WinXP-Examples: Class List

  • Main Page
  • Namespaces
  • Classes
  • Files
  • Directories
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

Class List

Here are the classes, structs, unions and interfaces with brief descriptions:
__POSITION |
_AcceptContext |
_ACCEPTEXARGS |
_ADOCollectionVtbl |
_ADODynaCollectionVtbl |
_ADOVtbl |
_AIO_WORK_ITEM |
_APPMEM_COUNTERS |
_APPMEM_DATA_DEFINITION |
_APPMEM_DATA_HEADER |
_APPMEM_INSTANCE |
_ASYNC_REQUEST |
_AUTH_SEQ |
_BALLDATA |
_BEZBUFFER |
_BINDING_ENTRY |
_BLRPLATE |
_BLRPLATECONFIG |
_BOUNCEDATA |
_BUFFER |
_ClientContext |
_CLIPBOOKSERVER_RESOURCE |
_CMD |
_CMDI |
_COLUMNDATA |
_CommandVtbl |
_CONFIGURATION_ENTRY |
_CONNECTEXARGS |
_ConnectionVtbl |
_COPY_CHUNK |
_CounterInfoBlock |
_CREDENTIAL |
_CSampleDropExt |
_CUSTOM_DIAL_DLG_SAMPLE_ |
_CUSTOM_ENTRY_DATA_SAMPLE_ |
_DATA_BUFFER |
_DEVICE_INFO |
_DIBDATA |
_DISCONNECTEXARGS |
_DLGITEMS |
_DOSDTTM |
_DRAWDATA |
_DRVLINE |
_DRVLINECONFIG |
_DSA_SEC_PAGE_INFO |
_DYNAMIC_LOCKS_STORE |
_DYNAMIC_READWRITE_LOCK |
_EAP_NAME_DIALOG |
_EAPCB |
_ENUMERATE_DIRECTORY_STACK |
_ENUMERATE_DIRECTORY_STATE |
_ERRORMAP |
_EVENT_ENTRY |
_EVENT_SINK_INFO |
_Events |
_ExpenseBuf |
_EXT_WSPPROC_TABLE |
_FFSTREAM |
_FileInfo |
_FILESHARESAMPLE_PROPS |
_FILESHARESAMPLE_RESOURCE |
_FILETIME |
_foo |
_FUNC_INFO |
_FundsRM |
_HASH_TABLE |
_htdata |
_IID |
_IMEUIDATA |
_INITDATA |
_INTERFACE_ENTRY |
_INTERFACEMAP |
_INTS |
_IO_WORK_ITEM |
_IOCTLARGS |
_IPSAMPLE_GLOBAL_CONFIG |
_IPSAMPLE_GLOBAL_STATS |
_IPSAMPLE_IF_BINDING |
_IPSAMPLE_IF_CONFIG |
_IPSAMPLE_IF_STATS |
_IPSAMPLE_IP_ADDRESS |
_IPSAMPLE_MIB_GET_INPUT_DATA |
_IPSAMPLE_MIB_GET_OUTPUT_DATA |
_IPSAMPLE_MIB_SET_INPUT_DATA |
_ITEM_DESC |
_Job |
_JOB_INFO |
_LOCAL_HEAP_INFO_BLOCK |
_LOCINFO |
_LOCKED_LIST |
_LSP_ENTRY |
_MAZEDATA |
_MEMORY_ALLOC_BLOCK |
_MESSAGE |
_metalookup |
_MIDL_PROC_FORMAT_STRING |
_MIDL_TYPE_FORMAT_STRING |
_MOF_INFO |
_MSD |
_MSDI |
_MSV1_0_INTERACTIVE_LOGON |
_MultiSelectCookies |
_MYDATA |
_MYXFORM |
_NAMEMAP |
_NETWORK_ENTRY |
_NoAddRefReleaseQIOnSmartPtr< T > |
_node_tag |
_OPEN_FILE |
_OPTIONS |
_PACKET |
_ParameterVtbl |
_PER_IO_CONTEXT |
_PER_SOCKET_CONTEXT |
_playinfo |
_POLYDATA |
_PREF |
_Printer |
_PROPIDLIST |
_PROPSETLIST |
_PROPSHEETCFG |
_PROPVALUE |
_PROVIDER |
_PRTDATA |
_QOS_OPTIONS |
_Query |
_Queue |
_QueueHashNode |
_QueueNode |
_RASHOST_DATA |
_READ_WRITE_LOCK |
_RecordsetVtbl |
_RECV_INFO |
_RECVARGS |
_RECVFROMARGS |
_REGSTRUCT |
_RqsConfigString |
_RqsEngineCbInfo |
_RSUMINFO |
_RU_SOCKET |
_RU_SOCKET_CREATE_DATA |
_RURASREGROOT |
_RUREGVALUE |
_SAMPLE_HELPER_DATA_ |
_SCHEMAINFO |
_SEARCH_REQUEST |
_SEARCH_REQUEST_STATE |
_SEC_CONTEXT |
_SEC_FUNC |
_SECTION |
_SEND_INFO |
_SENDARGS |
_SENDTOARGS |
_SFFS |
_Shutdown |
_SIGGEN_COUNTER |
_SIGGEN_DATA_DEFINITION |
_SIGNATURE |
_SNMP_MGR_SESSION |
_SOCK_INFO |
_socklist |
_SP_OPTIONS |
_STANDARDSECINMEM |
_STDZ |
_STREAM_FIND_DATA |
_stringstruct |
_SUMMARYINFO |
_SynchInfo |
_tag_MMC_VERSION_INFO |
_tag_NODE_ATTRIB_ |
_tagCol |
_tagCONFIGITEMLISTVIEWLPARAM |
_tagCONFIGSETTINGSLPARAM |
_tagDELETELOGERRORMSG |
_tagENABLEMODELESSMSG |
_tagESTABLISHCONNECTIONMSG |
_tagFILEOBJECT |
_tagGENERICITEM |
_tagGENERICITEMLIST |
_tagHANDLERITEM_SYNCSTATUS |
_tagHANDLERITEMSETTINGS |
_tagITEMCONFIGSETTINGSLPARAM |
_tagLISTPROP |
_tagLOGERRORMSG |
_tagLogon |
_tagMETHODARGS |
_tagPOSDATA |
_tagPOSTKEY |
_tagPREPAREFORSYNCCOMPLETEDMSG |
_tagPREPAREFORSYNCMSG |
_tagPROGRESSMSG |
_tagPROPSTRUCT |
_tagSAMPLEITEMSETTINGS |
_tagSHOWERRORCOMPLETEDMSG |
_tagSHOWERRORMSG |
_tagSHOWPROPERTIESCOMPLETEDMSG |
_tagSHOWPROPERTIESMSG |
_tagStatus |
_tagSYNCHRONIZECOMPLETEDMSG |
_tagSYNCHRONIZEMSG |
_tagTools |
_tagWorkerThreadArgs |
_threadparameters |
_THUMB |
_TIME |
_TRANSMITFILEARGS |
_TRANSMITPACKETSARGS |
_TYPEMAP |
_UNICODE_STRING |
_UNITSTABLE |
_USER_EVENT |
_USER_INFO |
_VIRTUAL_BUFFER |
_VOLUME_GET_GPT_ATTRIBUTES_INFORMATION |
_WAVE_DATA |
_WIDEDBIDMAP |
_WIDEGUIDMAP |
_WIDENAMEMAP |
_WORK_QUEUE |
_WORK_QUEUE_ITEM |
_WORK_THREAD_DATA |
_WSAOVERLAPPEDPLUS |
_WSARECVMSGARGS |
_XFORMDATA |
About |
AboutDlg |
ACCOUNT::CAccount |
ADDRESS_DATA |
ADOConnectionConstructionVtbl |
ADORecordsetConstructionVtbl |
ADsError |
ADSERRORLib::ADsError |
ADSFIRSTEXTLib::HelloWorld |
ADSTYPE_TO_STRING_ENTRY |
ADSTYPEsyntaxmapping |
ADVISE_SINK |
AgentNotifySink |
APIHook< T > |
APMFILEHEADER |
AppEvents |
ARRAYQ |
Async_Lib::AsyncTest |
ASYNC_REQUESTER |
ATLCONTROLLib::MMCControl |
ATTRIBUTES |
AUTH_DATA |
AUTHENTICATEPLUGINLib::AuthenticateAdmin |
AUTHENTICATEPLUGINLib::AuthenticateContext |
AUTHENTICATEPLUGINLib::AuthenticatePlugin |
AutoClaims::AutoClaims | The AutoClaims Sample Application form class
AutoClaims::InkLayer | InkLayer represents a given ink layer, which has a color and visibility setting associated with it
BANDINFOSTRUCT |
BANKVCLib::Account |
BANKVCLib::CreateTable |
BANKVCLib::MoveMoney |
BINDINGINFO |
blockTag |
BROCHUREMACHINELib::PTLauncher |
BROWSER_CONFIG |
BSTRING |
BTSTR |
CAboutDlg |
CAccount |
CachePluginAdmin |
CacheProxySamplePlugin::CacheProxyPlugin | Summary description for Class1
CacheProxySamplePlugin::ContentInfo |
CacheProxySamplePlugin::INSSBufferImpl |
CacheProxySamplePlugin::IWMSCacheItemCollectionImpl |
CacheProxySamplePlugin::IWMSCacheItemDescriptorImpl |
CacheProxySamplePlugin::PlaylistItem |
CActivitySub |
CAddDeviceDlg |
CAddFolderDlg |
CAddrNode |
CAddVFileDlg |
CAdminNotifyHandler |
CADOComponent |
CADQIApp |
CADQIDlg |
CADsFirstExtApp |
CADsSearch |
CADVCGENApp |
CADVCGENDlg |
CAdvClientDlg |
CAdvRecoApp |
CAgentCtlAnimationNames |
CAgentCtlAudioObject |
CAgentCtlBalloonEx |
CAgentCtlCharacterEx |
CAgentCtlCharacters |
CAgentCtlCommandEx |
CAgentCtlCommandsEx |
CAgentCtlEx |
CAgentCtlPropertySheet |
CAgentCtlRequest |
CAgentCtlUserInput |
CAggregate |
CallbackIUnknownLib::DeviceFinderCallBackInterface |
CallbackIUnknownLib::ServiceCallBackInterface |
CAlterColumnDlg |
CAlterIndexDlg |
CAlterTableDlg |
CAnchorTag |
CAnnotator |
CAPIApp |
CAPIDoc |
CAPIView |
CapJ | .import("USER32", auto)
CAppExportDlg |
CAppInfo |
CAppInstallDlg |
CApplet |
CAppletSession |
CAppLite |
CAppShareNotify |
CAppSub |
CAppUtilDlg |
cascadeec::CascadeEC | .register(clsid=8CE4A9E0-0FC1-11D3-925A-0080C7C30D72, typelib=7508F170-0FC1-11D3-925A-0080C7C30D72, version="1.0", description="Cascade Class")
cascadeec::INewsEvent | .interface(iid=4BF5E480-A5D3-11D2-AD4D-0080C7BFF6DB, thread=AUTO, type=DUAL)
cascadeec::INewsEventDefault | .interface(iid=00020400-0000-0000-C000-000000000046, thread=AUTO, type=DUAL)
CAssoc< KEY, VALUE > |
CAsyncFullServ |
CAsynchBase |
CAsynchNotify |
CAsyncQuerySink |
CAsyncTest |
CAsyncTest::threadParam |
CAsyncXXX< T, ISyncFace, IAsyncFace > |
CAttributeValueAddButton |
CAttributeValueDeleteButton |
CAttributeValueEditButton |
CAttributeValueEditor |
CAuthenticateAdmin |
CAuthenticateContext |
CAuthenticatePlugin |
CAVIFileReader |
CAVIFileWriter |
CBackground |
CBackgroundCopyCallback |
CBackgroundFolder |
CBankDlg |
CBase |
CBaseDialog |
CBaseNode |
CBaseObj |
CBasePropertyPage |
CBehavior |
CBicycle |
CBicycleFolder |
CBinder |
CBindings |
CBitArray |
CBitmapWnd |
CBlackPen |
CBlockFormat |
CBlockFrame |
CBox |
CBoxFormat |
CBrowserHost |
CBrush |
CBSTR |
CButtonLite |
CByotTransObj |
CCacheMapEl |
CCallAs |
CCallAsFactory |
CCallBack |
CCallbackWrapper |
CCallNotify |
CCanvas |
CCapMFCApp |
CCapMFCDlg |
CCascade |
CCaseTextService |
CCertEncodeAltName |
CCertEncodeBitString |
CCertEncodeCRLDistInfo |
CCertEncodeDateArray |
CCertEncodeLongArray |
CCertEncodeStringArray |
CCertExitSample |
CCertManageExitModuleSample |
CCertManagePolicyModuleSample |
CCertPolicySample |
CChannelNotify |
CCharBlock |
CCharGrid |
CChildView |
CClassFactory |
CClassFactoryWrapper |
CClassPro |
CClientApp |
CClientDlg |
CClipBookServerApp |
CClipBookServerParamsPage |
CCloseQueueDialog |
CClusPropList |
CClusPropValueList |
CClusterData |
CClusterUtils |
CCmdLineConsumerApp |
CCmdLineConsumerDlg |
CCmdLineLite |
CCodeGrid |
CColumnInfo |
CColumnProvider |
CComboBoxEx |
CComboBoxGuid |
CComboBoxLite |
CComboBoxString |
CCommand |
CCommBand |
CCompartmentMonitor |
CCompImportDlg |
CCompInstallDlg |
CComponent |
CComponentData |
CCompositionEditSession |
CComputer |
CComSpy |
CComSpyPropPage |
CComSpySqlAudit |
CComSyncTest |
CComWSTR |
CConfNotify |
CConnectDlg |
CConnectionPoint |
CConnectionPointContainer |
CConsole |
CConstraintDlg |
CConsumer |
CContainerBase |
CContext |
CContextAdmin |
CContextMenu |
CContextMenuExtension |
CContextPlugin |
CContextSamplePropPage |
CController |
CCounterData |
CCreateQueueDialog |
CCreateTable |
CCriticalSection |
CCrmDebugCompensator |
CCrmFilesCompensator |
CCrmFilesTest |
CCrmFilesWorker |
CCrmMonComp |
CCRMSub |
CCTypeSet |
CCustomError |
CCustomPropertyStore |
CDataAccess |
CDataGrid |
CDataLinks |
CDataNotify |
CDataObject |
CDataset |
CDataSource |
CDataXferObj |
CDbAlloc |
CDBAuthAdmin |
CDBAuthPlugin |
CDBFile |
CDBSession |
CDefClassFactory |
CDelegationBase |
CDeleteObjectDlg |
CDeleteQueueDialog |
CDeskBand |
CDeviceFinderCallback |
CDeviceNode |
CDeviceProp |
CDialogBase |
CDialogLite |
CDialogStream |
CDimmer |
CDimmerService |
CDisdrawApp |
CDisdrawDlg |
CDisplayAttributeInfo |
CDlgDest |
CDlgIADs |
CDlgIADsContainer |
CDlgIADsLargeInteger |
CDlgIADsOpenDSObject |
CDlgIADsPropertyList |
CDlgIADsSecurityDescriptor |
CDlgIDirectoryObject |
CDlgIDirectorySearch |
CDlgSrc |
CDllData |
CDllShared |
CDog |
CDownloadBindStatusCallback |
CDownloadUI |
CDragSource |
CDrawArea |
CDropObject |
CDropSource |
CDropTarget |
CDSLAdvancedPage |
CDSLConnectionPage |
CDSLContextBox |
CDynamic |
CDynamicResultset |
CEapCfg |
CEditBoxLite |
CEditSessionBase |
CEditValueDlg |
CellData |
CellDataList |
CellPos |
CEmptyVolumeCache |
CEnlistTransaction |
CEntity |
CEnumConnectionPoints |
CEnumConnections |
CEnumDisplayAttributeInfo |
CEnumerator |
CEnumFormatEtc |
CEnumIDList |
CEnumStorageResource |
CEnumSyncMgrItems |
CEnumTASK |
CEnumXXX< T, ELT_T, IFACE > |
CError |
CERTEXITSAMPLELib::CCertExitSample |
CERTEXITSAMPLELib::CCertManageExitModuleSample |
CERTPOLICYSAMPLELib::CCertManagePolicyModuleSample |
CERTPOLICYSAMPLELib::CCertPolicySample |
CEvent |
CEventSink |
CEvtStoreSub |
CException |
CExceptionSub |
CExecuteParamDlg |
CExeModule |
CExList< TYPE > |
CExplorerBar |
CExtBuffer |
CExtendContextMenuEx |
CExtendPropertySheet |
CExtObject |
CExtPageUser |
CExtractIcon |
CFactory |
CFactoryData |
CFastVariant |
CFileIdx |
CFileIO |
CFileLite |
CFileShareSampleApp |
CFileShareSampleParamsPage |
CFileStream |
CFileTransferNotify |
CFileViewer |
CFixedAlloc |
CFixedAlloc::CNode |
CFlipDocEditSession |
CFlipEditSession |
CFolderNode |
CFont |
CFontRange |
CFontSelect |
CFontSet |
CFrame |
CFrameFormat |
CFrameWndLite |
CFreeTest |
CFtNotify |
CFullConnect |
CFullConnectOptions |
CFullConnectProperties |
CFullConnectProvider |
CFullConnectSecurity |
CFullPropSpec |
CFullServ |
CFVClassFactory |
CGdiplusInit |
CGenerateRC |
CGenericEnum |
CGenericUCPApp |
CGenericUCPDlg |
CGetInfoExDlg |
CGetReceipt |
CGrid |
CGridIt |
CGroupData |
CHandler |
CHello |
CHelloClassFactory |
CHelloEditSession |
CHILD_PROPERTIES |
CHILDWINDOWDATA |
CHiPerfProvider |
CHMMSampleApp |
CHourglass | CHourglass: Manages the hourglass and mouse capture
CHtmlElemBagEntry |
CHtmlElement |
CHtmlElementBag |
CHtmlIFilter |
CHtmlIFilterBase |
CHtmlIFilterCF |
CHtmlScanner |
CHuman |
CIceSkate |
CIceSkateFolder |
CIdentitySub |
CImageTag |
CImp_DrawApp |
CImp_DrawDlg |
CImp_DrawDlg::Line |
CImpAuth |
CImpIAccessor |
CImpIAdviseSink |
CImpIBindResource |
CImpIColumnsInfo |
CImpICommandProperties |
CImpICommandText |
CImpIConvertType |
CImpICreateRow |
CImpIDBBinderProperties |
CImpIDBCreateCommand |
CImpIDBCreateSession |
CImpIDBInfo |
CImpIDBInitialize |
CImpIDBProperties |
CImpIFileViewer |
CImpIGetDataSource |
CImpIGetRow |
CImpIGetSession |
CImpIGetSourceRow |
CImpIOleClientSite |
CImpIOleDocumentSite |
CImpIOleInPlaceSite |
CImpIOpenRowset |
CImpIPersist |
CImpIPersistFile |
CImpIRow |
CImpIRowChange |
CImpIRowset |
CImpIRowsetChange |
CImpIRowsetIdentity |
CImpIRowsetInfo |
CImpIServiceProvider |
CImpISessionProperties |
CImpISpecifyPropertyPages |
CImpIStream |
CImportRes |
CInitStringBox |
CInkInputWnd |
CInputTag |
CInstanceSub |
CInstPro |
CInterfaceDlg |
CIntTrace |
CIsapiCertPolicyFilter |
CISeqStream |
CKeystrokeEditSession |
CLandBasedVehicle |
CLangBarItemButton |
CLanguageResourceSampleCF |
Class1 |
CLBSub |
CLDisp |
CLERK_ENTRY |
ClientList |
ClientList::_tag_LIST_NODE |
ClientList::Iterator |
CLine |
CLine::LINEDATA |
CLineGrid |
CLinkable |
CList< TYPE, ARG_TYPE > |
CListBoxLite |
CListener |
CListHeader |
CListViewLite |
CLListImpl< TYPE, ARG_TYPE > |
CLListImpl< TYPE, ARG_TYPE >::CNode |
CLocateDialog |
CLock |
CLockHandler |
CLogFile |
CLoginDlg |
CLUADMEXLib::CoClipBookServerEx |
CLUADMEXLib::CoFileShareSampleEx |
CMain |
CMainFrame |
CMainWindow |
CMallocSpy |
CMap< KEY, ARG_KEY, VALUE, ARG_VALUE > |
CMarkTextService |
CMD_ARGS |
CMDIChild |
CMDIChildLite |
CMDIFrameLite |
CMDIObjects |
CMDITrace |
CMember |
CMemoryException |
CMemoryMappedInputStream |
CMessageDlg |
CMetaTag |
CMethodPro |
CMethodSub |
CMgdClusCfgInit |
CMgdResType |
CMgrNotify |
CMMCControl |
CMmStream |
CMmStreamBuf |
CMmStreamConsecBuf |
CModel |
CMonitor |
CMonitorServer |
CMoveDlg |
CMoveMoney |
CMSMQEventHandler |
CMSOmniProvCommand |
CMSOmniProvRowset |
CMSOmniProvSession |
CMSOmniProvSessionColSchemaRowset |
CMSOmniProvSessionPTSchemaRowset |
CMSOmniProvSessionTRSchemaRowset |
CMSOmniProvSource |
CMultichanApp |
CMultipleResults |
CMultipleResultsDlg |
CMultiRecoApp |
CMultiValuedAttributeEditor |
CMultiValuedListBox |
CMyCapabilities |
CMyEventProvider |
CMyEvictListener |
CMyInkCollector |
CMyInkEvents |
CMyMemberSetChangeListener |
CMySink |
CMyStartupListener |
CMyUIExtApp |
CMyUIExtModule |
CMyWizExtApp |
CMyWizExtModule |
CNetInterfaceData |
CNetworkData |
CNewsEvent |
CNode< TYPE > |
CNodeData |
CNotify |
CNullModem |
CObjConstSub |
CObjData |
CObject |
CObjPool2Sub |
CObjPoolSub |
CObjSecurity |
CObjSub |
CObjTree |
COBLIST |
COBNODE |
CODBCData |
COfficeDlg |
COL |
COLDESC |
COleClient |
COLEDBComponent |
COleDocument |
COleDocumentView |
COleInPlaceActiveObject |
COleInPlaceObject |
COleObject |
COLORPICKSTATE |
ColProps |
ColPropsList |
COLUMNDATA |
comadmin::COMAdminAccessChecksLevelOptions |
comadmin::COMAdminActivationOptions |
comadmin::COMAdminApplicationExportOptions |
comadmin::COMAdminApplicationInstallOptions |
comadmin::COMAdminAuthenticationCapabilitiesOptions |
comadmin::COMAdminAuthenticationLevelOptions |
comadmin::COMAdminCatalog | .class(classid=F618C514-DFB8-11D1-A2CF-00805FC79235,DynamicCasts) .interface(iid=DD662187-DFC2-11D1-A2CF-00805FC79235, thread=AUTO, type=DUAL)
comadmin::COMAdminCatalogCollection | .class(classid=F618C516-DFB8-11D1-A2CF-00805FC79235,DynamicCasts) .interface(iid=6EB22872-8A19-11D0-81B6-00A0C9231C29, thread=AUTO, type=DUAL)
comadmin::COMAdminCatalogObject | .class(classid=F618C515-DFB8-11D1-A2CF-00805FC79235,DynamicCasts) .interface(iid=6EB22871-8A19-11D0-81B6-00A0C9231C29, thread=AUTO, type=DUAL)
comadmin::COMAdminComponentFlags |
comadmin::COMAdminErrorCodes |
comadmin::COMAdminFileFlags |
comadmin::COMAdminImpersonationLevelOptions |
comadmin::COMAdminOS |
comadmin::COMAdminServiceOptions |
comadmin::COMAdminServiceStatusOptions |
comadmin::COMAdminSynchronizationOptions |
comadmin::COMAdminThreadingModels |
comadmin::COMAdminTransactionOptions |
comadmin::ICatalogCollection | .interface(iid=6EB22872-8A19-11D0-81B6-00A0C9231C29, thread=AUTO, type=DUAL)
comadmin::ICatalogObject | .interface(iid=6EB22871-8A19-11D0-81B6-00A0C9231C29, thread=AUTO, type=DUAL)
comadmin::ICOMAdminCatalog | .interface(iid=DD662187-DFC2-11D1-A2CF-00805FC79235, thread=AUTO, type=DUAL)
compitem |
complist |
COMPlus | This class is designed to be packaged with a COM DLL output format
COMSPYAUDITLib::ComSpyAudit |
COMSPYCTLLib::ComSpy |
COMSPYCTLLib::ComSpyPropPage |
Conf |
CONotify |
CONST_DWORD_REP |
CONST_GUID_REP |
CONST_WORD_REP |
ContextNameHint |
CONTEXTSAMPLEPROPPAGELib::ContextSamplePropPage |
COpenQueueDialog |
COptionsAccessor |
COptionsCommand |
COptionsDataSource |
COptionsError |
COptionsNotify |
COptionsRowset |
COptionsSheet |
COrder |
COShip |
COShip2 |
Counter |
CPack |
CPage |
CPageFormat |
CPaintCanvas |
CParameters |
CPartitionInfo |
CPeoplePoweredVehicle |
CPermEventsApp |
CPermEventsDlg |
CPersistFile |
CPersistStorage |
CPerson |
CPidlMgr |
CPingResponder |
CPlane |
CPlex |
CPlgFilter |
CPlgPin |
CPlgTermSample |
CPluggableTransport |
CPoint |
CPoint::POINT |
CPooledData |
CPower |
CPrintAux |
CPrintCanvas |
CPrintRequest |
CPrintSDIApp |
CPrintSDIDoc |
CPrintSDIView |
CProcessDlg |
CProgress |
CProperties |
CPropertiesBase |
CPropertiesDlg |
CPropertyEditSession |
CPropertyIDs |
CPropertyInfos |
CPropertyPage |
CPropertyTag |
CPropIDSets |
CPropInfoSets |
CPropPageLite |
CProppageUser |
CProppageUserUI |
CPropPro |
CPropSets |
CPropSheetExtension |
CPropSheetHost |
CPropSheetLite |
CProvFactory |
CProvider |
CProvider_IWbemEventConsumerProvider |
CProvider_IWbemEventProvider |
CProvider_IWbemServices |
CProvider_IWbemUnboundObjectSink |
CProviderFactory |
CProxy |
CProxyIRowsetNotify< T > |
CProxyPlugin |
CProxyPlugin::COpState |
CPSTN |
CPTLauncher |
CQCSub |
CQueryBox |
CQueryDlg |
CQuickStringWrap |
CRDOComponent |
CREATEDATA |
CREATEGIZMOA |
CREATEGIZMOW |
CReceiveMessageDialog |
CReceiveWaitDialog |
CRecoOutputWnd |
CRefClient |
CRefCount |
CRefresher |
CRefresherMember< T > |
CRegAccess |
CReindeer |
CRenameDlg |
CRequestInstance |
CResData |
CResourceSub |
CResString |
CResTypeData |
CResultset |
CRichEditLite |
CRocket |
CRow |
CRowPosition |
CRowset |
CRowsetViewerDlg |
CRTCAVSession |
CRTCEvents |
CRTCIMSession |
CRTCIncomingApp |
CRTCIncomingDlg |
CRTCOutgoingApp |
CRTCOutgoingDlg |
CRTCSession |
CRTCWin |
CS1Dialog |
CS2Dialog |
CS3Dialog |
CS4Dialog |
CSAFEARRAY |
CSafeRefCount |
CSampleDataContainer |
CSampleDataSource |
CSampleDirectory |
CSampleDirectoryInfo |
CSampleInstance |
CSampleMSP |
CSampleMSPCall |
CSampleMSPStream |
CSamplePipe |
CSampleStemmer |
CSampleWordBreaker |
CSchemaDlg |
CSCP |
CSCPCMenuApp |
CSCPCMenuDialog |
CSCPContextMenuModule |
CSCPPageBindingInfo |
CSCPPageGeneral |
CSCPPageKeywords |
CSCPUIBindingInfo |
CSCPUIGeneral |
CSCPUIKeywords |
CSCPWiz |
CSCPWizApp |
CSCPWizModule |
CScreenCanvas |
CScriptTag |
CScrollableView |
CScrollBarLite |
CSDKSamplePlaylistParser |
CSDKSamplePlaylistParserPlugin |
CSDKSampleStorageSystem |
CSecureObject |
CSecuritySub |
CSelectEventsDlg |
CSendMessageDialog |
CSerialStream |
CServer |
CServerDlg |
CServiceCallback |
CServiceComp |
CSession |
CSessionDlg |
CSet |
CSettings |
CSharp_Draw::Form1 | Form1 is the main form for sending and receiving Drawing commands using MSMQ
CSharp_Draw::InputBox | Summary description for InputBox
CShellExt |
CShellExtClassFactory |
CShellFolder |
CShellIconOverlayID |
CShellView |
CShutdownDlg |
CSids |
CSimple |
CSimpleApp |
CSimpleArray< T > |
CSimpleClass |
CSimpleDialog |
CSimpleDoc |
CSimpleObject |
CSimpleSite |
CSimpSvrApp |
CSimpSvrDoc |
CSimpSvrObj |
CSite |
CSkateboard |
CSkateboardFolder |
CSkyBasedVehicle |
CSkyVehicle |
CSmartComPtr< T > |
CSmartPtr< T > |
CSmartPtrTrace< T > |
CSmpFilter |
CSmpFilterCF |
CSnap |
CSnapinAbout |
CSnoopWnd |
CSpaceFolder |
CSpaceStation |
CSpaceVehicle |
CSpecialCharHashEntry |
CSpecialCharHashTable |
CSplitterLite |
CSpyCon |
CStabilize |
Cstack_c |
CStartOfFileElement |
CSTATest |
CStaticEntity |
CStaticMap |
CStaticNode |
CStaticNode::privateData |
CStatusBarLite |
CStatusHelper |
CStdDbOutput |
CStorageBuffer |
CStorageResource |
CStorageResType |
CStream |
CString |
CStringData |
CStringException |
CStringTable |
CSurrogate |
CSyncMgrHandler |
CSysLCESub |
CTable |
CTableCopy |
CTabLite |
CTAPIEventNotification |
CTE_ENCODER_STRUCT |
CTerminateCompositionEditSession |
CTestApp |
CTestCOMPerformance |
CTestDlg |
CTestDoc |
CTestView |
CTextElement |
CTextField |
CTextGrid |
CThreadData |
CThreadSub |
CThumbNailPhotoHolder |
CTIMER |
CTitleTag |
CToken |
CToolBand |
CToolBarExtension |
CToolBarLite |
CTransaction |
CTransactionOptions |
CTreeViewLite |
CTSFDataObject |
CTSFEditWnd |
CTSFMainWnd |
CTSFPersistentPropertyLoader |
CTxSub |
CTypesDialog |
CUnknown |
CUpdateReceipt |
CUpdateTextEditSession |
CUrlmonCallback |
CUserSub |
CUtil |
CUtilBSTR |
CUtilComPtr< T > |
CUtilitiesDlg |
CUtilProp |
CUtilString |
CVariant |
CVARIANT |
CVCExploreApp |
CVCExploreDlg |
CVCSecuritySampleClass |
CVector< TYPE, IDX > |
CVectorEx< TYPE, IDX > |
CView |
CViewList |
CVirtualFile |
CWaitCursor |
CWaitDlg |
CWaitSystemDlg |
CWbemClientApp |
CWbemClientDlg |
CWebBrowser |
CWiaDataCallback |
CWinApp |
CWindow |
CWizard |
CWizExtUser |
CWndLite |
CWorkerThread |
CWrapVBComponent |
CX224 |
CXmlDOM |
CXMLTreeApp |
CXMLTreeDlg |
DBCONN |
DBG_THREAD_INFO |
DEB_DLL_LIST_INFO_STRUCT |
DEB_DLL_NODE_INFO_STRUCT |
DEB_PROCESS_LIST_INFO_STRUCT |
DEB_PROCESS_NODE_INFO_STRUCT |
DEB_STARTUP_INFO_STRUCT |
DEB_THREAD_LIST_INFO_STRUCT |
DEB_THREAD_NODE_INFO_STRUCT |
DebugGlobals | Debug variables
Deers |
direct |
diritem |
dirlist |
DOREGSTRUCT |
DTHandler |
DWSTR |
ECB_QUEUE_ENTRY |
EDANNOTATORLib::Annotator |
EDCOMMANDSLib::BrowserHost |
EDGLYPHSLib::BrowserHost |
EDHOSTLib::BrowserHost |
EDHOSTLib::Grid |
EDHOSTLib::Snap |
EDITARGS |
ENUMINFO |
ENUMSYMDATA |
ErrorsVtbl |
ErrorVtbl |
EventID |
EXEDLLICONINFO |
EXTENDER_NODE |
EXTENSION_NODE |
FaxDlg |
FieldInfo |
FieldsVtbl |
FieldVtbl |
FILE_CONTEXT_TYPE |
filebuffer |
filedata |
FILEDEX |
fileline |
FileRepClient |
FileRepServer |
FLAGMAPPING |
FONTENUM |
FONTLIST |
fullsvr::AsyncFullServ | .class(classid=F03BE176-A8DE-40D1-9161-A36BCBE1FEA6,DynamicCasts) .interface(iid=D3140113-D43F-4718-9119-EF62D631F2AB, thread=AUTO)
fullsvr::AsyncIFullServ | .interface(iid=D3140113-D43F-4718-9119-EF62D631F2AB, thread=AUTO)
fullsvr::FullServ | .class(classid=F03BE175-A8DE-40D1-9161-A36BCBE1FEA6,DynamicCasts) .interface(iid=D3140112-D43F-4718-9119-EF62D631F2AB, thread=AUTO)
fullsvr::ICallFactory | .interface(iid=1C733A30-2A1C-11CE-ADE5-00AA0044773D, thread=AUTO)
fullsvr::ICancelMethodCalls | .interface(iid=00000029-0000-0000-C000-000000000046, thread=AUTO)
fullsvr::IFullServ | .interface(iid=D3140112-D43F-4718-9119-EF62D631F2AB, thread=AUTO)
fullsvr::ISynchronize | .interface(iid=00000030-0000-0000-C000-000000000046, thread=AUTO)
GBGETINT |
GBGETTEXTA |
GBGETTEXTW |
GBMSG |
GBSETINT |
GLOBAL_STRUCT |
GlobalVars |
gss_buffer_desc_struct |
gss_channel_bindings_struct |
gss_OID_desc_struct |
gss_OID_set_desc_struct |
Hello2J |
Hello3J |
HelloJ |
HelloWorld |
helper::DatabaseSettings |
helper::sampleConstants |
HtmlPropIFilter |
HtmlPropIFilterCF |
HTTP_REQUEST_PARAM |
HTTP_REQUEST_RANGE |
HTTP_REQUESTCB_PARAM |
IAccount |
IADsError |
IADsErrorVtbl |
IAnnotator |
IAppletNotifyVtbl |
IAppletSessionNotifyVtbl |
IAppletSessionVtbl |
IAppletVtbl |
IAuthenticateAdmin |
IAuthenticateContext |
IAuthenticatePlugin |
IBehavior |
IBrowserHost |
icmp_hdr |
icmpv6_echo_request |
icmpv6_hdr |
IComSpy |
IComSpyAudit |
ICOMSysLCE |
ICONDIR |
ICONDIRENTRY |
ICONIMAGE |
IConnectionPointImpl |
ICONRESOURCE |
ICreateTable |
IDBAuthAdmin |
IDBAuthPlugin |
IDimmer |
IDimmerService |
IDispEventSimpleImpl |
IEnumConnectionPoints |
IEnumConnections |
IEventSink |
IFactory |
igmp_group_record_v3 |
igmp_hdr |
igmp_hdr_query_v3 |
igmp_hdr_report_v3 |
IGrid |
IHelloWorld |
IHelloWorldVtbl |
IIDLookUp |
IInkCollectorEventsImpl< T > |
IInkRecognitionEventsImpl< T > |
IMMCControl |
IMMCControlVtbl |
IMoveMoney |
IMyPersistStreamImpl< T > |
INDEXINFO |
InitOle |
InkBlog::_Default | The Default code-behind page
InkBlog::AddBlog | The AddBlog code-behind page
InkBlog::InkArea | The InkArea Sample Control class
InkClipboard::InkClipboard | The InkClipboard with Selection Sample Application form class
InkCollection::InkCollection | The InkCollection Sample Application form class
InkCollectorEvents |
InkErase::InkErase | Summary description for InkErase
InkHitTest::InkHitTest | The InkHitTest Sample Application form class
InkRecognition::InkRecognition | The InkRecognition Sample Application form class
InstDef |
INVOKE_INFO |
ip_hdr |
IPartitionProperties |
IPluggableTransport |
IPTLauncher |
ipv4_option_hdr |
ipv6_fragment_hdr |
ipv6_hdr |
IRowsetChange |
IRowsetChangeImpl< T, Storage, RowClass > |
IRowsetScrollImpl< T, RowsetInterface > |
ISAPI_BUFFER |
ISAPI_EXTENSION |
ISAPI_REQUEST |
ISAPI_STRING |
ISAPI_STRINGW |
ISAPITHREAD |
ISnap |
IStorageProperties |
ISynchronize |
item_tag |
ITEMINFO |
itemlist |
ITest |
IUPnPService_DimmingService_SCPD |
IUPnPService_DimmingService_SCPDVtbl |
IWMIObject |
IWMIServices |
IWMSCacheAdmin |
IWMSContextAdmin |
IWMSContextPlugin |
KEY_HEADER |
LessThan< Item > |
LineData |
LIST_STRUCT |
LOGON_DATA |
LOGPAL |
MainDlg |
Margin |
MEMICONDIR |
MEMICONDIRENTRY |
MGDRESOURCELib::ClipBookServer |
mib_entry |
Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm | InkDivider sample application form class
Microsoft::Samples::Ink::Cs::InkZoom::InkZoom | The InkZoom Sample Application form class
Microsoft::Uddi::Demo::Publish |
msado15::_ADO | .interface(iid=00000534-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)
msado15::_Collection | .interface(iid=00000512-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)
msado15::_Command | .interface(iid=0000054E-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)
msado15::_Connection | .interface(iid=00000550-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)
msado15::_DynaCollection | .interface(iid=00000513-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)
msado15::_Parameter | .interface(iid=0000050C-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)
msado15::_Record | .interface(iid=00000562-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)
msado15::_Recordset | .interface(iid=00000556-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)
msado15::_Stream | .interface(iid=00000565-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)
msado15::ADCPROP_ASYNCTHREADPRIORITY_ENUM |
msado15::ADCPROP_AUTORECALC_ENUM |
msado15::ADCPROP_UPDATECRITERIA_ENUM |
msado15::ADOCommandConstruction | .interface(iid=00000517-0000-0010-8000-00AA006D2EA4, thread=AUTO)
msado15::ADOConnectionConstruction | .interface(iid=00000551-0000-0010-8000-00AA006D2EA4, thread=AUTO)
msado15::ADOConnectionConstruction15 | .interface(iid=00000516-0000-0010-8000-00AA006D2EA4, thread=AUTO)
msado15::ADORecordConstruction | .interface(iid=00000567-0000-0010-8000-00AA006D2EA4, thread=AUTO)
msado15::ADORecordsetConstruction | .interface(iid=00000283-0000-0010-8000-00AA006D2EA4, thread=AUTO)
msado15::ADOStreamConstruction | .interface(iid=00000568-0000-0010-8000-00AA006D2EA4, thread=AUTO)
msado15::AffectEnum |
msado15::BookmarkEnum |
msado15::CEResyncEnum |
msado15::Command | .class(classid=00000507-0000-0010-8000-00AA006D2EA4,DynamicCasts) .interface(iid=0000054E-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)
msado15::Command15 | .interface(iid=00000508-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)
msado15::CommandTypeEnum |
msado15::CompareEnum |
msado15::Connection | .class(classid=00000514-0000-0010-8000-00AA006D2EA4,DynamicCasts) .interface(iid=00000550-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)
msado15::Connection15 | .interface(iid=00000515-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)
msado15::ConnectionEvents | .interface(iid=00000400-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DISPATCH)
msado15::ConnectionEventsVt | .interface(iid=00000402-0000-0010-8000-00AA006D2EA4, thread=AUTO)
msado15::ConnectModeEnum |
msado15::ConnectOptionEnum |
msado15::ConnectPromptEnum |
msado15::CopyRecordOptionsEnum |
msado15::CursorLocationEnum |
msado15::CursorOptionEnum |
msado15::CursorTypeEnum |
msado15::DataTypeEnum |
msado15::EditModeEnum |
msado15::Error | .interface(iid=00000500-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)
msado15::Errors | .interface(iid=00000501-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)
msado15::ErrorValueEnum |
msado15::EventReasonEnum |
msado15::EventStatusEnum |
msado15::ExecuteOptionEnum |
msado15::Field | .interface(iid=0000054C-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)
msado15::Field15 | .interface(iid=00000505-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)
msado15::FieldAttributeEnum |
msado15::FieldEnum |
msado15::Fields | .interface(iid=00000564-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)
msado15::Fields15 | .interface(iid=00000506-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)
msado15::Fields20 | .interface(iid=0000054D-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)
msado15::FilterGroupEnum |
msado15::GetRowsOptionEnum |
msado15::IRecFields | .interface(iid=00000563-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)
msado15::IsolationLevelEnum |
msado15::LineSeparatorEnum |
msado15::LockTypeEnum |
msado15::MarshalOptionsEnum |
msado15::MoveRecordOptionsEnum |
msado15::ObjectStateEnum |
msado15::Parameter | .class(classid=0000050B-0000-0010-8000-00AA006D2EA4,DynamicCasts) .interface(iid=0000050C-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)
msado15::ParameterAttributesEnum |
msado15::ParameterDirectionEnum |
msado15::Parameters | .interface(iid=0000050D-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)
msado15::PersistFormatEnum |
msado15::PositionEnum |
msado15::Properties | .interface(iid=00000504-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)
msado15::Property | .interface(iid=00000503-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)
msado15::PropertyAttributesEnum |
msado15::Record | .class(classid=00000560-0000-0010-8000-00AA006D2EA4,DynamicCasts) .interface(iid=00000562-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)
msado15::RecordCreateOptionsEnum |
msado15::RecordOpenOptionsEnum |
msado15::Recordset | .class(classid=00000535-0000-0010-8000-00AA006D2EA4,DynamicCasts) .interface(iid=00000556-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)
msado15::Recordset15 | .interface(iid=0000050E-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)
msado15::Recordset20 | .interface(iid=0000054F-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)
msado15::Recordset21 | .interface(iid=00000555-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)
msado15::RecordsetEvents | .interface(iid=00000266-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DISPATCH)
msado15::RecordsetEventsVt | .interface(iid=00000403-0000-0010-8000-00AA006D2EA4, thread=AUTO)
msado15::RecordStatusEnum |
msado15::RecordTypeEnum |
msado15::ResyncEnum |
msado15::SaveOptionsEnum |
msado15::SchemaEnum |
msado15::SearchDirectionEnum |
msado15::SeekEnum |
msado15::Stream | .class(classid=00000566-0000-0010-8000-00AA006D2EA4,DynamicCasts) .interface(iid=00000565-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)
msado15::StreamOpenOptionsEnum |
msado15::StreamReadEnum |
msado15::StreamTypeEnum |
msado15::StreamWriteEnum |
msado15::StringFormatEnum |
msado15::XactAttributeEnum |
MSDFHDL::IDataFactoryHandler |
MSDFMAPLib::Handler |
MyClassFactory |
MyDataSource | .register ( clsid=81C75D38-790A-11D2-8A61-0060088F441E, typelib=81C75D37-790A-11D2-8A61-0060088F441E )
MYDEVICELib::Dimmer |
MYDEVICELib::DimmerService |
MYDEVICELib::IUPnPService_DimmingService_SCPD |
MyOSPObject |
MyStorageResourceLib::CEnumStorageResource |
MyStorageResourceLib::CPartitionInfo |
MyStorageResourceLib::CStorageResource |
MyStorageResourceLib::CStorageResType |
MyString |
MYTOOLINFO |
NewDocDlg |
newseventclass::INewsEvent | .interface(iid=4BF5E480-A5D3-11D2-AD4D-0080C7BFF6DB, thread=AUTO, type=DUAL)
newseventclass::INewsEventDefault | .interface(iid=00020400-0000-0000-C000-000000000046, thread=AUTO, type=DUAL)
newseventclass::NewsEvent | .register(clsid=997FF9C0-0F01-11D3-9257-0080C7C30D72, typelib=94007C90-0F00-11D3-9257-0080C7C30D72, version="1.0", description="NewsEvent Class")
NewsFlash | This class can take a variable number of parameters on the command line
NewsSubscriber | This class can take a variable number of parameters on the command line
NIDeque_c< T > |
NIDequeIter_c< T > |
NILNode_c< T > |
NODE_PROPERTIES |
NODE_STRUCT |
NODESTRUCT |
NONDIALTOKENS |
Note |
Notify |
Object_Property |
PaperForm::PaperForm | The PaperForm Sample Application form class
ParametersVtbl |
params |
perf |
persistatl::INewsEvent | .interface(iid=4BF5E480-A5D3-11D2-AD4D-0080C7BFF6DB, thread=AUTO, type=DUAL)
persistatl::INewsEventDefault | .interface(iid=00020400-0000-0000-C000-000000000046, thread=AUTO, type=DUAL)
persistatl::NewsEvent | .register(clsid=6B834DA0-A5D3-11D2-AD4D-0080C7BFF6DB, typelib=04A47040-A5D3-11D2-AD4D-0080C7BFF6DB, version="1.0", description="NewsEvent Class")
PersistedConfiguration |
PersistedConfigurationDataSet |
PickleControlBlock |
pipe_state |
PLGTRMSMPLib::PlgTermSample |
PMmStream |
POINT3D |
port_hdr |
PRIMARYKEY |
PrintContext |
PRIVCLIPDATA |
PROFILE_STRUCT |
PropertiesVtbl |
PropertyVtbl |
Props |
Provider_Globals |
PROVIDERINFO |
PROVTYPEINFO |
qcnotify::_ShipStatus |
qcnotify::INotify | .interface(iid=6DD1E6EF-28C1-11D2-B5B6-00C04FC340EE, thread=AUTO, type=DUAL)
qcnotify::INotifyDefault | .interface(iid=00020400-0000-0000-C000-000000000046, thread=AUTO, type=DUAL)
qcnotify::Notify | .register(clsid=6DD1E6F0-28C1-11D2-B5B6-00C04FC340EE, typelib=6DD1E6DC-28C1-11D2-B5B6-00C04FC340EE, version="1.0", description="Notify Class")
qcorder::IOrder | .interface(iid=CB34A1A1-28C2-11D2-B5B6-00C04FC340EE, thread=AUTO, type=DUAL)
qcorder::IOrderDefault | .interface(iid=00020400-0000-0000-C000-000000000046, thread=AUTO, type=DUAL)
qcorder::Order | .register(clsid=CB34A1A2-28C2-11D2-B5B6-00C04FC340EE, typelib=6DD1E6C2-28C1-11D2-B5B6-00C04FC340EE, version="1.0", description="Order Class")
qcship::IShip | .interface(iid=CB34A1A4-28C2-11D2-B5B6-00C04FC340EE, thread=AUTO, type=DUAL)
qcship::IShipDefault | .interface(iid=00020400-0000-0000-C000-000000000046, thread=AUTO, type=DUAL)
qcship::Ship | .register(clsid=CB34A1A5-28C2-11D2-B5B6-00C04FC340EE, typelib=6DD1E6CF-28C1-11D2-B5B6-00C04FC340EE, version="1.0", description="Ship Class")
Query |
Queue |
RealTimeStylusPluginApp::PluginListItem | Helper used to store information about a given plugin
RealTimeStylusPluginApp::RealTimeStylusPluginApp | The RealTimeStylusPlugin Sample Application form class
RealTimeStylusPlugins::CustomDynamicRendererPlugin | A real time stylus plugin that demonstrates custom dynamic rendering
RealTimeStylusPlugins::PacketFilterPlugin | A real time stylus plugin that demonstrates packet modification
RECEIVE_CONTEXT |
RECTI |
RecvBuf |
RefCount |
REGENTRY |
REGSTRUCT |
RENDERLib::Behavior |
RENDERLib::EventSink |
RENDERLib::Factory |
REQUEST_CONTEXT |
RESOURCEPOSINFO |
RESULTDATA |
RqsClient |
RqsConfig |
RqsEngine |
RSProxy |
RUN |
Sample::Messages |
Sample::MySignedXml |
Sample::Sample |
Sample::SignVerify |
Sample::UI::AboutBox |
Sample::UI::MainWindow |
Sample::Win32 |
Sample::Win32::CERT_CHAIN_FIND_BY_ISSUER_PARA |
SClassEntry |
SDKDimmerServiceLib::IUPnPService_DimmingService_SCPD |
SDKDimmerServiceLib::UPNPSampleDimmerDevice |
SDKSAMPLEPLAYLISTPLUGINLib::SDKSamplePlaylistParser |
section |
Serialization::SerializationForm |
SESSION_DATA |
SFilterEntry |
SHandlerEntry |
SIMPLE_BROWSER |
SIndexedDisk |
SIndexedDiskLessThan |
SInfo |
SLangClassEntry |
SLangRegistry |
SmartRefPointer< T > |
SMmStream |
Sock_Info |
SocketMonitor |
SPINCUBEINFO |
SPropertyEntry |
SStemForm |
Stack_c< T > |
statel |
Static_Info_Database |
Static_Statistic |
STL_LABEL |
storesh::CERT_SYSTEM_STORE_INFO |
storesh::Storesh |
storesh::Win32 |
STR_BINDING |
STYLE |
SupportConcurList |
SupportOptList |
t_Ctype |
Table |
TableHdr |
TABLEINFO |
TableSelection |
tag_BASENODE_PROPERTIES |
tag_chunkhdr |
tag_filehdr |
tag_keyframe |
tag_preroll |
tag_seq |
tag_smf |
tag_smffileinfo |
tag_smfopenstruct |
tag_tempomapentry |
tag_track |
tagACCESSOR |
tagADSERRMSG |
tagADSIIF |
tagAppletCapability |
tagAppletCapability2 |
tagAppletCapabilityClass |
tagAppletCapabilityID |
tagAppletChannelRequest |
tagAppletLongString |
tagAppletObjectKey |
tagAppletOctetString |
tagAppletProtocolEntity |
tagAppletRecord |
tagAppletRegistryEntryOwner |
tagAppletRegistryItem |
tagAppletRegistryKey |
tagAppletRegistryRequest |
tagAppletRoster |
tagAppletSessionKey |
tagAppletSessionRequest |
tagAppletTokenRequest |
tagArFonts |
tagBRUSHSTYLELOOKUP |
tagCAPSLOOKUP |
tagCMTMLTFMT |
tagCONSOLEDATA |
tagCrmFilesCreateFileLogRecord |
tagCrmFilesDeleteFileLogRecord |
tagDataStruct |
tagDescInfo |
tagDescType |
tagDIAGINFO |
tagDRAWINFO |
tagEnhKeyUsage |
tagENTRY |
tagENUMLIST |
tagENUMPRTLOOKUP |
tagEVENT |
tagFieldMetaData |
tagGRAPHICLOOKUP |
tagHANDLES |
tagHeader |
tagICONEXTRACT |
tagINTERFACEIMPL |
tagLABELEXTRACT |
tagLINE |
tagLINE_INFO |
tagLINEINFO |
tagLSTSLOT |
tagMAPMODELOOKUP |
tagMETA16HEADER |
tagMULTI_SZ |
tagObject |
tagOleStdEnumFmtEtc |
tagOleStdEnumStatData |
tagOLESTDMESSAGEFILTER |
tagOPTIONS |
tagPENSTYLELOOKUP |
tagPENWIDTHLOOKUP |
tagPIDLDATA |
tagPLUGXPRT_PARAMETERS |
tagPOPUPMENUMAP |
tagProperties |
tagQtStruct |
tagRGPT |
tagRowBuff |
tagSEG |
tagSERVERINFO |
tagSLOT |
tagSTATMESSAGEMAP |
tagSTATUSBARLOOKUP |
tagTOOLDISPLAYDATA |
tagTrackObject |
tagUser |
tagVIEWLIST |
TempBuffer |
TEXTBUTTON_STRUCT |
THEPROVIDERLib::MSOmniProv |
THREAD_STRUCT |
ThreadArg_Struct |
ThreadArgs |
THREADARGS |
THREADDATA |
THREADINFO |
Title |
tpc_hdr |
tphys_connect_info |
TPropBase< TYPE > |
TPropSetBase< TYPE, OBJTYPE > |
tree |
TREEINFO |
treeitem |
tReq |
TS_VERSION_INFO |
tSReq |
TYPEINFO |
UDDI::Tools::CategoryTreeNode |
UDDI::Tools::CategoryTreeView | Summary description for categorytree
udp_hdr |
UnionInt64 |
UPNPDimmerDevice |
UPNPDimmerService |
UsageStringInfo |
util::DatabaseSettings |
Util::HelperFunctions |
Util::line |
vcacct::CAccount | .class(classid=04CF0B76-1989-11D0-B917-0080C7394688,DynamicCasts) .interface(iid=04CF0B72-1989-11D0-B917-0080C7394688, thread=AUTO, type=DUAL)
vcacct::CGetReceipt | .class(classid=A81260B2-DDC8-11D0-B5A0-00C04FB957D8,DynamicCasts) .interface(iid=A81260B1-DDC8-11D0-B5A0-00C04FB957D8, thread=AUTO, type=DUAL)
vcacct::CMoveMoney | .class(classid=04CF0B7B-1989-11D0-B917-0080C7394688,DynamicCasts) .interface(iid=04CF0B77-1989-11D0-B917-0080C7394688, thread=AUTO, type=DUAL)
vcacct::CUpdateReceipt | .class(classid=A81260B8-DDC8-11D0-B5A0-00C04FB957D8,DynamicCasts) .interface(iid=A81260B7-DDC8-11D0-B5A0-00C04FB957D8, thread=AUTO, type=DUAL)
vcacct::IAccount | .interface(iid=04CF0B72-1989-11D0-B917-0080C7394688, thread=AUTO, type=DUAL)
vcacct::IGetReceipt | .interface(iid=A81260B1-DDC8-11D0-B5A0-00C04FB957D8, thread=AUTO, type=DUAL)
vcacct::IMoveMoney | .interface(iid=04CF0B77-1989-11D0-B917-0080C7394688, thread=AUTO, type=DUAL)
vcacct::IUpdateReceipt | .interface(iid=A81260B7-DDC8-11D0-B5A0-00C04FB957D8, thread=AUTO, type=DUAL)
VERBMAPPING |
view |
viewline |
VJQuery | This class can take a variable number of parameters on the command line
VTUNION |
WATCHER_DATA |
WiaWrap::CComPtrArray< T > |
WiaWrap::CDataCallback |
WiaWrap::CEventCallback |
WiaWrap::CProgressDlg |
WININFO |
WRITER_PARAMS |
WRTHANDLE |
WsdlDiscovery::frmMain | Summary description for Form1
XBStr |
XInterface< T > |
XPtr< T > |
XWindow |
Generated on Wed Nov 13 2024 16:55:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: __POSITION Struct Reference

  • Files
  • Directories
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

__POSITION Struct Reference

#include "llistimpl.h"

Detailed Description

Definition at line 30 of file llistimpl.h.

The documentation for this struct was generated from the following file:
  • SysMgmt/MMC/mmc2.0/contextmenu/llistimpl.h
Generated on Wed Nov 13 2024 16:55:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _AcceptContext Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_AcceptContext Struct Reference

#include "common.h"

List of all members.

Public Attributes

BYTE | addressFamily
HWND | hAcceptWindow
SOCK_INFO * pSockList
char * | szInterface
char * | szPort
BYTE | typeOfAccept

Detailed Description

Definition at line 98 of file common.h.

Member Data Documentation

BYTE _AcceptContext::addressFamily

Definition at line 100 of file common.h.

HWND _AcceptContext::hAcceptWindow

Definition at line 105 of file common.h.

SOCK_INFO* _AcceptContext::pSockList

Definition at line 104 of file common.h.

char* _AcceptContext::szInterface

Definition at line 101 of file common.h.

char* _AcceptContext::szPort

Definition at line 102 of file common.h.

BYTE _AcceptContext::typeOfAccept

Definition at line 103 of file common.h.

The documentation for this struct was generated from the following file:
  • NetDS/WinSock/Accept/common.h
Generated on Wed Nov 13 2024 16:55:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _ACCEPTEXARGS Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_ACCEPTEXARGS Struct Reference

#include "provider.h"

List of all members.

Public Attributes

DWORD dwBytesReceived
DWORD dwLocalAddressLength
DWORD dwReceiveDataLength
DWORD dwRemoteAddressLength
PVOID lpOutputBuffer
SOCKET | sAcceptSocket
SOCKET | sProviderAcceptSocket

Detailed Description

Definition at line 94 of file provider.h.

Member Data Documentation

DWORD _ACCEPTEXARGS::dwBytesReceived

Definition at line 102 of file provider.h.

DWORD _ACCEPTEXARGS::dwLocalAddressLength

Definition at line 99 of file provider.h.

DWORD _ACCEPTEXARGS::dwReceiveDataLength

Definition at line 99 of file provider.h.

DWORD _ACCEPTEXARGS::dwRemoteAddressLength

Definition at line 99 of file provider.h.

PVOID _ACCEPTEXARGS::lpOutputBuffer

Definition at line 98 of file provider.h.

SOCKET _ACCEPTEXARGS::sAcceptSocket

Definition at line 96 of file provider.h.

SOCKET _ACCEPTEXARGS::sProviderAcceptSocket

Definition at line 96 of file provider.h.

The documentation for this struct was generated from the following file:
  • NetDS/WinSock/LSP/provider.h
Generated on Wed Nov 13 2024 16:55:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _ADOCollectionVtbl Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

_ADOCollectionVtbl Struct Reference

#include "adoint.h"

List of all members.

Public Member Functions

BEGIN_INTERFACE | HRESULT (STDMETHODCALLTYPE __RPC_FAR *QueryInterface)(_ADOCollection __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Refresh)(_ADOCollection __RPC_FAR *This)
HRESULT (STDMETHODCALLTYPE __RPC_FAR *_NewEnum)(_ADOCollection __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount)(_ADOCollection __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Invoke)(_ADOCollection __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Count)(_ADOCollection __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo)(_ADOCollection __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames)(_ADOCollection __RPC_FAR *This
ULONG (STDMETHODCALLTYPE __RPC_FAR *AddRef)(_ADOCollection __RPC_FAR *This)
ULONG (STDMETHODCALLTYPE __RPC_FAR *Release)(_ADOCollection __RPC_FAR *This)

Public Attributes

long __RPC_FAR * | c
REFIID LPOLESTR __RPC_FAR UINT | cNames
DISPID | dispIdMember
UINT iTInfo
UINT LCID | lcid
REFIID LPOLESTR __RPC_FAR UINT LCID | lcid
DISPID REFIID LCID | lcid
UINT __RPC_FAR * | pctinfo
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR * 		pDispParams
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR EXCEPINFO __RPC_FAR * 		pExcepInfo
UINT LCID ITypeInfo __RPC_FAR
*__RPC_FAR * 		ppTInfo
BEGIN_INTERFACE REFIID void
__RPC_FAR *__RPC_FAR * 		ppvObject
IUnknown __RPC_FAR *__RPC_FAR * | ppvObject
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR EXCEPINFO __RPC_FAR
UINT __RPC_FAR * 		puArgErr
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR * 		pVarResult
REFIID LPOLESTR __RPC_FAR UINT
LCID DISPID __RPC_FAR * 		rgDispId
REFIID LPOLESTR __RPC_FAR * | rgszNames
REFIID | riid
DISPID REFIID | riid
BEGIN_INTERFACE REFIID | riid
DISPID REFIID LCID WORD | wFlags

Detailed Description

Definition at line 470 of file adoint.h.

Member Function Documentation

BEGIN_INTERFACE _ADOCollectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * QueryInterface )
_ADOCollectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Refresh )
_ADOCollectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * _NewEnum )
_ADOCollectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetTypeInfoCount )
_ADOCollectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Invoke )
_ADOCollectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Count )
_ADOCollectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetTypeInfo )
_ADOCollectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetIDsOfNames )
_ADOCollectionVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * AddRef )
_ADOCollectionVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * Release )

Member Data Documentation

long __RPC_FAR* _ADOCollectionVtbl::c

Definition at line 516 of file adoint.h.

REFIID LPOLESTR __RPC_FAR UINT _ADOCollectionVtbl::cNames

Definition at line 497 of file adoint.h.

DISPID _ADOCollectionVtbl::dispIdMember

Definition at line 505 of file adoint.h.

UINT _ADOCollectionVtbl::iTInfo

Definition at line 491 of file adoint.h.

UINT LCID _ADOCollectionVtbl::lcid

Definition at line 491 of file adoint.h.

REFIID LPOLESTR __RPC_FAR UINT LCID _ADOCollectionVtbl::lcid

Definition at line 497 of file adoint.h.

DISPID REFIID LCID _ADOCollectionVtbl::lcid

Definition at line 505 of file adoint.h.

UINT __RPC_FAR* _ADOCollectionVtbl::pctinfo

Definition at line 487 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR* _ADOCollectionVtbl::pDispParams

Definition at line 505 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR EXCEPINFO __RPC_FAR* _ADOCollectionVtbl::pExcepInfo

Definition at line 505 of file adoint.h.

UINT LCID ITypeInfo __RPC_FAR* __RPC_FAR* _ADOCollectionVtbl::ppTInfo

Definition at line 491 of file adoint.h.

BEGIN_INTERFACE REFIID void __RPC_FAR* __RPC_FAR* _ADOCollectionVtbl::ppvObject

Definition at line 476 of file adoint.h.

IUnknown __RPC_FAR* __RPC_FAR* _ADOCollectionVtbl::ppvObject

Definition at line 520 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR EXCEPINFO __RPC_FAR UINT __RPC_FAR* _ADOCollectionVtbl::puArgErr

Definition at line 505 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR* _ADOCollectionVtbl::pVarResult

Definition at line 505 of file adoint.h.

REFIID LPOLESTR __RPC_FAR UINT LCID DISPID __RPC_FAR* _ADOCollectionVtbl::rgDispId

Definition at line 497 of file adoint.h.

REFIID LPOLESTR __RPC_FAR* _ADOCollectionVtbl::rgszNames

Definition at line 497 of file adoint.h.

REFIID _ADOCollectionVtbl::riid

Definition at line 497 of file adoint.h.

DISPID REFIID _ADOCollectionVtbl::riid

Definition at line 505 of file adoint.h.

BEGIN_INTERFACE REFIID _ADOCollectionVtbl::riid

Definition at line 476 of file adoint.h.

DISPID REFIID LCID WORD _ADOCollectionVtbl::wFlags

Definition at line 505 of file adoint.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/rds/handler/vc/adoint.h
Generated on Wed Nov 13 2024 16:55:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _ADODynaCollectionVtbl Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

_ADODynaCollectionVtbl Struct Reference

#include "adoint.h"

List of all members.

Public Member Functions

BEGIN_INTERFACE | HRESULT (STDMETHODCALLTYPE __RPC_FAR *QueryInterface)(_ADODynaCollection __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount)(_ADODynaCollection __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Append)(_ADODynaCollection __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Refresh)(_ADODynaCollection __RPC_FAR *This)
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Count)(_ADODynaCollection __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *_NewEnum)(_ADODynaCollection __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Invoke)(_ADODynaCollection __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Delete)(_ADODynaCollection __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo)(_ADODynaCollection __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames)(_ADODynaCollection __RPC_FAR *This
ULONG (STDMETHODCALLTYPE __RPC_FAR *Release)(_ADODynaCollection __RPC_FAR *This)
ULONG (STDMETHODCALLTYPE __RPC_FAR *AddRef)(_ADODynaCollection __RPC_FAR *This)

Public Attributes

long __RPC_FAR * | c
REFIID LPOLESTR __RPC_FAR UINT | cNames
DISPID | dispIdMember
VARIANT | Index
UINT iTInfo
UINT LCID | lcid
REFIID LPOLESTR __RPC_FAR UINT LCID | lcid
DISPID REFIID LCID | lcid
IDispatch __RPC_FAR * | Object
UINT __RPC_FAR * | pctinfo
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR * 		pDispParams
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR EXCEPINFO __RPC_FAR * 		pExcepInfo
UINT LCID ITypeInfo __RPC_FAR
*__RPC_FAR * 		ppTInfo
IUnknown __RPC_FAR *__RPC_FAR * | ppvObject
BEGIN_INTERFACE REFIID void
__RPC_FAR *__RPC_FAR * 		ppvObject
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR EXCEPINFO __RPC_FAR
UINT __RPC_FAR * 		puArgErr
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR * 		pVarResult
REFIID LPOLESTR __RPC_FAR UINT
LCID DISPID __RPC_FAR * 		rgDispId
REFIID LPOLESTR __RPC_FAR * | rgszNames
BEGIN_INTERFACE REFIID | riid
DISPID REFIID | riid
REFIID | riid
DISPID REFIID LCID WORD | wFlags

Detailed Description

Definition at line 603 of file adoint.h.

Member Function Documentation

BEGIN_INTERFACE _ADODynaCollectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * QueryInterface )
_ADODynaCollectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetTypeInfoCount )
_ADODynaCollectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Append )
_ADODynaCollectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Refresh )
_ADODynaCollectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Count )
_ADODynaCollectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * _NewEnum )
_ADODynaCollectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Invoke )
_ADODynaCollectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Delete )
_ADODynaCollectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetTypeInfo )
_ADODynaCollectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetIDsOfNames )
_ADODynaCollectionVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * Release )
_ADODynaCollectionVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * AddRef )

Member Data Documentation

long __RPC_FAR* _ADODynaCollectionVtbl::c

Definition at line 649 of file adoint.h.

REFIID LPOLESTR __RPC_FAR UINT _ADODynaCollectionVtbl::cNames

Definition at line 630 of file adoint.h.

DISPID _ADODynaCollectionVtbl::dispIdMember

Definition at line 638 of file adoint.h.

VARIANT _ADODynaCollectionVtbl::Index

Definition at line 664 of file adoint.h.

UINT _ADODynaCollectionVtbl::iTInfo

Definition at line 624 of file adoint.h.

UINT LCID _ADODynaCollectionVtbl::lcid

Definition at line 624 of file adoint.h.

REFIID LPOLESTR __RPC_FAR UINT LCID _ADODynaCollectionVtbl::lcid

Definition at line 630 of file adoint.h.

DISPID REFIID LCID _ADODynaCollectionVtbl::lcid

Definition at line 638 of file adoint.h.

IDispatch __RPC_FAR* _ADODynaCollectionVtbl::Object

Definition at line 660 of file adoint.h.

UINT __RPC_FAR* _ADODynaCollectionVtbl::pctinfo

Definition at line 620 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR* _ADODynaCollectionVtbl::pDispParams

Definition at line 638 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR EXCEPINFO __RPC_FAR* _ADODynaCollectionVtbl::pExcepInfo

Definition at line 638 of file adoint.h.

UINT LCID ITypeInfo __RPC_FAR* __RPC_FAR* _ADODynaCollectionVtbl::ppTInfo

Definition at line 624 of file adoint.h.

IUnknown __RPC_FAR* __RPC_FAR* _ADODynaCollectionVtbl::ppvObject

Definition at line 653 of file adoint.h.

BEGIN_INTERFACE REFIID void __RPC_FAR* __RPC_FAR* _ADODynaCollectionVtbl::ppvObject

Definition at line 609 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR EXCEPINFO __RPC_FAR UINT __RPC_FAR* _ADODynaCollectionVtbl::puArgErr

Definition at line 638 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR* _ADODynaCollectionVtbl::pVarResult

Definition at line 638 of file adoint.h.

REFIID LPOLESTR __RPC_FAR UINT LCID DISPID __RPC_FAR* _ADODynaCollectionVtbl::rgDispId

Definition at line 630 of file adoint.h.

REFIID LPOLESTR __RPC_FAR* _ADODynaCollectionVtbl::rgszNames

Definition at line 630 of file adoint.h.

BEGIN_INTERFACE REFIID _ADODynaCollectionVtbl::riid

Definition at line 609 of file adoint.h.

DISPID REFIID _ADODynaCollectionVtbl::riid

Definition at line 638 of file adoint.h.

REFIID _ADODynaCollectionVtbl::riid

Definition at line 630 of file adoint.h.

DISPID REFIID LCID WORD _ADODynaCollectionVtbl::wFlags

Definition at line 638 of file adoint.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/rds/handler/vc/adoint.h
Generated on Wed Nov 13 2024 16:55:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _ADOVtbl Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

_ADOVtbl Struct Reference

#include "adoint.h"

List of all members.

Public Member Functions

BEGIN_INTERFACE | HRESULT (STDMETHODCALLTYPE __RPC_FAR *QueryInterface)(_ADO __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount)(_ADO __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Invoke)(_ADO __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Properties)(_ADO __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo)(_ADO __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames)(_ADO __RPC_FAR *This
ULONG (STDMETHODCALLTYPE __RPC_FAR *AddRef)(_ADO __RPC_FAR *This)
ULONG (STDMETHODCALLTYPE __RPC_FAR *Release)(_ADO __RPC_FAR *This)

Public Attributes

REFIID LPOLESTR __RPC_FAR UINT | cNames
DISPID | dispIdMember
UINT iTInfo
UINT LCID | lcid
REFIID LPOLESTR __RPC_FAR UINT LCID | lcid
DISPID REFIID LCID | lcid
UINT __RPC_FAR * | pctinfo
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR * 		pDispParams
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR EXCEPINFO __RPC_FAR * 		pExcepInfo
UINT LCID ITypeInfo __RPC_FAR
*__RPC_FAR * 		ppTInfo
BEGIN_INTERFACE REFIID void
__RPC_FAR *__RPC_FAR * 		ppvObject
ADOProperties __RPC_FAR
*__RPC_FAR * 		ppvObject
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR EXCEPINFO __RPC_FAR
UINT __RPC_FAR * 		puArgErr
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR * 		pVarResult
REFIID LPOLESTR __RPC_FAR UINT
LCID DISPID __RPC_FAR * 		rgDispId
REFIID LPOLESTR __RPC_FAR * | rgszNames
REFIID | riid
DISPID REFIID | riid
BEGIN_INTERFACE REFIID | riid
DISPID REFIID LCID WORD | wFlags

Detailed Description

Definition at line 738 of file adoint.h.

Member Function Documentation

BEGIN_INTERFACE _ADOVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * QueryInterface )
_ADOVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetTypeInfoCount )
_ADOVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Invoke )
_ADOVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Properties )
_ADOVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetTypeInfo )
_ADOVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetIDsOfNames )
_ADOVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * AddRef )
_ADOVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * Release )

Member Data Documentation

REFIID LPOLESTR __RPC_FAR UINT _ADOVtbl::cNames

Definition at line 765 of file adoint.h.

DISPID _ADOVtbl::dispIdMember

Definition at line 773 of file adoint.h.

UINT _ADOVtbl::iTInfo

Definition at line 759 of file adoint.h.

UINT LCID _ADOVtbl::lcid

Definition at line 759 of file adoint.h.

REFIID LPOLESTR __RPC_FAR UINT LCID _ADOVtbl::lcid

Definition at line 765 of file adoint.h.

DISPID REFIID LCID _ADOVtbl::lcid

Definition at line 773 of file adoint.h.

UINT __RPC_FAR* _ADOVtbl::pctinfo

Definition at line 755 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR* _ADOVtbl::pDispParams

Definition at line 773 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR EXCEPINFO __RPC_FAR* _ADOVtbl::pExcepInfo

Definition at line 773 of file adoint.h.

UINT LCID ITypeInfo __RPC_FAR* __RPC_FAR* _ADOVtbl::ppTInfo

Definition at line 759 of file adoint.h.

BEGIN_INTERFACE REFIID void __RPC_FAR* __RPC_FAR* _ADOVtbl::ppvObject

Definition at line 744 of file adoint.h.

ADOProperties __RPC_FAR* __RPC_FAR* _ADOVtbl::ppvObject

Definition at line 784 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR EXCEPINFO __RPC_FAR UINT __RPC_FAR* _ADOVtbl::puArgErr

Definition at line 773 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR* _ADOVtbl::pVarResult

Definition at line 773 of file adoint.h.

REFIID LPOLESTR __RPC_FAR UINT LCID DISPID __RPC_FAR* _ADOVtbl::rgDispId

Definition at line 765 of file adoint.h.

REFIID LPOLESTR __RPC_FAR* _ADOVtbl::rgszNames

Definition at line 765 of file adoint.h.

REFIID _ADOVtbl::riid

Definition at line 765 of file adoint.h.

DISPID REFIID _ADOVtbl::riid

Definition at line 773 of file adoint.h.

BEGIN_INTERFACE REFIID _ADOVtbl::riid

Definition at line 744 of file adoint.h.

DISPID REFIID LCID WORD _ADOVtbl::wFlags

Definition at line 773 of file adoint.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/rds/handler/vc/adoint.h
Generated on Wed Nov 13 2024 16:55:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _AIO_WORK_ITEM Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_AIO_WORK_ITEM Struct Reference

List of all members.

Public Attributes

HANDLE hFile
HSE_TF_INFO | hseTf
LIST_ENTRY | listEntry
DWORD nRead
OVERLAPPED | ov
CHAR | pchBuffer [MAX_BUFFER_SIZE]
EXTENSION_CONTROL_BLOCK * | pecb

Detailed Description

Definition at line 23 of file ftrans.c.

Member Data Documentation

HANDLE _AIO_WORK_ITEM::hFile

Definition at line 28 of file fwasync.c.

HSE_TF_INFO _AIO_WORK_ITEM::hseTf

Definition at line 27 of file ftrans.c.

LIST_ENTRY _AIO_WORK_ITEM::listEntry

Definition at line 25 of file ftrans.c.

DWORD _AIO_WORK_ITEM::nRead

Definition at line 30 of file fwasync.c.

OVERLAPPED _AIO_WORK_ITEM::ov

Definition at line 29 of file fwasync.c.

CHAR _AIO_WORK_ITEM::pchBuffer

Definition at line 28 of file ftrans.c.

EXTENSION_CONTROL_BLOCK * _AIO_WORK_ITEM::pecb

Definition at line 26 of file ftrans.c.

The documentation for this struct was generated from the following files:
  • Web/iis/extensions/io/ASyncTrans/ftrans.c
  • Web/iis/extensions/io/ASyncWrite/fwasync.c
Generated on Wed Nov 13 2024 16:55:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _APPMEM_COUNTERS Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_APPMEM_COUNTERS Struct Reference

#include "DataMem.h"

List of all members.

Public Attributes

PERF_COUNTER_BLOCK CounterBlock
DWORD dwAppMemAllocs
DWORD dwAppMemAllocsSec
DWORD dwAppMemBytesAllocated
DWORD dwAppMemFrees
DWORD dwAppMemFreesSec
DWORD dwAppMemReAllocs
DWORD dwAppMemReAllocsSec

Detailed Description

Definition at line 65 of file DataMem.h.

Member Data Documentation

PERF_COUNTER_BLOCK _APPMEM_COUNTERS::CounterBlock

Definition at line 66 of file DataMem.h.

DWORD _APPMEM_COUNTERS::dwAppMemAllocs

Definition at line 68 of file DataMem.h.

DWORD _APPMEM_COUNTERS::dwAppMemAllocsSec

Definition at line 69 of file DataMem.h.

DWORD _APPMEM_COUNTERS::dwAppMemBytesAllocated

Definition at line 67 of file DataMem.h.

DWORD _APPMEM_COUNTERS::dwAppMemFrees

Definition at line 72 of file DataMem.h.

DWORD _APPMEM_COUNTERS::dwAppMemFreesSec

Definition at line 73 of file DataMem.h.

DWORD _APPMEM_COUNTERS::dwAppMemReAllocs

Definition at line 70 of file DataMem.h.

DWORD _APPMEM_COUNTERS::dwAppMemReAllocsSec

Definition at line 71 of file DataMem.h.

The documentation for this struct was generated from the following file:
  • WinBase/WinNT/PerfTool/PerfDllS/AppMem/PerfDll/DataMem.h
Generated on Wed Nov 13 2024 16:55:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _APPMEM_DATA_DEFINITION Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_APPMEM_DATA_DEFINITION Struct Reference

#include "DataMem.h"

List of all members.

Public Attributes

PERF_COUNTER_DEFINITION | AppMemAllocs
PERF_COUNTER_DEFINITION | AppMemAllocsSec
PERF_COUNTER_DEFINITION | AppMemBytesAllocated
PERF_COUNTER_DEFINITION | AppMemFrees
PERF_COUNTER_DEFINITION | AppMemFreesSec
PERF_OBJECT_TYPE | AppMemObjectType
PERF_COUNTER_DEFINITION | AppMemReAllocs
PERF_COUNTER_DEFINITION | AppMemReAllocsSec

Detailed Description

Definition at line 54 of file DataMem.h.

Member Data Documentation

PERF_COUNTER_DEFINITION _APPMEM_DATA_DEFINITION::AppMemAllocs

Definition at line 57 of file DataMem.h.

PERF_COUNTER_DEFINITION _APPMEM_DATA_DEFINITION::AppMemAllocsSec

Definition at line 58 of file DataMem.h.

PERF_COUNTER_DEFINITION _APPMEM_DATA_DEFINITION::AppMemBytesAllocated

Definition at line 56 of file DataMem.h.

PERF_COUNTER_DEFINITION _APPMEM_DATA_DEFINITION::AppMemFrees

Definition at line 61 of file DataMem.h.

PERF_COUNTER_DEFINITION _APPMEM_DATA_DEFINITION::AppMemFreesSec

Definition at line 62 of file DataMem.h.

PERF_OBJECT_TYPE _APPMEM_DATA_DEFINITION::AppMemObjectType

Definition at line 55 of file DataMem.h.

PERF_COUNTER_DEFINITION _APPMEM_DATA_DEFINITION::AppMemReAllocs

Definition at line 59 of file DataMem.h.

PERF_COUNTER_DEFINITION _APPMEM_DATA_DEFINITION::AppMemReAllocsSec

Definition at line 60 of file DataMem.h.

The documentation for this struct was generated from the following file:
  • WinBase/WinNT/PerfTool/PerfDllS/AppMem/PerfDll/DataMem.h
Generated on Wed Nov 13 2024 16:55:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _APPMEM_DATA_HEADER Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_APPMEM_DATA_HEADER Struct Reference

#include "AppMemi.h"

List of all members.

Public Attributes

DWORD dwFirstFreeOffset
DWORD dwFirstInUseOffset
DWORD dwInstanceCount

Detailed Description

Definition at line 48 of file AppMemi.h.

Member Data Documentation

DWORD _APPMEM_DATA_HEADER::dwFirstFreeOffset

Definition at line 52 of file AppMemi.h.

DWORD _APPMEM_DATA_HEADER::dwFirstInUseOffset

Definition at line 51 of file AppMemi.h.

DWORD _APPMEM_DATA_HEADER::dwInstanceCount

Definition at line 50 of file AppMemi.h.

The documentation for this struct was generated from the following file:
  • WinBase/WinNT/PerfTool/PerfDllS/AppMem/Inc/AppMemi.h
Generated on Wed Nov 13 2024 16:55:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _APPMEM_INSTANCE Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_APPMEM_INSTANCE Struct Reference

#include "AppMemi.h"

List of all members.

Public Attributes

DWORD dwAllocCalls
DWORD dwApplicationBytes
DWORD dwFreeCalls
DWORD dwOffsetOfNext
DWORD dwProcessId
DWORD dwReAllocCalls
DWORD dwReserved1
DWORD dwReserved2
HANDLE hProcessHeap
WCHAR wcszInstanceName [MAX_SIZEOF_INSTANCE_NAME]

Detailed Description

Definition at line 26 of file AppMemi.h.

Member Data Documentation

DWORD _APPMEM_INSTANCE::dwAllocCalls

Definition at line 33 of file AppMemi.h.

DWORD _APPMEM_INSTANCE::dwApplicationBytes

Definition at line 31 of file AppMemi.h.

DWORD _APPMEM_INSTANCE::dwFreeCalls

Definition at line 35 of file AppMemi.h.

DWORD _APPMEM_INSTANCE::dwOffsetOfNext

Definition at line 28 of file AppMemi.h.

DWORD _APPMEM_INSTANCE::dwProcessId

Definition at line 29 of file AppMemi.h.

DWORD _APPMEM_INSTANCE::dwReAllocCalls

Definition at line 34 of file AppMemi.h.

DWORD _APPMEM_INSTANCE::dwReserved1

Definition at line 37 of file AppMemi.h.

DWORD _APPMEM_INSTANCE::dwReserved2

Definition at line 38 of file AppMemi.h.

HANDLE _APPMEM_INSTANCE::hProcessHeap

Definition at line 30 of file AppMemi.h.

WCHAR _APPMEM_INSTANCE::wcszInstanceName[MAX_SIZEOF_INSTANCE_NAME]

Definition at line 36 of file AppMemi.h.

The documentation for this struct was generated from the following file:
  • WinBase/WinNT/PerfTool/PerfDllS/AppMem/Inc/AppMemi.h
Generated on Wed Nov 13 2024 16:55:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _ASYNC_REQUEST Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_ASYNC_REQUEST Struct Reference

#include "Atsp.h"

List of all members.

Public Attributes

DWORD dwCommand
DWORD dwRequestID
struct _ASYNC_REQUEST * | pNext
char | szCommand [32]

Detailed Description

Definition at line 85 of file Atsp.h.

Member Data Documentation

DWORD _ASYNC_REQUEST::dwCommand

Definition at line 89 of file Atsp.h.

DWORD _ASYNC_REQUEST::dwRequestID

Definition at line 87 of file Atsp.h.

struct _ASYNC_REQUEST* _ASYNC_REQUEST::pNext

Definition at line 93 of file Atsp.h.

char _ASYNC_REQUEST::szCommand[32]

Definition at line 91 of file Atsp.h.

The documentation for this struct was generated from the following file:
  • NetDS/Tapi/Tapi2/Atsp32/Atsp.h
Generated on Wed Nov 13 2024 16:55:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _AUTH_SEQ Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_AUTH_SEQ Struct Reference

List of all members.

Public Attributes

DWORD _cbMaxToken
BOOL _fHaveCredHandle
BOOL _fHaveCtxtHandle
BOOL _fNewConversation
BOOL _fUUEncodeData
CredHandle | _hcred
struct _SecHandle | _hctxt
ULONG cbMaxSignature
ULONG cbSecurityTrailer

Detailed Description

Definition at line 62 of file HttpAuth.c.

Member Data Documentation

DWORD _AUTH_SEQ::_cbMaxToken

Definition at line 66 of file HttpAuth.c.

BOOL _AUTH_SEQ::_fHaveCredHandle

Definition at line 65 of file HttpAuth.c.

BOOL _AUTH_SEQ::_fHaveCtxtHandle

Definition at line 67 of file HttpAuth.c.

BOOL _AUTH_SEQ::_fNewConversation

Definition at line 63 of file HttpAuth.c.

BOOL _AUTH_SEQ::_fUUEncodeData

Definition at line 69 of file HttpAuth.c.

CredHandle _AUTH_SEQ::_hcred

Definition at line 64 of file HttpAuth.c.

struct _SecHandle _AUTH_SEQ::_hctxt

Definition at line 68 of file HttpAuth.c.

ULONG _AUTH_SEQ::cbMaxSignature

Definition at line 39 of file Security.cpp.

ULONG _AUTH_SEQ::cbSecurityTrailer

Definition at line 40 of file Security.cpp.

The documentation for this struct was generated from the following files:
  • Security/SSPI/HttpAuth/HttpAuth.c
  • Security/SSPI/SockAuth/Security.cpp
Generated on Wed Nov 13 2024 16:55:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _BALLDATA Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_BALLDATA Struct Reference

#include "Bounce.h"

List of all members.

Public Attributes

BOOL bNewPosition
COLORREF | crColor
HWND | hWnd
int | nHeight
int | nWidth
int | xDirection
MYXFORM xForm
int | xPosition
int | yDirection
int | yPosition

Detailed Description

Definition at line 33 of file Bounce.h.

Member Data Documentation

BOOL _BALLDATA::bNewPosition

Definition at line 40 of file Bounce.h.

COLORREF _BALLDATA::crColor

Definition at line 43 of file Bounce.h.

HWND _BALLDATA::hWnd

Definition at line 35 of file Bounce.h.

int _BALLDATA::nHeight

Definition at line 37 of file Bounce.h.

int _BALLDATA::nWidth

Definition at line 36 of file Bounce.h.

int _BALLDATA::xDirection

Definition at line 38 of file Bounce.h.

MYXFORM _BALLDATA::xForm

Definition at line 44 of file Bounce.h.

int _BALLDATA::xPosition

Definition at line 41 of file Bounce.h.

int _BALLDATA::yDirection

Definition at line 39 of file Bounce.h.

int _BALLDATA::yPosition

Definition at line 42 of file Bounce.h.

The documentation for this struct was generated from the following file:
  • Multimedia/Gdi/GdiDemo/Bounce.h
Generated on Wed Nov 13 2024 16:55:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _BEZBUFFER Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_BEZBUFFER Struct Reference

#include "Poly.h"

List of all members.

Public Attributes

POINT pPts [BEZ_PTS]

Detailed Description

Definition at line 34 of file Poly.h.

Member Data Documentation

POINT _BEZBUFFER::pPts[BEZ_PTS]

Definition at line 36 of file Poly.h.

The documentation for this struct was generated from the following file:
  • Multimedia/Gdi/GdiDemo/Poly.h
Generated on Wed Nov 13 2024 16:55:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _BINDING_ENTRY Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_BINDING_ENTRY Struct Reference

#include "networkentry.h"

List of all members.

Public Attributes

IPADDRESS ipAddress
IPADDRESS ipMask

Detailed Description

Definition at line 33 of file networkentry.h.

Member Data Documentation

IPADDRESS _BINDING_ENTRY::ipAddress

Definition at line 35 of file networkentry.h.

IPADDRESS _BINDING_ENTRY::ipMask

Definition at line 36 of file networkentry.h.

The documentation for this struct was generated from the following file:
  • NetDS/RRas/ip/networkentry.h
Generated on Wed Nov 13 2024 16:55:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _BLRPLATE Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_BLRPLATE Struct Reference

#include "blrplate.h"

List of all members.

Public Attributes

BYTE | Flags
WORD | Opcode
DWORD Signature

Detailed Description

Definition at line 23 of file blrplate.h.

Member Data Documentation

BYTE _BLRPLATE::Flags

Definition at line 27 of file blrplate.h.

WORD _BLRPLATE::Opcode

Definition at line 26 of file blrplate.h.

DWORD _BLRPLATE::Signature

Definition at line 25 of file blrplate.h.

The documentation for this struct was generated from the following file:
  • NetDS/NetMon/parsers/blrplate/blrplate.h
Generated on Wed Nov 13 2024 16:55:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _BLRPLATECONFIG Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_BLRPLATECONFIG Struct Reference

#include "blrplate.h"

List of all members.

Public Attributes

DWORD nTotalLength

Detailed Description

Definition at line 30 of file blrplate.h.

Member Data Documentation

DWORD _BLRPLATECONFIG::nTotalLength

Definition at line 32 of file blrplate.h.

The documentation for this struct was generated from the following file:
  • NetDS/NetMon/experts/blrplate/blrplate.h
Generated on Wed Nov 13 2024 16:55:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _BOUNCEDATA Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_BOUNCEDATA Struct Reference

#include "Bounce.h"

List of all members.

Public Attributes

HANDLE hBall1
HANDLE hBall2
HANDLE hBall3
HANDLE hBall4

Detailed Description

Definition at line 63 of file Bounce.h.

Member Data Documentation

HANDLE _BOUNCEDATA::hBall1

Definition at line 65 of file Bounce.h.

HANDLE _BOUNCEDATA::hBall2

Definition at line 66 of file Bounce.h.

HANDLE _BOUNCEDATA::hBall3

Definition at line 67 of file Bounce.h.

HANDLE _BOUNCEDATA::hBall4

Definition at line 68 of file Bounce.h.

The documentation for this struct was generated from the following file:
  • Multimedia/Gdi/GdiDemo/Bounce.h
Generated on Wed Nov 13 2024 16:55:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _BUFFER Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_BUFFER Struct Reference

List of all members.

Public Attributes

DWORD cLen
PBYTE pBuf

Detailed Description

Definition at line 54 of file HttpAuth.c.

Member Data Documentation

DWORD _BUFFER::cLen

Definition at line 56 of file HttpAuth.c.

PBYTE _BUFFER::pBuf

Definition at line 55 of file HttpAuth.c.

The documentation for this struct was generated from the following file:
  • Security/SSPI/HttpAuth/HttpAuth.c
Generated on Wed Nov 13 2024 16:55:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _ClientContext Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_ClientContext Struct Reference

List of all members.

Public Attributes

BYTE | addressFamily
LONG | delay
LONG | loopCount
int | nBytesRecd
int | nBytesRemainingToBeSent
char * | pRecvBuf
char * | pSendBuf
LONG | recvBufSize
BYTE | scenario
LONG | sendBufSize
SOCKET | sock
char * | szPort
char * | szServer

Detailed Description

Definition at line 55 of file TestAccept.cpp.

Member Data Documentation

BYTE _ClientContext::addressFamily

Definition at line 57 of file TestAccept.cpp.

LONG _ClientContext::delay

Definition at line 63 of file TestAccept.cpp.

LONG _ClientContext::loopCount

Definition at line 62 of file TestAccept.cpp.

int _ClientContext::nBytesRecd

Definition at line 68 of file TestAccept.cpp.

int _ClientContext::nBytesRemainingToBeSent

Definition at line 67 of file TestAccept.cpp.

char* _ClientContext::pRecvBuf

Definition at line 66 of file TestAccept.cpp.

char* _ClientContext::pSendBuf

Definition at line 65 of file TestAccept.cpp.

LONG _ClientContext::recvBufSize

Definition at line 61 of file TestAccept.cpp.

BYTE _ClientContext::scenario

Definition at line 64 of file TestAccept.cpp.

LONG _ClientContext::sendBufSize

Definition at line 60 of file TestAccept.cpp.

SOCKET _ClientContext::sock

Definition at line 69 of file TestAccept.cpp.

char* _ClientContext::szPort

Definition at line 59 of file TestAccept.cpp.

char* _ClientContext::szServer

Definition at line 58 of file TestAccept.cpp.

The documentation for this struct was generated from the following file:
  • NetDS/WinSock/Accept/TestAccept.cpp
Generated on Wed Nov 13 2024 16:55:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _CLIPBOOKSERVER_RESOURCE Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_CLIPBOOKSERVER_RESOURCE Struct Reference

List of all members.

Public Attributes

CLUS_WORKER | cwWorkerThread
DWORD dwProcessId
HCLUSTER | hCluster
HKEY hkeyParameters
HRESOURCE | hResource
RESOURCE_HANDLE | hResourceHandle
SC_HANDLE | hService
LPWSTR | pwszResourceName
RESID | resid
CLUSTER_RESOURCE_STATE | state

Detailed Description

Definition at line 26 of file ClipBook Server.cpp.

Member Data Documentation

CLUS_WORKER _CLIPBOOKSERVER_RESOURCE::cwWorkerThread

Definition at line 30 of file ClipBook Server.cpp.

DWORD _CLIPBOOKSERVER_RESOURCE::dwProcessId

Definition at line 26 of file ClipBook Server.cpp.

HCLUSTER _CLIPBOOKSERVER_RESOURCE::hCluster

Definition at line 23 of file ClipBook Server.cpp.

HKEY _CLIPBOOKSERVER_RESOURCE::hkeyParameters

Definition at line 27 of file ClipBook Server.cpp.

HRESOURCE _CLIPBOOKSERVER_RESOURCE::hResource

Definition at line 24 of file ClipBook Server.cpp.

RESOURCE_HANDLE _CLIPBOOKSERVER_RESOURCE::hResourceHandle

Definition at line 28 of file ClipBook Server.cpp.

SC_HANDLE _CLIPBOOKSERVER_RESOURCE::hService

Definition at line 25 of file ClipBook Server.cpp.

LPWSTR _CLIPBOOKSERVER_RESOURCE::pwszResourceName

Definition at line 29 of file ClipBook Server.cpp.

RESID _CLIPBOOKSERVER_RESOURCE::resid

Definition at line 22 of file ClipBook Server.cpp.

CLUSTER_RESOURCE_STATE _CLIPBOOKSERVER_RESOURCE::state

Definition at line 31 of file ClipBook Server.cpp.

The documentation for this struct was generated from the following file:
  • WinBase/Cluster/Win2003/ClipBookServer/ClipBook Server/ClipBook Server.cpp
Generated on Wed Nov 13 2024 16:55:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _CMD Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_CMD Struct Reference

#include "GLOBALS.h"

List of all members.

Public Attributes

CMDPROC fn
PFNCMD pfncmd
char | shorttoken [4]
char | token [MAX_STR+1]
UINT wCmd
WORD | wCommand

Detailed Description

Definition at line 189 of file GLOBALS.h.

Member Data Documentation

CMDPROC _CMD::fn

Definition at line 85 of file dbh.cpp.

PFNCMD _CMD::pfncmd

Definition at line 192 of file GLOBALS.h.

char _CMD::shorttoken[4]

Definition at line 84 of file dbh.cpp.

char _CMD::token[MAX_STR+1]

Definition at line 83 of file dbh.cpp.

UINT _CMD::wCmd

Definition at line 107 of file Global.h.

WORD _CMD::wCommand

Definition at line 191 of file GLOBALS.h.

The documentation for this struct was generated from the following files:
  • NetDS/Tapi/Tapi2/TapiComm/GLOBALS.h
  • NetDS/WinSock/IpxChat/Globals.h
  • Web/NetMeeting/NMChat/Global.h
  • Web/NetMeeting/NMShare/Global.h
  • Web/NetMeeting/NMUI/Global.h
  • WinBase/Debug/dbh/dbh.cpp
Generated on Wed Nov 13 2024 16:55:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _CMDI Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_CMDI Struct Reference

#include "GLOBALS.h"

List of all members.

Public Attributes

int ccmd
EDWP edwp
CMD * rgcmd

Detailed Description

Definition at line 198 of file GLOBALS.h.

Member Data Documentation

int _CMDI::ccmd

Definition at line 200 of file GLOBALS.h.

EDWP _CMDI::edwp

Definition at line 202 of file GLOBALS.h.

CMD * _CMDI::rgcmd

Definition at line 201 of file GLOBALS.h.

The documentation for this struct was generated from the following files:
  • NetDS/Tapi/Tapi2/TapiComm/GLOBALS.h
  • NetDS/WinSock/IpxChat/Globals.h
Generated on Wed Nov 13 2024 16:55:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _COLUMNDATA Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_COLUMNDATA Struct Reference

#include "hashtbl.h"

List of all members.

Public Attributes

BYTE bData [1]
SDWORD dwLength
DWORD dwStatus

Detailed Description

Definition at line 22 of file hashtbl.h.

Member Data Documentation

BYTE _COLUMNDATA::bData[1]

Definition at line 25 of file hashtbl.h.

SDWORD _COLUMNDATA::dwLength

Definition at line 23 of file hashtbl.h.

DWORD _COLUMNDATA::dwStatus

Definition at line 24 of file hashtbl.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/oledb/sampprov/hashtbl.h
Generated on Wed Nov 13 2024 16:55:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _CommandVtbl Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

_CommandVtbl Struct Reference

#include "adoint.h"

List of all members.

Public Member Functions

BEGIN_INTERFACE | HRESULT (STDMETHODCALLTYPE __RPC_FAR *QueryInterface)(_ADOCommand __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *put_Name)(_ADOCommand __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Name)(_ADOCommand __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount)(_ADOCommand __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_CommandType)(_ADOCommand __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *put_CommandType)(_ADOCommand __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Parameters)(_ADOCommand __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Cancel)(_ADOCommand __RPC_FAR *This)
HRESULT (STDMETHODCALLTYPE __RPC_FAR *CreateParameter)(_ADOCommand __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Execute)(_ADOCommand __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Properties)(_ADOCommand __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Prepared)(_ADOCommand __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *put_CommandTimeout)(_ADOCommand __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_CommandTimeout)(_ADOCommand __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *put_CommandText)(_ADOCommand __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_State)(_ADOCommand __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *put_ActiveConnection)(_ADOCommand __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *putref_ActiveADOConnection)(_ADOCommand __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *put_Prepared)(_ADOCommand __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_ActiveConnection)(_ADOCommand __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Invoke)(_ADOCommand __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_CommandText)(_ADOCommand __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo)(_ADOCommand __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames)(_ADOCommand __RPC_FAR *This
ULONG (STDMETHODCALLTYPE __RPC_FAR *AddRef)(_ADOCommand __RPC_FAR *This)
ULONG (STDMETHODCALLTYPE __RPC_FAR *Release)(_ADOCommand __RPC_FAR *This)

Public Attributes

BSTR | bstr
BSTR | bstrName
REFIID LPOLESTR __RPC_FAR UINT | cNames
BSTR DataTypeEnum
ParameterDirectionEnum 		Direction
DISPID | dispIdMember
VARIANT_BOOL | fPrepared
UINT iTInfo
UINT LCID | lcid
REFIID LPOLESTR __RPC_FAR UINT LCID | lcid
DISPID REFIID LCID | lcid
CommandTypeEnum lCmdType
BSTR | Name
VARIANT __RPC_FAR VARIANT
__RPC_FAR long 		Options
VARIANT __RPC_FAR VARIANT
__RPC_FAR * 		Parameters
BSTR __RPC_FAR * | pbstr
BSTR __RPC_FAR * | pbstrName
_ADOConnection __RPC_FAR * | pCon
UINT __RPC_FAR * | pctinfo
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR * 		pDispParams
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR EXCEPINFO __RPC_FAR * 		pExcepInfo
VARIANT_BOOL __RPC_FAR * | pfPrepared
LONG __RPC_FAR * | pl
CommandTypeEnum __RPC_FAR * | plCmdType
LONG __RPC_FAR * | plObjState
BSTR DataTypeEnum
ParameterDirectionEnum long
VARIANT _ADOParameter
__RPC_FAR *__RPC_FAR * 		ppiprm
VARIANT __RPC_FAR VARIANT
__RPC_FAR long _ADORecordset
__RPC_FAR *__RPC_FAR * 		ppirs
UINT LCID ITypeInfo __RPC_FAR
*__RPC_FAR * 		ppTInfo
ADOParameters __RPC_FAR
*__RPC_FAR * 		ppvObject
BEGIN_INTERFACE REFIID void
__RPC_FAR *__RPC_FAR * 		ppvObject
_ADOConnection __RPC_FAR
*__RPC_FAR * 		ppvObject
ADOProperties __RPC_FAR
*__RPC_FAR * 		ppvObject
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR EXCEPINFO __RPC_FAR
UINT __RPC_FAR * 		puArgErr
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR * 		pVarResult
VARIANT __RPC_FAR * | RecordsAffected
REFIID LPOLESTR __RPC_FAR UINT
LCID DISPID __RPC_FAR * 		rgDispId
REFIID LPOLESTR __RPC_FAR * | rgszNames
REFIID | riid
DISPID REFIID | riid
BEGIN_INTERFACE REFIID | riid
BSTR DataTypeEnum
ParameterDirectionEnum long 		Size
LONG | Timeout
BSTR DataTypeEnum | Type
BSTR DataTypeEnum
ParameterDirectionEnum long
VARIANT 		Value
VARIANT | vConn
DISPID REFIID LCID WORD | wFlags

Detailed Description

Definition at line 1244 of file adoint.h.

Member Function Documentation

BEGIN_INTERFACE _CommandVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * QueryInterface )
_CommandVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * put_Name )
_CommandVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Name )
_CommandVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetTypeInfoCount )
_CommandVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_CommandType )
_CommandVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * put_CommandType )
_CommandVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Parameters )
_CommandVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Cancel )
_CommandVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * CreateParameter )
_CommandVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Execute )
_CommandVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Properties )
_CommandVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Prepared )
_CommandVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * put_CommandTimeout )
_CommandVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_CommandTimeout )
_CommandVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * put_CommandText )
_CommandVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_State )
_CommandVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * put_ActiveConnection )
_CommandVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * putref_ActiveADOConnection )
_CommandVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * put_Prepared )
_CommandVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_ActiveConnection )
_CommandVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Invoke )
_CommandVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_CommandText )
_CommandVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetTypeInfo )
_CommandVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetIDsOfNames )
_CommandVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * AddRef )
_CommandVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * Release )

Member Data Documentation

BSTR _CommandVtbl::bstr

Definition at line 1310 of file adoint.h.

BSTR _CommandVtbl::bstrName

Definition at line 1369 of file adoint.h.

REFIID LPOLESTR __RPC_FAR UINT _CommandVtbl::cNames

Definition at line 1271 of file adoint.h.

BSTR DataTypeEnum ParameterDirectionEnum _CommandVtbl::Direction

Definition at line 1337 of file adoint.h.

DISPID _CommandVtbl::dispIdMember

Definition at line 1279 of file adoint.h.

VARIANT_BOOL _CommandVtbl::fPrepared

Definition at line 1326 of file adoint.h.

UINT _CommandVtbl::iTInfo

Definition at line 1265 of file adoint.h.

UINT LCID _CommandVtbl::lcid

Definition at line 1265 of file adoint.h.

REFIID LPOLESTR __RPC_FAR UINT LCID _CommandVtbl::lcid

Definition at line 1271 of file adoint.h.

DISPID REFIID LCID _CommandVtbl::lcid

Definition at line 1279 of file adoint.h.

CommandTypeEnum _CommandVtbl::lCmdType

Definition at line 1353 of file adoint.h.

BSTR _CommandVtbl::Name

Definition at line 1337 of file adoint.h.

VARIANT __RPC_FAR VARIANT __RPC_FAR long _CommandVtbl::Options

Definition at line 1330 of file adoint.h.

VARIANT __RPC_FAR VARIANT __RPC_FAR* _CommandVtbl::Parameters

Definition at line 1330 of file adoint.h.

BSTR __RPC_FAR* _CommandVtbl::pbstr

Definition at line 1306 of file adoint.h.

BSTR __RPC_FAR* _CommandVtbl::pbstrName

Definition at line 1365 of file adoint.h.

_ADOConnection __RPC_FAR* _CommandVtbl::pCon

Definition at line 1298 of file adoint.h.

UINT __RPC_FAR* _CommandVtbl::pctinfo

Definition at line 1261 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR* _CommandVtbl::pDispParams

Definition at line 1279 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR EXCEPINFO __RPC_FAR* _CommandVtbl::pExcepInfo

Definition at line 1279 of file adoint.h.

VARIANT_BOOL __RPC_FAR* _CommandVtbl::pfPrepared

Definition at line 1322 of file adoint.h.

LONG __RPC_FAR* _CommandVtbl::pl

Definition at line 1314 of file adoint.h.

CommandTypeEnum __RPC_FAR* _CommandVtbl::plCmdType

Definition at line 1357 of file adoint.h.

LONG __RPC_FAR* _CommandVtbl::plObjState

Definition at line 1361 of file adoint.h.

BSTR DataTypeEnum ParameterDirectionEnum long VARIANT _ADOParameter __RPC_FAR* __RPC_FAR* _CommandVtbl::ppiprm

Definition at line 1337 of file adoint.h.

VARIANT __RPC_FAR VARIANT __RPC_FAR long _ADORecordset __RPC_FAR* __RPC_FAR* _CommandVtbl::ppirs

Definition at line 1330 of file adoint.h.

UINT LCID ITypeInfo __RPC_FAR* __RPC_FAR* _CommandVtbl::ppTInfo

Definition at line 1265 of file adoint.h.

ADOParameters __RPC_FAR* __RPC_FAR* _CommandVtbl::ppvObject

Definition at line 1349 of file adoint.h.

BEGIN_INTERFACE REFIID void __RPC_FAR* __RPC_FAR* _CommandVtbl::ppvObject

Definition at line 1250 of file adoint.h.

_ADOConnection __RPC_FAR* __RPC_FAR* _CommandVtbl::ppvObject

Definition at line 1294 of file adoint.h.

ADOProperties __RPC_FAR* __RPC_FAR* _CommandVtbl::ppvObject

Definition at line 1290 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR EXCEPINFO __RPC_FAR UINT __RPC_FAR* _CommandVtbl::puArgErr

Definition at line 1279 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR* _CommandVtbl::pVarResult

Definition at line 1279 of file adoint.h.

VARIANT __RPC_FAR* _CommandVtbl::RecordsAffected

Definition at line 1330 of file adoint.h.

REFIID LPOLESTR __RPC_FAR UINT LCID DISPID __RPC_FAR* _CommandVtbl::rgDispId

Definition at line 1271 of file adoint.h.

REFIID LPOLESTR __RPC_FAR* _CommandVtbl::rgszNames

Definition at line 1271 of file adoint.h.

REFIID _CommandVtbl::riid

Definition at line 1271 of file adoint.h.

DISPID REFIID _CommandVtbl::riid

Definition at line 1279 of file adoint.h.

BEGIN_INTERFACE REFIID _CommandVtbl::riid

Definition at line 1250 of file adoint.h.

BSTR DataTypeEnum ParameterDirectionEnum long _CommandVtbl::Size

Definition at line 1337 of file adoint.h.

LONG _CommandVtbl::Timeout

Definition at line 1318 of file adoint.h.

BSTR DataTypeEnum _CommandVtbl::Type

Definition at line 1337 of file adoint.h.

BSTR DataTypeEnum ParameterDirectionEnum long VARIANT _CommandVtbl::Value

Definition at line 1337 of file adoint.h.

VARIANT _CommandVtbl::vConn

Definition at line 1302 of file adoint.h.

DISPID REFIID LCID WORD _CommandVtbl::wFlags

Definition at line 1279 of file adoint.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/rds/handler/vc/adoint.h
Generated on Wed Nov 13 2024 16:55:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _CONFIGURATION_ENTRY Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_CONFIGURATION_ENTRY Struct Reference

#include "configentry.h"

List of all members.

Public Attributes

DYNAMIC_LOCKS_STORE dlsDynamicLocksStore
DWORD dwLogLevel
DWORD dwTraceID
HANDLE hActivitySemaphore
HANDLE hGlobalHeap
HANDLE hLogHandle
HANDLE hMgmHandle
HANDLE hMgrNotificationEvent
HANDLE hRtmHandle
HANDLE hRtmNotificationHandle
HANDLE hTimerQueue
IPSAMPLE_GLOBAL_STATS igsStats
IPSAMPLE_STATUS_CODE iscStatus
LOCKED_QUEUE | lqEventQueue
PNETWORK_ENTRY pneNetworkEntry
RTM_ENTITY_INFO | reiRtmEntity
RTM_REGN_PROFILE | rrpRtmProfile
READ_WRITE_LOCK rwlLock
SUPPORT_FUNCTIONS | sfSupportFunctions
ULONG ulActivityCount

Detailed Description

Definition at line 88 of file configentry.h.

Member Data Documentation

DYNAMIC_LOCKS_STORE _CONFIGURATION_ENTRY::dlsDynamicLocksStore

Definition at line 122 of file configentry.h.

DWORD _CONFIGURATION_ENTRY::dwLogLevel

Definition at line 105 of file configentry.h.

DWORD _CONFIGURATION_ENTRY::dwTraceID

Definition at line 107 of file configentry.h.

HANDLE _CONFIGURATION_ENTRY::hActivitySemaphore

Definition at line 102 of file configentry.h.

HANDLE _CONFIGURATION_ENTRY::hGlobalHeap

Definition at line 98 of file configentry.h.

HANDLE _CONFIGURATION_ENTRY::hLogHandle

Definition at line 106 of file configentry.h.

HANDLE _CONFIGURATION_ENTRY::hMgmHandle

Definition at line 138 of file configentry.h.

HANDLE _CONFIGURATION_ENTRY::hMgrNotificationEvent

Definition at line 128 of file configentry.h.

HANDLE _CONFIGURATION_ENTRY::hRtmHandle

Definition at line 134 of file configentry.h.

HANDLE _CONFIGURATION_ENTRY::hRtmNotificationHandle

Definition at line 135 of file configentry.h.

HANDLE _CONFIGURATION_ENTRY::hTimerQueue

Definition at line 125 of file configentry.h.

IPSAMPLE_GLOBAL_STATS _CONFIGURATION_ENTRY::igsStats

Definition at line 144 of file configentry.h.

IPSAMPLE_STATUS_CODE _CONFIGURATION_ENTRY::iscStatus

Definition at line 113 of file configentry.h.

LOCKED_QUEUE _CONFIGURATION_ENTRY::lqEventQueue

Definition at line 110 of file configentry.h.

PNETWORK_ENTRY _CONFIGURATION_ENTRY::pneNetworkEntry

Definition at line 141 of file configentry.h.

RTM_ENTITY_INFO _CONFIGURATION_ENTRY::reiRtmEntity

Definition at line 132 of file configentry.h.

RTM_REGN_PROFILE _CONFIGURATION_ENTRY::rrpRtmProfile

Definition at line 133 of file configentry.h.

READ_WRITE_LOCK _CONFIGURATION_ENTRY::rwlLock

Definition at line 95 of file configentry.h.

SUPPORT_FUNCTIONS _CONFIGURATION_ENTRY::sfSupportFunctions

Definition at line 129 of file configentry.h.

ULONG _CONFIGURATION_ENTRY::ulActivityCount

Definition at line 101 of file configentry.h.

The documentation for this struct was generated from the following file:
  • NetDS/RRas/ip/configentry.h
Generated on Wed Nov 13 2024 16:55:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _CONNECTEXARGS Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_CONNECTEXARGS Struct Reference

#include "provider.h"

List of all members.

Public Attributes

DWORD dwBytesSent
DWORD dwSendDataLength
PVOID lpSendBuffer
SOCKADDR_STORAGE | name
int | namelen
SOCKET | s

Detailed Description

Definition at line 120 of file provider.h.

Member Data Documentation

DWORD _CONNECTEXARGS::dwBytesSent

Definition at line 127 of file provider.h.

DWORD _CONNECTEXARGS::dwSendDataLength

Definition at line 126 of file provider.h.

PVOID _CONNECTEXARGS::lpSendBuffer

Definition at line 125 of file provider.h.

SOCKADDR_STORAGE _CONNECTEXARGS::name

Definition at line 123 of file provider.h.

int _CONNECTEXARGS::namelen

Definition at line 124 of file provider.h.

SOCKET _CONNECTEXARGS::s

Definition at line 122 of file provider.h.

The documentation for this struct was generated from the following file:
  • NetDS/WinSock/LSP/provider.h
Generated on Wed Nov 13 2024 16:55:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _ConnectionVtbl Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

_ConnectionVtbl Struct Reference

#include "adoint.h"

List of all members.

Public Member Functions

BEGIN_INTERFACE | HRESULT (STDMETHODCALLTYPE __RPC_FAR *QueryInterface)(_ADOConnection __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *OpenSchema)(_ADOConnection __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Cancel)(_ADOConnection __RPC_FAR *This)
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_State)(_ADOConnection __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *put_Provider)(_ADOConnection __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Provider)(_ADOConnection __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount)(_ADOConnection __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Mode)(_ADOConnection __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *put_CursorLocation)(_ADOConnection __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_CursorLocation)(_ADOConnection __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *put_Attributes)(_ADOConnection __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Attributes)(_ADOConnection __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *put_IsolationLevel)(_ADOConnection __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_IsolationLevel)(_ADOConnection __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Properties)(_ADOConnection __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_DefaultDatabase)(_ADOConnection __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Errors)(_ADOConnection __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Open)(_ADOConnection __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *RollbackTrans)(_ADOConnection __RPC_FAR *This)
HRESULT (STDMETHODCALLTYPE __RPC_FAR *CommitTrans)(_ADOConnection __RPC_FAR *This)
HRESULT (STDMETHODCALLTYPE __RPC_FAR *BeginTrans)(_ADOConnection __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Close)(_ADOConnection __RPC_FAR *This)
HRESULT (STDMETHODCALLTYPE __RPC_FAR *put_Mode)(_ADOConnection __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Version)(_ADOConnection __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *put_ConnectionTimeout)(_ADOConnection __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_ConnectionTimeout)(_ADOConnection __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *put_DefaultDatabase)(_ADOConnection __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_CommandTimeout)(_ADOConnection __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *put_ConnectionString)(_ADOConnection __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Execute)(_ADOConnection __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_ConnectionString)(_ADOConnection __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Invoke)(_ADOConnection __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *put_CommandTimeout)(_ADOConnection __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo)(_ADOConnection __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames)(_ADOConnection __RPC_FAR *This
ULONG (STDMETHODCALLTYPE __RPC_FAR *AddRef)(_ADOConnection __RPC_FAR *This)
ULONG (STDMETHODCALLTYPE __RPC_FAR *Release)(_ADOConnection __RPC_FAR *This)

Public Attributes

BSTR | bstr
REFIID LPOLESTR __RPC_FAR UINT | cNames
BSTR | CommandText
BSTR | ConnectionString
DISPID | dispIdMember
UINT iTInfo
long | lAttr
UINT LCID | lcid
REFIID LPOLESTR __RPC_FAR UINT LCID | lcid
DISPID REFIID LCID | lcid
CursorLocationEnum lCursorLoc
IsolationLevelEnum __RPC_FAR * | Level
IsolationLevelEnum Level
ConnectModeEnum lMode
LONG | lTimeout
BSTR BSTR BSTR long | Options
BSTR VARIANT __RPC_FAR long | Options
BSTR BSTR BSTR | Password
BSTR __RPC_FAR * | pbstr
UINT __RPC_FAR * | pctinfo
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR * 		pDispParams
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR EXCEPINFO __RPC_FAR * 		pExcepInfo
long __RPC_FAR * | plAttr
CursorLocationEnum __RPC_FAR * | plCursorLoc
ConnectModeEnum __RPC_FAR * | plMode
LONG __RPC_FAR * | plObjState
LONG __RPC_FAR * | plTimeout
BSTR VARIANT __RPC_FAR long
_ADORecordset __RPC_FAR
*__RPC_FAR * 		ppiRset
SchemaEnum VARIANT VARIANT
_ADORecordset __RPC_FAR
*__RPC_FAR * 		pprset
UINT LCID ITypeInfo __RPC_FAR
*__RPC_FAR * 		ppTInfo
ADOErrors __RPC_FAR *__RPC_FAR * | ppvObject
BEGIN_INTERFACE REFIID void
__RPC_FAR *__RPC_FAR * 		ppvObject
ADOProperties __RPC_FAR
*__RPC_FAR * 		ppvObject
BSTR | Provider
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR EXCEPINFO __RPC_FAR
UINT __RPC_FAR * 		puArgErr
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR * 		pVarResult
BSTR VARIANT __RPC_FAR * | RecordsAffected
SchemaEnum VARIANT | Restrictions
REFIID LPOLESTR __RPC_FAR UINT
LCID DISPID __RPC_FAR * 		rgDispId
REFIID LPOLESTR __RPC_FAR * | rgszNames
REFIID | riid
DISPID REFIID | riid
BEGIN_INTERFACE REFIID | riid
SchemaEnum Schema
SchemaEnum VARIANT VARIANT | SchemaID
long __RPC_FAR * | TransactionLevel
BSTR BSTR | UserID
DISPID REFIID LCID WORD | wFlags

Detailed Description

Definition at line 1695 of file adoint.h.

Member Function Documentation

BEGIN_INTERFACE _ConnectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * QueryInterface )
_ConnectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * OpenSchema )
_ConnectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Cancel )
_ConnectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_State )
_ConnectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * put_Provider )
_ConnectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Provider )
_ConnectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetTypeInfoCount )
_ConnectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Mode )
_ConnectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * put_CursorLocation )
_ConnectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_CursorLocation )
_ConnectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * put_Attributes )
_ConnectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Attributes )
_ConnectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * put_IsolationLevel )
_ConnectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_IsolationLevel )
_ConnectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Properties )
_ConnectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_DefaultDatabase )
_ConnectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Errors )
_ConnectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Open )
_ConnectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * RollbackTrans )
_ConnectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * CommitTrans )
_ConnectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * BeginTrans )
_ConnectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Close )
_ConnectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * put_Mode )
_ConnectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Version )
_ConnectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * put_ConnectionTimeout )
_ConnectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_ConnectionTimeout )
_ConnectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * put_DefaultDatabase )
_ConnectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_CommandTimeout )
_ConnectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * put_ConnectionString )
_ConnectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Execute )
_ConnectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_ConnectionString )
_ConnectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Invoke )
_ConnectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * put_CommandTimeout )
_ConnectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetTypeInfo )
_ConnectionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetIDsOfNames )
_ConnectionVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * AddRef )
_ConnectionVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * Release )

Member Data Documentation

BSTR _ConnectionVtbl::bstr

Definition at line 1749 of file adoint.h.

REFIID LPOLESTR __RPC_FAR UINT _ConnectionVtbl::cNames

Definition at line 1722 of file adoint.h.

BSTR _ConnectionVtbl::CommandText

Definition at line 1776 of file adoint.h.

BSTR _ConnectionVtbl::ConnectionString

Definition at line 1793 of file adoint.h.

DISPID _ConnectionVtbl::dispIdMember

Definition at line 1730 of file adoint.h.

UINT _ConnectionVtbl::iTInfo

Definition at line 1716 of file adoint.h.

long _ConnectionVtbl::lAttr

Definition at line 1824 of file adoint.h.

UINT LCID _ConnectionVtbl::lcid

Definition at line 1716 of file adoint.h.

REFIID LPOLESTR __RPC_FAR UINT LCID _ConnectionVtbl::lcid

Definition at line 1722 of file adoint.h.

DISPID REFIID LCID _ConnectionVtbl::lcid

Definition at line 1730 of file adoint.h.

CursorLocationEnum _ConnectionVtbl::lCursorLoc

Definition at line 1832 of file adoint.h.

IsolationLevelEnum __RPC_FAR* _ConnectionVtbl::Level

Definition at line 1812 of file adoint.h.

IsolationLevelEnum _ConnectionVtbl::Level

Definition at line 1816 of file adoint.h.

ConnectModeEnum _ConnectionVtbl::lMode

Definition at line 1840 of file adoint.h.

LONG _ConnectionVtbl::lTimeout

Definition at line 1757 of file adoint.h.

BSTR BSTR BSTR long _ConnectionVtbl::Options

Definition at line 1793 of file adoint.h.

BSTR VARIANT __RPC_FAR long _ConnectionVtbl::Options

Definition at line 1776 of file adoint.h.

BSTR BSTR BSTR _ConnectionVtbl::Password

Definition at line 1793 of file adoint.h.

BSTR __RPC_FAR * _ConnectionVtbl::pbstr

Definition at line 1745 of file adoint.h.

UINT __RPC_FAR* _ConnectionVtbl::pctinfo

Definition at line 1712 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR* _ConnectionVtbl::pDispParams

Definition at line 1730 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR EXCEPINFO __RPC_FAR* _ConnectionVtbl::pExcepInfo

Definition at line 1730 of file adoint.h.

long __RPC_FAR* _ConnectionVtbl::plAttr

Definition at line 1820 of file adoint.h.

CursorLocationEnum __RPC_FAR* _ConnectionVtbl::plCursorLoc

Definition at line 1828 of file adoint.h.

ConnectModeEnum __RPC_FAR* _ConnectionVtbl::plMode

Definition at line 1836 of file adoint.h.

LONG __RPC_FAR* _ConnectionVtbl::plObjState

Definition at line 1852 of file adoint.h.

LONG __RPC_FAR * _ConnectionVtbl::plTimeout

Definition at line 1753 of file adoint.h.

BSTR VARIANT __RPC_FAR long _ADORecordset __RPC_FAR* __RPC_FAR* _ConnectionVtbl::ppiRset

Definition at line 1776 of file adoint.h.

SchemaEnum VARIANT VARIANT _ADORecordset __RPC_FAR* __RPC_FAR* _ConnectionVtbl::pprset

Definition at line 1859 of file adoint.h.

UINT LCID ITypeInfo __RPC_FAR* __RPC_FAR* _ConnectionVtbl::ppTInfo

Definition at line 1716 of file adoint.h.

ADOErrors __RPC_FAR* __RPC_FAR* _ConnectionVtbl::ppvObject

Definition at line 1800 of file adoint.h.

BEGIN_INTERFACE REFIID void __RPC_FAR* __RPC_FAR* _ConnectionVtbl::ppvObject

Definition at line 1701 of file adoint.h.

ADOProperties __RPC_FAR* __RPC_FAR* _ConnectionVtbl::ppvObject

Definition at line 1741 of file adoint.h.

BSTR _ConnectionVtbl::Provider

Definition at line 1848 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR EXCEPINFO __RPC_FAR UINT __RPC_FAR* _ConnectionVtbl::puArgErr

Definition at line 1730 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR* _ConnectionVtbl::pVarResult

Definition at line 1730 of file adoint.h.

BSTR VARIANT __RPC_FAR* _ConnectionVtbl::RecordsAffected

Definition at line 1776 of file adoint.h.

SchemaEnum VARIANT _ConnectionVtbl::Restrictions

Definition at line 1859 of file adoint.h.

REFIID LPOLESTR __RPC_FAR UINT LCID DISPID __RPC_FAR* _ConnectionVtbl::rgDispId

Definition at line 1722 of file adoint.h.

REFIID LPOLESTR __RPC_FAR* _ConnectionVtbl::rgszNames

Definition at line 1722 of file adoint.h.

REFIID _ConnectionVtbl::riid

Definition at line 1722 of file adoint.h.

DISPID REFIID _ConnectionVtbl::riid

Definition at line 1730 of file adoint.h.

BEGIN_INTERFACE REFIID _ConnectionVtbl::riid

Definition at line 1701 of file adoint.h.

SchemaEnum _ConnectionVtbl::Schema

Definition at line 1859 of file adoint.h.

SchemaEnum VARIANT VARIANT _ConnectionVtbl::SchemaID

Definition at line 1859 of file adoint.h.

long __RPC_FAR* _ConnectionVtbl::TransactionLevel

Definition at line 1783 of file adoint.h.

BSTR BSTR _ConnectionVtbl::UserID

Definition at line 1793 of file adoint.h.

DISPID REFIID LCID WORD _ConnectionVtbl::wFlags

Definition at line 1730 of file adoint.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/rds/handler/vc/adoint.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _COPY_CHUNK Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_COPY_CHUNK Struct Reference

List of all members.

Public Attributes

LPVOID | Buffer
OVERLAPPED | Overlapped

Detailed Description

Definition at line 87 of file UnBufCp1.c.

Member Data Documentation

LPVOID _COPY_CHUNK::Buffer

Definition at line 89 of file UnBufCp1.c.

OVERLAPPED _COPY_CHUNK::Overlapped

Definition at line 88 of file UnBufCp1.c.

The documentation for this struct was generated from the following files:
  • WinBase/IO/UnBufCpy/UnBufCp1.c
  • WinBase/IO/UnBufCpy/UnBufCp2.c
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _CounterInfoBlock Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_CounterInfoBlock Struct Reference

#include "MainWnd.h"

List of all members.

Public Attributes

double | dLastValue
DWORD dwFirstIndex
DWORD dwLastIndex
DWORD dwNextIndex
HCOUNTER | hCounter
PPDH_RAW_COUNTER | pCounterArray
PDH_STATISTICS | pdhCurrentStats
struct _CounterInfoBlock * | pNext
TCHAR | szCounterPath [COUNTER_STRING_SIZE]

Detailed Description

Definition at line 17 of file MainWnd.h.

Member Data Documentation

double _CounterInfoBlock::dLastValue

Definition at line 26 of file MainWnd.h.

DWORD _CounterInfoBlock::dwFirstIndex

Definition at line 22 of file MainWnd.h.

DWORD _CounterInfoBlock::dwLastIndex

Definition at line 24 of file MainWnd.h.

DWORD _CounterInfoBlock::dwNextIndex

Definition at line 23 of file MainWnd.h.

HCOUNTER _CounterInfoBlock::hCounter

Definition at line 20 of file MainWnd.h.

PPDH_RAW_COUNTER _CounterInfoBlock::pCounterArray

Definition at line 21 of file MainWnd.h.

PDH_STATISTICS _CounterInfoBlock::pdhCurrentStats

Definition at line 25 of file MainWnd.h.

struct _CounterInfoBlock* _CounterInfoBlock::pNext

Definition at line 18 of file MainWnd.h.

TCHAR _CounterInfoBlock::szCounterPath[COUNTER_STRING_SIZE]

Definition at line 19 of file MainWnd.h.

The documentation for this struct was generated from the following file:
  • WinBase/WinNT/PerfTool/Pdh/StatList/MainWnd.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _CREDENTIAL Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_CREDENTIAL Struct Reference

#include "SampSSP.H"

List of all members.

Public Attributes

ULONG * AuthData
ULONG CredentialId
struct _CREDENTIAL * Next
ULONG Use

Detailed Description

Definition at line 39 of file SampSSP.H.

Member Data Documentation

ULONG* _CREDENTIAL::AuthData

Definition at line 43 of file SampSSP.H.

ULONG _CREDENTIAL::CredentialId

Definition at line 41 of file SampSSP.H.

struct _CREDENTIAL* _CREDENTIAL::Next

Definition at line 40 of file SampSSP.H.

ULONG _CREDENTIAL::Use

Definition at line 42 of file SampSSP.H.

The documentation for this struct was generated from the following file:
  • Security/Authentication/SampSSP/SampSSP.H
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _CSampleDropExt Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_CSampleDropExt Struct Reference

List of all members.

Public Attributes

UINT _cRef
IContextMenu | _ctm
HKEY _hkeyProgID
LPDATAOBJECT | _pdtobj
IShellExtInit | _sxi
char | _szTargetFolder [MAX_PATH]

Detailed Description

Definition at line 133 of file DropExt.C.

Member Data Documentation

UINT _CSampleDropExt::_cRef

Definition at line 137 of file DropExt.C.

IContextMenu _CSampleDropExt::_ctm

Definition at line 135 of file DropExt.C.

HKEY _CSampleDropExt::_hkeyProgID

Definition at line 139 of file DropExt.C.

LPDATAOBJECT _CSampleDropExt::_pdtobj

Definition at line 138 of file DropExt.C.

IShellExtInit _CSampleDropExt::_sxi

Definition at line 136 of file DropExt.C.

char _CSampleDropExt::_szTargetFolder[MAX_PATH]

Definition at line 140 of file DropExt.C.

The documentation for this struct was generated from the following file:
  • WinUI/Shell/DropExt/DropExt.C
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _CUSTOM_DIAL_DLG_SAMPLE_ Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_CUSTOM_DIAL_DLG_SAMPLE_ Struct Reference

List of all members.

Public Attributes

RASDIALDLG | tDialDlg
RASDIALPARAMS | tDialParams

Detailed Description

Definition at line 68 of file customdial.cpp.

Member Data Documentation

RASDIALDLG _CUSTOM_DIAL_DLG_SAMPLE_::tDialDlg

Definition at line 70 of file customdial.cpp.

RASDIALPARAMS _CUSTOM_DIAL_DLG_SAMPLE_::tDialParams

Definition at line 71 of file customdial.cpp.

The documentation for this struct was generated from the following file:
  • NetDS/Ras/customdial/customdial.cpp
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _CUSTOM_ENTRY_DATA_SAMPLE_ Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_CUSTOM_ENTRY_DATA_SAMPLE_ Struct Reference

List of all members.

Public Attributes

LPRASENTRY | ptEntry
TCHAR | szEntryName [RAS_MaxEntryName+1]
TCHAR | szPhoneBookPath [MAX_PATH+1]
RASENTRYDLG | tEntryDlg

Detailed Description

Definition at line 59 of file customdial.cpp.

Member Data Documentation

LPRASENTRY _CUSTOM_ENTRY_DATA_SAMPLE_::ptEntry

Definition at line 62 of file customdial.cpp.

TCHAR _CUSTOM_ENTRY_DATA_SAMPLE_::szEntryName[RAS_MaxEntryName+1]

Definition at line 63 of file customdial.cpp.

TCHAR _CUSTOM_ENTRY_DATA_SAMPLE_::szPhoneBookPath[MAX_PATH+1]

Definition at line 64 of file customdial.cpp.

RASENTRYDLG _CUSTOM_ENTRY_DATA_SAMPLE_::tEntryDlg

Definition at line 61 of file customdial.cpp.

The documentation for this struct was generated from the following file:
  • NetDS/Ras/customdial/customdial.cpp
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _DATA_BUFFER Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_DATA_BUFFER Struct Reference

#include "common.h"

List of all members.

Public Attributes

char | buf [RECV_DATA_SIZE]
int | dataSize
BOOL isNewData
int | sendOffset

Detailed Description

Definition at line 72 of file common.h.

Member Data Documentation

char _DATA_BUFFER::buf[RECV_DATA_SIZE]

Definition at line 74 of file common.h.

int _DATA_BUFFER::dataSize

Definition at line 75 of file common.h.

BOOL _DATA_BUFFER::isNewData

Definition at line 77 of file common.h.

int _DATA_BUFFER::sendOffset

Definition at line 76 of file common.h.

The documentation for this struct was generated from the following file:
  • NetDS/WinSock/Accept/common.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _DEVICE_INFO Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_DEVICE_INFO Struct Reference

#include "NewFsp.h"

List of all members.

Public Attributes

CRITICAL_SECTION | cs
DWORD DeviceId
WCHAR | Directory [MAX_PATH_LEN]
HANDLE ExitEvent
struct _JOB_INFO * | pJobInfo
struct _DEVICE_INFO * | pNextDeviceInfo
DWORD Status

Detailed Description

Definition at line 58 of file NewFsp.h.

Member Data Documentation

CRITICAL_SECTION _DEVICE_INFO::cs

Definition at line 59 of file NewFsp.h.

DWORD _DEVICE_INFO::DeviceId

Definition at line 60 of file NewFsp.h.

WCHAR _DEVICE_INFO::Directory[MAX_PATH_LEN]

Definition at line 61 of file NewFsp.h.

HANDLE _DEVICE_INFO::ExitEvent

Definition at line 63 of file NewFsp.h.

struct _JOB_INFO* _DEVICE_INFO::pJobInfo

Definition at line 65 of file NewFsp.h.

struct _DEVICE_INFO* _DEVICE_INFO::pNextDeviceInfo

Definition at line 64 of file NewFsp.h.

DWORD _DEVICE_INFO::Status

Definition at line 62 of file NewFsp.h.

The documentation for this struct was generated from the following file:
  • NetDS/fax/SampleFSP/NewFsp.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _DIBDATA Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_DIBDATA Struct Reference

#include "MfEdit.h"

List of all members.

Public Attributes

BOOL | rgbCoreHdr [MAX_FILE]
FILEINFO | rgFileInfo [MAX_FILE]
PBITMAPINFO | rgpbmi [MAX_FILE]
PBYTE | rgpjFrame [MAX_FRAME]
ULONG ulFiles
ULONG ulFrames

Detailed Description

Definition at line 517 of file MfEdit.h.

Member Data Documentation

BOOL _DIBDATA::rgbCoreHdr[MAX_FILE]

Definition at line 523 of file MfEdit.h.

FILEINFO _DIBDATA::rgFileInfo[MAX_FILE]

Definition at line 520 of file MfEdit.h.

PBITMAPINFO _DIBDATA::rgpbmi[MAX_FILE]

Definition at line 522 of file MfEdit.h.

PBYTE _DIBDATA::rgpjFrame[MAX_FRAME]

Definition at line 521 of file MfEdit.h.

ULONG _DIBDATA::ulFiles

Definition at line 518 of file MfEdit.h.

ULONG _DIBDATA::ulFrames

Definition at line 519 of file MfEdit.h.

The documentation for this struct was generated from the following file:
  • Multimedia/Gdi/Metafile/MfEdit/MfEdit.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _DISCONNECTEXARGS Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_DISCONNECTEXARGS Struct Reference

#include "provider.h"

List of all members.

Public Attributes

DWORD dwFlags
DWORD dwReserved
SOCKET s

Detailed Description

Definition at line 145 of file provider.h.

Member Data Documentation

DWORD _DISCONNECTEXARGS::dwFlags

Definition at line 148 of file provider.h.

DWORD _DISCONNECTEXARGS::dwReserved

Definition at line 149 of file provider.h.

SOCKET _DISCONNECTEXARGS::s

Definition at line 147 of file provider.h.

The documentation for this struct was generated from the following file:
  • NetDS/WinSock/LSP/provider.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _DLGITEMS Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_DLGITEMS Struct Reference

List of all members.

Public Attributes

DWORD dwStart
UINT uDelayID
UINT uNotify
UINT uState1
UINT uState2
UINT uTip1
UINT uTip2

Detailed Description

Definition at line 66 of file SetDisp.c.

Member Data Documentation

DWORD _DLGITEMS::dwStart

Definition at line 59 of file SetDisp.c.

UINT _DLGITEMS::uDelayID

Definition at line 61 of file SetDisp.c.

UINT _DLGITEMS::uNotify

Definition at line 60 of file SetDisp.c.

UINT _DLGITEMS::uState1

Definition at line 62 of file SetDisp.c.

UINT _DLGITEMS::uState2

Definition at line 64 of file SetDisp.c.

UINT _DLGITEMS::uTip1

Definition at line 63 of file SetDisp.c.

UINT _DLGITEMS::uTip2

Definition at line 65 of file SetDisp.c.

The documentation for this struct was generated from the following files:
  • Multimedia/Gdi/SetDisp/SetDisp.c
  • WinUI/Shell/TrayNot/App32.C
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _DOSDTTM Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_DOSDTTM Struct Reference

#include "wn_dos.h"

List of all members.

Public Attributes

union {
long lDOSDttm
struct {
BF day: 5
BF hours: 5
BF mint: 6
BF month: 4
BF sec: 5
BF year: 7
} S1
} U1

Detailed Description

Definition at line 151 of file wn_dos.h.

Member Data Documentation

BF _DOSDTTM::day

Definition at line 158 of file wn_dos.h.

BF _DOSDTTM::hours

Definition at line 163 of file wn_dos.h.

long _DOSDTTM::lDOSDttm

Definition at line 155 of file wn_dos.h.

BF _DOSDTTM::mint

Definition at line 162 of file wn_dos.h.

BF _DOSDTTM::month

Definition at line 159 of file wn_dos.h.

struct { ... } _DOSDTTM::S1
BF _DOSDTTM::sec

Definition at line 161 of file wn_dos.h.

union { ... } _DOSDTTM::U1
BF _DOSDTTM::year

Definition at line 160 of file wn_dos.h.

The documentation for this struct was generated from the following file:
  • Com/Fundamentals/OleStd/wn_dos.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _DRAWDATA Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_DRAWDATA Struct Reference

#include "Draw.h"

List of all members.

Public Attributes

int nObject

Detailed Description

Definition at line 30 of file Draw.h.

Member Data Documentation

int _DRAWDATA::nObject

Definition at line 32 of file Draw.h.

The documentation for this struct was generated from the following file:
  • Multimedia/Gdi/GdiDemo/Draw.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _DRVLINE Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_DRVLINE Struct Reference

#include "Atsp.h"

List of all members.

Public Attributes

BOOL bDropInProgress
DWORD dwCallState
DWORD dwCallStateMode
DWORD dwDeviceID
DWORD dwMediaMode
DWORD dwMSPHandle
HANDLE hComm
HTAPICALL | htCall
HTAPILINE | htLine
HTAPIMSPLINE | htMSPLineHandle
OVERLAPPED | Overlapped
LINEEVENT | pfnEventProc
char | szComm [8]

Detailed Description

Definition at line 40 of file Atsp.h.

Member Data Documentation

BOOL _DRVLINE::bDropInProgress

Definition at line 69 of file Atsp.h.

DWORD _DRVLINE::dwCallState

Definition at line 61 of file Atsp.h.

DWORD _DRVLINE::dwCallStateMode

Definition at line 63 of file Atsp.h.

DWORD _DRVLINE::dwDeviceID

Definition at line 55 of file Atsp.h.

DWORD _DRVLINE::dwMediaMode

Definition at line 65 of file Atsp.h.

DWORD _DRVLINE::dwMSPHandle

Definition at line 49 of file Atsp.h.

HANDLE _DRVLINE::hComm

Definition at line 67 of file Atsp.h.

HTAPICALL _DRVLINE::htCall

Definition at line 59 of file Atsp.h.

HTAPILINE _DRVLINE::htLine

Definition at line 42 of file Atsp.h.

HTAPIMSPLINE _DRVLINE::htMSPLineHandle

Definition at line 51 of file Atsp.h.

OVERLAPPED _DRVLINE::Overlapped

Definition at line 71 of file Atsp.h.

LINEEVENT _DRVLINE::pfnEventProc

Definition at line 44 of file Atsp.h.

char _DRVLINE::szComm[8]

Definition at line 57 of file Atsp.h.

The documentation for this struct was generated from the following file:
  • NetDS/Tapi/Tapi2/Atsp32/Atsp.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _DRVLINECONFIG Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_DRVLINECONFIG Struct Reference

#include "Atsp.h"

List of all members.

Public Attributes

char | szCommands [64]
char | szPort [8]

Detailed Description

Definition at line 76 of file Atsp.h.

Member Data Documentation

char _DRVLINECONFIG::szCommands[64]

Definition at line 80 of file Atsp.h.

char _DRVLINECONFIG::szPort[8]

Definition at line 78 of file Atsp.h.

The documentation for this struct was generated from the following file:
  • NetDS/Tapi/Tapi2/Atsp32/Atsp.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _DSA_SEC_PAGE_INFO Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_DSA_SEC_PAGE_INFO Struct Reference

#include "PropSheetHost.h"

List of all members.

Public Attributes

DSOBJECTNAMES | dsObjectNames
HWND | hwndParentSheet
DWORD offsetTitle

Detailed Description

Definition at line 69 of file PropSheetHost.h.

Member Data Documentation

DSOBJECTNAMES _DSA_SEC_PAGE_INFO::dsObjectNames

Definition at line 73 of file PropSheetHost.h.

HWND _DSA_SEC_PAGE_INFO::hwndParentSheet

Definition at line 71 of file PropSheetHost.h.

DWORD _DSA_SEC_PAGE_INFO::offsetTitle

Definition at line 72 of file PropSheetHost.h.

The documentation for this struct was generated from the following file:
  • NetDS/ActiveDirectory/PropSheetHost/PropSheetHost.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _DYNAMIC_LOCKS_STORE Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_DYNAMIC_LOCKS_STORE Struct Reference

#include "sync.h"

List of all members.

Public Attributes

HANDLE hHeap
LOCKED_LIST llFreeLocksList
ULONG ulCountAllocated
ULONG ulCountFree

Detailed Description

Definition at line 183 of file sync.h.

Member Data Documentation

HANDLE _DYNAMIC_LOCKS_STORE::hHeap

Definition at line 184 of file sync.h.

LOCKED_LIST _DYNAMIC_LOCKS_STORE::llFreeLocksList

Definition at line 186 of file sync.h.

ULONG _DYNAMIC_LOCKS_STORE::ulCountAllocated

Definition at line 188 of file sync.h.

ULONG _DYNAMIC_LOCKS_STORE::ulCountFree

Definition at line 189 of file sync.h.

The documentation for this struct was generated from the following file:
  • NetDS/RRas/ip/sync.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _DYNAMIC_READWRITE_LOCK Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_DYNAMIC_READWRITE_LOCK Struct Reference

#include "sync.h"

List of all members.

Public Attributes

union {
LIST_ENTRY leLink
ULONG ulCount
};
READ_WRITE_LOCK rwlLock

Detailed Description

Definition at line 170 of file sync.h.

Member Data Documentation

union { ... }
LIST_ENTRY _DYNAMIC_READWRITE_LOCK::leLink

Definition at line 175 of file sync.h.

READ_WRITE_LOCK _DYNAMIC_READWRITE_LOCK::rwlLock

Definition at line 171 of file sync.h.

ULONG _DYNAMIC_READWRITE_LOCK::ulCount

Definition at line 174 of file sync.h.

The documentation for this struct was generated from the following file:
  • NetDS/RRas/ip/sync.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _EAP_NAME_DIALOG Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_EAP_NAME_DIALOG Struct Reference

#include "Eap.h"

List of all members.

Public Attributes

WCHAR | awszIdentity [UNLEN+1]
WCHAR | awszPassword [PWLEN+1]

Detailed Description

Definition at line 51 of file Eap.h.

Member Data Documentation

WCHAR _EAP_NAME_DIALOG::awszIdentity[UNLEN+1]

Definition at line 53 of file Eap.h.

WCHAR _EAP_NAME_DIALOG::awszPassword[PWLEN+1]

Definition at line 54 of file Eap.h.

The documentation for this struct was generated from the following file:
  • NetDS/RRas/Eap/Eap.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _EAPCB Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_EAPCB Struct Reference

#include "Eap.h"

List of all members.

Public Attributes

CHAR | aszIdentity [UNLEN+1]
CHAR | aszPassword [PWLEN+1]
BYTE | bRecvPacketId
DWORD dwIdExpected
DWORD dwInitialPacketId
DWORD dwResult
DWORD dwSizeOfDataFromInteractiveUI
MYSTATE EapState
BOOL fAuthenticator
DWORD fFlags
BYTE * | pDataFromInteractiveUI
RAS_AUTH_ATTRIBUTE * | pMPPEKeyAttributes
PBYTE | pUIContext
RAS_AUTH_ATTRIBUTE * | pUserAttributes
LPVOID | pWorkBuffer

Detailed Description

Definition at line 30 of file Eap.h.

Member Data Documentation

CHAR _EAPCB::aszIdentity[UNLEN+1]

Definition at line 36 of file Eap.h.

CHAR _EAPCB::aszPassword[PWLEN+1]

Definition at line 38 of file Eap.h.

BYTE _EAPCB::bRecvPacketId

Definition at line 42 of file Eap.h.

DWORD _EAPCB::dwIdExpected

Definition at line 37 of file Eap.h.

DWORD _EAPCB::dwInitialPacketId

Definition at line 40 of file Eap.h.

DWORD _EAPCB::dwResult

Definition at line 39 of file Eap.h.

DWORD _EAPCB::dwSizeOfDataFromInteractiveUI

Definition at line 44 of file Eap.h.

MYSTATE _EAPCB::EapState

Definition at line 32 of file Eap.h.

BOOL _EAPCB::fAuthenticator

Definition at line 34 of file Eap.h.

DWORD _EAPCB::fFlags

Definition at line 33 of file Eap.h.

BYTE* _EAPCB::pDataFromInteractiveUI

Definition at line 41 of file Eap.h.

RAS_AUTH_ATTRIBUTE* _EAPCB::pMPPEKeyAttributes

Definition at line 47 of file Eap.h.

PBYTE _EAPCB::pUIContext

Definition at line 45 of file Eap.h.

RAS_AUTH_ATTRIBUTE* _EAPCB::pUserAttributes

Definition at line 46 of file Eap.h.

LPVOID _EAPCB::pWorkBuffer

Definition at line 35 of file Eap.h.

The documentation for this struct was generated from the following file:
  • NetDS/RRas/Eap/Eap.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _ENUMERATE_DIRECTORY_STACK Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_ENUMERATE_DIRECTORY_STACK Struct Reference

#include "AsyncIO.h"

List of all members.

Public Attributes

HANDLE FindHandle
LPSTR PathEnd

Detailed Description

Definition at line 140 of file AsyncIO.h.

Member Data Documentation

HANDLE _ENUMERATE_DIRECTORY_STACK::FindHandle

Definition at line 142 of file AsyncIO.h.

LPSTR _ENUMERATE_DIRECTORY_STACK::PathEnd

Definition at line 141 of file AsyncIO.h.

The documentation for this struct was generated from the following file:
  • WinBase/IO/AsyncIO/AsyncIO.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _ENUMERATE_DIRECTORY_STATE Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_ENUMERATE_DIRECTORY_STATE Struct Reference

#include "AsyncIO.h"

List of all members.

Public Attributes

DWORD Depth
CHAR | Path [MAX_PATH]
ENUMERATE_DIRECTORY_STACK | Stack [MAX_DEPTH]

Detailed Description

Definition at line 147 of file AsyncIO.h.

Member Data Documentation

DWORD _ENUMERATE_DIRECTORY_STATE::Depth

Definition at line 148 of file AsyncIO.h.

CHAR _ENUMERATE_DIRECTORY_STATE::Path[MAX_PATH]

Definition at line 150 of file AsyncIO.h.

ENUMERATE_DIRECTORY_STACK _ENUMERATE_DIRECTORY_STATE::Stack[MAX_DEPTH]

Definition at line 149 of file AsyncIO.h.

The documentation for this struct was generated from the following file:
  • WinBase/IO/AsyncIO/AsyncIO.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _ERRORMAP Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_ERRORMAP Struct Reference

List of all members.

Public Attributes

HRESULT | hr
WCHAR * | pwszError

Detailed Description

Definition at line 105 of file error.cpp.

Member Data Documentation

HRESULT _ERRORMAP::hr

Definition at line 107 of file error.cpp.

WCHAR* _ERRORMAP::pwszError

Definition at line 108 of file error.cpp.

The documentation for this struct was generated from the following file:
  • Dataaccess/oledb/tablecopy/error.cpp
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _EVENT_ENTRY Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_EVENT_ENTRY Struct Reference

#include "configentry.h"

List of all members.

Public Attributes

MESSAGE mMessage
QUEUE_ENTRY | qeEventQueueLink
ROUTING_PROTOCOL_EVENTS | rpeEvent

Detailed Description

Definition at line 26 of file configentry.h.

Member Data Documentation

MESSAGE _EVENT_ENTRY::mMessage

Definition at line 30 of file configentry.h.

QUEUE_ENTRY _EVENT_ENTRY::qeEventQueueLink

Definition at line 28 of file configentry.h.

ROUTING_PROTOCOL_EVENTS _EVENT_ENTRY::rpeEvent

Definition at line 29 of file configentry.h.

The documentation for this struct was generated from the following file:
  • NetDS/RRas/ip/configentry.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _EVENT_SINK_INFO Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_EVENT_SINK_INFO Struct Reference

List of all members.

Public Attributes

EventEnum eEvent
TCHAR * sDisplayName

Detailed Description

Definition at line 50 of file selectEventsDlg.Cpp.

Member Data Documentation

EventEnum _EVENT_SINK_INFO::eEvent

Definition at line 53 of file selectEventsDlg.Cpp.

TCHAR* _EVENT_SINK_INFO::sDisplayName

Definition at line 52 of file selectEventsDlg.Cpp.

The documentation for this struct was generated from the following file:
  • Com/Administration/Spy/ComSpyCtl/selectEventsDlg.Cpp
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _Events Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_Events Struct Reference

#include "WaitSystemDlg.h"

List of all members.

Public Attributes

DWORD EventFlag
TCHAR EventName [40]

Detailed Description

Definition at line 14 of file WaitSystemDlg.h.

Member Data Documentation

DWORD _Events::EventFlag

Definition at line 16 of file WaitSystemDlg.h.

TCHAR _Events::EventName[40]

Definition at line 15 of file WaitSystemDlg.h.

The documentation for this struct was generated from the following file:
  • WinBase/WtsApi/WtsApi/WaitSystemDlg.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _ExpenseBuf Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_ExpenseBuf Struct Reference

#include "common.h"

List of all members.

Public Attributes

DWORD dwAmmount
DWORD dwType

Detailed Description

Definition at line 78 of file common.h.

Member Data Documentation

DWORD _ExpenseBuf::dwAmmount

Definition at line 80 of file common.h.

DWORD _ExpenseBuf::dwType

Definition at line 81 of file common.h.

The documentation for this struct was generated from the following file:
  • Security/Authorization/authz/common.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _EXT_WSPPROC_TABLE Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_EXT_WSPPROC_TABLE Struct Reference

#include "provider.h"

List of all members.

Public Attributes

LPFN_ACCEPTEX | lpfnAcceptEx
LPFN_CONNECTEX | lpfnConnectEx
LPFN_DISCONNECTEX | lpfnDisconnectEx
LPFN_GETACCEPTEXSOCKADDRS | lpfnGetAcceptExSockaddrs
LPFN_TRANSMITFILE | lpfnTransmitFile
LPFN_TRANSMITPACKETS | lpfnTransmitPackets
LPFN_WSARECVMSG | lpfnWSARecvMsg

Detailed Description

Definition at line 59 of file provider.h.

Member Data Documentation

LPFN_ACCEPTEX _EXT_WSPPROC_TABLE::lpfnAcceptEx

Definition at line 61 of file provider.h.

LPFN_CONNECTEX _EXT_WSPPROC_TABLE::lpfnConnectEx

Definition at line 65 of file provider.h.

LPFN_DISCONNECTEX _EXT_WSPPROC_TABLE::lpfnDisconnectEx

Definition at line 66 of file provider.h.

LPFN_GETACCEPTEXSOCKADDRS _EXT_WSPPROC_TABLE::lpfnGetAcceptExSockaddrs

Definition at line 63 of file provider.h.

LPFN_TRANSMITFILE _EXT_WSPPROC_TABLE::lpfnTransmitFile

Definition at line 62 of file provider.h.

LPFN_TRANSMITPACKETS _EXT_WSPPROC_TABLE::lpfnTransmitPackets

Definition at line 64 of file provider.h.

LPFN_WSARECVMSG _EXT_WSPPROC_TABLE::lpfnWSARecvMsg

Definition at line 67 of file provider.h.

The documentation for this struct was generated from the following file:
  • NetDS/WinSock/LSP/provider.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _FFSTREAM Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_FFSTREAM Struct Reference

List of all members.

Public Attributes

DWORD dwFFStreamMagic
HANDLE hFile
LPVOID lpContext

Detailed Description

Definition at line 28 of file FindStream.c.

Member Data Documentation

DWORD _FFSTREAM::dwFFStreamMagic

Definition at line 30 of file FindStream.c.

HANDLE _FFSTREAM::hFile

Definition at line 31 of file FindStream.c.

LPVOID _FFSTREAM::lpContext

Definition at line 32 of file FindStream.c.

The documentation for this struct was generated from the following file:
  • WinBase/IO/EnumStreams/FindStream.c
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _FileInfo Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_FileInfo Struct Reference

#include "MfEdit.h"

List of all members.

Public Attributes

HANDLE hFile
HANDLE hMapFile
LPVOID lpvMapView

Detailed Description

Definition at line 511 of file MfEdit.h.

Member Data Documentation

HANDLE _FileInfo::hFile

Definition at line 512 of file MfEdit.h.

HANDLE _FileInfo::hMapFile

Definition at line 513 of file MfEdit.h.

LPVOID _FileInfo::lpvMapView

Definition at line 514 of file MfEdit.h.

The documentation for this struct was generated from the following file:
  • Multimedia/Gdi/Metafile/MfEdit/MfEdit.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _FILESHARESAMPLE_PROPS Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_FILESHARESAMPLE_PROPS Struct Reference

List of all members.

Public Attributes

DWORD nMaxUsers
PWSTR pwszPath
PWSTR pwszRemark
PWSTR pwszShareName

Detailed Description

Definition at line 42 of file File Share Sample.cpp.

Member Data Documentation

DWORD _FILESHARESAMPLE_PROPS::nMaxUsers

Definition at line 47 of file File Share Sample.cpp.

PWSTR _FILESHARESAMPLE_PROPS::pwszPath

Definition at line 45 of file File Share Sample.cpp.

PWSTR _FILESHARESAMPLE_PROPS::pwszRemark

Definition at line 46 of file File Share Sample.cpp.

PWSTR _FILESHARESAMPLE_PROPS::pwszShareName

Definition at line 44 of file File Share Sample.cpp.

The documentation for this struct was generated from the following file:
  • WinBase/Cluster/Win2003/FileShareSample/File Share Sample/File Share Sample.cpp
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _FILESHARESAMPLE_RESOURCE Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_FILESHARESAMPLE_RESOURCE Struct Reference

List of all members.

Public Attributes

CLUS_WORKER | cwWorkerThread
BOOL fIsAliveFailed
HCLUSTER | hCluster
HKEY hkeyParameters
HRESOURCE | hResource
RESOURCE_HANDLE | hResourceHandle
FILESHARESAMPLE_PROPS props
FILESHARESAMPLE_PROPS propsActive
LPWSTR | pwszComputerName
LPWSTR | pwszExpandedPath
LPWSTR | pwszResourceName
LPWSTR | pwszUNCSharedPath
RESID | resid
CLUSTER_RESOURCE_STATE | state

Detailed Description

Definition at line 50 of file File Share Sample.cpp.

Member Data Documentation

CLUS_WORKER _FILESHARESAMPLE_RESOURCE::cwWorkerThread

Definition at line 63 of file File Share Sample.cpp.

BOOL _FILESHARESAMPLE_RESOURCE::fIsAliveFailed

Definition at line 65 of file File Share Sample.cpp.

HCLUSTER _FILESHARESAMPLE_RESOURCE::hCluster

Definition at line 55 of file File Share Sample.cpp.

HKEY _FILESHARESAMPLE_RESOURCE::hkeyParameters

Definition at line 57 of file File Share Sample.cpp.

HRESOURCE _FILESHARESAMPLE_RESOURCE::hResource

Definition at line 56 of file File Share Sample.cpp.

RESOURCE_HANDLE _FILESHARESAMPLE_RESOURCE::hResourceHandle

Definition at line 58 of file File Share Sample.cpp.

FILESHARESAMPLE_PROPS _FILESHARESAMPLE_RESOURCE::props

Definition at line 54 of file File Share Sample.cpp.

FILESHARESAMPLE_PROPS _FILESHARESAMPLE_RESOURCE::propsActive

Definition at line 53 of file File Share Sample.cpp.

LPWSTR _FILESHARESAMPLE_RESOURCE::pwszComputerName

Definition at line 60 of file File Share Sample.cpp.

LPWSTR _FILESHARESAMPLE_RESOURCE::pwszExpandedPath

Definition at line 61 of file File Share Sample.cpp.

LPWSTR _FILESHARESAMPLE_RESOURCE::pwszResourceName

Definition at line 59 of file File Share Sample.cpp.

LPWSTR _FILESHARESAMPLE_RESOURCE::pwszUNCSharedPath

Definition at line 62 of file File Share Sample.cpp.

RESID _FILESHARESAMPLE_RESOURCE::resid

Definition at line 52 of file File Share Sample.cpp.

CLUSTER_RESOURCE_STATE _FILESHARESAMPLE_RESOURCE::state

Definition at line 64 of file File Share Sample.cpp.

The documentation for this struct was generated from the following file:
  • WinBase/Cluster/Win2003/FileShareSample/File Share Sample/File Share Sample.cpp
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _FILETIME Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_FILETIME Struct Reference

#include "scandir.h"

List of all members.

Public Attributes

DWORD dwHighDateTime
DWORD dwLowDateTime

Detailed Description

Definition at line 222 of file scandir.h.

Member Data Documentation

DWORD _FILETIME::dwHighDateTime

Definition at line 224 of file scandir.h.

DWORD _FILETIME::dwLowDateTime

Definition at line 223 of file scandir.h.

The documentation for this struct was generated from the following file:
  • Begin/sdkdiff/scandir.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _foo Union Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_foo Union Reference

List of all members.

Public Attributes

struct {
DWORD dw
DWORD dwh
};
struct {
WORD w0
WORD w1
WORD w2
WORD w3
};
ULARGE_INTEGER uli

Detailed Description

Definition at line 132 of file suminfo.Cpp.

Member Data Documentation

struct { ... }
struct { ... }
DWORD _foo::dw

Definition at line 135 of file suminfo.Cpp.

DWORD _foo::dwh

Definition at line 136 of file suminfo.Cpp.

ULARGE_INTEGER _foo::uli

Definition at line 133 of file suminfo.Cpp.

WORD _foo::w0

Definition at line 139 of file suminfo.Cpp.

WORD _foo::w1

Definition at line 140 of file suminfo.Cpp.

WORD _foo::w2

Definition at line 141 of file suminfo.Cpp.

WORD _foo::w3

Definition at line 142 of file suminfo.Cpp.

The documentation for this union was generated from the following file:
  • Com/Fundamentals/OleStd/suminfo.Cpp
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _FUNC_INFO Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_FUNC_INFO Struct Reference

#include "Atsp.h"

List of all members.

Public Attributes

LONG lResult

Detailed Description

Definition at line 110 of file Atsp.h.

Member Data Documentation

LONG _FUNC_INFO::lResult

Definition at line 123 of file Atsp.h.

The documentation for this struct was generated from the following file:
  • NetDS/Tapi/Tapi2/Atsp32/Atsp.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _FundsRM Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_FundsRM Struct Reference

List of all members.

Public Attributes

DWORD _dwFundsAvailable
AUTHZ_RESOURCE_MANAGER_HANDLE | _hRM
SECURITY_DESCRIPTOR | _SD

Detailed Description

Definition at line 50 of file AuthzSvr.c.

Member Data Documentation

DWORD _FundsRM::_dwFundsAvailable

Definition at line 55 of file AuthzSvr.c.

AUTHZ_RESOURCE_MANAGER_HANDLE _FundsRM::_hRM

Definition at line 61 of file AuthzSvr.c.

SECURITY_DESCRIPTOR _FundsRM::_SD

Definition at line 68 of file AuthzSvr.c.

The documentation for this struct was generated from the following file:
  • Security/Authorization/authz/AuthzSvr.c
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _HASH_TABLE Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_HASH_TABLE Struct Reference

#include "hashtable.h"

List of all members.

Public Attributes

PCOMPARE_FUNCTION pfnCompare
PDISPLAY_FUNCTION pfnDisplay
PFREE_FUNCTION pfnFree
PHASH_FUNCTION pfnHash
PLIST_ENTRY pleBuckets
ULONG ulNumBuckets
ULONG ulNumEntries

Detailed Description

Definition at line 36 of file hashtable.h.

Member Data Documentation

PCOMPARE_FUNCTION _HASH_TABLE::pfnCompare

Definition at line 44 of file hashtable.h.

PDISPLAY_FUNCTION _HASH_TABLE::pfnDisplay

Definition at line 41 of file hashtable.h.

PFREE_FUNCTION _HASH_TABLE::pfnFree

Definition at line 42 of file hashtable.h.

PHASH_FUNCTION _HASH_TABLE::pfnHash

Definition at line 43 of file hashtable.h.

PLIST_ENTRY _HASH_TABLE::pleBuckets

Definition at line 46 of file hashtable.h.

ULONG _HASH_TABLE::ulNumBuckets

Definition at line 38 of file hashtable.h.

ULONG _HASH_TABLE::ulNumEntries

Definition at line 39 of file hashtable.h.

The documentation for this struct was generated from the following file:
  • NetDS/RRas/ip/hashtable.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _htdata Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_htdata Struct Reference

#include "MfEdit.h"

List of all members.

Public Attributes

int | iRecord
POINT | point

Detailed Description

Definition at line 323 of file MfEdit.h.

Member Data Documentation

int _htdata::iRecord

Definition at line 325 of file MfEdit.h.

POINT _htdata::point

Definition at line 324 of file MfEdit.h.

The documentation for this struct was generated from the following file:
  • Multimedia/Gdi/Metafile/MfEdit/MfEdit.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _IID Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_IID Struct Reference

List of all members.

Public Attributes

unsigned char | c [8]
unsigned short | s1
unsigned short | s2
unsigned long | x

Detailed Description

Definition at line 23 of file ADsFirstExt_i.c.

Member Data Documentation

unsigned char _IID::c

Definition at line 28 of file ADsFirstExt_i.c.

unsigned short _IID::s1

Definition at line 26 of file ADsFirstExt_i.c.

unsigned short _IID::s2

Definition at line 27 of file ADsFirstExt_i.c.

unsigned long _IID::x

Definition at line 25 of file ADsFirstExt_i.c.

The documentation for this struct was generated from the following files:
  • NetDS/ADSI/samples/Extension/tutorial/step1/ADsFirstExt_i.c
  • NetDS/ADSI/samples/Extension/tutorial/step2/ADsFirstExt_i.c
  • NetDS/ADSI/samples/General/ADsError/ADsError_i.c
  • NetDS/upnp/StepByStep/Step3/MyDevice_i.c
  • NetDS/upnp/StepByStep/Step4/MyDevice_i.c
  • Web/NetMeeting/NMChat2/iapplet.c
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _IMEUIDATA Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_IMEUIDATA Struct Reference

#include "FullIME.h"

List of all members.

Public Attributes

DWORD fdwProperty
HWND | hListCand [MAX_LISTCAND]
HGLOBAL | hListCandMem [MAX_LISTCAND]
int | ImeState
UINT uCompLen

Detailed Description

Definition at line 42 of file FullIME.h.

Member Data Documentation

DWORD _IMEUIDATA::fdwProperty

Definition at line 45 of file FullIME.h.

HWND _IMEUIDATA::hListCand[MAX_LISTCAND]

Definition at line 46 of file FullIME.h.

HGLOBAL _IMEUIDATA::hListCandMem[MAX_LISTCAND]

Definition at line 47 of file FullIME.h.

int _IMEUIDATA::ImeState

Definition at line 43 of file FullIME.h.

UINT _IMEUIDATA::uCompLen

Definition at line 44 of file FullIME.h.

The documentation for this struct was generated from the following file:
  • WinUI/Input/Ime/FullIME/FullIME.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _INITDATA Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_INITDATA Struct Reference

#include "Dt.h"

List of all members.

Public Attributes

SYSTEMTIME LocalTime
DWORD PID
DWORD TID

Detailed Description

Definition at line 28 of file Dt.h.

Member Data Documentation

SYSTEMTIME _INITDATA::LocalTime

Definition at line 30 of file Dt.h.

DWORD _INITDATA::PID

Definition at line 32 of file Dt.h.

DWORD _INITDATA::TID

Definition at line 31 of file Dt.h.

The documentation for this struct was generated from the following file:
  • NetDS/WinSock/Dt_Dll/Dt.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _INTERFACE_ENTRY Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_INTERFACE_ENTRY Struct Reference

#include "networkentry.h"

List of all members.

Public Attributes

DWORD dwFlags
DWORD dwIfIndex
HANDLE hPeriodicTimer
HANDLE hReceiveEvent
HANDLE hReceiveWait
IPSAMPLE_IF_STATS iisStats
IPADDRESS ipAddress
LIST_ENTRY | leIndexSortedListLink
LIST_ENTRY | leInterfaceTableLink
PBINDING_ENTRY pbeBindingTable
PWCHAR | pwszIfName
SOCKET | sRawSocket
DWORD ulMetric
ULONG ulNumBindings

Detailed Description

Definition at line 92 of file networkentry.h.

Member Data Documentation

DWORD _INTERFACE_ENTRY::dwFlags

Definition at line 111 of file networkentry.h.

DWORD _INTERFACE_ENTRY::dwIfIndex

Definition at line 104 of file networkentry.h.

HANDLE _INTERFACE_ENTRY::hPeriodicTimer

Definition at line 122 of file networkentry.h.

HANDLE _INTERFACE_ENTRY::hReceiveEvent

Definition at line 118 of file networkentry.h.

HANDLE _INTERFACE_ENTRY::hReceiveWait

Definition at line 119 of file networkentry.h.

IPSAMPLE_IF_STATS _INTERFACE_ENTRY::iisStats

Definition at line 128 of file networkentry.h.

IPADDRESS _INTERFACE_ENTRY::ipAddress

Definition at line 114 of file networkentry.h.

LIST_ENTRY _INTERFACE_ENTRY::leIndexSortedListLink

Definition at line 98 of file networkentry.h.

LIST_ENTRY _INTERFACE_ENTRY::leInterfaceTableLink

Definition at line 95 of file networkentry.h.

PBINDING_ENTRY _INTERFACE_ENTRY::pbeBindingTable

Definition at line 108 of file networkentry.h.

PWCHAR _INTERFACE_ENTRY::pwszIfName

Definition at line 101 of file networkentry.h.

SOCKET _INTERFACE_ENTRY::sRawSocket

Definition at line 115 of file networkentry.h.

DWORD _INTERFACE_ENTRY::ulMetric

Definition at line 125 of file networkentry.h.

ULONG _INTERFACE_ENTRY::ulNumBindings

Definition at line 107 of file networkentry.h.

The documentation for this struct was generated from the following file:
  • NetDS/RRas/ip/networkentry.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _INTERFACEMAP Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_INTERFACEMAP Struct Reference

List of all members.

Public Attributes

const IID * | pIID
WCHAR * | pwszInterface

Detailed Description

Definition at line 30 of file error.cpp.

Member Data Documentation

const IID* _INTERFACEMAP::pIID

Definition at line 32 of file error.cpp.

WCHAR* _INTERFACEMAP::pwszInterface

Definition at line 33 of file error.cpp.

The documentation for this struct was generated from the following file:
  • Dataaccess/oledb/tablecopy/error.cpp
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _INTS Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_INTS Struct Reference

#include "suminfo.h"

List of all members.

Public Attributes

DWORD value
DWORD vtType

Detailed Description

Definition at line 174 of file suminfo.h.

Member Data Documentation

DWORD _INTS::value

Definition at line 177 of file suminfo.h.

DWORD _INTS::vtType

Definition at line 176 of file suminfo.h.

The documentation for this struct was generated from the following file:
  • Com/Fundamentals/OleStd/suminfo.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _IO_WORK_ITEM Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_IO_WORK_ITEM Struct Reference

List of all members.

Public Attributes

DWORD cbReadSoFar
PBYTE | pbDATAFromClient
EXTENSION_CONTROL_BLOCK * | pecb

Detailed Description

Definition at line 25 of file areadcli.c.

Member Data Documentation

DWORD _IO_WORK_ITEM::cbReadSoFar

Definition at line 28 of file areadcli.c.

PBYTE _IO_WORK_ITEM::pbDATAFromClient

Definition at line 27 of file areadcli.c.

EXTENSION_CONTROL_BLOCK* _IO_WORK_ITEM::pecb

Definition at line 30 of file areadcli.c.

The documentation for this struct was generated from the following file:
  • Web/iis/extensions/io/ASyncRead/areadcli.c
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _IOCTLARGS Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_IOCTLARGS Struct Reference

#include "provider.h"

List of all members.

Public Attributes

DWORD cbBytesReturned
DWORD cbInBuffer
DWORD cbOutBuffer
DWORD dwIoControlCode
LPVOID | lpvInBuffer
LPVOID | lpvOutBuffer

Detailed Description

Definition at line 213 of file provider.h.

Member Data Documentation

DWORD _IOCTLARGS::cbBytesReturned

Definition at line 220 of file provider.h.

DWORD _IOCTLARGS::cbInBuffer

Definition at line 217 of file provider.h.

DWORD _IOCTLARGS::cbOutBuffer

Definition at line 219 of file provider.h.

DWORD _IOCTLARGS::dwIoControlCode

Definition at line 215 of file provider.h.

LPVOID _IOCTLARGS::lpvInBuffer

Definition at line 216 of file provider.h.

LPVOID _IOCTLARGS::lpvOutBuffer

Definition at line 218 of file provider.h.

The documentation for this struct was generated from the following file:
  • NetDS/WinSock/LSP/provider.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _IPSAMPLE_GLOBAL_CONFIG Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_IPSAMPLE_GLOBAL_CONFIG Struct Reference

#include "ipsamplerm.h"

List of all members.

Public Attributes

DWORD dwLoggingLevel

Detailed Description

Definition at line 105 of file ipsamplerm.h.

Member Data Documentation

DWORD _IPSAMPLE_GLOBAL_CONFIG::dwLoggingLevel

Definition at line 107 of file ipsamplerm.h.

The documentation for this struct was generated from the following files:
  • NetDS/RRas/ip/ipsamplerm.h
  • NetDS/RRas/LoadProtocol/ipsamplerm.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _IPSAMPLE_GLOBAL_STATS Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_IPSAMPLE_GLOBAL_STATS Struct Reference

#include "ipsamplerm.h"

List of all members.

Public Attributes

ULONG ulNumInterfaces

Detailed Description

Definition at line 91 of file ipsamplerm.h.

Member Data Documentation

ULONG _IPSAMPLE_GLOBAL_STATS::ulNumInterfaces

Definition at line 93 of file ipsamplerm.h.

The documentation for this struct was generated from the following files:
  • NetDS/RRas/ip/ipsamplerm.h
  • NetDS/RRas/LoadProtocol/ipsamplerm.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _IPSAMPLE_IF_BINDING Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_IPSAMPLE_IF_BINDING Struct Reference

#include "ipsamplerm.h"

List of all members.

Public Attributes

DWORD dwState
ULONG ulCount

Detailed Description

Definition at line 157 of file ipsamplerm.h.

Member Data Documentation

DWORD _IPSAMPLE_IF_BINDING::dwState

Definition at line 159 of file ipsamplerm.h.

ULONG _IPSAMPLE_IF_BINDING::ulCount

Definition at line 160 of file ipsamplerm.h.

The documentation for this struct was generated from the following files:
  • NetDS/RRas/ip/ipsamplerm.h
  • NetDS/RRas/LoadProtocol/ipsamplerm.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _IPSAMPLE_IF_CONFIG Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_IPSAMPLE_IF_CONFIG Struct Reference

#include "ipsamplerm.h"

List of all members.

Public Attributes

ULONG ulMetric

Detailed Description

Definition at line 134 of file ipsamplerm.h.

Member Data Documentation

ULONG _IPSAMPLE_IF_CONFIG::ulMetric

Definition at line 136 of file ipsamplerm.h.

The documentation for this struct was generated from the following files:
  • NetDS/RRas/ip/ipsamplerm.h
  • NetDS/RRas/LoadProtocol/ipsamplerm.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _IPSAMPLE_IF_STATS Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_IPSAMPLE_IF_STATS Struct Reference

#include "ipsamplerm.h"

List of all members.

Public Attributes

ULONG ulNumPackets

Detailed Description

Definition at line 120 of file ipsamplerm.h.

Member Data Documentation

ULONG _IPSAMPLE_IF_STATS::ulNumPackets

Definition at line 122 of file ipsamplerm.h.

The documentation for this struct was generated from the following files:
  • NetDS/RRas/ip/ipsamplerm.h
  • NetDS/RRas/LoadProtocol/ipsamplerm.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _IPSAMPLE_IP_ADDRESS Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_IPSAMPLE_IP_ADDRESS Struct Reference

#include "ipsamplerm.h"

List of all members.

Public Attributes

DWORD dwAddress
DWORD dwMask

Detailed Description

Definition at line 176 of file ipsamplerm.h.

Member Data Documentation

DWORD _IPSAMPLE_IP_ADDRESS::dwAddress

Definition at line 178 of file ipsamplerm.h.

DWORD _IPSAMPLE_IP_ADDRESS::dwMask

Definition at line 179 of file ipsamplerm.h.

The documentation for this struct was generated from the following files:
  • NetDS/RRas/ip/ipsamplerm.h
  • NetDS/RRas/LoadProtocol/ipsamplerm.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _IPSAMPLE_MIB_GET_INPUT_DATA Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_IPSAMPLE_MIB_GET_INPUT_DATA Struct Reference

#include "ipsamplerm.h"

List of all members.

Public Attributes

DWORD IMGID_IfIndex
DWORD IMGID_TypeID

Detailed Description

Definition at line 255 of file ipsamplerm.h.

Member Data Documentation

DWORD _IPSAMPLE_MIB_GET_INPUT_DATA::IMGID_IfIndex

Definition at line 258 of file ipsamplerm.h.

DWORD _IPSAMPLE_MIB_GET_INPUT_DATA::IMGID_TypeID

Definition at line 257 of file ipsamplerm.h.

The documentation for this struct was generated from the following files:
  • NetDS/RRas/ip/ipsamplerm.h
  • NetDS/RRas/LoadProtocol/ipsamplerm.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _IPSAMPLE_MIB_GET_OUTPUT_DATA Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_IPSAMPLE_MIB_GET_OUTPUT_DATA Struct Reference

#include "ipsamplerm.h"

List of all members.

Public Attributes

BYTE IMGOD_Buffer [ANY_SIZE]
DWORD IMGOD_IfIndex
DWORD IMGOD_TypeID

Detailed Description

Definition at line 269 of file ipsamplerm.h.

Member Data Documentation

BYTE _IPSAMPLE_MIB_GET_OUTPUT_DATA::IMGOD_Buffer

Definition at line 274 of file ipsamplerm.h.

DWORD _IPSAMPLE_MIB_GET_OUTPUT_DATA::IMGOD_IfIndex

Definition at line 272 of file ipsamplerm.h.

DWORD _IPSAMPLE_MIB_GET_OUTPUT_DATA::IMGOD_TypeID

Definition at line 271 of file ipsamplerm.h.

The documentation for this struct was generated from the following files:
  • NetDS/RRas/ip/ipsamplerm.h
  • NetDS/RRas/LoadProtocol/ipsamplerm.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _IPSAMPLE_MIB_SET_INPUT_DATA Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_IPSAMPLE_MIB_SET_INPUT_DATA Struct Reference

#include "ipsamplerm.h"

List of all members.

Public Attributes

BYTE IMSID_Buffer [ANY_SIZE]
DWORD IMSID_BufferSize
DWORD IMSID_IfIndex
DWORD IMSID_TypeID

Detailed Description

Definition at line 238 of file ipsamplerm.h.

Member Data Documentation

BYTE _IPSAMPLE_MIB_SET_INPUT_DATA::IMSID_Buffer

Definition at line 243 of file ipsamplerm.h.

DWORD _IPSAMPLE_MIB_SET_INPUT_DATA::IMSID_BufferSize

Definition at line 242 of file ipsamplerm.h.

DWORD _IPSAMPLE_MIB_SET_INPUT_DATA::IMSID_IfIndex

Definition at line 241 of file ipsamplerm.h.

DWORD _IPSAMPLE_MIB_SET_INPUT_DATA::IMSID_TypeID

Definition at line 240 of file ipsamplerm.h.

The documentation for this struct was generated from the following files:
  • NetDS/RRas/ip/ipsamplerm.h
  • NetDS/RRas/LoadProtocol/ipsamplerm.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _ITEM_DESC Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_ITEM_DESC Struct Reference

#include "tracedmp.h"

List of all members.

Public Attributes

UINT ArraySize
ULONG DataSize
LIST_ENTRY Entry
ITEM_TYPE ItemType
LPTSTR strDescription

Detailed Description

Definition at line 139 of file tracedmp.h.

Member Data Documentation

UINT _ITEM_DESC::ArraySize

Definition at line 144 of file tracedmp.h.

ULONG _ITEM_DESC::DataSize

Definition at line 142 of file tracedmp.h.

LIST_ENTRY _ITEM_DESC::Entry

Definition at line 140 of file tracedmp.h.

ITEM_TYPE _ITEM_DESC::ItemType

Definition at line 143 of file tracedmp.h.

LPTSTR _ITEM_DESC::strDescription

Definition at line 141 of file tracedmp.h.

The documentation for this struct was generated from the following file:
  • WinBase/EventTrace/TraceDmp/tracedmp.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _Job Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_Job Struct Reference

#include "queue.h"

List of all members.

Public Attributes

DWORD BytesPrinted
BOOL | Changed [NFIELDS]
DWORD dwStatus
DWORD JobId
DWORD PagesPrinted
LPTSTR pszDocument
LPTSTR pszOwner
LPTSTR pszStatus
DWORD Size
SYSTEMTIME | Submitted
DWORD TotalPages

Detailed Description

Definition at line 68 of file queue.h.

Member Data Documentation

DWORD _Job::BytesPrinted

Definition at line 82 of file queue.h.

BOOL _Job::Changed[NFIELDS]

Definition at line 89 of file queue.h.

DWORD _Job::dwStatus

Definition at line 77 of file queue.h.

DWORD _Job::JobId

Definition at line 72 of file queue.h.

DWORD _Job::PagesPrinted

Definition at line 79 of file queue.h.

LPTSTR _Job::pszDocument

Definition at line 73 of file queue.h.

LPTSTR _Job::pszOwner

Definition at line 74 of file queue.h.

LPTSTR _Job::pszStatus

Definition at line 76 of file queue.h.

DWORD _Job::Size

Definition at line 81 of file queue.h.

SYSTEMTIME _Job::Submitted

Definition at line 84 of file queue.h.

DWORD _Job::TotalPages

Definition at line 80 of file queue.h.

The documentation for this struct was generated from the following file:
  • Multimedia/Gdi/PrintJob/queue.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _JOB_INFO Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_JOB_INFO Struct Reference

#include "NewFsp.h"

List of all members.

Public Attributes

BOOL Branding
LPWSTR | CallerId
LPWSTR | CallerName
LPWSTR | CallerNumber
HCALL | CallHandle
ULONG_PTR | CompletionKey
HANDLE CompletionPortHandle
LPWSTR | CSI
LPWSTR | FileName
DWORD JobType
HLINE | LineHandle
DWORD PageCount
PDEVICE_INFO pDeviceInfo
LPWSTR | ReceiverName
LPWSTR | ReceiverNumber
DWORD RetryCount
LPWSTR | RoutingInfo
DWORD Status

Detailed Description

Definition at line 68 of file NewFsp.h.

Member Data Documentation

BOOL _JOB_INFO::Branding

Definition at line 82 of file NewFsp.h.

LPWSTR _JOB_INFO::CallerId

Definition at line 85 of file NewFsp.h.

LPWSTR _JOB_INFO::CallerName

Definition at line 77 of file NewFsp.h.

LPWSTR _JOB_INFO::CallerNumber

Definition at line 78 of file NewFsp.h.

HCALL _JOB_INFO::CallHandle

Definition at line 75 of file NewFsp.h.

ULONG_PTR _JOB_INFO::CompletionKey

Definition at line 71 of file NewFsp.h.

HANDLE _JOB_INFO::CompletionPortHandle

Definition at line 70 of file NewFsp.h.

LPWSTR _JOB_INFO::CSI

Definition at line 84 of file NewFsp.h.

LPWSTR _JOB_INFO::FileName

Definition at line 76 of file NewFsp.h.

DWORD _JOB_INFO::JobType

Definition at line 72 of file NewFsp.h.

HLINE _JOB_INFO::LineHandle

Definition at line 74 of file NewFsp.h.

DWORD _JOB_INFO::PageCount

Definition at line 83 of file NewFsp.h.

PDEVICE_INFO _JOB_INFO::pDeviceInfo

Definition at line 69 of file NewFsp.h.

LPWSTR _JOB_INFO::ReceiverName

Definition at line 79 of file NewFsp.h.

LPWSTR _JOB_INFO::ReceiverNumber

Definition at line 80 of file NewFsp.h.

DWORD _JOB_INFO::RetryCount

Definition at line 81 of file NewFsp.h.

LPWSTR _JOB_INFO::RoutingInfo

Definition at line 86 of file NewFsp.h.

DWORD _JOB_INFO::Status

Definition at line 73 of file NewFsp.h.

The documentation for this struct was generated from the following file:
  • NetDS/fax/SampleFSP/NewFsp.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _LOCAL_HEAP_INFO_BLOCK Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_LOCAL_HEAP_INFO_BLOCK Struct Reference

#include "PerfUtil.h"

List of all members.

Public Attributes

DWORD AllocatedBytes
DWORD AllocatedEntries
DWORD FreeBytes
DWORD FreeEntries

Detailed Description

Definition at line 72 of file PerfUtil.h.

Member Data Documentation

DWORD _LOCAL_HEAP_INFO_BLOCK::AllocatedBytes

Definition at line 74 of file PerfUtil.h.

DWORD _LOCAL_HEAP_INFO_BLOCK::AllocatedEntries

Definition at line 73 of file PerfUtil.h.

DWORD _LOCAL_HEAP_INFO_BLOCK::FreeBytes

Definition at line 76 of file PerfUtil.h.

DWORD _LOCAL_HEAP_INFO_BLOCK::FreeEntries

Definition at line 75 of file PerfUtil.h.

The documentation for this struct was generated from the following file:
  • WinBase/WinNT/PerfTool/PerfDllS/PerfGen/PerfUtil.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _LOCINFO Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_LOCINFO Struct Reference

#include "global.h"

List of all members.

Public Attributes

TCHAR | tcAcp [STR_CPLEN]
TCHAR | tcLcid [STR_LEN]
TCHAR | tcLLang [STR_LEN]
TCHAR | tcNCountry [STR_LEN]
TCHAR | tcNLang [STR_LEN]
TCHAR | tcOem [STR_CPLEN]

Detailed Description

Definition at line 80 of file global.h.

Member Data Documentation

TCHAR _LOCINFO::tcAcp[STR_CPLEN]

Definition at line 86 of file global.h.

TCHAR _LOCINFO::tcLcid[STR_LEN]

Definition at line 82 of file global.h.

TCHAR _LOCINFO::tcLLang[STR_LEN]

Definition at line 83 of file global.h.

TCHAR _LOCINFO::tcNCountry[STR_LEN]

Definition at line 85 of file global.h.

TCHAR _LOCINFO::tcNLang[STR_LEN]

Definition at line 84 of file global.h.

TCHAR _LOCINFO::tcOem[STR_CPLEN]

Definition at line 87 of file global.h.

The documentation for this struct was generated from the following file:
  • WinUI/GlobalDev/globaldev/global.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _LOCKED_LIST Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_LOCKED_LIST Struct Reference

#include "sync.h"

List of all members.

Public Attributes

DWORD created
LIST_ENTRY | head
CRITICAL_SECTION | lock

Detailed Description

Definition at line 91 of file sync.h.

Member Data Documentation

DWORD _LOCKED_LIST::created

Definition at line 95 of file sync.h.

LIST_ENTRY _LOCKED_LIST::head

Definition at line 94 of file sync.h.

CRITICAL_SECTION _LOCKED_LIST::lock

Definition at line 93 of file sync.h.

The documentation for this struct was generated from the following file:
  • NetDS/RRas/ip/sync.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _LSP_ENTRY Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_LSP_ENTRY Struct Reference

List of all members.

Public Attributes

int | Count
WSAPROTOCOL_INFOW | DummyEntry
WSAPROTOCOL_INFOW * | LayeredEntries
int | LayeredGuidCount
GUID * | LayeredGuids
int | LspOrder
int | MaxChainLength
WCHAR | wszLspDll [MAX_PATH]

Detailed Description

Definition at line 111 of file instlsp.cpp.

Member Data Documentation

int _LSP_ENTRY::Count

Definition at line 117 of file instlsp.cpp.

WSAPROTOCOL_INFOW _LSP_ENTRY::DummyEntry

Definition at line 114 of file instlsp.cpp.

WSAPROTOCOL_INFOW* _LSP_ENTRY::LayeredEntries

Definition at line 116 of file instlsp.cpp.

int _LSP_ENTRY::LayeredGuidCount

Definition at line 123 of file instlsp.cpp.

GUID* _LSP_ENTRY::LayeredGuids

Definition at line 119 of file instlsp.cpp.

int _LSP_ENTRY::LspOrder

Definition at line 127 of file instlsp.cpp.

int _LSP_ENTRY::MaxChainLength

Definition at line 125 of file instlsp.cpp.

WCHAR _LSP_ENTRY::wszLspDll[MAX_PATH]

Definition at line 113 of file instlsp.cpp.

The documentation for this struct was generated from the following file:
  • NetDS/WinSock/LSP/instlsp.cpp
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _MAZEDATA Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_MAZEDATA Struct Reference

#include "Maze.h"

List of all members.

Public Attributes

int nMaze

Detailed Description

Definition at line 24 of file Maze.h.

Member Data Documentation

int _MAZEDATA::nMaze

Definition at line 26 of file Maze.h.

The documentation for this struct was generated from the following file:
  • Multimedia/Gdi/GdiDemo/Maze.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _MEMORY_ALLOC_BLOCK Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_MEMORY_ALLOC_BLOCK Struct Reference

#include "LeakyBin.h"

List of all members.

Public Attributes

struct _MEMORY_ALLOC_BLOCK * pNext

Detailed Description

Definition at line 26 of file LeakyBin.h.

Member Data Documentation

struct _MEMORY_ALLOC_BLOCK* _MEMORY_ALLOC_BLOCK::pNext

Definition at line 28 of file LeakyBin.h.

The documentation for this struct was generated from the following file:
  • WinBase/WinNT/PerfTool/PerfDllS/LeakyBin/LeakyBin.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _MESSAGE Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_MESSAGE Struct Reference

#include "SampSSP.H"

List of all members.

Public Attributes

UCHAR Buffer [MESSAGE_SIZE]
MESSAGE_TYPE MessageType

Detailed Description

Definition at line 55 of file SampSSP.H.

Member Data Documentation

UCHAR _MESSAGE::Buffer[MESSAGE_SIZE]

Definition at line 57 of file SampSSP.H.

MESSAGE_TYPE _MESSAGE::MessageType

Definition at line 56 of file SampSSP.H.

The documentation for this struct was generated from the following file:
  • Security/Authentication/SampSSP/SampSSP.H
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _metalookup Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_metalookup Struct Reference

#include "MfEdit.h"

List of all members.

Public Attributes

int iMRNumber
LPSTR szGDIName

Detailed Description

Definition at line 318 of file MfEdit.h.

Member Data Documentation

int _metalookup::iMRNumber

Definition at line 320 of file MfEdit.h.

LPSTR _metalookup::szGDIName

Definition at line 319 of file MfEdit.h.

The documentation for this struct was generated from the following file:
  • Multimedia/Gdi/Metafile/MfEdit/MfEdit.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _MIDL_PROC_FORMAT_STRING Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_MIDL_PROC_FORMAT_STRING Struct Reference

List of all members.

Public Attributes

unsigned char | Format [PROC_FORMAT_STRING_SIZE]
short | Pad

Detailed Description

Definition at line 39 of file ADsFirstExt_p.c.

Member Data Documentation

unsigned char _MIDL_PROC_FORMAT_STRING::Format

Definition at line 42 of file ADsFirstExt_p.c.

short _MIDL_PROC_FORMAT_STRING::Pad

Definition at line 41 of file ADsFirstExt_p.c.

The documentation for this struct was generated from the following files:
  • NetDS/ADSI/samples/Extension/tutorial/step1/ADsFirstExt_p.c
  • NetDS/ADSI/samples/Extension/tutorial/step2/ADsFirstExt_p.c
  • NetDS/ADSI/samples/General/ADsError/ADsError_p.c
  • Web/Browser/BrochureMachine/BrochureMachine_p.c
  • Web/Browser/EdAnnotator/AnnotatorProject/EDAnnotator_p.c
  • Web/Browser/EditCommands/EdCommands_p.c
  • Web/Browser/EditFeatures/EdCommands_p.c
  • Web/Browser/EditGlyphs/EdGlyphs_p.c
  • Web/Browser/EditHost/EdHost_p.c
  • Web/Browser/RenderBehave/renderproject/Render_p.c
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _MIDL_TYPE_FORMAT_STRING Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_MIDL_TYPE_FORMAT_STRING Struct Reference

List of all members.

Public Attributes

unsigned char | Format [TYPE_FORMAT_STRING_SIZE]
short | Pad

Detailed Description

Definition at line 33 of file ADsFirstExt_p.c.

Member Data Documentation

unsigned char _MIDL_TYPE_FORMAT_STRING::Format

Definition at line 36 of file ADsFirstExt_p.c.

short _MIDL_TYPE_FORMAT_STRING::Pad

Definition at line 35 of file ADsFirstExt_p.c.

The documentation for this struct was generated from the following files:
  • NetDS/ADSI/samples/Extension/tutorial/step1/ADsFirstExt_p.c
  • NetDS/ADSI/samples/Extension/tutorial/step2/ADsFirstExt_p.c
  • NetDS/ADSI/samples/General/ADsError/ADsError_p.c
  • Web/Browser/BrochureMachine/BrochureMachine_p.c
  • Web/Browser/EdAnnotator/AnnotatorProject/EDAnnotator_p.c
  • Web/Browser/EditCommands/EdCommands_p.c
  • Web/Browser/EditFeatures/EdCommands_p.c
  • Web/Browser/EditGlyphs/EdGlyphs_p.c
  • Web/Browser/EditHost/EdHost_p.c
  • Web/Browser/RenderBehave/renderproject/Render_p.c
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _MOF_INFO Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_MOF_INFO Struct Reference

#include "tracedmp.h"

List of all members.

Public Attributes

LIST_ENTRY | Entry
ULONG EventCount
GUID | Guid
PLIST_ENTRY | ItemHeader
CHAR | Level
LPTSTR strDescription
LPTSTR strType
SHORT | TypeIndex
SHORT | Version

Detailed Description

Definition at line 126 of file tracedmp.h.

Member Data Documentation

LIST_ENTRY _MOF_INFO::Entry

Definition at line 127 of file tracedmp.h.

ULONG _MOF_INFO::EventCount

Definition at line 129 of file tracedmp.h.

GUID _MOF_INFO::Guid

Definition at line 130 of file tracedmp.h.

PLIST_ENTRY _MOF_INFO::ItemHeader

Definition at line 131 of file tracedmp.h.

CHAR _MOF_INFO::Level

Definition at line 135 of file tracedmp.h.

LPTSTR _MOF_INFO::strDescription

Definition at line 128 of file tracedmp.h.

LPTSTR _MOF_INFO::strType

Definition at line 132 of file tracedmp.h.

SHORT _MOF_INFO::TypeIndex

Definition at line 133 of file tracedmp.h.

SHORT _MOF_INFO::Version

Definition at line 134 of file tracedmp.h.

The documentation for this struct was generated from the following file:
  • WinBase/EventTrace/TraceDmp/tracedmp.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _MSD Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_MSD Struct Reference

#include "GLOBALS.h"

List of all members.

Public Attributes

PFNMSG pfnmsg
UINT uMessage
UINT uMsg

Detailed Description

Definition at line 172 of file GLOBALS.h.

Member Data Documentation

PFNMSG _MSD::pfnmsg

Definition at line 175 of file GLOBALS.h.

UINT _MSD::uMessage

Definition at line 174 of file GLOBALS.h.

UINT _MSD::uMsg

Definition at line 87 of file Global.h.

The documentation for this struct was generated from the following files:
  • NetDS/Tapi/Tapi2/TapiComm/GLOBALS.h
  • NetDS/WinSock/IpxChat/Globals.h
  • Web/NetMeeting/NMChat/Global.h
  • Web/NetMeeting/NMFT/Msg.Cpp
  • Web/NetMeeting/NMShare/Global.h
  • Web/NetMeeting/NMUI/Global.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _MSDI Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_MSDI Struct Reference

#include "GLOBALS.h"

List of all members.

Public Attributes

int cmsd
EDWP edwp
MSD * rgmsd

Detailed Description

Definition at line 181 of file GLOBALS.h.

Member Data Documentation

int _MSDI::cmsd

Definition at line 183 of file GLOBALS.h.

EDWP _MSDI::edwp

Definition at line 185 of file GLOBALS.h.

MSD * _MSDI::rgmsd

Definition at line 184 of file GLOBALS.h.

The documentation for this struct was generated from the following files:
  • NetDS/Tapi/Tapi2/TapiComm/GLOBALS.h
  • NetDS/WinSock/IpxChat/Globals.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _MSV1_0_INTERACTIVE_LOGON Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_MSV1_0_INTERACTIVE_LOGON Struct Reference

#include "Npaux.h"

List of all members.

Public Attributes

UNICODE_STRING LogonDomainName
MSV1_0_LOGON_SUBMIT_TYPE MessageType
UNICODE_STRING Password
UNICODE_STRING UserName

Detailed Description

Definition at line 40 of file Npaux.h.

Member Data Documentation

UNICODE_STRING _MSV1_0_INTERACTIVE_LOGON::LogonDomainName

Definition at line 43 of file Npaux.h.

MSV1_0_LOGON_SUBMIT_TYPE _MSV1_0_INTERACTIVE_LOGON::MessageType

Definition at line 42 of file Npaux.h.

UNICODE_STRING _MSV1_0_INTERACTIVE_LOGON::Password

Definition at line 45 of file Npaux.h.

UNICODE_STRING _MSV1_0_INTERACTIVE_LOGON::UserName

Definition at line 44 of file Npaux.h.

The documentation for this struct was generated from the following file:
  • Security/NetProviders/LogonNP/Npaux.h
Generated on Wed Nov 13 2024 16:55:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _MultiSelectCookies Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_MultiSelectCookies Struct Reference

#include "dataobj.h"

List of all members.

Public Attributes

LONG_PTR Cookies [1]
DWORD count

Detailed Description

Definition at line 24 of file dataobj.h.

Member Data Documentation

LONG_PTR _MultiSelectCookies::Cookies[1]

Definition at line 27 of file dataobj.h.

DWORD _MultiSelectCookies::count

Definition at line 26 of file dataobj.h.

The documentation for this struct was generated from the following file:
  • SysMgmt/MMC/mmc2.0/multisel/dataobj.h
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _MYDATA Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_MYDATA Struct Reference

List of all members.

Public Attributes

char | szTest1 [80]
char | szTest2 [80]

Detailed Description

Definition at line 45 of file ComDlg32.C.

Member Data Documentation

char _MYDATA::szTest1[80]

Definition at line 47 of file ComDlg32.C.

char _MYDATA::szTest2[80]

Definition at line 48 of file ComDlg32.C.

The documentation for this struct was generated from the following file:
  • WinUI/CommDlg/ComDlg32/ComDlg32.C
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _MYXFORM Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_MYXFORM Struct Reference

#include "Bounce.h"

List of all members.

Public Attributes

int xForm [3][3]

Detailed Description

Definition at line 21 of file Bounce.h.

Member Data Documentation

int _MYXFORM::xForm[3][3]

Definition at line 23 of file Bounce.h.

The documentation for this struct was generated from the following file:
  • Multimedia/Gdi/GdiDemo/Bounce.h
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _NAMEMAP Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_NAMEMAP Struct Reference

#include "error.h"

List of all members.

Public Attributes

LONG | lItem
CHAR * | pszName

Detailed Description

Definition at line 25 of file error.h.

Member Data Documentation

LONG _NAMEMAP::lItem

Definition at line 28 of file error.h.

CHAR* _NAMEMAP::pszName

Definition at line 27 of file error.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/oledb/rowsetviewer/error.h
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _NETWORK_ENTRY Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_NETWORK_ENTRY Struct Reference

#include "networkentry.h"

List of all members.

Public Attributes

LIST_ENTRY leIndexSortedList
PHASH_TABLE phtInterfaceTable
READ_WRITE_LOCK rwlLock

Detailed Description

Definition at line 234 of file networkentry.h.

Member Data Documentation

LIST_ENTRY _NETWORK_ENTRY::leIndexSortedList

Definition at line 240 of file networkentry.h.

PHASH_TABLE _NETWORK_ENTRY::phtInterfaceTable

Definition at line 239 of file networkentry.h.

READ_WRITE_LOCK _NETWORK_ENTRY::rwlLock

Definition at line 237 of file networkentry.h.

The documentation for this struct was generated from the following file:
  • NetDS/RRas/ip/networkentry.h
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _NoAddRefReleaseQIOnSmartPtr< T > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Private Member Functions

_NoAddRefReleaseQIOnSmartPtr< T > Class Template Reference

#include "cdialoglite.h"

List of all members.

Private Member Functions

STDMETHOD_ (ULONG, AddRef)()=0
STDMETHOD_ (HRESULT, QI)(REFIID
STDMETHOD_ (ULONG, Release)()=0

Detailed Description

template<class T>
class _NoAddRefReleaseQIOnSmartPtr< T >

Definition at line 1610 of file cdialoglite.h.

Member Function Documentation

template<class T >
_NoAddRefReleaseQIOnSmartPtr< T >::STDMETHOD_ | ( | ULONG | ,
 |  | AddRef |  |
 | ) |  |  | [private, pure virtual]
template<class T >
_NoAddRefReleaseQIOnSmartPtr< T >::STDMETHOD_ | ( | HRESULT | ,
 |  | QI |  |
 | ) |  |  | [private]
template<class T >
_NoAddRefReleaseQIOnSmartPtr< T >::STDMETHOD_ | ( | ULONG | ,
 |  | Release |  |
 | ) |  |  | [private, pure virtual]
The documentation for this class was generated from the following file:
  • Dataaccess/oledb/rowsetviewer/cdialoglite.h
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _node_tag Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_node_tag Struct Reference

List of all members.

Public Attributes

DWORD dwKey
PVOID * pData
struct _node_tag * pNext

Detailed Description

Definition at line 22 of file Collect.cpp.

Member Data Documentation

DWORD _node_tag::dwKey

Definition at line 22 of file Collect.cpp.

PVOID* _node_tag::pData

Definition at line 23 of file Collect.cpp.

struct _node_tag* _node_tag::pNext

Definition at line 24 of file Collect.cpp.

The documentation for this struct was generated from the following file:
  • Security/SSPI/SockAuth/Collect.cpp
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _OPEN_FILE Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_OPEN_FILE Struct Reference

List of all members.

Public Attributes

HANDLE hFile
LONG | nHits
LONG | nRefs
struct _OPEN_FILE * | pNext
CHAR | rgchFile [MAX_PATH+1]

Detailed Description

Definition at line 16 of file openf.c.

Member Data Documentation

HANDLE _OPEN_FILE::hFile

Definition at line 18 of file openf.c.

LONG _OPEN_FILE::nHits

Definition at line 20 of file openf.c.

LONG _OPEN_FILE::nRefs

Definition at line 21 of file openf.c.

struct _OPEN_FILE * _OPEN_FILE::pNext

Definition at line 19 of file openf.c.

CHAR _OPEN_FILE::rgchFile

Definition at line 22 of file openf.c.

The documentation for this struct was generated from the following files:
  • Web/iis/extensions/io/ASyncTrans/openf.c
  • Web/iis/extensions/io/ASyncWrite/openf.c
  • Web/iis/extensions/io/SyncWrite/openf.c
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _OPTIONS Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_OPTIONS Struct Reference

#include "QosEvent.h"

List of all members.

Public Attributes

BOOL bGlobalTemplate
CHAR * | buf
BOOL bVerbose
CMD_TYPE cmd
DWORD dwSleep
DWORD dwSleepClose
DWORD dwTotalClients
CHAR | fillchar
int | nBufSize
int | nRepeat
int | nTotalThreads
char * | port
unsigned short | port
WSAPROTOCOL_INFO | protocolInfo
QOS_OPTIONS qosOptions
SP_OPTIONS spOptions
CHAR | szHostname [64]
char | szHostname [64]
CHAR | szLocalInterface [MAX_ATM_INTERFACE_LEN]
CHAR | szRemoteInterface [MAX_ATM_INTERFACE_LEN]
TEMPLATE_CMD template_cmd

Detailed Description

Definition at line 93 of file QosEvent.h.

Member Data Documentation

BOOL _OPTIONS::bGlobalTemplate

Definition at line 58 of file Qoslist.Cpp.

CHAR * _OPTIONS::buf

Definition at line 100 of file QosEvent.h.

BOOL _OPTIONS::bVerbose

Definition at line 61 of file IocpClient.Cpp.

CMD_TYPE _OPTIONS::cmd

Definition at line 44 of file ATMEvent.h.

DWORD _OPTIONS::dwSleep

Definition at line 101 of file QosEvent.h.

DWORD _OPTIONS::dwSleepClose

Definition at line 52 of file ATMEvent.h.

DWORD _OPTIONS::dwTotalClients

Definition at line 102 of file QosEvent.h.

CHAR _OPTIONS::fillchar

Definition at line 98 of file QosEvent.h.

int _OPTIONS::nBufSize

Definition at line 99 of file QosEvent.h.

int _OPTIONS::nRepeat

Definition at line 97 of file QosEvent.h.

int _OPTIONS::nTotalThreads

Definition at line 59 of file IocpClient.Cpp.

char* _OPTIONS::port

Definition at line 58 of file IocpClient.Cpp.

unsigned short _OPTIONS::port

Definition at line 96 of file QosEvent.h.

WSAPROTOCOL_INFO _OPTIONS::protocolInfo

Definition at line 54 of file ATMEvent.h.

QOS_OPTIONS _OPTIONS::qosOptions

Definition at line 103 of file QosEvent.h.

SP_OPTIONS _OPTIONS::spOptions

Definition at line 104 of file QosEvent.h.

CHAR _OPTIONS::szHostname[64]

Definition at line 95 of file QosEvent.h.

char _OPTIONS::szHostname[64]

Definition at line 57 of file IocpClient.Cpp.

CHAR _OPTIONS::szLocalInterface[MAX_ATM_INTERFACE_LEN]

Definition at line 45 of file ATMEvent.h.

CHAR _OPTIONS::szRemoteInterface[MAX_ATM_INTERFACE_LEN]

Definition at line 46 of file ATMEvent.h.

TEMPLATE_CMD _OPTIONS::template_cmd

Definition at line 57 of file Qoslist.Cpp.

The documentation for this struct was generated from the following files:
  • NetDS/GQos/QosEvent/QosEvent.h
  • NetDS/GQos/Qoslist/Qoslist.Cpp
  • NetDS/WinSock/ATMEvent/ATMEvent.h
  • NetDS/WinSock/iocp/IocpClient.Cpp
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _PACKET Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_PACKET Struct Reference

#include "packet.h"

List of all members.

Public Attributes

IPADDRESS ipSource
OVERLAPPED | oOverlapped
BYTE | rgbyBuffer [MAX_PACKET_LENGTH]
WSABUF | wsaBuffer

Detailed Description

Definition at line 24 of file packet.h.

Member Data Documentation

IPADDRESS _PACKET::ipSource

Definition at line 26 of file packet.h.

OVERLAPPED _PACKET::oOverlapped

Definition at line 30 of file packet.h.

BYTE _PACKET::rgbyBuffer[MAX_PACKET_LENGTH]

Definition at line 28 of file packet.h.

WSABUF _PACKET::wsaBuffer

Definition at line 27 of file packet.h.

The documentation for this struct was generated from the following file:
  • NetDS/RRas/ip/packet.h
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _ParameterVtbl Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

_ParameterVtbl Struct Reference

#include "adoint.h"

List of all members.

Public Member Functions

BEGIN_INTERFACE | HRESULT (STDMETHODCALLTYPE __RPC_FAR *QueryInterface)(_ADOParameter __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *put_Attributes)(_ADOParameter __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount)(_ADOParameter __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *AppendChunk)(_ADOParameter __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Size)(_ADOParameter __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *put_Size)(_ADOParameter __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_NumericScale)(_ADOParameter __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *put_NumericScale)(_ADOParameter __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Precision)(_ADOParameter __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Properties)(_ADOParameter __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Direction)(_ADOParameter __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *put_Direction)(_ADOParameter __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *put_Type)(_ADOParameter __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Type)(_ADOParameter __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Attributes)(_ADOParameter __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Value)(_ADOParameter __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *put_Name)(_ADOParameter __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *put_Precision)(_ADOParameter __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Name)(_ADOParameter __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Invoke)(_ADOParameter __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *put_Value)(_ADOParameter __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo)(_ADOParameter __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames)(_ADOParameter __RPC_FAR *This
ULONG (STDMETHODCALLTYPE __RPC_FAR *AddRef)(_ADOParameter __RPC_FAR *This)
ULONG (STDMETHODCALLTYPE __RPC_FAR *Release)(_ADOParameter __RPC_FAR *This)

Public Attributes

BYTE | bPrecision
BYTE | bScale
BSTR | bstr
REFIID LPOLESTR __RPC_FAR UINT | cNames
DISPID | dispIdMember
UINT iTInfo
long | l
UINT LCID | lcid
REFIID LPOLESTR __RPC_FAR UINT LCID | lcid
DISPID REFIID LCID | lcid
LONG | lParmAttribs
ParameterDirectionEnum lParmDirection
BYTE __RPC_FAR * | pbPrecision
BYTE __RPC_FAR * | pbScale
BSTR __RPC_FAR * | pbstr
UINT __RPC_FAR * | pctinfo
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR * 		pDispParams
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR EXCEPINFO __RPC_FAR * 		pExcepInfo
long __RPC_FAR * | pl
LONG __RPC_FAR * | plParmAttribs
ParameterDirectionEnum __RPC_FAR * | plParmDirection
UINT LCID ITypeInfo __RPC_FAR
*__RPC_FAR * 		ppTInfo
ADOProperties __RPC_FAR
*__RPC_FAR * 		ppvObject
BEGIN_INTERFACE REFIID void
__RPC_FAR *__RPC_FAR * 		ppvObject
DataTypeEnum __RPC_FAR * | psDataType
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR EXCEPINFO __RPC_FAR
UINT __RPC_FAR * 		puArgErr
VARIANT __RPC_FAR * | pvar
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR * 		pVarResult
REFIID LPOLESTR __RPC_FAR UINT
LCID DISPID __RPC_FAR * 		rgDispId
REFIID LPOLESTR __RPC_FAR * | rgszNames
REFIID | riid
DISPID REFIID | riid
BEGIN_INTERFACE REFIID | riid
DataTypeEnum sDataType
VARIANT | Val
VARIANT | val
DISPID REFIID LCID WORD | wFlags

Detailed Description

Definition at line 4141 of file adoint.h.

Member Function Documentation

BEGIN_INTERFACE _ParameterVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * QueryInterface )
_ParameterVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * put_Attributes )
_ParameterVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetTypeInfoCount )
_ParameterVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * AppendChunk )
_ParameterVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Size )
_ParameterVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * put_Size )
_ParameterVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_NumericScale )
_ParameterVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * put_NumericScale )
_ParameterVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Precision )
_ParameterVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Properties )
_ParameterVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Direction )
_ParameterVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * put_Direction )
_ParameterVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * put_Type )
_ParameterVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Type )
_ParameterVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Attributes )
_ParameterVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Value )
_ParameterVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * put_Name )
_ParameterVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * put_Precision )
_ParameterVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Name )
_ParameterVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Invoke )
_ParameterVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * put_Value )
_ParameterVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetTypeInfo )
_ParameterVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetIDsOfNames )
_ParameterVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * AddRef )
_ParameterVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * Release )

Member Data Documentation

BYTE _ParameterVtbl::bPrecision

Definition at line 4223 of file adoint.h.

BYTE _ParameterVtbl::bScale

Definition at line 4231 of file adoint.h.

BSTR _ParameterVtbl::bstr

Definition at line 4195 of file adoint.h.

REFIID LPOLESTR __RPC_FAR UINT _ParameterVtbl::cNames

Definition at line 4168 of file adoint.h.

DISPID _ParameterVtbl::dispIdMember

Definition at line 4176 of file adoint.h.

UINT _ParameterVtbl::iTInfo

Definition at line 4162 of file adoint.h.

long _ParameterVtbl::l

Definition at line 4239 of file adoint.h.

UINT LCID _ParameterVtbl::lcid

Definition at line 4162 of file adoint.h.

REFIID LPOLESTR __RPC_FAR UINT LCID _ParameterVtbl::lcid

Definition at line 4168 of file adoint.h.

DISPID REFIID LCID _ParameterVtbl::lcid

Definition at line 4176 of file adoint.h.

LONG _ParameterVtbl::lParmAttribs

Definition at line 4255 of file adoint.h.

ParameterDirectionEnum _ParameterVtbl::lParmDirection

Definition at line 4215 of file adoint.h.

BYTE __RPC_FAR* _ParameterVtbl::pbPrecision

Definition at line 4227 of file adoint.h.

BYTE __RPC_FAR* _ParameterVtbl::pbScale

Definition at line 4235 of file adoint.h.

BSTR __RPC_FAR* _ParameterVtbl::pbstr

Definition at line 4191 of file adoint.h.

UINT __RPC_FAR* _ParameterVtbl::pctinfo

Definition at line 4158 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR* _ParameterVtbl::pDispParams

Definition at line 4176 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR EXCEPINFO __RPC_FAR* _ParameterVtbl::pExcepInfo

Definition at line 4176 of file adoint.h.

long __RPC_FAR* _ParameterVtbl::pl

Definition at line 4243 of file adoint.h.

LONG __RPC_FAR* _ParameterVtbl::plParmAttribs

Definition at line 4251 of file adoint.h.

ParameterDirectionEnum __RPC_FAR* _ParameterVtbl::plParmDirection

Definition at line 4219 of file adoint.h.

UINT LCID ITypeInfo __RPC_FAR* __RPC_FAR* _ParameterVtbl::ppTInfo

Definition at line 4162 of file adoint.h.

ADOProperties __RPC_FAR* __RPC_FAR* _ParameterVtbl::ppvObject

Definition at line 4187 of file adoint.h.

BEGIN_INTERFACE REFIID void __RPC_FAR* __RPC_FAR* _ParameterVtbl::ppvObject

Definition at line 4147 of file adoint.h.

DataTypeEnum __RPC_FAR* _ParameterVtbl::psDataType

Definition at line 4207 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR EXCEPINFO __RPC_FAR UINT __RPC_FAR* _ParameterVtbl::puArgErr

Definition at line 4176 of file adoint.h.

VARIANT __RPC_FAR* _ParameterVtbl::pvar

Definition at line 4199 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR* _ParameterVtbl::pVarResult

Definition at line 4176 of file adoint.h.

REFIID LPOLESTR __RPC_FAR UINT LCID DISPID __RPC_FAR* _ParameterVtbl::rgDispId

Definition at line 4168 of file adoint.h.

REFIID LPOLESTR __RPC_FAR* _ParameterVtbl::rgszNames

Definition at line 4168 of file adoint.h.

REFIID _ParameterVtbl::riid

Definition at line 4168 of file adoint.h.

DISPID REFIID _ParameterVtbl::riid

Definition at line 4176 of file adoint.h.

BEGIN_INTERFACE REFIID _ParameterVtbl::riid

Definition at line 4147 of file adoint.h.

DataTypeEnum _ParameterVtbl::sDataType

Definition at line 4211 of file adoint.h.

VARIANT _ParameterVtbl::Val

Definition at line 4247 of file adoint.h.

VARIANT _ParameterVtbl::val

Definition at line 4203 of file adoint.h.

DISPID REFIID LCID WORD _ParameterVtbl::wFlags

Definition at line 4176 of file adoint.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/rds/handler/vc/adoint.h
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _PER_IO_CONTEXT Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_PER_IO_CONTEXT Struct Reference

#include "IocpServer.h"

List of all members.

Public Attributes

char | Buffer [MAX_BUFF_SIZE]
IO_OPERATION IOOperation
int | nSentBytes
int | nTotalBytes
WSAOVERLAPPED | Overlapped
struct _PER_IO_CONTEXT * | pIOContextForward
SOCKET | SocketAccept
WSABUF | wsabuf

Detailed Description

Definition at line 30 of file IocpServer.h.

Member Data Documentation

char _PER_IO_CONTEXT::Buffer[MAX_BUFF_SIZE]

Definition at line 32 of file IocpServer.h.

IO_OPERATION _PER_IO_CONTEXT::IOOperation

Definition at line 36 of file IocpServer.h.

int _PER_IO_CONTEXT::nSentBytes

Definition at line 35 of file IocpServer.h.

int _PER_IO_CONTEXT::nTotalBytes

Definition at line 34 of file IocpServer.h.

WSAOVERLAPPED _PER_IO_CONTEXT::Overlapped

Definition at line 31 of file IocpServer.h.

struct _PER_IO_CONTEXT* _PER_IO_CONTEXT::pIOContextForward

Definition at line 39 of file IocpServer.h.

SOCKET _PER_IO_CONTEXT::SocketAccept

Definition at line 37 of file IocpServer.h.

WSABUF _PER_IO_CONTEXT::wsabuf

Definition at line 33 of file IocpServer.h.

The documentation for this struct was generated from the following file:
  • NetDS/WinSock/iocp/IocpServer.h
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _PER_SOCKET_CONTEXT Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_PER_SOCKET_CONTEXT Struct Reference

#include "IocpServer.h"

List of all members.

Public Attributes

LPFN_ACCEPTEX | fnAcceptEx
struct _PER_SOCKET_CONTEXT * | pCtxtBack
struct _PER_SOCKET_CONTEXT * | pCtxtForward
PPER_IO_CONTEXT pIOContext
SOCKET | Socket

Detailed Description

Definition at line 51 of file IocpServer.h.

Member Data Documentation

LPFN_ACCEPTEX _PER_SOCKET_CONTEXT::fnAcceptEx

Definition at line 54 of file IocpServer.h.

struct _PER_SOCKET_CONTEXT* _PER_SOCKET_CONTEXT::pCtxtBack

Definition at line 60 of file IocpServer.h.

struct _PER_SOCKET_CONTEXT* _PER_SOCKET_CONTEXT::pCtxtForward

Definition at line 61 of file IocpServer.h.

PPER_IO_CONTEXT _PER_SOCKET_CONTEXT::pIOContext

Definition at line 59 of file IocpServer.h.

SOCKET _PER_SOCKET_CONTEXT::Socket

Definition at line 52 of file IocpServer.h.

The documentation for this struct was generated from the following file:
  • NetDS/WinSock/iocp/IocpServer.h
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _playinfo Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_playinfo Struct Reference

#include "MfEdit.h"

List of all members.

Public Attributes

BOOL bPlayContinuous
int iRecord

Detailed Description

Definition at line 313 of file MfEdit.h.

Member Data Documentation

BOOL _playinfo::bPlayContinuous

Definition at line 315 of file MfEdit.h.

int _playinfo::iRecord

Definition at line 314 of file MfEdit.h.

The documentation for this struct was generated from the following file:
  • Multimedia/Gdi/Metafile/MfEdit/MfEdit.h
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _POLYDATA Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_POLYDATA Struct Reference

#include "Poly.h"

List of all members.

Public Attributes

HANDLE hBezBuffer
int | nBezCurr
int | nBezTotal
int | nColor
POINT | pVel [BEZ_PTS]

Detailed Description

Definition at line 47 of file Poly.h.

Member Data Documentation

HANDLE _POLYDATA::hBezBuffer

Definition at line 53 of file Poly.h.

int _POLYDATA::nBezCurr

Definition at line 50 of file Poly.h.

int _POLYDATA::nBezTotal

Definition at line 49 of file Poly.h.

int _POLYDATA::nColor

Definition at line 51 of file Poly.h.

POINT _POLYDATA::pVel[BEZ_PTS]

Definition at line 52 of file Poly.h.

The documentation for this struct was generated from the following file:
  • Multimedia/Gdi/GdiDemo/Poly.h
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _PREF Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_PREF Struct Reference

#include "Global.h"

List of all members.

Public Attributes

DWORD dwNmch
BOOL fAutoCall
BOOL fAutoChat
BOOL fAutoHost
BOOL fAutoMonitor
BOOL fChat
BOOL fConfirm
BOOL fMsg
BOOL fMsgNotify
BOOL fMsgObjects
BOOL fMsgState
BOOL fMsgTrace
BOOL fMsgWindow
BOOL fSbar
BOOL fTbar
BOOL fUserList
int | iInit
LOGFONT | lf
NM_ADDR_TYPE | nmAddrType
NM_CALL_TYPE | nmCallType
PTCHAR | pszAddr
PTCHAR | pszConferenceName
PTCHAR | pszFileName
PTCHAR | pszPassword
WINDOWPLACEMENT | wpMain

Detailed Description

Definition at line 105 of file Global.h.

Member Data Documentation

DWORD _PREF::dwNmch

Definition at line 146 of file Global.h.

BOOL _PREF::fAutoCall

Definition at line 155 of file Global.h.

BOOL _PREF::fAutoChat

Definition at line 156 of file Global.h.

BOOL _PREF::fAutoHost

Definition at line 154 of file Global.h.

BOOL _PREF::fAutoMonitor

Definition at line 153 of file Global.h.

BOOL _PREF::fChat

Definition at line 139 of file Global.h.

BOOL _PREF::fConfirm

Definition at line 135 of file Global.h.

BOOL _PREF::fMsg

Definition at line 138 of file Global.h.

BOOL _PREF::fMsgNotify

Definition at line 160 of file Global.h.

BOOL _PREF::fMsgObjects

Definition at line 159 of file Global.h.

BOOL _PREF::fMsgState

Definition at line 161 of file Global.h.

BOOL _PREF::fMsgTrace

Definition at line 158 of file Global.h.

BOOL _PREF::fMsgWindow

Definition at line 108 of file Global.h.

BOOL _PREF::fSbar

Definition at line 107 of file Global.h.

BOOL _PREF::fTbar

Definition at line 137 of file Global.h.

BOOL _PREF::fUserList

Definition at line 109 of file Global.h.

int _PREF::iInit

Definition at line 151 of file Global.h.

LOGFONT _PREF::lf

Definition at line 111 of file Global.h.

NM_ADDR_TYPE _PREF::nmAddrType

Definition at line 144 of file Global.h.

NM_CALL_TYPE _PREF::nmCallType

Definition at line 164 of file Global.h.

PTCHAR _PREF::pszAddr

Definition at line 143 of file Global.h.

PTCHAR _PREF::pszConferenceName

Definition at line 147 of file Global.h.

PTCHAR _PREF::pszFileName

Definition at line 149 of file Global.h.

PTCHAR _PREF::pszPassword

Definition at line 148 of file Global.h.

WINDOWPLACEMENT _PREF::wpMain

Definition at line 110 of file Global.h.

The documentation for this struct was generated from the following files:
  • Web/NetMeeting/NMShare/Global.h
  • Web/NetMeeting/NMUI/Global.h
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _Printer Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_Printer Struct Reference

#include "queue.h"

List of all members.

Public Attributes

DWORD cJobs
DWORD dwStatus
HANDLE hPrinter
LPTSTR pszPrinterName
LPTSTR pszServerName
LPTSTR pszShareName

Detailed Description

Definition at line 55 of file queue.h.

Member Data Documentation

DWORD _Printer::cJobs

Definition at line 61 of file queue.h.

DWORD _Printer::dwStatus

Definition at line 60 of file queue.h.

HANDLE _Printer::hPrinter

Definition at line 62 of file queue.h.

LPTSTR _Printer::pszPrinterName

Definition at line 57 of file queue.h.

LPTSTR _Printer::pszServerName

Definition at line 58 of file queue.h.

LPTSTR _Printer::pszShareName

Definition at line 59 of file queue.h.

The documentation for this struct was generated from the following file:
  • Multimedia/Gdi/PrintJob/queue.h
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _PROPIDLIST Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_PROPIDLIST Struct Reference

#include "suminfo.h"

List of all members.

Public Attributes

DWORD byteOffset
DWORD propertyID

Detailed Description

Definition at line 94 of file suminfo.h.

Member Data Documentation

DWORD _PROPIDLIST::byteOffset

Definition at line 97 of file suminfo.h.

DWORD _PROPIDLIST::propertyID

Definition at line 96 of file suminfo.h.

The documentation for this struct was generated from the following file:
  • Com/Fundamentals/OleStd/suminfo.h
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _PROPSETLIST Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_PROPSETLIST Struct Reference

#include "suminfo.h"

List of all members.

Public Attributes

DWORD byteOffset
FMTID formatID

Detailed Description

Definition at line 88 of file suminfo.h.

Member Data Documentation

DWORD _PROPSETLIST::byteOffset

Definition at line 91 of file suminfo.h.

FMTID _PROPSETLIST::formatID

Definition at line 90 of file suminfo.h.

The documentation for this struct was generated from the following file:
  • Com/Fundamentals/OleStd/suminfo.h
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _PROPSHEETCFG Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_PROPSHEETCFG Struct Reference

#include "PropSheetHost.h"

List of all members.

Public Attributes

HWND | hwndHidden
HWND | hwndParentSheet
LONG_PTR | lNotifyHandle
WPARAM | wParamSheetClose

Detailed Description

Definition at line 78 of file PropSheetHost.h.

Member Data Documentation

HWND _PROPSHEETCFG::hwndHidden

Definition at line 82 of file PropSheetHost.h.

HWND _PROPSHEETCFG::hwndParentSheet

Definition at line 81 of file PropSheetHost.h.

LONG_PTR _PROPSHEETCFG::lNotifyHandle

Definition at line 80 of file PropSheetHost.h.

WPARAM _PROPSHEETCFG::wParamSheetClose

Definition at line 83 of file PropSheetHost.h.

The documentation for this struct was generated from the following file:
  • NetDS/ActiveDirectory/PropSheetHost/PropSheetHost.h
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _PROPVALUE Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_PROPVALUE Struct Reference

#include "suminfo.h"

List of all members.

Public Attributes

DWORD vtType
VTUNION vtValue

Detailed Description

Definition at line 100 of file suminfo.h.

Member Data Documentation

DWORD _PROPVALUE::vtType

Definition at line 102 of file suminfo.h.

VTUNION _PROPVALUE::vtValue

Definition at line 103 of file suminfo.h.

The documentation for this struct was generated from the following file:
  • Com/Fundamentals/OleStd/suminfo.h
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _PROVIDER Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_PROVIDER Struct Reference

#include "provider.h"

List of all members.

Public Attributes

HINSTANCE | hProvider
WSAPROTOCOL_INFOW | LayeredProvider
CHAR | LibraryPathA [MAX_PATH]
WCHAR | LibraryPathW [MAX_PATH]
LPWSPSTARTUP | lpWSPStartup
WSPPROC_TABLE | NextProcTable
EXT_WSPPROC_TABLE NextProcTableExt
WSAPROTOCOL_INFOW | NextProvider
CRITICAL_SECTION | ProviderCritSec
CHAR | ProviderPathA [MAX_PATH]
INT | ProviderPathLen
WCHAR | ProviderPathW [MAX_PATH]
SOCK_INFO * SocketList

Detailed Description

Definition at line 70 of file provider.h.

Member Data Documentation

HINSTANCE _PROVIDER::hProvider

Definition at line 82 of file provider.h.

WSAPROTOCOL_INFOW _PROVIDER::LayeredProvider

Definition at line 72 of file provider.h.

CHAR _PROVIDER::LibraryPathA[MAX_PATH]

Definition at line 79 of file provider.h.

WCHAR _PROVIDER::LibraryPathW[MAX_PATH]

Definition at line 77 of file provider.h.

LPWSPSTARTUP _PROVIDER::lpWSPStartup

Definition at line 84 of file provider.h.

WSPPROC_TABLE _PROVIDER::NextProcTable

Definition at line 74 of file provider.h.

EXT_WSPPROC_TABLE _PROVIDER::NextProcTableExt

Definition at line 75 of file provider.h.

WSAPROTOCOL_INFOW _PROVIDER::NextProvider

Definition at line 72 of file provider.h.

CRITICAL_SECTION _PROVIDER::ProviderCritSec

Definition at line 88 of file provider.h.

CHAR _PROVIDER::ProviderPathA[MAX_PATH]

Definition at line 79 of file provider.h.

INT _PROVIDER::ProviderPathLen

Definition at line 81 of file provider.h.

WCHAR _PROVIDER::ProviderPathW[MAX_PATH]

Definition at line 77 of file provider.h.

SOCK_INFO* _PROVIDER::SocketList

Definition at line 86 of file provider.h.

The documentation for this struct was generated from the following file:
  • NetDS/WinSock/LSP/provider.h
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _PRTDATA Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_PRTDATA Struct Reference

#include "MfEdit.h"

List of all members.

Public Attributes

BOOL bFit2Wnd
HENHMETAFILE hMetaf

Detailed Description

Definition at line 439 of file MfEdit.h.

Member Data Documentation

BOOL _PRTDATA::bFit2Wnd

Definition at line 440 of file MfEdit.h.

HENHMETAFILE _PRTDATA::hMetaf

Definition at line 441 of file MfEdit.h.

The documentation for this struct was generated from the following file:
  • Multimedia/Gdi/Metafile/MfEdit/MfEdit.h
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _QOS_OPTIONS Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_QOS_OPTIONS Struct Reference

#include "QosEvent.h"

List of all members.

Public Attributes

BOOL bAlternateQos
BOOL bConfirmResv
BOOL bDisableSignalling
BOOL bFineGrainErrorAvail
BOOL bFixTemplate
BOOL bMustSetQosInAccept
BOOL bProviderSpecific
BOOL bQosabilityIoctls
BOOL bQueryBufferSize
BOOL bReceiver
BOOL bSetDestaddr
BOOL bWaitToSend
QOS_IOCTL_SET qosIoctlSet
UCHAR | SendPriority
CHAR | szTemplate [64]

Detailed Description

Definition at line 64 of file QosEvent.h.

Member Data Documentation

BOOL _QOS_OPTIONS::bAlternateQos

Definition at line 77 of file QosEvent.h.

BOOL _QOS_OPTIONS::bConfirmResv

Definition at line 68 of file QosEvent.h.

BOOL _QOS_OPTIONS::bDisableSignalling

Definition at line 75 of file QosEvent.h.

BOOL _QOS_OPTIONS::bFineGrainErrorAvail

Definition at line 83 of file QosEvent.h.

BOOL _QOS_OPTIONS::bFixTemplate

Definition at line 86 of file QosEvent.h.

BOOL _QOS_OPTIONS::bMustSetQosInAccept

Definition at line 72 of file QosEvent.h.

BOOL _QOS_OPTIONS::bProviderSpecific

Definition at line 82 of file QosEvent.h.

BOOL _QOS_OPTIONS::bQosabilityIoctls

Definition at line 85 of file QosEvent.h.

BOOL _QOS_OPTIONS::bQueryBufferSize

Definition at line 69 of file QosEvent.h.

BOOL _QOS_OPTIONS::bReceiver

Definition at line 66 of file QosEvent.h.

BOOL _QOS_OPTIONS::bSetDestaddr

Definition at line 81 of file QosEvent.h.

BOOL _QOS_OPTIONS::bWaitToSend

Definition at line 67 of file QosEvent.h.

QOS_IOCTL_SET _QOS_OPTIONS::qosIoctlSet

Definition at line 88 of file QosEvent.h.

UCHAR _QOS_OPTIONS::SendPriority

Definition at line 79 of file QosEvent.h.

CHAR _QOS_OPTIONS::szTemplate[64]

Definition at line 89 of file QosEvent.h.

The documentation for this struct was generated from the following file:
  • NetDS/GQos/QosEvent/QosEvent.h
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _Query Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_Query Struct Reference

#include "QueryDlg.h"

List of all members.

Public Attributes

WTS_INFO_CLASS | InfoClass
TCHAR | QueryName [25]

Detailed Description

Definition at line 16 of file QueryDlg.h.

Member Data Documentation

WTS_INFO_CLASS _Query::InfoClass

Definition at line 18 of file QueryDlg.h.

TCHAR _Query::QueryName[25]

Definition at line 17 of file QueryDlg.h.

The documentation for this struct was generated from the following file:
  • WinBase/WtsApi/WtsApi/QueryDlg.h
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _Queue Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_Queue Struct Reference

#include "queue.h"

List of all members.

Public Attributes

DWORD nAllocated
DWORD nJobs
JOBDATA * pJobs
PRINTERDATA Printer

Detailed Description

Definition at line 96 of file queue.h.

Member Data Documentation

DWORD _Queue::nAllocated

Definition at line 100 of file queue.h.

DWORD _Queue::nJobs

Definition at line 99 of file queue.h.

JOBDATA* _Queue::pJobs

Definition at line 101 of file queue.h.

PRINTERDATA _Queue::Printer

Definition at line 98 of file queue.h.

The documentation for this struct was generated from the following file:
  • Multimedia/Gdi/PrintJob/queue.h
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _QueueHashNode Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_QueueHashNode Struct Reference

#include "Resources.h"

List of all members.

Public Attributes

VOID * | pKey
VOID * | pValue

Detailed Description

Definition at line 211 of file Resources.h.

Member Data Documentation

VOID * _QueueHashNode::pKey

Definition at line 212 of file Resources.h.

VOID * _QueueHashNode::pValue

Definition at line 213 of file Resources.h.

The documentation for this struct was generated from the following files:
  • NetDS/RPC/FileRep/FileRepAsyncPipe/Resources.h
  • NetDS/RPC/FileRep/filerepmultiuser/resources.h
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _QueueNode Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_QueueNode Struct Reference

#include "Resources.h"

List of all members.

Public Attributes

VOID * pData
_QueueNode * pNext

Detailed Description

Definition at line 116 of file Resources.h.

Member Data Documentation

VOID * _QueueNode::pData

Definition at line 117 of file Resources.h.

_QueueNode * _QueueNode::pNext

Definition at line 118 of file Resources.h.

The documentation for this struct was generated from the following files:
  • NetDS/RPC/FileRep/FileRepAsyncPipe/Resources.h
  • NetDS/RPC/FileRep/filerepmultiuser/resources.h
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _RASHOST_DATA Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_RASHOST_DATA Struct Reference

#include "RasHost.h"

List of all members.

Public Attributes

BYTE | Buffer [512]
DWORD dwSize
TCHAR | szUserDomain [64]
TCHAR | szUserName [64]

Detailed Description

Definition at line 47 of file RasHost.h.

Member Data Documentation

BYTE _RASHOST_DATA::Buffer[512]

Definition at line 52 of file RasHost.h.

DWORD _RASHOST_DATA::dwSize

Definition at line 49 of file RasHost.h.

TCHAR _RASHOST_DATA::szUserDomain[64]

Definition at line 51 of file RasHost.h.

TCHAR _RASHOST_DATA::szUserName[64]

Definition at line 50 of file RasHost.h.

The documentation for this struct was generated from the following file:
  • NetDS/Ras/WinNT/RasHost/RasHost.h
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _READ_WRITE_LOCK Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_READ_WRITE_LOCK Struct Reference

#include "sync.h"

List of all members.

Public Attributes

LONG | RWL_ReaderCount
HANDLE RWL_ReaderDoneEvent
CRITICAL_SECTION | RWL_ReadWriteBlock

Detailed Description

Definition at line 23 of file sync.h.

Member Data Documentation

LONG _READ_WRITE_LOCK::RWL_ReaderCount

Definition at line 26 of file sync.h.

HANDLE _READ_WRITE_LOCK::RWL_ReaderDoneEvent

Definition at line 27 of file sync.h.

CRITICAL_SECTION _READ_WRITE_LOCK::RWL_ReadWriteBlock

Definition at line 25 of file sync.h.

The documentation for this struct was generated from the following file:
  • NetDS/RRas/ip/sync.h
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _RecordsetVtbl Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

_RecordsetVtbl Struct Reference

#include "adoint.h"

List of all members.

Public Member Functions

BEGIN_INTERFACE | HRESULT (STDMETHODCALLTYPE __RPC_FAR *QueryInterface)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Find)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *put_MarshalOptions)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_MarshalOptions)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *put_Collect)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Collect)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Cancel)(_ADORecordset __RPC_FAR *This)
HRESULT (STDMETHODCALLTYPE __RPC_FAR *NextADORecordset)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *put_CursorLocation)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_CursorLocation)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *CancelBatch)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *UpdateBatch)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Clone)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_State)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Status)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *put_Sort)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Sort)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *put_PageSize)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_PageSize)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_PageCount)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *put_Filter)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Properties)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_EditMode)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *put_AbsolutePage)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_AbsolutePage)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Update)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Resync)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Requery)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Open)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *MoveLast)(_ADORecordset __RPC_FAR *This)
HRESULT (STDMETHODCALLTYPE __RPC_FAR *MoveFirst)(_ADORecordset __RPC_FAR *This)
HRESULT (STDMETHODCALLTYPE __RPC_FAR *MovePrevious)(_ADORecordset __RPC_FAR *This)
HRESULT (STDMETHODCALLTYPE __RPC_FAR *MoveNext)(_ADORecordset __RPC_FAR *This)
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Move)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetRows)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Delete)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *put_Bookmark)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *CancelUpdate)(_ADORecordset __RPC_FAR *This)
HRESULT (STDMETHODCALLTYPE __RPC_FAR *AddNew)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Source)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *put_Source)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *putref_Source)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_RecordCount)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *put_MaxRecords)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_MaxRecords)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Filter)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_LockType)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Fields)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_EOF)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *put_CursorType)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_CursorType)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *put_CacheSize)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Supports)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Close)(_ADORecordset __RPC_FAR *This)
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Bookmark)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_BOF)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_ActiveConnection)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *put_LockType)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *putref_ActiveADOConnection)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *put_AbsolutePosition)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_CacheSize)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_AbsolutePosition)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Invoke)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *put_ActiveConnection)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo)(_ADORecordset __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames)(_ADORecordset __RPC_FAR *This
ULONG (STDMETHODCALLTYPE __RPC_FAR *Release)(_ADORecordset __RPC_FAR *This)
ULONG (STDMETHODCALLTYPE __RPC_FAR *AddRef)(_ADORecordset __RPC_FAR *This)

Public Attributes

VARIANT VARIANT | ActiveConnection
AffectEnum AffectRecords
BSTR | bstrConn
long | CacheSize
REFIID LPOLESTR __RPC_FAR UINT | cNames
VARIANT __RPC_FAR * | Criteria
VARIANT | Criteria
BSTR __RPC_FAR * | Criteria
BSTR | Criteria
CursorOptionEnum CursorOptions
VARIANT VARIANT CursorTypeEnum | CursorType
DISPID | dispIdMember
MarshalOptionsEnum eMarshal
VARIANT | FieldList
long VARIANT VARIANT | Fields
VARIANT | Fields
VARIANT | Index
UINT iTInfo
UINT LCID | lcid
REFIID LPOLESTR __RPC_FAR UINT LCID | lcid
DISPID REFIID LCID | lcid
CursorLocationEnum lCursorLoc
CursorTypeEnum lCursorType
LockTypeEnum lLockType
long | lMaxRecords
VARIANT VARIANT CursorTypeEnum
LockTypeEnum 		LockType
long | NumRecords
VARIANT VARIANT CursorTypeEnum
LockTypeEnum LONG 		Options
LONG | Options
PositionEnum Page
long | PageSize
CursorOptionEnum VARIANT_BOOL
__RPC_FAR * 		pb
VARIANT_BOOL __RPC_FAR * | pb
IDispatch __RPC_FAR * | pcmd
IDispatch __RPC_FAR * | pconn
UINT __RPC_FAR * | pctinfo
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR * 		pDispParams
MarshalOptionsEnum __RPC_FAR * | peMarshal
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR EXCEPINFO __RPC_FAR * 		pExcepInfo
PositionEnum __RPC_FAR * | pl
long __RPC_FAR * | pl
EditModeEnum __RPC_FAR * | pl
CursorLocationEnum __RPC_FAR * | plCursorLoc
CursorTypeEnum __RPC_FAR * | plCursorType
LockTypeEnum __RPC_FAR * | plLockType
long __RPC_FAR * | plMaxRecords
LONG __RPC_FAR * | plObjState
PositionEnum Position
VARIANT __RPC_FAR
_ADORecordset __RPC_FAR
*__RPC_FAR * 		ppiRs
UINT LCID ITypeInfo __RPC_FAR
*__RPC_FAR * 		ppTInfo
_ADORecordset __RPC_FAR
*__RPC_FAR * 		ppvObject
ADOFields __RPC_FAR *__RPC_FAR * | ppvObject
ADOProperties __RPC_FAR
*__RPC_FAR * 		ppvObject
BEGIN_INTERFACE REFIID void
__RPC_FAR *__RPC_FAR * 		ppvObject
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR EXCEPINFO __RPC_FAR
UINT __RPC_FAR * 		puArgErr
VARIANT VARIANT __RPC_FAR * | pvar
long VARIANT VARIANT VARIANT
__RPC_FAR * 		pvar
VARIANT __RPC_FAR * | pvar
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR * 		pVarResult
VARIANT __RPC_FAR * | pvBookmark
VARIANT __RPC_FAR * | pvSource
VARIANT __RPC_FAR * | RecordsAffected
REFIID LPOLESTR __RPC_FAR UINT
LCID DISPID __RPC_FAR * 		rgDispId
REFIID LPOLESTR __RPC_FAR * | rgszNames
REFIID | riid
DISPID REFIID | riid
BEGIN_INTERFACE REFIID | riid
long | Rows
BSTR VARIANT_BOOL
SearchDirectionEnum 		SearchDirection
BSTR VARIANT_BOOL | SkipCurrent
VARIANT | Source
long VARIANT | Start
BSTR VARIANT_BOOL
SearchDirectionEnum VARIANT 		Start
VARIANT VARIANT | value
VARIANT VARIANT | Values
VARIANT | vBookmark
VARIANT | vConn
DISPID REFIID LCID WORD | wFlags

Detailed Description

Definition at line 2489 of file adoint.h.

Member Function Documentation

BEGIN_INTERFACE _RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * QueryInterface )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Find )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * put_MarshalOptions )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_MarshalOptions )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * put_Collect )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Collect )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetTypeInfoCount )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Cancel )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * NextADORecordset )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * put_CursorLocation )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_CursorLocation )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * CancelBatch )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * UpdateBatch )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Clone )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_State )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Status )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * put_Sort )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Sort )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * put_PageSize )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_PageSize )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_PageCount )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * put_Filter )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Properties )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_EditMode )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * put_AbsolutePage )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_AbsolutePage )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Update )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Resync )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Requery )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Open )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * MoveLast )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * MoveFirst )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * MovePrevious )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * MoveNext )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Move )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetRows )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Delete )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * put_Bookmark )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * CancelUpdate )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * AddNew )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Source )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * put_Source )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * putref_Source )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_RecordCount )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * put_MaxRecords )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_MaxRecords )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Filter )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_LockType )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Fields )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_EOF )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * put_CursorType )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_CursorType )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * put_CacheSize )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Supports )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Close )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Bookmark )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_BOF )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_ActiveConnection )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * put_LockType )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * putref_ActiveADOConnection )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * put_AbsolutePosition )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_CacheSize )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_AbsolutePosition )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Invoke )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * put_ActiveConnection )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetTypeInfo )
_RecordsetVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetIDsOfNames )
_RecordsetVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * Release )
_RecordsetVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * AddRef )

Member Data Documentation

VARIANT VARIANT _RecordsetVtbl::ActiveConnection

Definition at line 2666 of file adoint.h.

AffectEnum _RecordsetVtbl::AffectRecords

Definition at line 2638 of file adoint.h.

BSTR _RecordsetVtbl::bstrConn

Definition at line 2619 of file adoint.h.

long _RecordsetVtbl::CacheSize

Definition at line 2575 of file adoint.h.

REFIID LPOLESTR __RPC_FAR UINT _RecordsetVtbl::cNames

Definition at line 2516 of file adoint.h.

BSTR _RecordsetVtbl::Criteria

Definition at line 2699 of file adoint.h.

VARIANT _RecordsetVtbl::Criteria

Definition at line 2703 of file adoint.h.

BSTR __RPC_FAR* _RecordsetVtbl::Criteria

Definition at line 2719 of file adoint.h.

BSTR _RecordsetVtbl::Criteria

Definition at line 2723 of file adoint.h.

CursorOptionEnum _RecordsetVtbl::CursorOptions

Definition at line 2763 of file adoint.h.

VARIANT VARIANT CursorTypeEnum _RecordsetVtbl::CursorType

Definition at line 2666 of file adoint.h.

DISPID _RecordsetVtbl::dispIdMember

Definition at line 2524 of file adoint.h.

MarshalOptionsEnum _RecordsetVtbl::eMarshal

Definition at line 2782 of file adoint.h.

VARIANT _RecordsetVtbl::FieldList

Definition at line 2627 of file adoint.h.

long VARIANT VARIANT _RecordsetVtbl::Fields

Definition at line 2642 of file adoint.h.

VARIANT _RecordsetVtbl::Fields

Definition at line 2682 of file adoint.h.

VARIANT _RecordsetVtbl::Index

Definition at line 2768 of file adoint.h.

UINT _RecordsetVtbl::iTInfo

Definition at line 2510 of file adoint.h.

UINT LCID _RecordsetVtbl::lcid

Definition at line 2510 of file adoint.h.

REFIID LPOLESTR __RPC_FAR UINT LCID _RecordsetVtbl::lcid

Definition at line 2516 of file adoint.h.

DISPID REFIID LCID _RecordsetVtbl::lcid

Definition at line 2524 of file adoint.h.

CursorLocationEnum _RecordsetVtbl::lCursorLoc

Definition at line 2751 of file adoint.h.

CursorTypeEnum _RecordsetVtbl::lCursorType

Definition at line 2583 of file adoint.h.

LockTypeEnum _RecordsetVtbl::lLockType

Definition at line 2599 of file adoint.h.

long _RecordsetVtbl::lMaxRecords

Definition at line 2607 of file adoint.h.

VARIANT VARIANT CursorTypeEnum LockTypeEnum _RecordsetVtbl::LockType

Definition at line 2666 of file adoint.h.

long _RecordsetVtbl::NumRecords

Definition at line 2649 of file adoint.h.

VARIANT VARIANT CursorTypeEnum LockTypeEnum LONG _RecordsetVtbl::Options

Definition at line 2666 of file adoint.h.

LONG _RecordsetVtbl::Options

Definition at line 2674 of file adoint.h.

PositionEnum _RecordsetVtbl::Page

Definition at line 2691 of file adoint.h.

long _RecordsetVtbl::PageSize

Definition at line 2715 of file adoint.h.

CursorOptionEnum VARIANT_BOOL __RPC_FAR* _RecordsetVtbl::pb

Definition at line 2763 of file adoint.h.

VARIANT_BOOL __RPC_FAR * _RecordsetVtbl::pb

Definition at line 2559 of file adoint.h.

IDispatch __RPC_FAR* _RecordsetVtbl::pcmd

Definition at line 2615 of file adoint.h.

IDispatch __RPC_FAR* _RecordsetVtbl::pconn

Definition at line 2547 of file adoint.h.

UINT __RPC_FAR* _RecordsetVtbl::pctinfo

Definition at line 2506 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR* _RecordsetVtbl::pDispParams

Definition at line 2524 of file adoint.h.

MarshalOptionsEnum __RPC_FAR* _RecordsetVtbl::peMarshal

Definition at line 2778 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR EXCEPINFO __RPC_FAR* _RecordsetVtbl::pExcepInfo

Definition at line 2524 of file adoint.h.

long __RPC_FAR * _RecordsetVtbl::pl

Definition at line 2539 of file adoint.h.

long __RPC_FAR* _RecordsetVtbl::pl

Definition at line 2571 of file adoint.h.

EditModeEnum __RPC_FAR* _RecordsetVtbl::pl

Definition at line 2695 of file adoint.h.

CursorLocationEnum __RPC_FAR* _RecordsetVtbl::plCursorLoc

Definition at line 2747 of file adoint.h.

CursorTypeEnum __RPC_FAR* _RecordsetVtbl::plCursorType

Definition at line 2579 of file adoint.h.

LockTypeEnum __RPC_FAR* _RecordsetVtbl::plLockType

Definition at line 2595 of file adoint.h.

long __RPC_FAR* _RecordsetVtbl::plMaxRecords

Definition at line 2603 of file adoint.h.

LONG __RPC_FAR* _RecordsetVtbl::plObjState

Definition at line 2731 of file adoint.h.

PositionEnum _RecordsetVtbl::Position

Definition at line 2543 of file adoint.h.

VARIANT __RPC_FAR _ADORecordset __RPC_FAR* __RPC_FAR* _RecordsetVtbl::ppiRs

Definition at line 2755 of file adoint.h.

UINT LCID ITypeInfo __RPC_FAR* __RPC_FAR* _RecordsetVtbl::ppTInfo

Definition at line 2510 of file adoint.h.

_ADORecordset __RPC_FAR* __RPC_FAR* _RecordsetVtbl::ppvObject

Definition at line 2735 of file adoint.h.

ADOFields __RPC_FAR* __RPC_FAR* _RecordsetVtbl::ppvObject

Definition at line 2591 of file adoint.h.

ADOProperties __RPC_FAR* __RPC_FAR* _RecordsetVtbl::ppvObject

Definition at line 2535 of file adoint.h.

BEGIN_INTERFACE REFIID void __RPC_FAR* __RPC_FAR* _RecordsetVtbl::ppvObject

Definition at line 2495 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR EXCEPINFO __RPC_FAR UINT __RPC_FAR* _RecordsetVtbl::puArgErr

Definition at line 2524 of file adoint.h.

VARIANT VARIANT __RPC_FAR* _RecordsetVtbl::pvar

Definition at line 2768 of file adoint.h.

long VARIANT VARIANT VARIANT __RPC_FAR* _RecordsetVtbl::pvar

Definition at line 2642 of file adoint.h.

VARIANT __RPC_FAR* _RecordsetVtbl::pvar

Definition at line 2555 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR* _RecordsetVtbl::pVarResult

Definition at line 2524 of file adoint.h.

VARIANT __RPC_FAR* _RecordsetVtbl::pvBookmark

Definition at line 2563 of file adoint.h.

VARIANT __RPC_FAR* _RecordsetVtbl::pvSource

Definition at line 2623 of file adoint.h.

VARIANT __RPC_FAR* _RecordsetVtbl::RecordsAffected

Definition at line 2755 of file adoint.h.

REFIID LPOLESTR __RPC_FAR UINT LCID DISPID __RPC_FAR* _RecordsetVtbl::rgDispId

Definition at line 2516 of file adoint.h.

REFIID LPOLESTR __RPC_FAR* _RecordsetVtbl::rgszNames

Definition at line 2516 of file adoint.h.

REFIID _RecordsetVtbl::riid

Definition at line 2516 of file adoint.h.

DISPID REFIID _RecordsetVtbl::riid

Definition at line 2524 of file adoint.h.

BEGIN_INTERFACE REFIID _RecordsetVtbl::riid

Definition at line 2495 of file adoint.h.

long _RecordsetVtbl::Rows

Definition at line 2642 of file adoint.h.

BSTR VARIANT_BOOL SearchDirectionEnum _RecordsetVtbl::SearchDirection

Definition at line 2786 of file adoint.h.

BSTR VARIANT_BOOL _RecordsetVtbl::SkipCurrent

Definition at line 2786 of file adoint.h.

VARIANT _RecordsetVtbl::Source

Definition at line 2666 of file adoint.h.

long VARIANT _RecordsetVtbl::Start

Definition at line 2642 of file adoint.h.

BSTR VARIANT_BOOL SearchDirectionEnum VARIANT _RecordsetVtbl::Start

Definition at line 2786 of file adoint.h.

VARIANT VARIANT _RecordsetVtbl::value

Definition at line 2773 of file adoint.h.

VARIANT VARIANT _RecordsetVtbl::Values

Definition at line 2627 of file adoint.h.

VARIANT _RecordsetVtbl::vBookmark

Definition at line 2567 of file adoint.h.

VARIANT _RecordsetVtbl::vConn

Definition at line 2551 of file adoint.h.

DISPID REFIID LCID WORD _RecordsetVtbl::wFlags

Definition at line 2524 of file adoint.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/rds/handler/vc/adoint.h
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _RECV_INFO Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_RECV_INFO Struct Reference

List of all members.

Public Attributes

WSAEVENT | hEvents [MAXCLIENTS+1]
int | nTotalClients
CHAR * | recvbuf
SOCKET | sd [MAXCLIENTS+1]

Detailed Description

Definition at line 52 of file Receiver.Cpp.

Member Data Documentation

WSAEVENT _RECV_INFO::hEvents

Definition at line 55 of file Receiver.Cpp.

int _RECV_INFO::nTotalClients

Definition at line 57 of file Receiver.Cpp.

CHAR * _RECV_INFO::recvbuf

Definition at line 56 of file Receiver.Cpp.

SOCKET _RECV_INFO::sd

Definition at line 54 of file Receiver.Cpp.

The documentation for this struct was generated from the following files:
  • NetDS/GQos/QosEvent/Receiver.Cpp
  • NetDS/WinSock/ATMEvent/Receiver.Cpp
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _RECVARGS Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_RECVARGS Struct Reference

#include "provider.h"

List of all members.

Public Attributes

DWORD dwBufferCount
DWORD dwFlags
DWORD dwNumberOfBytesRecvd
LPWSABUF lpBuffers

Detailed Description

Definition at line 165 of file provider.h.

Member Data Documentation

DWORD _RECVARGS::dwBufferCount

Definition at line 168 of file provider.h.

DWORD _RECVARGS::dwFlags

Definition at line 169 of file provider.h.

DWORD _RECVARGS::dwNumberOfBytesRecvd

Definition at line 169 of file provider.h.

LPWSABUF _RECVARGS::lpBuffers

Definition at line 167 of file provider.h.

The documentation for this struct was generated from the following file:
  • NetDS/WinSock/LSP/provider.h
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _RECVFROMARGS Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_RECVFROMARGS Struct Reference

#include "provider.h"

List of all members.

Public Attributes

DWORD dwBufferCount
DWORD dwFlags
DWORD dwNumberOfBytesRecvd
LPWSABUF | lpBuffers
LPSOCKADDR | lpFrom
LPINT | lpFromLen

Detailed Description

Definition at line 176 of file provider.h.

Member Data Documentation

DWORD _RECVFROMARGS::dwBufferCount

Definition at line 179 of file provider.h.

DWORD _RECVFROMARGS::dwFlags

Definition at line 180 of file provider.h.

DWORD _RECVFROMARGS::dwNumberOfBytesRecvd

Definition at line 180 of file provider.h.

LPWSABUF _RECVFROMARGS::lpBuffers

Definition at line 178 of file provider.h.

LPSOCKADDR _RECVFROMARGS::lpFrom

Definition at line 182 of file provider.h.

LPINT _RECVFROMARGS::lpFromLen

Definition at line 183 of file provider.h.

The documentation for this struct was generated from the following file:
  • NetDS/WinSock/LSP/provider.h
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _REGSTRUCT Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_REGSTRUCT Struct Reference

List of all members.

Public Attributes

HKEY hRootKey
LPTSTR lpszData
LPTSTR lpszSubKey
LPTSTR lpszValueName

Detailed Description

Definition at line 127 of file ADEvent.cpp.

Member Data Documentation

HKEY _REGSTRUCT::hRootKey

Definition at line 129 of file ADEvent.cpp.

LPTSTR _REGSTRUCT::lpszData

Definition at line 132 of file ADEvent.cpp.

LPTSTR _REGSTRUCT::lpszSubKey

Definition at line 130 of file ADEvent.cpp.

LPTSTR _REGSTRUCT::lpszValueName

Definition at line 131 of file ADEvent.cpp.

The documentation for this struct was generated from the following file:
  • NetDS/ADSI/samples/activedir/adevent/ADEvent.cpp
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _RqsConfigString Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_RqsConfigString Struct Reference

#include "rqsconfig.h"

List of all members.

Public Attributes

CHAR * pszString
UINT uiLength

Detailed Description

Definition at line 16 of file rqsconfig.h.

Member Data Documentation

CHAR* _RqsConfigString::pszString

Definition at line 18 of file rqsconfig.h.

UINT _RqsConfigString::uiLength

Definition at line 19 of file rqsconfig.h.

The documentation for this struct was generated from the following file:
  • NetDS/RRas/rqs/server/rqsconfig.h
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _RqsEngineCbInfo Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_RqsEngineCbInfo Struct Reference

List of all members.

Public Attributes

RqsClient * pClient
RqsEngine * pEngine

Detailed Description

Definition at line 19 of file rqsengine.cpp.

Member Data Documentation

RqsClient* _RqsEngineCbInfo::pClient

Definition at line 22 of file rqsengine.cpp.

RqsEngine* _RqsEngineCbInfo::pEngine

Definition at line 21 of file rqsengine.cpp.

The documentation for this struct was generated from the following file:
  • NetDS/RRas/rqs/server/rqsengine.cpp
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _RSUMINFO Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_RSUMINFO Struct Reference

List of all members.

Public Attributes

WORD | byteOrder
CLSID classId
DWORD cSections
ULONG fileOffset
WORD | formatVersion
WORD | getOSVersion
WORD | osVersion
PROPSETLIST | rgPropSet [1]
STANDARDSECINMEM section

Detailed Description

Definition at line 117 of file suminfo.Cpp.

Member Data Documentation

WORD _RSUMINFO::byteOrder

Definition at line 119 of file suminfo.Cpp.

CLSID _RSUMINFO::classId

Definition at line 123 of file suminfo.Cpp.

DWORD _RSUMINFO::cSections

Definition at line 124 of file suminfo.Cpp.

ULONG _RSUMINFO::fileOffset

Definition at line 127 of file suminfo.Cpp.

WORD _RSUMINFO::formatVersion

Definition at line 120 of file suminfo.Cpp.

WORD _RSUMINFO::getOSVersion

Definition at line 121 of file suminfo.Cpp.

WORD _RSUMINFO::osVersion

Definition at line 122 of file suminfo.Cpp.

PROPSETLIST _RSUMINFO::rgPropSet[1]

Definition at line 125 of file suminfo.Cpp.

STANDARDSECINMEM _RSUMINFO::section

Definition at line 126 of file suminfo.Cpp.

The documentation for this struct was generated from the following file:
  • Com/Fundamentals/OleStd/suminfo.Cpp
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _RU_SOCKET Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_RU_SOCKET Struct Reference

List of all members.

Public Attributes

SOCKADDR | addr
SOCKET | Socket
UINT uiSize

Detailed Description

Definition at line 41 of file rusocket.cpp.

Member Data Documentation

SOCKADDR _RU_SOCKET::addr

Definition at line 44 of file rusocket.cpp.

SOCKET _RU_SOCKET::Socket

Definition at line 43 of file rusocket.cpp.

UINT _RU_SOCKET::uiSize

Definition at line 45 of file rusocket.cpp.

The documentation for this struct was generated from the following file:
  • NetDS/RRas/rqs/common/rusocket.cpp
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _RU_SOCKET_CREATE_DATA Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_RU_SOCKET_CREATE_DATA Struct Reference

#include "rusocket.h"

List of all members.

Public Attributes

CHAR * | pszDest
CHAR * | pszSrc
UINT uiPort

Detailed Description

Definition at line 38 of file rusocket.h.

Member Data Documentation

CHAR* _RU_SOCKET_CREATE_DATA::pszDest

Definition at line 41 of file rusocket.h.

CHAR* _RU_SOCKET_CREATE_DATA::pszSrc

Definition at line 42 of file rusocket.h.

UINT _RU_SOCKET_CREATE_DATA::uiPort

Definition at line 40 of file rusocket.h.

The documentation for this struct was generated from the following file:
  • NetDS/RRas/rqs/inc/rusocket.h
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _RURASREGROOT Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_RURASREGROOT Struct Reference

List of all members.

Public Attributes

HKEY hkRegRoot
PWSTR pszName

Detailed Description

Definition at line 32 of file rureg.cpp.

Member Data Documentation

HKEY _RURASREGROOT::hkRegRoot

Definition at line 35 of file rureg.cpp.

PWSTR _RURASREGROOT::pszName

Definition at line 34 of file rureg.cpp.

The documentation for this struct was generated from the following file:
  • NetDS/RRas/rqs/common/rureg.cpp
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _RUREGVALUE Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_RUREGVALUE Struct Reference

#include "rureg.h"

List of all members.

Public Attributes

DWORD dwSize
DWORD dwType
HRESULT | hr
BYTE * | pbData
PWSTR pszName

Detailed Description

Definition at line 30 of file rureg.h.

Member Data Documentation

DWORD _RUREGVALUE::dwSize

Definition at line 34 of file rureg.h.

DWORD _RUREGVALUE::dwType

Definition at line 33 of file rureg.h.

HRESULT _RUREGVALUE::hr

Definition at line 36 of file rureg.h.

BYTE* _RUREGVALUE::pbData

Definition at line 35 of file rureg.h.

PWSTR _RUREGVALUE::pszName

Definition at line 32 of file rureg.h.

The documentation for this struct was generated from the following file:
  • NetDS/RRas/rqs/inc/rureg.h
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _SAMPLE_HELPER_DATA_ Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_SAMPLE_HELPER_DATA_ Struct Reference

#include "nshsamp.h"

List of all members.

Public Attributes

BOOL bEnabled
DWORD GatewayUserData
DWORD InterfaceID
ePOTENTIAL Potential
DWORD SprocketCount
DWORD Supermetric
DWORD WidgetCount

Detailed Description

Definition at line 54 of file nshsamp.h.

Member Data Documentation

BOOL _SAMPLE_HELPER_DATA_::bEnabled

Definition at line 60 of file nshsamp.h.

DWORD _SAMPLE_HELPER_DATA_::GatewayUserData

Definition at line 58 of file nshsamp.h.

DWORD _SAMPLE_HELPER_DATA_::InterfaceID

Definition at line 59 of file nshsamp.h.

ePOTENTIAL _SAMPLE_HELPER_DATA_::Potential

Definition at line 62 of file nshsamp.h.

DWORD _SAMPLE_HELPER_DATA_::SprocketCount

Definition at line 57 of file nshsamp.h.

DWORD _SAMPLE_HELPER_DATA_::Supermetric

Definition at line 61 of file nshsamp.h.

DWORD _SAMPLE_HELPER_DATA_::WidgetCount

Definition at line 56 of file nshsamp.h.

The documentation for this struct was generated from the following file:
  • NetDS/netshell/nshsamp.h
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _SCHEMAINFO Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_SCHEMAINFO Struct Reference

#include "cdialog.h"

List of all members.

Public Attributes

ULONG cRestrictions
const GUID * | pguidSchema
WCHAR * | pwszSchemaName
struct {
ULONG iNode
WCHAR * pwszName
DBTYPE wType
} rgResInfo [MAX_RESTRICTIONS]

Detailed Description

Definition at line 44 of file cdialog.h.

Member Data Documentation

ULONG _SCHEMAINFO::cRestrictions

Definition at line 51 of file cdialog.h.

ULONG _SCHEMAINFO::iNode

Definition at line 54 of file cdialog.h.

const GUID* _SCHEMAINFO::pguidSchema

Definition at line 48 of file cdialog.h.

WCHAR* _SCHEMAINFO::pwszName

Definition at line 55 of file cdialog.h.

WCHAR* _SCHEMAINFO::pwszSchemaName

Definition at line 47 of file cdialog.h.

struct { ... } _SCHEMAINFO::rgResInfo[MAX_RESTRICTIONS]
DBTYPE _SCHEMAINFO::wType

Definition at line 56 of file cdialog.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/oledb/rowsetviewer/cdialog.h
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _SEARCH_REQUEST Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_SEARCH_REQUEST Struct Reference

#include "AsyncIO.h"

List of all members.

Public Attributes

HANDLE File
LPSTR FileData
DWORD FileSize
CHAR | FullPathName [1]
OVERLAPPED | OverlappedIO
WORK_QUEUE_ITEM WorkItem

Detailed Description

Definition at line 316 of file AsyncIO.h.

Member Data Documentation

HANDLE _SEARCH_REQUEST::File

Definition at line 320 of file AsyncIO.h.

LPSTR _SEARCH_REQUEST::FileData

Definition at line 319 of file AsyncIO.h.

DWORD _SEARCH_REQUEST::FileSize

Definition at line 318 of file AsyncIO.h.

CHAR _SEARCH_REQUEST::FullPathName[1]

Definition at line 322 of file AsyncIO.h.

OVERLAPPED _SEARCH_REQUEST::OverlappedIO

Definition at line 321 of file AsyncIO.h.

WORK_QUEUE_ITEM _SEARCH_REQUEST::WorkItem

Definition at line 317 of file AsyncIO.h.

The documentation for this struct was generated from the following file:
  • WinBase/IO/AsyncIO/AsyncIO.h
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _SEARCH_REQUEST_STATE Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_SEARCH_REQUEST_STATE Struct Reference

#include "AsyncIO.h"

List of all members.

Public Attributes

VIRTUAL_BUFFER Buffer
LPSTR CurrentOutput

Detailed Description

Definition at line 310 of file AsyncIO.h.

Member Data Documentation

VIRTUAL_BUFFER _SEARCH_REQUEST_STATE::Buffer

Definition at line 311 of file AsyncIO.h.

LPSTR _SEARCH_REQUEST_STATE::CurrentOutput

Definition at line 312 of file AsyncIO.h.

The documentation for this struct was generated from the following file:
  • WinBase/IO/AsyncIO/AsyncIO.h
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _SEC_CONTEXT Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Attributes

_SEC_CONTEXT Struct Reference

#include "SampSSP.H"

List of all members.

Public Types

enum {
Idle, FirstInit, FirstAccept, SecondInit,
SecondAccept
}

Public Attributes

ULONG ContextFlags
ULONG ContextId
ULONG CredentialId
struct _SEC_CONTEXT * | Next
ULONG Nonce
enum _SEC_CONTEXT:: { ... } | State

Detailed Description

Definition at line 24 of file SampSSP.H.

Member Enumeration Documentation

anonymous enum
Enumerator:
Idle
FirstInit
FirstAccept
SecondInit
SecondAccept

Definition at line 30 of file SampSSP.H.

         {
        Idle,
        FirstInit,
        FirstAccept,
        SecondInit,
        SecondAccept
    } State;

Member Data Documentation

ULONG _SEC_CONTEXT::ContextFlags

Definition at line 29 of file SampSSP.H.

ULONG _SEC_CONTEXT::ContextId

Definition at line 26 of file SampSSP.H.

ULONG _SEC_CONTEXT::CredentialId

Definition at line 27 of file SampSSP.H.

struct _SEC_CONTEXT* _SEC_CONTEXT::Next

Definition at line 25 of file SampSSP.H.

ULONG _SEC_CONTEXT::Nonce

Definition at line 28 of file SampSSP.H.

enum { ... } _SEC_CONTEXT::State
The documentation for this struct was generated from the following file:
  • Security/Authentication/SampSSP/SampSSP.H
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _SEC_FUNC Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_SEC_FUNC Struct Reference

List of all members.

Public Attributes

ACQUIRE_CREDENTIALS_HANDLE_FN | pAcquireCredentialsHandle
COMPLETE_AUTH_TOKEN_FN | pCompleteAuthToken
DELETE_SECURITY_CONTEXT_FN | pDeleteSecurityContext
ENUMERATE_SECURITY_PACKAGES_FN | pEnumerateSecurityPackages
FREE_CONTEXT_BUFFER_FN | pFreeContextBuffer
FREE_CREDENTIALS_HANDLE_FN | pFreeCredentialsHandle
INITIALIZE_SECURITY_CONTEXT_FN | pInitializeSecurityContext
QUERY_SECURITY_PACKAGE_INFO_FN | pQuerySecurityPackageInfo

Detailed Description

Definition at line 74 of file HttpAuth.c.

Member Data Documentation

ACQUIRE_CREDENTIALS_HANDLE_FN _SEC_FUNC::pAcquireCredentialsHandle

Definition at line 76 of file HttpAuth.c.

COMPLETE_AUTH_TOKEN_FN _SEC_FUNC::pCompleteAuthToken

Definition at line 80 of file HttpAuth.c.

DELETE_SECURITY_CONTEXT_FN _SEC_FUNC::pDeleteSecurityContext

Definition at line 82 of file HttpAuth.c.

ENUMERATE_SECURITY_PACKAGES_FN _SEC_FUNC::pEnumerateSecurityPackages

Definition at line 81 of file HttpAuth.c.

FREE_CONTEXT_BUFFER_FN _SEC_FUNC::pFreeContextBuffer

Definition at line 78 of file HttpAuth.c.

FREE_CREDENTIALS_HANDLE_FN _SEC_FUNC::pFreeCredentialsHandle

Definition at line 75 of file HttpAuth.c.

INITIALIZE_SECURITY_CONTEXT_FN _SEC_FUNC::pInitializeSecurityContext

Definition at line 79 of file HttpAuth.c.

QUERY_SECURITY_PACKAGE_INFO_FN _SEC_FUNC::pQuerySecurityPackageInfo

Definition at line 77 of file HttpAuth.c.

The documentation for this struct was generated from the following file:
  • Security/SSPI/HttpAuth/HttpAuth.c
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _SECTION Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_SECTION Struct Reference

#include "suminfo.h"

List of all members.

Public Attributes

DWORD cBytes
DWORD cProperties
PROPIDLIST | rgPropId [1]
PROPVALUE | rgPropValue [1]

Detailed Description

Definition at line 106 of file suminfo.h.

Member Data Documentation

DWORD _SECTION::cBytes

Definition at line 108 of file suminfo.h.

DWORD _SECTION::cProperties

Definition at line 109 of file suminfo.h.

PROPIDLIST _SECTION::rgPropId[1]

Definition at line 110 of file suminfo.h.

PROPVALUE _SECTION::rgPropValue[1]

Definition at line 111 of file suminfo.h.

The documentation for this struct was generated from the following file:
  • Com/Fundamentals/OleStd/suminfo.h
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _SEND_INFO Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_SEND_INFO Struct Reference

List of all members.

Public Attributes

BOOL bSendComplete
BOOL bSendEnabled
WSAEVENT | hEvents [TOTAL_EVENTS]
int | nTotalSends
WSAOVERLAPPED | ovr
SOCKET | sd
WSABUF | sndbuf

Detailed Description

Definition at line 53 of file Sender.Cpp.

Member Data Documentation

BOOL _SEND_INFO::bSendComplete

Definition at line 60 of file Sender.Cpp.

BOOL _SEND_INFO::bSendEnabled

Definition at line 59 of file Sender.Cpp.

WSAEVENT _SEND_INFO::hEvents

Definition at line 56 of file Sender.Cpp.

int _SEND_INFO::nTotalSends

Definition at line 61 of file Sender.Cpp.

WSAOVERLAPPED _SEND_INFO::ovr

Definition at line 58 of file Sender.Cpp.

SOCKET _SEND_INFO::sd

Definition at line 55 of file Sender.Cpp.

WSABUF _SEND_INFO::sndbuf

Definition at line 62 of file Sender.Cpp.

The documentation for this struct was generated from the following files:
  • NetDS/GQos/QosEvent/Sender.Cpp
  • NetDS/WinSock/ATMEvent/Sender.Cpp
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _SENDARGS Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_SENDARGS Struct Reference

#include "provider.h"

List of all members.

Public Attributes

DWORD dwBufferCount
DWORD dwFlags
DWORD dwNumberOfBytesSent
LPWSABUF lpBuffers

Detailed Description

Definition at line 189 of file provider.h.

Member Data Documentation

DWORD _SENDARGS::dwBufferCount

Definition at line 192 of file provider.h.

DWORD _SENDARGS::dwFlags

Definition at line 194 of file provider.h.

DWORD _SENDARGS::dwNumberOfBytesSent

Definition at line 193 of file provider.h.

LPWSABUF _SENDARGS::lpBuffers

Definition at line 191 of file provider.h.

The documentation for this struct was generated from the following file:
  • NetDS/WinSock/LSP/provider.h
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _SENDTOARGS Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_SENDTOARGS Struct Reference

#include "provider.h"

List of all members.

Public Attributes

DWORD dwBufferCount
DWORD dwFlags
DWORD dwNumberOfBytesSent
int | iToLen
LPWSABUF | lpBuffers
SOCKADDR_STORAGE | To

Detailed Description

Definition at line 200 of file provider.h.

Member Data Documentation

DWORD _SENDTOARGS::dwBufferCount

Definition at line 203 of file provider.h.

DWORD _SENDTOARGS::dwFlags

Definition at line 205 of file provider.h.

DWORD _SENDTOARGS::dwNumberOfBytesSent

Definition at line 204 of file provider.h.

int _SENDTOARGS::iToLen

Definition at line 207 of file provider.h.

LPWSABUF _SENDTOARGS::lpBuffers

Definition at line 202 of file provider.h.

SOCKADDR_STORAGE _SENDTOARGS::To

Definition at line 206 of file provider.h.

The documentation for this struct was generated from the following file:
  • NetDS/WinSock/LSP/provider.h
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _SFFS Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_SFFS Struct Reference

#include "wn_dos.h"

List of all members.

Public Attributes

union {
struct {
BF hr: 5
BF mint: 6
BF sec: 5
}
BF time:16
unsigned short timeVariable
};
union {
struct {
BF dom: 5
BF mon: 4
BF yr: 7
}
BF date:16
unsigned short dateVariable
};
uchar | buff [21]
ulong | cbFile
uchar | szFileName [13]
uchar | wAttr

Detailed Description

Definition at line 61 of file wn_dos.h.

Member Data Documentation

union { ... }
union { ... }
uchar _SFFS::buff[21]

Definition at line 63 of file wn_dos.h.

ulong _SFFS::cbFile

Definition at line 87 of file wn_dos.h.

BF _SFFS::date

Definition at line 79 of file wn_dos.h.

unsigned short _SFFS::dateVariable

Definition at line 78 of file wn_dos.h.

BF _SFFS::dom

Definition at line 82 of file wn_dos.h.

BF _SFFS::hr

Definition at line 73 of file wn_dos.h.

BF _SFFS::mint

Definition at line 72 of file wn_dos.h.

BF _SFFS::mon

Definition at line 83 of file wn_dos.h.

BF _SFFS::sec

Definition at line 71 of file wn_dos.h.

uchar _SFFS::szFileName[13]

Definition at line 88 of file wn_dos.h.

BF _SFFS::time

Definition at line 68 of file wn_dos.h.

unsigned short _SFFS::timeVariable

Definition at line 67 of file wn_dos.h.

uchar _SFFS::wAttr

Definition at line 64 of file wn_dos.h.

BF _SFFS::yr

Definition at line 84 of file wn_dos.h.

The documentation for this struct was generated from the following file:
  • Com/Fundamentals/OleStd/wn_dos.h
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _Shutdown Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_Shutdown Struct Reference

#include "ShutdownDlg.h"

List of all members.

Public Attributes

DWORD ShutdownFlag
TCHAR ShutdownName [35]

Detailed Description

Definition at line 20 of file ShutdownDlg.h.

Member Data Documentation

DWORD _Shutdown::ShutdownFlag

Definition at line 22 of file ShutdownDlg.h.

TCHAR _Shutdown::ShutdownName[35]

Definition at line 21 of file ShutdownDlg.h.

The documentation for this struct was generated from the following file:
  • WinBase/WtsApi/WtsApi/ShutdownDlg.h
Generated on Wed Nov 13 2024 16:55:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _SIGGEN_COUNTER Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_SIGGEN_COUNTER Struct Reference

#include "DataGen.h"

List of all members.

Public Attributes

PERF_COUNTER_BLOCK CounterBlock
DWORD dwConstantValue
DWORD dwReserved
DWORD dwSineWaveValue
DWORD dwSquareWaveValue
DWORD dwTriangleWaveValue

Detailed Description

Definition at line 67 of file DataGen.h.

Member Data Documentation

PERF_COUNTER_BLOCK _SIGGEN_COUNTER::CounterBlock

Definition at line 68 of file DataGen.h.

DWORD _SIGGEN_COUNTER::dwConstantValue

Definition at line 73 of file DataGen.h.

DWORD _SIGGEN_COUNTER::dwReserved

Definition at line 69 of file DataGen.h.

DWORD _SIGGEN_COUNTER::dwSineWaveValue

Definition at line 70 of file DataGen.h.

DWORD _SIGGEN_COUNTER::dwSquareWaveValue

Definition at line 72 of file DataGen.h.

DWORD _SIGGEN_COUNTER::dwTriangleWaveValue

Definition at line 71 of file DataGen.h.

The documentation for this struct was generated from the following file:
  • WinBase/WinNT/PerfTool/PerfDllS/PerfGen/DataGen.h
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _SIGGEN_DATA_DEFINITION Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_SIGGEN_DATA_DEFINITION Struct Reference

#include "DataGen.h"

List of all members.

Public Attributes

PERF_COUNTER_DEFINITION | ConstantValueDef
PERF_OBJECT_TYPE | SigGenObjectType
PERF_COUNTER_DEFINITION | SineWaveDef
PERF_COUNTER_DEFINITION | SquareWaveDef
PERF_COUNTER_DEFINITION | TriangleWaveDef

Detailed Description

Definition at line 53 of file DataGen.h.

Member Data Documentation

PERF_COUNTER_DEFINITION _SIGGEN_DATA_DEFINITION::ConstantValueDef

Definition at line 58 of file DataGen.h.

PERF_OBJECT_TYPE _SIGGEN_DATA_DEFINITION::SigGenObjectType

Definition at line 54 of file DataGen.h.

PERF_COUNTER_DEFINITION _SIGGEN_DATA_DEFINITION::SineWaveDef

Definition at line 55 of file DataGen.h.

PERF_COUNTER_DEFINITION _SIGGEN_DATA_DEFINITION::SquareWaveDef

Definition at line 57 of file DataGen.h.

PERF_COUNTER_DEFINITION _SIGGEN_DATA_DEFINITION::TriangleWaveDef

Definition at line 56 of file DataGen.h.

The documentation for this struct was generated from the following file:
  • WinBase/WinNT/PerfTool/PerfDllS/PerfGen/DataGen.h
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _SIGNATURE Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_SIGNATURE Struct Reference

#include "SampSSP.H"

List of all members.

Public Attributes

ULONG MessageId
ULONG Tag

Detailed Description

Definition at line 60 of file SampSSP.H.

Member Data Documentation

ULONG _SIGNATURE::MessageId

Definition at line 61 of file SampSSP.H.

ULONG _SIGNATURE::Tag

Definition at line 62 of file SampSSP.H.

The documentation for this struct was generated from the following file:
  • Security/Authentication/SampSSP/SampSSP.H
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _SNMP_MGR_SESSION Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_SNMP_MGR_SESSION Struct Reference

#include "WSnmpUtil.h"

List of all members.

Public Attributes

HSNMP_ENTITY | hAgentEntity
HSNMP_ENTITY | hManagerEntity
HSNMP_PDU | hPdu
HSNMP_SESSION | hSnmpSession
HSNMP_VBL | hVbl
HSNMP_CONTEXT | hViewContext
HWND | hWnd
smiINT32 | nError
smiINT32 | nErrorIndex
smiINT32 | nErrorStatus
smiINT32 | nPduType
smiINT32 | nRequestId

Detailed Description

Definition at line 48 of file WSnmpUtil.h.

Member Data Documentation

HSNMP_ENTITY _SNMP_MGR_SESSION::hAgentEntity

Definition at line 52 of file WSnmpUtil.h.

HSNMP_ENTITY _SNMP_MGR_SESSION::hManagerEntity

Definition at line 53 of file WSnmpUtil.h.

HSNMP_PDU _SNMP_MGR_SESSION::hPdu

Definition at line 55 of file WSnmpUtil.h.

HSNMP_SESSION _SNMP_MGR_SESSION::hSnmpSession

Definition at line 51 of file WSnmpUtil.h.

HSNMP_VBL _SNMP_MGR_SESSION::hVbl

Definition at line 56 of file WSnmpUtil.h.

HSNMP_CONTEXT _SNMP_MGR_SESSION::hViewContext

Definition at line 54 of file WSnmpUtil.h.

HWND _SNMP_MGR_SESSION::hWnd

Definition at line 57 of file WSnmpUtil.h.

smiINT32 _SNMP_MGR_SESSION::nError

Definition at line 61 of file WSnmpUtil.h.

smiINT32 _SNMP_MGR_SESSION::nErrorIndex

Definition at line 63 of file WSnmpUtil.h.

smiINT32 _SNMP_MGR_SESSION::nErrorStatus

Definition at line 62 of file WSnmpUtil.h.

smiINT32 _SNMP_MGR_SESSION::nPduType

Definition at line 59 of file WSnmpUtil.h.

smiINT32 _SNMP_MGR_SESSION::nRequestId

Definition at line 60 of file WSnmpUtil.h.

The documentation for this struct was generated from the following file:
  • NetDS/Snmp/WSnmp/WSnmpUtil.h
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _SOCK_INFO Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_SOCK_INFO Struct Reference

#include "common.h"

List of all members.

Public Attributes

BOOL bClosing
DWORD BytesRecv
DWORD BytesSent
DWORD dwOutstandingAsync
HANDLE hIocp
HWND | hWnd
BOOL isFdCloseRecd
BOOL isSocketListening
SOCKET | LayeredSocket
struct _SOCK_INFO * | next
int | nTotalRecd
int | nTotalSent
struct _SOCK_INFO * | prev
struct _PROVIDER * | Provider
SOCKET | ProviderSocket
DATA_BUFFER recdData
volatile LONG | RefCount
SOCKET | sock
CRITICAL_SECTION | SockCritSec
UINT uMsg

Detailed Description

Definition at line 83 of file common.h.

Member Data Documentation

BOOL _SOCK_INFO::bClosing

Definition at line 41 of file provider.h.

DWORD _SOCK_INFO::BytesRecv

Definition at line 46 of file provider.h.

DWORD _SOCK_INFO::BytesSent

Definition at line 45 of file provider.h.

DWORD _SOCK_INFO::dwOutstandingAsync

Definition at line 40 of file provider.h.

HANDLE _SOCK_INFO::hIocp

Definition at line 47 of file provider.h.

HWND _SOCK_INFO::hWnd

Definition at line 49 of file provider.h.

BOOL _SOCK_INFO::isFdCloseRecd

Definition at line 92 of file common.h.

BOOL _SOCK_INFO::isSocketListening

Definition at line 86 of file common.h.

SOCKET _SOCK_INFO::LayeredSocket

Definition at line 39 of file provider.h.

struct _SOCK_INFO * _SOCK_INFO::next

Definition at line 87 of file common.h.

int _SOCK_INFO::nTotalRecd

Definition at line 90 of file common.h.

int _SOCK_INFO::nTotalSent

Definition at line 91 of file common.h.

struct _SOCK_INFO * _SOCK_INFO::prev

Definition at line 87 of file common.h.

struct _PROVIDER* _SOCK_INFO::Provider

Definition at line 54 of file provider.h.

SOCKET _SOCK_INFO::ProviderSocket

Definition at line 38 of file provider.h.

DATA_BUFFER _SOCK_INFO::recdData

Definition at line 89 of file common.h.

volatile LONG _SOCK_INFO::RefCount

Definition at line 43 of file provider.h.

SOCKET _SOCK_INFO::sock

Definition at line 85 of file common.h.

CRITICAL_SECTION _SOCK_INFO::SockCritSec

Definition at line 52 of file provider.h.

UINT _SOCK_INFO::uMsg

Definition at line 50 of file provider.h.

The documentation for this struct was generated from the following files:
  • NetDS/WinSock/Accept/common.h
  • NetDS/WinSock/LSP/provider.h
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _socklist Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_socklist Struct Reference

List of all members.

Public Attributes

char | Buffer [128]
WSABUF | DataBuf
WSAOVERLAPPED * | overlap
SOCKET | sock

Detailed Description

Definition at line 49 of file Overlap.c.

Member Data Documentation

char _socklist::Buffer[128]

Definition at line 53 of file Overlap.c.

WSABUF _socklist::DataBuf

Definition at line 54 of file Overlap.c.

WSAOVERLAPPED* _socklist::overlap

Definition at line 52 of file Overlap.c.

SOCKET _socklist::sock

Definition at line 51 of file Overlap.c.

The documentation for this struct was generated from the following file:
  • NetDS/WinSock/Overlap/Overlap.c
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _SP_OPTIONS Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_SP_OPTIONS Struct Reference

#include "QosEvent.h"

List of all members.

Public Attributes

BOOL bMulticast
BOOL bQos
int iProtocol

Detailed Description

Definition at line 45 of file QosEvent.h.

Member Data Documentation

BOOL _SP_OPTIONS::bMulticast

Definition at line 49 of file QosEvent.h.

BOOL _SP_OPTIONS::bQos

Definition at line 48 of file QosEvent.h.

int _SP_OPTIONS::iProtocol

Definition at line 47 of file QosEvent.h.

The documentation for this struct was generated from the following file:
  • NetDS/GQos/QosEvent/QosEvent.h
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _STANDARDSECINMEM Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_STANDARDSECINMEM Struct Reference

#include "suminfo.h"

List of all members.

Public Attributes

DWORD cBytes
DWORD cProperties
INTS | rgInts [MAXINTS]
LPSTDZ | rglpsz [MAXSTDZ]
PROPIDLIST | rgPropId [cPIDSI_STANDARD]
TIME | rgTime [MAXTIME]
THUMB thumb

Detailed Description

Definition at line 184 of file suminfo.h.

Member Data Documentation

DWORD _STANDARDSECINMEM::cBytes

Definition at line 186 of file suminfo.h.

DWORD _STANDARDSECINMEM::cProperties

Definition at line 187 of file suminfo.h.

INTS _STANDARDSECINMEM::rgInts[MAXINTS]

Definition at line 190 of file suminfo.h.

LPSTDZ _STANDARDSECINMEM::rglpsz[MAXSTDZ]

Definition at line 191 of file suminfo.h.

PROPIDLIST _STANDARDSECINMEM::rgPropId[cPIDSI_STANDARD]

Definition at line 188 of file suminfo.h.

TIME _STANDARDSECINMEM::rgTime[MAXTIME]

Definition at line 189 of file suminfo.h.

THUMB _STANDARDSECINMEM::thumb

Definition at line 192 of file suminfo.h.

The documentation for this struct was generated from the following file:
  • Com/Fundamentals/OleStd/suminfo.h
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _STDZ Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_STDZ Struct Reference

#include "suminfo.h"

List of all members.

Public Attributes

union {
OLECHAR fill [4]
DWORD vtByteCount
};
OLECHAR rgchars [MAXWORD]
DWORD vtType

Detailed Description

Definition at line 136 of file suminfo.h.

Member Data Documentation

union { ... }
OLECHAR _STDZ::fill[4]

Definition at line 141 of file suminfo.h.

OLECHAR _STDZ::rgchars[MAXWORD]

Definition at line 143 of file suminfo.h.

DWORD _STDZ::vtByteCount

Definition at line 140 of file suminfo.h.

DWORD _STDZ::vtType

Definition at line 138 of file suminfo.h.

The documentation for this struct was generated from the following file:
  • Com/Fundamentals/OleStd/suminfo.h
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _STREAM_FIND_DATA Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_STREAM_FIND_DATA Struct Reference

#include "FindStream.h"

List of all members.

Public Attributes

TCHAR | cStreamName [MAX_PATH]
LARGE_INTEGER | Size

Detailed Description

Definition at line 19 of file FindStream.h.

Member Data Documentation

TCHAR _STREAM_FIND_DATA::cStreamName[MAX_PATH]

Definition at line 22 of file FindStream.h.

LARGE_INTEGER _STREAM_FIND_DATA::Size

Definition at line 21 of file FindStream.h.

The documentation for this struct was generated from the following file:
  • WinBase/IO/EnumStreams/FindStream.h
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _stringstruct Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_stringstruct Struct Reference

List of all members.

Public Attributes

short | cSize
char * | pszStr

Detailed Description

Definition at line 39 of file dialogs.c.

Member Data Documentation

short _stringstruct::cSize

Definition at line 42 of file dialogs.c.

char* _stringstruct::pszStr

Definition at line 41 of file dialogs.c.

The documentation for this struct was generated from the following file:
  • Multimedia/Gdi/PrintJob/dialogs.c
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _SUMMARYINFO Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_SUMMARYINFO Struct Reference

#include "suminfo.h"

List of all members.

Public Attributes

WORD | byteOrder
CLSID classId
DWORD cSections
WORD | formatVersion
WORD | getOSVersion
WORD | osVersion
PROPSETLIST | rgPropSet [1]
SECTION | rgSections [1]

Detailed Description

Definition at line 114 of file suminfo.h.

Member Data Documentation

WORD _SUMMARYINFO::byteOrder

Definition at line 116 of file suminfo.h.

CLSID _SUMMARYINFO::classId

Definition at line 120 of file suminfo.h.

DWORD _SUMMARYINFO::cSections

Definition at line 121 of file suminfo.h.

WORD _SUMMARYINFO::formatVersion

Definition at line 117 of file suminfo.h.

WORD _SUMMARYINFO::getOSVersion

Definition at line 118 of file suminfo.h.

WORD _SUMMARYINFO::osVersion

Definition at line 119 of file suminfo.h.

PROPSETLIST _SUMMARYINFO::rgPropSet[1]

Definition at line 122 of file suminfo.h.

SECTION _SUMMARYINFO::rgSections[1]

Definition at line 123 of file suminfo.h.

The documentation for this struct was generated from the following file:
  • Com/Fundamentals/OleStd/suminfo.h
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _SynchInfo Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_SynchInfo Struct Reference

List of all members.

Public Attributes

HWND | hWndSynch
WNDPROC | wpProc

Detailed Description

Definition at line 2674 of file common.cpp.

Member Data Documentation

HWND _SynchInfo::hWndSynch

Definition at line 2677 of file common.cpp.

WNDPROC _SynchInfo::wpProc

Definition at line 2676 of file common.cpp.

The documentation for this struct was generated from the following file:
  • Dataaccess/oledb/rowsetviewer/common.cpp
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _tag_MMC_VERSION_INFO Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_tag_MMC_VERSION_INFO Struct Reference

#include "globals.h"

List of all members.

Public Attributes

long | nMajor
long | nMinor

Detailed Description

Definition at line 31 of file globals.h.

Member Data Documentation

long _tag_MMC_VERSION_INFO::nMajor

Definition at line 33 of file globals.h.

long _tag_MMC_VERSION_INFO::nMinor

Definition at line 34 of file globals.h.

The documentation for this struct was generated from the following file:
  • SysMgmt/MMC/mmc2.0/dragdrop/globals.h
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _tag_NODE_ATTRIB_ Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_tag_NODE_ATTRIB_ Struct Reference

#include "globals.h"

List of all members.

Public Attributes

WCHAR szObjectPath [MAX_OBJECT_PATH]

Detailed Description

Definition at line 95 of file globals.h.

Member Data Documentation

WCHAR _tag_NODE_ATTRIB_::szObjectPath

Definition at line 97 of file globals.h.

The documentation for this struct was generated from the following files:
  • SysMgmt/MMC/mmc2.0/proppage/globals.h
  • SysMgmt/MMC/mmc2.0/proppagex/globals.h
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _tagCol Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_tagCol Struct Reference

#include "Global.h"

List of all members.

Public Attributes

UINT dwWidth
LPTSTR lpsz

Detailed Description

Definition at line 42 of file Main.Cpp.

Member Data Documentation

UINT _tagCol::dwWidth

Definition at line 43 of file Main.Cpp.

LPTSTR _tagCol::lpsz

Definition at line 44 of file Main.Cpp.

The documentation for this struct was generated from the following files:
  • Web/NetMeeting/NMChat/Main.Cpp
  • Web/NetMeeting/NMShare/Main.Cpp
  • Web/NetMeeting/NMUI/Global.h
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _tagCONFIGITEMLISTVIEWLPARAM Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_tagCONFIGITEMLISTVIEWLPARAM Struct Reference

#include "Settings.h"

List of all members.

Public Attributes

SYNCMGRITEMID ItemID

Detailed Description

Definition at line 79 of file Settings.h.

Member Data Documentation

SYNCMGRITEMID _tagCONFIGITEMLISTVIEWLPARAM::ItemID

Definition at line 81 of file Settings.h.

The documentation for this struct was generated from the following file:
  • NetDS/SyncMgr/SyncDir/Settings.h
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _tagCONFIGSETTINGSLPARAM Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_tagCONFIGSETTINGSLPARAM Struct Reference

#include "Settings.h"

List of all members.

Public Attributes

HRESULT hr
CSettings * pSettings

Detailed Description

Definition at line 59 of file Settings.h.

Member Data Documentation

HRESULT _tagCONFIGSETTINGSLPARAM::hr

Definition at line 62 of file Settings.h.

CSettings* _tagCONFIGSETTINGSLPARAM::pSettings

Definition at line 61 of file Settings.h.

The documentation for this struct was generated from the following file:
  • NetDS/SyncMgr/SyncDir/Settings.h
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _tagDELETELOGERRORMSG Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_tagDELETELOGERRORMSG Struct Reference

#include "Handler.h"

List of all members.

Public Attributes

DWORD dwReserved
SYNCMGRERRORID ErrorID

Detailed Description

Definition at line 252 of file Handler.h.

Member Data Documentation

DWORD _tagDELETELOGERRORMSG::dwReserved

Definition at line 255 of file Handler.h.

SYNCMGRERRORID _tagDELETELOGERRORMSG::ErrorID

Definition at line 254 of file Handler.h.

The documentation for this struct was generated from the following file:
  • NetDS/SyncMgr/SyncDir/Handler.h
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _tagENABLEMODELESSMSG Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_tagENABLEMODELESSMSG Struct Reference

#include "Handler.h"

List of all members.

Public Attributes

BOOL fEnable

Detailed Description

Definition at line 239 of file Handler.h.

Member Data Documentation

BOOL _tagENABLEMODELESSMSG::fEnable

Definition at line 241 of file Handler.h.

The documentation for this struct was generated from the following file:
  • NetDS/SyncMgr/SyncDir/Handler.h
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _tagESTABLISHCONNECTIONMSG Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_tagESTABLISHCONNECTIONMSG Struct Reference

#include "Handler.h"

List of all members.

Public Attributes

DWORD dwReserved
WCHAR const * lpwszConnection

Detailed Description

Definition at line 258 of file Handler.h.

Member Data Documentation

DWORD _tagESTABLISHCONNECTIONMSG::dwReserved

Definition at line 261 of file Handler.h.

WCHAR const* _tagESTABLISHCONNECTIONMSG::lpwszConnection

Definition at line 260 of file Handler.h.

The documentation for this struct was generated from the following file:
  • NetDS/SyncMgr/SyncDir/Handler.h
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _tagFILEOBJECT Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_tagFILEOBJECT Struct Reference

#include "Handler.h"

List of all members.

Public Attributes

BOOL fDirectory
BOOL fLastUpdateValid
TCHAR fName [MAX_PATH]
FILETIME ftLastUpdate
GENERICITEM genericItem
LPGENERICITEMLIST pChildList

Detailed Description

Definition at line 30 of file Handler.h.

Member Data Documentation

BOOL _tagFILEOBJECT::fDirectory

Definition at line 34 of file Handler.h.

BOOL _tagFILEOBJECT::fLastUpdateValid

Definition at line 35 of file Handler.h.

TCHAR _tagFILEOBJECT::fName[MAX_PATH]

Definition at line 33 of file Handler.h.

FILETIME _tagFILEOBJECT::ftLastUpdate

Definition at line 36 of file Handler.h.

GENERICITEM _tagFILEOBJECT::genericItem

Definition at line 32 of file Handler.h.

LPGENERICITEMLIST _tagFILEOBJECT::pChildList

Definition at line 37 of file Handler.h.

The documentation for this struct was generated from the following file:
  • NetDS/SyncMgr/SyncDir/Handler.h
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _tagGENERICITEM Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_tagGENERICITEM Struct Reference

#include "Enum.h"

List of all members.

Public Attributes

DWORD cbSize
_tagGENERICITEM * pNextGenericItem

Detailed Description

Definition at line 19 of file Enum.h.

Member Data Documentation

DWORD _tagGENERICITEM::cbSize

Definition at line 21 of file Enum.h.

_tagGENERICITEM* _tagGENERICITEM::pNextGenericItem

Definition at line 22 of file Enum.h.

The documentation for this struct was generated from the following file:
  • NetDS/SyncMgr/SyncDir/Enum.h
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _tagGENERICITEMLIST Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_tagGENERICITEMLIST Struct Reference

#include "Enum.h"

List of all members.

Public Attributes

DWORD _cRefs
DWORD dwNumItems
LPGENERICITEM pFirstGenericItem

Detailed Description

Definition at line 28 of file Enum.h.

Member Data Documentation

DWORD _tagGENERICITEMLIST::_cRefs

Definition at line 30 of file Enum.h.

DWORD _tagGENERICITEMLIST::dwNumItems

Definition at line 31 of file Enum.h.

LPGENERICITEM _tagGENERICITEMLIST::pFirstGenericItem

Definition at line 32 of file Enum.h.

The documentation for this struct was generated from the following file:
  • NetDS/SyncMgr/SyncDir/Enum.h
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _tagHANDLERITEM_SYNCSTATUS Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_tagHANDLERITEM_SYNCSTATUS Struct Reference

#include "Handler.h"

List of all members.

Public Attributes

DWORD dwSyncMgrResultStatus
BOOL fCancelled
BOOL fSynchronizeComplete
BOOL fSynchronizing
BOOL fUnresolvedConflicts
GENERICITEM genericItem
SYNCMGRITEMID ItemID

Detailed Description

Definition at line 16 of file Handler.h.

Member Data Documentation

DWORD _tagHANDLERITEM_SYNCSTATUS::dwSyncMgrResultStatus

Definition at line 24 of file Handler.h.

BOOL _tagHANDLERITEM_SYNCSTATUS::fCancelled

Definition at line 20 of file Handler.h.

BOOL _tagHANDLERITEM_SYNCSTATUS::fSynchronizeComplete

Definition at line 22 of file Handler.h.

BOOL _tagHANDLERITEM_SYNCSTATUS::fSynchronizing

Definition at line 21 of file Handler.h.

BOOL _tagHANDLERITEM_SYNCSTATUS::fUnresolvedConflicts

Definition at line 23 of file Handler.h.

GENERICITEM _tagHANDLERITEM_SYNCSTATUS::genericItem

Definition at line 18 of file Handler.h.

SYNCMGRITEMID _tagHANDLERITEM_SYNCSTATUS::ItemID

Definition at line 19 of file Handler.h.

The documentation for this struct was generated from the following file:
  • NetDS/SyncMgr/SyncDir/Handler.h
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _tagHANDLERITEMSETTINGS Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_tagHANDLERITEMSETTINGS Struct Reference

#include "Settings.h"

List of all members.

Public Attributes

TCHAR | dir1 [MAX_PATH]
TCHAR | dir2 [MAX_PATH]
BOOL fRecursive
FILETIME ft
GUID | ItemID
TCHAR | szItemName [MAX_SYNCMGRITEMNAME]

Detailed Description

Definition at line 20 of file Settings.h.

Member Data Documentation

TCHAR _tagHANDLERITEMSETTINGS::dir1[MAX_PATH]

Definition at line 25 of file Settings.h.

TCHAR _tagHANDLERITEMSETTINGS::dir2[MAX_PATH]

Definition at line 26 of file Settings.h.

BOOL _tagHANDLERITEMSETTINGS::fRecursive

Definition at line 27 of file Settings.h.

FILETIME _tagHANDLERITEMSETTINGS::ft

Definition at line 28 of file Settings.h.

GUID _tagHANDLERITEMSETTINGS::ItemID

Definition at line 23 of file Settings.h.

TCHAR _tagHANDLERITEMSETTINGS::szItemName[MAX_SYNCMGRITEMNAME]

Definition at line 24 of file Settings.h.

The documentation for this struct was generated from the following file:
  • NetDS/SyncMgr/SyncDir/Settings.h
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _tagITEMCONFIGSETTINGSLPARAM Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_tagITEMCONFIGSETTINGSLPARAM Struct Reference

#include "Settings.h"

List of all members.

Public Attributes

BOOL fDirty
BOOL fNewItem
HRESULT | hr
SYNCMGRITEMID | ItemID
LPSAMPLEITEMSETTINGS pItemSettings
CSettings * pSettings

Detailed Description

Definition at line 66 of file Settings.h.

Member Data Documentation

BOOL _tagITEMCONFIGSETTINGSLPARAM::fDirty

Definition at line 75 of file Settings.h.

BOOL _tagITEMCONFIGSETTINGSLPARAM::fNewItem

Definition at line 69 of file Settings.h.

HRESULT _tagITEMCONFIGSETTINGSLPARAM::hr

Definition at line 72 of file Settings.h.

SYNCMGRITEMID _tagITEMCONFIGSETTINGSLPARAM::ItemID

Definition at line 70 of file Settings.h.

LPSAMPLEITEMSETTINGS _tagITEMCONFIGSETTINGSLPARAM::pItemSettings

Definition at line 71 of file Settings.h.

CSettings* _tagITEMCONFIGSETTINGSLPARAM::pSettings

Definition at line 68 of file Settings.h.

The documentation for this struct was generated from the following file:
  • NetDS/SyncMgr/SyncDir/Settings.h
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _tagLISTPROP Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_tagLISTPROP Struct Reference

List of all members.

Public Attributes

LPBYTE lpbyBuf

Detailed Description

Definition at line 160 of file keys.cpp.

Member Data Documentation

LPBYTE _tagLISTPROP::lpbyBuf

Definition at line 161 of file keys.cpp.

The documentation for this struct was generated from the following file:
  • Web/iis/extensions/Formdump/keys.cpp
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _tagLOGERRORMSG Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_tagLOGERRORMSG Struct Reference

#include "Handler.h"

List of all members.

Public Attributes

DWORD dwErrorLevel
const WCHAR * | lpcErrorText
LPSYNCMGRLOGERRORINFO | lpSyncLogError

Detailed Description

Definition at line 244 of file Handler.h.

Member Data Documentation

DWORD _tagLOGERRORMSG::dwErrorLevel

Definition at line 246 of file Handler.h.

const WCHAR* _tagLOGERRORMSG::lpcErrorText

Definition at line 247 of file Handler.h.

LPSYNCMGRLOGERRORINFO _tagLOGERRORMSG::lpSyncLogError

Definition at line 248 of file Handler.h.

The documentation for this struct was generated from the following file:
  • NetDS/SyncMgr/SyncDir/Handler.h
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _tagLogon Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_tagLogon Struct Reference

List of all members.

Public Attributes

HANDLE hImpToken
HANDLE hLogon
PSECURITY_DESCRIPTOR | psdCreator
WCHAR | szDomain [MAX_NAME]
WCHAR | szUsername [MAX_NAME]

Detailed Description

Definition at line 40 of file Security.Cpp.

Member Data Documentation

HANDLE _tagLogon::hImpToken

Definition at line 42 of file Security.Cpp.

HANDLE _tagLogon::hLogon

Definition at line 41 of file Security.Cpp.

PSECURITY_DESCRIPTOR _tagLogon::psdCreator

Definition at line 45 of file Security.Cpp.

WCHAR _tagLogon::szDomain[MAX_NAME]

Definition at line 44 of file Security.Cpp.

WCHAR _tagLogon::szUsername[MAX_NAME]

Definition at line 43 of file Security.Cpp.

The documentation for this struct was generated from the following file:
  • Security/Authorization/SecurObj/Security.Cpp
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _tagMETHODARGS Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_tagMETHODARGS Struct Reference

#include "Handler.h"

List of all members.

Public Attributes

union {
DELETELOGERRORMSG DeleteLogErrorMsg
ENABLEMODELESSMSG EnableModelessMsg
ESTABLISHCONNECTIONMSG EstablishConnectionMsg
LOGERRORMSG LogErrorMsg
PREPAREFORSYNCCOMPLETEDMSG PrepareForSyncCompletedMsg
PREPAREFORSYNCMSG PrepareForSyncMsg
PROGRESSMSG ProgressMsg
SHOWERRORCOMPLETEDMSG ShowErrorCompletedMsg
SHOWERRORMSG ShowErrorMsg
SHOWPROPERTIESCOMPLETEDMSG ShowPropertiesCompletedMsg
SHOWPROPERTIESMSG ShowPropertiesMsg
SYNCHRONIZECOMPLETEDMSG SynchronizeCompletedMsg
SYNCHRONIZEMSG SynchronizeMsg
};
DWORD dwWorkerMsg
BOOL fAsync
HRESULT hr

Detailed Description

Definition at line 264 of file Handler.h.

Member Data Documentation

union { ... }
DELETELOGERRORMSG _tagMETHODARGS::DeleteLogErrorMsg

Definition at line 283 of file Handler.h.

DWORD _tagMETHODARGS::dwWorkerMsg

Definition at line 266 of file Handler.h.

ENABLEMODELESSMSG _tagMETHODARGS::EnableModelessMsg

Definition at line 281 of file Handler.h.

ESTABLISHCONNECTIONMSG _tagMETHODARGS::EstablishConnectionMsg

Definition at line 284 of file Handler.h.

BOOL _tagMETHODARGS::fAsync

Definition at line 267 of file Handler.h.

HRESULT _tagMETHODARGS::hr

Definition at line 268 of file Handler.h.

LOGERRORMSG _tagMETHODARGS::LogErrorMsg

Definition at line 282 of file Handler.h.

PREPAREFORSYNCCOMPLETEDMSG _tagMETHODARGS::PrepareForSyncCompletedMsg

Definition at line 277 of file Handler.h.

PREPAREFORSYNCMSG _tagMETHODARGS::PrepareForSyncMsg

Definition at line 271 of file Handler.h.

PROGRESSMSG _tagMETHODARGS::ProgressMsg

Definition at line 276 of file Handler.h.

SHOWERRORCOMPLETEDMSG _tagMETHODARGS::ShowErrorCompletedMsg

Definition at line 280 of file Handler.h.

SHOWERRORMSG _tagMETHODARGS::ShowErrorMsg

Definition at line 274 of file Handler.h.

SHOWPROPERTIESCOMPLETEDMSG _tagMETHODARGS::ShowPropertiesCompletedMsg

Definition at line 279 of file Handler.h.

SHOWPROPERTIESMSG _tagMETHODARGS::ShowPropertiesMsg

Definition at line 273 of file Handler.h.

SYNCHRONIZECOMPLETEDMSG _tagMETHODARGS::SynchronizeCompletedMsg

Definition at line 278 of file Handler.h.

SYNCHRONIZEMSG _tagMETHODARGS::SynchronizeMsg

Definition at line 272 of file Handler.h.

The documentation for this struct was generated from the following file:
  • NetDS/SyncMgr/SyncDir/Handler.h
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _tagPOSDATA Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_tagPOSDATA Struct Reference

List of all members.

Public Attributes

int(* | GetInboundByte )(struct _tagPOSDATA *p)
int | nAllocLength
int | nBufferLength
int | nBufferPos
int | nCurrentPos
LPBYTE | pData
EXTENSION_CONTROL_BLOCK * | pECB

Detailed Description

Definition at line 135 of file keys.cpp.

Member Data Documentation

int(* _tagPOSDATA::GetInboundByte)(struct _tagPOSDATA *p)

Definition at line 149 of file keys.cpp.

int _tagPOSDATA::nAllocLength

Definition at line 145 of file keys.cpp.

int _tagPOSDATA::nBufferLength

Definition at line 141 of file keys.cpp.

int _tagPOSDATA::nBufferPos

Definition at line 143 of file keys.cpp.

int _tagPOSDATA::nCurrentPos

Definition at line 139 of file keys.cpp.

LPBYTE _tagPOSDATA::pData

Definition at line 147 of file keys.cpp.

EXTENSION_CONTROL_BLOCK* _tagPOSDATA::pECB

Definition at line 137 of file keys.cpp.

The documentation for this struct was generated from the following file:
  • Web/iis/extensions/Formdump/keys.cpp
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _tagPOSTKEY Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_tagPOSTKEY Struct Reference

List of all members.

Public Attributes

BOOL bHasCtrlChars
DWORD dwLength
DWORD dwOffset
LPBYTE | lpbyBuf
int | nInstance
struct _tagPOSTKEY * | pHead
struct _tagPOSTKEY * | pNext

Detailed Description

Definition at line 520 of file keys.cpp.

Member Data Documentation

BOOL _tagPOSTKEY::bHasCtrlChars

Definition at line 526 of file keys.cpp.

DWORD _tagPOSTKEY::dwLength

Definition at line 525 of file keys.cpp.

DWORD _tagPOSTKEY::dwOffset

Definition at line 524 of file keys.cpp.

LPBYTE _tagPOSTKEY::lpbyBuf

Definition at line 529 of file keys.cpp.

int _tagPOSTKEY::nInstance

Definition at line 521 of file keys.cpp.

struct _tagPOSTKEY* _tagPOSTKEY::pHead

Definition at line 528 of file keys.cpp.

struct _tagPOSTKEY* _tagPOSTKEY::pNext

Definition at line 527 of file keys.cpp.

The documentation for this struct was generated from the following file:
  • Web/iis/extensions/Formdump/keys.cpp
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _tagPREPAREFORSYNCCOMPLETEDMSG Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_tagPREPAREFORSYNCCOMPLETEDMSG Struct Reference

#include "Handler.h"

List of all members.

Public Attributes

HRESULT hr

Detailed Description

Definition at line 217 of file Handler.h.

Member Data Documentation

HRESULT _tagPREPAREFORSYNCCOMPLETEDMSG::hr

Definition at line 219 of file Handler.h.

The documentation for this struct was generated from the following file:
  • NetDS/SyncMgr/SyncDir/Handler.h
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _tagPREPAREFORSYNCMSG Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_tagPREPAREFORSYNCMSG Struct Reference

#include "Handler.h"

List of all members.

Public Attributes

ULONG cbNumItems
DWORD dwReserved
HWND | hWndParent
SYNCMGRITEMID * | pItemIDs

Detailed Description

Definition at line 186 of file Handler.h.

Member Data Documentation

ULONG _tagPREPAREFORSYNCMSG::cbNumItems

Definition at line 188 of file Handler.h.

DWORD _tagPREPAREFORSYNCMSG::dwReserved

Definition at line 190 of file Handler.h.

HWND _tagPREPAREFORSYNCMSG::hWndParent

Definition at line 189 of file Handler.h.

SYNCMGRITEMID* _tagPREPAREFORSYNCMSG::pItemIDs

Definition at line 191 of file Handler.h.

The documentation for this struct was generated from the following file:
  • NetDS/SyncMgr/SyncDir/Handler.h
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _tagPROGRESSMSG Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_tagPROGRESSMSG Struct Reference

#include "Handler.h"

List of all members.

Public Attributes

SYNCMGRITEMID | ItemID
LPSYNCMGRPROGRESSITEM | lpSyncProgressItem

Detailed Description

Definition at line 211 of file Handler.h.

Member Data Documentation

SYNCMGRITEMID _tagPROGRESSMSG::ItemID

Definition at line 213 of file Handler.h.

LPSYNCMGRPROGRESSITEM _tagPROGRESSMSG::lpSyncProgressItem

Definition at line 214 of file Handler.h.

The documentation for this struct was generated from the following file:
  • NetDS/SyncMgr/SyncDir/Handler.h
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _tagPROPSTRUCT Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_tagPROPSTRUCT Struct Reference

#include "utilprop.h"

List of all members.

Public Attributes

BOOL boolVal
DBPROPFLAGS | dwFlags
DBPROPID | dwPropertyID
SLONG longVal
PWSTR pwstrDescBuffer
PWSTR pwstrVal
VARTYPE | vtType

Detailed Description

Definition at line 18 of file utilprop.h.

Member Data Documentation

BOOL _tagPROPSTRUCT::boolVal

Definition at line 23 of file utilprop.h.

DBPROPFLAGS _tagPROPSTRUCT::dwFlags

Definition at line 21 of file utilprop.h.

DBPROPID _tagPROPSTRUCT::dwPropertyID

Definition at line 20 of file utilprop.h.

SLONG _tagPROPSTRUCT::longVal

Definition at line 27 of file utilprop.h.

PWSTR _tagPROPSTRUCT::pwstrDescBuffer

Definition at line 30 of file utilprop.h.

PWSTR _tagPROPSTRUCT::pwstrVal

Definition at line 29 of file utilprop.h.

VARTYPE _tagPROPSTRUCT::vtType

Definition at line 22 of file utilprop.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/oledb/sampprov/utilprop.h
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _tagSAMPLEITEMSETTINGS Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_tagSAMPLEITEMSETTINGS Struct Reference

#include "Settings.h"

List of all members.

Public Attributes

TCHAR | dir1 [MAX_PATH]
TCHAR | dir2 [MAX_PATH]
BOOL fRecursive
BOOL fSyncLock
GENERICITEM genericItem
CSyncMgrHandler * pLockHandler
SYNCMGRITEM | syncmgrItem

Detailed Description

Definition at line 39 of file Settings.h.

Member Data Documentation

TCHAR _tagSAMPLEITEMSETTINGS::dir1[MAX_PATH]

Definition at line 45 of file Settings.h.

TCHAR _tagSAMPLEITEMSETTINGS::dir2[MAX_PATH]

Definition at line 46 of file Settings.h.

BOOL _tagSAMPLEITEMSETTINGS::fRecursive

Definition at line 47 of file Settings.h.

BOOL _tagSAMPLEITEMSETTINGS::fSyncLock

Definition at line 49 of file Settings.h.

GENERICITEM _tagSAMPLEITEMSETTINGS::genericItem

Definition at line 41 of file Settings.h.

CSyncMgrHandler* _tagSAMPLEITEMSETTINGS::pLockHandler

Definition at line 50 of file Settings.h.

SYNCMGRITEM _tagSAMPLEITEMSETTINGS::syncmgrItem

Definition at line 42 of file Settings.h.

The documentation for this struct was generated from the following file:
  • NetDS/SyncMgr/SyncDir/Settings.h
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _tagSHOWERRORCOMPLETEDMSG Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_tagSHOWERRORCOMPLETEDMSG Struct Reference

#include "Handler.h"

List of all members.

Public Attributes

ULONG cbNumItems
HRESULT | hr
SYNCMGRITEMID * | pItemIDs

Detailed Description

Definition at line 232 of file Handler.h.

Member Data Documentation

ULONG _tagSHOWERRORCOMPLETEDMSG::cbNumItems

Definition at line 235 of file Handler.h.

HRESULT _tagSHOWERRORCOMPLETEDMSG::hr

Definition at line 234 of file Handler.h.

SYNCMGRITEMID* _tagSHOWERRORCOMPLETEDMSG::pItemIDs

Definition at line 236 of file Handler.h.

The documentation for this struct was generated from the following file:
  • NetDS/SyncMgr/SyncDir/Handler.h
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _tagSHOWERRORMSG Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_tagSHOWERRORMSG Struct Reference

#include "Handler.h"

List of all members.

Public Attributes

SYNCMGRERRORID | ErrorID
HWND | hWndParent

Detailed Description

Definition at line 205 of file Handler.h.

Member Data Documentation

SYNCMGRERRORID _tagSHOWERRORMSG::ErrorID

Definition at line 208 of file Handler.h.

HWND _tagSHOWERRORMSG::hWndParent

Definition at line 207 of file Handler.h.

The documentation for this struct was generated from the following file:
  • NetDS/SyncMgr/SyncDir/Handler.h
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _tagSHOWPROPERTIESCOMPLETEDMSG Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_tagSHOWPROPERTIESCOMPLETEDMSG Struct Reference

#include "Handler.h"

List of all members.

Public Attributes

HRESULT hr

Detailed Description

Definition at line 227 of file Handler.h.

Member Data Documentation

HRESULT _tagSHOWPROPERTIESCOMPLETEDMSG::hr

Definition at line 229 of file Handler.h.

The documentation for this struct was generated from the following file:
  • NetDS/SyncMgr/SyncDir/Handler.h
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _tagSHOWPROPERTIESMSG Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_tagSHOWPROPERTIESMSG Struct Reference

#include "Handler.h"

List of all members.

Public Attributes

HWND | hWndParent
SYNCMGRITEMID | ItemID

Detailed Description

Definition at line 199 of file Handler.h.

Member Data Documentation

HWND _tagSHOWPROPERTIESMSG::hWndParent

Definition at line 201 of file Handler.h.

SYNCMGRITEMID _tagSHOWPROPERTIESMSG::ItemID

Definition at line 202 of file Handler.h.

The documentation for this struct was generated from the following file:
  • NetDS/SyncMgr/SyncDir/Handler.h
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _tagStatus Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_tagStatus Struct Reference

List of all members.

Public Attributes

HWND | hwnd
int | iGiveWidth
int | iMaxWidth
int | iMinWidth

Detailed Description

Definition at line 22 of file Status.c.

Member Data Documentation

HWND _tagStatus::hwnd

Definition at line 23 of file Status.c.

int _tagStatus::iGiveWidth

Definition at line 24 of file Status.c.

int _tagStatus::iMaxWidth

Definition at line 24 of file Status.c.

int _tagStatus::iMinWidth

Definition at line 24 of file Status.c.

The documentation for this struct was generated from the following file:
  • Multimedia/Gdi/Fonts/FontView/Status.c
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _tagSYNCHRONIZECOMPLETEDMSG Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_tagSYNCHRONIZECOMPLETEDMSG Struct Reference

#include "Handler.h"

List of all members.

Public Attributes

HRESULT hr

Detailed Description

Definition at line 222 of file Handler.h.

Member Data Documentation

HRESULT _tagSYNCHRONIZECOMPLETEDMSG::hr

Definition at line 224 of file Handler.h.

The documentation for this struct was generated from the following file:
  • NetDS/SyncMgr/SyncDir/Handler.h
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _tagSYNCHRONIZEMSG Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_tagSYNCHRONIZEMSG Struct Reference

#include "Handler.h"

List of all members.

Public Attributes

HWND hWndParent

Detailed Description

Definition at line 194 of file Handler.h.

Member Data Documentation

HWND _tagSYNCHRONIZEMSG::hWndParent

Definition at line 196 of file Handler.h.

The documentation for this struct was generated from the following file:
  • NetDS/SyncMgr/SyncDir/Handler.h
Generated on Wed Nov 13 2024 16:55:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _tagTools Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_tagTools Struct Reference

List of all members.

Public Attributes

HICON | hIcon
HWND | hwnd
int | iHeight
int | iWidth
WORD | wType

Detailed Description

Definition at line 34 of file Tools.c.

Member Data Documentation

HICON _tagTools::hIcon

Definition at line 38 of file Tools.c.

HWND _tagTools::hwnd

Definition at line 35 of file Tools.c.

int _tagTools::iHeight

Definition at line 37 of file Tools.c.

int _tagTools::iWidth

Definition at line 37 of file Tools.c.

WORD _tagTools::wType

Definition at line 36 of file Tools.c.

The documentation for this struct was generated from the following file:
  • Multimedia/Gdi/Fonts/FontView/Tools.c
Generated on Wed Nov 13 2024 16:55:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _tagWorkerThreadArgs Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_tagWorkerThreadArgs Struct Reference

#include "Handler.h"

List of all members.

Public Attributes

HANDLE hEvent
HRESULT | hr
HWND | hwnd
CSyncMgrHandler * pThis

Detailed Description

Definition at line 175 of file Handler.h.

Member Data Documentation

HANDLE _tagWorkerThreadArgs::hEvent

Definition at line 177 of file Handler.h.

HRESULT _tagWorkerThreadArgs::hr

Definition at line 180 of file Handler.h.

HWND _tagWorkerThreadArgs::hwnd

Definition at line 179 of file Handler.h.

CSyncMgrHandler* _tagWorkerThreadArgs::pThis

Definition at line 178 of file Handler.h.

The documentation for this struct was generated from the following file:
  • NetDS/SyncMgr/SyncDir/Handler.h
Generated on Wed Nov 13 2024 16:55:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _threadparameters Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_threadparameters Struct Reference

List of all members.

Public Attributes

HANDLE hPrevThread
HANDLE hPrinter
HWND hWnd

Detailed Description

Definition at line 55 of file threads.c.

Member Data Documentation

HANDLE _threadparameters::hPrevThread

Definition at line 59 of file threads.c.

HANDLE _threadparameters::hPrinter

Definition at line 58 of file threads.c.

HWND _threadparameters::hWnd

Definition at line 57 of file threads.c.

The documentation for this struct was generated from the following file:
  • Multimedia/Gdi/PrintJob/threads.c
Generated on Wed Nov 13 2024 16:55:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _THUMB Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_THUMB Struct Reference

#include "suminfo.h"

List of all members.

Public Attributes

DWORD cBytes
DWORD clipFormat
LPOLESTR lpByte
LPOLESTR lpstzName
DWORD selector
DWORD vtType

Detailed Description

Definition at line 147 of file suminfo.h.

Member Data Documentation

DWORD _THUMB::cBytes

Definition at line 150 of file suminfo.h.

DWORD _THUMB::clipFormat

Definition at line 152 of file suminfo.h.

LPOLESTR _THUMB::lpByte

Definition at line 154 of file suminfo.h.

LPOLESTR _THUMB::lpstzName

Definition at line 153 of file suminfo.h.

DWORD _THUMB::selector

Definition at line 151 of file suminfo.h.

DWORD _THUMB::vtType

Definition at line 149 of file suminfo.h.

The documentation for this struct was generated from the following file:
  • Com/Fundamentals/OleStd/suminfo.h
Generated on Wed Nov 13 2024 16:55:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _TIME Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_TIME Struct Reference

#include "suminfo.h"

List of all members.

Public Attributes

FILETIME time
DWORD vtType

Detailed Description

Definition at line 168 of file suminfo.h.

Member Data Documentation

FILETIME _TIME::time

Definition at line 171 of file suminfo.h.

DWORD _TIME::vtType

Definition at line 170 of file suminfo.h.

The documentation for this struct was generated from the following file:
  • Com/Fundamentals/OleStd/suminfo.h
Generated on Wed Nov 13 2024 16:55:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _TRANSMITFILEARGS Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_TRANSMITFILEARGS Struct Reference

#include "provider.h"

List of all members.

Public Attributes

DWORD dwFlags
HANDLE hFile
LPTRANSMIT_FILE_BUFFERS lpTransmitBuffers
DWORD nNumberOfBytesPerSend
DWORD nNumberOfBytesToWrite

Detailed Description

Definition at line 108 of file provider.h.

Member Data Documentation

DWORD _TRANSMITFILEARGS::dwFlags

Definition at line 114 of file provider.h.

HANDLE _TRANSMITFILEARGS::hFile

Definition at line 110 of file provider.h.

LPTRANSMIT_FILE_BUFFERS _TRANSMITFILEARGS::lpTransmitBuffers

Definition at line 113 of file provider.h.

DWORD _TRANSMITFILEARGS::nNumberOfBytesPerSend

Definition at line 111 of file provider.h.

DWORD _TRANSMITFILEARGS::nNumberOfBytesToWrite

Definition at line 111 of file provider.h.

The documentation for this struct was generated from the following file:
  • NetDS/WinSock/LSP/provider.h
Generated on Wed Nov 13 2024 16:55:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _TRANSMITPACKETSARGS Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_TRANSMITPACKETSARGS Struct Reference

#include "provider.h"

List of all members.

Public Attributes

DWORD dwFlags
LPTRANSMIT_PACKETS_ELEMENT | lpPacketArray
DWORD nElementCount
DWORD nSendSize
SOCKET | s

Detailed Description

Definition at line 133 of file provider.h.

Member Data Documentation

DWORD _TRANSMITPACKETSARGS::dwFlags

Definition at line 139 of file provider.h.

LPTRANSMIT_PACKETS_ELEMENT _TRANSMITPACKETSARGS::lpPacketArray

Definition at line 136 of file provider.h.

DWORD _TRANSMITPACKETSARGS::nElementCount

Definition at line 137 of file provider.h.

DWORD _TRANSMITPACKETSARGS::nSendSize

Definition at line 138 of file provider.h.

SOCKET _TRANSMITPACKETSARGS::s

Definition at line 135 of file provider.h.

The documentation for this struct was generated from the following file:
  • NetDS/WinSock/LSP/provider.h
Generated on Wed Nov 13 2024 16:55:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _TYPEMAP Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_TYPEMAP Struct Reference

List of all members.

Public Attributes

WCHAR * | pwszTypeName
DBTYPE | wType

Detailed Description

Definition at line 29 of file common.cpp.

Member Data Documentation

WCHAR* _TYPEMAP::pwszTypeName

Definition at line 32 of file common.cpp.

DBTYPE _TYPEMAP::wType

Definition at line 31 of file common.cpp.

The documentation for this struct was generated from the following file:
  • Dataaccess/oledb/tablecopy/common.cpp
Generated on Wed Nov 13 2024 16:55:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _UNICODE_STRING Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_UNICODE_STRING Struct Reference

#include "Npaux.h"

List of all members.

Public Attributes

PWSTR Buffer
USHORT Length
USHORT MaximumLength

Detailed Description

Definition at line 20 of file Npaux.h.

Member Data Documentation

PWSTR _UNICODE_STRING::Buffer

Definition at line 27 of file Npaux.h.

USHORT _UNICODE_STRING::Length

Definition at line 22 of file Npaux.h.

USHORT _UNICODE_STRING::MaximumLength

Definition at line 23 of file Npaux.h.

The documentation for this struct was generated from the following file:
  • Security/NetProviders/LogonNP/Npaux.h
Generated on Wed Nov 13 2024 16:55:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _UNITSTABLE Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_UNITSTABLE Struct Reference

List of all members.

Public Attributes

enum ENUM_PERIOD | enumPeriod
WCHAR const * | pwszString

Detailed Description

Definition at line 639 of file CeLib.Cpp.

Member Data Documentation

enum ENUM_PERIOD _UNITSTABLE::enumPeriod

Definition at line 642 of file CeLib.Cpp.

WCHAR const * _UNITSTABLE::pwszString

Definition at line 641 of file CeLib.Cpp.

The documentation for this struct was generated from the following files:
  • Security/CertServices/Encode/CeLib.Cpp
  • Security/CertServices/Exit/C++/Windows.Net/celib.cpp
  • Security/CertServices/Exit/C++/Windows2000/CeLib.Cpp
  • Security/CertServices/Policy/C++/Windows.Net/celib.cpp
  • Security/CertServices/Policy/C++/Windows2000/CeLib.Cpp
Generated on Wed Nov 13 2024 16:55:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _USER_EVENT Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_USER_EVENT Struct Reference

List of all members.

Public Attributes

ULONG EventInfo
EVENT_TRACE_HEADER Header

Detailed Description

Definition at line 48 of file TraceDp.c.

Member Data Documentation

ULONG _USER_EVENT::EventInfo

Definition at line 50 of file TraceDp.c.

EVENT_TRACE_HEADER _USER_EVENT::Header

Definition at line 49 of file TraceDp.c.

The documentation for this struct was generated from the following file:
  • WinBase/EventTrace/tracedp/TraceDp.c
Generated on Wed Nov 13 2024 16:55:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _USER_INFO Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_USER_INFO Struct Reference

List of all members.

Public Attributes

CHAR | achNTUserName [SF_MAX_USERNAME]
CHAR | achNTUserPassword [SF_MAX_PASSWORD]
CHAR | achPassword [SF_MAX_PASSWORD]
CHAR | achUserName [SF_MAX_USERNAME]
LIST_ENTRY | ListEntry

Detailed Description

Definition at line 34 of file cache.c.

Member Data Documentation

CHAR _USER_INFO::achNTUserName[SF_MAX_USERNAME]

Definition at line 40 of file cache.c.

CHAR _USER_INFO::achNTUserPassword[SF_MAX_PASSWORD]

Definition at line 41 of file cache.c.

CHAR _USER_INFO::achPassword[SF_MAX_PASSWORD]

Definition at line 39 of file cache.c.

CHAR _USER_INFO::achUserName[SF_MAX_USERNAME]

Definition at line 38 of file cache.c.

LIST_ENTRY _USER_INFO::ListEntry

Definition at line 36 of file cache.c.

The documentation for this struct was generated from the following file:
  • Web/iis/filters/AuthFilt/cache.c
Generated on Wed Nov 13 2024 16:55:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _VIRTUAL_BUFFER Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_VIRTUAL_BUFFER Struct Reference

#include "AsyncIO.h"

List of all members.

Public Attributes

LPVOID | Base
LPVOID | CommitLimit
ULONG PageSize
LPVOID | ReserveLimit

Detailed Description

Definition at line 80 of file AsyncIO.h.

Member Data Documentation

LPVOID _VIRTUAL_BUFFER::Base

Definition at line 81 of file AsyncIO.h.

LPVOID _VIRTUAL_BUFFER::CommitLimit

Definition at line 83 of file AsyncIO.h.

ULONG _VIRTUAL_BUFFER::PageSize

Definition at line 82 of file AsyncIO.h.

LPVOID _VIRTUAL_BUFFER::ReserveLimit

Definition at line 84 of file AsyncIO.h.

The documentation for this struct was generated from the following file:
  • WinBase/IO/AsyncIO/AsyncIO.h
Generated on Wed Nov 13 2024 16:55:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _VOLUME_GET_GPT_ATTRIBUTES_INFORMATION Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_VOLUME_GET_GPT_ATTRIBUTES_INFORMATION Struct Reference

List of all members.

Public Attributes

ULONGLONG GptAttributes

Detailed Description

Definition at line 67 of file DLEdit.Cpp.

Member Data Documentation

ULONGLONG _VOLUME_GET_GPT_ATTRIBUTES_INFORMATION::GptAttributes

Definition at line 68 of file DLEdit.Cpp.

The documentation for this struct was generated from the following file:
  • WinBase/IO/DLEdit/DLEdit.Cpp
Generated on Wed Nov 13 2024 16:55:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _WAVE_DATA Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_WAVE_DATA Struct Reference

List of all members.

Public Attributes

DWORD dwAmplitude
DWORD dwPeriod
LPWSTR szInstanceName

Detailed Description

Definition at line 59 of file Perfgen.c.

Member Data Documentation

DWORD _WAVE_DATA::dwAmplitude

Definition at line 61 of file Perfgen.c.

DWORD _WAVE_DATA::dwPeriod

Definition at line 60 of file Perfgen.c.

LPWSTR _WAVE_DATA::szInstanceName

Definition at line 62 of file Perfgen.c.

The documentation for this struct was generated from the following file:
  • WinBase/WinNT/PerfTool/PerfDllS/PerfGen/Perfgen.c
Generated on Wed Nov 13 2024 16:55:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _WIDEDBIDMAP Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_WIDEDBIDMAP Struct Reference

#include "error.h"

List of all members.

Public Attributes

const DBID * | pDBID
WCHAR * | pwszName

Detailed Description

Definition at line 43 of file error.h.

Member Data Documentation

const DBID* _WIDEDBIDMAP::pDBID

Definition at line 46 of file error.h.

WCHAR* _WIDEDBIDMAP::pwszName

Definition at line 45 of file error.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/oledb/rowsetviewer/error.h
Generated on Wed Nov 13 2024 16:55:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _WIDEGUIDMAP Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_WIDEGUIDMAP Struct Reference

#include "error.h"

List of all members.

Public Attributes

const GUID * | pGuid
WCHAR * | pwszName

Detailed Description

Definition at line 37 of file error.h.

Member Data Documentation

const GUID* _WIDEGUIDMAP::pGuid

Definition at line 40 of file error.h.

WCHAR* _WIDEGUIDMAP::pwszName

Definition at line 39 of file error.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/oledb/rowsetviewer/error.h
Generated on Wed Nov 13 2024 16:55:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _WIDENAMEMAP Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_WIDENAMEMAP Struct Reference

#include "error.h"

List of all members.

Public Attributes

LONG | lItem
WCHAR * | pwszName

Detailed Description

Definition at line 31 of file error.h.

Member Data Documentation

LONG _WIDENAMEMAP::lItem

Definition at line 34 of file error.h.

WCHAR* _WIDENAMEMAP::pwszName

Definition at line 33 of file error.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/oledb/rowsetviewer/error.h
Generated on Wed Nov 13 2024 16:55:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _WORK_QUEUE Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_WORK_QUEUE Struct Reference

#include "AsyncIO.h"

List of all members.

Public Attributes

CRITICAL_SECTION | CriticalSection
DWORD NumberOfWorkerThreads
LIST_ENTRY | Queue
HANDLE Semaphore
BOOL Terminating
PWORKER_ROUTINE WorkerRoutine
HANDLE | WorkerThreads [1]

Detailed Description

Definition at line 249 of file AsyncIO.h.

Member Data Documentation

CRITICAL_SECTION _WORK_QUEUE::CriticalSection

Definition at line 250 of file AsyncIO.h.

DWORD _WORK_QUEUE::NumberOfWorkerThreads

Definition at line 255 of file AsyncIO.h.

LIST_ENTRY _WORK_QUEUE::Queue

Definition at line 252 of file AsyncIO.h.

HANDLE _WORK_QUEUE::Semaphore

Definition at line 251 of file AsyncIO.h.

BOOL _WORK_QUEUE::Terminating

Definition at line 253 of file AsyncIO.h.

PWORKER_ROUTINE _WORK_QUEUE::WorkerRoutine

Definition at line 254 of file AsyncIO.h.

HANDLE _WORK_QUEUE::WorkerThreads[1]

Definition at line 256 of file AsyncIO.h.

The documentation for this struct was generated from the following file:
  • WinBase/IO/AsyncIO/AsyncIO.h
Generated on Wed Nov 13 2024 16:55:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _WORK_QUEUE_ITEM Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_WORK_QUEUE_ITEM Struct Reference

#include "AsyncIO.h"

List of all members.

Public Attributes

LIST_ENTRY List
DWORD Reason
PWORK_QUEUE WorkQueue

Detailed Description

Definition at line 259 of file AsyncIO.h.

Member Data Documentation

LIST_ENTRY _WORK_QUEUE_ITEM::List

Definition at line 260 of file AsyncIO.h.

DWORD _WORK_QUEUE_ITEM::Reason

Definition at line 261 of file AsyncIO.h.

PWORK_QUEUE _WORK_QUEUE_ITEM::WorkQueue

Definition at line 262 of file AsyncIO.h.

The documentation for this struct was generated from the following file:
  • WinBase/IO/AsyncIO/AsyncIO.h
Generated on Wed Nov 13 2024 16:55:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _WORK_THREAD_DATA Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

_WORK_THREAD_DATA Struct Reference

#include "RasHost.h"

List of all members.

Public Member Functions

VOID (WINAPI *pfnSecurityDialogEnd)(SECURITY_MESSAGE *)

Public Attributes

HPORT | hPort
PBYTE | pRecvBuf
PBYTE | pSendBuf
DWORD RecvBufSize
DWORD SendBufSize

Detailed Description

Definition at line 37 of file RasHost.h.

Member Function Documentation

_WORK_THREAD_DATA::VOID ( WINAPI * pfnSecurityDialogEnd )

Member Data Documentation

HPORT _WORK_THREAD_DATA::hPort

Definition at line 39 of file RasHost.h.

PBYTE _WORK_THREAD_DATA::pRecvBuf

Definition at line 42 of file RasHost.h.

PBYTE _WORK_THREAD_DATA::pSendBuf

Definition at line 40 of file RasHost.h.

DWORD _WORK_THREAD_DATA::RecvBufSize

Definition at line 43 of file RasHost.h.

DWORD _WORK_THREAD_DATA::SendBufSize

Definition at line 41 of file RasHost.h.

The documentation for this struct was generated from the following file:
  • NetDS/Ras/WinNT/RasHost/RasHost.h
Generated on Wed Nov 13 2024 16:55:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _WSAOVERLAPPEDPLUS Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_WSAOVERLAPPEDPLUS Struct Reference

#include "provider.h"

List of all members.

Public Attributes

union {
ACCEPTEXARGS AcceptExArgs
CONNECTEXARGS ConnectExArgs
DISCONNECTEXARGS DisconnectExArgs
IOCTLARGS IoctlArgs
RECVARGS RecvArgs
RECVFROMARGS RecvFromArgs
SENDARGS SendArgs
SENDTOARGS SendToArgs
TRANSMITFILEARGS TransmitFileArgs
TRANSMITPACKETSARGS TransmitPacketsArgs
WSARECVMSGARGS WSARecvMsgArgs
};
SOCKET | CallerSocket
WSATHREADID | CallerThreadId
int | Error
HANDLE Iocp
LPWSAOVERLAPPED_COMPLETION_ROUTINE | lpCallerCompletionRoutine
LPWSAOVERLAPPED | lpCallerOverlapped
_WSAOVERLAPPEDPLUS * next
int | Operation
PROVIDER * Provider
WSAOVERLAPPED | ProviderOverlapped
SOCKET | ProviderSocket
SOCK_INFO * SockInfo

Detailed Description

Definition at line 232 of file provider.h.

Member Data Documentation

union { ... }
ACCEPTEXARGS _WSAOVERLAPPEDPLUS::AcceptExArgs

Definition at line 244 of file provider.h.

SOCKET _WSAOVERLAPPEDPLUS::CallerSocket

Definition at line 237 of file provider.h.

WSATHREADID _WSAOVERLAPPEDPLUS::CallerThreadId

Definition at line 269 of file provider.h.

CONNECTEXARGS _WSAOVERLAPPEDPLUS::ConnectExArgs

Definition at line 246 of file provider.h.

DISCONNECTEXARGS _WSAOVERLAPPEDPLUS::DisconnectExArgs

Definition at line 248 of file provider.h.

int _WSAOVERLAPPEDPLUS::Error

Definition at line 240 of file provider.h.

HANDLE _WSAOVERLAPPEDPLUS::Iocp

Definition at line 239 of file provider.h.

IOCTLARGS _WSAOVERLAPPEDPLUS::IoctlArgs

Definition at line 254 of file provider.h.

LPWSAOVERLAPPED_COMPLETION_ROUTINE _WSAOVERLAPPEDPLUS::lpCallerCompletionRoutine

Definition at line 271 of file provider.h.

LPWSAOVERLAPPED _WSAOVERLAPPEDPLUS::lpCallerOverlapped

Definition at line 270 of file provider.h.

_WSAOVERLAPPEDPLUS* _WSAOVERLAPPEDPLUS::next

Definition at line 272 of file provider.h.

int _WSAOVERLAPPEDPLUS::Operation

Definition at line 268 of file provider.h.

PROVIDER* _WSAOVERLAPPEDPLUS::Provider

Definition at line 235 of file provider.h.

WSAOVERLAPPED _WSAOVERLAPPEDPLUS::ProviderOverlapped

Definition at line 234 of file provider.h.

SOCKET _WSAOVERLAPPEDPLUS::ProviderSocket

Definition at line 238 of file provider.h.

RECVARGS _WSAOVERLAPPEDPLUS::RecvArgs

Definition at line 250 of file provider.h.

RECVFROMARGS _WSAOVERLAPPEDPLUS::RecvFromArgs

Definition at line 251 of file provider.h.

SENDARGS _WSAOVERLAPPEDPLUS::SendArgs

Definition at line 252 of file provider.h.

SENDTOARGS _WSAOVERLAPPEDPLUS::SendToArgs

Definition at line 253 of file provider.h.

SOCK_INFO* _WSAOVERLAPPEDPLUS::SockInfo

Definition at line 236 of file provider.h.

TRANSMITFILEARGS _WSAOVERLAPPEDPLUS::TransmitFileArgs

Definition at line 245 of file provider.h.

TRANSMITPACKETSARGS _WSAOVERLAPPEDPLUS::TransmitPacketsArgs

Definition at line 247 of file provider.h.

WSARECVMSGARGS _WSAOVERLAPPEDPLUS::WSARecvMsgArgs

Definition at line 249 of file provider.h.

The documentation for this struct was generated from the following file:
  • NetDS/WinSock/LSP/provider.h
Generated on Wed Nov 13 2024 16:55:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _WSARECVMSGARGS Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_WSARECVMSGARGS Struct Reference

#include "provider.h"

List of all members.

Public Attributes

DWORD dwNumberOfBytesRecvd
LPWSAMSG | lpMsg
SOCKET | s

Detailed Description

Definition at line 155 of file provider.h.

Member Data Documentation

DWORD _WSARECVMSGARGS::dwNumberOfBytesRecvd

Definition at line 159 of file provider.h.

LPWSAMSG _WSARECVMSGARGS::lpMsg

Definition at line 158 of file provider.h.

SOCKET _WSARECVMSGARGS::s

Definition at line 157 of file provider.h.

The documentation for this struct was generated from the following file:
  • NetDS/WinSock/LSP/provider.h
Generated on Wed Nov 13 2024 16:55:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: _XFORMDATA Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

_XFORMDATA Struct Reference

#include "XForm.h"

List of all members.

Public Attributes

int | nObject
POINT | pObject [4]
XFORM | xForm

Detailed Description

Definition at line 23 of file XForm.h.

Member Data Documentation

int _XFORMDATA::nObject

Definition at line 29 of file XForm.h.

POINT _XFORMDATA::pObject[4]

Definition at line 28 of file XForm.h.

XFORM _XFORMDATA::xForm

Definition at line 26 of file XForm.h.

The documentation for this struct was generated from the following file:
  • Multimedia/Gdi/GdiDemo/XForm.h
Generated on Wed Nov 13 2024 16:55:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: About Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Package Attributes | Private Member Functions

About Class Reference

List of all members.

Public Member Functions

About ()
void | dispose ()

Static Public Member Functions

static void | main (String args[])

Package Attributes

Container | components = new Container()
Label | nameLabel = new Label()
Button | okButton = new Button()
Label | titleLabel = new Label()
Label | versionLabel = new Label()

Private Member Functions

void | initForm ()
void | okButton_click (Object sender, Event e)

Detailed Description

Definition at line 16 of file about.java.

Constructor & Destructor Documentation

About::About ( ) [inline]

Definition at line 23 of file about.java.

  {
    super();

    initForm();
  }

Member Function Documentation

void About::dispose ( ) [inline]

Definition at line 30 of file about.java.

  {
    super.dispose();
    components.dispose();
  }

void About::initForm ( ) [inline, private]

Definition at line 42 of file about.java.

  {
    okButton.setLocation(new Point(224, 16));
    okButton.setSize(new Point(84, 23));
    okButton.setTabIndex(0);
    okButton.setText("OK");
    okButton.addOnClick(new EventHandler(this.okButton_click));

    this.setText("About Microsoft Character Animation Previewer");
    this.setAcceptButton(okButton);
    this.setAutoScaleBaseSize(new Point(5, 13));
    this.setBorderStyle(FormBorderStyle.FIXED_TOOLWINDOW);
    this.setCancelButton(okButton);
    this.setClientSize(new Point(324, 85));
    this.setMaximizeBox(false);
    this.setMinimizeBox(false);
    this.setStartPosition(FormStartPosition.CENTER_SCREEN);

    titleLabel.setLocation(new Point(10, 10));
    titleLabel.setSize(new Point(192, 16));
    titleLabel.setTabIndex(1);
    titleLabel.setTabStop(false);
    titleLabel.setText("Microsoft Character Animation Previewer");

    versionLabel.setLocation(new Point(8, 56));
    versionLabel.setSize(new Point(64, 16));
    versionLabel.setTabIndex(2);
    versionLabel.setTabStop(false);
    versionLabel.setText("Version 1.00");

    nameLabel.setLocation(new Point(8, 32));
    nameLabel.setSize(new Point(192, 16));
    nameLabel.setTabIndex(3);
    nameLabel.setTabStop(false);
    nameLabel.setText("Copyright (C) 1998 Microsoft Corporation");

    this.setNewControls(new Control[] {
              nameLabel,
              versionLabel,
              titleLabel,
              okButton});
  }

static void About::main ( String args[] ) [inline, static]

Definition at line 85 of file about.java.

  {
    Application.run(new About());
  }

void About::okButton_click | ( | Object | sender,
 |  | Event | e |
 | ) |  |  | [inline, private]

Definition at line 18 of file about.java.

  {
    this.setDialogResult(DialogResult.OK);
  }

Member Data Documentation

Container About::components = new Container() [package]

Definition at line 36 of file about.java.

Label About::nameLabel = new Label() [package]

Definition at line 40 of file about.java.

Button About::okButton = new Button() [package]

Definition at line 37 of file about.java.

Label About::titleLabel = new Label() [package]

Definition at line 38 of file about.java.

Label About::versionLabel = new Label() [package]

Definition at line 39 of file about.java.

The documentation for this class was generated from the following file:
  • Web/MSAgent/Java/CapJ/about.java
Generated on Wed Nov 13 2024 16:55:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: AboutDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes | Friends

AboutDlg Class Reference

#include "About.h"

List of all members.

Public Member Functions

AboutDlg ()
~AboutDlg ()
void | DoModal (HWND hWndParent, short sAgentVersionMajor, short sAgentVersionMinor)

Private Member Functions

BOOL OnInitDialog ()

Private Attributes

HICON | m_hIcon
HWND | m_hWnd
RECT | m_rcIcon
short | m_sAgentMajor
short | m_sAgentMinor

Friends

BOOL CALLBACK | DlgProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)

Detailed Description

Definition at line 7 of file About.h.

Constructor & Destructor Documentation

AboutDlg::AboutDlg ( )

Definition at line 50 of file About.Cpp.

                   {

  m_hIcon = NULL;
}

AboutDlg::~AboutDlg ( )

Definition at line 56 of file About.Cpp.

                    {

}

Member Function Documentation

void AboutDlg::DoModal | ( | HWND | hWndParent,
 |  | short | sAgentVersionMajor,
 |  | short | sAgentVersionMinor
 | ) |  |

Definition at line 61 of file About.Cpp.

                                                                                {

  HWND hWndFocus;

  m_sAgentMajor = sAgentVersionMajor;
  m_sAgentMinor = sAgentVersionMinor;

  hWndFocus = GetFocus();

  DialogBoxParam(GetModuleHandle(NULL),
           MAKEINTRESOURCE(IDD_ABOUT),
           hWndParent,
           (DLGPROC)DlgProc,
           (long)this);

  if (hWndFocus)
    SetFocus(hWndFocus);
}

BOOL AboutDlg::OnInitDialog ( ) [private]

Definition at line 81 of file About.Cpp.

                            {

  _TCHAR  szExe[_MAX_PATH];
  _TCHAR  szVersion[256];
  DWORD dwVersionSize;
  DWORD dwTemp;
  void   *pData;
  void   *pVerInfo;
  UINT  uVerInfoSize;

  // Load the application icon

  m_hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_APP));

  GetWindowRect(GetDlgItem(m_hWnd, IDC_ICONPOS), &m_rcIcon);
  ScreenToClient(m_hWnd, (POINT *)&m_rcIcon);

  GetModuleFileName(NULL, szExe, _MAX_PATH);

  dwVersionSize = GetFileVersionInfoSize(szExe, &dwTemp);

  // There better be version data

  _ASSERT(dwVersionSize != 0);

  __try {
    pData = _alloca(dwVersionSize);
  }
  __except(EXCEPTION_EXECUTE_HANDLER) {
    pData = NULL;
  }

  if (pData) {

    GetFileVersionInfo(szExe, 0, dwVersionSize, pData);

    if (VerQueryValue(pData, _T("\\"), &pVerInfo, &uVerInfoSize)) {
      wsprintf(szVersion,
           _T("%d.%.2d.%d.%d"),
           HIWORD(((VS_FIXEDFILEINFO *)pVerInfo)->dwFileVersionMS),
           LOWORD(((VS_FIXEDFILEINFO *)pVerInfo)->dwFileVersionMS),
           HIWORD(((VS_FIXEDFILEINFO *)pVerInfo)->dwFileVersionLS),
           LOWORD(((VS_FIXEDFILEINFO *)pVerInfo)->dwFileVersionLS));
      SetDlgItemText(m_hWnd, IDC_VERSION, szVersion);
    }
  }

  // Microsoft Agent Version

  wsprintf(szVersion, _T("%d.%.2d"), m_sAgentMajor, m_sAgentMinor);
  SetDlgItemText(m_hWnd, IDC_AGENTVERSION, szVersion);

  return TRUE;
}

Friends And Related Function Documentation

BOOL CALLBACK DlgProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [friend]

Definition at line 1058 of file PlgBlt.c.

{

  switch (message) {
    /**********************************************************************\
    *  WM_INITDIALOG
    *
    * Fill the entry fields with sensible original values.
    \**********************************************************************/
    case WM_INITDIALOG:
        SetDlgItemText(hwnd, DID_P1X     , "0");
        SetDlgItemText(hwnd, DID_P1Y     , "0");
        SetDlgItemText(hwnd, DID_P2X     , "0");
        SetDlgItemText(hwnd, DID_P2Y     , "0");
        SetDlgItemText(hwnd, DID_P3X     , "0");
        SetDlgItemText(hwnd, DID_P3Y     , "0");
        SetDlgItemText(hwnd, DID_XSRC    , "0");
        SetDlgItemText(hwnd, DID_YSRC    , "0");
        SetDlgItemText(hwnd, DID_WIDTH   , "0");
        SetDlgItemText(hwnd, DID_HEIGHT  , "0");
        SetDlgItemText(hwnd, DID_XMASK   , "0");
        SetDlgItemText(hwnd, DID_YMASK   , "0");
    return TRUE;

    /**********************************************************************\
    *  WM_PUTUPLPOINTS
    *
    * wParam -  HDC with the needed world transform.
    * lParam -  Pointer to the track object.
    *
    * Fill the entry fields for the array of 3 dest parallelogram points.
    *  Conditionally change the first point depending on tracking mode.
    \**********************************************************************/
    case WM_PUTUPLPOINTS: {
        POINT p, origin;
        PTrackObject pto;
        HDC hdc;

        hdc = (HDC) wParam;
        pto = (PTrackObject) lParam;
        GetViewportOrgEx (hdc, &origin);

        if (pto->Mode & TMMOVE) {
          p.x = pto->rect.left;
          p.y = pto->rect.top;
          LPtoDP (pto->hdc, &p, 1);
          p.x -= origin.x; p.y -= origin.y;

          SetDlgItemInt(hwnd, DID_P1X, p.x, TRUE);
          SetDlgItemInt(hwnd, DID_P1Y, p.y, TRUE);

        }

        p.x = pto->rect.right;
        p.y = pto->rect.top;
        LPtoDP (pto->hdc, &p, 1);
        p.x -= origin.x; p.y -= origin.y;

        SetDlgItemInt(hwnd, DID_P2X, p.x, TRUE);
        SetDlgItemInt(hwnd, DID_P2Y, p.y, TRUE);

        p.x = pto->rect.left;
        p.y = pto->rect.bottom;
        LPtoDP (pto->hdc, &p, 1);
        p.x -= origin.x; p.y -= origin.y;
        SetDlgItemInt(hwnd, DID_P3X, p.x, TRUE);
        SetDlgItemInt(hwnd, DID_P3Y, p.y, TRUE);

    } return FALSE;

    /**********************************************************************\
    *  WM_PUTUPSRCRECT
    *
    * wParam -  HDC with the needed world transform.
    * lParam -  Pointer to the track object.
    *
    * Fill the entry fields for the source rectangle points.
    *  Conditionally change <x,y> or <width,height> depending on tracking mode.
    \**********************************************************************/
    case WM_PUTUPSRCRECT: {
        POINT p1,p2, origin;
        PTrackObject pto;
        HDC hdc;

        hdc = (HDC) wParam;
        pto = (PTrackObject) lParam;
        GetViewportOrgEx (hdc, &origin);

        p1.x = pto->rect.left;
        p1.y = pto->rect.top;
        LPtoDP (pto->hdc, &p1, 1);

        p2.x = pto->rect.right;
        p2.y = pto->rect.bottom;
        LPtoDP (pto->hdc, &p2, 1);
        p2.x -= p1.x; p2.y -= p1.y;

        p1.x -= origin.x; p1.y -= origin.y;

        if (!(pto->Mode & TMSIZEXY)) {
          SetDlgItemInt(hwnd, DID_XSRC, p1.x, TRUE);
          SetDlgItemInt(hwnd, DID_YSRC, p1.y, TRUE);
        }

        if (!(pto->Mode & TMMOVE)) {
          SetDlgItemInt(hwnd, DID_WIDTH,  p2.x, TRUE);
          SetDlgItemInt(hwnd, DID_HEIGHT, p2.y, TRUE);
        }
    } return FALSE;

    /**********************************************************************\
    *  WM_PUTUPMASKPT
    *
    * wParam -  HDC with the needed world transform.
    * lParam -  Pointer to the track object.
    *
    * Fill the entry fields for the mask location point.
    \**********************************************************************/
    case WM_PUTUPMASKPT: {
        POINT p1, origin;
        PTrackObject pto;
        HDC hdc;

        hdc = (HDC) wParam;
        pto = (PTrackObject) lParam;
        GetViewportOrgEx (hdc, &origin);

        p1.x = pto->rect.left;
        p1.y = pto->rect.top;
        LPtoDP (pto->hdc, &p1, 1);
        p1.x -= origin.x; p1.y -= origin.y;

        SetDlgItemInt(hwnd, DID_XMASK, p1.x, TRUE);
        SetDlgItemInt(hwnd, DID_YMASK, p1.y, TRUE);

    } return FALSE;

    /**********************************************************************\
    *  WM_COMMAND, DID_DRAW
    *
    * Draw button hit - send main window message to call PlgBlt().
    \**********************************************************************/
    case WM_COMMAND: {
      HBITMAP hbm;

      if (LOWORD(wParam) == DID_DRAW) {
          SendMessage (hwndMain, WM_PLGBLT, 0,0);

    /**********************************************************************\
    *  WM_COMMAND, DID_NEWSRC
    *
    * Try to get a new source bitmap.  Then
    *  invalidate two sub windows so that we force a repaint.
    \**********************************************************************/
      } else if (LOWORD(wParam) == DID_NEWSRC) {
        if ( hbm = GetBitmap (hdcSrc, hInst, FALSE)) {
          DeleteObject (hbmSrc);
          hbmSrc = hbm;
          InvalidateRect (hwndMain, &ptoSrc->rectClip, TRUE);
          InvalidateRect (hwndMain, &ptoDest->rectClip, TRUE);
        }

    /**********************************************************************\
    *  WM_COMMAND, DID_Mask
    *
    * Try to get a new mask bitmap.  Then
    *  invalidate two sub windows so that we force a repaint.
    \**********************************************************************/
      } else if (LOWORD(wParam) == DID_NEWMASK) {
        if ( hbm = GetBitmap (hdcMask,  hInst, TRUE)) {
          DeleteObject (hbmMask);
          hbmMask = hbm;
          InvalidateRect (hwndMain, &ptoMask->rectClip, TRUE);
          InvalidateRect (hwndMain, &ptoDest->rectClip, TRUE);
        }
      }

    } return FALSE; /* end WM_COMMAND */

  } /* end switch */
  return 0;
}

Member Data Documentation

HICON AboutDlg::m_hIcon [private]

Definition at line 21 of file About.h.

HWND AboutDlg::m_hWnd [private]

Definition at line 20 of file About.h.

RECT AboutDlg::m_rcIcon [private]

Definition at line 22 of file About.h.

short AboutDlg::m_sAgentMajor [private]

Definition at line 23 of file About.h.

short AboutDlg::m_sAgentMinor [private]

Definition at line 24 of file About.h.

The documentation for this class was generated from the following files:
  • Web/MSAgent/c/Cap/About.h
  • Web/MSAgent/c/Cap/About.Cpp
Generated on Wed Nov 13 2024 16:55:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ACCOUNT::CAccount Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • ACCOUNT
  • ACCOUNT::CAccount

ACCOUNT::CAccount Class Reference

import "Account.idl";

Detailed Description

Definition at line 58 of file Account.idl.

The documentation for this class was generated from the following file:
  • Com/Services/Events/UserEvents/VCAcct/Account.idl
Generated on Wed Nov 13 2024 16:58:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ADDRESS_DATA Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

ADDRESS_DATA Struct Reference

List of all members.

Public Attributes

WCHAR | szName [MAX_STRING]
PWSTR szTitle
WCHAR | szURI [MAX_STRING]

Detailed Description

Definition at line 466 of file rtcdialogs.cpp.

Member Data Documentation

WCHAR ADDRESS_DATA::szName[MAX_STRING]

Definition at line 470 of file rtcdialogs.cpp.

PWSTR ADDRESS_DATA::szTitle

Definition at line 468 of file rtcdialogs.cpp.

WCHAR ADDRESS_DATA::szURI[MAX_STRING]

Definition at line 469 of file rtcdialogs.cpp.

The documentation for this struct was generated from the following file:
  • NetDS/rtc/Client/CPP/rtcsample/rtcdialogs.cpp
Generated on Wed Nov 13 2024 16:55:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ADOConnectionConstructionVtbl Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

ADOConnectionConstructionVtbl Struct Reference

#include "adoint.h"

List of all members.

Public Member Functions

BEGIN_INTERFACE | HRESULT (STDMETHODCALLTYPE __RPC_FAR *QueryInterface)(ADOConnectionConstruction __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Session)(ADOConnectionConstruction __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_DSO)(ADOConnectionConstruction __RPC_FAR *This
ULONG (STDMETHODCALLTYPE __RPC_FAR *Release)(ADOConnectionConstruction __RPC_FAR *This)
ULONG (STDMETHODCALLTYPE __RPC_FAR *AddRef)(ADOConnectionConstruction __RPC_FAR *This)

Public Attributes

IUnknown __RPC_FAR *__RPC_FAR * | ppDSO
IUnknown __RPC_FAR *__RPC_FAR * | ppSession
BEGIN_INTERFACE REFIID void
__RPC_FAR *__RPC_FAR * 		ppvObject
BEGIN_INTERFACE REFIID | riid

Detailed Description

Definition at line 2210 of file adoint.h.

Member Function Documentation

BEGIN_INTERFACE ADOConnectionConstructionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * QueryInterface )
ADOConnectionConstructionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Session )
ADOConnectionConstructionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_DSO )
ADOConnectionConstructionVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * Release )
ADOConnectionConstructionVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * AddRef )

Member Data Documentation

IUnknown __RPC_FAR* __RPC_FAR* ADOConnectionConstructionVtbl::ppDSO

Definition at line 2227 of file adoint.h.

IUnknown __RPC_FAR* __RPC_FAR* ADOConnectionConstructionVtbl::ppSession

Definition at line 2231 of file adoint.h.

BEGIN_INTERFACE REFIID void __RPC_FAR* __RPC_FAR* ADOConnectionConstructionVtbl::ppvObject

Definition at line 2216 of file adoint.h.

BEGIN_INTERFACE REFIID ADOConnectionConstructionVtbl::riid

Definition at line 2216 of file adoint.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/rds/handler/vc/adoint.h
Generated on Wed Nov 13 2024 16:55:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ADORecordsetConstructionVtbl Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

ADORecordsetConstructionVtbl Struct Reference

#include "adoint.h"

List of all members.

Public Member Functions

BEGIN_INTERFACE | HRESULT (STDMETHODCALLTYPE __RPC_FAR *QueryInterface)(ADORecordsetConstruction __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *put_RowPosition)(ADORecordsetConstruction __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount)(ADORecordsetConstruction __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *put_Chapter)(ADORecordsetConstruction __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Chapter)(ADORecordsetConstruction __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Rowset)(ADORecordsetConstruction __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *put_Rowset)(ADORecordsetConstruction __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Invoke)(ADORecordsetConstruction __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_RowPosition)(ADORecordsetConstruction __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo)(ADORecordsetConstruction __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames)(ADORecordsetConstruction __RPC_FAR *This
ULONG (STDMETHODCALLTYPE __RPC_FAR *Release)(ADORecordsetConstruction __RPC_FAR *This)
ULONG (STDMETHODCALLTYPE __RPC_FAR *AddRef)(ADORecordsetConstruction __RPC_FAR *This)

Public Attributes

REFIID LPOLESTR __RPC_FAR UINT | cNames
DISPID | dispIdMember
UINT iTInfo
LONG | lChapter
UINT LCID | lcid
REFIID LPOLESTR __RPC_FAR UINT LCID | lcid
DISPID REFIID LCID | lcid
UINT __RPC_FAR * | pctinfo
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR * 		pDispParams
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR EXCEPINFO __RPC_FAR * 		pExcepInfo
LONG __RPC_FAR * | plChapter
IUnknown __RPC_FAR *__RPC_FAR * | ppRowPos
IUnknown __RPC_FAR *__RPC_FAR * | ppRowset
UINT LCID ITypeInfo __RPC_FAR
*__RPC_FAR * 		ppTInfo
BEGIN_INTERFACE REFIID void
__RPC_FAR *__RPC_FAR * 		ppvObject
IUnknown __RPC_FAR * | pRowPos
IUnknown __RPC_FAR * | pRowset
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR EXCEPINFO __RPC_FAR
UINT __RPC_FAR * 		puArgErr
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR * 		pVarResult
REFIID LPOLESTR __RPC_FAR UINT
LCID DISPID __RPC_FAR * 		rgDispId
REFIID LPOLESTR __RPC_FAR * | rgszNames
BEGIN_INTERFACE REFIID | riid
REFIID | riid
DISPID REFIID | riid
DISPID REFIID LCID WORD | wFlags

Detailed Description

Definition at line 3478 of file adoint.h.

Member Function Documentation

BEGIN_INTERFACE ADORecordsetConstructionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * QueryInterface )
ADORecordsetConstructionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * put_RowPosition )
ADORecordsetConstructionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetTypeInfoCount )
ADORecordsetConstructionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * put_Chapter )
ADORecordsetConstructionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Chapter )
ADORecordsetConstructionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Rowset )
ADORecordsetConstructionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * put_Rowset )
ADORecordsetConstructionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Invoke )
ADORecordsetConstructionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_RowPosition )
ADORecordsetConstructionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetTypeInfo )
ADORecordsetConstructionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetIDsOfNames )
ADORecordsetConstructionVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * Release )
ADORecordsetConstructionVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * AddRef )

Member Data Documentation

REFIID LPOLESTR __RPC_FAR UINT ADORecordsetConstructionVtbl::cNames

Definition at line 3505 of file adoint.h.

DISPID ADORecordsetConstructionVtbl::dispIdMember

Definition at line 3513 of file adoint.h.

UINT ADORecordsetConstructionVtbl::iTInfo

Definition at line 3499 of file adoint.h.

LONG ADORecordsetConstructionVtbl::lChapter

Definition at line 3536 of file adoint.h.

UINT LCID ADORecordsetConstructionVtbl::lcid

Definition at line 3499 of file adoint.h.

REFIID LPOLESTR __RPC_FAR UINT LCID ADORecordsetConstructionVtbl::lcid

Definition at line 3505 of file adoint.h.

DISPID REFIID LCID ADORecordsetConstructionVtbl::lcid

Definition at line 3513 of file adoint.h.

UINT __RPC_FAR* ADORecordsetConstructionVtbl::pctinfo

Definition at line 3495 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR* ADORecordsetConstructionVtbl::pDispParams

Definition at line 3513 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR EXCEPINFO __RPC_FAR* ADORecordsetConstructionVtbl::pExcepInfo

Definition at line 3513 of file adoint.h.

LONG __RPC_FAR* ADORecordsetConstructionVtbl::plChapter

Definition at line 3532 of file adoint.h.

IUnknown __RPC_FAR* __RPC_FAR* ADORecordsetConstructionVtbl::ppRowPos

Definition at line 3540 of file adoint.h.

IUnknown __RPC_FAR* __RPC_FAR* ADORecordsetConstructionVtbl::ppRowset

Definition at line 3524 of file adoint.h.

UINT LCID ITypeInfo __RPC_FAR* __RPC_FAR* ADORecordsetConstructionVtbl::ppTInfo

Definition at line 3499 of file adoint.h.

BEGIN_INTERFACE REFIID void __RPC_FAR* __RPC_FAR* ADORecordsetConstructionVtbl::ppvObject

Definition at line 3484 of file adoint.h.

IUnknown __RPC_FAR* ADORecordsetConstructionVtbl::pRowPos

Definition at line 3544 of file adoint.h.

IUnknown __RPC_FAR* ADORecordsetConstructionVtbl::pRowset

Definition at line 3528 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR EXCEPINFO __RPC_FAR UINT __RPC_FAR* ADORecordsetConstructionVtbl::puArgErr

Definition at line 3513 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR* ADORecordsetConstructionVtbl::pVarResult

Definition at line 3513 of file adoint.h.

REFIID LPOLESTR __RPC_FAR UINT LCID DISPID __RPC_FAR* ADORecordsetConstructionVtbl::rgDispId

Definition at line 3505 of file adoint.h.

REFIID LPOLESTR __RPC_FAR* ADORecordsetConstructionVtbl::rgszNames

Definition at line 3505 of file adoint.h.

BEGIN_INTERFACE REFIID ADORecordsetConstructionVtbl::riid

Definition at line 3484 of file adoint.h.

REFIID ADORecordsetConstructionVtbl::riid

Definition at line 3505 of file adoint.h.

DISPID REFIID ADORecordsetConstructionVtbl::riid

Definition at line 3513 of file adoint.h.

DISPID REFIID LCID WORD ADORecordsetConstructionVtbl::wFlags

Definition at line 3513 of file adoint.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/rds/handler/vc/adoint.h
Generated on Wed Nov 13 2024 16:55:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ADsError Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

ADsError Class Reference

#include "IADsError.h"

List of all members.

Public Member Functions

ADsError ()
STDMETHOD() | GetErrorMessage (long hResult, BSTR *pbMsg)
STDMETHOD() | InterfaceSupportsErrorInfo (REFIID riid)

Detailed Description

Definition at line 17 of file IADsError.h.

Constructor & Destructor Documentation

ADsError::ADsError ( ) [inline]

Definition at line 24 of file IADsError.h.

{}

Member Function Documentation

STDMETHODIMP ADsError::GetErrorMessage | ( | long | hResult,
 |  | BSTR * | pbMsg
 | ) |  |

Definition at line 34 of file IADsError.cpp.

{
  CComBSTR bstr;
  HRESULT hr;
  hr = ::GetErrorMessage( hResult, bstr );

  if ( SUCCEEDED(hr) )
  {
    *pbMsg = SysAllocString(bstr);
  }

  return hr;
}

STDMETHODIMP ADsError::InterfaceSupportsErrorInfo ( REFIID riid )

Definition at line 19 of file IADsError.cpp.

{
  static const IID* arr[] =
  {
    &IID_IADsError,
  };

  for (int i=0;i<sizeof(arr)/sizeof(arr[0]);i++)
  {
    if (::InlineIsEqualGUID(*arr[i],riid))
      return S_OK;
  }
  return S_FALSE;
}

The documentation for this class was generated from the following files:
  • NetDS/ADSI/samples/General/ADsError/IADsError.h
  • NetDS/ADSI/samples/General/ADsError/IADsError.cpp
Generated on Wed Nov 13 2024 16:55:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ADSERRORLib::ADsError Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • ADSERRORLib
  • ADSERRORLib::ADsError

ADSERRORLib::ADsError Class Reference

import "ADsError.idl";

Detailed Description

Definition at line 37 of file ADsError.idl.

The documentation for this class was generated from the following file:
  • NetDS/ADSI/samples/General/ADsError/ADsError.idl
Generated on Wed Nov 13 2024 16:58:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ADSFIRSTEXTLib::HelloWorld Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • ADSFIRSTEXTLib
  • ADSFIRSTEXTLib::HelloWorld

ADSFIRSTEXTLib::HelloWorld Class Reference

import "ADsFirstExt.idl";

Detailed Description

Definition at line 38 of file ADsFirstExt.idl.

The documentation for this class was generated from the following file:
  • NetDS/ADSI/samples/Extension/tutorial/step1/ADsFirstExt.idl
Generated on Wed Nov 13 2024 16:58:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ADSTYPE_TO_STRING_ENTRY Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

ADSTYPE_TO_STRING_ENTRY Struct Reference

List of all members.

Public Attributes

ADSTYPE | AdsType
LPWSTR | pwszTypeName

Detailed Description

Definition at line 434 of file UserProps.cpp.

Member Data Documentation

ADSTYPE ADSTYPE_TO_STRING_ENTRY::AdsType

Definition at line 437 of file UserProps.cpp.

LPWSTR ADSTYPE_TO_STRING_ENTRY::pwszTypeName

Definition at line 436 of file UserProps.cpp.

The documentation for this struct was generated from the following file:
  • NetDS/ADSI/samples/activedir/createuser/vc/UserProps.cpp
Generated on Wed Nov 13 2024 16:55:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ADSTYPEsyntaxmapping Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

ADSTYPEsyntaxmapping Struct Reference

List of all members.

Public Attributes

ADSTYPE | adsType
LPWSTR | pwszSyntax

Detailed Description

Definition at line 376 of file UserProps.cpp.

Member Data Documentation

ADSTYPE ADSTYPEsyntaxmapping::adsType

Definition at line 379 of file UserProps.cpp.

LPWSTR ADSTYPEsyntaxmapping::pwszSyntax

Definition at line 378 of file UserProps.cpp.

The documentation for this struct was generated from the following file:
  • NetDS/ADSI/samples/activedir/createuser/vc/UserProps.cpp
Generated on Wed Nov 13 2024 16:55:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ADVISE_SINK Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

ADVISE_SINK Struct Reference

#include "tsfedit.h"

List of all members.

Public Attributes

DWORD dwMask
ITextStoreACPSink * | pTextStoreACPSink
IUnknown * | punkID

Detailed Description

Definition at line 41 of file tsfedit.h.

Member Data Documentation

DWORD ADVISE_SINK::dwMask

Definition at line 45 of file tsfedit.h.

ITextStoreACPSink* ADVISE_SINK::pTextStoreACPSink

Definition at line 44 of file tsfedit.h.

IUnknown* ADVISE_SINK::punkID

Definition at line 43 of file tsfedit.h.

The documentation for this struct was generated from the following file:
  • WinUI/tsfapp/tsfedit.h
Generated on Wed Nov 13 2024 16:55:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: AgentNotifySink Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

AgentNotifySink Class Reference

#include "Notify.h"

Inherits agentsvr::IAgentNotifySinkEx, agentsvr::IAgentNotifySinkEx, and agentsvr::IAgentNotifySinkEx.

List of all members.

Public Member Functions

AgentNotifySink (MainDlg *pMainDlg)
AgentNotifySink ()
AgentNotifySink ()
~AgentNotifySink ()
~AgentNotifySink ()
~AgentNotifySink ()
STDMETHODIMP | ActivateInputState (long dwCharID, long bActivated)
STDMETHODIMP | ActivateInputState (long dwCharID, long bActivated)
STDMETHODIMP | ActivateInputState (long dwCharID, long bActivated)
STDMETHODIMP | ActiveClientChange (long dwCharID, long lStatus)
STDMETHODIMP | ActiveClientChange (long dwCharID, long bActive)
STDMETHODIMP | ActiveClientChange (long dwCharID, long lStatus)
STDMETHODIMP | AgentPropertyChange ()
STDMETHODIMP | AgentPropertyChange ()
STDMETHODIMP | AgentPropertyChange ()
STDMETHODIMP | BalloonVisibleState (long dwCharID, long bVisible)
STDMETHODIMP | BalloonVisibleState (long dwCharID, long bVisible)
STDMETHODIMP | BalloonVisibleState (long dwCharID, long bVisible)
STDMETHODIMP | BookMark (long dwBookMarkID)
STDMETHODIMP | BookMark (long dwBookMarkID)
STDMETHODIMP | BookMark (long dwBookMarkID)
STDMETHODIMP | Click (long dwCharID, short fwKeys, long X, long Y)
STDMETHODIMP | Click (long dwCharID, short fwKeys, long X, long Y)
STDMETHODIMP | Click (long dwCharID, short fwKeys, long x, long y)
STDMETHODIMP | Command (long dwCommandID, IUnknown *punkUserInput)
STDMETHODIMP | Command (long dwCommandID, IUnknown *punkUserInput)
STDMETHODIMP | Command (long dwCommandID, IUnknown *punkUserInput)
STDMETHODIMP | DblClick (long dwCharID, short fwKeys, long x, long y)
STDMETHODIMP | DblClick (long dwCharID, short fwKeys, long X, long Y)
STDMETHODIMP | DblClick (long dwCharID, short fwKeys, long X, long Y)
STDMETHODIMP | DefaultCharacterChange (BSTR bszGUID)
STDMETHODIMP | DefaultCharacterChange (BSTR bszGUID)
STDMETHODIMP | DefaultCharacterChange (BSTR bszGUID)
STDMETHODIMP | DragComplete (long dwCharID, short fwKeys, long x, long y)
STDMETHODIMP | DragComplete (long dwCharID, short fwKeys, long X, long Y)
STDMETHODIMP | DragComplete (long dwCharID, short fwKeys, long X, long Y)
STDMETHODIMP | DragStart (long dwCharID, short fwKeys, long x, long y)
STDMETHODIMP | DragStart (long dwCharID, short fwKeys, long X, long Y)
STDMETHODIMP | DragStart (long dwCharID, short fwKeys, long X, long Y)
STDMETHODIMP | GetIDsOfNames (REFIID, OLECHAR **, UINT, LCID, DISPID *)
STDMETHODIMP | GetIDsOfNames (REFIID, OLECHAR **, UINT, LCID, DISPID *)
STDMETHODIMP | GetIDsOfNames (REFIID, OLECHAR **, UINT, LCID, DISPID *)
STDMETHODIMP | GetTypeInfo (UINT, LCID, ITypeInfo **)
STDMETHODIMP | GetTypeInfo (UINT, LCID, ITypeInfo **)
STDMETHODIMP | GetTypeInfo (UINT, LCID, ITypeInfo **)
STDMETHODIMP | GetTypeInfoCount (UINT *)
STDMETHODIMP | GetTypeInfoCount (UINT *)
STDMETHODIMP | GetTypeInfoCount (UINT *)
STDMETHODIMP | HelpComplete (long dwCharID, long dwCommandID, long dwCause)
STDMETHODIMP | HelpComplete (long dwCharID, long dwCommandID, long dwCause)
STDMETHODIMP | HelpComplete (long dwCharID, long dwCommandID, long dwCause)
STDMETHODIMP | Idle (long dwCharID, long bStart)
STDMETHODIMP | Idle (long dwCharID, long bStart)
STDMETHODIMP | Idle (long dwCharID, long bStart)
STDMETHODIMP | Invoke (DISPID, REFIID, LCID, WORD, DISPPARAMS *, VARIANT *, EXCEPINFO *, UINT *)
STDMETHODIMP | Invoke (DISPID, REFIID, LCID, WORD, DISPPARAMS *, VARIANT *, EXCEPINFO *, UINT *)
STDMETHODIMP | Invoke (DISPID, REFIID, LCID, WORD, DISPPARAMS *, VARIANT *, EXCEPINFO *, UINT *)
STDMETHODIMP | ListeningState (long dwCharacterID, long bListenState, long dwCause)
STDMETHODIMP | ListeningState (long dwCharID, long bListening, long dwCause)
STDMETHODIMP | ListeningState (long dwCharacterID, long bListenState, long dwCause)
STDMETHODIMP | Move (long dwCharID, long X, long Y, long lCause)
STDMETHODIMP | Move (long dwCharID, long x, long y, long lCause)
STDMETHODIMP | Move (long dwCharID, long X, long Y, long lCause)
STDMETHODIMP | QueryInterface (REFIID, LPVOID FAR *)
STDMETHODIMP | QueryInterface (REFIID, LPVOID FAR *)
STDMETHODIMP | QueryInterface (REFIID, LPVOID FAR *)
STDMETHODIMP | RequestComplete (long dwRequestID, long hrStatus)
STDMETHODIMP | RequestComplete (long dwRequestID, long hrStatus)
STDMETHODIMP | RequestComplete (long dwRequestID, long hrStatus)
STDMETHODIMP | RequestStart (long dwRequestID)
STDMETHODIMP | RequestStart (long dwRequestID)
STDMETHODIMP | RequestStart (long dwRequestID)
STDMETHODIMP | Restart ()
STDMETHODIMP | Restart ()
STDMETHODIMP | Restart ()
STDMETHODIMP | Shutdown ()
STDMETHODIMP | Shutdown ()
STDMETHODIMP | Shutdown ()
STDMETHODIMP | Size (long dwCharID, long lWidth, long lHeight)
STDMETHODIMP | Size (long dwCharID, long lWidth, long lHeight)
STDMETHODIMP | Size (long dwCharID, long lWidth, long lHeight)
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP | Suspend ()
STDMETHODIMP | VisibleState (long dwCharID, long bVisible, long lCause)
STDMETHODIMP | VisibleState (long dwCharID, long bVisible, long lCause)
STDMETHODIMP | VisibleState (long dwCharID, long bVisible, long lCause)

Private Attributes

ULONG m_cRefs
MainDlg * m_pMainDlg

Detailed Description

Definition at line 12 of file Notify.h.

Constructor & Destructor Documentation

AgentNotifySink::AgentNotifySink ( MainDlg * pMainDlg ) [inline]

Definition at line 14 of file Notify.h.

: m_cRefs(0), m_pMainDlg(pMainDlg) {}

AgentNotifySink::~AgentNotifySink ( ) [inline]

Definition at line 15 of file Notify.h.

{}

AgentNotifySink::AgentNotifySink ( ) [inline]

Definition at line 10 of file Notify.h.

: m_cRefs(0) {}

AgentNotifySink::~AgentNotifySink ( ) [inline]

Definition at line 11 of file Notify.h.

{}

AgentNotifySink::AgentNotifySink ( ) [inline]

Definition at line 10 of file Notify.h.

: m_cRefs(0) {}

AgentNotifySink::~AgentNotifySink ( ) [inline]

Definition at line 11 of file Notify.h.

{}

Member Function Documentation

STDMETHODIMP AgentNotifySink::ActivateInputState | ( | long | dwCharID,
 |  | long | bActivated
 | ) |  |

Definition at line 211 of file Notify.Cpp.

                                                                               {

  return NOERROR;
}

STDMETHODIMP AgentNotifySink::ActivateInputState | ( | long | dwCharID,
 |  | long | bActivated
 | ) |  |
STDMETHODIMP AgentNotifySink::ActivateInputState | ( | long | dwCharID,
 |  | long | bActivated
 | ) |  |
STDMETHODIMP AgentNotifySink::ActiveClientChange | ( | long | dwCharID,
 |  | long | lStatus
 | ) |  |
STDMETHODIMP AgentNotifySink::ActiveClientChange | ( | long | dwCharID,
 |  | long | bActive
 | ) |  |

Definition at line 338 of file Notify.Cpp.

                                                                            {

  return NOERROR;
}

STDMETHODIMP AgentNotifySink::ActiveClientChange | ( | long | dwCharID,
 |  | long | lStatus
 | ) |  |
STDMETHODIMP AgentNotifySink::AgentPropertyChange ( )
STDMETHODIMP AgentNotifySink::AgentPropertyChange ( )

Definition at line 328 of file Notify.Cpp.

                                                  {

  _ASSERT(m_pMainDlg);

  m_pMainDlg->OnPropertyChange();

  return NOERROR;
}

STDMETHODIMP AgentNotifySink::AgentPropertyChange ( )
STDMETHODIMP AgentNotifySink::BalloonVisibleState | ( | long | dwCharID,
 |  | long | bVisible
 | ) |  |

Definition at line 304 of file Notify.Cpp.

                                                                              {

  return NOERROR;
}

STDMETHODIMP AgentNotifySink::BalloonVisibleState | ( | long | dwCharID,
 |  | long | bVisible
 | ) |  |
STDMETHODIMP AgentNotifySink::BalloonVisibleState | ( | long | dwCharID,
 |  | long | bVisible
 | ) |  |
STDMETHODIMP AgentNotifySink::BookMark ( long dwBookMarkID )
STDMETHODIMP AgentNotifySink::BookMark ( long dwBookMarkID )

Definition at line 276 of file Notify.Cpp.

                                                        {

  return NOERROR;
}

STDMETHODIMP AgentNotifySink::BookMark ( long dwBookMarkID )
STDMETHODIMP AgentNotifySink::Click | ( | long | dwCharID,
 |  | short | fwKeys,
 |  | long | X,
 |  | long | Y
 | ) |  |
STDMETHODIMP AgentNotifySink::Click | ( | long | dwCharID,
 |  | short | fwKeys,
 |  | long | X,
 |  | long | Y
 | ) |  |
STDMETHODIMP AgentNotifySink::Click | ( | long | dwCharID,
 |  | short | fwKeys,
 |  | long | x,
 |  | long | y
 | ) |  |

Definition at line 235 of file Notify.Cpp.

                                                                               {

  _ASSERT(m_pMainDlg);

  if (fwKeys & MK_RBUTTON)
    m_pMainDlg->OnCharacterRightClick(x, y);

  return NOERROR;
}

STDMETHODIMP AgentNotifySink::Command | ( | long | dwCommandID,
 |  | IUnknown * | punkUserInput
 | ) |  |
STDMETHODIMP AgentNotifySink::Command | ( | long | dwCommandID,
 |  | IUnknown * | punkUserInput
 | ) |  |

Definition at line 201 of file Notify.Cpp.

                                                                                {

  _ASSERT(m_pMainDlg);

  m_pMainDlg->OnCharacterCommand(dwCommandID);

  return NOERROR;
}

STDMETHODIMP AgentNotifySink::Command | ( | long | dwCommandID,
 |  | IUnknown * | punkUserInput
 | ) |  |
STDMETHODIMP AgentNotifySink::DblClick | ( | long | dwCharID,
 |  | short | fwKeys,
 |  | long | X,
 |  | long | Y
 | ) |  |
STDMETHODIMP AgentNotifySink::DblClick | ( | long | dwCharID,
 |  | short | fwKeys,
 |  | long | X,
 |  | long | Y
 | ) |  |
STDMETHODIMP AgentNotifySink::DblClick | ( | long | dwCharID,
 |  | short | fwKeys,
 |  | long | x,
 |  | long | y
 | ) |  |

Definition at line 246 of file Notify.Cpp.

                                                                                {

  return NOERROR;
}

STDMETHODIMP AgentNotifySink::DefaultCharacterChange ( BSTR bszGUID )
STDMETHODIMP AgentNotifySink::DefaultCharacterChange ( BSTR bszGUID )

Definition at line 322 of file Notify.Cpp.

                                                                 {

  return NOERROR;
}

STDMETHODIMP AgentNotifySink::DefaultCharacterChange ( BSTR bszGUID )
STDMETHODIMP AgentNotifySink::DragComplete | ( | long | dwCharID,
 |  | short | fwKeys,
 |  | long | x,
 |  | long | y
 | ) |  |

Definition at line 258 of file Notify.Cpp.

                                                                                {

  return NOERROR;
}

STDMETHODIMP AgentNotifySink::DragComplete | ( | long | dwCharID,
 |  | short | fwKeys,
 |  | long | X,
 |  | long | Y
 | ) |  |
STDMETHODIMP AgentNotifySink::DragComplete | ( | long | dwCharID,
 |  | short | fwKeys,
 |  | long | X,
 |  | long | Y
 | ) |  |
STDMETHODIMP AgentNotifySink::DragStart | ( | long | dwCharID,
 |  | short | fwKeys,
 |  | long | X,
 |  | long | Y
 | ) |  |
STDMETHODIMP AgentNotifySink::DragStart | ( | long | dwCharID,
 |  | short | fwKeys,
 |  | long | X,
 |  | long | Y
 | ) |  |
STDMETHODIMP AgentNotifySink::DragStart | ( | long | dwCharID,
 |  | short | fwKeys,
 |  | long | x,
 |  | long | y
 | ) |  |

Definition at line 252 of file Notify.Cpp.

                                                                                {

  return NOERROR;
}

STDMETHODIMP AgentNotifySink::GetIDsOfNames | ( | REFIID | riid,
 |  | OLECHAR ** | rgszNames,
 |  | UINT | cNames,
 |  | LCID | lcid,
 |  | DISPID * | rgDispID
 | ) |  |

Definition at line 131 of file Notify.Cpp.

                                                                                {

    HRESULT hRes;
    ITypeInfo *pInfo;

  // REFIID must be NULL

  if (riid != IID_NULL)
        return ResultFromScode(DISP_E_UNKNOWNINTERFACE);

  // Get the TypeInfo for the specified lcid

    hRes = GetTypeInfo(0, lcid, &pInfo);

  if (FAILED(hRes))
    return hRes;

  // Use the TypeInfo to get the DISPIDs of the specified names.
  // That's the whole point here.  Let TypeInfo do the work so
  // we don't have to.

  hRes = pInfo->GetIDsOfNames(rgszNames, cNames, rgDispID);

  pInfo->Release();

    return hRes;
}

STDMETHODIMP AgentNotifySink::GetIDsOfNames | ( | REFIID | ,
 |  | OLECHAR ** | ,
 |  | UINT | ,
 |  | LCID | ,
 |  | DISPID * |
 | ) |  |
STDMETHODIMP AgentNotifySink::GetIDsOfNames | ( | REFIID | ,
 |  | OLECHAR ** | ,
 |  | UINT | ,
 |  | LCID | ,
 |  | DISPID * |
 | ) |  |
STDMETHODIMP AgentNotifySink::GetTypeInfo | ( | UINT | ,
 |  | LCID | ,
 |  | ITypeInfo ** |
 | ) |  |
STDMETHODIMP AgentNotifySink::GetTypeInfo | ( | UINT | itInfo,
 |  | LCID | lcid,
 |  | ITypeInfo ** | ppTypeInfo
 | ) |  |

Definition at line 93 of file Notify.Cpp.

                                                                                {

    HRESULT hRes;
    ITypeLib *pLib;

    *ppTypeInfo = NULL;

  if (itInfo != 0)
        return TYPE_E_ELEMENTNOTFOUND;

    if (ppTypeInfo == NULL)
        return E_POINTER;

  if ((PRIMARYLANGID(lcid) != LANG_NEUTRAL) &&
    (PRIMARYLANGID(lcid) != LANG_ENGLISH))
    return DISP_E_UNKNOWNLCID;

    hRes = LoadRegTypeLib(LIBID_AgentServerObjects,
              1,
              0,
              PRIMARYLANGID(lcid),
              &pLib);
    if (FAILED(hRes))
        return hRes;

  hRes = pLib->GetTypeInfoOfGuid(IID_IAgentNotifySinkEx, ppTypeInfo);

  pLib->Release();

    if (FAILED(hRes))
        return hRes;

    (*ppTypeInfo)->AddRef();

    return NOERROR;
}

STDMETHODIMP AgentNotifySink::GetTypeInfo | ( | UINT | ,
 |  | LCID | ,
 |  | ITypeInfo ** |
 | ) |  |
STDMETHODIMP AgentNotifySink::GetTypeInfoCount ( UINT * )
STDMETHODIMP AgentNotifySink::GetTypeInfoCount ( UINT * pctInfo )

Definition at line 86 of file Notify.Cpp.

                                                            {

    *pctInfo = 1;
    return NOERROR;
}

STDMETHODIMP AgentNotifySink::GetTypeInfoCount ( UINT * )
STDMETHODIMP AgentNotifySink::HelpComplete | ( | long | dwCharID,
 |  | long | dwCommandID,
 |  | long | dwCause
 | ) |  |
STDMETHODIMP AgentNotifySink::HelpComplete | ( | long | dwCharID,
 |  | long | dwCommandID,
 |  | long | dwCause
 | ) |  |

Definition at line 310 of file Notify.Cpp.

                                                                                {

  return NOERROR;
}

STDMETHODIMP AgentNotifySink::HelpComplete | ( | long | dwCharID,
 |  | long | dwCommandID,
 |  | long | dwCause
 | ) |  |
STDMETHODIMP AgentNotifySink::Idle | ( | long | dwCharID,
 |  | long | bStart
 | ) |  |
STDMETHODIMP AgentNotifySink::Idle | ( | long | dwCharID,
 |  | long | bStart
 | ) |  |

Definition at line 282 of file Notify.Cpp.

                                                             {

  return NOERROR;
}

STDMETHODIMP AgentNotifySink::Idle | ( | long | dwCharID,
 |  | long | bStart
 | ) |  |
STDMETHODIMP AgentNotifySink::Invoke | ( | DISPID | ,
 |  | REFIID | ,
 |  | LCID | ,
 |  | WORD | ,
 |  | DISPPARAMS * | ,
 |  | VARIANT * | ,
 |  | EXCEPINFO * | ,
 |  | UINT * |
 | ) |  |
STDMETHODIMP AgentNotifySink::Invoke | ( | DISPID | ,
 |  | REFIID | ,
 |  | LCID | ,
 |  | WORD | ,
 |  | DISPPARAMS * | ,
 |  | VARIANT * | ,
 |  | EXCEPINFO * | ,
 |  | UINT * |
 | ) |  |
STDMETHODIMP AgentNotifySink::Invoke | ( | DISPID | ,
 |  | REFIID | ,
 |  | LCID | ,
 |  | WORD | ,
 |  | DISPPARAMS * | ,
 |  | VARIANT * | ,
 |  | EXCEPINFO * | ,
 |  | UINT * |
 | ) |  |
STDMETHODIMP AgentNotifySink::ListeningState | ( | long | dwCharacterID,
 |  | long | bListenState,
 |  | long | dwCause
 | ) |  |
STDMETHODIMP AgentNotifySink::ListeningState | ( | long | dwCharID,
 |  | long | bListening,
 |  | long | dwCause
 | ) |  |

Definition at line 316 of file Notify.Cpp.

                                                                                {

  return NOERROR;
}

STDMETHODIMP AgentNotifySink::ListeningState | ( | long | dwCharacterID,
 |  | long | bListenState,
 |  | long | dwCause
 | ) |  |
STDMETHODIMP AgentNotifySink::Move | ( | long | dwCharID,
 |  | long | X,
 |  | long | Y,
 |  | long | lCause
 | ) |  |
STDMETHODIMP AgentNotifySink::Move | ( | long | dwCharID,
 |  | long | X,
 |  | long | Y,
 |  | long | lCause
 | ) |  |
STDMETHODIMP AgentNotifySink::Move | ( | long | dwCharID,
 |  | long | x,
 |  | long | y,
 |  | long | lCause
 | ) |  |

Definition at line 288 of file Notify.Cpp.

                                                                             {

  _ASSERT(m_pMainDlg);

  m_pMainDlg->OnCharacterMove(x, y);

  return NOERROR;
}

STDMETHODIMP AgentNotifySink::QueryInterface | ( | REFIID | ,
 |  | LPVOID FAR * |
 | ) |  |
STDMETHODIMP AgentNotifySink::QueryInterface | ( | REFIID | ,
 |  | LPVOID FAR * |
 | ) |  |
STDMETHODIMP AgentNotifySink::QueryInterface | ( | REFIID | ,
 |  | LPVOID FAR * |
 | ) |  |
STDMETHODIMP AgentNotifySink::RequestComplete | ( | long | dwRequestID,
 |  | long | hrStatus
 | ) |  |
STDMETHODIMP AgentNotifySink::RequestComplete | ( | long | dwRequestID,
 |  | long | hrStatus
 | ) |  |
STDMETHODIMP AgentNotifySink::RequestComplete | ( | long | dwRequestID,
 |  | long | hrStatus
 | ) |  |

Definition at line 270 of file Notify.Cpp.

                                                                             {

  return NOERROR;
}

STDMETHODIMP AgentNotifySink::RequestStart ( long dwRequestID )

Definition at line 264 of file Notify.Cpp.

                                                           {

  return NOERROR;
}

STDMETHODIMP AgentNotifySink::RequestStart ( long dwRequestID )
STDMETHODIMP AgentNotifySink::RequestStart ( long dwRequestID )
STDMETHODIMP AgentNotifySink::Restart ( )
STDMETHODIMP AgentNotifySink::Restart ( )

Definition at line 217 of file Notify.Cpp.

                                      {

  return NOERROR;
}

STDMETHODIMP AgentNotifySink::Restart ( )
STDMETHODIMP AgentNotifySink::Shutdown ( )
STDMETHODIMP AgentNotifySink::Shutdown ( )

Definition at line 223 of file Notify.Cpp.

                                       {

  return NOERROR;
}

STDMETHODIMP AgentNotifySink::Shutdown ( )
STDMETHODIMP AgentNotifySink::Size | ( | long | dwCharID,
 |  | long | lWidth,
 |  | long | lHeight
 | ) |  |

Definition at line 298 of file Notify.Cpp.

                                                                           {

  return NOERROR;
}

STDMETHODIMP AgentNotifySink::Size | ( | long | dwCharID,
 |  | long | lWidth,
 |  | long | lHeight
 | ) |  |
STDMETHODIMP AgentNotifySink::Size | ( | long | dwCharID,
 |  | long | lWidth,
 |  | long | lHeight
 | ) |  |
AgentNotifySink::STDMETHODIMP_ ( ULONG )
AgentNotifySink::STDMETHODIMP_ ( ULONG )
AgentNotifySink::STDMETHODIMP_ ( ULONG )
AgentNotifySink::STDMETHODIMP_ ( ULONG )
AgentNotifySink::STDMETHODIMP_ ( ULONG )
AgentNotifySink::STDMETHODIMP_ ( ULONG )
STDMETHODIMP AgentNotifySink::Suspend ( )
STDMETHODIMP AgentNotifySink::VisibleState | ( | long | dwCharID,
 |  | long | bVisible,
 |  | long | lCause
 | ) |  |

Definition at line 229 of file Notify.Cpp.

                                                                                {

  return NOERROR;
}

STDMETHODIMP AgentNotifySink::VisibleState | ( | long | dwCharID,
 |  | long | bVisible,
 |  | long | lCause
 | ) |  |
STDMETHODIMP AgentNotifySink::VisibleState | ( | long | dwCharID,
 |  | long | bVisible,
 |  | long | lCause
 | ) |  |

Member Data Documentation

ULONG AgentNotifySink::m_cRefs [private]

Definition at line 51 of file Notify.h.

MainDlg* AgentNotifySink::m_pMainDlg [private]

Definition at line 52 of file Notify.h.

The documentation for this class was generated from the following files:
  • Web/MSAgent/c/Cap/Notify.h
  • Web/MSAgent/c/Hello2/Notify.h
  • Web/MSAgent/c/Hello3/Notify.h
  • Web/MSAgent/c/Cap/Notify.Cpp
  • Web/MSAgent/c/Hello2/Notify.Cpp
  • Web/MSAgent/c/Hello3/Notify.Cpp
Generated on Wed Nov 13 2024 16:55:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: APIHook< T > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

APIHook< T > Class Template Reference

#include "ApiHook.Hpp"

List of all members.

Public Member Functions

APIHook (const T *returnValue, const char *const libraryName, const bool preAPI)
const char *const | libName ()
const bool | preAPI ()
const T * | rValue ()

Private Member Functions

APIHook ()

Private Attributes

const char *const | _libName
const bool | _preAPI
const T * | _rValue

Detailed Description

template<class T>
class APIHook< T >

Definition at line 18 of file ApiHook.Hpp.

Constructor & Destructor Documentation

template<class T>
APIHook< T >::APIHook ( ) [private]
template<class T>
APIHook< T >::APIHook | ( | const T * | returnValue,
 |  | const char *const | libraryName,
 |  | const bool | preAPI |
 | ) |  |  | [inline]

Definition at line 28 of file ApiHook.Hpp.

                                                                                :
            _rValue(returnValue), _libName(libraryName), _preAPI(preAPI) {}

Member Function Documentation

template<class T>
const char* const APIHook< T >::libName ( ) [inline]

Definition at line 35 of file ApiHook.Hpp.

{ return (_libName); }

template<class T>
const bool APIHook< T >::preAPI ( ) [inline]

Definition at line 38 of file ApiHook.Hpp.

{ return (_preAPI); }

template<class T>
const T* APIHook< T >::rValue ( ) [inline]

Definition at line 32 of file ApiHook.Hpp.

{ return (_rValue); }

Member Data Documentation

template<class T>
const char* const APIHook< T >::_libName [private]

Definition at line 23 of file ApiHook.Hpp.

template<class T>
const bool APIHook< T >::_preAPI [private]

Definition at line 24 of file ApiHook.Hpp.

template<class T>
const T* APIHook< T >::_rValue [private]

Definition at line 22 of file ApiHook.Hpp.

The documentation for this class was generated from the following file:
  • NetDS/WinSock/Dt_Dll2/ApiHook.Hpp
Generated on Wed Nov 13 2024 16:55:28 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: APMFILEHEADER Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

APMFILEHEADER Struct Reference

#include "MfEdit.h"

List of all members.

Public Attributes

SMALL_RECT | bbox
WORD | checksum
WORD | hmf
WORD | inch
DWORD key
DWORD reserved

Detailed Description

Definition at line 283 of file MfEdit.h.

Member Data Documentation

SMALL_RECT APMFILEHEADER::bbox

Definition at line 287 of file MfEdit.h.

WORD APMFILEHEADER::checksum

Definition at line 290 of file MfEdit.h.

WORD APMFILEHEADER::hmf

Definition at line 286 of file MfEdit.h.

WORD APMFILEHEADER::inch

Definition at line 288 of file MfEdit.h.

DWORD APMFILEHEADER::key

Definition at line 285 of file MfEdit.h.

DWORD APMFILEHEADER::reserved

Definition at line 289 of file MfEdit.h.

The documentation for this struct was generated from the following file:
  • Multimedia/Gdi/Metafile/MfEdit/MfEdit.h
Generated on Wed Nov 13 2024 16:55:28 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: AppEvents Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

AppEvents Interface Reference

import "Proxy.idl";

Inherits com::ms::com::IUnknown.

Inherited by CEvent.

List of all members.

Public Member Functions

HRESULT Beep ([in] short alert)

Detailed Description

Definition at line 42 of file Proxy.idl.

Member Function Documentation

HRESULT AppEvents::Beep ( [in] short alert )

Implemented in CEvent.

The documentation for this interface was generated from the following file:
  • Com/async/proxy/Proxy.idl
Generated on Wed Nov 13 2024 16:55:28 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ARRAYQ Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

ARRAYQ Class Reference

#include "MqApiTst.h"

List of all members.

Public Member Functions

ARRAYQ ()

Public Attributes

BOOL bFormatNameOnly
DWORD dwAccess
QUEUEHANDLE | hHandle
TCHAR | szFormatName [MAX_Q_FORMATNAME_LEN]
TCHAR | szPathName [MAX_Q_PATHNAME_LEN]

Detailed Description

Definition at line 69 of file MqApiTst.h.

Constructor & Destructor Documentation

ARRAYQ::ARRAYQ ( ) [inline]

Definition at line 78 of file MqApiTst.h.

     :
    dwAccess(0),
    bFormatNameOnly(0),
    hHandle(0)
    {
      szPathName[0]=0;
      szFormatName[0]=0;
    }

Member Data Documentation

BOOL ARRAYQ::bFormatNameOnly

Definition at line 75 of file MqApiTst.h.

DWORD ARRAYQ::dwAccess

Definition at line 74 of file MqApiTst.h.

QUEUEHANDLE ARRAYQ::hHandle

Definition at line 73 of file MqApiTst.h.

TCHAR ARRAYQ::szFormatName[MAX_Q_FORMATNAME_LEN]

Definition at line 72 of file MqApiTst.h.

TCHAR ARRAYQ::szPathName[MAX_Q_PATHNAME_LEN]

Definition at line 71 of file MqApiTst.h.

The documentation for this class was generated from the following file:
  • NetDS/MessageQueuing/MqApiTst/MqApiTst.h
Generated on Wed Nov 13 2024 16:55:28 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Async_Lib::AsyncTest Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • Async_Lib
  • Async_Lib::AsyncTest

Async_Lib::AsyncTest Class Reference

import "Proxy.idl";

Detailed Description

Definition at line 67 of file Proxy.idl.

The documentation for this class was generated from the following file:
  • Com/async/proxy/Proxy.idl
Generated on Wed Nov 13 2024 16:58:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ASYNC_REQUESTER Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends

ASYNC_REQUESTER Class Reference

#include "browser.h"

List of all members.

Public Member Functions

ASYNC_REQUESTER (UINT nRequesterID, SIMPLE_BROWSER *pBrowser)
~ASYNC_REQUESTER ()
BOOL | Open (PWSTR pwszUrl, BOOL fProxyAutoDiscovery, BOOL fProxyFailover, UINT nFailureRetries, UINT nTimeLimit)
VOID | RequestToShutdown ()
BOOL Start ()

Private Types

enum | { READ_BUFFER_SIZE = 1024 }
enum STATE {
INIT, OPENED, ERROR, SENDING,
RECEIVING, HEADERS_AVAILABLE, WAITING_FOR_DATA, DATA_AVAILABLE,
DATA_EXHAUSTED, CLOSING, CLOSED
}

Private Member Functions

VOID | Close ()
VOID | OnHandleClosing (HINTERNET)
VOID | OnHeadersAvailable ()
VOID | OnReadComplete (DWORD dwBytesRead)
VOID | OnRequestError (LPWINHTTP_ASYNC_RESULT)
VOID | OnSendRequestComplete ()

Private Attributes

LIST_ENTRY | _List
int | m_ContentLength
DWORD m_dwBytesReadSoFar
DWORD m_dwErrorAPI
DWORD m_dwLastError
DWORD m_dwStartingTime
DWORD m_dwTimeLimit
BOOL m_fClosing
BOOL m_fProxyAutoDiscovery
BOOL m_fProxyFailover
HINTERNET | m_hConnect
HINTERNET | m_hRequest
UINT m_nFailureRetries
UINT m_nID
int | m_nNumAttempts
SIMPLE_BROWSER * m_pBrowser
WINHTTP_PROXY_INFO | m_ProxyInfo
LPWSTR | m_pwszNextProxies
PWSTR m_pwszUrl
BYTE | m_ReadBuffer [READ_BUFFER_SIZE]
STATE m_State
int | m_TimeRemaining

Friends

void CALLBACK | RequesterStatusCallback (HINTERNET hInternet, DWORD_PTR dwContext, DWORD dwInternetStatus, LPVOID lpvStatusInformation, DWORD dwStatusInformationLength)
class | SIMPLE_BROWSER

Detailed Description

Definition at line 51 of file browser.h.

Member Enumeration Documentation

anonymous enum [private]
Enumerator:
READ_BUFFER_SIZE

Definition at line 130 of file browser.h.

{ READ_BUFFER_SIZE = 1024 };

enum ASYNC_REQUESTER::STATE [private]
Enumerator:
INIT
OPENED
ERROR
SENDING
RECEIVING
HEADERS_AVAILABLE
WAITING_FOR_DATA
DATA_AVAILABLE
DATA_EXHAUSTED
CLOSING
CLOSED

Definition at line 91 of file browser.h.

    {
        INIT,
        OPENED,
        ERROR,
        SENDING,
        RECEIVING,
        HEADERS_AVAILABLE,
        WAITING_FOR_DATA,
        DATA_AVAILABLE,
        DATA_EXHAUSTED,
        CLOSING,
        CLOSED
    };

Constructor & Destructor Documentation

ASYNC_REQUESTER::ASYNC_REQUESTER | ( | UINT | nRequesterID,
 |  | SIMPLE_BROWSER * | pBrowser
 | ) |  |

Definition at line 421 of file browser.cpp.

{
    m_hConnect = NULL;
    m_hRequest = NULL;

    m_pwszUrl = NULL;

    m_nID = nRequesterID;
    m_pBrowser = pBrowser;

    m_fProxyAutoDiscovery = FALSE;
    m_fProxyFailover = FALSE;
    m_nFailureRetries = 0;

    ZeroMemory(&m_ProxyInfo, sizeof(m_ProxyInfo));

    m_pwszNextProxies = NULL;

    m_State = INIT;

    m_fClosing = FALSE;

    m_dwLastError = ERROR_SUCCESS;

    m_ContentLength = -1;
    m_dwBytesReadSoFar = 0;
}

ASYNC_REQUESTER::~ASYNC_REQUESTER ( )

Definition at line 451 of file browser.cpp.

{
    if (m_ProxyInfo.lpszProxy)
    {
        ::GlobalFree(m_ProxyInfo.lpszProxy);
    }
    if (m_ProxyInfo.lpszProxyBypass)
    {
        ::GlobalFree(m_ProxyInfo.lpszProxyBypass);
    }
    if (m_pwszUrl)
    {
        delete [] m_pwszUrl;
    }
}

Member Function Documentation

VOID ASYNC_REQUESTER::Close ( ) [private]
VOID ASYNC_REQUESTER::OnHandleClosing ( HINTERNET hRequest ) [private]

Definition at line 1218 of file browser.cpp.

{
    DWORD dwThreadId = ::GetCurrentThreadId();

    ASSERT(hRequest == m_hRequest);

    if (m_State == CLOSING)
    {
        m_State = CLOSED;

        ASSERT(m_pBrowser != NULL);

        fprintf(stdout,
                "[%d] Requester #%d shuts down.\n",
                dwThreadId,
                m_nID);

        m_pBrowser->OnRequesterClosed(this);
    }
}

VOID ASYNC_REQUESTER::OnHeadersAvailable ( ) [private]

Definition at line 829 of file browser.cpp.

{
    DWORD dwThreadId = ::GetCurrentThreadId();

    if (m_fClosing)
    {
        fprintf(stdout,
               "[%d] The Requester #%d stops downloading from %S; it's signaled to shut down.\n",
                dwThreadId,
                m_nID,
                m_pwszUrl);

        m_State = CLOSING;
        goto exit;
    }

    m_TimeRemaining = m_dwTimeLimit - (::GetTickCount() - m_dwStartingTime);
    if (m_TimeRemaining <= 0)
    {
        fprintf(stderr,
                "[%d] The Requester #%d timed out fetching %S; elapsed time = %d.\n",
                dwThreadId,
                m_nID,
                m_pwszUrl,
                m_dwTimeLimit);

        m_TimeRemaining = 0;

        m_State = ERROR;
        goto exit;
    }

    m_State = HEADERS_AVAILABLE;

    DWORD dwStatusCode = 0;
    DWORD dwSize = sizeof(DWORD);

    if (::WinHttpQueryHeaders(m_hRequest,
                             WINHTTP_QUERY_STATUS_CODE | WINHTTP_QUERY_FLAG_NUMBER,
                             NULL,
                             &dwStatusCode,
                             &dwSize,
                             NULL) == FALSE)
    {
        m_dwLastError = ::GetLastError();

        fprintf(stderr,
                "[%d] The Requester #%d failed to fetch %S, WinHttpQueryHeaders() failed; error = %d.\n",
                dwThreadId,
                m_nID,
                m_pwszUrl,
                m_dwLastError);

        m_State = ERROR;
        goto exit;
    }

    if ((dwStatusCode == HTTP_STATUS_DENIED) || (dwStatusCode == HTTP_STATUS_PROXY_AUTH_REQ))
    {
        fprintf(stderr,
                "[%d] The Requester #%d failed to fetch %S, the proxy or server requires authentication; Status Code = %d.\n",
                dwThreadId,
                m_nID,
                m_pwszUrl,
                dwStatusCode);

        // NOTE: This sample does not show how authentication should be handled; please refer to the
        // authentication sample in this SDK to see how credentials should be supplied in respond
        // to auth requests.

        m_dwLastError = dwStatusCode;

        m_State = ERROR;
        goto exit;
    }

    if (dwStatusCode != HTTP_STATUS_OK)
    {
        fprintf(stderr,
                "[%d] The Requester #%d failed to fetch %S; Status Code = %d.\n",
                dwThreadId,
                m_nID,
                m_pwszUrl,
                dwStatusCode);

        m_dwLastError = dwStatusCode;

        m_State = ERROR;
        goto exit;
    }

    DWORD dwContentLength = 0;
    DWORD dwCLSize = sizeof(DWORD);

    if (::WinHttpQueryHeaders(m_hRequest,
                             WINHTTP_QUERY_CONTENT_LENGTH | WINHTTP_QUERY_FLAG_NUMBER,
                             NULL,
                             &dwContentLength,
                             &dwCLSize,
                             NULL) == FALSE)
    {
        m_dwLastError = ::GetLastError();

        fprintf(stderr,
                "[%d] The Requester #%d failed to fetch %S, WinHttpQueryHeaders() failed; error = %d.\n",
                dwThreadId,
                m_nID,
                m_pwszUrl,
                m_dwLastError);

    }
    else
    {
        fprintf(stdout,
            "[%d] The Requester #%d attemps to download %d bytes of data from %S.\n",
            dwThreadId,
            m_nID,
            dwContentLength,
            m_pwszUrl);

        m_ContentLength = dwContentLength;
    }

    m_State = WAITING_FOR_DATA;

    if (::WinHttpReadData(m_hRequest,
                          m_ReadBuffer,
                          READ_BUFFER_SIZE,
                          NULL) == FALSE)
    {
        m_dwLastError = ::GetLastError();
        fprintf(stderr,
                "[%d] The Requester #%d failed to read data from %S, WinHttpReadData() failed; error = %d.\n",
                dwThreadId,
                m_nID,
                m_pwszUrl,
                m_dwLastError);

        m_State = ERROR;
        goto exit;
    }

    return;

exit:

    m_pBrowser->OnRequesterStopped(this);
}

VOID ASYNC_REQUESTER::OnReadComplete ( DWORD dwBytesRead ) [private]

Definition at line 979 of file browser.cpp.

{
   DWORD dwThreadId = ::GetCurrentThreadId();

    if (m_fClosing)
    {
        fprintf(stdout,
               "[%d] The Requester #%d stops downloading from %S; it's signaled to shut down.\n",
                dwThreadId,
                m_nID,
                m_pwszUrl);

        m_State = CLOSING;
        goto exit;
    }

    m_TimeRemaining = m_dwTimeLimit - (::GetTickCount() - m_dwStartingTime);
    if (m_TimeRemaining <= 0)
    {
        fprintf(stderr,
                "[%d] The Requester #%d timed out fetching %S; elapsed time = %d.\n",
                dwThreadId,
                m_nID,
                m_pwszUrl,
                m_dwTimeLimit);

        m_TimeRemaining = 0;

        m_State = ERROR;
        goto exit;
    }

    if (dwBytesRead == 0)
    {
        m_State = DATA_EXHAUSTED;

        fprintf(stdout,
            "[%d] Requester #%d has downloaded all data from from %S.\n",
            dwThreadId,
            m_nID,
            m_pwszUrl);

        goto exit;
    }
    else
    {
        m_State = DATA_AVAILABLE;

        m_dwBytesReadSoFar += dwBytesRead;

        fprintf(stdout,
                "[%d] Requester #%d has downloaded %d bytes from from %S",
                dwThreadId,
                m_nID,
                m_dwBytesReadSoFar,
                m_pwszUrl);

        if (m_ContentLength == -1)
        {
            fprintf(stdout, ".\n");  // total size unknown
        }
        else
        {
            fprintf(stdout, " (%.2f%% Complete).\n", ((float)m_dwBytesReadSoFar/m_ContentLength) * 100);
        }

    }

    m_State = WAITING_FOR_DATA;

    if (::WinHttpReadData(m_hRequest,
                          m_ReadBuffer,
                          READ_BUFFER_SIZE,
                          NULL) == FALSE)
    {
        m_dwLastError = ::GetLastError();

        fprintf(stderr,
                "[%d] The Requester #%d failed to read data from %S, WinHttpReadData() failed; error = %d.\n",
                dwThreadId,
                m_nID,
                m_pwszUrl,
                m_dwLastError);

        m_State = ERROR;
        goto exit;
    }

    return;

exit:

    m_pBrowser->OnRequesterStopped(this);
}

VOID ASYNC_REQUESTER::OnRequestError ( LPWINHTTP_ASYNC_RESULT pAsyncResult ) [private]

Definition at line 1076 of file browser.cpp.

{
    DWORD dwThreadId = ::GetCurrentThreadId();

    if (m_fClosing)
    {
        fprintf(stdout,
               "[%d] The Requester #%d stops downloading from %S; it's signaled to shut down.\n",
                dwThreadId,
                m_nID,
                m_pwszUrl);

        m_State = CLOSING;
        goto exit;
    }

    m_TimeRemaining = m_dwTimeLimit - (::GetTickCount() - m_dwStartingTime);
    if (m_TimeRemaining <= 0)
    {
        fprintf(stderr,
                "[%d] The Requester #%d timed out fetching %S; elapsed time = %d.\n",
                dwThreadId,
                m_nID,
                m_pwszUrl,
                m_dwTimeLimit);

        m_TimeRemaining = 0;

        m_State = ERROR;
        goto exit;
    }

    m_State = ERROR;

    m_dwErrorAPI = (DWORD)pAsyncResult->dwResult;
    m_dwLastError = pAsyncResult->dwError;

    if (m_dwErrorAPI == API_SEND_REQUEST)
    {
        if (m_dwLastError == ERROR_WINHTTP_CANNOT_CONNECT || m_dwLastError == ERROR_WINHTTP_NAME_NOT_RESOLVED)
        {
            fprintf(stderr,
                    "[%d] The Requester #%d failed to fetch %S, WinHttpSendRequest() c/b failed; error = %d.\n",
                    dwThreadId,
                    m_nID,
                    m_pwszUrl,
                    m_dwLastError);

            // *** proxy failover logic ***

            // WinHttp 5.1 has a limitation that it only uses the first proxy in a WINHTTP_PROXY_INFO structure
            // to attempt connect. Here we try to work around that by feeding the rest of the proxies and force
            // winHttp to retry.

            if (m_fProxyFailover && m_pwszNextProxies && m_pwszNextProxies[0])
            {
                WINHTTP_PROXY_INFO NextProxiesInfo;
                NextProxiesInfo.dwAccessType = WINHTTP_ACCESS_TYPE_NAMED_PROXY;
                NextProxiesInfo.lpszProxy = m_pwszNextProxies;
                NextProxiesInfo.lpszProxyBypass = m_ProxyInfo.lpszProxyBypass;

                m_pwszNextProxies = ::wcschr(m_pwszNextProxies, L';');
                if (m_pwszNextProxies)
                {
                    ++m_pwszNextProxies;
                }

                if (::WinHttpSetOption(m_hRequest,
                                       WINHTTP_OPTION_PROXY,
                                       &NextProxiesInfo,
                                       sizeof(NextProxiesInfo)) == TRUE)
                {
                    fprintf(stdout,
                            "[%d] The Requester #%d retries sending using a new proxy list %S.\n",
                            dwThreadId,
                            m_nID,
                            NextProxiesInfo.lpszProxy);
                }
            }
        }
    }
    else if (m_dwErrorAPI == API_RECEIVE_RESPONSE)
    {
        if (m_dwLastError == ERROR_WINHTTP_CLIENT_AUTH_CERT_NEEDED)
        {
            fprintf(stderr,
                    "[%d] The Requester #%d failed to fetch %S, WinHttpReceiveResponse() c/b failed; the server requires SSL client auth.\n",
                    dwThreadId,
                    m_nID,
                    m_pwszUrl);

            // NOTE: This sample does not show how SSL client authentication should be handled; please refer to the
            // SSL client authentication sample in this SDK to see how a client certificate should be supplied in respond
            // to SSL client auth requests.
        }
        else
        {
            fprintf(stderr,
                    "[%d] The Requester #%d failed to fetch %S, WinHttpReceiveResponse() c/b failed; error = %d.\n",
                    dwThreadId,
                    m_nID,
                    m_pwszUrl,
                    m_dwLastError);
        }
    }
    else if (m_dwErrorAPI == API_READ_DATA)
    {
        fprintf(stderr,
                "[%d] The Requester #%d failed to read data from %S, WinHttpReadData() c/b failed; error = %d\n",
                dwThreadId,
                m_nID,
                m_pwszUrl,
                m_dwLastError);
    }

exit:

    m_pBrowser->OnRequesterStopped(this);
}

VOID ASYNC_REQUESTER::OnSendRequestComplete ( ) [private]

Definition at line 772 of file browser.cpp.

{
    DWORD dwThreadId = ::GetCurrentThreadId();

    if (m_fClosing)
    {
        fprintf(stdout,
               "[%d] The Requester #%d stops downloading from %S; it's signaled to shut down.\n",
                dwThreadId,
                m_nID,
                m_pwszUrl);

        m_State = CLOSING;
        goto exit;
    }

    m_TimeRemaining = m_dwTimeLimit - (::GetTickCount() - m_dwStartingTime);
    if (m_TimeRemaining <= 0)
    {
        fprintf(stderr,
                "[%d] The Requester #%d timed out fetching %S; elapsed time = %d.\n",
                dwThreadId,
                m_nID,
                m_pwszUrl,
                m_dwTimeLimit);

        m_TimeRemaining = 0;

        m_State = ERROR;
        goto exit;
    }

    m_State = RECEIVING;

    if (::WinHttpReceiveResponse(m_hRequest, NULL) == FALSE)
    {
        m_dwLastError = ::GetLastError();

        fprintf(stderr,
                "[%d] The Requester #%d failed to fetch %S, WinHttpReceiveResponse() failed; error = %d.\n",
                dwThreadId,
                m_nID,
                m_pwszUrl,
                m_dwLastError);

        m_State = ERROR;
        goto exit;
    }

    return;

exit:

    m_pBrowser->OnRequesterStopped(this);
}

BOOL ASYNC_REQUESTER::Open | ( | PWSTR | pwszUrl,
 |  | BOOL | fProxyAutoDiscovery,
 |  | BOOL | fProxyFailover,
 |  | UINT | nFailureRetries,
 |  | UINT | nTimeLimit
 | ) |  |

Definition at line 503 of file browser.cpp.

{
    m_fProxyFailover = fProxyFailover;

    ASSERT(pwszUrl != NULL);
    m_pwszUrl = new WCHAR[::wcslen(pwszUrl) + 1];
    if (m_pwszUrl == NULL)
    {
        fprintf(stderr,
                "Requester #%d failed to open; not enough memory.\n",
                m_nID);

        goto error_exit;
    }
    ::wcscpy(m_pwszUrl, pwszUrl);

    m_nNumAttempts = nFailureRetries + 1;

    m_dwStartingTime = ::GetTickCount();
    m_TimeRemaining = m_dwTimeLimit = dwTimeLimit * 1000;

    BOOL fProxyDiscovered = FALSE;

    if (fProxyAutoDiscovery)
    {
        fprintf(stdout,
                "Requester #%d is detecting proxy settings for %S...\n",
                m_nID,
                m_pwszUrl);

        WINHTTP_AUTOPROXY_OPTIONS AutoProxyOptions;
        ZeroMemory(&AutoProxyOptions, sizeof(AutoProxyOptions));

        AutoProxyOptions.dwFlags = WINHTTP_AUTOPROXY_AUTO_DETECT;
        AutoProxyOptions.dwAutoDetectFlags = WINHTTP_AUTO_DETECT_TYPE_DHCP | WINHTTP_AUTO_DETECT_TYPE_DNS_A;
        AutoProxyOptions.lpszAutoConfigUrl = NULL;
        AutoProxyOptions.fAutoLogonIfChallenged = TRUE;

        if (::WinHttpGetProxyForUrl(m_pBrowser->m_hSession,
                                    m_pwszUrl,
                                    &AutoProxyOptions,
                                    &m_ProxyInfo) == FALSE)
        {
            fprintf(stderr,
                   "Requester #%d failed to discover proxy info; ::WinHttpGetProxyForUrl() failed; error = %d.\n",
                    m_nID,
                    ::GetLastError());

            WINHTTP_PROXY_INFO pi;
            pi.dwAccessType = WINHTTP_ACCESS_TYPE_DEFAULT_PROXY;
            pi.lpszProxy = NULL;
            pi.lpszProxyBypass = NULL;

            if (::WinHttpSetOption(m_hRequest,
                                WINHTTP_OPTION_PROXY,
                                &pi,
                                sizeof(pi)) == FALSE)
            {
                fprintf(stderr,
                    "Requester #%d failed to open; ::WinHttpSetOption() failed; error = %d.\n",
                        m_nID,
                        ::GetLastError());

                goto error_exit;
            }
        }
        else
        {
            fProxyDiscovered = TRUE;

            fprintf(stdout,
                    "Requester #%d detected the proxy settings for %S is %S.\n",
                    m_nID,
                    m_pwszUrl,
                    m_ProxyInfo.lpszProxy
                    );
        }
    }

    if (!fProxyDiscovered)
    {
        DWORD dwProxyInfoSize = sizeof(m_ProxyInfo);
        ::WinHttpQueryOption(NULL, // query for global proxy config
                             WINHTTP_OPTION_PROXY,
                             &m_ProxyInfo,
                             &dwProxyInfoSize);

    }

    if (fProxyFailover && m_ProxyInfo.lpszProxy)
    {
        m_pwszNextProxies = ::wcschr(m_ProxyInfo.lpszProxy, L';');
        if (m_pwszNextProxies)
        {
            ++m_pwszNextProxies;
        }
    }

    URL_COMPONENTS UrlComponents;
    ZeroMemory(&UrlComponents, sizeof(UrlComponents));
    UrlComponents.dwStructSize = sizeof(UrlComponents);

    UrlComponents.dwSchemeLength    = (DWORD)-1;
    UrlComponents.dwHostNameLength  = (DWORD)-1;
    UrlComponents.dwUrlPathLength   = (DWORD)-1;

    if (::WinHttpCrackUrl(m_pwszUrl,
                      (DWORD)::wcslen(m_pwszUrl),
                      0,
                      &UrlComponents) == NULL)
    {
        fprintf(stderr,
               "Requester #%d failed to open; ::WinHttpCrackUrl() failed; error = %d.\n",
                m_nID,
                ::GetLastError());

        goto error_exit;
    }

    WCHAR wCharSave = UrlComponents.lpszHostName[UrlComponents.dwHostNameLength];
    UrlComponents.lpszHostName[UrlComponents.dwHostNameLength] = L'\0';

    m_hConnect = ::WinHttpConnect(m_pBrowser->m_hSession,
                                  UrlComponents.lpszHostName,
                                  UrlComponents.nPort,
                                  0);

    UrlComponents.lpszHostName[UrlComponents.dwHostNameLength] = wCharSave;

    if (m_hConnect == NULL)
    {
        fprintf(stderr,
               "Requester #%d failed to open; ::WinHttpConnect() failed; error = %d.\n",
                m_nID,
                ::GetLastError());

        goto error_exit;
    }

    m_hRequest = ::WinHttpOpenRequest(m_hConnect,
                                      L"GET",
                                      UrlComponents.lpszUrlPath,
                                      L"HTTP/1.1",
                                      WINHTTP_NO_REFERER,
                                      WINHTTP_DEFAULT_ACCEPT_TYPES,
                                      (UrlComponents.nScheme == INTERNET_SCHEME_HTTPS) ? WINHTTP_FLAG_SECURE : 0);

    if (m_hRequest == NULL)
    {
        fprintf(stderr,
               "Requester #%d failed to open; ::WinHttpOpenRequest() failed; error = %d.\n",
                m_nID,
                ::GetLastError());

        goto error_exit;
    }

    if (::WinHttpSetOption(m_hRequest,
                           WINHTTP_OPTION_PROXY,
                           &m_ProxyInfo,
                           sizeof(m_ProxyInfo)) == FALSE)
    {
        fprintf(stderr,
               "Requester #%d failed to open; ::WinHttpSetOption() failed; error = %d.\n",
                m_nID,
                ::GetLastError());

        goto error_exit;
    }

    // in some cases we need to abort the transaction beforing sending (i.e. calling WinHttpSendRequest()), to make sure we
    // can point back to this object in thoses cases we need to set the context here.

    void* _this = this;
    if (::WinHttpSetOption(m_hRequest,
                           WINHTTP_OPTION_CONTEXT_VALUE,
                           &_this,
                           sizeof(this)) == FALSE)
    {
        fprintf(stderr,
               "Requester #%d failed to open; ::WinHttpSetOption() failed; error = %d.\n",
                m_nID,
                ::GetLastError());

        goto error_exit;
    }

    ::WinHttpSetStatusCallback(m_hRequest,
                               RequesterStatusCallback,
                               WINHTTP_CALLBACK_FLAG_ALL_COMPLETIONS |
                               WINHTTP_CALLBACK_FLAG_HANDLES,   // to listen to the HANDLE_CLOSING event
                               0);

    m_State = OPENED;

    return TRUE;

error_exit:

    if (m_hRequest)
    {
        ::WinHttpCloseHandle(m_hRequest);
        // m_hRequest will be set to NULL during the HANDLE_CLOSING callback
    }
    if (m_hConnect)
    {
        ::WinHttpCloseHandle(m_hConnect);
        m_hConnect = NULL;
    }
    return FALSE;
}

VOID ASYNC_REQUESTER::RequestToShutdown ( )

Definition at line 1200 of file browser.cpp.

{
    DWORD dwThreadId = ::GetCurrentThreadId();

    fprintf(stdout,
            "[%d] Requester #%d has been signaled to shutdown.\n",
            dwThreadId,
            m_nID);

    m_fClosing = TRUE;

    // this will cause an on-going request to transit to CLOSING state. The browser
    // will then be notified the CLOSING event, and it can then safely call
    // ASYNC_REQUESTER::Close().

    // if a requester has been stopped, it can be safely closed w/o calling RequestToShutdown() first.
}

BOOL ASYNC_REQUESTER::Start ( )

Definition at line 721 of file browser.cpp.

{
    DWORD dwThreadId = ::GetCurrentThreadId();

    // make sure we are in the right state to kick start a transaction
    if (m_State != OPENED &&
        m_State != ERROR  &&
        m_State != DATA_EXHAUSTED)
    {
        return FALSE;
    }

    if (m_nNumAttempts-- <= 0)
    {
        m_State = ERROR;
        m_dwLastError = (DWORD)-1; // retry limit is up
        return FALSE;
    }

    // initialize or re-initialize states

    m_ContentLength = -1;
    m_dwBytesReadSoFar = 0;

    m_State = SENDING;

    if (::WinHttpSendRequest(m_hRequest,
                             WINHTTP_NO_ADDITIONAL_HEADERS,
                             0,
                             WINHTTP_NO_REQUEST_DATA,
                             0,
                             0,
                             (DWORD_PTR)this)== FALSE)
    {
        m_dwLastError = ::GetLastError();

        fprintf(stderr,
                "[%d] The Requester #%d failed to fetch %S, WinHttpSendRequest() failed; error = %d.\n",
                dwThreadId,
                m_nID,
                m_pwszUrl,
                m_dwLastError);

        m_State = ERROR;
        return FALSE;
    }

    return TRUE;
}

Friends And Related Function Documentation

void CALLBACK RequesterStatusCallback | ( | HINTERNET | hInternet,
 |  | DWORD_PTR | dwContext,
 |  | DWORD | dwInternetStatus,
 |  | LPVOID | lpvStatusInformation,
 |  | DWORD | dwStatusInformationLength |
 | ) |  |  | [friend]

Definition at line 467 of file browser.cpp.

{
    ASYNC_REQUESTER* pRequester = (ASYNC_REQUESTER*)dwContext;
    ASSERT(pRequester != NULL);

    ASSERT(pRequester->m_hRequest == hInternet);

    switch(dwInternetStatus)
    {
        case WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE:
            pRequester->OnSendRequestComplete();
            break;
        case WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE:
            pRequester->OnHeadersAvailable();
            break;
        case WINHTTP_CALLBACK_STATUS_READ_COMPLETE:
            pRequester->OnReadComplete(dwStatusInformationLength);
            break;
        case WINHTTP_CALLBACK_STATUS_REQUEST_ERROR:
            pRequester->OnRequestError((LPWINHTTP_ASYNC_RESULT)lpvStatusInformation);
            break;
        case WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING:
            pRequester->OnHandleClosing(hInternet);
            pRequester->m_hRequest = NULL;
            break;
        default:
            ;
    }
}

friend class SIMPLE_BROWSER [friend]

Definition at line 142 of file browser.h.

Member Data Documentation

LIST_ENTRY ASYNC_REQUESTER::_List [private]

Definition at line 85 of file browser.h.

int ASYNC_REQUESTER::m_ContentLength [private]

Definition at line 133 of file browser.h.

DWORD ASYNC_REQUESTER::m_dwBytesReadSoFar [private]

Definition at line 134 of file browser.h.

DWORD ASYNC_REQUESTER::m_dwErrorAPI [private]

Definition at line 124 of file browser.h.

DWORD ASYNC_REQUESTER::m_dwLastError [private]

Definition at line 123 of file browser.h.

DWORD ASYNC_REQUESTER::m_dwStartingTime [private]

Definition at line 136 of file browser.h.

DWORD ASYNC_REQUESTER::m_dwTimeLimit [private]

Definition at line 137 of file browser.h.

BOOL ASYNC_REQUESTER::m_fClosing [private]

Definition at line 128 of file browser.h.

BOOL ASYNC_REQUESTER::m_fProxyAutoDiscovery [private]

Definition at line 115 of file browser.h.

BOOL ASYNC_REQUESTER::m_fProxyFailover [private]

Definition at line 116 of file browser.h.

HINTERNET ASYNC_REQUESTER::m_hConnect [private]

Definition at line 109 of file browser.h.

HINTERNET ASYNC_REQUESTER::m_hRequest [private]

Definition at line 110 of file browser.h.

UINT ASYNC_REQUESTER::m_nFailureRetries [private]

Definition at line 117 of file browser.h.

UINT ASYNC_REQUESTER::m_nID [private]

Definition at line 112 of file browser.h.

int ASYNC_REQUESTER::m_nNumAttempts [private]

Definition at line 140 of file browser.h.

SIMPLE_BROWSER* ASYNC_REQUESTER::m_pBrowser [private]

Definition at line 113 of file browser.h.

WINHTTP_PROXY_INFO ASYNC_REQUESTER::m_ProxyInfo [private]

Definition at line 119 of file browser.h.

LPWSTR ASYNC_REQUESTER::m_pwszNextProxies [private]

Definition at line 121 of file browser.h.

PWSTR ASYNC_REQUESTER::m_pwszUrl [private]

Definition at line 106 of file browser.h.

BYTE ASYNC_REQUESTER::m_ReadBuffer[READ_BUFFER_SIZE] [private]

Definition at line 131 of file browser.h.

STATE ASYNC_REQUESTER::m_State [private]

Definition at line 126 of file browser.h.

int ASYNC_REQUESTER::m_TimeRemaining [private]

Definition at line 138 of file browser.h.

The documentation for this class was generated from the following files:
  • Web/winhttp/WinHttpAsyncSample/browser.h
  • Web/winhttp/WinHttpAsyncSample/browser.cpp
Generated on Wed Nov 13 2024 16:55:28 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ATLCONTROLLib::MMCControl Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • ATLCONTROLLib
  • ATLCONTROLLib::MMCControl

ATLCONTROLLib::MMCControl Class Reference

import "atlcontrol.idl";

Detailed Description

Definition at line 39 of file atlcontrol.idl.

The documentation for this class was generated from the following file:
  • SysMgmt/MMC/ActiveX/atl/atlcontrol.idl
Generated on Wed Nov 13 2024 16:58:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ATTRIBUTES Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

ATTRIBUTES Struct Reference

#include "tsfedit.h"

List of all members.

Public Attributes

const TS_ATTRID * | attrid
DWORD dwFlags
VARIANT | varDefaultValue
VARIANT | varValue

Detailed Description

Definition at line 60 of file tsfedit.h.

Member Data Documentation

const TS_ATTRID* ATTRIBUTES::attrid

Definition at line 63 of file tsfedit.h.

DWORD ATTRIBUTES::dwFlags

Definition at line 62 of file tsfedit.h.

VARIANT ATTRIBUTES::varDefaultValue

Definition at line 65 of file tsfedit.h.

VARIANT ATTRIBUTES::varValue

Definition at line 64 of file tsfedit.h.

The documentation for this struct was generated from the following file:
  • WinUI/tsfapp/tsfedit.h
Generated on Wed Nov 13 2024 16:55:28 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: AUTH_DATA Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

AUTH_DATA Struct Reference

List of all members.

Public Attributes

BSTR | bstrOldURI
WCHAR | szAccount [MAX_STRING]
WCHAR | szPassword [MAX_STRING]
WCHAR | szUserURI [MAX_STRING]

Detailed Description

Definition at line 190 of file rtcdialogs.cpp.

Member Data Documentation

BSTR AUTH_DATA::bstrOldURI

Definition at line 192 of file rtcdialogs.cpp.

WCHAR AUTH_DATA::szAccount[MAX_STRING]

Definition at line 194 of file rtcdialogs.cpp.

WCHAR AUTH_DATA::szPassword[MAX_STRING]

Definition at line 195 of file rtcdialogs.cpp.

WCHAR AUTH_DATA::szUserURI[MAX_STRING]

Definition at line 193 of file rtcdialogs.cpp.

The documentation for this struct was generated from the following file:
  • NetDS/rtc/Client/CPP/rtcsample/rtcdialogs.cpp
Generated on Wed Nov 13 2024 16:55:28 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: AUTHENTICATEPLUGINLib::AuthenticateAdmin Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • AUTHENTICATEPLUGINLib
  • AUTHENTICATEPLUGINLib::AuthenticateAdmin

AUTHENTICATEPLUGINLib::AuthenticateAdmin Class Reference

import "Authenticate.idl";

Detailed Description

Definition at line 96 of file Authenticate.idl.

The documentation for this class was generated from the following file:
  • Multimedia/WindowsMediaServices9/Authentication/Authenticate.idl
Generated on Wed Nov 13 2024 16:58:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: AUTHENTICATEPLUGINLib::AuthenticateContext Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • AUTHENTICATEPLUGINLib
  • AUTHENTICATEPLUGINLib::AuthenticateContext

AUTHENTICATEPLUGINLib::AuthenticateContext Class Reference

import "Authenticate.idl";

Detailed Description

Definition at line 88 of file Authenticate.idl.

The documentation for this class was generated from the following file:
  • Multimedia/WindowsMediaServices9/Authentication/Authenticate.idl
Generated on Wed Nov 13 2024 16:58:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: AUTHENTICATEPLUGINLib::AuthenticatePlugin Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • AUTHENTICATEPLUGINLib
  • AUTHENTICATEPLUGINLib::AuthenticatePlugin

AUTHENTICATEPLUGINLib::AuthenticatePlugin Class Reference

import "Authenticate.idl";

Detailed Description

Definition at line 80 of file Authenticate.idl.

The documentation for this class was generated from the following file:
  • Multimedia/WindowsMediaServices9/Authentication/Authenticate.idl
Generated on Wed Nov 13 2024 16:58:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: AutoClaims::AutoClaims Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • AutoClaims
  • AutoClaims::AutoClaims
Public Member Functions | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes

AutoClaims::AutoClaims Class Reference

The AutoClaims Sample Application form class. More...

List of all members.

Public Member Functions

AutoClaims ()
AutoClaims ()
AutoClaims ()
void | DisposeResources ()

Protected Member Functions

override void | Dispose (bool disposing)
override void | Dispose (bool disposing)
override void | Dispose (bool disposing)

Private Member Functions

void | AutoClaims_Load (object sender, System.EventArgs e)
void | AutoClaims_Load (object sender, System.EventArgs e)
void | AutoClaims_Load (object sender, System.EventArgs e)
void | chHideLayer_CheckedChanged (object sender, System.EventArgs e)
void | chHideLayer_CheckedChanged (object sender, System.EventArgs e)
void | chHideLayer_CheckedChanged (object sender, System.EventArgs e)
void | InitializeComponent ()
void | InitializeComponent ()
void | InitializeComponent ()
void | inkEdMake_Enter (object sender, System.EventArgs e)
void | inkEdModel_Enter (object sender, System.EventArgs e)
void | inkEdYear_Enter (object sender, System.EventArgs e)
void | inkPictVehicle_Paint (object sender, System.Windows.Forms.PaintEventArgs e)
void | inkPictVehicle_Paint (object sender, System.Windows.Forms.PaintEventArgs e)
void | inkPictVehicle_Paint (object sender, System.Windows.Forms.PaintEventArgs e)
void | lstAnnotationLayer_SelectedIndexChanged (object sender, System.EventArgs e)
void | lstAnnotationLayer_SelectedIndexChanged (object sender, System.EventArgs e)
void | lstAnnotationLayer_SelectedIndexChanged (object sender, System.EventArgs e)

Static Private Member Functions

static void | Main ()
static void | Main ()

Private Attributes

internal
System.Windows.Forms.CheckBox 		chHideLayer
System.ComponentModel.Container | components = null
Ink | emptyInk = null
Microsoft.Ink.InkEdit | inkEdMake
Microsoft.Ink.InkEdit | inkEdModel
Microsoft.Ink.InkEdit | inkEdName
Microsoft.Ink.InkEdit | inkEdPolicyNumber
Microsoft.Ink.InkEdit | inkEdYear
InkLayer[] inkLayers
Microsoft.Ink.InkPicture | inkPictVehicle
internal System.Windows.Forms.Label | lblInstructions
internal System.Windows.Forms.Label | lblInsuredName
internal System.Windows.Forms.Label | lblMake
internal System.Windows.Forms.Label | lblModel
internal System.Windows.Forms.Label | lblPolicyNumber
internal System.Windows.Forms.Label | lblTitle
internal System.Windows.Forms.Label | lblVehicleDamage
internal System.Windows.Forms.Label | lblVehicleDescription
internal System.Windows.Forms.Label | lblYear
internal
System.Windows.Forms.ListBox 		lstAnnotationLayer
readonly int | ObjectsNotInstalledError = -2147221164
internal
System.Windows.Forms.PictureBox 		pictCheckmarks
internal
System.Windows.Forms.PictureBox 		pictHorzontalBar1
internal
System.Windows.Forms.PictureBox 		pictHorzontalBar2
internal
System.Windows.Forms.PictureBox 		pictHorzontalBar3
internal
System.Windows.Forms.PictureBox 		pictPolicyBox
internal
System.Windows.Forms.PictureBox 		pictVehicleBox
PenInputPanel | pipName = null
PenInputPanel | pipPolicyNumber = null
PenInputPanel | pipShared = null
bool | selectedHidden = false
int | selectedIndex = -1

Detailed Description

Definition at line 111 of file AutoClaims.cs.

Constructor & Destructor Documentation

AutoClaims::AutoClaims::AutoClaims ( ) [inline]

Definition at line 154 of file AutoClaims.cs.

        {
            #region Standard Template Code
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            #endregion
        }

AutoClaims::AutoClaims::AutoClaims ( ) [inline]

Definition at line 166 of file AutoClaims.cs.

        {
            #region Standard Template Code
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            #endregion
        }

AutoClaims::AutoClaims::AutoClaims ( ) [inline]

Definition at line 153 of file AutoClaims.cs.

        {
            #region Standard Template Code
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            #endregion
        }

Member Function Documentation

void AutoClaims::AutoClaims::AutoClaims_Load | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

This method occurs when the form is loaded.

It configures the insertion mode and the ink used by this application.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 530 of file AutoClaims.cs.

        {
            // Initialize the empty ink
            emptyInk = new Ink();

            // Initialize the four different layers of ink on the vehicle diagram:
            // vehicle body, windows, tires, and headlights.
            inkLayers = new InkLayer[4];
            inkLayers[0] = new InkLayer(new Ink(), Color.Red, false);
            inkLayers[1] = new InkLayer(new Ink(), Color.Violet, false);
            inkLayers[2] = new InkLayer(new Ink(), Color.LightGreen, false);
            inkLayers[3] = new InkLayer(new Ink(), Color.Aqua, false);

            // By default, select the first ink layer
            lstAnnotationLayer.SelectedIndex = 0;
            inkPictVehicle.DefaultDrawingAttributes.Color = inkLayers[lstAnnotationLayer.SelectedIndex].ActiveColor;

            // Currently there are recognizers that do not support regular expression
            // input scopes, thus raising exceptions.  This try catch handler copes
            // with these differences in the recognizer. For policy numbers, nothing
            // is being done in reaction to this exception though since there is no
            // factoid that serves the same purpose.
            try
            {
                inkEdPolicyNumber.Factoid = "(0|1|2|3|4|5|6|7|8|9)(0|1|2|3|4|5|6|7|8|9)(0|1|2|3|4|5|6|7|8|9)-(0|1|2|3|4|5|6|7|" +
                    "8|9)(0|1|2|3|4|5|6|7|8|9)(0|1|2|3|4|5|6|7|8|9)(0|1|2|3|4|5|6|7|8|9)";
            }
            catch
            {
                // Do nothing
            }

            // There are also recognizers that do not support common input scopes as
            // well.  This try catch handler copes with these differences in the
            // recognizer. For year, the NUMBER factoid is being set in reaction to
            // this exception.
            try
            {
                inkEdYear.Factoid = "(!IS_DATE_YEAR)";
            }
            catch
            {
                inkEdYear.Factoid = Factoid.Number;
            }
        }

void AutoClaims::AutoClaims::AutoClaims_Load | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

This method occurs when the form is loaded.

It configures the insertion mode, the ink used by this application, and the default behavior for the PenInputPanels.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 569 of file AutoClaims.cs.

        {
            // Initialize the empty ink
            emptyInk = new Ink();

            // Initialize the PenInputPanel objects inside a Try/Catch block
            // since the objects are not supported off a Tablet PC.
            try
            {
                // Initialize the PenInputPanel objects.
                // - pipShared is attached dynamically at run-time
                // - pipPolicyNumber is only attached to the Policy Number field
                // - pipName is only attached to the Insured Name field
                pipShared = new PenInputPanel();
                pipPolicyNumber = new PenInputPanel(inkEdPolicyNumber);
                pipName = new PenInputPanel(inkEdName);

                // Policy numbers are typically prone to recognizer errors, so we'll
                // default to the keyboard panel to be visible for the Policy number.
                pipPolicyNumber.DefaultPanel = PanelType.Keyboard;

                // Enable Text Services Framework on the Name and Policy Number fields.
                // InkEdit already provides a correction UI, but here EnableTsf is allowing
                // the PenInputPanel to use the TSF insertion context rather than SendInput
                // to send the handwriting recognition results into the control. This means
                // that text can be inserted even if the field no longer has focus.
                pipName.EnableTsf(true);
                pipPolicyNumber.EnableTsf(true);

                // Since the fields are laid out vertically on the form, we'll
                // display the PenInputPanels slightly further to the right
                // in order to make it easier for the user to navigate.
                pipShared.HorizontalOffset = 32;
                pipPolicyNumber.HorizontalOffset = 32;
                pipName.HorizontalOffset = 32;
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                // If the peninputpanel objects cannot be created, set them
                // to null. Other code that references these objects will need
                // to check
                if (ex.ErrorCode == ObjectsNotInstalledError)
                {
                    pipShared = null;
                    pipPolicyNumber = null;
                    pipName = null;
                }
                else
                {
                    throw; // rethrow unexpected exception
                }
            }

            // Initialize the four different layers of ink on the vehicle diagram:
            // vehicle body, windows, tires, and headlights.
            inkLayers = new InkLayer[4];
            inkLayers[0] = new InkLayer(new Ink(), Color.Red, false);
            inkLayers[1] = new InkLayer(new Ink(), Color.Violet, false);
            inkLayers[2] = new InkLayer(new Ink(), Color.LightGreen, false);
            inkLayers[3] = new InkLayer(new Ink(), Color.Aqua, false);

            // By default, select the first ink layer
            lstAnnotationLayer.SelectedIndex = 0;
            inkPictVehicle.DefaultDrawingAttributes.Color = inkLayers[lstAnnotationLayer.SelectedIndex].ActiveColor;
        }

void AutoClaims::AutoClaims::AutoClaims_Load | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

This method occurs when the control is loaded.

It configures the insertion mode and the ink used by this application.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 546 of file AutoClaims.cs.

        {
            // Initialize the empty ink
            emptyInk = new Ink();

            // Initialize the four different layers of ink on the vehicle diagram:
            // vehicle body, windows, tires, and headlights.
            inkLayers = new InkLayer[4];
            inkLayers[0] = new InkLayer(new Ink(), Color.Red, false);
            inkLayers[1] = new InkLayer(new Ink(), Color.Violet, false);
            inkLayers[2] = new InkLayer(new Ink(), Color.LightGreen, false);
            inkLayers[3] = new InkLayer(new Ink(), Color.Aqua, false);

            // By default, select the first ink layer
            lstAnnotationLayer.SelectedIndex = 0;
            inkPictVehicle.DefaultDrawingAttributes.Color = inkLayers[lstAnnotationLayer.SelectedIndex].ActiveColor;

            // Currently there are recognizers that do not support regular expression
            // input scopes, thus raising exceptions.  This try catch handler copes
            // with these differences in the recognizer. For policy numbers, nothing
            // is being done in reaction to this exception though since there is no
            // factoid that serves the same purpose.
            try
            {
                inkEdPolicyNumber.Factoid = "(0|1|2|3|4|5|6|7|8|9)(0|1|2|3|4|5|6|7|8|9)(0|1|2|3|4|5|6|7|8|9)-(0|1|2|3|4|5|6|7|" +
                    "8|9)(0|1|2|3|4|5|6|7|8|9)(0|1|2|3|4|5|6|7|8|9)(0|1|2|3|4|5|6|7|8|9)";
            }
            catch
            {
                // Do nothing
            }

            // There are also recognizers that do not support common input scopes as
            // well.  This try catch handler copes with these differences in the
            // recognizer. For year, the NUMBER factoid is being set in reaction to
            // this exception.
            try
            {
                inkEdYear.Factoid = "(!IS_DATE_YEAR)";
            }
            catch
            {
                inkEdYear.Factoid = Factoid.Number;
            }
        }

void AutoClaims::AutoClaims::chHideLayer_CheckedChanged | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from chHideLayer->CheckChanged Event.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 635 of file AutoClaims.cs.

        {
            // Provided that the new checked hidden value is different than
            // the previous value...
            if (chHideLayer.Checked != selectedHidden)
            {
                if (!inkPictVehicle.CollectingInk)
                {
                    // Update the array indicating the visibility of each ink layer
                    inkLayers[lstAnnotationLayer.SelectedIndex].Hidden = chHideLayer.Checked;

                    // Set the active ink object to the selected ink
                    // Note that if the current layer is not visible, empty
                    // ink is used to prevent flicker.
                    inkPictVehicle.InkEnabled = false;
                    inkPictVehicle.Ink = chHideLayer.Checked?emptyInk:inkLayers[lstAnnotationLayer.SelectedIndex].ActiveInk;

                    // If the layer is marked hidden, disable ink collections
                    inkPictVehicle.InkEnabled = !chHideLayer.Checked;

                    // Update the previous checkbox value to reflect the current
                    selectedHidden = chHideLayer.Checked;

                    this.Refresh();
                }
                else
                {
                    // If ink collection is enabled, the active ink cannot be changed
                    // and it is necessary to restore the checkbox to its previous value.
                    chHideLayer.Checked = selectedHidden;
                    MessageBox.Show("Cannot change visiblity while collecting ink.");
                }
            }
        }

void AutoClaims::AutoClaims::chHideLayer_CheckedChanged | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from chHideLayer->CheckChanged Event.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 619 of file AutoClaims.cs.

        {
            // Provided that the new checked hidden value is different than
            // the previous value...
            if (chHideLayer.Checked != selectedHidden)
            {
                if (!inkPictVehicle.CollectingInk)
                {
                    // Update the array indicating the visibility of each ink layer
                    inkLayers[lstAnnotationLayer.SelectedIndex].Hidden = chHideLayer.Checked;

                    // Set the active ink object to the selected ink
                    // Note that if the current layer is not visible, empty
                    // ink is used to prevent flicker.
                    inkPictVehicle.InkEnabled = false;
                    inkPictVehicle.Ink = chHideLayer.Checked?emptyInk:inkLayers[lstAnnotationLayer.SelectedIndex].ActiveInk;

                    // If the layer is marked hidden, disable ink collections
                    inkPictVehicle.InkEnabled = !chHideLayer.Checked;

                    // Update the previous checkbox value to reflect the current
                    selectedHidden = chHideLayer.Checked;

                    this.Refresh();
                }
                else
                {
                    // If ink collection is enabled, the active ink cannot be changed
                    // and it is necessary to restore the checkbox to its previous value.
                    chHideLayer.Checked = selectedHidden;
                    MessageBox.Show("Cannot change visiblity while collecting ink.");
                }
            }
        }

void AutoClaims::AutoClaims::chHideLayer_CheckedChanged | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from chHideLayer->CheckChanged Event.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 678 of file AutoClaims.cs.

        {
            // Provided that the new checked hidden value is different than
            // the previous value...
            if (chHideLayer.Checked != selectedHidden)
            {
                if (!inkPictVehicle.CollectingInk)
                {
                    // Update the array indicating the visibility of each ink layer
                    inkLayers[lstAnnotationLayer.SelectedIndex].Hidden = chHideLayer.Checked;

                    // Set the active ink object to the selected ink
                    // Note that if the current layer is not visible, empty
                    // ink is used to prevent flicker.
                    inkPictVehicle.InkEnabled = false;
                    inkPictVehicle.Ink = chHideLayer.Checked?emptyInk:inkLayers[lstAnnotationLayer.SelectedIndex].ActiveInk;

                    // If the layer is marked hidden, disable ink collections
                    inkPictVehicle.InkEnabled = !chHideLayer.Checked;

                    // Update the previous checkbox value to reflect the current
                    selectedHidden = chHideLayer.Checked;

                    this.Refresh();
                }
                else
                {
                    // If ink collection is enabled, the active ink cannot be changed
                    // and it is necessary to restore the checkbox to its previous value.
                    chHideLayer.Checked = selectedHidden;
                    MessageBox.Show("Cannot change visibility while collecting ink.");
                }
            }
        }

override void AutoClaims::AutoClaims::Dispose ( bool disposing ) [inline, protected]

Clean up any resources being used.

Definition at line 180 of file AutoClaims.cs.

        {
            if( disposing )
            {
                if (components != null)
                {
                    components.Dispose();
                }

                // dispose any resources associated with our input panels
                if (pipShared != null)
                {
                    pipShared.Dispose();
                }
                if (pipPolicyNumber != null)
                {
                    pipPolicyNumber.Dispose();
                }
                if (pipName != null)
                {
                    pipName.Dispose();
                }

                // dispose any resources associated with our ink objects
                foreach (InkLayer layer in inkLayers)
                {
                    layer.ActiveInk.Dispose();
                }

                // Dispose the empty ink object
                if(emptyInk != null)
                {
                    emptyInk.Dispose();
                }
            }
            base.Dispose( disposing );
        }

override void AutoClaims::AutoClaims::Dispose ( bool disposing ) [inline, protected]

Clean up any resources being used.

Definition at line 167 of file AutoClaims.cs.

        {
            if( disposing )
            {
                if (components != null)
                {
                    components.Dispose();
                }
            }
            base.Dispose( disposing );
        }

override void AutoClaims::AutoClaims::Dispose ( bool disposing ) [inline, protected]

Clean up any resources being used.

Definition at line 168 of file AutoClaims.cs.

        {
            if( disposing )
            {
                if (components != null)
                {
                    components.Dispose();
                }
            }
            base.Dispose( disposing );
        }

void AutoClaims::AutoClaims::DisposeResources ( ) [inline]

Disposes of the internal child controls used for collecting ink.

Definition at line 509 of file AutoClaims.cs.

        {
            // Call Dispose on all controls that sink ink events (this is
            // always required for a clean shutdown).
            inkEdPolicyNumber.Dispose();
            inkEdName.Dispose();
            inkEdYear.Dispose();
            inkEdMake.Dispose();
            inkEdModel.Dispose();
            inkPictVehicle.Dispose();

            // Garbage collection will not necessarily occur when
            // the page is shut down; in fact, the garbage collector might
            // never clean up ink resources when running from within IE.
            // As a result, we manually ensure that all ink resources are
            // garbage collected by setting them to null and then calling
            // GC.Collect().
            emptyInk = null;
            inkLayers = null;
            inkEdPolicyNumber = null;
            inkEdName = null;
            inkEdYear = null;
            inkEdMake = null;
            inkEdModel = null;
            inkPictVehicle = null;

            GC.Collect();
            GC.WaitForPendingFinalizers();
        }

void AutoClaims::AutoClaims::InitializeComponent ( ) [inline, private]

Required method for Designer support - do not modify the contents of this method with the code editor.

Definition at line 185 of file AutoClaims.cs.

        {
            System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(AutoClaims));
            this.lblVehicleDamage = new System.Windows.Forms.Label();
            this.lblVehicleDescription = new System.Windows.Forms.Label();
            this.lblModel = new System.Windows.Forms.Label();
            this.lblYear = new System.Windows.Forms.Label();
            this.lblMake = new System.Windows.Forms.Label();
            this.lblPolicyNumber = new System.Windows.Forms.Label();
            this.lblInsuredName = new System.Windows.Forms.Label();
            this.chHideLayer = new System.Windows.Forms.CheckBox();
            this.pictHorzontalBar2 = new System.Windows.Forms.PictureBox();
            this.pictVehicleBox = new System.Windows.Forms.PictureBox();
            this.pictHorzontalBar3 = new System.Windows.Forms.PictureBox();
            this.pictPolicyBox = new System.Windows.Forms.PictureBox();
            this.pictHorzontalBar1 = new System.Windows.Forms.PictureBox();
            this.lblInstructions = new System.Windows.Forms.Label();
            this.lblTitle = new System.Windows.Forms.Label();
            this.pictCheckmarks = new System.Windows.Forms.PictureBox();
            this.inkPictVehicle = new Microsoft.Ink.InkPicture();
            this.lstAnnotationLayer = new System.Windows.Forms.ListBox();
            this.inkEdPolicyNumber = new Microsoft.Ink.InkEdit();
            this.inkEdName = new Microsoft.Ink.InkEdit();
            this.inkEdYear = new Microsoft.Ink.InkEdit();
            this.inkEdMake = new Microsoft.Ink.InkEdit();
            this.inkEdModel = new Microsoft.Ink.InkEdit();
            this.SuspendLayout();
            //
            // lblVehicleDamage
            //
            this.lblVehicleDamage.AutoSize = true;
            this.lblVehicleDamage.BackColor = System.Drawing.Color.White;
            this.lblVehicleDamage.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.lblVehicleDamage.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.lblVehicleDamage.Location = new System.Drawing.Point(8, 408);
            this.lblVehicleDamage.Name = "lblVehicleDamage";
            this.lblVehicleDamage.Size = new System.Drawing.Size(256, 20);
            this.lblVehicleDamage.TabIndex = 58;
            this.lblVehicleDamage.Text = "Description of vehicle damage";
            this.lblVehicleDamage.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            //
            // lblVehicleDescription
            //
            this.lblVehicleDescription.AutoSize = true;
            this.lblVehicleDescription.BackColor = System.Drawing.Color.White;
            this.lblVehicleDescription.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.lblVehicleDescription.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.lblVehicleDescription.Location = new System.Drawing.Point(8, 240);
            this.lblVehicleDescription.Name = "lblVehicleDescription";
            this.lblVehicleDescription.Size = new System.Drawing.Size(386, 20);
            this.lblVehicleDescription.TabIndex = 56;
            this.lblVehicleDescription.Text = "Enter the involved vehicle listed on the policy ";
            this.lblVehicleDescription.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            //
            // lblModel
            //
            this.lblModel.AutoSize = true;
            this.lblModel.BackColor = System.Drawing.Color.Gainsboro;
            this.lblModel.Font = new System.Drawing.Font("Tahoma", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.lblModel.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.lblModel.Location = new System.Drawing.Point(112, 360);
            this.lblModel.Name = "lblModel";
            this.lblModel.Size = new System.Drawing.Size(73, 23);
            this.lblModel.TabIndex = 52;
            this.lblModel.Text = "Model:";
            this.lblModel.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            //
            // lblYear
            //
            this.lblYear.AutoSize = true;
            this.lblYear.BackColor = System.Drawing.Color.Gainsboro;
            this.lblYear.Font = new System.Drawing.Font("Tahoma", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.lblYear.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.lblYear.Location = new System.Drawing.Point(48, 280);
            this.lblYear.Name = "lblYear";
            this.lblYear.Size = new System.Drawing.Size(135, 23);
            this.lblYear.TabIndex = 51;
            this.lblYear.Text = "Year (YYYY):";
            this.lblYear.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            //
            // lblMake
            //
            this.lblMake.AutoSize = true;
            this.lblMake.BackColor = System.Drawing.Color.Gainsboro;
            this.lblMake.Font = new System.Drawing.Font("Tahoma", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.lblMake.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.lblMake.Location = new System.Drawing.Point(112, 320);
            this.lblMake.Name = "lblMake";
            this.lblMake.Size = new System.Drawing.Size(67, 23);
            this.lblMake.TabIndex = 50;
            this.lblMake.Text = "Make:";
            this.lblMake.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            //
            // lblPolicyNumber
            //
            this.lblPolicyNumber.AutoSize = true;
            this.lblPolicyNumber.BackColor = System.Drawing.Color.Gainsboro;
            this.lblPolicyNumber.Font = new System.Drawing.Font("Tahoma", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.lblPolicyNumber.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.lblPolicyNumber.Location = new System.Drawing.Point(32, 136);
            this.lblPolicyNumber.Name = "lblPolicyNumber";
            this.lblPolicyNumber.Size = new System.Drawing.Size(157, 23);
            this.lblPolicyNumber.TabIndex = 47;
            this.lblPolicyNumber.Text = "Policy Number:";
            this.lblPolicyNumber.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            //
            // lblInsuredName
            //
            this.lblInsuredName.AutoSize = true;
            this.lblInsuredName.BackColor = System.Drawing.Color.Gainsboro;
            this.lblInsuredName.Font = new System.Drawing.Font("Tahoma", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.lblInsuredName.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.lblInsuredName.Location = new System.Drawing.Point(32, 176);
            this.lblInsuredName.Name = "lblInsuredName";
            this.lblInsuredName.Size = new System.Drawing.Size(154, 23);
            this.lblInsuredName.TabIndex = 46;
            this.lblInsuredName.Text = "Insured Name:";
            this.lblInsuredName.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            //
            // chHideLayer
            //
            this.chHideLayer.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.chHideLayer.Location = new System.Drawing.Point(416, 576);
            this.chHideLayer.Name = "chHideLayer";
            this.chHideLayer.Size = new System.Drawing.Size(144, 24);
            this.chHideLayer.TabIndex = 61;
            this.chHideLayer.Text = "Hide Layer";
            this.chHideLayer.CheckedChanged += new System.EventHandler(this.chHideLayer_CheckedChanged);
            //
            // pictHorzontalBar2
            //
            this.pictHorzontalBar2.BackColor = System.Drawing.SystemColors.AppWorkspace;
            this.pictHorzontalBar2.Location = new System.Drawing.Point(8, 224);
            this.pictHorzontalBar2.Name = "pictHorzontalBar2";
            this.pictHorzontalBar2.Size = new System.Drawing.Size(536, 2);
            this.pictHorzontalBar2.TabIndex = 57;
            this.pictHorzontalBar2.TabStop = false;
            //
            // pictVehicleBox
            //
            this.pictVehicleBox.BackColor = System.Drawing.Color.Gainsboro;
            this.pictVehicleBox.Location = new System.Drawing.Point(8, 272);
            this.pictVehicleBox.Name = "pictVehicleBox";
            this.pictVehicleBox.Size = new System.Drawing.Size(184, 120);
            this.pictVehicleBox.TabIndex = 49;
            this.pictVehicleBox.TabStop = false;
            //
            // pictHorzontalBar3
            //
            this.pictHorzontalBar3.BackColor = System.Drawing.SystemColors.AppWorkspace;
            this.pictHorzontalBar3.Location = new System.Drawing.Point(8, 400);
            this.pictHorzontalBar3.Name = "pictHorzontalBar3";
            this.pictHorzontalBar3.Size = new System.Drawing.Size(536, 2);
            this.pictHorzontalBar3.TabIndex = 48;
            this.pictHorzontalBar3.TabStop = false;
            //
            // pictPolicyBox
            //
            this.pictPolicyBox.BackColor = System.Drawing.Color.Gainsboro;
            this.pictPolicyBox.Location = new System.Drawing.Point(8, 128);
            this.pictPolicyBox.Name = "pictPolicyBox";
            this.pictPolicyBox.Size = new System.Drawing.Size(184, 80);
            this.pictPolicyBox.TabIndex = 44;
            this.pictPolicyBox.TabStop = false;
            //
            // pictHorzontalBar1
            //
            this.pictHorzontalBar1.BackColor = System.Drawing.SystemColors.AppWorkspace;
            this.pictHorzontalBar1.Location = new System.Drawing.Point(8, 112);
            this.pictHorzontalBar1.Name = "pictHorzontalBar1";
            this.pictHorzontalBar1.Size = new System.Drawing.Size(536, 2);
            this.pictHorzontalBar1.TabIndex = 43;
            this.pictHorzontalBar1.TabStop = false;
            //
            // lblInstructions
            //
            this.lblInstructions.Font = new System.Drawing.Font("Tahoma", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.lblInstructions.Location = new System.Drawing.Point(96, 48);
            this.lblInstructions.Name = "lblInstructions";
            this.lblInstructions.Size = new System.Drawing.Size(456, 56);
            this.lblInstructions.TabIndex = 42;
            this.lblInstructions.Text = "Enter the required information for the policy applicable to the auto claim you ar" +
                "e submitting. Enter the vehicle exactly as it appears on the policy or insurance" +
                " card.";
            //
            // lblTitle
            //
            this.lblTitle.Font = new System.Drawing.Font("Tahoma", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.lblTitle.Location = new System.Drawing.Point(8, 8);
            this.lblTitle.Name = "lblTitle";
            this.lblTitle.Size = new System.Drawing.Size(288, 32);
            this.lblTitle.TabIndex = 41;
            this.lblTitle.Text = "Auto Claim";
            //
            // pictCheckmarks
            //
            this.pictCheckmarks.BackColor = System.Drawing.Color.White;
            this.pictCheckmarks.BackgroundImage = ((System.Drawing.Bitmap)(resources.GetObject("pictCheckmarks.BackgroundImage")));
            this.pictCheckmarks.Location = new System.Drawing.Point(32, 40);
            this.pictCheckmarks.Name = "pictCheckmarks";
            this.pictCheckmarks.Size = new System.Drawing.Size(40, 72);
            this.pictCheckmarks.TabIndex = 66;
            this.pictCheckmarks.TabStop = false;
            //
            // inkPictVehicle
            //
            this.inkPictVehicle.AutoRedraw = false;
            this.inkPictVehicle.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.inkPictVehicle.Image = ((System.Drawing.Bitmap)(resources.GetObject("inkPictVehicle.Image")));
            this.inkPictVehicle.Location = new System.Drawing.Point(32, 440);
            this.inkPictVehicle.MarginX = -1;
            this.inkPictVehicle.MarginY = -1;
            this.inkPictVehicle.Name = "inkPictVehicle";
            this.inkPictVehicle.Size = new System.Drawing.Size(352, 232);
            this.inkPictVehicle.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            this.inkPictVehicle.TabIndex = 67;
            this.inkPictVehicle.Paint += new System.Windows.Forms.PaintEventHandler(this.inkPictVehicle_Paint);
            //
            // lstAnnotationLayer
            //
            this.lstAnnotationLayer.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.lstAnnotationLayer.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.lstAnnotationLayer.ItemHeight = 19;
            this.lstAnnotationLayer.Items.AddRange(new object[] {
                                                                    "Body",
                                                                    "Windows",
                                                                    "Tires",
                                                                    "Headlights"});
            this.lstAnnotationLayer.Location = new System.Drawing.Point(416, 432);
            this.lstAnnotationLayer.Name = "lstAnnotationLayer";
            this.lstAnnotationLayer.Size = new System.Drawing.Size(104, 135);
            this.lstAnnotationLayer.TabIndex = 68;
            this.lstAnnotationLayer.SelectedIndexChanged += new System.EventHandler(this.lstAnnotationLayer_SelectedIndexChanged);
            //
            // inkEdPolicyNumber
            //
            this.inkEdPolicyNumber.Cursor = System.Windows.Forms.Cursors.Default;
            this.inkEdPolicyNumber.Location = new System.Drawing.Point(208, 136);
            this.inkEdPolicyNumber.Name = "inkEdPolicyNumber";
            this.inkEdPolicyNumber.Size = new System.Drawing.Size(312, 32);
            this.inkEdPolicyNumber.TabIndex = 69;
            this.inkEdPolicyNumber.Text = "";
            this.inkEdPolicyNumber.UseMouseForInput = true;
            //
            // inkEdName
            //
            this.inkEdName.Cursor = System.Windows.Forms.Cursors.Default;
            this.inkEdName.Location = new System.Drawing.Point(208, 176);
            this.inkEdName.Name = "inkEdName";
            this.inkEdName.Size = new System.Drawing.Size(312, 32);
            this.inkEdName.TabIndex = 70;
            this.inkEdName.Text = "";
            this.inkEdName.UseMouseForInput = true;
            //
            // inkEdYear
            //
            this.inkEdYear.Cursor = System.Windows.Forms.Cursors.Default;
            this.inkEdYear.Location = new System.Drawing.Point(208, 280);
            this.inkEdYear.Name = "inkEdYear";
            this.inkEdYear.Size = new System.Drawing.Size(312, 32);
            this.inkEdYear.TabIndex = 71;
            this.inkEdYear.Text = "";
            this.inkEdYear.UseMouseForInput = true;
            //
            // inkEdMake
            //
            this.inkEdMake.Cursor = System.Windows.Forms.Cursors.Default;
            this.inkEdMake.Location = new System.Drawing.Point(208, 320);
            this.inkEdMake.Name = "inkEdMake";
            this.inkEdMake.Size = new System.Drawing.Size(312, 32);
            this.inkEdMake.TabIndex = 72;
            this.inkEdMake.Text = "";
            this.inkEdMake.UseMouseForInput = true;
            //
            // inkEdModel
            //
            this.inkEdModel.Cursor = System.Windows.Forms.Cursors.Default;
            this.inkEdModel.Location = new System.Drawing.Point(208, 360);
            this.inkEdModel.Name = "inkEdModel";
            this.inkEdModel.Size = new System.Drawing.Size(312, 32);
            this.inkEdModel.TabIndex = 73;
            this.inkEdModel.Text = "";
            this.inkEdModel.UseMouseForInput = true;
            //
            // AutoClaims
            //
            this.AutoScroll = true;
            this.BackColor = System.Drawing.Color.White;
            this.ClientSize = new System.Drawing.Size(560, 694);
            this.Controls.AddRange(new System.Windows.Forms.Control[] {
                                                                          this.inkEdModel,
                                                                          this.inkEdMake,
                                                                          this.inkEdYear,
                                                                          this.inkEdName,
                                                                          this.inkEdPolicyNumber,
                                                                          this.lstAnnotationLayer,
                                                                          this.inkPictVehicle,
                                                                          this.lblVehicleDamage,
                                                                          this.lblVehicleDescription,
                                                                          this.lblModel,
                                                                          this.lblYear,
                                                                          this.lblMake,
                                                                          this.lblPolicyNumber,
                                                                          this.lblInsuredName,
                                                                          this.chHideLayer,
                                                                          this.pictHorzontalBar2,
                                                                          this.pictVehicleBox,
                                                                          this.pictHorzontalBar3,
                                                                          this.pictPolicyBox,
                                                                          this.pictHorzontalBar1,
                                                                          this.lblInstructions,
                                                                          this.lblTitle,
                                                                          this.pictCheckmarks});
            this.Name = "AutoClaims";
            this.Text = "AutoClaims";
            this.Load += new System.EventHandler(this.AutoClaims_Load);
            this.ResumeLayout(false);

        }

void AutoClaims::AutoClaims::InitializeComponent ( ) [inline, private]

Required method for Designer support - do not modify the contents of this method with the code editor.

Definition at line 186 of file AutoClaims.cs.

        {
            System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(AutoClaims));
            this.lblVehicleDamage = new System.Windows.Forms.Label();
            this.lblVehicleDescription = new System.Windows.Forms.Label();
            this.lblModel = new System.Windows.Forms.Label();
            this.lblYear = new System.Windows.Forms.Label();
            this.lblMake = new System.Windows.Forms.Label();
            this.lblPolicyNumber = new System.Windows.Forms.Label();
            this.lblInsuredName = new System.Windows.Forms.Label();
            this.chHideLayer = new System.Windows.Forms.CheckBox();
            this.pictHorzontalBar2 = new System.Windows.Forms.PictureBox();
            this.pictVehicleBox = new System.Windows.Forms.PictureBox();
            this.pictHorzontalBar3 = new System.Windows.Forms.PictureBox();
            this.pictPolicyBox = new System.Windows.Forms.PictureBox();
            this.pictHorzontalBar1 = new System.Windows.Forms.PictureBox();
            this.lblInstructions = new System.Windows.Forms.Label();
            this.lblTitle = new System.Windows.Forms.Label();
            this.pictCheckmarks = new System.Windows.Forms.PictureBox();
            this.inkPictVehicle = new Microsoft.Ink.InkPicture();
            this.lstAnnotationLayer = new System.Windows.Forms.ListBox();
            this.inkEdPolicyNumber = new Microsoft.Ink.InkEdit();
            this.inkEdName = new Microsoft.Ink.InkEdit();
            this.inkEdYear = new Microsoft.Ink.InkEdit();
            this.inkEdMake = new Microsoft.Ink.InkEdit();
            this.inkEdModel = new Microsoft.Ink.InkEdit();
            this.SuspendLayout();
            //
            // lblVehicleDamage
            //
            this.lblVehicleDamage.AutoSize = true;
            this.lblVehicleDamage.BackColor = System.Drawing.Color.White;
            this.lblVehicleDamage.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.lblVehicleDamage.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.lblVehicleDamage.Location = new System.Drawing.Point(8, 408);
            this.lblVehicleDamage.Name = "lblVehicleDamage";
            this.lblVehicleDamage.Size = new System.Drawing.Size(256, 20);
            this.lblVehicleDamage.TabIndex = 58;
            this.lblVehicleDamage.Text = "Description of vehicle damage";
            this.lblVehicleDamage.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            //
            // lblVehicleDescription
            //
            this.lblVehicleDescription.AutoSize = true;
            this.lblVehicleDescription.BackColor = System.Drawing.Color.White;
            this.lblVehicleDescription.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.lblVehicleDescription.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.lblVehicleDescription.Location = new System.Drawing.Point(8, 240);
            this.lblVehicleDescription.Name = "lblVehicleDescription";
            this.lblVehicleDescription.Size = new System.Drawing.Size(386, 20);
            this.lblVehicleDescription.TabIndex = 56;
            this.lblVehicleDescription.Text = "Enter the involved vehicle listed on the policy ";
            this.lblVehicleDescription.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            //
            // lblModel
            //
            this.lblModel.AutoSize = true;
            this.lblModel.BackColor = System.Drawing.Color.Gainsboro;
            this.lblModel.Font = new System.Drawing.Font("Tahoma", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.lblModel.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.lblModel.Location = new System.Drawing.Point(112, 360);
            this.lblModel.Name = "lblModel";
            this.lblModel.Size = new System.Drawing.Size(73, 23);
            this.lblModel.TabIndex = 52;
            this.lblModel.Text = "Model:";
            this.lblModel.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            //
            // lblYear
            //
            this.lblYear.AutoSize = true;
            this.lblYear.BackColor = System.Drawing.Color.Gainsboro;
            this.lblYear.Font = new System.Drawing.Font("Tahoma", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.lblYear.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.lblYear.Location = new System.Drawing.Point(48, 280);
            this.lblYear.Name = "lblYear";
            this.lblYear.Size = new System.Drawing.Size(135, 23);
            this.lblYear.TabIndex = 51;
            this.lblYear.Text = "Year (YYYY):";
            this.lblYear.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            //
            // lblMake
            //
            this.lblMake.AutoSize = true;
            this.lblMake.BackColor = System.Drawing.Color.Gainsboro;
            this.lblMake.Font = new System.Drawing.Font("Tahoma", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.lblMake.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.lblMake.Location = new System.Drawing.Point(112, 320);
            this.lblMake.Name = "lblMake";
            this.lblMake.Size = new System.Drawing.Size(67, 23);
            this.lblMake.TabIndex = 50;
            this.lblMake.Text = "Make:";
            this.lblMake.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            //
            // lblPolicyNumber
            //
            this.lblPolicyNumber.AutoSize = true;
            this.lblPolicyNumber.BackColor = System.Drawing.Color.Gainsboro;
            this.lblPolicyNumber.Font = new System.Drawing.Font("Tahoma", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.lblPolicyNumber.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.lblPolicyNumber.Location = new System.Drawing.Point(32, 136);
            this.lblPolicyNumber.Name = "lblPolicyNumber";
            this.lblPolicyNumber.Size = new System.Drawing.Size(157, 23);
            this.lblPolicyNumber.TabIndex = 47;
            this.lblPolicyNumber.Text = "Policy Number:";
            this.lblPolicyNumber.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            //
            // lblInsuredName
            //
            this.lblInsuredName.AutoSize = true;
            this.lblInsuredName.BackColor = System.Drawing.Color.Gainsboro;
            this.lblInsuredName.Font = new System.Drawing.Font("Tahoma", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.lblInsuredName.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.lblInsuredName.Location = new System.Drawing.Point(32, 176);
            this.lblInsuredName.Name = "lblInsuredName";
            this.lblInsuredName.Size = new System.Drawing.Size(154, 23);
            this.lblInsuredName.TabIndex = 46;
            this.lblInsuredName.Text = "Insured Name:";
            this.lblInsuredName.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            //
            // chHideLayer
            //
            this.chHideLayer.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.chHideLayer.Location = new System.Drawing.Point(416, 576);
            this.chHideLayer.Name = "chHideLayer";
            this.chHideLayer.Size = new System.Drawing.Size(144, 24);
            this.chHideLayer.TabIndex = 61;
            this.chHideLayer.Text = "Hide Layer";
            this.chHideLayer.CheckedChanged += new System.EventHandler(this.chHideLayer_CheckedChanged);
            //
            // pictHorzontalBar2
            //
            this.pictHorzontalBar2.BackColor = System.Drawing.SystemColors.AppWorkspace;
            this.pictHorzontalBar2.Location = new System.Drawing.Point(8, 224);
            this.pictHorzontalBar2.Name = "pictHorzontalBar2";
            this.pictHorzontalBar2.Size = new System.Drawing.Size(536, 2);
            this.pictHorzontalBar2.TabIndex = 57;
            this.pictHorzontalBar2.TabStop = false;
            //
            // pictVehicleBox
            //
            this.pictVehicleBox.BackColor = System.Drawing.Color.Gainsboro;
            this.pictVehicleBox.Location = new System.Drawing.Point(8, 272);
            this.pictVehicleBox.Name = "pictVehicleBox";
            this.pictVehicleBox.Size = new System.Drawing.Size(184, 120);
            this.pictVehicleBox.TabIndex = 49;
            this.pictVehicleBox.TabStop = false;
            //
            // pictHorzontalBar3
            //
            this.pictHorzontalBar3.BackColor = System.Drawing.SystemColors.AppWorkspace;
            this.pictHorzontalBar3.Location = new System.Drawing.Point(8, 400);
            this.pictHorzontalBar3.Name = "pictHorzontalBar3";
            this.pictHorzontalBar3.Size = new System.Drawing.Size(536, 2);
            this.pictHorzontalBar3.TabIndex = 48;
            this.pictHorzontalBar3.TabStop = false;
            //
            // pictPolicyBox
            //
            this.pictPolicyBox.BackColor = System.Drawing.Color.Gainsboro;
            this.pictPolicyBox.Location = new System.Drawing.Point(8, 128);
            this.pictPolicyBox.Name = "pictPolicyBox";
            this.pictPolicyBox.Size = new System.Drawing.Size(184, 80);
            this.pictPolicyBox.TabIndex = 44;
            this.pictPolicyBox.TabStop = false;
            //
            // pictHorzontalBar1
            //
            this.pictHorzontalBar1.BackColor = System.Drawing.SystemColors.AppWorkspace;
            this.pictHorzontalBar1.Location = new System.Drawing.Point(8, 112);
            this.pictHorzontalBar1.Name = "pictHorzontalBar1";
            this.pictHorzontalBar1.Size = new System.Drawing.Size(536, 2);
            this.pictHorzontalBar1.TabIndex = 43;
            this.pictHorzontalBar1.TabStop = false;
            //
            // lblInstructions
            //
            this.lblInstructions.Font = new System.Drawing.Font("Tahoma", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.lblInstructions.Location = new System.Drawing.Point(96, 48);
            this.lblInstructions.Name = "lblInstructions";
            this.lblInstructions.Size = new System.Drawing.Size(456, 56);
            this.lblInstructions.TabIndex = 42;
            this.lblInstructions.Text = "Enter the required information for the policy applicable to the auto claim you ar" +
                "e submitting. Enter the vehicle exactly as it appears on the policy or insurance" +
                " card.";
            //
            // lblTitle
            //
            this.lblTitle.Font = new System.Drawing.Font("Tahoma", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.lblTitle.Location = new System.Drawing.Point(8, 8);
            this.lblTitle.Name = "lblTitle";
            this.lblTitle.Size = new System.Drawing.Size(288, 32);
            this.lblTitle.TabIndex = 41;
            this.lblTitle.Text = "Auto Claim";
            //
            // pictCheckmarks
            //
            this.pictCheckmarks.BackColor = System.Drawing.Color.White;
            this.pictCheckmarks.BackgroundImage = ((System.Drawing.Bitmap)(resources.GetObject("pictCheckmarks.BackgroundImage")));
            this.pictCheckmarks.Location = new System.Drawing.Point(32, 40);
            this.pictCheckmarks.Name = "pictCheckmarks";
            this.pictCheckmarks.Size = new System.Drawing.Size(40, 72);
            this.pictCheckmarks.TabIndex = 66;
            this.pictCheckmarks.TabStop = false;
            //
            // inkPictVehicle
            //
            this.inkPictVehicle.AutoRedraw = false;
            this.inkPictVehicle.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.inkPictVehicle.Image = ((System.Drawing.Bitmap)(resources.GetObject("inkPictVehicle.Image")));
            this.inkPictVehicle.Location = new System.Drawing.Point(32, 440);
            this.inkPictVehicle.MarginX = -1;
            this.inkPictVehicle.MarginY = -1;
            this.inkPictVehicle.Name = "inkPictVehicle";
            this.inkPictVehicle.Size = new System.Drawing.Size(352, 232);
            this.inkPictVehicle.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            this.inkPictVehicle.TabIndex = 67;
            this.inkPictVehicle.Paint += new System.Windows.Forms.PaintEventHandler(this.inkPictVehicle_Paint);
            //
            // lstAnnotationLayer
            //
            this.lstAnnotationLayer.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.lstAnnotationLayer.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.lstAnnotationLayer.ItemHeight = 19;
            this.lstAnnotationLayer.Items.AddRange(new object[] {
                                                                    "Body",
                                                                    "Windows",
                                                                    "Tires",
                                                                    "Headlights"});
            this.lstAnnotationLayer.Location = new System.Drawing.Point(416, 432);
            this.lstAnnotationLayer.Name = "lstAnnotationLayer";
            this.lstAnnotationLayer.Size = new System.Drawing.Size(104, 135);
            this.lstAnnotationLayer.TabIndex = 68;
            this.lstAnnotationLayer.SelectedIndexChanged += new System.EventHandler(this.lstAnnotationLayer_SelectedIndexChanged);
            //
            // inkEdPolicyNumber
            //
            this.inkEdPolicyNumber.Cursor = System.Windows.Forms.Cursors.Default;
            this.inkEdPolicyNumber.Location = new System.Drawing.Point(208, 136);
            this.inkEdPolicyNumber.Name = "inkEdPolicyNumber";
            this.inkEdPolicyNumber.Size = new System.Drawing.Size(312, 32);
            this.inkEdPolicyNumber.TabIndex = 69;
            this.inkEdPolicyNumber.Text = "";
            this.inkEdPolicyNumber.UseMouseForInput = true;
            //
            // inkEdName
            //
            this.inkEdName.Cursor = System.Windows.Forms.Cursors.Default;
            this.inkEdName.Location = new System.Drawing.Point(208, 176);
            this.inkEdName.Name = "inkEdName";
            this.inkEdName.Size = new System.Drawing.Size(312, 32);
            this.inkEdName.TabIndex = 70;
            this.inkEdName.Text = "";
            this.inkEdName.UseMouseForInput = true;
            //
            // inkEdYear
            //
            this.inkEdYear.Cursor = System.Windows.Forms.Cursors.Default;
            this.inkEdYear.Location = new System.Drawing.Point(208, 280);
            this.inkEdYear.Name = "inkEdYear";
            this.inkEdYear.Size = new System.Drawing.Size(312, 32);
            this.inkEdYear.TabIndex = 71;
            this.inkEdYear.Text = "";
            this.inkEdYear.UseMouseForInput = true;
            //
            // inkEdMake
            //
            this.inkEdMake.Cursor = System.Windows.Forms.Cursors.Default;
            this.inkEdMake.Location = new System.Drawing.Point(208, 320);
            this.inkEdMake.Name = "inkEdMake";
            this.inkEdMake.Size = new System.Drawing.Size(312, 32);
            this.inkEdMake.TabIndex = 72;
            this.inkEdMake.Text = "";
            this.inkEdMake.UseMouseForInput = true;
            //
            // inkEdModel
            //
            this.inkEdModel.Cursor = System.Windows.Forms.Cursors.Default;
            this.inkEdModel.Location = new System.Drawing.Point(208, 360);
            this.inkEdModel.Name = "inkEdModel";
            this.inkEdModel.Size = new System.Drawing.Size(312, 32);
            this.inkEdModel.TabIndex = 73;
            this.inkEdModel.Text = "";
            this.inkEdModel.UseMouseForInput = true;
            //
            // AutoClaims
            //
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.AutoScroll = true;
            this.BackColor = System.Drawing.Color.White;
            this.ClientSize = new System.Drawing.Size(560, 694);
            this.Controls.AddRange(new System.Windows.Forms.Control[] {
                                                                          this.inkEdModel,
                                                                          this.inkEdMake,
                                                                          this.inkEdYear,
                                                                          this.inkEdName,
                                                                          this.inkEdPolicyNumber,
                                                                          this.lstAnnotationLayer,
                                                                          this.inkPictVehicle,
                                                                          this.lblVehicleDamage,
                                                                          this.lblVehicleDescription,
                                                                          this.lblModel,
                                                                          this.lblYear,
                                                                          this.lblMake,
                                                                          this.lblPolicyNumber,
                                                                          this.lblInsuredName,
                                                                          this.chHideLayer,
                                                                          this.pictHorzontalBar2,
                                                                          this.pictVehicleBox,
                                                                          this.pictHorzontalBar3,
                                                                          this.pictPolicyBox,
                                                                          this.pictHorzontalBar1,
                                                                          this.lblInstructions,
                                                                          this.lblTitle,
                                                                          this.pictCheckmarks});
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
            this.MaximizeBox = false;
            this.Name = "AutoClaims";
            this.Text = "AutoClaims";
            this.Load += new System.EventHandler(this.AutoClaims_Load);
            this.ResumeLayout(false);

        }

void AutoClaims::AutoClaims::InitializeComponent ( ) [inline, private]

Required method for Designer support - do not modify the contents of this method with the code editor.

Definition at line 224 of file AutoClaims.cs.

        {
            System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(AutoClaims));
            this.lblVehicleDamage = new System.Windows.Forms.Label();
            this.lblVehicleDescription = new System.Windows.Forms.Label();
            this.lblModel = new System.Windows.Forms.Label();
            this.lblYear = new System.Windows.Forms.Label();
            this.lblMake = new System.Windows.Forms.Label();
            this.lblPolicyNumber = new System.Windows.Forms.Label();
            this.lblInsuredName = new System.Windows.Forms.Label();
            this.chHideLayer = new System.Windows.Forms.CheckBox();
            this.pictHorzontalBar2 = new System.Windows.Forms.PictureBox();
            this.pictVehicleBox = new System.Windows.Forms.PictureBox();
            this.pictHorzontalBar3 = new System.Windows.Forms.PictureBox();
            this.pictPolicyBox = new System.Windows.Forms.PictureBox();
            this.pictHorzontalBar1 = new System.Windows.Forms.PictureBox();
            this.lblInstructions = new System.Windows.Forms.Label();
            this.lblTitle = new System.Windows.Forms.Label();
            this.pictCheckmarks = new System.Windows.Forms.PictureBox();
            this.inkPictVehicle = new Microsoft.Ink.InkPicture();
            this.lstAnnotationLayer = new System.Windows.Forms.ListBox();
            this.inkEdPolicyNumber = new Microsoft.Ink.InkEdit();
            this.inkEdName = new Microsoft.Ink.InkEdit();
            this.inkEdYear = new Microsoft.Ink.InkEdit();
            this.inkEdMake = new Microsoft.Ink.InkEdit();
            this.inkEdModel = new Microsoft.Ink.InkEdit();
            this.SuspendLayout();
            //
            // lblVehicleDamage
            //
            this.lblVehicleDamage.AutoSize = true;
            this.lblVehicleDamage.BackColor = System.Drawing.Color.White;
            this.lblVehicleDamage.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.lblVehicleDamage.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.lblVehicleDamage.Location = new System.Drawing.Point(8, 408);
            this.lblVehicleDamage.Name = "lblVehicleDamage";
            this.lblVehicleDamage.Size = new System.Drawing.Size(256, 20);
            this.lblVehicleDamage.TabIndex = 58;
            this.lblVehicleDamage.Text = "Description of vehicle damage";
            this.lblVehicleDamage.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            //
            // lblVehicleDescription
            //
            this.lblVehicleDescription.AutoSize = true;
            this.lblVehicleDescription.BackColor = System.Drawing.Color.White;
            this.lblVehicleDescription.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.lblVehicleDescription.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.lblVehicleDescription.Location = new System.Drawing.Point(8, 240);
            this.lblVehicleDescription.Name = "lblVehicleDescription";
            this.lblVehicleDescription.Size = new System.Drawing.Size(386, 20);
            this.lblVehicleDescription.TabIndex = 56;
            this.lblVehicleDescription.Text = "Enter the involved vehicle listed on the policy ";
            this.lblVehicleDescription.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            //
            // lblModel
            //
            this.lblModel.AutoSize = true;
            this.lblModel.BackColor = System.Drawing.Color.Gainsboro;
            this.lblModel.Font = new System.Drawing.Font("Tahoma", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.lblModel.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.lblModel.Location = new System.Drawing.Point(112, 360);
            this.lblModel.Name = "lblModel";
            this.lblModel.Size = new System.Drawing.Size(73, 23);
            this.lblModel.TabIndex = 52;
            this.lblModel.Text = "Model:";
            this.lblModel.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            //
            // lblYear
            //
            this.lblYear.AutoSize = true;
            this.lblYear.BackColor = System.Drawing.Color.Gainsboro;
            this.lblYear.Font = new System.Drawing.Font("Tahoma", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.lblYear.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.lblYear.Location = new System.Drawing.Point(48, 280);
            this.lblYear.Name = "lblYear";
            this.lblYear.Size = new System.Drawing.Size(135, 23);
            this.lblYear.TabIndex = 51;
            this.lblYear.Text = "Year (YYYY):";
            this.lblYear.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            //
            // lblMake
            //
            this.lblMake.AutoSize = true;
            this.lblMake.BackColor = System.Drawing.Color.Gainsboro;
            this.lblMake.Font = new System.Drawing.Font("Tahoma", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.lblMake.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.lblMake.Location = new System.Drawing.Point(112, 320);
            this.lblMake.Name = "lblMake";
            this.lblMake.Size = new System.Drawing.Size(67, 23);
            this.lblMake.TabIndex = 50;
            this.lblMake.Text = "Make:";
            this.lblMake.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            //
            // lblPolicyNumber
            //
            this.lblPolicyNumber.AutoSize = true;
            this.lblPolicyNumber.BackColor = System.Drawing.Color.Gainsboro;
            this.lblPolicyNumber.Font = new System.Drawing.Font("Tahoma", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.lblPolicyNumber.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.lblPolicyNumber.Location = new System.Drawing.Point(32, 136);
            this.lblPolicyNumber.Name = "lblPolicyNumber";
            this.lblPolicyNumber.Size = new System.Drawing.Size(157, 23);
            this.lblPolicyNumber.TabIndex = 47;
            this.lblPolicyNumber.Text = "Policy Number:";
            this.lblPolicyNumber.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            //
            // lblInsuredName
            //
            this.lblInsuredName.AutoSize = true;
            this.lblInsuredName.BackColor = System.Drawing.Color.Gainsboro;
            this.lblInsuredName.Font = new System.Drawing.Font("Tahoma", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.lblInsuredName.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.lblInsuredName.Location = new System.Drawing.Point(32, 176);
            this.lblInsuredName.Name = "lblInsuredName";
            this.lblInsuredName.Size = new System.Drawing.Size(154, 23);
            this.lblInsuredName.TabIndex = 46;
            this.lblInsuredName.Text = "Insured Name:";
            this.lblInsuredName.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            //
            // chHideLayer
            //
            this.chHideLayer.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.chHideLayer.Location = new System.Drawing.Point(416, 576);
            this.chHideLayer.Name = "chHideLayer";
            this.chHideLayer.Size = new System.Drawing.Size(144, 24);
            this.chHideLayer.TabIndex = 61;
            this.chHideLayer.Text = "Hide Layer";
            this.chHideLayer.CheckedChanged += new System.EventHandler(this.chHideLayer_CheckedChanged);
            //
            // pictHorzontalBar2
            //
            this.pictHorzontalBar2.BackColor = System.Drawing.SystemColors.AppWorkspace;
            this.pictHorzontalBar2.Location = new System.Drawing.Point(8, 224);
            this.pictHorzontalBar2.Name = "pictHorzontalBar2";
            this.pictHorzontalBar2.Size = new System.Drawing.Size(536, 2);
            this.pictHorzontalBar2.TabIndex = 57;
            this.pictHorzontalBar2.TabStop = false;
            //
            // pictVehicleBox
            //
            this.pictVehicleBox.BackColor = System.Drawing.Color.Gainsboro;
            this.pictVehicleBox.Location = new System.Drawing.Point(8, 272);
            this.pictVehicleBox.Name = "pictVehicleBox";
            this.pictVehicleBox.Size = new System.Drawing.Size(184, 120);
            this.pictVehicleBox.TabIndex = 49;
            this.pictVehicleBox.TabStop = false;
            //
            // pictHorzontalBar3
            //
            this.pictHorzontalBar3.BackColor = System.Drawing.SystemColors.AppWorkspace;
            this.pictHorzontalBar3.Location = new System.Drawing.Point(8, 400);
            this.pictHorzontalBar3.Name = "pictHorzontalBar3";
            this.pictHorzontalBar3.Size = new System.Drawing.Size(536, 2);
            this.pictHorzontalBar3.TabIndex = 48;
            this.pictHorzontalBar3.TabStop = false;
            //
            // pictPolicyBox
            //
            this.pictPolicyBox.BackColor = System.Drawing.Color.Gainsboro;
            this.pictPolicyBox.Location = new System.Drawing.Point(8, 128);
            this.pictPolicyBox.Name = "pictPolicyBox";
            this.pictPolicyBox.Size = new System.Drawing.Size(184, 80);
            this.pictPolicyBox.TabIndex = 44;
            this.pictPolicyBox.TabStop = false;
            //
            // pictHorzontalBar1
            //
            this.pictHorzontalBar1.BackColor = System.Drawing.SystemColors.AppWorkspace;
            this.pictHorzontalBar1.Location = new System.Drawing.Point(8, 112);
            this.pictHorzontalBar1.Name = "pictHorzontalBar1";
            this.pictHorzontalBar1.Size = new System.Drawing.Size(536, 2);
            this.pictHorzontalBar1.TabIndex = 43;
            this.pictHorzontalBar1.TabStop = false;
            //
            // lblInstructions
            //
            this.lblInstructions.Font = new System.Drawing.Font("Tahoma", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.lblInstructions.Location = new System.Drawing.Point(96, 48);
            this.lblInstructions.Name = "lblInstructions";
            this.lblInstructions.Size = new System.Drawing.Size(456, 56);
            this.lblInstructions.TabIndex = 42;
            this.lblInstructions.Text = "Enter the required information for the policy applicable to the auto claim you ar" +
                "e submitting. Enter the vehicle exactly as it appears on the policy or insurance" +
                " card.";
            //
            // lblTitle
            //
            this.lblTitle.Font = new System.Drawing.Font("Tahoma", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.lblTitle.Location = new System.Drawing.Point(8, 8);
            this.lblTitle.Name = "lblTitle";
            this.lblTitle.Size = new System.Drawing.Size(288, 32);
            this.lblTitle.TabIndex = 41;
            this.lblTitle.Text = "Auto Claim";
            //
            // pictCheckmarks
            //
            this.pictCheckmarks.BackColor = System.Drawing.Color.White;
            this.pictCheckmarks.BackgroundImage = ((System.Drawing.Bitmap)(resources.GetObject("pictCheckmarks.BackgroundImage")));
            this.pictCheckmarks.Location = new System.Drawing.Point(32, 40);
            this.pictCheckmarks.Name = "pictCheckmarks";
            this.pictCheckmarks.Size = new System.Drawing.Size(40, 72);
            this.pictCheckmarks.TabIndex = 66;
            this.pictCheckmarks.TabStop = false;
            //
            // inkPictVehicle
            //
            this.inkPictVehicle.AutoRedraw = false;
            this.inkPictVehicle.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.inkPictVehicle.Image = ((System.Drawing.Bitmap)(resources.GetObject("inkPictVehicle.Image")));
            this.inkPictVehicle.Location = new System.Drawing.Point(32, 440);
            this.inkPictVehicle.MarginX = -1;
            this.inkPictVehicle.MarginY = -1;
            this.inkPictVehicle.Name = "inkPictVehicle";
            this.inkPictVehicle.Size = new System.Drawing.Size(352, 232);
            this.inkPictVehicle.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            this.inkPictVehicle.TabIndex = 67;
            this.inkPictVehicle.Paint += new System.Windows.Forms.PaintEventHandler(this.inkPictVehicle_Paint);
            //
            // lstAnnotationLayer
            //
            this.lstAnnotationLayer.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.lstAnnotationLayer.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.lstAnnotationLayer.ItemHeight = 19;
            this.lstAnnotationLayer.Items.AddRange(new object[] {
                                                                    "Body",
                                                                    "Windows",
                                                                    "Tires",
                                                                    "Headlights"});
            this.lstAnnotationLayer.Location = new System.Drawing.Point(416, 432);
            this.lstAnnotationLayer.Name = "lstAnnotationLayer";
            this.lstAnnotationLayer.Size = new System.Drawing.Size(104, 135);
            this.lstAnnotationLayer.TabIndex = 68;
            this.lstAnnotationLayer.SelectedIndexChanged += new System.EventHandler(this.lstAnnotationLayer_SelectedIndexChanged);
            //
            // inkEdPolicyNumber
            //
            this.inkEdPolicyNumber.Cursor = System.Windows.Forms.Cursors.Default;
            this.inkEdPolicyNumber.InkMode = Microsoft.Ink.InkMode.Disabled;
            this.inkEdPolicyNumber.Location = new System.Drawing.Point(208, 136);
            this.inkEdPolicyNumber.Name = "inkEdPolicyNumber";
            this.inkEdPolicyNumber.Size = new System.Drawing.Size(312, 32);
            this.inkEdPolicyNumber.TabIndex = 69;
            this.inkEdPolicyNumber.Text = "";
            //
            // inkEdName
            //
            this.inkEdName.Cursor = System.Windows.Forms.Cursors.Default;
            this.inkEdName.InkMode = Microsoft.Ink.InkMode.Disabled;
            this.inkEdName.Location = new System.Drawing.Point(208, 176);
            this.inkEdName.Name = "inkEdName";
            this.inkEdName.Size = new System.Drawing.Size(312, 32);
            this.inkEdName.TabIndex = 70;
            this.inkEdName.Text = "";
            //
            // inkEdYear
            //
            this.inkEdYear.Cursor = System.Windows.Forms.Cursors.Default;
            this.inkEdYear.InkMode = Microsoft.Ink.InkMode.Disabled;
            this.inkEdYear.Location = new System.Drawing.Point(208, 280);
            this.inkEdYear.Name = "inkEdYear";
            this.inkEdYear.Size = new System.Drawing.Size(312, 32);
            this.inkEdYear.TabIndex = 71;
            this.inkEdYear.Text = "";
            this.inkEdYear.Enter += new System.EventHandler(this.inkEdYear_Enter);
            //
            // inkEdMake
            //
            this.inkEdMake.Cursor = System.Windows.Forms.Cursors.Default;
            this.inkEdMake.InkMode = Microsoft.Ink.InkMode.Disabled;
            this.inkEdMake.Location = new System.Drawing.Point(208, 320);
            this.inkEdMake.Name = "inkEdMake";
            this.inkEdMake.Size = new System.Drawing.Size(312, 32);
            this.inkEdMake.TabIndex = 72;
            this.inkEdMake.Text = "";
            this.inkEdMake.Enter += new System.EventHandler(this.inkEdMake_Enter);
            //
            // inkEdModel
            //
            this.inkEdModel.Cursor = System.Windows.Forms.Cursors.Default;
            this.inkEdModel.InkMode = Microsoft.Ink.InkMode.Disabled;
            this.inkEdModel.Location = new System.Drawing.Point(208, 360);
            this.inkEdModel.Name = "inkEdModel";
            this.inkEdModel.Size = new System.Drawing.Size(312, 32);
            this.inkEdModel.TabIndex = 73;
            this.inkEdModel.Text = "";
            this.inkEdModel.Enter += new System.EventHandler(this.inkEdModel_Enter);
            //
            // AutoClaims
            //
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.AutoScroll = true;
            this.BackColor = System.Drawing.Color.White;
            this.ClientSize = new System.Drawing.Size(560, 694);
            this.Controls.AddRange(new System.Windows.Forms.Control[] {
                                                                          this.inkEdModel,
                                                                          this.inkEdMake,
                                                                          this.inkEdYear,
                                                                          this.inkEdName,
                                                                          this.inkEdPolicyNumber,
                                                                          this.lstAnnotationLayer,
                                                                          this.inkPictVehicle,
                                                                          this.lblVehicleDamage,
                                                                          this.lblVehicleDescription,
                                                                          this.lblModel,
                                                                          this.lblYear,
                                                                          this.lblMake,
                                                                          this.lblPolicyNumber,
                                                                          this.lblInsuredName,
                                                                          this.chHideLayer,
                                                                          this.pictHorzontalBar2,
                                                                          this.pictVehicleBox,
                                                                          this.pictHorzontalBar3,
                                                                          this.pictPolicyBox,
                                                                          this.pictHorzontalBar1,
                                                                          this.lblInstructions,
                                                                          this.lblTitle,
                                                                          this.pictCheckmarks});
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
            this.MaximizeBox = false;
            this.Name = "AutoClaims";
            this.Text = "AutoClaims";
            this.Load += new System.EventHandler(this.AutoClaims_Load);
            this.ResumeLayout(false);

        }

void AutoClaims::AutoClaims::inkEdMake_Enter | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler for inkEdMake->Enter Event.

As the edit control receives focus, we attach the shared PenInputPanel to it. The Year, Make, and Model fields demonstrate how to share a single PenInputPanel among multiple controls

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 774 of file AutoClaims.cs.

        {
            if (pipShared != null)
            {
                // Attach the shared PenInputPanel to the Make field
                pipShared.AttachedEditControl = inkEdMake;

                // reset the factoid to bias recognition for general text
                pipShared.Factoid = "DEFAULT";

                // Enable Text Services Framework on the Make field.
                // InkEdit already provides a correction UI, but here EnableTsf is allowing
                // the PenInputPanel to use the TSF insertion context rather than SendInput
                // to send the handwriting recognition results into the control. This means
                // that text can be inserted even if the field no longer has focus.
                pipShared.EnableTsf(true);
            }
        }

void AutoClaims::AutoClaims::inkEdModel_Enter | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler for inkEdModel->Enter Event.

As the edit control receives focus, we attach the shared PenInputPanel to it. The Year, Make, and Model fields demonstrate how to share a single PenInputPanel among multiple controls

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 802 of file AutoClaims.cs.

        {
            if (pipShared != null)
            {
                // Attach the shared PenInputPanel to the Model field
                pipShared.AttachedEditControl = inkEdModel;

                // reset the factoid to bias recognition for general text
                pipShared.Factoid = "DEFAULT";

                // Enable Text Services Framework on the Model field.
                // InkEdit already provides a correction UI, but here EnableTsf is allowing
                // the PenInputPanel to use the TSF insertion context rather than SendInput
                // to send the handwriting recognition results into the control. This means
                // that text can be inserted even if the field no longer has focus.
                pipShared.EnableTsf(true);
            }
        }

void AutoClaims::AutoClaims::inkEdYear_Enter | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler for inkEdYear->Enter Event.

As the edit control receives focus, we attach the shared PenInputPanel to it. The Year, Make, and Model fields demonstrate how to share a single PenInputPanel among multiple controls

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 746 of file AutoClaims.cs.

        {
            if (pipShared != null)
            {
                // Attach the shared PenInputPanel to the Year field
                pipShared.AttachedEditControl = inkEdYear;

                // set the NUMBER factoid to bias recognition for numbers
                pipShared.Factoid = Factoid.Number;

                // Enable Text Services Framework on the Year field.
                // InkEdit already provides a correction UI, but here EnableTsf is allowing
                // the PenInputPanel to use the TSF insertion context rather than SendInput
                // to send the handwriting recognition results into the control. This means
                // that text can be inserted even if the field no longer has focus.
                pipShared.EnableTsf(true);
            }
        }

void AutoClaims::AutoClaims::inkPictVehicle_Paint | ( | object | sender,
 |  | System.Windows.Forms.PaintEventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from inkPictVehicle->Paint Event.

It is necessary to draw four different types of ink and the ink picture only has one ink associated with it. As a result, the autoredraw feature is turned off and the paint event is handled.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 664 of file AutoClaims.cs.

        {
            // Cycle through each ink layer.  If it is visible, paint it.
            // Note that it is necessary to customize the paint
            // behavior, since we want to hide/show different ink layers.
            foreach (InkLayer layer in inkLayers)
            {
                if (!layer.Hidden)
                {
                    inkPictVehicle.Renderer.Draw(e.Graphics,layer.ActiveInk.Strokes);
                }
            }
        }

void AutoClaims::AutoClaims::inkPictVehicle_Paint | ( | object | sender,
 |  | System.Windows.Forms.PaintEventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from inkPictVehicle->Paint Event.

It is necessary to draw four different types of ink and the ink picture only has one ink associated with it. As a result, the autoredraw feature is turned off and the paint event is handled.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 680 of file AutoClaims.cs.

        {
            // Cycle through each ink layer.  If it is visible, paint it.
            // Note that it is necessary to customize the paint
            // behavior, since we want to hide/show different ink layers.
            foreach (InkLayer layer in inkLayers)
            {
                if (!layer.Hidden)
                {
                    inkPictVehicle.Renderer.Draw(e.Graphics,layer.ActiveInk.Strokes);
                }
            }
        }

void AutoClaims::AutoClaims::inkPictVehicle_Paint | ( | object | sender,
 |  | System.Windows.Forms.PaintEventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from inkPictVehicle->Paint Event.

It is necessary to draw four different types of ink and the ink picture only has one ink associated with it. As a result, the autoredraw feature is turned off and the paint event is handled.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 723 of file AutoClaims.cs.

        {
            // Cycle through each ink layer.  If it is visible, paint it.
            // Note that it is necessary to customize the paint
            // behavior, since we want to hide/show different ink layers.
            foreach (InkLayer layer in inkLayers)
            {
                if (!layer.Hidden)
                {
                    inkPictVehicle.Renderer.Draw(e.Graphics,layer.ActiveInk.Strokes);
                }
            }
        }

void AutoClaims::AutoClaims::lstAnnotationLayer_SelectedIndexChanged | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from lstAnnotationLayer->SelectedIndexChanged Event.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 640 of file AutoClaims.cs.

        {
            // Provided that the new selected index value is different than
            // the previous value...
            if (lstAnnotationLayer.SelectedIndex != selectedIndex)
            {
                if (!inkPictVehicle.CollectingInk)
                {
                    // Set the ink and visibility of the current ink layer
                    inkPictVehicle.DefaultDrawingAttributes.Color = inkLayers[lstAnnotationLayer.SelectedIndex].ActiveColor;
                    chHideLayer.Checked = inkLayers[lstAnnotationLayer.SelectedIndex].Hidden;

                    // Set the active ink object to the selected ink
                    // Note that if the current layer is not visible, empty
                    // ink is used to prevent flicker.
                    inkPictVehicle.InkEnabled = false;
                    inkPictVehicle.Ink = chHideLayer.Checked?emptyInk:inkLayers[lstAnnotationLayer.SelectedIndex].ActiveInk;
                    inkPictVehicle.InkEnabled = !chHideLayer.Checked;

                    selectedIndex = lstAnnotationLayer.SelectedIndex;

                    this.Refresh();
                }
                else
                {
                    // If ink collection is enabled, the active ink cannot be changed
                    // and it is necessary to restore the selection to its previous value.
                    lstAnnotationLayer.SelectedIndex = selectedIndex;
                    MessageBox.Show("Cannot change active ink while collecting ink.");
                }
            }
        }

void AutoClaims::AutoClaims::lstAnnotationLayer_SelectedIndexChanged | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from lstAnnotationLayer->SelectedIndexChanged Event.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 581 of file AutoClaims.cs.

        {
            // Provided that the new selected index value is different than
            // the previous value...
            if (lstAnnotationLayer.SelectedIndex != selectedIndex)
            {
                if (!inkPictVehicle.CollectingInk)
                {
                    // Set the ink and visiblity of the current ink layer
                    inkPictVehicle.DefaultDrawingAttributes.Color = inkLayers[lstAnnotationLayer.SelectedIndex].ActiveColor;
                    chHideLayer.Checked = inkLayers[lstAnnotationLayer.SelectedIndex].Hidden;

                    // Set the active ink object to the selected ink
                    // Note that if the current layer is not visible, empty
                    // ink is used to prevent flicker.
                    inkPictVehicle.InkEnabled = false;
                    inkPictVehicle.Ink = chHideLayer.Checked?emptyInk:inkLayers[lstAnnotationLayer.SelectedIndex].ActiveInk;
                    inkPictVehicle.InkEnabled = !chHideLayer.Checked;

                    selectedIndex = lstAnnotationLayer.SelectedIndex;

                    this.Refresh();
                }
                else
                {
                    // If ink collection is enabled, the active ink cannot be changed
                    // and it is necessary to restore the selection to its previous value.
                    lstAnnotationLayer.SelectedIndex = selectedIndex;
                    MessageBox.Show("Cannot change active ink while collecting ink.");
                }
            }
        }

void AutoClaims::AutoClaims::lstAnnotationLayer_SelectedIndexChanged | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from lstAnnotationLayer->SelectedIndexChanged Event.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 597 of file AutoClaims.cs.

        {
            // Provided that the new selected index value is different than
            // the previous value...
            if (lstAnnotationLayer.SelectedIndex != selectedIndex)
            {
                if (!inkPictVehicle.CollectingInk)
                {
                    // Set the ink and visiblity of the current ink layer
                    inkPictVehicle.DefaultDrawingAttributes.Color = inkLayers[lstAnnotationLayer.SelectedIndex].ActiveColor;
                    chHideLayer.Checked = inkLayers[lstAnnotationLayer.SelectedIndex].Hidden;

                    // Set the active ink object to the selected ink
                    // Note that if the current layer is not visible, empty
                    // ink is used to prevent flicker.
                    inkPictVehicle.InkEnabled = false;
                    inkPictVehicle.Ink = chHideLayer.Checked?emptyInk:inkLayers[lstAnnotationLayer.SelectedIndex].ActiveInk;
                    inkPictVehicle.InkEnabled = !chHideLayer.Checked;

                    selectedIndex = lstAnnotationLayer.SelectedIndex;

                    this.Refresh();
                }
                else
                {
                    // If ink collection is enabled, the active ink cannot be changed
                    // and it is necessary to restore the selection to its previous value.
                    lstAnnotationLayer.SelectedIndex = selectedIndex;
                    MessageBox.Show("Cannot change active ink while collecting ink.");
                }
            }
        }

static void AutoClaims::AutoClaims::Main ( ) [inline, static, private]

The main entry point for the application.

Definition at line 556 of file AutoClaims.cs.

        {
            Application.Run(new AutoClaims());
        }

static void AutoClaims::AutoClaims::Main ( ) [inline, static, private]

The main entry point for the application.

Definition at line 514 of file AutoClaims.cs.

        {
            // Set the current thread to single-threaded aparment.
            Thread.CurrentThread.ApartmentState = ApartmentState.STA;

            Application.Run(new AutoClaims());
        }

Member Data Documentation

internal System Windows Forms CheckBox AutoClaims::AutoClaims::chHideLayer [private]

Definition at line 128 of file AutoClaims.cs.

System ComponentModel Container AutoClaims::AutoClaims::components = null [private]

Definition at line 151 of file AutoClaims.cs.

Ink AutoClaims::AutoClaims::emptyInk = null [private]

Definition at line 119 of file AutoClaims.cs.

Microsoft Ink InkEdit AutoClaims::AutoClaims::inkEdMake [private]

Definition at line 149 of file AutoClaims.cs.

Microsoft Ink InkEdit AutoClaims::AutoClaims::inkEdModel [private]

Definition at line 150 of file AutoClaims.cs.

Microsoft Ink InkEdit AutoClaims::AutoClaims::inkEdName [private]

Definition at line 147 of file AutoClaims.cs.

Microsoft Ink InkEdit AutoClaims::AutoClaims::inkEdPolicyNumber [private]

Definition at line 146 of file AutoClaims.cs.

Microsoft Ink InkEdit AutoClaims::AutoClaims::inkEdYear [private]

Definition at line 148 of file AutoClaims.cs.

InkLayer [] AutoClaims::AutoClaims::inkLayers [private]

Definition at line 115 of file AutoClaims.cs.

Microsoft Ink InkPicture AutoClaims::AutoClaims::inkPictVehicle [private]

Definition at line 145 of file AutoClaims.cs.

internal System Windows Forms Label AutoClaims::AutoClaims::lblInstructions [private]

Definition at line 136 of file AutoClaims.cs.

internal System Windows Forms Label AutoClaims::AutoClaims::lblInsuredName [private]

Definition at line 135 of file AutoClaims.cs.

internal System Windows Forms Label AutoClaims::AutoClaims::lblMake [private]

Definition at line 133 of file AutoClaims.cs.

internal System Windows Forms Label AutoClaims::AutoClaims::lblModel [private]

Definition at line 131 of file AutoClaims.cs.

internal System Windows Forms Label AutoClaims::AutoClaims::lblPolicyNumber [private]

Definition at line 134 of file AutoClaims.cs.

internal System Windows Forms Label AutoClaims::AutoClaims::lblTitle [private]

Definition at line 137 of file AutoClaims.cs.

internal System Windows Forms Label AutoClaims::AutoClaims::lblVehicleDamage [private]

Definition at line 129 of file AutoClaims.cs.

internal System Windows Forms Label AutoClaims::AutoClaims::lblVehicleDescription [private]

Definition at line 130 of file AutoClaims.cs.

internal System Windows Forms Label AutoClaims::AutoClaims::lblYear [private]

Definition at line 132 of file AutoClaims.cs.

internal System Windows Forms ListBox AutoClaims::AutoClaims::lstAnnotationLayer [private]

Definition at line 144 of file AutoClaims.cs.

readonly int AutoClaims::AutoClaims::ObjectsNotInstalledError = -2147221164 [private]

Definition at line 115 of file AutoClaims.cs.

internal System Windows Forms PictureBox AutoClaims::AutoClaims::pictCheckmarks [private]

Definition at line 143 of file AutoClaims.cs.

internal System Windows Forms PictureBox AutoClaims::AutoClaims::pictHorzontalBar1 [private]

Definition at line 142 of file AutoClaims.cs.

internal System Windows Forms PictureBox AutoClaims::AutoClaims::pictHorzontalBar2 [private]

Definition at line 140 of file AutoClaims.cs.

internal System Windows Forms PictureBox AutoClaims::AutoClaims::pictHorzontalBar3 [private]

Definition at line 141 of file AutoClaims.cs.

internal System Windows Forms PictureBox AutoClaims::AutoClaims::pictPolicyBox [private]

Definition at line 139 of file AutoClaims.cs.

internal System Windows Forms PictureBox AutoClaims::AutoClaims::pictVehicleBox [private]

Definition at line 138 of file AutoClaims.cs.

PenInputPanel AutoClaims::AutoClaims::pipName = null [private]

Definition at line 131 of file AutoClaims.cs.

PenInputPanel AutoClaims::AutoClaims::pipPolicyNumber = null [private]

Definition at line 129 of file AutoClaims.cs.

PenInputPanel AutoClaims::AutoClaims::pipShared = null [private]

Definition at line 127 of file AutoClaims.cs.

bool AutoClaims::AutoClaims::selectedHidden = false [private]

Definition at line 125 of file AutoClaims.cs.

int AutoClaims::AutoClaims::selectedIndex = -1 [private]

Definition at line 122 of file AutoClaims.cs.

The documentation for this class was generated from the following files:
  • TabletPC/AutoClaims/C#/AutoClaims.cs
  • TabletPC/AutoClaims15/C#/AutoClaims.cs
  • TabletPC/AutoClaims_WebControl/C#/AutoClaims.cs
Generated on Wed Nov 13 2024 16:58:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: AutoClaims::InkLayer Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • AutoClaims
  • AutoClaims::InkLayer
Public Member Functions | Properties | Private Attributes

AutoClaims::InkLayer Struct Reference

InkLayer represents a given ink layer, which has a color and visibility setting associated with it.

List of all members.

Public Member Functions

InkLayer (Ink ink, Color color, bool hidden)
InkLayer (Ink ink, Color color, bool hidden)
InkLayer (Ink ink, Color color, bool hidden)

Properties

Color | ActiveColor [get, set]
Ink | ActiveInk [get, set]
bool | Hidden [get, set]

Private Attributes

Color | myColor
bool | myHidden
Ink | myInk

Detailed Description

Definition at line 42 of file AutoClaims.cs.

Constructor & Destructor Documentation

AutoClaims::InkLayer::InkLayer | ( | Ink | ink,
 |  | Color | color,
 |  | bool | hidden |
 | ) |  |  | [inline]

Constructor for InkLayer.

Parameters:
ink | The ink
color | The color of the layer
hidden | True if the layer is hidden

Definition at line 55 of file AutoClaims.cs.

        {
            myInk = ink;
            myColor = color;
            myHidden = hidden;
        }

AutoClaims::InkLayer::InkLayer | ( | Ink | ink,
 |  | Color | color,
 |  | bool | hidden |
 | ) |  |  | [inline]

Constructor for InkLayer.

Parameters:
ink | The ink
color | The color of the layer
hidden | True if the layer is hidden

Definition at line 56 of file AutoClaims.cs.

        {
            myInk = ink;
            myColor = color;
            myHidden = hidden;
        }

AutoClaims::InkLayer::InkLayer | ( | Ink | ink,
 |  | Color | color,
 |  | bool | hidden |
 | ) |  |  | [inline]

Constructor for InkLayer.

Parameters:
ink | The ink
color | The color of the layer
hidden | True if the layer is hidden

Definition at line 54 of file AutoClaims.cs.

        {
            myInk = ink;
            myColor = color;
            myHidden = hidden;
        }

Member Data Documentation

Color AutoClaims::InkLayer::myColor [private]

Definition at line 46 of file AutoClaims.cs.

bool AutoClaims::InkLayer::myHidden [private]

Definition at line 47 of file AutoClaims.cs.

Ink AutoClaims::InkLayer::myInk [private]

Definition at line 45 of file AutoClaims.cs.

Property Documentation

Color AutoClaims::InkLayer::ActiveColor [get, set]

The color associated with this layer.

Definition at line 81 of file AutoClaims.cs.

Ink AutoClaims::InkLayer::ActiveInk [get, set]

The property used to set the ink associated with this layer.

Definition at line 66 of file AutoClaims.cs.

bool AutoClaims::InkLayer::Hidden [get, set]

True if this layer is hidden.

Definition at line 96 of file AutoClaims.cs.

The documentation for this struct was generated from the following files:
  • TabletPC/AutoClaims/C#/AutoClaims.cs
  • TabletPC/AutoClaims15/C#/AutoClaims.cs
  • TabletPC/AutoClaims_WebControl/C#/AutoClaims.cs
Generated on Wed Nov 13 2024 16:58:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: BANDINFOSTRUCT Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

BANDINFOSTRUCT Struct Reference

List of all members.

Public Attributes

BOOL bGraphics
BOOL bText
RECT GraphicsRect

Detailed Description

Definition at line 35 of file Print.c.

Member Data Documentation

BOOL BANDINFOSTRUCT::bGraphics

Definition at line 37 of file Print.c.

BOOL BANDINFOSTRUCT::bText

Definition at line 38 of file Print.c.

RECT BANDINFOSTRUCT::GraphicsRect

Definition at line 39 of file Print.c.

The documentation for this struct was generated from the following file:
  • Multimedia/Gdi/WinCap32/Print.c
Generated on Wed Nov 13 2024 16:55:28 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: BANKVCLib::Account Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • BANKVCLib
  • BANKVCLib::Account

BANKVCLib::Account Class Reference

import "BankVC.idl";

Detailed Description

Definition at line 57 of file BankVC.idl.

The documentation for this class was generated from the following file:
  • Web/iis/Components/Cpp/MTXSample/BankVC.idl
Generated on Wed Nov 13 2024 16:58:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: BANKVCLib::CreateTable Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • BANKVCLib
  • BANKVCLib::CreateTable

BANKVCLib::CreateTable Class Reference

import "BankVC.idl";

Detailed Description

Definition at line 65 of file BankVC.idl.

The documentation for this class was generated from the following file:
  • Web/iis/Components/Cpp/MTXSample/BankVC.idl
Generated on Wed Nov 13 2024 16:58:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: BANKVCLib::MoveMoney Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • BANKVCLib
  • BANKVCLib::MoveMoney

BANKVCLib::MoveMoney Class Reference

import "BankVC.idl";

Detailed Description

Definition at line 73 of file BankVC.idl.

The documentation for this class was generated from the following file:
  • Web/iis/Components/Cpp/MTXSample/BankVC.idl
Generated on Wed Nov 13 2024 16:58:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: BINDINGINFO Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

BINDINGINFO Struct Reference

#include "table.h"

List of all members.

Public Attributes

ULONG cBindings
HACCESSOR | hAccessor
DBBINDING * | rgBindings

Detailed Description

Definition at line 109 of file table.h.

Member Data Documentation

ULONG BINDINGINFO::cBindings

Definition at line 112 of file table.h.

HACCESSOR BINDINGINFO::hAccessor

Definition at line 111 of file table.h.

DBBINDING* BINDINGINFO::rgBindings

Definition at line 113 of file table.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/oledb/tablecopy/table.h
Generated on Wed Nov 13 2024 16:55:28 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: blockTag Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

blockTag Struct Reference

List of all members.

Public Attributes

char | chData [BLOCKSIZE]
HANDLE hMem
int | iInUse
SIZE_T | iNext
struct blockTag * | NextBlock
struct blockTag * | PrevBlock

Detailed Description

Definition at line 24 of file list.cpp.

Member Data Documentation

char blockTag::chData[BLOCKSIZE]

Definition at line 30 of file list.cpp.

HANDLE blockTag::hMem

Definition at line 27 of file list.cpp.

int blockTag::iInUse

Definition at line 28 of file list.cpp.

SIZE_T blockTag::iNext

Definition at line 29 of file list.cpp.

struct blockTag* blockTag::NextBlock

Definition at line 26 of file list.cpp.

struct blockTag* blockTag::PrevBlock

Definition at line 25 of file list.cpp.

The documentation for this struct was generated from the following file:
  • Begin/sdkdiff/list.cpp
Generated on Wed Nov 13 2024 16:55:28 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: BROCHUREMACHINELib::PTLauncher Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • BROCHUREMACHINELib
  • BROCHUREMACHINELib::PTLauncher

BROCHUREMACHINELib::PTLauncher Class Reference

import "BrochureMachine.idl";

Detailed Description

Definition at line 39 of file BrochureMachine.idl.

The documentation for this class was generated from the following file:
  • Web/Browser/BrochureMachine/BrochureMachine.idl
Generated on Wed Nov 13 2024 16:58:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: BROWSER_CONFIG Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

BROWSER_CONFIG Struct Reference

#include "browser.h"

List of all members.

Public Attributes

BOOL fEnableProxyFailover
BOOL fProxyAutoDiscovery
UINT nFailureRetries
UINT nTimeLimit
PWSTR pwszEmbeddedLinks
PWSTR pwszHomePage

Detailed Description

Definition at line 7 of file browser.h.

Member Data Documentation

BOOL BROWSER_CONFIG::fEnableProxyFailover

Definition at line 11 of file browser.h.

BOOL BROWSER_CONFIG::fProxyAutoDiscovery

Definition at line 10 of file browser.h.

UINT BROWSER_CONFIG::nFailureRetries

Definition at line 13 of file browser.h.

UINT BROWSER_CONFIG::nTimeLimit

Definition at line 12 of file browser.h.

PWSTR BROWSER_CONFIG::pwszEmbeddedLinks

Definition at line 14 of file browser.h.

PWSTR BROWSER_CONFIG::pwszHomePage

Definition at line 9 of file browser.h.

The documentation for this struct was generated from the following file:
  • Web/winhttp/WinHttpAsyncSample/browser.h
Generated on Wed Nov 13 2024 16:55:28 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: BSTRING Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

BSTRING Class Reference

#include "clUtil.h"

List of all members.

Public Member Functions

BSTRING ()
BSTRING (LPCWSTR lpcwString)
BSTRING (LPCWSTR lpcwString)
BSTRING (LPCSTR lpcString)
BSTRING ()
BSTRING (LPCWSTR lpcwString)
BSTRING (LPCSTR lpcString)
BSTRING (LPCSTR lpcString)
BSTRING ()
BSTRING ()
BSTRING (LPCWSTR lpcwString)
BSTRING (LPCSTR lpcString)
~BSTRING ()
~BSTRING ()
~BSTRING ()
~BSTRING ()
LPBSTR | GetLPBSTR (void)
LPBSTR | GetLPBSTR (void)
LPBSTR | GetLPBSTR (void)
LPBSTR | GetLPBSTR (void)
operator BSTR ()
operator BSTR ()
operator BSTR ()
operator BSTR ()

Private Attributes

BSTR | m_bstr

Detailed Description

Definition at line 137 of file clUtil.h.

Constructor & Destructor Documentation

BSTRING::BSTRING ( ) [inline]

Definition at line 144 of file clUtil.h.

{m_bstr = NULL;}

BSTRING::BSTRING ( LPCWSTR lpcwString ) [inline]

Definition at line 162 of file clUtil.h.

{
  if (NULL != lpcwString)
  {
    m_bstr = SysAllocString(lpcwString);
    ASSERT(NULL != m_bstr);
  }
  else
  {
    m_bstr = NULL;
  }
}

BSTRING::BSTRING ( LPCSTR lpcString )

Definition at line 557 of file clUtil.Cpp.

{
  m_bstr = NULL;

  // Compute the length of the required BSTR, including the null
  int cWC =  MultiByteToWideChar(CP_ACP, 0, lpcString, -1, NULL, 0);
  if (cWC <= 0)
  {
    return;
  }

  // Allocate the BSTR, including the null
  m_bstr = SysAllocStringLen(NULL, cWC); // SysAllocStringLen adds another 1

  ASSERT(NULL != m_bstr);
  if (NULL == m_bstr)
  {
    return;
  }

  ZeroMemory(m_bstr, (cWC + 1) * sizeof(OLECHAR));

  // Copy the string
  MultiByteToWideChar(CP_ACP, 0, lpcString, -1, (LPWSTR) m_bstr, cWC);
}

BSTRING::~BSTRING ( ) [inline]

Definition at line 175 of file clUtil.h.

{
  if (NULL != m_bstr)
  {
    SysFreeString(m_bstr);
  }
}

BSTRING::BSTRING ( ) [inline]

Definition at line 146 of file clUtil.h.

{m_bstr = NULL;}

BSTRING::BSTRING ( LPCWSTR lpcwString ) [inline]
BSTRING::BSTRING ( LPCSTR lpcString )
BSTRING::~BSTRING ( ) [inline]
BSTRING::BSTRING ( ) [inline]

Definition at line 147 of file clUtil.h.

{m_bstr = NULL;}

BSTRING::BSTRING ( LPCWSTR lpcwString ) [inline]
BSTRING::BSTRING ( LPCSTR lpcString )
BSTRING::~BSTRING ( ) [inline]
BSTRING::BSTRING ( ) [inline]

Definition at line 140 of file clUtil.h.

{m_bstr = NULL;}

BSTRING::BSTRING ( LPCWSTR lpcwString ) [inline]
BSTRING::BSTRING ( LPCSTR lpcString )
BSTRING::~BSTRING ( ) [inline]

Member Function Documentation

LPBSTR BSTRING::GetLPBSTR ( void ) [inline]

Definition at line 183 of file clUtil.h.

{
  ASSERT(NULL == m_bstr);

// DO I NEED A CHECK HERE AS WELL?

  return &m_bstr;
}

LPBSTR BSTRING::GetLPBSTR ( void ) [inline]
LPBSTR BSTRING::GetLPBSTR ( void ) [inline]
LPBSTR BSTRING::GetLPBSTR ( void ) [inline]
BSTRING::operator BSTR ( ) [inline]

Definition at line 160 of file clUtil.h.

{return m_bstr;}

BSTRING::operator BSTR ( ) [inline]

Definition at line 157 of file clUtil.h.

{return m_bstr;}

BSTRING::operator BSTR ( ) [inline]

Definition at line 159 of file clUtil.h.

{return m_bstr;}

BSTRING::operator BSTR ( ) [inline]

Definition at line 153 of file clUtil.h.

{return m_bstr;}

Member Data Documentation

BSTR BSTRING::m_bstr [private]

Definition at line 140 of file clUtil.h.

The documentation for this class was generated from the following files:
  • Web/NetMeeting/NMChat/clUtil.h
  • Web/NetMeeting/NMFT/clUtil.h
  • Web/NetMeeting/NMShare/clUtil.h
  • Web/NetMeeting/NMUI/clUtil.h
  • Web/NetMeeting/NMChat/clUtil.Cpp
  • Web/NetMeeting/NMFT/clUtil.Cpp
  • Web/NetMeeting/NMShare/clUtil.Cpp
  • Web/NetMeeting/NMUI/clUtil.Cpp
Generated on Wed Nov 13 2024 16:55:28 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: BTSTR Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

BTSTR Class Reference

#include "clUtil.h"

List of all members.

Public Member Functions

BTSTR (BSTR bstr)
BTSTR (BSTR bstr)
BTSTR (BSTR bstr)
BTSTR (BSTR bstr)
~BTSTR ()
~BTSTR ()
~BTSTR ()
~BTSTR ()
operator LPTSTR ()
operator LPTSTR ()
operator LPTSTR ()
operator LPTSTR ()

Private Attributes

LPTSTR m_psz

Detailed Description

Definition at line 199 of file clUtil.h.

Constructor & Destructor Documentation

BTSTR::BTSTR ( BSTR bstr )

Definition at line 598 of file clUtil.Cpp.

{
  m_psz = PszFromBstr(bstr);
}

BTSTR::~BTSTR ( )

Definition at line 610 of file clUtil.Cpp.

{
  if (NULL != m_psz)
  {
    LocalFree(m_psz);
  }
}

BTSTR::BTSTR ( BSTR bstr )
BTSTR::~BTSTR ( )
BTSTR::BTSTR ( BSTR bstr )
BTSTR::~BTSTR ( )
BTSTR::BTSTR ( BSTR bstr )
BTSTR::~BTSTR ( )

Member Function Documentation

BTSTR::operator LPTSTR ( ) [inline]

Definition at line 209 of file clUtil.h.

{return (NULL == m_psz) ? TEXT("<null>") : m_psz;}

BTSTR::operator LPTSTR ( ) [inline]

Definition at line 206 of file clUtil.h.

{return (NULL == m_psz) ? TEXT("<null>") : m_psz;}

BTSTR::operator LPTSTR ( ) [inline]

Definition at line 210 of file clUtil.h.

{return (NULL == m_psz) ? TEXT("<null>") : m_psz;}

BTSTR::operator LPTSTR ( ) [inline]

Definition at line 210 of file clUtil.h.

{return (NULL == m_psz) ? TEXT("<null>") : m_psz;}

Member Data Documentation

LPTSTR BTSTR::m_psz [private]

Definition at line 202 of file clUtil.h.

The documentation for this class was generated from the following files:
  • Web/NetMeeting/NMChat/clUtil.h
  • Web/NetMeeting/NMFT/clUtil.h
  • Web/NetMeeting/NMShare/clUtil.h
  • Web/NetMeeting/NMUI/clUtil.h
  • Web/NetMeeting/NMChat/clUtil.Cpp
  • Web/NetMeeting/NMFT/clUtil.Cpp
  • Web/NetMeeting/NMShare/clUtil.Cpp
  • Web/NetMeeting/NMUI/clUtil.Cpp
Generated on Wed Nov 13 2024 16:55:28 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAboutDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Protected Member Functions

CAboutDlg Class Reference

#include "cmainwindow.h"

Inherits CDialogLite.

List of all members.

Public Types

enum | { IDD = IDD_ABOUTBOX }
enum | { IDD = IDD_ABOUTBOX }
enum | { IDD = IDD_ABOUTBOX }
enum | { IDD = IDD_ABOUTBOX }
enum | { IDD = IDD_ABOUTBOX }
enum | { IDD = IDD_ABOUTBOX }
enum | { IDD = IDD_ABOUTBOX }
enum | { IDD = IDD_ABOUTBOX }
enum | { IDD = IDD_ABOUTBOX }
enum | { IDD = IDD_ABOUTBOX }
enum | { IDD = IDD_ABOUTBOX }
enum | { IDD = IDD_ABOUTBOX }
enum | { IDD = IDD_ABOUTBOX }
enum | { IDD = IDD_ABOUTBOX }

Public Member Functions

CAboutDlg ()
CAboutDlg ()
CAboutDlg ()
CAboutDlg ()
CAboutDlg ()
CAboutDlg ()
CAboutDlg ()
CAboutDlg ()
CAboutDlg ()
CAboutDlg ()
CAboutDlg ()
CAboutDlg ()
CAboutDlg ()
CAboutDlg ()
CAboutDlg ()
virtual BOOL | OnInitDialog ()

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
virtual void | DoDataExchange (CDataExchange *pDX)
virtual void | DoDataExchange (CDataExchange *pDX)
virtual void | DoDataExchange (CDataExchange *pDX)
virtual void | DoDataExchange (CDataExchange *pDX)
virtual void | DoDataExchange (CDataExchange *pDX)
virtual void | DoDataExchange (CDataExchange *pDX)
virtual void | DoDataExchange (CDataExchange *pDX)
virtual void | DoDataExchange (CDataExchange *pDX)
virtual void | DoDataExchange (CDataExchange *pDX)
virtual void | DoDataExchange (CDataExchange *pDX)
virtual void | DoDataExchange (CDataExchange *pDX)
virtual void | DoDataExchange (CDataExchange *pDX)
virtual void | DoDataExchange (CDataExchange *pDX)
afx_msg void | OnEasterEgg ()
virtual BOOL | OnInitDialog ()
virtual BOOL | OnInitDialog ()

Detailed Description

Definition at line 58 of file VCExploreDlg.Cpp.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 29 of file RTCIncomingDlg.cpp.

: public CDialog

anonymous enum
Enumerator:
IDD

Definition at line 52 of file RTCOutgoingDlg.cpp.

{ IDD = IDD_ABOUTBOX };

anonymous enum
Enumerator:
IDD

Definition at line 20 of file GenericUCPDlg.cpp.

: public CDialog

anonymous enum
Enumerator:
IDD

Definition at line 26 of file AdvClientdlg.cpp.

: public CDialog

anonymous enum
Enumerator:
IDD

Definition at line 34 of file CmdLineConsumerDlg.Cpp.

{ IDD = IDD_ABOUTBOX };

anonymous enum
Enumerator:
IDD

Definition at line 34 of file PermEventsdlg.Cpp.

{ IDD = IDD_ABOUTBOX };

anonymous enum
Enumerator:
IDD

Definition at line 34 of file WbemClientDlg.Cpp.

{ IDD = IDD_ABOUTBOX };

anonymous enum
Enumerator:
IDD

Definition at line 88 of file MainDlg.Cpp.

{ IDD = IDD_ABOUTBOX };

anonymous enum
Enumerator:
IDD

Definition at line 27 of file XMLTreeDlg.cpp.

{ IDD = IDD_ABOUTBOX };

anonymous enum
Enumerator:
IDD

Definition at line 102 of file API.Cpp.

{ IDD = IDD_ABOUTBOX };

anonymous enum
Enumerator:
IDD

Definition at line 24 of file advcgendlg.cpp.

{ IDD = IDD_ABOUTBOX };

anonymous enum
Enumerator:
IDD

Definition at line 65 of file VCExploreDlg.Cpp.

{ IDD = IDD_ABOUTBOX };

anonymous enum
Enumerator:
IDD

Definition at line 117 of file PrintSdi.Cpp.

{ IDD = IDD_ABOUTBOX };

anonymous enum
Enumerator:
IDD

Definition at line 120 of file MqApiTst.Cpp.

{ IDD = IDD_ABOUTBOX };

Constructor & Destructor Documentation

CAboutDlg::CAboutDlg ( )

Definition at line 83 of file VCExploreDlg.Cpp.

                     : CDialog(CAboutDlg::IDD)
{
  //{{AFX_DATA_INIT(CAboutDlg)
  //}}AFX_DATA_INIT
}

CAboutDlg::CAboutDlg ( )
CAboutDlg::CAboutDlg ( )
CAboutDlg::CAboutDlg ( )
CAboutDlg::CAboutDlg ( )
CAboutDlg::CAboutDlg ( )
CAboutDlg::CAboutDlg ( )
CAboutDlg::CAboutDlg ( )
CAboutDlg::CAboutDlg ( )
CAboutDlg::CAboutDlg ( )
CAboutDlg::CAboutDlg ( )
CAboutDlg::CAboutDlg ( )
CAboutDlg::CAboutDlg ( )
CAboutDlg::CAboutDlg ( )
CAboutDlg::CAboutDlg ( )

Member Function Documentation

void CAboutDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 89 of file VCExploreDlg.Cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CAboutDlg)
  //}}AFX_DATA_MAP
}

virtual void CAboutDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]
virtual void CAboutDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]
virtual void CAboutDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]
virtual void CAboutDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]
virtual void CAboutDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]
virtual void CAboutDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]
virtual void CAboutDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]
virtual void CAboutDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]
virtual void CAboutDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]
virtual void CAboutDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]
virtual void CAboutDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]
virtual void CAboutDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]
virtual void CAboutDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]
void CAboutDlg::OnEasterEgg ( ) [protected]

Definition at line 113 of file VCExploreDlg.Cpp.

{
  MessageBox("Built By:\tAllen Herring\n\tApplication Developer Consultant\n\tMicrosoft Corporation\n\n\tFebruary 1999",
        "Party On!",
        (MB_OK | MB_ICONINFORMATION));
}

virtual BOOL CAboutDlg::OnInitDialog ( ) [protected, virtual]

Reimplemented from CDialogLite.

BOOL CAboutDlg::OnInitDialog ( ) [protected, virtual]

Reimplemented from CDialogLite.

Definition at line 103 of file VCExploreDlg.Cpp.

{
  CDialog::OnInitDialog();

  // TODO: Add extra initialization here

  return TRUE;  // return TRUE unless you set the focus to a control
                // EXCEPTION: OCX Property Pages should return FALSE
}

virtual BOOL CAboutDlg::OnInitDialog ( ) [virtual]

Reimplemented from CDialogLite.

The documentation for this class was generated from the following files:
  • Com/Administration/Explore.VC/VCExploreDlg.Cpp
  • Dataaccess/ADO/ADOVCGEN/advcgendlg.cpp
  • NetDS/fax/PrintSdi/PrintSdi.Cpp
  • NetDS/MessageQueuing/MqApiTst/MqApiTst.Cpp
  • NetDS/rtc/Client/CPP/RTCIncoming/RTCIncomingDlg.cpp
  • NetDS/rtc/Client/CPP/RTCOutgoing/RTCOutgoingDlg.cpp
  • NetDS/upnp/GenericUCP/CPP/GenericUCPDlg.cpp
  • SysMgmt/WMI/VC/AdvClient/AdvClientdlg.cpp
  • SysMgmt/WMI/VC/CmdLineConsumer/CmdLineConsumerDlg.Cpp
  • SysMgmt/WMI/VC/EventConsumer/PermEventsdlg.Cpp
  • SysMgmt/WMI/VC/SimpleClient/WbemClientDlg.Cpp
  • Web/MSAgent/c/CapMFC/MainDlg.Cpp
  • Web/xml/mfc_tree/XMLTreeDlg.cpp
  • WinBase/WtsApi/WtsApi/API.Cpp
  • Dataaccess/oledb/rowsetviewer/cmainwindow.h
  • Dataaccess/oledb/rowsetviewer/cmainwindow.cpp
Generated on Wed Nov 13 2024 16:55:28 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAccount Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CAccount Class Reference

#include "CAccount.h"

List of all members.

Public Member Functions

CAccount ()
CAccount ()
CAccount ()
CAccount ()
~CAccount ()
STDMETHODIMP | Activate ()
STDMETHODIMP | Construct (IDispatch *pUnk)
HRESULT | DoWork (long lAccount, long lAmount, BSTR *pbstrResult)
HRESULT | Enlist ()
HRESULT | FinalConstruct ()
void | FinalRelease ()
STDMETHOD() | InterfaceSupportsErrorInfo (REFIID riid)
STDMETHOD() | InterfaceSupportsErrorInfo (REFIID riid)
STDMETHOD() | InterfaceSupportsErrorInfo (REFIID riid)
STDMETHOD() | InterfaceSupportsErrorInfo (REFIID riid)
STDMETHOD() | Post (long lngAccntNum, long lngAmount, BSTR *pVal)
STDMETHOD() | Post (IN long lAccount, IN long lAmount, OUT BSTR *pbstrResult)
STDMETHOD() | Post (IN long lAccount, IN long lAmount, OUT BSTR *pbstrResult)
STDMETHOD() | Post (IN long lAccount, IN long lAmount, OUT BSTR *pbstrResult)
STDMETHODIMP_ (BOOL) CanBePooled()
STDMETHODIMP_ (void) Deactivate()

Private Attributes

long | d_acctBalance
BOOL m_bConstructed
BOOL m_bObjectPooled
BOOL m_bShouldEnlist
HDBC | m_hdbc
HENV | m_henv
HSTMT | m_hstmt
CComBSTR | m_sDSN
GUID | m_txuow

Detailed Description

Definition at line 27 of file CAccount.h.

Constructor & Destructor Documentation

CAccount::CAccount ( ) [inline]

Definition at line 34 of file CAccount.h.

{ d_acctBalance = 0L; }

CAccount::CAccount ( ) [inline]

Definition at line 50 of file caccount.h.

  {
    m_henv = 0;
    m_hdbc = 0;
    m_hstmt= 0;
    m_bConstructed = FALSE;
    m_bShouldEnlist = FALSE;
    m_txuow = GUID_NULL;
    m_bObjectPooled = FALSE;
  }

CAccount::~CAccount ( ) [inline]

Definition at line 60 of file caccount.h.

  {
  }

CAccount::CAccount ( ) [inline]

Definition at line 34 of file caccount.h.

{}

CAccount::CAccount ( ) [inline]

Definition at line 17 of file Account.h.

  {
  }

Member Function Documentation

STDMETHODIMP CAccount::Activate ( void )

Definition at line 411 of file caccount.Cpp.

{

  //  should only do this when we are being activated in different
  //  tx units of work
  m_bShouldEnlist = FALSE;

  if (!m_bObjectPooled)
    return S_OK;

  HRESULT hr;
  IObjectContext * pObjectContext = NULL;
  hr = CoGetObjectContext(IID_IObjectContext, (void**)&pObjectContext);
  _ASSERTE(pObjectContext);
  GUID txUOW = GUID_NULL;
  IObjectContextInfo  * pObjTx = NULL;
  pObjectContext -> QueryInterface(IID_IObjectContextInfo, (void **)&pObjTx);
  if (pObjTx)
  {
    pObjTx -> GetTransactionId (&txUOW);
    pObjTx -> Release();
  }
  pObjectContext -> Release();

  if (txUOW != m_txuow)
  {
    m_bShouldEnlist = TRUE;
    m_txuow = txUOW;

  }

  return S_OK;

}

STDMETHODIMP CAccount::Construct ( IDispatch * pUnk )

Definition at line 136 of file caccount.Cpp.

{

  if (!pUnk)
    return E_UNEXPECTED;
  HRESULT hr;
  IObjectConstructString * pString = NULL;
  hr = pUnk -> QueryInterface(IID_IObjectConstructString, (void **)&pString);
  if (pString)
  {
    CComBSTR s;
    pString -> get_ConstructString(&s);
    WCHAR * p = wcsstr(s.m_str, L"/NP");
    if (p)
    {
      m_bObjectPooled = FALSE;
      *p = NULL;
    }
    else
      m_bObjectPooled = TRUE;

    m_sDSN = s;
    pString -> Release();
    hr = GetConnection(m_sDSN.m_str, &m_henv, &m_hdbc, &m_hstmt, m_bObjectPooled);
    if (FAILED(hr))
    {
      BSTR sResult;
      GetODBCError(m_henv, m_hdbc, NULL, &sResult);
      AtlReportError( CLSID_CUpdateReceipt, sResult, IID_IAccount, hr);
      SysFreeString(sResult);
      return hr;
    }
  }

  m_bConstructed = TRUE;

  return hr;

}

HRESULT CAccount::DoWork | ( | long | lAccount,
 |  | long | lAmount,
 |  | BSTR * | pbstrResult
 | ) |  |

Definition at line 302 of file caccount.Cpp.

{

  WCHAR szBuffer[512];
  RETCODE rc;
  long lBal = 0;
  long len = 0;
  HRESULT hr = S_OK;

  if (m_bShouldEnlist)
  {
    //
    // NOTE: I know I call SetComplete, so I don't have to set
    //       the m_bShouldEnlist flag to FALSE after I enlist
    //
    hr = Enlist();
    if (FAILED(hr))
      return hr;
  }

  ZeroMemory(szBuffer, 512 * sizeof (WCHAR));
  wsprintf(szBuffer, L"update VcAccount set balance = balance + %ld where AccountNo = %ld", lAmount, lAccount);
  rc = SQLExecDirect(m_hstmt, szBuffer, SQL_NTS);
  if (SQL_FAILED(rc))
  {
    GetODBCError(m_henv, m_hdbc, m_hstmt, pbstrResult);
    return E_UNEXPECTED;

  }

  long nRowsAffected;
  rc = SQLRowCount( m_hstmt, &nRowsAffected);
  if (nRowsAffected == 0)
  {
    wsprintf (szBuffer, L"account %ld not on file. (VC++ ODBC)", lAccount);
    *pbstrResult = SysAllocString(szBuffer);
    return E_FAIL;
  }

  wsprintf (szBuffer, L"SELECT Balance FROM VcAccount WHERE AccountNo = %ld", lAccount);

  rc = SQLExecDirect(m_hstmt, szBuffer, SQL_NTS);
  if (SQL_FAILED(rc))
  {
    GetODBCError(m_henv, m_hdbc, m_hstmt, pbstrResult);
    return E_UNEXPECTED;

  }
  while (SQLFetch(m_hstmt) == SQL_SUCCESS) // only get the first one for now
  {

    rc = SQLGetData(m_hstmt, 1, SQL_C_LONG, &lBal, 0, &len);
  }

  // Check for overdraw, then prepare return string
  if (lBal < 0)
  {

    wsprintf (szBuffer, L"Error. Account %ld would be overdrawn by %ld.  Balance is still %ld",
        lAccount, -lBal, lBal - lAmount);

    *pbstrResult = ::SysAllocString(szBuffer);
    return E_FAIL;
  }

  SQLFreeStmt(m_hstmt, SQL_CLOSE);

  wsprintf (szBuffer, L"%s account %ld, balance is $%ld. (VC++ ODBC)",
      lAmount >= 0 ? L"Credit to" : L"Debit from", lAccount, lBal);

  *pbstrResult = SysAllocString(szBuffer);

  return S_OK;
}

HRESULT CAccount::Enlist ( )

Definition at line 452 of file caccount.Cpp.

{
  HRESULT hr;
  IObjectContext * pObjectContext = NULL;
  hr = CoGetObjectContext(IID_IObjectContext, (void**)&pObjectContext);
  _ASSERTE(pObjectContext);

  IObjectContextInfo  * pObjTx = NULL;
  pObjectContext -> QueryInterface(IID_IObjectContextInfo, (void **)&pObjTx);
  pObjectContext -> Release();
  if (pObjTx)
  {
    ITransaction * pTx = NULL;
    pObjTx -> GetTransaction ((IUnknown **)&pTx);
    RETCODE rc ;
    if (pTx)
    {
      rc = SQLSetConnectOption(m_hdbc, SQL_ATTR_ENLIST_IN_DTC, (UDWORD)pTx);
      if (SQL_FAILED(rc))
      {
#ifdef _DEBUG
        BSTR sErr;
        GetODBCError(m_henv, m_hdbc, m_hstmt, &sErr);
        AtlTrace(L"Warning! Failed to enlist on caller tx in VCAccount!\n");
        AtlTrace(L"ODBC Error: ");
        AtlTrace(sErr);
        AtlTrace(L"\n");
        SysFreeString(sErr);
#endif
        hr = E_FAIL;
      }

      pTx -> Release();
    }

    pObjTx -> Release();
  }

  return hr;
}

HRESULT CAccount::FinalConstruct ( ) [inline]

Definition at line 79 of file caccount.h.

{
  return S_OK;
}

void CAccount::FinalRelease ( )

Definition at line 385 of file caccount.Cpp.

{
  if (m_hstmt)
    SQLFreeStmt(m_hstmt, SQL_DROP);
  if (m_hdbc)
  {
    SQLDisconnect(m_hdbc);
    SQLFreeConnect(m_hdbc);
  }
  if (m_henv)
    SQLFreeEnv(m_henv);

  m_hstmt = 0;
  m_henv = 0;
  m_hdbc = 0;
}

STDMETHOD() CAccount::InterfaceSupportsErrorInfo ( REFIID riid )
STDMETHOD() CAccount::InterfaceSupportsErrorInfo ( REFIID riid )
STDMETHOD() CAccount::InterfaceSupportsErrorInfo ( REFIID riid )
STDMETHODIMP CAccount::InterfaceSupportsErrorInfo ( REFIID riid )

Definition at line 31 of file CAccount.cpp.

{
  static const IID* arr[] =
  {
    &IID_IAccount,
  };

  for (int i=0;i<sizeof(arr)/sizeof(arr[0]);i++)
  {
    if (  *arr[i] == riid )
      return S_OK;
  }
  return S_FALSE;
}

STDMETHODIMP CAccount::Post | ( | long | lngAccntNum,
 |  | long | lngAmount,
 |  | BSTR * | pVal
 | ) |  |

Definition at line 21 of file Account.cpp.

{
  // Get the ObjectContext object

  _RecordsetPtr pRecordset = NULL;
  BOOL bFatal = FALSE;
  TCHAR strErr[256];
  _ConnectionPtr pConnection;
  FieldsPtr pFields;
  FieldPtr pField;
  CComVariant vntValue;
  CComPtr<ICreateTable> pCreateTable;
  CComBSTR bstrSQL;

  CComPtr<IObjectContext> pObjectContext = NULL;

  HRESULT hr = GetObjectContext(&pObjectContext);

  if (FAILED(hr))
  {
    wsprintf(strErr, "GetObjectContext() failed!");

    goto ErrorHandler;
  }

  // Create ADODB.Connection object

  hr = pConnection.CreateInstance("ADODB.Connection.1");

  if (FAILED(hr))
  {
    wsprintf(strErr, "Failed to Create ADODB.Connection object!");

    goto ErrorHandler;
  }

  // Open ODBC connection

  hr = pConnection->Open(CONNECTION, NULL, NULL, NULL);

  if (FAILED(hr))
  {
    wsprintf(strErr, "Open connection failed!");

    goto ErrorHandler;
  }

  // Execute Update SQL statement

  wsprintf(strErr, "Update Account Set Balance = Balance + %d where AccountNo = %d", lngAmount, lngAccntNum);

  bstrSQL = CComBSTR(strErr);

TryAgain:

  hr = pConnection->Execute(bstrSQL, static_cast<VARIANT *>(&vtMissing), adCmdText, &pRecordset);

  if (FAILED(hr))
    goto ErrorCreateTable;

  wsprintf(strErr, "Select Balance from Account where AccountNo = %d", lngAccntNum);

  bstrSQL = CComBSTR(strErr);

  // Get current balance

  hr = pConnection->Execute(bstrSQL, static_cast<VARIANT *>(&vtMissing), adCmdText, &pRecordset);

  if (FAILED(hr))
  {
    wsprintf(strErr, "Unable to obtain balance for Account %d", lngAccntNum);

    goto ErrorHandler;
  }

  pRecordset->get_Fields(&pFields);

  pFields->get_Item(CComVariant(L"Balance"), &pField);

  pField->get_Value(&vntValue);

  // If the current balance is less than 0, abort transaction otherwise complete transaction

  if (vntValue.lVal < 0)
  {
    wsprintf(strErr, "Not enough fund to withdraw");

    goto ErrorHandler;
  }

  wsprintf(strErr, "%s account %ld, balance is $%ld. (VC++)", ((lngAmount >= 0) ? "Credit to" : "Debit from"), lngAmount, vntValue.lVal);

  *pVal = CComBSTR(strErr).Copy();

  pObjectContext->SetComplete();

  return S_OK;

ErrorCreateTable:

  // first pass OK, but not second;

  if (bFatal == TRUE)
    goto ErrorHandler;

  bFatal = TRUE;

  // create a CreateTable object

  hr = pObjectContext->CreateInstance(CLSID_CreateTable, IID_ICreateTable, (void**)&pCreateTable);

  if (FAILED(hr))
    goto ErrorHandler;

  hr = pCreateTable->CreateAccount();

  if (FAILED(hr))
    goto ErrorHandler;

  goto TryAgain;

ErrorHandler:

  Error(strErr,IID_IAccount);

  if (pObjectContext)
    pObjectContext->SetAbort();

  return hr;
}

STDMETHOD() CAccount::Post | ( | IN long | lAccount,
 |  | IN long | lAmount,
 |  | OUT BSTR * | pbstrResult
 | ) |  |
STDMETHOD() CAccount::Post | ( | IN long | lAccount,
 |  | IN long | lAmount,
 |  | OUT BSTR * | pbstrResult
 | ) |  |
STDMETHODIMP CAccount::Post | ( | IN long | lAccount,
 |  | IN long | lAmount,
 |  | OUT BSTR * | pbstrResult
 | ) |  |

Definition at line 59 of file CAccount.cpp.

{
  if( pbstrResult == 0 )
  {
    return E_POINTER;
  }

  HRESULT hr = S_OK;

  *pbstrResult = NULL;

  long lErrFlag = 0;
  TCHAR* pErrMsg = NULL;

  // See if we have sufficient funds
  // We're ignoring the rollover case here.
  if( ( d_acctBalance + lAmount ) < 0 )
  {
    // Error checking code removed for brevity
    ICreateErrorInfo * pCreateErrorInfo = NULL;
    CreateErrorInfo( &pCreateErrorInfo );
    pCreateErrorInfo->SetDescription( OLESTR( "Insufficient funds to perform transaction" ) );
    pCreateErrorInfo->SetGUID( __uuidof( IAccount ) );

    IErrorInfo* pErrorInfo = 0;
    pCreateErrorInfo->QueryInterface( IID_IErrorInfo, reinterpret_cast< void** >( &pErrorInfo ) );

    SetErrorInfo(NULL, static_cast< IErrorInfo* >( pErrorInfo) );
    return E_FAIL;
  }

  // Perform the transaction
  d_acctBalance += lAmount;

  // Generate a transaction description
  // Let the compiler choose the correct string template
  // based on UNICODE settings.  ( don't use std::string or std::wstring )
  std::basic_string< TCHAR > description;

  if( lAmount < 0 )
  {
    TCHAR txtBuffer[ 1024 ];
    wsprintf( txtBuffer
          , TEXT( "Debit from account %d, balance is $%d" )
          , lAccount
        , d_acctBalance );

    description = txtBuffer;
  }
  else
  {
    TCHAR txtBuffer[ 1024 ];
    wsprintf( txtBuffer
          , TEXT( "Credit from account %d, balance is $%d" )
          , lAccount
        , d_acctBalance );

    description = txtBuffer;
  }

  description += " (VC++)";
  // Set up our out param and then we're done ( with the required stuff )
  *pbstrResult = SysAllocString( _bstr_t( description.c_str( ) ) );

  // Because everything went well, we want to notify interested clients
  // that a sucessful post occured.
  // We don't particularly care whether the event went out in this sample,
  // so we'll go as far as we can.  On error, we'll silently fail and
  // return success to the client ( because the POST was a success )

  HRESULT eventHR;

  IMTSLocator* mtsLocator = 0;
  eventHR = CoCreateInstance( CLSID_CoMTSLocator
                          , NULL
                , CLSCTX_ALL
                , __uuidof( IMTSLocator )
                , reinterpret_cast< void** >( &mtsLocator ) );

  if( SUCCEEDED( eventHR ) )
  {
    // In order to dispatch a User Event, we need to locate the object that
    // will do this for us.  The MTSLocator object does this.
    IUnknown* eventDispatcher = 0;
    eventHR = mtsLocator->GetEventDispatcher( &eventDispatcher );

    if( SUCCEEDED( eventHR ) )
    {
      // We need to get the correct interface....
      IMtsEvents* mtsEvents = 0;
      eventHR = eventDispatcher->QueryInterface( __uuidof( IMtsEvents )
                                             , reinterpret_cast< void** >( &mtsEvents ) );

      if( SUCCEEDED( eventHR ) )
      {
        // And now that we have it, we can publish on the UserEvents event.
        // it simply takes a variant, which makes it very flexable.  We'll
        // stuff a string in there.
        VARIANT param;
        param.vt = VT_BSTR;
        param.bstrVal = _bstr_t( description.c_str( ) );
        mtsEvents->PostEvent( &param );

        mtsEvents->Release( );
        mtsEvents = 0;
      }
      eventDispatcher->Release( );
      eventDispatcher = 0;
    }

    mtsLocator->Release( );
    eventDispatcher = 0;
  }

  return S_OK;
}

CAccount::STDMETHODIMP_ ( void ) [inline]

Definition at line 106 of file caccount.h.

  {
    // nothing to do
  }

CAccount::STDMETHODIMP_ ( BOOL ) [inline]

Definition at line 99 of file caccount.h.

  {
    return TRUE;
  }

Member Data Documentation

long CAccount::d_acctBalance [private]

Definition at line 56 of file CAccount.h.

BOOL CAccount::m_bConstructed [private]

Definition at line 45 of file caccount.h.

BOOL CAccount::m_bObjectPooled [private]

Definition at line 48 of file caccount.h.

BOOL CAccount::m_bShouldEnlist [private]

Definition at line 46 of file caccount.h.

HDBC CAccount::m_hdbc [private]

Definition at line 42 of file caccount.h.

HENV CAccount::m_henv [private]

Definition at line 41 of file caccount.h.

HSTMT CAccount::m_hstmt [private]

Definition at line 43 of file caccount.h.

CComBSTR CAccount::m_sDSN [private]

Definition at line 44 of file caccount.h.

GUID CAccount::m_txuow [private]

Definition at line 47 of file caccount.h.

The documentation for this class was generated from the following files:
  • Com/Services/Events/UserEvents/VCAcct/CAccount.h
  • Com/Services/Object_Pooling/OPBankSample/Account.VC/caccount.h
  • Com/Services/Transaction/SampleBank/VCAcct/caccount.h
  • Web/iis/Components/Cpp/MTXSample/Account.h
  • Com/Services/Events/UserEvents/VCAcct/CAccount.cpp
  • Com/Services/Object_Pooling/OPBankSample/Account.VC/caccount.Cpp
  • Com/Services/Transaction/SampleBank/VCAcct/caccount.Cpp
  • Web/iis/Components/Cpp/MTXSample/Account.cpp
Generated on Wed Nov 13 2024 16:55:28 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CachePluginAdmin Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Properties | Private Attributes

CachePluginAdmin Class Reference

Inherits IWMSCacheAdmin.

List of all members.

Public Member Functions

CachePluginAdmin ()
object | FetchNameValFromServerNamespace (string strKey, object objValue)
void | LoadSettingsFromServerNamespace ()
bool | LoadSettingsFromXmlFile (string strPath)
delegate void | ModifySettingsEventHandler (string strName, object objValue)
void | PersistChangesToXmlFile (string strPath)
void | PersistChangesToXmlFile ()
void | PersistNameValToServerNamespace (string strKey, object objValue)
void | RegisterChange (string strName, object objValue)
void | RegisterChangeHandler (ModifySettingsEventHandler theHandler)

Properties

int IWMSCacheAdmin. | ArchiveQuotaPerStream [get, set]
int | ArchiveQuotaPerStream [get, set]
string IWMSCacheAdmin. | BackendServer [get, set]
string | BackendServer [get, set]
string | CacheDirectoryPath [get, set]
string IWMSCacheAdmin. | CacheDirectoryPath [get, set]
bool IWMSCacheAdmin. | CacheOnDemandCacheMiss [get, set]
bool | CacheOnDemandCacheMiss [get, set]
int | DiskQuota [get, set]
int IWMSCacheAdmin. | DiskQuota [get, set]
WMSNamedValues | NamedValues [set]
string IWMSCacheAdmin. | PreferredProtocol [get, set]
string | PreferredProtocol [get, set]
bool IWMSCacheAdmin. | ProxyOnDemandCacheMiss [get, set]
bool | ProxyOnDemandCacheMiss [get, set]
string IWMSCacheAdmin. | ProxyRedirectURL [get, set]
string | ProxyRedirectURL [get, set]

Private Attributes

WMSNamedValues | g_NamedValues = null
ModifySettingsEventHandler | RegisteredChangeHandler = null
PersistedConfiguration SerializedValues
string | strPathToConfigDoc = ""

Detailed Description

Definition at line 44 of file PluginAdmin.cs.

Constructor & Destructor Documentation

CachePluginAdmin::CachePluginAdmin ( ) [inline]

Definition at line 52 of file PluginAdmin.cs.

    {
        SerializedValues = new PersistedConfiguration();
        SerializedValues.diskQuota = -1;
        SerializedValues.archiveQuotaPerStream = -1;
        SerializedValues.reverseProxyRedirectURL = "";
        SerializedValues.backendServer = "";
        SerializedValues.enableCaching = false;
        SerializedValues.enableProxy = false;
        SerializedValues.proxyOnDemandCacheMiss = false;
        SerializedValues.cacheOnDemandCacheMiss = false;
        SerializedValues.handleUpstreamCacheRequests = false;
        SerializedValues.protocol = protocolEnum.clientprotocol;
        RegisteredChangeHandler = null;
    }

Member Function Documentation

object CachePluginAdmin::FetchNameValFromServerNamespace | ( | string | strKey,
 |  | object | objValue |
 | ) |  |  | [inline]

Definition at line 177 of file PluginAdmin.cs.

    {
        if( null == g_NamedValues )
        {
            return( null );
        }
        foreach( IWMSNamedValue NamedVal in g_NamedValues )
        {
            if( NamedVal.Name == strKey )
            {
                return( NamedVal.Value );
            }
        }
        return( null );
    }

void CachePluginAdmin::LoadSettingsFromServerNamespace ( ) [inline]

Definition at line 80 of file PluginAdmin.cs.

    {
        if( null == g_NamedValues )
        {
            return;
        }
        if( null == SerializedValues )
        {
            SerializedValues = new PersistedConfiguration();
            FetchNameValFromServerNamespace( "ArchiveQuotaPerStream", SerializedValues.archiveQuotaPerStream );
            FetchNameValFromServerNamespace( "BackendServer", SerializedValues.backendServer );
            FetchNameValFromServerNamespace( "CacheDirectoryPath", SerializedValues.cacheDirectoryPath );
            FetchNameValFromServerNamespace( "CacheOnDemandCacheMiss", SerializedValues.cacheOnDemandCacheMiss );
            FetchNameValFromServerNamespace( "DiskQuota", SerializedValues.diskQuota );
            FetchNameValFromServerNamespace( "EnableCaching", SerializedValues.enableCaching );
            FetchNameValFromServerNamespace( "EnableProxy", SerializedValues.enableProxy );
            FetchNameValFromServerNamespace( "HandleUpstreamCacheRequests", SerializedValues.handleUpstreamCacheRequests );
            FetchNameValFromServerNamespace( "PreferredProtocol", SerializedValues.protocol );
            FetchNameValFromServerNamespace( "ProxyOnDemandCacheMiss", SerializedValues.proxyOnDemandCacheMiss );
            FetchNameValFromServerNamespace( "ReverseProxyRedirectURL", SerializedValues.reverseProxyRedirectURL );
        }
    }

bool CachePluginAdmin::LoadSettingsFromXmlFile ( string strPath ) [inline]

Definition at line 103 of file PluginAdmin.cs.

    {
        FileStream fs = null;
        bool bSucceeded = false;
        try
        {
            // A FileStream is needed to read the XML document.
            fs = new FileStream( strPath, FileMode.Open);
        }
        catch( Exception e )
        {
            Console.WriteLine( "Exception: {0}\n{1}", e.Message, e.StackTrace );
            return( false );
        }

        XmlTextReader reader = new XmlTextReader(fs);

        // Create an instance of the XmlSerializer specifying type and namespace.
        XmlSerializer serializer = new XmlSerializer( typeof( PersistedConfiguration ) );

        PersistedConfiguration tmpSettings = null;

        try
        {
            tmpSettings = (PersistedConfiguration) serializer.Deserialize( reader );
        }
        catch( Exception e )
        {
            Console.WriteLine( "Exception: {0}\n{1}", e.Message, e.StackTrace );
        }
        if( null != tmpSettings )
        {
            SerializedValues = null;
            SerializedValues = tmpSettings;
            tmpSettings = null;
            bSucceeded = true;
        }

        serializer = null;
        reader.Close();
        reader = null;
        strPathToConfigDoc = strPath;
        return( bSucceeded );
    }

delegate void CachePluginAdmin::ModifySettingsEventHandler | ( | string | strName,
 |  | object | objValue
 | ) |  |
void CachePluginAdmin::PersistChangesToXmlFile ( string strPath ) [inline]

Definition at line 148 of file PluginAdmin.cs.

    {
        XmlTextWriter writer = new XmlTextWriter( strPath, System.Text.Encoding.UTF8 );

        // Create an instance of the XmlSerializer specifying type and namespace.
        XmlSerializer serializer = new XmlSerializer( typeof( PersistedConfiguration ) );

        serializer.Serialize( writer, ( object ) SerializedValues );
        strPathToConfigDoc = strPath;

        writer.Flush();
        writer.Close();
        writer = null;
        serializer = null;
    }

void CachePluginAdmin::PersistChangesToXmlFile ( ) [inline]

Definition at line 164 of file PluginAdmin.cs.

    {
        if( 0 < strPathToConfigDoc.Length )
        {
            PersistChangesToXmlFile( strPathToConfigDoc );
        }
    }

void CachePluginAdmin::PersistNameValToServerNamespace | ( | string | strKey,
 |  | object | objValue |
 | ) |  |  | [inline]

Definition at line 193 of file PluginAdmin.cs.

    {
        if( null == g_NamedValues )
        {
            return;
        }
        bool bPersisted = false;
        foreach( IWMSNamedValue NamedVal in g_NamedValues )
        {
            if( NamedVal.Name == strKey )
            {
                // Console.WriteLine( "Persisting {0} to the server namespace: {1}", strKey, objValue );
                NamedVal.Value = objValue;
                bPersisted = false;
                break;
            }
        }
        if( ! bPersisted )
        {
            g_NamedValues.Add( strKey, objValue );
        }
    }

void CachePluginAdmin::RegisterChange | ( | string | strName,
 |  | object | objValue |
 | ) |  |  | [inline]

Definition at line 216 of file PluginAdmin.cs.

    {
        // invoke callback
        if( null != RegisteredChangeHandler )
        {
            // persist the changes back to disk
            PersistChangesToXmlFile();
            RegisteredChangeHandler( strName, objValue );
        }
    }

void CachePluginAdmin::RegisterChangeHandler ( ModifySettingsEventHandler theHandler ) [inline]

Definition at line 172 of file PluginAdmin.cs.

    {
        RegisteredChangeHandler = theHandler;
    }

Member Data Documentation

WMSNamedValues CachePluginAdmin::g_NamedValues = null [private]

Definition at line 48 of file PluginAdmin.cs.

ModifySettingsEventHandler CachePluginAdmin::RegisteredChangeHandler = null [private]

Definition at line 50 of file PluginAdmin.cs.

PersistedConfiguration CachePluginAdmin::SerializedValues [private]

Definition at line 46 of file PluginAdmin.cs.

string CachePluginAdmin::strPathToConfigDoc = "" [private]

Definition at line 47 of file PluginAdmin.cs.

Property Documentation

int IWMSCacheAdmin. CachePluginAdmin::ArchiveQuotaPerStream [get, set, private]

Implements IWMSCacheAdmin.

Definition at line 345 of file PluginAdmin.cs.

int CachePluginAdmin::ArchiveQuotaPerStream [get, set]

Implements IWMSCacheAdmin.

Definition at line 515 of file PluginAdmin.cs.

string IWMSCacheAdmin. CachePluginAdmin::BackendServer [get, set, private]

Implements IWMSCacheAdmin.

Definition at line 375 of file PluginAdmin.cs.

string CachePluginAdmin::BackendServer [get, set]

Implements IWMSCacheAdmin.

Definition at line 545 of file PluginAdmin.cs.

string CachePluginAdmin::CacheDirectoryPath [get, set]

Implements IWMSCacheAdmin.

Definition at line 410 of file PluginAdmin.cs.

string IWMSCacheAdmin. CachePluginAdmin::CacheDirectoryPath [get, set, private]

Implements IWMSCacheAdmin.

Definition at line 248 of file PluginAdmin.cs.

bool IWMSCacheAdmin. CachePluginAdmin::CacheOnDemandCacheMiss [get, set, private]

Implements IWMSCacheAdmin.

Definition at line 330 of file PluginAdmin.cs.

bool CachePluginAdmin::CacheOnDemandCacheMiss [get, set]

Implements IWMSCacheAdmin.

Definition at line 500 of file PluginAdmin.cs.

int CachePluginAdmin::DiskQuota [get, set]

Definition at line 395 of file PluginAdmin.cs.

int IWMSCacheAdmin. CachePluginAdmin::DiskQuota [get, set, private]

Definition at line 233 of file PluginAdmin.cs.

WMSNamedValues CachePluginAdmin::NamedValues [set]

Definition at line 69 of file PluginAdmin.cs.

string IWMSCacheAdmin. CachePluginAdmin::PreferredProtocol [get, set, private]

Implements IWMSCacheAdmin.

Definition at line 278 of file PluginAdmin.cs.

string CachePluginAdmin::PreferredProtocol [get, set]

Implements IWMSCacheAdmin.

Definition at line 440 of file PluginAdmin.cs.

bool IWMSCacheAdmin. CachePluginAdmin::ProxyOnDemandCacheMiss [get, set, private]

Implements IWMSCacheAdmin.

Definition at line 263 of file PluginAdmin.cs.

bool CachePluginAdmin::ProxyOnDemandCacheMiss [get, set]

Implements IWMSCacheAdmin.

Definition at line 425 of file PluginAdmin.cs.

string IWMSCacheAdmin. CachePluginAdmin::ProxyRedirectURL [get, set, private]

Implements IWMSCacheAdmin.

Definition at line 360 of file PluginAdmin.cs.

string CachePluginAdmin::ProxyRedirectURL [get, set]

Implements IWMSCacheAdmin.

Definition at line 530 of file PluginAdmin.cs.

The documentation for this class was generated from the following file:
  • Multimedia/WindowsMediaServices9/CacheProxy/csharp/PluginAdmin.cs
Generated on Wed Nov 13 2024 16:55:28 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CacheProxySamplePlugin::CacheProxyPlugin Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • CacheProxySamplePlugin
  • CacheProxySamplePlugin::CacheProxyPlugin
Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes

CacheProxySamplePlugin::CacheProxyPlugin Class Reference

Summary description for Class1.

List of all members.

Public Member Functions

CacheProxyPlugin ()
void | GetContentInfo (string OriginUrl, out ContentInfo ci)
void | GetContentInfoContext (ContentInfo ci, out IWMSContext Context)
void | PersistSettings (string strName, object objValue)

Static Public Member Functions

static void | RegisterFunction (Type t)
static void | UnRegisterFunction (Type t)

Private Member Functions

void IWMSCacheProxy. | AddCacheItem (string bstrOriginUrl, string bstrPrestuffUrl, int lExpiration, int lBandwidth, int lRemoteEventFlags, IWMSCacheProxyCallback pCallback, object varContext)
void | AddCDLToContext (IWMSContext pContentInfo, ContentInfo ci)
void | AddForDownload (ContentInfo ci)
void IWMSCacheProxy. | CreateCacheItemCollection (out IWMSCacheItemCollection ppCacheItemCollection)
void | CreateCacheTable ()
void | CreatePlaylistTable ()
void | CreateReverseProxyTable ()
void IWMSBasicPlugin. | DisablePlugin ()
void IWMSBasicPlugin. | EnablePlugin (ref int flags, ref int heartbeat)
void IWMSCacheProxy. | FindCacheItem (string bstrOriginUrl, out IWMSCacheItemDescriptor ppCacheItemDescriptor)
void IWMSProxyContext. | FindProxyForURL (IWMSContext pUserContext, string bstrUrl, out string pbstrProxyServer, out uint pdwProxyPort)
void | GetContentInfoFromContext (IWMSContext pContentInfo, ref ContentInfo ci)
void IWMSProxyContext. | GetCredentials (IWMSContext pUserContext, string bstrRealm, string bstrUrl, out string pbstrName, out string pbstrPassword)
object IWMSBasicPlugin. | GetCustomAdminInterface ()
void IWMSBasicPlugin. | InitializePlugin (IWMSContext pServerContext, WMSNamedValues pNamedValues, IWMSClassObject pClassFactory)
bool | IsContentCached (string Url, out string ReturnURL, out IWMSContext Context, out int ContentType)
bool | IsDownloadInProgress (ContentInfo ci)
void | LoadConfig ()
void IWMSCacheProxy. | OnCacheClientClose (int resultHr, IWMSContext pUserContext, IWMSContext pPresentationContext)
void IWMSCacheProxyServerCallback. | OnCancelDownloadContent (int lHr, object varContext)
void IWMSCacheProxyServerCallback. | OnCompareContentInformation (int lHr, WMS_CACHE_VERSION_COMPARE_RESPONSE CompareResponse, IWMSContext pNewContentInfo, object varContext)
void IWMSCacheProxyServerCallback. | OnDownloadContentFinished (int lHr, object[] psaArchiveContexts, object varContext)
void IWMSCacheProxyServerCallback. | OnDownloadContentProgress (int lHr, WMS_RECORD_PROGRESS_OPCODE opCode, IWMSContext pArchiveContext, object varContext)
void IWMSCacheProxyServerCallback. | OnGetContentInformation (int lHr, IWMSContext pContentInfo, object varContext)
void IWMSBasicPlugin. | OnHeartbeat ()
void IWMSCacheProxy. | QueryCache (string bstrOriginUrl, IWMSContext pUserContext, IWMSCommandContext pCommandContext, IWMSContext pPresentationContext, int lQueryType, IWMSCacheProxyCallback pCallback, object varContext)
void IWMSCacheProxy. | QueryCacheMissPolicy (string bstrOriginUrl, IWMSContext pUserContext, IWMSCommandContext pCommandContext, IWMSContext pPresentationContext, object pCachePluginContext, int lQueryType, IWMSCacheProxyCallback pCallback, object varContext)
void IWMSCacheProxy. | QuerySpaceForCacheItem (int lContentSizeLow, int lContentSizeHigh, out System.Boolean pvarfSpaceAvail)
void IWMSCacheProxy. | RemoveAllCacheItems (IWMSCacheProxyCallback pCallback, object varContext)
void IWMSCacheProxy. | RemoveCacheItem (string stringOriginUrl, IWMSCacheProxyCallback pCallback, object varContext)
void | RemoveEntryFromDatabase (ContentInfo ci, bool bDeleteFile)
void | RemoveEntryFromDatabase (string OriginUrl, bool bDeleteFile)
void | SavePlaylist (ContentInfo ci)
void IWMSBasicPlugin. | ShutdownPlugin ()
void | UpdateTable (ContentInfo ci)

Static Private Member Functions

static string | GetStringFromNSSBuffer (INSSBuffer NsBuffer)

Private Attributes

CachePluginAdmin AdminSettings
IWMSCacheProxyServer | CacheProxyServer
IWMSClassObject | ClassObject
string | ConfigPath
string | DatabasePath
DataSet | DS
CachePluginAdmin.ModifySettingsEventHandler | MyChangeEventHandler

Static Private Attributes

static readonly string | strGuid = "{1976C73A-4B3A-4738-8B84-1C5545CE80EC}"
static readonly string | strPluginName = "WMS SDK Sample C# Cache Proxy Plug-in"
static readonly string | strSubKey1 = "SOFTWARE\\Microsoft\\Windows Media\\Server\\RegisteredPlugins\\Cache Proxy\\" + strGuid
static readonly string | strSubKey2 = "\\Properties"

Detailed Description

Definition at line 263 of file Class1.cs.

Constructor & Destructor Documentation

CacheProxySamplePlugin::CacheProxyPlugin::CacheProxyPlugin ( ) [inline]

Definition at line 432 of file Class1.cs.

        {
      Debug.WriteLine("CacheProxyPlugin::CacheProxyPlugin entered");
        }

Member Function Documentation

void IWMSCacheProxy. CacheProxySamplePlugin::CacheProxyPlugin::AddCacheItem | ( | string | bstrOriginUrl,
 |  | string | bstrPrestuffUrl,
 |  | int | lExpiration,
 |  | int | lBandwidth,
 |  | int | lRemoteEventFlags,
 |  | IWMSCacheProxyCallback | pCallback,
 |  | object | varContext |
 | ) |  |  | [inline, private]

Definition at line 772 of file Class1.cs.

        {
      Debug.WriteLine("IWMSCacheProxy.AddCacheItem entered");
            //first remove the entry from database
            ContentInfo ci = new ContentInfo(bstrOriginUrl,bstrPrestuffUrl);
            ci.lExpiration = lExpiration;

            IWMSContext pPresentationContext=null;
            Type t = typeof(IWMSContext);
            Guid guid = t.GUID;
            System.IntPtr punk;
            ClassObject.AllocIWMSContext(ref guid,WMS_CONTEXT_TYPE.WMS_PRESENTATION_CONTEXT_TYPE,null,
                out punk);
            pPresentationContext = (IWMSContext)Marshal.GetObjectForIUnknown(punk);

            CacheProxyServer.GetContentInformation(bstrOriginUrl,pPresentationContext,null,
                null,this,ci);

            return;
        }

void CacheProxySamplePlugin::CacheProxyPlugin::AddCDLToContext | ( | IWMSContext | pContentInfo,
 |  | ContentInfo | ci |
 | ) |  |  | [inline, private]

Definition at line 1213 of file Class1.cs.

    {
      IWMSDataContainerVersion DCV = null;
      Type t = typeof(IWMSDataContainerVersion);
      Guid guid = t.GUID;
      object odcv = (object)DCV;
      /*
      pContentInfo.GetAndQueryIUnknownValue("WMS_CACHE_CONTENT_INFORMATION_DATA_CONTAINER_VERSION",
        3,ref guid,out odcv, 0);
      */
      pContentInfo.GetAndQueryIUnknownValue(WMSDefines.WMS_CACHE_CONTENT_INFORMATION_DATA_CONTAINER_VERSION,
        WMSDefines.WMS_CACHE_CONTENT_INFORMATION_DATA_CONTAINER_VERSION_ID,ref guid,out odcv, 0);
      DCV = (IWMSDataContainerVersion)odcv;

      if(ci.EntityTags!=null)
      {
        foreach(string str in ci.EntityTags)
        {
          DCV.SetEntityTag(str);
        }
      }
    }

void CacheProxySamplePlugin::CacheProxyPlugin::AddForDownload ( ContentInfo ci ) [inline, private]

Definition at line 1019 of file Class1.cs.

    {
      Debug.WriteLine("CacheProxyPlugin::AddForDownload entered");
      // update the database
            object[] obj = {ci.OriginUrl,"Downloading",null,null,null,
                               null,null,null,null,null
                           };
      try
      {
        DataTable dt = DS.Tables["CachedItems"];
        DataRow dr = dt.NewRow();
        dr.ItemArray = obj;
        dt.Rows.Add(dr);
      }
      catch(Exception e)
      {
        Debug.WriteLine(e);
      }
    }

void IWMSCacheProxy. CacheProxySamplePlugin::CacheProxyPlugin::CreateCacheItemCollection ( out IWMSCacheItemCollection ppCacheItemCollection ) [inline, private]

Definition at line 818 of file Class1.cs.

        {
      Debug.WriteLine("IWMSCacheProxy.CreateCacheItemCollection entered");
            IWMSCacheItemCollectionImpl obj = new IWMSCacheItemCollectionImpl(this,DS.Tables["CachedItems"]);
      ppCacheItemCollection = obj as IWMSCacheItemCollection;
            return;
        }

void CacheProxySamplePlugin::CacheProxyPlugin::CreateCacheTable ( ) [inline, private]

Definition at line 296 of file Class1.cs.

        {
      Debug.WriteLine("CacheProxyPlugin::CreateCacheTable entered");
            // create a table and add columns for it under CacheDatabase Node
            DataTable dt = new DataTable("CachedItems");
      DataColumn col = dt.Columns.Add("OriginUrl",typeof(string));
      dt.Columns.Add("CacheUrl",typeof(string));
            dt.Columns.Add("ContentSize",typeof(System.Int64));
            dt.Columns.Add("ContentType",typeof(int));
            dt.Columns.Add("CacheFlags",typeof(int));
            dt.Columns.Add("ExpirationTime",typeof(System.DateTime));
            dt.Columns.Add("LastModified",typeof(System.DateTime));
            dt.Columns.Add("SubscriptionFlag",typeof(int));
            dt.Columns.Add("EntityTags",typeof(string));
            dt.Columns.Add("CDLData",typeof(string));

      col.Unique = true;
      dt.PrimaryKey = new DataColumn[]{col};

            DS = new DataSet("SampleCachePlugin");
            DS.Tables.Add(dt);

      // we add a dummy row to this file so that
      // next inserts won't get confused by mismatched columns etc
      object[] obj = {"test","test",0,0,0,DateTime.Now,DateTime.Now,0,"test","test"};
      DataRow dr = dt.NewRow();
      dr.ItemArray = obj;
        }

void CacheProxySamplePlugin::CacheProxyPlugin::CreatePlaylistTable ( ) [inline, private]

Definition at line 355 of file Class1.cs.

        {
      Debug.WriteLine("CacheProxyPlugin::CreatePlaylistTable entered");
            DataTable dt2 = new DataTable("PlaylistEntries");
            DataColumn col2 = dt2.Columns.Add("OriginUrl",typeof(string));
            DataColumn col3 = dt2.Columns.Add("CacheID",typeof(string));
            dt2.Columns.Add("CDLData",typeof(string));
            dt2.Columns.Add("CacheUrl",typeof(string));

      dt2.PrimaryKey = new DataColumn[] {col2,col3};

            if(DS==null)
            {
                DS = new DataSet("SampleCachePlugin");
            }
            DS.Tables.Add(dt2);

      object[] obj = {"test","test","test","test"};
      DataRow dr = dt2.NewRow();
      dr.ItemArray = obj;
        }

void CacheProxySamplePlugin::CacheProxyPlugin::CreateReverseProxyTable ( ) [inline, private]

Definition at line 325 of file Class1.cs.

    {
      Debug.WriteLine("CacheProxyPlugin::CreateReverseProxyTable entered");
      // create a table and add columns for it under CacheDatabase Node
      DataTable dt = new DataTable("ReverseProxyEntries");
      DataColumn col = dt.Columns.Add("OriginUrl",typeof(string));
      dt.Columns.Add("CacheUrl",typeof(string));
      dt.Columns.Add("ContentSize",typeof(System.Int64));
      dt.Columns.Add("ContentType",typeof(int));
      dt.Columns.Add("CacheFlags",typeof(int));
      dt.Columns.Add("ExpirationTime",typeof(System.DateTime));
      dt.Columns.Add("LastModified",typeof(System.DateTime));
      dt.Columns.Add("SubscriptionFlag",typeof(int));
      dt.Columns.Add("EntityTags",typeof(string));
      dt.Columns.Add("CDLData",typeof(string));

      col.Unique = true;
      dt.PrimaryKey = new DataColumn[]{col};

      DS = new DataSet("SampleCachePlugin");
      DS.Tables.Add(dt);

      // we add a dummy row to this file so that
      // next inserts won't get confused by mismatched columns etc
      object[] obj = {"test","test",0,0,0,DateTime.Now,DateTime.Now,0,"test","test"};
      DataRow dr = dt.NewRow();
      dr.ItemArray = obj;
      dt.Rows.Add(dr);
    }

void IWMSBasicPlugin. CacheProxySamplePlugin::CacheProxyPlugin::DisablePlugin ( ) [inline, private]

Definition at line 513 of file Class1.cs.

        {
      Debug.WriteLine("WMSBasicPlugin.DisablePlugin entered");
        }

void IWMSBasicPlugin. CacheProxySamplePlugin::CacheProxyPlugin::EnablePlugin | ( | ref int | flags,
 |  | ref int | heartbeat |
 | ) |  |  | [inline, private]

Definition at line 508 of file Class1.cs.

        {
      Debug.WriteLine("WMSBasicPlugin.EnablePlugin entered");
        }

void IWMSCacheProxy. CacheProxySamplePlugin::CacheProxyPlugin::FindCacheItem | ( | string | bstrOriginUrl,
 |  | out IWMSCacheItemDescriptor | ppCacheItemDescriptor |
 | ) |  |  | [inline, private]

Definition at line 809 of file Class1.cs.

        {
      Debug.WriteLine("IWMSCacheProxy.FindCacheItem entered");
            ppCacheItemDescriptor = null;

            return;
        }

void IWMSProxyContext. CacheProxySamplePlugin::CacheProxyPlugin::FindProxyForURL | ( | IWMSContext | pUserContext,
 |  | string | bstrUrl,
 |  | out string | pbstrProxyServer,
 |  | out uint | pdwProxyPort |
 | ) |  |  | [inline, private]

Definition at line 1382 of file Class1.cs.

        {
      Debug.WriteLine("CacheProxyPlugin::IWMSProxyContext.FindProxyForURL entered");
            throw new COMException("NO ERROR",1);
        }

void CacheProxySamplePlugin::CacheProxyPlugin::GetContentInfo | ( | string | OriginUrl,
 |  | out ContentInfo | ci |
 | ) |  |  | [inline]

Definition at line 1399 of file Class1.cs.

        {
      Debug.WriteLine("CacheProxyPlugin::GetContentInfo entered");
      ci = new ContentInfo(OriginUrl,null);
      try
      {
        DataTable dt = DS.Tables["CachedItems"];
        if(dt==null)
        {
          return;
        }

        string filexpr = string.Format("OriginUrl = '{0}'",OriginUrl);

        DataRow[] drows = dt.Select(filexpr);
        if(drows.Length==0)
        {
          return;
        }

        // FOR REVERSE PROXY DATA, WE HAVE TO HAVE THE TYPE OF CONTENT
        // STORED HERE AS WELL FOR THE APPROPRIATE RESPONSE

        ci.ContentType = Convert.ToInt32(drows[0]["ContentType"]);
        if((ci.ContentType & 1)!=0)
        {
          ci.CacheUrl = OriginUrl;
        }
        else
        {
          ci.CacheUrl = Convert.ToString(drows[0]["CacheUrl"]);
        }

        // if this string is ReverseProxy, then that means we are looking at a ReverseProxy
        // entry, so we should really return from here to force a cache miss
        ci.CDLData = Convert.ToString((drows[0]["CDLData"]));
        if(ci.CDLData=="ReverseProxy")
        {
          return;
        }

        // we simply assume there will be only one row returned as we enforce
        // primary key constraint

        ci.SubscriptionFlag = Convert.ToInt32((drows[0]["SubscriptionFlag"]));
        ci.LastModified = Convert.ToDateTime((drows[0]["LastModified"]));
        ci.ExpirationTime = Convert.ToDateTime(drows[0]["ExpirationTime"]);
        ci.ContentSize = Convert.ToInt64(drows[0]["ContentSize"]);

        // get the entity tags

        string strTags=Convert.ToString(drows[0]["EntityTags"]);
        int i=0, j=0;
        while(true)
        {
          int k = strTags.IndexOf('#',i);
          if(k<0)
          {
            break;
          }
          string str = strTags.Substring(i,k);
          ci.EntityTags.Insert(j,str);
          i=k+1;
          j++;
        }
      }
      catch(Exception e)
      {
        Debug.WriteLine(e);

      }
        }

void CacheProxySamplePlugin::CacheProxyPlugin::GetContentInfoContext | ( | ContentInfo | ci,
 |  | out IWMSContext | Context |
 | ) |  |  | [inline]

Definition at line 1473 of file Class1.cs.

        {
      Debug.WriteLine("CacheProxyPlugin::GetContentInfoContext entered");
            System.IntPtr punk;
            Type t = typeof(IWMSContext);
            System.Guid guid = t.GUID;
            ClassObject.AllocIWMSContext(ref guid,
                WMS_CONTEXT_TYPE.WMS_CACHE_CONTENT_INFORMATION_CONTEXT_TYPE
                ,null, out punk);
            Context = (IWMSContext)Marshal.GetObjectForIUnknown(punk);

            t = typeof(IWMSDataContainerVersion);
            guid = t.GUID;
            ClassObject.CreateInstance(ref guid, out punk);
            IWMSDataContainerVersion DataContainer =
                (IWMSDataContainerVersion)Marshal.GetObjectForIUnknown(punk);
            Context.SetIUnknownValue(WMSDefines.WMS_CACHE_CONTENT_INFORMATION_DATA_CONTAINER_VERSION,
        WMSDefines.WMS_CACHE_CONTENT_INFORMATION_DATA_CONTAINER_VERSION_ID,DataContainer,0);

            Context.SetLongValue(WMSDefines.WMS_CACHE_CONTENT_INFORMATION_CONTENT_TYPE,
        WMSDefines.WMS_CACHE_CONTENT_INFORMATION_CONTENT_TYPE_ID,ci.ContentType,0);
            Context.SetLongValue(WMSDefines.WMS_CACHE_CONTENT_INFORMATION_EVENT_SUBSCRIPTIONS,
        WMSDefines.WMS_CACHE_CONTENT_INFORMATION_EVENT_SUBSCRIPTIONS_ID,ci.SubscriptionFlag,0);
            DataContainer.SetLastModifiedTime(ci.LastModified);
            DataContainer.SetExpirationTime(ci.ExpirationTime);
            DataContainer.SetCacheFlags(ci.CacheFlags);
            DataContainer.SetContentSize((int)ci.ContentSize,0);

            if(ci.EntityTags!=null)
            {
                foreach(string str in ci.EntityTags)
                {
                    DataContainer.SetEntityTag(str);
                }
            }

      guid = typeof(IWMSContext).GUID;
      if((ci.ContentType & 2) == 0) // not a playlist
      {
        //create a CDL context and make it point to the INSSBuffer that we persisted
        ClassObject.AllocIWMSContext(ref guid,
          WMS_CONTEXT_TYPE.WMS_UNKNOWN_CONTEXT_TYPE
          ,null, out punk);
        IWMSContext CDLContext = (IWMSContext)Marshal.GetObjectForIUnknown(punk);
        INSSBufferImpl Buffer = new INSSBufferImpl();
        Buffer.SetBuffer(ci.CDLData);
        INSSBuffer pBuffer = Buffer as INSSBuffer;
        CDLContext.SetIUnknownValue("CDL",0,(object)pBuffer,2);

        Context.SetIUnknownValue(WMSDefines.WMS_CACHE_CONTENT_INFORMATION_CONTENT_DESCRIPTION_LISTS,
          WMSDefines.WMS_CACHE_CONTENT_INFORMATION_CONTENT_DESCRIPTION_LISTS_ID,(object)CDLContext,0);
      }
      else
      {
        // create CDL for each file of the playlist
        // get the list of entries from PlaylistItem table corresponding to this Origin URL
        // for each of the entry
        // create CDL data and stuff it with the Context
        // query would be like select * from PlaylistEntries where OriginUrl=ci.OriginUrl
        DataTable dtPlaylist = DS.Tables["PlaylistEntries"];
        string filter = string.Format("OriginUrl='{0}'",ci.OriginUrl);
        DataRow[] rows = dtPlaylist.Select(filter);

        ClassObject.AllocIWMSContext(ref guid,
          WMS_CONTEXT_TYPE.WMS_UNKNOWN_CONTEXT_TYPE
          ,null, out punk);
        IWMSContext CDLContext = (IWMSContext)Marshal.GetObjectForIUnknown(punk);
        foreach( DataRow row in rows)
        {

          INSSBufferImpl Buffer = new INSSBufferImpl();
          Buffer.SetBuffer(Convert.ToString(row["CDLData"]));
          INSSBuffer pBuffer = Buffer as INSSBuffer;
          CDLContext.SetIUnknownValue(Convert.ToString(row["CacheID"]),0,(object)pBuffer,2);
        }
        Context.SetIUnknownValue(WMSDefines.WMS_CACHE_CONTENT_INFORMATION_CONTENT_DESCRIPTION_LISTS
          ,WMSDefines.WMS_CACHE_CONTENT_INFORMATION_CONTENT_DESCRIPTION_LISTS_ID
          ,(object)CDLContext,0);

      }
        }

void CacheProxySamplePlugin::CacheProxyPlugin::GetContentInfoFromContext | ( | IWMSContext | pContentInfo,
 |  | ref ContentInfo | ci |
 | ) |  |  | [inline, private]

Definition at line 834 of file Class1.cs.

        {
      Debug.WriteLine("CacheProxyPlugin::GetContentInfoFromContext entered");
            int nFlag=0;
            int lCacheFlags=0;
            IWMSDataContainerVersion DCV = null;
            Type t = typeof(IWMSDataContainerVersion);
            Guid guid = t.GUID;
            object odcv = (object)DCV;
            pContentInfo.GetAndQueryIUnknownValue(WMSDefines.WMS_CACHE_CONTENT_INFORMATION_DATA_CONTAINER_VERSION,
        WMSDefines.WMS_CACHE_CONTENT_INFORMATION_DATA_CONTAINER_VERSION_ID,ref guid,out odcv, 0);
            DCV = (IWMSDataContainerVersion)odcv;
            DCV.GetCacheFlags(out lCacheFlags);
            nFlag = lCacheFlags & (int)WMS_DATA_CONTAINER_VERSION_CACHE_FLAGS.WMS_DATA_CONTAINER_VERSION_ALLOW_PROXY_CACHING;

            ci.CacheFlags = lCacheFlags;
            //content size
            int nLowVal=0, nHighVal=0;
            DCV.GetContentSize(out nLowVal,out nHighVal);
            ci.ContentSize = nLowVal;

            //content type
            int nContentType = 0;
            pContentInfo.GetLongValue(WMSDefines.WMS_CACHE_CONTENT_INFORMATION_CONTENT_TYPE,
        WMSDefines.WMS_CACHE_CONTENT_INFORMATION_CONTENT_TYPE_ID,out nContentType,0);
            ci.ContentType = nContentType;

            //expiration time
            DateTime time = new DateTime(0);

      //last modified
      DCV.GetLastModifiedTime(out time);
      ci.LastModified = time;

      //following call throws exception
      // when this is a bpp sourcing from encoder
      // so we don't call it based on the lastmodified time

      if(((ci.ContentType &1)!=0) && time.Year==1899)
      {
      }
      else
      {
        DCV.GetExpirationTime(out time);
        try
        {
          ci.ExpirationTime = time;
        }
        catch(Exception e)
        {
          //if this call fails, we just ignore
          Debug.WriteLine(e);
        }
      }
            //Subscription flags
            int nSubFlag=0;
            pContentInfo.GetLongValue(WMSDefines.WMS_CACHE_CONTENT_INFORMATION_EVENT_SUBSCRIPTIONS
        ,WMSDefines.WMS_CACHE_CONTENT_INFORMATION_EVENT_SUBSCRIPTIONS_ID,out nSubFlag,0);
            ci.SubscriptionFlag = nSubFlag;

      //clear previous entries
      ci.EntityTags.Clear();
            int nTagCount = 0;
            DCV.GetEntityTagCount(out nTagCount);
            for(int i=0;i<nTagCount;i++)
            {
                string tag;
                DCV.GetEntityTag(i,out tag);
                ci.EntityTags.Insert(i,tag);
            }
        }

void IWMSProxyContext. CacheProxySamplePlugin::CacheProxyPlugin::GetCredentials | ( | IWMSContext | pUserContext,
 |  | string | bstrRealm,
 |  | string | bstrUrl,
 |  | out string | pbstrName,
 |  | out string | pbstrPassword |
 | ) |  |  | [inline, private]

Definition at line 1389 of file Class1.cs.

        {
      Debug.WriteLine("CacheProxyPlugin::IWMSProxyContext.GetCredentials entered");
            pbstrName="";
            pbstrPassword="";
            throw new COMException("NO ERROR",1);
        }

object IWMSBasicPlugin. CacheProxySamplePlugin::CacheProxyPlugin::GetCustomAdminInterface ( ) [inline, private]

Definition at line 528 of file Class1.cs.

        {
            Debug.WriteLine("IWMSBasicPlugin.GetCustomAdminInterface entered");
            IWMSCacheAdmin CacheAdmin = null;
            try
            {
                CacheAdmin = ( IWMSCacheAdmin ) AdminSettings;
            }
            catch( Exception e )
            {
                Console.WriteLine( "EXCEPTION: " + e.Message + e.StackTrace );
                AdminSettings = null;
            }
            finally
            {
                CacheAdmin = null;
            }
            return( ( object ) AdminSettings );
        }

static string CacheProxySamplePlugin::CacheProxyPlugin::GetStringFromNSSBuffer ( INSSBuffer NsBuffer ) [inline, static, private]

Definition at line 280 of file Class1.cs.

        {
      Debug.WriteLine("CacheProxyPlugin::GetStringFromNSSBuffer entered");
            uint bufSize;
            IntPtr pBuf = IntPtr.Zero;
            NsBuffer.GetBufferAndLength( out pBuf, out bufSize );
            byte[] Buf = new byte[bufSize];
            Marshal.Copy(pBuf,Buf,0,(int)bufSize);
            /*
            string s = Marshal.PtrToStringUni( pBuf, (int) bufSize / 2 );
            return s;
            */
            return Convert.ToBase64String(Buf,0,(int)bufSize);

        }

void IWMSBasicPlugin. CacheProxySamplePlugin::CacheProxyPlugin::InitializePlugin | ( | IWMSContext | pServerContext,
 |  | WMSNamedValues | pNamedValues,
 |  | IWMSClassObject | pClassFactory |
 | ) |  |  | [inline, private]

Definition at line 486 of file Class1.cs.

        {
      Debug.WriteLine("CacheProxyPlugin::InitializePlugin entered");
            Console.WriteLine( "IWMSBasicPlugin.InitializePlugin entered" );
            ClassObject = pClassFactory;
            Type t = typeof(IWMSCacheProxyServer);
            Guid guid = t.GUID;
            Object obj;
            pServerContext.GetAndQueryIUnknownValue(WMSDefines.WMS_SERVER_CACHE_MANAGER,WMSDefines.WMS_SERVER_CACHE_MANAGER_ID,
                ref guid,out obj ,0);
            CacheProxyServer = (IWMSCacheProxyServer)obj;

      //load config file
            LoadConfig();
            if( null != AdminSettings )
            {
                AdminSettings.NamedValues = pNamedValues;
            }
        }

bool CacheProxySamplePlugin::CacheProxyPlugin::IsContentCached | ( | string | Url,
 |  | out string | ReturnURL,
 |  | out IWMSContext | Context,
 |  | out int | ContentType |
 | ) |  |  | [inline, private]

Definition at line 1554 of file Class1.cs.

        {
      Debug.WriteLine("CacheProxyPlugin::IsContentCached entered");
            ContentType=0;
            ReturnURL=null;

            System.IntPtr punk;
            Type t = typeof(IWMSContext);
            System.Guid guid = t.GUID;
            ClassObject.AllocIWMSContext(ref guid,
                WMS_CONTEXT_TYPE.WMS_CACHE_CONTENT_INFORMATION_CONTEXT_TYPE
                ,null, out punk);
            Context = (IWMSContext)Marshal.GetObjectForIUnknown(punk);

            t = typeof(IWMSDataContainerVersion);
            guid = t.GUID;
            ClassObject.CreateInstance(ref guid, out punk);
            IWMSDataContainerVersion DataContainer =
                (IWMSDataContainerVersion)Marshal.GetObjectForIUnknown(punk);

            Context.SetIUnknownValue(WMSDefines.WMS_CACHE_CONTENT_INFORMATION_DATA_CONTAINER_VERSION,
        WMSDefines.WMS_CACHE_CONTENT_INFORMATION_DATA_CONTAINER_VERSION_ID,DataContainer,0);

            // search the database if the specified URL exists
            DataTable dt = DS.Tables["CachedItems"];
            if(dt==null)
            {
                return false;
            }

            string filexpr = string.Format("OriginUrl = '{0}'",Url);

            DataRow[] drows = dt.Select(filexpr);
            if(drows.Length==0)
            {
                return false;
            }

            // we simply assume there will be only one row returned as we enforce
            // primary key constraint

            object ob = (drows[0]["ContentType"]);
            int nVal = Convert.ToInt32(ob);
            Context.SetLongValue(WMSDefines.WMS_CACHE_CONTENT_INFORMATION_CONTENT_TYPE,
        WMSDefines.WMS_CACHE_CONTENT_INFORMATION_CONTENT_TYPE_ID,nVal,0);
            ContentType = nVal;

            nVal = Convert.ToInt32((drows[0]["SubscriptionFlag"]));
            Context.SetLongValue(WMSDefines.WMS_CACHE_CONTENT_INFORMATION_EVENT_SUBSCRIPTIONS,
        WMSDefines.WMS_CACHE_CONTENT_INFORMATION_EVENT_SUBSCRIPTIONS_ID,nVal,0);

            System.DateTime date = Convert.ToDateTime((drows[0]["LastModified"]));
            DataContainer.SetLastModifiedTime(date);

            date = Convert.ToDateTime(drows[0]["ExpirationTime"]);
            DataContainer.SetExpirationTime(date);

            nVal = Convert.ToInt32((drows[0]["SubscriptionFlag"]));
            DataContainer.SetCacheFlags(nVal);

            System.Int64 n64Val = Convert.ToInt64(drows[0]["ContentSize"]);
            DataContainer.SetContentSize((int)n64Val,0);
            /*
                        string tag = Convert.ToString(drows[0]["EntityTags"]);
                        DataContainer.SetEntityTag(tag);
            */

            string cacheurl=null;
            try
            {
                cacheurl = Convert.ToString(drows[0]["CacheUrl"]);
            }
            catch(Exception e)
            {
        Debug.WriteLine(e);
            }

            // there is no CacheUrl for broadcast content, so we should reply with
            // the OriginUrl
            if((ContentType & 1 )!=0) // it's a brodcast content
            {
                ReturnURL = Url;
            }
            else
            {
                ReturnURL = string.Format("file://{0}",cacheurl);
            }

            return true;

        }

bool CacheProxySamplePlugin::CacheProxyPlugin::IsDownloadInProgress ( ContentInfo ci ) [inline, private]

Definition at line 1002 of file Class1.cs.

    {
      Debug.WriteLine("CacheProxyPlugin::IsDownloadInProgress entered");
      try
      {
        DataTable dt = DS.Tables["CachedItems"];
        string filexpr = string.Format("OriginUrl = '{0}'",ci.OriginUrl);
        DataRow[] drows = dt.Select(filexpr);
        return (drows.Length!=0);
      }
      catch(Exception e)
      {
        Debug.WriteLine(e);
        return false;
      }
    }

void CacheProxySamplePlugin::CacheProxyPlugin::LoadConfig ( ) [inline, private]

Definition at line 379 of file Class1.cs.

        {
      Debug.WriteLine("CacheProxyPlugin::LoadConfig entered");
            Console.WriteLine( "LoadConfig entered" );

            // get the module path and replace extension with xml
            string Path = Assembly.GetExecutingAssembly().Location;
            string Dir = Path.Substring(0,Path.LastIndexOf('.'));
            ConfigPath = Dir + ".xml";
            DatabasePath = Dir+"database"+".xml";

            try
            {
                Console.WriteLine( "Attempting to load config file {0}", ConfigPath );

                // Load configuration from file

                AdminSettings = new CachePluginAdmin();

                // Choose one or the other means of persistence
                if( ! AdminSettings.LoadSettingsFromXmlFile( ConfigPath ) )
                {
                    Console.WriteLine( "Failed to read XML file.  Reading from server namespace." );
                    AdminSettings.LoadSettingsFromServerNamespace();
                }

                IWMSCacheAdmin cacheAdmin = ( IWMSCacheAdmin ) AdminSettings;
                Console.WriteLine( "AdminSettings loaded: diskquota: " + cacheAdmin.DiskQuota );

                MyChangeEventHandler = new CachePluginAdmin.ModifySettingsEventHandler( PersistSettings );
                AdminSettings.RegisterChangeHandler( MyChangeEventHandler );
            }
            catch(Exception e)
            {
                Console.WriteLine( "ASSERT1: " + e.Message + e.StackTrace );
                //load failed, we will treat this as a new file and save it

            }

            try
            {
                DS = new DataSet("SampleCachePlugin");
                DS.ReadXml(DatabasePath, XmlReadMode.ReadSchema);
            }
            catch(Exception e)
            {
                Console.WriteLine( "ASSERT2: " + e.Message + e.StackTrace );
        CreateCacheTable();
        CreatePlaylistTable();
            }
      File.Delete(DatabasePath);
        }

void IWMSCacheProxy. CacheProxySamplePlugin::CacheProxyPlugin::OnCacheClientClose | ( | int | resultHr,
 |  | IWMSContext | pUserContext,
 |  | IWMSContext | pPresentationContext |
 | ) |  |  | [inline, private]

Definition at line 826 of file Class1.cs.

        {
      Debug.WriteLine("IWMSCacheProxy.OnCacheClientClose entered");
            return;
        }

void IWMSCacheProxyServerCallback. CacheProxySamplePlugin::CacheProxyPlugin::OnCancelDownloadContent | ( | int | lHr,
 |  | object | varContext |
 | ) |  |  | [inline, private]

Definition at line 1372 of file Class1.cs.

        {
      Debug.WriteLine("CacheProxyPlugin::IWMSCacheProxyServerCallback.OnCancelDownloadContent entered");
            return;
        }

void IWMSCacheProxyServerCallback. CacheProxySamplePlugin::CacheProxyPlugin::OnCompareContentInformation | ( | int | lHr,
 |  | WMS_CACHE_VERSION_COMPARE_RESPONSE | CompareResponse,
 |  | IWMSContext | pNewContentInfo,
 |  | object | varContext |
 | ) |  |  | [inline, private]

Definition at line 1143 of file Class1.cs.

    {
      Debug.WriteLine("CacheProxyPlugin::IWMSCacheProxyServerCallback.OnCompareContentInformation entered");
      WMS_CACHE_QUERY_RESPONSE Response = WMS_CACHE_QUERY_RESPONSE.WMS_CACHE_QUERY_MISS;
      ContentInfo ci = (ContentInfo)varContext;
      // we use this content info  to call back by default
      // it changes if the CI in our database is valid
      IWMSContext pContenInfo = pNewContentInfo;
      // if the call failed, we have to go for protocol rollover etc
      if(lHr==0)
      {
        switch (CompareResponse)
        {
          case WMS_CACHE_VERSION_COMPARE_RESPONSE.WMS_CACHE_VERSION_CACHE_STALE:
          {
            RemoveEntryFromDatabase(ci,true);
          }
            break;

          case WMS_CACHE_VERSION_COMPARE_RESPONSE.WMS_CACHE_VERSION_CACHE_UP_TO_DATE:
          {
            if((ci.ContentType & 1 )!=0) // it's a brodcast content
            {
              Response = WMS_CACHE_QUERY_RESPONSE.WMS_CACHE_QUERY_HIT_PLAY_BROADCAST;
            }
            else
            {
              Response = WMS_CACHE_QUERY_RESPONSE.WMS_CACHE_QUERY_HIT_PLAY_ON_DEMAND;
            }
            // update the database with the new information
            RemoveEntryFromDatabase(ci,false);
            GetContentInfoFromContext(pNewContentInfo,ref ci);
            UpdateTable(ci);

            GetContentInfoContext(ci,out pContenInfo);
          }
            break;
          case WMS_CACHE_VERSION_COMPARE_RESPONSE.WMS_CACHE_VERSION_FAIL_TO_CHECK_VERSION:
          {
          }
            break;

          default:
            break;
        }

        Debug.WriteLine("CacheProxyPlugin::IWMSCacheProxyServerCallback.OnCompareContentInformation -> calling OnQueryCache");

        // crude test...look up if we have :// embedded in the URL, if not prefix it with file://
        // otherwise just let it go
        int nIndex = ci.CacheUrl.IndexOf("://");
        string strCacheUrl = ci.CacheUrl;
        if(nIndex==-1)
        {
          strCacheUrl = string.Format("file://{0}",ci.CacheUrl);
        }

        ci.CacheProxyCallback.OnQueryCache(0,Response,strCacheUrl,pContenInfo,
          null,ci.varContext);

      }

      return;
    }

void IWMSCacheProxyServerCallback. CacheProxySamplePlugin::CacheProxyPlugin::OnDownloadContentFinished | ( | int | lHr,
 |  | object[] | psaArchiveContexts,
 |  | object | varContext |
 | ) |  |  | [inline, private]

Definition at line 1280 of file Class1.cs.

    {
      Debug.WriteLine("CacheProxyPlugin::IWMSCacheProxyServerCallback.OnDownloadContentFinished entered");
      if(lHr==0) // download succeeded
      {
        ContentInfo ci = (ContentInfo)varContext;
        // server might have renamed the specified file if there is a name collision
        // so we get the actual name of the file from archive context that we get
        if(psaArchiveContexts.Length!=0)
        {
          if((ci.ContentType & 2)==0) // it's not a playlist
          {
            IWMSContext ArchiveContext = (IWMSContext)psaArchiveContexts.GetValue(0);
            // get the file name
            string CacheFile;
            ArchiveContext.GetStringValue(WMSDefines.WMS_ARCHIVE_FILENAME,
              WMSDefines.WMS_ARCHIVE_FILENAME_ID,out CacheFile,0);
            ci.CacheUrl = CacheFile;

          }
          else
          {
            SavePlaylist(ci);
          }
          UpdateTable(ci);
        }

      }
      else
      {
        Debug.WriteLine(string.Format("HRESULT for CacheProxyPlugin::IWMSCacheProxyServerCallback.OnDownloadContentFinished = {0}",
          lHr.ToString("X")));
      }
      return;
    }

void IWMSCacheProxyServerCallback. CacheProxySamplePlugin::CacheProxyPlugin::OnDownloadContentProgress | ( | int | lHr,
 |  | WMS_RECORD_PROGRESS_OPCODE | opCode,
 |  | IWMSContext | pArchiveContext,
 |  | object | varContext |
 | ) |  |  | [inline, private]

Definition at line 1236 of file Class1.cs.

    {
      Debug.WriteLine("CacheProxyPlugin::IWMSCacheProxyServerCallback.OnDownloadContentProgress entered");
      if(lHr==0)
      {
        if(opCode==WMS_RECORD_PROGRESS_OPCODE.WMS_RECORD_PROGRESS_ARCHIVE_STARTED)
        {
          INSSBuffer NSBuffer=null;
          Guid guid = typeof(INSSBuffer).GUID;
          Object obj;
          pArchiveContext.GetAndQueryIUnknownValue(WMSDefines.WMS_ARCHIVE_CONTENT_DESCRIPTION_LIST_BUFFER,
            WMSDefines.WMS_ARCHIVE_CONTENT_DESCRIPTION_LIST_BUFFER_ID,ref guid,out obj ,0);
          NSBuffer = (INSSBuffer)obj;

          // get the file name
          string CacheFile;
          pArchiveContext.GetStringValue(WMSDefines.WMS_ARCHIVE_FILENAME,
            WMSDefines.WMS_ARCHIVE_FILENAME_ID,out CacheFile,0);

          ContentInfo ci = (ContentInfo)varContext;

          string s = GetStringFromNSSBuffer(NSBuffer);
          if((ci.ContentType & 2)==0) // not a playlist
          {
            ci.CDLData = s;
            ci.CacheUrl = CacheFile;
          }
          else
          {
            PlaylistItem Item = new PlaylistItem();
            Item.CacheUrl = CacheFile;
            Item.CDLData = s;
            ci.CDL.Add((object)Item);
          }
        }
      }
      return;
    }

void IWMSCacheProxyServerCallback. CacheProxySamplePlugin::CacheProxyPlugin::OnGetContentInformation | ( | int | lHr,
 |  | IWMSContext | pContentInfo,
 |  | object | varContext |
 | ) |  |  | [inline, private]

Definition at line 909 of file Class1.cs.

        {
      Debug.WriteLine("IWMSCacheProxyServerCallback::OnGetContentInformation entered");
            int nFlag=0;
            ContentInfo ci = (ContentInfo)varContext;
      bool bAddCacheItem = false;
      int nRetHr = lHr;
            // if we are called from the result of AddCacheItem, the lExpiration variable won't be 0
            // and we would simply call DownloadContent
            if(ci.lExpiration!=0) // Call result of AddCacheIrtem
            {
                bAddCacheItem=true;
                lHr=0;
            }
            // check the flags and if allowed
            // download the content and save it locally
      if(lHr==0) // would be E_ACCESSDENIED or something
        // if we didn't get content info
      {
        // if we are not allowed to cache the content
        // we simply set up proxy on demand datapath
        // else we store the information and ask cache manager
        // to download the content
        GetContentInfoFromContext(pContentInfo, ref ci);
        nFlag = ci.CacheFlags & (int)WMS_DATA_CONTAINER_VERSION_CACHE_FLAGS.WMS_DATA_CONTAINER_VERSION_ALLOW_PROXY_CACHING;

        if((nFlag!=0)||(bAddCacheItem))
        {
          // proxying is allowed
          // let's get all the content information
          // and ask the cache manager to download the content
          if((!bAddCacheItem)||(bAddCacheItem && (ci.CacheUrl==null)))
          {
            ci.CacheUrl = "c:\\WMSCache\\test";
          }

          //we check first from the database if the dowloading is already in progress
          // and cll for downloading the content only if there is no active
          // downloading going on
          if(!IsDownloadInProgress(ci))
          {
            // add to the database that we are downloading
            AddForDownload(ci);
            CacheProxyServer.DownloadContent(ci.OriginUrl,ci.CacheUrl,0,0,0,0,this,
              null,this,ci);
          }
          else
          {
            Debug.WriteLine("download arlready in progress");
          }
        }
        // if this is a broadcast content, we are not going to download it
        // so we simply store the content information in the database with
        // empty CacheUrl, so when next request comes, we get a hit so
        // we can reply accordingly
        if((ci.ContentType & 1)!=0)
        {
          UpdateTable(ci);
        }
      }
      else
      {
        Debug.WriteLine(string.Format("HRESULT for CacheProxyPlugin::IWMSCacheProxyServerCallback.OnGetContentInformation = {0}",
          lHr.ToString("X")));
        if(lHr==-2147024891)
          nRetHr=0;
      }

            // check if stream splitting is allowed
            // if so we ask cache manager to set up a brodcast connection with the player
            // otherwise we go for OD
            WMS_CACHE_QUERY_MISS_RESPONSE MissResponse = WMS_CACHE_QUERY_MISS_RESPONSE.WMS_CACHE_QUERY_MISS_PLAY_ON_DEMAND;
            nFlag = ci.CacheFlags & (int)WMS_DATA_CONTAINER_VERSION_CACHE_FLAGS.WMS_DATA_CONTAINER_VERSION_ALLOW_STREAM_SPLITTING;
            if(nFlag!=0)
            {
                MissResponse = WMS_CACHE_QUERY_MISS_RESPONSE.WMS_CACHE_QUERY_MISS_PLAY_BROADCAST;
            }

            // ask the server to setup a proxy on-demand
            if(ci.CacheProxyCallback!=null)
            {
                ci.CacheProxyCallback.OnQueryCacheMissPolicy((int)nRetHr,MissResponse
                    ,ci.OriginUrl,null,pContentInfo,ci.varContext);
            }
            return;
        }

void IWMSBasicPlugin. CacheProxySamplePlugin::CacheProxyPlugin::OnHeartbeat ( ) [inline, private]

Definition at line 548 of file Class1.cs.

        {
      Debug.WriteLine("IWMSBasicPlugin.OnHeartbeat entered");
        }

void CacheProxySamplePlugin::CacheProxyPlugin::PersistSettings | ( | string | strName,
 |  | object | objValue |
 | ) |  |  | [inline]

Definition at line 520 of file Class1.cs.

        {
            if( null != AdminSettings )
            {
                AdminSettings.PersistNameValToServerNamespace( strName, objValue );
            }
        }

void IWMSCacheProxy. CacheProxySamplePlugin::CacheProxyPlugin::QueryCache | ( | string | bstrOriginUrl,
 |  | IWMSContext | pUserContext,
 |  | IWMSCommandContext | pCommandContext,
 |  | IWMSContext | pPresentationContext,
 |  | int | lQueryType,
 |  | IWMSCacheProxyCallback | pCallback,
 |  | object | varContext |
 | ) |  |  | [inline, private]

Definition at line 563 of file Class1.cs.

        {
      Debug.WriteLine("IWMSCacheProxy.QueryCache entered");
            // we simply return a hard coded URL for the request WMS_CACHE_QUERY_OPEN for now
            int nFlag = (int)WMS_CACHE_QUERY_TYPE_FLAGS.WMS_CACHE_QUERY_OPEN;
            int nOpen = lQueryType & nFlag;
            int nGCI = lQueryType & ((int)WMS_CACHE_QUERY_TYPE_FLAGS.WMS_CACHE_QUERY_GET_CONTENT_INFO);
      int nReverseProxy = lQueryType & ((int)WMS_CACHE_QUERY_TYPE_FLAGS.WMS_CACHE_QUERY_REVERSE_PROXY);

            // either open or GCI is called
            // for GCI we don't care about CompareContentInformation
            // if not upto date, we treat as a miss
      if((nOpen!=0)||(nGCI!=0))
      {
        // allocate ContentInfoContext and DataContainerObject
        // stuff it with the information
        // and call back
        IWMSContext Context;
        WMS_CACHE_QUERY_RESPONSE Response = WMS_CACHE_QUERY_RESPONSE.WMS_CACHE_QUERY_MISS;

        ContentInfo ci;
        //gets allocated here
        GetContentInfo(bstrOriginUrl,out ci);
        ci.CacheProxyCallback = pCallback;
        ci.varContext = varContext;
        GetContentInfoContext(ci,out Context);

        bool bQueryCache = true;
        bool bOnDemand = true;
        if((ci.CacheUrl!=null) && (nReverseProxy==0)) // there is something in the cache
        {
          // if content is not expired, this is a hit
          DateTime now = DateTime.Now;
          Debug.WriteLine(string.Format("Current local time={0}",now));
          //covert to UTC time
          now = now.ToUniversalTime();
          Debug.WriteLine(string.Format("Current UTC time={0}",now));

          Debug.WriteLine(string.Format("Expiration time={0}",ci.ExpirationTime));
          if(ci.ExpirationTime > now)
          {
            if((ci.ContentType & 1 )!=0) // it's a brodcast content
            {
              Response = WMS_CACHE_QUERY_RESPONSE.WMS_CACHE_QUERY_HIT_PLAY_BROADCAST;
              bOnDemand = false;
            }
            else
            {
              Response = WMS_CACHE_QUERY_RESPONSE.WMS_CACHE_QUERY_HIT_PLAY_ON_DEMAND;
              bOnDemand = true;
            }
          }
          else // content appears expired, we will have to call CompareContentInformation
          {
            if(nOpen!=0) // only for open queries
            {
              bQueryCache = false;
            }
          }
        }

        if(bQueryCache)
        {
          string CacheUrl = ci.CacheUrl;
          if(bOnDemand)
          {
            CacheUrl = string.Format("file://{0}",ci.CacheUrl);
          }
          pCallback.OnQueryCache( 0,
            Response,
            CacheUrl,
            Context,
            null,
            varContext);
        }
        else
        {
          CacheProxyServer.CompareContentInformation(bstrOriginUrl,Context,pPresentationContext,
            this,null,this,(object)ci);
        }
      }
      else
      {
        // see of this is for event propagation
        int nCacheEvent = lQueryType & ((int)WMS_CACHE_QUERY_TYPE_FLAGS.WMS_CACHE_QUERY_CACHE_EVENT);
        int nLocalEvent = lQueryType & ((int)WMS_CACHE_QUERY_TYPE_FLAGS.WMS_CACHE_QUERY_LOCAL_EVENT);
        if((nCacheEvent | nLocalEvent)!=0)
        {
          // we declare it as a miss
          // and on QCP, we ask the cachemanager to forward it
          WMS_CACHE_QUERY_RESPONSE Response = WMS_CACHE_QUERY_RESPONSE.WMS_CACHE_QUERY_MISS;
          pCallback.OnQueryCache( 0,
            Response,
            bstrOriginUrl,
            null,
            null,
            varContext);
        }

      }

            return;
        }

void IWMSCacheProxy. CacheProxySamplePlugin::CacheProxyPlugin::QueryCacheMissPolicy | ( | string | bstrOriginUrl,
 |  | IWMSContext | pUserContext,
 |  | IWMSCommandContext | pCommandContext,
 |  | IWMSContext | pPresentationContext,
 |  | object | pCachePluginContext,
 |  | int | lQueryType,
 |  | IWMSCacheProxyCallback | pCallback,
 |  | object | varContext |
 | ) |  |  | [inline, private]

Definition at line 673 of file Class1.cs.

        {
      Debug.WriteLine("IWMSCacheProxy.QueryCacheMissPolicy entered");
            int nOpenFlag = (int)WMS_CACHE_QUERY_TYPE_FLAGS.WMS_CACHE_QUERY_OPEN;
            int nGCI = lQueryType & ((int)WMS_CACHE_QUERY_TYPE_FLAGS.WMS_CACHE_QUERY_GET_CONTENT_INFO);
      int nReverseProxy = lQueryType & ((int)WMS_CACHE_QUERY_TYPE_FLAGS.WMS_CACHE_QUERY_REVERSE_PROXY);
            ContentInfo ci = new ContentInfo(bstrOriginUrl,null);
            if((nOpenFlag & lQueryType)!=0) // open query
            {
        if(nReverseProxy==0) //normal mode
        {
          // get content information
          ci.CacheProxyCallback = pCallback;
          ci.varContext = varContext;
          CacheProxyServer.GetContentInformation(bstrOriginUrl,pPresentationContext,null,
            null,this,ci);
        }
        else // it's a reverse proxy mode
        {
          // we simply look up our table to see if there is a mapping between the requested
          //Url and the RP url and return it
          // we distinguish the table entry if it's a reverse proxy or not by
          // checking the CDL data
          // we store a special string "ReverseProxy" there for the distinction
          // one can simply add another entry in the table to be safer
          // as there might be some CDL data written as "ReverseProxy" !!
          ContentInfo ciRP = null;
          GetContentInfo(bstrOriginUrl,out ciRP);
          WMS_CACHE_QUERY_MISS_RESPONSE Response = WMS_CACHE_QUERY_MISS_RESPONSE.WMS_CACHE_QUERY_MISS_PLAY_ON_DEMAND;
          if((ciRP.ContentType & 1 )!=0) // it's a brodcast content
          {
            Response = WMS_CACHE_QUERY_MISS_RESPONSE.WMS_CACHE_QUERY_MISS_PLAY_BROADCAST;
          }
          else
          {
            Response = WMS_CACHE_QUERY_MISS_RESPONSE.WMS_CACHE_QUERY_MISS_PLAY_ON_DEMAND;
          }

          IWMSContext ContentInfoContext = null;
          GetContentInfoContext(ci,out ContentInfoContext);
          pCallback.OnQueryCacheMissPolicy(0,Response,ciRP.CacheUrl,null,ContentInfoContext,varContext);

        }

            }
            if((nGCI & lQueryType)!=0) // GCI query from downstream server
            {
                WMS_CACHE_QUERY_MISS_RESPONSE Response = WMS_CACHE_QUERY_MISS_RESPONSE.WMS_CACHE_QUERY_MISS_FORWARD_REQUEST;
                IWMSContext ContentInfoContext = null;
                GetContentInfoContext(ci,out ContentInfoContext);
                pCallback.OnQueryCacheMissPolicy(0,Response,bstrOriginUrl,null,ContentInfoContext,varContext);
            }

            if((lQueryType & (int)WMS_CACHE_QUERY_TYPE_FLAGS.WMS_CACHE_QUERY_CACHE_EVENT)!=0)
            {
                pCallback.OnQueryCacheMissPolicy(0,WMS_CACHE_QUERY_MISS_RESPONSE.WMS_CACHE_QUERY_MISS_FORWARD_REQUEST,
          null,this,null,varContext);
            }

            return;
        }

void IWMSCacheProxy. CacheProxySamplePlugin::CacheProxyPlugin::QuerySpaceForCacheItem | ( | int | lContentSizeLow,
 |  | int | lContentSizeHigh,
 |  | out System.Boolean | pvarfSpaceAvail |
 | ) |  |  | [inline, private]

Definition at line 800 of file Class1.cs.

        {
      Debug.WriteLine("IWMSCacheProxy.QuerySpaceForCacheItem entered");
            pvarfSpaceAvail = true;
            return;
        }

static void CacheProxySamplePlugin::CacheProxyPlugin::RegisterFunction ( Type t ) [inline, static]

Definition at line 438 of file Class1.cs.

        {
            Debug.WriteLine("CacheProxyPlugin::RegisterFunction entered");
            try
            {
                RegistryKey regHKLM = Registry.LocalMachine;
                regHKLM = regHKLM.CreateSubKey( strSubKey1 );
                regHKLM.SetValue(null, strPluginName);

                RegistryKey regHKCR = Registry.ClassesRoot;
                regHKCR = regHKCR.CreateSubKey( strSubKey2 );
                regHKCR.SetValue("Name", strPluginName);
                regHKCR.SetValue("Author", "Microsoft Corporation");
                regHKCR.SetValue("CopyRight", "Copyright (C) Microsoft Corporation. All rights reserved.");
        regHKCR.SetValue("Description", "Enables you to configure Cache/Proxy");
                regHKCR.SetValue("UnsupportedLoadTypes", 0x02);
            }
            catch(Exception error)
            {
                Console.WriteLine( "Error Registering DLL. Error " + error.Message );
            }
        }

void IWMSCacheProxy. CacheProxySamplePlugin::CacheProxyPlugin::RemoveAllCacheItems | ( | IWMSCacheProxyCallback | pCallback,
 |  | object | varContext |
 | ) |  |  | [inline, private]

Definition at line 755 of file Class1.cs.

        {
      Debug.WriteLine("IWMSCacheProxy.RemoveAllCacheItems entered");
            DataTable dt = DS.Tables["CachedItems"];
            DataRow[] drows = dt.Select();
            foreach(DataRow row in drows)
            {
                string File = Convert.ToString(row["OriginUrl"]);
                RemoveEntryFromDatabase(File,true);
            }
            pCallback.OnRemoveAllCacheItems(0,varContext);
            return;
        }

void IWMSCacheProxy. CacheProxySamplePlugin::CacheProxyPlugin::RemoveCacheItem | ( | string | stringOriginUrl,
 |  | IWMSCacheProxyCallback | pCallback,
 |  | object | varContext |
 | ) |  |  | [inline, private]

Definition at line 743 of file Class1.cs.

        {
      Debug.WriteLine("IWMSCacheProxy.RemoveCacheItem entered");
            RemoveEntryFromDatabase(stringOriginUrl,true);
            pCallback.OnRemoveCacheItem(0,varContext);
            return;
        }

void CacheProxySamplePlugin::CacheProxyPlugin::RemoveEntryFromDatabase | ( | string | OriginUrl,
 |  | bool | bDeleteFile |
 | ) |  |  | [inline, private]

Definition at line 1081 of file Class1.cs.

        {
      ContentInfo ci = new ContentInfo(OriginUrl,null);
      RemoveEntryFromDatabase(ci,bDeleteFile);
        }

void CacheProxySamplePlugin::CacheProxyPlugin::RemoveEntryFromDatabase | ( | ContentInfo | ci,
 |  | bool | bDeleteFile |
 | ) |  |  | [inline, private]

Definition at line 1039 of file Class1.cs.

        {
      Debug.WriteLine("CacheProxyPlugin::RemoveEntryFromDatabase entered");
      try
      {
        DataTable dt = DS.Tables["CachedItems"];
        string filexpr = string.Format("OriginUrl = '{0}'",ci.OriginUrl);
        DataRow[] drows = dt.Select(filexpr);
        if(drows.Length==0)
        {
          return;
        }
        // should ideally be only one row
        foreach(DataRow row in drows)
        {
          if(bDeleteFile)
          {
            string file = Convert.ToString(row["CacheUrl"]);
            File.Delete(file);
          }
          dt.Rows.Remove(row);
        }

        // now delete all playlist entries if available
        DataTable dtPlaylist = DS.Tables["PlaylistEntries"];
        string filter = string.Format("OriginUrl='{0}'",ci.OriginUrl);
        DataRow[] rows = dtPlaylist.Select(filter);
        foreach(DataRow row in rows)
        {
          if(bDeleteFile)
          {
            string file = Convert.ToString(row["CacheUrl"]);
            File.Delete(file);
          }
          dt.Rows.Remove(row);
        }
      }
      catch(Exception e)
      {
        Debug.WriteLine(e);
      }
        }

void CacheProxySamplePlugin::CacheProxyPlugin::SavePlaylist ( ContentInfo ci ) [inline, private]

Definition at line 1087 of file Class1.cs.

    {
      Debug.WriteLine("CacheProxyPlugin::SavePlaylist entered");
      //create a wsx file with filename same as first cache entry of the playlist file
      // create wsx with following format
      //<?wsx version="1.0"?>
      //<smil>
      //  <media src="{filename1}" />
      //  <media src="{filename2}" />
      //</smil>
      if(ci==null)
      {
        return;
      }
      if(ci.CDL.Count==0)
      {
        return;
      }
      string filename=string.Format("{0}.wsx",((PlaylistItem)ci.CDL[0]).CacheUrl);
      XmlDocument dom = new XmlDocument();
      //create an empty playlist
      dom.LoadXml("<?wsx version=\"1.0\"?><smil/>");
      //get the smil node
      XmlElement smilnode = dom.DocumentElement;

      int i=0;
      foreach(Object obj in ci.CDL)
      {
        ((PlaylistItem)obj).CacheID = i;
        string file = ((PlaylistItem)obj).CacheUrl;

        XmlElement elem = dom.CreateElement("media");
        XmlAttribute attr = dom.CreateAttribute("src");
        attr.Value = file;
        elem.Attributes.Append(attr);

        attr = dom.CreateAttribute("CacheID");
        attr.Value = i.ToString();
        elem.Attributes.Append(attr);

        smilnode.AppendChild(elem);
        i++;
      }

      // now save the file
      string filesaved = string.Format("{0}.wsx",((PlaylistItem)ci.CDL[0]).CacheUrl);
      dom.Save(filesaved);

      // set the cache URL to this file for cache hit
      ci.CacheUrl = filesaved;
    }

void IWMSBasicPlugin. CacheProxySamplePlugin::CacheProxyPlugin::ShutdownPlugin ( ) [inline, private]

Definition at line 553 of file Class1.cs.

        {
      Debug.WriteLine("IWMSBasicPlugin.ShutdownPlugin entered");
      File.Delete(DatabasePath);
      DS.WriteXml(DatabasePath,XmlWriteMode.WriteSchema);
        }

static void CacheProxySamplePlugin::CacheProxyPlugin::UnRegisterFunction ( Type t ) [inline, static]

Definition at line 462 of file Class1.cs.

        {
      Debug.WriteLine("CacheProxyPlugin::UnRegisterFunction entered");
            try
            {
                RegistryKey regHKLM = Registry.LocalMachine;
                regHKLM.DeleteSubKey( strSubKey1 );
            }
            catch( Exception )
            {
                // ignore error for deleting sub key
            }

            try
            {
                RegistryKey regHKCR = Registry.ClassesRoot;
                regHKCR.DeleteSubKeyTree( strSubKey2 );
            }
            catch( Exception )
            {
                // ignore error for deleting sub key
            }
        }

void CacheProxySamplePlugin::CacheProxyPlugin::UpdateTable ( ContentInfo ci ) [inline, private]

Definition at line 1320 of file Class1.cs.

        {
      Debug.WriteLine("CacheProxyPlugin::UpdateTable entered");
            string strTags=null;
            for(int i=0;(ci.EntityTags!=null)&&(i<ci.EntityTags.Count);i++)
            {
                strTags += ci.EntityTags[i];
                strTags += "#";
            }

            if(strTags==null)
            {
                strTags="Test";
            }
            // update the database
            object[] obj = {ci.OriginUrl,ci.CacheUrl,ci.ContentSize,ci.ContentType,ci.CacheFlags,
                               ci.ExpirationTime,ci.LastModified,ci.SubscriptionFlag
                               ,strTags,ci.CDLData
                           };
            try
            {
                DataTable dt = DS.Tables["CachedItems"];
        DataRow dr = dt.NewRow();
                dr.ItemArray = obj;

        // we remove the previous entry which would most likely be due to the Add For Download call
        RemoveEntryFromDatabase(ci,false);
                dt.Rows.Add(dr);

                // if this is a playlist file, we also need to persist the CDL information for the playlist
                DataTable dt2 = DS.Tables["PlaylistEntries"];

                foreach(PlaylistItem Item in ci.CDL)
                {
                    //add a row for each CDL data
                    DataRow dr2 = dt2.NewRow();
                    object[] objPlaylist =
                        {
                            ci.OriginUrl,Item.CacheID ,Item.CDLData,Item.CacheUrl
                        };
                    dr2.ItemArray = objPlaylist;
                    dt2.Rows.Add(dr2);
                }

            }
            catch(System.Exception e)
            {
                Debug.WriteLine(e);
            }
        }

Member Data Documentation

CachePluginAdmin CacheProxySamplePlugin::CacheProxyPlugin::AdminSettings [private]

Definition at line 277 of file Class1.cs.

IWMSCacheProxyServer CacheProxySamplePlugin::CacheProxyPlugin::CacheProxyServer [private]

Definition at line 271 of file Class1.cs.

IWMSClassObject CacheProxySamplePlugin::CacheProxyPlugin::ClassObject [private]

Definition at line 270 of file Class1.cs.

string CacheProxySamplePlugin::CacheProxyPlugin::ConfigPath [private]

Definition at line 274 of file Class1.cs.

string CacheProxySamplePlugin::CacheProxyPlugin::DatabasePath [private]

Definition at line 275 of file Class1.cs.

DataSet CacheProxySamplePlugin::CacheProxyPlugin::DS [private]

Definition at line 278 of file Class1.cs.

CachePluginAdmin.ModifySettingsEventHandler CacheProxySamplePlugin::CacheProxyPlugin::MyChangeEventHandler [private]

Definition at line 518 of file Class1.cs.

readonly string CacheProxySamplePlugin::CacheProxyPlugin::strGuid = "{1976C73A-4B3A-4738-8B84-1C5545CE80EC}" [static, private]

Definition at line 265 of file Class1.cs.

readonly string CacheProxySamplePlugin::CacheProxyPlugin::strPluginName = "WMS SDK Sample C# Cache Proxy Plug-in" [static, private]

Definition at line 268 of file Class1.cs.

readonly string CacheProxySamplePlugin::CacheProxyPlugin::strSubKey1 = "SOFTWARE\\Microsoft\\Windows Media\\Server\\RegisteredPlugins\\Cache Proxy\\" + strGuid [static, private]

Definition at line 266 of file Class1.cs.

readonly string CacheProxySamplePlugin::CacheProxyPlugin::strSubKey2 = "\\Properties" [static, private]

Definition at line 267 of file Class1.cs.

The documentation for this class was generated from the following file:
  • Multimedia/WindowsMediaServices9/CacheProxy/csharp/Class1.cs
Generated on Wed Nov 13 2024 16:58:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CacheProxySamplePlugin::ContentInfo Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • CacheProxySamplePlugin
  • CacheProxySamplePlugin::ContentInfo
Public Member Functions | Public Attributes

CacheProxySamplePlugin::ContentInfo Class Reference

List of all members.

Public Member Functions

ContentInfo (string o, string c)

Public Attributes

int | CacheFlags
IWMSCacheProxyCallback | CacheProxyCallback
string | CacheUrl
ArrayList | CDL
string | CDLData
System.Int64 | ContentSize
int | ContentType
ArrayList | EntityTags
DateTime | ExpirationTime
DateTime | LastModified
int | lExpiration
string | OriginUrl
int | SubscriptionFlag
object | varContext

Detailed Description

Definition at line 31 of file Class1.cs.

Constructor & Destructor Documentation

CacheProxySamplePlugin::ContentInfo::ContentInfo | ( | string | o,
 |  | string | c |
 | ) |  |  | [inline]

Definition at line 33 of file Class1.cs.

        {
            Debug.WriteLine("ContentInfo::ContentInfo entered");
            OriginUrl = o;
            CacheUrl = c;
            CacheFlags=0;
            ContentSize = 0;
            SubscriptionFlag=0;
            ContentType=0;
            EntityTags = new ArrayList();
            LastModified = System.DateTime.Now;
            ExpirationTime = System.DateTime.Now;
            CacheProxyCallback = null;
            varContext = null;
            lExpiration = 0;
            CDL = new ArrayList();
        }

Member Data Documentation

int CacheProxySamplePlugin::ContentInfo::CacheFlags

Definition at line 55 of file Class1.cs.

IWMSCacheProxyCallback CacheProxySamplePlugin::ContentInfo::CacheProxyCallback

Definition at line 59 of file Class1.cs.

string CacheProxySamplePlugin::ContentInfo::CacheUrl

Definition at line 50 of file Class1.cs.

ArrayList CacheProxySamplePlugin::ContentInfo::CDL

Definition at line 62 of file Class1.cs.

string CacheProxySamplePlugin::ContentInfo::CDLData

Definition at line 58 of file Class1.cs.

System.Int64 CacheProxySamplePlugin::ContentInfo::ContentSize

Definition at line 56 of file Class1.cs.

int CacheProxySamplePlugin::ContentInfo::ContentType

Definition at line 52 of file Class1.cs.

ArrayList CacheProxySamplePlugin::ContentInfo::EntityTags

Definition at line 57 of file Class1.cs.

DateTime CacheProxySamplePlugin::ContentInfo::ExpirationTime

Definition at line 54 of file Class1.cs.

DateTime CacheProxySamplePlugin::ContentInfo::LastModified

Definition at line 53 of file Class1.cs.

int CacheProxySamplePlugin::ContentInfo::lExpiration

Definition at line 61 of file Class1.cs.

string CacheProxySamplePlugin::ContentInfo::OriginUrl

Definition at line 50 of file Class1.cs.

int CacheProxySamplePlugin::ContentInfo::SubscriptionFlag

Definition at line 51 of file Class1.cs.

object CacheProxySamplePlugin::ContentInfo::varContext

Definition at line 60 of file Class1.cs.

The documentation for this class was generated from the following file:
  • Multimedia/WindowsMediaServices9/CacheProxy/csharp/Class1.cs
Generated on Wed Nov 13 2024 16:58:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CacheProxySamplePlugin::INSSBufferImpl Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • CacheProxySamplePlugin
  • CacheProxySamplePlugin::INSSBufferImpl
Public Member Functions | Public Attributes | Private Member Functions

CacheProxySamplePlugin::INSSBufferImpl Class Reference

List of all members.

Public Member Functions

INSSBufferImpl ()
void | SetBuffer (string Buf)

Public Attributes

byte[] | Buffer
uint | Length

Private Member Functions

void INSSBuffer. | GetBuffer (out IntPtr ppbBuffer)
void INSSBuffer. | GetBufferAndLength (out IntPtr ppbBuffer, out uint pdwLength)
void INSSBuffer. | GetLength (out uint pdwLength)
void INSSBuffer. | GetMaxLength (out uint pdwLength)
void INSSBuffer. | SetLength (uint dwLength)

Detailed Description

Definition at line 65 of file Class1.cs.

Constructor & Destructor Documentation

CacheProxySamplePlugin::INSSBufferImpl::INSSBufferImpl ( ) [inline]

Definition at line 70 of file Class1.cs.

        {
      Debug.WriteLine("INSSBufferImpl::INSSBufferImpl entered");
      Length = 0;
        }

Member Function Documentation

void INSSBuffer. CacheProxySamplePlugin::INSSBufferImpl::GetBuffer ( out IntPtr ppbBuffer ) [inline, private]

Definition at line 84 of file Class1.cs.

        {
            Debug.WriteLine("INSSBufferImpl::GetBuffer entered");
            ppbBuffer = Marshal.AllocCoTaskMem((int)Length);
            try
            {
                Marshal.Copy(Buffer,0,ppbBuffer,(int)Length);
            }
            catch(Exception e)
            {
                Debug.WriteLine(e);
            }
        }

void INSSBuffer. CacheProxySamplePlugin::INSSBufferImpl::GetBufferAndLength | ( | out IntPtr | ppbBuffer,
 |  | out uint | pdwLength |
 | ) |  |  | [inline, private]

Definition at line 76 of file Class1.cs.

        {
            Debug.WriteLine("INSSBufferImpl::GetBufferAndLength entered");
            pdwLength=Length;
            INSSBuffer pBuf = this as INSSBuffer;
            pBuf.GetBuffer(out ppbBuffer);

        }

void INSSBuffer. CacheProxySamplePlugin::INSSBufferImpl::GetLength ( out uint pdwLength ) [inline, private]

Definition at line 98 of file Class1.cs.

        {
            Debug.WriteLine("INSSBufferImpl::GetLength entered");
            pdwLength=Length;
        }

void INSSBuffer. CacheProxySamplePlugin::INSSBufferImpl::GetMaxLength ( out uint pdwLength ) [inline, private]

Definition at line 104 of file Class1.cs.

        {
            Debug.WriteLine("INSSBufferImpl::GetMaxLength entered");
            pdwLength=Length;
        }

void CacheProxySamplePlugin::INSSBufferImpl::SetBuffer ( string Buf ) [inline]

Definition at line 116 of file Class1.cs.

        {
            Debug.WriteLine("INSSBufferImpl::SetBuffer entered");
            if(Buf!=null)
            {
                try
                {
                    Buffer = Convert.FromBase64String(Buf);
          Length = (uint)Buffer.Length;
                }
                catch(Exception e)
                {
                    Debug.WriteLine(e);
                }

            }
      Debug.WriteLine("INSSBufferImpl::SetBuffer ended");
        }

void INSSBuffer. CacheProxySamplePlugin::INSSBufferImpl::SetLength ( uint dwLength ) [inline, private]

Definition at line 110 of file Class1.cs.

        {
            Debug.WriteLine("INSSBufferImpl::SetLength entered");
            Length = dwLength;
        }

Member Data Documentation

byte [] CacheProxySamplePlugin::INSSBufferImpl::Buffer

Definition at line 67 of file Class1.cs.

uint CacheProxySamplePlugin::INSSBufferImpl::Length

Definition at line 68 of file Class1.cs.

The documentation for this class was generated from the following file:
  • Multimedia/WindowsMediaServices9/CacheProxy/csharp/Class1.cs
Generated on Wed Nov 13 2024 16:58:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CacheProxySamplePlugin::IWMSCacheItemCollectionImpl Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • CacheProxySamplePlugin
  • CacheProxySamplePlugin::IWMSCacheItemCollectionImpl
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes

CacheProxySamplePlugin::IWMSCacheItemCollectionImpl Class Reference

List of all members.

Public Member Functions

IWMSCacheItemCollectionImpl (CacheProxyPlugin plugin, DataTable dt)

Public Attributes

CacheProxyPlugin Plugin

Private Member Functions

void IWMSCacheItemCollection. | GetCount (out int count)
void IWMSCacheItemCollection. | GetItem (int index, out IWMSCacheItemDescriptor cacheItem)

Private Attributes

DataTable | DT

Static Private Attributes

static string | strSel = "ContentType%2 = 0"

Detailed Description

Definition at line 208 of file Class1.cs.

Constructor & Destructor Documentation

CacheProxySamplePlugin::IWMSCacheItemCollectionImpl::IWMSCacheItemCollectionImpl | ( | CacheProxyPlugin | plugin,
 |  | DataTable | dt |
 | ) |  |  | [inline]

Definition at line 211 of file Class1.cs.

    {
      Plugin = plugin;
      DT = dt;
    }

Member Function Documentation

void IWMSCacheItemCollection. CacheProxySamplePlugin::IWMSCacheItemCollectionImpl::GetCount ( out int count ) [inline, private]

Definition at line 217 of file Class1.cs.

    {
      // return the count of the Cache Table entries
      // we have to return the count of only the Cache downloads and have to exclude the
      // Broadcast specific cache information
      try
      {
        DataRow[] rows = DT.Select(strSel);
        count = rows.Length;
      }
      catch(Exception e)
      {
        count = 0;
        Debug.WriteLine(e);
        throw new COMException("NO ERROR",1);
      }
    }

void IWMSCacheItemCollection. CacheProxySamplePlugin::IWMSCacheItemCollectionImpl::GetItem | ( | int | index,
 |  | out IWMSCacheItemDescriptor | cacheItem |
 | ) |  |  | [inline, private]

Definition at line 235 of file Class1.cs.

    {
      cacheItem = null;
      try
      {
        DataRow[] rows = DT.Select(strSel);
        if((index <0)||(index >= rows.Length))
        {
          throw new COMException("NO ERROR",1);
        }
        cacheItem = new IWMSCacheItemDescriptorImpl(this,rows[index]) as IWMSCacheItemDescriptor;
      }
      catch(Exception e)
      {
        Debug.WriteLine(e);
        throw new COMException("NO ERROR",1);
      }
    }

Member Data Documentation

DataTable CacheProxySamplePlugin::IWMSCacheItemCollectionImpl::DT [private]

Definition at line 254 of file Class1.cs.

CacheProxyPlugin CacheProxySamplePlugin::IWMSCacheItemCollectionImpl::Plugin

Definition at line 255 of file Class1.cs.

string CacheProxySamplePlugin::IWMSCacheItemCollectionImpl::strSel = "ContentType%2 = 0" [static, private]

Definition at line 210 of file Class1.cs.

The documentation for this class was generated from the following file:
  • Multimedia/WindowsMediaServices9/CacheProxy/csharp/Class1.cs
Generated on Wed Nov 13 2024 16:58:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CacheProxySamplePlugin::IWMSCacheItemDescriptorImpl Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • CacheProxySamplePlugin
  • CacheProxySamplePlugin::IWMSCacheItemDescriptorImpl
Public Member Functions | Private Member Functions | Private Attributes

CacheProxySamplePlugin::IWMSCacheItemDescriptorImpl Class Reference

List of all members.

Public Member Functions

IWMSCacheItemDescriptorImpl (IWMSCacheItemCollectionImpl collection, DataRow row)

Private Member Functions

void IWMSCacheItemDescriptor. | GetCacheUrl (out string url)
void IWMSCacheItemDescriptor. | GetContentInformation (out IWMSContext contentinfo)
void IWMSCacheItemDescriptor. | GetContentSize (out int sizeLow, out int sizeHigh)
void IWMSCacheItemDescriptor. | GetOriginUrl (out string url)

Private Attributes

IWMSCacheItemCollectionImpl Collection
DataRow | Row

Detailed Description

Definition at line 138 of file Class1.cs.

Constructor & Destructor Documentation

CacheProxySamplePlugin::IWMSCacheItemDescriptorImpl::IWMSCacheItemDescriptorImpl | ( | IWMSCacheItemCollectionImpl | collection,
 |  | DataRow | row |
 | ) |  |  | [inline]

Definition at line 140 of file Class1.cs.

    {
      Row = row;
      Collection = collection;
    }

Member Function Documentation

void IWMSCacheItemDescriptor. CacheProxySamplePlugin::IWMSCacheItemDescriptorImpl::GetCacheUrl ( out string url ) [inline, private]

Definition at line 146 of file Class1.cs.

    {
      url = null;
      try
      {
        url = Convert.ToString(Row["CacheUrl"]);
      }
      catch(Exception e)
      {
        Debug.WriteLine(e);
        throw new COMException("NO ERROR",1);
      }
    }

void IWMSCacheItemDescriptor. CacheProxySamplePlugin::IWMSCacheItemDescriptorImpl::GetContentInformation ( out IWMSContext contentinfo ) [inline, private]

Definition at line 160 of file Class1.cs.

    {
      contentinfo=null;
      try
      {
        ContentInfo ci;
        Collection.Plugin.GetContentInfo(Convert.ToString(Row["OriginUrl"]),out ci);
        Collection.Plugin.GetContentInfoContext(ci,out contentinfo);
      }
      catch(Exception e)
      {
        Debug.WriteLine(e);
        throw new COMException("NO ERROR",1);
      }
    }

void IWMSCacheItemDescriptor. CacheProxySamplePlugin::IWMSCacheItemDescriptorImpl::GetContentSize | ( | out int | sizeLow,
 |  | out int | sizeHigh |
 | ) |  |  | [inline, private]

Definition at line 176 of file Class1.cs.

    {
      sizeLow = sizeHigh = 0;
      try
      {
        sizeLow = sizeHigh = 0;
      }
      catch(Exception e)
      {
        Debug.WriteLine(e);
        throw new COMException("NO ERROR",1);
      }
    }

void IWMSCacheItemDescriptor. CacheProxySamplePlugin::IWMSCacheItemDescriptorImpl::GetOriginUrl ( out string url ) [inline, private]

Definition at line 190 of file Class1.cs.

    {
      url = null;
      try
      {
        url = Convert.ToString(Row["OriginUrl"]);
      }
      catch(Exception e)
      {
        Debug.WriteLine(e);
        throw new COMException("NO ERROR",1);
      }
    }

Member Data Documentation

IWMSCacheItemCollectionImpl CacheProxySamplePlugin::IWMSCacheItemDescriptorImpl::Collection [private]

Definition at line 205 of file Class1.cs.

DataRow CacheProxySamplePlugin::IWMSCacheItemDescriptorImpl::Row [private]

Definition at line 204 of file Class1.cs.

The documentation for this class was generated from the following file:
  • Multimedia/WindowsMediaServices9/CacheProxy/csharp/Class1.cs
Generated on Wed Nov 13 2024 16:58:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CacheProxySamplePlugin::PlaylistItem Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • CacheProxySamplePlugin
  • CacheProxySamplePlugin::PlaylistItem
Public Attributes

CacheProxySamplePlugin::PlaylistItem Class Reference

List of all members.

Public Attributes

int | CacheID
string | CacheUrl
string | CDLData

Detailed Description

Definition at line 25 of file Class1.cs.

Member Data Documentation

int CacheProxySamplePlugin::PlaylistItem::CacheID

Definition at line 29 of file Class1.cs.

string CacheProxySamplePlugin::PlaylistItem::CacheUrl

Definition at line 27 of file Class1.cs.

string CacheProxySamplePlugin::PlaylistItem::CDLData

Definition at line 28 of file Class1.cs.

The documentation for this class was generated from the following file:
  • Multimedia/WindowsMediaServices9/CacheProxy/csharp/Class1.cs
Generated on Wed Nov 13 2024 16:58:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CActivitySub Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CActivitySub Class Reference

#include "activitysub.h"

Inherits CSysLCESub.

List of all members.

Public Member Functions

CActivitySub (CComSpy *pSpy)
CActivitySub ()
STDMETHODIMP | GetEventClass (LPGUID guid)
STDMETHODIMP | GetEventType (EventEnum *e)
STDMETHODIMP | GetInterface (IID *iid)
STDMETHODIMP | OnActivityCreate (COMSVCSEVENTINFO *pInfo, REFGUID guidActivity)
STDMETHODIMP | OnActivityDestroy (COMSVCSEVENTINFO *pInfo, REFGUID guidActivity)
STDMETHODIMP | OnActivityEnter (COMSVCSEVENTINFO *pInfo, REFGUID guidCurrent, REFGUID guidEntered, DWORD dwThread)
STDMETHODIMP | OnActivityLeave (COMSVCSEVENTINFO *pInfo, REFGUID guidCurrent, REFGUID guidLeft)
STDMETHODIMP | OnActivityLeaveSame (COMSVCSEVENTINFO *pInfo, REFGUID guidCurrent, DWORD dwCallDepth)
STDMETHODIMP | OnActivityReenter (COMSVCSEVENTINFO *pInfo, REFGUID guidCurrent, DWORD dwThread, DWORD dwCallDepth)
STDMETHODIMP | OnActivityTimeout (COMSVCSEVENTINFO *pInfo, REFGUID guidCurrent, REFGUID guidEntered, DWORD dwThread, DWORD dwTimeout)

Detailed Description

Definition at line 31 of file activitysub.h.

Constructor & Destructor Documentation

CActivitySub::CActivitySub ( CComSpy * pSpy ) [inline]

Definition at line 36 of file activitysub.h.

  {
    m_pSpy = pSpy;
  }

CActivitySub::CActivitySub ( ) [inline]

Definition at line 41 of file activitysub.h.

  {
    m_pSpy = NULL;
  }

Member Function Documentation

STDMETHODIMP CActivitySub::GetEventClass ( LPGUID guid ) [inline, virtual]

Implements CSysLCESub.

Definition at line 55 of file activitysub.h.

{*guid = CLSID_ComServiceEvents;return S_OK;}

STDMETHODIMP CActivitySub::GetEventType ( EventEnum * e ) [inline, virtual]

Implements CSysLCESub.

Definition at line 54 of file activitysub.h.

{*e = Activity;return S_OK;}

STDMETHODIMP CActivitySub::GetInterface ( IID * iid ) [inline, virtual]

Implements CSysLCESub.

Definition at line 56 of file activitysub.h.

{*iid = IID_IComActivityEvents;return S_OK;}

STDMETHODIMP CActivitySub::OnActivityCreate | ( | COMSVCSEVENTINFO * | pInfo,
 |  | REFGUID | guidActivity |
 | ) |  |  | [inline]

Definition at line 58 of file activitysub.h.

  {
    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnActivityCreate"), GuidToBstr(pInfo->guidApp));

    CComBSTR sGuidActivity = GuidToBstr(guidActivity);

    m_pSpy -> AddParamValueToList(L"guidActivity", sGuidActivity);

    IF_AUDIT_DO(OnActivityCreate)(pInfo->perfCount,GuidToBstr(pInfo->guidApp),sGuidActivity);

    return S_OK;
  }

STDMETHODIMP CActivitySub::OnActivityDestroy | ( | COMSVCSEVENTINFO * | pInfo,
 |  | REFGUID | guidActivity |
 | ) |  |  | [inline]

Definition at line 71 of file activitysub.h.

  {
    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnActivityDestroy"),  GuidToBstr(pInfo->guidApp));

    CComBSTR sGuidActivity = GuidToBstr(guidActivity);
    m_pSpy -> AddParamValueToList(L"guidActivity", sGuidActivity);

    IF_AUDIT_DO(OnActivityDestroy)(pInfo->perfCount,GuidToBstr(pInfo->guidApp),sGuidActivity);
    return S_OK;

  }

STDMETHODIMP CActivitySub::OnActivityEnter | ( | COMSVCSEVENTINFO * | pInfo,
 |  | REFGUID | guidCurrent,
 |  | REFGUID | guidEntered,
 |  | DWORD | dwThread |
 | ) |  |  | [inline]

Definition at line 83 of file activitysub.h.

  {
    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnActivityEnter"),  GuidToBstr(pInfo->guidApp));

    CComBSTR sGuidCurrent = GuidToBstr(guidCurrent);
    m_pSpy -> AddParamValueToList(L"guidCurrent", sGuidCurrent);
    CComBSTR sGuidEntered = GuidToBstr(guidEntered);
    m_pSpy -> AddParamValueToList(L"guidEntered", sGuidEntered);

    WCHAR szThread[16];
    wsprintfW(szThread,L"0x%08X", dwThread);
    m_pSpy -> AddParamValueToList(L"dwThread", szThread);

    IF_AUDIT_DO(OnActivityEnter)(pInfo->perfCount,GuidToBstr(pInfo->guidApp),
                  sGuidCurrent,
                  sGuidEntered,
                  szThread
                  );

    return S_OK;
  }

STDMETHODIMP CActivitySub::OnActivityLeave | ( | COMSVCSEVENTINFO * | pInfo,
 |  | REFGUID | guidCurrent,
 |  | REFGUID | guidLeft |
 | ) |  |  | [inline]

Definition at line 156 of file activitysub.h.

  {
    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnActivityLeave"),  GuidToBstr(pInfo->guidApp));

    CComBSTR sGuidCurrent = GuidToBstr(guidCurrent);
    m_pSpy -> AddParamValueToList(L"guidCurrent", sGuidCurrent);
    CComBSTR sGuidLeft = GuidToBstr(guidLeft);
    m_pSpy -> AddParamValueToList(L"guidLeft", sGuidLeft);

    IF_AUDIT_DO(OnActivityLeave)(pInfo->perfCount,GuidToBstr(pInfo->guidApp),
                  sGuidCurrent,
                  sGuidLeft
                  );
    return S_OK;
  }

STDMETHODIMP CActivitySub::OnActivityLeaveSame | ( | COMSVCSEVENTINFO * | pInfo,
 |  | REFGUID | guidCurrent,
 |  | DWORD | dwCallDepth |
 | ) |  |  | [inline]

Definition at line 172 of file activitysub.h.

  {
    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnActivityLeaveSame"),  GuidToBstr(pInfo->guidApp));

    CComBSTR sGuidCurrent = GuidToBstr(guidCurrent);
    m_pSpy -> AddParamValueToList(L"guidCurrent", sGuidCurrent);
    WCHAR id[16];
    wsprintfW(id,L"%d", dwCallDepth);
    m_pSpy -> AddParamValueToList(L"dwCallDepth", id);

    IF_AUDIT_DO(OnActivityLeaveSame)(pInfo->perfCount,GuidToBstr(pInfo->guidApp),
                  sGuidCurrent,
                  dwCallDepth
                  );
    return S_OK;
  }

STDMETHODIMP CActivitySub::OnActivityReenter | ( | COMSVCSEVENTINFO * | pInfo,
 |  | REFGUID | guidCurrent,
 |  | DWORD | dwThread,
 |  | DWORD | dwCallDepth |
 | ) |  |  | [inline]

Definition at line 133 of file activitysub.h.

  {
    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnActivityReEnter"),  GuidToBstr(pInfo->guidApp));

    CComBSTR sGuidCurrent = GuidToBstr(guidCurrent);
    m_pSpy -> AddParamValueToList(L"guidCurrent", sGuidCurrent);

    WCHAR szThread[16];
    wsprintfW(szThread,L"0x%08X", dwThread);
    m_pSpy -> AddParamValueToList(L"dwThread", szThread);

    WCHAR szCallDepth[16];
    wsprintfW(szCallDepth,L"%d", dwCallDepth);
    m_pSpy -> AddParamValueToList(L"dwCallDepth", szCallDepth);

    IF_AUDIT_DO(OnActivityReenter)(pInfo->perfCount,GuidToBstr(pInfo->guidApp),
                  sGuidCurrent,
                  szThread,
                  dwCallDepth
                  );
    return S_OK;
  }

STDMETHODIMP CActivitySub::OnActivityTimeout | ( | COMSVCSEVENTINFO * | pInfo,
 |  | REFGUID | guidCurrent,
 |  | REFGUID | guidEntered,
 |  | DWORD | dwThread,
 |  | DWORD | dwTimeout |
 | ) |  |  | [inline]

Definition at line 106 of file activitysub.h.

  {
    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnActivityTimeout"),  GuidToBstr(pInfo->guidApp));

    CComBSTR sGuidCurrent = GuidToBstr(guidCurrent);
    m_pSpy -> AddParamValueToList(L"guidCurrent", sGuidCurrent);
    CComBSTR sGuidEntered = GuidToBstr(guidEntered);
    m_pSpy -> AddParamValueToList(L"guidEntered", sGuidEntered);

    WCHAR szThread[16];
    wsprintfW(szThread,L"0x%08X", dwThread);
    m_pSpy -> AddParamValueToList(L"dwThread", szThread);

    WCHAR szTimeout[16];
    wsprintfW(szTimeout,L"%d", dwTimeout);
    m_pSpy -> AddParamValueToList(L"dwTimeout", szTimeout);

    IF_AUDIT_DO(OnActivityTimeout)(pInfo->perfCount,GuidToBstr(pInfo->guidApp),
                  sGuidCurrent,
                  sGuidEntered,
                  szThread,
                  dwTimeout
                  );
    return S_OK;
  }

The documentation for this class was generated from the following file:
  • Com/Administration/Spy/ComSpyCtl/activitysub.h
Generated on Wed Nov 13 2024 16:55:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAddDeviceDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CAddDeviceDlg Class Reference

#include "adddevicedlg.h"

Inherits CBaseDialog, CBaseDialog, CBaseDialog, CBaseDialog, CBaseDialog, and CBaseDialog.

List of all members.

Public Member Functions

CAddDeviceDlg (ULONG nTemplate, HWND hParentWnd)
CAddDeviceDlg (ULONG nTemplate, HWND hParentWnd)
CAddDeviceDlg (ULONG nTemplate, HWND hParentWnd)
CAddDeviceDlg (ULONG nTemplate, HWND hParentWnd)
CAddDeviceDlg (ULONG nTemplate, HWND hParentWnd)
CAddDeviceDlg (ULONG nTemplate, HWND hParentWnd)
~CAddDeviceDlg ()
~CAddDeviceDlg ()
~CAddDeviceDlg ()
~CAddDeviceDlg ()
~CAddDeviceDlg ()
~CAddDeviceDlg ()
BOOL | ProcessMessage (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
BOOL | ProcessMessage (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
BOOL | ProcessMessage (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
BOOL | ProcessMessage (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
BOOL | ProcessMessage (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
BOOL | ProcessMessage (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)

Private Member Functions

LRESULT | OnInitDialog (HWND hDlg, WPARAM wParam, LPARAM lParam)
LRESULT | OnInitDialog (HWND hDlg, WPARAM wParam, LPARAM lParam)
LRESULT | OnInitDialog (HWND hDlg, WPARAM wParam, LPARAM lParam)
LRESULT | OnInitDialog (HWND hDlg, WPARAM wParam, LPARAM lParam)
LRESULT | OnInitDialog (HWND hDlg, WPARAM wParam, LPARAM lParam)
LRESULT | OnInitDialog (HWND hDlg, WPARAM wParam, LPARAM lParam)
LRESULT | OnOK (HWND hDlg, WPARAM wParam, LPARAM lParam)
LRESULT | OnOK (HWND hDlg, WPARAM wParam, LPARAM lParam)
LRESULT | OnOK (HWND hDlg, WPARAM wParam, LPARAM lParam)
LRESULT | OnOK (HWND hDlg, WPARAM wParam, LPARAM lParam)
LRESULT | OnOK (HWND hDlg, WPARAM wParam, LPARAM lParam)
LRESULT | OnOK (HWND hDlg, WPARAM wParam, LPARAM lParam)

Private Attributes

HWND | m_hParentWnd

Detailed Description

Definition at line 31 of file adddevicedlg.h.

Constructor & Destructor Documentation

CAddDeviceDlg::CAddDeviceDlg | ( | ULONG | nTemplate,
 |  | HWND | hParentWnd
 | ) |  |

Definition at line 29 of file adddevicedlg.cpp.

             : CBaseDialog( nTemplate )
{
  _ASSERT( NULL != pParentWnd );
  m_hParentWnd = pParentWnd;

}

CAddDeviceDlg::~CAddDeviceDlg ( )

Definition at line 37 of file adddevicedlg.cpp.

{
}

CAddDeviceDlg::CAddDeviceDlg | ( | ULONG | nTemplate,
 |  | HWND | hParentWnd
 | ) |  |
CAddDeviceDlg::~CAddDeviceDlg ( )
CAddDeviceDlg::CAddDeviceDlg | ( | ULONG | nTemplate,
 |  | HWND | hParentWnd
 | ) |  |
CAddDeviceDlg::~CAddDeviceDlg ( )
CAddDeviceDlg::CAddDeviceDlg | ( | ULONG | nTemplate,
 |  | HWND | hParentWnd
 | ) |  |
CAddDeviceDlg::~CAddDeviceDlg ( )
CAddDeviceDlg::CAddDeviceDlg | ( | ULONG | nTemplate,
 |  | HWND | hParentWnd
 | ) |  |
CAddDeviceDlg::~CAddDeviceDlg ( )
CAddDeviceDlg::CAddDeviceDlg | ( | ULONG | nTemplate,
 |  | HWND | hParentWnd
 | ) |  |
CAddDeviceDlg::~CAddDeviceDlg ( )

Member Function Documentation

LRESULT CAddDeviceDlg::OnInitDialog | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private, virtual]

Reimplemented from CBaseDialog.

Definition at line 46 of file adddevicedlg.cpp.

{
  LRESULT lResult = 0;

  HWND hArchiveCtrl  = GetDlgItem( hDlg, IDC_ARCHIVE_ATTR  );
  HWND hHiddenCtrl   = GetDlgItem( hDlg, IDC_HIDDEN_ATTR   );
  HWND hLockedCtrl   = GetDlgItem( hDlg, IDC_HIDDEN_ATTR   );
  HWND hReadOnlyCtrl = GetDlgItem( hDlg, IDC_READONLY_ATTR );
  HWND hBackupCtrl   = GetDlgItem( hDlg, IDC_BACKUP_FLAG   );
  HWND hDevNameCtrl  = GetDlgItem( hDlg, IDC_DEVNAME_EDIT  );

  lResult = SendMessage( hArchiveCtrl,  BM_SETCHECK, BST_UNCHECKED, 0 );
  lResult = SendMessage( hHiddenCtrl,   BM_SETCHECK, BST_UNCHECKED, 0 );
  lResult = SendMessage( hLockedCtrl,   BM_SETCHECK, BST_UNCHECKED, 0 );
  lResult = SendMessage( hBackupCtrl,   BM_SETCHECK, BST_UNCHECKED, 0 );
  lResult = SendMessage( hReadOnlyCtrl, BM_SETCHECK, BST_UNCHECKED, 0 );

  lResult = SetWindowText( hDevNameCtrl, _T("") );
  SetFocus( hDevNameCtrl );

  return 0;
}

LRESULT CAddDeviceDlg::OnInitDialog | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private, virtual]

Reimplemented from CBaseDialog.

LRESULT CAddDeviceDlg::OnInitDialog | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private, virtual]

Reimplemented from CBaseDialog.

LRESULT CAddDeviceDlg::OnInitDialog | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private, virtual]

Reimplemented from CBaseDialog.

LRESULT CAddDeviceDlg::OnInitDialog | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private, virtual]

Reimplemented from CBaseDialog.

LRESULT CAddDeviceDlg::OnInitDialog | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private, virtual]

Reimplemented from CBaseDialog.

LRESULT CAddDeviceDlg::OnOK | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private, virtual]

Reimplemented from CBaseDialog.

LRESULT CAddDeviceDlg::OnOK | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private, virtual]

Reimplemented from CBaseDialog.

LRESULT CAddDeviceDlg::OnOK | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private, virtual]

Reimplemented from CBaseDialog.

LRESULT CAddDeviceDlg::OnOK | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private, virtual]

Reimplemented from CBaseDialog.

LRESULT CAddDeviceDlg::OnOK | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private, virtual]

Reimplemented from CBaseDialog.

LRESULT CAddDeviceDlg::OnOK | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private, virtual]

Reimplemented from CBaseDialog.

Definition at line 70 of file adddevicedlg.cpp.

{
  LRESULT          lResult = 0;
  NODE_PROPERTIES  NodeProps;

  ZeroMemory( &NodeProps, sizeof(NODE_PROPERTIES) );

  HWND hArchiveCtrl  = GetDlgItem( hDlg, IDC_ARCHIVE_ATTR  );
  HWND hHiddenCtrl   = GetDlgItem( hDlg, IDC_HIDDEN_ATTR   );
  HWND hLockedCtrl   = GetDlgItem( hDlg, IDC_HIDDEN_ATTR   );
  HWND hReadOnlyCtrl = GetDlgItem( hDlg, IDC_READONLY_ATTR );
  HWND hBackupCtrl   = GetDlgItem( hDlg, IDC_BACKUP_FLAG   );
  HWND hDevNameCtrl  = GetDlgItem( hDlg, IDC_DEVNAME_EDIT  );

  if( BST_CHECKED == SendMessage( hArchiveCtrl, BM_GETCHECK, 0, 0 ) )
    NodeProps.dwAttributes |= ATTRIBUTE_DATA_ARCHIVE;

  if( BST_CHECKED == SendMessage( hHiddenCtrl, BM_GETCHECK, 0, 0 ) )
    NodeProps.dwAttributes |= ATTRIBUTE_DATA_HIDDEN;

  if( BST_CHECKED == SendMessage( hLockedCtrl, BM_GETCHECK, 0, 0 ) )
    NodeProps.dwAttributes |= ATTRIBUTE_DATA_LOCKED;

  if( BST_CHECKED == SendMessage( hReadOnlyCtrl, BM_GETCHECK, 0, 0 ) )
    NodeProps.dwAttributes |= ATTRIBUTE_DATA_READONLY;

  if( BST_CHECKED == SendMessage( hBackupCtrl, BM_GETCHECK, 0, 0 ) )
    NodeProps.dwAttributes |= ATTRIBUTE_BACKUP_DEVICE;

  // Convert to wide characters here for all platforms.  This is the node name
  TCHAR szBuff[ MAX_NAME_LEN ] = {0};
  GetWindowText( hDevNameCtrl, szBuff, MAX_NAME_LEN );
  CopyT2W( NodeProps.szNodeName, szBuff, MAX_NAME_LEN);
  // Probably a good idea to check for NULL name strings here

  // This message passes the user supplied info to the Static Node
  SendMessage( m_hParentWnd, WM_ADD_DEVICENODE, (WPARAM)&NodeProps, 0 );

  // Now tell the static node we are deleting ourselves so the
  // context menu option can be enabled
  SendMessage( m_hParentWnd, WM_DEVICENODE_CLOSED, 0, 0 );

  // Call the base class to shut down the dialog
  CBaseDialog::OnOK( hDlg, wParam, lParam );
  return 0;
}

BOOL CAddDeviceDlg::ProcessMessage | ( | HWND | hDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [virtual]

Implements CBaseDialog.

BOOL CAddDeviceDlg::ProcessMessage | ( | HWND | hDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [virtual]

Implements CBaseDialog.

BOOL CAddDeviceDlg::ProcessMessage | ( | HWND | hDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [virtual]

Implements CBaseDialog.

BOOL CAddDeviceDlg::ProcessMessage | ( | HWND | hDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [virtual]

Implements CBaseDialog.

BOOL CAddDeviceDlg::ProcessMessage | ( | HWND | hDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [virtual]

Implements CBaseDialog.

BOOL CAddDeviceDlg::ProcessMessage | ( | HWND | hDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [virtual]

Implements CBaseDialog.

Definition at line 122 of file adddevicedlg.cpp.

{
  LRESULT lResult = 0;

  switch( uMsg )
  {
    case WM_INITDIALOG:
      lResult = OnInitDialog( hDlg, wParam, lParam );
      break;

    case WM_DESTROY:
      lResult = OnDestroy( hDlg, wParam, lParam );
      break;

    case WM_NCDESTROY:
      lResult = OnNcDestroy( hDlg, wParam, lParam );
      break;

    case WM_CLOSE:
      // Not overriding WM_CLOSE and IDCANCEL so we must send
      // WM_DEVICENODE_CLOSED before calling the base class or else
      // the context menu will stay grayed
      SendMessage( m_hParentWnd, WM_DEVICENODE_CLOSED, 0, 0 );
      lResult = OnClose( hDlg, wParam, lParam );
      break;

    case WM_COMMAND:
      switch( wParam )
      {
        case IDOK:
          lResult = OnOK( hDlg, wParam, lParam );
          break;

        case IDCANCEL:
          SendMessage( m_hParentWnd, WM_DEVICENODE_CLOSED, 0, 0 );
          lResult = OnCancel( hDlg, wParam, lParam );
          break;

        default:
          break;
      }
    default:
      break;
  }
  return (BOOL)lResult;
}

Member Data Documentation

HWND CAddDeviceDlg::m_hParentWnd [private]

Definition at line 48 of file adddevicedlg.h.

The documentation for this class was generated from the following files:
  • SysMgmt/MMC/mmc2.0/contextmenu/adddevicedlg.h
  • SysMgmt/MMC/mmc2.0/dragdrop/adddevicedlg.h
  • SysMgmt/MMC/mmc2.0/help/adddevicedlg.h
  • SysMgmt/MMC/mmc2.0/multisel/adddevicedlg.h
  • SysMgmt/MMC/mmc2.0/proppage/adddevicedlg.h
  • SysMgmt/MMC/mmc2.0/viewex/adddevicedlg.h
  • SysMgmt/MMC/mmc2.0/contextmenu/adddevicedlg.cpp
  • SysMgmt/MMC/mmc2.0/dragdrop/adddevicedlg.cpp
  • SysMgmt/MMC/mmc2.0/help/adddevicedlg.cpp
  • SysMgmt/MMC/mmc2.0/multisel/adddevicedlg.cpp
  • SysMgmt/MMC/mmc2.0/proppage/adddevicedlg.cpp
  • SysMgmt/MMC/mmc2.0/viewex/adddevicedlg.cpp
Generated on Wed Nov 13 2024 16:55:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAddFolderDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CAddFolderDlg Class Reference

#include "addfolderdlg.h"

Inherits CBaseDialog.

List of all members.

Public Member Functions

CAddFolderDlg (ULONG nTemplate, HWND hParentWnd)
~CAddFolderDlg ()
BOOL | ProcessMessage (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)

Private Member Functions

LRESULT | OnInitDialog (HWND hDlg, WPARAM wParam, LPARAM lParam)
LRESULT | OnOK (HWND hDlg, WPARAM wParam, LPARAM lParam)

Private Attributes

HWND | m_hParentWnd

Detailed Description

Definition at line 31 of file addfolderdlg.h.

Constructor & Destructor Documentation

CAddFolderDlg::CAddFolderDlg | ( | ULONG | nTemplate,
 |  | HWND | hParentWnd
 | ) |  |

Definition at line 29 of file ADDFolderdlg.cpp.

             : CBaseDialog( nTemplate )
{
  _ASSERT( NULL != pParentWnd );
  m_hParentWnd = pParentWnd;

}

CAddFolderDlg::~CAddFolderDlg ( )

Definition at line 37 of file ADDFolderdlg.cpp.

{
}

Member Function Documentation

LRESULT CAddFolderDlg::OnInitDialog | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private, virtual]

Reimplemented from CBaseDialog.

Definition at line 46 of file ADDFolderdlg.cpp.

{
  LRESULT lResult = 0;

  HWND hArchiveCtrl  = GetDlgItem( hDlg, IDC_ARCHIVE_ATTR  );
  HWND hHiddenCtrl   = GetDlgItem( hDlg, IDC_HIDDEN_ATTR   );
  HWND hLockedCtrl   = GetDlgItem( hDlg, IDC_LOCKED_ATTR   );
  HWND hReadOnlyCtrl = GetDlgItem( hDlg, IDC_READONLY_ATTR );
  HWND hFldrNameCtrl = GetDlgItem( hDlg, IDC_FLDRNAME_EDIT );

  lResult = SendMessage( hArchiveCtrl,  BM_SETCHECK, BST_UNCHECKED, 0 );
  lResult = SendMessage( hHiddenCtrl,   BM_SETCHECK, BST_UNCHECKED, 0 );
  lResult = SendMessage( hLockedCtrl,   BM_SETCHECK, BST_UNCHECKED, 0 );
  lResult = SendMessage( hReadOnlyCtrl, BM_SETCHECK, BST_UNCHECKED, 0 );

  lResult = SetWindowText( hFldrNameCtrl, _T("") );
  SetFocus( hFldrNameCtrl );

  return 0;
}

LRESULT CAddFolderDlg::OnOK | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private, virtual]

Reimplemented from CBaseDialog.

Definition at line 68 of file ADDFolderdlg.cpp.

{
  LRESULT          lResult = 0;
  NODE_PROPERTIES  NodeProps;

  ZeroMemory( &NodeProps, sizeof(NODE_PROPERTIES) );

  HWND hArchiveCtrl  = GetDlgItem( hDlg, IDC_ARCHIVE_ATTR  );
  HWND hHiddenCtrl   = GetDlgItem( hDlg, IDC_HIDDEN_ATTR   );
  HWND hLockedCtrl   = GetDlgItem( hDlg, IDC_LOCKED_ATTR   );
  HWND hReadOnlyCtrl = GetDlgItem( hDlg, IDC_READONLY_ATTR );
  HWND hFldrNameCtrl = GetDlgItem( hDlg, IDC_FLDRNAME_EDIT );

  if( BST_CHECKED == SendMessage( hArchiveCtrl, BM_GETCHECK, 0, 0 ) )
    NodeProps.dwAttributes |= ATTRIBUTE_DATA_ARCHIVE;

  if( BST_CHECKED == SendMessage( hHiddenCtrl, BM_GETCHECK, 0, 0 ) )
    NodeProps.dwAttributes |= ATTRIBUTE_DATA_HIDDEN;

  if( BST_CHECKED == SendMessage( hLockedCtrl, BM_GETCHECK, 0, 0 ) )
    NodeProps.dwAttributes |= ATTRIBUTE_DATA_LOCKED;

  if( BST_CHECKED == SendMessage( hReadOnlyCtrl, BM_GETCHECK, 0, 0 ) )
    NodeProps.dwAttributes |= ATTRIBUTE_DATA_READONLY;

  // Convert to wide characters here for all platforms.  This is the node name
  TCHAR szBuff[ MAX_NAME_LEN ] = {0};
  GetWindowText( hFldrNameCtrl, szBuff, MAX_NAME_LEN );
  CopyT2W( NodeProps.szNodeName, szBuff, MAX_NAME_LEN);
  // Probably a good idea to check for NULL name strings here

  // This message passes the user supplied info to the Static Node
  SendMessage( m_hParentWnd, WM_ADDNEW_NODE, (WPARAM)&NodeProps, 0 );

  // Now tell the parent node we are deleting ourselves so the
  // context menu option can be enabled
  SendMessage( m_hParentWnd, WM_DIALOG_CLOSED, 0, 0 );

  // Call the base class to shut down the dialog
  CBaseDialog::OnOK( hDlg, wParam, lParam );
  return 0;
}

BOOL CAddFolderDlg::ProcessMessage | ( | HWND | hDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [virtual]

Implements CBaseDialog.

Definition at line 116 of file ADDFolderdlg.cpp.

{
  LRESULT lResult = 0;

  switch( uMsg )
  {
    case WM_INITDIALOG:
      lResult = OnInitDialog( hDlg, wParam, lParam );
      break;

    case WM_DESTROY:
      lResult = OnDestroy( hDlg, wParam, lParam );
      break;

    case WM_NCDESTROY:
      lResult = OnNcDestroy( hDlg, wParam, lParam );
      break;

    case WM_CLOSE:
      // Not overriding WM_CLOSE and IDCANCEL so we must send
      // WM_DIALOG_CLOSED before calling the base class or else
      // the context menu will stay grayed
      SendMessage( m_hParentWnd, WM_DIALOG_CLOSED, 0, 0 );
      lResult = OnClose( hDlg, wParam, lParam );
      break;

    case WM_COMMAND:
      switch( wParam )
      {
        case IDOK:
          lResult = OnOK( hDlg, wParam, lParam );
          break;

        case IDCANCEL:
          SendMessage( m_hParentWnd, WM_DIALOG_CLOSED, 0, 0 );
          lResult = OnCancel( hDlg, wParam, lParam );
          break;

        default:
          break;
      }
    default:
      break;
  }
  return (BOOL)lResult;
}

Member Data Documentation

HWND CAddFolderDlg::m_hParentWnd [private]

Definition at line 48 of file addfolderdlg.h.

The documentation for this class was generated from the following files:
  • SysMgmt/MMC/mmc2.0/multisel/addfolderdlg.h
  • SysMgmt/MMC/mmc2.0/multisel/ADDFolderdlg.cpp
Generated on Wed Nov 13 2024 16:55:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAddrNode Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CAddrNode Class Reference

List of all members.

Public Member Functions

void | operator delete (void FAR *pv)
void FAR * | operator new (size_t cb)

Public Attributes

ULONG m_cb
ULONG m_nAlloc
CAddrNode FAR * | m_next
void FAR * | m_pv

Detailed Description

Definition at line 203 of file dballoc.Cpp.

Member Function Documentation

void CAddrNode::operator delete ( void FAR * pv ) [inline]

Definition at line 214 of file dballoc.Cpp.

                                     {
     FREE(pv);
   }

void FAR* CAddrNode::operator new ( size_t cb ) [inline]

Definition at line 211 of file dballoc.Cpp.

                                    {
     return MALLOC(cb);
   }

Member Data Documentation

ULONG CAddrNode::m_cb

Definition at line 207 of file dballoc.Cpp.

ULONG CAddrNode::m_nAlloc

Definition at line 208 of file dballoc.Cpp.

CAddrNode FAR* CAddrNode::m_next

Definition at line 209 of file dballoc.Cpp.

void FAR* CAddrNode::m_pv

Definition at line 206 of file dballoc.Cpp.

The documentation for this class was generated from the following file:
  • Com/Fundamentals/OleStd/dballoc.Cpp
Generated on Wed Nov 13 2024 16:55:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAddVFileDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CAddVFileDlg Class Reference

#include "addvfiledlg.h"

Inherits CBaseDialog, CBaseDialog, CBaseDialog, CBaseDialog, and CBaseDialog.

List of all members.

Public Member Functions

CAddVFileDlg (ULONG nTemplate, HWND hParentWnd)
CAddVFileDlg (ULONG nTemplate, HWND hParentWnd)
CAddVFileDlg (ULONG nTemplate, HWND hParentWnd)
CAddVFileDlg (ULONG nTemplate, HWND hParentWnd)
CAddVFileDlg (ULONG nTemplate, HWND hParentWnd)
~CAddVFileDlg ()
~CAddVFileDlg ()
~CAddVFileDlg ()
~CAddVFileDlg ()
~CAddVFileDlg ()
BOOL | ProcessMessage (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
BOOL | ProcessMessage (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
BOOL | ProcessMessage (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
BOOL | ProcessMessage (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
BOOL | ProcessMessage (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)

Private Member Functions

LRESULT | OnInitDialog (HWND hDlg, WPARAM wParam, LPARAM lParam)
LRESULT | OnInitDialog (HWND hDlg, WPARAM wParam, LPARAM lParam)
LRESULT | OnInitDialog (HWND hDlg, WPARAM wParam, LPARAM lParam)
LRESULT | OnInitDialog (HWND hDlg, WPARAM wParam, LPARAM lParam)
LRESULT | OnInitDialog (HWND hDlg, WPARAM wParam, LPARAM lParam)
LRESULT | OnOK (HWND hDlg, WPARAM wParam, LPARAM lParam)
LRESULT | OnOK (HWND hDlg, WPARAM wParam, LPARAM lParam)
LRESULT | OnOK (HWND hDlg, WPARAM wParam, LPARAM lParam)
LRESULT | OnOK (HWND hDlg, WPARAM wParam, LPARAM lParam)
LRESULT | OnOK (HWND hDlg, WPARAM wParam, LPARAM lParam)

Private Attributes

HWND | m_hParentWnd

Detailed Description

Definition at line 31 of file addvfiledlg.h.

Constructor & Destructor Documentation

CAddVFileDlg::CAddVFileDlg | ( | ULONG | nTemplate,
 |  | HWND | hParentWnd
 | ) |  |

Definition at line 29 of file addvfiledlg.cpp.

             : CBaseDialog( nTemplate )
{
  _ASSERT( NULL != pParentWnd );
  m_hParentWnd = pParentWnd;

}

CAddVFileDlg::~CAddVFileDlg ( )

Definition at line 37 of file addvfiledlg.cpp.

{
}

CAddVFileDlg::CAddVFileDlg | ( | ULONG | nTemplate,
 |  | HWND | hParentWnd
 | ) |  |
CAddVFileDlg::~CAddVFileDlg ( )
CAddVFileDlg::CAddVFileDlg | ( | ULONG | nTemplate,
 |  | HWND | hParentWnd
 | ) |  |
CAddVFileDlg::~CAddVFileDlg ( )
CAddVFileDlg::CAddVFileDlg | ( | ULONG | nTemplate,
 |  | HWND | hParentWnd
 | ) |  |
CAddVFileDlg::~CAddVFileDlg ( )
CAddVFileDlg::CAddVFileDlg | ( | ULONG | nTemplate,
 |  | HWND | hParentWnd
 | ) |  |
CAddVFileDlg::~CAddVFileDlg ( )

Member Function Documentation

LRESULT CAddVFileDlg::OnInitDialog | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private, virtual]

Reimplemented from CBaseDialog.

Definition at line 46 of file addvfiledlg.cpp.

{
  LRESULT lResult = 0;

  HWND hArchiveCtrl  = GetDlgItem( hDlg, IDC_ARCHIVE_ATTR  );
  HWND hHiddenCtrl   = GetDlgItem( hDlg, IDC_HIDDEN_ATTR   );
  HWND hLockedCtrl   = GetDlgItem( hDlg, IDC_LOCKED_ATTR   );
  HWND hReadOnlyCtrl = GetDlgItem( hDlg, IDC_READONLY_ATTR );
  HWND hDevNameCtrl  = GetDlgItem( hDlg, IDC_DEVNAME_EDIT  );

  lResult = SendMessage( hArchiveCtrl,  BM_SETCHECK, BST_UNCHECKED, 0 );
  lResult = SendMessage( hHiddenCtrl,   BM_SETCHECK, BST_UNCHECKED, 0 );
  lResult = SendMessage( hLockedCtrl,   BM_SETCHECK, BST_UNCHECKED, 0 );
  lResult = SendMessage( hReadOnlyCtrl, BM_SETCHECK, BST_UNCHECKED, 0 );

  lResult = SetWindowText( hDevNameCtrl, _T("") );
  SetFocus( hDevNameCtrl );

  return 0;
}

LRESULT CAddVFileDlg::OnInitDialog | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private, virtual]

Reimplemented from CBaseDialog.

LRESULT CAddVFileDlg::OnInitDialog | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private, virtual]

Reimplemented from CBaseDialog.

LRESULT CAddVFileDlg::OnInitDialog | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private, virtual]

Reimplemented from CBaseDialog.

LRESULT CAddVFileDlg::OnInitDialog | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private, virtual]

Reimplemented from CBaseDialog.

LRESULT CAddVFileDlg::OnOK | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private, virtual]

Reimplemented from CBaseDialog.

LRESULT CAddVFileDlg::OnOK | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private, virtual]

Reimplemented from CBaseDialog.

LRESULT CAddVFileDlg::OnOK | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private, virtual]

Reimplemented from CBaseDialog.

LRESULT CAddVFileDlg::OnOK | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private, virtual]

Reimplemented from CBaseDialog.

LRESULT CAddVFileDlg::OnOK | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private, virtual]

Reimplemented from CBaseDialog.

Definition at line 68 of file addvfiledlg.cpp.

{
  LRESULT          lResult = 0;
  NODE_PROPERTIES  NodeProps;

  ZeroMemory( &NodeProps, sizeof(NODE_PROPERTIES) );

  HWND hArchiveCtrl  = GetDlgItem( hDlg, IDC_ARCHIVE_ATTR  );
  HWND hHiddenCtrl   = GetDlgItem( hDlg, IDC_HIDDEN_ATTR   );
  HWND hLockedCtrl   = GetDlgItem( hDlg, IDC_LOCKED_ATTR   );
  HWND hReadOnlyCtrl = GetDlgItem( hDlg, IDC_READONLY_ATTR );
  HWND hDevNameCtrl  = GetDlgItem( hDlg, IDC_DEVNAME_EDIT  );

  if( BST_CHECKED == SendMessage( hArchiveCtrl, BM_GETCHECK, 0, 0 ) )
    NodeProps.dwAttributes |= ATTRIBUTE_DATA_ARCHIVE;

  if( BST_CHECKED == SendMessage( hHiddenCtrl, BM_GETCHECK, 0, 0 ) )
    NodeProps.dwAttributes |= ATTRIBUTE_DATA_HIDDEN;

  if( BST_CHECKED == SendMessage( hLockedCtrl, BM_GETCHECK, 0, 0 ) )
    NodeProps.dwAttributes |= ATTRIBUTE_DATA_LOCKED;

  if( BST_CHECKED == SendMessage( hReadOnlyCtrl, BM_GETCHECK, 0, 0 ) )
    NodeProps.dwAttributes |= ATTRIBUTE_DATA_READONLY;

  // Convert to wide characters here for all platforms.  This is the node name
  TCHAR szBuff[ MAX_NAME_LEN ] = {0};
  GetWindowText( hDevNameCtrl, szBuff, MAX_NAME_LEN );
  CopyT2W( NodeProps.szNodeName, szBuff, MAX_NAME_LEN);
  // Probably a good idea to check for NULL name strings here

  // This message passes the user supplied info to the Static Node
  SendMessage( m_hParentWnd, WM_ADD_VIRTUALFILE, (WPARAM)&NodeProps, 0 );

  // Now tell the static node we are deleting ourselves so the
  // context menu option can be enabled
  SendMessage( m_hParentWnd, WM_VIRTUALFILE_CLOSED, 0, 0 );

  // Call the base class to shut down the dialog
  CBaseDialog::OnOK( hDlg, wParam, lParam );
  return 0;
}

BOOL CAddVFileDlg::ProcessMessage | ( | HWND | hDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [virtual]

Implements CBaseDialog.

BOOL CAddVFileDlg::ProcessMessage | ( | HWND | hDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [virtual]

Implements CBaseDialog.

BOOL CAddVFileDlg::ProcessMessage | ( | HWND | hDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [virtual]

Implements CBaseDialog.

Definition at line 117 of file addvfiledlg.cpp.

{
  LRESULT lResult = 0;

  switch( uMsg )
  {
    case WM_INITDIALOG:
      lResult = OnInitDialog( hDlg, wParam, lParam );
      break;

    case WM_DESTROY:
      lResult = OnDestroy( hDlg, wParam, lParam );
      break;

    case WM_NCDESTROY:
      lResult = OnNcDestroy( hDlg, wParam, lParam );
      break;

    case WM_CLOSE:
      // Not overriding WM_CLOSE and IDCANCEL so we must send
      // WM_DEVICENODE_CLOSED before calling the base class or else
      // the context menu will stay grayed
      SendMessage( m_hParentWnd, WM_VIRTUALFILE_CLOSED, 0, 0 );
      lResult = OnClose( hDlg, wParam, lParam );
      break;

    case WM_COMMAND:
      switch( wParam )
      {
        case IDOK:
          lResult = OnOK( hDlg, wParam, lParam );
          break;

        case IDCANCEL:
          SendMessage( m_hParentWnd, WM_VIRTUALFILE_CLOSED, 0, 0 );
          lResult = OnCancel( hDlg, wParam, lParam );
          break;

        default:
          break;
      }
    default:
      break;
  }
  return (BOOL)lResult;
}

BOOL CAddVFileDlg::ProcessMessage | ( | HWND | hDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [virtual]

Implements CBaseDialog.

BOOL CAddVFileDlg::ProcessMessage | ( | HWND | hDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [virtual]

Implements CBaseDialog.

Member Data Documentation

HWND CAddVFileDlg::m_hParentWnd [private]

Definition at line 48 of file addvfiledlg.h.

The documentation for this class was generated from the following files:
  • SysMgmt/MMC/mmc2.0/dragdrop/addvfiledlg.h
  • SysMgmt/MMC/mmc2.0/help/addvfiledlg.h
  • SysMgmt/MMC/mmc2.0/multisel/addvfiledlg.h
  • SysMgmt/MMC/mmc2.0/proppage/addvfiledlg.h
  • SysMgmt/MMC/mmc2.0/viewex/addvfiledlg.h
  • SysMgmt/MMC/mmc2.0/dragdrop/addvfiledlg.cpp
  • SysMgmt/MMC/mmc2.0/help/addvfiledlg.cpp
  • SysMgmt/MMC/mmc2.0/multisel/addvfiledlg.cpp
  • SysMgmt/MMC/mmc2.0/proppage/addvfiledlg.cpp
  • SysMgmt/MMC/mmc2.0/viewex/addvfiledlg.cpp
Generated on Wed Nov 13 2024 16:55:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAdminNotifyHandler Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CAdminNotifyHandler Class Reference

#include "adevent.h"

List of all members.

Public Member Functions

CAdminNotifyHandler ()
~CAdminNotifyHandler ()
STDMETHOD() | Begin (ULONG uEvent, IDataObject *pArg1, IDataObject *pArg2, ULONG *puFlags, BSTR *pBstr)
STDMETHOD() | End (void)
STDMETHOD() | Initialize (IDataObject *pExtraInfo, ULONG *puEventFlags)
STDMETHOD() | Notify (ULONG nItem, ULONG uFlags)
STDMETHOD() | QueryInterface (REFIID, LPVOID FAR *)
STDMETHOD_ (DWORD, AddRef)()
STDMETHOD_ (DWORD, Release)()

Protected Attributes

DWORD m_ObjRefCount
IDataObject * | m_pdoFrom
IDataObject * | m_pdoTo

Detailed Description

Definition at line 60 of file adevent.h.

Constructor & Destructor Documentation

CAdminNotifyHandler::CAdminNotifyHandler ( )

Definition at line 391 of file ADEvent.cpp.

{
    m_ObjRefCount = 1;
    g_DllRefCount++;
    m_pdoFrom = NULL;
    m_pdoTo = NULL;
}

CAdminNotifyHandler::~CAdminNotifyHandler ( )

Definition at line 405 of file ADEvent.cpp.

{
    g_DllRefCount--;

    End();
}

Member Function Documentation

STDMETHODIMP CAdminNotifyHandler::Begin | ( | ULONG | uEvent,
 |  | IDataObject * | pArg1,
 |  | IDataObject * | pArg2,
 |  | ULONG * | puFlags,
 |  | BSTR * | pBstr
 | ) |  |

Definition at line 511 of file ADEvent.cpp.

{
    OutputDebugString(TEXT("CAdminNotifyHandler::Begin\n"));

    if(NULL == pArg1)
    {
        return E_INVALIDARG;
    }
    if(IsBadWritePtr(puFlags, sizeof(ULONG)))
    {
        return E_INVALIDARG;
    }
    if(IsBadWritePtr(pBstr, sizeof(BSTR)))
    {
        return E_INVALIDARG;
    }

    //release any data objects this handler may already have
    End();

    //save the data objects
    pArg1->QueryInterface(IID_IDataObject, (LPVOID*)&m_pdoFrom);

    if(NULL != pArg2)
    {
        pArg2->QueryInterface(IID_IDataObject, (LPVOID*)&m_pdoTo);
    }

    STGMEDIUM   stm;
    FORMATETC   fe;
    HRESULT     hr;

    fe.cfFormat = (CLIPFORMAT)RegisterClipboardFormat(CFSTR_DSOBJECTNAMES);
    fe.ptd = NULL;
    fe.dwAspect = DVASPECT_CONTENT;
    fe.lindex = -1;
    fe.tymed = TYMED_HGLOBAL;
    hr = pArg1->GetData(&fe, &stm);
    if(SUCCEEDED(hr))
    {
        LPDSOBJECTNAMES pdson = (LPDSOBJECTNAMES)GlobalLock(stm.hGlobal);

        if(pdson)
        {
            LPWSTR  pwszName = (LPWSTR)((LPBYTE)pdson + pdson->aObjects[0].offsetName);
            LPWSTR  pwszClass = (LPWSTR)((LPBYTE)pdson + pdson->aObjects[0].offsetClass);

            OutputDebugString(TEXT("\t"));
            OutputDebugStringW(pwszClass);
            OutputDebugString(TEXT(" - "));
            OutputDebugStringW(pwszName);
            OutputDebugString(TEXT("\n"));

            GlobalUnlock(stm.hGlobal);
        }

        ReleaseStgMedium(&stm);
    }

    if(pArg2)
    {
        fe.cfFormat = (CLIPFORMAT)RegisterClipboardFormat(CFSTR_DSOBJECTNAMES);
        fe.ptd = NULL;
        fe.dwAspect = DVASPECT_CONTENT;
        fe.lindex = -1;
        fe.tymed = TYMED_HGLOBAL;
        hr = pArg2->GetData(&fe, &stm);
        if(SUCCEEDED(hr))
        {
            LPDSOBJECTNAMES pdson = (LPDSOBJECTNAMES)GlobalLock(stm.hGlobal);

            if(pdson)
            {
                LPWSTR  pwszName = (LPWSTR)((LPBYTE)pdson + pdson->aObjects[0].offsetName);
                LPWSTR  pwszClass = (LPWSTR)((LPBYTE)pdson + pdson->aObjects[0].offsetClass);

                OutputDebugString(TEXT("\t"));
                OutputDebugStringW(pwszClass);
                OutputDebugString(TEXT(" - "));
                OutputDebugStringW(pwszName);
                OutputDebugString(TEXT("\n"));

                GlobalUnlock(stm.hGlobal);
            }

            ReleaseStgMedium(&stm);
        }
    }

    *puFlags = DSA_NOTIFY_FLAG_ADDITIONAL_DATA |
                DSA_NOTIFY_FLAG_FORCE_ADDITIONAL_DATA;

    WCHAR   wszTitle[MAX_PATH];
    LocalToWideChar(wszTitle, g_szMainTitle, MAX_PATH);
    *pBstr = SysAllocString(wszTitle);

    return *pBstr ? S_OK : E_OUTOFMEMORY;
}

STDMETHODIMP CAdminNotifyHandler::End ( void )

Definition at line 633 of file ADEvent.cpp.

{
    OutputDebugString(TEXT("CAdminNotifyHandler::End\n"));

    if(m_pdoFrom)
    {
        m_pdoFrom->Release();
        m_pdoFrom = NULL;
    }
    if(m_pdoTo)
    {
        m_pdoTo->Release();
        m_pdoTo = NULL;
    }

    return S_OK;
}

STDMETHODIMP CAdminNotifyHandler::Initialize | ( | IDataObject * | pExtraInfo,
 |  | ULONG * | puEventFlags
 | ) |  |

Definition at line 489 of file ADEvent.cpp.

{
    OutputDebugString(TEXT("CAdminNotifyHandler::Initialize\n"));

    if(IsBadWritePtr(puEventFlags, sizeof(ULONG)))
    {
        return E_INVALIDARG;
    }

    //Tell the host which events the handler wants to receive.
    *puEventFlags = DSA_NOTIFY_ALL;

    return S_OK;
}

STDMETHODIMP CAdminNotifyHandler::Notify | ( | ULONG | nItem,
 |  | ULONG | uFlags
 | ) |  |

Definition at line 620 of file ADEvent.cpp.

{
    OutputDebugString(TEXT("CAdminNotifyHandler::Notify\n"));

    return S_OK;
}

STDMETHODIMP CAdminNotifyHandler::QueryInterface | ( | REFIID | riid,
 |  | LPVOID FAR * | ppReturn
 | ) |  |

Definition at line 423 of file ADEvent.cpp.

{
    *ppReturn = NULL;

    //IUnknown
    if(IsEqualIID(riid, IID_IUnknown))
    {
        *ppReturn = (LPVOID)this;
    }

    //IDsAdminNotifyHandler
    if(IsEqualIID(riid, IID_IDsAdminNotifyHandler))
    {
        *ppReturn = (IDsAdminNotifyHandler*)this;
    }

    if(*ppReturn)
    {
        (*(LPUNKNOWN*)ppReturn)->AddRef();
        return S_OK;
    }

    return E_NOINTERFACE;
}

CAdminNotifyHandler::STDMETHOD_ | ( | DWORD | ,
 |  | Release |
 | ) |  |
CAdminNotifyHandler::STDMETHOD_ | ( | DWORD | ,
 |  | AddRef |
 | ) |  |

Member Data Documentation

DWORD CAdminNotifyHandler::m_ObjRefCount [protected]

Definition at line 63 of file adevent.h.

IDataObject* CAdminNotifyHandler::m_pdoFrom [protected]

Definition at line 64 of file adevent.h.

IDataObject* CAdminNotifyHandler::m_pdoTo [protected]

Definition at line 65 of file adevent.h.

The documentation for this class was generated from the following files:
  • NetDS/ADSI/samples/activedir/adevent/adevent.h
  • NetDS/ADSI/samples/activedir/adevent/ADEvent.cpp
Generated on Wed Nov 13 2024 16:55:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CADOComponent Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CADOComponent Class Reference

#include "adocomponent.h"

List of all members.

Public Member Functions

CADOComponent ()
STDMETHOD() | Activate ()
STDMETHOD() | SimpleQuery (VARIANT *returnval)
STDMETHOD_ (BOOL, CanBePooled)()
STDMETHOD_ (void, Deactivate)()

Public Attributes

CComPtr< IObjectContext > | m_spObjectContext

Detailed Description

Definition at line 31 of file adocomponent.h.

Constructor & Destructor Documentation

CADOComponent::CADOComponent ( ) [inline]

Definition at line 38 of file adocomponent.h.

  {
  }

Member Function Documentation

HRESULT CADOComponent::Activate ( void )

Definition at line 31 of file adocomponent.Cpp.

{
  HRESULT hr = CoGetObjectContext(IID_IObjectContext, (void**)&m_spObjectContext);
  if (SUCCEEDED(hr))
    return S_OK;
  return hr;
}

STDMETHODIMP CADOComponent::SimpleQuery ( VARIANT * returnval )

Definition at line 50 of file adocomponent.Cpp.

{
   _RecordsetPtr adoRs;

   _bstr_t Source("select au_fname from authors where au_lname = 'White'");
   //NOTE: Secure database installations should never have a blank password
   // Trusted security is recommended for production systems - this avoids
   // having to store the password in the code
   _bstr_t Connect("DSN=pubs;Uid=sa;Pwd=;Database=pubs");

   try
   {
      _variant_t InVar;

      adoRs.CreateInstance(__uuidof(Recordset));
      adoRs->Open( Source,
                Connect,
                adOpenForwardOnly,
        adLockReadOnly,
        adCmdText);
      InVar = adoRs->Fields->GetItem("au_fname")->Value;
      VariantClear(returnval);
      VariantCopy(returnval, &(InVar.Detach()));

      adoRs->Close();
   }

   catch(_com_error z)
   {
      if(adoRs)
    {
         adoRs->Close();
         adoRs = NULL;
    }

    if (m_spObjectContext)
      m_spObjectContext->SetAbort();
    return z.Error();
  }

   if (m_spObjectContext)
   {
    m_spObjectContext->SetComplete();
   }

   adoRs = NULL;
   return S_OK;
}

CADOComponent::STDMETHOD_ | ( | void | ,
 |  | Deactivate |
 | ) |  |
CADOComponent::STDMETHOD_ | ( | BOOL | ,
 |  | CanBePooled |
 | ) |  |

Member Data Documentation

CComPtr<IObjectContext> CADOComponent::m_spObjectContext

Definition at line 57 of file adocomponent.h.

The documentation for this class was generated from the following files:
  • Com/Services/Transaction/DataAccess/DataAcADO/adocomponent.h
  • Com/Services/Transaction/DataAccess/DataAcADO/adocomponent.Cpp
Generated on Wed Nov 13 2024 16:55:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CADQIApp Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CADQIApp Class Reference

#include "ADQI.h"

Inherits CWinApp.

List of all members.

Public Member Functions

CADQIApp ()
HRESULT | ADsOpenObject (LPWSTR pszPath, REFIID riid, void **pUnk)
virtual BOOL | InitInstance ()
void | SetCredentials (LPCTSTR pszUserName, DWORD dwFlag)

Protected Attributes

DWORD m_dwFlag
CComBSTR | m_sUserName

Detailed Description

Definition at line 23 of file ADQI.h.

Constructor & Destructor Documentation

CADQIApp::CADQIApp ( )

Definition at line 43 of file ADQI.cpp.

{
  m_dwFlag = 0;
  m_sUserName.Empty();
}

Member Function Documentation

HRESULT CADQIApp::ADsOpenObject | ( | LPWSTR | pszPath,
 |  | REFIID | riid,
 |  | void ** | pUnk
 | ) |  |

Definition at line 50 of file ADQI.cpp.

{

  if ( m_sUserName.Length() )
  {
    return ::ADsOpenObject( pszPath, m_sUserName, NULL, m_dwFlag, riid, pUnk );
  }
  else
  {
    return ADsGetObject( pszPath, riid, pUnk );
  }
}

BOOL CADQIApp::InitInstance ( void ) [virtual]

Reimplemented from CWinApp.

Definition at line 77 of file ADQI.cpp.

{
  // Standard initialization
  // If you are not using these features and wish to reduce the size
  //  of your final executable, you should remove from the following
  //  the specific initialization routines you do not need.

#ifdef _AFXDLL
  Enable3dControls();     // Call this when using MFC in a shared DLL
#else
  Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif

  CADQIDlg dlg;
  AfxOleInit();
  m_pMainWnd = &dlg;
  int nResponse = dlg.DoModal();
  if (nResponse == IDOK)
  {
  }
  else if (nResponse == IDCANCEL)
  {
  }

  // Since the dialog has been closed, return FALSE so that we exit the
  //  application, rather than start the application's message pump.
  return FALSE;
}

void CADQIApp::SetCredentials | ( | LPCTSTR | pszUserName,
 |  | DWORD | dwFlag
 | ) |  |

Definition at line 63 of file ADQI.cpp.

{
  m_sUserName = pszUserName;
  m_dwFlag    = dwFlag;

}

Member Data Documentation

DWORD CADQIApp::m_dwFlag [protected]

Definition at line 40 of file ADQI.h.

CComBSTR CADQIApp::m_sUserName [protected]

Definition at line 39 of file ADQI.h.

The documentation for this class was generated from the following files:
  • NetDS/ADSI/samples/General/ADQI/ADQI.h
  • NetDS/ADSI/samples/General/ADQI/ADQI.cpp
Generated on Wed Nov 13 2024 16:55:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CADQIDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes

CADQIDlg Class Reference

#include "ADQIDlg.h"

List of all members.

Public Types

enum | { IDD = IDD_ADQI_DIALOG }

Public Member Functions

CADQIDlg (CWnd *pParent=NULL)
void | EnumerateInterface ()

Public Attributes

CEdit | m_cADsPath
CListBox | m_cListIf
CButton | m_cOK
LPUNKNOWN | m_pUnk
CString m_sADsPath

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
virtual void | OnCancel ()
afx_msg void | OnChangeADsPath ()
afx_msg void | OnDblClkInterfaces ()
virtual BOOL | OnInitDialog ()
virtual void | OnOK ()
afx_msg void | OnPaint ()
afx_msg HCURSOR | OnQueryDragIcon ()

Protected Attributes

HICON | m_hIcon

Detailed Description

Definition at line 14 of file ADQIDlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 23 of file ADQIDlg.h.

{ IDD = IDD_ADQI_DIALOG };

Constructor & Destructor Documentation

CADQIDlg::CADQIDlg ( CWnd * pParent = NULL )

Definition at line 99 of file ADQIDlg.cpp.

  : CDialog(CADQIDlg::IDD, pParent)
{
  //{{AFX_DATA_INIT(CADQIDlg)
  m_sADsPath = _T("");
  //}}AFX_DATA_INIT
  // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
  m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
  m_pUnk = NULL;
}

Member Function Documentation

void CADQIDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 110 of file ADQIDlg.cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CADQIDlg)
  DDX_Control(pDX, IDC_INTERFACES, m_cListIf);
  DDX_Control(pDX, IDOK, m_cOK);
  DDX_Control(pDX, IDC_ADSPATH, m_cADsPath);
  DDX_Text(pDX, IDC_ADSPATH, m_sADsPath);
  //}}AFX_DATA_MAP
}

void CADQIDlg::EnumerateInterface ( )

Definition at line 240 of file ADQIDlg.cpp.

{
  int xx=0;
  HRESULT hr;
  LPUNKNOWN pQI;

  m_cListIf.ResetContent();

  ///////////////////////////////////////////////////////////////
  // Query Interface all known ADSI Interfaces
  ////////////////////////////////////////////////////////////////
  while( !IsEqualIID( *adsiIfs[xx].pIID, IID_NULL ) )
  {
    hr = m_pUnk->QueryInterface( *adsiIfs[xx].pIID, (void**) &pQI );
    if ( SUCCEEDED(hr) )
    {
      m_cListIf.AddString( adsiIfs[xx].szIf );
      pQI->Release();
    }
    xx++;
  }

}

void CADQIDlg::OnCancel ( ) [protected, virtual]

Definition at line 235 of file ADQIDlg.cpp.

{
  CDialog::OnCancel();
}

void CADQIDlg::OnChangeADsPath ( ) [protected]

Definition at line 226 of file ADQIDlg.cpp.

{
  BOOL bEnabled;
  bEnabled = m_cADsPath.GetWindowTextLength() > 0 ? TRUE : FALSE;

  m_cOK.EnableWindow( bEnabled );

}

void CADQIDlg::OnDblClkInterfaces ( ) [protected]

Definition at line 266 of file ADQIDlg.cpp.

{
  CString s;
  int xx=0;
  int idx;
  IUnknown *pNewUnk = NULL;

  idx = m_cListIf.GetCurSel();
  if ( idx == LB_ERR )
  {
    MessageBeep(0);
    return;
  }

  CWaitCursor wait;
  m_cListIf.GetText( idx, s );

  //////////////////////////////////////////////////////////////
  //
  // Find the appropriate dialog box to display
  //
  /////////////////////////////////////////////////////////////////
  while( !IsEqualIID( *adsiIfs[xx].pIID, IID_NULL ) && s != adsiIfs[xx].szIf  )
  {
    xx++;
  }

  ASSERT( !IsEqualIID( *adsiIfs[xx].pIID, IID_NULL ) );
  if ( adsiIfs[xx].pFn )
  {
    m_pUnk->AddRef();
    (*adsiIfs[xx].pFn)( m_pUnk, &pNewUnk );
  }
  else
  {
     wait.Restore();
     AfxMessageBox(_T("No UI implemented yet"));
  }

  ////////////////////////////////////////////////////
  // if IADsOpenObject is selected, special care
  ///////////////////////////////////////////////////
  if ( pNewUnk )
  {

    HRESULT hr;
    BSTR  bstr;
    IADs  *pADs;

    hr = pNewUnk->QueryInterface( IID_IADs, (void**) &pADs );
    if ( SUCCEEDED(hr) )
    {
      pADs->get_ADsPath( &bstr );
    }
    pADs->Release();

    m_sADsPath = bstr;
    SysFreeString( bstr );

    m_pUnk->Release(); // old ads iunknown path;
    m_pUnk = pNewUnk;

    UpdateData(FALSE);
    EnumerateInterface();

  }

}

BOOL CADQIDlg::OnInitDialog ( ) [protected, virtual]

Definition at line 133 of file ADQIDlg.cpp.

{
  CDialog::OnInitDialog();
  OnChangeADsPath();

  // Set the icon for this dialog.  The framework does this automatically
  //  when the application's main window is not a dialog
  SetIcon(m_hIcon, TRUE);     // Set big icon
  SetIcon(m_hIcon, FALSE);    // Set small icon

  return TRUE;  // return TRUE  unless you set the focus to a control
}

void CADQIDlg::OnOK ( ) [protected, virtual]

Definition at line 186 of file ADQIDlg.cpp.

{

  HRESULT   hr;
  CWaitCursor wait;
  IUnknown *pSave = NULL;

  UpdateData( TRUE );

  if ( m_pUnk )
  {
    pSave = m_pUnk; // save it first
  }

  USES_CONVERSION;
  hr = App->ADsOpenObject(T2OLE(m_sADsPath), IID_IUnknown, (void**) &m_pUnk );

  if ( !SUCCEEDED(hr) )
  {
     AfxMessageBox(GetErrorMessage(hr));
     m_pUnk = NULL;
     return;
  }

  if ( pSave ) // release the previous pointer
  {
    pSave->Release();

  }

  EnumerateInterface();

}

void CADQIDlg::OnPaint ( void ) [protected]

Definition at line 154 of file ADQIDlg.cpp.

{
  if (IsIconic())
  {
    CPaintDC dc(this); // device context for painting

    SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

    // Center icon in client rectangle
    int cxIcon = GetSystemMetrics(SM_CXICON);
    int cyIcon = GetSystemMetrics(SM_CYICON);
    CRect rect;
    GetClientRect(&rect);
    int x = (rect.Width() - cxIcon + 1) / 2;
    int y = (rect.Height() - cyIcon + 1) / 2;

    // Draw the icon
    dc.DrawIcon(x, y, m_hIcon);
  }
  else
  {
    CDialog::OnPaint();
  }
}

HCURSOR CADQIDlg::OnQueryDragIcon ( ) [protected]

Definition at line 181 of file ADQIDlg.cpp.

{
  return (HCURSOR) m_hIcon;
}

Member Data Documentation

CEdit CADQIDlg::m_cADsPath

Definition at line 26 of file ADQIDlg.h.

CListBox CADQIDlg::m_cListIf

Definition at line 24 of file ADQIDlg.h.

CButton CADQIDlg::m_cOK

Definition at line 25 of file ADQIDlg.h.

HICON CADQIDlg::m_hIcon [protected]

Definition at line 39 of file ADQIDlg.h.

LPUNKNOWN CADQIDlg::m_pUnk

Definition at line 28 of file ADQIDlg.h.

CString CADQIDlg::m_sADsPath

Definition at line 27 of file ADQIDlg.h.

The documentation for this class was generated from the following files:
  • NetDS/ADSI/samples/General/ADQI/ADQIDlg.h
  • NetDS/ADSI/samples/General/ADQI/ADQIDlg.cpp
Generated on Wed Nov 13 2024 16:55:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CADsFirstExtApp Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CADsFirstExtApp Class Reference

Inherits CWinApp, and CWinApp.

List of all members.

Public Member Functions

virtual int | ExitInstance ()
virtual int | ExitInstance ()
virtual BOOL | InitInstance ()
virtual BOOL | InitInstance ()

Detailed Description

Definition at line 23 of file ADsFirstExt.cpp.

Member Function Documentation

int CADsFirstExtApp::ExitInstance ( void ) [virtual]

Reimplemented from CWinApp.

Definition at line 61 of file ADsFirstExt.cpp.

{
    _Module.Term();
    return CWinApp::ExitInstance();
}

virtual int CADsFirstExtApp::ExitInstance ( ) [virtual]

Reimplemented from CWinApp.

virtual BOOL CADsFirstExtApp::InitInstance ( ) [virtual]

Reimplemented from CWinApp.

BOOL CADsFirstExtApp::InitInstance ( void ) [virtual]

Reimplemented from CWinApp.

Definition at line 55 of file ADsFirstExt.cpp.

{
    _Module.Init(ObjectMap, m_hInstance, &LIBID_ADSFIRSTEXTLib);
    return CWinApp::InitInstance();
}

The documentation for this class was generated from the following files:
  • NetDS/ADSI/samples/Extension/tutorial/step1/ADsFirstExt.cpp
  • NetDS/ADSI/samples/Extension/tutorial/step2/ADsFirstExt.cpp
Generated on Wed Nov 13 2024 16:55:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CADsSearch Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CADsSearch Class Reference

#include "DirectorySearch.h"

List of all members.

Public Member Functions

CADsSearch (IADs *pADs)
CADsSearch ()
virtual | ~CADsSearch ()
void | AddColumn (LPCTSTR pszColumn)
HRESULT | AddSearchPref (PADS_SEARCHPREF_INFO pSearchPrefs, DWORD dwNumPref=1)
HRESULT | Execute (LPCTSTR pszFilter)
PADS_SEARCHPREF_INFO | FindSearchPrefence (ADS_SEARCHPREF pref)
HRESULT | FormatColumn (PADS_SEARCH_COLUMN pColumn, CStringList &sList)
HRESULT | FreeColumn (PADS_SEARCH_COLUMN pCol)
HRESULT | GetColumn (LPCTSTR pszCol, PADS_SEARCH_COLUMN pCol)
HRESULT | GetColumn (CString &s, CStringList &sList)
HRESULT | GetColumn (UINT nIndex, CStringList &sList)
HRESULT | GetNextRow ()
IDirectorySearch * | GetSearchIf ()
void | ResetSearchPref ()
HRESULT | SetAttribOnly (BOOL bAttribOnly=TRUE)
HRESULT | SetInterface (IUnknown *pUnk)
HRESULT | SetPageSize (UINT nPageSize)
HRESULT | SetScope (ADS_SCOPEENUM flag)
HRESULT | SetSearchLevel (int flag)

Protected Attributes

DWORD m_dwPrefCount
ADS_SEARCH_HANDLE | m_hSearch
IDirectorySearch * | m_pSearch
CStringList | m_sColumnList
ADS_SEARCHPREF_INFO | m_srchInfo [MAX_SEARCH_PREF]

Detailed Description

Definition at line 71 of file DirectorySearch.h.

Constructor & Destructor Documentation

CADsSearch::CADsSearch ( IADs * pADs )

Definition at line 669 of file DirectorySearch.cpp.

{
  CADsSearch();
  SetInterface( pADs );

}

CADsSearch::CADsSearch ( )

Definition at line 676 of file DirectorySearch.cpp.

{
   m_pSearch = NULL;
   m_hSearch = NULL;
   m_dwPrefCount = 0;

}

CADsSearch::~CADsSearch ( ) [virtual]

Definition at line 719 of file DirectorySearch.cpp.

{
  if ( m_pSearch )
  {
    if ( m_hSearch )
    {
      m_pSearch->CloseSearchHandle( m_hSearch );
    }
    m_pSearch->Release();
  }
}

Member Function Documentation

void CADsSearch::AddColumn ( LPCTSTR pszColumn )

Definition at line 742 of file DirectorySearch.cpp.

{
  ASSERT( pszColumn );

  m_sColumnList.AddTail( pszColumn );
}

HRESULT CADsSearch::AddSearchPref | ( | PADS_SEARCHPREF_INFO | pSearchPrefs,
 |  | DWORD | dwNumPref = 1
 | ) |  |

Definition at line 796 of file DirectorySearch.cpp.

{
  PADS_SEARCHPREF_INFO pInfo;

  for( UINT idx=0; idx < dwNumPref; idx++ )
  {
    pInfo = FindSearchPrefence( pSearchPrefs->dwSearchPref );
    if ( pInfo )
    {
      *(pInfo) = *(pSearchPrefs);
    }
    else
    {
      if ( m_dwPrefCount == MAX_SEARCH_PREF )
      {
        return E_FAIL;
      }

      m_srchInfo[m_dwPrefCount] = *(pSearchPrefs);
      m_dwPrefCount++;
    }

    pSearchPrefs++;
  }
  return S_OK;
}

HRESULT CADsSearch::Execute ( LPCTSTR pszFilter )

Definition at line 836 of file DirectorySearch.cpp.

{
  USES_CONVERSION;
  HRESULT hr;

  if ( !m_pSearch  )
  {
    return E_UNEXPECTED;
  }

  m_hSearch = NULL;

  //////////////////////////////////////////////
  // Set the search preference if any
  ///////////////////////////////////////////////
  if ( m_dwPrefCount )
  {
    hr = m_pSearch->SetSearchPreference( m_srchInfo, m_dwPrefCount);
    if ( !SUCCEEDED(hr) )
    {
      return hr;
    }
  }

  if ( m_sColumnList.IsEmpty() )
  {
    hr = m_pSearch->ExecuteSearch( T2OLE(pszFilter), NULL, -1, &m_hSearch );
  }
  else // Columns is specified
  {
    unsigned int count, xx;
    LPWSTR    *pColumns = NULL;
    POSITION  pos;
    CString   s;

    count = m_sColumnList.GetCount();
    pColumns = (LPWSTR*)AllocADsMem( sizeof(LPWSTR)*count);
    pos = m_sColumnList.GetHeadPosition();
    for(xx=0; xx < count; xx++)
    {
      s = m_sColumnList.GetAt(pos);
      pColumns[xx] = T2OLE(s);
      m_sColumnList.GetNext(pos);
    }

    hr = m_pSearch->ExecuteSearch( T2OLE(pszFilter), pColumns, count, &m_hSearch );
    if ( pColumns )
    {
      FreeADsMem( pColumns );
    }

  }

  return hr;

}

PADS_SEARCHPREF_INFO CADsSearch::FindSearchPrefence ( ADS_SEARCHPREF pref )

Definition at line 823 of file DirectorySearch.cpp.

{
  for(UINT idx=0; idx < MAX_SEARCH_PREF; idx++ )
  {
      if( m_srchInfo[idx].dwSearchPref == pref )
    {
       return &m_srchInfo[idx];
    }
  }

  return NULL;
}

HRESULT CADsSearch::FormatColumn | ( | PADS_SEARCH_COLUMN | pColumn,
 |  | CStringList & | sList
 | ) |  |

Definition at line 965 of file DirectorySearch.cpp.

{

  ADsToStringList( pColumn->pADsValues, pColumn->dwNumValues, sList );
    return S_OK;

}

HRESULT CADsSearch::FreeColumn ( PADS_SEARCH_COLUMN pCol )

Definition at line 931 of file DirectorySearch.cpp.

{
   return m_pSearch->FreeColumn( pCol );
}

HRESULT CADsSearch::GetColumn | ( | CString & | s,
 |  | CStringList & | sList
 | ) |  |

Definition at line 938 of file DirectorySearch.cpp.

{
   LPWSTR pszAttrName;
   ADS_SEARCH_COLUMN col;
   HRESULT hr;
   USES_CONVERSION;
   CString s;

   pszAttrName = T2OLE(sCol);

   hr = m_pSearch->GetColumn( m_hSearch, pszAttrName, &col );

   if ( !SUCCEEDED(hr) )
   {
     return hr;
   }

   hr =  FormatColumn( &col, sList );
   m_pSearch->FreeColumn( &col );

   return hr;

}

HRESULT CADsSearch::GetColumn | ( | LPCTSTR | pszCol,
 |  | PADS_SEARCH_COLUMN | pCol
 | ) |  |

Definition at line 920 of file DirectorySearch.cpp.

{
   LPWSTR pszAttrName;
   USES_CONVERSION;

   pszAttrName = T2OLE(pszCol);

   return m_pSearch->GetColumn( m_hSearch, pszAttrName, pCol );

}

HRESULT CADsSearch::GetColumn | ( | UINT | nIndex,
 |  | CStringList & | sList
 | ) |  |

Definition at line 897 of file DirectorySearch.cpp.

{
  CString s;

  if ( m_sColumnList.IsEmpty() )
  {
    return E_FAIL;
  }

  POSITION pos;
  pos = m_sColumnList.FindIndex( nIndex );

  if ( pos == NULL )
  {
    return E_FAIL;
  }

  s = m_sColumnList.GetAt(pos);
  return GetColumn( s, sList );

}

HRESULT CADsSearch::GetNextRow ( )

Definition at line 731 of file DirectorySearch.cpp.

{
  HRESULT hr;
  if ( !m_pSearch || !m_hSearch)
  {
    return E_UNEXPECTED;
  }
  hr = m_pSearch->GetNextRow( m_hSearch );
  return hr;
}

IDirectorySearch* CADsSearch::GetSearchIf ( ) [inline]

Definition at line 99 of file DirectorySearch.h.

{ m_pSearch->AddRef(); return m_pSearch; }

void CADsSearch::ResetSearchPref ( ) [inline]

Definition at line 96 of file DirectorySearch.h.

{ m_dwPrefCount=0; }

HRESULT CADsSearch::SetAttribOnly ( BOOL bAttribOnly = TRUE )

Definition at line 769 of file DirectorySearch.cpp.

{
  ADS_SEARCHPREF_INFO info;

  info.dwSearchPref = ADS_SEARCHPREF_ATTRIBTYPES_ONLY;
    info.vValue.dwType = ADSTYPE_BOOLEAN;
    info.vValue.Integer = bAttribOnly;

  return AddSearchPref( &info );

}

HRESULT CADsSearch::SetInterface ( IUnknown * pUnk )

Definition at line 686 of file DirectorySearch.cpp.

{
  if ( pUnk != NULL )
  {
    HRESULT hr;
    //////////////////////////////////////////
    // Remove the current search if any
    ////////////////////////////////////////
    if ( m_pSearch )
    {
      if ( m_hSearch )
      {
        m_pSearch->CloseSearchHandle( m_hSearch );
      }
      m_pSearch->Release();
    }

    m_pSearch = NULL;
    m_hSearch = NULL;
    m_dwPrefCount = 0;
    hr = pUnk->QueryInterface( IID_IDirectorySearch, (LPVOID*) &m_pSearch );
    pUnk->Release();
    return hr;
  }

  return E_UNEXPECTED;

}

HRESULT CADsSearch::SetPageSize ( UINT nPageSize )

Definition at line 781 of file DirectorySearch.cpp.

{
  ADS_SEARCHPREF_INFO info;

  info.dwSearchPref = ADS_SEARCHPREF_PAGESIZE;
    info.vValue.dwType = ADSTYPE_INTEGER;
    info.vValue.Integer = nPageSize;

  return AddSearchPref( &info );
}

HRESULT CADsSearch::SetScope ( ADS_SCOPEENUM flag )

Definition at line 750 of file DirectorySearch.cpp.

{

  if ( !m_pSearch )
  {
    return E_UNEXPECTED;
  }

  ADS_SEARCHPREF_INFO info;

  info.dwSearchPref = ADS_SEARCHPREF_SEARCH_SCOPE;
  info.vValue.dwType = ADSTYPE_INTEGER;
  info.vValue.Integer = flag;
  return AddSearchPref( &info );

}

HRESULT CADsSearch::SetSearchLevel ( int flag )

Member Data Documentation

DWORD CADsSearch::m_dwPrefCount [protected]

Definition at line 107 of file DirectorySearch.h.

ADS_SEARCH_HANDLE CADsSearch::m_hSearch [protected]

Definition at line 105 of file DirectorySearch.h.

IDirectorySearch* CADsSearch::m_pSearch [protected]

Definition at line 104 of file DirectorySearch.h.

CStringList CADsSearch::m_sColumnList [protected]

Definition at line 108 of file DirectorySearch.h.

ADS_SEARCHPREF_INFO CADsSearch::m_srchInfo[MAX_SEARCH_PREF] [protected]

Definition at line 106 of file DirectorySearch.h.

The documentation for this class was generated from the following files:
  • NetDS/ADSI/samples/General/ADQI/DirectorySearch.h
  • NetDS/ADSI/samples/General/ADQI/DirectorySearch.cpp
Generated on Wed Nov 13 2024 16:55:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CADVCGENApp Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CADVCGENApp Class Reference

#include "advcgen.h"

Inherits CWinApp.

List of all members.

Public Member Functions

CADVCGENApp ()
virtual BOOL InitInstance ()

Detailed Description

Definition at line 22 of file advcgen.h.

Constructor & Destructor Documentation

CADVCGENApp::CADVCGENApp ( )

Definition at line 28 of file advcgen.cpp.

{
  // TODO: add construction code here,
  // Place all significant initialization in InitInstance
}

Member Function Documentation

BOOL CADVCGENApp::InitInstance ( void ) [virtual]

Reimplemented from CWinApp.

Definition at line 42 of file advcgen.cpp.

{
  AfxEnableControlContainer();

  // Standard initialization
  // If you are not using these features and wish to reduce the size
  //  of your final executable, you should remove from the following
  //  the specific initialization routines you do not need.

#ifdef _AFXDLL
  Enable3dControls();     // Call this when using MFC in a shared DLL
#else
  Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif

  CADVCGENDlg dlg;
  m_pMainWnd = &dlg;
  int nResponse = dlg.DoModal();
  if (nResponse == IDOK)
  {
    // TODO: Place code here to handle when the dialog is
    //  dismissed with OK
  }
  else if (nResponse == IDCANCEL)
  {
    // TODO: Place code here to handle when the dialog is
    //  dismissed with Cancel
  }

  // Since the dialog has been closed, return FALSE so that we exit the
  //  application, rather than start the application's message pump.
  return FALSE;
}

The documentation for this class was generated from the following files:
  • Dataaccess/ADO/ADOVCGEN/advcgen.h
  • Dataaccess/ADO/ADOVCGEN/advcgen.cpp
Generated on Wed Nov 13 2024 16:55:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CADVCGENDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes

CADVCGENDlg Class Reference

#include "advcgendlg.h"

List of all members.

Public Types

enum | { IDD = IDD_ADVCGEN_DIALOG }

Public Member Functions

CADVCGENDlg (CWnd *pParent=NULL)
~CADVCGENDlg ()
void | DataRefresh (BOOL bflag)
void | OutputIntoDataGrid (char *buffer)
void | RestrictionsOnOpenSchema (_variant_t &restrictions, int lenCtr, _variant_t *criteriaValues)
_bstr_t | VarToBstr (_variant_t varT)

Public Attributes

ado20::_ConnectionPtr | conn
_bstr_t | connStr
ado20::_RecordsetPtr | dataRs
HRESULT | hr
CDataGrid m_DataGridDisplay
CButton | m_SchemaInfo
CEdit | m_SQLEditBox
CListBox | m_TableListBox
ado20::_RecordsetPtr | schemaRs

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
afx_msg void | OnBuild ()
afx_msg void | OnChangeTableList ()
afx_msg void | OnExit ()
virtual BOOL | OnInitDialog ()
afx_msg void | OnPaint ()
afx_msg HCURSOR | OnQueryDragIcon ()
afx_msg void | OnSysCommand (UINT nID, LPARAM lParam)
afx_msg void | OnXecute ()

Protected Attributes

HICON | m_hIcon

Detailed Description

Definition at line 18 of file advcgendlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 40 of file advcgendlg.h.

{ IDD = IDD_ADVCGEN_DIALOG };

Constructor & Destructor Documentation

CADVCGENDlg::CADVCGENDlg ( CWnd * pParent = NULL )

Definition at line 62 of file advcgendlg.cpp.

  : CDialog(CADVCGENDlg::IDD, pParent)
{
  //{{AFX_DATA_INIT(CADVCGENDlg)
  //}}AFX_DATA_INIT
  // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
  schemaRs = NULL; // Schema Recordset Object
    dataRs = NULL;  // Data Recordset Object
  conn = NULL;
  m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

CADVCGENDlg::~CADVCGENDlg ( )

Definition at line 75 of file advcgendlg.cpp.

{
  //{{AFX_DATA_INIT(CADVCGENDlg)
  //}}AFX_DATA_INIT
  // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
  if (schemaRs != NULL) // Schema Recordset Object
  {
    if(schemaRs->State != ado20::adStateOpen)
      schemaRs->Close();
    schemaRs.Release();
    schemaRs=NULL;
  }
    if (dataRs != NULL)  // Data Recordset Object
  {
    if(dataRs->State != ado20::adStateOpen)
      dataRs->Close();
    dataRs.Release();
    dataRs = NULL;
  }
  if(conn != NULL)
  {
    if(conn->State != ado20::adStateOpen)
      conn->Close();
    conn.Release();
    conn = NULL;
  }
}

Member Function Documentation

void CADVCGENDlg::DataRefresh ( BOOL bflag )

Definition at line 473 of file advcgendlg.cpp.

{
  m_SQLEditBox.EnableWindow(bflag); // enable the SQL statement Edit Box
  m_TableListBox.EnableWindow(bflag); // The Select Table ListBox...
  (GetDlgItem(IDC_DATAGRID1))->EnableWindow(bflag); // The Datagrid
  (GetDlgItem(IDC_BUTTON2))->EnableWindow(bflag); // The Xeceute Button
  (GetDlgItem(ID_REFRESH))->EnableWindow(bflag); // The Refresh Button
  UpdateData();
}

void CADVCGENDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 104 of file advcgendlg.cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CADVCGENDlg)
  DDX_Control(pDX, IDC_DATAGRID1, m_DataGridDisplay);
  DDX_Control(pDX, IDC_TABLELIST, m_TableListBox);
  DDX_Control(pDX, IDC_CHECK1, m_SchemaInfo);
  DDX_Control(pDX, IDC_EDIT1, m_SQLEditBox);
  //}}AFX_DATA_MAP
}

void CADVCGENDlg::OnBuild ( ) [protected]

Definition at line 223 of file advcgendlg.cpp.

{

  TRYDB;
  try
  {
    // The the Smart Pointer
    msdasc::IDataSourceLocatorPtr pOledb;  // Interface to show
    //Get the m_pInterface pointer to the DataLinks COM Object
    pOledb.CreateInstance(__uuidof(msdasc::DataLinks));  // coclass of IDataSourceLocatorPtr
    // Get the Connection
//    if (conn != NULL)  // It contains data release it first
//      conn->Close();
    conn = (ado20::_ConnectionPtr) pOledb->PromptNew();

    connStr = (char*) conn->ConnectionString;
    TRACE("ADO Connection string is %s\n",(char*) conn->ConnectionString);
    TRACE("ADO Version is %s\n",(char*) conn->Version);
    SetDlgItemText(IDC_CONNECTSTRING,(LPCTSTR) conn->ConnectionString);
    UpdateData();
    // Set The cursor before the Open !!!
    //conn->CursorLocation = ado20::adUseClient;
    if(conn->State != ado20::adStateOpen)
      conn->Open(L"",L"",L"",-1);

//////////////////////////////////////////////////////////////////////////////
    // How to create restrictions
    // Pass it the right info
    // rs now contains all the data...
    // To selectively get Table data only...
    ///////////////////////////////////////////////////////////////
    _variant_t restrictions;
    // For adSchemaTable
    int lenCtr=4;
    _variant_t criteriaValues[4];
    criteriaValues[0].vt = VT_EMPTY;
    criteriaValues[1].vt = VT_EMPTY;
    criteriaValues[2].vt = VT_EMPTY;
    criteriaValues[3].vt = VT_BSTR;
    criteriaValues[3].bstrVal = (BSTR)_bstr_t("TABLE");
    RestrictionsOnOpenSchema(restrictions,lenCtr, criteriaValues);
    // If it contained previous data
    if (schemaRs != NULL)
    {
      schemaRs->putref_ActiveConnection(NULL);
      schemaRs->Close();
    }

    schemaRs = conn->OpenSchema(ado20::adSchemaTables,&restrictions);
    if(schemaRs->State == ado20::adStateOpen)
    {
      schemaRs->MoveFirst();
      m_TableListBox.ResetContent();
      while(!schemaRs->EOF)
      {
      if(m_SchemaInfo.GetCheck() == TRUE)
        {
          m_TableListBox.AddString(VarToBstr(schemaRs->Fields->Item[1L]->Value)+  // The Schema Name
            _bstr_t(".")+                       // "."
            VarToBstr(schemaRs->Fields->Item[2L]->Value));          // The Table Name
        }
        else
          m_TableListBox.AddString(VarToBstr(schemaRs->Fields->Item[2L]->Value));
        hr = schemaRs->MoveNext();
      }
      TRACE( "Found %lu records.\n", schemaRs->RecordCount );
      m_DataGridDisplay.SetRefDataSource( NULL);
      m_DataGridDisplay.ClearFields();
      m_DataGridDisplay.Refresh();
      ////////////////////////////////////////////////////
      // Enable Disabled Controls...
      SetDlgItemText(IDC_CONNECTSTRING,(LPCTSTR) conn->ConnectionString);
      DataRefresh(TRUE);
    }
    else
      MessageBox("Could not open the Schema Information", "Error",MB_OK);
  }
  catch (_com_error &ce)
  {
    CString adoStr,msgStr,tempStr;
    //
    // Trace COM error information.
    //
    adoStr=_T("");
    TRACE( "\nCom Exception Information\n-----------------------------------------------\n" );
    TRACE( "Description : %s\n",   (char*) ce.Description()  );
    TRACE( "Message     : %s\n",   (char*) ce.ErrorMessage() );
    TRACE( "HResult     : 0x%08x\n", ce.Error() );
    //
    // Trace ADO exception information only if connection is not null.
    //
    if ( NULL != conn )
    {
      TRACE( "\nADO Exception Information\n-----------------------------------------------\n" );
      ado20::ErrorPtr err;
      for ( long i=0; i<conn->Errors->Count; i++ )
      {
        tempStr=_T("");
        err = conn->Errors->Item[i];
        TRACE( "Number      : 0x%08x\n", err->Number );
        TRACE( "Description : %s\n",    (char*) err->Description );
        TRACE( "SQLState    : %s\n",     (char*) err->SQLState );
        TRACE( "Source      : %s\n\n",   (char*) err->Source );
        tempStr.Format("Ado Exception :\n===============\nDescription : %s\nSource : %s\n",(char*) err->Description,(char*) err->Source);
        adoStr += tempStr;
      }
    }
    msgStr.Format("\tCom Exception :\n===============\nDescription : %s\nMessage     : %s\n\t%s",(char*) ce.Description(),(char*) ce.ErrorMessage(), (LPCTSTR) adoStr);
    this->MessageBox(msgStr,"Error Message", MB_OK);
  }
  CATCHDB;
}

void CADVCGENDlg::OnChangeTableList ( ) [protected]

Definition at line 380 of file advcgendlg.cpp.

{
  CString buff1,buffer;
  // Get the table name
  TRYDB
  m_TableListBox.GetText(m_TableListBox.GetCurSel(), buffer);
  // Create connection object.
  if (buffer.Find(" ") == -1)
    buff1.Format("SELECT * FROM %s",buffer,buffer);
  else
    buff1.Format("SELECT * FROM [%s]",buffer,buffer);
  OutputIntoDataGrid((char *) _bstr_t(buff1));
  m_SQLEditBox.SetWindowText(buff1);
  CATCHDB
}

void CADVCGENDlg::OnExit ( ) [protected]

Definition at line 372 of file advcgendlg.cpp.

{
  TRYDB
  if (MessageBox("Thanx for using ADVCGEN...","Exit",MB_OK) == IDOK)
    DestroyWindow();
  CATCHDB
}

BOOL CADVCGENDlg::OnInitDialog ( ) [protected, virtual]

Definition at line 130 of file advcgendlg.cpp.

{
  CDialog::OnInitDialog();

  // Add "About..." menu item to system menu.

  // IDM_ABOUTBOX must be in the system command range.
  ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
  ASSERT(IDM_ABOUTBOX < 0xF000);

  CMenu* pSysMenu = GetSystemMenu(FALSE);
  if (pSysMenu != NULL)
  {
    CString strAboutMenu;
    strAboutMenu.LoadString(IDS_ABOUTBOX);
    if (!strAboutMenu.IsEmpty())
    {
      pSysMenu->AppendMenu(MF_SEPARATOR);
      pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
    }
  }

  // Set the icon for this dialog.  The framework does this automatically
  //  when the application's main window is not a dialog
  SetIcon(m_hIcon, TRUE);     // Set big icon
  SetIcon(m_hIcon, FALSE);    // Set small icon

  // TODO: Add extra initialization here

  return TRUE;  // return TRUE  unless you set the focus to a control
}

void CADVCGENDlg::OnPaint ( void ) [protected]

Definition at line 179 of file advcgendlg.cpp.

{
  if (IsIconic())
  {
    CPaintDC dc(this); // device context for painting

    SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

    // Center icon in client rectangle
    int cxIcon = GetSystemMetrics(SM_CXICON);
    int cyIcon = GetSystemMetrics(SM_CYICON);
    CRect rect;
    GetClientRect(&rect);
    int x = (rect.Width() - cxIcon + 1) / 2;
    int y = (rect.Height() - cyIcon + 1) / 2;

    // Draw the icon
    dc.DrawIcon(x, y, m_hIcon);
  }
  else
  {
    CDialog::OnPaint();
  }
}

HCURSOR CADVCGENDlg::OnQueryDragIcon ( ) [protected]

Definition at line 206 of file advcgendlg.cpp.

{
  return (HCURSOR) m_hIcon;
}

void CADVCGENDlg::OnSysCommand | ( | UINT | nID,
 |  | LPARAM | lParam |
 | ) |  |  | [protected]

Definition at line 162 of file advcgendlg.cpp.

{
  if ((nID & 0xFFF0) == IDM_ABOUTBOX)
  {
    CAboutDlg dlgAbout;
    dlgAbout.DoModal();
  }
  else
  {
    CDialog::OnSysCommand(nID, lParam);
  }
}

void CADVCGENDlg::OnXecute ( ) [protected]

Definition at line 211 of file advcgendlg.cpp.

{
  char buffer[MAX_COUNT];
  CString buff1;
  // Get the SQL Statement
  TRYDB
  m_SQLEditBox.GetWindowText(buffer,MAX_COUNT);
  if(strlen(buffer) > 0)
    OutputIntoDataGrid(buffer);
  CATCHDB
}

void CADVCGENDlg::OutputIntoDataGrid ( char * buffer )

Definition at line 396 of file advcgendlg.cpp.

{
  _variant_t vra; // Dummy Rows affected variant

  TRYDB
  try
  {
    TRACE( "Instantiating ado connection object...\n" );
    // Remember INSERT, Update, Delete commands do not return recordsets
    if(dataRs == NULL) // Create it only for the 1st time
      hr = dataRs.CreateInstance(__uuidof(ado20::Recordset));
    else
    {
      dataRs->putref_ActiveConnection(NULL);
      if(dataRs->State == ado20::adStateOpen)
        dataRs->Close();
      m_DataGridDisplay.ClearFields();
      m_DataGridDisplay.SetRefDataSource(NULL);
    }
    dataRs->putref_ActiveConnection(conn);
    hr = dataRs->Open(_bstr_t(buffer),_variant_t((IDispatch*) conn), ado20::adOpenStatic,ado20::adLockOptimistic,ado20::adCmdText);
    if (SUCCEEDED(hr))
    {
      // Only for select statements do the following
      if(dataRs->State == ado20::adStateOpen)
      {
        TRACE( "Found %lu records.\n", dataRs->RecordCount );
        if(dataRs->RecordCount > 0 )
        {
          m_DataGridDisplay.ClearFields();
          m_DataGridDisplay.SetRefDataSource( (IUnknownPtr) dataRs);
        }
        else
          MessageBox("No Records found !!", "Error", MB_OK);
        UpdateData();
      }
    }
    else
      MessageBox("Could not Open the Query !!", "Error", MB_OK);
  }
  catch (_com_error &ce)
  {
    CString adoStr,msgStr,tempStr;
    //
    // Trace COM error information.
    //
    adoStr=_T("");
    TRACE( "\nCom Exception Information\n-----------------------------------------------\n" );
    TRACE( "Description : %s\n",   (char*) ce.Description()  );
    TRACE( "Message     : %s\n",   (char*) ce.ErrorMessage() );
    TRACE( "HResult     : 0x%08x\n", ce.Error() );
    //
    // Trace ADO exception information only if connection is not null.
    //
    if ( NULL != conn )
    {
      TRACE( "\nADO Exception Information\n-----------------------------------------------\n" );
      ado20::ErrorPtr err;
      for ( long i=0; i<conn->Errors->Count; i++ )
      {
        tempStr=_T("");
        err = conn->Errors->Item[i];
        TRACE( "Number      : 0x%08x\n", err->Number );
        TRACE( "Description : %s\n",    (char*) err->Description );
        TRACE( "SQLState    : %s\n",     (char*) err->SQLState );
        TRACE( "Source      : %s\n\n",   (char*) err->Source );
        tempStr.Format("Ado Exception :\n===============\nDescription : %s\nSource : %s\n",(char*) err->Description,(char*) err->Source);
        adoStr += tempStr;
      }
    }
    msgStr.Format("Com Exception :\n===============\nDescription : %s\nMessage     : %s\n%s",(char*) ce.Description(),(char*) ce.ErrorMessage(), (LPCTSTR) adoStr);
    MessageBox(msgStr,"Error Message", MB_OK);
  }
  CATCHDB

}

void CADVCGENDlg::RestrictionsOnOpenSchema | ( | _variant_t & | restrictions,
 |  | int | lenCtr,
 |  | _variant_t * | criteriaValues
 | ) |  |

Definition at line 351 of file advcgendlg.cpp.

{
   HRESULT hr = 0;
   SAFEARRAY FAR* psa;
   SAFEARRAYBOUND rgsabound[1];
   rgsabound[0].lLbound = 0;
   rgsabound[0].cElements = lenCtr;

   TRYDB
   psa = SafeArrayCreate(VT_VARIANT, 1, rgsabound);
   // Fill the safe array.
   for( long lIndex = 0 ; lIndex < lenCtr ;lIndex++)
   {
     hr  = SafeArrayPutElement(psa, &lIndex,&criteriaValues[lIndex]);
   }
   // Initialize the safearray.
   restrictions.vt = VT_VARIANT | VT_ARRAY;
   V_ARRAY(&restrictions) = psa;
   CATCHDB
}

_bstr_t CADVCGENDlg::VarToBstr ( _variant_t varT )

Definition at line 336 of file advcgendlg.cpp.

{
  TRYDB
  switch(varT.vt)
  {
  case VT_EMPTY: return _bstr_t("Empty");
  case VT_NULL: return _bstr_t("<NULL>");
  case VT_ERROR: return _bstr_t("Error");
  case VT_BSTR: return _bstr_t(varT.bstrVal);
  default: return _bstr_t("Unknown");
  }
  CATCHDB
  return _bstr_t("Wrong Data Type");
}

Member Data Documentation

ado20::_ConnectionPtr CADVCGENDlg::conn

Definition at line 25 of file advcgendlg.h.

_bstr_t CADVCGENDlg::connStr

Definition at line 24 of file advcgendlg.h.

ado20::_RecordsetPtr CADVCGENDlg::dataRs

Definition at line 26 of file advcgendlg.h.

HRESULT CADVCGENDlg::hr

Definition at line 28 of file advcgendlg.h.

CDataGrid CADVCGENDlg::m_DataGridDisplay

Definition at line 41 of file advcgendlg.h.

HICON CADVCGENDlg::m_hIcon [protected]

Definition at line 55 of file advcgendlg.h.

CButton CADVCGENDlg::m_SchemaInfo

Definition at line 43 of file advcgendlg.h.

CEdit CADVCGENDlg::m_SQLEditBox

Definition at line 44 of file advcgendlg.h.

CListBox CADVCGENDlg::m_TableListBox

Definition at line 42 of file advcgendlg.h.

ado20::_RecordsetPtr CADVCGENDlg::schemaRs

Definition at line 27 of file advcgendlg.h.

The documentation for this class was generated from the following files:
  • Dataaccess/ADO/ADOVCGEN/advcgendlg.h
  • Dataaccess/ADO/ADOVCGEN/advcgendlg.cpp
Generated on Wed Nov 13 2024 16:55:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAdvClientDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes

CAdvClientDlg Class Reference

#include "AdvClientdlg.h"

List of all members.

Public Types

enum | { IDD = IDD_SAMPLE_DIALOG }

Public Member Functions

CAdvClientDlg (CWnd *pParent=NULL)
virtual | ~CAdvClientDlg ()

Public Attributes

CButton | m_addEquipment
CButton | m_connect
CButton | m_diskDescriptions
CButton | m_diskDetails
CButton | m_enumDisks
CButton | m_enumServices
CButton | m_enumServicesAsync
CListBox | m_eventList
CString m_namespace
CListBox | m_outputList
CButton | m_perm
CButton | m_temp

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
afx_msg void | OnAddEquipment ()
virtual void | OnCancel ()
afx_msg void | OnConnect ()
afx_msg void | OnDiskdetails ()
afx_msg void | OnDiskPropsDescriptions ()
afx_msg void | OnEnumdisks ()
afx_msg void | OnEnumservices ()
afx_msg void | OnEnumservicesasync ()
virtual BOOL | OnInitDialog ()
afx_msg void | OnRegPerm ()
afx_msg void | OnRegTemp ()
afx_msg void | OnSysCommand (UINT nID, LPARAM lParam)

Private Member Functions

BOOL | AddBinding (IWbemClassObject *pConsumer, IWbemClassObject *pFilter)
BOOL | AddFilter (IWbemClassObject **pFilter)
HRESULT | AssociateToMachine (IWbemClassObject *pEquipInst)
BOOL | CheckOfficeNamespace (void)
BOOL | EnsureOfficeNamespace (void)
HRESULT | GetCompSysRef (VARIANT *v)
BOOL | GetConsumer (IWbemClassObject **pConsumer)
BOOL OnPermRegister ()
void | OnPermUnregister ()
BOOL OnTempRegister ()
void | OnTempUnregister ()
BOOL PermRegistered ()
void | StopThread ()

Static Private Member Functions

static STDMETHODIMP | DisplayEvents (CAdvClientDlg *pThis, LONG lObjectCount, IWbemClassObject **ppObjArray)
static DWORD WINAPI | ThreadProc (LPVOID lpParameter)

Private Attributes

CRITICAL_SECTION | m_critSect
IWbemServices * | m_pIWbemServices
IWbemServices * | m_pOfficeService
CAsyncQuerySink * m_pQueryCallback
IStream * | m_pStream
HANDLE m_ptrReady
BOOL m_regPerm
BOOL m_regTemp
HANDLE m_stopThread
HANDLE m_thread
DWORD m_threadId

Detailed Description

Definition at line 32 of file AdvClientdlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 41 of file AdvClientdlg.h.

{ IDD = IDD_SAMPLE_DIALOG };

Constructor & Destructor Documentation

CAdvClientDlg::CAdvClientDlg ( CWnd * pParent = NULL )

Definition at line 94 of file AdvClientdlg.cpp.

  : CDialog(CAdvClientDlg::IDD, pParent),
  m_threadId(0), m_thread(0), m_ptrReady(0), m_stopThread(0)
{
  //{{AFX_DATA_INIT(CAdvClientDlg)
  m_namespace = _T("\\\\.\\root\\cimv2");
  //}}AFX_DATA_INIT

  m_pIWbemServices = NULL;
  m_pOfficeService = NULL;
  m_pQueryCallback = NULL;
  m_regPerm = TRUE;
  m_regTemp = TRUE;
  m_pStream = NULL;

    InitializeCriticalSection(&m_critSect);
  m_stopThread = CreateEvent(NULL, FALSE, FALSE, NULL);
  m_ptrReady = CreateEvent(NULL, FALSE, FALSE, NULL);

}

CAdvClientDlg::~CAdvClientDlg ( ) [virtual]

Definition at line 135 of file AdvClientdlg.cpp.

{

  if (m_thread != NULL)
  {
    OnTempUnregister();
  }

  // done with m_pQueryCallback sink.
  if(m_pQueryCallback)
  {
    m_pQueryCallback->Release();
    delete m_pQueryCallback;
    m_pQueryCallback = NULL;
  }

  // done with m_pIWbemServices.
  if (m_pIWbemServices)
  {
    m_pIWbemServices->Release();
    m_pIWbemServices = NULL;
  }
  // done with m_pIWbemServices.
  if (m_pOfficeService)
  {
    m_pOfficeService->Release();
    m_pOfficeService = NULL;
  }

  StopThread();

    DeleteCriticalSection(&m_critSect);

}

Member Function Documentation

BOOL CAdvClientDlg::AddBinding | ( | IWbemClassObject * | pConsumer,
 |  | IWbemClassObject * | pFilter |
 | ) |  |  | [private]

Definition at line 310 of file onperm.cpp.

{
  BOOL retval = FALSE;
  HRESULT hRes;
  VARIANT v;
  VariantInit(&v);

  IWbemClassObject *pAClass = NULL;
  IWbemClassObject *pAInst = NULL;

  BSTR AssocClassName = SysAllocString(L"__FilterToConsumerBinding");
  if (!AssocClassName)
  {
    TRACE(_T("SysAllocString failed: not enough memory\n"));
    return FALSE;
  }

  BSTR ConsumerProp = SysAllocString(L"Consumer");
  if (!ConsumerProp)
  {
    SysFreeString(AssocClassName);
    TRACE(_T("SysAllocString failed: not enough memory\n"));
    return FALSE;
  }

  BSTR FilterProp = SysAllocString(L"Filter");
  if (!FilterProp)
  {
    SysFreeString(AssocClassName);
    SysFreeString(ConsumerProp);
    TRACE(_T("SysAllocString failed: not enough memory\n"));
    return FALSE;
  }

  BSTR PathProp = SysAllocString(L"__RELPATH");
  if (!PathProp)
  {
    SysFreeString(AssocClassName);
    SysFreeString(ConsumerProp);
    SysFreeString(FilterProp);
    TRACE(_T("SysAllocString failed: not enough memory\n"));
    return FALSE;
  }

  // if association class exists...
  if((hRes = m_pOfficeService->GetObject(AssocClassName,
                    0L, NULL,
                    &pAClass,
                    NULL)) == S_OK)
  {
    //------------------------------
    // spawn a new instance.
    if((hRes = pAClass->SpawnInstance(0, &pAInst)) == S_OK)
    {
      TRACE(_T("Assoc SpawnInstance() worked\n"));

      //-----------------------------------
      // set consumer instance name
      if ((hRes = pConsumer->Get(PathProp, 0L,
                  &v, NULL, NULL)) == S_OK)
      {
        hRes = pAInst->Put(ConsumerProp, 0, &v, 0);
        TRACE(_T("Got Consumer ref: %s\n"), ErrorString(hRes));
        VariantClear(&v);
      }
      else
      {
        TRACE(_T("Get() consumer ref failed: %s\n"), ErrorString(hRes));
      } //endif Get()

      //-----------------------------------
      // set Filter ref
      if ((hRes = pFilter->Get(PathProp, 0L,
                  &v, NULL, NULL)) == S_OK)
      {
        hRes = pAInst->Put(FilterProp, 0, &v, 0);
        TRACE(_T("Got filter ref: %s\n"), ErrorString(hRes));
        VariantClear(&v);
      }
      else
      {
        TRACE(_T("Get() filter ref failed: %s\n"), ErrorString(hRes));
      } //endif Get()

      SysFreeString(PathProp);

      //-----------------------------------
      // putInstance
      if((hRes = m_pOfficeService->PutInstance(pAInst, WBEM_FLAG_CREATE_OR_UPDATE, NULL, NULL)) == S_OK)
      {
        retval = TRUE;
      }
      else
      {
        TRACE(_T("PutInstance() __FilterToConsumerBinding failed: %s\n"), ErrorString(hRes));
      }

      pAInst->Release();
      pAInst = NULL;
    }
    else
    {
      TRACE(_T("SpawnInstance() failed: %s\n"), ErrorString(hRes));

    } //endif SpawnInstance()
  }
  else
  {
    TRACE(_T("GetObject() class failed: %s\n"), ErrorString(hRes));

  } // endif GetObject() class.

  if(pAClass)
  {
    pAClass->Release();
    pAClass = NULL;
  }

  SysFreeString(AssocClassName);
  SysFreeString(ConsumerProp);
  SysFreeString(FilterProp);

  return retval;
}

BOOL CAdvClientDlg::AddFilter ( IWbemClassObject ** pFilter ) [private]

Definition at line 171 of file onperm.cpp.

{
  BOOL retval = FALSE;

  HRESULT hRes;
  VARIANT v;
  VariantInit(&v);

  CString FilterName(_T("Sample Perm Query"));
  CString FilterClass(L"__EventFilter");
  CString FilterClassKey(L"Name");
  CString QueryProp(L"Query");
  CString LangProp(L"QueryLanguage");
  CString theQuery(L"select * from __InstanceCreationEvent where TargetInstance isa \"SAMPLE_OfficeEquipment\"");
  BSTR Prop = NULL;
  BSTR curInst = NULL;
  BSTR FilterClassName = NULL;

  IWbemClassObject *pFilterClass = NULL;
  IWbemClassObject *pFilterInst = NULL;

  FilterClassName = FilterClass.AllocSysString();
  if (!FilterClassName)
    goto OutOfMemory;

  //---------------------
  // if class exists...
  if((hRes = m_pOfficeService->GetObject(FilterClassName,
                  0L, NULL,
                  &pFilterClass,
                  NULL)) == S_OK)
  {
    //---------------------
    // spawn a new instance
    if((hRes = pFilterClass->SpawnInstance(0, &pFilterInst)) == S_OK)
    {
      TRACE(_T("SpawnInstance() worked\n"));

      // set the key property.
      V_VT(&v) = VT_BSTR;
      V_BSTR(&v) = FilterName.AllocSysString();
      if (!V_BSTR(&v))
        goto OutOfMemory;

      Prop = FilterClassKey.AllocSysString();
      if (!Prop)
        goto OutOfMemory;

      pFilterInst->Put(Prop, 0, &v, 0);
      VariantClear(&v);
      SysFreeString(Prop);

      V_VT(&v) = VT_BSTR;
      V_BSTR(&v) = theQuery.AllocSysString();
      if (!V_BSTR(&v))
        goto OutOfMemory;
      Prop = QueryProp.AllocSysString();
      if (!Prop)
        goto OutOfMemory;
      pFilterInst->Put(Prop, 0, &v, 0);
      VariantClear(&v);
      SysFreeString(Prop);

      V_VT(&v) = VT_BSTR;
      V_BSTR(&v) = SysAllocString(L"WQL");
      if (!V_BSTR(&v))
        goto OutOfMemory;
      Prop = LangProp.AllocSysString();
      if (!Prop)
        goto OutOfMemory;
      pFilterInst->Put(Prop, 0, &v, 0);
      VariantClear(&v);
      SysFreeString(Prop);

      //---------------------
      // putInstance
      hRes = m_pOfficeService->PutInstance(pFilterInst, 0, NULL, NULL);

      pFilterInst->Release();
      pFilterInst = NULL;

      CString str = FilterClass + _T(".") + FilterClassKey;
      str += _T("=\"");
      str += FilterName;
      str += _T("\"");

      curInst = str.AllocSysString();
      if (!curInst)
        goto OutOfMemory;

      TRACE(_T("flushing instance for %s\n"), str);

      //---------------------
      if((hRes = m_pOfficeService->GetObject(curInst, 0L, NULL,
                      ppFilter, NULL)) == S_OK)
      {
        retval = TRUE;
      }
      else
      {
        TRACE(_T("Second GetObject() pFilterInst failed: %s\n"), ErrorString(hRes));
      } //endif GetObject()

      SysFreeString(curInst);
    }
    else
    {
      TRACE(_T("SpawnInstance() failed: %s\n"), ErrorString(hRes));

    } //endif SpawnInstance()

    pFilterClass->Release();  // Don't need the class any more
    pFilterClass = NULL;

  } // endif class doesnt exist.

  SysFreeString(FilterClassName);
  return retval;

OutOfMemory:
  SysFreeString (FilterClassName);
  SysFreeString (Prop);
  SysFreeString (curInst);

  if (pFilterClass)
    pFilterClass->Release();
  if (pFilterInst)
    pFilterInst->Release();

  VariantClear(& v);

  TRACE(_T("SysAllocString failed: not enough memory\n"));

  return FALSE;

}

HRESULT CAdvClientDlg::AssociateToMachine ( IWbemClassObject * pEquipInst ) [private]

Definition at line 152 of file onaddequipment.cpp.

{
  IWbemClassObject *pAClass = NULL;
  IWbemClassObject *pAInst = NULL;
  IWbemQualifierSet *pQual = NULL;

  VARIANT v, vTRUE, ref, def;
  VariantInit(&v);
  VariantInit(&vTRUE);
  VariantInit(&ref);
  VariantInit(&def);

  HRESULT hRes = S_OK;

  BSTR AssocClassName = NULL;
  BSTR EquipProp = NULL;
  BSTR CompProp = NULL;
  BSTR PathProp = NULL;
  BSTR Key = NULL;
  BSTR CimType = NULL;
  BSTR Class = NULL;

  EquipProp = SysAllocString(L"Equipment");
  if (!EquipProp)
    goto OutOfMemory;

  CompProp = SysAllocString(L"ComputerSystem");
  if (!CompProp)
    goto OutOfMemory;

  AssocClassName = SysAllocString(L"SAMPLE_EquipmentToSystem");
  if (!AssocClassName)
    goto OutOfMemory;

  // if association class doesn't exist yet...
  hRes = m_pOfficeService->GetObject(AssocClassName,
                    0L, NULL,
                    &pAClass,
                    NULL);

  SysFreeString(AssocClassName);
  if(hRes != S_OK)
  {
    // create new class. Parm1 == NULL gives a new, empty
    // class to load with property values.
    if((hRes = m_pOfficeService->GetObject(NULL, 0, NULL,
                      &pAClass, NULL)) == S_OK)
    {
      //-----------------------------------
      // name the class.
      V_VT(&v) = VT_BSTR;
      V_BSTR(&v) = SysAllocString(L"SAMPLE_EquipmentToSystem");
      if (!V_BSTR(&v))
        goto OutOfMemory;

      Class = SysAllocString(L"__CLASS");
      if (!Class)
        goto OutOfMemory;

      pAClass->Put(Class, 0, &v, 0);
      SysFreeString(Class);
      VariantClear(&v);

      //-----------------------------------
      // make it an association.
      pAClass->GetQualifierSet(&pQual);

      BSTR assoc = SysAllocString(L"Association");
      if (!assoc)
        goto OutOfMemory;

      V_VT(&vTRUE) = VT_BOOL;
      V_BOOL(&vTRUE) = VARIANT_TRUE;

      pQual->Put(assoc, &vTRUE, WBEM_FLAVOR_FLAG_PROPAGATE_TO_INSTANCE |
                WBEM_FLAVOR_FLAG_PROPAGATE_TO_DERIVED_CLASS);

      // cleanup.
      SysFreeString(assoc);
      pQual->Release();
      pQual = NULL;

      //-----------------------------------
      // common stuff for properties
      Key = SysAllocString(L"Key");
      CimType = SysAllocString(L"CIMTYPE");
      if (!Key || ! CimType)
        goto OutOfMemory;

      V_VT(&def) = VT_BSTR;
      V_BSTR(&def) = SysAllocString(L"");
      if (!V_BSTR(&def))
        goto OutOfMemory;

      //-----------------------------------
      // create the equipment property.
      pAClass->Put(EquipProp, 0, &def, 0);

      // make it a key.
      pAClass->GetPropertyQualifierSet(EquipProp, &pQual);
      pQual->Put(Key, &vTRUE, WBEM_FLAVOR_FLAG_PROPAGATE_TO_INSTANCE |
                WBEM_FLAVOR_FLAG_PROPAGATE_TO_DERIVED_CLASS);

      // make it a strongly typed reference.
      V_VT(&ref) = VT_BSTR;
      V_BSTR(&ref) = SysAllocString(L"REF:SAMPLE_OfficeEquipment");
      if (!V_BSTR(&ref))
        goto OutOfMemory;
      pQual->Put(CimType, &ref, WBEM_FLAVOR_FLAG_PROPAGATE_TO_INSTANCE |
                WBEM_FLAVOR_FLAG_PROPAGATE_TO_DERIVED_CLASS);

      // cleanup the property specific stuff.
      VariantClear(&ref);
      pQual->Release();
      pQual = NULL;

      //-----------------------------------
      // 'ComputerSystem' is the other key property.
      pAClass->Put(CompProp, 0, &def, 0);

      // make it a key.
      pAClass->GetPropertyQualifierSet(CompProp, &pQual);
      pQual->Put(Key, &vTRUE, WBEM_FLAVOR_FLAG_PROPAGATE_TO_INSTANCE |
                WBEM_FLAVOR_FLAG_PROPAGATE_TO_DERIVED_CLASS);

      // make it a strongly typed reference.
      V_VT(&ref) = VT_BSTR;
      V_BSTR(&ref) = SysAllocString(L"REF:Win32_ComputerSystem");
      if (!V_BSTR(&ref))
        goto OutOfMemory;
      pQual->Put(CimType, &ref, WBEM_FLAVOR_FLAG_PROPAGATE_TO_INSTANCE |
                WBEM_FLAVOR_FLAG_PROPAGATE_TO_DERIVED_CLASS);

      // cleanup the property specific stuff.
      VariantClear(&ref);
      pQual->Release();
      pQual = NULL;

      //-----------------------------------
      // cleanup the common stuff too.
      SysFreeString(Key);
      SysFreeString(CimType);
      VariantClear(&v);
      VariantClear(&vTRUE);
      VariantClear(&def);

      //-----------------------------------
      // register new class
      if((hRes = m_pOfficeService->PutClass(pAClass,
                        0, NULL, NULL)) != S_OK)
      {
        TRACE(_T("Second PutClass() failed: %s\n"), ErrorString(hRes));
      }

      pAClass->Release();
      pAClass = NULL;
    }
    else
    {
      TRACE(_T("GetObject() NULL failed: %s\n"), ErrorString(hRes));
    }

    // NOTE: now pAClass exists for sure but you have to go get a new pointer
    //  from CIMOM before you can spawnInstance() on it. You CANNOT continue to use
    //   the pAClass ptr from above.
    AssocClassName = SysAllocString(L"SAMPLE_EquipmentToSystem");
    if (!AssocClassName)
      goto OutOfMemory;

    hRes = m_pOfficeService->GetObject(AssocClassName,
                        0L, NULL,
                        &pAClass,
                        NULL);
    SysFreeString(AssocClassName);
    if(hRes != S_OK)
    {
      TRACE(_T("Second GetObject() failed: %s\n"), ErrorString(hRes));
    } //endif GetObject()

  } // endif class doesnt exist.

  ASSERT(pAClass);

  // spawn a new instance.
  if((hRes = pAClass->SpawnInstance(0, &pAInst)) == S_OK)
  {
    TRACE(_T("Assoc SpawnInstance() worked\n"));

    PathProp = SysAllocString(L"__PATH");
    if (!PathProp)
      goto OutOfMemory;

    //-----------------------------------
    // set equipment reference
    if ((hRes = pEquipInst->Get(PathProp, 0L,
              &v, NULL, NULL)) == S_OK)
    {
      TRACE(_T("Got equipment ref\n"));
      pAInst->Put(EquipProp, 0, &v, 0);
      VariantClear(&v);
    }
    else
    {
      TRACE(_T("Get() equipment ref failed: %s\n"), ErrorString(hRes));
    } //endif Get()

    SysFreeString(PathProp);

    //-----------------------------------
    // set ComputerSystem reference
    if ((hRes = GetCompSysRef(&v)) == S_OK)
    {
      TRACE(_T("Got the ComputerSystem ref\n"));
      pAInst->Put(CompProp, 0, &v, 0);
      VariantClear(&v);
    }
    else
    {
      TRACE(_T("Get() compSys ref failed: %s\n"), ErrorString(hRes));
    } //endif Get()

    //-----------------------------------
    // putInstance
    hRes = m_pOfficeService->PutInstance(pAInst, 0, NULL, NULL);
    pAInst->Release();
    pAInst = NULL;
  }
  else
  {
    TRACE(_T("SpawnInstance() failed: %s\n"), ErrorString(hRes));

  } //endif SpawnInstance()

  pAClass->Release();  // Don't need the class any more
  pAClass = NULL;

  SysFreeString(EquipProp);
  SysFreeString(CompProp);

  return hRes;

OutOfMemory:
  SysFreeString(EquipProp);
  SysFreeString(CompProp);
  SysFreeString(PathProp);
  SysFreeString(AssocClassName);
  SysFreeString(Key);
  SysFreeString(CimType);
  SysFreeString(Class);

  if (pAClass)
  {
    pAClass->Release();
  }
  if (pAInst)
  {
    pAInst->Release();
  }
  if (pQual)
  {
    pQual->Release();
  }

  VariantClear(&v);
  VariantClear(&vTRUE);
  VariantClear(&ref);
  VariantClear(&def);

  TRACE(_T("Not enough memory"));

  return E_OUTOFMEMORY;

}

BOOL CAdvClientDlg::CheckOfficeNamespace ( void ) [private]

Definition at line 698 of file AdvClientdlg.cpp.

{
  IWbemServices *pOfficeService = NULL;
  HRESULT hRes;
  BOOL itsThere = FALSE;

  // lazy check first.
  if(m_pOfficeService != NULL) return TRUE;

  // do some real work now.
  BSTR Namespace = SysAllocString(L"SAMPLE_Office");
  if (Namespace == NULL)
    return FALSE; //out of memory

  // if 'Office' namespace doesnt exists...
  if((hRes = m_pIWbemServices->OpenNamespace(Namespace, 0, NULL,
                        &pOfficeService, NULL)) == S_OK)
  {
    itsThere = TRUE;
    pOfficeService->Release();
    pOfficeService = NULL;

  } //endif OpenNamespace()

  SysFreeString(Namespace);

  return itsThere;
}

STDMETHODIMP CAdvClientDlg::DisplayEvents | ( | CAdvClientDlg * | pThis,
 |  | LONG | lObjectCount,
 |  | IWbemClassObject ** | ppObjArray |
 | ) |  |  | [static, private]

Definition at line 177 of file ontemp.cpp.

{

  if (!pThis)
  {
    return E_FAIL;
  }
  HRESULT  hRes;
  CString clMyBuff;
  BSTR objName = NULL;
  BSTR propName = NULL;
  VARIANT pVal, vDisp;
  IDispatch *pDisp = NULL;
  IWbemClassObject *tgtInst = NULL;

  VariantInit(&pVal);
  VariantInit(&vDisp);

  objName = SysAllocString(L"TargetInstance");
  if (!objName)
    return E_OUTOFMEMORY;
  propName = SysAllocString(L"Item");
  if (!propName)
  {
    SysFreeString(objName);
    return E_OUTOFMEMORY;
  }

  // walk though the classObjects...
  for (int i = 0; i < lObjectCount; i++)
  {
    // clear my output buffer.
    clMyBuff.Empty();

    // get what was added. This will be an embedded object (VT_DISPATCH). All
    // WBEM interfaces are derived from IDispatch.
    if ((hRes = ppObjArray[i]->Get(objName, 0L,
                    &vDisp, NULL, NULL)) == S_OK)
    {
      //--------------------------------
      // pull the IDispatch out of the various. Dont cast directly to to IWbemClassObject.
      // it MIGHT work now but a suptle change later will break your code. The PROPER
      // way is to go through QueryInterface and do all the right Release()'s.
      pDisp = (IDispatch *)V_DISPATCH(&vDisp);

      //--------------------------------
      // ask for the IWbemClassObject which is the embedded object. This will be the
      // instance that was created.
      if(SUCCEEDED(pDisp->QueryInterface(IID_IWbemClassObject, (void **)&tgtInst)))
      {
        //--------------------------------
        // dont need the IDispatch anymore.
        pDisp->Release();

        //--------------------------------
        // get the 'Item' property out of the embedded object.
        if ((hRes = tgtInst->Get(propName, 0L,
                    &pVal, NULL, NULL)) == S_OK)
        {
          //--------------------------------
          // done with it.
          tgtInst->Release();

          // compose a string for the listbox.
          clMyBuff = _T("SAMPLE_OfficeEquipment Instance added for: ");
          clMyBuff += V_BSTR(&pVal);

          // output the buffer.
          (pThis->m_eventList).AddString(clMyBuff);
        }
        else
        {
          TRACE(_T("Get() Item failed %s\n"), ErrorString(hRes));
        }
      }
      else
      {
        TRACE(_T("QI() failed \n"));
      }
    }
    else
    {
      TRACE(_T("Get() targetInst failed %s\n"), ErrorString(hRes));
      (pThis->m_eventList).AddString(_T("programming error"));
    } //endif Get()

  } // endfor

  SysFreeString(propName);
  SysFreeString(objName);
  VariantClear(&pVal);

  return S_OK;
}

void CAdvClientDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 170 of file AdvClientdlg.cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CAdvClientDlg)
  DDX_Control(pDX, IDC_DISK_PROPS_DESCRIPTIONS, m_diskDescriptions);
  DDX_Control(pDX, IDC_EVENTLIST, m_eventList);
  DDX_Control(pDX, IDC_REGPERM, m_perm);
  DDX_Control(pDX, IDC_REGTEMP, m_temp);
  DDX_Control(pDX, IDC_ADDEQUIPMENT, m_addEquipment);
  DDX_Control(pDX, IDC_ENUMSERVICES, m_enumServices);
  DDX_Control(pDX, IDC_ENUMSERVICESASYNC, m_enumServicesAsync);
  DDX_Control(pDX, IDC_ENUMDISKS, m_enumDisks);
  DDX_Control(pDX, IDC_DISKDETAILS, m_diskDetails);
  DDX_Control(pDX, IDC_CONNECT, m_connect);
  DDX_Control(pDX, IDC_OUTPUTLIST, m_outputList);
  DDX_Text(pDX, IDC_NAMESPACE, m_namespace);
  //}}AFX_DATA_MAP
}

BOOL CAdvClientDlg::EnsureOfficeNamespace ( void ) [private]

Definition at line 601 of file AdvClientdlg.cpp.

{
  IWbemClassObject *pNSClass = NULL;
  IWbemClassObject *pNSInst = NULL;

  BSTR Prop = NULL;
  VARIANT v;
  HRESULT hRes;

  BSTR Namespace = SysAllocString(L"SAMPLE_Office");
  if (Namespace == NULL)
  {
    return FALSE;
  }

  // avoid getting another pointer if you already one. Potential
  // leak if you do.
  if(m_pOfficeService != NULL)
  {
    return TRUE;
  }

  // if 'Office' namespace doesnt exists...
  if((hRes = m_pIWbemServices->OpenNamespace(Namespace, 0, NULL, &m_pOfficeService, NULL)) != S_OK)
  { // create it.

    BSTR NamespaceClass = SysAllocString(L"__Namespace");
    if (NamespaceClass == NULL)
    {
      SysFreeString(Namespace);
      return FALSE;
    }

    //-----------------------------------
    // get the namespace class
    hRes = m_pIWbemServices->GetObject(NamespaceClass,
                      0L, NULL,
                      &pNSClass,
                      NULL);

    SysFreeString(NamespaceClass);
    if(hRes == S_OK)
    {
      //-----------------------------------
      // spawn a new instance
      if((hRes = pNSClass->SpawnInstance(0, &pNSInst)) == S_OK)
      {
        TRACE(_T("SpawnInstance() worked\n"));

        // set the namespace's name.
        VariantInit(&v);
        V_VT(&v) = VT_BSTR;
        V_BSTR(&v) = Namespace;
        Prop = SysAllocString(L"Name");
        if (Prop == NULL)
        {
          pNSClass->Release();  // Don't need the class any more
          pNSClass = NULL;
          SysFreeString(Namespace);
          return FALSE;
        }

        pNSInst->Put(Prop, 0, &v, 0);

        SysFreeString(Prop);
        VariantClear(&v);

        // create the instance.
        hRes = m_pIWbemServices->PutInstance(pNSInst, 0, NULL, NULL);
        pNSInst->Release();
        pNSInst = NULL;

        //-----------------------------------
        // open the new namespace.
        if((hRes = m_pIWbemServices->OpenNamespace(Namespace, 0, NULL, &m_pOfficeService, NULL)) != S_OK)
        {
          TRACE(_T("OpenNamespace() still failed: %s\n"), ErrorString(hRes));
        } // endif OpenNamespace() again
      }
      else
      {
        TRACE(_T("SpawnInstance() failed: %s\n"), ErrorString(hRes));

      } //endif SpawnInstance()

      pNSClass->Release();  // Don't need the class any more
      pNSClass = NULL;
    }

  } //endif OpenNamespace()

  SysFreeString(Namespace);

  // NOTE: The caller needs to Release() it.
  return (m_pOfficeService != NULL);
}

HRESULT CAdvClientDlg::GetCompSysRef ( VARIANT * v ) [private]

Definition at line 41 of file onaddequipment.cpp.

{
  // these are for enumerating.
  DWORD uReturned;
  HRESULT  hRes;
  IWbemClassObject *pCompSys = NULL;
  IEnumWbemClassObject *pEnumCompSys = NULL;

  // these help get properties.
  BSTR propName = SysAllocString(L"__PATH");
  if (!propName)
  {
    return E_OUTOFMEMORY;
  }

  // here's what we're looking for.
  // NOTE: make sure you specify a class that has a Provider()
  //  specified for it in the mof file. All other classes are
  //  abstract and wont be found using HMM_FLAG_SHALLOW. They
  //  will be found using HMM_FLAG_DEEP.
  BSTR className = SysAllocString(L"Win32_ComputerSystem");
  if (!className)
  {
    SysFreeString(propName);
    return E_OUTOFMEMORY;
  }

  TRACE(_T("Going for class\n"));

  // get the list of the computerSystems. There should only be one.
    if ((hRes = m_pIWbemServices->CreateInstanceEnum(className,
                        WBEM_FLAG_SHALLOW,
                        NULL,
                        &pEnumCompSys)) == S_OK)
  {
    TRACE(_T("good enumerator\n"));

    // No need to actually loop since there should only be one instance
    // of 'Win32_ComputerSystem'.
    if(((hRes = pEnumCompSys->Next(TIMEOUT,
                  1,
                  &pCompSys,
                  &uReturned)) == S_OK) &&
       (uReturned == 1))
    {

      TRACE(_T("Got a device class\n"));

      // Add the path
      if ((hRes = pCompSys->Get(propName, 0L,
                v, NULL, NULL)) == S_OK)
      {
        TRACE(_T("Got the computer name %s\n"), V_BSTR(v));
      }
      else
      {
        TRACE(_T("Get() comp name: %s\n"), ErrorString(hRes));
      } // endif Get()

      // Done with this object.
      if (pCompSys)
      {
        pCompSys->Release();
        pCompSys = NULL;
      }
    }
    else
    {
      TRACE(_T("done looking up comp name: %s\n"), ErrorString(hRes));
    } // endif Next()

    // Done with the enumerator.
    if (pEnumCompSys)
    {
      pEnumCompSys->Release();
      pEnumCompSys = NULL;
    }
    }
  else // CreateInstanceEnum() failed.
  {
    TRACE(_T("CreateInstanceEnum() failed: %s\n"), ErrorString(hRes));

  } // endif CreateInstanceEnum()

  SysFreeString(propName);

  TRACE(_T("returning\n"));

  return hRes;
}

BOOL CAdvClientDlg::GetConsumer ( IWbemClassObject ** pConsumer ) [private]

Definition at line 139 of file onperm.cpp.

{
  BOOL retval = FALSE;
  HRESULT hRes;
  BSTR curInst;
  CString str(L"SampleViewerConsumer.Name=\"Sample says:\"");
//  CString ConsumerCLSID(L"{1E069401-087E-11d1-AD85-00AA00B8E05A}");

  curInst = str.AllocSysString();
  if (! curInst)
  {
    TRACE(_T("AllocSysString failed"));

    return FALSE;
  }

  //---------------------
  if((hRes = m_pOfficeService->GetObject(curInst, 0L, NULL,
                      ppConsumer, NULL)) == S_OK)
  {
    retval = TRUE;
  }
  else
  {
    TRACE(_T("Second GetObject() pConsumerInst failed: %s\n"), ErrorString(hRes));
  } //endif GetObject()

  SysFreeString(curInst);

  return retval;
}

void CAdvClientDlg::OnAddEquipment ( ) [protected]

Definition at line 448 of file onaddequipment.cpp.

{
  IWbemClassObject *pEquipClass = NULL;
  IWbemClassObject *pEquipInst = NULL;
  IEnumWbemClassObject *pEnumEquipment = NULL;

  HRESULT hRes;
  CString buf;
  BSTR Prop = NULL;
  BSTR curInst = NULL;
  VARIANT v;
  DWORD uReturned;

  //allocate some strings

  COfficeDlg dlg;

  VariantInit(&v);
  m_outputList.ResetContent();
  m_outputList.AddString(_T("working..."));

  // collect office equipment info.
  dlg.DoModal();

  // switch to the root\cimv2\office namespace.
  if(EnsureOfficeNamespace())
  {
    // the namespace exists now, allow user to register for its events.
    m_perm.EnableWindow(TRUE);
    m_temp.EnableWindow(TRUE);

    BSTR EquipClassName = SysAllocString(L"SAMPLE_OfficeEquipment");
    if (!EquipClassName)
    {
      TRACE(_T("Not enough memory: SysAllocString failed"));
      return;
    }

    // if class doesn't exist yet...
    if((hRes = m_pOfficeService->GetObject(EquipClassName,
                      0L, NULL,
                      &pEquipClass,
                      NULL)) != S_OK)
    {

      //-----------------------------------
      // create new class. Parm1 == NULL gives a new, empty
      // class to load with property values.
      if((hRes = m_pOfficeService->GetObject(NULL, 0, NULL,
                        &pEquipClass, NULL)) == S_OK)
      {

        // name the class.
        V_VT(&v) = VT_BSTR;
        V_BSTR(&v) = EquipClassName;

        BSTR  Class = SysAllocString(L"__CLASS");
        if (!Class)
        {
          pEquipClass->Release();
          SysFreeString(EquipClassName);
          TRACE(_T("Not enough memory: SysAllocString failed"));
          return;
        }
        pEquipClass->Put(Class, 0, &v, 0);
        SysFreeString(Class);
        VariantClear(&v);

        // 'SKU' is the key property
        V_VT(&v) = VT_BSTR;

        BSTR Default = SysAllocString(L"<default>");
        if (!Default)
        {
          pEquipClass->Release();
          SysFreeString(EquipClassName);
          TRACE(_T("Not enough memory: SysAllocString failed"));
          return;
        }

        V_BSTR(&v) = Default;

        Prop = SysAllocString(L"SKU");
        if (!Prop)
        {
          pEquipClass->Release();
          SysFreeString(EquipClassName);
          TRACE(_T("Not enough memory: SysAllocString failed"));
          return;
        };
        pEquipClass->Put(Prop, 0, &v, 0);
        VariantClear(&v);

        // Mark the "OfficeNum" property as the 'key'.
        IWbemQualifierSet *pQual = NULL;
        if (FAILED(pEquipClass->GetPropertyQualifierSet(Prop, &pQual)))
        {
          pEquipClass->Release();
          SysFreeString(EquipClassName);
          TRACE(_T("Failed to get qualifier set"));
          return;
        }
        V_VT(&v) = VT_BOOL;
        V_BOOL(&v) = VARIANT_TRUE;
        BSTR Key = SysAllocString(L"Key");
        if (!Key)
        {
          pQual->Release();
          pEquipClass->Release();
          SysFreeString(EquipClassName);
          TRACE(_T("Not enough memory: SysAllocString failed"));
          return;
        }

        // NOTE: Qualifier flavors not required for KEY
        pQual->Put(Key,
              &v,
              WBEM_FLAVOR_FLAG_PROPAGATE_TO_INSTANCE |
              WBEM_FLAVOR_FLAG_PROPAGATE_TO_DERIVED_CLASS);
        SysFreeString(Key);

        // No longer need the qualifier set for "SKU".
        pQual->Release();
        VariantClear(&v);

        // add description of item.
        V_VT(&v) = VT_BSTR;
        V_BSTR(&v) = SysAllocString(L"<default>");
        if (!V_BSTR(&v))
        {
          pEquipClass->Release();
          SysFreeString(EquipClassName);
          TRACE(_T("Not enough memory: SysAllocString failed"));
          return;
        }

        SysFreeString(Prop);
        Prop = SysAllocString(L"Item");
        if (!Prop)
        {
          pEquipClass->Release();
          SysFreeString(EquipClassName);
          TRACE(_T("Not enough memory: SysAllocString failed"));
          return;
        };

        pEquipClass->Put(Prop, 0, &v, 0);
        SysFreeString(Prop);

        // register new class
        if((hRes = m_pOfficeService->PutClass(pEquipClass, 0, NULL, NULL)) != S_OK)
        {
          TRACE(_T("equipment PutClass() failed: %s\n"), ErrorString(hRes));
        }

        pEquipClass->Release();
        pEquipClass = NULL;

        //-----------------------------------
        // NOTE: now pEquipClass exists for sure but you have to go get a new pointer
        //  from CIMOM before you can spawnInstance() on it. You CANNOT continue to use
        //   the pEquipClass ptr from above.
        if((hRes = m_pOfficeService->GetObject(EquipClassName,
                            0L, NULL,
                            &pEquipClass,
                            NULL)) != S_OK)
        {
          TRACE(_T("Second GetObject() failed: %s\n"), ErrorString(hRes));
        } //endif GetObject()
      }
      else
      {
        TRACE(_T("GetObject() NULL failed: %s\n"), ErrorString(hRes));
      } //endif GetObject() NULL

    } // endif class doesnt exist.
    VariantClear(&v);

    //-----------------------------------
    // spawn a new instance
    if((hRes = pEquipClass->SpawnInstance(0, &pEquipInst)) == S_OK)
    {
      TRACE(_T("SpawnInstance() worked\n"));

      // set the property values
      V_VT(&v) = VT_BSTR;
      V_BSTR(&v) = dlg.m_item.AllocSysString();
      if (!V_BSTR(&v))
      {
        pEquipClass->Release();
        pEquipInst->Release();

        SysFreeString(EquipClassName);
        TRACE(_T("Not enough memory: SysAllocString failed"));
        return;
      }
      Prop = SysAllocString(L"Item");
      if (!Prop)
      {
        VariantClear(&v);
        pEquipClass->Release();
        pEquipInst->Release();

        SysFreeString(EquipClassName);
        TRACE(_T("Not enough memory: SysAllocString failed"));
        return;
      };
      pEquipInst->Put(Prop, 0, &v, 0);
      VariantClear(&v);

      V_VT(&v) = VT_BSTR;
      V_BSTR(&v) = dlg.m_SKU.AllocSysString();
      if (!V_BSTR(&v))
      {
        pEquipClass->Release();
        pEquipInst->Release();

        SysFreeString(EquipClassName);
        VariantClear(&v);
        TRACE(_T("Not enough memory: SysAllocString failed"));
        return;
      }
      Prop = SysAllocString(L"SKU");
      if (!Prop)
      {
        pEquipClass->Release();
        pEquipInst->Release();

        SysFreeString(EquipClassName);
        VariantClear(&v);
        TRACE(_T("Not enough memory: SysAllocString failed"));
        return;
      };
      pEquipInst->Put(Prop, 0, &v, 0);
      VariantClear(&v);

      // putInstance
      hRes = m_pOfficeService->PutInstance(pEquipInst, 0, NULL, NULL);

      pEquipInst->Release();
      pEquipInst = NULL;

      CString str("SAMPLE_OfficeEquipment.SKU=\"");
      str += dlg.m_SKU;
      str += _T("\"");

      curInst = str.AllocSysString();
      if (!curInst)
      {
        pEquipClass->Release();
        pEquipInst->Release();

        SysFreeString(EquipClassName);
        TRACE(_T("Not enough memory: SysAllocString failed"));
        return;
      };

      TRACE(_T("flushing instance for %s\n"), str);

      if((hRes = m_pOfficeService->GetObject(curInst,
                          0L, NULL,
                          &pEquipInst,
                          NULL)) != S_OK)
      {
        TRACE(_T("Second GetObject() pEquipInst failed: %s\n"), ErrorString(hRes));
      } //endif GetObject()

      SysFreeString(Prop);
      SysFreeString(curInst);

      //-----------------------------------
      // make the association.
      hRes = AssociateToMachine(pEquipInst);
      if (FAILED(hRes))
      {
        TRACE(_T("AssociateToMachine() failed: %s\n"), ErrorString(hRes));
      }

      pEquipInst->Release();
      pEquipInst = NULL;
    }
    else
    {
      TRACE(_T("SpawnInstance() failed: %s\n"), ErrorString(hRes));

    } //endif SpawnInstance()

    pEquipClass->Release();  // Don't need the class any more
    pEquipClass = NULL;

    //-----------------------------------
    // enum the office equipment for display purposes.
    if ((hRes = m_pOfficeService->CreateInstanceEnum(EquipClassName,
                          WBEM_FLAG_SHALLOW,
                          NULL,
                          &pEnumEquipment)) == S_OK)
    {
      TRACE(_T("good equip enum\n"));
      SysFreeString(EquipClassName);

      m_outputList.ResetContent();

      uReturned = 1;
      while(uReturned == 1)
      {
        // enumerate through the resultset.
        hRes = pEnumEquipment->Next(TIMEOUT,
                      1,
                      &pEquipInst,
                      &uReturned);

        TRACE(_T("Next() %d:%s\n"), uReturned, ErrorString(hRes));

        // was one found?
        if((hRes == S_OK) && (uReturned == 1))
        {
          TRACE(_T("Got a device class\n"));

          // Get the "SKU" property.
          VariantClear(&v);
          SysFreeString(Prop);
          Prop = SysAllocString(L"SKU");
          if (!Prop)
          {
            pEnumEquipment->Release();
            pEquipInst->Release();
            TRACE(_T("Not enough memory: SysAllocString failed"));
            return;
          }

          if (pEquipInst->Get(Prop, 0L,
                    &v, NULL, NULL) == S_OK)
          {
            TRACE(_T("Got the SKU\n"));
             buf = V_BSTR(&v);
            buf += _T("=>");
          }

          // Get the "Item" property.
          VariantClear(&v);
          SysFreeString(Prop);
          Prop = SysAllocString(L"Item");
          if (!Prop)
          {
            pEnumEquipment->Release();
            pEquipInst->Release();
            TRACE(_T("Not enough memory: SysAllocString failed"));
            return;
          };

          if (pEquipInst->Get(Prop, 0L,
                    &v, NULL, NULL) == S_OK)
          {
            TRACE(_T("Got an item\n"));
            buf += V_BSTR(&v);
          }

          // add to the output listbox.
          m_outputList.AddString(buf);

          // cleanup for next loop
          VariantClear(&v);
          SysFreeString(Prop);

          // Done with this object.
          if (pEquipInst)
          {
            pEquipInst->Release();

            // NOTE: pEquipInst MUST be set to NULL for the next all to Next().
            pEquipInst = NULL;
          }

        } // endif (hRes == S_OK)

      } // endwhile

      TRACE(_T("done enumming: %s\n"), ErrorString(hRes));

      // Done with this enumerator.
      if (pEnumEquipment)
      {
        pEnumEquipment->Release();
        pEnumEquipment = NULL;
      }
    }
    else // CreateInstanceEnum() failed.
    {
      TRACE(_T("CreateInstanceEnum() failed: %s\n"), ErrorString(hRes));

    } // endif CreateInstanceEnum()

    SysFreeString(EquipClassName);

  } // endif EnsureOfficeNamespace()
}

void CAdvClientDlg::OnCancel ( ) [protected, virtual]

Definition at line 728 of file AdvClientdlg.cpp.

{
  // make sure you unregister that sink.
  if (m_thread != NULL)
  {
    OnTempUnregister();
  }

  CDialog::OnCancel();
}

void CAdvClientDlg::OnConnect ( ) [protected]

Definition at line 39 of file onconnect.cpp.

{
  IWbemLocator *pIWbemLocator = NULL;

  UpdateData();
  //------------------------
   // Create an instance of the WbemLocator interface.
   if(CoCreateInstance(CLSID_WbemLocator,
            NULL,
            CLSCTX_INPROC_SERVER,
            IID_IWbemLocator,
            (LPVOID *) &pIWbemLocator) == S_OK)
   {
    //------------------------
    // Use the pointer returned in step two to connect to
    //     the server using the passed in namespace.
    BSTR pNamespace = m_namespace.AllocSysString();
    if (!pNamespace)
    {
      m_outputList.AddString(_T("Out of memory"));
      pIWbemLocator->Release();
      return;
    }
    HRESULT hr = S_OK;

    if((hr = pIWbemLocator->ConnectServer(pNamespace,
                NULL,   //using current account for simplicity
                NULL, //using current password for simplicity
                0L,   // locale
                0L,   // securityFlags
                NULL, // authority (domain for NTLM)
                NULL, // context
                &m_pIWbemServices)) == S_OK)
    {
      // indicate success.
      m_outputList.ResetContent();
      m_outputList.AddString(_T("Connected To Namespace"));

      // its safe the hit the other buttons now.
      m_enumServices.EnableWindow(TRUE);
      m_enumServicesAsync.EnableWindow(TRUE);
      m_enumDisks.EnableWindow(TRUE);
      m_diskDetails.EnableWindow(TRUE);
      m_connect.EnableWindow(TRUE);
      m_addEquipment.EnableWindow(TRUE);
      m_diskDescriptions.EnableWindow(TRUE);

      // dont allow reconnection.
      m_connect.EnableWindow(FALSE);

      // since these guys register for the non-standard
      // root/default/office namespace, dont enable them unless
      // that namespace exists.
      if(CheckOfficeNamespace())
      {
        m_perm.EnableWindow(TRUE);
        m_temp.EnableWindow(TRUE);
      }

      // initialize the Register Perm button.
      if(PermRegistered())
      {
        // init for UNregistering.
        m_regPerm = FALSE;
        m_perm.SetWindowText(_T("Unregister &Perm"));
      }
      else // its not registered...
      {
        // init for registering.
        m_regPerm = TRUE;
        m_perm.SetWindowText(_T("Register &Perm"));
      }
    }
    else
    {
      // failed ConnectServer()
      AfxMessageBox(_T("Bad namespace"));
    }

    // done with pNamespace.
    if(pNamespace)
    {
      SysFreeString(pNamespace);
    }

    //------------------------
    // done with pIWbemLocator.
    if (pIWbemLocator)
    {
      pIWbemLocator->Release();
      pIWbemLocator = NULL;
    }
  }
  else // failed CoCreateInstance()
  {
    AfxMessageBox(_T("Failed to create IWbemLocator object"));

  } // endif CoCreateInstance()

}

void CAdvClientDlg::OnDiskdetails ( ) [protected]

Definition at line 41 of file ondiskdetails.cpp.

{
  HRESULT  hRes;
  long lLower, lUpper, lCount;
  SAFEARRAY *psaNames = NULL;
  BSTR PropName = NULL;
  VARIANT varString, pVal;
  WCHAR *pBuf;
  CString clMyBuff;

  IWbemClassObject *pDriveInst = NULL;
  IWbemQualifierSet *pQualSet = NULL;

  VariantInit(&varString);
  VariantInit(&pVal);

  m_outputList.ResetContent();
  m_outputList.AddString(_T("working..."));

  //-------------------------------
  // Get the instance for C: drive.
  BSTR driveName = SysAllocString(L"Win32_LogicalDisk.DeviceID=\"C:\"");
  if (!driveName)
  {
    TRACE(_T("SysAllocString failed: not enough memory\n"));
    return;
  }
  BSTR cimType = SysAllocString(L"CIMTYPE");
  if (!cimType)
  {
    SysFreeString(driveName);
    TRACE(_T("SysAllocString failed: not enough memory\n"));
    return;
  }
  BSTR keyQual = SysAllocString(L"key");
  if (!keyQual)
  {
    SysFreeString(driveName);
    SysFreeString(cimType);
    TRACE(_T("SysAllocString failed: not enough memory\n"));
    return;
  }

    if((hRes = m_pIWbemServices->GetObject(driveName,
                    0L,
                    NULL,
                    &pDriveInst,
                    NULL)) == S_OK)
  {

    m_outputList.ResetContent();

    //-------------------------------
    // Get the property names
    if((hRes = pDriveInst->GetNames(NULL,
                    WBEM_FLAG_ALWAYS |
                    WBEM_FLAG_NONSYSTEM_ONLY,
                    NULL,
                    &psaNames)) == S_OK)
    {
      //-------------------------------
      // Get the upper and lower bounds of the Names array
      if((hRes = SafeArrayGetLBound(psaNames, 1, &lLower)) != S_OK)
      {
        TRACE(_T("Couldn't get safe array lbound\n"));
        SafeArrayDestroy(psaNames);
        return;
      }

      //-------------------------------
      if((hRes = SafeArrayGetUBound(psaNames, 1, &lUpper)) != S_OK)
      {
        TRACE(_T("Couldn't get safe array ubound\n"));
        SafeArrayDestroy(psaNames);
        return;
      }

      //-------------------------------
      // For all properties...
      for (lCount = lLower; lCount <= lUpper; lCount++)
      {
        //-----------------------------------------------
        // I'm formatting each property as:
        //   name (type) ==> value
        //-----------------------------------------------

        //-------------------------------
        // get the property name for this element
        if((hRes = SafeArrayGetElement(psaNames,
                        &lCount,
                        &PropName)) == S_OK)
        {
          clMyBuff = PropName;

          // print variable type for property value
          clMyBuff += _T(" (");

          // Get pointer to property qualifiers
          // this mess is due to the fact that system properties don't have qualifiers
          if ((pDriveInst->GetPropertyQualifierSet(PropName, &pQualSet)) == S_OK)
          {
            // Get and print syntax attribute (if any)
            if ((pQualSet->Get(cimType, 0L, &pVal, NULL)) == S_OK)
            {
               clMyBuff += V_BSTR(&pVal);
            }
            else if (hRes != WBEM_E_NOT_FOUND)
            {  // some other error
               TRACE(_T("Could not get syntax qualifier\n"));
               break;
            }
            VariantClear(&pVal);

            //-------------------------------
            // If this is a key field, print an asterisk
            if(((hRes = pQualSet->Get(keyQual,
                        0L,
                        &pVal,
                        NULL)) == S_OK) &&
              (pVal.boolVal))
            { // Yes, it's a key
               clMyBuff += _T(")*");
            }
            else if (hRes == WBEM_E_NOT_FOUND)
            {  // not a key qualifier
               clMyBuff += _T(")");
            }
            else
            { // some other error
               TRACE(_T("Could not get key qualifier\n"));
               break;
            }
            // done with the qualifierSet.
            if (pQualSet)
            {
              pQualSet->Release();
              pQualSet = NULL;
            }
          }
          else
          {
            clMyBuff += _T(")");
          } //endif pDriveClass->GetPropertyQualifierSet()

          //-------------------------------
          // Get the value for the property.
          if((hRes = pDriveInst->Get(PropName,
                        0L,
                        &varString,
                        NULL, NULL)) == S_OK)
          {
            // Print the value
            clMyBuff += _T("   ==> ");
            clMyBuff += ValueToString(&varString, &pBuf);

            m_outputList.AddString(clMyBuff);

            free(pBuf); // allocated by ValueToString()
          }
          else
          {
            TRACE(_T("Couldn't get Property Value\n"));
            break;
          } //endif pDriveClass->Get()

          VariantClear(&varString);
          VariantClear(&pVal);
        }
        else // SafeArrayGetElement() failed
        {
          TRACE(_T("Couldn't get safe array element\n"));
          break;
        } //endif SafeArrayGetElement()

      } // endfor

      // cleanup.
      SysFreeString(PropName);
      SysFreeString(keyQual);
      SysFreeString(cimType);
      SafeArrayDestroy(psaNames);
      VariantClear(&varString);
      VariantClear(&pVal);
    }
    else // pDriveClass->GetNames() failed
    {
      TRACE(_T("Couldn't GetNames\n"));
    } //endif pDriveClass->GetNames()

    // done with drive instance.
    if (pDriveInst)
    {
      pDriveInst->Release();
      pDriveInst = NULL;
    }
  } //endif GetObject()
}

void CAdvClientDlg::OnDiskPropsDescriptions ( ) [protected]

Definition at line 55 of file OnDiskPropsDescriptions.cpp.

{

  HRESULT  hRes;
  long lLower, lUpper, lCount;
  SAFEARRAY *psaNames = NULL;
  VARIANT pVal;
  BSTR PropName = NULL;
  CString clMyBuff;

  VariantInit(&pVal);

  IWbemClassObject *pDriveClass = NULL;
  IWbemQualifierSet *pQualSet = NULL;

  m_outputList.ResetContent();
  m_outputList.AddString(_T("working..."));

  BSTR driveClassName = SysAllocString(L"Win32_LogicalDisk");
  if (!driveClassName)
  {
    TRACE(_T("SysAllocString failed: not enough memory\n"));
    return;
  }

  BSTR descr = SysAllocString(L"Description");
  if (!descr)
  {
    TRACE(_T("SysAllocString failed: not enough memory\n"));
    SysFreeString(driveClassName);
    return;
  }

    if((hRes = m_pIWbemServices->GetObject(driveClassName,
                    WBEM_FLAG_USE_AMENDED_QUALIFIERS, // this is necessary to retrieve descriptions
                    NULL,
                    &pDriveClass,
                    NULL)) == S_OK)
  {

    m_outputList.ResetContent();

    //get class description
    hRes = pDriveClass->GetQualifierSet(&pQualSet);
    if (hRes == S_OK)
    {
      hRes = pQualSet->Get(descr, 0L, &pVal, NULL);
      if (hRes == S_OK)
      {
         m_outputList.AddString(CString(V_BSTR(&pVal)));
      }

      VariantClear(&pVal);
    }
    pQualSet->Release();

    //-------------------------------
    // Get the property names
    if((hRes = pDriveClass->GetNames(NULL,
                    WBEM_FLAG_ALWAYS |
                    WBEM_FLAG_NONSYSTEM_ONLY,
                    NULL,
                    &psaNames)) == S_OK)
    {
      //-------------------------------
      // Get the upper and lower bounds of the Names array
      if((hRes = SafeArrayGetLBound(psaNames, 1, &lLower)) != S_OK)
      {
        TRACE(_T("Couldn't get safe array lbound\n"));
        SafeArrayDestroy(psaNames);
        return;
      }

      //-------------------------------
      if((hRes = SafeArrayGetUBound(psaNames, 1, &lUpper)) != S_OK)
      {
        TRACE(_T("Couldn't get safe array ubound\n"));
        SafeArrayDestroy(psaNames);
        return;
      }

      //-------------------------------
      // For all properties...
      for (lCount = lLower; lCount <= lUpper; lCount++)
      {

        //-------------------------------
        // get the property name for this element
        if((hRes = SafeArrayGetElement(psaNames,
                        &lCount,
                        &PropName)) == S_OK)
        {

          // Get pointer to property qualifiers
          // this mess is due to the fact that system properties don't have qualifiers
          if ((pDriveClass->GetPropertyQualifierSet(PropName, &pQualSet)) == S_OK)
          {
            // Get and print description
            if ((pQualSet->Get(descr, 0L, &pVal, NULL)) == S_OK)
            {
              m_outputList.AddString(CString(V_BSTR(&pVal)));
            }
            VariantClear(&pVal);

            // done with the qualifierSet.
            if (pQualSet)
            {
              pQualSet->Release();
              pQualSet = NULL;
            }
          }

        }
        else // SafeArrayGetElement() failed
        {
          TRACE(_T("Couldn't get safe array element\n"));
          break;
        } //endif SafeArrayGetElement()

      } // endfor

      // cleanup.
      SysFreeString(PropName);
      SysFreeString(descr);
      SafeArrayDestroy(psaNames);
      VariantClear(&pVal);
    }
    else // pDriveClass->GetNames() failed
    {
      TRACE(_T("Couldn't GetNames\n"));
    } //endif pDriveClass->GetNames()

    // done with drive instance.
    if (pDriveClass)
    {
      pDriveClass->Release();
      pDriveClass = NULL;
    }
  } //endif GetObject()

}

void CAdvClientDlg::OnEnumdisks ( ) [protected]

Definition at line 40 of file onenumdisks.cpp.

{
  // these are for enumerating.
  HRESULT  hRes;
  ULONG uReturned;
  IWbemClassObject *pStorageDev = NULL;
  IEnumWbemClassObject *pEnumStorageDevs = NULL;

  // these help get properties.
  VARIANT pVal;
  BSTR propName = NULL;
    CString buf;

  // here's what we're looking for.
  // NOTE: make sure you specify a class that has a Provider()
  //  specified for it in the mof file. All other classes are
  //  abstract and wont be found using HMM_FLAG_SHALLOW. They
  //  will be found using HMM_FLAG_DEEP.
  BSTR className = SysAllocString(L"Win32_LogicalDisk");
  if (!className)
  {
    TRACE(_T("SysAllocString failed: not enough memory\n"));
    return;
  }

  // setup for the "__RELPATH" system property.
  propName = SysAllocString(L"__RELPATH");
  if (!propName)
  {
    SysFreeString(className);
    TRACE(_T("SysAllocString failed: not enough memory\n"));
    return;
  }

  VariantInit(&pVal);

  m_outputList.ResetContent();
  m_outputList.AddString(_T("working..."));

  TRACE(_T("Going for class\n"));

  //---------------------------
  // get the list of logical storage devices.
    if ((hRes = m_pIWbemServices->CreateInstanceEnum(className,
                        WBEM_FLAG_SHALLOW,
                        NULL,
                        &pEnumStorageDevs)) == S_OK)
  {
    TRACE(_T("good enumerator\n"));

    m_outputList.ResetContent();

    uReturned = 1;
    while(uReturned == 1)
    {
      //---------------------------
      // enumerate through the resultset.
      hRes = pEnumStorageDevs->Next(TIMEOUT,
                    1,
                    &pStorageDev,
                    &uReturned);

      TRACE(_T("Next() %d:%s\n"), uReturned, ErrorString(hRes));

      // was one found?
      if((hRes == S_OK) && (uReturned == 1))
      {

        TRACE(_T("Got a device class\n"));

        VariantClear(&pVal);

        // Add the path
        if (pStorageDev->Get(propName,
                    0L,
                    &pVal,
                    NULL, NULL) == S_OK)
        {
          TRACE(_T("Got a device path\n"));
           buf = V_BSTR(&pVal);
        }

        // add to the output listbox.
        m_outputList.AddString(buf);

        // cleanup for next loop
        VariantInit(&pVal);

        // Done with this object.
        if (pStorageDev)
        {
          pStorageDev->Release();

          // NOTE: pStorageDev MUST be set to NULL for the next all to Next().
          pStorageDev = NULL;
        }

      } // endif (hRes == S_OK)

        } // endwhile

    TRACE(_T("done enumming: %s\n"), ErrorString(hRes));

    // Done with this enumerator.
    if (pEnumStorageDevs)
    {
      pEnumStorageDevs->Release();
      pEnumStorageDevs = NULL;
    }
    }
  else // CreateInstanceEnum() failed.
  {
    TRACE(_T("CreateInstanceEnum() failed: %s\n"), ErrorString(hRes));

  } // endif CreateInstanceEnum()

  TRACE(_T("returning\n"));
}

void CAdvClientDlg::OnEnumservices ( ) [protected]

Definition at line 41 of file onenumsvcs.cpp.

{
  HRESULT  hRes;
  BSTR propName = NULL, val = NULL;
  VARIANT pVal;
  WCHAR *pBuf;
  CString clMyBuff, prop;
  ULONG uReturned;

  IWbemClassObject *pService = NULL;
  IEnumWbemClassObject *pEnumServices = NULL;

  BSTR qLang = SysAllocString(L"WQL");
  if (!qLang)
  {
    TRACE(_T("SysAllocString failed: not enough memory\n"));
    return;
  }

  BSTR query = SysAllocString(L"select * from Win32_Service");
  if (!query)
  {
    SysFreeString(qLang);
    TRACE(_T("SysAllocString failed: not enough memory\n"));
    return;
  }

  m_outputList.ResetContent();
  m_outputList.AddString(_T("working..."));

  //----------------------
  // execute the query.
  if((hRes = m_pIWbemServices->ExecQuery(qLang, query,
                    0L, NULL,
                    &pEnumServices)) == S_OK)
  {
    TRACE(_T("Executed query\n"));

    m_outputList.ResetContent();

    //----------------------
    // enumerate through services.
    while(((hRes = pEnumServices->Next(TIMEOUT, 1,
                    &pService, &uReturned)) == S_OK) &&
        (uReturned == 1))
    {
      // clear my output buffer.
      clMyBuff.Empty();

      //----------------------
      // different way to enumerate properties.
      if((hRes = pService->BeginEnumeration(WBEM_FLAG_NONSYSTEM_ONLY)) == S_OK)
      {
        //----------------------
        // try to get the next property.
        while(pService->Next(0, &propName,
                  &pVal, NULL, NULL) == S_OK)
        {
          // is it one of the 'names' we want?
          if((wcsncmp(propName, L"Name", 4) == 0) ||
            (wcsncmp(propName, L"DisplayName", 11) == 0) ||
            (wcsncmp(propName, L"PathName", 8) == 0))
          {
            // format the property=value/
            clMyBuff += propName;
            clMyBuff += _T("=");
            clMyBuff += ValueToString(&pVal, &pBuf);
            clMyBuff += _T("/");
            free(pBuf); // allocated by ValueToString()
          }

          // cleanup stuff used in the Next() loop.
          SysFreeString(propName);
          VariantClear(&pVal);
        }

        // did the while loop exit due to an error?
        if(hRes != S_OK)
        {
          TRACE(_T("pService->Next() failed %s\n"), ErrorString(hRes));
        }
      }
      else
      {
        TRACE(_T("BeginEnumeration() failed %s\n"), ErrorString(hRes));
      }

      // output the buffer.
      m_outputList.AddString(clMyBuff);

      //----------------------
      // free the iterator space.
      pService->EndEnumeration();

      // done with the ClassObject
      if (pService)
      {
        pService->Release();
        pService = NULL;
      }
    } //endwhile Next()

    TRACE(_T("walked query\n"));
    m_outputList.AddString(_T("Done Enumerating"));

    // did the while loop exit due to an error?
    if((hRes != S_OK) &&
       (hRes != 1))
    {
      TRACE(_T("pEnumServices->Next() failed %s\n"), ErrorString(hRes));
    }

    if (pEnumServices)
    {
      pEnumServices->Release();
      pEnumServices = NULL;
    }
  }
  else
  {
    TRACE(_T("ExecQuery() failed %s\n"), ErrorString(hRes));

  } //endif ExecQuery()

  SysFreeString(qLang);
  SysFreeString(query);
}

void CAdvClientDlg::OnEnumservicesasync ( ) [protected]

Definition at line 42 of file onasync.cpp.

{

  AfxMessageBox(__T("Please note that using asynchronous WMI APIs remotely in non-Kerberos domains \
requires that the client application lower its authentication level to RPC_C_AUTHN_LEVEL_NONE, \
which makes it less robust from the security standpoint. Use semi-synchronous access \
to WMI data and events instead.\n This sample sets the authentication level to RPC_C_AUTHN_LEVEL_PKT_PRIVACY, \
which means that the following asynchronous data query may fail if you are connecting remotely in a non-Kerberos environment."));

  HRESULT  hRes;

  BSTR qLang = SysAllocString(L"WQL");
  if (!qLang)
  {
    TRACE(_T("ExecQuery() failed: not enough memory\n"));
    return;
  }

  BSTR query = SysAllocString(L"select * from Win32_Service");
  if (!query)
  {
    TRACE(_T("ExecQuery() failed: not enough memory\n"));
    SysFreeString(qLang);
    return;
  }

  //---------------------------
  // allocate the sink if its not already allocated.
  if(m_pQueryCallback == NULL)
  {
    m_pQueryCallback = new CAsyncQuerySink(&m_outputList);
    if (m_pQueryCallback == NULL)
    {
      TRACE(_T("ExecQuery() failed: not enough memory\n"));
      SysFreeString(qLang);
      return;
    }
    m_pQueryCallback->AddRef();
  }

  m_outputList.ResetContent();
  m_outputList.AddString(_T("working..."));

  //---------------------------
  // execute the query. For *Async, the last parm is a sink object
  // that will be sent the resultset instead of returning the normal
  // enumerator object.
  if((hRes = m_pIWbemServices->ExecQueryAsync(qLang, query,
                      0L, NULL,
                      m_pQueryCallback)) == S_OK)
  {
    TRACE(_T("Executed query\n"));

    m_outputList.ResetContent();
  }
  else
  {
    TRACE(_T("ExecQuery() failed %s\n"), ErrorString(hRes));

  } //endif ExecQuery()

  SysFreeString(qLang);
  SysFreeString(query);

}

BOOL CAdvClientDlg::OnInitDialog ( ) [protected, virtual]

Definition at line 208 of file AdvClientdlg.cpp.

{
  CDialog::OnInitDialog();

  // Add "About..." menu item to system menu.

  // IDM_ABOUTBOX must be in the system command range.
  ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
  ASSERT(IDM_ABOUTBOX < 0xF000);

  CMenu* pSysMenu = GetSystemMenu(FALSE);
  if (pSysMenu != NULL)
  {
    CString strAboutMenu;
    strAboutMenu.LoadString(IDS_ABOUTBOX);
    if (!strAboutMenu.IsEmpty())
    {
      pSysMenu->AppendMenu(MF_SEPARATOR);
      pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
    }
  }

  //make scrollable horizontally by 5000 pixels
  m_outputList.SetHorizontalExtent(5000);

  return TRUE;  // return TRUE  unless you set the focus to a control
}

BOOL CAdvClientDlg::OnPermRegister ( ) [private]

Definition at line 59 of file onperm.cpp.

{
  BOOL retval = FALSE;
  IWbemClassObject *pConsumer = NULL;
  IWbemClassObject *pFilter = NULL;

  m_eventList.ResetContent();

  // switch to the root\cimv2\office namespace.
  if(EnsureOfficeNamespace())
  {
    if(GetConsumer(&pConsumer))
    {
      if(AddFilter(&pFilter))
      {
        if(AddBinding(pConsumer, pFilter))
        {
          retval = TRUE;
          m_eventList.AddString(_T("Permanent is ready"));
        }
        else
        {
          m_eventList.AddString(_T("Failed To Register"));
        } //endif AddBinding()
      }
      else
      {
      } //endif AddFilter()
    }
    else
    {
    } //endif AddConsumer()
  }
  return retval;
}

void CAdvClientDlg::OnPermUnregister ( ) [private]

Definition at line 95 of file onperm.cpp.

{
  HRESULT hRes;
  BSTR instName;

  if(EnsureOfficeNamespace())
  {
    // delete the filter instance.
    instName = SysAllocString(L"__EventFilter.Name=\"Sample Perm Query\"");
    if (!instName)
    {
      TRACE(_T("SysAllocString failed: not enough memory\n"));
      return;
    }
    if((hRes = m_pOfficeService->DeleteInstance(instName,
                          0L, NULL,
                          NULL)) != S_OK)
    {
      TRACE(_T("Cant delete filter, %s\n"), ErrorString(hRes));
    }
    SysFreeString(instName);

    // delete the association instance.
    // NOTE: Remember the triple backslashes on the inner quotes.
    instName = SysAllocString(L"__FilterToConsumerBinding.Consumer=\"SampleViewerConsumer.Name=\\\"Sample says:\\\"\",Filter=\"__EventFilter.Name=\\\"Sample Perm Query\\\"\"");
    if (!instName)
    {
      TRACE(_T("SysAllocString failed: not enough memory\n"));
      return;
    }
    if((hRes = m_pOfficeService->DeleteInstance(instName,
                          0L, NULL,
                          NULL)) != S_OK)
    {
      TRACE(_T("Cant delete association, %s\n"), ErrorString(hRes));
    }

    SysFreeString(instName);
  }
  m_eventList.ResetContent();
  m_eventList.AddString(_T("Permanent is removed"));
}

void CAdvClientDlg::OnRegPerm ( ) [protected]

Definition at line 42 of file onregister.cpp.

{
  // if registered.
  if(m_regPerm)
  {
    if(OnPermRegister())
    {
      m_regPerm = FALSE;
      m_perm.SetWindowText(_T("Unregister &Perm"));
    }
  }
  else
  {
    m_regPerm = TRUE;
    OnPermUnregister();
    m_perm.SetWindowText(_T("Register &Perm"));
  }

}

void CAdvClientDlg::OnRegTemp ( ) [protected]

Definition at line 83 of file onregister.cpp.

{
  if(m_regTemp)
  {
    if(OnTempRegister())
    {
      m_regTemp = FALSE;
      m_temp.SetWindowText(_T("Unregister &Temp"));
    }
  }
  else
  {
    m_regTemp = TRUE;
    OnTempUnregister();
    m_temp.SetWindowText(_T("Register &Temp"));
  }

}

void CAdvClientDlg::OnSysCommand | ( | UINT | nID,
 |  | LPARAM | lParam |
 | ) |  |  | [protected]

Definition at line 237 of file AdvClientdlg.cpp.

{
  if ((nID & 0xFFF0) == IDM_ABOUTBOX)
  {
    CAboutDlg dlgAbout;
    dlgAbout.DoModal();
  }
  else
  {
    CDialog::OnSysCommand(nID, lParam);
  }
}

BOOL CAdvClientDlg::OnTempRegister ( ) [private]

Definition at line 17 of file ontemp.cpp.

{
  HRESULT hr;

  if(EnsureOfficeNamespace())
  {

    //create a thread that would call ExecNotificationQuery() semi-synchronously and
    //poll for events

    hr = CoMarshalInterThreadInterfaceInStream(IID_IWbemServices,
                          m_pOfficeService,
                          &m_pStream);
    if (FAILED(hr))
    {
      m_eventList.AddString(_T("Failed to marshal IWbemServices pointer"));
      return FALSE;

    }

      m_thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)ThreadProc,
                (void *)this, 0, &m_threadId);

    if (m_thread == NULL)
    {
      m_eventList.AddString(_T("Failed to create event polling thread"));
      return FALSE;
    }

    return TRUE;
  }

  return FALSE;
}

void CAdvClientDlg::OnTempUnregister ( ) [private]

Definition at line 53 of file ontemp.cpp.

{

  if(EnsureOfficeNamespace())
  {
    StopThread();

    m_eventList.ResetContent();
    m_eventList.AddString(_T("unregistered"));

  }
}

BOOL CAdvClientDlg::PermRegistered ( ) [private]

Definition at line 25 of file onperm.cpp.

{
  HRESULT hRes;
  BOOL retval = FALSE;
  IWbemClassObject *pConsumerInst = NULL;
  BSTR instName = SysAllocString(L"__EventFilter.Name=\"Sample Perm Query\"");
  if (!instName)
  {
    TRACE(_T("SysAllocString failed: not enough memory\n"));
    return FALSE;
  }

  // switch to the root\cimv2\office namespace.
  if(EnsureOfficeNamespace())
  {
    // if the EventFilter is there...
    if((hRes = m_pOfficeService->GetObject(instName,
                        0L, NULL,
                        &pConsumerInst,
                        NULL)) == S_OK)
    {
      pConsumerInst->Release();
      pConsumerInst = NULL;

      // assume the perm sink is registered.
      retval = TRUE;
    }
  }

  SysFreeString(instName);
  return retval;
}

void CAdvClientDlg::StopThread ( ) [private]

Definition at line 67 of file ontemp.cpp.

{
    EnterCriticalSection(&m_critSect);

    if (m_thread != NULL)
  {
    //m_threadCmd = CT_EXIT;
    SetEvent(m_stopThread);
    WaitForSingleObject(m_ptrReady, 100);

        CloseHandle(m_thread);

        m_thread = NULL;
    }
    LeaveCriticalSection(&m_critSect);
}

DWORD WINAPI CAdvClientDlg::ThreadProc ( LPVOID lpParameter ) [static, private]

Definition at line 86 of file ontemp.cpp.

{

  CoInitialize(NULL);

  CAdvClientDlg * pThis = (CAdvClientDlg *)lpParameter;

  BSTR qLang = SysAllocString(L"WQL");
  if (!qLang)
  {
    (pThis->m_eventList).AddString(_T("SysAllocString failed"));
    SetEvent(pThis->m_ptrReady);
    return 1;
  }
  BSTR query = SysAllocString(L"select * from __InstanceCreationEvent where TargetInstance isa \"SAMPLE_OfficeEquipment\"");
  if (!query)
  {
    (pThis->m_eventList).AddString(_T("SysAllocString failed"));
    SetEvent(pThis->m_ptrReady);
    SysFreeString(qLang);
    return 1;
  }

  IWbemServices * pServices = NULL;
  (pThis->m_eventList).ResetContent();

  HRESULT hr = CoGetInterfaceAndReleaseStream(pThis->m_pStream,
                    IID_IWbemServices,
                    (void**)&pServices);
  if (FAILED(hr))
  {
    (pThis->m_eventList).AddString(_T("Failed to unmarshal interface: "));
    (pThis->m_eventList).AddString(ErrorString(hr));
    SetEvent(pThis->m_ptrReady);
    return 1;
  }

  (pThis->m_eventList).ResetContent();

  IEnumWbemClassObject * pEnumEvents = NULL;

  // execute the query.
  hr = pServices->ExecNotificationQuery(qLang, query,
                      WBEM_FLAG_RETURN_IMMEDIATELY | WBEM_FLAG_FORWARD_ONLY,
                      NULL, &pEnumEvents);

  SysFreeString(qLang);
  SysFreeString(query);

  if(hr == WBEM_S_NO_ERROR)
  {
    TRACE(_T("Executed event query\n"));
    (pThis->m_eventList).AddString(_T("Ready for events"));

    while(WaitForSingleObject((pThis->m_stopThread), 10) != WAIT_OBJECT_0)
    {
      IWbemClassObject * pEvent = NULL;
      ULONG uReturned = 0;

      //poll for an event
      hr = pEnumEvents->Next(100,
                  1,
                  &pEvent,
                  &uReturned);
      if (SUCCEEDED(hr) && uReturned > 0)
      {
        DisplayEvents(pThis, 1, &pEvent);
                pEvent->Release();
      }
    }

    //thread terminating:
    pEnumEvents->Release();

  }
  else
  {
    TRACE(_T("ExecNotificationQuery() failed %s\n"), ErrorString(hr));
    (pThis->m_eventList).AddString(_T("Failed To Register"));

  } //endif ExecQuery()

  SetEvent(pThis->m_ptrReady);

  return 0;

}

Member Data Documentation

CButton CAdvClientDlg::m_addEquipment

Definition at line 46 of file AdvClientdlg.h.

CButton CAdvClientDlg::m_connect

Definition at line 51 of file AdvClientdlg.h.

CRITICAL_SECTION CAdvClientDlg::m_critSect [private]

Definition at line 102 of file AdvClientdlg.h.

CButton CAdvClientDlg::m_diskDescriptions

Definition at line 42 of file AdvClientdlg.h.

CButton CAdvClientDlg::m_diskDetails

Definition at line 50 of file AdvClientdlg.h.

CButton CAdvClientDlg::m_enumDisks

Definition at line 49 of file AdvClientdlg.h.

CButton CAdvClientDlg::m_enumServices

Definition at line 48 of file AdvClientdlg.h.

CButton CAdvClientDlg::m_enumServicesAsync

Definition at line 47 of file AdvClientdlg.h.

CListBox CAdvClientDlg::m_eventList

Definition at line 43 of file AdvClientdlg.h.

CString CAdvClientDlg::m_namespace

Definition at line 53 of file AdvClientdlg.h.

CListBox CAdvClientDlg::m_outputList

Definition at line 52 of file AdvClientdlg.h.

CButton CAdvClientDlg::m_perm

Definition at line 44 of file AdvClientdlg.h.

IWbemServices* CAdvClientDlg::m_pIWbemServices [private]

Definition at line 86 of file AdvClientdlg.h.

IWbemServices* CAdvClientDlg::m_pOfficeService [private]

Definition at line 87 of file AdvClientdlg.h.

CAsyncQuerySink* CAdvClientDlg::m_pQueryCallback [private]

Definition at line 85 of file AdvClientdlg.h.

IStream* CAdvClientDlg::m_pStream [private]

Definition at line 98 of file AdvClientdlg.h.

HANDLE CAdvClientDlg::m_ptrReady [private]

Definition at line 100 of file AdvClientdlg.h.

BOOL CAdvClientDlg::m_regPerm [private]

Definition at line 83 of file AdvClientdlg.h.

BOOL CAdvClientDlg::m_regTemp [private]

Definition at line 83 of file AdvClientdlg.h.

HANDLE CAdvClientDlg::m_stopThread [private]

Definition at line 101 of file AdvClientdlg.h.

CButton CAdvClientDlg::m_temp

Definition at line 45 of file AdvClientdlg.h.

HANDLE CAdvClientDlg::m_thread [private]

Definition at line 104 of file AdvClientdlg.h.

DWORD CAdvClientDlg::m_threadId [private]

Definition at line 103 of file AdvClientdlg.h.

The documentation for this class was generated from the following files:
  • SysMgmt/WMI/VC/AdvClient/AdvClientdlg.h
  • SysMgmt/WMI/VC/AdvClient/AdvClientdlg.cpp
  • SysMgmt/WMI/VC/AdvClient/onaddequipment.cpp
  • SysMgmt/WMI/VC/AdvClient/onasync.cpp
  • SysMgmt/WMI/VC/AdvClient/onconnect.cpp
  • SysMgmt/WMI/VC/AdvClient/ondiskdetails.cpp
  • SysMgmt/WMI/VC/AdvClient/OnDiskPropsDescriptions.cpp
  • SysMgmt/WMI/VC/AdvClient/onenumdisks.cpp
  • SysMgmt/WMI/VC/AdvClient/onenumsvcs.cpp
  • SysMgmt/WMI/VC/AdvClient/onperm.cpp
  • SysMgmt/WMI/VC/AdvClient/onregister.cpp
  • SysMgmt/WMI/VC/AdvClient/ontemp.cpp
Generated on Wed Nov 13 2024 16:55:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAdvRecoApp Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes

CAdvRecoApp Class Reference

#include "AdvReco.h"

Inherits IInkCollectorEventsImpl< CAdvRecoApp >, and IInkRecognitionEventsImpl< CAdvRecoApp >.

List of all members.

Public Types

enum {
mc_iSubmenuRecognizers = 1, mc_iSubmenuInputScopes = 2, mc_iSubmenuGuides = 3, mc_iSubmenuModes = 4,
mc_iInputWndId = 1, mc_iOutputWndId = 2, mc_iStatusWndId = 3, mc_iSSGestLVId = 4,
mc_iMSGestLVId = 5, mc_iNumRowsCols = 100, mc_iGuideColWidth = 100, mc_iGuideRowHeight = 100,
mc_cxBoxMargin = 4, mc_cyBoxMargin = 4, mc_cxGestLVWidth = 160, mc_cNumSSGestures = 36,
mc_cNumMSGestures = 6, mc_iPenWidth = 5
}

Public Member Functions

CAdvRecoApp ()
bool | CreateChildWindows ()
bool | GetGestureName (InkApplicationGesture idGesture, UINT &idGestureName)
HMENU | LoadMenu ()
LRESULT | OnClear (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnCreate (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
LRESULT | OnDestroy (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
LRESULT | OnExit (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
HRESULT | OnGesture (IInkCursor *pIInkCursor, IInkStrokes *pIInkStrokes, VARIANT vGestures, VARIANT_BOOL *pbCancel)
LRESULT | OnGuide (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnInputScope (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnInputScopeCoerce (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnLVColumnClick (int idCtrl, LPNMHDR pnmh, BOOL &bHandled)
LRESULT | OnLVItemChanging (int idCtrl, LPNMHDR pnmh, BOOL &bHandled)
LRESULT | OnMode (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
HRESULT | OnRecognitionWithAlternates (IInkRecognitionResult *pIInkRecoResult, VARIANT vCustomParam, InkRecognitionStatus RecognitionStatus)
LRESULT | OnRecognize (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnRecognizer (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnSetFocus (UINT, WPARAM, LPARAM, BOOL &bHandled)
LRESULT | OnSize (UINT, WPARAM, LPARAM, BOOL &bHandled)
HRESULT | OnStroke (IInkCursor *pIInkCursor, IInkStrokeDisp *pIInkStroke, VARIANT_BOOL *pbCancel)
void | PresetGestures ()
void | UpdateInputScopeMenu ()
void | UpdateLayout ()
void | UpdateMenuRadioItems (UINT iSubMenu, UINT idCheck, UINT idUncheck)
void | UpdateStatusBar ()
bool | UseRecognizer (IInkRecognizer *pIInkRecognizer)

Static Public Member Functions

static int | Run (int nCmdShow)

Public Attributes

bool | m_bAllMSGestures
bool | m_bAllSSGestures
bool | m_bCoerceInputScope
CComBSTR | m_bstrCurRecoName
HWND | m_hwndMSGestLV
HWND | m_hwndSSGestLV
HWND | m_hwndStatusBar
UINT m_nCmdGuide
UINT m_nCmdInputScope
UINT m_nCmdMode
UINT m_nCmdRecognizer
CComPtr< IInkCollector > | m_spIInkCollector
CComPtr< IInkDisp > | m_spIInkDisp
CComPtr< IInkRecognizerContext > | m_spIInkRecoContext
CComPtr< IInkRecognizers > | m_spIInkRecognizers
CComPtr< IInkRecognizerGuide > | m_spIInkRecoGuide
CComPtr< IInkRenderer > | m_spIInkRenderer
CComPtr< IInkStrokes > | m_spIInkStrokes
SIZE | m_szGuideBox
CInkInputWnd m_wndInput
CRecoOutputWnd m_wndResults

Detailed Description

Definition at line 26 of file AdvReco.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
mc_iSubmenuRecognizers
mc_iSubmenuInputScopes
mc_iSubmenuGuides
mc_iSubmenuModes
mc_iInputWndId
mc_iOutputWndId
mc_iStatusWndId
mc_iSSGestLVId
mc_iMSGestLVId
mc_iNumRowsCols
mc_iGuideColWidth
mc_iGuideRowHeight
mc_cxBoxMargin
mc_cyBoxMargin
mc_cxGestLVWidth
mc_cNumSSGestures
mc_cNumMSGestures
mc_iPenWidth

Definition at line 34 of file AdvReco.h.

         {
        // submenus indices
        mc_iSubmenuRecognizers = 1,
        mc_iSubmenuInputScopes = 2,
        mc_iSubmenuGuides = 3,
        mc_iSubmenuModes = 4,
        // child windows IDs
        mc_iInputWndId = 1,
        mc_iOutputWndId = 2,
        mc_iStatusWndId = 3,
        mc_iSSGestLVId = 4,
        mc_iMSGestLVId = 5,
        // recognition guide box data
        mc_iNumRowsCols = 100,
        mc_iGuideColWidth = 100,
        mc_iGuideRowHeight = 100,
        mc_cxBoxMargin = 4,
        mc_cyBoxMargin = 4,
        // the width of the gesture list views
        mc_cxGestLVWidth = 160,
        // the number of the gesture names in the string table
        mc_cNumSSGestures = 36,     // single stroke gestures
        mc_cNumMSGestures =  6,     // multi-stroke gestures
        // pen width
        mc_iPenWidth = 5
    };

Constructor & Destructor Documentation

CAdvRecoApp::CAdvRecoApp ( ) [inline]

Definition at line 92 of file AdvReco.h.

                  :
        m_hwndStatusBar(NULL), m_hwndSSGestLV(NULL), m_hwndMSGestLV(NULL),
        m_bCoerceInputScope(false),
        m_nCmdGuide(0), m_nCmdInputScope(0), m_nCmdRecognizer(0), m_nCmdMode(0),
        m_bAllSSGestures(true), m_bAllMSGestures(true)
    {
        m_szGuideBox.cx = m_szGuideBox.cy = 0;
    }

Member Function Documentation

bool CAdvRecoApp::CreateChildWindows ( )

Definition at line 1844 of file AdvReco.cpp.

{
    if ((m_wndInput.Create(m_hWnd, CWindow::rcDefault, NULL,
                           WS_CHILD, WS_EX_CLIENTEDGE, (UINT)mc_iInputWndId) == NULL)
        || (m_wndResults.Create(m_hWnd, CWindow::rcDefault, NULL,
                                WS_CHILD, WS_EX_CLIENTEDGE, (UINT)mc_iOutputWndId) == NULL))
    {
        return false;
    }

    HINSTANCE hInst = _Module.GetResourceInstance();

    // Create a listview control for the list of the single stroke gestures
    m_hwndSSGestLV = ::CreateWindowEx(WS_EX_CLIENTEDGE, WC_LISTVIEW, NULL,
                                      WS_VISIBLE | WS_CHILD | WS_BORDER | LVS_REPORT,
                                      0, 0, 1, 1,
                                      m_hWnd, (HMENU)mc_iSSGestLVId,
                                      _Module.GetModuleInstance(), NULL);
    if (NULL == m_hwndSSGestLV)
        return false;

    //
    ListView_SetExtendedListViewStyleEx(m_hwndSSGestLV, LVS_EX_CHECKBOXES, LVS_EX_CHECKBOXES);

    // Create a column
    LV_COLUMN lvC;
    lvC.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
    lvC.fmt = LVCFMT_LEFT;
    lvC.iSubItem = 0;
    lvC.cx = mc_cxGestLVWidth - 22;
    lvC.pszText = TEXT("Single Stroke Gestures");
    if (-1 == ListView_InsertColumn(m_hwndSSGestLV, lvC.iSubItem, &lvC))
        return false;

    // Insert items - the names of the single stroke gestures.
    TCHAR szText[100];  // large enough to load a gesture name into
    LV_ITEM lvItem;
    lvItem.mask = LVIF_TEXT /*| LVIF_IMAGE*/ | LVIF_STATE;
    lvItem.state = 0;
    lvItem.stateMask = 0;
    lvItem.pszText = szText;
    lvItem.iSubItem = 0;
    for (int i = 0; i < mc_cNumSSGestures; i++)
    {
        lvItem.iItem = i;
        // Load the names from the application resource, there should be
        // mc_cNumSSGestures names there with sequential id's starting
        // with IDS_SSGESTURE_FIRST
        ::LoadString(hInst, IDS_SSGESTURE_FIRST + i, szText, countof(szText));
        if (-1 == ListView_InsertItem(m_hwndSSGestLV, &lvItem))
            return false;
    }

    // Create a listview control for the list of the multi-stroke gestures
    m_hwndMSGestLV = ::CreateWindowEx(WS_EX_CLIENTEDGE, WC_LISTVIEW, NULL,
                                      WS_VISIBLE | WS_CHILD | WS_BORDER | LVS_REPORT,
                                      0, 0, 1, 1,
                                      m_hWnd, (HMENU)mc_iMSGestLVId,
                                      _Module.GetModuleInstance(), NULL);
    if (NULL == m_hwndMSGestLV)
        return false;
    //
    ListView_SetExtendedListViewStyleEx(m_hwndMSGestLV, LVS_EX_CHECKBOXES, LVS_EX_CHECKBOXES);

    // Create a column
    lvC.pszText = TEXT("Multiple Stroke Gestures");
    ListView_InsertColumn(m_hwndMSGestLV, lvC.iSubItem, &lvC);

    // Insert items - the names of the single stroke gestures.
    for (i = 0; i < mc_cNumMSGestures; i++)
    {
        lvItem.iItem = i;
        // Load the names from the application resource, there should be
        // mc_cNumMSGestures names there with sequential id's starting
        // with IDS_MSGESTURE_FIRST
        ::LoadString(hInst, IDS_MSGESTURE_FIRST + i, szText, countof(szText));
        if (-1 == ListView_InsertItem(m_hwndMSGestLV, &lvItem))
            return false;
    }

    // Create a status bar (Ignore if it fails, the application can live without it).
    m_hwndStatusBar = ::CreateStatusWindow(
                        WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN|WS_CLIPSIBLINGS|SBARS_SIZEGRIP,
                        NULL, m_hWnd, (UINT)mc_iStatusWndId);
    if (NULL != m_hwndStatusBar)
    {
        ::SendMessage(m_hwndStatusBar,
                      WM_SETFONT,
                      (LPARAM)::GetStockObject(DEFAULT_GUI_FONT), FALSE);
    }

    // Update the child windows' positions and sizes so that they cover
    // entire client area of the main window.
    UpdateLayout();

    return true;
}

bool CAdvRecoApp::GetGestureName | ( | InkApplicationGesture | idGesture,
 |  | UINT & | idGestureName
 | ) |  |

Definition at line 2129 of file AdvReco.cpp.

{
    idGestureName = IDS_GESTURE_UNKNOWN;

    // This function should not be called when the collection mode is ICM_InkOnly
    if (ID_MODE_INK == m_nCmdMode)
        return false;

    // First, try to find the gesture among the single stroke ones
    int iCount = countof(gc_igtSingleStrokeGestures);
    for (int i = 0; i < iCount; i++)
    {
        if (gc_igtSingleStrokeGestures[i] == igtGesture)
        {
            idGestureName = IDS_SSGESTURE_FIRST + i;
            break;
        }
    }

    // If this is not a known single stroke gesture and the current collection mode
    // is ICM_GestureOnly, this may be a multi-stroke one.
    if (i == iCount && ID_MODE_GESTURES == m_nCmdMode)
    {
        iCount = countof(gc_igtMultiStrokeGestures);
        for (i = 0; i < iCount; i++)
        {
            if (gc_igtMultiStrokeGestures[i] == igtGesture)
            {
                idGestureName = IDS_MSGESTURE_FIRST + i;
                break;
            }
        }
    }

    return (IDS_GESTURE_UNKNOWN != idGestureName);
}

HMENU CAdvRecoApp::LoadMenu ( )

Definition at line 1309 of file AdvReco.cpp.

{
    HRESULT hr = S_OK;

    // Create the enumerator for the installed recognizers
    hr = m_spIInkRecognizers.CoCreateInstance(CLSID_InkRecognizers);
    if (FAILED(hr))
        return NULL;

    // Get the number of the recognizers known to the system
    LONG lCount = 0;
    hr = m_spIInkRecognizers->get_Count(&lCount);
    if (0 == lCount)
    {
        ::MessageBox(NULL, TEXT("There are no handwriting recognizers installed.\n")
                     TEXT("You need to have at least one in order to run this sample.\nExiting."),
                     gc_szAppName, MB_ICONERROR | MB_OK);
        return NULL;
    }

    // Load the menu of the main window
    HMENU hMenu = ::LoadMenu(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MENU));
    if (NULL == hMenu)
        return NULL; // Not normal

    MENUITEMINFOW miinfo;
    memset(&miinfo, 0, sizeof(miinfo));
    miinfo.cbSize = sizeof(miinfo);
    miinfo.fMask = MIIM_ID | MIIM_STATE | MIIM_FTYPE | MIIM_STRING;
    miinfo.fType = MFT_RADIOCHECK | MFT_STRING;

    // Get the submenu id for the recognizers menu.
    // This submenu will contain the list of installed recognizers
    HMENU hSubMenu = ::GetSubMenu(hMenu, mc_iSubmenuRecognizers);
    if (hSubMenu)
    {
        CComPtr<IInkRecognizer> spIInkRecognizer;

        // The ID_RECOGNIZER_FIRST is defined in the resource.h file.
        // It's the base id for the commands that fill this submenu
        miinfo.wID = ID_RECOGNIZER_FIRST;
        miinfo.fState = 0;
        for (LONG i = 0; i < lCount; i++, miinfo.wID++)
        {
            if (FAILED(m_spIInkRecognizers->Item(i, &spIInkRecognizer)))
                continue;

            // Filter out non-language recognizers by checking for
            // the languages supported by the recognizer - there'll be
            // none if it's a gesture or object recognizer.
            CComVariant vLanguages;
            if (SUCCEEDED(spIInkRecognizer->get_Languages(&vLanguages)))
            {
                if ((VT_ARRAY == (VT_ARRAY & vLanguages.vt))            // it should be an array
                    && (NULL != vLanguages.parray)
                    && (0 < vLanguages.parray->rgsabound[0].cElements)) // with at least one element
                {
                    CComBSTR bstrName;
                    if (SUCCEEDED(spIInkRecognizer->get_Name(&bstrName)))
                    {
                        miinfo.dwTypeData = bstrName;
                        ::InsertMenuItemW(hSubMenu, (UINT)-1, TRUE, &miinfo);
                    }
                }
                spIInkRecognizer.Release();
            }
        }
    }

    // Get the Input Scope submenu and create command items
    // for each input scope name defined in gc_pwsInputScopes[]
    hSubMenu = ::GetSubMenu(hMenu, mc_iSubmenuInputScopes);
    if (hSubMenu)
    {
        // The ID_INPUTSCOPE_FIRST is defined in the resource.h file.
        // It's the base id for the commands that fill this submenu
        miinfo.wID = ID_INPUTSCOPE_FIRST;
        miinfo.fState = 0;
        lCount = countof(gc_pwsInputScopes);
        for(LONG i = 0; i < lCount; i++, miinfo.wID++)
        {

            // Set the input scope menu item text.  If the text
            // length exceeds the maximum allowed value, then truncate
            // it and append "...".
            if (wcslen(gc_pwsInputScopes[i]) <= gc_lMaxInputScopeMenuItemLength)
            {
                miinfo.dwTypeData = gc_pwsInputScopes[i];
            }
            else
            {
                CComBSTR bstrInputScope(gc_lMaxInputScopeMenuItemLength-3, gc_pwsInputScopes[i]);
                bstrInputScope += L"...";
                miinfo.dwTypeData = bstrInputScope;
            }

            ::InsertMenuItemW(hSubMenu, (UINT)-1, TRUE, &miinfo);
        }
    }

    return hMenu;
}

LRESULT CAdvRecoApp::OnClear | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 1219 of file AdvReco.cpp.

{
    if (m_spIInkDisp != NULL)
    {
        // Delete all strokes from the Ink object, ignore returned value
        m_spIInkDisp->DeleteStrokes(0);

        // Release the old stroke collection and get an empty one
        m_spIInkStrokes.Release();
        CComVariant vt(0);
        if (FAILED(m_spIInkDisp->CreateStrokes(vt, &m_spIInkStrokes)))
        {
            MessageBox(TEXT("Failed to get the stroke collection from the Ink object!"),
                       gc_szAppName, MB_ICONERROR | MB_OK);
        }

        // Attach the new stroke collection to the recognition context.
        // If get_Strokes has failed, m_spIInkStrokes is NULL, so no
        // stroke collection will be attached to the context
        if (m_spIInkRecoContext != NULL)
        {
            if (FAILED(m_spIInkRecoContext->putref_Strokes(m_spIInkStrokes)))
            {
                MessageBox(TEXT("Failed to attach the stroke collection to the recognition context!"),
                           gc_szAppName, MB_ICONERROR | MB_OK);
            }
        }
    }

    // Update the child windows
    m_wndResults.ResetResults();    // empties the strings
    m_wndResults.Invalidate();
    m_wndInput.Invalidate();

    return 0;
}

LRESULT CAdvRecoApp::OnCreate | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 331 of file AdvReco.cpp.

{
    // Create child windows for ink input and recognition output,
    // listview controls for the lists of gestures, and a status bar
    if (false == CreateChildWindows())
        return -1;

    HRESULT hr;

    // Create an ink collector object.
    hr = m_spIInkCollector.CoCreateInstance(CLSID_InkCollector);
    if (FAILED(hr))
        return -1;

    // Get a pointer to the ink object interface.
    hr = m_spIInkCollector->get_Ink(&m_spIInkDisp);
    if (FAILED(hr))
        return -1;

    // Get an empty ink strokes collection from the ink object.
    // It'll be used as a storage for the ink
    hr = m_spIInkDisp->get_Strokes(&m_spIInkStrokes);
    if (FAILED(hr))
        return -1;

    // Establish a connection to the collector's event source.
    // Depending on the selected collection mode, the application will be
    // listening to either Stroke or Gesture events, or both.
    hr = IInkCollectorEventsImpl<CAdvRecoApp>::DispEventAdvise(m_spIInkCollector);
    // There is nothing interesting the application can do without events
    // from the ink collector
    if (FAILED(hr))
        return -1;

    // Set the recommended subset of gestures
    PresetGestures();

    // Enable ink input in the m_wndInput window
    hr = m_spIInkCollector->put_hWnd((long)m_wndInput.m_hWnd);
    if (FAILED(hr))
        return -1;
    hr = m_spIInkCollector->put_Enabled(VARIANT_TRUE);
    if (FAILED(hr))
        return -1;

    // Create a recognizer guide object
    if (SUCCEEDED(m_spIInkRecoGuide.CoCreateInstance(CLSID_InkRecognizerGuide)))
    {
        _InkRecoGuide irg;
        irg.midline = -1;                   // not use midline
        irg.cRows = irg.cColumns = 0;       // no guide lines
        ::SetRect(&irg.rectWritingBox, 0, 0, mc_iGuideColWidth, mc_iGuideRowHeight);
        // Make the guide's DrawnBox a little smaller than the the actual area
        // in which a user is expected to draw the ink (WritingBox)
        irg.rectDrawnBox = irg.rectWritingBox;
        ::InflateRect(&irg.rectDrawnBox, -mc_cxBoxMargin, -mc_cyBoxMargin);

        // Set the m_wndInput's guide data
        m_wndInput.SetGuide(irg);

        // Use IInkRenderer to transform the guide boxes rectangles
        // into ink space coordinates
        hr = m_spIInkCollector->get_Renderer(&m_spIInkRenderer);
        if (SUCCEEDED(hr))
        {
            HDC hdc = m_wndInput.GetDC();
            if (NULL != hdc)
            {
                // Convert the guide's writing box
                m_spIInkRenderer->PixelToInkSpace((long)hdc,
                                                  &irg.rectWritingBox.left,
                                                  &irg.rectWritingBox.top);
                m_spIInkRenderer->PixelToInkSpace((long)hdc,
                                                  &irg.rectWritingBox.right,
                                                  &irg.rectWritingBox.bottom);
                // and the drawn box
                m_spIInkRenderer->PixelToInkSpace((long)hdc,
                                                  &irg.rectDrawnBox.left,
                                                  &irg.rectDrawnBox.top);
                m_spIInkRenderer->PixelToInkSpace((long)hdc,
                                                  &irg.rectDrawnBox.right,
                                                  &irg.rectDrawnBox.bottom);
                // Initialize the guide
                hr = m_spIInkRecoGuide->put_GuideData(irg);
                ReleaseDC(hdc);
            }
            else
            {
                hr = E_FAIL;
            }
        }

        // Don't use m_spIInkRecoGuide if failed to set the guide data
        if (FAILED(hr))
        {
            m_spIInkRecoGuide.Release();
        }
    }

    return 0;
}

LRESULT CAdvRecoApp::OnDestroy | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 454 of file AdvReco.cpp.

{
    // Disable ink input and release the InkCollector object
    if (m_spIInkCollector != NULL)
    {
        IInkCollectorEventsImpl<CAdvRecoApp>::DispEventUnadvise(m_spIInkCollector);
        m_spIInkCollector->put_Enabled(VARIANT_FALSE);
        m_spIInkCollector.Release();
    }

    // Detach the strokes collection from the recognition context
    // and stop listening to the recognition events
    if (m_spIInkRecoContext != NULL)
    {
        m_spIInkRecoContext->EndInkInput();
        IInkRecognitionEventsImpl<CAdvRecoApp>::DispEventUnadvise(m_spIInkRecoContext);
        m_spIInkRecoContext.Release();
    }

    // Release the other objects and collections
    m_spIInkRecoGuide.Release();
    m_spIInkStrokes.Release();
    m_spIInkRecognizers.Release();

    // Post a WM_QUIT message to the application's message queue
    ::PostQuitMessage(0);

    return 0;
}

LRESULT CAdvRecoApp::OnExit | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 1277 of file AdvReco.cpp.

{
    // Close the application window
    SendMessage(WM_CLOSE);
    return 0;
}

HRESULT CAdvRecoApp::OnGesture | ( | IInkCursor * | pIInkCursor,
 |  | IInkStrokes * | pIInkStrokes,
 |  | VARIANT | vGestures,
 |  | VARIANT_BOOL * | pbCancel
 | ) |  |

Definition at line 586 of file AdvReco.cpp.

{
    if (((VT_ARRAY | VT_DISPATCH) != vGestures.vt) || (NULL == vGestures.parray))
        return E_INVALIDARG;
    if (0 == vGestures.parray->rgsabound->cElements)
        return E_INVALIDARG;

    // The gestures in the array are supposed to be ordered by their recognition
    // confidence level. This sample picks up the top one.
    // NOTE: when in the InkAndGesture collection mode, besides the gestures expected
    // by the application there also can come a gesture object with the id IAG_NoGesture
    // This application cancels the event if the object with ISG_NoGesture has
    // the top confidence level (the first item in the array).
    InkApplicationGesture idGesture = IAG_NoGesture;
    IDispatch** ppIDispatch;
    HRESULT hr = ::SafeArrayAccessData(vGestures.parray, (void HUGEP**)&ppIDispatch);
    if (SUCCEEDED(hr))
    {
        CComQIPtr<IInkGesture> spIInkGesture(ppIDispatch[0]);
        if (spIInkGesture != NULL)
        {
            hr = spIInkGesture->get_Id(&idGesture);
        }
        ::SafeArrayUnaccessData(vGestures.parray);
    }

    // Load the name of the gesture from the resource string table
    UINT idGestureName;
    bool bAccepted;     // will be true, if the gesture is known to this application
    if (IAG_NoGesture != idGesture)
    {
        bAccepted = GetGestureName(idGesture, idGestureName);
    }
    else    // ignore the event (IAG_NoGesture had the highest confidence level,
            // or something has failed
    {
        bAccepted = false;
        idGestureName = 0;
    }

    // If the current collection mode is ICM_GestureOnly or if we accept
    // the gesture, the gesture's strokes will be removed from the ink object,
    // So, the window needs to be updated in the strokes' area.
    if (ID_MODE_GESTURES == m_nCmdMode || true == bAccepted)
    {
        // Get the rectangle to update.
        RECT rc;
        CComPtr<IInkRectangle> spIInkRect;
        if (m_spIInkRenderer != NULL
            && pInkStrokes != NULL
            && SUCCEEDED(pInkStrokes->GetBoundingBox(IBBM_Default, &spIInkRect))
            && SUCCEEDED(spIInkRect->GetRectangle(&rc.top, &rc.left,
                                                  &rc.bottom, &rc.right)))
        {
            // Transform the bounding box coordinates from ink space to screen
            HDC hdc = m_wndInput.GetDC();
            if (NULL != hdc)
            {
                if (FAILED(m_spIInkRenderer->InkSpaceToPixel((long)hdc, &rc.left, &rc.top))
                    || FAILED(m_spIInkRenderer->InkSpaceToPixel((long)hdc, &rc.right,
                                                                &rc.bottom)))
                {
                    // Failed mapping from ink space to screen,
                    // update entire client area of the input window
                    m_wndInput.GetClientRect(&rc);
                }
                ReleaseDC(hdc);
            }
            else
            {
                // Failed getting an hdc, update entire client area of the input window
                m_wndInput.GetClientRect(&rc);
            }
        }
        else
        {
            // Failed getting the bounding box, update entire client area of the input window
            m_wndInput.GetClientRect(&rc);
        }

        m_wndInput.InvalidateRect(&rc);
    }
    else // if something's failed,
         // or the gesture is either unknown or unchecked in the list
    {
        // Reject the gesture. The InkCollector will fire Stroke event(s)
        // for the strokes, so they'll be handled in the OnStroke method.
        *pbCancel = VARIANT_TRUE;
        idGestureName = IDS_GESTURE_UNKNOWN;
    }

    // Update the results window as well
    m_wndResults.SetGestureName(idGestureName);
    m_wndResults.Invalidate();

    return hr;
}

LRESULT CAdvRecoApp::OnGuide | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 981 of file AdvReco.cpp.

{
    // Do nothing, if the InkRecoGuide object was not created,
    // or user selected the currently used type of guide.
    if (m_spIInkRecoGuide == NULL || wID == m_nCmdGuide)
        return 0;

    // The sizes of the drawing and writing boxes of the guide were set
    // in CAdvRecoApp::OnCreate, when the guide object was created.
    // There is no need to modify them in order to switch the guide from
    // one type to another. This can be done by setting the guides properties
    // Rows and Columns to 0 or not 0.
    int cRows = 0, cColumns = 0;
    if (ID_GUIDE_LINES == wID || ID_GUIDE_BOXES == wID)
    {
        cRows = mc_iNumRowsCols;
        if (ID_GUIDE_BOXES == wID)
        {
            cColumns = mc_iNumRowsCols;
        }
    }

    // Put the new values
    if (SUCCEEDED(m_spIInkRecoGuide->put_Rows(cRows))
        && SUCCEEDED(m_spIInkRecoGuide->put_Columns(cColumns)))
    {
        HRESULT hr = S_OK;
        if (m_spIInkRecoContext != NULL)
        {
            // Need to reset the recognition context in order to change the property
            if (m_spIInkStrokes != NULL)
            {
                m_spIInkRecoContext->putref_Strokes(NULL);
            }

            // Set the updated guide
            hr = m_spIInkRecoContext->putref_Guide(m_spIInkRecoGuide);

            // Re-attach the stroke collection to the context
            if (m_spIInkStrokes != NULL)
            {
                m_spIInkRecoContext->putref_Strokes(m_spIInkStrokes);
            }

            // Update the recognition results
            CComVariant vCustomData;    // no custom data
            m_spIInkRecoContext->BackgroundRecognizeWithAlternates(vCustomData);
        }

        if (SUCCEEDED(hr))
        {
            // Update the input window (this call will force it to redraw the guide).
            m_wndInput.SetRowsCols(cRows, cColumns);

            // Update the menu
            UpdateMenuRadioItems(mc_iSubmenuGuides, wID, m_nCmdGuide);

            // store the selected guide's associated command id
            m_nCmdGuide = wID;
        }
        else
        {
            MessageBox(TEXT("Error setting the guide to the recognition context.\n"),
                       gc_szAppName, MB_ICONERROR | MB_OK);
        }
    }
    else
    {
        MessageBox(TEXT("Error setting the guide's Rows and/or Columns property.\n"),
                   gc_szAppName, MB_ICONERROR | MB_OK);
    }

    return 0;
}

LRESULT CAdvRecoApp::OnInputScope | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 905 of file AdvReco.cpp.

{
    UINT iInputScope = wID - ID_INPUTSCOPE_FIRST;     // get the index to gc_pwsInputScopes
    // Return if user clicks on the currently selected Input Scope menu item or if
    // the command id is not in the valid range (shouldn't happen with error free code)
    if (wID == m_nCmdInputScope || iInputScope >= countof(gc_pwsInputScopes))
        return 0;

    // Tell the context to use the Input Scope, by assigning the input scope name
    // to the corresponding property of the context.
    if (m_spIInkRecoContext != NULL)
    {
        // Need to reset the recognition context in order to change the property
        if (m_spIInkStrokes != NULL)
        {
            m_spIInkRecoContext->putref_Strokes(NULL);
        }

        CComBSTR bstrInputScope(gc_pwsInputScopes[iInputScope]);
        HRESULT hr = m_spIInkRecoContext->put_Factoid(bstrInputScope);

        // Re-attach the stroke collection to the context
        if (m_spIInkStrokes != NULL)
        {
            m_spIInkRecoContext->putref_Strokes(m_spIInkStrokes);
        }

        if (SUCCEEDED(hr))
        {
            // Update the recognition results
            CComVariant vCustomData;    // no custom data
            m_spIInkRecoContext->BackgroundRecognizeWithAlternates(vCustomData);
        }
        else if (TPC_E_INVALID_PROPERTY == hr) // the input scope is not supported
        {
            MessageBox(TEXT("This factoid is not supported by the recognizer."),
                       gc_szAppName, MB_ICONINFORMATION | MB_OK);
            return 0;
        }
        else
        {
            MessageBox(TEXT("Failed to set the context's Factoid property!"),
                       gc_szAppName, MB_ICONERROR | MB_OK);
            return 0;
        }
    }

    // Update the menu and the status bar
    UpdateMenuRadioItems(mc_iSubmenuInputScopes, wID, m_nCmdInputScope);
    m_nCmdInputScope = wID;
    UpdateStatusBar();

    return 0;
}

LRESULT CAdvRecoApp::OnInputScopeCoerce | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 830 of file AdvReco.cpp.

{
    // Ignore the command if the recognition context
    // has not been created
    if (m_spIInkRecoContext == NULL )
        return 0;

    // Need to reset the recognition context to modify the property
    if (m_spIInkStrokes != NULL)
    {
        m_spIInkRecoContext->putref_Strokes(NULL);
    }

    // Reset the RecognitionFlags property of the recognition context
    if (FAILED(m_spIInkRecoContext->put_RecognitionFlags (m_bCoerceInputScope?IRM_None:IRM_Coerce)))
    {
        MessageBox(TEXT("Failed to reset the RecognitionFlags property!"),
                         gc_szAppName, MB_ICONERROR | MB_OK);

        // Re-attach the stroke collection to the context
        if (m_spIInkStrokes != NULL)
        {
            m_spIInkRecoContext->putref_Strokes(m_spIInkStrokes);
        }
        return 0;
    }

    m_bCoerceInputScope = !m_bCoerceInputScope;

    // Re-attach the stroke collection to the context
    if (m_spIInkStrokes != NULL)
    {
        m_spIInkRecoContext->putref_Strokes(m_spIInkStrokes);
    }

    // Update the recognition results
    CComVariant vCustomData;    // no custom data
    m_spIInkRecoContext->BackgroundRecognizeWithAlternates(vCustomData);

    // Update the menu item
    HMENU hMenu = GetMenu();
    if (NULL != hMenu)
    {
        HMENU hSubMenu = ::GetSubMenu(hMenu, mc_iSubmenuInputScopes);
        if (NULL != hSubMenu)
        {
            ::CheckMenuItem(hSubMenu, wID,
                            MF_BYCOMMAND | (m_bCoerceInputScope ? MF_CHECKED : MF_UNCHECKED));
        }
    }

    return 0;
}

LRESULT CAdvRecoApp::OnLVColumnClick | ( | int | idCtrl,
 |  | LPNMHDR | pnmh,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 1741 of file AdvReco.cpp.

{
    if (mc_iSSGestLVId == idCtrl)
    {
        m_bAllSSGestures = !m_bAllSSGestures;
        ListView_SetCheckState(m_hwndSSGestLV, -1, m_bAllSSGestures);
    }
    else if (mc_iMSGestLVId == idCtrl)
    {
        m_bAllMSGestures = !m_bAllMSGestures;
        ListView_SetCheckState(m_hwndMSGestLV, -1, m_bAllMSGestures);
    }
    else
    {
        bHandled = FALSE;
    }

    return 0;
}

LRESULT CAdvRecoApp::OnLVItemChanging | ( | int | idCtrl,
 |  | LPNMHDR | pnmh,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 1782 of file AdvReco.cpp.

{
    if (m_spIInkCollector == NULL)
        return FALSE;

    LPNMLISTVIEW pnmv = (LPNMLISTVIEW)pnmh;

    LRESULT lRet;

    // Ignore all the changes which are not of the item state,
    // and the item state changes other then checked/unchecked (LVIS_STATEIMAGEMASK)
    if (LVIF_STATE == pnmv->uChanged && 0 != (LVIS_STATEIMAGEMASK & pnmv->uNewState))
    {
        lRet = TRUE;   // prevent the change if something is wrong
        BOOL bChecked = ((LVIS_STATEIMAGEMASK & pnmv->uNewState) >> 12) == 2;
        InkApplicationGesture igtGesture = IAG_NoGesture;
        if (mc_iSSGestLVId == idCtrl)
        {
            if (pnmv->iItem >= 0 && pnmv->iItem < countof(gc_igtSingleStrokeGestures))
                igtGesture = gc_igtSingleStrokeGestures[pnmv->iItem];
        }
        else if (mc_iMSGestLVId == idCtrl)
        {
            if (pnmv->iItem >= 0 && pnmv->iItem < countof(gc_igtMultiStrokeGestures))
                igtGesture = gc_igtMultiStrokeGestures[pnmv->iItem];
        }

        if (IAG_NoGesture != igtGesture && SUCCEEDED(
            m_spIInkCollector->SetGestureStatus(igtGesture, bChecked ? VARIANT_TRUE : VARIANT_FALSE)))
        {
            // Allow the change in the control's item state
            lRet = FALSE;
        }
    }
    else
    {
        // Allow all the other changes
        lRet = FALSE;
    }

    return lRet;
}

LRESULT CAdvRecoApp::OnMode | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 1079 of file AdvReco.cpp.

{
    // Do nothing, id user selected the same mode.
    if (wID == m_nCmdMode)
        return 0;

    InkCollectionMode icm;
    switch (wID)
    {
        default:
            return 0;
        case ID_MODE_INK:
            icm = ICM_InkOnly;
            break;
        case ID_MODE_INK_AND_GESTURES:
            icm = ICM_InkAndGesture;
            break;
        case ID_MODE_GESTURES:
            icm = ICM_GestureOnly;
            break;
    }

    // Disable input to switch the collection mode
    if (m_spIInkCollector != NULL
        && SUCCEEDED(m_spIInkCollector->put_Enabled(VARIANT_FALSE)))
    {
        // Set the new mode
        if (SUCCEEDED(m_spIInkCollector->put_CollectionMode(icm)))
        {

            // Update the menu
            UpdateMenuRadioItems(mc_iSubmenuModes, wID, m_nCmdMode);
            m_nCmdMode = wID;  // store the selected mode's associated command id

            // Show or hide the gesture list views
            UpdateLayout();
        }
        else
        {
            TCHAR* pszErrorMsg;
            if (ID_MODE_INK == m_nCmdMode)
            {
                pszErrorMsg = TEXT("Unable to change the CollectionMode property on the ")
                              TEXT("InkCollector.\nA possible reason is that the selected ")
                              TEXT("mode requires there to be a gesture recognizer installed.");
            }
            else
            {
                pszErrorMsg = TEXT("Unable to change the CollectionMode property ")
                              TEXT("on the InkCollector.");
            }
            MessageBox(pszErrorMsg, gc_szAppName, MB_ICONERROR | MB_OK);
        }
        // Enable input
        if (FAILED(m_spIInkCollector->put_Enabled(VARIANT_TRUE)))
        {
            MessageBox(TEXT("Error enabling InkCollector after changing collection mode!"),
                       gc_szAppName, MB_ICONERROR | MB_OK);
        }
    }

    return 0;
}

HRESULT CAdvRecoApp::OnRecognitionWithAlternates | ( | IInkRecognitionResult * | pIInkRecoResult,
 |  | VARIANT | vCustomParam,
 |  | InkRecognitionStatus | RecognitionStatus
 | ) |  |

Definition at line 706 of file AdvReco.cpp.

{
    if (NULL == pIInkRecoResult)
        return E_INVALIDARG;

    // Reset the old results
    m_wndResults.ResetResults();

    // Get the best lCount results
    HRESULT hr;
    CComPtr<IInkRecognitionAlternates> spIInkRecoAlternates;
    hr = pIInkRecoResult->AlternatesFromSelection(
        0,                              // in: selection start
        -1,                             // in: selection length; -1 means "up to the last one"
        CRecoOutputWnd::mc_iNumResults, // in: the number of alternates we're interested in
        &spIInkRecoAlternates           // out: the receiving pointer
        );

    // Count the returned alternates, it may be less then we asked for
    long lCount = 0;
    if (SUCCEEDED(hr) && SUCCEEDED(spIInkRecoAlternates->get_Count(&lCount)))
    {
        // Get the alternate strings
        IInkRecognitionAlternate* pIInkRecoAlternate = NULL;
        for (LONG iItem = 0; (iItem < lCount) && (iItem < CRecoOutputWnd::mc_iNumResults); iItem++)
        {
            // Get the alternate string if there is one
            if (SUCCEEDED(spIInkRecoAlternates->Item(iItem, &pIInkRecoAlternate)))
            {
                BSTR bstr = NULL;
                if (SUCCEEDED(pIInkRecoAlternate->get_String(&bstr)))
                {
                    m_wndResults.m_bstrResults[iItem].Attach(bstr);
                }
                pIInkRecoAlternate->Release();
            }
        }
    }

    // Update the output window with the new results
    m_wndResults.Invalidate();

    return S_OK;
}

LRESULT CAdvRecoApp::OnRecognize | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 1164 of file AdvReco.cpp.

{
    if (m_spIInkRecoContext != NULL)
    {
        m_spIInkRecoContext->EndInkInput();

        // Recognize
        CComPtr<IInkRecognitionResult> spIInkRecoResult;
        InkRecognitionStatus ink_reco_status = IRS_NoError;
        if (SUCCEEDED(m_spIInkRecoContext->Recognize(&ink_reco_status, &spIInkRecoResult)))
        {
            CComVariant vCustomData;    // no custom data
            OnRecognitionWithAlternates(spIInkRecoResult, vCustomData, ink_reco_status);
        }
        else
        {
            MessageBox(TEXT("Error code returned from the context's Recognize method."),
                       gc_szAppName, MB_ICONERROR | MB_OK);
        }

        // Re-attach the stroke collection to the context
        if (m_spIInkStrokes != NULL)
        {
            if (FAILED(m_spIInkRecoContext->putref_Strokes(m_spIInkStrokes)))
            {
                MessageBox(TEXT("Failed to attach the stroke collection to the recognition context!"),
                           gc_szAppName, MB_ICONERROR | MB_OK);
            }
        }
    }

    return 0;
}

LRESULT CAdvRecoApp::OnRecognizer | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 773 of file AdvReco.cpp.

{
    if (m_spIInkRecognizers == NULL || wID == m_nCmdRecognizer)
        return 0;

    // Get a pointer to the recognizer object from the recognizer collection
    // Use DefaultRecognizer method to get a pointer to the default recognizer
    // or use index for any other one
    HRESULT hr;
    CComPtr<IInkRecognizer> spIInkRecognizer;
    if (ID_RECOGNIZER_DEFAULT == wID)
    {
        // The first parameter is the language id, passing 0 means that the language
        // id will be retrieved using the user default-locale identifier
        hr = m_spIInkRecognizers->GetDefaultRecognizer(0, &spIInkRecognizer);
    }
    else
    {
        hr = m_spIInkRecognizers->Item(wID - ID_RECOGNIZER_FIRST, &spIInkRecognizer);
    }

    // Create new recognition context
    if (SUCCEEDED(hr) && UseRecognizer(spIInkRecognizer))
    {
        // Update the menu and the status bar
        UpdateMenuRadioItems(mc_iSubmenuRecognizers, wID, m_nCmdRecognizer);
        m_bstrCurRecoName.Empty();
        spIInkRecognizer->get_Name(&m_bstrCurRecoName);
        UpdateStatusBar();
        // Store the selected recognizer's command id
        m_nCmdRecognizer = wID;
    }

    return 0;
}

LRESULT CAdvRecoApp::OnSetFocus | ( | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM | ,
 |  | BOOL & | bHandled
 | ) |  |
LRESULT CAdvRecoApp::OnSize | ( | UINT | ,
 |  | WPARAM | wParam,
 |  | LPARAM | ,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 504 of file AdvReco.cpp.

{
    if (wParam != SIZE_MINIMIZED)
    {
        UpdateLayout();
    }
    return 0;
}

HRESULT CAdvRecoApp::OnStroke | ( | IInkCursor * | pIInkCursor,
 |  | IInkStrokeDisp * | pIInkStroke,
 |  | VARIANT_BOOL * | pbCancel
 | ) |  |

Definition at line 539 of file AdvReco.cpp.

{
    if (NULL == pIInkStroke)
        return E_INVALIDARG;

    if (m_spIInkStrokes == NULL)
        return S_OK;

    // Add the new stroke to the collection
    HRESULT hr = m_spIInkStrokes->Add(pIInkStroke);
    if (SUCCEEDED(hr) && m_spIInkRecoContext != NULL)
    {
        // Cancel the previous background recognition requests
        // which have not been processed yet
        m_spIInkRecoContext->StopBackgroundRecognition();

        // Update the recognition results
        CComVariant vCustomData;    // no custom data
        m_spIInkRecoContext->BackgroundRecognizeWithAlternates(vCustomData);
    }
    return hr;
}

void CAdvRecoApp::PresetGestures ( )

Definition at line 2183 of file AdvReco.cpp.

{
    // This function should not be called before the listview controls have been created
    if (0 == ::IsWindow(m_hwndSSGestLV) || 0 == ::IsWindow(m_hwndMSGestLV))
        return;

    // Set the status of the single stroke gestures
    UINT iNumGestures = countof(gc_igtSingleStrokeGestures);
    UINT iNumSubset = countof(gc_nRecommendedForMixedMode);
    for (UINT i = 0; i < iNumSubset; i++)
    {
        if (gc_nRecommendedForMixedMode[i] < iNumGestures)
            ListView_SetCheckState(m_hwndSSGestLV, gc_nRecommendedForMixedMode[i], TRUE);
    }

    // Set the status of the multiple stroke gestures
    iNumGestures = countof(gc_igtMultiStrokeGestures);
    for (i = 0; i < iNumGestures; i++)
    {
        ListView_SetCheckState(m_hwndMSGestLV, i, TRUE);
    }
}

int CAdvRecoApp::Run ( int nCmdShow ) [static]

Definition at line 254 of file AdvReco.cpp.

{

    CAdvRecoApp theApp;

    // Load and update the menu before creating the main window.
    // Create menu items for the installed recognizers and for the
    // supported input scopes.
    HMENU hMenu = theApp.LoadMenu();
    if (NULL == hMenu)
        return 0;

    int iRet;

    // Load the icon from the resource and associate it with the window class
    WNDCLASSEX& wc = CAdvRecoApp::GetWndClassInfo().m_wc;
    wc.hIcon = wc.hIconSm = ::LoadIcon(_Module.GetResourceInstance(),
                                       MAKEINTRESOURCE(IDR_APPICON));

    // Create the application's main window
    if (theApp.Create(NULL, CWindow::rcDefault, gc_szAppName,
                      WS_OVERLAPPEDWINDOW, 0, (UINT)hMenu) != NULL)
    {
        // Initialize the application object:
        // Use no guides
        theApp.SendMessage(WM_COMMAND, ID_GUIDE_NONE);
        // Set input scope to default
        theApp.SendMessage(WM_COMMAND, ID_INPUTSCOPE_FIRST);
        // Create a recognition context with the default recognizer
        theApp.SendMessage(WM_COMMAND, ID_RECOGNIZER_DEFAULT);
        // Set the collection mode to ICM_InkOnly
        theApp.SendMessage(WM_COMMAND, ID_MODE_INK);

        // Show and update the main window
        theApp.ShowWindow(nCmdShow);
        theApp.UpdateWindow();

        // Run the boilerplate message loop
        MSG msg;
        while (::GetMessage(&msg, NULL, 0, 0) > 0)
        {
            ::TranslateMessage(&msg);
            ::DispatchMessage(&msg);
        }
        iRet = msg.wParam;
    }
    else
    {
        ::MessageBox(NULL, TEXT("Error creating the window"),
                     gc_szAppName, MB_ICONERROR | MB_OK);
        ::DestroyMenu(hMenu);
        iRet = 0;
    }

    return iRet;
}

void CAdvRecoApp::UpdateInputScopeMenu ( )

Definition at line 1431 of file AdvReco.cpp.

{
    HMENU hMenu = GetMenu();
    if (NULL != hMenu)
    {
        HMENU hSubMenu = ::GetSubMenu(hMenu, mc_iSubmenuInputScopes);
        if (NULL != hSubMenu)
        {
            if (m_spIInkRecoContext != NULL)
            {
                // Cache the current Factoid property so that we can revert later
                CComBSTR bstrInputScope;
                if (FAILED(m_spIInkRecoContext->get_Factoid(&bstrInputScope)))
                {
                    MessageBox(TEXT("Failed to get the context's Factoid property."),
                                gc_szAppName, MB_ICONERROR | MB_OK);
                    return;
                }

                // Need to reset the recognition context in order to change the Factoid property
                if (m_spIInkStrokes != NULL)
                {
                    m_spIInkRecoContext->putref_Strokes(NULL);
                }

                // Enable or disable the InputScope submenu items
                MENUITEMINFO miinfo;
                memset(&miinfo, 0, sizeof(miinfo));
                miinfo.cbSize = sizeof(miinfo);
                miinfo.fMask = MIIM_STATE;
                miinfo.wID = ID_INPUTSCOPE_FIRST;
                for(LONG i = 0; i < countof(gc_pwsInputScopes); i++, miinfo.wID++)
                {
                    CComBSTR bstrTestInputScope(gc_pwsInputScopes[i]);
                    HRESULT hr = m_spIInkRecoContext->put_Factoid(bstrTestInputScope);
                    if (FAILED(hr))
                    {
                        miinfo.fState = MFS_DISABLED;
                    }
                    else
                    {
                        miinfo.fState = MFS_ENABLED;
                    }
                    ::SetMenuItemInfo(hSubMenu, miinfo.wID, FALSE, &miinfo);

                }

                // Revert to the cached Factoid property
                if (FAILED(m_spIInkRecoContext->put_Factoid(bstrInputScope)))
                {
                    MessageBox(TEXT("Failed to set the context's Factoid property."),
                                gc_szAppName, MB_ICONERROR | MB_OK);
                }

                // Re-attach the stroke collection to the context
                if (m_spIInkStrokes != NULL)
                {
                    m_spIInkRecoContext->putref_Strokes(m_spIInkStrokes);
                }
            }
        }
    }
}

void CAdvRecoApp::UpdateLayout ( )

Definition at line 1960 of file AdvReco.cpp.

{
    RECT rect;
    GetClientRect(&rect);

    // update the size and position of the status bar
    if (::IsWindow(m_hwndStatusBar)
        && ((DWORD)::GetWindowLong(m_hwndStatusBar, GWL_STYLE) & WS_VISIBLE))
    {
        ::SendMessage(m_hwndStatusBar, WM_SIZE, 0, 0);
        RECT rectStatusBar;
        ::GetWindowRect(m_hwndStatusBar, &rectStatusBar);
        if (rect.bottom > rectStatusBar.bottom - rectStatusBar.top)
        {
            rect.bottom -= rectStatusBar.bottom - rectStatusBar.top;
        }
        else
        {
            rect.bottom = 0;
        }
    }

    // update the size and position of the gesture listviews
    if (::IsWindow(m_hwndSSGestLV) && ::IsWindow(m_hwndMSGestLV))
    {
        if (ID_MODE_INK != m_nCmdMode)
        {
            // calculate the rectangle covered by the list views
            RECT rcGest = rect;
            if (rcGest.right < mc_cxGestLVWidth)
            {
                rcGest.left = 0;
            }
            else
            {
                rcGest.left = rcGest.right - mc_cxGestLVWidth;
            }

            rect.right = rcGest.left;

            if (ID_MODE_GESTURES == m_nCmdMode)
            {
                int iHeight;
                RECT rcItem;
                if (TRUE == ListView_GetItemRect(m_hwndMSGestLV, 0, &rcItem, LVIR_BOUNDS))
                {
                    iHeight = rcItem.top + (rcItem.bottom - rcItem.top)
                                            * (countof(gc_igtMultiStrokeGestures) + 1);
                }
                else
                {
                    iHeight = (rcGest.bottom - rcGest.top) / 3;
                }

                // show the multiple stroke gesture listview control
                ::SetWindowPos(m_hwndMSGestLV, NULL,
                               rcGest.left, rcGest.bottom - iHeight,
                               rcGest.right - rcGest.left, iHeight,
                               SWP_NOZORDER | SWP_NOACTIVATE | SWP_SHOWWINDOW);
                rcGest.bottom -= iHeight;
            }
            else if (WS_VISIBLE ==
                    (((DWORD)::GetWindowLong(m_hwndMSGestLV, GWL_STYLE)) & WS_VISIBLE))
            {
                // hide the multiple stroke gesture listview control
                ::ShowWindow(m_hwndMSGestLV, SW_HIDE);
            }

            // show the single stroke gesture listview control
            ::SetWindowPos(m_hwndSSGestLV, NULL,
                           rcGest.left, rcGest.top,
                           rcGest.right - rcGest.left, rcGest.bottom - rcGest.top,
                           SWP_NOZORDER | SWP_NOACTIVATE | SWP_SHOWWINDOW);
        }
        else
        {
            // hide the single stroke gesture listview control
            if (WS_VISIBLE ==
                    (((DWORD)::GetWindowLong(m_hwndSSGestLV, GWL_STYLE)) & WS_VISIBLE))
            {
                ::ShowWindow(m_hwndSSGestLV, SW_HIDE);
            }
            // hide the multiple stroke gesture listview control
            if (WS_VISIBLE ==
                    (((DWORD)::GetWindowLong(m_hwndMSGestLV, GWL_STYLE)) & WS_VISIBLE))
            {
                ::ShowWindow(m_hwndMSGestLV, SW_HIDE);
            }
        }
    }

    // update the size and position of the output window
    if (::IsWindow(m_wndResults.m_hWnd))
    {
        int cyResultsWnd = m_wndResults.GetBestHeight();
        if (cyResultsWnd > rect.bottom)
        {
            cyResultsWnd = rect.bottom;
        }
        ::SetWindowPos(m_wndResults.m_hWnd, NULL,
                       rect.left, rect.bottom - cyResultsWnd,
                       rect.right - rect.left, cyResultsWnd - rect.top,
                       SWP_NOZORDER | SWP_NOACTIVATE | SWP_SHOWWINDOW);
        rect.bottom -= cyResultsWnd;
    }

    // update the size and position of the ink input window
    if (::IsWindow(m_wndInput.m_hWnd))
    {
        ::SetWindowPos(m_wndInput.m_hWnd, NULL,
                       rect.left, rect.top,
                       rect.right - rect.left, rect.bottom - rect.top,
                       SWP_NOZORDER | SWP_NOACTIVATE | SWP_SHOWWINDOW);
    }
}

void CAdvRecoApp::UpdateMenuRadioItems | ( | UINT | iSubMenu,
 |  | UINT | idCheck,
 |  | UINT | idUncheck
 | ) |  |

Definition at line 1513 of file AdvReco.cpp.

{
    // Update the menu
    HMENU hMenu = GetMenu();
    if (NULL != hMenu)
    {
        HMENU hSubMenu = ::GetSubMenu(hMenu, iSubMenu);
        if (NULL != hSubMenu)
        {
            MENUITEMINFO miinfo;
            miinfo.cbSize = sizeof(miinfo);
            miinfo.fMask = MIIM_STATE | MIIM_FTYPE;
            ::GetMenuItemInfo(hSubMenu, idCheck, FALSE, &miinfo);
            miinfo.fType |= MFT_RADIOCHECK;
            miinfo.fState |= MFS_CHECKED;
            ::SetMenuItemInfo(hSubMenu, idCheck, FALSE, &miinfo);
            if (0 != idUncheck)
            {
                ::GetMenuItemInfo(hSubMenu, idUncheck, FALSE, &miinfo);
                miinfo.fType |= MFT_RADIOCHECK;
                miinfo.fState &= ~MFS_CHECKED;
                ::SetMenuItemInfo(hSubMenu, idUncheck, FALSE, &miinfo);
            }
        }
    }
}

void CAdvRecoApp::UpdateStatusBar ( )

Definition at line 2090 of file AdvReco.cpp.

{
    if (NULL == m_hwndStatusBar)
        return;

    UINT iInputScope = m_nCmdInputScope - ID_INPUTSCOPE_FIRST;
    if (iInputScope >= sizeof(gc_pwsInputScopes)/sizeof(gc_pwsInputScopes[0]))
    {
        iInputScope = 0;
    }

    CComBSTR bstrStatus(m_bstrCurRecoName);

    // If an input scope is set, add to the status bar string
    if (m_nCmdInputScope != -1)
    {
        bstrStatus += L"; Input Scope: ";
        bstrStatus += gc_pwsInputScopes[iInputScope];
    }

    // Set the new text int the status bar
    ::SendMessage(m_hwndStatusBar, SB_SETTEXTW, NULL, (LPARAM)bstrStatus.m_str);
}

bool CAdvRecoApp::UseRecognizer ( IInkRecognizer * pIInkRecognizer )

Definition at line 1560 of file AdvReco.cpp.

{

    if (NULL == pIInkRecognizer)
        return false;

    // Create a new recognition context
    CComPtr<IInkRecognizerContext> spNewContext;
    HRESULT hr = pIInkRecognizer->CreateRecognizerContext(&spNewContext);
    if (FAILED(hr))
    {
        MessageBox(TEXT("Error creating a new recognition context!"),
                   gc_szAppName, MB_ICONERROR | MB_OK);
        return false;
    }

    // Change cursor to the system's Hourglass
    HCURSOR hCursor = ::SetCursor(::LoadCursor(NULL, IDC_WAIT));

    // Detach and release the old context
    if (m_spIInkRecoContext != NULL)
    {
        // Disconnect from the recognition events source
        IInkRecognitionEventsImpl<CAdvRecoApp>::DispEventUnadvise(m_spIInkRecoContext);

        // Reset and release the recognition context
        m_spIInkRecoContext->putref_Strokes(NULL);
        m_spIInkRecoContext.Release();
    }

    // Establish a connection with the recognition context's event source
    hr = IInkRecognitionEventsImpl<CAdvRecoApp>::DispEventAdvise(spNewContext);
    if (FAILED(hr))
    {
        MessageBox(TEXT("Error connecting to the recognition context's event source!"),
                   gc_szAppName, MB_ICONERROR | MB_OK);
    }

    // Get the recognizer's capabilities flags.
    // (use IRC__DontCare if get_Capabilities fails)
    InkRecognizerCapabilities dwCapabilities;
    if (FAILED(pIInkRecognizer->get_Capabilities(&dwCapabilities)))
    {
        dwCapabilities = IRC_DontCare;
    }

    // Update the Guide menu items
    const UINT nGuideCmds[] = {ID_GUIDE_BOXES, ID_GUIDE_LINES, ID_GUIDE_NONE};
    const UINT nGuideFlags[] = {IRC_BoxedInput, IRC_LinedInput, IRC_FreeInput};
    HMENU hMenu = GetMenu();
    HMENU hSubMenu = hMenu ? ::GetSubMenu(hMenu, mc_iSubmenuGuides) : NULL;
    UINT nCmdGuid = 0;
    for (int i = 0; i < countof(nGuideCmds) && i < countof(nGuideFlags); i++)
    {
        UINT nFlags;
        if (m_spIInkRecoGuide != NULL &&
            (((nGuideFlags[i] & dwCapabilities) == nGuideFlags[i])
            || ((IRC_DontCare & dwCapabilities) == IRC_DontCare)))
        {
            nFlags = MF_BYCOMMAND | MF_ENABLED;
            if ((0 == nCmdGuid) || (nGuideCmds[i] == m_nCmdGuide))
            {
                nCmdGuid = nGuideCmds[i];
            }
        }
        else
        {
            nFlags = MF_BYCOMMAND | MF_GRAYED;
        }
        // Update the menu item
        if (NULL != hSubMenu)
        {
            ::EnableMenuItem(hSubMenu, nGuideCmds[i], nFlags);
        }
    }

    // Change the guide selection if the current guide is not supported by the recognizer
    if (m_nCmdGuide != nCmdGuid)
    {
        SendMessage(WM_COMMAND, nCmdGuid);
    }

    // Set the recognition context properties before attaching the stroke collection to it

    // Set the guide
    if (m_spIInkRecoGuide != NULL && 0 != m_nCmdGuide)
    {
        if (FAILED(spNewContext->putref_Guide(m_spIInkRecoGuide)))
        {
            MessageBox(TEXT("Failed to set guide to the new recognition context!"),
                       gc_szAppName, MB_ICONERROR | MB_OK);
        }
    }

    // Clear currently set input scope. -1 is being used to indicate no input scope
    m_nCmdInputScope = -1;
    m_bCoerceInputScope = false;

    // Reset the Input Scope to baseline
    CComBSTR bstrFactoid(FACTOID_DEFAULT);
    if (FAILED(spNewContext->put_Factoid(bstrFactoid)))
    {
        MessageBox(TEXT("Failed to set factoid to the new recognition context!"),
                         gc_szAppName, MB_ICONERROR | MB_OK);
    }

    // Attach the stroke collection to the context
    hr = spNewContext->putref_Strokes(m_spIInkStrokes);
    if (FAILED(hr))
    {
        MessageBox(TEXT("Error attaching the stroke collection to the new recognition context!"),
                   gc_szAppName, MB_ICONERROR | MB_OK);
    }

    // Use the new context
    m_spIInkRecoContext.Attach(spNewContext.Detach());

    // Update the radio item check state of the input scope menu
    UpdateMenuRadioItems(mc_iSubmenuInputScopes, ID_INPUTSCOPE_FIRST, m_nCmdInputScope);

    // Update the enabled/disabled state of the input scope menu
    UpdateInputScopeMenu();

    // Update the coerce input scope menu item
    hSubMenu = hMenu ? ::GetSubMenu(hMenu, mc_iSubmenuInputScopes) : NULL;
    if (NULL != hSubMenu)
    {
        ::CheckMenuItem(hSubMenu, ID_INPUTSCOPE_COERCE, MF_BYCOMMAND | MF_UNCHECKED);
    }

    // Select an appropriate font for the recognition output
    LANGID wLandId = ::GetUserDefaultLangID();
    CComVariant vLangIDs;
    if (SUCCEEDED(pIInkRecognizer->get_Languages(&vLangIDs)) && NULL != vLangIDs.parray)
    {
        WORD* pwLIDs;
        if (SUCCEEDED(::SafeArrayAccessData(vLangIDs.parray, (void HUGEP**)&pwLIDs)))
        {
            wLandId = pwLIDs[0];
            ::SafeArrayUnaccessData(vLangIDs.parray);
        }
    }
    if (false == m_wndResults.UpdateFont(wLandId))
    {
        MessageBox(TEXT("Can not find an appropriate font for the selected recognizer.\n")
                   TEXT("The default font will be used for text output"), gc_szAppName);
    }

    // Reset the current results
    m_wndResults.ResetResults();
    m_wndResults.Invalidate();

    // Update the recognition results
    CComVariant vCustomData;    // no custom data
    m_spIInkRecoContext->BackgroundRecognizeWithAlternates(vCustomData);

    // restore the cursor
    ::SetCursor(hCursor);

    return true;
}

Member Data Documentation

bool CAdvRecoApp::m_bAllMSGestures

Definition at line 86 of file AdvReco.h.

bool CAdvRecoApp::m_bAllSSGestures

Definition at line 85 of file AdvReco.h.

bool CAdvRecoApp::m_bCoerceInputScope

Definition at line 83 of file AdvReco.h.

CComBSTR CAdvRecoApp::m_bstrCurRecoName

Definition at line 82 of file AdvReco.h.

HWND CAdvRecoApp::m_hwndMSGestLV

Definition at line 75 of file AdvReco.h.

HWND CAdvRecoApp::m_hwndSSGestLV

Definition at line 74 of file AdvReco.h.

HWND CAdvRecoApp::m_hwndStatusBar

Definition at line 73 of file AdvReco.h.

UINT CAdvRecoApp::m_nCmdGuide

Definition at line 80 of file AdvReco.h.

UINT CAdvRecoApp::m_nCmdInputScope

Definition at line 79 of file AdvReco.h.

UINT CAdvRecoApp::m_nCmdMode

Definition at line 81 of file AdvReco.h.

UINT CAdvRecoApp::m_nCmdRecognizer

Definition at line 78 of file AdvReco.h.

CComPtr<IInkCollector> CAdvRecoApp::m_spIInkCollector

Definition at line 62 of file AdvReco.h.

CComPtr<IInkDisp> CAdvRecoApp::m_spIInkDisp

Definition at line 64 of file AdvReco.h.

CComPtr<IInkRecognizerContext> CAdvRecoApp::m_spIInkRecoContext

Definition at line 66 of file AdvReco.h.

CComPtr<IInkRecognizers> CAdvRecoApp::m_spIInkRecognizers

Definition at line 67 of file AdvReco.h.

CComPtr<IInkRecognizerGuide> CAdvRecoApp::m_spIInkRecoGuide

Definition at line 68 of file AdvReco.h.

CComPtr<IInkRenderer> CAdvRecoApp::m_spIInkRenderer

Definition at line 63 of file AdvReco.h.

CComPtr<IInkStrokes> CAdvRecoApp::m_spIInkStrokes

Definition at line 65 of file AdvReco.h.

SIZE CAdvRecoApp::m_szGuideBox

Definition at line 84 of file AdvReco.h.

CInkInputWnd CAdvRecoApp::m_wndInput

Definition at line 71 of file AdvReco.h.

CRecoOutputWnd CAdvRecoApp::m_wndResults

Definition at line 72 of file AdvReco.h.

The documentation for this class was generated from the following files:
  • TabletPC/AdvReco/AdvReco.h
  • TabletPC/AdvReco/AdvReco.cpp
Generated on Wed Nov 13 2024 16:55:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAgentCtlAnimationNames Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CAgentCtlAnimationNames Class Reference

#include "AcAnim.h"

List of all members.

Public Member Functions

CAgentCtlAnimationNames ()
CAgentCtlAnimationNames (const CAgentCtlAnimationNames &dispatchSrc)
CAgentCtlAnimationNames (LPDISPATCH pDispatch)

Detailed Description

Definition at line 15 of file AcAnim.h.

Constructor & Destructor Documentation

CAgentCtlAnimationNames::CAgentCtlAnimationNames ( ) [inline]

Definition at line 18 of file AcAnim.h.

{}    // Calls COleDispatchDriver default constructor

CAgentCtlAnimationNames::CAgentCtlAnimationNames ( LPDISPATCH pDispatch ) [inline]

Definition at line 19 of file AcAnim.h.

: COleDispatchDriver(pDispatch) {}

CAgentCtlAnimationNames::CAgentCtlAnimationNames ( const CAgentCtlAnimationNames & dispatchSrc ) [inline]

Definition at line 20 of file AcAnim.h.

: COleDispatchDriver(dispatchSrc) {}

The documentation for this class was generated from the following file:
  • Web/MSAgent/c/CapMFC/AcAnim.h
Generated on Wed Nov 13 2024 16:55:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAgentCtlAudioObject Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CAgentCtlAudioObject Class Reference

#include "AcAudio.h"

List of all members.

Public Member Functions

CAgentCtlAudioObject ()
CAgentCtlAudioObject (LPDISPATCH pDispatch)
CAgentCtlAudioObject (const CAgentCtlAudioObject &dispatchSrc)
BOOL GetEnabled ()
BOOL GetSoundEffects ()

Detailed Description

Definition at line 13 of file AcAudio.h.

Constructor & Destructor Documentation

CAgentCtlAudioObject::CAgentCtlAudioObject ( ) [inline]

Definition at line 16 of file AcAudio.h.

{}    // Calls COleDispatchDriver default constructor

CAgentCtlAudioObject::CAgentCtlAudioObject ( LPDISPATCH pDispatch ) [inline]

Definition at line 17 of file AcAudio.h.

: COleDispatchDriver(pDispatch) {}

CAgentCtlAudioObject::CAgentCtlAudioObject ( const CAgentCtlAudioObject & dispatchSrc ) [inline]

Definition at line 18 of file AcAudio.h.

: COleDispatchDriver(dispatchSrc) {}

Member Function Documentation

BOOL CAgentCtlAudioObject::GetEnabled ( )

Definition at line 63 of file AcAudio.Cpp.

{
  BOOL result;
  InvokeHelper(0x1, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
  return result;
}

BOOL CAgentCtlAudioObject::GetSoundEffects ( )

Definition at line 70 of file AcAudio.Cpp.

{
  BOOL result;
  InvokeHelper(0x2, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
  return result;
}

The documentation for this class was generated from the following files:
  • Web/MSAgent/c/CapMFC/AcAudio.h
  • Web/MSAgent/c/CapMFC/AcAudio.Cpp
Generated on Wed Nov 13 2024 16:55:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAgentCtlBalloonEx Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CAgentCtlBalloonEx Class Reference

#include "AcBall.h"

List of all members.

Public Member Functions

CAgentCtlBalloonEx ()
CAgentCtlBalloonEx (LPDISPATCH pDispatch)
CAgentCtlBalloonEx (const CAgentCtlBalloonEx &dispatchSrc)
long | GetBackColor ()
long | GetBorderColor ()
long | GetCharsPerLine ()
BOOL GetEnabled ()
BOOL GetFontBold ()
short | GetFontCharSet ()
BOOL GetFontItalic ()
CString GetFontName ()
long | GetFontSize ()
BOOL GetFontStrikethru ()
BOOL GetFontUnderline ()
long | GetForeColor ()
long | GetNumberOfLines ()
long | GetStyle ()
BOOL GetVisible ()
void | SetFontCharSet (short nNewValue)
void | SetFontName (LPCTSTR lpszNewValue)
void | SetFontSize (long nNewValue)
void | SetStyle (long nNewValue)
void | SetVisible (BOOL bNewValue)

Detailed Description

Definition at line 15 of file AcBall.h.

Constructor & Destructor Documentation

CAgentCtlBalloonEx::CAgentCtlBalloonEx ( ) [inline]

Definition at line 18 of file AcBall.h.

{}    // Calls COleDispatchDriver default constructor

CAgentCtlBalloonEx::CAgentCtlBalloonEx ( LPDISPATCH pDispatch ) [inline]

Definition at line 19 of file AcBall.h.

: COleDispatchDriver(pDispatch) {}

CAgentCtlBalloonEx::CAgentCtlBalloonEx ( const CAgentCtlBalloonEx & dispatchSrc ) [inline]

Definition at line 20 of file AcBall.h.

: COleDispatchDriver(dispatchSrc) {}

Member Function Documentation

long CAgentCtlBalloonEx::GetBackColor ( )

Definition at line 130 of file AcBall.Cpp.

{
  long result;
  InvokeHelper(0x8, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
  return result;
}

long CAgentCtlBalloonEx::GetBorderColor ( )

Definition at line 137 of file AcBall.Cpp.

{
  long result;
  InvokeHelper(0x9, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
  return result;
}

long CAgentCtlBalloonEx::GetCharsPerLine ( )

Definition at line 74 of file AcBall.Cpp.

{
  long result;
  InvokeHelper(0x3, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
  return result;
}

BOOL CAgentCtlBalloonEx::GetEnabled ( )

Definition at line 60 of file AcBall.Cpp.

{
  BOOL result;
  InvokeHelper(0x1, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
  return result;
}

BOOL CAgentCtlBalloonEx::GetFontBold ( )

Definition at line 95 of file AcBall.Cpp.

{
  BOOL result;
  InvokeHelper(0xa, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
  return result;
}

short CAgentCtlBalloonEx::GetFontCharSet ( )

Definition at line 183 of file AcBall.Cpp.

{
  short result;
  InvokeHelper(0xf, DISPATCH_PROPERTYGET, VT_I2, (void*)&result, NULL);
  return result;
}

BOOL CAgentCtlBalloonEx::GetFontItalic ( )

Definition at line 102 of file AcBall.Cpp.

{
  BOOL result;
  InvokeHelper(0xb, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
  return result;
}

CString CAgentCtlBalloonEx::GetFontName ( )

Definition at line 81 of file AcBall.Cpp.

{
  CString result;
  InvokeHelper(0x4, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
  return result;
}

long CAgentCtlBalloonEx::GetFontSize ( )

Definition at line 88 of file AcBall.Cpp.

{
  long result;
  InvokeHelper(0x5, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
  return result;
}

BOOL CAgentCtlBalloonEx::GetFontStrikethru ( )

Definition at line 109 of file AcBall.Cpp.

{
  BOOL result;
  InvokeHelper(0xc, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
  return result;
}

BOOL CAgentCtlBalloonEx::GetFontUnderline ( )

Definition at line 116 of file AcBall.Cpp.

{
  BOOL result;
  InvokeHelper(0xd, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
  return result;
}

long CAgentCtlBalloonEx::GetForeColor ( )

Definition at line 123 of file AcBall.Cpp.

{
  long result;
  InvokeHelper(0x7, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
  return result;
}

long CAgentCtlBalloonEx::GetNumberOfLines ( )

Definition at line 67 of file AcBall.Cpp.

{
  long result;
  InvokeHelper(0x2, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
  return result;
}

long CAgentCtlBalloonEx::GetStyle ( )

Definition at line 198 of file AcBall.Cpp.

{
  long result;
  InvokeHelper(0x10, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
  return result;
}

BOOL CAgentCtlBalloonEx::GetVisible ( )

Definition at line 152 of file AcBall.Cpp.

{
  BOOL result;
  InvokeHelper(0xe, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
  return result;
}

void CAgentCtlBalloonEx::SetFontCharSet ( short nNewValue )

Definition at line 175 of file AcBall.Cpp.

{
  static BYTE parms[] =
    VTS_I2;
  InvokeHelper(0xf, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     nNewValue);
}

void CAgentCtlBalloonEx::SetFontName ( LPCTSTR lpszNewValue )

Definition at line 159 of file AcBall.Cpp.

{
  static BYTE parms[] =
    VTS_BSTR;
  InvokeHelper(0x4, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     lpszNewValue);
}

void CAgentCtlBalloonEx::SetFontSize ( long nNewValue )

Definition at line 167 of file AcBall.Cpp.

{
  static BYTE parms[] =
    VTS_I4;
  InvokeHelper(0x5, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     nNewValue);
}

void CAgentCtlBalloonEx::SetStyle ( long nNewValue )

Definition at line 190 of file AcBall.Cpp.

{
  static BYTE parms[] =
    VTS_I4;
  InvokeHelper(0x10, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     nNewValue);
}

void CAgentCtlBalloonEx::SetVisible ( BOOL bNewValue )

Definition at line 144 of file AcBall.Cpp.

{
  static BYTE parms[] =
    VTS_BOOL;
  InvokeHelper(0xe, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     bNewValue);
}

The documentation for this class was generated from the following files:
  • Web/MSAgent/c/CapMFC/AcBall.h
  • Web/MSAgent/c/CapMFC/AcBall.Cpp
Generated on Wed Nov 13 2024 16:55:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAgentCtlCharacterEx Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CAgentCtlCharacterEx Class Reference

#include "AcChar.h"

List of all members.

Public Member Functions

CAgentCtlCharacterEx ()
CAgentCtlCharacterEx (LPDISPATCH pDispatch)
CAgentCtlCharacterEx (const CAgentCtlCharacterEx &dispatchSrc)
BOOL | Activate (const VARIANT &State)
CAgentCtlRequest | GestureAt (short x, short y)
CAgentCtlRequest | Get (LPCTSTR Type, LPCTSTR Name, const VARIANT &Queue)
short | GetActive ()
CAgentCtlAnimationNames GetAnimationNames ()
BOOL GetAutoPopupMenu ()
CAgentCtlBalloonEx GetBalloon ()
CAgentCtlCommandsEx GetCommands ()
CString GetDescription ()
CString GetExtraData ()
CString GetGuid ()
BOOL GetHasOtherClients ()
short | GetHeight ()
long | GetHelpContextID ()
CString GetHelpFile ()
BOOL GetHelpModeOn ()
BOOL GetIdleOn ()
long | GetLanguageID ()
short | GetLeft ()
short | GetMoveCause ()
CString GetName ()
short | GetOriginalHeight ()
short | GetOriginalWidth ()
long | GetPitch ()
BOOL GetSoundEffectsOn ()
long | GetSpeed ()
CString GetSRModeID ()
long | GetSRStatus ()
short | GetTop ()
CString GetTTSModeID ()
CString GetVersion ()
short | GetVisibilityCause ()
BOOL GetVisible ()
short | GetWidth ()
CAgentCtlRequest | Hide (const VARIANT &Fast)
CAgentCtlRequest | Interrupt (LPDISPATCH InterruptRequest)
BOOL | Listen (BOOL Listen)
CAgentCtlRequest | MoveTo (short x, short y, const VARIANT &Speed)
CAgentCtlRequest | Play (LPCTSTR Animation)
void | SetAutoPopupMenu (BOOL bNewValue)
void | SetDescription (LPCTSTR lpszNewValue)
void | SetHeight (short nNewValue)
void | SetHelpContextID (long nNewValue)
void | SetHelpFile (LPCTSTR lpszNewValue)
void | SetHelpModeOn (BOOL bNewValue)
void | SetIdleOn (BOOL bNewValue)
void | SetLanguageID (long nNewValue)
void | SetLeft (short nNewValue)
void | SetName (LPCTSTR lpszNewValue)
void | SetSoundEffectsOn (BOOL bNewValue)
void | SetSRModeID (LPCTSTR lpszNewValue)
void | SetTop (short nNewValue)
void | SetTTSModeID (LPCTSTR lpszNewValue)
void | SetWidth (short nNewValue)
CAgentCtlRequest | Show (const VARIANT &Fast)
void | ShowPopupMenu (short x, short y)
CAgentCtlRequest | Speak (const VARIANT &Text, const VARIANT &Url)
void | Stop (const VARIANT &Request)
void | StopAll (const VARIANT &Types)
CAgentCtlRequest | Think (LPCTSTR Text)
CAgentCtlRequest | Wait (LPDISPATCH WaitForRequest)

Detailed Description

Definition at line 22 of file AcChar.h.

Constructor & Destructor Documentation

CAgentCtlCharacterEx::CAgentCtlCharacterEx ( ) [inline]

Definition at line 25 of file AcChar.h.

{}    // Calls COleDispatchDriver default constructor

CAgentCtlCharacterEx::CAgentCtlCharacterEx ( LPDISPATCH pDispatch ) [inline]

Definition at line 26 of file AcChar.h.

: COleDispatchDriver(pDispatch) {}

CAgentCtlCharacterEx::CAgentCtlCharacterEx ( const CAgentCtlCharacterEx & dispatchSrc ) [inline]

Definition at line 27 of file AcChar.h.

: COleDispatchDriver(dispatchSrc) {}

Member Function Documentation

BOOL CAgentCtlCharacterEx::Activate ( const VARIANT & State )

Definition at line 190 of file AcChar.Cpp.

{
  BOOL result;
  static BYTE parms[] =
    VTS_VARIANT;
  InvokeHelper(0x1a, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
    &State);
  return result;
}

CAgentCtlRequest CAgentCtlCharacterEx::GestureAt | ( | short | x,
 |  | short | y
 | ) |  |

Definition at line 258 of file AcChar.Cpp.

{
  LPDISPATCH pDispatch;
  static BYTE parms[] =
    VTS_I2 VTS_I2;
  InvokeHelper(0x11, DISPATCH_METHOD, VT_DISPATCH, (void*)&pDispatch, parms,
    x, y);
  return CAgentCtlRequest(pDispatch);
}

CAgentCtlRequest CAgentCtlCharacterEx::Get | ( | LPCTSTR | Type,
 |  | LPCTSTR | Name,
 |  | const VARIANT & | Queue
 | ) |  |

Definition at line 210 of file AcChar.Cpp.

{
  LPDISPATCH pDispatch;
  static BYTE parms[] =
    VTS_BSTR VTS_BSTR VTS_VARIANT;
  InvokeHelper(0x1b, DISPATCH_METHOD, VT_DISPATCH, (void*)&pDispatch, parms,
    Type, Name, &Queue);
  return CAgentCtlRequest(pDispatch);
}

short CAgentCtlCharacterEx::GetActive ( )

Definition at line 418 of file AcChar.Cpp.

{
  short result;
  InvokeHelper(0x29, DISPATCH_PROPERTYGET, VT_I2, (void*)&result, NULL);
  return result;
}

CAgentCtlAnimationNames CAgentCtlCharacterEx::GetAnimationNames ( )

Definition at line 533 of file AcChar.Cpp.

{
  LPDISPATCH pDispatch;
  InvokeHelper(0x36, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&pDispatch, NULL);
  return CAgentCtlAnimationNames(pDispatch);
}

BOOL CAgentCtlCharacterEx::GetAutoPopupMenu ( )

Definition at line 381 of file AcChar.Cpp.

{
  BOOL result;
  InvokeHelper(0x26, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
  return result;
}

CAgentCtlBalloonEx CAgentCtlCharacterEx::GetBalloon ( )

Definition at line 66 of file AcChar.Cpp.

{
  LPDISPATCH pDispatch;
  InvokeHelper(0x17, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&pDispatch, NULL);
  return CAgentCtlBalloonEx(pDispatch);
}

CAgentCtlCommandsEx CAgentCtlCharacterEx::GetCommands ( )

Definition at line 73 of file AcChar.Cpp.

{
  LPDISPATCH pDispatch;
  InvokeHelper(0x19, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&pDispatch, NULL);
  return CAgentCtlCommandsEx(pDispatch);
}

CString CAgentCtlCharacterEx::GetDescription ( )

Definition at line 87 of file AcChar.Cpp.

{
  CString result;
  InvokeHelper(0x1c, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
  return result;
}

CString CAgentCtlCharacterEx::GetExtraData ( )

Definition at line 358 of file AcChar.Cpp.

{
  CString result;
  InvokeHelper(0x24, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
  return result;
}

CString CAgentCtlCharacterEx::GetGuid ( )

Definition at line 495 of file AcChar.Cpp.

{
  CString result;
  InvokeHelper(0x31, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
  return result;
}

BOOL CAgentCtlCharacterEx::GetHasOtherClients ( )

Definition at line 320 of file AcChar.Cpp.

{
  BOOL result;
  InvokeHelper(0x22, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
  return result;
}

short CAgentCtlCharacterEx::GetHeight ( )

Definition at line 139 of file AcChar.Cpp.

{
  short result;
  InvokeHelper(0x5, DISPATCH_PROPERTYGET, VT_I2, (void*)&result, NULL);
  return result;
}

long CAgentCtlCharacterEx::GetHelpContextID ( )

Definition at line 411 of file AcChar.Cpp.

{
  long result;
  InvokeHelper(0x28, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
  return result;
}

CString CAgentCtlCharacterEx::GetHelpFile ( )

Definition at line 480 of file AcChar.Cpp.

{
  CString result;
  InvokeHelper(0x30, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
  return result;
}

BOOL CAgentCtlCharacterEx::GetHelpModeOn ( )

Definition at line 396 of file AcChar.Cpp.

{
  BOOL result;
  InvokeHelper(0x27, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
  return result;
}

BOOL CAgentCtlCharacterEx::GetIdleOn ( )

Definition at line 183 of file AcChar.Cpp.

{
  BOOL result;
  InvokeHelper(0x1d, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
  return result;
}

long CAgentCtlCharacterEx::GetLanguageID ( )

Definition at line 443 of file AcChar.Cpp.

{
  long result;
  InvokeHelper(0x2b, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
  return result;
}

short CAgentCtlCharacterEx::GetLeft ( )

Definition at line 109 of file AcChar.Cpp.

{
  short result;
  InvokeHelper(0x3, DISPATCH_PROPERTYGET, VT_I2, (void*)&result, NULL);
  return result;
}

short CAgentCtlCharacterEx::GetMoveCause ( )

Definition at line 306 of file AcChar.Cpp.

{
  short result;
  InvokeHelper(0x20, DISPATCH_PROPERTYGET, VT_I2, (void*)&result, NULL);
  return result;
}

CString CAgentCtlCharacterEx::GetName ( )

Definition at line 80 of file AcChar.Cpp.

{
  CString result;
  InvokeHelper(0x18, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
  return result;
}

short CAgentCtlCharacterEx::GetOriginalHeight ( )

Definition at line 502 of file AcChar.Cpp.

{
  short result;
  InvokeHelper(0x32, DISPATCH_PROPERTYGET, VT_I2, (void*)&result, NULL);
  return result;
}

short CAgentCtlCharacterEx::GetOriginalWidth ( )

Definition at line 509 of file AcChar.Cpp.

{
  short result;
  InvokeHelper(0x33, DISPATCH_PROPERTYGET, VT_I2, (void*)&result, NULL);
  return result;
}

long CAgentCtlCharacterEx::GetPitch ( )

Definition at line 168 of file AcChar.Cpp.

{
  long result;
  InvokeHelper(0xb, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
  return result;
}

BOOL CAgentCtlCharacterEx::GetSoundEffectsOn ( )

Definition at line 335 of file AcChar.Cpp.

{
  BOOL result;
  InvokeHelper(0x23, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
  return result;
}

long CAgentCtlCharacterEx::GetSpeed ( )

Definition at line 161 of file AcChar.Cpp.

{
  long result;
  InvokeHelper(0xa, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
  return result;
}

CString CAgentCtlCharacterEx::GetSRModeID ( )

Definition at line 450 of file AcChar.Cpp.

{
  CString result;
  InvokeHelper(0x2e, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
  return result;
}

long CAgentCtlCharacterEx::GetSRStatus ( )

Definition at line 540 of file AcChar.Cpp.

{
  long result;
  InvokeHelper(0x37, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
  return result;
}

short CAgentCtlCharacterEx::GetTop ( )

Definition at line 124 of file AcChar.Cpp.

{
  short result;
  InvokeHelper(0x4, DISPATCH_PROPERTYGET, VT_I2, (void*)&result, NULL);
  return result;
}

CString CAgentCtlCharacterEx::GetTTSModeID ( )

Definition at line 465 of file AcChar.Cpp.

{
  CString result;
  InvokeHelper(0x2f, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
  return result;
}

CString CAgentCtlCharacterEx::GetVersion ( )

Definition at line 526 of file AcChar.Cpp.

{
  CString result;
  InvokeHelper(0x35, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
  return result;
}

short CAgentCtlCharacterEx::GetVisibilityCause ( )

Definition at line 313 of file AcChar.Cpp.

{
  short result;
  InvokeHelper(0x21, DISPATCH_PROPERTYGET, VT_I2, (void*)&result, NULL);
  return result;
}

BOOL CAgentCtlCharacterEx::GetVisible ( )

Definition at line 94 of file AcChar.Cpp.

{
  BOOL result;
  InvokeHelper(0x2, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
  return result;
}

short CAgentCtlCharacterEx::GetWidth ( )

Definition at line 154 of file AcChar.Cpp.

{
  short result;
  InvokeHelper(0x6, DISPATCH_PROPERTYGET, VT_I2, (void*)&result, NULL);
  return result;
}

CAgentCtlRequest CAgentCtlCharacterEx::Hide ( const VARIANT & Fast )

Definition at line 278 of file AcChar.Cpp.

{
  LPDISPATCH pDispatch;
  static BYTE parms[] =
    VTS_VARIANT;
  InvokeHelper(0x13, DISPATCH_METHOD, VT_DISPATCH, (void*)&pDispatch, parms,
    &Fast);
  return CAgentCtlRequest(pDispatch);
}

CAgentCtlRequest CAgentCtlCharacterEx::Interrupt ( LPDISPATCH InterruptRequest )

Definition at line 238 of file AcChar.Cpp.

{
  LPDISPATCH pDispatch;
  static BYTE parms[] =
    VTS_DISPATCH;
  InvokeHelper(0x15, DISPATCH_METHOD, VT_DISPATCH, (void*)&pDispatch, parms,
    InterruptRequest);
  return CAgentCtlRequest(pDispatch);
}

BOOL CAgentCtlCharacterEx::Listen ( BOOL Listen )

Definition at line 425 of file AcChar.Cpp.

{
  BOOL result;
  static BYTE parms[] =
    VTS_BOOL;
  InvokeHelper(0x2a, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
    Listen);
  return result;
}

CAgentCtlRequest CAgentCtlCharacterEx::MoveTo | ( | short | x,
 |  | short | y,
 |  | const VARIANT & | Speed
 | ) |  |

Definition at line 268 of file AcChar.Cpp.

{
  LPDISPATCH pDispatch;
  static BYTE parms[] =
    VTS_I2 VTS_I2 VTS_VARIANT;
  InvokeHelper(0x12, DISPATCH_METHOD, VT_DISPATCH, (void*)&pDispatch, parms,
    x, y, &Speed);
  return CAgentCtlRequest(pDispatch);
}

CAgentCtlRequest CAgentCtlCharacterEx::Play ( LPCTSTR Animation )

Definition at line 200 of file AcChar.Cpp.

{
  LPDISPATCH pDispatch;
  static BYTE parms[] =
    VTS_BSTR;
  InvokeHelper(0xd, DISPATCH_METHOD, VT_DISPATCH, (void*)&pDispatch, parms,
    Animation);
  return CAgentCtlRequest(pDispatch);
}

void CAgentCtlCharacterEx::SetAutoPopupMenu ( BOOL bNewValue )

Definition at line 373 of file AcChar.Cpp.

{
  static BYTE parms[] =
    VTS_BOOL;
  InvokeHelper(0x26, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     bNewValue);
}

void CAgentCtlCharacterEx::SetDescription ( LPCTSTR lpszNewValue )

Definition at line 350 of file AcChar.Cpp.

{
  static BYTE parms[] =
    VTS_BSTR;
  InvokeHelper(0x1c, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     lpszNewValue);
}

void CAgentCtlCharacterEx::SetHeight ( short nNewValue )

Definition at line 131 of file AcChar.Cpp.

{
  static BYTE parms[] =
    VTS_I2;
  InvokeHelper(0x5, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     nNewValue);
}

void CAgentCtlCharacterEx::SetHelpContextID ( long nNewValue )

Definition at line 403 of file AcChar.Cpp.

{
  static BYTE parms[] =
    VTS_I4;
  InvokeHelper(0x28, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     nNewValue);
}

void CAgentCtlCharacterEx::SetHelpFile ( LPCTSTR lpszNewValue )

Definition at line 487 of file AcChar.Cpp.

{
  static BYTE parms[] =
    VTS_BSTR;
  InvokeHelper(0x30, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     lpszNewValue);
}

void CAgentCtlCharacterEx::SetHelpModeOn ( BOOL bNewValue )

Definition at line 388 of file AcChar.Cpp.

{
  static BYTE parms[] =
    VTS_BOOL;
  InvokeHelper(0x27, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     bNewValue);
}

void CAgentCtlCharacterEx::SetIdleOn ( BOOL bNewValue )

Definition at line 175 of file AcChar.Cpp.

{
  static BYTE parms[] =
    VTS_BOOL;
  InvokeHelper(0x1d, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     bNewValue);
}

void CAgentCtlCharacterEx::SetLanguageID ( long nNewValue )

Definition at line 435 of file AcChar.Cpp.

{
  static BYTE parms[] =
    VTS_I4;
  InvokeHelper(0x2b, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     nNewValue);
}

void CAgentCtlCharacterEx::SetLeft ( short nNewValue )

Definition at line 101 of file AcChar.Cpp.

{
  static BYTE parms[] =
    VTS_I2;
  InvokeHelper(0x3, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     nNewValue);
}

void CAgentCtlCharacterEx::SetName ( LPCTSTR lpszNewValue )

Definition at line 342 of file AcChar.Cpp.

{
  static BYTE parms[] =
    VTS_BSTR;
  InvokeHelper(0x18, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     lpszNewValue);
}

void CAgentCtlCharacterEx::SetSoundEffectsOn ( BOOL bNewValue )

Definition at line 327 of file AcChar.Cpp.

{
  static BYTE parms[] =
    VTS_BOOL;
  InvokeHelper(0x23, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     bNewValue);
}

void CAgentCtlCharacterEx::SetSRModeID ( LPCTSTR lpszNewValue )

Definition at line 457 of file AcChar.Cpp.

{
  static BYTE parms[] =
    VTS_BSTR;
  InvokeHelper(0x2e, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     lpszNewValue);
}

void CAgentCtlCharacterEx::SetTop ( short nNewValue )

Definition at line 116 of file AcChar.Cpp.

{
  static BYTE parms[] =
    VTS_I2;
  InvokeHelper(0x4, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     nNewValue);
}

void CAgentCtlCharacterEx::SetTTSModeID ( LPCTSTR lpszNewValue )

Definition at line 472 of file AcChar.Cpp.

{
  static BYTE parms[] =
    VTS_BSTR;
  InvokeHelper(0x2f, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     lpszNewValue);
}

void CAgentCtlCharacterEx::SetWidth ( short nNewValue )

Definition at line 146 of file AcChar.Cpp.

{
  static BYTE parms[] =
    VTS_I2;
  InvokeHelper(0x6, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     nNewValue);
}

CAgentCtlRequest CAgentCtlCharacterEx::Show ( const VARIANT & Fast )

Definition at line 288 of file AcChar.Cpp.

{
  LPDISPATCH pDispatch;
  static BYTE parms[] =
    VTS_VARIANT;
  InvokeHelper(0x14, DISPATCH_METHOD, VT_DISPATCH, (void*)&pDispatch, parms,
    &Fast);
  return CAgentCtlRequest(pDispatch);
}

void CAgentCtlCharacterEx::ShowPopupMenu | ( | short | x,
 |  | short | y
 | ) |  |

Definition at line 365 of file AcChar.Cpp.

{
  static BYTE parms[] =
    VTS_I2 VTS_I2;
  InvokeHelper(0x25, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
     x, y);
}

CAgentCtlRequest CAgentCtlCharacterEx::Speak | ( | const VARIANT & | Text,
 |  | const VARIANT & | Url
 | ) |  |

Definition at line 248 of file AcChar.Cpp.

{
  LPDISPATCH pDispatch;
  static BYTE parms[] =
    VTS_VARIANT VTS_VARIANT;
  InvokeHelper(0xf, DISPATCH_METHOD, VT_DISPATCH, (void*)&pDispatch, parms,
    &Text, &Url);
  return CAgentCtlRequest(pDispatch);
}

void CAgentCtlCharacterEx::Stop ( const VARIANT & Request )

Definition at line 220 of file AcChar.Cpp.

{
  static BYTE parms[] =
    VTS_VARIANT;
  InvokeHelper(0xe, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
     &Request);
}

void CAgentCtlCharacterEx::StopAll ( const VARIANT & Types )

Definition at line 298 of file AcChar.Cpp.

{
  static BYTE parms[] =
    VTS_VARIANT;
  InvokeHelper(0x1f, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
     &Types);
}

CAgentCtlRequest CAgentCtlCharacterEx::Think ( LPCTSTR Text )

Definition at line 516 of file AcChar.Cpp.

{
  LPDISPATCH pDispatch;
  static BYTE parms[] =
    VTS_BSTR;
  InvokeHelper(0x34, DISPATCH_METHOD, VT_DISPATCH, (void*)&pDispatch, parms,
    Text);
  return CAgentCtlRequest(pDispatch);
}

CAgentCtlRequest CAgentCtlCharacterEx::Wait ( LPDISPATCH WaitForRequest )

Definition at line 228 of file AcChar.Cpp.

{
  LPDISPATCH pDispatch;
  static BYTE parms[] =
    VTS_DISPATCH;
  InvokeHelper(0x16, DISPATCH_METHOD, VT_DISPATCH, (void*)&pDispatch, parms,
    WaitForRequest);
  return CAgentCtlRequest(pDispatch);
}

The documentation for this class was generated from the following files:
  • Web/MSAgent/c/CapMFC/AcChar.h
  • Web/MSAgent/c/CapMFC/AcChar.Cpp
Generated on Wed Nov 13 2024 16:55:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAgentCtlCharacters Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CAgentCtlCharacters Class Reference

#include "AcChars.h"

List of all members.

Public Member Functions

CAgentCtlCharacters ()
CAgentCtlCharacters (LPDISPATCH pDispatch)
CAgentCtlCharacters (const CAgentCtlCharacters &dispatchSrc)
CAgentCtlCharacterEx | Character (LPCTSTR CharacterID)
CAgentCtlCharacterEx | GetItem (LPCTSTR CharacterID)
CAgentCtlRequest | Load (LPCTSTR CharacterID, const VARIANT &LoadKey)
void | Unload (LPCTSTR CharacterID)

Detailed Description

Definition at line 20 of file AcChars.h.

Constructor & Destructor Documentation

CAgentCtlCharacters::CAgentCtlCharacters ( ) [inline]

Definition at line 23 of file AcChars.h.

{}    // Calls COleDispatchDriver default constructor

CAgentCtlCharacters::CAgentCtlCharacters ( LPDISPATCH pDispatch ) [inline]

Definition at line 24 of file AcChars.h.

: COleDispatchDriver(pDispatch) {}

CAgentCtlCharacters::CAgentCtlCharacters ( const CAgentCtlCharacters & dispatchSrc ) [inline]

Definition at line 25 of file AcChars.h.

: COleDispatchDriver(dispatchSrc) {}

Member Function Documentation

CAgentCtlCharacterEx CAgentCtlCharacters::Character ( LPCTSTR CharacterID )

Definition at line 74 of file AcChars.Cpp.

{
  LPDISPATCH pDispatch;
  static BYTE parms[] =
    VTS_BSTR;
  InvokeHelper(0x3, DISPATCH_METHOD, VT_DISPATCH, (void*)&pDispatch, parms,
    CharacterID);
  return CAgentCtlCharacterEx(pDispatch);
}

CAgentCtlCharacterEx CAgentCtlCharacters::GetItem ( LPCTSTR CharacterID )

Definition at line 64 of file AcChars.Cpp.

{
  LPDISPATCH pDispatch;
  static BYTE parms[] =
    VTS_BSTR;
  InvokeHelper(0x0, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&pDispatch, parms,
    CharacterID);
  return CAgentCtlCharacterEx(pDispatch);
}

CAgentCtlRequest CAgentCtlCharacters::Load | ( | LPCTSTR | CharacterID,
 |  | const VARIANT & | LoadKey
 | ) |  |

Definition at line 92 of file AcChars.Cpp.

{
  LPDISPATCH pDispatch;
  static BYTE parms[] =
    VTS_BSTR VTS_VARIANT;
  InvokeHelper(0x1, DISPATCH_METHOD, VT_DISPATCH, (void*)&pDispatch, parms,
    CharacterID, &LoadKey);
  return CAgentCtlRequest(pDispatch);
}

void CAgentCtlCharacters::Unload ( LPCTSTR CharacterID )

Definition at line 84 of file AcChars.Cpp.

{
  static BYTE parms[] =
    VTS_BSTR;
  InvokeHelper(0x2, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
     CharacterID);
}

The documentation for this class was generated from the following files:
  • Web/MSAgent/c/CapMFC/AcChars.h
  • Web/MSAgent/c/CapMFC/AcChars.Cpp
Generated on Wed Nov 13 2024 16:55:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAgentCtlCommandEx Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CAgentCtlCommandEx Class Reference

#include "AcComm.h"

List of all members.

Public Member Functions

CAgentCtlCommandEx ()
CAgentCtlCommandEx (LPDISPATCH pDispatch)
CAgentCtlCommandEx (const CAgentCtlCommandEx &dispatchSrc)
CString GetCaption ()
long | GetConfidence ()
CString GetConfidenceText ()
BOOL GetEnabled ()
long | GetHelpContextID ()
BOOL GetVisible ()
CString GetVoice ()
CString GetVoiceCaption ()
void | SetCaption (LPCTSTR lpszNewValue)
void | SetConfidence (long nNewValue)
void | SetConfidenceText (LPCTSTR lpszNewValue)
void | SetEnabled (BOOL bNewValue)
void | SetHelpContextID (long nNewValue)
void | SetVisible (BOOL bNewValue)
void | SetVoice (LPCTSTR lpszNewValue)
void | SetVoiceCaption (LPCTSTR lpszNewValue)

Detailed Description

Definition at line 15 of file AcComm.h.

Constructor & Destructor Documentation

CAgentCtlCommandEx::CAgentCtlCommandEx ( ) [inline]

Definition at line 18 of file AcComm.h.

{}    // Calls COleDispatchDriver default constructor

CAgentCtlCommandEx::CAgentCtlCommandEx ( LPDISPATCH pDispatch ) [inline]

Definition at line 19 of file AcComm.h.

: COleDispatchDriver(pDispatch) {}

CAgentCtlCommandEx::CAgentCtlCommandEx ( const CAgentCtlCommandEx & dispatchSrc ) [inline]

Definition at line 20 of file AcComm.h.

: COleDispatchDriver(dispatchSrc) {}

Member Function Documentation

CString CAgentCtlCommandEx::GetCaption ( )

Definition at line 75 of file AcComm.Cpp.

{
  CString result;
  InvokeHelper(0x2, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
  return result;
}

long CAgentCtlCommandEx::GetConfidence ( )

Definition at line 120 of file AcComm.Cpp.

{
  long result;
  InvokeHelper(0x3, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
  return result;
}

CString CAgentCtlCommandEx::GetConfidenceText ( )

Definition at line 135 of file AcComm.Cpp.

{
  CString result;
  InvokeHelper(0x4, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
  return result;
}

BOOL CAgentCtlCommandEx::GetEnabled ( )

Definition at line 90 of file AcComm.Cpp.

{
  BOOL result;
  InvokeHelper(0x5, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
  return result;
}

long CAgentCtlCommandEx::GetHelpContextID ( )

Definition at line 158 of file AcComm.Cpp.

{
  long result;
  InvokeHelper(0x7, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
  return result;
}

BOOL CAgentCtlCommandEx::GetVisible ( )

Definition at line 105 of file AcComm.Cpp.

{
  BOOL result;
  InvokeHelper(0x6, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
  return result;
}

CString CAgentCtlCommandEx::GetVoice ( )

Definition at line 60 of file AcComm.Cpp.

{
  CString result;
  InvokeHelper(0x1, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
  return result;
}

CString CAgentCtlCommandEx::GetVoiceCaption ( )

Definition at line 173 of file AcComm.Cpp.

{
  CString result;
  InvokeHelper(0x8, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
  return result;
}

void CAgentCtlCommandEx::SetCaption ( LPCTSTR lpszNewValue )

Definition at line 82 of file AcComm.Cpp.

{
  static BYTE parms[] =
    VTS_BSTR;
  InvokeHelper(0x2, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     lpszNewValue);
}

void CAgentCtlCommandEx::SetConfidence ( long nNewValue )

Definition at line 127 of file AcComm.Cpp.

{
  static BYTE parms[] =
    VTS_I4;
  InvokeHelper(0x3, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     nNewValue);
}

void CAgentCtlCommandEx::SetConfidenceText ( LPCTSTR lpszNewValue )

Definition at line 142 of file AcComm.Cpp.

{
  static BYTE parms[] =
    VTS_BSTR;
  InvokeHelper(0x4, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     lpszNewValue);
}

void CAgentCtlCommandEx::SetEnabled ( BOOL bNewValue )

Definition at line 97 of file AcComm.Cpp.

{
  static BYTE parms[] =
    VTS_BOOL;
  InvokeHelper(0x5, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     bNewValue);
}

void CAgentCtlCommandEx::SetHelpContextID ( long nNewValue )

Definition at line 150 of file AcComm.Cpp.

{
  static BYTE parms[] =
    VTS_I4;
  InvokeHelper(0x7, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     nNewValue);
}

void CAgentCtlCommandEx::SetVisible ( BOOL bNewValue )

Definition at line 112 of file AcComm.Cpp.

{
  static BYTE parms[] =
    VTS_BOOL;
  InvokeHelper(0x6, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     bNewValue);
}

void CAgentCtlCommandEx::SetVoice ( LPCTSTR lpszNewValue )

Definition at line 67 of file AcComm.Cpp.

{
  static BYTE parms[] =
    VTS_BSTR;
  InvokeHelper(0x1, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     lpszNewValue);
}

void CAgentCtlCommandEx::SetVoiceCaption ( LPCTSTR lpszNewValue )

Definition at line 165 of file AcComm.Cpp.

{
  static BYTE parms[] =
    VTS_BSTR;
  InvokeHelper(0x8, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     lpszNewValue);
}

The documentation for this class was generated from the following files:
  • Web/MSAgent/c/CapMFC/AcComm.h
  • Web/MSAgent/c/CapMFC/AcComm.Cpp
Generated on Wed Nov 13 2024 16:55:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAgentCtlCommandsEx Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CAgentCtlCommandsEx Class Reference

#include "AcComms.h"

List of all members.

Public Member Functions

CAgentCtlCommandsEx ()
CAgentCtlCommandsEx (LPDISPATCH pDispatch)
CAgentCtlCommandsEx (const CAgentCtlCommandsEx &dispatchSrc)
LPDISPATCH | Add (LPCTSTR Name, const VARIANT &Caption, const VARIANT &Voice, const VARIANT &Enabled, const VARIANT &Visible)
CAgentCtlCommandEx | Command (LPCTSTR Name)
CString GetCaption ()
long | GetCount ()
CString GetDefaultCommand ()
CString GetFontName ()
long | GetFontSize ()
BOOL GetGlobalVoiceCommandsEnabled ()
long | GetHelpContextID ()
CAgentCtlCommandEx | GetItem (LPCTSTR Name)
BOOL GetVisible ()
CString GetVoice ()
CString GetVoiceCaption ()
LPDISPATCH | Insert (LPCTSTR Name, LPCTSTR RefName, const VARIANT &Before, const VARIANT &Caption, const VARIANT &Voice, const VARIANT &Enabled, const VARIANT &Visible)
void | Remove (LPCTSTR Name)
void | RemoveAll ()
void | SetCaption (LPCTSTR lpszNewValue)
void | SetDefaultCommand (LPCTSTR lpszNewValue)
void | SetFontName (LPCTSTR lpszNewValue)
void | SetFontSize (long nNewValue)
void | SetGlobalVoiceCommandsEnabled (BOOL bNewValue)
void | SetHelpContextID (long nNewValue)
void | SetVisible (BOOL bNewValue)
void | SetVoice (LPCTSTR lpszNewValue)
void | SetVoiceCaption (LPCTSTR lpszNewValue)

Detailed Description

Definition at line 19 of file AcComms.h.

Constructor & Destructor Documentation

CAgentCtlCommandsEx::CAgentCtlCommandsEx ( ) [inline]

Definition at line 22 of file AcComms.h.

{}    // Calls COleDispatchDriver default constructor

CAgentCtlCommandsEx::CAgentCtlCommandsEx ( LPDISPATCH pDispatch ) [inline]

Definition at line 23 of file AcComms.h.

: COleDispatchDriver(pDispatch) {}

CAgentCtlCommandsEx::CAgentCtlCommandsEx ( const CAgentCtlCommandsEx & dispatchSrc ) [inline]

Definition at line 24 of file AcComms.h.

: COleDispatchDriver(dispatchSrc) {}

Member Function Documentation

LPDISPATCH CAgentCtlCommandsEx::Add | ( | LPCTSTR | Name,
 |  | const VARIANT & | Caption,
 |  | const VARIANT & | Voice,
 |  | const VARIANT & | Enabled,
 |  | const VARIANT & | Visible
 | ) |  |

Definition at line 135 of file AcComms.Cpp.

{
  LPDISPATCH result;
  static BYTE parms[] =
    VTS_BSTR VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT;
  InvokeHelper(0xa, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, parms,
    Name, &Caption, &Voice, &Enabled, &Visible);
  return result;
}

CAgentCtlCommandEx CAgentCtlCommandsEx::Command ( LPCTSTR Name )

Definition at line 73 of file AcComms.Cpp.

{
  LPDISPATCH pDispatch;
  static BYTE parms[] =
    VTS_BSTR;
  InvokeHelper(0xf, DISPATCH_METHOD, VT_DISPATCH, (void*)&pDispatch, parms,
    Name);
  return CAgentCtlCommandEx(pDispatch);
}

CString CAgentCtlCommandsEx::GetCaption ( )

Definition at line 90 of file AcComms.Cpp.

{
  CString result;
  InvokeHelper(0x3, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
  return result;
}

long CAgentCtlCommandsEx::GetCount ( )

Definition at line 83 of file AcComms.Cpp.

{
  long result;
  InvokeHelper(0x2, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
  return result;
}

CString CAgentCtlCommandsEx::GetDefaultCommand ( )

Definition at line 176 of file AcComms.Cpp.

{
  CString result;
  InvokeHelper(0x10, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
  return result;
}

CString CAgentCtlCommandsEx::GetFontName ( )

Definition at line 206 of file AcComms.Cpp.

{
  CString result;
  InvokeHelper(0x15, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
  return result;
}

long CAgentCtlCommandsEx::GetFontSize ( )

Definition at line 213 of file AcComms.Cpp.

{
  long result;
  InvokeHelper(0x17, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
  return result;
}

BOOL CAgentCtlCommandsEx::GetGlobalVoiceCommandsEnabled ( )

Definition at line 251 of file AcComms.Cpp.

{
  BOOL result;
  InvokeHelper(0x18, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
  return result;
}

long CAgentCtlCommandsEx::GetHelpContextID ( )

Definition at line 191 of file AcComms.Cpp.

{
  long result;
  InvokeHelper(0x11, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
  return result;
}

CAgentCtlCommandEx CAgentCtlCommandsEx::GetItem ( LPCTSTR Name )

Definition at line 63 of file AcComms.Cpp.

{
  LPDISPATCH pDispatch;
  static BYTE parms[] =
    VTS_BSTR;
  InvokeHelper(0x0, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&pDispatch, parms,
    Name);
  return CAgentCtlCommandEx(pDispatch);
}

BOOL CAgentCtlCommandsEx::GetVisible ( )

Definition at line 120 of file AcComms.Cpp.

{
  BOOL result;
  InvokeHelper(0x5, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
  return result;
}

CString CAgentCtlCommandsEx::GetVoice ( )

Definition at line 105 of file AcComms.Cpp.

{
  CString result;
  InvokeHelper(0x4, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
  return result;
}

CString CAgentCtlCommandsEx::GetVoiceCaption ( )

Definition at line 236 of file AcComms.Cpp.

{
  CString result;
  InvokeHelper(0x16, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
  return result;
}

LPDISPATCH CAgentCtlCommandsEx::Insert | ( | LPCTSTR | Name,
 |  | LPCTSTR | RefName,
 |  | const VARIANT & | Before,
 |  | const VARIANT & | Caption,
 |  | const VARIANT & | Voice,
 |  | const VARIANT & | Enabled,
 |  | const VARIANT & | Visible
 | ) |  |

Definition at line 145 of file AcComms.Cpp.

{
  LPDISPATCH result;
  static BYTE parms[] =
    VTS_BSTR VTS_BSTR VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT VTS_VARIANT;
  InvokeHelper(0xb, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, parms,
    Name, RefName, &Before, &Caption, &Voice, &Enabled, &Visible);
  return result;
}

void CAgentCtlCommandsEx::Remove ( LPCTSTR Name )

Definition at line 155 of file AcComms.Cpp.

{
  static BYTE parms[] =
    VTS_BSTR;
  InvokeHelper(0xd, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
     Name);
}

void CAgentCtlCommandsEx::RemoveAll ( )

Definition at line 163 of file AcComms.Cpp.

{
  InvokeHelper(0xe, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
}

void CAgentCtlCommandsEx::SetCaption ( LPCTSTR lpszNewValue )

Definition at line 97 of file AcComms.Cpp.

{
  static BYTE parms[] =
    VTS_BSTR;
  InvokeHelper(0x3, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     lpszNewValue);
}

void CAgentCtlCommandsEx::SetDefaultCommand ( LPCTSTR lpszNewValue )

Definition at line 168 of file AcComms.Cpp.

{
  static BYTE parms[] =
    VTS_BSTR;
  InvokeHelper(0x10, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     lpszNewValue);
}

void CAgentCtlCommandsEx::SetFontName ( LPCTSTR lpszNewValue )

Definition at line 198 of file AcComms.Cpp.

{
  static BYTE parms[] =
    VTS_BSTR;
  InvokeHelper(0x15, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     lpszNewValue);
}

void CAgentCtlCommandsEx::SetFontSize ( long nNewValue )

Definition at line 220 of file AcComms.Cpp.

{
  static BYTE parms[] =
    VTS_I4;
  InvokeHelper(0x17, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     nNewValue);
}

void CAgentCtlCommandsEx::SetGlobalVoiceCommandsEnabled ( BOOL bNewValue )

Definition at line 243 of file AcComms.Cpp.

{
  static BYTE parms[] =
    VTS_BOOL;
  InvokeHelper(0x18, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     bNewValue);
}

void CAgentCtlCommandsEx::SetHelpContextID ( long nNewValue )

Definition at line 183 of file AcComms.Cpp.

{
  static BYTE parms[] =
    VTS_I4;
  InvokeHelper(0x11, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     nNewValue);
}

void CAgentCtlCommandsEx::SetVisible ( BOOL bNewValue )

Definition at line 127 of file AcComms.Cpp.

{
  static BYTE parms[] =
    VTS_BOOL;
  InvokeHelper(0x5, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     bNewValue);
}

void CAgentCtlCommandsEx::SetVoice ( LPCTSTR lpszNewValue )

Definition at line 112 of file AcComms.Cpp.

{
  static BYTE parms[] =
    VTS_BSTR;
  InvokeHelper(0x4, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     lpszNewValue);
}

void CAgentCtlCommandsEx::SetVoiceCaption ( LPCTSTR lpszNewValue )

Definition at line 228 of file AcComms.Cpp.

{
  static BYTE parms[] =
    VTS_BSTR;
  InvokeHelper(0x16, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     lpszNewValue);
}

The documentation for this class was generated from the following files:
  • Web/MSAgent/c/CapMFC/AcComms.h
  • Web/MSAgent/c/CapMFC/AcComms.Cpp
Generated on Wed Nov 13 2024 16:55:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAgentCtlEx Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CAgentCtlEx Class Reference

#include "Acex.h"

List of all members.

Public Member Functions

virtual BOOL | Create (LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, UINT nID, CCreateContext *pContext=NULL)
BOOL | Create (LPCTSTR lpszWindowName, DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, UINT nID, CFile *pPersist=NULL, BOOL bStorage=FALSE, BSTR bstrLicKey=NULL)
CAgentCtlAudioObject GetAudioOutput ()
CAgentCtlCharacters GetCharacters ()
CLSID const & | GetClsid ()
LPDISPATCH | GetCommandsWindow ()
BOOL GetConnected ()
CAgentCtlPropertySheet GetPropertySheet ()
BOOL GetRaiseRequestErrors ()
LPDISPATCH | GetSpeechInput ()
BOOL GetSuspended ()
void | SetConnected (BOOL bNewValue)
void | SetRaiseRequestErrors (BOOL bNewValue)
void | ShowDefaultCharacterProperties (const VARIANT &x, const VARIANT &y)

Detailed Description

Definition at line 21 of file Acex.h.

Member Function Documentation

virtual BOOL CAgentCtlEx::Create | ( | LPCTSTR | lpszClassName,
 |  | LPCTSTR | lpszWindowName,
 |  | DWORD | dwStyle,
 |  | const RECT & | rect,
 |  | CWnd * | pParentWnd,
 |  | UINT | nID,
 |  | CCreateContext * | pContext = NULL |
 | ) |  |  | [inline, virtual]

Definition at line 32 of file Acex.h.

  { return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID); }

BOOL CAgentCtlEx::Create | ( | LPCTSTR | lpszWindowName,
 |  | DWORD | dwStyle,
 |  | const RECT & | rect,
 |  | CWnd * | pParentWnd,
 |  | UINT | nID,
 |  | CFile * | pPersist = NULL,
 |  | BOOL | bStorage = FALSE,
 |  | BSTR | bstrLicKey = NULL |
 | ) |  |  | [inline]

Definition at line 39 of file Acex.h.

  { return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID,
    pPersist, bStorage, bstrLicKey); }

CAgentCtlAudioObject CAgentCtlEx::GetAudioOutput ( )

Definition at line 76 of file Acex.Cpp.

{
  LPDISPATCH pDispatch;
  InvokeHelper(0x4, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&pDispatch, NULL);
  return CAgentCtlAudioObject(pDispatch);
}

CAgentCtlCharacters CAgentCtlEx::GetCharacters ( )

Definition at line 69 of file Acex.Cpp.

{
  LPDISPATCH pDispatch;
  InvokeHelper(0x3, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&pDispatch, NULL);
  return CAgentCtlCharacters(pDispatch);
}

CLSID const& CAgentCtlEx::GetClsid ( ) [inline]

Definition at line 26 of file Acex.h.

  {
    static CLSID const clsid
      = { 0xd45fd31b, 0x5c6e, 0x11d1, { 0x9e, 0xc1, 0x0, 0xc0, 0x4f, 0xd7, 0x8, 0x1f } };
    return clsid;
  }

LPDISPATCH CAgentCtlEx::GetCommandsWindow ( )

Definition at line 97 of file Acex.Cpp.

{
  LPDISPATCH result;
  InvokeHelper(0xc, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL);
  return result;
}

BOOL CAgentCtlEx::GetConnected ( )

Definition at line 104 of file Acex.Cpp.

{
  BOOL result;
  InvokeHelper(0x9, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
  return result;
}

CAgentCtlPropertySheet CAgentCtlEx::GetPropertySheet ( )

Definition at line 90 of file Acex.Cpp.

{
  LPDISPATCH pDispatch;
  InvokeHelper(0x8, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&pDispatch, NULL);
  return CAgentCtlPropertySheet(pDispatch);
}

BOOL CAgentCtlEx::GetRaiseRequestErrors ( )

Definition at line 134 of file Acex.Cpp.

{
  BOOL result;
  InvokeHelper(0x15, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
  return result;
}

LPDISPATCH CAgentCtlEx::GetSpeechInput ( )

Definition at line 83 of file Acex.Cpp.

{
  LPDISPATCH result;
  InvokeHelper(0x5, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL);
  return result;
}

BOOL CAgentCtlEx::GetSuspended ( )

Definition at line 119 of file Acex.Cpp.

{
  BOOL result;
  InvokeHelper(0xe, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
  return result;
}

void CAgentCtlEx::SetConnected ( BOOL bNewValue )

Definition at line 111 of file Acex.Cpp.

{
  static BYTE parms[] =
    VTS_BOOL;
  InvokeHelper(0x9, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     bNewValue);
}

void CAgentCtlEx::SetRaiseRequestErrors ( BOOL bNewValue )

Definition at line 141 of file Acex.Cpp.

{
  static BYTE parms[] =
    VTS_BOOL;
  InvokeHelper(0x15, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     bNewValue);
}

void CAgentCtlEx::ShowDefaultCharacterProperties | ( | const VARIANT & | x,
 |  | const VARIANT & | y
 | ) |  |

Definition at line 126 of file Acex.Cpp.

{
  static BYTE parms[] =
    VTS_VARIANT VTS_VARIANT;
  InvokeHelper(0x14, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
     &x, &y);
}

The documentation for this class was generated from the following files:
  • Web/MSAgent/c/CapMFC/Acex.h
  • Web/MSAgent/c/CapMFC/Acex.Cpp
Generated on Wed Nov 13 2024 16:55:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAgentCtlPropertySheet Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CAgentCtlPropertySheet Class Reference

#include "AcProp.h"

List of all members.

Public Member Functions

CAgentCtlPropertySheet ()
CAgentCtlPropertySheet (LPDISPATCH pDispatch)
CAgentCtlPropertySheet (const CAgentCtlPropertySheet &dispatchSrc)
short | GetHeight ()
short | GetLeft ()
CString GetPage ()
short | GetTop ()
BOOL GetVisible ()
short | GetWidth ()
void | SetPage (LPCTSTR lpszNewValue)
void | SetVisible (BOOL bNewValue)

Detailed Description

Definition at line 15 of file AcProp.h.

Constructor & Destructor Documentation

CAgentCtlPropertySheet::CAgentCtlPropertySheet ( ) [inline]

Definition at line 18 of file AcProp.h.

{}    // Calls COleDispatchDriver default constructor

CAgentCtlPropertySheet::CAgentCtlPropertySheet ( LPDISPATCH pDispatch ) [inline]

Definition at line 19 of file AcProp.h.

: COleDispatchDriver(pDispatch) {}

CAgentCtlPropertySheet::CAgentCtlPropertySheet ( const CAgentCtlPropertySheet & dispatchSrc ) [inline]

Definition at line 20 of file AcProp.h.

: COleDispatchDriver(dispatchSrc) {}

Member Function Documentation

short CAgentCtlPropertySheet::GetHeight ( )

Definition at line 74 of file AcProp.Cpp.

{
  short result;
  InvokeHelper(0x3, DISPATCH_PROPERTYGET, VT_I2, (void*)&result, NULL);
  return result;
}

short CAgentCtlPropertySheet::GetLeft ( )

Definition at line 60 of file AcProp.Cpp.

{
  short result;
  InvokeHelper(0x1, DISPATCH_PROPERTYGET, VT_I2, (void*)&result, NULL);
  return result;
}

CString CAgentCtlPropertySheet::GetPage ( )

Definition at line 111 of file AcProp.Cpp.

{
  CString result;
  InvokeHelper(0x5, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
  return result;
}

short CAgentCtlPropertySheet::GetTop ( )

Definition at line 67 of file AcProp.Cpp.

{
  short result;
  InvokeHelper(0x2, DISPATCH_PROPERTYGET, VT_I2, (void*)&result, NULL);
  return result;
}

BOOL CAgentCtlPropertySheet::GetVisible ( )

Definition at line 96 of file AcProp.Cpp.

{
  BOOL result;
  InvokeHelper(0x6, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
  return result;
}

short CAgentCtlPropertySheet::GetWidth ( )

Definition at line 81 of file AcProp.Cpp.

{
  short result;
  InvokeHelper(0x4, DISPATCH_PROPERTYGET, VT_I2, (void*)&result, NULL);
  return result;
}

void CAgentCtlPropertySheet::SetPage ( LPCTSTR lpszNewValue )

Definition at line 103 of file AcProp.Cpp.

{
  static BYTE parms[] =
    VTS_BSTR;
  InvokeHelper(0x5, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     lpszNewValue);
}

void CAgentCtlPropertySheet::SetVisible ( BOOL bNewValue )

Definition at line 88 of file AcProp.Cpp.

{
  static BYTE parms[] =
    VTS_BOOL;
  InvokeHelper(0x6, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     bNewValue);
}

The documentation for this class was generated from the following files:
  • Web/MSAgent/c/CapMFC/AcProp.h
  • Web/MSAgent/c/CapMFC/AcProp.Cpp
Generated on Wed Nov 13 2024 16:55:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAgentCtlRequest Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CAgentCtlRequest Class Reference

#include "AcReq.h"

List of all members.

Public Member Functions

CAgentCtlRequest ()
CAgentCtlRequest (LPDISPATCH pDispatch)
CAgentCtlRequest (const CAgentCtlRequest &dispatchSrc)
CString GetDescription ()
long | GetNumber ()
long | GetStatus ()

Detailed Description

Definition at line 15 of file AcReq.h.

Constructor & Destructor Documentation

CAgentCtlRequest::CAgentCtlRequest ( ) [inline]

Definition at line 18 of file AcReq.h.

{}    // Calls COleDispatchDriver default constructor

CAgentCtlRequest::CAgentCtlRequest ( LPDISPATCH pDispatch ) [inline]

Definition at line 19 of file AcReq.h.

: COleDispatchDriver(pDispatch) {}

CAgentCtlRequest::CAgentCtlRequest ( const CAgentCtlRequest & dispatchSrc ) [inline]

Definition at line 20 of file AcReq.h.

: COleDispatchDriver(dispatchSrc) {}

Member Function Documentation

CString CAgentCtlRequest::GetDescription ( )

Definition at line 67 of file AcReq.Cpp.

{
  CString result;
  InvokeHelper(0x2, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
  return result;
}

long CAgentCtlRequest::GetNumber ( )

Definition at line 74 of file AcReq.Cpp.

{
  long result;
  InvokeHelper(0x3, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
  return result;
}

long CAgentCtlRequest::GetStatus ( )

Definition at line 60 of file AcReq.Cpp.

{
  long result;
  InvokeHelper(0x1, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
  return result;
}

The documentation for this class was generated from the following files:
  • Web/MSAgent/c/CapMFC/AcReq.h
  • Web/MSAgent/c/CapMFC/AcReq.Cpp
Generated on Wed Nov 13 2024 16:55:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAgentCtlUserInput Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CAgentCtlUserInput Class Reference

#include "AcUser.h"

List of all members.

Public Member Functions

CAgentCtlUserInput ()
CAgentCtlUserInput (LPDISPATCH pDispatch)
CAgentCtlUserInput (const CAgentCtlUserInput &dispatchSrc)
long | GetAlt1Confidence ()
CString GetAlt1Name ()
CString GetAlt1Voice ()
long | GetAlt2Confidence ()
CString GetAlt2Name ()
CString GetAlt2Voice ()
CString GetCharacterID ()
long | GetConfidence ()
short | GetCount ()
CString GetName ()
CString GetVoice ()

Detailed Description

Definition at line 13 of file AcUser.h.

Constructor & Destructor Documentation

CAgentCtlUserInput::CAgentCtlUserInput ( ) [inline]

Definition at line 16 of file AcUser.h.

{}    // Calls COleDispatchDriver default constructor

CAgentCtlUserInput::CAgentCtlUserInput ( LPDISPATCH pDispatch ) [inline]

Definition at line 17 of file AcUser.h.

: COleDispatchDriver(pDispatch) {}

CAgentCtlUserInput::CAgentCtlUserInput ( const CAgentCtlUserInput & dispatchSrc ) [inline]

Definition at line 18 of file AcUser.h.

: COleDispatchDriver(dispatchSrc) {}

Member Function Documentation

long CAgentCtlUserInput::GetAlt1Confidence ( )

Definition at line 105 of file AcUser.Cpp.

{
  long result;
  InvokeHelper(0x60020006, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
  return result;
}

CString CAgentCtlUserInput::GetAlt1Name ( )

Definition at line 98 of file AcUser.Cpp.

{
  CString result;
  InvokeHelper(0x60020005, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
  return result;
}

CString CAgentCtlUserInput::GetAlt1Voice ( )

Definition at line 112 of file AcUser.Cpp.

{
  CString result;
  InvokeHelper(0x60020007, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
  return result;
}

long CAgentCtlUserInput::GetAlt2Confidence ( )

Definition at line 126 of file AcUser.Cpp.

{
  long result;
  InvokeHelper(0x60020009, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
  return result;
}

CString CAgentCtlUserInput::GetAlt2Name ( )

Definition at line 119 of file AcUser.Cpp.

{
  CString result;
  InvokeHelper(0x60020008, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
  return result;
}

CString CAgentCtlUserInput::GetAlt2Voice ( )

Definition at line 133 of file AcUser.Cpp.

{
  CString result;
  InvokeHelper(0x6002000a, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
  return result;
}

CString CAgentCtlUserInput::GetCharacterID ( )

Definition at line 77 of file AcUser.Cpp.

{
  CString result;
  InvokeHelper(0x60020002, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
  return result;
}

long CAgentCtlUserInput::GetConfidence ( )

Definition at line 84 of file AcUser.Cpp.

{
  long result;
  InvokeHelper(0x60020003, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
  return result;
}

short CAgentCtlUserInput::GetCount ( )

Definition at line 63 of file AcUser.Cpp.

{
  short result;
  InvokeHelper(0x60020000, DISPATCH_PROPERTYGET, VT_I2, (void*)&result, NULL);
  return result;
}

CString CAgentCtlUserInput::GetName ( )

Definition at line 70 of file AcUser.Cpp.

{
  CString result;
  InvokeHelper(0x60020001, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
  return result;
}

CString CAgentCtlUserInput::GetVoice ( )

Definition at line 91 of file AcUser.Cpp.

{
  CString result;
  InvokeHelper(0x60020004, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
  return result;
}

The documentation for this class was generated from the following files:
  • Web/MSAgent/c/CapMFC/AcUser.h
  • Web/MSAgent/c/CapMFC/AcUser.Cpp
Generated on Wed Nov 13 2024 16:55:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAggregate Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CAggregate Class Reference

#include "cbase.h"

List of all members.

Public Member Functions

CAggregate ()
virtual | ~CAggregate ()
virtual HRESULT | HandleAggregation (REFIID riid, IUnknown **ppIUnknown)
virtual STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
HRESULT | ReleaseInner ()
HRESULT | SetInner (IUnknown *pIUnkInner)
virtual | STDMETHODIMP_ (ULONG) AddRef(void)
virtual | STDMETHODIMP_ (ULONG) Release(void)

Protected Attributes

ULONG m_cRef
CComPtr< IUnknown > | m_spUnkInner

Detailed Description

Definition at line 373 of file cbase.h.

Constructor & Destructor Documentation

CAggregate::CAggregate ( )

Definition at line 509 of file cbase.cpp.

{
  m_cRef = 1;
}

CAggregate::~CAggregate ( ) [virtual]

Definition at line 519 of file cbase.cpp.

{
  //COM Aggregation rule #6
  //To free an inner pointer (other than IUnknown), the outer object calls its
  //own outer unknown's AddRef followed by Release on the inner object's pointer
  //Currently we don't have this case, since we only have IUnknown
  //AddRef()
  //SAFE_RELEASE(m_pNonIUnknownInner);

  //Inner object free
  ReleaseInner();
}

Member Function Documentation

HRESULT CAggregate::HandleAggregation | ( | REFIID | riid,
 |  | IUnknown ** | ppIUnknown |
 | ) |  |  | [virtual]

Definition at line 569 of file cbase.cpp.

{
  HRESULT hr = S_OK;
  IUnknown* pIUnkInner = ppIUnknown ? *ppIUnknown : NULL;

  if(pIUnkInner)
  {
    //This would be a bug in the provider if aggregaiton succeeded
    //but the user didn't request IID_IUnknown.
    if(riid != IID_IUnknown)
    {
      //NOTE:  We don't want to just continue here since this is dangerous.
      //If the provider succeeds, this means the outer object was probably returned rather
      //than the inner non-delegating IUnknown, this will cause our outer controlling object
      //to have a circular QI problem when asked for an inner interface, and will have refcounting
      //problems as well.  Might as well let the use know, and don't further this provider bug...
      if(IDNO == wMessageBox
        (
          GetFocus(),
          MB_TASKMODAL | MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON1,
          wsz_ERROR,
          L"Provider Bug: Allowed Aggregation and riid!=IID_IUnknown!\n\n"
          L"This may crash your Provider...\n"
          L"Do you wish to continue anyway?"
        ))
      {
        //return a failure if the user wished not to continue...
        TESTC(hr = E_INVALIDARG);
      }
    }

    //We need to "hook" up our objects.  So that our outer controlling object
    //has a pointer to the inner for delegating QI calls.  This must be an non-delegating
    //inner IUnknown, (see below).  Also the caller of this function will ALWAYS
    //release their CAggregate object, and we return a the Aggregate object with our
    //reference count.  (consistent with COM, calle never releases callers IUnknown, and
    //calle always addref's if they hold onto the callers object).
    if(SUCCEEDED(hr = SetInner(pIUnkInner)))
    {
      //SetInner
      TRACE_RELEASE(pIUnkInner, L"IUnknown");
      hr = QueryInterface(IID_IUnknown, (void**)ppIUnknown);
    }
  }

CLEANUP:
  return hr;
}

HRESULT CAggregate::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv |
 | ) |  |  | [virtual]

Definition at line 653 of file cbase.cpp.

{
  HRESULT hr = S_OK;

  //TEST_ NULL
  if(ppv == NULL)
    return E_INVALIDARG;
  *ppv = NULL;

  //Support IID_IUnknown
  if(riid == IID_IUnknown)
  {
    *ppv = (IUnknown*)this;
    SAFE_ADDREF((IUnknown*)*ppv);
  }
  else if(riid == IID_IAggregate)
  {
    *ppv = (IUnknown*)this;
    SAFE_ADDREF((IUnknown*)*ppv);
  }
  else if(m_spUnkInner)
  {
    //Delegate the the Inner Object
    //This is not "circular" since this interface is the IID_IUnknown
    //interface only, which has its own non-delegating QI...
    hr = m_spUnkInner->QueryInterface(riid, ppv);
  }
  else
  {
    return E_NOINTERFACE;
  }

  return hr;
}

HRESULT CAggregate::ReleaseInner ( )

Definition at line 551 of file cbase.cpp.

{
  //Only release the inner if the RefCount of the outer has gone to its
  //orginal refcount
  if(m_cRef <= 1)
  {
    TRACE_RELEASE(m_spUnkInner.p, L"IUnknown");
    return S_OK;
  }

  return S_FALSE;
}

HRESULT CAggregate::SetInner ( IUnknown * pIUnkInner )

Definition at line 537 of file cbase.cpp.

{
  if(!pIUnkInner)
    return E_INVALIDARG;

  TRACE_RELEASE(m_spUnkInner.p, L"IUnknown");
  return TRACE_QI(pIUnkInner, IID_IUnknown, (IUnknown**)&m_spUnkInner);
}

virtual CAggregate::STDMETHODIMP_ ( ULONG ) [virtual]
virtual CAggregate::STDMETHODIMP_ ( ULONG ) [virtual]

Member Data Documentation

ULONG CAggregate::m_cRef [protected]

Definition at line 391 of file cbase.h.

CComPtr<IUnknown> CAggregate::m_spUnkInner [protected]

Definition at line 392 of file cbase.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cbase.h
  • Dataaccess/oledb/rowsetviewer/cbase.cpp
Generated on Wed Nov 13 2024 16:55:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CallbackIUnknownLib::DeviceFinderCallBackInterface Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • CallbackIUnknownLib
  • CallbackIUnknownLib::DeviceFinderCallBackInterface
Public Member Functions

CallbackIUnknownLib::DeviceFinderCallBackInterface Interface Reference

import "cbklib.idl";

Inherits com::ms::com::IUnknown.

List of all members.

Public Member Functions

HRESULT CallbackFunction ([in] VARIANT device,[in] VARIANT UDN,[in] VARIANT callbackType)

Detailed Description

Definition at line 31 of file cbklib.idl.

Member Function Documentation

HRESULT CallbackIUnknownLib::DeviceFinderCallBackInterface::CallbackFunction | ( | [in] VARIANT | device,
 |  | [in] VARIANT | UDN,
 |  | [in] VARIANT | callbackType
 | ) |  |
The documentation for this interface was generated from the following file:
  • NetDS/upnp/FunctionDelegator/cbklib.idl
Generated on Wed Nov 13 2024 16:58:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CallbackIUnknownLib::ServiceCallBackInterface Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • CallbackIUnknownLib
  • CallbackIUnknownLib::ServiceCallBackInterface
Public Member Functions

CallbackIUnknownLib::ServiceCallBackInterface Interface Reference

import "cbklib.idl";

Inherits com::ms::com::IUnknown.

List of all members.

Public Member Functions

HRESULT CallbackFunction ([in] VARIANT pszCallbackType,[in] VARIANT svcObject,[in] VARIANT pszStateVarName,[in] VARIANT varValue)

Detailed Description

Definition at line 21 of file cbklib.idl.

Member Function Documentation

HRESULT CallbackIUnknownLib::ServiceCallBackInterface::CallbackFunction | ( | [in] VARIANT | pszCallbackType,
 |  | [in] VARIANT | svcObject,
 |  | [in] VARIANT | pszStateVarName,
 |  | [in] VARIANT | varValue
 | ) |  |
The documentation for this interface was generated from the following file:
  • NetDS/upnp/FunctionDelegator/cbklib.idl
Generated on Wed Nov 13 2024 16:58:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAlterColumnDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Private Attributes

CAlterColumnDlg Class Reference

#include "cdialog.h"

Inherits CDialogLite, and CRowsetViewerDlg.

List of all members.

Public Member Functions

CAlterColumnDlg (CMDIChild *pCMDIChild)
virtual | ~CAlterColumnDlg ()
HRESULT | AlterColumn (HWND hWndParent)
virtual BOOL | OnCommand (UINT iID, HWND hWndCtrl)
virtual BOOL | OnCommandNotify (INT wNotifyCode, INT iID, HWND hWndCtrl)
virtual BOOL | OnInitDialog ()
virtual BOOL | OnOK ()
virtual BOOL | OnSelChange (INT iID, HWND hWndCtrl)

Public Attributes

DBCOLUMNDESC | m_ColDesc
CPropSets m_CPropSets
DBCOLUMNDESCFLAGS | m_dwColFlags
BOOL m_fUseColProps
DBID * | m_pColumnID
DBID * | m_pTableID

Private Attributes

CComboBoxLite m_comboDBType
CComboBoxLite m_comboTypeName
CEditBoxLite m_editColumnName
CEditBoxLite m_editNewColumnName
CEditBoxLite m_editPrecision
CEditBoxLite m_editScale
CEditBoxLite m_editSize
CEditBoxLite m_editTableName
CListBoxLite m_listColumnDescFlags

Detailed Description

Definition at line 792 of file cdialog.h.

Constructor & Destructor Documentation

CAlterColumnDlg::CAlterColumnDlg ( CMDIChild * pCMDIChild )

Definition at line 5946 of file cdialog.cpp.

  : CDialogLite(IDD_ALTERCOLUMN), CRowsetViewerDlg(NULL, pCMDIChild)
{
  m_pTableID      = NULL;
  m_pColumnID     = NULL;
  m_fUseColProps    = FALSE;
  m_dwColFlags    = 0;
  memset(&m_ColDesc, 0, sizeof(DBCOLUMNDESC));
} //CAlterColumnDlg::CAlterColumnDlg

CAlterColumnDlg::~CAlterColumnDlg ( ) [virtual]

Definition at line 5976 of file cdialog.cpp.

{
  DBIDFree(m_pTableID);
  SAFE_FREE(m_pTableID);
  DBIDFree(m_pColumnID);
  SAFE_FREE(m_pColumnID);

  DBIDFree(&m_ColDesc.dbcid);
  SAFE_FREE(m_ColDesc.pwszTypeName);
} //CAlterColumnDlg::~CAlterColumnDlg

Member Function Documentation

HRESULT CAlterColumnDlg::AlterColumn ( HWND hWndParent )

Definition at line 5962 of file cdialog.cpp.

{
  //Now Display the dialog
  if(DoModal(hWndParent) == IDOK)
    return S_OK;

  return DB_E_CANCELED;
} //CAlterColumnDlg::AlterColumn

BOOL CAlterColumnDlg::OnCommand | ( | UINT | iID,
 |  | HWND | hWndCtrl |
 | ) |  |  | [virtual]

Definition at line 6074 of file cdialog.cpp.

{
  switch (iID)
  {
    case IDB_SETPROPERTIES:
    {
      // get the new index properties
      //Get the "this" pointer
      CSession    *pCSession    = (CSession*)m_pCMDIChild->GetObject(eCSession);
      CDataSource   *pCDataSource = SOURCE_GETPARENT(pCSession, CDataSource);
      CPropertiesDlg  sCPropertiesDlg(m_pCMainWindow);

      //SetProperties
      sCPropertiesDlg.SetProperties(hWndCtrl, &DBPROPSET_COLUMNALL, IID_IDBProperties, NULL, pCDataSource ? pCDataSource->m_pIDBProperties : NULL, &m_CPropSets);
      return TRUE;
    }
  }

  return FALSE;
} //CAlterColumnDlg::OnCommand

BOOL CAlterColumnDlg::OnCommandNotify | ( | INT | wNotifyCode,
 |  | INT | iID,
 |  | HWND | hWndCtrl |
 | ) |  |  | [virtual]

Definition at line 6100 of file cdialog.cpp.

{
  switch(wNotifyCode)
  {
    case CBN_SELCHANGE:
    {
      if(OnSelChange(iID, hWndCtrl))
        return TRUE;
      break;
    }
  };

  //Otherwise Delegate
  return CDialogLite::OnCommandNotify(wNotifyCode, iID, hWndCtrl);
} // CAlterColumnDlg::OnCommandNotify

BOOL CAlterColumnDlg::OnInitDialog ( ) [virtual]

Definition at line 5992 of file cdialog.cpp.

{
  CWaitCursor waitCursor;
  INDEX   iSel;
  DBORDINAL index;
  CMDIChild *pCMDIChild   = m_pCMDIChild;
  WCHAR   wszBuffer[MAX_NAME_LEN+1];

  CSession    *pCSession    = (CSession*)pCMDIChild->GetObject(eCSession);

  // make sure we have provider type info in the session
  if (0 == pCSession->m_cProvTypes)
    pCSession->GetProviderTypes();

  //Setup Controls
  m_editTableName.CreateIndirect(m_hWnd, IDE_TABLEID);
  m_editColumnName.CreateIndirect(m_hWnd, IDE_COLUMN);
  m_editNewColumnName.CreateIndirect(m_hWnd, IDE_COLUMNID);

  m_editSize.CreateIndirect(m_hWnd, IDE_SIZE);
  m_editPrecision.CreateIndirect(m_hWnd, IDE_PRECISION);
  m_editScale.CreateIndirect(m_hWnd, IDE_SCALE);

  m_listColumnDescFlags.CreateIndirect(m_hWnd, IDL_CDFLAGS);

  m_comboDBType.CreateIndirect(m_hWnd, IDC_TYPE);
  m_comboTypeName.CreateIndirect(m_hWnd, IDC_TYPENAME);

  //Auto Save buttons for change IndexID and use index properties
  CheckDlgButton(IDB_USEPROPERTIES, BST_UNCHECKED);

  //Fill in the column desc flag list
  for (index = 0; index < g_cCDFlagsMaps; index++)
  {
    iSel = m_listColumnDescFlags.AddString(g_rgCDFlagsMaps[index].pwszName);
    m_listColumnDescFlags.SetItemParam(iSel, g_rgCDFlagsMaps[index].lItem);
  }

  //Fill in the type name list
  for (index = 0; index < pCSession->m_cProvTypes; index++)
  {
    iSel = m_comboTypeName.AddString(pCSession->m_rgProvTypes[index].wszTypeName);
    m_comboTypeName.SetItemParam(iSel, (LPARAM)(&pCSession->m_rgProvTypes[index]));
  }
  m_comboTypeName.SetCurSel(0);

  //Fill in the DBTYPE list
  for (index = 0; index < g_cDBTypes; index++)
  {
    iSel = m_comboDBType.AddString(g_rgDBTypes[index].pwszName);
    m_comboDBType.SetItemParam(iSel, g_rgDBTypes[index].lItem);
  }

  // select the corresponding DBTYPE
  wSendMessage(m_comboDBType.GetWnd(), CB_SELECTSTRING, -1, GetDBTypeName(pCSession->m_rgProvTypes[0].wType));

  StringFormat(wszBuffer, NUMELE(wszBuffer), L"%lu", pCSession->m_rgProvTypes[0].ulColumnSize);
  m_editSize.SetWindowText(wszBuffer);

  if (IsNumericType(pCSession->m_rgProvTypes[0].wType))
  {
    StringFormat(wszBuffer, NUMELE(wszBuffer), L"%lu", pCSession->m_rgProvTypes[0].ulColumnSize);
    m_editPrecision.SetWindowText(wszBuffer);
  }
  else
  {
    m_editPrecision.SetWindowText(L"0");
  }

  m_editScale.SetWindowText(L"0");

  //Delegate
  return CDialogLite::OnInitDialog();
} // CAlterColumnDlg::OnInitDialog

BOOL CAlterColumnDlg::OnOK ( ) [virtual]

Definition at line 6197 of file cdialog.cpp.

{
  CWaitCursor waitCursor;
  WCHAR   *pwszTableName  = NULL;
  WCHAR   *pwszColumnName = NULL;
  HRESULT   hr;
  const ULONG cMaxSel = 2;
  INDEX   cSel;
  INT     rgSel[cMaxSel];
  HWND    hWndCDFlags   = GetDlgItem(IDL_CDFLAGS);
  LONG    lValue;
  DBORDINAL index;

  CMDIChild *pCMDIChild   = m_pCMDIChild;
  CSession  *pCSession    = (CSession*)pCMDIChild->GetObject(eCSession);

  PROVTYPEINFO  *pTypeInfo  = NULL;

  pwszTableName = m_editTableName.GetWindowText();
  if (pwszTableName)
  {
    SAFE_ALLOC(m_pTableID, DBID, 1);
    m_pTableID->eKind     = DBKIND_NAME;
    m_pTableID->uName.pwszName  = pwszTableName;
  }

  pwszColumnName = m_editColumnName.GetWindowText();
  if (pwszColumnName)
  {
    SAFE_ALLOC(m_pColumnID, DBID, 1);
    m_pColumnID->eKind      = DBKIND_NAME;
    m_pColumnID->uName.pwszName = pwszColumnName;
  }

  // fill in the flags
  cSel = SendMessage(hWndCDFlags, LB_GETSELITEMS, (WPARAM)cMaxSel, (LPARAM)rgSel);

  m_dwColFlags = 0;
  for (index = 0; index < (ULONG)cSel; index++)
  {
    m_dwColFlags |= this->m_listColumnDescFlags.GetItemParam(rgSel[index]);
  }

  // fill in the DBCOLUMNDESC structure
  memset(&m_ColDesc, 0, sizeof(DBCOLUMNDESC));

  // set column name
  pwszColumnName = m_editNewColumnName.GetWindowText();
  if (pwszColumnName)
  {
    m_ColDesc.dbcid.eKind     = DBKIND_NAME;
    m_ColDesc.dbcid.uName.pwszName  = pwszColumnName;
  }

  // get type name
  if (LB_ERR != m_comboTypeName.GetCurSel())
  {
    pTypeInfo = (PROVTYPEINFO*)m_comboTypeName.GetItemParam(m_comboTypeName.GetCurSel());
    m_ColDesc.pwszTypeName = wcsDuplicate(pTypeInfo->wszTypeName);
  }
  else
  {
    // it might be another value
    m_ColDesc.pwszTypeName = m_comboTypeName.GetWindowText();
  }

  // get wType
  m_ColDesc.wType = (DBTYPE)m_comboDBType.GetItemParam(m_comboDBType.GetCurSel());

  // get column size
  lValue = 0;
  GetEditBoxValue(m_editSize.GetWnd(), &lValue, 0/*Min*/, LONG_MAX/*Max*/, TRUE);
  m_ColDesc.ulColumnSize = lValue;

  // get precision
  GetEditBoxValue(m_editPrecision.GetWnd(), &lValue, 0/*Min*/, 255/*Max*/, TRUE);
  m_ColDesc.bPrecision = (BYTE)lValue;

  // get size
  GetEditBoxValue(m_editScale.GetWnd(), &lValue, 0/*Min*/, 255/*Max*/, TRUE);
  m_ColDesc.bScale = (BYTE)lValue;

  // get properties
  m_fUseColProps = IsDlgButtonChecked(IDB_USEPROPERTIES);
  if (m_fUseColProps)
  {
    m_ColDesc.cPropertySets = m_CPropSets.GetCount();
    m_ColDesc.rgPropertySets= m_CPropSets.GetPropSets();
  }

CLEANUP:
  //Delegate
  return CDialogLite::OnOK();
} //CAlterColumnDlg::OnOK

BOOL CAlterColumnDlg::OnSelChange | ( | INT | iID,
 |  | HWND | hWndCtrl |
 | ) |  |  | [virtual]

Definition at line 6121 of file cdialog.cpp.

{
  static WCHAR      wszBuffer[MAX_NAME_LEN+1];

  switch(iID)
  {
    case IDC_TYPENAME:
    {
      CMDIChild *pCMDIChild   = m_pCMDIChild;
      CSession  *pCSession    = (CSession*)pCMDIChild->GetObject(eCSession);

      PROVTYPEINFO  *pTypeInfo  = NULL;
      pTypeInfo = (PROVTYPEINFO*)m_comboTypeName.GetItemParam(m_comboTypeName.GetCurSel());

      if (pTypeInfo)
      {
        // select the corresponding DBTYPE
        wSendMessage(m_comboDBType.GetWnd(), CB_SELECTSTRING, -1, GetDBTypeName(pTypeInfo->wType));

        StringFormat(wszBuffer, NUMELE(wszBuffer), L"%lu", pTypeInfo->ulColumnSize);
        m_editSize.SetWindowText(wszBuffer);

        if (IsNumericType(pTypeInfo->wType))
        {
          StringFormat(wszBuffer, NUMELE(wszBuffer), L"%lu", pTypeInfo->ulColumnSize);
          m_editPrecision.SetWindowText(wszBuffer);
        }
        else
        {
          m_editPrecision.SetWindowText(L"0");
        }
      }

      return TRUE;
    }

    case IDC_TYPE:
    {
      CMDIChild *pCMDIChild   = m_pCMDIChild;
      CSession  *pCSession    = (CSession*)pCMDIChild->GetObject(eCSession);
      DBTYPE    wType;
      DBLENGTH ulMaxSize = 0;
      BYTE  bPrecision, bScale;

      wType = (DBTYPE)m_comboDBType.GetItemParam(m_comboDBType.GetCurSel());

      //Get Default Size,Prec,Scale for this type...
      GetDBTypeMaxSize(wType, &ulMaxSize, &bPrecision, &bScale);

      //Set Size
      wSendMessageFmt(m_editSize.GetWnd(), WM_SETTEXT, 0, L"%lu", ulMaxSize!=0 ? ulMaxSize : 255);

      //Set Precision
      wSendMessageFmt(m_editPrecision.GetWnd(), WM_SETTEXT, 0, L"%d", bPrecision);

      //Set Scale
      wSendMessageFmt(m_editScale.GetWnd(), WM_SETTEXT, 0, L"%d", bScale);

      // no type name
      m_comboTypeName.SetWindowText(L"");
      m_comboTypeName.SetCurSel(-1);

      return TRUE;
    }
  };

  return FALSE;
} //CAlterColumnDlg::OnSelChange

Member Data Documentation

DBCOLUMNDESC CAlterColumnDlg::m_ColDesc

Definition at line 831 of file cdialog.h.

CComboBoxLite CAlterColumnDlg::m_comboDBType [private]

Definition at line 805 of file cdialog.h.

CComboBoxLite CAlterColumnDlg::m_comboTypeName [private]

Definition at line 806 of file cdialog.h.

CPropSets CAlterColumnDlg::m_CPropSets

Definition at line 834 of file cdialog.h.

DBCOLUMNDESCFLAGS CAlterColumnDlg::m_dwColFlags

Definition at line 832 of file cdialog.h.

CEditBoxLite CAlterColumnDlg::m_editColumnName [private]

Definition at line 796 of file cdialog.h.

CEditBoxLite CAlterColumnDlg::m_editNewColumnName [private]

Definition at line 798 of file cdialog.h.

CEditBoxLite CAlterColumnDlg::m_editPrecision [private]

Definition at line 800 of file cdialog.h.

CEditBoxLite CAlterColumnDlg::m_editScale [private]

Definition at line 801 of file cdialog.h.

CEditBoxLite CAlterColumnDlg::m_editSize [private]

Definition at line 799 of file cdialog.h.

CEditBoxLite CAlterColumnDlg::m_editTableName [private]

Definition at line 795 of file cdialog.h.

BOOL CAlterColumnDlg::m_fUseColProps

Definition at line 830 of file cdialog.h.

CListBoxLite CAlterColumnDlg::m_listColumnDescFlags [private]

Definition at line 803 of file cdialog.h.

DBID* CAlterColumnDlg::m_pColumnID

Definition at line 829 of file cdialog.h.

DBID* CAlterColumnDlg::m_pTableID

Definition at line 828 of file cdialog.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialog.h
  • Dataaccess/oledb/rowsetviewer/cdialog.cpp
Generated on Wed Nov 13 2024 16:55:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAlterIndexDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CAlterIndexDlg Class Reference

#include "cdialog.h"

Inherits CDialogLite, and CRowsetViewerDlg.

List of all members.

Public Member Functions

CAlterIndexDlg (CMDIChild *pCMDIChild)
virtual | ~CAlterIndexDlg ()
HRESULT | AlterIndex (HWND hWndParent, DBID **ppTableID, DBID **ppIndexID, DBID **ppNewIndexID, BOOL *pfUseIndexProps)
virtual BOOL | OnCommand (UINT iID, HWND hWndCtrl)
virtual BOOL | OnInitDialog ()
virtual BOOL | OnOK ()

Public Attributes

CPropSets m_CPropSets
CEditBoxLite m_editIndexName
CEditBoxLite m_editNewIndexName
CEditBoxLite m_editTableName
BOOL * m_pfUseIndexProps
DBID ** | m_ppIndexID
DBID ** | m_ppNewIndexID
DBID ** | m_ppTableID

Detailed Description

Definition at line 712 of file cdialog.h.

Constructor & Destructor Documentation

CAlterIndexDlg::CAlterIndexDlg ( CMDIChild * pCMDIChild )

Definition at line 5653 of file cdialog.cpp.

  : CDialogLite(IDD_ALTERINDEX), CRowsetViewerDlg(NULL, pCMDIChild)
{
  m_ppTableID     = NULL;
  m_ppIndexID     = NULL;
  m_ppNewIndexID    = NULL;
  m_pfUseIndexProps = NULL;
} //CAlterIndexDlg::CAlterIndexDlg

CAlterIndexDlg::~CAlterIndexDlg ( ) [virtual]

Definition at line 5667 of file cdialog.cpp.

{
} //CAlterIndexDlg::~CAlterIndexDlg

Member Function Documentation

HRESULT CAlterIndexDlg::AlterIndex | ( | HWND | hWndParent,
 |  | DBID ** | ppTableID,
 |  | DBID ** | ppIndexID,
 |  | DBID ** | ppNewIndexID,
 |  | BOOL * | pfUseIndexProps
 | ) |  |

Definition at line 5676 of file cdialog.cpp.

{
  ASSERT(ppTableID);
  ASSERT(ppIndexID);
  ASSERT(ppNewIndexID);
  ASSERT(pfUseIndexProps);

  m_ppTableID     = ppTableID;
  m_ppIndexID     = ppIndexID;
  m_ppNewIndexID    = ppNewIndexID;
  m_pfUseIndexProps = pfUseIndexProps;

  *m_ppTableID = NULL;
  *m_ppIndexID = NULL;
  *m_ppNewIndexID = NULL;

  *pfUseIndexProps = FALSE;

  //Now Display the dialog
  if(DoModal(hWndParent) == IDOK)
    return S_OK;

  return DB_E_CANCELED;
} //CAlterIndexDlg::AlterIndex

BOOL CAlterIndexDlg::OnCommand | ( | UINT | iID,
 |  | HWND | hWndCtrl |
 | ) |  |  | [virtual]

Definition at line 5738 of file cdialog.cpp.

{
  switch (iID)
  {
    case IDB_INDEXPROPERTIES:
    {
      // get the new index properties
      //Get the "this" pointer
//      CAlterIndexDlg  *pThis      = (CAlterIndexDlg*)GetThis(hWndCtrl);
      CMDIChild   *pCMDIChild   = this->m_pCMDIChild;
      CMainWindow   *pCMainWindow = pCMDIChild->m_pCMainWindow;

      CSession    *pCSession    = (CSession*)pCMDIChild->GetObject(eCSession);
      CDataSource   *pCDataSource = SOURCE_GETPARENT(pCSession, CDataSource);
      CPropertiesDlg  sCPropertiesDlg(pCMainWindow);

      //SetProperties
      sCPropertiesDlg.SetProperties(hWndCtrl, &DBPROPSET_INDEXALL, IID_IDBProperties, NULL, pCDataSource ? pCDataSource->m_pIDBProperties : NULL, &this->m_CPropSets);
      return TRUE;
    }
    case IDC_ChangeIndexID:
    {
      m_editNewIndexName.EnableWindow(IsDlgButtonChecked(IDC_ChangeIndexID));
      return TRUE;
    }
  }

  return FALSE;
} //CAlterIndexDlg::OnCommand

BOOL CAlterIndexDlg::OnInitDialog ( ) [virtual]

Definition at line 5712 of file cdialog.cpp.

{
  CWaitCursor waitCursor;

  //Setup Controls
  m_editTableName.CreateIndirect(m_hWnd, IDE_TABLEID);
  m_editIndexName.CreateIndirect(m_hWnd, IDE_INDEXID);
  m_editNewIndexName.CreateIndirect(m_hWnd, IDE_NewIndexID);

  //Auto Save buttons for change IndexID and use index properties
  CheckDlgButton(IDB_USEPROPERTIES, BST_UNCHECKED);
  CheckDlgButton(IDC_ChangeIndexID, (*m_pfUseIndexProps)? BST_CHECKED: BST_UNCHECKED);

  m_editNewIndexName.EnableWindow(FALSE);

  //Delegate
  return CDialogLite::OnInitDialog();
} // CAlterIndexDlg::OnInitDialog

BOOL CAlterIndexDlg::OnOK ( ) [virtual]

Definition at line 5773 of file cdialog.cpp.

{
  CWaitCursor waitCursor;
  WCHAR   *pwszTableName = NULL;
  WCHAR   *pwszIndexName = NULL;
  WCHAR   *pwszNewIndexName = NULL;
  HRESULT   hr;

  pwszTableName = m_editTableName.GetWindowText();
  if (pwszTableName)
  {
    SAFE_ALLOC(*m_ppTableID, DBID, 1);
    (*m_ppTableID)->eKind     = DBKIND_NAME;
    (*m_ppTableID)->uName.pwszName  = pwszTableName;
  }

  pwszIndexName = m_editIndexName.GetWindowText();
  if (pwszIndexName)
  {
    SAFE_ALLOC(*m_ppIndexID, DBID, 1);
    (*m_ppIndexID)->eKind     = DBKIND_NAME;
    (*m_ppIndexID)->uName.pwszName  = pwszIndexName;
  }

  pwszNewIndexName = m_editNewIndexName.GetWindowText();
  if (pwszNewIndexName)
  {
    SAFE_ALLOC(*m_ppNewIndexID, DBID, 1);
    (*m_ppNewIndexID)->eKind      = DBKIND_NAME;
    (*m_ppNewIndexID)->uName.pwszName = pwszNewIndexName;
  }

  *m_pfUseIndexProps = IsDlgButtonChecked(IDB_USEPROPERTIES);

CLEANUP:
  //Delegate
  return CDialogLite::OnOK();
} //CAlterIndexDlg::OnOK

Member Data Documentation

CPropSets CAlterIndexDlg::m_CPropSets

Definition at line 743 of file cdialog.h.

CEditBoxLite CAlterIndexDlg::m_editIndexName

Definition at line 747 of file cdialog.h.

CEditBoxLite CAlterIndexDlg::m_editNewIndexName

Definition at line 748 of file cdialog.h.

CEditBoxLite CAlterIndexDlg::m_editTableName

Definition at line 746 of file cdialog.h.

BOOL* CAlterIndexDlg::m_pfUseIndexProps

Definition at line 741 of file cdialog.h.

DBID** CAlterIndexDlg::m_ppIndexID

Definition at line 739 of file cdialog.h.

DBID** CAlterIndexDlg::m_ppNewIndexID

Definition at line 740 of file cdialog.h.

DBID** CAlterIndexDlg::m_ppTableID

Definition at line 738 of file cdialog.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialog.h
  • Dataaccess/oledb/rowsetviewer/cdialog.cpp
Generated on Wed Nov 13 2024 16:55:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAlterTableDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Private Attributes

CAlterTableDlg Class Reference

#include "cdialog.h"

Inherits CDialogLite, and CRowsetViewerDlg.

List of all members.

Public Member Functions

CAlterTableDlg (CMDIChild *pCMDIChild)
virtual | ~CAlterTableDlg ()
HRESULT | AlterTable (HWND hWndParent)
virtual BOOL | OnCommand (UINT iID, HWND hWndCtrl)
virtual BOOL | OnInitDialog ()
virtual BOOL | OnOK ()

Public Attributes

CPropSets m_CPropSets
BOOL m_fUseTableProps
DBID * | m_pNewTableID
DBID * | m_pTableID

Private Attributes

CEditBoxLite m_editNewTableName
CEditBoxLite m_editTableName

Detailed Description

Definition at line 756 of file cdialog.h.

Constructor & Destructor Documentation

CAlterTableDlg::CAlterTableDlg ( CMDIChild * pCMDIChild )

Definition at line 5817 of file cdialog.cpp.

  : CDialogLite(IDD_ALTERTABLE), CRowsetViewerDlg(NULL, pCMDIChild)
{
  m_pTableID      = NULL;
  m_pNewTableID   = NULL;
  m_fUseTableProps  = FALSE;
} //CAlterTableDlg::CAlterTableDlg

CAlterTableDlg::~CAlterTableDlg ( ) [virtual]

Definition at line 5845 of file cdialog.cpp.

{
  DBIDFree(m_pTableID);
  SAFE_FREE(m_pTableID);
  DBIDFree(m_pNewTableID);
  SAFE_FREE(m_pNewTableID);
} //CAlterTableDlg::~CAlterTableDlg

Member Function Documentation

HRESULT CAlterTableDlg::AlterTable ( HWND hWndParent )

Definition at line 5831 of file cdialog.cpp.

{
  //Now Display the dialog
  if(DoModal(hWndParent) == IDOK)
    return S_OK;

  return DB_E_CANCELED;
} //CAlterTableDlg::AlterTable

BOOL CAlterTableDlg::OnCommand | ( | UINT | iID,
 |  | HWND | hWndCtrl |
 | ) |  |  | [virtual]

Definition at line 5880 of file cdialog.cpp.

{
  switch (iID)
  {
    case IDB_TABLEPROPERTIES:
    {
      // get the new index properties
      //Get the "this" pointer
      CMDIChild   *pCMDIChild   = m_pCMDIChild;
      CMainWindow   *pCMainWindow = pCMDIChild->m_pCMainWindow;

      CSession    *pCSession    = (CSession*)pCMDIChild->GetObject(eCSession);
      CDataSource   *pCDataSource = SOURCE_GETPARENT(pCSession, CDataSource);
      CPropertiesDlg  sCPropertiesDlg(pCMainWindow);

      //SetProperties
      sCPropertiesDlg.SetProperties(hWndCtrl, &DBPROPSET_TABLEALL, IID_IDBProperties, NULL, pCDataSource ? pCDataSource->m_pIDBProperties : NULL, &m_CPropSets);
      return TRUE;
    }
  }

  return FALSE;
} //CAlterTableDlg::OnCommand

BOOL CAlterTableDlg::OnInitDialog ( ) [virtual]

Definition at line 5858 of file cdialog.cpp.

{
  CWaitCursor waitCursor;

  //Setup Controls
  m_editTableName.CreateIndirect(m_hWnd, IDE_TABLEID);
  m_editNewTableName.CreateIndirect(m_hWnd, IDE_NewTableID);

  //Auto Save buttons for change IndexID and use index properties
  CheckDlgButton(IDB_USEPROPERTIES, BST_UNCHECKED);

  //Delegate
  return CDialogLite::OnInitDialog();
} // CAlterTableDlg::OnInitDialog

BOOL CAlterTableDlg::OnOK ( ) [virtual]

Definition at line 5909 of file cdialog.cpp.

{
  CWaitCursor waitCursor;
  WCHAR   *pwszTableName = NULL;
  WCHAR   *pwszNewTableName = NULL;
  HRESULT   hr;

  pwszTableName = m_editTableName.GetWindowText();
  if (pwszTableName)
  {
    SAFE_ALLOC(m_pTableID, DBID, 1);
    m_pTableID->eKind     = DBKIND_NAME;
    m_pTableID->uName.pwszName  = pwszTableName;
  }

  pwszNewTableName = m_editNewTableName.GetWindowText();
  if (pwszNewTableName)
  {
    SAFE_ALLOC(m_pNewTableID, DBID, 1);
    m_pNewTableID->eKind      = DBKIND_NAME;
    m_pNewTableID->uName.pwszName = pwszNewTableName;
  }

  m_fUseTableProps = IsDlgButtonChecked(IDB_USEPROPERTIES);

CLEANUP:
  //Delegate
  return CDialogLite::OnOK();
} //CAlterTableDlg::OnOK

Member Data Documentation

CPropSets CAlterTableDlg::m_CPropSets

Definition at line 784 of file cdialog.h.

CEditBoxLite CAlterTableDlg::m_editNewTableName [private]

Definition at line 760 of file cdialog.h.

CEditBoxLite CAlterTableDlg::m_editTableName [private]

Definition at line 759 of file cdialog.h.

BOOL CAlterTableDlg::m_fUseTableProps

Definition at line 782 of file cdialog.h.

DBID* CAlterTableDlg::m_pNewTableID

Definition at line 781 of file cdialog.h.

DBID* CAlterTableDlg::m_pTableID

Definition at line 780 of file cdialog.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialog.h
  • Dataaccess/oledb/rowsetviewer/cdialog.cpp
Generated on Wed Nov 13 2024 16:55:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAnchorTag Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CAnchorTag Class Reference

#include "Anchor.Hxx"

Inherits CHtmlElement.

List of all members.

Public Member Functions

CAnchorTag (CHtmlIFilter &htmlIFilter, CSerialStream &serialStream)
~CAnchorTag ()
virtual SCODE | GetChunk (STAT_CHUNK *pStat)
virtual SCODE | GetText (ULONG *pcwcOutput, WCHAR *awcBuffer)
virtual void | InitStatChunk (STAT_CHUNK *pStat)

Private Attributes

unsigned | _cHrefChars
unsigned | _cHrefCharsFiltered
AnchorTagState _eState
WCHAR * | _pwcHrefBuf
unsigned | _uLenHrefBuf

Detailed Description

Definition at line 32 of file Anchor.Hxx.

Constructor & Destructor Documentation

CAnchorTag::CAnchorTag | ( | CHtmlIFilter & | htmlIFilter,
 |  | CSerialStream & | serialStream
 | ) |  |

Definition at line 30 of file Anchor.Cxx.

    : CHtmlElement(htmlIFilter, serialStream),
      _eState(StartAnchor),
      _pwcHrefBuf(0),
      _uLenHrefBuf(0),
      _cHrefChars(0),
      _cHrefCharsFiltered(0)
{
}

CAnchorTag::~CAnchorTag ( )

Definition at line 54 of file Anchor.Cxx.

{
    delete[] _pwcHrefBuf;
}

Member Function Documentation

SCODE CAnchorTag::GetChunk ( STAT_CHUNK * pStat ) [virtual]

Implements CHtmlElement.

Definition at line 70 of file Anchor.Cxx.

{
    //
    // Toggle state
    //
    if ( _eState == StartAnchor )
        _eState = EndAnchor;
    else
        _eState = StartAnchor;

    SCODE sc = SwitchToNextHtmlElement( pStat );

    return sc;
}

SCODE CAnchorTag::GetText | ( | ULONG * | pcwcOutput,
 |  | WCHAR * | awcBuffer |
 | ) |  |  | [virtual]

Implements CHtmlElement.

Definition at line 98 of file Anchor.Cxx.

{
    if ( _eState == StartAnchor )
    {
        *pcwcOutput = 0;
        return FILTER_E_NO_MORE_TEXT;
    }

    ULONG cCharsRemaining = _cHrefChars - _cHrefCharsFiltered;

    if ( cCharsRemaining == 0 )
    {
        *pcwcOutput = 0;
        return FILTER_E_NO_MORE_TEXT;
    }

    if ( *pcwcOutput < cCharsRemaining )
    {
        RtlCopyMemory( awcBuffer,
                       _pwcHrefBuf + _cHrefCharsFiltered,
                       *pcwcOutput * sizeof(WCHAR) );
        _cHrefCharsFiltered += *pcwcOutput;

        return S_OK;
    }
    else
    {
        RtlCopyMemory( awcBuffer,
                       _pwcHrefBuf + _cHrefCharsFiltered,
                       cCharsRemaining * sizeof(WCHAR) );
        _cHrefCharsFiltered += cCharsRemaining;
        *pcwcOutput = cCharsRemaining;

        return FILTER_S_LAST_TEXT;
    }
}

void CAnchorTag::InitStatChunk ( STAT_CHUNK * pStat ) [virtual]

Implements CHtmlElement.

Definition at line 147 of file Anchor.Cxx.

{
    pStat->idChunk = _htmlIFilter.GetNextChunkId();
    pStat->flags = CHUNK_TEXT;
    pStat->locale = _htmlIFilter.GetLocale();
    pStat->attribute.guidPropSet = CLSID_HtmlInformation;
    pStat->attribute.psProperty.ulKind = PRSPEC_PROPID;
    pStat->attribute.psProperty.propid = PID_HREF;
    pStat->breakType = CHUNK_EOS;

    if ( _eState == StartAnchor)
    {
        //
        // Start tag, hence read href field into local buffer
        //
        _scanner.ReadTagIntoBuffer();

        WCHAR *pwcHrefBuf;
        unsigned cHrefChars;
        _scanner.ScanTagBuffer( L"href=\"", pwcHrefBuf, cHrefChars );

        //
        // Need to grow internal buffer ?
        //
        if ( cHrefChars > _uLenHrefBuf )
        {
            delete[] _pwcHrefBuf;
            _pwcHrefBuf = 0;
            _uLenHrefBuf = 0;

            _pwcHrefBuf = newk(mtNewX, NULL) WCHAR[cHrefChars];
            _uLenHrefBuf = cHrefChars;
        }

        RtlCopyMemory( _pwcHrefBuf, pwcHrefBuf, cHrefChars*sizeof(WCHAR) );
        _cHrefChars = cHrefChars;
        _cHrefCharsFiltered = 0;

        pStat->idChunkSource = 0;
        pStat->cwcStartSource = 0;
        pStat->cwcLenSource = 0;
    }
    else
    {
        Win4Assert( _eState == EndAnchor );

        _scanner.EatTag();

        //
        // Set up the filter region to be the one between the start and end
        // anchor tags, i.e. the region belonging to the current Html element,
        // because we haven't changed state yet.
        //
        _htmlIFilter.GetCurHtmlElement()->InitFilterRegion( pStat->idChunkSource,
                                                            pStat->cwcStartSource,
                                                            pStat->cwcLenSource );
    }
}

Member Data Documentation

unsigned CAnchorTag::_cHrefChars [private]

Definition at line 48 of file Anchor.Hxx.

unsigned CAnchorTag::_cHrefCharsFiltered [private]

Definition at line 49 of file Anchor.Hxx.

AnchorTagState CAnchorTag::_eState [private]

Definition at line 45 of file Anchor.Hxx.

WCHAR* CAnchorTag::_pwcHrefBuf [private]

Definition at line 46 of file Anchor.Hxx.

unsigned CAnchorTag::_uLenHrefBuf [private]

Definition at line 47 of file Anchor.Hxx.

The documentation for this class was generated from the following files:
  • WinBase/Indexing/IFilter/Anchor.Hxx
  • WinBase/Indexing/IFilter/Anchor.Cxx
Generated on Wed Nov 13 2024 16:55:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAnnotator Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CAnnotator Class Reference

#include "Annotator.h"

List of all members.

Public Member Functions

CAnnotator ()
STDMETHOD() | AddComment ()
STDMETHOD() | AttachAnnotator (IHTMLDocument2 *pDoc)
STDMETHOD() | DetachAnnotator ()
STDMETHOD() | PostEditorEventNotify (DISPID inEvtDispId, IHTMLEventObj *pIEventObj)
STDMETHOD() | PostHandleEvent (DISPID inEvtDispId, IHTMLEventObj *pIEventObj)
STDMETHOD() | PreHandleEvent (DISPID inEvtDispId, IHTMLEventObj *pIEventObj)
STDMETHOD() | ShowCommentGlyphs (BOOL bShow)
STDMETHOD() | TranslateAccelerator (DISPID inEvtDispId, IHTMLEventObj *pIEventObj)

Private Member Functions

STDMETHOD() | CloseCommentEditBox ()
HRESULT | OnDraw (ATL_DRAWINFO &di)
STDMETHOD() | OpenCommentEditBox (IHTMLElement *pSrcElem)

Private Attributes

HCURSOR | m_hOldCursor
CComPtr< IHTMLElement > | m_spCommentEditBox
CComPtr< IHTMLEditDesigner > | m_spDesigner
CComPtr< IHTMLDocument2 > | m_spDoc
CComPtr< IHTMLElement > | m_spSrcElem

Detailed Description

Definition at line 17 of file Annotator.h.

Constructor & Destructor Documentation

CAnnotator::CAnnotator ( ) [inline]

Definition at line 38 of file Annotator.h.

    {
    }

Member Function Documentation

STDMETHODIMP CAnnotator::AddComment ( )

Definition at line 191 of file Annotator.cpp.

{
    CComPtr<IDisplayServices> spDS;
    CComPtr<IHTMLCaret> spCaret;
    CComPtr<IDisplayPointer> spDP;
    CComPtr<IHTMLElement> spNewComment;
    CComPtr<IHTMLElement> spFElem;
  CComPtr<IHTMLElement3> spFElem3;
    CComPtr<IHTMLWindow2> spWin;
    CComPtr<IMarkupServices> spMS;
    CComPtr<IMarkupPointer> spMP;
  VARIANT_BOOL bIsEditable;

    // Retrieve interface for insertion point,
    // place display pointer at its location, and retrieve the
  // flow element containing the display pointer
    m_spDoc->QueryInterface(IID_IDisplayServices, (void**)&spDS);
    spDS->CreateDisplayPointer(&spDP);
    spDS->GetCaret(&spCaret);
    spCaret->MoveDisplayPointerToCaret(spDP);
    spDP->GetFlowElement(&spFElem);

  // Check if display pointer is in content-editable area
  spFElem->QueryInterface(IID_IHTMLElement3, (void**)&spFElem3);
  spFElem3->get_isContentEditable(&bIsEditable);
  if (bIsEditable != VARIANT_TRUE) return S_OK;

    // Check to see if comment is open;
    if (m_spCommentEditBox)
    {
        // If so, check to see if caret is in comment edit box

        if (spFElem.IsEqualObject(m_spCommentEditBox))
        {
            // If so, alert that comment can't be added to comment and return
            m_spDoc->get_parentWindow(&spWin);
            spWin->alert(L"Cannot add comment to comment.");
            return S_OK;
        }
        else
            CloseCommentEditBox();
    }

    // Add the new comment and open the comment edit box for it
    m_spDoc->QueryInterface(IID_IMarkupServices, (void**)&spMS);

    spMS->CreateElement(TAGID_COMMENT,
                        NULL,
                        &spNewComment);

    spMS->CreateMarkupPointer(&spMP);
    spDP->PositionMarkupPointer(spMP);

    spMS->InsertElement(spNewComment, spMP, NULL);
    OpenCommentEditBox(spNewComment);

    return S_OK;
}

STDMETHODIMP CAnnotator::AttachAnnotator ( IHTMLDocument2 * pDoc )

Definition at line 120 of file Annotator.cpp.

{
    CComPtr<IServiceProvider> spSP;
    CComPtr<IHTMLEditServices> spES;

    m_spDoc = pDoc; // IUnknown::AddRef is automatically called
                    // on smart pointer m_spDoc

    m_spDoc->QueryInterface(IID_IServiceProvider, (void**)&spSP);

    spSP->QueryService(SID_SHTMLEditServices,
                       IID_IHTMLEditServices,
                       (void**)&spES);

    this->QueryInterface(IID_IHTMLEditDesigner, (void**)&m_spDesigner);

    spES->AddDesigner(m_spDesigner);

    return S_OK;
}

STDMETHODIMP CAnnotator::CloseCommentEditBox ( ) [private]

Definition at line 385 of file Annotator.cpp.

{
    USES_CONVERSION;

    CComBSTR tagName;
    CComBSTR commentString;
    CComPtr<IHTMLWindow2> spWin;
    CComPtr<IHTMLElement> spBodyElem;
    CComPtr<IHTMLElement> spParElem;
    CComPtr<IHTMLDOMNode> spParElemNode;
    CComPtr<IHTMLDOMNode> spTempCommentBoxNode;
    CComPtr<IMarkupServices> spMUServ;
    CComPtr<IMarkupPointer> spMPSrcBeg;
    CComPtr<IMarkupPointer> spMPSrcEnd;
    CComPtr<IHTMLCommentElement> spCommentElement;
    CComPtr<IOleCommandTarget> spCmdTarg;

    m_spSrcElem->get_tagName(&tagName);
    LPSTR szName = OLE2A(tagName);

    // Format new comment from comment edit box inner text
    // Note: two different styles of comment
    if (!strcmp(szName, "!"))
        commentString = "<!--";

    CComBSTR spanString;
    m_spCommentEditBox->get_innerText(&spanString);
    commentString.AppendBSTR(spanString);

    if (!strcmp(szName, "!"))
        commentString.Append(_T("-->"));

    // Place new text in original comment
    m_spSrcElem->QueryInterface(IID_IHTMLCommentElement, (void**)&spCommentElement);
    spCommentElement->put_text(commentString);

    // Remove comment edit box
    m_spCommentEditBox->get_parentElement(&spParElem);

    m_spCommentEditBox->QueryInterface(IID_IHTMLDOMNode,
                                       (void**)&spTempCommentBoxNode);

    spParElem->QueryInterface(IID_IHTMLDOMNode,
                              (void**)&spParElemNode);

    spParElemNode->removeChild(spTempCommentBoxNode, NULL);

    // Release interface pointers; assignment of NULL causes automatic
    // call to IUnknown::Release on CComPtr smart pointers
    m_spCommentEditBox = (IHTMLElement*)NULL;
    m_spSrcElem = (IHTMLElement*)NULL;

    // Reactivate resizing handles when leaving comment edit mode
    m_spDoc->QueryInterface(IID_IOleCommandTarget, (void**)&spCmdTarg);
    spCmdTarg->Exec(&CGID_MSHTML, IDM_DISABLE_EDITFOCUS_UI, OLECMDEXECOPT_DODEFAULT, NULL, NULL);

    return S_OK;
}

STDMETHODIMP CAnnotator::DetachAnnotator ( )

Definition at line 141 of file Annotator.cpp.

{
    CComPtr<IServiceProvider> spSP;
    CComPtr<IHTMLEditServices> spES;

    m_spDoc->QueryInterface(IID_IServiceProvider, (void**)&spSP);

    spSP->QueryService(SID_SHTMLEditServices,
                       IID_IHTMLEditServices,
                       (void**)&spES);

    spES->RemoveDesigner(m_spDesigner);

    m_spDesigner = (IHTMLEditDesigner*)NULL; // Assignment of NULL causes automatic
                                             // call toIUnknown::Release on the
                                             // m_spDesigner smart pointer.
    return S_OK;
}

HRESULT CAnnotator::OnDraw ( ATL_DRAWINFO & di ) [inline, private]

Definition at line 102 of file Annotator.h.

    {
        RECT& rc = *(RECT*)di.prcBounds;
        Rectangle(di.hdcDraw, rc.left, rc.top, rc.right, rc.bottom);

        SetTextAlign(di.hdcDraw, TA_CENTER|TA_BASELINE);
        LPCTSTR pszText = _T("ATL 3.0 : Annotator");
        TextOut(di.hdcDraw,
            (rc.left + rc.right) / 2,
            (rc.top + rc.bottom) / 2,
            pszText,
            lstrlen(pszText));

        return S_OK;
    }

STDMETHODIMP CAnnotator::OpenCommentEditBox ( IHTMLElement * pSrcElem ) [private]

Definition at line 252 of file Annotator.cpp.

{
    USES_CONVERSION;

    CComPtr<IHTMLElement> spBody;
    CComPtr<IHTMLElement2> spBody2;
    CComPtr<IHTMLElement2> spSrcElem2;
    CComPtr<IHTMLElement2> spCommentEditBox2;
    CComPtr<IHTMLElement3> spCommentEditBox3;
    CComPtr<IHTMLStyle> spStyle;
    CComPtr<IHTMLStyle2> spStyle2;
    CComBSTR bstrOuterHTML;
    CComBSTR spanString;
    CComBSTR tagName;
    CComVariant vBoxLeft, vBoxTop, vBoxWidth, vBoxHeight, vBoxBGColor;
    LPTSTR szName;

    // Retrieve entire comment and tag name
    m_spSrcElem = pSrcElem;
    m_spSrcElem->get_outerHTML(&bstrOuterHTML);
    m_spSrcElem->get_tagName(&tagName);
    szName = OLE2T(tagName);

    // Extract text from comment depending on comment style
    LONG lCommentLength = bstrOuterHTML.Length();

    if (!_tcscmp(szName, _T("!")))
    {
        for (int i = 4; i < lCommentLength - 3; i++)
        {
            LPTSTR onechar = (LPTSTR)&bstrOuterHTML.m_str[i];
            spanString.Append(onechar);
        }
    }

    if (!_tcscmp(szName, _T("COMMENT")))
    {
        int endbracket = 8;
        LPTSTR onechar = (LPTSTR)&bstrOuterHTML.m_str[endbracket];

        while (_tcscmp(onechar, _T(">")))
            onechar = (LPTSTR)&bstrOuterHTML.m_str[++endbracket];

        for (int i = ++endbracket; i < lCommentLength - 10; i++)
        {
            LPTSTR onechar = (LPTSTR)&bstrOuterHTML.m_str[i];
            spanString.Append(onechar);
        }
    }

    // Disable resizing handles on while in comment edit mode
    CComPtr<IOleCommandTarget> spCmdTarg;
    m_spDoc->QueryInterface(IID_IOleCommandTarget, (void**)&spCmdTarg);
    spCmdTarg->Exec(&CGID_MSHTML, IDM_DISABLE_EDITFOCUS_UI, OLECMDEXECOPT_DODEFAULT, NULL, NULL);

    // Create the temporary comment edit box
    m_spDoc->createElement(L"span", &m_spCommentEditBox);
    m_spCommentEditBox->put_innerHTML(spanString);

    // insertAdjacentElement must be called after put_innerHTML
    // or the undo command can erase the comment box's contents
    // insertAdjacentElement protects put_innerHTML from
    // inclusion in undo stack
    m_spDoc->get_body(&spBody);
    spBody->QueryInterface(IID_IHTMLElement2, (void**)&spBody2);
    spBody2->insertAdjacentElement(L"beforeEnd", m_spCommentEditBox, NULL);

    CComPtr<IMarkupServices> spMUS;
    CComPtr<IMarkupPointer> spMUP;
    CComPtr<IDisplayServices> spDS;
    CComPtr<IDisplayPointer> spDP;
    CComPtr<ILineInfo> spLineInfo;
    POINT ptDPLocation;

    // Query for IMarkupServices and
    // IDisplayServices interfaces
    m_spDoc->QueryInterface(IID_IMarkupServices, (void**)&spMUS);
    m_spDoc->QueryInterface(IID_IDisplayServices, (void**)&spDS);

    // Create markup pointer and move to end of source element
    spMUS->CreateMarkupPointer(&spMUP);
    spMUP->MoveAdjacentToElement(m_spSrcElem, ELEM_ADJ_AfterEnd);

    // Create display pointer and place at markup pointer
    spDS->CreateDisplayPointer(&spDP);
    spDP->MoveToMarkupPointer(spMUP, NULL);

    // Get ILineInfo interface from which to
    // retrieve display pointer location
    spDP->GetLineInfo(&spLineInfo);

    // Get display pointer location and
    // tranfrom to global coordinate system
    spLineInfo->get_x(&(ptDPLocation.x));
    spLineInfo->get_baseLine(&(ptDPLocation.y));

    spDS->TransformPoint(&ptDPLocation,
                         COORD_SYSTEM_CONTENT,
                         COORD_SYSTEM_GLOBAL,
                         m_spSrcElem);

    // Transfer position, size and color for box to
    // VARIANT structures
    vBoxLeft = ptDPLocation.x;
    vBoxTop = ptDPLocation.y;
    vBoxWidth = 225;
    vBoxHeight = 150;
    vBoxBGColor = "#ff6666";

    // Set positioning and styles for comment edit box
    m_spCommentEditBox->get_style(&spStyle);
    spStyle->QueryInterface(IID_IHTMLStyle2, (void**)&spStyle2);
    spStyle2->put_position(L"absolute");
    spStyle->put_top(vBoxTop);
    spStyle->put_left(vBoxLeft);
    spStyle->put_width(vBoxWidth);
    spStyle->put_height(vBoxHeight);
    spStyle->put_backgroundColor(vBoxBGColor);
    spStyle->put_padding(L"5");
    spStyle->put_border(L"thin solid #666666");

    // Make Comment Edit Box contentEditable
    m_spCommentEditBox->QueryInterface(IID_IHTMLElement3, (void**)&spCommentEditBox3);
    spCommentEditBox3->put_contentEditable(L"true");

    // Place insertion point in box
    m_spCommentEditBox->QueryInterface(IID_IHTMLElement2, (void**)&spCommentEditBox2);
    spCommentEditBox2->focus();

    return S_OK;
}

STDMETHODIMP CAnnotator::PostEditorEventNotify | ( | DISPID | inEvtDispId,
 |  | IHTMLEventObj * | pIEventObj
 | ) |  |

Definition at line 20 of file Annotator.cpp.

{
    return S_FALSE;
}

STDMETHODIMP CAnnotator::PostHandleEvent | ( | DISPID | inEvtDispId,
 |  | IHTMLEventObj * | pIEventObj
 | ) |  |

Definition at line 26 of file Annotator.cpp.

{

    return S_FALSE;
}

STDMETHODIMP CAnnotator::PreHandleEvent | ( | DISPID | inEvtDispId,
 |  | IHTMLEventObj * | pIEventObj
 | ) |  |

Definition at line 33 of file Annotator.cpp.

{
    USES_CONVERSION;

    CComQIPtr<IHTMLElement> spSrcElem;
    CComQIPtr<IHTMLElement3> spSrcElem3;
    VARIANT_BOOL bIsEditable;

    pIEventObj->get_srcElement(&spSrcElem);
    spSrcElem->QueryInterface(IID_IHTMLElement3, (void**)&spSrcElem3);
    spSrcElem3->get_isContentEditable(&bIsEditable);

    // Reject all events that aren't in content-editable areas
    if (bIsEditable == VARIANT_FALSE) return S_FALSE;

    CComQIPtr<IOleCommandTarget> spCmdTarg;
    CComBSTR bstrSrcTagName;
    CComVariant var;
    LPSTR szName;
    BOOL bAreObjectsEqual = FALSE;

    m_spDoc->QueryInterface(IID_IOleCommandTarget, (void**)&spCmdTarg);

    spSrcElem->get_tagName(&bstrSrcTagName);
    szName = OLE2A(bstrSrcTagName);

    switch (inEvtDispId)
    {
    case DISPID_HTMLELEMENTEVENTS2_ONMOUSEOVER:

        if (!strcmp(szName, "!") || !strcmp(szName, "COMMENT"))
        {
            // Set cursor over comment to arrow
            var = TRUE;
            spCmdTarg->Exec(&CGID_MSHTML, IDM_OVERRIDE_CURSOR, OLECMDEXECOPT_DODEFAULT, &var, NULL);
            HCURSOR arrow = LoadCursor(NULL,IDC_ARROW);
            m_hOldCursor = SetCursor(arrow);
        }
        break;

    case DISPID_HTMLELEMENTEVENTS2_ONMOUSEOUT:

        if (!strcmp(szName, "!") || !strcmp(szName, "COMMENT"))
        {
            // Set cursor over comment back to auto
            var = FALSE;
            SetCursor(m_hOldCursor);
            spCmdTarg->Exec(&CGID_MSHTML, IDM_OVERRIDE_CURSOR, OLECMDEXECOPT_DODEFAULT, &var, NULL);
        }
        break;

    case DISPID_HTMLELEMENTEVENTS2_ONMOUSEUP:

        // Check if current src element is the same as any saved src element
        // which would be the comment that is currently being edited
        // If it is, we want to close the comment edit box without opening a new one.
        if (m_spSrcElem)
            bAreObjectsEqual = spSrcElem.IsEqualObject(m_spSrcElem);

        // If there is an open comment edit box already and the mouse release
        // didn't occur in the edit box, close the comment edit box
        if (m_spCommentEditBox &&
            !spSrcElem.IsEqualObject(m_spCommentEditBox))
                CloseCommentEditBox();

        // If there isn't an open comment edit box already, and
        // if the click was not on a glyph to close the comment edit box, and
        // if the click occurred on a comment element,
        // then open a comment edit box
        if (!m_spCommentEditBox &&
            !bAreObjectsEqual &&
            (!(strcmp(szName, "!")) || !(strcmp(szName, "COMMENT"))))
                OpenCommentEditBox(spSrcElem);

        break;
    }

    return S_FALSE;
}

STDMETHODIMP CAnnotator::ShowCommentGlyphs ( BOOL bShow )

Definition at line 160 of file Annotator.cpp.

{
    CComVariant vGlyphTableEntry;
    CComPtr<IOleCommandTarget> pCmdTarg;

    m_spDoc->QueryInterface(IID_IOleCommandTarget, (void**)&pCmdTarg);

    if (bShow)
    {
        //Load Glyph Table Entry into VARIANT
        vGlyphTableEntry =
            "%%comment^^%%res://EDannotator.dll/comment.gif^^%%0^^%%3^^%%3^^%%4^^%%20^^%%15^^%%20^^%%15^^**";

        // Exec IDM_ADDTOGLYPHTABLE
        pCmdTarg->Exec(&CGID_MSHTML,
                       IDM_ADDTOGLYPHTABLE,
                       OLECMDEXECOPT_DODEFAULT,
                       &vGlyphTableEntry,
                       NULL);
    }
    else
        pCmdTarg->Exec(&CGID_MSHTML,
                       IDM_EMPTYGLYPHTABLE,
                       OLECMDEXECOPT_DODEFAULT,
                       NULL,
                       NULL);

    return S_OK;
}

STDMETHODIMP CAnnotator::TranslateAccelerator | ( | DISPID | inEvtDispId,
 |  | IHTMLEventObj * | pIEventObj
 | ) |  |

Definition at line 114 of file Annotator.cpp.

{
    return S_FALSE;
}

Member Data Documentation

HCURSOR CAnnotator::m_hOldCursor [private]

Definition at line 123 of file Annotator.h.

CComPtr<IHTMLElement> CAnnotator::m_spCommentEditBox [private]

Definition at line 122 of file Annotator.h.

CComPtr<IHTMLEditDesigner> CAnnotator::m_spDesigner [private]

Definition at line 120 of file Annotator.h.

CComPtr<IHTMLDocument2> CAnnotator::m_spDoc [private]

Definition at line 119 of file Annotator.h.

CComPtr<IHTMLElement> CAnnotator::m_spSrcElem [private]

Definition at line 121 of file Annotator.h.

The documentation for this class was generated from the following files:
  • Web/Browser/EdAnnotator/AnnotatorProject/Annotator.h
  • Web/Browser/EdAnnotator/AnnotatorProject/Annotator.cpp
Generated on Wed Nov 13 2024 16:55:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAPIApp Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CAPIApp Class Reference

#include "API.h"

Inherits CWinApp.

List of all members.

Public Member Functions

CAPIApp ()
virtual BOOL | InitInstance ()
afx_msg void | OnAppAbout ()

Detailed Description

Definition at line 33 of file API.h.

Constructor & Destructor Documentation

CAPIApp::CAPIApp ( )

Definition at line 36 of file API.Cpp.

{
}

Member Function Documentation

BOOL CAPIApp::InitInstance ( void ) [virtual]

Reimplemented from CWinApp.

Definition at line 49 of file API.Cpp.

{

#ifdef _AFXDLL
  Enable3dControls();     // Call this when using MFC in a shared DLL
#else
  Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif

  // Change the registry key under which our settings are stored.
  // You should modify this string to be something appropriate
  // such as the name of your company or organization.
  SetRegistryKey(_T("Citrix"));

  LoadStdProfileSettings();  // Load standard INI file options (including MRU)

  // Register the application's document templates.  Document templates
  //  serve as the connection between documents, frame windows and views.

  CSingleDocTemplate* pDocTemplate;
  pDocTemplate = new CSingleDocTemplate(
    IDR_MAINFRAME,
    RUNTIME_CLASS(CAPIDoc),
    RUNTIME_CLASS(CMainFrame),       // main SDI frame window
    RUNTIME_CLASS(CAPIView));
  AddDocTemplate(pDocTemplate);

  // Parse command line for standard shell commands, DDE, file open
  CCommandLineInfo cmdInfo;
  ParseCommandLine(cmdInfo);

  // Dispatch commands specified on the command line
  if (!ProcessShellCommand(cmdInfo))
    return FALSE;

  // The one and only window has been initialized, so show and update it.
  m_pMainWnd->ShowWindow(SW_SHOW);
  m_pMainWnd->UpdateWindow();

  return TRUE;
}

void CAPIApp::OnAppAbout ( )

Definition at line 139 of file API.Cpp.

{
  CAboutDlg aboutDlg;
  aboutDlg.DoModal();
}

The documentation for this class was generated from the following files:
  • WinBase/WtsApi/WtsApi/API.h
  • WinBase/WtsApi/WtsApi/API.Cpp
Generated on Wed Nov 13 2024 16:55:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAPIDoc Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Protected Member Functions | Private Attributes

CAPIDoc Class Reference

#include "APIDoc.h"

List of all members.

Public Member Functions

virtual | ~CAPIDoc ()
LPSTR GetServerName ()
DWORD GetSessionID ()
void | ReadTrustedDomains ()
virtual void | Serialize (CArchive &ar)
void | SetServerName (TCHAR *temp)
void | SetSessionID (DWORD p)

Public Attributes

DWORD count
LPSTR domainName
PWTS_SERVER_INFO | pServerInfo
TCHAR * | serverName
DWORD sessionID

Protected Member Functions

CAPIDoc ()
afx_msg void | OnProcess ()
afx_msg void | OnRunTest ()
afx_msg void | OnSendMessage ()
afx_msg void | OnSession ()
afx_msg void | OnShutdownSystem ()
afx_msg void | OnUserconfig ()
afx_msg void | OnWaitEvent ()

Private Attributes

char | m_ServerName [70]

Detailed Description

Definition at line 17 of file APIDoc.h.

Constructor & Destructor Documentation

CAPIDoc::CAPIDoc ( ) [protected]

Definition at line 45 of file APIDoc.Cpp.

{
  g_pDoc = this;
  serverName = new TCHAR[255];
  serverName[0] = NULL;
}

CAPIDoc::~CAPIDoc ( ) [virtual]

Definition at line 52 of file APIDoc.Cpp.

{
}

Member Function Documentation

LPSTR CAPIDoc::GetServerName ( ) [inline]

Definition at line 40 of file APIDoc.h.

{return serverName;};

DWORD CAPIDoc::GetSessionID ( ) [inline]

Definition at line 39 of file APIDoc.h.

{return sessionID;};

void CAPIDoc::OnProcess ( ) [protected]

Definition at line 97 of file APIDoc.Cpp.

{
  CProcessDlg dlg;
  dlg.DoModal();
}

void CAPIDoc::OnRunTest ( ) [protected]

Definition at line 91 of file APIDoc.Cpp.

{
  CServerDlg dlg;
  dlg.DoModal();
}

void CAPIDoc::OnSendMessage ( ) [protected]

Definition at line 115 of file APIDoc.Cpp.

{
  CMessageDlg dlg;
  dlg.DoModal();
}

void CAPIDoc::OnSession ( ) [protected]

Definition at line 103 of file APIDoc.Cpp.

{
  CSessionDlg dlg;
  dlg.DoModal();
}

void CAPIDoc::OnShutdownSystem ( ) [protected]

Definition at line 109 of file APIDoc.Cpp.

{
  CShutdownDlg dlg;
  dlg.DoModal();
}

afx_msg void CAPIDoc::OnUserconfig ( ) [protected]
void CAPIDoc::OnWaitEvent ( ) [protected]

Definition at line 121 of file APIDoc.Cpp.

{
  CWaitSystemDlg dlg;
  dlg.DoModal();
}

void CAPIDoc::ReadTrustedDomains ( )
void CAPIDoc::Serialize ( CArchive & ar ) [virtual]

Definition at line 61 of file APIDoc.Cpp.

{
  if (ar.IsStoring())
  {
    // TODO: add storing code here
  }
  else
  {
    // TODO: add loading code here
  }
}

void CAPIDoc::SetServerName ( TCHAR * temp ) [inline]

Definition at line 41 of file APIDoc.h.

{strcpy(serverName, temp);};

void CAPIDoc::SetSessionID ( DWORD p ) [inline]

Definition at line 38 of file APIDoc.h.

{sessionID=p;};

Member Data Documentation

DWORD CAPIDoc::count

Definition at line 43 of file APIDoc.h.

LPSTR CAPIDoc::domainName

Definition at line 47 of file APIDoc.h.

char CAPIDoc::m_ServerName[70] [private]

Definition at line 70 of file APIDoc.h.

PWTS_SERVER_INFO CAPIDoc::pServerInfo

Definition at line 44 of file APIDoc.h.

TCHAR* CAPIDoc::serverName

Definition at line 46 of file APIDoc.h.

DWORD CAPIDoc::sessionID

Definition at line 45 of file APIDoc.h.

The documentation for this class was generated from the following files:
  • WinBase/WtsApi/WtsApi/APIDoc.h
  • WinBase/WtsApi/WtsApi/APIDoc.Cpp
Generated on Wed Nov 13 2024 16:55:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAPIView Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions

CAPIView Class Reference

#include "APIView.h"

Inherits CView.

List of all members.

Public Member Functions

virtual | ~CAPIView ()
CAPIDoc * GetDocument ()
virtual void | OnDraw (CDC *pDC)
virtual BOOL | PreCreateWindow (CREATESTRUCT &cs)

Protected Member Functions

CAPIView ()
afx_msg void | OnPaint ()
afx_msg void | OnSetFocus (CWnd *pOldWnd)

Detailed Description

Definition at line 15 of file APIView.h.

Constructor & Destructor Documentation

CAPIView::CAPIView ( ) [protected]

Definition at line 34 of file APIView.Cpp.

{
  //g_pDoc->SetServerName("");
}

CAPIView::~CAPIView ( ) [virtual]

Definition at line 39 of file APIView.Cpp.

{
}

Member Function Documentation

CAPIDoc * CAPIView::GetDocument ( ) [inline]

Definition at line 57 of file APIView.h.

   { return (CAPIDoc*)m_pDocument; }

void CAPIView::OnDraw ( CDC * pDC ) [virtual]

Definition at line 54 of file APIView.Cpp.

{
  CAPIDoc *pDoc = GetDocument();
  ASSERT_VALID(pDoc);

  TCHAR* serverName;
  serverName = g_pDoc->GetServerName();
  if (*serverName == NULL)
    pDoc->SetTitle("local server");
  else
    pDoc->SetTitle(serverName);

}

void CAPIView::OnPaint ( void ) [protected]

Definition at line 100 of file APIView.Cpp.

{
    CPaintDC dc(this); // device context for painting
  LOGFONT logFont;
  logFont.lfHeight = 30;
  logFont.lfWidth = 20;
  logFont.lfEscapement = 0;
  logFont.lfOrientation = 0;
  logFont.lfWeight= 0;
  logFont.lfItalic = 0;
  logFont.lfUnderline = 0;
  logFont.lfStrikeOut = 0;
  logFont.lfCharSet = ANSI_CHARSET;
  CFont font;
  font.CreateFontIndirect(&logFont);
  CFont* oldFont = dc.SelectObject(&font);

  strcpy(logFont.lfFaceName, "Times New Roman");
  dc.TextOut(50, 50, "Test Program for WTSAPI32.DLL");
  dc.SelectObject(oldFont);
}

void CAPIView::OnSetFocus ( CWnd * pOldWnd ) [protected]

Definition at line 93 of file APIView.Cpp.

{
  CView::OnSetFocus(pOldWnd);
  CDC* pDC=NULL;
  OnDraw(pDC);
}

BOOL CAPIView::PreCreateWindow ( CREATESTRUCT & cs ) [virtual]

Definition at line 43 of file APIView.Cpp.

{
  // TODO: Modify the Window class or styles here by modifying
  //  the CREATESTRUCT cs

  return CView::PreCreateWindow(cs);
}

The documentation for this class was generated from the following files:
  • WinBase/WtsApi/WtsApi/APIView.h
  • WinBase/WtsApi/WtsApi/APIView.Cpp
Generated on Wed Nov 13 2024 16:55:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CapJ Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Package Attributes | Private Member Functions | Static Private Member Functions | Private Attributes

CapJ Class Reference

.import("USER32", auto)

List of all members.

Public Member Functions

CapJ ()
void | dispose ()
void | exitMenu_click (Object sender, Event e)

Static Public Member Functions

static void | main (String args[])

Package Attributes

MenuItem | aboutMenu = new MenuItem()
agentctl.Agent.Agent | agent1 = new agentctl.Agent.Agent()
GroupBox | AnimationsLabel = new GroupBox()
ListBox | AnimationsListBox = new ListBox()
CheckBox | AutoHide = new CheckBox()
CheckBox | AutoPace = new CheckBox()
Container | components = new Container()
MenuItem | exitMenu = new MenuItem()
MenuItem | fileMenu = new MenuItem()
MenuItem | helpMenu = new MenuItem()
MainMenu | mainMenu1 = new MainMenu()
MenuItem | menuItem1 = new MenuItem()
Button | Move = new Button()
MenuItem | openMenu = new MenuItem()
Button | PlayButton = new Button()
GroupBox | PositionLabel = new GroupBox()
MenuItem | recent1 = new MenuItem()
MenuItem | recent2 = new MenuItem()
MenuItem | recent3 = new MenuItem()
MenuItem | recent4 = new MenuItem()
MenuItem | recentSeparator = new MenuItem()
CheckBox | SizeToText = new CheckBox()
Button | SpeakButton = new Button()
Edit | SpeakText = new Edit()
GroupBox | SpeechOutputLabel = new GroupBox()
CheckBox | StopBeforePlay = new CheckBox()
Button | StopButton = new Button()
CheckBox | UseBalloon = new CheckBox()
CheckBox | UseSfx = new CheckBox()
Edit | X = new Edit()
Label | XLabel = new Label()
Edit | Y = new Edit()
Label | YLabel = new Label()

Private Member Functions

void | aboutMenu_click (Object sender, Event e)
void | agent1_agentPropertyChange (Object sender, Event e)
void | agent1_command (Object sender, agentctl.Agent.CommandEvent e)
void | agent1_move (Object sender, agentctl.Agent.MoveEvent e)
void | AnimationsListBox_doubleClick (Object source, Event e)
void | CapJ_activate (Object source, Event e)
void | CapJ_closing (Object source, CancelEvent e)
void | CapJ_deactivate (Object source, Event e)
void | initForm ()
void | LoadCharacter (String path)
String | MakeEllipsisPath (String pszPath, int iMaxLength)
void | Move_click (Object source, Event e)
void | OnListDblClick (Object sender, Event e)
void | OnRecentFile (int iFile)
void | openMenu_click (Object source, Event e)
void | PlayButton_click (Object sender, Event e)
void | recent1_click (Object source, Event e)
void | recent2_click (Object source, Event e)
void | recent3_click (Object source, Event e)
void | recent4_click (Object source, Event e)
void | SpeakButton_click (Object source, Event e)
void | StopButton_click (Object source, Event e)
void | UpdateRecentFiles (String pszFilename)
void | UseBalloon_click (Object source, Event e)
void | UseSfx_click (Object source, Event e)

Static Private Member Functions

static native int | GetForegroundWindow ()
static native int | GetWindowText (int hWnd, StringBuffer text, int nMaxCount)

Private Attributes

final String | kpszCharacterWindowTitle = "Microsoft Agent"
final String | kpszOptionsWindowTitle = "Advanced Character Options"
final String | kpszRecentFilesItem = "File"
final String | kpszRecentFilesSubkey = "Software\\Microsoft\\Microsoft Agent\\Tools\\Character Previewer\\Recent Files"
agentctl.IAgentCtlCharacterEx | m_pCharacter = null
final int | MAX_RECENT_FILENAME = 32
final int | MAX_RECENT_FILES = 4
final int | UserHid = 0
final int | UserHidViaCharacterMenu = 7

Detailed Description

Definition at line 31 of file capj.java.

Constructor & Destructor Documentation

CapJ::CapJ ( ) [inline]

Definition at line 60 of file capj.java.

  {
    super();

    initForm();

    // Ensure that we're connected to Microsoft Agent

    agent1.setConnected(true);

    // Update the recent file list in the File menu

    UpdateRecentFiles(null);
  }

Member Function Documentation

void CapJ::aboutMenu_click | ( | Object | sender,
 |  | Event | e |
 | ) |  |  | [inline, private]

Definition at line 483 of file capj.java.

  {
    About myAbout = new About();
    myAbout.showDialog();
  }

void CapJ::agent1_agentPropertyChange | ( | Object | sender,
 |  | Event | e |
 | ) |  |  | [inline, private]

Definition at line 664 of file capj.java.

  {
    // When an Agent property changes (via the Advanced Character
    // Options property sheet), we need to resync our window with
    // the current state of Agent's properties.

    UseSfx.setEnabled(agent1.getAudioOutput().getSoundEffects() &&
              AnimationsListBox.getItemCount() > 0);

    boolean bEnable = m_pCharacter.getBalloon().getEnabled();

    UseBalloon.setEnabled(bEnable);

    bEnable = bEnable && UseBalloon.getChecked();

    SizeToText.setEnabled(bEnable);
    AutoHide.setEnabled(bEnable);
    AutoPace.setEnabled(bEnable);
  }

void CapJ::agent1_command | ( | Object | sender,
 |  | agentctl.Agent.CommandEvent | e |
 | ) |  |  | [inline, private]

Definition at line 627 of file capj.java.

  {
    // The user selected a command from the popup menu.

    agentctl.IAgentCtlUserInput ui = (agentctl.IAgentCtlUserInput)(e.UserInput);

    if (ui.getName().equals("PropSheet"))
    {
      agentctl.IAgentCtlPropertySheet ps = agent1.getPropertySheet();
      short sX = (short)(ps.getLeft() + ps.getWidth()/2);
      short sY = (short)(ps.getTop() + ps.getHeight()/2);

      // Stop the character

      m_pCharacter.StopAll(new com.ms.com.Variant());

      // Gesture at the center of the property sheet

      m_pCharacter.GestureAt(sX, sY);

      // And show the property sheet

      ps.setVisible(true);
    }
  }

void CapJ::agent1_move | ( | Object | sender,
 |  | agentctl.Agent.MoveEvent | e |
 | ) |  |  | [inline, private]

Definition at line 653 of file capj.java.

  {
    // The character moved. Resync our window to the
    // new position.

    Short sX = new Short(e.x);
    Short sY = new Short(e.y);
    X.setText(sX.toString());
    Y.setText(sY.toString());
  }

void CapJ::AnimationsListBox_doubleClick | ( | Object | source,
 |  | Event | e |
 | ) |  |  | [inline, private]

Definition at line 695 of file capj.java.

  {
    PlayButton_click(source, e);
  }

void CapJ::CapJ_activate | ( | Object | source,
 |  | Event | e |
 | ) |  |  | [inline, private]

Definition at line 700 of file capj.java.

  {
    // Is a character currently loaded?

    if (m_pCharacter != null)
    {
      // We never want to show the character if the window
      // is minimized (i.e. state == 1).

      if (getWindowState() != 1)
      {
        // We want to show the character on activation but there's
        // a special case. If the user hid the character we could get
        // an activate message after the character window hides.
        // In that case, we sure don't want to show the character. So
        // check the visibility cause of the character. If the user hid
        // it, we won't show it.

        if ((m_pCharacter.getVisibilityCause() == UserHid) ||
          (m_pCharacter.getVisibilityCause() == UserHidViaCharacterMenu))
          return;

        m_pCharacter.Show(new com.ms.com.Variant(true));
      }
    }
  }

void CapJ::CapJ_closing | ( | Object | source,
 |  | CancelEvent | e |
 | ) |  |  | [inline, private]

Definition at line 685 of file capj.java.

  {
    // Unload the character (if necessary)

    if (m_pCharacter != null) {
      m_pCharacter = null;
      agent1.getCharacters().Unload("characterID");
    }
  }

void CapJ::CapJ_deactivate | ( | Object | source,
 |  | Event | e |
 | ) |  |  | [inline, private]

Definition at line 727 of file capj.java.

  {
    // When the window is deactivated, we'll hide the character
    // (non-animated). This code also demonstrates the use of
    // J/Direct.

    // Is a character currently loaded?

    if (m_pCharacter != null)
    {
      // Use J/Direct to get the foreground window

      int hWnd = GetForegroundWindow();

      // Create a StringBuffer to get the window title
      // of the foreground window.

      StringBuffer title = new StringBuffer(256);

      // Get the title of the foreground window using
      // J/Direct.

      if (GetWindowText(hWnd, title, 256) > 0)
      {
        // We don't want to hide the character if it is the
        // foreground window.

        if (title.toString().equalsIgnoreCase(kpszCharacterWindowTitle))
          return;

        // Check to see if it's the Agent Character Property
        // Sheet. NOTE: this currently only works on English
        // systems. A more robust way to do this would be to
        // use the process id of the window that is getting
        // focus, and make sure that it's not AgentSvr.exe.

        if (title.toString().equalsIgnoreCase(kpszOptionsWindowTitle))
          return;
      }

      // Hide the character (no animation)

      m_pCharacter.Hide(new com.ms.com.Variant(true));
    }
  }

void CapJ::dispose ( ) [inline]

Definition at line 75 of file capj.java.

  {
    super.dispose();
    components.dispose();
  }

void CapJ::exitMenu_click | ( | Object | sender,
 |  | Event | e |
 | ) |  |  | [inline]

Definition at line 471 of file capj.java.

  {
    // Unload the character (if necessary)

    if (m_pCharacter != null) {
      m_pCharacter = null;
      agent1.getCharacters().Unload("characterID");
    }

    Application.exit();
  }

static native int CapJ::GetForegroundWindow ( ) [static, private]
static native int CapJ::GetWindowText | ( | int | hWnd,
 |  | StringBuffer | text,
 |  | int | nMaxCount |
 | ) |  |  | [static, private]
void CapJ::initForm ( ) [inline, private]

Definition at line 807 of file capj.java.

  {
    // NOTE:  This form is storing resource information in an
    // external file.  Do not modify the string parameter to any
    // resources.getObject() function call. For example, do not
    // modify "foo1_location" in the following line of code
    // even if the name of the Foo object changes:
    //   foo1.setLocation((Point)resources.getObject("foo1_location"));

    IResourceManager resources = new ResourceManager(this, "CapJ");
    components.add(openMenu, "openMenu");
    openMenu.setShortcut(Shortcut.CTRL_O);
    openMenu.setText("&Open...");
    openMenu.addOnClick(new EventHandler(this.openMenu_click));

    components.add(AnimationsLabel, "AnimationsLabel");
    AnimationsLabel.setEnabled(false);
    AnimationsLabel.setLocation(new Point(8, 8));
    AnimationsLabel.setSize(new Point(280, 168));
    AnimationsLabel.setTabIndex(2);
    AnimationsLabel.setTabStop(false);
    AnimationsLabel.setText("&Animations");

    components.add(recentSeparator, "recentSeparator");
    recentSeparator.setText("-");

    components.add(AnimationsListBox, "AnimationsListBox");
    AnimationsListBox.setEnabled(false);
    AnimationsListBox.setLocation(new Point(16, 24));
    AnimationsListBox.setSize(new Point(264, 108));
    AnimationsListBox.setTabIndex(1);
    AnimationsListBox.setText("listBox1");
    AnimationsListBox.setSorted(true);
    AnimationsListBox.setUseTabStops(true);
    AnimationsListBox.addOnDoubleClick(new EventHandler(this.AnimationsListBox_doubleClick));

    components.add(aboutMenu, "aboutMenu");
    aboutMenu.setText("&About Microsoft Character Animation Previewer");
    aboutMenu.addOnClick(new EventHandler(this.aboutMenu_click));

    components.add(AutoHide, "AutoHide");
    AutoHide.setEnabled(false);
    AutoHide.setLocation(new Point(32, 112));
    AutoHide.setSize(new Point(64, 16));
    AutoHide.setTabIndex(2);
    AutoHide.setText("Auto hi&de");

    components.add(PlayButton, "PlayButton");
    PlayButton.setEnabled(false);
    PlayButton.setLocation(new Point(304, 24));
    PlayButton.setSize(new Point(96, 24));
    PlayButton.setTabIndex(3);
    PlayButton.setText("&Play");
    PlayButton.addOnClick(new EventHandler(this.PlayButton_click));

    components.add(StopButton, "StopButton");
    StopButton.setEnabled(false);
    StopButton.setLocation(new Point(304, 64));
    StopButton.setSize(new Point(96, 24));
    StopButton.setTabIndex(4);
    StopButton.setText("S&top");
    StopButton.addOnClick(new EventHandler(this.StopButton_click));

    components.add(UseSfx, "UseSfx");
    UseSfx.setEnabled(false);
    UseSfx.setLocation(new Point(8, 136));
    UseSfx.setSize(new Point(112, 16));
    UseSfx.setTabIndex(0);
    UseSfx.setText("Play sound &effects");
    UseSfx.addOnClick(new EventHandler(this.UseSfx_click));

    components.add(StopBeforePlay, "StopBeforePlay");
    StopBeforePlay.setEnabled(false);
    StopBeforePlay.setLocation(new Point(136, 136));
    StopBeforePlay.setSize(new Point(128, 16));
    StopBeforePlay.setTabIndex(1);
    StopBeforePlay.setText("Stop &before next action");

    components.add(SpeechOutputLabel, "SpeechOutputLabel");
    SpeechOutputLabel.setEnabled(false);
    SpeechOutputLabel.setLocation(new Point(8, 184));
    SpeechOutputLabel.setSize(new Point(280, 144));
    SpeechOutputLabel.setTabIndex(5);
    SpeechOutputLabel.setTabStop(false);
    SpeechOutputLabel.setText("Speech &Output");

    components.add(SpeakText, "SpeakText");
    SpeakText.setEnabled(false);
    SpeakText.setLocation(new Point(8, 16));
    SpeakText.setSize(new Point(264, 64));
    SpeakText.setTabIndex(0);
    SpeakText.setText("");
    SpeakText.setMultiline(true);
    SpeakText.setScrollBars(ScrollBars.VERTICAL);

    components.add(UseBalloon, "UseBalloon");
    UseBalloon.setEnabled(false);
    UseBalloon.setLocation(new Point(8, 88));
    UseBalloon.setSize(new Point(120, 16));
    UseBalloon.setTabIndex(1);
    UseBalloon.setText("Display &word balloon");
    UseBalloon.addOnClick(new EventHandler(this.UseBalloon_click));

    components.add(exitMenu, "exitMenu");
    exitMenu.setText("E&xit");
    exitMenu.addOnClick(new EventHandler(this.exitMenu_click));

    components.add(helpMenu, "helpMenu");
    helpMenu.setMenuItems(new MenuItem[] {
                aboutMenu});
    helpMenu.setText("&Help");

    components.add(agent1, "agent1");
    agent1.setLocation(new Point(368, 96));
    agent1.setSize(new Point(32, 32));
    agent1.setTabIndex(0);
    agent1.setOcxState((AxHost.State)resources.getObject("agent1_ocxState"));
    agent1.addOnCommand(new agentctl.Agent.CommandHandler(this.agent1_command));
    agent1.addOnMove(new agentctl.Agent.MoveHandler(this.agent1_move));
    agent1.addOnAgentPropertyChange(new EventHandler(this.agent1_agentPropertyChange));

    components.add(AutoPace, "AutoPace");
    AutoPace.setEnabled(false);
    AutoPace.setLocation(new Point(112, 112));
    AutoPace.setSize(new Point(72, 16));
    AutoPace.setTabIndex(3);
    AutoPace.setText("Auto pa&ce");

    components.add(SizeToText, "SizeToText");
    SizeToText.setEnabled(false);
    SizeToText.setLocation(new Point(192, 112));
    SizeToText.setSize(new Point(72, 16));
    SizeToText.setTabIndex(4);
    SizeToText.setText("Si&ze to text");

    components.add(SpeakButton, "SpeakButton");
    SpeakButton.setEnabled(false);
    SpeakButton.setLocation(new Point(304, 200));
    SpeakButton.setSize(new Point(96, 24));
    SpeakButton.setTabIndex(6);
    SpeakButton.setText("&Speak");
    SpeakButton.addOnClick(new EventHandler(this.SpeakButton_click));

    components.add(PositionLabel, "PositionLabel");
    PositionLabel.setEnabled(false);
    PositionLabel.setLocation(new Point(8, 336));
    PositionLabel.setSize(new Point(280, 56));
    PositionLabel.setTabIndex(7);
    PositionLabel.setTabStop(false);
    PositionLabel.setText("Position");

    components.add(XLabel, "XLabel");
    XLabel.setEnabled(false);
    XLabel.setLocation(new Point(16, 24));
    XLabel.setSize(new Point(16, 16));
    XLabel.setTabIndex(0);
    XLabel.setTabStop(false);
    XLabel.setText("&X:");

    components.add(X, "X");
    X.setEnabled(false);
    X.setLocation(new Point(32, 24));
    X.setSize(new Point(40, 20));
    X.setTabIndex(1);
    X.setText("");

    components.add(YLabel, "YLabel");
    YLabel.setEnabled(false);
    YLabel.setLocation(new Point(112, 24));
    YLabel.setSize(new Point(16, 16));
    YLabel.setTabIndex(2);
    YLabel.setTabStop(false);
    YLabel.setText("&Y:");

    components.add(Y, "Y");
    Y.setEnabled(false);
    Y.setLocation(new Point(136, 24));
    Y.setSize(new Point(40, 20));
    Y.setTabIndex(3);
    Y.setText("");

    components.add(Move, "Move");
    Move.setEnabled(false);
    Move.setLocation(new Point(304, 360));
    Move.setSize(new Point(96, 24));
    Move.setTabIndex(9);
    Move.setText("&Move");
    Move.addOnClick(new EventHandler(this.Move_click));

    components.add(menuItem1, "menuItem1");
    menuItem1.setText("-");

    components.add(recent2, "recent2");
    recent2.setText("");
    recent2.setVisible(false);
    recent2.addOnClick(new EventHandler(this.recent2_click));

    components.add(recent3, "recent3");
    recent3.setText("");
    recent3.setVisible(false);
    recent3.addOnClick(new EventHandler(this.recent3_click));

    components.add(recent4, "recent4");
    recent4.setText("");
    recent4.setVisible(false);
    recent4.addOnClick(new EventHandler(this.recent4_click));

    components.add(recent1, "recent1");
    recent1.setText("");
    recent1.setVisible(false);
    recent1.addOnClick(new EventHandler(this.recent1_click));

    components.add(fileMenu, "fileMenu");
    fileMenu.setMenuItems(new MenuItem[] {
                openMenu,
                recentSeparator,
                recent1,
                recent2,
                recent3,
                recent4,
                menuItem1,
                exitMenu});
    fileMenu.setText("&File");

    components.add(mainMenu1, "mainMenu1");
    mainMenu1.setMenuItems(new MenuItem[] {
                 fileMenu,
                 helpMenu});
    /* @designTimeOnly mainMenu1.setLocation(new Point(320, 136)); */

    this.setAllowDrop(true);
    this.setAnchor(ControlAnchor.ALL);
    this.setLocation(new Point(298, 88));
    this.setText("Microsoft Character Animation Previewer");
    this.setAutoScaleBaseSize(new Point(5, 13));
    this.setClientSize(new Point(414, 403));
    this.setIcon((Icon)resources.getObject("this_icon"));
    this.setMaximizeBox(false);
    this.setMenu(mainMenu1);
    this.setStartPosition(FormStartPosition.CENTER_SCREEN);
    this.addOnActivate(new EventHandler(this.CapJ_activate));
    this.addOnDeactivate(new EventHandler(this.CapJ_deactivate));
    this.addOnClosing(new CancelEventHandler(this.CapJ_closing));

    this.setNewControls(new Control[] {
              Move,
              PositionLabel,
              SpeakButton,
              SpeechOutputLabel,
              StopButton,
              PlayButton,
              AnimationsListBox,
              agent1,
              AnimationsLabel});
    AnimationsLabel.setNewControls(new Control[] {
                     StopBeforePlay,
                     UseSfx});
    SpeechOutputLabel.setNewControls(new Control[] {
                     SizeToText,
                     AutoPace,
                     AutoHide,
                     UseBalloon,
                     SpeakText});
    PositionLabel.setNewControls(new Control[] {
                   Y,
                   YLabel,
                   X,
                   XLabel});

    agent1.begin();
  }

void CapJ::LoadCharacter ( String path ) [inline, private]

Definition at line 81 of file capj.java.

  {
    com.ms.com.IEnumVariant enum = null;
    com.ms.com.Variant vName[] = {null};
    int iRetrieved[] = {-1};
    int iBalloonStyle;
    boolean bHasAnims;

    com.ms.com.Variant vPath = new com.ms.com.Variant();
    com.ms.com.Variant vFast = new com.ms.com.Variant();

    // Was a path specified

    if (path == "")
    {
      // Nope. Create a file dialog object.

      OpenFileDialog fOpenDlg = new OpenFileDialog();

      fOpenDlg.setFilter("Agent Character Files (*.acs)|*.acs|Agent Character Files (*.acf)|*.acf|All files (*.*)|*.*");
      fOpenDlg.setCheckFileExists(true);
      fOpenDlg.setCheckPathExists(true);

      // Show it

      if (fOpenDlg.showDialog() == DialogResult.OK)
        vPath.putString(fOpenDlg.getFileName());
      else
        return;
    }
    else
    {
      vPath.putString(path);
    }

    // If we already have a character loaded, unload it and
    // clear the animation name list box.

    if (m_pCharacter != null)
    {
      agent1.getCharacters().Unload("characterID");
      m_pCharacter = null;
      this.AnimationsListBox.removeAll();
    }

    // Load the character

    try
    {
      agent1.getCharacters().Load("characterID",vPath);
    }
    catch (com.ms.com.ComFailException e)
    {
      return;
    }

    // Save the character interface/object

    m_pCharacter = agent1.getCharacters().Character("characterID");

    // Move the character to the right of the window

    Rectangle rcWindow = new Rectangle(this.getLocation().x,
                       this.getLocation().y,
                       this.getSize().x,
                       this.getSize().y);

    // Make sure we'll fit to the right (NOTE: a production
    // quality app would handle multi-monitor!!!)

    int charLeft;

    charLeft = rcWindow.getRight();

    if ((charLeft + m_pCharacter.getWidth()) > FxToolkit.getSystemMetric(FxToolkit.SCREEN_WIDTH))
      charLeft = rcWindow.x - m_pCharacter.getWidth();

    // Position the character

    m_pCharacter.MoveTo((short)charLeft, (short)rcWindow.y, new com.ms.com.Variant(0));

    // And show it

    m_pCharacter.Show(vFast);

    // Enumerate the character's animation names

    enum = (com.ms.com.IEnumVariant)m_pCharacter.getAnimationNames().getEnum();

    while (true) {
      enum.Next(1, vName, iRetrieved);
      if (iRetrieved[0] != 1)
        break;
      this.AnimationsListBox.addItem(vName[0].getString());
    }

    // Initialize the animation list box label with the character's
    // name.

    AnimationsLabel.setText("Animations for " + m_pCharacter.getName());

    // Initialize controls

    UseSfx.setChecked(m_pCharacter.getSoundEffectsOn());

    bHasAnims = AnimationsListBox.getItemCount() > 0;

    if (bHasAnims)
      AnimationsListBox.setSelectedIndex(0);

    AnimationsLabel.setEnabled(bHasAnims);
    AnimationsListBox.setEnabled(bHasAnims);
    UseSfx.setEnabled(bHasAnims && agent1.getAudioOutput().getSoundEffects());
    StopBeforePlay.setEnabled(bHasAnims);
    PlayButton.setEnabled(bHasAnims);
    StopButton.setEnabled(bHasAnims);
    SpeechOutputLabel.setEnabled(bHasAnims);
    SpeakText.setEnabled(bHasAnims);
    SpeakButton.setEnabled(bHasAnims);

    PositionLabel.setEnabled(bHasAnims);
    XLabel.setEnabled(bHasAnims);
    X.setEnabled(bHasAnims);
    YLabel.setEnabled(bHasAnims);
    Y.setEnabled(bHasAnims);
    Move.setEnabled(bHasAnims);

    iBalloonStyle = m_pCharacter.getBalloon().getStyle();

    UseBalloon.setChecked((iBalloonStyle & 1) == 1);
    SizeToText.setChecked((iBalloonStyle & 2) == 2);
    AutoHide.setChecked((iBalloonStyle & 4) == 4);
    AutoPace.setChecked((iBalloonStyle & 8) == 8);

    UseBalloon.setEnabled(bHasAnims);
    AutoHide.setEnabled(bHasAnims && UseBalloon.getChecked());
    AutoPace.setEnabled(bHasAnims && UseBalloon.getChecked());
    SizeToText.setEnabled(bHasAnims && UseBalloon.getChecked());

    // Add commands

    m_pCharacter.getCommands().Add("PropSheet",
                     new com.ms.com.Variant("&Advanced Character Properties"),
                     new com.ms.com.Variant(),
                     new com.ms.com.Variant(),
                     new com.ms.com.Variant());

    // Add the loaded character to the recent file list

    UpdateRecentFiles(vPath.getString());
  }

static void CapJ::main ( String args[] ) [inline, static]

Definition at line 1079 of file capj.java.

  {
    Application.run(new CapJ());
  }

String CapJ::MakeEllipsisPath | ( | String | pszPath,
 |  | int | iMaxLength |
 | ) |  |  | [inline, private]

Definition at line 233 of file capj.java.

  {
    // This function takes a full path and truncates to a fixed
    // specified size using ellipses as necessary.

    int iPathPartLen;
    int iEndDir;
    int i;
    String pszFilename;

    // If the specified path fits, then just copy it and return

    if (pszPath.length() <= iMaxLength)
      return new String(pszPath);

    // See if the filename alone is too big

    i = pszPath.lastIndexOf("\\");

    if (i >= 0)
      pszFilename = pszPath.substring(i+1, pszPath.length());
    else
      pszFilename = new String(pszPath);

    if (pszFilename.length() >= iMaxLength)
      return pszFilename.substring(0, iMaxLength-3) + "...";

    // Make a copy

    String pszPathCopy = new String(pszPath);

    if (pszPathCopy.startsWith("\\\\"))
      iEndDir = 3;
    else
      iEndDir = pszPathCopy.indexOf('\\') + 1;

    iEndDir = pszPathCopy.indexOf('\\', iEndDir);

    // If we couldn't find the first directory component, give up
    // and just return the filename only.

    if (iEndDir < 0)
      return pszFilename;
    else
      iEndDir++;

    if (iEndDir < (iMaxLength - pszFilename.length() - 4))
      iPathPartLen = iEndDir;
    else
      iPathPartLen = iMaxLength - pszFilename.length() - 4;

    return new String(pszPathCopy.substring(0, iPathPartLen) + "...\\" + pszFilename);
  }

void CapJ::Move_click | ( | Object | source,
 |  | Event | e |
 | ) |  |  | [inline, private]

Definition at line 570 of file capj.java.

  {
    Short x;
    Short y;

    if (m_pCharacter == null)
      return;

    if ((X.getText().length() == 0) || (Y.getText().length() == 0))
      return;

    try
    {
      x = new Short(X.getText());
    }
    catch (NumberFormatException exc)
    {
      X.setSelectionStart(0);
      X.setSelectionEnd(-1);
      return;
    }

    try
    {
      y = new Short(Y.getText());
    }
    catch (NumberFormatException exc)
    {
      Y.selectAll();
      return;
    }

    if (this.StopBeforePlay.getChecked())
      m_pCharacter.StopAll(new com.ms.com.Variant());

    m_pCharacter.MoveTo(x.shortValue(), y.shortValue(), new com.ms.com.Variant());
  }

void CapJ::OnListDblClick | ( | Object | sender,
 |  | Event | e |
 | ) |  |  | [inline, private]

Definition at line 514 of file capj.java.

  {
    PlayButton_click(sender, e);
  }

void CapJ::OnRecentFile ( int iFile ) [inline, private]

Definition at line 447 of file capj.java.

  {
    Registry reg = new Registry();
    RegistryKey rk;
    Integer i = new Integer(iFile);

    // Open the registry subkey

    rk = reg.CURRENT_USER.createSubKey(kpszRecentFilesSubkey);

    // Try to find a value name of "File<iFile>"

    String pszFilename = (String)rk.getValue(kpszRecentFilesItem + i.toString());

    // Did we find it?

    if (pszFilename == null)
      return;

    // Load the character

    LoadCharacter(pszFilename);
  }

void CapJ::openMenu_click | ( | Object | source,
 |  | Event | e |
 | ) |  |  | [inline, private]

Definition at line 489 of file capj.java.

  {
    LoadCharacter("");
  }

void CapJ::PlayButton_click | ( | Object | sender,
 |  | Event | e |
 | ) |  |  | [inline, private]

Definition at line 519 of file capj.java.

  {
    String curAnim = new String("");

    if (m_pCharacter == null)
      return;

    curAnim = (String)this.AnimationsListBox.getSelectedItem();

    if (curAnim != "")
    {
      if (this.StopBeforePlay.getChecked())
        m_pCharacter.StopAll(new com.ms.com.Variant());

      m_pCharacter.Play(curAnim);
    }
  }

void CapJ::recent1_click | ( | Object | source,
 |  | Event | e |
 | ) |  |  | [inline, private]

Definition at line 494 of file capj.java.

  {
    OnRecentFile(1);
  }

void CapJ::recent2_click | ( | Object | source,
 |  | Event | e |
 | ) |  |  | [inline, private]

Definition at line 499 of file capj.java.

  {
    OnRecentFile(2);
  }

void CapJ::recent3_click | ( | Object | source,
 |  | Event | e |
 | ) |  |  | [inline, private]

Definition at line 504 of file capj.java.

  {
    OnRecentFile(3);
  }

void CapJ::recent4_click | ( | Object | source,
 |  | Event | e |
 | ) |  |  | [inline, private]

Definition at line 509 of file capj.java.

  {
    OnRecentFile(4);
  }

void CapJ::SpeakButton_click | ( | Object | source,
 |  | Event | e |
 | ) |  |  | [inline, private]

Definition at line 543 of file capj.java.

  {
    int iStyle;

    if (m_pCharacter == null)
      return;

    iStyle = 0;

    if (UseBalloon.getChecked())
      iStyle |= 1;

    if (SizeToText.getChecked())
      iStyle |= 2;

    if (AutoHide.getChecked())
      iStyle |= 4;

    if (AutoPace.getChecked())
      iStyle |= 8;

    m_pCharacter.getBalloon().setStyle(iStyle);

    if (SpeakText.getText().length() != 0)
      m_pCharacter.Speak(new com.ms.com.Variant(SpeakText.getText()), new com.ms.com.Variant());
  }

void CapJ::StopButton_click | ( | Object | source,
 |  | Event | e |
 | ) |  |  | [inline, private]

Definition at line 537 of file capj.java.

  {
    if (m_pCharacter != null)
      m_pCharacter.StopAll(new com.ms.com.Variant());
  }

void CapJ::UpdateRecentFiles ( String pszFilename ) [inline, private]

Definition at line 287 of file capj.java.

  {
    Registry reg;
    RegistryKey rk;

    int iNumExisting = 0;
    int iFind = -1;
    int iCount;
    String pszEllipsis;
    String[] rgpszRecentFiles = new String[MAX_RECENT_FILES];

    // Create/Open the recent files registry subkey

    reg = new Registry();

    rk = reg.CURRENT_USER.createSubKey(kpszRecentFilesSubkey);

    for (int i=1; i <= MAX_RECENT_FILES; i++)
    {
      // Get the registry value of the form "File<#>"

      Integer i2 = new Integer(i);

      rgpszRecentFiles[i-1] = (String)rk.getValue(kpszRecentFilesItem + i2.toString());

      // Did we find a value

      if (rgpszRecentFiles[i-1] != null)
      {
        // If a filename was specified, see if it matches this one

        if (pszFilename != null)
        {
          if (pszFilename.equals(rgpszRecentFiles[iNumExisting]))
          {
            // If the specified file is the first file we find,
            // then we're done.

            if (iNumExisting == 0)
            {
              rk.close();
              return;
            }

            iFind = iNumExisting;
          }
        }

        ++iNumExisting;
      }
    }

    // If no filename was specified, and we don't have any
    // existing files, we're done.

    if ((pszFilename == null) && (iNumExisting == 0))
    {
      recentSeparator.setVisible(false);
      return;
    }

    // If a file was specified, we have to update the registry

    if (pszFilename != null)
    {
      // Write the new filename to the registry

      rk.setValue(kpszRecentFilesItem + "1", pszFilename);

      // If we previously had the maximum number of files, and
      // the new one is not one of them, we disregard the last
      // one.

      if ((iNumExisting == MAX_RECENT_FILES) && (iFind < 0))
        --iNumExisting;

      // Now, write the remaining items

      iCount = 1;

      for (int i=0; i < iNumExisting; i++)
      {
        if (i != iFind)
        {
          Integer i2 = new Integer(++iCount);
          rk.setValue(kpszRecentFilesItem + i2.toString(), rgpszRecentFiles[i]);
        }
      }
    }

    // Set the recent file menu items to be non-visible

    recent1.setVisible(false);
    recent2.setVisible(false);
    recent3.setVisible(false);
    recent4.setVisible(false);

    // Create an ellipsis path from the specified filename and
    // insert it into the menu.

    if (pszFilename != null)
    {
      pszEllipsis = MakeEllipsisPath(pszFilename, MAX_RECENT_FILENAME);
      String pszMenuItemText = new String("&1 " + pszEllipsis);
      recent1.setText(pszMenuItemText);
      recent1.setVisible(true);
      iCount = 1;
    }
    else
    {
      iCount = 0;
    }

    // Then do the same for the remaining items

    for (int i=0; i < iNumExisting; i++)
    {
      if (i != iFind)
      {
        Integer i2 = new Integer(iCount+1);

        pszEllipsis = MakeEllipsisPath(rgpszRecentFiles[i], MAX_RECENT_FILENAME);

        String pszMenuItemText = new String("&" + i2.toString() + " " + pszEllipsis);

        if (iCount == 0)
        {
          recent1.setText(pszMenuItemText);
          recent1.setVisible(true);
        }
        else if (iCount == 1)
        {
          recent2.setText(pszMenuItemText);
          recent2.setVisible(true);
        }
        else if (iCount == 2)
        {
          recent3.setText(pszMenuItemText);
          recent3.setVisible(true);
        }
        else if (iCount == 3)
        {
          recent4.setText(pszMenuItemText);
          recent4.setVisible(true);
        }

        ++iCount;
      }
    }

    // Show/Hide the separator as appropriate

    if ((iNumExisting == 0) && (pszFilename == null))
      recentSeparator.setVisible(false);
    else
      recentSeparator.setVisible(true);

    rk.close();
  }

void CapJ::UseBalloon_click | ( | Object | source,
 |  | Event | e |
 | ) |  |  | [inline, private]

Definition at line 616 of file capj.java.

  {
    boolean bUseBalloon;

    bUseBalloon = UseBalloon.getChecked();

    AutoHide.setEnabled(bUseBalloon);
    AutoPace.setEnabled(bUseBalloon);
    SizeToText.setEnabled(bUseBalloon);
  }

void CapJ::UseSfx_click | ( | Object | source,
 |  | Event | e |
 | ) |  |  | [inline, private]

Definition at line 608 of file capj.java.

  {
    if (m_pCharacter == null)
      return;

    m_pCharacter.setSoundEffectsOn(UseSfx.getChecked());
  }

Member Data Documentation

MenuItem CapJ::aboutMenu = new MenuItem() [package]

Definition at line 779 of file capj.java.

agentctl.Agent.Agent CapJ::agent1 = new agentctl.Agent.Agent() [package]

Definition at line 791 of file capj.java.

GroupBox CapJ::AnimationsLabel = new GroupBox() [package]

Definition at line 776 of file capj.java.

ListBox CapJ::AnimationsListBox = new ListBox() [package]

Definition at line 778 of file capj.java.

CheckBox CapJ::AutoHide = new CheckBox() [package]

Definition at line 781 of file capj.java.

CheckBox CapJ::AutoPace = new CheckBox() [package]

Definition at line 792 of file capj.java.

Container CapJ::components = new Container() [package]

Definition at line 773 of file capj.java.

MenuItem CapJ::exitMenu = new MenuItem() [package]

Definition at line 789 of file capj.java.

MenuItem CapJ::fileMenu = new MenuItem() [package]

Definition at line 780 of file capj.java.

MenuItem CapJ::helpMenu = new MenuItem() [package]

Definition at line 790 of file capj.java.

final String CapJ::kpszCharacterWindowTitle = "Microsoft Agent" [private]

Definition at line 47 of file capj.java.

final String CapJ::kpszOptionsWindowTitle = "Advanced Character Options" [private]

Definition at line 48 of file capj.java.

final String CapJ::kpszRecentFilesItem = "File" [private]

Definition at line 45 of file capj.java.

final String CapJ::kpszRecentFilesSubkey = "Software\\Microsoft\\Microsoft Agent\\Tools\\Character Previewer\\Recent Files" [private]

Definition at line 44 of file capj.java.

agentctl.IAgentCtlCharacterEx CapJ::m_pCharacter = null [private]

Definition at line 40 of file capj.java.

MainMenu CapJ::mainMenu1 = new MainMenu() [package]

Definition at line 774 of file capj.java.

final int CapJ::MAX_RECENT_FILENAME = 32 [private]

Definition at line 51 of file capj.java.

final int CapJ::MAX_RECENT_FILES = 4 [private]

Definition at line 50 of file capj.java.

MenuItem CapJ::menuItem1 = new MenuItem() [package]

Definition at line 801 of file capj.java.

Button CapJ::Move = new Button() [package]

Definition at line 800 of file capj.java.

MenuItem CapJ::openMenu = new MenuItem() [package]

Definition at line 775 of file capj.java.

Button CapJ::PlayButton = new Button() [package]

Definition at line 782 of file capj.java.

GroupBox CapJ::PositionLabel = new GroupBox() [package]

Definition at line 795 of file capj.java.

MenuItem CapJ::recent1 = new MenuItem() [package]

Definition at line 805 of file capj.java.

MenuItem CapJ::recent2 = new MenuItem() [package]

Definition at line 802 of file capj.java.

MenuItem CapJ::recent3 = new MenuItem() [package]

Definition at line 803 of file capj.java.

MenuItem CapJ::recent4 = new MenuItem() [package]

Definition at line 804 of file capj.java.

MenuItem CapJ::recentSeparator = new MenuItem() [package]

Definition at line 777 of file capj.java.

CheckBox CapJ::SizeToText = new CheckBox() [package]

Definition at line 793 of file capj.java.

Button CapJ::SpeakButton = new Button() [package]

Definition at line 794 of file capj.java.

Edit CapJ::SpeakText = new Edit() [package]

Definition at line 787 of file capj.java.

GroupBox CapJ::SpeechOutputLabel = new GroupBox() [package]

Definition at line 786 of file capj.java.

CheckBox CapJ::StopBeforePlay = new CheckBox() [package]

Definition at line 785 of file capj.java.

Button CapJ::StopButton = new Button() [package]

Definition at line 783 of file capj.java.

CheckBox CapJ::UseBalloon = new CheckBox() [package]

Definition at line 788 of file capj.java.

final int CapJ::UserHid = 0 [private]

Definition at line 55 of file capj.java.

final int CapJ::UserHidViaCharacterMenu = 7 [private]

Definition at line 56 of file capj.java.

CheckBox CapJ::UseSfx = new CheckBox() [package]

Definition at line 784 of file capj.java.

Edit CapJ::X = new Edit() [package]

Definition at line 797 of file capj.java.

Label CapJ::XLabel = new Label() [package]

Definition at line 796 of file capj.java.

Edit CapJ::Y = new Edit() [package]

Definition at line 799 of file capj.java.

Label CapJ::YLabel = new Label() [package]

Definition at line 798 of file capj.java.

The documentation for this class was generated from the following file:
  • Web/MSAgent/Java/CapJ/capj.java
Generated on Wed Nov 13 2024 16:55:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAppExportDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes

CAppExportDlg Class Reference

#include "AppExportDlg.h"

List of all members.

Public Types

enum | { IDD = IDD_EXPORT_APPLICATION }

Public Member Functions

CAppExportDlg (CWnd *pParent=NULL)
void | set_Catalog (ICOMAdminCatalog *pCatalog)

Public Attributes

CEdit | m_edtApplicationID
CEdit | m_edtExportPath

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
afx_msg void | OnClose ()
afx_msg void | OnExportClients ()
afx_msg void | OnExportPathSearch ()
afx_msg void | OnExportUsers ()
afx_msg void | OnExportWithoutUsers ()
virtual BOOL | OnInitDialog ()
virtual void | OnOK ()
afx_msg void | OnOverwriteFiles ()

Protected Attributes

HICON | m_hIcon

Private Member Functions

void | ReleaseCatalog ()

Private Attributes

bool | m_bOverwriteFiles
int | m_nExportType
ICOMAdminCatalog * | m_pCatalog

Detailed Description

Definition at line 32 of file AppExportDlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 41 of file AppExportDlg.h.

{ IDD = IDD_EXPORT_APPLICATION };

Constructor & Destructor Documentation

CAppExportDlg::CAppExportDlg ( CWnd * pParent = NULL )

Definition at line 42 of file AppExportDlg.Cpp.

  : CDialog(CAppExportDlg::IDD, pParent)
{
  //{{AFX_DATA_INIT(CAppExportDlg)
    // NOTE: the ClassWizard will add member initialization here
  //}}AFX_DATA_INIT

  // Load the dialog's icon resource
  m_hIcon = AfxGetApp()->LoadIcon(IDI_EXPORT);

  // Initialize the members
  m_pCatalog = NULL;
  m_nExportType = EXPORT_TYPE_UNDEFINED;
  m_bOverwriteFiles = false;
}

Member Function Documentation

void CAppExportDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 59 of file AppExportDlg.Cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CAppExportDlg)
  DDX_Control(pDX, IDC_EDIT_EXPORT_PATH, m_edtExportPath);
  DDX_Control(pDX, IDC_EDIT_APPLICATION_ID, m_edtApplicationID);
  //}}AFX_DATA_MAP
}

void CAppExportDlg::OnClose ( ) [protected]

Definition at line 91 of file AppExportDlg.Cpp.

{
  // Release the reference to the Catalog object if needed
  ReleaseCatalog();

  CDialog::OnClose();
}

void CAppExportDlg::OnExportClients ( ) [protected]

Definition at line 188 of file AppExportDlg.Cpp.

{
  m_nExportType = EXPORT_TYPE_WITH_CLIENTS;
}

void CAppExportDlg::OnExportPathSearch ( ) [protected]

Definition at line 203 of file AppExportDlg.Cpp.

{
  OPENFILENAME ofn;
  char pFilePath[256];
  char pFileTitle[256];

  // Setup of OPENFILENAME structure
  ofn.lStructSize = sizeof(OPENFILENAME);
    ofn.hwndOwner = m_hWnd;
    ofn.hInstance = NULL;
    ofn.lpstrFilter = "All Files (*.*)\0*.*\0\0";
    ofn.lpstrCustomFilter = (LPSTR) NULL;
    ofn.nMaxCustFilter = 0;
    ofn.nFilterIndex = 1;
    pFilePath[0] = '\0';
    ofn.lpstrFile = pFilePath;
    ofn.nMaxFile = sizeof(pFilePath);
    ofn.lpstrFileTitle = pFileTitle;
    ofn.nMaxFileTitle = sizeof(pFileTitle);
    ofn.lpstrInitialDir = NULL;
  ofn.lpstrTitle = "Select the export directory";
    ofn.Flags = (OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST);
    ofn.lpstrDefExt = "DLL";
    ofn.nFileOffset = 0;
    ofn.nFileExtension = 0;
    ofn.lCustData = 0;

  // Invoke the file open common dialog
  GetOpenFileName(&ofn);

  // Update the value in the control
  m_edtExportPath.SetWindowText(ofn.lpstrFile);
}

void CAppExportDlg::OnExportUsers ( ) [protected]

Definition at line 193 of file AppExportDlg.Cpp.

{
  m_nExportType = EXPORT_TYPE_WITH_USERS;
}

void CAppExportDlg::OnExportWithoutUsers ( ) [protected]

Definition at line 183 of file AppExportDlg.Cpp.

{
  m_nExportType = EXPORT_TYPE_WITHOUT_USERS;
}

BOOL CAppExportDlg::OnInitDialog ( ) [protected, virtual]

Definition at line 164 of file AppExportDlg.Cpp.

{
  CDialog::OnInitDialog();

  // Set the dialog's icon resource
  SetIcon(m_hIcon, true);     // 32x32 icon
  SetIcon(m_hIcon, true);     // 16x16 icon

  // Select and set default export type
  CheckRadioButton(IDC_RADIO_DO_NOT_EXPORT_USERS, IDC_RADIO_EXPORT_CLIENTS, IDC_RADIO_DO_NOT_EXPORT_USERS);

  // Set the import type and description to match the current selection
  OnExportWithoutUsers();

  return TRUE;  // return TRUE unless you set the focus to a control
                // EXCEPTION: OCX Property Pages should return FALSE
}

void CAppExportDlg::OnOK ( ) [protected, virtual]

Definition at line 106 of file AppExportDlg.Cpp.

{
  if (NULL != m_pCatalog)
  {
    // Determine the export options
    long lOptions = 0;
    switch (m_nExportType)
    {
    case EXPORT_TYPE_WITHOUT_USERS:
      lOptions = COMAdminExportNoUsers;
      break;
    case EXPORT_TYPE_WITH_USERS:
      lOptions = COMAdminExportUsers;
      break;
    case EXPORT_TYPE_WITH_CLIENTS:
      lOptions = COMAdminExportApplicationProxy;
      break;
    }

    if (m_bOverwriteFiles)
      lOptions = lOptions | COMAdminExportForceOverwriteOfFiles;

    // Extract method parameters from the UI
    int nAppIDLength = m_edtApplicationID.GetWindowTextLength() + 1;
    char* pAppIDBuf = new char[nAppIDLength];
    m_edtApplicationID.GetWindowText(pAppIDBuf, nAppIDLength);
    _bstr_t bstrAppID = pAppIDBuf;
    delete [] pAppIDBuf;

    int nExportPathLength = m_edtExportPath.GetWindowTextLength() + 1;
    char* pExportPathBuf = new char[nExportPathLength];
    m_edtExportPath.GetWindowText(pExportPathBuf, nExportPathLength);
    _bstr_t bstrExportPath = pExportPathBuf;
    delete [] pExportPathBuf;

    // Attempt to export the application
    HRESULT hr = m_pCatalog->ExportApplication(bstrAppID,
                          bstrExportPath,
                          lOptions);

    // Validate success/fail
    if FAILED(hr)
      MessageBox("Failed to export the application.\n\nNo processing performed.\n\nPress OK to continue.",
            "Error",
            (MB_OK | MB_ICONERROR));

  }
  else
    MessageBox("Invalid Catalog reference.\n\nNo processing will be performed.\n\nPress OK to continue.",
          "Error",
          (MB_OK | MB_ICONERROR));

  // Release the Catalog reference
  ReleaseCatalog();

  CDialog::OnOK();
}

void CAppExportDlg::OnOverwriteFiles ( ) [protected]

Definition at line 198 of file AppExportDlg.Cpp.

{
  m_bOverwriteFiles = !m_bOverwriteFiles;
}

void CAppExportDlg::ReleaseCatalog ( ) [private]

Definition at line 99 of file AppExportDlg.Cpp.

{
  // Release the reference to the Catalog object if needed
  if (NULL != m_pCatalog)
    m_pCatalog->Release();
}

void CAppExportDlg::set_Catalog ( ICOMAdminCatalog * pCatalog )

Definition at line 83 of file AppExportDlg.Cpp.

{
  // Only can have one Catalog object reference... release all prior references before assignment
  ReleaseCatalog();

  m_pCatalog = pCatalog;
}

Member Data Documentation

bool CAppExportDlg::m_bOverwriteFiles [private]

Definition at line 71 of file AppExportDlg.h.

CEdit CAppExportDlg::m_edtApplicationID

Definition at line 43 of file AppExportDlg.h.

CEdit CAppExportDlg::m_edtExportPath

Definition at line 42 of file AppExportDlg.h.

HICON CAppExportDlg::m_hIcon [protected]

Definition at line 56 of file AppExportDlg.h.

int CAppExportDlg::m_nExportType [private]

Definition at line 72 of file AppExportDlg.h.

ICOMAdminCatalog* CAppExportDlg::m_pCatalog [private]

Definition at line 74 of file AppExportDlg.h.

The documentation for this class was generated from the following files:
  • Com/Administration/Explore.VC/AppExportDlg.h
  • Com/Administration/Explore.VC/AppExportDlg.Cpp
Generated on Wed Nov 13 2024 16:55:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAppInfo Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CAppInfo Class Reference

#include "appinfo.h"

List of all members.

Public Member Functions

CAppInfo (LPTSTR sAppName, CComSpy *pSpy)
CAppInfo (LPTSTR sAppName, CComSpy *pSpy, long nPID)
CAppInfo (LPTSTR sAppName, CComSpy *pSpy, LPTSTR sAppID)
~CAppInfo ()
bool | AddSubscription (EventEnum e)
CComBSTR & | AppName ()
SUBSCRIBERMAP * GetEvents ()
FILTERTYPE GetFilterType ()
bool | IsReadyForDelete ()
bool | IsSubscribed (EventEnum e)
bool | IsSubscribedToAny ()
bool | RemoveAllSubscriptions ()
bool | RemoveSubscription (EventEnum e)
void | SetDeleteFlag (bool bDelete)

Private Member Functions

CAppInfo ()
void | Initialze (CComSpy *pSpy)

Private Attributes

bool | m_bReadyForDelete
SUBSCRIBERMAP * m_EventMap
FILTERTYPE m_FilterType
long | m_PID
CComSpy * m_pSpy
CComBSTR | m_sAppID
CComBSTR | m_sAppName

Detailed Description

Definition at line 37 of file appinfo.h.

Constructor & Destructor Documentation

CAppInfo::CAppInfo ( ) [private]
CAppInfo::CAppInfo | ( | LPTSTR | sAppName,
 |  | CComSpy * | pSpy
 | ) |  |

Definition at line 70 of file appinfo.Cpp.

{
  Initialze(pSpy);
  m_sAppName = sAppName;
  m_FilterType = NoFilter;
  m_sAppID = _T("");
  m_PID = 0;
};

CAppInfo::CAppInfo | ( | LPTSTR | sAppName,
 |  | CComSpy * | pSpy,
 |  | long | nPID
 | ) |  |

Definition at line 89 of file appinfo.Cpp.

{
  Initialze(pSpy);
  m_sAppName = sAppName;
  m_FilterType = ProcessID;
  m_sAppID = _T("");
  m_PID = nPID;
};

CAppInfo::CAppInfo | ( | LPTSTR | sAppName,
 |  | CComSpy * | pSpy,
 |  | LPTSTR | sAppID
 | ) |  |

Definition at line 110 of file appinfo.Cpp.

{
  Initialze(pSpy);
  m_sAppName = sAppName;
  m_FilterType = AppID;
  m_sAppID = sAppID;
  m_PID = 0;
};

CAppInfo::~CAppInfo ( )

Definition at line 129 of file appinfo.Cpp.

{
  bool bResult = RemoveAllSubscriptions();
  delete m_EventMap;
  m_EventMap = NULL;
 }

Member Function Documentation

bool CAppInfo::AddSubscription ( EventEnum e )

Definition at line 180 of file appinfo.Cpp.

{
  USES_CONVERSION;

  HRESULT hr;
  ICOMSysLCE* pSubscriber = NULL;

  if (IsSubscribed(e))
    return false;

  switch (e)
  {
    // Hack note: The QI will do our AddRef
    case Application:
    {
      CComObject <CAppSub> * pSub;
      hr = CComObject<CAppSub>::CreateInstance(&pSub);
      _ASSERTE(pSub);
      pSub->SetSpyObj(m_pSpy);
      pSub -> QueryInterface(IID_ICOMSysLCE, (void **)&pSubscriber);
      break;
    }
    case Thread:
    {
      CComObject <CThreadSub> * pSub;
      hr = CComObject<CThreadSub>::CreateInstance(&pSub);
      _ASSERTE(pSub);
      pSub -> SetSpyObj(m_pSpy);
      pSub -> QueryInterface(IID_ICOMSysLCE, (void **)&pSubscriber);
      break;
    }
    case Instance:
    {
      CComObject <CInstanceSub> * pSub;
      hr = CComObject<CInstanceSub>::CreateInstance(&pSub);
      _ASSERTE(pSub);
      pSub -> SetSpyObj(m_pSpy);
      pSub -> QueryInterface(IID_ICOMSysLCE, (void **)&pSubscriber);
      break;
    }
    case Transaction:
    {
      CComObject <CTxSub> * pSub;
      hr = CComObject<CTxSub>::CreateInstance(&pSub);
      _ASSERTE(pSub);
      pSub -> SetSpyObj(m_pSpy);
      pSub -> QueryInterface(IID_ICOMSysLCE, (void **)&pSubscriber);
      break;
    }
    case Method:
    {
      CComObject <CMethodSub> * pSub;
      hr = CComObject<CMethodSub>::CreateInstance(&pSub);
      _ASSERTE(pSub);
      pSub -> SetSpyObj(m_pSpy);
      pSub -> QueryInterface(IID_ICOMSysLCE, (void **)&pSubscriber);
      break;
    }
    case Object:
    {
      CComObject <CObjSub> * pSub;
      hr = CComObject<CObjSub>::CreateInstance(&pSub);
      _ASSERTE(pSub);
      pSub -> SetSpyObj(m_pSpy);
      pSub -> QueryInterface(IID_ICOMSysLCE, (void **)&pSubscriber);
      break;
    }
    case Resource:
    {
      CComObject <CResourceSub> * pSub;
      hr = CComObject<CResourceSub>::CreateInstance(&pSub);
      _ASSERTE(pSub);
      pSub -> SetSpyObj(m_pSpy);
      pSub -> QueryInterface(IID_ICOMSysLCE, (void **)&pSubscriber);
      break;
    }
    case User:
    {
      CComObject <CUserSub> * pSub;
      hr = CComObject<CUserSub>::CreateInstance(&pSub);
      _ASSERTE(pSub);
      pSub -> SetSpyObj(m_pSpy);
      pSub -> QueryInterface(IID_ICOMSysLCE, (void **)&pSubscriber);
      break;
    }
    case Security:
    {
      CComObject <CSecuritySub> * pSub;
      hr = CComObject<CSecuritySub>::CreateInstance(&pSub);
      _ASSERTE(pSub);
      pSub -> SetSpyObj(m_pSpy);
      pSub -> QueryInterface(IID_ICOMSysLCE, (void **)&pSubscriber);
      break;
    }
    case ObjectConstruction:
    {
      CComObject <CObjConstSub> * pSub;
      hr = CComObject<CObjConstSub>::CreateInstance(&pSub);
      _ASSERTE(pSub);
      pSub -> SetSpyObj(m_pSpy);
      pSub -> QueryInterface(IID_ICOMSysLCE, (void **)&pSubscriber);
      break;
    }
    case ObjectPool:
    {
      CComObject <CObjPoolSub> * pSub;
      hr = CComObject<CObjPoolSub>::CreateInstance(&pSub);
      _ASSERTE(pSub);
      pSub -> SetSpyObj(m_pSpy);
      pSub -> QueryInterface(IID_ICOMSysLCE, (void **)&pSubscriber);
      break;
    }
    case ObjectPool2:
    {
      CComObject <CObjPool2Sub> * pSub;
      hr = CComObject<CObjPool2Sub>::CreateInstance(&pSub);
      _ASSERTE(pSub);
      pSub -> SetSpyObj(m_pSpy);
      pSub -> QueryInterface(IID_ICOMSysLCE, (void **)&pSubscriber);
      break;
    }
    case Activity:
    {
      CComObject <CActivitySub> * pSub;
      hr = CComObject<CActivitySub>::CreateInstance(&pSub);
      _ASSERTE(pSub);
      pSub -> SetSpyObj(m_pSpy);
      pSub -> QueryInterface(IID_ICOMSysLCE, (void **)&pSubscriber);
      break;
    }
    case Identity:
    {
      CComObject <CIdentitySub> * pSub;
      hr = CComObject<CIdentitySub>::CreateInstance(&pSub);
      _ASSERTE(pSub);
      pSub -> SetSpyObj(m_pSpy);
      pSub -> QueryInterface(IID_ICOMSysLCE, (void **)&pSubscriber);
      break;
    }
    case QC:
    {
      CComObject <CQCSub> * pSub;
      hr = CComObject<CQCSub>::CreateInstance(&pSub);
      _ASSERTE(pSub);
      pSub -> SetSpyObj(m_pSpy);
      pSub -> QueryInterface(IID_ICOMSysLCE, (void **)&pSubscriber);
      break;
    }
    case Exception:
    {
      CComObject <CExceptionSub> * pSub;
      hr = CComObject<CExceptionSub>::CreateInstance(&pSub);
      _ASSERTE(pSub);
      pSub -> SetSpyObj(m_pSpy);
      pSub -> QueryInterface(IID_ICOMSysLCE, (void **)&pSubscriber);
      break;
    }
    case CRM:
    {
      CComObject <CCRMSub> * pSub;
      hr = CComObject<CCRMSub>::CreateInstance(&pSub);
      _ASSERTE(pSub);
      pSub -> SetSpyObj(m_pSpy);
      pSub -> QueryInterface(IID_ICOMSysLCE, (void **)&pSubscriber);
      break;
    }
    //Events generated by system process
    case EventStore:
    {
      CComObject <CEvtStoreSub> * pSub;
      hr = CComObject<CEvtStoreSub>::CreateInstance(&pSub);
      _ASSERTE(pSub);
      pSub -> SetSpyObj(m_pSpy);
      pSub -> QueryInterface(IID_ICOMSysLCE, (void **)&pSubscriber);
      break;
    }
    case LoadBalancing:
    {
      CComObject <CLBSub> * pSub;
      hr = CComObject<CLBSub>::CreateInstance(&pSub);
      _ASSERTE(pSub);
      pSub -> SetSpyObj(m_pSpy);
      pSub -> QueryInterface(IID_ICOMSysLCE, (void **)&pSubscriber);
      break;
    }
    default:
      ATLTRACE(L"Object type not implemented yet\n");
      _ASSERTE(0);
      break;
  }

  // We've successfully created the Subscriber interface.
  if (pSubscriber)
  {
    CComBSTR  bstrPropertyName;
    CComVariant vPropertyValue;
    BSTR*   pbstrPropertyName;

    // Set the filter strings according to the object type.
    switch (m_FilterType)
    {
    case ProcessID:
      TCHAR convBuff[ 32 ];
      _itot( m_PID, convBuff, 10 );

      vPropertyValue = convBuff;
      bstrPropertyName = _T("ProcessId");
      pbstrPropertyName = (BSTR*)&bstrPropertyName;
      break;
    case AppID:
      bstrPropertyName = _T("AppId");
      vPropertyValue = m_sAppID;
      pbstrPropertyName = (BSTR*)&bstrPropertyName;
      break;
    case NoFilter:
      // If this is a filtertype of All Apps, then pass NULL.
      pbstrPropertyName = NULL;
      vPropertyValue = _T("");
      break;
    default:
      _ASSERTE(0);
    };

    // Register the subscription.
    pSubscriber->Install(pbstrPropertyName, vPropertyValue);

    // Add the event Subscription to the MAP.
    (*m_EventMap)[e] = pSubscriber;
  };

  return true;
};

CComBSTR& CAppInfo::AppName ( ) [inline]

Definition at line 59 of file appinfo.h.

{return m_sAppName;}

SUBSCRIBERMAP* CAppInfo::GetEvents ( ) [inline]

Definition at line 61 of file appinfo.h.

{return m_EventMap;}

FILTERTYPE CAppInfo::GetFilterType ( ) [inline]

Definition at line 60 of file appinfo.h.

{return m_FilterType;}

void CAppInfo::Initialze ( CComSpy * pSpy ) [private]

Definition at line 54 of file appinfo.Cpp.

{
  m_EventMap = new SUBSCRIBERMAP;
  m_bReadyForDelete = false;
  m_pSpy = pSpy;
};

bool CAppInfo::IsReadyForDelete ( ) [inline]

Definition at line 64 of file appinfo.h.

{ return m_bReadyForDelete; }

bool CAppInfo::IsSubscribed ( EventEnum e )

Definition at line 451 of file appinfo.Cpp.

{
  ICOMSysLCE * pSubscriber = NULL;
  pSubscriber = (*m_EventMap)[e];
  bool bResult = pSubscriber ? true : false;
  pSubscriber = NULL;
  return bResult;
};

bool CAppInfo::IsSubscribedToAny ( )

Definition at line 468 of file appinfo.Cpp.

{
  long nSubs = 0;
  SUBSCRIBERMAP::iterator item;
  ICOMSysLCE * pSubscriber = NULL;
  for (item = m_EventMap->begin(); item != m_EventMap->end(); ++item)
  {
    pSubscriber = (*item).second;
    if (pSubscriber)
      nSubs++;
  };
  return (nSubs > 0) ? true : false;
};

bool CAppInfo::RemoveAllSubscriptions ( )

Definition at line 146 of file appinfo.Cpp.

{
  SUBSCRIBERMAP::iterator item;
  ICOMSysLCE * pSubscriber = NULL;

  // Iterate through the list of Events to delete them all.
  item = m_EventMap->begin();
  while (item != m_EventMap->end())
  {
    pSubscriber = (*item).second;
    if (pSubscriber)
    {
      pSubscriber->Uninstall();
      pSubscriber->Release();
      pSubscriber = NULL;
    }
    item = m_EventMap->erase(item);
  };

  return true;
}

bool CAppInfo::RemoveSubscription ( EventEnum e )

Definition at line 422 of file appinfo.Cpp.

{
  ICOMSysLCE * pSubscriber = NULL;

  if (!IsSubscribed(e))
    return false;

  // Get the Subscriber interface pointer.
  pSubscriber = (*m_EventMap)[e];
  if (pSubscriber)
  {
    pSubscriber->Uninstall();
    pSubscriber->Release();
    pSubscriber = NULL;
    m_EventMap->erase(e);
    return true;
  };

  return false;
}

void CAppInfo::SetDeleteFlag ( bool bDelete ) [inline]

Definition at line 63 of file appinfo.h.

{ m_bReadyForDelete = bDelete; }

Member Data Documentation

bool CAppInfo::m_bReadyForDelete [private]

Definition at line 41 of file appinfo.h.

SUBSCRIBERMAP* CAppInfo::m_EventMap [private]

Definition at line 42 of file appinfo.h.

FILTERTYPE CAppInfo::m_FilterType [private]

Definition at line 44 of file appinfo.h.

long CAppInfo::m_PID [private]

Definition at line 46 of file appinfo.h.

CComSpy* CAppInfo::m_pSpy [private]

Definition at line 40 of file appinfo.h.

CComBSTR CAppInfo::m_sAppID [private]

Definition at line 45 of file appinfo.h.

CComBSTR CAppInfo::m_sAppName [private]

Definition at line 43 of file appinfo.h.

The documentation for this class was generated from the following files:
  • Com/Administration/Spy/ComSpyCtl/appinfo.h
  • Com/Administration/Spy/ComSpyCtl/appinfo.Cpp
Generated on Wed Nov 13 2024 16:55:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAppInstallDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes

CAppInstallDlg Class Reference

#include "AppInstallDlg.h"

List of all members.

Public Types

enum | { IDD = IDD_INSTALL_APPLICATION }

Public Member Functions

CAppInstallDlg (CWnd *pParent=NULL)
void | set_Catalog (ICOMAdminCatalog *pCatalog)

Public Attributes

CEdit | m_edtAppFile
CEdit | m_edtInstallDir
CEdit | m_edtPWD
CEdit | m_edtRemoteServerName
CEdit | m_edtUID

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
afx_msg void | OnAppFileSearch ()
afx_msg void | OnClose ()
virtual BOOL | OnInitDialog ()
afx_msg void | OnInstallDirSearch ()
afx_msg void | OnInstallWithoutUsers ()
afx_msg void | OnInstallWithUsers ()
virtual void | OnOK ()
afx_msg void | OnOverwriteFiles ()
afx_msg void | OnRemoteServerInstall ()

Protected Attributes

HICON | m_hIcon

Private Member Functions

void | ReleaseCatalog ()
void | ToggleRemoteServerState (bool Flag)

Private Attributes

bool | m_bOverwriteFiles
bool | m_bRemoteInstall
int | m_nInstallType
ICOMAdminCatalog * | m_pCatalog

Detailed Description

Definition at line 30 of file AppInstallDlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 39 of file AppInstallDlg.h.

{ IDD = IDD_INSTALL_APPLICATION };

Constructor & Destructor Documentation

CAppInstallDlg::CAppInstallDlg ( CWnd * pParent = NULL )

Definition at line 39 of file AppInstallDlg.Cpp.

  : CDialog(CAppInstallDlg::IDD, pParent)
{
  //{{AFX_DATA_INIT(CAppInstallDlg)
    // NOTE: the ClassWizard will add member initialization here
  //}}AFX_DATA_INIT

  // Load the dialogs icon resource
  m_hIcon = AfxGetApp()->LoadIcon(IDI_INSTALL);

  // Initialize the members
  m_pCatalog = NULL;
  m_nInstallType = APP_INSTALL_TYPE_UNDEFINED;
  m_bOverwriteFiles = false;
  m_bRemoteInstall = false;
}

Member Function Documentation

void CAppInstallDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 57 of file AppInstallDlg.Cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CAppInstallDlg)
  DDX_Control(pDX, IDC_EDIT_UID, m_edtUID);
  DDX_Control(pDX, IDC_EDIT_PWD, m_edtPWD);
  DDX_Control(pDX, IDC_EDIT_REMOTE_SERVER_NAME, m_edtRemoteServerName);
  DDX_Control(pDX, IDC_EDIT_INSTALL_DIRECTORY, m_edtInstallDir);
  DDX_Control(pDX, IDC_EDIT_APPLICATION_FILE, m_edtAppFile);
  //}}AFX_DATA_MAP

}

void CAppInstallDlg::OnAppFileSearch ( ) [protected]

Definition at line 197 of file AppInstallDlg.Cpp.

{
  OPENFILENAME ofn;
  char pFilePath[256];
  char pFileTitle[256];

  // Setup of OPENFILENAME structure
  ofn.lStructSize = sizeof(OPENFILENAME);
    ofn.hwndOwner = m_hWnd;
    ofn.hInstance = NULL;
    ofn.lpstrFilter = "All Files (*.*)\0*.*\0\0";
    ofn.lpstrCustomFilter = (LPSTR) NULL;
    ofn.nMaxCustFilter = 0;
    ofn.nFilterIndex = 1;
    pFilePath[0] = '\0';
    ofn.lpstrFile = pFilePath;
    ofn.nMaxFile = sizeof(pFilePath);
    ofn.lpstrFileTitle = pFileTitle;
    ofn.nMaxFileTitle = sizeof(pFileTitle);
    ofn.lpstrInitialDir = NULL;
  ofn.lpstrTitle = "Select Application to install";
    ofn.Flags = (OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST);
    ofn.lpstrDefExt = "DLL";
    ofn.nFileOffset = 0;
    ofn.nFileExtension = 0;
    ofn.lCustData = 0;

  // Invoke the file open common dialog
  GetOpenFileName(&ofn);

  // Update the value in the control
  m_edtAppFile.SetWindowText(ofn.lpstrFile);
}

void CAppInstallDlg::OnClose ( ) [protected]

Definition at line 95 of file AppInstallDlg.Cpp.

{
  // Release the reference to the Catalog object if needed
  ReleaseCatalog();

  CDialog::OnClose();
}

BOOL CAppInstallDlg::OnInitDialog ( ) [protected, virtual]

Definition at line 265 of file AppInstallDlg.Cpp.

{
  CDialog::OnInitDialog();

  // Set the dialog's icon resource
  SetIcon(m_hIcon, true);     // 32x32 icon
  SetIcon(m_hIcon, false);    // 16x16 icon

  // Select and set default export type
  CheckRadioButton(IDC_RADIO_INSTALL_WITHOUT_USERS, IDC_RADIO_INSTALL_WITH_USERS, IDC_RADIO_INSTALL_WITHOUT_USERS);

  // Set the import type and description to match the current selection
  OnInstallWithoutUsers();

  // Set the state of the Remote Server Install control group
  ToggleRemoteServerState(false);

  return TRUE;  // return TRUE unless you set the focus to a control
                // EXCEPTION: OCX Property Pages should return FALSE
}

void CAppInstallDlg::OnInstallDirSearch ( ) [protected]

Definition at line 231 of file AppInstallDlg.Cpp.

{
  OPENFILENAME ofn;
  char pFilePath[256];
  char pFileTitle[256];

  // Setup of OPENFILENAME structure
  ofn.lStructSize = sizeof(OPENFILENAME);
    ofn.hwndOwner = m_hWnd;
    ofn.hInstance = NULL;
    ofn.lpstrFilter = "All Files (*.*)\0*.*\0\0";
    ofn.lpstrCustomFilter = (LPSTR) NULL;
    ofn.nMaxCustFilter = 0;
    ofn.nFilterIndex = 1;
    pFilePath[0] = '\0';
    ofn.lpstrFile = pFilePath;
    ofn.nMaxFile = sizeof(pFilePath);
    ofn.lpstrFileTitle = pFileTitle;
    ofn.nMaxFileTitle = sizeof(pFileTitle);
    ofn.lpstrInitialDir = NULL;
  ofn.lpstrTitle = "Select the install directory";
    ofn.Flags = (OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST);
    ofn.lpstrDefExt = "DLL";
    ofn.nFileOffset = 0;
    ofn.nFileExtension = 0;
    ofn.lCustData = 0;

  // Invoke the file open common dialog
  GetOpenFileName(&ofn);

  // Update the value in the control
  m_edtInstallDir.SetWindowText(ofn.lpstrFile);
}

void CAppInstallDlg::OnInstallWithoutUsers ( ) [protected]

Definition at line 292 of file AppInstallDlg.Cpp.

{
  // Set the install type
  m_nInstallType = APP_INSTALL_TYPE_WITH_USERS;
}

void CAppInstallDlg::OnInstallWithUsers ( ) [protected]

Definition at line 286 of file AppInstallDlg.Cpp.

{
  // Set the install type
  m_nInstallType = APP_INSTALL_TYPE_WITHOUT_USERS;
}

void CAppInstallDlg::OnOK ( ) [protected, virtual]

Definition at line 103 of file AppInstallDlg.Cpp.

{
  // Continue only if we have a valid Catalog pointer
  if (NULL != m_pCatalog)
  {
    long  lOptions = 0;

    // Determine the install options
    if (m_nInstallType == APP_INSTALL_TYPE_WITHOUT_USERS)
      lOptions = lOptions | COMAdminInstallNoUsers;
    else
      lOptions = lOptions | COMAdminInstallUsers;

    if (m_bOverwriteFiles)
      lOptions = lOptions | COMAdminInstallForceOverwriteOfFiles;

    // Extract method parameters from the UI
    int nAppFileLength = m_edtAppFile.GetWindowTextLength() + 1;
    char* pAppFileBuf = new char[nAppFileLength];
    m_edtAppFile.GetWindowText(pAppFileBuf, nAppFileLength);
    _bstr_t bstrAppFile = pAppFileBuf;
    delete [] pAppFileBuf;

    int nInstallDirLength = m_edtInstallDir.GetWindowTextLength() + 1;
    char* pInstallDirBuf = new char[nInstallDirLength];
    m_edtInstallDir.GetWindowText(pInstallDirBuf, nInstallDirLength);
    _bstr_t bstrInstallDir = pInstallDirBuf;
    delete [] pInstallDirBuf;

    HRESULT hr = 0;
    // Perform local vs. remote server install
    if (m_bRemoteInstall)
    {
      int nUIDLength = m_edtUID.GetWindowTextLength() + 1;
      char* pUIDBuf = new char[nUIDLength];
      m_edtUID.GetWindowText(pUIDBuf, nUIDLength);
      _bstr_t bstrUID = pUIDBuf;
      delete [] pUIDBuf;

      int nPWDLength = m_edtPWD.GetWindowTextLength() + 1;
      char* pPWDBuf = new char[nPWDLength];
      m_edtPWD.GetWindowText(pPWDBuf, nPWDLength);
      _bstr_t bstrPWD = pPWDBuf;
      delete [] pPWDBuf;

      int nRSNLength = m_edtRemoteServerName.GetWindowTextLength() + 1;
      char* pRSNBuf = new char[nRSNLength];
      m_edtRemoteServerName.GetWindowText(pRSNBuf, nRSNLength);
      _bstr_t bstrRSN = pRSNBuf;
      delete [] pRSNBuf;

      // Attempt a remote server install
      hr = m_pCatalog->InstallApplication(bstrAppFile,
                        bstrInstallDir,
                        lOptions,
                        bstrUID,
                        bstrPWD,
                        bstrRSN);
    }
    else
    {
      // Attempt a local install
      hr = m_pCatalog->InstallApplication(bstrAppFile,
                        bstrInstallDir,
                        lOptions,
                        NULL,
                        NULL,
                        NULL);
    }

    // Validate success/fail of attempted app install
    if FAILED(hr)
      MessageBox("Failed to install the specified application.\n\nPress OK to continue.",
            "Error",
            (MB_OK | MB_ICONERROR));
  }
  else
    MessageBox("Invalid Catalog reference.\n\nNo processing will be performed.\n\nPress OK to continue.",
          "Error",
          (MB_OK | MB_ICONERROR));

  // Release the Catalog reference
  ReleaseCatalog();

  CDialog::OnOK();
}

void CAppInstallDlg::OnOverwriteFiles ( ) [protected]

Definition at line 298 of file AppInstallDlg.Cpp.

{
  // Toggle the overwrite flag
  m_bOverwriteFiles = !m_bOverwriteFiles;
}

void CAppInstallDlg::OnRemoteServerInstall ( ) [protected]

Definition at line 320 of file AppInstallDlg.Cpp.

{
  // Toggle the variable used to manage the Remote Server Install group
  m_bRemoteInstall = !m_bRemoteInstall;

  // Toggle the UI to reflect the new state of the control group
  ToggleRemoteServerState(m_bRemoteInstall);
}

void CAppInstallDlg::ReleaseCatalog ( ) [private]

Definition at line 190 of file AppInstallDlg.Cpp.

{
  // Release the reference to the Catalog object if needed
  if (NULL != m_pCatalog)
    m_pCatalog->Release();
}

void CAppInstallDlg::set_Catalog ( ICOMAdminCatalog * pCatalog )

Definition at line 86 of file AppInstallDlg.Cpp.

{
  // Only can have one Catalog object reference... release all prior references before assignment
  ReleaseCatalog();

  // Assign the new Catalog reference
  m_pCatalog = pCatalog;
}

void CAppInstallDlg::ToggleRemoteServerState ( bool Flag ) [private]

Definition at line 304 of file AppInstallDlg.Cpp.

{
  // Clear the controls and toggle it's state
  m_edtRemoteServerName.SetSel(0, -1, false);
  m_edtRemoteServerName.Clear();
  m_edtRemoteServerName.EnableWindow(Flag);

  m_edtUID.SetSel(0, -1, false);
  m_edtUID.Clear();
  m_edtUID.EnableWindow(Flag);

  m_edtPWD.SetSel(0, -1, false);
  m_edtPWD.Clear();
  m_edtPWD.EnableWindow(Flag);
}

Member Data Documentation

bool CAppInstallDlg::m_bOverwriteFiles [private]

Definition at line 75 of file AppInstallDlg.h.

bool CAppInstallDlg::m_bRemoteInstall [private]

Definition at line 74 of file AppInstallDlg.h.

CEdit CAppInstallDlg::m_edtAppFile

Definition at line 44 of file AppInstallDlg.h.

CEdit CAppInstallDlg::m_edtInstallDir

Definition at line 43 of file AppInstallDlg.h.

CEdit CAppInstallDlg::m_edtPWD

Definition at line 41 of file AppInstallDlg.h.

CEdit CAppInstallDlg::m_edtRemoteServerName

Definition at line 42 of file AppInstallDlg.h.

CEdit CAppInstallDlg::m_edtUID

Definition at line 40 of file AppInstallDlg.h.

HICON CAppInstallDlg::m_hIcon [protected]

Definition at line 57 of file AppInstallDlg.h.

int CAppInstallDlg::m_nInstallType [private]

Definition at line 76 of file AppInstallDlg.h.

ICOMAdminCatalog* CAppInstallDlg::m_pCatalog [private]

Definition at line 78 of file AppInstallDlg.h.

The documentation for this class was generated from the following files:
  • Com/Administration/Explore.VC/AppInstallDlg.h
  • Com/Administration/Explore.VC/AppInstallDlg.Cpp
Generated on Wed Nov 13 2024 16:55:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CApplet Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CApplet Class Reference

#include "applet.h"

Inherits CRefCount.

List of all members.

Public Member Functions

CApplet (IApplet *pIApplet)
~CApplet (void)
ULONG STDMETHODCALLTYPE | AddRef (void)
HRESULT | Advise (void)
HRESULT STDMETHODCALLTYPE | AutoJoinSessionIndication (IAppletSession *pSession, HRESULT hrResult, AppletUserID uidMyself, AppletNodeID nidMyself, AppletSessionID sidMyself, AppletEntityID eidMyself, ULONG cDynamicChannels, AppletChannelID aDynamicChannels[])
HRESULT STDMETHODCALLTYPE | PermitToJoinSessionIndication (AppletConfID nConfID, BOOL fPermissionGranted)
HRESULT STDMETHODCALLTYPE | QueryInterface (REFIID riid, void **ppvObj)
ULONG STDMETHODCALLTYPE | Release (void)
HRESULT | UnAdvise (void)

Private Attributes

DWORD m_dwCookie
IApplet * m_pIApplet

Detailed Description

Definition at line 24 of file applet.h.

Constructor & Destructor Documentation

CApplet::CApplet ( IApplet * pIApplet )

Definition at line 129 of file applet.cpp.

:
    CRefCount(),
    m_pIApplet(pIApplet),
    m_dwCookie(0)
{
    ASSERT(NULL != m_pIApplet);
}

CApplet::~CApplet ( void )

Definition at line 145 of file applet.cpp.

{
    ASSERT(NULL != m_pIApplet);
    m_pIApplet->Release();
}

Member Function Documentation

ULONG STDMETHODCALLTYPE CApplet::AddRef ( void )

Reimplemented from CRefCount.

Definition at line 159 of file applet.cpp.

{
    return CRefCount::AddRef();
}

HRESULT CApplet::Advise ( void ) [inline]

Definition at line 50 of file applet.h.

{ return m_pIApplet->Advise((IAppletNotify *) this, &m_dwCookie); }

HRESULT STDMETHODCALLTYPE CApplet::AutoJoinSessionIndication | ( | IAppletSession * | pSession,
 |  | HRESULT | hrResult,
 |  | AppletUserID | uidMyself,
 |  | AppletNodeID | nidMyself,
 |  | AppletSessionID | sidMyself,
 |  | AppletEntityID | eidMyself,
 |  | ULONG | cDynamicChannels,
 |  | AppletChannelID | aDynamicChannels[]
 | ) |  |

Definition at line 302 of file applet.cpp.

{
    //
    // We do not register auto-join; therefore,
    // we will not receive this indication.
    //

    //
    // In case of using auto join, the code to handle this notification
    // should be very similar to that in CAppletSession::JoinSessionConfirm.
    //

    return S_OK;
}

HRESULT STDMETHODCALLTYPE CApplet::PermitToJoinSessionIndication | ( | AppletConfID | nConfID,
 |  | BOOL | fPermissionGranted
 | ) |  |

Definition at line 211 of file applet.cpp.

{
    HRESULT hr = NO_ERROR;

    if (fPermissionGranted)
    {
        //
        // A new conference just starts.
        //

        //
        // We only support one session per applet for now.
        //
        ASSERT(NULL == g_pSession);

    if(NULL != g_pSession)
    {
      return E_POINTER;
    }
        //
        // Create the IAppletSession interface.
        //
        IAppletSession *pISession = NULL;
        hr = m_pIApplet->CreateSession(&pISession, nConfID);
        if (S_OK == hr)
        {
            //
            // Create the Applet Session object, which is a wrapper of
            // the IAppletSession interface, and implements
            // the IAppletSessionNotify notification sink.
            //
            g_pSession = new CAppletSession(this, pISession);
            if (NULL != g_pSession)
            {
                //
                // Hook up the notification sink.
                //
                hr = g_pSession->Advise();
                ASSERT(S_OK == hr);

                //
                // Join the conference now.
                //
                hr = g_pSession->Join();
                ASSERT(S_OK == hr);
            }
        }
        else
        {
            ASSERT(S_OK == hr);
        }
    }
    else
    {
        //
        // The conference is exiting.
        //

        if (NULL != g_pSession)
        {
            //
            // Make sure this is the conference which I am in now.
            //
            ASSERT(nConfID == g_pSession->GetConfID());

            //
            // Leave the conference as directed.
            //
            hr = g_pSession->Leave();
            ASSERT(S_OK == hr);

            //
            // Unhook the notification sink.
            //
            hr = g_pSession->UnAdvise();
            ASSERT(S_OK == hr);

            g_pSession->Release();
            g_pSession = NULL;
        }
    }

    return S_OK;
}

HRESULT STDMETHODCALLTYPE CApplet::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppvObj
 | ) |  |

Definition at line 171 of file applet.cpp.

{
  if(NULL == ppvObject)
  {
    return E_POINTER;
  }

    HRESULT hr = NO_ERROR;

    if (riid == IID_IUnknown)
    {
        *ppvObject = (IUnknown *)this;
    }
    else if (riid == IID_IAppletNotify)
    {
        *ppvObject = (IAppletNotify *)this;
    }
    else
    {
        hr = E_NOINTERFACE;
        *ppvObject = NULL;
    }

    if (S_OK == hr)
    {
        AddRef();
    }

    return hr;
}

ULONG STDMETHODCALLTYPE CApplet::Release ( void )

Reimplemented from CRefCount.

Definition at line 165 of file applet.cpp.

{
    return CRefCount::Release();
}

HRESULT CApplet::UnAdvise ( void ) [inline]

Definition at line 51 of file applet.h.

{ return m_pIApplet->UnAdvise(m_dwCookie); }

Member Data Documentation

DWORD CApplet::m_dwCookie [private]

Definition at line 56 of file applet.h.

IApplet* CApplet::m_pIApplet [private]

Definition at line 55 of file applet.h.

The documentation for this class was generated from the following files:
  • Web/NetMeeting/NMChat2/applet.h
  • Web/NetMeeting/NMChat2/applet.cpp
Generated on Wed Nov 13 2024 16:55:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAppletSession Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CAppletSession Class Reference

#include "session.h"

Inherits CRefCount.

List of all members.

Public Member Functions

CAppletSession (CApplet *pApplet, IAppletSession *pISession)
~CAppletSession (void)
ULONG STDMETHODCALLTYPE | AddRef (void)
HRESULT | Advise (void)
HRESULT STDMETHODCALLTYPE | AllocateHandleConfirm (HRESULT hrResult, ULONG nFirstHandle, ULONG cHandles)
HRESULT STDMETHODCALLTYPE | ChannelConfirm (AppletChannelCommand eCommand, HRESULT hrResult, AppletChannelID nChannelID)
HRESULT STDMETHODCALLTYPE | ChannelIndication (AppletChannelCommand eCommand, AppletChannelID nChannelID, AppletReason eReason, AppletUserID uidManager)
AppletConfID | GetConfID (void)
HRESULT STDMETHODCALLTYPE | InquireRosterConfirm (HRESULT hrResult, ULONG cRosters, AppletRoster **apAppRosters)
HRESULT | InvokeApplet (void)
HRESULT STDMETHODCALLTYPE | InvokeAppletConfirm (AppletRequestTag nReqTag, HRESULT hrResult)
HRESULT | Join (void)
HRESULT STDMETHODCALLTYPE | JoinSessionConfirm (HRESULT hrResult, AppletUserID uidMyself, AppletNodeID nidMyself, AppletSessionID sidMyself, AppletEntityID eidMyself, ULONG cDynamicChannels, AppletChannelID aDynamicChannels[])
HRESULT | Leave (void)
HRESULT STDMETHODCALLTYPE | LeaveSessionIndication (AppletReason eReason, AppletUserID uidLeave)
HRESULT STDMETHODCALLTYPE | QueryInterface (REFIID riid, void **ppvObj)
HRESULT STDMETHODCALLTYPE | RegistryConfirm (AppletRegistryCommand eCommand, HRESULT hrResult, AppletRegistryKey *pRegistryKey, AppletRegistryItem *pRegistryItem, AppletRegistryEntryOwner *pEntryOwner, AppletModificationRights eRights)
ULONG STDMETHODCALLTYPE | Release (void)
void | RemoveMember (INmMember *)
HRESULT STDMETHODCALLTYPE | RosterReportIndication (ULONG cRosters, AppletRoster **apAppRosters)
HRESULT | SendData (AppletChannelID, ULONG cbBufSize, BYTE *pBuffer)
HRESULT STDMETHODCALLTYPE | SendDataIndication (BOOL fUniformSend, AppletUserID uidInitiator, AppletChannelID nChannelID, AppletPriority eDataPriority, AppletOctetString Data)
void | SetMember (INmMember *pIMember)
HRESULT STDMETHODCALLTYPE | TestTokenConfirm (AppletTokenID nTokenID, AppletTokenStatus eStatus)
HRESULT STDMETHODCALLTYPE | TokenConfirm (AppletTokenCommand eCommand, HRESULT hrResult, AppletTokenID nTokenID)
HRESULT STDMETHODCALLTYPE | TokenIndication (AppletTokenCommand eCommand, AppletReason eReason, AppletTokenID nTokenID, AppletUserID uidInitiator)
HRESULT | UnAdvise (void)

Private Member Functions

void | BuildJoinSessionStructure (void)
LPTSTR | GetMemberName (AppletUserID uid)
void | SetMember (AppletRecord *)

Private Attributes

CMember * | m_apMembers [MAX_MEMBERS]
ULONG m_cMembers
DWORD m_dwCookie
AppletRegistryKey m_DynChnlRegKey
AppletEntityID m_eidMyself
BOOL m_fTopProvider
AppletSessionRequest m_JoinSessionReq
AppletConfID m_nConfID
AppletChannelID m_nDynamicMulticastChannel
AppletNodeID m_nidMyself
CApplet * m_pApplet
IAppletSession * m_pISession
LPSTR m_pszMyName
AppletSessionID m_sidMyself
AppletUserID m_uidMyself

Detailed Description

Definition at line 25 of file session.h.

Constructor & Destructor Documentation

CAppletSession::CAppletSession | ( | CApplet * | pApplet,
 |  | IAppletSession * | pISession
 | ) |  |

Definition at line 58 of file session.cpp.

:
    CRefCount(),
    m_pApplet(pApplet),
    m_pISession(pISession),
    m_dwCookie(0),
    m_uidMyself(0),
    m_nidMyself(0),
    m_sidMyself(0),
    m_eidMyself(0),
    m_pszMyName(NULL),
    m_nDynamicMulticastChannel(0),
    m_cMembers(0)
{
//    if(NULL == pApplet || NULL == pISession || NULL == m_pISession)
//  {
//    return E_POINTER;
//  }

  ASSERT(NULL != m_pISession);

    m_pApplet->AddRef();

    //
    // Build the join session data structure, which contains object key and
    // capabilities if needed.
    //
    BuildJoinSessionStructure();

    //
    // Clean the array of members. To simplify the code, we use an array to
    // hold all members, and assume that the maximum number of members
    // is MAX_MEMBERS.
    //
    ::ZeroMemory(m_apMembers, sizeof(m_apMembers));

    //
    // Get the conference ID.
    //
    HRESULT hr = m_pISession->GetConfID(&m_nConfID);
    ASSERT(S_OK == hr);

    //
    // Query to see if the local node is a top provider or not.
    //
    hr = m_pISession->IsThisNodeTopProvider(&m_fTopProvider);
    ASSERT(S_OK == hr);

    //
    // Get the INmMember pointers from the conference object.
    // We got these INmMember pointers before this session object is created.
    //
    if (NULL != g_pConferenceNotify)
    {
        //
        // Get the total number of these early-arrival members.
        //
        ULONG cIMembers = g_pConferenceNotify->GetIMemberCount();

        //
        // Get the cached array.
        //
        INmMember **apIMembers = g_pConferenceNotify->GetIMemberArray();

        //
        // Iterate through the array and retrieve applet independent
        // node information.
        //
        for (ULONG i = 0; i < cIMembers; i++)
        {
            SetMember(apIMembers[i]);
        }

        //
        // After retrieving all the node information, we release these
        // INmMember pointers and clean the array.
        //
        g_pConferenceNotify->ReleaseIMemberArray();
    }
}

CAppletSession::~CAppletSession ( void )

Definition at line 146 of file session.cpp.

{
    delete m_pszMyName;

    ASSERT(NULL != m_pISession);
    m_pISession->Release();

    m_pApplet->Release();
}

Member Function Documentation

ULONG STDMETHODCALLTYPE CAppletSession::AddRef ( void )

Reimplemented from CRefCount.

Definition at line 164 of file session.cpp.

{
    return CRefCount::AddRef();
}

HRESULT CAppletSession::Advise ( void ) [inline]

Definition at line 113 of file session.h.

{ return m_pISession->Advise((IAppletSessionNotify *) this, &m_dwCookie); }

HRESULT STDMETHODCALLTYPE CAppletSession::AllocateHandleConfirm | ( | HRESULT | hrResult,
 |  | ULONG | nFirstHandle,
 |  | ULONG | cHandles
 | ) |  |

Definition at line 542 of file session.cpp.

{
    //
    // This is to handle the allocate-handle confirmation. In this sample code,
    // we do not issue RegistryRequest with APPLET_ALLOCATE_HANDLE;
    // therefore, we do not need to handle this notifcation.
    //

    return S_OK;
}

void CAppletSession::BuildJoinSessionStructure ( void ) [private]

Definition at line 707 of file session.cpp.

{
    //
    // Clean the structure.
    //
    ::ZeroMemory(&m_JoinSessionReq, sizeof(m_JoinSessionReq));

    //
    // We will use dynamic multicast channel which will be created during
    // IAppletSession::Join.
    //
    m_JoinSessionReq.nStartupChannelType = APPLET_DYNAMIC_MULTICAST_CHANNEL;

    //
    // Build the session key which consists of applet key and session ID.
    //
    ::BuildAppletKey();
    m_JoinSessionReq.SessionKey.AppletProtocolKey.eType =
                                        APPLET_H221_NONSTD_KEY;
    m_JoinSessionReq.SessionKey.AppletProtocolKey.ostrH221NonStdID.cbStrSize =
                                        sizeof(g_AppletKey);
    m_JoinSessionReq.SessionKey.AppletProtocolKey.ostrH221NonStdID.pbValue =
                                        g_AppletKey;
    m_JoinSessionReq.SessionKey.nSessionID = m_sidMyself;

    //
    // Build registry key for the dynamic multicast channel.
    //
    ::ZeroMemory(&m_DynChnlRegKey, sizeof(m_DynChnlRegKey));
    m_DynChnlRegKey.SessionKey = m_JoinSessionReq.SessionKey;
    m_DynChnlRegKey.ostrResourceID.cbStrSize =
                                sizeof(DYNAMIC_CHANNEL_RESOURCE_ID);
    m_DynChnlRegKey.ostrResourceID.pbValue =
                                (LPBYTE) DYNAMIC_CHANNEL_RESOURCE_ID;
    m_JoinSessionReq.aChannelRegistryKeys = &m_DynChnlRegKey;
    m_JoinSessionReq.cDynamicChannels = 1;

    //
    // Build the static channel array.
    //
    // In this sample code, we do not use static channels because this sample
    // applet is not a standard applet.
    //

    //
    // Build capabilities
    //
    // In this sample code, we do not use capabilities.
    //
}

HRESULT STDMETHODCALLTYPE CAppletSession::ChannelConfirm | ( | AppletChannelCommand | eCommand,
 |  | HRESULT | hrResult,
 |  | AppletChannelID | nChannelID
 | ) |  |

Definition at line 560 of file session.cpp.

{
    //
    // This is to handle the channel confirmation. In this sample code,
    // we do not issue ChannelRequest; therefore, we do not need to handle
    // this notifcation.
    //

    return S_OK;
}

HRESULT STDMETHODCALLTYPE CAppletSession::ChannelIndication | ( | AppletChannelCommand | eCommand,
 |  | AppletChannelID | nChannelID,
 |  | AppletReason | eReason,
 |  | AppletUserID | uidManager
 | ) |  |

Definition at line 578 of file session.cpp.

{
    //
    // This is to handle the channel indication. In this sample code,
    // we do not issue ChannelRequest; therefore, we do not need to handle
    // this notifcation.
    //

    return S_OK;
}

AppletConfID CAppletSession::GetConfID ( void ) [inline]

Definition at line 110 of file session.h.

{ return m_nConfID; }

LPTSTR CAppletSession::GetMemberName ( AppletUserID uid ) [private]

Definition at line 1071 of file session.cpp.

{
    CMember *pMember = NULL;
    for (ULONG i = 0; i < m_cMembers; i++)
    {
        pMember = m_apMembers[i];
        if (pMember->IsSameUID(uid))
        {
            return m_apMembers[i]->GetName();
        }
    }
    return NULL;
}

HRESULT STDMETHODCALLTYPE CAppletSession::InquireRosterConfirm | ( | HRESULT | hrResult,
 |  | ULONG | cRosters,
 |  | AppletRoster ** | apAppRosters
 | ) |  |

Definition at line 482 of file session.cpp.

{
    //
    // This is to handle the inquire roster confirmation. In this sample code,
    // we do not issue InquireRoster; therefore, we do not need to handle
    // this notifcation.
    //

    //
    // The code dealing with this notificaiton is very similar to that of
    // CAppletSession::RosterReportIndication.
    //

    return S_OK;
}

HRESULT CAppletSession::InvokeApplet ( void )

Definition at line 254 of file session.cpp.

{
    AppletRequestTag nTag = 0;

    //
    // Build the applet invoke information.
    //
    AppletProtocolEntity ape;
    ::ZeroMemory(&ape, sizeof(ape));
    ape.apExpectedCapabilities = m_JoinSessionReq.apCollapsedCaps;
    ape.cExpectedCapabilities = m_JoinSessionReq.cCollapsedCaps;
    ape.eStartupChannelType = APPLET_DYNAMIC_MULTICAST_CHANNEL;
    ape.fMustBeInvoked = TRUE;
    ape.SessionKey = m_JoinSessionReq.SessionKey;

    //
    // Invoke all. If we want to invoke a specific person, we need to
    // specify the count and the array of nodes. If invoking all, we can
    // simply put 0 and NULL.
    //
    HRESULT hr = m_pISession->InvokeApplet(&nTag, &ape, 0, NULL);
    ASSERT(S_OK == hr);

    return hr;
}

HRESULT STDMETHODCALLTYPE CAppletSession::InvokeAppletConfirm | ( | AppletRequestTag | nReqTag,
 |  | HRESULT | hrResult
 | ) |  |

Definition at line 505 of file session.cpp.

{
    //
    // Make sure the result is successful.
    //
    ASSERT(S_OK == hrResult);

    return S_OK;
}

HRESULT CAppletSession::Join ( void ) [inline]

Definition at line 111 of file session.h.

{ return m_pISession->Join(&m_JoinSessionReq); }

HRESULT STDMETHODCALLTYPE CAppletSession::JoinSessionConfirm | ( | HRESULT | hrResult,
 |  | AppletUserID | uidMyself,
 |  | AppletNodeID | nidMyself,
 |  | AppletSessionID | sidMyself,
 |  | AppletEntityID | eidMyself,
 |  | ULONG | cDynamicChannels,
 |  | AppletChannelID | aDynamicChannels[]
 | ) |  |

Definition at line 289 of file session.cpp.

{
    //
    // The response to the Join method.
    //
    if (S_OK == hrResult)
    {
        //
        // This applet is successfully join the conference. We should remember
        // applet specific information such as user ID, node ID, entity ID,
        // and session ID.
        //
        m_uidMyself = uidMyself;
        m_nidMyself = nidMyself;
        m_sidMyself = sidMyself;
        m_eidMyself = eidMyself;

        //
        // We also need to remember the broadcast channel.
        //
        ASSERT(1 == cDynamicChannels);
        m_nDynamicMulticastChannel = aDynamicChannels[0];

        //
        // Sanity check.
        //
        ASSERT(0 != m_uidMyself);
        ASSERT(0 != m_nidMyself);
        ASSERT(0 != m_nDynamicMulticastChannel);

        //
        // We are ready to send out text. Put in "everyone".
        //
        ::UiAddMember(NULL);
    }
    else
    {
        ASSERT(S_OK == hrResult);
    }

    return S_OK;
}

HRESULT CAppletSession::Leave ( void ) [inline]

Definition at line 112 of file session.h.

{ ::UiRemoveMember(NULL); return m_pISession->Leave(); }

HRESULT STDMETHODCALLTYPE CAppletSession::LeaveSessionIndication | ( | AppletReason | eReason,
 |  | AppletUserID | uidLeave
 | ) |  |

Definition at line 343 of file session.cpp.

{
    //
    // This notification indicates someone (identified by user ID uidLeave)
    // just left the conference. This "someone" can be a node or an applet.
    // In case of an applet, this applet can be of different kind or same kind.
    //
    if (uidLeave == m_uidMyself)
    {
        //
        // I am out of the conference now. So, remove "everyone".
        //
        ::UiRemoveMember(NULL);
    }
    return S_OK;
}

HRESULT STDMETHODCALLTYPE CAppletSession::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppvObj
 | ) |  |

Definition at line 177 of file session.cpp.

{
    if(NULL == ppvObject)
  {
    return E_POINTER;
  }

  HRESULT hr = NO_ERROR;

    if (riid == IID_IUnknown)
    {
        *ppvObject = (IUnknown *)this;
    }
    else if (riid == IID_IAppletSessionNotify)
    {
        *ppvObject = (IAppletSessionNotify *)this;
    }
    else
    {
        hr = E_NOINTERFACE;
        *ppvObject = NULL;
    }

    if (S_OK == hr)
    {
        AddRef();
    }

    return hr;
}

HRESULT STDMETHODCALLTYPE CAppletSession::RegistryConfirm | ( | AppletRegistryCommand | eCommand,
 |  | HRESULT | hrResult,
 |  | AppletRegistryKey * | pRegistryKey,
 |  | AppletRegistryItem * | pRegistryItem,
 |  | AppletRegistryEntryOwner * | pEntryOwner,
 |  | AppletModificationRights | eRights
 | ) |  |

Definition at line 521 of file session.cpp.

{
    //
    // This is to handle the registry confirmation. In this sample code,
    // we do not issue RegistryRequest; therefore, we do not need to handle
    // this notifcation.
    //

    return S_OK;
}

ULONG STDMETHODCALLTYPE CAppletSession::Release ( void )

Reimplemented from CRefCount.

Definition at line 171 of file session.cpp.

{
    return CRefCount::Release();
}

void CAppletSession::RemoveMember ( INmMember * pIMember )

Definition at line 952 of file session.cpp.

{
    if(NULL == pIMember)
  {
    return;
  }

  ULONG nMemberID = 0;
    HRESULT hr = pIMember->GetID(&nMemberID);
    ASSERT(S_OK == hr);

    AppletNodeID nid = (AppletNodeID) nMemberID;
    if (nid != m_nidMyself)
    {
        for (ULONG i = 0; i < m_cMembers; i++)
        {
            if (m_apMembers[i]->IsSameMemberID(nid))
            {
                delete m_apMembers[i];
                m_apMembers[i] = NULL;
                m_apMembers[i] = m_apMembers[--m_cMembers];
            }
        }
    }
}

HRESULT STDMETHODCALLTYPE CAppletSession::RosterReportIndication | ( | ULONG | cRosters,
 |  | AppletRoster ** | apAppRosters
 | ) |  |

Definition at line 384 of file session.cpp.

{
    if(NULL == apAppRosters)
  {
    return E_POINTER;
  }

  //
    // A roster contains information of each participating applet of the same
    // kind. The information includes applet IDs and capabilities. In this
    // sample code, we do not have capabilities. Therefore, we will only
    // retrieve applet IDs.
    //

    //
    // Clear out the InRoster flag of the member objects.
    //
    for (ULONG i = 0; i < m_cMembers; i++)
    {
        m_apMembers[i]->ClearInRosterFlag();
    }

    //
    // Iterate through the array of rosters.
    //
    for (ULONG iRoster = 0; iRoster < cRosters; iRoster++)
    {
        AppletRoster *pRoster = apAppRosters[iRoster];

        //
        // Make sure we are in the same session. An applet of the same kind can
        // participate multiple sessions.
        //
        if (pRoster->SessionKey.nSessionID == m_sidMyself)
        {
            //
            // Iterate through the array of applet records.
            //
            for (ULONG iRecord = 0; iRecord < pRoster->cRecords ; iRecord++)
            {
                AppletRecord *pRecord = pRoster->apAppletRecords[iRecord];

                //
                // We only need to keep track of those enrolled actively.
                //
                if (pRecord->fEnrolledActively)
                {
                    //
                    // Retrieve applet IDs.
                    //
                    SetMember(pRecord);
                }
            } // for iRecord
        } // if
    } // for iRoster

    //
    // Iterate through the member array and remove those not in the rosters.
    //
    i = 0;
    while (i < m_cMembers)
    {
        //
        // It is possible that the element is created due to the member
        // notification from the conference object. In this case,
        // the corresponding entry in the roster may not arrive yet.
        // This means that we should not remove this element.
        // Therefore, we only remove those with a valid user ID.
        //
        if (! m_apMembers[i]->IsInRoster() && ! m_apMembers[i]->IsEmptyUID())
        {
            //
            // This element has a valid user ID but does not appear in
            // this roster. This means that it must be gone already.
            //
            delete m_apMembers[i];
            m_apMembers[i] = NULL;

            //
            // Move the last element to this one just deleted.
            //
            m_apMembers[i] = m_apMembers[--m_cMembers];
        }
        else
        {
            i++;
        }
    }

    return S_OK;
}

HRESULT CAppletSession::SendData | ( | AppletChannelID | nChannelID,
 |  | ULONG | cbBufSize,
 |  | BYTE * | pBuffer
 | ) |  |

Definition at line 216 of file session.cpp.

{
    if(NULL == pBuffer)
  {
    return E_POINTER;
  }

  //
    // If the channel ID is zero, it means a broadcast. We then internally
    // change the channel ID to the broadcast channel.
    //
    if (0 == nChannelID)
    {
        nChannelID = m_nDynamicMulticastChannel;
    }

    //
    // Send the data now.
    //
    HRESULT hr = m_pISession->SendData(
                         FALSE,         // not uniform send
                         nChannelID,    // target channel ID
                         APPLET_MEDIUM_PRIORITY,
                         cbBufSize,
                         pBuffer);
    if (SUCCEEDED(hr))
    {
        ::UiDisplayMsg((LPTSTR) pBuffer, m_pszMyName);
    }

    return hr;
}

HRESULT STDMETHODCALLTYPE CAppletSession::SendDataIndication | ( | BOOL | fUniformSend,
 |  | AppletUserID | uidInitiator,
 |  | AppletChannelID | nChannelID,
 |  | AppletPriority | eDataPriority,
 |  | AppletOctetString | Data
 | ) |  |

Definition at line 366 of file session.cpp.

{
    //
    // I just received data from the person "uidInitiator".
    //
    ::UiDisplayMsg((LPTSTR) Data.pbValue, GetMemberName(uidInitiator));
    return S_OK;
}

void CAppletSession::SetMember ( INmMember * pIMember )

Definition at line 982 of file session.cpp.

{
    if(NULL == pIMember)
  {
    return;
  }

  ULONG nMemberID = 0;
    HRESULT hr = pIMember->GetID(&nMemberID);
    ASSERT(S_OK == hr);

    AppletNodeID nid = (AppletNodeID) nMemberID;
    if (nid != m_nidMyself)
    {
        CMember *pMember = NULL;
        for (ULONG i = 0; i < m_cMembers; i++)
        {
            pMember = m_apMembers[i];
            if (pMember->IsSameMemberID(nid))
            {
                if (pMember->IsEmptyMember())
                {
                    pMember->SetMember(pIMember);
                }
                return;
            }
        }

        // cound not find it, create a new entry
        ASSERT(m_cMembers < MAX_MEMBERS);
        pMember = new CMember(pIMember);
        if (NULL != pMember)
        {
            m_apMembers[m_cMembers++] = pMember;
        }
    }
}

void CAppletSession::SetMember ( AppletRecord * pRecord ) [private]

Definition at line 1024 of file session.cpp.

{
  if(NULL == pRecord)
  {
    return;
  }

    if (pRecord->nAppletUserID != m_uidMyself)
    {
        CMember *pMember = NULL;
        for (ULONG i = 0; i < m_cMembers; i++)
        {
            pMember = m_apMembers[i];
            if (pMember->IsSameUID(pRecord->nAppletUserID))
            {
                // this member is already in the list
                pMember->SetInRosterFlag();
                return;
            }

            if (pMember->IsSameMemberID(pRecord->nNodeID))
            {
                if (pMember->IsEmptyUID())
                {
                    pMember->SetMember(pRecord);
                    pMember->SetInRosterFlag();
                }
                return;
            }
        }

        // cound not find it, create a new entry
        ASSERT(m_cMembers < MAX_MEMBERS);
        pMember = new CMember(pRecord);
        if (NULL != pMember)
        {
            m_apMembers[m_cMembers++] = pMember;
            pMember->SetInRosterFlag();
            return;
        }
    }
}

HRESULT STDMETHODCALLTYPE CAppletSession::TestTokenConfirm | ( | AppletTokenID | nTokenID,
 |  | AppletTokenStatus | eStatus
 | ) |  |

Definition at line 615 of file session.cpp.

{
    //
    // This is to handle the test-token confirmation. In this sample code,
    // we do not issue TokenRequest with APPLET_TEST_TOKEN; therefore,
    // we do not need to handle this notifcation.
    //

    return S_OK;
}

HRESULT STDMETHODCALLTYPE CAppletSession::TokenConfirm | ( | AppletTokenCommand | eCommand,
 |  | HRESULT | hrResult,
 |  | AppletTokenID | nTokenID
 | ) |  |

Definition at line 597 of file session.cpp.

{
    //
    // This is to handle the token confirmation. In this sample code,
    // we do not issue TokenRequest; therefore, we do not need to handle
    // this notifcation.
    //

    return S_OK;
}

HRESULT STDMETHODCALLTYPE CAppletSession::TokenIndication | ( | AppletTokenCommand | eCommand,
 |  | AppletReason | eReason,
 |  | AppletTokenID | nTokenID,
 |  | AppletUserID | uidInitiator
 | ) |  |

Definition at line 632 of file session.cpp.

{
    //
    // This is to handle the token indication. In this sample code,
    // we do not issue TokenRequest; therefore, we do not need to handle
    // this notifcation.
    //

    return S_OK;
}

HRESULT CAppletSession::UnAdvise ( void ) [inline]

Definition at line 114 of file session.h.

{ return m_pISession->UnAdvise(m_dwCookie); }

Member Data Documentation

CMember* CAppletSession::m_apMembers[MAX_MEMBERS] [private]

Definition at line 143 of file session.h.

ULONG CAppletSession::m_cMembers [private]

Definition at line 142 of file session.h.

DWORD CAppletSession::m_dwCookie [private]

Definition at line 132 of file session.h.

AppletRegistryKey CAppletSession::m_DynChnlRegKey [private]

Definition at line 147 of file session.h.

AppletEntityID CAppletSession::m_eidMyself [private]

Definition at line 137 of file session.h.

BOOL CAppletSession::m_fTopProvider [private]

Definition at line 140 of file session.h.

AppletSessionRequest CAppletSession::m_JoinSessionReq [private]

Definition at line 146 of file session.h.

AppletConfID CAppletSession::m_nConfID [private]

Definition at line 133 of file session.h.

AppletChannelID CAppletSession::m_nDynamicMulticastChannel [private]

Definition at line 139 of file session.h.

AppletNodeID CAppletSession::m_nidMyself [private]

Definition at line 135 of file session.h.

CApplet* CAppletSession::m_pApplet [private]

Definition at line 130 of file session.h.

IAppletSession* CAppletSession::m_pISession [private]

Definition at line 131 of file session.h.

LPSTR CAppletSession::m_pszMyName [private]

Definition at line 138 of file session.h.

AppletSessionID CAppletSession::m_sidMyself [private]

Definition at line 136 of file session.h.

AppletUserID CAppletSession::m_uidMyself [private]

Definition at line 134 of file session.h.

The documentation for this class was generated from the following files:
  • Web/NetMeeting/NMChat2/session.h
  • Web/NetMeeting/NMChat2/session.cpp
Generated on Wed Nov 13 2024 16:55:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAppLite Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Static Public Attributes

CAppLite Class Reference

#include "cdialoglite.h"

Inherited by CWinApp.

List of all members.

Public Member Functions

CAppLite (UINT nAppID)
virtual | ~CAppLite ()
BOOL | AppInitialize (HINSTANCE hInstance, HINSTANCE hPrevInstance, CHAR *pszCmdLine, INT nCmdShow)
virtual int | ExitInstance ()
virtual BOOL | InitInstance ()
virtual int | Run ()

Public Attributes

HINSTANCE | m_hInstance
HINSTANCE | m_hPrevInstance
UINT m_nAppID
INT | m_nCmdShow
CHAR * | m_pszCmdLine

Static Public Attributes

static HWND | m_hWndModeless = NULL
static CFrameWndLite * | m_pCMainWindow = NULL

Detailed Description

Definition at line 83 of file cdialoglite.h.

Constructor & Destructor Documentation

CAppLite::CAppLite ( UINT nAppID )

Definition at line 74 of file cdialoglite.cpp.

{
  m_nAppID = nAppID;

  //Need to setup global CAppLite
  SetAppLite(this);
}

CAppLite::~CAppLite ( ) [virtual]

Definition at line 87 of file cdialoglite.cpp.

{
  SetAppLite(NULL);
}

Member Function Documentation

BOOL CAppLite::AppInitialize | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | CHAR * | pszCmdLine,
 |  | INT | nCmdShow
 | ) |  |

Definition at line 97 of file cdialoglite.cpp.

{
  m_hInstance   = hInstance;
  m_hPrevInstance = hPrevInstance;
  m_pszCmdLine  = pszCmdLine;
  m_nCmdShow    = nCmdShow;

  return TRUE;
}

int CAppLite::ExitInstance ( void ) [virtual]

Reimplemented in CWinApp, CSCPCMenuApp, CMyUIExtApp, CSCPWizApp, CMyUIExtApp, CMyWizExtApp, CADsFirstExtApp, CADsFirstExtApp, CGenericUCPApp, CHMMSampleApp, CCmdLineConsumerApp, CPermEventsApp, CClipBookServerApp, and CFileShareSampleApp.

Definition at line 160 of file cdialoglite.cpp.

{
  return TRUE;
}

BOOL CAppLite::InitInstance ( void ) [virtual]

Reimplemented in CVCExploreApp, CClientApp, CADVCGENApp, CWinApp, CMultichanApp, CSCPCMenuApp, CMyUIExtApp, CSCPWizApp, CMyUIExtApp, CMyWizExtApp, CADsFirstExtApp, CADsFirstExtApp, CADQIApp, CPrintSDIApp, CDisdrawApp, CImp_DrawApp, CTestApp, CDisdrawApp, CRTCIncomingApp, CRTCOutgoingApp, CGenericUCPApp, CHMMSampleApp, CCmdLineConsumerApp, CPermEventsApp, CWbemClientApp, CCapMFCApp, CXMLTreeApp, CClipBookServerApp, CFileShareSampleApp, and CAPIApp.

Definition at line 112 of file cdialoglite.cpp.

{
  return TRUE;
}

int CAppLite::Run ( ) [virtual]

Definition at line 122 of file cdialoglite.cpp.

{
  MSG   msg;

  //load accelerators
  HACCEL  hAccel = LoadAccelerators(m_hInstance, MAKEINTRESOURCE(m_nAppID));

  // acquire and dispatch messages until a WM_QUIT message is received
  while(GetMessage(&msg, NULL, 0, 0))
  {
    //Modeless dialog boxes...
    if(m_hWndModeless && IsWindow(m_hWndModeless) && IsDialogMessage(m_hWndModeless, &msg))
      continue;

    //Main Window Translation?
    if(m_pCMainWindow)
    {
      if(m_pCMainWindow->PreTranslateMessage(&msg))
        continue;
    }

    //Check for App accelerators
    if(hAccel && TranslateAccelerator(m_pCMainWindow->m_hWnd, hAccel, &msg))
      continue;

        // if the message does not need special processing, dispatch it
    TranslateMessage(&msg);
    DispatchMessage(&msg);
  }

  return TRUE;
}

Member Data Documentation

HINSTANCE CAppLite::m_hInstance

Definition at line 96 of file cdialoglite.h.

HINSTANCE CAppLite::m_hPrevInstance

Definition at line 97 of file cdialoglite.h.

HWND CAppLite::m_hWndModeless = NULL [static]

Definition at line 103 of file cdialoglite.h.

UINT CAppLite::m_nAppID

Definition at line 101 of file cdialoglite.h.

INT CAppLite::m_nCmdShow

Definition at line 99 of file cdialoglite.h.

CFrameWndLite * CAppLite::m_pCMainWindow = NULL [static]

Definition at line 104 of file cdialoglite.h.

CHAR* CAppLite::m_pszCmdLine

Definition at line 98 of file cdialoglite.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialoglite.h
  • Dataaccess/oledb/rowsetviewer/cdialoglite.cpp
Generated on Wed Nov 13 2024 16:55:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAppShareNotify Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CAppShareNotify Class Reference

#include "cShare.h"

Inherits RefCount, CNotify, RefCount, and CNotify.

List of all members.

Public Member Functions

CAppShareNotify ()
CAppShareNotify ()
~CAppShareNotify ()
~CAppShareNotify ()
ULONG STDMETHODCALLTYPE | AddRef (void)
ULONG STDMETHODCALLTYPE | AddRef (void)
HRESULT STDMETHODCALLTYPE | Connect (IUnknown *pUnk)
HRESULT STDMETHODCALLTYPE | Connect (IUnknown *pUnk)
HRESULT STDMETHODCALLTYPE | Disconnect (void)
HRESULT STDMETHODCALLTYPE | Disconnect (void)
HRESULT STDMETHODCALLTYPE | MemberChanged (NM_MEMBER_NOTIFY uNotify, INmMember *pMember)
HRESULT STDMETHODCALLTYPE | MemberChanged (NM_MEMBER_NOTIFY uNotify, INmMember *pMember)
HRESULT STDMETHODCALLTYPE | NmUI (CONFN uNotify)
HRESULT STDMETHODCALLTYPE | NmUI (CONFN uNotify)
HRESULT STDMETHODCALLTYPE | QueryInterface (REFIID riid, PVOID *ppvObj)
HRESULT STDMETHODCALLTYPE | QueryInterface (REFIID riid, PVOID *ppvObj)
ULONG STDMETHODCALLTYPE | Release (void)
ULONG STDMETHODCALLTYPE | Release (void)
HRESULT STDMETHODCALLTYPE | StateChanged (NM_SHAPP_STATE uNotify, INmSharableApp *pApp)
HRESULT STDMETHODCALLTYPE | StateChanged (NM_SHAPP_STATE uState, INmSharableApp *pApp)

Detailed Description

Definition at line 21 of file cShare.h.

Constructor & Destructor Documentation

CAppShareNotify::CAppShareNotify ( )

Definition at line 139 of file cShare.Cpp.

                                 : RefCount(), CNotify()
{
}

CAppShareNotify::~CAppShareNotify ( )

Definition at line 143 of file cShare.Cpp.

{
}

CAppShareNotify::CAppShareNotify ( )
CAppShareNotify::~CAppShareNotify ( )

Member Function Documentation

ULONG STDMETHODCALLTYPE CAppShareNotify::AddRef ( void )

Definition at line 154 of file cShare.Cpp.

{
  return RefCount::AddRef();
}

ULONG STDMETHODCALLTYPE CAppShareNotify::AddRef ( void )
HRESULT STDMETHODCALLTYPE CAppShareNotify::Connect ( IUnknown * pUnk )
HRESULT STDMETHODCALLTYPE CAppShareNotify::Connect ( IUnknown * pUnk )

Definition at line 203 of file cShare.Cpp.

{
  return CNotify::Connect(pUnk, IID_INmChannelAppShareNotify, (IUnknown *)this);
}

HRESULT STDMETHODCALLTYPE CAppShareNotify::Disconnect ( void )

Reimplemented from CNotify.

Definition at line 208 of file cShare.Cpp.

{
  return CNotify::Disconnect();
}

HRESULT STDMETHODCALLTYPE CAppShareNotify::Disconnect ( void )

Reimplemented from CNotify.

HRESULT STDMETHODCALLTYPE CAppShareNotify::MemberChanged | ( | NM_MEMBER_NOTIFY | uNotify,
 |  | INmMember * | pMember
 | ) |  |

Definition at line 249 of file cShare.Cpp.

{
  PUSER pUser = PUserFromINmMember(pMember);
  if (NULL != pUser)
  {
//    UpdateUserChannel(pUser, (INmChannel *) (CNotify::GetPunk()), uNotify);
#ifdef DEBUG
    TCHAR szMsg[MAX_PATH + 1];
    ZeroMemory(szMsg,(MAX_PATH + 1) * sizeof(TCHAR));
    _sntprintf(szMsg,MAX_PATH,TEXT("%s changed sharing status"), pUser->pszName);

    //TCHAR szMsg[MAX_PATH];
    //wsprintf(szMsg, TEXT("%s changed sharing status"), pUser->pszName);
    DisplayMsg(szMsg);
#endif

    if (S_OK == pMember->IsSelf())
    {
      NM_SHARE_STATE uState;
      if (SUCCEEDED(pMember->GetShareState(&uState)))
      {
        SetMenuCheck(IDM_WORK_ALONE,  (NM_SHARE_WORKING_ALONE == uState));
        SetMenuCheck(IDM_COLLABORATE, (NM_SHARE_COLLABORATING == uState)
          || (NM_SHARE_IN_CONTROL == uState));
        SetMenuCheck(IDM_IN_CONTROL,  (NM_SHARE_IN_CONTROL == uState));

#ifdef DEBUG
        switch (uState)
        {
          case NM_SHARE_WORKING_ALONE: DisplayMsg(TEXT("Working Alone"));       break;
          case NM_SHARE_COLLABORATING: DisplayMsg(TEXT("Collaborating"));       break;
          case NM_SHARE_IN_CONTROL:    DisplayMsg(TEXT("In Control"));          break;
          default:                     DisplayMsg(TEXT("Uknown Share State?")); break;
        }
#endif
      }
    }
    else
    {
#ifdef DEBUG
      NM_SHARE_STATE uState;
      if (SUCCEEDED(pMember->GetShareState(&uState)))
      {
        LPTSTR pszState = TEXT("?");
        switch (uState)
        {
          case NM_SHARE_WORKING_ALONE: pszState = TEXT("Working Alone");       break;
          case NM_SHARE_COLLABORATING: pszState = TEXT("Collaborating");       break;
          case NM_SHARE_IN_CONTROL:    pszState = TEXT("In Control");          break;
          default:                     pszState = TEXT("Uknown Share State?"); break;
        }

        BSTR  bstrName;
        if (SUCCEEDED(pMember->GetName(&bstrName)))
        {
          TCHAR sz[MAX_PATH + 1];
          ZeroMemory(sz,(MAX_PATH + 1) * sizeof(TCHAR));
          _sntprintf(sz,MAX_PATH,TEXT("%s is %s"), (LPTSTR) BTSTR(bstrName), pszState);

          //TCHAR sz[MAX_PATH];
          //wsprintf(sz, "%s is %s", (LPTSTR) BTSTR(bstrName), pszState);
          DisplayMsg(sz);
          SysFreeString(bstrName);
        }
      }
#endif
    }
  }

  return S_OK;
}

HRESULT STDMETHODCALLTYPE CAppShareNotify::MemberChanged | ( | NM_MEMBER_NOTIFY | uNotify,
 |  | INmMember * | pMember
 | ) |  |
HRESULT STDMETHODCALLTYPE CAppShareNotify::NmUI ( CONFN uNotify )

Definition at line 220 of file cShare.Cpp.

{
  LPTSTR psz;

  switch (uNotify)
  {
    case CONFN_CLICK_CONTROL:
      psz = TEXT("Click: requesting control");
      break;
    case CONFN_CLICK_OBSCURE:
      psz = TEXT("Click: obscured area");
      break;
    case CONFN_CLICK_REMOTE_NOT_COLLABORATING:
      psz = TEXT("Click: Remote not collaborating");
      break;
    case CONFN_CLICK_LOCAL_NOT_COLLABORATING:
      psz = TEXT("Click: Local not collaborating");
      break;
    default:
      psz = TEXT("Unknown confn");
      break;
  }

  DisplayMsg(psz);

  return S_OK;
}

HRESULT STDMETHODCALLTYPE CAppShareNotify::NmUI ( CONFN uNotify )
HRESULT STDMETHODCALLTYPE CAppShareNotify::QueryInterface | ( | REFIID | riid,
 |  | PVOID * | ppvObj
 | ) |  |

Definition at line 165 of file cShare.Cpp.

{
  if (NULL == ppvObject)
  {
    return E_POINTER;
  }

  HRESULT hr = S_OK;

  if (riid == IID_IUnknown)
  {
    *ppvObject = (IUnknown *)this;
  }
  else if (riid == IID_INmChannelAppShareNotify)
  {
    *ppvObject = (INmChannelAppShareNotify *)this;
  }
  else
  {
    hr = E_NOINTERFACE;
    *ppvObject = NULL;
  }

  if (S_OK == hr)
  {
    AddRef();
  }

  return hr;
}

HRESULT STDMETHODCALLTYPE CAppShareNotify::QueryInterface | ( | REFIID | riid,
 |  | PVOID * | ppvObj
 | ) |  |
ULONG STDMETHODCALLTYPE CAppShareNotify::Release ( void )

Definition at line 160 of file cShare.Cpp.

{
  return RefCount::Release();
}

ULONG STDMETHODCALLTYPE CAppShareNotify::Release ( void )
HRESULT STDMETHODCALLTYPE CAppShareNotify::StateChanged | ( | NM_SHAPP_STATE | uNotify,
 |  | INmSharableApp * | pApp
 | ) |  |

Definition at line 322 of file cShare.Cpp.

{
  TCHAR szMsg[MAX_PATH + 1];
  ZeroMemory(szMsg,(MAX_PATH + 1) * sizeof(TCHAR));
  _sntprintf(szMsg,MAX_PATH,TEXT("%08X %s"), pApp,
    (NM_SHAPP_SHARED == uState) ? TEXT("Shared") : TEXT("not shared"));

  DisplayMsg(szMsg);
  UpdateApp(pApp);
  return S_OK;
}

HRESULT STDMETHODCALLTYPE CAppShareNotify::StateChanged | ( | NM_SHAPP_STATE | uState,
 |  | INmSharableApp * | pApp
 | ) |  |
The documentation for this class was generated from the following files:
  • Web/NetMeeting/NMShare/cShare.h
  • Web/NetMeeting/NMUI/cshare.h
  • Web/NetMeeting/NMShare/cShare.Cpp
  • Web/NetMeeting/NMUI/cshare.cpp
Generated on Wed Nov 13 2024 16:55:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAppSub Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CAppSub Class Reference

#include "appsub.h"

Inherits CSysLCESub.

List of all members.

Public Member Functions

CAppSub ()
CAppSub (CComSpy *pSpy)
STDMETHODIMP | GetEventClass (LPGUID guid)
STDMETHODIMP | GetEventType (EventEnum *e)
STDMETHODIMP | GetInterface (IID *iid)
STDMETHODIMP | OnAppActivation (COMSVCSEVENTINFO *pInfo, GUID guidApp)
STDMETHODIMP | OnAppForceShutdown (COMSVCSEVENTINFO *pInfo, GUID guidApp)
STDMETHODIMP | OnAppShutdown (COMSVCSEVENTINFO *pInfo, GUID guidApp)

Detailed Description

Definition at line 31 of file appsub.h.

Constructor & Destructor Documentation

CAppSub::CAppSub ( ) [inline]

Definition at line 36 of file appsub.h.

  {
    m_pSpy = NULL;
  }

CAppSub::CAppSub ( CComSpy * pSpy ) [inline]

Definition at line 40 of file appsub.h.

  {
    m_pSpy = pSpy;
  }

Member Function Documentation

STDMETHODIMP CAppSub::GetEventClass ( LPGUID guid ) [inline, virtual]

Implements CSysLCESub.

Definition at line 54 of file appsub.h.

{*guid = CLSID_ComServiceEvents;return S_OK;}

STDMETHODIMP CAppSub::GetEventType ( EventEnum * e ) [inline, virtual]

Implements CSysLCESub.

Definition at line 53 of file appsub.h.

{*e = Application;return S_OK;}

STDMETHODIMP CAppSub::GetInterface ( IID * iid ) [inline, virtual]

Implements CSysLCESub.

Definition at line 55 of file appsub.h.

{*iid = IID_IComAppEvents;return S_OK;}

STDMETHODIMP CAppSub::OnAppActivation | ( | COMSVCSEVENTINFO * | pInfo,
 |  | GUID | guidApp |
 | ) |  |  | [inline]

Definition at line 58 of file appsub.h.

  {
    if (m_pSpy)
    {
      CComBSTR sGuidApp = GuidToBstr(guidApp);
      m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnAppActivation"), sGuidApp);
      m_pSpy -> AddParamValueToList(L"guidApp", sGuidApp);

      IF_AUDIT_DO(OnAppActivation)(pInfo->perfCount, sGuidApp);
    }
    return S_OK;
  }

STDMETHODIMP CAppSub::OnAppForceShutdown | ( | COMSVCSEVENTINFO * | pInfo,
 |  | GUID | guidApp |
 | ) |  |  | [inline]

Definition at line 84 of file appsub.h.

  {
    if (m_pSpy)
    {
      CComBSTR sGuidApp = GuidToBstr(guidApp);
      m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnAppForceShutdown"), sGuidApp);
      m_pSpy -> AddParamValueToList(L"guidApp", sGuidApp);
//      IF_AUDIT_DO(OnAppShutdown)(pInfo->perfCount, sGuidApp);
    }

  return S_OK;
  }

STDMETHODIMP CAppSub::OnAppShutdown | ( | COMSVCSEVENTINFO * | pInfo,
 |  | GUID | guidApp |
 | ) |  |  | [inline]

Definition at line 71 of file appsub.h.

  {
    if (m_pSpy)
    {
      CComBSTR sGuidApp = GuidToBstr(guidApp);
      m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnAppShutdown"), sGuidApp);
      m_pSpy -> AddParamValueToList(L"guidApp", sGuidApp);
      IF_AUDIT_DO(OnAppShutdown)(pInfo->perfCount, sGuidApp);
    }

    return S_OK;
  }

The documentation for this class was generated from the following file:
  • Com/Administration/Spy/ComSpyCtl/appsub.h
Generated on Wed Nov 13 2024 16:55:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAppUtilDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes

CAppUtilDlg Class Reference

#include "AppUtilDlg.h"

List of all members.

Public Types

enum | { IDD = IDD_APP_UTILITY }

Public Member Functions

CAppUtilDlg (CWnd *pParent=NULL)
void | set_Catalog (ICOMAdminCatalog *pCatalog)
void | set_UtilityType (int UtilityType)

Public Attributes

CEdit | m_edtApp

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
afx_msg void | OnAppSearch ()
afx_msg void | OnClose ()
virtual BOOL | OnInitDialog ()
virtual void | OnOK ()

Protected Attributes

HICON | m_hIcon

Private Member Functions

void | ReleaseCatalog ()

Private Attributes

int | m_nUtilityType
ICOMAdminCatalog * | m_pCatalog

Detailed Description

Definition at line 37 of file AppUtilDlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 47 of file AppUtilDlg.h.

{ IDD = IDD_APP_UTILITY };

Constructor & Destructor Documentation

CAppUtilDlg::CAppUtilDlg ( CWnd * pParent = NULL )

Definition at line 34 of file AppUtilDlg.Cpp.

  : CDialog(CAppUtilDlg::IDD, pParent)
{
  //{{AFX_DATA_INIT(CAppUtilDlg)
    // NOTE: the ClassWizard will add member initialization here
  //}}AFX_DATA_INIT

  // Initialize the members
  m_pCatalog = NULL;
  m_nUtilityType = UTILITY_TYPE_UNDEFINED;
}

Member Function Documentation

void CAppUtilDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 47 of file AppUtilDlg.Cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CAppUtilDlg)
  DDX_Control(pDX, IDC_EDIT_APPLICATION_ID_VALUE, m_edtApp);
  //}}AFX_DATA_MAP
}

void CAppUtilDlg::OnAppSearch ( ) [protected]

Definition at line 168 of file AppUtilDlg.Cpp.

{
  OPENFILENAME ofn;
  char pFilePath[256];
  char pFileTitle[256];

  // Setup of OPENFILENAME structure
  ofn.lStructSize = sizeof(OPENFILENAME);
    ofn.hwndOwner = m_hWnd;
    ofn.hInstance = NULL;
    ofn.lpstrFilter = "All Files (*.*)\0*.*\0\0";
    ofn.lpstrCustomFilter = (LPSTR) NULL;
    ofn.nMaxCustFilter = 0;
    ofn.nFilterIndex = 1;
    pFilePath[0] = '\0';
    ofn.lpstrFile = pFilePath;
    ofn.nMaxFile = sizeof(pFilePath);
    ofn.lpstrFileTitle = pFileTitle;
    ofn.nMaxFileTitle = sizeof(pFileTitle);
    ofn.lpstrInitialDir = NULL;
  if (UTILITY_TYPE_START_APP == m_nUtilityType)
    ofn.lpstrTitle = "Select Application to start";
  else
    ofn.lpstrTitle = "Select Application to stop";
    ofn.Flags = (OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST);
    ofn.lpstrDefExt = "DLL";
    ofn.nFileOffset = 0;
    ofn.nFileExtension = 0;
    ofn.lCustData = 0;

  // Invoke the file open common dialog
  GetOpenFileName(&ofn);

  // Update the value in the control
  m_edtApp.SetWindowText(ofn.lpstrFile);
}

void CAppUtilDlg::OnClose ( ) [protected]

Definition at line 74 of file AppUtilDlg.Cpp.

{
  // Release the reference to the Catalog object if needed
  ReleaseCatalog();

  CDialog::OnClose();
}

BOOL CAppUtilDlg::OnInitDialog ( ) [protected, virtual]

Definition at line 89 of file AppUtilDlg.Cpp.

{
  CDialog::OnInitDialog();

  // Set the dialogs caption and load the appropriate icon resource
  switch (m_nUtilityType)
  {
    case UTILITY_TYPE_START_APP:
      SetWindowText("Start Application");
      m_hIcon = AfxGetApp()->LoadIcon(IDI_START);
      break;
    case UTILITY_TYPE_STOP_APP:
      SetWindowText("Stop Application");
      m_hIcon = AfxGetApp()->LoadIcon(IDI_STOP);
      break;
  }

  // Set the dialog's icon resource
  SetIcon(m_hIcon, true);   // 32x32 icon
  SetIcon(m_hIcon, false);  // 16x16 icon

  return TRUE;  // return TRUE unless you set the focus to a control
                // EXCEPTION: OCX Property Pages should return FALSE
}

void CAppUtilDlg::OnOK ( ) [protected, virtual]

Definition at line 121 of file AppUtilDlg.Cpp.

{
  // Continue only if we have a valid Catalog pointer
  if (NULL != m_pCatalog)
  {
    HRESULT hr = 0;

    // Retrieve the text from the edit control
    int nTextLength = m_edtApp.GetWindowTextLength() + 1;
    char* pBuf = new char[nTextLength];
    m_edtApp.GetWindowText(pBuf, nTextLength);
    _bstr_t bstrApp = pBuf;
    delete [] pBuf;

    // Execute specified action
    switch (m_nUtilityType)
    {
    case UTILITY_TYPE_START_APP:
      hr = m_pCatalog->StartApplication(bstrApp);
      break;
    case UTILITY_TYPE_STOP_APP:
      hr = m_pCatalog->ShutdownApplication(bstrApp);
      break;
    default:
      MessageBox("Invalid utility type specified.\n\nNo processing will be performed.\n\nPress OK to continue.",
            "Error",
            (MB_OK | MB_ICONERROR));
      break;
    }

    // Validate success/fail of the method call
    if FAILED(hr)
      MessageBox("Failed to perform the requested action.\n\nPress OK to continue.",
            "Error",
            (MB_OK | MB_ICONERROR));
  }
  else
    MessageBox("Invalid Catalog reference.\n\nNo processing will be performed.\n\nPress OK to continue.",
          "Error",
          (MB_OK | MB_ICONERROR));

  // Release the Catalog reference
  ReleaseCatalog();

  CDialog::OnOK();
}

void CAppUtilDlg::ReleaseCatalog ( ) [private]

Definition at line 114 of file AppUtilDlg.Cpp.

{
  // Release the reference to the Catalog object if needed
  if (NULL != m_pCatalog)
    m_pCatalog->Release();
}

void CAppUtilDlg::set_Catalog ( ICOMAdminCatalog * pCatalog )

Definition at line 66 of file AppUtilDlg.Cpp.

{
  // Only can have one Catalog object reference... release all prior references before assignment
  ReleaseCatalog();

  m_pCatalog = pCatalog;
}

void CAppUtilDlg::set_UtilityType ( int UtilityType )

Definition at line 82 of file AppUtilDlg.Cpp.

{
  // Continue only for valid requests
  if ((UtilityType == UTILITY_TYPE_START_APP) || (UtilityType == UTILITY_TYPE_STOP_APP))
    m_nUtilityType = UtilityType;
}

Member Data Documentation

CEdit CAppUtilDlg::m_edtApp

Definition at line 48 of file AppUtilDlg.h.

HICON CAppUtilDlg::m_hIcon [protected]

Definition at line 61 of file AppUtilDlg.h.

int CAppUtilDlg::m_nUtilityType [private]

Definition at line 73 of file AppUtilDlg.h.

ICOMAdminCatalog* CAppUtilDlg::m_pCatalog [private]

Definition at line 74 of file AppUtilDlg.h.

The documentation for this class was generated from the following files:
  • Com/Administration/Explore.VC/AppUtilDlg.h
  • Com/Administration/Explore.VC/AppUtilDlg.Cpp
Generated on Wed Nov 13 2024 16:55:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: cascadeec::CascadeEC Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • cascadeec
  • cascadeec::CascadeEC
Public Member Functions

cascadeec::CascadeEC Class Reference

.register(clsid=8CE4A9E0-0FC1-11D3-925A-0080C7C30D72, typelib=7508F170-0FC1-11D3-925A-0080C7C30D72, version="1.0", description="Cascade Class")

Inherits com::ms::com::IUnknown, and cascadeec::INewsEventDefault.

List of all members.

Public Member Functions

void | LongQuote (String Symbol, double BidPrice, double AskPrice, String LastTradeTime, double LastTradePrice, double NetChange, double DailyHigh, double DailyLow, int AskSize, int BidSize, double OpenPrice, double ClosePrice, String CloseDate)
void | NewsFlash (double dtTimeStamp, String Symbol, String Headline, String URL)
void | ShortQuote (String Symbol, double BidPrice, double AskPrice, double LastTradeTime, double LastTradePrice, double NetChange, double DailyHigh, double DailyLow)

Detailed Description

Definition at line 19 of file CascadeEC.java.

Member Function Documentation

void cascadeec::CascadeEC::LongQuote | ( | String | Symbol,
 |  | double | BidPrice,
 |  | double | AskPrice,
 |  | String | LastTradeTime,
 |  | double | LastTradePrice,
 |  | double | NetChange,
 |  | double | DailyHigh,
 |  | double | DailyLow,
 |  | int | AskSize,
 |  | int | BidSize,
 |  | double | OpenPrice,
 |  | double | ClosePrice,
 |  | String | CloseDate |
 | ) |  |  | [inline]

Implements cascadeec::INewsEventDefault.

Definition at line 29 of file CascadeEC.java.

  {
  }

void cascadeec::CascadeEC::NewsFlash | ( | double | dtTimeStamp,
 |  | String | Symbol,
 |  | String | Headline,
 |  | String | URL |
 | ) |  |  | [inline]

Implements cascadeec::INewsEventDefault.

Definition at line 21 of file CascadeEC.java.

  {
  }

void cascadeec::CascadeEC::ShortQuote | ( | String | Symbol,
 |  | double | BidPrice,
 |  | double | AskPrice,
 |  | double | LastTradeTime,
 |  | double | LastTradePrice,
 |  | double | NetChange,
 |  | double | DailyHigh,
 |  | double | DailyLow |
 | ) |  |  | [inline]

Implements cascadeec::INewsEventDefault.

Definition at line 25 of file CascadeEC.java.

  {
  }

The documentation for this class was generated from the following file:
  • Com/Services/Events/EventNewsJAVA/CascadeEvent/Cascadeec/CascadeEC.java
Generated on Wed Nov 13 2024 16:58:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: cascadeec::INewsEvent Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • cascadeec
  • cascadeec::INewsEvent
Public Member Functions | Static Public Attributes

cascadeec::INewsEvent Interface Reference

.interface(iid=4BF5E480-A5D3-11D2-AD4D-0080C7BFF6DB, thread=AUTO, type=DUAL)

Inherits com::ms::com::IUnknown.

Inherited by cascadeec::INewsEventDefault.

List of all members.

Public Member Functions

void | LongQuote (String Symbol, double BidPrice, double AskPrice, String LastTradeTime, double LastTradePrice, double NetChange, double DailyHigh, double DailyLow, int AskSize, int BidSize, double OpenPrice, double ClosePrice, String CloseDate)
void | NewsFlash (double dtTimeStamp, String Symbol, String Headline, String URL)
void | ShortQuote (String Symbol, double BidPrice, double AskPrice, double LastTradeTime, double LastTradePrice, double NetChange, double DailyHigh, double DailyLow)

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x4bf5e480, (short)0xa5d3, (short)0x11d2, (byte)0xad, (byte)0x4d, (byte)0x0, (byte)0x80, (byte)0xc7, (byte)0xbf, (byte)0xf6, (byte)0xdb)

Detailed Description

Definition at line 20 of file INewsEvent.java.

Member Function Documentation

void cascadeec::INewsEvent::LongQuote | ( | String | Symbol,
 |  | double | BidPrice,
 |  | double | AskPrice,
 |  | String | LastTradeTime,
 |  | double | LastTradePrice,
 |  | double | NetChange,
 |  | double | DailyHigh,
 |  | double | DailyLow,
 |  | int | AskSize,
 |  | int | BidSize,
 |  | double | OpenPrice,
 |  | double | ClosePrice,
 |  | String | CloseDate
 | ) |  |

.method(vtoffset=6, dispid=3, type=METHOD, name="LongQuote", addFlagsVtable=4) .parameters([in,type=STRING] Symbol, [in,type=R8] BidPrice, [in,type=R8] AskPrice, [in,type=STRING] LastTradeTime, [in,type=R8] LastTradePrice, [in,type=R8] NetChange, [in,type=R8] DailyHigh, [in,type=R8] DailyLow, [in,type=I4] AskSize, [in,type=I4] BidSize, [in,type=R8] OpenPrice, [in,type=R8] ClosePrice, [in,type=STRING] CloseDate)

Implemented in cascadeec::CascadeEC, and cascadeec::INewsEventDefault.

void cascadeec::INewsEvent::NewsFlash | ( | double | dtTimeStamp,
 |  | String | Symbol,
 |  | String | Headline,
 |  | String | URL
 | ) |  |

.method(vtoffset=4, dispid=1, type=METHOD, name="NewsFlash", addFlagsVtable=4) .parameters([in,type=DATE] dtTimeStamp, [in,type=STRING] Symbol, [in,type=STRING] Headline, [in,type=STRING] URL)

Implemented in cascadeec::CascadeEC, and cascadeec::INewsEventDefault.

void cascadeec::INewsEvent::ShortQuote | ( | String | Symbol,
 |  | double | BidPrice,
 |  | double | AskPrice,
 |  | double | LastTradeTime,
 |  | double | LastTradePrice,
 |  | double | NetChange,
 |  | double | DailyHigh,
 |  | double | DailyLow
 | ) |  |

.method(vtoffset=5, dispid=2, type=METHOD, name="ShortQuote", addFlagsVtable=4) .parameters([in,type=STRING] Symbol, [in,type=R8] BidPrice, [in,type=R8] AskPrice, [in,type=DATE] LastTradeTime, [in,type=R8] LastTradePrice, [in,type=R8] NetChange, [in,type=R8] DailyHigh, [in,type=R8] DailyLow)

Implemented in cascadeec::CascadeEC, and cascadeec::INewsEventDefault.

Member Data Documentation

final com.ms.com._Guid cascadeec::INewsEvent::iid = new com.ms.com._Guid((int)0x4bf5e480, (short)0xa5d3, (short)0x11d2, (byte)0xad, (byte)0x4d, (byte)0x0, (byte)0x80, (byte)0xc7, (byte)0xbf, (byte)0xf6, (byte)0xdb) [static]

Implemented in cascadeec::INewsEventDefault.

Definition at line 35 of file INewsEvent.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Events/EventNewsJAVA/CascadeEvent/Cascadeec/INewsEvent.java
Generated on Wed Nov 13 2024 16:58:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: cascadeec::INewsEventDefault Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • cascadeec
  • cascadeec::INewsEventDefault
Public Member Functions | Static Public Attributes

cascadeec::INewsEventDefault Interface Reference

.interface(iid=00020400-0000-0000-C000-000000000046, thread=AUTO, type=DUAL)

Inherits cascadeec::INewsEvent.

Inherited by cascadeec::CascadeEC.

List of all members.

Public Member Functions

void | LongQuote (String Symbol, double BidPrice, double AskPrice, String LastTradeTime, double LastTradePrice, double NetChange, double DailyHigh, double DailyLow, int AskSize, int BidSize, double OpenPrice, double ClosePrice, String CloseDate)
void | NewsFlash (double dtTimeStamp, String Symbol, String Headline, String URL)
void | ShortQuote (String Symbol, double BidPrice, double AskPrice, double LastTradeTime, double LastTradePrice, double NetChange, double DailyHigh, double DailyLow)

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x20400, (short)0x0, (short)0x0, (byte)0xc0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x46)

Detailed Description

Definition at line 20 of file INewsEventDefault.java.

Member Function Documentation

void cascadeec::INewsEventDefault::LongQuote | ( | String | Symbol,
 |  | double | BidPrice,
 |  | double | AskPrice,
 |  | String | LastTradeTime,
 |  | double | LastTradePrice,
 |  | double | NetChange,
 |  | double | DailyHigh,
 |  | double | DailyLow,
 |  | int | AskSize,
 |  | int | BidSize,
 |  | double | OpenPrice,
 |  | double | ClosePrice,
 |  | String | CloseDate
 | ) |  |

.method(vtoffset=6, dispid=3, type=METHOD, name="LongQuote", addFlagsVtable=4) .parameters([in,type=STRING] Symbol, [in,type=R8] BidPrice, [in,type=R8] AskPrice, [in,type=STRING] LastTradeTime, [in,type=R8] LastTradePrice, [in,type=R8] NetChange, [in,type=R8] DailyHigh, [in,type=R8] DailyLow, [in,type=I4] AskSize, [in,type=I4] BidSize, [in,type=R8] OpenPrice, [in,type=R8] ClosePrice, [in,type=STRING] CloseDate)

Implements cascadeec::INewsEvent.

Implemented in cascadeec::CascadeEC.

void cascadeec::INewsEventDefault::NewsFlash | ( | double | dtTimeStamp,
 |  | String | Symbol,
 |  | String | Headline,
 |  | String | URL
 | ) |  |

.method(vtoffset=4, dispid=1, type=METHOD, name="NewsFlash", addFlagsVtable=4) .parameters([in,type=DATE] dtTimeStamp, [in,type=STRING] Symbol, [in,type=STRING] Headline, [in,type=STRING] URL)

Implements cascadeec::INewsEvent.

Implemented in cascadeec::CascadeEC.

void cascadeec::INewsEventDefault::ShortQuote | ( | String | Symbol,
 |  | double | BidPrice,
 |  | double | AskPrice,
 |  | double | LastTradeTime,
 |  | double | LastTradePrice,
 |  | double | NetChange,
 |  | double | DailyHigh,
 |  | double | DailyLow
 | ) |  |

.method(vtoffset=5, dispid=2, type=METHOD, name="ShortQuote", addFlagsVtable=4) .parameters([in,type=STRING] Symbol, [in,type=R8] BidPrice, [in,type=R8] AskPrice, [in,type=DATE] LastTradeTime, [in,type=R8] LastTradePrice, [in,type=R8] NetChange, [in,type=R8] DailyHigh, [in,type=R8] DailyLow)

Implements cascadeec::INewsEvent.

Implemented in cascadeec::CascadeEC.

Member Data Documentation

final com.ms.com._Guid cascadeec::INewsEventDefault::iid = new com.ms.com._Guid((int)0x20400, (short)0x0, (short)0x0, (byte)0xc0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x46) [static]

Implements cascadeec::INewsEvent.

Definition at line 35 of file INewsEventDefault.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Events/EventNewsJAVA/CascadeEvent/Cascadeec/INewsEventDefault.java
Generated on Wed Nov 13 2024 16:58:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAssoc< KEY, VALUE > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CAssoc< KEY, VALUE > Class Template Reference

#include "list.h"

List of all members.

Public Member Functions

CAssoc ()
virtual | ~CAssoc ()

Public Attributes

KEY | m_key
VALUE | m_value

Detailed Description

template<class KEY, class VALUE>
class CAssoc< KEY, VALUE >

Definition at line 540 of file list.h.

Constructor & Destructor Documentation

template<class KEY , class VALUE >
CAssoc< KEY, VALUE >::CAssoc ( )

Definition at line 557 of file list.h.

{
    //Constructor
//    m_key        = key;
//    m_value        = value;      // element data

    //NOTE:  The constructor doesn't have an element passed in for
    //data.  This is so we don't have a copy of the parameter and then
    //need to copy it for assignment...
}

template<class KEY , class VALUE >
CAssoc< KEY, VALUE >::~CAssoc ( ) [virtual]

Definition at line 572 of file list.h.

{
}

Member Data Documentation

template<class KEY, class VALUE>
KEY CAssoc< KEY, VALUE >::m_key

Definition at line 548 of file list.h.

template<class KEY, class VALUE>
VALUE CAssoc< KEY, VALUE >::m_value

Definition at line 549 of file list.h.

The documentation for this class was generated from the following file:
  • Dataaccess/oledb/rowsetviewer/list.h
Generated on Wed Nov 13 2024 16:55:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAsyncFullServ Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Private Attributes

CAsyncFullServ Class Reference

#include "fullserv.h"

List of all members.

Public Member Functions

CAsyncFullServ ()
STDMETHOD() | Begin_Sum (int i, int j)
STDMETHOD() | doSum ()
STDMETHOD() | Finish_Sum (int *sum)
void | Init (IFullServ *pIFullServ)

Public Attributes

CComPtr< IUnknown > | m_pAggISync

Private Attributes

BOOL m_callInProgress
HRESULT | m_hr
int | m_i
int | m_j
CComPtr< IFullServ > | m_pIFullServ
int | m_sum

Detailed Description

Definition at line 82 of file fullserv.h.

Constructor & Destructor Documentation

CAsyncFullServ::CAsyncFullServ ( ) [inline]

Definition at line 87 of file fullserv.h.

                  {
    m_callInProgress = FALSE;
  }

Member Function Documentation

STDMETHODIMP CAsyncFullServ::Begin_Sum | ( | int | i,
 |  | int | j
 | ) |  |

Definition at line 138 of file fullserv.Cpp.

                                                  {

  HRESULT hr = S_OK;
  ISynchronize * pISynchronize;
  m_hr = S_OK;

  if(m_callInProgress) return RPC_S_CALLPENDING;

  m_callInProgress = TRUE;

  // Get and store ptr to ISynchronize
  hr = ((AsyncIFullServ *)this)->QueryInterface(IID_ISynchronize,
                   (void**)&pISynchronize);
  _ASSERT(SUCCEEDED(hr));

  pISynchronize->Reset();

  //store [in] params
  m_i = i;
  m_j = j;

  //Queue CAsyncFullServ for processing by a worker thread
  if(!QueueUserWorkItem(WorkerFcn, this, WT_EXECUTEDEFAULT)){
    m_hr = E_FAIL;
    pISynchronize->Signal();
  }

  pISynchronize->Release();
  return S_OK;
}//RPC thread is returned to the RPC thread pool

STDMETHODIMP CAsyncFullServ::doSum ( )

Definition at line 211 of file fullserv.Cpp.

                                  {

  HRESULT hr;
  ISynchronize * pISynchronize;
  ICancelMethodCalls * pICancelMethodCalls = NULL;

  //Get ISynchronize
  hr = ((AsyncIFullServ *)this)->QueryInterface(IID_ISynchronize,
                   (void**)&pISynchronize);
  _ASSERT(SUCCEEDED(hr));

  //Attempt to get pointer to ICancelMethod Calls
  hr = ((AsyncIFullServ *)this)->QueryInterface(IID_ICancelMethodCalls,
                                                      (void**)&pICancelMethodCalls);

  //Check for call cancellation
  if(SUCCEEDED(hr)){
    hr = pICancelMethodCalls->TestCancel();
    if(hr == RPC_E_CALL_CANCELED){
      m_hr = hr; //record call cancellation for Finish
      pICancelMethodCalls->Release();
      pISynchronize->Signal();
      pISynchronize->Release();
      return S_OK;
    }
  }

  //do the work of the function
  m_sum = m_i + m_j;

    // Work complete, signal the stub so that the Finish_Sum method is called.
  pISynchronize->Signal();
  pISynchronize->Release();
  if(pICancelMethodCalls) pICancelMethodCalls->Release();
  return S_OK;
}

STDMETHODIMP CAsyncFullServ::Finish_Sum ( int * sum )

Definition at line 258 of file fullserv.Cpp.

                                                {
  HRESULT hr;
  ISynchronize * pISynchronize;
  if(!m_callInProgress)
    return RPC_E_CALL_COMPLETE;
  m_callInProgress = FALSE;

  //Get ISynchronize
  hr = ((AsyncIFullServ *)this)->QueryInterface(IID_ISynchronize,
                   (void**)&pISynchronize);
  _ASSERT(SUCCEEDED(hr));

  pISynchronize->Wait(COWAIT_WAITALL,INFINITE);

  pISynchronize->Release();

  //Check if call was canceled or if Begin failed
  if(FAILED(m_hr)){
    return m_hr; //Call failed or was canceled. m_sum is garbage
  }

  *sum = m_sum;
  return m_hr; //call was successful
}

void CAsyncFullServ::Init ( IFullServ * pIFullServ ) [inline]

Definition at line 91 of file fullserv.h.

                                   {
    m_pIFullServ = pIFullServ;//calls addref
  }

Member Data Documentation

BOOL CAsyncFullServ::m_callInProgress [private]

Definition at line 97 of file fullserv.h.

HRESULT CAsyncFullServ::m_hr [private]

Definition at line 99 of file fullserv.h.

int CAsyncFullServ::m_i [private]

Definition at line 98 of file fullserv.h.

int CAsyncFullServ::m_j [private]

Definition at line 98 of file fullserv.h.

CComPtr<IUnknown> CAsyncFullServ::m_pAggISync

Definition at line 111 of file fullserv.h.

CComPtr<IFullServ> CAsyncFullServ::m_pIFullServ [private]

Definition at line 96 of file fullserv.h.

int CAsyncFullServ::m_sum [private]

Definition at line 98 of file fullserv.h.

The documentation for this class was generated from the following files:
  • Com/Fundamentals/AsyncCalls/FullSvr/fullserv.h
  • Com/Fundamentals/AsyncCalls/FullSvr/fullserv.Cpp
Generated on Wed Nov 13 2024 16:55:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAsynchBase Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CAsynchBase Class Reference

#include "cbase.h"

Inherits CContainerBase.

Inherited by CDataAccess, CPropertiesBase, CSession, and CStream.

List of all members.

Public Member Functions

CAsynchBase (SOURCE eObjectType, CMainWindow *pCMainWindow, CMDIChild *pCMDIChild=NULL)
virtual | ~CAsynchBase ()
virtual HRESULT | Abort (HCHAPTER hChapter, DBASYNCHOP eOperation)
virtual HRESULT | AutoQI (DWORD dwCreateOpts)
virtual HRESULT | AutoRelease ()
virtual IUnknown ** | GetInterfaceAddress (REFIID riid)
virtual HRESULT | GetStatus (HCHAPTER hChapter, DBASYNCHOP eOperation, DBCOUNTITEM *pulProgress, DBCOUNTITEM *pulProgressMax, DBASYNCHPHASE *peAsynchPhase, LPOLESTR *ppwszStatusText)
virtual HRESULT | Initialize ()
virtual BOOL | IsInitialized ()
virtual HRESULT | Uninitialize ()

Public Attributes

DWORD m_dwCookieAsynchNotify
BOOL m_fInitialized
IDBAsynchStatus * | m_pIDBAsynchStatus
IDBInitialize * | m_pIDBInitialize

Detailed Description

Definition at line 303 of file cbase.h.

Constructor & Destructor Documentation

CAsynchBase::CAsynchBase | ( | SOURCE | eObjectType,
 |  | CMainWindow * | pCMainWindow,
 |  | CMDIChild * | pCMDIChild = NULL
 | ) |  |

Definition at line 961 of file cbase.cpp.

  : CContainerBase(eObjectType, pCMainWindow, pCMDIChild)
{
  //eBaseClass
  m_eBaseClass = BASE_CLASS(m_eBaseClass | eCAsynchBase);

  //OLE DB Interfaces
  m_pIDBInitialize      = NULL;   //OLE DB interface
  m_pIDBAsynchStatus      = NULL;   //OLE DB interface

  //Extra interfaces
  m_dwCookieAsynchNotify    = 0;

  //Data
  m_fInitialized        = FALSE;
}

CAsynchBase::~CAsynchBase ( ) [virtual]

Definition at line 983 of file cbase.cpp.

{
}

Member Function Documentation

HRESULT CAsynchBase::Abort | ( | HCHAPTER | hChapter,
 |  | DBASYNCHOP | eOperation |
 | ) |  |  | [virtual]

Definition at line 1117 of file cbase.cpp.

{
  HRESULT hr = S_OK;

  if(!m_pIDBAsynchStatus)
    goto CLEANUP;

  //IDBAsynchStatus::Abort
  XTEST(hr = m_pIDBAsynchStatus->Abort(hChapter, eOperation));
  TRACE_METHOD(hr, L"IDBAsynchStatus::Abort(0x%p, %s)", hChapter, GetAsynchReason(eOperation));

CLEANUP:
  return hr;
}

HRESULT CAsynchBase::AutoQI ( DWORD dwCreateOpts ) [virtual]

Reimplemented from CContainerBase.

Reimplemented in CPropertiesBase, CCommand, CDataset, CDataSource, CEnumerator, CRow, CDataAccess, CRowset, CSession, and CStream.

Definition at line 1029 of file cbase.cpp.

{
  //Delegate First so we have base interfaces
  CContainerBase::AutoQI(dwCreateOpts);

  //[MANDATORY]
  if(dwCreateOpts & CREATE_QI_MANDATORY)
  {
  }

  //AutoQI
  if(dwCreateOpts & CREATE_QI_OPTIONAL)
  {
    //[OPTIONAL]
    OBTAIN_INTERFACE(IDBInitialize);
    OBTAIN_INTERFACE(IDBAsynchStatus);
  }

  //Listeners
  AdviseListener(IID_IDBAsynchNotify, &m_dwCookieAsynchNotify);
  return S_OK;
}

HRESULT CAsynchBase::AutoRelease ( ) [virtual]

Reimplemented from CContainerBase.

Reimplemented in CPropertiesBase, CCommand, CDataset, CDataSource, CEnumerator, CRow, CDataAccess, CRowset, CSession, and CStream.

Definition at line 1006 of file cbase.cpp.

{
  //UnadviseListeners
  UnadviseListener(IID_IDBAsynchNotify, &m_dwCookieAsynchNotify);

  //OLE DB interfaces
  RELEASE_INTERFACE(IDBInitialize);
  RELEASE_INTERFACE(IDBAsynchStatus);

  //Extra interfaces

  //Data
  m_fInitialized = FALSE;

  //Delegate
  return CContainerBase::AutoRelease();
}

IUnknown ** CAsynchBase::GetInterfaceAddress ( REFIID riid ) [virtual]

Reimplemented from CContainerBase.

Reimplemented in CPropertiesBase, CCommand, CDataset, CDataSource, CEnumerator, CRow, CDataAccess, CRowset, CSession, and CStream.

Definition at line 992 of file cbase.cpp.

{
  HANDLE_GETINTERFACE(IDBInitialize);
  HANDLE_GETINTERFACE(IDBAsynchStatus);

  //Otherwise delegate
  return CContainerBase::GetInterfaceAddress(riid);
}

HRESULT CAsynchBase::GetStatus | ( | HCHAPTER | hChapter,
 |  | DBASYNCHOP | eOperation,
 |  | DBCOUNTITEM * | pulProgress,
 |  | DBCOUNTITEM * | pulProgressMax,
 |  | DBASYNCHPHASE * | peAsynchPhase,
 |  | LPOLESTR * | ppwszStatusText |
 | ) |  |  | [virtual]

Definition at line 1137 of file cbase.cpp.

{
  HRESULT hr = S_OK;

  if(!m_pIDBAsynchStatus)
    goto CLEANUP;

  //IDBAsynchStatus::GetStatus
  XTEST(hr = m_pIDBAsynchStatus->GetStatus(hChapter, eOperation, pulProgress, pulProgressMax, peAsynchPhase, ppwszStatusText));
  TRACE_METHOD(hr, L"IDBAsynchStatus::GetStatus(0x%p, %s, &%lu, &%lu, &%s, &\"%s\")", hChapter, GetAsynchReason(eOperation), pulProgress ? *pulProgress : 0, pulProgressMax ? *pulProgressMax : 0, GetAsynchPhase(peAsynchPhase ? *peAsynchPhase : 0), ppwszStatusText ? *ppwszStatusText : NULL);

CLEANUP:
  return hr;
}

HRESULT CAsynchBase::Initialize ( ) [virtual]

Definition at line 1057 of file cbase.cpp.

{
  HRESULT hr = S_OK;
  DWORD dwCreateOpts = GetOptions()->m_dwCreateOpts;

  if(!m_pIDBInitialize)
    goto CLEANUP;

  //Initailize
  //NOTE: Expect S_OK or DB_E_CANCELED, since canceling the dialog always returns DB_E_CANCELED
  XTEST_(hr = m_pIDBInitialize->Initialize(), DB_E_CANCELED);
  TRACE_METHOD(hr, L"IDBInitialize::Initialize()");

  //Display any property errors...
  TESTC(hr = DisplayPropErrors(hr, IID_IDBProperties, m_pIDBInitialize));

  //We are now Initialized
  m_fInitialized = TRUE;

  //Obtain all interfaces, now that we are initialized
  TESTC(hr = AutoQI(dwCreateOpts));

  //Also "redraw" the object now that more interfaces are available for use
  //For Example: If the rowset was originally obtained Asynchronously and now interfaces
  //to obtain columns and data are available, display the object...
  TESTC(hr = DisplayObject());

CLEANUP:
  return hr;
}

virtual BOOL CAsynchBase::IsInitialized ( ) [inline, virtual]

Definition at line 316 of file cbase.h.

{ return m_fInitialized;      }

HRESULT CAsynchBase::Uninitialize ( ) [virtual]

Definition at line 1093 of file cbase.cpp.

{
  HRESULT hr = S_OK;

  if(!m_pIDBInitialize)
    goto CLEANUP;

  //Uninitailize
  XTEST(hr = m_pIDBInitialize->Uninitialize());
  TESTC(TRACE_METHOD(hr, L"IDBInitialize::Uninitialize()"));

  //We are now Uninitialized
  m_fInitialized = FALSE;

CLEANUP:
  return hr;
}

Member Data Documentation

DWORD CAsynchBase::m_dwCookieAsynchNotify

Definition at line 334 of file cbase.h.

BOOL CAsynchBase::m_fInitialized

Definition at line 335 of file cbase.h.

IDBAsynchStatus* CAsynchBase::m_pIDBAsynchStatus

Definition at line 328 of file cbase.h.

IDBInitialize* CAsynchBase::m_pIDBInitialize

Reimplemented in CDataSource, and CDataSource.

Definition at line 327 of file cbase.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cbase.h
  • Dataaccess/oledb/rowsetviewer/cbase.cpp
Generated on Wed Nov 13 2024 16:55:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAsynchNotify Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CAsynchNotify Class Reference

List of all members.

Public Member Functions

CAsynchNotify ()
~CAsynchNotify ()
BOOL | IsValid () const
STDMETHOD() | OnLowResource (DB_DWRESERVE dwReserved)
STDMETHOD() | OnProgress (HCHAPTER hChap, DBASYNCHOP ulOp, DBCOUNTITEM ulProg, DBCOUNTITEM ulProgMax, DBASYNCHPHASE ulStat, LPOLESTR pwszStatus)
STDMETHOD() | OnStop (HCHAPTER hChap, ULONG ulOp, HRESULT hrStat, LPOLESTR pwszStatus)
STDMETHOD() | QueryInterface (REFIID riid, LPVOID *ppiuk)
STDMETHOD_ (ULONG, Release)()
STDMETHOD_ (ULONG, AddRef)()
void | Wait ()

Private Attributes

LONG | _cLowResource
LONG | _cRef
HANDLE _hEvent

Detailed Description

Definition at line 723 of file AdvQuery.Cxx.

Constructor & Destructor Documentation

CAsynchNotify::CAsynchNotify ( ) [inline]

Definition at line 726 of file AdvQuery.Cxx.

                    :
        _cRef( 1 ),
        _cLowResource( 0 ),
        _hEvent( 0 )
    {
        _hEvent = CreateEventW( 0, TRUE, FALSE, 0 );
    }

CAsynchNotify::~CAsynchNotify ( ) [inline]

Definition at line 734 of file AdvQuery.Cxx.

    {
        if ( 0 != _hEvent )
            CloseHandle( _hEvent );
    }

Member Function Documentation

BOOL CAsynchNotify::IsValid ( ) const [inline]

Definition at line 740 of file AdvQuery.Cxx.

{ return 0 != _hEvent; }

STDMETHOD() CAsynchNotify::OnLowResource ( DB_DWRESERVE dwReserved ) [inline]

Definition at line 761 of file AdvQuery.Cxx.

    {
        _cLowResource++;

        // If we've failed a few times due to low resource, give up
        // on the query since there may not be sufficient resources
        // to ever get an OnStop call.

        if ( _cLowResource >= 5 )
            SetEvent( _hEvent );

        return S_OK;
    }

STDMETHOD() CAsynchNotify::OnProgress | ( | HCHAPTER | hChap,
 |  | DBASYNCHOP | ulOp,
 |  | DBCOUNTITEM | ulProg,
 |  | DBCOUNTITEM | ulProgMax,
 |  | DBASYNCHPHASE | ulStat,
 |  | LPOLESTR | pwszStatus |
 | ) |  |  | [inline]

Definition at line 775 of file AdvQuery.Cxx.

    {
        return S_OK;
    }

STDMETHOD() CAsynchNotify::OnStop | ( | HCHAPTER | hChap,
 |  | ULONG | ulOp,
 |  | HRESULT | hrStat,
 |  | LPOLESTR | pwszStatus |
 | ) |  |  | [inline]

Definition at line 782 of file AdvQuery.Cxx.

    {
        // If the query is complete (successfully or not), set the event

        if ( DBASYNCHOP_OPEN == ulOp )
            SetEvent( _hEvent );

        return S_OK;
    }

STDMETHOD() CAsynchNotify::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppiuk |
 | ) |  |  | [inline]

Definition at line 746 of file AdvQuery.Cxx.

    {
        *ppiuk = (void **) this; // hold our breath and jump
        AddRef();
        return S_OK;
    }

CAsynchNotify::STDMETHOD_ | ( | ULONG | ,
 |  | Release |  |
 | ) |  |  | [inline]

Definition at line 755 of file AdvQuery.Cxx.

{ return InterlockedDecrement( &_cRef ); }

CAsynchNotify::STDMETHOD_ | ( | ULONG | ,
 |  | AddRef |  |
 | ) |  |  | [inline]

Definition at line 753 of file AdvQuery.Cxx.

{ return InterlockedIncrement( &_cRef ); }

void CAsynchNotify::Wait ( ) [inline]

Definition at line 793 of file AdvQuery.Cxx.

    {
        WaitForSingleObject( _hEvent, INFINITE );
    }

Member Data Documentation

LONG CAsynchNotify::_cLowResource [private]

Definition at line 800 of file AdvQuery.Cxx.

LONG CAsynchNotify::_cRef [private]

Definition at line 799 of file AdvQuery.Cxx.

HANDLE CAsynchNotify::_hEvent [private]

Definition at line 801 of file AdvQuery.Cxx.

The documentation for this class was generated from the following file:
  • WinBase/Indexing/AdvQuery/AdvQuery.Cxx
Generated on Wed Nov 13 2024 16:55:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAsyncQuerySink Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Private Attributes

CAsyncQuerySink Class Reference

#include "OnAsync.h"

List of all members.

Public Member Functions

CAsyncQuerySink (CListBox *output)
~CAsyncQuerySink ()
STDMETHOD() | GetIDsOfNames (REFIID riid, OLECHAR **rgszNames, UINT cNames, LCID lcid, DISPID *rgdispid)
STDMETHOD() | GetTypeInfo (UINT itinfo, LCID lcid, ITypeInfo **pptinfo)
STDMETHOD() | GetTypeInfoCount (UINT *pctinfo)
STDMETHOD() | Invoke (DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pdispparams, VARIANT *pvarResult, EXCEPINFO *pexcepinfo, UINT *puArgErr)
STDMETHODIMP | QueryInterface (REFIID, LPVOID *)
STDMETHOD_ (SCODE, SetStatus)(long lFlags
STDMETHOD_ (SCODE, Indicate)(long lObjectCount
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) AddRef(void)

Public Attributes

HRESULT | hResult
IWbemClassObject ** | pObjArray
HRESULT BSTR IWbemClassObject * | pObjParam
HRESULT BSTR | strParam

Private Attributes

long | m_lRef
CListBox * | m_pOutputList
BOOL m_SetStatusCalled

Detailed Description

Definition at line 19 of file OnAsync.h.

Constructor & Destructor Documentation

CAsyncQuerySink::CAsyncQuerySink ( CListBox * output )

Definition at line 117 of file onasync.cpp.

{
  m_pOutputList = output;
  m_SetStatusCalled = FALSE;
}

CAsyncQuerySink::~CAsyncQuerySink ( )

Definition at line 123 of file onasync.cpp.

{
  if(!m_SetStatusCalled)
  {
    // NOTE: This happening is indicative of a comm error
    // between the server and this client such as a security
    // violation. CoInitializeSecurity() needs to be called to
    // avoid the security problem.
    TRACE(_T("released before SetStatus() was called\n"));
  }
}

Member Function Documentation

STDMETHOD() CAsyncQuerySink::GetIDsOfNames | ( | REFIID | riid,
 |  | OLECHAR ** | rgszNames,
 |  | UINT | cNames,
 |  | LCID | lcid,
 |  | DISPID * | rgdispid |
 | ) |  |  | [inline]

Definition at line 43 of file OnAsync.h.

    {return E_NOTIMPL;}

STDMETHOD() CAsyncQuerySink::GetTypeInfo | ( | UINT | itinfo,
 |  | LCID | lcid,
 |  | ITypeInfo ** | pptinfo |
 | ) |  |  | [inline]

Definition at line 41 of file OnAsync.h.

    {return E_NOTIMPL;}

STDMETHOD() CAsyncQuerySink::GetTypeInfoCount ( UINT * pctinfo ) [inline]

Definition at line 39 of file OnAsync.h.

    {return E_NOTIMPL;}

STDMETHOD() CAsyncQuerySink::Invoke | ( | DISPID | dispidMember,
 |  | REFIID | riid,
 |  | LCID | lcid,
 |  | WORD | wFlags,
 |  | DISPPARAMS * | pdispparams,
 |  | VARIANT * | pvarResult,
 |  | EXCEPINFO * | pexcepinfo,
 |  | UINT * | puArgErr |
 | ) |  |  | [inline]

Definition at line 46 of file OnAsync.h.

    {return E_NOTIMPL;}

STDMETHODIMP CAsyncQuerySink::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 135 of file onasync.cpp.

{
  // we're implementing the IID_IWbemObjectSink interface.
    if(riid == IID_IUnknown || riid == IID_IWbemObjectSink)
    {
        *ppv = this;

    // you're handing out a copy of yourself so account for it.
        AddRef();
        return S_OK;
    }
    else
  {
    return E_NOINTERFACE;
  }
}

CAsyncQuerySink::STDMETHOD_ | ( | SCODE | ,
 |  | SetStatus |
 | ) |  |
CAsyncQuerySink::STDMETHOD_ | ( | SCODE | ,
 |  | Indicate |
 | ) |  |
CAsyncQuerySink::STDMETHODIMP_ ( ULONG )
CAsyncQuerySink::STDMETHODIMP_ ( ULONG )

Member Data Documentation

HRESULT CAsyncQuerySink::hResult

Definition at line 29 of file OnAsync.h.

long CAsyncQuerySink::m_lRef [private]

Definition at line 52 of file OnAsync.h.

CListBox* CAsyncQuerySink::m_pOutputList [private]

Definition at line 53 of file OnAsync.h.

BOOL CAsyncQuerySink::m_SetStatusCalled [private]

Definition at line 54 of file OnAsync.h.

IWbemClassObject** CAsyncQuerySink::pObjArray

Definition at line 26 of file OnAsync.h.

HRESULT BSTR IWbemClassObject* CAsyncQuerySink::pObjParam

Definition at line 29 of file OnAsync.h.

HRESULT BSTR CAsyncQuerySink::strParam

Definition at line 29 of file OnAsync.h.

The documentation for this class was generated from the following files:
  • SysMgmt/WMI/VC/AdvClient/OnAsync.h
  • SysMgmt/WMI/VC/AdvClient/onasync.cpp
Generated on Wed Nov 13 2024 16:55:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAsyncTest Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Classes | Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Member Functions

CAsyncTest Class Reference

#include "CAsyncTest.h"

Inherited by CAsyncXXX< CServer, ITest, CAsyncTest >.

List of all members.

Classes

struct | threadParam

Public Member Functions

bool __stdcall | Init ()

Protected Types

enum | { CallNone, CallDone, CallPending }
enum | { Test1, Test2 }

Protected Member Functions

CAsyncTest ()
CAsyncTest (CAsyncXXX< CServer, ITest, CAsyncTest > *pA)
virtual | ~CAsyncTest ()

Static Protected Member Functions

static void __cdecl | ThreadProc (threadParam *pthdParam)

Protected Attributes

HRESULT | m_hResult
CAsyncXXX< CServer, ITest,
CAsyncTest > * 		m_lpAsyncXXX
DWORD m_state

Private Member Functions

virtual HRESULT __stdcall | Begin_Test1 (BSTR bstr)
virtual HRESULT __stdcall | Begin_Test2 (BSTR bstrIn)
virtual HRESULT __stdcall | Finish_Test1 (BSTR bstr)
virtual HRESULT __stdcall | Finish_Test2 (BSTR *lpbstrOut)

Detailed Description

Definition at line 28 of file CAsyncTest.h.

Member Enumeration Documentation

anonymous enum [protected]
Enumerator:
CallNone
CallDone
CallPending

Definition at line 33 of file CAsyncTest.h.

{CallNone, CallDone, CallPending};          // Flags used track call progress

anonymous enum [protected]
Enumerator:
Test1
Test2

Definition at line 34 of file CAsyncTest.h.

{Test1, Test2};                   // Used by either TimerProc or ThreadProc to designate which

Constructor & Destructor Documentation

CAsyncTest::CAsyncTest ( ) [inline, protected]

Definition at line 32 of file CAsyncTest.h.

{};

CAsyncTest::CAsyncTest ( CAsyncXXX< CServer, ITest, CAsyncTest > * pA ) [protected]

Definition at line 25 of file CAsyncTest.cpp.

    : m_lpAsyncXXX(pA), m_state(CallNone), m_hResult(S_OK)
{
  _ASSERT(m_lpAsyncXXX != NULL);
  DEBUGTRACE(_T("CAsyncTest ctor"));
}

CAsyncTest::~CAsyncTest ( ) [protected, virtual]

Definition at line 32 of file CAsyncTest.cpp.

{
  DEBUGTRACE(_T("CAsyncTest dtor"));
}

Member Function Documentation

HRESULT __stdcall CAsyncTest::Begin_Test1 ( BSTR bstr ) [private, virtual]

Definition at line 64 of file CAsyncTest.cpp.

{
  CHECKPOINTER(bstr);
  DEBUGTRACE(_T("In AsyncTest::Begin_Test1. string is %S"), bstr);
  printf("In AsyncTest::Begin_Test1. string is %S\n", bstr);

  // Make certain that the call object is not servicing another call
  if (m_state != CallNone)
    return (m_hResult = RPC_S_CALLPENDING);

  // Save state and set the ISynchronize interface to the non-signaled state
  m_state = CallPending;
  m_lpAsyncXXX->Reset();

/*
 *  Procedure specific implementation. Here I save the BSTR parameter passed in
 *  and pass the processing off to a callback function in the case of a STA
 *  object or a different thread in the case of a MTA object
 */

 // TODO test to see if client has called ICancelMethods::Cancel()
  g_pthdParam =  new threadParam(10000, this, Test1, SysAllocString(bstr));
#if defined(_APARTMENT_)
  g_pthdParam->id = SetTimer(NULL, 0, g_pthdParam->wait, CAsyncTest::TimerProc);
#else
  _beginthread((void(__cdecl*)(void*))ThreadProc, 0, g_pthdParam);
#endif

  // Save hresult
  return (m_hResult = S_OK);
}

HRESULT __stdcall CAsyncTest::Begin_Test2 ( BSTR bstrIn ) [private, virtual]

Definition at line 129 of file CAsyncTest.cpp.

{
  CHECKPOINTER(bstrIn);
  DEBUGTRACE(_T("In AsyncTest::Begin_Test2. string is %S"), bstrIn);
  printf("In AsyncTest::Begin_Test2. string is %S\n", bstrIn);

  if (m_state != CallNone)
    return RPC_S_CALLPENDING;

  m_state = CallPending;
  m_lpAsyncXXX->Reset();

  g_pthdParam =  new threadParam(10000, this, Test2, SysAllocString(bstrIn));
#if defined(_APARTMENT_)
  g_pthdParam->id = SetTimer(NULL, 0, g_pthdParam->wait, CAsyncTest::TimerProc);
#else
  _beginthread((void(__cdecl*)(void*))ThreadProc, 0, g_pthdParam);
#endif
  return S_OK;
}

HRESULT __stdcall CAsyncTest::Finish_Test1 ( BSTR bstr ) [private, virtual]

Definition at line 108 of file CAsyncTest.cpp.

{
  CHECKPOINTER(bstr);
  DEBUGTRACE(_T("In AsyncTest::Finish_Test1"));

  if (m_state == CallNone)
    return (m_hResult = RPC_E_CALL_COMPLETE); // Begin_XXX was never called
  else if (m_state == CallPending)
    m_lpAsyncXXX->Wait(0, INFINITE);      // Call not yet completed. Block till ISynchronize::Signal()
  else if (FAILED(m_hResult))
    return m_hResult;             // Begin_XXX returned an error

  _ASSERT(m_state == CallDone);
  HRESULT hr = SysReAllocString(&bstr, g_pthdParam->data);  // Fill in any [out] parameters
  _ASSERT(SUCCEEDED(hr));
  printf("In AsyncTest::Finish_Test1 string is %S\n", bstr);
  m_state = CallNone;               //  Set the state back to free so that it can be reused
  return S_OK;
}

HRESULT __stdcall CAsyncTest::Finish_Test2 ( BSTR * lpbstrOut ) [private, virtual]

Definition at line 149 of file CAsyncTest.cpp.

{
  CHECKPOINTER(lpbstrOut);
  DEBUGTRACE(_T("In AsyncTest::Finish_Test2"));

  if (m_state == CallNone)
    return RPC_E_CALL_COMPLETE;
  else if (m_state == CallPending)
    return RPC_S_CALLPENDING;

  _ASSERT(m_state == CallDone);
  *lpbstrOut = g_pthdParam->data;
  printf("In AsyncTest::Finish_Test2 string is %S\n", *lpbstrOut);
  m_state = CallNone;
  return S_OK;
}

bool __stdcall CAsyncTest::Init ( )

Definition at line 37 of file CAsyncTest.cpp.

{
  return true;
}

void __cdecl CAsyncTest::ThreadProc ( threadParam * pthdParam ) [static, protected]

Definition at line 198 of file CAsyncTest.cpp.

{
  DEBUGTRACE(_T("In CAsyncTest::ThreadProc"));
  printf("In CAsyncTest::ThreadProc\n");

  CoInitializeEx(0, COINIT_MULTITHREADED);
  Sleep(g_pthdParam->wait);
  g_pthdParam->func == Test1 ?
    g_pthdParam->pA->m_lpAsyncXXX->GetISync()->Test1(g_pthdParam->data) :
    g_pthdParam->pA->m_lpAsyncXXX->GetISync()->Test2(g_pthdParam->data, &g_pthdParam->data);
  g_pthdParam->pA->m_state = CAsyncTest::CallDone;
  g_pthdParam->pA->m_lpAsyncXXX->SignalEvent();
  CoUninitialize();
}

Member Data Documentation

HRESULT CAsyncTest::m_hResult [protected]

Definition at line 37 of file CAsyncTest.h.

CAsyncXXX<CServer, ITest, CAsyncTest>* CAsyncTest::m_lpAsyncXXX [protected]

Definition at line 31 of file CAsyncTest.h.

DWORD CAsyncTest::m_state [protected]

Definition at line 36 of file CAsyncTest.h.

The documentation for this class was generated from the following files:
  • Com/async/server/CAsyncTest.h
  • Com/async/server/CAsyncTest.cpp
Generated on Wed Nov 13 2024 16:55:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAsyncTest::threadParam Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • CAsyncTest
  • CAsyncTest::threadParam
Public Member Functions | Public Attributes

CAsyncTest::threadParam Struct Reference

#include "CAsyncTest.h"

List of all members.

Public Member Functions

threadParam (DWORD w, CAsyncTest *p, DWORD method, BSTR s)

Public Attributes

BSTR | data
DWORD func
UINT_PTR | id
CAsyncTest * pA
UINT wait

Detailed Description

Definition at line 39 of file CAsyncTest.h.

Constructor & Destructor Documentation

CAsyncTest::threadParam::threadParam | ( | DWORD | w,
 |  | CAsyncTest * | p,
 |  | DWORD | method,
 |  | BSTR | s |
 | ) |  |  | [inline]

Definition at line 41 of file CAsyncTest.h.

: wait(w), id(0), pA(p), func(method), data(s){}

Member Data Documentation

BSTR CAsyncTest::threadParam::data

Definition at line 47 of file CAsyncTest.h.

DWORD CAsyncTest::threadParam::func

Definition at line 46 of file CAsyncTest.h.

UINT_PTR CAsyncTest::threadParam::id

Definition at line 44 of file CAsyncTest.h.

CAsyncTest* CAsyncTest::threadParam::pA

Definition at line 45 of file CAsyncTest.h.

UINT CAsyncTest::threadParam::wait

Definition at line 43 of file CAsyncTest.h.

The documentation for this struct was generated from the following file:
  • Com/async/server/CAsyncTest.h
Generated on Wed Nov 13 2024 16:55:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAsyncXXX< T, ISyncFace, IAsyncFace > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends

CAsyncXXX< T, ISyncFace, IAsyncFace > Class Template Reference

#include "CAsyncXXX.h"

Inherits CUnknown.

List of all members.

Public Member Functions

virtual | ~CAsyncXXX ()
void __stdcall | FinalRelease ()
__inline ISyncFace * | GetISync ()
DECLARE_IUNKNOWN HRESULT __stdcall | NondelegatingQueryInterface (const IID &iid, void **ppv)
HRESULT __stdcall | Reset ()
HRESULT __stdcall | Signal ()
HRESULT __stdcall | Wait (ULONG dwFlags, ULONG dwMilliseconds)

Static Public Member Functions

static LPUNKNOWN __stdcall | Create (LPUNKNOWN lpUnkCtrl, REFIID riid1, REFIID riid2, T *pT, ISyncFace *lpSyncface)

Private Member Functions

CAsyncXXX ()
CAsyncXXX (LPUNKNOWN lpUnk, REFIID iid)
virtual HRESULT __stdcall | Init (const CFactoryData *pData)
virtual HRESULT __stdcall | Init (T *pT, ISyncFace *lpSyncface)

Private Attributes

REFIID | m_iid
T * | m_lpObj
ISyncFace * | m_lpSyncface
LPUNKNOWN | m_lpUnkSync

Friends

class | IAsyncFace

Detailed Description

template<class T, class ISyncFace, class IAsyncFace>
class CAsyncXXX< T, ISyncFace, IAsyncFace >

Definition at line 43 of file CAsyncXXX.h.

Constructor & Destructor Documentation

template<class T, class ISyncFace, class IAsyncFace>
CAsyncXXX< T, ISyncFace, IAsyncFace >::CAsyncXXX ( ) [inline, private]

Definition at line 54 of file CAsyncXXX.h.

:CUnknown(NULL,"CAsyncXXX"), m_iid(CLSID_NULL) {};

template<class T , class ISyncFace , class IAsyncFace >
CAsyncXXX< T, ISyncFace, IAsyncFace >::CAsyncXXX | ( | LPUNKNOWN | lpUnk,
 |  | REFIID | iid |
 | ) |  |  | [private]

Definition at line 56 of file CAsyncXXX.cpp.

    :CUnknown(lpUnk,"CAsyncXXX"), CAsyncTest(this),
    m_lpSyncface(NULL), m_lpObj(NULL), m_iid(iid), m_lpUnkSync(NULL)
{
  DEBUGTRACE(_T("CAsyncXXX ctor"));
}

template<class T , class ISyncFace , class IAsyncFace >
CAsyncXXX< T, ISyncFace, IAsyncFace >::~CAsyncXXX ( ) [virtual]

Definition at line 65 of file CAsyncXXX.cpp.

{
  DEBUGTRACE(_T("CAsyncXXX dtor"));
}

Member Function Documentation

template<class T, class ISyncFace, class IAsyncFace >
LPUNKNOWN __stdcall CAsyncXXX< T, ISyncFace, IAsyncFace >::Create | ( | LPUNKNOWN | lpUnkCtrl,
 |  | REFIID | riid1,
 |  | REFIID | riid2,
 |  | T * | pT,
 |  | ISyncFace * | lpSyncface |
 | ) |  |  | [static]

Definition at line 24 of file CAsyncXXX.cpp.

{
  DEBUGTRACE(_T("CAsyncXXX::Create()"));

  /* Create the uninitialized object. The reason for this two part creation mechanism is that there is no
   * easy way to handle failures within a ctor. Therefore only the operations certain to succeed are done
   * within the ctor. The more complex initializations that could fail are done in the call to Init()
   */
  CAsyncXXX<T, ISyncFace, IAsyncFace> *pAsync = new CAsyncXXX<T, ISyncFace, IAsyncFace>(lpUnkCtrl, riid1);

  if (!pAsync)
    return NULL;

  pAsync->NondelegatingAddRef();
  LPUNKNOWN lpUnk = NULL;
  HRESULT hr;
  if (SUCCEEDED(hr = pAsync->Init(pT, lpSyncface)))
  {
    hr = pAsync->NondelegatingQueryInterface(riid2, reinterpret_cast<PVOID*>(&lpUnk));

  }
  pAsync->NondelegatingRelease();

  if (FAILED(hr))
    DEBUGTRACE(_T("Error instanciating Call Object: HRESULT is %#X"), hr);

  return lpUnk;
}

template<class T , class ISyncFace , class IAsyncFace >
void __stdcall CAsyncXXX< T, ISyncFace, IAsyncFace >::FinalRelease ( ) [virtual]

Reimplemented from CUnknown.

Definition at line 178 of file CAsyncXXX.cpp.

{
  DEBUGTRACE(_T("CAsyncXXX::FinalRelease"));
  RELEASEINTERFACE(m_lpUnkSync);
  RELEASEINTERFACE(m_lpSyncface);
}

template<class T, class ISyncFace, class IAsyncFace>
__inline ISyncFace* CAsyncXXX< T, ISyncFace, IAsyncFace >::GetISync ( ) [inline]

Definition at line 117 of file CAsyncXXX.h.

{return m_lpSyncface;}

template<class T, class ISyncFace, class IAsyncFace >
HRESULT __stdcall CAsyncXXX< T, ISyncFace, IAsyncFace >::Init | ( | T * | pT,
 |  | ISyncFace * | lpSyncface |
 | ) |  |  | [private, virtual]

Definition at line 81 of file CAsyncXXX.cpp.

{
  DEBUGTRACE(_T("In CAsyncXXX::Init"));
  _ASSERT(pT);
  _ASSERT(lpSyncface);

  /*
   *  The life type of class T is contained within the life time of ISyncFace
   */
   m_lpObj = pT;
  (m_lpSyncface = lpSyncface)->AddRef();

  /*
   *  Note that the CLSID_ManualResetEvent object is aggreated by the call to GetOuterUnknown(). This is done so that
   *  both objects created in the same apartment or different apartments can be treated the same.
   *
   *  The GetOuterUnknown() method will either return the controlling Unknown passed into ICallFactory::CreateCall()
   *  if aggregated or itself in the non-aggreated case. The client will either be using the ISynchronize interface returned
   *  from the CoCreateInstance() method below in the typical inproc case or COM's implemenation of ISynchronize in
   *  the typical Local server case. In each case the call object must use the same ISynchronize
   *  implementation as the client does.
   *
   */
  HRESULT hr = CoCreateInstance(CLSID_ManualResetEvent, GetOuterUnknown(), CLSCTX_INPROC, IID_IUnknown, reinterpret_cast<PVOID*>(&m_lpUnkSync));
  _ASSERT(SUCCEEDED(hr) && m_lpUnkSync);

  return S_OK;
}

template<class T , class ISyncFace , class IAsyncFace >
long __stdcall CAsyncXXX< T, ISyncFace, IAsyncFace >::Init ( const CFactoryData * pData ) [private, virtual]

Implements CUnknown.

Definition at line 72 of file CAsyncXXX.cpp.

{
  DEBUGTRACE(_T("This function should never be called"));
  DebugBreak();
  return 0;
}

template<class T, class ISyncFace, class IAsyncFace>
DECLARE_IUNKNOWN HRESULT __stdcall CAsyncXXX< T, ISyncFace, IAsyncFace >::NondelegatingQueryInterface | ( | const IID & | iid,
 |  | void ** | ppv |
 | ) |  |  | [virtual]

Reimplemented from CUnknown.

template<class T , class ISyncFace , class IAsyncFace >
HRESULT __stdcall CAsyncXXX< T, ISyncFace, IAsyncFace >::Reset ( )

Definition at line 141 of file CAsyncXXX.cpp.

{
  LPSYNCHRONIZE   lpSync = NULL;
  HRESULT hr = QueryInterface(IID_ISynchronize, reinterpret_cast<PVOID*>(&lpSync));
  _ASSERT(SUCCEEDED(hr) && lpSync);
  hr = lpSync->Reset();
  RELEASEINTERFACE(lpSync);
  return S_OK;
}

template<class T , class ISyncFace , class IAsyncFace >
HRESULT __stdcall CAsyncXXX< T, ISyncFace, IAsyncFace >::Signal ( )

Definition at line 152 of file CAsyncXXX.cpp.

{
  LPSYNCHRONIZE   lpSync = NULL;
  HRESULT hr = QueryInterface(IID_ISynchronize, reinterpret_cast<PVOID*>(&lpSync));
  _ASSERT(SUCCEEDED(hr) && lpSync);
  hr = lpSync->Signal();
  _ASSERT(SUCCEEDED(hr));
  RELEASEINTERFACE(lpSync);
  return hr;
}

template<class T , class ISyncFace , class IAsyncFace >
HRESULT __stdcall CAsyncXXX< T, ISyncFace, IAsyncFace >::Wait | ( | ULONG | dwFlags,
 |  | ULONG | dwMilliseconds
 | ) |  |

Definition at line 165 of file CAsyncXXX.cpp.

{
  LPSYNCHRONIZE   lpSync = NULL;
  HRESULT hr = QueryInterface(IID_ISynchronize, reinterpret_cast<PVOID*>(&lpSync));
  _ASSERT(SUCCEEDED(hr) && lpSync);
  hr = lpSync->Wait(dwFlags, dwMilliseconds);
  _ASSERT(SUCCEEDED(hr));
  RELEASEINTERFACE(lpSync);
  return hr;
}

Friends And Related Function Documentation

template<class T, class ISyncFace, class IAsyncFace>
friend class IAsyncFace [friend]

Definition at line 47 of file CAsyncXXX.h.

Member Data Documentation

template<class T, class ISyncFace, class IAsyncFace>
REFIID CAsyncXXX< T, ISyncFace, IAsyncFace >::m_iid [private]

Definition at line 51 of file CAsyncXXX.h.

template<class T, class ISyncFace, class IAsyncFace>
T* CAsyncXXX< T, ISyncFace, IAsyncFace >::m_lpObj [private]

Definition at line 50 of file CAsyncXXX.h.

template<class T, class ISyncFace, class IAsyncFace>
ISyncFace* CAsyncXXX< T, ISyncFace, IAsyncFace >::m_lpSyncface [private]

Definition at line 49 of file CAsyncXXX.h.

template<class T, class ISyncFace, class IAsyncFace>
LPUNKNOWN CAsyncXXX< T, ISyncFace, IAsyncFace >::m_lpUnkSync [private]

Definition at line 52 of file CAsyncXXX.h.

The documentation for this class was generated from the following files:
  • Com/async/server/CAsyncXXX.h
  • Com/async/server/CAsyncXXX.cpp
Generated on Wed Nov 13 2024 16:55:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAttributeValueAddButton Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CAttributeValueAddButton Class Reference

#include "util.h"

List of all members.

Public Member Functions

CAttributeValueAddButton (CMultiValuedAttributeEditor *pEditor)
CAttributeValueAddButton (CMultiValuedAttributeEditor *pEditor)
~CAttributeValueAddButton ()
~CAttributeValueAddButton ()
afx_msg BOOL | OnAdd ()
afx_msg BOOL | OnAdd ()

Protected Attributes

CMultiValuedAttributeEditor * m_pEditor

Detailed Description

Definition at line 71 of file util.h.

Constructor & Destructor Documentation

CAttributeValueAddButton::CAttributeValueAddButton ( CMultiValuedAttributeEditor * pEditor ) [inline]

Definition at line 74 of file util.h.

  {
    ASSERT(pEditor != NULL);
    m_pEditor = pEditor;
  }

CAttributeValueAddButton::~CAttributeValueAddButton ( ) [inline]

Definition at line 80 of file util.h.

{}

CAttributeValueAddButton::CAttributeValueAddButton ( CMultiValuedAttributeEditor * pEditor ) [inline]

Definition at line 75 of file util.h.

  {
    ASSERT(pEditor != NULL);
    m_pEditor = pEditor;
  }

CAttributeValueAddButton::~CAttributeValueAddButton ( ) [inline]

Definition at line 81 of file util.h.

{}

Member Function Documentation

BOOL CAttributeValueAddButton::OnAdd ( )

Definition at line 90 of file util.cpp.

{
  //
  // Let the editor handle the message
  //
  m_pEditor->OnAddValue();
  return FALSE;
}

afx_msg BOOL CAttributeValueAddButton::OnAdd ( )

Member Data Documentation

CMultiValuedAttributeEditor * CAttributeValueAddButton::m_pEditor [protected]

Definition at line 85 of file util.h.

The documentation for this class was generated from the following files:
  • NetDS/ADSI/samples/DSUI/scpext/scpproppage/util.h
  • NetDS/ADSI/samples/DSUI/scpext/scpwizard/util.h
  • NetDS/ADSI/samples/DSUI/scpext/scpproppage/util.cpp
  • NetDS/ADSI/samples/DSUI/scpext/scpwizard/util.cpp
Generated on Wed Nov 13 2024 16:55:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAttributeValueDeleteButton Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CAttributeValueDeleteButton Class Reference

#include "util.h"

List of all members.

Public Member Functions

CAttributeValueDeleteButton (CMultiValuedAttributeEditor *pEditor)
CAttributeValueDeleteButton (CMultiValuedAttributeEditor *pEditor)
~CAttributeValueDeleteButton ()
~CAttributeValueDeleteButton ()
afx_msg BOOL | OnDelete ()
afx_msg BOOL | OnDelete ()

Protected Attributes

CMultiValuedAttributeEditor * m_pEditor

Detailed Description

Definition at line 92 of file util.h.

Constructor & Destructor Documentation

CAttributeValueDeleteButton::CAttributeValueDeleteButton ( CMultiValuedAttributeEditor * pEditor ) [inline]

Definition at line 95 of file util.h.

  {
    ASSERT(pEditor != NULL);
    m_pEditor = pEditor;
  }

CAttributeValueDeleteButton::~CAttributeValueDeleteButton ( ) [inline]

Definition at line 101 of file util.h.

{}

CAttributeValueDeleteButton::CAttributeValueDeleteButton ( CMultiValuedAttributeEditor * pEditor ) [inline]

Definition at line 96 of file util.h.

  {
    ASSERT(pEditor != NULL);
    m_pEditor = pEditor;
  }

CAttributeValueDeleteButton::~CAttributeValueDeleteButton ( ) [inline]

Definition at line 102 of file util.h.

{}

Member Function Documentation

BOOL CAttributeValueDeleteButton::OnDelete ( )

Definition at line 108 of file util.cpp.

{
  //
  // Let the editor handle the message
  //
  m_pEditor->OnDeleteValue();
  return FALSE;
}

afx_msg BOOL CAttributeValueDeleteButton::OnDelete ( )

Member Data Documentation

CMultiValuedAttributeEditor * CAttributeValueDeleteButton::m_pEditor [protected]

Definition at line 106 of file util.h.

The documentation for this class was generated from the following files:
  • NetDS/ADSI/samples/DSUI/scpext/scpproppage/util.h
  • NetDS/ADSI/samples/DSUI/scpext/scpwizard/util.h
  • NetDS/ADSI/samples/DSUI/scpext/scpproppage/util.cpp
  • NetDS/ADSI/samples/DSUI/scpext/scpwizard/util.cpp
Generated on Wed Nov 13 2024 16:55:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAttributeValueEditButton Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CAttributeValueEditButton Class Reference

#include "util.h"

List of all members.

Public Member Functions

CAttributeValueEditButton (CMultiValuedAttributeEditor *pEditor)
~CAttributeValueEditButton ()
afx_msg BOOL OnEdit ()

Protected Attributes

CMultiValuedAttributeEditor * m_pEditor

Detailed Description

Definition at line 113 of file util.h.

Constructor & Destructor Documentation

CAttributeValueEditButton::CAttributeValueEditButton ( CMultiValuedAttributeEditor * pEditor ) [inline]

Definition at line 116 of file util.h.

  {
    ASSERT(pEditor != NULL);
    m_pEditor = pEditor;
  }

CAttributeValueEditButton::~CAttributeValueEditButton ( ) [inline]

Definition at line 122 of file util.h.

{}

Member Function Documentation

afx_msg BOOL CAttributeValueEditButton::OnEdit ( )

Member Data Documentation

CMultiValuedAttributeEditor* CAttributeValueEditButton::m_pEditor [protected]

Definition at line 127 of file util.h.

The documentation for this class was generated from the following file:
  • NetDS/ADSI/samples/DSUI/scpext/scpproppage/util.h
Generated on Wed Nov 13 2024 16:55:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAttributeValueEditor Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CAttributeValueEditor Class Reference

#include "util.h"

List of all members.

Public Member Functions

CAttributeValueEditor (CMultiValuedAttributeEditor *pEditor)
CAttributeValueEditor (CMultiValuedAttributeEditor *pEditor)
~CAttributeValueEditor ()
~CAttributeValueEditor ()
afx_msg BOOL | OnChange ()
afx_msg BOOL | OnChange ()

Protected Attributes

CMultiValuedAttributeEditor * m_pEditor

Detailed Description

Definition at line 29 of file util.h.

Constructor & Destructor Documentation

CAttributeValueEditor::CAttributeValueEditor ( CMultiValuedAttributeEditor * pEditor ) [inline]

Definition at line 32 of file util.h.

  {
    ASSERT(pEditor != NULL);
    m_pEditor = pEditor;
  }

CAttributeValueEditor::~CAttributeValueEditor ( ) [inline]

Definition at line 38 of file util.h.

{}

CAttributeValueEditor::CAttributeValueEditor ( CMultiValuedAttributeEditor * pEditor ) [inline]

Definition at line 33 of file util.h.

  {
    ASSERT(pEditor != NULL);
    m_pEditor = pEditor;
  }

CAttributeValueEditor::~CAttributeValueEditor ( ) [inline]

Definition at line 39 of file util.h.

{}

Member Function Documentation

BOOL CAttributeValueEditor::OnChange ( )

Definition at line 54 of file util.cpp.

{
  //
  // Let the editor handle the message
  //
  m_pEditor->OnEditChange();
  return FALSE;
}

afx_msg BOOL CAttributeValueEditor::OnChange ( )

Member Data Documentation

CMultiValuedAttributeEditor * CAttributeValueEditor::m_pEditor [protected]

Definition at line 43 of file util.h.

The documentation for this class was generated from the following files:
  • NetDS/ADSI/samples/DSUI/scpext/scpproppage/util.h
  • NetDS/ADSI/samples/DSUI/scpext/scpwizard/util.h
  • NetDS/ADSI/samples/DSUI/scpext/scpproppage/util.cpp
  • NetDS/ADSI/samples/DSUI/scpext/scpwizard/util.cpp
Generated on Wed Nov 13 2024 16:55:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAuthenticateAdmin Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CAuthenticateAdmin Class Reference

#include "AuthenticateAdmin.h"

List of all members.

Public Member Functions

CAuthenticateAdmin ()
STDMETHOD() | Initialize (CAuthenticatePlugin *pPlugin)
STDMETHOD() | InterfaceSupportsErrorInfo (REFIID riid)

Private Attributes

CAuthenticatePlugin * m_pAuthenticatePlugin

Detailed Description

Definition at line 21 of file AuthenticateAdmin.h.

Constructor & Destructor Documentation

CAuthenticateAdmin::CAuthenticateAdmin ( ) [inline]

Definition at line 28 of file AuthenticateAdmin.h.

                         :
        m_pAuthenticatePlugin( NULL )
    {
    }

Member Function Documentation

STDMETHODIMP CAuthenticateAdmin::Initialize ( CAuthenticatePlugin * pPlugin )

Definition at line 38 of file AuthenticateAdmin.cpp.

{
    HRESULT hr = S_OK;

    if( NULL == pPlugin )
    {
        return( E_INVALIDARG );
    }

    m_pAuthenticatePlugin = pPlugin;

    return( hr );
}

STDMETHODIMP CAuthenticateAdmin::InterfaceSupportsErrorInfo ( REFIID riid )

Definition at line 20 of file AuthenticateAdmin.cpp.

{
    static const IID* arr[] =
    {
        &IID_IAuthenticateAdmin
    };

    for( int i = 0; i < sizeof( arr ) / sizeof( arr[ 0 ] ); i++ )
    {
        if( IsEqualGUID( *arr[i], riid ) )
            return( S_OK );
    }
    return( S_FALSE );
}

Member Data Documentation

CAuthenticatePlugin* CAuthenticateAdmin::m_pAuthenticatePlugin [private]

Definition at line 54 of file AuthenticateAdmin.h.

The documentation for this class was generated from the following files:
  • Multimedia/WindowsMediaServices9/Authentication/AuthenticateAdmin.h
  • Multimedia/WindowsMediaServices9/Authentication/AuthenticateAdmin.cpp
Generated on Wed Nov 13 2024 16:55:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAuthenticateContext Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CAuthenticateContext Class Reference

#include "AuthenticateContext.h"

List of all members.

Public Member Functions

CAuthenticateContext ()
~CAuthenticateContext ()
STDMETHOD() | Authenticate (VARIANT ResponseBlob, IWMSContext *pUserCtx, IWMSContext *pPresentationCtx, IWMSCommandContext *pCommandContext, IWMSAuthenticationCallback *pCallback, VARIANT Context)
STDMETHOD() | GetAuthenticationPlugin (IWMSAuthenticationPlugin **ppAuthenPlugin)
STDMETHOD() | GetImpersonationAccountName (BSTR *bstrAccountName)
STDMETHOD() | GetImpersonationToken (long *Token)
STDMETHOD() | GetLogicalUserID (BSTR *bstrUserID)
STDMETHOD() | Initialize (IWMSAuthenticationPlugin *pAuthenticator)

Private Attributes

CComBSTR | m_bstrUsername
CRITICAL_SECTION | m_CritSec
HANDLE m_hToken
IWMSAuthenticationPlugin * | m_pWMSAuthenticationPlugin
DWORD m_State

Detailed Description

Definition at line 20 of file AuthenticateContext.h.

Constructor & Destructor Documentation

CAuthenticateContext::CAuthenticateContext ( )

Definition at line 30 of file AuthenticateContext.cpp.

                                           :
    m_hToken( NULL ),
    m_bstrUsername( L"" ),
    m_State( 0 )
{
    InitializeCriticalSection( &m_CritSec );
}

CAuthenticateContext::~CAuthenticateContext ( )

Definition at line 41 of file AuthenticateContext.cpp.

{
    DeleteCriticalSection( &m_CritSec );

    if( NULL != m_hToken )
    {
        CloseHandle( m_hToken );
    }

    if( NULL != m_pWMSAuthenticationPlugin )
    {
        m_pWMSAuthenticationPlugin->Release();
    }
}

Member Function Documentation

STDMETHODIMP CAuthenticateContext::Authenticate | ( | VARIANT | ResponseBlob,
 |  | IWMSContext * | pUserCtx,
 |  | IWMSContext * | pPresentationCtx,
 |  | IWMSCommandContext * | pCommandContext,
 |  | IWMSAuthenticationCallback * | pCallback,
 |  | VARIANT | Context
 | ) |  |

Definition at line 120 of file AuthenticateContext.cpp.

{

    if( NULL == pCallback )
    {
        return(E_INVALIDARG);
    }

    HRESULT hr = S_OK;
    EnterCriticalSection( &m_CritSec );

    DWORD dwState = WMS_AUTHENTICATION_ERROR;

    VARIANT ChallengeBlob;
    VariantInit( &ChallengeBlob );

    do
    {
        if( WMS_AUTHENTICATION_SUCCESS == m_State )
        {
            dwState = m_State;
            break;
        }

        if ( 0 == LogonUserW(
                    ANON_USER,
                    ANON_DOMAIN,
                    ANON_PSWD,
                    LOGON32_LOGON_NETWORK,
                    LOGON32_PROVIDER_DEFAULT,
                    &m_hToken ) )
        {
            m_hToken = NULL;
            m_bstrUsername = L"";
            hr = HRESULT_FROM_WIN32( ERROR_LOGON_FAILURE );
            dwState = WMS_AUTHENTICATION_DENIED;
            break;
        }
        else
        {
            m_State = dwState = WMS_AUTHENTICATION_SUCCESS;
            m_bstrUsername = ANON_USER;
        }

    } while( FALSE );

    LeaveCriticalSection( &m_CritSec );

    pCallback->OnAuthenticateComplete( (WMS_AUTHENTICATION_RESULT) dwState, ChallengeBlob, Context );

    VariantClear( &ChallengeBlob );

    return( S_OK );

}

STDMETHODIMP CAuthenticateContext::GetAuthenticationPlugin ( IWMSAuthenticationPlugin ** ppAuthenPlugin )

Definition at line 85 of file AuthenticateContext.cpp.

{
    if( NULL == ppAuthenPlugin)
    {
        return( E_INVALIDARG );
    }

    HRESULT hr = S_OK;

    EnterCriticalSection( &m_CritSec );

    do
    {
        if( NULL == m_pWMSAuthenticationPlugin )
        {
            hr = E_UNEXPECTED;
            break;
        }

        hr = m_pWMSAuthenticationPlugin->QueryInterface( IID_IWMSAuthenticationPlugin, (void**)ppAuthenPlugin );

    }
    while( FALSE );

    LeaveCriticalSection( &m_CritSec );

    return( hr );
}

STDMETHODIMP CAuthenticateContext::GetImpersonationAccountName ( BSTR * bstrAccountName )

Definition at line 222 of file AuthenticateContext.cpp.

{
    if( NULL == bstrAccountName )
    {
        return( E_POINTER );
    }

    HRESULT hr = E_NOTIMPL;
    EnterCriticalSection( &m_CritSec );

    //
    // TODO: Add code here to return the Impersonation Account Name
    //
    // hr = ...

    LeaveCriticalSection( &m_CritSec );

    return( hr );
}

STDMETHODIMP CAuthenticateContext::GetImpersonationToken ( long * Token )

Definition at line 248 of file AuthenticateContext.cpp.

{
    if( NULL == Token )
    {
        return( E_POINTER );
    }

    HRESULT hr = S_OK;

    EnterCriticalSection( &m_CritSec );

    *Token = HandleToLong(m_hToken);

    LeaveCriticalSection( &m_CritSec );

    return( hr );
}

STDMETHODIMP CAuthenticateContext::GetLogicalUserID ( BSTR * bstrUserID )

Definition at line 187 of file AuthenticateContext.cpp.

{
    if( NULL == bstrUserID )
    {
        return( E_POINTER );
    }

    HRESULT hr = S_OK;
    EnterCriticalSection( &m_CritSec );

    if( WMS_AUTHENTICATION_SUCCESS == m_State )
    {
        *bstrUserID = SysAllocString( m_bstrUsername.m_str );

        if( NULL == *bstrUserID )
        {
            hr = E_OUTOFMEMORY;
        }
    }
    else
    {
        *bstrUserID = NULL;
    }

    LeaveCriticalSection( &m_CritSec );

    return( hr );
}

STDMETHODIMP CAuthenticateContext::Initialize ( IWMSAuthenticationPlugin * pAuthenticator )

Definition at line 60 of file AuthenticateContext.cpp.

{
    if( NULL == pAuthenticator)
    {
        return( E_INVALIDARG );
    }

    HRESULT hr = S_OK;

    EnterCriticalSection( &m_CritSec );

    m_pWMSAuthenticationPlugin = pAuthenticator;
    m_pWMSAuthenticationPlugin->AddRef();

    LeaveCriticalSection( &m_CritSec );

    return( hr );
}

Member Data Documentation

CComBSTR CAuthenticateContext::m_bstrUsername [private]

Definition at line 59 of file AuthenticateContext.h.

CRITICAL_SECTION CAuthenticateContext::m_CritSec [private]

Definition at line 56 of file AuthenticateContext.h.

HANDLE CAuthenticateContext::m_hToken [private]

Definition at line 57 of file AuthenticateContext.h.

IWMSAuthenticationPlugin* CAuthenticateContext::m_pWMSAuthenticationPlugin [private]

Definition at line 55 of file AuthenticateContext.h.

DWORD CAuthenticateContext::m_State [private]

Definition at line 58 of file AuthenticateContext.h.

The documentation for this class was generated from the following files:
  • Multimedia/WindowsMediaServices9/Authentication/AuthenticateContext.h
  • Multimedia/WindowsMediaServices9/Authentication/AuthenticateContext.cpp
Generated on Wed Nov 13 2024 16:55:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAuthenticatePlugin Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CAuthenticatePlugin Class Reference

#include "AuthenticatePlugin.h"

Inherits IAuthenticatePlugin.

List of all members.

Public Member Functions

CAuthenticatePlugin ()
~CAuthenticatePlugin ()
STDMETHOD() | CreateAuthenticationContext (IWMSAuthenticationContext **ppAuthenCtx)
STDMETHOD() | DisablePlugin ()
STDMETHOD() | EnablePlugin (long *pdwFlags, long *pdwHeartbeatPeriod)
STDMETHOD() | GetCustomAdminInterface (IDispatch **ppValue)
STDMETHOD() | GetFlags (long *Flags)
STDMETHOD() | GetPackageName (BSTR *PackageName)
STDMETHOD() | GetProtocolName (BSTR *ProtocolName)
STDMETHOD() | InitializePlugin (IWMSContext *pServerContext, IWMSNamedValues *pNamedValues, IWMSClassObject *pClassFactory)
STDMETHOD() | OnHeartbeat ()
STDMETHOD() | ShutdownPlugin ()

Private Attributes

CComPtr< IWMSNamedValues > | m_spNamedValues

Detailed Description

Definition at line 25 of file AuthenticatePlugin.h.

Constructor & Destructor Documentation

CAuthenticatePlugin::CAuthenticatePlugin ( )

Definition at line 23 of file AuthenticatePlugin.cpp.

{
}

CAuthenticatePlugin::~CAuthenticatePlugin ( )

Definition at line 30 of file AuthenticatePlugin.cpp.

{
}

Member Function Documentation

STDMETHODIMP CAuthenticatePlugin::CreateAuthenticationContext ( IWMSAuthenticationContext ** ppAuthenCtx )

Definition at line 237 of file AuthenticatePlugin.cpp.

{
    if( NULL == ppAuthenCtx )
    {
        return( E_POINTER );
    }

    HRESULT hr = S_OK;

    CComObject<CAuthenticateContext> *pAuthenticateContext = NULL;

    if( SUCCEEDED( hr ) )
    {
        hr = CComObject<CAuthenticateContext>::CreateInstance( &pAuthenticateContext );
    }

    if( SUCCEEDED( hr ) )
    {
        pAuthenticateContext->AddRef();
        hr = pAuthenticateContext->Initialize( this );
    }

    if( SUCCEEDED( hr ) )
    {
        hr = pAuthenticateContext->QueryInterface( IID_IWMSAuthenticationContext, (void **) ppAuthenCtx );
    }

    if( NULL != pAuthenticateContext )
    {
        pAuthenticateContext->Release();
    }

    return( hr );
}

STDMETHODIMP CAuthenticatePlugin::DisablePlugin ( )

Definition at line 88 of file AuthenticatePlugin.cpp.

{
    HRESULT hr = S_OK;

    // TODO: Add any additional code here

    return( hr );
}

STDMETHODIMP CAuthenticatePlugin::EnablePlugin | ( | long * | pdwFlags,
 |  | long * | pdwHeartbeatPeriod
 | ) |  |

Definition at line 67 of file AuthenticatePlugin.cpp.

{
    if( NULL == pdwFlags || NULL == pdwHeartbeatPeriod )
    {
        return( E_POINTER );
    }

    HRESULT hr = S_OK;

    // Set the heartbeat period in milliseconds
    *pdwHeartbeatPeriod = 0000;

    return( hr );
}

STDMETHODIMP CAuthenticatePlugin::GetCustomAdminInterface ( IDispatch ** ppValue )

Definition at line 127 of file AuthenticatePlugin.cpp.

{
    if( ( NULL == ppValue ) )
    {
        return( E_POINTER );
    }

    HRESULT hr = S_OK;

    *ppValue = NULL;

    CComObject<CAuthenticateAdmin> *pAuthenticateAdmin = NULL;

    hr = CComObject<CAuthenticateAdmin>::CreateInstance( &pAuthenticateAdmin );

    if( SUCCEEDED( hr ) )
    {
        pAuthenticateAdmin->AddRef();
        hr = pAuthenticateAdmin->Initialize( this );
    }

    if( SUCCEEDED(hr) )
    {
        hr = pAuthenticateAdmin->QueryInterface( IID_IDispatch, (void **) ppValue );
    }

    if( NULL != pAuthenticateAdmin )
    {
        pAuthenticateAdmin->Release();
    }

    return( hr );
}

STDMETHODIMP CAuthenticatePlugin::GetFlags ( long * Flags )

Definition at line 217 of file AuthenticatePlugin.cpp.

{
    if( NULL == Flags )
    {
        return( E_POINTER );
    }

    HRESULT hr = S_OK;

    *Flags = WMS_AUTHENTICATION_ANONYMOUS;

    return( hr );
}

STDMETHODIMP CAuthenticatePlugin::GetPackageName ( BSTR * PackageName )

Definition at line 167 of file AuthenticatePlugin.cpp.

{
    if( NULL == PackageName )
    {
        return( E_POINTER );
    }

    HRESULT hr = S_OK;

    *PackageName = SysAllocString( _T( PACKET_NAME ) );

    if( NULL == *PackageName )
    {
        hr = E_OUTOFMEMORY;
    }

    return( hr );
}

STDMETHODIMP CAuthenticatePlugin::GetProtocolName ( BSTR * ProtocolName )

Definition at line 192 of file AuthenticatePlugin.cpp.

{
    if( NULL == ProtocolName )
    {
        return( E_POINTER );
    }

    HRESULT hr = S_OK;

    *ProtocolName = SysAllocString( _T( PROTOCOL_NAME ) );

    if( NULL == *ProtocolName )
    {
        hr = E_OUTOFMEMORY;
    }

    return( hr );
}

STDMETHODIMP CAuthenticatePlugin::InitializePlugin | ( | IWMSContext * | pServerContext,
 |  | IWMSNamedValues * | pNamedValues,
 |  | IWMSClassObject * | pClassFactory
 | ) |  |

Definition at line 38 of file AuthenticatePlugin.cpp.

{
    if( ( NULL == pServerContext )
        || ( NULL == pNamedValues )
        || ( NULL == pClassFactory ) )
    {
        return( E_INVALIDARG );
    }

    HRESULT hr = S_OK;

    if( NULL != pNamedValues )
    {
        m_spNamedValues = pNamedValues;
    }

    // TODO: Add any additional initialization here

    return( hr );
}

STDMETHODIMP CAuthenticatePlugin::OnHeartbeat ( )

Definition at line 114 of file AuthenticatePlugin.cpp.

{
    HRESULT hr = S_OK;

    // TODO: Add code that should execute on every Heartbeat Period

    return( hr );
}

STDMETHODIMP CAuthenticatePlugin::ShutdownPlugin ( )

Definition at line 100 of file AuthenticatePlugin.cpp.

{
    HRESULT hr = S_OK;

    m_spNamedValues = NULL;

    // TODO: Add any additional code here

    return( hr );
}

Member Data Documentation

CComPtr<IWMSNamedValues> CAuthenticatePlugin::m_spNamedValues [private]

Definition at line 66 of file AuthenticatePlugin.h.

The documentation for this class was generated from the following files:
  • Multimedia/WindowsMediaServices9/Authentication/AuthenticatePlugin.h
  • Multimedia/WindowsMediaServices9/Authentication/AuthenticatePlugin.cpp
Generated on Wed Nov 13 2024 16:55:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAVIFileReader Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CAVIFileReader Class Reference

#include "avifilereader.h"

List of all members.

Public Member Functions

CAVIFileReader ()
virtual | ~CAVIFileReader ()
HRESULT | GetFormat (WAVEFORMATEX **ppWaveFormat)
HRESULT | Initialize (char *pszFileName)
BOOL IsValidAudioFile ()
HRESULT | Read (BYTE *pBuffer, LONG nBufferSize, LONG *pBytesWritten)

Private Attributes

LONG | m_nSamplesReadSoFar
PAVISTREAM | m_pAudioStream
WAVEFORMATEX * | m_pWaveFormat

Detailed Description

Definition at line 25 of file avifilereader.h.

Constructor & Destructor Documentation

CAVIFileReader::CAVIFileReader ( )

Definition at line 27 of file avifilereader.cpp.

    :m_pAudioStream(NULL),
    m_pWaveFormat(NULL),
    m_nSamplesReadSoFar(0)
{
    LogMessage("CAVIFileReader::CAVIFileReader");
}

CAVIFileReader::~CAVIFileReader ( ) [virtual]

Definition at line 191 of file avifilereader.cpp.

{
    LogMessage("CAVIFileReader::~CAVIFileReader started");

    if (NULL != m_pAudioStream)
    {
        AVIStreamRelease(m_pAudioStream);
        m_pAudioStream = NULL;
    }

    if (NULL != m_pWaveFormat)
    {
        FreeMemory(m_pWaveFormat);
        m_pWaveFormat = NULL;
    }

    //
    // AVIFileExit must be called on the same thread as AVIFileInit.
    // therefore this object must be created and deleted on the same thread
    //

    AVIFileExit();

    LogMessage("CAVIFileReader::~CAVIFileReader completed");
}

Member Function Documentation

HRESULT CAVIFileReader::GetFormat ( WAVEFORMATEX ** ppWaveFormat )
HRESULT CAVIFileReader::Initialize ( char * pszFileName )
BOOL CAVIFileReader::IsValidAudioFile ( ) [inline]

Definition at line 72 of file avifilereader.h.

    {

        //
        // if we know stream's format, chances are this is a valid audio file
        //

        if (NULL == m_pWaveFormat)
        {
            return FALSE;
        }
        else
        {
            return TRUE;
        }
    }

HRESULT CAVIFileReader::Read | ( | BYTE * | pBuffer,
 |  | LONG | nBufferSize,
 |  | LONG * | pBytesWritten
 | ) |  |

Member Data Documentation

LONG CAVIFileReader::m_nSamplesReadSoFar [private]

Definition at line 112 of file avifilereader.h.

PAVISTREAM CAVIFileReader::m_pAudioStream [private]

Definition at line 97 of file avifilereader.h.

WAVEFORMATEX* CAVIFileReader::m_pWaveFormat [private]

Definition at line 104 of file avifilereader.h.

The documentation for this class was generated from the following files:
  • NetDS/Tapi/Tapi3/Cpp/tapisend/avifilereader.h
  • NetDS/Tapi/Tapi3/Cpp/tapisend/avifilereader.cpp
Generated on Wed Nov 13 2024 16:55:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CAVIFileWriter Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CAVIFileWriter Class Reference

#include "avifilewriter.h"

List of all members.

Public Member Functions

CAVIFileWriter ()
virtual | ~CAVIFileWriter ()
HRESULT | Initialize (IN const CHAR *psFileName, IN const WAVEFORMATEX &WaveFormat)
HRESULT | Write (IN BYTE *pBuffer, IN ULONG nBytesToWrite, IN OUT ULONG *pnBytesWritten)

Private Attributes

LONG | m_nSampleSize
PAVISTREAM | m_pAudioStream
PAVIFILE | m_pAVIFile

Detailed Description

Definition at line 23 of file avifilewriter.h.

Constructor & Destructor Documentation

CAVIFileWriter::CAVIFileWriter ( )

Definition at line 26 of file avifilewriter.cpp.

    :m_pAVIFile(NULL),
    m_pAudioStream(NULL),
    m_nSampleSize(0)
{

    LogMessage("CAVIFileWriter::CAVIFileWriter");

}

CAVIFileWriter::~CAVIFileWriter ( ) [virtual]

Definition at line 182 of file avifilewriter.cpp.

{

    LogMessage("CAVIFileWriter::~CAVIFileWriter started");

    if (NULL != m_pAudioStream)
    {
        AVIStreamRelease(m_pAudioStream);
        m_pAudioStream = NULL;
    }

    if (NULL != m_pAVIFile)
    {
        AVIFileRelease(m_pAVIFile);
        m_pAVIFile = NULL;
    }

    //
    // uninitialize avi file libraries
    //

    AVIFileExit();

    LogMessage("CAVIFileWriter::~CAVIFileWriter finished");

}

Member Function Documentation

HRESULT CAVIFileWriter::Initialize | ( | IN const CHAR * | psFileName,
 |  | IN const WAVEFORMATEX & | WaveFormat
 | ) |  |

Definition at line 48 of file avifilewriter.cpp.

{

    HRESULT hr = S_OK;

    //
    // if initialization fails, the object's stream and file will be NULL, so
    // subsequent Write() calls will fail
    //

    //
    // would do a better argument checking in a real-life application
    //

    _ASSERTE(pszFileName);

    //
    // log file name and requested wave format
    //

    LogMessage("CAVIFileWriter::Initialize started.");

    LogMessage("    file [%s] ", pszFileName);

    LogFormat(&WaveFormat);

    //
    // initialize avi file library.
    // when done with it, call AVIFileExit should be called on the same thread
    //

    AVIFileInit();

    //
    // create file
    //

    hr = AVIFileOpen(&m_pAVIFile,
                     pszFileName,
                     OF_WRITE | OF_CREATE | OF_SHARE_DENY_WRITE,
                     NULL);

    if (FAILED(hr))
    {
        LogError("CAVIFileWriter::Initialize Failed to create file %s",
                 pszFileName);

        m_pAVIFile = NULL;

        return hr;
    }

    //
    // fill in stream information
    //

    AVISTREAMINFO StreamInfo;

    memset(&StreamInfo, 0, sizeof(StreamInfo));

    StreamInfo.fccType = streamtypeAUDIO;
    StreamInfo.dwQuality = (DWORD)-1;
    m_nSampleSize = StreamInfo.dwSampleSize = WaveFormat.nBlockAlign;

    // ignore the return code -- we will have a null-terminated string no
    // matter what.
    StringCbCopy(&StreamInfo.szName[0], 64, "test audio stream");

    //
    // add an audio stream to the file
    //

    hr = AVIFileCreateStream(m_pAVIFile, &m_pAudioStream, &StreamInfo);

    if (FAILED(hr))
    {
        LogError("CAVIFileWriter::CAVIFileWriter "
                 "failed to create audio stream");

        AVIFileRelease(m_pAVIFile);
        m_pAVIFile = NULL;

        return hr;
    }

    //
    // set format for the stream
    //

    hr = AVIStreamSetFormat(m_pAudioStream,
                            0,
                            (void*)&WaveFormat,
                            sizeof(WaveFormat) + WaveFormat.cbSize);

    if ( FAILED(hr))
    {
        LogError("Failed to set stream format");

        AVIFileRelease(m_pAVIFile);
        m_pAVIFile = NULL;

        AVIStreamRelease(m_pAudioStream);
        m_pAudioStream = NULL;

        return hr;
    }

    LogMessage("CAVIFileWriter::Initialize succeeded");

    return S_OK;

}

HRESULT CAVIFileWriter::Write | ( | IN BYTE * | pBuffer,
 |  | IN ULONG | nBytesToWrite,
 |  | IN OUT ULONG * | pnBytesWritten
 | ) |  |

Definition at line 223 of file avifilewriter.cpp.

{

    if ( (NULL == m_pAudioStream) || (NULL == m_pAVIFile))
    {
        LogError("CAVIFileWriter::Write file or stream is not open");

        return E_UNEXPECTED;
    }

    //
    // AVIStreamWrite wants the number of samples we are recording
    //

    LONG nSamples2Write = nBytesToWrite / m_nSampleSize;

    //
    // write to file until dumped the whole buffer of until failure
    //

    HRESULT hr = S_OK;

    ULONG nTotalBytesWritten = 0;

    while ((hr == S_OK) && (nTotalBytesWritten < nBytesToWrite))
    {

        //
        // bytes and samples written with the call
        //

        LONG nBytesWritten = 0;

        LONG nSamplesWritten = 0;

        hr = AVIStreamWrite(m_pAudioStream,
                            -1,              // append at the end of the stream
                            nSamples2Write,  // how many samples to write
                            pBuffer,         // where the data is
                            nBytesToWrite,   // how much data do we have
                            AVIIF_KEYFRAME,  // self-sufficient data
                            &nSamplesWritten,// how many samples were written
                            &nBytesWritten); // how many bytes were written

        //
        // keep track of how many bytes made it into the file
        //

        nTotalBytesWritten += nBytesWritten;

    }

    //
    // will return the number of bytes written
    //

    if (NULL != pnBytesWritten)
    {
        *pnBytesWritten = nTotalBytesWritten;
    }

    //
    // either dumped the whole buffer or failed.
    //

    if (FAILED(hr))
    {

        LogError("CAVIFileWriter::Write Failed to write buffer hr = 0x%lx, "
                 "wrote %ld bytes", hr, nTotalBytesWritten);
    }
    else
    {

        LogMessage("CAVIFileWriter::Write Succeeded. Wrote %ld bytes",
                    nTotalBytesWritten);
    }

    return hr;

}

Member Data Documentation

LONG CAVIFileWriter::m_nSampleSize [private]

Definition at line 79 of file avifilewriter.h.

PAVISTREAM CAVIFileWriter::m_pAudioStream [private]

Definition at line 72 of file avifilewriter.h.

PAVIFILE CAVIFileWriter::m_pAVIFile [private]

Definition at line 65 of file avifilewriter.h.

The documentation for this class was generated from the following files:
  • NetDS/Tapi/Tapi3/Cpp/tapirecv/avifilewriter.h
  • NetDS/Tapi/Tapi3/Cpp/tapirecv/avifilewriter.cpp
Generated on Wed Nov 13 2024 16:55:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CBackground Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Types | Private Attributes | Static Private Attributes

CBackground Class Reference

#include "backgrnd.h"

Inherits CDelegationBase, CDelegationBase, and CDelegationBase.

List of all members.

Public Member Functions

CBackground (int id)
CBackground (int id)
CBackground (int id)
virtual | ~CBackground ()
virtual | ~CBackground ()
virtual | ~CBackground ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
HSCOPEITEM | GetHandle ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
void | SetHandle (HSCOPEITEM itemId)

Private Types

enum | { IDM_NEW_BACKGROUND = 6 }
enum | { IDM_NEW_BACKGROUND = 6 }
enum | { IDM_NEW_BACKGROUND = 6 }

Private Attributes

int | m_id
HSCOPEITEM | m_itemId

Static Private Attributes

static const GUID | thisGuid = { 0x2974380f, 0x4c4b, 0x11d2, { 0x89, 0xd8, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28 } }

Detailed Description

Definition at line 25 of file backgrnd.h.

Member Enumeration Documentation

anonymous enum [private]
Enumerator:
IDM_NEW_BACKGROUND

Definition at line 35 of file backgrnd.h.

{ IDM_NEW_BACKGROUND = 6 };

anonymous enum [private]
Enumerator:
IDM_NEW_BACKGROUND

Definition at line 35 of file backgrnd.h.

{ IDM_NEW_BACKGROUND = 6 };

anonymous enum [private]
Enumerator:
IDM_NEW_BACKGROUND

Definition at line 38 of file backgrnd.h.

{ IDM_NEW_BACKGROUND = 6 };

Constructor & Destructor Documentation

CBackground::CBackground ( int id ) [inline]

Definition at line 27 of file backgrnd.h.

: m_itemId(NULL), m_id(id) { }

virtual CBackground::~CBackground ( ) [inline, virtual]

Definition at line 28 of file backgrnd.h.

{}

CBackground::CBackground ( int id ) [inline]

Definition at line 27 of file backgrnd.h.

: m_itemId(NULL), m_id(id) { }

virtual CBackground::~CBackground ( ) [inline, virtual]

Definition at line 28 of file backgrnd.h.

{}

CBackground::CBackground ( int id ) [inline]

Definition at line 27 of file backgrnd.h.

: m_itemId(NULL), m_id(id) { }

virtual CBackground::~CBackground ( ) [inline, virtual]

Definition at line 28 of file backgrnd.h.

{}

Member Function Documentation

virtual const int CBackground::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 32 of file backgrnd.h.

{ return INDEX_BACKGROUND; }

virtual const int CBackground::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 32 of file backgrnd.h.

{ return INDEX_BACKGROUND; }

virtual const int CBackground::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 32 of file backgrnd.h.

{ return INDEX_BACKGROUND; }

virtual const _TCHAR* CBackground::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

const _TCHAR * CBackground::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

Definition at line 265 of file backgrnd.Cpp.

{
    static _TCHAR buf[128];

    _stprintf(buf, _T("Background object #%d"), m_id);

    return buf;
}

virtual const _TCHAR* CBackground::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

HSCOPEITEM CBackground::GetHandle ( ) [inline]

Reimplemented from CDelegationBase.

Definition at line 35 of file backgrnd.h.

{ return m_itemId; }

virtual const GUID& CBackground::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 31 of file backgrnd.h.

{ return thisGuid; }

virtual const GUID& CBackground::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 31 of file backgrnd.h.

{ return thisGuid; }

virtual const GUID& CBackground::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 31 of file backgrnd.h.

{ return thisGuid; }

void CBackground::SetHandle ( HSCOPEITEM itemId ) [inline]

Definition at line 34 of file backgrnd.h.

{ m_itemId = itemId; }

Member Data Documentation

int CBackground::m_id [private]

Definition at line 38 of file backgrnd.h.

HSCOPEITEM CBackground::m_itemId [private]

Definition at line 39 of file backgrnd.h.

static const GUID CBackground::thisGuid = { 0x2974380f, 0x4c4b, 0x11d2, { 0x89, 0xd8, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28 } } [static, private]

Reimplemented from CDelegationBase.

Definition at line 37 of file backgrnd.h.

The documentation for this class was generated from the following files:
  • SysMgmt/MMC/CutCopy/backgrnd.h
  • SysMgmt/MMC/Multisel/backgrnd.h
  • SysMgmt/MMC/Nodes/backgrnd.h
  • SysMgmt/MMC/CutCopy/backgrnd.Cpp
  • SysMgmt/MMC/Multisel/backgrnd.Cpp
  • SysMgmt/MMC/Nodes/backgrnd.Cpp
Generated on Wed Nov 13 2024 16:55:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CBackgroundCopyCallback Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CBackgroundCopyCallback Class Reference

List of all members.

Public Member Functions

virtual ULONG STDMETHODCALLTYPE | AddRef (void)
virtual HRESULT STDMETHODCALLTYPE | CreateInstance (IUnknown *pUnkOuter, REFIID riid, void **ppvObject)
virtual HRESULT STDMETHODCALLTYPE | JobError (IBackgroundCopyJob *pJob, IBackgroundCopyError *pError)
virtual HRESULT STDMETHODCALLTYPE | JobModification (IBackgroundCopyJob *pJob, DWORD dwReserved)
virtual HRESULT STDMETHODCALLTYPE | JobTransferred (IBackgroundCopyJob *pJob)
virtual HRESULT STDMETHODCALLTYPE | QueryInterface (REFIID riid, void **ppvObject)
virtual ULONG STDMETHODCALLTYPE | Release (void)

Detailed Description

Definition at line 1315 of file bits_ie.cpp.

Member Function Documentation

virtual ULONG STDMETHODCALLTYPE CBackgroundCopyCallback::AddRef ( void ) [inline, virtual]

Definition at line 1360 of file bits_ie.cpp.

    {
        return 0;
    }

virtual HRESULT STDMETHODCALLTYPE CBackgroundCopyCallback::CreateInstance | ( | IUnknown * | pUnkOuter,
 |  | REFIID | riid,
 |  | void ** | ppvObject |
 | ) |  |  | [inline, virtual]

Definition at line 1343 of file bits_ie.cpp.

    {

        if ( pUnkOuter )
            return CLASS_E_NOAGGREGATION;

        return QueryInterface( riid, ppvObject );

    }

virtual HRESULT STDMETHODCALLTYPE CBackgroundCopyCallback::JobError | ( | IBackgroundCopyJob * | pJob,
 |  | IBackgroundCopyError * | pError |
 | ) |  |  | [inline, virtual]

Definition at line 1374 of file bits_ie.cpp.

    {
        return HandleCOMCallback( pJob, true );
    }

virtual HRESULT STDMETHODCALLTYPE CBackgroundCopyCallback::JobModification | ( | IBackgroundCopyJob * | pJob,
 |  | DWORD | dwReserved |
 | ) |  |  | [inline, virtual]

Definition at line 1379 of file bits_ie.cpp.

    {
        return HandleCOMCallback( pJob, true );
    }

virtual HRESULT STDMETHODCALLTYPE CBackgroundCopyCallback::JobTransferred ( IBackgroundCopyJob * pJob ) [inline, virtual]

Definition at line 1369 of file bits_ie.cpp.

    {
        return HandleCOMCallback( pJob, true );
    }

virtual HRESULT STDMETHODCALLTYPE CBackgroundCopyCallback::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppvObject |
 | ) |  |  | [inline, virtual]

Definition at line 1323 of file bits_ie.cpp.

    {

        if ( riid == _uuidof(IUnknown) )
            {
            *ppvObject = (IUnknown*)(IBackgroundCopyCallback*)this;
            return S_OK;
            }

        else if ( riid == _uuidof(IBackgroundCopyCallback) )
            {
            *ppvObject = (IBackgroundCopyCallback*)this;
            return S_OK;
            }

        else
            return E_NOINTERFACE;

    }

virtual ULONG STDMETHODCALLTYPE CBackgroundCopyCallback::Release ( void ) [inline, virtual]

Definition at line 1364 of file bits_ie.cpp.

    {
        return 0;
    }

The documentation for this class was generated from the following file:
  • Web/bits/bits_ie/bits_ie.cpp
Generated on Wed Nov 13 2024 16:55:37 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CBackgroundFolder Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes

CBackgroundFolder Class Reference

#include "backgrnd.h"

Inherits CDelegationBase, CDelegationBase, and CDelegationBase.

List of all members.

Public Member Functions

CBackgroundFolder ()
CBackgroundFolder ()
CBackgroundFolder ()
virtual | ~CBackgroundFolder ()
virtual | ~CBackgroundFolder ()
virtual | ~CBackgroundFolder ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual HRESULT | OnAddImages (IImageList *pImageList, HSCOPEITEM hsi)
virtual HRESULT | OnAddImages (IImageList *pImageList, HSCOPEITEM hsi)
virtual HRESULT | OnAddImages (IImageList *pImageList, HSCOPEITEM hsi)
virtual HRESULT | OnExpand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
virtual HRESULT | OnExpand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
virtual HRESULT | OnExpand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
virtual HRESULT | OnRefresh ()
virtual HRESULT | OnRefresh ()
virtual HRESULT | OnRefresh ()
virtual HRESULT | OnSelect (IConsole *pConsole, BOOL bScope, BOOL bSelect)
virtual HRESULT | OnSelect (IConsole *pConsole, BOOL bScope, BOOL bSelect)
virtual HRESULT | OnSelect (IConsole *pConsole, BOOL bScope, BOOL bSelect)

Private Types

enum | { MAX_CHILDREN = 30 }
enum | { MAX_CHILDREN = 30 }
enum | { MAX_CHILDREN = 30 }

Private Member Functions

void | AddItem (int id)
void | AddItem (int id)
void | AddItem (int id)
void | StartThread ()
void | StartThread ()
void | StartThread ()
void | StopThread ()
void | StopThread ()
void | StopThread ()

Static Private Member Functions

static DWORD WINAPI | ThreadProc (LPVOID lpParameter)
static DWORD WINAPI | ThreadProc (LPVOID lpParameter)
static DWORD WINAPI | ThreadProc (LPVOID lpParameter)
static LRESULT CALLBACK | WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
static LRESULT CALLBACK | WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
static LRESULT CALLBACK | WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)

Private Attributes

HWND | m_backgroundHwnd
bool | m_bSelected
bool | m_bViewUpdated
CBackground * | m_children [MAX_CHILDREN]
CRITICAL_SECTION | m_critSect
IConsoleNameSpace * | m_pConsoleNameSpace
bool | m_running
HSCOPEITEM | m_scopeitem
HANDLE m_thread
DWORD m_threadId

Static Private Attributes

static const GUID | thisGuid = { 0x2974380f, 0x4c4b, 0x11d2, { 0x89, 0xd8, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28 } }

Detailed Description

Definition at line 42 of file backgrnd.h.

Member Enumeration Documentation

anonymous enum [private]
Enumerator:
MAX_CHILDREN

Definition at line 59 of file backgrnd.h.

{ MAX_CHILDREN = 30 };

anonymous enum [private]
Enumerator:
MAX_CHILDREN

Definition at line 59 of file backgrnd.h.

{ MAX_CHILDREN = 30 };

anonymous enum [private]
Enumerator:
MAX_CHILDREN

Definition at line 62 of file backgrnd.h.

{ MAX_CHILDREN = 30 };

Constructor & Destructor Documentation

CBackgroundFolder::CBackgroundFolder ( )

Definition at line 33 of file backgrnd.Cpp.

: m_pConsoleNameSpace(NULL), m_scopeitem(0), m_threadId(0), m_thread(NULL),
m_running(false), m_bViewUpdated(false)
{
    ZeroMemory(m_children, sizeof(m_children));

    WNDCLASS wndClass;

    ZeroMemory(&wndClass, sizeof(WNDCLASS));

    wndClass.lpfnWndProc = WindowProc;
    wndClass.lpszClassName = _T("backgroundthreadwindow");
    wndClass.hInstance = g_hinst;

    ATOM atom = RegisterClass(&wndClass);
    m_backgroundHwnd = CreateWindow(
            _T("backgroundthreadwindow"),  // pointer to registered class name
            NULL, // pointer to window name
            0,        // window style
            0,                // horizontal position of window
            0,                // vertical position of window
            0,           // window width
            0,          // window height
            NULL,      // handle to parent or owner window
            NULL,          // handle to menu or child-window identifier
            g_hinst,     // handle to application instance
            (void *)this        // pointer to window-creation data
        );

    if (m_backgroundHwnd)
        SetWindowLong(m_backgroundHwnd, GWL_USERDATA, (LONG)this);

    InitializeCriticalSection(&m_critSect);
}

CBackgroundFolder::~CBackgroundFolder ( ) [virtual]

Definition at line 68 of file backgrnd.Cpp.

{
    StopThread();

    for (int n = 0; n < MAX_CHILDREN; n++)
        if (m_children[n] != NULL)
            delete m_children[n];

    if (m_backgroundHwnd != NULL)
        DestroyWindow(m_backgroundHwnd);

    UnregisterClass(_T("backgroundthreadwindow"), NULL);

    DeleteCriticalSection(&m_critSect);
}

CBackgroundFolder::CBackgroundFolder ( )
virtual CBackgroundFolder::~CBackgroundFolder ( ) [virtual]
CBackgroundFolder::CBackgroundFolder ( )
virtual CBackgroundFolder::~CBackgroundFolder ( ) [virtual]

Member Function Documentation

void CBackgroundFolder::AddItem ( int id ) [private]

Definition at line 162 of file backgrnd.Cpp.

{
    HRESULT hr;

    EnterCriticalSection(&m_critSect);

    _ASSERT(m_children[id] == NULL);

    m_children[id] = new CBackground(id);

    SCOPEDATAITEM sdi;

    // insert items here
    ZeroMemory(&sdi, sizeof(SCOPEDATAITEM));

    sdi.mask = SDI_STR       |   // Displayname is valid
        SDI_PARAM     |   // lParam is valid
        SDI_IMAGE     |   // nImage is valid
        SDI_OPENIMAGE |   // nOpenImage is valid
        SDI_PARENT    |
        SDI_CHILDREN;

    sdi.relativeID  = (HSCOPEITEM)m_scopeitem;
    sdi.nImage      = m_children[id]->GetBitmapIndex();
    sdi.nOpenImage  = INDEX_OPENFOLDER;
    sdi.displayname = MMC_CALLBACK;
    sdi.lParam      = (LPARAM)m_children[id];       // The cookie
    sdi.cChildren   = 0;

    hr = m_pConsoleNameSpace->InsertItem( &sdi );
    _ASSERT( SUCCEEDED(hr) );

    m_children[id]->SetHandle((HANDLE)sdi.ID);

    LeaveCriticalSection(&m_critSect);

    return;
}

void CBackgroundFolder::AddItem ( int id ) [private]
void CBackgroundFolder::AddItem ( int id ) [private]
virtual const int CBackgroundFolder::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 49 of file backgrnd.h.

{ return INDEX_BACKGROUND; }

virtual const int CBackgroundFolder::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 49 of file backgrnd.h.

{ return INDEX_BACKGROUND; }

virtual const int CBackgroundFolder::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 52 of file backgrnd.h.

{ return INDEX_BACKGROUND; }

virtual const _TCHAR* CBackgroundFolder::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 50 of file backgrnd.h.

{ return _T("Background Objects"); }

virtual const _TCHAR* CBackgroundFolder::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 47 of file backgrnd.h.

{ return _T("Background Objects"); }

virtual const _TCHAR* CBackgroundFolder::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 47 of file backgrnd.h.

{ return _T("Background Objects"); }

virtual const GUID& CBackgroundFolder::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 48 of file backgrnd.h.

{ return thisGuid; }

virtual const GUID& CBackgroundFolder::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 51 of file backgrnd.h.

{ return thisGuid; }

virtual const GUID& CBackgroundFolder::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 48 of file backgrnd.h.

{ return thisGuid; }

virtual HRESULT CBackgroundFolder::OnAddImages | ( | IImageList * | pImageList,
 |  | HSCOPEITEM | hsi |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

HRESULT CBackgroundFolder::OnAddImages | ( | IImageList * | pImageList,
 |  | HSCOPEITEM | hsi |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 201 of file backgrnd.Cpp.

{
    return pImageList->ImageListSetStrip((long *)m_pBMapSm, // pointer to a handle
        (long *)m_pBMapLg, // pointer to a handle
        0, // index of the first image in the strip
        RGB(0, 128, 128)  // color of the icon mask
        );
}

virtual HRESULT CBackgroundFolder::OnAddImages | ( | IImageList * | pImageList,
 |  | HSCOPEITEM | hsi |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CBackgroundFolder::OnExpand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

HRESULT CBackgroundFolder::OnExpand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 210 of file backgrnd.Cpp.

{
    // cache the stuff
    m_pConsoleNameSpace = pConsoleNameSpace;
    m_scopeitem = parent;

    if (m_bViewUpdated == false && m_running == false)
        StartThread();

    return S_OK;
}

virtual HRESULT CBackgroundFolder::OnExpand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

HRESULT CBackgroundFolder::OnRefresh ( ) [virtual]

Reimplemented from CDelegationBase.

Definition at line 240 of file backgrnd.Cpp.

{
    HRESULT hr = S_OK;

    StopThread();

    EnterCriticalSection(&m_critSect);
    for (int n = 0; n < MAX_CHILDREN; n++) {
        if (m_children[n] != NULL) {
            HSCOPEITEM hItem = (HSCOPEITEM)m_children[n]->GetHandle();
            hr = m_pConsoleNameSpace->DeleteItem(hItem, TRUE);

            delete m_children[n];
            m_children[n] = NULL;
        }
    }
    LeaveCriticalSection(&m_critSect);

    m_bViewUpdated = false;

    StartThread();

    return S_OK;
}

virtual HRESULT CBackgroundFolder::OnRefresh ( ) [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CBackgroundFolder::OnRefresh ( ) [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CBackgroundFolder::OnSelect | ( | IConsole * | pConsole,
 |  | BOOL | bScope,
 |  | BOOL | bSelect |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

HRESULT CBackgroundFolder::OnSelect | ( | IConsole * | pConsole,
 |  | BOOL | bScope,
 |  | BOOL | bSelect |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 222 of file backgrnd.Cpp.

{
    m_bSelected = (bSelect && bScope) ? true : false;

    if (bSelect && !m_running) {
        IConsoleVerb *pConsoleVerb;

        HRESULT hr = pConsole->QueryConsoleVerb(&pConsoleVerb);
        _ASSERT(SUCCEEDED(hr));

        hr = pConsoleVerb->SetVerbState(MMC_VERB_REFRESH, ENABLED, TRUE);

        pConsoleVerb->Release();
    }

    return S_OK;
}

virtual HRESULT CBackgroundFolder::OnSelect | ( | IConsole * | pConsole,
 |  | BOOL | bScope,
 |  | BOOL | bSelect |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

void CBackgroundFolder::StartThread ( ) [private]

Definition at line 136 of file backgrnd.Cpp.

{
    EnterCriticalSection(&m_critSect);
    m_thread = CreateThread(NULL, 0, ThreadProc, (void *)this, 0, &m_threadId);
    LeaveCriticalSection(&m_critSect);
}

void CBackgroundFolder::StartThread ( ) [private]
void CBackgroundFolder::StartThread ( ) [private]
void CBackgroundFolder::StopThread ( ) [private]

Definition at line 143 of file backgrnd.Cpp.

{
    EnterCriticalSection(&m_critSect);
    m_running = false;

    if (m_thread != NULL) {
        // this is ugly, wait for 10 seconds, then kill the thread
        DWORD res = WaitForSingleObject(m_thread, 10000);

        if (res == WAIT_TIMEOUT)
            TerminateThread(m_thread, 0);

        CloseHandle(m_thread);

        m_thread = NULL;
    }
    LeaveCriticalSection(&m_critSect);
}

void CBackgroundFolder::StopThread ( ) [private]
void CBackgroundFolder::StopThread ( ) [private]
static DWORD WINAPI CBackgroundFolder::ThreadProc ( LPVOID lpParameter ) [static, private]
DWORD WINAPI CBackgroundFolder::ThreadProc ( LPVOID lpParameter ) [static, private]

Definition at line 109 of file backgrnd.Cpp.

{
    CBackgroundFolder *pThis = (CBackgroundFolder *)lpParameter;

    EnterCriticalSection(&pThis->m_critSect);
    pThis->m_running = true;
    LeaveCriticalSection(&pThis->m_critSect);

    for (int n = 0; n < MAX_CHILDREN; n++) {
        EnterCriticalSection(&pThis->m_critSect);
        bool running = pThis->m_running;
        LeaveCriticalSection(&pThis->m_critSect);

        if (running == false)
            return 0;

        PostMessage(pThis->m_backgroundHwnd, WM_NEWOBJECT, 0, n);
        Sleep(500);
    }

    PostMessage(pThis->m_backgroundHwnd, WM_DISCOVERYCOMPLETE, 0, 0);

    return 0;
}

static DWORD WINAPI CBackgroundFolder::ThreadProc ( LPVOID lpParameter ) [static, private]
LRESULT CALLBACK CBackgroundFolder::WindowProc | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static, private]

Definition at line 84 of file backgrnd.Cpp.

{
    CBackgroundFolder *pThis = (CBackgroundFolder *)GetWindowLong(hwnd, GWL_USERDATA);

    switch (uMsg) {
    case WM_NEWOBJECT:
        _ASSERT(pThis != NULL);
        pThis->AddItem(lParam);
        break;

    case WM_DISCOVERYCOMPLETE:
        _ASSERT(pThis != NULL);
        pThis->m_bViewUpdated = true;
        pThis->StopThread();
        break;
   }

    return DefWindowProc(hwnd, uMsg, wParam, lParam);
}

static LRESULT CALLBACK CBackgroundFolder::WindowProc | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static, private]
static LRESULT CALLBACK CBackgroundFolder::WindowProc | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static, private]

Member Data Documentation

HWND CBackgroundFolder::m_backgroundHwnd [private]

Definition at line 63 of file backgrnd.h.

bool CBackgroundFolder::m_bSelected [private]

Definition at line 91 of file backgrnd.h.

bool CBackgroundFolder::m_bViewUpdated [private]

Definition at line 92 of file backgrnd.h.

CBackground * CBackgroundFolder::m_children [private]

Definition at line 61 of file backgrnd.h.

CRITICAL_SECTION CBackgroundFolder::m_critSect [private]

Definition at line 86 of file backgrnd.h.

IConsoleNameSpace * CBackgroundFolder::m_pConsoleNameSpace [private]

Definition at line 82 of file backgrnd.h.

bool CBackgroundFolder::m_running [private]

Definition at line 80 of file backgrnd.h.

HSCOPEITEM CBackgroundFolder::m_scopeitem [private]

Definition at line 83 of file backgrnd.h.

HANDLE CBackgroundFolder::m_thread [private]

Definition at line 79 of file backgrnd.h.

DWORD CBackgroundFolder::m_threadId [private]

Definition at line 78 of file backgrnd.h.

static const GUID CBackgroundFolder::thisGuid = { 0x2974380f, 0x4c4b, 0x11d2, { 0x89, 0xd8, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28 } } [static, private]

Reimplemented from CDelegationBase.

Definition at line 65 of file backgrnd.h.

The documentation for this class was generated from the following files:
  • SysMgmt/MMC/CutCopy/backgrnd.h
  • SysMgmt/MMC/Multisel/backgrnd.h
  • SysMgmt/MMC/Nodes/backgrnd.h
  • SysMgmt/MMC/CutCopy/backgrnd.Cpp
  • SysMgmt/MMC/Multisel/backgrnd.Cpp
  • SysMgmt/MMC/Nodes/backgrnd.Cpp
Generated on Wed Nov 13 2024 16:55:37 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CBankDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Private Member Functions | Private Attributes

CBankDlg Class Reference

#include "bankdlg.h"

List of all members.

Public Types

enum | { IDD = IDD_BANKDLG }

Public Member Functions

CBankDlg ()
~CBankDlg ()
void | GetThreadData (THREADDATA *pTd)
BOOL LoadAll ()
LRESULT | OnAdd (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnAssertOnErrors (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnClose (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
LRESULT | OnCopy (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnCopyAll (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnCopyErrors (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnCreateRows (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnCreateTables (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnDestroy (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
LRESULT | OnGo (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnInitDialog (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
LRESULT | OnInitMenu (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
LRESULT | OnKillThreads (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnOK (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnRandom (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnRemove (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnRetryOnErrors (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnRunSuite (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnSave (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnSelectAccount (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnSelectChattyDisplay (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnSelectCoInit (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnSelectCreatePerIteration (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnSelectLanguage (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnSelectMoveMoney (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnShowError (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
LRESULT | OnShowResults (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
LRESULT | OnSize (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
LRESULT | OnStop (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnStopOnODBCErrors (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnViewNext (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnViewPrev (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
BOOL SaveAll ()
void | SetThreadData (THREADDATA *pTd)

Private Member Functions

void | ConsumeAllMessages ()
void | DoWork (CThreadData *pData, int nTestType)
void | SetDescription (THREADDATA *pData)
void | UpdateStatus (CThreadData *pData, int nCurItem)

Private Attributes

CREATEDATA m_cd
HANDLE m_hCreateThread
HANDLE m_hFile
HMENU | m_hMenu
CListHeader m_list
int | m_nMaxRowLength
int | m_nMsgs
int | m_nSuiteIndex
int | m_nTotalTests
CThreadData * m_pCurrentThreadData

Detailed Description

Definition at line 115 of file bankdlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 145 of file bankdlg.h.

{ IDD = IDD_BANKDLG };

Constructor & Destructor Documentation

CBankDlg::CBankDlg ( )

Definition at line 96 of file bankdlg.Cpp.

{

  m_nSuiteIndex = -1;
  m_nTotalTests = sizeof(g_pSuite)/ sizeof(g_pSuite[0]);
  m_hCreateThread = NULL;
  m_cd.bDone = TRUE; // the create data thread is not running
  m_hMenu = NULL;
  QueryPerformanceFrequency ( &g_PerfFreq);
  m_nMaxRowLength = 0;
  m_hFile = NULL;
  m_nMsgs = 0;

}

CBankDlg::~CBankDlg ( )

Definition at line 117 of file bankdlg.Cpp.

{

  if (m_hFile)
  {
    CloseHandle(m_hFile);
    m_hFile = NULL;
  }

  SaveAll();

}

Member Function Documentation

void CBankDlg::ConsumeAllMessages ( ) [private]

Definition at line 498 of file bankdlg.Cpp.

{
  MSG msg;

  while ( PeekMessage( &msg, m_hWnd, 0, 0, PM_REMOVE ) )
  {
    if (!TranslateAccelerator(m_hWnd, g_hAccel, &msg))
    {
      if (!::IsDialogMessage(m_hWnd, &msg))
      {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
      }
    }

  }

}

void CBankDlg::DoWork | ( | CThreadData * | pData,
 |  | int | nTestType |
 | ) |  |  | [private]

Definition at line 539 of file bankdlg.Cpp.

{

  POINT pt;
  ::SetClassLong(m_hWnd, GCL_HCURSOR, (long)LoadCursor(NULL, IDC_APPSTARTING));
  GetCursorPos(&pt);
  SetCursorPos(pt.x, pt.y);

  g_bStop = FALSE;

  DWORD dwThreadId;
  _ASSERTE(g_hWndResults);
  switch (nTestType)
  {

    case MOVEMONEY:
    {
      g_nThreadsRunning = (pData -> GetThreadData()) -> nThreads;
      g_pHandles = new HANDLE[g_nThreadsRunning];
      for (int i=0; i<g_nThreadsRunning; i++)
      {
        g_pHandles[i] = CreateThread( NULL, 0, MoveMoneyThread, (void *)pData -> GetThreadData(), NULL, &dwThreadId);
      }
      break;
    }
    case ACCOUNT:
    {
      g_nThreadsRunning = (pData -> GetThreadData()) -> nThreads;
      g_pHandles = new HANDLE[g_nThreadsRunning];
      for (int i=0; i<g_nThreadsRunning; i++)
      {
        g_pHandles[i] = CreateThread( NULL, 0, AccountThread, (void *)pData -> GetThreadData(), NULL, &dwThreadId);
      }
      break;
    }
    case VERIFY_SCHEMA:
      g_nThreadsRunning = 1;
      g_pHandles = new HANDLE[g_nThreadsRunning];
      *g_pHandles = CreateThread( NULL, 0, CreateSchemaThread, (void *)NULL, NULL, &dwThreadId);
      break;
    case CREATEROWS:
      g_nThreadsRunning = 1;
      g_pHandles = new HANDLE[g_nThreadsRunning];
      g_nRows = GetDlgItemInt(IDC_ROWS);
      *g_pHandles = CreateThread( NULL, 0, CreateRowsThread, (void *)g_nRows, NULL, &dwThreadId);
      break;

    default:
      _ASSERTE(0);
  }

  DWORD dwRet;
  int nFinishedThead = 0;
  while (nFinishedThead <  g_nThreadsRunning)
  {
    //
    //  we wait until all threads are signaled, but we wait for them one at a time
    //  (a thread is signaled when it exits, and stays that way)...here we wait
    //  for the first thread to exit, and then wait on the second. if it has already
    //  exited, MsgWaitForMultipleObjects emmediately returns, and we wait for the next thread
    //  and so on
    //
    dwRet = MsgWaitForMultipleObjects(1, g_pHandles + nFinishedThead, FALSE, INFINITE, QS_ALLINPUT);
    if (dwRet == WAIT_OBJECT_0)
    {
      //
      //   a thread finished
      //
      nFinishedThead++;
    }
    else
    {
      ConsumeAllMessages();
    }
  }

  ConsumeAllMessages();       // there may be messages in the Q that haven't been processed since the last thread exited
  g_nThreadsRunning = 0;
  delete [] g_pHandles;

  g_pHandles = NULL;
  HCURSOR hCur = LoadCursor(NULL, IDC_ARROW);
  SetClassLong(m_hWnd, GCL_HCURSOR, (long)hCur);
  SetCursor(hCur);
  GetCursorPos(&pt);
  SetCursorPos(pt.x, pt.y);

}

void CBankDlg::GetThreadData ( THREADDATA * pTd )

Definition at line 712 of file bankdlg.Cpp.

{
  if (!pTd)
  {
    _ASSERTE(0);
    return;
  }

  //
  //  get all settings from current settings except for the new UI elements
  //

  if (pTd != m_pCurrentThreadData -> GetThreadData())
  {
    memcpy(pTd, m_pCurrentThreadData -> GetThreadData(), sizeof *pTd);
  }
  pTd -> nFrom = GetDlgItemInt(IDC_FROM);
  pTd -> nTo = GetDlgItemInt(IDC_TO);
  pTd -> nIters = GetDlgItemInt(IDC_ITERS);
  pTd -> nAmount = GetDlgItemInt(IDC_AMOUNT);
  pTd -> nThreads = GetDlgItemInt(IDC_THREADS);

}

BOOL CBankDlg::LoadAll ( )

Definition at line 1058 of file bankdlg.Cpp.

{

  char szDir[MAX_PATH];
  ZeroMemory(szDir, MAX_PATH * sizeof(char));
  GetWindowsDirectoryA(szDir, MAX_PATH);
  strncat(szDir, "\\vcbank.dat", sizeof("\\vcbank.dat"));
  ifstream ifs( szDir, ios::in | ios::binary , filebuf::sh_none    );

  int version = 0;

  ifs.read((BYTE *)&version, sizeof(version));

  CThreadData * pData = NULL;
  if (version != FILE_VERSION)
  {
    // use defaults

    g_nRows = 0;

    int i;
    for (i=0; i<m_nTotalTests; i++)
    {
      pData = new CThreadData(&g_pSuite[i]);
      m_list.InsertLast(pData);
    }

  ShowWindow(SW_SHOWNORMAL);
  SetDlgItemInt(IDC_ROWS, 100);
  DoWork(pData, VERIFY_SCHEMA);
  DoWork(pData, CREATEROWS);

    return TRUE;
  }

  ifs.read((BYTE *)&m_nTotalTests, sizeof(m_nTotalTests));
  ifs.read((BYTE *)&g_bAssertOnErrors, sizeof(g_bAssertOnErrors));
  ifs.read((BYTE *)&g_bStopOnODBCErrors, sizeof(g_bStopOnODBCErrors));
  ifs.read((BYTE *)&g_nRows, sizeof(g_nRows));
  ifs.read((BYTE *)&g_bRetry, sizeof(BOOL));

  int nWidth;
  int i;

  for (i=0;i<NUMBER_OF_COLUMNS; i++)
  {
    ifs.read((BYTE*)&nWidth, sizeof(int));
    ListView_SetColumnWidth(g_hWndResults, i, nWidth);
  }

  WINDOWPLACEMENT wp;
  ZeroMemory(&wp, sizeof wp);
  wp.length = sizeof(wp);
  ifs.read((BYTE *)&wp, sizeof wp);
  SetWindowPlacement(&wp);

  THREADDATA td;

  for (i=0; i< (int)m_nTotalTests; i++)
  {
    ifs.read((char *)&td, sizeof(THREADDATA));
    pData = new CThreadData(&td);
    m_list.InsertLast(pData);
  }

  return TRUE;

}

LRESULT CBankDlg::OnAdd | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 1143 of file bankdlg.Cpp.

{

  CThreadData * pData = new CThreadData();
  GetThreadData(pData -> GetThreadData());
  m_list.InsertLast(pData);
  m_pCurrentThreadData = pData;
  m_nTotalTests++;
  m_nSuiteIndex = m_nTotalTests - 1;
  UpdateStatus(m_pCurrentThreadData, m_nSuiteIndex);
  return 0;
}

LRESULT CBankDlg::OnAssertOnErrors | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 415 of file bankdlg.Cpp.

{
  g_bAssertOnErrors = 1 - g_bAssertOnErrors;
  SetDescription(m_pCurrentThreadData -> GetThreadData());
  return 0;
}

LRESULT CBankDlg::OnClose | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 521 of file bankdlg.Cpp.

{
  g_bStop = TRUE;

  for (int i = 0; i< g_nThreadsRunning; i++)
  {
    TerminateThread(g_pHandles[i] ,666);
  }
  PostQuitMessage(0);
  EndDialog(0);
  return 0;
}

LRESULT CBankDlg::OnCopy | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 1325 of file bankdlg.Cpp.

{
  UINT nSel = ListView_GetSelectedCount( g_hWndResults);

  int nChars = (nSel + 1)* (m_nMaxRowLength + 32);

  HANDLE hMem = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE , sizeof(WCHAR) * nChars);
  WCHAR * buf = (WCHAR *)GlobalLock(hMem);
  ZeroMemory(buf, nChars * sizeof(WCHAR));
  WCHAR * p = buf;
  int nItem = -1;
  int nCol;
  int nLen = 0;

  for (nCol=0;nCol<NUMBER_OF_COLUMNS; nCol++)
  {

  }

  for (;;)
  {
    nItem = ListView_GetNextItem(g_hWndResults, nItem, LVNI_ALL | LVNI_SELECTED);
    if (nItem == -1)
      break;
    for (nCol=0;nCol<NUMBER_OF_COLUMNS; nCol++)
    {
      ListView_GetItemText( g_hWndResults, nItem, nCol, p, nChars);
      nLen = lstrlen(p);
      nChars -= nLen;
      _ASSERTE(nChars > 0);
      p += nLen;
      *p++ = '\t';
      nChars--;
    }

    *p++ = '\r';
    *p++ = '\n';
    nChars -= 2;
    _ASSERTE(nChars>0);

  }

  BOOL bRet = ::OpenClipboard(NULL);
  if (bRet)
  {
    GlobalUnlock(hMem);
    SetClipboardData(CF_UNICODETEXT, hMem);
    CloseClipboard();
  }

  return 0;
}

LRESULT CBankDlg::OnCopyAll | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 1384 of file bankdlg.Cpp.

{
  UINT nCount = ListView_GetItemCount( g_hWndResults);

  int nChars = nCount * (m_nMaxRowLength + 32);
  HANDLE hMem = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE , sizeof(WCHAR) * nChars);
  WCHAR * buf = (WCHAR *)GlobalLock(hMem);
  ZeroMemory(buf, nChars * sizeof(WCHAR));
  WCHAR * p = buf;
  UINT nItem = -1;
  int nCol;
  UINT nLen = 0;
  for (nItem = 0; nItem < nCount; nItem++)
  {
    for (nCol=0;nCol<NUMBER_OF_COLUMNS; nCol++)
    {
      ListView_GetItemText( g_hWndResults, nItem, nCol, p, nChars);
      nLen = lstrlen(p);
      nChars -= nLen;
      _ASSERTE(nChars > 0);
      p += nLen;
      *p++ = '\t';
      nChars--;
    }

    *p++ = '\r';
    *p++ = '\n';
    nChars -= 2;
    _ASSERTE(nChars>0);

  }

  BOOL bRet = ::OpenClipboard(NULL);
  if (bRet)
  {
    GlobalUnlock(hMem);
    SetClipboardData(CF_UNICODETEXT, hMem);
    CloseClipboard();
  }

  return 0;
}

LRESULT CBankDlg::OnCopyErrors | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 1431 of file bankdlg.Cpp.

{
  UINT nCount = ListView_GetItemCount( g_hWndResults);
  int nChars = nCount * (m_nMaxRowLength + 32);
  HANDLE hMem = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE , sizeof(WCHAR) * nChars);
  WCHAR * buf = (WCHAR *)GlobalLock(hMem);
  ZeroMemory(buf, nChars * sizeof(WCHAR));
  WCHAR * p = buf;
  UINT nItem = -1;
  int nCol;
  UINT nLen = 0;
  int nErrors = 0;
  for (nItem = 0; nItem < nCount; nItem++)
  {
    ListView_GetItemText( g_hWndResults, nItem, ERROR_COLUMN, p, nChars);
    if (*p)
    {
      *p = NULL;
      nErrors++;
      for (nCol=0;nCol<NUMBER_OF_COLUMNS; nCol++)
      {
        ListView_GetItemText( g_hWndResults, nItem, nCol, p, nChars);
        nLen = lstrlen(p);
        nChars -= nLen;
        _ASSERTE(nChars > 0);
        p += nLen;
        *p++ = '\t';
        nChars--;
      }

      *p++ = '\r';
      *p++ = '\n';
      nChars -= 2;
      _ASSERTE(nChars>0);
    }

  }

  GlobalUnlock(hMem);
  if (nErrors == 0)
  {
    GlobalFree(hMem);
  }
  else
  {

    BOOL bRet = ::OpenClipboard(NULL);
    if (bRet)
    {
      SetClipboardData(CF_UNICODETEXT, hMem);
      CloseClipboard();
    }
  }

  return 0;
}

LRESULT CBankDlg::OnCreateRows | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 684 of file bankdlg.Cpp.

{
  SaveAll();

  //
  //  save current settings
  //
  GetThreadData(m_pCurrentThreadData -> GetThreadData());

  ListView_DeleteAllItems(g_hWndResults);
  ::EnableWindow(GetDlgItem(IDC_SUBMIT), FALSE);
  ::EnableWindow(GetDlgItem(IDC_STOP), TRUE);
  ::EnableWindow(GetDlgItem(IDC_RUN_SUITE), FALSE);

  DoWork(m_pCurrentThreadData, CREATEROWS);

  ::EnableWindow(GetDlgItem(IDC_SUBMIT), TRUE);
  ::EnableWindow(GetDlgItem(IDC_STOP), FALSE);
  ::EnableWindow(GetDlgItem(IDC_RUN_SUITE), TRUE);

  return 0;
}

LRESULT CBankDlg::OnCreateTables | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 1216 of file bankdlg.Cpp.

{
  return 0;
}

LRESULT CBankDlg::OnDestroy | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 673 of file bankdlg.Cpp.

{
  bHandled = FALSE; // continue processing
  return 0;

}

LRESULT CBankDlg::OnGo | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 645 of file bankdlg.Cpp.

{

  SaveAll();

  //
  //  save current settings
  //
  GetThreadData(m_pCurrentThreadData -> GetThreadData());

  ListView_DeleteAllItems(g_hWndResults);
  ::EnableWindow(GetDlgItem(IDC_SUBMIT), FALSE);
  ::EnableWindow(GetDlgItem(IDC_STOP), TRUE);
  ::EnableWindow(GetDlgItem(IDC_RUN_SUITE), FALSE);

  DoWork(m_pCurrentThreadData, m_pCurrentThreadData -> GetThreadData() -> nTestType);

  ::EnableWindow(GetDlgItem(IDC_SUBMIT), TRUE);
  ::EnableWindow(GetDlgItem(IDC_STOP), FALSE);
  ::EnableWindow(GetDlgItem(IDC_RUN_SUITE), TRUE);
  return 0;
}

LRESULT CBankDlg::OnInitDialog | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 141 of file bankdlg.Cpp.

{
  //
  // set global Variables
  //

  g_hWndResults = GetDlgItem(IDC_RESULTS);
  g_hWndSubmit = GetDlgItem(IDC_SUBMIT);
  g_hWndStop = GetDlgItem(IDC_STOP);
  g_hDlg = m_hWnd;

  //
  //  we always want the list to be Full Row Select --
  //  note: this only works if the user has IE 3.0 installed
  //
  DWORD dwStyle = ListView_GetExtendedListViewStyle(g_hWndResults);
  dwStyle |= LVS_EX_FULLROWSELECT;
  ListView_SetExtendedListViewStyle(g_hWndResults, dwStyle);

  m_cd.nRows = GetDlgItemInt(IDC_ROWS);
  m_cd.hWndResults = GetDlgItem(IDC_RESULTS);
  m_cd.hWndStopButton = GetDlgItem(IDC_CREATE_ROWS);

  //
  //  create the columns in our list
  //

  LV_COLUMN col;
  memset(&col,NULL, sizeof(col));
  col.mask = LVCF_TEXT|LVCF_WIDTH;
  col.fmt = LVCFMT_LEFT;
  col.cx = 40;
  col.pszText = L"Count";
  col.cchTextMax  = lstrlen(col.pszText);
  ListView_InsertColumn(m_cd.hWndResults, 0, &col);

  memset(&col,NULL, sizeof(col));
  col.mask = LVCF_TEXT|LVCF_WIDTH;
  col.fmt = LVCFMT_LEFT;
  col.cx = 60;
  col.pszText = L"ThreadId";
  col.cchTextMax  = lstrlen(col.pszText);
  ListView_InsertColumn(m_cd.hWndResults, 1, &col);

  memset(&col,NULL, sizeof(col));
  col.mask = LVCF_TEXT|LVCF_WIDTH;
  col.fmt = LVCFMT_LEFT;
  col.cx = 60;
  col.pszText = L"Error?";
  col.cchTextMax  = lstrlen(col.pszText);
  ListView_InsertColumn(m_cd.hWndResults, 2, &col);

  memset(&col,NULL, sizeof(col));
  col.mask = LVCF_TEXT|LVCF_WIDTH;
  col.fmt = LVCFMT_LEFT;
  col.cx = 600;
  col.pszText = L"Result";
  col.cchTextMax  = lstrlen(col.pszText);
  ListView_InsertColumn(m_cd.hWndResults, 3, &col);

  LoadAll();
  m_pCurrentThreadData = (CThreadData *)m_list.First();
  m_nSuiteIndex = 0 ;
  UpdateStatus(m_pCurrentThreadData, m_nSuiteIndex);
  bHandled=TRUE;
  SetDlgItemInt(IDC_ROWS, g_nRows);
  m_hMenu = LoadMenu(_Module.m_hInst, MAKEINTRESOURCE(IDR_MENU));

  if (g_bUnattended)
  {
    m_hFile = CreateFile(g_szLogFile, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
  }

  return 1;  // Let the system set the focus
}

LRESULT CBankDlg::OnInitMenu | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 766 of file bankdlg.Cpp.

{
  HMENU hMenu = (HMENU)wParam;

  THREADDATA * pTd = m_pCurrentThreadData -> GetThreadData();

  CheckMenuItem(hMenu, ID_MM_TRANSFER,
          (pTd -> nTestType == MOVEMONEY &&  pTd -> nTranType == TRANSFER) ?
          MF_BYCOMMAND|MF_CHECKED : MF_BYCOMMAND|MF_UNCHECKED);

  CheckMenuItem(hMenu, ID_MM_DEBIT,
          (pTd -> nTestType == MOVEMONEY &&  pTd -> nTranType == DEBIT) ?
          MF_BYCOMMAND|MF_CHECKED : MF_BYCOMMAND|MF_UNCHECKED);

  CheckMenuItem(hMenu, ID_MM_CREDIT,
          (pTd -> nTestType == MOVEMONEY &&  pTd -> nTranType == CREDIT) ?
          MF_BYCOMMAND|MF_CHECKED : MF_BYCOMMAND|MF_UNCHECKED);

  CheckMenuItem(hMenu, ID_AC_DEBIT,
          (pTd -> nTestType == ACCOUNT &&  pTd -> nTranType == DEBIT) ?
          MF_BYCOMMAND|MF_CHECKED : MF_BYCOMMAND|MF_UNCHECKED);

  CheckMenuItem(hMenu, IDM_RETRY,
          (g_bRetry == TRUE) ?
          MF_BYCOMMAND|MF_CHECKED : MF_BYCOMMAND|MF_UNCHECKED);

  CheckMenuItem(hMenu, ID_AC_CREDIT,
          (pTd -> nTestType == ACCOUNT &&  pTd -> nTranType == CREDIT) ?
          MF_BYCOMMAND|MF_CHECKED : MF_BYCOMMAND|MF_UNCHECKED);

  CheckMenuItem(hMenu, ID_COINIT_MTA,  (pTd -> eCoInit == CoInitMTA) ?
          MF_BYCOMMAND|MF_CHECKED : MF_BYCOMMAND|MF_UNCHECKED);

  CheckMenuItem(hMenu, ID_COINIT_STA,  (pTd -> eCoInit == CoInitSTA) ?
          MF_BYCOMMAND|MF_CHECKED : MF_BYCOMMAND|MF_UNCHECKED);

  CheckMenuItem(hMenu, ID_COINIT_RANDOM,  (pTd -> eCoInit == CoInitRandom) ?
          MF_BYCOMMAND|MF_CHECKED : MF_BYCOMMAND|MF_UNCHECKED);

  CheckMenuItem(hMenu, ID_LANG_C,  (pTd -> eLang == VC) ?
          MF_BYCOMMAND|MF_CHECKED : MF_BYCOMMAND|MF_UNCHECKED);

  CheckMenuItem(hMenu, ID_LANG_VB,  (pTd -> eLang == VB) ?
          MF_BYCOMMAND|MF_CHECKED : MF_BYCOMMAND|MF_UNCHECKED);

  CheckMenuItem(hMenu, ID_LANG_JAVA,  (pTd -> eLang == Java) ?
          MF_BYCOMMAND|MF_CHECKED : MF_BYCOMMAND|MF_UNCHECKED);

  // (04.26.00 mdl) Include support for Delphi.
  CheckMenuItem(hMenu, ID_LANG_DELPHI,  (pTd -> eLang == Delphi) ?
          MF_BYCOMMAND|MF_CHECKED : MF_BYCOMMAND|MF_UNCHECKED);

  CheckMenuItem(hMenu, ID_ASSERT_ON_ERRORS, g_bAssertOnErrors ?
            MF_BYCOMMAND|MF_CHECKED : MF_BYCOMMAND|MF_UNCHECKED);

  CheckMenuItem(hMenu, IDM_OPTION_ODBC_STOP, g_bStopOnODBCErrors ?
          MF_BYCOMMAND|MF_CHECKED : MF_BYCOMMAND|MF_UNCHECKED);

  CheckMenuItem(hMenu, IDM_OPTION_CHATTY,  pTd -> bChatty ?
          MF_BYCOMMAND|MF_CHECKED : MF_BYCOMMAND|MF_UNCHECKED);

  CheckMenuItem(hMenu, IDM_OPTION_CREATE_ITERATION, pTd -> bCreatePerIteration ?
          MF_BYCOMMAND|MF_CHECKED : MF_BYCOMMAND|MF_UNCHECKED);

  CheckMenuItem(hMenu, IDM_RANDOM,    pTd -> bRandom ?
          MF_BYCOMMAND|MF_CHECKED : MF_BYCOMMAND|MF_UNCHECKED);

  EnableMenuItem(hMenu, IDM_KILL_THREADS,  g_nThreadsRunning ?
          MF_BYCOMMAND | MF_ENABLED  : MF_BYCOMMAND | MF_GRAYED);
  bHandled = TRUE;
  return 0;
}

LRESULT CBankDlg::OnKillThreads | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 250 of file bankdlg.Cpp.

{

  g_bStop = TRUE;
  for (int i = 0; i< g_nThreadsRunning; i++)
  {
    TerminateThread(g_pHandles[i] ,666);
  }
  return 0;
}

LRESULT CBankDlg::OnOK | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 226 of file bankdlg.Cpp.

{
  return OnClose(WM_CLOSE, 0, 0L, bHandled);
}

LRESULT CBankDlg::OnRandom | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 235 of file bankdlg.Cpp.

{
  THREADDATA * pTd = m_pCurrentThreadData -> GetThreadData();
  pTd -> bRandom = 1 - pTd -> bRandom;
  ::EnableWindow(GetDlgItem(IDC_FROM), !pTd -> bRandom);
  ::EnableWindow(GetDlgItem(IDC_TO), !pTd -> bRandom);
  SetDescription(pTd);
  bHandled = TRUE;
  return 0;
}

LRESULT CBankDlg::OnRemove | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 1184 of file bankdlg.Cpp.

{
  bHandled = TRUE;

  if (m_nTotalTests == 0)
  {
    MessageBeep(0);
    return 0;
  }
  if (m_nSuiteIndex != m_nTotalTests - 1) // not removing the last one
  {
    CThreadData * pData = (CThreadData * )m_pCurrentThreadData -> Next();
    m_pCurrentThreadData -> Remove();
    m_pCurrentThreadData = pData;
  }
  else // removing the last one
  {
    CThreadData * pData = (CThreadData * )m_pCurrentThreadData -> Previous();
    m_pCurrentThreadData -> Remove();
    m_pCurrentThreadData = pData;
    m_nSuiteIndex--;
  }

  m_nTotalTests--;
  UpdateStatus(m_pCurrentThreadData, m_nSuiteIndex);
  return 0;
}

LRESULT CBankDlg::OnRetryOnErrors | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 375 of file bankdlg.Cpp.

{
  bHandled = TRUE;
  g_bRetry = 1 - g_bRetry;
  return 0;

}

LRESULT CBankDlg::OnRunSuite | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 443 of file bankdlg.Cpp.

{

  //
  //  save current settings
  //
  GetThreadData(m_pCurrentThreadData -> GetThreadData());

  ::EnableWindow(GetDlgItem(IDC_SUBMIT), FALSE);
  ::EnableWindow(GetDlgItem(IDC_STOP), TRUE);
  ::EnableWindow(GetDlgItem(IDC_RUN_SUITE), FALSE);
  ListView_DeleteAllItems(g_hWndResults);
  SaveAll();
  CThreadData * pThreadData = (CThreadData *)m_list.First();
  int index = 0;
  WCHAR sz[64];

  // (03.22.00 mdl) Add overall timing information for test suite.
  DWORD liStartTime = GetTickCount();

  while ( pThreadData != (CThreadData *)&m_list)
  {

    UpdateStatus(pThreadData, index);
    index++;
    wsprintf(sz, L"Running Suite Test %d", index);
    ShowResults(SysAllocString(sz), FALSE);
    // Perform test based on selected language.
    DoWork(pThreadData, pThreadData -> GetThreadData() -> nTestType);
    if (g_bStop)
      break;

    pThreadData = ( CThreadData * )pThreadData -> Next();
  }

  // (03.22.00 mdl) Report total time for test.
  float t = (GetTickCount() - (float)liStartTime)  / 1000;
  swprintf(sz, L"Test suite complete.  Elapsed time: %2.4f seconds", t);
  ShowResults(SysAllocString(sz), FALSE);

  UpdateStatus(m_pCurrentThreadData, m_nSuiteIndex);

  ::EnableWindow(GetDlgItem(IDC_RUN_SUITE), TRUE);
  ::EnableWindow(GetDlgItem(IDC_SUBMIT), TRUE);
  ::EnableWindow(GetDlgItem(IDC_STOP), FALSE);

  ShowResults(SysAllocString(L"Finished Running Test Suite."), FALSE);
  return 0;
}

LRESULT CBankDlg::OnSave | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 1132 of file bankdlg.Cpp.

{
  SaveAll();

  return 0;
}

LRESULT CBankDlg::OnSelectAccount | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 293 of file bankdlg.Cpp.

{
  THREADDATA * pTd = m_pCurrentThreadData -> GetThreadData();
  pTd -> nTestType = ACCOUNT;
  switch (wID)
  {
  case ID_AC_DEBIT:
    pTd -> nTranType = DEBIT;
    break;
  case ID_AC_CREDIT:
    pTd -> nTranType = CREDIT;
    break;
  default:
    _ASSERTE(0);
  }

  SetDescription(pTd);
  return 0;

}

LRESULT CBankDlg::OnSelectChattyDisplay | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 362 of file bankdlg.Cpp.

{
  THREADDATA * pTd = m_pCurrentThreadData -> GetThreadData();
  pTd -> bChatty = 1 - pTd -> bChatty;
  bHandled = TRUE;
  SetDescription(pTd);
  return 0;
}

LRESULT CBankDlg::OnSelectCoInit | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 387 of file bankdlg.Cpp.

{
  THREADDATA * pTd = m_pCurrentThreadData -> GetThreadData();
  pTd -> nTestType = MOVEMONEY;
  switch (wID)
  {
  case ID_COINIT_MTA:
    pTd -> eCoInit = CoInitMTA;
    break;
  case ID_COINIT_STA:
    pTd -> eCoInit = CoInitSTA;
    break;
  case ID_COINIT_RANDOM:
    pTd -> eCoInit = CoInitRandom;
    break;
  default:
    _ASSERTE(0);
  }

  SetDescription(pTd);

  return 0;
}

LRESULT CBankDlg::OnSelectCreatePerIteration | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 349 of file bankdlg.Cpp.

{
  THREADDATA * pTd = m_pCurrentThreadData -> GetThreadData();
  pTd -> bCreatePerIteration = 1 - pTd -> bCreatePerIteration;
  bHandled = TRUE;
  SetDescription(pTd);
  return 0;
}

LRESULT CBankDlg::OnSelectLanguage | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 318 of file bankdlg.Cpp.

{
  THREADDATA * pTd = m_pCurrentThreadData -> GetThreadData();
  switch (wID)
  {
  case ID_LANG_C:
    pTd -> eLang = VC;
    break;
  case ID_LANG_VB:
    pTd -> eLang = VB;
    break;
  case ID_LANG_JAVA:
    pTd -> eLang = Java;
    break;
  // (04.26.00 mdl) Include support for Delphi.
  case ID_LANG_DELPHI:
    pTd -> eLang = Delphi;
    break;
  default:
    _ASSERTE(0);
  }

  SetDescription(pTd);
  return 0;

}

LRESULT CBankDlg::OnSelectMoveMoney | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 265 of file bankdlg.Cpp.

{
  THREADDATA * pTd = m_pCurrentThreadData -> GetThreadData();
  pTd -> nTestType = MOVEMONEY;
  switch (wID)
  {
  case ID_MM_CREDIT:
    pTd -> nTranType = CREDIT;
    break;
  case ID_MM_DEBIT:
    pTd -> nTranType = DEBIT;
    break;
  case ID_MM_TRANSFER:
    pTd -> nTranType = TRANSFER;
    break;
  default:
    _ASSERTE(0);
  }

  SetDescription(pTd);

  return 0;
}

LRESULT CBankDlg::OnShowError | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 908 of file bankdlg.Cpp.

{
  bHandled = TRUE;

  if (m_hFile)
  {
    USES_CONVERSION;
    WCHAR buf[1024];
    ZeroMemory(buf, 1024 * sizeof(WCHAR));
    wsprintf(buf, L"%d\t%ld\tY\t%s\r\n", m_nMsgs++, (long)wParam, (BSTR)lParam);
    DWORD dwWritten=0;
    DWORD dwSize = lstrlen(buf);
    WriteFile(m_hFile, buf, dwSize*sizeof(WCHAR), &dwWritten, NULL);
  }

  int nCount = ListView_GetItemCount(g_hWndResults);
  LV_ITEM item;
  WCHAR sz[8];

  wsprintf(sz, L"%ld", nCount);
  memset(&item, NULL, sizeof(item));
  item.mask = LVIF_TEXT;
  item.iItem = nCount;
  item.pszText = sz;
  item.cchTextMax = lstrlen(sz);

  ListView_InsertItem(g_hWndResults, &item);
  wsprintf(sz,L"%ld", (DWORD)wParam);
  ListView_SetItemText(g_hWndResults, nCount, 1, sz);
  ListView_SetItemText(g_hWndResults, nCount, 2, L"Y");
  BSTR sString = (BSTR)lParam;
  int nLen = SysStringLen(sString);
  if (nLen > m_nMaxRowLength)
    m_nMaxRowLength = nLen;
  ListView_SetItemText(g_hWndResults, nCount, 3, sString);
  ListView_EnsureVisible(g_hWndResults, nCount, FALSE);
  SysFreeString(sString);
  return 0;

}

LRESULT CBankDlg::OnShowResults | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 865 of file bankdlg.Cpp.

{
  bHandled = TRUE;

  if (m_hFile)
  {
    USES_CONVERSION;
    WCHAR buf[1024];
    ZeroMemory(buf, 1024 * sizeof(WCHAR));
    wsprintf(buf, L"%d\t%ld\t\t%s\r\n", m_nMsgs++, (long)wParam, (BSTR)lParam);
    DWORD dwWritten=0;
    DWORD dwSize = lstrlen(buf);
    WriteFile(m_hFile, buf, dwSize*sizeof(WCHAR), &dwWritten, NULL);
  }
  int nCount = ListView_GetItemCount(g_hWndResults);
  LV_ITEM item;
  WCHAR sz[8];

  wsprintf(sz, L"%ld", nCount);
  memset(&item, NULL, sizeof(item));
  item.mask = LVIF_TEXT;
  item.iItem = nCount;
  item.pszText = sz;
  item.cchTextMax = lstrlen(sz);

  ListView_InsertItem(g_hWndResults, &item);
  wsprintf(sz,L"%ld", (DWORD)wParam);
  ListView_SetItemText(g_hWndResults, nCount, 1, sz);
  BSTR sString = (BSTR)lParam;
  int nLen = SysStringLen(sString);
  if (nLen > m_nMaxRowLength)
    m_nMaxRowLength = nLen;
  ListView_SetItemText(g_hWndResults, nCount, 3, sString);
  ListView_EnsureVisible(g_hWndResults, nCount, FALSE);
  SysFreeString(sString);
  return 0;

}

LRESULT CBankDlg::OnSize | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 843 of file bankdlg.Cpp.

{

  int fwSizeType = wParam;      // resizing flag
  int nWidth = LOWORD(lParam);  // width of client area
  int nHeight = HIWORD(lParam); // height of client area
  bHandled = FALSE;

  RECT rect;
  ::GetWindowRect(g_hWndResults, &rect);

  ScreenToClient(&rect);

    ::MoveWindow(g_hWndResults, 0, rect.top , nWidth, nHeight - rect.top, TRUE);
  return 0;

}

LRESULT CBankDlg::OnStop | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 634 of file bankdlg.Cpp.

{
  g_bStop = TRUE;
  ::EnableWindow(GetDlgItem(IDC_STOP), FALSE);
  return 0;
}

LRESULT CBankDlg::OnStopOnODBCErrors | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 426 of file bankdlg.Cpp.

{
  g_bStopOnODBCErrors =   1 - g_bStopOnODBCErrors;
  SetDescription(m_pCurrentThreadData -> GetThreadData());
  return 0;
}

LRESULT CBankDlg::OnViewNext | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 953 of file bankdlg.Cpp.

{

  //
  //  save current settings
  //
  GetThreadData(m_pCurrentThreadData -> GetThreadData());

  if (m_nSuiteIndex < m_nTotalTests - 1)
  {
    m_nSuiteIndex++;
    m_pCurrentThreadData = (CThreadData *)m_pCurrentThreadData -> Next();
    UpdateStatus(m_pCurrentThreadData, m_nSuiteIndex);
  }
  else
  {
    MessageBeep(0);
  }

  bHandled = TRUE;
  return 0;
}

LRESULT CBankDlg::OnViewPrev | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 980 of file bankdlg.Cpp.

{

  //
  //  save current settings
  //
  GetThreadData(m_pCurrentThreadData -> GetThreadData());

  if (m_nSuiteIndex > 0)
  {
    m_nSuiteIndex--;
    m_pCurrentThreadData = (CThreadData *)m_pCurrentThreadData -> Previous();
    UpdateStatus(m_pCurrentThreadData, m_nSuiteIndex);
  }
  else
  {
    MessageBeep(0);
  }
  bHandled = TRUE;
  return 0;

}

BOOL CBankDlg::SaveAll ( )

Definition at line 1007 of file bankdlg.Cpp.

{

  g_nRows = GetDlgItemInt(IDC_ROWS);

  char szDir[MAX_PATH];
  ZeroMemory(szDir, MAX_PATH * sizeof(char));
  GetWindowsDirectoryA(szDir, MAX_PATH);
  strncat(szDir, "\\vcbank.dat", sizeof("\\vcbank.dat"));
  ofstream of( szDir, ios::out | ios::binary , filebuf::sh_none    );

  int version = FILE_VERSION;
  of.write((BYTE*)&version, sizeof(version));
  of.write((BYTE*)&m_nTotalTests, sizeof(m_nTotalTests));
  of.write((BYTE*)&g_bAssertOnErrors, sizeof(g_bAssertOnErrors));
  of.write((BYTE*)&g_bStopOnODBCErrors, sizeof(g_bStopOnODBCErrors));
  of.write((BYTE*)&g_nRows, sizeof(g_nRows));
  of.write((BYTE*)&g_bRetry, sizeof(g_bRetry));

  int nWidth = 0;
  for (int i=0;i<NUMBER_OF_COLUMNS; i++)
  {
    nWidth = ListView_GetColumnWidth(g_hWndResults, i);
    of.write((BYTE*)&nWidth, sizeof(int));
  }

  WINDOWPLACEMENT wp;
  ZeroMemory(&wp, sizeof wp);
  wp.length = sizeof(wp);
  GetWindowPlacement(&wp);

  of.write((BYTE *)&wp, sizeof wp);

  CThreadData * pThreadData = NULL;
  CLinkable* pLinkable  = m_list.First();
  while ( pLinkable != &m_list)
  {
    pThreadData = ( CThreadData * )pLinkable;
    of.write((BYTE *)pThreadData -> GetThreadData(), sizeof(THREADDATA));
    pLinkable = pLinkable -> Next();
  }

  return TRUE;

}

void CBankDlg::SetDescription ( THREADDATA * pData ) [private]

Definition at line 1226 of file bankdlg.Cpp.

{
  if (!pData)
  {
    SetDlgItemText(IDC_DESCRIPTION, L"");
    return;
  }

  WCHAR sz[1024];
  ZeroMemory(sz, 1024*sizeof WCHAR);

  switch (pData -> eLang)
  {
  case VC:
    _tcsncat(sz, L"C++ ", sizeof(L"C++ "));
    break;
  case VB:
    _tcsncat(sz, L"VB ", sizeof(L"VB "));
    break;
  case Java:
    _tcsncat(sz, L"Java ", sizeof(L"Java "));
    break;
  // (04.26.00 mdl) Include support for Delphi.
  case Delphi:
    _tcsncat(sz, L"Delphi ", sizeof(L"Delphi "));
    break;
  default:
    _ASSERTE(0);
  }

  BOOL bMoveMoney = FALSE;
  switch (pData -> nTestType)
  {
  case MOVEMONEY:
    _tcsncat(sz, L"MoveMoney ", sizeof(L"MoveMoney "));
    bMoveMoney = TRUE;
    break;
  case ACCOUNT:
    _tcsncat(sz, L"Account ", sizeof(L"Account "));
    break;
  }

  switch (pData -> nTranType)
  {
  case DEBIT:
    _tcsncat(sz, L"Debit ", sizeof(L"Debit "));
    break;
  case CREDIT:
    _tcsncat(sz, L"Credit ", sizeof(L"Credit "));
    break;
  case TRANSFER:
    _tcsncat(sz, L"Transfer ", sizeof(L"Transfer "));
    break;
  default:
    _ASSERTE(0);
  }

  switch (pData -> eCoInit)
  {
  case CoInitMTA:
    _tcsncat(sz, L"in the MTA", sizeof(L"in the MTA"));
    break;
  case CoInitSTA:
    _tcsncat(sz, L"in the STA", sizeof(L"in the STA"));
    break;
  case CoInitRandom:
    _tcsncat(sz, L"in Random Apartments ", sizeof(L"in Random Apartments "));
    break;
  default:
    _ASSERTE(0);

  }

  _tcsncat(sz, L".  ", sizeof(L".  "));
  if (pData -> bChatty)
    _tcsncat(sz, L"Chatty Mode ", sizeof(L"Chatty Mode "));
  else
    _tcsncat(sz, L"Quiet Mode ", sizeof(L"Quiet Mode "));

  if (pData -> bCreatePerIteration)
    _tcsncat(sz, L"doing a CCI Per iteration ", sizeof(L"doing a CCI Per iteration "));
  else
    _tcsncat(sz, L"Using JIT ", sizeof(L"Using JIT "));

  if (pData -> bRandom)
    _tcsncat(sz, L"with Random Account Numbers", sizeof(L"with Random Account Numbers"));
  else
    _tcsncat(sz, L"with Accounts numbers specified ", sizeof(L"with Accounts numbers specified "));

  SetDlgItemText(IDC_DESCRIPTION, sz);

}

void CBankDlg::SetThreadData ( THREADDATA * pTd )

Definition at line 741 of file bankdlg.Cpp.

{

  if (!pTd)
  {
    _ASSERTE(0);
    return;
  }

  SetDlgItemInt(IDC_FROM, pTd -> nFrom );
  SetDlgItemInt(IDC_TO, pTd -> nTo);
  SetDlgItemInt(IDC_ITERS, pTd -> nIters);
  SetDlgItemInt(IDC_AMOUNT, pTd -> nAmount);
  SetDlgItemInt(IDC_THREADS, pTd -> nThreads);

  ::EnableWindow(GetDlgItem(IDC_FROM), !pTd -> bRandom);
  ::EnableWindow(GetDlgItem(IDC_TO), !pTd -> bRandom);

}

void CBankDlg::UpdateStatus | ( | CThreadData * | pData,
 |  | int | nCurItem |
 | ) |  |  | [private]

Definition at line 1160 of file bankdlg.Cpp.

{
  if (m_nTotalTests != 0)
  {
    SetThreadData(pData -> GetThreadData());
    WCHAR sz[32];
    wsprintf(sz, L"Test %d of %d", nCurItem+1, m_nTotalTests);
    SetDlgItemText(IDC_SUITE_STATUS, sz);
    SetDescription(pData -> GetThreadData());
  }
  else
  {
    THREADDATA td;
    ZeroMemory(&td, sizeof(td));
    SetThreadData(&td);
    SetDlgItemText(IDC_SUITE_STATUS, L"Test 0 of 0");
    SetDescription(NULL);
  }
}

Member Data Documentation

CREATEDATA CBankDlg::m_cd [private]

Definition at line 121 of file bankdlg.h.

HANDLE CBankDlg::m_hCreateThread [private]

Definition at line 122 of file bankdlg.h.

HANDLE CBankDlg::m_hFile [private]

Definition at line 132 of file bankdlg.h.

HMENU CBankDlg::m_hMenu [private]

Definition at line 129 of file bankdlg.h.

CListHeader CBankDlg::m_list [private]

Definition at line 127 of file bankdlg.h.

int CBankDlg::m_nMaxRowLength [private]

Definition at line 131 of file bankdlg.h.

int CBankDlg::m_nMsgs [private]

Definition at line 133 of file bankdlg.h.

int CBankDlg::m_nSuiteIndex [private]

Definition at line 125 of file bankdlg.h.

int CBankDlg::m_nTotalTests [private]

Definition at line 126 of file bankdlg.h.

CThreadData* CBankDlg::m_pCurrentThreadData [private]

Definition at line 120 of file bankdlg.h.

The documentation for this class was generated from the following files:
  • Com/Services/Object_Pooling/OPBankSample/OPBank/bankdlg.h
  • Com/Services/Object_Pooling/OPBankSample/OPBank/bankdlg.Cpp
Generated on Wed Nov 13 2024 16:55:37 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CBase Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Protected Attributes

CBase Class Reference

#include "cbase.h"

Inherits com::ms::com::IUnknown.

Inherited by CBinder, CConnectionPoint, CContainerBase, CCustomError, CDataLinks, CError, CMultipleResults, CServiceComp, CTransactionOptions, and CUnknown.

List of all members.

Public Member Functions

CBase (SOURCE eObjectType, CMainWindow *pCMainWindow, CMDIChild *pCMDIChild=NULL)
virtual | ~CBase ()
virtual HRESULT | AutoQI (DWORD dwCreateOpts)=0
virtual HRESULT | AutoRelease ()=0
virtual HRESULT | CreateObject (CBase *pCSource, REFIID riid, IUnknown *pIUnknown, DWORD dwCreateOpts=-1)
virtual HRESULT | DisplayObject ()
BASE_CLASS GetBaseType ()
virtual REFIID | GetDefaultInterface ()=0
virtual IUnknown * | GetInterface (REFIID riid)
virtual IUnknown ** | GetInterfaceAddress (REFIID riid)=0
virtual WCHAR * | GetObjectDesc ()
virtual LONG | GetObjectImage ()=0
virtual UINT | GetObjectMenu ()=0
virtual WCHAR * | GetObjectName ()=0
SOURCE GetObjectType ()
virtual COptionsSheet * | GetOptions ()
virtual CBase * | GetParent (SOURCE eSource)
virtual BOOL | IsSameObject (IUnknown *pIUnkObject)
virtual ULONG | ObjectAddRef ()
virtual HRESULT | ObjectQI (REFIID riid, IUnknown **ppIUnknown)
virtual ULONG | ObjectRelease ()
virtual void | OnDefOperation ()
STDMETHODIMP | QueryInterface (REFIID riid, void **ppvObject)
virtual HRESULT | ReleaseChildren ()
virtual HRESULT | ReleaseObject (ULONG ulExpectedRefCount=0)
virtual HRESULT | SetInterface (REFIID riid, IUnknown *pIUnknown)
virtual void | SetObjectDesc (WCHAR *pwszDescription, BOOL fCopy=TRUE)
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()

Public Attributes

DWORD m_dwCLSCTX
GUID | m_guidSource
HTREEITEM | m_hTreeItem
CMainWindow * m_pCMainWindow
CMDIChild * m_pCMDIChild
CBase * m_pCParent
IAggregate * | m_pIAggregate
IService * | m_pIService
ISupportErrorInfo * | m_pISupportErrorInfo
IUnknown * | m_pIUnknown

Protected Attributes

ULONG m_cRef
BASE_CLASS m_eBaseClass
SOURCE m_eObjectType
CComWSTR m_strObjectDesc

Detailed Description

Definition at line 118 of file cbase.h.

Constructor & Destructor Documentation

CBase::CBase | ( | SOURCE | eObjectType,
 |  | CMainWindow * | pCMainWindow,
 |  | CMDIChild * | pCMDIChild = NULL
 | ) |  |

Definition at line 22 of file cbase.cpp.

{
  //IUnknown
  m_cRef              = 1;

  //BackPointers
  ASSERT(pCMainWindow || pCMDIChild);
  m_pCMDIChild      =  pCMDIChild;
  m_pCMainWindow      =  pCMainWindow ? pCMainWindow : pCMDIChild->m_pCMainWindow;

  //Common OLE DB Interfaces
  m_pIUnknown           = NULL;
  m_pISupportErrorInfo      = NULL;
  m_pIAggregate         = NULL;
  m_pIService           = NULL;

  //Data
  m_hTreeItem           = NULL;
  m_eObjectType         = eObjectType;
  m_eBaseClass          = eCBase;
  m_dwCLSCTX            = CLSCTX_INPROC_SERVER;

  //Parent Info
  m_pCParent            = NULL;
  m_guidSource          = GUID_NULL;
}

CBase::~CBase ( ) [virtual]

Definition at line 54 of file cbase.cpp.

{
  //ReleaseObject should have already been called...
  //If you hit this ASSERT put a "ReleaseObject(0)" in the obhjects destructor...

  //NOTE:  We can't just call ReleaseObject here since its a virtual function.
  //Calling a virtual function would invoke the derived class, which when we are here
  //(in the base destructor) the derived class is already garbaged!
  ASSERT(m_pIUnknown == NULL);
  ASSERT(m_pCParent == NULL);

  //Make sure this item is removed from the tree...
  CObjTree* pCObjTree = m_pCMainWindow->m_pCMDIObjects->m_pCObjTree;
  if(pCObjTree && m_hTreeItem)
  {
    //NOTE: The object (after this desctructor) is no longer available,
    //so make sure that even if the node cannot be removed (child nodes),
    //we need to still remove the object reference so it doesn't try and access it anymore...
    pCObjTree->RemoveObject(this);
    pCObjTree->SetItemParam(m_hTreeItem, NULL);
  }
}

Member Function Documentation

HRESULT CBase::AutoQI ( DWORD dwCreateOpts ) [pure virtual]

Implemented in CUnknown, CContainerBase, CConnectionPoint, CAsynchBase, CPropertiesBase, CBinder, CCommand, CServiceComp, CDataLinks, CDataset, CDataSource, CEnumerator, CError, CCustomError, CMultipleResults, CRow, CRowPosition, CDataAccess, CRowset, CSession, CStream, CTransaction, and CTransactionOptions.

Definition at line 373 of file cbase.cpp.

{
  //[MANDATORY] Obtain [mandatory] interfaces
  if(dwCreateOpts & CREATE_QI_MANDATORY)
  {
  }

  //[OPTIONAL]
  if(dwCreateOpts & CREATE_QI_OPTIONAL)
  {
    OBTAIN_INTERFACE(ISupportErrorInfo);
    OBTAIN_INTERFACE(IAggregate);
    OBTAIN_INTERFACE(IService);
  }

  return S_OK;
}

HRESULT CBase::AutoRelease ( ) [pure virtual]

Implemented in CUnknown, CContainerBase, CConnectionPoint, CAsynchBase, CPropertiesBase, CBinder, CCommand, CServiceComp, CDataLinks, CDataset, CDataSource, CEnumerator, CError, CCustomError, CMultipleResults, CRow, CRowPosition, CDataAccess, CRowset, CSession, CStream, CTransaction, and CTransactionOptions.

Definition at line 359 of file cbase.cpp.

{
  //Common OLE DB Interface
  RELEASE_INTERFACE(ISupportErrorInfo);
  RELEASE_INTERFACE(IAggregate);
  RELEASE_INTERFACE(IService);
  return S_OK;
}

HRESULT CBase::CreateObject | ( | CBase * | pCSource,
 |  | REFIID | riid,
 |  | IUnknown * | pIUnknown,
 |  | DWORD | dwCreateOpts = -1 |
 | ) |  |  | [virtual]

Definition at line 308 of file cbase.cpp.

{
  //No-op...
  if(!pIUnkObject)
    return E_INVALIDARG;

  //Use exsiting Connection
  IUnknown* pIUnknown = NULL;

  if(dwCreateOpts == -1 /*Default*/)
    dwCreateOpts = GetOptions()->m_dwCreateOpts;

  HRESULT hr      = S_OK;

  //Store the Parent Object...
  SAFE_RELEASE(m_pCParent);
  SAFE_ADDREF(pCSource);
  m_pCParent = pCSource;

  //First we QI for IID_IUnknown the object passed in.
  //NOTE: We do this before we call ReleaseObject since the caller of this
  //method could have passed in our own member variable (m_pIUnknown) to "recreate" the object.
  TRACE_QI(pIUnkObject, IID_IUnknown, &pIUnknown, GetObjectName());

  //Release all Previous interfaces...
  ReleaseObject(1);

  //[MANDATORY]
  //Used the AddRef'd input as our IUnknown, since all interfaces inherit from IUnknown.
  m_pIUnknown = pIUnknown;

  //Now set the pointer pased into the appropiate interface member
  //NOTE: We already handled IUnknown above...
  if(riid != IID_IUnknown)
    SetInterface(riid, pIUnkObject);

  //Now AutoQI for derived object interfaces...
  AutoQI(dwCreateOpts);

  //Add this object to the Objects Window
  m_pCMainWindow->m_pCMDIObjects->m_pCObjTree->AddObject(pCSource, this);

//CLEANUP:
  return hr;
}

HRESULT CBase::DisplayObject ( ) [virtual]

Reimplemented in CDataset, CRow, CRowset, and CStream.

Definition at line 481 of file cbase.cpp.

{
  //Update the object in the tree...
  if(m_hTreeItem)
    m_pCMainWindow->m_pCMDIObjects->m_pCObjTree->AddObject(NULL, this);
  return S_OK;
}

BASE_CLASS CBase::GetBaseType ( ) [inline]

Definition at line 163 of file cbase.h.

{ return m_eBaseClass;          }

virtual REFIID CBase::GetDefaultInterface ( ) [pure virtual]

Implemented in CUnknown, CConnectionPoint, CBinder, CCommand, CServiceComp, CDataLinks, CDataset, CDataSource, CEnumerator, CError, CCustomError, CMultipleResults, CRow, CRowPosition, CRowset, CSession, CStream, CTransaction, and CTransactionOptions.

IUnknown * CBase::GetInterface ( REFIID riid ) [virtual]

Definition at line 203 of file cbase.cpp.

{
  //Delegate to the derived class...
  IUnknown** ppIUnknown = GetInterfaceAddress(riid);
  if(ppIUnknown)
    return *ppIUnknown;

  return NULL;
}

IUnknown ** CBase::GetInterfaceAddress ( REFIID riid ) [pure virtual]

Implemented in CUnknown, CContainerBase, CConnectionPoint, CAsynchBase, CPropertiesBase, CBinder, CCommand, CServiceComp, CDataLinks, CDataset, CDataSource, CEnumerator, CError, CCustomError, CMultipleResults, CRow, CRowPosition, CDataAccess, CRowset, CSession, CStream, CTransaction, and CTransactionOptions.

Definition at line 396 of file cbase.cpp.

{
  HANDLE_GETINTERFACE(IUnknown);
  HANDLE_GETINTERFACE(ISupportErrorInfo);
  HANDLE_GETINTERFACE(IAggregate);
  HANDLE_GETINTERFACE(IService);

  return NULL;
}

virtual WCHAR* CBase::GetObjectDesc ( ) [inline, virtual]

Reimplemented in CConnectionPoint, CBinder, CDataSource, CEnumerator, CError, CCustomError, CRow, and CRowset.

Definition at line 158 of file cbase.h.

{ return m_strObjectDesc;       }

virtual LONG CBase::GetObjectImage ( ) [pure virtual]

Implemented in CUnknown, CConnectionPoint, CBinder, CCommand, CServiceComp, CDataLinks, CDataset, CDataSource, CEnumerator, CError, CCustomError, CMultipleResults, CRow, CRowPosition, CRowset, CSession, CStream, CTransaction, and CTransactionOptions.

virtual UINT CBase::GetObjectMenu ( ) [pure virtual]

Implemented in CUnknown, CConnectionPoint, CBinder, CCommand, CServiceComp, CDataLinks, CDataset, CDataSource, CEnumerator, CError, CCustomError, CMultipleResults, CRow, CRowPosition, CRowset, CSession, CStream, CTransaction, and CTransactionOptions.

virtual WCHAR* CBase::GetObjectName ( ) [pure virtual]

Implemented in CUnknown, CConnectionPoint, CBinder, CCommand, CServiceComp, CDataLinks, CDataset, CDataSource, CEnumerator, CError, CCustomError, CMultipleResults, CRow, CRowPosition, CRowset, CSession, CStream, CTransaction, and CTransactionOptions.

SOURCE CBase::GetObjectType ( ) [inline]

Definition at line 162 of file cbase.h.

{ return m_eObjectType;         }

COptionsSheet * CBase::GetOptions ( ) [virtual]

Definition at line 494 of file cbase.cpp.

{
  return m_pCMainWindow->GetOptions();
}

CBase * CBase::GetParent ( SOURCE eSource ) [virtual]

Definition at line 422 of file cbase.cpp.

{
  CBase* pCParent = m_pCParent;

  //Try to find the requested parent object type
  while(pCParent)
  {
    //Do we have a match...
    if(pCParent->m_eObjectType == eSource)
      return pCParent;

    //Try the previous parent...
    pCParent = pCParent->m_pCParent;
  }

  return NULL;
}

BOOL CBase::IsSameObject ( IUnknown * pIUnkObject ) [virtual]

Definition at line 411 of file cbase.cpp.

{
  CComPtr<IUnknown> spUnknown = m_pIUnknown;
  return spUnknown.IsEqualObject(pIUnkObject);
}

ULONG CBase::ObjectAddRef ( ) [virtual]

Definition at line 137 of file cbase.cpp.

{
  //Record the number of times the user has addref'd this object.
  //So we can know when to correctly NULL out the interface, so they can longer use it...
  AddRef();

  //IUnknown::AddRef
  return TRACE_ADDREF(m_pIUnknown, GetObjectName());
}

HRESULT CBase::ObjectQI | ( | REFIID | riid,
 |  | IUnknown ** | ppIUnknown |
 | ) |  |  | [virtual]

Definition at line 218 of file cbase.cpp.

{
  HRESULT hr = S_OK;

  //IUnknown::QueryInterface
  XTESTC(hr = TRACE_QI(m_pIUnknown, riid, ppIUnknown, GetObjectName()));

  //We need to put the obtained interface in the appropiate member...
  if(ppIUnknown && *ppIUnknown)
    hr = SetInterface(riid, *ppIUnknown);

CLEANUP:
  return hr;
}

ULONG CBase::ObjectRelease ( ) [virtual]

Definition at line 152 of file cbase.cpp.

{
  IUnknown* pIUnknown = m_pIUnknown;
  ULONG ulRefCount = 0;

  //IUnknown::Release
  ulRefCount = CIntTrace::TraceRelease(&pIUnknown, GetObjectName());

  //We need to disable this interface once it hits zero so
  //its not used incorrectly after the object is released...
  if(ulRefCount == 0 || m_cRef<=1)
  {
    m_pIUnknown = NULL;
    ReleaseObject();
  }
  else
  {
    Release();
  }

  return ulRefCount;
}

void CBase::OnDefOperation ( ) [virtual]

Reimplemented in CBinder, CServiceComp, CDataLinks, CEnumerator, and CStream.

Definition at line 468 of file cbase.cpp.

{
  //The default implementation (unless its overridden)
  //Activate the MDIChild window assoicated with this object
  if(m_pCMDIChild && m_pCMDIChild->m_hWnd)
    m_pCMainWindow->MDIActivate(m_pCMDIChild->m_hWnd);
}

STDMETHODIMP CBase::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppvObject
 | ) |  |
HRESULT CBase::ReleaseChildren ( ) [virtual]

Definition at line 265 of file cbase.cpp.

{
  //Make our lives easier...
  CObjTree* pCObjTree = m_pCMainWindow->m_pCMDIObjects->m_pCObjTree;

  //No-op
  if(!m_hTreeItem || !pCObjTree->m_hWnd)
    return S_OK;
  BOOL bAllRemoved = TRUE;

  //Try to obtain the first child...
  HTREEITEM hChildItem = pCObjTree->GetChildItem(m_hTreeItem);
  while(hChildItem)
  {
    //NOTE: Before deleting this node of the tree, obtain the
    //next sibling (if there is one...).  Since we can't do this after the node has been deleted!
    HTREEITEM hNextSibling = pCObjTree->GetNextItem(hChildItem);
    CBase* pCChild = (CBase*)pCObjTree->GetItemParam(hChildItem);

    if(pCChild)
    {
      //Make sure all its children are released (recurse)
      //If this child cannot be released, we still can continue on to the next child
      //(ie: release everything we can - not all or nothing...)
      if(SUCCEEDED(pCChild->ReleaseChildren()))
      {
        //Now we can release this child
        pCChild->ReleaseObject();
      }
    }

    //Go to the next sibling...
    hChildItem = hNextSibling;
  }

  return bAllRemoved ? S_OK : E_FAIL;
}

HRESULT CBase::ReleaseObject ( ULONG ulExpectedRefCount = 0 ) [virtual]

Definition at line 238 of file cbase.cpp.

{
  //Release Derived interfaces first...
  AutoRelease();

  //IUnknown
  TRACE_RELEASE_(m_pIUnknown, L"IUnknown", ulExpectedRefCount);

  //Cleanup when there are no more references
  if(ulExpectedRefCount==0)
  {
    //Remove this object from the tree, unless there is a window associated with it
    m_pCMainWindow->m_pCMDIObjects->m_pCObjTree->RemoveObject(this);
    m_guidSource    = GUID_NULL;

    //Release Parent
    SAFE_RELEASE(m_pCParent);
  }

  return S_OK;
}

HRESULT CBase::SetInterface | ( | REFIID | riid,
 |  | IUnknown * | pIUnknown |
 | ) |  |  | [virtual]

Definition at line 180 of file cbase.cpp.

{
  //We need to put the obtained interface in the appropiate member...
  if(pIUnknown)
  {
    //First obtain the correct interface member variable...
    IUnknown** ppInterfaceMember = GetInterfaceAddress(riid);
    if(!ppInterfaceMember)
      return E_NOINTERFACE;

    TRACE_RELEASE(*ppInterfaceMember, GetObjectName());
    TRACE_ADDREF(pIUnknown, GetObjectName());
    *ppInterfaceMember = pIUnknown;
  }

  return S_OK;
}

void CBase::SetObjectDesc | ( | WCHAR * | pwszDescription,
 |  | BOOL | fCopy = TRUE |
 | ) |  |  | [virtual]

Definition at line 445 of file cbase.cpp.

{
  //Optmization:  If the caller no longer needs the name,
  //no sense in reallocing, copying, freeing, freeing.  Just reference it...
  if(fCopy)
  {
    m_strObjectDesc.CopyFrom(pwszObjectDesc);
  }
  else
  {
    m_strObjectDesc.Attach(pwszObjectDesc);
  }

  //Update the object in the tree...
  if(m_strObjectDesc && m_hTreeItem)
    m_pCMainWindow->m_pCMDIObjects->m_pCObjTree->AddObject(NULL, this);
}

CBase::STDMETHODIMP_ ( ULONG )

Reimplemented in CStream, and CStream.

CBase::STDMETHODIMP_ ( ULONG )

Reimplemented in CStream, and CStream.

Member Data Documentation

ULONG CBase::m_cRef [protected]

Reimplemented in CConnectionPoint, CUnknown, CBinder, CCommand, CDataSource, CRow, CRowset, and CStream.

Definition at line 193 of file cbase.h.

DWORD CBase::m_dwCLSCTX

Definition at line 176 of file cbase.h.

BASE_CLASS CBase::m_eBaseClass [protected]

Definition at line 189 of file cbase.h.

SOURCE CBase::m_eObjectType [protected]

Definition at line 188 of file cbase.h.

GUID CBase::m_guidSource

Definition at line 180 of file cbase.h.

HTREEITEM CBase::m_hTreeItem

Definition at line 175 of file cbase.h.

CMainWindow* CBase::m_pCMainWindow

Definition at line 183 of file cbase.h.

CMDIChild* CBase::m_pCMDIChild

Definition at line 184 of file cbase.h.

CBase* CBase::m_pCParent

Definition at line 179 of file cbase.h.

IAggregate* CBase::m_pIAggregate

Definition at line 171 of file cbase.h.

IService* CBase::m_pIService

Definition at line 172 of file cbase.h.

ISupportErrorInfo* CBase::m_pISupportErrorInfo

Definition at line 170 of file cbase.h.

IUnknown* CBase::m_pIUnknown

Definition at line 169 of file cbase.h.

CComWSTR CBase::m_strObjectDesc [protected]

Definition at line 190 of file cbase.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cbase.h
  • Dataaccess/oledb/rowsetviewer/cbase.cpp
Generated on Wed Nov 13 2024 16:55:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CBaseDialog Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Private Attributes

CBaseDialog Class Reference

#include "basedialog.h"

Inherited by CAddDeviceDlg, CAddDeviceDlg, CAddDeviceDlg, CAddDeviceDlg, CAddDeviceDlg, CAddDeviceDlg, CAddFolderDlg, CAddVFileDlg, CAddVFileDlg, CAddVFileDlg, CAddVFileDlg, and CAddVFileDlg.

List of all members.

Public Member Functions

CBaseDialog (ULONG nTemplate=0)
CBaseDialog (ULONG nTemplate=0)
CBaseDialog (ULONG nTemplate=0)
CBaseDialog (ULONG nTemplate=0)
CBaseDialog (ULONG nTemplate=0)
CBaseDialog (ULONG nTemplate=0)
virtual | ~CBaseDialog ()
virtual | ~CBaseDialog ()
virtual | ~CBaseDialog ()
virtual | ~CBaseDialog ()
virtual | ~CBaseDialog ()
virtual | ~CBaseDialog ()
virtual HWND | Create (HINSTANCE hInstance, HWND hWndParent, DWORD dwFlags=0)
virtual HWND | Create (HINSTANCE hInstance, HWND hWndParent, DWORD dwFlags=0)
virtual HWND | Create (HINSTANCE hInstance, HWND hWndParent, DWORD dwFlags=0)
virtual HWND | Create (HINSTANCE hInstance, HWND hWndParent, DWORD dwFlags=0)
virtual HWND | Create (HINSTANCE hInstance, HWND hWndParent, DWORD dwFlags=0)
virtual HWND | Create (HINSTANCE hInstance, HWND hWndParent, DWORD dwFlags=0)
virtual BOOL | ProcessMessage (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)=0
virtual BOOL | ProcessMessage (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)=0
virtual BOOL | ProcessMessage (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)=0
virtual BOOL | ProcessMessage (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)=0
virtual BOOL | ProcessMessage (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)=0
virtual BOOL | ProcessMessage (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)=0

Protected Member Functions

virtual LRESULT | OnCancel (HWND hDlg, WPARAM wParam, LPARAM lParam)
virtual LRESULT | OnCancel (HWND hDlg, WPARAM wParam, LPARAM lParam)
virtual LRESULT | OnCancel (HWND hDlg, WPARAM wParam, LPARAM lParam)
virtual LRESULT | OnCancel (HWND hDlg, WPARAM wParam, LPARAM lParam)
virtual LRESULT | OnCancel (HWND hDlg, WPARAM wParam, LPARAM lParam)
virtual LRESULT | OnCancel (HWND hDlg, WPARAM wParam, LPARAM lParam)
virtual LRESULT | OnClose (HWND hDlg, WPARAM wParam, LPARAM lParam)
virtual LRESULT | OnClose (HWND hDlg, WPARAM wParam, LPARAM lParam)
virtual LRESULT | OnClose (HWND hDlg, WPARAM wParam, LPARAM lParam)
virtual LRESULT | OnClose (HWND hDlg, WPARAM wParam, LPARAM lParam)
virtual LRESULT | OnClose (HWND hDlg, WPARAM wParam, LPARAM lParam)
virtual LRESULT | OnClose (HWND hDlg, WPARAM wParam, LPARAM lParam)
virtual LRESULT | OnDestroy (HWND hDlg, WPARAM wParam, LPARAM lParam)
virtual LRESULT | OnDestroy (HWND hDlg, WPARAM wParam, LPARAM lParam)
virtual LRESULT | OnDestroy (HWND hDlg, WPARAM wParam, LPARAM lParam)
virtual LRESULT | OnDestroy (HWND hDlg, WPARAM wParam, LPARAM lParam)
virtual LRESULT | OnDestroy (HWND hDlg, WPARAM wParam, LPARAM lParam)
virtual LRESULT | OnDestroy (HWND hDlg, WPARAM wParam, LPARAM lParam)
virtual LRESULT | OnInitDialog (HWND hDlg, WPARAM wParam, LPARAM lParam)
virtual LRESULT | OnInitDialog (HWND hDlg, WPARAM wParam, LPARAM lParam)
virtual LRESULT | OnInitDialog (HWND hDlg, WPARAM wParam, LPARAM lParam)
virtual LRESULT | OnInitDialog (HWND hDlg, WPARAM wParam, LPARAM lParam)
virtual LRESULT | OnInitDialog (HWND hDlg, WPARAM wParam, LPARAM lParam)
virtual LRESULT | OnInitDialog (HWND hDlg, WPARAM wParam, LPARAM lParam)
virtual LRESULT | OnNcDestroy (HWND hDlg, WPARAM wParam, LPARAM lParam)
virtual LRESULT | OnNcDestroy (HWND hDlg, WPARAM wParam, LPARAM lParam)
virtual LRESULT | OnNcDestroy (HWND hDlg, WPARAM wParam, LPARAM lParam)
virtual LRESULT | OnNcDestroy (HWND hDlg, WPARAM wParam, LPARAM lParam)
virtual LRESULT | OnNcDestroy (HWND hDlg, WPARAM wParam, LPARAM lParam)
virtual LRESULT | OnNcDestroy (HWND hDlg, WPARAM wParam, LPARAM lParam)
virtual LRESULT | OnOK (HWND hDlg, WPARAM wParam, LPARAM lParam)
virtual LRESULT | OnOK (HWND hDlg, WPARAM wParam, LPARAM lParam)
virtual LRESULT | OnOK (HWND hDlg, WPARAM wParam, LPARAM lParam)
virtual LRESULT | OnOK (HWND hDlg, WPARAM wParam, LPARAM lParam)
virtual LRESULT | OnOK (HWND hDlg, WPARAM wParam, LPARAM lParam)
virtual LRESULT | OnOK (HWND hDlg, WPARAM wParam, LPARAM lParam)

Static Protected Member Functions

static BOOL CALLBACK | DlgProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
static BOOL CALLBACK | DlgProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
static BOOL CALLBACK | DlgProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
static BOOL CALLBACK | DlgProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
static BOOL CALLBACK | DlgProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
static BOOL CALLBACK | DlgProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)

Private Attributes

DLGPROC | m_DlgProc
DWORD m_dwFlags
HWND | m_hWnd
ULONG m_nTemplate

Detailed Description

Definition at line 30 of file basedialog.h.

Constructor & Destructor Documentation

CBaseDialog::CBaseDialog ( ULONG nTemplate = 0 )

Definition at line 25 of file basedialog.cpp.

{
  _ASSERT( NULL != nTemplate );

  m_nTemplate = nTemplate;
  m_hWnd      = NULL;          // Handle returned by CreateDialogParam
  m_DlgProc   = DlgProc;       // Point to default dialog proc
  m_dwFlags   = 0;
}

CBaseDialog::~CBaseDialog ( ) [virtual]

Definition at line 36 of file basedialog.cpp.

{
}

CBaseDialog::CBaseDialog ( ULONG nTemplate = 0 )
virtual CBaseDialog::~CBaseDialog ( ) [virtual]
CBaseDialog::CBaseDialog ( ULONG nTemplate = 0 )
virtual CBaseDialog::~CBaseDialog ( ) [virtual]
CBaseDialog::CBaseDialog ( ULONG nTemplate = 0 )
virtual CBaseDialog::~CBaseDialog ( ) [virtual]
CBaseDialog::CBaseDialog ( ULONG nTemplate = 0 )
virtual CBaseDialog::~CBaseDialog ( ) [virtual]
CBaseDialog::CBaseDialog ( ULONG nTemplate = 0 )
virtual CBaseDialog::~CBaseDialog ( ) [virtual]

Member Function Documentation

HWND CBaseDialog::Create | ( | HINSTANCE | hInstance,
 |  | HWND | hWndParent,
 |  | DWORD | dwFlags = 0 |
 | ) |  |  | [virtual]

Definition at line 46 of file basedialog.cpp.

{
  _ASSERT( NULL != hInstance );

  m_dwFlags = dwFlags;
  m_hWnd = CreateDialogParam( hInstance,
                              MAKEINTRESOURCE(m_nTemplate),
                              hWndParent,
                              m_DlgProc,
                              (LPARAM)this
                            );

  BOOL bReturn = ShowWindow( m_hWnd, SW_SHOW );  // Should return 0

  return m_hWnd;
}

virtual HWND CBaseDialog::Create | ( | HINSTANCE | hInstance,
 |  | HWND | hWndParent,
 |  | DWORD | dwFlags = 0 |
 | ) |  |  | [virtual]
virtual HWND CBaseDialog::Create | ( | HINSTANCE | hInstance,
 |  | HWND | hWndParent,
 |  | DWORD | dwFlags = 0 |
 | ) |  |  | [virtual]
virtual HWND CBaseDialog::Create | ( | HINSTANCE | hInstance,
 |  | HWND | hWndParent,
 |  | DWORD | dwFlags = 0 |
 | ) |  |  | [virtual]
virtual HWND CBaseDialog::Create | ( | HINSTANCE | hInstance,
 |  | HWND | hWndParent,
 |  | DWORD | dwFlags = 0 |
 | ) |  |  | [virtual]
virtual HWND CBaseDialog::Create | ( | HINSTANCE | hInstance,
 |  | HWND | hWndParent,
 |  | DWORD | dwFlags = 0 |
 | ) |  |  | [virtual]
static BOOL CALLBACK CBaseDialog::DlgProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static, protected]
static BOOL CALLBACK CBaseDialog::DlgProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static, protected]
BOOL CALLBACK CBaseDialog::DlgProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static, protected]

Definition at line 133 of file basedialog.cpp.

{
  BOOL bReturn = FALSE;
  if( WM_INITDIALOG == uMsg )
  {
    SetWindowLongPtr(hDlg, GWL_USERDATA, lParam);
  }

  CBaseDialog* pThis = reinterpret_cast<CBaseDialog*>(GetWindowLongPtr(hDlg, GWL_USERDATA));
  if( NULL != pThis )
  {
    bReturn = pThis->ProcessMessage( hDlg, uMsg, wParam, lParam );
  }

  return bReturn;
}

static BOOL CALLBACK CBaseDialog::DlgProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static, protected]
static BOOL CALLBACK CBaseDialog::DlgProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static, protected]
static BOOL CALLBACK CBaseDialog::DlgProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static, protected]
virtual LRESULT CBaseDialog::OnCancel | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]
LRESULT CBaseDialog::OnCancel | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]

Definition at line 107 of file basedialog.cpp.

{
  return DestroyWindow( m_hWnd);
}

virtual LRESULT CBaseDialog::OnCancel | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]
virtual LRESULT CBaseDialog::OnCancel | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]
virtual LRESULT CBaseDialog::OnCancel | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]
virtual LRESULT CBaseDialog::OnCancel | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]
virtual LRESULT CBaseDialog::OnClose | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]
virtual LRESULT CBaseDialog::OnClose | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]
LRESULT CBaseDialog::OnClose | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]

Definition at line 113 of file basedialog.cpp.

{
  return DestroyWindow( m_hWnd);
}

virtual LRESULT CBaseDialog::OnClose | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]
virtual LRESULT CBaseDialog::OnClose | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]
virtual LRESULT CBaseDialog::OnClose | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]
virtual LRESULT CBaseDialog::OnDestroy | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]
virtual LRESULT CBaseDialog::OnDestroy | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]
virtual LRESULT CBaseDialog::OnDestroy | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]
virtual LRESULT CBaseDialog::OnDestroy | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]
virtual LRESULT CBaseDialog::OnDestroy | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]
LRESULT CBaseDialog::OnDestroy | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]

Definition at line 82 of file basedialog.cpp.

{
  return 1;
}

virtual LRESULT CBaseDialog::OnInitDialog | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]

Reimplemented in CAddDeviceDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, CAddFolderDlg, CAddVFileDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, and CAddVFileDlg.

virtual LRESULT CBaseDialog::OnInitDialog | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]

Reimplemented in CAddDeviceDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, CAddFolderDlg, CAddVFileDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, and CAddVFileDlg.

virtual LRESULT CBaseDialog::OnInitDialog | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]

Reimplemented in CAddDeviceDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, CAddFolderDlg, CAddVFileDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, and CAddVFileDlg.

virtual LRESULT CBaseDialog::OnInitDialog | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]

Reimplemented in CAddDeviceDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, CAddFolderDlg, CAddVFileDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, and CAddVFileDlg.

LRESULT CBaseDialog::OnInitDialog | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]

Reimplemented in CAddDeviceDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, CAddFolderDlg, CAddVFileDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, and CAddVFileDlg.

Definition at line 72 of file basedialog.cpp.

{
  return 1;
}

virtual LRESULT CBaseDialog::OnInitDialog | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]

Reimplemented in CAddDeviceDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, CAddFolderDlg, CAddVFileDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, and CAddVFileDlg.

virtual LRESULT CBaseDialog::OnNcDestroy | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]
virtual LRESULT CBaseDialog::OnNcDestroy | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]
virtual LRESULT CBaseDialog::OnNcDestroy | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]
LRESULT CBaseDialog::OnNcDestroy | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]

Definition at line 92 of file basedialog.cpp.

{
  m_hWnd = NULL;             // Since this is a modeless-only dialog
  delete this;               // class we delete ourselves here

  return 1;
}

virtual LRESULT CBaseDialog::OnNcDestroy | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]
virtual LRESULT CBaseDialog::OnNcDestroy | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]
virtual LRESULT CBaseDialog::OnOK | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]

Reimplemented in CAddDeviceDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, CAddFolderDlg, CAddVFileDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, and CAddVFileDlg.

virtual LRESULT CBaseDialog::OnOK | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]

Reimplemented in CAddDeviceDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, CAddFolderDlg, CAddVFileDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, and CAddVFileDlg.

LRESULT CBaseDialog::OnOK | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]

Reimplemented in CAddDeviceDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, CAddFolderDlg, CAddVFileDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, and CAddVFileDlg.

Definition at line 101 of file basedialog.cpp.

{
  return DestroyWindow( m_hWnd);
}

virtual LRESULT CBaseDialog::OnOK | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]

Reimplemented in CAddDeviceDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, CAddFolderDlg, CAddVFileDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, and CAddVFileDlg.

virtual LRESULT CBaseDialog::OnOK | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]

Reimplemented in CAddDeviceDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, CAddFolderDlg, CAddVFileDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, and CAddVFileDlg.

virtual LRESULT CBaseDialog::OnOK | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]

Reimplemented in CAddDeviceDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, CAddFolderDlg, CAddVFileDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, and CAddVFileDlg.

virtual BOOL CBaseDialog::ProcessMessage | ( | HWND | hDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [pure virtual]

Implemented in CAddDeviceDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, CAddFolderDlg, CAddVFileDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, and CAddVFileDlg.

virtual BOOL CBaseDialog::ProcessMessage | ( | HWND | hDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [pure virtual]

Implemented in CAddDeviceDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, CAddFolderDlg, CAddVFileDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, and CAddVFileDlg.

virtual BOOL CBaseDialog::ProcessMessage | ( | HWND | hDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [pure virtual]

Implemented in CAddDeviceDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, CAddFolderDlg, CAddVFileDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, and CAddVFileDlg.

virtual BOOL CBaseDialog::ProcessMessage | ( | HWND | hDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [pure virtual]

Implemented in CAddDeviceDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, CAddFolderDlg, CAddVFileDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, and CAddVFileDlg.

virtual BOOL CBaseDialog::ProcessMessage | ( | HWND | hDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [pure virtual]

Implemented in CAddDeviceDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, CAddFolderDlg, CAddVFileDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, and CAddVFileDlg.

virtual BOOL CBaseDialog::ProcessMessage | ( | HWND | hDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [pure virtual]

Implemented in CAddDeviceDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, CAddFolderDlg, CAddVFileDlg, CAddDeviceDlg, CAddVFileDlg, CAddDeviceDlg, and CAddVFileDlg.

Member Data Documentation

DLGPROC CBaseDialog::m_DlgProc [private]

Definition at line 35 of file basedialog.h.

DWORD CBaseDialog::m_dwFlags [private]

Definition at line 36 of file basedialog.h.

HWND CBaseDialog::m_hWnd [private]

Definition at line 33 of file basedialog.h.

ULONG CBaseDialog::m_nTemplate [private]

Definition at line 34 of file basedialog.h.

The documentation for this class was generated from the following files:
  • SysMgmt/MMC/mmc2.0/contextmenu/basedialog.h
  • SysMgmt/MMC/mmc2.0/dragdrop/basedialog.h
  • SysMgmt/MMC/mmc2.0/help/basedialog.h
  • SysMgmt/MMC/mmc2.0/multisel/basedialog.h
  • SysMgmt/MMC/mmc2.0/proppage/basedialog.h
  • SysMgmt/MMC/mmc2.0/viewex/basedialog.h
  • SysMgmt/MMC/mmc2.0/contextmenu/basedialog.cpp
  • SysMgmt/MMC/mmc2.0/dragdrop/basedialog.cpp
  • SysMgmt/MMC/mmc2.0/help/basedialog.cpp
  • SysMgmt/MMC/mmc2.0/multisel/basedialog.cpp
  • SysMgmt/MMC/mmc2.0/proppage/basedialog.cpp
  • SysMgmt/MMC/mmc2.0/viewex/basedialog.cpp
Generated on Wed Nov 13 2024 16:55:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CBaseNode Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Protected Attributes

CBaseNode Class Reference

#include "basenode.h"

Inherited by CDeviceNode, CDeviceNode, CDeviceNode, CDeviceNode, CDeviceNode, CDeviceNode, CFolderNode, CFolderNode, CFolderNode, CFolderNode, CFolderNode, CFolderNode, CStaticNode, CStaticNode, CStaticNode, CStaticNode, CStaticNode, CStaticNode, CStaticNode, CStaticNode, CVirtualFile, CVirtualFile, CVirtualFile, CVirtualFile, and CVirtualFile.

List of all members.

Public Member Functions

CBaseNode ()
CBaseNode ()
CBaseNode ()
CBaseNode ()
CBaseNode ()
CBaseNode ()
CBaseNode ()
CBaseNode ()
virtual | ~CBaseNode ()
virtual | ~CBaseNode ()
virtual | ~CBaseNode ()
virtual | ~CBaseNode ()
virtual | ~CBaseNode ()
virtual | ~CBaseNode ()
virtual | ~CBaseNode ()
virtual | ~CBaseNode ()
virtual HRESULT | AddMenuItems (LPCONTEXTMENUCALLBACK ipCallback, long __RPC_FAR *pInsertionAllowed)=0
virtual HRESULT | AddMenuItems (LPCONTEXTMENUCALLBACK ipCallback, long __RPC_FAR *pInsertionAllowed)=0
virtual HRESULT | AddMenuItems (LPCONTEXTMENUCALLBACK ipCallback, long __RPC_FAR *pInsertionAllowed)=0
virtual HRESULT | AddMenuItems (LPCONTEXTMENUCALLBACK ipCallback, long __RPC_FAR *pInsertionAllowed)=0
virtual HRESULT | AddMenuItems (LPCONTEXTMENUCALLBACK ipCallback, long __RPC_FAR *pInsertionAllowed)=0
virtual HRESULT | AddMenuItems (LPCONTEXTMENUCALLBACK ipCallback, long __RPC_FAR *pInsertionAllowed)=0
virtual HRESULT | Command (long lCommandID)=0
virtual HRESULT | Command (long lCommandID)=0
virtual HRESULT | Command (long lCommandID)=0
virtual HRESULT | Command (long lCommandID)=0
virtual HRESULT | Command (long lCommandID)=0
virtual HRESULT | Command (long lCommandID)=0
virtual HRESULT | ControlbarNotify (LPARAM nArg, LPARAM lParam, LONG_PTR pComp)=0
virtual HRESULT | CreatePropertyPages (LPPROPERTYSHEETCALLBACK lpCallback, LONG_PTR Handle)=0
virtual HRESULT | CreatePropertyPages (LPPROPERTYSHEETCALLBACK lpCallback, LONG_PTR Handle)=0
virtual DWORD | GetAttributes ()=0
virtual LPWSTR | GetAttributeString ()=0
virtual HRESULT | GetDisplayInfo (SCOPEDATAITEM *pSDI)=0
virtual HRESULT | GetDisplayInfo (RESULTDATAITEM *pRDI)=0
virtual HRESULT | GetDisplayInfo (RESULTDATAITEM *pRDI)=0
virtual HRESULT | GetDisplayInfo (SCOPEDATAITEM *pSDI)=0
virtual HRESULT | GetDisplayInfo (SCOPEDATAITEM *pSDI)=0
virtual HRESULT | GetDisplayInfo (SCOPEDATAITEM *pSDI)=0
virtual HRESULT | GetDisplayInfo (RESULTDATAITEM *pRDI)=0
virtual HRESULT | GetDisplayInfo (RESULTDATAITEM *pRDI)=0
virtual HRESULT | GetDisplayInfo (RESULTDATAITEM *pRDI)=0
virtual HRESULT | GetDisplayInfo (SCOPEDATAITEM *pSDI)=0
virtual HRESULT | GetDisplayInfo (RESULTDATAITEM *pRDI)=0
virtual HRESULT | GetDisplayInfo (SCOPEDATAITEM *pSDI)=0
virtual HRESULT | GetDisplayInfo (SCOPEDATAITEM *pSDI)=0
virtual HRESULT | GetDisplayInfo (RESULTDATAITEM *pRDI)=0
virtual HRESULT | GetDisplayInfo (SCOPEDATAITEM *pSDI)=0
virtual HRESULT | GetDisplayInfo (RESULTDATAITEM *pRDI)=0
virtual GUID & | GetNodeGUID ()=0
virtual GUID & | GetNodeGUID ()=0
virtual GUID & | GetNodeGUID ()=0
virtual GUID & | GetNodeGUID ()=0
virtual GUID * | GetNodeGUID ()=0
virtual GUID & | GetNodeGUID ()=0
virtual GUID & | GetNodeGUID ()=0
virtual GUID * | GetNodeGUID ()=0
LPWSTR | GetNodeName ()
LPWSTR | GetNodeName ()
LPWSTR | GetNodeName ()
LPWSTR | GetNodeName ()
LPWSTR | GetNodeName ()
LPWSTR | GetNodeName ()
LPWSTR | GetNodeName ()
LPWSTR | GetNodeName ()
virtual ULONG | GetNodeType ()=0
virtual ULONG | GetNodeType ()=0
virtual ULONG | GetNodeType ()=0
virtual ULONG | GetNodeType ()=0
virtual ULONG | GetNodeType ()=0
virtual ULONG | GetNodeType ()=0
virtual ULONG | GetNodeType ()=0
virtual ULONG | GetNodeType ()=0
virtual LPWSTR | GetObjectPath ()=0
virtual HRESULT | GetProperties (LPNODEPROPS *ppNodeProps)=0
virtual HRESULT | GetProperty (BSTR szPropertyName, PBSTR pbstrProperty)=0
virtual HRESULT | GetResultViewType2 (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pRVTinfo)=0
virtual HRESULT | GetResultViewType2 (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pRVTinfo)=0
virtual HRESULT | GetResultViewType2 (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pRVTinfo)=0
virtual HRESULT | GetResultViewType2 (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pRVTinfo)=0
virtual HRESULT | GetResultViewType2 (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pRVTinfo)=0
virtual HRESULT | GetResultViewType2 (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pRVTinfo)=0
virtual HRESULT | GetResultViewType2 (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pRVTinfo)=0
virtual HRESULT | GetResultViewType2 (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pRVTinfo)=0
virtual HRESULT | GetWatermarks (HBITMAP __RPC_FAR *lphWatermark, HBITMAP __RPC_FAR *lphHeader, HPALETTE __RPC_FAR *lphPalette, BOOL __RPC_FAR *bStretch)=0
virtual HRESULT | GetWatermarks (HBITMAP __RPC_FAR *lphWatermark, HBITMAP __RPC_FAR *lphHeader, HPALETTE __RPC_FAR *lphPalette, BOOL __RPC_FAR *bStretch)=0
virtual HRESULT | Initialize (LPNODEPROPS pNodeProps)=0
virtual HRESULT | Initialize (NODE_PROPERTIES *pProperties)=0
virtual HRESULT | Initialize (NODE_PROPERTIES *pProperties)=0
virtual HRESULT | Initialize (NODE_PROPERTIES *pProperties)=0
virtual HRESULT | Initialize (NODE_PROPERTIES *pProperties)=0
virtual HRESULT | Initialize (NODE_PROPERTIES *pProperties)=0
virtual HRESULT | Initialize (NODE_PROPERTIES *pProperties)=0
virtual HRESULT | Initialize (NODE_PROPERTIES *pProperties)=0
virtual BOOL | IsAttributeSet (DWORD dwAttribute)=0
virtual HRESULT | OnContextHelp (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)=0
virtual HRESULT | OnCutOrMove (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)=0
virtual HRESULT | OnDelete (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)=0
virtual HRESULT | OnDelete (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)=0
virtual HRESULT | OnDelete (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pComponent)=0
virtual HRESULT | OnExpand (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pCompData)=0
virtual HRESULT | OnExpand (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pCompData)=0
virtual HRESULT | OnExpand (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pCompData)=0
virtual HRESULT | OnExpand (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pCompData)=0
virtual HRESULT | OnExpand (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pCompData)=0
virtual HRESULT | OnExpand (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pCompData)=0
virtual HRESULT | OnPaste (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)=0
virtual HRESULT | OnQueryPaste (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)=0
virtual HRESULT | OnRemoveChildren (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pCompData)=0
virtual HRESULT | OnRemoveChildren (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pCompData)=0
virtual HRESULT | OnRemoveChildren (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pCompData)=0
virtual HRESULT | OnRemoveChildren (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pCompData)=0
virtual HRESULT | OnRemoveChildren (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pCompData)=0
virtual HRESULT | OnRemoveChildren (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pCompData)=0
virtual HRESULT | OnRename (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)=0
virtual HRESULT | OnRename (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)=0
virtual HRESULT | OnRename (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)=0
virtual HRESULT | OnSelect (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pComponent)=0
virtual HRESULT | OnSelect (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)=0
virtual HRESULT | OnSelect (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pComponent)=0
virtual HRESULT | OnSelect (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)=0
virtual HRESULT | OnSelect (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pComponent)=0
virtual HRESULT | OnSelect (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pComponent)=0
virtual HRESULT | OnSelect (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)=0
virtual HRESULT | OnSelect (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)=0
virtual HRESULT | OnShow (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)=0
virtual HRESULT | OnShow (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pComponent)=0
virtual HRESULT | OnShow (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pComponent)=0
virtual HRESULT | OnShow (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)=0
virtual HRESULT | OnShow (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)=0
virtual HRESULT | OnShow (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)=0
virtual HRESULT | OnShow (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pComponent)=0
virtual HRESULT | OnShow (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pComponent)=0
virtual HRESULT | OnViewChange (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pComponent)
virtual HRESULT | OnViewChange (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
virtual HRESULT | OnViewChange (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)=0
virtual HRESULT | OnViewChange (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)=0
virtual HRESULT | OnViewChange (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
virtual HRESULT | QueryForPropertyPage ()=0
virtual HRESULT | QueryForPropertyPage ()=0
virtual VOID | RemoveAttribute (DWORD dwAttribute)=0
virtual VOID | SetAttribute (DWORD dwAttribute)=0

Public Attributes

DWORD m_dwAttributes
WCHAR | m_pAttributeStr [16]
RESULTDATAITEM | m_RDI
SCOPEDATAITEM | m_SDI

Protected Attributes

LONG | m_nPropPageCount
LPWSTR | m_pwszNodeName

Detailed Description

Definition at line 43 of file basenode.h.

Constructor & Destructor Documentation

CBaseNode::CBaseNode ( ) [inline]

Definition at line 46 of file basenode.h.

    {
      m_pwszNodeName      = NULL;

      ZeroMemory( &m_SDI, sizeof(SCOPEDATAITEM) );
      ZeroMemory( &m_RDI, sizeof(RESULTDATAITEM) );
    };

virtual CBaseNode::~CBaseNode ( ) [inline, virtual]

Definition at line 54 of file basenode.h.

    {
      if( NULL != m_pwszNodeName )
        CoTaskMemFree( m_pwszNodeName );
    };

CBaseNode::CBaseNode ( ) [inline]

Definition at line 53 of file basenode.h.

    {
      m_pwszNodeName      = NULL;

      ZeroMemory( &m_SDI, sizeof(SCOPEDATAITEM) );
      ZeroMemory( &m_RDI, sizeof(RESULTDATAITEM) );
    };

virtual CBaseNode::~CBaseNode ( ) [inline, virtual]

Definition at line 61 of file basenode.h.

    {
      if( NULL != m_pwszNodeName )
        CoTaskMemFree( m_pwszNodeName );
    };

CBaseNode::CBaseNode ( ) [inline]

Definition at line 71 of file basenode.h.

    {
      m_pwszNodeName      = NULL;

      ZeroMemory( &m_SDI, sizeof(SCOPEDATAITEM) );
      ZeroMemory( &m_RDI, sizeof(RESULTDATAITEM) );
    };

virtual CBaseNode::~CBaseNode ( ) [inline, virtual]

Definition at line 79 of file basenode.h.

    {
      if( NULL != m_pwszNodeName )
        CoTaskMemFree( m_pwszNodeName );
    };

CBaseNode::CBaseNode ( ) [inline]

Definition at line 53 of file basenode.h.

    {
      m_pwszNodeName   = NULL;
      m_nPropPageCount = 0;

      ZeroMemory( &m_SDI, sizeof(SCOPEDATAITEM) );
      ZeroMemory( &m_RDI, sizeof(RESULTDATAITEM) );
    };

virtual CBaseNode::~CBaseNode ( ) [inline, virtual]

Definition at line 62 of file basenode.h.

    {
      if( NULL != m_pwszNodeName )
        CoTaskMemFree( m_pwszNodeName );
    };

CBaseNode::CBaseNode ( ) [inline]

Definition at line 53 of file basenode.h.

    {
      m_pwszNodeName      = NULL;

      ZeroMemory( &m_SDI, sizeof(SCOPEDATAITEM) );
      ZeroMemory( &m_RDI, sizeof(RESULTDATAITEM) );
    };

virtual CBaseNode::~CBaseNode ( ) [inline, virtual]

Definition at line 61 of file basenode.h.

    {
      if( NULL != m_pwszNodeName )
        CoTaskMemFree( m_pwszNodeName );
    };

CBaseNode::CBaseNode ( ) [inline]

Definition at line 53 of file basenode.h.

    {
      m_pwszNodeName   = NULL;
      m_nPropPageCount = 0;
      m_dwAttributes   = 0;
      *m_pAttributeStr = NULL;

      ZeroMemory( &m_SDI, sizeof(SCOPEDATAITEM) );
      ZeroMemory( &m_RDI, sizeof(RESULTDATAITEM) );
    };

virtual CBaseNode::~CBaseNode ( ) [inline, virtual]

Definition at line 64 of file basenode.h.

    {
      if( NULL != m_pwszNodeName )
        CoTaskMemFree( m_pwszNodeName );
    };

CBaseNode::CBaseNode ( ) [inline]

Definition at line 46 of file basenode.h.

    {
      m_pwszNodeName      = NULL;

      ZeroMemory( &m_SDI, sizeof(SCOPEDATAITEM) );
      ZeroMemory( &m_RDI, sizeof(RESULTDATAITEM) );
    };

virtual CBaseNode::~CBaseNode ( ) [inline, virtual]

Definition at line 54 of file basenode.h.

    {
      if( NULL != m_pwszNodeName )
        CoTaskMemFree( m_pwszNodeName );
    };

CBaseNode::CBaseNode ( ) [inline]

Definition at line 53 of file basenode.h.

    {
      m_pwszNodeName      = NULL;

      ZeroMemory( &m_SDI, sizeof(SCOPEDATAITEM) );
      ZeroMemory( &m_RDI, sizeof(RESULTDATAITEM) );
    };

virtual CBaseNode::~CBaseNode ( ) [inline, virtual]

Definition at line 61 of file basenode.h.

    {
      if( NULL != m_pwszNodeName )
        CoTaskMemFree( m_pwszNodeName );
    };

Member Function Documentation

virtual HRESULT CBaseNode::AddMenuItems | ( | LPCONTEXTMENUCALLBACK | ipCallback,
 |  | long __RPC_FAR * | pInsertionAllowed |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::AddMenuItems | ( | LPCONTEXTMENUCALLBACK | ipCallback,
 |  | long __RPC_FAR * | pInsertionAllowed |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::AddMenuItems | ( | LPCONTEXTMENUCALLBACK | ipCallback,
 |  | long __RPC_FAR * | pInsertionAllowed |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::AddMenuItems | ( | LPCONTEXTMENUCALLBACK | ipCallback,
 |  | long __RPC_FAR * | pInsertionAllowed |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::AddMenuItems | ( | LPCONTEXTMENUCALLBACK | ipCallback,
 |  | long __RPC_FAR * | pInsertionAllowed |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::AddMenuItems | ( | LPCONTEXTMENUCALLBACK | ipCallback,
 |  | long __RPC_FAR * | pInsertionAllowed |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::Command ( long lCommandID ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::Command ( long lCommandID ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::Command ( long lCommandID ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::Command ( long lCommandID ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::Command ( long lCommandID ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::Command ( long lCommandID ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::ControlbarNotify | ( | LPARAM | nArg,
 |  | LPARAM | lParam,
 |  | LONG_PTR | pComp |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::CreatePropertyPages | ( | LPPROPERTYSHEETCALLBACK | lpCallback,
 |  | LONG_PTR | Handle |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::CreatePropertyPages | ( | LPPROPERTYSHEETCALLBACK | lpCallback,
 |  | LONG_PTR | Handle |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual DWORD CBaseNode::GetAttributes ( ) [pure virtual]

Implemented in CVirtualFile, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, and CVirtualFile.

virtual LPWSTR CBaseNode::GetAttributeString ( ) [pure virtual]

Implemented in CVirtualFile, CVirtualFile, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, and CVirtualFile.

virtual HRESULT CBaseNode::GetDisplayInfo ( SCOPEDATAITEM * pSDI ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::GetDisplayInfo ( RESULTDATAITEM * pRDI ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::GetDisplayInfo ( SCOPEDATAITEM * pSDI ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::GetDisplayInfo ( RESULTDATAITEM * pRDI ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::GetDisplayInfo ( RESULTDATAITEM * pRDI ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::GetDisplayInfo ( SCOPEDATAITEM * pSDI ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::GetDisplayInfo ( RESULTDATAITEM * pRDI ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::GetDisplayInfo ( SCOPEDATAITEM * pSDI ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::GetDisplayInfo ( SCOPEDATAITEM * pSDI ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::GetDisplayInfo ( RESULTDATAITEM * pRDI ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::GetDisplayInfo ( SCOPEDATAITEM * pSDI ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::GetDisplayInfo ( RESULTDATAITEM * pRDI ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::GetDisplayInfo ( RESULTDATAITEM * pRDI ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::GetDisplayInfo ( SCOPEDATAITEM * pSDI ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::GetDisplayInfo ( SCOPEDATAITEM * pSDI ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::GetDisplayInfo ( RESULTDATAITEM * pRDI ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual GUID& CBaseNode::GetNodeGUID ( ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual GUID* CBaseNode::GetNodeGUID ( ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual GUID& CBaseNode::GetNodeGUID ( ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual GUID& CBaseNode::GetNodeGUID ( ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual GUID& CBaseNode::GetNodeGUID ( ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual GUID* CBaseNode::GetNodeGUID ( ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual GUID& CBaseNode::GetNodeGUID ( ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual GUID& CBaseNode::GetNodeGUID ( ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

LPWSTR CBaseNode::GetNodeName ( ) [inline]

Definition at line 71 of file basenode.h.

{ return m_pwszNodeName;  };

LPWSTR CBaseNode::GetNodeName ( ) [inline]

Definition at line 68 of file basenode.h.

{ return m_pwszNodeName;  }

LPWSTR CBaseNode::GetNodeName ( ) [inline]

Definition at line 69 of file basenode.h.

{ return m_pwszNodeName;  };

LPWSTR CBaseNode::GetNodeName ( ) [inline]

Definition at line 86 of file basenode.h.

{ return m_pwszNodeName;  };

LPWSTR CBaseNode::GetNodeName ( ) [inline]

Definition at line 61 of file basenode.h.

{ return m_pwszNodeName;  }

LPWSTR CBaseNode::GetNodeName ( ) [inline]

Definition at line 61 of file basenode.h.

{ return m_pwszNodeName;  }

LPWSTR CBaseNode::GetNodeName ( ) [inline]

Definition at line 68 of file basenode.h.

{ return m_pwszNodeName;  };

LPWSTR CBaseNode::GetNodeName ( ) [inline]

Definition at line 68 of file basenode.h.

{ return m_pwszNodeName;  }

virtual ULONG CBaseNode::GetNodeType ( ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual ULONG CBaseNode::GetNodeType ( ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual ULONG CBaseNode::GetNodeType ( ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual ULONG CBaseNode::GetNodeType ( ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual ULONG CBaseNode::GetNodeType ( ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual ULONG CBaseNode::GetNodeType ( ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual ULONG CBaseNode::GetNodeType ( ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual ULONG CBaseNode::GetNodeType ( ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual LPWSTR CBaseNode::GetObjectPath ( ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::GetProperties ( LPNODEPROPS * ppNodeProps ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::GetProperty | ( | BSTR | szPropertyName,
 |  | PBSTR | pbstrProperty |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::GetResultViewType2 | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pRVTinfo |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::GetResultViewType2 | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pRVTinfo |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::GetResultViewType2 | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pRVTinfo |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::GetResultViewType2 | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pRVTinfo |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::GetResultViewType2 | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pRVTinfo |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::GetResultViewType2 | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pRVTinfo |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::GetResultViewType2 | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pRVTinfo |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::GetResultViewType2 | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pRVTinfo |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::GetWatermarks | ( | HBITMAP __RPC_FAR * | lphWatermark,
 |  | HBITMAP __RPC_FAR * | lphHeader,
 |  | HPALETTE __RPC_FAR * | lphPalette,
 |  | BOOL __RPC_FAR * | bStretch |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::GetWatermarks | ( | HBITMAP __RPC_FAR * | lphWatermark,
 |  | HBITMAP __RPC_FAR * | lphHeader,
 |  | HPALETTE __RPC_FAR * | lphPalette,
 |  | BOOL __RPC_FAR * | bStretch |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::Initialize ( NODE_PROPERTIES * pProperties ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::Initialize ( NODE_PROPERTIES * pProperties ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::Initialize ( NODE_PROPERTIES * pProperties ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::Initialize ( NODE_PROPERTIES * pProperties ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::Initialize ( NODE_PROPERTIES * pProperties ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::Initialize ( LPNODEPROPS pNodeProps ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CVirtualFile, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::Initialize ( NODE_PROPERTIES * pProperties ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::Initialize ( NODE_PROPERTIES * pProperties ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual BOOL CBaseNode::IsAttributeSet ( DWORD dwAttribute ) [pure virtual]

Implemented in CVirtualFile, CVirtualFile, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, and CVirtualFile.

virtual HRESULT CBaseNode::OnContextHelp | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::OnCutOrMove | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::OnDelete | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::OnDelete | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::OnDelete | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::OnExpand | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::OnExpand | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::OnExpand | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::OnExpand | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::OnExpand | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::OnExpand | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::OnPaste | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::OnQueryPaste | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::OnRemoveChildren | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::OnRemoveChildren | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::OnRemoveChildren | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::OnRemoveChildren | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::OnRemoveChildren | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::OnRemoveChildren | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::OnRename | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::OnRename | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::OnRename | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::OnSelect | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::OnSelect | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::OnSelect | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::OnSelect | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::OnSelect | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::OnSelect | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::OnSelect | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::OnSelect | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::OnShow | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::OnShow | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::OnShow | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::OnShow | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::OnShow | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::OnShow | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::OnShow | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::OnShow | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [pure virtual]

Implemented in CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::OnViewChange | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [pure virtual]

Implemented in CFolderNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::OnViewChange | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [inline, virtual]

Reimplemented in CFolderNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

Definition at line 119 of file basenode.h.

                     { return E_NOTIMPL; };

virtual HRESULT CBaseNode::OnViewChange | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [inline, virtual]

Reimplemented in CFolderNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

Definition at line 108 of file basenode.h.

                     { return E_NOTIMPL; };

virtual HRESULT CBaseNode::OnViewChange | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [inline, virtual]

Reimplemented in CFolderNode.

Definition at line 109 of file basenode.h.

                     { return E_NOTIMPL; };

virtual HRESULT CBaseNode::OnViewChange | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [pure virtual]

Implemented in CFolderNode, CFolderNode, CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::QueryForPropertyPage ( ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual HRESULT CBaseNode::QueryForPropertyPage ( ) [pure virtual]

Implemented in CDeviceNode, CFolderNode, CVirtualFile, CDeviceNode, CFolderNode, and CVirtualFile.

virtual VOID CBaseNode::RemoveAttribute ( DWORD dwAttribute ) [pure virtual]

Implemented in CVirtualFile, CVirtualFile, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, and CVirtualFile.

virtual VOID CBaseNode::SetAttribute ( DWORD dwAttribute ) [pure virtual]

Implemented in CVirtualFile, CVirtualFile, CVirtualFile, CDeviceNode, CFolderNode, CVirtualFile, and CVirtualFile.

Member Data Documentation

DWORD CBaseNode::m_dwAttributes

Reimplemented in CDeviceNode, CFolderNode, and CVirtualFile.

Definition at line 124 of file basenode.h.

LONG CBaseNode::m_nPropPageCount [protected]

Definition at line 117 of file basenode.h.

WCHAR CBaseNode::m_pAttributeStr[16]

Reimplemented in CVirtualFile.

Definition at line 125 of file basenode.h.

LPWSTR CBaseNode::m_pwszNodeName [protected]

Definition at line 87 of file basenode.h.

RESULTDATAITEM CBaseNode::m_RDI

Definition at line 84 of file basenode.h.

SCOPEDATAITEM CBaseNode::m_SDI

Definition at line 83 of file basenode.h.

The documentation for this class was generated from the following files:
  • SysMgmt/MMC/mmc2.0/about/basenode.h
  • SysMgmt/MMC/mmc2.0/contextmenu/basenode.h
  • SysMgmt/MMC/mmc2.0/dragdrop/basenode.h
  • SysMgmt/MMC/mmc2.0/help/basenode.h
  • SysMgmt/MMC/mmc2.0/multisel/basenode.h
  • SysMgmt/MMC/mmc2.0/proppage/basenode.h
  • SysMgmt/MMC/mmc2.0/simple/basenode.h
  • SysMgmt/MMC/mmc2.0/viewex/basenode.h
Generated on Wed Nov 13 2024 16:55:39 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CBaseObj Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes

CBaseObj Class Reference

#include "baseobj.h"

Inherits com::ms::com::IUnknown.

Inherited by CBinder, CCommand, CDataSource, CDBSession, CRow, CRowset, and CStream.

List of all members.

Public Member Functions

virtual | ~CBaseObj ()
EBaseObjectType GetBaseObjectType ()
IUnknown * | GetOuterUnknown ()

Protected Member Functions

CBaseObj (EBaseObjectType botVal)

Protected Attributes

LPUNKNOWN | m_pUnkOuter

Private Attributes

EBaseObjectType m_BaseObjectType

Detailed Description

Definition at line 41 of file baseobj.h.

Constructor & Destructor Documentation

CBaseObj::CBaseObj ( EBaseObjectType botVal ) [protected]

Definition at line 24 of file baseobj.cpp.

{
  m_BaseObjectType = botVal;
}

CBaseObj::~CBaseObj ( ) [virtual]

Definition at line 39 of file baseobj.cpp.

{
}

Member Function Documentation

EBaseObjectType CBaseObj::GetBaseObjectType ( ) [inline]

Definition at line 61 of file baseobj.h.

  {
    return m_BaseObjectType;
  }

IUnknown* CBaseObj::GetOuterUnknown ( ) [inline]

Definition at line 67 of file baseobj.h.

  {
    return m_pUnkOuter;
  }

Member Data Documentation

EBaseObjectType CBaseObj::m_BaseObjectType [private]

Definition at line 46 of file baseobj.h.

LPUNKNOWN CBaseObj::m_pUnkOuter [protected]

Definition at line 51 of file baseobj.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/sampprov/baseobj.h
  • Dataaccess/oledb/sampprov/baseobj.cpp
Generated on Wed Nov 13 2024 16:55:40 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CBasePropertyPage Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes

CBasePropertyPage Class Reference

#include "BasePage.h"

Inherits CPropertyPage, and CPropertyPage.

Inherited by CClipBookServerParamsPage, and CFileShareSampleParamsPage.

List of all members.

Public Types

enum | { IDD = 0 }
enum | { IDD = 0 }

Public Member Functions

CBasePropertyPage (void)
CBasePropertyPage (UINT nIDTemplateIn, UINT nIDCaptionIn=0)
CBasePropertyPage (void)
CBasePropertyPage (UINT nIDTemplateIn, UINT nIDCaptionIn=0)
virtual | ~CBasePropertyPage (void)
virtual | ~CBasePropertyPage (void)
CLUADMEX_OBJECT_TYPE | Cot (void) const
CLUADMEX_OBJECT_TYPE | Cot (void) const
HPROPSHEETPAGE | Hpage (void) const
HPROPSHEETPAGE | Hpage (void) const
HRESULT | HrCreatePage (void)
HRESULT | HrCreatePage (void)
virtual HRESULT | HrInit (CExtObject *peoInout)
virtual HRESULT | HrInit (CExtObject *peoInout)
virtual BOOL | OnApply ()
virtual BOOL | OnApply ()
virtual BOOL | OnSetActive ()
virtual BOOL | OnSetActive ()
virtual LRESULT | OnWizardBack ()
virtual LRESULT | OnWizardBack ()
virtual BOOL | OnWizardFinish ()
virtual BOOL | OnWizardFinish ()
virtual LRESULT | OnWizardNext ()
virtual LRESULT | OnWizardNext ()

Public Attributes

CStatic | m_staticIcon
CStatic | m_staticTitle
CString m_strTitle

Protected Member Functions

virtual BOOL | BApplyChanges (void)
virtual BOOL | BApplyChanges (void)
BOOL | BBackPressed (void) const
BOOL | BBackPressed (void) const
virtual BOOL | BBuildPropList (CClusPropList &rcplInout, BOOL fNoNewPropsIn=FALSE)
virtual BOOL | BBuildPropList (CClusPropList &rcplInout, BOOL fNoNewPropsIn=FALSE)
BOOL | BSaved (void) const
BOOL | BSaved (void) const
BOOL | BSetPrivateProps (BOOL fValidateOnlyIn=FALSE, BOOL fNoNewPropsIn=FALSE)
BOOL | BSetPrivateProps (BOOL fValidateOnlyIn=FALSE, BOOL fNoNewPropsIn=FALSE)
BOOL | BWizard (void) const
BOOL | BWizard (void) const
void | CommonConstruct (void)
void | CommonConstruct (void)
virtual DWORD | Cprops (void) const
virtual DWORD | Cprops (void) const
virtual void | DisplaySetPropsError (DWORD scIn, UINT idsOperIn) const
virtual void | DisplaySetPropsError (DWORD scIn, UINT idsOperIn) const
virtual void | DoDataExchange (CDataExchange *pDX)
virtual void | DoDataExchange (CDataExchange *pDX)
void | EnableNext (BOOL fEnableIn=TRUE)
void | EnableNext (BOOL fEnableIn=TRUE)
HCLUSTER | Hcluster (void) const
HCLUSTER | Hcluster (void) const
IDD | IddPropertyPage (void) const
IDD | IddPropertyPage (void) const
IDD | IddWizardPage (void) const
IDD | IddWizardPage (void) const
IDS | IdsCaption (void) const
IDS | IdsCaption (void) const
afx_msg void | OnChangeCtrl ()
afx_msg void | OnChangeCtrl ()
afx_msg int | OnCreate (LPCREATESTRUCT lpCreateStruct)
afx_msg int | OnCreate (LPCREATESTRUCT lpCreateStruct)
afx_msg void | OnDestroy ()
afx_msg void | OnDestroy ()
virtual BOOL | OnInitDialog ()
virtual BOOL | OnInitDialog ()
CExtObject * | Peo (void) const
CExtObject * | Peo (void) const
IWCWizardCallback * | PiWizardCallback (void) const
IWCWizardCallback * | PiWizardCallback (void) const
virtual const CObjectProperty * | Pprops (void) const
virtual const CObjectProperty * | Pprops (void) const
DWORD | ScParseProperties (CClusPropList &rcplIn)
DWORD | ScParseProperties (CClusPropList &rcplIn)
virtual DWORD | ScParseUnknownProperty (LPCWSTR pwszNameIn, const CLUSPROP_BUFFER_HELPER &rvalueIn, DWORD cbBufIn)
virtual DWORD | ScParseUnknownProperty (LPCWSTR pwszNameIn, const CLUSPROP_BUFFER_HELPER &rvalueIn, DWORD cbBufIn)

Protected Attributes

BOOL m_bBackPressed
BOOL m_bDoDetach
BOOL m_bSaved
HPROPSHEETPAGE | m_hpage
IDD m_iddPropertyPage
IDD m_iddWizardPage
IDS m_idsCaption
CExtObject * m_peo

Detailed Description

Definition at line 41 of file BasePage.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 98 of file BasePage.h.

{ IDD = 0 };

anonymous enum
Enumerator:
IDD

Definition at line 98 of file BasePage.h.

{ IDD = 0 };

Constructor & Destructor Documentation

CBasePropertyPage::CBasePropertyPage ( void )

Definition at line 64 of file BasePage.cpp.

{
    CommonConstruct();

} //*** CBasePropertyPage::CBasePropertyPage

CBasePropertyPage::CBasePropertyPage | ( | UINT | nIDTemplateIn,
 |  | UINT | nIDCaptionIn = 0
 | ) |  |

Definition at line 90 of file BasePage.cpp.

    : CPropertyPage( nIDTemplateIn, nIDCaptionIn )
{
    CommonConstruct();

} //*** CBasePropertyPage::CBasePropertyPage

virtual CBasePropertyPage::~CBasePropertyPage ( void ) [inline, virtual]

Definition at line 54 of file BasePage.h.

    {
    } //*** ~CBasePropertyPage

CBasePropertyPage::CBasePropertyPage ( void )
CBasePropertyPage::CBasePropertyPage | ( | UINT | nIDTemplateIn,
 |  | UINT | nIDCaptionIn = 0
 | ) |  |
virtual CBasePropertyPage::~CBasePropertyPage ( void ) [inline, virtual]

Definition at line 54 of file BasePage.h.

    {
    } //*** ~CBasePropertyPage

Member Function Documentation

BOOL CBasePropertyPage::BApplyChanges ( void ) [protected, virtual]

Definition at line 1060 of file BasePage.cpp.

{
    AFX_MANAGE_STATE( AfxGetStaticModuleState() );

    CWaitCursor wc;

    //
    //  Save data.
    //

    return BSetPrivateProps();

} //*** CBasePropertyPage::BApplyChanges

virtual BOOL CBasePropertyPage::BApplyChanges ( void ) [protected, virtual]
BOOL CBasePropertyPage::BBackPressed ( void ) const [inline, protected]

Definition at line 149 of file BasePage.h.

{ return m_bBackPressed; }

BOOL CBasePropertyPage::BBackPressed ( void ) const [inline, protected]

Definition at line 149 of file BasePage.h.

{ return m_bBackPressed; }

BOOL CBasePropertyPage::BBuildPropList | ( | CClusPropList & | rcplInout,
 |  | BOOL | fNoNewPropsIn = FALSE |
 | ) |  |  | [protected, virtual]

Definition at line 1102 of file BasePage.cpp.

{
    BOOL                    fNewPropsFound = FALSE;
    DWORD                   cprop;
    const CObjectProperty * pprop;

    for ( pprop = Pprops(), cprop = Cprops() ; cprop > 0 ; pprop++, cprop-- )
    {
        if ( fNoNewPropsIn && (pprop->m_dwFlags & CObjectProperty::opfNew) )
        {
            fNewPropsFound = TRUE;
            continue;
        } // if: no new props allowed and this is a new property

        switch ( pprop->m_propFormat )
        {
            case CLUSPROP_FORMAT_SZ:
                rcplIn.ScAddProp(
                          pprop->m_pwszName
                        , *pprop->m_value.pstr
                        , *pprop->m_valuePrev.pstr
                        );
                break;

            case CLUSPROP_FORMAT_EXPAND_SZ:
                rcplIn.ScAddExpandSzProp(
                          pprop->m_pwszName
                        , *pprop->m_value.pstr
                        , *pprop->m_valuePrev.pstr
                        );
                break;

            case CLUSPROP_FORMAT_DWORD:
                rcplIn.ScAddProp(
                          pprop->m_pwszName
                        , *pprop->m_value.pdw
                        , *pprop->m_valuePrev.pdw
                        );
                break;

            case CLUSPROP_FORMAT_LONG:
                rcplIn.ScAddProp(
                          pprop->m_pwszName
                        , *pprop->m_value.pl
                        , *pprop->m_valuePrev.pl
                        );
                break;

            case CLUSPROP_FORMAT_BINARY:
            case CLUSPROP_FORMAT_MULTI_SZ:
                rcplIn.ScAddProp(
                          pprop->m_pwszName
                        , *pprop->m_value.ppb
                        , *pprop->m_value.pcb
                        , *pprop->m_valuePrev.ppb
                        , *pprop->m_valuePrev.pcb
                        );
                break;

            default:
                ASSERT( 0 ); // don't know how to deal with this type
                return FALSE;

        } // switch: property format
    } // for: each property

    return ( !( fNoNewPropsIn || fNewPropsFound ) );

} //*** CBasePropertyPage::BBuildPropList

virtual BOOL CBasePropertyPage::BBuildPropList | ( | CClusPropList & | rcplInout,
 |  | BOOL | fNoNewPropsIn = FALSE |
 | ) |  |  | [protected, virtual]
BOOL CBasePropertyPage::BSaved ( void ) const [inline, protected]

Definition at line 150 of file BasePage.h.

{ return m_bSaved; }

BOOL CBasePropertyPage::BSaved ( void ) const [inline, protected]

Definition at line 150 of file BasePage.h.

{ return m_bSaved; }

BOOL CBasePropertyPage::BSetPrivateProps | ( | BOOL | fValidateOnlyIn = FALSE,
 |  | BOOL | fNoNewPropsIn = FALSE |
 | ) |  |  | [protected]

Definition at line 1200 of file BasePage.cpp.

{
    BOOL            fSuccess   = TRUE;
    CClusPropList   cpl( BWizard() /*bAlwaysAddProp*/ );

    ASSERT( Peo() != NULL );
    ASSERT( Peo()->PodObjData() );

    //
    //  Build the property list.
    //

    try
    {
        fSuccess = BBuildPropList( cpl, fNoNewPropsIn );
    } // try
    catch ( CException * pe )
    {
        pe->ReportError();
        pe->Delete();
        fSuccess = FALSE;
    } // catch: CException

    //
    //  Set the data.
    //

    if ( fSuccess )
    {
        if ( (cpl.PbPropList() != NULL) && (cpl.CbPropList() > 0) )
        {
            DWORD       sc = ERROR_SUCCESS;
            DWORD       dwControlCode;
            DWORD       cbProps;

            switch ( Cot() )
            {
                case CLUADMEX_OT_NODE:
                {
                    CNodeData * pcnd = reinterpret_cast< CNodeData * >( Peo()->PodObjData() );
                    ASSERT( pcnd && (pcnd->GetHNode() != NULL) );

                    //
                    //  Determine which control code to use.
                    //

                    if ( fValidateOnlyIn )
                    {
                        dwControlCode = CLUSCTL_NODE_VALIDATE_PRIVATE_PROPERTIES;
                    } // if: only validating data
                    else
                    {
                        dwControlCode = CLUSCTL_NODE_SET_PRIVATE_PROPERTIES;
                    } // else: setting data

                    //
                    //  Set private properties.
                    //

                    sc = ClusterNodeControl(
                                      pcnd->GetHNode()
                                    , NULL   // hNode
                                    , dwControlCode
                                    , cpl.PbPropList()
                                    , cpl.CbPropList()
                                    , NULL   // lpOutBuffer
                                    , 0      // nOutBufferSize
                                    , &cbProps
                                    );
                    break;
                } // case:

                case CLUADMEX_OT_GROUP:
                {
                    CGroupData * pcgd = reinterpret_cast< CGroupData * >( Peo()->PodObjData() );
                    ASSERT( pcgd && (pcgd->GetHGroup() != NULL) );

                    //
                    //  Determine which control code to use.
                    //

                    if ( fValidateOnlyIn )
                    {
                        dwControlCode = CLUSCTL_GROUP_VALIDATE_PRIVATE_PROPERTIES;
                    } // if: only validating data
                    else
                    {
                        dwControlCode = CLUSCTL_GROUP_SET_PRIVATE_PROPERTIES;
                    } // else: setting data

                    //
                    //  Set private properties.
                    //

                    sc = ClusterGroupControl(
                                      pcgd->GetHGroup()
                                    , NULL   // hNode
                                    , dwControlCode
                                    , cpl.PbPropList()
                                    , cpl.CbPropList()
                                    , NULL   // lpOutBuffer
                                    , 0      // nOutBufferSize
                                    , &cbProps
                                    );
                    break;
                } // case:

                case CLUADMEX_OT_RESOURCE:
                {
                    CResData * pcrd = reinterpret_cast< CResData * >( Peo()->PodObjData() );
                    ASSERT( pcrd && (pcrd->GetHResource() != NULL) );

                    //
                    //  Determine which control code to use.
                    //

                    if ( fValidateOnlyIn )
                    {
                        dwControlCode = CLUSCTL_RESOURCE_VALIDATE_PRIVATE_PROPERTIES;
                    } // if: only validating data
                    else
                    {
                        dwControlCode = CLUSCTL_RESOURCE_SET_PRIVATE_PROPERTIES;
                    } // else: setting data

                    //
                    //  Set private properties.
                    //

                    sc = ClusterResourceControl(
                                      pcrd->GetHResource()
                                    , NULL   // hNode
                                    , dwControlCode
                                    , cpl.PbPropList()
                                    , cpl.CbPropList()
                                    , NULL   // lpOutBuffer
                                    , 0      // nOutBufferSize
                                    , &cbProps
                                    );
                    break;
                } // case:

                case CLUADMEX_OT_RESOURCETYPE:
                {
                    CResTypeData * pcrd = reinterpret_cast< CResTypeData * >( Peo()->PodObjData() );
                    ASSERT( pcrd && (pcrd->StrName().GetLength() > 0) );

                    //
                    //  Determine which control code to use.
                    //

                    if ( fValidateOnlyIn )
                    {
                        dwControlCode = CLUSCTL_RESOURCE_TYPE_VALIDATE_PRIVATE_PROPERTIES;
                    } // if: only validating data
                    else
                    {
                        dwControlCode = CLUSCTL_RESOURCE_TYPE_SET_PRIVATE_PROPERTIES;
                    } // else: setting data

                    //
                    //  Set private properties.
                    //

                    sc = ClusterResourceTypeControl(
                                      Hcluster()
                                    , pcrd->StrName()
                                    , NULL   // hNode
                                    , dwControlCode
                                    , cpl.PbPropList()
                                    , cpl.CbPropList()
                                    , NULL   // lpOutBuffer
                                    , 0      // nOutBufferSize
                                    , &cbProps
                                    );
                    break;
                } // case:

                case CLUADMEX_OT_NETWORK:
                {
                    CNetworkData * pcnd = reinterpret_cast< CNetworkData * >( Peo()->PodObjData() );
                    ASSERT( pcnd && (pcnd->GetHNetwork() != NULL) );

                    //
                    //  Determine which control code to use.
                    //

                    if ( fValidateOnlyIn )
                    {
                        dwControlCode = CLUSCTL_NETWORK_VALIDATE_PRIVATE_PROPERTIES;
                    } // if: only validating data
                    else
                    {
                        dwControlCode = CLUSCTL_NETWORK_SET_PRIVATE_PROPERTIES;
                    } // else: setting data

                    //
                    //  Set private properties.
                    //

                    sc = ClusterNetworkControl(
                                      pcnd->GetHNetwork()
                                    , NULL   // hNode
                                    , dwControlCode
                                    , cpl.PbPropList()
                                    , cpl.CbPropList()
                                    , NULL   // lpOutBuffer
                                    , 0      // nOutBufferSize
                                    , &cbProps
                                    );
                    break;
                } // case:

                case CLUADMEX_OT_NETINTERFACE:
                {
                    CNetInterfaceData * pcnd = reinterpret_cast< CNetInterfaceData * >( Peo()->PodObjData() );
                    ASSERT( pcnd && (pcnd->GetHNetInterface() != NULL) );

                    //
                    //  Determine which control code to use.
                    //

                    if ( fValidateOnlyIn )
                    {
                        dwControlCode = CLUSCTL_NETINTERFACE_VALIDATE_PRIVATE_PROPERTIES;
                    } // if: only validating data
                    else
                    {
                        dwControlCode = CLUSCTL_NETINTERFACE_SET_PRIVATE_PROPERTIES;
                    } // else: setting data

                    //
                    //  Set private properties.
                    //

                    sc = ClusterNetInterfaceControl(
                                      pcnd->GetHNetInterface()
                                    , NULL   // hNode
                                    , dwControlCode
                                    , cpl.PbPropList()
                                    , cpl.CbPropList()
                                    , NULL   // lpOutBuffer
                                    , 0      // nOutBufferSize
                                    , &cbProps
                                    );
                    break;
                } // case:

                default:
                    ASSERT( 0 );

            } // switch: object type

            //
            //  Handle errors.
            //

            if ( sc != ERROR_SUCCESS )
            {
                if ( sc == ERROR_INVALID_PARAMETER )
                {
                    if ( ! fNoNewPropsIn )
                    {
                        fSuccess = BSetPrivateProps( fValidateOnlyIn, TRUE /*fNoNewPropsIn*/ );
                    } // if: new props are allowed
                    else
                        fSuccess = FALSE;
                } // if: invalid parameter error occurred
                else
                {
                    fSuccess = FALSE;
                } // else: some other error occurred

                //
                // If an error occurred, display an error message.
                //

                if ( ! fSuccess )
                {
                    DisplaySetPropsError( sc, fValidateOnlyIn ? IDS_ERROR_VALIDATING_PROPERTIES : IDS_ERROR_SETTING_PROPERTIES );
                    if ( sc == ERROR_RESOURCE_PROPERTIES_STORED )
                    {
                        fSuccess = TRUE;
                    } // if: properties only stored
                } // if: error occurred
            } // if: error setting/validating data
        } // if: there is data to set
    } // if: no errors building the property list

    //
    //  Save data locally.
    //

    if ( ! fValidateOnlyIn && fSuccess )
    {
        //
        //  Save new values as previous values.
        //

        try
        {
            DWORD                   cprop;
            const CObjectProperty * pprop;

            for ( pprop = Pprops(), cprop = Cprops() ; cprop > 0 ; pprop++, cprop-- )
            {
                switch ( pprop->m_propFormat )
                {
                    case CLUSPROP_FORMAT_SZ:
                    case CLUSPROP_FORMAT_EXPAND_SZ:
                        ASSERT(pprop->m_value.pstr != NULL);
                        ASSERT(pprop->m_valuePrev.pstr != NULL);
                        *pprop->m_valuePrev.pstr = *pprop->m_value.pstr;
                        break;

                    case CLUSPROP_FORMAT_DWORD:
                    case CLUSPROP_FORMAT_LONG:
                        ASSERT( pprop->m_value.pdw != NULL );
                        ASSERT( pprop->m_valuePrev.pdw != NULL );
                        *pprop->m_valuePrev.pdw = *pprop->m_value.pdw;
                        break;

                    case CLUSPROP_FORMAT_BINARY:
                    case CLUSPROP_FORMAT_MULTI_SZ:
                        ASSERT( pprop->m_value.ppb != NULL );
                        ASSERT( *pprop->m_value.ppb != NULL );
                        ASSERT( pprop->m_value.pcb != NULL );
                        ASSERT( pprop->m_valuePrev.ppb != NULL );
                        ASSERT( *pprop->m_valuePrev.ppb != NULL );
                        ASSERT( pprop->m_valuePrev.pcb != NULL );
                        delete [] *pprop->m_valuePrev.ppb;
                        *pprop->m_valuePrev.ppb = new BYTE[ *pprop->m_value.pcb ];
                        CopyMemory( *pprop->m_valuePrev.ppb, *pprop->m_value.ppb, *pprop->m_value.pcb );
                        *pprop->m_valuePrev.pcb = *pprop->m_value.pcb;
                        break;

                    default:
                        ASSERT( 0 ); // don't know how to deal with this type

                } // switch: property format
            } // for: each property
        } // try
        catch ( CException * pe )
        {
            pe->ReportError();
            pe->Delete();
            fSuccess = FALSE;
        } // catch: CException
    } // if: not just validating and successful so far

    //
    // Indicate we successfully saved the properties.
    //

    if ( ! fValidateOnlyIn && fSuccess )
    {
        m_bSaved = TRUE;
    } // if: successfully saved data

    return fSuccess;

} //*** CBasePropertyPage::BSetPrivateProps

BOOL CBasePropertyPage::BSetPrivateProps | ( | BOOL | fValidateOnlyIn = FALSE,
 |  | BOOL | fNoNewPropsIn = FALSE |
 | ) |  |  | [protected]
BOOL CBasePropertyPage::BWizard ( void ) const [inline, protected]

Definition at line 158 of file BasePage.h.

    {
        ASSERT( Peo() != NULL );
        return Peo()->BWizard();
    }; //*** BWizard

BOOL CBasePropertyPage::BWizard ( void ) const [inline, protected]

Definition at line 158 of file BasePage.h.

    {
        ASSERT( Peo() != NULL );
        return Peo()->BWizard();
    }; //*** BWizard

void CBasePropertyPage::CommonConstruct ( void ) [protected]

Definition at line 117 of file BasePage.cpp.

{
    //{{AFX_DATA_INIT(CBasePropertyPage)
    //}}AFX_DATA_INIT

    m_peo = NULL;
    m_hpage = NULL;
    m_bBackPressed = FALSE;
    m_bSaved = FALSE;

    m_iddPropertyPage = NULL;
    m_iddWizardPage = NULL;
    m_idsCaption = NULL;

    m_bDoDetach = FALSE;

} //*** CBasePropertyPage::CommonConstruct

void CBasePropertyPage::CommonConstruct ( void ) [protected]
CLUADMEX_OBJECT_TYPE CBasePropertyPage::Cot ( void ) const [inline]

Definition at line 87 of file BasePage.h.

    {
        ASSERT( Peo() != NULL );
        return Peo()->Cot();
    }; //*** Cot

CLUADMEX_OBJECT_TYPE CBasePropertyPage::Cot ( void ) const [inline]

Definition at line 87 of file BasePage.h.

    {
        ASSERT( Peo() != NULL );
        return Peo()->Cot();
    }; //*** Cot

virtual DWORD CBasePropertyPage::Cprops ( void ) const [inline, protected, virtual]

Reimplemented in CClipBookServerParamsPage, and CFileShareSampleParamsPage.

Definition at line 138 of file BasePage.h.

{ return 0; }

virtual DWORD CBasePropertyPage::Cprops ( void ) const [inline, protected, virtual]

Reimplemented in CClipBookServerParamsPage, and CFileShareSampleParamsPage.

Definition at line 138 of file BasePage.h.

{ return 0; }

void CBasePropertyPage::DisplaySetPropsError | ( | DWORD | scIn,
 |  | UINT | idsOperIn |
 | ) |  |  | const [protected, virtual]

Definition at line 1587 of file BasePage.cpp.

{
    CString strErrorMsg;
    CString strOperMsg;
    CString strMsgIdFmt;
    CString strMsgId;
    CString strMsg;

    UNREFERENCED_PARAMETER( idsOperIn );

    strOperMsg.LoadString( IDS_ERROR_SETTING_PROPERTIES );
    FormatError( strErrorMsg, scIn );
    strMsgIdFmt.LoadString( IDS_ERROR_MSG_ID );
    strMsgId.Format( strMsgIdFmt, scIn, scIn );
    strMsg.Format( _T("%s\n\n%s%s"), strOperMsg, strErrorMsg, strMsgId );
    AfxMessageBox( strMsg );

}  //*** CBasePropertyPage::DisplaySetPropsError

virtual void CBasePropertyPage::DisplaySetPropsError | ( | DWORD | scIn,
 |  | UINT | idsOperIn |
 | ) |  |  | const [protected, virtual]
void CBasePropertyPage::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Reimplemented in CClipBookServerParamsPage, and CFileShareSampleParamsPage.

Definition at line 632 of file BasePage.cpp.

{
    if ( ! pDXIn->m_bSaveAndValidate || ! BSaved() )
    {
        AFX_MANAGE_STATE( AfxGetStaticModuleState() );

        //{{AFX_DATA_MAP(CBasePropertyPage)
            // NOTE: the ClassWizard will add DDX and DDV calls here
        //}}AFX_DATA_MAP

        DDX_Control( pDXIn, IDC_PP_ICON, m_staticIcon );
        DDX_Control( pDXIn, IDC_PP_TITLE, m_staticTitle );

        if ( pDXIn->m_bSaveAndValidate )
        {
            if ( ! BBackPressed() )
            {
                CWaitCursor wc;

                //
                //  Validate the data.
                //

                if ( ! BSetPrivateProps( TRUE /*fValidateOnlyIn*/ ) )
                {
                    pDXIn->Fail();
                } // if: error setting private properties
            } // if: Back button not pressed
        } // if: saving data from dialog
        else
        {
            //
            //  Set the title.
            //

            DDX_Text( pDXIn, IDC_PP_TITLE, m_strTitle );
        } // if: not saving data
    }  // if: not saving or haven't saved yet

    //
    //  Call the base class method.
    //

    CPropertyPage::DoDataExchange( pDXIn );

} //*** CBasePropertyPage::DoDataExchange

virtual void CBasePropertyPage::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Reimplemented in CClipBookServerParamsPage, and CFileShareSampleParamsPage.

void CBasePropertyPage::EnableNext ( BOOL fEnableIn = TRUE ) [protected]

Definition at line 1026 of file BasePage.cpp.

{
    ASSERT( BWizard() );
    ASSERT( PiWizardCallback() );

    AFX_MANAGE_STATE( AfxGetStaticModuleState() );

    PiWizardCallback()->EnableNext( reinterpret_cast< LONG * >( Hpage() ), fEnableIn );

} //*** CBasePropertyPage::EnableNext

void CBasePropertyPage::EnableNext ( BOOL fEnableIn = TRUE ) [protected]
HCLUSTER CBasePropertyPage::Hcluster ( void ) const [inline, protected]

Definition at line 164 of file BasePage.h.

    {
        ASSERT( Peo() != NULL );
        return Peo()->Hcluster();
    }; //*** Hcluster

HCLUSTER CBasePropertyPage::Hcluster ( void ) const [inline, protected]

Definition at line 164 of file BasePage.h.

    {
        ASSERT( Peo() != NULL );
        return Peo()->Hcluster();
    }; //*** Hcluster

HPROPSHEETPAGE CBasePropertyPage::Hpage ( void ) const [inline]

Definition at line 85 of file BasePage.h.

{ return m_hpage; }

HPROPSHEETPAGE CBasePropertyPage::Hpage ( void ) const [inline]

Definition at line 85 of file BasePage.h.

{ return m_hpage; }

HRESULT CBasePropertyPage::HrCreatePage ( void )
HRESULT CBasePropertyPage::HrCreatePage ( void )

Definition at line 332 of file BasePage.cpp.

{
    ASSERT( m_hpage == NULL );

    HRESULT hr = S_OK;

    m_hpage = CreatePropertySheetPage( reinterpret_cast< LPPROPSHEETPAGEW >( &m_psp ) );
    if ( m_hpage == NULL )
    {
        hr = HRESULT_FROM_WIN32( GetLastError() );
    } // if: error creating the page

    return hr;

} //*** CBasePropertyPage::HrCreatePage

virtual HRESULT CBasePropertyPage::HrInit ( CExtObject * peoInout ) [virtual]
HRESULT CBasePropertyPage::HrInit ( CExtObject * peoInout ) [virtual]

Definition at line 157 of file BasePage.cpp.

{
    ASSERT( peoInout != NULL );

    AFX_MANAGE_STATE( AfxGetStaticModuleState() );

    HRESULT         hr = S_OK;
    CWaitCursor     wc;
    DWORD           sc = ERROR_SUCCESS;
    CClusPropList   cpl;

    m_peo = peoInout;

    //
    //  Don't display a help button.
    //

    m_psp.dwFlags &= ~PSP_HASHELP;

    //
    //  Construct the property page.
    //

    if ( Peo()->BWizard() )
    {
        ASSERT( IddWizardPage() != NULL);
        Construct( IddWizardPage(), IdsCaption() );
    } // if: adding page to wizard
    else
    {
        ASSERT( IddPropertyPage() != NULL );
        Construct( IddPropertyPage(), IdsCaption() );
    } // else: adding page to property sheet

    //
    //  Read the properties private to this resource and parse them.
    //

    ASSERT( Peo() != NULL );
    ASSERT( Peo()->PodObjData() );

    //
    //  Read the properties.
    //

    switch ( Cot() )
    {
        case CLUADMEX_OT_CLUSTER:
        {
            CClusterData * pccd = reinterpret_cast< CClusterData * >( Peo()->PodObjData() );
            ASSERT( pccd && (pccd->GetHCluster() != NULL) );
            sc = cpl.ScGetClusterProperties(
                                      pccd->GetHCluster()
                                    , CLUSCTL_CLUSTER_GET_PRIVATE_PROPERTIES
                                    );
            break;
        }
        case CLUADMEX_OT_NODE:
        {
            CNodeData * pcnd = reinterpret_cast< CNodeData * >( Peo()->PodObjData() );
            ASSERT( pcnd && (pcnd->GetHNode() != NULL) );
            sc = cpl.ScGetNodeProperties(
                                      pcnd->GetHNode()
                                    , CLUSCTL_NODE_GET_PRIVATE_PROPERTIES
                                    );
            break;
        }
        case CLUADMEX_OT_GROUP:
        {
            CGroupData * pcgd = reinterpret_cast< CGroupData * >( Peo()->PodObjData() );
            ASSERT( pcgd && (pcgd->GetHGroup() != NULL) );
            sc = cpl.ScGetGroupProperties(
                                      pcgd->GetHGroup()
                                    , CLUSCTL_GROUP_GET_PRIVATE_PROPERTIES
                                    );
            break;
        }
        case CLUADMEX_OT_RESOURCE:
        {
            CResData * pcrd = reinterpret_cast< CResData * >( Peo()->PodObjData() );
            ASSERT( pcrd && (pcrd->GetHResource() != NULL) );
            sc = cpl.ScGetResourceProperties(
                                      pcrd->GetHResource()
                                    , CLUSCTL_RESOURCE_GET_PRIVATE_PROPERTIES
                                    );
            break;
        }
        case CLUADMEX_OT_RESOURCETYPE:
        {
            CResTypeData * pcrd = reinterpret_cast< CResTypeData * >( Peo()->PodObjData() );
            ASSERT( pcrd && (pcrd->StrName().GetLength() > 0) );
            sc = cpl.ScGetResourceTypeProperties(
                                      Hcluster()
                                    , pcrd->StrName()
                                    , CLUSCTL_RESOURCE_TYPE_GET_PRIVATE_PROPERTIES
                                    );
            break;
        }
        case CLUADMEX_OT_NETWORK:
        {
            CNetworkData * pcnd = reinterpret_cast< CNetworkData * >( Peo()->PodObjData() );
            ASSERT( pcnd && (pcnd->GetHNetwork() != NULL) );
            sc = cpl.ScGetNetworkProperties(
                                      pcnd->GetHNetwork()
                                    , CLUSCTL_NETWORK_GET_PRIVATE_PROPERTIES
                                    );
            break;
        }
        case CLUADMEX_OT_NETINTERFACE:
        {
            CNetInterfaceData * pcnd = reinterpret_cast< CNetInterfaceData * >( Peo()->PodObjData() );
            ASSERT( pcnd && (pcnd->GetHNetInterface() != NULL) );
            sc = cpl.ScGetNetInterfaceProperties(
                                      pcnd->GetHNetInterface()
                                    , CLUSCTL_NETINTERFACE_GET_PRIVATE_PROPERTIES
                                    );
            break;
        }
        default:
            ASSERT( 0 );
    } // switch: object type

    //
    //  Parse the properties.
    //

    if ( sc == ERROR_SUCCESS )
    {
        // Parse the properties.
        try
        {
            sc = ScParseProperties( cpl );
        } // try
        catch ( CMemoryException * pme )
        {
            hr = E_OUTOFMEMORY;
            pme->Delete();
        } // catch: CMemoryException
    } // if: properties read successfully

    if ( sc != ERROR_SUCCESS )
    {
        hr = HRESULT_FROM_WIN32( sc );
        goto Cleanup;
    } // if: error parsing getting or parsing properties

Cleanup:

    return hr;

} //*** CBasePropertyPage::HrInit

IDD CBasePropertyPage::IddPropertyPage ( void ) const [inline, protected]

Definition at line 80 of file BasePage.h.

{ return m_iddPropertyPage; }

IDD CBasePropertyPage::IddPropertyPage ( void ) const [inline, protected]

Definition at line 80 of file BasePage.h.

{ return m_iddPropertyPage; }

IDD CBasePropertyPage::IddWizardPage ( void ) const [inline, protected]

Definition at line 81 of file BasePage.h.

{ return m_iddWizardPage; }

IDD CBasePropertyPage::IddWizardPage ( void ) const [inline, protected]

Definition at line 81 of file BasePage.h.

{ return m_iddWizardPage; }

IDS CBasePropertyPage::IdsCaption ( void ) const [inline, protected]

Definition at line 82 of file BasePage.h.

{ return m_idsCaption; }

IDS CBasePropertyPage::IdsCaption ( void ) const [inline, protected]

Definition at line 82 of file BasePage.h.

{ return m_idsCaption; }

BOOL CBasePropertyPage::OnApply ( void ) [virtual]

Definition at line 813 of file BasePage.cpp.

{
    ASSERT( ! BWizard() );

    AFX_MANAGE_STATE( AfxGetStaticModuleState() );

    CWaitCursor wc;

    if ( BApplyChanges() == FALSE )
    {
        return FALSE;
    } // if: error applying changes

    return CPropertyPage::OnApply();

} //*** CBasePropertyPage::OnApply

virtual BOOL CBasePropertyPage::OnApply ( ) [virtual]
void CBasePropertyPage::OnChangeCtrl ( void ) [protected]

Definition at line 1000 of file BasePage.cpp.

{
    AFX_MANAGE_STATE( AfxGetStaticModuleState() );

    SetModified( TRUE );

} //*** CBasePropertyPage::OnChangeCtrl

afx_msg void CBasePropertyPage::OnChangeCtrl ( ) [protected]
int CBasePropertyPage::OnCreate ( LPCREATESTRUCT lpCreateStruct ) [protected]

Definition at line 546 of file BasePage.cpp.

{
    AFX_MANAGE_STATE( AfxGetStaticModuleState() );

    //
    // Attach the window to the property page structure.
    // This has been done once already in the main application, since the
    // main application owns the property sheet.  It needs to be done here
    // so that the window handle can be found in the DLL's handle map.
    //

    if ( FromHandlePermanent( m_hWnd ) == NULL ) // is the window handle already in the handle map
    {
        HWND hWnd = m_hWnd;
        m_hWnd = NULL;
        Attach( hWnd );
        m_bDoDetach = TRUE;
    } // if: is the window handle in the handle map

    return CPropertyPage::OnCreate( lpCreateStructIn );

} //*** CBasePropertyPage::OnCreate

afx_msg int CBasePropertyPage::OnCreate ( LPCREATESTRUCT lpCreateStruct ) [protected]
afx_msg void CBasePropertyPage::OnDestroy ( ) [protected]
void CBasePropertyPage::OnDestroy ( void ) [protected]

Definition at line 588 of file BasePage.cpp.

{
    AFX_MANAGE_STATE( AfxGetStaticModuleState() );

    //
    // Detach the window from the property page structure.
    // This will be done again by the main application, since it owns the
    // property sheet.  It needs to be done here so that the window handle
    // can be removed from the DLL's handle map.
    //

    if ( m_bDoDetach )
    {
        if ( m_hWnd != NULL )
        {
            HWND hWnd = m_hWnd;

            Detach();
            m_hWnd = hWnd;
        } // if: do we have a window handle?
    } // if: do we need to balance the attach we did with a detach?

    CPropertyPage::OnDestroy();

} //*** CBasePropertyPage::OnDestroy

virtual BOOL CBasePropertyPage::OnInitDialog ( ) [protected, virtual]

Reimplemented in CClipBookServerParamsPage, and CFileShareSampleParamsPage.

BOOL CBasePropertyPage::OnInitDialog ( void ) [protected, virtual]

Reimplemented in CClipBookServerParamsPage, and CFileShareSampleParamsPage.

Definition at line 702 of file BasePage.cpp.

{
    ASSERT( Peo() != NULL );
    ASSERT( Peo()->PodObjData() != NULL );

    AFX_MANAGE_STATE( AfxGetStaticModuleState() );

    //
    //  Set the title string.
    //

    m_strTitle = Peo()->PodObjData()->StrName();

    //
    //  Call the base class method.
    //

    CPropertyPage::OnInitDialog();

    //
    //  Display an icon for the object.
    //

    if ( Peo()->Hicon() != NULL )
    {
        m_staticIcon.SetIcon( Peo()->Hicon() );
    } // if: an icon was specified

    //
    //  Return TRUE unless you set the focus to a control.
    //
    //  EXCEPTION: OCX Property Pages should return FALSE.
    //

    return TRUE;

} //*** CBasePropertyPage::OnInitDialog

virtual BOOL CBasePropertyPage::OnSetActive ( ) [virtual]

Reimplemented in CClipBookServerParamsPage, and CFileShareSampleParamsPage.

BOOL CBasePropertyPage::OnSetActive ( void ) [virtual]

Reimplemented in CClipBookServerParamsPage, and CFileShareSampleParamsPage.

Definition at line 761 of file BasePage.cpp.

{
    HRESULT hr = S_OK;

    ASSERT( Peo() != NULL);
    ASSERT( Peo()->PodObjData() != NULL );

    AFX_MANAGE_STATE( AfxGetStaticModuleState() );

    //
    //  Reread the data.
    //

    hr = Peo()->HrGetObjectInfo();
    if ( FAILED( hr ) )
    {
        return FALSE;
    } // if: error getting object info

    //
    //  Set the title string.
    //

    m_strTitle = Peo()->PodObjData()->StrName();

    m_bBackPressed = FALSE;
    m_bSaved = FALSE;
    return CPropertyPage::OnSetActive();

} //*** CBasePropertyPage::OnSetActive

LRESULT CBasePropertyPage::OnWizardBack ( void ) [virtual]

Definition at line 851 of file BasePage.cpp.

{
    LRESULT lResult = 0L;

    ASSERT( BWizard() );

    AFX_MANAGE_STATE( AfxGetStaticModuleState() );

    lResult = CPropertyPage::OnWizardBack();
    if ( lResult != -1 )
    {
        m_bBackPressed = TRUE;
    } // if: no error occurred

    return lResult;

} //*** CBasePropertyPage::OnWizardBack

virtual LRESULT CBasePropertyPage::OnWizardBack ( ) [virtual]
BOOL CBasePropertyPage::OnWizardFinish ( void ) [virtual]

Definition at line 948 of file BasePage.cpp.

{
    ASSERT( BWizard() );

    AFX_MANAGE_STATE( AfxGetStaticModuleState() );

    CWaitCursor wc;

    //
    //  BUG! There should be no need to call UpdateData in this function.
    //  See BUG: Finish Button Fails Data Transfer from Page to Variables
    //  KB Article ID: Q150349
    //

    //
    //  Update the data in the class from the page.
    //

    if ( UpdateData( TRUE /*bSaveAndValidate*/ ) == FALSE )
    {
        return FALSE;
    } // if: error updating data

    // Save the data in the sheet.
    if ( BApplyChanges() == FALSE )
    {
        return FALSE;
    } // if: error applying changes

    return CPropertyPage::OnWizardFinish();

} //*** CBasePropertyPage::OnWizardFinish

virtual BOOL CBasePropertyPage::OnWizardFinish ( ) [virtual]
LRESULT CBasePropertyPage::OnWizardNext ( void ) [virtual]

Definition at line 890 of file BasePage.cpp.

{
    ASSERT( BWizard() );

    AFX_MANAGE_STATE( AfxGetStaticModuleState() );

    CWaitCursor wc;

    //
    //  Update the data in the class from the page.
    //  This necessary because, while OnKillActive() will call UpdateData(),
    //  it is called after this method is called, and we need to be sure that
    //  data has been saved before we apply them.
    //

    if ( ! UpdateData( TRUE /*bSaveAndValidate*/ ) )
    {
        return -1;
    } // if: error updating data

    //
    //  Save the data in the sheet.
    //

    if ( BApplyChanges() == FALSE )
    {
        return -1;
    } // if: error applying changes

    //
    //  Create the object.
    //

    return CPropertyPage::OnWizardNext();

} //*** CBasePropertyPage::OnWizardNext

virtual LRESULT CBasePropertyPage::OnWizardNext ( ) [virtual]
CExtObject* CBasePropertyPage::Peo ( void ) const [inline, protected]

Definition at line 78 of file BasePage.h.

{ return m_peo; }

CExtObject* CBasePropertyPage::Peo ( void ) const [inline, protected]

Definition at line 78 of file BasePage.h.

{ return m_peo; }

IWCWizardCallback* CBasePropertyPage::PiWizardCallback ( void ) const [inline, protected]

Definition at line 152 of file BasePage.h.

    {
        ASSERT( Peo() != NULL );
        return Peo()->PiWizardCallback();
    }; //*** PiWizardCallback

IWCWizardCallback* CBasePropertyPage::PiWizardCallback ( void ) const [inline, protected]

Definition at line 152 of file BasePage.h.

    {
        ASSERT( Peo() != NULL );
        return Peo()->PiWizardCallback();
    }; //*** PiWizardCallback

virtual const CObjectProperty* CBasePropertyPage::Pprops ( void ) const [inline, protected, virtual]

Reimplemented in CClipBookServerParamsPage, and CFileShareSampleParamsPage.

Definition at line 137 of file BasePage.h.

{ return NULL; }

virtual const CObjectProperty* CBasePropertyPage::Pprops ( void ) const [inline, protected, virtual]

Reimplemented in CClipBookServerParamsPage, and CFileShareSampleParamsPage.

Definition at line 137 of file BasePage.h.

{ return NULL; }

DWORD CBasePropertyPage::ScParseProperties ( CClusPropList & rcplIn ) [protected]
DWORD CBasePropertyPage::ScParseProperties ( CClusPropList & rcplIn ) [protected]

Definition at line 375 of file BasePage.cpp.

{
    DWORD                   sc = ERROR_SUCCESS;
    DWORD                   cprop;
    const CObjectProperty * pprop;

    ASSERT( rcplIn.PbPropList() != NULL );

    sc = rcplIn.ScMoveToFirstProperty();
    while ( sc == ERROR_SUCCESS )
    {
        //
        // Parse known properties.
        //

        for ( pprop = Pprops(), cprop = Cprops() ; cprop > 0 ; pprop++, cprop-- )
        {
            if ( NIStringCompareW(
                                   rcplIn.PszCurrentPropertyName()
                                 , pprop->m_pwszName
                                 , rcplIn.CbhCurrentPropertyName().pName->cbLength / sizeof( WCHAR )
                                 ) == 0
               )
            {
                if ( rcplIn.CpfCurrentValueFormat() == pprop->m_propFormat )
                {
                    switch ( pprop->m_propFormat )
                    {
                        case CLUSPROP_FORMAT_SZ:
                        case CLUSPROP_FORMAT_EXPAND_SZ:
                            ASSERT(     (rcplIn.CbCurrentValueLength() == (lstrlenW( rcplIn.CbhCurrentValue().pStringValue->sz ) + 1) * sizeof( WCHAR ))
                                    ||  (   (rcplIn.CbCurrentValueLength() == 0)
                                        &&  (rcplIn.CbhCurrentValue().pStringValue->sz[ 0 ] == L'\0') ) );
                            *pprop->m_value.pstr = rcplIn.CbhCurrentValue().pStringValue->sz;
                            *pprop->m_valuePrev.pstr = rcplIn.CbhCurrentValue().pStringValue->sz;

                            //
                            //  See if we need to find an expanded version
                            //

                            if ( pprop->m_valueEx.pstr != NULL )
                            {
                                // Copy the non-expanded one just in case there isn't an expanded version
                                *pprop->m_valueEx.pstr = rcplIn.CbhCurrentValue().pStringValue->sz;

                                // See if they included an expanded version
                                rcplIn.ScMoveToNextPropertyValue( );
                                if ( rcplIn.CpfCurrentValueFormat( ) == CLUSPROP_FORMAT_EXPANDED_SZ )
                                {
                                    *pprop->m_valueEx.pstr = rcplIn.CbhCurrentValue().pStringValue->sz;
                                } // if: found expanded version

                            } // if: *pprop->m_valueEx.pstr is present
                            break;

                        case CLUSPROP_FORMAT_EXPANDED_SZ:
                            ASSERT(     (rcplIn.CbCurrentValueLength() == (lstrlenW( rcplIn.CbhCurrentValue().pStringValue->sz ) + 1) * sizeof( WCHAR ))
                                    ||  (   (rcplIn.CbCurrentValueLength() == 0)
                                        &&  (rcplIn.CbhCurrentValue().pStringValue->sz[ 0 ] == L'\0') ) );
                            *pprop->m_value.pstr = rcplIn.CbhCurrentValue().pStringValue->sz;
                            *pprop->m_valuePrev.pstr = rcplIn.CbhCurrentValue().pStringValue->sz;

                            //
                            //  See if we need to find an expanded version
                            //

                            if ( *pprop->m_valueEx.pstr ) // can not use != NULL because overloading tries to do a string compare!
                            {
                                // Copy the expanded version
                                *pprop->m_valueEx.pstr = rcplIn.CbhCurrentValue().pStringValue->sz;

                                // See if they included a non-expanded version
                                rcplIn.ScMoveToNextPropertyValue( );
                                if ( rcplIn.CpfCurrentValueFormat( ) == CLUSPROP_FORMAT_SZ )
                                {
                                    *pprop->m_value.pstr = rcplIn.CbhCurrentValue().pStringValue->sz;
                                    *pprop->m_valuePrev.pstr = rcplIn.CbhCurrentValue().pStringValue->sz;
                                } // if: found non-expanded version

                            } // if: *pprop->m_valueEx.pstr is present
                            break;

                        case CLUSPROP_FORMAT_DWORD:
                        case CLUSPROP_FORMAT_LONG:
                            ASSERT( rcplIn.CbCurrentValueLength() == sizeof( DWORD ) );
                            *pprop->m_value.pdw = rcplIn.CbhCurrentValue().pDwordValue->dw;
                            *pprop->m_valuePrev.pdw = rcplIn.CbhCurrentValue().pDwordValue->dw;
                            break;

                        case CLUSPROP_FORMAT_BINARY:
                        case CLUSPROP_FORMAT_MULTI_SZ:
                            *pprop->m_value.ppb = rcplIn.CbhCurrentValue().pBinaryValue->rgb;
                            *pprop->m_value.pcb = rcplIn.CbhCurrentValue().pBinaryValue->cbLength;
                            *pprop->m_valuePrev.ppb = rcplIn.CbhCurrentValue().pBinaryValue->rgb;
                            *pprop->m_valuePrev.pcb = rcplIn.CbhCurrentValue().pBinaryValue->cbLength;
                            break;

                        default:
                            ASSERT(0);  // don't know how to deal with this type
                    } // switch: property format

                    //
                    //  Exit the loop since we found the parameter.
                    //

                    break;
                }// if: found a type match
            } // if: found a string match
        } // for: each property that we know about

        //
        // If the property wasn't known, ask the derived class to parse it.
        //

        if ( cprop == 0 )
        {
            sc = ScParseUnknownProperty(
                          rcplIn.CbhCurrentPropertyName().pName->sz
                        , rcplIn.CbhCurrentValue()
                        , rcplIn.RPvlPropertyValue().CbDataLeft()
                        );
            if ( sc != ERROR_SUCCESS )
            {
                return sc;
            } // if: error parsing the unknown property
        } // if: property not parsed

        //
        // Advance the buffer pointer past the value in the value list.
        //

        sc = rcplIn.ScMoveToNextProperty();
    } // while: more properties to parse

    //
    // If we reached the end of the properties, fix the return code.
    //

    if ( sc == ERROR_NO_MORE_ITEMS )
    {
        sc = ERROR_SUCCESS;
    } // if: ended loop after parsing all properties

    return sc;

} //*** CBasePropertyPage::ScParseProperties

virtual DWORD CBasePropertyPage::ScParseUnknownProperty | ( | LPCWSTR | pwszNameIn,
 |  | const CLUSPROP_BUFFER_HELPER & | rvalueIn,
 |  | DWORD | cbBufIn |
 | ) |  |  | [inline, protected, virtual]

Definition at line 120 of file BasePage.h.

    {
        UNREFERENCED_PARAMETER( pwszNameIn );
        UNREFERENCED_PARAMETER( rvalueIn );
        UNREFERENCED_PARAMETER( cbBufIn );
        return ERROR_SUCCESS;

    } //*** ScParseUnknownProperty

virtual DWORD CBasePropertyPage::ScParseUnknownProperty | ( | LPCWSTR | pwszNameIn,
 |  | const CLUSPROP_BUFFER_HELPER & | rvalueIn,
 |  | DWORD | cbBufIn |
 | ) |  |  | [inline, protected, virtual]

Definition at line 120 of file BasePage.h.

    {
        UNREFERENCED_PARAMETER( pwszNameIn );
        UNREFERENCED_PARAMETER( rvalueIn );
        UNREFERENCED_PARAMETER( cbBufIn );
        return ERROR_SUCCESS;

    } //*** ScParseUnknownProperty

Member Data Documentation

BOOL CBasePropertyPage::m_bBackPressed [protected]

Definition at line 145 of file BasePage.h.

BOOL CBasePropertyPage::m_bDoDetach [protected]

Definition at line 147 of file BasePage.h.

BOOL CBasePropertyPage::m_bSaved [protected]

Definition at line 146 of file BasePage.h.

HPROPSHEETPAGE CBasePropertyPage::m_hpage [protected]

Definition at line 72 of file BasePage.h.

IDD CBasePropertyPage::m_iddPropertyPage [protected]

Definition at line 74 of file BasePage.h.

IDD CBasePropertyPage::m_iddWizardPage [protected]

Definition at line 75 of file BasePage.h.

IDS CBasePropertyPage::m_idsCaption [protected]

Definition at line 76 of file BasePage.h.

CExtObject * CBasePropertyPage::m_peo [protected]

Definition at line 71 of file BasePage.h.

CStatic CBasePropertyPage::m_staticIcon

Definition at line 100 of file BasePage.h.

CStatic CBasePropertyPage::m_staticTitle

Definition at line 101 of file BasePage.h.

CString CBasePropertyPage::m_strTitle

Definition at line 102 of file BasePage.h.

The documentation for this class was generated from the following files:
  • WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/BasePage.h
  • WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/BasePage.h
  • WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/BasePage.cpp
  • WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/BasePage.cpp
Generated on Wed Nov 13 2024 16:55:40 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CBehavior Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CBehavior Class Reference

#include "Behavior.h"

List of all members.

Public Member Functions

CBehavior ()
STDMETHOD() | Detach (void)
double | Distance (POINT pt1, POINT pt2)
STDMETHOD() | Draw (RECT rcBounds, RECT rcUpdate, LONG lDrawFlags, HDC hdc, LPVOID pvDrawObject)
HRESULT | GetEventObject (IHTMLEventObj **event)
STDMETHOD() | GetPainterInfo (HTML_PAINTER_INFO *pInfo)
STDMETHOD() | HitTestPoint (POINT pt, BOOL *pbHit, LONG *plPartID)
STDMETHOD() | Init (IElementBehaviorSite *pBehaviorSite)
STDMETHOD() | Notify (LONG lEvent, VARIANT *pVar)
STDMETHOD() | OnResize (SIZE pt)

Public Attributes

DWORD m_dwCookie
long | m_lCookie
long | m_lPartID
CComObject< CEventSink > * | m_pEventSink
IHTMLPaintSite * | m_pPaintSite
POINT | m_ptPolyCorners [4]
RECT | m_rtElemCorners
CComPtr< IHTMLDocument2 > | m_spDoc
CComPtr< IHTMLElement > | m_spElem
CComPtr< IElementBehaviorSiteOM > | m_spOMSite
CComPtr< IHTMLElement > | m_spParent
CComPtr< IHTMLSelectionObject > | m_spSel
CComPtr< IElementBehaviorSite > | m_spSite
CComPtr< IHTMLWindow2 > | m_spWin

Detailed Description

Definition at line 16 of file Behavior.h.

Constructor & Destructor Documentation

CBehavior::CBehavior ( ) [inline]

Definition at line 39 of file Behavior.h.

              :
    m_pEventSink(NULL),
    m_dwCookie(0),
    m_lPartID(-1)
  {
  }

Member Function Documentation

STDMETHODIMP CBehavior::Detach ( void )

Definition at line 16 of file Behavior.cpp.

{
  // Release cached EventSink and PaintSite pointers
  // (Note: Other cached pointers are smart pointers and
  // automatically release themselves)
  m_pEventSink->Release();
  m_pPaintSite->Release();

  return S_OK;
}

double CBehavior::Distance | ( | POINT | pt1,
 |  | POINT | pt2
 | ) |  |

Definition at line 254 of file Behavior.cpp.

{
  return _hypot((pt1.x - pt2.x), (pt1.y - pt2.y));
}

HRESULT CBehavior::Draw | ( | RECT | rcBounds,
 |  | RECT | rcUpdate,
 |  | LONG | lDrawFlags,
 |  | HDC | hdc,
 |  | LPVOID | pvDrawObject
 | ) |  |

Definition at line 131 of file Behavior.cpp.

{
  if (!m_pEventSink) return S_OK;
  HBRUSH blackBrush     = (HBRUSH)GetStockObject(BLACK_BRUSH);
  HBRUSH coloredBrush   = CreateSolidBrush(RGB(0x99,0x66,0x99));
  HBRUSH highlightBrush = CreateSolidBrush(RGB(0xff, 0xff, 0x00));
  HPEN   blackPen       = (HPEN)GetStockObject(BLACK_PEN);

  HPEN   oldPen         = (HPEN)SelectObject(hdc,blackPen);
  HBRUSH oldBrush       = (HBRUSH)SelectObject(hdc,coloredBrush);

  POINT ptGlobalCorners[4];

  for (int i = 0; i < 4; i++)
  {
    ptGlobalCorners[i].x = m_ptPolyCorners[i].x + rcBounds.left + HANDLE_RADIUS;
    ptGlobalCorners[i].y = m_ptPolyCorners[i].y + rcBounds.top + HANDLE_RADIUS;
  }

  Polygon(hdc, ptGlobalCorners, 4);

  for (i = 0; i < 4; i++)
  {
    if (m_pEventSink->mouseDown && m_lPartID == i)
      SelectObject(hdc, highlightBrush);
    else
      SelectObject(hdc, blackBrush);

    Ellipse(hdc,
        ptGlobalCorners[i].x - HANDLE_RADIUS,
        ptGlobalCorners[i].y - HANDLE_RADIUS,
        ptGlobalCorners[i].x + HANDLE_RADIUS,
        ptGlobalCorners[i].y + HANDLE_RADIUS);
  }

  SelectObject(hdc, oldPen);
  SelectObject(hdc, oldBrush);

  DeleteObject(coloredBrush);
  DeleteObject(highlightBrush);

  return S_OK;
}

HRESULT CBehavior::GetEventObject ( IHTMLEventObj ** event )

Definition at line 261 of file Behavior.cpp.

{
  HRESULT       hr;

  hr = m_spWin->get_event(ppEvent);
  if (*ppEvent == NULL) hr =  E_FAIL;

  return hr;
}

HRESULT CBehavior::GetPainterInfo ( HTML_PAINTER_INFO * pInfo )

Definition at line 175 of file Behavior.cpp.

{
  pInfo->lFlags = HTMLPAINTER_OPAQUE | HTMLPAINTER_HITTEST;
  pInfo->lZOrder = HTMLPAINT_ZORDER_ABOVE_CONTENT;

  memset(&pInfo->iidDrawObject, 0, sizeof(IID));

  pInfo->rcExpand.left = HANDLE_RADIUS;
  pInfo->rcExpand.right = HANDLE_RADIUS;
  pInfo->rcExpand.top = HANDLE_RADIUS;
  pInfo->rcExpand.bottom = HANDLE_RADIUS;

  return S_OK;
}

HRESULT CBehavior::HitTestPoint | ( | POINT | pt,
 |  | BOOL * | pbHit,
 |  | LONG * | plPartID
 | ) |  |

Definition at line 190 of file Behavior.cpp.

{
  if (!m_pEventSink) return S_OK;
  if (m_pEventSink->mouseDown) return S_OK;

  *pbHit = FALSE;
  *plPartID = NULL;
  m_lPartID = -1;

  // Convert point coordinates, which are given with respect to the element's
  // expanded region, to reflect the element without its expanded region
  pt.x = pt.x - HANDLE_RADIUS;
  pt.y = pt.y - HANDLE_RADIUS;

  for (int i = 0; i < 4; i++)
  {
    if (Distance(pt, m_ptPolyCorners[i]) <= HANDLE_RADIUS)
    {
      // Setting pbHit to TRUE will trigger an event that can be handled
      // by IEventSink::Invoke
      *pbHit = TRUE;
      *plPartID = i;
      m_lPartID = i;
    }
  }

  return S_OK;
}

STDMETHODIMP CBehavior::Init ( IElementBehaviorSite * pBehaviorSite )

Definition at line 28 of file Behavior.cpp.

{
  HRESULT hr;

  // Cache the IElementBehaviorSite interface pointer.
  m_spSite = pBehaviorSite;

  // Cache the IElementBehaviorSiteOM interface pointer.
  hr = m_spSite->QueryInterface(
              IID_IElementBehaviorSiteOM,
              (void**)&m_spOMSite);

  // Cache the IHTMLPaintSite interface pointer.
  hr = m_spSite->QueryInterface(
              IID_IHTMLPaintSite,
              (void**)&m_pPaintSite);

  return hr;
}

STDMETHODIMP CBehavior::Notify | ( | LONG | lEvent,
 |  | VARIANT * | pVar
 | ) |  |

Definition at line 49 of file Behavior.cpp.

{
  HRESULT hr = S_OK;

  switch (lEvent)
  {
    // The HTML document has been parsed. The DOM is available
    case BEHAVIOREVENT_DOCUMENTREADY:
      if (!m_spSite) break;

      // Cache the IHTMLElement interface pointer for this element
      // and its parent
      hr = m_spSite->GetElement(&m_spElem);
      hr = m_spElem->get_offsetParent(&m_spParent);

      // Cache the IHTMLDocument2 interface pointer
      IDispatch* pDisp;
      hr = m_spElem->get_document(&pDisp);
      hr = pDisp->QueryInterface(IID_IHTMLDocument2, (void**)&m_spDoc);
      pDisp->Release();

      // Cache the IHTMLWindow2 interface pointer
      hr = m_spDoc->get_parentWindow(&m_spWin);

      // Cache the IHTMLSelectionObject interface pointer
      hr = m_spDoc->get_selection(&m_spSel);

      // Change mouse cursor to arrow only for this element
      IHTMLStyle* pStyle;
      hr = m_spElem->get_style(&pStyle);
      hr = pStyle->put_cursor(L"default");
      pStyle->Release();

      long lHeight, lWidth;

      m_spElem->get_offsetHeight(&lHeight);
      m_spElem->get_offsetWidth(&lWidth);

      // Cache the initial coordinates of the element's
      // corner points
      m_rtElemCorners.top = 0;
      m_rtElemCorners.bottom = lHeight;
      m_rtElemCorners.left = 0;
      m_rtElemCorners.right = lWidth;

      // Set the initial coordinates of the polygon to
      // the element's corner points
      m_ptPolyCorners[0].x = 0;
      m_ptPolyCorners[0].y = 0;
      m_ptPolyCorners[1].x = lWidth;
      m_ptPolyCorners[1].y = 0;
      m_ptPolyCorners[2].x = lWidth;
      m_ptPolyCorners[2].y = lHeight;
      m_ptPolyCorners[3].x = 0;
      m_ptPolyCorners[3].y = lHeight;

      // Create and connect the event sink.
      hr = CComObject<CEventSink>::CreateInstance(&m_pEventSink);
      if (SUCCEEDED(hr))
      {
        m_pEventSink->AddRef();
        m_pEventSink->m_pBehavior = this;

        hr = AtlAdvise(m_spElem, (IDispatch*)m_pEventSink,
                  DIID_HTMLElementEvents,
                  &m_dwCookie);
      }

      break;

    default:
      break;
  }

  return S_OK;
}

HRESULT CBehavior::OnResize ( SIZE pt )

Definition at line 219 of file Behavior.cpp.

{
  if (!m_spElem) return E_FAIL;

  long lHeight, lWidth, lOldElemHeight, lOldElemWidth;
  float ratioX, ratioY;

  lOldElemHeight = m_rtElemCorners.bottom;
  lOldElemWidth = m_rtElemCorners.right;

  m_spElem->get_offsetHeight(&lHeight);
  m_spElem->get_offsetWidth(&lWidth);

  m_rtElemCorners.top = 0;
  m_rtElemCorners.bottom = lHeight;
  m_rtElemCorners.left = 0;
  m_rtElemCorners.right = lWidth;

  ratioX = (float)lWidth/(float)lOldElemWidth;
  ratioY = (float)lHeight/(float)lOldElemHeight;

  for (int i = 0; i < 4; i++)
  {
    m_ptPolyCorners[i].x = (long)(ratioX * m_ptPolyCorners[i].x);
    m_ptPolyCorners[i].y = (long)(ratioY * m_ptPolyCorners[i].y);
  }

  return S_OK;
}

Member Data Documentation

DWORD CBehavior::m_dwCookie

Definition at line 33 of file Behavior.h.

long CBehavior::m_lCookie

Definition at line 34 of file Behavior.h.

long CBehavior::m_lPartID

Definition at line 37 of file Behavior.h.

CComObject<CEventSink>* CBehavior::m_pEventSink

Definition at line 32 of file Behavior.h.

IHTMLPaintSite* CBehavior::m_pPaintSite

Definition at line 26 of file Behavior.h.

POINT CBehavior::m_ptPolyCorners[4]

Definition at line 36 of file Behavior.h.

RECT CBehavior::m_rtElemCorners

Definition at line 35 of file Behavior.h.

CComPtr<IHTMLDocument2> CBehavior::m_spDoc

Definition at line 29 of file Behavior.h.

CComPtr<IHTMLElement> CBehavior::m_spElem

Definition at line 27 of file Behavior.h.

CComPtr<IElementBehaviorSiteOM> CBehavior::m_spOMSite

Definition at line 25 of file Behavior.h.

CComPtr<IHTMLElement> CBehavior::m_spParent

Definition at line 28 of file Behavior.h.

CComPtr<IHTMLSelectionObject> CBehavior::m_spSel

Definition at line 31 of file Behavior.h.

CComPtr<IElementBehaviorSite> CBehavior::m_spSite

Definition at line 24 of file Behavior.h.

CComPtr<IHTMLWindow2> CBehavior::m_spWin

Definition at line 30 of file Behavior.h.

The documentation for this class was generated from the following files:
  • Web/Browser/RenderBehave/renderproject/Behavior.h
  • Web/Browser/RenderBehave/renderproject/Behavior.cpp
Generated on Wed Nov 13 2024 16:55:40 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CBicycle Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes

CBicycle Class Reference

#include "people.h"

Inherits CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, and CDelegationBase.

List of all members.

Public Member Functions

CBicycle (int i)
CBicycle (int i)
CBicycle (int i)
CBicycle (int i)
CBicycle (int i)
CBicycle (int i)
CBicycle (int i)
CBicycle (int i)
CBicycle (int i)
CBicycle (int i)
CBicycle (int i)
CBicycle (CBicycleFolder *parent, IWbemClassObject *inst)
virtual | ~CBicycle ()
virtual | ~CBicycle ()
virtual | ~CBicycle ()
virtual | ~CBicycle ()
virtual | ~CBicycle ()
virtual | ~CBicycle ()
virtual | ~CBicycle ()
virtual | ~CBicycle ()
virtual | ~CBicycle ()
virtual | ~CBicycle ()
virtual | ~CBicycle ()
virtual | ~CBicycle ()
virtual HRESULT | CreatePropertyPages (IPropertySheetCallback *lpProvider, LONG_PTR handle)
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual HRESULT | GetWatermarks (HBITMAP *lphWatermark, HBITMAP *lphHeader, HPALETTE *lphPalette, BOOL *bStretch)
virtual HRESULT | HasPropertySheets ()
virtual HRESULT | OnPropertyChange ()
virtual HRESULT | OnSelect (IConsole *pConsole, BOOL bScope, BOOL bSelect)

Private Member Functions

const TCHAR * | ConvertSurfaceValue (BYTE val)
bool | GetGirls (void)
void | LoadSurfaces (HWND hwndDlg, BYTE iSurface)
HRESULT | PutProperty (LPWSTR propName, BYTE val)
HRESULT | PutProperty (LPWSTR propName, bool val)
HRESULT | PutProperty (LPWSTR propName, LPTSTR str)

Static Private Member Functions

static BOOL CALLBACK | DialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)

Private Attributes

int | id
IWbemClassObject * | m_inst
BYTE | m_iSurface
CBicycleFolder * m_parent
LONG_PTR | m_ppHandle

Static Private Attributes

static const GUID | thisGuid = { 0xef163734, 0x9353, 0x11d2, { 0x99, 0x67, 0x0, 0x80, 0xc7, 0xdc, 0xb3, 0xdc } }

Detailed Description

Definition at line 25 of file people.h.

Constructor & Destructor Documentation

CBicycle::CBicycle ( int i ) [inline]

Definition at line 27 of file people.h.

: id(i) { }

virtual CBicycle::~CBicycle ( ) [inline, virtual]

Definition at line 28 of file people.h.

{}

CBicycle::CBicycle ( int i ) [inline]

Definition at line 27 of file people.h.

: id(i) { }

virtual CBicycle::~CBicycle ( ) [inline, virtual]

Definition at line 28 of file people.h.

{}

CBicycle::CBicycle ( int i ) [inline]

Definition at line 27 of file people.h.

: id(i) { }

virtual CBicycle::~CBicycle ( ) [inline, virtual]

Definition at line 28 of file people.h.

{}

CBicycle::CBicycle ( int i ) [inline]

Definition at line 27 of file people.h.

: id(i) { }

virtual CBicycle::~CBicycle ( ) [inline, virtual]

Definition at line 28 of file people.h.

{}

CBicycle::CBicycle ( int i ) [inline]

Definition at line 27 of file people.h.

: id(i) { }

virtual CBicycle::~CBicycle ( ) [inline, virtual]

Definition at line 28 of file people.h.

{}

CBicycle::CBicycle ( int i ) [inline]

Definition at line 27 of file people.h.

: id(i) { }

virtual CBicycle::~CBicycle ( ) [inline, virtual]

Definition at line 28 of file people.h.

{}

CBicycle::CBicycle ( int i ) [inline]

Definition at line 27 of file people.h.

: id(i) { }

virtual CBicycle::~CBicycle ( ) [inline, virtual]

Definition at line 28 of file people.h.

{}

CBicycle::CBicycle ( int i ) [inline]

Definition at line 27 of file people.h.

: id(i) { }

virtual CBicycle::~CBicycle ( ) [inline, virtual]

Definition at line 28 of file people.h.

{}

CBicycle::CBicycle ( int i ) [inline]

Definition at line 27 of file people.h.

: id(i) { }

virtual CBicycle::~CBicycle ( ) [inline, virtual]

Definition at line 28 of file people.h.

{}

CBicycle::CBicycle ( int i ) [inline]

Definition at line 27 of file people.h.

: id(i) { }

virtual CBicycle::~CBicycle ( ) [inline, virtual]

Definition at line 28 of file people.h.

{}

CBicycle::CBicycle ( int i ) [inline]

Definition at line 27 of file people.h.

: id(i) { }

virtual CBicycle::~CBicycle ( ) [inline, virtual]

Definition at line 28 of file people.h.

{}

CBicycle::CBicycle | ( | CBicycleFolder * | parent,
 |  | IWbemClassObject * | inst
 | ) |  |

Definition at line 821 of file people.Cpp.

                                                                 :
          m_parent(parent),
          m_inst(inst)
{
  if(m_inst)
    m_inst->AddRef();
}

virtual CBicycle::~CBicycle ( ) [inline, virtual]

Definition at line 90 of file people.h.

  {
    if(m_inst)
      m_inst->Release();

    m_inst = 0;
  }

Member Function Documentation

const TCHAR * CBicycle::ConvertSurfaceValue ( BYTE val ) [private]

Definition at line 963 of file people.Cpp.

{
  // Convert a enum to a string using the Value{} array.
  static TCHAR temp[128] = {0};

  return temp;
}

HRESULT CBicycle::CreatePropertyPages | ( | IPropertySheetCallback * | lpProvider,
 |  | LONG_PTR | handle |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 1201 of file people.Cpp.

{
    PROPSHEETPAGE psp;
    HPROPSHEETPAGE hPage = NULL;

    // cache this handle so we can call MMCPropertyChangeNotify
    m_ppHandle = handle;

    // create the property page for this node.
    // NOTE: if your node has multiple pages, put the following
    // in a loop and create multiple pages calling
    // lpProvider->AddPage() for each page.
    psp.dwSize = sizeof(PROPSHEETPAGE);
    psp.dwFlags = PSP_DEFAULT | PSP_USETITLE;
    psp.hInstance = g_hinst;
    psp.pszTemplate = MAKEINTRESOURCE(IDD_PROPPAGE_PEOPLE);
    psp.pfnDlgProc = DialogProc;
    psp.lParam = reinterpret_cast<LPARAM>(this);
    psp.pszTitle = MAKEINTRESOURCE(IDS_BIKE_TITLE);

    hPage = CreatePropertySheetPage(&psp);
    _ASSERT(hPage);

    return lpProvider->AddPage(hPage);
}

BOOL CALLBACK CBicycle::DialogProc | ( | HWND | hwndDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static, private]

Definition at line 1057 of file people.Cpp.

{
    static CBicycle *pBike = NULL;

    switch (uMsg)
  {
    case WM_INITDIALOG:
    {
      // catch the "this" pointer so we can actually operate on the object
      pBike = reinterpret_cast<CBicycle *>(reinterpret_cast<PROPSHEETPAGE *>(lParam)->lParam);

      SetDlgItemText(hwndDlg, IDC_PEOPLE_NAME, pBike->GetDisplayName(NAME_COL));
      SetDlgItemText(hwndDlg, IDC_PEOPLE_COLOR, pBike->GetDisplayName(COLOR_COL));
      SetDlgItemText(hwndDlg, IDC_PEOPLE_MATERIAL, pBike->GetDisplayName(MATERIAL_COL));
      SetDlgItemText(hwndDlg, IDC_PEOPLE_OWNER, pBike->GetDisplayName(OWNER_COL));

      Button_SetCheck(GetDlgItem(hwndDlg, IDC_PEOPLE_GIRLS),
              (pBike->GetGirls()? BST_CHECKED: BST_UNCHECKED));

      VARIANT pVal;
      VariantInit(&pVal);
      if(SUCCEEDED(pBike->m_inst->Get((bstr_t)L"Surface", 0L, &pVal, NULL, NULL)))
      {
        pBike->m_iSurface = V_UI1(&pVal);
        pBike->LoadSurfaces(hwndDlg, pBike->m_iSurface);

        VariantClear(&pVal);
      }

    }
        break;

    case WM_COMMAND:
        // turn the Apply button on
        if (HIWORD(wParam) == EN_CHANGE ||
            HIWORD(wParam) == CBN_SELCHANGE)
            SendMessage(GetParent(hwndDlg), PSM_CHANGED, (WPARAM)hwndDlg, 0);
        break;

    case WM_DESTROY:
        // tell MMC that we're done with the property sheet (we got this
        // handle in CreatePropertyPages
        MMCFreeNotifyHandle(pBike->m_ppHandle);
        break;

    case WM_NOTIFY:

    switch(((NMHDR *)lParam)->code)
    {
        case PSN_APPLY:
      {
        bool changed = false;
        TCHAR temp[50] = {0};
        HRESULT hr = S_OK;

        HWND hWnd = GetDlgItem(hwndDlg, IDC_PEOPLE_NAME);
        if(hWnd && Edit_GetModify(hWnd))
        {
          GetWindowText(hWnd, temp, 50);
          changed |= SUCCEEDED(pBike->PutProperty(L"Name", temp));
        }

        hWnd = GetDlgItem(hwndDlg, IDC_PEOPLE_COLOR);
        if(hWnd && Edit_GetModify(hWnd))
        {
          GetWindowText(hWnd, temp, 50);
          changed |= SUCCEEDED(pBike->PutProperty(L"Color", temp));
        }

        hWnd = GetDlgItem(hwndDlg, IDC_PEOPLE_MATERIAL);
        if(hWnd && Edit_GetModify(hWnd))
        {
          GetWindowText(hWnd, temp, 50);
          changed |= SUCCEEDED(pBike->PutProperty(L"Material", temp));
        }

        hWnd = GetDlgItem(hwndDlg, IDC_PEOPLE_OWNER);
        if(hWnd && Edit_GetModify(hWnd))
        {
          GetWindowText(hWnd, temp, 50);
          changed |= SUCCEEDED(hr = pBike->PutProperty(L"Owner", temp));
        }

        hWnd = GetDlgItem(hwndDlg, IDC_PEOPLE_SURFACE);

        if(hWnd)
        {
          BYTE newValue = ComboBox_GetCurSel(hWnd);
          if(newValue != pBike->m_iSurface)
          {
            changed |= SUCCEEDED(pBike->PutProperty(L"Surface", newValue));
          }
        }

        hWnd = GetDlgItem(hwndDlg, IDC_PEOPLE_GIRLS);
        if(hWnd)
        {
          bool checked = (Button_GetState(hWnd) & BST_CHECKED);
          bool wasChecked = pBike->GetGirls();
          // did it change?
          if(checked != wasChecked)
          {
            changed |= SUCCEEDED(pBike->PutProperty(L"Girls", checked));
          }
        }

        // if any property changed, write it back to WMI.
        if(changed)
        {
          IWbemServices *service = 0;
          // dialogs run in their own thread so use the marshaling helper
          // get a useable IWbemServices ptr.
          // NOTE: IWbemClassObjects are in-proc so they DONT need to be
          // marshaled.
          if(SUCCEEDED(pBike->m_parent->GetPtr(&service)))
          {
            service->PutInstance(pBike->m_inst, WBEM_FLAG_CREATE_OR_UPDATE, 0, 0);
            service->Release();
                  HRESULT hr = MMCPropertyChangeNotify(pBike->m_ppHandle, (long)pBike);
          }
        }
      }
      break;
        } // endswitch (((NMHDR *)lParam)->code)

        break;

    } // endswitch (uMsg)

    return DefWindowProc(hwndDlg, uMsg, wParam, lParam);
}

virtual const int CBicycle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 32 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CBicycle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 32 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CBicycle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 32 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CBicycle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 100 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CBicycle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 32 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CBicycle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 32 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CBicycle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 32 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CBicycle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 32 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CBicycle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 32 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CBicycle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 32 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CBicycle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 32 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CBicycle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 32 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const _TCHAR* CBicycle::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

virtual const _TCHAR* CBicycle::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

virtual const _TCHAR* CBicycle::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

virtual const _TCHAR* CBicycle::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

virtual const _TCHAR* CBicycle::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

virtual const _TCHAR* CBicycle::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

virtual const _TCHAR* CBicycle::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

const _TCHAR * CBicycle::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

Definition at line 278 of file people.Cpp.

{
    static _TCHAR buf[128];

    _stprintf(buf, _T("Bicycle #%d"), id);

    return buf;
}

virtual const _TCHAR* CBicycle::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

virtual const _TCHAR* CBicycle::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

virtual const _TCHAR* CBicycle::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

virtual const _TCHAR* CBicycle::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

bool CBicycle::GetGirls ( void ) [private]

Definition at line 882 of file people.Cpp.

{
  VARIANT_BOOL retval = VARIANT_FALSE;
  // Here's how to get/interpret a VT_BOOL property.
  if(m_inst)
  {
    VARIANT pVal;
    if(m_inst->Get(L"Girls", 0L, &pVal, NULL, NULL) == S_OK)
    {
      retval = V_BOOL(&pVal);
    }

    VariantClear(&pVal);
  } //endif (m_inst)

    return (retval == VARIANT_TRUE);
}

virtual const GUID& CBicycle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 31 of file people.h.

{ return thisGuid; }

virtual const GUID& CBicycle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 31 of file people.h.

{ return thisGuid; }

virtual const GUID& CBicycle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 31 of file people.h.

{ return thisGuid; }

virtual const GUID& CBicycle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 31 of file people.h.

{ return thisGuid; }

virtual const GUID& CBicycle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 31 of file people.h.

{ return thisGuid; }

virtual const GUID& CBicycle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 31 of file people.h.

{ return thisGuid; }

virtual const GUID& CBicycle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 31 of file people.h.

{ return thisGuid; }

virtual const GUID& CBicycle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 31 of file people.h.

{ return thisGuid; }

virtual const GUID& CBicycle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 31 of file people.h.

{ return thisGuid; }

virtual const GUID& CBicycle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 99 of file people.h.

{ return thisGuid; }

virtual const GUID& CBicycle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 31 of file people.h.

{ return thisGuid; }

virtual const GUID& CBicycle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 31 of file people.h.

{ return thisGuid; }

HRESULT CBicycle::GetWatermarks | ( | HBITMAP * | lphWatermark,
 |  | HBITMAP * | lphHeader,
 |  | HPALETTE * | lphPalette,
 |  | BOOL * | bStretch |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 1228 of file people.Cpp.

{
    return S_FALSE;
}

HRESULT CBicycle::HasPropertySheets ( ) [virtual]

Reimplemented from CDelegationBase.

Definition at line 1195 of file people.Cpp.

{
    // say "yes" when MMC asks if we have pages
    return S_OK;
}

void CBicycle::LoadSurfaces | ( | HWND | hwndDlg,
 |  | BYTE | iSurface |
 | ) |  |  | [private]

Definition at line 900 of file people.Cpp.

{
  HWND hCombo = GetDlgItem(hwndDlg, IDC_PEOPLE_SURFACE);
  HRESULT hr = E_FAIL;
  IWbemQualifierSet *qualSet = 0;
  int selected = 0;

  // qualifiers only exist on the class definition. m_inst is a instance.
  IWbemClassObject *pClass = 0;
  IWbemServices *service = 0;

  if(SUCCEEDED(m_parent->GetPtr(&service)))
  {
    hr = service->GetObject((bstr_t)L"Bicycle", 0,0, &pClass, 0);

    if(SUCCEEDED(hr = pClass->GetPropertyQualifierSet((bstr_t)L"Surface",
                              &qualSet)))
    {
      VARIANT vList;
      VariantInit(&vList);
      if(SUCCEEDED(hr = qualSet->Get((bstr_t)L"Values", 0, &vList, 0)))
      {
        SAFEARRAY *pma = V_ARRAY(&vList);
        long lLowerBound = 0, lUpperBound = 0 ;
        UINT idx = 0;

        SafeArrayGetLBound(pma, 1, &lLowerBound);
        SafeArrayGetUBound(pma, 1, &lUpperBound);

        for(long x = lLowerBound; x <= lUpperBound; x++)
        {
          BSTR vSurface;

          SafeArrayGetElement(pma, &x, &vSurface);

          // NOTE: taking advantage of the bstr_t's conversion operators.
          // really cleans up the code.
          bstr_t temp(vSurface);

          UINT idx = ComboBox_AddString(hCombo, (LPTSTR)temp);
          ComboBox_SetItemData(hCombo, idx, x);

          // is this the one we want to select?
          if(iSurface == x)
          {
            selected = x;
          }

        } //endfor
        VariantClear(&vList);
        ComboBox_SetCurSel(hCombo, selected);
      }

      qualSet->Release();
      qualSet = 0;
    } //endif GetPropertyQualifierSet()

    service->Release();

  } //endif GetPtr()

}

HRESULT CBicycle::OnPropertyChange ( ) [virtual]

Definition at line 1033 of file people.Cpp.

{
    return S_OK;
}

HRESULT CBicycle::OnSelect | ( | IConsole * | pConsole,
 |  | BOOL | bScope,
 |  | BOOL | bSelect |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 1038 of file people.Cpp.

{
    IConsoleVerb *pConsoleVerb;

    HRESULT hr = pConsole->QueryConsoleVerb(&pConsoleVerb);
    _ASSERT(SUCCEEDED(hr));

    // can't get to properties (via the standard methods) unless
    // we tell MMC to display the Properties menu item and
    // toolbar button, this wil give the user a visual cue that
    // there's "something" to do
    hr = pConsoleVerb->SetVerbState(MMC_VERB_PROPERTIES, ENABLED, TRUE);

    pConsoleVerb->Release();

    return S_OK;
}

HRESULT CBicycle::PutProperty | ( | LPWSTR | propName,
 |  | LPTSTR | str |
 | ) |  |  | [private]

Definition at line 971 of file people.Cpp.

{
  HRESULT hr = E_FAIL;
  if(m_inst)
  {
    VARIANT pVal;
    bstr_t temp(str);

    VariantInit(&pVal);
    V_BSTR(&pVal) = temp;
    V_VT(&pVal) = VT_BSTR;

    hr = m_inst->Put(propName, 0L, &pVal, 0);

    VariantClear(&pVal);
  } //endif (m_inst)

    return hr;
}

HRESULT CBicycle::PutProperty | ( | LPWSTR | propName,
 |  | bool | val |
 | ) |  |  | [private]

Definition at line 1010 of file people.Cpp.

{
  HRESULT hr = E_FAIL;
  if(m_inst)
  {
    VARIANT pVal;

    VariantInit(&pVal);
    V_BOOL(&pVal) = (val?VARIANT_TRUE: VARIANT_FALSE);
    V_VT(&pVal) = VT_BOOL;

    hr = m_inst->Put(propName, 0L, &pVal, 0);

    VariantClear(&pVal);

  } //endif (m_inst)

    return hr;
}

HRESULT CBicycle::PutProperty | ( | LPWSTR | propName,
 |  | BYTE | val |
 | ) |  |  | [private]

Definition at line 991 of file people.Cpp.

{
  HRESULT hr = E_FAIL;
  if(m_inst)
  {
    VARIANT pVal;

    VariantInit(&pVal);
    V_UI1(&pVal) = val;
    V_VT(&pVal) = VT_UI1;

    hr = m_inst->Put(propName, 0L, &pVal, 0);

    VariantClear(&pVal);
  } //endif (m_inst)

    return hr;
}

Member Data Documentation

int CBicycle::id [private]

Definition at line 38 of file people.h.

IWbemClassObject* CBicycle::m_inst [private]

Definition at line 117 of file people.h.

BYTE CBicycle::m_iSurface [private]

Definition at line 135 of file people.h.

CBicycleFolder* CBicycle::m_parent [private]

Definition at line 116 of file people.h.

LONG_PTR CBicycle::m_ppHandle [private]

Definition at line 119 of file people.h.

static const GUID CBicycle::thisGuid = { 0xef163734, 0x9353, 0x11d2, { 0x99, 0x67, 0x0, 0x80, 0xc7, 0xdc, 0xb3, 0xdc } } [static, private]

Reimplemented from CDelegationBase.

Definition at line 36 of file people.h.

The documentation for this class was generated from the following files:
  • SysMgmt/MMC/CMenu/people.h
  • SysMgmt/MMC/Complete/people.h
  • SysMgmt/MMC/CutCopy/people.h
  • SysMgmt/MMC/Extens/people.h
  • SysMgmt/MMC/Menubtn/people.h
  • SysMgmt/MMC/Multisel/people.h
  • SysMgmt/MMC/Nodes/people.h
  • SysMgmt/MMC/Openserv/people.h
  • SysMgmt/MMC/Proppage/people.h
  • SysMgmt/MMC/Taskpads/people.h
  • SysMgmt/MMC/Toolbar/people.h
  • SysMgmt/MMC/WMI/people.h
  • SysMgmt/MMC/CMenu/people.Cpp
  • SysMgmt/MMC/Complete/people.Cpp
  • SysMgmt/MMC/CutCopy/people.Cpp
  • SysMgmt/MMC/Extens/people.Cpp
  • SysMgmt/MMC/Menubtn/people.Cpp
  • SysMgmt/MMC/Multisel/people.Cpp
  • SysMgmt/MMC/Nodes/people.Cpp
  • SysMgmt/MMC/Openserv/people.Cpp
  • SysMgmt/MMC/Proppage/people.Cpp
  • SysMgmt/MMC/Taskpads/people.Cpp
  • SysMgmt/MMC/Toolbar/people.Cpp
  • SysMgmt/MMC/WMI/people.Cpp
Generated on Wed Nov 13 2024 16:55:40 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CBicycleFolder Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes

CBicycleFolder Class Reference

#include "people.h"

Inherits CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, and CDelegationBase.

List of all members.

Public Member Functions

CBicycleFolder ()
CBicycleFolder ()
CBicycleFolder ()
CBicycleFolder ()
CBicycleFolder ()
CBicycleFolder ()
CBicycleFolder ()
CBicycleFolder ()
CBicycleFolder ()
CBicycleFolder ()
CBicycleFolder ()
CBicycleFolder ()
virtual | ~CBicycleFolder ()
virtual | ~CBicycleFolder ()
virtual | ~CBicycleFolder ()
virtual | ~CBicycleFolder ()
virtual | ~CBicycleFolder ()
virtual | ~CBicycleFolder ()
virtual | ~CBicycleFolder ()
virtual | ~CBicycleFolder ()
virtual | ~CBicycleFolder ()
virtual | ~CBicycleFolder ()
virtual | ~CBicycleFolder ()
virtual | ~CBicycleFolder ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual HRESULT | GetListpadInfo (MMC_LISTPAD_INFO *lpListPadInfo)
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual HSCOPEITEM | GetParentScopeItem ()
HRESULT | GetPtr (IWbemServices **ptr)
virtual HRESULT | GetResultViewType (LPOLESTR *ppViewType, long *pViewOptions)
virtual MMC_TASK * | GetTaskList (LPOLESTR szTaskGroup, LONG *nCount)
virtual HRESULT | GetTaskpadBackground (MMC_TASK_DISPLAY_OBJECT *pTDO)
virtual HRESULT | GetTaskpadDescription (LPOLESTR *pszDescription)
virtual HRESULT | GetTaskpadTitle (LPOLESTR *pszTitle)
virtual HRESULT | OnListpad (IConsole *pConsole, BOOL bAttaching)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual void | SetScopeItemValue (HSCOPEITEM hscopeitem)
virtual HRESULT | TaskNotify (IConsole *pConsole, VARIANT *v1, VARIANT *v2)

Private Types

enum | { NUMBER_OF_CHILDREN = 20 }
enum | { NUMBER_OF_CHILDREN = 20 }
enum | { NUMBER_OF_CHILDREN = 20 }
enum | { NUMBER_OF_CHILDREN = 20 }
enum | { NUMBER_OF_CHILDREN = 20 }
enum | { NUMBER_OF_CHILDREN = 20 }
enum | { NUMBER_OF_CHILDREN = 20 }
enum | { NUMBER_OF_CHILDREN = 20 }
enum | { NUMBER_OF_CHILDREN = 20 }
enum | { NUMBER_OF_CHILDREN = 20 }
enum | { NUMBER_OF_CHILDREN = 20 }

Private Member Functions

HRESULT | DisplayChildren (void)
void | EmptyChildren (void)
bool | EnumChildren (IWbemServices *service)
bool | ErrorString (HRESULT hr, TCHAR *errMsg, UINT errSize)
void | RegisterEventSink (IWbemServices *service)
void | StopThread ()

Static Private Member Functions

static DWORD WINAPI | ThreadProc (LPVOID lpParameter)
static LRESULT CALLBACK | WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)

Private Attributes

CDelegationBase * | children [NUMBER_OF_CHILDREN]
CSimpleArray< CBicycle * > m_children
HWND | m_connectHwnd
CRITICAL_SECTION | m_critSect
HANDLE m_doWork
HSCOPEITEM | m_hParentHScopeItem
IResultData * | m_pResultData
IStream * | m_pStream
IWbemObjectSink * | m_pStubSink
HANDLE m_ptrReady
IUnsecuredApartment * | m_pUnsecApp
IWbemServices * | m_realWMI
bool | m_running
HANDLE m_thread
int | m_threadCmd
DWORD m_threadId

Static Private Attributes

static const GUID | thisGuid = { 0xef163732, 0x9353, 0x11d2, { 0x99, 0x67, 0x0, 0x80, 0xc7, 0xdc, 0xb3, 0xdc } }

Detailed Description

Definition at line 41 of file people.h.

Member Enumeration Documentation

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 58 of file people.h.

{ NUMBER_OF_CHILDREN = 20 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 62 of file people.h.

{ NUMBER_OF_CHILDREN = 20 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 58 of file people.h.

{ NUMBER_OF_CHILDREN = 20 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 58 of file people.h.

{ NUMBER_OF_CHILDREN = 20 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 58 of file people.h.

{ NUMBER_OF_CHILDREN = 20 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 58 of file people.h.

{ NUMBER_OF_CHILDREN = 20 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 58 of file people.h.

{ NUMBER_OF_CHILDREN = 20 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 58 of file people.h.

{ NUMBER_OF_CHILDREN = 20 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 58 of file people.h.

{ NUMBER_OF_CHILDREN = 20 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 68 of file people.h.

{ NUMBER_OF_CHILDREN = 20 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 58 of file people.h.

{ NUMBER_OF_CHILDREN = 20 };

Constructor & Destructor Documentation

CBicycleFolder::CBicycleFolder ( )

Definition at line 83 of file people.Cpp.

{
    for (int n = 0; n < NUMBER_OF_CHILDREN; n++) {
        children[n] = new CBicycle(n + 1);
    }
}

CBicycleFolder::~CBicycleFolder ( ) [virtual]

Definition at line 90 of file people.Cpp.

{
    for (int n = 0; n < NUMBER_OF_CHILDREN; n++)
        if (children[n]) {
            delete children[n];
        }
}

CBicycleFolder::CBicycleFolder ( )
virtual CBicycleFolder::~CBicycleFolder ( ) [virtual]
CBicycleFolder::CBicycleFolder ( )
virtual CBicycleFolder::~CBicycleFolder ( ) [virtual]
CBicycleFolder::CBicycleFolder ( )
virtual CBicycleFolder::~CBicycleFolder ( ) [virtual]
CBicycleFolder::CBicycleFolder ( )
virtual CBicycleFolder::~CBicycleFolder ( ) [virtual]
CBicycleFolder::CBicycleFolder ( )
virtual CBicycleFolder::~CBicycleFolder ( ) [virtual]
CBicycleFolder::CBicycleFolder ( )
virtual CBicycleFolder::~CBicycleFolder ( ) [virtual]
CBicycleFolder::CBicycleFolder ( )
virtual CBicycleFolder::~CBicycleFolder ( ) [virtual]
CBicycleFolder::CBicycleFolder ( )
virtual CBicycleFolder::~CBicycleFolder ( ) [virtual]
CBicycleFolder::CBicycleFolder ( )
virtual CBicycleFolder::~CBicycleFolder ( ) [virtual]
CBicycleFolder::CBicycleFolder ( )
virtual CBicycleFolder::~CBicycleFolder ( ) [virtual]
CBicycleFolder::CBicycleFolder ( )
virtual CBicycleFolder::~CBicycleFolder ( ) [virtual]

Member Function Documentation

HRESULT CBicycleFolder::DisplayChildren ( void ) [private]

Definition at line 598 of file people.Cpp.

{
    // insert items here
    RESULTDATAITEM rdi;
  HRESULT hr = S_OK;
  int last = m_children.GetSize();
  CBicycle *pBike = 0;

    // create the child nodes, then expand them
    for (int n = 0; n < last; n++)
  {
    pBike = (CBicycle *)m_children[n];

        ZeroMemory(&rdi, sizeof(RESULTDATAITEM) );
        rdi.mask       =  RDI_STR       |   // Displayname is valid
              RDI_IMAGE     |   // nImage is valid
              RDI_PARAM;

        rdi.nImage      = pBike->GetBitmapIndex();
        rdi.str         = MMC_CALLBACK;
        rdi.nCol        = 0;
        rdi.lParam      = (LPARAM)pBike;

    if(m_pResultData)
      hr = m_pResultData->InsertItem( &rdi );

        _ASSERT( SUCCEEDED(hr) );
    }
  return hr;
}

void CBicycleFolder::EmptyChildren ( void ) [private]

Definition at line 450 of file people.Cpp.

{
  if(m_pResultData)
  {
    HRESULT hr = m_pResultData->DeleteAllRsltItems();

    int last = m_children.GetSize();
    for (int n = 0; n < last; n++)
    {
      if (m_children[n] != NULL)
        delete m_children[n];
    }
    m_children.RemoveAll();
  }
}

bool CBicycleFolder::EnumChildren ( IWbemServices * service ) [private]

Definition at line 466 of file people.Cpp.

{
  IEnumWbemClassObject *pEnumBikes = NULL;
  HRESULT hr = S_OK;

  // get the list of bicycles...
  if(SUCCEEDED(hr = service->CreateInstanceEnum((bstr_t)L"Bicycle",
                      WBEM_FLAG_SHALLOW,
                      NULL, &pEnumBikes)))
  {
    // NOTE: pBike MUST be set to NULL for Next().
    IWbemClassObject *pBike = NULL;
    CBicycle *pBikeInst = 0;

    ULONG uReturned = 1;

    while((SUCCEEDED(hr = pEnumBikes->Next(-1, 1, &pBike, &uReturned))) &&
        (uReturned != 0))
    {
      // Add the bike...
      pBikeInst = new CBicycle(this, pBike);

      m_children.Add(pBikeInst);

      // Done with this object. pBikeInst "owns" it now.
      if(pBike)
      {
        pBike->Release();

        // NOTE: pBike MUST be reset to NULL for Next().
        pBike = NULL;
      }

    } // endwhile

    // Done with this enumerator.
    if (pEnumBikes)
    {
      pEnumBikes->Release();
      pEnumBikes = NULL;
    }
  } // endif CreateInstanceEnum()

  return SUCCEEDED(hr);
}

bool CBicycleFolder::ErrorString | ( | HRESULT | hr,
 |  | TCHAR * | errMsg,
 |  | UINT | errSize |
 | ) |  |  | [private]

Definition at line 112 of file people.Cpp.

{
    TCHAR szError[TEMP_BUF] = {0};
  TCHAR szFacility[TEMP_BUF] = {0};
  IWbemStatusCodeText * pStatus = NULL;

    // initialize buffers.
  memset(errMsg, 0, errSize * sizeof(TCHAR));

  HRESULT hr1 = CoInitialize(NULL);
  SCODE sc1 = CoCreateInstance(CLSID_WbemStatusCodeText,
                0, CLSCTX_INPROC_SERVER,
                IID_IWbemStatusCodeText,
                (LPVOID *) &pStatus);

  // loaded OK?
  if(sc1 == S_OK)
  {
    BSTR bstr;
    sc1 = pStatus->GetErrorCodeText(hr, 0, 0, &bstr);
    if(sc1 == S_OK)
    {
#ifdef UNICODE
      wcsncpy(szError, bstr, TEMP_BUF-1);
#else
      wcstombs(szError, bstr, TEMP_BUF-1);
#endif UNICODE
      SysFreeString(bstr);
      bstr = 0;
    }

    sc1 = pStatus->GetFacilityCodeText(hr, 0, 0, &bstr);
    if(sc1 == S_OK)
    {
#ifdef UNICODE
      wcsncpy(szFacility, bstr, TEMP_BUF-1);
#else
      wcstombs(szFacility, bstr, TEMP_BUF-1);
#endif UNICODE
      SysFreeString(bstr);
      bstr = 0;
    }

    // RELEASE
    pStatus->Release();
    pStatus = NULL;
  }
  else
  {
    ::MessageBox(NULL, _T("WBEM error features not available. Upgrade WMI to a newer build."),
           _T("Internal Error"), MB_ICONSTOP|MB_OK);
  }

  // if not msgs returned....
  if(_tcslen(szFacility) == 0 || _tcslen(szError) == 0)
  {
    // format the error nbr as a reasonable default.
    _stprintf(errMsg, _T("Error code: 0x%08X"), hr);
  }
  else
  {
    // format a readable msg.
    _stprintf(errMsg, _T("%s: %s"), szFacility, szError);
  }

  if(hr1 == S_OK)
    CoUninitialize();

  return (SUCCEEDED(sc1) && SUCCEEDED(hr1));
}

virtual const int CBicycleFolder::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 48 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CBicycleFolder::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 48 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CBicycleFolder::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 48 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CBicycleFolder::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 48 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CBicycleFolder::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 48 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CBicycleFolder::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 48 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CBicycleFolder::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 48 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CBicycleFolder::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 48 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CBicycleFolder::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 48 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CBicycleFolder::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 37 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CBicycleFolder::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 48 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CBicycleFolder::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 48 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const _TCHAR* CBicycleFolder::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 46 of file people.h.

{ return _T("Bicycles"); }

virtual const _TCHAR* CBicycleFolder::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 46 of file people.h.

{ return _T("Bicycles"); }

virtual const _TCHAR* CBicycleFolder::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 46 of file people.h.

{ return _T("Bicycles"); }

virtual const _TCHAR* CBicycleFolder::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 46 of file people.h.

{ return _T("Bicycles"); }

virtual const _TCHAR* CBicycleFolder::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 46 of file people.h.

{ return _T("Bicycles (horizontal listpad)"); }

virtual const _TCHAR* CBicycleFolder::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 46 of file people.h.

{ return _T("Bicycles"); }

virtual const _TCHAR* CBicycleFolder::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 46 of file people.h.

{ return _T("Bicycles"); }

virtual const _TCHAR* CBicycleFolder::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 46 of file people.h.

{ return _T("Bicycles"); }

virtual const _TCHAR* CBicycleFolder::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 46 of file people.h.

{ return _T("Bicycles"); }

virtual const _TCHAR* CBicycleFolder::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 35 of file people.h.

{ return _T("Bicycles"); }

virtual const _TCHAR* CBicycleFolder::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 46 of file people.h.

{ return _T("Bicycles"); }

virtual const _TCHAR* CBicycleFolder::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 46 of file people.h.

{ return _T("Bicycles"); }

HRESULT CBicycleFolder::GetListpadInfo ( MMC_LISTPAD_INFO * lpListPadInfo ) [virtual]

Reimplemented from CDelegationBase.

Definition at line 285 of file people.Cpp.

{
        lpListPadInfo->szTitle = OleDuplicateString(L"Bicycle");
        lpListPadInfo->szButtonText = OleDuplicateString(L"Special");
        lpListPadInfo->nCommandID = 102;
        return S_OK;
}

virtual const GUID& CBicycleFolder::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 47 of file people.h.

{ return thisGuid; }

virtual const GUID& CBicycleFolder::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 47 of file people.h.

{ return thisGuid; }

virtual const GUID& CBicycleFolder::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 47 of file people.h.

{ return thisGuid; }

virtual const GUID& CBicycleFolder::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 47 of file people.h.

{ return thisGuid; }

virtual const GUID& CBicycleFolder::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 47 of file people.h.

{ return thisGuid; }

virtual const GUID& CBicycleFolder::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 47 of file people.h.

{ return thisGuid; }

virtual const GUID& CBicycleFolder::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 47 of file people.h.

{ return thisGuid; }

virtual const GUID& CBicycleFolder::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 36 of file people.h.

{ return thisGuid; }

virtual const GUID& CBicycleFolder::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 47 of file people.h.

{ return thisGuid; }

virtual const GUID& CBicycleFolder::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 47 of file people.h.

{ return thisGuid; }

virtual const GUID& CBicycleFolder::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 47 of file people.h.

{ return thisGuid; }

virtual const GUID& CBicycleFolder::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 47 of file people.h.

{ return thisGuid; }

virtual HSCOPEITEM CBicycleFolder::GetParentScopeItem ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 50 of file people.h.

{ return m_hParentHScopeItem; }

HRESULT CBicycleFolder::GetPtr ( IWbemServices ** ptr )

Definition at line 512 of file people.Cpp.

{
  HRESULT hr = E_FAIL;
  m_threadCmd = CT_GET_PTR;
  SetEvent(m_doWork);
  WaitForSingleObject(m_ptrReady, 10000);

  if(ptr && m_pStream)
  {
    *ptr = 0;
    hr = CoGetInterfaceAndReleaseStream(m_pStream,
                      IID_IWbemServices,
                      (void**)ptr);
  }
  return hr;
}

HRESULT CBicycleFolder::GetResultViewType | ( | LPOLESTR * | ppViewType,
 |  | long * | pViewOptions |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 147 of file people.Cpp.

{
  TCHAR taskpad[1024];
    TCHAR szThis[16];

    _ultot((unsigned long)this, szThis, 16);
  _tcscpy(taskpad, _T("horizontal.htm#"));
    _tcscat(taskpad, szThis);
    MAKE_WIDEPTR_FROMTSTR_ALLOC(pszW, taskpad);

  *ppViewType = CreateResourcePath( NULL, pszW );

    *pViewOptions = MMC_VIEW_OPTIONS_NONE;
    return S_OK;
}

MMC_TASK * CBicycleFolder::GetTaskList | ( | LPOLESTR | szTaskGroup,
 |  | LONG * | nCount |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 163 of file people.Cpp.

{
    *nCount = 5;

    MMC_TASK *tasks = new MMC_TASK[*nCount];

    for (int t = 0; t < *nCount; t++) {
        tasks[t].sDisplayObject.eDisplayType = MMC_TASK_DISPLAY_TYPE_BITMAP;
        tasks[t].sDisplayObject.uBitmap.szMouseOverBitmap = CreateResourcePath(g_hinst, L"buttonover.bmp");
        tasks[t].sDisplayObject.uBitmap.szMouseOffBitmap = CreateResourcePath(g_hinst, L"buttonoff.bmp");

        switch (t) {
        case 0:
            tasks[t].szText = OleDuplicateString(L"Tune bicycle");
            tasks[t].szHelpString = OleDuplicateString(L"Click here to Tune bicycle");

            break;
        case 1:
            tasks[t].szText = OleDuplicateString(L"Ride bicycle");
            tasks[t].szHelpString = OleDuplicateString(L"Click here to ride bicycle");

            break;
        case 2:
            tasks[t].szText = OleDuplicateString(L"Stop riding bicycle");
            tasks[t].szHelpString = OleDuplicateString(L"Click here to stop riding bicycle");

            break;
        case 3:
            tasks[t].szText = OleDuplicateString(L"Purchase bicycle");
            tasks[t].szHelpString = OleDuplicateString(L"Click here to purchase bicycle");

        case 4:
            tasks[t].szText = OleDuplicateString(L"Sell bicycle");
            tasks[t].szHelpString = OleDuplicateString(L"Click here to sell bicycle");

            break;
        }

        tasks[t].eActionType = MMC_ACTION_ID;
        tasks[t].nCommandID = t;
    }

    return tasks;
}

HRESULT CBicycleFolder::GetTaskpadBackground ( MMC_TASK_DISPLAY_OBJECT * pTDO ) [virtual]

Reimplemented from CDelegationBase.

Definition at line 278 of file people.Cpp.

{
        pTDO->eDisplayType = MMC_TASK_DISPLAY_TYPE_BITMAP;
        pTDO->uBitmap.szMouseOverBitmap = CreateResourcePath(g_hinst, L"bicycle.bmp");
        return S_OK;
}

HRESULT CBicycleFolder::GetTaskpadDescription ( LPOLESTR * pszDescription ) [virtual]

Reimplemented from CDelegationBase.

Definition at line 272 of file people.Cpp.

{
        *pszDescription = OleDuplicateString(L"This is a sample task pad for bicycle nodes");
        return S_OK;
}

HRESULT CBicycleFolder::GetTaskpadTitle ( LPOLESTR * pszTitle ) [virtual]

Reimplemented from CDelegationBase.

Definition at line 266 of file people.Cpp.

{
        *pszTitle = OleDuplicateString(L"Bicycle Tasks");
        return S_OK;
}

HRESULT CBicycleFolder::OnListpad | ( | IConsole * | pConsole,
 |  | BOOL | bAttaching |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 293 of file people.Cpp.

{
    HRESULT      hr = S_OK;

    IHeaderCtrl *pHeaderCtrl = NULL;
    IResultData *pResultData = NULL;
    IImageList  *pImageList  = NULL;

    if (bAttaching) {
        hr = pConsole->QueryResultImageList(&pImageList);
        _ASSERT( SUCCEEDED(hr) );

        hr = pImageList->ImageListSetStrip((long *)m_pBMapSm, // pointer to a handle
                                           (long *)m_pBMapLg, // pointer to a handle
                                           0, // index of the first image in the strip
                                           RGB(0, 128, 128)  // color of the icon mask
            );
        _ASSERT( SUCCEEDED(hr) );

        pImageList->Release();

        hr = pConsole->QueryInterface(IID_IHeaderCtrl, (void **)&pHeaderCtrl);
        _ASSERT( SUCCEEDED(hr) );

        hr = pConsole->QueryInterface(IID_IResultData, (void **)&pResultData);
        _ASSERT( SUCCEEDED(hr) );

        // Set the column headers in the results pane
        hr = pHeaderCtrl->InsertColumn( 0, L"Name                ", 0, MMCLV_AUTO );
        _ASSERT( S_OK == hr );
        hr = pHeaderCtrl->InsertColumn( 1, L"Bicycle License      ", 0, MMCLV_AUTO );
        _ASSERT( S_OK == hr );

        // insert items here
        RESULTDATAITEM rdi;

        hr = pResultData->DeleteAllRsltItems();
        _ASSERT( SUCCEEDED(hr) );

        if (!bExpanded) {
            // create the child nodes, then expand them
            for (int n = 0; n < NUMBER_OF_CHILDREN; n++) {
                ZeroMemory(&rdi, sizeof(RESULTDATAITEM) );
                rdi.mask       = RDI_STR       |   // Displayname is valid
                    RDI_IMAGE     |
                    RDI_PARAM;        // nImage is valid

                rdi.nImage      = children[n]->GetBitmapIndex();
                rdi.str         = MMC_CALLBACK;
                rdi.nCol        = 0;
                rdi.lParam      = (LPARAM)children[n];

                hr = pResultData->InsertItem( &rdi );

                _ASSERT( SUCCEEDED(hr) );
            }
        }

        pHeaderCtrl->Release();
        pResultData->Release();
    }

    return hr;
}

virtual HRESULT CBicycleFolder::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CBicycleFolder::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CBicycleFolder::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CBicycleFolder::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CBicycleFolder::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CBicycleFolder::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CBicycleFolder::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

HRESULT CBicycleFolder::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 98 of file people.Cpp.

{
    HRESULT      hr = S_OK;

    IHeaderCtrl *pHeaderCtrl = NULL;
    IResultData *pResultData = NULL;

    if (bShow) {
        hr = pConsole->QueryInterface(IID_IHeaderCtrl, (void **)&pHeaderCtrl);
        _ASSERT( SUCCEEDED(hr) );

        hr = pConsole->QueryInterface(IID_IResultData, (void **)&pResultData);
        _ASSERT( SUCCEEDED(hr) );

        // Set the column headers in the results pane
        hr = pHeaderCtrl->InsertColumn( 0, L"Name                ", 0, MMCLV_AUTO );
        _ASSERT( S_OK == hr );

        // insert items here
        RESULTDATAITEM rdi;

        hr = pResultData->DeleteAllRsltItems();
        _ASSERT( SUCCEEDED(hr) );

        if (!bExpanded) {
            // create the child nodes, then expand them
            for (int n = 0; n < NUMBER_OF_CHILDREN; n++) {
                ZeroMemory(&rdi, sizeof(RESULTDATAITEM) );
                rdi.mask       = RDI_STR       |   // Displayname is valid
                    RDI_IMAGE     |
                    RDI_PARAM;        // nImage is valid

                rdi.nImage      = children[n]->GetBitmapIndex();
                rdi.str         = MMC_CALLBACK;
                rdi.nCol        = 0;
                rdi.lParam      = (LPARAM)children[n];

                hr = pResultData->InsertItem( &rdi );

                _ASSERT( SUCCEEDED(hr) );
            }
        }

        pHeaderCtrl->Release();
        pResultData->Release();
    }

    return hr;
}

virtual HRESULT CBicycleFolder::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CBicycleFolder::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CBicycleFolder::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

void CBicycleFolder::RegisterEventSink ( IWbemServices * service ) [private]

Definition at line 395 of file people.Cpp.

{
  //NOTE: this logic is from the Wmi documentation,
  // "Security Considerations with Asynchronous Calls" so you can
  // follow along.

  // allocate the sink if its not already allocated.
  if(m_pStubSink == 0)
  {
    CEventSink *pEventSink = 0;
    IUnknown* pStubUnk = 0;

    // create the 'real' sink.
    pEventSink = new CEventSink(m_connectHwnd);
    pEventSink->AddRef();

    // create an unsecapp object.
    CoCreateInstance(CLSID_UnsecuredApartment, NULL,
              CLSCTX_LOCAL_SERVER, IID_IUnsecuredApartment,
              (void**)&m_pUnsecApp);

    // give the 'real' sink to the unsecapp to manage. Get a 'pStubUnk' in return.
    m_pUnsecApp->CreateObjectStub(pEventSink, &pStubUnk);

    // from that pUnk, get a wrapper to your original sink.
    pStubUnk->QueryInterface(IID_IWbemObjectSink, (void **)&m_pStubSink);
    pStubUnk->Release();

    // release the 'real' sink cuz m_pStubSink "owns" it now.
    long ref = pEventSink->Release();
  }

  HRESULT hRes = S_OK;
  BSTR qLang = SysAllocString(L"WQL");
  BSTR query = SysAllocString(L"select * from __InstanceCreationEvent where TargetInstance isa \"Bicycle\"");

  // execute the query. For *Async, the last parm is a sink object
  // that will be sent the resultset instead of returning the normal
  // enumerator object.
  if(SUCCEEDED(hRes = service->ExecNotificationQueryAsync(qLang, query,
                              0L, NULL,
                              m_pStubSink)))
  {
    OutputDebugString(_T("Executed filter query\n"));
  }
  else
  {
    OutputDebugString(_T("ExecQuery() failed\n"));

  } //endif ExecQuery()

  SysFreeString(qLang);
  SysFreeString(query);
}

virtual void CBicycleFolder::SetScopeItemValue ( HSCOPEITEM hscopeitem ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 49 of file people.h.

{ m_hParentHScopeItem = hscopeitem; }

void CBicycleFolder::StopThread ( ) [private]

Definition at line 314 of file people.Cpp.

{
    EnterCriticalSection(&m_critSect);
    m_running = false;

    if (m_thread != NULL)
  {
    m_threadCmd = CT_EXIT;
    SetEvent(m_doWork);
    WaitForSingleObject(m_ptrReady, 10000);

        CloseHandle(m_thread);

        m_thread = NULL;
    }
    LeaveCriticalSection(&m_critSect);
}

HRESULT CBicycleFolder::TaskNotify | ( | IConsole * | pConsole,
 |  | VARIANT * | v1,
 |  | VARIANT * | v2 |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 208 of file people.Cpp.

{
    RESULTDATAITEM rdi;
    IResultData *pResultData;

    ZeroMemory(&rdi, sizeof(RESULTDATAITEM));

    HRESULT hr = S_OK;

    hr = pConsole->QueryInterface(IID_IResultData, (void **)&pResultData);

    if (SUCCEEDED(hr)) {

        rdi.mask = RDI_STATE | RDI_PARAM;  // Use selected state to get param.
        rdi.nState = LVIS_SELECTED | LVIS_FOCUSED;
        rdi.nIndex = -1;  // Start looking for selected item from top of list view

        hr = pResultData->GetNextItem(&rdi);

        pResultData->Release();
    }

    if (SUCCEEDED(hr)) {
        _TCHAR buf[256];

        switch (v1->lVal) {
        case 0:
            wsprintf(buf, _T("Bicycle %d tuned."), rdi.nIndex);

            break;
        case 1:
            wsprintf(buf, _T("Riding bicycle %d."), rdi.nIndex);

            break;
        case 2:
            wsprintf(buf, _T("Not riding bicycle %d."), rdi.nIndex);

            break;
        case 3:
            wsprintf(buf, _T("Bicycle %d purchased."), rdi.nIndex);

            break;
        case 4:
            wsprintf(buf, _T("Bicycle %d sold."), rdi.nIndex);

            break;
        case 102:
            wsprintf(buf, _T("Special bicycle task choosen (%d)."), rdi.nIndex);

            break;
        }

        MessageBox(NULL, buf, _T("Task Notification"), MB_OK | MB_ICONINFORMATION);
    }

    return hr;
}

DWORD WINAPI CBicycleFolder::ThreadProc ( LPVOID lpParameter ) [static, private]

Definition at line 529 of file people.Cpp.

{
    CBicycleFolder *pThis = (CBicycleFolder *)lpParameter;
  HRESULT hr = S_OK;

  CoInitialize(NULL);

  while(true)
  {
    WaitForSingleObject(pThis->m_doWork, -1);

    switch(pThis->m_threadCmd)
    {
    case CT_CONNECT:
      {
        IWbemLocator *pLocator = 0;
        HRESULT hr;

        // Create an instance of the WbemLocator interface.
        hr = CoCreateInstance(CLSID_WbemLocator,
                    NULL, CLSCTX_INPROC_SERVER,
                    IID_IWbemLocator, (LPVOID *)&pLocator);

        if(SUCCEEDED(hr))
        {
          hr = pLocator->ConnectServer(L"root\\Vehicles",// Network
                          NULL,         // User
                          NULL,         // Password
                          NULL,         // Locale
                          0,            // Security Flags
                          NULL,         // Authority
                          NULL,         // Context
                          &pThis->m_realWMI);  // Namespace

          // tell the callback the result of the connection.
          if(pThis->m_connectHwnd)
            PostMessage(pThis->m_connectHwnd, WM_WMI_CONNECTED, hr, 0);
        }
      }
      break;

    case CT_GET_PTR:
      if(pThis->m_realWMI != NULL)
      {
        hr = CoMarshalInterThreadInterfaceInStream(IID_IWbemServices,
                              pThis->m_realWMI,
                              &(pThis->m_pStream));
      }

      SetEvent(pThis->m_ptrReady);
      break;

    case CT_EXIT:
      if(pThis->m_realWMI != NULL)
      {
        pThis->m_realWMI->Release();
        pThis->m_realWMI = 0;
      }
      SetEvent(pThis->m_ptrReady);
      return 0;
      break;

    } //endswitch

  } //endwhile(true)

    return 0;
}

LRESULT CALLBACK CBicycleFolder::WindowProc | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static, private]

Definition at line 332 of file people.Cpp.

{
    CBicycleFolder *pThis = (CBicycleFolder *)GetWindowLong(hwnd, GWL_USERDATA);

    switch (uMsg)
  {
    case WM_WMI_CONNECTED:
        if(pThis != NULL)
    {
      IWbemServices *service = 0;
      HRESULT hr = pThis->GetPtr(&service);
      if(SUCCEEDED(hr))
      {
        pThis->RegisterEventSink(service);
        pThis->EnumChildren(service);

        // m_pResultData gets set when an onShow has happened. If set, the user already wants
        // to see equipment but the connection was slower than the UI. Catchup now.
        if(pThis->m_pResultData)
          pThis->DisplayChildren();

        // done with the marshaled service ptr.
        service->Release();
        service = 0;
      }
    }
    else
    {
      TCHAR errMsg[255] = {0};
      pThis->ErrorString((HRESULT)wParam, errMsg, 255);

      MessageBox(hwnd, errMsg, _T("WMI Snapin Sample"), MB_OK|MB_ICONSTOP);
    }

        break;

    case WM_REFRESH_EVENT:
        if(pThis != NULL)
    {
      IWbemServices *service = 0;
      HRESULT hr = pThis->GetPtr(&service);
      if(SUCCEEDED(hr))
      {
        pThis->EmptyChildren();
        pThis->EnumChildren(service);
        pThis->DisplayChildren();

        // done with the marshaled service ptr.
        service->Release();
        service = 0;
      }
    }
        break;

  } //endswitch

    return DefWindowProc(hwnd, uMsg, wParam, lParam);
}

Member Data Documentation

CDelegationBase * CBicycleFolder::children [private]

Definition at line 59 of file people.h.

CSimpleArray<CBicycle *> CBicycleFolder::m_children [private]

Definition at line 47 of file people.h.

HWND CBicycleFolder::m_connectHwnd [private]

Definition at line 67 of file people.h.

CRITICAL_SECTION CBicycleFolder::m_critSect [private]

Definition at line 77 of file people.h.

HANDLE CBicycleFolder::m_doWork [private]

Definition at line 71 of file people.h.

HSCOPEITEM CBicycleFolder::m_hParentHScopeItem [private]

Definition at line 60 of file people.h.

IResultData* CBicycleFolder::m_pResultData [private]

Definition at line 82 of file people.h.

IStream* CBicycleFolder::m_pStream [private]

Definition at line 83 of file people.h.

IWbemObjectSink* CBicycleFolder::m_pStubSink [private]

Definition at line 64 of file people.h.

HANDLE CBicycleFolder::m_ptrReady [private]

Definition at line 80 of file people.h.

IUnsecuredApartment* CBicycleFolder::m_pUnsecApp [private]

Definition at line 65 of file people.h.

IWbemServices* CBicycleFolder::m_realWMI [private]

Definition at line 84 of file people.h.

bool CBicycleFolder::m_running [private]

Definition at line 78 of file people.h.

HANDLE CBicycleFolder::m_thread [private]

Definition at line 69 of file people.h.

int CBicycleFolder::m_threadCmd [private]

Definition at line 72 of file people.h.

DWORD CBicycleFolder::m_threadId [private]

Definition at line 68 of file people.h.

static const GUID CBicycleFolder::thisGuid = { 0xef163732, 0x9353, 0x11d2, { 0x99, 0x67, 0x0, 0x80, 0xc7, 0xdc, 0xb3, 0xdc } } [static, private]

Reimplemented from CDelegationBase.

Definition at line 56 of file people.h.

The documentation for this class was generated from the following files:
  • SysMgmt/MMC/CMenu/people.h
  • SysMgmt/MMC/Complete/people.h
  • SysMgmt/MMC/CutCopy/people.h
  • SysMgmt/MMC/Extens/people.h
  • SysMgmt/MMC/Menubtn/people.h
  • SysMgmt/MMC/Multisel/people.h
  • SysMgmt/MMC/Nodes/people.h
  • SysMgmt/MMC/Openserv/people.h
  • SysMgmt/MMC/Proppage/people.h
  • SysMgmt/MMC/Taskpads/people.h
  • SysMgmt/MMC/Toolbar/people.h
  • SysMgmt/MMC/WMI/people.h
  • SysMgmt/MMC/CMenu/people.Cpp
  • SysMgmt/MMC/Complete/people.Cpp
  • SysMgmt/MMC/CutCopy/people.Cpp
  • SysMgmt/MMC/Extens/people.Cpp
  • SysMgmt/MMC/Menubtn/people.Cpp
  • SysMgmt/MMC/Multisel/people.Cpp
  • SysMgmt/MMC/Nodes/people.Cpp
  • SysMgmt/MMC/Openserv/people.Cpp
  • SysMgmt/MMC/Proppage/people.Cpp
  • SysMgmt/MMC/Taskpads/people.Cpp
  • SysMgmt/MMC/Toolbar/people.Cpp
  • SysMgmt/MMC/WMI/people.Cpp
Generated on Wed Nov 13 2024 16:55:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CBinder Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Protected Attributes | Friends

CBinder Class Reference

#include "cbinder.h"

Inherits CBaseObj, and CBase.

List of all members.

Public Member Functions

CBinder (CMainWindow *pCMainWindow, CMDIChild *pCMDIChild=NULL)
CBinder (LPUNKNOWN)
virtual | ~CBinder ()
virtual | ~CBinder (void)
virtual HRESULT | AutoQI (DWORD dwCreateOpts)
virtual HRESULT | AutoRelease ()
virtual HRESULT | CreateBinder (REFCLSID clsidProv)
BOOL FInit ()
virtual REFIID | GetDefaultInterface ()
virtual IUnknown ** | GetInterfaceAddress (REFIID riid)
virtual WCHAR * | GetObjectDesc ()
virtual LONG | GetObjectImage ()
virtual UINT | GetObjectMenu ()
virtual WCHAR * | GetObjectName ()
virtual void | OnDefOperation ()
STDMETHODIMP | QueryInterface (REFIID, LPVOID *)
virtual HRESULT | SetProperties (ULONG cPropSets, DBPROPSET *rgPropSets)
STDMETHODIMP_ (DBREFCOUNT) AddRef(void)
STDMETHODIMP_ (DBREFCOUNT) Release(void)

Public Attributes

IBindResource * | m_pIBindResource
ICreateRow * | m_pICreateRow
IDBBinderProperties * | m_pIDBBinderProperties
IDBProperties * | m_pIDBProperties
IRegisterProvider * | m_pIRegisterProvider
WCHAR * | m_pwszURL

Protected Attributes

DBREFCOUNT | m_cRef
PIMPIBINDRESOURCE m_pIBindResource
PIMPICREATEROW m_pICreateRow
PIMPIDBBINDERPROPERTIES m_pIDBBinderProperties
PCUTILPROP m_pUtilProp

Friends

class | CImpIBindResource
class | CImpICreateRow
class | CImpIDBBinderProperties

Detailed Description

Definition at line 26 of file cbinder.h.

Constructor & Destructor Documentation

CBinder::CBinder | ( | CMainWindow * | pCMainWindow,
 |  | CMDIChild * | pCMDIChild = NULL
 | ) |  |

Definition at line 22 of file cbinder.cpp.

  : CBase(eCBinder, pCMainWindow, pCMDIChild)
{
  //OLE DB Interfaces
  m_pIBindResource    = NULL;   //Binder interface
  m_pICreateRow     = NULL;   //Binder interface
  m_pIDBProperties    = NULL;   //Binder interface
  m_pIDBBinderProperties  = NULL;   //Binder interface

  m_pIRegisterProvider  = NULL;   //Binder interface

  //Data
  m_pwszURL       = NULL;
}

CBinder::~CBinder ( ) [virtual]

Definition at line 42 of file cbinder.cpp.

{
  ReleaseObject(0);

  //Save Recent URL into the Registry
  if(m_pwszURL)
  {
    DelRegEntry(HKEY_ROWSETVIEWER, wszRECENTURL_KEY);
    SetRegEntry(HKEY_ROWSETVIEWER, wszRECENTURL_KEY, m_pwszURL, L"");
    SAFE_FREE(m_pwszURL);
  }
}

CBinder::CBinder ( LPUNKNOWN pUnkOuter )

Definition at line 30 of file binder.cpp.

  : CBaseObj( BOT_BINDER )
{
  m_cRef = 0;
  m_pUnkOuter = pUnkOuter ? pUnkOuter : this;

  m_pUtilProp     = NULL;

  // Contained interfaces
  m_pIBindResource    = NULL;
  m_pIDBBinderProperties  = NULL;
  m_pICreateRow     = NULL;
}

virtual CBinder::~CBinder ( void ) [virtual]

Member Function Documentation

HRESULT CBinder::AutoQI ( DWORD dwCreateOpts ) [virtual]

Implements CBase.

Definition at line 94 of file cbinder.cpp.

{
  //Delegate First so we have base interfaces
  CBase::AutoQI(dwCreateOpts);

  //[MANDATORY] Obtain [mandatory] interfaces
  if(dwCreateOpts & CREATE_QI_MANDATORY)
  {
    OBTAIN_INTERFACE(IBindResource);
    OBTAIN_INTERFACE(IDBProperties);
  }

  //[OPTIONAL]
  if(dwCreateOpts & CREATE_QI_OPTIONAL)
  {
    OBTAIN_INTERFACE(ICreateRow);
    OBTAIN_INTERFACE(IDBBinderProperties);
    OBTAIN_INTERFACE(IRegisterProvider);
  }

  //Get the Recent Saved URL
  if(!m_pwszURL)
    GetRegEnumValue(HKEY_ROWSETVIEWER, wszRECENTURL_KEY, 0, &m_pwszURL);
  if(!m_pwszURL)
    m_pwszURL = wcsDuplicate(L"http://");

  return S_OK;
}

HRESULT CBinder::AutoRelease ( ) [virtual]

Implements CBase.

Definition at line 77 of file cbinder.cpp.

{
  RELEASE_INTERFACE(IBindResource);
  RELEASE_INTERFACE(ICreateRow);
  RELEASE_INTERFACE(IDBProperties);
  RELEASE_INTERFACE(IDBBinderProperties);
  RELEASE_INTERFACE(IRegisterProvider);

  //Delegate
  return CBase::AutoRelease();
}

HRESULT CBinder::CreateBinder ( REFCLSID clsidProv ) [virtual]

Definition at line 159 of file cbinder.cpp.

{
  HRESULT hr = S_OK;
  CComPtr<IBindResource>  spBindResource;

  //Create the Binder object (optional object)...
  XTESTC(hr = m_pCMainWindow->m_pCRootEnumerator->CreateInstance(NULL, clsid, CLSCTX_ALL, IID_IBindResource, (IUnknown**)&spBindResource));

  //Delegate
  m_guidSource = clsid;
  TESTC(hr = CreateObject(NULL, IID_IBindResource, spBindResource));

CLEANUP:
  return hr;
}

BOOL CBinder::FInit ( )

Definition at line 70 of file binder.cpp.

{
  assert(m_pUnkOuter);

  m_pUtilProp     = new CUtilProp();

  // contained interfaces
  m_pIBindResource    = new CImpIBindResource( this, m_pUnkOuter );
  m_pIDBBinderProperties  = new CImpIDBBinderProperties( this, m_pUnkOuter );
  m_pICreateRow     = new CImpICreateRow( this, m_pUnkOuter );

  return (m_pUtilProp && m_pIBindResource && m_pIDBBinderProperties &&
      m_pICreateRow);
}

virtual REFIID CBinder::GetDefaultInterface ( ) [inline, virtual]

Implements CBase.

Definition at line 43 of file cbinder.h.

{ return IID_IBindResource; }

IUnknown ** CBinder::GetInterfaceAddress ( REFIID riid ) [virtual]

Implements CBase.

Definition at line 60 of file cbinder.cpp.

{
  HANDLE_GETINTERFACE(IBindResource);
  HANDLE_GETINTERFACE(ICreateRow);
  HANDLE_GETINTERFACE(IDBBinderProperties);
  HANDLE_GETINTERFACE(IDBProperties);
  HANDLE_GETINTERFACE(IRegisterProvider);

  //Otherwise delegate
  return CBase::GetInterfaceAddress(riid);
}

WCHAR * CBinder::GetObjectDesc ( ) [virtual]

Reimplemented from CBase.

Definition at line 128 of file cbinder.cpp.

{
  if(!m_strObjectDesc && m_guidSource != GUID_NULL)
  {
    if(m_guidSource == CLSID_RootBinder)
      m_strObjectDesc.CopyFrom(L"Root Binder");
    else
      m_strObjectDesc.CopyFrom(GetProgID(m_guidSource));
  }

  return m_strObjectDesc;
}

virtual LONG CBinder::GetObjectImage ( ) [inline, virtual]

Implements CBase.

Definition at line 42 of file cbinder.h.

{ return IMAGE_CHAPTER;   }

virtual UINT CBinder::GetObjectMenu ( ) [inline, virtual]

Implements CBase.

Definition at line 41 of file cbinder.h.

{ return IDM_BINDERMENU;  }

virtual WCHAR* CBinder::GetObjectName ( ) [inline, virtual]

Implements CBase.

Definition at line 40 of file cbinder.h.

{ return L"Binder";     }

void CBinder::OnDefOperation ( ) [virtual]

Reimplemented from CBase.

Definition at line 147 of file cbinder.cpp.

{
  //Display the Bind Dialog (by default)
  if(m_pIBindResource)
    m_pCMainWindow->DisplayDialog(IDD_BINDRESOURCE, GetFocus(), CMainWindow::BindResourceProc, this, IDM_IBINDRESOURCE_BIND);
}

STDMETHODIMP CBinder::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 98 of file binder.cpp.

{
    if (NULL == ppv)
        return ResultFromScode( E_INVALIDARG );

  //  Place NULL in *ppv in case of failure
    *ppv = NULL;

  //IUNKNOWN
  if (riid == IID_IUnknown)
    *ppv = this;
  else if(riid == IID_IBindResource)
    *ppv = (LPVOID) m_pIBindResource;
  else if(riid == IID_IDBProperties)
    *ppv = (LPVOID) m_pIDBBinderProperties;
  else if(riid == IID_IDBBinderProperties)
    *ppv = (LPVOID) m_pIDBBinderProperties;
  else if(riid == IID_ICreateRow)
    *ppv = (LPVOID) m_pICreateRow;

    //  If we're going to return an interface, AddRef it first
    if (*ppv)
        {
        ((LPUNKNOWN) *ppv)->AddRef();
        return ResultFromScode( S_OK );
        }
    else
        return ResultFromScode( E_NOINTERFACE );
}

HRESULT CBinder::SetProperties | ( | ULONG | cPropSets,
 |  | DBPROPSET * | rgPropSets |
 | ) |  |  | [virtual]

Definition at line 180 of file cbinder.cpp.

{
  HRESULT hr = S_OK;

  if(m_pIDBProperties && cPropSets)
  {
    //SetProperties
    XTEST_(hr = m_pIDBProperties->SetProperties(cPropSets, rgPropSets),S_OK);
    TRACE_METHOD(hr, L"IDBProperties::SetProperties(%d, 0x%p)", cPropSets, rgPropSets);

    //Display any property errors...
    TESTC(hr = DisplayPropErrors(hr, cPropSets, rgPropSets));
  }

CLEANUP:
  return hr;
}

CBinder::STDMETHODIMP_ ( DBREFCOUNT )
CBinder::STDMETHODIMP_ ( DBREFCOUNT )

Friends And Related Function Documentation

friend class CImpIBindResource [friend]

Definition at line 38 of file binder.h.

friend class CImpICreateRow [friend]

Definition at line 40 of file binder.h.

friend class CImpIDBBinderProperties [friend]

Definition at line 39 of file binder.h.

Member Data Documentation

DBREFCOUNT CBinder::m_cRef [protected]

Reimplemented from CBase.

Definition at line 50 of file binder.h.

IBindResource* CBinder::m_pIBindResource

Definition at line 52 of file cbinder.h.

PIMPIBINDRESOURCE CBinder::m_pIBindResource [protected]

Definition at line 53 of file binder.h.

ICreateRow* CBinder::m_pICreateRow

Definition at line 53 of file cbinder.h.

PIMPICREATEROW CBinder::m_pICreateRow [protected]

Definition at line 57 of file binder.h.

IDBBinderProperties* CBinder::m_pIDBBinderProperties

Definition at line 55 of file cbinder.h.

PIMPIDBBINDERPROPERTIES CBinder::m_pIDBBinderProperties [protected]

Definition at line 55 of file binder.h.

IDBProperties* CBinder::m_pIDBProperties

Definition at line 54 of file cbinder.h.

IRegisterProvider* CBinder::m_pIRegisterProvider

Definition at line 58 of file cbinder.h.

PCUTILPROP CBinder::m_pUtilProp [protected]

Definition at line 45 of file binder.h.

WCHAR* CBinder::m_pwszURL

Definition at line 61 of file cbinder.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cbinder.h
  • Dataaccess/oledb/sampprov/binder.h
  • Dataaccess/oledb/rowsetviewer/cbinder.cpp
  • Dataaccess/oledb/sampprov/binder.cpp
Generated on Wed Nov 13 2024 16:55:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CBindings Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CBindings Class Reference

#include "crowset.h"

Inherits CVector< DBBINDING, DBCOUNTITEM >.

List of all members.

Public Member Functions

CBindings ()
~CBindings ()
HRESULT | FreeData (void *pv, BOOL fSetData=FALSE)
const DBBINDING * | GetOrdinal (DBORDINAL iOrdinal)
void | RemoveAll ()

Detailed Description

Definition at line 39 of file crowset.h.

Constructor & Destructor Documentation

CBindings::CBindings ( ) [inline]

Definition at line 43 of file crowset.h.

{}

CBindings::~CBindings ( ) [inline]

Definition at line 44 of file crowset.h.

{}

Member Function Documentation

HRESULT CBindings::FreeData | ( | void * | pv,
 |  | BOOL | fSetData = FALSE |
 | ) |  |  | [inline]

Definition at line 56 of file crowset.h.

  {
    //Delegate
    return ::FreeBindingData(m_cElements, m_rgElements, pv, fSetData);
  }

const DBBINDING* CBindings::GetOrdinal ( DBORDINAL iOrdinal ) [inline]

Definition at line 62 of file crowset.h.

  {
    //Due to the bookmark column being present or absent causes the Binding
    //to not be lined exactly (1:1) to the Ordinal position...

    //no-ops
    if(!GetCount() || !GetElements() || (iOrdinal==0 && GetElement(0).iOrdinal!=0))
      return NULL;

    //Bookmark
    if(GetElement(0).iOrdinal == 0)
    {
      //[0,1,2,3,4,5...]
      ASSERT(GetElement(iOrdinal).iOrdinal == iOrdinal);
      return &GetElement(iOrdinal);
    }
    else
    {
      //[1,2,3,4,5...]
      ASSERT(GetElement(iOrdinal-1).iOrdinal == iOrdinal);
      return &GetElement(iOrdinal-1);
    }

    return NULL;
  }

void CBindings::RemoveAll ( ) [inline, virtual]

Reimplemented from CVector< DBBINDING, DBCOUNTITEM >.

Definition at line 47 of file crowset.h.

  {
    //Overloaded - inorder to first free out-of-line data
        ::FreeBindings(&m_cElements, &m_rgElements);

    //Now - Delegate
    CVector<DBBINDING, DBCOUNTITEM>::RemoveAll();
  }

The documentation for this class was generated from the following file:
  • Dataaccess/oledb/rowsetviewer/crowset.h
Generated on Wed Nov 13 2024 16:55:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CBitArray Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CBitArray Class Reference

#include "bitarray.h"

List of all members.

Public Member Functions

CBitArray (void)
~CBitArray (void)
STDMETHODIMP | ArrayEmpty (void)
STDMETHODIMP | FindSet (ULONG islotStart, ULONG islotLimit, ULONG *pislot)
STDMETHODIMP | FInit (ULONG cslotMax, ULONG cbPage)
STDMETHODIMP | IsSlotSet (ULONG islot)
STDMETHODIMP | ResetSlots (ULONG islotFirst, ULONG islotLast)
STDMETHODIMP | SetSlots (ULONG islotFirst, ULONG islotLast)

Private Attributes

ULONG m_cbPage
ULONG m_cPageCurrent
ULONG m_cPageMax
ULONG m_cslotCurrent
BYTE * | m_rgbBit
BYTE | m_rgbBitMask [8]

Detailed Description

Definition at line 24 of file bitarray.h.

Constructor & Destructor Documentation

CBitArray::CBitArray ( void )

Definition at line 22 of file bitarray.cpp.

{
    m_rgbBit       = NULL;
    m_cPageMax     = 0;
    m_cPageCurrent = 0;
    m_cslotCurrent = 0;
}

CBitArray::~CBitArray ( void )

Definition at line 39 of file bitarray.cpp.

{
    if (m_rgbBit)
        {
        if (m_cPageCurrent)
            VirtualFree((VOID *) m_rgbBit, m_cPageCurrent *m_cbPage, MEM_DECOMMIT );
        VirtualFree((VOID *) m_rgbBit, 0, MEM_RELEASE );
        }
}

Member Function Documentation

STDMETHODIMP CBitArray::ArrayEmpty ( void )

Definition at line 202 of file bitarray.cpp.

{
    if (m_cPageCurrent)
        {
        ULONG idw, cdw, *rgdw;

        cdw = m_cPageCurrent * (m_cbPage / sizeof( ULONG ));
        rgdw = (ULONG *) m_rgbBit;
        for (idw =0; idw < cdw; idw++)
            if (rgdw[idw])
                return ResultFromScode( S_FALSE );
        }
    return ResultFromScode( S_OK );
}

STDMETHODIMP CBitArray::FindSet | ( | ULONG | islotStart,
 |  | ULONG | islotLimit,
 |  | ULONG * | pislot
 | ) |  |

Definition at line 249 of file bitarray.cpp.

{
    ULONG ibStart, ibLimit, idwStart, idwLimit, ibEnd, ib, islot, islotEnd, idw, *pdw;

    if (islotStart > islotLimit)
        {
        ibStart  = islotStart / 8;
        ibLimit  = islotLimit / 8;
        if ((ibStart - ibLimit) > 1)
            {
            islotEnd = ibStart*8;
            for (islot = islotStart; islot >= islotEnd; islot--)
                if (m_rgbBit[islot / 8] & m_rgbBitMask[islot % 8])
                    {
                    *pislot = islot;
                    return ResultFromScode( S_OK );
                    }
            idwStart = islotStart / 32;
            idwLimit = islotLimit / 32;
            if (idwStart - idwLimit > 1)
                {
                ibEnd = idwStart*4;
                for (ib = ibStart - 1; ib >= ibEnd; ib--)
                    if (m_rgbBit[ib])
                        {
                        islot = ib*8 + 7;
                        goto Found1;
                        }
                for (pdw = (ULONG *) & m_rgbBit[ (idwStart - 1) *4], idw = idwStart - 1; idw > idwLimit; idw--, pdw--)
                    if (*pdw)
                        {
                        islot = idw*32 + 31;
                        goto Found1;
                        }
                ib = (idwLimit*4 + 3);
                }
            else
                ib = ibStart - 1;
            for (; ib > ibLimit; ib--)
                if (m_rgbBit[ib])
                    {
                    islot = ib*8 + 7;
                    goto Found1;
                    }
            islot = (ibLimit*8 + 7);
            }
        else
            islot = islotStart;

        Found1:
        for (; islot >= islotLimit; islot--)
            if (m_rgbBit[islot / 8] & m_rgbBitMask[islot % 8])
                {
                *pislot = islot;
                return ResultFromScode( S_OK );
                }
        return ResultFromScode( S_FALSE );  // not found
        }
    else
        return ResultFromScode( E_FAIL );
}

STDMETHODIMP CBitArray::FInit | ( | ULONG | cslotMax,
 |  | ULONG | cbPage
 | ) |  |

Definition at line 60 of file bitarray.cpp.

{
    ULONG cPage;
    ULONG ib;

    cPage = (cslotMax / 8 + 1) / cbPage + 1;
    m_rgbBit = (BYTE *) VirtualAlloc( NULL, cbPage *cPage, MEM_RESERVE, PAGE_READWRITE );

    if (m_rgbBit == NULL)
        return ResultFromScode( E_OUTOFMEMORY );

    m_cPageMax = cPage;

    m_cbPage = cbPage;

    for (ib =0; ib < 8; ib++)
        m_rgbBitMask[ib] = (1 << ib);
    return ResultFromScode( S_OK );
}

STDMETHODIMP CBitArray::IsSlotSet ( ULONG islot )

Definition at line 229 of file bitarray.cpp.

{
    if (islot >= m_cslotCurrent || (m_rgbBit[islot / 8] & m_rgbBitMask[islot % 8]) == 0x00)
        return ResultFromScode( S_FALSE );  // not set
    else
        return ResultFromScode( S_OK ); // is set
}

STDMETHODIMP CBitArray::ResetSlots | ( | ULONG | islotFirst,
 |  | ULONG | islotLast
 | ) |  |

Definition at line 161 of file bitarray.cpp.

{
    ULONG ibFirst, ibLast, islot;

    if (islotFirst < m_cslotCurrent)
        {
        if (islotLast >=    m_cslotCurrent)
            islotLast = m_cslotCurrent - 1;

        if ((islotLast - islotFirst) > 2*8)
            {
            ibFirst = islotFirst / 8;
            ibLast  = islotLast / 8;
            for (islot = islotFirst; (islot / 8) == ibFirst; islot++)
                m_rgbBit[islot / 8] &= ~m_rgbBitMask[islot % 8];
            memset( &m_rgbBit[ibFirst + 1], 0x00, (ULONG)(ibLast - ibFirst - 1) );
            for (islot = islotLast; (islot / 8) == ibLast; islot--)
                m_rgbBit[islot / 8] &= ~m_rgbBitMask[islot % 8];
            }
        else
            {
            for (islot = islotFirst; islot <= islotLast; islot++)
                m_rgbBit[islot / 8] &= ~m_rgbBitMask[islot % 8];
            }
        }

    return ResultFromScode( S_OK );
}

STDMETHODIMP CBitArray::SetSlots | ( | ULONG | islotFirst,
 |  | ULONG | islotLast
 | ) |  |

Definition at line 92 of file bitarray.cpp.

{
    ULONG islot;

    if (islotLast >=    m_cslotCurrent)
        {
        ULONG cPageAdd;

        cPageAdd = ((islotLast - m_cslotCurrent + 1) / 8 + 1) / m_cbPage + 1;

        if ((cPageAdd + m_cPageCurrent) > m_cPageMax
            || VirtualAlloc( m_rgbBit + m_cPageCurrent*m_cbPage, cPageAdd *m_cbPage, MEM_COMMIT, PAGE_READWRITE ) == NULL)
            return ResultFromScode( E_OUTOFMEMORY );

        memset( m_rgbBit + m_cPageCurrent*m_cbPage, 0x00, cPageAdd *m_cbPage );
        m_cPageCurrent += cPageAdd;
        m_cslotCurrent += cPageAdd *m_cbPage *8;
        }

    // Only do this top section
    // if we have at least 2 byte's worth of bits to set.
    // Although no real speedup until we have 3 byte's worth.
    // Note really ought to be ((ilast-ifirst+1) >= 2*8).
    // (Note could use CHAR_BIT, num bits in a char.)
    // Also optimized end cases, so nothing is done
    // if the start or end is byte aligned.
    // Need this copied into ResetSlots.

    //if((islotLast -islotFirst) > 2*sizeof(BYTE))
    if (islotLast - islotFirst > 2 * 8)
        {
        ULONG ibFirst, ibLast;
        int iFixFirst, iFixLast;

        ibFirst = islotFirst / 8;
        ibLast  = islotLast / 8;
        iFixFirst = (islotFirst % 8 != 0);  // set to 1 if first byte not totally set
        iFixLast  = (islotLast % 8 != 7);   // set to 1 if last  byte not totally set

        if (iFixFirst)
            for (islot = islotFirst; (islot / 8) == ibFirst; islot++)
                m_rgbBit[islot / 8] |= m_rgbBitMask[islot % 8];

        memset( &m_rgbBit[ibFirst + iFixFirst], 0xff, ibLast - ibFirst + 1 - iFixFirst - iFixLast );

        if (iFixLast)
            for (islot = islotLast; (islot / 8) == ibLast; islot--)
                m_rgbBit[islot / 8] |= m_rgbBitMask[islot % 8];
        }
    else
        {
        for (islot = islotFirst; islot <= islotLast; islot++)
            m_rgbBit[islot / 8] |= m_rgbBitMask[islot % 8];
        }

    return ResultFromScode( S_OK );
}

Member Data Documentation

ULONG CBitArray::m_cbPage [private]

Definition at line 34 of file bitarray.h.

ULONG CBitArray::m_cPageCurrent [private]

Definition at line 32 of file bitarray.h.

ULONG CBitArray::m_cPageMax [private]

Definition at line 30 of file bitarray.h.

ULONG CBitArray::m_cslotCurrent [private]

Definition at line 28 of file bitarray.h.

BYTE* CBitArray::m_rgbBit [private]

Definition at line 38 of file bitarray.h.

BYTE CBitArray::m_rgbBitMask[8] [private]

Definition at line 36 of file bitarray.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/sampprov/bitarray.h
  • Dataaccess/oledb/sampprov/bitarray.cpp
Generated on Wed Nov 13 2024 16:55:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CBitmapWnd Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes

CBitmapWnd Class Reference

#include "BitmapWnd.h"

Inherits com::ms::com::IUnknown.

List of all members.

Public Member Functions

CBitmapWnd (IStream *pStream)
CBitmapWnd (PCWSTR pszFileName)
STDMETHOD() | QueryInterface (REFIID iid, LPVOID *ppvObj)
STDMETHOD_ (ULONG, AddRef)()
STDMETHOD_ (ULONG, Release)()

Static Public Member Functions

static ATOM | Register ()

Private Member Functions

LRESULT | OnPaint (HWND hWnd)

Static Private Member Functions

static LRESULT CALLBACK | WindowProc (HWND, UINT, WPARAM, LPARAM)

Private Attributes

LONG | m_cRef
HGLOBAL m_hBitmap
Gdiplus::Image | m_Image

Detailed Description

Definition at line 33 of file BitmapWnd.h.

Constructor & Destructor Documentation

CBitmapWnd::CBitmapWnd ( IStream * pStream )

Definition at line 18 of file BitmapWnd.cpp.

                                       : m_Image(pStream)
{
    m_cRef = 0;
}

CBitmapWnd::CBitmapWnd ( PCWSTR pszFileName )

Definition at line 28 of file BitmapWnd.cpp.

                                         : m_Image(pszFileName)
{
    m_cRef = 0;
}

Member Function Documentation

LRESULT CBitmapWnd::OnPaint ( HWND hWnd ) [private]

Definition at line 171 of file BitmapWnd.cpp.

{
    // Get the destination DC

    PAINTSTRUCT ps;

    HDC hDC = BeginPaint(hWnd, &ps);

    if (hDC != NULL)
    {
        Gdiplus::Graphics graphics(hDC);

        // Get the size of the window

        RECT r;

        GetClientRect(hWnd, &r);

        UINT nWindowWidth = r.right;
        UINT nWindowHeight = r.bottom;

        // Get the size of the image

        UINT nBitmapWidth = m_Image.GetWidth();
        UINT nBitmapHeight = m_Image.GetHeight();

        if (nBitmapWidth != 0 && nBitmapHeight != 0)
        {
            // Calculate the coordinates and the size of the image

            Gdiplus::Rect rDest;

            if (nBitmapWidth <= nWindowWidth && nBitmapHeight <= nWindowHeight)
            {
                // If the image is smaller than the window, center the image

                rDest.X      = (nWindowWidth - nBitmapWidth) / 2;
                rDest.Y      = (nWindowHeight - nBitmapHeight) / 2;
                rDest.Width  = nBitmapWidth;
                rDest.Height = nBitmapHeight;
            }
            else
            {
                // If the image is larger than the window, resize and center
                // the image while keeping the aspect ratio

                UINT nStretchedWidth  = nWindowWidth;
                UINT nStretchedHeight = MulDiv(nBitmapHeight, nWindowWidth, nBitmapWidth);

          if (nStretchedHeight > nWindowHeight)
          {
            nStretchedWidth  = MulDiv(nBitmapWidth, nWindowHeight, nBitmapHeight);
            nStretchedHeight = nWindowHeight;
          }

                rDest.X      = (nWindowWidth - nStretchedWidth) / 2;
                rDest.Y      = (nWindowHeight - nStretchedHeight) / 2;
                rDest.Width  = nStretchedWidth;
                rDest.Height = nStretchedHeight;
            }

            // Paint the image with a white background

            graphics.DrawImage(&m_Image, rDest);

            graphics.ExcludeClip(rDest);
        }

        graphics.Clear(Gdiplus::Color::White);

        EndPaint(hWnd, &ps);
    }

    return 0;
}

STDMETHODIMP CBitmapWnd::QueryInterface | ( | REFIID | iid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 38 of file BitmapWnd.cpp.

{
    if (ppvObj == NULL)
    {
      return E_POINTER;
    }

    if (iid == IID_IUnknown)
    {
      *ppvObj = (IUnknown *) this;
    }
    else
    {
        *ppvObj = NULL;
        return E_NOINTERFACE;
    }

  AddRef();
    return S_OK;
}

ATOM CBitmapWnd::Register ( ) [static]

Definition at line 91 of file BitmapWnd.cpp.

{
    WNDCLASSEX wcex = { 0 };

    wcex.cbSize         = sizeof(wcex);
    wcex.style          = CS_HREDRAW | CS_VREDRAW;
    wcex.lpfnWndProc    = WindowProc;
    wcex.hInstance      = g_hInstance;
    wcex.hIcon      = LoadIcon(NULL, IDI_APPLICATION);
    wcex.hCursor    = LoadCursor(NULL, IDC_ARROW);
    wcex.lpszClassName  = _T("BitmapWindow");

    return RegisterClassEx(&wcex);
}

CBitmapWnd::STDMETHOD_ | ( | ULONG | ,
 |  | AddRef |
 | ) |  |
CBitmapWnd::STDMETHOD_ | ( | ULONG | ,
 |  | Release |
 | ) |  |
LRESULT CALLBACK CBitmapWnd::WindowProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static, private]

Definition at line 113 of file BitmapWnd.cpp.

{
    switch (uMsg)
    {
        case WM_CREATE:
        {
            LPCREATESTRUCT pcs = (LPCREATESTRUCT) lParam;

            LPMDICREATESTRUCT pmdics = (LPMDICREATESTRUCT) pcs->lpCreateParams;

            CBitmapWnd *that = (CBitmapWnd *) pmdics->lParam;

            that->AddRef();

            SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR) that);

            break;
        }

        case WM_DESTROY:
        {
            CBitmapWnd *that = (CBitmapWnd *) GetWindowLongPtr(hWnd, GWLP_USERDATA);

            SetWindowLongPtr(hWnd, GWLP_USERDATA, NULL);

            that->Release();

            break;
        }

        case WM_PAINT:
        {
            CBitmapWnd *that = (CBitmapWnd *) GetWindowLongPtr(hWnd, GWLP_USERDATA);

            that->OnPaint(hWnd);

            break;
        }
    }

    return DefMDIChildProc(
        hWnd,
        uMsg,
        wParam,
        lParam
    );
}

Member Data Documentation

LONG CBitmapWnd::m_cRef [private]

Definition at line 55 of file BitmapWnd.h.

HGLOBAL CBitmapWnd::m_hBitmap [private]

Definition at line 56 of file BitmapWnd.h.

Gdiplus::Image CBitmapWnd::m_Image [private]

Definition at line 57 of file BitmapWnd.h.

The documentation for this class was generated from the following files:
  • Multimedia/wia/GetImage/BitmapWnd.h
  • Multimedia/wia/GetImage/BitmapWnd.cpp
Generated on Wed Nov 13 2024 16:55:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CBlackPen Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CBlackPen Class Reference

#include "Font.Hxx"

List of all members.

Public Member Functions

CBlackPen (CCanvas &canvas, int iStyle, int iWidth)
~CBlackPen ()

Protected Attributes

CCanvas & _canvas
HPEN | _hPen
HPEN | _hPenOld

Detailed Description

Definition at line 45 of file Font.Hxx.

Constructor & Destructor Documentation

CBlackPen::CBlackPen | ( | CCanvas & | canvas,
 |  | int | iStyle,
 |  | int | iWidth |
 | ) |  |  | [inline]

Definition at line 48 of file Font.Hxx.

                                                           :
            _canvas(canvas)
        {
            _hPen = CreatePen(iStyle,iWidth,RGB(0,0,0));
            _hPenOld = SelectPen(_canvas, _hPen);
        };

CBlackPen::~CBlackPen ( ) [inline]

Definition at line 55 of file Font.Hxx.

        {
            // release pen
            _hPen = SelectPen(_canvas, _hPenOld);
            DeleteObject(_hPen);
        }

Member Data Documentation

CCanvas& CBlackPen::_canvas [protected]

Definition at line 64 of file Font.Hxx.

HPEN CBlackPen::_hPen [protected]

Definition at line 62 of file Font.Hxx.

HPEN CBlackPen::_hPenOld [protected]

Definition at line 63 of file Font.Hxx.

The documentation for this class was generated from the following file:
  • Multimedia/Gdi/Fonts/GridFont/Font.Hxx
Generated on Wed Nov 13 2024 16:55:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CBlockFormat Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes | Protected Member Functions

CBlockFormat Class Reference

#include "Grid.Hxx"

Inherited by CBoxFormat, and CFrameFormat.

List of all members.

Public Attributes

CFont _fontChar
CFont _fontCode
UINT _fuFormat
SIZE _size

Protected Member Functions

CBlockFormat ()

Detailed Description

Definition at line 140 of file Grid.Hxx.

Constructor & Destructor Documentation

CBlockFormat::CBlockFormat ( ) [protected]

Definition at line 489 of file Grid.Cxx.

                           :
    _fontCode    (TEXT("Arial Narrow"), -6),
#ifdef UNICODE
    _fontChar    (TEXT("Lucida Sans Unicode"), -16, TRUE)
#else
    _fontChar    (TEXT("Lucida Sans"), -16, TRUE)
#endif
{
};

Member Data Documentation

CFont CBlockFormat::_fontChar

Definition at line 144 of file Grid.Hxx.

CFont CBlockFormat::_fontCode

Definition at line 145 of file Grid.Hxx.

UINT CBlockFormat::_fuFormat

Reimplemented in CPageFormat.

Definition at line 146 of file Grid.Hxx.

SIZE CBlockFormat::_size

Definition at line 143 of file Grid.Hxx.

The documentation for this class was generated from the following files:
  • Multimedia/Gdi/Fonts/GridFont/Grid.Hxx
  • Multimedia/Gdi/Fonts/GridFont/Grid.Cxx
Generated on Wed Nov 13 2024 16:55:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CBlockFrame Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Protected Attributes

CBlockFrame Class Reference

#include "Grid.Hxx"

Inherits CCharBlock.

List of all members.

Public Member Functions

CBlockFrame (UINT cCol, UINT cRow, POINT pt, UINT iBlockOffset, TCHAR *szHeader, const CFrameFormat &ff)
~CBlockFrame ()
void | Paint (CCanvas &canvas, RECT rc, POINT pt)

Protected Member Functions

void | Draw (CCanvas &canvas, POINT pt)

Protected Attributes

UINT _cCol
CCodeGrid _Cols
UINT _cRow
HFONT | _fontHeader
CCodeGrid * _pRows
SIZE | _size
TCHAR * | _szHeader

Detailed Description

Definition at line 198 of file Grid.Hxx.

Constructor & Destructor Documentation

CBlockFrame::CBlockFrame | ( | UINT | cCol,
 |  | UINT | cRow,
 |  | POINT | pt,
 |  | UINT | iBlockOffset,
 |  | TCHAR * | szHeader,
 |  | const CFrameFormat & | ff
 | ) |  |

Definition at line 339 of file Grid.Cxx.

                                                                         :
     CCharBlock(cCol, cRow, iBlockOffset, ff ),
     _size(ff._size),
     _Cols(cCol,    1, ff._size, iBlockOffset/16),
     _cRow(cRow),
     _cCol(cCol)
{

     // COLUMN label above first row
     _Cols.SetFormat(HEXADECIMAL,3);
     _Cols.SetFont(ff._fontLabel);

     // if not first block on page, suppress row labels
     if( iBlockOffset % 0x100 )
     {
        _pRows = NULL;
     }
     else
     {
        // ROW label to left of first column
        _pRows = new CCodeGrid(1, cRow,  ff._size);
        _pRows->SetFont(ff._fontLabel);
     }

     // BLOCK HEADER
     _szHeader = new TCHAR[lstrlen(szHeader)+sizeof(TCHAR)];
     lstrcpyn(_szHeader, szHeader, sizeof(_szHeader)/sizeof(TCHAR));
     _fontHeader = ff._fontHeader;

}

CBlockFrame::~CBlockFrame ( )

Definition at line 372 of file Grid.Cxx.

{
    delete _pRows;
    delete _szHeader;
}

Member Function Documentation

void CBlockFrame::Draw | ( | CCanvas & | canvas,
 |  | POINT | pt |
 | ) |  |  | [protected]

Definition at line 396 of file Grid.Cxx.

{
    UINT dy = 3*_size.cy/2;     // height of short uprights
    UINT cx = _cCol*_size.cx;
    UINT cy = _cRow*_size.cy;
  RECT rc;

    // set up pen
    CBlackPen pen(canvas, PS_SOLID, 40);    // Solid Black 40/20 points

    //Draw block divider lines

    canvas.Line(pt.x,    pt.y-dy, pt.x,    pt.y+cy);  // left edge
    canvas.Line(pt.x+cx, pt.y-dy, pt.x+cx, pt.y+cy);  // right edge
    canvas.Line(pt.x,    pt.y,    pt.x+cx, pt.y);     // top edge
    canvas.Line(pt.x,    pt.y+cy, pt.x+cx, pt.y+cy);  // bottom

    CFontSelect fs(canvas, _fontHeader);

    SetTextAlign(canvas, TA_BASELINE|TA_LEFT);
    rc.left = pt.x + _size.cx/12;
    rc.top = pt.y - 6*_size.cy/5;
    rc.right = pt.x + cx - _size.cx/12;
    rc.bottom = pt.y;
    canvas.RCText(&rc,
                _szHeader,
                lstrlen(_szHeader));
}

void CBlockFrame::Paint | ( | CCanvas & | canvas,
 |  | RECT | rc,
 |  | POINT | pt
 | ) |  |

Reimplemented from CCharBlock.

Definition at line 379 of file Grid.Cxx.

{
    Draw(canvas, pt);
    {
        POINT ptCols = {pt.x, pt.y-_size.cy};
        _Cols.Paint(canvas, rc, ptCols);
    }
    CCharBlock::Paint(canvas, rc, pt);

    // these two are optional. Test first, then draw
    if(_pRows )
    {
        POINT ptRows = {pt.x-_size.cx, pt.y};
        _pRows->Paint(canvas, rc, ptRows);
    }
}

Member Data Documentation

UINT CBlockFrame::_cCol [protected]

Definition at line 210 of file Grid.Hxx.

CCodeGrid CBlockFrame::_Cols [protected]

Definition at line 213 of file Grid.Hxx.

UINT CBlockFrame::_cRow [protected]

Definition at line 211 of file Grid.Hxx.

HFONT CBlockFrame::_fontHeader [protected]

Definition at line 212 of file Grid.Hxx.

CCodeGrid* CBlockFrame::_pRows [protected]

Definition at line 216 of file Grid.Hxx.

SIZE CBlockFrame::_size [protected]

Definition at line 209 of file Grid.Hxx.

TCHAR* CBlockFrame::_szHeader [protected]

Definition at line 208 of file Grid.Hxx.

The documentation for this class was generated from the following files:
  • Multimedia/Gdi/Fonts/GridFont/Grid.Hxx
  • Multimedia/Gdi/Fonts/GridFont/Grid.Cxx
Generated on Wed Nov 13 2024 16:55:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CBox Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CBox Class Reference

#include "Box.Hxx"

List of all members.

Public Member Functions

CBox (CBoxFormat &bxf, UINT iChar, HFONT hfont)
SIZE & | GetSize ()
UINT | Hittest (CCanvas &canvas, POINT pt)
void | Paint (CCanvas &canvas, POINT pt, RECT rc)
void | SetFormat (UINT fuFormat)

Protected Attributes

CTextField _Alias
CCharBlock _Block
CBoxFormat & _bxf
CFont _fontBlock
UINT _fuFormat
UINT _iChar
SIZE | _sizeBox

Detailed Description

Definition at line 32 of file Box.Hxx.

Constructor & Destructor Documentation

CBox::CBox | ( | CBoxFormat & | bxf,
 |  | UINT | iChar,
 |  | HFONT | hfont
 | ) |  |

Definition at line 43 of file Box.Cxx.

                                                     :
        _fontBlock( hfont ),
        _Block(1, 1, iChar, bxf ),
        _bxf(bxf),
#ifdef CHARBITS
        _Alias(TEXT("Character Type Bits:")),

#else
        _Alias(TEXT("Character Decomposition: ")),
#endif
        _fuFormat(HEXADECIMAL)
{

    _fontBlock.Update( -40, TRUE);
    _Block.SetFont(_fontBlock);

    _sizeBox.cx = bxf._size.cx+100; // shadow 100/20 poitns
    _sizeBox.cy = bxf._size.cy+100;

#ifdef UNICODE
    _sizeBox.cx += INCH4;
    _sizeBox.cy += INCH4;
#endif

    _Alias.SetFont(bxf._fontAlias);
    _iChar = iChar;
}

Member Function Documentation

SIZE& CBox::GetSize ( ) [inline]

Definition at line 40 of file Box.Hxx.

{ return _sizeBox; };

UINT CBox::Hittest | ( | CCanvas & | canvas,
 |  | POINT | pt
 | ) |  |

Definition at line 167 of file Box.Cxx.

{
     return 0x00C5;
}

void CBox::Paint | ( | CCanvas & | canvas,
 |  | POINT | pt,
 |  | RECT | rc
 | ) |  |

Definition at line 73 of file Box.Cxx.

{
    int x = pt.x;
    int y = pt.y;

#ifdef UNICODE
    // adjust to length of header

    SIZE size;
    _Alias.GetExtent(canvas, &size);
    _sizeBox.cx += size.cx;
#endif
    // make rc large enough
    rc.left = pt.x;
    rc.top = pt.y;
    rc.right = pt.x+_sizeBox.cx-100;
    rc.bottom = pt.y+_sizeBox.cy-100;

    OffsetRect( &rc, 100, 100 );
    FillRect(canvas, &rc, GetStockBrush(GRAY_BRUSH));
    OffsetRect( &rc, -100, -100 );
    FillRect(canvas, &rc, GetStockBrush(WHITE_BRUSH));

#ifdef UNICODE
    CBlackPen pen(canvas, PS_SOLID, 20);
    Rectangle(canvas, rc.left, rc.top, rc.right, rc.bottom);

    pt.x += INCH8;
    pt.y += INCH8;
#endif

    _Block.SetFormat(_fuFormat);
    _Block.Paint(canvas, rc, pt);

#ifdef UNICODE
    _Alias.Paint(canvas, x+=(INCH1-INCH10), y+= INCH4);
    _Alias.GetExtent(canvas, &size);

    pt.x = x;
    pt.y = y+INCH10;

    USHORT uTemp[2]={_iChar, 0};

    SetTextColor(canvas, RGB(0,128,0));
#ifdef CHARBITS

    USHORT uType[2];

    for( int i = 0; i < 3; i++ )
    {
        pt.y += size.cy;

        GetStringTypeW(1<<i, uTemp, 2, uType );
        CCodeGrid Ctype(1,1, size, uType[0]);
        Ctype.SetFont(_bxf._fontCtype);
        Ctype.SetFormat(HEXADECIMAL, 4);
        Ctype.Paint(canvas, rc, pt);
    }
#else // ifdef DECOMP
    int cch =FoldString(MAP_COMPOSITE, (LPCTSTR) &_iChar, 1, NULL, 0);

    LPTSTR pch = new TCHAR[cch];
    FoldString(MAP_COMPOSITE, (LPCTSTR) &_iChar, 1, pch, cch);
    SIZE sizedecomp;
    sizedecomp.cx = _bxf._size.cx/2;
    sizedecomp.cy = _bxf._size.cy/2;
    // pt.y += sizedecomp.cy;

    CFont fontDecomp(_fontBlock);
    fontDecomp.Update(-20, TRUE);

    for(int i=0; i < cch; i++ )
    {
        CCharGrid Decomp(1,1,sizedecomp, pch[i] );
        Decomp.SetCharTable();        // exclude char images not in font
        Decomp.SetFont(fontDecomp);
        Decomp.Paint(canvas, rc, pt);

        CCodeGrid Code(1,1,sizedecomp, pch[i] );
                          // but don't exclude their code nums
        Code.SetFont(_bxf._fontCtype);
        Code.SetTextOrg(sizedecomp.cx/2, 9*sizedecomp.cy/10);
        Code.SetFormat(HEXADECIMAL, 4);
        Code.Paint(canvas, rc, pt);

        pt.x += sizedecomp.cx;
    }
    delete pch;
#endif
    SetTextColor(canvas, RGB(0,0,0));
#endif
}

void CBox::SetFormat ( UINT fuFormat ) [inline]

Definition at line 41 of file Box.Hxx.

{_fuFormat = fuFormat; return; };

Member Data Documentation

CTextField CBox::_Alias [protected]

Definition at line 47 of file Box.Hxx.

CCharBlock CBox::_Block [protected]

Definition at line 41 of file Box.Hxx.

CBoxFormat& CBox::_bxf [protected]

Definition at line 49 of file Box.Hxx.

CFont CBox::_fontBlock [protected]

Definition at line 46 of file Box.Hxx.

UINT CBox::_fuFormat [protected]

Definition at line 50 of file Box.Hxx.

UINT CBox::_iChar [protected]

Definition at line 48 of file Box.Hxx.

SIZE CBox::_sizeBox [protected]

Definition at line 44 of file Box.Hxx.

The documentation for this class was generated from the following files:
  • Multimedia/Gdi/Fonts/GridFont/Box.Hxx
  • Multimedia/Gdi/Fonts/GridFont/Box.Cxx
Generated on Wed Nov 13 2024 16:55:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CBoxFormat Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CBoxFormat Class Reference

#include "Box.Hxx"

Inherits CBlockFormat.

List of all members.

Public Member Functions

CBoxFormat (SIZE sizeChar)

Public Attributes

CFont _fontAlias
CFont _fontCtype

Detailed Description

Definition at line 22 of file Box.Hxx.

Constructor & Destructor Documentation

CBoxFormat::CBoxFormat ( SIZE sizeChar )

Definition at line 30 of file Box.Cxx.

                                    :
        _fontAlias(TEXT("Arial Narrow"), -10, FALSE),
#ifdef CHARBITS
        _fontCtype(TEXT("Arial"), 12, TRUE, FALSE, TRUE)
#else
        _fontCtype(TEXT("Arial"), 7, TRUE, FALSE, FALSE)
#endif

{
    _size = sizeChar;
}

Member Data Documentation

CFont CBoxFormat::_fontAlias

Definition at line 25 of file Box.Hxx.

CFont CBoxFormat::_fontCtype

Definition at line 26 of file Box.Hxx.

The documentation for this class was generated from the following files:
  • Multimedia/Gdi/Fonts/GridFont/Box.Hxx
  • Multimedia/Gdi/Fonts/GridFont/Box.Cxx
Generated on Wed Nov 13 2024 16:55:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CBrowserHost Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions

CBrowserHost Class Reference

#include "BrowserHost.h"

List of all members.

Public Member Functions

CBrowserHost ()
CBrowserHost ()
CBrowserHost ()
CBrowserHost ()
LRESULT | OnAddressBox (UINT, WPARAM, LPARAM, BOOL &)
LRESULT | OnBox1 (UINT, WPARAM, LPARAM, BOOL &)
LRESULT | OnBox2 (UINT, WPARAM, LPARAM, BOOL &)
LRESULT | OnBox3 (UINT, WPARAM, LPARAM, BOOL &)
LRESULT | OnBox4 (UINT, WPARAM, LPARAM, BOOL &)
LRESULT | OnButton1 (WORD, WORD, HWND, BOOL &)
LRESULT | OnButton2 (WORD, WORD, HWND, BOOL &)
LRESULT | OnButton3 (WORD, WORD, HWND, BOOL &)
LRESULT | OnButton4 (WORD, WORD, HWND, BOOL &)
LRESULT | OnButton5 (WORD, WORD, HWND, BOOL &)
LRESULT | OnButton6 (WORD, WORD, HWND, BOOL &)
LRESULT | OnButton7 (WORD, WORD, HWND, BOOL &)
LRESULT | OnCheckBox (WORD, WORD, HWND, BOOL &)
LRESULT | OnCreate (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
LRESULT | OnDestroy (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
LRESULT | OnKeydown (UINT, WPARAM wParam, LPARAM lParam, BOOL &)
LRESULT | OnSize (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
ALT_MSG_MAP(1) public STDMETHOD() | Run ()
ALT_MSG_MAP(1) public STDMETHOD() | Run ()
STDMETHOD() | Run ()
ALT_MSG_MAP(1) public STDMETHOD() | Run ()
STDMETHOD() | Stop ()

Public Attributes

BOOL m_bIsChecked
DWORD m_dwCookie
DWORD m_dwCookie2
LONG | m_lLeftBandWidth
ALT_MSG_MAP(1) ALT_MSG_MAP(2)
ALT_MSG_MAP(3) ALT_MSG_MAP(4)
ALT_MSG_MAP(5) private LONG 		m_lTopBandHeight
CComQIPtr< IHTMLDocument2,&IID_IHTMLDocument2 > | m_spDoc
CComQIPtr< IOleInPlaceObject,&IID_IOleInPlaceObject > | m_spInPlaceObject
CComQIPtr< IOleCommandTarget,&IID_IOleCommandTarget > | m_spOleCmdTarg
CComQIPtr< IWebBrowser2,&IID_IWebBrowser2 > | m_spWebBrowser
CContainedWindow | m_wndAddressBox
CContainedWindow | m_wndBox1
CContainedWindow | m_wndBox2
CContainedWindow | m_wndBox3
CContainedWindow | m_wndBox4
CContainedWindow | m_wndButton1
CContainedWindow | m_wndButton2
CContainedWindow | m_wndButton3
CContainedWindow | m_wndButton4
CContainedWindow | m_wndButton5
CContainedWindow | m_wndButton6
CContainedWindow | m_wndButton7
CContainedWindow | m_wndCheckBox
CContainedWindow | m_wndLeftBand
CWindow m_wndStatusBar
CContainedWindow | m_wndTopBand

Protected Member Functions

LRESULT | OnButton1 (WORD, WORD, HWND, BOOL &)
LRESULT | OnButton1 (WORD, WORD, HWND, BOOL &)
LRESULT | OnButton1 (WORD, WORD, HWND, BOOL &)
LRESULT | OnButton10 (WORD, WORD, HWND, BOOL &)
LRESULT | OnButton2 (WORD, WORD, HWND, BOOL &)
LRESULT | OnButton2 (WORD, WORD, HWND, BOOL &)
LRESULT | OnButton2 (WORD, WORD, HWND, BOOL &)
LRESULT | OnButton3 (WORD, WORD, HWND, BOOL &)
LRESULT | OnButton3 (WORD, WORD, HWND, BOOL &)
LRESULT | OnButton3 (WORD, WORD, HWND, BOOL &)
LRESULT | OnButton4 (WORD, WORD, HWND, BOOL &)
LRESULT | OnButton4 (WORD, WORD, HWND, BOOL &)
LRESULT | OnButton5 (WORD, WORD, HWND, BOOL &)
LRESULT | OnButton5 (WORD, WORD, HWND, BOOL &)
LRESULT | OnButton6 (WORD, WORD, HWND, BOOL &)
LRESULT | OnButton7 (WORD, WORD, HWND, BOOL &)
LRESULT | OnButton8 (WORD, WORD, HWND, BOOL &)
LRESULT | OnButton9 (WORD, WORD, HWND, BOOL &)
LRESULT | OnCreate (UINT, WPARAM, LPARAM, BOOL &)
LRESULT | OnCreate (UINT, WPARAM, LPARAM, BOOL &)
LRESULT | OnCreate (UINT, WPARAM, LPARAM, BOOL &)
LRESULT | OnKeydown (UINT, WPARAM wParam, LPARAM lParam, BOOL &)
LRESULT | OnKeydown (UINT, WPARAM wParam, LPARAM lParam, BOOL &)
LRESULT | OnKeydown (UINT, WPARAM wParam, LPARAM lParam, BOOL &)
LRESULT | OnNCDestroy (UINT, WPARAM, LPARAM, BOOL &)
LRESULT | OnNCDestroy (UINT, WPARAM, LPARAM, BOOL &)
LRESULT | OnNCDestroy (UINT, WPARAM, LPARAM, BOOL &)
LRESULT | OnSize (UINT, WPARAM, LPARAM, BOOL &)
LRESULT | OnSize (UINT, WPARAM, LPARAM, BOOL &)
LRESULT | OnSize (UINT, WPARAM, LPARAM, BOOL &)
STDMETHOD() | Stop ()
STDMETHOD() | Stop ()
STDMETHOD() | Stop ()

Protected Attributes

BOOL m_bAtlBrowserHelp
BOOL m_bButton10Down
BOOL m_bButton2Down
BOOL m_bButton3Down
BOOL m_bButton4Down
BOOL m_bButton5Down
BOOL m_bButton6Down
BOOL m_bButton7Down
BOOL m_bButton8Down
BOOL m_bButton9Down
BOOL m_bEnableCtxMenus
BOOL m_bInPlaceActive
DWORD m_dwDLControl
DWORD m_dwDocHostUIDblClk
DWORD m_dwDocHostUIFlags
LONG | m_lCSSlevel
LONG | m_lGridCookie
LONG | m_lSnapIncrement
CComQIPtr< IGrid,&IID_IGrid > | m_spGrid
CComQIPtr< ISnap,&IID_ISnap > | m_spSnap
CContainedWindow | m_wndIncrementCombo
CWindow m_wndToolBar
CContainedWindow | m_wndUrlCombo

Private Member Functions

STDMETHOD() | CanInPlaceActivate ()
STDMETHOD() | CanInPlaceActivate ()
STDMETHOD() | CanInPlaceActivate ()
STDMETHOD() | CanInPlaceActivate ()
STDMETHOD() | ContextSensitiveHelp (BOOL fEnterMode)
STDMETHOD() | ContextSensitiveHelp (BOOL fEnterMode)
STDMETHOD() | ContextSensitiveHelp (BOOL fEnterMode)
STDMETHOD() | ContextSensitiveHelp (BOOL fEnterMode)
void | CreateToolbar ()
void | CreateToolbar ()
void | CreateToolbar ()
STDMETHOD() | DeactivateAndUndo (void)
STDMETHOD() | DeactivateAndUndo (void)
STDMETHOD() | DeactivateAndUndo (void)
STDMETHOD() | DeactivateAndUndo (void)
STDMETHOD() | DiscardUndoState ()
STDMETHOD() | DiscardUndoState ()
STDMETHOD() | DiscardUndoState ()
STDMETHOD() | DiscardUndoState ()
STDMETHOD() | GetContainer (IOleContainer **ppContainer)
STDMETHOD() | GetContainer (IOleContainer **ppContainer)
STDMETHOD() | GetContainer (IOleContainer **ppContainer)
STDMETHOD() | GetContainer (IOleContainer **ppContainer)
STDMETHOD() | GetMoniker (DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk)
STDMETHOD() | GetMoniker (DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk)
STDMETHOD() | GetMoniker (DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk)
STDMETHOD() | GetMoniker (DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk)
STDMETHOD() | GetWindow (HWND *phwnd)
STDMETHOD() | GetWindow (HWND *phwnd)
STDMETHOD() | GetWindow (HWND *phwnd)
STDMETHOD() | GetWindow (HWND *phwnd)
STDMETHOD() | GetWindowContext (IOleInPlaceFrame **ppFrame, IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect, LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
STDMETHOD() | GetWindowContext (IOleInPlaceFrame **ppFrame, IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect, LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
STDMETHOD() | GetWindowContext (IOleInPlaceFrame **ppFrame, IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect, LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
STDMETHOD() | GetWindowContext (IOleInPlaceFrame **ppFrame, IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect, LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
STDMETHOD() | Invoke (DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pdispparams, VARIANT *pvarResult, EXCEPINFO *pexcepinfo, UINT *puArgErr)
STDMETHOD() | Invoke (DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pdispparams, VARIANT *pvarResult, EXCEPINFO *pexcepinfo, UINT *puArgErr)
STDMETHOD() | Invoke (DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pdispparams, VARIANT *pvarResult, EXCEPINFO *pexcepinfo, UINT *puArgErr)
STDMETHOD() | Invoke (DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pdispparams, VARIANT *pvarResult, EXCEPINFO *pexcepinfo, UINT *puArgErr)
STDMETHOD() | OnInPlaceActivate ()
STDMETHOD() | OnInPlaceActivate ()
STDMETHOD() | OnInPlaceActivate ()
STDMETHOD() | OnInPlaceActivate ()
STDMETHOD() | OnInPlaceDeactivate ()
STDMETHOD() | OnInPlaceDeactivate ()
STDMETHOD() | OnInPlaceDeactivate ()
STDMETHOD() | OnInPlaceDeactivate ()
STDMETHOD() | OnPosRectChange (LPCRECT lprcPosRect)
STDMETHOD() | OnPosRectChange (LPCRECT lprcPosRect)
STDMETHOD() | OnPosRectChange (LPCRECT lprcPosRect)
STDMETHOD() | OnPosRectChange (LPCRECT lprcPosRect)
STDMETHOD() | OnShowWindow (BOOL fShow)
STDMETHOD() | OnShowWindow (BOOL fShow)
STDMETHOD() | OnShowWindow (BOOL fShow)
STDMETHOD() | OnShowWindow (BOOL fShow)
STDMETHOD() | OnUIActivate ()
STDMETHOD() | OnUIActivate ()
STDMETHOD() | OnUIActivate ()
STDMETHOD() | OnUIActivate ()
STDMETHOD() | OnUIDeactivate (BOOL fUndoable)
STDMETHOD() | OnUIDeactivate (BOOL fUndoable)
STDMETHOD() | OnUIDeactivate (BOOL fUndoable)
STDMETHOD() | OnUIDeactivate (BOOL fUndoable)
STDMETHOD() | QueryService (REFGUID guidService, REFIID riid, void **ppv)
STDMETHOD() | RequestNewObjectLayout (void)
STDMETHOD() | RequestNewObjectLayout (void)
STDMETHOD() | RequestNewObjectLayout (void)
STDMETHOD() | RequestNewObjectLayout (void)
STDMETHOD() | SaveObject (void)
STDMETHOD() | SaveObject (void)
STDMETHOD() | SaveObject (void)
STDMETHOD() | SaveObject (void)
STDMETHOD() | Scroll (SIZE scrollExtant)
STDMETHOD() | Scroll (SIZE scrollExtant)
STDMETHOD() | Scroll (SIZE scrollExtant)
STDMETHOD() | Scroll (SIZE scrollExtant)
STDMETHOD() | ShowObject (void)
STDMETHOD() | ShowObject (void)
STDMETHOD() | ShowObject (void)
STDMETHOD() | ShowObject (void)

Detailed Description

Definition at line 18 of file BrowserHost.h.

Constructor & Destructor Documentation

CBrowserHost::CBrowserHost ( ) [inline]

Definition at line 28 of file BrowserHost.h.

                 :
    m_bInPlaceActive(FALSE),
    m_lLeftBandWidth(180),
    m_lTopBandHeight(35),
    m_dwCookie(NULL),
    m_dwCookie2(NULL),
    m_bIsChecked(FALSE), // for check box state
    m_wndTopBand(_T("Static"), this, 0),
    m_wndLeftBand(_T("Static"), this, 0),
    m_wndButton1(_T("Button"), this, 0),
    m_wndButton2(_T("Button"), this, 0),
    m_wndButton3(_T("Button"), this, 0),
    m_wndButton4(_T("Button"), this, 0),
    m_wndButton5(_T("Button"), this, 0),
    m_wndButton6(_T("Button"), this, 0),
    m_wndButton7(_T("Button"), this, 0),
    m_wndCheckBox(_T("Button"), this, 0),
    m_wndAddressBox(_T("ComboBox"), this, 1),
    m_wndBox1(_T("ComboBox"), this, 2),
    m_wndBox2(_T("ComboBox"), this, 3),
    m_wndBox3(_T("ComboBox"), this, 4),
    m_wndBox4(_T("ComboBox"), this, 5)
  {
  }

CBrowserHost::CBrowserHost ( )
CBrowserHost::CBrowserHost ( )
CBrowserHost::CBrowserHost ( )

Member Function Documentation

STDMETHOD() CBrowserHost::CanInPlaceActivate ( void ) [inline, private]

Definition at line 185 of file BrowserHost.h.

{return S_OK;}

STDMETHOD() CBrowserHost::CanInPlaceActivate ( void ) [inline, private]

Definition at line 122 of file BrowserHost.h.

{return S_OK;}

STDMETHOD() CBrowserHost::CanInPlaceActivate ( void ) [inline, private]

Definition at line 144 of file BrowserHost.h.

{return S_OK;}

STDMETHOD() CBrowserHost::CanInPlaceActivate ( void ) [inline, private]

Definition at line 134 of file BrowserHost.h.

{return S_OK;}

STDMETHOD() CBrowserHost::ContextSensitiveHelp ( BOOL fEnterMode ) [inline, private]

Definition at line 118 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::ContextSensitiveHelp ( BOOL fEnterMode ) [inline, private]

Definition at line 180 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::ContextSensitiveHelp ( BOOL fEnterMode ) [inline, private]

Definition at line 140 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::ContextSensitiveHelp ( BOOL fEnterMode ) [inline, private]

Definition at line 130 of file BrowserHost.h.

{return E_NOTIMPL;}

void CBrowserHost::CreateToolbar ( ) [private]
void CBrowserHost::CreateToolbar ( ) [private]

Definition at line 599 of file BrowserHost.cpp.

{
  TBBUTTON tbb[] =
  {
    // Add separators to make room for the combo box.
    0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0,
    0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0,
    0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0,
    0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0,
    0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0,
    0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0,
    0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0,
    0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0,
    0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0,
    0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0,
    0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0,
    0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0,
    0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0,
    0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0,
    0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0,
    0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0,
    0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0,
    0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0,
    0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0,
    0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0,
    0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0,
    0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0,
    0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0,
    0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0,
    0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0,
    0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0,
    0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0,
    0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0,
    0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0,
    0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0,
    0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0,
    0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0,
    0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0,
    0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0,
    0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0,
    0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0,
    0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0,
    0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0,
    0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0,
    0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0,

    0, ID_BUTTON1, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, 0,
    0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0,
    1, ID_BUTTON2, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, 0,
    2, ID_BUTTON3, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, 0,
    3, ID_BUTTON4, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, 0,
    4, ID_BUTTON5, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, 0,
    5, ID_BUTTON6, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, 0,
    6, ID_BUTTON7, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, 0,
    7, ID_BUTTON8, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, 0,
    8, ID_BUTTON9, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, 0,
    9, ID_BUTTON10, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, 0,
  };

  HWND toolbar = CreateToolbarEx(m_hWnd,
                   WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | CCS_TOP | TBSTYLE_WRAPABLE | TBSTYLE_TOOLTIPS,
                   ID_TOOLBARWND,
                   4,
                   _Module.GetResourceInstance(),
                   IDR_TOOLBAR1,
                   tbb, 51,
                   0, 0,
                   55, 30,
                   sizeof(TBBUTTON));

  m_wndToolBar.Attach(toolbar);
  _ASSERT(m_wndToolBar);

  // Tell the toolbar to resize itself
  m_wndToolBar.SendMessage(TB_AUTOSIZE, 0, 0L);
  m_wndToolBar.SendMessage(TB_ENABLEBUTTON, ID_BUTTON2, MAKELONG(FALSE, 0));
  m_wndToolBar.SendMessage(TB_ENABLEBUTTON, ID_BUTTON3, MAKELONG(FALSE, 0));
  m_wndToolBar.SendMessage(TB_ENABLEBUTTON, ID_BUTTON4, MAKELONG(FALSE, 0));
  m_wndToolBar.SendMessage(TB_ENABLEBUTTON, ID_BUTTON5, MAKELONG(FALSE, 0));

  m_wndToolBar.SendMessage(TB_ENABLEBUTTON, ID_BUTTON7, MAKELONG(FALSE, 0));
  m_wndToolBar.SendMessage(TB_ENABLEBUTTON, ID_BUTTON8, MAKELONG(FALSE, 0));
  m_wndToolBar.SendMessage(TB_ENABLEBUTTON, ID_BUTTON9, MAKELONG(FALSE, 0));
  m_wndToolBar.SendMessage(TB_ENABLEBUTTON, ID_BUTTON10, MAKELONG(FALSE, 0));

  // Create the combo box on the toolbar
  RECT rc, rc2;

  // Calculate the coordinates for the combo box.
  m_wndToolBar.SendMessage(TB_GETITEMRECT, (WPARAM)0, (LPARAM)(LPRECT)&rc);
  m_wndToolBar.SendMessage(TB_GETITEMRECT, (WPARAM)38, (LPARAM)(LPRECT)&rc2);

  rc.right = rc2.right;
  rc.bottom = 100;
  m_wndUrlCombo.Create(m_wndToolBar, rc, NULL, WS_CHILD|WS_VISIBLE|CBS_DROPDOWN|CBS_AUTOHSCROLL,
                0, ID_URLBOX);
}

void CBrowserHost::CreateToolbar ( ) [private]
STDMETHOD() CBrowserHost::DeactivateAndUndo ( void ) [inline, private]

Definition at line 173 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::DeactivateAndUndo ( void ) [inline, private]

Definition at line 214 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::DeactivateAndUndo ( void ) [inline, private]

Definition at line 151 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::DeactivateAndUndo ( void ) [inline, private]

Definition at line 163 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::DiscardUndoState ( void ) [inline, private]

Definition at line 213 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::DiscardUndoState ( void ) [inline, private]

Definition at line 172 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::DiscardUndoState ( void ) [inline, private]

Definition at line 150 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::DiscardUndoState ( void ) [inline, private]

Definition at line 162 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::GetContainer ( IOleContainer ** ppContainer ) [inline, private]

Definition at line 170 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::GetContainer ( IOleContainer ** ppContainer ) [inline, private]

Definition at line 180 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::GetContainer ( IOleContainer ** ppContainer ) [inline, private]

Definition at line 158 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::GetContainer ( IOleContainer ** ppContainer ) [inline, private]

Definition at line 167 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::GetMoniker | ( | DWORD | dwAssign,
 |  | DWORD | dwWhichMoniker,
 |  | IMoniker ** | ppmk |
 | ) |  |  | [inline, private]

Definition at line 169 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::GetMoniker | ( | DWORD | dwAssign,
 |  | DWORD | dwWhichMoniker,
 |  | IMoniker ** | ppmk |
 | ) |  |  | [inline, private]

Definition at line 179 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::GetMoniker | ( | DWORD | dwAssign,
 |  | DWORD | dwWhichMoniker,
 |  | IMoniker ** | ppmk |
 | ) |  |  | [inline, private]

Definition at line 166 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::GetMoniker | ( | DWORD | dwAssign,
 |  | DWORD | dwWhichMoniker,
 |  | IMoniker ** | ppmk |
 | ) |  |  | [inline, private]

Definition at line 157 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::GetWindow ( HWND * phwnd ) [inline, private]

Definition at line 112 of file BrowserHost.h.

  {
     *phwnd = m_hWnd;
    return S_OK;
  }

STDMETHOD() CBrowserHost::GetWindow ( HWND * phwnd ) [inline, private]

Definition at line 134 of file BrowserHost.h.

  {
     *phwnd = m_hWnd;
    return S_OK;
  }

STDMETHOD() CBrowserHost::GetWindow ( HWND * phwnd ) [inline, private]

Definition at line 124 of file BrowserHost.h.

  {
     *phwnd = m_hWnd;
    return S_OK;
  }

STDMETHOD() CBrowserHost::GetWindow ( HWND * phwnd ) [inline, private]

Definition at line 174 of file BrowserHost.h.

  {
     *phwnd = m_hWnd;
    return S_OK;
  }

STDMETHOD() CBrowserHost::GetWindowContext | ( | IOleInPlaceFrame ** | ppFrame,
 |  | IOleInPlaceUIWindow ** | ppDoc,
 |  | LPRECT | lprcPosRect,
 |  | LPRECT | lprcClipRect,
 |  | LPOLEINPLACEFRAMEINFO | lpFrameInfo |
 | ) |  |  | [inline, private]

Definition at line 130 of file BrowserHost.h.

  {
    GetClientRect(lprcPosRect);
    GetClientRect(lprcClipRect);
    return S_OK;
  }

STDMETHOD() CBrowserHost::GetWindowContext | ( | IOleInPlaceFrame ** | ppFrame,
 |  | IOleInPlaceUIWindow ** | ppDoc,
 |  | LPRECT | lprcPosRect,
 |  | LPRECT | lprcClipRect,
 |  | LPOLEINPLACEFRAMEINFO | lpFrameInfo |
 | ) |  |  | [inline, private]

Definition at line 152 of file BrowserHost.h.

  {
    GetClientRect(lprcPosRect);
    GetClientRect(lprcClipRect);
    return S_OK;
  }

STDMETHOD() CBrowserHost::GetWindowContext | ( | IOleInPlaceFrame ** | ppFrame,
 |  | IOleInPlaceUIWindow ** | ppDoc,
 |  | LPRECT | lprcPosRect,
 |  | LPRECT | lprcClipRect,
 |  | LPOLEINPLACEFRAMEINFO | lpFrameInfo |
 | ) |  |  | [inline, private]

Definition at line 142 of file BrowserHost.h.

  {
    GetClientRect(lprcPosRect);
    GetClientRect(lprcClipRect);
    return S_OK;
  }

STDMETHOD() CBrowserHost::GetWindowContext | ( | IOleInPlaceFrame ** | ppFrame,
 |  | IOleInPlaceUIWindow ** | ppDoc,
 |  | LPRECT | lprcPosRect,
 |  | LPRECT | lprcClipRect,
 |  | LPOLEINPLACEFRAMEINFO | lpFrameInfo |
 | ) |  |  | [inline, private]

Definition at line 193 of file BrowserHost.h.

  {
    GetClientRect(lprcPosRect);
    GetClientRect(lprcClipRect);
    return S_OK;
  }

STDMETHODIMP CBrowserHost::Invoke | ( | DISPID | dispidMember,
 |  | REFIID | riid,
 |  | LCID | lcid,
 |  | WORD | wFlags,
 |  | DISPPARAMS * | pdispparams,
 |  | VARIANT * | pvarResult,
 |  | EXCEPINFO * | pexcepinfo,
 |  | UINT * | puArgErr |
 | ) |  |  | [private]

Definition at line 676 of file BrowserHost.cpp.

{
  USES_CONVERSION;
  HRESULT hr;
  CComBSTR bstrString;
  CComVariant var;
  TCHAR szRed[3];
  TCHAR szGreen[3];
  TCHAR szBlue[3];
  TCHAR szColor[8];
  TCHAR szString[25];
  int i = 0;
  int j = 0;
  int hex = 1;
  LONG lColor, lRed, lGreen, lBlue;

  switch (dispidMember)
  {
    case DISPID_DOCUMENTCOMPLETE:
    {
      IDispatch* pDisp;
      m_spDoc = (IHTMLDocument2*)NULL;
      m_spWebBrowser->get_Document(&pDisp);
      pDisp->QueryInterface(IID_IHTMLDocument2, (void**)&m_spDoc);

      // Set up event notification to document
      if (!m_dwCookie2) // Check m_dwCookie because Invoke is called
                // w/DISPID_DOCUMENTCOMPLETE more than once
                // and we don't want to set more than one
                // connection point to document
        hr = AtlAdvise(m_spDoc,
                 GetUnknown(),
                 DIID_HTMLDocumentEvents2,
                 &m_dwCookie2);

      pDisp->Release();
      break;
    }

    case DISPID_BEFORENAVIGATE:
    case DISPID_BEFORENAVIGATE2:
    case DISPID_ONQUIT:
    {
      if (!m_dwCookie2 || !m_spDoc) break;
      hr = AtlUnadvise(m_spDoc,
               DIID_HTMLDocumentEvents2,
               m_dwCookie2);

      m_dwCookie2 = NULL;

      break;
    }

    case DISPID_HTMLDOCUMENTEVENTS2_ONSELECTIONCHANGE:
    {
      if (!m_bIsChecked) break;

      // Get font color
      hr = m_spOleCmdTarg->Exec(&CGID_MSHTML,
                 IDM_FORECOLOR, // To compile with IE 5.0 Headers and Libs use:  IDM_DISABLE_EDITFOCUS_UI
                 MSOCMDEXECOPT_DODEFAULT,
                 NULL,
                 &var);

      // Convert long returned in var to hash-prefixed
      // hexidecimal string
      lColor = var.lVal;
      lBlue = lColor/(256*256);
      lColor = lColor - lBlue*256*256;
      lGreen = lColor/256;
      lRed = lColor - lGreen*256;

      _itot(lRed, szRed, 16);
      _itot(lGreen, szGreen, 16);
      _itot(lBlue, szBlue, 16);

      szColor[0] = '#';
      if (lRed < 16)
      {
        szColor[1] = '0';
        szColor[2] = szRed[0];
      }
      else
      {
        szColor[1] = szRed[0];
        szColor[2] = szRed[1];
      }
      if (lGreen < 16)
      {
        szColor[3] = '0';
        szColor[4] = szGreen[0];
      }
      else
      {
        szColor[3] = szGreen[0];
        szColor[4] = szGreen[1];
      }
      if (lBlue < 16)
      {
        szColor[5] = '0';
        szColor[6] = szBlue[0];
      }
      else
      {
        szColor[5] = szBlue[0];
        szColor[6] = szBlue[1];
      }

      szColor[7] = NULL;

      if (var.vt != VT_EMPTY)
        m_wndBox1.SetWindowText(szColor);
      else
        m_wndBox1.SetWindowText(_T(""));

      // Get font size
      hr = m_spOleCmdTarg->Exec(&CGID_MSHTML,
                 IDM_FONTSIZE,
                 MSOCMDEXECOPT_DODEFAULT,
                 NULL,
                 &var);

      _itot(var.lVal, szString, 10);

      if (var.vt != VT_EMPTY)
        m_wndBox2.SetWindowText(szString);
      else
        m_wndBox2.SetWindowText(_T(""));

      // Get font name
      hr = m_spOleCmdTarg->Exec(&CGID_MSHTML,
                 IDM_FONTNAME,
                 MSOCMDEXECOPT_DODEFAULT,
                 NULL,
                 &var);

      if (var.vt != VT_EMPTY)
        m_wndBox3.SetWindowText(OLE2T(var.bstrVal));
      else
        m_wndBox3.SetWindowText(_T(""));

      break;
    }

    case DISPID_STATUSTEXTCHANGE:
      m_wndStatusBar.SetWindowText(OLE2T(pDispParams->rgvarg[0].bstrVal));
      break;

    default:
      return DISP_E_MEMBERNOTFOUND;
  }

  return S_OK;
}

STDMETHOD() CBrowserHost::Invoke | ( | DISPID | dispidMember,
 |  | REFIID | riid,
 |  | LCID | lcid,
 |  | WORD | wFlags,
 |  | DISPPARAMS * | pdispparams,
 |  | VARIANT * | pvarResult,
 |  | EXCEPINFO * | pexcepinfo,
 |  | UINT * | puArgErr |
 | ) |  |  | [private]
STDMETHOD() CBrowserHost::Invoke | ( | DISPID | dispidMember,
 |  | REFIID | riid,
 |  | LCID | lcid,
 |  | WORD | wFlags,
 |  | DISPPARAMS * | pdispparams,
 |  | VARIANT * | pvarResult,
 |  | EXCEPINFO * | pexcepinfo,
 |  | UINT * | puArgErr |
 | ) |  |  | [private]
STDMETHOD() CBrowserHost::Invoke | ( | DISPID | dispidMember,
 |  | REFIID | riid,
 |  | LCID | lcid,
 |  | WORD | wFlags,
 |  | DISPPARAMS * | pdispparams,
 |  | VARIANT * | pvarResult,
 |  | EXCEPINFO * | pexcepinfo,
 |  | UINT * | puArgErr |
 | ) |  |  | [private]
LRESULT CBrowserHost::OnAddressBox | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 218 of file BrowserHost.cpp.

{
  USES_CONVERSION;

  if (wParam == VK_RETURN)
  {
    CComBSTR bstrURL;

    // CODE REVIEW: Add this security comment.
    /* The following use of GetWindowText is simplified for illustrative
    purposes. This simplified use in production code can expose a
    security risk in some situations. In production code you might want
    to ensure that the receiving buffer size isn't exceeded by the size
    of the source string. */
    m_wndAddressBox.GetWindowText(bstrURL.m_str);
    m_spWebBrowser->Navigate(bstrURL, NULL, NULL, NULL, NULL);
  }

  return 0;
}

LRESULT CBrowserHost::OnBox1 | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 239 of file BrowserHost.cpp.

{
  if (wParam == VK_RETURN)
    OnButton4(NULL, NULL, NULL, bHandled);

  return 0;
}

LRESULT CBrowserHost::OnBox2 | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 247 of file BrowserHost.cpp.

{
  if (wParam == VK_RETURN)
    OnButton5(uMsg, wParam, NULL, bHandled);

  return 0;
}

LRESULT CBrowserHost::OnBox3 | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 255 of file BrowserHost.cpp.

{
  if (wParam == VK_RETURN)
    OnButton6(uMsg, wParam, NULL, bHandled);

  return 0;
}

LRESULT CBrowserHost::OnBox4 | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 263 of file BrowserHost.cpp.

{
  if (wParam == VK_RETURN)
    OnButton7(uMsg, wParam, NULL, bHandled);

  return 0;
}

LRESULT CBrowserHost::OnButton1 | ( | WORD | ,
 |  | WORD | ,
 |  | HWND | ,
 |  | BOOL & |  |
 | ) |  |  | [protected]
LRESULT CBrowserHost::OnButton1 | ( | WORD | ,
 |  | WORD | ,
 |  | HWND | ,
 |  | BOOL & |  |
 | ) |  |  | [protected]
LRESULT CBrowserHost::OnButton1 | ( | WORD | ,
 |  | WORD | ,
 |  | HWND | ,
 |  | BOOL & |  |
 | ) |  |  | [protected]
LRESULT CBrowserHost::OnButton1 | ( | WORD | ,
 |  | WORD | ,
 |  | HWND | ,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 17 of file BrowserHost.cpp.

{
  _ASSERT(m_spWebBrowser);

  if (!m_spDoc)
  {
     MessageBox(_T("Document object no available."));
     return 0;
  }

  USES_CONVERSION; // Needed for the OLE2A conversion macro
  BSTR bstrMode;
  HRESULT hr;

  hr = AtlUnadvise(m_spDoc,
           DIID_HTMLDocumentEvents2,
           m_dwCookie2);

  m_dwCookie2 = NULL;

  m_spDoc->get_designMode(&bstrMode);
  char* cMode = OLE2A(bstrMode);

  if (strcmp(cMode, "On"))
  {
    m_spDoc->put_designMode(L"On");
    m_wndButton1.SendMessage(BM_SETCHECK, BST_CHECKED, NULL);
  }
  else
  {
    m_spDoc->put_designMode(L"Off");
    m_wndButton1.SendMessage(BM_SETCHECK, BST_UNCHECKED, NULL);
  }

  if (m_bIsChecked)
  {
    m_wndBox1.SetWindowText(_T(""));
    m_wndBox2.SetWindowText(_T(""));
    m_wndBox3.SetWindowText(_T(""));
  }

  hr = AtlAdvise(m_spDoc,
           GetUnknown(),
           DIID_HTMLDocumentEvents2,
           &m_dwCookie2);

  m_spOleCmdTarg = m_spWebBrowser;

  bHandled = TRUE;

  return 0;
}

LRESULT CBrowserHost::OnButton10 | ( | WORD | ,
 |  | WORD | ,
 |  | HWND | ,
 |  | BOOL & |  |
 | ) |  |  | [protected]

Definition at line 386 of file BrowserHost.cpp.

{
  HRESULT hr ;
    VARIANT var;

  V_VT(&var) = VT_I4;

  TCHAR textLevel = NULL;

  _itot(m_lCSSlevel, &textLevel, 10);

  V_I4(&var) = m_lCSSlevel++;

  if (m_lCSSlevel > 2) m_lCSSlevel = 0;

  MessageBox(&textLevel, _T("CSS Level"), NULL);

  hr = m_spOleCmdTarg->Exec(&CGID_MSHTML,
                IDM_CSSEDITING_LEVEL,
                MSOCMDEXECOPT_DODEFAULT,
                &var,
                NULL);

  return 0;
}

LRESULT CBrowserHost::OnButton2 | ( | WORD | ,
 |  | WORD | ,
 |  | HWND | ,
 |  | BOOL & |  |
 | ) |  |  | [protected]
LRESULT CBrowserHost::OnButton2 | ( | WORD | ,
 |  | WORD | ,
 |  | HWND | ,
 |  | BOOL & |  |
 | ) |  |  | [protected]
LRESULT CBrowserHost::OnButton2 | ( | WORD | ,
 |  | WORD | ,
 |  | HWND | ,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 71 of file BrowserHost.cpp.

{
  // Bold Selection
  m_spOleCmdTarg->Exec(&CGID_MSHTML,
             IDM_BOLD,
             MSOCMDEXECOPT_DODEFAULT,
             NULL,
             NULL);

  return 0;
}

LRESULT CBrowserHost::OnButton2 | ( | WORD | ,
 |  | WORD | ,
 |  | HWND | ,
 |  | BOOL & |  |
 | ) |  |  | [protected]
LRESULT CBrowserHost::OnButton3 | ( | WORD | ,
 |  | WORD | ,
 |  | HWND | ,
 |  | BOOL & |  |
 | ) |  |  | [protected]
LRESULT CBrowserHost::OnButton3 | ( | WORD | ,
 |  | WORD | ,
 |  | HWND | ,
 |  | BOOL & |  |
 | ) |  |  | [protected]
LRESULT CBrowserHost::OnButton3 | ( | WORD | ,
 |  | WORD | ,
 |  | HWND | ,
 |  | BOOL & |  |
 | ) |  |  | [protected]
LRESULT CBrowserHost::OnButton3 | ( | WORD | ,
 |  | WORD | ,
 |  | HWND | ,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 83 of file BrowserHost.cpp.

{
  // Italicize Selection
  m_spOleCmdTarg->Exec(&CGID_MSHTML,
             IDM_ITALIC,
             MSOCMDEXECOPT_DODEFAULT,
             NULL,
             NULL);

  return 0;
}

LRESULT CBrowserHost::OnButton4 | ( | WORD | ,
 |  | WORD | ,
 |  | HWND | ,
 |  | BOOL & |  |
 | ) |  |  | [protected]
LRESULT CBrowserHost::OnButton4 | ( | WORD | ,
 |  | WORD | ,
 |  | HWND | ,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 95 of file BrowserHost.cpp.

{
  // Font Color
  USES_CONVERSION;

  CComBSTR bstrColor;

  // CODE REVIEW: Add this security comment.
  /* The following use of GetWindowText is simplified for illustrative
  purposes. This simplified use in production code can expose a
  security risk in some situations. In production code you might want
  to ensure that the receiving buffer size isn't exceeded by the size
  of the source string. */
  m_wndBox1.GetWindowText(bstrColor.m_str);

  VARIANT vColor;
  vColor.vt = VT_BSTR;
  vColor.bstrVal = bstrColor;

  m_spOleCmdTarg->Exec(&CGID_MSHTML,
             IDM_FORECOLOR,
             MSOCMDEXECOPT_DODEFAULT,
             &vColor,
             NULL);

  return 0;
}

LRESULT CBrowserHost::OnButton4 | ( | WORD | ,
 |  | WORD | ,
 |  | HWND | ,
 |  | BOOL & |  |
 | ) |  |  | [protected]
LRESULT CBrowserHost::OnButton5 | ( | WORD | ,
 |  | WORD | ,
 |  | HWND | ,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 123 of file BrowserHost.cpp.

{
  // FontSize
  USES_CONVERSION;

  CComBSTR bstrSize;

  // CODE REVIEW: Add this security comment.
  /* The following use of GetWindowText is simplified for illustrative
  purposes. This simplified use in production code can expose a
  security risk in some situations. In production code you might want
  to ensure that the receiving buffer size isn't exceeded by the size
  of the source string. */
  m_wndBox2.GetWindowText(bstrSize.m_str);

  LPSTR szSize = OLE2A(bstrSize);

  LONG lSize = atoi(szSize);

  VARIANT vSize;
  vSize.vt = VT_I4;
  vSize.lVal = lSize;

  m_spOleCmdTarg->Exec(&CGID_MSHTML,
             IDM_FONTSIZE,
             MSOCMDEXECOPT_DODEFAULT,
             &vSize,
             NULL);

  return 0;
}

LRESULT CBrowserHost::OnButton5 | ( | WORD | ,
 |  | WORD | ,
 |  | HWND | ,
 |  | BOOL & |  |
 | ) |  |  | [protected]
LRESULT CBrowserHost::OnButton5 | ( | WORD | ,
 |  | WORD | ,
 |  | HWND | ,
 |  | BOOL & |  |
 | ) |  |  | [protected]
LRESULT CBrowserHost::OnButton6 | ( | WORD | ,
 |  | WORD | ,
 |  | HWND | ,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 155 of file BrowserHost.cpp.

{
  // FontName
  USES_CONVERSION;

  CComBSTR bstrName;

  // CODE REVIEW: Add this security comment.
  /* The following use of GetWindowText is simplified for illustrative
  purposes. This simplified use in production code can expose a
  security risk in some situations. In production code you might want
  to ensure that the receiving buffer size isn't exceeded by the size
  of the source string. */
  m_wndBox3.GetWindowText(bstrName.m_str);

  VARIANT vName;
  vName.vt = VT_BSTR;
  vName.bstrVal = bstrName;

  m_spOleCmdTarg->Exec(&CGID_MSHTML,
             IDM_FONTNAME,
             MSOCMDEXECOPT_DODEFAULT,
             &vName,
             NULL);

  return 0;
}

LRESULT CBrowserHost::OnButton6 | ( | WORD | ,
 |  | WORD | ,
 |  | HWND | ,
 |  | BOOL & |  |
 | ) |  |  | [protected]
LRESULT CBrowserHost::OnButton7 | ( | WORD | ,
 |  | WORD | ,
 |  | HWND | ,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 183 of file BrowserHost.cpp.

{
  //InsertImage
  USES_CONVERSION;

  CComBSTR bstrImage;

  // CODE REVIEW: Add this security comment.
  /* The following use of GetWindowText is simplified for illustrative
  purposes. This simplified use in production code can expose a
  security risk in some situations. In production code you might want
  to ensure that the receiving buffer size isn't exceeded by the size
  of the source string. */
  m_wndBox4.GetWindowText(bstrImage.m_str);

  VARIANT vImage;
  vImage.vt = VT_BSTR;
  vImage.bstrVal = bstrImage;

  m_spOleCmdTarg->Exec(&CGID_MSHTML,
             IDM_IMAGE,
             MSOCMDEXECOPT_DONTPROMPTUSER,
             &vImage,
             NULL);

  return 0;
}

LRESULT CBrowserHost::OnButton7 | ( | WORD | ,
 |  | WORD | ,
 |  | HWND | ,
 |  | BOOL & |  |
 | ) |  |  | [protected]
LRESULT CBrowserHost::OnButton8 | ( | WORD | ,
 |  | WORD | ,
 |  | HWND | ,
 |  | BOOL & |  |
 | ) |  |  | [protected]

Definition at line 336 of file BrowserHost.cpp.

{
  HRESULT hr ;
    VARIANT var;

  // Turn button on or off
  if (m_bButton8Down)
    m_wndToolBar.SendMessage(TB_PRESSBUTTON, ID_BUTTON8, MAKELONG(FALSE, 0));
  else
    m_wndToolBar.SendMessage(TB_PRESSBUTTON, ID_BUTTON8, MAKELONG(TRUE, 0));

  m_bButton8Down = !m_bButton8Down;

  V_VT(&var) = VT_BOOL;
  V_BOOL(&var) = m_bButton8Down ? VARIANT_TRUE : VARIANT_FALSE;

  hr = m_spOleCmdTarg->Exec(&CGID_MSHTML,
                IDM_RESPECTVISIBILITY_INDESIGN,
                MSOCMDEXECOPT_DODEFAULT,
                &var,
                NULL);

  return 0;
}

LRESULT CBrowserHost::OnButton9 | ( | WORD | ,
 |  | WORD | ,
 |  | HWND | ,
 |  | BOOL & |  |
 | ) |  |  | [protected]

Definition at line 361 of file BrowserHost.cpp.

{
  HRESULT hr ;
    VARIANT var;

  // Turn button on or off
  if (m_bButton9Down)
    m_wndToolBar.SendMessage(TB_PRESSBUTTON, ID_BUTTON9, MAKELONG(FALSE, 0));
  else
    m_wndToolBar.SendMessage(TB_PRESSBUTTON, ID_BUTTON9, MAKELONG(TRUE, 0));

  m_bButton9Down = !m_bButton9Down;

  V_VT(&var) = VT_BOOL;
  V_BOOL(&var) = m_bButton9Down ? VARIANT_TRUE : VARIANT_FALSE;

  hr = m_spOleCmdTarg->Exec(&CGID_MSHTML,
                IDM_OVERRIDE_CURSOR,
                MSOCMDEXECOPT_DODEFAULT,
                &var,
                NULL);

  return 0;
}

LRESULT CBrowserHost::OnCheckBox | ( | WORD | ,
 |  | WORD | ,
 |  | HWND | ,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 211 of file BrowserHost.cpp.

{
  m_bIsChecked = !m_bIsChecked;

  return 0;
}

LRESULT CBrowserHost::OnCreate | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 553 of file BrowserHost.cpp.

{return 0;}

LRESULT CBrowserHost::OnCreate | ( | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM | ,
 |  | BOOL & |  |
 | ) |  |  | [protected]
LRESULT CBrowserHost::OnCreate | ( | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM | ,
 |  | BOOL & |  |
 | ) |  |  | [protected]
LRESULT CBrowserHost::OnCreate | ( | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM | ,
 |  | BOOL & |  |
 | ) |  |  | [protected]
LRESULT CBrowserHost::OnDestroy | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 555 of file BrowserHost.cpp.

{
  Stop();
  return 0;
}

STDMETHOD() CBrowserHost::OnInPlaceActivate ( void ) [inline, private]

Definition at line 146 of file BrowserHost.h.

  {
      m_bInPlaceActive = TRUE;
      return S_OK;
  }

STDMETHOD() CBrowserHost::OnInPlaceActivate ( void ) [inline, private]

Definition at line 124 of file BrowserHost.h.

  {
      m_bInPlaceActive = TRUE;
      return S_OK;
  }

STDMETHOD() CBrowserHost::OnInPlaceActivate ( void ) [inline, private]

Definition at line 136 of file BrowserHost.h.

  {
      m_bInPlaceActive = TRUE;
      return S_OK;
  }

STDMETHOD() CBrowserHost::OnInPlaceActivate ( void ) [inline, private]

Definition at line 187 of file BrowserHost.h.

  {
      m_bInPlaceActive = TRUE;
      return S_OK;
  }

STDMETHOD() CBrowserHost::OnInPlaceDeactivate ( void ) [inline, private]

Definition at line 204 of file BrowserHost.h.

  {
    m_bInPlaceActive = FALSE;
    return S_OK;
  }

STDMETHOD() CBrowserHost::OnInPlaceDeactivate ( void ) [inline, private]

Definition at line 141 of file BrowserHost.h.

  {
    m_bInPlaceActive = FALSE;
    return S_OK;
  }

STDMETHOD() CBrowserHost::OnInPlaceDeactivate ( void ) [inline, private]

Definition at line 153 of file BrowserHost.h.

  {
    m_bInPlaceActive = FALSE;
    return S_OK;
  }

STDMETHOD() CBrowserHost::OnInPlaceDeactivate ( void ) [inline, private]

Definition at line 163 of file BrowserHost.h.

  {
    m_bInPlaceActive = FALSE;
    return S_OK;
  }

LRESULT CBrowserHost::OnKeydown | ( | UINT | ,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL & |  |
 | ) |  |  | [protected]
LRESULT CBrowserHost::OnKeydown | ( | UINT | ,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL & |  |
 | ) |  |  | [protected]
LRESULT CBrowserHost::OnKeydown | ( | UINT | ,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL & |  |
 | ) |  |  | [protected]
LRESULT CBrowserHost::OnKeydown | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 616 of file BrowserHost.cpp.

{
  // Deal with tab and delete key events
  // Check for doc first
  if (!m_spDoc) return 0;

  USES_CONVERSION;
  // Determine current designMode
  CComBSTR bstrMode;
  m_spDoc->get_designMode(&bstrMode);
  char* cMode = OLE2A(bstrMode);

  // Handle tab when design mode is off
  // Handle return regardless of designMode
  if ((strcmp(cMode, "On") && wParam == VK_TAB) || wParam == VK_RETURN)
  {
    // Pass user interface control to the WebBrowser when
    // the tab or return keys are pressed (that is, UIActivate it)
    // This lets the WebBrowser change focus between the
    // various controls on the page when the tab key is pressed
    CComQIPtr<IOleObject, &IID_IOleObject> spOleObject(m_spWebBrowser);

    RECT rect;
    GetClientRect(&rect);
    spOleObject->DoVerb(OLEIVERB_UIACTIVATE, NULL, this, 0, m_hWnd, &rect);
  }

  // When designMode is on, tab, backspace, right arrow,
  // left arrow, up arrow, down arrow, and end key events
  // shouldn't be passed to the WebBrowser
  // (They require special handling to work correctly)
  // Also, pass VK_TAB to WebBrowser control when designMode is off
  // Pass return key events regardless of designMode
  if ((!strcmp(cMode, "On") && wParam != VK_TAB &&
                 wParam != VK_BACK &&
                 wParam != VK_RIGHT &&
                 wParam != VK_LEFT &&
                 wParam != VK_UP &&
                 wParam != VK_DOWN &&
                 wParam != VK_END) ||
    (strcmp(cMode, "On") && wParam == VK_TAB) ||
    (wParam == VK_RETURN))
  {
    // Call TranslateAccelerator on the in-place active
    // object to pass events to the WebBrowser control
    CComQIPtr<IOleInPlaceActiveObject,
        &IID_IOleInPlaceActiveObject> spInPlaceActiveObject(m_spWebBrowser);

    MSG msg;
    msg.message = uMsg;
    msg.wParam = wParam;
    msg.lParam = lParam;

    spInPlaceActiveObject->TranslateAccelerator(&msg);
  }

  return 0;
}

LRESULT CBrowserHost::OnNCDestroy | ( | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM | ,
 |  | BOOL & |  |
 | ) |  |  | [protected]
LRESULT CBrowserHost::OnNCDestroy | ( | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM | ,
 |  | BOOL & |  |
 | ) |  |  | [protected]

Definition at line 41 of file BrowserHost.cpp.

{
  Stop();
  return 0;
}

LRESULT CBrowserHost::OnNCDestroy | ( | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM | ,
 |  | BOOL & |  |
 | ) |  |  | [protected]
STDMETHOD() CBrowserHost::OnPosRectChange ( LPCRECT lprcPosRect ) [inline, private]

Definition at line 164 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::OnPosRectChange ( LPCRECT lprcPosRect ) [inline, private]

Definition at line 174 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::OnPosRectChange ( LPCRECT lprcPosRect ) [inline, private]

Definition at line 215 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::OnPosRectChange ( LPCRECT lprcPosRect ) [inline, private]

Definition at line 152 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::OnShowWindow ( BOOL fShow ) [inline, private]

Definition at line 172 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::OnShowWindow ( BOOL fShow ) [inline, private]

Definition at line 182 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::OnShowWindow ( BOOL fShow ) [inline, private]

Definition at line 169 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::OnShowWindow ( BOOL fShow ) [inline, private]

Definition at line 160 of file BrowserHost.h.

{return E_NOTIMPL;}

LRESULT CBrowserHost::OnSize | ( | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM | ,
 |  | BOOL & |  |
 | ) |  |  | [protected]
LRESULT CBrowserHost::OnSize | ( | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM | ,
 |  | BOOL & |  |
 | ) |  |  | [protected]
LRESULT CBrowserHost::OnSize | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 562 of file BrowserHost.cpp.

{
  RECT rcStatus;
  RECT rc;

  // Resize the status bar
  if (m_wndStatusBar.m_hWnd)
  {
    GetClientRect(&rc);

    // Keep the status bar height the same.
    m_wndStatusBar.GetWindowRect(&rcStatus);
    rc.top = rc.bottom - (rcStatus.bottom - rcStatus.top);

    m_wndStatusBar.MoveWindow(&rc, TRUE);
  }

  // Resize Top Band
  if (m_wndTopBand.m_hWnd)
  {
    GetClientRect(&rc);
    rc.bottom = rc.top + m_lTopBandHeight;
    m_wndTopBand.MoveWindow(&rc, TRUE);
  }

  // Resize Left Band
  if (m_wndLeftBand.m_hWnd)
  {
    GetClientRect(&rc);
    rc.right = rc.left + m_lLeftBandWidth;
    rc.top = rc.top + m_lTopBandHeight;
    rc.bottom = rc.bottom - (rcStatus.bottom - rcStatus.top);
    m_wndLeftBand.MoveWindow(&rc, TRUE);
  }

  // Resize the WebBrowser
  if (m_spWebBrowser && m_bInPlaceActive)
  {
    GetClientRect(&rc);

    // Resize the control to accomodate the status bar and toolbar
    rc.bottom -= (rcStatus.bottom - rcStatus.top);

    //m_wndToolBar.GetWindowRect(&rcWindow);
    rc.left += m_lLeftBandWidth;
    rc.top += m_lTopBandHeight;

    if (m_spInPlaceObject)
      m_spInPlaceObject->SetObjectRects(&rc, &rc);
  }

  return 0;
}

LRESULT CBrowserHost::OnSize | ( | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM | ,
 |  | BOOL & |  |
 | ) |  |  | [protected]
STDMETHOD() CBrowserHost::OnUIActivate ( void ) [inline, private]

Definition at line 210 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::OnUIActivate ( void ) [inline, private]

Definition at line 169 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::OnUIActivate ( void ) [inline, private]

Definition at line 147 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::OnUIActivate ( void ) [inline, private]

Definition at line 159 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::OnUIDeactivate ( BOOL fUndoable ) [inline, private]

Definition at line 149 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::OnUIDeactivate ( BOOL fUndoable ) [inline, private]

Definition at line 212 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::OnUIDeactivate ( BOOL fUndoable ) [inline, private]

Definition at line 171 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::OnUIDeactivate ( BOOL fUndoable ) [inline, private]

Definition at line 161 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHODIMP CBrowserHost::QueryService | ( | REFGUID | guidService,
 |  | REFIID | riid,
 |  | void ** | ppv |
 | ) |  |  | [private]

Definition at line 664 of file BrowserHost.cpp.

{
    HRESULT hr = E_NOINTERFACE;

    if (guidService == SID_SHTMLEditHost && riid == IID_IHTMLEditHost)
    {
    // Create new CSnap object
        CComObject<CSnap>* pSnap;
        hr = CComObject<CSnap>::CreateInstance(&pSnap);

    // Query the new CSnap object for IHTMLEditHost interface
        hr = pSnap->QueryInterface(IID_IHTMLEditHost, ppv);

        // Cache a pointer to ISnap so we can tell the Snap behavior
        // when to snap
        m_spSnap = (ISnap*)NULL; // Clear any previous pointers
        hr = pSnap->QueryInterface(IID_ISnap, (void**)&m_spSnap);

    // Set the snap increment
        hr = pSnap->put_SnapIncrement(m_lSnapIncrement);
    }

    return hr;
}

STDMETHOD() CBrowserHost::RequestNewObjectLayout ( void ) [inline, private]

Definition at line 170 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::RequestNewObjectLayout ( void ) [inline, private]

Definition at line 173 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::RequestNewObjectLayout ( void ) [inline, private]

Definition at line 183 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::RequestNewObjectLayout ( void ) [inline, private]

Definition at line 161 of file BrowserHost.h.

{return E_NOTIMPL;}

ALT_MSG_MAP (1) public STDMETHOD() CBrowserHost::Run ( )
ALT_MSG_MAP (1) public STDMETHOD() CBrowserHost::Run ( )
STDMETHODIMP CBrowserHost::Run ( )

Definition at line 271 of file BrowserHost.cpp.

{
  // Create and show the window
  RECT rcClient = { CW_USEDEFAULT, 0, 0, 0 };

  Create(GetDesktopWindow(),
       rcClient,
       _T("Editing Command Sample App"),
       WS_VISIBLE | WS_OVERLAPPEDWINDOW,
       0,
       NULL);

  ShowWindow(SW_SHOWNORMAL);

  // Add status bar
  m_wndStatusBar.Attach(CreateStatusWindow(WS_CHILD | WS_VISIBLE | CCS_ADJUSTABLE,
                         _T("Ready"),
                       m_hWnd,
                       2));

  // CreateWebBrowser Control
  CComQIPtr<IOleObject> spOleObject;
  HRESULT hr = CoCreateInstance(CLSID_WebBrowser,
                  NULL,
                  CLSCTX_INPROC,
                  IID_IWebBrowser,
                  (void**)&m_spWebBrowser);

  m_spInPlaceObject = m_spWebBrowser;
  spOleObject = m_spWebBrowser;

  hr = spOleObject->SetClientSite(this);
  if (FAILED(hr))
  {
    MessageBox(_T("SetClientSite failed"));
    return E_FAIL;
  }

  // In-place activate the WebBrower control
  MSG msg;
  GetClientRect(&rcClient);

  hr = spOleObject->DoVerb(OLEIVERB_INPLACEACTIVATE, &msg, this, 0, m_hWnd, &rcClient);

  // Set up event notification to browser
  hr = AtlAdvise(m_spWebBrowser,
           GetUnknown(),
           DIID_DWebBrowserEvents2,
           &m_dwCookie);

  // Create Top Band Window
  RECT rc;

  GetClientRect(&rc);
  rc.bottom = rc.top + m_lTopBandHeight;

  m_wndTopBand.Create(m_hWnd,
             rc,
             NULL,
             WS_CHILD|WS_VISIBLE|SS_BLACKRECT,
             0,
             ID_TOPBAND);

  // Create Left Band Window
  GetClientRect(&rc);
  rc.right = rc.left + m_lLeftBandWidth;
  rc.top = rc.top + m_lTopBandHeight;

  RECT rcStatus;
  m_wndStatusBar.GetWindowRect(&rcStatus);

  rc.bottom = rc.bottom - (rcStatus.bottom - rcStatus.top);

  m_wndLeftBand.Create(m_hWnd,
             rc,
             NULL,
             WS_CHILD|WS_VISIBLE|SS_BLACKRECT,
             0,
             ID_LEFTBAND);

  // Add buttons
  LONG lheight = 25;
  LONG lwidth = 80;
  LONG lYOffset = 35;
  LONG lTopMargin = 10;
  LONG lLeftMargin = 10;

  GetClientRect(&rc);

  rc.top = rc.top + lTopMargin;
  rc.left = rc.left + lLeftMargin;
  rc.bottom = rc.top + lheight;
  rc.right = rc.left + 110;

  m_wndButton1.Create(m_wndLeftBand.m_hWnd,
            rc,
            _T("DesignModeOn"),
            WS_CHILD|WS_VISIBLE|BS_CHECKBOX|BS_PUSHLIKE,
            0,
            ID_BUTTON1);

  rc.top = rc.top + lYOffset;
  rc.bottom = rc.top + lheight;
  rc.right = rc.left + lwidth;

  m_wndButton2.Create(m_wndLeftBand.m_hWnd,
            rc,
            _T("Bold"),
            WS_CHILD|WS_VISIBLE| BS_PUSHBUTTON,
            0,
            ID_BUTTON2);

  rc.top = rc.top + lYOffset;
  rc.bottom = rc.top + lheight;
  rc.right = rc.left + lwidth;

  m_wndButton3.Create(m_wndLeftBand.m_hWnd,
            rc,
            _T("Italic"),
            WS_CHILD|WS_VISIBLE| BS_PUSHBUTTON,
            0,
            ID_BUTTON3);

  rc.top = rc.top + lYOffset;
  rc.bottom = rc.top + lheight;
  rc.right = rc.left + lwidth;

  m_wndButton4.Create(m_wndLeftBand.m_hWnd,
            rc,
            _T("FontColor"),
            WS_CHILD|WS_VISIBLE| BS_PUSHBUTTON,
            0,
            ID_BUTTON4);

  rc.top = rc.top + lYOffset;
  rc.bottom = rc.top + lheight;
  rc.right = rc.left + lwidth;

  m_wndButton5.Create(m_wndLeftBand.m_hWnd,
            rc,
            _T("FontSize"),
            WS_CHILD|WS_VISIBLE| BS_PUSHBUTTON,
            0,
            ID_BUTTON5);

  rc.top = rc.top + lYOffset;
  rc.bottom = rc.top + lheight;
  rc.right = rc.left + lwidth;

  m_wndButton6.Create(m_wndLeftBand.m_hWnd,
            rc,
            _T("FontName"),
            WS_CHILD|WS_VISIBLE| BS_PUSHBUTTON,
            0,
            ID_BUTTON6);

  rc.top = rc.top + lYOffset;
  rc.bottom = rc.top + lheight;
  rc.right = rc.left + lwidth + 10;

  m_wndButton7.Create(m_wndLeftBand.m_hWnd,
            rc,
            _T("InsertImage"),
            WS_CHILD|WS_VISIBLE| BS_PUSHBUTTON,
            0,
            ID_BUTTON7);

  // Add edit boxes
  lwidth = 65;
  lheight = 25;

  rc.left = rc.left + 90;
  rc.right = rc.left + lwidth;
  rc.top = rc.top - 3 *lYOffset;
  rc.bottom = rc.top + lheight;

  m_wndBox1.Create(m_wndLeftBand.m_hWnd,
           rc,
           NULL,
           WS_CHILD|WS_VISIBLE|ES_AUTOHSCROLL,
           0,
           ID_BOX1);

  rc.right = rc.left + lwidth;
  rc.top = rc.top + lYOffset;
  rc.bottom = rc.top + lheight;

  m_wndBox2.Create(m_wndLeftBand.m_hWnd,
           rc,
           NULL,
           WS_CHILD|WS_VISIBLE|CBS_AUTOHSCROLL,
           0,
           ID_BOX2);

  rc.right = rc.left + lwidth;
  rc.top = rc.top + lYOffset;
  rc.bottom = rc.top + lheight;

  m_wndBox3.Create(m_wndLeftBand.m_hWnd,
           rc,
           NULL,
           WS_CHILD|WS_VISIBLE|CBS_AUTOHSCROLL,
           0,
           ID_BOX3);

  rc.left = rc.left - 80;
  rc.right = rc.left + lwidth + 80;
  rc.top = rc.top + 2 *lYOffset;
  rc.bottom = rc.top + lheight;

  m_wndBox4.Create(m_wndLeftBand.m_hWnd,
           rc,
           NULL,
           WS_CHILD|WS_VISIBLE|CBS_AUTOHSCROLL,
           0,
           ID_BOX4);

  m_wndBox1.SetWindowText(_T("red"));
  m_wndBox2.SetWindowText(_T("7"));
  m_wndBox3.SetWindowText(_T("comic sans ms"));
  m_wndBox4.SetWindowText(_T("res://edcommands.exe/cone.jpg"));

  rc.top = rc.top + 2*lYOffset;
  rc.bottom = rc.top + 3*lheight/2;
  rc.left = rc.left - 10;
  rc.right = rc.left + 130;

  m_wndCheckBox.Create(m_wndLeftBand.m_hWnd,
           rc,
           _T("Track Selection Properties"),
           WS_CHILD|WS_VISIBLE|BS_AUTOCHECKBOX|BS_MULTILINE,
           0,
           ID_CHECKBOX);

  // Add addressbox
  GetClientRect(&rc);
  rc.top += 5;
  rc.bottom = rc.top + 25;
  rc.left += lLeftMargin;
  rc.right = rc.left + 450;

  m_wndAddressBox.Create(m_wndTopBand.m_hWnd,
           rc,
           NULL,
           WS_CHILD|WS_VISIBLE|CBS_AUTOHSCROLL,
           0,
           ID_ADDRESSBOX);

  m_wndStatusBar.GetWindowRect(&rc);

  // resize webbrowser to account for status bar, top and left band
  GetClientRect(&rcClient);
  rcClient.top = rcClient.top + m_lTopBandHeight;
  rcClient.left = rcClient.left + m_lLeftBandWidth;
  rcClient.bottom = rcClient.bottom - (rc.bottom - rc.top);

  m_spInPlaceObject->SetObjectRects(&rcClient, &rcClient);

  // Navigate to home page
  m_spWebBrowser->Navigate(L"res://edcommands.exe/test.html", NULL, NULL, NULL, NULL);
  m_wndAddressBox.SetWindowText(_T("res://edcommands.exe/test.html"));

  m_spOleCmdTarg = m_spWebBrowser;

  return S_OK;
}

ALT_MSG_MAP (1) public STDMETHOD() CBrowserHost::Run ( )
STDMETHOD() CBrowserHost::SaveObject ( void ) [inline, private]

Definition at line 165 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::SaveObject ( void ) [inline, private]

Definition at line 168 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::SaveObject ( void ) [inline, private]

Definition at line 178 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::SaveObject ( void ) [inline, private]

Definition at line 156 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::Scroll ( SIZE scrollExtant ) [inline, private]

Definition at line 148 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::Scroll ( SIZE scrollExtant ) [inline, private]

Definition at line 160 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::Scroll ( SIZE scrollExtant ) [inline, private]

Definition at line 211 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::Scroll ( SIZE scrollExtant ) [inline, private]

Definition at line 170 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::ShowObject ( void ) [inline, private]

Definition at line 171 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::ShowObject ( void ) [inline, private]

Definition at line 159 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::ShowObject ( void ) [inline, private]

Definition at line 168 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::ShowObject ( void ) [inline, private]

Definition at line 181 of file BrowserHost.h.

{return E_NOTIMPL;}

STDMETHOD() CBrowserHost::Stop ( ) [protected]
STDMETHOD() CBrowserHost::Stop ( ) [protected]
STDMETHOD() CBrowserHost::Stop ( ) [protected]
STDMETHODIMP CBrowserHost::Stop ( void )

Definition at line 540 of file BrowserHost.cpp.

{
  HRESULT hr = AtlUnadvise(m_spWebBrowser,
               DIID_DWebBrowserEvents2,
               m_dwCookie);

  m_dwCookie = NULL;

  PostQuitMessage(0);

  return S_OK;
}

Member Data Documentation

BOOL CBrowserHost::m_bAtlBrowserHelp [protected]

Definition at line 78 of file BrowserHost.h.

BOOL CBrowserHost::m_bButton10Down [protected]

Definition at line 87 of file BrowserHost.h.

BOOL CBrowserHost::m_bButton2Down [protected]

Definition at line 79 of file BrowserHost.h.

BOOL CBrowserHost::m_bButton3Down [protected]

Definition at line 80 of file BrowserHost.h.

BOOL CBrowserHost::m_bButton4Down [protected]

Definition at line 81 of file BrowserHost.h.

BOOL CBrowserHost::m_bButton5Down [protected]

Definition at line 82 of file BrowserHost.h.

BOOL CBrowserHost::m_bButton6Down [protected]

Definition at line 83 of file BrowserHost.h.

BOOL CBrowserHost::m_bButton7Down [protected]

Definition at line 84 of file BrowserHost.h.

BOOL CBrowserHost::m_bButton8Down [protected]

Definition at line 85 of file BrowserHost.h.

BOOL CBrowserHost::m_bButton9Down [protected]

Definition at line 86 of file BrowserHost.h.

BOOL CBrowserHost::m_bEnableCtxMenus [protected]

Definition at line 72 of file BrowserHost.h.

BOOL CBrowserHost::m_bInPlaceActive [protected]

Definition at line 77 of file BrowserHost.h.

BOOL CBrowserHost::m_bIsChecked

Definition at line 105 of file BrowserHost.h.

DWORD CBrowserHost::m_dwCookie

Definition at line 103 of file BrowserHost.h.

DWORD CBrowserHost::m_dwCookie2

Definition at line 104 of file BrowserHost.h.

DWORD CBrowserHost::m_dwDLControl [protected]

Definition at line 73 of file BrowserHost.h.

DWORD CBrowserHost::m_dwDocHostUIDblClk [protected]

Definition at line 76 of file BrowserHost.h.

DWORD CBrowserHost::m_dwDocHostUIFlags [protected]

Definition at line 75 of file BrowserHost.h.

LONG CBrowserHost::m_lCSSlevel [protected]

Definition at line 88 of file BrowserHost.h.

LONG CBrowserHost::m_lGridCookie [protected]

Definition at line 82 of file BrowserHost.h.

LONG CBrowserHost::m_lLeftBandWidth

Definition at line 102 of file BrowserHost.h.

LONG CBrowserHost::m_lSnapIncrement [protected]

Definition at line 77 of file BrowserHost.h.

ALT_MSG_MAP (1) ALT_MSG_MAP(2) ALT_MSG_MAP(3) ALT_MSG_MAP(4) ALT_MSG_MAP(5) private LONG CBrowserHost::m_lTopBandHeight

Definition at line 82 of file BrowserHost.h.

CComQIPtr< IHTMLDocument2,&IID_IHTMLDocument2 > CBrowserHost::m_spDoc

Definition at line 123 of file BrowserHost.h.

CComQIPtr<IGrid, &IID_IGrid> CBrowserHost::m_spGrid [protected]

Definition at line 84 of file BrowserHost.h.

CComQIPtr< IOleInPlaceObject,&IID_IOleInPlaceObject > CBrowserHost::m_spInPlaceObject

Definition at line 124 of file BrowserHost.h.

CComQIPtr< IOleCommandTarget,&IID_IOleCommandTarget > CBrowserHost::m_spOleCmdTarg

Definition at line 125 of file BrowserHost.h.

CComQIPtr<ISnap, &IID_ISnap> CBrowserHost::m_spSnap [protected]

Definition at line 85 of file BrowserHost.h.

CComQIPtr< IWebBrowser2,&IID_IWebBrowser2 > CBrowserHost::m_spWebBrowser

Definition at line 122 of file BrowserHost.h.

CContainedWindow CBrowserHost::m_wndAddressBox

Definition at line 116 of file BrowserHost.h.

CContainedWindow CBrowserHost::m_wndBox1

Definition at line 118 of file BrowserHost.h.

CContainedWindow CBrowserHost::m_wndBox2

Definition at line 119 of file BrowserHost.h.

CContainedWindow CBrowserHost::m_wndBox3

Definition at line 120 of file BrowserHost.h.

CContainedWindow CBrowserHost::m_wndBox4

Definition at line 121 of file BrowserHost.h.

CContainedWindow CBrowserHost::m_wndButton1

Definition at line 109 of file BrowserHost.h.

CContainedWindow CBrowserHost::m_wndButton2

Definition at line 110 of file BrowserHost.h.

CContainedWindow CBrowserHost::m_wndButton3

Definition at line 111 of file BrowserHost.h.

CContainedWindow CBrowserHost::m_wndButton4

Definition at line 112 of file BrowserHost.h.

CContainedWindow CBrowserHost::m_wndButton5

Definition at line 113 of file BrowserHost.h.

CContainedWindow CBrowserHost::m_wndButton6

Definition at line 114 of file BrowserHost.h.

CContainedWindow CBrowserHost::m_wndButton7

Definition at line 115 of file BrowserHost.h.

CContainedWindow CBrowserHost::m_wndCheckBox

Definition at line 117 of file BrowserHost.h.

CContainedWindow CBrowserHost::m_wndIncrementCombo [protected]

Definition at line 79 of file BrowserHost.h.

CContainedWindow CBrowserHost::m_wndLeftBand

Definition at line 108 of file BrowserHost.h.

CWindow CBrowserHost::m_wndStatusBar

Definition at line 106 of file BrowserHost.h.

CWindow CBrowserHost::m_wndToolBar [protected]

Definition at line 91 of file BrowserHost.h.

CContainedWindow CBrowserHost::m_wndTopBand

Definition at line 107 of file BrowserHost.h.

CContainedWindow CBrowserHost::m_wndUrlCombo [protected]

Definition at line 89 of file BrowserHost.h.

The documentation for this class was generated from the following files:
  • Web/Browser/EditCommands/BrowserHost.h
  • Web/Browser/EditFeatures/BrowserHost.h
  • Web/Browser/EditGlyphs/BrowserHost.h
  • Web/Browser/EditHost/BrowserHost.h
  • Web/Browser/EditCommands/BrowserHost.cpp
  • Web/Browser/EditFeatures/BrowserHost.cpp
  • Web/Browser/EditGlyphs/BrowserHost.cpp
  • Web/Browser/EditHost/BrowserHost.cpp
Generated on Wed Nov 13 2024 16:55:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CBrush Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CBrush Class Reference

#include "Font.Hxx"

List of all members.

Public Member Functions

CBrush (CCanvas &canvas, int iStyle=BS_NULL, COLORREF color=RGB(0, 0, 0))
~CBrush ()

Protected Attributes

CCanvas _canvas
HBRUSH | _hBrush
HBRUSH | _hBrushOld

Detailed Description

Definition at line 68 of file Font.Hxx.

Constructor & Destructor Documentation

CBrush::CBrush | ( | CCanvas & | canvas,
 |  | int | iStyle = BS_NULL,
 |  | COLORREF | color = RGB(0,0,0) |
 | ) |  |  | [inline]

Definition at line 71 of file Font.Hxx.

                                                                            :
      _canvas(canvas)
    {
      LOGBRUSH lb;
      lb.lbStyle= iStyle;
      lb.lbColor= color;
      lb.lbHatch = NULL;

      _hBrush = CreateBrushIndirect(&lb);

      _hBrushOld = SelectBrush(_canvas, _hBrush);
    }

CBrush::~CBrush ( ) [inline]

Definition at line 84 of file Font.Hxx.

    {
      //release brush
      _hBrush = SelectBrush(_canvas, _hBrushOld);
      DeleteObject(_hBrush);
    }

Member Data Documentation

CCanvas CBrush::_canvas [protected]

Definition at line 93 of file Font.Hxx.

HBRUSH CBrush::_hBrush [protected]

Definition at line 91 of file Font.Hxx.

HBRUSH CBrush::_hBrushOld [protected]

Definition at line 92 of file Font.Hxx.

The documentation for this class was generated from the following file:
  • Multimedia/Gdi/Fonts/GridFont/Font.Hxx
Generated on Wed Nov 13 2024 16:55:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CBSTR Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CBSTR Class Reference

List of all members.

Public Member Functions

CBSTR ()
CBSTR (LPWSTR pSrc)
CBSTR ()
CBSTR (LPWSTR pSrc)
~CBSTR ()
~CBSTR ()
operator BSTR ()
operator BSTR ()
void | Unbind ()
void | Unbind ()

Private Attributes

BSTR | m_pStr

Detailed Description

Definition at line 17 of file OaHelp.Inl.

Constructor & Destructor Documentation

CBSTR::CBSTR ( ) [inline]

Definition at line 21 of file OaHelp.Inl.

{ m_pStr = 0; }

CBSTR::CBSTR ( LPWSTR pSrc ) [inline]

Definition at line 22 of file OaHelp.Inl.

{ m_pStr = SysAllocString(pSrc); }

CBSTR::~CBSTR ( ) [inline]

Definition at line 23 of file OaHelp.Inl.

{ if (m_pStr) SysFreeString(m_pStr); }

CBSTR::CBSTR ( ) [inline]

Definition at line 19 of file OaHelp.Inl.

{ m_pStr = 0; }

CBSTR::CBSTR ( LPWSTR pSrc ) [inline]

Definition at line 20 of file OaHelp.Inl.

{ m_pStr = SysAllocString(pSrc); }

CBSTR::~CBSTR ( ) [inline]

Definition at line 21 of file OaHelp.Inl.

{ if (m_pStr) SysFreeString(m_pStr); }

Member Function Documentation

CBSTR::operator BSTR ( ) [inline]

Definition at line 24 of file OaHelp.Inl.

{ return m_pStr; }

CBSTR::operator BSTR ( ) [inline]

Definition at line 22 of file OaHelp.Inl.

{ return m_pStr; }

void CBSTR::Unbind ( ) [inline]

Definition at line 24 of file OaHelp.Inl.

{ m_pStr = 0; }

void CBSTR::Unbind ( ) [inline]

Definition at line 26 of file OaHelp.Inl.

{ m_pStr = 0; }

Member Data Documentation

BSTR CBSTR::m_pStr [private]

Definition at line 19 of file OaHelp.Inl.

The documentation for this class was generated from the following files:
  • SysMgmt/WMI/VC/EventProvider/OaHelp.Inl
  • SysMgmt/WMI/VC/TempConsumer/OaHelp.Inl
Generated on Wed Nov 13 2024 16:55:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CButtonLite Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CButtonLite Class Reference

#include "cdialoglite.h"

Inherits CWndLite.

List of all members.

Public Member Functions

CButtonLite (HWND hWndParent=NULL, UINT nID=0)
virtual | ~CButtonLite ()
virtual BOOL | CheckButton (UINT uCheck)
virtual UINT | IsButtonChecked ()

Detailed Description

Definition at line 853 of file cdialoglite.h.

Constructor & Destructor Documentation

CButtonLite::CButtonLite | ( | HWND | hWndParent = NULL,
 |  | UINT | nID = 0
 | ) |  |

Definition at line 3688 of file cdialoglite.cpp.

  : CWndLite(hWndParent, nID)
{
}

CButtonLite::~CButtonLite ( ) [virtual]

Definition at line 3698 of file cdialoglite.cpp.

{
}

Member Function Documentation

virtual BOOL CButtonLite::CheckButton ( UINT uCheck ) [inline, virtual]

Definition at line 862 of file cdialoglite.h.

{ ASSERT(uCheck == BST_CHECKED || uCheck == BST_UNCHECKED || BST_INDETERMINATE); return ::CheckDlgButton(m_hWndParent, m_nID, uCheck);    }

virtual UINT CButtonLite::IsButtonChecked ( ) [inline, virtual]

Definition at line 861 of file cdialoglite.h.

{ return ::IsDlgButtonChecked(m_hWndParent, m_nID);             }

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialoglite.h
  • Dataaccess/oledb/rowsetviewer/cdialoglite.cpp
Generated on Wed Nov 13 2024 16:55:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CByotTransObj Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CByotTransObj Class Reference

#include "BYOTtransObj.h"

List of all members.

Public Member Functions

CByotTransObj ()
STDMETHOD() | AbortTransaction ()
STDMETHOD() | BeginTransaction ()
STDMETHOD() | CommitTransaction ()
STDMETHOD() | get_TipURL (BSTR *pVal)
STDMETHOD() | InterfaceSupportsErrorInfo (REFIID riid)

Detailed Description

Definition at line 12 of file BYOTtransObj.h.

Constructor & Destructor Documentation

CByotTransObj::CByotTransObj ( ) [inline]

Definition at line 19 of file BYOTtransObj.h.

  {
  }

Member Function Documentation

STDMETHODIMP CByotTransObj::AbortTransaction ( )

Definition at line 52 of file BYOTtransObj.Cpp.

{
  HRESULT       hr      = S_OK;
  IObjectContext*   pObjCtx   = NULL;

  // TODO: Add your implementation code here

  hr = GetObjectContext(&pObjCtx);
  if (FAILED(hr))
    return hr;

  hr = pObjCtx->SetAbort ();
  if (FAILED(hr))
    return hr;

  return hr;
}

STDMETHODIMP CByotTransObj::BeginTransaction ( )

Definition at line 26 of file BYOTtransObj.Cpp.

{
  // TODO: Add your implementation code here
  return S_OK;
}

STDMETHODIMP CByotTransObj::CommitTransaction ( )

Definition at line 32 of file BYOTtransObj.Cpp.

{
  // TODO: Add your implementation code here

  HRESULT       hr      = S_OK;
  IObjectContext*   pObjCtx   = NULL;

  // TODO: Add your implementation code here

  hr = GetObjectContext(&pObjCtx);
  if (FAILED(hr))
    return hr;

  hr = pObjCtx->SetComplete ();
  if (FAILED(hr))
    return hr;

  return hr;
}

STDMETHODIMP CByotTransObj::get_TipURL ( BSTR * pVal )

Definition at line 70 of file BYOTtransObj.Cpp.

{
  HRESULT       hr      = S_OK;
  IObjectContext*   pObjCtx   = NULL;
  IObjectContextTip*  pObjCtxTip  = NULL;
  BSTR          bstrTipURL  = NULL;

  // TODO: Add your implementation code here
  if (!pVal)
    return E_POINTER;

  hr = GetObjectContext(&pObjCtx);
  if (FAILED(hr))
    goto ErrorExit;

  hr = pObjCtx->QueryInterface (IID_IObjectContextTip, (void**)&pObjCtxTip);
  if (FAILED(hr))
    goto ErrorExit;

  hr = pObjCtxTip->GetTipUrl(&bstrTipURL);
  if (FAILED(hr))
    goto ErrorExit;

ErrorExit:

  *pVal = bstrTipURL;

  if (pObjCtxTip)
    pObjCtxTip->Release();
  if (pObjCtx)
    pObjCtx->Release ();

  return hr;
}

STDMETHODIMP CByotTransObj::InterfaceSupportsErrorInfo ( REFIID riid )

Definition at line 12 of file BYOTtransObj.Cpp.

{
  static const IID* arr[] =
  {
    &IID_IByotTransaction
  };
  for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++)
  {
    if (::InlineIsEqualGUID(*arr[i],riid))
      return S_OK;
  }
  return S_FALSE;
}

The documentation for this class was generated from the following files:
  • Com/Services/BYOT/Client/BYOTTransaction/BYOTtransObj.h
  • Com/Services/BYOT/Client/BYOTTransaction/BYOTtransObj.Cpp
Generated on Wed Nov 13 2024 16:55:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCacheMapEl Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes | Static Private Attributes

CCacheMapEl Class Reference

#include "BasicHiPerf.h"

List of all members.

Public Member Functions

CCacheMapEl (long lIndex)
long | GetUID ()

Private Attributes

long | m_lIndex
long | m_lUID

Static Private Attributes

static long | m_lGenID = MAX_ENUMERATORS

Detailed Description

Definition at line 131 of file BasicHiPerf.h.

Constructor & Destructor Documentation

CCacheMapEl::CCacheMapEl ( long lIndex ) [inline]

Definition at line 144 of file BasicHiPerf.h.

                           : m_lIndex(lIndex), m_lUID(m_lGenID++)
  {}

Member Function Documentation

long CCacheMapEl::GetUID ( ) [inline]

Definition at line 147 of file BasicHiPerf.h.

{return m_lUID;}

Member Data Documentation

long CCacheMapEl::m_lGenID = MAX_ENUMERATORS [static, private]

Definition at line 133 of file BasicHiPerf.h.

long CCacheMapEl::m_lIndex [private]

Definition at line 141 of file BasicHiPerf.h.

long CCacheMapEl::m_lUID [private]

Definition at line 137 of file BasicHiPerf.h.

The documentation for this class was generated from the following files:
  • SysMgmt/WMI/VC/HiPerfProvider/BasicHiPerf.h
  • SysMgmt/WMI/VC/HiPerfProvider/BasicHiPerf.Cpp
Generated on Wed Nov 13 2024 16:55:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCallAs Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CCallAs Class Reference

List of all members.

Public Member Functions

CCallAs ()
ULONG STDMETHODCALLTYPE | AddRef ()
MyBoolean __stdcall | HelloProc (unsigned char *pszString)
void | operator delete (void *pv)
void * | operator new (size_t s)
HRESULT STDMETHODCALLTYPE | QueryInterface (REFIID iid, void **ppv)
ULONG STDMETHODCALLTYPE | Release ()

Private Attributes

unsigned long | RefCount

Detailed Description

Definition at line 111 of file Server.Cxx.

Constructor & Destructor Documentation

CCallAs::CCallAs ( ) [inline]

Definition at line 134 of file Server.Cxx.

                                {
                                RefCount    = 0;
                                }

Member Function Documentation

ULONG STDMETHODCALLTYPE CCallAs::AddRef ( )

Definition at line 419 of file Server.Cxx.

{
    IncrementRefCount(RefCount);
        return RefCount;
}

MyBoolean __stdcall CCallAs::HelloProc ( unsigned char * pszString )

Definition at line 476 of file Server.Cxx.

{
    printf("HelloProc: %s \n", pszString);
    printf(" <pausing for 5 sec>\n");
    // pretend to be busy computing for a bit
    Sleep( 5000 ); // 5000 msec = 5 sec

    return TRUE;
}

void CCallAs::operator delete ( void * pv ) [inline]

Definition at line 144 of file Server.Cxx.

                                {
                                CoTaskMemFree( pv );
                                }

void* CCallAs::operator new ( size_t s ) [inline]

Definition at line 139 of file Server.Cxx.

                                {
                                return CoTaskMemAlloc( s );
                                }

HRESULT STDMETHODCALLTYPE CCallAs::QueryInterface | ( | REFIID | iid,
 |  | void ** | ppv
 | ) |  |

Definition at line 390 of file Server.Cxx.

{
    HRESULT hr = E_NOINTERFACE;

        assert(ppv);

    *ppv = 0;
    if ( IsEqualGUID( iid, IID_IUnknown ) ||
         IsEqualGUID( iid, IID_IHelloCallAs ) )
    {
        *ppv = this;
                AddRef();
            hr = S_OK;
    }

    return hr;
}

ULONG STDMETHODCALLTYPE CCallAs::Release ( )

Definition at line 435 of file Server.Cxx.

{
        long t;
        unsigned long count;

    t = DecrementRefCount(RefCount);

        if(t == 0)
        {
                count = 0;

                //decrement the object count
                if(DecrementRefCount(ObjectCount) == 0)
                {
                        //The last object has been destroyed.
                        PostQuitMessage(0);
                }
                delete this;
        }
        else
                count = RefCount;

    return count;
}

Member Data Documentation

unsigned long CCallAs::RefCount [private]

Definition at line 115 of file Server.Cxx.

The documentation for this class was generated from the following file:
  • Com/Fundamentals/Object/CallAs/Server.Cxx
Generated on Wed Nov 13 2024 16:55:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCallAsFactory Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CCallAsFactory Class Reference

List of all members.

Public Member Functions

CCallAsFactory ()
ULONG STDMETHODCALLTYPE | AddRef ()
HRESULT STDMETHODCALLTYPE | CreateInstance (IUnknown *punkOuter, REFIID riid, void **ppv)
HRESULT STDMETHODCALLTYPE | LockServer (BOOL fLock)
HRESULT STDMETHODCALLTYPE | QueryInterface (REFIID iid, void **ppv)
ULONG STDMETHODCALLTYPE | Release ()

Public Attributes

unsigned long | RefCount

Detailed Description

Definition at line 73 of file Server.Cxx.

Constructor & Destructor Documentation

CCallAsFactory::CCallAsFactory ( ) [inline]

Definition at line 81 of file Server.Cxx.

                                {
                                RefCount    = 0;
                                }

Member Function Documentation

ULONG STDMETHODCALLTYPE CCallAsFactory::AddRef ( )

Definition at line 277 of file Server.Cxx.

{
    IncrementRefCount(RefCount);
        return RefCount;
}

HRESULT STDMETHODCALLTYPE CCallAsFactory::CreateInstance | ( | IUnknown * | punkOuter,
 |  | REFIID | riid,
 |  | void ** | ppv
 | ) |  |

Definition at line 325 of file Server.Cxx.

{
    HRESULT hr = E_OUTOFMEMORY;
        CCallAs *pCallAs;

        assert(ppv);

        *ppv = 0;

        if(fClassRegistered == TRUE)
        {
                fClassRegistered = FALSE;
                CoRevokeClassObject(dwHandle);
        }

        pCallAs = new CCallAs();
        if(pCallAs)
        {
            // invoke the constructor
                *pCallAs = CCallAs();

                //increment the object count.
                //The object count will keep this process alive until all
                //objects are released.
                IncrementRefCount(ObjectCount);
                hr = pCallAs->QueryInterface( riid, ppv);
        }

    return hr;
}

HRESULT STDMETHODCALLTYPE CCallAsFactory::LockServer ( BOOL fLock )

Definition at line 368 of file Server.Cxx.

{
    if ( fLock )
            IncrementRefCount( ObjectCount );
        else
            DecrementRefCount( ObjectCount );

        return S_OK;

}

HRESULT STDMETHODCALLTYPE CCallAsFactory::QueryInterface | ( | REFIID | iid,
 |  | void ** | ppv
 | ) |  |

Definition at line 246 of file Server.Cxx.

{
    HRESULT hr = E_NOINTERFACE;

        assert(ppv);

    *ppv = 0;
    if ( IsEqualGUID( iid, IID_IUnknown) ||
         IsEqualGUID( iid, IID_IClassFactory ) )
    {
        *ppv = this;
                AddRef();
            hr = S_OK;
    }

    return hr;
}

ULONG STDMETHODCALLTYPE CCallAsFactory::Release ( )

Definition at line 293 of file Server.Cxx.

{
        long t;
        unsigned long count;

    t = DecrementRefCount(RefCount);

        if(t == 0)
        {
                count = 0;
                //decrement the object count
                if(DecrementRefCount(ObjectCount) == 0)
                {
                        //The last object has been destroyed.
                        PostQuitMessage(0);
                }
        }
        else
                count = RefCount;

    return count;
}

Member Data Documentation

unsigned long CCallAsFactory::RefCount

Definition at line 79 of file Server.Cxx.

The documentation for this class was generated from the following file:
  • Com/Fundamentals/Object/CallAs/Server.Cxx
Generated on Wed Nov 13 2024 16:55:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCallBack Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CCallBack Class Reference

#include "callbackclient.h"

Inherits ISynchronize.

List of all members.

Public Member Functions

CCallBack ()
STDMETHOD() | CallBack ()
DECLARE_AGGREGATABLE (CCallBack)
DECLARE_GET_CONTROLLING_UNKNOWN ()
HRESULT | FinalConstruct ()
HRESULT | FinalRelease ()
STDMETHOD() | MyQuery (REFIID riid, LPVOID *ppv)
STDMETHOD() | Reset ()
STDMETHOD() | Signal ()
STDMETHOD() | StartCall (int i, int j)
STDMETHOD() | Wait (DWORD flags, DWORD timeout)

Public Attributes

COM_INTERFACE_ENTRY_FUNC_BLIND(0,
QueryFunc) private IUnknown * 		m_pCallObjUnk

Detailed Description

Definition at line 39 of file callbackclient.h.

Constructor & Destructor Documentation

CCallBack::CCallBack ( ) [inline]

Definition at line 44 of file callbackclient.h.

  {
    m_pCallObjUnk = NULL;
  }

Member Function Documentation

STDMETHODIMP CCallBack::CallBack ( )

Definition at line 160 of file callbackclient.Cpp.

                                {

  HRESULT hr;
  AsyncIFullServ * pAsyncIFullServ;
  int i;

  cout<<"Recieved a Call Back"<<endl;

  //Get Async interface
  hr = QueryInterface(IID_AsyncIFullServ,(void**)&pAsyncIFullServ);
  _ASSERT(SUCCEEDED(hr));

  //Finish the call
  hr = pAsyncIFullServ->Finish_Sum(&i);
  if(FAILED(hr)){
    cerr<<"Finish_Sum failed"<<endl;
  }else{
    cout<<"Sum of 2 and 3 is: "<<i<<endl;
  }

  pAsyncIFullServ->Release();

  return S_OK;
}

CCallBack::DECLARE_AGGREGATABLE ( CCallBack )
CCallBack::DECLARE_GET_CONTROLLING_UNKNOWN ( )
HRESULT CCallBack::FinalConstruct ( ) [inline]

Definition at line 49 of file callbackclient.h.

                          {
    //Create contained sync object
    return CoCreateInstance(CLSID_ManualResetEvent,NULL,CLSCTX_INPROC_SERVER,IID_ISynchronize,(void**)&smartPtrISynchronize.p);
  }

HRESULT CCallBack::FinalRelease ( ) [inline]

Definition at line 54 of file callbackclient.h.

                        {
    //Release the call object
    if(m_pCallObjUnk) m_pCallObjUnk->Release();
    return S_OK;
  }

STDMETHODIMP CCallBack::MyQuery | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 205 of file callbackclient.Cpp.

                                                       {

  if(!m_pCallObjUnk)
    return E_NOINTERFACE;

  return m_pCallObjUnk->QueryInterface(riid,ppv);
}

STDMETHODIMP CCallBack::Reset ( void )

Definition at line 129 of file callbackclient.Cpp.

                             {
  return smartPtrISynchronize->Reset();
}

STDMETHODIMP CCallBack::Signal ( )

Definition at line 149 of file callbackclient.Cpp.

                              {
  smartPtrISynchronize->Signal();
  CallBack();
  return S_OK;
}

STDMETHODIMP CCallBack::StartCall | ( | int | i,
 |  | int | j
 | ) |  |

Definition at line 82 of file callbackclient.Cpp.

                                             {

  HRESULT hr = S_OK;
  ICallFactory * pICallFactory = NULL;
  IUnknown * pIUnknown = NULL;
  AsyncIFullServ * pAsyncIFullServ = NULL;

  //Create FullServ
  hr = CoCreateInstance(CLSID_FullServ,NULL,CLSCTX_SERVER,IID_IUnknown,(void**)&pIUnknown);
  if(FAILED(hr))
    return hr;

  //Get ICallFactory
  hr = pIUnknown->QueryInterface(IID_ICallFactory,(void**)&pICallFactory);
  if(FAILED(hr))
    goto CleanUp;

  //Create and aggregate the call object
  hr = pICallFactory->CreateCall(IID_AsyncIFullServ,GetControllingUnknown(),IID_IUnknown,(IUnknown**)&m_pCallObjUnk);
  if(FAILED(hr))
    goto CleanUp;

  //Get the Async interface and begin the call
  hr = QueryInterface(IID_AsyncIFullServ,(void**)&pAsyncIFullServ);
  if(FAILED(hr))
    goto CleanUp;

  hr = pAsyncIFullServ->Begin_Sum(i,j);

  if(SUCCEEDED(hr))
  cout<<"Call sent to the server"<<endl;

  //Release all but the call object's unk
CleanUp:
  if(pIUnknown) pIUnknown->Release();
  if(pICallFactory) pICallFactory->Release();
  if(pAsyncIFullServ) pAsyncIFullServ->Release();
  return hr;
}

STDMETHODIMP CCallBack::Wait | ( | DWORD | flags,
 |  | DWORD | timeout
 | ) |  |

Definition at line 137 of file callbackclient.Cpp.

                                                     {
  return smartPtrISynchronize->Wait(flags,timeout);
}

Member Data Documentation

COM_INTERFACE_ENTRY_FUNC_BLIND (0, QueryFunc ) private IUnknown* CCallBack::m_pCallObjUnk

Definition at line 68 of file callbackclient.h.

The documentation for this class was generated from the following files:
  • Com/Fundamentals/AsyncCalls/CallBackClient/callbackclient.h
  • Com/Fundamentals/AsyncCalls/CallBackClient/callbackclient.Cpp
Generated on Wed Nov 13 2024 16:55:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCallbackWrapper Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CCallbackWrapper Class Reference

#include "Handler.h"

List of all members.

Public Member Functions

CCallbackWrapper (HWND hwndCallback)
~CCallbackWrapper ()
STDMETHODIMP | DeleteLogError (REFSYNCMGRERRORID ErrorID, DWORD dwReserved)
STDMETHODIMP | EnableModeless (BOOL fEnable)
STDMETHODIMP | EstablishConnection (WCHAR const *lpwszConnection, DWORD dwReserved)
STDMETHODIMP | LogError (DWORD dwErrorLevel, const WCHAR *lpcErrorText, LPSYNCMGRLOGERRORINFO lpSyncLogError)
STDMETHODIMP | PrepareForSyncCompleted (HRESULT hr)
STDMETHODIMP | Progress (REFSYNCMGRITEMID ItemID, LPSYNCMGRPROGRESSITEM lpSyncProgressItem)
STDMETHODIMP | QueryInterface (REFIID, LPVOID FAR *)
STDMETHODIMP | ShowErrorCompleted (HRESULT hr, ULONG cbNumItems, SYNCMGRITEMID *pItemIDs)
STDMETHODIMP | ShowPropertiesCompleted (HRESULT hr)
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP | SynchronizeCompleted (HRESULT hr)

Private Attributes

ULONG m_cRef
HWND | m_hwndCallback

Detailed Description

Definition at line 140 of file Handler.h.

Constructor & Destructor Documentation

CCallbackWrapper::CCallbackWrapper ( HWND hwndCallback )

Definition at line 2664 of file Handler.Cpp.

{

    Assert(hwndCallback);

    m_hwndCallback = hwndCallback;
    m_cRef = 1;

}

CCallbackWrapper::~CCallbackWrapper ( )

Definition at line 2674 of file Handler.Cpp.

{
    m_hwndCallback = NULL;

    Assert(0 == m_cRef);
}

Member Function Documentation

STDMETHODIMP CCallbackWrapper::DeleteLogError | ( | REFSYNCMGRERRORID | ErrorID,
 |  | DWORD | dwReserved
 | ) |  |

Definition at line 2846 of file Handler.Cpp.

{
METHODARGS MethodArgs;

    MethodArgs.fAsync = FALSE;
    MethodArgs.hr = E_UNEXPECTED;

    MethodArgs.dwWorkerMsg = WM_WORKERMSG_DELETELOGERROR;
    MethodArgs.DeleteLogErrorMsg.ErrorID = ErrorID;
    MethodArgs.DeleteLogErrorMsg.dwReserved = dwReserved;

    if (m_hwndCallback)
    {
        SendMessage(m_hwndCallback,MethodArgs.dwWorkerMsg,0,(LPARAM) &MethodArgs);
    }

    return MethodArgs.hr;
}

STDMETHODIMP CCallbackWrapper::EnableModeless ( BOOL fEnable )

Definition at line 2807 of file Handler.Cpp.

{
METHODARGS MethodArgs;

    MethodArgs.fAsync = FALSE;
    MethodArgs.hr = E_UNEXPECTED;

    MethodArgs.dwWorkerMsg = WM_WORKERMSG_ENABLEMODELESS;
    MethodArgs.EnableModelessMsg.fEnable = fEnable;

    if (m_hwndCallback)
    {
        SendMessage(m_hwndCallback,MethodArgs.dwWorkerMsg,0,(LPARAM) &MethodArgs);
    }

    return MethodArgs.hr;
}

STDMETHODIMP CCallbackWrapper::EstablishConnection | ( | WCHAR const * | lpwszConnection,
 |  | DWORD | dwReserved
 | ) |  |

Definition at line 2866 of file Handler.Cpp.

{
METHODARGS MethodArgs;

    MethodArgs.fAsync = FALSE;
    MethodArgs.hr = E_UNEXPECTED;

    MethodArgs.dwWorkerMsg = WM_WORKERMSG_ESTABLISHCONNECTION;
    MethodArgs.EstablishConnectionMsg.lpwszConnection = lpwszConnection;
    MethodArgs.EstablishConnectionMsg.dwReserved = dwReserved;

    if (m_hwndCallback)
    {
        SendMessage(m_hwndCallback,MethodArgs.dwWorkerMsg,0,(LPARAM) &MethodArgs);
    }

    return MethodArgs.hr;
}

STDMETHODIMP CCallbackWrapper::LogError | ( | DWORD | dwErrorLevel,
 |  | const WCHAR * | lpcErrorText,
 |  | LPSYNCMGRLOGERRORINFO | lpSyncLogError
 | ) |  |

Definition at line 2825 of file Handler.Cpp.

{
METHODARGS MethodArgs;

    MethodArgs.fAsync = FALSE;
    MethodArgs.hr = E_UNEXPECTED;

    MethodArgs.dwWorkerMsg = WM_WORKERMSG_LOGERROR;
    MethodArgs.LogErrorMsg.dwErrorLevel = dwErrorLevel;
    MethodArgs.LogErrorMsg.lpcErrorText = lpcErrorText;
    MethodArgs.LogErrorMsg.lpSyncLogError = lpSyncLogError;

    if (m_hwndCallback)
    {
        SendMessage(m_hwndCallback,MethodArgs.dwWorkerMsg,0,(LPARAM) &MethodArgs);
    }

    return MethodArgs.hr;
}

STDMETHODIMP CCallbackWrapper::PrepareForSyncCompleted ( HRESULT hr )

Definition at line 2732 of file Handler.Cpp.

{
METHODARGS MethodArgs;

    MethodArgs.fAsync = FALSE;
    MethodArgs.hr = E_UNEXPECTED;

    MethodArgs.dwWorkerMsg = WM_WORKERMSG_PREPAREFORSYNCCOMPLETED;
    MethodArgs.PrepareForSyncCompletedMsg.hr = hr;

    if (m_hwndCallback)
    {
        SendMessage(m_hwndCallback,MethodArgs.dwWorkerMsg,0,(LPARAM) &MethodArgs);
    }

    return MethodArgs.hr;
}

STDMETHODIMP CCallbackWrapper::Progress | ( | REFSYNCMGRITEMID | ItemID,
 |  | LPSYNCMGRPROGRESSITEM | lpSyncProgressItem
 | ) |  |

Definition at line 2712 of file Handler.Cpp.

{
METHODARGS MethodArgs;

    MethodArgs.fAsync = FALSE;
    MethodArgs.hr = E_UNEXPECTED;

    MethodArgs.dwWorkerMsg = WM_WORKERMSG_PROGRESS;
    MethodArgs.ProgressMsg.ItemID = ItemID;
    MethodArgs.ProgressMsg.lpSyncProgressItem = lpSyncProgressItem;

    if (m_hwndCallback)
    {
        SendMessage(m_hwndCallback,MethodArgs.dwWorkerMsg,0,(LPARAM) &MethodArgs);
    }

    return MethodArgs.hr;
}

STDMETHODIMP CCallbackWrapper::QueryInterface | ( | REFIID | ,
 |  | LPVOID FAR * |
 | ) |  |

Definition at line 2683 of file Handler.Cpp.

{
    return E_NOTIMPL;
}

STDMETHODIMP CCallbackWrapper::ShowErrorCompleted | ( | HRESULT | hr,
 |  | ULONG | cbNumItems,
 |  | SYNCMGRITEMID * | pItemIDs
 | ) |  |

Definition at line 2787 of file Handler.Cpp.

{
METHODARGS MethodArgs;

    MethodArgs.fAsync = FALSE;
    MethodArgs.hr = E_UNEXPECTED;

    MethodArgs.dwWorkerMsg = WM_WORKERMSG_SHOWERRORCOMPLETED;
    MethodArgs.ShowErrorCompletedMsg.hr = hr;
    MethodArgs.ShowErrorCompletedMsg.cbNumItems = cbNumItems;
    MethodArgs.ShowErrorCompletedMsg.pItemIDs = pItemIDs;

    if (m_hwndCallback)
    {
        SendMessage(m_hwndCallback,MethodArgs.dwWorkerMsg,0,(LPARAM) &MethodArgs);
    }

    return MethodArgs.hr;
}

STDMETHODIMP CCallbackWrapper::ShowPropertiesCompleted ( HRESULT hr )

Definition at line 2768 of file Handler.Cpp.

{
METHODARGS MethodArgs;

    MethodArgs.fAsync = FALSE;
    MethodArgs.hr = E_UNEXPECTED;

    MethodArgs.dwWorkerMsg = WM_WORKERMSG_SHOWPROPERTIESCOMPLETED;
    MethodArgs.ShowPropertiesCompletedMsg.hr = hr;

    if (m_hwndCallback)
    {
        SendMessage(m_hwndCallback,MethodArgs.dwWorkerMsg,0,(LPARAM) &MethodArgs);
    }

    return MethodArgs.hr;

}

CCallbackWrapper::STDMETHODIMP_ ( ULONG )
CCallbackWrapper::STDMETHODIMP_ ( ULONG )
STDMETHODIMP CCallbackWrapper::SynchronizeCompleted ( HRESULT hr )

Definition at line 2750 of file Handler.Cpp.

{
METHODARGS MethodArgs;

    MethodArgs.fAsync = FALSE;
    MethodArgs.hr = E_UNEXPECTED;

    MethodArgs.dwWorkerMsg = WM_WORKERMSG_SYNCHRONIZECOMPLETED;
    MethodArgs.SynchronizeCompletedMsg.hr = hr;

    if (m_hwndCallback)
    {
        SendMessage(m_hwndCallback,MethodArgs.dwWorkerMsg,0,(LPARAM) &MethodArgs);
    }

    return MethodArgs.hr;
}

Member Data Documentation

ULONG CCallbackWrapper::m_cRef [private]

Definition at line 164 of file Handler.h.

HWND CCallbackWrapper::m_hwndCallback [private]

Definition at line 165 of file Handler.h.

The documentation for this class was generated from the following files:
  • NetDS/SyncMgr/SyncDir/Handler.h
  • NetDS/SyncMgr/SyncDir/Handler.Cpp
Generated on Wed Nov 13 2024 16:55:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCallNotify Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CCallNotify Class Reference

#include "CCall.h"

Inherits RefCount, CNotify, RefCount, and CNotify.

List of all members.

Public Member Functions

CCallNotify ()
CCallNotify (Conf *)
~CCallNotify ()
virtual | ~CCallNotify ()
HRESULT STDMETHODCALLTYPE | Accepted (INmConference *pConference)
HRESULT STDMETHODCALLTYPE | Accepted (INmConference *pConference)
ULONG STDMETHODCALLTYPE | AddRef (void)
ULONG STDMETHODCALLTYPE | AddRef (void)
HRESULT | Connect (IUnknown *pUnkOuter)
HRESULT STDMETHODCALLTYPE | Connect (IUnknown *pUnk)
HRESULT STDMETHODCALLTYPE | Disconnect (void)
HRESULT | Disconnect (void)
HRESULT STDMETHODCALLTYPE | Failed (ULONG uError)
HRESULT STDMETHODCALLTYPE | Failed (ULONG uError)
HRESULT STDMETHODCALLTYPE | NmUI (CONFN uNotify)
HRESULT STDMETHODCALLTYPE | NmUI (CONFN uNotify)
HRESULT STDMETHODCALLTYPE | QueryInterface (REFIID riid, PVOID *ppvObject)
HRESULT STDMETHODCALLTYPE | QueryInterface (REFIID riid, PVOID *ppvObj)
ULONG STDMETHODCALLTYPE | Release (void)
ULONG STDMETHODCALLTYPE | Release (void)
HRESULT STDMETHODCALLTYPE | StateChanged (NM_CALL_STATE uState)
HRESULT STDMETHODCALLTYPE | StateChanged (NM_CALL_STATE uState)

Private Member Functions

CCallNotify ()

Private Attributes

Conf * m_pConf

Detailed Description

Definition at line 21 of file CCall.h.

Constructor & Destructor Documentation

CCallNotify::CCallNotify ( )

Definition at line 140 of file CCall.Cpp.

                         : RefCount(), CNotify()
{
  OBJECT_MSG(TEXT("CCallNotify created"));
}

CCallNotify::~CCallNotify ( )

Definition at line 145 of file CCall.Cpp.

{
  OBJECT_MSG(TEXT("CCallNotify destroyed"));
}

CCallNotify::CCallNotify ( ) [private]
CCallNotify::CCallNotify ( Conf * pConf )

Definition at line 675 of file nmsession.cpp.

{
    m_pConf = pConf;
}

virtual CCallNotify::~CCallNotify ( ) [virtual]

Member Function Documentation

HRESULT STDMETHODCALLTYPE CCallNotify::Accepted ( INmConference * pConference )

Definition at line 271 of file CCall.Cpp.

{
  NOTIFY_MSG(TEXT("CCallNotify::Accepted"));
  DumpConferenceInfo(pConference);
  return S_OK;
}

HRESULT STDMETHODCALLTYPE CCallNotify::Accepted ( INmConference * pConference )
ULONG STDMETHODCALLTYPE CCallNotify::AddRef ( void )
ULONG STDMETHODCALLTYPE CCallNotify::AddRef ( void )

Definition at line 157 of file CCall.Cpp.

{
  return RefCount::AddRef();
}

HRESULT CCallNotify::Connect ( IUnknown * pUnk )

Definition at line 208 of file CCall.Cpp.

{
  return CNotify::Connect(pUnk, IID_INmCallNotify, (IUnknown *)this);
}

HRESULT CCallNotify::Connect ( IUnknown * pUnkOuter )
HRESULT CCallNotify::Disconnect ( void )

Reimplemented from CNotify.

HRESULT CCallNotify::Disconnect ( void )

Reimplemented from CNotify.

Definition at line 213 of file CCall.Cpp.

{
  return CNotify::Disconnect();
}

HRESULT STDMETHODCALLTYPE CCallNotify::Failed ( ULONG uError )
HRESULT STDMETHODCALLTYPE CCallNotify::Failed ( ULONG uError )

Definition at line 258 of file CCall.Cpp.

{
  LOG_MSG(RGB(255, 0, 0), TEXT("CCallNotify::Failed uError=%08X"), uError);
  return S_OK;
}

HRESULT STDMETHODCALLTYPE CCallNotify::NmUI ( CONFN uNotify )
HRESULT STDMETHODCALLTYPE CCallNotify::NmUI ( CONFN uNotify )

Definition at line 285 of file CCall.Cpp.

{
  LOG_MSG(RGB(255, 0, 255), TEXT("CCallNotify::NmUI uNotify=%s"), GetConfnSz(uNotify));
  return S_OK;
}

HRESULT STDMETHODCALLTYPE CCallNotify::QueryInterface | ( | REFIID | riid,
 |  | PVOID * | ppvObj
 | ) |  |

Definition at line 168 of file CCall.Cpp.

{
  HRESULT hr = S_OK;

  if  (NULL == ppvObject)
    return E_POINTER;

  if (riid == IID_IUnknown)
  {
    *ppvObject = (IUnknown *)this;
    OBJECT_MSG(TEXT("CCallNotify::QueryInterface(): Returning IUnknown."));
  }
  else if (riid == IID_INmCallNotify)
  {
    *ppvObject = (INmCallNotify *)this;
    OBJECT_MSG(TEXT("CCallNotify::QueryInterface(): Returning INmCallNotify."));
  }
  else
  {
    hr = E_NOINTERFACE;
    *ppvObject = NULL;
    OBJECT_MSG(TEXT("CCallNotify::QueryInterface(): Called on unknown interface."));
  }

  if SUCCEEDED(hr)
  {
    AddRef();
  }

  return hr;
}

HRESULT STDMETHODCALLTYPE CCallNotify::QueryInterface | ( | REFIID | riid,
 |  | PVOID * | ppvObject
 | ) |  |
ULONG STDMETHODCALLTYPE CCallNotify::Release ( void )

Definition at line 163 of file CCall.Cpp.

{
  return RefCount::Release();
}

ULONG STDMETHODCALLTYPE CCallNotify::Release ( void )
HRESULT STDMETHODCALLTYPE CCallNotify::StateChanged ( NM_CALL_STATE uState )
HRESULT STDMETHODCALLTYPE CCallNotify::StateChanged ( NM_CALL_STATE uState )

Definition at line 232 of file CCall.Cpp.

{
  INmCall * pINmCall  = (INmCall *) CNotify::GetPunk();

  STATE_MSG(TEXT("CCallNotify::StateChanged uState=%s"), GetCallStateSz(uState));

  if  (NULL != pINmCall)
  {
    DumpCallInfo((INmCall *) CNotify::GetPunk());
    STATE_MSG(TEXT("Call direction is %d"), ((INmCall *)CNotify::GetPunk())->IsIncoming());
  }
  else
  {
    WARN_MSG(TEXT("CCallNotify::StateChanged when pINmCall == NULL"));
  }

  return S_OK;
}

Member Data Documentation

Conf* CCallNotify::m_pConf [private]

Definition at line 45 of file nmsession.h.

The documentation for this class was generated from the following files:
  • Web/NetMeeting/NMUI/CCall.h
  • Web/NetMeeting/PlugTransport/nmsession.h
  • Web/NetMeeting/NMUI/CCall.Cpp
  • Web/NetMeeting/PlugTransport/nmsession.cpp
Generated on Wed Nov 13 2024 16:55:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCanvas Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Protected Attributes

CCanvas Class Reference

#include "Canvas.Hxx"

Inherited by CPaintCanvas, CPrintCanvas, and CScreenCanvas.

List of all members.

Public Member Functions

CCanvas ()
void | Char (int x, int y, TCHAR ch)
void | Circle (int x, int y, int r)
void | Clear (RECT &rect)
void | DPtoLP (LPPOINT lppt)
void | Line (COORD x1, COORD y1, COORD x2, COORD y2)
void | LPtoDP (LPPOINT lppt)
operator HDC ()
void | RCText (LPRECT lprc, LPTSTR buf, int cBuf)
void | Scale (UINT iScale)
void | Scroll (int dx, int dy)
void | Text (int x, int y, LPTSTR buf, int cBuf)
void | TextAlign (WORD aligntype)

Protected Member Functions

void | Init (HDC hdc)

Protected Attributes

HDC | _hdc

Detailed Description

Definition at line 38 of file Canvas.Hxx.

Constructor & Destructor Documentation

CCanvas::CCanvas ( ) [inline]

Definition at line 41 of file Canvas.Hxx.

             :_hdc(0)
    {
    }

Member Function Documentation

void CCanvas::Char | ( | int | x,
 |  | int | y,
 |  | TCHAR | ch |
 | ) |  |  | [inline]

Definition at line 74 of file Canvas.Hxx.

    {
        TextOut ( _hdc, x, y,(LPTSTR) &ch, 1 );
    }

void CCanvas::Circle | ( | int | x,
 |  | int | y,
 |  | int | r |
 | ) |  |  | [inline]

Definition at line 80 of file Canvas.Hxx.

    {
        Ellipse (_hdc,  x-r/2, y-r/2, x+r/2, y+r/2 );
    }

void CCanvas::Clear ( RECT & rect ) [inline]

Definition at line 58 of file Canvas.Hxx.

    {
        // Trick: fast erase with Extended Text Out
        ExtTextOut (_hdc, rect.left, rect.top, ETO_OPAQUE, &rect, TEXT(""), 0, NULL );
    }

void CCanvas::DPtoLP ( LPPOINT lppt ) [inline]

Definition at line 100 of file Canvas.Hxx.

    {
        ::DPtoLP(_hdc, lppt, 1);
    };

void CCanvas::Init ( HDC hdc ) [inline, protected]

Definition at line 111 of file Canvas.Hxx.

    {
        _hdc = hdc;
        TextAlign(TA_CENTER | TA_BASELINE );
    };

void CCanvas::Line | ( | COORD | x1,
 |  | COORD | y1,
 |  | COORD | x2,
 |  | COORD | y2 |
 | ) |  |  | [inline]

Definition at line 52 of file Canvas.Hxx.

    {
        MoveToEx ( _hdc, x1, y1, NULL );
        LineTo   ( _hdc, x2, y2 );
    }

void CCanvas::LPtoDP ( LPPOINT lppt ) [inline]

Definition at line 105 of file Canvas.Hxx.

    {
        ::LPtoDP(_hdc, lppt, 1);
    };

CCanvas::operator HDC ( ) [inline]

Definition at line 45 of file Canvas.Hxx.

{ return _hdc; }

void CCanvas::RCText | ( | LPRECT | lprc,
 |  | LPTSTR | buf,
 |  | int | cBuf |
 | ) |  |  | [inline]

Definition at line 69 of file Canvas.Hxx.

    {
        DrawText ( _hdc, buf, cBuf, lprc, DT_LEFT | DT_WORDBREAK | DT_NOCLIP | DT_NOPREFIX);
    }

void CCanvas::Scale ( UINT iScale ) [inline]

Definition at line 85 of file Canvas.Hxx.

    {
        // Logical TWIPS
        SetMapMode (_hdc, MM_ANISOTROPIC);

        SetWindowExtEx (_hdc, MulDiv(INCH1,iScale,100), MulDiv(INCH1,iScale,100), NULL);
        SetViewportExtEx (_hdc, GetDeviceCaps (_hdc, LOGPIXELSX),
                GetDeviceCaps (_hdc, LOGPIXELSY), NULL);
    }

void CCanvas::Scroll | ( | int | dx,
 |  | int | dy |
 | ) |  |  | [inline]

Definition at line 95 of file Canvas.Hxx.

    {
        SetWindowOrgEx(_hdc, dx, dy, NULL );
    }

void CCanvas::Text | ( | int | x,
 |  | int | y,
 |  | LPTSTR | buf,
 |  | int | cBuf |
 | ) |  |  | [inline]

Definition at line 64 of file Canvas.Hxx.

    {
        TextOut ( _hdc, x, y, buf, cBuf );
    }

void CCanvas::TextAlign ( WORD aligntype ) [inline]

Definition at line 47 of file Canvas.Hxx.

    {
        SetTextAlign(_hdc, aligntype );
    }

Member Data Documentation

HDC CCanvas::_hdc [protected]

Definition at line 115 of file Canvas.Hxx.

The documentation for this class was generated from the following file:
  • Multimedia/Gdi/Fonts/GridFont/Canvas.Hxx
Generated on Wed Nov 13 2024 16:55:44 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCapMFCApp Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CCapMFCApp Class Reference

#include "CapMFC.h"

Inherits CWinApp.

List of all members.

Public Member Functions

CCapMFCApp ()
virtual BOOL InitInstance ()

Detailed Description

Definition at line 22 of file CapMFC.h.

Constructor & Destructor Documentation

CCapMFCApp::CCapMFCApp ( )

Definition at line 66 of file CapMFC.Cpp.

                       {
}

Member Function Documentation

BOOL CCapMFCApp::InitInstance ( void ) [virtual]

Reimplemented from CWinApp.

Definition at line 72 of file CapMFC.Cpp.

                              {

  AfxEnableControlContainer();

  // Standard initialization

#ifdef _AFXDLL
  Enable3dControls();     // Call this when using MFC in a shared DLL
#else
  Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif

  CCapMFCDlg dlg;
  m_pMainWnd = &dlg;

  dlg.DoModal();

  return FALSE;
}

The documentation for this class was generated from the following files:
  • Web/MSAgent/c/CapMFC/CapMFC.h
  • Web/MSAgent/c/CapMFC/CapMFC.Cpp
Generated on Wed Nov 13 2024 16:55:44 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCapMFCDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes

CCapMFCDlg Class Reference

#include "MainDlg.h"

List of all members.

Public Types

enum | { IDD = IDD_CAPMFC_DIALOG }

Public Member Functions

CCapMFCDlg (CWnd *pParent=NULL)
virtual void | OnFinalRelease ()

Public Attributes

CAgentCtlEx m_Agent
CListBox | m_Animations
CButton | m_AnimationsLabel
CButton | m_BalloonAutoHide
CButton | m_BalloonAutoPace
CButton | m_BalloonEnabled
CButton | m_BalloonSizeToText
CButton | m_Move
CEdit | m_MoveX
CEdit | m_MoveY
CButton | m_Play
CButton | m_PositionLabel
CButton | m_Sfx
CButton | m_Speak
CEdit | m_SpeakText
CButton | m_SpeechOutputLabel
CButton | m_Stop
CButton | m_StopBeforePlay
CStatic | m_XLabel
CStatic | m_YLabel

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
afx_msg void | OnActivateApp (BOOL bActive, DWORD hTask)
afx_msg void | OnAgentPropertyChange ()
afx_msg void | OnBalloonUse ()
afx_msg void | OnChangeSpeakText ()
virtual BOOL | OnCommand (WPARAM wParam, LPARAM lParam)
afx_msg void | OnCommandAgent (LPDISPATCH UserInput)
afx_msg void | OnDblclkAnimations ()
afx_msg void | OnDropFiles (HDROP hDropInfo)
afx_msg void | OnFileExit ()
afx_msg void | OnFileOpen ()
afx_msg void | OnHelpAbout ()
virtual BOOL | OnInitDialog ()
afx_msg void | OnInitMenuPopup (CMenu *pPopupMenu, UINT uIndex, BOOL bSysMenu)
afx_msg void | OnMove ()
afx_msg void | OnMoveAgent (LPCTSTR CharacterID, short x, short y, short Cause)
afx_msg void | OnPaint ()
afx_msg void | OnPlay ()
afx_msg HCURSOR | OnQueryDragIcon ()
afx_msg void | OnSetFocusAnimations ()
afx_msg void | OnSetFocusMoveX ()
afx_msg void | OnSetFocusMoveY ()
afx_msg void | OnSetFocusSpeakText ()
afx_msg void | OnSfx ()
afx_msg void | OnSpeak ()
afx_msg void | OnStop ()
afx_msg void | OnSysCommand (UINT nID, LPARAM lParam)

Protected Attributes

HICON | m_hIcon

Private Member Functions

void | LoadCharacter (CString pszFilename)
void | MakeEllipsisPath (LPCTSTR pszPath, LPTSTR pszEllipsisPath, UINT cchMaxEllipsisPath)
void | OnRecentFile (UINT uFile)
void | UpdateRecentFiles (LPCTSTR pszFilename)

Private Attributes

BOOL m_bHasMRUSeparator
LPCTSTR | m_pszCurCharID

Detailed Description

Definition at line 17 of file MainDlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 25 of file MainDlg.h.

{ IDD = IDD_CAPMFC_DIALOG };

Constructor & Destructor Documentation

CCapMFCDlg::CCapMFCDlg ( CWnd * pParent = NULL )

Definition at line 177 of file MainDlg.Cpp.

                                    : CDialog(CCapMFCDlg::IDD, pParent) {

  //{{AFX_DATA_INIT(CCapMFCDlg)
    // NOTE: the ClassWizard will add member initialization here
  //}}AFX_DATA_INIT

  m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
  m_pszCurCharID = NULL;
  m_bHasMRUSeparator = FALSE;
}

Member Function Documentation

void CCapMFCDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 189 of file MainDlg.Cpp.

                                                  {

  CDialog::DoDataExchange(pDX);

  //{{AFX_DATA_MAP(CCapMFCDlg)
  DDX_Control(pDX, IDC_Y_LABEL, m_YLabel);
  DDX_Control(pDX, IDC_X_LABEL, m_XLabel);
  DDX_Control(pDX, IDC_POSITION_LABEL, m_PositionLabel);
  DDX_Control(pDX, IDC_MOVE_Y, m_MoveY);
  DDX_Control(pDX, IDC_MOVE_X, m_MoveX);
  DDX_Control(pDX, IDC_MOVE, m_Move);
  DDX_Control(pDX, IDC_BALLOON_USE, m_BalloonEnabled);
  DDX_Control(pDX, IDC_BALLOON_SIZETOTEXT, m_BalloonSizeToText);
  DDX_Control(pDX, IDC_BALLOON_AUTOPACE, m_BalloonAutoPace);
  DDX_Control(pDX, IDC_BALLOON_AUTOHIDE, m_BalloonAutoHide);
  DDX_Control(pDX, IDC_SPEAK, m_Speak);
  DDX_Control(pDX, IDC_SPEECHOUTPUT_LABEL, m_SpeechOutputLabel);
  DDX_Control(pDX, IDC_SPEAKTEXT, m_SpeakText);
  DDX_Control(pDX, IDC_SFX, m_Sfx);
  DDX_Control(pDX, IDC_STOP, m_Stop);
  DDX_Control(pDX, IDC_STOPBEFOREPLAY, m_StopBeforePlay);
  DDX_Control(pDX, IDC_PLAY, m_Play);
  DDX_Control(pDX, IDC_ANIMATIONS_LABEL, m_AnimationsLabel);
  DDX_Control(pDX, IDC_ANIMATIONS, m_Animations);
  DDX_Control(pDX, IDC_AGENT, m_Agent);
  //}}AFX_DATA_MAP
}

void CCapMFCDlg::LoadCharacter ( CString pszFilename ) [private]

Definition at line 453 of file MainDlg.Cpp.

                                                  {

  HRESULT         hRes;
  BOOL          bHasAnims;
  CString         szFilename;
  _TCHAR           *pchFilename;
  CAgentCtlRequest    AgentRequest;
  CAgentCtlCharacterEx  Character;
  LPCTSTR         kpszNewID;
  _TCHAR          szTemp[256];
  UINT          uBalloonStyle;
  COleVariant       vEmpty;
  DWORD         dwRetrieved;
  VARIANT         vAnimName;
  IUnknown         *punkAnimNames;
  IEnumVARIANT       *pevAnimNames;

  // If no filename was specified, bring up the common
  // open dialog to get one from the user.

  if (pszFilename.IsEmpty()) {

    CFileDialog fd(TRUE, _T(".acs"), NULL, OFN_HIDEREADONLY, kpszFileTypes, this);

    if (fd.DoModal() == IDCANCEL)
      return;

    szFilename = fd.GetPathName();
    pszFilename = szFilename;
  }

  SetCursor(LoadCursor(NULL, IDC_WAIT));

  // Construct a VARIANT to hold the filename

  COleVariant v(pszFilename);

  // Load the new character. NOTE: we don't release the
  // existing character until we're sure we've successfully
  // loaded the new one.

  if (m_pszCurCharID == NULL)
    kpszNewID = kpszID1;
  else if (m_pszCurCharID == kpszID1)
    kpszNewID = kpszID2;
  else
    kpszNewID = kpszID1;

  AgentRequest = m_Agent.GetCharacters().Load(kpszNewID, v);

  // Did we successfully load the character? NOTE: if it's the
  // same character as we already have loaded we'll get the
  // error code AGENTERR_CHARACTERALREADYLOADED.

  if (AgentRequest.GetStatus() != RequestSuccess) {
    SetCursor(LoadCursor(NULL, IDC_ARROW));
    return;
  }

  // Unload the previous character if we have one

  if (m_pszCurCharID)
    m_Agent.GetCharacters().Unload(m_pszCurCharID);

  // Save the new id

  m_pszCurCharID = kpszNewID;
  Character = m_Agent.GetCharacters().Character(m_pszCurCharID);

  // Reset the contents of the animation list box

  m_Animations.ResetContent();

  // Add it to the MRU menu

  UpdateRecentFiles(pszFilename);

  // Get the last visibility cause of the character. If
  // it's never been shown we'll position it. Otherwise,
  // we'll leave it alone and assume it's where the user
  // or another app wants it.

  if (Character.GetVisibilityCause() == NeverShown) {

    CRect rcWindow;

    // Get the window rect

    GetWindowRect(&rcWindow);

    // Make sure we'll fit to the right (NOTE: a production
    // quality app would handle multi-monitor!!!)

    if ((rcWindow.right + Character.GetWidth()) > GetSystemMetrics(SM_CXSCREEN))
      rcWindow.right = rcWindow.left + Character.GetWidth();

    // Move it (non-animated)

    Character.MoveTo((short)rcWindow.right, (short)rcWindow.top, vEmpty);
  }

  // Add commands

  CString pszCommand;
  pszCommand.LoadString(IDS_COMMAND_PROPERTIES);
  COleVariant vCommand(pszCommand);

  Character.GetCommands().Add(kpszCommandProperties, vCommand, vEmpty, vEmpty, vEmpty);

  // Show the character (animated)

  Character.Show(vEmpty);

  // Populate the listbox with the character's animation names.
  // This is a little tricky since MFC does not generate a wrapper
  // for the Enum method of IAgentCtlAnimationNames. So we'll have
  // to get the IUnknown ourself via GetProperty.

  Character.GetAnimationNames().GetProperty(DISPID_NEWENUM, VT_UNKNOWN, (void *)&punkAnimNames);

  // We've got the IUnknown, now query for IEnumVARIANT

  hRes = punkAnimNames->QueryInterface(IID_IEnumVARIANT, (LPVOID *)&pevAnimNames);

  // We're done with the IUnknown no matter what

  punkAnimNames->Release();

  // Did we get IEnumVARIANT?

  if (SUCCEEDED(hRes)) {

    while (TRUE) {

      // Get the next animation name

      if (pevAnimNames->Next(1, &vAnimName, &dwRetrieved) != NOERROR)
        break;

      // Hmmmm

      _ASSERT(dwRetrieved > 0);
      _ASSERT(vAnimName.vt == VT_BSTR);
      _ASSERT(vAnimName.bstrVal != NULL);

      CString pszAnimName(vAnimName.bstrVal);

      // Add it to the list box

      m_Animations.AddString((LPCTSTR)pszAnimName);

      // And clean up

      VariantClear(&vAnimName);
    }

    pevAnimNames->Release();
  }

  // Do we have any animations?

  bHasAnims = (m_Animations.GetCount() > 0);

  if (bHasAnims)
    m_Animations.SetCurSel(0);

  // Enable/Disable controls

  m_Play.EnableWindow(bHasAnims);
  m_StopBeforePlay.EnableWindow(bHasAnims);
  m_Stop.EnableWindow(bHasAnims);
  m_Sfx.EnableWindow(bHasAnims);
  m_Speak.EnableWindow(bHasAnims && (m_SpeakText.GetWindowTextLength() > 0));
  m_SpeakText.EnableWindow(bHasAnims);
  m_SpeechOutputLabel.EnableWindow(bHasAnims);
  m_BalloonEnabled.EnableWindow(bHasAnims);

  m_AnimationsLabel.EnableWindow(bHasAnims);

  // Sound Effects

  m_Sfx.SetCheck(Character.GetSoundEffectsOn());

  // Update the balloon buttons

  uBalloonStyle = 0;

  if (bHasAnims) {

    uBalloonStyle = Character.GetBalloon().GetStyle();

    m_BalloonEnabled.SetCheck(uBalloonStyle & BALLOON_STYLE_BALLOON_ON);
    m_BalloonSizeToText.SetCheck(uBalloonStyle & BALLOON_STYLE_SIZETOTEXT);
    m_BalloonAutoPace.SetCheck(uBalloonStyle & BALLOON_STYLE_AUTOPACE);
    m_BalloonAutoHide.SetCheck(uBalloonStyle & BALLOON_STYLE_AUTOHIDE);
  }

  m_BalloonSizeToText.EnableWindow(bHasAnims && (uBalloonStyle & BALLOON_STYLE_BALLOON_ON));
  m_BalloonAutoPace.EnableWindow(bHasAnims && (uBalloonStyle & BALLOON_STYLE_BALLOON_ON));
  m_BalloonAutoHide.EnableWindow(bHasAnims && (uBalloonStyle & BALLOON_STYLE_BALLOON_ON));

  m_Move.EnableWindow(bHasAnims);
  m_MoveX.EnableWindow(bHasAnims);
  m_MoveY.EnableWindow(bHasAnims);
  m_PositionLabel.EnableWindow(bHasAnims);
  m_XLabel.EnableWindow(bHasAnims);
  m_YLabel.EnableWindow(bHasAnims);

  // Call our OnPropertyChange function. This will sync
  // our dialog with Agent properties.

  OnAgentPropertyChange();

  m_Animations.SetFocus();

  // Set the text of the title bar

  pchFilename = _tcsrchr(pszFilename, '\\');

  if (pchFilename)
    pchFilename = _tcsinc(pchFilename);
  else
    pchFilename = (LPTSTR)(LPCTSTR)pszFilename;

    ZeroMemory(szTemp, sizeof(szTemp));
    _tcsncpy(szTemp, pchFilename, (sizeof(szTemp) / sizeof(szTemp[0])) - (_tcslen(kpszAppTitle) + 4));
    _tcscat(szTemp, _T(" - "));
    _tcscat(szTemp, kpszAppTitle);

  SetWindowText(szTemp);

  // Update the "Animations" group box text with the character's
  // name.

  CString szTemplate;

  szTemplate.LoadString(IDS_ANIMATIONS_LABEL);

  _ASSERT(szTemplate.GetLength() + Character.GetName().GetLength() < 256);

  wsprintf(szTemp, szTemplate, Character.GetName());

  m_AnimationsLabel.SetWindowText(szTemp);

  SetCursor(LoadCursor(NULL, IDC_ARROW));
}

void CCapMFCDlg::MakeEllipsisPath | ( | LPCTSTR | pszPath,
 |  | LPTSTR | pszEllipsisPath,
 |  | UINT | cchMaxEllipsisPath |
 | ) |  |  | [private]

Definition at line 712 of file MainDlg.Cpp.

                                                                                {

  // This function takes a full path and truncates to a fixed
  // specified size using ellipses as necessary. It's main goal
  // is to keep the first directory in the path and the filename
  // intact and use ellipsis in the middle.
  //
  // NOTE: cchMaxEllipsisPath is NOT the size of the pszEllipsisPath
  // buffer (in characters). It is simply the maximum number of
  // characters to allow in the path so we'd better have room for at
  // least that many.

  _ASSERT(!IsBadWritePtr(pszEllipsisPath, (cchMaxEllipsisPath+1) * sizeof(_TCHAR)));
  _ASSERT(cchMaxEllipsisPath <= _MAX_PATH);

  _TCHAR  szPathCopy[_MAX_PATH];
  _TCHAR *pchEndDir;
  LPCTSTR pchFilename;
  UINT  uPathPartLen;
  UINT  uFilenameLen;

  // If the specified path fits, then just copy it and return

  if ((UINT)lstrlen(pszPath) < cchMaxEllipsisPath) {
    lstrcpy(pszEllipsisPath, pszPath);
    return;
  }

  // See if the filename alone is too big

  pchFilename = _tcsrchr(pszPath, '\\');

  if (pchFilename != NULL)
    pchFilename = _tcsinc(pchFilename);
  else
    pchFilename = pszPath;

  _ASSERT(pchFilename);

  uFilenameLen = lstrlen(pchFilename);

  if (uFilenameLen >= cchMaxEllipsisPath) {
    lstrcpyn(pszEllipsisPath, pchFilename, cchMaxEllipsisPath-2);
    lstrcat(pszEllipsisPath, _T("..."));
    return;
  }

  // Save a local copy of the specified path

  lstrcpy(szPathCopy, pszPath);

  pchEndDir = szPathCopy;

  // See if it's a UNC name

  if (_tcsncmp(pchEndDir, _T("\\\\"), 2) == 0) {
    pchEndDir = _tcsinc(pchEndDir);
    pchEndDir = _tcsinc(pchEndDir);
    pchEndDir = _tcschr(pchEndDir, '\\');
  }
  else {
    pchEndDir = _tcschr(pchEndDir, '\\');
    if (pchEndDir) {
      pchEndDir = _tcsinc(pchEndDir);
      pchEndDir = _tcschr(pchEndDir, '\\');
    }
  }

  if (pchEndDir != NULL)
    pchEndDir = _tcsinc(pchEndDir);

  // If we couldn't find the first directory component, give up
  // and just return the filename only.

  if (pchEndDir == NULL) {
    lstrcpy(pszEllipsisPath, pchFilename);
    return;
  }

  *pchEndDir = 0;

  uPathPartLen = min((UINT)lstrlen(szPathCopy), cchMaxEllipsisPath - uFilenameLen - 4);

  lstrcpyn(pszEllipsisPath, szPathCopy, uPathPartLen+1);
  lstrcat(pszEllipsisPath, _T("...\\"));
  lstrcat(pszEllipsisPath, pchFilename);
}

void CCapMFCDlg::OnActivateApp | ( | BOOL | bActive,
 |  | DWORD | hTask |
 | ) |  |  | [protected]

Definition at line 322 of file MainDlg.Cpp.

                                                        {

  _TCHAR szText[256];
  CAgentCtlCharacterEx Character;
  COleVariant vFast;

  vFast.vt = VT_BOOL;
  vFast.boolVal = VARIANT_TRUE;

  // If we don't have a character loaded, we're done

  if (m_pszCurCharID == NULL)
    return;

  Character = m_Agent.GetCharacters().Character(m_pszCurCharID);

  // If we're being deactivated, and the foreground
  // window is an Agent character, we don't want to
  // hide the character.

  if (!bActive) {

    // Get the window title text for the foreground window.
    // NOTE: Microsoft Agent character's window titles are
    // always "Microsoft Agent"

    if (::GetWindowText(::GetForegroundWindow(), szText, 256) > 0) {

      if (lstrcmpi(szText, kpszAgentCharacterTitle) == 0)
        return;

      // Check to see if it's the Agent Character Property
      // Sheet. NOTE: this currently only works on English
      // systems. A more robust way to do this would be to
      // use the process id of the window that is getting
      // focus, and make sure that it's not AgentSvr.exe.

      if (lstrcmpi(szText, kpszAgentCharacterOptions) == 0)
        return;
    }

    // If the character has other clients, we're not going
    // to hide it.

    if (!Character.GetHasOtherClients())
      Character.Hide(vFast);
  }
  else {

    // Is the window minimized?

    if (!IsIconic()) {

      // We want to show the character on activation but there's
      // a special case. If the user hid the character we could get
      // a WM_ACTIVATEAPP message after the character window hides.
      // In that case, we sure don't want to show the character. So
      // check the visibility cause of the character. If the user hid
      // it, we won't show it.

      if ((Character.GetVisibilityCause() == UserHid) ||
        (Character.GetVisibilityCause() == UserHidViaCharacterMenu))
        return;

      Character.Show(vFast);
    }
  }
}

void CCapMFCDlg::OnAgentPropertyChange ( ) [protected]

Definition at line 1305 of file MainDlg.Cpp.

                                       {

  CAgentCtlCharacterEx Character;
  BOOL bUseBalloon;

  // The user has changed an Agent property via the
  // Advanced Characters Property Sheet. Update any
  // of our own fields to reflect the change.

  m_Sfx.EnableWindow(m_Agent.GetAudioOutput().GetSoundEffects());

  Character = m_Agent.GetCharacters().Character(m_pszCurCharID);

  m_BalloonEnabled.EnableWindow(Character.GetBalloon().GetEnabled());

  bUseBalloon = m_BalloonEnabled.IsWindowEnabled() && m_BalloonEnabled.GetCheck();

  m_BalloonSizeToText.EnableWindow(bUseBalloon);
  m_BalloonAutoPace.EnableWindow(bUseBalloon);
  m_BalloonAutoHide.EnableWindow(bUseBalloon);
}

void CCapMFCDlg::OnBalloonUse ( ) [protected]

Definition at line 1166 of file MainDlg.Cpp.

                              {

  BOOL bCheck;

  bCheck = m_BalloonEnabled.GetCheck();

  m_BalloonSizeToText.EnableWindow(bCheck);
  m_BalloonAutoPace.EnableWindow(bCheck);
  m_BalloonAutoHide.EnableWindow(bCheck);
}

void CCapMFCDlg::OnChangeSpeakText ( ) [protected]

Definition at line 1141 of file MainDlg.Cpp.

                                   {

  BOOL bEnable;

  // Enable the Speak button if there are animations and text
  // in the speak text edit field.

  bEnable = (m_Animations.GetCount() > 0) && (m_SpeakText.GetWindowTextLength() > 0);

  // If we're enabling and the button isn't already enabled,
  // enable it and make it the default button. If we're disabling
  // and the button is enabled, disable it and turn off it's
  // default button status.

  if (bEnable && !m_Speak.IsWindowEnabled()) {
    m_Speak.EnableWindow(TRUE);
    SendMessage(DM_SETDEFID, IDC_SPEAK, 0);
  }
  else if (!bEnable && m_Speak.IsWindowEnabled()) {
    m_Speak.EnableWindow(FALSE);
    SendMessage(DM_SETDEFID, 0, 0);
  }
}

BOOL CCapMFCDlg::OnCommand | ( | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]

Definition at line 1236 of file MainDlg.Cpp.

                                                       {

  WORD wID;

  wID = LOWORD(wParam);

  // First check for a recent file command

  if ((wID >= ID_RECENT_FILE_0) && (wID < ID_RECENT_FILE_0+MAX_RECENT_FILES)) {
    OnRecentFile(wID - ID_RECENT_FILE_0 + 1);
    return TRUE;
  }

  return CDialog::OnCommand(wParam, lParam);
}

void CCapMFCDlg::OnCommandAgent ( LPDISPATCH UserInput ) [protected]

Definition at line 1270 of file MainDlg.Cpp.

                                                    {

  CAgentCtlUserInput userInput(UserInput);
  CAgentCtlCharacterEx Character;
  CAgentCtlPropertySheet PropertySheet;
  COleVariant vEmpty;

  if (userInput.GetName() == kpszCommandProperties) {

    // Get the property sheet

    PropertySheet = m_Agent.GetPropertySheet();

    // Show it

    PropertySheet.SetVisible(TRUE);

    // Get the character

    _ASSERT(m_pszCurCharID);

    Character = m_Agent.GetCharacters().Character(m_pszCurCharID);

    // Stop it

    Character.StopAll(vEmpty);

    // Gesture at the property sheet

    Character.GestureAt(PropertySheet.GetLeft() + (PropertySheet.GetWidth() / 2),
                PropertySheet.GetTop() + (PropertySheet.GetHeight() / 2));
  }
}

void CCapMFCDlg::OnDblclkAnimations ( ) [protected]

Definition at line 1061 of file MainDlg.Cpp.

                                    {

  OnPlay();
}

void CCapMFCDlg::OnDropFiles ( HDROP hDropInfo ) [protected]

Definition at line 266 of file MainDlg.Cpp.

                                            {

  TCHAR szFilename[_MAX_PATH];

  // Handle drag and drop

  ::DragQueryFile(hDropInfo, 0, szFilename, _MAX_PATH);
  ::DragFinish(hDropInfo);

  LoadCharacter(szFilename);
}

void CCapMFCDlg::OnFileExit ( ) [protected]

Definition at line 431 of file MainDlg.Cpp.

                            {

  ShowWindow(SW_HIDE);
  PostQuitMessage(0);
}

void CCapMFCDlg::OnFileOpen ( ) [protected]

Definition at line 438 of file MainDlg.Cpp.

                            {

  CString psz;
  psz.Empty();
  LoadCharacter(psz);
}

void CCapMFCDlg::OnFinalRelease ( ) [virtual]

Definition at line 701 of file MainDlg.Cpp.

                                {

  // If we have a character, unload it now

  if (m_pszCurCharID)
    m_Agent.GetCharacters().Unload(m_pszCurCharID);

  CDialog::OnFinalRelease();
}

void CCapMFCDlg::OnHelpAbout ( ) [protected]

Definition at line 446 of file MainDlg.Cpp.

                             {

  CAboutDlg dlgAbout;
  dlgAbout.DoModal();
}

BOOL CCapMFCDlg::OnInitDialog ( ) [protected, virtual]

Definition at line 245 of file MainDlg.Cpp.

                              {

  CDialog::OnInitDialog();

  SetIcon(m_hIcon, TRUE);
  SetIcon(m_hIcon, FALSE);

  // We don't want the Agent control to throw exceptions. We'd
  // rather have HRESULTs returned. If you want to use exception
  // handling instead, remove/comment the next line.

  m_Agent.SetRaiseRequestErrors(FALSE);

  // Initialize the MRU menu

  UpdateRecentFiles(NULL);

  return TRUE;
}

void CCapMFCDlg::OnInitMenuPopup | ( | CMenu * | pPopupMenu,
 |  | UINT | uIndex,
 |  | BOOL | bSysMenu |
 | ) |  |  | [protected]

Definition at line 305 of file MainDlg.Cpp.

                                                                              {

  CDialog::OnInitMenuPopup(pPopupMenu, uIndex, bSysMenu);

  // We're not going to allow the dialog to be sized or
  // maximized, so disable those menu items on the context
  // menu.

  if (bSysMenu) {
    pPopupMenu->EnableMenuItem(SC_MAXIMIZE, MF_GRAYED);
    pPopupMenu->EnableMenuItem(SC_MINIMIZE, IsIconic() ? MF_GRAYED : MF_ENABLED);
    pPopupMenu->EnableMenuItem(SC_RESTORE, IsIconic() ? MF_ENABLED : MF_GRAYED);
    pPopupMenu->EnableMenuItem(SC_SIZE, MF_GRAYED);
  }
}

void CCapMFCDlg::OnMove ( ) [protected]

Definition at line 1178 of file MainDlg.Cpp.

                        {

  _ASSERT(m_pszCurCharID);

  int iX;
  int iY;
  BOOL bConvert;
  CAgentCtlCharacterEx Character;
  COleVariant vEmpty;

  iX = GetDlgItemInt(IDC_MOVE_X, &bConvert, TRUE);

  if (!bConvert || (iX > 32767) || (iX < -32767))
    return;

  iY = GetDlgItemInt(IDC_MOVE_Y, &bConvert, TRUE);

  if (!bConvert || (iY > 32767) || (iY < -32767))
    return;

  // Shortcut to the character

  Character = m_Agent.GetCharacters().Character(m_pszCurCharID);

  // Should we stop the character?

  if (m_StopBeforePlay.GetCheck())
    Character.StopAll(vEmpty);

  Character.MoveTo((short)iX, (short)iY, vEmpty);
}

void CCapMFCDlg::OnMoveAgent | ( | LPCTSTR | CharacterID,
 |  | short | x,
 |  | short | y,
 |  | short | Cause |
 | ) |  |  | [protected]

Definition at line 1262 of file MainDlg.Cpp.

                                                                               {

  // Update the position fields

  SetDlgItemInt(IDC_MOVE_X, x, TRUE);
  SetDlgItemInt(IDC_MOVE_Y, y, TRUE);
}

void CCapMFCDlg::OnPaint ( void ) [protected]

Definition at line 392 of file MainDlg.Cpp.

                         {

  // If you add a minimize button to your dialog, you will need the code below
  // to draw the icon.  For MFC applications using the document/view model,
  // this is automatically done for you by the framework.

  if (IsIconic()) {

    CPaintDC dc(this);

    SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

    int cxIcon = GetSystemMetrics(SM_CXICON);
    int cyIcon = GetSystemMetrics(SM_CYICON);

    CRect rect;

    GetClientRect(&rect);

    int x = (rect.Width() - cxIcon + 1) / 2;
    int y = (rect.Height() - cyIcon + 1) / 2;

    // Draw the icon

    dc.DrawIcon(x, y, m_hIcon);
  }
  else {

    CDialog::OnPaint();
  }
}

void CCapMFCDlg::OnPlay ( ) [protected]

Definition at line 1022 of file MainDlg.Cpp.

                        {

  // We'd better have a character at this point

  _ASSERT(m_pszCurCharID);

  int iCurSel;
  CAgentCtlCharacterEx Character;
  COleVariant vEmpty;

  // Get the current selection

  iCurSel = m_Animations.GetCurSel();

  // Is there one?

  if (iCurSel == LB_ERR)
    return;

  // Shortcut to the character

  Character = m_Agent.GetCharacters().Character(m_pszCurCharID);

  // Stop the character if the button is checked

  if (m_StopBeforePlay.GetCheck())
    Character.StopAll(vEmpty);

  // Play the animation

  CString pszAnim;
  m_Animations.GetText(iCurSel, pszAnim);

  Character.Play(pszAnim);

  m_Animations.SetFocus();
}

HCURSOR CCapMFCDlg::OnQueryDragIcon ( ) [protected]

Definition at line 425 of file MainDlg.Cpp.

                                    {

  return (HCURSOR) m_hIcon;
}

void CCapMFCDlg::OnRecentFile ( UINT uFile ) [private]

Definition at line 976 of file MainDlg.Cpp.

                                        {

  // Hmmm

  _ASSERT((uFile >= 1) && (uFile <= MAX_RECENT_FILES));

  LONG  lRes;
  DWORD dwRetType;
  DWORD dwSize;
  _TCHAR  szValueName[256];
  _TCHAR  szFile[_MAX_PATH];
  HKEY  hKeyMRU;

  // Open the Recent Files subkey

  lRes = RegOpenKeyEx(HKEY_CURRENT_USER,
            kpszRecentFilesSubkey,
            0,
            KEY_ALL_ACCESS,
            &hKeyMRU);

  if (lRes != ERROR_SUCCESS)
    return;

  // Query the value for the specified item

  wsprintf(szValueName, _T("%s%d"), kpszRecentFilesItem, uFile);

  dwSize = _MAX_PATH * sizeof(_TCHAR);

  lRes = RegQueryValueEx(hKeyMRU,
               szValueName,
               NULL,
               &dwRetType,
               (LPBYTE)szFile,
               &dwSize);

  // If we found it, Load the character.

  if ((lRes == ERROR_SUCCESS) && (dwRetType == REG_SZ))
    LoadCharacter(szFile);

  RegCloseKey(hKeyMRU);
}

void CCapMFCDlg::OnSetFocusAnimations ( ) [protected]

Definition at line 1230 of file MainDlg.Cpp.

                                      {

  SendMessage(DM_SETDEFID, IDC_PLAY, 0);
}

void CCapMFCDlg::OnSetFocusMoveX ( ) [protected]

Definition at line 1218 of file MainDlg.Cpp.

                                 {

  SendMessage(DM_SETDEFID, IDC_MOVE, 0);
}

void CCapMFCDlg::OnSetFocusMoveY ( ) [protected]

Definition at line 1224 of file MainDlg.Cpp.

                                 {

  SendMessage(DM_SETDEFID, IDC_MOVE, 0);
}

void CCapMFCDlg::OnSetFocusSpeakText ( ) [protected]

Definition at line 1211 of file MainDlg.Cpp.

                                     {

  if (m_SpeakText.GetWindowTextLength() > 0)
    SendMessage(DM_SETDEFID, IDC_SPEAK, 0);
}

void CCapMFCDlg::OnSfx ( ) [protected]

Definition at line 1077 of file MainDlg.Cpp.

                       {

  _ASSERT(m_pszCurCharID);

  m_Agent.GetCharacters().Character(m_pszCurCharID).SetSoundEffectsOn(m_Sfx.GetCheck());
}

void CCapMFCDlg::OnSpeak ( ) [protected]

Definition at line 1085 of file MainDlg.Cpp.

                         {

  _ASSERT(m_pszCurCharID);

  // We should never be in here if there's no text

  _ASSERT(m_SpeakText.GetWindowTextLength() > 0);

  CAgentCtlCharacterEx Character;
  COleVariant vEmpty;
  COleVariant vText;
  CString pszText;
  UINT uBalloonFlags;

  // Shortcut to the character

  Character = m_Agent.GetCharacters().Character(m_pszCurCharID);

  // Set the balloon style if we have the interface

  uBalloonFlags = 0;

  if (m_BalloonEnabled.GetCheck())
    uBalloonFlags |= BALLOON_STYLE_BALLOON_ON;

  if (m_BalloonSizeToText.GetCheck())
    uBalloonFlags |= BALLOON_STYLE_SIZETOTEXT;

  if (m_BalloonAutoPace.GetCheck())
    uBalloonFlags |= BALLOON_STYLE_AUTOPACE;

  if (m_BalloonAutoHide.GetCheck())
    uBalloonFlags |= BALLOON_STYLE_AUTOHIDE;

  Character.GetBalloon().SetStyle((long)uBalloonFlags);

  // Should we stop the character?

  if (m_StopBeforePlay.GetCheck())
    Character.StopAll(vEmpty);

  // Speak the text

  m_SpeakText.GetWindowText(pszText);
  vText = pszText;

  Character.Speak(vText, vEmpty);

  // Reselect the text and set the focus back to the
  // edit field.

  m_SpeakText.SetSel(0, -1);
  m_SpeakText.SetFocus();
}

void CCapMFCDlg::OnStop ( ) [protected]

Definition at line 1067 of file MainDlg.Cpp.

                        {

  _ASSERT(m_pszCurCharID);

  COleVariant vEmpty;

  m_Agent.GetCharacters().Character(m_pszCurCharID).StopAll(vEmpty);
}

void CCapMFCDlg::OnSysCommand | ( | UINT | nID,
 |  | LPARAM | lParam |
 | ) |  |  | [protected]

Definition at line 279 of file MainDlg.Cpp.

                                                     {

  COleVariant vFast;

  vFast.vt = VT_BOOL;
  vFast.boolVal = VARIANT_TRUE;

  // If the dialog is getting minimized, hide the character. If it's
  // being restore, show it.

  switch (nID) {
    case SC_MINIMIZE:
      if (m_pszCurCharID)
        m_Agent.GetCharacters().Character(m_pszCurCharID).Hide(vFast);
      break;

    case SC_RESTORE:
      if (m_pszCurCharID)
        m_Agent.GetCharacters().Character(m_pszCurCharID).Show(vFast);
      break;
  }

  CDialog::OnSysCommand(nID, lParam);
}

void CCapMFCDlg::UpdateRecentFiles ( LPCTSTR pszFilename ) [private]

Definition at line 801 of file MainDlg.Cpp.

                                                      {

  // This function updates our recent file list if a filename
  // is specified or initializes the file menu with existing
  // filenames from the registry.

  LONG  lRes;
  HKEY  hKeyMRU;
  HMENU hMenuFile;
  DWORD dwSize;
  DWORD dwDisposition;
  DWORD dwRetType;
  int   iNumExisting = 0;
  int   iFind = -1;
  int   iCount;
  int   iFileExitPos;
  _TCHAR  szValueName[256];
  _TCHAR  rgszExisting[MAX_RECENT_FILES][_MAX_PATH];
  _TCHAR  szEllipsisText[_MAX_PATH];
  _TCHAR  szMenuItemText[_MAX_PATH];

  // Open/Create the registry key

  lRes = RegCreateKeyEx(HKEY_CURRENT_USER,
              kpszRecentFilesSubkey,
                0,
                _T(""),
                REG_OPTION_NON_VOLATILE,
                KEY_ALL_ACCESS,
                NULL,
                &hKeyMRU,
                &dwDisposition);

  if (lRes != ERROR_SUCCESS)
    return;

  // Get all of the current entries

  for (int i=0; i < MAX_RECENT_FILES; i++) {

    // Format the value string

    wsprintf(szValueName, _T("%s%d"), kpszRecentFilesItem, i+1);

    // Get the next value

    dwSize = _MAX_PATH * sizeof(_TCHAR);

    lRes = RegQueryValueEx(hKeyMRU,
                 szValueName,
                 NULL,
                 &dwRetType,
                 (LPBYTE)rgszExisting[iNumExisting],
                 &dwSize);

    // Was it there?

    if (lRes == ERROR_SUCCESS) {

      // If a filename was specified, see if it matches this one

      if (pszFilename) {

        if (lstrcmpi(pszFilename, rgszExisting[iNumExisting]) == 0) {

          // If the specified file is the first file we find,
          // then we're done.

          if (iNumExisting == 0) {
            RegCloseKey(hKeyMRU);
            return;
          }

          iFind = iNumExisting;
        }
      }

      ++iNumExisting;
    }
  }

  // If no filename was specified, and we don't have any
  // existing files, we're done.

  if ((pszFilename == NULL) && (iNumExisting == 0))
    return;

  // If a file was specified, we have to update the registry

  if (pszFilename) {

    // Write the new filename to the registry

    wsprintf(szValueName, _T("%s%d"), kpszRecentFilesItem, 1);
    dwSize = (_tcslen(pszFilename)+1) * sizeof(_TCHAR);
    RegSetValueEx(hKeyMRU, szValueName, 0, REG_SZ, (LPBYTE)pszFilename, dwSize);

    // If we previously had the maximum number of files, and
    // the new one is not one of them, we disregard the last
    // one.

    if ((iNumExisting == MAX_RECENT_FILES) && (iFind < 0))
      --iNumExisting;

    // Now, write the remaining items

    iCount = 1;

    for (i=0; i < iNumExisting; i++) {
      if (i != iFind) {
        wsprintf(szValueName, _T("%s%d"), kpszRecentFilesItem, ++iCount);
        dwSize = (_tcslen(rgszExisting[i])+1) * sizeof(_TCHAR);
        RegSetValueEx(hKeyMRU, szValueName, 0, REG_SZ, (LPBYTE)rgszExisting[i], dwSize);
      }
    }
  }

  // Get the File submenu

  hMenuFile = GetMenu()->GetSubMenu(0)->m_hMenu;

  // Delete any existing recent file entries

  for (i=0; i < MAX_RECENT_FILES; i++)
    DeleteMenu(hMenuFile, ID_RECENT_FILE_0+i, MF_BYCOMMAND);

  // Where's the Exit item?

  iFileExitPos = GetMenuItemCount(hMenuFile) - 1;

  // Create an ellipsis path from the specified filename and
  // insert it into the menu.

  if (pszFilename) {
    MakeEllipsisPath(pszFilename, szEllipsisText, MAX_RECENT_FILENAME);
    wsprintf(szMenuItemText, _T("&%d %s"), 1, szEllipsisText);
    InsertMenu(hMenuFile, iFileExitPos-1, MF_BYPOSITION, ID_RECENT_FILE_0, szMenuItemText);
    iCount = 1;
  }
  else {
    iCount = 0;
  }

  // Then do the same for the remaining items

  for (i=0; i < iNumExisting; i++) {
    if (i != iFind) {
      MakeEllipsisPath(rgszExisting[i], szEllipsisText, MAX_RECENT_FILENAME);
      wsprintf(szMenuItemText, _T("&%d %s"), iCount+1, szEllipsisText);
      InsertMenu(hMenuFile, iFileExitPos-1+iCount, MF_BYPOSITION, ID_RECENT_FILE_0+iCount, szMenuItemText);
      ++iCount;
    }
  }

  // Delete/Insert the separator as appropriate

  if ((iNumExisting == 0) && (pszFilename == NULL)) {
    if (m_bHasMRUSeparator) {
      DeleteMenu(hMenuFile, iFileExitPos-2, MF_BYPOSITION);
      m_bHasMRUSeparator = FALSE;
    }
  }
  else {
    if (!m_bHasMRUSeparator) {
      InsertMenu(hMenuFile, ID_RECENT_FILE_0, MF_BYCOMMAND | MF_SEPARATOR, 0, NULL);
      m_bHasMRUSeparator = TRUE;
    }
  }

  // We're done with the registry

  RegCloseKey(hKeyMRU);
}

Member Data Documentation

CAgentCtlEx CCapMFCDlg::m_Agent

Definition at line 45 of file MainDlg.h.

CListBox CCapMFCDlg::m_Animations

Definition at line 44 of file MainDlg.h.

CButton CCapMFCDlg::m_AnimationsLabel

Definition at line 43 of file MainDlg.h.

CButton CCapMFCDlg::m_BalloonAutoHide

Definition at line 35 of file MainDlg.h.

CButton CCapMFCDlg::m_BalloonAutoPace

Definition at line 34 of file MainDlg.h.

CButton CCapMFCDlg::m_BalloonEnabled

Definition at line 32 of file MainDlg.h.

CButton CCapMFCDlg::m_BalloonSizeToText

Definition at line 33 of file MainDlg.h.

BOOL CCapMFCDlg::m_bHasMRUSeparator [private]

Definition at line 100 of file MainDlg.h.

HICON CCapMFCDlg::m_hIcon [protected]

Definition at line 59 of file MainDlg.h.

CButton CCapMFCDlg::m_Move

Definition at line 31 of file MainDlg.h.

CEdit CCapMFCDlg::m_MoveX

Definition at line 30 of file MainDlg.h.

CEdit CCapMFCDlg::m_MoveY

Definition at line 29 of file MainDlg.h.

CButton CCapMFCDlg::m_Play

Definition at line 42 of file MainDlg.h.

CButton CCapMFCDlg::m_PositionLabel

Definition at line 28 of file MainDlg.h.

LPCTSTR CCapMFCDlg::m_pszCurCharID [private]

Definition at line 99 of file MainDlg.h.

CButton CCapMFCDlg::m_Sfx

Definition at line 39 of file MainDlg.h.

CButton CCapMFCDlg::m_Speak

Definition at line 36 of file MainDlg.h.

CEdit CCapMFCDlg::m_SpeakText

Definition at line 38 of file MainDlg.h.

CButton CCapMFCDlg::m_SpeechOutputLabel

Definition at line 37 of file MainDlg.h.

CButton CCapMFCDlg::m_Stop

Definition at line 40 of file MainDlg.h.

CButton CCapMFCDlg::m_StopBeforePlay

Definition at line 41 of file MainDlg.h.

CStatic CCapMFCDlg::m_XLabel

Definition at line 27 of file MainDlg.h.

CStatic CCapMFCDlg::m_YLabel

Definition at line 26 of file MainDlg.h.

The documentation for this class was generated from the following files:
  • Web/MSAgent/c/CapMFC/MainDlg.h
  • Web/MSAgent/c/CapMFC/MainDlg.Cpp
Generated on Wed Nov 13 2024 16:55:44 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCascade Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CCascade Class Reference

#include "cascade.h"

List of all members.

Public Member Functions

CCascade ()

Detailed Description

Definition at line 10 of file cascade.h.

Constructor & Destructor Documentation

CCascade::CCascade ( ) [inline]

Definition at line 15 of file cascade.h.

  {
  }

The documentation for this class was generated from the following file:
  • Com/Services/Events/EventNews/CascadeEC/cascade.h
Generated on Wed Nov 13 2024 16:55:44 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCaseTextService Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes

CCaseTextService Class Reference

#include "case.h"

List of all members.

Public Member Functions

CCaseTextService ()
~CCaseTextService ()
TfClientId | _GetClientId ()
ITfThreadMgr * | _GetThreadMgr ()
BOOL _IsKeyFlipping ()
BOOL _IsSnoopWndVisible ()
STDMETHODIMP | Activate (ITfThreadMgr *pThreadMgr, TfClientId tfClientId)
STDMETHODIMP | Deactivate ()
STDMETHODIMP | OnEndEdit (ITfContext *pContext, TfEditCookie ecReadOnly, ITfEditRecord *pEditRecord)
STDMETHODIMP | OnInitDocumentMgr (ITfDocumentMgr *pDocMgr)
STDMETHODIMP | OnKeyDown (ITfContext *pContext, WPARAM wParam, LPARAM lParam, BOOL *pfEaten)
STDMETHODIMP | OnKeyUp (ITfContext *pContext, WPARAM wParam, LPARAM lParam, BOOL *pfEaten)
STDMETHODIMP | OnKillThreadFocus ()
STDMETHODIMP | OnPopContext (ITfContext *pContext)
STDMETHODIMP | OnPreservedKey (ITfContext *pContext, REFGUID rguid, BOOL *pfEaten)
STDMETHODIMP | OnPushContext (ITfContext *pContext)
STDMETHODIMP | OnSetFocus (BOOL fForeground)
STDMETHODIMP | OnSetFocus (ITfDocumentMgr *pDocMgrFocus, ITfDocumentMgr *pDocMgrPrevFocus)
STDMETHODIMP | OnSetThreadFocus ()
STDMETHODIMP | OnTestKeyDown (ITfContext *pContext, WPARAM wParam, LPARAM lParam, BOOL *pfEaten)
STDMETHODIMP | OnTestKeyUp (ITfContext *pContext, WPARAM wParam, LPARAM lParam, BOOL *pfEaten)
STDMETHODIMP | OnUninitDocumentMgr (ITfDocumentMgr *pDocMgr)
STDMETHODIMP | QueryInterface (REFIID riid, void **ppvObj)
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP_ (ULONG) Release(void)

Static Public Member Functions

static void | _Menu_FlipDoc (CCaseTextService *_this)
static void | _Menu_FlipKeys (CCaseTextService *_this)
static void | _Menu_FlipSel (CCaseTextService *_this)
static void | _Menu_HelloWord (CCaseTextService *_this)
static void | _Menu_ShowSnoopWnd (CCaseTextService *_this)
static HRESULT | CreateInstance (IUnknown *pUnkOuter, REFIID riid, void **ppvObj)
static BOOL | RegisterCategories (BOOL fRegister)
static BOOL | RegisterProfiles ()
static BOOL | RegisterServer ()
static void | UnregisterProfiles ()
static void | UnregisterServer ()

Private Member Functions

BOOL _InitKeystrokeSink ()
BOOL _InitLanguageBar ()
BOOL _InitPreservedKey ()
BOOL _InitSnoopWnd ()
BOOL | _InitTextEditSink (ITfDocumentMgr *pDocMgr)
BOOL _InitThreadMgrSink ()
void | _UninitKeystrokeSink ()
void | _UninitLanguageBar ()
void | _UninitPreservedKey ()
void | _UninitSnoopWnd ()
void | _UninitThreadMgrSink ()

Private Attributes

LONG | _cRef
DWORD _dwTextEditSinkCookie
DWORD _dwThreadFocusSinkCookie
DWORD _dwThreadMgrEventSinkCookie
BOOL _fFlipKeys
BOOL _fShowSnoop
CLangBarItemButton * _pLangBarItem
CSnoopWnd * _pSnoopWnd
ITfContext * | _pTextEditSinkContext
ITfThreadMgr * | _pThreadMgr
TfClientId | _tfClientId

Detailed Description

Definition at line 13 of file case.h.

Constructor & Destructor Documentation

CCaseTextService::CCaseTextService ( )

Definition at line 46 of file case.cpp.

{
    DllAddRef();

    _pThreadMgr = NULL;
    _tfClientId = TF_CLIENTID_NULL;

    _fShowSnoop = FALSE;
    _pSnoopWnd = NULL;

    _pLangBarItem = NULL;

    _fFlipKeys = FALSE;

    _dwThreadMgrEventSinkCookie = TF_INVALID_COOKIE;
    _dwThreadFocusSinkCookie = TF_INVALID_COOKIE;
    _dwTextEditSinkCookie = TF_INVALID_COOKIE;
    _pTextEditSinkContext = NULL;

    _cRef = 1;
}

CCaseTextService::~CCaseTextService ( )

Definition at line 74 of file case.cpp.

{
    DllRelease();
}

Member Function Documentation

TfClientId CCaseTextService::_GetClientId ( ) [inline]

Definition at line 72 of file case.h.

{ return _tfClientId; }

ITfThreadMgr* CCaseTextService::_GetThreadMgr ( ) [inline]

Definition at line 71 of file case.h.

{ return _pThreadMgr; }

BOOL CCaseTextService::_InitKeystrokeSink ( ) [private]

Definition at line 66 of file keys.cpp.

{
    ITfKeystrokeMgr *pKeystrokeMgr;
    HRESULT hr;

    if (_pThreadMgr->QueryInterface(IID_ITfKeystrokeMgr, (void **)&pKeystrokeMgr) != S_OK)
        return FALSE;

    hr = pKeystrokeMgr->AdviseKeyEventSink(_tfClientId, (ITfKeyEventSink *)this, TRUE);

    pKeystrokeMgr->Release();

    return (hr == S_OK);
}

BOOL CCaseTextService::_InitLanguageBar ( ) [private]

Definition at line 348 of file langbar.cpp.

{
    ITfLangBarItemMgr *pLangBarItemMgr;
    BOOL fRet;

    if (_pThreadMgr->QueryInterface(IID_ITfLangBarItemMgr, (void **)&pLangBarItemMgr) != S_OK)
        return FALSE;

    fRet = FALSE;

    if ((_pLangBarItem = new CLangBarItemButton(this)) == NULL)
        goto Exit;

    if (pLangBarItemMgr->AddItem(_pLangBarItem) != S_OK)
    {
        _pLangBarItem->Release();
        _pLangBarItem = NULL;
        goto Exit;
    }

    fRet = TRUE;

Exit:
    pLangBarItemMgr->Release();
    return fRet;
}

BOOL CCaseTextService::_InitPreservedKey ( ) [private]

Definition at line 107 of file keys.cpp.

{
    ITfKeystrokeMgr *pKeystrokeMgr;
    HRESULT hr;

    if (_pThreadMgr->QueryInterface(IID_ITfKeystrokeMgr, (void **)&pKeystrokeMgr) != S_OK)
        return FALSE;

    hr = pKeystrokeMgr->PreserveKey(_tfClientId, GUID_PRESERVEDKEY_FLIPCASE,
                                    &c_FlipCaseKey, L"Toggle Case",
                                    wcslen(L"Toggle Case"));

    pKeystrokeMgr->Release();

    return (hr == S_OK);
}

BOOL CCaseTextService::_InitSnoopWnd ( ) [private]

Definition at line 331 of file snoop.cpp.

{
    BOOL fThreadfocus;
    ITfSource *pSource = NULL;

    // create a snoop window

    if ((_pSnoopWnd = new CSnoopWnd(this)) == NULL)
        return FALSE;

    if (!_pSnoopWnd->_Init())
        goto ExitError;

    // we also need a thread focus sink

    if (_pThreadMgr->QueryInterface(IID_ITfSource, (void **)&pSource) != S_OK)
    {
        pSource = NULL;
        goto ExitError;
    }

    if (pSource->AdviseSink(IID_ITfThreadFocusSink, (ITfThreadFocusSink *)this, &_dwThreadFocusSinkCookie) != S_OK)
    {
        // make sure we don't try to Unadvise _dwThreadFocusSinkCookie later
        _dwThreadFocusSinkCookie = TF_INVALID_COOKIE;
        goto ExitError;
    }

    pSource->Release();

    // we may need to display the snoop window right now
    // our thread focus sink won't be called until something changes,
    // so we need to check the current state.

    if (_pThreadMgr->IsThreadFocus(&fThreadfocus) == S_OK && fThreadfocus)
    {
        OnSetThreadFocus();
    }

    return TRUE;

ExitError:
    SafeRelease(pSource);
    _UninitSnoopWnd();
    return FALSE;
}

BOOL CCaseTextService::_InitTextEditSink ( ITfDocumentMgr * pDocMgr ) [private]

Definition at line 61 of file editsink.cpp.

{
    ITfSource *pSource;
    BOOL fRet;

    // clear out any previous sink first

    if (_dwTextEditSinkCookie != TF_INVALID_COOKIE)
    {
        if (_pTextEditSinkContext->QueryInterface(IID_ITfSource, (void **)&pSource) == S_OK)
        {
            pSource->UnadviseSink(_dwTextEditSinkCookie);
            pSource->Release();
        }

        _pTextEditSinkContext->Release();
        _pTextEditSinkContext = NULL;
        _dwTextEditSinkCookie = TF_INVALID_COOKIE;
    }

    if (pDocMgr == NULL)
        return TRUE; // caller just wanted to clear the previous sink

    // setup a new sink advised to the topmost context of the document

    if (pDocMgr->GetTop(&_pTextEditSinkContext) != S_OK)
        return FALSE;

    if (_pTextEditSinkContext == NULL)
        return TRUE; // empty document, no sink possible

    fRet = FALSE;

    if (_pTextEditSinkContext->QueryInterface(IID_ITfSource, (void **)&pSource) == S_OK)
    {
        if (pSource->AdviseSink(IID_ITfTextEditSink, (ITfTextEditSink *)this, &_dwTextEditSinkCookie) == S_OK)
        {
            fRet = TRUE;
        }
        else
        {
            _dwTextEditSinkCookie = TF_INVALID_COOKIE;
        }
        pSource->Release();
    }

    if (fRet == FALSE)
    {
        _pTextEditSinkContext->Release();
        _pTextEditSinkContext = NULL;
    }

    return fRet;
}

BOOL CCaseTextService::_InitThreadMgrSink ( ) [private]

Definition at line 88 of file tmgrsink.cpp.

{
    ITfSource *pSource;
    BOOL fRet;

    if (_pThreadMgr->QueryInterface(IID_ITfSource, (void **)&pSource) != S_OK)
        return FALSE;

    fRet = FALSE;

    if (pSource->AdviseSink(IID_ITfThreadMgrEventSink, (ITfThreadMgrEventSink *)this, &_dwThreadMgrEventSinkCookie) != S_OK)
    {
        // make sure we don't try to Unadvise _dwThreadMgrEventSinkCookie later
        _dwThreadMgrEventSinkCookie = TF_INVALID_COOKIE;
        goto Exit;
    }

    fRet = TRUE;

Exit:
    pSource->Release();
    return fRet;
}

BOOL CCaseTextService::_IsKeyFlipping ( ) [inline]

Definition at line 74 of file case.h.

{ return _fFlipKeys; }

BOOL CCaseTextService::_IsSnoopWndVisible ( ) [inline]

Definition at line 73 of file case.h.

{ return _fShowSnoop; }

void CCaseTextService::_Menu_FlipDoc ( CCaseTextService * _this ) [static]

Definition at line 27 of file flipdoc.cpp.

{
    ITfDocumentMgr *pFocusDoc;
    ITfContext *pContext;
    CFlipDocEditSession *pFlipEditSession;
    HRESULT hr;

    // get the focus document
    if (_this->_pThreadMgr->GetFocus(&pFocusDoc) != S_OK)
        return;

    // we want the topmost context, since the main doc context could be
    // superceded by a modal tip context
    if (pFocusDoc->GetTop(&pContext) != S_OK)
    {
        pContext = NULL;
        goto Exit;
    }

    if (pFlipEditSession = new CFlipDocEditSession(pContext))
    {
        // we need a document write lock to insert text
        // the CHelloEditSession will do all the work when the
        // CFlipDocEditSession::DoEditSession method is called by the context
        pContext->RequestEditSession(_this->_tfClientId, pFlipEditSession, TF_ES_READWRITE | TF_ES_ASYNCDONTCARE, &hr);

        pFlipEditSession->Release();
    }

Exit:
    SafeRelease(pContext);
    pFocusDoc->Release();
}

void CCaseTextService::_Menu_FlipKeys ( CCaseTextService * _this ) [static]

Definition at line 54 of file keys.cpp.

{
    _this->_fFlipKeys = !_this->_fFlipKeys;
}

void CCaseTextService::_Menu_FlipSel ( CCaseTextService * _this ) [static]

Definition at line 27 of file flipsel.cpp.

{
    ITfDocumentMgr *pFocusDoc;
    ITfContext *pContext;
    CFlipEditSession *pFlipEditSession;
    HRESULT hr;

    // get the focus document
    if (_this->_pThreadMgr->GetFocus(&pFocusDoc) != S_OK)
        return;

    // we want the topmost context, since the main doc context could be
    // superceded by a modal tip context
    if (pFocusDoc->GetTop(&pContext) != S_OK)
    {
        pContext = NULL;
        goto Exit;
    }

    if (pFlipEditSession = new CFlipEditSession(pContext))
    {
        // we need a document write lock to insert text
        // the CHelloEditSession will do all the work when the
        // CFlipEditSession::DoEditSession method is called by the context
        pContext->RequestEditSession(_this->_tfClientId, pFlipEditSession, TF_ES_READWRITE | TF_ES_ASYNCDONTCARE, &hr);

        pFlipEditSession->Release();
    }

Exit:
    SafeRelease(pContext);
    pFocusDoc->Release();
}

void CCaseTextService::_Menu_HelloWord ( CCaseTextService * _this ) [static]

Definition at line 27 of file hello.cpp.

{
    ITfDocumentMgr *pFocusDoc;
    ITfContext *pContext;
    CHelloEditSession *pHelloEditSession;
    HRESULT hr;

    // get the focus document
    if (_this->_pThreadMgr->GetFocus(&pFocusDoc) != S_OK)
        return;

    // we want the topmost context, since the main doc context could be
    // superceded by a modal tip context
    if (pFocusDoc->GetTop(&pContext) != S_OK)
    {
        pContext = NULL;
        goto Exit;
    }

    if (pHelloEditSession = new CHelloEditSession(pContext))
    {
        // we need a document write lock to insert text
        // the CHelloEditSession will do all the work when the
        // CHelloEditSession::DoEditSession method is called by the context
        pContext->RequestEditSession(_this->_tfClientId, pHelloEditSession, TF_ES_READWRITE | TF_ES_ASYNCDONTCARE, &hr);

        pHelloEditSession->Release();
    }

Exit:
    SafeRelease(pContext);
    pFocusDoc->Release();
}

void CCaseTextService::_Menu_ShowSnoopWnd ( CCaseTextService * _this ) [static]

Definition at line 414 of file snoop.cpp.

{
    _this->_fShowSnoop = !_this->_fShowSnoop;

    if (_this->_fShowSnoop)
    {
        _this->_pSnoopWnd->_Show();
    }
    else
    {
        _this->_pSnoopWnd->_Hide();
    }
}

void CCaseTextService::_UninitKeystrokeSink ( ) [private]

Definition at line 88 of file keys.cpp.

{
    ITfKeystrokeMgr *pKeystrokeMgr;

    if (_pThreadMgr->QueryInterface(IID_ITfKeystrokeMgr, (void **)&pKeystrokeMgr) != S_OK)
        return;

    pKeystrokeMgr->UnadviseKeyEventSink(_tfClientId);

    pKeystrokeMgr->Release();
}

void CCaseTextService::_UninitLanguageBar ( ) [private]

Definition at line 381 of file langbar.cpp.

{
    ITfLangBarItemMgr *pLangBarItemMgr;

    if (_pLangBarItem == NULL)
        return;

    if (_pThreadMgr->QueryInterface(IID_ITfLangBarItemMgr, (void **)&pLangBarItemMgr) == S_OK)
    {
        pLangBarItemMgr->RemoveItem(_pLangBarItem);
        pLangBarItemMgr->Release();
    }

    _pLangBarItem->Release();
    _pLangBarItem = NULL;
}

void CCaseTextService::_UninitPreservedKey ( ) [private]

Definition at line 131 of file keys.cpp.

{
    ITfKeystrokeMgr *pKeystrokeMgr;

    if (_pThreadMgr->QueryInterface(IID_ITfKeystrokeMgr, (void **)&pKeystrokeMgr) != S_OK)
        return;

    pKeystrokeMgr->UnpreserveKey(GUID_PRESERVEDKEY_FLIPCASE, &c_FlipCaseKey);

    pKeystrokeMgr->Release();
}

void CCaseTextService::_UninitSnoopWnd ( ) [private]

Definition at line 385 of file snoop.cpp.

{
    ITfSource *pSource;

    if (_pSnoopWnd != NULL)
    {
        _pSnoopWnd->_Uninit();
        delete _pSnoopWnd;
    }

    if (_dwThreadFocusSinkCookie != TF_INVALID_COOKIE)
    {
        if (_pThreadMgr->QueryInterface(IID_ITfSource, (void **)&pSource) == S_OK)
        {
            pSource->UnadviseSink(_dwThreadFocusSinkCookie);
            pSource->Release();
        }

        _dwThreadFocusSinkCookie = TF_INVALID_COOKIE;
    }
}

void CCaseTextService::_UninitThreadMgrSink ( ) [private]

Definition at line 119 of file tmgrsink.cpp.

{
    ITfSource *pSource;

    if (_dwThreadMgrEventSinkCookie == TF_INVALID_COOKIE)
        return; // never Advised

    if (_pThreadMgr->QueryInterface(IID_ITfSource, (void **)&pSource) == S_OK)
    {
        pSource->UnadviseSink(_dwThreadMgrEventSinkCookie);
        pSource->Release();
    }

    _dwThreadMgrEventSinkCookie = TF_INVALID_COOKIE;
}

STDAPI CCaseTextService::Activate | ( | ITfThreadMgr * | pThreadMgr,
 |  | TfClientId | tfClientId
 | ) |  |

Definition at line 161 of file case.cpp.

{
    ITfDocumentMgr *pFocusDoc;

    _pThreadMgr = pThreadMgr;
    _pThreadMgr->AddRef();

    _tfClientId = tfClientId;

    if (!_InitLanguageBar())
        goto ExitError;

    if (!_InitThreadMgrSink())
        goto ExitError;

    if (!_InitSnoopWnd())
        goto ExitError;

    if (!_InitKeystrokeSink())
        goto ExitError;

    if (!_InitPreservedKey())
        goto ExitError;

    // start tracking the focus doc
    if (_pThreadMgr->GetFocus(&pFocusDoc) == S_OK)
    {
        // The system will call OnSetFocus only for focus events after Activate
        // is called.
        OnSetFocus(pFocusDoc, NULL);
        pFocusDoc->Release();
    }

    return S_OK;

ExitError:
    Deactivate(); // cleanup any half-finished init
    return E_FAIL;
}

HRESULT CCaseTextService::CreateInstance | ( | IUnknown * | pUnkOuter,
 |  | REFIID | riid,
 |  | void ** | ppvObj |
 | ) |  |  | [static]

Definition at line 17 of file case.cpp.

{
    CCaseTextService *pCase;
    HRESULT hr;

    if (ppvObj == NULL)
        return E_INVALIDARG;

    *ppvObj = NULL;

    if (NULL != pUnkOuter)
        return CLASS_E_NOAGGREGATION;

    if ((pCase = new CCaseTextService) == NULL)
        return E_OUTOFMEMORY;

    hr = pCase->QueryInterface(riid, ppvObj);

    pCase->Release(); // caller still holds ref if hr == S_OK

    return hr;
}

STDAPI CCaseTextService::Deactivate ( void )

Definition at line 207 of file case.cpp.

{
    _UninitSnoopWnd();
    _UninitThreadMgrSink();
    _UninitLanguageBar();
    _UninitKeystrokeSink();
    _UninitPreservedKey();

    // we MUST release all refs to _pThreadMgr in Deactivate
    SafeReleaseClear(_pThreadMgr);

    _tfClientId = TF_CLIENTID_NULL;

    return S_OK;
}

STDAPI CCaseTextService::OnEndEdit | ( | ITfContext * | pContext,
 |  | TfEditCookie | ecReadOnly,
 |  | ITfEditRecord * | pEditRecord
 | ) |  |

Definition at line 18 of file editsink.cpp.

{
    BOOL fSelectionChanged;
    IEnumTfRanges *pEnumTextChanges;
    ITfRange *pRange;

    // we'll use the endedit notification to update the snoop window

    // did the selection change?
    if (pEditRecord->GetSelectionStatus(&fSelectionChanged) == S_OK &&
        fSelectionChanged)
    {
        _pSnoopWnd->_UpdateText(ecReadOnly, pContext, NULL);
        return S_OK;
    }

    // text modification?
    if (pEditRecord->GetTextAndPropertyUpdates(TF_GTP_INCL_TEXT, NULL, 0, &pEnumTextChanges) == S_OK)
    {
        if (pEnumTextChanges->Next(1, &pRange, NULL) == S_OK)
        {
            // arbitrary update the snoop window with the first change
            // there may be more than one in the enumerator, but we don't care here
            _pSnoopWnd->_UpdateText(ecReadOnly, pContext, pRange);
            pRange->Release();
        }

        pEnumTextChanges->Release();
    }

    // if we get here, only property values changed

    return S_OK;
}

STDAPI CCaseTextService::OnInitDocumentMgr ( ITfDocumentMgr * pDocMgr )

Definition at line 19 of file tmgrsink.cpp.

{
    return S_OK;
}

STDAPI CCaseTextService::OnKeyDown | ( | ITfContext * | pContext,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL * | pfEaten
 | ) |  |

Definition at line 176 of file keys.cpp.

{
    CKeystrokeEditSession *pEditSession;
    HRESULT hr = S_OK;

    *pfEaten = IsKeyEaten(_fFlipKeys, wParam);

    if (*pfEaten)
    {
        // we'll insert a char ourselves in place of this keystroke
        if ((pEditSession = new CKeystrokeEditSession(pContext, wParam)) == NULL)
        {
            hr = E_OUTOFMEMORY;
            goto Exit;
        }

        // we need a lock to do our work
        // nb: this method is one of the few places where it is legal to use
        // the TF_ES_SYNC flag
        if (pContext->RequestEditSession(_tfClientId, pEditSession, TF_ES_SYNC | TF_ES_READWRITE, &hr) != S_OK)
        {
            hr = E_FAIL;
        }

        pEditSession->Release();
    }

Exit:
    if (hr != S_OK)
    {
        *pfEaten = FALSE;
    }
    return S_OK;
}

STDAPI CCaseTextService::OnKeyUp | ( | ITfContext * | pContext,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL * | pfEaten
 | ) |  |

Definition at line 262 of file keys.cpp.

{
    *pfEaten = IsKeyEaten(_fFlipKeys, wParam);
    return S_OK;
}

STDAPI CCaseTextService::OnKillThreadFocus ( )

Definition at line 454 of file snoop.cpp.

{
    // only show our snoop window when our thread has the focus.
    if (_fShowSnoop)
    {
        _pSnoopWnd->_Hide();
    }

    return S_OK;
}

STDAPI CCaseTextService::OnPopContext ( ITfContext * pContext )

Definition at line 76 of file tmgrsink.cpp.

{
    return S_OK;
}

STDAPI CCaseTextService::OnPreservedKey | ( | ITfContext * | pContext,
 |  | REFGUID | rguid,
 |  | BOOL * | pfEaten
 | ) |  |

Definition at line 275 of file keys.cpp.

{
    if (IsEqualGUID(rguid, GUID_PRESERVEDKEY_FLIPCASE))
    {
        _Menu_FlipDoc(this);
        *pfEaten = TRUE;
    }
    else
    {
        *pfEaten = FALSE;
    }

    return S_OK;
}

STDAPI CCaseTextService::OnPushContext ( ITfContext * pContext )

Definition at line 64 of file tmgrsink.cpp.

{
    return S_OK;
}

STDAPI CCaseTextService::OnSetFocus ( BOOL fForeground )

Definition at line 150 of file keys.cpp.

{
    return S_OK;
}

STDAPI CCaseTextService::OnSetFocus | ( | ITfDocumentMgr * | pDocMgrFocus,
 |  | ITfDocumentMgr * | pDocMgrPrevFocus
 | ) |  |

Definition at line 46 of file tmgrsink.cpp.

{
    // track text changes on the focus doc
    // we are guarenteed a final OnSetFocus(NULL, ..) which we use for cleanup
    _InitTextEditSink(pDocMgrFocus);

    // let's update the snoop window with text from the new focus context
    _pSnoopWnd->_UpdateText(NULL);
    return S_OK;
}

STDAPI CCaseTextService::OnSetThreadFocus ( )

Definition at line 436 of file snoop.cpp.

{
    if (_fShowSnoop)
    {
        _pSnoopWnd->_Show();
    }

    return S_OK;
}

STDAPI CCaseTextService::OnTestKeyDown | ( | ITfContext * | pContext,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL * | pfEaten
 | ) |  |

Definition at line 162 of file keys.cpp.

{
    *pfEaten = IsKeyEaten(_fFlipKeys, wParam);
    return S_OK;
}

STDAPI CCaseTextService::OnTestKeyUp | ( | ITfContext * | pContext,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL * | pfEaten
 | ) |  |

Definition at line 248 of file keys.cpp.

{
    *pfEaten = IsKeyEaten(_fFlipKeys, wParam);
    return S_OK;
}

STDAPI CCaseTextService::OnUninitDocumentMgr ( ITfDocumentMgr * pDocMgr )

Definition at line 32 of file tmgrsink.cpp.

{
    return S_OK;
}

STDAPI CCaseTextService::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppvObj
 | ) |  |

Definition at line 85 of file case.cpp.

{
    if (ppvObj == NULL)
        return E_INVALIDARG;

    *ppvObj = NULL;

    if (IsEqualIID(riid, IID_IUnknown) ||
        IsEqualIID(riid, IID_ITfTextInputProcessor))
    {
        *ppvObj = (ITfTextInputProcessor *)this;
    }
    else if (IsEqualIID(riid, IID_ITfThreadMgrEventSink))
    {
        *ppvObj = (ITfThreadMgrEventSink *)this;
    }
    else if (IsEqualIID(riid, IID_ITfThreadFocusSink))
    {
        *ppvObj = (ITfThreadFocusSink *)this;
    }
    else if (IsEqualIID(riid, IID_ITfTextEditSink))
    {
        *ppvObj = (ITfTextEditSink *)this;
    }
    else if (IsEqualIID(riid, IID_ITfKeyEventSink))
    {
        *ppvObj = (ITfKeyEventSink *)this;
    }

    if (*ppvObj)
    {
        AddRef();
        return S_OK;
    }

    return E_NOINTERFACE;
}

BOOL CCaseTextService::RegisterCategories ( BOOL fRegister ) [static]

Definition at line 101 of file register.cpp.

{
    ITfCategoryMgr *pCategoryMgr;
    int i;
    HRESULT hr;

    hr = CoCreateInstance(CLSID_TF_CategoryMgr, NULL, CLSCTX_INPROC_SERVER,
                          IID_ITfCategoryMgr, (void**)&pCategoryMgr);

    if (hr != S_OK)
        return FALSE;

    for (i=0; i<ARRAYSIZE(c_rgCategories); i++)
    {
        if (fRegister)
        {
            hr = pCategoryMgr->RegisterCategory(c_clsidCaseTextService,
                   *c_rgCategories[i].pguidCategory, *c_rgCategories[i].pguid);
        }
        else
        {
            hr = pCategoryMgr->UnregisterCategory(c_clsidCaseTextService,
                   *c_rgCategories[i].pguidCategory, *c_rgCategories[i].pguid);
        }

        if (hr != S_OK)
            break;
    }

    pCategoryMgr->Release();
    return (hr == S_OK);
}

BOOL CCaseTextService::RegisterProfiles ( ) [static]

Definition at line 35 of file register.cpp.

{
    ITfInputProcessorProfiles *pInputProcessProfiles;
    WCHAR achIconFile[MAX_PATH];
    char achFileNameA[MAX_PATH];
    DWORD cchA;
    int cchIconFile;
    HRESULT hr;

    hr = CoCreateInstance(CLSID_TF_InputProcessorProfiles, NULL, CLSCTX_INPROC_SERVER,
                          IID_ITfInputProcessorProfiles, (void**)&pInputProcessProfiles);

    if (hr != S_OK)
        return E_FAIL;

    hr = pInputProcessProfiles->Register(c_clsidCaseTextService);

    if (hr != S_OK)
        goto Exit;

    cchA = GetModuleFileNameA(g_hInst, achFileNameA, ARRAYSIZE(achFileNameA));

    cchIconFile = MultiByteToWideChar(CP_ACP, 0, achFileNameA, cchA, achIconFile, ARRAYSIZE(achIconFile)-1);
    achIconFile[cchIconFile] = '\0';

    hr = pInputProcessProfiles->AddLanguageProfile(c_clsidCaseTextService,
                                  CASE_LANGID,
                                  c_guidCaseProfile,
                                  CASE_DESC,
                                  (ULONG)wcslen(CASE_DESC),
                                  achIconFile,
                                  cchIconFile,
                                  CASE_ICON_INDEX);

Exit:
    pInputProcessProfiles->Release();
    return (hr == S_OK);
}

BOOL CCaseTextService::RegisterServer ( void ) [static]

Definition at line 210 of file register.cpp.

{
    DWORD dw;
    HKEY hKey;
    HKEY hSubKey;
    BOOL fRet;
    TCHAR achIMEKey[ARRAYSIZE(c_szInfoKeyPrefix) + CLSID_STRLEN];
    TCHAR achFileName[MAX_PATH];

    if (!CLSIDToStringA(c_clsidCaseTextService, achIMEKey + ARRAYSIZE(c_szInfoKeyPrefix) - 1))
        return FALSE;
    memcpy(achIMEKey, c_szInfoKeyPrefix, sizeof(c_szInfoKeyPrefix)-sizeof(TCHAR));

    if (fRet = RegCreateKeyEx(HKEY_CLASSES_ROOT, achIMEKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, &dw)
            == ERROR_SUCCESS)
    {
        fRet &= RegSetValueEx(hKey, NULL, 0, REG_SZ, (BYTE *)CASE_DESC_A, (lstrlen(CASE_DESC_A)+1)*sizeof(TCHAR))
            == ERROR_SUCCESS;

        if (fRet &= RegCreateKeyEx(hKey, c_szInProcSvr32, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hSubKey, &dw)
            == ERROR_SUCCESS)
        {
            dw = GetModuleFileNameA(g_hInst, achFileName, ARRAYSIZE(achFileName));

            fRet &= RegSetValueEx(hSubKey, NULL, 0, REG_SZ, (BYTE *)achFileName, (lstrlen(achFileName)+1)*sizeof(TCHAR)) == ERROR_SUCCESS;
            fRet &= RegSetValueEx(hSubKey, c_szModelName, 0, REG_SZ, (BYTE *)CASE_MODEL, (lstrlen(CASE_MODEL)+1)*sizeof(TCHAR)) == ERROR_SUCCESS;
            RegCloseKey(hSubKey);
        }
        RegCloseKey(hKey);
    }

    return fRet;
}

CCaseTextService::STDMETHODIMP_ ( ULONG )
CCaseTextService::STDMETHODIMP_ ( ULONG )
void CCaseTextService::UnregisterProfiles ( ) [static]

Definition at line 80 of file register.cpp.

{
    ITfInputProcessorProfiles *pInputProcessProfiles;
    HRESULT hr;

    hr = CoCreateInstance(CLSID_TF_InputProcessorProfiles, NULL, CLSCTX_INPROC_SERVER,
                          IID_ITfInputProcessorProfiles, (void**)&pInputProcessProfiles);

    if (hr != S_OK)
        return;

    pInputProcessProfiles->Unregister(c_clsidCaseTextService);
    pInputProcessProfiles->Release();
}

void CCaseTextService::UnregisterServer ( void ) [static]

Definition at line 250 of file register.cpp.

{
    TCHAR achIMEKey[ARRAYSIZE(c_szInfoKeyPrefix) + CLSID_STRLEN];

    if (!CLSIDToStringA(c_clsidCaseTextService, achIMEKey + ARRAYSIZE(c_szInfoKeyPrefix) - 1))
        return;
    memcpy(achIMEKey, c_szInfoKeyPrefix, sizeof(c_szInfoKeyPrefix)-sizeof(TCHAR));

    RecurseDeleteKey(HKEY_CLASSES_ROOT, achIMEKey);
}

Member Data Documentation

LONG CCaseTextService::_cRef [private]

Definition at line 111 of file case.h.

DWORD CCaseTextService::_dwTextEditSinkCookie [private]

Definition at line 108 of file case.h.

DWORD CCaseTextService::_dwThreadFocusSinkCookie [private]

Definition at line 107 of file case.h.

DWORD CCaseTextService::_dwThreadMgrEventSinkCookie [private]

Definition at line 106 of file case.h.

BOOL CCaseTextService::_fFlipKeys [private]

Definition at line 102 of file case.h.

BOOL CCaseTextService::_fShowSnoop [private]

Definition at line 99 of file case.h.

CLangBarItemButton* CCaseTextService::_pLangBarItem [private]

Definition at line 104 of file case.h.

CSnoopWnd* CCaseTextService::_pSnoopWnd [private]

Definition at line 100 of file case.h.

ITfContext* CCaseTextService::_pTextEditSinkContext [private]

Definition at line 109 of file case.h.

ITfThreadMgr* CCaseTextService::_pThreadMgr [private]

Definition at line 96 of file case.h.

TfClientId CCaseTextService::_tfClientId [private]

Definition at line 97 of file case.h.

The documentation for this class was generated from the following files:
  • WinUI/TSFcase/case.h
  • WinUI/TSFcase/case.cpp
  • WinUI/TSFcase/editsink.cpp
  • WinUI/TSFcase/flipdoc.cpp
  • WinUI/TSFcase/flipsel.cpp
  • WinUI/TSFcase/hello.cpp
  • WinUI/TSFcase/keys.cpp
  • WinUI/TSFcase/langbar.cpp
  • WinUI/TSFcase/register.cpp
  • WinUI/TSFcase/snoop.cpp
  • WinUI/TSFcase/tmgrsink.cpp
Generated on Wed Nov 13 2024 16:55:44 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCertEncodeAltName Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Types | Private Member Functions | Private Attributes

CCertEncodeAltName Class Reference

#include "AltName.h"

List of all members.

Public Member Functions

CCertEncodeAltName ()
~CCertEncodeAltName ()
STDMETHOD() | Encode (BSTR *pstrBinary)
STDMETHOD() | GetName (LONG NameIndex, BSTR __RPC_FAR *pstrName)
STDMETHOD() | GetNameChoice (LONG NameIndex, LONG __RPC_FAR *pNameChoice)
STDMETHOD() | Reset (LONG NameCount)
STDMETHOD() | SetNameEntry (LONG NameIndex, LONG NameChoice, BSTR const strName)

Private Types

enum _enumNameType {
enumUnknown = 0, enumUnicode, enumAnsi, enumBlob,
enumOther
}
typedef enum
CCertEncodeAltName::_enumNameType 		enumNameType

Private Member Functions

VOID | _Cleanup (VOID)
HRESULT | _MapName (IN BOOL fEncode, IN LONG NameIndex, OUT CERT_ALT_NAME_ENTRY **ppName)
enumNameType | _NameType (IN DWORD NameChoice)
HRESULT | _SetErrorInfo (IN HRESULT hrError, IN WCHAR const *pwszDescription)
BOOL | _VerifyName (IN LONG NameIndex)

Private Attributes

CERT_ALT_NAME_ENTRY * | m_aValue
LONG | m_cValue
CERT_ALT_NAME_INFO * | m_DecodeInfo
DWORD m_DecodeLength
BOOL m_fConstructing

Detailed Description

Definition at line 21 of file AltName.h.

Member Typedef Documentation

typedef enum CCertEncodeAltName::_enumNameType CCertEncodeAltName::enumNameType [private]

Member Enumeration Documentation

enum CCertEncodeAltName::_enumNameType [private]
Enumerator:
enumUnknown
enumUnicode
enumAnsi
enumBlob
enumOther

Definition at line 89 of file AltName.h.

                               {
  enumUnknown = 0,
  enumUnicode,
  enumAnsi,
  enumBlob,
  enumOther,
    } enumNameType;

Constructor & Destructor Documentation

CCertEncodeAltName::CCertEncodeAltName ( )

Definition at line 32 of file AltName.Cpp.

{
    m_aValue = NULL;
    m_DecodeInfo = NULL;
    m_fConstructing = FALSE;
}

CCertEncodeAltName::~CCertEncodeAltName ( )

Definition at line 46 of file AltName.Cpp.

{
    _Cleanup();
}

Member Function Documentation

VOID CCertEncodeAltName::_Cleanup ( VOID ) [private]
HRESULT CCertEncodeAltName::_MapName | ( | IN BOOL | fEncode,
 |  | IN LONG | NameIndex,
 |  | OUT CERT_ALT_NAME_ENTRY ** | ppName |
 | ) |  |  | [private]

Definition at line 172 of file AltName.Cpp.

{
    HRESULT hr = S_OK;
    CERT_ALT_NAME_ENTRY *pName;

    if (fEncode)
    {
  pName = m_fConstructing? m_aValue : NULL;
    }
    else
    {
  pName = m_aValue;
    }

    if (NULL == pName)
    {
  hr = E_INVALIDARG;
  ceERRORPRINTLINE("bad parameter", hr);
  goto error;
    }

    NameIndex &= ~EAN_NAMEOBJECTID;
    if (m_cValue <= NameIndex)
    {
  ceERRORPRINTLINE("bad NameIndex parameter", hr);
  hr = E_INVALIDARG;
  goto error;
    }
    *ppName = &pName[NameIndex];

error:
    return(hr);
}

CCertEncodeAltName::enumNameType CCertEncodeAltName::_NameType ( IN DWORD NameChoice ) [private]

Definition at line 58 of file AltName.Cpp.

{
    enumNameType Type = enumUnknown;

    switch (NameChoice)
    {
  case CERT_ALT_NAME_RFC822_NAME:
  case CERT_ALT_NAME_DNS_NAME:
  case CERT_ALT_NAME_URL:
      Type = enumUnicode;
      break;

  case CERT_ALT_NAME_REGISTERED_ID:
      Type = enumAnsi;
      break;

  case CERT_ALT_NAME_DIRECTORY_NAME:
  case CERT_ALT_NAME_IP_ADDRESS:
      Type = enumBlob;
      break;

  case CERT_ALT_NAME_OTHER_NAME:
      Type = enumOther;
      break;

  //case CERT_ALT_NAME_X400_ADDRESS:
  //case CERT_ALT_NAME_EDI_PARTY_NAME:
    }
    return(Type);
}

HRESULT CCertEncodeAltName::_SetErrorInfo | ( | IN HRESULT | hrError,
 |  | IN WCHAR const * | pwszDescription |
 | ) |  |  | [private]

Definition at line 762 of file AltName.Cpp.

{
    assert(FAILED(hrError) || S_OK == hrError || S_FALSE == hrError);
    if (FAILED(hrError))
    {
  HRESULT hr;

  hr = ceDispatchSetErrorInfo(
          hrError,
          pwszDescription,
          wszCLASS_CERTENCODEALTNAME,
          &IID_ICertEncodeAltName);
  assert(hr == hrError);
    }
    return(hrError);
}

BOOL CCertEncodeAltName::_VerifyName ( IN LONG NameIndex ) [private]

Definition at line 639 of file AltName.Cpp.

{
    HRESULT hr;
    BOOL fOk = FALSE;
    CERT_ALT_NAME_ENTRY *pName;

    assert(m_fConstructing);

    hr = _MapName(TRUE, NameIndex, &pName);
    if (S_OK != hr)
    {
  ceERRORPRINTLINE("_MapName", hr);
  goto error;
    }
    assert(NULL != pName);
    switch (_NameType(pName->dwAltNameChoice))
    {
  case enumOther:
      if (NULL != pName->pOtherName &&
    NULL != pName->pOtherName->pszObjId &&
    NULL != pName->pOtherName->Value.pbData)
      {
    break;
      }
      // FALLTHROUGH

  case enumUnknown:
      hr = E_INVALIDARG;
      ceERRORPRINTLINE("uninitialized name", hr);
      goto error;
    }
    fOk = TRUE;

error:
    return(fOk);
}

STDMETHOD() CCertEncodeAltName::Encode ( BSTR * pstrBinary )
STDMETHODIMP CCertEncodeAltName::GetName | ( | LONG | NameIndex,
 |  | BSTR __RPC_FAR * | pstrName
 | ) |  |

Definition at line 336 of file AltName.Cpp.

{
    HRESULT hr;
    CERT_ALT_NAME_ENTRY *pName;

    if (NULL == pstrName)
    {
  hr = E_POINTER;
  ceERRORPRINTLINE("NULL parm", hr);
  goto error;
    }
    ceFreeBstr(pstrName);
    hr = _MapName(FALSE, NameIndex, &pName);
    if (S_OK != hr)
    {
  ceERRORPRINTLINE("_MapName", hr);
  goto error;
    }

    hr = E_OUTOFMEMORY;
    switch (_NameType(pName->dwAltNameChoice))
    {
  case enumUnicode:
      if (!ceConvertWszToBstr(pstrName, pName->pwszURL, -1))
      {
    ceERRORPRINTLINE("no memory", hr);
    goto error;
      }
      break;

  case enumAnsi:
      if (!ceConvertSzToBstr(pstrName, pName->pszRegisteredID, -1))
      {
    ceERRORPRINTLINE("no memory", hr);
    goto error;
      }
      break;

  case enumBlob:
      if (!ceConvertWszToBstr(
        pstrName,
        (WCHAR const *) pName->DirectoryName.pbData,
        pName->DirectoryName.cbData))
      {
    ceERRORPRINTLINE("no memory", hr);
    goto error;
      }
      break;

  case enumOther:
      if (EAN_NAMEOBJECTID & NameIndex)
      {
    if (!ceConvertSzToBstr(
        pstrName,
        pName->pOtherName->pszObjId,
        -1))
    {
        ceERRORPRINTLINE("no memory", hr);
        goto error;
    }
      }
      else
      {
    if (!ceConvertWszToBstr(
        pstrName,
        (WCHAR const *) pName->pOtherName->Value.pbData,
        pName->pOtherName->Value.cbData))
    {
        ceERRORPRINTLINE("no memory", hr);
        goto error;
    }
      }
      break;

  default:
      assert(enumUnknown == _NameType(pName->dwAltNameChoice));
      hr = HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
      ceERRORPRINTLINE("uninitialized", hr);
      goto error;
    }
    hr = S_OK;

error:
    return(_SetErrorInfo(hr, L"CCertEncodeAltName::GetName"));
}

STDMETHODIMP CCertEncodeAltName::GetNameChoice | ( | LONG | NameIndex,
 |  | LONG __RPC_FAR * | pNameChoice
 | ) |  |

Definition at line 297 of file AltName.Cpp.

{
    HRESULT hr;
    CERT_ALT_NAME_ENTRY *pName;

    if (NULL == pNameChoice)
    {
  hr = E_POINTER;
  ceERRORPRINTLINE("NULL parm", hr);
  goto error;
    }
    hr = _MapName(FALSE, NameIndex, &pName);
    if (S_OK != hr)
    {
  ceERRORPRINTLINE("_MapName", hr);
  goto error;
    }
    if (enumUnknown == _NameType(pName->dwAltNameChoice))
    {
  hr = HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
  ceERRORPRINTLINE("uninitialized", hr);
  goto error;
    }
    *pNameChoice = pName->dwAltNameChoice;

error:
    return(_SetErrorInfo(hr, L"CCertEncodeAltName::GetNameChoice"));
}

STDMETHODIMP CCertEncodeAltName::Reset ( LONG NameCount )

Definition at line 432 of file AltName.Cpp.

{
    HRESULT hr = S_OK;

    _Cleanup();
    m_fConstructing = TRUE;
    if (CENCODEMAX < NameCount || 0 > NameCount)
    {
  hr = E_INVALIDARG;
  ceERRORPRINTLINE("bad count parameter", hr);
  goto error;
    }

    m_aValue = (CERT_ALT_NAME_ENTRY *) LocalAlloc(
        LMEM_FIXED | LMEM_ZEROINIT,
        NameCount * sizeof(m_aValue[0]));
    if (NULL == m_aValue)
    {
  hr = E_OUTOFMEMORY;
  ceERRORPRINTLINE("LocalAlloc", hr);
  goto error;
    }
    m_cValue = NameCount;

error:
    if (S_OK != hr)
    {
  _Cleanup();
    }
    return(_SetErrorInfo(hr, L"CCertEncodeAltName::Reset"));
}

STDMETHODIMP CCertEncodeAltName::SetNameEntry | ( | LONG | NameIndex,
 |  | LONG | NameChoice,
 |  | BSTR const | strName
 | ) |  |

Definition at line 473 of file AltName.Cpp.

{
    HRESULT hr;
    CERT_ALT_NAME_ENTRY *pName;
    DATA_BLOB *pBlob = NULL;
    CCertEncodeAltName::enumNameType enumT;

    if (NULL == strName)
    {
  hr = E_POINTER;
  ceERRORPRINTLINE("NULL parm", hr);
  goto error;
    }
    if (!m_fConstructing)
    {
  hr = E_INVALIDARG;
  ceERRORPRINTLINE("bad parameter", hr);
  goto error;
    }

    hr = _MapName(TRUE, NameIndex, &pName);
    if (S_OK != hr)
    {
  ceERRORPRINTLINE("_MapName", hr);
  goto error;
    }

    enumT = enumUnknown;
    if (CERT_ALT_NAME_OTHER_NAME == pName->dwAltNameChoice &&
  0 == (EAN_NAMEOBJECTID & NameIndex))
    {
  enumT = enumOther;
    }
    if (_NameType(pName->dwAltNameChoice) != enumT)
    {
  hr = E_INVALIDARG;
  ceERRORPRINTLINE("bad parameter", hr);
  goto error;
    }
    if (CERT_ALT_NAME_OTHER_NAME != pName->dwAltNameChoice ||
  0 == (EAN_NAMEOBJECTID & NameIndex))
    {
  hr = ceVerifyAltNameString(NameChoice, strName);
  if (S_OK != hr)
  {
      ceERRORPRINTLINE("ceVerifyAltNameString", hr);
      goto error;
  }
    }

    switch (_NameType(NameChoice))
    {
  case enumUnicode:
      pName->pwszURL = ceDuplicateString(strName);
      if (NULL == pName->pwszURL)
      {
    hr = E_OUTOFMEMORY;
    ceERRORPRINTLINE("ceDuplicateString", hr);
    goto error;
      }
      break;

  case enumAnsi:
      if (CERT_ALT_NAME_REGISTERED_ID == NameChoice)
      {
    hr = ceVerifyObjId(strName);
    if (S_OK != hr)
    {
        ceERRORPRINTLINE("ceVerifyObjId", hr);
        goto error;
    }
      }
      if (!ceConvertWszToSz(&pName->pszRegisteredID, strName, -1))
      {
    hr = E_OUTOFMEMORY;
    ceERRORPRINTLINE("ceConvertWszToSz", hr);
    goto error;
      }
      break;

  case enumBlob:
      pBlob = &pName->DirectoryName;
      break;

  case enumOther:
      if (NULL == pName->pOtherName)
      {
    pName->pOtherName = (CERT_OTHER_NAME *) LocalAlloc(
          LMEM_FIXED | LMEM_ZEROINIT,
          sizeof(*pName->pOtherName));
    if (NULL == pName->pOtherName)
    {
        hr = E_OUTOFMEMORY;
        _JumpError(hr, error, "LocalAlloc");
    }
      }
      else if (CERT_ALT_NAME_OTHER_NAME != pName->dwAltNameChoice)
      {
    hr = E_INVALIDARG;
    _JumpError(hr, error, "NameChoice conflict");
      }
      if (EAN_NAMEOBJECTID & NameIndex)
      {
    if (NULL != pName->pOtherName->pszObjId)
    {
        hr = E_INVALIDARG;
        _JumpError(hr, error, "pszObjId already set");
    }
    hr = ceVerifyObjId(strName);
    if (S_OK != hr)
    {
        ceERRORPRINTLINE("ceVerifyObjId", hr);
        goto error;
    }
    if (!ceConvertWszToSz(&pName->pOtherName->pszObjId, strName, -1))
    {
        hr = E_OUTOFMEMORY;
        _JumpError(hr, error, "ceConvertWszToSz");
    }
      }
      else
      {
    pBlob = &pName->pOtherName->Value;
      }
      break;

  default:
      hr = E_INVALIDARG;
      ceERRORPRINTLINE("bad NameChoice parameter", hr);
      goto error;
      break;
    }

    if (NULL != pBlob)
    {
  if (NULL != pBlob->pbData)
  {
      hr = E_INVALIDARG;
      _JumpError(hr, error, "pbData already set");
  }
  pBlob->cbData = SysStringByteLen(strName);
  pBlob->pbData = (BYTE *) LocalAlloc(LMEM_FIXED, pBlob->cbData);
  if (NULL == pBlob->pbData)
  {
      hr = E_OUTOFMEMORY;
      _JumpError(hr, error, "LocalAlloc");
  }
  CopyMemory(pBlob->pbData, strName, pBlob->cbData);
    }
    pName->dwAltNameChoice = NameChoice;

error:
    return(_SetErrorInfo(hr, L"CCertEncodeAltName::SetNameEntry"));
}

Member Data Documentation

CERT_ALT_NAME_ENTRY* CCertEncodeAltName::m_aValue [private]

Definition at line 100 of file AltName.h.

LONG CCertEncodeAltName::m_cValue [private]

Definition at line 101 of file AltName.h.

CERT_ALT_NAME_INFO* CCertEncodeAltName::m_DecodeInfo [private]

Definition at line 102 of file AltName.h.

DWORD CCertEncodeAltName::m_DecodeLength [private]

Definition at line 103 of file AltName.h.

BOOL CCertEncodeAltName::m_fConstructing [private]

Definition at line 104 of file AltName.h.

The documentation for this class was generated from the following files:
  • Security/CertServices/Encode/AltName.h
  • Security/CertServices/Encode/AltName.Cpp
Generated on Wed Nov 13 2024 16:55:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCertEncodeBitString Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CCertEncodeBitString Class Reference

#include "BitStr.h"

List of all members.

Public Member Functions

CCertEncodeBitString ()
~CCertEncodeBitString ()
STDMETHOD() | Encode (LONG BitCount, BSTR strBitString, BSTR *pstrBinary)
STDMETHOD() | GetBitString (BSTR __RPC_FAR *pstrBitString)

Private Member Functions

VOID | _Cleanup (VOID)
HRESULT | _SetErrorInfo (IN HRESULT hrError, IN WCHAR const *pwszDescription)

Private Attributes

LONG | m_cBits
CRYPT_BIT_BLOB * | m_DecodeInfo

Detailed Description

Definition at line 21 of file BitStr.h.

Constructor & Destructor Documentation

CCertEncodeBitString::CCertEncodeBitString ( ) [inline]

Definition at line 28 of file BitStr.h.

    {
  m_DecodeInfo = NULL;
    }

CCertEncodeBitString::~CCertEncodeBitString ( )

Definition at line 28 of file BitStr.Cpp.

{
    _Cleanup();
}

Member Function Documentation

VOID CCertEncodeBitString::_Cleanup ( VOID ) [private]
HRESULT CCertEncodeBitString::_SetErrorInfo | ( | IN HRESULT | hrError,
 |  | IN WCHAR const * | pwszDescription |
 | ) |  |  | [private]

Definition at line 258 of file BitStr.Cpp.

{
    assert(FAILED(hrError) || S_OK == hrError || S_FALSE == hrError);
    if (FAILED(hrError))
    {
  HRESULT hr;

  hr = ceDispatchSetErrorInfo(
          hrError,
          pwszDescription,
          wszCLASS_CERTENCODEBITSTRING,
          &IID_ICertEncodeBitString);
  assert(hr == hrError);
    }
    return(hrError);
}

STDMETHOD() CCertEncodeBitString::Encode | ( | LONG | BitCount,
 |  | BSTR | strBitString,
 |  | BSTR * | pstrBinary
 | ) |  |
STDMETHODIMP CCertEncodeBitString::GetBitString ( BSTR __RPC_FAR * pstrBitString )

Definition at line 136 of file BitStr.Cpp.

{
    HRESULT hr = E_INVALIDARG;

    if (NULL == pstrBitString)
    {
  hr = E_POINTER;
  ceERRORPRINTLINE("NULL parm", hr);
  goto error;
    }
    ceFreeBstr(pstrBitString);

    if (NULL == m_DecodeInfo)
    {
  ceERRORPRINTLINE("bad parameter", hr);
  goto error;
    }

    hr = E_OUTOFMEMORY;
    if (!ceConvertWszToBstr(
      pstrBitString,
      (WCHAR const *) m_DecodeInfo->pbData,
      m_DecodeInfo->cbData))
    {
  ceERRORPRINTLINE("no memory", hr);
  goto error;
    }
    hr = S_OK;

error:
    return(_SetErrorInfo(hr, L"CCertEncodeBitString::GetBitString"));
}

Member Data Documentation

LONG CCertEncodeBitString::m_cBits [private]

Definition at line 73 of file BitStr.h.

CRYPT_BIT_BLOB* CCertEncodeBitString::m_DecodeInfo [private]

Definition at line 74 of file BitStr.h.

The documentation for this class was generated from the following files:
  • Security/CertServices/Encode/BitStr.h
  • Security/CertServices/Encode/BitStr.Cpp
Generated on Wed Nov 13 2024 16:55:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCertEncodeCRLDistInfo Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CCertEncodeCRLDistInfo Class Reference

#include "CrlDist.h"

List of all members.

Public Member Functions

CCertEncodeCRLDistInfo ()
~CCertEncodeCRLDistInfo ()
STDMETHOD() | Encode (BSTR *pstrBinary)
STDMETHOD() | GetName (LONG DistPointIndex, LONG NameIndex, BSTR __RPC_FAR *pstrName)
STDMETHOD() | GetNameChoice (LONG DistPointIndex, LONG NameIndex, LONG __RPC_FAR *pNameChoice)
STDMETHOD() | GetNameCount (LONG DistPointIndex, LONG __RPC_FAR *pNameCount)
STDMETHOD() | Reset (LONG DistPointCount)
STDMETHOD() | SetNameCount (LONG DistPointIndex, LONG NameCount)
STDMETHOD() | SetNameEntry (LONG DistPointIndex, LONG NameIndex, LONG NameChoice, BSTR const strName)

Private Member Functions

VOID | _Cleanup (VOID)
HRESULT | _MapDistPoint (IN BOOL fEncode, IN LONG DistPointIndex, OUT LONG **ppNameCount, OUT CERT_ALT_NAME_ENTRY ***ppaName)
HRESULT | _MapName (IN BOOL fEncode, IN LONG DistPointIndex, IN LONG NameIndex, OUT CERT_ALT_NAME_ENTRY **ppName)
HRESULT | _SetErrorInfo (IN HRESULT hrError, IN WCHAR const *pwszDescription)
BOOL | _VerifyNames (IN LONG DistPointIndex)

Private Attributes

CRL_DIST_POINT * | m_aValue
LONG | m_cValue
CRL_DIST_POINTS_INFO * | m_DecodeInfo
BOOL m_fConstructing

Detailed Description

Definition at line 21 of file CrlDist.h.

Constructor & Destructor Documentation

CCertEncodeCRLDistInfo::CCertEncodeCRLDistInfo ( ) [inline]

Definition at line 28 of file CrlDist.h.

    {
  m_aValue = NULL;
  m_DecodeInfo = NULL;
  m_fConstructing = FALSE;
    }

CCertEncodeCRLDistInfo::~CCertEncodeCRLDistInfo ( )

Definition at line 28 of file CrlDist.Cpp.

{
    _Cleanup();
}

Member Function Documentation

VOID CCertEncodeCRLDistInfo::_Cleanup ( VOID ) [private]
HRESULT CCertEncodeCRLDistInfo::_MapDistPoint | ( | IN BOOL | fEncode,
 |  | IN LONG | DistPointIndex,
 |  | OUT LONG ** | ppNameCount,
 |  | OUT CERT_ALT_NAME_ENTRY *** | ppaName |
 | ) |  |  | [private]

Definition at line 95 of file CrlDist.Cpp.

{
    HRESULT hr = S_OK;
    CRL_DIST_POINT *pDistPoint;

    if (fEncode)
    {
  pDistPoint = m_fConstructing? m_aValue : NULL;
    }
    else
    {
  pDistPoint = m_aValue;
    }

    if (NULL == pDistPoint)
    {
  hr = E_INVALIDARG;
  ceERRORPRINTLINE("bad parameter", hr);
  goto error;
    }

    if (m_cValue <= DistPointIndex)
    {
  ceERRORPRINTLINE("bad DistPointIndex parameter", hr);
  hr = E_INVALIDARG;
  goto error;
    }
    *ppNameCount =
  (LONG *) &pDistPoint[DistPointIndex].DistPointName.FullName.cAltEntry;
    *ppaName = &pDistPoint[DistPointIndex].DistPointName.FullName.rgAltEntry;

error:
    return(hr);
}

HRESULT CCertEncodeCRLDistInfo::_MapName | ( | IN BOOL | fEncode,
 |  | IN LONG | DistPointIndex,
 |  | IN LONG | NameIndex,
 |  | OUT CERT_ALT_NAME_ENTRY ** | ppName |
 | ) |  |  | [private]

Definition at line 141 of file CrlDist.Cpp.

{
    HRESULT hr;
    LONG *pNameCount;
    CERT_ALT_NAME_ENTRY **paName;

    if (NULL == ppName)
    {
  hr = E_POINTER;
        ceERRORPRINTLINE("NULL parm", hr);
  goto error;
    }

    hr = _MapDistPoint(fEncode, DistPointIndex, &pNameCount, &paName);
    if (S_OK != hr)
    {
  ceERRORPRINTLINE("_MapDistPoint", hr);
  goto error;
    }
    if (*pNameCount <= NameIndex)
    {
  ceERRORPRINTLINE("bad NameIndex parameter", hr);
  hr = E_INVALIDARG;
  goto error;
    }
    *ppName = &(*paName)[NameIndex];

error:
    return(hr);
}

HRESULT CCertEncodeCRLDistInfo::_SetErrorInfo | ( | IN HRESULT | hrError,
 |  | IN WCHAR const * | pwszDescription |
 | ) |  |  | [private]

Definition at line 793 of file CrlDist.Cpp.

{
    assert(FAILED(hrError) || S_OK == hrError || S_FALSE == hrError);
    if (FAILED(hrError))
    {
  HRESULT hr;

  hr = ceDispatchSetErrorInfo(
          hrError,
          pwszDescription,
          wszCLASS_CERTENCODECRLDISTINFO,
          &IID_ICertEncodeCRLDistInfo);
  assert(hr == hrError);
    }
    return(hrError);
}

BOOL CCertEncodeCRLDistInfo::_VerifyNames ( IN LONG DistPointIndex ) [private]

Definition at line 665 of file CrlDist.Cpp.

{
    HRESULT hr;
    BOOL fOk = FALSE;
    LONG Count;
    LONG *pNameCount;
    LONG i;
    CERT_ALT_NAME_ENTRY **paName;

    assert(m_fConstructing);

    hr = _MapDistPoint(TRUE, DistPointIndex, &pNameCount, &paName);
    if (S_OK != hr)
    {
  ceERRORPRINTLINE("_MapDistPoint", hr);
  goto error;
    }
    Count = *pNameCount;
    if (0 != Count)
    {
  CERT_ALT_NAME_ENTRY *pName;

  pName = *paName;
  assert(NULL != pName);
  for (i = 0; i < Count; pName++, i++)
  {
      if (NULL == pName->pwszURL)   // test arbitrary union arm
      {
    hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
    ceERRORPRINTLINE("uninitialized name", hr);
    goto error;
      }
  }
    }
    fOk = TRUE;

error:
    return(fOk);
}

STDMETHOD() CCertEncodeCRLDistInfo::Encode ( BSTR * pstrBinary )
STDMETHODIMP CCertEncodeCRLDistInfo::GetName | ( | LONG | DistPointIndex,
 |  | LONG | NameIndex,
 |  | BSTR __RPC_FAR * | pstrName
 | ) |  |

Definition at line 349 of file CrlDist.Cpp.

{
    HRESULT hr;
    CERT_ALT_NAME_ENTRY *pName;
    WCHAR const *pwsz = NULL;
    char const *psz = NULL;

    if (NULL == pstrName)
    {
  hr = E_POINTER;
  ceERRORPRINTLINE("NULL parm", hr);
  goto error;
    }
    ceFreeBstr(pstrName);
    hr = _MapName(FALSE, DistPointIndex, NameIndex, &pName);
    if (S_OK != hr)
    {
  ceERRORPRINTLINE("_MapName", hr);
  goto error;
    }

    switch (pName->dwAltNameChoice)
    {
  case CERT_ALT_NAME_RFC822_NAME:
      pwsz = pName->pwszRfc822Name;
      break;

  case CERT_ALT_NAME_DNS_NAME:
      pwsz = pName->pwszDNSName;
      break;

  case CERT_ALT_NAME_URL:
      pwsz = pName->pwszURL;
      break;

  case CERT_ALT_NAME_REGISTERED_ID:
      psz = pName->pszRegisteredID;
      break;

  //case CERT_ALT_NAME_DIRECTORY_NAME:
  //case CERT_ALT_NAME_OTHER_NAME:
  //case CERT_ALT_NAME_X400_ADDRESS:
  //case CERT_ALT_NAME_EDI_PARTY_NAME:
  //case CERT_ALT_NAME_IP_ADDRESS:
  default:
      assert(0 == pName->dwAltNameChoice);
      hr = HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
      ceERRORPRINTLINE("uninitialized", hr);
      goto error;
    }

    // we'd better assure 1 and only 1 of these is non null

    if ((NULL != pwsz) ^ (NULL == psz))
    {
       hr = E_UNEXPECTED;
       _JumpError(hr, error, "((NULL != pwsz) ^ (NULL == psz))");
    }

    hr = E_OUTOFMEMORY;
    if (NULL != pwsz)
    {
  if (!ceConvertWszToBstr(pstrName, pwsz, -1))
  {
      ceERRORPRINTLINE("no memory", hr);
      goto error;
  }
    }
    else
    {
  assert(NULL != psz);
  if (!ceConvertSzToBstr(pstrName, psz, -1))
  {
      ceERRORPRINTLINE("no memory", hr);
      goto error;
  }
    }
    hr = S_OK;

error:
    return(_SetErrorInfo(hr, L"CCertEncodeCRLDistInfo::GetName"));
}

STDMETHODIMP CCertEncodeCRLDistInfo::GetNameChoice | ( | LONG | DistPointIndex,
 |  | LONG | NameIndex,
 |  | LONG __RPC_FAR * | pNameChoice
 | ) |  |

Definition at line 308 of file CrlDist.Cpp.

{
    HRESULT hr;
    CERT_ALT_NAME_ENTRY *pName;

    if (NULL == pNameChoice)
    {
        hr = E_POINTER;
  ceERRORPRINTLINE("NULL parm", hr);
  goto error;
    }

    hr = _MapName(FALSE, DistPointIndex, NameIndex, &pName);
    if (S_OK != hr)
    {
  ceERRORPRINTLINE("_MapName", hr);
  goto error;
    }
    *pNameChoice = pName->dwAltNameChoice;
    if (0 == pName->dwAltNameChoice)
    {
  hr = HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
  ceERRORPRINTLINE("uninitialized", hr);
  goto error;
    }

error:
    return(_SetErrorInfo(hr, L"CCertEncodeCRLDistInfo::GetNameChoice"));
}

STDMETHODIMP CCertEncodeCRLDistInfo::GetNameCount | ( | LONG | DistPointIndex,
 |  | LONG __RPC_FAR * | pNameCount
 | ) |  |

Definition at line 267 of file CrlDist.Cpp.

{
    HRESULT hr;
    LONG *pCount;
    CERT_ALT_NAME_ENTRY **paName;

    if (NULL == pNameCount)
    {
        hr = E_POINTER;
  ceERRORPRINTLINE("NULL parm", hr);
  goto error;
    }

    hr = _MapDistPoint(FALSE, DistPointIndex, &pCount, &paName);
    if (S_OK != hr)
    {
  ceERRORPRINTLINE("_MapDistPoint", hr);
  goto error;
    }
    if (NULL == *paName)
    {
  hr = HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
  ceERRORPRINTLINE("uninitialized", hr);
  goto error;
    }
    *pNameCount = *pCount;

error:
    return(_SetErrorInfo(hr, L"CCertEncodeCRLDistInfo::GetNameCount"));
}

STDMETHODIMP CCertEncodeCRLDistInfo::Reset ( LONG DistPointCount )

Definition at line 443 of file CrlDist.Cpp.

{
    HRESULT hr = S_OK;

    _Cleanup();
    m_fConstructing = TRUE;
    if (CENCODEMAX < DistPointCount || 0 > DistPointCount)
    {
  hr = E_INVALIDARG;
  ceERRORPRINTLINE("bad count parameter", hr);
  goto error;
    }

    m_aValue = (CRL_DIST_POINT *) LocalAlloc(
        LMEM_FIXED | LMEM_ZEROINIT,
        DistPointCount * sizeof(m_aValue[0]));
    if (NULL == m_aValue)
    {
  hr = E_OUTOFMEMORY;
  ceERRORPRINTLINE("LocalAlloc", hr);
  goto error;
    }
    m_cValue = DistPointCount;

error:
    if (S_OK != hr)
    {
  _Cleanup();
    }
    return(_SetErrorInfo(hr, L"CCertEncodeCRLDistInfo::Reset"));
}

STDMETHODIMP CCertEncodeCRLDistInfo::SetNameCount | ( | LONG | DistPointIndex,
 |  | LONG | NameCount
 | ) |  |

Definition at line 484 of file CrlDist.Cpp.

{
    HRESULT hr;
    LONG *pNameCount;
    CERT_ALT_NAME_ENTRY **paName;

    hr = E_INVALIDARG;
    if (!m_fConstructing)
    {
  ceERRORPRINTLINE("bad parameter", hr);
  goto error;
    }
    if (CENCODEMAX < NameCount || 0 > NameCount)
    {
  ceERRORPRINTLINE("bad count parameter", hr);
  goto error;
    }

    hr = _MapDistPoint(FALSE, DistPointIndex, &pNameCount, &paName);
    if (S_OK != hr)
    {
  ceERRORPRINTLINE("_MapDistPoint", hr);
  goto error;
    }
    if (0 != *pNameCount || NULL != *paName)
    {
  hr = E_INVALIDARG;
  ceERRORPRINTLINE("bad parameter", hr);
  goto error;
    }

    *paName = (CERT_ALT_NAME_ENTRY *) LocalAlloc(
        LMEM_FIXED | LMEM_ZEROINIT,
        NameCount * sizeof(CERT_ALT_NAME_ENTRY));
    if (NULL == *paName)
    {
  hr = E_OUTOFMEMORY;
  ceERRORPRINTLINE("LocalAlloc", hr);
  goto error;
    }
    *pNameCount = NameCount;

error:
    return(_SetErrorInfo(hr, L"CCertEncodeCRLDistInfo::SetNameCount"));
}

STDMETHODIMP CCertEncodeCRLDistInfo::SetNameEntry | ( | LONG | DistPointIndex,
 |  | LONG | NameIndex,
 |  | LONG | NameChoice,
 |  | BSTR const | strName
 | ) |  |

Definition at line 540 of file CrlDist.Cpp.

{
    HRESULT hr;
    CERT_ALT_NAME_ENTRY *pName;
    WCHAR **ppwsz = NULL;
    char **ppsz = NULL;

    if (NULL == strName)
    {
  hr = E_POINTER;
  ceERRORPRINTLINE("NULL parm", hr);
  goto error;
    }
    if (!m_fConstructing)
    {
  hr = E_INVALIDARG;
  ceERRORPRINTLINE("bad parameter", hr);
  goto error;
    }

    hr = _MapName(TRUE, DistPointIndex, NameIndex, &pName);
    if (S_OK != hr)
    {
  ceERRORPRINTLINE("_MapName", hr);
  goto error;
    }

    if (NULL != pName->pwszURL)
    {
  hr = E_INVALIDARG;
  ceERRORPRINTLINE("bad parameter", hr);
  goto error;
    }

    switch (NameChoice)
    {
  case CERT_ALT_NAME_RFC822_NAME:
      ppwsz = &pName->pwszRfc822Name;
      break;

  case CERT_ALT_NAME_DNS_NAME:
      ppwsz = &pName->pwszDNSName;
      break;

  case CERT_ALT_NAME_URL:
      ppwsz = &pName->pwszURL;
      break;

  case CERT_ALT_NAME_REGISTERED_ID:
      hr = ceVerifyObjId(strName);
      if (S_OK != hr)
      {
    ceERRORPRINTLINE("ceVerifyObjId", hr);
    goto error;
      }
      ppsz = &pName->pszRegisteredID;
      break;

  //case CERT_ALT_NAME_DIRECTORY_NAME:
  //case CERT_ALT_NAME_OTHER_NAME:
  //case CERT_ALT_NAME_X400_ADDRESS:
  //case CERT_ALT_NAME_EDI_PARTY_NAME:
  //case CERT_ALT_NAME_IP_ADDRESS:
    }
    if (NULL != ppwsz)
    {
  if (NULL != *ppwsz)
  {
      hr = E_INVALIDARG;
      ceERRORPRINTLINE("string already set", hr);
      goto error;
  }
  hr = ceVerifyAltNameString(NameChoice, strName);
  if (S_OK != hr)
  {
      ceERRORPRINTLINE("ceVerifyAltNameString", hr);
      goto error;
  }
  *ppwsz = ceDuplicateString(strName);
  if (NULL == *ppwsz)
  {
      hr = E_OUTOFMEMORY;
      ceERRORPRINTLINE("ceDuplicateString", hr);
      goto error;
  }
    }
    else if (NULL != ppsz)
    {
  if (NULL != *ppsz)
  {
      hr = E_INVALIDARG;
      ceERRORPRINTLINE("string already set", hr);
      goto error;
  }
  if (!ceConvertWszToSz(ppsz, strName, -1))
  {
      hr = E_OUTOFMEMORY;
      ceERRORPRINTLINE("ceConvertWszToSz", hr);
      goto error;
  }
    }
    else
    {
  hr = E_INVALIDARG;
  ceERRORPRINTLINE("bad NameChoice parameter", hr);
  goto error;
    }
    pName->dwAltNameChoice = NameChoice;

error:
    return(_SetErrorInfo(hr, L"CCertEncodeCRLDistInfo::SetNameEntry"));
}

Member Data Documentation

CRL_DIST_POINT* CCertEncodeCRLDistInfo::m_aValue [private]

Definition at line 112 of file CrlDist.h.

LONG CCertEncodeCRLDistInfo::m_cValue [private]

Definition at line 113 of file CrlDist.h.

CRL_DIST_POINTS_INFO* CCertEncodeCRLDistInfo::m_DecodeInfo [private]

Definition at line 114 of file CrlDist.h.

BOOL CCertEncodeCRLDistInfo::m_fConstructing [private]

Definition at line 115 of file CrlDist.h.

The documentation for this class was generated from the following files:
  • Security/CertServices/Encode/CrlDist.h
  • Security/CertServices/Encode/CrlDist.Cpp
Generated on Wed Nov 13 2024 16:55:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCertEncodeDateArray Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CCertEncodeDateArray Class Reference

#include "ADate.h"

List of all members.

Public Member Functions

CCertEncodeDateArray ()
~CCertEncodeDateArray ()
STDMETHOD() | Encode (BSTR __RPC_FAR *pstrBinary)
STDMETHOD() | GetValue (LONG Index, DATE __RPC_FAR *pValue)
STDMETHOD() | Reset (LONG Count)
STDMETHOD() | SetValue (LONG Index, DATE Value)

Private Member Functions

VOID | _Cleanup (VOID)
HRESULT | _SetErrorInfo (IN HRESULT hrError, IN WCHAR const *pwszDescription)

Private Attributes

DATE * | m_aValue
LONG | m_cValue
LONG | m_cValuesSet
BOOL m_fConstructing

Detailed Description

Definition at line 21 of file ADate.h.

Constructor & Destructor Documentation

CCertEncodeDateArray::CCertEncodeDateArray ( ) [inline]

Definition at line 28 of file ADate.h.

    {
  m_aValue = NULL;
  m_fConstructing = FALSE;
    }

CCertEncodeDateArray::~CCertEncodeDateArray ( )

Definition at line 28 of file ADate.Cpp.

{
    _Cleanup();
}

Member Function Documentation

VOID CCertEncodeDateArray::_Cleanup ( VOID ) [private]
HRESULT CCertEncodeDateArray::_SetErrorInfo | ( | IN HRESULT | hrError,
 |  | IN WCHAR const * | pwszDescription |
 | ) |  |  | [private]

Definition at line 418 of file ADate.Cpp.

{
    assert(FAILED(hrError) || S_OK == hrError || S_FALSE == hrError);
    if (FAILED(hrError))
    {
  HRESULT hr;

  hr = ceDispatchSetErrorInfo(
          hrError,
          pwszDescription,
          wszCLASS_CERTENCODEDATEARRAY,
          &IID_ICertEncodeDateArray);
  assert(hr == hrError);
    }
    return(hrError);
}

STDMETHODIMP CCertEncodeDateArray::Encode ( BSTR __RPC_FAR * pstrBinary )

Definition at line 292 of file ADate.Cpp.

{
    HRESULT hr = S_OK;
    LONG i;
    CRYPT_SEQUENCE_OF_ANY Sequence;
    BYTE *pbEncoded = NULL;
    DWORD cbEncoded;

    Sequence.cValue = 0;
    Sequence.rgValue = NULL;

    if (NULL == pstrBinary)
    {
  hr = E_POINTER;
  ceERRORPRINTLINE("NULL parm", hr);
  goto error;
    }
    ceFreeBstr(pstrBinary);
    if (!m_fConstructing || NULL == m_aValue)
    {
  hr = E_INVALIDARG;
  ceERRORPRINTLINE("bad parameter", hr);
  goto error;
    }
    if (m_cValuesSet != m_cValue)
    {
  hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
  ceERRORPRINTLINE("m_cValuesSet", hr);
  goto error;
    }

    Sequence.rgValue = (CRYPT_DER_BLOB *) LocalAlloc(
            LMEM_FIXED,
            m_cValue * sizeof(Sequence.rgValue[0]));
    if (NULL == Sequence.rgValue)
    {
  hr = E_OUTOFMEMORY;
  ceERRORPRINTLINE("LocalAlloc", hr);
  goto error;
    }

    for (i = 0; i < m_cValue; i++)
    {
  FILETIME ft;

  // Convert each DATE into a FILETIME:

  assert(0 != m_aValue[i]);
  hr = ceDateToFileTime(&m_aValue[i], &ft);
  if (S_OK != hr)
  {
      ceERRORPRINTLINE("ceDateToFileTime", hr);
      goto error;
  }

  // Encode each FILETIME into an ASN blob:

  if (!ceEncodeObject(
      X509_ASN_ENCODING,
      X509_CHOICE_OF_TIME,
      &ft,
      0,
      FALSE,
      &Sequence.rgValue[i].pbData,
      &Sequence.rgValue[i].cbData))
  {
      hr = ceHLastError();
      ceERRORPRINTLINE("ceEncodeObject", hr);
      goto error;
  }
  Sequence.cValue++;
    }
    assert((LONG) Sequence.cValue == m_cValue);

    // Encode the array of ASN blob:

    if (!ceEncodeObject(
        X509_ASN_ENCODING,
        X509_SEQUENCE_OF_ANY,
        &Sequence,
        0,
        FALSE,
        &pbEncoded,
        &cbEncoded))
    {
  hr = ceHLastError();
  ceERRORPRINTLINE("ceEncodeObject", hr);
  goto error;
    }
    if (!ceConvertWszToBstr(
      pstrBinary,
      (WCHAR const *) pbEncoded,
      cbEncoded))
    {
  hr = E_OUTOFMEMORY;
  ceERRORPRINTLINE("ceConvertWszToBstr", hr);
  goto error;
    }

error:
    if (NULL != pbEncoded)
    {
  LocalFree(pbEncoded);
    }
    if (NULL != Sequence.rgValue)
    {
  assert((LONG) Sequence.cValue <= m_cValue);
  for (i = 0; i < (LONG) Sequence.cValue; i++)
  {
      assert(NULL != Sequence.rgValue[i].pbData);
      LocalFree(Sequence.rgValue[i].pbData);
  }
  LocalFree(Sequence.rgValue);
    }
    return(_SetErrorInfo(hr, L"CCertEncodeDateArray::Encode"));
}

STDMETHODIMP CCertEncodeDateArray::GetValue | ( | LONG | Index,
 |  | DATE __RPC_FAR * | pValue
 | ) |  |

Definition at line 186 of file ADate.Cpp.

{
    HRESULT hr = S_OK;

    if (NULL == pValue)
    {
  hr = E_POINTER;
  ceERRORPRINTLINE("NULL parm", hr);
  goto error;
    }
    if (NULL == m_aValue || Index >= m_cValue)
    {
  hr = E_INVALIDARG;
  ceERRORPRINTLINE("bad parameter", hr);
  goto error;
    }
    if (0 == m_aValue[Index])
    {
  hr = HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
  ceERRORPRINTLINE("uninitialized", hr);
  goto error;
    }
    *pValue = m_aValue[Index];

error:
    return(_SetErrorInfo(hr, L"CCertEncodeDateArray::GetValue"));
}

STDMETHODIMP CCertEncodeDateArray::Reset ( LONG Count )

Definition at line 224 of file ADate.Cpp.

{
    HRESULT hr = S_OK;

    _Cleanup();
    m_fConstructing = TRUE;
    if (CENCODEMAX < Count || 0 > Count)
    {
  hr = E_INVALIDARG;
  ceERRORPRINTLINE("bad count parameter", hr);
  goto error;
    }
    m_aValue = (DATE *) LocalAlloc(
        LMEM_FIXED | LMEM_ZEROINIT,
        Count * sizeof(m_aValue[0]));
    if (NULL == m_aValue)
    {
  hr = E_OUTOFMEMORY;
  ceERRORPRINTLINE("LocalAlloc", hr);
  goto error;
    }
    m_cValue = Count;

error:
    return(_SetErrorInfo(hr, L"CCertEncodeDateArray::Reset"));
}

STDMETHODIMP CCertEncodeDateArray::SetValue | ( | LONG | Index,
 |  | DATE | Value
 | ) |  |

Definition at line 260 of file ADate.Cpp.

{
    HRESULT hr = S_OK;

    if (!m_fConstructing ||
  NULL == m_aValue ||
  Index >= m_cValue ||
  m_cValuesSet >= m_cValue ||
  0 != m_aValue[Index] ||
  0 == Value)
    {
  hr = E_INVALIDARG;
  ceERRORPRINTLINE("bad parameter", hr);
  goto error;
    }
    m_aValue[Index] = Value;
    m_cValuesSet++;

error:
    return(_SetErrorInfo(hr, L"CCertEncodeDateArray::SetValue"));
}

Member Data Documentation

DATE* CCertEncodeDateArray::m_aValue [private]

Definition at line 80 of file ADate.h.

LONG CCertEncodeDateArray::m_cValue [private]

Definition at line 81 of file ADate.h.

LONG CCertEncodeDateArray::m_cValuesSet [private]

Definition at line 82 of file ADate.h.

BOOL CCertEncodeDateArray::m_fConstructing [private]

Definition at line 83 of file ADate.h.

The documentation for this class was generated from the following files:
  • Security/CertServices/Encode/ADate.h
  • Security/CertServices/Encode/ADate.Cpp
Generated on Wed Nov 13 2024 16:55:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCertEncodeLongArray Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CCertEncodeLongArray Class Reference

#include "ALong.h"

List of all members.

Public Member Functions

CCertEncodeLongArray ()
~CCertEncodeLongArray ()
STDMETHOD() | Encode (BSTR __RPC_FAR *pstrBinary)
STDMETHOD() | GetValue (LONG Index, LONG __RPC_FAR *pValue)
STDMETHOD() | Reset (LONG Count)
STDMETHOD() | SetValue (LONG Index, LONG Value)

Private Member Functions

VOID | _Cleanup (VOID)
HRESULT | _SetErrorInfo (IN HRESULT hrError, IN WCHAR const *pwszDescription)

Private Attributes

LONG * | m_aValue
LONG | m_cValue
LONG | m_cValuesSet
BOOL m_fConstructing

Detailed Description

Definition at line 21 of file ALong.h.

Constructor & Destructor Documentation

CCertEncodeLongArray::CCertEncodeLongArray ( ) [inline]

Definition at line 28 of file ALong.h.

    {
  m_aValue = NULL;
  m_fConstructing = FALSE;
    }

CCertEncodeLongArray::~CCertEncodeLongArray ( )

Definition at line 28 of file ALong.Cpp.

{
    _Cleanup();
}

Member Function Documentation

VOID CCertEncodeLongArray::_Cleanup ( VOID ) [private]
HRESULT CCertEncodeLongArray::_SetErrorInfo | ( | IN HRESULT | hrError,
 |  | IN WCHAR const * | pwszDescription |
 | ) |  |  | [private]

Definition at line 410 of file ALong.Cpp.

{
    assert(FAILED(hrError) || S_OK == hrError || S_FALSE == hrError);
    if (FAILED(hrError))
    {
  HRESULT hr;

  hr = ceDispatchSetErrorInfo(
          hrError,
          pwszDescription,
          wszCLASS_CERTENCODELONGARRAY,
          &IID_ICertEncodeLongArray);
  assert(hr == hrError);
    }
    return(hrError);
}

STDMETHODIMP CCertEncodeLongArray::Encode ( BSTR __RPC_FAR * pstrBinary )

Definition at line 296 of file ALong.Cpp.

{
    HRESULT hr = S_OK;
    LONG i;
    CRYPT_SEQUENCE_OF_ANY Sequence;
    BYTE *pbEncoded = NULL;
    DWORD cbEncoded;

    Sequence.cValue = 0;
    Sequence.rgValue = NULL;

    if (NULL == pstrBinary)
    {
  hr = E_POINTER;
  ceERRORPRINTLINE("NULL parm", hr);
  goto error;
    }
    ceFreeBstr(pstrBinary);
    if (!m_fConstructing || NULL == m_aValue)
    {
  hr = E_INVALIDARG;
  ceERRORPRINTLINE("bad parameter", hr);
  goto error;
    }
    if (m_cValuesSet != m_cValue)
    {
  hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
  ceERRORPRINTLINE("m_cValuesSet", hr);
  goto error;
    }

    Sequence.rgValue = (CRYPT_DER_BLOB *) LocalAlloc(
            LMEM_FIXED,
            m_cValue * sizeof(Sequence.rgValue[0]));
    if (NULL == Sequence.rgValue)
    {
  hr = E_OUTOFMEMORY;
  ceERRORPRINTLINE("LocalAlloc", hr);
  goto error;
    }

    for (i = 0; i < m_cValue; i++)
    {
  // Encode each integer into an ASN blob:

  if (!ceEncodeObject(
      X509_ASN_ENCODING,
      X509_INTEGER,
      &m_aValue[i],
      0,
      FALSE,
      &Sequence.rgValue[i].pbData,
      &Sequence.rgValue[i].cbData))
  {
      hr = ceHLastError();
      ceERRORPRINTLINE("ceEncodeObject", hr);
      goto error;
  }
  Sequence.cValue++;
    }
    assert((LONG) Sequence.cValue == m_cValue);

    // Encode each integer into an ASN blob:

    if (!ceEncodeObject(
        X509_ASN_ENCODING,
        X509_SEQUENCE_OF_ANY,
        &Sequence,
        0,
        FALSE,
        &pbEncoded,
        &cbEncoded))
    {
  hr = ceHLastError();
  ceERRORPRINTLINE("ceEncodeObject", hr);
  goto error;
    }
    if (!ceConvertWszToBstr(
      pstrBinary,
      (WCHAR const *) pbEncoded,
      cbEncoded))
    {
  hr = E_OUTOFMEMORY;
  ceERRORPRINTLINE("ceConvertWszToBstr", hr);
  goto error;
    }

error:
    if (NULL != pbEncoded)
    {
  LocalFree(pbEncoded);
    }
    if (NULL != Sequence.rgValue)
    {
  assert((LONG) Sequence.cValue <= m_cValue);
  for (i = 0; i < (LONG) Sequence.cValue; i++)
  {
      assert(NULL != Sequence.rgValue[i].pbData);
      LocalFree(Sequence.rgValue[i].pbData);
  }
  LocalFree(Sequence.rgValue);
    }
    return(_SetErrorInfo(hr, L"CCertEncodeLongArray::Encode"));
}

STDMETHODIMP CCertEncodeLongArray::GetValue | ( | LONG | Index,
 |  | LONG __RPC_FAR * | pValue
 | ) |  |

Definition at line 175 of file ALong.Cpp.

{
    HRESULT hr = S_OK;
    BYTE *pb;

    if (NULL == pValue)
    {
  hr = E_POINTER;
  ceERRORPRINTLINE("NULL parm", hr);
  goto error;
    }
    if (NULL == m_aValue || Index >= m_cValue)
    {
  hr = E_INVALIDARG;
  ceERRORPRINTLINE("bad parameter", hr);
  goto error;
    }

    // Bitmap only exists when constrcuting!

    if (m_fConstructing)
    {
  pb = (BYTE *) &m_aValue[m_cValue];
  if (!GETBIT(pb, Index))
  {
      hr = HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
      ceERRORPRINTLINE("uninitialized", hr);
      goto error;
  }
    }
    *pValue = m_aValue[Index];

error:
    return(_SetErrorInfo(hr, L"CCertEncodeLongArray::GetValue"));
}

STDMETHODIMP CCertEncodeLongArray::Reset ( LONG Count )

Definition at line 221 of file ALong.Cpp.

{
    HRESULT hr = S_OK;
    DWORD cbAlloc;

    _Cleanup();
    m_fConstructing = TRUE;
    if (CENCODEMAX < Count || 0 > Count)
    {
  hr = E_INVALIDARG;
  ceERRORPRINTLINE("bad count parameter", hr);
  goto error;
    }
    cbAlloc = Count * sizeof(m_aValue[0]) + BITSTOBYTES(Count);
    m_aValue = (LONG *) LocalAlloc(LMEM_FIXED | LMEM_ZEROINIT, cbAlloc);
    if (NULL == m_aValue)
    {
  hr = E_OUTOFMEMORY;
  ceERRORPRINTLINE("LocalAlloc", hr);
  goto error;
    }
    m_cValue = Count;

error:
    return(_SetErrorInfo(hr, L"CCertEncodeLongArray::Reset"));
}

STDMETHODIMP CCertEncodeLongArray::SetValue | ( | LONG | Index,
 |  | LONG | Value
 | ) |  |

Definition at line 257 of file ALong.Cpp.

{
    HRESULT hr = S_OK;
    BYTE *pb;

    if (!m_fConstructing ||
  NULL == m_aValue ||
  Index >= m_cValue ||
  m_cValuesSet >= m_cValue)
    {
  hr = E_INVALIDARG;
  ceERRORPRINTLINE("bad parameter", hr);
  goto error;
    }
    pb = (BYTE *) &m_aValue[m_cValue];
    if (GETBIT(pb, Index))
    {
  hr = E_INVALIDARG;
  ceERRORPRINTLINE("already set", hr);
  goto error;
    }
    SETBIT(pb, Index);
    m_aValue[Index] = Value;
    m_cValuesSet++;

error:
    return(_SetErrorInfo(hr, L"CCertEncodeLongArray::SetValue"));
}

Member Data Documentation

LONG* CCertEncodeLongArray::m_aValue [private]

Definition at line 80 of file ALong.h.

LONG CCertEncodeLongArray::m_cValue [private]

Definition at line 81 of file ALong.h.

LONG CCertEncodeLongArray::m_cValuesSet [private]

Definition at line 82 of file ALong.h.

BOOL CCertEncodeLongArray::m_fConstructing [private]

Definition at line 83 of file ALong.h.

The documentation for this class was generated from the following files:
  • Security/CertServices/Encode/ALong.h
  • Security/CertServices/Encode/ALong.Cpp
Generated on Wed Nov 13 2024 16:55:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCertEncodeStringArray Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CCertEncodeStringArray Class Reference

#include "AString.h"

List of all members.

Public Member Functions

CCertEncodeStringArray ()
~CCertEncodeStringArray ()
STDMETHOD() | Encode (BSTR *pstrBinary)
STDMETHOD() | GetCount (LONG __RPC_FAR *pCount)
STDMETHOD() | GetValue (LONG Index, BSTR __RPC_FAR *pstr)
STDMETHOD() | Reset (LONG Count, LONG StringType)
STDMETHOD() | SetValue (LONG Index, BSTR const str)

Private Member Functions

VOID | _Cleanup (VOID)
HRESULT | _SetErrorInfo (IN HRESULT hrError, IN WCHAR const *pwszDescription)

Private Attributes

CERT_NAME_VALUE ** | m_aValue
LONG | m_cValue
LONG | m_cValuesSet
BOOL m_fConstructing
LONG | m_StringType

Detailed Description

Definition at line 21 of file AString.h.

Constructor & Destructor Documentation

CCertEncodeStringArray::CCertEncodeStringArray ( ) [inline]

Definition at line 28 of file AString.h.

    {
  m_aValue = NULL;
  m_fConstructing = FALSE;
    }

CCertEncodeStringArray::~CCertEncodeStringArray ( )

Definition at line 28 of file AString.Cpp.

{
    _Cleanup();
}

Member Function Documentation

VOID CCertEncodeStringArray::_Cleanup ( VOID ) [private]
HRESULT CCertEncodeStringArray::_SetErrorInfo | ( | IN HRESULT | hrError,
 |  | IN WCHAR const * | pwszDescription |
 | ) |  |  | [private]

Definition at line 541 of file AString.Cpp.

{
    assert(FAILED(hrError) || S_OK == hrError || S_FALSE == hrError);
    if (FAILED(hrError))
    {
  HRESULT hr;

  hr = ceDispatchSetErrorInfo(
          hrError,
          pwszDescription,
          wszCLASS_CERTENCODESTRINGARRAY,
          &IID_ICertEncodeStringArray);
  assert(hr == hrError);
    }
    return(hrError);
}

STDMETHOD() CCertEncodeStringArray::Encode ( BSTR * pstrBinary )
STDMETHODIMP CCertEncodeStringArray::GetCount ( LONG __RPC_FAR * pCount )

Definition at line 212 of file AString.Cpp.

{
    HRESULT hr = S_OK;

    if (NULL == pCount)
    {
  hr = E_POINTER;
  ceERRORPRINTLINE("NULL parm", hr);
  goto error;
    }
    if (NULL == m_aValue)
    {
  hr = E_INVALIDARG;
  ceERRORPRINTLINE("bad parameter", hr);
  goto error;
    }
    *pCount = m_cValue;
error:
    return(_SetErrorInfo(hr, L"CCertEncodeStringArray::GetCount"));
}

STDMETHODIMP CCertEncodeStringArray::GetValue | ( | LONG | Index,
 |  | BSTR __RPC_FAR * | pstr
 | ) |  |

Definition at line 242 of file AString.Cpp.

{
    HRESULT hr = S_OK;

    if (NULL == pstr)
    {
  hr = E_POINTER;
  ceERRORPRINTLINE("NULL parm", hr);
  goto error;
    }
    ceFreeBstr(pstr);
    if (NULL == m_aValue || Index >= m_cValue)
    {
  hr = E_INVALIDARG;
  ceERRORPRINTLINE("bad parameter", hr);
  goto error;
    }
    if (NULL == m_aValue[Index]->Value.pbData)
    {
  hr = HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
  ceERRORPRINTLINE("uninitialized", hr);
  goto error;
    }
    if (!ceConvertWszToBstr(
      pstr,
      (WCHAR const *) m_aValue[Index]->Value.pbData,
      -1))
    {
  hr = E_OUTOFMEMORY;
  ceERRORPRINTLINE("ceConvertWszToBstr", hr);
  goto error;
    }
error:
    return(_SetErrorInfo(hr, L"CCertEncodeStringArray::GetValue"));
}

STDMETHODIMP CCertEncodeStringArray::Reset | ( | LONG | Count,
 |  | LONG | StringType
 | ) |  |

Definition at line 288 of file AString.Cpp.

{
    HRESULT hr = S_OK;
    CERT_NAME_VALUE *aNameValue = NULL;
    LONG i;

    _Cleanup();
    m_fConstructing = TRUE;
    if (CENCODEMAX < Count || 0 > Count)
    {
  hr = E_INVALIDARG;
  ceERRORPRINTLINE("bad count parameter", hr);
  goto error;
    }

    switch (StringType)
    {
  case CERT_RDN_ANY_TYPE:
  //case CERT_RDN_ENCODED_BLOB:
  //case CERT_RDN_OCTET_STRING:
  case CERT_RDN_NUMERIC_STRING:
  case CERT_RDN_PRINTABLE_STRING:
  //case CERT_RDN_TELETEX_STRING: same as CERT_RDN_T61_STRING:
  case CERT_RDN_T61_STRING:
  case CERT_RDN_VIDEOTEX_STRING:
  case CERT_RDN_IA5_STRING:
  case CERT_RDN_GRAPHIC_STRING:
  //case CERT_RDN_VISIBLE_STRING: same as CERT_RDN_ISO646_STRING:
  case CERT_RDN_ISO646_STRING:
  case CERT_RDN_GENERAL_STRING:
  //case CERT_RDN_UNIVERSAL_STRING: same as CERT_RDN_INT4_STRING:
  case CERT_RDN_INT4_STRING:
  //case CERT_RDN_BMP_STRING: same as case CERT_RDN_UNICODE_STRING:
  case CERT_RDN_UNICODE_STRING:
      break;

  default:
      hr = E_INVALIDARG;
      ceERRORPRINTLINE("bad parameter", hr);
      goto error;
    }
    m_StringType = StringType;

    aNameValue = (CERT_NAME_VALUE *) LocalAlloc(
        LMEM_FIXED | LMEM_ZEROINIT,
        Count * sizeof(*m_aValue[0]));
    if (NULL == aNameValue)
    {
  hr = E_OUTOFMEMORY;
  ceERRORPRINTLINE("LocalAlloc", hr);
  goto error;
    }

    m_aValue = (CERT_NAME_VALUE **) LocalAlloc(
        LMEM_FIXED,
        Count * sizeof(m_aValue[0]));
    if (NULL == m_aValue)
    {
  hr = E_OUTOFMEMORY;
  ceERRORPRINTLINE("LocalAlloc", hr);
  goto error;
    }

    m_cValue = Count;
    for (i = 0; i < Count; i++)
    {
  m_aValue[i] = &aNameValue[i];
    }
    aNameValue = NULL;

error:
    if (NULL != aNameValue)
    {
  LocalFree(aNameValue);
    }
    if (S_OK != hr)
    {
  _Cleanup();
    }
    return(_SetErrorInfo(hr, L"CCertEncodeStringArray::Reset"));
}

STDMETHODIMP CCertEncodeStringArray::SetValue | ( | LONG | Index,
 |  | BSTR const | str
 | ) |  |

Definition at line 380 of file AString.Cpp.

{
    HRESULT hr = S_OK;
    WCHAR *pwsz;

    if (NULL == str)
    {
  hr = E_POINTER;
  ceERRORPRINTLINE("NULL parm", hr);
  goto error;
    }
    if (!m_fConstructing ||
  NULL == m_aValue ||
  Index >= m_cValue ||
  m_cValuesSet >= m_cValue ||
  NULL != m_aValue[Index]->Value.pbData)
    {
  hr = E_INVALIDARG;
  ceERRORPRINTLINE("bad parameter", hr);
  goto error;
    }
    pwsz = ceDuplicateString(str);
    if (NULL == pwsz)
    {
  hr = E_OUTOFMEMORY;
  ceERRORPRINTLINE("ceDuplicateString", hr);
  goto error;
    }
    m_aValue[Index]->dwValueType = m_StringType;
    m_aValue[Index]->Value.pbData = (BYTE *) pwsz;
    m_aValue[Index]->Value.cbData = 0;
    m_cValuesSet++;

error:
    return(_SetErrorInfo(hr, L"CCertEncodeStringArray::SetValue"));
}

Member Data Documentation

CERT_NAME_VALUE** CCertEncodeStringArray::m_aValue [private]

Definition at line 84 of file AString.h.

LONG CCertEncodeStringArray::m_cValue [private]

Definition at line 85 of file AString.h.

LONG CCertEncodeStringArray::m_cValuesSet [private]

Definition at line 86 of file AString.h.

BOOL CCertEncodeStringArray::m_fConstructing [private]

Definition at line 87 of file AString.h.

LONG CCertEncodeStringArray::m_StringType [private]

Definition at line 88 of file AString.h.

The documentation for this class was generated from the following files:
  • Security/CertServices/Encode/AString.h
  • Security/CertServices/Encode/AString.Cpp
Generated on Wed Nov 13 2024 16:55:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCertExitSample Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CCertExitSample Class Reference

#include "exit.h"

List of all members.

Public Member Functions

CCertExitSample ()
CCertExitSample ()
~CCertExitSample ()
~CCertExitSample ()
DECLARE_REGISTRY (CCertExitSample, wszCLASS_CERTEXITSAMPLE TEXT(".1"), wszCLASS_CERTEXITSAMPLE, IDS_CERTEXIT_DESC, THREADFLAGS_BOTH) STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid)
DECLARE_REGISTRY (CCertExitSample, wszCLASS_CERTEXITSAMPLE TEXT(".1"), wszCLASS_CERTEXITSAMPLE, IDS_CERTEXIT_DESC, THREADFLAGS_BOTH) STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid)
STDMETHOD() | GetDescription (BSTR *pstrDescription)
STDMETHOD() | GetDescription (BSTR *pstrDescription)
STDMETHOD() | GetManageModule (ICertManageModule **ppManageModule)
STDMETHOD() | Initialize (BSTR const strConfig, LONG __RPC_FAR *pEventMask)
STDMETHOD() | Initialize (BSTR const strConfig, LONG __RPC_FAR *pEventMask)
STDMETHOD() | Notify (LONG ExitEvent, LONG Context)
STDMETHOD() | Notify (LONG ExitEvent, LONG Context)

Private Member Functions

HRESULT | _ExpandEnvironmentVariables (IN WCHAR const *pwszIn, OUT WCHAR *pwszOut, IN DWORD cwcOut)
HRESULT | _ExpandEnvironmentVariables (IN WCHAR const *pwszIn, OUT WCHAR *pwszOut, IN DWORD cwcOut)
HRESULT | _NotifyCRLIssued (IN LONG Context)
HRESULT | _NotifyCRLIssued (IN LONG Context)
HRESULT | _NotifyNewCert (IN LONG Context)
HRESULT | _NotifyNewCert (IN LONG Context)
HRESULT | _WriteCertToFile (IN ICertServerExit *pServer, IN BYTE const *pbCert, IN DWORD cbCert)
HRESULT | _WriteCertToFile (IN ICertServerExit *pServer, IN BYTE const *pbCert, IN DWORD cbCert)

Private Attributes

BSTR | m_bstrDescription
DWORD m_cCACert
INT | m_cCRLPublishRetryCount
DWORD m_dwExitPublishFlags
HKEY m_hExitKey
LPWSTR | m_pwszRegStorageLoc
BSTR | m_strCAName
BSTR | m_strDescription
LPWSTR | m_wszRegStorageLoc

Detailed Description

Definition at line 32 of file exit.h.

Constructor & Destructor Documentation

CCertExitSample::CCertExitSample ( ) [inline]

Definition at line 39 of file exit.h.

    {
        m_strDescription = NULL;
        m_strCAName = NULL;
        m_pwszRegStorageLoc = NULL;
        m_hExitKey = NULL;
        m_dwExitPublishFlags = 0;
        m_cCACert = 0;
    }

CCertExitSample::~CCertExitSample ( )

Definition at line 83 of file exit.cpp.

{
    if (NULL != m_strCAName)
    {
        SysFreeString(m_strCAName);
    }
    if (NULL != m_pwszRegStorageLoc)
    {
        LocalFree(m_pwszRegStorageLoc);
    }
    if (NULL != m_hExitKey)
    {
        RegCloseKey(m_hExitKey);
    }
    if (NULL != m_strDescription)
    {
        SysFreeString(m_strDescription);
    }
}

CCertExitSample::CCertExitSample ( ) [inline]

Definition at line 44 of file Exit.h.

    {
  m_bstrDescription = NULL;
        m_strCAName = NULL;
        m_wszRegStorageLoc = NULL;
        m_hExitKey = NULL;
        m_dwExitPublishFlags = 0;
        m_cCACert = 0;
        m_cCRLPublishRetryCount = CRL_PUBLISH_RETRY_DEFAULT;

    }

CCertExitSample::~CCertExitSample ( )

Member Function Documentation

HRESULT CCertExitSample::_ExpandEnvironmentVariables | ( | IN WCHAR const * | pwszIn,
 |  | OUT WCHAR * | pwszOut,
 |  | IN DWORD | cwcOut |
 | ) |  |  | [private]

Definition at line 241 of file exit.cpp.

{
    HRESULT hr = HRESULT_FROM_WIN32(ERROR_BUFFER_OVERFLOW);
    WCHAR awcVar[MAX_PATH];
    WCHAR const *pwszSrc;
    WCHAR *pwszDst;
    WCHAR *pwszDstEnd;
    WCHAR *pwszVar;
    DWORD cwc;

    pwszSrc = pwszIn;
    pwszDst = pwszOut;
    pwszDstEnd = &pwszOut[cwcOut];

    while (L'\0' != (*pwszDst = *pwszSrc++))
    {
  if ('%' == *pwszDst)
  {
      *pwszDst = L'\0';
      pwszVar = awcVar;

      while (L'\0' != *pwszSrc)
      {
    if ('%' == *pwszSrc)
    {
        pwszSrc++;
        break;
    }
    *pwszVar++ = *pwszSrc++;
    if (pwszVar >= &awcVar[sizeof(awcVar)/sizeof(awcVar[0]) - 1])
    {
        _JumpError(hr, error, "Exit:overflow 1");
    }
      }
      *pwszVar = L'\0';
      cwc = GetEnvironmentVariable(awcVar, pwszDst, SAFE_SUBTRACT_POINTERS(pwszDstEnd, pwszDst));
      if (0 == cwc)
      {
    hr = ceHLastError();
    _JumpError(hr, error, "Exit:GetEnvironmentVariable");
      }
      if ((DWORD) (pwszDstEnd - pwszDst) <= cwc)
      {
    _JumpError(hr, error, "Exit:overflow 2");
      }
      pwszDst += cwc;
  }
  else
  {
      pwszDst++;
  }
  if (pwszDst >= pwszDstEnd)
  {
      _JumpError(hr, error, "Exit:overflow 3");
  }
    }
    hr = S_OK;

error:
    return(hr);
}

HRESULT CCertExitSample::_ExpandEnvironmentVariables | ( | IN WCHAR const * | pwszIn,
 |  | OUT WCHAR * | pwszOut,
 |  | IN DWORD | cwcOut |
 | ) |  |  | [private]
HRESULT CCertExitSample::_NotifyCRLIssued ( IN LONG Context ) [private]
HRESULT CCertExitSample::_NotifyCRLIssued ( IN LONG Context ) [private]
HRESULT CCertExitSample::_NotifyNewCert ( IN LONG Context ) [private]
HRESULT CCertExitSample::_NotifyNewCert ( IN LONG Context ) [private]
HRESULT CCertExitSample::_WriteCertToFile | ( | IN ICertServerExit * | pServer,
 |  | IN BYTE const * | pbCert,
 |  | IN DWORD | cbCert |
 | ) |  |  | [private]
HRESULT CCertExitSample::_WriteCertToFile | ( | IN ICertServerExit * | pServer,
 |  | IN BYTE const * | pbCert,
 |  | IN DWORD | cbCert |
 | ) |  |  | [private]

Definition at line 346 of file exit.cpp.

{
    HRESULT hr;
    BSTR strCertFile = NULL;
    DWORD cbWritten;
    HANDLE hFile = INVALID_HANDLE_VALUE;
    WCHAR wszDir[MAX_PATH];
    WCHAR *pwszPath = NULL;
    WCHAR wszFile[cwcDWORDSPRINTF+5]; //format "requestid.cer"
    VARIANT varRequestID;

    VariantInit(&varRequestID);

    // Old functionality asked requester to pass in a CertFile attribute with
    // the output request file name. After the security review we decided
    // to not allow file name from user but to build it at server. Still, we
    // don't want to start publishing all certificates, so we'll maintain the
    // CertFile property; if present, we'll just ignore its content, if not
    // present we won't publish.
    hr = exitGetRequestAttribute(pServer, wszPROPEXITCERTFILE, &strCertFile);
    if (S_OK != hr)
    {
  DBGPRINT((
      fDebug,
      "Exit:exitGetRequestAttribute(%ws): %x%hs\n",
      wszPROPEXITCERTFILE,
      hr,
      CERTSRV_E_PROPERTY_EMPTY == hr? " EMPTY VALUE" : ""));
  if (CERTSRV_E_PROPERTY_EMPTY == hr)
  {
      hr = S_OK;
  }
  goto error;
    }

    // build file name as "requestid.cer"

    hr = exitGetProperty(
        pServer,
        TRUE,  // fRequest,
        wszPROPREQUESTREQUESTID,
        PROPTYPE_LONG,
        &varRequestID);
    _JumpIfErrorStr(hr, error, "Exit:exitGetProperty", wszPROPREQUESTREQUESTID);

    wsprintf(wszFile, L"%d.cer", V_I4(&varRequestID));

    hr = _ExpandEnvironmentVariables(
        L"%SystemRoot%\\System32\\" wszCERTENROLLSHAREPATH L"\\",
        wszDir,
        ARRAYSIZE(wszDir));
    _JumpIfError(hr, error, "_ExpandEnvironmentVariables");

    hr = ceBuildPathAndExt(wszDir, wszFile, NULL, &pwszPath);
    _JumpIfError(hr, error, "ceBuildPathAndExt");

    // open file & write binary cert out.

    hFile = CreateFile(
        pwszPath,
        GENERIC_WRITE,
        0,      // dwShareMode
        NULL,   // lpSecurityAttributes
        CREATE_NEW,
        FILE_ATTRIBUTE_NORMAL,
        NULL);    // hTemplateFile
    if (INVALID_HANDLE_VALUE == hFile)
    {
  hr = ceHLastError();
  _JumpErrorStr(hr, error, "Exit:CreateFile", pwszPath);
    }
    if (!WriteFile(hFile, pbCert, cbCert, &cbWritten, NULL))
    {
  hr = ceHLastError();
  _JumpErrorStr(hr, error, "Exit:WriteFile", pwszPath);
    }
    if (cbWritten != cbCert)
    {
  hr = STG_E_WRITEFAULT;
  DBGPRINT((
      fDebug,
      "Exit:WriteFile(%ws): attempted %x, actual %x bytes: %x\n",
      pwszPath,
      cbCert,
      cbWritten,
      hr));
  goto error;
    }

error:

    if (INVALID_HANDLE_VALUE != hFile)
    {
  CloseHandle(hFile);
    }
    if (NULL != pwszPath)
    {
  LocalFree(pwszPath);
    }
    if (NULL != strCertFile)
    {
  SysFreeString(strCertFile);
    }
    return(hr);
}

CCertExitSample::DECLARE_REGISTRY | ( | CCertExitSample | ,
 |  | wszCLASS_CERTEXITSAMPLE | TEXT".1",
 |  | wszCLASS_CERTEXITSAMPLE | ,
 |  | IDS_CERTEXIT_DESC | ,
 |  | THREADFLAGS_BOTH |
 | ) |  |
CCertExitSample::DECLARE_REGISTRY | ( | CCertExitSample | ,
 |  | wszCLASS_CERTEXITSAMPLE | TEXT".1",
 |  | wszCLASS_CERTEXITSAMPLE | ,
 |  | IDS_CERTEXIT_DESC | ,
 |  | THREADFLAGS_BOTH |
 | ) |  |
STDMETHODIMP CCertExitSample::GetDescription ( BSTR * pstrDescription )

Definition at line 703 of file exit.cpp.

{
    HRESULT hr = S_OK;
    WCHAR sz[MAX_PATH];

    assert(wcslen(wsz_SAMPLE_DESCRIPTION) < ARRAYSIZE(sz));
    wcscpy(sz, wsz_SAMPLE_DESCRIPTION);

    *pstrDescription = SysAllocString(sz);
    if (NULL == *pstrDescription)
    {
  hr = E_OUTOFMEMORY;
  _JumpError(hr, error, "Exit:SysAllocString");
    }

error:
    return(hr);
}

STDMETHOD() CCertExitSample::GetDescription ( BSTR * pstrDescription )
STDMETHODIMP CCertExitSample::GetManageModule ( ICertManageModule ** ppManageModule )

Definition at line 731 of file exit.cpp.

{
    HRESULT hr;

    *ppManageModule = NULL;
    hr = CoCreateInstance(
            CLSID_CCertManageExitModuleSample,
            NULL,               // pUnkOuter
            CLSCTX_INPROC_SERVER,
            IID_ICertManageModule,
            (VOID **) ppManageModule);
    _JumpIfError(hr, error, "CoCreateInstance");

error:
    return(hr);
}

STDMETHODIMP CCertExitSample::Initialize | ( | BSTR const | strConfig,
 |  | LONG __RPC_FAR * | pEventMask
 | ) |  |

Definition at line 111 of file exit.cpp.

{
    HRESULT hr = S_OK;
    DWORD       cbbuf;
    DWORD       dwType;
    ENUM_CATYPES CAType;
    ICertServerExit* pServer = NULL;
    VARIANT varValue;
    WCHAR sz[MAX_PATH];

    VariantInit(&varValue);

    assert(wcslen(wsz_SAMPLE_DESCRIPTION) < ARRAYSIZE(sz));
    wcsncpy(sz, wsz_SAMPLE_DESCRIPTION, ARRAYSIZE(sz));
    sz[ARRAYSIZE(sz) - 1] = L'\0';

    m_strDescription = SysAllocString(sz);
    if (NULL == m_strDescription)
    {
        hr = E_OUTOFMEMORY;
        _JumpError(hr, error, "Exit:SysAllocString");
    }

    m_strCAName = SysAllocString(strConfig);
    if (NULL == m_strCAName)
    {
      hr = E_OUTOFMEMORY;
        _JumpError(hr, error, "Exit:SysAllocString");
    }

    *pEventMask = ceEXITEVENTS;
    DBGPRINT((fDebug, "Exit:Initialize(%ws) ==> %x\n", m_strCAName, *pEventMask));

    // get server callbacks

    hr = GetServerCallbackInterface(&pServer, 0);
    _JumpIfError(hr, error, "Exit:GetServerCallbackInterface");

    // get storage location

    hr = exitGetProperty(
        pServer,
        FALSE,  // fRequest
        wszPROPMODULEREGLOC,
        PROPTYPE_STRING,
        &varValue);
    _JumpIfErrorStr(hr, error, "Exit:exitGetProperty", wszPROPMODULEREGLOC);

    m_pwszRegStorageLoc = (LPWSTR)LocalAlloc(LMEM_FIXED, (wcslen(varValue.bstrVal)+1) *sizeof(WCHAR));
    if (NULL == m_pwszRegStorageLoc)
    {
        hr = E_OUTOFMEMORY;
        _JumpError(hr, error, "Exit:LocalAlloc");
    }
    wcscpy(m_pwszRegStorageLoc, varValue.bstrVal);
    VariantClear(&varValue);

    // get CA type
    hr = exitGetProperty(
        pServer,
        FALSE,  // fRequest
        wszPROPCATYPE,
        PROPTYPE_LONG,
        &varValue);
    _JumpIfErrorStr(hr, error, "Exit:exitGetProperty", wszPROPCATYPE);

    CAType = (ENUM_CATYPES) varValue.lVal;
    VariantClear(&varValue);

    hr = RegOpenKeyEx(
                HKEY_LOCAL_MACHINE,
                m_pwszRegStorageLoc,
                0,              // dwReserved
                KEY_ENUMERATE_SUB_KEYS | KEY_EXECUTE | KEY_QUERY_VALUE,
                &m_hExitKey);

    if (S_OK != hr)
    {
        if ((HRESULT) ERROR_FILE_NOT_FOUND == hr)
        {
            hr = S_OK;
            goto error;
        }
        _JumpError(hr, error, "Exit:RegOpenKeyEx");
    }

    hr = exitGetProperty(
        pServer,
        FALSE,  // fRequest
        wszPROPCERTCOUNT,
        PROPTYPE_LONG,
        &varValue);
    _JumpIfErrorStr(hr, error, "Exit:exitGetProperty", wszPROPCERTCOUNT);

    m_cCACert = varValue.lVal;

    cbbuf = sizeof(m_dwExitPublishFlags);
    hr = RegQueryValueEx(
        m_hExitKey,
        wszREGCERTPUBLISHFLAGS,
        NULL,           // lpdwReserved
        &dwType,
        (BYTE *) &m_dwExitPublishFlags,
        &cbbuf);
    if (S_OK != hr)
    {
        m_dwExitPublishFlags = 0;
    }

    hr = S_OK;

error:
    VariantClear(&varValue);
    if (NULL != pServer)
    {
        pServer->Release();
    }
    return(ceHError(hr));
}

STDMETHOD() CCertExitSample::Initialize | ( | BSTR const | strConfig,
 |  | LONG __RPC_FAR * | pEventMask
 | ) |  |
STDMETHODIMP CCertExitSample::Notify | ( | LONG | ExitEvent,
 |  | LONG | Context
 | ) |  |

Definition at line 650 of file exit.cpp.

{
    char *psz = "UNKNOWN EVENT";
    HRESULT hr = S_OK;

    switch (ExitEvent)
    {
  case EXITEVENT_CERTISSUED:
      hr = _NotifyNewCert(Context);
      psz = "certissued";
      break;

  case EXITEVENT_CERTPENDING:
      psz = "certpending";
      break;

  case EXITEVENT_CERTDENIED:
      psz = "certdenied";
      break;

  case EXITEVENT_CERTREVOKED:
      psz = "certrevoked";
      break;

  case EXITEVENT_CERTRETRIEVEPENDING:
      psz = "retrievepending";
      break;

  case EXITEVENT_CRLISSUED:
      hr = _NotifyCRLIssued(Context);
      psz = "crlissued";
      break;

  case EXITEVENT_SHUTDOWN:
      psz = "shutdown";
      break;
    }

    DBGPRINT((
  fDebug,
  "Exit:Notify(%hs=%x, ctx=%x) rc=%x\n",
  psz,
  ExitEvent,
  Context,
  hr));
    return(hr);
}

STDMETHOD() CCertExitSample::Notify | ( | LONG | ExitEvent,
 |  | LONG | Context
 | ) |  |

Member Data Documentation

BSTR CCertExitSample::m_bstrDescription [private]

Definition at line 105 of file Exit.h.

DWORD CCertExitSample::m_cCACert [private]

Definition at line 108 of file exit.h.

INT CCertExitSample::m_cCRLPublishRetryCount [private]

Definition at line 111 of file Exit.h.

DWORD CCertExitSample::m_dwExitPublishFlags [private]

Definition at line 107 of file exit.h.

HKEY CCertExitSample::m_hExitKey [private]

Definition at line 106 of file exit.h.

LPWSTR CCertExitSample::m_pwszRegStorageLoc [private]

Definition at line 105 of file exit.h.

BSTR CCertExitSample::m_strCAName [private]

Definition at line 104 of file exit.h.

BSTR CCertExitSample::m_strDescription [private]

Definition at line 103 of file exit.h.

LPWSTR CCertExitSample::m_wszRegStorageLoc [private]

Definition at line 107 of file Exit.h.

The documentation for this class was generated from the following files:
  • Security/CertServices/Exit/C++/Windows.Net/exit.h
  • Security/CertServices/Exit/C++/Windows2000/Exit.h
  • Security/CertServices/Exit/C++/Windows.Net/exit.cpp
  • Security/CertServices/Exit/C++/Windows2000/Exit.Cpp
Generated on Wed Nov 13 2024 16:55:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCertManageExitModuleSample Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CCertManageExitModuleSample Class Reference

#include "module.h"

List of all members.

Public Member Functions

CCertManageExitModuleSample ()
CCertManageExitModuleSample ()
~CCertManageExitModuleSample ()
~CCertManageExitModuleSample ()
STDMETHOD() | Configure (const BSTR strConfig, BSTR strStorageLocation, LONG dwFlags)
STDMETHOD() | Configure (const BSTR strConfig, BSTR strStorageLocation, LONG dwFlags)

Detailed Description

Definition at line 16 of file module.h.

Constructor & Destructor Documentation

CCertManageExitModuleSample::CCertManageExitModuleSample ( ) [inline]

Definition at line 22 of file module.h.

{}

CCertManageExitModuleSample::~CCertManageExitModuleSample ( ) [inline]

Definition at line 23 of file module.h.

{}

CCertManageExitModuleSample::CCertManageExitModuleSample ( ) [inline]

Definition at line 22 of file Module.h.

{}

CCertManageExitModuleSample::~CCertManageExitModuleSample ( ) [inline]

Definition at line 23 of file Module.h.

{}

Member Function Documentation

STDMETHODIMP CCertManageExitModuleSample::Configure | ( | const BSTR | strConfig,
 |  | BSTR | strStorageLocation,
 |  | LONG | dwFlags
 | ) |  |

Definition at line 73 of file module.cpp.

{
    MessageBox(NULL, L"No Configurable Options", NULL, MB_OK|MB_ICONINFORMATION);

    return S_OK;
}

STDMETHOD() CCertManageExitModuleSample::Configure | ( | const BSTR | strConfig,
 |  | BSTR | strStorageLocation,
 |  | LONG | dwFlags
 | ) |  |
The documentation for this class was generated from the following files:
  • Security/CertServices/Exit/C++/Windows.Net/module.h
  • Security/CertServices/Exit/C++/Windows2000/Module.h
  • Security/CertServices/Exit/C++/Windows.Net/module.cpp
  • Security/CertServices/Exit/C++/Windows2000/Module.Cpp
Generated on Wed Nov 13 2024 16:55:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCertManagePolicyModuleSample Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CCertManagePolicyModuleSample Class Reference

#include "module.h"

List of all members.

Public Member Functions

CCertManagePolicyModuleSample ()
CCertManagePolicyModuleSample ()
~CCertManagePolicyModuleSample ()
~CCertManagePolicyModuleSample ()
STDMETHOD() | Configure (const BSTR strConfig, BSTR strStorageLocation, LONG dwFlags)
STDMETHOD() | Configure (const BSTR strConfig, BSTR strStorageLocation, LONG dwFlags)

Detailed Description

Definition at line 16 of file module.h.

Constructor & Destructor Documentation

CCertManagePolicyModuleSample::CCertManagePolicyModuleSample ( ) [inline]

Definition at line 22 of file module.h.

{}

CCertManagePolicyModuleSample::~CCertManagePolicyModuleSample ( ) [inline]

Definition at line 23 of file module.h.

{}

CCertManagePolicyModuleSample::CCertManagePolicyModuleSample ( ) [inline]

Definition at line 22 of file Module.h.

{}

CCertManagePolicyModuleSample::~CCertManagePolicyModuleSample ( ) [inline]

Definition at line 23 of file Module.h.

{}

Member Function Documentation

STDMETHODIMP CCertManagePolicyModuleSample::Configure | ( | const BSTR | strConfig,
 |  | BSTR | strStorageLocation,
 |  | LONG | dwFlags
 | ) |  |

Definition at line 74 of file module.cpp.

{
    MessageBox(NULL, L"No Configurable Options", NULL, MB_OK|MB_ICONINFORMATION);

    return S_OK;
}

STDMETHOD() CCertManagePolicyModuleSample::Configure | ( | const BSTR | strConfig,
 |  | BSTR | strStorageLocation,
 |  | LONG | dwFlags
 | ) |  |
The documentation for this class was generated from the following files:
  • Security/CertServices/Policy/C++/Windows.Net/module.h
  • Security/CertServices/Policy/C++/Windows2000/Module.h
  • Security/CertServices/Policy/C++/Windows.Net/module.cpp
  • Security/CertServices/Policy/C++/Windows2000/Module.Cpp
Generated on Wed Nov 13 2024 16:55:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCertPolicySample Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes

CCertPolicySample Class Reference

#include "policy.h"

List of all members.

Public Member Functions

CCertPolicySample ()
CCertPolicySample ()
~CCertPolicySample ()
~CCertPolicySample ()
HRESULT | AddBasicConstraintsCommon (IN ICertServerPolicy *pServer, IN CERT_EXTENSION const *pExtension, IN BOOL fCA, IN BOOL fEnableExtension)
HRESULT | AddBasicConstraintsCommon (IN ICertServerPolicy *pServer, IN CERT_EXTENSION const *pExtension, IN BOOL fCA, IN BOOL fEnableExtension)
HRESULT | AddV1TemplateNameExtension (IN ICertServerPolicy *pServer, OPTIONAL IN WCHAR const *pwszTemplateName)
DECLARE_REGISTRY (CCertPolicySample, wszCLASS_CERTPOLICYSAMPLE TEXT(".1"), wszCLASS_CERTPOLICYSAMPLE, IDS_CERTPOLICY_DESC, THREADFLAGS_BOTH) STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid)
DECLARE_REGISTRY (CCertPolicySample, wszCLASS_CERTPOLICYSAMPLE TEXT(".1"), wszCLASS_CERTPOLICYSAMPLE, IDS_CERTPOLICY_DESC, THREADFLAGS_BOTH) STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid)
STDMETHOD() | GetDescription (BSTR __RPC_FAR *pstrDescription)
STDMETHOD() | GetDescription (BSTR __RPC_FAR *pstrDescription)
STDMETHOD() | GetManageModule (ICertManageModule **ppManageModule)
BSTRC GetPolicyDescription ()
STDMETHOD() | Initialize (BSTR const strConfig)
STDMETHOD() | Initialize (BSTR const strConfig)
STDMETHOD() | ShutDown ()
STDMETHOD() | ShutDown ()
STDMETHOD() | VerifyRequest (BSTR const strConfig, LONG Context, LONG bNewRequest, LONG Flags, LONG __RPC_FAR *pDisposition)
STDMETHOD() | VerifyRequest (BSTR const strConfig, LONG Context, LONG bNewRequest, LONG Flags, LONG __RPC_FAR *pDisposition)

Protected Member Functions

HRESULT | _AddAuthorityInfoAccessExtension (IN ICertServerPolicy *pServer)
HRESULT | _AddAuthorityKeyId (IN ICertServerPolicy *pServer)
HRESULT | _AddCertTypeExtension (IN ICertServerPolicy *pServer, IN BOOL fCA)
HRESULT | _AddDefaultBasicConstraintsExtension (IN ICertServerPolicy *pServer, IN BOOL fCA)
HRESULT | _AddDefaultKeyUsageExtension (IN ICertServerPolicy *pServer, IN BOOL fCA)
HRESULT | _AddRevocationExtension (IN ICertServerPolicy *pServer)
HRESULT | _AddStringArray (IN WCHAR const *pwszzValue, IN BOOL fURL, IN OUT DWORD *pcStrings, IN OUT LPWSTR **papstrRegValues)
HRESULT | _AddSubjectAltNameExtension (IN ICertServerPolicy *pServer, IN DWORD iAltName)
VOID | _Cleanup ()
HRESULT | _EnumerateExtensions (IN ICertServerPolicy *pServer, IN LONG bNewRequest, OPTIONAL OUT BOOL *pfCA)
VOID | _FreeStringArray (IN OUT DWORD *pcString, IN OUT LPWSTR **papstr)
CERT_CONTEXT const * | _GetIssuer (IN ICertServerPolicy *pServer)
VOID | _InitAuthorityInfoAccessExtension (IN HKEY hkey)
VOID | _InitDisableExtensionList (IN HKEY hkey)
VOID | _InitRequestExtensionList (IN HKEY hkey)
VOID | _InitRevocationExtension (IN HKEY hkey)
VOID | _InitSubjectAltNameExtension (IN HKEY hkey, IN WCHAR const *pwszRegName, IN WCHAR const *pwszObjectId, IN DWORD iAltName)
HRESULT | _ReadRegistryString (IN HKEY hkey, IN BOOL fURL, IN WCHAR const *pwszRegName, IN WCHAR const *pwszSuffix, OUT LPWSTR *pwszRegValue)
HRESULT | _ReadRegistryStringArray (IN HKEY hkey, IN BOOL fURL, IN DWORD dwFlags, IN DWORD cRegNames, IN DWORD *aFlags, IN WCHAR const *const *apwszRegNames, IN OUT DWORD *pcStrings, IN OUT LPWSTR **papstrRegValues)
HRESULT | _SetValidityPeriod (IN ICertServerPolicy *pServer)

Protected Attributes

LPWSTR * | m_apstrCDPRevocationURL
LPWSTR * | m_apstrDisableExtensions
LPWSTR * | m_apstrEnableRequestExtensions
LPWSTR * | m_apstrIssuerCertURL
BSTR | m_astrSubjectAltNameObjectId [2]
BSTR | m_astrSubjectAltNameProp [2]
BSTR | m_bstrCAName
BSTR | m_bstrCASanitizedDSName
BSTR | m_bstrCASanitizedName
BSTR | m_bstrDescription
BSTR | m_bstrMachineDNSName
DWORD m_cCDPRevocationURL
DWORD m_CertType
DWORD m_cIssuerCertURL
DWORD m_dwIssuerCertURLFlags
DWORD m_hrLastUpdateResult
PCCERT_CONTEXT | m_pCert
CRITICAL_SECTION | m_PolicyCriticalSection
LPWSTR | m_wszRegStorageLoc

Private Member Functions

HRESULT | _AddAuthorityKeyId (IN ICertServerPolicy *pServer)
HRESULT | _AddDefaultBasicConstraintsExtension (IN ICertServerPolicy *pServer, IN BOOL fCA)
HRESULT | _AddDefaultKeyUsageExtension (IN ICertServerPolicy *pServer, IN BOOL fCA)
HRESULT | _AddEnhancedKeyUsageExtension (IN ICertServerPolicy *pServer)
HRESULT | _AddOldCertTypeExtension (IN ICertServerPolicy *pServer, IN BOOL fCA)
HRESULT | _AddRevocationExtension (IN ICertServerPolicy *pServer)
HRESULT | _AddStringArray (IN WCHAR const *pwszzValue, IN BOOL fURL, IN OUT DWORD *pcStrings, IN OUT LPWSTR **papwszRegValues)
VOID | _Cleanup ()
HRESULT | _EnumerateExtensions (IN ICertServerPolicy *pServer, IN LONG bNewRequest, IN BOOL fFirstPass, IN BOOL fEnableEnrolleeExtensions, IN DWORD cCriticalExtensions, IN WCHAR const *const *apwszCriticalExtensions)
VOID | _FreeStringArray (IN OUT DWORD *pcString, IN OUT LPWSTR **papwsz)
CERT_CONTEXT const * | _GetIssuer (IN ICertServerPolicy *pServer)
VOID | _InitDisableExtensionList (IN HKEY hkey)
VOID | _InitRequestExtensionList (IN HKEY hkey)
VOID | _InitRevocationExtension (IN HKEY hkey)
HRESULT | _ReadRegistryString (IN HKEY hkey, IN BOOL fURL, IN WCHAR const *pwszRegName, IN WCHAR const *pwszSuffix, OUT LPWSTR *pwszRegValue)
HRESULT | _ReadRegistryStringArray (IN HKEY hkey, IN BOOL fURL, IN DWORD dwFlags, IN DWORD cRegNames, IN DWORD *aFlags, IN WCHAR const *const *apwszRegNames, IN OUT DWORD *pcStrings, IN OUT LPWSTR **papwszRegValues)
HRESULT | _SetSystemStringProp (IN ICertServerPolicy *pServer, IN WCHAR const *pwszName, OPTIONAL IN WCHAR const *pwszValue)
HRESULT | _SetValidityPeriod (IN ICertServerPolicy *pServer)

Private Attributes

LPWSTR * | m_apwszDisableExtensions
LPWSTR * | m_apwszEnableEnrolleeRequestExtensions
LPWSTR * | m_apwszEnableRequestExtensions
DWORD m_CAPathLength
ENUM_CATYPES | m_CAType
DWORD m_cDisableExtensions
DWORD m_cEnableEnrolleeRequestExtensions
DWORD m_cEnableRequestExtensions
DWORD m_dwDispositionFlags
DWORD m_dwEditFlags
DWORD m_dwRevocationFlags
DWORD m_iCert
DWORD m_iCRL
CERT_CONTEXT const * | m_pCert
BSTR | m_strCAName
BSTR | m_strCASanitizedDSName
BSTR | m_strCASanitizedName
BSTR | m_strDescription
BSTR | m_strMachineDNSName
BSTR | m_strRegStorageLoc
LPWSTR | m_wszASPRevocationURL

Detailed Description

Definition at line 107 of file policy.h.

Constructor & Destructor Documentation

CCertPolicySample::CCertPolicySample ( ) [inline]

Definition at line 114 of file policy.h.

    {
  m_strDescription = NULL;

        // RevocationExtension variables:

  m_dwRevocationFlags = 0;
  m_wszASPRevocationURL = NULL;

        m_dwDispositionFlags = 0;
        m_dwEditFlags = 0;

  m_cEnableRequestExtensions = 0;
  m_apwszEnableRequestExtensions = NULL;

  m_cEnableEnrolleeRequestExtensions = 0;
  m_apwszEnableEnrolleeRequestExtensions = NULL;

  m_cDisableExtensions = 0;
  m_apwszDisableExtensions = NULL;

  // CA Name
        m_strRegStorageLoc = NULL;

  m_strCAName = NULL;
        m_strCASanitizedName = NULL;
        m_strCASanitizedDSName = NULL;
        m_strMachineDNSName = NULL;

        // CA and cert type info

        m_CAType = ENUM_UNKNOWN_CA;

        m_pCert = NULL;
        m_iCRL = 0;

    }

CCertPolicySample::~CCertPolicySample ( )

Definition at line 362 of file policy.cpp.

{
    _Cleanup();

}

CCertPolicySample::CCertPolicySample ( ) [inline]

Definition at line 48 of file Policy.h.

    {
        m_bstrDescription = NULL;

        // RevocationExtension variables:

  m_dwRevocationFlags = 0;
  m_cCDPRevocationURL = 0;
  m_apstrCDPRevocationURL = NULL;
  m_wszASPRevocationURL = NULL;

        m_dwDispositionFlags = 0;
        m_dwEditFlags = 0;

  // CertTypeExtension variables:

  m_astrSubjectAltNameProp[0] = NULL;
  m_astrSubjectAltNameProp[1] = NULL;
  m_astrSubjectAltNameObjectId[0] = NULL;
  m_astrSubjectAltNameObjectId[1] = NULL;

  // AuthorityInfoAccessExtension variables:

        m_dwIssuerCertURLFlags = 0;
        m_cIssuerCertURL = 0;
  m_apstrIssuerCertURL = NULL;

  m_cEnableRequestExtensions = 0;
  m_apstrEnableRequestExtensions = NULL;

  m_cDisableExtensions = 0;
  m_apstrDisableExtensions = NULL;

  // CA Name
        m_wszRegStorageLoc = NULL;

  m_bstrCAName = NULL;
        m_bstrCASanitizedName = NULL;
        m_bstrCASanitizedDSName = NULL;
        m_bstrMachineDNSName = NULL;

        InitializeCriticalSection(&m_PolicyCriticalSection);

        // CA and cert type info

        m_CAType = ENUM_UNKNOWN_CA;

        m_hrLastUpdateResult = S_OK;
        m_pCert = NULL;
        m_iCRL = 0;

    }

CCertPolicySample::~CCertPolicySample ( )

Member Function Documentation

HRESULT CCertPolicySample::_AddAuthorityInfoAccessExtension ( IN ICertServerPolicy * pServer ) [protected]

Definition at line 1609 of file Policy.Cpp.

{
    HRESULT hr = S_OK;
    BYTE *pbEncoded = NULL;
    DWORD cbEncoded;
    BSTR strExtension = NULL;
    VARIANT varExtension;
    DWORD i;

    CERT_AUTHORITY_INFO_ACCESS caio;
    caio.rgAccDescr = NULL;

    if (NULL == m_apstrIssuerCertURL)
    {
  goto error;
    }

    caio.cAccDescr = m_cIssuerCertURL;
    caio.rgAccDescr = (CERT_ACCESS_DESCRIPTION *) LocalAlloc(
      LMEM_FIXED,
      sizeof(CERT_ACCESS_DESCRIPTION) * m_cIssuerCertURL);
    if (NULL == caio.rgAccDescr)
    {
        hr = E_OUTOFMEMORY;
  _JumpError(hr, error, "Policy:LocalAlloc");
    }

    for (i = 0; i < m_cIssuerCertURL; i++)
    {
  caio.rgAccDescr[i].pszAccessMethod = szOID_PKIX_CA_ISSUERS;
  caio.rgAccDescr[i].AccessLocation.dwAltNameChoice = CERT_ALT_NAME_URL;
  caio.rgAccDescr[i].AccessLocation.pwszURL = m_apstrIssuerCertURL[i];
    }

    if (!ceEncodeObject(
        X509_ASN_ENCODING,
        X509_AUTHORITY_INFO_ACCESS,
        &caio,
        0,
        FALSE,
        &pbEncoded,
        &cbEncoded))
    {
  hr = ceHLastError();
  _JumpError(hr, error, "Policy:ceEncodeObject");
    }
    if (!ceConvertWszToBstr(
      &strExtension,
      (WCHAR const *) pbEncoded,
      cbEncoded))
    {
  hr = E_OUTOFMEMORY;
  _JumpError(hr, error, "Policy:ceConvertWszToBstr");
    }

    varExtension.vt = VT_BSTR;
    varExtension.bstrVal = strExtension;
    hr = pServer->SetCertificateExtension(
          TEXT(szOID_AUTHORITY_INFO_ACCESS),
          PROPTYPE_BINARY,
          0,
          &varExtension);
    _JumpIfError(hr, error, "Policy:SetCertificateExtension(AuthInfoAccess)");

error:
    if (NULL != pbEncoded)
    {
  LocalFree(pbEncoded);
    }
    if (NULL != strExtension)
    {
        SysFreeString(strExtension);
    }
    if (NULL != caio.rgAccDescr)
    {
        LocalFree(caio.rgAccDescr);
    }
    return(hr);
}

HRESULT CCertPolicySample::_AddAuthorityKeyId ( IN ICertServerPolicy * pServer ) [private]

Definition at line 1715 of file policy.cpp.

{
    HRESULT hr = S_OK;
    BYTE *pbEncoded = NULL;
    DWORD cbEncoded;
    BSTR strExtension = NULL;
    VARIANT varExtension;
    VARIANT varExtensionT;
    PCERT_AUTHORITY_KEY_ID2_INFO pInfo = NULL;
    DWORD cbInfo = 0;
    LONG ExtFlags = 0;

    VariantInit(&varExtension);

    // Optimization

    if ((EDITF_ENABLEAKIKEYID |
   EDITF_ENABLEAKIISSUERNAME |
   EDITF_ENABLEAKIISSUERSERIAL) ==
  ((EDITF_ENABLEAKIKEYID |
    EDITF_ENABLEAKIISSUERNAME |
    EDITF_ENABLEAKIISSUERSERIAL |
    EDITF_ENABLEAKICRITICAL) & m_dwEditFlags))
    {
        goto error;
    }

    hr = polGetCertificateExtension(
          pServer,
          TEXT(szOID_AUTHORITY_KEY_IDENTIFIER2),
          PROPTYPE_BINARY,
          &varExtension);
    _JumpIfError(hr, error, "Policy:polGetCertificateExtension");

    hr = pServer->GetCertificateExtensionFlags(&ExtFlags);
    _JumpIfError(hr, error, "Policy:GetCertificateExtensionFlags");

    if (VT_BSTR != varExtension.vt)
    {
  hr = E_INVALIDARG;
  _JumpError(hr, error, "Policy:GetCertificateExtension");
    }

    cbInfo = 0;
    if (!ceDecodeObject(
        X509_ASN_ENCODING,
                    X509_AUTHORITY_KEY_ID2,
                    (BYTE *) varExtension.bstrVal,
                    SysStringByteLen(varExtension.bstrVal),
        FALSE,
                    (VOID **) &pInfo,
                    &cbInfo))
    {
  hr = ceHLastError();
  _JumpIfError(hr, error, "Policy:ceDecodeObject");
    }

    // Make Any Modifications Here

    if (0 == (EDITF_ENABLEAKIKEYID & m_dwEditFlags))
    {
        pInfo->KeyId.cbData = 0;
        pInfo->KeyId.pbData = NULL;
    }
    if (0 == (EDITF_ENABLEAKIISSUERNAME & m_dwEditFlags))
    {
        pInfo->AuthorityCertIssuer.cAltEntry = 0;
        pInfo->AuthorityCertIssuer.rgAltEntry = NULL;
    }
    if (0 == (EDITF_ENABLEAKIISSUERSERIAL & m_dwEditFlags))
    {
        pInfo->AuthorityCertSerialNumber.cbData = 0;
        pInfo->AuthorityCertSerialNumber.pbData = NULL;
    }
    if (EDITF_ENABLEAKICRITICAL & m_dwEditFlags)
    {
  ExtFlags |= EXTENSION_CRITICAL_FLAG;
    }
    if (0 ==
  ((EDITF_ENABLEAKIKEYID |
    EDITF_ENABLEAKIISSUERNAME |
    EDITF_ENABLEAKIISSUERSERIAL) & m_dwEditFlags))
    {
  ExtFlags |= EXTENSION_DISABLE_FLAG;
    }

    if (!ceEncodeObject(
        X509_ASN_ENCODING,
        X509_AUTHORITY_KEY_ID2,
        pInfo,
        0,
        FALSE,
        &pbEncoded,
        &cbEncoded))
    {
  hr = ceHLastError();
  _JumpError(hr, error, "Policy:ceEncodeObject");
    }
    if (!ceConvertWszToBstr(
      &strExtension,
      (WCHAR const *) pbEncoded,
      cbEncoded))
    {
  hr = E_OUTOFMEMORY;
  _JumpError(hr, error, "Policy:ceConvertWszToBstr");
    }

    varExtensionT.vt = VT_BSTR;
    varExtensionT.bstrVal = strExtension;
    hr = polSetCertificateExtension(
          pServer,
          TEXT(szOID_AUTHORITY_KEY_IDENTIFIER2),
          PROPTYPE_BINARY,
          ExtFlags,
          &varExtensionT);
    _JumpIfError(hr, error, "Policy:polSetCertificateExtension(AuthorityKeyId2)");

error:
    VariantClear(&varExtension);
    if (NULL != pInfo)
    {
  LocalFree(pInfo);
    }
    if (NULL != pbEncoded)
    {
  LocalFree(pbEncoded);
    }
    if (NULL != strExtension)
    {
        SysFreeString(strExtension);
    }
    return(hr);
}

HRESULT CCertPolicySample::_AddAuthorityKeyId ( IN ICertServerPolicy * pServer ) [protected]
HRESULT CCertPolicySample::_AddCertTypeExtension | ( | IN ICertServerPolicy * | pServer,
 |  | IN BOOL | fCA |
 | ) |  |  | [protected]

Definition at line 1485 of file Policy.Cpp.

{
    HRESULT hr = S_OK;
    ICertEncodeBitString *pBitString = NULL;
    BSTR strExtension = NULL;
    VARIANT varExtension;
    BSTR strBitString = NULL;
    BSTR strCertType = NULL;
    CERT_BASIC_CONSTRAINTS2_INFO Constraints;
    VARIANT varConstraints;
    DWORD cb;

    VariantInit(&varConstraints);

    if (EDITF_ADDOLDCERTTYPE & m_dwEditFlags)
    {
  BYTE CertType;

  if (!fCA)
  {
      hr = pServer->GetCertificateExtension(
          TEXT(szOID_BASIC_CONSTRAINTS2),
          PROPTYPE_BINARY,
          &varConstraints);
      if (S_OK == hr)
      {
    cb = sizeof(Constraints);
    if (!CryptDecodeObject(
            X509_ASN_ENCODING,
            X509_BASIC_CONSTRAINTS2,
            (BYTE const *) varConstraints.bstrVal,
            SysStringByteLen(varConstraints.bstrVal),
            0,
            &Constraints,
            &cb))
    {
        hr = ceHLastError();
        _JumpError(hr, error, "Policy:CryptDecodeObject");
    }
    fCA = Constraints.fCA;
      }
  }

  hr = CoCreateInstance(
      CLSID_CCertEncodeBitString,
      NULL,               // pUnkOuter
      CLSCTX_INPROC_SERVER,
      IID_ICertEncodeBitString,
      (VOID **) &pBitString);
  _JumpIfError(hr, error, "Policy:CoCreateInstance");

  CertType = NSCERTTYPE_CLIENT; // Default to client auth. cert
  if (fCA)
  {
      CertType = NSCERTTYPE_CA;
  }
  else
  {
      hr = pServer->GetRequestAttribute(wszPROPCERTTYPE, &strCertType);
      if (S_OK == hr)
      {
    if (0 == lstrcmpi(strCertType, L"server"))
    {
        CertType = NSCERTTYPE_SERVER;
    }
      }
  }

        if (!ceConvertWszToBstr(
        &strBitString,
        (WCHAR const *) &CertType,
        sizeof(CertType)))
  {
      hr = E_OUTOFMEMORY;
      _JumpError(hr, error, "Policy:ceConvertWszToBstr");
  }

  hr = pBitString->Encode(
          sizeof(CertType) * 8,
          strBitString,
          &strExtension);
  _JumpIfError(hr, error, "Policy:BitString:Encode");

        varExtension.vt = VT_BSTR;
  varExtension.bstrVal = strExtension;
  hr = pServer->SetCertificateExtension(
        TEXT(szOID_NETSCAPE_CERT_TYPE),
        PROPTYPE_BINARY,
        0,
        &varExtension);
  _JumpIfError(hr, error, "Policy:SetCertificateExtension");
    }

error:
    VariantClear(&varConstraints);
    if (NULL != strExtension)
    {
        SysFreeString(strExtension);
    }
    if (NULL != strBitString)
    {
        SysFreeString(strBitString);
    }
    if (NULL != strCertType)
    {
        SysFreeString(strCertType);
    }
    if (NULL != pBitString)
    {
        pBitString->Release();
    }
    return(hr);
}

HRESULT CCertPolicySample::_AddDefaultBasicConstraintsExtension | ( | IN ICertServerPolicy * | pServer,
 |  | IN BOOL | fCA |
 | ) |  |  | [private]

Definition at line 2228 of file policy.cpp.

{
    HRESULT hr;
    VARIANT varExtension;
    LONG ExtFlags;
    CERT_EXTENSION Ext;
    CERT_EXTENSION *pExtension = NULL;
    BSTR strCertType = NULL;

    VariantInit(&varExtension);

    if (EDITF_BASICCONSTRAINTSCA & m_dwEditFlags)
    {
        hr = polGetCertificateExtension(
        pServer,
        TEXT(szOID_BASIC_CONSTRAINTS2),
        PROPTYPE_BINARY,
        &varExtension);
        if (S_OK == hr)
        {
      CERT_BASIC_CONSTRAINTS2_INFO Constraints;
      DWORD cb;

      hr = pServer->GetCertificateExtensionFlags(&ExtFlags);
      if (S_OK == hr)
      {
                Ext.pszObjId = szOID_BASIC_CONSTRAINTS2;
                Ext.fCritical = FALSE;
                if (EXTENSION_CRITICAL_FLAG & ExtFlags)
                {
                    Ext.fCritical = TRUE;
                }
                Ext.Value.pbData = (BYTE *) varExtension.bstrVal;
                Ext.Value.cbData = SysStringByteLen(varExtension.bstrVal);
    pExtension = &Ext;

    cb = sizeof(Constraints);
    if (!fCA && CryptDecodeObject(
              X509_ASN_ENCODING,
              X509_BASIC_CONSTRAINTS2,
              Ext.Value.pbData,
              Ext.Value.cbData,
              0,
              &Constraints,
              &cb))
    {
        fCA = Constraints.fCA;
    }
      }
  }
    }

    if (EDITF_ATTRIBUTECA & m_dwEditFlags)
    {
        if (!fCA)
        {
      hr = polGetRequestAttribute(pServer, wszPROPCERTTYPE, &strCertType);
            if (S_OK == hr)
            {
                if (0 == celstrcmpiL(strCertType, L"ca"))
                {
                    fCA = TRUE;
                }
            }
        }
        if (!fCA)
        {
      hr = polGetRequestAttribute(pServer, wszPROPCERTTEMPLATE, &strCertType);
            if (S_OK == hr)
            {
                if (0 == celstrcmpiL(strCertType, wszCERTTYPE_SUBORDINATE_CA) ||
        0 == celstrcmpiL(strCertType, wszCERTTYPE_CROSS_CA))
                {
                    fCA = TRUE;
                }
            }
  }
    }

    // For standalone, the extension is only enabled if it's a CA

    hr = AddBasicConstraintsCommon(pServer, pExtension, fCA, fCA);
    _JumpIfError(hr, error, "Policy:AddBasicConstraintsCommon");

error:
    VariantClear(&varExtension);
    if (NULL != strCertType)
    {
        SysFreeString(strCertType);
    }
    return(hr);
}

HRESULT CCertPolicySample::_AddDefaultBasicConstraintsExtension | ( | IN ICertServerPolicy * | pServer,
 |  | IN BOOL | fCA |
 | ) |  |  | [protected]
HRESULT CCertPolicySample::_AddDefaultKeyUsageExtension | ( | IN ICertServerPolicy * | pServer,
 |  | IN BOOL | fCA |
 | ) |  |  | [private]

Definition at line 1858 of file policy.cpp.

{
    HRESULT hr;
    BSTR strName = NULL;
    ICertEncodeBitString *pBitString = NULL;
    BSTR strExtension = NULL;
    VARIANT varExtension;
    BSTR strBitString = NULL;
    CERT_BASIC_CONSTRAINTS2_INFO Constraints;
    VARIANT varConstraints;
    VARIANT varKeyUsage;
    CRYPT_BIT_BLOB *pKeyUsage = NULL;
    DWORD cb;
    BYTE abKeyUsage[1];
    BYTE *pbKeyUsage;
    DWORD cbKeyUsage;

    VariantInit(&varConstraints);
    VariantInit(&varKeyUsage);

    if (EDITF_ADDOLDKEYUSAGE & m_dwEditFlags)
    {
  BOOL fModified = FALSE;

  if (!fCA)
  {
      hr = polGetCertificateExtension(
            pServer,
            TEXT(szOID_BASIC_CONSTRAINTS2),
            PROPTYPE_BINARY,
            &varConstraints);
      if (S_OK == hr)
      {
    cb = sizeof(Constraints);
    if (!CryptDecodeObject(
            X509_ASN_ENCODING,
            X509_BASIC_CONSTRAINTS2,
            (BYTE const *) varConstraints.bstrVal,
            SysStringByteLen(varConstraints.bstrVal),
            0,
            &Constraints,
            &cb))
    {
        hr = ceHLastError();
        _JumpError(hr, error, "Policy:CryptDecodeObject");
    }
    fCA = Constraints.fCA;
      }
  }

  ZeroMemory(abKeyUsage, sizeof(abKeyUsage));
  pbKeyUsage = abKeyUsage;
  cbKeyUsage = sizeof(abKeyUsage);

  hr = polGetCertificateExtension(
        pServer,
        TEXT(szOID_KEY_USAGE),
        PROPTYPE_BINARY,
        &varKeyUsage);
  if (S_OK == hr)
  {
      if (!ceDecodeObject(
          X509_ASN_ENCODING,
          X509_KEY_USAGE,
          (BYTE const *) varKeyUsage.bstrVal,
          SysStringByteLen(varKeyUsage.bstrVal),
          FALSE,
          (VOID **) &pKeyUsage,
          &cb))
      {
    hr = GetLastError();
    _PrintError(hr, "Policy:ceDecodeObject");
      }
      else if (0 != cb && NULL != pKeyUsage && 0 != pKeyUsage->cbData)
      {
    pbKeyUsage = pKeyUsage->pbData;
    cbKeyUsage = pKeyUsage->cbData;
      }
  }

  if ((CERT_KEY_ENCIPHERMENT_KEY_USAGE & pbKeyUsage[0]) &&
      (CERT_KEY_AGREEMENT_KEY_USAGE & pbKeyUsage[0]))
  {
      pbKeyUsage[0] &= ~CERT_KEY_AGREEMENT_KEY_USAGE;
      pbKeyUsage[0] |= CERT_DIGITAL_SIGNATURE_KEY_USAGE;
      fModified = TRUE;
  }
  if (fCA)
  {
      pbKeyUsage[0] |= ceCASIGN_KEY_USAGE;
      fModified = TRUE;
  }
  if (fModified)
  {
      hr = CoCreateInstance(
          CLSID_CCertEncodeBitString,
          NULL,               // pUnkOuter
          CLSCTX_INPROC_SERVER,
          IID_ICertEncodeBitString,
          (VOID **) &pBitString);
      _JumpIfError(hr, error, "Policy:CoCreateInstance");

      if (!ceConvertWszToBstr(
      &strBitString,
      (WCHAR const *) pbKeyUsage,
      cbKeyUsage))
      {
    hr = E_OUTOFMEMORY;
    _JumpError(hr, error, "Policy:ceConvertWszToBstr");
      }

      hr = pBitString->Encode(cbKeyUsage * 8, strBitString, &strExtension);
      _JumpIfError(hr, error, "Policy:Encode");

      if (!ceConvertWszToBstr(&strName, TEXT(szOID_KEY_USAGE), -1))
      {
    hr = E_OUTOFMEMORY;
    _JumpError(hr, error, "Policy:ceConvertWszToBstr");
      }
      varExtension.vt = VT_BSTR;
      varExtension.bstrVal = strExtension;
      hr = pServer->SetCertificateExtension(
            strName,
            PROPTYPE_BINARY,
            0,
            &varExtension);
      _JumpIfError(hr, error, "Policy:SetCertificateExtension");
  }
    }
    hr = S_OK;

error:
    VariantClear(&varConstraints);
    VariantClear(&varKeyUsage);
    if (NULL != pKeyUsage)
    {
        LocalFree(pKeyUsage);
    }
    if (NULL != strName)
    {
        SysFreeString(strName);
    }
    if (NULL != strExtension)
    {
        SysFreeString(strExtension);
    }
    if (NULL != strBitString)
    {
        SysFreeString(strBitString);
    }
    if (NULL != pBitString)
    {
        pBitString->Release();
    }
    return(hr);
}

HRESULT CCertPolicySample::_AddDefaultKeyUsageExtension | ( | IN ICertServerPolicy * | pServer,
 |  | IN BOOL | fCA |
 | ) |  |  | [protected]
HRESULT CCertPolicySample::_AddEnhancedKeyUsageExtension ( IN ICertServerPolicy * pServer ) [private]

Definition at line 2019 of file policy.cpp.

{
    HRESULT hr;
    BSTR strUsage = NULL;
    char *pszUsage = NULL;
    char *psz;
    char *pszNext;
    CERT_ENHKEY_USAGE ceu;
    CERT_POLICIES_INFO cpi;
    BYTE *pbKeyUsage = NULL;
    DWORD cbKeyUsage;
    BYTE *pbPolicies = NULL;
    DWORD cbPolicies;
    CERT_POLICY_INFO *pcpi = NULL;
    DWORD i;
    VARIANT varExtension;

    ZeroMemory(&ceu, sizeof(ceu));
    ZeroMemory(&cpi, sizeof(cpi));
    VariantInit(&varExtension);

    if (0 == (EDITF_ATTRIBUTEEKU & m_dwEditFlags))
    {
  hr = S_OK;
  goto error;
    }
    hr = polGetRequestAttribute(pServer, wszPROPCERTUSAGE, &strUsage);
    if (S_OK != hr)
    {
  hr = S_OK;
  goto error;
    }
    if (!ceConvertWszToSz(&pszUsage, strUsage, -1))
    {
  hr = E_OUTOFMEMORY;
  _JumpError(hr, error, "Policy:ceConvertWszToSz");
    }
    for (psz = pszUsage; '\0' != *psz; psz = pszNext)
    {
  pszNext = &psz[strcspn(psz, ",")];
  if ('\0' != *pszNext)
  {
      pszNext++;
  }
  ceu.cUsageIdentifier++;
    }
    if (0 == ceu.cUsageIdentifier)
    {
  hr = S_OK;
  goto error;
    }

    ceu.rgpszUsageIdentifier = (char **) LocalAlloc(
    LMEM_FIXED,
    ceu.cUsageIdentifier * sizeof(ceu.rgpszUsageIdentifier[0]));
    if (NULL == ceu.rgpszUsageIdentifier)
    {
  hr = E_OUTOFMEMORY;
  _JumpError(hr, error, "Policy:myLocalAlloc");
    }

    // Destructively parse comma separated ObjIds into individual strings

    i = 0;
    for (psz = pszUsage; '\0' != *psz; psz = pszNext)
    {
  char *pszEnd;

  assert(i < ceu.cUsageIdentifier);
  pszNext = &psz[strcspn(psz, ",")];
  pszEnd = pszNext;
  if ('\0' != *pszNext)
  {
      *pszNext++ = '\0';
  }
  while (' ' == *psz)
  {
      psz++;
  }
  while (pszEnd > psz && ' ' == *--pszEnd)
  {
      *pszEnd = '\0';
  }
  if ('\0' != *psz)
  {
      hr = ceVerifyObjIdA(psz);
      _JumpIfError(hr, error, "Policy:ceVerifyObjIdA");

      ceu.rgpszUsageIdentifier[i++] = psz;
  }
    }
    ceu.cUsageIdentifier = i;
    if (0 == ceu.cUsageIdentifier)
    {
  hr = S_OK;
  goto error;
    }

    if (!ceEncodeObject(
        X509_ASN_ENCODING,
        X509_ENHANCED_KEY_USAGE,
        &ceu,
        0,
        FALSE,
        &pbKeyUsage,
        &cbKeyUsage))
    {
  hr = ceHLastError();
  _JumpError(hr, error, "Policy:ceEncodeObject");
    }

    varExtension.bstrVal = NULL;
    if (!ceConvertWszToBstr(
      &varExtension.bstrVal,
      (WCHAR const *) pbKeyUsage,
      cbKeyUsage))
    {
        hr = E_OUTOFMEMORY;
        _JumpError(hr, error, "Policy:ceConvertWszToBstr");
    }
    varExtension.vt = VT_BSTR;
    hr = polSetCertificateExtension(
          pServer,
          TEXT(szOID_ENHANCED_KEY_USAGE),
          PROPTYPE_BINARY,
          0,
          &varExtension);
    _JumpIfError(hr, error, "Policy:polSetCertificateExtension");

    cpi.cPolicyInfo = ceu.cUsageIdentifier;
    cpi.rgPolicyInfo = (CERT_POLICY_INFO *) LocalAlloc(
          LMEM_FIXED | LMEM_ZEROINIT,
          cpi.cPolicyInfo * sizeof(cpi.rgPolicyInfo[0]));
    if (NULL == cpi.rgPolicyInfo)
    {
        hr = E_OUTOFMEMORY;
        _JumpError(hr, error, "Policy:LocalAlloc");
    }
    for (i = 0; i < cpi.cPolicyInfo; i++)
    {
  cpi.rgPolicyInfo[i].pszPolicyIdentifier = ceu.rgpszUsageIdentifier[i];
    }
    if (!ceEncodeObject(
        X509_ASN_ENCODING,
        X509_CERT_POLICIES,
        &cpi,
        0,
        FALSE,
        &pbPolicies,
        &cbPolicies))
    {
  hr = ceHLastError();
  _JumpError(hr, error, "Policy:ceEncodeObject");
    }

    if (!ceConvertWszToBstr(
      &varExtension.bstrVal,
      (WCHAR const *) pbPolicies,
      cbPolicies))
    {
        hr = E_OUTOFMEMORY;
        _JumpError(hr, error, "Policy:ceConvertWszToBstr");
    }
    hr = polSetCertificateExtension(
          pServer,
          TEXT(szOID_APPLICATION_CERT_POLICIES),
          PROPTYPE_BINARY,
          0,
          &varExtension);
    _JumpIfError(hr, error, "Policy:polSetCertificateExtension");

error:
    if (NULL != pcpi)
    {
  LocalFree(pcpi);
    }
    VariantClear(&varExtension);
    if (NULL != ceu.rgpszUsageIdentifier)
    {
  LocalFree(ceu.rgpszUsageIdentifier);
    }
    if (NULL != pbPolicies)
    {
  LocalFree(pbPolicies);
    }
    if (NULL != pbKeyUsage)
    {
  LocalFree(pbKeyUsage);
    }
    if (NULL != pszUsage)
    {
  LocalFree(pszUsage);
    }
    if (NULL != strUsage)
    {
  SysFreeString(strUsage);
    }
    return(hr);
}

HRESULT CCertPolicySample::_AddOldCertTypeExtension | ( | IN ICertServerPolicy * | pServer,
 |  | IN BOOL | fCA |
 | ) |  |  | [private]

Definition at line 1589 of file policy.cpp.

{
    HRESULT hr = S_OK;
    ICertEncodeBitString *pBitString = NULL;
    BSTR strExtension = NULL;
    VARIANT varExtension;
    BSTR strBitString = NULL;
    BSTR strCertType = NULL;
    CERT_BASIC_CONSTRAINTS2_INFO Constraints;
    VARIANT varConstraints;
    DWORD cb;

    VariantInit(&varConstraints);

    if (EDITF_ADDOLDCERTTYPE & m_dwEditFlags)
    {
  BYTE CertType;

  if (!fCA)
  {
      hr = polGetCertificateExtension(
            pServer,
            TEXT(szOID_BASIC_CONSTRAINTS2),
            PROPTYPE_BINARY,
            &varConstraints);
      if (S_OK == hr)
      {
    cb = sizeof(Constraints);
    if (!CryptDecodeObject(
            X509_ASN_ENCODING,
            X509_BASIC_CONSTRAINTS2,
            (BYTE const *) varConstraints.bstrVal,
            SysStringByteLen(varConstraints.bstrVal),
            0,
            &Constraints,
            &cb))
    {
        hr = ceHLastError();
        _JumpError(hr, error, "Policy:CryptDecodeObject");
    }
    fCA = Constraints.fCA;
      }
  }

  hr = CoCreateInstance(
      CLSID_CCertEncodeBitString,
      NULL,               // pUnkOuter
      CLSCTX_INPROC_SERVER,
      IID_ICertEncodeBitString,
      (VOID **) &pBitString);
  _JumpIfError(hr, error, "Policy:CoCreateInstance");

  CertType = NSCERTTYPE_CLIENT; // Default to client auth. cert
  if (fCA)
  {
      CertType = NSCERTTYPE_CA;
  }
  else
  {
      hr = polGetRequestAttribute(pServer, wszPROPCERTTYPE, &strCertType);
      if (S_OK == hr)
      {
    if (0 == celstrcmpiL(strCertType, L"server"))
    {
        CertType = NSCERTTYPE_SERVER;
    }
      }
  }

        if (!ceConvertWszToBstr(
        &strBitString,
        (WCHAR const *) &CertType,
        sizeof(CertType)))
  {
      hr = E_OUTOFMEMORY;
      _JumpError(hr, error, "Policy:ceConvertWszToBstr");
  }

  hr = pBitString->Encode(
          sizeof(CertType) * 8,
          strBitString,
          &strExtension);
  _JumpIfError(hr, error, "Policy:BitString:Encode");

        varExtension.vt = VT_BSTR;
  varExtension.bstrVal = strExtension;
  hr = polSetCertificateExtension(
        pServer,
        TEXT(szOID_NETSCAPE_CERT_TYPE),
        PROPTYPE_BINARY,
        0,
        &varExtension);
  _JumpIfError(hr, error, "Policy:polSetCertificateExtension");
    }

error:
    VariantClear(&varConstraints);
    if (NULL != strExtension)
    {
        SysFreeString(strExtension);
    }
    if (NULL != strBitString)
    {
        SysFreeString(strBitString);
    }
    if (NULL != strCertType)
    {
        SysFreeString(strCertType);
    }
    if (NULL != pBitString)
    {
        pBitString->Release();
    }
    return(hr);
}

HRESULT CCertPolicySample::_AddRevocationExtension ( IN ICertServerPolicy * pServer ) [private]

Definition at line 1528 of file policy.cpp.

{
    HRESULT hr = S_OK;
    BSTR strASPExtension = NULL;
    VARIANT varExtension;

    if (NULL != m_wszASPRevocationURL)
    {
  strASPExtension = SysAllocString(m_wszASPRevocationURL);
  if (NULL == strASPExtension)
  {
      hr = E_OUTOFMEMORY;
      _JumpError(hr, error, "Policy:SysAllocString");
  }

  varExtension.vt = VT_BSTR;
  varExtension.bstrVal = strASPExtension;
  hr = polSetCertificateExtension(
        pServer,
        TEXT(szOID_NETSCAPE_REVOCATION_URL),
        PROPTYPE_STRING,
        0,
        &varExtension);
  _JumpIfErrorStr(hr, error, "Policy:polSetCertificateExtension", L"ASP");
    }

error:
    if (NULL != strASPExtension)
    {
        SysFreeString(strASPExtension);
    }
    return(hr);
}

HRESULT CCertPolicySample::_AddRevocationExtension ( IN ICertServerPolicy * pServer ) [protected]
HRESULT CCertPolicySample::_AddStringArray | ( | IN WCHAR const * | pwszzValue,
 |  | IN BOOL | fURL,
 |  | IN OUT DWORD * | pcStrings,
 |  | IN OUT LPWSTR ** | papstrRegValues |
 | ) |  |  | [protected]
HRESULT CCertPolicySample::_AddStringArray | ( | IN WCHAR const * | pwszzValue,
 |  | IN BOOL | fURL,
 |  | IN OUT DWORD * | pcStrings,
 |  | IN OUT LPWSTR ** | papwszRegValues |
 | ) |  |  | [private]

Definition at line 617 of file policy.cpp.

{
    HRESULT hr;
    DWORD cString = 0;
    WCHAR const *pwsz;
    LPCWSTR *awszFormatStrings = NULL;
    LPWSTR *awszOutputStrings = NULL;

    // Count the number of strings we're adding
    for (pwsz = pwszzValue; L'\0' != *pwsz; pwsz += wcslen(pwsz) + 1)
    {
        cString++;
    }
    if (0 == cString)   // no strings
    {
  hr = S_OK;
        goto error;
    }
    awszFormatStrings = (LPCWSTR *) LocalAlloc(
          LMEM_FIXED | LMEM_ZEROINIT,
          cString * sizeof(LPWSTR));
    if (NULL == awszFormatStrings)
    {
        hr = E_OUTOFMEMORY;
        _JumpError(hr, error, "Policy:LocalAlloc");
    }

    cString = 0;
    for (pwsz = pwszzValue; L'\0' != *pwsz; pwsz += wcslen(pwsz) + 1)
    {
        // Skip strings that start with a an unescaped minus sign.
        // Strings with an escaped minus sign (2 minus signs) are not skipped.

        if (L'-' == *pwsz)
        {
      pwsz++;
      if (L'-' != *pwsz)
      {
                continue;
      }
        }
        awszFormatStrings[cString++] = pwsz;
    }

    // if no strings to add, don't modify
    if (cString > 0)
    {
        awszOutputStrings = (LPWSTR *) LocalAlloc(
              LMEM_FIXED | LMEM_ZEROINIT,
              (cString + *pcStrings) * sizeof(LPWSTR));
        if (NULL == awszOutputStrings)
        {
            hr = E_OUTOFMEMORY;
            _JumpError(hr, error, "Policy:LocalAlloc");
        }

        if (0 != *pcStrings)
        {
            assert(NULL != *papwszRegValues);
            CopyMemory(
    awszOutputStrings,
    *papwszRegValues,
    *pcStrings * sizeof(LPWSTR));
        }

        hr = ceFormatCertsrvStringArray(
    fURL,       // fURL
    m_strMachineDNSName,    // pwszServerName_p1_2
    m_strCASanitizedName,   // pwszSanitizedName_p3_7
    m_iCert,      // iCert_p4
    MAXDWORD,     // iCertTarget_p4
    L"",      // pwszDomainDN_p5
    L"",      // pwszConfigDN_p6
    m_iCRL,       // iCRL_p8
    FALSE,        // fDeltaCRL_p9
    TRUE,       // fDSAttrib_p10_11
    cString,      // cStrings
    awszFormatStrings,    // apwszStringsIn
    awszOutputStrings + (*pcStrings)); // apwszStringsOut
  _JumpIfError(hr, error, "Policy:ceFormatCertsrvStringArray");

        *pcStrings = (*pcStrings) + cString;
        if (*papwszRegValues)
        {
            LocalFree(*papwszRegValues);
        }
        *papwszRegValues = awszOutputStrings;
        awszOutputStrings = NULL;
    }
    hr = S_OK;

error:
    if (NULL != awszOutputStrings)
    {
        LocalFree(awszOutputStrings);
    }
    if (NULL != awszFormatStrings)
    {
        LocalFree(awszFormatStrings);
    }
    return(hr);
}

HRESULT CCertPolicySample::_AddSubjectAltNameExtension | ( | IN ICertServerPolicy * | pServer,
 |  | IN DWORD | iAltName |
 | ) |  |  | [protected]

Definition at line 2425 of file Policy.Cpp.

{
    HRESULT hr = S_OK;
    ICertEncodeAltName *pAltName = NULL;
    BSTR strExtension = NULL;
    VARIANT varExtension;
    BSTR strCertType = NULL;
    BSTR strName = NULL;
    VARIANT varValue;

    VariantInit(&varValue);
    if (NULL != m_astrSubjectAltNameProp[iAltName])
    {
  hr = CoCreateInstance(
      CLSID_CCertEncodeAltName,
      NULL,               // pUnkOuter
      CLSCTX_INPROC_SERVER,
      IID_ICertEncodeAltName,
      (VOID **) &pAltName);
  _JumpIfError(hr, error, "Policy:CoCreateInstance");

  hr = pServer->GetRequestProperty(
            m_astrSubjectAltNameProp[iAltName],
            PROPTYPE_STRING,
            &varValue);
  if (S_OK != hr)
  {
      DBGPRINT((
    fDebug,
    "Policy:GetRequestProperty(%ws):%s %x\n",
    m_astrSubjectAltNameProp[iAltName],
    CERTSRV_E_PROPERTY_EMPTY == hr? " MISSING ATTRIBUTE" : "",
    hr));
      if (CERTSRV_E_PROPERTY_EMPTY == hr)
      {
    hr = S_OK;
      }
      goto error;
  }
        if (VT_BSTR != varValue.vt)
  {
      hr = E_INVALIDARG;
      _JumpError(hr, error, "Policy:varValue.vt");
  }

        if (L'\0' == varValue.bstrVal[0])
  {
      hr = S_OK;
      goto error;
  }
        if (!ceConvertWszToBstr(&strName, varValue.bstrVal, -1))
  {
      hr = E_OUTOFMEMORY;
      _JumpError(hr, error, "Policy:ceConvertWszToBstr");
  }

  hr = pAltName->Reset(1);
  _JumpIfError(hr, error, "Policy:AltName:Reset");

  hr = pAltName->SetNameEntry(0, CERT_ALT_NAME_RFC822_NAME, strName);
  _JumpIfError(hr, error, "Policy:AltName:SetNameEntry");

  hr = pAltName->Encode(&strExtension);
  _JumpIfError(hr, error, "Policy:AltName:Encode");

        varExtension.vt = VT_BSTR;
  varExtension.bstrVal = strExtension;
  hr = pServer->SetCertificateExtension(
        m_astrSubjectAltNameObjectId[iAltName],
        PROPTYPE_BINARY,
        0,
        &varExtension);
  _JumpIfError(hr, error, "Policy:SetCertificateExtension");
    }

error:
    if (NULL != strName)
    {
        SysFreeString(strName);
    }
    if (NULL != strExtension)
    {
        SysFreeString(strExtension);
    }
    if (NULL != pAltName)
    {
        pAltName->Release();
    }
    VariantClear(&varValue);
    return(hr);
}

VOID CCertPolicySample::_Cleanup ( ) [protected]
VOID CCertPolicySample::_Cleanup ( ) [private]

Definition at line 403 of file policy.cpp.

{
    if (m_strDescription)
    {
        SysFreeString(m_strDescription);
        m_strDescription = NULL;
    }

    // RevocationExtension variables:

    if (NULL != m_wszASPRevocationURL)
    {
        LocalFree(m_wszASPRevocationURL);
      m_wszASPRevocationURL = NULL;
    }

    _FreeStringArray(&m_cEnableRequestExtensions, &m_apwszEnableRequestExtensions);
    _FreeStringArray(&m_cEnableEnrolleeRequestExtensions, &m_apwszEnableEnrolleeRequestExtensions);
    _FreeStringArray(&m_cDisableExtensions, &m_apwszDisableExtensions);

    if (NULL != m_strCAName)
    {
        SysFreeString(m_strCAName);
        m_strCAName = NULL;
    }
    if (NULL != m_strCASanitizedName)
    {
        SysFreeString(m_strCASanitizedName);
        m_strCASanitizedName = NULL;
    }
    if (NULL != m_strCASanitizedDSName)
    {
        SysFreeString(m_strCASanitizedDSName);
        m_strCASanitizedDSName = NULL;
    }
    if (NULL != m_strRegStorageLoc)
    {
        SysFreeString(m_strRegStorageLoc);
        m_strRegStorageLoc = NULL;
    }
    if (NULL != m_pCert)
    {
        CertFreeCertificateContext(m_pCert);
        m_pCert = NULL;
    }
    if (m_strMachineDNSName)
    {
        SysFreeString(m_strMachineDNSName);
        m_strMachineDNSName=NULL;
    }

}

HRESULT CCertPolicySample::_EnumerateExtensions | ( | IN ICertServerPolicy * | pServer,
 |  | IN LONG | bNewRequest,
 |  | OPTIONAL OUT BOOL * | pfCA |
 | ) |  |  | [protected]

Definition at line 1091 of file Policy.Cpp.

{
    HRESULT hr;
    HRESULT hr2;
    BSTR strName = NULL;
    LONG ExtFlags;
    VARIANT varValue;
    BOOL fClose = FALSE;
    BOOL fFirstPass = NULL != pfCA;
    BOOL fEnable;
    BOOL fDisable;

    if (NULL != pfCA)
    {
  *pfCA = FALSE;
    }
    VariantInit(&varValue);

    hr = pServer->EnumerateExtensionsSetup(0);
    _JumpIfError(hr, error, "Policy:EnumerateExtensionsSetup");

    fClose = TRUE;
    while (TRUE)
    {
        hr = pServer->EnumerateExtensions(&strName);
        if (S_FALSE == hr)
        {
            hr = S_OK;
            break;
        }
        _JumpIfError(hr, error, "Policy:EnumerateExtensions");

        hr = pServer->GetCertificateExtension(
                                        strName,
                                        PROPTYPE_BINARY,
                                        &varValue);
        _JumpIfError(hr, error, "Policy:GetCertificateExtension");

        hr = pServer->GetCertificateExtensionFlags(&ExtFlags);
  _JumpIfError(hr, error, "Policy:GetCertificateExtensionFlags");

  fEnable = FALSE;
  fDisable = FALSE;

        if (fFirstPass)
        {
      {
    if (0 == wcscmp(strName, TEXT(szOID_CERTTYPE_EXTENSION)))
    {
        CERT_NAME_VALUE *pCAType;
        DWORD cbCAType;

        if (VT_BSTR == varValue.vt)
        {
      if (!ceDecodeObject(
          X509_ASN_ENCODING,
          X509_UNICODE_ANY_STRING,
          (BYTE const *) varValue.bstrVal,
          SysStringByteLen(varValue.bstrVal),
          FALSE,
          (VOID **) &pCAType,
          &cbCAType))
      {
          hr = GetLastError();
          _PrintError(hr, "Policy:ceDecodeObject");
      }
      else
      {
          if (0 == lstrcmpi(
              wszCERTTYPE_SUBORDINATE_CA,
              (WCHAR *) pCAType->Value.pbData))
          {
        *pfCA = TRUE;
          }
          LocalFree(pCAType);
      }
        }
        else
        {
      _PrintError(
        HRESULT_FROM_WIN32(ERROR_INVALID_DATA),
        "Policy:Incorrect CertType Extension type");
        }
    }
      }
            if (bNewRequest && (EXTENSION_DISABLE_FLAG & ExtFlags))
            {
                switch (EXTENSION_ORIGIN_MASK & ExtFlags)
                {
                    case EXTENSION_ORIGIN_REQUEST:
                    case EXTENSION_ORIGIN_RENEWALCERT:
                    case EXTENSION_ORIGIN_PKCS7:
                    if ((EDITF_ENABLEREQUESTEXTENSIONS & m_dwEditFlags) ||
      IsStringInList(
                        strName,
                        m_cEnableRequestExtensions,
                        m_apstrEnableRequestExtensions))
                    {
      fEnable = TRUE;
                    }
                    break;
                }
            }
        }
        else
        {
            if (0 == (EXTENSION_DISABLE_FLAG & ExtFlags) &&
    IsStringInList(
          strName,
          m_cDisableExtensions,
          m_apstrDisableExtensions))
            {
                fDisable = TRUE;
            }
        }

        if (fDisable || fEnable)
        {
            if (fEnable)
            {
                ExtFlags &= ~EXTENSION_DISABLE_FLAG;
            }
            else
            {
                ExtFlags |= EXTENSION_DISABLE_FLAG;
            }
            hr = pServer->SetCertificateExtension(
                  strName,
                  PROPTYPE_BINARY,
                  ExtFlags,
                  &varValue);
            _JumpIfError(hr, error, "Policy:SetCertificateExtension");
        }

        if (fFirstPass || fDisable || fEnable)
        {
      DBGPRINT((
    fDebug,
                "Policy:EnumerateExtensions(%ws, Flags=%x, %x bytes)%s\n",
                strName,
                ExtFlags,
                SysStringByteLen(varValue.bstrVal),
    fDisable? " DISABLING" : (fEnable? " ENABLING" : "")));
        }
        VariantClear(&varValue);
    }

error:
    if (fClose)
    {
        hr2 = pServer->EnumerateExtensionsClose();
        if (S_OK != hr2)
        {
            if (S_OK == hr)
            {
                hr = hr2;
            }
      _PrintError(hr2, "Policy:EnumerateExtensionsClose");
        }
    }
    if (NULL != strName)
    {
        SysFreeString(strName);
    }
    VariantClear(&varValue);
    return(hr);
}

HRESULT CCertPolicySample::_EnumerateExtensions | ( | IN ICertServerPolicy * | pServer,
 |  | IN LONG | bNewRequest,
 |  | IN BOOL | fFirstPass,
 |  | IN BOOL | fEnableEnrolleeExtensions,
 |  | IN DWORD | cCriticalExtensions,
 |  | IN WCHAR const *const * | apwszCriticalExtensions |
 | ) |  |  | [private]
VOID CCertPolicySample::_FreeStringArray | ( | IN OUT DWORD * | pcString,
 |  | IN OUT LPWSTR ** | papstr |
 | ) |  |  | [protected]
VOID CCertPolicySample::_FreeStringArray | ( | IN OUT DWORD * | pcString,
 |  | IN OUT LPWSTR ** | papwsz |
 | ) |  |  | [private]

Definition at line 370 of file policy.cpp.

{
    LPWSTR *apwsz = *papwsz;
    DWORD i;

    if (NULL != apwsz)
    {
        for (i = *pcString; i-- > 0; )
        {
            if (NULL != apwsz[i])
            {
                DBGPRINT((fDebug, "_FreeStringArray[%u]: '%ws'\n", i, apwsz[i]));
                LocalFree(apwsz[i]);
            }
        }
        LocalFree(apwsz);
        *papwsz = NULL;
    }
    *pcString = 0;
}

CERT_CONTEXT const* CCertPolicySample::_GetIssuer ( IN ICertServerPolicy * pServer ) [protected]
PCCERT_CONTEXT CCertPolicySample::_GetIssuer ( IN ICertServerPolicy * pServer ) [private]

Definition at line 3083 of file policy.cpp.

{
    HRESULT hr;
    VARIANT varValue;
    BSTR strName = NULL;

    VariantInit(&varValue);
    if (NULL != m_pCert)
    {
        hr = S_OK;
  goto error;
    }
    strName = SysAllocString(wszPROPRAWCACERTIFICATE);
    if (NULL == strName)
    {
  hr = E_OUTOFMEMORY;
  _JumpError(hr, error, "Policy:SysAllocString");
    }
    hr = pServer->GetCertificateProperty(strName, PROPTYPE_BINARY, &varValue);
    _JumpIfError(hr, error, "Policy:GetCertificateProperty");

    m_pCert = CertCreateCertificateContext(
            X509_ASN_ENCODING,
            (BYTE *) varValue.bstrVal,
            SysStringByteLen(varValue.bstrVal));
    if (NULL == m_pCert)
    {
  hr = ceHLastError();
  _JumpError(hr, error, "Policy:CertCreateCertificateContext");
    }

error:
    VariantClear(&varValue);
    if (NULL != strName)
    {
  SysFreeString(strName);
    }
    return(m_pCert);
}

VOID CCertPolicySample::_InitAuthorityInfoAccessExtension ( IN HKEY hkey ) [protected]

Definition at line 629 of file Policy.Cpp.

{
    HRESULT hr;
    DWORD dwType;
    DWORD cb;
    DWORD adwFlags[] = {
    ISSCERT_LDAPURL,
    ISSCERT_HTTPURL,
    ISSCERT_FTPURL,
    ISSCERT_FILEURL,
      };
    WCHAR *apwszRegNames[] = {
    wszREGLDAPISSUERCERTURL,
    wszREGISSUERCERTURL,
    wszREGFTPISSUERCERTURL,
    wszREGFILEISSUERCERTURL,
      };

    // clean up from previous call
    if(m_apstrIssuerCertURL)
    {
        _FreeStringArray(&m_cIssuerCertURL, &m_apstrIssuerCertURL);
    }

    cb = sizeof(m_dwIssuerCertURLFlags);
    hr = RegQueryValueEx(
                hkey,
    wszREGISSUERCERTURLFLAGS,
                NULL,           // lpdwReserved
                &dwType,
                (BYTE *) &m_dwIssuerCertURLFlags,
                &cb);
    if (S_OK != hr ||
  REG_DWORD != dwType ||
  sizeof(m_dwIssuerCertURLFlags) != cb)
    {
        goto error;
    }
    DBGPRINT((fDebug, "Issuer Cert Flags = %x\n", m_dwIssuerCertURLFlags));

    if (ISSCERT_ENABLE & m_dwIssuerCertURLFlags)
    {
        assert(ARRAYSIZE(adwFlags) == ARRAYSIZE(apwszRegNames));
        hr = _ReadRegistryStringArray(
                                        hkey,
                                        TRUE,     // fURL
                                        m_dwIssuerCertURLFlags,
                                        ARRAYSIZE(adwFlags),
                                        adwFlags,
                                        apwszRegNames,
                                        &m_cIssuerCertURL,
                                        &m_apstrIssuerCertURL);
        _JumpIfError(hr, error, "_ReadRegistryStringArray");

        _DumpStringArray("Issuer Cert", m_cIssuerCertURL, m_apstrIssuerCertURL);
    }

error:
    ;
}

VOID CCertPolicySample::_InitDisableExtensionList ( IN HKEY hkey ) [private]

Definition at line 959 of file policy.cpp.

{
    HRESULT hr;
    DWORD adwFlags[] = {
  EDITF_DISABLEEXTENSIONLIST,
    };
    WCHAR *apwszRegNames[] = {
  wszREGDISABLEEXTENSIONLIST,
    };

    assert(ARRAYSIZE(adwFlags) == ARRAYSIZE(apwszRegNames));

    // clean up from previous call

    if (NULL != m_apwszDisableExtensions)
    {
        _FreeStringArray(&m_cDisableExtensions, &m_apwszDisableExtensions);
    }

    hr = _ReadRegistryStringArray(
      hkey,
      FALSE,      // fURL
      m_dwEditFlags,
      ARRAYSIZE(adwFlags),
      adwFlags,
      apwszRegNames,
      &m_cDisableExtensions,
      &m_apwszDisableExtensions);
    _JumpIfError(hr, error, "_ReadRegistryStringArray");

    _DumpStringArray(
    "Disable",
    m_cDisableExtensions,
    m_apwszDisableExtensions);

error:
    ;
}

VOID CCertPolicySample::_InitDisableExtensionList ( IN HKEY hkey ) [protected]
VOID CCertPolicySample::_InitRequestExtensionList ( IN HKEY hkey ) [private]

Definition at line 884 of file policy.cpp.

{
    HRESULT hr;
    DWORD adwFlags[] = {
  EDITF_REQUESTEXTENSIONLIST,
    };
    WCHAR *apwszRegNames[] = {
  wszREGENABLEREQUESTEXTENSIONLIST,
    };
    WCHAR *apwszRegNamesEnrollee[] = {
  wszREGENABLEENROLLEEREQUESTEXTENSIONLIST,
    };

    assert(ARRAYSIZE(adwFlags) == ARRAYSIZE(apwszRegNames));
    assert(ARRAYSIZE(adwFlags) == ARRAYSIZE(apwszRegNamesEnrollee));

    // clean up from previous call

    if (NULL != m_apwszEnableRequestExtensions)
    {
        _FreeStringArray(
        &m_cEnableRequestExtensions,
        &m_apwszEnableRequestExtensions);
    }
    if (NULL != m_apwszEnableEnrolleeRequestExtensions)
    {
        _FreeStringArray(
        &m_cEnableEnrolleeRequestExtensions,
        &m_apwszEnableEnrolleeRequestExtensions);
    }

    hr = _ReadRegistryStringArray(
      hkey,
      FALSE,      // fURL
      m_dwEditFlags,
      ARRAYSIZE(adwFlags),
      adwFlags,
      apwszRegNames,
      &m_cEnableRequestExtensions,
      &m_apwszEnableRequestExtensions);
    _JumpIfError(hr, error, "_ReadRegistryStringArray");

    _DumpStringArray(
    "Request",
    m_cEnableRequestExtensions,
    m_apwszEnableRequestExtensions);

    hr = _ReadRegistryStringArray(
      hkey,
      FALSE,      // fURL
      m_dwEditFlags,
      ARRAYSIZE(adwFlags),
      adwFlags,
      apwszRegNamesEnrollee,
      &m_cEnableEnrolleeRequestExtensions,
      &m_apwszEnableEnrolleeRequestExtensions);
    _JumpIfError(hr, error, "_ReadRegistryStringArray");

    _DumpStringArray(
    "EnrolleeRequest",
    m_cEnableEnrolleeRequestExtensions,
    m_apwszEnableEnrolleeRequestExtensions);

error:
    ;
}

VOID CCertPolicySample::_InitRequestExtensionList ( IN HKEY hkey ) [protected]
VOID CCertPolicySample::_InitRevocationExtension ( IN HKEY hkey ) [private]

Definition at line 829 of file policy.cpp.

{
    HRESULT hr;
    DWORD dwType;
    DWORD cb;

    cb = sizeof(m_dwRevocationFlags);
    hr = RegQueryValueEx(
                hkey,
                wszREGREVOCATIONTYPE,
                NULL,           // lpdwReserved
                &dwType,
                (BYTE *) &m_dwRevocationFlags,
                &cb);
    if (S_OK != hr ||
  REG_DWORD != dwType ||
  sizeof(m_dwRevocationFlags) != cb)
    {
  m_dwRevocationFlags = 0;
        goto error;
    }
    DBGPRINT((fDebug, "Revocation Flags = %x\n", m_dwRevocationFlags));

    // clean up from previous call

    if (NULL != m_wszASPRevocationURL)
    {
  LocalFree(m_wszASPRevocationURL);
  m_wszASPRevocationURL = NULL;
    }

    if (REVEXT_ASPENABLE & m_dwRevocationFlags)
    {
        hr = _ReadRegistryString(
          hkey,
          TRUE,     // fURL
          wszREGREVOCATIONURL,  // pwszRegName
          L"?",     // pwszSuffix
          &m_wszASPRevocationURL);  // pstrRegValue
        _JumpIfErrorStr(hr, error, "_ReadRegistryString", wszREGREVOCATIONURL);
        _DumpStringArray("ASP", 1, &m_wszASPRevocationURL);
    }

error:
    ;
}

VOID CCertPolicySample::_InitRevocationExtension ( IN HKEY hkey ) [protected]
VOID CCertPolicySample::_InitSubjectAltNameExtension | ( | IN HKEY | hkey,
 |  | IN WCHAR const * | pwszRegName,
 |  | IN WCHAR const * | pwszObjectId,
 |  | IN DWORD | iAltName |
 | ) |  |  | [protected]

Definition at line 788 of file Policy.Cpp.

{
    DWORD err;
    DWORD dwType;
    DWORD cbbuf;
    WCHAR awcbuf[MAX_PATH];

    cbbuf = sizeof(awcbuf) - 2 * sizeof(WCHAR);
    err = RegQueryValueEx(
        hkey,
        pwszRegName,
        NULL,         // lpdwReserved
        &dwType,
        (BYTE *) awcbuf,
        &cbbuf);
    if (ERROR_SUCCESS != err ||
        REG_SZ != dwType ||
        sizeof(awcbuf) - 2 * sizeof(WCHAR) <= cbbuf)
    {
        goto error;
    }
    if (0 == lstrcmpi(awcbuf, wszATTREMAIL1) ||
  0 == lstrcmpi(awcbuf, wszATTREMAIL2))
    {
        if (!ceConvertWszToBstr(
      &m_astrSubjectAltNameObjectId[iAltName],
      pwszObjectId,
      -1))
  {
      _JumpError(E_OUTOFMEMORY, error, "Policy:ceConvertWszToBstr");
  }

        if (!ceConvertWszToBstr(
      &m_astrSubjectAltNameProp[iAltName],
      wszPROPSUBJECTEMAIL,
      -1))
  {
      _JumpError(E_OUTOFMEMORY, error, "Policy:ceConvertWszToBstr");
  }
    }
    DBGPRINT((
  fDebug,
  "Policy: %ws(RDN=%ws): %ws\n",
  pwszRegName,
  awcbuf,
  m_astrSubjectAltNameProp[iAltName]));

error:
    ;
}

HRESULT CCertPolicySample::_ReadRegistryString | ( | IN HKEY | hkey,
 |  | IN BOOL | fURL,
 |  | IN WCHAR const * | pwszRegName,
 |  | IN WCHAR const * | pwszSuffix,
 |  | OUT LPWSTR * | pwszRegValue |
 | ) |  |  | [protected]
HRESULT CCertPolicySample::_ReadRegistryString | ( | IN HKEY | hkey,
 |  | IN BOOL | fURL,
 |  | IN WCHAR const * | pwszRegName,
 |  | IN WCHAR const * | pwszSuffix,
 |  | OUT LPWSTR * | pwszRegValue |
 | ) |  |  | [private]

Definition at line 459 of file policy.cpp.

{
    HRESULT hr;
    WCHAR *pwszRegValue = NULL;
    DWORD cbValue;
    DWORD dwType;

    *ppwszOut = NULL;
    hr = RegQueryValueEx(
        hkey,
        pwszRegName,
        NULL,           // lpdwReserved
        &dwType,
        NULL,
        &cbValue);
    _JumpIfErrorStr2(
    hr,
    error,
    "Policy:RegQueryValueEx",
    pwszRegName,
    ERROR_FILE_NOT_FOUND);

    if (REG_SZ != dwType && REG_MULTI_SZ != dwType)
    {
        hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
        _JumpErrorStr(hr, error, "Policy:RegQueryValueEx TYPE", pwszRegName);
    }
    if (NULL != pwszSuffix)
    {
  cbValue += wcslen(pwszSuffix) * sizeof(WCHAR);
    }
    pwszRegValue = (WCHAR *) LocalAlloc(LMEM_FIXED, cbValue + sizeof(WCHAR));
    if (NULL == pwszRegValue)
    {
        hr = E_OUTOFMEMORY;
        _JumpErrorStr(hr, error, "Policy:LocalAlloc", pwszRegName);
    }
    hr = RegQueryValueEx(
        hkey,
        pwszRegName,
        NULL,           // lpdwReserved
        &dwType,
        (BYTE *) pwszRegValue,
        &cbValue);
    _JumpIfErrorStr(hr, error, "Policy:RegQueryValueEx", pwszRegName);

    // Handle malformed registry values cleanly:

    pwszRegValue[cbValue / sizeof(WCHAR)] = L'\0';
    if (NULL != pwszSuffix)
    {
  wcscat(pwszRegValue, pwszSuffix);
    }

    hr = ceFormatCertsrvStringArray(
      fURL,     // fURL
      m_strMachineDNSName,  // pwszServerName_p1_2
      m_strCASanitizedName, // pwszSanitizedName_p3_7
      m_iCert,    // iCert_p4
      MAXDWORD,   // iCertTarget_p4
      L"",    // pwszDomainDN_p5
      L"",    // pwszConfigDN_p6
      m_iCRL,     // iCRL_p8
      FALSE,      // fDeltaCRL_p9
      TRUE,     // fDSAttrib_p10_11
      1,      // cStrings
      (LPCWSTR *) &pwszRegValue, // apwszStringsIn
      ppwszOut);    // apwszStringsOut
    _JumpIfError(hr, error, "Policy:ceFormatCertsrvStringArray");

error:
    if (NULL != pwszRegValue)
    {
        LocalFree(pwszRegValue);
    }
    return(ceHError(hr)); // Reg routines return Win32 error codes
}

HRESULT CCertPolicySample::_ReadRegistryStringArray | ( | IN HKEY | hkey,
 |  | IN BOOL | fURL,
 |  | IN DWORD | dwFlags,
 |  | IN DWORD | cRegNames,
 |  | IN DWORD * | aFlags,
 |  | IN WCHAR const *const * | apwszRegNames,
 |  | IN OUT DWORD * | pcStrings,
 |  | IN OUT LPWSTR ** | papwszRegValues |
 | ) |  |  | [private]

Definition at line 726 of file policy.cpp.

{
    HRESULT hr;
    DWORD i;
    WCHAR *pwszzValue = NULL;
    DWORD cbValue;
    DWORD dwType;

    for (i = 0; i < cRegNames; i++)
    {
        if (0 == (dwFlags & aFlags[i]))
        {
      continue;
        }
        if (NULL != pwszzValue)
        {
      LocalFree(pwszzValue);
      pwszzValue = NULL;
        }
        hr = RegQueryValueEx(
            hkey,
            apwszRegNames[i],
            NULL,           // lpdwReserved
            &dwType,
            NULL,
            &cbValue);
        if (S_OK != hr)
        {
      _PrintErrorStr2(
      hr,
      "Policy:RegQueryValueEx",
      apwszRegNames[i],
      ERROR_FILE_NOT_FOUND);
      continue;
        }
        if (REG_SZ != dwType && REG_MULTI_SZ != dwType)
        {
      hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
      _PrintErrorStr(hr, "Policy:RegQueryValueEx TYPE", apwszRegNames[i]);
      continue;
        }

        // Handle malformed registry values cleanly by adding two WCHAR L'\0's
  // allocate space for 3 WCHARs to allow for unaligned (odd) cbValue;

        pwszzValue = (WCHAR *) LocalAlloc(
                LMEM_FIXED,
                cbValue + 3 * sizeof(WCHAR));
        if (NULL == pwszzValue)
        {
      hr = E_OUTOFMEMORY;
      _JumpErrorStr(hr, error, "Policy:LocalAlloc", apwszRegNames[i]);
        }
        hr = RegQueryValueEx(
            hkey,
            apwszRegNames[i],
            NULL,           // lpdwReserved
            &dwType,
            (BYTE *) pwszzValue,
            &cbValue);
        if (S_OK != hr)
        {
      _PrintErrorStr(hr, "Policy:RegQueryValueEx", apwszRegNames[i]);
      continue;
        }

        // Handle malformed registry values cleanly:

        pwszzValue[cbValue / sizeof(WCHAR)] = L'\0';
        pwszzValue[cbValue / sizeof(WCHAR) + 1] = L'\0';

        hr = _AddStringArray(
      pwszzValue,
      fURL,
      pcStrings,
      papwszRegValues);
        _JumpIfErrorStr(hr, error, "_AddStringArray", apwszRegNames[i]);
    }
    hr = S_OK;

error:
    if (NULL != pwszzValue)
    {
        LocalFree(pwszzValue);
    }
    return(hr);
}

HRESULT CCertPolicySample::_ReadRegistryStringArray | ( | IN HKEY | hkey,
 |  | IN BOOL | fURL,
 |  | IN DWORD | dwFlags,
 |  | IN DWORD | cRegNames,
 |  | IN DWORD * | aFlags,
 |  | IN WCHAR const *const * | apwszRegNames,
 |  | IN OUT DWORD * | pcStrings,
 |  | IN OUT LPWSTR ** | papstrRegValues |
 | ) |  |  | [protected]
HRESULT CCertPolicySample::_SetSystemStringProp | ( | IN ICertServerPolicy * | pServer,
 |  | IN WCHAR const * | pwszName,
 |  | OPTIONAL IN WCHAR const * | pwszValue |
 | ) |  |  | [private]

Definition at line 575 of file policy.cpp.

{
    HRESULT hr;
    BSTR strName = NULL;
    VARIANT varValue;

    varValue.vt = VT_NULL;
    varValue.bstrVal = NULL;

    if (!ceConvertWszToBstr(&strName, pwszName, -1))
    {
  hr = E_OUTOFMEMORY;
  _JumpError(hr, error, "Policy:ceConvertWszToBstr");
    }

    if (NULL != pwszValue)
    {
        if (!ceConvertWszToBstr(&varValue.bstrVal, pwszValue, -1))
  {
      hr = E_OUTOFMEMORY;
      _JumpError(hr, error, "Policy:ceConvertWszToBstr");
  }
  varValue.vt = VT_BSTR;
    }

    hr = pServer->SetCertificateProperty(strName, PROPTYPE_STRING, &varValue);
    _JumpIfError(hr, error, "Policy:SetCertificateProperty");

error:
    VariantClear(&varValue);
    if (NULL != strName)
    {
  SysFreeString(strName);
    }
    return(hr);
}

HRESULT CCertPolicySample::_SetValidityPeriod ( IN ICertServerPolicy * pServer ) [protected]
HRESULT CCertPolicySample::_SetValidityPeriod ( IN ICertServerPolicy * pServer ) [private]

Definition at line 2516 of file policy.cpp.

{
    HRESULT hr;
    BSTR strPeriodString = NULL;
    BSTR strPeriodCount = NULL;
    BSTR strNameNotBefore = NULL;
    BSTR strNameNotAfter = NULL;
    VARIANT varValue;
    LONG lDelta;
    ENUM_PERIOD enumValidityPeriod;
    BOOL fValidDigitString;

    VariantInit(&varValue);

    if (!(EDITF_ATTRIBUTEENDDATE & m_dwEditFlags))
    {
  hr = S_OK;
  goto error;
    }

    hr = polGetRequestAttribute(
      pServer,
      wszPROPVALIDITYPERIODSTRING,
      &strPeriodString);
    if (S_OK != hr)
    {
  _PrintErrorStr2(
    hr,
    "Policy:polGetRequestAttribute",
    wszPROPVALIDITYPERIODSTRING,
    CERTSRV_E_PROPERTY_EMPTY);
  if (CERTSRV_E_PROPERTY_EMPTY == hr)
  {
      hr = S_OK;
  }
  goto error;
    }

    hr = polGetRequestAttribute(
      pServer,
      wszPROPVALIDITYPERIODCOUNT,
      &strPeriodCount);
    if (S_OK != hr)
    {
  _PrintErrorStr2(
    hr,
    "Policy:polGetRequestAttribute",
    wszPROPVALIDITYPERIODCOUNT,
    CERTSRV_E_PROPERTY_EMPTY);
  if (CERTSRV_E_PROPERTY_EMPTY == hr)
  {
      hr = S_OK;
  }
  goto error;
    }

    // Swap Count and String BSTRs if backwards -- Windows 2000 had it wrong.

    lDelta = ceWtoI(strPeriodCount, &fValidDigitString);
    if (!fValidDigitString)
    {
  BSTR str = strPeriodCount;

  strPeriodCount = strPeriodString;
  strPeriodString = str;

  lDelta = ceWtoI(strPeriodCount, &fValidDigitString);
  if (!fValidDigitString)
  {
      hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
      _JumpError(hr, error, "Policy:ceWtoI");
  }
    }

    hr = ceTranslatePeriodUnits(strPeriodString, lDelta, &enumValidityPeriod, &lDelta);
    _JumpIfError(hr, error, "Policy:ceTranslatePeriodUnits");

    strNameNotBefore = SysAllocString(wszPROPCERTIFICATENOTBEFOREDATE);
    if (NULL == strNameNotBefore)
    {
        hr = E_OUTOFMEMORY;
        _JumpError(hr, error, "Policy:SysAllocString");
    }
    hr = pServer->GetCertificateProperty(
        strNameNotBefore,
        PROPTYPE_DATE,
        &varValue);
    _JumpIfError(hr, error, "Policy:GetCertificateProperty");

    hr = ceMakeExprDate(&varValue.date, lDelta, enumValidityPeriod);
    _JumpIfError(hr, error, "Policy:ceMakeExprDate");

    strNameNotAfter = SysAllocString(wszPROPCERTIFICATENOTAFTERDATE);
    if (NULL == strNameNotAfter)
    {
        hr = E_OUTOFMEMORY;
        _JumpError(hr, error, "Policy:SysAllocString");
    }
    hr = pServer->SetCertificateProperty(
        strNameNotAfter,
        PROPTYPE_DATE,
        &varValue);
    _JumpIfError(hr, error, "Policy:SetCertificateProperty");

    hr = S_OK;

error:
    VariantClear(&varValue);
    if (NULL != strPeriodString)
    {
  SysFreeString(strPeriodString);
    }
    if (NULL != strPeriodCount)
    {
  SysFreeString(strPeriodCount);
    }
    if (NULL != strNameNotBefore)
    {
        SysFreeString(strNameNotBefore);
    }
    if (NULL != strNameNotAfter)
    {
        SysFreeString(strNameNotAfter);
    }
    return(hr);
}

HRESULT CCertPolicySample::AddBasicConstraintsCommon | ( | IN ICertServerPolicy * | pServer,
 |  | IN CERT_EXTENSION const * | pExtension,
 |  | IN BOOL | fCA,
 |  | IN BOOL | fEnableExtension
 | ) |  |
HRESULT CCertPolicySample::AddBasicConstraintsCommon | ( | IN ICertServerPolicy * | pServer,
 |  | IN CERT_EXTENSION const * | pExtension,
 |  | IN BOOL | fCA,
 |  | IN BOOL | fEnableExtension
 | ) |  |

Definition at line 2325 of file policy.cpp.

{
    HRESULT hr;
    BSTR strExtension = NULL;
    VARIANT varExtension;
    CERT_CONTEXT const *pIssuerCert;
    CERT_EXTENSION *pIssuerExtension;
    LONG ExtFlags = 0;
    BYTE *pbConstraints = NULL;
    CERT_BASIC_CONSTRAINTS2_INFO Constraints;
    CERT_BASIC_CONSTRAINTS2_INFO IssuerConstraints;
    ZeroMemory(&IssuerConstraints, sizeof(IssuerConstraints));

    DWORD cb;

    pIssuerCert = _GetIssuer(pServer);
    if (NULL == pIssuerCert)
    {
        hr = E_POINTER;
        _JumpError(hr, error, "_GetIssuer");
    }

    if (NULL != pExtension)
    {
        cb = sizeof(Constraints);
        if (!CryptDecodeObject(
      X509_ASN_ENCODING,
      X509_BASIC_CONSTRAINTS2,
      pExtension->Value.pbData,
      pExtension->Value.cbData,
      0,
      &Constraints,
      &cb))
        {
      hr = ceHLastError();
      _JumpError(hr, error, "Policy:CryptDecodeObject");
        }

        // Cert templates use CAPATHLENGTH_INFINITE to indicate
        // fPathLenConstraint should be FALSE.

        if (CAPATHLENGTH_INFINITE == Constraints.dwPathLenConstraint)
        {

            // NOTE: This is ok as certcli already sets fPathLenConstraint to FALSE
            // for templates in this case.
      Constraints.fPathLenConstraint = FALSE;

            // NOTE: This is ok as autoenrollment ignores dwPathLenConstraint
            // if fPathLenConstraint is FALSE;
      Constraints.dwPathLenConstraint = 0;
        }
        if (pExtension->fCritical)
        {
      ExtFlags = EXTENSION_CRITICAL_FLAG;
        }
    }
    else
    {
  Constraints.fCA = fCA;
  Constraints.fPathLenConstraint = FALSE;
  Constraints.dwPathLenConstraint = 0;
    }
    if (EDITF_BASICCONSTRAINTSCRITICAL & m_dwEditFlags)
    {
        ExtFlags = EXTENSION_CRITICAL_FLAG;
    }

    // Check basic constraints against the issuer's cert.

    pIssuerExtension = CertFindExtension(
        szOID_BASIC_CONSTRAINTS2,
        pIssuerCert->pCertInfo->cExtension,
        pIssuerCert->pCertInfo->rgExtension);
    if (NULL != pIssuerExtension)
    {
        cb = sizeof(IssuerConstraints);
        if (!CryptDecodeObject(
              X509_ASN_ENCODING,
              X509_BASIC_CONSTRAINTS2,
              pIssuerExtension->Value.pbData,
              pIssuerExtension->Value.cbData,
              0,
              &IssuerConstraints,
              &cb))
        {
            hr = ceHLastError();
            _JumpError(hr, error, "Policy:CryptDecodeObject");
        }
        if (!IssuerConstraints.fCA)
        {
            hr = CERTSRV_E_INVALID_CA_CERTIFICATE;
            _JumpError(hr, error, "Policy:CA cert not a CA cert");
        }
    }

    if (Constraints.fCA)
    {
        if (IssuerConstraints.fPathLenConstraint)
        {
            if (0 == IssuerConstraints.dwPathLenConstraint)
            {
                hr = CERTSRV_E_INVALID_CA_CERTIFICATE;
                _JumpError(hr, error, "Policy:CA cert is a leaf CA cert");
            }
            if (!Constraints.fPathLenConstraint ||
                Constraints.dwPathLenConstraint >
              IssuerConstraints.dwPathLenConstraint - 1)
            {
                Constraints.fPathLenConstraint = TRUE;
                Constraints.dwPathLenConstraint =
                IssuerConstraints.dwPathLenConstraint - 1;
            }
        }
        if (CAPATHLENGTH_INFINITE != m_CAPathLength)
        {
            if (0 == m_CAPathLength)
            {
                hr = CERTSRV_E_INVALID_CA_CERTIFICATE;
                _JumpError(hr, error, "Policy:Registry says not to issue CA certs");
            }
            if (!Constraints.fPathLenConstraint ||
                Constraints.dwPathLenConstraint > m_CAPathLength - 1)
            {
                Constraints.fPathLenConstraint = TRUE;
                Constraints.dwPathLenConstraint = m_CAPathLength - 1;
            }
        }
    }

    if (!fEnableExtension)
    {
        ExtFlags |= EXTENSION_DISABLE_FLAG;
    }

    if (!ceEncodeObject(
        X509_ASN_ENCODING,
                    X509_BASIC_CONSTRAINTS2,
                    &Constraints,
        0,
        FALSE,
                    &pbConstraints,
                    &cb))
    {
        hr = ceHLastError();
        _JumpError(hr, error, "Policy:ceEncodeObject");
    }

    if (!ceConvertWszToBstr(
      &strExtension,
      (WCHAR const *) pbConstraints,
      cb))
    {
        hr = E_OUTOFMEMORY;
        _JumpError(hr, error, "Policy:ceConvertWszToBstr");
    }

    varExtension.vt = VT_BSTR;
    varExtension.bstrVal = strExtension;
    hr = polSetCertificateExtension(
          pServer,
          TEXT(szOID_BASIC_CONSTRAINTS2),
          PROPTYPE_BINARY,
          ExtFlags,
          &varExtension);
    _JumpIfError(hr, error, "Policy:polSetCertificateExtension");

error:
    if (NULL != pbConstraints)
    {
        LocalFree(pbConstraints);
    }
    if (NULL != strExtension)
    {
        SysFreeString(strExtension);
    }
    return(hr);
}

HRESULT CCertPolicySample::AddV1TemplateNameExtension | ( | IN ICertServerPolicy * | pServer,
 |  | OPTIONAL IN WCHAR const * | pwszTemplateName
 | ) |  |

Definition at line 2653 of file policy.cpp.

{
    HRESULT hr;
    BSTR strName = NULL;
    LONG ExtFlags = 0;
    VARIANT varExtension;
    CERT_NAME_VALUE *pName = NULL;
    CERT_NAME_VALUE NameValue;
    DWORD cbEncoded;
    BYTE *pbEncoded = NULL;
    BOOL fUpdate = TRUE;

    VariantInit(&varExtension);

    strName = SysAllocString(TEXT(szOID_ENROLL_CERTTYPE_EXTENSION));
    if (NULL == strName)
    {
  hr = E_OUTOFMEMORY;
  _JumpError(hr, error, "Policy:SysAllocString");
    }

    hr = pServer->GetCertificateExtension(
            strName,
            PROPTYPE_BINARY,
            &varExtension);
    _PrintIfError2(hr, "Policy:GetCertificateExtension", hr);
    if (CERTSRV_E_PROPERTY_EMPTY == hr)
    {
  if (NULL == pwszTemplateName)
  {
      hr = S_OK;
      goto error;
  }
    }
    else
    {
  _JumpIfError(hr, error, "Policy:GetCertificateExtension");

  hr = pServer->GetCertificateExtensionFlags(&ExtFlags);
  _JumpIfError(hr, error, "Policy:GetCertificateExtensionFlags");

  if (VT_BSTR == varExtension.vt &&
      0 == (EXTENSION_DISABLE_FLAG & ExtFlags) &&
      NULL != pwszTemplateName)
  {
      if (!ceDecodeObject(
      X509_ASN_ENCODING,
      X509_UNICODE_ANY_STRING,
      (BYTE *) varExtension.bstrVal,
      SysStringByteLen(varExtension.bstrVal),
      FALSE,
      (VOID **) &pName,
      &cbEncoded))
      {
    hr = ceHLastError();
    _JumpError(hr, error, "Policy:ceDecodeObject");
      }

      // case sensitive compare -- be sure to match case of template

      if (0 == lstrcmp(
      (WCHAR const *) pName->Value.pbData,
      pwszTemplateName))
      {
    fUpdate = FALSE;
      }
  }
    }
    if (fUpdate)
    {
  if (NULL == pwszTemplateName)
  {
      ExtFlags |= EXTENSION_DISABLE_FLAG;
  }
  else
  {
      VariantClear(&varExtension);
      varExtension.bstrVal = NULL;

      NameValue.dwValueType = CERT_RDN_UNICODE_STRING;
      NameValue.Value.pbData = (BYTE *) pwszTemplateName;
      NameValue.Value.cbData = 0;

      if (!ceEncodeObject(
          X509_ASN_ENCODING,
          X509_UNICODE_ANY_STRING,
          &NameValue,
          0,
          FALSE,
          &pbEncoded,
          &cbEncoded))
      {
    hr = ceHLastError();
    _JumpError(hr, error, "Policy:ceEncodeObject");
      }
      if (!ceConvertWszToBstr(
        &varExtension.bstrVal,
        (WCHAR const *) pbEncoded,
        cbEncoded))
      {
    hr = E_OUTOFMEMORY;
    _JumpError(hr, error, "Policy:ceConvertWszToBstr");
      }
      varExtension.vt = VT_BSTR;
      ExtFlags &= ~EXTENSION_DISABLE_FLAG;
  }
  hr = pServer->SetCertificateExtension(
        strName,
        PROPTYPE_BINARY,
        ExtFlags,
        &varExtension);
  _JumpIfError(hr, error, "Policy:SetCertificateExtension");
    }
    hr = S_OK;

error:
    VariantClear(&varExtension);
    if (NULL != strName)
    {
  SysFreeString(strName);
    }
    if (NULL != pName)
    {
  LocalFree(pName);
    }
    if (NULL != pbEncoded)
    {
  LocalFree(pbEncoded);
    }
    return(hr);
}

CCertPolicySample::DECLARE_REGISTRY | ( | CCertPolicySample | ,
 |  | wszCLASS_CERTPOLICYSAMPLE | TEXT".1",
 |  | wszCLASS_CERTPOLICYSAMPLE | ,
 |  | IDS_CERTPOLICY_DESC | ,
 |  | THREADFLAGS_BOTH |
 | ) |  |
CCertPolicySample::DECLARE_REGISTRY | ( | CCertPolicySample | ,
 |  | wszCLASS_CERTPOLICYSAMPLE | TEXT".1",
 |  | wszCLASS_CERTPOLICYSAMPLE | ,
 |  | IDS_CERTPOLICY_DESC | ,
 |  | THREADFLAGS_BOTH |
 | ) |  |
STDMETHODIMP CCertPolicySample::GetDescription ( BSTR __RPC_FAR * pstrDescription )

Definition at line 3001 of file policy.cpp.

{
    HRESULT hr = S_OK;
    WCHAR sz[MAX_PATH];

    if(!m_strDescription)
    {
  assert(wcslen(wsz_SAMPLE_DESCRIPTION) < ARRAYSIZE(sz));
  wcsncpy(sz, wsz_SAMPLE_DESCRIPTION, ARRAYSIZE(sz));
  sz[ARRAYSIZE(sz) - 1] = L'\0';

  m_strDescription = SysAllocString(sz);
  if (NULL == m_strDescription)
  {
      hr = E_OUTOFMEMORY;
      return hr;
  }
    }

    if (NULL != *pstrDescription)
    {
        SysFreeString(*pstrDescription);
    }

    *pstrDescription = SysAllocString(m_strDescription);
    if (NULL == *pstrDescription)
    {
        hr = E_OUTOFMEMORY;
    }
    return(hr);
}

STDMETHOD() CCertPolicySample::GetDescription ( BSTR __RPC_FAR * pstrDescription )
STDMETHODIMP CCertPolicySample::GetManageModule ( ICertManageModule ** ppManageModule )

Definition at line 3057 of file policy.cpp.

{
    HRESULT hr;

    *ppManageModule = NULL;
    hr = CoCreateInstance(
        CLSID_CCertManagePolicyModuleSample,
                    NULL,               // pUnkOuter
                    CLSCTX_INPROC_SERVER,
        IID_ICertManageModule,
                    (VOID **) ppManageModule);
    _JumpIfError(hr, error, "CoCreateInstance");

error:
    return(hr);
}

BSTRC CCertPolicySample::GetPolicyDescription ( ) [inline]

Definition at line 203 of file policy.h.

{ return(m_strDescription); }

STDMETHOD() CCertPolicySample::Initialize ( BSTR const strConfig )
STDMETHODIMP CCertPolicySample::Initialize ( BSTR const strConfig )

Definition at line 1010 of file policy.cpp.

{
    HRESULT hr;
    HKEY hkey = NULL;
    DWORD dwType;
    DWORD dwSize;
    ICertServerPolicy *pServer = NULL;
    BOOL fUpgraded;
    BSTR bstrDescription = NULL;

    CERT_RDN_ATTR rdnAttr = { szOID_COMMON_NAME, CERT_RDN_ANY_TYPE, };

    rdnAttr.Value.pbData = NULL;

    DBGPRINT((fDebug, "Policy:Initialize:\n"));

    __try
    {
  _Cleanup();

  m_strCAName = SysAllocString(strConfig);
  if (NULL == m_strCAName)
  {
      hr = E_OUTOFMEMORY;
      _LeaveError(hr, "CCertPolicySample::SysAllocString");
  }

  // force loading the description from resources

  hr = GetDescription(&bstrDescription);
  _LeaveIfError(hr, "CCertPolicySample::GetDescription");

  // get server callbacks

  hr = polGetServerCallbackInterface(&pServer, 0);
  _LeaveIfError(hr, "Policy:polGetServerCallbackInterface");

  hr = ReqInitialize(pServer);
  _JumpIfError(hr, error, "ReqInitialize");

  // get storage location
  hr = polGetCertificateStringProperty(
            pServer,
            wszPROPMODULEREGLOC,
            &m_strRegStorageLoc);
  _LeaveIfErrorStr(
        hr,
        "Policy:polGetCertificateStringProperty",
        wszPROPMODULEREGLOC);

  // get CA type

  hr = polGetCertificateLongProperty(
            pServer,
            wszPROPCATYPE,
            (LONG *) &m_CAType);
  _LeaveIfErrorStr(
        hr,
        "Policy:polGetCertificateLongProperty",
        wszPROPCATYPE);

  // get sanitized name

  hr = polGetCertificateStringProperty(
            pServer,
            wszPROPSANITIZEDCANAME,
            &m_strCASanitizedName);
  _LeaveIfErrorStr(
        hr,
        "Policy:polGetCertificateStringProperty",
        wszPROPSANITIZEDCANAME);

  // get sanitized name

  hr = polGetCertificateStringProperty(
            pServer,
            wszPROPSANITIZEDSHORTNAME,
            &m_strCASanitizedDSName);
  _LeaveIfErrorStr(
        hr,
        "Policy:polGetCertificateStringProperty",
        wszPROPSANITIZEDSHORTNAME);

  hr = polGetCertificateLongProperty(
            pServer,
            wszPROPSERVERUPGRADED,
            (LONG *) &fUpgraded);
  if (S_OK != hr)
  {
      fUpgraded = FALSE;
      _PrintErrorStr(
        hr,
        "Policy:polGetCertificateLongProperty",
        wszPROPSERVERUPGRADED);
  }

  hr = RegOpenKeyEx(
    HKEY_LOCAL_MACHINE,
    m_strRegStorageLoc,
    0,              // dwReserved
    fUpgraded?
        KEY_ALL_ACCESS :
        (KEY_ENUMERATE_SUB_KEYS | KEY_EXECUTE | KEY_QUERY_VALUE),
    &hkey);
  _LeaveIfErrorStr(
        hr,
        "Policy:Initialize:RegOpenKeyEx",
        m_strRegStorageLoc);

  // Ignore error codes.

  dwSize = sizeof(m_dwDispositionFlags);
  hr = RegQueryValueEx(
      hkey,
      wszREGREQUESTDISPOSITION,
      0,
      &dwType,
      (BYTE *) &m_dwDispositionFlags,
      &dwSize);
  if (S_OK != hr || REG_DWORD != dwType)
  {
      m_dwDispositionFlags = REQDISP_PENDINGFIRST | REQDISP_ISSUE;
  }
  DBGPRINT((
      fDebug,
      "Disposition Flags = %x\n",
      m_dwDispositionFlags));

  dwSize = sizeof(m_dwEditFlags);
  hr = RegQueryValueEx(
      hkey,
      wszREGEDITFLAGS,
      0,
      &dwType,
      (BYTE *) &m_dwEditFlags,
      &dwSize);
  if (S_OK != hr || REG_DWORD != dwType)
  {
      m_dwEditFlags =
        EDITF_DEFAULT_STANDALONE;
  }
  if (fUpgraded)
  {
      DBGPRINT((
    fDebug,
    "Initialize: setting EDITF_SERVERUPGRADED\n"));

      m_dwEditFlags |= EDITF_SERVERUPGRADED;
      dwSize = sizeof(m_dwEditFlags);
      hr = RegSetValueEx(
          hkey,
          wszREGEDITFLAGS,
          0,
          REG_DWORD,
          (BYTE *) &m_dwEditFlags,
          dwSize);
      _PrintIfError(hr, "Policy:RegSetValueEx");
  }
  DBGPRINT((fDebug, "Edit Flags = %x\n", m_dwEditFlags));

  dwSize = sizeof(m_CAPathLength);
  hr = RegQueryValueEx(
      hkey,
      wszREGCAPATHLENGTH,
      0,
      &dwType,
      (BYTE *) &m_CAPathLength,
      &dwSize);
  if (S_OK != hr || REG_DWORD != dwType)
  {
      m_CAPathLength = CAPATHLENGTH_INFINITE;
  }
  DBGPRINT((fDebug, "CAPathLength = %x\n", m_CAPathLength));

  // Initialize the insertion string array.
  // Machine DNS name (%1)

  hr = polGetCertificateStringProperty(
          pServer,
          wszPROPMACHINEDNSNAME,
          &m_strMachineDNSName);
  _LeaveIfErrorStr(
        hr,
        "Policy:polGetCertificateStringProperty",
        wszPROPMACHINEDNSNAME);

  hr = polGetCertificateLongProperty(
            pServer,
            wszPROPCERTCOUNT,
            (LONG *) &m_iCert);
  _LeaveIfErrorStr(
        hr,
        "Policy:polGetCertificateLongProperty",
        wszPROPCERTCOUNT);

  if (0 == m_iCert) // no CA certs?
  {
      hr = HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
      _LeaveIfErrorStr(
      hr,
      "Policy:polGetCertificateLongProperty",
      wszPROPCERTCOUNT);
  }
  m_iCert--;

  hr = polGetCertificateLongProperty(
            pServer,
            wszPROPCRLINDEX,
            (LONG *) &m_iCRL);
  _LeaveIfErrorStr(
        hr,
        "Policy:polGetCertificateLongProperty",
        wszPROPCRLINDEX);

  _InitRevocationExtension(hkey);
  _InitRequestExtensionList(hkey);
  _InitDisableExtensionList(hkey);

  hr = S_OK;
    }
    __except(hr = ceHError(GetExceptionCode()), EXCEPTION_EXECUTE_HANDLER)
    {
  _PrintError(hr, "Exception");
    }

error:
    if (NULL != bstrDescription)
    {
        SysFreeString(bstrDescription);
    }
    if (NULL != hkey)
    {
  RegCloseKey(hkey);
    }
    if (NULL != pServer)
    {
  pServer->Release();
    }
    return(ceHError(hr)); // Reg routines return Win32 error codes
}

STDMETHOD() CCertPolicySample::ShutDown ( )
STDMETHOD() CCertPolicySample::ShutDown ( )
STDMETHODIMP CCertPolicySample::VerifyRequest | ( | BSTR const | strConfig,
 |  | LONG | Context,
 |  | LONG | bNewRequest,
 |  | LONG | Flags,
 |  | LONG __RPC_FAR * | pDisposition
 | ) |  |

Definition at line 2789 of file policy.cpp.

{
    HRESULT hr = E_FAIL;
    ICertServerPolicy *pServer = NULL;
    LONG lRequestId;
    CRequestInstance Request;
    BSTR strDisposition = NULL;
    BOOL fEnableEnrolleeExtensions;
    BOOL fReenroll = FALSE;
    DWORD cCriticalExtensions = 0;
    WCHAR const * const *apwszCriticalExtensions = NULL;

    lRequestId = 0;

    __try
    {
  if (NULL == pDisposition)
  {
      hr = E_POINTER;
      _LeaveError(hr, "Policy:pDisposition");
  }
  *pDisposition = VR_INSTANT_BAD;

  hr = polGetServerCallbackInterface(&pServer, Context);
  _LeaveIfError(hr, "Policy:polGetServerCallbackInterface");

  hr = GetRequestId(pServer, &lRequestId);
  _JumpIfError(hr, deny, "Policy:GetRequestId");

  // only need to check user access for original submitter:
  // resubmit can only be called by admins

  if (bNewRequest && (0 == (m_dwEditFlags & EDITF_IGNOREREQUESTERGROUP)))
  {
      BOOL fRequesterAccess = FALSE;

      // Is this user allowed to request certs?
      hr = polGetCertificateLongProperty(
            pServer,
            wszPROPREQUESTERCAACCESS,
            (LONG *) &fRequesterAccess);
      _PrintIfErrorStr(
      hr,
      "Policy:polGetCertificateLongProperty",
      wszPROPREQUESTERCAACCESS);
      if (hr != S_OK || !fRequesterAccess)
      {
    hr = CERTSRV_E_ENROLL_DENIED;
    _JumpError(hr, deny, "Policy:fRequesterAccess");
      }
  }

  hr = Request.Initialize(
          this,
          pServer,
          &fEnableEnrolleeExtensions);
  _LeaveIfError(hr, "Policy:VerifyRequest:Request.Initialize");

  hr = _EnumerateExtensions(
          pServer,
          bNewRequest,
          TRUE,
          fEnableEnrolleeExtensions,
          0,
          NULL);
  _LeaveIfError(hr, "_EnumerateExtensions");

  {
      hr = _AddDefaultBasicConstraintsExtension(
            pServer,
            Request.IsCARequest());
      _LeaveIfError(hr, "_AddDefaultBasicConstraintsExtension");

      hr = _AddDefaultKeyUsageExtension(pServer, Request.IsCARequest());
      _LeaveIfError(hr, "_AddDefaultKeyUsageExtension");

      hr = _AddEnhancedKeyUsageExtension(pServer);
      _LeaveIfError(hr, "_AddEnhancedKeyUsageExtension");
  }

  hr = _SetValidityPeriod(pServer);
  _LeaveIfError(hr, "_SetValidityPeriod");

  hr = EnumerateAttributes(pServer);
  _LeaveIfError(hr, "Policy:EnumerateAttributes");

  hr = _AddRevocationExtension(pServer);
  _LeaveIfError(hr, "_AddRevocationExtension");

  hr = _AddOldCertTypeExtension(pServer, Request.IsCARequest());
  _LeaveIfError(hr, "_AddOldCertTypeExtension");

  hr = _AddAuthorityKeyId(pServer);
  _LeaveIfError(hr, "_AddAuthorityKeyId");

  // pass hr as Disposition

  if ((EDITF_DISABLEEXTENSIONLIST & m_dwEditFlags) ||
      NULL != apwszCriticalExtensions)
  {
      hr = _EnumerateExtensions(
        pServer,
        bNewRequest,
        FALSE,
        FALSE,
        cCriticalExtensions,
        apwszCriticalExtensions);
      _LeaveIfError(hr, "_EnumerateExtensions");
  }

  if (bNewRequest &&
      (
       (REQDISP_PENDINGFIRST & m_dwDispositionFlags)))
  {
      *pDisposition = VR_PENDING;
  }
  else switch (REQDISP_MASK & m_dwDispositionFlags)
  {
      default:
      case REQDISP_PENDING:
    *pDisposition = VR_PENDING;
    break;

      case REQDISP_ISSUE:
    *pDisposition = VR_INSTANT_OK;
    break;

      case REQDISP_DENY:
    *pDisposition = VR_INSTANT_BAD;
    break;

      case REQDISP_USEREQUESTATTRIBUTE:
    *pDisposition = VR_INSTANT_OK;
    hr = polGetRequestAttribute(
            pServer,
            wszPROPDISPOSITION,
            &strDisposition);
    if (S_OK == hr)
    {
        if (0 == celstrcmpiL(strDisposition, wszPROPDISPOSITIONDENY))
        {
      *pDisposition = VR_INSTANT_BAD;
        }
        if (0 == celstrcmpiL(strDisposition, wszPROPDISPOSITIONPENDING))
        {
      *pDisposition = VR_PENDING;
        }
    }
    hr = S_OK;
    break;
  }
deny:
  if (FAILED(hr))
  {
      *pDisposition = hr; // pass failed HRESULT back as Disposition
  }
  else if (hr != S_OK)
  {
      *pDisposition = VR_INSTANT_BAD;
  }
  hr = S_OK;
    }
    __except(hr = ceHError(GetExceptionCode()), EXCEPTION_EXECUTE_HANDLER)
    {
  _PrintError(hr, "Exception");
    }

    {
  HRESULT hr2 = hr;
#define wszFORMATREQUESTID  L"RequestId=%u"
  WCHAR wszRequestId[ARRAYSIZE(wszFORMATREQUESTID) + cwcDWORDSPRINTF];

  if (S_OK == hr2 && NULL != pDisposition && FAILED(*pDisposition))
  {
      hr2 = *pDisposition;
  }
  if (S_OK != hr2)
  {
      wsprintf(wszRequestId, wszFORMATREQUESTID, lRequestId);
      _PrintErrorStr(hr2, "VerifyRequest", wszRequestId);
  }
    }
    if (NULL != strDisposition)
    {
  SysFreeString(strDisposition);
    }
    if (NULL != pServer)
    {
        pServer->Release();
    }
    //_PrintIfError(hr, "Policy:VerifyRequest(hr)");
    //_PrintError(*pDisposition, "Policy:VerifyRequest(*pDisposition)");
    return(hr);
}

STDMETHOD() CCertPolicySample::VerifyRequest | ( | BSTR const | strConfig,
 |  | LONG | Context,
 |  | LONG | bNewRequest,
 |  | LONG | Flags,
 |  | LONG __RPC_FAR * | pDisposition
 | ) |  |

Member Data Documentation

LPWSTR* CCertPolicySample::m_apstrCDPRevocationURL [protected]

Definition at line 251 of file Policy.h.

LPWSTR* CCertPolicySample::m_apstrDisableExtensions [protected]

Definition at line 268 of file Policy.h.

LPWSTR* CCertPolicySample::m_apstrEnableRequestExtensions [protected]

Definition at line 265 of file Policy.h.

LPWSTR* CCertPolicySample::m_apstrIssuerCertURL [protected]

Definition at line 262 of file Policy.h.

LPWSTR* CCertPolicySample::m_apwszDisableExtensions [private]

Definition at line 321 of file policy.h.

LPWSTR* CCertPolicySample::m_apwszEnableEnrolleeRequestExtensions [private]

Definition at line 318 of file policy.h.

LPWSTR* CCertPolicySample::m_apwszEnableRequestExtensions [private]

Definition at line 315 of file policy.h.

BSTR CCertPolicySample::m_astrSubjectAltNameObjectId[2] [protected]

Definition at line 273 of file Policy.h.

BSTR CCertPolicySample::m_astrSubjectAltNameProp[2] [protected]

Definition at line 272 of file Policy.h.

BSTR CCertPolicySample::m_bstrCAName [protected]

Definition at line 280 of file Policy.h.

BSTR CCertPolicySample::m_bstrCASanitizedDSName [protected]

Definition at line 283 of file Policy.h.

BSTR CCertPolicySample::m_bstrCASanitizedName [protected]

Definition at line 282 of file Policy.h.

BSTR CCertPolicySample::m_bstrDescription [protected]

Definition at line 247 of file Policy.h.

BSTR CCertPolicySample::m_bstrMachineDNSName [protected]

Definition at line 285 of file Policy.h.

DWORD CCertPolicySample::m_CAPathLength [private]

Definition at line 312 of file policy.h.

ENUM_CATYPES CCertPolicySample::m_CAType [private]

Definition at line 335 of file policy.h.

DWORD CCertPolicySample::m_cCDPRevocationURL [protected]

Definition at line 250 of file Policy.h.

DWORD CCertPolicySample::m_cDisableExtensions [private]

Definition at line 320 of file policy.h.

DWORD CCertPolicySample::m_cEnableEnrolleeRequestExtensions [private]

Definition at line 317 of file policy.h.

DWORD CCertPolicySample::m_cEnableRequestExtensions [private]

Definition at line 314 of file policy.h.

DWORD CCertPolicySample::m_CertType [protected]

Definition at line 277 of file Policy.h.

DWORD CCertPolicySample::m_cIssuerCertURL [protected]

Definition at line 261 of file Policy.h.

DWORD CCertPolicySample::m_dwDispositionFlags [private]

Definition at line 310 of file policy.h.

DWORD CCertPolicySample::m_dwEditFlags [private]

Definition at line 311 of file policy.h.

DWORD CCertPolicySample::m_dwIssuerCertURLFlags [protected]

Definition at line 260 of file Policy.h.

DWORD CCertPolicySample::m_dwRevocationFlags [private]

Definition at line 307 of file policy.h.

DWORD CCertPolicySample::m_hrLastUpdateResult [protected]

Definition at line 293 of file Policy.h.

DWORD CCertPolicySample::m_iCert [private]

Definition at line 337 of file policy.h.

DWORD CCertPolicySample::m_iCRL [private]

Definition at line 338 of file policy.h.

PCCERT_CONTEXT CCertPolicySample::m_pCert [protected]

Definition at line 245 of file Policy.h.

CERT_CONTEXT const* CCertPolicySample::m_pCert [private]

Definition at line 303 of file policy.h.

CRITICAL_SECTION CCertPolicySample::m_PolicyCriticalSection [protected]

Definition at line 287 of file Policy.h.

BSTR CCertPolicySample::m_strCAName [private]

Definition at line 326 of file policy.h.

BSTR CCertPolicySample::m_strCASanitizedDSName [private]

Definition at line 329 of file policy.h.

BSTR CCertPolicySample::m_strCASanitizedName [private]

Definition at line 328 of file policy.h.

BSTR CCertPolicySample::m_strDescription [private]

Definition at line 305 of file policy.h.

BSTR CCertPolicySample::m_strMachineDNSName [private]

Definition at line 331 of file policy.h.

BSTR CCertPolicySample::m_strRegStorageLoc [private]

Definition at line 325 of file policy.h.

LPWSTR CCertPolicySample::m_wszASPRevocationURL [private]

Definition at line 308 of file policy.h.

LPWSTR CCertPolicySample::m_wszRegStorageLoc [protected]

Definition at line 279 of file Policy.h.

The documentation for this class was generated from the following files:
  • Security/CertServices/Policy/C++/Windows.Net/policy.h
  • Security/CertServices/Policy/C++/Windows2000/Policy.h
  • Security/CertServices/Policy/C++/Windows.Net/policy.cpp
  • Security/CertServices/Policy/C++/Windows2000/Policy.Cpp
Generated on Wed Nov 13 2024 16:55:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CChannelNotify Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CChannelNotify Class Reference

#include "CChan.h"

Inherits RefCount, and CNotify.

List of all members.

Public Member Functions

CChannelNotify ()
~CChannelNotify ()
ULONG STDMETHODCALLTYPE | AddRef (void)
HRESULT STDMETHODCALLTYPE | Connect (IUnknown *pUnk)
HRESULT STDMETHODCALLTYPE | Disconnect (void)
HRESULT STDMETHODCALLTYPE | MemberChanged (NM_MEMBER_NOTIFY uNotify, INmMember *pMember)
HRESULT STDMETHODCALLTYPE | NmUI (CONFN uNotify)
HRESULT STDMETHODCALLTYPE | QueryInterface (REFIID riid, PVOID *ppvObj)
ULONG STDMETHODCALLTYPE | Release (void)

Detailed Description

Definition at line 21 of file CChan.h.

Constructor & Destructor Documentation

CChannelNotify::CChannelNotify ( )

Definition at line 298 of file CChan.Cpp.

                               : RefCount(), CNotify()
{
  OBJECT_MSG(TEXT("CChannelNotify created"));
}

CChannelNotify::~CChannelNotify ( )

Definition at line 303 of file CChan.Cpp.

{
  OBJECT_MSG(TEXT("CChannelNotify destroyed"));
}

Member Function Documentation

ULONG STDMETHODCALLTYPE CChannelNotify::AddRef ( void )

Definition at line 315 of file CChan.Cpp.

{
  return RefCount::AddRef();
}

HRESULT STDMETHODCALLTYPE CChannelNotify::Connect ( IUnknown * pUnk )

Definition at line 365 of file CChan.Cpp.

{
  return CNotify::Connect(pUnk, IID_INmChannelNotify, (IUnknown *)this);
}

HRESULT STDMETHODCALLTYPE CChannelNotify::Disconnect ( void )

Reimplemented from CNotify.

Definition at line 370 of file CChan.Cpp.

{
  return CNotify::Disconnect();
}

HRESULT STDMETHODCALLTYPE CChannelNotify::MemberChanged | ( | NM_MEMBER_NOTIFY | uNotify,
 |  | INmMember * | pMember
 | ) |  |

Definition at line 389 of file CChan.Cpp.

{
  if  (NULL == pMember)
  {
    WARN_MSG(TEXT("NULL == pMember"));
    return E_POINTER;
  }

  NOTIFY_MSG(TEXT("CChannelNotify::MemberChanged uNotify=%d pMember=%08X, pChannel=%08X"), uNotify, pMember, CNotify::GetPunk());
  PUSER pUser = PUserFromINmMember(pMember);

  if  (NULL == pUser)
  {
    WARN_MSG(TEXT("NULL == pUser"));
    return E_POINTER;
  }

  pMember->GetNmchCaps(&pUser->uchCaps);
  pMember->GetID(&pUser->uId);

  UpdateUserChannel(pUser, (INmChannel *) (CNotify::GetPunk()), uNotify);

  return S_OK;
}

HRESULT STDMETHODCALLTYPE CChannelNotify::NmUI ( CONFN uNotify )

Definition at line 382 of file CChan.Cpp.

{
  NOTIFY_MSG(TEXT("CChannelNotify::NmUI uNotify=%08X, pChannel=%08X"), uNotify, CNotify::GetPunk());
  return S_OK;
}

HRESULT STDMETHODCALLTYPE CChannelNotify::QueryInterface | ( | REFIID | riid,
 |  | PVOID * | ppvObj
 | ) |  |

Definition at line 326 of file CChan.Cpp.

{
  if  (NULL == ppvObject)
    return E_POINTER;

  HRESULT hr = NO_ERROR;

  if (riid == IID_IUnknown)
  {
    *ppvObject = (IUnknown *)this;
    OBJECT_MSG(TEXT("CChannelNotify::QueryInterface(): Returning IUnknown."));
  }
  else if (riid == IID_INmChannelNotify)
  {
    *ppvObject = (INmChannelNotify *)this;
    OBJECT_MSG(TEXT("CChannelNotify::QueryInterface(): Returning INmChannelNotify."));
  }
  else
  {
    hr = E_NOINTERFACE;
    *ppvObject = NULL;
    OBJECT_MSG(TEXT("CChannelNotify::QueryInterface(): Called on unknown interface."));
  }

  if SUCCEEDED(hr)
  {
    AddRef();
  }

  return hr;
}

ULONG STDMETHODCALLTYPE CChannelNotify::Release ( void )

Definition at line 321 of file CChan.Cpp.

{
  return RefCount::Release();
}

The documentation for this class was generated from the following files:
  • Web/NetMeeting/NMUI/CChan.h
  • Web/NetMeeting/NMUI/CChan.Cpp
Generated on Wed Nov 13 2024 16:55:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCharBlock Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CCharBlock Class Reference

#include "Grid.Hxx"

Inherited by CBlockFrame.

List of all members.

Public Member Functions

CCharBlock (UINT cCol, UINT cRow, UINT iBlockOffset, const CBlockFormat &bf)
UINT | Hittest (POINT pt, POINT ptTest)
void | Paint (CCanvas &canvas, RECT rc, POINT pt)
void | SetFont (HFONT font)
void | SetFormat (UINT fuFormat=HEXADECIMAL)

Protected Attributes

CCharGrid _Char
CCodeGrid _Code
CLineGrid _Line

Detailed Description

Definition at line 180 of file Grid.Hxx.

Constructor & Destructor Documentation

CCharBlock::CCharBlock | ( | UINT | cCol,
 |  | UINT | cRow,
 |  | UINT | iBlockOffset,
 |  | const CBlockFormat & | bf
 | ) |  |

Definition at line 288 of file Grid.Cxx.

                                                                                :
     _Line(cCol, cRow, bf._size),
     _Char(cCol, cRow, bf._size, iBlockOffset),
     _Code(cCol, cRow, bf._size, iBlockOffset)
{
     // LINE GRID
     _Line.SetStyle(PS_SOLID);

     // LARGE CHARACTER each cell
     _Char.SetFont(bf._fontChar);

     // CODE POINT label each cell
     _Code.SetTextOrg(bf._size.cx/2, 9*bf._size.cy/10);
     _Code.SetFont(bf._fontCode);
     _Code.SetFormat(HEXADECIMAL,4);
}

Member Function Documentation

UINT CCharBlock::Hittest | ( | POINT | pt,
 |  | POINT | ptTest
 | ) |  |

Definition at line 316 of file Grid.Cxx.

{
    return _Code.Hittest(pt, ptTest);
}

void CCharBlock::Paint | ( | CCanvas & | canvas,
 |  | RECT | rc,
 |  | POINT | pt
 | ) |  |

Reimplemented in CBlockFrame.

Definition at line 305 of file Grid.Cxx.

{
    _Line.Paint(canvas, rc, pt);
#ifdef UNICODE
    _Char.SetCharTable();
    _Code.SetCharTable();
#endif
    _Char.Paint(canvas, rc, pt);
    _Code.Paint(canvas, rc, pt);
}

void CCharBlock::SetFont ( HFONT font )

Definition at line 326 of file Grid.Cxx.

{
    _Char.SetFont(font);
}

void CCharBlock::SetFormat ( UINT fuFormat = HEXADECIMAL )

Definition at line 321 of file Grid.Cxx.

{
    _Code.SetFormat(fuFormat&DECIMAL,4);
}

Member Data Documentation

CCharGrid CCharBlock::_Char [protected]

Definition at line 191 of file Grid.Hxx.

CCodeGrid CCharBlock::_Code [protected]

Definition at line 192 of file Grid.Hxx.

CLineGrid CCharBlock::_Line [protected]

Definition at line 190 of file Grid.Hxx.

The documentation for this class was generated from the following files:
  • Multimedia/Gdi/Fonts/GridFont/Grid.Hxx
  • Multimedia/Gdi/Fonts/GridFont/Grid.Cxx
Generated on Wed Nov 13 2024 16:55:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCharGrid Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CCharGrid Class Reference

#include "Grid.Hxx"

Inherits CTextGrid.

List of all members.

Public Member Functions

CCharGrid (UINT cCol, UINT cRow, SIZE size, UINT iEltOffset=0)
virtual void DrawElement (CCanvas &canvas, COORD x, COORD y, UINT i, UINT j)

Detailed Description

Definition at line 110 of file Grid.Hxx.

Constructor & Destructor Documentation

CCharGrid::CCharGrid | ( | UINT | cCol,
 |  | UINT | cRow,
 |  | SIZE | size,
 |  | UINT | iEltOffset = 0
 | ) |  |

Definition at line 175 of file Grid.Cxx.

{
    _size  = size;
    _cCol  = cCol;
    _cRow  = cRow;
    _iEltOffset = iEltOffset;
    SetTextOrg();
}

Member Function Documentation

void CCharGrid::DrawElement | ( | CCanvas & | canvas,
 |  | COORD | x,
 |  | COORD | y,
 |  | UINT | i,
 |  | UINT | j |
 | ) |  |  | [virtual]

Implements CTextGrid.

Definition at line 186 of file Grid.Cxx.

{
  WORD iChar = _cRow*i+j+_iEltOffset;
#ifdef UNICODE
  static CCTypeSet Combining(0,0,C3_NONSPACING || C3_DIACRITIC || C3_VOWELMARK);
  static CCTypeSet Alpha(C1_ALPHA, 0, 0);
#endif

  if ( vpCSet && vpCSet->In(iChar) )
  {
      SetTextColor(canvas, RGB(128,0,128));
  }
    if (_pCharUsed == NULL || _pCharUsed[_cRow*i+j]) // if char exists draw it
  {
#ifdef UNICODE
    if( Combining.In(iChar) && !Alpha.In(iChar) )
    {
      TCHAR pch[2] = { iChar,0 };
      CFontSelect fs(canvas, _font);
      //SIZE size;
        //GetTextExtentPoint(canvas, pch, 2, &size);
      //canvas.Text(x, y, pch, 2 );
      canvas.Char(x+_size.cx/4/*+size.cx/2*/,y, iChar);

        // set up pen
        CBlackPen pen(canvas, PS_DOT, 0);
      CBrush brush(canvas);

      // draw dotted circle
      int r = 7*_size.cx/16;
      canvas.Circle(x, y-r/2, r);
    }
    else
    {
          canvas.Char(x, y, iChar);
    }
#else
    canvas.Char(x, y, (TCHAR)iChar);
#endif
  }
    SetTextColor(canvas, RGB(0,0,0));
}

The documentation for this class was generated from the following files:
  • Multimedia/Gdi/Fonts/GridFont/Grid.Hxx
  • Multimedia/Gdi/Fonts/GridFont/Grid.Cxx
Generated on Wed Nov 13 2024 16:55:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CChildView Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Protected Member Functions

CChildView Class Reference

#include "childview.h"

List of all members.

Public Member Functions

CChildView ()
virtual | ~CChildView ()
BOOL | UpdateDialogs (void)

Public Attributes

int | m_cChannels
SIZE | m_sizeInitPos

Protected Member Functions

afx_msg void | OnFileOpen ()
afx_msg void | OnFileSave ()
afx_msg void | OnMixerMerge ()
afx_msg void | OnMixerPlay ()
afx_msg void | OnMixerStop ()
afx_msg void | OnPaint ()
afx_msg void | OnSetfocusEditValidbits ()
afx_msg void | OnUpdateFileSave (CCmdUI *pCmdUI)
afx_msg void | OnUpdateMixerMerge (CCmdUI *pCmdUI)
afx_msg void | OnUpdateMixerPlay (CCmdUI *pCmdUI)
afx_msg void | OnUpdateMixerStop (CCmdUI *pCmdUI)
virtual BOOL | PreCreateWindow (CREATESTRUCT &cs)
virtual LRESULT | WindowProc (UINT message, WPARAM wParam, LPARAM lParam)

Detailed Description

Definition at line 23 of file childview.h.

Constructor & Destructor Documentation

CChildView::CChildView ( )

Definition at line 27 of file childview.cpp.

  : m_cChannels(0)
{
    m_sizeInitPos.cx = 100;
    m_sizeInitPos.cy = 40;

    g_pChildView = this;
}

CChildView::~CChildView ( ) [virtual]

Definition at line 36 of file childview.cpp.

{}

Member Function Documentation

void CChildView::OnFileOpen ( ) [protected]

Definition at line 96 of file childview.cpp.

{
    DWORD           dwThreadID  = 0;

    //
    // std file open dialog
    //
    CFileDialog dlg(    TRUE,
                        "*.wav",
                        NULL,
                        OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST,
                        "Wave Files (*.wav)|*.wav|All Files (*.*)|*.*||"
                   );
    if(IDOK != dlg.DoModal())
    {
        return;
    }

    //
    // parse the wave file
    //
    LPWAVEFORMATEX      pwfx  = 0;
    ULONG         cbData  = 0;
    HANDLE          hFile = INVALID_HANDLE_VALUE;

    ZeroMemory(&pwfx, sizeof(WAVEFORMATEX));

  hFile = WaveOpenFile(dlg.GetPathName(), &pwfx, &cbData);

  ASSERT( 0 != pwfx );

    if(IsValidHandle(hFile) && pwfx && cbData)
    {

        ULONG   cbRead;
        PVOID   pvData = LocalAlloc(LPTR, cbData);
    if( 0 == pvData )
    {
      MessageBox( "Insufficient memory to complete the task.", "MultiChan : Error", MB_OK | MB_ICONSTOP );
      return;
    }

        //
        // read the data into a buffer
        //
        if
        (
            pvData &&
            ReadFile
            (
                hFile,
                pvData,
                cbData,
                &cbRead,
                NULL
            )
        )
        {
            m_cChannels = ( int )g_listSources.GetCount();

            //
            // create a src dialog for each channel in the wave file
            //
            for(int c = 0; c < pwfx->nChannels; c++)
            {
                char    szTitle[MAX_PATH];
                DWORD   dwChanMsk = 0;

                CDlgSrc* pdlgSrcNew = new CDlgSrc(this);
                g_listSources.AddTail(pdlgSrcNew);

                //
                // find an unused speaker mask
                //

                //
                //  currently only 18 speaker positions are defined
                //  any channel above 18 will be assigned a non specified speaker
                //  it is the sole responsibility of the driver to deal with
                //  unspecified speaker masks
                //
                if(g_pdlgDest)
                {
                    for
          (
            dwChanMsk = SPEAKER_FRONT_LEFT;
                        dwChanMsk & g_pdlgDest->m_wfExt.dwChannelMask;
                        dwChanMsk <<= 1
          )
                            ;

                    if( SPEAKER_NOT_SPECIFIED != dwChanMsk )
                        g_pdlgDest->m_wfExt.dwChannelMask |= dwChanMsk;

                    //
                    //  g_pdlgDest->m_wfExt.dwChannelMask &= 0x7fffffff;
                    //
                }
                else
                {
                    if( c >= SPEAKERS_USED )
                    {
                        dwChanMsk = SPEAKER_NOT_SPECIFIED;
                    }
                    else
                    {
                        dwChanMsk = cdrSpeakers[c].dwConstant;
                    }
                }

                //
                // create the dialog
                //
                _snprintf(szTitle, MAX_PATH, "\"%s\" channel %d of %d", dlg.GetFileTitle(), c, pwfx->nChannels);
                pdlgSrcNew->Create(szTitle, m_sizeInitPos, dwChanMsk);

        //
                // pull the c-th channel of data out of this wave file
        //  also treat return codes
        //
                if( !pdlgSrcNew->AquireData(pwfx, pvData, cbData, c) )
        {
          MessageBox( "Only max 2 channel PCM formats are accepted as input.", "MultiChan : Error", MB_OK | MB_ICONSTOP );
          break;
        }

                //
                // the next dialog created should be cascaded
                //
                m_sizeInitPos.cx += 32;
                m_sizeInitPos.cy += 32;
            }

            //
            // make sure the src dialogs are consistent
            //
            UpdateDialogs();
        }

        SafeLocalFree(pvData);
    }

    SafeLocalFree(pwfx);
    SafeCloseHandle(hFile);
}

void CChildView::OnFileSave ( ) [protected]

Definition at line 243 of file childview.cpp.

{
    // std file open dialog
    CFileDialog dlg(FALSE, "*.wav", NULL, OFN_PATHMUSTEXIST, "Wave Files (*.wav)|*.wav|All Files (*.*)|*.*||");

    if(IDOK == dlg.DoModal())
    {
        WaveSaveFile(dlg.GetFileName(), (WAVEFORMATEX*)&g_pdlgDest->m_wfExt, g_pdlgDest->m_pbData, g_pdlgDest->m_cbData);
    }
}

void CChildView::OnMixerMerge ( ) [protected]

Definition at line 308 of file childview.cpp.

{
  g_pdlgDest->OnRemix();
}

void CChildView::OnMixerPlay ( ) [protected]

Definition at line 320 of file childview.cpp.

{
    g_pdlgDest->OnPlay();
}

void CChildView::OnMixerStop ( ) [protected]

Definition at line 332 of file childview.cpp.

{
    ASSERT( 0 );
}

void CChildView::OnPaint ( void ) [protected]

Definition at line 75 of file childview.cpp.

{
  CPaintDC dc(this); // device context for painting
}

void CChildView::OnSetfocusEditValidbits ( ) [protected]

Definition at line 342 of file childview.cpp.

{
  // TODO: Add your control notification handler code here
  ASSERT(0);
}

void CChildView::OnUpdateFileSave ( CCmdUI * pCmdUI ) [protected]

Definition at line 255 of file childview.cpp.

{
  pCmdUI->Enable(g_pdlgDest && g_pdlgDest->m_fPlayable);
}

void CChildView::OnUpdateMixerMerge ( CCmdUI * pCmdUI ) [protected]

Definition at line 314 of file childview.cpp.

{
  pCmdUI->Enable( (0 != g_pdlgDest) && (0 != g_listSources.GetHeadPosition()) );
}

void CChildView::OnUpdateMixerPlay ( CCmdUI * pCmdUI ) [protected]

Definition at line 326 of file childview.cpp.

{
  pCmdUI->Enable(g_pdlgDest && g_pdlgDest->m_fPlayable);
}

void CChildView::OnUpdateMixerStop ( CCmdUI * pCmdUI ) [protected]

Definition at line 338 of file childview.cpp.

{}

BOOL CChildView::PreCreateWindow ( CREATESTRUCT & cs ) [protected, virtual]

Definition at line 61 of file childview.cpp.

{
  if (!CWnd::PreCreateWindow(cs))
    return FALSE;

  cs.dwExStyle |= WS_EX_CLIENTEDGE;
  cs.style &= ~WS_BORDER;
  cs.lpszClass = AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS,
    ::LoadCursor(NULL, IDC_ARROW), HBRUSH(COLOR_APPWORKSPACE+1), NULL);

  return TRUE;
}

BOOL CChildView::UpdateDialogs ( void )

Definition at line 261 of file childview.cpp.

{
    //
    // set channel numbers for each SRC
    //
    ULONG       nChannel = 0;
    DWORD       dwBit;
    DWORD       dwChanMsk = 0;
    POSITION    pos;
    CDlgSrc*    pdlgSrc;

    // make a bitmask
    pos = g_listSources.GetHeadPosition();
    while(pos)
    {
        pdlgSrc = g_listSources.GetNext(pos);

        // bail if this seat is taken
        if( dwChanMsk & pdlgSrc->m_dwChannelMask & 0x7fffffff)
            return FALSE;

        dwChanMsk |= pdlgSrc->m_dwChannelMask;
    }

    // sort
    for(dwBit = SPEAKER_FRONT_LEFT; dwBit <= 0x80000000; dwBit <<= 1) //KSAUDIO_SPEAKER_TOP_REAR_RIGHT
    {
        pos = g_listSources.GetHeadPosition();
        while(pos)
        {
            pdlgSrc = g_listSources.GetNext(pos);
            if(pdlgSrc->m_dwChannelMask == dwBit)
                pdlgSrc->SetChannelNum(nChannel++);
        }

        // shift this again, and you get 0 => hangsville
        if(dwBit == 0x80000000)
            break;
    }

    // update the dest
    g_pdlgDest->Update();

    return TRUE;
}

LRESULT CChildView::WindowProc | ( | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]

Definition at line 349 of file childview.cpp.

{
    switch(message)
    {
        case WM_COMMAND:
            {
                if(wParam == IDC_EDIT_VALIDBITS)
                {
                    char sz[128];
                    _snprintf(sz, 128, "WM_COMMAND\n");
                    OutputDebugString(sz);
                }
                break;
            }

        case WM_CTLCOLOR:
            {
                if ( HIWORD(lParam) == IDC_EDIT_VALIDBITS)
                {
                    SetBkColor((HDC)wParam, RGB(128,128,128));
                    SetTextColor((HDC)wParam, RGB(255, 255, 255) );
                    return (LRESULT)GetStockObject(LTGRAY_BRUSH);
                }
                break;
            }
    }

  return CWnd ::WindowProc(message, wParam, lParam);
}

Member Data Documentation

int CChildView::m_cChannels

Definition at line 32 of file childview.h.

SIZE CChildView::m_sizeInitPos

Definition at line 31 of file childview.h.

The documentation for this class was generated from the following files:
  • Multimedia/Audio/multichan/childview.h
  • Multimedia/Audio/multichan/childview.cpp
Generated on Wed Nov 13 2024 16:55:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CClassFactory Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Attributes | Private Member Functions | Private Attributes

CClassFactory Class Reference

#include "clsfact.h"

List of all members.

Public Types

enum FACTORY_TYPE {
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1,
COMPONENTDATA = 0, ABOUT = 1, CONTEXTMENUX = 0, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, PROPERTYPAGEX = 0,
COMPONENTDATA = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
NAMESPACEEXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
TOOLBAREXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1
}
enum FACTORY_TYPE {
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1,
COMPONENTDATA = 0, ABOUT = 1, CONTEXTMENUX = 0, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, PROPERTYPAGEX = 0,
COMPONENTDATA = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
NAMESPACEEXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
TOOLBAREXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1
}
enum FACTORY_TYPE {
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1,
COMPONENTDATA = 0, ABOUT = 1, CONTEXTMENUX = 0, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, PROPERTYPAGEX = 0,
COMPONENTDATA = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
NAMESPACEEXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
TOOLBAREXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1
}
enum FACTORY_TYPE {
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1,
COMPONENTDATA = 0, ABOUT = 1, CONTEXTMENUX = 0, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, PROPERTYPAGEX = 0,
COMPONENTDATA = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
NAMESPACEEXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
TOOLBAREXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1
}
enum FACTORY_TYPE {
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1,
COMPONENTDATA = 0, ABOUT = 1, CONTEXTMENUX = 0, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, PROPERTYPAGEX = 0,
COMPONENTDATA = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
NAMESPACEEXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
TOOLBAREXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1
}
enum FACTORY_TYPE {
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1,
COMPONENTDATA = 0, ABOUT = 1, CONTEXTMENUX = 0, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, PROPERTYPAGEX = 0,
COMPONENTDATA = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
NAMESPACEEXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
TOOLBAREXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1
}
enum FACTORY_TYPE {
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1,
COMPONENTDATA = 0, ABOUT = 1, CONTEXTMENUX = 0, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, PROPERTYPAGEX = 0,
COMPONENTDATA = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
NAMESPACEEXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
TOOLBAREXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1
}
enum FACTORY_TYPE {
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1,
COMPONENTDATA = 0, ABOUT = 1, CONTEXTMENUX = 0, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, PROPERTYPAGEX = 0,
COMPONENTDATA = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
NAMESPACEEXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
TOOLBAREXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1
}
enum FACTORY_TYPE {
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1,
COMPONENTDATA = 0, ABOUT = 1, CONTEXTMENUX = 0, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, PROPERTYPAGEX = 0,
COMPONENTDATA = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
NAMESPACEEXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
TOOLBAREXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1
}
enum FACTORY_TYPE {
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1,
COMPONENTDATA = 0, ABOUT = 1, CONTEXTMENUX = 0, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, PROPERTYPAGEX = 0,
COMPONENTDATA = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
NAMESPACEEXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
TOOLBAREXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1
}
enum FACTORY_TYPE {
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1,
COMPONENTDATA = 0, ABOUT = 1, CONTEXTMENUX = 0, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, PROPERTYPAGEX = 0,
COMPONENTDATA = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
NAMESPACEEXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
TOOLBAREXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1
}
enum FACTORY_TYPE {
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1,
COMPONENTDATA = 0, ABOUT = 1, CONTEXTMENUX = 0, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, PROPERTYPAGEX = 0,
COMPONENTDATA = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
NAMESPACEEXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
TOOLBAREXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1
}
enum FACTORY_TYPE {
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1,
COMPONENTDATA = 0, ABOUT = 1, CONTEXTMENUX = 0, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, PROPERTYPAGEX = 0,
COMPONENTDATA = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
NAMESPACEEXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
TOOLBAREXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1
}
enum FACTORY_TYPE {
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1,
COMPONENTDATA = 0, ABOUT = 1, CONTEXTMENUX = 0, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, PROPERTYPAGEX = 0,
COMPONENTDATA = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
NAMESPACEEXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
TOOLBAREXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1
}
enum FACTORY_TYPE {
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1,
COMPONENTDATA = 0, ABOUT = 1, CONTEXTMENUX = 0, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, PROPERTYPAGEX = 0,
COMPONENTDATA = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
NAMESPACEEXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
TOOLBAREXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1
}
enum FACTORY_TYPE {
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1,
COMPONENTDATA = 0, ABOUT = 1, CONTEXTMENUX = 0, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, PROPERTYPAGEX = 0,
COMPONENTDATA = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
NAMESPACEEXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
TOOLBAREXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1
}
enum FACTORY_TYPE {
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1,
COMPONENTDATA = 0, ABOUT = 1, CONTEXTMENUX = 0, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, PROPERTYPAGEX = 0,
COMPONENTDATA = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
NAMESPACEEXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
TOOLBAREXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1
}
enum FACTORY_TYPE {
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1,
COMPONENTDATA = 0, ABOUT = 1, CONTEXTMENUX = 0, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, PROPERTYPAGEX = 0,
COMPONENTDATA = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
NAMESPACEEXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
TOOLBAREXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1
}
enum FACTORY_TYPE {
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1,
COMPONENTDATA = 0, ABOUT = 1, CONTEXTMENUX = 0, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, PROPERTYPAGEX = 0,
COMPONENTDATA = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
NAMESPACEEXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
TOOLBAREXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1
}
enum FACTORY_TYPE {
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1,
COMPONENTDATA = 0, ABOUT = 1, CONTEXTMENUX = 0, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, PROPERTYPAGEX = 0,
COMPONENTDATA = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
NAMESPACEEXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
TOOLBAREXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1
}
enum FACTORY_TYPE {
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1,
COMPONENTDATA = 0, ABOUT = 1, CONTEXTMENUX = 0, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, PROPERTYPAGEX = 0,
COMPONENTDATA = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
NAMESPACEEXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
TOOLBAREXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1
}
enum FACTORY_TYPE {
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1,
COMPONENTDATA = 0, ABOUT = 1, CONTEXTMENUX = 0, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, PROPERTYPAGEX = 0,
COMPONENTDATA = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
NAMESPACEEXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
TOOLBAREXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1
}
enum FACTORY_TYPE {
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1,
COMPONENTDATA = 0, ABOUT = 1, CONTEXTMENUX = 0, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, PROPERTYPAGEX = 0,
COMPONENTDATA = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
NAMESPACEEXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
TOOLBAREXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1
}
enum FACTORY_TYPE {
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1,
COMPONENTDATA = 0, ABOUT = 1, CONTEXTMENUX = 0, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, PROPERTYPAGEX = 0,
COMPONENTDATA = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
NAMESPACEEXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
TOOLBAREXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1
}
enum FACTORY_TYPE {
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1,
COMPONENTDATA = 0, ABOUT = 1, CONTEXTMENUX = 0, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, PROPERTYPAGEX = 0,
COMPONENTDATA = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
NAMESPACEEXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
TOOLBAREXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1
}
enum FACTORY_TYPE {
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1,
COMPONENTDATA = 0, ABOUT = 1, CONTEXTMENUX = 0, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, PROPERTYPAGEX = 0,
COMPONENTDATA = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
NAMESPACEEXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
TOOLBAREXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1
}
enum FACTORY_TYPE {
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1,
COMPONENTDATA = 0, ABOUT = 1, CONTEXTMENUX = 0, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, PROPERTYPAGEX = 0,
COMPONENTDATA = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
NAMESPACEEXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
TOOLBAREXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1
}
enum FACTORY_TYPE {
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1,
COMPONENTDATA = 0, ABOUT = 1, CONTEXTMENUX = 0, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, COMPONENTDATA = 0,
ABOUT = 1, COMPONENTDATA = 0, ABOUT = 1, PROPERTYPAGEX = 0,
COMPONENTDATA = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
NAMESPACEEXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, CONTEXTEXTENSION = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
TOOLBAREXTENSION = 0, ABOUT = 1, COMPONENT = 0, ABOUT = 1,
COMPONENT = 0, ABOUT = 1
}

Public Member Functions

CClassFactory ()
CClassFactory ()
CClassFactory ()
CClassFactory (FACTORY_TYPE factoryType)
CClassFactory (FACTORY_TYPE eFactoryType)
CClassFactory (FACTORY_TYPE factoryType)
CClassFactory (FACTORY_TYPE factoryType)
CClassFactory (FACTORY_TYPE factoryType)
CClassFactory (FACTORY_TYPE eFactoryType)
CClassFactory ()
CClassFactory (CLSID)
CClassFactory ()
CClassFactory (FACTORY_TYPE factoryType)
CClassFactory (FACTORY_TYPE eFactoryType)
CClassFactory ()
CClassFactory (FACTORY_TYPE eFactoryType)
CClassFactory ()
CClassFactory ()
CClassFactory ()
CClassFactory ()
CClassFactory (FACTORY_TYPE eFactoryType)
CClassFactory ()
CClassFactory (FACTORY_TYPE factoryType)
CClassFactory (FACTORY_TYPE eFactoryType)
CClassFactory (REFCLSID rclsid, HRESULT(*pfnCreateInstance)(IUnknown *pUnkOuter, REFIID riid, void **ppvObj))
CClassFactory (REFCLSID rclsid, HRESULT(*pfnCreateInstance)(IUnknown *pUnkOuter, REFIID riid, void **ppvObj))
CClassFactory (FACTORY_TYPE eFactoryType)
CClassFactory (REFCLSID clsid)
CClassFactory (FACTORY_TYPE factoryType)
CClassFactory (FACTORY_TYPE eFactoryType)
CClassFactory (FACTORY_TYPE factoryType)
CClassFactory ()
CClassFactory ()
CClassFactory ()
CClassFactory (FACTORY_TYPE factoryType)
CClassFactory (FACTORY_TYPE eFactoryType)
CClassFactory (FACTORY_TYPE factoryType)
CClassFactory (FACTORY_TYPE factoryType)
CClassFactory ()
CClassFactory (FACTORY_TYPE factoryType)
CClassFactory (FACTORY_TYPE factoryType)
CClassFactory (FACTORY_TYPE factoryType)
CClassFactory ()
CClassFactory (FACTORY_TYPE factoryType)
CClassFactory (FACTORY_TYPE factoryType)
CClassFactory (FACTORY_TYPE factoryType)
CClassFactory (FACTORY_TYPE factoryType)
CClassFactory ()
CClassFactory (FACTORY_TYPE factoryType)
~CClassFactory ()
~CClassFactory ()
~CClassFactory ()
~CClassFactory ()
~CClassFactory ()
~CClassFactory ()
~CClassFactory ()
~CClassFactory ()
virtual | ~CClassFactory ()
virtual | ~CClassFactory ()
~CClassFactory ()
~CClassFactory ()
~CClassFactory ()
~CClassFactory ()
~CClassFactory ()
~CClassFactory ()
~CClassFactory ()
~CClassFactory ()
~CClassFactory ()
~CClassFactory ()
~CClassFactory ()
~CClassFactory ()
~CClassFactory (void)
~CClassFactory ()
~CClassFactory ()
~CClassFactory ()
~CClassFactory ()
~CClassFactory ()
~CClassFactory ()
~CClassFactory ()
~CClassFactory ()
~CClassFactory ()
~CClassFactory ()
~CClassFactory ()
~CClassFactory ()
~CClassFactory ()
~CClassFactory ()
~CClassFactory ()
~CClassFactory ()
~CClassFactory ()
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, LPVOID *)
STDMETHODIMP | CreateInstance (LPUNKNOWN punkOuter, REFIID iid, void **ppv)
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, LPVOID *)
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, LPVOID FAR *)
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, LPVOID *)
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, LPVOID *)
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, LPVOID *)
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, LPVOID *)
STDMETHODIMP | CreateInstance (IUnknown *pUnknownOuter, REFIID iid, LPVOID *ppv)
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, LPVOID *)
STDMETHODIMP | CreateInstance (LPUNKNOWN pUnkOuter, REFIID riid, LPVOID *ppvObject)
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, LPVOID *)
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, LPVOID *)
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, LPVOID FAR *)
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, LPVOID *)
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, LPVOID *)
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, LPVOID *)
STDMETHODIMP | CreateInstance (LPUNKNOWN punkOuter, REFIID iid, void **ppv)
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, LPVOID *)
STDMETHODIMP | CreateInstance (IUnknown *pUnkOuter, REFIID riid, void **ppvObj)
STDMETHODIMP | CreateInstance (IUnknown *pUnkOuter, REFIID riid, void **ppvObj)
STDMETHOD() | CreateInstance (IUnknown FAR *punkOuter, REFIID riid, void FAR *FAR *ppv)
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, LPVOID *)
STDMETHODIMP | CreateInstance (LPUNKNOWN punkOuter, REFIID iid, void **ppv)
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, LPVOID *)
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, LPVOID *)
STDMETHODIMP | CreateInstance (LPUNKNOWN pUnkOuter, REFIID riid, LPVOID *ppvObject)
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, LPVOID *)
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, LPVOID *)
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, LPVOID *)
STDMETHODIMP | CreateInstance (LPUNKNOWN punkOuter, REFIID iid, void **ppv)
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, LPVOID *)
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, LPVOID *)
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, LPVOID *)
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, LPVOID *)
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, LPVOID *)
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, LPVOID *)
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, LPVOID *)
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, LPVOID *)
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, LPVOID *)
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, LPVOID *)
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, LPVOID *)
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, LPVOID FAR *)
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, LPVOID *)
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, LPVOID *)
STDMETHODIMP | CreateInstance (LPUNKNOWN punkOuter, REFIID iid, void **ppv)
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, LPVOID *)
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, LPVOID *)
STDMETHODIMP | LockServer (BOOL)
STDMETHODIMP | LockServer (BOOL)
STDMETHODIMP | LockServer (BOOL fLock)
STDMETHODIMP | LockServer (BOOL)
STDMETHODIMP | LockServer (BOOL)
STDMETHODIMP | LockServer (BOOL)
STDMETHODIMP | LockServer (BOOL fLock)
STDMETHODIMP | LockServer (BOOL)
STDMETHODIMP | LockServer (BOOL)
STDMETHODIMP | LockServer (BOOL)
STDMETHODIMP | LockServer (BOOL)
STDMETHODIMP | LockServer (BOOL)
STDMETHODIMP | LockServer (BOOL fLock)
STDMETHODIMP | LockServer (BOOL)
STDMETHODIMP | LockServer (BOOL bLock)
STDMETHODIMP | LockServer (BOOL fLock)
STDMETHODIMP | LockServer (BOOL)
STDMETHODIMP | LockServer (BOOL)
STDMETHODIMP | LockServer (BOOL)
STDMETHODIMP | LockServer (BOOL)
STDMETHODIMP | LockServer (BOOL)
STDMETHODIMP | LockServer (BOOL)
STDMETHODIMP | LockServer (BOOL)
STDMETHODIMP | LockServer (BOOL)
STDMETHODIMP | LockServer (BOOL fLock)
STDMETHODIMP | LockServer (BOOL)
STDMETHODIMP | LockServer (BOOL bLock)
STDMETHODIMP | LockServer (BOOL)
STDMETHODIMP | LockServer (BOOL)
STDMETHODIMP | LockServer (BOOL)
STDMETHODIMP | LockServer (BOOL)
STDMETHODIMP | LockServer (BOOL fLock)
STDMETHODIMP | LockServer (BOOL)
STDMETHODIMP | LockServer (BOOL)
STDMETHODIMP | LockServer (BOOL)
STDMETHOD() | LockServer (BOOL fLock)
STDMETHODIMP | LockServer (BOOL)
STDMETHODIMP | LockServer (BOOL)
STDMETHODIMP | LockServer (BOOL)
STDMETHODIMP | LockServer (BOOL)
STDMETHODIMP | LockServer (BOOL)
STDMETHODIMP | LockServer (BOOL)
STDMETHODIMP | LockServer (BOOL bLock)
STDMETHODIMP | LockServer (BOOL)
STDMETHODIMP | LockServer (BOOL)
STDMETHODIMP | LockServer (BOOL)
STDMETHODIMP | LockServer (BOOL fLock)
STDMETHODIMP | LockServer (BOOL)
STDMETHODIMP | QueryInterface (REFIID iid, void **ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppvObject)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, void **ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID, LPVOID *)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHOD() | QueryInterface (REFIID riid, LPVOID FAR *ppvObj)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID, LPVOID FAR *)
STDMETHODIMP | QueryInterface (REFIID riid, void **ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, void **ppvObj)
STDMETHODIMP | QueryInterface (REFIID, LPVOID *)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, void **ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID, LPVOID *)
STDMETHODIMP | QueryInterface (REFIID, LPVOID *)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppvObject)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, void **ppvObj)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, void **ppv)
STDMETHODIMP | QueryInterface (REFIID riid, void **ppv)
STDMETHODIMP | QueryInterface (REFIID, LPVOID FAR *)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID, LPVOID FAR *)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHOD_ (ULONG, Release)(void)
STDMETHOD_ (ULONG, AddRef)(void)
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (DWORD) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (DWORD) AddRef()
STDMETHODIMP_ (DWORD) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (DWORD) AddRef()
STDMETHODIMP_ (DWORD) AddRef()
STDMETHODIMP_ (DWORD) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (DWORD) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP_ (DWORD) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (DWORD) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (DWORD) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (DBREFCOUNT) Release(void)
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (DBREFCOUNT) AddRef(void)
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef(void)

Public Attributes

HRESULT(* | _pfnCreateInstance )(IUnknown *pUnkOuter, REFIID riid, void **ppvObj)
REFCLSID | _rclsid

Protected Attributes

CLSID m_clsid
DBREFCOUNT | m_cRef
long | m_lRef
DWORD m_ObjRefCount

Private Member Functions

STDMETHODIMP | CreateInstance (LPUNKNOWN punkOuter, REFIID iid, LPVOID FAR *ppv)
STDMETHODIMP | CreateInstance (LPUNKNOWN punkOuter, REFIID iid, LPVOID FAR *ppv)
STDMETHODIMP | CreateInstance (LPUNKNOWN punkOuter, REFIID iid, LPVOID FAR *ppv)
STDMETHODIMP | LockServer (BOOL fLock)
STDMETHODIMP | LockServer (BOOL fLock)
STDMETHODIMP | LockServer (BOOL fLock)
STDMETHODIMP | QueryInterface (REFIID iid, void **ppv)
STDMETHODIMP | QueryInterface (REFIID iid, void **ppv)
STDMETHODIMP | QueryInterface (REFIID iid, void **ppv)
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) AddRef(void)

Private Attributes

CLSID m_clsidObject
ULONG m_cRef
ULONG m_cref
LONG | m_cRef
FACTORY_TYPE m_factoryType
FACTORY_TYPE m_FactoryType
ULONG m_nRefCount
ULONG mcRef

Detailed Description

Definition at line 41 of file clsfact.h.

Member Enumeration Documentation

enum CClassFactory::FACTORY_TYPE
Enumerator:
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
CONTEXTMENUX
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
PROPERTYPAGEX
COMPONENTDATA
ABOUT
COMPONENT
ABOUT
NAMESPACEEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
TOOLBAREXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT

Definition at line 33 of file basesnap.h.

{COMPONENT = 0, ABOUT = 1};

enum CClassFactory::FACTORY_TYPE
Enumerator:
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
CONTEXTMENUX
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
PROPERTYPAGEX
COMPONENTDATA
ABOUT
COMPONENT
ABOUT
NAMESPACEEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
TOOLBAREXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT

Definition at line 33 of file basesnap.h.

{COMPONENT = 0, ABOUT = 1};

enum CClassFactory::FACTORY_TYPE
Enumerator:
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
CONTEXTMENUX
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
PROPERTYPAGEX
COMPONENTDATA
ABOUT
COMPONENT
ABOUT
NAMESPACEEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
TOOLBAREXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT

Definition at line 33 of file basesnap.h.

{COMPONENT = 0, ABOUT = 1};

enum CClassFactory::FACTORY_TYPE
Enumerator:
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
CONTEXTMENUX
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
PROPERTYPAGEX
COMPONENTDATA
ABOUT
COMPONENT
ABOUT
NAMESPACEEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
TOOLBAREXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT

Definition at line 34 of file basesnap.h.

{TOOLBAREXTENSION = 0, ABOUT = 1};

enum CClassFactory::FACTORY_TYPE
Enumerator:
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
CONTEXTMENUX
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
PROPERTYPAGEX
COMPONENTDATA
ABOUT
COMPONENT
ABOUT
NAMESPACEEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
TOOLBAREXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT

Definition at line 33 of file basesnap.h.

{COMPONENT = 0, ABOUT = 1};

enum CClassFactory::FACTORY_TYPE
Enumerator:
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
CONTEXTMENUX
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
PROPERTYPAGEX
COMPONENTDATA
ABOUT
COMPONENT
ABOUT
NAMESPACEEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
TOOLBAREXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT

Definition at line 33 of file basesnap.h.

{COMPONENT = 0, ABOUT = 1};

enum CClassFactory::FACTORY_TYPE
Enumerator:
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
CONTEXTMENUX
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
PROPERTYPAGEX
COMPONENTDATA
ABOUT
COMPONENT
ABOUT
NAMESPACEEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
TOOLBAREXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT

Definition at line 33 of file basesnap.h.

{CONTEXTEXTENSION = 0, ABOUT = 1};

enum CClassFactory::FACTORY_TYPE
Enumerator:
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
CONTEXTMENUX
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
PROPERTYPAGEX
COMPONENTDATA
ABOUT
COMPONENT
ABOUT
NAMESPACEEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
TOOLBAREXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT

Definition at line 33 of file basesnap.h.

{COMPONENT = 0, ABOUT = 1};

enum CClassFactory::FACTORY_TYPE
Enumerator:
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
CONTEXTMENUX
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
PROPERTYPAGEX
COMPONENTDATA
ABOUT
COMPONENT
ABOUT
NAMESPACEEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
TOOLBAREXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT

Definition at line 33 of file basesnap.h.

{COMPONENT = 0, ABOUT = 1};

enum CClassFactory::FACTORY_TYPE
Enumerator:
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
CONTEXTMENUX
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
PROPERTYPAGEX
COMPONENTDATA
ABOUT
COMPONENT
ABOUT
NAMESPACEEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
TOOLBAREXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT

Definition at line 33 of file basesnap.h.

{NAMESPACEEXTENSION = 0, ABOUT = 1};

enum CClassFactory::FACTORY_TYPE
Enumerator:
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
CONTEXTMENUX
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
PROPERTYPAGEX
COMPONENTDATA
ABOUT
COMPONENT
ABOUT
NAMESPACEEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
TOOLBAREXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT

Definition at line 33 of file basesnap.h.

{COMPONENT = 0, ABOUT = 1};

enum CClassFactory::FACTORY_TYPE
Enumerator:
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
CONTEXTMENUX
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
PROPERTYPAGEX
COMPONENTDATA
ABOUT
COMPONENT
ABOUT
NAMESPACEEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
TOOLBAREXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT

Definition at line 30 of file basesnap.h.

{COMPONENTDATA = 0, ABOUT = 1};

enum CClassFactory::FACTORY_TYPE
Enumerator:
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
CONTEXTMENUX
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
PROPERTYPAGEX
COMPONENTDATA
ABOUT
COMPONENT
ABOUT
NAMESPACEEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
TOOLBAREXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT

Definition at line 30 of file basesnap.h.

{PROPERTYPAGEX = 0};

enum CClassFactory::FACTORY_TYPE
Enumerator:
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
CONTEXTMENUX
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
PROPERTYPAGEX
COMPONENTDATA
ABOUT
COMPONENT
ABOUT
NAMESPACEEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
TOOLBAREXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT

Definition at line 30 of file basesnap.h.

{COMPONENTDATA = 0, ABOUT = 1};

enum CClassFactory::FACTORY_TYPE
Enumerator:
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
CONTEXTMENUX
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
PROPERTYPAGEX
COMPONENTDATA
ABOUT
COMPONENT
ABOUT
NAMESPACEEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
TOOLBAREXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT

Definition at line 30 of file basesnap.h.

{COMPONENTDATA = 0, ABOUT = 1};

enum CClassFactory::FACTORY_TYPE
Enumerator:
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
CONTEXTMENUX
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
PROPERTYPAGEX
COMPONENTDATA
ABOUT
COMPONENT
ABOUT
NAMESPACEEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
TOOLBAREXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT

Definition at line 30 of file basesnap.h.

{COMPONENTDATA = 0, ABOUT = 1};

enum CClassFactory::FACTORY_TYPE
Enumerator:
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
CONTEXTMENUX
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
PROPERTYPAGEX
COMPONENTDATA
ABOUT
COMPONENT
ABOUT
NAMESPACEEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
TOOLBAREXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT

Definition at line 30 of file basesnap.h.

{COMPONENTDATA = 0, ABOUT = 1};

enum CClassFactory::FACTORY_TYPE
Enumerator:
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
CONTEXTMENUX
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
PROPERTYPAGEX
COMPONENTDATA
ABOUT
COMPONENT
ABOUT
NAMESPACEEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
TOOLBAREXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT

Definition at line 30 of file basesnap.h.

{CONTEXTMENUX = 0};

enum CClassFactory::FACTORY_TYPE
Enumerator:
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
CONTEXTMENUX
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
PROPERTYPAGEX
COMPONENTDATA
ABOUT
COMPONENT
ABOUT
NAMESPACEEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
TOOLBAREXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT

Definition at line 30 of file basesnap.h.

{COMPONENTDATA = 0, ABOUT = 1};

enum CClassFactory::FACTORY_TYPE
Enumerator:
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
CONTEXTMENUX
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
PROPERTYPAGEX
COMPONENTDATA
ABOUT
COMPONENT
ABOUT
NAMESPACEEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
TOOLBAREXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT

Definition at line 33 of file basesnap.h.

{COMPONENTDATA = 0, ABOUT = 1};

enum CClassFactory::FACTORY_TYPE
Enumerator:
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
CONTEXTMENUX
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
PROPERTYPAGEX
COMPONENTDATA
ABOUT
COMPONENT
ABOUT
NAMESPACEEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
TOOLBAREXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT

Definition at line 33 of file basesnap.h.

{COMPONENT = 0, ABOUT = 1};

enum CClassFactory::FACTORY_TYPE
Enumerator:
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
CONTEXTMENUX
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
PROPERTYPAGEX
COMPONENTDATA
ABOUT
COMPONENT
ABOUT
NAMESPACEEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
TOOLBAREXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT

Definition at line 33 of file BaseSnap.h.

{COMPONENT = 0, ABOUT = 1};

enum CClassFactory::FACTORY_TYPE
Enumerator:
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
CONTEXTMENUX
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
PROPERTYPAGEX
COMPONENTDATA
ABOUT
COMPONENT
ABOUT
NAMESPACEEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
TOOLBAREXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT

Definition at line 33 of file basesnap.h.

{COMPONENT = 0, ABOUT = 1};

enum CClassFactory::FACTORY_TYPE
Enumerator:
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
CONTEXTMENUX
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
PROPERTYPAGEX
COMPONENTDATA
ABOUT
COMPONENT
ABOUT
NAMESPACEEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
TOOLBAREXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT

Definition at line 33 of file basesnap.h.

{COMPONENT = 0, ABOUT = 1};

enum CClassFactory::FACTORY_TYPE
Enumerator:
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
CONTEXTMENUX
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
PROPERTYPAGEX
COMPONENTDATA
ABOUT
COMPONENT
ABOUT
NAMESPACEEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
TOOLBAREXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT

Definition at line 33 of file basesnap.h.

{COMPONENT = 0, ABOUT = 1};

enum CClassFactory::FACTORY_TYPE
Enumerator:
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
CONTEXTMENUX
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
PROPERTYPAGEX
COMPONENTDATA
ABOUT
COMPONENT
ABOUT
NAMESPACEEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
TOOLBAREXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT

Definition at line 33 of file basesnap.h.

{CONTEXTEXTENSION = 0, ABOUT = 1};

enum CClassFactory::FACTORY_TYPE
Enumerator:
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
CONTEXTMENUX
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
PROPERTYPAGEX
COMPONENTDATA
ABOUT
COMPONENT
ABOUT
NAMESPACEEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
TOOLBAREXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT

Definition at line 33 of file basesnap.h.

{COMPONENT = 0, ABOUT = 1};

enum CClassFactory::FACTORY_TYPE
Enumerator:
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
CONTEXTMENUX
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
COMPONENTDATA
ABOUT
PROPERTYPAGEX
COMPONENTDATA
ABOUT
COMPONENT
ABOUT
NAMESPACEEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
CONTEXTEXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT
TOOLBAREXTENSION
ABOUT
COMPONENT
ABOUT
COMPONENT
ABOUT

Definition at line 33 of file basesnap.h.

{COMPONENT = 0, ABOUT = 1};

Constructor & Destructor Documentation

CClassFactory::CClassFactory ( )

Definition at line 44 of file clsfact.Cpp.

{
  OutputDebugString(TEXT("CClassFactory's constructor\n"));

  m_ObjRefCount = 0;
}

CClassFactory::~CClassFactory ( void )

Definition at line 57 of file clsfact.Cpp.

{
  OutputDebugString(TEXT("CClassFactory's destructor\n"));
}

CClassFactory::CClassFactory ( ) [inline]

Definition at line 32 of file Dogcf.h.

{    m_cRef = 0; InterlockedIncrement(&g_cObjects); }

CClassFactory::~CClassFactory ( void ) [inline]

Definition at line 33 of file Dogcf.h.

{    InterlockedDecrement(&g_cObjects); }

CClassFactory::CClassFactory ( ) [inline]

Definition at line 59 of file SServer.Cpp.

{ }

CClassFactory::CClassFactory ( ) [inline]

Definition at line 66 of file SServer.Cpp.

{ }

CClassFactory::CClassFactory ( ) [inline]

Definition at line 64 of file SServer.Cpp.

{ }

CClassFactory::CClassFactory ( ) [inline]

Definition at line 144 of file ComPerf.Cpp.

{ m_cRef = 1; }

CClassFactory::CClassFactory ( ) [inline]

Definition at line 101 of file OleImp.Cpp.

{ mcRef = 1; }

CClassFactory::CClassFactory ( ) [inline]

Definition at line 80 of file OleApt.Cpp.

{ mcRef = 1; }

CClassFactory::CClassFactory ( REFCLSID clsid )

Definition at line 224 of file classfac.cpp.

{
    m_cRef  = 0;
  m_clsid = clsid;

    // Increment global object count
    OBJECT_CONSTRUCTED();
}

CClassFactory::~CClassFactory ( void )
CClassFactory::CClassFactory ( )
CClassFactory::~CClassFactory ( )
CClassFactory::CClassFactory ( )
CClassFactory::~CClassFactory ( )
CClassFactory::CClassFactory ( FACTORY_TYPE factoryType )

Definition at line 86 of file basesnap.Cpp.

: m_cref(0), m_factoryType(factoryType)
{
    OBJECT_CREATED
}

CClassFactory::~CClassFactory ( )
CClassFactory::CClassFactory ( FACTORY_TYPE factoryType )
CClassFactory::~CClassFactory ( )
CClassFactory::CClassFactory ( FACTORY_TYPE factoryType )
CClassFactory::~CClassFactory ( )
CClassFactory::CClassFactory ( FACTORY_TYPE factoryType )
CClassFactory::~CClassFactory ( )
CClassFactory::CClassFactory ( FACTORY_TYPE factoryType )
CClassFactory::~CClassFactory ( )
CClassFactory::CClassFactory ( FACTORY_TYPE factoryType )
CClassFactory::~CClassFactory ( )
CClassFactory::CClassFactory ( FACTORY_TYPE factoryType )
CClassFactory::~CClassFactory ( )
CClassFactory::CClassFactory ( FACTORY_TYPE factoryType )
CClassFactory::~CClassFactory ( )
CClassFactory::CClassFactory ( FACTORY_TYPE factoryType )
CClassFactory::~CClassFactory ( )
CClassFactory::CClassFactory ( FACTORY_TYPE eFactoryType )
CClassFactory::~CClassFactory ( )
CClassFactory::CClassFactory ( FACTORY_TYPE eFactoryType )
CClassFactory::~CClassFactory ( )
CClassFactory::CClassFactory ( FACTORY_TYPE eFactoryType )
CClassFactory::~CClassFactory ( )
CClassFactory::CClassFactory ( FACTORY_TYPE eFactoryType )
CClassFactory::~CClassFactory ( )
CClassFactory::CClassFactory ( FACTORY_TYPE eFactoryType )
CClassFactory::~CClassFactory ( )
CClassFactory::CClassFactory ( FACTORY_TYPE eFactoryType )
CClassFactory::~CClassFactory ( )
CClassFactory::CClassFactory ( FACTORY_TYPE eFactoryType )
CClassFactory::~CClassFactory ( )
CClassFactory::CClassFactory ( FACTORY_TYPE eFactoryType )
CClassFactory::~CClassFactory ( )
CClassFactory::CClassFactory ( )
CClassFactory::~CClassFactory ( )
CClassFactory::CClassFactory ( FACTORY_TYPE eFactoryType )
CClassFactory::~CClassFactory ( )
CClassFactory::CClassFactory ( FACTORY_TYPE factoryType )
CClassFactory::~CClassFactory ( )
CClassFactory::CClassFactory ( FACTORY_TYPE factoryType )
CClassFactory::~CClassFactory ( )
CClassFactory::CClassFactory ( FACTORY_TYPE factoryType )
CClassFactory::~CClassFactory ( )
CClassFactory::CClassFactory ( FACTORY_TYPE factoryType )
CClassFactory::~CClassFactory ( )
CClassFactory::CClassFactory ( FACTORY_TYPE factoryType )
CClassFactory::~CClassFactory ( )
CClassFactory::CClassFactory ( FACTORY_TYPE factoryType )
CClassFactory::~CClassFactory ( )
CClassFactory::CClassFactory ( )
CClassFactory::~CClassFactory ( )
CClassFactory::CClassFactory ( FACTORY_TYPE factoryType )
CClassFactory::~CClassFactory ( )
CClassFactory::CClassFactory ( FACTORY_TYPE factoryType )
CClassFactory::~CClassFactory ( )
CClassFactory::CClassFactory ( FACTORY_TYPE factoryType )
CClassFactory::~CClassFactory ( )
CClassFactory::CClassFactory ( FACTORY_TYPE factoryType )
CClassFactory::~CClassFactory ( )
CClassFactory::CClassFactory ( ) [inline]

Definition at line 37 of file Factory.h.

: m_lRef(0) {}

CClassFactory::CClassFactory ( CLSID clsid )

Definition at line 44 of file ClsFact.Cpp.

{
m_clsidObject = clsid;
m_ObjRefCount = 1;
g_DllRefCount++;
}

CClassFactory::~CClassFactory ( )
CClassFactory::CClassFactory ( )
virtual CClassFactory::~CClassFactory ( ) [virtual]
CClassFactory::CClassFactory ( )
virtual CClassFactory::~CClassFactory ( ) [virtual]
CClassFactory::CClassFactory ( )
CClassFactory::~CClassFactory ( )
CClassFactory::CClassFactory ( )
CClassFactory::~CClassFactory ( )
CClassFactory::CClassFactory | ( | REFCLSID | rclsid,
 |  | HRESULT(*)(IUnknown *pUnkOuter, REFIID riid, void **ppvObj) | pfnCreateInstance |
 | ) |  |  | [inline]

Definition at line 68 of file server.cpp.

        : _rclsid(rclsid)
    {
        _pfnCreateInstance = pfnCreateInstance;
    }

CClassFactory::CClassFactory | ( | REFCLSID | rclsid,
 |  | HRESULT(*)(IUnknown *pUnkOuter, REFIID riid, void **ppvObj) | pfnCreateInstance |
 | ) |  |  | [inline]

Definition at line 70 of file server.cpp.

        : _rclsid(rclsid)
    {
        _pfnCreateInstance = pfnCreateInstance;
    }

Member Function Documentation

STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | pUnknown,
 |  | REFIID | riid,
 |  | LPVOID * | ppObject
 | ) |  |

Definition at line 129 of file clsfact.Cpp.

{
  OutputDebugString(TEXT("CClassFactory::CreateInstance\n"));

  *ppObject = NULL;

  if(pUnknown != NULL)
    return ResultFromScode(CLASS_E_NOAGGREGATION);

  COleDocument *pOleDoc = new COleDocument;
  if(NULL == pOleDoc)
    return ResultFromScode(E_OUTOFMEMORY);

  //get the QueryInterface return for our return value
  HRESULT hr = pOleDoc->QueryInterface(riid, ppObject);

  //return the result from QueryInterface
  return hr;
}

STDMETHODIMP CClassFactory::CreateInstance | ( | IUnknown FAR * | punkOuter,
 |  | REFIID | riid,
 |  | void FAR *FAR * | ppv
 | ) |  |

Definition at line 54 of file Dogcf.Cpp.

{
    extern HINSTANCE g_hInst;

    HRESULT hr;
    CDog * pDog;

    *ppv = NULL;

    // This implementation does not allow aggregation
    if (punkOuter)
        return ResultFromScode(CLASS_E_NOAGGREGATION);

    // Create an instance of the Dog object.
    pDog = new CDog;

    hr = pDog->QueryInterface(riid, ppv);
    if (FAILED(hr))
    {
        delete pDog;
        return hr;
    }
    return NOERROR;
}

STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | punkOuter,
 |  | REFIID | iid,
 |  | void ** | ppv
 | ) |  |
STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | punkOuter,
 |  | REFIID | iid,
 |  | LPVOID FAR * | ppv |
 | ) |  |  | [private]

Definition at line 177 of file icf.Cpp.

{
  HRESULT hErr;

  OutputDebugString("In CClassFactory::CreateInstance\r\n");

  // need to NULL the out parameter
  *ppvObject = NULL;

  // we don't support aggregation...
  if (pUnkOuter)
    {
    hErr = CLASS_E_NOAGGREGATION;
    goto error;
    }

  hErr = m_lpApp->m_lpDoc->CreateObject(riid, ppvObject);

error:
  return hErr;
};

STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | ,
 |  | REFIID | ,
 |  | LPVOID FAR * |
 | ) |  |
STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | ,
 |  | REFIID | ,
 |  | LPVOID * |
 | ) |  |
STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | ,
 |  | REFIID | ,
 |  | LPVOID * |
 | ) |  |
STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | ,
 |  | REFIID | ,
 |  | LPVOID * |
 | ) |  |
STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | ,
 |  | REFIID | ,
 |  | LPVOID * |
 | ) |  |
STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | punkOuter,
 |  | REFIID | iid,
 |  | LPVOID FAR * | ppv |
 | ) |  |  | [private]
STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | ,
 |  | REFIID | ,
 |  | LPVOID * |
 | ) |  |
STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | ,
 |  | REFIID | ,
 |  | LPVOID * |
 | ) |  |
STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | ,
 |  | REFIID | ,
 |  | LPVOID * |
 | ) |  |
STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | ,
 |  | REFIID | ,
 |  | LPVOID * |
 | ) |  |
STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | ,
 |  | REFIID | ,
 |  | LPVOID * |
 | ) |  |
STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | ,
 |  | REFIID | ,
 |  | LPVOID * |
 | ) |  |
STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | punkOuter,
 |  | REFIID | iid,
 |  | void ** | ppv
 | ) |  |
STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | ,
 |  | REFIID | ,
 |  | LPVOID * |
 | ) |  |
STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | ,
 |  | REFIID | ,
 |  | LPVOID * |
 | ) |  |
STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | ,
 |  | REFIID | ,
 |  | LPVOID * |
 | ) |  |
STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | ,
 |  | REFIID | ,
 |  | LPVOID * |
 | ) |  |
STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | ,
 |  | REFIID | ,
 |  | LPVOID * |
 | ) |  |
STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | ,
 |  | REFIID | ,
 |  | LPVOID * |
 | ) |  |
STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | ,
 |  | REFIID | ,
 |  | LPVOID * |
 | ) |  |
STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | ,
 |  | REFIID | ,
 |  | LPVOID * |
 | ) |  |
STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | ,
 |  | REFIID | ,
 |  | LPVOID * |
 | ) |  |
STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | punkOuter,
 |  | REFIID | iid,
 |  | void ** | ppv
 | ) |  |

Definition at line 257 of file SServer.Cpp.

{
  HRESULT hr = S_OK;
    *ppv = NULL;
  CSimpleObject *p;

    if (punkOuter != NULL)
        return CLASS_E_NOAGGREGATION;
  EnterCriticalSection(&g_cs);
  g_ConsoleData.y++;
  p = new CSimpleObject;
  LeaveCriticalSection(&g_cs);
    if (p == NULL)
        return E_OUTOFMEMORY;
  if (RPC_E_CALL_CANCELED == p->WasteTime(TEXT("Creating Object")))
  {
    p->Release();
    return hr;
  }
    hr = p->QueryInterface(riid, ppv);
  p->Release();
  return hr;
}  // CClassFactory::CreateInstance

STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | punkOuter,
 |  | REFIID | iid,
 |  | void ** | ppv
 | ) |  |
STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | punkOuter,
 |  | REFIID | iid,
 |  | LPVOID FAR * | ppv |
 | ) |  |  | [private]
STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | ,
 |  | REFIID | ,
 |  | LPVOID * |
 | ) |  |
STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | ,
 |  | REFIID | ,
 |  | LPVOID * |
 | ) |  |
STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | ,
 |  | REFIID | ,
 |  | LPVOID * |
 | ) |  |
STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | ,
 |  | REFIID | ,
 |  | LPVOID * |
 | ) |  |
STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | ,
 |  | REFIID | ,
 |  | LPVOID * |
 | ) |  |
STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | ,
 |  | REFIID | ,
 |  | LPVOID * |
 | ) |  |
STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | ,
 |  | REFIID | ,
 |  | LPVOID * |
 | ) |  |
STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | ,
 |  | REFIID | ,
 |  | LPVOID * |
 | ) |  |
STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | ,
 |  | REFIID | ,
 |  | LPVOID * |
 | ) |  |
STDMETHODIMP CClassFactory::CreateInstance | ( | IUnknown * | pUnknownOuter,
 |  | REFIID | iid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 86 of file Factory.Cpp.

{
  HRESULT hRes;
  CHiPerfProvider *pProvider = NULL;

  *ppv = NULL;

  // We do not support aggregation
  // =============================

  if (pUnknownOuter)
    return CLASS_E_NOAGGREGATION;

  // Create the provider object
  // ==========================

  pProvider = new CHiPerfProvider;

  if (!pProvider)
    return E_OUTOFMEMORY;

  // Retrieve the requested interface
  // ================================

  hRes = pProvider->QueryInterface(iid, ppv);
  if (FAILED(hRes))
  {
    delete pProvider;
    return hRes;
  }

  return S_OK;
}

STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | punkOuter,
 |  | REFIID | iid,
 |  | void ** | ppv
 | ) |  |
STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | ,
 |  | REFIID | ,
 |  | LPVOID FAR * |
 | ) |  |
STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | ,
 |  | REFIID | ,
 |  | LPVOID * |
 | ) |  |
STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | ,
 |  | REFIID | ,
 |  | LPVOID * |
 | ) |  |
STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | pUnkOuter,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObject
 | ) |  |
STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | ,
 |  | REFIID | ,
 |  | LPVOID * |
 | ) |  |
STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | pUnkOuter,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObject
 | ) |  |
STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | ,
 |  | REFIID | ,
 |  | LPVOID * |
 | ) |  |
STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | ,
 |  | REFIID | ,
 |  | LPVOID * |
 | ) |  |
STDMETHODIMP CClassFactory::CreateInstance | ( | LPUNKNOWN | ,
 |  | REFIID | ,
 |  | LPVOID FAR * |
 | ) |  |
STDAPI CClassFactory::CreateInstance | ( | IUnknown * | pUnkOuter,
 |  | REFIID | riid,
 |  | void ** | ppvObj
 | ) |  |

Definition at line 127 of file server.cpp.

{
    return _pfnCreateInstance(pUnkOuter, riid, ppvObj);
}

STDMETHODIMP CClassFactory::CreateInstance | ( | IUnknown * | pUnkOuter,
 |  | REFIID | riid,
 |  | void ** | ppvObj
 | ) |  |
STDMETHODIMP CClassFactory::LockServer ( BOOL )
STDMETHODIMP CClassFactory::LockServer ( BOOL )
STDMETHODIMP CClassFactory::LockServer ( BOOL )
STDMETHODIMP CClassFactory::LockServer ( BOOL fLock ) [private]
STDMETHODIMP CClassFactory::LockServer ( BOOL )
STDMETHODIMP CClassFactory::LockServer ( BOOL )
STDMETHODIMP CClassFactory::LockServer ( BOOL )
STDMETHODIMP CClassFactory::LockServer ( BOOL )
STDMETHODIMP CClassFactory::LockServer ( BOOL )
STDMETHODIMP CClassFactory::LockServer ( BOOL )
STDAPI CClassFactory::LockServer ( BOOL fLock )

Definition at line 157 of file clsfact.Cpp.

{
  OutputDebugString(TEXT("CClassFactory::LockServer - "));

  if(fLock)
  {
    OutputDebugString(TEXT("Lock\n"));
    g_DllRefCount++;
  }
  else
  {
    OutputDebugString(TEXT("Unlock\n"));
    g_DllRefCount--;
  }

  return S_OK;
}

STDMETHODIMP CClassFactory::LockServer ( BOOL )
STDMETHODIMP CClassFactory::LockServer ( BOOL )
STDMETHODIMP CClassFactory::LockServer ( BOOL fLock ) [private]
STDMETHODIMP CClassFactory::LockServer ( BOOL )
STDMETHODIMP CClassFactory::LockServer ( BOOL fLock ) [inline]

Definition at line 53 of file SServer.Cpp.

                                            {
    if (fLock)
      CoAddRefServerProcess();
    else
    {
      if (!CoReleaseServerProcess())
      {
        SetEvent(g_hEventDone);
      }
    }
    return S_OK;
  }

STDMETHODIMP CClassFactory::LockServer ( BOOL )
STDMETHODIMP CClassFactory::LockServer ( BOOL )
STDMETHODIMP CClassFactory::LockServer ( BOOL )
STDMETHOD() CClassFactory::LockServer ( BOOL fLock )
STDMETHODIMP CClassFactory::LockServer ( BOOL fLock ) [inline]

Definition at line 83 of file sserver.cpp.

{ return E_FAIL; };

STDMETHODIMP CClassFactory::LockServer ( BOOL )
STDMETHODIMP CClassFactory::LockServer ( BOOL )
STDMETHODIMP CClassFactory::LockServer ( BOOL )
STDMETHODIMP CClassFactory::LockServer ( BOOL )
STDMETHODIMP CClassFactory::LockServer ( BOOL )
STDMETHODIMP CClassFactory::LockServer ( BOOL )
STDMETHODIMP CClassFactory::LockServer ( BOOL fLock ) [inline]

Definition at line 51 of file SServer.Cpp.

                                            {
    if (fLock)
      CoAddRefServerProcess();
    else
    {
      if (!CoReleaseServerProcess())
      {
        PostThreadMessage(GetCurrentThreadId(), WM_QUIT, 0, 0);
      }
    }
    return S_OK;
  }

STDMETHODIMP CClassFactory::LockServer ( BOOL )
STDMETHODIMP CClassFactory::LockServer ( BOOL )
STDMETHODIMP CClassFactory::LockServer ( BOOL fLock ) [private]
STDMETHODIMP CClassFactory::LockServer ( BOOL )
STDMETHODIMP CClassFactory::LockServer ( BOOL )
STDMETHODIMP CClassFactory::LockServer ( BOOL )
STDMETHODIMP CClassFactory::LockServer ( BOOL )
STDMETHODIMP CClassFactory::LockServer ( BOOL )
STDMETHODIMP CClassFactory::LockServer ( BOOL )
STDMETHODIMP CClassFactory::LockServer ( BOOL bLock )
STDMETHODIMP CClassFactory::LockServer ( BOOL )
STDMETHODIMP CClassFactory::LockServer ( BOOL )
STDMETHODIMP CClassFactory::LockServer ( BOOL bLock )
STDMETHODIMP CClassFactory::LockServer ( BOOL bLock )
STDMETHODIMP CClassFactory::LockServer ( BOOL fLock ) [inline]

Definition at line 57 of file SServer.Cpp.

{ fLock ? InterlockedIncrement(&g_Count): InterlockedDecrement(&g_Count); return S_OK;}

STDMETHODIMP CClassFactory::LockServer ( BOOL )
STDMETHODIMP CClassFactory::LockServer ( BOOL )
STDMETHODIMP CClassFactory::LockServer ( BOOL )
STDMETHODIMP CClassFactory::LockServer ( BOOL )
STDMETHODIMP CClassFactory::LockServer ( BOOL fLock )
STDMETHODIMP CClassFactory::LockServer ( BOOL )
STDMETHODIMP CClassFactory::LockServer ( BOOL fLock )
STDMETHODIMP CClassFactory::LockServer ( BOOL fLock )
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppvObject
 | ) |  |
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | iid,
 |  | void ** | ppv |
 | ) |  |  | [private]
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppvObj
 | ) |  |
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | ,
 |  | LPVOID * |
 | ) |  |
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppv
 | ) |  |
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | iid,
 |  | void ** | ppv |
 | ) |  |  | [private]
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | ,
 |  | LPVOID FAR * |
 | ) |  |
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | ,
 |  | LPVOID FAR * |
 | ) |  |
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppReturn
 | ) |  |

Definition at line 68 of file clsfact.Cpp.

{
  OutputDebugString(TEXT("CClassFactory::QueryInterface\n"));

  if(IsEqualIID(riid, IID_IUnknown))
  {
    *ppReturn = (LPUNKNOWN)(LPCLASSFACTORY)this;
    m_ObjRefCount++;
    return ResultFromScode(S_OK);
  }

  if(IsEqualIID(riid, IID_IClassFactory))
  {
    *ppReturn = (LPCLASSFACTORY)this;
    m_ObjRefCount++;
    return ResultFromScode(S_OK);
  }

  *ppReturn = NULL;
  return ResultFromScode(E_NOINTERFACE);
}

STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppv
 | ) |  |
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | iid,
 |  | void ** | ppv |
 | ) |  |  | [private]
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppv
 | ) |  |
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | riid,
 |  | LPVOID FAR * | ppvObj
 | ) |  |

Definition at line 46 of file icf.Cpp.

{
  OutputDebugString("In CClassFactory::QueryInterface\r\n");

  SCODE sc = S_OK;

  if ( (riid == IID_IUnknown) ||
     (riid == IID_IClassFactory) )
    *ppvObj = this;
  else
    {
    *ppvObj = NULL;
    sc = E_NOINTERFACE;
    }

  if (*ppvObj)
    ((LPUNKNOWN)*ppvObj)->AddRef();

  // pass it on to the Application object
  return sc;
};

STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDAPI CClassFactory::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppv
 | ) |  |

Definition at line 238 of file SServer.Cpp.

{
    if (ppv == NULL)
        return E_INVALIDARG;
    if (riid == IID_IClassFactory || riid == IID_IUnknown)
        {
        *ppv = (IClassFactory *) this;
        AddRef();
        return S_OK;
        }
    *ppv = NULL;
    return E_NOINTERFACE;
}  // CClassFactory::QueryInterface

STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | ,
 |  | LPVOID FAR * |
 | ) |  |
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | iid,
 |  | void ** | ppv
 | ) |  |
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | ,
 |  | LPVOID * |
 | ) |  |
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppv
 | ) |  |
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppvObject
 | ) |  |
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | ,
 |  | LPVOID * |
 | ) |  |
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CClassFactory::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppvObj
 | ) |  |
CClassFactory::STDMETHOD_ | ( | ULONG | ,
 |  | AddRef |
 | ) |  |
CClassFactory::STDMETHOD_ | ( | ULONG | ,
 |  | Release |
 | ) |  |
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( DWORD )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG ) [inline]

Definition at line 139 of file ComPerf.Cpp.

{ return m_cRef++; }

CClassFactory::STDMETHODIMP_ ( ULONG ) [inline, private]

Definition at line 71 of file OleApt.Cpp.

{ if (--mcRef == 0) { delete this; return 0; } return mcRef; }

CClassFactory::STDMETHODIMP_ ( ULONG ) [inline]

Definition at line 47 of file SServer.Cpp.

{ return 1; }

CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( DWORD )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG ) [inline]

Definition at line 79 of file sserver.cpp.

{ return 1; }

CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG ) [inline, private]

Definition at line 70 of file OleApt.Cpp.

{ return mcRef++; }

CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG ) [inline]

Definition at line 52 of file SServer.Cpp.

{ return 2; };

CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG ) [inline, private]

Definition at line 94 of file secSvr.Cpp.

{ return 1; }

CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG ) [inline, private]

Definition at line 93 of file secSvr.Cpp.

{ return 1; }

CClassFactory::STDMETHODIMP_ ( DWORD )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( DWORD )
CClassFactory::STDMETHODIMP_ ( ULONG ) [inline, private]

Definition at line 92 of file OleImp.Cpp.

{ if (--mcRef == 0) { delete this; return 0; } return mcRef; }

CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( DWORD )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( DWORD )
CClassFactory::STDMETHODIMP_ ( ULONG ) [inline]

Definition at line 78 of file sserver.cpp.

{ return 1; };

CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG ) [inline]

Definition at line 53 of file SServer.Cpp.

{ return 1; }

CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( DWORD )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG ) [inline]

Definition at line 49 of file SServer.Cpp.

{ return 1; }

CClassFactory::STDMETHODIMP_ ( DWORD )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( DBREFCOUNT )
CClassFactory::STDMETHODIMP_ ( DWORD )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( DBREFCOUNT )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG ) [inline, private]

Definition at line 91 of file OleImp.Cpp.

{ return mcRef++; }

CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG ) [inline]

Definition at line 140 of file ComPerf.Cpp.

{ if (--m_cRef == 0){ delete this; return 0; } return m_cRef;}

CClassFactory::STDMETHODIMP_ ( DWORD )
CClassFactory::STDMETHODIMP_ ( ULONG )
CClassFactory::STDMETHODIMP_ ( ULONG ) [inline]

Definition at line 48 of file SServer.Cpp.

{ return 2; };

CClassFactory::STDMETHODIMP_ ( ULONG ) [inline]

Definition at line 46 of file SServer.Cpp.

{ return 2; };

CClassFactory::STDMETHODIMP_ ( ULONG )

Member Data Documentation

HRESULT(* CClassFactory::_pfnCreateInstance)(IUnknown *pUnkOuter, REFIID riid, void **ppvObj)

Definition at line 76 of file server.cpp.

REFCLSID CClassFactory::_rclsid

Definition at line 75 of file server.cpp.

CLSID CClassFactory::m_clsid [protected]

Definition at line 27 of file classfac.h.

CLSID CClassFactory::m_clsidObject [private]

Definition at line 53 of file ClsFact.h.

DBREFCOUNT CClassFactory::m_cRef [protected]

Definition at line 26 of file classfac.h.

ULONG CClassFactory::m_cRef [private]

Definition at line 146 of file ComPerf.Cpp.

ULONG CClassFactory::m_cRef [private]

Definition at line 36 of file Dogcf.h.

ULONG CClassFactory::m_cref [private]

Definition at line 30 of file basesnap.h.

FACTORY_TYPE CClassFactory::m_factoryType [private]

Definition at line 46 of file basesnap.h.

FACTORY_TYPE CClassFactory::m_FactoryType [private]

Definition at line 48 of file basesnap.h.

long CClassFactory::m_lRef [protected]

Definition at line 34 of file Factory.h.

ULONG CClassFactory::m_nRefCount [private]

Definition at line 39 of file ClassFactory.h.

DWORD CClassFactory::m_ObjRefCount [protected]

Definition at line 44 of file clsfact.h.

ULONG CClassFactory::mcRef [private]

Definition at line 97 of file OleImp.Cpp.

The documentation for this class was generated from the following files:
  • Com/Fundamentals/ActiveDocument/DoServer/clsfact.h
  • SysMgmt/MMC/About/basesnap.h
  • SysMgmt/MMC/ActiveX/basesnap.h
  • SysMgmt/MMC/CMenu/basesnap.h
  • SysMgmt/MMC/CMenuExt/basesnap.h
  • SysMgmt/MMC/Complete/basesnap.h
  • SysMgmt/MMC/CutCopy/basesnap.h
  • SysMgmt/MMC/Extens/basesnap.h
  • SysMgmt/MMC/Help/BaseSnap.h
  • SysMgmt/MMC/Menubtn/basesnap.h
  • SysMgmt/MMC/mmc2.0/about/basesnap.h
  • SysMgmt/MMC/mmc2.0/contextmenu/basesnap.h
  • SysMgmt/MMC/mmc2.0/contextmenuex/basesnap.h
  • SysMgmt/MMC/mmc2.0/dragdrop/basesnap.h
  • SysMgmt/MMC/mmc2.0/help/basesnap.h
  • SysMgmt/MMC/mmc2.0/multisel/basesnap.h
  • SysMgmt/MMC/mmc2.0/proppage/basesnap.h
  • SysMgmt/MMC/mmc2.0/proppagex/basesnap.h
  • SysMgmt/MMC/mmc2.0/viewex/basesnap.h
  • SysMgmt/MMC/Multisel/basesnap.h
  • SysMgmt/MMC/Nameext/basesnap.h
  • SysMgmt/MMC/Nodes/basesnap.h
  • SysMgmt/MMC/Openserv/basesnap.h
  • SysMgmt/MMC/Ppgeext/basesnap.h
  • SysMgmt/MMC/Proppage/basesnap.h
  • SysMgmt/MMC/Taskpads/basesnap.h
  • SysMgmt/MMC/Tbarext/basesnap.h
  • SysMgmt/MMC/Toolbar/basesnap.h
  • SysMgmt/MMC/WMI/basesnap.h
  • Com/Fundamentals/CustomSurrogate/Dog/Dogcf.h
  • Com/Fundamentals/DCom/ComPerf/ComPerf.Cpp
  • Com/Fundamentals/DCom/OleImp/OleImp.Cpp
  • Com/Fundamentals/OleApt/OleApt.Cpp
  • Dataaccess/oledb/sampprov/classfac.h
  • NetDS/ADSI/samples/activedir/adevent/adevent.h
  • NetDS/SyncMgr/SyncDir/Cfact.h
  • SysMgmt/MMC/mmc2.0/simple/basesnap.h
  • SysMgmt/MMC/Simple/basesnap.h
  • SysMgmt/WMI/VC/HiPerfProvider/Factory.h
  • WinUI/Shell/BandObjs/ClsFact.h
  • WinUI/Shell/ColumnProvider/ClassFactory.h
  • WinUI/Shell/DiskCleanupHandler/ClassFactory.h
  • WinUI/Shell/SampView/ClsFact.h
  • WinUI/Shell/ShellIconOverlay/IcnOvrly.h
  • WinUI/TSFcase/server.cpp
  • WinUI/TSFmark/server.cpp
  • Com/Fundamentals/DCom/Cancel/InProc/SServer.Cpp
  • Com/Fundamentals/DCom/Cancel/Local/Mta/SServer.Cpp
  • Com/Fundamentals/DCom/Cancel/Local/Sta/SServer.Cpp
  • Com/Fundamentals/DCom/Secure/secSvr.Cpp
  • Com/Fundamentals/DCom/Simple/sserver/sserver.cpp
  • Com/Fundamentals/ActiveDocument/DoServer/clsfact.Cpp
  • Com/Fundamentals/CustomSurrogate/Dog/Dogcf.Cpp
  • Com/Fundamentals/SimpSvr/icf.Cpp
  • Com/Fundamentals/SimpSvr/icf.h
  • Dataaccess/oledb/sampprov/classfac.cpp
  • NetDS/ADSI/samples/activedir/adevent/ADEvent.cpp
  • NetDS/SyncMgr/SyncDir/Cfact.Cpp
  • SysMgmt/MMC/About/basesnap.Cpp
  • SysMgmt/MMC/ActiveX/basesnap.Cpp
  • SysMgmt/MMC/CMenu/basesnap.Cpp
  • SysMgmt/MMC/CMenuExt/basesnap.Cpp
  • SysMgmt/MMC/Complete/basesnap.Cpp
  • SysMgmt/MMC/CutCopy/basesnap.Cpp
  • SysMgmt/MMC/Extens/basesnap.Cpp
  • SysMgmt/MMC/Help/BaseSnap.Cpp
  • SysMgmt/MMC/Menubtn/basesnap.Cpp
  • SysMgmt/MMC/mmc2.0/about/basesnap.cpp
  • SysMgmt/MMC/mmc2.0/contextmenu/basesnap.cpp
  • SysMgmt/MMC/mmc2.0/contextmenuex/basesnap.cpp
  • SysMgmt/MMC/mmc2.0/dragdrop/basesnap.cpp
  • SysMgmt/MMC/mmc2.0/help/basesnap.cpp
  • SysMgmt/MMC/mmc2.0/multisel/basesnap.cpp
  • SysMgmt/MMC/mmc2.0/proppage/basesnap.cpp
  • SysMgmt/MMC/mmc2.0/proppagex/basesnap.cpp
  • SysMgmt/MMC/mmc2.0/simple/basesnap.cpp
  • SysMgmt/MMC/mmc2.0/viewex/basesnap.cpp
  • SysMgmt/MMC/Multisel/basesnap.Cpp
  • SysMgmt/MMC/Nameext/basesnap.Cpp
  • SysMgmt/MMC/Nodes/basesnap.Cpp
  • SysMgmt/MMC/Openserv/basesnap.Cpp
  • SysMgmt/MMC/Ppgeext/basesnap.Cpp
  • SysMgmt/MMC/Proppage/basesnap.Cpp
  • SysMgmt/MMC/Simple/basesnap.Cpp
  • SysMgmt/MMC/Taskpads/basesnap.Cpp
  • SysMgmt/MMC/Tbarext/basesnap.Cpp
  • SysMgmt/MMC/Toolbar/basesnap.Cpp
  • SysMgmt/MMC/WMI/basesnap.Cpp
  • SysMgmt/WMI/VC/HiPerfProvider/Factory.Cpp
  • WinUI/Shell/BandObjs/ClsFact.Cpp
  • WinUI/Shell/ColumnProvider/ClassFactory.Cpp
  • WinUI/Shell/DiskCleanupHandler/ClassFactory.Cpp
  • WinUI/Shell/SampView/ClsFact.Cpp
  • WinUI/Shell/ShellIconOverlay/IcnOvrly.Cpp
Generated on Wed Nov 13 2024 16:55:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CClassFactoryWrapper Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes | Friends

CClassFactoryWrapper Class Reference

#include "cfWrap.h"

List of all members.

Public Member Functions

CClassFactoryWrapper (REFCLSID rclsid)
virtual | ~CClassFactoryWrapper ()
STDMETHOD() | CreateInstance (IUnknown *pUnkOuter, REFIID iid, void **ppv)
STDMETHOD() | DisconnectObject (DWORD dwReserved)
STDMETHOD() | GetMarshalSizeMax (REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlflags, DWORD *pSize)
STDMETHOD() | GetUnmarshalClass (REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlflags, CLSID *pCid)
STDMETHOD() | LockServer (BOOL fLock)
STDMETHOD() | MarshalInterface (IStream *pStm, REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlflags)
STDMETHOD() | QueryInterface (REFIID iid, LPVOID *ppv)
STDMETHOD() | ReleaseMarshalData (IStream *pStm)
STDMETHOD_ (ULONG, AddRef)()
STDMETHOD_ (ULONG, Release)()
STDMETHOD() | UnmarshalInterface (IStream *pStm, REFIID riid, void **ppv)

Private Attributes

CLSID m_clsid
LONG | m_cRef
DWORD m_dwReg

Friends

class | CSurrogate

Detailed Description

Definition at line 18 of file cfWrap.h.

Constructor & Destructor Documentation

CClassFactoryWrapper::CClassFactoryWrapper ( REFCLSID rclsid )

Definition at line 38 of file cfWrap.Cpp.

                                                          : m_cRef(0)
{
  m_clsid = rclsid;
}

CClassFactoryWrapper::~CClassFactoryWrapper ( ) [virtual]

Definition at line 43 of file cfWrap.Cpp.

{}

Member Function Documentation

STDMETHODIMP CClassFactoryWrapper::CreateInstance | ( | IUnknown * | pUnkOuter,
 |  | REFIID | iid,
 |  | void ** | ppv
 | ) |  |

Definition at line 80 of file cfWrap.Cpp.

{
  OutputDebugString("Creating Inproc Object...");
  return CoCreateInstance(m_clsid, pUnkOuter, CLSCTX_INPROC_SERVER, riid, ppv);
}

STDMETHODIMP CClassFactoryWrapper::DisconnectObject ( DWORD dwReserved )

Definition at line 170 of file cfWrap.Cpp.

{
  return S_OK;
}

STDMETHODIMP CClassFactoryWrapper::GetMarshalSizeMax | ( | REFIID | riid,
 |  | void * | pv,
 |  | DWORD | dwDestContext,
 |  | void * | pvDestContext,
 |  | DWORD | mshlflags,
 |  | DWORD * | pSize
 | ) |  |

Definition at line 114 of file cfWrap.Cpp.

{
  return E_UNEXPECTED;
}

STDMETHODIMP CClassFactoryWrapper::GetUnmarshalClass | ( | REFIID | riid,
 |  | void * | pv,
 |  | DWORD | dwDestContext,
 |  | void * | pvDestContext,
 |  | DWORD | mshlflags,
 |  | CLSID * | pCid
 | ) |  |

Definition at line 103 of file cfWrap.Cpp.

{
  OutputDebugString("IMarshal::GetUnmarshalClass() returning CLSID_StdMarshal.");
  *pCid = CLSID_StdMarshal;
  return S_OK;
}

STDMETHODIMP CClassFactoryWrapper::LockServer ( BOOL fLock )

Definition at line 89 of file cfWrap.Cpp.

{
  return S_OK;
}

STDMETHODIMP CClassFactoryWrapper::MarshalInterface | ( | IStream * | pStm,
 |  | REFIID | riid,
 |  | void * | pv,
 |  | DWORD | dwDestContext,
 |  | void * | pvDestContext,
 |  | DWORD | mshlflags
 | ) |  |

Definition at line 127 of file cfWrap.Cpp.

{
  // return a marshaled interface pointer to the inproc
  // object's class factory object. marshal into the stream pStm

  OutputDebugString("IMarshal::MarhsalInterface() called.");
  IUnknown *pUnk = 0;
  HRESULT hr = CoGetClassObject(m_clsid, CLSCTX_INPROC_SERVER, 0, IID_IUnknown,
                  (LPVOID*) &pUnk);

  if (SUCCEEDED(hr))
  {
    // marshal the class factory object pUnk using the standard marshaler
    hr = CoMarshalInterface(pStm, riid, pUnk, dwDstCtx, pvDstCtx, flags);
    pUnk->Release();
  }
  return hr;
}

STDMETHOD() CClassFactoryWrapper::QueryInterface | ( | REFIID | iid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CClassFactoryWrapper::ReleaseMarshalData ( IStream * pStm )

Definition at line 161 of file cfWrap.Cpp.

{
  OutputDebugString("IMarshal::ReleaseMarshalData() called.");
  return CoReleaseMarshalData(pStm);
}

CClassFactoryWrapper::STDMETHOD_ | ( | ULONG | ,
 |  | AddRef |
 | ) |  |
CClassFactoryWrapper::STDMETHOD_ | ( | ULONG | ,
 |  | Release |
 | ) |  |
STDMETHODIMP CClassFactoryWrapper::UnmarshalInterface | ( | IStream * | pStm,
 |  | REFIID | riid,
 |  | void ** | ppv
 | ) |  |

Definition at line 150 of file cfWrap.Cpp.

{
  return E_UNEXPECTED;
}

Friends And Related Function Documentation

friend class CSurrogate [friend]

Definition at line 47 of file cfWrap.h.

Member Data Documentation

CLSID CClassFactoryWrapper::m_clsid [private]

Definition at line 21 of file cfWrap.h.

LONG CClassFactoryWrapper::m_cRef [private]

Definition at line 20 of file cfWrap.h.

DWORD CClassFactoryWrapper::m_dwReg [private]

Definition at line 22 of file cfWrap.h.

The documentation for this class was generated from the following files:
  • Com/Fundamentals/CustomSurrogate/Surrog/cfWrap.h
  • Com/Fundamentals/CustomSurrogate/Surrog/cfWrap.Cpp
Generated on Wed Nov 13 2024 16:55:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CClassPro Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CClassPro Class Reference

#include "Sample.h"

List of all members.

Public Member Functions

CClassPro (BSTR ObjectPath=NULL, BSTR User=NULL, BSTR Password=NULL, IWbemContext *pCtx=NULL)
~CClassPro (void)
HRESULT STDMETHODCALLTYPE | CancelAsyncCall (IWbemObjectSink __RPC_FAR *pSink)
HRESULT STDMETHODCALLTYPE | CreateClassEnum (const BSTR Superclass, long lFlags, IWbemContext __RPC_FAR *pCtx, IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum)
HRESULT STDMETHODCALLTYPE | CreateClassEnumAsync (const BSTR Superclass, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemObjectSink __RPC_FAR *pResponseHandler)
HRESULT STDMETHODCALLTYPE | CreateInstanceEnum (const BSTR Class, long lFlags, IWbemContext __RPC_FAR *pCtx, IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum)
HRESULT STDMETHODCALLTYPE | CreateInstanceEnumAsync (const BSTR Class, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemObjectSink __RPC_FAR *pResponseHandler)
HRESULT STDMETHODCALLTYPE | DeleteClass (const BSTR Class, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult)
HRESULT STDMETHODCALLTYPE | DeleteClassAsync (const BSTR Class, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemObjectSink __RPC_FAR *pResponseHandler)
HRESULT STDMETHODCALLTYPE | DeleteInstance (const BSTR ObjectPath, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult)
HRESULT STDMETHODCALLTYPE | DeleteInstanceAsync (const BSTR ObjectPath, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemObjectSink __RPC_FAR *pResponseHandler)
HRESULT STDMETHODCALLTYPE | ExecMethod (const BSTR, const BSTR, long, IWbemContext *, IWbemClassObject *, IWbemClassObject **, IWbemCallResult **)
HRESULT STDMETHODCALLTYPE | ExecMethodAsync (const BSTR, const BSTR, long, IWbemContext *, IWbemClassObject *, IWbemObjectSink *)
HRESULT STDMETHODCALLTYPE | ExecNotificationQuery (const BSTR QueryLanguage, const BSTR Query, long lFlags, IWbemContext __RPC_FAR *pCtx, IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum)
HRESULT STDMETHODCALLTYPE | ExecNotificationQueryAsync (const BSTR QueryLanguage, const BSTR Query, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemObjectSink __RPC_FAR *pResponseHandler)
HRESULT STDMETHODCALLTYPE | ExecQuery (const BSTR QueryLanguage, const BSTR Query, long lFlags, IWbemContext __RPC_FAR *pCtx, IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum)
HRESULT STDMETHODCALLTYPE | ExecQueryAsync (const BSTR QueryLanguage, const BSTR Query, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemObjectSink __RPC_FAR *pResponseHandler)
SCODE | GetByPath (BSTR Path, IWbemClassObject FAR *FAR *pObj, IWbemContext *pCtx)
HRESULT STDMETHODCALLTYPE | GetObject (const BSTR ObjectPath, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemClassObject __RPC_FAR *__RPC_FAR *ppObject, IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult)
HRESULT STDMETHODCALLTYPE | GetObjectAsync (const BSTR ObjectPath, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemObjectSink __RPC_FAR *pResponseHandler)
HRESULT STDMETHODCALLTYPE | Initialize (LPWSTR pszUser, LONG lFlags, LPWSTR pszNamespace, LPWSTR pszLocale, IWbemServices *pNamespace, IWbemContext *pCtx, IWbemProviderInitSink *pInitSink)
HRESULT STDMETHODCALLTYPE | OpenNamespace (const BSTR Namespace, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemServices __RPC_FAR *__RPC_FAR *ppWorkingNamespace, IWbemCallResult __RPC_FAR *__RPC_FAR *ppResult)
HRESULT STDMETHODCALLTYPE | PutClass (IWbemClassObject __RPC_FAR *pObject, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult)
HRESULT STDMETHODCALLTYPE | PutClassAsync (IWbemClassObject __RPC_FAR *pObject, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemObjectSink __RPC_FAR *pResponseHandler)
HRESULT STDMETHODCALLTYPE | PutInstance (IWbemClassObject __RPC_FAR *pInst, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult)
HRESULT STDMETHODCALLTYPE | PutInstanceAsync (IWbemClassObject __RPC_FAR *pInst, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemObjectSink __RPC_FAR *pResponseHandler)
STDMETHODIMP | QueryInterface (REFIID, PPVOID)
HRESULT STDMETHODCALLTYPE | QueryObjectSink (long lFlags, IWbemObjectSink __RPC_FAR *__RPC_FAR *ppResponseHandler)
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP_ (ULONG) Release(void)

Protected Attributes

ULONG m_cRef
IWbemServices * | m_pNamespace

Detailed Description

Definition at line 30 of file Sample.h.

Constructor & Destructor Documentation

CClassPro::CClassPro | ( | BSTR | ObjectPath = NULL,
 |  | BSTR | User = NULL,
 |  | BSTR | Password = NULL,
 |  | IWbemContext * | pCtx = NULL
 | ) |  |

Definition at line 42 of file ClassProv.Cpp.

{
    m_pNamespace = NULL;
    m_cRef=0;
    InterlockedIncrement(&g_cObj);
    return;
}

CClassPro::~CClassPro ( void )

Definition at line 50 of file ClassProv.Cpp.

{
    if(m_pNamespace)
        m_pNamespace->Release();
    InterlockedDecrement(&g_cObj);
    return;
}

Member Function Documentation

HRESULT STDMETHODCALLTYPE CClassPro::CancelAsyncCall ( IWbemObjectSink __RPC_FAR * pSink ) [inline]

Definition at line 68 of file Sample.h.

                                                         {return WBEM_E_NOT_SUPPORTED;};

HRESULT STDMETHODCALLTYPE CClassPro::CreateClassEnum | ( | const BSTR | Superclass,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IEnumWbemClassObject __RPC_FAR *__RPC_FAR * | ppEnum |
 | ) |  |  | [inline]

Definition at line 112 of file Sample.h.

                                                                           {return WBEM_E_NOT_SUPPORTED;};

HRESULT STDMETHODCALLTYPE CClassPro::CreateClassEnumAsync | ( | const BSTR | Superclass,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemObjectSink __RPC_FAR * | pResponseHandler
 | ) |  |
HRESULT STDMETHODCALLTYPE CClassPro::CreateInstanceEnum | ( | const BSTR | Class,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IEnumWbemClassObject __RPC_FAR *__RPC_FAR * | ppEnum |
 | ) |  |  | [inline]

Definition at line 148 of file Sample.h.

                                                                           {return WBEM_E_NOT_SUPPORTED;};

HRESULT STDMETHODCALLTYPE CClassPro::CreateInstanceEnumAsync | ( | const BSTR | Class,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemObjectSink __RPC_FAR * | pResponseHandler
 | ) |  |
HRESULT STDMETHODCALLTYPE CClassPro::DeleteClass | ( | const BSTR | Class,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemCallResult __RPC_FAR *__RPC_FAR * | ppCallResult |
 | ) |  |  | [inline]

Definition at line 100 of file Sample.h.

                                                                                {return WBEM_E_NOT_SUPPORTED;};

SCODE CClassPro::DeleteClassAsync | ( | const BSTR | Class,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemObjectSink __RPC_FAR * | pResponseHandler
 | ) |  |

Definition at line 343 of file ClassProv.Cpp.

{
  if(!_wcsicmp(SAMPLE_CLASS_NAME, Class))
    pResponseHandler->SetStatus(0,S_OK,NULL, NULL);
  else
    pResponseHandler->SetStatus(0,WBEM_E_NOT_FOUND,NULL, NULL);

  return S_OK;
}

HRESULT STDMETHODCALLTYPE CClassPro::DeleteInstance | ( | const BSTR | ObjectPath,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemCallResult __RPC_FAR *__RPC_FAR * | ppCallResult |
 | ) |  |  | [inline]

Definition at line 136 of file Sample.h.

                                                                                {return WBEM_E_NOT_SUPPORTED;};

SCODE CClassPro::DeleteInstanceAsync | ( | const BSTR | ObjectPath,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemObjectSink __RPC_FAR * | pResponseHandler
 | ) |  |

Definition at line 365 of file ClassProv.Cpp.

{
    pResponseHandler->SetStatus(0,S_OK,NULL, NULL);
  return S_OK;
}

HRESULT STDMETHODCALLTYPE CClassPro::ExecMethod | ( | const | BSTR,
 |  | const | BSTR,
 |  | long | ,
 |  | IWbemContext * | ,
 |  | IWbemClassObject * | ,
 |  | IWbemClassObject ** | ,
 |  | IWbemCallResult ** |  |
 | ) |  |  | [inline]

Definition at line 188 of file Sample.h.

                                                                      {return WBEM_E_NOT_SUPPORTED;}

HRESULT STDMETHODCALLTYPE CClassPro::ExecMethodAsync | ( | const | BSTR,
 |  | const | BSTR,
 |  | long | ,
 |  | IWbemContext * | ,
 |  | IWbemClassObject * | ,
 |  | IWbemObjectSink * |  |
 | ) |  |  | [inline]

Definition at line 191 of file Sample.h.

                                                                {return WBEM_E_NOT_SUPPORTED;}

HRESULT STDMETHODCALLTYPE CClassPro::ExecNotificationQuery | ( | const BSTR | QueryLanguage,
 |  | const BSTR | Query,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IEnumWbemClassObject __RPC_FAR *__RPC_FAR * | ppEnum |
 | ) |  |  | [inline]

Definition at line 174 of file Sample.h.

                                                                           {return WBEM_E_NOT_SUPPORTED;};

HRESULT STDMETHODCALLTYPE CClassPro::ExecNotificationQueryAsync | ( | const BSTR | QueryLanguage,
 |  | const BSTR | Query,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemObjectSink __RPC_FAR * | pResponseHandler |
 | ) |  |  | [inline]

Definition at line 181 of file Sample.h.

                                                                    {return WBEM_E_NOT_SUPPORTED;};

HRESULT STDMETHODCALLTYPE CClassPro::ExecQuery | ( | const BSTR | QueryLanguage,
 |  | const BSTR | Query,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IEnumWbemClassObject __RPC_FAR *__RPC_FAR * | ppEnum |
 | ) |  |  | [inline]

Definition at line 160 of file Sample.h.

                                                                           {return WBEM_E_NOT_SUPPORTED;};

HRESULT STDMETHODCALLTYPE CClassPro::ExecQueryAsync | ( | const BSTR | QueryLanguage,
 |  | const BSTR | Query,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemObjectSink __RPC_FAR * | pResponseHandler |
 | ) |  |  | [inline]

Definition at line 167 of file Sample.h.

                                                                    {return WBEM_E_NOT_SUPPORTED;};

SCODE CClassPro::GetByPath | ( | BSTR | Path,
 |  | IWbemClassObject FAR *FAR * | pObj,
 |  | IWbemContext * | pCtx
 | ) |  |

Definition at line 277 of file ClassProv.Cpp.

{
    SCODE sc = S_OK;

    int iCnt;

    // do a simple path parse.  The path will look something like
    // ClassProvSamp.MyKey="a"
    // Create a test string with just the part between quotes.

    WCHAR wcTest[MAX_PATH+1];
  StringCbCopyW(wcTest, sizeof(wcTest), ObjectPath);
    WCHAR * pwcTest, * pwcCompare = NULL;

    int iNumQuotes = 0;
    for(pwcTest = wcTest; *pwcTest; pwcTest++)
        if(*pwcTest == L'\"')
        {
            iNumQuotes++;
            if(iNumQuotes == 1)
            {
                pwcCompare = pwcTest+1;
            }
            else if(iNumQuotes == 2)
            {
                *pwcTest = NULL;
                break;
            }
        }
        else if(*pwcTest == L'.')
            *pwcTest = NULL;    // issolate the class name.
    if(iNumQuotes != 2)
        return WBEM_E_FAILED;

    // check the instance list for a match.

    for(iCnt = 0; iCnt < glNumInst; iCnt++)
    {
        if(!_wcsicmp(MyDefs[iCnt].pwcKey, pwcCompare))
        {
            sc = CreateInst(m_pNamespace,MyDefs[iCnt].pwcKey,
                    MyDefs[iCnt].lValue, ppObj, wcTest, pCtx);
            return sc;
        }
    }

    return WBEM_E_NOT_FOUND;
}

HRESULT STDMETHODCALLTYPE CClassPro::GetObject | ( | const BSTR | ObjectPath,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemClassObject __RPC_FAR *__RPC_FAR * | ppObject,
 |  | IWbemCallResult __RPC_FAR *__RPC_FAR * | ppCallResult |
 | ) |  |  | [inline]

Definition at line 75 of file Sample.h.

                                                                                {return WBEM_E_NOT_SUPPORTED;};

HRESULT STDMETHODCALLTYPE CClassPro::GetObjectAsync | ( | const BSTR | ObjectPath,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemObjectSink __RPC_FAR * | pResponseHandler
 | ) |  |
STDMETHODIMP CClassPro::Initialize | ( | LPWSTR | pszUser,
 |  | LONG | lFlags,
 |  | LPWSTR | pszNamespace,
 |  | LPWSTR | pszLocale,
 |  | IWbemServices * | pNamespace,
 |  | IWbemContext * | pCtx,
 |  | IWbemProviderInitSink * | pInitSink
 | ) |  |

Definition at line 114 of file ClassProv.Cpp.

{
   if(! pNamespace)
  {
      pInitSink->SetStatus(WBEM_E_FAILED , 0);
  }
  else
  {
    m_pNamespace = pNamespace;
      m_pNamespace->AddRef();
    pInitSink->SetStatus(WBEM_S_INITIALIZED, 0);
  }

    return WBEM_S_NO_ERROR;
}

HRESULT STDMETHODCALLTYPE CClassPro::OpenNamespace | ( | const BSTR | Namespace,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemServices __RPC_FAR *__RPC_FAR * | ppWorkingNamespace,
 |  | IWbemCallResult __RPC_FAR *__RPC_FAR * | ppResult |
 | ) |  |  | [inline]

Definition at line 61 of file Sample.h.

                                                                                {return WBEM_E_NOT_SUPPORTED;};

HRESULT STDMETHODCALLTYPE CClassPro::PutClass | ( | IWbemClassObject __RPC_FAR * | pObject,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemCallResult __RPC_FAR *__RPC_FAR * | ppCallResult |
 | ) |  |  | [inline]

Definition at line 88 of file Sample.h.

                                                                                {return WBEM_E_NOT_SUPPORTED;};

SCODE CClassPro::PutClassAsync | ( | IWbemClassObject __RPC_FAR * | pObject,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemObjectSink __RPC_FAR * | pResponseHandler
 | ) |  |

Definition at line 326 of file ClassProv.Cpp.

{

  VARIANT var;
  VariantInit(&var);
  pObject->Get(L"__Class", 0, &var, NULL, NULL);
  if(!_wcsicmp(SAMPLE_CLASS_NAME, var.bstrVal))
    pResponseHandler->SetStatus(0,S_OK,NULL, NULL);
  else
    pResponseHandler->SetStatus(0,WBEM_E_NOT_FOUND,NULL, NULL);
  return S_OK;
}

HRESULT STDMETHODCALLTYPE CClassPro::PutInstance | ( | IWbemClassObject __RPC_FAR * | pInst,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemCallResult __RPC_FAR *__RPC_FAR * | ppCallResult |
 | ) |  |  | [inline]

Definition at line 124 of file Sample.h.

                                                                                {return WBEM_E_NOT_SUPPORTED;};

SCODE CClassPro::PutInstanceAsync | ( | IWbemClassObject __RPC_FAR * | pInst,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemObjectSink __RPC_FAR * | pResponseHandler
 | ) |  |

Definition at line 356 of file ClassProv.Cpp.

{
    pResponseHandler->SetStatus(0,S_OK,NULL, NULL);
  return S_OK;
}

STDMETHODIMP CClassPro::QueryInterface | ( | REFIID | riid,
 |  | PPVOID | ppv
 | ) |  |

Definition at line 68 of file ClassProv.Cpp.

{
    *ppv=NULL;

    // Since we have dual inheritance, it is necessary to cast the return type

    if(riid== IID_IWbemServices)
       *ppv=(IWbemServices*)this;

    if(IID_IUnknown==riid || riid== IID_IWbemProviderInit)
       *ppv=(IWbemProviderInit*)this;

    if (NULL!=*ppv) {
        AddRef();
        return NOERROR;
        }
    else
        return E_NOINTERFACE;

}

HRESULT STDMETHODCALLTYPE CClassPro::QueryObjectSink | ( | long | lFlags,
 |  | IWbemObjectSink __RPC_FAR *__RPC_FAR * | ppResponseHandler |
 | ) |  |  | [inline]

Definition at line 71 of file Sample.h.

                                                                                {return WBEM_E_NOT_SUPPORTED;};

CClassPro::STDMETHODIMP_ ( ULONG )
CClassPro::STDMETHODIMP_ ( ULONG )

Member Data Documentation

ULONG CClassPro::m_cRef [protected]

Definition at line 33 of file Sample.h.

IWbemServices* CClassPro::m_pNamespace [protected]

Definition at line 34 of file Sample.h.

The documentation for this class was generated from the following files:
  • SysMgmt/WMI/VC/ClassProv/Sample.h
  • SysMgmt/WMI/VC/ClassProv/ClassProv.Cpp
Generated on Wed Nov 13 2024 16:55:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CClientApp Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CClientApp Class Reference

#include "Client.h"

Inherits CWinApp.

List of all members.

Public Member Functions

CClientApp ()
~CClientApp ()
HRESULT | DoAPing (IPingResponder *pResp, DWORD dwTimeout)
virtual BOOL | InitInstance ()
virtual BOOL | OnIdle (LONG lCount)

Public Attributes

int | nFail
CClientDlg * pDlg
IMonitorServer * | pMonitor
ICallFactory * | pMonitorCallFactory
IPingResponder * | pMonitorResponder

Detailed Description

Definition at line 47 of file Client.h.

Constructor & Destructor Documentation

CClientApp::CClientApp ( )

Definition at line 57 of file Client.Cpp.

{
  pDlg = NULL;
  pMonitor = NULL;
  pMonitorCallFactory = NULL;
  pMonitorResponder = NULL;
  nFail = 0;
  // Place all significant initialization in InitInstance
}

CClientApp::~CClientApp ( )

Definition at line 67 of file Client.Cpp.

                       {
//    if (pMonitorCallFactory) pMonitorCallFactory->Release();
//    if (pMonitor) pMonitor->Release();
        if (pDlg) delete pDlg;
}

Member Function Documentation

HRESULT CClientApp::DoAPing | ( | IPingResponder * | pResp,
 |  | DWORD | dwTimeout
 | ) |  |

Definition at line 107 of file Client.Cpp.

                                                                 {
  AsyncIPingResponder *pAsyncResp = NULL;
  ISynchronize* pAsyncSync = NULL;
  ICallFactory* pResponderCallFactory = NULL;
  ICancelMethodCalls* pCancel = NULL;

  HRESULT hr = E_FAIL;
  __try {
    hr = pResp->QueryInterface(IID_ICallFactory, (void**)&pResponderCallFactory);
    if (FAILED(hr)) return hr;

    hr = pResponderCallFactory->CreateCall(IID_AsyncIPingResponder,NULL,IID_AsyncIPingResponder,(IUnknown**)&pAsyncResp);
    if (FAILED(hr)) return hr;

    hr = pAsyncResp->Begin_Ping();
    if (FAILED(hr)) return hr;
    pDlg->m_lPings++;

    // Timeout the Ping...
    hr = pAsyncResp->QueryInterface(IID_ISynchronize,(void**)&pAsyncSync);
    if (FAILED(hr)) return hr;

    // The HRESULT from this wait is what determines whether DoAPing fails!
    hr = pAsyncSync->Wait(0, dwTimeout);

    if (hr != S_OK){
      // Ping didn't complete in time. Cancel the call to cleanup
      // any resources consumed by the call.
      HRESULT hr2 = S_OK;
      hr2 = pAsyncResp->QueryInterface(IID_ICancelMethodCalls, (void**)&pCancel);
        ASSERT(SUCCEEDED(hr2));
        hr2 = pCancel->Cancel(0);
        ASSERT(SUCCEEDED(hr2));
        pCancel->Release();
        pCancel = NULL;
      pDlg->m_lPingFailures++;
    }

    // Complete the Ping Call ignoring its results
    pAsyncResp->Finish_Ping();

  }
  __finally{
    // All these releases will cleanup any debris left from the ping
    if (pCancel) pCancel->Release();
    if (pAsyncResp) pAsyncResp->Release();
    if (pAsyncSync) pAsyncSync->Release();
    if (pResponderCallFactory) pResponderCallFactory->Release();
  }
  return hr;
}

BOOL CClientApp::InitInstance ( void ) [virtual]

Reimplemented from CWinApp.

Definition at line 80 of file Client.Cpp.

{
  // Standard initialization
  // If you are not using these features and wish to reduce the size
  //  of your final executable, you should remove from the following
  //  the specific initialization routines you do not need.

#ifdef _AFXDLL
  Enable3dControls();     // Call this when using MFC in a shared DLL
#else
  Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif

  AfxOleInit();

  pDlg = new CClientDlg;
  m_pMainWnd = pDlg;
  if (!pDlg->Create(IDD_CLIENT_DIALOG,NULL)){
    AfxMessageBox(_T("Can't Create Dialog!"));
    return FALSE;
  }

  return TRUE;
}

BOOL CClientApp::OnIdle ( LONG lCount ) [virtual]

Definition at line 159 of file Client.Cpp.

{
  AsyncIMonitorServer *pAsyncMonitor = NULL;
  ISynchronize* pAsyncSync = NULL;
  ICancelMethodCalls* pCancel = NULL;
  HRESULT hr = E_FAIL;

  CWinApp::OnIdle(lCount);

  __try {
  if ((lCount == 0) && pMonitorCallFactory){

    // Time to make Non-Blocking Call to get data
    hr = pMonitorCallFactory->CreateCall(IID_AsyncIMonitorServer,NULL,IID_AsyncIMonitorServer,(IUnknown**)&pAsyncMonitor);
    if (FAILED(hr)){
      AfxMessageBox(_T("OOPS! Creating of Call Instance Object Failed"));
      return FALSE;
    }

    // Start Call
    pDlg->m_lTries++;

    hr = pAsyncMonitor->Begin_GetData();
    if (SUCCEEDED(hr)) {

      hr = pAsyncMonitor->QueryInterface(IID_ISynchronize,(void**)&pAsyncSync);
      ASSERT(SUCCEEDED(hr));
      //
      // There are two different mechanisms shown here:
      //  A) As long as the server system responsds to a ping
      //       let the call complete in as long as it likes.
      //
      //  B) Enforce a strict timeout. The call must complete within
      //     the CALLTIMEOUT interval.
      //

      if (pDlg->m_bUsePing){
        // Use the pinging technique...
        HRESULT hr2 = S_OK;

        // Keep call going as long as pinging succeeds
        while (hr2 == S_OK) {
        hr = pAsyncSync->Wait(0, CALLTIMEOUTWHENPINGING);
        if (hr != S_OK){
          hr2 = DoAPing(pMonitorResponder, PINGTIMEOUT);

        } else {
          hr2 = (HRESULT)-1; //Call Completed
        }
        }

        // Evaluate the results of pinging or call
        if (hr != S_OK){
          // Call didn't complete and we got here because DoAPing failed
          // Just cancel call
          pDlg->m_lTimeouts++;
          hr = pAsyncMonitor->QueryInterface(IID_ICancelMethodCalls, (void**)&pCancel);
          ASSERT(SUCCEEDED(hr));
          hr = pCancel->Cancel(0);
          ASSERT(SUCCEEDED(hr));
          pCancel->Release();
          pCancel = NULL;
        }

      } else {
        // Apply Strict Timeouts
        hr = pAsyncSync->Wait(0,CALLTIMEOUT);
        if (hr != S_OK){
          // Timeout happened before Call Completed
          // Cancel call which will cause Finish_GetData
          //   to return RPC_E_CALLCANCELED
          pDlg->m_lTimeouts++;
          hr = pAsyncMonitor->QueryInterface(IID_ICancelMethodCalls, (void**)&pCancel);
          ASSERT(SUCCEEDED(hr));
          hr = pCancel->Cancel(0);
          ASSERT(SUCCEEDED(hr));
          pCancel->Release();
          pCancel = NULL;
        }
      }

      pAsyncSync->Release();
      pAsyncSync = NULL;
    } else {
      pDlg->m_lFails++;
    }
    // Complete Call
        long iNewData;
    hr = pAsyncMonitor->Finish_GetData(&iNewData);
    if (SUCCEEDED(hr)) {
            pDlg->m_iData = iNewData;       // Believe new data
      nFail = 0;            // State data Ok...
        } else {
      nFail++;
        }
    if (nFail > 3) nFail=3;   // To keep the UI happy

    pAsyncMonitor->Release();
    pAsyncMonitor = NULL;

    // Update Status Text on Dialog based upon nFail
    if (nFail == 0){
      pDlg->m_cGood.ModifyStyle(0,WS_VISIBLE,0);
      pDlg->m_cWarning.ModifyStyle(WS_VISIBLE,0,0);
      pDlg->m_cBad.ModifyStyle(WS_VISIBLE,0,0);
    } else if (nFail <= 2){
      pDlg->m_cGood.ModifyStyle(WS_VISIBLE,0,0);
      pDlg->m_cWarning.ModifyStyle(0,WS_VISIBLE,0);
      pDlg->m_cBad.ModifyStyle(WS_VISIBLE,0,0);
    } else {
      pDlg->m_cGood.ModifyStyle(WS_VISIBLE,0,0);
      pDlg->m_cWarning.ModifyStyle(WS_VISIBLE,0,0);
      pDlg->m_cBad.ModifyStyle(0,WS_VISIBLE,0);
    }

    pDlg->Invalidate(TRUE);
    pDlg->UpdateData(FALSE);
    pDlg->UpdateWindow();

    pDlg->SetTimer(47,MONITORPOLLDELAY,NULL);

  }
  }
  __finally {
    if (pCancel) pCancel->Release();
    if (pAsyncSync) pAsyncSync->Release();
    if (pAsyncMonitor) pAsyncMonitor->Release();
    }

  return FALSE;
}

Member Data Documentation

int CClientApp::nFail

Definition at line 57 of file Client.h.

CClientDlg* CClientApp::pDlg

Definition at line 53 of file Client.h.

IMonitorServer* CClientApp::pMonitor

Definition at line 54 of file Client.h.

ICallFactory* CClientApp::pMonitorCallFactory

Definition at line 55 of file Client.h.

IPingResponder* CClientApp::pMonitorResponder

Definition at line 56 of file Client.h.

The documentation for this class was generated from the following files:
  • Com/Fundamentals/DCom/TimeOuts/Client/Client.h
  • Com/Fundamentals/DCom/TimeOuts/Client/Client.Cpp
Generated on Wed Nov 13 2024 16:55:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CClientDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes

CClientDlg Class Reference

#include "ClientDlg.h"

List of all members.

Public Types

enum | { IDD = IDD_CLIENT_DIALOG }

Public Member Functions

CClientDlg (CWnd *pParent=NULL)

Public Attributes

BOOL m_bUsePing
CStatic | m_cBad
CStatic | m_cGood
CString m_cRSN
CButton | m_ctlStart
CStatic | m_cWarning
long | m_iData
long | m_lFails
long | m_lPingFailures
long | m_lPings
long | m_lTimeouts
long | m_lTries

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
virtual BOOL | OnInitDialog ()
virtual void | OnOK ()
afx_msg void | OnPaint ()
afx_msg HCURSOR | OnQueryDragIcon ()
afx_msg void | OnStart ()
afx_msg void | OnUsePing ()

Protected Attributes

HICON | m_hIcon

Detailed Description

Definition at line 35 of file ClientDlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 43 of file ClientDlg.h.

{ IDD = IDD_CLIENT_DIALOG };

Constructor & Destructor Documentation

CClientDlg::CClientDlg ( CWnd * pParent = NULL )

Definition at line 41 of file ClientDlg.Cpp.

  : CDialog(CClientDlg::IDD, pParent)
{
  //{{AFX_DATA_INIT(CClientDlg)
  m_iData = 0;
  m_lPings = 0;
  m_lTimeouts = 0;
  m_lTries = 0;
  m_bUsePing = FALSE;
  m_lFails = 0;
  m_cRSN = _T("");
  m_lPingFailures = 0;
  //}}AFX_DATA_INIT
  // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
  m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

Member Function Documentation

void CClientDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 58 of file ClientDlg.Cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CClientDlg)
  DDX_Control(pDX, IDSTART, m_ctlStart);
  DDX_Control(pDX, IDC_WARNING, m_cWarning);
  DDX_Control(pDX, IDC_GOOD, m_cGood);
  DDX_Control(pDX, IDC_BAD, m_cBad);
  DDX_Text(pDX, IDC_LASTVALUE, m_iData);
  DDX_Text(pDX, IDC_PINGS, m_lPings);
  DDX_Text(pDX, IDC_TIMEOUTS, m_lTimeouts);
  DDX_Text(pDX, IDC_TRIES, m_lTries);
  DDX_Check(pDX, IDC_USEPING, m_bUsePing);
  DDX_Text(pDX, IDC_FAILS, m_lFails);
  DDX_Text(pDX, IDC_RSN, m_cRSN);
  DDX_Text(pDX, IDC_PINGFAILS, m_lPingFailures);
  //}}AFX_DATA_MAP
}

BOOL CClientDlg::OnInitDialog ( ) [protected, virtual]

Definition at line 89 of file ClientDlg.Cpp.

{
  CDialog::OnInitDialog();

  // Set the icon for this dialog.  The framework does this automatically
  //  when the application's main window is not a dialog
  SetIcon(m_hIcon, TRUE);     // Set big icon
  SetIcon(m_hIcon, FALSE);    // Set small icon

  return TRUE;  // return TRUE  unless you set the focus to a control
}

void CClientDlg::OnOK ( ) [protected, virtual]

Definition at line 140 of file ClientDlg.Cpp.

{
  CDialog::OnOK();

  // Exit the monitor loop
  DestroyWindow();
}

void CClientDlg::OnPaint ( void ) [protected]

Definition at line 107 of file ClientDlg.Cpp.

{
  if (IsIconic())
  {
    CPaintDC dc(this); // device context for painting

    SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

    // Center icon in client rectangle
    int cxIcon = GetSystemMetrics(SM_CXICON);
    int cyIcon = GetSystemMetrics(SM_CYICON);
    CRect rect;
    GetClientRect(&rect);
    int x = (rect.Width() - cxIcon + 1) / 2;
    int y = (rect.Height() - cyIcon + 1) / 2;

    // Draw the icon
    dc.DrawIcon(x, y, m_hIcon);
  }
  else
  {
    CDialog::OnPaint();
  }
}

HCURSOR CClientDlg::OnQueryDragIcon ( ) [protected]

Definition at line 134 of file ClientDlg.Cpp.

{
  return (HCURSOR) m_hIcon;
}

void CClientDlg::OnStart ( ) [protected]

Definition at line 153 of file ClientDlg.Cpp.

{
        WCHAR* pTemp = NULL;
  HRESULT hr = E_FAIL;

  if (theApp.pMonitor){
    // Disconnect from the Server
    if (theApp.pMonitorCallFactory) {
      theApp.pMonitorCallFactory->Release();
      theApp.pMonitorCallFactory = NULL;
    }

    if (theApp.pMonitorResponder){
      theApp.pMonitorResponder->Release();
      theApp.pMonitorResponder = NULL;
    }

    theApp.pMonitor->Release();
    theApp.pMonitor = NULL;

    m_ctlStart.SetWindowText(_T("Start"));
  } else {
    // Capture Remote Server Name
    UpdateData(TRUE);

                // Obtain the Remote Server Name
    COSERVERINFO  cos;
    cos.dwReserved1 = 0;
    cos.dwReserved2 = 0;
    cos.pAuthInfo = NULL;
#ifdef _UNICODE
                cos.pwszName = m_cRSN.GetBuffer(0);
#else
                int cchWide = MultiByteToWideChar(CP_ACP,MB_PRECOMPOSED,m_cRSN.GetBuffer(0),-1,NULL,0);
                if (cchWide == 0)
                {
                  // Error Case
                  AfxMessageBox(_T("MultiByteToWideChar Failed on RemoteServer Name getting Length! Using local machine."));

                } else {
                  pTemp = new WCHAR[cchWide+1];
                  if (pTemp)
                  {
                    cchWide = MultiByteToWideChar(CP_ACP,MB_PRECOMPOSED,m_cRSN.GetBuffer(0),-1,pTemp,cchWide);
                    if (cchWide == 0)
                    {
                      AfxMessageBox(_T("MultiByteToWideChar Failed on RemoteServer Name copying string!"));
                      delete pTemp;
                      pTemp = NULL;
                    }
                  }
                }
                cos.pwszName = pTemp;
#endif

    // Need MultiQI for CoCreateInstanceEx
    MULTI_QI mqi;
    mqi.pIID = &IID_IMonitorServer;
    mqi.pItf = NULL;
    mqi.hr = E_FAIL;

    // Connect to server
    hr = CoCreateInstanceEx(CLSID_MonitorServer, NULL, CLSCTX_LOCAL_SERVER|CLSCTX_REMOTE_SERVER, &cos, 1, &mqi);
    if (FAILED(hr) || FAILED(mqi.hr)){
      AfxMessageBox(_T("Please Register Server, proxystub DLL on local machine, and specified Remote Server!"));
      OnOK();
      if (pTemp) delete pTemp;
                        return;
    }

    theApp.pMonitor = (IMonitorServer*)mqi.pItf;

    // Make sure IMonitorServer supports Non-Blocking Calls

    hr = theApp.pMonitor->QueryInterface(IID_ICallFactory, (void**)&theApp.pMonitorCallFactory);
    if (FAILED(hr)){
      AfxMessageBox(_T("IMonitorServer doesn't support Non-Blocking Calls! Executing on Windows 2000?"));
      theApp.pMonitor->Release();
      theApp.pMonitor = NULL;
      OnOK();
      if (pTemp) delete pTemp;
      return;
    }

    hr = theApp.pMonitor->GetPingResponder(&theApp.pMonitorResponder);
    if (FAILED(hr)){
      AfxMessageBox(_T("IMonitorServer doesn't support PingResponder! Please Register PingResp.dll on local system and Remote Server."));
      theApp.pMonitorCallFactory->Release();
      theApp.pMonitorCallFactory = NULL;

      theApp.pMonitor->Release();
      theApp.pMonitor = NULL;
      OnOK();
      if (pTemp) delete pTemp;
      return;
    }

                if (pTemp) delete pTemp;

                m_ctlStart.SetWindowText(_T("Stop"));

    // Reset Statistics
    m_iData = 0;
    m_lPings = 0;
    m_lTimeouts = 0;
    m_lTries = 0;
    m_lFails = 0;
    m_lPingFailures = 0;

                // Start OnIdle processing in CClientApp
    SetTimer(47,MONITORPOLLDELAY,NULL);
  }
}

void CClientDlg::OnUsePing ( ) [protected]

Definition at line 148 of file ClientDlg.Cpp.

{
  m_bUsePing = !m_bUsePing;
}

Member Data Documentation

BOOL CClientDlg::m_bUsePing

Definition at line 52 of file ClientDlg.h.

CStatic CClientDlg::m_cBad

Definition at line 47 of file ClientDlg.h.

CStatic CClientDlg::m_cGood

Definition at line 46 of file ClientDlg.h.

CString CClientDlg::m_cRSN

Definition at line 54 of file ClientDlg.h.

CButton CClientDlg::m_ctlStart

Definition at line 44 of file ClientDlg.h.

CStatic CClientDlg::m_cWarning

Definition at line 45 of file ClientDlg.h.

HICON CClientDlg::m_hIcon [protected]

Definition at line 66 of file ClientDlg.h.

long CClientDlg::m_iData

Definition at line 48 of file ClientDlg.h.

long CClientDlg::m_lFails

Definition at line 53 of file ClientDlg.h.

long CClientDlg::m_lPingFailures

Definition at line 55 of file ClientDlg.h.

long CClientDlg::m_lPings

Definition at line 49 of file ClientDlg.h.

long CClientDlg::m_lTimeouts

Definition at line 50 of file ClientDlg.h.

long CClientDlg::m_lTries

Definition at line 51 of file ClientDlg.h.

The documentation for this class was generated from the following files:
  • Com/Fundamentals/DCom/TimeOuts/Client/ClientDlg.h
  • Com/Fundamentals/DCom/TimeOuts/Client/ClientDlg.Cpp
Generated on Wed Nov 13 2024 16:55:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CClipBookServerApp Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CClipBookServerApp Class Reference

Inherits CWinApp.

List of all members.

Public Member Functions

virtual int | ExitInstance ()
virtual BOOL | InitInstance ()

Detailed Description

Definition at line 80 of file ClipBook ServerEx.cpp.

Member Function Documentation

int CClipBookServerApp::ExitInstance ( void ) [virtual]

Reimplemented from CWinApp.

Definition at line 135 of file ClipBook ServerEx.cpp.

{
    _Module.Term();

    return CWinApp::ExitInstance();

}  //*** CClipBookServerApp::ExitInstance

BOOL CClipBookServerApp::InitInstance ( void ) [virtual]

Reimplemented from CWinApp.

Definition at line 110 of file ClipBook ServerEx.cpp.

{
    _Module.Init( ObjectMap, m_hInstance );

    return CWinApp::InitInstance();

}  //*** CClipBookServerApp::InitInstance

The documentation for this class was generated from the following file:
  • WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/ClipBook ServerEx.cpp
Generated on Wed Nov 13 2024 16:55:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CClipBookServerParamsPage Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Protected Member Functions

CClipBookServerParamsPage Class Reference

#include "ResProp.h"

Inherits CBasePropertyPage.

List of all members.

Public Types

enum | { IDD = IDD_PP_CLIPBOOKSERVER_PARAMETERS }

Public Member Functions

CClipBookServerParamsPage (void)
virtual BOOL | OnSetActive ()

Protected Member Functions

BOOL | BAllRequiredFieldsPresent (void) const
virtual DWORD | Cprops (void) const
virtual void | DoDataExchange (CDataExchange *pDX)
afx_msg void | OnChangeRequiredField ()
virtual BOOL | OnInitDialog ()
virtual const CObjectProperty * | Pprops (void) const

Detailed Description

Definition at line 56 of file ResProp.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 73 of file ResProp.h.

{ IDD = IDD_PP_CLIPBOOKSERVER_PARAMETERS };

Constructor & Destructor Documentation

CClipBookServerParamsPage::CClipBookServerParamsPage ( void )

Definition at line 67 of file ResProp.cpp.

    : CBasePropertyPage( CClipBookServerParamsPage::IDD )
{
    //
    //  TODO: Modify the following lines to represent the data displayed on this page.
    //

    //{{AFX_DATA_INIT(CClipBookServerParamsPage)
    //}}AFX_DATA_INIT

    // Setup the property array.
    {
    } // Setup the property array

    m_iddPropertyPage = IDD_PP_CLIPBOOKSERVER_PARAMETERS;
    m_iddWizardPage = IDD_WIZ_CLIPBOOKSERVER_PARAMETERS;

} //*** CClipBookServerParamsPage::CClipBookServerParamsPage

Member Function Documentation

BOOL CClipBookServerParamsPage::BAllRequiredFieldsPresent ( void ) const [protected]

Definition at line 272 of file ResProp.cpp.

{
    return TRUE;

} //*** CClipBookServerParamsPage::BAllRequiredFieldsPresent

virtual DWORD CClipBookServerParamsPage::Cprops ( void ) const [inline, protected, virtual]

Reimplemented from CBasePropertyPage.

Definition at line 89 of file ResProp.h.

{ return 0; }

void CClipBookServerParamsPage::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Reimplemented from CBasePropertyPage.

Definition at line 104 of file ResProp.cpp.

{
    if ( ! pDXIn->m_bSaveAndValidate || ! BSaved() )
    {
        AFX_MANAGE_STATE( AfxGetStaticModuleState() );

        //
        //  TODO: Modify the following lines to represent the data displayed on this page.
        //

        //  {{AFX_DATA_MAP(CClipBookServerParamsPage)
        //}}AFX_DATA_MAP

        //
        //  Handle numeric parameters.
        //

        if ( ! BBackPressed() )
        {
        } // if: back button not pressed

        //
        //  TODO: Add any additional field validation here.
        //

        if ( pDXIn->m_bSaveAndValidate )
        {
            //
            //  Make sure all required fields are present.
            //

            if ( ! BBackPressed() )
            {
            } // if: back button not pressed
        } // if: saving data from dialog
    } // if: not saving or haven't saved yet

    CBasePropertyPage::DoDataExchange( pDXIn );

} //*** CClipBookServerParamsPage::DoDataExchange

void CClipBookServerParamsPage::OnChangeRequiredField ( void ) [protected]

Definition at line 241 of file ResProp.cpp.

{
    AFX_MANAGE_STATE( AfxGetStaticModuleState() );

    OnChangeCtrl();

    if ( BWizard() )
    {
        EnableNext( BAllRequiredFieldsPresent() );
    } // if: displaying a wizard

} //*** CClipBookServerParamsPage::OnChangeRequiredField

BOOL CClipBookServerParamsPage::OnInitDialog ( void ) [protected, virtual]

Reimplemented from CBasePropertyPage.

Definition at line 168 of file ResProp.cpp.

{
    AFX_MANAGE_STATE( AfxGetStaticModuleState() );

    CBasePropertyPage::OnInitDialog();

    //
    //  TODO: Limit the size of the text that can be entered in edit controls.
    //

    //
    //  Return TRUE unless you set the focus to a control.
    //
    //  EXCEPTION: OCX Property Pages should return FALSE..
    //

    return TRUE;

} //*** CClipBookServerParamsPage::OnInitDialog

BOOL CClipBookServerParamsPage::OnSetActive ( void ) [virtual]

Reimplemented from CBasePropertyPage.

Definition at line 209 of file ResProp.cpp.

{
    AFX_MANAGE_STATE( AfxGetStaticModuleState() );

    // Enable/disable the Next/Finish button.
    if ( BWizard() )
    {
        EnableNext( BAllRequiredFieldsPresent() );
    } // if: displaying a wizard

    return CBasePropertyPage::OnSetActive();

} //*** CClipBookServerParamsPage::OnSetActive

virtual const CObjectProperty* CClipBookServerParamsPage::Pprops ( void ) const [inline, protected, virtual]

Reimplemented from CBasePropertyPage.

Definition at line 88 of file ResProp.h.

{ return NULL; }

The documentation for this class was generated from the following files:
  • WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/ResProp.h
  • WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/ResProp.cpp
Generated on Wed Nov 13 2024 16:55:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCloseQueueDialog Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions

CCloseQueueDialog Class Reference

#include "CLOSQDlg.h"

List of all members.

Public Types

enum | { IDD = IDD_CLOSE_QUEUE_DIALOG }

Public Member Functions

CCloseQueueDialog (CArray< ARRAYQ *, ARRAYQ * > *, CWnd *pParent=NULL)
void | GetPathName (TCHAR szPathName[BUFFERSIZE])

Public Attributes

CComboBox | m_PathNameCB
CArray< ARRAYQ *, ARRAYQ * > * | m_pStrArray
CString m_szPathName

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
virtual BOOL | OnInitDialog ()

Detailed Description

Definition at line 20 of file CLOSQDlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 28 of file CLOSQDlg.h.

{ IDD = IDD_CLOSE_QUEUE_DIALOG };

Constructor & Destructor Documentation

CCloseQueueDialog::CCloseQueueDialog | ( | CArray< ARRAYQ *, ARRAYQ * > * | pStrArray,
 |  | CWnd * | pParent = NULL
 | ) |  |

Definition at line 32 of file CLOSQDlg.Cpp.

  : CDialog(CCloseQueueDialog::IDD, pParent)
{
  m_pStrArray = pStrArray;

  //{{AFX_DATA_INIT(CCloseQueueDialog)
  m_szPathName = _T("");
  //}}AFX_DATA_INIT
}

Member Function Documentation

void CCloseQueueDialog::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 43 of file CLOSQDlg.Cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CCloseQueueDialog)
  DDX_Control(pDX, IDC_COMBO, m_PathNameCB);
  DDX_CBString(pDX, IDC_COMBO, m_szPathName);
  DDV_MaxChars(pDX, m_szPathName, 4000);
  //}}AFX_DATA_MAP
}

void CCloseQueueDialog::GetPathName ( TCHAR szPathName[BUFFERSIZE] ) [inline]

Definition at line 53 of file CLOSQDlg.h.

  {
    ASSERT(szPathName != NULL);

    _tcsncpy (szPathName, m_szPathName, BUFFERSIZE-1);
    szPathName[BUFFERSIZE-1] = '\0';

  }

BOOL CCloseQueueDialog::OnInitDialog ( ) [protected, virtual]

Definition at line 62 of file CLOSQDlg.Cpp.

{
  CDialog::OnInitDialog();

  int i;

  // TODO: Add extra initialization here
  for  (i=0 ; i<m_pStrArray->GetSize() ; i++)
  {
    if ((*m_pStrArray)[i]->bFormatNameOnly)
    {
      VERIFY (m_PathNameCB.AddString((*m_pStrArray)[i]->szFormatName) != CB_ERR);
    }
    else
    {
      VERIFY (m_PathNameCB.AddString((*m_pStrArray)[i]->szPathName) != CB_ERR);
    }
  }

    if (m_PathNameCB.GetCount() > 0) m_PathNameCB.SetCurSel(0);

    return TRUE;  // return TRUE unless you set the focus to a control
                // EXCEPTION: OCX Property Pages should return FALSE
}

Member Data Documentation

CComboBox CCloseQueueDialog::m_PathNameCB

Definition at line 29 of file CLOSQDlg.h.

CArray<ARRAYQ*, ARRAYQ*>* CCloseQueueDialog::m_pStrArray

Definition at line 34 of file CLOSQDlg.h.

CString CCloseQueueDialog::m_szPathName

Definition at line 30 of file CLOSQDlg.h.

The documentation for this class was generated from the following files:
  • NetDS/MessageQueuing/MqApiTst/CLOSQDlg.h
  • NetDS/MessageQueuing/MqApiTst/CLOSQDlg.Cpp
Generated on Wed Nov 13 2024 16:55:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CClusPropList Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes

CClusPropList Class Reference

#include "PropList.h"

List of all members.

Public Member Functions

CClusPropList (BOOL bAlwaysAddPropIn=FALSE)
CClusPropList (BOOL bAlwaysAddPropIn=FALSE)
CClusPropList (BOOL bAlwaysAddPropIn=FALSE)
~CClusPropList (void)
~CClusPropList (void)
~CClusPropList (void)
BOOL | BIsListEmpty (void) const
BOOL | BIsListEmpty (void) const
BOOL | BIsListEmpty (void) const
DWORD | CbBufferSize (void) const
DWORD | CbBufferSize (void) const
DWORD | CbBufferSize (void) const
DWORD | CbCurrentValueLength (void) const
DWORD | CbCurrentValueLength (void) const
DWORD | CbCurrentValueLength (void) const
DWORD | CbDataLeft (void) const
DWORD | CbDataLeft (void) const
DWORD | CbDataLeft (void) const
const CLUSPROP_BUFFER_HELPER | CbhCurrentPropertyName (void)
const CLUSPROP_BUFFER_HELPER | CbhCurrentPropertyName (void)
const CLUSPROP_BUFFER_HELPER | CbhCurrentPropertyName (void)
const CLUSPROP_BUFFER_HELPER | CbhCurrentValue (void)
const CLUSPROP_BUFFER_HELPER | CbhCurrentValue (void)
const CLUSPROP_BUFFER_HELPER | CbhCurrentValue (void)
const CLUSPROP_BUFFER_HELPER | CbhCurrentValueList (void)
const CLUSPROP_BUFFER_HELPER | CbhCurrentValueList (void)
const CLUSPROP_BUFFER_HELPER | CbhCurrentValueList (void)
const CLUSPROP_BUFFER_HELPER | CbhPropList (void) const
const CLUSPROP_BUFFER_HELPER | CbhPropList (void) const
const CLUSPROP_BUFFER_HELPER | CbhPropList (void) const
DWORD | CbPropList (void) const
DWORD | CbPropList (void) const
DWORD | CbPropList (void) const
void | ClearPropList (void)
void | ClearPropList (void)
void | ClearPropList (void)
CLUSTER_PROPERTY_FORMAT | CpfCurrentValueFormat (void) const
CLUSTER_PROPERTY_FORMAT | CpfCurrentValueFormat (void) const
CLUSTER_PROPERTY_FORMAT | CpfCurrentValueFormat (void) const
DWORD | Cprops (void) const
DWORD | Cprops (void) const
DWORD | Cprops (void) const
CLUSTER_PROPERTY_SYNTAX | CpsCurrentValueSyntax (void) const
CLUSTER_PROPERTY_SYNTAX | CpsCurrentValueSyntax (void) const
CLUSTER_PROPERTY_SYNTAX | CpsCurrentValueSyntax (void) const
CLUSTER_PROPERTY_TYPE | CptCurrentValueType (void) const
CLUSTER_PROPERTY_TYPE | CptCurrentValueType (void) const
CLUSTER_PROPERTY_TYPE | CptCurrentValueType (void) const
void | DeletePropList (void)
void | DeletePropList (void)
void | DeletePropList (void)
void | InitSize (size_t cbSizeIn)
void | InitSize (size_t cbSizeIn)
void | InitSize (size_t cbSizeIn)
operator PCLUSPROP_LIST (void) const
operator PCLUSPROP_LIST (void) const
operator PCLUSPROP_LIST (void) const
PBYTE | PbPropList (void) const
PBYTE | PbPropList (void) const
PBYTE | PbPropList (void) const
PCLUSPROP_LIST | Plist (void)
PCLUSPROP_LIST | Plist (void)
PCLUSPROP_LIST | Plist (void)
LPCWSTR | PszCurrentPropertyName (void) const
LPCWSTR | PszCurrentPropertyName (void) const
LPCWSTR | PszCurrentPropertyName (void) const
const CClusPropValueList & | RPvlPropertyValue (void)
const CClusPropValueList & | RPvlPropertyValue (void)
const CClusPropValueList & | RPvlPropertyValue (void)
DWORD | ScAddExpandSzProp (LPCWSTR pwszNameIn, LPCWSTR pwszValueIn, LPCWSTR pwszPrevValueIn)
DWORD | ScAddExpandSzProp (LPCWSTR pwszNameIn, LPCWSTR pwszValueIn, LPCWSTR pwszPrevValueIn)
DWORD | ScAddExpandSzProp (LPCWSTR pwszNameIn, LPCWSTR pwszValueIn)
DWORD | ScAddExpandSzProp (LPCWSTR pwszNameIn, LPCWSTR pwszValueIn)
DWORD | ScAddExpandSzProp (LPCWSTR pwszNameIn, LPCWSTR pwszValueIn, LPCWSTR pwszPrevValueIn)
DWORD | ScAddExpandSzProp (LPCWSTR pwszNameIn, LPCWSTR pwszValueIn)
DWORD | ScAddMultiSzProp (LPCWSTR pwszNameIn, LPCWSTR pwszValueIn, LPCWSTR pwszPrevValueIn)
DWORD | ScAddMultiSzProp (LPCWSTR pwszNameIn, LPCWSTR pwszValueIn, LPCWSTR pwszPrevValueIn)
DWORD | ScAddMultiSzProp (LPCWSTR pwszNameIn, LPCWSTR pwszValueIn, LPCWSTR pwszPrevValueIn)
DWORD | ScAddProp (LPCWSTR pwszNameIn, LONG nValueIn, LONG nPrevValueIn)
DWORD | ScAddProp (LPCWSTR pwszNameIn, LPCWSTR pwszValueIn, LPCWSTR pwszPrevValueIn)
DWORD | ScAddProp (LPCWSTR pwszNameIn, ULONGLONG ullValueIn, ULONGLONG ullPrevValueIn)
DWORD | ScAddProp (LPCWSTR pwszNameIn, LONGLONG llValueIn, LONGLONG llPrevValueIn)
DWORD | ScAddProp (LPCWSTR pwszNameIn, LPCWSTR pwszValueIn)
DWORD | ScAddProp (LPCWSTR pwszNameIn, DWORD nValueIn, DWORD nPrevValueIn)
DWORD | ScAddProp (LPCWSTR pwszNameIn, LONG nValueIn, LONG nPrevValueIn)
DWORD | ScAddProp (LPCWSTR pwszNameIn, ULONGLONG ullValueIn, ULONGLONG ullPrevValueIn)
DWORD | ScAddProp (LPCWSTR pwszNameIn, LONGLONG llValueIn, LONGLONG llPrevValueIn)
DWORD | ScAddProp (LPCWSTR pwszNameIn, LPCWSTR pwszValueIn, LPCWSTR pwszPrevValueIn)
DWORD | ScAddProp (LPCWSTR pwszNameIn, const unsigned char *pbValueIn, size_t cbValueIn, const unsigned char *pbPrevValueIn, size_t cbPrevValueIn)
DWORD | ScAddProp (LPCWSTR pwszNameIn, LPCWSTR pwszValueIn)
DWORD | ScAddProp (LPCWSTR pwszNameIn, DWORD nValueIn, DWORD nPrevValueIn)
DWORD | ScAddProp (LPCWSTR pwszNameIn, ULONGLONG ullValueIn, ULONGLONG ullPrevValueIn)
DWORD | ScAddProp (LPCWSTR pwszNameIn, const unsigned char *pbValueIn, size_t cbValueIn, const unsigned char *pbPrevValueIn, size_t cbPrevValueIn)
DWORD | ScAddProp (LPCWSTR pwszNameIn, LPCWSTR pwszValueIn)
DWORD | ScAddProp (LPCWSTR pwszNameIn, LPCWSTR pwszValueIn, LPCWSTR pwszPrevValueIn)
DWORD | ScAddProp (LPCWSTR pwszNameIn, LONGLONG llValueIn, LONGLONG llPrevValueIn)
DWORD | ScAddProp (LPCWSTR pwszNameIn, const unsigned char *pbValueIn, size_t cbValueIn, const unsigned char *pbPrevValueIn, size_t cbPrevValueIn)
DWORD | ScAddProp (LPCWSTR pwszNameIn, DWORD nValueIn, DWORD nPrevValueIn)
DWORD | ScAddProp (LPCWSTR pwszNameIn, LONG nValueIn, LONG nPrevValueIn)
DWORD | ScAllocPropList (size_t cbMinimumIn)
DWORD | ScAllocPropList (size_t cbMinimumIn)
DWORD | ScAllocPropList (size_t cbMinimumIn)
DWORD | ScAppend (const CClusPropList &rclPropListIn)
DWORD | ScAppend (const CClusPropList &rclPropListIn)
DWORD | ScAppend (const CClusPropList &rclPropListIn)
DWORD | ScCheckIfAtLastProperty (void) const
DWORD | ScCheckIfAtLastProperty (void) const
DWORD | ScCheckIfAtLastProperty (void) const
DWORD | ScCopy (const PCLUSPROP_LIST pcplPropListIn, size_t cbListSizeIn)
DWORD | ScCopy (const PCLUSPROP_LIST pcplPropListIn, size_t cbListSizeIn)
DWORD | ScCopy (const PCLUSPROP_LIST pcplPropListIn, size_t cbListSizeIn)
DWORD | ScGetClusterProperties (HCLUSTER hClusterIn, DWORD dwControlCodeIn, HNODE hHostNodeIn=NULL, LPVOID lpBufferIn=NULL, size_t cbBufferIn=0)
DWORD | ScGetClusterProperties (HCLUSTER hClusterIn, DWORD dwControlCodeIn, HNODE hHostNodeIn=NULL, LPVOID lpBufferIn=NULL, size_t cbBufferIn=0)
DWORD | ScGetClusterProperties (HCLUSTER hClusterIn, DWORD dwControlCodeIn, HNODE hHostNodeIn=NULL, LPVOID lpBufferIn=NULL, size_t cbBufferIn=0)
DWORD | ScGetGroupProperties (HGROUP hGroupIn, DWORD dwControlCodeIn, HNODE hHostNodeIn=NULL, LPVOID lpBufferIn=NULL, size_t cbBufferIn=0)
DWORD | ScGetGroupProperties (HGROUP hGroupIn, DWORD dwControlCodeIn, HNODE hHostNodeIn=NULL, LPVOID lpBufferIn=NULL, size_t cbBufferIn=0)
DWORD | ScGetGroupProperties (HGROUP hGroupIn, DWORD dwControlCodeIn, HNODE hHostNodeIn=NULL, LPVOID lpBufferIn=NULL, size_t cbBufferIn=0)
DWORD | ScGetNetInterfaceProperties (HNETINTERFACE hNetInterfaceIn, DWORD dwControlCodeIn, HNODE hHostNodeIn=NULL, LPVOID lpBufferIn=NULL, size_t cbBufferIn=0)
DWORD | ScGetNetInterfaceProperties (HNETINTERFACE hNetInterfaceIn, DWORD dwControlCodeIn, HNODE hHostNodeIn=NULL, LPVOID lpBufferIn=NULL, size_t cbBufferIn=0)
DWORD | ScGetNetInterfaceProperties (HNETINTERFACE hNetInterfaceIn, DWORD dwControlCodeIn, HNODE hHostNodeIn=NULL, LPVOID lpBufferIn=NULL, size_t cbBufferIn=0)
DWORD | ScGetNetworkProperties (HNETWORK hNetworkIn, DWORD dwControlCodeIn, HNODE hHostNodeIn=NULL, LPVOID lpBufferIn=NULL, size_t cbBufferIn=0)
DWORD | ScGetNetworkProperties (HNETWORK hNetworkIn, DWORD dwControlCodeIn, HNODE hHostNodeIn=NULL, LPVOID lpBufferIn=NULL, size_t cbBufferIn=0)
DWORD | ScGetNetworkProperties (HNETWORK hNetworkIn, DWORD dwControlCodeIn, HNODE hHostNodeIn=NULL, LPVOID lpBufferIn=NULL, size_t cbBufferIn=0)
DWORD | ScGetNodeProperties (HNODE hNodeIn, DWORD dwControlCodeIn, HNODE hHostNodeIn=NULL, LPVOID lpBufferIn=NULL, size_t cbBufferIn=0)
DWORD | ScGetNodeProperties (HNODE hNodeIn, DWORD dwControlCodeIn, HNODE hHostNodeIn=NULL, LPVOID lpBufferIn=NULL, size_t cbBufferIn=0)
DWORD | ScGetNodeProperties (HNODE hNodeIn, DWORD dwControlCodeIn, HNODE hHostNodeIn=NULL, LPVOID lpBufferIn=NULL, size_t cbBufferIn=0)
DWORD | ScGetResourceProperties (HRESOURCE hResourceIn, DWORD dwControlCodeIn, HNODE hHostNodeIn=NULL, LPVOID lpBufferIn=NULL, size_t cbBufferIn=0)
DWORD | ScGetResourceProperties (HRESOURCE hResourceIn, DWORD dwControlCodeIn, HNODE hHostNodeIn=NULL, LPVOID lpBufferIn=NULL, size_t cbBufferIn=0)
DWORD | ScGetResourceProperties (HRESOURCE hResourceIn, DWORD dwControlCodeIn, HNODE hHostNodeIn=NULL, LPVOID lpBufferIn=NULL, size_t cbBufferIn=0)
DWORD | ScGetResourceTypeProperties (HCLUSTER hClusterIn, LPCWSTR pwszResTypeNameIn, DWORD dwControlCodeIn, HNODE hHostNodeIn=NULL, LPVOID lpBufferIn=NULL, size_t cbBufferIn=0)
DWORD | ScGetResourceTypeProperties (HCLUSTER hClusterIn, LPCWSTR pwszResTypeNameIn, DWORD dwControlCodeIn, HNODE hHostNodeIn=NULL, LPVOID lpBufferIn=NULL, size_t cbBufferIn=0)
DWORD | ScGetResourceTypeProperties (HCLUSTER hClusterIn, LPCWSTR pwszResTypeNameIn, DWORD dwControlCodeIn, HNODE hHostNodeIn=NULL, LPVOID lpBufferIn=NULL, size_t cbBufferIn=0)
DWORD | ScMoveToFirstProperty (void)
DWORD | ScMoveToFirstProperty (void)
DWORD | ScMoveToFirstProperty (void)
DWORD | ScMoveToFirstPropertyValue (void)
DWORD | ScMoveToFirstPropertyValue (void)
DWORD | ScMoveToFirstPropertyValue (void)
DWORD | ScMoveToNextProperty (void)
DWORD | ScMoveToNextProperty (void)
DWORD | ScMoveToNextProperty (void)
DWORD | ScMoveToNextPropertyValue (void)
DWORD | ScMoveToNextPropertyValue (void)
DWORD | ScMoveToNextPropertyValue (void)
DWORD | ScMoveToPropertyByName (LPCWSTR pwszPropNameIn)
DWORD | ScMoveToPropertyByName (LPCWSTR pwszPropNameIn)
DWORD | ScMoveToPropertyByName (LPCWSTR pwszPropNameIn)
DWORD | ScSetPropToDefault (LPCWSTR pwszNameIn, CLUSTER_PROPERTY_FORMAT propFormatIn)
DWORD | ScSetPropToDefault (LPCWSTR pwszNameIn, CLUSTER_PROPERTY_FORMAT propFormatIn)
DWORD | ScSetPropToDefault (LPCWSTR pwszNameIn, CLUSTER_PROPERTY_FORMAT propFormatIn)

Protected Member Functions

void | CopyEmptyProp (PCLUSPROP_VALUE ppropOut, CLUSTER_PROPERTY_TYPE cptPropTypeIn, CLUSTER_PROPERTY_FORMAT propFormatIn)
void | CopyEmptyProp (PCLUSPROP_VALUE ppropOut, CLUSTER_PROPERTY_TYPE cptPropTypeIn, CLUSTER_PROPERTY_FORMAT propFormatIn)
void | CopyEmptyProp (PCLUSPROP_VALUE ppropOut, CLUSTER_PROPERTY_TYPE cptPropTypeIn, CLUSTER_PROPERTY_FORMAT propFormatIn)
void | CopyExpandSzProp (PCLUSPROP_SZ ppropIn, CLUSTER_PROPERTY_TYPE cptPropTypeIn, LPCWSTR pszIn, size_t cbszIn=0)
void | CopyExpandSzProp (PCLUSPROP_SZ ppropIn, CLUSTER_PROPERTY_TYPE cptPropTypeIn, LPCWSTR pszIn, size_t cbszIn=0)
void | CopyExpandSzProp (PCLUSPROP_SZ ppropIn, CLUSTER_PROPERTY_TYPE cptPropTypeIn, LPCWSTR pszIn, size_t cbszIn=0)
void | CopyMultiSzProp (PCLUSPROP_MULTI_SZ ppropIn, CLUSTER_PROPERTY_TYPE cptPropTypeIn, LPCWSTR pszIn, size_t cbszIn=0)
void | CopyMultiSzProp (PCLUSPROP_MULTI_SZ ppropIn, CLUSTER_PROPERTY_TYPE cptPropTypeIn, LPCWSTR pszIn, size_t cbszIn=0)
void | CopyMultiSzProp (PCLUSPROP_MULTI_SZ ppropIn, CLUSTER_PROPERTY_TYPE cptPropTypeIn, LPCWSTR pszIn, size_t cbszIn=0)
void | CopyProp (PCLUSPROP_SZ ppropIn, CLUSTER_PROPERTY_TYPE cptPropTypeIn, LPCWSTR pszIn, size_t cbszIn=0)
void | CopyProp (PCLUSPROP_SZ ppropIn, CLUSTER_PROPERTY_TYPE cptPropTypeIn, LPCWSTR pszIn, size_t cbszIn=0)
void | CopyProp (PCLUSPROP_LONG ppropIn, CLUSTER_PROPERTY_TYPE cptPropTypeIn, LONG nValueIn)
void | CopyProp (PCLUSPROP_BINARY ppropOut, CLUSTER_PROPERTY_TYPE cptPropTypeIn, const unsigned char *pbValueIn, size_t cbValueIn)
void | CopyProp (PCLUSPROP_ULARGE_INTEGER ppropOut, CLUSTER_PROPERTY_TYPE cptPropTypeIn, LONGLONG llValueIn)
void | CopyProp (PCLUSPROP_LARGE_INTEGER ppropOut, CLUSTER_PROPERTY_TYPE cptPropTypeIn, LONGLONG llValueIn)
void | CopyProp (PCLUSPROP_ULARGE_INTEGER ppropOut, CLUSTER_PROPERTY_TYPE cptPropTypeIn, ULONGLONG ullValueIn)
void | CopyProp (PCLUSPROP_LARGE_INTEGER ppropOut, CLUSTER_PROPERTY_TYPE cptPropTypeIn, LONGLONG llValueIn)
void | CopyProp (PCLUSPROP_DWORD ppropIn, CLUSTER_PROPERTY_TYPE cptPropTypeIn, DWORD nValueIn)
void | CopyProp (PCLUSPROP_ULARGE_INTEGER ppropOut, CLUSTER_PROPERTY_TYPE cptPropTypeIn, ULONGLONG ullValueIn)
void | CopyProp (PCLUSPROP_ULARGE_INTEGER ppropOut, CLUSTER_PROPERTY_TYPE cptPropTypeIn, ULONGLONG ullValueIn)
void | CopyProp (PCLUSPROP_ULARGE_INTEGER ppropOut, CLUSTER_PROPERTY_TYPE cptPropTypeIn, LONGLONG llValueIn)
void | CopyProp (PCLUSPROP_SZ ppropIn, CLUSTER_PROPERTY_TYPE cptPropTypeIn, LPCWSTR pszIn, size_t cbszIn=0)
void | CopyProp (PCLUSPROP_BINARY ppropOut, CLUSTER_PROPERTY_TYPE cptPropTypeIn, const unsigned char *pbValueIn, size_t cbValueIn)
void | CopyProp (PCLUSPROP_ULARGE_INTEGER ppropOut, CLUSTER_PROPERTY_TYPE cptPropTypeIn, LONGLONG llValueIn)
void | CopyProp (PCLUSPROP_BINARY ppropOut, CLUSTER_PROPERTY_TYPE cptPropTypeIn, const unsigned char *pbValueIn, size_t cbValueIn)
void | CopyProp (PCLUSPROP_DWORD ppropIn, CLUSTER_PROPERTY_TYPE cptPropTypeIn, DWORD nValueIn)
void | CopyProp (PCLUSPROP_LARGE_INTEGER ppropOut, CLUSTER_PROPERTY_TYPE cptPropTypeIn, LONGLONG llValueIn)
void | CopyProp (PCLUSPROP_DWORD ppropIn, CLUSTER_PROPERTY_TYPE cptPropTypeIn, DWORD nValueIn)
void | CopyProp (PCLUSPROP_LONG ppropIn, CLUSTER_PROPERTY_TYPE cptPropTypeIn, LONG nValueIn)
void | CopyProp (PCLUSPROP_LONG ppropIn, CLUSTER_PROPERTY_TYPE cptPropTypeIn, LONG nValueIn)

Protected Attributes

DWORD m_cbBufferSize
DWORD m_cbDataLeft
DWORD m_cbDataSize
CLUSPROP_BUFFER_HELPER | m_cbhCurrentProp
CLUSPROP_BUFFER_HELPER | m_cbhPropList
BOOL m_fAlwaysAddProp

Private Attributes

CLUSPROP_BUFFER_HELPER | m_cbhCurrentPropName
DWORD m_nPropsRemaining
CClusPropValueList m_pvlValues

Detailed Description

Definition at line 680 of file PropList.h.

Constructor & Destructor Documentation

CClusPropList::CClusPropList ( BOOL bAlwaysAddPropIn = FALSE ) [inline]

Definition at line 696 of file PropList.h.

        : m_fAlwaysAddProp( bAlwaysAddPropIn )
        , m_cbBufferSize( 0 )
        , m_cbDataSize( 0 )
        , m_cbDataLeft( 0 )
        , m_nPropsRemaining( 0 )
    {
        m_cbhPropList.pList     = NULL;
        m_cbhCurrentProp.pb     = NULL;
        m_cbhCurrentPropName.pb = NULL;

    } //*** CClusPropList

CClusPropList::~CClusPropList ( void ) [inline]

Definition at line 712 of file PropList.h.

    {
        DeletePropList();

    } //*** ~CClusPropList

CClusPropList::CClusPropList ( BOOL bAlwaysAddPropIn = FALSE ) [inline]

Definition at line 696 of file PropList.h.

        : m_fAlwaysAddProp( bAlwaysAddPropIn )
        , m_cbBufferSize( 0 )
        , m_cbDataSize( 0 )
        , m_cbDataLeft( 0 )
        , m_nPropsRemaining( 0 )
    {
        m_cbhPropList.pList     = NULL;
        m_cbhCurrentProp.pb     = NULL;
        m_cbhCurrentPropName.pb = NULL;

    } //*** CClusPropList

CClusPropList::~CClusPropList ( void ) [inline]

Definition at line 712 of file PropList.h.

    {
        DeletePropList();

    } //*** ~CClusPropList

CClusPropList::CClusPropList ( BOOL bAlwaysAddPropIn = FALSE ) [inline]

Definition at line 592 of file PropList.h.

        : m_fAlwaysAddProp( bAlwaysAddPropIn )
        , m_cbBufferSize( 0 )
        , m_cbDataSize( 0 )
        , m_cbDataLeft( 0 )
        , m_nPropsRemaining( 0 )
    {
        m_cbhPropList.pList     = NULL;
        m_cbhCurrentProp.pb     = NULL;
        m_cbhCurrentPropName.pb = NULL;

    } //*** CClusPropList

CClusPropList::~CClusPropList ( void ) [inline]

Definition at line 608 of file PropList.h.

    {
        DeletePropList();

    } //*** ~CClusPropList

Member Function Documentation

BOOL CClusPropList::BIsListEmpty ( void ) const [inline]

Definition at line 939 of file PropList.h.

    {
        ASSERT( m_cbhPropList.pb != NULL );
        ASSERT( m_cbDataSize >= sizeof( m_cbhPropList.pList->nPropertyCount ) );

        return m_cbhPropList.pList->nPropertyCount == 0;

    } //*** BIsListEmpty

BOOL CClusPropList::BIsListEmpty ( void ) const [inline]

Definition at line 939 of file PropList.h.

    {
        ASSERT( m_cbhPropList.pb != NULL );
        ASSERT( m_cbDataSize >= sizeof( m_cbhPropList.pList->nPropertyCount ) );

        return m_cbhPropList.pList->nPropertyCount == 0;

    } //*** BIsListEmpty

BOOL CClusPropList::BIsListEmpty ( void ) const [inline]

Definition at line 835 of file PropList.h.

    {
        ASSERT( m_cbhPropList.pb != NULL );
        ASSERT( m_cbDataSize >= sizeof( m_cbhPropList.pList->nPropertyCount ) );

        return m_cbhPropList.pList->nPropertyCount == 0;

    } //*** BIsListEmpty

DWORD CClusPropList::CbBufferSize ( void ) const [inline]

Definition at line 777 of file PropList.h.

    {
        return m_cbBufferSize;

    } //*** CbBufferSize

DWORD CClusPropList::CbBufferSize ( void ) const [inline]

Definition at line 777 of file PropList.h.

    {
        return m_cbBufferSize;

    } //*** CbBufferSize

DWORD CClusPropList::CbBufferSize ( void ) const [inline]

Definition at line 673 of file PropList.h.

    {
        return m_cbBufferSize;

    } //*** CbBufferSize

DWORD CClusPropList::CbCurrentValueLength ( void ) const [inline]

Definition at line 729 of file PropList.h.

    {
        return m_pvlValues.CbCurrentValueLength();

    } //*** CbCurrentValueLength

DWORD CClusPropList::CbCurrentValueLength ( void ) const [inline]

Definition at line 833 of file PropList.h.

    {
        return m_pvlValues.CbCurrentValueLength();

    } //*** CbCurrentValueLength

DWORD CClusPropList::CbCurrentValueLength ( void ) const [inline]

Definition at line 833 of file PropList.h.

    {
        return m_pvlValues.CbCurrentValueLength();

    } //*** CbCurrentValueLength

DWORD CClusPropList::CbDataLeft ( void ) const [inline]

Definition at line 760 of file PropList.h.

    {
        return m_cbDataLeft;

    } //*** CbDataLeft

DWORD CClusPropList::CbDataLeft ( void ) const [inline]

Definition at line 864 of file PropList.h.

    {
        return m_cbDataLeft;

    } //*** CbDataLeft

DWORD CClusPropList::CbDataLeft ( void ) const [inline]

Definition at line 864 of file PropList.h.

    {
        return m_cbDataLeft;

    } //*** CbDataLeft

const CLUSPROP_BUFFER_HELPER CClusPropList::CbhCurrentPropertyName ( void ) [inline]

Definition at line 791 of file PropList.h.

    {
        return m_cbhCurrentPropName;

    } //*** CbhCurrentPropertyName

const CLUSPROP_BUFFER_HELPER CClusPropList::CbhCurrentPropertyName ( void ) [inline]

Definition at line 791 of file PropList.h.

    {
        return m_cbhCurrentPropName;

    } //*** CbhCurrentPropertyName

const CLUSPROP_BUFFER_HELPER CClusPropList::CbhCurrentPropertyName ( void ) [inline]

Definition at line 687 of file PropList.h.

    {
        return m_cbhCurrentPropName;

    } //*** CbhCurrentPropertyName

const CLUSPROP_BUFFER_HELPER CClusPropList::CbhCurrentValue ( void ) [inline]

Definition at line 805 of file PropList.h.

    {
        return m_pvlValues.CbhCurrentValue();

    } //*** CbhCurrentValue

const CLUSPROP_BUFFER_HELPER CClusPropList::CbhCurrentValue ( void ) [inline]

Definition at line 805 of file PropList.h.

    {
        return m_pvlValues.CbhCurrentValue();

    } //*** CbhCurrentValue

const CLUSPROP_BUFFER_HELPER CClusPropList::CbhCurrentValue ( void ) [inline]

Definition at line 701 of file PropList.h.

    {
        return m_pvlValues.CbhCurrentValue();

    } //*** CbhCurrentValue

const CLUSPROP_BUFFER_HELPER CClusPropList::CbhCurrentValueList ( void ) [inline]

Definition at line 798 of file PropList.h.

    {
        return m_pvlValues.CbhValueList();

    } //*** CbhCurrentValueList

const CLUSPROP_BUFFER_HELPER CClusPropList::CbhCurrentValueList ( void ) [inline]

Definition at line 798 of file PropList.h.

    {
        return m_pvlValues.CbhValueList();

    } //*** CbhCurrentValueList

const CLUSPROP_BUFFER_HELPER CClusPropList::CbhCurrentValueList ( void ) [inline]

Definition at line 694 of file PropList.h.

    {
        return m_pvlValues.CbhValueList();

    } //*** CbhCurrentValueList

const CLUSPROP_BUFFER_HELPER CClusPropList::CbhPropList ( void ) const [inline]

Definition at line 741 of file PropList.h.

    {
        return m_cbhPropList;

    } //*** CbhPropList

const CLUSPROP_BUFFER_HELPER CClusPropList::CbhPropList ( void ) const [inline]

Definition at line 845 of file PropList.h.

    {
        return m_cbhPropList;

    } //*** CbhPropList

const CLUSPROP_BUFFER_HELPER CClusPropList::CbhPropList ( void ) const [inline]

Definition at line 845 of file PropList.h.

    {
        return m_cbhPropList;

    } //*** CbhPropList

DWORD CClusPropList::CbPropList ( void ) const [inline]

Definition at line 753 of file PropList.h.

    {
        return m_cbDataSize + sizeof( CLUSPROP_SYNTAX ); /*endmark*/

    } //*** CbPropList

DWORD CClusPropList::CbPropList ( void ) const [inline]

Definition at line 857 of file PropList.h.

    {
        return m_cbDataSize + sizeof( CLUSPROP_SYNTAX ); /*endmark*/

    } //*** CbPropList

DWORD CClusPropList::CbPropList ( void ) const [inline]

Definition at line 857 of file PropList.h.

    {
        return m_cbDataSize + sizeof( CLUSPROP_SYNTAX ); /*endmark*/

    } //*** CbPropList

void CClusPropList::ClearPropList ( void ) [inline]

Definition at line 852 of file PropList.h.

    {
        m_cbDataSize = 0;
        m_cbDataLeft = 0;

        if ( m_cbBufferSize != 0 )
        {
            ZeroMemory( m_cbhPropList.pb, m_cbBufferSize );
            m_cbhCurrentProp.pb = m_cbhPropList.pb + sizeof( m_cbhPropList.pList->nPropertyCount );
            m_cbhCurrentPropName = m_cbhCurrentProp;
        } // if:  buffer already allocated

    } //*** ClearPropList

void CClusPropList::ClearPropList ( void ) [inline]

Definition at line 956 of file PropList.h.

    {
        m_cbDataSize = 0;
        m_cbDataLeft = 0;

        if ( m_cbBufferSize != 0 )
        {
            ZeroMemory( m_cbhPropList.pb, m_cbBufferSize );
            m_cbhCurrentProp.pb = m_cbhPropList.pb + sizeof( m_cbhPropList.pList->nPropertyCount );
            m_cbhCurrentPropName = m_cbhCurrentProp;
        } // if:  buffer already allocated

    } //*** ClearPropList

void CClusPropList::ClearPropList ( void ) [inline]

Definition at line 956 of file PropList.h.

    {
        m_cbDataSize = 0;
        m_cbDataLeft = 0;

        if ( m_cbBufferSize != 0 )
        {
            ZeroMemory( m_cbhPropList.pb, m_cbBufferSize );
            m_cbhCurrentProp.pb = m_cbhPropList.pb + sizeof( m_cbhPropList.pList->nPropertyCount );
            m_cbhCurrentPropName = m_cbhCurrentProp;
        } // if:  buffer already allocated

    } //*** ClearPropList

void CClusPropList::CopyEmptyProp | ( | PCLUSPROP_VALUE | ppropOut,
 |  | CLUSTER_PROPERTY_TYPE | cptPropTypeIn,
 |  | CLUSTER_PROPERTY_FORMAT | propFormatIn |
 | ) |  |  | [protected]
void CClusPropList::CopyEmptyProp | ( | PCLUSPROP_VALUE | ppropOut,
 |  | CLUSTER_PROPERTY_TYPE | cptPropTypeIn,
 |  | CLUSTER_PROPERTY_FORMAT | propFormatIn |
 | ) |  |  | [protected]

Definition at line 2683 of file PropList.cpp.

{
    ASSERT( ppropOut != NULL );

    CLUSPROP_BUFFER_HELPER  cbhProps;

    ppropOut->Syntax.wFormat = static_cast< WORD >( cptPropFmt );
    ppropOut->Syntax.wType = static_cast< WORD >( cptPropTypeIn );
    ppropOut->cbLength = 0;

    //
    // Set an endmark.
    //

    cbhProps.pValue = ppropOut;
    cbhProps.pb += sizeof( *cbhProps.pValue );
    cbhProps.pSyntax->dw = CLUSPROP_SYNTAX_ENDMARK;

} //*** CClusPropList::CopyEmptyProp

void CClusPropList::CopyEmptyProp | ( | PCLUSPROP_VALUE | ppropOut,
 |  | CLUSTER_PROPERTY_TYPE | cptPropTypeIn,
 |  | CLUSTER_PROPERTY_FORMAT | propFormatIn |
 | ) |  |  | [protected]
void CClusPropList::CopyExpandSzProp | ( | PCLUSPROP_SZ | ppropIn,
 |  | CLUSTER_PROPERTY_TYPE | cptPropTypeIn,
 |  | LPCWSTR | pszIn,
 |  | size_t | cbszIn = 0 |
 | ) |  |  | [protected]
void CClusPropList::CopyExpandSzProp | ( | PCLUSPROP_SZ | ppropIn,
 |  | CLUSTER_PROPERTY_TYPE | cptPropTypeIn,
 |  | LPCWSTR | pszIn,
 |  | size_t | cbszIn = 0 |
 | ) |  |  | [protected]

Definition at line 2387 of file PropList.cpp.

{
    ASSERT( ppropOut != NULL );
    ASSERT( pszIn != NULL );

    CLUSPROP_BUFFER_HELPER  cbhProps;
    HRESULT                 hr = S_OK;

    ppropOut->Syntax.wFormat = CLUSPROP_FORMAT_EXPAND_SZ;
    ppropOut->Syntax.wType = static_cast< WORD >( cptPropTypeIn );

    if ( cbSzIn == 0 )
    {
        cbSzIn = (lstrlenW( pszIn ) + 1) * sizeof( *pszIn );
    } // if: cbSzIn == 0

    ASSERT( cbSzIn == (lstrlenW( pszIn ) + 1) * sizeof( *pszIn ) );

    ppropOut->cbLength = static_cast< DWORD >( cbSzIn );

    hr = StringCbCopyW( ppropOut->sz, cbSzIn, pszIn );
    if ( SUCCEEDED( hr ) )
    {
        //
        // Set an endmark.
        //

        cbhProps.pStringValue = ppropOut;
        cbhProps.pb += sizeof( *cbhProps.pStringValue ) + ALIGN_CLUSPROP( cbSzIn );
        cbhProps.pSyntax->dw = CLUSPROP_SYNTAX_ENDMARK;
    } // if:

} //*** CClusPropList::CopyExpandSzProp

void CClusPropList::CopyExpandSzProp | ( | PCLUSPROP_SZ | ppropIn,
 |  | CLUSTER_PROPERTY_TYPE | cptPropTypeIn,
 |  | LPCWSTR | pszIn,
 |  | size_t | cbszIn = 0 |
 | ) |  |  | [protected]
void CClusPropList::CopyMultiSzProp | ( | PCLUSPROP_MULTI_SZ | ppropIn,
 |  | CLUSTER_PROPERTY_TYPE | cptPropTypeIn,
 |  | LPCWSTR | pszIn,
 |  | size_t | cbszIn = 0 |
 | ) |  |  | [protected]
void CClusPropList::CopyMultiSzProp | ( | PCLUSPROP_MULTI_SZ | ppropIn,
 |  | CLUSTER_PROPERTY_TYPE | cptPropTypeIn,
 |  | LPCWSTR | pszIn,
 |  | size_t | cbszIn = 0 |
 | ) |  |  | [protected]

Definition at line 2332 of file PropList.cpp.

{
    ASSERT( ppropOut != NULL );
    ASSERT( pszIn != NULL );

    CLUSPROP_BUFFER_HELPER  cbhProps;

    ppropOut->Syntax.wFormat = CLUSPROP_FORMAT_MULTI_SZ;
    ppropOut->Syntax.wType = static_cast< WORD >( cptPropTypeIn );

    if ( cbSzIn == 0 )
    {
        cbSzIn = (CchMultiSz( pszIn ) + 1) * sizeof( *pszIn );
    } // if: zero size specified

    ASSERT( cbSzIn == (CchMultiSz( pszIn ) + 1) * sizeof( *pszIn ) );

    ppropOut->cbLength = static_cast< DWORD >( cbSzIn );
    CopyMemory( ppropOut->sz, pszIn, cbSzIn );

    //
    // Set an endmark.
    //

    cbhProps.pMultiSzValue = ppropOut;
    cbhProps.pb += sizeof( *cbhProps.pMultiSzValue ) + ALIGN_CLUSPROP( cbSzIn );
    cbhProps.pSyntax->dw = CLUSPROP_SYNTAX_ENDMARK;

} //*** CClusPropList::CopyMultiSzProp

void CClusPropList::CopyMultiSzProp | ( | PCLUSPROP_MULTI_SZ | ppropIn,
 |  | CLUSTER_PROPERTY_TYPE | cptPropTypeIn,
 |  | LPCWSTR | pszIn,
 |  | size_t | cbszIn = 0 |
 | ) |  |  | [protected]
void CClusPropList::CopyProp | ( | PCLUSPROP_SZ | ppropIn,
 |  | CLUSTER_PROPERTY_TYPE | cptPropTypeIn,
 |  | LPCWSTR | pszIn,
 |  | size_t | cbszIn = 0 |
 | ) |  |  | [protected]
void CClusPropList::CopyProp | ( | PCLUSPROP_LONG | ppropIn,
 |  | CLUSTER_PROPERTY_TYPE | cptPropTypeIn,
 |  | LONG | nValueIn |
 | ) |  |  | [protected]
void CClusPropList::CopyProp | ( | PCLUSPROP_ULARGE_INTEGER | ppropOut,
 |  | CLUSTER_PROPERTY_TYPE | cptPropTypeIn,
 |  | ULONGLONG | ullValueIn |
 | ) |  |  | [protected]
void CClusPropList::CopyProp | ( | PCLUSPROP_LARGE_INTEGER | ppropOut,
 |  | CLUSTER_PROPERTY_TYPE | cptPropTypeIn,
 |  | LONGLONG | llValueIn |
 | ) |  |  | [protected]
void CClusPropList::CopyProp | ( | PCLUSPROP_DWORD | ppropIn,
 |  | CLUSTER_PROPERTY_TYPE | cptPropTypeIn,
 |  | DWORD | nValueIn |
 | ) |  |  | [protected]
void CClusPropList::CopyProp | ( | PCLUSPROP_BINARY | ppropOut,
 |  | CLUSTER_PROPERTY_TYPE | cptPropTypeIn,
 |  | const unsigned char * | pbValueIn,
 |  | size_t | cbValueIn |
 | ) |  |  | [protected]
void CClusPropList::CopyProp | ( | PCLUSPROP_ULARGE_INTEGER | ppropOut,
 |  | CLUSTER_PROPERTY_TYPE | cptPropTypeIn,
 |  | LONGLONG | llValueIn |
 | ) |  |  | [protected]
void CClusPropList::CopyProp | ( | PCLUSPROP_SZ | ppropIn,
 |  | CLUSTER_PROPERTY_TYPE | cptPropTypeIn,
 |  | LPCWSTR | pszIn,
 |  | size_t | cbszIn = 0 |
 | ) |  |  | [protected]

Definition at line 2272 of file PropList.cpp.

{
    ASSERT( ppropOut != NULL );
    ASSERT( pszIn != NULL );

    CLUSPROP_BUFFER_HELPER  cbhProps;
    HRESULT                 hr = S_OK;

    ppropOut->Syntax.wFormat = CLUSPROP_FORMAT_SZ;
    ppropOut->Syntax.wType = static_cast< WORD >( cptPropTypeIn );

    if ( cbSzIn == 0 )
    {
        cbSzIn = (lstrlenW( pszIn ) + 1) * sizeof( *pszIn );
    } // if: zero size specified

    ASSERT( cbSzIn == (lstrlenW( pszIn ) + 1) * sizeof( *pszIn ) );

    ppropOut->cbLength = static_cast< DWORD >( cbSzIn );

    hr = StringCbCopyW( ppropOut->sz, cbSzIn, pszIn );
    if ( SUCCEEDED( hr ) )
    {
        //
        // Set an endmark.
        //

        cbhProps.pStringValue = ppropOut;
        cbhProps.pb += sizeof( *cbhProps.pStringValue ) + ALIGN_CLUSPROP( cbSzIn );
        cbhProps.pSyntax->dw = CLUSPROP_SYNTAX_ENDMARK;
    } // if:

} //*** CClusPropList::CopyProp

void CClusPropList::CopyProp | ( | PCLUSPROP_LONG | ppropIn,
 |  | CLUSTER_PROPERTY_TYPE | cptPropTypeIn,
 |  | LONG | nValueIn |
 | ) |  |  | [protected]

Definition at line 2489 of file PropList.cpp.

{
    ASSERT( ppropOut != NULL );

    CLUSPROP_BUFFER_HELPER  cbhProps;

    ppropOut->Syntax.wFormat = CLUSPROP_FORMAT_LONG;
    ppropOut->Syntax.wType = static_cast< WORD >( cptPropTypeIn );
    ppropOut->cbLength = sizeof( DWORD );
    ppropOut->l = nValueIn;

    //
    // Set an endmark.
    //

    cbhProps.pLongValue = ppropOut;
    cbhProps.pb += sizeof( *cbhProps.pLongValue );
    cbhProps.pSyntax->dw = CLUSPROP_SYNTAX_ENDMARK;

} //*** CClusPropList::CopyProp( LONG )

void CClusPropList::CopyProp | ( | PCLUSPROP_SZ | ppropIn,
 |  | CLUSTER_PROPERTY_TYPE | cptPropTypeIn,
 |  | LPCWSTR | pszIn,
 |  | size_t | cbszIn = 0 |
 | ) |  |  | [protected]
void CClusPropList::CopyProp | ( | PCLUSPROP_DWORD | ppropIn,
 |  | CLUSTER_PROPERTY_TYPE | cptPropTypeIn,
 |  | DWORD | nValueIn |
 | ) |  |  | [protected]

Definition at line 2445 of file PropList.cpp.

{
    ASSERT( ppropOut != NULL );

    CLUSPROP_BUFFER_HELPER  cbhProps;

    ppropOut->Syntax.wFormat = CLUSPROP_FORMAT_DWORD;
    ppropOut->Syntax.wType = static_cast< WORD >( cptPropTypeIn );
    ppropOut->cbLength = sizeof( DWORD );
    ppropOut->dw = nValueIn;

    //
    // Set an endmark.
    //

    cbhProps.pDwordValue = ppropOut;
    cbhProps.pb += sizeof( *cbhProps.pDwordValue );
    cbhProps.pSyntax->dw = CLUSPROP_SYNTAX_ENDMARK;

} //*** CClusPropList::CopyProp( DWORD )

void CClusPropList::CopyProp | ( | PCLUSPROP_ULARGE_INTEGER | ppropOut,
 |  | CLUSTER_PROPERTY_TYPE | cptPropTypeIn,
 |  | ULONGLONG | ullValueIn |
 | ) |  |  | [protected]

Definition at line 2533 of file PropList.cpp.

{
    ASSERT( ppropOut != NULL );

    CLUSPROP_BUFFER_HELPER  cbhProps;

    ppropOut->Syntax.wFormat = CLUSPROP_FORMAT_ULARGE_INTEGER;
    ppropOut->Syntax.wType = static_cast< WORD >( cptPropTypeIn );
    ppropOut->cbLength = sizeof( ULONGLONG );

    //
    // ppropOut may not have the correct alignment for large ints; copy as two
    // DWORDs to be safe
    //

    ppropOut->li.u = ((ULARGE_INTEGER *)&ullValueIn)->u;

    //
    // Set an endmark.
    //

    cbhProps.pULargeIntegerValue = ppropOut;
    cbhProps.pb += sizeof( *cbhProps.pULargeIntegerValue );
    cbhProps.pSyntax->dw = CLUSPROP_SYNTAX_ENDMARK;

} //*** CClusPropList::CopyProp( ULONGLONG )

void CClusPropList::CopyProp | ( | PCLUSPROP_LARGE_INTEGER | ppropOut,
 |  | CLUSTER_PROPERTY_TYPE | cptPropTypeIn,
 |  | LONGLONG | llValueIn |
 | ) |  |  | [protected]

Definition at line 2583 of file PropList.cpp.

{
    ASSERT( ppropOut != NULL );

    CLUSPROP_BUFFER_HELPER  cbhProps;

    ppropOut->Syntax.wFormat = CLUSPROP_FORMAT_LARGE_INTEGER;
    ppropOut->Syntax.wType = static_cast< WORD >( cptPropTypeIn );
    ppropOut->cbLength = sizeof( LONGLONG );

    //
    // ppropOut may not have the correct alignment for large ints; copy as two
    // DWORDs to be safe
    //

    ppropOut->li.u = ((LARGE_INTEGER *)&llValueIn)->u;

    //
    // Set an endmark.
    //

    cbhProps.pLargeIntegerValue = ppropOut;
    cbhProps.pb += sizeof( *cbhProps.pLargeIntegerValue );
    cbhProps.pSyntax->dw = CLUSPROP_SYNTAX_ENDMARK;

} //*** CClusPropList::CopyProp( LONGLONG )

void CClusPropList::CopyProp | ( | PCLUSPROP_DWORD | ppropIn,
 |  | CLUSTER_PROPERTY_TYPE | cptPropTypeIn,
 |  | DWORD | nValueIn |
 | ) |  |  | [protected]
void CClusPropList::CopyProp | ( | PCLUSPROP_LONG | ppropIn,
 |  | CLUSTER_PROPERTY_TYPE | cptPropTypeIn,
 |  | LONG | nValueIn |
 | ) |  |  | [protected]
void CClusPropList::CopyProp | ( | PCLUSPROP_BINARY | ppropOut,
 |  | CLUSTER_PROPERTY_TYPE | cptPropTypeIn,
 |  | const unsigned char * | pbValueIn,
 |  | size_t | cbValueIn |
 | ) |  |  | [protected]

Definition at line 2634 of file PropList.cpp.

{
    ASSERT( ppropOut != NULL );

    CLUSPROP_BUFFER_HELPER  cbhProps;

    ppropOut->Syntax.wFormat = CLUSPROP_FORMAT_BINARY;
    ppropOut->Syntax.wType = static_cast< WORD >( cptPropTypeIn );
    ppropOut->cbLength = static_cast< DWORD >( cbValueIn );

    if ( cbValueIn > 0 )
    {
        CopyMemory( ppropOut->rgb, pbValueIn, cbValueIn );
    } // if: non-zero data length

    //
    // Set an endmark.
    //

    cbhProps.pBinaryValue = ppropOut;
    cbhProps.pb += sizeof( *cbhProps.pStringValue ) + ALIGN_CLUSPROP( cbValueIn );
    cbhProps.pSyntax->dw = CLUSPROP_SYNTAX_ENDMARK;

} //*** CClusPropList::CopyProp( PBYTE )

void CClusPropList::CopyProp | ( | PCLUSPROP_ULARGE_INTEGER | ppropOut,
 |  | CLUSTER_PROPERTY_TYPE | cptPropTypeIn,
 |  | ULONGLONG | ullValueIn |
 | ) |  |  | [protected]
void CClusPropList::CopyProp | ( | PCLUSPROP_LARGE_INTEGER | ppropOut,
 |  | CLUSTER_PROPERTY_TYPE | cptPropTypeIn,
 |  | LONGLONG | llValueIn |
 | ) |  |  | [protected]
void CClusPropList::CopyProp | ( | PCLUSPROP_ULARGE_INTEGER | ppropOut,
 |  | CLUSTER_PROPERTY_TYPE | cptPropTypeIn,
 |  | LONGLONG | llValueIn |
 | ) |  |  | [protected]
void CClusPropList::CopyProp | ( | PCLUSPROP_BINARY | ppropOut,
 |  | CLUSTER_PROPERTY_TYPE | cptPropTypeIn,
 |  | const unsigned char * | pbValueIn,
 |  | size_t | cbValueIn |
 | ) |  |  | [protected]
void CClusPropList::CopyProp | ( | PCLUSPROP_ULARGE_INTEGER | ppropOut,
 |  | CLUSTER_PROPERTY_TYPE | cptPropTypeIn,
 |  | LONGLONG | llValueIn |
 | ) |  |  | [protected]
CLUSTER_PROPERTY_FORMAT CClusPropList::CpfCurrentValueFormat ( void ) const [inline]

Definition at line 812 of file PropList.h.

    {
        return m_pvlValues.CpfCurrentValueFormat();

    } //*** CpfCurrentValueFormat

CLUSTER_PROPERTY_FORMAT CClusPropList::CpfCurrentValueFormat ( void ) const [inline]

Definition at line 812 of file PropList.h.

    {
        return m_pvlValues.CpfCurrentValueFormat();

    } //*** CpfCurrentValueFormat

CLUSTER_PROPERTY_FORMAT CClusPropList::CpfCurrentValueFormat ( void ) const [inline]

Definition at line 708 of file PropList.h.

    {
        return m_pvlValues.CpfCurrentValueFormat();

    } //*** CpfCurrentValueFormat

DWORD CClusPropList::Cprops ( void ) const [inline]

Definition at line 766 of file PropList.h.

    {
        if ( m_cbhPropList.pb == NULL )
        {
            return 0;
        } // if:  no buffer yet

        return m_cbhPropList.pList->nPropertyCount;

    } //*** Cprops

DWORD CClusPropList::Cprops ( void ) const [inline]

Definition at line 870 of file PropList.h.

    {
        if ( m_cbhPropList.pb == NULL )
        {
            return 0;
        } // if:  no buffer yet

        return m_cbhPropList.pList->nPropertyCount;

    } //*** Cprops

DWORD CClusPropList::Cprops ( void ) const [inline]

Definition at line 870 of file PropList.h.

    {
        if ( m_cbhPropList.pb == NULL )
        {
            return 0;
        } // if:  no buffer yet

        return m_cbhPropList.pList->nPropertyCount;

    } //*** Cprops

CLUSTER_PROPERTY_SYNTAX CClusPropList::CpsCurrentValueSyntax ( void ) const [inline]

Definition at line 722 of file PropList.h.

    {
        return m_pvlValues.CpsCurrentValueSyntax();

    } //*** CpsCurrentValueSyntax

CLUSTER_PROPERTY_SYNTAX CClusPropList::CpsCurrentValueSyntax ( void ) const [inline]

Definition at line 826 of file PropList.h.

    {
        return m_pvlValues.CpsCurrentValueSyntax();

    } //*** CpsCurrentValueSyntax

CLUSTER_PROPERTY_SYNTAX CClusPropList::CpsCurrentValueSyntax ( void ) const [inline]

Definition at line 826 of file PropList.h.

    {
        return m_pvlValues.CpsCurrentValueSyntax();

    } //*** CpsCurrentValueSyntax

CLUSTER_PROPERTY_TYPE CClusPropList::CptCurrentValueType ( void ) const [inline]

Definition at line 715 of file PropList.h.

    {
        return m_pvlValues.CptCurrentValueType();

    } //*** CptCurrentValueType

CLUSTER_PROPERTY_TYPE CClusPropList::CptCurrentValueType ( void ) const [inline]

Definition at line 819 of file PropList.h.

    {
        return m_pvlValues.CptCurrentValueType();

    } //*** CptCurrentValueType

CLUSTER_PROPERTY_TYPE CClusPropList::CptCurrentValueType ( void ) const [inline]

Definition at line 819 of file PropList.h.

    {
        return m_pvlValues.CptCurrentValueType();

    } //*** CptCurrentValueType

void CClusPropList::DeletePropList ( void ) [inline]

Definition at line 725 of file PropList.h.

    {
        delete [] m_cbhPropList.pb;

        m_cbhPropList.pb = NULL;
        m_cbhCurrentProp.pb = NULL;
        m_cbhCurrentPropName.pb = NULL;
        m_cbBufferSize = 0;
        m_cbDataSize = 0;
        m_cbDataLeft = 0;

    } //*** DeletePropList

void CClusPropList::DeletePropList ( void ) [inline]

Definition at line 621 of file PropList.h.

    {
        delete [] m_cbhPropList.pb;

        m_cbhPropList.pb = NULL;
        m_cbhCurrentProp.pb = NULL;
        m_cbhCurrentPropName.pb = NULL;
        m_cbBufferSize = 0;
        m_cbDataSize = 0;
        m_cbDataLeft = 0;

    } //*** DeletePropList

void CClusPropList::DeletePropList ( void ) [inline]

Definition at line 725 of file PropList.h.

    {
        delete [] m_cbhPropList.pb;

        m_cbhPropList.pb = NULL;
        m_cbhCurrentProp.pb = NULL;
        m_cbhCurrentPropName.pb = NULL;
        m_cbBufferSize = 0;
        m_cbDataSize = 0;
        m_cbDataLeft = 0;

    } //*** DeletePropList

void CClusPropList::InitSize ( size_t cbSizeIn ) [inline]

Definition at line 783 of file PropList.h.

    {
        ASSERT( m_cbhPropList.pb != NULL );
        ASSERT( m_cbBufferSize > 0 );

        m_cbDataSize = cbSizeIn;
        m_cbDataLeft = cbSizeIn;

    } //*** InitSize

void CClusPropList::InitSize ( size_t cbSizeIn ) [inline]

Definition at line 887 of file PropList.h.

    {
        ASSERT( m_cbhPropList.pb != NULL );
        ASSERT( m_cbBufferSize > 0 );

        m_cbDataSize = cbSizeIn;
        m_cbDataLeft = cbSizeIn;

    } //*** InitSize

void CClusPropList::InitSize ( size_t cbSizeIn ) [inline]

Definition at line 887 of file PropList.h.

    {
        ASSERT( m_cbhPropList.pb != NULL );
        ASSERT( m_cbBufferSize > 0 );

        m_cbDataSize = cbSizeIn;
        m_cbDataLeft = cbSizeIn;

    } //*** InitSize

CClusPropList::operator PCLUSPROP_LIST ( void ) const [inline]

Definition at line 770 of file PropList.h.

    {
        return m_cbhPropList.pList;

    } //*** operator PCLUSPROP_LIST

CClusPropList::operator PCLUSPROP_LIST ( void ) const [inline]

Definition at line 666 of file PropList.h.

    {
        return m_cbhPropList.pList;

    } //*** operator PCLUSPROP_LIST

CClusPropList::operator PCLUSPROP_LIST ( void ) const [inline]

Definition at line 770 of file PropList.h.

    {
        return m_cbhPropList.pList;

    } //*** operator PCLUSPROP_LIST

PBYTE CClusPropList::PbPropList ( void ) const [inline]

Definition at line 747 of file PropList.h.

    {
        return m_cbhPropList.pb;

    } //*** PbPropList

PBYTE CClusPropList::PbPropList ( void ) const [inline]

Definition at line 851 of file PropList.h.

    {
        return m_cbhPropList.pb;

    } //*** PbPropList

PBYTE CClusPropList::PbPropList ( void ) const [inline]

Definition at line 851 of file PropList.h.

    {
        return m_cbhPropList.pb;

    } //*** PbPropList

PCLUSPROP_LIST CClusPropList::Plist ( void ) [inline]

Definition at line 735 of file PropList.h.

    {
        return m_cbhPropList.pList;

    } //*** Plist

PCLUSPROP_LIST CClusPropList::Plist ( void ) [inline]

Definition at line 839 of file PropList.h.

    {
        return m_cbhPropList.pList;

    } //*** Plist

PCLUSPROP_LIST CClusPropList::Plist ( void ) [inline]

Definition at line 839 of file PropList.h.

    {
        return m_cbhPropList.pList;

    } //*** Plist

LPCWSTR CClusPropList::PszCurrentPropertyName ( void ) const [inline]

Definition at line 784 of file PropList.h.

    {
        return m_cbhCurrentPropName.pName->sz;

    } //*** PszCurrentPropertyName

LPCWSTR CClusPropList::PszCurrentPropertyName ( void ) const [inline]

Definition at line 680 of file PropList.h.

    {
        return m_cbhCurrentPropName.pName->sz;

    } //*** PszCurrentPropertyName

LPCWSTR CClusPropList::PszCurrentPropertyName ( void ) const [inline]

Definition at line 784 of file PropList.h.

    {
        return m_cbhCurrentPropName.pName->sz;

    } //*** PszCurrentPropertyName

const CClusPropValueList& CClusPropList::RPvlPropertyValue ( void ) [inline]

Definition at line 763 of file PropList.h.

    {
        return m_pvlValues;

    } //*** RPvlPropertyValue

const CClusPropValueList& CClusPropList::RPvlPropertyValue ( void ) [inline]

Definition at line 659 of file PropList.h.

    {
        return m_pvlValues;

    } //*** RPvlPropertyValue

const CClusPropValueList& CClusPropList::RPvlPropertyValue ( void ) [inline]

Definition at line 763 of file PropList.h.

    {
        return m_pvlValues;

    } //*** RPvlPropertyValue

DWORD CClusPropList::ScAddExpandSzProp | ( | LPCWSTR | pwszNameIn,
 |  | LPCWSTR | pwszValueIn,
 |  | LPCWSTR | pwszPrevValueIn
 | ) |  |

Definition at line 1696 of file PropList.cpp.

{
    ASSERT( pwszNameIn != NULL );

    DWORD                   sc = ERROR_SUCCESS;
    BOOL                    fValuesDifferent = TRUE;
    PCLUSPROP_PROPERTY_NAME pName = NULL;
    PCLUSPROP_SZ            pValue = NULL;

    if ( ( pwszPrevValueIn != NULL ) && ( IStringCompareW( pwszValueIn, pwszPrevValueIn ) == 0 ) )
    {
        fValuesDifferent = FALSE;
    } // if: we have a prev value and the values are the same

    //
    // If we should always add, or if the new value and the previous value
    // are not equal, add the property to the property list.
    //

    if ( m_fAlwaysAddProp || fValuesDifferent )
    {
        size_t  cbNameSize = 0;
        size_t  cbDataSize = 0;
        size_t  cbValueSize = 0;

        //
        // Calculate sizes and make sure we have a property list.
        //

        cbNameSize = sizeof( CLUSPROP_PROPERTY_NAME )
                    + ALIGN_CLUSPROP( (lstrlenW( pwszNameIn ) + 1) * sizeof( *pwszNameIn ) );

        cbDataSize = (lstrlenW( pwszValueIn ) + 1) * sizeof( *pwszValueIn );

        cbValueSize = sizeof( CLUSPROP_SZ )
                    + ALIGN_CLUSPROP( cbDataSize )
                    + sizeof( CLUSPROP_SYNTAX ); // value list endmark

        sc = ScAllocPropList( cbNameSize + cbValueSize );
        if ( sc == ERROR_SUCCESS )
        {
            //
            // Set the property name.
            //

            pName = m_cbhCurrentProp.pName;
            CopyProp( pName, CLUSPROP_TYPE_NAME, pwszNameIn );
            m_cbhCurrentProp.pb += cbNameSize;

            //
            // Set the property value.
            //

            pValue = m_cbhCurrentProp.pStringValue;
            CopyExpandSzProp( pValue, CLUSPROP_TYPE_LIST_VALUE, pwszValueIn, cbDataSize );
            m_cbhCurrentProp.pb += cbValueSize;

            //
            // Increment the property count and buffer size.
            //

            m_cbhPropList.pList->nPropertyCount++;
            m_cbDataSize += cbNameSize + cbValueSize;
        } // if: ScAllocPropList successfully grew the proplist
    } // if: the value has changed

    return sc;

} //*** CClusPropList::ScAddExpandSzProp( LPCWSTR )

DWORD CClusPropList::ScAddExpandSzProp | ( | LPCWSTR | pwszNameIn,
 |  | LPCWSTR | pwszValueIn,
 |  | LPCWSTR | pwszPrevValueIn
 | ) |  |
DWORD CClusPropList::ScAddExpandSzProp | ( | LPCWSTR | pwszNameIn,
 |  | LPCWSTR | pwszValueIn |
 | ) |  |  | [inline]

Definition at line 896 of file PropList.h.

    {
        return ScAddExpandSzProp( pwszNameIn, pwszValueIn, NULL );

    } //*** ScAddExpandSzProp

DWORD CClusPropList::ScAddExpandSzProp | ( | LPCWSTR | pwszNameIn,
 |  | LPCWSTR | pwszValueIn |
 | ) |  |  | [inline]

Definition at line 1000 of file PropList.h.

    {
        return ScAddExpandSzProp( pwszNameIn, pwszValueIn, NULL );

    } //*** ScAddExpandSzProp

DWORD CClusPropList::ScAddExpandSzProp | ( | LPCWSTR | pwszNameIn,
 |  | LPCWSTR | pwszValueIn,
 |  | LPCWSTR | pwszPrevValueIn
 | ) |  |
DWORD CClusPropList::ScAddExpandSzProp | ( | LPCWSTR | pwszNameIn,
 |  | LPCWSTR | pwszValueIn |
 | ) |  |  | [inline]

Definition at line 1000 of file PropList.h.

    {
        return ScAddExpandSzProp( pwszNameIn, pwszValueIn, NULL );

    } //*** ScAddExpandSzProp

DWORD CClusPropList::ScAddMultiSzProp | ( | LPCWSTR | pwszNameIn,
 |  | LPCWSTR | pwszValueIn,
 |  | LPCWSTR | pwszPrevValueIn
 | ) |  |

Definition at line 1603 of file PropList.cpp.

{
    ASSERT( pwszNameIn != NULL );

    DWORD                   sc = ERROR_SUCCESS;
    BOOL                    fValuesDifferent = TRUE;
    PCLUSPROP_PROPERTY_NAME pName = NULL;
    PCLUSPROP_MULTI_SZ      pValue = NULL;

    if ( ( pwszPrevValueIn != NULL ) && ( NCompareMultiSz( pwszValueIn, pwszPrevValueIn ) == 0 ) )
    {
        fValuesDifferent = FALSE;
    } // if: we have a prev value and the values are the same

    //
    // If we should always add, or if the new value and the previous value
    // are not equal, add the property to the property list.
    //

    if ( m_fAlwaysAddProp || fValuesDifferent )
    {
        size_t  cbNameSize;
        size_t  cbDataSize;
        size_t  cbValueSize;

        //
        // Calculate sizes and make sure we have a property list.
        //

        cbNameSize = sizeof( CLUSPROP_PROPERTY_NAME )
                    + ALIGN_CLUSPROP( (lstrlenW( pwszNameIn ) + 1) * sizeof( *pwszNameIn ) );

        cbDataSize = static_cast< DWORD >( (CchMultiSz( pwszValueIn ) + 1) * sizeof( *pwszValueIn ) );

        cbValueSize = sizeof( CLUSPROP_SZ )
                    + ALIGN_CLUSPROP( cbDataSize )
                    + sizeof( CLUSPROP_SYNTAX ); // value list endmark

        sc = ScAllocPropList( cbNameSize + cbValueSize );
        if ( sc == ERROR_SUCCESS )
        {
            //
            // Set the property name.
            //

            pName = m_cbhCurrentProp.pName;
            CopyProp( pName, CLUSPROP_TYPE_NAME, pwszNameIn );
            m_cbhCurrentProp.pb += cbNameSize;

            //
            // Set the property value.
            //

            pValue = m_cbhCurrentProp.pMultiSzValue;
            CopyMultiSzProp( pValue, CLUSPROP_TYPE_LIST_VALUE, pwszValueIn, cbDataSize );
            m_cbhCurrentProp.pb += cbValueSize;

            //
            // Increment the property count and buffer size.
            //

            m_cbhPropList.pList->nPropertyCount++;
            m_cbDataSize += cbNameSize + cbValueSize;
        } // if: ScAllocPropList successfully grew the proplist
    } // if: the value has changed

    return sc;

} //*** CClusPropList::ScAddMultiSzProp( LPCWSTR )

DWORD CClusPropList::ScAddMultiSzProp | ( | LPCWSTR | pwszNameIn,
 |  | LPCWSTR | pwszValueIn,
 |  | LPCWSTR | pwszPrevValueIn
 | ) |  |
DWORD CClusPropList::ScAddMultiSzProp | ( | LPCWSTR | pwszNameIn,
 |  | LPCWSTR | pwszValueIn,
 |  | LPCWSTR | pwszPrevValueIn
 | ) |  |
DWORD CClusPropList::ScAddProp | ( | LPCWSTR | pwszNameIn,
 |  | DWORD | nValueIn,
 |  | DWORD | nPrevValueIn
 | ) |  |

Definition at line 1789 of file PropList.cpp.

{
    ASSERT( pwszNameIn != NULL );

    DWORD                   sc = ERROR_SUCCESS;
    PCLUSPROP_PROPERTY_NAME pName = NULL;
    PCLUSPROP_DWORD         pValue = NULL;

    if ( m_fAlwaysAddProp || ( nValueIn != nPrevValueIn ) )
    {
        size_t  cbNameSize = 0;
        size_t  cbValueSize = 0;

        //
        // Calculate sizes and make sure we have a property list.
        //

        cbNameSize = sizeof( CLUSPROP_PROPERTY_NAME )
                    + ALIGN_CLUSPROP( (lstrlenW( pwszNameIn ) + 1) * sizeof( *pwszNameIn ) );

        cbValueSize = sizeof( CLUSPROP_DWORD )
                    + sizeof( CLUSPROP_SYNTAX ); // value list endmark

        sc = ScAllocPropList( cbNameSize + cbValueSize );
        if ( sc == ERROR_SUCCESS )
        {
            //
            // Set the property name.
            //

            pName = m_cbhCurrentProp.pName;
            CopyProp( pName, CLUSPROP_TYPE_NAME, pwszNameIn );
            m_cbhCurrentProp.pb += cbNameSize;

            //
            // Set the property value.
            //

            pValue = m_cbhCurrentProp.pDwordValue;
            CopyProp( pValue, CLUSPROP_TYPE_LIST_VALUE, nValueIn );
            m_cbhCurrentProp.pb += cbValueSize;

            //
            // Increment the property count and buffer size.
            //

            m_cbhPropList.pList->nPropertyCount++;
            m_cbDataSize += cbNameSize + cbValueSize;
        } // if: ScAllocPropList successfully grew the proplist
    } // if: the value has changed

    return sc;

} //*** CClusPropList::ScAddProp( DWORD )

DWORD CClusPropList::ScAddProp | ( | LPCWSTR | pwszNameIn,
 |  | LONG | nValueIn,
 |  | LONG | nPrevValueIn
 | ) |  |

Definition at line 1866 of file PropList.cpp.

{
    ASSERT( pwszNameIn != NULL );

    DWORD                   sc = ERROR_SUCCESS;
    PCLUSPROP_PROPERTY_NAME pName = NULL;
    PCLUSPROP_LONG          pValue = NULL;

    if ( m_fAlwaysAddProp || ( nValueIn != nPrevValueIn ) )
    {
        size_t  cbNameSize = 0;
        size_t  cbValueSize = 0;

        //
        // Calculate sizes and make sure we have a property list.
        //

        cbNameSize = sizeof( CLUSPROP_PROPERTY_NAME )
                    + ALIGN_CLUSPROP( (lstrlenW( pwszNameIn ) + 1) * sizeof( *pwszNameIn ) );

        cbValueSize = sizeof( CLUSPROP_LONG )
                    + sizeof( CLUSPROP_SYNTAX ); // value list endmark

        sc = ScAllocPropList( cbNameSize + cbValueSize );
        if ( sc == ERROR_SUCCESS )
        {
            //
            // Set the property name.
            //

            pName = m_cbhCurrentProp.pName;
            CopyProp( pName, CLUSPROP_TYPE_NAME, pwszNameIn );
            m_cbhCurrentProp.pb += cbNameSize;

            //
            // Set the property value.
            //

            pValue = m_cbhCurrentProp.pLongValue;
            CopyProp( pValue, CLUSPROP_TYPE_LIST_VALUE, nValueIn );
            m_cbhCurrentProp.pb += cbValueSize;

            //
            // Increment the property count and buffer size.
            //

            m_cbhPropList.pList->nPropertyCount++;
            m_cbDataSize += cbNameSize + cbValueSize;
        } // if: ScAllocPropList successfully grew the proplist
    } // if: the value has changed

    return sc;

} //*** CClusPropList::ScAddProp( LONG )

DWORD CClusPropList::ScAddProp | ( | LPCWSTR | pwszNameIn,
 |  | ULONGLONG | ullValueIn,
 |  | ULONGLONG | ullPrevValueIn
 | ) |  |

Definition at line 2041 of file PropList.cpp.

{
    ASSERT( pwszNameIn != NULL );

    DWORD                       sc = ERROR_SUCCESS;
    PCLUSPROP_PROPERTY_NAME     pName = NULL;
    PCLUSPROP_ULARGE_INTEGER    pValue = NULL;

    if ( m_fAlwaysAddProp || ( ullValueIn != ullPrevValueIn ) )
    {
        size_t  cbNameSize = 0;
        size_t  cbValueSize = 0;

        //
        // Calculate sizes and make sure we have a property list.
        //

        cbNameSize = sizeof( CLUSPROP_PROPERTY_NAME )
                    + ALIGN_CLUSPROP( (lstrlenW( pwszNameIn ) + 1) * sizeof( *pwszNameIn ) );

        cbValueSize = sizeof( CLUSPROP_ULARGE_INTEGER )
                    + sizeof( CLUSPROP_SYNTAX ); // value list endmark

        sc = ScAllocPropList( cbNameSize + cbValueSize );
        if ( sc == ERROR_SUCCESS )
        {
            //
            // Set the property name.
            //

            pName = m_cbhCurrentProp.pName;
            CopyProp( pName, CLUSPROP_TYPE_NAME, pwszNameIn );
            m_cbhCurrentProp.pb += cbNameSize;

            //
            // Set the property value.
            //

            pValue = m_cbhCurrentProp.pULargeIntegerValue;
            CopyProp( pValue, CLUSPROP_TYPE_LIST_VALUE, ullValueIn );
            m_cbhCurrentProp.pb += cbValueSize;

            //
            // Increment the property count and buffer size.
            //

            m_cbhPropList.pList->nPropertyCount++;
            m_cbDataSize += cbNameSize + cbValueSize;
        } // if: ScAllocPropList successfully grew the proplist
    } // if: the value has changed

    return sc;

} //*** CClusPropList::ScAddProp( ULONGLONG )

DWORD CClusPropList::ScAddProp | ( | LPCWSTR | pwszNameIn,
 |  | LONG | nValueIn,
 |  | LONG | nPrevValueIn
 | ) |  |
DWORD CClusPropList::ScAddProp | ( | LPCWSTR | pwszNameIn,
 |  | DWORD | nValueIn,
 |  | DWORD | nPrevValueIn
 | ) |  |
DWORD CClusPropList::ScAddProp | ( | LPCWSTR | pwszNameIn,
 |  | ULONGLONG | ullValueIn,
 |  | ULONGLONG | ullPrevValueIn
 | ) |  |
DWORD CClusPropList::ScAddProp | ( | LPCWSTR | pwszNameIn,
 |  | LONGLONG | llValueIn,
 |  | LONGLONG | llPrevValueIn
 | ) |  |
DWORD CClusPropList::ScAddProp | ( | LPCWSTR | pwszNameIn,
 |  | LPCWSTR | pwszValueIn |
 | ) |  |  | [inline]

Definition at line 994 of file PropList.h.

    {
        return ScAddProp( pwszNameIn, pwszValueIn, NULL );

    } //*** ScAddProp

DWORD CClusPropList::ScAddProp | ( | LPCWSTR | pwszNameIn,
 |  | LPCWSTR | pwszValueIn,
 |  | LPCWSTR | pwszPrevValueIn
 | ) |  |
DWORD CClusPropList::ScAddProp | ( | LPCWSTR | pwszNameIn,
 |  | LONGLONG | llValueIn,
 |  | LONGLONG | llPrevValueIn
 | ) |  |

Definition at line 2119 of file PropList.cpp.

{
    ASSERT( pwszNameIn != NULL );

    DWORD                       sc = ERROR_SUCCESS;
    PCLUSPROP_PROPERTY_NAME     pName = NULL;
    PCLUSPROP_LARGE_INTEGER     pValue = NULL;

    if ( m_fAlwaysAddProp || ( llValueIn != llPrevValueIn ) )
    {
        size_t  cbNameSize = 0;
        size_t  cbValueSize = 0;

        //
        // Calculate sizes and make sure we have a property list.
        //

        cbNameSize = sizeof( CLUSPROP_PROPERTY_NAME )
                    + ALIGN_CLUSPROP( (lstrlenW( pwszNameIn ) + 1) * sizeof( *pwszNameIn ) );

        cbValueSize = sizeof( CLUSPROP_LARGE_INTEGER )
                    + sizeof( CLUSPROP_SYNTAX ); // value list endmark

        sc = ScAllocPropList( cbNameSize + cbValueSize );
        if ( sc == ERROR_SUCCESS )
        {
            //
            // Set the property name.
            //

            pName = m_cbhCurrentProp.pName;
            CopyProp( pName, CLUSPROP_TYPE_NAME, pwszNameIn );
            m_cbhCurrentProp.pb += cbNameSize;

            //
            // Set the property value.
            //

            pValue = m_cbhCurrentProp.pLargeIntegerValue;
            CopyProp( pValue, CLUSPROP_TYPE_LIST_VALUE, llValueIn );
            m_cbhCurrentProp.pb += cbValueSize;

            //
            // Increment the property count and buffer size.
            //

            m_cbhPropList.pList->nPropertyCount++;
            m_cbDataSize += cbNameSize + cbValueSize;
        } // if: ScAllocPropList successfully grew the proplist
    } // if: the value has changed

    return sc;

} //*** CClusPropList::ScAddProp( LONGLONG )

DWORD CClusPropList::ScAddProp | ( | LPCWSTR | pwszNameIn,
 |  | const unsigned char * | pbValueIn,
 |  | size_t | cbValueIn,
 |  | const unsigned char * | pbPrevValueIn,
 |  | size_t | cbPrevValueIn
 | ) |  |

Definition at line 1946 of file PropList.cpp.

{
    ASSERT( pwszNameIn != NULL );

    DWORD                   sc = ERROR_SUCCESS;
    BOOL                    _fChanged = FALSE;
    PCLUSPROP_PROPERTY_NAME pName = NULL;
    PCLUSPROP_BINARY        pValue = NULL;

    //
    // Determine if the buffer has changed.
    //

    if ( m_fAlwaysAddProp || (cbValueIn != cbPrevValueIn) )
    {
        _fChanged = TRUE;
    } // if: always adding the property or the value size changed
    else if ( ( cbValueIn != 0 ) && ( cbPrevValueIn != 0 ) )
    {
        _fChanged = memcmp( pbValueIn, pbPrevValueIn, cbValueIn ) != 0;
    } // else if: value length changed

    if ( _fChanged )
    {
        size_t  cbNameSize = 0;
        size_t  cbValueSize = 0;

        //
        // Calculate sizes and make sure we have a property list.
        //

        cbNameSize = sizeof( CLUSPROP_PROPERTY_NAME )
                    + ALIGN_CLUSPROP( (lstrlenW( pwszNameIn ) + 1) * sizeof( *pwszNameIn ) );

        cbValueSize = sizeof( CLUSPROP_BINARY )
                    + ALIGN_CLUSPROP( cbValueIn )
                    + sizeof( CLUSPROP_SYNTAX ); // value list endmark

        sc = ScAllocPropList( cbNameSize + cbValueSize );
        if ( sc == ERROR_SUCCESS )
        {
            //
            // Set the property name.
            //

            pName = m_cbhCurrentProp.pName;
            CopyProp( pName, CLUSPROP_TYPE_NAME, pwszNameIn );
            m_cbhCurrentProp.pb += cbNameSize;

            //
            // Set the property value.
            //

            pValue = m_cbhCurrentProp.pBinaryValue;
            CopyProp( pValue, CLUSPROP_TYPE_LIST_VALUE, pbValueIn, cbValueIn );
            m_cbhCurrentProp.pb += cbValueSize;

            //
            // Increment the property count and buffer size.
            //

            m_cbhPropList.pList->nPropertyCount++;
            m_cbDataSize += cbNameSize + cbValueSize;
        } // if: ScAllocPropList successfully grew the proplist
    } // if: the value has changed

    return sc;

} //*** CClusPropList::ScAddProp( const unsigned char * )

DWORD CClusPropList::ScAddProp | ( | LPCWSTR | pwszNameIn,
 |  | LPCWSTR | pwszValueIn,
 |  | LPCWSTR | pwszPrevValueIn
 | ) |  |
DWORD CClusPropList::ScAddProp | ( | LPCWSTR | pwszNameIn,
 |  | DWORD | nValueIn,
 |  | DWORD | nPrevValueIn
 | ) |  |
DWORD CClusPropList::ScAddProp | ( | LPCWSTR | pwszNameIn,
 |  | LONG | nValueIn,
 |  | LONG | nPrevValueIn
 | ) |  |
DWORD CClusPropList::ScAddProp | ( | LPCWSTR | pwszNameIn,
 |  | ULONGLONG | ullValueIn,
 |  | ULONGLONG | ullPrevValueIn
 | ) |  |
DWORD CClusPropList::ScAddProp | ( | LPCWSTR | pwszNameIn,
 |  | const unsigned char * | pbValueIn,
 |  | size_t | cbValueIn,
 |  | const unsigned char * | pbPrevValueIn,
 |  | size_t | cbPrevValueIn
 | ) |  |
DWORD CClusPropList::ScAddProp | ( | LPCWSTR | pwszNameIn,
 |  | const unsigned char * | pbValueIn,
 |  | size_t | cbValueIn,
 |  | const unsigned char * | pbPrevValueIn,
 |  | size_t | cbPrevValueIn
 | ) |  |
DWORD CClusPropList::ScAddProp | ( | LPCWSTR | pwszNameIn,
 |  | LPCWSTR | pwszValueIn |
 | ) |  |  | [inline]

Definition at line 994 of file PropList.h.

    {
        return ScAddProp( pwszNameIn, pwszValueIn, NULL );

    } //*** ScAddProp

DWORD CClusPropList::ScAddProp | ( | LPCWSTR | pwszNameIn,
 |  | LPCWSTR | pwszValueIn,
 |  | LPCWSTR | pwszPrevValueIn
 | ) |  |

Definition at line 1509 of file PropList.cpp.

{
    ASSERT( pwszNameIn != NULL );

    DWORD                   sc = ERROR_SUCCESS;
    BOOL                    fValuesDifferent = TRUE;
    PCLUSPROP_PROPERTY_NAME pName = NULL;
    PCLUSPROP_SZ            pValue = NULL;

    if ( ( pwszPrevValueIn != NULL ) && ( IStringCompareW( pwszValueIn, pwszPrevValueIn ) == 0 ) )
    {
        fValuesDifferent = FALSE;
    } // if: we have a prev value and the values are the same

    //
    // If we should always add, or if the new value and the previous value
    // are not equal, add the property to the property list.
    //

    if ( m_fAlwaysAddProp || fValuesDifferent )
    {
        size_t  cbNameSize;
        size_t  cbDataSize;
        size_t  cbValueSize = 0;

        //
        // Calculate sizes and make sure we have a property list.
        //

        cbNameSize = sizeof( CLUSPROP_PROPERTY_NAME )
                    + ALIGN_CLUSPROP( (lstrlenW( pwszNameIn ) + 1) * sizeof( *pwszNameIn ) );

        cbDataSize = (lstrlenW( pwszValueIn ) + 1) * sizeof( *pwszValueIn );

        cbValueSize = sizeof( CLUSPROP_SZ )
                    + ALIGN_CLUSPROP( cbDataSize )
                    + sizeof( CLUSPROP_SYNTAX ); // value list endmark

        sc = ScAllocPropList( cbNameSize + cbValueSize );
        if ( sc == ERROR_SUCCESS )
        {
            //
            // Set the property name.
            //

            pName = m_cbhCurrentProp.pName;
            CopyProp( pName, CLUSPROP_TYPE_NAME, pwszNameIn );
            m_cbhCurrentProp.pb += cbNameSize;

            //
            // Set the property value.
            //

            pValue = m_cbhCurrentProp.pStringValue;
            CopyProp( pValue, CLUSPROP_TYPE_LIST_VALUE, pwszValueIn, cbDataSize );
            m_cbhCurrentProp.pb += cbValueSize;

            //
            // Increment the property count and buffer size.
            //

            m_cbhPropList.pList->nPropertyCount++;
            m_cbDataSize += cbNameSize + cbValueSize;
        } // if: ScAllocPropList successfully grew the proplist

    } // if: the value has changed

    return sc;

} //*** CClusPropList::ScAddProp( LPCWSTR )

DWORD CClusPropList::ScAddProp | ( | LPCWSTR | pwszNameIn,
 |  | LPCWSTR | pwszValueIn |
 | ) |  |  | [inline]

Definition at line 890 of file PropList.h.

    {
        return ScAddProp( pwszNameIn, pwszValueIn, NULL );

    } //*** ScAddProp

DWORD CClusPropList::ScAddProp | ( | LPCWSTR | pwszNameIn,
 |  | LONGLONG | llValueIn,
 |  | LONGLONG | llPrevValueIn
 | ) |  |
DWORD CClusPropList::ScAllocPropList ( size_t cbMinimumIn )
DWORD CClusPropList::ScAllocPropList ( size_t cbMinimumIn )
DWORD CClusPropList::ScAllocPropList ( size_t cbMinimumIn )

Definition at line 1422 of file PropList.cpp.

{
    ASSERT( cbMinimumIn > 0 );

    DWORD   sc = ERROR_SUCCESS;
    size_t  cbTotal = 0;

    //
    // Add the size of the item count and final endmark.
    //

    cbMinimumIn += sizeof( CLUSPROP_VALUE );
    cbTotal = m_cbDataSize + cbMinimumIn;

    if ( m_cbBufferSize < cbTotal )
    {
        PBYTE   pbNewProplist = NULL;

        cbMinimumIn = max( BUFFER_GROWTH_FACTOR, cbMinimumIn );
        cbTotal = m_cbDataSize + cbMinimumIn;

        //
        // Allocate and zero a new buffer.
        //

        pbNewProplist = new BYTE[ cbTotal ];
        if ( pbNewProplist != NULL )
        {
            ZeroMemory( pbNewProplist, cbTotal );

            //
            // If there was a previous buffer, copy it and the delete it.
            //

            if ( m_cbhPropList.pb != NULL )
            {
                if ( m_cbDataSize != 0 )
                {
                    CopyMemory( pbNewProplist, m_cbhPropList.pb, m_cbDataSize );
                } // if: data already exists in buffer

                delete [] m_cbhPropList.pb;
                m_cbhCurrentProp.pb = pbNewProplist + (m_cbhCurrentProp.pb - m_cbhPropList.pb);
            } // if: there was a previous buffer
            else
            {
                m_cbhCurrentProp.pb = pbNewProplist + sizeof( DWORD ); // move past prop count
            } // else: no previous buffer

            //
            // Save the new buffer.
            //

            m_cbhPropList.pb = pbNewProplist;
            m_cbBufferSize = cbTotal;
        } // if: allocation succeeded
        else
        {
            sc = ERROR_NOT_ENOUGH_MEMORY;
        } // else: allocation failed
    } // if: buffer isn't big enough

    return sc;

} //*** CClusPropList::ScAllocPropList

DWORD CClusPropList::ScAppend ( const CClusPropList & rclPropListIn )
DWORD CClusPropList::ScAppend ( const CClusPropList & rclPropListIn )

Definition at line 1018 of file PropList.cpp.

{
    DWORD   sc = ERROR_SUCCESS;
    size_t  cbPropertyCountOffset = 0;
    size_t  cbIncrement = 0;
    size_t  cbDataLeft = 0;
    PBYTE   pbsrc = NULL;
    PBYTE   pbdest = NULL;

    //
    //  Compute the number of bytes to get past the count of properties that
    //  is at the head of the list.  This is typically sizeof DWORD.
    //

    cbPropertyCountOffset = sizeof( m_cbhPropList.pList->nPropertyCount );

    //
    //  Compute the allocation increment.  This is used when growing our buffer
    //  and is the amount of data to copy from the passed in list.  This includes
    //  the trailing endmark.  m_cbDataSize does not include the leading property
    //  count DWORD.
    //

    cbIncrement = rclPropListIn.m_cbDataSize;

    //
    //  How much space remains in our current buffer?
    //

    cbDataLeft = m_cbBufferSize - m_cbDataSize;

    //
    //  If the size of the list to append is larger than what we have remaining
    //  then we need to grow the list.
    //

    if ( cbIncrement > cbDataLeft )
    {
        sc = ScAllocPropList( m_cbDataSize + cbIncrement );
        if ( sc != ERROR_SUCCESS )
        {
            goto Cleanup;
        } // if:
    } // if:

    pbdest = (PBYTE) &m_cbhPropList.pb[ cbPropertyCountOffset + m_cbDataSize ];

    pbsrc = (PBYTE) &rclPropListIn.m_cbhPropList.pList->PropertyName;

    CopyMemory( pbdest, pbsrc, cbIncrement );

    //
    //  Grow our data size to match our new size.
    //

    m_cbDataSize += cbIncrement;

    //
    //  Increment our property count to include the count of properties appended to the end
    //  of our buffer.
    //

    m_cbhPropList.pList->nPropertyCount += rclPropListIn.m_cbhPropList.pList->nPropertyCount;

Cleanup:

    return sc;

} //*** CClusPropList::ScAppend

DWORD CClusPropList::ScAppend ( const CClusPropList & rclPropListIn )
DWORD CClusPropList::ScCheckIfAtLastProperty ( void ) const [inline]

Definition at line 921 of file PropList.h.

    {
        DWORD sc;

        if ( m_nPropsRemaining <= 1 )
        {
            sc = ERROR_NO_MORE_ITEMS;
        } // if:  at the last property
        else
        {
            sc = ERROR_SUCCESS;
        } // else:  not at the last property

        return sc;

    } //*** ScCheckIfAtLastProperty

DWORD CClusPropList::ScCheckIfAtLastProperty ( void ) const [inline]

Definition at line 921 of file PropList.h.

    {
        DWORD sc;

        if ( m_nPropsRemaining <= 1 )
        {
            sc = ERROR_NO_MORE_ITEMS;
        } // if:  at the last property
        else
        {
            sc = ERROR_SUCCESS;
        } // else:  not at the last property

        return sc;

    } //*** ScCheckIfAtLastProperty

DWORD CClusPropList::ScCheckIfAtLastProperty ( void ) const [inline]

Definition at line 817 of file PropList.h.

    {
        DWORD sc;

        if ( m_nPropsRemaining <= 1 )
        {
            sc = ERROR_NO_MORE_ITEMS;
        } // if:  at the last property
        else
        {
            sc = ERROR_SUCCESS;
        } // else:  not at the last property

        return sc;

    } //*** ScCheckIfAtLastProperty

DWORD CClusPropList::ScCopy | ( | const PCLUSPROP_LIST | pcplPropListIn,
 |  | size_t | cbListSizeIn
 | ) |  |

Definition at line 960 of file PropList.cpp.

{
    ASSERT( pcplPropListIn != NULL );

    DWORD   sc = ERROR_SUCCESS;

    //
    // Clean up any vestiges of a previous prop list.
    //

    if ( m_cbhPropList.pb != NULL )
    {
        DeletePropList();
    } // if: the current list is not empty

    //
    // Allocate the new property list buffer.  If successful,
    // copy the source list.
    //

    m_cbhPropList.pb = new BYTE[ cbPropListIn ];
    if ( m_cbhPropList.pb != NULL )
    {
        CopyMemory( m_cbhPropList.pList, pcplPropListIn, cbPropListIn );
        m_cbBufferSize = cbPropListIn;
        m_cbDataSize   = cbPropListIn;
        m_cbDataLeft   = cbPropListIn;
        sc = ScMoveToFirstProperty();
    } // if: new succeeded
    else
    {
        sc = ERROR_NOT_ENOUGH_MEMORY;
    } // else:

    return sc;

} //*** CClusPropList::ScCopy

DWORD CClusPropList::ScCopy | ( | const PCLUSPROP_LIST | pcplPropListIn,
 |  | size_t | cbListSizeIn
 | ) |  |
DWORD CClusPropList::ScCopy | ( | const PCLUSPROP_LIST | pcplPropListIn,
 |  | size_t | cbListSizeIn
 | ) |  |
DWORD CClusPropList::ScGetClusterProperties | ( | HCLUSTER | hClusterIn,
 |  | DWORD | dwControlCodeIn,
 |  | HNODE | hHostNodeIn = NULL,
 |  | LPVOID | lpBufferIn = NULL,
 |  | size_t | cbBufferIn = 0
 | ) |  |
DWORD CClusPropList::ScGetClusterProperties | ( | HCLUSTER | hClusterIn,
 |  | DWORD | dwControlCodeIn,
 |  | HNODE | hHostNodeIn = NULL,
 |  | LPVOID | lpBufferIn = NULL,
 |  | size_t | cbBufferIn = 0
 | ) |  |
DWORD CClusPropList::ScGetClusterProperties | ( | HCLUSTER | hClusterIn,
 |  | DWORD | dwControlCodeIn,
 |  | HNODE | hHostNodeIn = NULL,
 |  | LPVOID | lpBufferIn = NULL,
 |  | size_t | cbBufferIn = 0
 | ) |  |

Definition at line 3300 of file PropList.cpp.

{
    ASSERT( hClusterIn != NULL );
    ASSERT( ( dwControlCodeIn & ( CLUSCTL_OBJECT_MASK << CLUSCTL_OBJECT_SHIFT ) )
            == ( CLUS_OBJECT_CLUSTER << CLUSCTL_OBJECT_SHIFT ) );

    DWORD   sc = ERROR_SUCCESS;
    DWORD   cbProps = 256;

    //
    // Overwrite anything that may be in the buffer.
    // Allows this class instance to be reused.
    //

    m_cbDataSize = 0;

    //
    // Get properties.
    //

    sc = ScAllocPropList( cbProps );
    if ( sc == ERROR_SUCCESS )
    {
        sc = ClusterControl(
                          hClusterIn
                        , hHostNodeIn
                        , dwControlCodeIn
                        , lpBufferIn
                        , static_cast< DWORD >( cbBufferIn )
                        , m_cbhPropList.pb
                        , static_cast< DWORD >( m_cbBufferSize )
                        , &cbProps
                        );
        if ( sc == ERROR_MORE_DATA )
        {
            sc = ScAllocPropList( cbProps );
            if ( sc == ERROR_SUCCESS )
            {
                sc = ClusterControl(
                                  hClusterIn
                                , hHostNodeIn
                                , dwControlCodeIn
                                , lpBufferIn
                                , static_cast< DWORD >( cbBufferIn )
                                , m_cbhPropList.pb
                                , static_cast< DWORD >( m_cbBufferSize )
                                , &cbProps
                                );
            } // if: ScAllocPropList succeeded
        } // if: buffer too small
    } // if: ScAllocPropList succeeded

    if ( sc != ERROR_SUCCESS )
    {
        DeletePropList();
    } // if: error getting private properties.
    else
    {
        m_cbDataSize = static_cast< size_t >( cbProps );
        m_cbDataLeft = static_cast< size_t >( cbProps );
    } // else: no errors

    return sc;

} //*** CClusPropList::ScGetClusterProperties

DWORD CClusPropList::ScGetGroupProperties | ( | HGROUP | hGroupIn,
 |  | DWORD | dwControlCodeIn,
 |  | HNODE | hHostNodeIn = NULL,
 |  | LPVOID | lpBufferIn = NULL,
 |  | size_t | cbBufferIn = 0
 | ) |  |
DWORD CClusPropList::ScGetGroupProperties | ( | HGROUP | hGroupIn,
 |  | DWORD | dwControlCodeIn,
 |  | HNODE | hHostNodeIn = NULL,
 |  | LPVOID | lpBufferIn = NULL,
 |  | size_t | cbBufferIn = 0
 | ) |  |
DWORD CClusPropList::ScGetGroupProperties | ( | HGROUP | hGroupIn,
 |  | DWORD | dwControlCodeIn,
 |  | HNODE | hHostNodeIn = NULL,
 |  | LPVOID | lpBufferIn = NULL,
 |  | size_t | cbBufferIn = 0
 | ) |  |

Definition at line 2823 of file PropList.cpp.

{
    ASSERT( hGroupIn != NULL );
    ASSERT( ( dwControlCodeIn & ( CLUSCTL_OBJECT_MASK << CLUSCTL_OBJECT_SHIFT ) )
            == ( CLUS_OBJECT_GROUP << CLUSCTL_OBJECT_SHIFT ) );

    DWORD   sc = ERROR_SUCCESS;
    DWORD   cbProps = 256;

    //
    // Overwrite anything that may be in the buffer.
    // Allows this class instance to be reused.
    //

    m_cbDataSize = 0;

    //
    // Get properties.
    //

    sc = ScAllocPropList( cbProps );
    if ( sc == ERROR_SUCCESS )
    {
        sc = ClusterGroupControl(
                          hGroupIn
                        , hHostNodeIn
                        , dwControlCodeIn
                        , lpBufferIn
                        , static_cast< DWORD >( cbBufferIn )
                        , m_cbhPropList.pb
                        , static_cast< DWORD >( m_cbBufferSize )
                        , &cbProps
                        );
        if ( sc == ERROR_MORE_DATA )
        {
            sc = ScAllocPropList( cbProps );
            if ( sc == ERROR_SUCCESS )
            {
                sc = ClusterGroupControl(
                                  hGroupIn
                                , hHostNodeIn
                                , dwControlCodeIn
                                , lpBufferIn
                                , static_cast< DWORD >( cbBufferIn )
                                , m_cbhPropList.pb
                                , static_cast< DWORD >( m_cbBufferSize )
                                , &cbProps
                                );
            } // if: ScAllocPropList succeeded
        } // if: buffer too small
    } // if: ScAllocPropList succeeded

    if ( sc != ERROR_SUCCESS )
    {
        DeletePropList();
    } // if: error getting properties.
    else
    {
        m_cbDataSize = static_cast< size_t >( cbProps );
        m_cbDataLeft = static_cast< size_t >( cbProps );
    } // else: no errors

    return sc;

} //*** CClusPropList::ScGetGroupProperties

DWORD CClusPropList::ScGetNetInterfaceProperties | ( | HNETINTERFACE | hNetInterfaceIn,
 |  | DWORD | dwControlCodeIn,
 |  | HNODE | hHostNodeIn = NULL,
 |  | LPVOID | lpBufferIn = NULL,
 |  | size_t | cbBufferIn = 0
 | ) |  |

Definition at line 3205 of file PropList.cpp.

{
    ASSERT( hNetInterfaceIn != NULL );
    ASSERT( ( dwControlCodeIn & ( CLUSCTL_OBJECT_MASK << CLUSCTL_OBJECT_SHIFT ) )
            == ( CLUS_OBJECT_NETINTERFACE << CLUSCTL_OBJECT_SHIFT ) );

    DWORD   sc = ERROR_SUCCESS;
    DWORD   cbProps = 256;

    //
    // Overwrite anything that may be in the buffer.
    // Allows this class instance to be reused.
    //

    m_cbDataSize = 0;

    //
    // Get properties.
    //

    sc = ScAllocPropList( cbProps );
    if ( sc == ERROR_SUCCESS )
    {
        sc = ClusterNetInterfaceControl(
                          hNetInterfaceIn
                        , hHostNodeIn
                        , dwControlCodeIn
                        , lpBufferIn
                        , static_cast< DWORD >( cbBufferIn )
                        , m_cbhPropList.pb
                        , static_cast< DWORD >( m_cbBufferSize )
                        , &cbProps
                        );
        if ( sc == ERROR_MORE_DATA )
        {
            sc = ScAllocPropList( cbProps );
            if ( sc == ERROR_SUCCESS )
            {
                sc = ClusterNetInterfaceControl(
                                  hNetInterfaceIn
                                , hHostNodeIn
                                , dwControlCodeIn
                                , lpBufferIn
                                , static_cast< DWORD >( cbBufferIn )
                                , m_cbhPropList.pb
                                , static_cast< DWORD >( m_cbBufferSize )
                                , &cbProps
                                );
            } // if: ScAllocPropList succeeded
        } // if: buffer too small
    } // if: ScAllocPropList succeeded

    if ( sc != ERROR_SUCCESS )
    {
        DeletePropList();
    } // if: error getting private properties.
    else
    {
        m_cbDataSize = static_cast< size_t >( cbProps );
        m_cbDataLeft = static_cast< size_t >( cbProps );
    } // else: no errors

    return sc;

} //*** CClusPropList::ScGetNetInterfaceProperties

DWORD CClusPropList::ScGetNetInterfaceProperties | ( | HNETINTERFACE | hNetInterfaceIn,
 |  | DWORD | dwControlCodeIn,
 |  | HNODE | hHostNodeIn = NULL,
 |  | LPVOID | lpBufferIn = NULL,
 |  | size_t | cbBufferIn = 0
 | ) |  |
DWORD CClusPropList::ScGetNetInterfaceProperties | ( | HNETINTERFACE | hNetInterfaceIn,
 |  | DWORD | dwControlCodeIn,
 |  | HNODE | hHostNodeIn = NULL,
 |  | LPVOID | lpBufferIn = NULL,
 |  | size_t | cbBufferIn = 0
 | ) |  |
DWORD CClusPropList::ScGetNetworkProperties | ( | HNETWORK | hNetworkIn,
 |  | DWORD | dwControlCodeIn,
 |  | HNODE | hHostNodeIn = NULL,
 |  | LPVOID | lpBufferIn = NULL,
 |  | size_t | cbBufferIn = 0
 | ) |  |
DWORD CClusPropList::ScGetNetworkProperties | ( | HNETWORK | hNetworkIn,
 |  | DWORD | dwControlCodeIn,
 |  | HNODE | hHostNodeIn = NULL,
 |  | LPVOID | lpBufferIn = NULL,
 |  | size_t | cbBufferIn = 0
 | ) |  |

Definition at line 3112 of file PropList.cpp.

{
    ASSERT( hNetworkIn != NULL );
    ASSERT( ( dwControlCodeIn & ( CLUSCTL_OBJECT_MASK << CLUSCTL_OBJECT_SHIFT ) )
            == ( CLUS_OBJECT_NETWORK << CLUSCTL_OBJECT_SHIFT ) );

    DWORD   sc = ERROR_SUCCESS;
    DWORD   cbProps = 256;

    //
    // Overwrite anything that may be in the buffer.
    // Allows this class instance to be reused.
    //

    m_cbDataSize = 0;

    //
    // Get properties.
    //
    sc = ScAllocPropList( cbProps );
    if ( sc == ERROR_SUCCESS )
    {
        sc = ClusterNetworkControl(
                          hNetworkIn
                        , hHostNodeIn
                        , dwControlCodeIn
                        , lpBufferIn
                        , static_cast< DWORD >( cbBufferIn )
                        , m_cbhPropList.pb
                        , static_cast< DWORD >( m_cbBufferSize )
                        , &cbProps
                        );
        if ( sc == ERROR_MORE_DATA )
        {
            sc = ScAllocPropList( cbProps );
            if ( sc == ERROR_SUCCESS )
            {
                sc = ClusterNetworkControl(
                                  hNetworkIn
                                , hHostNodeIn
                                , dwControlCodeIn
                                , lpBufferIn
                                , static_cast< DWORD >( cbBufferIn )
                                , m_cbhPropList.pb
                                , static_cast< DWORD >( m_cbBufferSize )
                                , &cbProps
                                );
            } // if: ScAllocPropList succeeded
        } // if: buffer too small
    } // if: ScAllocPropList succeeded

    if ( sc != ERROR_SUCCESS )
    {
        DeletePropList();
    } // if: error getting private properties.
    else
    {
        m_cbDataSize = static_cast< size_t >( cbProps );
        m_cbDataLeft = static_cast< size_t >( cbProps );
    } // else: no errors

    return sc;

} //*** CClusPropList::ScGetNetworkProperties

DWORD CClusPropList::ScGetNetworkProperties | ( | HNETWORK | hNetworkIn,
 |  | DWORD | dwControlCodeIn,
 |  | HNODE | hHostNodeIn = NULL,
 |  | LPVOID | lpBufferIn = NULL,
 |  | size_t | cbBufferIn = 0
 | ) |  |
DWORD CClusPropList::ScGetNodeProperties | ( | HNODE | hNodeIn,
 |  | DWORD | dwControlCodeIn,
 |  | HNODE | hHostNodeIn = NULL,
 |  | LPVOID | lpBufferIn = NULL,
 |  | size_t | cbBufferIn = 0
 | ) |  |

Definition at line 2729 of file PropList.cpp.

{
    ASSERT( hNodeIn != NULL );
    ASSERT( ( dwControlCodeIn & ( CLUSCTL_OBJECT_MASK << CLUSCTL_OBJECT_SHIFT ) )
            == ( CLUS_OBJECT_NODE << CLUSCTL_OBJECT_SHIFT ) );

    DWORD   sc = ERROR_SUCCESS;
    DWORD   cbProps = 256;

    //
    // Overwrite anything that may be in the buffer.
    // Allows this class instance to be reused.
    //

    m_cbDataSize = 0;

    //
    // Get properties.
    //

    sc = ScAllocPropList( cbProps );
    if ( sc == ERROR_SUCCESS )
    {
        sc = ClusterNodeControl(
                          hNodeIn
                        , hHostNodeIn
                        , dwControlCodeIn
                        , lpBufferIn
                        , static_cast< DWORD >( cbBufferIn )
                        , m_cbhPropList.pb
                        , static_cast< DWORD >( m_cbBufferSize )
                        , &cbProps
                        );
        if ( sc == ERROR_MORE_DATA )
        {
            sc = ScAllocPropList( cbProps );
            if ( sc == ERROR_SUCCESS )
            {
                sc = ClusterNodeControl(
                                  hNodeIn
                                , hHostNodeIn
                                , dwControlCodeIn
                                , lpBufferIn
                                , static_cast< DWORD >( cbBufferIn )
                                , m_cbhPropList.pb
                                , static_cast< DWORD >( m_cbBufferSize )
                                , &cbProps
                                );
            } // if: ScAllocPropList succeeded
        } // if: buffer too small
    } // if: ScAllocPropList succeeded

    if ( sc != ERROR_SUCCESS )
    {
        DeletePropList();
    } // if: error getting properties.
    else
    {
        m_cbDataSize = static_cast< size_t >( cbProps );
        m_cbDataLeft = static_cast< size_t >( cbProps );
    } // else: no errors

    return sc;

} //*** CClusPropList::ScGetNodeProperties

DWORD CClusPropList::ScGetNodeProperties | ( | HNODE | hNodeIn,
 |  | DWORD | dwControlCodeIn,
 |  | HNODE | hHostNodeIn = NULL,
 |  | LPVOID | lpBufferIn = NULL,
 |  | size_t | cbBufferIn = 0
 | ) |  |
DWORD CClusPropList::ScGetNodeProperties | ( | HNODE | hNodeIn,
 |  | DWORD | dwControlCodeIn,
 |  | HNODE | hHostNodeIn = NULL,
 |  | LPVOID | lpBufferIn = NULL,
 |  | size_t | cbBufferIn = 0
 | ) |  |
DWORD CClusPropList::ScGetResourceProperties | ( | HRESOURCE | hResourceIn,
 |  | DWORD | dwControlCodeIn,
 |  | HNODE | hHostNodeIn = NULL,
 |  | LPVOID | lpBufferIn = NULL,
 |  | size_t | cbBufferIn = 0
 | ) |  |
DWORD CClusPropList::ScGetResourceProperties | ( | HRESOURCE | hResourceIn,
 |  | DWORD | dwControlCodeIn,
 |  | HNODE | hHostNodeIn = NULL,
 |  | LPVOID | lpBufferIn = NULL,
 |  | size_t | cbBufferIn = 0
 | ) |  |
DWORD CClusPropList::ScGetResourceProperties | ( | HRESOURCE | hResourceIn,
 |  | DWORD | dwControlCodeIn,
 |  | HNODE | hHostNodeIn = NULL,
 |  | LPVOID | lpBufferIn = NULL,
 |  | size_t | cbBufferIn = 0
 | ) |  |

Definition at line 2917 of file PropList.cpp.

{
    ASSERT( hResourceIn != NULL );
    ASSERT( ( dwControlCodeIn & (CLUSCTL_OBJECT_MASK << CLUSCTL_OBJECT_SHIFT ) )
            == ( CLUS_OBJECT_RESOURCE << CLUSCTL_OBJECT_SHIFT ) );

    DWORD   sc = ERROR_SUCCESS;
    DWORD   cbProps = 256;

    //
    // Overwrite anything that may be in the buffer.
    // Allows this class instance to be reused.
    //

    m_cbDataSize = 0;

    //
    // Get properties.
    //

    sc = ScAllocPropList( cbProps );
    if ( sc == ERROR_SUCCESS )
    {
        sc = ClusterResourceControl(
                          hResourceIn
                        , hHostNodeIn
                        , dwControlCodeIn
                        , lpBufferIn
                        , static_cast< DWORD >( cbBufferIn )
                        , m_cbhPropList.pb
                        , static_cast< DWORD >( m_cbBufferSize )
                        , &cbProps
                        );
        if ( sc == ERROR_MORE_DATA )
        {
            sc = ScAllocPropList( cbProps );
            if ( sc == ERROR_SUCCESS )
            {
                sc = ClusterResourceControl(
                                  hResourceIn
                                , hHostNodeIn
                                , dwControlCodeIn
                                , lpBufferIn
                                , static_cast< DWORD >( cbBufferIn )
                                , m_cbhPropList.pb
                                , static_cast< DWORD >( m_cbBufferSize )
                                , &cbProps
                                );
            } // if: ScAllocPropList succeeded
        } // if: buffer too small
    } // if: ScAllocPropList succeeded

    if ( sc != ERROR_SUCCESS )
    {
        DeletePropList();
    } // if: error getting properties.
    else
    {
        m_cbDataSize = static_cast< size_t >( cbProps );
        m_cbDataLeft = static_cast< size_t >( cbProps );
    } // else: no errors

    return sc;

} //*** CClusPropList::ScGetResourceProperties

DWORD CClusPropList::ScGetResourceTypeProperties | ( | HCLUSTER | hClusterIn,
 |  | LPCWSTR | pwszResTypeNameIn,
 |  | DWORD | dwControlCodeIn,
 |  | HNODE | hHostNodeIn = NULL,
 |  | LPVOID | lpBufferIn = NULL,
 |  | size_t | cbBufferIn = 0
 | ) |  |
DWORD CClusPropList::ScGetResourceTypeProperties | ( | HCLUSTER | hClusterIn,
 |  | LPCWSTR | pwszResTypeNameIn,
 |  | DWORD | dwControlCodeIn,
 |  | HNODE | hHostNodeIn = NULL,
 |  | LPVOID | lpBufferIn = NULL,
 |  | size_t | cbBufferIn = 0
 | ) |  |
DWORD CClusPropList::ScGetResourceTypeProperties | ( | HCLUSTER | hClusterIn,
 |  | LPCWSTR | pwszResTypeNameIn,
 |  | DWORD | dwControlCodeIn,
 |  | HNODE | hHostNodeIn = NULL,
 |  | LPVOID | lpBufferIn = NULL,
 |  | size_t | cbBufferIn = 0
 | ) |  |

Definition at line 3013 of file PropList.cpp.

{
    ASSERT( hClusterIn != NULL );
    ASSERT( pwszResTypeNameIn != NULL );
    ASSERT( *pwszResTypeNameIn != L'\0' );
    ASSERT( ( dwControlCodeIn & ( CLUSCTL_OBJECT_MASK << CLUSCTL_OBJECT_SHIFT ) )
            == ( CLUS_OBJECT_RESOURCE_TYPE << CLUSCTL_OBJECT_SHIFT ) );

    DWORD   sc = ERROR_SUCCESS;
    DWORD   cbProps = 256;

    //
    // Overwrite anything that may be in the buffer.
    // Allows this class instance to be reused.
    //

    m_cbDataSize = 0;

    //
    // Get properties.
    //

    sc = ScAllocPropList( cbProps );
    if ( sc == ERROR_SUCCESS )
    {
        sc = ClusterResourceTypeControl(
                          hClusterIn
                        , pwszResTypeNameIn
                        , hHostNodeIn
                        , dwControlCodeIn
                        , lpBufferIn
                        , static_cast< DWORD >( cbBufferIn )
                        , m_cbhPropList.pb
                        , static_cast< DWORD >( m_cbBufferSize )
                        , &cbProps
                        );
        if ( sc == ERROR_MORE_DATA )
        {
            sc = ScAllocPropList( cbProps );
            if ( sc == ERROR_SUCCESS )
            {
                sc = ClusterResourceTypeControl(
                                  hClusterIn
                                , pwszResTypeNameIn
                                , hHostNodeIn
                                , dwControlCodeIn
                                , lpBufferIn
                                , static_cast< DWORD >( cbBufferIn )
                                , m_cbhPropList.pb
                                , static_cast< DWORD >( m_cbBufferSize )
                                , &cbProps
                                );
            } // if: ScAllocPropList succeeded
        } // if: buffer too small
    } // if: ScAllocPropList succeeded

    if ( sc != ERROR_SUCCESS )
    {
        DeletePropList();
    } // if: error getting properties.
    else
    {
        m_cbDataSize = static_cast< size_t >( cbProps );
        m_cbDataLeft = static_cast< size_t >( cbProps );
    } // else: no errors

    return sc;

} //*** CClusPropList::ScGetResourceTypeProperties

DWORD CClusPropList::ScMoveToFirstProperty ( void )
DWORD CClusPropList::ScMoveToFirstProperty ( void )

Definition at line 1109 of file PropList.cpp.

{
    ASSERT( m_cbhPropList.pb != NULL );
    ASSERT( m_cbDataSize >= sizeof( m_cbhPropList.pList->nPropertyCount ) );

    DWORD                   sc;
    size_t                  cbDataLeft;
    size_t                  cbDataSize;
    CLUSPROP_BUFFER_HELPER  cbhCurrentValue;

    //
    // Make sure the buffer is big enough for the list header.
    //

    if ( m_cbDataSize < sizeof( m_cbhPropList.pList->nPropertyCount ) )
    {
        sc = ERROR_INVALID_DATA;
        goto Cleanup;
    } // if: not enough data

    //
    // Set the property counter to the number of properties in the list.
    //

    m_nPropsRemaining = m_cbhPropList.pList->nPropertyCount;

    //
    // Point the name pointer to the first name in the list.
    //

    m_cbhCurrentPropName.pName = &m_cbhPropList.pList->PropertyName;
    m_cbDataLeft = m_cbDataSize - sizeof( m_cbhPropList.pList->nPropertyCount );

    //
    // Check to see if there are any properties in the list.
    //

    if ( m_nPropsRemaining == 0 )
    {
        sc = ERROR_NO_MORE_ITEMS;
        goto Cleanup;
    } // if: no properties in the list

    //
    // Make sure the buffer is big enough for the first property name.
    //

    if ( m_cbDataLeft < sizeof( *m_cbhCurrentPropName.pName ) )
    {
        sc = ERROR_INVALID_DATA;
        goto Cleanup;
    } // if: not enough data left

    //
    // Calculate how much to advance the buffer pointer.
    //

    cbDataSize = sizeof( *m_cbhCurrentPropName.pName )
                + ALIGN_CLUSPROP( m_cbhCurrentPropName.pName->cbLength );

    //
    // Make sure the buffer is big enough for the name header
    // and the data itself.
    //

    if ( m_cbDataLeft < cbDataSize )
    {
        sc = ERROR_INVALID_DATA;
        goto Cleanup;
    } // if: not enough data left

    //
    // Point the value buffer to the first value in the list.
    //

    cbhCurrentValue.pb = m_cbhCurrentPropName.pb + cbDataSize;
    cbDataLeft = m_cbDataLeft - cbDataSize;
    m_pvlValues.Init( cbhCurrentValue, cbDataLeft );

    //
    // Indicate we are successful.
    //

    sc = ERROR_SUCCESS;

Cleanup:

    return sc;

} //*** CClusPropList::ScMoveToFirstProperty

DWORD CClusPropList::ScMoveToFirstProperty ( void )
DWORD CClusPropList::ScMoveToFirstPropertyValue ( void ) [inline]

Definition at line 907 of file PropList.h.

    {
        return m_pvlValues.ScMoveToFirstValue();

    } //*** ScMoveToFirstPropertyValue

DWORD CClusPropList::ScMoveToFirstPropertyValue ( void ) [inline]

Definition at line 803 of file PropList.h.

    {
        return m_pvlValues.ScMoveToFirstValue();

    } //*** ScMoveToFirstPropertyValue

DWORD CClusPropList::ScMoveToFirstPropertyValue ( void ) [inline]

Definition at line 907 of file PropList.h.

    {
        return m_pvlValues.ScMoveToFirstValue();

    } //*** ScMoveToFirstPropertyValue

DWORD CClusPropList::ScMoveToNextProperty ( void )

Definition at line 1219 of file PropList.cpp.

{
    ASSERT( m_cbhPropList.pb != NULL );
    ASSERT( m_pvlValues.CbhValueList().pb != NULL );

    DWORD                   sc = ERROR_SUCCESS;
    size_t                  cbNameSize = 0;
    size_t                  cbDataLeft = 0;
    size_t                  cbDataSize = 0;
    CLUSPROP_BUFFER_HELPER  cbhCurrentValue;
    CLUSPROP_BUFFER_HELPER  cbhPropName;

    cbhCurrentValue = m_pvlValues;
    cbDataLeft = m_pvlValues.CbDataLeft();

    //
    // If we aren't already at the last property, attempt to move to the next one.
    //

    sc = ScCheckIfAtLastProperty();
    if ( sc != ERROR_SUCCESS )
    {
        goto Cleanup;
    } // if: already at the last property (probably)

    //
    // Make sure the buffer is big enough for the value header.
    //

    if ( cbDataLeft < sizeof( *cbhCurrentValue.pValue ) )
    {
        sc = ERROR_INVALID_DATA;
        goto Cleanup;
    } // if: not enough data left

    //
    // Careful!  Add offset only to cbhCurrentValue.pb.  Otherwise
    // pointer arithmetic will give undesirable results.
    //

    while ( cbhCurrentValue.pSyntax->dw != CLUSPROP_SYNTAX_ENDMARK )
    {
        //
        // Make sure the buffer is big enough for the value
        // and an endmark.
        //

        cbDataSize = sizeof( *cbhCurrentValue.pValue )
                    + ALIGN_CLUSPROP( cbhCurrentValue.pValue->cbLength );
        if ( cbDataLeft < cbDataSize + sizeof( *cbhCurrentValue.pSyntax ) )
        {
            sc = ERROR_INVALID_DATA;
            goto Cleanup;
        } // if: not enough data left

        //
        // Advance past the value.
        //

        cbhCurrentValue.pb += cbDataSize;
        cbDataLeft -= cbDataSize;
    } // while: not at endmark

    if ( sc != ERROR_SUCCESS )
    {
        goto Cleanup;
    } // if: error occurred in loop

    //
    // Advanced past the endmark.
    // Size check already performed in above loop.
    //

    cbDataSize = sizeof( *cbhCurrentValue.pSyntax );
    cbhCurrentValue.pb += cbDataSize;
    cbDataLeft -= cbDataSize;

    //
    // Point the name pointer to the next name in the list.
    //

    cbhPropName = cbhCurrentValue;
    ASSERT( cbDataLeft == m_cbDataSize - (cbhPropName.pb - m_cbhPropList.pb) );

    //
    // Calculate the size of the name with header.
    // Make sure the buffer is big enough for the name and an endmark.
    //

    if ( cbDataLeft < sizeof( *cbhPropName.pName ) )
    {
        sc = ERROR_INVALID_DATA;
        goto Cleanup;
    } // if: not enough data

    cbNameSize = sizeof( *cbhPropName.pName )
                + ALIGN_CLUSPROP( cbhPropName.pName->cbLength );

    if ( cbDataLeft < cbNameSize + sizeof( CLUSPROP_SYNTAX ) )
    {
        sc = ERROR_INVALID_DATA;
        goto Cleanup;
    } // if: not enough data

    //
    // Point the value buffer to the first value in the list.
    //

    cbhCurrentValue.pb = cbhPropName.pb + cbNameSize;
    m_cbhCurrentPropName = cbhPropName;
    m_cbDataLeft = cbDataLeft - cbNameSize;
    m_pvlValues.Init( cbhCurrentValue, m_cbDataLeft );

    //
    // We've successfully advanced to the next property,
    // so there is now one fewer property remaining.
    //

    --m_nPropsRemaining;
    ASSERT( m_nPropsRemaining >= 1 );

    sc = ERROR_SUCCESS;

Cleanup:

    return sc;

} //*** CClusPropList::ScMoveToNextProperty

DWORD CClusPropList::ScMoveToNextProperty ( void )
DWORD CClusPropList::ScMoveToNextProperty ( void )
DWORD CClusPropList::ScMoveToNextPropertyValue ( void ) [inline]

Definition at line 914 of file PropList.h.

    {
        return m_pvlValues.ScMoveToNextValue();

    } //*** ScMoveToNextPropertyValue

DWORD CClusPropList::ScMoveToNextPropertyValue ( void ) [inline]

Definition at line 914 of file PropList.h.

    {
        return m_pvlValues.ScMoveToNextValue();

    } //*** ScMoveToNextPropertyValue

DWORD CClusPropList::ScMoveToNextPropertyValue ( void ) [inline]

Definition at line 810 of file PropList.h.

    {
        return m_pvlValues.ScMoveToNextValue();

    } //*** ScMoveToNextPropertyValue

DWORD CClusPropList::ScMoveToPropertyByName ( LPCWSTR pwszPropNameIn )
DWORD CClusPropList::ScMoveToPropertyByName ( LPCWSTR pwszPropNameIn )
DWORD CClusPropList::ScMoveToPropertyByName ( LPCWSTR pwszPropNameIn )

Definition at line 1367 of file PropList.cpp.

{
    ASSERT( m_cbhPropList.pb != NULL );

    DWORD   sc = ERROR_SUCCESS;

    sc = ScMoveToFirstProperty();
    if ( sc == ERROR_SUCCESS )
    {
        do
        {
            //
            // See if this is the specified property.  If so, we're done.
            //

            if ( IStringCompareW( m_cbhCurrentPropName.pName->sz, pwszPropNameIn ) == 0 )
            {
                break;
            } // if: property found

            //
            // Advance to the next property.
            //

            sc = ScMoveToNextProperty();   // No because we expect an error when at the d

        } while ( sc == ERROR_SUCCESS );   // do-while: not end of list
    } // if: successfully moved to the first property

    return sc;

} //*** ClusPropList::ScMoveToPropertyByName( LPCWSTR )

DWORD CClusPropList::ScSetPropToDefault | ( | LPCWSTR | pwszNameIn,
 |  | CLUSTER_PROPERTY_FORMAT | propFormatIn
 | ) |  |

Definition at line 2197 of file PropList.cpp.

{
    ASSERT( pwszNameIn != NULL );

    DWORD                   sc = ERROR_SUCCESS;
    size_t                  cbNameSize = 0;
    size_t                  cbValueSize = 0;
    PCLUSPROP_PROPERTY_NAME pName = NULL;
    PCLUSPROP_VALUE         pValue = NULL;

    //
    //  Calculate sizes and make sure we have a property list.
    //

    cbNameSize = sizeof( CLUSPROP_PROPERTY_NAME )
                + ALIGN_CLUSPROP( (lstrlenW( pwszNameIn ) + 1) * sizeof( *pwszNameIn ) );

    cbValueSize = sizeof( CLUSPROP_BINARY )
                + sizeof( CLUSPROP_SYNTAX ); // value list endmark

    sc = ScAllocPropList( cbNameSize + cbValueSize );
    if ( sc == ERROR_SUCCESS )
    {
        //
        // Set the property name.
        //

        pName = m_cbhCurrentProp.pName;
        CopyProp( pName, CLUSPROP_TYPE_NAME, pwszNameIn );
        m_cbhCurrentProp.pb += cbNameSize;

        //
        // Set the property value.
        //

        pValue = m_cbhCurrentProp.pValue;
        CopyEmptyProp( pValue, CLUSPROP_TYPE_LIST_VALUE, cpfPropFormatIn );
        m_cbhCurrentProp.pb += cbValueSize;

        //
        // Increment the property count and buffer size.
        //

        m_cbhPropList.pList->nPropertyCount++;
        m_cbDataSize += cbNameSize + cbValueSize;
    } // if:

    return sc;

} //*** CClusPropList::ScSetPropToDefault

DWORD CClusPropList::ScSetPropToDefault | ( | LPCWSTR | pwszNameIn,
 |  | CLUSTER_PROPERTY_FORMAT | propFormatIn
 | ) |  |
DWORD CClusPropList::ScSetPropToDefault | ( | LPCWSTR | pwszNameIn,
 |  | CLUSTER_PROPERTY_FORMAT | propFormatIn
 | ) |  |

Member Data Documentation

DWORD CClusPropList::m_cbBufferSize [protected]

Definition at line 747 of file PropList.h.

DWORD CClusPropList::m_cbDataLeft [protected]

Definition at line 749 of file PropList.h.

DWORD CClusPropList::m_cbDataSize [protected]

Definition at line 748 of file PropList.h.

CLUSPROP_BUFFER_HELPER CClusPropList::m_cbhCurrentProp [protected]

Definition at line 746 of file PropList.h.

CLUSPROP_BUFFER_HELPER CClusPropList::m_cbhCurrentPropName [private]

Definition at line 752 of file PropList.h.

CLUSPROP_BUFFER_HELPER CClusPropList::m_cbhPropList [protected]

Definition at line 745 of file PropList.h.

BOOL CClusPropList::m_fAlwaysAddProp [protected]

Definition at line 744 of file PropList.h.

DWORD CClusPropList::m_nPropsRemaining [private]

Definition at line 753 of file PropList.h.

CClusPropValueList CClusPropList::m_pvlValues [private]

Definition at line 754 of file PropList.h.

The documentation for this class was generated from the following files:
  • WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/PropList.h
  • WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/PropList.h
  • WinBase/Cluster/Win2003/MyStorageResource/PropList.h
  • WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/PropList.cpp
  • WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/PropList.cpp
  • WinBase/Cluster/Win2003/MyStorageResource/PropList.cpp
Generated on Wed Nov 13 2024 16:55:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CClusPropValueList Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CClusPropValueList Class Reference

#include "PropList.h"

List of all members.

Public Member Functions

CClusPropValueList (void)
CClusPropValueList (const CClusPropValueList &rcpvlInout)
CClusPropValueList (void)
CClusPropValueList (CLUSPROP_BUFFER_HELPER cbhValueListIn, size_t cbDataSizeIn)
CClusPropValueList (void)
CClusPropValueList (const CClusPropValueList &rcpvlInout)
CClusPropValueList (const CClusPropValueList &rcpvlInout)
CClusPropValueList (CLUSPROP_BUFFER_HELPER cbhValueListIn, size_t cbDataSizeIn)
CClusPropValueList (CLUSPROP_BUFFER_HELPER cbhValueListIn, size_t cbDataSizeIn)
~CClusPropValueList (void)
~CClusPropValueList (void)
~CClusPropValueList (void)
DWORD | CbCurrentValueLength (void) const
DWORD | CbCurrentValueLength (void) const
DWORD | CbCurrentValueLength (void) const
DWORD | CbDataLeft (void) const
DWORD | CbDataLeft (void) const
DWORD | CbDataLeft (void) const
DWORD | CbDataSize (void) const
DWORD | CbDataSize (void) const
DWORD | CbDataSize (void) const
CLUSPROP_BUFFER_HELPER | CbhCurrentValue (void) const
CLUSPROP_BUFFER_HELPER | CbhCurrentValue (void) const
CLUSPROP_BUFFER_HELPER | CbhCurrentValue (void) const
CLUSPROP_BUFFER_HELPER | CbhValueList (void) const
CLUSPROP_BUFFER_HELPER | CbhValueList (void) const
CLUSPROP_BUFFER_HELPER | CbhValueList (void) const
CLUSTER_PROPERTY_FORMAT | CpfCurrentValueFormat (void) const
CLUSTER_PROPERTY_FORMAT | CpfCurrentValueFormat (void) const
CLUSTER_PROPERTY_FORMAT | CpfCurrentValueFormat (void) const
CLUSTER_PROPERTY_SYNTAX | CpsCurrentValueSyntax (void) const
CLUSTER_PROPERTY_SYNTAX | CpsCurrentValueSyntax (void) const
CLUSTER_PROPERTY_SYNTAX | CpsCurrentValueSyntax (void) const
CLUSTER_PROPERTY_TYPE | CptCurrentValueType (void) const
CLUSTER_PROPERTY_TYPE | CptCurrentValueType (void) const
CLUSTER_PROPERTY_TYPE | CptCurrentValueType (void) const
void | DeleteValueList (void)
void | DeleteValueList (void)
void | DeleteValueList (void)
void | Init (const CLUSPROP_BUFFER_HELPER cbhValueListIn, size_t cbDataSizeIn)
void | Init (const CLUSPROP_BUFFER_HELPER cbhValueListIn, size_t cbDataSizeIn)
void | Init (const CClusPropValueList &rcpvlInout)
void | Init (const CClusPropValueList &rcpvlInout)
void | Init (const CLUSPROP_BUFFER_HELPER cbhValueListIn, size_t cbDataSizeIn)
void | Init (const CClusPropValueList &rcpvlInout)
operator const CLUSPROP_BUFFER_HELPER (void) const
operator const CLUSPROP_BUFFER_HELPER (void) const
operator const CLUSPROP_BUFFER_HELPER (void) const
void | operator= (const CClusPropValueList &rcpvlInout)
void | operator= (const CClusPropValueList &rcpvlInout)
void | operator= (const CClusPropValueList &rcpvlInout)
DWORD | ScAllocValueList (size_t cbMinimumIn)
DWORD | ScAllocValueList (size_t cbMinimumIn)
DWORD | ScAllocValueList (size_t cbMinimumIn)
DWORD | ScCheckIfAtLastValue (void)
DWORD | ScCheckIfAtLastValue (void)
DWORD | ScCheckIfAtLastValue (void)
DWORD | ScGetResourceTypeValueList (HCLUSTER hClusterIn, LPCWSTR pwszResTypeNameIn, DWORD dwControlCodeIn, HNODE hHostNodeIn=NULL, LPVOID lpBufferIn=NULL, size_t cbBufferIn=0)
DWORD | ScGetResourceTypeValueList (HCLUSTER hClusterIn, LPCWSTR pwszResTypeNameIn, DWORD dwControlCodeIn, HNODE hHostNodeIn=NULL, LPVOID lpBufferIn=NULL, size_t cbBufferIn=0)
DWORD | ScGetResourceTypeValueList (HCLUSTER hClusterIn, LPCWSTR pwszResTypeNameIn, DWORD dwControlCodeIn, HNODE hHostNodeIn=NULL, LPVOID lpBufferIn=NULL, size_t cbBufferIn=0)
DWORD | ScGetResourceValueList (HRESOURCE hResourceIn, DWORD dwControlCodeIn, HNODE hHostNodeIn=NULL, LPVOID lpBufferIn=NULL, size_t cbBufferIn=0)
DWORD | ScGetResourceValueList (HRESOURCE hResourceIn, DWORD dwControlCodeIn, HNODE hHostNodeIn=NULL, LPVOID lpBufferIn=NULL, size_t cbBufferIn=0)
DWORD | ScGetResourceValueList (HRESOURCE hResourceIn, DWORD dwControlCodeIn, HNODE hHostNodeIn=NULL, LPVOID lpBufferIn=NULL, size_t cbBufferIn=0)
DWORD | ScMoveToFirstValue (void)
DWORD | ScMoveToFirstValue (void)
DWORD | ScMoveToFirstValue (void)
DWORD | ScMoveToNextValue (void)
DWORD | ScMoveToNextValue (void)
DWORD | ScMoveToNextValue (void)

Private Attributes

DWORD m_cbBufferSize
DWORD m_cbDataLeft
DWORD m_cbDataSize
CLUSPROP_BUFFER_HELPER | m_cbhCurrentValue
CLUSPROP_BUFFER_HELPER | m_cbhValueList
BOOL m_fAtEnd

Detailed Description

Definition at line 413 of file PropList.h.

Constructor & Destructor Documentation

CClusPropValueList::CClusPropValueList ( void ) [inline]

Definition at line 429 of file PropList.h.

        : m_cbDataSize( 0 )
        , m_cbDataLeft( 0 )
        , m_cbBufferSize( 0 )
        , m_fAtEnd( FALSE )
    {
        m_cbhValueList.pb = NULL;
        m_cbhCurrentValue.pb = NULL;

    } //*** CClusPropValueList

CClusPropValueList::CClusPropValueList ( const CClusPropValueList & rcpvlInout ) [inline]

Definition at line 441 of file PropList.h.

        : m_cbBufferSize( 0 )
        , m_fAtEnd( FALSE )
    {
        Init( rcpvlInout );

    } //*** CClusPropValueList

CClusPropValueList::CClusPropValueList | ( | CLUSPROP_BUFFER_HELPER | cbhValueListIn,
 |  | size_t | cbDataSizeIn |
 | ) |  |  | [inline]

Definition at line 452 of file PropList.h.

        : m_cbBufferSize( 0 )
        , m_fAtEnd( FALSE )
    {
        Init( cbhValueListIn, cbDataSizeIn );

    } //*** CClusPropValueList

CClusPropValueList::~CClusPropValueList ( void ) [inline]

Definition at line 464 of file PropList.h.

    {
        DeleteValueList();

    } //*** ~CClusPropValueList

CClusPropValueList::CClusPropValueList ( void ) [inline]

Definition at line 429 of file PropList.h.

        : m_cbDataSize( 0 )
        , m_cbDataLeft( 0 )
        , m_cbBufferSize( 0 )
        , m_fAtEnd( FALSE )
    {
        m_cbhValueList.pb = NULL;
        m_cbhCurrentValue.pb = NULL;

    } //*** CClusPropValueList

CClusPropValueList::CClusPropValueList ( const CClusPropValueList & rcpvlInout ) [inline]

Definition at line 441 of file PropList.h.

        : m_cbBufferSize( 0 )
        , m_fAtEnd( FALSE )
    {
        Init( rcpvlInout );

    } //*** CClusPropValueList

CClusPropValueList::CClusPropValueList | ( | CLUSPROP_BUFFER_HELPER | cbhValueListIn,
 |  | size_t | cbDataSizeIn |
 | ) |  |  | [inline]

Definition at line 452 of file PropList.h.

        : m_cbBufferSize( 0 )
        , m_fAtEnd( FALSE )
    {
        Init( cbhValueListIn, cbDataSizeIn );

    } //*** CClusPropValueList

CClusPropValueList::~CClusPropValueList ( void ) [inline]

Definition at line 464 of file PropList.h.

    {
        DeleteValueList();

    } //*** ~CClusPropValueList

CClusPropValueList::CClusPropValueList ( void ) [inline]

Definition at line 325 of file PropList.h.

        : m_cbDataSize( 0 )
        , m_cbDataLeft( 0 )
        , m_cbBufferSize( 0 )
        , m_fAtEnd( FALSE )
    {
        m_cbhValueList.pb = NULL;
        m_cbhCurrentValue.pb = NULL;

    } //*** CClusPropValueList

CClusPropValueList::CClusPropValueList ( const CClusPropValueList & rcpvlInout ) [inline]

Definition at line 337 of file PropList.h.

        : m_cbBufferSize( 0 )
        , m_fAtEnd( FALSE )
    {
        Init( rcpvlInout );

    } //*** CClusPropValueList

CClusPropValueList::CClusPropValueList | ( | CLUSPROP_BUFFER_HELPER | cbhValueListIn,
 |  | size_t | cbDataSizeIn |
 | ) |  |  | [inline]

Definition at line 348 of file PropList.h.

        : m_cbBufferSize( 0 )
        , m_fAtEnd( FALSE )
    {
        Init( cbhValueListIn, cbDataSizeIn );

    } //*** CClusPropValueList

CClusPropValueList::~CClusPropValueList ( void ) [inline]

Definition at line 360 of file PropList.h.

    {
        DeleteValueList();

    } //*** ~CClusPropValueList

Member Function Documentation

DWORD CClusPropValueList::CbCurrentValueLength ( void ) const [inline]

Definition at line 563 of file PropList.h.

    {
        DWORD cbLength = 0;

        if ( m_cbhCurrentValue.pb == NULL )
        {
            cbLength = 0;
        } // if: no value list allocated yet
        else
        {
            cbLength = m_cbhCurrentValue.pValue->cbLength;
        } // else: value list allocated

        return cbLength;

    } //*** CbCurrentValueLength

DWORD CClusPropValueList::CbCurrentValueLength ( void ) const [inline]

Definition at line 563 of file PropList.h.

    {
        DWORD cbLength = 0;

        if ( m_cbhCurrentValue.pb == NULL )
        {
            cbLength = 0;
        } // if: no value list allocated yet
        else
        {
            cbLength = m_cbhCurrentValue.pValue->cbLength;
        } // else: value list allocated

        return cbLength;

    } //*** CbCurrentValueLength

DWORD CClusPropValueList::CbCurrentValueLength ( void ) const [inline]

Definition at line 459 of file PropList.h.

    {
        DWORD cbLength = 0;

        if ( m_cbhCurrentValue.pb == NULL )
        {
            cbLength = 0;
        } // if: no value list allocated yet
        else
        {
            cbLength = m_cbhCurrentValue.pValue->cbLength;
        } // else: value list allocated

        return cbLength;

    } //*** CbCurrentValueLength

DWORD CClusPropValueList::CbDataLeft ( void ) const [inline]

Definition at line 484 of file PropList.h.

    {
        return m_cbDataLeft;

    } //*** CbDataLeft

DWORD CClusPropValueList::CbDataLeft ( void ) const [inline]

Definition at line 588 of file PropList.h.

    {
        return m_cbDataLeft;

    } //*** CbDataLeft

DWORD CClusPropValueList::CbDataLeft ( void ) const [inline]

Definition at line 588 of file PropList.h.

    {
        return m_cbDataLeft;

    } //*** CbDataLeft

DWORD CClusPropValueList::CbDataSize ( void ) const [inline]

Definition at line 581 of file PropList.h.

    {
        return m_cbDataSize;

    } //*** CbDataSize

DWORD CClusPropValueList::CbDataSize ( void ) const [inline]

Definition at line 477 of file PropList.h.

    {
        return m_cbDataSize;

    } //*** CbDataSize

DWORD CClusPropValueList::CbDataSize ( void ) const [inline]

Definition at line 581 of file PropList.h.

    {
        return m_cbDataSize;

    } //*** CbDataSize

CLUSPROP_BUFFER_HELPER CClusPropValueList::CbhCurrentValue ( void ) const [inline]

Definition at line 535 of file PropList.h.

    {
        return m_cbhCurrentValue;

    } //*** CbhCurrentValue

CLUSPROP_BUFFER_HELPER CClusPropValueList::CbhCurrentValue ( void ) const [inline]

Definition at line 431 of file PropList.h.

    {
        return m_cbhCurrentValue;

    } //*** CbhCurrentValue

CLUSPROP_BUFFER_HELPER CClusPropValueList::CbhCurrentValue ( void ) const [inline]

Definition at line 535 of file PropList.h.

    {
        return m_cbhCurrentValue;

    } //*** CbhCurrentValue

CLUSPROP_BUFFER_HELPER CClusPropValueList::CbhValueList ( void ) const [inline]

Definition at line 424 of file PropList.h.

    {
        return m_cbhValueList;

    } //*** CbhValueList

CLUSPROP_BUFFER_HELPER CClusPropValueList::CbhValueList ( void ) const [inline]

Definition at line 528 of file PropList.h.

    {
        return m_cbhValueList;

    } //*** CbhValueList

CLUSPROP_BUFFER_HELPER CClusPropValueList::CbhValueList ( void ) const [inline]

Definition at line 528 of file PropList.h.

    {
        return m_cbhValueList;

    } //*** CbhValueList

CLUSTER_PROPERTY_FORMAT CClusPropValueList::CpfCurrentValueFormat ( void ) const [inline]

Definition at line 438 of file PropList.h.

    {
        return static_cast< CLUSTER_PROPERTY_FORMAT >( m_cbhCurrentValue.pValue->Syntax.wFormat );

    } //*** CpfCurrentValueFormat

CLUSTER_PROPERTY_FORMAT CClusPropValueList::CpfCurrentValueFormat ( void ) const [inline]

Definition at line 542 of file PropList.h.

    {
        return static_cast< CLUSTER_PROPERTY_FORMAT >( m_cbhCurrentValue.pValue->Syntax.wFormat );

    } //*** CpfCurrentValueFormat

CLUSTER_PROPERTY_FORMAT CClusPropValueList::CpfCurrentValueFormat ( void ) const [inline]

Definition at line 542 of file PropList.h.

    {
        return static_cast< CLUSTER_PROPERTY_FORMAT >( m_cbhCurrentValue.pValue->Syntax.wFormat );

    } //*** CpfCurrentValueFormat

CLUSTER_PROPERTY_SYNTAX CClusPropValueList::CpsCurrentValueSyntax ( void ) const [inline]

Definition at line 556 of file PropList.h.

    {
        return static_cast< CLUSTER_PROPERTY_SYNTAX >( m_cbhCurrentValue.pValue->Syntax.dw );

    } //*** CpsCurrentValueSyntax

CLUSTER_PROPERTY_SYNTAX CClusPropValueList::CpsCurrentValueSyntax ( void ) const [inline]

Definition at line 452 of file PropList.h.

    {
        return static_cast< CLUSTER_PROPERTY_SYNTAX >( m_cbhCurrentValue.pValue->Syntax.dw );

    } //*** CpsCurrentValueSyntax

CLUSTER_PROPERTY_SYNTAX CClusPropValueList::CpsCurrentValueSyntax ( void ) const [inline]

Definition at line 556 of file PropList.h.

    {
        return static_cast< CLUSTER_PROPERTY_SYNTAX >( m_cbhCurrentValue.pValue->Syntax.dw );

    } //*** CpsCurrentValueSyntax

CLUSTER_PROPERTY_TYPE CClusPropValueList::CptCurrentValueType ( void ) const [inline]

Definition at line 549 of file PropList.h.

    {
        return static_cast< CLUSTER_PROPERTY_TYPE >( m_cbhCurrentValue.pValue->Syntax.wType );

    } //*** CptCurrentValueType

CLUSTER_PROPERTY_TYPE CClusPropValueList::CptCurrentValueType ( void ) const [inline]

Definition at line 445 of file PropList.h.

    {
        return static_cast< CLUSTER_PROPERTY_TYPE >( m_cbhCurrentValue.pValue->Syntax.wType );

    } //*** CptCurrentValueType

CLUSTER_PROPERTY_TYPE CClusPropValueList::CptCurrentValueType ( void ) const [inline]

Definition at line 549 of file PropList.h.

    {
        return static_cast< CLUSTER_PROPERTY_TYPE >( m_cbhCurrentValue.pValue->Syntax.wType );

    } //*** CptCurrentValueType

void CClusPropValueList::DeleteValueList ( void ) [inline]

Definition at line 614 of file PropList.h.

    {
        //
        // If m_cbBufferSize is greater then 0 then we allocated the value list.
        // If it's zero then the value list is a part of the property list in
        // CClusPropList.
        //

        if ( m_cbBufferSize > 0 )
        {
            delete [] m_cbhValueList.pb;

            m_cbhValueList.pb = NULL;
            m_cbhCurrentValue.pb = NULL;
            m_cbBufferSize = 0;
            m_cbDataSize = 0;
            m_cbDataLeft = 0;
            m_fAtEnd = FALSE;
        } // if: we allocated anything

    } //*** DeleteValueList

void CClusPropValueList::DeleteValueList ( void ) [inline]

Definition at line 614 of file PropList.h.

    {
        //
        // If m_cbBufferSize is greater then 0 then we allocated the value list.
        // If it's zero then the value list is a part of the property list in
        // CClusPropList.
        //

        if ( m_cbBufferSize > 0 )
        {
            delete [] m_cbhValueList.pb;

            m_cbhValueList.pb = NULL;
            m_cbhCurrentValue.pb = NULL;
            m_cbBufferSize = 0;
            m_cbDataSize = 0;
            m_cbDataLeft = 0;
            m_fAtEnd = FALSE;
        } // if: we allocated anything

    } //*** DeleteValueList

void CClusPropValueList::DeleteValueList ( void ) [inline]

Definition at line 510 of file PropList.h.

    {
        //
        // If m_cbBufferSize is greater then 0 then we allocated the value list.
        // If it's zero then the value list is a part of the property list in
        // CClusPropList.
        //

        if ( m_cbBufferSize > 0 )
        {
            delete [] m_cbhValueList.pb;

            m_cbhValueList.pb = NULL;
            m_cbhCurrentValue.pb = NULL;
            m_cbBufferSize = 0;
            m_cbDataSize = 0;
            m_cbDataLeft = 0;
            m_fAtEnd = FALSE;
        } // if: we allocated anything

    } //*** DeleteValueList

void CClusPropValueList::Init ( const CClusPropValueList & rcpvlInout ) [inline]

Definition at line 472 of file PropList.h.

    {
        ASSERT( m_cbBufferSize == 0 );

        m_cbhValueList      = rcpvlInout.m_cbhValueList;
        m_cbhCurrentValue   = rcpvlInout.m_cbhCurrentValue;
        m_cbDataSize        = rcpvlInout.m_cbDataSize;
        m_cbDataLeft        = rcpvlInout.m_cbDataLeft;
        m_fAtEnd            = rcpvlInout.m_fAtEnd;

    } //*** Init

void CClusPropValueList::Init ( const CClusPropValueList & rcpvlInout ) [inline]

Definition at line 368 of file PropList.h.

    {
        ASSERT( m_cbBufferSize == 0 );

        m_cbhValueList      = rcpvlInout.m_cbhValueList;
        m_cbhCurrentValue   = rcpvlInout.m_cbhCurrentValue;
        m_cbDataSize        = rcpvlInout.m_cbDataSize;
        m_cbDataLeft        = rcpvlInout.m_cbDataLeft;
        m_fAtEnd            = rcpvlInout.m_fAtEnd;

    } //*** Init

void CClusPropValueList::Init ( const CClusPropValueList & rcpvlInout ) [inline]

Definition at line 472 of file PropList.h.

    {
        ASSERT( m_cbBufferSize == 0 );

        m_cbhValueList      = rcpvlInout.m_cbhValueList;
        m_cbhCurrentValue   = rcpvlInout.m_cbhCurrentValue;
        m_cbDataSize        = rcpvlInout.m_cbDataSize;
        m_cbDataLeft        = rcpvlInout.m_cbDataLeft;
        m_fAtEnd            = rcpvlInout.m_fAtEnd;

    } //*** Init

void CClusPropValueList::Init | ( | const CLUSPROP_BUFFER_HELPER | cbhValueListIn,
 |  | size_t | cbDataSizeIn |
 | ) |  |  | [inline]

Definition at line 384 of file PropList.h.

    {
        ASSERT( m_cbBufferSize == 0 );

        m_cbhValueList      = cbhValueListIn;
        m_cbhCurrentValue   = cbhValueListIn;
        m_cbDataSize        = cbDataSizeIn;
        m_cbDataLeft        = cbDataSizeIn;
        m_fAtEnd            = FALSE;

    } //*** Init

void CClusPropValueList::Init | ( | const CLUSPROP_BUFFER_HELPER | cbhValueListIn,
 |  | size_t | cbDataSizeIn |
 | ) |  |  | [inline]

Definition at line 488 of file PropList.h.

    {
        ASSERT( m_cbBufferSize == 0 );

        m_cbhValueList      = cbhValueListIn;
        m_cbhCurrentValue   = cbhValueListIn;
        m_cbDataSize        = cbDataSizeIn;
        m_cbDataLeft        = cbDataSizeIn;
        m_fAtEnd            = FALSE;

    } //*** Init

void CClusPropValueList::Init | ( | const CLUSPROP_BUFFER_HELPER | cbhValueListIn,
 |  | size_t | cbDataSizeIn |
 | ) |  |  | [inline]

Definition at line 488 of file PropList.h.

    {
        ASSERT( m_cbBufferSize == 0 );

        m_cbhValueList      = cbhValueListIn;
        m_cbhCurrentValue   = cbhValueListIn;
        m_cbDataSize        = cbDataSizeIn;
        m_cbDataLeft        = cbDataSizeIn;
        m_fAtEnd            = FALSE;

    } //*** Init

CClusPropValueList::operator const CLUSPROP_BUFFER_HELPER ( void ) const [inline]

Definition at line 521 of file PropList.h.

    {
        return m_cbhCurrentValue;

    } //*** operator CLUSPROP_BUFFER_HELPER

CClusPropValueList::operator const CLUSPROP_BUFFER_HELPER ( void ) const [inline]

Definition at line 521 of file PropList.h.

    {
        return m_cbhCurrentValue;

    } //*** operator CLUSPROP_BUFFER_HELPER

CClusPropValueList::operator const CLUSPROP_BUFFER_HELPER ( void ) const [inline]

Definition at line 417 of file PropList.h.

    {
        return m_cbhCurrentValue;

    } //*** operator CLUSPROP_BUFFER_HELPER

void CClusPropValueList::operator= ( const CClusPropValueList & rcpvlInout ) [inline]

Definition at line 504 of file PropList.h.

    {
        ASSERT( m_cbBufferSize == 0 );

        m_cbhValueList      = rcpvlInout.m_cbhValueList;
        m_cbhCurrentValue   = rcpvlInout.m_cbhCurrentValue;
        m_cbDataSize        = rcpvlInout.m_cbDataSize;
        m_cbDataLeft        = rcpvlInout.m_cbDataLeft;
        m_fAtEnd            = rcpvlInout.m_fAtEnd;

    } //*** operator=

void CClusPropValueList::operator= ( const CClusPropValueList & rcpvlInout ) [inline]

Definition at line 504 of file PropList.h.

    {
        ASSERT( m_cbBufferSize == 0 );

        m_cbhValueList      = rcpvlInout.m_cbhValueList;
        m_cbhCurrentValue   = rcpvlInout.m_cbhCurrentValue;
        m_cbDataSize        = rcpvlInout.m_cbDataSize;
        m_cbDataLeft        = rcpvlInout.m_cbDataLeft;
        m_fAtEnd            = rcpvlInout.m_fAtEnd;

    } //*** operator=

void CClusPropValueList::operator= ( const CClusPropValueList & rcpvlInout ) [inline]

Definition at line 400 of file PropList.h.

    {
        ASSERT( m_cbBufferSize == 0 );

        m_cbhValueList      = rcpvlInout.m_cbhValueList;
        m_cbhCurrentValue   = rcpvlInout.m_cbhCurrentValue;
        m_cbDataSize        = rcpvlInout.m_cbDataSize;
        m_cbDataLeft        = rcpvlInout.m_cbDataLeft;
        m_fAtEnd            = rcpvlInout.m_fAtEnd;

    } //*** operator=

DWORD CClusPropValueList::ScAllocValueList ( size_t cbMinimumIn )

Definition at line 665 of file PropList.cpp.

{
    ASSERT( cbMinimumIn > 0 );

    DWORD   sc = ERROR_SUCCESS;
    size_t  cbTotal = 0;

    //
    // Add the size of the item count and final endmark.
    //

    cbMinimumIn += sizeof( CLUSPROP_VALUE );
    cbTotal = m_cbDataSize + cbMinimumIn;

    if ( m_cbBufferSize < cbTotal )
    {
        PBYTE   _pbNewValuelist = NULL;

        cbMinimumIn = max( BUFFER_GROWTH_FACTOR, cbMinimumIn );
        cbTotal = m_cbDataSize + cbMinimumIn;

        //
        // Allocate and zero a new buffer.
        //

        _pbNewValuelist = new BYTE[ cbTotal ];
        if ( _pbNewValuelist != NULL )
        {
            ZeroMemory( _pbNewValuelist, cbTotal );

            //
            // If there was a previous buffer, copy it and the delete it.
            //

            if ( m_cbhValueList.pb != NULL )
            {
                if ( m_cbDataSize != 0 )
                {
                    CopyMemory( _pbNewValuelist, m_cbhValueList.pb, m_cbDataSize );
                } // if: data already exists in buffer

                delete [] m_cbhValueList.pb;
                m_cbhCurrentValue.pb = _pbNewValuelist + (m_cbhCurrentValue.pb - m_cbhValueList.pb);
            } // if: there was a previous buffer
            else
            {
                m_cbhCurrentValue.pb = _pbNewValuelist + sizeof( DWORD ); // move past prop count
            } // else: no previous buffer

            //
            // Save the new buffer.
            //

            m_cbhValueList.pb = _pbNewValuelist;
            m_cbBufferSize = cbTotal;
        } // if: allocation succeeded
        else
        {
            sc = ERROR_NOT_ENOUGH_MEMORY;
        } // else: allocation failed
    } // if: buffer isn't big enough

    return sc;

} //*** CClusPropValueList::ScAllocValueList

DWORD CClusPropValueList::ScAllocValueList ( size_t cbMinimumIn )
DWORD CClusPropValueList::ScAllocValueList ( size_t cbMinimumIn )
DWORD CClusPropValueList::ScCheckIfAtLastValue ( void )
DWORD CClusPropValueList::ScCheckIfAtLastValue ( void )

Definition at line 577 of file PropList.cpp.

{
    ASSERT( m_cbhCurrentValue.pb != NULL );

    DWORD                   sc = ERROR_SUCCESS;
    CLUSPROP_BUFFER_HELPER  cbhCurrentValue;
    size_t                  cbDataSize = 0;

    cbhCurrentValue = m_cbhCurrentValue;

    //
    // Don't try to recalculate if we already know
    // we're at the end of the list.
    //

    if ( m_fAtEnd )
    {
        goto Cleanup;
    } // if: already at the end of the list

    //
    // Make sure the buffer is big enough for the value header.
    //

    if ( m_cbDataLeft < sizeof( *cbhCurrentValue.pValue ) )
    {
        sc = ERROR_INVALID_DATA;
        goto Cleanup;
    } // if: not enough data left

    //
    // Calculate how much to advance buffer pointer.
    //

    cbDataSize = sizeof( *cbhCurrentValue.pValue )
                + ALIGN_CLUSPROP( cbhCurrentValue.pValue->cbLength );

    //
    // Make sure the buffer is big enough for the value header,
    // the data itself, and the endmark.
    //

    if ( m_cbDataLeft < cbDataSize + sizeof( CLUSPROP_SYNTAX ) )
    {
        sc = ERROR_INVALID_DATA;
        goto Cleanup;
    } // if: not enough data left

    //
    // Move past the current value to the next value's syntax.
    //

    cbhCurrentValue.pb += cbDataSize;

    //
    // We are on the last value if the next thing after this value
    // is an endmark.
    //

    if ( cbhCurrentValue.pSyntax->dw == CLUSPROP_SYNTAX_ENDMARK )
    {
        sc = ERROR_NO_MORE_ITEMS;
    } // if: next value's syntax is the endmark

Cleanup:

    return sc;

} //*** CClusPropValueList::ScCheckIfAtLastValue

DWORD CClusPropValueList::ScCheckIfAtLastValue ( void )
DWORD CClusPropValueList::ScGetResourceTypeValueList | ( | HCLUSTER | hClusterIn,
 |  | LPCWSTR | pwszResTypeNameIn,
 |  | DWORD | dwControlCodeIn,
 |  | HNODE | hHostNodeIn = NULL,
 |  | LPVOID | lpBufferIn = NULL,
 |  | size_t | cbBufferIn = 0
 | ) |  |
DWORD CClusPropValueList::ScGetResourceTypeValueList | ( | HCLUSTER | hClusterIn,
 |  | LPCWSTR | pwszResTypeNameIn,
 |  | DWORD | dwControlCodeIn,
 |  | HNODE | hHostNodeIn = NULL,
 |  | LPVOID | lpBufferIn = NULL,
 |  | size_t | cbBufferIn = 0
 | ) |  |
DWORD CClusPropValueList::ScGetResourceTypeValueList | ( | HCLUSTER | hClusterIn,
 |  | LPCWSTR | pwszResTypeNameIn,
 |  | DWORD | dwControlCodeIn,
 |  | HNODE | hHostNodeIn = NULL,
 |  | LPVOID | lpBufferIn = NULL,
 |  | size_t | cbBufferIn = 0
 | ) |  |

Definition at line 851 of file PropList.cpp.

{
    ASSERT( hClusterIn != NULL );
    ASSERT( pwszResTypeNameIn != NULL );
    ASSERT( *pwszResTypeNameIn != L'\0' );
    ASSERT( ( dwControlCodeIn & ( CLUSCTL_OBJECT_MASK << CLUSCTL_OBJECT_SHIFT ) )
            == ( CLUS_OBJECT_RESOURCE_TYPE << CLUSCTL_OBJECT_SHIFT ) );

    DWORD   sc = ERROR_SUCCESS;
    DWORD   cb = 512;

    //
    // Overwrite anything that may be in the buffer.
    // Allows this class instance to be reused.
    //

    m_cbDataSize = 0;

    //
    // Get values.
    //

    sc = ScAllocValueList( cb );
    if ( sc == ERROR_SUCCESS )
    {
        sc = ClusterResourceTypeControl(
                        hClusterIn,
                        pwszResTypeNameIn,
                        hHostNodeIn,
                        dwControlCodeIn,
                        lpBufferIn,
                        static_cast< DWORD >( cbBufferIn ),
                        m_cbhValueList.pb,
                        static_cast< DWORD >( m_cbBufferSize ),
                        &cb
                        );
        if ( sc == ERROR_MORE_DATA )
        {
            sc = ScAllocValueList( cb );
            if ( sc == ERROR_SUCCESS )
            {
                sc = ClusterResourceTypeControl(
                                hClusterIn,
                                pwszResTypeNameIn,
                                hHostNodeIn,
                                dwControlCodeIn,
                                lpBufferIn,
                                static_cast< DWORD >( cbBufferIn ),
                                m_cbhValueList.pb,
                                static_cast< DWORD >( m_cbBufferSize ),
                                &cb
                                );
            } // if: ScAllocValueList succeeded
        } // if: buffer too small
    } // if: ScAllocValueList succeeded

    if ( sc != ERROR_SUCCESS )
    {
        DeleteValueList();
    } // if: error getting properties.
    else
    {
        m_cbDataSize = static_cast< size_t >( cb );
        m_cbDataLeft = static_cast< size_t >( cb );
    } // else: no errors

    return sc;

} //*** CClusPropValueList::ScGetResourceTypeValueList

DWORD CClusPropValueList::ScGetResourceValueList | ( | HRESOURCE | hResourceIn,
 |  | DWORD | dwControlCodeIn,
 |  | HNODE | hHostNodeIn = NULL,
 |  | LPVOID | lpBufferIn = NULL,
 |  | size_t | cbBufferIn = 0
 | ) |  |
DWORD CClusPropValueList::ScGetResourceValueList | ( | HRESOURCE | hResourceIn,
 |  | DWORD | dwControlCodeIn,
 |  | HNODE | hHostNodeIn = NULL,
 |  | LPVOID | lpBufferIn = NULL,
 |  | size_t | cbBufferIn = 0
 | ) |  |
DWORD CClusPropValueList::ScGetResourceValueList | ( | HRESOURCE | hResourceIn,
 |  | DWORD | dwControlCodeIn,
 |  | HNODE | hHostNodeIn = NULL,
 |  | LPVOID | lpBufferIn = NULL,
 |  | size_t | cbBufferIn = 0
 | ) |  |

Definition at line 755 of file PropList.cpp.

{
    ASSERT( hResourceIn != NULL );
    ASSERT( ( dwControlCodeIn & ( CLUSCTL_OBJECT_MASK << CLUSCTL_OBJECT_SHIFT ) )
            == ( CLUS_OBJECT_RESOURCE << CLUSCTL_OBJECT_SHIFT ) );

    DWORD   sc = ERROR_SUCCESS;
    DWORD   cb = 512;

    //
    // Overwrite anything that may be in the buffer.
    // Allows this class instance to be reused.
    //

    m_cbDataSize = 0;

    //
    // Get values.
    //

    sc = ScAllocValueList( cb );
    if ( sc == ERROR_SUCCESS )
    {
        sc = ClusterResourceControl(
                        hResourceIn,
                        hHostNodeIn,
                        dwControlCodeIn,
                        lpBufferIn,
                        static_cast< DWORD >( cbBufferIn ),
                        m_cbhValueList.pb,
                        static_cast< DWORD >( m_cbBufferSize ),
                        &cb
                        );
        if ( sc == ERROR_MORE_DATA )
        {
            sc = ScAllocValueList( cb );
            if ( sc == ERROR_SUCCESS )
            {
                sc = ClusterResourceControl(
                                hResourceIn,
                                hHostNodeIn,
                                dwControlCodeIn,
                                lpBufferIn,
                                static_cast< DWORD >( cbBufferIn ),
                                m_cbhValueList.pb,
                                static_cast< DWORD >( m_cbBufferSize ),
                                &cb
                                );
            } // if: ScAllocValueList succeeded
        } // if: buffer too small
    } // if: ScAllocValueList succeeded

    if ( sc != ERROR_SUCCESS )
    {
        DeleteValueList();
    } // if: error getting properties.
    else
    {
        m_cbDataSize = static_cast< size_t >( cb );
        m_cbDataLeft = static_cast< size_t >( cb );
    } // else: no errors

    return sc;

} //*** CClusPropValueList::ScGetResourceValueList

DWORD CClusPropValueList::ScMoveToFirstValue ( void )
DWORD CClusPropValueList::ScMoveToFirstValue ( void )
DWORD CClusPropValueList::ScMoveToFirstValue ( void )

Definition at line 441 of file PropList.cpp.

{
    ASSERT( m_cbhValueList.pb != NULL );

    DWORD   sc;

    m_cbhCurrentValue = m_cbhValueList;
    m_cbDataLeft = m_cbDataSize;
    m_fAtEnd = FALSE;

    if ( m_cbhCurrentValue.pSyntax->dw == CLUSPROP_SYNTAX_ENDMARK )
    {
        sc = ERROR_NO_MORE_ITEMS;
    } // if: no items in the value list
    else
    {
        sc = ERROR_SUCCESS;
    } // else: items exist in the value list

    return sc;

} //*** CClusPropValueList::ScMoveToFirstValue

DWORD CClusPropValueList::ScMoveToNextValue ( void )

Definition at line 483 of file PropList.cpp.

{
    ASSERT( m_cbhCurrentValue.pb != NULL );

    DWORD                   sc     = ERROR_NO_MORE_ITEMS;
    size_t                  cbDataSize;
    CLUSPROP_BUFFER_HELPER  cbhCurrentValue;

    cbhCurrentValue = m_cbhCurrentValue;

    //
    // Don't try to move if we're already at the end.
    //

    if ( m_fAtEnd )
    {
        goto Cleanup;
    } // if: already at the end of the list

    //
    // Make sure the buffer is big enough for the value header.
    //

    if ( m_cbDataLeft < sizeof( *cbhCurrentValue.pValue ) )
    {
        sc = ERROR_INVALID_DATA;
        goto Cleanup;
    } // if: not enough data left

    //
    // Calculate how much to advance buffer pointer.
    //

    cbDataSize = sizeof( *cbhCurrentValue.pValue )
                + ALIGN_CLUSPROP( cbhCurrentValue.pValue->cbLength );

    //
    // Make sure the buffer is big enough for the value header,
    // the data itself, and the endmark.
    //

    if ( m_cbDataLeft < cbDataSize + sizeof( CLUSPROP_SYNTAX ) )
    {
        sc = ERROR_INVALID_DATA;
        goto Cleanup;
    } // if: not enough data left

    //
    // Move past the current value to the next value's syntax.
    //

    cbhCurrentValue.pb += cbDataSize;

    //
    // This test will ensure that the value is always valid since we won't
    // advance if the next thing is the endmark.
    //

    if ( cbhCurrentValue.pSyntax->dw != CLUSPROP_SYNTAX_ENDMARK )
    {
        m_cbhCurrentValue = cbhCurrentValue;
        m_cbDataLeft -= cbDataSize;
        sc = ERROR_SUCCESS;
    } // if: next value's syntax is not the endmark
    else
    {
        m_fAtEnd = TRUE;
    } // else: next value's syntax is the endmark

Cleanup:

    return sc;

} //*** CClusPropValueList::ScMoveToNextValue

DWORD CClusPropValueList::ScMoveToNextValue ( void )
DWORD CClusPropValueList::ScMoveToNextValue ( void )

Member Data Documentation

DWORD CClusPropValueList::m_cbBufferSize [private]

Definition at line 661 of file PropList.h.

DWORD CClusPropValueList::m_cbDataLeft [private]

Definition at line 660 of file PropList.h.

DWORD CClusPropValueList::m_cbDataSize [private]

Definition at line 659 of file PropList.h.

CLUSPROP_BUFFER_HELPER CClusPropValueList::m_cbhCurrentValue [private]

Definition at line 658 of file PropList.h.

CLUSPROP_BUFFER_HELPER CClusPropValueList::m_cbhValueList [private]

Definition at line 657 of file PropList.h.

BOOL CClusPropValueList::m_fAtEnd [private]

Definition at line 662 of file PropList.h.

The documentation for this class was generated from the following files:
  • WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/PropList.h
  • WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/PropList.h
  • WinBase/Cluster/Win2003/MyStorageResource/PropList.h
  • WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/PropList.cpp
  • WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/PropList.cpp
  • WinBase/Cluster/Win2003/MyStorageResource/PropList.cpp
Generated on Wed Nov 13 2024 16:55:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CClusterData Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Private Attributes

CClusterData Class Reference

#include "ExtObjData.h"

Inherits CObjData, and CObjData.

List of all members.

Public Member Functions

virtual HRESULT | AddContextMenuItems (IWCContextMenuCallback *piCallbackIn)
virtual HRESULT | AddContextMenuItems (IWCContextMenuCallback *piCallbackIn)
HCLUSTER | GetHCluster (void)
HCLUSTER | GetHCluster (void)
virtual HRESULT | InvokeCommand (ULONG nCommandIDIn)
virtual HRESULT | InvokeCommand (ULONG nCommandIDIn)

Protected Member Functions

virtual HRESULT | HrInitialize (IUnknown *piDataIn)
virtual HRESULT | HrInitialize (IUnknown *piDataIn)

Private Attributes

HCLUSTER | m_hCluster
CString m_strClusterName

Detailed Description

Definition at line 137 of file ExtObjData.h.

Member Function Documentation

HRESULT CClusterData::AddContextMenuItems ( IWCContextMenuCallback * piCallbackIn ) [virtual]

Reimplemented from CObjData.

Definition at line 447 of file ExtObjData.cpp.

{
    HRESULT hr = S_OK;

    ASSERT( piCallbackIn != NULL );

    hr = AddContextMenuItem(
                  piCallbackIn
                , IDS_CLUSTER_MENU_ITEM_1
                , IDS_CLUSTER_MENU_ITEM_1_DESC
                , CLUSTER_MENU_ID_1
                , MF_ENABLED
                );

    return hr;

} //*** CClusterData::AddContextMenuItems

virtual HRESULT CClusterData::AddContextMenuItems ( IWCContextMenuCallback * piCallbackIn ) [virtual]

Reimplemented from CObjData.

HCLUSTER CClusterData::GetHCluster ( void ) [inline]

Definition at line 151 of file ExtObjData.h.

{ return m_hCluster; };

HCLUSTER CClusterData::GetHCluster ( void ) [inline]

Definition at line 151 of file ExtObjData.h.

{ return m_hCluster; };

virtual HRESULT CClusterData::HrInitialize ( IUnknown * piDataIn ) [protected, virtual]

Reimplemented from CObjData.

HRESULT CClusterData::HrInitialize ( IUnknown * piDataIn ) [protected, virtual]

Reimplemented from CObjData.

Definition at line 326 of file ExtObjData.cpp.

{
    HRESULT                 hr = S_OK;
    IGetClusterDataInfo *   piClusInfo = NULL;
    LONG                    cchClusterName = 0;
    BSTR                    bstrClusterName = NULL;

    ASSERT( piDataIn != NULL );

    //
    // Initialize the base class.
    //

    hr = CObjData::HrInitialize( piDataIn );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if: error initializing the base class

    //
    // Initialize member variables to default values.
    //

    m_hCluster = NULL;

    //
    // Set the object type.
    //

    m_cot = CLUADMEX_OT_CLUSTER;

    //
    // Get an interface pointer to IGetClusterDataInfo.
    //

    hr = piDataIn->QueryInterface( IID_IGetClusterDataInfo, reinterpret_cast< LPVOID * >( &piClusInfo ) );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if: error querying for interface

    //
    // Get a copy of the handle.  Don't free this handle - it's just a copy.
    //

    m_hCluster = piClusInfo->GetClusterHandle();
    ASSERT( m_hCluster != NULL );
    if ( m_hCluster == NULL )
    {
        hr = E_HANDLE;
        goto Cleanup;
    } // if: error querying for interface

    //
    // Allocate a buffer for and retrieve the name.
    //

    hr = piClusInfo->GetClusterName( NULL, &cchClusterName );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if: error getting the name length

    bstrClusterName = SysAllocStringLen( NULL, cchClusterName );
    if ( bstrClusterName == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if: error allocating a string

    hr = piClusInfo->GetClusterName( bstrClusterName, &cchClusterName );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if: error getting the name

    //
    // The CString assignment operator makes a copy.
    //

    m_strClusterName = bstrClusterName;

Cleanup:

    if ( piClusInfo != NULL )
    {
        piClusInfo->Release();
    } // if:

    SysFreeString( bstrClusterName );

    return hr;

} //*** CClusterData::HrInitialize

virtual HRESULT CClusterData::InvokeCommand ( ULONG nCommandIDIn ) [virtual]

Reimplemented from CObjData.

HRESULT CClusterData::InvokeCommand ( ULONG nCommandIDIn ) [virtual]

Reimplemented from CObjData.

Definition at line 486 of file ExtObjData.cpp.

{
    HRESULT hr = S_OK;

    switch ( nCommandIDIn )
    {
        case CLUSTER_MENU_ID_1:

            //
            //  TODO:  Implement your menu item here.
            //

            hr = S_OK;
            break;

        default:
            hr = E_NOTIMPL;
            break;
    } // switch: nCommandIDIn

    return hr;

} //*** CClusterData::InvokeCommand

Member Data Documentation

HCLUSTER CClusterData::m_hCluster [private]

Definition at line 141 of file ExtObjData.h.

CString CClusterData::m_strClusterName [private]

Definition at line 142 of file ExtObjData.h.

The documentation for this class was generated from the following files:
  • WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/ExtObjData.h
  • WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/ExtObjData.h
  • WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/ExtObjData.cpp
  • WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/ExtObjData.cpp
Generated on Wed Nov 13 2024 16:55:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CClusterUtils Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Private Member Functions

CClusterUtils Class Reference

#include "CClusterUtils.h"

Inherited by CEnumStorageResource.

List of all members.

Public Member Functions

HRESULT | HrEnumNodeResources (BSTR bstrNodeNameIn)
HRESULT | HrGetQuorumResourceName (BSTR *pbstrQuorumResourceNameOut)
HRESULT | HrIsClusterServiceRunning (void)
HRESULT | HrIsCoreResource (HRESOURCE hResourceIn)
HRESULT | HrIsGroupOwnedByThisNode (HGROUP hGroupIn, BSTR bstrNodeNameIn)
HRESULT | HrIsNodeClustered (void)
HRESULT | HrLoadGroupResources (HCLUSTER hClusterIn, HGROUP hGroupIn)
virtual HRESULT | HrNodeResourceCallback (HRESOURCE hResourceIn)=0

Protected Member Functions

CClusterUtils (void)
virtual | ~CClusterUtils (void)

Private Member Functions

CClusterUtils (const CClusterUtils &nodeSrc)
const CClusterUtils & | operator= (const CClusterUtils &nodeSrc)

Detailed Description

Definition at line 43 of file CClusterUtils.h.

Constructor & Destructor Documentation

CClusterUtils::CClusterUtils ( const CClusterUtils & nodeSrc ) [private]
CClusterUtils::CClusterUtils ( void ) [inline, protected]

Definition at line 69 of file CClusterUtils.h.

{};

virtual CClusterUtils::~CClusterUtils ( void ) [inline, protected, virtual]

Definition at line 70 of file CClusterUtils.h.

{};

Member Function Documentation

HRESULT CClusterUtils::HrEnumNodeResources ( BSTR bstrNodeNameIn )

Definition at line 209 of file CClusterUtils.cpp.

{
    assert( bstrNodeNameIn != NULL );

    HRESULT     hr = S_FALSE;
    DWORD       sc = ERROR_SUCCESS;
    DWORD       idx = 0;
    HCLUSTER    hCluster = NULL;
    HCLUSENUM   hEnum = NULL;
    DWORD       dwType;
    WCHAR *     pwszGroupName = NULL;
    DWORD       cchGroupName = 33;
    HGROUP      hGroup = NULL;

    hCluster = OpenCluster( NULL );
    if ( hCluster == NULL )
    {
        sc = GetLastError();
        hr = HRESULT_FROM_WIN32( sc );
        goto Cleanup;
    } // if:

    hEnum = ClusterOpenEnum( hCluster, CLUSTER_ENUM_GROUP );
    if ( hEnum == NULL )
    {
        sc = GetLastError();
        hr = HRESULT_FROM_WIN32( sc );
        goto Cleanup;
    } // if:

    pwszGroupName = new WCHAR[ cchGroupName ];
    if ( pwszGroupName == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if:

    for ( idx = 0; ; )
    {
        sc = ClusterEnum( hEnum, idx, &dwType, pwszGroupName, &cchGroupName );
        if ( sc == ERROR_SUCCESS )
        {
            //
            // Process the current group.  See if it is owned by this
            // node and if so load its resources.
            //
            hGroup = OpenClusterGroup( hCluster, pwszGroupName );
            if ( hGroup == NULL )
            {
                sc = GetLastError();
                hr = HRESULT_FROM_WIN32( sc );
                goto Cleanup;
            } // if:

            hr = HrIsGroupOwnedByThisNode( hGroup, bstrNodeNameIn );
            if ( FAILED( hr ) )
            {
                goto Cleanup;
            } // if:

            if ( hr == S_OK )
            {
                hr = HrLoadGroupResources( hCluster, hGroup );
                if ( FAILED( hr ) )
                {
                    goto Cleanup;
                } // if:
            } // if:

            CloseClusterGroup( hGroup );
            hGroup = NULL;

            idx++;
            continue;
        } // if: ClusterEnum succeeded

        if ( sc == ERROR_MORE_DATA )
        {
            //
            // Allocate a bigger buffer and try again.
            //
            delete [] pwszGroupName;
            pwszGroupName = NULL;
            cchGroupName++;

            pwszGroupName = new WCHAR[ cchGroupName ];
            if ( pwszGroupName == NULL )
            {
                hr = E_OUTOFMEMORY;
                goto Cleanup;
            } // if:

            continue;
        } // if: pwszGroupName wasn't big enough

        if ( sc == ERROR_NO_MORE_ITEMS )
        {
            //
            // Enum is complete.
            //
            hr = S_OK;
            break;
        } // if:

        hr = HRESULT_FROM_WIN32( sc );
        break;
    } // for: each group in the enum

Cleanup:

    if ( hGroup != NULL )
    {
        CloseClusterGroup( hGroup );
    } // if:

    if ( hEnum != NULL )
    {
        ClusterCloseEnum( hEnum );
    } // if:

    if ( hCluster != NULL )
    {
        CloseCluster( hCluster );
    } // if:

    delete [] pwszGroupName;

    return hr;

} //*** CClusterUtils::HrEnumNodeResources

HRESULT CClusterUtils::HrGetQuorumResourceName ( BSTR * pbstrQuorumResourceNameOut )

Definition at line 509 of file CClusterUtils.cpp.

{
    assert( pbstrQuorumResourceNameOut != NULL );

    HRESULT     hr = S_OK;
    HCLUSTER    hCluster = NULL;
    DWORD       sc = ERROR_SUCCESS;
    WCHAR *     pwszResourceName = NULL;
    DWORD       cchResourceName = 33;
    WCHAR *     pwszDeviceName = NULL;
    DWORD       cchDeviceName = 33;
    DWORD       cbQuorumLog;

    hCluster = OpenCluster( NULL );
    if ( hCluster == NULL )
    {
        sc = GetLastError();
        hr = HRESULT_FROM_WIN32( sc );
        goto Cleanup;
    } // if:

    pwszResourceName = new WCHAR[ cchResourceName ];
    if ( pwszResourceName == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if:

    pwszDeviceName = new WCHAR[ cchDeviceName ];
    if ( pwszDeviceName == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if:

    //
    // Try to get the quorum resource name.  We need to pass in the device name
    // buffer as well or the call will fail.
    //
    sc = GetClusterQuorumResource(
              hCluster
            , pwszResourceName
            , &cchResourceName
            , pwszDeviceName
            , &cchDeviceName
            , &cbQuorumLog
            );
    if ( sc == ERROR_MORE_DATA )
    {
        //
        //  At least one of the buffers wasn't big enough.  Reallocate and try again.
        //
        delete [] pwszResourceName;
        pwszResourceName = NULL;
        cchResourceName++;

        delete [] pwszDeviceName;
        pwszDeviceName = NULL;
        cchDeviceName++;

        pwszResourceName = new WCHAR[ cchResourceName ];
        if ( pwszResourceName == NULL )
        {
            hr = E_OUTOFMEMORY;
            goto Cleanup;
        } // if:

        pwszDeviceName = new WCHAR[ cchDeviceName ];
        if ( pwszDeviceName == NULL )
        {
            hr = E_OUTOFMEMORY;
            goto Cleanup;
        } // if:

        sc = GetClusterQuorumResource(
                  hCluster
                , pwszResourceName
                , &cchResourceName
                , pwszDeviceName
                , &cchDeviceName
                , &cbQuorumLog
                );
    } // if:

    if ( sc == ERROR_SUCCESS )
    {
        //
        // Allocate a BSTR and copy the WCHAR string into it.
        //
        *pbstrQuorumResourceNameOut = SysAllocString( pwszResourceName );
        if ( *pbstrQuorumResourceNameOut == NULL )
        {
            hr = E_OUTOFMEMORY;
            goto Cleanup;
        } // if:
    } // if: GetClusterQuorumResource succeeded.
    else
    {
        hr = HRESULT_FROM_WIN32( sc );
        goto Cleanup;
    } // else: GetClusterQuorumResource failed.

    hr = S_OK;

Cleanup:

    if ( hCluster != NULL )
    {
        CloseCluster( hCluster );
    } // if:

    delete [] pwszResourceName;
    delete [] pwszDeviceName;

    return hr;

} //*** CClusterUtils::HrGetQuorumResourceName

HRESULT CClusterUtils::HrIsClusterServiceRunning ( void )

Definition at line 657 of file CClusterUtils.cpp.

{
    HRESULT hr = S_FALSE;
    DWORD   sc = ERROR_SUCCESS;
    DWORD   dwClusterState;

    //
    // Get the cluster state of the node.
    // Ignore the case where the service does not exist so that
    // EvictCleanup can do its job.
    //

    sc = GetNodeClusterState( NULL, &dwClusterState );
    if ( ( sc != ERROR_SUCCESS ) && ( sc != ERROR_SERVICE_DOES_NOT_EXIST ) )
    {
        hr = HRESULT_FROM_WIN32( sc );
        goto Cleanup;
    } // if : GetClusterState() failed

    if ( dwClusterState == ClusterStateRunning )
    {
        hr = S_OK;
    } // if:

Cleanup:

    return hr;

} //*** CClusterUtils::HrIsClusterServiceRunning

HRESULT CClusterUtils::HrIsCoreResource ( HRESOURCE hResourceIn )

Definition at line 713 of file CClusterUtils.cpp.

{
    assert( hResourceIn != NULL );

    HRESULT hr = S_FALSE;
    DWORD   sc = ERROR_SUCCESS;
    DWORD   dwFlags = 0;
    DWORD   cb = 0;

    //
    // If the resource has the CLUS_FLAG_CORE flag set then it is a core resource.
    //
    sc = ClusterResourceControl(
              hResourceIn
            , NULL
            , CLUSCTL_RESOURCE_GET_FLAGS
            , NULL
            , 0
            , &dwFlags
            , sizeof( dwFlags )
            , &cb
            );
    if ( sc != ERROR_SUCCESS )
    {
        hr = HRESULT_FROM_WIN32( sc );
        goto Cleanup;
    } // if:

    if ( dwFlags & CLUS_FLAG_CORE )
    {
        hr = S_OK;
    } // if:

Cleanup:

    return hr;

} //*** CClusterUtils::HrIsCoreResource

HRESULT CClusterUtils::HrIsGroupOwnedByThisNode | ( | HGROUP | hGroupIn,
 |  | BSTR | bstrNodeNameIn
 | ) |  |

Definition at line 58 of file CClusterUtils.cpp.

{
    assert( hGroupIn != NULL );
    assert( bstrNodeNameIn != NULL );

    HRESULT             hr = S_OK;
    DWORD               sc = ERROR_SUCCESS;
    WCHAR *             pwszNodeName = NULL;
    DWORD               cchNodeName = 33;
    CLUSTER_GROUP_STATE cgs;

    pwszNodeName = new WCHAR[ cchNodeName ];
    if ( pwszNodeName == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if:

    cgs = GetClusterGroupState( hGroupIn, pwszNodeName, &cchNodeName );
    sc = GetLastError();
    if ( sc == ERROR_MORE_DATA )
    {
        delete [] pwszNodeName;
        pwszNodeName = NULL;
        cchNodeName++;

        pwszNodeName = new WCHAR[ cchNodeName ];
        if ( pwszNodeName == NULL )
        {
            hr = E_OUTOFMEMORY;
            goto Cleanup;
        } // if:

        cgs = GetClusterGroupState( hGroupIn, pwszNodeName, &cchNodeName );
    } // if: the pwszNodeName buffer wasn't big enough

    if ( cgs == ClusterGroupStateUnknown )
    {
        sc = GetLastError();
        hr = HRESULT_FROM_WIN32( sc );
        goto Cleanup;
    } // if: GetClusterGroupState failed

    if ( NIStringCompareW(
                  bstrNodeNameIn
                , SysStringLen( bstrNodeNameIn )
                , pwszNodeName
                , cchNodeName
                )
         == 0
       )
    {
        hr = S_OK;
    } // if: Node names match so this group is owned by that node.
    else
    {
        hr = S_FALSE;
    } // else: Node names do not match and the group is owned by another node.

Cleanup:

    delete [] pwszNodeName;

    return hr;

} //*** CClusterUtils::HrIsGroupOwnedByThisNode

HRESULT CClusterUtils::HrIsNodeClustered ( void )

Definition at line 153 of file CClusterUtils.cpp.

{
    HRESULT hr = S_FALSE;
    DWORD   sc = ERROR_SUCCESS;
    DWORD   dwClusterState;

    //
    // Get the cluster state of the local node.
    // Ignore the case where the service does not exist so that
    // EvictCleanup can do its job.
    //

    sc = GetNodeClusterState( NULL, &dwClusterState );
    if ( ( sc != ERROR_SUCCESS ) && ( sc != ERROR_SERVICE_DOES_NOT_EXIST ) )
    {
        hr = HRESULT_FROM_WIN32( sc );
        goto Cleanup;
    } // if : GetNodeClusterState failed

    if ( ( dwClusterState == ClusterStateRunning ) || ( dwClusterState == ClusterStateNotRunning ) )
    {
        hr = S_OK;
    } // if:

Cleanup:

    return hr;

} //*** CClusterUtils::HrIsNodeClustered

HRESULT CClusterUtils::HrLoadGroupResources | ( | HCLUSTER | hClusterIn,
 |  | HGROUP | hGroupIn
 | ) |  |

Definition at line 371 of file CClusterUtils.cpp.

{
    assert( hClusterIn != NULL );
    assert( hGroupIn != NULL );

    HRESULT     hr = S_OK;
    DWORD       sc = ERROR_SUCCESS;
    HGROUPENUM  hEnum = NULL;
    WCHAR *     pwszResourceName = NULL;
    DWORD       cchResourceName = 33;
    DWORD       dwType;
    DWORD       idx = 0;
    HRESOURCE   hResource = NULL;

    hEnum = ClusterGroupOpenEnum( hGroupIn, CLUSTER_GROUP_ENUM_CONTAINS );
    if ( hEnum == NULL )
    {
        sc = GetLastError();
        hr = HRESULT_FROM_WIN32( sc );
        goto Cleanup;
    } // if:

    pwszResourceName = new WCHAR[ cchResourceName ];
    if ( pwszResourceName == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if:

    for ( idx = 0; ; )
    {
        sc = ClusterGroupEnum( hEnum, idx, &dwType, pwszResourceName, &cchResourceName );
        if ( sc == ERROR_SUCCESS )
        {
            //
            // Process the current resource.  Open it and pass a handle
            // to HrNodeResourceCallback for further processing.
            //
            hResource = OpenClusterResource( hClusterIn, pwszResourceName );
            if ( hResource == NULL )
            {
                sc = GetLastError();
                hr = HRESULT_FROM_WIN32( sc );
                goto Cleanup;
            } // if:

            hr = HrNodeResourceCallback( hResource );
            if ( FAILED( hr ) )
            {
                goto Cleanup;
            } // if:

            CloseClusterResource( hResource );
            hResource = NULL;

            idx++;
            continue;
        } // if:

        if ( sc == ERROR_MORE_DATA )
        {
            //
            // Allocate a bigger buffer and try again.
            //
            delete [] pwszResourceName;
            pwszResourceName = NULL;
            cchResourceName++;

            pwszResourceName = new WCHAR[ cchResourceName ];
            if ( pwszResourceName == NULL )
            {
                hr = E_OUTOFMEMORY;
                goto Cleanup;
            } // if:

            continue;
        } // if:

        if ( sc == ERROR_NO_MORE_ITEMS )
        {
            //
            // Enum is complete.
            //
            hr = S_OK;
            break;
        } // if:

        hr = HRESULT_FROM_WIN32( sc );
        break;
    } // for:

Cleanup:

    if ( hResource != NULL )
    {
        CloseClusterResource( hResource );
    } // if:

    if ( hEnum != NULL )
    {
        ClusterGroupCloseEnum( hEnum );
    } // if:

    delete [] pwszResourceName;

    return hr;

} //*** CClusterUtils::HrLoadGroupResources

virtual HRESULT CClusterUtils::HrNodeResourceCallback ( HRESOURCE hResourceIn ) [pure virtual]
const CClusterUtils& CClusterUtils::operator= ( const CClusterUtils & nodeSrc ) [private]
The documentation for this class was generated from the following files:
  • WinBase/Cluster/Win2003/MyStorageResource/CClusterUtils.h
  • WinBase/Cluster/Win2003/MyStorageResource/CClusterUtils.cpp
Generated on Wed Nov 13 2024 16:55:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCmdLineConsumerApp Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CCmdLineConsumerApp Class Reference

#include "CmdLineConsumer.h"

Inherits CWinApp.

List of all members.

Public Member Functions

CCmdLineConsumerApp ()
int | ExitInstance ()
virtual BOOL | InitInstance ()

Private Member Functions

void | RegisterServer (void)
void | UnregisterServer (void)

Private Attributes

DWORD m_clsReg
CProviderFactory * m_factory

Detailed Description

Definition at line 33 of file CmdLineConsumer.h.

Constructor & Destructor Documentation

CCmdLineConsumerApp::CCmdLineConsumerApp ( )

Definition at line 41 of file CmdLineConsumer.Cpp.

{
  // TODO: add construction code here,
  // Place all significant initialization in InitInstance
  m_clsReg = 0;
}

Member Function Documentation

int CCmdLineConsumerApp::ExitInstance ( void ) [virtual]

Reimplemented from CWinApp.

Definition at line 174 of file CmdLineConsumer.Cpp.

{
  if(m_clsReg)
  {
    HRESULT hres = CoRevokeClassObject(m_clsReg);

    CoUninitialize();
  }

  return CWinApp::ExitInstance();
}

BOOL CCmdLineConsumerApp::InitInstance ( void ) [virtual]

Reimplemented from CWinApp.

Definition at line 60 of file CmdLineConsumer.Cpp.

{
  HRESULT hRes;
  BOOL regEmpty = FALSE; // did a self-unregister happen?

  // OLE initialization. This is 'lighter' than OleInitialize()
  //  which also setups DnD, etc.
  if(SUCCEEDED(CoInitialize(NULL)))
  {

    //  NOTE:
    //  When using asynchronous WMI API's remotely in an environment where the "Local System" account
    //  has no network identity (such as non-Kerberos domains), the authentication level of
    //  RPC_C_AUTHN_LEVEL_NONE is needed. However, lowering the authentication level to
    //  RPC_C_AUTHN_LEVEL_NONE makes your application less secure. It is wise to
    //  use semi-synchronous API's for accessing WMI data and events instead of the asynchronous ones.

    hRes = CoInitializeSecurity( NULL, -1, NULL, NULL,
                      RPC_C_AUTHN_LEVEL_PKT_PRIVACY,
                      RPC_C_IMP_LEVEL_IMPERSONATE,
                      NULL,
                      EOAC_SECURE_REFS, //change to EOAC_NONE if you change dwAuthnLevel to RPC_C_AUTHN_LEVEL_NONE
                      NULL );
    if (FAILED(hRes))
    {
      AfxMessageBox(_T("CoInitializeSecurity Failed"));
      return FALSE;
    }
  }
  else // didnt CoInitialize()
  {
    AfxMessageBox(_T("CoInitialize Failed"));
    return FALSE;
  } // endif OleInitialize()

  // NOTE: To advertise that we can self-register, put 'OLESelfRegister'
  // in the version resource.

  // see if this is a self-Unregister call.
  TCHAR temp[256];
  TCHAR seps[] = _T(" ");
  TCHAR *token = NULL;

  HRESULT hr = StringCbCopy(temp, sizeof(temp), (LPCTSTR)m_lpCmdLine);
  if (FAILED(hr))
  {
    return FALSE; //command line too long to be valid
  }
  token = _tcstok( temp, seps );
  while( token != NULL )
  {
    /* While there are tokens in "string" */
    if(_tcsicmp(token, _T("/UNREGSERVER")) == 0)
    {
      UnregisterServer();
      return FALSE;   // no use doing any more.
    }
    /* Get next token: */
    token = _tcstok( NULL, seps );
  }

  // if we got here, the unregister didn't return out and we should
  // make sure we're registered now.
  RegisterServer();

  // creating the dlg earlier than usual so the class factory
  //  can pass m_outputList.
  CCmdLineConsumerDlg dlg;

  m_factory = new CProviderFactory(&(dlg.m_output));
  if (!m_factory)
  {
    return FALSE;  //out of memory
  }

  if((hRes = CoRegisterClassObject(CLSID_CmdLineConsumer,
              (IUnknown *)m_factory,
              CLSCTX_LOCAL_SERVER | CLSCTX_REMOTE_SERVER,
              REGCLS_MULTIPLEUSE,
              &m_clsReg)) == S_OK)
  {
    TRACE(_T("registered\n"));
  }
  else
  {
    TRACE(_T("not registered\n"));
  }

#ifdef _AFXDLL
  Enable3dControls();     // Call this when using MFC in a shared DLL
#else
  Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif

  m_pMainWnd = &dlg;
  INT_PTR nResponse = dlg.DoModal();
  if (nResponse == IDOK)
  {
    // TODO: Place code here to handle when the dialog is
    //  dismissed with OK
  }
  else if (nResponse == IDCANCEL)
  {
    // TODO: Place code here to handle when the dialog is
    //  dismissed with Cancel
  }

  // Since the dialog has been closed, return FALSE so that we exit the
  //  application, rather than start the application's message pump.
  return FALSE;
}

void CCmdLineConsumerApp::RegisterServer ( void ) [private]

Definition at line 203 of file CmdLineConsumer.Cpp.

{
  HKEY hKey1, hKey2;

  const TCHAR       wcConsID[] = _T("{31704FFF-6B85-11d1-ADAD-00AA00B8E05A}");
    const TCHAR       wcCLSID[] = _T("CLSID\\{31704FFF-6B85-11d1-ADAD-00AA00B8E05A}");
    const TCHAR       wcAppID[] = _T("AppID\\{31704FFF-6B85-11d1-ADAD-00AA00B8E05A}");
    TCHAR      wcModule[MAX_PATH + 1];  // this will hold the exe's path.
  const TCHAR ConsumerTextForm[] = _T("Microsoft Cmd Line Consumer");

  // this will allow the server to display its windows on the active desktop instead
  // of the hidden desktop where services run.
  const TCHAR Interactive[] = _T("Interactive User");

  memset(&wcModule, NULL, sizeof(wcModule)/sizeof(TCHAR));
  GetModuleFileName(NULL, wcModule, sizeof(wcModule)/sizeof(TCHAR) - 1);

  //Set the "default" text under CLSID
  //==========================
  RegCreateKeyEx( HKEY_CLASSES_ROOT, wcCLSID, 0, NULL,
                    REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL,
                    &hKey1, NULL );
  RegSetValueEx(hKey1, NULL, 0, REG_SZ,
          (LPBYTE)ConsumerTextForm,
          TCHAR_LEN_IN_BYTES(ConsumerTextForm));

  // create the LocalServer32 key so the server can be found.
  RegCreateKeyEx( hKey1, _T("LocalServer32"), 0, NULL,
                    REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL,
                    &hKey2, NULL );
  RegSetValueEx(hKey2, NULL, 0, REG_SZ, (LPBYTE)wcModule, TCHAR_LEN_IN_BYTES(wcModule));
  RegSetValueEx(hKey1, _T("AppID"), 0, REG_SZ, (LPBYTE)wcConsID, TCHAR_LEN_IN_BYTES(wcConsID));

  RegCloseKey(hKey2);
  RegCloseKey(hKey1);

  // now do the AppID keys.
  RegCreateKeyEx( HKEY_CLASSES_ROOT, wcAppID, 0, NULL,
                    REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL,
                    &hKey1, NULL );
  RegSetValueEx(hKey1, NULL, 0, REG_SZ,
          (LPBYTE)ConsumerTextForm,
          TCHAR_LEN_IN_BYTES(ConsumerTextForm));

  // this makes the local server run on the active desktop (the one you're seeing)
  // instead of the hidden desktop that services run on (which doesn't have UI)
  RegSetValueEx(hKey1, _T("RunAs"), 0, REG_SZ, (LPBYTE)Interactive, TCHAR_LEN_IN_BYTES(Interactive));
  RegCloseKey(hKey1);
}

void CCmdLineConsumerApp::UnregisterServer ( void ) [private]

Definition at line 261 of file CmdLineConsumer.Cpp.

{

  TCHAR       wcConsID[] = _T("{31704FFF-6B85-11d1-ADAD-00AA00B8E05A}");
    TCHAR       wcCLSID[] = _T("CLSID\\{31704FFF-6B85-11d1-ADAD-00AA00B8E05A}");
    TCHAR       wcAppID[] = _T("AppID\\{31704FFF-6B85-11d1-ADAD-00AA00B8E05A}");
    HKEY hKey1;
  DWORD dwRet;

  // delete the keys under CLSID\[guid]
    dwRet = RegOpenKeyEx(HKEY_CLASSES_ROOT, wcCLSID, 0, KEY_WRITE, &hKey1);
    if(dwRet == NOERROR)
    {
        RegDeleteKey(hKey1, _T("LocalServer32"));
        RegCloseKey(hKey1);
    }

  // delete CLSID\[guid] <default>
    dwRet = RegOpenKeyEx(HKEY_CLASSES_ROOT, _T("CLSID"), 0, KEY_WRITE, &hKey1);
    if(dwRet == NOERROR)
    {
        RegDeleteKey(hKey1,wcConsID);
        RegCloseKey(hKey1);
    }

  // delete AppID\[guid] <default>
    dwRet = RegOpenKeyEx(HKEY_CLASSES_ROOT, _T("AppID"), 0, KEY_WRITE, &hKey1);
    if(dwRet == NOERROR)
    {
        RegDeleteKey(hKey1, wcConsID);
        RegCloseKey(hKey1);
    }
}

Member Data Documentation

DWORD CCmdLineConsumerApp::m_clsReg [private]

Definition at line 56 of file CmdLineConsumer.h.

CProviderFactory* CCmdLineConsumerApp::m_factory [private]

Definition at line 57 of file CmdLineConsumer.h.

The documentation for this class was generated from the following files:
  • SysMgmt/WMI/VC/CmdLineConsumer/CmdLineConsumer.h
  • SysMgmt/WMI/VC/CmdLineConsumer/CmdLineConsumer.Cpp
Generated on Wed Nov 13 2024 16:55:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCmdLineConsumerDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes

CCmdLineConsumerDlg Class Reference

#include "CmdLineConsumerDlg.h"

List of all members.

Public Types

enum | { IDD = IDD_CMDLINECONSUMER_DIALOG }

Public Member Functions

CCmdLineConsumerDlg (CWnd *pParent=NULL)

Public Attributes

CListBox | m_output

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
virtual BOOL | OnInitDialog ()
afx_msg void | OnPaint ()
afx_msg HCURSOR | OnQueryDragIcon ()
afx_msg void | OnSysCommand (UINT nID, LPARAM lParam)

Protected Attributes

HICON | m_hIcon

Detailed Description

Definition at line 24 of file CmdLineConsumerDlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 32 of file CmdLineConsumerDlg.h.

{ IDD = IDD_CMDLINECONSUMER_DIALOG };

Constructor & Destructor Documentation

CCmdLineConsumerDlg::CCmdLineConsumerDlg ( CWnd * pParent = NULL )

Definition at line 72 of file CmdLineConsumerDlg.Cpp.

  : CDialog(CCmdLineConsumerDlg::IDD, pParent)
{
  //{{AFX_DATA_INIT(CCmdLineConsumerDlg)
    // NOTE: the ClassWizard will add member initialization here
  //}}AFX_DATA_INIT
  // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
  m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

Member Function Documentation

void CCmdLineConsumerDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 82 of file CmdLineConsumerDlg.Cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CCmdLineConsumerDlg)
  DDX_Control(pDX, IDC_LIST, m_output);
  //}}AFX_DATA_MAP
}

BOOL CCmdLineConsumerDlg::OnInitDialog ( ) [protected, virtual]

Definition at line 101 of file CmdLineConsumerDlg.Cpp.

{
  CDialog::OnInitDialog();

  // this controls the app's main dialog box.
  ShowWindow(SW_MINIMIZE);

  // Add "About..." menu item to system menu.

  // IDM_ABOUTBOX must be in the system command range.
  ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
  ASSERT(IDM_ABOUTBOX < 0xF000);

  CMenu* pSysMenu = GetSystemMenu(FALSE);
  if (pSysMenu != NULL)
  {
    CString strAboutMenu;
    strAboutMenu.LoadString(IDS_ABOUTBOX);
    if (!strAboutMenu.IsEmpty())
    {
      pSysMenu->AppendMenu(MF_SEPARATOR);
      pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
    }
  }

  // Set the icon for this dialog.  The framework does this automatically
  //  when the application's main window is not a dialog
  SetIcon(m_hIcon, TRUE);     // Set big icon
  SetIcon(m_hIcon, FALSE);    // Set small icon

  // TODO: Add extra initialization here

  return TRUE;  // return TRUE  unless you set the focus to a control
}

void CCmdLineConsumerDlg::OnPaint ( void ) [protected]

Definition at line 153 of file CmdLineConsumerDlg.Cpp.

{
  if (IsIconic())
  {
    CPaintDC dc(this); // device context for painting

    SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

    // Center icon in client rectangle
    int cxIcon = GetSystemMetrics(SM_CXICON);
    int cyIcon = GetSystemMetrics(SM_CYICON);
    CRect rect;
    GetClientRect(&rect);
    int x = (rect.Width() - cxIcon + 1) / 2;
    int y = (rect.Height() - cyIcon + 1) / 2;

    // Draw the icon
    dc.DrawIcon(x, y, m_hIcon);
  }
  else
  {
    CDialog::OnPaint();
  }
}

HCURSOR CCmdLineConsumerDlg::OnQueryDragIcon ( ) [protected]

Definition at line 180 of file CmdLineConsumerDlg.Cpp.

{
  return (HCURSOR) m_hIcon;
}

void CCmdLineConsumerDlg::OnSysCommand | ( | UINT | nID,
 |  | LPARAM | lParam |
 | ) |  |  | [protected]

Definition at line 136 of file CmdLineConsumerDlg.Cpp.

{
  if ((nID & 0xFFF0) == IDM_ABOUTBOX)
  {
    CAboutDlg dlgAbout;
    dlgAbout.DoModal();
  }
  else
  {
    CDialog::OnSysCommand(nID, lParam);
  }
}

Member Data Documentation

HICON CCmdLineConsumerDlg::m_hIcon [protected]

Definition at line 44 of file CmdLineConsumerDlg.h.

CListBox CCmdLineConsumerDlg::m_output

Definition at line 33 of file CmdLineConsumerDlg.h.

The documentation for this class was generated from the following files:
  • SysMgmt/WMI/VC/CmdLineConsumer/CmdLineConsumerDlg.h
  • SysMgmt/WMI/VC/CmdLineConsumer/CmdLineConsumerDlg.Cpp
Generated on Wed Nov 13 2024 16:55:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCmdLineLite Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CCmdLineLite Class Reference

#include "cdialoglite.h"

List of all members.

Public Member Functions

CCmdLineLite ()
virtual | ~CCmdLineLite ()
virtual BOOL | ParseCommandLine ()
virtual BOOL | ParseFile (WCHAR *pwszFileName)
virtual void | ParseParam (WCHAR *pwszParam, BOOL bFlag, BOOL bLast)
virtual void | ResetParser ()

Public Attributes

WCHAR | m_wszLastCmd [MAX_QUERY_LEN]

Detailed Description

Definition at line 1044 of file cdialoglite.h.

Constructor & Destructor Documentation

CCmdLineLite::CCmdLineLite ( )

Definition at line 4425 of file cdialoglite.cpp.

{
  m_wszLastCmd[0] = wEOL;
}

CCmdLineLite::~CCmdLineLite ( ) [virtual]

Definition at line 4435 of file cdialoglite.cpp.

{
}

Member Function Documentation

BOOL CCmdLineLite::ParseCommandLine ( ) [virtual]

Definition at line 4463 of file cdialoglite.cpp.

{
  //NOTE:  This is a simple command line parser which relies upon the Runtime to seperate
  //the arguments into argc/argv pairs.  Basically the runtime determines arguments by words
  //seperated soley by spaces, unless they are enclosed in double quotes.  If an argument
  //has spaces or needs embedded quotes, you need to close the argument in double quotes
  //and the embedded quotes need to be single quotes, (as single quotes are not recognized
  //and are ignored)
  WCHAR wszBuffer[MAX_QUERY_LEN];

  for(INT i=1; i<__argc; i++)
  {
    //TODO remove conversion code for NT unicode support (GetCommandLineW)
    //Can always do the opposite conversion on Win95 if only GetCommandLineA is supported.
    WCHAR* pwszParam = wszBuffer;
    ConvertToWCHAR(__argv[i], pwszParam, MAX_QUERY_LEN);

    BOOL bFlag = FALSE;
    BOOL bLast = ((i + 1) == __argc);
    if(pwszParam[0] == L'-' || pwszParam[0] == L'/')
    {
      // remove flag specifier
      bFlag = TRUE;
      pwszParam++;
    }

    ParseParam(pwszParam, bFlag, bLast);
  }

  //TRUE - CmdLine specified, FALSE - no command line args
  return __argc >1;
}

BOOL CCmdLineLite::ParseFile ( WCHAR * pwszFileName ) [virtual]

Definition at line 4501 of file cdialoglite.cpp.

{
  if(!pwszFileName)
    return FALSE;

  static CHAR szBuffer[MAX_QUERY_LEN+1] = {0};
  CHAR*  pszToken = NULL;
  BOOL bFlag = TRUE;

  //Reset the Parser
  ResetParser();

  //Open the file - for reading...
  CFileLite cFile;
  if(FAILED(cFile.Open(pwszFileName, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING)))
    return FALSE;

  //Start reading...
  //NOTE:  We read the entire steam in ANSI, since this is the native format of the file.
  //We get major speed improvements reading all characters first, then converting to Unicode.
  //This method also prevens bugs with converting MBCS chars to unicode when all the characters
  //have not been read, since we may be converting and leading or trailing byte independent
  //of the context or other characters related...
  while(!cFile.IsEOF())
  {
    CHAR  chToken = 0;
    CHAR  chQuote = 0;
    LONG  cQuotes = 0;
    ULONG cChars = 0;
    BOOL  bLast = FALSE;

    szBuffer[0] = EOL;
    pszToken = szBuffer;

    //Obtain the string
    //Sure wish getLine allowed more than 1 deliminator
    //Since its doesn't I get 1 character at a time until either a space
    //or carriage return it hit...
    while(!cFile.IsEOF() && cChars<MAX_QUERY_LEN)
    {
      if(cFile.Read(sizeof(CHAR), &chToken)!=S_OK)
        break;

      //Quote Character
      if(chToken == '\"' || chToken == '\'')
      {
        //First Quote - remember which quote char used
        if(cQuotes==0 && cChars==0)
          chQuote = chToken;

        //Start or End of Quote
        if(chToken == chQuote)
          cQuotes = cQuotes ? cQuotes-1 : cQuotes+1;

        //Don't include the first or the last quote
        if(cChars==0 || cQuotes==0)
          continue;
      }

      //End of Token
      if(cQuotes==0)
      {
        //End of Token indicators (not inside quotes)
        if(chToken==' ' || chToken=='\n' || cFile.IsEOF())
          break;

        //Line Feed are ignored (not inside quotes)
        if(chToken=='\r')
          continue;
      }

      *pszToken = chToken;
      pszToken++;
      cChars++;
    }

    //End of this token...
    *pszToken = EOL;

    //Determine if this is a flag or parameter
    //Its only a flag if it wasn't inside a quoted option and begins with '/' or '-'
    if(!chQuote && (szBuffer[0] == '/' || szBuffer[0] == '-'))
    {
      bFlag = TRUE;       //This is a flag
      pszToken = &szBuffer[1];  //Remove the flag
    }
    else
    {
      bFlag = FALSE;
      pszToken = szBuffer;
    }

    //Last Argument in the file...
    bLast = cFile.IsEOF();

    //Parse The Command Line...
    //Ignore whitespace, but whitespace enclosed in quotes is counted as a param...
    if(pszToken[0] || chQuote)
    {
      //Now convert the Token into Unicode...
      static WCHAR wszBuffer[MAX_QUERY_LEN] = {0};
      ConvertToWCHAR(pszToken, wszBuffer, MAX_QUERY_LEN);

      //Parse this parameter...
      ParseParam(wszBuffer, bFlag, bLast);
    }
  }

  return TRUE;
}

void CCmdLineLite::ParseParam | ( | WCHAR * | pwszParam,
 |  | BOOL | bFlag,
 |  | BOOL | bLast |
 | ) |  |  | [virtual]

Definition at line 4454 of file cdialoglite.cpp.

{
}

void CCmdLineLite::ResetParser ( ) [virtual]

Definition at line 4444 of file cdialoglite.cpp.

{
  m_wszLastCmd[0] = wEOL;
}

Member Data Documentation

WCHAR CCmdLineLite::m_wszLastCmd[MAX_QUERY_LEN]

Definition at line 1061 of file cdialoglite.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialoglite.h
  • Dataaccess/oledb/rowsetviewer/cdialoglite.cpp
Generated on Wed Nov 13 2024 16:55:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCodeGrid Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CCodeGrid Class Reference

#include "Grid.Hxx"

Inherits CTextGrid.

List of all members.

Public Member Functions

CCodeGrid (UINT cCol, UINT cRow, SIZE size, UINT iEltOffset=0)
void | DrawElement (CCanvas &canvas, COORD x, COORD y, UINT i, UINT j)
void | SetFormat (UINT fuFormat=HEXADECIMAL, UINT cDigits=1)

Protected Attributes

UINT _cDigits
TCHAR | _szFormat [5]

Detailed Description

Definition at line 125 of file Grid.Hxx.

Constructor & Destructor Documentation

CCodeGrid::CCodeGrid | ( | UINT | cCol,
 |  | UINT | cRow,
 |  | SIZE | size,
 |  | UINT | iEltOffset = 0
 | ) |  |

Definition at line 236 of file Grid.Cxx.

{
    _size  = size;
    _cCol  = cCol;
    _cRow  = cRow;
    _iEltOffset = iEltOffset;
    SetTextOrg();
    SetFormat();
}

Member Function Documentation

void CCodeGrid::DrawElement | ( | CCanvas & | canvas,
 |  | COORD | x,
 |  | COORD | y,
 |  | UINT | i,
 |  | UINT | j |
 | ) |  |  | [virtual]

Implements CTextGrid.

Definition at line 268 of file Grid.Cxx.

{
     TCHAR sz[32];
   if (_pCharUsed == NULL || _pCharUsed[_cRow*i+j]) // if char exists draw it
         {
             _sntprintf( sz, sizeof(sz)/sizeof(TCHAR), _szFormat, (_cRow*i+j+_iEltOffset));
             sz[sizeof(sz)/sizeof(TCHAR) - 1] = TEXT('\0');
             canvas.Text(x, y, sz, _cDigits);
         }
}

void CCodeGrid::SetFormat | ( | UINT | fuFormat = HEXADECIMAL,
 |  | UINT | cDigits = 1
 | ) |  |

Definition at line 246 of file Grid.Cxx.

{
    _cDigits = cDigits;

    _szFormat[0]='%';
    if( fuFormat == DECIMAL )
    {
        _cDigits = 4;       // Constraint:
                            // This format for Decimal
        _szFormat[1]='3';   // really only works with _cDigits == 4
        _szFormat[2]='d';   //
        _szFormat[3]=' ';   // (blank padding for better positioning)
    }
    else //
    {
        _szFormat[1]='0';
        _szFormat[2]=_cDigits%10+'0';
        _szFormat[3]='X';
    }
    _szFormat[4]='\0';
}

Member Data Documentation

UINT CCodeGrid::_cDigits [protected]

Definition at line 132 of file Grid.Hxx.

TCHAR CCodeGrid::_szFormat[5] [protected]

Definition at line 133 of file Grid.Hxx.

The documentation for this class was generated from the following files:
  • Multimedia/Gdi/Fonts/GridFont/Grid.Hxx
  • Multimedia/Gdi/Fonts/GridFont/Grid.Cxx
Generated on Wed Nov 13 2024 16:55:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CColumnInfo Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CColumnInfo Class Reference

#include "crowset.h"

Inherits CVector< DBCOLUMNINFO, DBORDINAL >.

List of all members.

Public Member Functions

CColumnInfo ()
~CColumnInfo ()
void | Attach (DBORDINAL cColumnInfo, DBCOLUMNINFO *rgColumnInfo, WCHAR *pwszStringBuffer, DBORDINAL cHiddenColumns=0)
const DBCOLUMNINFO * | GetOrdinal (DBORDINAL iOrdinal)
BOOL | IsHidden (DBORDINAL iOrdinal)
void | RemoveAll ()

Protected Attributes

DBORDINAL | m_cHiddenColumns
CComWSTR m_cstrStringBuffer

Detailed Description

Definition at line 97 of file crowset.h.

Constructor & Destructor Documentation

CColumnInfo::CColumnInfo ( ) [inline]

Definition at line 101 of file crowset.h.

  {
    m_cHiddenColumns  = 0;
  }

CColumnInfo::~CColumnInfo ( ) [inline]

Definition at line 105 of file crowset.h.

  {
  }

Member Function Documentation

void CColumnInfo::Attach | ( | DBORDINAL | cColumnInfo,
 |  | DBCOLUMNINFO * | rgColumnInfo,
 |  | WCHAR * | pwszStringBuffer,
 |  | DBORDINAL | cHiddenColumns = 0 |
 | ) |  |  | [inline]

Definition at line 121 of file crowset.h.

  {
    //First - Delegate
    //NOTE: We have to do this first, since this method call RemoveAll, which will empty
    //anything we do in this class, since its virtual...
    CVector<DBCOLUMNINFO, DBORDINAL>::Attach(cColumnInfo, rgColumnInfo);

    //Overloaded - inorder to first obtain other items
    m_cstrStringBuffer.Attach(pwszStringBuffer);
    m_cHiddenColumns  = cHiddenColumns;

  }

const DBCOLUMNINFO* CColumnInfo::GetOrdinal ( DBORDINAL iOrdinal ) [inline]

Definition at line 152 of file crowset.h.

  {
    //Due to the bookmark column being present or absent causes the Binding
    //to not be lined exactly (1:1) to the Ordinal position...

    //no-ops
    if(!GetCount() || !GetElements() || (iOrdinal==0 && GetElement(0).iOrdinal!=0))
      return NULL;

    //Bookmark
    if(GetElement(0).iOrdinal == 0)
    {
      //[0,1,2,3,4,5...]
      ASSERT(GetElement(iOrdinal).iOrdinal == iOrdinal);
      return &GetElement(iOrdinal);
    }
    else
    {
      //[1,2,3,4,5...]
      ASSERT(GetElement(iOrdinal-1).iOrdinal == iOrdinal);
      return &GetElement(iOrdinal-1);
    }

    return NULL;
  }

BOOL CColumnInfo::IsHidden ( DBORDINAL iOrdinal ) [inline]

Definition at line 134 of file crowset.h.

  {
    //Hidden Column
    if(m_cHiddenColumns)
    {
      //cColInfo already includes cHiddenColumns, this...
      ASSERT(m_cHiddenColumns <= m_cElements);

      //Is this a hidden column
      //If this ordinal is >= to the first hidden column then its hidden...
      if(iOrdinal >= m_rgElements[m_cElements - m_cHiddenColumns].iOrdinal)
        return TRUE;
    }

    return FALSE;

  }

void CColumnInfo::RemoveAll ( ) [inline, virtual]

Reimplemented from CVector< DBCOLUMNINFO, DBORDINAL >.

Definition at line 110 of file crowset.h.

  {
    //Overloaded - inorder to first free out-of-line data
    m_cstrStringBuffer.Empty();
    m_cHiddenColumns  = 0;

    //Now - Delegate
    CVector<DBCOLUMNINFO, DBORDINAL>::RemoveAll();
  }

Member Data Documentation

DBORDINAL CColumnInfo::m_cHiddenColumns [protected]

Definition at line 181 of file crowset.h.

CComWSTR CColumnInfo::m_cstrStringBuffer [protected]

Definition at line 180 of file crowset.h.

The documentation for this class was generated from the following file:
  • Dataaccess/oledb/rowsetviewer/crowset.h
Generated on Wed Nov 13 2024 16:55:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CColumnProvider Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CColumnProvider Class Reference

#include "columnprovider.h"

List of all members.

Public Member Functions

CColumnProvider ()
virtual | ~CColumnProvider ()
STDMETHODIMP | GetColumnInfo (DWORD dwIndex, LPSHCOLUMNINFO psci)
STDMETHODIMP | GetItemData (LPCSHCOLUMNID pscid, LPCSHCOLUMNDATA pscd, VARIANT *pvartData)
STDMETHODIMP | Initialize (LPCSHCOLUMNINIT psci)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppvObject)
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()

Private Attributes

ULONG m_nRefCount

Detailed Description

Definition at line 12 of file columnprovider.h.

Constructor & Destructor Documentation

CColumnProvider::CColumnProvider ( )

Definition at line 38 of file columnprovider.Cpp.

{
    m_nRefCount = 0;
    nDllRefCount++;

    sci[0].scid.fmtid = FMTID_ShortFilename;
    sci[1].scid.fmtid = FMTID_FullPath;
}

CColumnProvider::~CColumnProvider ( ) [virtual]

Definition at line 47 of file columnprovider.Cpp.

{
    nDllRefCount--;
}

Member Function Documentation

STDMETHODIMP CColumnProvider::GetColumnInfo | ( | DWORD | dwIndex,
 |  | LPSHCOLUMNINFO | psci
 | ) |  |

Definition at line 102 of file columnprovider.Cpp.

{
    //
    //  Return information on each column we support. Return S_FALSE
    //  to indicate that we have returned information on all our
    //  columns. GetColumnInfo will be called repeatedly until S_FALSE
    //  or an error is returned
    //
    if (dwIndex >= NUM_COLUMNS)
        return S_FALSE;

    psci->scid.fmtid = sci[dwIndex].scid.fmtid;
    psci->scid.pid = sci[dwIndex].scid.pid;

    psci->vt = sci[dwIndex].vt;

    psci->fmt = sci[dwIndex].fmt;

    psci->cChars = sci[dwIndex].cChars;

    psci->csFlags = sci[dwIndex].csFlags;

    lstrcpyn (psci->wszTitle, sci[dwIndex].wszTitle, ARRAYSIZE(psci->wszTitle));
    lstrcpyn (psci->wszDescription, sci[dwIndex].wszDescription, ARRAYSIZE(psci->wszDescription));
    return S_OK;
}

STDMETHODIMP CColumnProvider::GetItemData | ( | LPCSHCOLUMNID | pscid,
 |  | LPCSHCOLUMNDATA | pscd,
 |  | VARIANT * | pvartData
 | ) |  |

Definition at line 130 of file columnprovider.Cpp.

{
  VARIANT varTemp;
  HRESULT hresult = S_FALSE;
    //
    //  The shell is asking for data for an item in one of our
    //  columns. Verify that a correct format ID has been passed and
    //  return the proper information
    //
    WCHAR wszShortPath[MAX_PATH];

    //
    // Get the short path name for the file/folder
    //
    if (GetShortPathName (pscd->wszFile, wszShortPath, MAX_PATH)) {

      //
      // Is the text for the short filename column is being requested
      //
      if (IsEqualGUID (pscid->fmtid, FMTID_ShortFilename) && pscid->pid == 0)
  {
    //
    // Don't do anything for directories
    //
    if (!(pscd->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {

      varTemp.vt =  VT_BSTR;
      varTemp.bstrVal = SysAllocString (PathFindFileName (wszShortPath));
      if (varTemp.bstrVal) {
        *pvartData = varTemp;
        hresult = S_OK;
      } else {
        hresult = E_OUTOFMEMORY;
      }
    }
  }
    }
    //
    // Is the text for the short pathname column is being requested
    //
    else if (IsEqualGUID (pscid->fmtid, FMTID_FullPath) && pscid->pid == 0)
    {
      varTemp.vt =  VT_BSTR;
      varTemp.bstrVal = SysAllocString (wszShortPath);
      if (varTemp.bstrVal) {
  *pvartData = varTemp;
  hresult = S_OK;
      } else {
  hresult = E_OUTOFMEMORY;
      }
    }

    return hresult;
}

STDMETHODIMP CColumnProvider::Initialize ( LPCSHCOLUMNINIT psci )

Definition at line 94 of file columnprovider.Cpp.

{
    //
    //  Perform any needed initialization here
    //
    return S_OK;
}

STDMETHODIMP CColumnProvider::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppvObject
 | ) |  |

Definition at line 56 of file columnprovider.Cpp.

{
    HRESULT hr = E_NOINTERFACE;

    *ppvObject = NULL;
    if (IsEqualIID (riid, IID_IUnknown) || IsEqualIID (riid, IID_IColumnProvider))
    {
        *ppvObject = (LPVOID)(LPCLASSFACTORY) this;
    }

    if (*ppvObject != NULL)
    {
        ((LPUNKNOWN)*ppvObject)->AddRef ();
        hr = S_OK;
    }
    return hr;
}

CColumnProvider::STDMETHODIMP_ ( ULONG )
CColumnProvider::STDMETHODIMP_ ( ULONG )

Member Data Documentation

ULONG CColumnProvider::m_nRefCount [private]

Definition at line 29 of file columnprovider.h.

The documentation for this class was generated from the following files:
  • WinUI/Shell/ColumnProvider/columnprovider.h
  • WinUI/Shell/ColumnProvider/columnprovider.Cpp
Generated on Wed Nov 13 2024 16:55:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CComboBoxEx Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CComboBoxEx Class Reference

#include "cdialoglite.h"

Inherits CComboBoxLite.

List of all members.

Public Member Functions

CComboBoxEx (HWND hWndParent=NULL, UINT nID=0)
virtual | ~CComboBoxEx ()
virtual INDEX | AddString (WCHAR *pwszString)
virtual INDEX | AddString (WCHAR *pwszString, LPARAM lParam)
virtual INDEX | FindString (WCHAR *pwszString, INDEX nStartIndex=-1)
INDEX | InsertItem (INDEX iItem, WCHAR *pwszName, LPARAM lParam=PARAM_NONE, INT iIndent=PARAM_NONE, INT iImage=IMAGE_NONE, UINT iSelectedImage=IMAGE_NONE)
virtual BOOL | OnInitialUpdate ()
virtual BOOL | SetUnicodeFormat (BOOL fUnicode=TRUE)

Detailed Description

Definition at line 873 of file cdialoglite.h.

Constructor & Destructor Documentation

CComboBoxEx::CComboBoxEx | ( | HWND | hWndParent = NULL,
 |  | UINT | nID = 0
 | ) |  |

Definition at line 3707 of file cdialoglite.cpp.

  : CComboBoxLite(hWndParent, nID)
{
}

CComboBoxEx::~CComboBoxEx ( ) [virtual]

Definition at line 3717 of file cdialoglite.cpp.

{
}

Member Function Documentation

virtual INDEX CComboBoxEx::AddString ( WCHAR * pwszString ) [inline, virtual]

Reimplemented from CComboBoxLite.

Definition at line 888 of file cdialoglite.h.

{ return InsertItem(-1/*iItem*/, pwszString);               }

virtual INDEX CComboBoxEx::AddString | ( | WCHAR * | pwszString,
 |  | LPARAM | lParam |
 | ) |  |  | [inline, virtual]

Reimplemented from CComboBoxLite.

Definition at line 889 of file cdialoglite.h.

{ return InsertItem(-1/*iItem*/, pwszString, lParam);           }

virtual INDEX CComboBoxEx::FindString | ( | WCHAR * | pwszString,
 |  | INDEX | nStartIndex = -1 |
 | ) |  |  | [inline, virtual]

Reimplemented from CComboBoxLite.

Definition at line 894 of file cdialoglite.h.

{ ASSERT(!L"FindString is not processed by ComboBoxEx, change code to use FindStringExact.");   return FindStringExact(pwszString, nStartIndex);  }

INDEX CComboBoxEx::InsertItem | ( | INDEX | iItem,
 |  | WCHAR * | pwszName,
 |  | LPARAM | lParam = PARAM_NONE,
 |  | INT | iIndent = PARAM_NONE,
 |  | INT | iImage = IMAGE_NONE,
 |  | UINT | iSelectedImage = IMAGE_NONE
 | ) |  |

Definition at line 3739 of file cdialoglite.cpp.

{
  INDEX iIndex = CB_ERR;

  //Figure out the mask
  UINT   dwMask = 0;
  if(lParam != PARAM_NONE)
    dwMask |= CBEIF_LPARAM;
  if(pwszName )
    dwMask |= CBEIF_TEXT;
  if(iIndent != PARAM_NONE)
    dwMask |= CBEIF_INDENT;
  if(iImage != IMAGE_NONE)
    dwMask |= CBEIF_IMAGE;
  if(iSelectedImage != IMAGE_NONE)
    dwMask |= CBEIF_SELECTEDIMAGE;

  //CBEM_INSERTITEM
  //NOTE: In the OnInitialUpdate we set the ComboBoxEx to be Unicode if on
  //a unicode OS and ANSI is not.  Even thought resource has ComboBoxEx (ANSI) the control
  //allow the user tha change the setting at runtime...
  if(IsUnicodeOS())
  {
    COMBOBOXEXITEMW comboItem = { dwMask, iItem, pwszName, 0/*cchTextMax*/, iImage, iSelectedImage, 0/*iOverlay*/, iIndent, lParam };
    iIndex = SendMessageW(m_hWnd, CBEM_INSERTITEMW, 0, (LPARAM)&comboItem);
  }
  else
  {
    CHAR szBuffer[MAX_NAME_LEN+1]={0};
    ConvertToMBCS(pwszName, szBuffer, MAX_NAME_LEN);

    COMBOBOXEXITEMA comboItem = { dwMask, iItem, szBuffer, 0/*cchTextMax*/, iImage, iSelectedImage, 0/*iOverlay*/, iIndent, lParam };
    iIndex = SendMessageA(m_hWnd, CBEM_INSERTITEMA, 0, (LPARAM)&comboItem);
  }

  return iIndex;
}

BOOL CComboBoxEx::OnInitialUpdate ( ) [virtual]

Reimplemented from CWndLite.

Definition at line 3726 of file cdialoglite.cpp.

{
  SetUnicodeFormat(IsUnicodeOS());

  //Delegate
  return CComboBoxLite::OnInitialUpdate();
}

virtual BOOL CComboBoxEx::SetUnicodeFormat ( BOOL fUnicode = TRUE ) [inline, virtual]

Definition at line 891 of file cdialoglite.h.

{ return (BOOL)::SendMessage(m_hWnd, CBEM_SETUNICODEFORMAT, fUnicode, 0); }

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialoglite.h
  • Dataaccess/oledb/rowsetviewer/cdialoglite.cpp
Generated on Wed Nov 13 2024 16:55:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CComboBoxGuid Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CComboBoxGuid Class Reference

#include "cdialog.h"

Inherits CComboBoxLite.

List of all members.

Public Member Functions

CComboBoxGuid ()
virtual | ~CComboBoxGuid ()
virtual REFIID | GetGuid ()
virtual BOOL | Populate (ULONG cGuidMaps, const WIDEGUIDMAP *rgGuidMaps)
virtual INDEX | SetGuid (REFIID riid)

Public Attributes

ULONG m_cGuidMaps
const WIDEGUIDMAP * | m_rgGuidMaps

Detailed Description

Definition at line 73 of file cdialog.h.

Constructor & Destructor Documentation

CComboBoxGuid::CComboBoxGuid ( )

Definition at line 4886 of file cdialog.cpp.

{
  m_cGuidMaps   = 0;
  m_rgGuidMaps  = NULL;
}

CComboBoxGuid::~CComboBoxGuid ( ) [virtual]

Definition at line 4897 of file cdialog.cpp.

{
}

Member Function Documentation

REFIID CComboBoxGuid::GetGuid ( ) [virtual]

Definition at line 4952 of file cdialog.cpp.

{
  INDEX iSel = GetCurSel();
  WIDEGUIDMAP* pGuidMap = (WIDEGUIDMAP*)GetItemParam(iSel);

  if(iSel != CB_ERR && pGuidMap)
  {
    SaveSelection();
    return *pGuidMap->pGuid;
  }

  return GUID_NULL;
}

BOOL CComboBoxGuid::Populate | ( | ULONG | cGuidMaps,
 |  | const WIDEGUIDMAP * | rgGuidMaps |
 | ) |  |  | [virtual]

Definition at line 4906 of file cdialog.cpp.

{
  m_cGuidMaps   = cGuidMaps;
  m_rgGuidMaps  = rgGuidMaps;

  //Remove any existing Data
  ResetContent();

  //Fill in the Combo Box...
  for(ULONG i=0; i<cGuidMaps; i++)
  {
    AddString(rgGuidMaps[i].pwszName, (ULONG_PTR)&rgGuidMaps[i]);
  }

  //Restore the Default Selection...
  RestoreSelection();
  return TRUE;
}

INDEX CComboBoxGuid::SetGuid ( REFIID riid ) [virtual]

Definition at line 4930 of file cdialog.cpp.

{
  //Find the specified guid...
  for(ULONG i=0; i<m_cGuidMaps; i++)
  {
    WIDEGUIDMAP* pGuidMap = (WIDEGUIDMAP*)GetItemParam(i);

    //Is this a match
    if(pGuidMap && *pGuidMap->pGuid == riid)
    {
      return SetCurSel(i);
    }
  }

  return CB_ERR;
}

Member Data Documentation

ULONG CComboBoxGuid::m_cGuidMaps

Definition at line 91 of file cdialog.h.

const WIDEGUIDMAP* CComboBoxGuid::m_rgGuidMaps

Definition at line 92 of file cdialog.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialog.h
  • Dataaccess/oledb/rowsetviewer/cdialog.cpp
Generated on Wed Nov 13 2024 16:55:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CComboBoxLite Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CComboBoxLite Class Reference

#include "cdialoglite.h"

Inherits CWndLite.

Inherited by CComboBoxEx, CComboBoxGuid, and CComboBoxString.

List of all members.

Public Member Functions

CComboBoxLite (HWND hWndParent=NULL, UINT nID=0)
virtual | ~CComboBoxLite ()
virtual INDEX | AddString (WCHAR *pwszString)
virtual INDEX | AddString (WCHAR *pwszString, LPARAM lParam)
virtual INDEX | DeleteString (INDEX nIndex)
virtual INDEX | FindString (WCHAR *pwszString, INDEX nStartIndex=-1)
virtual INDEX | FindStringExact (WCHAR *pwszString, INDEX nStartIndex=-1)
virtual INDEX | GetCount ()
virtual INDEX | GetCurSel () const
virtual LPARAM | GetItemParam (INDEX nIndex) const
virtual INDEX | GetSelText (WCHAR *pwszBuffer, ULONG ulMaxSize)
virtual LPARAM | GetSelValue ()
virtual INDEX | GetText (INDEX nIndex, WCHAR *pwszBuffer)
virtual LRESULT | GetTextLength (INDEX nIndex)
virtual BOOL | OnCommandNotify (INT wNotifyCode, INT iID, HWND hWndCtrl)
virtual BOOL | OnDropDown (INT iID, HWND hWndCtrl)
virtual BOOL | OnSelChange (INT iID, HWND hWndCtrl)
virtual BOOL | Populate (ULONG cItems, const WIDENAMEMAP *rgItems)
virtual void | ResetContent ()
virtual INDEX | RestoreSelection ()
virtual INDEX | SaveSelection ()
virtual INDEX | SetCurSel (WPARAM nSelect)
virtual BOOL | SetItemParam (INDEX nIndex, LPARAM lParam)
virtual INDEX | SetSelText (WCHAR *pwszBuffer, BOOL fAddItem=FALSE)
virtual INDEX | SetSelValue (LPARAM lParam)

Public Attributes

INDEX m_iSavedSel

Detailed Description

Definition at line 800 of file cdialoglite.h.

Constructor & Destructor Documentation

CComboBoxLite::CComboBoxLite | ( | HWND | hWndParent = NULL,
 |  | UINT | nID = 0
 | ) |  |

Definition at line 3460 of file cdialoglite.cpp.

  : CWndLite(hWndParent, nID)
{
  //NOTE: The "Height" of the combo indicates the "dropdown" height of the combo...

  m_iSavedSel   = CB_ERR;
}

CComboBoxLite::~CComboBoxLite ( ) [virtual]

Definition at line 3474 of file cdialoglite.cpp.

{
}

Member Function Documentation

virtual INDEX CComboBoxLite::AddString ( WCHAR * pwszString ) [inline, virtual]

Reimplemented in CComboBoxEx.

Definition at line 819 of file cdialoglite.h.

{ return (INDEX)::wSendMessage(m_hWnd,  CB_ADDSTRING, 0, pwszString);   }

INDEX CComboBoxLite::AddString | ( | WCHAR * | pwszString,
 |  | LPARAM | lParam |
 | ) |  |  | [virtual]

Reimplemented in CComboBoxEx.

Definition at line 3551 of file cdialoglite.cpp.

{
  //Delegate to our other function to add just the string to the combo
  INDEX iItem = AddString(pwszString);
  if(iItem!=CB_ERR)
  {
    //Now set the item data for this item...
    SetItemParam(iItem, lParam);
  }

  return iItem;
}

virtual INDEX CComboBoxLite::DeleteString ( INDEX nIndex ) [inline, virtual]

Definition at line 820 of file cdialoglite.h.

{ return (INDEX)::SendMessage(m_hWnd, CB_DELETESTRING, nIndex, 0);    }

virtual INDEX CComboBoxLite::FindString | ( | WCHAR * | pwszString,
 |  | INDEX | nStartIndex = -1 |
 | ) |  |  | [inline, virtual]

Reimplemented in CComboBoxEx.

Definition at line 827 of file cdialoglite.h.

{ return (INDEX)wSendMessage(m_hWnd,  CB_FINDSTRING,    nStartIndex, pwszString);   }

virtual INDEX CComboBoxLite::FindStringExact | ( | WCHAR * | pwszString,
 |  | INDEX | nStartIndex = -1 |
 | ) |  |  | [inline, virtual]

Definition at line 828 of file cdialoglite.h.

{ return (INDEX)wSendMessage(m_hWnd,  CB_FINDSTRINGEXACT, nStartIndex, pwszString);   }

virtual INDEX CComboBoxLite::GetCount ( ) [inline, virtual]

Definition at line 815 of file cdialoglite.h.

{ return (INDEX)::SendMessage(m_hWnd, CB_GETCOUNT, 0, 0);         }

virtual INDEX CComboBoxLite::GetCurSel ( ) const [inline, virtual]

Definition at line 816 of file cdialoglite.h.

{ return (INDEX)::SendMessage(m_hWnd, CB_GETCURSEL, 0, 0);        }

virtual LPARAM CComboBoxLite::GetItemParam ( INDEX nIndex ) const [inline, virtual]

Definition at line 824 of file cdialoglite.h.

{ return ::SendMessage(m_hWnd,  CB_GETITEMDATA, nIndex, 0);         }

INDEX CComboBoxLite::GetSelText | ( | WCHAR * | pwszBuffer,
 |  | ULONG | ulMaxSize |
 | ) |  |  | [virtual]

Definition at line 3569 of file cdialoglite.cpp.

{
  ASSERT(pwszString);
  ASSERT(ulMaxSize);

  //Try to obtain the Current Selection
  INDEX iSel = GetCurSel();

  //This may fail, if the current selection is entered (DropDown instead of DropList)
  if(iSel == CB_ERR)
  {
    GetWindowText(pwszString, ulMaxSize);
  }
  else
  {
    //Should be limiting the text if this ASSERT is hit!
    //Length does not include the NULL Terminator
    LRESULT ulLength = GetTextLength(iSel);
    ASSERT((ULONG)ulLength < ulMaxSize);

    //Obtain the text...
    if((ULONG)ulLength < ulMaxSize)
      GetText(iSel, pwszString);
  }

  return iSel;
}

LPARAM CComboBoxLite::GetSelValue ( ) [virtual]

Definition at line 3656 of file cdialoglite.cpp.

{
  //Obtain the Current Selection
  INDEX iSel    = GetCurSel();
  LPARAM lParam = CB_ERR;

  //This may fail, if the current selection is entered (DropDown instead of DropList)
  if(iSel == CB_ERR)
  {
    WCHAR* pwszText = GetWindowText();
    WCHAR* pwszEnd = NULL;
    if(pwszText)
    {
      //Convert to LPARAM
      if(!ConvertToLONG(pwszText, (LONG*)&lParam))
        lParam = CB_ERR;
      SAFE_FREE(pwszText);
    }
  }
  else
  {
    lParam = GetItemParam(iSel);
  }

  return lParam;
}

virtual INDEX CComboBoxLite::GetText | ( | INDEX | nIndex,
 |  | WCHAR * | pwszBuffer |
 | ) |  |  | [inline, virtual]

Definition at line 826 of file cdialoglite.h.

{ return (INDEX)::wSendMessage(m_hWnd,  CB_GETLBTEXT, nIndex, pwszBuffer);  }

virtual LRESULT CComboBoxLite::GetTextLength ( INDEX nIndex ) [inline, virtual]

Definition at line 825 of file cdialoglite.h.

{ return ::SendMessage(m_hWnd,  CB_GETLBTEXTLEN, nIndex, 0);        }

BOOL CComboBoxLite::OnCommandNotify | ( | INT | wNotifyCode,
 |  | INT | iID,
 |  | HWND | hWndCtrl |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 3503 of file cdialoglite.cpp.

{
  switch(wNotifyCode)
  {
    case CBN_SELCHANGE:
    {
      if(OnSelChange(iID, hWndCtrl))
        return TRUE;
      break;
    }

    case CBN_DROPDOWN:
    {
      if(OnDropDown(iID, hWndCtrl))
        return TRUE;
      break;
    }
  };

  //Otherwise Delegate
  return CWndLite::OnCommandNotify(wNotifyCode, iID, hWndCtrl);
}

BOOL CComboBoxLite::OnDropDown | ( | INT | iID,
 |  | HWND | hWndCtrl |
 | ) |  |  | [virtual]

Definition at line 3541 of file cdialoglite.cpp.

{
  return FALSE;
}

BOOL CComboBoxLite::OnSelChange | ( | INT | iID,
 |  | HWND | hWndCtrl |
 | ) |  |  | [virtual]

Definition at line 3531 of file cdialoglite.cpp.

{
  return FALSE;
}

BOOL CComboBoxLite::Populate | ( | ULONG | cItems,
 |  | const WIDENAMEMAP * | rgItems |
 | ) |  |  | [virtual]

Definition at line 3483 of file cdialoglite.cpp.

{
  //Remove any existing Data
  ResetContent();

  //Fill in the Combo Box...
  for(ULONG i=0; i<cItems; i++)
    AddString(rgItems[i].pwszName, (LPARAM)rgItems[i].lItem);

  //Restore the Default Selection...
  RestoreSelection();
  return TRUE;
}

virtual void CComboBoxLite::ResetContent ( ) [inline, virtual]

Definition at line 822 of file cdialoglite.h.

{ ::SendMessage(m_hWnd, CB_RESETCONTENT, 0, 0);               }

virtual INDEX CComboBoxLite::RestoreSelection ( ) [inline, virtual]

Definition at line 839 of file cdialoglite.h.

{ return SetCurSel(m_iSavedSel);                      }

virtual INDEX CComboBoxLite::SaveSelection ( ) [inline, virtual]

Definition at line 838 of file cdialoglite.h.

{ return m_iSavedSel = GetCurSel();                     }

virtual INDEX CComboBoxLite::SetCurSel ( WPARAM nSelect ) [inline, virtual]

Definition at line 817 of file cdialoglite.h.

{ return (INDEX)::SendMessage(m_hWnd, CB_SETCURSEL, nSelect, 0);      }

virtual BOOL CComboBoxLite::SetItemParam | ( | INDEX | nIndex,
 |  | LPARAM | lParam |
 | ) |  |  | [inline, virtual]

Definition at line 821 of file cdialoglite.h.

{ return ::SendMessage(m_hWnd,  CB_SETITEMDATA, nIndex, lParam) != CB_ERR;  }

INDEX CComboBoxLite::SetSelText | ( | WCHAR * | pwszBuffer,
 |  | BOOL | fAddItem = FALSE |
 | ) |  |  | [virtual]

Definition at line 3602 of file cdialoglite.cpp.

{
  ASSERT(pwszString);

  //Try to find the Indicated Text
  INDEX iSel = FindStringExact(pwszString);

  //If not found, just add it to the list (if desired)
  if(iSel == CB_ERR)
  {
    if(fAddItem)
    {
      iSel = AddString(pwszString, 0);
    }
    else
    {
      SetCurSel(iSel);
      SetWindowText(pwszString);
    }
  }

  if(iSel != CB_ERR)
    iSel = SetCurSel(iSel);

  return iSel;
}

INDEX CComboBoxLite::SetSelValue ( LPARAM lParam ) [virtual]

Definition at line 3634 of file cdialoglite.cpp.

{
  //Loop through all Combo Item Values and Select specified one...
  INDEX iCount = GetCount();
  for(INDEX i=0; i<iCount; i++)
  {
    if(lParam == GetItemParam(i))
    {
      SetCurSel(i);
      return i;
    }
  }

  return CB_ERR;
}

Member Data Documentation

INDEX CComboBoxLite::m_iSavedSel

Definition at line 845 of file cdialoglite.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialoglite.h
  • Dataaccess/oledb/rowsetviewer/cdialoglite.cpp
Generated on Wed Nov 13 2024 16:55:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CComboBoxString Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CComboBoxString Class Reference

#include "cdialog.h"

Inherits CComboBoxLite.

List of all members.

Public Member Functions

CComboBoxString ()
virtual | ~CComboBoxString ()
virtual WCHAR * | GetSelText ()
virtual BOOL | OnInitialUpdate ()

Detailed Description

Definition at line 101 of file cdialog.h.

Constructor & Destructor Documentation

CComboBoxString::CComboBoxString ( )

Definition at line 4974 of file cdialog.cpp.

{
}

CComboBoxString::~CComboBoxString ( ) [virtual]

Definition at line 4983 of file cdialog.cpp.

{
}

Member Function Documentation

WCHAR * CComboBoxString::GetSelText ( ) [virtual]

Definition at line 5007 of file cdialog.cpp.

{
  INDEX iSel = GetCurSel();
  if(iSel == CB_ERR)
  {
    //Delegate
    return CComboBoxLite::GetWindowText();
  }

  DBTYPE wType = (DBTYPE)GetItemParam(iSel);
  switch(wType)
  {
    case VT_NULL:
      //Null pointer
      return NULL;

    case VT_EMPTY:
      //Empty string
      return wcsDuplicate(L"");

    default:
      ASSERT(!"Unhandled Drop Down!");
      break;
  };

  return NULL;
}

BOOL CComboBoxString::OnInitialUpdate ( ) [virtual]

Reimplemented from CWndLite.

Definition at line 4992 of file cdialog.cpp.

{
  //Populate the <NULL> option
  AddString(L"<NULL>",      VT_NULL /*NULL pointer*/);
  AddString(L"<Empty String>",  VT_EMPTY/*Empty String*/);

  //Delegate
  return CComboBoxLite::OnInitialUpdate();
}

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialog.h
  • Dataaccess/oledb/rowsetviewer/cdialog.cpp
Generated on Wed Nov 13 2024 16:55:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCommand Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Protected Attributes | Friends

CCommand Class Reference

#include "ccommand.h"

Inherits CBaseObj, and CDataAccess.

List of all members.

Public Member Functions

CCommand (CMainWindow *pCMainWindow, CMDIChild *pCMDIChild=NULL)
CCommand (CDBSession *pCSession, LPUNKNOWN pUnkOuter)
virtual | ~CCommand ()
~CCommand (void)
virtual HRESULT | AutoQI (DWORD dwCreateOpts)
virtual HRESULT | AutoRelease ()
HRESULT | CheckCanceledHelper ()
virtual HRESULT | CreateParamAccessor (DB_UPARAMS cParams, DBPARAMINFO *rgParamInfo, DB_UPARAMS cParamSets)
void | DecrementOpenRowsets ()
virtual HRESULT | Execute (CAggregate *pCAggregate, WCHAR *pwszCommandText, REFIID riid, BOOL fUseParams, DBROWCOUNT *pcRowsAffected, IUnknown **ppIUnknown, BOOL fCommandStream=FALSE)
HRESULT | FInit ()
WCHAR *const | GetCommandText ()
virtual HRESULT | GetCurrentCommand (DBID **ppCommandID)
virtual REFIID | GetDefaultInterface ()
virtual IUnknown ** | GetInterfaceAddress (REFIID riid)
virtual LONG | GetObjectImage ()
virtual UINT | GetObjectMenu ()
virtual WCHAR * | GetObjectName ()
virtual HRESULT | GetParameterInfo (DB_UPARAMS *pcParams, DBPARAMINFO **prgParamInfo, OLECHAR **ppwszNamesBuffer)
void | IncrementOpenRowsets ()
BOOL IsCommandSet ()
BOOL IsRowsetOpen ()
virtual HRESULT | Prepare (ULONG cExpectedRuns)
STDMETHODIMP | QueryInterface (REFIID, LPVOID *)
virtual HRESULT | SetCommandStream (WCHAR *pwszText, REFIID riid=IID_ISequentialStream, GUID *pGuidDialect=NULL, BOOL fUnicode=TRUE)
virtual HRESULT | SetCommandText (WCHAR *pwszText, GUID *pGuidDialect=NULL)
void | SetImpersonateIID (const GUID *pGuid)
virtual HRESULT | SetProperties (ULONG cPropSets, DBPROPSET *rgPropSets)
virtual HRESULT | SetupBindings (DB_UPARAMS cParams, DBPARAMINFO *rgParamInfo, DBCOUNTITEM *cBindings, DBBINDING **prgBindings, DBLENGTH *pcRowSize=NULL)
STDMETHODIMP_ (DBREFCOUNT) AddRef(void)
STDMETHODIMP_ (DBREFCOUNT) Release(void)

Public Attributes

GUID | m_guidDialect
CParameters m_Parameters
CDBSession * m_pCSession
ICommand * | m_pICommand
ICommandPersist * | m_pICommandPersist
ICommandPrepare * | m_pICommandPrepare
ICommandProperties * | m_pICommandProperties
ICommandStream * | m_pICommandStream
ICommandText * | m_pICommandText
ICommandWithParameters * | m_pICommandWithParameters

Protected Attributes

DBREFCOUNT | m_cRef
ULONG m_cRowsetsOpen
UDWORD m_dwStatus
GUID | m_guidCmdDialect
GUID | m_guidImpersonate
CImpIAccessor * m_pIAccessor
PIMPICOLUMNSINFO m_pIColumnsInfo
PIMPICOMMANDPROPERTIES m_pICommandProperties
PIMPICOMMANDTEXT m_pICommandText
PIMPICONVERTTYPE m_pIConvertType
PCUTILPROP m_pUtilProp
WCHAR * | m_strCmdText

Friends

class | CImpIAccessor
class | CImpIColumnsInfo
class | CImpICommandProperties
class | CImpICommandText
class | CImpIConvertType

Detailed Description

Definition at line 99 of file ccommand.h.

Constructor & Destructor Documentation

CCommand::CCommand | ( | CMainWindow * | pCMainWindow,
 |  | CMDIChild * | pCMDIChild = NULL
 | ) |  |

Definition at line 22 of file ccommand.cpp.

  : CDataAccess(eCCommand, pCMainWindow, pCMDIChild)
{
  //OLE DB Interfaces
  m_pICommand         = NULL;   //Command interface
  m_pICommandProperties   = NULL;   //Command interface
  m_pICommandText       = NULL;   //Command interface
  m_pICommandStream     = NULL;   //Command interface
  m_pICommandPrepare      = NULL;   //Command interface
  m_pICommandPersist      = NULL;   //Command interface
  m_pICommandWithParameters = NULL;   //Command interface

  //Data
  m_guidDialect       = DBGUID_DEFAULT;
}

CCommand::~CCommand ( void ) [virtual]

Definition at line 42 of file ccommand.cpp.

{
  ReleaseObject(0);
}

CCommand::CCommand | ( | CDBSession * | pCSession,
 |  | LPUNKNOWN | pUnkOuter
 | ) |  |

Definition at line 24 of file command.cpp.

  : CBaseObj( BOT_COMMAND )
{
  assert( pCSession );

  //  Initialize simple member vars
  m_pUnkOuter         = pUnkOuter ? pUnkOuter : this;
  m_dwStatus          = 0L;
  m_cRowsetsOpen        = 0;
  m_cRef            = 0L;

  // Establish the parent object
  m_pCSession         = pCSession;

  //  Initially, NULL all contained interfaces
  m_pIAccessor        = NULL;
  m_pICommandText       = NULL;
  m_pICommandProperties   = NULL;
  m_pIColumnsInfo       = NULL;
  m_pIConvertType       = NULL;

  m_pUtilProp         = NULL;

  m_guidCmdDialect      = DBGUID_DBSQL;
  m_guidImpersonate     = GUID_NULL;

  m_strCmdText        = NULL;

  // Increment global object count.
    OBJECT_CONSTRUCTED();
  return;
}

CCommand::~CCommand ( void )

Member Function Documentation

HRESULT CCommand::AutoQI ( DWORD dwCreateOpts ) [virtual]

Reimplemented from CDataAccess.

Definition at line 97 of file ccommand.cpp.

{
  //Delegate First so we have base interfaces
  CDataAccess::AutoQI(dwCreateOpts);

  //[MANDATORY]
  if(dwCreateOpts & CREATE_QI_MANDATORY)
  {
    OBTAIN_INTERFACE(ICommand);
    OBTAIN_INTERFACE(ICommandText);
  }

  //[OPTIONAL]
  if(dwCreateOpts & CREATE_QI_OPTIONAL)
  {
    //[OPTIONAL]
    OBTAIN_INTERFACE(ICommandStream);
    OBTAIN_INTERFACE(ICommandProperties);
    OBTAIN_INTERFACE(ICommandPrepare);
    OBTAIN_INTERFACE(ICommandPersist);
    OBTAIN_INTERFACE(ICommandWithParameters);
  }

  return S_OK;
}

HRESULT CCommand::AutoRelease ( ) [virtual]

Reimplemented from CDataAccess.

Definition at line 71 of file ccommand.cpp.

{
  ReleaseAccessor(&m_Parameters.GetParams().hAccessor);
  m_Parameters.RemoveAll();

  //Command
  RELEASE_INTERFACE(IAccessor);
  RELEASE_INTERFACE(IColumnsInfo);
  RELEASE_INTERFACE(ICommand);
  RELEASE_INTERFACE(ICommandProperties);
  RELEASE_INTERFACE(ICommandText);
  RELEASE_INTERFACE(ICommandStream);
  RELEASE_INTERFACE(IConvertType);
  RELEASE_INTERFACE(ICommandPrepare);
  RELEASE_INTERFACE(ICommandPersist);
  RELEASE_INTERFACE(ICommandWithParameters);

  //Delegate
  return CDataAccess::AutoRelease();
}

HRESULT CCommand::CheckCanceledHelper ( )
HRESULT CCommand::CreateParamAccessor | ( | DB_UPARAMS | cParams,
 |  | DBPARAMINFO * | rgParamInfo,
 |  | DB_UPARAMS | cParamSets |
 | ) |  |  | [virtual]

Definition at line 180 of file ccommand.cpp.

{
  HRESULT   hr = S_OK;
  DBCOUNTITEM cBindings = 0;
  DBBINDING*  rgBindings = NULL;
  HACCESSOR hAccessor = NULL;
  DBLENGTH  cbRowSize = 0;

  //Release Previous Accessor
  ReleaseAccessor(&m_Parameters.GetParams().hAccessor);
  m_Parameters.RemoveAll();

  //Setup the Bindings
  TESTC(hr = SetupBindings(cParams, rgParamInfo, &cBindings, &rgBindings, &cbRowSize));

  //Create the Accessor
  TESTC(hr = CreateAccessor(DBACCESSOR_PARAMETERDATA, cBindings, rgBindings, cbRowSize, &hAccessor));

  //Attach our object...
  TESTC(hr = m_Parameters.Attach(cParamSets, hAccessor, cbRowSize));
  m_Parameters.GetBindings().Attach(cBindings, rgBindings);

CLEANUP:
  return hr;
}

void CCommand::DecrementOpenRowsets ( ) [inline]

Definition at line 127 of file command.h.

                                       {
      InterlockedDecrement( (LONG*) &m_cRowsetsOpen );
      ASSERT( m_cRowsetsOpen != (ULONG)-1 );
    };

HRESULT CCommand::Execute | ( | CAggregate * | pCAggregate,
 |  | WCHAR * | pwszCommandText,
 |  | REFIID | riid,
 |  | BOOL | fUseParams,
 |  | DBROWCOUNT * | pcRowsAffected,
 |  | IUnknown ** | ppIUnknown,
 |  | BOOL | fCommandStream = FALSE |
 | ) |  |  | [virtual]

Definition at line 403 of file ccommand.cpp.

{
  HRESULT hr = S_OK;
  DBROWCOUNT cRowsAffected = DB_COUNTUNAVAILABLE;

  //Execute
  if(m_pICommand)
  {
    //SetCommandText (if user requested new text)
    if(pwszCommandText)
    {
      //Clear previous object (if requested and really need to...)
      if(GetOptions()->m_dwCommandOpts & COMMAND_RELEASE_OPENOBJECTS)
      {
        //Release all child objects of the command.
        //NOTE: This includes: Rowset, Row, DataSet, Stream, etc...
        ReleaseChildren();
      }

      //SetCommandText...
      if(fCommandStream)
      {
        TESTC(hr = SetCommandStream(pwszCommandText));
      }
      else
      {
        TESTC(hr = SetCommandText(pwszCommandText));
      }
    }

    //Execute
    XTEST_(hr = m_pICommand->Execute(
              pCAggregate,      // pUnkOuter
              riid,         // refiid
              fUseParams ? &m_Parameters.GetParams() : NULL,  // params
              &cRowsAffected,     // rows affected
              ppIUnknown),S_OK);    // IRowset pointer
    TRACE_METHOD(hr, L"ICommand::Execute(0x%p, %s, 0x%p, &%ld, &0x%p)", pCAggregate, GetInterfaceName(riid), fUseParams ? &m_Parameters.GetParams() : NULL, cRowsAffected, ppIUnknown ? *ppIUnknown : NULL);

    //Display Property Errors
    TESTC(hr = DisplayPropErrors(hr, IID_ICommandProperties, m_pICommand));

    //ParameterBinding Errors
    if(fUseParams)
    {
      //Loop through the parameter sets (if any)
      for(ULONG iParamSet=0; iParamSet<m_Parameters.GetParams().cParamSets; iParamSet++)
        TESTC(hr = DisplayBindingErrors(hr, m_Parameters.GetBindings().GetCount(), m_Parameters.GetBindings().GetElements(), m_Parameters.GetData(iParamSet)));
    }

    //Handle Aggregation
    if(pCAggregate)
      TESTC(hr = pCAggregate->HandleAggregation(riid, ppIUnknown));

    //Display RowsAffected - (if desired)
    if(!pcRowsAffected)
    {
      if(!ppIUnknown || !*ppIUnknown)
      {
        if(cRowsAffected==DB_COUNTUNAVAILABLE)
          wMessageBox(GetFocus(), MB_TASKMODAL | MB_ICONWARNING | MB_OK, wsz_INFO,
            L"RowsAffected = %s, No Rowset returned", L"DB_COUNTUNAVAILABLE");
        else
          wMessageBox(GetFocus(), MB_TASKMODAL | MB_ICONWARNING | MB_OK, wsz_INFO,
            L"RowsAffected = %ld, No Rowset returned", cRowsAffected );
      }
    }
  }

CLEANUP:
  if(pcRowsAffected)
    *pcRowsAffected = cRowsAffected;
  return hr;
}

HRESULT CCommand::FInit ( )

Definition at line 105 of file command.cpp.

{
  assert( m_pUnkOuter );    // Set in constructor
  assert( m_pCSession );    // Set in constructor

  LPUNKNOWN   pIUnknown = (LPUNKNOWN) this;

  if (m_pUnkOuter)
        pIUnknown = m_pUnkOuter;

  if (m_pCSession && m_pCSession->GetOuterUnknown())
    m_pCSession->GetOuterUnknown()->AddRef();

  // Allocate Property Utility object
  m_pUtilProp = new CUtilProp();
  if( !m_pUtilProp )
    return ResultFromScode(E_OUTOFMEMORY);

  //  Allocate contained interface objects
  m_pIAccessor                = new CImpIAccessor( this, pIUnknown );
  m_pICommandText       = new CImpICommandText( this, pIUnknown );
  m_pICommandProperties   = new CImpICommandProperties( this, pIUnknown );
  m_pIColumnsInfo       = new CImpIColumnsInfo( this, pIUnknown );
  m_pIConvertType       = new CImpIConvertType( this, pIUnknown );

  if ( m_pIAccessor )
    {
    if( FAILED(m_pIAccessor->FInit(FALSE)))
      return ResultFromScode(E_OUTOFMEMORY);
    }

  if( m_pIAccessor &&
    m_pICommandText &&
    m_pICommandProperties &&
    m_pIColumnsInfo &&
    m_pIConvertType
    )
    return ResultFromScode(S_OK);
  else
    return ResultFromScode(E_FAIL);
}

WCHAR* const CCommand::GetCommandText ( ) [inline]

Definition at line 119 of file command.h.

                                          {
      return m_strCmdText;
    };

HRESULT CCommand::GetCurrentCommand ( DBID ** ppCommandID ) [virtual]

Definition at line 155 of file ccommand.cpp.

{
  HRESULT hr = E_FAIL;

  if(m_pICommandPersist)
  {
    WCHAR wszCommandID[MAX_NAME_LEN] = {0};

    //ICommandPersist::GetCurrentCommand
    hr = m_pICommandPersist->GetCurrentCommand(ppCommandID);

    //Format the resultant DBID into something the user can look at...
    DBIDToString(ppCommandID ? *ppCommandID : NULL, wszCommandID, MAX_NAME_LEN);
    TESTC(TRACE_METHOD(hr, L"ICommandPersist::GetCurrentCommand({\"%s\"})", wszCommandID));
  }

CLEANUP:
  return hr;
}

virtual REFIID CCommand::GetDefaultInterface ( ) [inline, virtual]

Implements CBase.

Definition at line 114 of file ccommand.h.

{ return IID_ICommand;    }

IUnknown ** CCommand::GetInterfaceAddress ( REFIID riid ) [virtual]

Reimplemented from CDataAccess.

Definition at line 52 of file ccommand.cpp.

{
  HANDLE_GETINTERFACE(ICommand);
  HANDLE_GETINTERFACE(ICommandProperties);
  HANDLE_GETINTERFACE(ICommandText);
  HANDLE_GETINTERFACE(ICommandStream);
  HANDLE_GETINTERFACE(ICommandPrepare);
  HANDLE_GETINTERFACE(ICommandPersist);
  HANDLE_GETINTERFACE(ICommandWithParameters);

  //Otherwise delegate
  return CDataAccess::GetInterfaceAddress(riid);
}

virtual LONG CCommand::GetObjectImage ( ) [inline, virtual]

Implements CBase.

Definition at line 115 of file ccommand.h.

{ return IMAGE_COMMAND;   }

virtual UINT CCommand::GetObjectMenu ( ) [inline, virtual]

Implements CBase.

Definition at line 113 of file ccommand.h.

{ return IDM_COMMANDMENU; }

virtual WCHAR* CCommand::GetObjectName ( ) [inline, virtual]

Implements CBase.

Definition at line 112 of file ccommand.h.

{ return L"Command";    }

HRESULT CCommand::GetParameterInfo | ( | DB_UPARAMS * | pcParams,
 |  | DBPARAMINFO ** | prgParamInfo,
 |  | OLECHAR ** | ppwszNamesBuffer |
 | ) |  |  | [virtual]

Definition at line 306 of file ccommand.cpp.

{
  HRESULT hr = S_OK;

  if(m_pICommandWithParameters)
  {
    //ICommandWithParameters::GetParameterInfo
    hr = m_pICommandWithParameters->GetParameterInfo(pcParams, prgParamInfo, ppwszNamesBuffer);
    TRACE_METHOD(hr, L"ICommandWithParameters::GetParameterInfo(&%lu, &0x%p, &0x%p)", pcParams ? *pcParams : 0, prgParamInfo ? *prgParamInfo : NULL, ppwszNamesBuffer ? *ppwszNamesBuffer : NULL);
  }

  return hr;
}

void CCommand::IncrementOpenRowsets ( ) [inline]

Definition at line 132 of file command.h.

                                       {
      InterlockedIncrement( (LONG*) &m_cRowsetsOpen );
    };

BOOL CCommand::IsCommandSet ( ) [inline]

Definition at line 123 of file command.h.

                               {
      return !!(m_dwStatus & CMD_TEXT_SET);
    };

BOOL CCommand::IsRowsetOpen ( ) [inline]

Definition at line 136 of file command.h.

                               {
      return (m_cRowsetsOpen > 0) ? TRUE : FALSE;
    };

HRESULT CCommand::Prepare ( ULONG cExpectedRuns ) [virtual]

Definition at line 286 of file ccommand.cpp.

{
  HRESULT hr = S_OK;

  //Prepare
  if(m_pICommandPrepare)
  {
    //ICommandPrepare::Prepare
    hr = m_pICommandPrepare->Prepare(0);
    TRACE_METHOD(hr, L"ICommandPrepare::Prepare(%d)", cExpectedRuns);
  }

  return hr;
}

STDMETHODIMP CCommand::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 160 of file command.cpp.

{
  if( ppv == NULL )
    return ResultFromScode(E_INVALIDARG);

  //  This is the non-delegating IUnknown implementation
  if( riid == IID_IAccessor )
    *ppv = (LPVOID)m_pIAccessor;
  else if( riid == IID_ICommand )
    *ppv = (LPVOID)m_pICommandText;
  else if( riid == IID_ICommandText )
    *ppv = (LPVOID)m_pICommandText;
  else if( riid == IID_ICommandProperties )
    *ppv = (LPVOID)m_pICommandProperties;
  else if( riid == IID_IColumnsInfo )
    *ppv = (LPVOID)m_pIColumnsInfo;
  else if( riid == IID_IConvertType )
    *ppv = (LPVOID)m_pIConvertType;
  else if( riid == IID_IUnknown )
    *ppv = (LPVOID)this;
  else
    *ppv = NULL;

  //  If we're going to return an interface, AddRef it first
  if( *ppv )
  {
    ((LPUNKNOWN)*ppv)->AddRef();
    return NOERROR;
  }

  return ResultFromScode(E_NOINTERFACE);
}

HRESULT CCommand::SetCommandStream | ( | WCHAR * | pwszText,
 |  | REFIID | riid = IID_ISequentialStream,
 |  | GUID * | pGuidDialect = NULL,
 |  | BOOL | fUnicode = TRUE |
 | ) |  |  | [virtual]

Definition at line 350 of file ccommand.cpp.

{
  HRESULT hr = E_NOINTERFACE;
  GUID guidDialect = pGuidDialect ? *pGuidDialect : m_guidDialect;
  CStorageBuffer* pCStream = NULL;

  //Set CommandStream
  if(m_pICommandStream)
  {
    //Create a stream object over the specified text.
    pCStream = new CStorageBuffer;
    if(pwszText)
    {
      ULONG cbWritten = 0;
      if(fUnicode)
      {
        //UNICODE-Stream:
        //We need to place the BOM mark to indicate its a Unicode stream...
        TESTC(pCStream->WriteBuffer(0, &UNICODE_BYTE_ORDER_MARK, sizeof(UNICODE_BYTE_ORDER_MARK), &cbWritten));
        TESTC(pCStream->WriteBuffer(cbWritten, pwszText, wcslen(pwszText)*sizeof(WCHAR), NULL));
      }
      else
      {
        //MBCS-Stream:
        //First convert the Unicode stream to MBCS
        CHAR* pszText = ConvertToMBCS(pwszText);
        TESTC(pCStream->WriteBuffer(cbWritten, pszText, strlen(pszText)*sizeof(CHAR), NULL));
        SAFE_FREE(pszText);
      }
    }

    //ICommandStream::SetCommandStream
    //NOTE: The provider has to validate that the object passed in actually supports the interface
    //requested, so we can just blindly pass in the IUnknown and it will do the QI, not us...
    XTEST(hr = m_pICommandStream->SetCommandStream(riid, guidDialect, (IStream*)pCStream));
    TESTC(TRACE_METHOD(hr, L"ICommandStream::SetCommandStream(%s, %s, \"%s\")", GetInterfaceName(riid), GetDialectName(guidDialect), pwszText));

    //Save the Command Text on Success...
    if(pGuidDialect)
      m_guidDialect = *pGuidDialect;
  }

CLEANUP:
  SAFE_RELEASE(pCStream);
  return hr;
}

HRESULT CCommand::SetCommandText | ( | WCHAR * | pwszText,
 |  | GUID * | pGuidDialect = NULL |
 | ) |  |  | [virtual]

Definition at line 325 of file ccommand.cpp.

{
  HRESULT hr = E_NOINTERFACE;
  GUID guidDialect = pGuidDialect ? *pGuidDialect : m_guidDialect;

  //Set CommandText
  if(m_pICommandText)
  {
    XTEST(hr = m_pICommandText->SetCommandText(guidDialect, pwszText));
    TESTC(TRACE_METHOD(hr, L"ICommandText::SetCommandText(%s, \"%s\")", GetDialectName(guidDialect), pwszText));

    //Save the Command Text on Success...
    if(pGuidDialect)
      m_guidDialect = *pGuidDialect;
  }

CLEANUP:
  return hr;
}

void CCommand::SetImpersonateIID ( const GUID * pGuid ) [inline]

Definition at line 114 of file command.h.

                                                     {
      assert(pGuid);
      m_guidImpersonate = *pGuid;
    };

HRESULT CCommand::SetProperties | ( | ULONG | cPropSets,
 |  | DBPROPSET * | rgPropSets |
 | ) |  |  | [virtual]

Definition at line 128 of file ccommand.cpp.

{
  HRESULT hr = E_FAIL;

  //Initally setup up some rowset properties that are very useful functionality
  //These are mainly to have the most common operations on the rowset and to
  //be able to obtain blob columns...

  if(m_pICommandProperties)
  {
    //ICommandProperties::SetProperties
    XTEST_(hr = m_pICommandProperties->SetProperties(cPropSets, rgPropSets),S_OK);
    TRACE_METHOD(hr, L"ICommandProperties::SetProperties(%d, 0x%p)", cPropSets, rgPropSets);

    //Display property errors
    TESTC(hr = DisplayPropErrors(hr, cPropSets, rgPropSets));
  }

CLEANUP:
  return hr;
}

HRESULT CCommand::SetupBindings | ( | DB_UPARAMS | cParams,
 |  | DBPARAMINFO * | rgParamInfo,
 |  | DBCOUNTITEM * | cBindings,
 |  | DBBINDING ** | prgBindings,
 |  | DBLENGTH * | pcRowSize = NULL |
 | ) |  |  | [virtual]

Definition at line 211 of file ccommand.cpp.

{
  ASSERT(pcBindings);
  ASSERT(prgBindings);

  HRESULT hr = S_OK;

  DBLENGTH dwOffset = 0;
  DBCOUNTITEM i,cBindings = 0;
  DBBINDING* rgBindings = NULL;

  //Only capable of the Following Converions (for Display)
  DWORD dwMaxLength   = GetOptions()->m_dwMaxLength;
  DWORD dwAccessorOpts  = GetOptions()->m_dwAccessorOpts;

  //Alloc the space to hold the Bindings and Accessors
  SAFE_ALLOC(rgBindings, DBBINDING, cParams);

  cBindings = 0;
  for(i=0; i<cParams; i++)
  {
    ASSERT(rgParamInfo);

    //SetUp the Bindings
    rgBindings[cBindings].iOrdinal  = rgParamInfo[i].iOrdinal;
    rgBindings[cBindings].obStatus  = dwOffset;
    dwOffset += ROUNDUP(sizeof(DBSTATUS));
    rgBindings[cBindings].obLength  = dwOffset;
    dwOffset += ROUNDUP(sizeof(DBLENGTH));
    rgBindings[cBindings].obValue = dwOffset;

    rgBindings[cBindings].pTypeInfo = NULL;
    rgBindings[cBindings].pBindExt  = NULL;

    rgBindings[cBindings].dwPart  = dwAccessorOpts & (DBPART_VALUE|DBPART_LENGTH|DBPART_STATUS);
    rgBindings[cBindings].dwMemOwner= (dwAccessorOpts & ACCESSOR_OWNED_PROVIDER) ? DBMEMOWNER_PROVIDEROWNED : DBMEMOWNER_CLIENTOWNED;

    rgBindings[cBindings].eParamIO  = DBPARAMIO_NOTPARAM;
    if(rgParamInfo[i].dwFlags & DBPARAMFLAGS_ISINPUT)
      rgBindings[cBindings].eParamIO |= DBPARAMIO_INPUT;
    if(rgParamInfo[i].dwFlags & DBPARAMFLAGS_ISOUTPUT)
      rgBindings[cBindings].eParamIO |= DBPARAMIO_OUTPUT;

    rgBindings[cBindings].dwFlags = 0;
    rgBindings[cBindings].bPrecision= rgParamInfo[i].bPrecision;
    rgBindings[cBindings].bScale  = rgParamInfo[i].bScale;

    rgBindings[cBindings].pObject = NULL;
    rgBindings[cBindings].wType   = GetOptions()->GetBindingType(rgParamInfo[i].wType);

    //MAX_LENGTH
    rgBindings[cBindings].cbMaxLen  = GetMaxDisplaySize(rgBindings[cBindings].wType, rgParamInfo[i].wType, rgParamInfo[i].ulParamSize, dwMaxLength);

    dwOffset += rgBindings[cBindings].cbMaxLen;
    dwOffset = ROUNDUP( dwOffset );
    cBindings++;
  }

  //Size for pData
  if(pcRowSize)
    *pcRowSize = dwOffset;

CLEANUP:
  //Accessors
  *pcBindings = cBindings;
  *prgBindings = rgBindings;
  return hr;
}

CCommand::STDMETHODIMP_ ( DBREFCOUNT )
CCommand::STDMETHODIMP_ ( DBREFCOUNT )

Friends And Related Function Documentation

friend class CImpIAccessor [friend]

Definition at line 52 of file command.h.

friend class CImpIColumnsInfo [friend]

Definition at line 55 of file command.h.

friend class CImpICommandProperties [friend]

Definition at line 54 of file command.h.

friend class CImpICommandText [friend]

Definition at line 53 of file command.h.

friend class CImpIConvertType [friend]

Definition at line 56 of file command.h.

Member Data Documentation

DBREFCOUNT CCommand::m_cRef [protected]

Reimplemented from CBase.

Definition at line 61 of file command.h.

ULONG CCommand::m_cRowsetsOpen [protected]

Definition at line 76 of file command.h.

UDWORD CCommand::m_dwStatus [protected]

Definition at line 74 of file command.h.

GUID CCommand::m_guidCmdDialect [protected]

Definition at line 82 of file command.h.

GUID CCommand::m_guidDialect

Definition at line 151 of file ccommand.h.

GUID CCommand::m_guidImpersonate [protected]

Definition at line 79 of file command.h.

CParameters CCommand::m_Parameters

Definition at line 148 of file ccommand.h.

CDBSession* CCommand::m_pCSession

Definition at line 98 of file command.h.

CImpIAccessor* CCommand::m_pIAccessor [protected]

Reimplemented from CDataAccess.

Definition at line 63 of file command.h.

PIMPICOLUMNSINFO CCommand::m_pIColumnsInfo [protected]

Reimplemented from CDataAccess.

Definition at line 69 of file command.h.

ICommand* CCommand::m_pICommand

Definition at line 137 of file ccommand.h.

ICommandPersist* CCommand::m_pICommandPersist

Definition at line 144 of file ccommand.h.

ICommandPrepare* CCommand::m_pICommandPrepare

Definition at line 143 of file ccommand.h.

ICommandProperties* CCommand::m_pICommandProperties

Definition at line 138 of file ccommand.h.

PIMPICOMMANDPROPERTIES CCommand::m_pICommandProperties [protected]

Definition at line 67 of file command.h.

ICommandStream* CCommand::m_pICommandStream

Definition at line 142 of file ccommand.h.

ICommandText* CCommand::m_pICommandText

Definition at line 139 of file ccommand.h.

PIMPICOMMANDTEXT CCommand::m_pICommandText [protected]

Definition at line 65 of file command.h.

ICommandWithParameters* CCommand::m_pICommandWithParameters

Definition at line 145 of file ccommand.h.

PIMPICONVERTTYPE CCommand::m_pIConvertType [protected]

Reimplemented from CDataAccess.

Definition at line 71 of file command.h.

PCUTILPROP CCommand::m_pUtilProp [protected]

Definition at line 86 of file command.h.

WCHAR* CCommand::m_strCmdText [protected]

Definition at line 84 of file command.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/ccommand.h
  • Dataaccess/oledb/sampprov/command.h
  • Dataaccess/oledb/rowsetviewer/ccommand.cpp
  • Dataaccess/oledb/sampprov/command.cpp
Generated on Wed Nov 13 2024 16:55:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCommBand Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes | Private Member Functions | Static Private Member Functions | Private Attributes

CCommBand Class Reference

#include "CommBand.h"

List of all members.

Public Member Functions

CCommBand ()
~CCommBand ()
STDMETHOD() | CloseDW (DWORD dwReserved)
STDMETHOD() | ContextSensitiveHelp (BOOL)
STDMETHOD() | GetBandInfo (DWORD, DWORD, DESKBANDINFO *)
STDMETHOD() | GetClassID (LPCLSID)
STDMETHOD() | GetSite (REFIID, LPVOID *)
STDMETHOD() | GetSizeMax (ULARGE_INTEGER *)
STDMETHOD() | GetWindow (HWND *)
STDMETHOD() | HasFocusIO (void)
STDMETHOD() | IsDirty (void)
STDMETHOD() | Load (LPSTREAM)
STDMETHODIMP | QueryInterface (REFIID, LPVOID *)
STDMETHOD() | ResizeBorderDW (LPCRECT prcBorder, IUnknown *punkToolbarSite, BOOL fReserved)
STDMETHOD() | Save (LPSTREAM, BOOL)
STDMETHOD() | SetSite (IUnknown *)
STDMETHOD() | ShowDW (BOOL fShow)
STDMETHODIMP_ (DWORD) Release()
STDMETHODIMP_ (DWORD) AddRef()
STDMETHOD() | TranslateAcceleratorIO (LPMSG)
STDMETHOD() | UIActivateIO (BOOL, LPMSG)

Protected Attributes

DWORD m_ObjRefCount

Private Member Functions

void | FocusChange (BOOL)
LRESULT | OnCommand (WPARAM wParam, LPARAM lParam)
LRESULT | OnKillFocus (void)
LRESULT | OnPaint (void)
LRESULT | OnSetFocus (void)
BOOL | RegisterAndCreateWindow (void)

Static Private Member Functions

static LRESULT CALLBACK | WndProc (HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam)

Private Attributes

BOOL m_bFocus
DWORD m_dwBandID
DWORD m_dwViewMode
HWND | m_hWnd
HWND | m_hwndParent
IInputObjectSite * | m_pSite

Detailed Description

Definition at line 34 of file CommBand.h.

Constructor & Destructor Documentation

CCommBand::CCommBand ( )

Definition at line 32 of file CommBand.Cpp.

{
m_pSite = NULL;

m_hWnd = NULL;
m_hwndParent = NULL;

m_bFocus = FALSE;

m_dwViewMode = 0;
m_dwBandID = 0;

m_ObjRefCount = 1;
g_DllRefCount++;
}

CCommBand::~CCommBand ( )

Definition at line 54 of file CommBand.Cpp.

{
//this should have been freed in a call to SetSite(NULL), but just to be safe
if(m_pSite)
   {
   m_pSite->Release();
   m_pSite = NULL;
   }

g_DllRefCount--;
}

Member Function Documentation

STDMETHODIMP CCommBand::CloseDW ( DWORD dwReserved )

Definition at line 238 of file CommBand.Cpp.

{
ShowDW(FALSE);

if(IsWindow(m_hWnd))
   DestroyWindow(m_hWnd);

m_hWnd = NULL;

return S_OK;
}

STDMETHODIMP CCommBand::ContextSensitiveHelp ( BOOL fEnterMode )

Definition at line 197 of file CommBand.Cpp.

{
return E_NOTIMPL;
}

void CCommBand::FocusChange ( BOOL bFocus ) [private]

Definition at line 597 of file CommBand.Cpp.

{
m_bFocus = bFocus;

//inform the input object site that the focus has changed
if(m_pSite)
   {
   m_pSite->OnFocusChangeIS((IDockingWindow*)this, bFocus);
   }
}

STDMETHODIMP CCommBand::GetBandInfo | ( | DWORD | dwBandID,
 |  | DWORD | dwViewMode,
 |  | DESKBANDINFO * | pdbi
 | ) |  |

Definition at line 394 of file CommBand.Cpp.

{
if(pdbi)
   {
   m_dwBandID = dwBandID;
   m_dwViewMode = dwViewMode;

   if(pdbi->dwMask & DBIM_MINSIZE)
      {
      pdbi->ptMinSize.x = 0;
      pdbi->ptMinSize.y = 30;
      }

   if(pdbi->dwMask & DBIM_MAXSIZE)
      {
      pdbi->ptMaxSize.x = -1;
      pdbi->ptMaxSize.y = 30;
      }

   if(pdbi->dwMask & DBIM_INTEGRAL)
      {
      pdbi->ptIntegral.x = 1;
      pdbi->ptIntegral.y = 1;
      }

   if(pdbi->dwMask & DBIM_ACTUAL)
      {
      pdbi->ptActual.x = 0;
      pdbi->ptActual.y = 0;
      }

   if(pdbi->dwMask & DBIM_TITLE)
      {
      lstrcpyW(pdbi->wszTitle, L"");
      }

   if(pdbi->dwMask & DBIM_MODEFLAGS)
      {
      pdbi->dwModeFlags = DBIMF_NORMAL;
      }

   if(pdbi->dwMask & DBIM_BKCOLOR)
      {
      //Use the default background color by removing this flag.
      pdbi->dwMask &= ~DBIM_BKCOLOR;
      }

   return S_OK;
   }

return E_INVALIDARG;
}

STDMETHODIMP CCommBand::GetClassID ( LPCLSID pClassID )

Definition at line 462 of file CommBand.Cpp.

{
*pClassID = CLSID_SampleCommBand;

return S_OK;
}

STDMETHODIMP CCommBand::GetSite | ( | REFIID | riid,
 |  | LPVOID * | ppvReturn
 | ) |  |

Definition at line 373 of file CommBand.Cpp.

{
*ppvReturn = NULL;

if(m_pSite)
   return m_pSite->QueryInterface(riid, ppvReturn);

return E_FAIL;
}

STDMETHODIMP CCommBand::GetSizeMax ( ULARGE_INTEGER * pul )

Definition at line 508 of file CommBand.Cpp.

{
return E_NOTIMPL;
}

STDMETHODIMP CCommBand::GetWindow ( HWND * phWnd )

Definition at line 184 of file CommBand.Cpp.

{
*phWnd = m_hWnd;

return S_OK;
}

STDMETHODIMP CCommBand::HasFocusIO ( void )

Definition at line 294 of file CommBand.Cpp.

{
if(m_bFocus)
   return S_OK;

return S_FALSE;
}

STDMETHODIMP CCommBand::IsDirty ( void )

Definition at line 475 of file CommBand.Cpp.

{
return S_FALSE;
}

STDMETHODIMP CCommBand::Load ( LPSTREAM pStream )

Definition at line 486 of file CommBand.Cpp.

{
return S_OK;
}

LRESULT CCommBand::OnCommand | ( | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private]

Definition at line 586 of file CommBand.Cpp.

{
return 0;
}

LRESULT CCommBand::OnKillFocus ( void ) [private]

Definition at line 627 of file CommBand.Cpp.

{
FocusChange(FALSE);

return 0;
}

LRESULT CCommBand::OnPaint ( void ) [private]

Definition at line 563 of file CommBand.Cpp.

{
PAINTSTRUCT ps;
RECT        rc;

BeginPaint(m_hWnd, &ps);

GetClientRect(m_hWnd, &rc);
SetTextColor(ps.hdc, RGB(0, 0, 0));
SetBkMode(ps.hdc, TRANSPARENT);
DrawText(ps.hdc, TEXT("Sample Comm Band"), -1, &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER);

EndPaint(m_hWnd, &ps);

return 0;
}

LRESULT CCommBand::OnSetFocus ( void ) [private]

Definition at line 614 of file CommBand.Cpp.

{
FocusChange(TRUE);

return 0;
}

STDMETHODIMP CCommBand::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppReturn
 | ) |  |

Definition at line 77 of file CommBand.Cpp.

{
*ppReturn = NULL;

//IUnknown
if(IsEqualIID(riid, IID_IUnknown))
   {
   *ppReturn = this;
   }

//IOleWindow
else if(IsEqualIID(riid, IID_IOleWindow))
   {
   *ppReturn = (IOleWindow*)this;
   }

//IDockingWindow
else if(IsEqualIID(riid, IID_IDockingWindow))
   {
   *ppReturn = (IDockingWindow*)this;
   }

//IInputObject
else if(IsEqualIID(riid, IID_IInputObject))
   {
   *ppReturn = (IInputObject*)this;
   }

//IObjectWithSite
else if(IsEqualIID(riid, IID_IObjectWithSite))
   {
   *ppReturn = (IObjectWithSite*)this;
   }

//IDeskBand
else if(IsEqualIID(riid, IID_IDeskBand))
   {
   *ppReturn = (IDeskBand*)this;
   }

//IPersist
else if(IsEqualIID(riid, IID_IPersist))
   {
   *ppReturn = (IPersist*)this;
   }

//IPersistStream
else if(IsEqualIID(riid, IID_IPersistStream))
   {
   *ppReturn = (IPersistStream*)this;
   }

//IDocHostUIHandler
else if(IsEqualIID(riid, IID_IDocHostUIHandler))
   {
   MessageBeep(MB_OK);
   }

if(*ppReturn)
   {
   (*(LPUNKNOWN*)ppReturn)->AddRef();
   return S_OK;
   }

return E_NOINTERFACE;
}

BOOL CCommBand::RegisterAndCreateWindow ( void ) [private]

Definition at line 640 of file CommBand.Cpp.

{
//If the window doesn't exist yet, create it now.
if(!m_hWnd)
   {
   //Can't create a child window without a parent.
   if(!m_hwndParent)
      {
      return FALSE;
      }

   //If the window class has not been registered, then do so.
   WNDCLASS wc;
   if(!GetClassInfo(g_hInst, CB_CLASS_NAME, &wc))
      {
      ZeroMemory(&wc, sizeof(wc));
      wc.style          = CS_HREDRAW | CS_VREDRAW | CS_GLOBALCLASS;
      wc.lpfnWndProc    = (WNDPROC)WndProc;
      wc.cbClsExtra     = 0;
      wc.cbWndExtra     = 0;
      wc.hInstance      = g_hInst;
      wc.hIcon          = NULL;
      wc.hCursor        = LoadCursor(NULL, IDC_ARROW);
      wc.hbrBackground  = (HBRUSH)CreateSolidBrush(RGB(0, 192, 0));
      wc.lpszMenuName   = NULL;
      wc.lpszClassName  = CB_CLASS_NAME;

      if(!RegisterClass(&wc))
         {
         //If RegisterClass fails, CreateWindow below will fail.
         }
      }

   RECT  rc;

   GetClientRect(m_hwndParent, &rc);

   //Create the window. The WndProc will set m_hWnd.
   CreateWindowEx(   0,
                     CB_CLASS_NAME,
                     NULL,
                     WS_CHILD | WS_CLIPSIBLINGS | WS_BORDER,
                     rc.left,
                     rc.top,
                     rc.right - rc.left,
                     rc.bottom - rc.top,
                     m_hwndParent,
                     NULL,
                     g_hInst,
                     (LPVOID)this);

   }

return (NULL != m_hWnd);
}

STDMETHODIMP CCommBand::ResizeBorderDW | ( | LPCRECT | prcBorder,
 |  | IUnknown * | punkToolbarSite,
 |  | BOOL | fReserved
 | ) |  |

Definition at line 256 of file CommBand.Cpp.

{
/*
This method is never called for Band Objects.
*/
return E_NOTIMPL;
}

STDMETHODIMP CCommBand::Save | ( | LPSTREAM | pStream,
 |  | BOOL | fClearDirty
 | ) |  |

Definition at line 497 of file CommBand.Cpp.

{
return S_OK;
}

STDMETHODIMP CCommBand::SetSite ( IUnknown * punkSite )

Definition at line 326 of file CommBand.Cpp.

{
//If a site is being held, release it.
if(m_pSite)
   {
   m_pSite->Release();
   m_pSite = NULL;
   }

//If punkSite is not NULL, a new site is being set.
if(punkSite)
   {
   //Get the parent window.
   IOleWindow  *pOleWindow;

   m_hwndParent = NULL;

   if(SUCCEEDED(punkSite->QueryInterface(IID_IOleWindow, (LPVOID*)&pOleWindow)))
      {
      pOleWindow->GetWindow(&m_hwndParent);
      pOleWindow->Release();
      }

   if(!m_hwndParent)
      return E_FAIL;

   if(!RegisterAndCreateWindow())
      return E_FAIL;

   //Get and keep the IInputObjectSite pointer.
   if(SUCCEEDED(punkSite->QueryInterface(IID_IInputObjectSite, (LPVOID*)&m_pSite)))
      {
      return S_OK;
      }

   return E_FAIL;
   }

return S_OK;
}

STDMETHODIMP CCommBand::ShowDW ( BOOL fShow )

Definition at line 213 of file CommBand.Cpp.

{
if(m_hWnd)
   {
   if(fShow)
      {
      //show our window
      ShowWindow(m_hWnd, SW_SHOW);
      }
   else
      {
      //hide our window
      ShowWindow(m_hWnd, SW_HIDE);
      }
   }

return S_OK;
}

CCommBand::STDMETHODIMP_ ( DWORD )
CCommBand::STDMETHODIMP_ ( DWORD )
STDMETHODIMP CCommBand::TranslateAcceleratorIO ( LPMSG pMsg )

Definition at line 310 of file CommBand.Cpp.

{
return S_FALSE;
}

STDMETHODIMP CCommBand::UIActivateIO | ( | BOOL | fActivate,
 |  | LPMSG | pMsg
 | ) |  |

Definition at line 277 of file CommBand.Cpp.

{
if(fActivate)
   SetFocus(m_hWnd);

return S_OK;
}

LRESULT CALLBACK CCommBand::WndProc | ( | HWND | hWnd,
 |  | UINT | uMessage,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static, private]

Definition at line 524 of file CommBand.Cpp.

{
CCommBand  *pThis = (CCommBand*)GetWindowLongPtr(hWnd, GWLP_USERDATA);

switch (uMessage)
   {
   case WM_NCCREATE:
      {
      LPCREATESTRUCT lpcs = (LPCREATESTRUCT)lParam;
      pThis = (CCommBand*)(lpcs->lpCreateParams);
      SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)pThis);

      //set the window handle
      pThis->m_hWnd = hWnd;
      }
      break;

   case WM_PAINT:
      return pThis->OnPaint();

   case WM_COMMAND:
      return pThis->OnCommand(wParam, lParam);

   case WM_SETFOCUS:
      return pThis->OnSetFocus();

   case WM_KILLFOCUS:
      return pThis->OnKillFocus();
   }

return DefWindowProc(hWnd, uMessage, wParam, lParam);
}

Member Data Documentation

BOOL CCommBand::m_bFocus [private]

Definition at line 80 of file CommBand.h.

DWORD CCommBand::m_dwBandID [private]

Definition at line 84 of file CommBand.h.

DWORD CCommBand::m_dwViewMode [private]

Definition at line 83 of file CommBand.h.

HWND CCommBand::m_hWnd [private]

Definition at line 82 of file CommBand.h.

HWND CCommBand::m_hwndParent [private]

Definition at line 81 of file CommBand.h.

DWORD CCommBand::m_ObjRefCount [protected]

Definition at line 40 of file CommBand.h.

IInputObjectSite* CCommBand::m_pSite [private]

Definition at line 85 of file CommBand.h.

The documentation for this class was generated from the following files:
  • WinUI/Shell/BandObjs/CommBand.h
  • WinUI/Shell/BandObjs/CommBand.Cpp
Generated on Wed Nov 13 2024 16:55:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCompartmentMonitor Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CCompartmentMonitor Class Reference

#include "monitor.h"

List of all members.

Public Member Functions

CCompartmentMonitor (void)
virtual | ~CCompartmentMonitor ()
HRESULT | GetStatus (BOOL *pfStatus)
HRESULT | Initialize (const GUID *pguidCompartment, PCOMPARTMENTMONITORPROC pCallback, LPARAM lParam)
STDMETHODIMP | OnChange (REFGUID rguid)
STDMETHODIMP | QueryInterface (REFIID riid, void **ppvObj)
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP_ (ULONG) Release(void)
HRESULT | Uninitialize (void)

Private Attributes

DWORD m_dwCookie
DWORD m_dwRef
GUID | m_guidCompartment
LPARAM | m_lParam
PCOMPARTMENTMONITORPROC m_pCallback
ITfCompartment * | m_pCompartment

Detailed Description

Definition at line 37 of file monitor.h.

Constructor & Destructor Documentation

CCompartmentMonitor::CCompartmentMonitor ( void )

Definition at line 34 of file monitor.cpp.

{
    m_dwRef = 1;
    m_dwCookie = 0;
    m_pCompartment = NULL;
    m_guidCompartment = GUID_NULL;
    m_pCallback = NULL;
}

CCompartmentMonitor::~CCompartmentMonitor ( ) [virtual]

Definition at line 49 of file monitor.cpp.

{
    Uninitialize();
}

Member Function Documentation

HRESULT CCompartmentMonitor::GetStatus ( BOOL * pfStatus )

Definition at line 253 of file monitor.cpp.

{
    if(IsBadWritePtr(pfEnabled, sizeof(BOOL)))
    {
        return E_INVALIDARG;
    }

    if(!m_pCompartment)
    {
        return E_UNEXPECTED;
    }

    HRESULT hr;
    VARIANT var;

    VariantInit(&var);
    hr = m_pCompartment->GetValue(&var);
    if(S_OK == hr)
    {
        switch(var.vt)
        {
        case VT_I4:
            *pfEnabled = var.lVal;
            break;
        }

        VariantClear(&var);
    }
    else
    {
        //this usually means the text service is not installed
        return E_UNEXPECTED;
    }

    return S_OK;
}

HRESULT CCompartmentMonitor::Initialize | ( | const GUID * | pguidCompartment,
 |  | PCOMPARTMENTMONITORPROC | pCallback,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 60 of file monitor.cpp.

{
    if(!IsEqualGUID(m_guidCompartment, GUID_NULL))
    {
        //Initialize() has already been called
        return E_UNEXPECTED;
    }

    m_guidCompartment = *pguidCompartment;
    m_pCallback = pCallback;
    m_lParam = lParam;

    HRESULT         hr;
    ITfThreadMgr    *pThreadMgr;

    //create a thread manager object
    hr = CoCreateInstance(CLSID_TF_ThreadMgr,
        NULL,
        CLSCTX_INPROC_SERVER,
        IID_ITfThreadMgr,
        (void**)&pThreadMgr);

    if(SUCCEEDED(hr))
    {
        ITfCompartmentMgr   *pCompMgr;

        //get the global compartment manager
        hr = pThreadMgr->GetGlobalCompartment(&pCompMgr);
        if(SUCCEEDED(hr))
        {
            //get the Speech UI compartment
            hr = pCompMgr->GetCompartment(m_guidCompartment,
                &m_pCompartment);
            if(SUCCEEDED(hr))
            {
                ITfSource   *pSource;

                //install the advise sink
                hr = m_pCompartment->QueryInterface(IID_ITfSource,
                    (LPVOID*)&pSource);
                if(SUCCEEDED(hr))
                {
                    hr = pSource->AdviseSink(IID_ITfCompartmentEventSink,
                        (ITfCompartmentEventSink*)this,
                        &m_dwCookie);
                }

                //if something went wrong, release the member interface
                if(FAILED(hr))
                {
                    m_pCompartment->Release();
                    m_pCompartment = NULL;
                }
            }

            //release the compartment manager
            pCompMgr->Release();
        }

        //release the thread manager
        pThreadMgr->Release();
    }

    return hr;
}

STDAPI CCompartmentMonitor::OnChange ( REFGUID rguid )

Definition at line 229 of file monitor.cpp.

{
    HRESULT hr = S_OK;

    if(IsEqualGUID(rguid, m_guidCompartment))
    {
        GUID guid = m_guidCompartment;
        BOOL fStatus;

        GetStatus(&fStatus);

        //notify the status of this compartment has changed
        hr = (*m_pCallback)(&guid, fStatus, m_lParam);
    }

    return hr;
}

STDAPI CCompartmentMonitor::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppvObj
 | ) |  |

Definition at line 170 of file monitor.cpp.

{
    *ppvObj = NULL;

    if (IsEqualIID(riid, IID_IUnknown) ||
        IsEqualIID(riid, IID_ITfCompartmentEventSink))
    {
        *ppvObj = (ITfCompartmentEventSink*)this;
    }

    if (*ppvObj)
    {
        AddRef();
        return S_OK;
    }

    return E_NOINTERFACE;
}

CCompartmentMonitor::STDMETHODIMP_ ( ULONG )
CCompartmentMonitor::STDMETHODIMP_ ( ULONG )
HRESULT CCompartmentMonitor::Uninitialize ( void )

Definition at line 134 of file monitor.cpp.

{
    HRESULT     hr = S_OK;

    if(m_pCompartment)
    {
        ITfSource   *pSource;

        hr = m_pCompartment->QueryInterface(IID_ITfSource, (void **)&pSource);

        if(SUCCEEDED(hr))
        {
            hr = pSource->UnadviseSink(m_dwCookie);

            pSource->Release();
        }

        m_pCompartment->Release();
        m_pCompartment = NULL;
    }

    m_guidCompartment = GUID_NULL;

    return hr;
}

Member Data Documentation

DWORD CCompartmentMonitor::m_dwCookie [private]

Definition at line 66 of file monitor.h.

DWORD CCompartmentMonitor::m_dwRef [private]

Definition at line 65 of file monitor.h.

GUID CCompartmentMonitor::m_guidCompartment [private]

Definition at line 68 of file monitor.h.

LPARAM CCompartmentMonitor::m_lParam [private]

Definition at line 70 of file monitor.h.

PCOMPARTMENTMONITORPROC CCompartmentMonitor::m_pCallback [private]

Definition at line 69 of file monitor.h.

ITfCompartment* CCompartmentMonitor::m_pCompartment [private]

Definition at line 67 of file monitor.h.

The documentation for this class was generated from the following files:
  • WinUI/tsfcompart/monitor.h
  • WinUI/tsfcompart/monitor.cpp
Generated on Wed Nov 13 2024 16:55:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCompImportDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes

CCompImportDlg Class Reference

#include "CompImportDlg.h"

List of all members.

Public Types

enum | { IDD = IDD_IMPORT_COMPONENT }

Public Member Functions

CCompImportDlg (CWnd *pParent=NULL)
void | set_Catalog (ICOMAdminCatalog *pCatalog)

Public Attributes

CComboBox | m_cboApplications
CEdit | m_edtID
CStatic | m_lblComponentDesc

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
afx_msg void | OnClose ()
afx_msg void | OnCLSID ()
virtual BOOL | OnInitDialog ()
virtual void | OnOK ()
afx_msg void | OnProgID ()

Protected Attributes

HICON | m_hIcon

Private Member Functions

void | LoadAppCombo ()
void | ReleaseCatalog ()

Private Attributes

int | m_nImportType
ICOMAdminCatalog * | m_pCatalog

Detailed Description

Definition at line 30 of file CompImportDlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 39 of file CompImportDlg.h.

{ IDD = IDD_IMPORT_COMPONENT };

Constructor & Destructor Documentation

CCompImportDlg::CCompImportDlg ( CWnd * pParent = NULL )

Definition at line 40 of file CompImportDlg.Cpp.

  : CDialog(CCompImportDlg::IDD, pParent)
{
  //{{AFX_DATA_INIT(CCompImportDlg)
    // NOTE: the ClassWizard will add member initialization here
  //}}AFX_DATA_INIT

  // Load the dialogs icon resource
  m_hIcon = AfxGetApp()->LoadIcon(IDI_IMPORT);

  // Initialize the members
  m_pCatalog = NULL;
  m_nImportType = IMPORT_TYPE_UNDEFINED;
}

Member Function Documentation

void CCompImportDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 56 of file CompImportDlg.Cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CCompImportDlg)
  DDX_Control(pDX, IDC_EDIT_COMPONENT, m_edtID);
  DDX_Control(pDX, IDC_LABEL_COMPONENT, m_lblComponentDesc);
  DDX_Control(pDX, IDC_COMBO_APPLICATION, m_cboApplications);
  //}}AFX_DATA_MAP
}

void CCompImportDlg::LoadAppCombo ( ) [private]

Definition at line 177 of file CompImportDlg.Cpp.

{
  // Continue only if we have a valid Catalog pointer
  if (NULL == m_pCatalog)
  {
    MessageBox("Invalid Catalog reference.\n\nNo processing will be performed.\n\nPress OK to continue.",
          "Error",
          (MB_OK | MB_ICONERROR));
    return;
  }

  _bstr_t       bstrAppCollection = "Applications";
  ICatalogCollection* pAppCollection = NULL;

  // Attempt to get a reference to the Catalog's "Application" collection
  HRESULT hr = m_pCatalog->GetCollection(bstrAppCollection,
                      (IDispatch**) &pAppCollection);
  if SUCCEEDED(hr)
  {
    // Attempt to populate the collection
    hr = pAppCollection->Populate();
    if SUCCEEDED(hr)
    {
      // Determine the number of items in the current collection
      long lCount = 0;
      hr = pAppCollection->get_Count(&lCount);
      if SUCCEEDED(hr)
      {
        _variant_t    vtItemName;
        ICatalogObject* pCatalogObject = NULL;

        // Enumerate through the objects in the current collection and
        //  populate the combo box
        for (long lIndex = 0; lIndex < lCount; lIndex++)
        {
          hr = pAppCollection->get_Item(lIndex,
                          (IDispatch**) &pCatalogObject);
          if SUCCEEDED(hr)
          {
            hr = pCatalogObject->get_Name(&vtItemName);
            if SUCCEEDED(hr)
              m_cboApplications.AddString(_bstr_t(vtItemName));

            pCatalogObject->Release();
          }
          else
            MessageBox("Error when attempting to get the current items name.\n\nPress OK to continue.",
                  "Error",
                  (MB_OK | MB_ICONERROR));
        }
      }
      else
        MessageBox("Failed to successfully determine the number of items in the Applications collection.\n\nNo processing will be performed.\n\nPress OK to continue.",
              "Error",
              (MB_OK | MB_ICONERROR));
    }
    else
      MessageBox("Failed to successfully populate the Applications collection.\n\nNo processing will be performed.\n\nPress OK to continue.",
            "Error",
            (MB_OK | MB_ICONERROR));
  }
  else
    MessageBox("Failed to get a reference to the Applications collection.\n\nNo processing will be performed.\n\nPress OK to continue.",
          "Error",
          (MB_OK | MB_ICONERROR));
}

void CCompImportDlg::OnClose ( ) [protected]

Definition at line 87 of file CompImportDlg.Cpp.

{
  // Release the reference to the Catalog object if needed
  ReleaseCatalog();

  CDialog::OnClose();
}

void CCompImportDlg::OnCLSID ( ) [protected]

Definition at line 161 of file CompImportDlg.Cpp.

{
  // Set the import type....
  m_nImportType = IMPORT_TYPE_CLSID;
  //... and set the description to match the selection
  m_lblComponentDesc.SetWindowText("CLSID:");
}

BOOL CCompImportDlg::OnInitDialog ( ) [protected, virtual]

Definition at line 140 of file CompImportDlg.Cpp.

{
  CDialog::OnInitDialog();

  // Set the dialogs icon resources
  SetIcon(m_hIcon, true);     // 32x32 icon
  SetIcon(m_hIcon, false);    // 16x16 icon

  // Select and set default export type
  CheckRadioButton(IDC_RADIO_PROG_ID, IDC_RADIO_CLSID, IDC_RADIO_PROG_ID);

  // Set the import type and description to match the current/default selection
  OnProgID();

  // Load the available applications
  LoadAppCombo();

  return TRUE;  // return TRUE unless you set the focus to a control
                // EXCEPTION: OCX Property Pages should return FALSE
}

void CCompImportDlg::OnOK ( ) [protected, virtual]

Definition at line 102 of file CompImportDlg.Cpp.

{
  // Continue only if we have a valid Catalog pointer
  if (NULL != m_pCatalog)
  {
    // Extract the method parameters from the UI
    int nAppNameSize = m_cboApplications.GetWindowTextLength() + 1;
    char* pAppNameBuf = new char[nAppNameSize];
    m_cboApplications.GetWindowText(pAppNameBuf, nAppNameSize);
    _bstr_t bstrAppName = pAppNameBuf;
    delete [] pAppNameBuf;

    int nIDSize = m_edtID.GetWindowTextLength() + 1;
    char* pComponentNameBuf = new char[nIDSize];
    m_edtID.GetWindowText(pComponentNameBuf, nIDSize);
    _bstr_t bstrID = pComponentNameBuf;
    delete [] pComponentNameBuf;

    // Attempt to invoke the method
    HRESULT hr = m_pCatalog->ImportComponent(bstrAppName,
                          bstrID);
    // Report errors, if any
    if FAILED(hr)
      MessageBox("Failed to export the specified component.\n\nPress OK to continue.",
            "Error",
            (MB_OK | MB_ICONERROR));
  }
  else
    MessageBox("Invalid Catalog reference.\n\nNo processing will be performed.\n\nPress OK to continue.",
          "Error",
          (MB_OK | MB_ICONERROR));

  // Release the catalog reference
  ReleaseCatalog();

  CDialog::OnOK();
}

void CCompImportDlg::OnProgID ( ) [protected]

Definition at line 169 of file CompImportDlg.Cpp.

{
  // Set the import type....
  m_nImportType = IMPORT_TYPE_PROGID;
  //... and set the description to match the selection
  m_lblComponentDesc.SetWindowText("ProgID:");
}

void CCompImportDlg::ReleaseCatalog ( ) [private]

Definition at line 95 of file CompImportDlg.Cpp.

{
  // Release the reference to the Catalog object if needed
  if (NULL != m_pCatalog)
    m_pCatalog->Release();
}

void CCompImportDlg::set_Catalog ( ICOMAdminCatalog * pCatalog )

Definition at line 78 of file CompImportDlg.Cpp.

{
  // Only can have one Catalog object reference... release all prior references before assignment
  ReleaseCatalog();

  // Assign the new Catalog reference
  m_pCatalog = pCatalog;
}

Member Data Documentation

CComboBox CCompImportDlg::m_cboApplications

Definition at line 42 of file CompImportDlg.h.

CEdit CCompImportDlg::m_edtID

Definition at line 40 of file CompImportDlg.h.

HICON CCompImportDlg::m_hIcon [protected]

Definition at line 55 of file CompImportDlg.h.

CStatic CCompImportDlg::m_lblComponentDesc

Definition at line 41 of file CompImportDlg.h.

int CCompImportDlg::m_nImportType [private]

Definition at line 68 of file CompImportDlg.h.

ICOMAdminCatalog* CCompImportDlg::m_pCatalog [private]

Definition at line 70 of file CompImportDlg.h.

The documentation for this class was generated from the following files:
  • Com/Administration/Explore.VC/CompImportDlg.h
  • Com/Administration/Explore.VC/CompImportDlg.Cpp
Generated on Wed Nov 13 2024 16:55:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCompInstallDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes

CCompInstallDlg Class Reference

#include "CompInstallDlg.h"

List of all members.

Public Types

enum | { IDD = IDD_INSTALL_COMPONENT }

Public Member Functions

CCompInstallDlg (CWnd *pParent=NULL)
void | set_Catalog (ICOMAdminCatalog *pCatalog)

Public Attributes

CComboBox | m_cboApplications
CEdit | m_edtComponent
CEdit | m_edtProxyStub
CEdit | m_edtTypeLib

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
afx_msg void | OnClose ()
afx_msg void | OnComponentSearch ()
virtual BOOL | OnInitDialog ()
virtual void | OnOK ()
afx_msg void | OnProxyStubDll ()
afx_msg void | OnTypeLibrary ()

Protected Attributes

HICON | m_hIcon

Private Member Functions

void | LoadAppCombo ()
void | ReleaseCatalog ()

Private Attributes

ICOMAdminCatalog * | m_pCatalog

Detailed Description

Definition at line 29 of file CompInstallDlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 38 of file CompInstallDlg.h.

{ IDD = IDD_INSTALL_COMPONENT };

Constructor & Destructor Documentation

CCompInstallDlg::CCompInstallDlg ( CWnd * pParent = NULL )

Definition at line 35 of file CompInstallDlg.Cpp.

  : CDialog(CCompInstallDlg::IDD, pParent)
{
  //{{AFX_DATA_INIT(CCompInstallDlg)
    // NOTE: the ClassWizard will add member initialization here
  //}}AFX_DATA_INIT

  // Load the dialog's icon resource
  m_hIcon = AfxGetApp()->LoadIcon(IDI_INSTALL);

  // Initialize the members
  m_pCatalog = NULL;
}

Member Function Documentation

void CCompInstallDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 50 of file CompInstallDlg.Cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CCompInstallDlg)
  DDX_Control(pDX, IDC_COMBO_APPLICATION, m_cboApplications);
  DDX_Control(pDX, IDC_EDIT_TYPE_LIBRARY, m_edtTypeLib);
  DDX_Control(pDX, IDC_EDIT_PROXY_STUB_DLL, m_edtProxyStub);
  DDX_Control(pDX, IDC_EDIT_COMPONENT, m_edtComponent);
  //}}AFX_DATA_MAP
}

void CCompInstallDlg::LoadAppCombo ( ) [private]

Definition at line 193 of file CompInstallDlg.Cpp.

{
  // Continue only if we have a valid Catalog pointer
  if (NULL == m_pCatalog)
  {
    MessageBox("Invalid Catalog reference.\n\nNo processing will be performed.\n\nPress OK to continue.",
          "Error",
          (MB_OK | MB_ICONERROR));
    return;
  }

  _bstr_t       bstrAppCollection = "Applications";
  ICatalogCollection* pAppCollection = NULL;

  // Attempt to get a reference to the Catalog's "Application" collection
  HRESULT hr = m_pCatalog->GetCollection(bstrAppCollection,
                      (IDispatch**) &pAppCollection);
  if SUCCEEDED(hr)
  {
    // Attempt to populate the collection
    hr = pAppCollection->Populate();
    if SUCCEEDED(hr)
    {
      // Determine the number of items in the current collection
      long lCount = 0;
      hr = pAppCollection->get_Count(&lCount);
      if SUCCEEDED(hr)
      {
        _variant_t    vtItemName;
        ICatalogObject* pCatalogObject = NULL;

        // Enumerate through the objects in the current collection and
        //  populate the combo box
        for (long lIndex = 0; lIndex < lCount; lIndex++)
        {
          hr = pAppCollection->get_Item(lIndex,
                          (IDispatch**) &pCatalogObject);
          if SUCCEEDED(hr)
          {
            hr = pCatalogObject->get_Name(&vtItemName);
            if SUCCEEDED(hr)
              m_cboApplications.AddString(_bstr_t(vtItemName));

            pCatalogObject->Release();
          }
          else
            MessageBox("Error when attempting to get the current items name.\n\nPress OK to continue.",
                  "Error",
                  (MB_OK | MB_ICONERROR));
        }
      }
      else
        MessageBox("Failed to successfully determine the number of items in the Applications collection.\n\nNo processing will be performed.\n\nPress OK to continue.",
              "Error",
              (MB_OK | MB_ICONERROR));
    }
    else
      MessageBox("Failed to successfully populate the Applications collection.\n\nNo processing will be performed.\n\nPress OK to continue.",
            "Error",
            (MB_OK | MB_ICONERROR));
  }
  else
    MessageBox("Failed to get a reference to the Applications collection.\n\nNo processing will be performed.\n\nPress OK to continue.",
          "Error",
          (MB_OK | MB_ICONERROR));
}

void CCompInstallDlg::OnClose ( ) [protected]

Definition at line 83 of file CompInstallDlg.Cpp.

{
  // Release the reference to the Catalog object if needed
  ReleaseCatalog();

  CDialog::OnClose();
}

void CCompInstallDlg::OnComponentSearch ( ) [protected]

Definition at line 91 of file CompInstallDlg.Cpp.

{
  OPENFILENAME ofn;
  char pFilePath[256];
  char pFileTitle[256];

  // Setup of OPENFILENAME structure
  ofn.lStructSize = sizeof(OPENFILENAME);
    ofn.hwndOwner = m_hWnd;
    ofn.hInstance = NULL;
    ofn.lpstrFilter = "All Files (*.*)\0*.*\0\0";
    ofn.lpstrCustomFilter = (LPSTR) NULL;
    ofn.nMaxCustFilter = 0;
    ofn.nFilterIndex = 1;
    pFilePath[0] = '\0';
    ofn.lpstrFile = pFilePath;
    ofn.nMaxFile = sizeof(pFilePath);
    ofn.lpstrFileTitle = pFileTitle;
    ofn.nMaxFileTitle = sizeof(pFileTitle);
    ofn.lpstrInitialDir = NULL;
    ofn.lpstrTitle = "Select Component To Install";
    ofn.Flags = (OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST);
    ofn.lpstrDefExt = "DLL";
    ofn.nFileOffset = 0;
    ofn.nFileExtension = 0;
    ofn.lCustData = 0;

  // Invoke the file open common dialog
  GetOpenFileName(&ofn);

  // Update the value in the control
  m_edtComponent.SetWindowText(ofn.lpstrFile);
}

BOOL CCompInstallDlg::OnInitDialog ( ) [protected, virtual]

Definition at line 260 of file CompInstallDlg.Cpp.

{
  CDialog::OnInitDialog();

  // Set the dialog's icon resource
  SetIcon(m_hIcon, true);     // 32x32 icon
  SetIcon(m_hIcon, false);    // 16x16 icon

  // Load the application combo box
  LoadAppCombo();

  return TRUE;  // return TRUE unless you set the focus to a control
                // EXCEPTION: OCX Property Pages should return FALSE
}

void CCompInstallDlg::OnOK ( ) [protected, virtual]

Definition at line 275 of file CompInstallDlg.Cpp.

{
  // Continue only if we have a valid Catalog pointer
  if (NULL != m_pCatalog)
  {
    // Extract the method parameters from the UI
    int nAppNameSize = m_cboApplications.GetWindowTextLength() + 1;
    char* pAppNameBuf = new char[nAppNameSize];
    m_cboApplications.GetWindowText(pAppNameBuf, nAppNameSize);
    _bstr_t bstrAppName = pAppNameBuf;
    delete [] pAppNameBuf;

    int nComponentNameSize = m_edtComponent.GetWindowTextLength() + 1;
    char* pComponentNameBuf = new char[nComponentNameSize];
    m_edtComponent.GetWindowText(pComponentNameBuf, nComponentNameSize);
    _bstr_t bstrComponentName = pComponentNameBuf;
    delete [] pComponentNameBuf;

    int nTLBNameSize = m_edtTypeLib.GetWindowTextLength() + 1;
    char* pTLBNameBuf = new char[nTLBNameSize];
    m_edtTypeLib.GetWindowText(pTLBNameBuf, nTLBNameSize);
    _bstr_t bstrTLB = pTLBNameBuf;
    delete [] pTLBNameBuf;

    int nProxyStubNameSize = m_edtProxyStub.GetWindowTextLength() + 1;
    char* pProxyStubNameBuf = new char[nProxyStubNameSize];
    m_edtProxyStub.GetWindowText(pProxyStubNameBuf, nProxyStubNameSize);
    _bstr_t bstrProxyStub = pProxyStubNameBuf;
    delete [] pProxyStubNameBuf;

    // Invoke the method
    HRESULT hr = m_pCatalog->InstallComponent(bstrAppName,
                          bstrComponentName,
                          bstrTLB,
                          bstrProxyStub);
    // Report errors, if any
    if FAILED(hr)
      MessageBox("Failed to install the specified component.\n\nPress OK to continue.",
            "Error",
            (MB_OK | MB_ICONERROR));
  }
  else
    MessageBox("Invalid Catalog reference.\n\nNo processing will be performed.\n\nPress OK to continue.",
          "Error",
          (MB_OK | MB_ICONERROR));

  // Release the Catalog reference
  ReleaseCatalog();

  CDialog::OnOK();
}

void CCompInstallDlg::OnProxyStubDll ( ) [protected]

Definition at line 159 of file CompInstallDlg.Cpp.

{
  OPENFILENAME ofn;
  char pFilePath[256];
  char pFileTitle[256];

  // Setup of OPENFILENAME structure
  ofn.lStructSize = sizeof(OPENFILENAME);
    ofn.hwndOwner = m_hWnd;
    ofn.hInstance = NULL;
    ofn.lpstrFilter = "All Files (*.*)\0*.*\0\0";
    ofn.lpstrCustomFilter = (LPSTR) NULL;
    ofn.nMaxCustFilter = 0;
    ofn.nFilterIndex = 1;
    pFilePath[0] = '\0';
    ofn.lpstrFile = pFilePath;
    ofn.nMaxFile = sizeof(pFilePath);
    ofn.lpstrFileTitle = pFileTitle;
    ofn.nMaxFileTitle = sizeof(pFileTitle);
    ofn.lpstrInitialDir = NULL;
    ofn.lpstrTitle = "Select Proxy/Stub To Install";
    ofn.Flags = (OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST);
    ofn.lpstrDefExt = "DLL";
    ofn.nFileOffset = 0;
    ofn.nFileExtension = 0;
    ofn.lCustData = 0;

  // Invoke the file open common dialog
  GetOpenFileName(&ofn);

  // Update the value in the control
  m_edtProxyStub.SetWindowText(ofn.lpstrFile);
}

void CCompInstallDlg::OnTypeLibrary ( ) [protected]

Definition at line 125 of file CompInstallDlg.Cpp.

{
  OPENFILENAME ofn;
  char pFilePath[256];
  char pFileTitle[256];

  // Setup of OPENFILENAME structure
  ofn.lStructSize = sizeof(OPENFILENAME);
    ofn.hwndOwner = m_hWnd;
    ofn.hInstance = NULL;
    ofn.lpstrFilter = "All Files (*.*)\0*.*\0\0";
    ofn.lpstrCustomFilter = (LPSTR) NULL;
    ofn.nMaxCustFilter = 0;
    ofn.nFilterIndex = 1;
    pFilePath[0] = '\0';
    ofn.lpstrFile = pFilePath;
    ofn.nMaxFile = sizeof(pFilePath);
    ofn.lpstrFileTitle = pFileTitle;
    ofn.nMaxFileTitle = sizeof(pFileTitle);
    ofn.lpstrInitialDir = NULL;
    ofn.lpstrTitle = "Select TypeLib To Install";
    ofn.Flags = (OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST);
    ofn.lpstrDefExt = "DLL";
    ofn.nFileOffset = 0;
    ofn.nFileExtension = 0;
    ofn.lCustData = 0;

  // Invoke the file open common dialog
  GetOpenFileName(&ofn);

  // Update the value in the control
  m_edtTypeLib.SetWindowText(ofn.lpstrFile);
}

void CCompInstallDlg::ReleaseCatalog ( ) [private]

Definition at line 327 of file CompInstallDlg.Cpp.

{
  // Release the reference to the Catalog object if needed
  if (NULL != m_pCatalog)
    m_pCatalog->Release();
}

void CCompInstallDlg::set_Catalog ( ICOMAdminCatalog * pCatalog )

Definition at line 74 of file CompInstallDlg.Cpp.

{
  // Only can have one Catalog object reference... release all prior references before assignment
  ReleaseCatalog();

  // Assign the new Catalog reference
  m_pCatalog = pCatalog;
}

Member Data Documentation

CComboBox CCompInstallDlg::m_cboApplications

Definition at line 39 of file CompInstallDlg.h.

CEdit CCompInstallDlg::m_edtComponent

Definition at line 42 of file CompInstallDlg.h.

CEdit CCompInstallDlg::m_edtProxyStub

Definition at line 41 of file CompInstallDlg.h.

CEdit CCompInstallDlg::m_edtTypeLib

Definition at line 40 of file CompInstallDlg.h.

HICON CCompInstallDlg::m_hIcon [protected]

Definition at line 55 of file CompInstallDlg.h.

ICOMAdminCatalog* CCompInstallDlg::m_pCatalog [private]

Definition at line 70 of file CompInstallDlg.h.

The documentation for this class was generated from the following files:
  • Com/Administration/Explore.VC/CompInstallDlg.h
  • Com/Administration/Explore.VC/CompInstallDlg.Cpp
Generated on Wed Nov 13 2024 16:55:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CComponent Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CComponent Class Reference

#include "comp.h"

List of all members.

Public Member Functions

CComponent (CComponentData *parent)
CComponent (CComponentData *parent)
CComponent (CComponentData *parent)
CComponent (CComponentData *pParent)
CComponent (CComponentData *parent)
CComponent (CComponentData *parent)
CComponent (CComponentData *pParent)
CComponent (CComponentData *parent)
CComponent (CComponentData *parent)
CComponent (CComponentData *parent)
CComponent (CComponentData *pParent)
CComponent (CComponentData *parent)
CComponent (CComponentData *parent)
CComponent (CComponentData *pParent)
CComponent (CComponentData *parent)
CComponent (CComponentData *parent)
CComponent (CComponentData *parent)
CComponent (CComponentData *parent)
CComponent (CComponentData *parent)
CComponent (CComponentData *pParent)
CComponent (CComponentData *pParent)
CComponent (CComponentData *pParent)
CComponent (CComponentData *pParent)
CComponent (CComponentData *pParent)
CComponent (CComponentData *pParent)
~CComponent ()
~CComponent ()
~CComponent ()
~CComponent ()
~CComponent ()
~CComponent ()
~CComponent ()
~CComponent ()
~CComponent ()
~CComponent ()
~CComponent ()
~CComponent ()
~CComponent ()
~CComponent ()
~CComponent ()
~CComponent ()
~CComponent ()
~CComponent ()
~CComponent ()
~CComponent ()
~CComponent ()
~CComponent ()
~CComponent ()
~CComponent ()
~CComponent ()
virtual HRESULT STDMETHODCALLTYPE | AddMenuItems (LPDATAOBJECT piDataObject, LPCONTEXTMENUCALLBACK piCallback, long __RPC_FAR *pInsertionAllowed)
virtual HRESULT STDMETHODCALLTYPE | AddMenuItems (LPDATAOBJECT piDataObject, LPCONTEXTMENUCALLBACK piCallback, long __RPC_FAR *pInsertionAllowed)
virtual HRESULT STDMETHODCALLTYPE | CacheHint (int nStartIndex, int nEndIndex)
virtual HRESULT STDMETHODCALLTYPE | CacheHint (int nStartIndex, int nEndIndex)
virtual HRESULT STDMETHODCALLTYPE | CacheHint (int nStartIndex, int nEndIndex)
virtual HRESULT STDMETHODCALLTYPE | Command (long lCommandID, LPDATAOBJECT piDataObject)
virtual HRESULT STDMETHODCALLTYPE | Command (long lCommandID, LPDATAOBJECT piDataObject)
virtual HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB)
HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB)
virtual HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB)
virtual HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB)
virtual HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB)
HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB)
virtual HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB)
virtual HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB)
virtual HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB)
virtual HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB)
virtual HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB)
HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB)
virtual HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB)
virtual HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB)
virtual HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB)
HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB)
virtual HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB)
virtual HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB)
virtual HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB)
virtual HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB)
HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB)
virtual HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB)
HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB)
HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB)
HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB)
virtual HRESULT STDMETHODCALLTYPE | ControlbarNotify (MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)
HRESULT STDMETHODCALLTYPE | ControlbarNotify (MMC_NOTIFY_TYPE MmcEvent, LPARAM nArg, LPARAM lParam)
virtual HRESULT STDMETHODCALLTYPE | ControlbarNotify (MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)
virtual HRESULT STDMETHODCALLTYPE | ControlbarNotify (MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)
virtual HRESULT STDMETHODCALLTYPE | CreatePropertyPages (LPPROPERTYSHEETCALLBACK lpProvider, LONG_PTR handle, LPDATAOBJECT lpIDataObject)
virtual HRESULT STDMETHODCALLTYPE | CreatePropertyPages (LPPROPERTYSHEETCALLBACK lpProvider, LONG_PTR handle, LPDATAOBJECT lpIDataObject)
virtual HRESULT STDMETHODCALLTYPE | CreatePropertyPages (LPPROPERTYSHEETCALLBACK lpProvider, LONG_PTR handle, LPDATAOBJECT lpIDataObject)
HRESULT STDMETHODCALLTYPE | CreatePropertyPages (LPPROPERTYSHEETCALLBACK lpProvider, LONG_PTR Handle, LPDATAOBJECT ipIDataObject)
virtual HRESULT STDMETHODCALLTYPE | CreatePropertyPages (LPPROPERTYSHEETCALLBACK lpProvider, LONG_PTR handle, LPDATAOBJECT lpIDataObject)
virtual HRESULT STDMETHODCALLTYPE | CreatePropertyPages (LPPROPERTYSHEETCALLBACK lpProvider, LONG_PTR handle, LPDATAOBJECT lpIDataObject)
HRESULT STDMETHODCALLTYPE | CreatePropertyPages (LPPROPERTYSHEETCALLBACK lpProvider, LONG_PTR Handle, LPDATAOBJECT ipIDataObject)
virtual HRESULT STDMETHODCALLTYPE | Destroy (MMC_COOKIE cookie)
virtual HRESULT STDMETHODCALLTYPE | Destroy (MMC_COOKIE cookie)
HRESULT STDMETHODCALLTYPE | Destroy (MMC_COOKIE nCookie)
virtual HRESULT STDMETHODCALLTYPE | Destroy (MMC_COOKIE cookie)
virtual HRESULT STDMETHODCALLTYPE | Destroy (MMC_COOKIE cookie)
virtual HRESULT STDMETHODCALLTYPE | Destroy (MMC_COOKIE cookie)
virtual HRESULT STDMETHODCALLTYPE | Destroy (MMC_COOKIE cookie)
HRESULT STDMETHODCALLTYPE | Destroy (MMC_COOKIE nCookie)
virtual HRESULT STDMETHODCALLTYPE | Destroy (MMC_COOKIE cookie)
virtual HRESULT STDMETHODCALLTYPE | Destroy (MMC_COOKIE cookie)
virtual HRESULT STDMETHODCALLTYPE | Destroy (MMC_COOKIE cookie)
virtual HRESULT STDMETHODCALLTYPE | Destroy (MMC_COOKIE cookie)
virtual HRESULT STDMETHODCALLTYPE | Destroy (MMC_COOKIE cookie)
HRESULT STDMETHODCALLTYPE | Destroy (MMC_COOKIE nCookie)
virtual HRESULT STDMETHODCALLTYPE | Destroy (MMC_COOKIE cookie)
virtual HRESULT STDMETHODCALLTYPE | Destroy (MMC_COOKIE cookie)
virtual HRESULT STDMETHODCALLTYPE | Destroy (MMC_COOKIE cookie)
virtual HRESULT STDMETHODCALLTYPE | Destroy (MMC_COOKIE cookie)
HRESULT STDMETHODCALLTYPE | Destroy (MMC_COOKIE nCookie)
virtual HRESULT STDMETHODCALLTYPE | Destroy (MMC_COOKIE cookie)
HRESULT STDMETHODCALLTYPE | Destroy (MMC_COOKIE nCookie)
virtual HRESULT STDMETHODCALLTYPE | Destroy (MMC_COOKIE cookie)
HRESULT STDMETHODCALLTYPE | Destroy (MMC_COOKIE nCookie)
HRESULT STDMETHODCALLTYPE | Destroy (MMC_COOKIE nCookie)
HRESULT STDMETHODCALLTYPE | Destroy (MMC_COOKIE nCookie)
void | DisplayMessageBox (CDelegationBase *base)
virtual HRESULT STDMETHODCALLTYPE | EnumTasks (IDataObject __RPC_FAR *pdo, LPOLESTR szTaskGroup, IEnumTASK __RPC_FAR *__RPC_FAR *ppEnumTASK)
virtual HRESULT STDMETHODCALLTYPE | FindItem (LPRESULTFINDINFO pFindInfo, int __RPC_FAR *pnFoundIndex)
virtual HRESULT STDMETHODCALLTYPE | FindItem (LPRESULTFINDINFO pFindInfo, int __RPC_FAR *pnFoundIndex)
virtual HRESULT STDMETHODCALLTYPE | FindItem (LPRESULTFINDINFO pFindInfo, int __RPC_FAR *pnFoundIndex)
virtual HRESULT STDMETHODCALLTYPE | GetBackground (LPOLESTR pszGroup, MMC_TASK_DISPLAY_OBJECT __RPC_FAR *pTDO)
HRESULT | GetCurrentSelections (CDataObject *pMultiSelectDataObject)
virtual HRESULT STDMETHODCALLTYPE | GetDescriptiveText (LPOLESTR pszGroup, LPOLESTR __RPC_FAR *pszDescriptiveText)
virtual HRESULT STDMETHODCALLTYPE | GetDisplayInfo (RESULTDATAITEM __RPC_FAR *pResultDataItem)
virtual HRESULT STDMETHODCALLTYPE | GetDisplayInfo (RESULTDATAITEM __RPC_FAR *pResultDataItem)
HRESULT STDMETHODCALLTYPE | GetDisplayInfo (RESULTDATAITEM __RPC_FAR *pResultDataItem)
virtual HRESULT STDMETHODCALLTYPE | GetDisplayInfo (RESULTDATAITEM __RPC_FAR *pResultDataItem)
virtual HRESULT STDMETHODCALLTYPE | GetDisplayInfo (RESULTDATAITEM __RPC_FAR *pResultDataItem)
virtual HRESULT STDMETHODCALLTYPE | GetDisplayInfo (RESULTDATAITEM __RPC_FAR *pResultDataItem)
virtual HRESULT STDMETHODCALLTYPE | GetDisplayInfo (RESULTDATAITEM __RPC_FAR *pResultDataItem)
virtual HRESULT STDMETHODCALLTYPE | GetDisplayInfo (RESULTDATAITEM __RPC_FAR *pResultDataItem)
HRESULT STDMETHODCALLTYPE | GetDisplayInfo (RESULTDATAITEM __RPC_FAR *pResultDataItem)
virtual HRESULT STDMETHODCALLTYPE | GetDisplayInfo (RESULTDATAITEM __RPC_FAR *pResultDataItem)
virtual HRESULT STDMETHODCALLTYPE | GetDisplayInfo (RESULTDATAITEM __RPC_FAR *pResultDataItem)
virtual HRESULT STDMETHODCALLTYPE | GetDisplayInfo (RESULTDATAITEM __RPC_FAR *pResultDataItem)
virtual HRESULT STDMETHODCALLTYPE | GetDisplayInfo (RESULTDATAITEM __RPC_FAR *pResultDataItem)
HRESULT STDMETHODCALLTYPE | GetDisplayInfo (RESULTDATAITEM __RPC_FAR *pResultDataItem)
virtual HRESULT STDMETHODCALLTYPE | GetDisplayInfo (RESULTDATAITEM __RPC_FAR *pResultDataItem)
virtual HRESULT STDMETHODCALLTYPE | GetDisplayInfo (RESULTDATAITEM __RPC_FAR *pResultDataItem)
virtual HRESULT STDMETHODCALLTYPE | GetDisplayInfo (RESULTDATAITEM __RPC_FAR *pResultDataItem)
HRESULT STDMETHODCALLTYPE | GetDisplayInfo (RESULTDATAITEM __RPC_FAR *pResultDataItem)
virtual HRESULT STDMETHODCALLTYPE | GetDisplayInfo (RESULTDATAITEM __RPC_FAR *pResultDataItem)
virtual HRESULT STDMETHODCALLTYPE | GetDisplayInfo (RESULTDATAITEM __RPC_FAR *pResultDataItem)
HRESULT STDMETHODCALLTYPE | GetDisplayInfo (RESULTDATAITEM __RPC_FAR *pResultDataItem)
virtual HRESULT STDMETHODCALLTYPE | GetDisplayInfo (RESULTDATAITEM __RPC_FAR *pResultDataItem)
HRESULT STDMETHODCALLTYPE | GetDisplayInfo (RESULTDATAITEM __RPC_FAR *pResultDataItem)
HRESULT STDMETHODCALLTYPE | GetDisplayInfo (RESULTDATAITEM __RPC_FAR *pResultDataItem)
HRESULT STDMETHODCALLTYPE | GetDisplayInfo (RESULTDATAITEM __RPC_FAR *pResultDataItem)
HRESULT | GetInterface (DWORD dwRequestedInterface, LONG_PTR *ppInterface)
HRESULT | GetInterface (DWORD dwRequestedInterface, LONG_PTR *ppInterface)
HRESULT | GetInterface (DWORD dwRequestedInterface, LONG_PTR *ppInterface)
HRESULT | GetInterface (DWORD dwRequestedInterface, LONG_PTR *ppInterface)
HRESULT | GetInterface (DWORD dwRequestedInterface, LONG_PTR *ppInterface)
HRESULT | GetInterface (DWORD dwRequestedInterface, LONG_PTR *ppInterface)
virtual HRESULT STDMETHODCALLTYPE | GetListPadInfo (LPOLESTR pszGroup, MMC_LISTPAD_INFO __RPC_FAR *lpListPadInfo)
LONG_PTR | GetParent ()
HRESULT STDMETHODCALLTYPE | GetProperty (LPDATAOBJECT ipDataObject, BSTR szPropertyName, PBSTR pbstrProperty)
virtual HRESULT STDMETHODCALLTYPE | GetResultViewType (MMC_COOKIE cookie, LPOLESTR __RPC_FAR *ppViewType, long __RPC_FAR *pViewOptions)
virtual HRESULT STDMETHODCALLTYPE | GetResultViewType (MMC_COOKIE cookie, LPOLESTR __RPC_FAR *ppViewType, long __RPC_FAR *pViewOptions)
HRESULT STDMETHODCALLTYPE | GetResultViewType (MMC_COOKIE nCookie, LPOLESTR __RPC_FAR *ppViewType, long __RPC_FAR *pViewOptions)
virtual HRESULT STDMETHODCALLTYPE | GetResultViewType (MMC_COOKIE cookie, LPOLESTR __RPC_FAR *ppViewType, long __RPC_FAR *pViewOptions)
virtual HRESULT STDMETHODCALLTYPE | GetResultViewType (MMC_COOKIE cookie, LPOLESTR __RPC_FAR *ppViewType, long __RPC_FAR *pViewOptions)
virtual HRESULT STDMETHODCALLTYPE | GetResultViewType (MMC_COOKIE cookie, LPOLESTR __RPC_FAR *ppViewType, long __RPC_FAR *pViewOptions)
virtual HRESULT STDMETHODCALLTYPE | GetResultViewType (MMC_COOKIE cookie, LPOLESTR __RPC_FAR *ppViewType, long __RPC_FAR *pViewOptions)
virtual HRESULT STDMETHODCALLTYPE | GetResultViewType (MMC_COOKIE cookie, LPOLESTR __RPC_FAR *ppViewType, long __RPC_FAR *pViewOptions)
HRESULT STDMETHODCALLTYPE | GetResultViewType (MMC_COOKIE nCookie, LPOLESTR __RPC_FAR *ppViewType, long __RPC_FAR *pViewOptions)
virtual HRESULT STDMETHODCALLTYPE | GetResultViewType (MMC_COOKIE cookie, LPOLESTR __RPC_FAR *ppViewType, long __RPC_FAR *pViewOptions)
virtual HRESULT STDMETHODCALLTYPE | GetResultViewType (MMC_COOKIE cookie, LPOLESTR __RPC_FAR *ppViewType, long __RPC_FAR *pViewOptions)
virtual HRESULT STDMETHODCALLTYPE | GetResultViewType (MMC_COOKIE cookie, LPOLESTR __RPC_FAR *ppViewType, long __RPC_FAR *pViewOptions)
HRESULT STDMETHODCALLTYPE | GetResultViewType (MMC_COOKIE nCookie, LPOLESTR __RPC_FAR *ppViewType, long __RPC_FAR *pViewOptions)
virtual HRESULT STDMETHODCALLTYPE | GetResultViewType (MMC_COOKIE cookie, LPOLESTR __RPC_FAR *ppViewType, long __RPC_FAR *pViewOptions)
virtual HRESULT STDMETHODCALLTYPE | GetResultViewType (MMC_COOKIE cookie, LPOLESTR __RPC_FAR *ppViewType, long __RPC_FAR *pViewOptions)
virtual HRESULT STDMETHODCALLTYPE | GetResultViewType (MMC_COOKIE cookie, LPOLESTR __RPC_FAR *ppViewType, long __RPC_FAR *pViewOptions)
virtual HRESULT STDMETHODCALLTYPE | GetResultViewType (MMC_COOKIE cookie, LPOLESTR __RPC_FAR *ppViewType, long __RPC_FAR *pViewOptions)
HRESULT STDMETHODCALLTYPE | GetResultViewType (MMC_COOKIE nCookie, LPOLESTR __RPC_FAR *ppViewType, long __RPC_FAR *pViewOptions)
virtual HRESULT STDMETHODCALLTYPE | GetResultViewType (MMC_COOKIE cookie, LPOLESTR __RPC_FAR *ppViewType, long __RPC_FAR *pViewOptions)
virtual HRESULT STDMETHODCALLTYPE | GetResultViewType (MMC_COOKIE cookie, LPOLESTR __RPC_FAR *ppViewType, long __RPC_FAR *pViewOptions)
HRESULT STDMETHODCALLTYPE | GetResultViewType (MMC_COOKIE nCookie, LPOLESTR __RPC_FAR *ppViewType, long __RPC_FAR *pViewOptions)
virtual HRESULT STDMETHODCALLTYPE | GetResultViewType (MMC_COOKIE cookie, LPOLESTR __RPC_FAR *ppViewType, long __RPC_FAR *pViewOptions)
HRESULT STDMETHODCALLTYPE | GetResultViewType (MMC_COOKIE nCookie, LPOLESTR __RPC_FAR *ppViewType, long __RPC_FAR *pViewOptions)
HRESULT STDMETHODCALLTYPE | GetResultViewType (MMC_COOKIE nCookie, LPOLESTR __RPC_FAR *ppViewType, long __RPC_FAR *pViewOptions)
HRESULT STDMETHODCALLTYPE | GetResultViewType (MMC_COOKIE nCookie, LPOLESTR __RPC_FAR *ppViewType, long __RPC_FAR *pViewOptions)
HRESULT STDMETHODCALLTYPE | GetResultViewType2 (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pRVTinfo)
HRESULT STDMETHODCALLTYPE | GetResultViewType2 (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pRVTinfo)
HRESULT STDMETHODCALLTYPE | GetResultViewType2 (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pRVTinfo)
HRESULT STDMETHODCALLTYPE | GetResultViewType2 (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pRVTinfo)
HRESULT STDMETHODCALLTYPE | GetResultViewType2 (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pRVTinfo)
HRESULT STDMETHODCALLTYPE | GetResultViewType2 (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pResultViewType)
HRESULT STDMETHODCALLTYPE | GetResultViewType2 (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pRVTinfo)
HRESULT STDMETHODCALLTYPE | GetResultViewType2 (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pRVTinfo)
LONG_PTR | GetScopeCookie ()
INT_PTR | GetScopeCookie ()
LONG_PTR | GetScopeCookie ()
virtual HRESULT STDMETHODCALLTYPE | GetTitle (LPOLESTR pszGroup, LPOLESTR __RPC_FAR *pszTitle)
IToolbar * | getToolbar ()
IToolbar * | getToolbar ()
HRESULT STDMETHODCALLTYPE | GetWatermarks (LPDATAOBJECT lpIDataObject, HBITMAP __RPC_FAR *lphWatermark, HBITMAP __RPC_FAR *lphHeader, HPALETTE __RPC_FAR *lphPalette, BOOL __RPC_FAR *bStretch)
virtual HRESULT STDMETHODCALLTYPE | GetWatermarks (LPDATAOBJECT lpIDataObject, HBITMAP __RPC_FAR *lphWatermark, HBITMAP __RPC_FAR *lphHeader, HPALETTE __RPC_FAR *lphPalette, BOOL __RPC_FAR *bStretch)
virtual HRESULT STDMETHODCALLTYPE | GetWatermarks (LPDATAOBJECT lpIDataObject, HBITMAP __RPC_FAR *lphWatermark, HBITMAP __RPC_FAR *lphHeader, HPALETTE __RPC_FAR *lphPalette, BOOL __RPC_FAR *bStretch)
virtual HRESULT STDMETHODCALLTYPE | GetWatermarks (LPDATAOBJECT lpIDataObject, HBITMAP __RPC_FAR *lphWatermark, HBITMAP __RPC_FAR *lphHeader, HPALETTE __RPC_FAR *lphPalette, BOOL __RPC_FAR *bStretch)
virtual HRESULT STDMETHODCALLTYPE | GetWatermarks (LPDATAOBJECT lpIDataObject, HBITMAP __RPC_FAR *lphWatermark, HBITMAP __RPC_FAR *lphHeader, HPALETTE __RPC_FAR *lphPalette, BOOL __RPC_FAR *bStretch)
HRESULT STDMETHODCALLTYPE | GetWatermarks (LPDATAOBJECT lpIDataObject, HBITMAP __RPC_FAR *lphWatermark, HBITMAP __RPC_FAR *lphHeader, HPALETTE __RPC_FAR *lphPalette, BOOL __RPC_FAR *bStretch)
virtual HRESULT STDMETHODCALLTYPE | GetWatermarks (LPDATAOBJECT lpIDataObject, HBITMAP __RPC_FAR *lphWatermark, HBITMAP __RPC_FAR *lphHeader, HPALETTE __RPC_FAR *lphPalette, BOOL __RPC_FAR *bStretch)
virtual HRESULT STDMETHODCALLTYPE | Initialize (LPCONSOLE lpConsole)
HRESULT STDMETHODCALLTYPE | Initialize (LPCONSOLE ipConsole)
virtual HRESULT STDMETHODCALLTYPE | Initialize (LPCONSOLE lpConsole)
virtual HRESULT STDMETHODCALLTYPE | Initialize (LPCONSOLE lpConsole)
HRESULT STDMETHODCALLTYPE | Initialize (LPCONSOLE ipConsole)
virtual HRESULT STDMETHODCALLTYPE | Initialize (LPCONSOLE lpConsole)
virtual HRESULT STDMETHODCALLTYPE | Initialize (LPCONSOLE lpConsole)
virtual HRESULT STDMETHODCALLTYPE | Initialize (LPCONSOLE lpConsole)
virtual HRESULT STDMETHODCALLTYPE | Initialize (LPCONSOLE lpConsole)
HRESULT STDMETHODCALLTYPE | Initialize (LPCONSOLE ipConsole)
virtual HRESULT STDMETHODCALLTYPE | Initialize (LPCONSOLE lpConsole)
virtual HRESULT STDMETHODCALLTYPE | Initialize (LPCONSOLE lpConsole)
virtual HRESULT STDMETHODCALLTYPE | Initialize (LPCONSOLE lpConsole)
virtual HRESULT STDMETHODCALLTYPE | Initialize (LPCONSOLE lpConsole)
virtual HRESULT STDMETHODCALLTYPE | Initialize (LPCONSOLE lpConsole)
HRESULT STDMETHODCALLTYPE | Initialize (LPCONSOLE ipConsole)
HRESULT STDMETHODCALLTYPE | Initialize (LPCONSOLE ipConsole)
virtual HRESULT STDMETHODCALLTYPE | Initialize (LPCONSOLE lpConsole)
virtual HRESULT STDMETHODCALLTYPE | Initialize (LPCONSOLE lpConsole)
HRESULT STDMETHODCALLTYPE | Initialize (LPCONSOLE ipConsole)
virtual HRESULT STDMETHODCALLTYPE | Initialize (LPCONSOLE lpConsole)
HRESULT STDMETHODCALLTYPE | Initialize (LPCONSOLE ipConsole)
HRESULT STDMETHODCALLTYPE | Initialize (LPCONSOLE ipConsole)
virtual HRESULT STDMETHODCALLTYPE | Initialize (LPCONSOLE lpConsole)
virtual HRESULT STDMETHODCALLTYPE | Initialize (LPCONSOLE lpConsole)
virtual HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT lpDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)
HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT ipDataObject, MMC_NOTIFY_TYPE MmcEvent, LONG nArg, LONG nParam)
virtual HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT lpDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)
HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT ipDataObject, MMC_NOTIFY_TYPE MmcEvent, LONG nArg, LONG nParam)
virtual HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT lpDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)
virtual HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT lpDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)
HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT ipDataObject, MMC_NOTIFY_TYPE MmcEvent, LPARAM nArg, LPARAM nParam)
virtual HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT lpDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)
virtual HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT lpDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)
virtual HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT lpDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)
virtual HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT lpDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)
virtual HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT lpDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)
virtual HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT lpDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)
virtual HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT lpDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)
HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT ipDataObject, MMC_NOTIFY_TYPE MmcEvent, LPARAM nArg, LPARAM nParam)
virtual HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT lpDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)
virtual HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT lpDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)
HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT ipDataObject, MMC_NOTIFY_TYPE MmcEvent, LONG nArg, LONG nParam)
virtual HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT lpDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)
virtual HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT lpDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)
virtual HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT lpDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)
HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT ipDataObject, MMC_NOTIFY_TYPE MmcEvent, LPARAM nArg, LPARAM nParam)
virtual HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT lpDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)
HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT ipDataObject, MMC_NOTIFY_TYPE MmcEvent, LONG nArg, LONG nParam)
HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT ipDataObject, MMC_NOTIFY_TYPE MmcEvent, LONG nArg, LONG nParam)
virtual HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT __RPC_FAR *ppDataObject)
virtual HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT __RPC_FAR *ppDataObject)
virtual HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT __RPC_FAR *ppDataObject)
HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE nCookie, DATA_OBJECT_TYPES nEnumType, LPDATAOBJECT __RPC_FAR *ppDataObject)
virtual HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT __RPC_FAR *ppDataObject)
virtual HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT __RPC_FAR *ppDataObject)
virtual HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT __RPC_FAR *ppDataObject)
virtual HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT __RPC_FAR *ppDataObject)
virtual HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT __RPC_FAR *ppDataObject)
virtual HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT __RPC_FAR *ppDataObject)
HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE nCookie, DATA_OBJECT_TYPES nEnumType, LPDATAOBJECT __RPC_FAR *ppDataObject)
virtual HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT __RPC_FAR *ppDataObject)
HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE nCookie, DATA_OBJECT_TYPES nEnumType, LPDATAOBJECT __RPC_FAR *ppDataObject)
virtual HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT __RPC_FAR *ppDataObject)
virtual HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT __RPC_FAR *ppDataObject)
virtual HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT __RPC_FAR *ppDataObject)
virtual HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT __RPC_FAR *ppDataObject)
virtual HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT __RPC_FAR *ppDataObject)
HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE nCookie, DATA_OBJECT_TYPES nEnumType, LPDATAOBJECT __RPC_FAR *ppDataObject)
HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE nCookie, DATA_OBJECT_TYPES nEnumType, LPDATAOBJECT __RPC_FAR *ppDataObject)
virtual HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT __RPC_FAR *ppDataObject)
HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE nCookie, DATA_OBJECT_TYPES nEnumType, LPDATAOBJECT __RPC_FAR *ppDataObject)
HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE nCookie, DATA_OBJECT_TYPES nEnumType, LPDATAOBJECT __RPC_FAR *ppDataObject)
HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE nCookie, DATA_OBJECT_TYPES nEnumType, LPDATAOBJECT __RPC_FAR *ppDataObject)
virtual HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT __RPC_FAR *ppDataObject)
HRESULT STDMETHODCALLTYPE | QueryDispatch (MMC_COOKIE nCookie, DATA_OBJECT_TYPES eType, LPDISPATCH *pipDispatch)
HRESULT STDMETHODCALLTYPE | QueryDispatch (MMC_COOKIE nCookie, DATA_OBJECT_TYPES eType, LPDISPATCH *pipDispatch)
HRESULT STDMETHODCALLTYPE | QueryDispatch (MMC_COOKIE nCookie, DATA_OBJECT_TYPES eType, LPDISPATCH *pipDispatch)
HRESULT STDMETHODCALLTYPE | QueryDispatch (MMC_COOKIE nCookie, DATA_OBJECT_TYPES eType, LPDISPATCH *pipDispatch)
HRESULT STDMETHODCALLTYPE | QueryDispatch (MMC_COOKIE nCookie, DATA_OBJECT_TYPES eType, LPDISPATCH *pipDispatch)
HRESULT STDMETHODCALLTYPE | QueryDispatch (MMC_COOKIE nCookie, DATA_OBJECT_TYPES eType, LPDISPATCH *pipDispatch)
HRESULT STDMETHODCALLTYPE | QueryDispatch (MMC_COOKIE nCookie, DATA_OBJECT_TYPES eType, LPDISPATCH *pipDispatch)
HRESULT STDMETHODCALLTYPE | QueryDispatch (MMC_COOKIE nCookie, DATA_OBJECT_TYPES eType, LPDISPATCH *pipDispatch)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
HRESULT | QueryMultiSelDataObject (MMC_COOKIE nCookie, DATA_OBJECT_TYPES nEnumType, CDataObject **ppDataObject)
virtual HRESULT STDMETHODCALLTYPE | QueryPagesFor (LPDATAOBJECT lpDataObject)
virtual HRESULT STDMETHODCALLTYPE | QueryPagesFor (LPDATAOBJECT lpDataObject)
HRESULT STDMETHODCALLTYPE | QueryPagesFor (LPDATAOBJECT ipDataObject)
virtual HRESULT STDMETHODCALLTYPE | QueryPagesFor (LPDATAOBJECT lpDataObject)
virtual HRESULT STDMETHODCALLTYPE | QueryPagesFor (LPDATAOBJECT lpDataObject)
HRESULT STDMETHODCALLTYPE | QueryPagesFor (LPDATAOBJECT ipDataObject)
virtual HRESULT STDMETHODCALLTYPE | QueryPagesFor (LPDATAOBJECT lpDataObject)
HRESULT STDMETHODCALLTYPE | RestoreResultView (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pResultViewType)
HRESULT STDMETHODCALLTYPE | RestoreResultView (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pResultViewType)
HRESULT STDMETHODCALLTYPE | RestoreResultView (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pResultViewType)
HRESULT STDMETHODCALLTYPE | RestoreResultView (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pResultViewType)
HRESULT STDMETHODCALLTYPE | RestoreResultView (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pResultViewType)
HRESULT STDMETHODCALLTYPE | RestoreResultView (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pResultViewType)
HRESULT STDMETHODCALLTYPE | RestoreResultView (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pResultViewType)
HRESULT STDMETHODCALLTYPE | RestoreResultView (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pResultViewType)
HRESULT STDMETHODCALLTYPE | SetControlbar (LPCONTROLBAR ipControlbar)
virtual HRESULT STDMETHODCALLTYPE | SetControlbar (LPCONTROLBAR pControlbar)
virtual HRESULT STDMETHODCALLTYPE | SetControlbar (LPCONTROLBAR pControlbar)
virtual HRESULT STDMETHODCALLTYPE | SetControlbar (LPCONTROLBAR pControlbar)
virtual HRESULT STDMETHODCALLTYPE | SortItems (int nColumn, DWORD dwSortOptions, LPARAM lUserParam)
virtual HRESULT STDMETHODCALLTYPE | SortItems (int nColumn, DWORD dwSortOptions, LPARAM lUserParam)
virtual HRESULT STDMETHODCALLTYPE | SortItems (int nColumn, DWORD dwSortOptions, LPARAM lUserParam)
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
virtual HRESULT STDMETHODCALLTYPE | TaskNotify (IDataObject __RPC_FAR *pdo, VARIANT __RPC_FAR *arg, VARIANT __RPC_FAR *param)

Private Member Functions

LPOLESTR | OleDuplicateString (LPOLESTR lpStr)
HRESULT | OnAddImages (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam)
HRESULT | OnAddImages (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam)
HRESULT | OnAddImages (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam)
HRESULT | OnAddImages (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam)
HRESULT | OnAddImages (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam)
HRESULT | OnAddImages (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam)

Private Attributes

BOOL m_bIsTaskpadPreferred
BOOL m_bTaskpadView
ULONG m_cRef
ULONG m_cref
HBITMAP | m_hImageStrip16
HBITMAP | m_hImageStrip32
LPCONSOLE3 | m_ipConsole
IConsole * | m_ipConsole
IConsole3 * | m_ipConsole
IConsole2 * | m_ipConsole2
LPCONSOLEVERB | m_ipConsoleVerb
IControlbar * | m_ipControlBar
IControlbar * | m_ipControlbar
IToolbar * | m_ipDeviceToolbar
IDisplayHelp * | m_ipDisplayHelp
LPHEADERCTRL2 | m_ipHeaderCtrl
LPHEADERCTRL2 | m_ipHeaderCtrl2
IMenuButton * | m_ipMenuButton
LPRESULTDATA2 | m_ipResultData
LPRESULTDATA | m_ipResultData
IToolbar * | m_ipStaticToolbar
IToolbar * | m_ipToolbar
IToolbar * | m_ipVFileToolbar
class CComponentData * | m_pComponentData
CComponentData * m_pComponentData
class CDelegationBase * | m_pLastNode
class CComponentData * | m_pParent
INT_PTR | m_pScopeCookie
LONG_PTR | m_pScopeCookie

Detailed Description

Definition at line 24 of file comp.h.

Constructor & Destructor Documentation

CComponent::CComponent ( CComponentData * parent )

Definition at line 28 of file comp.Cpp.

: m_pComponentData(parent), m_cref(0), m_ipConsole(NULL)
{
    OBJECT_CREATED
}

CComponent::~CComponent ( )

Definition at line 34 of file comp.Cpp.

{
    OBJECT_DESTROYED
}

CComponent::CComponent ( CComponentData * parent )
CComponent::~CComponent ( )
CComponent::CComponent ( CComponentData * parent )
CComponent::~CComponent ( )
CComponent::CComponent ( CComponentData * parent )
CComponent::~CComponent ( )
CComponent::CComponent ( CComponentData * pParent )
CComponent::~CComponent ( )
CComponent::CComponent ( CComponentData * parent )
CComponent::~CComponent ( )
CComponent::CComponent ( CComponentData * parent )
CComponent::~CComponent ( )
CComponent::CComponent ( CComponentData * parent )
CComponent::~CComponent ( )
CComponent::CComponent ( CComponentData * pParent )
CComponent::~CComponent ( )
CComponent::CComponent ( CComponentData * pParent )
CComponent::~CComponent ( )
CComponent::CComponent ( CComponentData * pParent )
CComponent::~CComponent ( )
CComponent::CComponent ( CComponentData * pParent )
CComponent::~CComponent ( )
CComponent::CComponent ( CComponentData * pParent )
CComponent::~CComponent ( )
CComponent::CComponent ( CComponentData * pParent )
CComponent::~CComponent ( )
CComponent::CComponent ( CComponentData * pParent )
CComponent::~CComponent ( )
CComponent::CComponent ( CComponentData * pParent )
CComponent::~CComponent ( )
CComponent::CComponent ( CComponentData * pParent )
CComponent::~CComponent ( )
CComponent::CComponent ( CComponentData * parent )
CComponent::~CComponent ( )
CComponent::CComponent ( CComponentData * parent )
CComponent::~CComponent ( )
CComponent::CComponent ( CComponentData * parent )
CComponent::~CComponent ( )
CComponent::CComponent ( CComponentData * parent )
CComponent::~CComponent ( )
CComponent::CComponent ( CComponentData * parent )
CComponent::~CComponent ( )
CComponent::CComponent ( CComponentData * parent )
CComponent::~CComponent ( )
CComponent::CComponent ( CComponentData * parent )
CComponent::~CComponent ( )
CComponent::CComponent ( CComponentData * parent )
CComponent::~CComponent ( )

Member Function Documentation

HRESULT CComponent::AddMenuItems | ( | LPDATAOBJECT | piDataObject,
 |  | LPCONTEXTMENUCALLBACK | piCallback,
 |  | long __RPC_FAR * | pInsertionAllowed |
 | ) |  |  | [virtual]

Definition at line 233 of file comp.Cpp.

{
    CDelegationBase *base = GetOurDataObject(piDataObject)->GetBaseNodeObject();

    return base->OnAddMenuItems(piCallback, pInsertionAllowed);
}

virtual HRESULT STDMETHODCALLTYPE CComponent::AddMenuItems | ( | LPDATAOBJECT | piDataObject,
 |  | LPCONTEXTMENUCALLBACK | piCallback,
 |  | long __RPC_FAR * | pInsertionAllowed |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::CacheHint | ( | int | nStartIndex,
 |  | int | nEndIndex |
 | ) |  |  | [virtual]
STDMETHODIMP CComponent::CacheHint | ( | int | nStartIndex,
 |  | int | nEndIndex |
 | ) |  |  | [virtual]

Definition at line 412 of file comp.Cpp.

{
    return E_NOTIMPL;
}

virtual HRESULT STDMETHODCALLTYPE CComponent::CacheHint | ( | int | nStartIndex,
 |  | int | nEndIndex |
 | ) |  |  | [virtual]
HRESULT CComponent::Command | ( | long | lCommandID,
 |  | LPDATAOBJECT | piDataObject |
 | ) |  |  | [virtual]

Definition at line 243 of file comp.Cpp.

{
    CDelegationBase *base = GetOurDataObject(piDataObject)->GetBaseNodeObject();

    return base->OnMenuCommand(m_ipConsole, lCommandID);
}

virtual HRESULT STDMETHODCALLTYPE CComponent::Command | ( | long | lCommandID,
 |  | LPDATAOBJECT | piDataObject |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::CompareObjects | ( | LPDATAOBJECT | lpDataObjectA,
 |  | LPDATAOBJECT | lpDataObjectB |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::CompareObjects | ( | LPDATAOBJECT | lpDataObjectA,
 |  | LPDATAOBJECT | lpDataObjectB |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::CompareObjects | ( | LPDATAOBJECT | lpDataObjectA,
 |  | LPDATAOBJECT | lpDataObjectB |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponent::CompareObjects | ( | LPDATAOBJECT | lpDataObjectA,
 |  | LPDATAOBJECT | lpDataObjectB
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponent::CompareObjects | ( | LPDATAOBJECT | lpDataObjectA,
 |  | LPDATAOBJECT | lpDataObjectB |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponent::CompareObjects | ( | LPDATAOBJECT | lpDataObjectA,
 |  | LPDATAOBJECT | lpDataObjectB
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponent::CompareObjects | ( | LPDATAOBJECT | lpDataObjectA,
 |  | LPDATAOBJECT | lpDataObjectB |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::CompareObjects | ( | LPDATAOBJECT | lpDataObjectA,
 |  | LPDATAOBJECT | lpDataObjectB |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::CompareObjects | ( | LPDATAOBJECT | lpDataObjectA,
 |  | LPDATAOBJECT | lpDataObjectB |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::CompareObjects | ( | LPDATAOBJECT | lpDataObjectA,
 |  | LPDATAOBJECT | lpDataObjectB |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::CompareObjects | ( | LPDATAOBJECT | lpDataObjectA,
 |  | LPDATAOBJECT | lpDataObjectB |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::CompareObjects | ( | LPDATAOBJECT | lpDataObjectA,
 |  | LPDATAOBJECT | lpDataObjectB |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponent::CompareObjects | ( | LPDATAOBJECT | lpDataObjectA,
 |  | LPDATAOBJECT | lpDataObjectB
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponent::CompareObjects | ( | LPDATAOBJECT | lpDataObjectA,
 |  | LPDATAOBJECT | lpDataObjectB |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::CompareObjects | ( | LPDATAOBJECT | lpDataObjectA,
 |  | LPDATAOBJECT | lpDataObjectB |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponent::CompareObjects | ( | LPDATAOBJECT | lpDataObjectA,
 |  | LPDATAOBJECT | lpDataObjectB
 | ) |  |
HRESULT STDMETHODCALLTYPE CComponent::CompareObjects | ( | LPDATAOBJECT | lpDataObjectA,
 |  | LPDATAOBJECT | lpDataObjectB
 | ) |  |
HRESULT STDMETHODCALLTYPE CComponent::CompareObjects | ( | LPDATAOBJECT | lpDataObjectA,
 |  | LPDATAOBJECT | lpDataObjectB
 | ) |  |
HRESULT STDMETHODCALLTYPE CComponent::CompareObjects | ( | LPDATAOBJECT | lpDataObjectA,
 |  | LPDATAOBJECT | lpDataObjectB
 | ) |  |
STDMETHODIMP CComponent::CompareObjects | ( | LPDATAOBJECT | lpDataObjectA,
 |  | LPDATAOBJECT | lpDataObjectB |
 | ) |  |  | [virtual]

Definition at line 182 of file comp.Cpp.

{
    CDelegationBase *baseA = GetOurDataObject(lpDataObjectA)->GetBaseNodeObject();
    CDelegationBase *baseB = GetOurDataObject(lpDataObjectB)->GetBaseNodeObject();

    // compare the object pointers
    if (baseA->GetCookie() == baseB->GetCookie())
        return S_OK;

    return S_FALSE;
}

virtual HRESULT STDMETHODCALLTYPE CComponent::CompareObjects | ( | LPDATAOBJECT | lpDataObjectA,
 |  | LPDATAOBJECT | lpDataObjectB |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponent::CompareObjects | ( | LPDATAOBJECT | lpDataObjectA,
 |  | LPDATAOBJECT | lpDataObjectB
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponent::CompareObjects | ( | LPDATAOBJECT | lpDataObjectA,
 |  | LPDATAOBJECT | lpDataObjectB |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::CompareObjects | ( | LPDATAOBJECT | lpDataObjectA,
 |  | LPDATAOBJECT | lpDataObjectB |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::CompareObjects | ( | LPDATAOBJECT | lpDataObjectA,
 |  | LPDATAOBJECT | lpDataObjectB |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::ControlbarNotify | ( | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponent::ControlbarNotify | ( | MMC_NOTIFY_TYPE | MmcEvent,
 |  | LPARAM | nArg,
 |  | LPARAM | lParam
 | ) |  |
HRESULT CComponent::ControlbarNotify | ( | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param |
 | ) |  |  | [virtual]

Definition at line 400 of file comp.Cpp.

{
    HRESULT hr = S_OK;

    if (event == MMCN_SELECT) {
        BOOL bScope = (BOOL) LOWORD(arg);
        BOOL bSelect = (BOOL) HIWORD(arg);

        CDelegationBase *base = GetOurDataObject(reinterpret_cast<IDataObject *>(param))->GetBaseNodeObject();
        hr = base->OnSetToolbar(m_ipControlBar, m_ipToolbar, bScope, bSelect);
    }

  else if (event == MMCN_BTN_CLICK) {
        CDelegationBase *base = GetOurDataObject(reinterpret_cast<IDataObject *>(arg))->GetBaseNodeObject();
        hr = base->OnToolbarCommand(m_pComponentData->m_ipConsole, (MMC_CONSOLE_VERB)param, reinterpret_cast<IDataObject *>(arg));
    }

    return hr;
}

virtual HRESULT STDMETHODCALLTYPE CComponent::ControlbarNotify | ( | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::CreatePropertyPages | ( | LPPROPERTYSHEETCALLBACK | lpProvider,
 |  | LONG_PTR | handle,
 |  | LPDATAOBJECT | lpIDataObject |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::CreatePropertyPages | ( | LPPROPERTYSHEETCALLBACK | lpProvider,
 |  | LONG_PTR | handle,
 |  | LPDATAOBJECT | lpIDataObject |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::CreatePropertyPages | ( | LPPROPERTYSHEETCALLBACK | lpProvider,
 |  | LONG_PTR | handle,
 |  | LPDATAOBJECT | lpIDataObject |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponent::CreatePropertyPages | ( | LPPROPERTYSHEETCALLBACK | lpProvider,
 |  | LONG_PTR | Handle,
 |  | LPDATAOBJECT | ipIDataObject
 | ) |  |
HRESULT CComponent::CreatePropertyPages | ( | LPPROPERTYSHEETCALLBACK | lpProvider,
 |  | LONG_PTR | handle,
 |  | LPDATAOBJECT | lpIDataObject |
 | ) |  |  | [virtual]

Definition at line 308 of file comp.Cpp.

{
    CDelegationBase *base = GetOurDataObject(lpIDataObject)->GetBaseNodeObject();

    return base->CreatePropertyPages(lpProvider, handle);
}

virtual HRESULT STDMETHODCALLTYPE CComponent::CreatePropertyPages | ( | LPPROPERTYSHEETCALLBACK | lpProvider,
 |  | LONG_PTR | handle,
 |  | LPDATAOBJECT | lpIDataObject |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponent::CreatePropertyPages | ( | LPPROPERTYSHEETCALLBACK | lpProvider,
 |  | LONG_PTR | Handle,
 |  | LPDATAOBJECT | ipIDataObject
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponent::Destroy ( MMC_COOKIE cookie ) [virtual]
HRESULT STDMETHODCALLTYPE CComponent::Destroy ( MMC_COOKIE nCookie )
virtual HRESULT STDMETHODCALLTYPE CComponent::Destroy ( MMC_COOKIE cookie ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::Destroy ( MMC_COOKIE cookie ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::Destroy ( MMC_COOKIE cookie ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::Destroy ( MMC_COOKIE cookie ) [virtual]
HRESULT STDMETHODCALLTYPE CComponent::Destroy ( MMC_COOKIE nCookie )
virtual HRESULT STDMETHODCALLTYPE CComponent::Destroy ( MMC_COOKIE cookie ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::Destroy ( MMC_COOKIE cookie ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::Destroy ( MMC_COOKIE cookie ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::Destroy ( MMC_COOKIE cookie ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::Destroy ( MMC_COOKIE cookie ) [virtual]
HRESULT STDMETHODCALLTYPE CComponent::Destroy ( MMC_COOKIE nCookie )
STDMETHODIMP CComponent::Destroy ( MMC_COOKIE cookie ) [virtual]

Definition at line 104 of file comp.Cpp.

{
    if (m_ipConsole) {
        m_ipConsole->Release();
        m_ipConsole = NULL;
    }

    return S_OK;
}

virtual HRESULT STDMETHODCALLTYPE CComponent::Destroy ( MMC_COOKIE cookie ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::Destroy ( MMC_COOKIE cookie ) [virtual]
HRESULT STDMETHODCALLTYPE CComponent::Destroy ( MMC_COOKIE nCookie )
virtual HRESULT STDMETHODCALLTYPE CComponent::Destroy ( MMC_COOKIE cookie ) [virtual]
HRESULT STDMETHODCALLTYPE CComponent::Destroy ( MMC_COOKIE nCookie )
HRESULT STDMETHODCALLTYPE CComponent::Destroy ( MMC_COOKIE nCookie )
HRESULT STDMETHODCALLTYPE CComponent::Destroy ( MMC_COOKIE nCookie )
HRESULT STDMETHODCALLTYPE CComponent::Destroy ( MMC_COOKIE nCookie )
virtual HRESULT STDMETHODCALLTYPE CComponent::Destroy ( MMC_COOKIE cookie ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::Destroy ( MMC_COOKIE cookie ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::Destroy ( MMC_COOKIE cookie ) [virtual]
void CComponent::DisplayMessageBox ( CDelegationBase * base )

Definition at line 439 of file comp.Cpp.

{

   _TCHAR szVehicle[128];
    static _TCHAR buf[128];

  _stprintf(buf, _T("%s"), base->GetDisplayName() );

  wsprintf(szVehicle, _T("%s deleted"), buf);

  int ret = 0;
  MAKE_WIDEPTR_FROMTSTR_ALLOC(wszVehicle, szVehicle);
  m_ipConsole->MessageBox(wszVehicle,
     L"Vehicle command", MB_OK | MB_ICONINFORMATION, &ret);

  return;
}

HRESULT CComponent::EnumTasks | ( | IDataObject __RPC_FAR * | pdo,
 |  | LPOLESTR | szTaskGroup,
 |  | IEnumTASK __RPC_FAR *__RPC_FAR * | ppEnumTASK |
 | ) |  |  | [virtual]

Definition at line 254 of file comp.Cpp.

{
    CDelegationBase *base = GetOurDataObject(pdo)->GetBaseNodeObject();

    // GetTaskList will allocate the entire task structure, it's
    // up to the enumerator to free the list when destroyed
    LONG nCount;
    MMC_TASK *tasks = base->GetTaskList(szTaskGroup, &nCount);

    if (tasks != NULL) {
        CEnumTASK *pTask = new CEnumTASK(tasks, nCount);

        if (pTask) {
            reinterpret_cast<IUnknown *>(pTask)->AddRef();
            HRESULT hr = pTask->QueryInterface (IID_IEnumTASK, (void **)ppEnumTASK);
            reinterpret_cast<IUnknown *>(pTask)->Release();

            return hr;
        }
    }

    return S_OK;
}

virtual HRESULT STDMETHODCALLTYPE CComponent::FindItem | ( | LPRESULTFINDINFO | pFindInfo,
 |  | int __RPC_FAR * | pnFoundIndex |
 | ) |  |  | [virtual]
STDMETHODIMP CComponent::FindItem | ( | LPRESULTFINDINFO | pFindInfo,
 |  | int __RPC_FAR * | pnFoundIndex |
 | ) |  |  | [virtual]

Definition at line 405 of file comp.Cpp.

{
    return E_NOTIMPL;
}

virtual HRESULT STDMETHODCALLTYPE CComponent::FindItem | ( | LPRESULTFINDINFO | pFindInfo,
 |  | int __RPC_FAR * | pnFoundIndex |
 | ) |  |  | [virtual]
HRESULT CComponent::GetBackground | ( | LPOLESTR | pszGroup,
 |  | MMC_TASK_DISPLAY_OBJECT __RPC_FAR * | pTDO |
 | ) |  |  | [virtual]

Definition at line 306 of file comp.Cpp.

{
        CDelegationBase *base = (CDelegationBase *)wcstoul(pszGroup, NULL, 16);

        if (NULL == base)
                return S_FALSE;

    return base->GetTaskpadBackground(pTDO);
}

HRESULT CComponent::GetCurrentSelections ( CDataObject * pMultiSelectDataObject )

Definition at line 385 of file comp.Cpp.

{

  HRESULT hr = S_FALSE;

  //GetCurrentSelections only works for multiselection data objects
  if ( !( MMC_MULTI_SELECT_COOKIE == GetOurDataObject(pMultiSelectDataObject)->GetCookie() ) )
    return hr = E_INVALIDARG;

  IResultData *pResultData = NULL;

  hr = m_ipConsole->QueryInterface(IID_IResultData, (void **)&pResultData);
  _ASSERT( SUCCEEDED(hr) );

    RESULTDATAITEM rdi;

  BOOL isLastSelected = FALSE;
  int nIndex = -1;
  int nIndexCookies = 0;

  while (!isLastSelected)
  {
    ZeroMemory(&rdi, sizeof(RESULTDATAITEM) );
    rdi.mask  = RDI_STATE;    // nState is valid
    rdi.nCol  = 0;
    rdi.nIndex  = nIndex;     // nIndex == -1 to start at first item
    rdi.nState  = LVIS_SELECTED;  // only interested in selected items

    hr = pResultData->GetNextItem(&rdi);
    _ASSERT( SUCCEEDED(hr) );

    if (rdi.nIndex != -1) {

      //rdi is the RESULTDATAITEM of a selected item. add its
      //lParam to the pCookies array of the pMultiSelectDataObject data object

      _ASSERT( nIndexCookies < 20 ); // MAX_COOKIES == 20
      pMultiSelectDataObject->AddMultiSelectCookie(nIndexCookies, rdi.lParam);
      nIndexCookies++;
      nIndex = rdi.nIndex;
    }

    else
      isLastSelected = TRUE;

  }

  pResultData->Release();

  return hr;

}

HRESULT CComponent::GetDescriptiveText | ( | LPOLESTR | pszGroup,
 |  | LPOLESTR __RPC_FAR * | pszDescriptiveText |
 | ) |  |  | [virtual]

Definition at line 294 of file comp.Cpp.

{
        CDelegationBase *base = (CDelegationBase *)wcstoul(pszGroup, NULL, 16);

        if (NULL == base)
                return S_FALSE;

    return base->GetTaskpadDescription(pszDescriptiveText);
}

virtual HRESULT STDMETHODCALLTYPE CComponent::GetDisplayInfo ( RESULTDATAITEM __RPC_FAR * pResultDataItem ) [virtual]
HRESULT STDMETHODCALLTYPE CComponent::GetDisplayInfo ( RESULTDATAITEM __RPC_FAR * pResultDataItem )
virtual HRESULT STDMETHODCALLTYPE CComponent::GetDisplayInfo ( RESULTDATAITEM __RPC_FAR * pResultDataItem ) [virtual]
HRESULT STDMETHODCALLTYPE CComponent::GetDisplayInfo ( RESULTDATAITEM __RPC_FAR * pResultDataItem )
virtual HRESULT STDMETHODCALLTYPE CComponent::GetDisplayInfo ( RESULTDATAITEM __RPC_FAR * pResultDataItem ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::GetDisplayInfo ( RESULTDATAITEM __RPC_FAR * pResultDataItem ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::GetDisplayInfo ( RESULTDATAITEM __RPC_FAR * pResultDataItem ) [virtual]
HRESULT STDMETHODCALLTYPE CComponent::GetDisplayInfo ( RESULTDATAITEM __RPC_FAR * pResultDataItem )
virtual HRESULT STDMETHODCALLTYPE CComponent::GetDisplayInfo ( RESULTDATAITEM __RPC_FAR * pResultDataItem ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::GetDisplayInfo ( RESULTDATAITEM __RPC_FAR * pResultDataItem ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::GetDisplayInfo ( RESULTDATAITEM __RPC_FAR * pResultDataItem ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::GetDisplayInfo ( RESULTDATAITEM __RPC_FAR * pResultDataItem ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::GetDisplayInfo ( RESULTDATAITEM __RPC_FAR * pResultDataItem ) [virtual]
STDMETHODIMP CComponent::GetDisplayInfo ( RESULTDATAITEM __RPC_FAR * pResultDataItem ) [virtual]

Definition at line 157 of file comp.Cpp.

{
    HRESULT hr = S_OK;
    CDelegationBase *base = NULL;

    // if they are asking for the RDI_STR we have one of those to give

    if (pResultDataItem->lParam) {
        base = (CDelegationBase *)pResultDataItem->lParam;
        if (pResultDataItem->mask & RDI_STR) {
      LPCTSTR pszT = base->GetDisplayName(pResultDataItem->nCol);
      MAKE_WIDEPTR_FROMTSTR_ALLOC(pszW, pszT);
            pResultDataItem->str = pszW;
        }

        if (pResultDataItem->mask & RDI_IMAGE) {
            pResultDataItem->nImage = base->GetBitmapIndex();
        }
    }

    return hr;
}

HRESULT STDMETHODCALLTYPE CComponent::GetDisplayInfo ( RESULTDATAITEM __RPC_FAR * pResultDataItem )
virtual HRESULT STDMETHODCALLTYPE CComponent::GetDisplayInfo ( RESULTDATAITEM __RPC_FAR * pResultDataItem ) [virtual]
HRESULT STDMETHODCALLTYPE CComponent::GetDisplayInfo ( RESULTDATAITEM __RPC_FAR * pResultDataItem )
HRESULT STDMETHODCALLTYPE CComponent::GetDisplayInfo ( RESULTDATAITEM __RPC_FAR * pResultDataItem )
HRESULT STDMETHODCALLTYPE CComponent::GetDisplayInfo ( RESULTDATAITEM __RPC_FAR * pResultDataItem )
virtual HRESULT STDMETHODCALLTYPE CComponent::GetDisplayInfo ( RESULTDATAITEM __RPC_FAR * pResultDataItem ) [virtual]
HRESULT STDMETHODCALLTYPE CComponent::GetDisplayInfo ( RESULTDATAITEM __RPC_FAR * pResultDataItem )
virtual HRESULT STDMETHODCALLTYPE CComponent::GetDisplayInfo ( RESULTDATAITEM __RPC_FAR * pResultDataItem ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::GetDisplayInfo ( RESULTDATAITEM __RPC_FAR * pResultDataItem ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::GetDisplayInfo ( RESULTDATAITEM __RPC_FAR * pResultDataItem ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::GetDisplayInfo ( RESULTDATAITEM __RPC_FAR * pResultDataItem ) [virtual]
HRESULT CComponent::GetInterface | ( | DWORD | dwRequestedInterface,
 |  | LONG_PTR * | ppInterface
 | ) |  |
HRESULT CComponent::GetInterface | ( | DWORD | dwRequestedInterface,
 |  | LONG_PTR * | ppInterface
 | ) |  |
HRESULT CComponent::GetInterface | ( | DWORD | dwRequestedInterface,
 |  | LONG_PTR * | ppInterface
 | ) |  |
HRESULT CComponent::GetInterface | ( | DWORD | dwRequestedInterface,
 |  | LONG_PTR * | ppInterface
 | ) |  |
HRESULT CComponent::GetInterface | ( | DWORD | dwRequestedInterface,
 |  | LONG_PTR * | ppInterface
 | ) |  |
HRESULT CComponent::GetInterface | ( | DWORD | dwRequestedInterface,
 |  | LONG_PTR * | ppInterface
 | ) |  |

Definition at line 356 of file comp.cpp.

{
  _ASSERT( NULL != ppInterface );
  HRESULT hResult = S_OK;

  switch( dwRequestedInterface )
  {
    case REQUEST_ICONSOLE:
      _ASSERT( NULL != m_ipConsole );
      *ppInterface = reinterpret_cast<LONG_PTR>(m_ipConsole);
      break;

    case REQUEST_ICONSOLEVERB:
      _ASSERT( NULL != m_ipConsoleVerb );
      *ppInterface = reinterpret_cast<LONG_PTR>(m_ipConsoleVerb);
      break;

    case REQUEST_IRESULTDATA:
      _ASSERT( NULL != m_ipResultData );
      *ppInterface = reinterpret_cast<LONG_PTR>(m_ipResultData);
      break;

    case REQUEST_IHEADERCTRL2:
      _ASSERT( NULL != m_ipHeaderCtrl2 );
      *ppInterface = reinterpret_cast<LONG_PTR>(m_ipHeaderCtrl2);
      break;

    default:
      hResult = S_FALSE;
      *ppInterface = NULL;
      break;
  }
  return hResult;
}

HRESULT CComponent::GetListPadInfo | ( | LPOLESTR | pszGroup,
 |  | MMC_LISTPAD_INFO __RPC_FAR * | lpListPadInfo |
 | ) |  |  | [virtual]

Definition at line 318 of file comp.Cpp.

{
        CDelegationBase *base = (CDelegationBase *)wcstoul(pszGroup, NULL, 16);

        if (NULL == base)
                return S_FALSE;

    return base->GetListpadInfo(lpListPadInfo);
}

LONG_PTR CComponent::GetParent ( ) [inline]

Definition at line 142 of file comp.h.

{ return (LONG_PTR)m_pComponentData; }

HRESULT CComponent::GetProperty | ( | LPDATAOBJECT | ipDataObject,
 |  | BSTR | szPropertyName,
 |  | PBSTR | pbstrProperty
 | ) |  |

Definition at line 329 of file comp.cpp.

{
  _ASSERT( NULL != ipDataObject );
  if( NULL == pbstrProperty )            // Must have valid pointer
    return E_INVALIDARG;

  HRESULT hResult = S_FALSE;

  LPBASENODE pNode = ExtractBaseNodePtr( ipDataObject );
  if( NULL != pNode )
    hResult = pNode->GetProperty( bstrPropertyName, pbstrProperty );

  return hResult;
}

virtual HRESULT STDMETHODCALLTYPE CComponent::GetResultViewType | ( | MMC_COOKIE | cookie,
 |  | LPOLESTR __RPC_FAR * | ppViewType,
 |  | long __RPC_FAR * | pViewOptions |
 | ) |  |  | [virtual]
STDMETHODIMP CComponent::GetResultViewType | ( | MMC_COOKIE | cookie,
 |  | LPOLESTR __RPC_FAR * | ppViewType,
 |  | long __RPC_FAR * | pViewOptions |
 | ) |  |  | [virtual]

Definition at line 136 of file comp.Cpp.

{
    CDelegationBase *base = (CDelegationBase *)cookie;

    //
    // Ask for default listview.
    //
    if (base == NULL)
    {
        *pViewOptions = MMC_VIEW_OPTIONS_NONE;
        *ppViewType = NULL;
    }
    else
        return base->GetResultViewType(ppViewType, pViewOptions);

    return S_OK;
}

HRESULT STDMETHODCALLTYPE CComponent::GetResultViewType | ( | MMC_COOKIE | nCookie,
 |  | LPOLESTR __RPC_FAR * | ppViewType,
 |  | long __RPC_FAR * | pViewOptions
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponent::GetResultViewType | ( | MMC_COOKIE | cookie,
 |  | LPOLESTR __RPC_FAR * | ppViewType,
 |  | long __RPC_FAR * | pViewOptions |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::GetResultViewType | ( | MMC_COOKIE | cookie,
 |  | LPOLESTR __RPC_FAR * | ppViewType,
 |  | long __RPC_FAR * | pViewOptions |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::GetResultViewType | ( | MMC_COOKIE | cookie,
 |  | LPOLESTR __RPC_FAR * | ppViewType,
 |  | long __RPC_FAR * | pViewOptions |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponent::GetResultViewType | ( | MMC_COOKIE | nCookie,
 |  | LPOLESTR __RPC_FAR * | ppViewType,
 |  | long __RPC_FAR * | pViewOptions
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponent::GetResultViewType | ( | MMC_COOKIE | cookie,
 |  | LPOLESTR __RPC_FAR * | ppViewType,
 |  | long __RPC_FAR * | pViewOptions |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::GetResultViewType | ( | MMC_COOKIE | cookie,
 |  | LPOLESTR __RPC_FAR * | ppViewType,
 |  | long __RPC_FAR * | pViewOptions |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::GetResultViewType | ( | MMC_COOKIE | cookie,
 |  | LPOLESTR __RPC_FAR * | ppViewType,
 |  | long __RPC_FAR * | pViewOptions |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::GetResultViewType | ( | MMC_COOKIE | cookie,
 |  | LPOLESTR __RPC_FAR * | ppViewType,
 |  | long __RPC_FAR * | pViewOptions |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::GetResultViewType | ( | MMC_COOKIE | cookie,
 |  | LPOLESTR __RPC_FAR * | ppViewType,
 |  | long __RPC_FAR * | pViewOptions |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponent::GetResultViewType | ( | MMC_COOKIE | nCookie,
 |  | LPOLESTR __RPC_FAR * | ppViewType,
 |  | long __RPC_FAR * | pViewOptions
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponent::GetResultViewType | ( | MMC_COOKIE | cookie,
 |  | LPOLESTR __RPC_FAR * | ppViewType,
 |  | long __RPC_FAR * | pViewOptions |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::GetResultViewType | ( | MMC_COOKIE | cookie,
 |  | LPOLESTR __RPC_FAR * | ppViewType,
 |  | long __RPC_FAR * | pViewOptions |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponent::GetResultViewType | ( | MMC_COOKIE | nCookie,
 |  | LPOLESTR __RPC_FAR * | ppViewType,
 |  | long __RPC_FAR * | pViewOptions
 | ) |  |
HRESULT STDMETHODCALLTYPE CComponent::GetResultViewType | ( | MMC_COOKIE | nCookie,
 |  | LPOLESTR __RPC_FAR * | ppViewType,
 |  | long __RPC_FAR * | pViewOptions
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponent::GetResultViewType | ( | MMC_COOKIE | cookie,
 |  | LPOLESTR __RPC_FAR * | ppViewType,
 |  | long __RPC_FAR * | pViewOptions |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponent::GetResultViewType | ( | MMC_COOKIE | nCookie,
 |  | LPOLESTR __RPC_FAR * | ppViewType,
 |  | long __RPC_FAR * | pViewOptions
 | ) |  |
HRESULT STDMETHODCALLTYPE CComponent::GetResultViewType | ( | MMC_COOKIE | nCookie,
 |  | LPOLESTR __RPC_FAR * | ppViewType,
 |  | long __RPC_FAR * | pViewOptions
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponent::GetResultViewType | ( | MMC_COOKIE | cookie,
 |  | LPOLESTR __RPC_FAR * | ppViewType,
 |  | long __RPC_FAR * | pViewOptions |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::GetResultViewType | ( | MMC_COOKIE | cookie,
 |  | LPOLESTR __RPC_FAR * | ppViewType,
 |  | long __RPC_FAR * | pViewOptions |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponent::GetResultViewType | ( | MMC_COOKIE | nCookie,
 |  | LPOLESTR __RPC_FAR * | ppViewType,
 |  | long __RPC_FAR * | pViewOptions
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponent::GetResultViewType | ( | MMC_COOKIE | cookie,
 |  | LPOLESTR __RPC_FAR * | ppViewType,
 |  | long __RPC_FAR * | pViewOptions |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::GetResultViewType | ( | MMC_COOKIE | cookie,
 |  | LPOLESTR __RPC_FAR * | ppViewType,
 |  | long __RPC_FAR * | pViewOptions |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponent::GetResultViewType2 | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pRVTinfo
 | ) |  |
HRESULT STDMETHODCALLTYPE CComponent::GetResultViewType2 | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pRVTinfo
 | ) |  |
HRESULT STDMETHODCALLTYPE CComponent::GetResultViewType2 | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pRVTinfo
 | ) |  |
HRESULT STDMETHODCALLTYPE CComponent::GetResultViewType2 | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pRVTinfo
 | ) |  |
HRESULT STDMETHODCALLTYPE CComponent::GetResultViewType2 | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pResultViewType
 | ) |  |
HRESULT CComponent::GetResultViewType2 | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pRVTinfo
 | ) |  |

Definition at line 205 of file comp.cpp.

{
  HRESULT hResult = S_FALSE;

  if( NULL == nCookie )
  {
    CStaticNode* pNode = m_pComponentData->GetStaticNode();
    hResult = pNode->GetResultViewType2( nCookie, pRVTinfo );
  }
  else
  {
    _ASSERT( FALSE );
  }

  TRACE_HRESULT(_T("GetResultViewType2"), hResult );
  return hResult;
}

HRESULT STDMETHODCALLTYPE CComponent::GetResultViewType2 | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pRVTinfo
 | ) |  |
HRESULT STDMETHODCALLTYPE CComponent::GetResultViewType2 | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pRVTinfo
 | ) |  |
LONG_PTR CComponent::GetScopeCookie ( ) [inline]

Definition at line 114 of file comp.h.

{ return m_pScopeCookie; }

INT_PTR CComponent::GetScopeCookie ( ) [inline]

Definition at line 132 of file comp.h.

{ return m_pScopeCookie; }

LONG_PTR CComponent::GetScopeCookie ( ) [inline]

Definition at line 123 of file comp.h.

{ return m_pScopeCookie; }

HRESULT CComponent::GetTitle | ( | LPOLESTR | pszGroup,
 |  | LPOLESTR __RPC_FAR * | pszTitle |
 | ) |  |  | [virtual]

Definition at line 282 of file comp.Cpp.

{
    CDelegationBase *base = (CDelegationBase *)wcstoul(pszGroup, NULL, 16);

    if (NULL == base)
            return S_FALSE;

    return base->GetTaskpadTitle(pszTitle);
}

IToolbar* CComponent::getToolbar ( ) [inline]

Definition at line 93 of file comp.h.

{ return m_ipToolbar; }

IToolbar* CComponent::getToolbar ( ) [inline]

Definition at line 109 of file comp.h.

{ return m_ipToolbar; }

virtual HRESULT STDMETHODCALLTYPE CComponent::GetWatermarks | ( | LPDATAOBJECT | lpIDataObject,
 |  | HBITMAP __RPC_FAR * | lphWatermark,
 |  | HBITMAP __RPC_FAR * | lphHeader,
 |  | HPALETTE __RPC_FAR * | lphPalette,
 |  | BOOL __RPC_FAR * | bStretch |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::GetWatermarks | ( | LPDATAOBJECT | lpIDataObject,
 |  | HBITMAP __RPC_FAR * | lphWatermark,
 |  | HBITMAP __RPC_FAR * | lphHeader,
 |  | HPALETTE __RPC_FAR * | lphPalette,
 |  | BOOL __RPC_FAR * | bStretch |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::GetWatermarks | ( | LPDATAOBJECT | lpIDataObject,
 |  | HBITMAP __RPC_FAR * | lphWatermark,
 |  | HBITMAP __RPC_FAR * | lphHeader,
 |  | HPALETTE __RPC_FAR * | lphPalette,
 |  | BOOL __RPC_FAR * | bStretch |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::GetWatermarks | ( | LPDATAOBJECT | lpIDataObject,
 |  | HBITMAP __RPC_FAR * | lphWatermark,
 |  | HBITMAP __RPC_FAR * | lphHeader,
 |  | HPALETTE __RPC_FAR * | lphPalette,
 |  | BOOL __RPC_FAR * | bStretch |
 | ) |  |  | [virtual]
HRESULT CComponent::GetWatermarks | ( | LPDATAOBJECT | lpIDataObject,
 |  | HBITMAP __RPC_FAR * | lphWatermark,
 |  | HBITMAP __RPC_FAR * | lphHeader,
 |  | HPALETTE __RPC_FAR * | lphPalette,
 |  | BOOL __RPC_FAR * | bStretch |
 | ) |  |  | [virtual]

Definition at line 326 of file comp.Cpp.

{
    CDelegationBase *base = GetOurDataObject(lpIDataObject)->GetBaseNodeObject();

    return base->GetWatermarks(lphWatermark, lphHeader, lphPalette, bStretch);
}

HRESULT STDMETHODCALLTYPE CComponent::GetWatermarks | ( | LPDATAOBJECT | lpIDataObject,
 |  | HBITMAP __RPC_FAR * | lphWatermark,
 |  | HBITMAP __RPC_FAR * | lphHeader,
 |  | HPALETTE __RPC_FAR * | lphPalette,
 |  | BOOL __RPC_FAR * | bStretch
 | ) |  |
HRESULT STDMETHODCALLTYPE CComponent::GetWatermarks | ( | LPDATAOBJECT | lpIDataObject,
 |  | HBITMAP __RPC_FAR * | lphWatermark,
 |  | HBITMAP __RPC_FAR * | lphHeader,
 |  | HPALETTE __RPC_FAR * | lphPalette,
 |  | BOOL __RPC_FAR * | bStretch
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponent::Initialize ( LPCONSOLE lpConsole ) [virtual]
HRESULT STDMETHODCALLTYPE CComponent::Initialize ( LPCONSOLE ipConsole )
virtual HRESULT STDMETHODCALLTYPE CComponent::Initialize ( LPCONSOLE lpConsole ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::Initialize ( LPCONSOLE lpConsole ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::Initialize ( LPCONSOLE lpConsole ) [virtual]
HRESULT STDMETHODCALLTYPE CComponent::Initialize ( LPCONSOLE ipConsole )
virtual HRESULT STDMETHODCALLTYPE CComponent::Initialize ( LPCONSOLE lpConsole ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::Initialize ( LPCONSOLE lpConsole ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::Initialize ( LPCONSOLE lpConsole ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::Initialize ( LPCONSOLE lpConsole ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::Initialize ( LPCONSOLE lpConsole ) [virtual]
HRESULT STDMETHODCALLTYPE CComponent::Initialize ( LPCONSOLE ipConsole )
virtual HRESULT STDMETHODCALLTYPE CComponent::Initialize ( LPCONSOLE lpConsole ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::Initialize ( LPCONSOLE lpConsole ) [virtual]
HRESULT STDMETHODCALLTYPE CComponent::Initialize ( LPCONSOLE ipConsole )
STDMETHODIMP CComponent::Initialize ( LPCONSOLE lpConsole ) [virtual]

Definition at line 79 of file comp.Cpp.

{
    HRESULT hr = S_OK;

    // Save away all the interfaces we'll need.
    // Fail if we can't QI the required interfaces.

    m_ipConsole = lpConsole;
    m_ipConsole->AddRef();

    return hr;
}

HRESULT STDMETHODCALLTYPE CComponent::Initialize ( LPCONSOLE ipConsole )
HRESULT STDMETHODCALLTYPE CComponent::Initialize ( LPCONSOLE ipConsole )
virtual HRESULT STDMETHODCALLTYPE CComponent::Initialize ( LPCONSOLE lpConsole ) [virtual]
HRESULT STDMETHODCALLTYPE CComponent::Initialize ( LPCONSOLE ipConsole )
virtual HRESULT STDMETHODCALLTYPE CComponent::Initialize ( LPCONSOLE lpConsole ) [virtual]
HRESULT STDMETHODCALLTYPE CComponent::Initialize ( LPCONSOLE ipConsole )
virtual HRESULT STDMETHODCALLTYPE CComponent::Initialize ( LPCONSOLE lpConsole ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::Initialize ( LPCONSOLE lpConsole ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::Initialize ( LPCONSOLE lpConsole ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::Notify | ( | LPDATAOBJECT | lpDataObject,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::Notify | ( | LPDATAOBJECT | lpDataObject,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::Notify | ( | LPDATAOBJECT | lpDataObject,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::Notify | ( | LPDATAOBJECT | lpDataObject,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::Notify | ( | LPDATAOBJECT | lpDataObject,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param |
 | ) |  |  | [virtual]
STDMETHODIMP CComponent::Notify | ( | LPDATAOBJECT | lpDataObject,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param |
 | ) |  |  | [virtual]

Definition at line 93 of file comp.Cpp.

{
  MMCN_Crack(FALSE, lpDataObject, NULL, this, event, arg, param);

    return S_FALSE;
}

HRESULT STDMETHODCALLTYPE CComponent::Notify | ( | LPDATAOBJECT | ipDataObject,
 |  | MMC_NOTIFY_TYPE | MmcEvent,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponent::Notify | ( | LPDATAOBJECT | lpDataObject,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::Notify | ( | LPDATAOBJECT | lpDataObject,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponent::Notify | ( | LPDATAOBJECT | ipDataObject,
 |  | MMC_NOTIFY_TYPE | MmcEvent,
 |  | LONG | nArg,
 |  | LONG | nParam
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponent::Notify | ( | LPDATAOBJECT | lpDataObject,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponent::Notify | ( | LPDATAOBJECT | ipDataObject,
 |  | MMC_NOTIFY_TYPE | MmcEvent,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponent::Notify | ( | LPDATAOBJECT | lpDataObject,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::Notify | ( | LPDATAOBJECT | lpDataObject,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponent::Notify | ( | LPDATAOBJECT | ipDataObject,
 |  | MMC_NOTIFY_TYPE | MmcEvent,
 |  | LONG | nArg,
 |  | LONG | nParam
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponent::Notify | ( | LPDATAOBJECT | lpDataObject,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param |
 | ) |  |  | [virtual]
STDMETHODIMP CComponent::Notify | ( | LPDATAOBJECT | ipDataObject,
 |  | MMC_NOTIFY_TYPE | MmcEvent,
 |  | LONG | nArg,
 |  | LONG | nParam
 | ) |  |

Definition at line 117 of file comp.cpp.

{
  HRESULT hResult = S_FALSE;       // Return this for unhandled notifications
  TRACE_EVENT( _T("Notify"), MmcEvent );
  return hResult;
}

HRESULT STDMETHODCALLTYPE CComponent::Notify | ( | LPDATAOBJECT | ipDataObject,
 |  | MMC_NOTIFY_TYPE | MmcEvent,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponent::Notify | ( | LPDATAOBJECT | lpDataObject,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponent::Notify | ( | LPDATAOBJECT | ipDataObject,
 |  | MMC_NOTIFY_TYPE | MmcEvent,
 |  | LONG | nArg,
 |  | LONG | nParam
 | ) |  |
HRESULT STDMETHODCALLTYPE CComponent::Notify | ( | LPDATAOBJECT | ipDataObject,
 |  | MMC_NOTIFY_TYPE | MmcEvent,
 |  | LONG | nArg,
 |  | LONG | nParam
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponent::Notify | ( | LPDATAOBJECT | lpDataObject,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::Notify | ( | LPDATAOBJECT | lpDataObject,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::Notify | ( | LPDATAOBJECT | lpDataObject,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::Notify | ( | LPDATAOBJECT | lpDataObject,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param |
 | ) |  |  | [virtual]
LPOLESTR CComponent::OleDuplicateString ( LPOLESTR lpStr ) [inline, private]

Definition at line 116 of file comp.h.

                                                    {
            LPOLESTR tmp = static_cast<LPOLESTR>(CoTaskMemAlloc((wcslen(lpStr) + 1)  * sizeof(WCHAR)));
            wcscpy(tmp, lpStr);

            return tmp;
        }

HRESULT CComponent::OnAddImages | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam |
 | ) |  |  | [private]
HRESULT CComponent::OnAddImages | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam |
 | ) |  |  | [private]
HRESULT CComponent::OnAddImages | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam |
 | ) |  |  | [private]
HRESULT CComponent::OnAddImages | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam |
 | ) |  |  | [private]
HRESULT CComponent::OnAddImages | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam |
 | ) |  |  | [private]

Definition at line 364 of file comp.cpp.

{
  HRESULT hResult = S_FALSE;

  HBITMAP hImageStrip16 = ::LoadBitmap(g_hInst, MAKEINTRESOURCE(IDB_NODEIMAGES_16));
  HBITMAP hImageStrip32 = ::LoadBitmap(g_hInst, MAKEINTRESOURCE(IDB_NODEIMAGES_32));

  if( NULL != nArg )           // May get this when shutting down
  {
    IImageList* ipImageList = reinterpret_cast<IImageList*>(nArg);
    hResult = ipImageList->ImageListSetStrip( (LONG_PTR*)hImageStrip16,
                                              (LONG_PTR*)hImageStrip32,
                                              0,
                                              RGB(0,255,0)
                                            );

    SAFE_FREE_BITMAP( hImageStrip16 );
    SAFE_FREE_BITMAP( hImageStrip32 );
  }

  TRACE_HRESULT(_T("OnAddImages"), hResult );
  return hResult;

}

HRESULT CComponent::OnAddImages | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam |
 | ) |  |  | [private]

Definition at line 326 of file comp.cpp.

{
  HRESULT hResult = S_FALSE;

  if( NULL != nArg )           // May get this when shutting down
  {
    IImageList* ipImageList = reinterpret_cast<IImageList*>(nArg);
    hResult = ipImageList->ImageListSetStrip( (LONG*)m_hImageStrip16,
                                              (LONG*)m_hImageStrip32,
                                              0,
                                              RGB(0,255,0)
                                            );
  }
  TRACE_HRESULT(_T("OnAddImages"), hResult );
  return hResult;

}

virtual HRESULT STDMETHODCALLTYPE CComponent::QueryDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | type,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::QueryDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | type,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponent::QueryDataObject | ( | MMC_COOKIE | nCookie,
 |  | DATA_OBJECT_TYPES | nEnumType,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject
 | ) |  |
HRESULT STDMETHODCALLTYPE CComponent::QueryDataObject | ( | MMC_COOKIE | nCookie,
 |  | DATA_OBJECT_TYPES | nEnumType,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponent::QueryDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | type,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::QueryDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | type,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponent::QueryDataObject | ( | MMC_COOKIE | nCookie,
 |  | DATA_OBJECT_TYPES | nEnumType,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject
 | ) |  |
HRESULT STDMETHODCALLTYPE CComponent::QueryDataObject | ( | MMC_COOKIE | nCookie,
 |  | DATA_OBJECT_TYPES | nEnumType,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponent::QueryDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | type,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::QueryDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | type,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::QueryDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | type,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::QueryDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | type,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::QueryDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | type,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject |
 | ) |  |  | [virtual]
STDMETHODIMP CComponent::QueryDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | type,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject |
 | ) |  |  | [virtual]

Definition at line 116 of file comp.Cpp.

{
    CDataObject *pObj = NULL;

    if (cookie == 0)
        pObj = new CDataObject((MMC_COOKIE)m_pComponentData->m_pStaticNode, type);
    else
        pObj = new CDataObject(cookie, type);

    if (!pObj)
        return E_OUTOFMEMORY;

    pObj->QueryInterface(IID_IDataObject, (void **)ppDataObject);

    return S_OK;
}

virtual HRESULT STDMETHODCALLTYPE CComponent::QueryDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | type,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponent::QueryDataObject | ( | MMC_COOKIE | nCookie,
 |  | DATA_OBJECT_TYPES | nEnumType,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponent::QueryDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | type,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::QueryDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | type,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::QueryDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | type,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponent::QueryDataObject | ( | MMC_COOKIE | nCookie,
 |  | DATA_OBJECT_TYPES | nEnumType,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject
 | ) |  |
HRESULT STDMETHODCALLTYPE CComponent::QueryDataObject | ( | MMC_COOKIE | nCookie,
 |  | DATA_OBJECT_TYPES | nEnumType,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject
 | ) |  |
HRESULT STDMETHODCALLTYPE CComponent::QueryDataObject | ( | MMC_COOKIE | nCookie,
 |  | DATA_OBJECT_TYPES | nEnumType,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponent::QueryDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | type,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::QueryDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | type,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::QueryDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | type,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponent::QueryDispatch | ( | MMC_COOKIE | nCookie,
 |  | DATA_OBJECT_TYPES | eType,
 |  | LPDISPATCH * | pipDispatch
 | ) |  |
HRESULT STDMETHODCALLTYPE CComponent::QueryDispatch | ( | MMC_COOKIE | nCookie,
 |  | DATA_OBJECT_TYPES | eType,
 |  | LPDISPATCH * | pipDispatch
 | ) |  |
HRESULT STDMETHODCALLTYPE CComponent::QueryDispatch | ( | MMC_COOKIE | nCookie,
 |  | DATA_OBJECT_TYPES | eType,
 |  | LPDISPATCH * | pipDispatch
 | ) |  |
HRESULT STDMETHODCALLTYPE CComponent::QueryDispatch | ( | MMC_COOKIE | nCookie,
 |  | DATA_OBJECT_TYPES | eType,
 |  | LPDISPATCH * | pipDispatch
 | ) |  |
HRESULT STDMETHODCALLTYPE CComponent::QueryDispatch | ( | MMC_COOKIE | nCookie,
 |  | DATA_OBJECT_TYPES | eType,
 |  | LPDISPATCH * | pipDispatch
 | ) |  |
HRESULT STDMETHODCALLTYPE CComponent::QueryDispatch | ( | MMC_COOKIE | nCookie,
 |  | DATA_OBJECT_TYPES | eType,
 |  | LPDISPATCH * | pipDispatch
 | ) |  |
HRESULT CComponent::QueryDispatch | ( | MMC_COOKIE | nCookie,
 |  | DATA_OBJECT_TYPES | eType,
 |  | LPDISPATCH * | pipDispatch
 | ) |  |

Definition at line 191 of file comp.cpp.

{
  return E_NOTIMPL;
}

HRESULT STDMETHODCALLTYPE CComponent::QueryDispatch | ( | MMC_COOKIE | nCookie,
 |  | DATA_OBJECT_TYPES | eType,
 |  | LPDISPATCH * | pipDispatch
 | ) |  |
STDMETHODIMP CComponent::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponent::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponent::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponent::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponent::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 39 of file comp.Cpp.

{
    if (!ppv)
        return E_FAIL;

    *ppv = NULL;

    if (IsEqualIID(riid, IID_IUnknown))
        *ppv = static_cast<IComponent *>(this);
    else if (IsEqualIID(riid, IID_IComponent))
        *ppv = static_cast<IComponent *>(this);

    if (*ppv)
    {
        reinterpret_cast<IUnknown *>(*ppv)->AddRef();
        return S_OK;
    }

    return E_NOINTERFACE;
}

STDMETHODIMP CComponent::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponent::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponent::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponent::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponent::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponent::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponent::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponent::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponent::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponent::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponent::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponent::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponent::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponent::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponent::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponent::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponent::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponent::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponent::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponent::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
HRESULT CComponent::QueryMultiSelDataObject | ( | MMC_COOKIE | nCookie,
 |  | DATA_OBJECT_TYPES | nEnumType,
 |  | CDataObject ** | ppDataObject
 | ) |  |

Definition at line 251 of file comp.cpp.

{
  HRESULT        hResult  = S_OK;
  LPBASENODE     pTmpNode = NULL;
  CDataObject*   pMSelObj = *ppDataObject;
  RESULTDATAITEM rdi;

  ZeroMemory( &rdi, sizeof(RESULTDATAITEM) );
  rdi.mask   = RDI_STATE;
  rdi.nIndex = -1;
  rdi.nState = TVIS_SELECTED;

  // Store the basic info in the MS DataObject
  pMSelObj->SetPrivateData( nCookie, (ULONG)nEnumType );

  // Iterate through the selected items, create a new data object for each
  // and add it to the list
  while( S_OK == m_ipResultData->GetNextItem(&rdi) )
  {
    pTmpNode = reinterpret_cast<LPBASENODE>(rdi.lParam);   // Need to save this...
    pMSelObj->AddMultiSelectCookie( rdi.lParam );
  }

  // All our result items are of one type so there is only one GUID
  // to support in CCF_OBJECT_TYPES_IN_MULTI_SELECT
  pMSelObj->AddMultiSelectGuid( &pTmpNode->GetNodeGUID() );

  //TRACE_PTR(_T("QueryMultiSelDataObject"),_T("pDO"), (ULONG_PTR)*ppDataObject );
  return hResult;
}

virtual HRESULT STDMETHODCALLTYPE CComponent::QueryPagesFor ( LPDATAOBJECT lpDataObject ) [virtual]
HRESULT STDMETHODCALLTYPE CComponent::QueryPagesFor ( LPDATAOBJECT ipDataObject )
virtual HRESULT STDMETHODCALLTYPE CComponent::QueryPagesFor ( LPDATAOBJECT lpDataObject ) [virtual]
HRESULT CComponent::QueryPagesFor ( LPDATAOBJECT lpDataObject ) [virtual]

Definition at line 318 of file comp.Cpp.

{
    CDelegationBase *base = GetOurDataObject(lpDataObject)->GetBaseNodeObject();

    return base->HasPropertySheets();
}

HRESULT STDMETHODCALLTYPE CComponent::QueryPagesFor ( LPDATAOBJECT ipDataObject )
virtual HRESULT STDMETHODCALLTYPE CComponent::QueryPagesFor ( LPDATAOBJECT lpDataObject ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::QueryPagesFor ( LPDATAOBJECT lpDataObject ) [virtual]
HRESULT STDMETHODCALLTYPE CComponent::RestoreResultView | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pResultViewType
 | ) |  |
HRESULT STDMETHODCALLTYPE CComponent::RestoreResultView | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pResultViewType
 | ) |  |
HRESULT STDMETHODCALLTYPE CComponent::RestoreResultView | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pResultViewType
 | ) |  |
HRESULT STDMETHODCALLTYPE CComponent::RestoreResultView | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pResultViewType
 | ) |  |
HRESULT STDMETHODCALLTYPE CComponent::RestoreResultView | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pResultViewType
 | ) |  |
HRESULT CComponent::RestoreResultView | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pResultViewType
 | ) |  |

Definition at line 229 of file comp.cpp.

{
  return E_NOTIMPL;
}

HRESULT STDMETHODCALLTYPE CComponent::RestoreResultView | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pResultViewType
 | ) |  |
HRESULT STDMETHODCALLTYPE CComponent::RestoreResultView | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pResultViewType
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponent::SetControlbar ( LPCONTROLBAR pControlbar ) [virtual]
HRESULT CComponent::SetControlbar ( LPCONTROLBAR pControlbar ) [virtual]

Definition at line 348 of file comp.Cpp.

{
    HRESULT hr = S_OK;

    //
    //  Clean up
    //

    // if we've got a cached toolbar, release it
    if (m_ipToolbar) {
        m_ipToolbar->Release();
        m_ipToolbar = NULL;
    }

    // if we've got a cached control bar, release it
    if (m_ipControlBar) {
        m_ipControlBar->Release();
        m_ipControlBar = NULL;
    }

    //
    // Install new pieces if necessary
    //

    // if a new one came in, cache and AddRef
    if (pControlbar) {
        m_ipControlBar = pControlbar;
        m_ipControlBar->AddRef();

        hr = m_ipControlBar->Create(TOOLBAR,  // type of control to be created
            dynamic_cast<IExtendControlbar *>(this),
            reinterpret_cast<IUnknown **>(&m_ipToolbar));
        _ASSERT(SUCCEEDED(hr));

        // The IControlbar::Create AddRefs the toolbar object it created
        // so no need to do any addref on the interface.

        // add the bitmap to the toolbar
        HBITMAP hbmp = LoadBitmap(g_hinst, MAKEINTRESOURCE(IDR_TOOLBAR1));
        hr = m_ipToolbar->AddBitmap(3, hbmp, 16, 16, RGB(0, 128, 128)); // NOTE, hardcoded value 3
        _ASSERT(SUCCEEDED(hr));

        // Add the buttons to the toolbar
        hr = m_ipToolbar->AddButtons(ARRAYLEN(SnapinButtons1), SnapinButtons1);
        _ASSERT(SUCCEEDED(hr));
    }

    return hr;
}

virtual HRESULT STDMETHODCALLTYPE CComponent::SetControlbar ( LPCONTROLBAR pControlbar ) [virtual]
HRESULT STDMETHODCALLTYPE CComponent::SetControlbar ( LPCONTROLBAR ipControlbar )
virtual HRESULT STDMETHODCALLTYPE CComponent::SortItems | ( | int | nColumn,
 |  | DWORD | dwSortOptions,
 |  | LPARAM | lUserParam |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponent::SortItems | ( | int | nColumn,
 |  | DWORD | dwSortOptions,
 |  | LPARAM | lUserParam |
 | ) |  |  | [virtual]
STDMETHODIMP CComponent::SortItems | ( | int | nColumn,
 |  | DWORD | dwSortOptions,
 |  | LPARAM | lUserParam |
 | ) |  |  | [virtual]

Definition at line 419 of file comp.Cpp.

{
    return E_NOTIMPL;
}

CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
CComponent::STDMETHODIMP_ ( ULONG )
HRESULT CComponent::TaskNotify | ( | IDataObject __RPC_FAR * | pdo,
 |  | VARIANT __RPC_FAR * | arg,
 |  | VARIANT __RPC_FAR * | param |
 | ) |  |  | [virtual]

Definition at line 244 of file comp.Cpp.

{
    CDelegationBase *base = GetOurDataObject(pdo)->GetBaseNodeObject();

    return base->TaskNotify(m_ipConsole, arg, param);
}

Member Data Documentation

BOOL CComponent::m_bIsTaskpadPreferred [private]

Definition at line 39 of file comp.h.

BOOL CComponent::m_bTaskpadView [private]

Definition at line 37 of file comp.h.

ULONG CComponent::m_cRef [private]

Definition at line 92 of file comp.h.

ULONG CComponent::m_cref [private]

Definition at line 27 of file comp.h.

HBITMAP CComponent::m_hImageStrip16 [private]

Definition at line 97 of file comp.h.

HBITMAP CComponent::m_hImageStrip32 [private]

Definition at line 98 of file comp.h.

LPCONSOLE3 CComponent::m_ipConsole [private]

Definition at line 96 of file comp.h.

IConsole * CComponent::m_ipConsole [private]

Definition at line 29 of file comp.h.

IConsole3* CComponent::m_ipConsole [private]

Definition at line 99 of file comp.h.

IConsole2* CComponent::m_ipConsole2 [private]

Definition at line 34 of file comp.h.

LPCONSOLEVERB CComponent::m_ipConsoleVerb [private]

Definition at line 100 of file comp.h.

IControlbar * CComponent::m_ipControlBar [private]

Definition at line 31 of file comp.h.

IControlbar* CComponent::m_ipControlbar [private]

Definition at line 118 of file comp.h.

IToolbar* CComponent::m_ipDeviceToolbar [private]

Definition at line 120 of file comp.h.

IDisplayHelp * CComponent::m_ipDisplayHelp [private]

Definition at line 30 of file comp.h.

LPHEADERCTRL2 CComponent::m_ipHeaderCtrl [private]

Definition at line 99 of file comp.h.

LPHEADERCTRL2 CComponent::m_ipHeaderCtrl2 [private]

Definition at line 102 of file comp.h.

IMenuButton* CComponent::m_ipMenuButton [private]

Definition at line 34 of file comp.h.

LPRESULTDATA CComponent::m_ipResultData [private]

Definition at line 101 of file comp.h.

LPRESULTDATA CComponent::m_ipResultData [private]

Definition at line 98 of file comp.h.

IToolbar* CComponent::m_ipStaticToolbar [private]

Definition at line 119 of file comp.h.

IToolbar * CComponent::m_ipToolbar [private]

Definition at line 32 of file comp.h.

IToolbar* CComponent::m_ipVFileToolbar [private]

Definition at line 121 of file comp.h.

class CComponentData * CComponent::m_pComponentData [private]

Definition at line 31 of file comp.h.

CComponentData* CComponent::m_pComponentData [private]

Definition at line 93 of file comp.h.

class CDelegationBase * CComponent::m_pLastNode [private]

Definition at line 32 of file comp.h.

class CComponentData * CComponent::m_pParent [private]

Definition at line 31 of file comp.h.

INT_PTR CComponent::m_pScopeCookie [private]

Definition at line 116 of file comp.h.

LONG_PTR CComponent::m_pScopeCookie [private]

Definition at line 101 of file comp.h.

The documentation for this class was generated from the following files:
  • SysMgmt/MMC/About/comp.h
  • SysMgmt/MMC/ActiveX/comp.h
  • SysMgmt/MMC/CMenu/comp.h
  • SysMgmt/MMC/Complete/comp.h
  • SysMgmt/MMC/CutCopy/comp.h
  • SysMgmt/MMC/Extens/comp.h
  • SysMgmt/MMC/Help/Comp.h
  • SysMgmt/MMC/Menubtn/comp.h
  • SysMgmt/MMC/mmc2.0/about/comp.h
  • SysMgmt/MMC/mmc2.0/contextmenu/comp.h
  • SysMgmt/MMC/mmc2.0/dragdrop/comp.h
  • SysMgmt/MMC/mmc2.0/help/comp.h
  • SysMgmt/MMC/mmc2.0/multisel/comp.h
  • SysMgmt/MMC/mmc2.0/proppage/comp.h
  • SysMgmt/MMC/mmc2.0/simple/comp.h
  • SysMgmt/MMC/mmc2.0/viewex/comp.h
  • SysMgmt/MMC/Multisel/comp.h
  • SysMgmt/MMC/Nameext/comp.h
  • SysMgmt/MMC/Nodes/comp.h
  • SysMgmt/MMC/Openserv/comp.h
  • SysMgmt/MMC/Proppage/comp.h
  • SysMgmt/MMC/Simple/comp.h
  • SysMgmt/MMC/Taskpads/comp.h
  • SysMgmt/MMC/Toolbar/comp.h
  • SysMgmt/MMC/WMI/comp.h
  • SysMgmt/MMC/About/comp.Cpp
  • SysMgmt/MMC/ActiveX/comp.Cpp
  • SysMgmt/MMC/CMenu/comp.Cpp
  • SysMgmt/MMC/Complete/comp.Cpp
  • SysMgmt/MMC/CutCopy/comp.Cpp
  • SysMgmt/MMC/Extens/comp.Cpp
  • SysMgmt/MMC/Help/Comp.Cpp
  • SysMgmt/MMC/Menubtn/comp.Cpp
  • SysMgmt/MMC/mmc2.0/about/comp.cpp
  • SysMgmt/MMC/mmc2.0/contextmenu/comp.cpp
  • SysMgmt/MMC/mmc2.0/dragdrop/comp.cpp
  • SysMgmt/MMC/mmc2.0/help/comp.cpp
  • SysMgmt/MMC/mmc2.0/multisel/comp.cpp
  • SysMgmt/MMC/mmc2.0/proppage/comp.cpp
  • SysMgmt/MMC/mmc2.0/simple/comp.cpp
  • SysMgmt/MMC/mmc2.0/viewex/comp.cpp
  • SysMgmt/MMC/Multisel/comp.Cpp
  • SysMgmt/MMC/Nameext/comp.Cpp
  • SysMgmt/MMC/Nodes/comp.Cpp
  • SysMgmt/MMC/Openserv/comp.Cpp
  • SysMgmt/MMC/Proppage/comp.Cpp
  • SysMgmt/MMC/Simple/comp.Cpp
  • SysMgmt/MMC/Taskpads/comp.Cpp
  • SysMgmt/MMC/Toolbar/comp.Cpp
  • SysMgmt/MMC/WMI/comp.Cpp
Generated on Wed Nov 13 2024 16:55:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CComponentData Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Attributes | Static Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | Friends

CComponentData Class Reference

#include "compdata.h"

List of all members.

Public Member Functions

CComponentData ()
CComponentData ()
CComponentData ()
CComponentData ()
CComponentData ()
CComponentData ()
CComponentData ()
CComponentData ()
CComponentData ()
CComponentData ()
CComponentData ()
CComponentData ()
CComponentData ()
CComponentData ()
CComponentData ()
CComponentData ()
CComponentData ()
CComponentData ()
CComponentData ()
CComponentData ()
CComponentData ()
CComponentData ()
CComponentData ()
CComponentData ()
CComponentData ()
~CComponentData ()
~CComponentData ()
~CComponentData ()
~CComponentData ()
~CComponentData ()
~CComponentData ()
~CComponentData ()
~CComponentData ()
~CComponentData ()
~CComponentData ()
~CComponentData ()
~CComponentData ()
~CComponentData ()
~CComponentData ()
~CComponentData ()
~CComponentData ()
~CComponentData ()
~CComponentData ()
~CComponentData ()
~CComponentData ()
~CComponentData ()
~CComponentData ()
~CComponentData ()
~CComponentData ()
~CComponentData ()
virtual HRESULT STDMETHODCALLTYPE | AddMenuItems (LPDATAOBJECT piDataObject, LPCONTEXTMENUCALLBACK piCallback, long __RPC_FAR *pInsertionAllowed)
virtual HRESULT STDMETHODCALLTYPE | AddMenuItems (LPDATAOBJECT piDataObject, LPCONTEXTMENUCALLBACK piCallback, long __RPC_FAR *pInsertionAllowed)
HRESULT STDMETHODCALLTYPE | AddMenuItems (LPDATAOBJECT ipDataObject, LPCONTEXTMENUCALLBACK ipCallback, long __RPC_FAR *pInsertionAllowed)
HRESULT STDMETHODCALLTYPE | AddMenuItems (LPDATAOBJECT ipDataObject, LPCONTEXTMENUCALLBACK ipCallback, long __RPC_FAR *pInsertionAllowed)
HRESULT STDMETHODCALLTYPE | AddMenuItems (LPDATAOBJECT ipDataObject, LPCONTEXTMENUCALLBACK ipCallback, long __RPC_FAR *pInsertionAllowed)
HRESULT STDMETHODCALLTYPE | AddMenuItems (LPDATAOBJECT ipDataObject, LPCONTEXTMENUCALLBACK ipCallback, long __RPC_FAR *pInsertionAllowed)
HRESULT STDMETHODCALLTYPE | AddMenuItems (LPDATAOBJECT ipDataObject, LPCONTEXTMENUCALLBACK ipCallback, long __RPC_FAR *pInsertionAllowed)
virtual HRESULT STDMETHODCALLTYPE | AddMenuItems (LPDATAOBJECT piDataObject, LPCONTEXTMENUCALLBACK piCallback, long __RPC_FAR *pInsertionAllowed)
HRESULT STDMETHODCALLTYPE | AddMenuItems (LPDATAOBJECT ipDataObject, LPCONTEXTMENUCALLBACK ipCallback, long __RPC_FAR *pInsertionAllowed)
virtual HRESULT STDMETHODCALLTYPE | Command (long lCommandID, LPDATAOBJECT piDataObject)
HRESULT STDMETHODCALLTYPE | Command (long lCommandID, LPDATAOBJECT piDataObject)
HRESULT STDMETHODCALLTYPE | Command (long lCommandID, LPDATAOBJECT piDataObject)
virtual HRESULT STDMETHODCALLTYPE | Command (long lCommandID, LPDATAOBJECT piDataObject)
HRESULT STDMETHODCALLTYPE | Command (long lCommandID, LPDATAOBJECT piDataObject)
HRESULT STDMETHODCALLTYPE | Command (long lCommandID, LPDATAOBJECT piDataObject)
HRESULT STDMETHODCALLTYPE | Command (long lCommandID, LPDATAOBJECT piDataObject)
virtual HRESULT STDMETHODCALLTYPE | Command (long lCommandID, LPDATAOBJECT piDataObject)
HRESULT STDMETHODCALLTYPE | Command (long lCommandID, LPDATAOBJECT piDataObject)
HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT ipDataObjectA, LPDATAOBJECT ipDataObjectB)
virtual HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB)
virtual HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB)
virtual HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB)
virtual HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB)
virtual HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB)
HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT ipDataObjectA, LPDATAOBJECT ipDataObjectB)
virtual HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB)
virtual HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB)
virtual HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB)
HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT ipDataObjectA, LPDATAOBJECT ipDataObjectB)
virtual HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB)
virtual HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB)
virtual HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB)
virtual HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB)
HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT ipDataObjectA, LPDATAOBJECT ipDataObjectB)
virtual HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB)
HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT ipDataObjectA, LPDATAOBJECT ipDataObjectB)
virtual HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB)
virtual HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB)
virtual HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB)
HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB)
HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT ipDataObjectA, LPDATAOBJECT ipDataObjectB)
HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB)
virtual HRESULT STDMETHODCALLTYPE | CompareObjects (LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB)
HRESULT STDMETHODCALLTYPE | CreateComponent (LPCOMPONENT __RPC_FAR *ppComponent)
virtual HRESULT STDMETHODCALLTYPE | CreateComponent (LPCOMPONENT __RPC_FAR *ppComponent)
virtual HRESULT STDMETHODCALLTYPE | CreateComponent (LPCOMPONENT __RPC_FAR *ppComponent)
virtual HRESULT STDMETHODCALLTYPE | CreateComponent (LPCOMPONENT __RPC_FAR *ppComponent)
virtual HRESULT STDMETHODCALLTYPE | CreateComponent (LPCOMPONENT __RPC_FAR *ppComponent)
virtual HRESULT STDMETHODCALLTYPE | CreateComponent (LPCOMPONENT __RPC_FAR *ppComponent)
HRESULT STDMETHODCALLTYPE | CreateComponent (LPCOMPONENT __RPC_FAR *ppComponent)
virtual HRESULT STDMETHODCALLTYPE | CreateComponent (LPCOMPONENT __RPC_FAR *ppComponent)
virtual HRESULT STDMETHODCALLTYPE | CreateComponent (LPCOMPONENT __RPC_FAR *ppComponent)
virtual HRESULT STDMETHODCALLTYPE | CreateComponent (LPCOMPONENT __RPC_FAR *ppComponent)
virtual HRESULT STDMETHODCALLTYPE | CreateComponent (LPCOMPONENT __RPC_FAR *ppComponent)
HRESULT STDMETHODCALLTYPE | CreateComponent (LPCOMPONENT __RPC_FAR *ppComponent)
virtual HRESULT STDMETHODCALLTYPE | CreateComponent (LPCOMPONENT __RPC_FAR *ppComponent)
virtual HRESULT STDMETHODCALLTYPE | CreateComponent (LPCOMPONENT __RPC_FAR *ppComponent)
virtual HRESULT STDMETHODCALLTYPE | CreateComponent (LPCOMPONENT __RPC_FAR *ppComponent)
virtual HRESULT STDMETHODCALLTYPE | CreateComponent (LPCOMPONENT __RPC_FAR *ppComponent)
HRESULT STDMETHODCALLTYPE | CreateComponent (LPCOMPONENT __RPC_FAR *ppComponent)
virtual HRESULT STDMETHODCALLTYPE | CreateComponent (LPCOMPONENT __RPC_FAR *ppComponent)
HRESULT STDMETHODCALLTYPE | CreateComponent (LPCOMPONENT __RPC_FAR *ppComponent)
virtual HRESULT STDMETHODCALLTYPE | CreateComponent (LPCOMPONENT __RPC_FAR *ppComponent)
virtual HRESULT STDMETHODCALLTYPE | CreateComponent (LPCOMPONENT __RPC_FAR *ppComponent)
HRESULT STDMETHODCALLTYPE | CreateComponent (LPCOMPONENT __RPC_FAR *ppComponent)
HRESULT STDMETHODCALLTYPE | CreateComponent (LPCOMPONENT __RPC_FAR *ppComponent)
HRESULT STDMETHODCALLTYPE | CreateComponent (LPCOMPONENT __RPC_FAR *ppComponent)
virtual HRESULT STDMETHODCALLTYPE | CreateComponent (LPCOMPONENT __RPC_FAR *ppComponent)
virtual HRESULT STDMETHODCALLTYPE | CreatePropertyPages (LPPROPERTYSHEETCALLBACK lpProvider, LONG_PTR handle, LPDATAOBJECT lpIDataObject)
virtual HRESULT STDMETHODCALLTYPE | CreatePropertyPages (LPPROPERTYSHEETCALLBACK lpProvider, LONG_PTR handle, LPDATAOBJECT lpIDataObject)
virtual HRESULT STDMETHODCALLTYPE | CreatePropertyPages (LPPROPERTYSHEETCALLBACK lpProvider, LONG_PTR handle, LPDATAOBJECT lpIDataObject)
virtual HRESULT STDMETHODCALLTYPE | CreatePropertyPages (LPPROPERTYSHEETCALLBACK lpProvider, LONG_PTR handle, LPDATAOBJECT lpIDataObject)
HRESULT STDMETHODCALLTYPE | Destroy (void)
virtual HRESULT STDMETHODCALLTYPE | Destroy (void)
virtual HRESULT STDMETHODCALLTYPE | Destroy (void)
virtual HRESULT STDMETHODCALLTYPE | Destroy (void)
virtual HRESULT STDMETHODCALLTYPE | Destroy (void)
virtual HRESULT STDMETHODCALLTYPE | Destroy (void)
virtual HRESULT STDMETHODCALLTYPE | Destroy (void)
HRESULT STDMETHODCALLTYPE | Destroy (void)
virtual HRESULT STDMETHODCALLTYPE | Destroy (void)
virtual HRESULT STDMETHODCALLTYPE | Destroy (void)
HRESULT STDMETHODCALLTYPE | Destroy (void)
virtual HRESULT STDMETHODCALLTYPE | Destroy (void)
virtual HRESULT STDMETHODCALLTYPE | Destroy (void)
virtual HRESULT STDMETHODCALLTYPE | Destroy (void)
virtual HRESULT STDMETHODCALLTYPE | Destroy (void)
virtual HRESULT STDMETHODCALLTYPE | Destroy (void)
HRESULT STDMETHODCALLTYPE | Destroy (void)
virtual HRESULT STDMETHODCALLTYPE | Destroy (void)
virtual HRESULT STDMETHODCALLTYPE | Destroy (void)
HRESULT STDMETHODCALLTYPE | Destroy (void)
virtual HRESULT STDMETHODCALLTYPE | Destroy (void)
HRESULT STDMETHODCALLTYPE | Destroy (void)
HRESULT STDMETHODCALLTYPE | Destroy (void)
HRESULT STDMETHODCALLTYPE | Destroy (void)
virtual HRESULT STDMETHODCALLTYPE | Destroy (void)
virtual HRESULT STDMETHODCALLTYPE | GetClassID (CLSID __RPC_FAR *pClassID)
virtual HRESULT STDMETHODCALLTYPE | GetClassID (CLSID __RPC_FAR *pClassID)
LPCONSOLENAMESPACE | GetConsoleNameSpace ()
virtual HRESULT STDMETHODCALLTYPE | GetDisplayInfo (SCOPEDATAITEM __RPC_FAR *pScopeDataItem)
HRESULT STDMETHODCALLTYPE | GetDisplayInfo (SCOPEDATAITEM __RPC_FAR *pScopeDataItem)
virtual HRESULT STDMETHODCALLTYPE | GetDisplayInfo (SCOPEDATAITEM __RPC_FAR *pScopeDataItem)
virtual HRESULT STDMETHODCALLTYPE | GetDisplayInfo (SCOPEDATAITEM __RPC_FAR *pScopeDataItem)
virtual HRESULT STDMETHODCALLTYPE | GetDisplayInfo (SCOPEDATAITEM __RPC_FAR *pScopeDataItem)
virtual HRESULT STDMETHODCALLTYPE | GetDisplayInfo (SCOPEDATAITEM __RPC_FAR *pScopeDataItem)
virtual HRESULT STDMETHODCALLTYPE | GetDisplayInfo (SCOPEDATAITEM __RPC_FAR *pScopeDataItem)
HRESULT STDMETHODCALLTYPE | GetDisplayInfo (SCOPEDATAITEM __RPC_FAR *pScopeDataItem)
virtual HRESULT STDMETHODCALLTYPE | GetDisplayInfo (SCOPEDATAITEM __RPC_FAR *pScopeDataItem)
virtual HRESULT STDMETHODCALLTYPE | GetDisplayInfo (SCOPEDATAITEM __RPC_FAR *pScopeDataItem)
virtual HRESULT STDMETHODCALLTYPE | GetDisplayInfo (SCOPEDATAITEM __RPC_FAR *pScopeDataItem)
virtual HRESULT STDMETHODCALLTYPE | GetDisplayInfo (SCOPEDATAITEM __RPC_FAR *pScopeDataItem)
HRESULT STDMETHODCALLTYPE | GetDisplayInfo (SCOPEDATAITEM __RPC_FAR *pScopeDataItem)
virtual HRESULT STDMETHODCALLTYPE | GetDisplayInfo (SCOPEDATAITEM __RPC_FAR *pScopeDataItem)
virtual HRESULT STDMETHODCALLTYPE | GetDisplayInfo (SCOPEDATAITEM __RPC_FAR *pScopeDataItem)
virtual HRESULT STDMETHODCALLTYPE | GetDisplayInfo (SCOPEDATAITEM __RPC_FAR *pScopeDataItem)
HRESULT STDMETHODCALLTYPE | GetDisplayInfo (SCOPEDATAITEM __RPC_FAR *pScopeDataItem)
HRESULT STDMETHODCALLTYPE | GetDisplayInfo (SCOPEDATAITEM __RPC_FAR *pScopeDataItem)
virtual HRESULT STDMETHODCALLTYPE | GetDisplayInfo (SCOPEDATAITEM __RPC_FAR *pScopeDataItem)
virtual HRESULT STDMETHODCALLTYPE | GetDisplayInfo (SCOPEDATAITEM __RPC_FAR *pScopeDataItem)
HRESULT STDMETHODCALLTYPE | GetDisplayInfo (SCOPEDATAITEM __RPC_FAR *pScopeDataItem)
HRESULT STDMETHODCALLTYPE | GetDisplayInfo (SCOPEDATAITEM __RPC_FAR *pScopeDataItem)
HRESULT STDMETHODCALLTYPE | GetDisplayInfo (SCOPEDATAITEM __RPC_FAR *pScopeDataItem)
virtual HRESULT STDMETHODCALLTYPE | GetDisplayInfo (SCOPEDATAITEM __RPC_FAR *pScopeDataItem)
virtual HRESULT STDMETHODCALLTYPE | GetDisplayInfo (SCOPEDATAITEM __RPC_FAR *pScopeDataItem)
LPOLESTR GetHelpPath ()
virtual HRESULT STDMETHODCALLTYPE | GetHelpTopic (LPOLESTR __RPC_FAR *lpCompiledHelpFile)
HRESULT STDMETHODCALLTYPE | GetHelpTopic (LPOLESTR *lpHelpFilePath)
virtual HRESULT STDMETHODCALLTYPE | GetHelpTopic (LPOLESTR __RPC_FAR *lpCompiledHelpFile)
virtual HRESULT STDMETHODCALLTYPE | GetHelpTopic (LPOLESTR __RPC_FAR *lpCompiledHelpFile)
virtual HRESULT STDMETHODCALLTYPE | GetHelpTopic (LPOLESTR __RPC_FAR *lpCompiledHelpFile)
virtual HRESULT STDMETHODCALLTYPE | GetHelpTopic (LPOLESTR __RPC_FAR *lpCompiledHelpFile)
HRESULT | GetInterface (DWORD dwRequestedInterface, LONG_PTR *ppInterface)
HRESULT | GetInterface (DWORD dwRequestedInterface, LONG_PTR *ppInterface)
HRESULT | GetInterface (DWORD dwRequestedInterface, LONG_PTR *ppInterface)
HRESULT | GetInterface (DWORD dwRequestedInterface, LONG_PTR *ppInterface)
HRESULT | GetInterface (DWORD dwRequestedInterface, LONG_PTR *ppInterface)
HRESULT | GetInterface (DWORD dwRequestedInterface, LONG_PTR *ppInterface)
HRESULT STDMETHODCALLTYPE | GetLinkedTopics (LPOLESTR *lpHelpFilePath)
virtual HRESULT STDMETHODCALLTYPE | GetLinkedTopics (LPOLESTR __RPC_FAR *lpCompiledHelpFiles)
const GUID & | getPrimaryNodeType ()
virtual HRESULT STDMETHODCALLTYPE | GetSizeMax (ULARGE_INTEGER __RPC_FAR *pcbSize)
virtual HRESULT STDMETHODCALLTYPE | GetSizeMax (ULARGE_INTEGER __RPC_FAR *pcbSize)
CStaticNode * GetStaticNode ()
CStaticNode * GetStaticNode ()
CStaticNode * GetStaticNode ()
CStaticNode * GetStaticNode ()
CStaticNode * GetStaticNode ()
CStaticNode * GetStaticNode ()
CStaticNode * GetStaticNode ()
CStaticNode * GetStaticNode ()
virtual HRESULT STDMETHODCALLTYPE | GetWatermarks (LPDATAOBJECT lpIDataObject, HBITMAP __RPC_FAR *lphWatermark, HBITMAP __RPC_FAR *lphHeader, HPALETTE __RPC_FAR *lphPalette, BOOL __RPC_FAR *bStretch)
virtual HRESULT STDMETHODCALLTYPE | GetWatermarks (LPDATAOBJECT lpIDataObject, HBITMAP __RPC_FAR *lphWatermark, HBITMAP __RPC_FAR *lphHeader, HPALETTE __RPC_FAR *lphPalette, BOOL __RPC_FAR *bStretch)
virtual HRESULT STDMETHODCALLTYPE | GetWatermarks (LPDATAOBJECT lpIDataObject, HBITMAP __RPC_FAR *lphWatermark, HBITMAP __RPC_FAR *lphHeader, HPALETTE __RPC_FAR *lphPalette, BOOL __RPC_FAR *bStretch)
virtual HRESULT STDMETHODCALLTYPE | GetWatermarks (LPDATAOBJECT lpIDataObject, HBITMAP __RPC_FAR *lphWatermark, HBITMAP __RPC_FAR *lphHeader, HPALETTE __RPC_FAR *lphPalette, BOOL __RPC_FAR *bStretch)
HRESULT STDMETHODCALLTYPE | Initialize (LPUNKNOWN pUnknown)
virtual HRESULT STDMETHODCALLTYPE | Initialize (LPUNKNOWN pUnknown)
virtual HRESULT STDMETHODCALLTYPE | Initialize (LPUNKNOWN pUnknown)
virtual HRESULT STDMETHODCALLTYPE | Initialize (LPUNKNOWN pUnknown)
virtual HRESULT STDMETHODCALLTYPE | Initialize (LPUNKNOWN pUnknown)
HRESULT STDMETHODCALLTYPE | Initialize (LPUNKNOWN pUnknown)
virtual HRESULT STDMETHODCALLTYPE | Initialize (LPUNKNOWN pUnknown)
virtual HRESULT STDMETHODCALLTYPE | Initialize (LPUNKNOWN pUnknown)
virtual HRESULT STDMETHODCALLTYPE | Initialize (LPUNKNOWN pUnknown)
virtual HRESULT STDMETHODCALLTYPE | Initialize (LPUNKNOWN pUnknown)
HRESULT STDMETHODCALLTYPE | Initialize (LPUNKNOWN pUnknown)
virtual HRESULT STDMETHODCALLTYPE | Initialize (LPUNKNOWN pUnknown)
virtual HRESULT STDMETHODCALLTYPE | Initialize (LPUNKNOWN pUnknown)
virtual HRESULT STDMETHODCALLTYPE | Initialize (LPUNKNOWN pUnknown)
HRESULT STDMETHODCALLTYPE | Initialize (LPUNKNOWN pUnknown)
virtual HRESULT STDMETHODCALLTYPE | Initialize (LPUNKNOWN pUnknown)
HRESULT STDMETHODCALLTYPE | Initialize (LPUNKNOWN pUnknown)
virtual HRESULT STDMETHODCALLTYPE | Initialize (LPUNKNOWN pUnknown)
HRESULT STDMETHODCALLTYPE | Initialize (LPUNKNOWN pUnknown)
virtual HRESULT STDMETHODCALLTYPE | Initialize (LPUNKNOWN pUnknown)
HRESULT STDMETHODCALLTYPE | Initialize (LPUNKNOWN pUnknown)
virtual HRESULT STDMETHODCALLTYPE | Initialize (LPUNKNOWN pUnknown)
HRESULT STDMETHODCALLTYPE | Initialize (LPUNKNOWN pUnknown)
virtual HRESULT STDMETHODCALLTYPE | Initialize (LPUNKNOWN pUnknown)
virtual HRESULT STDMETHODCALLTYPE | Initialize (LPUNKNOWN pUnknown)
virtual HRESULT STDMETHODCALLTYPE | IsDirty (void)
virtual HRESULT STDMETHODCALLTYPE | IsDirty (void)
virtual HRESULT STDMETHODCALLTYPE | Load (IStream __RPC_FAR *pStm)
virtual HRESULT STDMETHODCALLTYPE | Load (IStream __RPC_FAR *pStm)
virtual HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT lpDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)
virtual HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT lpDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)
virtual HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT lpDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)
virtual HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT lpDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)
virtual HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT lpDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)
virtual HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT lpDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)
virtual HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT lpDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)
HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT ipDataObject, MMC_NOTIFY_TYPE MmcEvent, LONG nArg, LONG nParam)
HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT ipDataObject, MMC_NOTIFY_TYPE MmcEvent, LPARAM nArg, LPARAM nParam)
virtual HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT lpDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)
HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT ipDataObject, MMC_NOTIFY_TYPE MmcEvent, LONG nArg, LONG nParam)
virtual HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT lpDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)
virtual HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT lpDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)
virtual HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT lpDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)
virtual HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT lpDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)
HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT ipDataObject, MMC_NOTIFY_TYPE MmcEvent, LONG nArg, LONG nParam)
virtual HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT lpDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)
HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT ipDataObject, MMC_NOTIFY_TYPE MmcEvent, LONG nArg, LONG nParam)
virtual HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT lpDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)
virtual HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT lpDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)
HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT ipDataObject, MMC_NOTIFY_TYPE MmcEvent, LONG nArg, LONG nParam)
HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT ipDataObject, MMC_NOTIFY_TYPE MmcEvent, LONG nArg, LONG nParam)
HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT ipDataObject, MMC_NOTIFY_TYPE MmcEvent, LPARAM nArg, LPARAM nParam)
virtual HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT lpDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)
virtual HRESULT STDMETHODCALLTYPE | Notify (LPDATAOBJECT lpDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)
HRESULT | OnExpand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
virtual HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT __RPC_FAR *ppDataObject)
virtual HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT __RPC_FAR *ppDataObject)
virtual HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT __RPC_FAR *ppDataObject)
virtual HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT __RPC_FAR *ppDataObject)
virtual HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT __RPC_FAR *ppDataObject)
HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE uCookie, DATA_OBJECT_TYPES nEnumType, LPDATAOBJECT __RPC_FAR *ppDataObject)
HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE uCookie, DATA_OBJECT_TYPES nEnumType, LPDATAOBJECT __RPC_FAR *ppDataObject)
HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE uCookie, DATA_OBJECT_TYPES nEnumType, LPDATAOBJECT __RPC_FAR *ppDataObject)
virtual HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT __RPC_FAR *ppDataObject)
virtual HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT __RPC_FAR *ppDataObject)
HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE uCookie, DATA_OBJECT_TYPES nEnumType, LPDATAOBJECT __RPC_FAR *ppDataObject)
virtual HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT __RPC_FAR *ppDataObject)
HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE nCookie, DATA_OBJECT_TYPES nEnumType, LPDATAOBJECT __RPC_FAR *ppDataObject)
HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE uCookie, DATA_OBJECT_TYPES nEnumType, LPDATAOBJECT __RPC_FAR *ppDataObject)
virtual HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT __RPC_FAR *ppDataObject)
virtual HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT __RPC_FAR *ppDataObject)
virtual HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT __RPC_FAR *ppDataObject)
virtual HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT __RPC_FAR *ppDataObject)
HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE uCookie, DATA_OBJECT_TYPES nEnumType, LPDATAOBJECT __RPC_FAR *ppDataObject)
virtual HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT __RPC_FAR *ppDataObject)
virtual HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT __RPC_FAR *ppDataObject)
virtual HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT __RPC_FAR *ppDataObject)
virtual HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT __RPC_FAR *ppDataObject)
HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE uCookie, DATA_OBJECT_TYPES nEnumType, LPDATAOBJECT __RPC_FAR *ppDataObject)
virtual HRESULT STDMETHODCALLTYPE | QueryDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT __RPC_FAR *ppDataObject)
HRESULT STDMETHODCALLTYPE | QueryDispatch (MMC_COOKIE nCookie, DATA_OBJECT_TYPES eType, LPDISPATCH *pipDispatch)
HRESULT STDMETHODCALLTYPE | QueryDispatch (MMC_COOKIE nCookie, DATA_OBJECT_TYPES eType, LPDISPATCH *pipDispatch)
HRESULT STDMETHODCALLTYPE | QueryDispatch (MMC_COOKIE nCookie, DATA_OBJECT_TYPES eType, LPDISPATCH *pipDispatch)
HRESULT STDMETHODCALLTYPE | QueryDispatch (MMC_COOKIE nCookie, DATA_OBJECT_TYPES eType, LPDISPATCH *pipDispatch)
HRESULT STDMETHODCALLTYPE | QueryDispatch (MMC_COOKIE nCookie, DATA_OBJECT_TYPES eType, LPDISPATCH *pipDispatch)
HRESULT STDMETHODCALLTYPE | QueryDispatch (MMC_COOKIE nCookie, DATA_OBJECT_TYPES eType, LPDISPATCH *pipDispatch)
HRESULT STDMETHODCALLTYPE | QueryDispatch (MMC_COOKIE nCookie, DATA_OBJECT_TYPES eType, LPDISPATCH *pipDispatch)
HRESULT STDMETHODCALLTYPE | QueryDispatch (MMC_COOKIE nCookie, DATA_OBJECT_TYPES eType, LPDISPATCH *pipDispatch)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
virtual HRESULT STDMETHODCALLTYPE | QueryPagesFor (LPDATAOBJECT lpDataObject)
virtual HRESULT STDMETHODCALLTYPE | QueryPagesFor (LPDATAOBJECT lpDataObject)
virtual HRESULT STDMETHODCALLTYPE | QueryPagesFor (LPDATAOBJECT lpDataObject)
virtual HRESULT STDMETHODCALLTYPE | QueryPagesFor (LPDATAOBJECT lpDataObject)
virtual HRESULT STDMETHODCALLTYPE | Save (IStream __RPC_FAR *pStm, BOOL fClearDirty)
virtual HRESULT STDMETHODCALLTYPE | Save (IStream __RPC_FAR *pStm, BOOL fClearDirty)
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()

Static Public Attributes

static HBITMAP | m_pBMapLg = NULL
static HBITMAP | m_pBMapSm = NULL

Static Protected Member Functions

static void | LoadBitmaps ()

Protected Attributes

BOOL bExpanded

Private Types

enum | { NUMBER_OF_CHILDREN = 1 }

Private Member Functions

HRESULT | ExtractData (IDataObject *piDataObject, CLIPFORMAT cfClipFormat, BYTE *pbData, DWORD cbData)
HRESULT | ExtractObjectTypeGUID (IDataObject *piDataObject, GUID *pguidObjectType)
HRESULT | ExtractSnapInCLSID (IDataObject *piDataObject, CLSID *pclsidSnapin)
HRESULT | ExtractString (IDataObject *piDataObject, CLIPFORMAT cfClipFormat, _TCHAR *pstr, DWORD cchMaxLength)

Private Attributes

CDelegationBase * | children [1]
ULONG m_cref
ULONG m_cRef
WCHAR | m_HelpFile [MAX_PATH]
HBITMAP | m_hImageStrip16
HBITMAP | m_hImageStrip32
HSCOPEITEM | m_hStaticNode
LPCONSOLE3 | m_ipConsole
LPCONSOLE | m_ipConsole
LPCONSOLE | m_ipConsole2
LPCONSOLENAMESPACE2 | m_ipConsoleNameSpace
LPCONSOLENAMESPACE | m_ipConsoleNameSpace
LPCONSOLENAMESPACE | m_ipConsoleNameSpace2
LPCONSOLENAMESPACE2 | m_ipConsoleNameSpace2
LPIMAGELIST | m_ipScopeImage
CStaticNode * m_pStaticNode
LPOLESTR m_pszwHelpPath

Static Private Attributes

static UINT | s_cfDisplayName = RegisterClipboardFormat(_T_CCF_DISPLAY_NAME)
static UINT | s_cfNodeType = RegisterClipboardFormat(_T_CCF_NODETYPE)
static UINT | s_cfSnapInCLSID = RegisterClipboardFormat(_T_CCF_SNAPIN_CLASSID)
static const GUID | skybasedvehicleGuid = { 0x2974380f, 0x4c4b, 0x11d2, { 0x89, 0xd8, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28 } }

Friends

class | CComponent

Detailed Description

Definition at line 27 of file compdata.h.

Member Enumeration Documentation

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 46 of file nameext.h.

{ NUMBER_OF_CHILDREN = 1 };

Constructor & Destructor Documentation

CComponentData::CComponentData ( )

Definition at line 25 of file compdata.Cpp.

: m_cref(0), m_ipConsoleNameSpace(NULL), m_ipConsole(NULL)
{
    OBJECT_CREATED

        m_pStaticNode = new CStaticNode;
}

CComponentData::~CComponentData ( )

Definition at line 33 of file compdata.Cpp.

{
    if (m_pStaticNode) {
        delete m_pStaticNode;
    }

    OBJECT_DESTROYED
}

CComponentData::CComponentData ( )
CComponentData::~CComponentData ( )
CComponentData::CComponentData ( )
CComponentData::~CComponentData ( )
CComponentData::CComponentData ( )
CComponentData::~CComponentData ( )
CComponentData::CComponentData ( )
CComponentData::~CComponentData ( )
CComponentData::CComponentData ( )
CComponentData::~CComponentData ( )
CComponentData::CComponentData ( )
CComponentData::~CComponentData ( )
CComponentData::CComponentData ( )
CComponentData::~CComponentData ( )
CComponentData::CComponentData ( )
CComponentData::~CComponentData ( )
CComponentData::CComponentData ( )
CComponentData::~CComponentData ( )
CComponentData::CComponentData ( )
CComponentData::~CComponentData ( )
CComponentData::CComponentData ( )
CComponentData::~CComponentData ( )
CComponentData::CComponentData ( )
CComponentData::~CComponentData ( )
CComponentData::CComponentData ( )
CComponentData::~CComponentData ( )
CComponentData::CComponentData ( )
CComponentData::~CComponentData ( )
CComponentData::CComponentData ( )
CComponentData::~CComponentData ( )
CComponentData::CComponentData ( )
CComponentData::~CComponentData ( )
CComponentData::CComponentData ( )
CComponentData::~CComponentData ( )
CComponentData::CComponentData ( )
CComponentData::~CComponentData ( )
CComponentData::CComponentData ( )
CComponentData::~CComponentData ( )
CComponentData::CComponentData ( )
CComponentData::~CComponentData ( )
CComponentData::CComponentData ( )
CComponentData::~CComponentData ( )
CComponentData::CComponentData ( )
CComponentData::~CComponentData ( )
CComponentData::CComponentData ( )
CComponentData::~CComponentData ( )
CComponentData::CComponentData ( )
CComponentData::~CComponentData ( )

Member Function Documentation

HRESULT CComponentData::AddMenuItems | ( | LPDATAOBJECT | piDataObject,
 |  | LPCONTEXTMENUCALLBACK | piCallback,
 |  | long __RPC_FAR * | pInsertionAllowed |
 | ) |  |  | [virtual]

Definition at line 263 of file compdata.Cpp.

{
    CDelegationBase *base = GetOurDataObject(piDataObject)->GetBaseNodeObject();

    return base->OnAddMenuItems(piCallback, pInsertionAllowed);
}

HRESULT STDMETHODCALLTYPE CComponentData::AddMenuItems | ( | LPDATAOBJECT | ipDataObject,
 |  | LPCONTEXTMENUCALLBACK | ipCallback,
 |  | long __RPC_FAR * | pInsertionAllowed
 | ) |  |
HRESULT STDMETHODCALLTYPE CComponentData::AddMenuItems | ( | LPDATAOBJECT | ipDataObject,
 |  | LPCONTEXTMENUCALLBACK | ipCallback,
 |  | long __RPC_FAR * | pInsertionAllowed
 | ) |  |
HRESULT STDMETHODCALLTYPE CComponentData::AddMenuItems | ( | LPDATAOBJECT | ipDataObject,
 |  | LPCONTEXTMENUCALLBACK | ipCallback,
 |  | long __RPC_FAR * | pInsertionAllowed
 | ) |  |
HRESULT STDMETHODCALLTYPE CComponentData::AddMenuItems | ( | LPDATAOBJECT | ipDataObject,
 |  | LPCONTEXTMENUCALLBACK | ipCallback,
 |  | long __RPC_FAR * | pInsertionAllowed
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponentData::AddMenuItems | ( | LPDATAOBJECT | piDataObject,
 |  | LPCONTEXTMENUCALLBACK | piCallback,
 |  | long __RPC_FAR * | pInsertionAllowed |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::AddMenuItems | ( | LPDATAOBJECT | ipDataObject,
 |  | LPCONTEXTMENUCALLBACK | ipCallback,
 |  | long __RPC_FAR * | pInsertionAllowed
 | ) |  |
HRESULT STDMETHODCALLTYPE CComponentData::AddMenuItems | ( | LPDATAOBJECT | ipDataObject,
 |  | LPCONTEXTMENUCALLBACK | ipCallback,
 |  | long __RPC_FAR * | pInsertionAllowed
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponentData::AddMenuItems | ( | LPDATAOBJECT | piDataObject,
 |  | LPCONTEXTMENUCALLBACK | piCallback,
 |  | long __RPC_FAR * | pInsertionAllowed |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::Command | ( | long | lCommandID,
 |  | LPDATAOBJECT | piDataObject
 | ) |  |
HRESULT CComponentData::Command | ( | long | lCommandID,
 |  | LPDATAOBJECT | piDataObject |
 | ) |  |  | [virtual]

Definition at line 273 of file compdata.Cpp.

{
    CDelegationBase *base = GetOurDataObject(piDataObject)->GetBaseNodeObject();

    return base->OnMenuCommand(m_ipConsole, lCommandID);
}

HRESULT STDMETHODCALLTYPE CComponentData::Command | ( | long | lCommandID,
 |  | LPDATAOBJECT | piDataObject
 | ) |  |
HRESULT STDMETHODCALLTYPE CComponentData::Command | ( | long | lCommandID,
 |  | LPDATAOBJECT | piDataObject
 | ) |  |
HRESULT STDMETHODCALLTYPE CComponentData::Command | ( | long | lCommandID,
 |  | LPDATAOBJECT | piDataObject
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponentData::Command | ( | long | lCommandID,
 |  | LPDATAOBJECT | piDataObject |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::Command | ( | long | lCommandID,
 |  | LPDATAOBJECT | piDataObject
 | ) |  |
HRESULT STDMETHODCALLTYPE CComponentData::Command | ( | long | lCommandID,
 |  | LPDATAOBJECT | piDataObject
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponentData::Command | ( | long | lCommandID,
 |  | LPDATAOBJECT | piDataObject |
 | ) |  |  | [virtual]
HRESULT CComponentData::CompareObjects | ( | LPDATAOBJECT | lpDataObjectA,
 |  | LPDATAOBJECT | lpDataObjectB |
 | ) |  |  | [virtual]

Definition at line 185 of file compdata.Cpp.

{
    CDelegationBase *baseA = GetOurDataObject(lpDataObjectA)->GetBaseNodeObject();
    CDelegationBase *baseB = GetOurDataObject(lpDataObjectB)->GetBaseNodeObject();

    // compare the object pointers
    if (baseA->GetCookie() == baseB->GetCookie())
        return S_OK;

    return S_FALSE;
}

virtual HRESULT STDMETHODCALLTYPE CComponentData::CompareObjects | ( | LPDATAOBJECT | lpDataObjectA,
 |  | LPDATAOBJECT | lpDataObjectB |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::CompareObjects | ( | LPDATAOBJECT | lpDataObjectA,
 |  | LPDATAOBJECT | lpDataObjectB |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::CompareObjects | ( | LPDATAOBJECT | ipDataObjectA,
 |  | LPDATAOBJECT | ipDataObjectB
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponentData::CompareObjects | ( | LPDATAOBJECT | lpDataObjectA,
 |  | LPDATAOBJECT | lpDataObjectB |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::CompareObjects | ( | LPDATAOBJECT | lpDataObjectA,
 |  | LPDATAOBJECT | lpDataObjectB |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::CompareObjects | ( | LPDATAOBJECT | lpDataObjectA,
 |  | LPDATAOBJECT | lpDataObjectB |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::CompareObjects | ( | LPDATAOBJECT | ipDataObjectA,
 |  | LPDATAOBJECT | ipDataObjectB
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponentData::CompareObjects | ( | LPDATAOBJECT | lpDataObjectA,
 |  | LPDATAOBJECT | lpDataObjectB |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::CompareObjects | ( | LPDATAOBJECT | lpDataObjectA,
 |  | LPDATAOBJECT | lpDataObjectB |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::CompareObjects | ( | LPDATAOBJECT | lpDataObjectA,
 |  | LPDATAOBJECT | lpDataObjectB |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::CompareObjects | ( | LPDATAOBJECT | lpDataObjectA,
 |  | LPDATAOBJECT | lpDataObjectB |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::CompareObjects | ( | LPDATAOBJECT | lpDataObjectA,
 |  | LPDATAOBJECT | lpDataObjectB |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::CompareObjects | ( | LPDATAOBJECT | ipDataObjectA,
 |  | LPDATAOBJECT | ipDataObjectB
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponentData::CompareObjects | ( | LPDATAOBJECT | lpDataObjectA,
 |  | LPDATAOBJECT | lpDataObjectB |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::CompareObjects | ( | LPDATAOBJECT | ipDataObjectA,
 |  | LPDATAOBJECT | ipDataObjectB
 | ) |  |
HRESULT STDMETHODCALLTYPE CComponentData::CompareObjects | ( | LPDATAOBJECT | lpDataObjectA,
 |  | LPDATAOBJECT | lpDataObjectB
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponentData::CompareObjects | ( | LPDATAOBJECT | lpDataObjectA,
 |  | LPDATAOBJECT | lpDataObjectB |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::CompareObjects | ( | LPDATAOBJECT | lpDataObjectA,
 |  | LPDATAOBJECT | lpDataObjectB
 | ) |  |
HRESULT STDMETHODCALLTYPE CComponentData::CompareObjects | ( | LPDATAOBJECT | ipDataObjectA,
 |  | LPDATAOBJECT | ipDataObjectB
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponentData::CompareObjects | ( | LPDATAOBJECT | lpDataObjectA,
 |  | LPDATAOBJECT | lpDataObjectB |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::CompareObjects | ( | LPDATAOBJECT | ipDataObjectA,
 |  | LPDATAOBJECT | ipDataObjectB
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponentData::CompareObjects | ( | LPDATAOBJECT | lpDataObjectA,
 |  | LPDATAOBJECT | lpDataObjectB |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::CompareObjects | ( | LPDATAOBJECT | lpDataObjectA,
 |  | LPDATAOBJECT | lpDataObjectB |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::CompareObjects | ( | LPDATAOBJECT | lpDataObjectA,
 |  | LPDATAOBJECT | lpDataObjectB |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::CreateComponent ( LPCOMPONENT __RPC_FAR * ppComponent ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::CreateComponent ( LPCOMPONENT __RPC_FAR * ppComponent ) [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::CreateComponent ( LPCOMPONENT __RPC_FAR * ppComponent )
virtual HRESULT STDMETHODCALLTYPE CComponentData::CreateComponent ( LPCOMPONENT __RPC_FAR * ppComponent ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::CreateComponent ( LPCOMPONENT __RPC_FAR * ppComponent ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::CreateComponent ( LPCOMPONENT __RPC_FAR * ppComponent ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::CreateComponent ( LPCOMPONENT __RPC_FAR * ppComponent ) [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::CreateComponent ( LPCOMPONENT __RPC_FAR * ppComponent )
virtual HRESULT STDMETHODCALLTYPE CComponentData::CreateComponent ( LPCOMPONENT __RPC_FAR * ppComponent ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::CreateComponent ( LPCOMPONENT __RPC_FAR * ppComponent ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::CreateComponent ( LPCOMPONENT __RPC_FAR * ppComponent ) [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::CreateComponent ( LPCOMPONENT __RPC_FAR * ppComponent )
HRESULT CComponentData::CreateComponent ( LPCOMPONENT __RPC_FAR * ppComponent ) [virtual]

Definition at line 103 of file compdata.Cpp.

{
    *ppComponent = NULL;

    CComponent *pComponent = new CComponent(this);

    if (NULL == pComponent)
        return E_OUTOFMEMORY;

    return pComponent->QueryInterface(IID_IComponent, (void **)ppComponent);
}

HRESULT STDMETHODCALLTYPE CComponentData::CreateComponent ( LPCOMPONENT __RPC_FAR * ppComponent )
virtual HRESULT STDMETHODCALLTYPE CComponentData::CreateComponent ( LPCOMPONENT __RPC_FAR * ppComponent ) [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::CreateComponent ( LPCOMPONENT __RPC_FAR * ppComponent )
HRESULT STDMETHODCALLTYPE CComponentData::CreateComponent ( LPCOMPONENT __RPC_FAR * ppComponent )
virtual HRESULT STDMETHODCALLTYPE CComponentData::CreateComponent ( LPCOMPONENT __RPC_FAR * ppComponent ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::CreateComponent ( LPCOMPONENT __RPC_FAR * ppComponent ) [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::CreateComponent ( LPCOMPONENT __RPC_FAR * ppComponent )
virtual HRESULT STDMETHODCALLTYPE CComponentData::CreateComponent ( LPCOMPONENT __RPC_FAR * ppComponent ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::CreateComponent ( LPCOMPONENT __RPC_FAR * ppComponent ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::CreateComponent ( LPCOMPONENT __RPC_FAR * ppComponent ) [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::CreateComponent ( LPCOMPONENT __RPC_FAR * ppComponent )
virtual HRESULT STDMETHODCALLTYPE CComponentData::CreateComponent ( LPCOMPONENT __RPC_FAR * ppComponent ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::CreatePropertyPages | ( | LPPROPERTYSHEETCALLBACK | lpProvider,
 |  | LONG_PTR | handle,
 |  | LPDATAOBJECT | lpIDataObject |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::CreatePropertyPages | ( | LPPROPERTYSHEETCALLBACK | lpProvider,
 |  | LONG_PTR | handle,
 |  | LPDATAOBJECT | lpIDataObject |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::CreatePropertyPages | ( | LPPROPERTYSHEETCALLBACK | lpProvider,
 |  | LONG_PTR | handle,
 |  | LPDATAOBJECT | lpIDataObject |
 | ) |  |  | [virtual]
HRESULT CComponentData::CreatePropertyPages | ( | LPPROPERTYSHEETCALLBACK | lpProvider,
 |  | LONG_PTR | handle,
 |  | LPDATAOBJECT | lpIDataObject |
 | ) |  |  | [virtual]

Definition at line 250 of file compdata.Cpp.

{
    CDelegationBase *base = GetOurDataObject(lpIDataObject)->GetBaseNodeObject();

    return base->CreatePropertyPages(lpProvider, handle);
}

virtual HRESULT STDMETHODCALLTYPE CComponentData::Destroy ( void ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::Destroy ( void ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::Destroy ( void ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::Destroy ( void ) [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::Destroy ( void )
virtual HRESULT STDMETHODCALLTYPE CComponentData::Destroy ( void ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::Destroy ( void ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::Destroy ( void ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::Destroy ( void ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::Destroy ( void ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::Destroy ( void ) [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::Destroy ( void )
HRESULT STDMETHODCALLTYPE CComponentData::Destroy ( void )
virtual HRESULT STDMETHODCALLTYPE CComponentData::Destroy ( void ) [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::Destroy ( void )
HRESULT STDMETHODCALLTYPE CComponentData::Destroy ( void )
HRESULT STDMETHODCALLTYPE CComponentData::Destroy ( void )
virtual HRESULT STDMETHODCALLTYPE CComponentData::Destroy ( void ) [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::Destroy ( void )
virtual HRESULT STDMETHODCALLTYPE CComponentData::Destroy ( void ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::Destroy ( void ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::Destroy ( void ) [virtual]
HRESULT CComponentData::Destroy ( void ) [virtual]

Definition at line 127 of file compdata.Cpp.

{
    // Free interfaces
    if (m_ipConsoleNameSpace) {
        m_ipConsoleNameSpace->Release();
        m_ipConsoleNameSpace = NULL;
    }

    if (m_ipConsole) {
        m_ipConsole->Release();
        m_ipConsole = NULL;
    }

    return S_OK;
}

virtual HRESULT STDMETHODCALLTYPE CComponentData::Destroy ( void ) [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::Destroy ( void )
HRESULT CComponentData::ExtractData | ( | IDataObject * | piDataObject,
 |  | CLIPFORMAT | cfClipFormat,
 |  | BYTE * | pbData,
 |  | DWORD | cbData |
 | ) |  |  | [private]

Definition at line 343 of file nameext.Cpp.

{
    HRESULT hr = S_OK;

    FORMATETC formatetc = {cfClipFormat, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL};
    STGMEDIUM stgmedium = {TYMED_HGLOBAL, NULL};

    stgmedium.hGlobal = ::GlobalAlloc(GPTR, cbData);
    do // false loop
    {
        if (NULL == stgmedium.hGlobal)
        {
            hr = E_OUTOFMEMORY;
            break;
        }
        hr = piDataObject->GetDataHere( &formatetc, &stgmedium );
        if ( FAILED(hr) )
        {
            break;
        }

        BYTE* pbNewData = reinterpret_cast<BYTE*>(stgmedium.hGlobal);
        if (NULL == pbNewData)
        {
            hr = E_UNEXPECTED;
            break;
        }
        ::memcpy( pbData, pbNewData, cbData );
    } while (FALSE); // false loop

    if (NULL != stgmedium.hGlobal)
    {
        ::GlobalFree(stgmedium.hGlobal);
    }
    return hr;
} // ExtractData()

HRESULT CComponentData::ExtractObjectTypeGUID | ( | IDataObject * | piDataObject,
 |  | GUID * | pguidObjectType |
 | ) |  |  | [private]

Definition at line 396 of file nameext.Cpp.

{
    return ExtractData( piDataObject, s_cfNodeType, (PBYTE)pguidObjectType, sizeof(GUID) );
}

HRESULT CComponentData::ExtractSnapInCLSID | ( | IDataObject * | piDataObject,
 |  | CLSID * | pclsidSnapin |
 | ) |  |  | [private]

Definition at line 391 of file nameext.Cpp.

{
    return ExtractData( piDataObject, s_cfSnapInCLSID, (PBYTE)pclsidSnapin, sizeof(CLSID) );
}

HRESULT CComponentData::ExtractString | ( | IDataObject * | piDataObject,
 |  | CLIPFORMAT | cfClipFormat,
 |  | _TCHAR * | pstr,
 |  | DWORD | cchMaxLength |
 | ) |  |  | [private]

Definition at line 383 of file nameext.Cpp.

{
    return ExtractData( piDataObject, cfClipFormat, (PBYTE)pstr, cchMaxLength );
}

HRESULT CComponentData::GetClassID ( CLSID __RPC_FAR * pClassID ) [virtual]

Definition at line 270 of file compdata.Cpp.

{
    *pClassID = m_pStaticNode->getNodeType();

    return S_OK;
}

virtual HRESULT STDMETHODCALLTYPE CComponentData::GetClassID ( CLSID __RPC_FAR * pClassID ) [virtual]
LPCONSOLENAMESPACE CComponentData::GetConsoleNameSpace ( ) [inline]

Definition at line 42 of file compdata.h.

    {
        return m_ipConsoleNameSpace;
    }

virtual HRESULT STDMETHODCALLTYPE CComponentData::GetDisplayInfo ( SCOPEDATAITEM __RPC_FAR * pScopeDataItem ) [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::GetDisplayInfo ( SCOPEDATAITEM __RPC_FAR * pScopeDataItem )
virtual HRESULT STDMETHODCALLTYPE CComponentData::GetDisplayInfo ( SCOPEDATAITEM __RPC_FAR * pScopeDataItem ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::GetDisplayInfo ( SCOPEDATAITEM __RPC_FAR * pScopeDataItem ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::GetDisplayInfo ( SCOPEDATAITEM __RPC_FAR * pScopeDataItem ) [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::GetDisplayInfo ( SCOPEDATAITEM __RPC_FAR * pScopeDataItem )
virtual HRESULT STDMETHODCALLTYPE CComponentData::GetDisplayInfo ( SCOPEDATAITEM __RPC_FAR * pScopeDataItem ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::GetDisplayInfo ( SCOPEDATAITEM __RPC_FAR * pScopeDataItem ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::GetDisplayInfo ( SCOPEDATAITEM __RPC_FAR * pScopeDataItem ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::GetDisplayInfo ( SCOPEDATAITEM __RPC_FAR * pScopeDataItem ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::GetDisplayInfo ( SCOPEDATAITEM __RPC_FAR * pScopeDataItem ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::GetDisplayInfo ( SCOPEDATAITEM __RPC_FAR * pScopeDataItem ) [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::GetDisplayInfo ( SCOPEDATAITEM __RPC_FAR * pScopeDataItem )
virtual HRESULT STDMETHODCALLTYPE CComponentData::GetDisplayInfo ( SCOPEDATAITEM __RPC_FAR * pScopeDataItem ) [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::GetDisplayInfo ( SCOPEDATAITEM __RPC_FAR * pScopeDataItem )
HRESULT STDMETHODCALLTYPE CComponentData::GetDisplayInfo ( SCOPEDATAITEM __RPC_FAR * pScopeDataItem )
HRESULT STDMETHODCALLTYPE CComponentData::GetDisplayInfo ( SCOPEDATAITEM __RPC_FAR * pScopeDataItem )
virtual HRESULT STDMETHODCALLTYPE CComponentData::GetDisplayInfo ( SCOPEDATAITEM __RPC_FAR * pScopeDataItem ) [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::GetDisplayInfo ( SCOPEDATAITEM __RPC_FAR * pScopeDataItem )
HRESULT STDMETHODCALLTYPE CComponentData::GetDisplayInfo ( SCOPEDATAITEM __RPC_FAR * pScopeDataItem )
virtual HRESULT STDMETHODCALLTYPE CComponentData::GetDisplayInfo ( SCOPEDATAITEM __RPC_FAR * pScopeDataItem ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::GetDisplayInfo ( SCOPEDATAITEM __RPC_FAR * pScopeDataItem ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::GetDisplayInfo ( SCOPEDATAITEM __RPC_FAR * pScopeDataItem ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::GetDisplayInfo ( SCOPEDATAITEM __RPC_FAR * pScopeDataItem ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::GetDisplayInfo ( SCOPEDATAITEM __RPC_FAR * pScopeDataItem ) [virtual]
LPOLESTR CComponentData::GetHelpPath ( )

Definition at line 409 of file compdata.cpp.

{
  if( NULL == m_pszwHelpPath )         // Not initialized yet...
  {
    LPOLESTR pszBogus = NULL;          // so call GetHelpTopic() to
    GetHelpTopic( &pszBogus );         // cache the help file path
  }

  return m_pszwHelpPath;
}

virtual HRESULT STDMETHODCALLTYPE CComponentData::GetHelpTopic ( LPOLESTR __RPC_FAR * lpCompiledHelpFile ) [virtual]
HRESULT CComponentData::GetHelpTopic ( LPOLESTR * lpHelpFilePath )

Definition at line 251 of file compdata.Cpp.

{
    *lpCompiledHelpFile = static_cast<LPOLESTR>(CoTaskMemAlloc((wcslen(m_HelpFile) + 1) * sizeof(WCHAR)));

    wcscpy(*lpCompiledHelpFile, m_HelpFile);

    return S_OK;
}

virtual HRESULT STDMETHODCALLTYPE CComponentData::GetHelpTopic ( LPOLESTR __RPC_FAR * lpCompiledHelpFile ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::GetHelpTopic ( LPOLESTR __RPC_FAR * lpCompiledHelpFile ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::GetHelpTopic ( LPOLESTR __RPC_FAR * lpCompiledHelpFile ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::GetHelpTopic ( LPOLESTR __RPC_FAR * lpCompiledHelpFile ) [virtual]
HRESULT CComponentData::GetInterface | ( | DWORD | dwRequestedInterface,
 |  | LONG_PTR * | ppInterface
 | ) |  |
HRESULT CComponentData::GetInterface | ( | DWORD | dwRequestedInterface,
 |  | LONG_PTR * | ppInterface
 | ) |  |
HRESULT CComponentData::GetInterface | ( | DWORD | dwRequestedInterface,
 |  | LONG_PTR * | ppInterface
 | ) |  |
HRESULT CComponentData::GetInterface | ( | DWORD | dwRequestedInterface,
 |  | LONG_PTR * | ppInterface
 | ) |  |
HRESULT CComponentData::GetInterface | ( | DWORD | dwRequestedInterface,
 |  | LONG_PTR * | ppInterface
 | ) |  |
HRESULT CComponentData::GetInterface | ( | DWORD | dwRequestedInterface,
 |  | LONG_PTR * | ppInterface
 | ) |  |

Definition at line 376 of file compdata.cpp.

{
  _ASSERT( NULL != ppInterface );
  HRESULT hResult = S_OK;

  switch( dwRequestedInterface )
  {
    case REQUEST_ICONSOLENAMESPACE2:
      *ppInterface = reinterpret_cast<LONG_PTR>(m_ipConsoleNameSpace2);
      break;

    case REQUEST_ICONSOLE:
      *ppInterface = reinterpret_cast<LONG_PTR>(m_ipConsole);
      break;

    default:
      hResult = S_FALSE;
      *ppInterface = NULL;
      break;
  }

  return hResult;
}

HRESULT STDMETHODCALLTYPE CComponentData::GetLinkedTopics ( LPOLESTR * lpHelpFilePath ) [inline]

Definition at line 107 of file compdata.h.

                              { return E_NOTIMPL; }

virtual HRESULT STDMETHODCALLTYPE CComponentData::GetLinkedTopics ( LPOLESTR __RPC_FAR * lpCompiledHelpFiles ) [inline, virtual]

Definition at line 86 of file CompData.h.

                                                         { return S_FALSE; }

const GUID& CComponentData::getPrimaryNodeType ( ) [inline]

Definition at line 62 of file nameext.h.

{ return skybasedvehicleGuid; }

HRESULT CComponentData::GetSizeMax ( ULARGE_INTEGER __RPC_FAR * pcbSize ) [virtual]

Definition at line 305 of file compdata.Cpp.

{
    return m_pStaticNode->getDataSize();
}

virtual HRESULT STDMETHODCALLTYPE CComponentData::GetSizeMax ( ULARGE_INTEGER __RPC_FAR * pcbSize ) [virtual]
CStaticNode* CComponentData::GetStaticNode ( ) [inline]

Definition at line 100 of file compdata.h.

{ return m_pStaticNode; }

CStaticNode* CComponentData::GetStaticNode ( ) [inline]

Definition at line 112 of file compdata.h.

{ return m_pStaticNode;  }

CStaticNode* CComponentData::GetStaticNode ( ) [inline]

Definition at line 103 of file compdata.h.

{ return m_pStaticNode; }

CStaticNode* CComponentData::GetStaticNode ( ) [inline]

Definition at line 105 of file compdata.h.

{ return m_pStaticNode; }

CStaticNode* CComponentData::GetStaticNode ( ) [inline]

Definition at line 85 of file compdata.h.

{ return m_pStaticNode; }

CStaticNode* CComponentData::GetStaticNode ( ) [inline]

Definition at line 101 of file compdata.h.

{ return m_pStaticNode; }

CStaticNode* CComponentData::GetStaticNode ( ) [inline]

Definition at line 84 of file compdata.h.

{ return m_pStaticNode; }

CStaticNode* CComponentData::GetStaticNode ( ) [inline]

Definition at line 104 of file compdata.h.

{ return m_pStaticNode; }

virtual HRESULT STDMETHODCALLTYPE CComponentData::GetWatermarks | ( | LPDATAOBJECT | lpIDataObject,
 |  | HBITMAP __RPC_FAR * | lphWatermark,
 |  | HBITMAP __RPC_FAR * | lphHeader,
 |  | HPALETTE __RPC_FAR * | lphPalette,
 |  | BOOL __RPC_FAR * | bStretch |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::GetWatermarks | ( | LPDATAOBJECT | lpIDataObject,
 |  | HBITMAP __RPC_FAR * | lphWatermark,
 |  | HBITMAP __RPC_FAR * | lphHeader,
 |  | HPALETTE __RPC_FAR * | lphPalette,
 |  | BOOL __RPC_FAR * | bStretch |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::GetWatermarks | ( | LPDATAOBJECT | lpIDataObject,
 |  | HBITMAP __RPC_FAR * | lphWatermark,
 |  | HBITMAP __RPC_FAR * | lphHeader,
 |  | HPALETTE __RPC_FAR * | lphPalette,
 |  | BOOL __RPC_FAR * | bStretch |
 | ) |  |  | [virtual]
HRESULT CComponentData::GetWatermarks | ( | LPDATAOBJECT | lpIDataObject,
 |  | HBITMAP __RPC_FAR * | lphWatermark,
 |  | HBITMAP __RPC_FAR * | lphHeader,
 |  | HPALETTE __RPC_FAR * | lphPalette,
 |  | BOOL __RPC_FAR * | bStretch |
 | ) |  |  | [virtual]

Definition at line 268 of file compdata.Cpp.

{
    CDelegationBase *base = GetOurDataObject(lpIDataObject)->GetBaseNodeObject();

    return base->GetWatermarks(lphWatermark, lphHeader, lphPalette, bStretch);
}

virtual HRESULT STDMETHODCALLTYPE CComponentData::Initialize ( LPUNKNOWN pUnknown ) [virtual]
HRESULT CComponentData::Initialize ( LPUNKNOWN pUnknown ) [virtual]

Definition at line 87 of file compdata.Cpp.

{
    HRESULT      hr;

    // Get pointer to name space interface
    hr = pUnknown->QueryInterface(IID_IConsoleNameSpace, (void **)&m_ipConsoleNameSpace);
    _ASSERT( S_OK == hr );

    // Get pointer to console interface
    hr = pUnknown->QueryInterface(IID_IConsole, (void **)&m_ipConsole);
    _ASSERT( S_OK == hr );

    return S_OK;
}

virtual HRESULT STDMETHODCALLTYPE CComponentData::Initialize ( LPUNKNOWN pUnknown ) [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::Initialize ( LPUNKNOWN pUnknown )
virtual HRESULT STDMETHODCALLTYPE CComponentData::Initialize ( LPUNKNOWN pUnknown ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::Initialize ( LPUNKNOWN pUnknown ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::Initialize ( LPUNKNOWN pUnknown ) [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::Initialize ( LPUNKNOWN pUnknown )
virtual HRESULT STDMETHODCALLTYPE CComponentData::Initialize ( LPUNKNOWN pUnknown ) [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::Initialize ( LPUNKNOWN pUnknown )
virtual HRESULT STDMETHODCALLTYPE CComponentData::Initialize ( LPUNKNOWN pUnknown ) [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::Initialize ( LPUNKNOWN pUnknown )
virtual HRESULT STDMETHODCALLTYPE CComponentData::Initialize ( LPUNKNOWN pUnknown ) [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::Initialize ( LPUNKNOWN pUnknown )
HRESULT STDMETHODCALLTYPE CComponentData::Initialize ( LPUNKNOWN pUnknown )
virtual HRESULT STDMETHODCALLTYPE CComponentData::Initialize ( LPUNKNOWN pUnknown ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::Initialize ( LPUNKNOWN pUnknown ) [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::Initialize ( LPUNKNOWN pUnknown )
virtual HRESULT STDMETHODCALLTYPE CComponentData::Initialize ( LPUNKNOWN pUnknown ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::Initialize ( LPUNKNOWN pUnknown ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::Initialize ( LPUNKNOWN pUnknown ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::Initialize ( LPUNKNOWN pUnknown ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::Initialize ( LPUNKNOWN pUnknown ) [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::Initialize ( LPUNKNOWN pUnknown )
virtual HRESULT STDMETHODCALLTYPE CComponentData::Initialize ( LPUNKNOWN pUnknown ) [virtual]
HRESULT CComponentData::IsDirty ( void ) [virtual]

Definition at line 278 of file compdata.Cpp.

{
    return m_pStaticNode->isDirty() == true ? S_OK : S_FALSE;
}

virtual HRESULT STDMETHODCALLTYPE CComponentData::IsDirty ( void ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::Load ( IStream __RPC_FAR * pStm ) [virtual]
HRESULT CComponentData::Load ( IStream __RPC_FAR * pStm ) [virtual]

Definition at line 283 of file compdata.Cpp.

{
    void *snapInData = m_pStaticNode->getData();
    ULONG dataSize = m_pStaticNode->getDataSize();

    return pStm->Read(snapInData, dataSize, NULL);
}

static void CComponentData::LoadBitmaps ( ) [inline, static, protected]

Definition at line 120 of file nameext.h.

                              {
        m_pBMapSm = LoadBitmap(g_hinst, MAKEINTRESOURCE(IDR_SMICONS));
        m_pBMapLg = LoadBitmap(g_hinst, MAKEINTRESOURCE(IDR_LGICONS));
    }

virtual HRESULT STDMETHODCALLTYPE CComponentData::Notify | ( | LPDATAOBJECT | lpDataObject,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::Notify | ( | LPDATAOBJECT | lpDataObject,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::Notify | ( | LPDATAOBJECT | lpDataObject,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::Notify | ( | LPDATAOBJECT | lpDataObject,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::Notify | ( | LPDATAOBJECT | ipDataObject,
 |  | MMC_NOTIFY_TYPE | MmcEvent,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponentData::Notify | ( | LPDATAOBJECT | lpDataObject,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::Notify | ( | LPDATAOBJECT | ipDataObject,
 |  | MMC_NOTIFY_TYPE | MmcEvent,
 |  | LONG | nArg,
 |  | LONG | nParam
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponentData::Notify | ( | LPDATAOBJECT | lpDataObject,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::Notify | ( | LPDATAOBJECT | lpDataObject,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::Notify | ( | LPDATAOBJECT | lpDataObject,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::Notify | ( | LPDATAOBJECT | ipDataObject,
 |  | MMC_NOTIFY_TYPE | MmcEvent,
 |  | LONG | nArg,
 |  | LONG | nParam
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponentData::Notify | ( | LPDATAOBJECT | lpDataObject,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::Notify | ( | LPDATAOBJECT | ipDataObject,
 |  | MMC_NOTIFY_TYPE | MmcEvent,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam
 | ) |  |
HRESULT CComponentData::Notify | ( | LPDATAOBJECT | ipDataObject,
 |  | MMC_NOTIFY_TYPE | MmcEvent,
 |  | LONG | nArg,
 |  | LONG | nParam
 | ) |  |

Definition at line 174 of file compdata.cpp.

{
  TRACE_EVENT( _T("Notify"), MmcEvent );  // Provides trace output

  return S_FALSE;
}

HRESULT STDMETHODCALLTYPE CComponentData::Notify | ( | LPDATAOBJECT | ipDataObject,
 |  | MMC_NOTIFY_TYPE | MmcEvent,
 |  | LONG | nArg,
 |  | LONG | nParam
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponentData::Notify | ( | LPDATAOBJECT | lpDataObject,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::Notify | ( | LPDATAOBJECT | lpDataObject,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::Notify | ( | LPDATAOBJECT | ipDataObject,
 |  | MMC_NOTIFY_TYPE | MmcEvent,
 |  | LONG | nArg,
 |  | LONG | nParam
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponentData::Notify | ( | LPDATAOBJECT | lpDataObject,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param |
 | ) |  |  | [virtual]
HRESULT CComponentData::Notify | ( | LPDATAOBJECT | lpDataObject,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param |
 | ) |  |  | [virtual]

Definition at line 116 of file compdata.Cpp.

{
        MMCN_Crack(TRUE, lpDataObject, this, NULL, event, arg, param);

    return S_FALSE;
}

virtual HRESULT STDMETHODCALLTYPE CComponentData::Notify | ( | LPDATAOBJECT | lpDataObject,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::Notify | ( | LPDATAOBJECT | lpDataObject,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::Notify | ( | LPDATAOBJECT | lpDataObject,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::Notify | ( | LPDATAOBJECT | lpDataObject,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::Notify | ( | LPDATAOBJECT | ipDataObject,
 |  | MMC_NOTIFY_TYPE | MmcEvent,
 |  | LONG | nArg,
 |  | LONG | nParam
 | ) |  |
HRESULT CComponentData::OnExpand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent
 | ) |  |

Definition at line 298 of file nameext.Cpp.

{
  //first create the CSkyVehicle objects, one for each inserted item
    for (int n = 0; n < NUMBER_OF_CHILDREN; n++) {
        children[n] = new CSkyVehicle(n + 1);
    }

  //now fill an SCOPEDATAITEM for each item and then insert it
  SCOPEDATAITEM sdi;

    if (!bExpanded) {
        // create the child nodes, then expand them
        for (int n = 0; n < NUMBER_OF_CHILDREN; n++) {
            ZeroMemory(&sdi, sizeof(SCOPEDATAITEM) );
            sdi.mask = SDI_STR       |   // Displayname is valid
                SDI_PARAM     |   // lParam is valid
                SDI_IMAGE     |   // nImage is valid
                SDI_OPENIMAGE |   // nOpenImage is valid
                SDI_PARENT    |   // relativeID is valid
                SDI_CHILDREN;     // cChildren is valid

            sdi.relativeID  = (HSCOPEITEM)parent;
            sdi.nImage      = children[n]->GetBitmapIndex();
            sdi.nOpenImage  = INDEX_OPENFOLDER;
            sdi.displayname = MMC_CALLBACK;
            sdi.lParam      = (LPARAM)children[n];       // The cookie
            sdi.cChildren   = 0;

            HRESULT hr = pConsoleNameSpace->InsertItem( &sdi );

            _ASSERT( SUCCEEDED(hr) );
        }
    }

    return S_OK;
}

virtual HRESULT STDMETHODCALLTYPE CComponentData::QueryDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | type,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::QueryDataObject | ( | MMC_COOKIE | uCookie,
 |  | DATA_OBJECT_TYPES | nEnumType,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponentData::QueryDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | type,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::QueryDataObject | ( | MMC_COOKIE | uCookie,
 |  | DATA_OBJECT_TYPES | nEnumType,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject
 | ) |  |
HRESULT CComponentData::QueryDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | type,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject |
 | ) |  |  | [virtual]

Definition at line 205 of file compdata.cpp.

{
  HRESULT hResult = S_FALSE;
  ULONG   uCookie = 0;

  CDataObject* pNewObject = new CDataObject();

  (0 == nCookie) ? uCookie = (ULONG)m_pStaticNode : uCookie = nCookie;
  pNewObject->SetPrivateData( uCookie, (ULONG)nEnumType );

  if( NULL == pNewObject )
    hResult = E_OUTOFMEMORY;
  else
    hResult = pNewObject->QueryInterface( IID_IDataObject, (void**)ppDataObject );

  return hResult;
}

HRESULT STDMETHODCALLTYPE CComponentData::QueryDataObject | ( | MMC_COOKIE | nCookie,
 |  | DATA_OBJECT_TYPES | nEnumType,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject
 | ) |  |
HRESULT STDMETHODCALLTYPE CComponentData::QueryDataObject | ( | MMC_COOKIE | uCookie,
 |  | DATA_OBJECT_TYPES | nEnumType,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponentData::QueryDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | type,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::QueryDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | type,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::QueryDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | type,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::QueryDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | type,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::QueryDataObject | ( | MMC_COOKIE | uCookie,
 |  | DATA_OBJECT_TYPES | nEnumType,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponentData::QueryDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | type,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::QueryDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | type,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::QueryDataObject | ( | MMC_COOKIE | uCookie,
 |  | DATA_OBJECT_TYPES | nEnumType,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponentData::QueryDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | type,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::QueryDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | type,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::QueryDataObject | ( | MMC_COOKIE | uCookie,
 |  | DATA_OBJECT_TYPES | nEnumType,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponentData::QueryDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | type,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::QueryDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | type,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::QueryDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | type,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::QueryDataObject | ( | MMC_COOKIE | uCookie,
 |  | DATA_OBJECT_TYPES | nEnumType,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponentData::QueryDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | type,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::QueryDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | type,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::QueryDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | type,
 |  | LPDATAOBJECT __RPC_FAR * | ppDataObject |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CComponentData::QueryDispatch | ( | MMC_COOKIE | nCookie,
 |  | DATA_OBJECT_TYPES | eType,
 |  | LPDISPATCH * | pipDispatch
 | ) |  |
HRESULT STDMETHODCALLTYPE CComponentData::QueryDispatch | ( | MMC_COOKIE | nCookie,
 |  | DATA_OBJECT_TYPES | eType,
 |  | LPDISPATCH * | pipDispatch
 | ) |  |
HRESULT STDMETHODCALLTYPE CComponentData::QueryDispatch | ( | MMC_COOKIE | nCookie,
 |  | DATA_OBJECT_TYPES | eType,
 |  | LPDISPATCH * | pipDispatch
 | ) |  |
HRESULT STDMETHODCALLTYPE CComponentData::QueryDispatch | ( | MMC_COOKIE | nCookie,
 |  | DATA_OBJECT_TYPES | eType,
 |  | LPDISPATCH * | pipDispatch
 | ) |  |
HRESULT CComponentData::QueryDispatch | ( | MMC_COOKIE | nCookie,
 |  | DATA_OBJECT_TYPES | eType,
 |  | LPDISPATCH * | pipDispatch
 | ) |  |

Definition at line 260 of file compdata.cpp.

{
  return E_NOTIMPL;
}

HRESULT STDMETHODCALLTYPE CComponentData::QueryDispatch | ( | MMC_COOKIE | nCookie,
 |  | DATA_OBJECT_TYPES | eType,
 |  | LPDISPATCH * | pipDispatch
 | ) |  |
HRESULT STDMETHODCALLTYPE CComponentData::QueryDispatch | ( | MMC_COOKIE | nCookie,
 |  | DATA_OBJECT_TYPES | eType,
 |  | LPDISPATCH * | pipDispatch
 | ) |  |
HRESULT STDMETHODCALLTYPE CComponentData::QueryDispatch | ( | MMC_COOKIE | nCookie,
 |  | DATA_OBJECT_TYPES | eType,
 |  | LPDISPATCH * | pipDispatch
 | ) |  |
STDMETHODIMP CComponentData::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponentData::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponentData::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponentData::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 46 of file compdata.Cpp.

{
    if (!ppv)
        return E_FAIL;

    *ppv = NULL;

    if (IsEqualIID(riid, IID_IUnknown))
        *ppv = static_cast<IComponentData *>(this);
    else if (IsEqualIID(riid, IID_IComponentData))
        *ppv = static_cast<IComponentData *>(this);

    if (*ppv)
    {
        reinterpret_cast<IUnknown *>(*ppv)->AddRef();
        return S_OK;
    }

    return E_NOINTERFACE;
}

STDMETHODIMP CComponentData::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponentData::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponentData::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponentData::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponentData::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponentData::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponentData::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponentData::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponentData::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponentData::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponentData::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponentData::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponentData::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponentData::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponentData::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponentData::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponentData::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponentData::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponentData::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponentData::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CComponentData::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CComponentData::QueryPagesFor ( LPDATAOBJECT lpDataObject ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::QueryPagesFor ( LPDATAOBJECT lpDataObject ) [virtual]
HRESULT CComponentData::QueryPagesFor ( LPDATAOBJECT lpDataObject ) [virtual]

Definition at line 260 of file compdata.Cpp.

{
    CDelegationBase *base = GetOurDataObject(lpDataObject)->GetBaseNodeObject();

    return base->HasPropertySheets();
}

virtual HRESULT STDMETHODCALLTYPE CComponentData::QueryPagesFor ( LPDATAOBJECT lpDataObject ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CComponentData::Save | ( | IStream __RPC_FAR * | pStm,
 |  | BOOL | fClearDirty |
 | ) |  |  | [virtual]
HRESULT CComponentData::Save | ( | IStream __RPC_FAR * | pStm,
 |  | BOOL | fClearDirty |
 | ) |  |  | [virtual]

Definition at line 292 of file compdata.Cpp.

{
    void *snapInData = m_pStaticNode->getData();
    ULONG dataSize = m_pStaticNode->getDataSize();

    if (fClearDirty)
        m_pStaticNode->clearDirty();

    return pStm->Write(snapInData, dataSize, NULL);
}

CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )
CComponentData::STDMETHODIMP_ ( ULONG )

Friends And Related Function Documentation

CComponent [friend]

Definition at line 29 of file compdata.h.

Member Data Documentation

BOOL CComponentData::bExpanded [protected]

Definition at line 125 of file nameext.h.

CDelegationBase* CComponentData::children[1] [private]

Definition at line 47 of file nameext.h.

ULONG CComponentData::m_cref [private]

Definition at line 32 of file compdata.h.

ULONG CComponentData::m_cRef [private]

Definition at line 28 of file compdata.h.

WCHAR CComponentData::m_HelpFile [private]

Definition at line 37 of file compdata.h.

HBITMAP CComponentData::m_hImageStrip16 [private]

Definition at line 35 of file compdata.h.

HBITMAP CComponentData::m_hImageStrip32 [private]

Definition at line 36 of file compdata.h.

HSCOPEITEM CComponentData::m_hStaticNode [private]

Definition at line 34 of file compdata.h.

LPCONSOLE3 CComponentData::m_ipConsole [private]

Definition at line 30 of file compdata.h.

LPCONSOLE CComponentData::m_ipConsole [private]

Definition at line 33 of file compdata.h.

LPCONSOLE CComponentData::m_ipConsole2 [private]

Definition at line 29 of file compdata.h.

LPCONSOLENAMESPACE CComponentData::m_ipConsoleNameSpace [private]

Definition at line 34 of file compdata.h.

LPCONSOLENAMESPACE2 CComponentData::m_ipConsoleNameSpace [private]

Definition at line 31 of file compdata.h.

LPCONSOLENAMESPACE CComponentData::m_ipConsoleNameSpace2 [private]

Definition at line 30 of file compdata.h.

LPCONSOLENAMESPACE2 CComponentData::m_ipConsoleNameSpace2 [private]

Definition at line 31 of file compdata.h.

LPIMAGELIST CComponentData::m_ipScopeImage [private]

Definition at line 32 of file compdata.h.

HBITMAP CComponentData::m_pBMapLg = NULL [static]

Definition at line 117 of file nameext.h.

HBITMAP CComponentData::m_pBMapSm = NULL [static]

Definition at line 116 of file nameext.h.

CStaticNode * CComponentData::m_pStaticNode [private]

Definition at line 36 of file compdata.h.

LPOLESTR CComponentData::m_pszwHelpPath [private]

Definition at line 38 of file compdata.h.

UINT CComponentData::s_cfDisplayName = RegisterClipboardFormat(_T_CCF_DISPLAY_NAME) [static, private]

Definition at line 50 of file nameext.h.

UINT CComponentData::s_cfNodeType = RegisterClipboardFormat(_T_CCF_NODETYPE) [static, private]

Definition at line 52 of file nameext.h.

UINT CComponentData::s_cfSnapInCLSID = RegisterClipboardFormat(_T_CCF_SNAPIN_CLASSID) [static, private]

Definition at line 51 of file nameext.h.

const GUID CComponentData::skybasedvehicleGuid = { 0x2974380f, 0x4c4b, 0x11d2, { 0x89, 0xd8, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28 } } [static, private]

Definition at line 55 of file nameext.h.

The documentation for this class was generated from the following files:
  • SysMgmt/MMC/About/compdata.h
  • SysMgmt/MMC/Nameext/nameext.h
  • SysMgmt/MMC/ActiveX/compdata.h
  • SysMgmt/MMC/CMenu/compdata.h
  • SysMgmt/MMC/Complete/compdata.h
  • SysMgmt/MMC/CutCopy/compdata.h
  • SysMgmt/MMC/Extens/compdata.h
  • SysMgmt/MMC/Help/CompData.h
  • SysMgmt/MMC/Menubtn/compdata.h
  • SysMgmt/MMC/mmc2.0/about/compdata.h
  • SysMgmt/MMC/mmc2.0/contextmenu/compdata.h
  • SysMgmt/MMC/mmc2.0/dragdrop/compdata.h
  • SysMgmt/MMC/mmc2.0/help/compdata.h
  • SysMgmt/MMC/mmc2.0/multisel/compdata.h
  • SysMgmt/MMC/mmc2.0/proppage/compdata.h
  • SysMgmt/MMC/mmc2.0/simple/compdata.h
  • SysMgmt/MMC/mmc2.0/viewex/compdata.h
  • SysMgmt/MMC/Multisel/compdata.h
  • SysMgmt/MMC/Nodes/compdata.h
  • SysMgmt/MMC/Openserv/compdata.h
  • SysMgmt/MMC/Proppage/compdata.h
  • SysMgmt/MMC/Simple/compdata.h
  • SysMgmt/MMC/Taskpads/compdata.h
  • SysMgmt/MMC/Toolbar/compdata.h
  • SysMgmt/MMC/WMI/compdata.h
  • SysMgmt/MMC/About/compdata.Cpp
  • SysMgmt/MMC/ActiveX/compdata.Cpp
  • SysMgmt/MMC/CMenu/compdata.Cpp
  • SysMgmt/MMC/Complete/compdata.Cpp
  • SysMgmt/MMC/CutCopy/compdata.Cpp
  • SysMgmt/MMC/Extens/compdata.Cpp
  • SysMgmt/MMC/Help/CompData.Cpp
  • SysMgmt/MMC/Menubtn/compdata.Cpp
  • SysMgmt/MMC/mmc2.0/about/compdata.cpp
  • SysMgmt/MMC/mmc2.0/contextmenu/compdata.cpp
  • SysMgmt/MMC/mmc2.0/dragdrop/compdata.cpp
  • SysMgmt/MMC/mmc2.0/help/compdata.cpp
  • SysMgmt/MMC/mmc2.0/multisel/compdata.cpp
  • SysMgmt/MMC/mmc2.0/proppage/compdata.cpp
  • SysMgmt/MMC/mmc2.0/simple/compdata.cpp
  • SysMgmt/MMC/mmc2.0/viewex/compdata.cpp
  • SysMgmt/MMC/Multisel/compdata.Cpp
  • SysMgmt/MMC/Nameext/nameext.Cpp
  • SysMgmt/MMC/Nodes/compdata.Cpp
  • SysMgmt/MMC/Openserv/compdata.Cpp
  • SysMgmt/MMC/Proppage/compdata.Cpp
  • SysMgmt/MMC/Simple/compdata.Cpp
  • SysMgmt/MMC/Taskpads/compdata.Cpp
  • SysMgmt/MMC/Toolbar/compdata.Cpp
  • SysMgmt/MMC/WMI/compdata.Cpp
Generated on Wed Nov 13 2024 16:55:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCompositionEditSession Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CCompositionEditSession Class Reference

Inherits CEditSessionBase.

List of all members.

Public Member Functions

CCompositionEditSession (ITfContext *pContext, CMarkTextService *pMark)
~CCompositionEditSession ()
STDMETHODIMP DoEditSession (TfEditCookie ec)

Private Attributes

CMarkTextService * _pMark

Detailed Description

Definition at line 11 of file compose.cpp.

Constructor & Destructor Documentation

CCompositionEditSession::CCompositionEditSession | ( | ITfContext * | pContext,
 |  | CMarkTextService * | pMark |
 | ) |  |  | [inline]

Definition at line 12 of file compose.cpp.

{
public:
    CCompositionEditSession(ITfContext *pContext, CMarkTextService *pMark) : CEditSessionBase(pContext)
    {
        _pMark = pMark;

CCompositionEditSession::~CCompositionEditSession ( ) [inline]

Definition at line 17 of file compose.cpp.

    {

Member Function Documentation

STDAPI CCompositionEditSession::DoEditSession ( TfEditCookie ec ) [virtual]

Implements CEditSessionBase.

Definition at line 123 of file compose.cpp.

{
    ITfInsertAtSelection *pInsertAtSelection;
    ITfContextComposition *pContextComposition;
    ITfComposition *pComposition;
    ITfRange *pRangeComposition;
    ITfRange *pRangeInsert;
    ITfContext *pCompositionContext;
    HRESULT hr;
    BOOL fEqualContexts;

    // get an interface on the context we can use to deal with compositions
    if (_pContext->QueryInterface(IID_ITfContextComposition, (void **)&pContextComposition) != S_OK)
        return E_FAIL;

    hr = E_FAIL;

    pInsertAtSelection = NULL;

    if (_pMark->_IsComposing())
    {
        // we have a composition, let's terminate it

        // it's possible our current composition is in another context...let's find out
        fEqualContexts = TRUE;
        if (_pMark->_GetComposition()->GetRange(&pRangeComposition) == S_OK)
        {
            if (pRangeComposition->GetContext(&pCompositionContext) == S_OK)
            {
                fEqualContexts = IsEqualUnknown(pCompositionContext, _pContext);
                if (!fEqualContexts)
                {
                    // need an edit session in the composition context
                    _pMark->_TerminateCompositionInContext(pCompositionContext);
                }
                pCompositionContext->Release();
            }
            pRangeComposition->Release();
        }

        // if the composition is in pContext, we already have an edit cookie
        if (fEqualContexts)
        {
            _pMark->_TerminateComposition(ec);
        }
    }
    else
    {
        // let's start a new composition over the current selection
        // this is totally contrived, a real text service would have
        // some meaningful logic to trigger this

        // first, test where a keystroke would go in the document if we did an insert
        // we need a special interface to insert text at the selection
        if (_pContext->QueryInterface(IID_ITfInsertAtSelection, (void **)&pInsertAtSelection) != S_OK)
        {
            pInsertAtSelection = NULL;
            goto Exit;
        }

        if (pInsertAtSelection->InsertTextAtSelection(ec, TF_IAS_QUERYONLY, NULL, 0, &pRangeInsert) != S_OK)
            goto Exit;

        // start the composition
        if (pContextComposition->StartComposition(ec, pRangeInsert, _pMark, &pComposition) != S_OK)
        {
            pComposition = NULL;
        }

        pRangeInsert->Release();

        // _pComposition may be NULL even if StartComposition return S_OK, this mean the application
        // rejected the composition

        if (pComposition != NULL)
        {
            _pMark->_SetComposition(pComposition);
            // underline the composition text to give the user some feedback UI
            _pMark->_SetCompositionDisplayAttributes(ec);
        }
    }

    // if we make it here, we've succeeded
    hr = S_OK;

Exit:
    SafeRelease(pInsertAtSelection);
    pContextComposition->Release();

    return hr;
}

Member Data Documentation

CMarkTextService* CCompositionEditSession::_pMark [private]

Definition at line 26 of file compose.cpp.

The documentation for this class was generated from the following file:
  • WinUI/TSFmark/compose.cpp
Generated on Wed Nov 13 2024 16:55:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CComputer Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CComputer Class Reference

#include "Computer.h"

List of all members.

Public Member Functions

CComputer ()
STDMETHODIMP | AddNewGame (IN VARIANT_BOOL bEasy, OUT VARIANT *pvGameID, OUT VARIANT *pvOrder, OUT VARIANT *pvX, OUT VARIANT *pvY)
STDMETHODIMP | NewMove (IN long lGameID, IN VARIANT_BOOL bEasy, IN long lX, IN long lY, OUT VARIANT *pvMyX, OUT VARIANT *pvMyY, OUT VARIANT *pvWin)

Private Member Functions

float | Evaluate (long lX, long lY)
void | GetMove (long lGameID, VARIANT_BOOL bEasy, long &lX, long &lY)
long | HowManyTurns ()
void | InitArray ()
STDMETHOD() | InterfaceSupportsErrorInfo (REFIID riid)
bool | IsWin (long lPlayer)
long | LineScan (long lPlayer, long &lX, long &lY)
HRESULT | LoadArray (long lGameID)
HRESULT | SaveArray (long lGameID)

Private Attributes

long | plField [3][3]

Detailed Description

Definition at line 27 of file Computer.h.

Constructor & Destructor Documentation

CComputer::CComputer ( ) [inline]

Definition at line 34 of file Computer.h.

{}

Member Function Documentation

STDMETHODIMP CComputer::AddNewGame | ( | IN VARIANT_BOOL | bEasy,
 |  | OUT VARIANT * | pvGameID,
 |  | OUT VARIANT * | pvOrder,
 |  | OUT VARIANT * | pvX,
 |  | OUT VARIANT * | pvY
 | ) |  |

Definition at line 44 of file Computer.Cpp.

                                                      {

  HRESULT hr = S_OK;

  IObjectContext* pObjectContext = NULL;

  ISharedPropertyGroupManager* spmMgr = NULL;
  ISharedPropertyGroup* spmGroup = NULL;

  ISharedProperty* spmPropCounter = NULL;
  ISharedProperty* spmPropState = NULL;

  pvGameID->vt = VT_I4;
  pvOrder->vt = VT_I4;
  pvX->vt = VT_I4;
  pvY->vt = VT_I4;

  long lGameID = 0;
  long lOrder = 0;
  long lNewX = 0;
  long lNewY = 0;

  try {

    // Get the object context
    THROW_ERR ( hr = GetObjectContext(&pObjectContext) );
    if (pObjectContext == NULL) {
      THROW_ERR ( E_FAIL );
    }

    // Create the SharedPropertyGroupManager
    THROW_ERR ( pObjectContext->CreateInstance (CLSID_SharedPropertyGroupManager, IID_ISharedPropertyGroupManager, (void**)&spmMgr) );

    // Create the SharedPropertyGroup
    LONG lIsolationMode = LockMethod;
    LONG lReleaseMode = Process;
    VARIANT_BOOL bExists = VARIANT_FALSE;
    THROW_ERR ( spmMgr->CreatePropertyGroup (L"TicTacToe", &lIsolationMode, &lReleaseMode, &bExists, &spmGroup) );

    // Create the counter properties
    THROW_ERR ( spmGroup->CreateProperty (L"Counter", &bExists, &spmPropCounter) );

    // Obtain the current value of the counter
    CComVariant vCounter;
    THROW_ERR ( spmPropCounter->get_Value (&vCounter) );

    // Assign gameID
    if (vCounter.lVal == 0)
      vCounter.lVal = 1;

    lGameID = vCounter.lVal;

    // Update the counter
    vCounter.lVal ++;
    THROW_ERR ( spmPropCounter->put_Value (vCounter) );

    // Set the state variable
    TCHAR szBuf [512];
    BSTR bstrState;

    wsprintf (szBuf, _T("%dState"), lGameID);
    bstrState = TCHAR2BSTR (szBuf);
    THROW_ERR ( spmGroup->CreateProperty (bstrState, &bExists, &spmPropState) );

    CComVariant vState;
    vState.vt = VT_I4;
    vState.lVal = 4;
    THROW_ERR ( spmPropState->put_Value (vState) );

    // Initialize the array
    InitArray();
    THROW_ERR ( SaveArray(lGameID) );

    // Assign order randomly
    srand ((unsigned) time (NULL));
    lOrder = rand() % 2 + 1;

    // Get computer's first move if player's order is 2
    if (lOrder == 2) {
      GetMove (lGameID, bEasy, lNewX, lNewY);
      plField [lNewX][lNewY] = 2;
      SaveArray(lGameID);
    }

    // Prepare return values
    pvX->lVal = lNewX;
    pvY->lVal = lNewY;
    pvOrder->lVal = lOrder;
    pvGameID->lVal = lGameID;

    // We're finished and happy
    pObjectContext->SetComplete();

  } catch (HRESULT hr) {

    // Create an ErrorInfo object
    ICreateErrorInfo* pCreateErrInfo = NULL;
    IErrorInfo* pErrInfo = NULL;

    CreateErrorInfo (&pCreateErrInfo);
    pCreateErrInfo->QueryInterface (IID_IErrorInfo, (LPVOID FAR*) &pErrInfo);

    // Fill in error information
    TCHAR szErr [512];
    wsprintf (szErr, _T("Error %d occurred in Computer::AddNewGame()"), hr);
    BSTR bstrDesc = TCHAR2BSTR (szErr);
    pCreateErrInfo->SetGUID (IID_IComputer);
    pCreateErrInfo->SetSource (L"Computer");
    pCreateErrInfo->SetDescription (bstrDesc);
    ::SysFreeString (bstrDesc);

    // Confirm error information
    SetErrorInfo (0, pErrInfo);

    // Clean up the error objects
    if (pCreateErrInfo)
      pCreateErrInfo->Release();

    if (pErrInfo)
      pErrInfo->Release();

    // Indicate our unhappiness
    if (pObjectContext)
      pObjectContext->SetAbort();

    hr = E_FAIL;
  }

  if (pObjectContext)
    pObjectContext->Release();

  if (spmMgr)
    spmMgr->Release();

  if (spmGroup)
    spmGroup->Release();

  if (spmPropCounter)
    spmPropCounter->Release();

  if (spmPropState)
    spmPropState->Release();

  return hr;
}

float CComputer::Evaluate | ( | long | lX,
 |  | long | lY |
 | ) |  |  | [private]

Definition at line 452 of file Computer.Cpp.

                                           {

  long lNewX, lNewY, lNewX2, lNewY2;
  float fEval1, fEval2, fEval3;

  if (plField[lX][lY] != 0) {

    lX = - 100;
    lY = - 100;
    return - 100;
  } else {

    // Evaluate defensive options
    plField[lX][lY] = 1;
    fEval2 = (float) (LineScan (1, lNewX, lNewY) / 3);

    // Evaluate offensive options
    plField[lX][lY] = 2;
    fEval1 = (float) LineScan (2, lNewX, lNewY);

    // Evaluate opponent's follow-up
    if (fEval1 > 0) {
      plField[lNewX][lNewY] = 1;
      fEval3 = (float) (LineScan (1, lNewX2, lNewY2) * 0.9);
      plField[lNewX][lNewY] = 0;
    } else
      fEval3 = 0;

    // Restore tiles and return final evaluation
    plField[lX][lY] = 0;
    return fEval1 + fEval2 - fEval3;
  }
}

void CComputer::GetMove | ( | long | lGameID,
 |  | VARIANT_BOOL | bEasy,
 |  | long & | lX,
 |  | long & | lY |
 | ) |  |  | [private]

Definition at line 318 of file Computer.Cpp.

                                                                             {

  long lFlag = 0;
  long lNewX = 0;
  long lNewY = 0;

  // Perhaps there's only possible move
  if (HowManyTurns() == 8) {

    // Scan for open tile
    long i,j;
    for (i = 0; i < 3; i ++) {
      for (j = 0; j < 3; j ++) {
        if (plField[i][j] == 0) {
          lNewX = i;
          lNewY = j;
          lFlag = 1;
        }
      }
    }
  }

  // Check for win
  if (lFlag == 0)
    lFlag = LineScan (2, lNewX, lNewY);

  // Check for block
  if (lFlag == 0)
    lFlag = LineScan (1, lNewX, lNewY);

  // Else create a new move
  if (lFlag == 0) {

    // Prepare random seed
    srand ((unsigned) time (NULL));

    // Decide intelligence level
    if (!bEasy) {

      // Place in center if it's open
      if (plField[1][1] == 0) {
        lNewX = 1;
        lNewY = 1;
        lFlag = 1;

      } else {

        // Place on corner, if opponent placed first move in center
        long lTurns = HowManyTurns();
        if (lTurns == 1 && plField[1][1] > 0) {
          lNewX = (rand() % 2 == 0) ? 0:2;
          lNewY = (rand() % 2 == 0) ? 0:2;
          lFlag = 1;
        } else {

          // Place on opposite tile, if opponent's second
          // move was placed on diagonal
          if (lTurns == 2) {
            if (plField[0][0] == 1) {
              lNewX = 2;
              lNewY = 2;
              lFlag = 1;
            }

            if (plField[0][2] == 1) {
              lNewX = 2;
              lNewY = 0;
              lFlag = 1;
            }

            if (plField[2][0] == 1) {
              lNewX = 0;
              lNewY = 2;
              lFlag = 1;
            }

            if (plField[2][2] == 1) {
              lNewX = 0;
              lNewY = 0;
              lFlag = 1;
            }
          }
        }
      }

      // Else find most intelligent move
      if (lFlag == 0) {

        float value = 0;
        float maxValue = 0;

        for (long i = 0; i < 3; i ++) {
          for (long j = 0; j < 3; j ++) {

            // Evaluate tile
            value = Evaluate (i, j);

            // Randomize equal choices
            if (value == maxValue && rand() % 2 == 0) {

              lNewX = i;
              lNewY = j;

            } else {

              if (value > maxValue) {
                maxValue = value;
                lNewX = i;
                lNewY = j;
              }
            }
          }
        }
      }

    } else {

      // Choose a random slot
      while (lFlag == 0) {

        lNewX = rand() % 3;
        lNewY = rand() % 3;

        if (plField [lNewX][lNewY] == 0)
          lFlag = 1;
      }
    }
  }

  // Prepare return values
  lX = lNewX;
  lY = lNewY;
}

long CComputer::HowManyTurns ( ) [private]

Definition at line 507 of file Computer.Cpp.

                              {

  long lTurns = 0;

  for (int i = 0; i < 3; i ++) {
    for (int j = 0; j < 3; j ++) {
      if (plField[i][j] > 0) {
        lTurns ++;
      }
    }
  }

  return lTurns;
}

void CComputer::InitArray ( ) [inline, private]

Definition at line 46 of file Computer.h.

                                    {
    for (int i = 0; i < 3; i ++)
      for (int j = 0; j < 3; j ++)
        plField[i][j] = 0;
  }

STDMETHODIMP CComputer::InterfaceSupportsErrorInfo ( REFIID riid ) [private]

Definition at line 28 of file Computer.Cpp.

{
  static const IID* arr[] =
  {
    &IID_IComputer,
  };

  for (int i=0;i<sizeof(arr)/sizeof(arr[0]);i++)
  {
    if (::InlineIsEqualGUID(*arr[i],riid))
      return S_OK;
  }
  return S_FALSE;
}

bool CComputer::IsWin ( long lPlayer ) [private]

Definition at line 487 of file Computer.Cpp.

                                   {

  bool bWin = false;

  for (int i = 0; i < 3; i ++) {
    if (plField [i][0] == plField [i][1] && plField [i][1] == plField [i][2] && plField [i][0] == lPlayer)
      bWin = true;
    if (plField [0][i] == plField [1][i] && plField [1][i] == plField [2][i] && plField [0][i] == lPlayer)
      bWin = true;
  }

  if (plField [0][0] == plField [1][1] && plField [1][1] == plField [2][2] && plField [1][1] == lPlayer)
    bWin = true;
  if (plField [2][0] == plField [1][1] && plField [1][1] == plField [0][2] && plField [1][1] == lPlayer)
    bWin = true;

  return bWin;
}

long CComputer::LineScan | ( | long | lPlayer,
 |  | long & | lX,
 |  | long & | lY |
 | ) |  |  | [private]

Definition at line 523 of file Computer.Cpp.

                                                          {

  long lCounter = 0;
  lX = - 100;
  lY = - 100;

  // Horizontal lines
  for (int i = 0; i < 3; i ++) {

    if (plField [1][i] == lPlayer && plField [0][i] == lPlayer && plField[2][i] == 0) {
      lX = 2;
      lY = i;
      lCounter ++;
    }

    if (plField [0][i] == lPlayer && plField [2][i] == lPlayer && plField[1][i] == 0) {
      lX = 1;
      lY = i;
      lCounter ++;
    }

    if (plField [1][i] == lPlayer && plField [2][i] == lPlayer && plField[0][i] == 0) {
      lX = 0;
      lY = i;
      lCounter ++;
    }
  }

  // Vertical lines
  for (i = 0; i < 3; i ++) {

    if (plField [i][1] == lPlayer && plField [i][0] == lPlayer && plField[i][2] == 0) {
      lX = i;
      lY = 2;
      lCounter ++;
    }

    if (plField [i][0] == lPlayer && plField [i][2] == lPlayer && plField[i][1] == 0) {
      lX = i;
      lY = 1;
      lCounter ++;
    }

    if (plField [i][1] == lPlayer && plField [i][2] == lPlayer && plField[i][0] == 0) {
      lX = i;
      lY = 0;
      lCounter ++;
    }
  }

  // Diagonals
  if (plField [1][1] == lPlayer && plField [0][0] == lPlayer && plField[2][2] == 0) {
    lX = 2;
    lY = 2;
    lCounter ++;
  }

  if (plField [1][1] == lPlayer && plField [2][0] == lPlayer && plField[0][2] == 0) {
    lX = 0;
    lY = 2;
    lCounter ++;
  }

  if (plField [1][1] == lPlayer && plField [0][2] == lPlayer && plField[2][0] == 0) {
    lX = 2;
    lY = 0;
    lCounter ++;
  }

  if (plField [1][1] == lPlayer && plField [2][2] == lPlayer && plField[0][0] == 0) {
    lX = 0;
    lY = 0;
    lCounter ++;
  }

  if (plField [0][0] == lPlayer && plField [2][2] == lPlayer && plField[1][1] == 0) {
    lX = 1;
    lY = 1;
    lCounter ++;
  }
  if (plField [0][2] == lPlayer && plField [2][0] == lPlayer && plField[1][1] == 0) {
    lX = 1;
    lY = 1;
    lCounter ++;
  }

  return lCounter;
}

HRESULT CComputer::LoadArray ( long lGameID ) [private]

Definition at line 613 of file Computer.Cpp.

                                          {

  HRESULT hr = S_OK;

  IObjectContext* pObjectContext = NULL;

  ISharedPropertyGroupManager* spmMgr = NULL;
  ISharedPropertyGroup* spmGroup = NULL;
  ISharedProperty* spmPropField[3][3];

  // Get context
  hr = GetObjectContext(&pObjectContext);

  // Create the SharedPropertyGroupManager
  hr = pObjectContext->CreateInstance (CLSID_SharedPropertyGroupManager, IID_ISharedPropertyGroupManager, (void**)&spmMgr);

  // Create the SharedPropertyGroup
  LONG lIsolationMode = LockMethod;
  LONG lReleaseMode = Process;
  VARIANT_BOOL bExists = VARIANT_FALSE;
  hr = spmMgr->CreatePropertyGroup (L"TicTacToe", &lIsolationMode, &lReleaseMode, &bExists, &spmGroup);

  // Load the field SharedProperties
  TCHAR szBuf [512];
  BSTR bstrField;
  CComVariant vField;

  for (long i = 0; i < 3; i ++ ) {
    for (long j = 0; j < 3; j ++) {

      wsprintf (szBuf, _T("%dField%d%d"), lGameID, i, j);
      bstrField = TCHAR2BSTR (szBuf);
      hr = spmGroup->CreateProperty (bstrField, &bExists, &spmPropField[i][j]);
      ::SysFreeString (bstrField);

      hr = spmPropField[i][j]->get_Value (&vField);
      plField[i][j] = vField.lVal;
    }
  }

  if (pObjectContext)
    pObjectContext->Release();

  if (spmMgr)
    spmMgr->Release();

  if (spmGroup)
    spmGroup->Release();

  for (i = 0; i < 3; i ++) {
    for (long j = 0; j < 3; j ++) {
      if (spmPropField[i][j]) {
        spmPropField[i][j]->Release();
      }
    }
  }

  return hr;
}

STDMETHODIMP CComputer::NewMove | ( | IN long | lGameID,
 |  | IN VARIANT_BOOL | bEasy,
 |  | IN long | lX,
 |  | IN long | lY,
 |  | OUT VARIANT * | pvMyX,
 |  | OUT VARIANT * | pvMyY,
 |  | OUT VARIANT * | pvWin
 | ) |  |

Definition at line 193 of file Computer.Cpp.

                                                                             {
  // Win protocol
  // ============
  // 0  -> moves did not end game
  // 1  -> player won
  // -1 -> computer won
  // 2  -> player's move tied the game
  // -2 -> computer's move tied the game

  HRESULT hr = S_OK;

  pvMyX->vt = VT_I4;
  pvMyY->vt = VT_I4;
  pvWin->vt = VT_I4;

  long lTurns = 0;
  long lWin = 0;
  long lNewX = 0;
  long lNewY = 0;

  IObjectContext* pObjectContext = NULL;

  try {

    // Get the object context
    THROW_ERR ( hr = GetObjectContext(&pObjectContext) );
    if (pObjectContext == NULL) {
      THROW_ERR ( E_FAIL );
    }

    THROW_ERR ( LoadArray(lGameID) );

    // Enter new move
    plField [lX][lY] = 1;

    // Check for player's win
    if (IsWin (1)) {

      // Player won
      lWin = 1;

    } else {

      // Check for fullness
      lTurns = HowManyTurns();

      if (lTurns == 9) {

        // Tie
        lWin = - 2;

      } else {

        // Get computer's move
        GetMove (lGameID, bEasy, lNewX, lNewY);
        plField[lNewX][lNewY] = 2;

        // Check for computer win
        if (IsWin(2))

          lWin = - 1;

        else

          // Check for fullness
          if (lTurns == 8)
            lWin = 2;
      }
    }

    // Save array
    THROW_ERR ( SaveArray(lGameID) );

    // Set return values
    pvMyX->lVal = lNewX;
    pvMyY->lVal = lNewY;
    pvWin->lVal = lWin;

    // We're finished and happy
    pObjectContext->SetComplete();

  } catch (HRESULT hr) {

    // Create an ErrorInfo object
    ICreateErrorInfo* pCreateErrInfo = NULL;
    IErrorInfo* pErrInfo = NULL;

    CreateErrorInfo (&pCreateErrInfo);
    pCreateErrInfo->QueryInterface (IID_IErrorInfo, (LPVOID FAR*) &pErrInfo);

    // Fill in error information
    TCHAR szErr[512];
    wsprintf (szErr, _T("Error %d occurred in Computer::NewMove()"), hr);
    BSTR bstrDesc = TCHAR2BSTR (szErr);
    pCreateErrInfo->SetGUID (IID_IComputer);
    pCreateErrInfo->SetSource (L"Computer");
    pCreateErrInfo->SetDescription (bstrDesc);
    ::SysFreeString (bstrDesc);

    // Confirm error information
    SetErrorInfo (0, pErrInfo);

    // Clean up the error objects
    if (pCreateErrInfo)
      pCreateErrInfo->Release();

    if (pErrInfo)
      pErrInfo->Release();

    // Indicate our unhappiness
    if (pObjectContext)
      pObjectContext->SetAbort();

    hr = E_FAIL;
  }

  if (pObjectContext)
    pObjectContext->Release();

  return hr;
}

HRESULT CComputer::SaveArray ( long lGameID ) [private]

Definition at line 674 of file Computer.Cpp.

                                          {

  HRESULT hr = S_OK;

  IObjectContext* pObjectContext = NULL;

  ISharedPropertyGroupManager* spmMgr = NULL;
  ISharedPropertyGroup* spmGroup = NULL;
  ISharedProperty* spmPropField[3][3];

  // Get context
  hr = GetObjectContext(&pObjectContext);

  // Create the SharedPropertyGroupManager
  hr = pObjectContext->CreateInstance (CLSID_SharedPropertyGroupManager, IID_ISharedPropertyGroupManager, (void**)&spmMgr);

  // Create the SharedPropertyGroup
  LONG lIsolationMode = LockMethod;
  LONG lReleaseMode = Process;
  VARIANT_BOOL bExists = VARIANT_FALSE;
  hr = spmMgr->CreatePropertyGroup (L"TicTacToe", &lIsolationMode, &lReleaseMode, &bExists, &spmGroup);

  // Save the field SharedProperties
  TCHAR szBuf [512];
  BSTR bstrField;
  CComVariant vField;
  vField.vt = VT_I4;

  for (long i = 0; i < 3; i ++ ) {
    for (long j = 0; j < 3; j ++) {

      wsprintf (szBuf, _T("%dField%d%d"), lGameID, i, j);
      bstrField = TCHAR2BSTR (szBuf);
      hr = spmGroup->CreateProperty (bstrField, &bExists, &spmPropField[i][j]);
      ::SysFreeString (bstrField);

      vField.lVal = plField[i][j];
      hr = spmPropField[i][j]->put_Value (vField);
    }
  }

  if (pObjectContext)
    pObjectContext->Release();

  if (spmMgr)
    spmMgr->Release();

  if (spmGroup)
    spmGroup->Release();

  for (i = 0; i < 3; i ++) {
    for (long j = 0; j < 3; j ++) {
      if (spmPropField[i][j]) {
        spmPropField[i][j]->Release();
      }
    }
  }

  return hr;
}

Member Data Documentation

long CComputer::plField[3][3] [private]

Definition at line 37 of file Computer.h.

The documentation for this class was generated from the following files:
  • Com/Services/Shared_Property_Manager/TServer/Computer.h
  • Com/Services/Shared_Property_Manager/TServer/Computer.Cpp
Generated on Wed Nov 13 2024 16:55:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CComSpy Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes

CComSpy Class Reference

#include "ccomspy.h"

List of all members.

Public Member Functions

CComSpy ()
~CComSpy ()
STDMETHOD() | About ()
BOOL | AddEventToList (LONGLONG perfCount, LPCOLESTR sEvent, LPCOLESTR sApplication)
BOOL | AddParamValueToList (LPCOLESTR sParamName, LPCOLESTR sValue)
BOOL | AddRunningAspsToDebugMenu (HMENU hMenu)
BOOL Audit ()
STDMETHOD() | ChooseFont ()
STDMETHOD() | ChooseLogFile (BSTR *sLogFileName, BOOL *bCanceled)
STDMETHOD() | ClearAllEvents ()
STDMETHOD() | Close (DWORD dwSaveOption)
HFONT | CreateHFontFromIFont (IFont *pFont)
void | FinalRelease ()
STDMETHOD() | get_Audit (BOOL *pVal)
STDMETHOD() | get_ColWidth (short nColumn, long *pVal)
STDMETHOD() | get_LogFile (BSTR *pVal)
STDMETHOD() | get_LogToFile (BOOL *pVal)
STDMETHOD() | get_ShowGridLines (BOOL *pVal)
STDMETHOD() | get_ShowOnScreen (BOOL *pVal)
IComSpyAudit * GetAuditObj ()
STDMETHOD() | GetViewStatus (DWORD *pdwStatus)
HRESULT | IPersistStreamInit_Load (LPSTREAM pStm, ATL_PROPMAP_ENTRY *pMap)
HRESULT | IPersistStreamInit_Save (LPSTREAM pStm, BOOL, ATL_PROPMAP_ENTRY *pMap)
LRESULT | OnAbout (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnChooseFont (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnChooseLogFile (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnClear (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnCreate (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
LRESULT | OnDebugApplication (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnDestroy (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
HRESULT | OnDrawAdvanced (ATL_DRAWINFO &di)
LRESULT | OnInitMenu (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
LRESULT | OnLogToFile (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnRButtonDown (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
LRESULT | OnSave (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnSelectApplications (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnToggleAudit (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnToggleGridLines (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnToggleShowOnScreen (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
STDMETHOD() | put_Audit (BOOL newVal)
STDMETHOD() | put_ColWidth (short nColumn, long newVal)
STDMETHOD() | put_LogFile (BSTR newVal)
STDMETHOD() | put_LogToFile (BOOL newVal)
STDMETHOD() | put_ShowGridLines (BOOL newVal)
STDMETHOD() | put_ShowOnScreen (BOOL newVal)
HRESULT STDMETHODCALLTYPE | putref_Font (IFontDisp *pFont)
STDMETHOD() | Read (LPCOLESTR pszPropName, VARIANT *pVar, IErrorLog *pErrorLog)
STDMETHOD() | SaveToFile ()
STDMETHOD() | SelectApplications ()
STDMETHOD() | SetObjectRects (LPCRECT prcPos, LPCRECT prcClip)
BOOL | ShouldScroll (int nIndex)
HRESULT | ShutdownApplication (LPCOLESTR sApplicationName)
STDMETHOD() | Write (LPCOLESTR pszPropName, VARIANT *pVar)

Public Attributes

CContainedWindow | m_ctlSysListView32
CComPtr< IFontDisp > | m_pFont

Private Member Functions

HRESULT | EnableAudit (BOOL bEnable)

Private Attributes

BOOL m_bAudit
BOOL m_bCSV
BOOL m_bLogToFile
BOOL m_bShowGridLines
BOOL m_bShowOnScreen
int | m_cEvents
HANDLE m_hFile
HFONT | m_hFont
HMENU | m_hMenuDebug
HWND | m_hWndList
MapStringToAppInfo m_map
long | m_nWidth [NUMBER_COLUMNS]
IComSpyAudit * m_pSqlAudit
CAppInfo * m_pSysAppInfo
CComBSTR | m_sLogFile

Detailed Description

Definition at line 31 of file ccomspy.h.

Constructor & Destructor Documentation

CComSpy::CComSpy ( )

Definition at line 56 of file ComSpy.Cpp.

                 :m_ctlSysListView32(_T("SysListView32"), this, 1)
{
  m_hWndList = NULL;
  m_bLogToFile = FALSE;
  m_hFile = NULL;
  m_cEvents = 0;
  m_bShowGridLines = TRUE;
  m_bWindowOnly = TRUE;
  for (int i=0;i<NUMBER_COLUMNS;i++)
  {
    m_nWidth[i] = 60;
  }

  m_hFont = NULL;
  m_bShowOnScreen = TRUE;
  m_bCSV = FALSE;
  m_bAudit = FALSE;
  m_pSqlAudit = NULL;

  CComBSTR bstrAppName(_T("SysApp"));
  m_pSysAppInfo = new CAppInfo((TCHAR*)bstrAppName, this);
  _ASSERTE(m_pSysAppInfo);
}

CComSpy::~CComSpy ( ) [inline]

Definition at line 76 of file ccomspy.h.

  {
    m_hWndList = NULL;

  }

Member Function Documentation

STDMETHODIMP CComSpy::About ( )

Definition at line 926 of file ComSpy.Cpp.

{
  BOOL bHandled;
  OnAbout(0,0,0,bHandled);
  return S_OK;
}

BOOL CComSpy::AddEventToList | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | sEvent,
 |  | LPCOLESTR | sApplication
 | ) |  |

Definition at line 463 of file ComSpy.Cpp.

{
    long TickCount = 0;
    if (PerformanceFrequency != 0)
        TickCount = (long)((1000 * perfCount) / PerformanceFrequency);

  BOOL bRet;
  if (m_bLogToFile)
  {
    TCHAR sSep[2];
    ZeroMemory(sSep,2 * sizeof(TCHAR));
    (m_bCSV) ? _tcsncat(sSep, _T(","), 1) : _tcsncat(sSep, _T("\t"),1);
    sSep[1] = NULL;
    _ASSERTE(m_hFile);
    TCHAR sBuf[MAX_MSG_LENGTH];
    ZeroMemory(sBuf, MAX_MSG_LENGTH*sizeof(TCHAR));

    wsprintf(sBuf, _T("%s%s%d%s%s\n"), sEvent, sSep, TickCount, sSep, sApplication);

    if (m_hFile)
    {

      DWORD cbWritten;
      bRet = WriteFile(m_hFile, sBuf, lstrlen(sBuf) * sizeof(TCHAR), &cbWritten, NULL);

    }
  }
  if (m_bShowOnScreen)
  {
    int nCount = ListView_GetItemCount(m_hWndList);
    LV_ITEM item;
    TCHAR sz[8];
    wsprintf(sz,_TEXT("%ld"), m_cEvents++);
    memset(&item, NULL, sizeof(item));
    item.mask = LVIF_TEXT;
    item.iItem = nCount;
    item.pszText = sz;
    item.cchTextMax = lstrlen(sz);

    ListView_InsertItem(m_hWndList, &item);
    ListView_SetItemText(m_hWndList, nCount, 1, (LPWSTR)sEvent);

    TCHAR szTick[16];
    wsprintf(szTick, _T("%ld"), TickCount);
    ListView_SetItemText(m_hWndList, nCount, 2, szTick);
    ListView_SetItemText(m_hWndList, nCount, 3, (LPWSTR)sApplication);
    if (ShouldScroll(nCount))
      ListView_EnsureVisible(m_hWndList, nCount, FALSE);
  }
  return TRUE;
}

BOOL CComSpy::AddParamValueToList | ( | LPCOLESTR | sParamName,
 |  | LPCOLESTR | sValue
 | ) |  |

Definition at line 518 of file ComSpy.Cpp.

{
  BOOL bRet;
  if (m_bLogToFile)
  {
    TCHAR sSep[2];
    ZeroMemory(sSep,2 * sizeof(TCHAR));
    (m_bCSV) ? _tcsncat(sSep, _T(","),1) : _tcsncat(sSep, _T("\t"),1);
    sSep[1] = NULL;
    _ASSERTE(m_hFile);
    TCHAR sBuf[MAX_MSG_LENGTH];
    ZeroMemory(sBuf, MAX_MSG_LENGTH*sizeof(TCHAR));
    wsprintf(sBuf, _T("%s%s%s%s%s%s\n"), sSep, sSep, sSep, sParamName,sSep, sValue);
    if (m_hFile)
    {

      DWORD cbWritten;
      bRet = WriteFile(m_hFile, sBuf, lstrlen(sBuf) * sizeof(TCHAR), &cbWritten, NULL);
    }
  }
  if (m_bShowOnScreen)
  {
    int nCount = ListView_GetItemCount(m_hWndList);
    LV_ITEM item;
    item.mask = LVIF_TEXT;
    item.iItem = nCount;
    item.pszText = _T("");
    item.cchTextMax = 1;
    item.iSubItem = 0;
    int nItem;
    nItem = ListView_InsertItem(m_hWndList, &item);
    ListView_SetItemText(m_hWndList, nItem, 4, (LPWSTR)sParamName);
    ListView_SetItemText(m_hWndList, nItem, 5, (LPWSTR)sValue);
    if (ShouldScroll(nCount))
      ListView_EnsureVisible(m_hWndList, nItem, FALSE);
  }

  return TRUE;
}

BOOL CComSpy::AddRunningAspsToDebugMenu ( HMENU hMenu )

Definition at line 1019 of file ComSpy.Cpp.

{

//
//  remove the <No Running Applications> menu item
//

  RemoveMenu(hMenu, 0, MF_BYPOSITION);

  HRESULT hr = E_FAIL;
  IMtsGrp * pMtsGrp = NULL;
  hr = CoCreateInstance (CLSID_MtsGrp, NULL, CLSCTX_ALL, IID_IMtsGrp, (void **)&pMtsGrp);
  if (!pMtsGrp)
  {
    _ASSERTE(0);
    return FALSE;
  }

  long lApplications;
  pMtsGrp -> Refresh(); // its important to call this!
  pMtsGrp -> get_Count(&lApplications);

  IUnknown * pUnk = NULL;
  IMtsEvents * pEvents = NULL;
  USES_CONVERSION;
  long lPID;
  TCHAR szBuf[128];
  for (int i=0; i<lApplications; i++)
  {

    pMtsGrp -> Item(i, &pUnk);
    _ASSERTE(pUnk);
    pUnk -> QueryInterface(IID_IMtsEvents, (void **)&pEvents);
    _ASSERTE(pEvents);
    if (SUCCEEDED(hr))
    {

      CComBSTR sName;
      pEvents -> get_PackageName(&sName.m_str);
      pEvents -> GetProcessID(&lPID);
      ZeroMemory(szBuf, 128*sizeof(TCHAR));
      if (sName.m_str)
      {
        wsprintf(szBuf, _T("%s - PID: %ld"), sName.m_str, lPID);
        int nRet = InsertMenu(hMenu, -1, MF_BYPOSITION|MF_STRING, ID_DEBUG_BEGIN + i, szBuf);
      }
      SafeRelease(pEvents);

    }

    SafeRelease(pEvents);
    SafeRelease(pUnk);
  }

  SafeRelease(pMtsGrp);
  return TRUE;
}

BOOL CComSpy::Audit ( ) [inline]

Definition at line 70 of file ccomspy.h.

{return m_bAudit;}

STDMETHODIMP CComSpy::ChooseFont ( )

Definition at line 982 of file ComSpy.Cpp.

{
  BOOL bHandled;
  OnChooseFont(0,0,0,bHandled);
  return S_OK;
}

STDMETHODIMP CComSpy::ChooseLogFile | ( | BSTR * | sLogFileName,
 |  | BOOL * | bCanceled
 | ) |  |

Definition at line 1001 of file ComSpy.Cpp.

{
  *bCanceled = TRUE;
  BOOL bHandled = TRUE;
  OnChooseLogFile(0,0,0,bHandled);
  if (m_sLogFile.Length() == 0)
  {
    return S_OK;
  }

  *sLogFileName = ::SysAllocString(m_sLogFile.m_str);
  *bCanceled = FALSE;
  return S_OK;
}

STDMETHODIMP CComSpy::ClearAllEvents ( )

Definition at line 918 of file ComSpy.Cpp.

{

  BOOL bHandled;
  OnClear(0,0,0,bHandled);
  return S_OK;
}

HRESULT CComSpy::Close ( DWORD dwSaveOption )

Definition at line 863 of file ComSpy.Cpp.

{
  return IOleObject_Close(dwSaveOption);
}

HFONT CComSpy::CreateHFontFromIFont ( IFont * pFont )

Definition at line 868 of file ComSpy.Cpp.

{

  _ASSERTE(pFont);
  HFONT hFont;
  LOGFONT lf;
  ZeroMemory(&lf, sizeof(lf));
  CComBSTR bstr;
  pFont -> get_Name(&bstr);
  lstrcpyn(lf.lfFaceName, bstr.m_str, bstr.Length());
  CY cy;
  pFont -> get_Size(&cy);
  HDC hDC = ::GetDC(NULL);
  _ASSERTE(hDC);
  long lCaps = GetDeviceCaps(hDC, LOGPIXELSY);
  lf.lfHeight =  -MulDiv(cy.Hi, lCaps, 72);
  lf.lfHeight += -MulDiv(cy.Lo, lCaps, 720000);
  ::ReleaseDC(NULL, hDC);
  short sVal;
  pFont -> get_Weight(&sVal);
  lf.lfWeight  = sVal;
  BOOL bFlag;
  pFont -> get_Italic(&bFlag);
  lf.lfItalic = bFlag;
  pFont -> get_Underline(&bFlag);
  lf.lfUnderline = bFlag;
  pFont -> get_Strikethrough(&bFlag);
  lf.lfStrikeOut = bFlag;
  pFont -> get_Charset(&sVal);
  lf.lfCharSet = (BYTE)sVal;
  hFont = CreateFontIndirect(&lf);
  return hFont;

}

HRESULT CComSpy::EnableAudit ( BOOL bEnable ) [private]

Definition at line 1122 of file ComSpy.Cpp.

{

  if (!bEnable)
  {
    SafeRelease(m_pSqlAudit);
    return S_OK;
  }

  if (m_pSqlAudit)    // make EnableAudit() idempotent -- we are already enabled
    return S_OK;

  HRESULT hr;
  hr = CoCreateInstance(CLSID_ComSpyAudit, NULL, CLSCTX_ALL, IID_IComSpyAudit, (void **)&m_pSqlAudit);
  if (SUCCEEDED(hr))
  {
    //
    //  these hard coded strings (user and pw) should be looked up in the registry for a production
    //  app
    hr = m_pSqlAudit -> Init(L"ComSpyAudit", L"sa", L"");
    if (FAILED(hr))
    {
      LPTSTR sMsg = _T("Unable to connect to DSN 'ComSpyAudit'.\nMake sure that the DSN exists,the Database has the\n \
schema contained in ComSpyAudit.SQL, and you have \nthe permission to access the database.");

      ::MessageBox(m_hWndList, sMsg,  _T("ComSpy"), MB_ICONSTOP);
      SafeRelease(m_pSqlAudit);
    }
  }
  else
  {

    ::MessageBox(m_hWndList, _T("Unable to create the ComSpyAudit component!"),  _T("ComSpy"), MB_ICONSTOP);
  }

  return hr;
}

void CComSpy::FinalRelease ( ) [inline]

Definition at line 81 of file ccomspy.h.

  {
    SafeRelease(m_pSqlAudit);
  }

STDMETHODIMP CComSpy::get_Audit ( BOOL * pVal )

Definition at line 677 of file ComSpy.Cpp.

{
  *pVal = m_bAudit;
  return S_OK;
}

STDMETHODIMP CComSpy::get_ColWidth | ( | short | nColumn,
 |  | long * | pVal
 | ) |  |

Definition at line 692 of file ComSpy.Cpp.

{
  _ASSERTE(m_hWndList);
  _ASSERTE(nColumn >= 0 && nColumn <= NUMBER_COLUMNS);
  *pVal = ListView_GetColumnWidth(m_hWndList, nColumn);
  return S_OK;
}

STDMETHODIMP CComSpy::get_LogFile ( BSTR * pVal )

Definition at line 624 of file ComSpy.Cpp.

{
  *pVal = m_sLogFile.Copy();
  return S_OK;
}

STDMETHODIMP CComSpy::get_LogToFile ( BOOL * pVal )

Definition at line 933 of file ComSpy.Cpp.

{
  *pVal = m_bLogToFile;
  return S_OK;
}

STDMETHODIMP CComSpy::get_ShowGridLines ( BOOL * pVal )

Definition at line 657 of file ComSpy.Cpp.

{
  *pVal = m_bShowGridLines;
  return S_OK;
}

STDMETHODIMP CComSpy::get_ShowOnScreen ( BOOL * pVal )

Definition at line 989 of file ComSpy.Cpp.

{
  *pVal = m_bShowOnScreen;
  return S_OK;
}

IComSpyAudit* CComSpy::GetAuditObj ( ) [inline]

Definition at line 71 of file ccomspy.h.

{return m_pSqlAudit;}

STDMETHOD() CComSpy::GetViewStatus ( DWORD * pdwStatus ) [inline]

Definition at line 184 of file ccomspy.h.

  {
    ATLTRACE(_T("IViewObjectExImpl::GetViewStatus\n"));
    *pdwStatus = VIEWSTATUS_SOLIDBKGND | VIEWSTATUS_OPAQUE;
    return S_OK;
  }

HRESULT CComSpy::IPersistStreamInit_Load | ( | LPSTREAM | pStm,
 |  | ATL_PROPMAP_ENTRY * | pMap
 | ) |  |

Definition at line 712 of file ComSpy.Cpp.

{

  ULONG cbRead;

  // read in the version
  UINT nVersion;
  pStm -> Read((void *)&nVersion, sizeof(UINT), &cbRead);
  if (nVersion != 3)
  {
    ::MessageBox(m_hWndList, _T("The saved information is from a different version of the control.\n\nThe saved state will have to be discarded."), _T("COM Spy"), MB_ICONINFORMATION);
    return S_OK;
  }

  // get log file size
  long lLen;
  pStm -> Read((void *)&lLen, sizeof(long), &cbRead);

  // read in the chars for the log name
  char * pLog = new char[lLen+1];
  ZeroMemory(pLog, lLen+1);
  pStm -> Read((void*)pLog, lLen, &cbRead);

  m_sLogFile = pLog;
  delete [] pLog;

  // gridlines
  pStm -> Read((void *)&m_bShowGridLines, sizeof(BOOL),&cbRead);
  put_ShowGridLines(m_bShowGridLines);

  // show on screen
  pStm -> Read((void *)&m_bShowOnScreen, sizeof(BOOL),&cbRead);
  put_ShowOnScreen(m_bShowOnScreen);

  // log to file
  pStm -> Read((void *)&m_bLogToFile, sizeof(BOOL),&cbRead);
  put_LogToFile(m_bLogToFile);

  // csv files
  pStm -> Read((void *)&m_bCSV, sizeof(BOOL), &cbRead);

  // csv files
  pStm -> Read((void *)&m_bAudit, sizeof(BOOL), &cbRead);
  EnableAudit(m_bAudit);

  // read the col widths
  int i;
  long nWidth;
  for (i=0;i<NUMBER_COLUMNS;i++)
  {
    pStm -> Read((void *)&nWidth, sizeof(long), &cbRead);
    put_ColWidth(i, nWidth);
  }

  BOOL bCustomFont = FALSE;
  pStm -> Read((void *)&bCustomFont, sizeof(BOOL),&cbRead);
  if (bCustomFont)
  {
    if (!m_pFont)
    {
      //create an IFontDisp
      HRESULT hr= CoCreateInstance(CLSID_StdFont, NULL, CLSCTX_ALL, IID_IFontDisp, (void **)&m_pFont);
      _ASSERTE(SUCCEEDED(hr));
    }
    if (m_pFont)
    {
      IPersistStream * pFontSt = NULL;
      m_pFont -> QueryInterface(IID_IPersistStream, (void **)&pFontSt);
      pFontSt -> Load(pStm);
      pFontSt -> Release();
      if (m_hFont) // should I tell the list that I deleted its font?
        DeleteObject(m_hFont);
      IFont * pFont = NULL;
      m_pFont -> QueryInterface(IID_IFont, (void **)&pFont);
      _ASSERTE(pFont);
      m_hFont = CreateHFontFromIFont(pFont);
      pFont -> Release();
    }
  }

  return S_OK;
}

HRESULT CComSpy::IPersistStreamInit_Save | ( | LPSTREAM | pStm,
 |  | BOOL | ,
 |  | ATL_PROPMAP_ENTRY * | pMap
 | ) |  |

Definition at line 795 of file ComSpy.Cpp.

{
  _ASSERTE(this);
  _ASSERTE(m_hWndList);

  ULONG cbWritten = 0;
  // write a version
  UINT nVersion  = 3;
  pStm -> Write((void *)&nVersion, sizeof(UINT), &cbWritten);

  // write the log file size
  long nChars = m_sLogFile.Length();
  pStm -> Write((void *)&nChars, sizeof(long), &cbWritten);
  _ASSERTE(cbWritten == sizeof(long));

  // write the log file name (in ANSI!)
  USES_CONVERSION;
  char * sFile = W2A((BSTR)m_sLogFile);
  pStm -> Write((void *)sFile, m_sLogFile.Length(), &cbWritten);

  // write the BOOL if gridlines should be shown
  pStm -> Write((void *)&m_bShowGridLines, sizeof(BOOL), &cbWritten);

  // write the BOOL if the user wants to see the messages
  pStm -> Write((void *)&m_bShowOnScreen, sizeof(BOOL), &cbWritten);

  // write the BOOL if the user wants to log the messages
  pStm -> Write((void *)&m_bLogToFile, sizeof(BOOL), &cbWritten);

  // write the BOOL if we have CSV files
  pStm -> Write((void *)&m_bCSV, sizeof(BOOL), &cbWritten);

  // write the BOOL if Auditing is enabled
  pStm -> Write((void *)&m_bAudit, sizeof(BOOL), &cbWritten);

  // write the col widths
  int i;
  long nWidth;
  for (i=0;i<NUMBER_COLUMNS;i++)
  {
    get_ColWidth(i, &nWidth);
    _ASSERTE(nWidth);
    pStm -> Write((void *)&nWidth, sizeof(long), &cbWritten);
  }

  // ask the font to persist itself in the stream
  BOOL bCustomFont;
  if (m_pFont)
  {
    bCustomFont = TRUE;
    pStm -> Write((void *)&bCustomFont, sizeof(BOOL), &cbWritten);
    IPersistStream * pSt = NULL;
    m_pFont -> QueryInterface(IID_IPersistStream, (void **)&pSt);
    _ASSERTE(pSt);
    pSt -> Save(pStm, FALSE);
    pSt -> Release();
  }
  else
  {
    bCustomFont = FALSE;
    pStm -> Write((void *)&bCustomFont, sizeof(BOOL), &cbWritten);
  }

  return S_OK;
}

LRESULT CComSpy::OnAbout | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 318 of file ComSpy.Cpp.

{
  HICON hIcon =  LoadIcon(_Module.GetModuleInstance(), MAKEINTRESOURCE(IDI_MAIN));

  ShellAbout(m_hWnd, _T("COM Spy"), _T("Version 1.00"), hIcon);
  return 0;
}

LRESULT CComSpy::OnChooseFont | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 611 of file ComSpy.Cpp.

{
  HRESULT hr = S_OK;
  CComPtr<IUnknown> pUnk;
  ControlQueryInterface(IID_IUnknown, (void**)&pUnk);
  _ASSERTE(pUnk != NULL);
  LPOLESTR szTitle = _T("Com Spy - Choose Font");
  hr = OleCreatePropertyFrame(m_hWnd, m_rcPos.top, m_rcPos.left, szTitle,
    1, &pUnk.p, 1, (GUID *)&CLSID_StockFontPage, LOCALE_USER_DEFAULT, 0, 0);

  return 0;
}

LRESULT CComSpy::OnChooseLogFile | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 226 of file ComSpy.Cpp.

{

  USES_CONVERSION;
  OPENFILENAME OpenFileName;
  TCHAR         szFile[MAX_PATH];
  memset(szFile, NULL, MAX_PATH * sizeof(TCHAR));
  if (m_sLogFile.Length() > 2)
    lstrcpyn(szFile, OLE2T(m_sLogFile.m_str), m_sLogFile.Length());
  else
    lstrcpyn(szFile, _T("ComSpy.Log"), 10);

    // Fill in the OPENFILENAME structure to support a template and hook.
  OpenFileName.lStructSize       = sizeof(OPENFILENAME);
    OpenFileName.hwndOwner         = m_hWndList;
    OpenFileName.hInstance         = _Module.GetModuleInstance( );
    OpenFileName.lpstrFilter       = _T("TAB seperated Files (*.log)\0*.log\0CSV Files (*.csv)\0*.csv\0");
    OpenFileName.lpstrCustomFilter = NULL;
    OpenFileName.nMaxCustFilter    = 0;
    OpenFileName.nFilterIndex      = 0;
    OpenFileName.lpstrFile          = szFile;
    OpenFileName.nMaxFile          = sizeof(szFile);
    OpenFileName.lpstrFileTitle    = NULL;
    OpenFileName.nMaxFileTitle     = 0;
    OpenFileName.lpstrInitialDir   = NULL;
    OpenFileName.lpstrTitle        = _T("Choose Log File");
    OpenFileName.nFileOffset       = 0;
    OpenFileName.nFileExtension    = 0;
    OpenFileName.lpstrDefExt       = NULL;
    OpenFileName.lCustData         = 0;
  OpenFileName.lpfnHook        = NULL;
  OpenFileName.lpTemplateName    = NULL;
    OpenFileName.Flags             = OFN_EXPLORER | OFN_HIDEREADONLY |OFN_NOREADONLYRETURN |OFN_CREATEPROMPT;

  // Call the common dialog function.
    if (GetSaveFileName(&OpenFileName))
    {
    m_sLogFile = OpenFileName.lpstrFile;
    if (lstrcmpi(OpenFileName.lpstrFile + OpenFileName.nFileExtension, _T("csv")) == 0)
      m_bCSV = TRUE;

  }

  return 0;

}

LRESULT CComSpy::OnClear | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 329 of file ComSpy.Cpp.

{

  ListView_DeleteAllItems(m_hWndList);
  m_cEvents = 0;
  return 0;
}

LRESULT CComSpy::OnCreate | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 104 of file ComSpy.Cpp.

{
  RECT rc;
  GetWindowRect(&rc);
  rc.right -= rc.left;
  rc.bottom -= rc.top;
  rc.top = rc.left = 0;
  DWORD dwStyle = WS_VISIBLE|WS_CHILD|LVS_REPORT|LVS_SINGLESEL|WS_BORDER;
  if (!m_hWndList)
    m_hWndList = m_ctlSysListView32.Create(m_hWnd, rc, _T(""), dwStyle);

  _ASSERTE(m_hWndList);
  put_ShowGridLines(m_bShowGridLines);

  //
  //  we always want the list to be Full Row Select --
  //  note: this only works if the user has IE 3.0 installed
  //
  dwStyle = ListView_GetExtendedListViewStyle(m_hWndList);
  dwStyle |= LVS_EX_FULLROWSELECT;
  ListView_SetExtendedListViewStyle(m_hWndList, dwStyle);

  //
  //  create the columns in our list
  //
  LV_COLUMN col;
  memset(&col,NULL, sizeof(col));
  col.mask = LVCF_TEXT|LVCF_WIDTH;
  col.fmt = LVCFMT_LEFT;
  int i;
  for (i=0;i<NUMBER_COLUMNS;i++)
  {
    col.cx = m_nWidth[i];
    col.pszText = sColNames[i];
    col.cchTextMax  = lstrlen(col.pszText);
    ListView_InsertColumn(m_hWndList, i, &col);
  }

    QueryPerformanceFrequency((LARGE_INTEGER *)&PerformanceFrequency);

  if (m_hFont)
  {
    // this is set if the container app has set our properties using the property bag
    ::SendMessage(m_hWndList, WM_SETFONT, (WPARAM)m_hFont, MAKELPARAM(TRUE,0));
  }

  return 0;
}

LRESULT CComSpy::OnDebugApplication | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 1086 of file ComSpy.Cpp.

{

  HCURSOR hBusy = LoadCursor(NULL, IDC_WAIT);
  HCURSOR hOldCur = SetCursor(hBusy);
  TCHAR szBuf[128];
  ZeroMemory(szBuf, 128 * sizeof(TCHAR));
  int nChars;
  _ASSERTE(m_hMenuDebug);
  nChars = GetMenuString(m_hMenuDebug, wID, szBuf, 128, MF_BYCOMMAND);
  if (nChars)
  {
    int nCount = lstrlen(szBuf);
    LPTSTR p = szBuf + nCount;
    while (*p-- != ':' && nCount)
    {
      nCount --;
    }

    if (nCount == 0)
    {
      SetCursor(hOldCur);
      return 0;
    }

    p+=3;
    TCHAR buf[MAX_PATH];
    wsprintf(buf, _T("-p %s -e %s"), p, p);
    HINSTANCE hInst = ShellExecute( NULL, _T("open"), _T("msdev"), buf, NULL, SW_SHOWNORMAL);
  }
  SetCursor(hOldCur);
  return 0;
}

LRESULT CComSpy::OnDestroy | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 570 of file ComSpy.Cpp.

{
  bHandled = FALSE; // continue processing

  //
  //  clean up our application information
  //
  MapStringToAppInfo::iterator iter;
  CAppInfo * pInfo;
  for (iter = m_map.begin(); iter != m_map.end(); ++iter)
  {

    pInfo = (*iter).second;
    delete pInfo;
  }
  m_map.clear();

  if(m_pSysAppInfo)
    delete m_pSysAppInfo;

  if (m_hFont)
  {
    DeleteObject(m_hFont);
    m_hFont = NULL;
  }

  m_bLogToFile = FALSE;
  if (m_hFile)
  {
    CloseHandle(m_hFile);
    m_hFile = NULL;
  }

  m_cEvents = 0;
  m_bShowGridLines = TRUE;
  return 0;
}

HRESULT CComSpy::OnDrawAdvanced ( ATL_DRAWINFO & di )

Definition at line 81 of file ComSpy.Cpp.

{
  return S_OK;
}

LRESULT CComSpy::OnInitMenu | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 157 of file ComSpy.Cpp.

{
  HMENU hMenu = (HMENU)wParam;
  CComBSTR temp = "Log to File ";
  if (m_sLogFile.Length() > 5)
    temp += m_sLogFile;
  else
    temp += "...";

  USES_CONVERSION;
  ModifyMenu(hMenu, ID_LOG, MF_BYCOMMAND|MF_STRING, ID_LOG, OLE2T(temp));
  CheckMenuItem(hMenu, ID_LOG,  m_bLogToFile ? MF_BYCOMMAND|MF_CHECKED : MF_BYCOMMAND|MF_UNCHECKED);
  CheckMenuItem(hMenu, ID_OPTIONS_GRID_LINES,  m_bShowGridLines ? MF_BYCOMMAND|MF_CHECKED : MF_BYCOMMAND|MF_UNCHECKED);
  CheckMenuItem(hMenu, ID_SHOW_ON_SCREEN,  m_bShowOnScreen ? MF_BYCOMMAND|MF_CHECKED : MF_BYCOMMAND|MF_UNCHECKED);
  CheckMenuItem(hMenu, ID_AUDIT,  m_bAudit ? MF_BYCOMMAND|MF_CHECKED : MF_BYCOMMAND|MF_UNCHECKED);

  m_hMenuDebug = GetSubMenu(hMenu, 5);
  _ASSERTE(m_hMenuDebug);
  AddRunningAspsToDebugMenu(m_hMenuDebug);

  return 0;
}

LRESULT CComSpy::OnLogToFile | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 185 of file ComSpy.Cpp.

{

  m_bLogToFile = 1 - m_bLogToFile;
  if (m_bLogToFile)
  {
    if (m_sLogFile.Length() == 0)
    {
      BOOL bHandled = TRUE;
      OnChooseLogFile(0,0,0,bHandled);
      if (m_sLogFile.Length() == 0)
        return 0;
    }
    m_hFile = CreateFile(m_sLogFile, GENERIC_WRITE,
              0, (LPSECURITY_ATTRIBUTES) NULL,
              OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL,
              (HANDLE) NULL);

    if (!m_hFile)
    {
      m_bLogToFile = FALSE;
      return 0;
    }

  }
  else
  {
    if (m_hFile)
    {
      CloseHandle(m_hFile);
      m_hFile = NULL;
    }

  }

  return 0;
}

LRESULT CComSpy::OnRButtonDown | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 85 of file ComSpy.Cpp.

{
  HMENU hMenu = LoadMenu(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_SPYMENU));
  if (!hMenu)
  {
    _ASSERTE(0);
    return 0;
  }
  POINT local;
  local.x = LOWORD(lParam);
  local.y = HIWORD(lParam);
    ClientToScreen(&local);
  HMENU hPopup = GetSubMenu(hMenu, 0);
    _ASSERTE(hPopup != NULL);
  TrackPopupMenu(hPopup, TPM_LEFTALIGN | TPM_RIGHTBUTTON, local.x, local.y, NULL, m_hWndList, NULL);

  return 0;
}

LRESULT CComSpy::OnSave | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 341 of file ComSpy.Cpp.

{
  USES_CONVERSION;
  OPENFILENAME OpenFileName;
  TCHAR         szFile[MAX_PATH];
  memset(szFile, NULL, MAX_PATH * sizeof(TCHAR));
  if (m_sLogFile.Length() > 2)
    lstrcpyn(szFile, OLE2T(m_sLogFile.m_str), m_sLogFile.Length());
  else
    lstrcpyn(szFile, _T("COMSpy.Log"), 10);

  OpenFileName.lStructSize       = sizeof(OPENFILENAME);
    OpenFileName.hwndOwner         = m_hWndList;
    OpenFileName.hInstance         = _Module.GetModuleInstance( );
    OpenFileName.lpstrFilter       = NULL;
    OpenFileName.lpstrCustomFilter = NULL;
    OpenFileName.nMaxCustFilter    = 0;
    OpenFileName.nFilterIndex      = 0;
    OpenFileName.lpstrFile          = szFile;
    OpenFileName.nMaxFile          = sizeof(szFile);
    OpenFileName.lpstrFileTitle    = NULL;
    OpenFileName.nMaxFileTitle     = 0;
    OpenFileName.lpstrInitialDir   = NULL;
    OpenFileName.lpstrTitle        = _T("Log ToFile");
    OpenFileName.nFileOffset       = 0;
    OpenFileName.nFileExtension    = 0;
    OpenFileName.lpstrDefExt       = NULL;
    OpenFileName.lCustData         = 0;
  OpenFileName.lpfnHook        = NULL;
  OpenFileName.lpTemplateName    = NULL;
    OpenFileName.Flags             = OFN_EXPLORER | OFN_HIDEREADONLY |OFN_NOREADONLYRETURN;

  // Call the common dialog function.
    if (GetSaveFileName(&OpenFileName))
    {

    FILE* f = _tfopen(OpenFileName.lpstrFile, _T("a+"));
    if (f)
    {
      int nCount = ListView_GetItemCount(m_hWndList);
      int i, j;
      TCHAR buf[MAX_MSG_LENGTH];
      for (i=0; i<nCount; i++)
      {
        for (j=0; j < 4; j++)
        {
          ListView_GetItemText(m_hWndList, i, j, buf, MAX_MSG_LENGTH);
          _ftprintf(f, _T("%s\t"),buf);
        }
        while ( i < nCount - 1)
        {
          i++; // move to next column

          // now get the name/value pairs
          ListView_GetItemText(m_hWndList, i, 4, buf, MAX_MSG_LENGTH);
          if (*buf)
          {

            _ftprintf(f, _T("\n\t\t\t\t%s\t"), buf);
            ListView_GetItemText(m_hWndList, i, 5, buf, MAX_MSG_LENGTH);
            _ftprintf(f, _T("%s"),buf);
          }
          else
          {
            i--;
            _ftprintf(f, _T("\n"));
            break;
          }
        }
      }

      fclose(f);
    }

  }

  return 0;

}

LRESULT CComSpy::OnSelectApplications | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 562 of file ComSpy.Cpp.

{
  CSelectEventsDlg dlg(&m_map, m_pSysAppInfo, this);
  dlg.DoModal();
  return 0;
}

LRESULT CComSpy::OnToggleAudit | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 297 of file ComSpy.Cpp.

{

  m_bAudit = 1 - m_bAudit;
  HRESULT hr = EnableAudit(m_bAudit);
  if (hr != S_OK)
    m_bAudit = FALSE;
  return 0;
}

LRESULT CComSpy::OnToggleGridLines | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 279 of file ComSpy.Cpp.

{

  m_bShowGridLines = 1 - m_bShowGridLines;

  DWORD dwStyle = ListView_GetExtendedListViewStyle(m_hWndList);
  (m_bShowGridLines) ? dwStyle |= LVS_EX_GRIDLINES :
             dwStyle &= ~LVS_EX_GRIDLINES;

  ListView_SetExtendedListViewStyle(m_hWndList, dwStyle);

  return 0;
}

LRESULT CComSpy::OnToggleShowOnScreen | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 308 of file ComSpy.Cpp.

{
  m_bShowOnScreen = 1-m_bShowOnScreen;
  return 0;

}

STDMETHODIMP CComSpy::put_Audit ( BOOL newVal )

Definition at line 683 of file ComSpy.Cpp.

{

  m_bAudit = newVal;
  EnableAudit(m_bAudit);
  return S_OK;
}

STDMETHODIMP CComSpy::put_ColWidth | ( | short | nColumn,
 |  | long | newVal
 | ) |  |

Definition at line 700 of file ComSpy.Cpp.

{
  if (nColumn >= NUMBER_COLUMNS)
    return E_INVALIDARG;

  m_nWidth[nColumn] = newVal;
  ListView_SetColumnWidth(m_hWndList, nColumn, newVal);
  FireViewChange();
  return S_OK;
}

STDMETHODIMP CComSpy::put_LogFile ( BSTR newVal )

Definition at line 630 of file ComSpy.Cpp.

{

  HANDLE hTemp;
  hTemp = CreateFile(newVal, GENERIC_WRITE,
            0, (LPSECURITY_ATTRIBUTES) NULL,
            OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL,
            (HANDLE) NULL);

  if (hTemp)
  {
    if (m_hFile)
    {
      CloseHandle(m_hFile);
    }

    m_hFile = hTemp;
  }
  else
    return E_INVALIDARG;

  m_sLogFile = newVal;
  return S_OK;
}

STDMETHODIMP CComSpy::put_LogToFile ( BOOL newVal )

Definition at line 939 of file ComSpy.Cpp.

{
  m_bLogToFile = newVal;
  if (m_bLogToFile)
  {
    if (m_sLogFile.Length() == 0)
    {
      BOOL bHandled = TRUE;
      OnChooseLogFile(0,0,0,bHandled);
      if (m_sLogFile.Length() == 0)
        return 0;
    }

    if (m_hFile)
    {
      CloseHandle(m_hFile);
      m_hFile = NULL;
    }

    m_hFile = CreateFile(m_sLogFile, GENERIC_WRITE,
              0, (LPSECURITY_ATTRIBUTES) NULL,
              OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL,
              (HANDLE) NULL);

    if (!m_hFile)
    {
      m_bLogToFile = FALSE;
      return E_FAIL;
    }

  }
  else
  {
    if (m_hFile)
    {
      CloseHandle(m_hFile);
      m_hFile = NULL;
    }

  }
  return S_OK;
}

STDMETHODIMP CComSpy::put_ShowGridLines ( BOOL newVal )

Definition at line 663 of file ComSpy.Cpp.

{

  m_bShowGridLines = newVal;
  DWORD dwStyle = ListView_GetExtendedListViewStyle(m_hWndList);
  (m_bShowGridLines) ? dwStyle |= LVS_EX_GRIDLINES :
             dwStyle &= ~LVS_EX_GRIDLINES;

  ListView_SetExtendedListViewStyle(m_hWndList, dwStyle);
  FireViewChange();
  return S_OK;
}

STDMETHODIMP CComSpy::put_ShowOnScreen ( BOOL newVal )

Definition at line 995 of file ComSpy.Cpp.

{
  m_bShowOnScreen = newVal;
  return S_OK;
}

HRESULT STDMETHODCALLTYPE CComSpy::putref_Font ( IFontDisp * pFont ) [inline]

Definition at line 215 of file ccomspy.h.

  {
    CComQIPtr<IFont, &IID_IFont> pIFont(pFont);
    if (pIFont)
    {
      if (m_hFont)
      {
        DeleteObject(m_hFont);
        m_hFont = NULL;

      }
      m_hFont = CreateHFontFromIFont(pIFont);
      if (m_hFont)
      {
        ::SendMessage(m_hWndList, WM_SETFONT, (WPARAM)m_hFont, 0L);
      }
    }

    if (FireOnRequestEdit(DISPID_FONT) == S_FALSE)
      return S_FALSE;
    m_pFont = pFont;
    m_bRequiresSave = TRUE;
    FireOnChanged(DISPID_FONT);
    FireViewChange();
    return S_OK;

  }

STDMETHOD() CComSpy::Read | ( | LPCOLESTR | pszPropName,
 |  | VARIANT * | pVar,
 |  | IErrorLog * | pErrorLog |
 | ) |  |  | [inline]

Definition at line 244 of file ccomspy.h.

  {
    return S_OK;
  }

STDMETHODIMP CComSpy::SaveToFile ( )

Definition at line 910 of file ComSpy.Cpp.

{

  BOOL bHandled;
  OnSave(0,0,0,bHandled);
  return S_OK;
}

STDMETHODIMP CComSpy::SelectApplications ( )

Definition at line 903 of file ComSpy.Cpp.

{
  BOOL bHandled;
  OnSelectApplications(0,0,0,bHandled);
  return S_OK;
}

STDMETHOD() CComSpy::SetObjectRects | ( | LPCRECT | prcPos,
 |  | LPCRECT | prcClip |
 | ) |  |  | [inline]

Definition at line 170 of file ccomspy.h.

  {
    IOleInPlaceObjectWindowlessImpl<CComSpy>::SetObjectRects(prcPos, prcClip);
    int cx, cy;
    cx = prcPos->right - prcPos->left;
    cy = prcPos->bottom - prcPos->top;
    ::SetWindowPos(m_ctlSysListView32.m_hWnd, NULL, 0,
      0, cx, cy, SWP_NOZORDER | SWP_NOACTIVATE);

    return S_OK;
  }

BOOL CComSpy::ShouldScroll ( int nIndex )

Definition at line 430 of file ComSpy.Cpp.

{
  BOOL bRet = FALSE;
  int nCountPage = ListView_GetCountPerPage(m_hWndList);
  int nTopIndex = ListView_GetTopIndex(m_hWndList);
  if (nTopIndex + nCountPage>= nIndex)
    bRet = TRUE;
  return bRet;
}

HRESULT CComSpy::ShutdownApplication ( LPCOLESTR sApplicationName )

Definition at line 443 of file ComSpy.Cpp.

{

  USES_CONVERSION;
  CAppInfo * pInfo = m_map[W2A(sApplicatioinName)];
  if (!pInfo)
  {
    _ASSERTE(0); // we should never get this unless we have a sink for (at least) the Applicatioin events
    return E_FAIL;
  }

  size_t nElementsRemoved = m_map.erase(W2A(sApplicatioinName));
  _ASSERTE(nElementsRemoved == 1);
  delete pInfo;
  return S_OK;
}

STDMETHOD() CComSpy::Write | ( | LPCOLESTR | pszPropName,
 |  | VARIANT * | pVar |
 | ) |  |  | [inline]

Definition at line 249 of file ccomspy.h.

  {
    return S_OK;
  }

Member Data Documentation

BOOL CComSpy::m_bAudit [private]

Definition at line 60 of file ccomspy.h.

BOOL CComSpy::m_bCSV [private]

Definition at line 64 of file ccomspy.h.

BOOL CComSpy::m_bLogToFile [private]

Definition at line 54 of file ccomspy.h.

BOOL CComSpy::m_bShowGridLines [private]

Definition at line 59 of file ccomspy.h.

BOOL CComSpy::m_bShowOnScreen [private]

Definition at line 63 of file ccomspy.h.

int CComSpy::m_cEvents [private]

Definition at line 57 of file ccomspy.h.

CContainedWindow CComSpy::m_ctlSysListView32

Definition at line 73 of file ccomspy.h.

HANDLE CComSpy::m_hFile [private]

Definition at line 55 of file ccomspy.h.

HFONT CComSpy::m_hFont [private]

Definition at line 61 of file ccomspy.h.

HMENU CComSpy::m_hMenuDebug [private]

Definition at line 65 of file ccomspy.h.

HWND CComSpy::m_hWndList [private]

Definition at line 58 of file ccomspy.h.

MapStringToAppInfo CComSpy::m_map [private]

Definition at line 52 of file ccomspy.h.

long CComSpy::m_nWidth[NUMBER_COLUMNS] [private]

Definition at line 62 of file ccomspy.h.

CComPtr<IFontDisp> CComSpy::m_pFont

Definition at line 72 of file ccomspy.h.

IComSpyAudit* CComSpy::m_pSqlAudit [private]

Definition at line 66 of file ccomspy.h.

CAppInfo* CComSpy::m_pSysAppInfo [private]

Definition at line 53 of file ccomspy.h.

CComBSTR CComSpy::m_sLogFile [private]

Definition at line 56 of file ccomspy.h.

The documentation for this class was generated from the following files:
  • Com/Administration/Spy/ComSpyCtl/ccomspy.h
  • Com/Administration/Spy/ComSpyCtl/ComSpy.Cpp
Generated on Wed Nov 13 2024 16:55:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CComSpyPropPage Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes

CComSpyPropPage Class Reference

#include "ComSpyproppage.h"

List of all members.

Public Types

enum | { IDD = IDD_COMSPYPROPPAGE }

Public Member Functions

CComSpyPropPage ()
STDMETHOD() | Apply (void)
LRESULT | OnCheckBoxClick (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnInitDialog (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
LRESULT | OnLogFileChange (WORD wNotify, WORD wID, HWND hWnd, BOOL &bHandled)
LRESULT | OnSelectColumn (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnWidthChange (WORD wNotify, WORD wID, HWND hWnd, BOOL &bHandled)

Public Attributes

CComPtr< IComSpy > | m_pSpy

Detailed Description

Definition at line 27 of file ComSpyproppage.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 46 of file ComSpyproppage.h.

{IDD = IDD_COMSPYPROPPAGE};

Constructor & Destructor Documentation

CComSpyPropPage::CComSpyPropPage ( ) [inline]

Definition at line 38 of file ComSpyproppage.h.

  {
    m_dwTitleID = IDS_TITLEComSpyPropPage;
    m_dwHelpFileID = IDS_HELPFILEComSpyPropPage;
    m_dwDocStringID = IDS_DOCSTRINGComSpyPropPage;
    m_bDirty = FALSE;
  }

Member Function Documentation

STDMETHODIMP CComSpyPropPage::Apply ( void )

Definition at line 93 of file ComSpyproppage.Cpp.

{
  ATLTRACE(_T("CComSpyPropPage::Apply\n"));
  for (UINT i = 0; i < m_nObjects; i++)
  {

    CComQIPtr<IComSpy, &IID_IComSpy> pSpy(m_ppUnk[i]);
    BSTR bstr;
    GetDlgItemText(IDC_LOG_FILE, bstr);
    pSpy -> put_LogFile(bstr);
    ::SysFreeString(bstr);
    // grid lines
    BOOL bVal = (SendDlgItemMessage(IDC_SHOW_GRID_LINES, BM_GETCHECK) == BST_CHECKED);
    pSpy -> put_ShowGridLines(bVal);

    // log to file
    bVal = (SendDlgItemMessage(IDC_LOG_TO_FILE, BM_GETCHECK) == BST_CHECKED);
    pSpy -> put_LogToFile(bVal);

    // show on screen
    bVal = (SendDlgItemMessage(IDC_SHOW_ON_SCREEN, BM_GETCHECK) == BST_CHECKED);
    pSpy -> put_ShowOnScreen(bVal);

    int j;
    UINT nWidth;
    for (j=0;j<sizeof(szColNames)/sizeof(szColNames[0]);j++)
    {

      nWidth = SendDlgItemMessage(IDC_COLUMN_NAMES, CB_GETITEMDATA, j) ;
      if (nWidth)
      {
        pSpy -> put_ColWidth(j,nWidth);
        SendDlgItemMessage(IDC_COLUMN_NAMES, CB_SETITEMDATA, j, 0);
      }
    }

  }
  SetDirty(FALSE);
  m_bDirty = FALSE;
  return S_OK;
}

LRESULT CComSpyPropPage::OnCheckBoxClick | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled |
 | ) |  |  | [inline]

Definition at line 85 of file ComSpyproppage.h.

{
  SetDirty(TRUE);
  return 0;

}

LRESULT CComSpyPropPage::OnInitDialog | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 37 of file ComSpyproppage.Cpp.

{

  bHandled = FALSE;

  m_ppUnk[0]->QueryInterface(IID_IComSpy, (void**)&m_pSpy);
  _ASSERTE(m_pSpy);
  CComBSTR bstr;
  m_pSpy -> get_LogFile(&bstr);
  SetDlgItemText(IDC_LOG_FILE, bstr);

  // grid lines
  BOOL bVal;
  m_pSpy -> get_ShowGridLines(&bVal);
  SendDlgItemMessage(IDC_SHOW_GRID_LINES, BM_SETCHECK,  (bVal) ? BST_CHECKED : BST_UNCHECKED);

  // show on screen
  m_pSpy -> get_ShowOnScreen(&bVal);
  SendDlgItemMessage(IDC_SHOW_ON_SCREEN, BM_SETCHECK,  (bVal) ? BST_CHECKED : BST_UNCHECKED);

  // log to file
  m_pSpy -> get_LogToFile(&bVal);
  SendDlgItemMessage(IDC_LOG_TO_FILE, BM_SETCHECK,  (bVal) ? BST_CHECKED : BST_UNCHECKED);

  int i;
  for (i=0;i<sizeof(szColNames)/sizeof(szColNames[0]);i++)
    SendDlgItemMessage(IDC_COLUMN_NAMES, CB_ADDSTRING, 0, (LPARAM)(LPTSTR)szColNames[i]);

  SendDlgItemMessage(IDC_COLUMN_NAMES, CB_SETCURSEL, 0, 0);
  BOOL bH;
  OnSelectColumn(CBN_SELCHANGE, 0,0, bH);
  return 0;
}

LRESULT CComSpyPropPage::OnLogFileChange | ( | WORD | wNotify,
 |  | WORD | wID,
 |  | HWND | hWnd,
 |  | BOOL & | bHandled |
 | ) |  |  | [inline]

Definition at line 78 of file ComSpyproppage.h.

{
  SetDirty(TRUE);
  return 0;

}

LRESULT CComSpyPropPage::OnSelectColumn | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 72 of file ComSpyproppage.Cpp.

{
  if (wNotifyCode == CBN_SELCHANGE)
  {
    int nSel = SendDlgItemMessage(IDC_COLUMN_NAMES, CB_GETCURSEL, 0, 0L);
    if (nSel != CB_ERR)
    {
      // get the width

      long lWidth;
      _ASSERTE(m_pSpy);
      m_pSpy -> get_ColWidth(nSel, &lWidth);
      SetDlgItemInt(IDC_WIDTH, lWidth);
    }

  }

  return 0;
}

LRESULT CComSpyPropPage::OnWidthChange | ( | WORD | wNotify,
 |  | WORD | wID,
 |  | HWND | hWnd,
 |  | BOOL & | bHandled |
 | ) |  |  | [inline]

Definition at line 68 of file ComSpyproppage.h.

{
  SetDirty(TRUE);
  int nSel = SendDlgItemMessage(IDC_COLUMN_NAMES, CB_GETCURSEL, 0, 0L);
  BOOL bSuccess;
  UINT nVal = GetDlgItemInt(IDC_WIDTH, &bSuccess, FALSE);
  SendDlgItemMessage(IDC_COLUMN_NAMES, CB_SETITEMDATA, nSel, nVal); // indicating that its width changed
  return 0;

}

Member Data Documentation

CComPtr<IComSpy> CComSpyPropPage::m_pSpy

Definition at line 36 of file ComSpyproppage.h.

The documentation for this class was generated from the following files:
  • Com/Administration/Spy/ComSpyCtl/ComSpyproppage.h
  • Com/Administration/Spy/ComSpyCtl/ComSpyproppage.Cpp
Generated on Wed Nov 13 2024 16:55:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CComSpySqlAudit Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes

CComSpySqlAudit Class Reference

#include "ComSpysqlAudit.h"

Inherits IComSpyAudit.

List of all members.

Public Member Functions

CComSpySqlAudit ()
STDMETHOD() | EngineDefined (LONGLONG perfCount, LPCOLESTR pszPropName, VARIANT *varPropValue, LPCOLESTR pszClsidEng)
HRESULT | FinalConstruct ()
void | FinalRelease ()
void | GetError (HENV henv, HDBC hdbc, HSTMT hstmt, BSTR *msg)
STDMETHOD() | Init (LPCOLESTR sDSN, LPCOLESTR sUser, LPCOLESTR sPw)
STDMETHOD() | OnActivityCreate (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszGuidActivityID)
STDMETHOD() | OnActivityDestroy (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszGuidActivityID)
STDMETHOD() | OnActivityEnter (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszGuidCurrentApp, LPCOLESTR pszGuidEnteredApp, LPCOLESTR pszW2KThreadID)
STDMETHOD() | OnActivityLeave (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszGuidCurrentApp, LPCOLESTR pszGuidLeftApp)
STDMETHOD() | OnActivityLeaveSame (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszGuidCurrentApp, DWORD dwCallDepth)
STDMETHOD() | OnActivityReenter (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszGuidCurrentApp, LPCOLESTR pszW2KThreadID, DWORD dwCallDepth)
STDMETHOD() | OnActivityTimeout (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszGuidCurrentApp, LPCOLESTR pszGuidEnteredApp, LPCOLESTR pszW2KThreadID, DWORD dwTimeout)
STDMETHOD() | OnAppActivation (LONGLONG perfCount, LPCOLESTR pszGuidApp)
STDMETHOD() | OnAppShutdown (LONGLONG perfCount, LPCOLESTR pszGuidApp)
STDMETHOD() | OnAuthenticate (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszGuidActivity, LPCOLESTR pszObjectID, LPCOLESTR pszGuidIID, LPCOLESTR pszMethod, LPCOLESTR pszOriginalUser, LPCOLESTR pszDirectUser, BOOL bCurrentUserInpersonatingInProc)
STDMETHOD() | OnAuthenticateFail (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszGuidActivity, LPCOLESTR pszObjectID, LPCOLESTR pszGuidIID, LPCOLESTR pszMethod, LPCOLESTR pszOriginalUser, LPCOLESTR pszDirectUser, BOOL bCurrentUserInpersonatingInProc)
STDMETHOD() | OnCRMAbort (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszGuidClerkCLSID)
STDMETHOD() | OnCRMAnalyze (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszGuidClerkCLSID, LPCOLESTR pszCrmRecordType, DWORD dwRecordSize)
STDMETHOD() | OnCRMBegin (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszGuidClerkCLSID, LPCOLESTR pszGuidActivityID, LPCOLESTR pszGuidTxUOWID, LPCOLESTR pszProgIdCompensator, LPCOLESTR pszDescription)
STDMETHOD() | OnCRMCheckpoint (LONGLONG perfCount, LPCOLESTR pszGuidApp)
STDMETHOD() | OnCRMCommit (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszGuidClerkCLSID)
STDMETHOD() | OnCRMDeliver (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszGuidClerkCLSID, BOOL bVariants, DWORD dwRecordSize)
STDMETHOD() | OnCRMDone (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszGuidClerkCLSID)
STDMETHOD() | OnCRMForce (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszGuidClerkCLSID)
STDMETHOD() | OnCRMForget (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszGuidClerkCLSID)
STDMETHOD() | OnCRMIndoubt (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszGuidClerkCLSID)
STDMETHOD() | OnCRMPrepare (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszGuidClerkCLSID)
STDMETHOD() | OnCRMRecoveryDone (LONGLONG perfCount, LPCOLESTR pszGuidApp)
STDMETHOD() | OnCRMRecoveryStart (LONGLONG perfCount, LPCOLESTR pszGuidApp)
STDMETHOD() | OnCRMRelease (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszGuidClerkCLSID)
STDMETHOD() | OnCRMWrite (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszGuidClerkCLSID, BOOL bVariants, DWORD dwRecordSize)
STDMETHOD() | OnDisableCommit (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszContextID)
STDMETHOD() | OnEnableCommit (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszContextID)
STDMETHOD() | OnExceptionUser (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszCode, LPCOLESTR pszAddress, LPCOLESTR pszStackTrace)
STDMETHOD() | OnIISRequestInfo (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszObjectID, LPCOLESTR pszClientIP, LPCOLESTR pszServerIP, LPCOLESTR pszURL)
STDMETHOD() | OnMethodCall (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszObjectID, LPCOLESTR pszGuidClassID, LPCOLESTR pszGuidInterfaceID, LPCOLESTR pszMethod)
STDMETHOD() | OnMethodException (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszObjectID, LPCOLESTR pszGuidClassID, LPCOLESTR pszGuidInterfaceID, LPCOLESTR pszMethod)
STDMETHOD() | OnMethodReturn (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszObjectID, LPCOLESTR pszGuidClassID, LPCOLESTR pszGuidInterfaceID, LPCOLESTR pszMethod, HRESULT hr, LPCOLESTR pszCallTime)
STDMETHOD() | OnObjectActivate (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszContextID, LPCOLESTR pszObjectID)
STDMETHOD() | OnObjectConstruct (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszClassID, LPCOLESTR pszConstructString, LPCOLESTR pszObjectID)
STDMETHOD() | OnObjectCreate (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszGuidActivityID, LPCOLESTR pszClassID, LPCOLESTR pszTSID, LPCOLESTR pszContextID, LPCOLESTR pszObjectID)
STDMETHOD() | OnObjectDeactivate (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszContextID, LPCOLESTR pszObjectID)
STDMETHOD() | OnObjectDestroy (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszContextID)
STDMETHOD() | OnObjPoolCreateDecision (LONGLONG perfCount, LPCOLESTR pszGuidApp, DWORD dwThreadsWaiting, DWORD dwAvailableObjs, DWORD dwCreatedObjs, DWORD dwMin, DWORD dwMax)
STDMETHOD() | OnObjPoolCreateObject (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszClassID, DWORD dwAvailableObjs, LPCOLESTR pszObjectID)
STDMETHOD() | OnObjPoolCreatePool (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszClassID, DWORD dwMin, DWORD dwMax, DWORD dwTimeout)
STDMETHOD() | OnObjPoolDestroyObject (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszClassID, DWORD dwAvailableObjs, LPCOLESTR pszObjectID)
STDMETHOD() | OnObjPoolGetFromTx (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszGuidActivityID, LPCOLESTR pszClassID, LPCOLESTR pszGuidTx, LPCOLESTR pszObjectID)
STDMETHOD() | OnObjPoolGetObject (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszGuidActivityID, LPCOLESTR pszClassID, DWORD dwAvailableObjs, LPCOLESTR pszObjectID)
STDMETHOD() | OnObjPoolPutObject (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszClassID, int nReason, DWORD dwAvailableObjs, LPCOLESTR pszObjectID)
STDMETHOD() | OnObjPoolRecycleToTx (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszGuidActivityID, LPCOLESTR pszClassID, LPCOLESTR pszGuidTx, LPCOLESTR pszObjectID)
STDMETHOD() | OnObjPoolTimeout (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszClassID, LPCOLESTR pszGuidActivityID, DWORD dwTimeout)
STDMETHOD() | OnQCMoveToDeadQueue (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszGuidMsgID, LPCOLESTR pszGuidWorkFlowID)
STDMETHOD() | OnQCMoveToReTryQueue (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszGuidMsgID, LPCOLESTR pszGuidWorkFlowID, ULONG RetryIndex)
STDMETHOD() | OnQCPlayback (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszObjectID, LPCOLESTR pszGuidMsgID, LPCOLESTR pszGuidWorkFlowID, HRESULT hr)
STDMETHOD() | OnQCQueueOpen (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszQueueName, LPCOLESTR pszQueueID, HRESULT hr)
STDMETHOD() | OnQCReceive (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszQueueID, LPCOLESTR pszGuidMsgID, LPCOLESTR pszGuidWorkFlowID, HRESULT hr)
STDMETHOD() | OnQCReceiveFail (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszQueueID, HRESULT hr)
STDMETHOD() | OnQCRecord (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszObjectID, LPCOLESTR pszQueueName, LPCOLESTR pszGuidMsgID, LPCOLESTR pszGuidWorkFlowID, HRESULT hr)
STDMETHOD() | OnResourceAllocate (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszObjectID, LPCOLESTR pszType, LPCOLESTR pszResId, BOOL bEnlisted, LPCOLESTR pszNumRated, LPCOLESTR pszRating)
STDMETHOD() | OnResourceCreate (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszObjectID, LPCOLESTR pszType, LPCOLESTR pszResId, BOOL bEnlisted)
STDMETHOD() | OnResourceDestroy (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszObjectID, HRESULT hResult, LPCOLESTR pszType, LPCOLESTR pszResId)
STDMETHOD() | OnResourceRecycle (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszObjectID, LPCOLESTR pszType, LPCOLESTR pszResId)
STDMETHOD() | OnResourceTrack (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszObjectID, LPCOLESTR pszType, LPCOLESTR pszResId, BOOL bEnlisted)
STDMETHOD() | OnSetAbort (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszContextID)
STDMETHOD() | OnSetComplete (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszContextID)
STDMETHOD() | OnThreadAssignApartment (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszGuidActivityID, LPCOLESTR pszAptID)
STDMETHOD() | OnThreadBindToApartment (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszThreadID, LPCOLESTR pszAptID, DWORD dwActivityCnt)
STDMETHOD() | OnThreadStart (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszThreadID, LPCOLESTR pszW2KThreadID, DWORD dwThreadCnt)
STDMETHOD() | OnThreadTerminate (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszThreadID, LPCOLESTR pszW2KThreadID, DWORD dwThreadCnt)
STDMETHOD() | OnThreadUnassignApartment (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszAptID)
STDMETHOD() | OnThreadUnBind (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszThreadID, LPCOLESTR pszAptID, DWORD dwActivityCnt)
STDMETHOD() | OnThreadWorkEnque (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszThreadID, LPCOLESTR MsgWorkID, DWORD dwQueueLen)
STDMETHOD() | OnThreadWorkPrivate (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszThreadID, LPCOLESTR MsgWorkID)
STDMETHOD() | OnThreadWorkPublic (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszThreadID, LPCOLESTR MsgWorkID, DWORD dwQueueLen)
STDMETHOD() | OnThreadWorkRedirect (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszThreadID, LPCOLESTR MsgWorkID, DWORD dwQueueLen, LPCOLESTR pszThreadNum)
STDMETHOD() | OnThreadWorkReject (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszThreadID, LPCOLESTR MsgWorkID, DWORD dwQueueLen)
STDMETHOD() | OnTransactionAborted (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszGuidTxID)
STDMETHOD() | OnTransactionCommit (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszGuidTxID)
STDMETHOD() | OnTransactionPrepared (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszGuidTxID, BOOL bVoteYes)
STDMETHOD() | OnTransactionStart (LONGLONG perfCount, LPCOLESTR pszGuidApp, LPCOLESTR pszGuidTxID, LPCOLESTR pszGuidTSID, BOOL bRoot)
STDMETHOD() | TargetDown (LONGLONG perfCount, LPCOLESTR pszServerName, LPCOLESTR pszClsidEng)
STDMETHOD() | TargetUp (LONGLONG perfCount, LPCOLESTR pszServerName, LPCOLESTR pszClsidEng)

Public Attributes

CComPtr< IUnknown > | m_pUnkMarshaler

Private Member Functions

long | PerfCountToTickCount (LONGLONG perfCount)

Private Attributes

HDBC | m_hdbc
HENV | m_henv
HSTMT | m_hstmt
LONGLONG | m_PerformanceFrequency
WCHAR | m_sSQL [SQL_BUF_SIZE]

Detailed Description

Definition at line 25 of file ComSpysqlAudit.h.

Constructor & Destructor Documentation

CComSpySqlAudit::CComSpySqlAudit ( ) [inline]

Definition at line 41 of file ComSpysqlAudit.h.

  {
    m_hdbc = m_henv = m_hstmt = NULL;
    m_PerformanceFrequency = 0;
    m_pUnkMarshaler = NULL;
  }

Member Function Documentation

STDMETHODIMP CComSpySqlAudit::EngineDefined | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszPropName,
 |  | VARIANT * | varPropValue,
 |  | LPCOLESTR | pszClsidEng
 | ) |  |

Implements IComSpyAudit.

Definition at line 2093 of file Events.Cpp.

{
  UNREFERENCED_PARAMETER(perfCount);
  UNREFERENCED_PARAMETER(pszPropName);
  UNREFERENCED_PARAMETER(varPropValue);
  UNREFERENCED_PARAMETER(pszClsidEng);

  return S_OK;
}

HRESULT CComSpySqlAudit::FinalConstruct ( ) [inline]

Definition at line 59 of file ComSpysqlAudit.h.

  {

    QueryPerformanceFrequency((LARGE_INTEGER *)&m_PerformanceFrequency);
    return CoCreateFreeThreadedMarshaler(
      GetControllingUnknown(), &m_pUnkMarshaler.p);
  }

void CComSpySqlAudit::FinalRelease ( ) [inline]

Definition at line 67 of file ComSpysqlAudit.h.

  {
    m_pUnkMarshaler.Release();
    RETCODE rc;
    if (m_hstmt)
    {
      SQLFreeStmt( m_hstmt, SQL_DROP );
    }
    if (m_hdbc)
    {
       rc = SQLDisconnect( m_hdbc);
       SQLFreeConnect( m_hdbc);
       SQLFreeEnv( m_henv );
    }
  }

void CComSpySqlAudit::GetError | ( | HENV | henv,
 |  | HDBC | hdbc,
 |  | HSTMT | hstmt,
 |  | BSTR * | msg
 | ) |  |

Definition at line 149 of file ComSpysqlAudit.Cpp.

{
    WCHAR szSqlState[64];
    SDWORD NativeError;
    WCHAR szErr[512];
    SWORD cbErrorMsg;
    SQLError(henv, hdbc, hstmt, szSqlState, &NativeError, szErr, 511, &cbErrorMsg);
    *msg = SysAllocString(szErr);
}

STDMETHODIMP CComSpySqlAudit::Init | ( | LPCOLESTR | sDSN,
 |  | LPCOLESTR | sUser,
 |  | LPCOLESTR | sPw
 | ) |  |

Implements IComSpyAudit.

Definition at line 49 of file ComSpysqlAudit.Cpp.

{
  CComBSTR msg;
  RETCODE rc;

  if (m_henv || m_hstmt || m_hdbc)
    return E_UNEXPECTED; //did you call Init() twice?

  rc = SQLAllocEnv( &m_henv );
    if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO)
    {
        msg = L"CComSpySqlAudit::Init() - SQLAllocEnv failed!\n";
    goto Exit;
    }

    //Allocate the Connection handle
    rc = SQLAllocConnect( m_henv, &m_hdbc );

    if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO )
    {
        msg = L"CComSpySqlAudit::Init() - SQLAllocConnect failed!\n";
    goto Exit;
    }

  SQLSetConnectOption(m_hdbc, SQL_LOGIN_TIMEOUT, 5);

    rc = SQLConnect( m_hdbc, (SQLWCHAR *)sDSN,  SQL_NTS,
               (SQLWCHAR *)sUser, SQL_NTS,
               (SQLWCHAR *)sPw,   SQL_NTS );

    if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO )
    {
        msg = L"CComSpySqlAudit::Init() - SQLConnect failed!\n";
    goto Exit;
    }

    //Allocate the statement handle
    rc = SQLAllocStmt( m_hdbc, &m_hstmt);
  if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO )
    {
        msg = L"CComSpySqlAudit::Init() - SQLConnect failed!\n";
    goto Exit;
    }
  //
  //  verify the table existence
  //
  {
    TCHAR sSQL[1024];
    for (int i=0; i<sizeof(sTables)/sizeof(sTables[0]); i++)
    {
      ZeroMemory(sSQL, 1024 * sizeof(TCHAR));
      wsprintf(sSQL, sCreateTable, sTables[i]);
      rc = SQLExecDirect(m_hstmt, sSQL, lstrlen(sSQL));
      if (rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO)
      {
        // this means the table is not in the db

        //Clean up the table just created and exit
        ZeroMemory(sSQL, 1024 * sizeof(TCHAR));
        wsprintf(sSQL, _T("drop table %s"), sTables[i]);
        rc = SQLExecDirect(m_hstmt, sSQL, lstrlen(sSQL));
        msg = L"Table ";
        msg.Append(sTables[i]);
        msg.Append(L" is not in the Database.");

        goto Exit;
      }
    }
  }

  return S_OK;

Exit:

  ATLTRACE(msg);
  ATLTRACE(_T("\n"));

  if (m_hstmt)
  {
    SQLFreeStmt( m_hstmt, SQL_DROP );
  }

  if (m_hdbc)
  {
     rc = SQLDisconnect( m_hdbc);
     SQLFreeConnect( m_hdbc);
     if (m_henv)
     SQLFreeEnv( m_henv );
  }

  m_hdbc = m_hstmt  = m_henv = NULL;

  return E_FAIL;

}

STDMETHODIMP CComSpySqlAudit::OnActivityCreate | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszGuidActivityID
 | ) |  |

Implements IComSpyAudit.

Definition at line 1281 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into ActivityEvents (Event,TickCount,Application, ActivityID) \
        values ('%s',%d, '%s', '%s')",
       L"OnActivityCreate",
       TickCount,
       pszGuidApp,
       pszGuidActivityID
       );

  SQL_EXEC(m_sSQL);

  return S_OK;

}

STDMETHODIMP CComSpySqlAudit::OnActivityDestroy | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszGuidActivityID
 | ) |  |

Implements IComSpyAudit.

Definition at line 1305 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into ActivityEvents (Event,TickCount,Application, ActivityID) \
        values ('%s',%d, '%s', '%s')",
       L"OnActivityDestroy",
       TickCount,
       pszGuidApp,
       pszGuidActivityID
       );

  SQL_EXEC(m_sSQL);

  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnActivityEnter | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszGuidCurrentApp,
 |  | LPCOLESTR | pszGuidEnteredApp,
 |  | LPCOLESTR | pszW2KThreadID
 | ) |  |

Implements IComSpyAudit.

Definition at line 1328 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into ActivityEvents (Event,TickCount,Application, CurrentApp, EnteredApp,W2KThreadID) \
        values ('%s',%d, '%s', '%s','%s', '%s')",
       L"OnActivityEnter",
       TickCount,
       pszGuidApp,
       pszGuidCurrentApp,
       pszGuidEnteredApp,
       pszW2KThreadID
       );

  SQL_EXEC(m_sSQL);

  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnActivityLeave | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszGuidCurrentApp,
 |  | LPCOLESTR | pszGuidLeftApp
 | ) |  |

Implements IComSpyAudit.

Definition at line 1412 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into ActivityEvents (Event,TickCount,Application, CurrentApp, LeftApp) \
        values ('%s',%d, '%s', '%s','%s')",
       L"OnActivityLeave",
       TickCount,
       pszGuidApp,
       pszGuidCurrentApp,
       pszGuidLeftApp
       );

  SQL_EXEC(m_sSQL);

  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnActivityLeaveSame | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszGuidCurrentApp,
 |  | DWORD | dwCallDepth
 | ) |  |

Implements IComSpyAudit.

Definition at line 1437 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into ActivityEvents (Event,TickCount,Application, CurrentApp,CallDepth) \
        values ('%s',%d, '%s', '%s',%d)",
       L"OnActivityLeaveSame",
       TickCount,
       pszGuidApp,
       pszGuidCurrentApp,
       dwCallDepth
       );

  SQL_EXEC(m_sSQL);

  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnActivityReenter | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszGuidCurrentApp,
 |  | LPCOLESTR | pszW2KThreadID,
 |  | DWORD | dwCallDepth
 | ) |  |

Implements IComSpyAudit.

Definition at line 1385 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into ActivityEvents (Event,TickCount,Application, CurrentApp, W2KThreadID,CallDepth) \
        values ('%s',%d, '%s', '%s','%s',%d)",
       L"OnActivityReenter",
       TickCount,
       pszGuidApp,
       pszGuidCurrentApp,
       pszW2KThreadID,
       dwCallDepth
       );

  SQL_EXEC(m_sSQL);

  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnActivityTimeout | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszGuidCurrentApp,
 |  | LPCOLESTR | pszGuidEnteredApp,
 |  | LPCOLESTR | pszW2KThreadID,
 |  | DWORD | dwTimeout
 | ) |  |

Implements IComSpyAudit.

Definition at line 1356 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into ActivityEvents (Event,TickCount,Application, CurrentApp, EnteredApp,W2KThreadID,Timeout) \
        values ('%s',%d, '%s', '%s','%s', '%s',%d)",
       L"OnActivityTimeout",
       TickCount,
       pszGuidApp,
       pszGuidCurrentApp,
       pszGuidEnteredApp,
       pszW2KThreadID,
       dwTimeout
       );

  SQL_EXEC(m_sSQL);

  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnAppActivation | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp
 | ) |  |

Implements IComSpyAudit.

Definition at line 322 of file Events.Cpp.

{
   long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into AppEvents values ('%s',%d,'%s')",
       L"OnAppActivation",
       TickCount,
       pszGuidApp);

  SQL_EXEC(m_sSQL);
  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnAppShutdown | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp
 | ) |  |

Implements IComSpyAudit.

Definition at line 340 of file Events.Cpp.

{
    long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into AppEvents values ('%s',%d,'%s')",
       L"OnAppShutdown",
       TickCount,
       pszGuidApp);

  SQL_EXEC(m_sSQL);
  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnAuthenticate | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszGuidActivity,
 |  | LPCOLESTR | pszObjectID,
 |  | LPCOLESTR | pszGuidIID,
 |  | LPCOLESTR | pszMethod,
 |  | LPCOLESTR | pszOriginalUser,
 |  | LPCOLESTR | pszDirectUser,
 |  | BOOL | bCurrentUserInpersonatingInProc
 | ) |  |

Implements IComSpyAudit.

Definition at line 920 of file Events.Cpp.

{
    long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into SecurityEvents (Event,TickCount,Application, ActivityID, ObjectID, InterfaceID, Method, OriginalUser, DirectUser,Impersonation) \
        values ('%s', %d, '%s', '%s', '%s', '%s','%s', '%s', '%s', '%s')",
       L"OnAuthenticate",
       TickCount,
       pszGuidApp,
       pszGuidActivity,
       pszObjectID,
       pszGuidIID,
       pszMethod,
       pszOriginalUser,
       pszDirectUser,
       (bCurrentUserInpersonatingInProc ? L"Yes" : L"NO"));

  ATLTRACE(L"OnAuthenticate: m_sSQL = %s\n", m_sSQL);

  SQL_EXEC(m_sSQL);
  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnAuthenticateFail | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszGuidActivity,
 |  | LPCOLESTR | pszObjectID,
 |  | LPCOLESTR | pszGuidIID,
 |  | LPCOLESTR | pszMethod,
 |  | LPCOLESTR | pszOriginalUser,
 |  | LPCOLESTR | pszDirectUser,
 |  | BOOL | bCurrentUserInpersonatingInProc
 | ) |  |

Implements IComSpyAudit.

Definition at line 957 of file Events.Cpp.

{
    long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into SecurityEvents (Event,TickCount,Application, ActivityID, ObjectID, InterfaceID, Method, OriginalUser, DirectUser,Impersonation) \
        values ('%s', %d, '%s', '%s', '%s', '%s','%s', '%s', '%s', '%s')",
       L"OnAuthenticateFail",
       TickCount,
       pszGuidApp,
       pszGuidActivity,
       pszObjectID,
       pszGuidIID,
       pszMethod,
       pszOriginalUser,
       pszDirectUser,
       (bCurrentUserInpersonatingInProc ? L"Yes" : L"NO"));

  SQL_EXEC(m_sSQL);
  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnCRMAbort | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszGuidClerkCLSID
 | ) |  |

Implements IComSpyAudit.

Definition at line 1829 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into CRMEvents (Event,TickCount,Application, ClerkID) \
        values ('%s',%d, '%s','%s')",
         L"OnCRMAbort",
         TickCount,
         pszGuidApp,
         pszGuidClerkCLSID
       );

  SQL_EXEC(m_sSQL);

  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnCRMAnalyze | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszGuidClerkCLSID,
 |  | LPCOLESTR | pszCrmRecordType,
 |  | DWORD | dwRecordSize
 | ) |  |

Implements IComSpyAudit.

Definition at line 1921 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into CRMEvents (Event,TickCount,Application, ClerkID,CRMRecordType,RecordSize) \
        values ('%s',%d, '%s','%s','%s',%d)",
         L"OnCRMAnalyze",
         TickCount,
         pszGuidApp,
         pszGuidClerkCLSID,
         pszCrmRecordType,
         dwRecordSize
       );

  SQL_EXEC(m_sSQL);

  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnCRMBegin | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszGuidClerkCLSID,
 |  | LPCOLESTR | pszGuidActivityID,
 |  | LPCOLESTR | pszGuidTxUOWID,
 |  | LPCOLESTR | pszProgIdCompensator,
 |  | LPCOLESTR | pszDescription
 | ) |  |

Implements IComSpyAudit.

Definition at line 1751 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into CRMEvents (Event,TickCount,Application, ClerkID, ActivityID,TransactionUOWID,ProgIdCompensator,Description ) \
        values ('%s',%d, '%s','%s','%s','%s','%s','%s')",
         L"OnCRMBegin",
         TickCount,
         pszGuidApp,
         pszGuidClerkCLSID,
         pszGuidActivityID,
         pszGuidTxUOWID,
         pszProgIdCompensator,
         pszDescription
           );

  SQL_EXEC(m_sSQL);

  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnCRMCheckpoint | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp
 | ) |  |

Implements IComSpyAudit.

Definition at line 1730 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into CRMEvents (Event,TickCount,Application) \
        values ('%s',%d, '%s')",
       L"OnCRMCheckpoint",
       TickCount,
       pszGuidApp
       );

  SQL_EXEC(m_sSQL);

  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnCRMCommit | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszGuidClerkCLSID
 | ) |  |

Implements IComSpyAudit.

Definition at line 1806 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into CRMEvents (Event,TickCount,Application, ClerkID) \
        values ('%s',%d, '%s','%s')",
         L"OnCRMCommit",
         TickCount,
         pszGuidApp,
         pszGuidClerkCLSID
       );

  SQL_EXEC(m_sSQL);

  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnCRMDeliver | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszGuidClerkCLSID,
 |  | BOOL | bVariants,
 |  | DWORD | dwRecordSize
 | ) |  |

Implements IComSpyAudit.

Definition at line 2019 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into CRMEvents (Event,TickCount,Application, ClerkID, Variants, RecordSize) \
        values ('%s',%d, '%s','%s','%s',%d)",
         L"OnCRMDeliver",
         TickCount,
         pszGuidApp,
         pszGuidClerkCLSID,
         (bVariants ? L"Yes" : L"No"),
         dwRecordSize
       );

  SQL_EXEC(m_sSQL);

  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnCRMDone | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszGuidClerkCLSID
 | ) |  |

Implements IComSpyAudit.

Definition at line 1875 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into CRMEvents (Event,TickCount,Application, ClerkID) \
        values ('%s',%d, '%s','%s')",
         L"OnCRMDone",
         TickCount,
         pszGuidApp,
         pszGuidClerkCLSID
       );

  SQL_EXEC(m_sSQL);

  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnCRMForce | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszGuidClerkCLSID
 | ) |  |

Implements IComSpyAudit.

Definition at line 1996 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into CRMEvents (Event,TickCount,Application, ClerkID) \
        values ('%s',%d, '%s','%s')",
         L"OnCRMForce",
         TickCount,
         pszGuidApp,
         pszGuidClerkCLSID
       );

  SQL_EXEC(m_sSQL);

  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnCRMForget | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszGuidClerkCLSID
 | ) |  |

Implements IComSpyAudit.

Definition at line 1973 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into CRMEvents (Event,TickCount,Application, ClerkID) \
        values ('%s',%d, '%s','%s')",
         L"OnCRMForget",
         TickCount,
         pszGuidApp,
         pszGuidClerkCLSID
       );

  SQL_EXEC(m_sSQL);

  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnCRMIndoubt | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszGuidClerkCLSID
 | ) |  |

Implements IComSpyAudit.

Definition at line 1852 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into CRMEvents (Event,TickCount,Application, ClerkID) \
        values ('%s',%d, '%s','%s')",
         L"OnCRMIndoubt",
         TickCount,
         pszGuidApp,
         pszGuidClerkCLSID
       );

  SQL_EXEC(m_sSQL);

  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnCRMPrepare | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszGuidClerkCLSID
 | ) |  |

Implements IComSpyAudit.

Definition at line 1782 of file Events.Cpp.

{

  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into CRMEvents (Event,TickCount,Application, ClerkID) \
        values ('%s',%d, '%s','%s')",
         L"OnCRMPrepare",
         TickCount,
         pszGuidApp,
         pszGuidClerkCLSID
           );

  SQL_EXEC(m_sSQL);

  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnCRMRecoveryDone | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp
 | ) |  |

Implements IComSpyAudit.

Definition at line 1709 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into CRMEvents (Event,TickCount,Application) \
        values ('%s',%d, '%s')",
       L"OnCRMRecoveryDone",
       TickCount,
       pszGuidApp
       );

  SQL_EXEC(m_sSQL);

  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnCRMRecoveryStart | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp
 | ) |  |

Implements IComSpyAudit.

Definition at line 1687 of file Events.Cpp.

{

  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into CRMEvents (Event,TickCount,Application) \
        values ('%s',%d, '%s')",
       L"OnCRMRecoveryStart",
       TickCount,
       pszGuidApp
       );

  SQL_EXEC(m_sSQL);

  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnCRMRelease | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszGuidClerkCLSID
 | ) |  |

Implements IComSpyAudit.

Definition at line 1898 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into CRMEvents (Event,TickCount,Application, ClerkID) \
        values ('%s',%d, '%s','%s')",
         L"OnCRMRelease",
         TickCount,
         pszGuidApp,
         pszGuidClerkCLSID
       );

  SQL_EXEC(m_sSQL);

  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnCRMWrite | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszGuidClerkCLSID,
 |  | BOOL | bVariants,
 |  | DWORD | dwRecordSize
 | ) |  |

Implements IComSpyAudit.

Definition at line 1948 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into CRMEvents (Event,TickCount,Application, ClerkID,Variants,RecordSize) \
        values ('%s',%d, '%s','%s','%s',%d)",
         L"OnCRMWrite",
         TickCount,
         pszGuidApp,
         pszGuidClerkCLSID,
         (bVariants ? L"Yes" : L"No"),
         dwRecordSize
       );
  SQL_EXEC(m_sSQL);

  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnDisableCommit | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszContextID
 | ) |  |

Implements IComSpyAudit.

Definition at line 675 of file Events.Cpp.

{
    long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into ObjectEvents (Event, TickCount,Application, ContextID) \
        values ('%s', %d,  '%s', '%s')",
       L"OnDisableCommit",
       TickCount,
       pszGuidApp,
       pszContextID);

  SQL_EXEC(m_sSQL);

  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnEnableCommit | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszContextID
 | ) |  |

Implements IComSpyAudit.

Definition at line 698 of file Events.Cpp.

{
    long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
        L"insert into ObjectEvents (Event, TickCount,Application, ContextID) \
        values ('%s', %d,  '%s', '%s')",
       L"OnEnableCommit",
       TickCount,
       pszGuidApp,
       pszContextID);

  SQL_EXEC(m_sSQL);

  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnExceptionUser | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszCode,
 |  | LPCOLESTR | pszAddress,
 |  | LPCOLESTR | pszStackTrace
 | ) |  |

Implements IComSpyAudit.

Definition at line 1659 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into ExceptionEvents (Event,TickCount,Application, Code,Address,StackTrace) \
        values ('%s',%d, '%s', '%s','%s','%s')",
       L"OnExceptionUser",
       TickCount,
       pszGuidApp,
       pszCode,
       pszAddress,
       pszStackTrace
       );

  SQL_EXEC(m_sSQL);

  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnIISRequestInfo | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszObjectID,
 |  | LPCOLESTR | pszClientIP,
 |  | LPCOLESTR | pszServerIP,
 |  | LPCOLESTR | pszURL
 | ) |  |

Implements IComSpyAudit.

Definition at line 992 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into SecurityEvents (Event,TickCount,Application, ObjectID,ClientIP, ServerIP, URL) \
        values ('%s',%d, '%s', '%s','%s','%s','%s')",
       L"OnIISRequestInfo",
       TickCount,
       pszGuidApp,
       pszObjectID,
       pszClientIP,
       pszServerIP,
       pszURL
       );
  SQL_EXEC(m_sSQL);

  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnMethodCall | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszObjectID,
 |  | LPCOLESTR | pszGuidClassID,
 |  | LPCOLESTR | pszGuidInterfaceID,
 |  | LPCOLESTR | pszMethod
 | ) |  |

Implements IComSpyAudit.

Definition at line 458 of file Events.Cpp.

{
    long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into MethodEvents (Event,TickCount, Application, ObjectID, ClassID, InterfaceID, Method) values('%s',%ld, '%s','%s', '%s', '%s', '%s')",
       L"OnMethodCall",
       TickCount,
       pszGuidApp,
       pszObjectID,
       pszGuidClassID,
       pszGuidInterfaceID,
       pszMethod
       );

  ATLTRACE(L"OnMethodCall: m_sSQL = %s", m_sSQL);
  SQL_EXEC(m_sSQL);
  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnMethodException | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszObjectID,
 |  | LPCOLESTR | pszGuidClassID,
 |  | LPCOLESTR | pszGuidInterfaceID,
 |  | LPCOLESTR | pszMethod
 | ) |  |

Implements IComSpyAudit.

Definition at line 516 of file Events.Cpp.

{
    long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into MethodEvents (Event,TickCount, Application, ObjectID, ClassID, InterfaceID, Method) \
        values ('%s', %d, '%s', '%s', '%s', '%s', '%s')",
       L"OnMethodException",
       TickCount,
       pszGuidApp,
       pszObjectID,
       pszGuidClassID,
       pszGuidInterfaceID,
       pszMethod);

  SQL_EXEC(m_sSQL);
  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnMethodReturn | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszObjectID,
 |  | LPCOLESTR | pszGuidClassID,
 |  | LPCOLESTR | pszGuidInterfaceID,
 |  | LPCOLESTR | pszMethod,
 |  | HRESULT | hr,
 |  | LPCOLESTR | pszCallTime
 | ) |  |

Implements IComSpyAudit.

Definition at line 486 of file Events.Cpp.

{
    long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into MethodEvents  values ('%s', %d, '%s', '%s', '%s', '%s', '%s', %d, '%s')",
       L"OnMethodReturn",
       TickCount,
       pszGuidApp,
       pszObjectID,
       pszGuidClassID,
       pszGuidInterfaceID,
       pszMethod,
       hr,
       pszCallTime);

  SQL_EXEC(m_sSQL);
  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnObjectActivate | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszContextID,
 |  | LPCOLESTR | pszObjectID
 | ) |  |

Implements IComSpyAudit.

Definition at line 628 of file Events.Cpp.

{
    long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into ObjectEvents (Event, TickCount,Application, ContextID,ObjectId) \
        values ('%s', %d,  '%s', '%s','%s')",
       L"OnObjectActivate",
       TickCount,
       pszGuidApp,
       pszContextID,
       pszObjectID);

  SQL_EXEC(m_sSQL);
  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnObjectConstruct | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszClassID,
 |  | LPCOLESTR | pszConstructString,
 |  | LPCOLESTR | pszObjectID
 | ) |  |

Implements IComSpyAudit.

Definition at line 546 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into ObjectEvents (Event,TickCount,Application, ClassID,ConstructString,ObjectID) \
        values ('%s', %d, '%s', '%s', '%s', '%s')",
       L"OnObjectConstruct",
       TickCount,
       pszGuidApp,
       pszClassID,
       pszConstructString,
       pszObjectID);

  SQL_EXEC(m_sSQL);

  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnObjectCreate | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszGuidActivityID,
 |  | LPCOLESTR | pszClassID,
 |  | LPCOLESTR | pszTSID,
 |  | LPCOLESTR | pszContextID,
 |  | LPCOLESTR | pszObjectID
 | ) |  |

Implements IComSpyAudit.

Definition at line 575 of file Events.Cpp.

{
    long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));

  wsprintf(m_sSQL,
       L"insert into ObjectEvents (Event, TickCount,Application, ActivityID, ClassID, TSID, ContextID,ObjectID) \
        values ('%s',%d, '%s', '%s', '%s', '%s', '%s', '%s')",
       L"OnObjectCreate",
       TickCount,
       pszGuidApp,
       pszGuidActivityID,
       pszClassID,
       pszTSID,
       pszContextID,
       pszObjectID);

  SQL_EXEC(m_sSQL);
  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnObjectDeactivate | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszContextID,
 |  | LPCOLESTR | pszObjectID
 | ) |  |

Implements IComSpyAudit.

Definition at line 651 of file Events.Cpp.

{
    long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into ObjectEvents (Event, TickCount,Application, ContextID,ObjectId) \
        values ('%s', %d,  '%s', '%s','%s')",
       L"OnObjectDeactivate",
       TickCount,
       pszGuidApp,
       pszContextID,
       pszObjectID);

  SQL_EXEC(m_sSQL);

  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnObjectDestroy | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszContextID
 | ) |  |

Implements IComSpyAudit.

Definition at line 604 of file Events.Cpp.

{
    long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));

  wsprintf(m_sSQL,
       L"insert into ObjectEvents (Event,TickCount,Application,ContextID) \
        values ('%s',%d, '%s', '%s')",
       L"OnObjectDestroy",
       TickCount,
       pszGuidApp,
       pszContextID);

  SQL_EXEC(m_sSQL);

  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnObjPoolCreateDecision | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | DWORD | dwThreadsWaiting,
 |  | DWORD | dwAvailableObjs,
 |  | DWORD | dwCreatedObjs,
 |  | DWORD | dwMin,
 |  | DWORD | dwMax
 | ) |  |

Implements IComSpyAudit.

Definition at line 1192 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into ObjectPoolEvents (Event,TickCount,Application, ThreadsWaiting, AvailableObjs, CreatedObjs, Min, Max) \
        values ('%s',%d, '%s', %d, %d, %d, %d, %d)",
       L"OnObjPoolCreateDecision",
       TickCount,
       pszGuidApp,
       dwThreadsWaiting,
       dwAvailableObjs,
       dwCreatedObjs,
       dwMin,
       dwMax
       );

  SQL_EXEC(m_sSQL);

  return S_OK;

}

STDMETHODIMP CComSpySqlAudit::OnObjPoolCreateObject | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszClassID,
 |  | DWORD | dwAvailableObjs,
 |  | LPCOLESTR | pszObjectID
 | ) |  |

Implements IComSpyAudit.

Definition at line 1138 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into ObjectPoolEvents (Event,TickCount,Application, ClassID,AvailableObjs, ObjectID) \
        values ('%s',%d, '%s', '%s', %d, '%s')",
       L"OnObjPoolCreateObject",
       TickCount,
       pszGuidApp,
       pszClassID,
       dwAvailableObjs,
       pszObjectID
       );

  SQL_EXEC(m_sSQL);

  return S_OK;

}

STDMETHODIMP CComSpySqlAudit::OnObjPoolCreatePool | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszClassID,
 |  | DWORD | dwMin,
 |  | DWORD | dwMax,
 |  | DWORD | dwTimeout
 | ) |  |

Implements IComSpyAudit.

Definition at line 1250 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into ObjectPoolEvents (Event,TickCount,Application, ClassID, Min, Max, Timeout) \
        values ('%s',%d, '%s', '%s', %d, %d, %d)",
       L"OnObjPoolCreatePool",
       TickCount,
       pszGuidApp,
       pszClassID,
       dwMin,
       dwMax,
       dwTimeout
       );

  SQL_EXEC(m_sSQL);

  return S_OK;

}

STDMETHODIMP CComSpySqlAudit::OnObjPoolDestroyObject | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszClassID,
 |  | DWORD | dwAvailableObjs,
 |  | LPCOLESTR | pszObjectID
 | ) |  |

Implements IComSpyAudit.

Definition at line 1165 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into ObjectPoolEvents (Event,TickCount,Application, ActivityID, ClassID, TransactionID, ObjectID) \
        values ('%s',%d, '%s', '%s', %d, '%s')",
       L"OnObjPoolDestroyObject",
       TickCount,
       pszGuidApp,
       pszClassID,
       dwAvailableObjs,
       pszObjectID
       );

  SQL_EXEC(m_sSQL);

  return S_OK;

}

STDMETHODIMP CComSpySqlAudit::OnObjPoolGetFromTx | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszGuidActivityID,
 |  | LPCOLESTR | pszClassID,
 |  | LPCOLESTR | pszGuidTx,
 |  | LPCOLESTR | pszObjectID
 | ) |  |

Implements IComSpyAudit.

Definition at line 1107 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into ObjectPoolEvents (Event,TickCount,Application, ActivityID, ClassID, TransactionID, ObjectID) \
        values ('%s',%d, '%s', '%s', '%s', '%s', '%s')",
       L"OnObjPoolGetFromTx",
       TickCount,
       pszGuidApp,
       pszGuidActivityID,
       pszClassID,
       pszGuidTx,
       pszObjectID
       );

  SQL_EXEC(m_sSQL);

  return S_OK;

}

STDMETHODIMP CComSpySqlAudit::OnObjPoolGetObject | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszGuidActivityID,
 |  | LPCOLESTR | pszClassID,
 |  | DWORD | dwAvailableObjs,
 |  | LPCOLESTR | pszObjectID
 | ) |  |

Implements IComSpyAudit.

Definition at line 1050 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into ObjectPoolEvents (Event,TickCount,Application, ActivityID, ClassID, AvailableObjs, ObjectID) \
        values ('%s',%d, '%s', '%s', '%s', %d, '%s')",
       L"OnObjPoolGetObject",
       TickCount,
       pszGuidApp,
       pszGuidActivityID,
       pszClassID,
       dwAvailableObjs,
       pszObjectID
       );

  SQL_EXEC(m_sSQL);

  return S_OK;

}

STDMETHODIMP CComSpySqlAudit::OnObjPoolPutObject | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszClassID,
 |  | int | nReason,
 |  | DWORD | dwAvailableObjs,
 |  | LPCOLESTR | pszObjectID
 | ) |  |

Implements IComSpyAudit.

Definition at line 1021 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into ObjectPoolEvents (Event,TickCount,Application, ClassID, Reason, AvailableObjs, ObjectID) \
        values ('%s',%d, '%s', '%s', %d, %d, '%s')",
       L"OnObjPoolPutObject",
       TickCount,
       pszGuidApp,
       pszClassID,
       nReason,
       dwAvailableObjs,
       pszObjectID
       );

  SQL_EXEC(m_sSQL);

  return S_OK;

}

STDMETHODIMP CComSpySqlAudit::OnObjPoolRecycleToTx | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszGuidActivityID,
 |  | LPCOLESTR | pszClassID,
 |  | LPCOLESTR | pszGuidTx,
 |  | LPCOLESTR | pszObjectID
 | ) |  |

Implements IComSpyAudit.

Definition at line 1079 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into ObjectPoolEvents (Event,TickCount,Application, ActivityID, ClassID, TransactionID, ObjectID) \
        values ('%s',%d, '%s', '%s', '%s', '%s', '%s')",
       L"OnObjPoolRecycleToTx",
       TickCount,
       pszGuidApp,
       pszGuidActivityID,
       pszClassID,
       pszGuidTx,
       pszObjectID
       );

  SQL_EXEC(m_sSQL);

  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnObjPoolTimeout | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszClassID,
 |  | LPCOLESTR | pszGuidActivityID,
 |  | DWORD | dwTimeout
 | ) |  |

Implements IComSpyAudit.

Definition at line 1223 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into ObjectPoolEvents (Event,TickCount,Application, ClassID, ActivityID,Timeout) \
        values ('%s',%d, '%s', '%s', '%s',%d)",
       L"OnObjPoolTimeout",
       TickCount,
       pszGuidApp,
       pszClassID,
       pszGuidActivityID,
       dwTimeout
       );

  SQL_EXEC(m_sSQL);

  return S_OK;

}

STDMETHODIMP CComSpySqlAudit::OnQCMoveToDeadQueue | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszGuidMsgID,
 |  | LPCOLESTR | pszGuidWorkFlowID
 | ) |  |

Implements IComSpyAudit.

Definition at line 1603 of file Events.Cpp.

{

  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into QCEvents (Event,TickCount,Application, MsgID, WorkFlowID) \
        values ('%s',%d, '%s', '%s', '%s')",
       L"OnQCMoveToDeadQueue",
       TickCount,
       pszGuidApp,
       pszGuidMsgID,
       pszGuidWorkFlowID
       );

  SQL_EXEC(m_sSQL);

  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnQCMoveToReTryQueue | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszGuidMsgID,
 |  | LPCOLESTR | pszGuidWorkFlowID,
 |  | ULONG | RetryIndex
 | ) |  |

Implements IComSpyAudit.

Definition at line 1575 of file Events.Cpp.

{

  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into QCEvents (Event,TickCount,Application, MsgID, WorkFlowID, RetryIndex) \
        values ('%s',%d, '%s', '%s', '%s',%d)",
       L"OnQCMoveToReTryQueue",
       TickCount,
       pszGuidApp,
       pszGuidMsgID,
       pszGuidWorkFlowID,
       RetryIndex
       );

  SQL_EXEC(m_sSQL);

  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnQCPlayback | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszObjectID,
 |  | LPCOLESTR | pszGuidMsgID,
 |  | LPCOLESTR | pszGuidWorkFlowID,
 |  | HRESULT | hr
 | ) |  |

Implements IComSpyAudit.

Definition at line 1629 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into QCEvents (Event,TickCount,Application, ObjectID, MsgID, WorkFlowID, HResult) \
        values ('%s',%d, '%s', '%s', '%s','%s',%d)",
       L"OnQCMoveToDeadQueue",
       TickCount,
       pszGuidApp,
       pszObjectID,
       pszGuidMsgID,
       pszGuidWorkFlowID,
       hr
       );

  SQL_EXEC(m_sSQL);

  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnQCQueueOpen | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszQueueName,
 |  | LPCOLESTR | pszQueueID,
 |  | HRESULT | hr
 | ) |  |

Implements IComSpyAudit.

Definition at line 1495 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into QCEvents (Event,TickCount,Application, QueueName, QueueID, HResult) \
        values ('%s',%d, '%s', '%s','%s', %d)",
       L"OnQCQueueOpen",
       TickCount,
       pszGuidApp,
       pszQueueName,
       pszQueueID,
       hr
       );

  SQL_EXEC(m_sSQL);

  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnQCReceive | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszQueueID,
 |  | LPCOLESTR | pszGuidMsgID,
 |  | LPCOLESTR | pszGuidWorkFlowID,
 |  | HRESULT | hr
 | ) |  |

Implements IComSpyAudit.

Definition at line 1522 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into QCEvents (Event,TickCount,Application, QueueID, MsgID, WrokFlowID, HResult) \
        values ('%s',%d, '%s', '%s','%s','%s', %d)",
       L"OnQCReceive",
       TickCount,
       pszGuidApp,
       pszQueueID,
       pszGuidMsgID,
       pszGuidWorkFlowID,
       hr
       );

  SQL_EXEC(m_sSQL);

  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnQCReceiveFail | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszQueueID,
 |  | HRESULT | hr
 | ) |  |

Implements IComSpyAudit.

Definition at line 1551 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into QCEvents (Event,TickCount,Application, QueueID, HResult) \
        values ('%s',%d, '%s', '%s', %d)",
       L"OnQCReceiveFail",
       TickCount,
       pszGuidApp,
       pszQueueID,
       hr
       );
  SQL_EXEC(m_sSQL);

  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnQCRecord | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszObjectID,
 |  | LPCOLESTR | pszQueueName,
 |  | LPCOLESTR | pszGuidMsgID,
 |  | LPCOLESTR | pszGuidWorkFlowID,
 |  | HRESULT | hr
 | ) |  |

Implements IComSpyAudit.

Definition at line 1465 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into QCEvents (Event,TickCount,Application, ObjectID,QueueName, MsgID, WorkFlowID, HResult) \
        values ('%s',%d, '%s', '%s','%s','%s','%s',%d)",
       L"OnQCRecord",
       TickCount,
       pszGuidApp,
       pszObjectID,
       pszQueueName,
       pszGuidMsgID,
       pszGuidWorkFlowID,
       hr
       );

  SQL_EXEC(m_sSQL);

  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnResourceAllocate | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszObjectID,
 |  | LPCOLESTR | pszType,
 |  | LPCOLESTR | pszResId,
 |  | BOOL | bEnlisted,
 |  | LPCOLESTR | pszNumRated,
 |  | LPCOLESTR | pszRating
 | ) |  |

Implements IComSpyAudit.

Definition at line 798 of file Events.Cpp.

{
    long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into ResourceEvents (Event,TickCount,Application, ObjectID, Type, ResourceID, Enlisted, NumRated, Rating) \
        values ('%s',%d, '%s', '%s', '%s', '%s', '%s', '%s', '%s')",
       L"OnResourceAllocate",
       TickCount,
       pszGuidApp,
       pszObjectID,
       pszType,
       pszResId,
       bEnlisted ? L"TRUE" : L"FALSE",
       pszNumRated,
       pszRating
       );

  SQL_EXEC(m_sSQL);

  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnResourceCreate | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszObjectID,
 |  | LPCOLESTR | pszType,
 |  | LPCOLESTR | pszResId,
 |  | BOOL | bEnlisted
 | ) |  |

Implements IComSpyAudit.

Definition at line 769 of file Events.Cpp.

{
    long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into ResourceEvents (Event,TickCount,Application, ObjectID, Type, ResourceID, Enlisted) \
        values ('%s',%d, '%s', '%s', '%s', '%s', '%s')",
       L"OnResourceCreate",
       TickCount,
       pszGuidApp,
       pszObjectID,
       pszType,
       pszResId,
       (bEnlisted ? L"TRUE" : L"FALSE")
       );

  SQL_EXEC(m_sSQL);

  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnResourceDestroy | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszObjectID,
 |  | HRESULT | hResult,
 |  | LPCOLESTR | pszType,
 |  | LPCOLESTR | pszResId
 | ) |  |

Implements IComSpyAudit.

Definition at line 859 of file Events.Cpp.

{
    long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));

  wsprintf(m_sSQL,
       L"insert into ResourceEvents (Event,TickCount,Application,ObjectID, Type, ResourceID,HResult) \
        values ('%s',%d, '%s','%s', '%s', '%s', %d)",
       L"OnResourceDestroy",
       TickCount,
       pszGuidApp,
       pszObjectID,
       pszType,
       pszResId,
       hResult
       );

  SQL_EXEC(m_sSQL);

  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnResourceRecycle | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszObjectID,
 |  | LPCOLESTR | pszType,
 |  | LPCOLESTR | pszResId
 | ) |  |

Implements IComSpyAudit.

Definition at line 831 of file Events.Cpp.

{
    long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));

  wsprintf(m_sSQL,
       L"insert into ResourceEvents (Event,TickCount,Application, ObjectID, Type, ResourceID) \
        values ('%s',%d, '%s', '%s', '%s', '%s')",
       L"OnResourceRecycle",
       TickCount,
       pszGuidApp,
       pszObjectID,
       pszType,
       pszResId
       );

  SQL_EXEC(m_sSQL);

  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnResourceTrack | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszObjectID,
 |  | LPCOLESTR | pszType,
 |  | LPCOLESTR | pszResId,
 |  | BOOL | bEnlisted
 | ) |  |

Implements IComSpyAudit.

Definition at line 890 of file Events.Cpp.

{
    long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into ResourceEvents (Event,TickCount,Application, ObjectID, Type, ResourceID, Enlisted) \
        values ('%s',%d, '%s', '%s', '%s', '%s', '%s')",
       L"OnResourceTrack",
       TickCount,
       pszGuidApp,
       pszObjectID,
       pszType,
       pszResId,
       bEnlisted ? L"TRUE" : L"FALSE"
       );

  SQL_EXEC(m_sSQL);

  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnSetAbort | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszContextID
 | ) |  |

Implements IComSpyAudit.

Definition at line 744 of file Events.Cpp.

{
    long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into ObjectEvents (Event, TickCount,Application, ContextID) \
        values ('%s', %d,  '%s', '%s')",
       L"OnSetAbort",
       TickCount,
       pszGuidApp,
       pszContextID);

  SQL_EXEC(m_sSQL);

  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnSetComplete | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszContextID
 | ) |  |

Implements IComSpyAudit.

Definition at line 721 of file Events.Cpp.

{
    long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into ObjectEvents (Event, TickCount,Application, ContextID) \
        values ('%s', %d,  '%s', '%s')",
       L"OnSetComplete",
       TickCount,
       pszGuidApp,
       pszContextID);

  SQL_EXEC(m_sSQL);

  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnThreadAssignApartment | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszGuidActivityID,
 |  | LPCOLESTR | pszAptID
 | ) |  |

Implements IComSpyAudit.

Definition at line 157 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into ThreadEvents (Event, TickCount, Application, ActivityID, ApartmentID) values ('%s',%d,'%s','%s','%s')",
       L"OnThreadAssignApartment",
       TickCount,
       pszGuidApp,
       pszGuidActivityID,
       pszAptID);

  SQL_EXEC(m_sSQL);
  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnThreadBindToApartment | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszThreadID,
 |  | LPCOLESTR | pszAptID,
 |  | DWORD | dwActivityCnt
 | ) |  |

Implements IComSpyAudit.

Definition at line 107 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into ThreadEvents (Event, TickCount, Application, ThreadID, ApartmentID, ActivityCnt) values ('%s', %d,'%s','%s','%s', %d)",
       L"OnThreadBindToApartment",
       TickCount,
       pszGuidApp,
       pszThreadID,
       pszAptID,
       dwActivityCnt);

  SQL_EXEC(m_sSQL);
  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnThreadStart | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszThreadID,
 |  | LPCOLESTR | pszW2KThreadID,
 |  | DWORD | dwThreadCnt
 | ) |  |

Implements IComSpyAudit.

Definition at line 58 of file Events.Cpp.

{
    long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into ThreadEvents (Event, TickCount, Application, ThreadID, W2KThreadID, ThreadCnt) values ('%s',%d,'%s','%s','%s', %d)",
       L"OnThreadStart",
       TickCount,
       pszGuidApp,
       pszThreadID,
       pszW2KThreadID,
       dwThreadCnt);

  SQL_EXEC(m_sSQL);
  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnThreadTerminate | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszThreadID,
 |  | LPCOLESTR | pszW2KThreadID,
 |  | DWORD | dwThreadCnt
 | ) |  |

Implements IComSpyAudit.

Definition at line 82 of file Events.Cpp.

{
    long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into ThreadEvents (Event, TickCount, Application, ThreadID, W2KThreadID, ThreadCnt) values ('%s',%d,'%s','%s','%s', %d)",
       L"OnThreadTerminate",
       TickCount,
       pszGuidApp,
       pszThreadID,
       pszW2KThreadID,
       dwThreadCnt);

  SQL_EXEC(m_sSQL);
  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnThreadUnassignApartment | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszAptID
 | ) |  |

Implements IComSpyAudit.

Definition at line 181 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into ThreadEvents (Event, TickCount, Application, ApartmentID) values ('%s', %d,'%s','%s')",
       L"OnThreadUnAssignApartment",
       TickCount,
       pszGuidApp,
       pszAptID);

  SQL_EXEC(m_sSQL);
  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnThreadUnBind | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszThreadID,
 |  | LPCOLESTR | pszAptID,
 |  | DWORD | dwActivityCnt
 | ) |  |

Implements IComSpyAudit.

Definition at line 132 of file Events.Cpp.

{
    long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into ThreadEvents (Event, TickCount, Application, Threadid, ApartmentID, ActivityCnt) values ('%s',%d,'%s','%s','%s', %d)",
       L"OnThreadUnBind",
       TickCount,
       pszGuidApp,
       pszThreadID,
       pszAptID,
       dwActivityCnt);

  SQL_EXEC(m_sSQL);
  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnThreadWorkEnque | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszThreadID,
 |  | LPCOLESTR | MsgWorkID,
 |  | DWORD | dwQueueLen
 | ) |  |

Implements IComSpyAudit.

Definition at line 202 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into ThreadEvents (Event, TickCount, Application, ThreadID, MsgWorkID,QueueLen) values ('%s', %d,'%s','%s','%s', %d)",
       L"OnThreadWorkEnque",
       TickCount,
       pszGuidApp,
       pszThreadID,
       MsgWorkID,
       dwQueueLen);

  SQL_EXEC(m_sSQL);
  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnThreadWorkPrivate | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszThreadID,
 |  | LPCOLESTR | MsgWorkID
 | ) |  |

Implements IComSpyAudit.

Definition at line 226 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into ThreadEvents (Event, TickCount, Application, ThreadID, MsgWorkID) values ('%s', %d, '%s','%s','%s')",
       L"OnThreadWorkPrivate",
       TickCount,
       pszGuidApp,
       pszThreadID,
       MsgWorkID);

  SQL_EXEC(m_sSQL);
  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnThreadWorkPublic | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszThreadID,
 |  | LPCOLESTR | MsgWorkID,
 |  | DWORD | dwQueueLen
 | ) |  |

Implements IComSpyAudit.

Definition at line 247 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into ThreadEvents (Event, TickCount, Application, ThreadID, MsgWorkID,QueueLen) values ('%s', %d,'%s','%s','%s', %d)",
       L"OnThreadWorkPublic",
       TickCount,
       pszGuidApp,
       pszThreadID,
       MsgWorkID,
       dwQueueLen);

  SQL_EXEC(m_sSQL);
  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnThreadWorkRedirect | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszThreadID,
 |  | LPCOLESTR | MsgWorkID,
 |  | DWORD | dwQueueLen,
 |  | LPCOLESTR | pszThreadNum
 | ) |  |

Implements IComSpyAudit.

Definition at line 271 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into ThreadEvents (Event, TickCount, Application, ThreadID, MsgWorkID,QueueLen, ThreadNum) values ('%s',%d,'%s','%s','%s', %d, '%s')",
       L"OnThreadWorkPublic",
       TickCount,
       pszGuidApp,
       pszThreadID,
       MsgWorkID,
       dwQueueLen,
       pszThreadNum);

  SQL_EXEC(m_sSQL);
  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnThreadWorkReject | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszThreadID,
 |  | LPCOLESTR | MsgWorkID,
 |  | DWORD | dwQueueLen
 | ) |  |

Implements IComSpyAudit.

Definition at line 297 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into ThreadEvents (Event, TickCount, Application, ThreadID, MsgWorkID,QueueLen) values ('%s', %d,'%s','%s','%s', %d)",
       L"OnThreadWorkPublic",
       TickCount,
       pszGuidApp,
       pszThreadID,
       MsgWorkID,
       dwQueueLen);

  SQL_EXEC(m_sSQL);
  return S_OK;

}

STDMETHODIMP CComSpySqlAudit::OnTransactionAborted | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszGuidTxID
 | ) |  |

Implements IComSpyAudit.

Definition at line 433 of file Events.Cpp.

{
    long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into TransactionEvents (Event,TickCount,Application, TransactionID) \
        values ('%s',%d,'%s','%s')",
       L"OnTransactionAborted",
       TickCount,
       pszGuidApp,
       pszGuidTxID
       );

  SQL_EXEC(m_sSQL);
  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnTransactionCommit | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszGuidTxID
 | ) |  |

Implements IComSpyAudit.

Definition at line 409 of file Events.Cpp.

{
    long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into TransactionEvents (Event,TickCount,Application, TransactionID) \
        values ('%s',%d,'%s','%s')",
       L"OnTransactionCommit",
       TickCount,
       pszGuidApp,
       pszGuidTxID
       );

  SQL_EXEC(m_sSQL);
  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnTransactionPrepared | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszGuidTxID,
 |  | BOOL | bVoteYes
 | ) |  |

Implements IComSpyAudit.

Definition at line 385 of file Events.Cpp.

{
    long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into TransactionEvents (Event,TickCount,Application, TransactionID, VoteYes) \
        values ('%s',%d,'%s','%s','%s' )",
       L"OnTransactionPrepared",
       TickCount,
       pszGuidApp,
       pszGuidTxID,
       (bVoteYes ? L"Yes" : L"No")
       );

  SQL_EXEC(m_sSQL);
  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::OnTransactionStart | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszGuidApp,
 |  | LPCOLESTR | pszGuidTxID,
 |  | LPCOLESTR | pszGuidTSID,
 |  | BOOL | bRoot
 | ) |  |

Implements IComSpyAudit.

Definition at line 359 of file Events.Cpp.

{
    long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into TransactionEvents (Event,TickCount,Application, TransactionID, TSID, Root) \
        values ('%s',%d,'%s','%s','%s','%s' )",
       L"OnTransactionStart",
       TickCount,
       pszGuidApp,
       pszGuidTxID,
       pszGuidTSID,
       (bRoot ? L"Yes" : L"No")
       );

  SQL_EXEC(m_sSQL);
  return S_OK;
}

long CComSpySqlAudit::PerfCountToTickCount ( LONGLONG perfCount ) [private]

Definition at line 44 of file Events.Cpp.

{
  long TickCount = 0;
    if (m_PerformanceFrequency != 0)
        TickCount = (long)((1000 * perfCount) / m_PerformanceFrequency);

  return TickCount;
}

STDMETHODIMP CComSpySqlAudit::TargetDown | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszServerName,
 |  | LPCOLESTR | pszClsidEng
 | ) |  |

Implements IComSpyAudit.

Definition at line 2070 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into LBEvents (Event,TickCount,Application, ServerName, ClsidEng) \
        values ('%s',%d, '%s','%s','%s')",
         L"TargetDown",
         TickCount,
         L"COM+ Load Balancing",
         pszServerName,
         pszClsidEng
       );

  SQL_EXEC(m_sSQL);

  return S_OK;
}

STDMETHODIMP CComSpySqlAudit::TargetUp | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | pszServerName,
 |  | LPCOLESTR | pszClsidEng
 | ) |  |

Implements IComSpyAudit.

Definition at line 2047 of file Events.Cpp.

{
  long TickCount = PerfCountToTickCount(perfCount);

  ZeroMemory(m_sSQL, SQL_BUF_SIZE * sizeof(WCHAR));
  wsprintf(m_sSQL,
       L"insert into LBEvents (Event,TickCount,Application, ServerName, ClsidEng) \
        values ('%s',%d, '%s','%s','%s')",
         L"TargetUp",
         TickCount,
         L"COM+ Load Balancing",
         pszServerName,
         pszClsidEng
       );

  SQL_EXEC(m_sSQL);

  return S_OK;
}

Member Data Documentation

HDBC CComSpySqlAudit::m_hdbc [private]

Definition at line 33 of file ComSpysqlAudit.h.

HENV CComSpySqlAudit::m_henv [private]

Definition at line 32 of file ComSpysqlAudit.h.

HSTMT CComSpySqlAudit::m_hstmt [private]

Definition at line 34 of file ComSpysqlAudit.h.

LONGLONG CComSpySqlAudit::m_PerformanceFrequency [private]

Definition at line 35 of file ComSpysqlAudit.h.

CComPtr<IUnknown> CComSpySqlAudit::m_pUnkMarshaler

Definition at line 83 of file ComSpysqlAudit.h.

WCHAR CComSpySqlAudit::m_sSQL[SQL_BUF_SIZE] [private]

Definition at line 36 of file ComSpysqlAudit.h.

The documentation for this class was generated from the following files:
  • Com/Administration/Spy/ComSpyAudit/ComSpysqlAudit.h
  • Com/Administration/Spy/ComSpyAudit/ComSpysqlAudit.Cpp
  • Com/Administration/Spy/ComSpyAudit/Events.Cpp
Generated on Wed Nov 13 2024 16:55:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CComSyncTest Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CComSyncTest Class Reference

#include "ComSyncTest.h"

List of all members.

Public Member Functions

CComSyncTest ()
STDMETHOD() Exercise (void)

Detailed Description

Definition at line 29 of file ComSyncTest.h.

Constructor & Destructor Documentation

CComSyncTest::CComSyncTest ( ) [inline]

Definition at line 35 of file ComSyncTest.h.

  {
  }

Member Function Documentation

STDMETHODIMP CComSyncTest::Exercise ( void )

Definition at line 47 of file ComSyncTest.Cpp.

{

  DWORD dwCount, dwValue = 0;

  for (dwCount = 0; dwCount < LOOPCOUNT; dwCount++)
    dwValue += dwCount;

  return S_OK;
}

The documentation for this class was generated from the following files:
  • Com/Services/Concurrency/SyncComp/ComSyncObject/ComSyncTest.h
  • Com/Services/Concurrency/SyncComp/ComSyncObject/ComSyncTest.Cpp
Generated on Wed Nov 13 2024 16:55:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CComWSTR Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes | Private Member Functions

CComWSTR Class Reference

#include "cdialoglite.h"

List of all members.

Public Member Functions

CComWSTR ()
virtual | ~CComWSTR ()
HRESULT | Append (LPCOLESTR pSrc)
HRESULT | Append (LPCOLESTR pSrc, int nLen)
void | Attach (WCHAR *src)
WCHAR * | Copy () const
HRESULT | CopyFrom (LPCOLESTR pSrc)
WCHAR * | Detach ()
void | Empty ()
unsigned int | Length () const
operator WCHAR * () const
bool | operator! () const
WCHAR ** | operator& ()
CComWSTR & | operator+= (LPCOLESTR pSrc)

Protected Attributes

WCHAR * | m_str

Private Member Functions

CComWSTR (LPCOLESTR pSrc)
CComWSTR (const CComWSTR &src)

Detailed Description

Definition at line 1904 of file cdialoglite.h.

Constructor & Destructor Documentation

CComWSTR::CComWSTR ( LPCOLESTR pSrc ) [inline, private]

Definition at line 1914 of file cdialoglite.h.

{ ASSERT(FALSE);  }

CComWSTR::CComWSTR ( const CComWSTR & src ) [inline, private]

Definition at line 1915 of file cdialoglite.h.

{ ASSERT(FALSE);  }

CComWSTR::CComWSTR ( ) [inline]

Definition at line 1921 of file cdialoglite.h.

  {
    m_str = NULL;
  }

virtual CComWSTR::~CComWSTR ( ) [inline, virtual]

Definition at line 1925 of file cdialoglite.h.

  {
    Empty();
  }

Member Function Documentation

HRESULT CComWSTR::Append ( LPCOLESTR pSrc ) [inline]

Definition at line 1984 of file cdialoglite.h.

  {
    return Append(pSrc, pSrc ? wcslen(pSrc) : 0);
  }

HRESULT CComWSTR::Append | ( | LPCOLESTR | pSrc,
 |  | int | nLen |
 | ) |  |  | [inline]

Definition at line 1988 of file cdialoglite.h.

  {
    HRESULT hr = S_OK;

    if(nLen)
    {
      ASSERT(pSrc);
      int n1 = Length();

      //Realloc the current string
      SAFE_REALLOC(m_str, WCHAR, n1+nLen+1);
      memcpy(m_str+n1, pSrc, nLen*sizeof(WCHAR));
      m_str[n1+nLen] = NULL;
    }

  CLEANUP:
    return hr;
  }

void CComWSTR::Attach ( WCHAR * src ) [inline]

Definition at line 1971 of file cdialoglite.h.

  {
    ASSERT(m_str == NULL);
    m_str = src;
  }

WCHAR* CComWSTR::Copy ( ) const [inline]

Definition at line 1959 of file cdialoglite.h.

  {
    return wcsDuplicate(m_str);
  }

HRESULT CComWSTR::CopyFrom ( LPCOLESTR pSrc ) [inline]

Definition at line 1963 of file cdialoglite.h.

  {
    Empty();
    m_str = wcsDuplicate(pSrc);
    return S_OK;
  }

WCHAR* CComWSTR::Detach ( ) [inline]

Definition at line 1976 of file cdialoglite.h.

  {
    WCHAR* s = m_str;
    m_str = NULL;
    return s;
  }

void CComWSTR::Empty ( ) [inline]

Definition at line 1929 of file cdialoglite.h.

  {
    SAFE_FREE(m_str);
  }

unsigned int CComWSTR::Length ( ) const [inline]

Definition at line 1955 of file cdialoglite.h.

  {
    return (m_str == NULL) ? 0 : wcslen(m_str);
  }

CComWSTR::operator WCHAR * ( ) const [inline]

Definition at line 1949 of file cdialoglite.h.

  {
    return m_str;
  }

bool CComWSTR::operator! ( ) const [inline]

Definition at line 1938 of file cdialoglite.h.

  {
    return (m_str == NULL);
  }

WCHAR** CComWSTR::operator& ( ) [inline]

Definition at line 1942 of file cdialoglite.h.

  {
    ASSERT(m_str == NULL);
    return &m_str;
  }

CComWSTR& CComWSTR::operator+= ( LPCOLESTR pSrc ) [inline]

Definition at line 1933 of file cdialoglite.h.

  {
    Append(pSrc);
    return *this;
  }

Member Data Documentation

WCHAR* CComWSTR::m_str [protected]

Definition at line 1908 of file cdialoglite.h.

The documentation for this class was generated from the following file:
  • Dataaccess/oledb/rowsetviewer/cdialoglite.h
Generated on Wed Nov 13 2024 16:55:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CConfNotify Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CConfNotify Class Reference

#include "CConf.h"

Inherits RefCount, CNotify, RefCount, CNotify, RefCount, CNotify, CRefCount, CNotify, RefCount, and CNotify.

List of all members.

Public Member Functions

CConfNotify ()
CConfNotify ()
CConfNotify ()
CConfNotify ()
CConfNotify (Conf *)
~CConfNotify ()
~CConfNotify ()
virtual | ~CConfNotify ()
~CConfNotify ()
~CConfNotify ()
ULONG STDMETHODCALLTYPE | AddRef (void)
ULONG STDMETHODCALLTYPE | AddRef (void)
ULONG STDMETHODCALLTYPE | AddRef (void)
ULONG STDMETHODCALLTYPE | AddRef (void)
ULONG STDMETHODCALLTYPE | AddRef (void)
HRESULT STDMETHODCALLTYPE | ChannelChanged (NM_CHANNEL_NOTIFY uNotify, INmChannel *pChannel)
HRESULT STDMETHODCALLTYPE | ChannelChanged (NM_CHANNEL_NOTIFY uNotify, INmChannel *pChannel)
HRESULT STDMETHODCALLTYPE | ChannelChanged (NM_CHANNEL_NOTIFY uNotify, INmChannel *pChannel)
HRESULT STDMETHODCALLTYPE | ChannelChanged (NM_CHANNEL_NOTIFY uNotify, INmChannel *pChannel)
HRESULT STDMETHODCALLTYPE | ChannelChanged (NM_CHANNEL_NOTIFY uNotify, INmChannel *pChannel)
HRESULT STDMETHODCALLTYPE | Connect (IUnknown *pUnk)
HRESULT | Connect (IUnknown *pUnkOuter)
HRESULT STDMETHODCALLTYPE | Connect (IUnknown *pUnk)
HRESULT STDMETHODCALLTYPE | Connect (IUnknown *pUnk)
HRESULT STDMETHODCALLTYPE | Connect (IUnknown *pUnk)
HRESULT STDMETHODCALLTYPE | Disconnect (void)
HRESULT STDMETHODCALLTYPE | Disconnect (void)
HRESULT STDMETHODCALLTYPE | Disconnect (void)
HRESULT STDMETHODCALLTYPE | Disconnect (void)
HRESULT | Disconnect (void)
INmMember ** | GetIMemberArray (void)
ULONG | GetIMemberCount (void)
HRESULT STDMETHODCALLTYPE | MemberChanged (NM_MEMBER_NOTIFY uNotify, INmMember *pfMember)
HRESULT STDMETHODCALLTYPE | MemberChanged (NM_MEMBER_NOTIFY uNotify, INmMember *pfMember)
HRESULT STDMETHODCALLTYPE | MemberChanged (NM_MEMBER_NOTIFY uNotify, INmMember *pfMember)
HRESULT STDMETHODCALLTYPE | MemberChanged (NM_MEMBER_NOTIFY uNotify, INmMember *pMember)
HRESULT STDMETHODCALLTYPE | MemberChanged (NM_MEMBER_NOTIFY uNotify, INmMember *pfMember)
HRESULT STDMETHODCALLTYPE | NmUI (CONFN uNotify)
HRESULT STDMETHODCALLTYPE | NmUI (CONFN uNotify)
HRESULT STDMETHODCALLTYPE | NmUI (CONFN uNotify)
HRESULT STDMETHODCALLTYPE | NmUI (CONFN uNotify)
HRESULT STDMETHODCALLTYPE | NmUI (CONFN uNotify)
HRESULT STDMETHODCALLTYPE | QueryInterface (REFIID riid, PVOID *ppvObj)
HRESULT STDMETHODCALLTYPE | QueryInterface (REFIID riid, PVOID *ppvObject)
HRESULT STDMETHODCALLTYPE | QueryInterface (REFIID riid, PVOID *ppvObj)
HRESULT STDMETHODCALLTYPE | QueryInterface (REFIID riid, void **ppvObj)
HRESULT STDMETHODCALLTYPE | QueryInterface (REFIID riid, PVOID *ppvObj)
ULONG STDMETHODCALLTYPE | Release (void)
ULONG STDMETHODCALLTYPE | Release (void)
ULONG STDMETHODCALLTYPE | Release (void)
ULONG STDMETHODCALLTYPE | Release (void)
ULONG STDMETHODCALLTYPE | Release (void)
void | ReleaseIMemberArray (void)
HRESULT STDMETHODCALLTYPE | StateChanged (NM_CONFERENCE_STATE uState)
HRESULT STDMETHODCALLTYPE | StateChanged (NM_CONFERENCE_STATE uState)
HRESULT STDMETHODCALLTYPE | StateChanged (NM_CONFERENCE_STATE uState)
HRESULT STDMETHODCALLTYPE | StateChanged (NM_CONFERENCE_STATE uState)
HRESULT STDMETHODCALLTYPE | StateChanged (NM_CONFERENCE_STATE uState)

Private Member Functions

CConfNotify ()

Private Attributes

INmMember * | m_apIMembers [MAX_MEMBERS]
ULONG m_cIMembers
Conf * m_pConf

Detailed Description

Definition at line 49 of file CConf.h.

Constructor & Destructor Documentation

CConfNotify::CConfNotify ( )

Definition at line 313 of file CConf.Cpp.

                         : RefCount(), CNotify()
{
}

CConfNotify::~CConfNotify ( )

Definition at line 324 of file CConf.Cpp.

{
}

CConfNotify::CConfNotify ( )
CConfNotify::~CConfNotify ( )
CConfNotify::CConfNotify ( )
CConfNotify::~CConfNotify ( )
CConfNotify::CConfNotify ( )
CConfNotify::~CConfNotify ( )
CConfNotify::CConfNotify ( ) [private]
CConfNotify::CConfNotify ( Conf * pConf )

Definition at line 948 of file nmsession.cpp.

{
    m_pConf = pConf;
}

virtual CConfNotify::~CConfNotify ( ) [virtual]

Member Function Documentation

ULONG STDMETHODCALLTYPE CConfNotify::AddRef ( void )

Definition at line 335 of file CConf.Cpp.

{
  return RefCount::AddRef();
}

ULONG STDMETHODCALLTYPE CConfNotify::AddRef ( void )
ULONG STDMETHODCALLTYPE CConfNotify::AddRef ( void )
ULONG STDMETHODCALLTYPE CConfNotify::AddRef ( void )
ULONG STDMETHODCALLTYPE CConfNotify::AddRef ( void )
HRESULT STDMETHODCALLTYPE CConfNotify::ChannelChanged | ( | NM_CHANNEL_NOTIFY | uNotify,
 |  | INmChannel * | pChannel
 | ) |  |
HRESULT STDMETHODCALLTYPE CConfNotify::ChannelChanged | ( | NM_CHANNEL_NOTIFY | uNotify,
 |  | INmChannel * | pChannel
 | ) |  |
HRESULT STDMETHODCALLTYPE CConfNotify::ChannelChanged | ( | NM_CHANNEL_NOTIFY | uNotify,
 |  | INmChannel * | pChannel
 | ) |  |
HRESULT STDMETHODCALLTYPE CConfNotify::ChannelChanged | ( | NM_CHANNEL_NOTIFY | uNotify,
 |  | INmChannel * | pChannel
 | ) |  |
HRESULT STDMETHODCALLTYPE CConfNotify::ChannelChanged | ( | NM_CHANNEL_NOTIFY | uNotify,
 |  | INmChannel * | pChannel
 | ) |  |

Definition at line 482 of file CConf.Cpp.

{
  return S_OK;
}

HRESULT CConfNotify::Connect ( IUnknown * pUnk )

Definition at line 384 of file CConf.Cpp.

{
  return CNotify::Connect(pUnk, IID_INmConferenceNotify, (IUnknown *)this);
}

HRESULT STDMETHODCALLTYPE CConfNotify::Connect ( IUnknown * pUnk )
HRESULT CConfNotify::Connect ( IUnknown * pUnkOuter )
HRESULT STDMETHODCALLTYPE CConfNotify::Connect ( IUnknown * pUnk )
HRESULT STDMETHODCALLTYPE CConfNotify::Connect ( IUnknown * pUnk )
HRESULT STDMETHODCALLTYPE CConfNotify::Disconnect ( void )

Reimplemented from CNotify.

HRESULT CConfNotify::Disconnect ( void )

Reimplemented from CNotify.

HRESULT STDMETHODCALLTYPE CConfNotify::Disconnect ( void )

Reimplemented from CNotify.

HRESULT CConfNotify::Disconnect ( void )

Reimplemented from CNotify.

Definition at line 389 of file CConf.Cpp.

{
  return CNotify::Disconnect();
}

HRESULT STDMETHODCALLTYPE CConfNotify::Disconnect ( void )

Reimplemented from CNotify.

INmMember** CConfNotify::GetIMemberArray ( void ) [inline]

Definition at line 126 of file conf.h.

{ return &m_apIMembers[0]; }

ULONG CConfNotify::GetIMemberCount ( void ) [inline]

Definition at line 125 of file conf.h.

{ return m_cIMembers; }

HRESULT STDMETHODCALLTYPE CConfNotify::MemberChanged | ( | NM_MEMBER_NOTIFY | uNotify,
 |  | INmMember * | pfMember
 | ) |  |
HRESULT STDMETHODCALLTYPE CConfNotify::MemberChanged | ( | NM_MEMBER_NOTIFY | uNotify,
 |  | INmMember * | pfMember
 | ) |  |

Definition at line 442 of file CConf.Cpp.

{
  switch (uNotify)
  {
    case NM_MEMBER_ADDED:
    {
      if (S_OK == pMember->IsSelf())
      {
        ASSERT(NULL == g_pMemberLocal);
        g_pMemberLocal = pMember;
        g_pMemberLocal->AddRef();
      }
      break;
    }

    case NM_MEMBER_REMOVED:
    {
      if (g_pMemberLocal == pMember)
      {
        g_pMemberLocal->Release();
        g_pMemberLocal = NULL;
      }
      break;
    }

    default:
    case NM_MEMBER_UPDATED:
    {
      // Check if the data channel should be added
      if (g_fActiveConference && (g_pMemberLocal == pMember) )
      {
        CheckDataChannel();
      }
      break;
    }
  }

  return S_OK;
}

HRESULT STDMETHODCALLTYPE CConfNotify::MemberChanged | ( | NM_MEMBER_NOTIFY | uNotify,
 |  | INmMember * | pMember
 | ) |  |
HRESULT STDMETHODCALLTYPE CConfNotify::MemberChanged | ( | NM_MEMBER_NOTIFY | uNotify,
 |  | INmMember * | pfMember
 | ) |  |
HRESULT STDMETHODCALLTYPE CConfNotify::MemberChanged | ( | NM_MEMBER_NOTIFY | uNotify,
 |  | INmMember * | pfMember
 | ) |  |
HRESULT STDMETHODCALLTYPE CConfNotify::NmUI ( CONFN uNotify )

Definition at line 401 of file CConf.Cpp.

{
  return S_OK;
}

HRESULT STDMETHODCALLTYPE CConfNotify::NmUI ( CONFN uNotify )
HRESULT STDMETHODCALLTYPE CConfNotify::NmUI ( CONFN uNotify )
HRESULT STDMETHODCALLTYPE CConfNotify::NmUI ( CONFN uNotify )
HRESULT STDMETHODCALLTYPE CConfNotify::NmUI ( CONFN uNotify )
HRESULT STDMETHODCALLTYPE CConfNotify::QueryInterface | ( | REFIID | riid,
 |  | PVOID * | ppvObj
 | ) |  |

Definition at line 346 of file CConf.Cpp.

{
  if(NULL == ppvObject)
  {
    return E_POINTER;
  }

  HRESULT hr = NO_ERROR;

  if (riid == IID_IUnknown)
  {
    *ppvObject = (IUnknown *)this;
  }
  else if (riid == IID_INmConferenceNotify)
  {
    *ppvObject = (INmConferenceNotify *)this;
  }
  else
  {
    hr = E_NOINTERFACE;
    *ppvObject = NULL;
  }

  if(SUCCEEDED(hr))
  {
    AddRef();
  }

  return hr;
}

HRESULT STDMETHODCALLTYPE CConfNotify::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppvObj
 | ) |  |

Definition at line 383 of file conf.cpp.

{
    if(NULL == ppvObject)
  {
    return E_POINTER;
  }

  HRESULT hr = NO_ERROR;

    if (riid == IID_IUnknown)
    {
        *ppvObject = (IUnknown *)this;
    }
    else if (riid == IID_INmConferenceNotify)
    {
        *ppvObject = (INmConferenceNotify *)this;
    }
    else
    {
        hr = E_NOINTERFACE;
        *ppvObject = NULL;
    }

    if (S_OK == hr)
    {
        AddRef();
    }

    return hr;
}

HRESULT STDMETHODCALLTYPE CConfNotify::QueryInterface | ( | REFIID | riid,
 |  | PVOID * | ppvObj
 | ) |  |
HRESULT STDMETHODCALLTYPE CConfNotify::QueryInterface | ( | REFIID | riid,
 |  | PVOID * | ppvObject
 | ) |  |
HRESULT STDMETHODCALLTYPE CConfNotify::QueryInterface | ( | REFIID | riid,
 |  | PVOID * | ppvObj
 | ) |  |
ULONG STDMETHODCALLTYPE CConfNotify::Release ( void )

Definition at line 341 of file CConf.Cpp.

{
  return RefCount::Release();
}

ULONG STDMETHODCALLTYPE CConfNotify::Release ( void )
ULONG STDMETHODCALLTYPE CConfNotify::Release ( void )
ULONG STDMETHODCALLTYPE CConfNotify::Release ( void )
ULONG STDMETHODCALLTYPE CConfNotify::Release ( void )
void CConfNotify::ReleaseIMemberArray ( void )

Definition at line 586 of file conf.cpp.

{
    //
    // Clean up the cached member array, which is created before
    // the session object is created.
    //
    for (ULONG i = 0; i < m_cIMembers; i++)
    {
        ASSERT(NULL != m_apIMembers[i]);
        m_apIMembers[i]->Release();
        m_apIMembers[i] = NULL;
    }
    m_cIMembers = 0;
}

HRESULT STDMETHODCALLTYPE CConfNotify::StateChanged ( NM_CONFERENCE_STATE uState )
HRESULT STDMETHODCALLTYPE CConfNotify::StateChanged ( NM_CONFERENCE_STATE uState )

Definition at line 406 of file CConf.Cpp.

{
  if (NULL == g_pConference)
    return S_OK;

  switch (uState)
  {
    case NM_CONFERENCE_ACTIVE:
    {
      g_fActiveConference = TRUE;
      CheckDataChannel();
      break;
    }
    case NM_CONFERENCE_INITIALIZING:
    {
      break; // can't do anything just yet
    }
    case NM_CONFERENCE_WAITING:
    {
      DisplaySysMsg(TEXT("Waiting in Host Mode"), NULL);
      g_fActiveConference = FALSE;
      FreeDataChannel();
      break;
    }
    case NM_CONFERENCE_IDLE:
    {
      DisplaySysMsg(TEXT("No conference"), NULL);
      g_fActiveConference = FALSE;
      FreeDataChannel();
      FreeConference();
      break;
    }
  }
  return S_OK;
}

HRESULT STDMETHODCALLTYPE CConfNotify::StateChanged ( NM_CONFERENCE_STATE uState )
HRESULT STDMETHODCALLTYPE CConfNotify::StateChanged ( NM_CONFERENCE_STATE uState )
HRESULT STDMETHODCALLTYPE CConfNotify::StateChanged ( NM_CONFERENCE_STATE uState )

Member Data Documentation

INmMember* CConfNotify::m_apIMembers[MAX_MEMBERS] [private]

Definition at line 131 of file conf.h.

ULONG CConfNotify::m_cIMembers [private]

Definition at line 130 of file conf.h.

Conf* CConfNotify::m_pConf [private]

Definition at line 81 of file nmsession.h.

The documentation for this class was generated from the following files:
  • Web/NetMeeting/NMChat/CConf.h
  • Web/NetMeeting/NMChat2/conf.h
  • Web/NetMeeting/PlugTransport/nmsession.h
  • Web/NetMeeting/NMShare/CConf.h
  • Web/NetMeeting/NMUI/CConf.h
  • Web/NetMeeting/NMChat/CConf.Cpp
  • Web/NetMeeting/NMChat2/conf.cpp
  • Web/NetMeeting/NMShare/CConf.Cpp
  • Web/NetMeeting/NMUI/CConf.Cpp
  • Web/NetMeeting/PlugTransport/nmsession.cpp
Generated on Wed Nov 13 2024 16:55:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CConnectDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes

CConnectDlg Class Reference

#include "ConnectDlg.h"

List of all members.

Public Types

enum | { IDD = IDD_CONNECT }
enum | { IDD = IDD_CONNECT }

Public Member Functions

CConnectDlg (CWnd *pParent=NULL)
CConnectDlg (CWnd *pParent=NULL)
void | set_Catalog (ICOMAdminCatalog *pCatalog)
void | set_ParentDlg (CVCExploreDlg *pDlg)

Public Attributes

CButton | m_CancelButton
CButton | m_cContinueButton
CButton | m_cRadioDS
CButton | m_cRadioWorkgroup
CEdit | m_edtRemoteComputerName
int | m_iRadioDS
CString m_strLogin

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
virtual void | DoDataExchange (CDataExchange *pDX)
afx_msg void | OnClose ()
afx_msg void | OnConnect ()
virtual BOOL | OnInitDialog ()
virtual BOOL | OnInitDialog ()
afx_msg void | OnLocalComputer ()
virtual void | OnOK ()
afx_msg void | OnRemoteComputer ()

Protected Attributes

HICON | m_hIcon

Private Member Functions

void | ReleaseCatalog ()
void | ToggleEditControl (bool Flag)

Private Attributes

int | m_nConnectionType
ICOMAdminCatalog * | m_pCatalog
CVCExploreDlg * m_pParentDlg

Detailed Description

Definition at line 30 of file ConnectDlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 40 of file ConnectDlg.h.

{ IDD = IDD_CONNECT };

anonymous enum
Enumerator:
IDD

Definition at line 31 of file connectdlg.h.

{ IDD = IDD_DS};

Constructor & Destructor Documentation

CConnectDlg::CConnectDlg ( CWnd * pParent = NULL )

Definition at line 42 of file ConnectDlg.Cpp.

  : CDialog(CConnectDlg::IDD, pParent)
{
  //{{AFX_DATA_INIT(CConnectDlg)
    // NOTE: the ClassWizard will add member initialization here
  //}}AFX_DATA_INIT

  // Load the dialogs icon resource
  m_hIcon = AfxGetApp()->LoadIcon(IDI_CONNECT);

  // Initialize members
  m_pCatalog = NULL;
  m_pParentDlg = NULL;
  m_nConnectionType = CONNECTION_TYPE_UNDEFINED;
}

CConnectDlg::CConnectDlg ( CWnd * pParent = NULL )

Member Function Documentation

void CConnectDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 59 of file ConnectDlg.Cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CConnectDlg)
  DDX_Control(pDX, IDC_EDIT_REMOTE_COMPUTER_NAME, m_edtRemoteComputerName);
  //}}AFX_DATA_MAP
}

virtual void CConnectDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]
void CConnectDlg::OnClose ( ) [protected]

Definition at line 208 of file ConnectDlg.Cpp.

{
  // Release the reference to the Catalog object if needed
  ReleaseCatalog();

  CDialog::OnClose();
}

afx_msg void CConnectDlg::OnConnect ( ) [protected]
virtual BOOL CConnectDlg::OnInitDialog ( ) [protected, virtual]
BOOL CConnectDlg::OnInitDialog ( ) [protected, virtual]

Definition at line 166 of file ConnectDlg.Cpp.

{
  CDialog::OnInitDialog();

  // Set the dialogs icon resource
  SetIcon(m_hIcon, true);   // 32x32 icon
  SetIcon(m_hIcon, false);  // 16x16 icon

  // Select and set default connection type
  CheckRadioButton(IDC_RADIO_THIS_COMPUTER, IDC_RADIO_REMOTE_COMPUTER, IDC_RADIO_THIS_COMPUTER);

  // Set the import type and description to match the current selection
  OnLocalComputer();

  // Set the edit control to it's default state
  ToggleEditControl(false);

  return TRUE;  // return TRUE unless you set the focus to a control
                // EXCEPTION: OCX Property Pages should return FALSE
}

void CConnectDlg::OnLocalComputer ( ) [protected]

Definition at line 160 of file ConnectDlg.Cpp.

{
  // Clear and disable the edit control
  ToggleEditControl(false);
}

void CConnectDlg::OnOK ( ) [protected, virtual]

Definition at line 88 of file ConnectDlg.Cpp.

{
  if (NULL != m_pCatalog)
  {
    ICatalogCollection* pRootCollection = NULL;
    HRESULT       hr = 0;
    _bstr_t       bstrInputValue = "";

    // Get a reference to the "Root" collection depending upon the
    //  specified connection type
    switch (m_nConnectionType)
    {
    case CONNECTION_TYPE_LOCAL:
        bstrInputValue = "Root";
        hr = m_pCatalog->GetCollection(bstrInputValue,
                      (IDispatch**) &pRootCollection);
        bstrInputValue = "( Local )";
        break;
    case CONNECTION_TYPE_REMOTE:
        int nMaxLength = m_edtRemoteComputerName.GetWindowTextLength() + 1;
        char* pBuf = new char[nMaxLength];
        m_edtRemoteComputerName.GetWindowText(pBuf, nMaxLength);
        bstrInputValue = pBuf;
        delete [] pBuf;
        hr = m_pCatalog->Connect(bstrInputValue,
                    (IDispatch**) &pRootCollection);
        break;
    }

    // Contine only if we successfully get a reference to the specified "Root" collection
    if SUCCEEDED(hr)
    {
      // Attempt assignment only if correctly setup
      if (NULL != m_pParentDlg)
      {
        // Increment the reference count on the object before we pass it
        //  back to the parent dialog
        pRootCollection->AddRef();
        // Set the new remote connection
        m_pParentDlg->set_CurrentCollection(pRootCollection);
        // Set the computer name
        m_pParentDlg->set_ComputerName(bstrInputValue);
        // Release the temporary object
        pRootCollection->Release();
      }
      else
        MessageBox("Invalid parent reference.\n\nYou must call CConnectDlg->set_ParentDlg() before attempting to execute ICatalog::Connect().\n\nPress OK to continue.",
              "Error",
              (MB_OK | MB_ICONERROR));
    }
    else
      MessageBox("Failed to connect to specified root collection.\n\nPress OK to continue.",
            "Error",
            (MB_OK | MB_ICONERROR));
  }
  else
    MessageBox("Invalid Catalog reference.\n\nNo processing will be performed.\n\nPress OK to continue.",
          "Error",
          (MB_OK | MB_ICONERROR));

  // Release the reference to our Catalog object
  ReleaseCatalog();

  CDialog::OnOK();
}

void CConnectDlg::OnRemoteComputer ( ) [protected]

Definition at line 154 of file ConnectDlg.Cpp.

{
  // Enable the edit control
  ToggleEditControl(true);
}

void CConnectDlg::ReleaseCatalog ( ) [private]

Definition at line 216 of file ConnectDlg.Cpp.

{
  // Release the reference to the Catalog object if needed
  if (NULL != m_pCatalog)
    m_pCatalog->Release();
}

void CConnectDlg::set_Catalog ( ICOMAdminCatalog * pCatalog )

Definition at line 79 of file ConnectDlg.Cpp.

{
  // Only can have one Catalog object reference... release all prior references before assignment
  ReleaseCatalog();

  // Assign the new Catalog reference
  m_pCatalog = pCatalog;
}

void CConnectDlg::set_ParentDlg ( CVCExploreDlg * pDlg )

Definition at line 203 of file ConnectDlg.Cpp.

{
  m_pParentDlg = pDlg;
}

void CConnectDlg::ToggleEditControl ( bool Flag ) [private]

Definition at line 187 of file ConnectDlg.Cpp.

{
  // Clear the control if we are disabling it
  if (Flag)
    m_nConnectionType = CONNECTION_TYPE_REMOTE;
  else
  {
    m_nConnectionType = CONNECTION_TYPE_LOCAL;
    m_edtRemoteComputerName.SetSel(0, -1, false);
    m_edtRemoteComputerName.Clear();
  }

  // Toggle the control state
  m_edtRemoteComputerName.EnableWindow(Flag);
}

Member Data Documentation

CButton CConnectDlg::m_CancelButton

Definition at line 32 of file connectdlg.h.

CButton CConnectDlg::m_cContinueButton

Definition at line 34 of file connectdlg.h.

CButton CConnectDlg::m_cRadioDS

Definition at line 33 of file connectdlg.h.

CButton CConnectDlg::m_cRadioWorkgroup

Definition at line 36 of file connectdlg.h.

CEdit CConnectDlg::m_edtRemoteComputerName

Definition at line 41 of file ConnectDlg.h.

HICON CConnectDlg::m_hIcon [protected]

Definition at line 54 of file ConnectDlg.h.

int CConnectDlg::m_iRadioDS

Definition at line 35 of file connectdlg.h.

int CConnectDlg::m_nConnectionType [private]

Definition at line 69 of file ConnectDlg.h.

ICOMAdminCatalog* CConnectDlg::m_pCatalog [private]

Definition at line 70 of file ConnectDlg.h.

CVCExploreDlg* CConnectDlg::m_pParentDlg [private]

Definition at line 67 of file ConnectDlg.h.

CString CConnectDlg::m_strLogin

Definition at line 26 of file connectdlg.h.

The documentation for this class was generated from the following files:
  • Com/Administration/Explore.VC/ConnectDlg.h
  • NetDS/MessageQueuing/mqf_draw/connectdlg.h
  • Com/Administration/Explore.VC/ConnectDlg.Cpp
  • NetDS/MessageQueuing/mqf_draw/connectdlg.cpp
Generated on Wed Nov 13 2024 16:55:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CConnectionPoint Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes

CConnectionPoint Class Reference

#include "CConnectionPT.h"

Inherits CBase.

List of all members.

Public Member Functions

CConnectionPoint (CConnectionPointContainer *pCPC, IID iid)
CConnectionPoint (CMainWindow *pCMainWindow, CMDIChild *pCMDIChild=NULL)
virtual | ~CConnectionPoint ()
virtual | ~CConnectionPoint ()
virtual ULONG __stdcall | AddRef ()
virtual HRESULT | AutoQI (DWORD dwCreateOpts)
virtual HRESULT | AutoRelease ()
virtual void __stdcall | FinalRelease ()
virtual HRESULT | GetConnectionInterface (IID *pIID)
virtual REFIID | GetDefaultInterface ()
virtual IUnknown ** | GetInterfaceAddress (REFIID riid)
virtual WCHAR * | GetObjectDesc ()
virtual LONG | GetObjectImage ()
virtual UINT | GetObjectMenu ()
virtual WCHAR * | GetObjectName ()
virtual HRESULT __stdcall | QueryInterface (REFIID iid, PVOID *ppv)
virtual ULONG __stdcall | Release ()
bool __stdcall | SignalEvent ()
bool __stdcall | SignalEvent (DISPID dispid, DISPPARAMS *params)

Public Attributes

DWORD m_dwCookie
IConnectionPoint * | m_pIConnectionPoint

Private Member Functions

virtual HRESULT __stdcall | Advise (LPUNKNOWN lpUnk, LPDWORD pdwCookie)
virtual HRESULT __stdcall | EnumConnections (LPENUMCONNECTIONS *ppenum)
virtual HRESULT __stdcall | GetConnectionInterface (IID *pIID)
virtual HRESULT __stdcall | GetConnectionPointContainer (LPCONNECTIONPOINTCONTAINER *ppCPC)
virtual HRESULT __stdcall | Unadvise (DWORD dwCookie)

Private Attributes

const DWORD | m_Adviselimit
DWORD m_cookie
ULONG m_cRef
IID m_iid
AppEvents * | m_lpEventSink [2]
CConnectionPointContainer * m_pCPC

Detailed Description

Definition at line 51 of file CConnectionPT.h.

Constructor & Destructor Documentation

CConnectionPoint::CConnectionPoint | ( | CConnectionPointContainer * | pCPC,
 |  | IID | iid
 | ) |  |

Definition at line 218 of file CConnectionPT.cpp.

                                                                           :
  m_cookie(0), m_cRef(0), m_pCPC(pCPC), m_iid(iid), m_Adviselimit(2)
{
  DEBUGTRACE(_T("In CConnectionPoint ctor"));
#if 0
  LPOLESTR lpstr;
  StringFromIID(m_iid, &lpstr);
  DEBUGTRACE(_T("[%S] was passed in to CConnectionPoint ctor"), lpstr);
  CoTaskMemFree(lpstr);
#endif
  _ASSERT(m_pCPC);
  for (DWORD i = 0; i < m_Adviselimit; i++)
    m_lpEventSink[i] = NULL;
}

CConnectionPoint::~CConnectionPoint ( ) [virtual]

Definition at line 233 of file CConnectionPT.cpp.

{
  DEBUGTRACE(_T("In CConnectionPoint dtor"));
}

CConnectionPoint::CConnectionPoint | ( | CMainWindow * | pCMainWindow,
 |  | CMDIChild * | pCMDIChild = NULL
 | ) |  |

Definition at line 848 of file cbase.cpp.

  : CBase(eCConnectionPoint, pCMainWindow, pCMDIChild)
{
  //Common OLE DB Interfaces
  m_pIConnectionPoint       = NULL;   //Connection interface

  //Data
  m_dwCookie            = 0;
}

virtual CConnectionPoint::~CConnectionPoint ( ) [virtual]

Member Function Documentation

ULONG __stdcall CConnectionPoint::AddRef ( ) [virtual]

Definition at line 256 of file CConnectionPT.cpp.

{
  DEBUGTRACE(_T("In IConnectionPoint::AddRef refcounts = %i"), m_cRef+1);
/*
 * Need to AddRef ConnectionPointContainer since it is what determines
 * the lifetime of CConnectionPoint interface. This will be countered
 * CConnectionPoint::Release()
 */
  m_pCPC->AddRef();
  return InterlockedIncrement(reinterpret_cast<PLONG>(&m_cRef));
}

HRESULT __stdcall CConnectionPoint::Advise | ( | LPUNKNOWN | lpUnk,
 |  | LPDWORD | pdwCookie |
 | ) |  |  | [private, virtual]

Definition at line 387 of file CConnectionPT.cpp.

{

  DEBUGTRACE(_T("In IConnectionPoint::Advise"));
  CHECKPOINTER(pdwCookie && lpUnk);

  if (m_cookie >= m_Adviselimit)
    return CONNECT_E_ADVISELIMIT;

  HRESULT hr =lpUnk->QueryInterface(m_iid, reinterpret_cast<PVOID*>(&m_lpEventSink[m_cookie]));
  if (FAILED(hr))
    return hr == E_NOINTERFACE ? CONNECT_E_CANNOTCONNECT : hr;

  // TODO Add to connection to list
  *pdwCookie = m_cookie++; // Running count of # of event sinks
  return S_OK;
}

HRESULT CConnectionPoint::AutoQI ( DWORD dwCreateOpts ) [virtual]

Implements CBase.

Definition at line 887 of file cbase.cpp.

{
  //Delegate First so we have base interfaces
  CBase::AutoQI(dwCreateOpts);

  //[MANDATORY] Obtain [mandatory] interfaces
  if(dwCreateOpts & CREATE_QI_MANDATORY)
  {
    OBTAIN_INTERFACE(IConnectionPoint);
  }

  //[OPTIONAL]
  if(dwCreateOpts & CREATE_QI_OPTIONAL)
  {
  }

  return S_OK;
}

HRESULT CConnectionPoint::AutoRelease ( ) [virtual]

Implements CBase.

Definition at line 873 of file cbase.cpp.

{
  //Common OLE DB Interface
  RELEASE_INTERFACE(IConnectionPoint);

  //Delegate
  return CBase::AutoRelease();
}

HRESULT __stdcall CConnectionPoint::EnumConnections ( LPENUMCONNECTIONS * ppenum ) [private, virtual]

Definition at line 416 of file CConnectionPT.cpp.

{
  DEBUGTRACE(_T("In IConnectionPoint::EnumConnections"));
  CHECKPOINTER(ppenum);

  CONNECTDATA* elemlist = new CONNECTDATA[m_cookie]; // m_cookie is running total of connections to this ConnectionPoint
  for (DWORD i = 0; i < m_cookie; i++)
  {
    elemlist[i].dwCookie = i;
    elemlist[i].pUnk = m_lpEventSink[i];
  }

  CEnumConnections *penum = CEnumConnections::Create(this, m_cookie, elemlist);
  HRESULT hr = penum->QueryInterface(IID_IEnumConnections, reinterpret_cast<PVOID*>(ppenum));
  return hr;
}

void __stdcall CConnectionPoint::FinalRelease ( ) [virtual]

Definition at line 290 of file CConnectionPT.cpp.

{
#if 0 // HACK till I get the list for sinks interfaces
  _ASSERT(m_cookie == 0);
#endif
  m_pCPC->Release();  // Release strong lock added in by the AddRef()
}

HRESULT CConnectionPoint::GetConnectionInterface ( IID * pIID ) [private, virtual]

Definition at line 366 of file CConnectionPT.cpp.

{
  DEBUGTRACE(_T("In IConnectionPoint::GetConnectionInterface"));
  CHECKPOINTER(pIID);

  *pIID = m_iid;
  return S_OK;
}

virtual HRESULT CConnectionPoint::GetConnectionInterface ( IID * pIID ) [virtual]
HRESULT __stdcall CConnectionPoint::GetConnectionPointContainer ( LPCONNECTIONPOINTCONTAINER * ppCPC ) [private, virtual]

Definition at line 375 of file CConnectionPT.cpp.

{
  DEBUGTRACE(_T("In IConnectionPoint::GetConnectionPointContainer"));
  CHECKPOINTER(ppCPC);

  HRESULT hr = m_pCPC->QueryInterface(IID_IConnectionPointContainer, reinterpret_cast<PVOID*>(ppCPC));
  return hr;
}

virtual REFIID CConnectionPoint::GetDefaultInterface ( ) [inline, virtual]

Implements CBase.

Definition at line 281 of file cbase.h.

{ return IID_IConnectionPoint;      }

IUnknown ** CConnectionPoint::GetInterfaceAddress ( REFIID riid ) [virtual]

Implements CBase.

Definition at line 911 of file cbase.cpp.

{
  HANDLE_GETINTERFACE(IConnectionPoint);

  //Otherwise delegate
  return CBase::GetInterfaceAddress(riid);
}

WCHAR * CConnectionPoint::GetObjectDesc ( ) [virtual]

Reimplemented from CBase.

Definition at line 924 of file cbase.cpp.

{
  if(!m_strObjectDesc && m_pIConnectionPoint)
  {
    IID iid;
    if(SUCCEEDED(GetConnectionInterface(&iid)))
      m_strObjectDesc.CopyFrom(GetInterfaceName(iid));
  }

  return m_strObjectDesc;
}

virtual LONG CConnectionPoint::GetObjectImage ( ) [inline, virtual]

Implements CBase.

Definition at line 280 of file cbase.h.

{ return IMAGE_FORM;          }

virtual UINT CConnectionPoint::GetObjectMenu ( ) [inline, virtual]

Implements CBase.

Definition at line 279 of file cbase.h.

{ return IDM_CONNECTIONPOINTMENU;   }

virtual WCHAR* CConnectionPoint::GetObjectName ( ) [inline, virtual]

Implements CBase.

Definition at line 278 of file cbase.h.

{ return L"ConnectionPoint";      }

HRESULT __stdcall CConnectionPoint::QueryInterface | ( | REFIID | iid,
 |  | PVOID * | ppv |
 | ) |  |  | [virtual]

Definition at line 238 of file CConnectionPT.cpp.

{
  CHECKPOINTER(ppObj);

  if (iid == IID_IUnknown || iid == IID_IConnectionPoint)
    *ppObj = this;
  else
  {
    *ppObj = NULL;
    return E_NOINTERFACE;
  }

  if (*ppObj)
    reinterpret_cast<LPUNKNOWN>(*ppObj)->AddRef();

  return S_OK;
}

ULONG __stdcall CConnectionPoint::Release ( ) [virtual]

Definition at line 276 of file CConnectionPT.cpp.

{
  _ASSERT(m_cRef > 0); // not thread safe
  DEBUGTRACE(_T("In IConnectionPoint::Release refcounts = %i"), m_cRef-1);

  if (InterlockedDecrement(reinterpret_cast<PLONG>(&m_cRef)) == 0)
  {
    FinalRelease();
    return 0;
  }
  m_pCPC->Release();  // Release strong lock added in by the AddRef()
  return m_cRef;
}

bool __stdcall CConnectionPoint::SignalEvent | ( | DISPID | dispid,
 |  | DISPPARAMS * | params
 | ) |  |
bool __stdcall CConnectionPoint::SignalEvent ( )

Definition at line 341 of file CConnectionPT.cpp.

{
  if (m_cookie == 0) // No sink has been set up
    return false;

  HRESULT hr;
  LPCALLFACTORY pCallF = NULL;
  AsyncAppEvents*  pAsyncTest = NULL;
  LPSYNCHRONIZE pSync = NULL;

  for (DWORD i = 0; i < m_cookie; i++)
  {
    hr = m_lpEventSink[i]->QueryInterface(IID_ICallFactory, (PVOID*)&pCallF);
    _ASSERT(SUCCEEDED(hr) && pCallF);
    hr = pCallF->CreateCall(IID_AsyncAppEvents, NULL, IID_AsyncAppEvents, (LPUNKNOWN*)&pAsyncTest);
    _ASSERT(SUCCEEDED(hr) && pAsyncTest);
    hr = pAsyncTest->Begin_Beep(~0);
    RELEASEINTERFACE(pAsyncTest);
    RELEASEINTERFACE(pCallF);
  }

  return SUCCEEDED(hr) ? true : false;
}

HRESULT __stdcall CConnectionPoint::Unadvise ( DWORD dwCookie ) [private, virtual]

Definition at line 405 of file CConnectionPT.cpp.

{
  DEBUGTRACE(_T("In IConnectionPoint::Unadvise"));

  // TODO Remove from list. If cookie does not match return E_UNEXPEC; otherwise do ...
  // decrement # of event sinks attached to the list

  RELEASEINTERFACE(m_lpEventSink[dwCookie]);
  return S_OK;
}

Member Data Documentation

const DWORD CConnectionPoint::m_Adviselimit [private]

Definition at line 79 of file CConnectionPT.h.

DWORD CConnectionPoint::m_cookie [private]

Definition at line 77 of file CConnectionPT.h.

ULONG CConnectionPoint::m_cRef [private]

Reimplemented from CBase.

Definition at line 76 of file CConnectionPT.h.

DWORD CConnectionPoint::m_dwCookie

Definition at line 295 of file cbase.h.

IID CConnectionPoint::m_iid [private]

Definition at line 78 of file CConnectionPT.h.

AppEvents* CConnectionPoint::m_lpEventSink[2] [private]

Definition at line 86 of file CConnectionPT.h.

CConnectionPointContainer* CConnectionPoint::m_pCPC [private]

Definition at line 88 of file CConnectionPT.h.

IConnectionPoint* CConnectionPoint::m_pIConnectionPoint

Definition at line 289 of file cbase.h.

The documentation for this class was generated from the following files:
  • Com/async/server/CConnectionPT.h
  • Dataaccess/oledb/rowsetviewer/cbase.h
  • Com/async/server/CConnectionPT.cpp
  • Dataaccess/oledb/rowsetviewer/cbase.cpp
Generated on Wed Nov 13 2024 16:55:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CConnectionPointContainer Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

CConnectionPointContainer Class Reference

#include "CConnectionPT.h"

List of all members.

Public Member Functions

CConnectionPoint *__stdcall | GetConnectionPoint (REFIID iid)
bool __stdcall | Init (EventID &events)

Protected Member Functions

CConnectionPointContainer ()
virtual | ~CConnectionPointContainer ()

Private Member Functions

virtual HRESULT __stdcall | EnumConnectionPoints (LPENUMCONNECTIONPOINTS *ppenum)
virtual HRESULT __stdcall | FindConnectionPoint (REFIID id, LPCONNECTIONPOINT *ppCP)

Private Attributes

DWORD m_cCP
DWORD m_cookie
CConnectionPoint ** m_prgCP
IID * m_prgEventIID

Detailed Description

Definition at line 30 of file CConnectionPT.h.

Constructor & Destructor Documentation

CConnectionPointContainer::CConnectionPointContainer ( ) [protected]

Definition at line 86 of file CConnectionPT.cpp.

                                                     : m_cookie(0), m_cCP(0), m_prgEventIID(NULL), m_prgCP(NULL)
{
  DEBUGTRACE(_T("In CConnectionPointContainer ctor"));
}

CConnectionPointContainer::~CConnectionPointContainer ( ) [protected, virtual]

Definition at line 117 of file CConnectionPT.cpp.

{
  DEBUGTRACE(_T("In CConnectionPointContainer dtor"));
  for (DWORD i = 0; i < m_cCP; i++)
    delete m_prgCP[i];
  delete [] m_prgEventIID;
  delete [] m_prgCP;
}

Member Function Documentation

HRESULT __stdcall CConnectionPointContainer::EnumConnectionPoints ( LPENUMCONNECTIONPOINTS * ppenum ) [private, virtual]

Definition at line 153 of file CConnectionPT.cpp.

{
  DEBUGTRACE(_T("In IConnectionPointContainer::EnumConnectionPoints"));

  CHECKPOINTER(ppenum);
  LPCONNECTIONPOINT *elemlist = new LPCONNECTIONPOINT[m_cCP];
  for (DWORD i = 0; i < m_cCP; i++)
    elemlist[i] = m_prgCP[i]; // only a shallow copy is needed

  CEnumConnectionPoints *penum = CEnumConnectionPoints::Create(this, m_cCP, elemlist); // elemlist is now owned by CEnumConnectionPoints
  _ASSERT(penum);
  HRESULT hr = penum->QueryInterface(IID_IEnumConnectionPoints, reinterpret_cast<PVOID*>(ppenum));
  return hr;
}

HRESULT __stdcall CConnectionPointContainer::FindConnectionPoint | ( | REFIID | id,
 |  | LPCONNECTIONPOINT * | ppCP |
 | ) |  |  | [private, virtual]

Definition at line 169 of file CConnectionPT.cpp.

{
  DEBUGTRACE(_T("In IConnectionPointContainer::FindConnectionPoint"));
  CHECKPOINTER(ppCP);

  *ppCP = NULL;
  for (DWORD i = 0; i < m_cCP; i++)
    if (m_prgEventIID[i] == iid)
    {
      *ppCP = m_prgCP[i];
      (*ppCP)->AddRef();
      return S_OK;
    }

  return CONNECT_E_NOCONNECTION;
}

CConnectionPoint *__stdcall CConnectionPointContainer::GetConnectionPoint ( REFIID iid )

Definition at line 142 of file CConnectionPT.cpp.

{
/*
 * TODO: What this code should be doing is searching through a list of supported source IID's
 */
  if (iid == IID_AppEvents)
    return m_prgCP[0];

  return NULL;
}

bool __stdcall CConnectionPointContainer::Init ( EventID & events )

Definition at line 92 of file CConnectionPT.cpp.

{
  m_cCP = events.cEventID;
  m_prgCP = new CConnectionPoint*[m_cCP];
  m_prgEventIID = new IID[m_cCP];
  for (DWORD i = 0; i < m_cCP; i++)
  {
#if 0
    LPOLESTR lpstr;
    StringFromIID(events.EventIDs[i], &lpstr);
    DEBUGTRACE(_T("passing [%S] to CConnectionPoint ctor"), lpstr);
    CoTaskMemFree(lpstr);
#endif
    CConnectionPoint *cp = new CConnectionPoint(this, events.EventIDs[i]);
    _ASSERT(cp);
    m_prgCP[i] = cp;
    m_prgEventIID[i] = events.EventIDs[i];
  }
  return true;
}

Member Data Documentation

DWORD CConnectionPointContainer::m_cCP [private]

Definition at line 46 of file CConnectionPT.h.

DWORD CConnectionPointContainer::m_cookie [private]

Definition at line 45 of file CConnectionPT.h.

CConnectionPoint** CConnectionPointContainer::m_prgCP [private]

Definition at line 47 of file CConnectionPT.h.

IID* CConnectionPointContainer::m_prgEventIID [private]

Definition at line 48 of file CConnectionPT.h.

The documentation for this class was generated from the following files:
  • Com/async/server/CConnectionPT.h
  • Com/async/server/CConnectionPT.cpp
Generated on Wed Nov 13 2024 16:55:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CConsole Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CConsole Class Reference

#include "cdialoglite.h"

Inherited by CRichEditLite.

List of all members.

Public Member Functions

CConsole ()
virtual | ~CConsole ()
CConsole & GetConsole ()
virtual CConsole & | operator<< (LPCWSTR pwsz)
virtual CConsole & | operator<< (COLORREF refColor)
virtual CConsole & | operator<< (COLORA attColor)
virtual void | SetColor (COLORREF refColor)
virtual void | SetColorAttrib (COLORA attColor, BOOL fEnable=TRUE)
virtual HRESULT | Write (LPCWSTR pwsz)=0
virtual HRESULT | WriteLine (LPCWSTR pwsz=NULL)

Protected Attributes

WCHAR * | m_pwszNewLine

Detailed Description

Definition at line 478 of file cdialoglite.h.

Constructor & Destructor Documentation

CConsole::CConsole ( ) [inline]

Definition at line 482 of file cdialoglite.h.

  {
    m_pwszNewLine = wWndEOL;
  }

virtual CConsole::~CConsole ( ) [inline, virtual]

Definition at line 486 of file cdialoglite.h.

  {
  }

Member Function Documentation

CConsole& CConsole::GetConsole ( ) [inline]

Definition at line 491 of file cdialoglite.h.

{ return *this; }

virtual CConsole& CConsole::operator<< ( LPCWSTR pwsz ) [inline, virtual]

Definition at line 494 of file cdialoglite.h.

  {
    Write(pwsz);
    return GetConsole();
  }

virtual CConsole& CConsole::operator<< ( COLORA attColor ) [inline, virtual]

Definition at line 526 of file cdialoglite.h.

  {
    SetColorAttrib(attColor);
    return GetConsole();
  }

virtual CConsole& CConsole::operator<< ( COLORREF refColor ) [inline, virtual]

Definition at line 521 of file cdialoglite.h.

  {
    SetColor(refColor);
    return GetConsole();
  }

virtual void CConsole::SetColor ( COLORREF refColor ) [inline, virtual]

Reimplemented in CRichEditLite.

Definition at line 515 of file cdialoglite.h.

  {
  }

virtual void CConsole::SetColorAttrib | ( | COLORA | attColor,
 |  | BOOL | fEnable = TRUE |
 | ) |  |  | [inline, virtual]

Reimplemented in CRichEditLite.

Definition at line 518 of file cdialoglite.h.

  {
  }

virtual HRESULT CConsole::Write ( LPCWSTR pwsz ) [pure virtual]

Implemented in CRichEditLite.

virtual HRESULT CConsole::WriteLine ( LPCWSTR pwsz = NULL ) [inline, virtual]

Definition at line 504 of file cdialoglite.h.

  {
    if(pwsz)
      Write(pwsz);
    return Write(m_pwszNewLine);
  }

Member Data Documentation

WCHAR* CConsole::m_pwszNewLine [protected]

Definition at line 538 of file cdialoglite.h.

The documentation for this class was generated from the following file:
  • Dataaccess/oledb/rowsetviewer/cdialoglite.h
Generated on Wed Nov 13 2024 16:55:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CConstraintDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CConstraintDlg Class Reference

#include "cdialog.h"

Inherits CDialogLite, and CRowsetViewerDlg.

List of all members.

Public Member Functions

CConstraintDlg (CMainWindow *pCMainWindow)
virtual | ~CConstraintDlg ()
virtual BOOL | OnCommand (UINT iID, HWND hWndCtrl)
virtual BOOL | OnInitDialog ()
virtual BOOL | OnOK ()
HRESULT | SetConstraint (HWND hWndParent, DBCONSTRAINTDESC *pConsDesc)
HRESULT | SetConstraintAndTable (HWND hWndParent, DBCONSTRAINTDESC *pConsDesc, WCHAR **ppwszTableName)

Public Attributes

CComboBoxLite m_comboConstraintType
CComboBoxLite m_comboDeleteRule
CComboBoxLite m_comboMatchType
CComboBoxLite m_comboUpdateRule
CEditBoxLite m_editBaseTableName
CEditBoxLite m_editColumnName
CEditBoxLite m_editConstraintName
CEditBoxLite m_editConstraintText
CEditBoxLite m_editFKColumnName
CEditBoxLite m_editReferencedTableName
CListBoxLite m_listColumnList
CListBoxLite m_listDeferrability
CListBoxLite m_listFKColumnList
DBCONSTRAINTDESC * | m_pConsDesc
WCHAR ** | m_ppwszTableName

Detailed Description

Definition at line 660 of file cdialog.h.

Constructor & Destructor Documentation

CConstraintDlg::CConstraintDlg ( CMainWindow * pCMainWindow )

Definition at line 5381 of file cdialog.cpp.

  : CDialogLite(IDD_ADDCONSTRAINTDESC), CRowsetViewerDlg(pCMainWindow)
{
  m_pConsDesc   = NULL;
  m_ppwszTableName  = NULL;
} //CConstraintDlg::CConstraintDlg

CConstraintDlg::~CConstraintDlg ( ) [virtual]

Definition at line 5393 of file cdialog.cpp.

{
} //CConstraintDlg::~CConstraintDlg

Member Function Documentation

BOOL CConstraintDlg::OnCommand | ( | UINT | iID,
 |  | HWND | hWndCtrl |
 | ) |  |  | [virtual]

Definition at line 5502 of file cdialog.cpp.

{
  WCHAR *pwszColName = NULL;

  switch(iID)
  {
    case IDB_ADDCOL:
    {
      // add column to the list of columns
      pwszColName = m_editColumnName.GetWindowText();
      if (pwszColName)
        m_listColumnList.AddString(pwszColName);
      SAFE_FREE(pwszColName);
      return TRUE;
    }

    case IDB_ADDFKCOL:
    {
      // add column to the list of columns
      pwszColName = m_editFKColumnName.GetWindowText();
      if (pwszColName)
        m_listFKColumnList.AddString(pwszColName);
      SAFE_FREE(pwszColName);
      return TRUE;
    }

    case IDB_DELCOL:
    {
      m_listColumnList.DeleteString(m_listColumnList.GetCurSel());
      return TRUE;
    }

    case IDB_DELFKCOL:
    {
      m_listFKColumnList.DeleteString(m_listFKColumnList.GetCurSel());
      return TRUE;
    }
  };

  return FALSE;
} //CConstraintDlg::OnCommand

BOOL CConstraintDlg::OnInitDialog ( ) [virtual]

Definition at line 5423 of file cdialog.cpp.

{
  CWaitCursor waitCursor;
  INDEX   iSel;
  ULONG   index;

  //Setup Controls
  m_comboConstraintType.CreateIndirect(m_hWnd, IDC_CONSTYPE);
  m_listDeferrability.CreateIndirect(m_hWnd, IDC_DEFERRABILITY);
  m_listColumnList.CreateIndirect(m_hWnd, IDC_COLLIST);
  m_listFKColumnList.CreateIndirect(m_hWnd, IDC_FKCOLLIST);
  m_comboMatchType.CreateIndirect(m_hWnd, IDC_MATCHTYPE);
  m_comboUpdateRule.CreateIndirect(m_hWnd, IDC_UPDATERULE);
  m_comboDeleteRule.CreateIndirect(m_hWnd, IDC_DELETERULE);

  m_editConstraintName.CreateIndirect(m_hWnd, IDE_CONSNAME);
  m_editBaseTableName.CreateIndirect(m_hWnd, IDE_TABLEID);
  m_editReferencedTableName.CreateIndirect(m_hWnd, IDE_REFERENCEDTABLE);
  m_editConstraintText.CreateIndirect(m_hWnd, IDE_CONSTEXT);
  m_editColumnName.CreateIndirect(m_hWnd, IDE_COLNAME);
  m_editFKColumnName.CreateIndirect(m_hWnd, IDE_FKCOLNAME);

  //Now adjust display
  if(NULL != m_ppwszTableName)
  {
    SetWindowText(L"ITableDefinitionWithConstraints::AddConstraint");
    m_editBaseTableName.EnableWindow(TRUE);
  }
  else
  {
    SetWindowText(L"ITableDefinitionWithConstraints::CreateTableWithConstraints");
    m_editBaseTableName.EnableWindow(FALSE);
  }

  //Fill in the constraint type list
  for (index = 0; index < g_cConsTypeMaps; index++)
  {
    iSel = m_comboConstraintType.AddString(g_rgConsTypeMaps[index].pwszName);
    m_comboConstraintType.SetItemParam(iSel, g_rgConsTypeMaps[index].lItem);
  }
  m_comboConstraintType.SetCurSel(1);

  //Fill in the deferrability list
  for (index = 0; index < g_cDeferrabilityMaps; index++)
  {
    iSel = m_listDeferrability.AddString(g_rgDeferrabilityMaps[index].pwszName);
    m_listDeferrability.SetItemParam(iSel, g_rgDeferrabilityMaps[index].lItem);
  }

  //Fill in the match type list
  for (index = 0; index < g_cMatchTypeMaps; index++)
  {
    iSel = m_comboMatchType.AddString(g_rgMatchTypeMaps[index].pwszName);
    m_comboMatchType.SetItemParam(iSel, g_rgMatchTypeMaps[index].lItem);
  }

  //Fill in the update and delete list
  for (index = 0; index < g_cUpDelRuleMaps; index++)
  {
    // update list
    iSel = m_comboUpdateRule.AddString(g_rgUpDelRuleMaps[index].pwszName);
    m_comboUpdateRule.SetItemParam(iSel, g_rgUpDelRuleMaps[index].lItem);

    // delete list
    iSel = m_comboDeleteRule.AddString(g_rgUpDelRuleMaps[index].pwszName);
    m_comboDeleteRule.SetItemParam(iSel, g_rgUpDelRuleMaps[index].lItem);
  }

  //Delegate
  return CDialogLite::OnInitDialog();
} // CConstraintDlg::OnInitDialog

BOOL CConstraintDlg::OnOK ( ) [virtual]

Definition at line 5549 of file cdialog.cpp.

{
  CWaitCursor waitCursor;
  HWND    hWndDeferrability = GetDlgItem(IDC_DEFERRABILITY);
  const ULONG cMaxSel = 2;
  INDEX   cSel;
  INT     rgSel[cMaxSel];
  DBORDINAL index;
  HRESULT   hr;
  WCHAR   *pwszText = NULL;

  // fill in table name
  if (m_ppwszTableName)
  {
    *m_ppwszTableName = this->m_editBaseTableName.GetWindowText();
  }

  // fill in pConsDesc structure
  if (m_pConsDesc)
  {
    WCHAR *pwszConsName = m_editConstraintName.GetWindowText();

    // get constraint name
    if (pwszConsName)
    {
      SAFE_ALLOC(m_pConsDesc->pConstraintID, DBID, 1);
      m_pConsDesc->pConstraintID->eKind     = DBKIND_NAME;
      m_pConsDesc->pConstraintID->uName.pwszName  = pwszConsName ;
    }

    // get the type
    m_pConsDesc->ConstraintType = (DBCONSTRAINTTYPE)m_comboConstraintType.GetItemParam(m_comboConstraintType.GetCurSel());

    // get deferrability
    m_pConsDesc->Deferrability = 0;
    cSel = SendMessage(hWndDeferrability, LB_GETSELITEMS, (WPARAM)cMaxSel, (LPARAM)rgSel);

    if (1 == cSel)
      m_pConsDesc->Deferrability |= m_listDeferrability.GetItemParam(rgSel[0]);
    else if (2 == cSel)
      m_pConsDesc->Deferrability = DBDEFERRABILITY_DEFERRED | DBDEFERRABILITY_DEFERRABLE;

    // get text of constraint
    m_pConsDesc->pwszConstraintText = m_editConstraintText.GetWindowText();

    // get list of column names
    m_pConsDesc->cColumns = m_listColumnList.GetCount();
    if (m_pConsDesc->cColumns)
    {
      SAFE_ALLOC(m_pConsDesc->rgColumnList, DBID, m_pConsDesc->cColumns);
      for (index = 0; index < m_pConsDesc->cColumns; index++)
      {
        m_pConsDesc->rgColumnList[index].eKind = DBKIND_NAME;
        SAFE_ALLOC(m_pConsDesc->rgColumnList[index].uName.pwszName, WCHAR,
          m_listColumnList.GetTextLen(index)+1);
        m_listColumnList.GetText(index, m_pConsDesc->rgColumnList[index].uName.pwszName);
      }
    }

    // get referenced table name
    pwszText = m_editReferencedTableName.GetWindowText();
    if (pwszText)
    {
      SAFE_ALLOC(m_pConsDesc->pReferencedTableID, DBID, 1);
      m_pConsDesc->pReferencedTableID->eKind      = DBKIND_NAME;
      m_pConsDesc->pReferencedTableID->uName.pwszName = pwszText;
    }

    // get list of foreign key column names
    m_pConsDesc->cForeignKeyColumns = m_listFKColumnList.GetCount();
    if (m_pConsDesc->cForeignKeyColumns)
    {
      SAFE_ALLOC(m_pConsDesc->rgForeignKeyColumnList, DBID, m_pConsDesc->cForeignKeyColumns);
      for (index = 0; index < m_pConsDesc->cForeignKeyColumns; index++)
      {
        m_pConsDesc->rgForeignKeyColumnList[index].eKind = DBKIND_NAME;
        SAFE_ALLOC(m_pConsDesc->rgForeignKeyColumnList[index].uName.pwszName, WCHAR,
          m_listFKColumnList.GetTextLen(index)+1);
        m_listFKColumnList.GetText(index, m_pConsDesc->rgForeignKeyColumnList[index].uName.pwszName);
      }
    }

    // get match type
    m_pConsDesc->MatchType = (DBMATCHTYPE)m_comboMatchType.GetItemParam(m_comboMatchType.GetCurSel());

    // get update rule
    m_pConsDesc->UpdateRule = (DBUPDELRULE)m_comboUpdateRule.GetItemParam(m_comboUpdateRule.GetCurSel());

    // get delete rule
    m_pConsDesc->DeleteRule = (DBUPDELRULE)m_comboDeleteRule.GetItemParam(m_comboDeleteRule.GetCurSel());
  }

CLEANUP:
  //Delegate
  return CDialogLite::OnOK();
} //CConstraintDlg::OnOK

HRESULT CConstraintDlg::SetConstraint | ( | HWND | hWndParent,
 |  | DBCONSTRAINTDESC * | pConsDesc |
 | ) |  |  | [inline]

Definition at line 675 of file cdialog.h.

                                                                            {
              return SetConstraintAndTable(hWndParent, pConsDesc, NULL);
  }

HRESULT CConstraintDlg::SetConstraintAndTable | ( | HWND | hWndParent,
 |  | DBCONSTRAINTDESC * | pConsDesc,
 |  | WCHAR ** | ppwszTableName
 | ) |  |

Definition at line 5402 of file cdialog.cpp.

{
  m_pConsDesc     = pConsDesc;
  m_ppwszTableName  = ppwszTableName;

  //Now Display the dialog
  if(DoModal(hWndParent) == IDOK)
    return S_OK;

  return DB_E_CANCELED;
} //CConstraintDlg::SetConstraintAndTable

Member Data Documentation

CComboBoxLite CConstraintDlg::m_comboConstraintType

Definition at line 691 of file cdialog.h.

CComboBoxLite CConstraintDlg::m_comboDeleteRule

Definition at line 697 of file cdialog.h.

CComboBoxLite CConstraintDlg::m_comboMatchType

Definition at line 695 of file cdialog.h.

CComboBoxLite CConstraintDlg::m_comboUpdateRule

Definition at line 696 of file cdialog.h.

CEditBoxLite CConstraintDlg::m_editBaseTableName

Definition at line 700 of file cdialog.h.

CEditBoxLite CConstraintDlg::m_editColumnName

Definition at line 703 of file cdialog.h.

CEditBoxLite CConstraintDlg::m_editConstraintName

Definition at line 699 of file cdialog.h.

CEditBoxLite CConstraintDlg::m_editConstraintText

Definition at line 702 of file cdialog.h.

CEditBoxLite CConstraintDlg::m_editFKColumnName

Definition at line 704 of file cdialog.h.

CEditBoxLite CConstraintDlg::m_editReferencedTableName

Definition at line 701 of file cdialog.h.

CListBoxLite CConstraintDlg::m_listColumnList

Definition at line 693 of file cdialog.h.

CListBoxLite CConstraintDlg::m_listDeferrability

Definition at line 692 of file cdialog.h.

CListBoxLite CConstraintDlg::m_listFKColumnList

Definition at line 694 of file cdialog.h.

DBCONSTRAINTDESC* CConstraintDlg::m_pConsDesc

Definition at line 687 of file cdialog.h.

WCHAR** CConstraintDlg::m_ppwszTableName

Definition at line 688 of file cdialog.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialog.h
  • Dataaccess/oledb/rowsetviewer/cdialog.cpp
Generated on Wed Nov 13 2024 16:55:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CConsumer Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CConsumer Class Reference

#include "Consumer.h"

List of all members.

Public Member Functions

CConsumer (CListBox *pOutputList)
CConsumer (CListBox *pOutputList)
~CConsumer ()
~CConsumer ()
STDMETHOD() | IndicateToConsumer (IWbemClassObject *pLogicalConsumer, long lNumObjects, IWbemClassObject **ppObjects)
STDMETHOD() | IndicateToConsumer (IWbemClassObject *pLogicalConsumer, long lNumObjects, IWbemClassObject **ppObjects)
STDMETHODIMP | QueryInterface (REFIID, LPVOID *)
STDMETHODIMP | QueryInterface (REFIID, LPVOID *)
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP_ (ULONG) Release(void)

Private Member Functions

LPCTSTR | ErrorString (HRESULT hRes)
LPCTSTR | ErrorString (HRESULT hRes)
LPWSTR | ValueToString (VARIANT *pValue, WCHAR **pbuf)

Private Attributes

DWORD m_cRef
CListBox * | m_pOutputList

Detailed Description

Definition at line 17 of file Consumer.h.

Constructor & Destructor Documentation

CConsumer::CConsumer ( CListBox * pOutputList )

Definition at line 19 of file Consumer.Cpp.

{
  m_cRef = 0L;
  m_pOutputList = pOutputList;
}

CConsumer::~CConsumer ( )

Definition at line 25 of file Consumer.Cpp.

{
}

CConsumer::CConsumer ( CListBox * pOutputList )
CConsumer::~CConsumer ( )

Member Function Documentation

LPCTSTR CConsumer::ErrorString ( HRESULT hRes ) [private]

Definition at line 211 of file Consumer.Cpp.

{
    TCHAR szBuffer2[19];
  static TCHAR szBuffer[24];
  LPCTSTR psz;

  switch(hRes)
    {
    case WBEM_NO_ERROR:
    psz = _T("WBEM_NO_ERROR");
    break;
    case WBEM_S_FALSE:
    psz = _T("WBEM_S_FALSE");
    break;
    case WBEM_S_NO_MORE_DATA:
    psz = _T("WBEM_S_NO_MORE_DATA");
    break;
  case WBEM_E_FAILED:
    psz = _T("WBEM_E_FAILED");
    break;
  case WBEM_E_NOT_FOUND:
    psz = _T("WBEM_E_NOT_FOUND");
    break;
  case WBEM_E_ACCESS_DENIED:
    psz = _T("WBEM_E_ACCESS_DENIED");
    break;
  case WBEM_E_PROVIDER_FAILURE:
    psz = _T("WBEM_E_PROVIDER_FAILURE");
    break;
  case WBEM_E_TYPE_MISMATCH:
    psz = _T("WBEM_E_TYPE_MISMATCH");
    break;
  case WBEM_E_OUT_OF_MEMORY:
    psz = _T("WBEM_E_OUT_OF_MEMORY");
    break;
  case WBEM_E_INVALID_CONTEXT:
    psz = _T("WBEM_E_INVALID_CONTEXT");
    break;
  case WBEM_E_INVALID_PARAMETER:
    psz = _T("WBEM_E_INVALID_PARAMETER");
    break;
  case WBEM_E_NOT_AVAILABLE:
    psz = _T("WBEM_E_NOT_AVAILABLE");
    break;
  case WBEM_E_CRITICAL_ERROR:
    psz = _T("WBEM_E_CRITICAL_ERROR");
    break;
  case WBEM_E_INVALID_STREAM:
    psz = _T("WBEM_E_INVALID_STREAM");
    break;
  case WBEM_E_NOT_SUPPORTED:
    psz = _T("WBEM_E_NOT_SUPPORTED");
    break;
  case WBEM_E_INVALID_SUPERCLASS:
    psz = _T("WBEM_E_INVALID_SUPERCLASS");
    break;
  case WBEM_E_INVALID_NAMESPACE:
    psz = _T("WBEM_E_INVALID_NAMESPACE");
    break;
  case WBEM_E_INVALID_OBJECT:
    psz = _T("WBEM_E_INVALID_OBJECT");
    break;
  case WBEM_E_INVALID_CLASS:
    psz = _T("WBEM_E_INVALID_CLASS");
    break;
  case WBEM_E_PROVIDER_NOT_FOUND:
    psz = _T("WBEM_E_PROVIDER_NOT_FOUND");
    break;
  case WBEM_E_INVALID_PROVIDER_REGISTRATION:
    psz = _T("WBEM_E_INVALID_PROVIDER_REGISTRATION");
    break;
  case WBEM_E_PROVIDER_LOAD_FAILURE:
    psz = _T("WBEM_E_PROVIDER_LOAD_FAILURE");
    break;
  case WBEM_E_INITIALIZATION_FAILURE:
    psz = _T("WBEM_E_INITIALIZATION_FAILURE");
    break;
  case WBEM_E_TRANSPORT_FAILURE:
    psz = _T("WBEM_E_TRANSPORT_FAILURE");
    break;
  case WBEM_E_INVALID_OPERATION:
    psz = _T("WBEM_E_INVALID_OPERATION");
    break;
  case WBEM_E_INVALID_QUERY:
    psz = _T("WBEM_E_INVALID_QUERY");
    break;
  case WBEM_E_INVALID_QUERY_TYPE:
    psz = _T("WBEM_E_INVALID_QUERY_TYPE");
    break;
  case WBEM_E_ALREADY_EXISTS:
    psz = _T("WBEM_E_ALREADY_EXISTS");
    break;
    case WBEM_S_ALREADY_EXISTS:
        psz = _T("WBEM_S_ALREADY_EXISTS");
        break;
    case WBEM_S_RESET_TO_DEFAULT:
        psz = _T("WBEM_S_RESET_TO_DEFAULT");
        break;
    case WBEM_S_DIFFERENT:
        psz = _T("WBEM_S_DIFFERENT");
        break;
    case WBEM_E_OVERRIDE_NOT_ALLOWED:
        psz = _T("WBEM_E_OVERRIDE_NOT_ALLOWED");
        break;
    case WBEM_E_PROPAGATED_QUALIFIER:
        psz = _T("WBEM_E_PROPAGATED_QUALIFIER");
        break;
    case WBEM_E_PROPAGATED_PROPERTY:
        psz = _T("WBEM_E_PROPAGATED_PROPERTY");
        break;
    case WBEM_E_UNEXPECTED:
        psz = _T("WBEM_E_UNEXPECTED");
        break;
    case WBEM_E_ILLEGAL_OPERATION:
        psz = _T("WBEM_E_ILLEGAL_OPERATION");
        break;
    case WBEM_E_CANNOT_BE_KEY:
        psz = _T("WBEM_E_CANNOT_BE_KEY");
        break;
    case WBEM_E_INCOMPLETE_CLASS:
        psz = _T("WBEM_E_INCOMPLETE_CLASS");
        break;
    case WBEM_E_INVALID_SYNTAX:
        psz = _T("WBEM_E_INVALID_SYNTAX");
        break;
    case WBEM_E_NONDECORATED_OBJECT:
        psz = _T("WBEM_E_NONDECORATED_OBJECT");
        break;
    case WBEM_E_READ_ONLY:
        psz = _T("WBEM_E_READ_ONLY");
        break;
    case WBEM_E_PROVIDER_NOT_CAPABLE:
        psz = _T("WBEM_E_PROVIDER_NOT_CAPABLE");
        break;
    case WBEM_E_CLASS_HAS_CHILDREN:
        psz = _T("WBEM_E_CLASS_HAS_CHILDREN");
        break;
    case WBEM_E_CLASS_HAS_INSTANCES:
        psz = _T("WBEM_E_CLASS_HAS_INSTANCES");
        break;
    case WBEM_E_QUERY_NOT_IMPLEMENTED:
        psz = _T("WBEM_E_QUERY_NOT_IMPLEMENTED");
        break;
    case WBEM_E_ILLEGAL_NULL:
        psz = _T("WBEM_E_ILLEGAL_NULL");
        break;
    case WBEM_E_INVALID_QUALIFIER_TYPE:
        psz = _T("WBEM_E_INVALID_QUALIFIER_TYPE");
        break;
    case WBEM_E_INVALID_PROPERTY_TYPE:
        psz = _T("WBEM_E_INVALID_PROPERTY_TYPE");
        break;
    case WBEM_E_VALUE_OUT_OF_RANGE:
        psz = _T("WBEM_E_VALUE_OUT_OF_RANGE");
        break;
    case WBEM_E_CANNOT_BE_SINGLETON:
        psz = _T("WBEM_E_CANNOT_BE_SINGLETON");
        break;
  default:
    _itot(hRes, szBuffer2, 16);
    StringCbCopy(szBuffer, sizeof(szBuffer),_T("0x"));
      StringCbCat(szBuffer, sizeof(szBuffer), szBuffer2);
    psz = szBuffer;
  }
  return psz;
}

LPCTSTR CConsumer::ErrorString ( HRESULT hRes ) [private]
STDMETHOD() CConsumer::IndicateToConsumer | ( | IWbemClassObject * | pLogicalConsumer,
 |  | long | lNumObjects,
 |  | IWbemClassObject ** | ppObjects
 | ) |  |
STDMETHODIMP CConsumer::IndicateToConsumer | ( | IWbemClassObject * | pLogicalConsumer,
 |  | long | lNumObjects,
 |  | IWbemClassObject ** | ppObjects
 | ) |  |

Definition at line 59 of file Consumer.Cpp.

{
/* for easy reference.
#define SW_HIDE             0
#define SW_SHOWNORMAL       1
#define SW_NORMAL           1
#define SW_SHOWMINIMIZED    2
#define SW_SHOWMAXIMIZED    3
#define SW_MAXIMIZE         3
#define SW_SHOWNOACTIVATE   4
#define SW_SHOW             5
#define SW_MINIMIZE         6
#define SW_SHOWMINNOACTIVE  7
#define SW_SHOWNA           8
#define SW_RESTORE          9
#define SW_SHOWDEFAULT      10
*/

  // NOTE: If this routine returns a failure code, including
  // GPFs from called routines, CIMOM will recreate the object
  // and call here again. If you see this routine being called
  // twice for every indication, it means this routine is
  // returning a failure code somehow. Especially watch the
  // AddRef()/Release() semantics for the embedded object.
  // If they're too low, you'll return a GPF.
  CString clMyBuff;
  BSTR tgtProp = NULL;
  BSTR showProp = NULL;
  BSTR tgt = NULL;
  UINT showWindow = SW_SHOWNORMAL;
  VARIANT pVal, pVal1;
  CString appName;

  VariantInit(&pVal);
  VariantInit(&pVal1);

  TRACE(_T("Indicate() called\n"));

  tgtProp = SysAllocString(L"cmdLine");
  if (!tgtProp)
        return E_OUTOFMEMORY;

  showProp = SysAllocString(L"ShowWindow");
  if (!showProp)
        return E_OUTOFMEMORY;

  // clear my output buffer.
  clMyBuff.Empty();

  //--------------------------------
  // NOTICE that I only call once per call, not once per object passed since
  //  I dont care what object caused the event anyway.

  // get the 'Item' property out of the embedded object.
  if((pLogicalConsumer->Get(tgtProp, 0L, &pVal, NULL, NULL) == S_OK) &&
    (pLogicalConsumer->Get(showProp, 0L, &pVal1, NULL, NULL) == S_OK))
  {
    // pull out the command.
    tgt = V_BSTR(&pVal);

    //if the application name does not contain any slashes,
    //assume it is in the System directory
    if (appName.Find('\\') < 0 &&
      appName.Find('/') < 0)
    {
      TCHAR tchSystemInfo[MAX_PATH + 1];
            if (GetSystemDirectory(tchSystemInfo, MAX_PATH+1)!= 0)
      {
        appName += tchSystemInfo;
        appName += _T("\\");
        appName += tgt;
      }
    }
    else  //full path must have been specified, pass it on to CreateProcess
    {
      appName += tgt;
    }

    // take onto the display line.
    clMyBuff = _T("cmdLine will run: ");
    clMyBuff += appName;

    // how to run the program.
    showWindow = (UINT)V_UI1(&pVal1);

    // call CreateProcess
    STARTUPINFO si;
    memset(&si, 0, sizeof(si));
    si.cb          = sizeof(si);
    si.dwFlags     = STARTF_USESHOWWINDOW;
    si.wShowWindow = (unsigned short)showWindow;

    PROCESS_INFORMATION pi;
    memset(&pi, 0, sizeof(pi));
    if (!CreateProcess(appName, NULL, NULL, NULL, FALSE,
              0, NULL, NULL, &si, &pi))
    {
      DWORD lastErr = GetLastError();
      TCHAR msg[100];
      _itot(lastErr, msg, 10);
      CString errMsg = _T("CreateProcess failed. Error ");
      errMsg +=(LPCTSTR)&msg[0];

      m_pOutputList->AddString(errMsg);
    }
    else
    {
      // output the buffer.
      m_pOutputList->AddString(clMyBuff);

      //IMPORTANT: remember to close handles after the spawned process
      //has signalled its completion:

      //CloseHandle(pi.hProcess);
            //CloseHandle(pi.hThread);
    }
  }
  else
  {
    TRACE(_T("Get() cmdLine failed\n"));
  }

  SysFreeString(tgtProp);
  VariantClear(&pVal);

  TRACE(_T("walked indication list\n"));

  return S_OK;
}

STDMETHODIMP CConsumer::QueryInterface | ( | REFIID | ,
 |  | LPVOID * |
 | ) |  |
STDMETHODIMP CConsumer::QueryInterface | ( | REFIID | ,
 |  | LPVOID * |
 | ) |  |
CConsumer::STDMETHODIMP_ ( ULONG )
CConsumer::STDMETHODIMP_ ( ULONG )
CConsumer::STDMETHODIMP_ ( ULONG )
CConsumer::STDMETHODIMP_ ( ULONG )
LPWSTR CConsumer::ValueToString | ( | VARIANT * | pValue,
 |  | WCHAR ** | pbuf |
 | ) |  |  | [private]

Definition at line 382 of file Consumer.Cpp.

{
   DWORD iNeed = 0;
   DWORD iVSize = 0;
   DWORD iCurBufSize = 0;

   WCHAR *vbuf = NULL;
   WCHAR *buf = NULL;

   switch (pValue->vt)
   {
   case VT_NULL:
         buf = (WCHAR *)malloc(BLOCKSIZE);
     if (buf)
      StringCbCopyW(buf, BLOCKSIZE, L"<null>");
         break;

   case VT_BOOL: {
         VARIANT_BOOL b = pValue->boolVal;
         buf = (WCHAR *)malloc(BLOCKSIZE);
     if (buf)
     {
      if (!b) {
        StringCbCopyW(buf, BLOCKSIZE, L"FALSE");

      } else {
        StringCbCopyW(buf, BLOCKSIZE, L"TRUE");
      }
    }
         break;
      }

   case VT_UI1: {
      unsigned char b = pValue->bVal;
        buf = (WCHAR *)malloc(BLOCKSIZE);
        if (buf)
        {
            if (b >= 32)
            {
                StringCbPrintfW(buf, BLOCKSIZE, L"'%c' (%hu, 0x%hX)", b, (unsigned char)b, b);
            }
            else
            {
                StringCbPrintfW(buf, BLOCKSIZE, L"%hu (0x%hX)", (unsigned char)b, b);
            }
        }
        break;
  }
   case VT_I2:  {
        USHORT i = pValue->uiVal;
        buf = (WCHAR *)malloc(BLOCKSIZE);
        if (buf)
        {
            StringCbPrintfW(buf, BLOCKSIZE, L"%hu (0x%hX)", i, i);
        }
        break;
    }

   case VT_I4: {
         LONG l = pValue->lVal;
        buf = (WCHAR *)malloc(BLOCKSIZE);
        if (buf)
        {
            StringCbPrintfW(buf, BLOCKSIZE, L"%d (0x%X)", l, l);
        }
        break;
      }

   case VT_R4: {
        float f = pValue->fltVal;
        buf = (WCHAR *)malloc(CVTBUFSIZE * sizeof(WCHAR));
        if (buf)
        {
            StringCbPrintfW(buf, BLOCKSIZE,  L"%10.4f", f);
        }
        break;
      }

   case VT_R8: {
    double d = pValue->dblVal;
        buf = (WCHAR *)malloc(CVTBUFSIZE * sizeof(WCHAR));
        if (buf)
        {
            StringCbPrintfW(buf, BLOCKSIZE, L"%10.4f", d);
        }
        break;
    }

   case VT_BSTR: {
     LPWSTR pWStr = pValue->bstrVal;
     int bufSize = (wcslen(pWStr) * sizeof(WCHAR)) + sizeof(WCHAR) + (2 * sizeof(WCHAR));
     buf = (WCHAR *)malloc(bufSize);
     if (buf)
      StringCbPrintfW(buf, bufSize, L"\"%wS\"", pWStr);
     break;
    }

  // the sample GUI is too simple to make it necessary to display
  // these 'complicated' types--so ignore them.
   case VT_DISPATCH:  // Currently only used for embedded objects
   case VT_BOOL|VT_ARRAY:
   case VT_UI1|VT_ARRAY:
   case VT_I2|VT_ARRAY:
   case VT_I4|VT_ARRAY:
   case VT_R4|VT_ARRAY:
   case VT_R8|VT_ARRAY:
   case VT_BSTR|VT_ARRAY:
   case VT_DISPATCH | VT_ARRAY:
         break;

   default:
         buf = (WCHAR *)malloc(BLOCKSIZE);
     if (buf)
      StringCbCopyW(buf, BLOCKSIZE, L"<conversion error>");
   }

   *pbuf = buf;
   return buf;
}

Member Data Documentation

DWORD CConsumer::m_cRef [private]

Definition at line 35 of file Consumer.h.

CListBox * CConsumer::m_pOutputList [private]

Definition at line 37 of file Consumer.h.

The documentation for this class was generated from the following files:
  • SysMgmt/WMI/VC/CmdLineConsumer/Consumer.h
  • SysMgmt/WMI/VC/EventConsumer/Consumer.h
  • SysMgmt/WMI/VC/CmdLineConsumer/Consumer.Cpp
  • SysMgmt/WMI/VC/EventConsumer/Consumer.Cpp
Generated on Wed Nov 13 2024 16:55:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CContainerBase Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CContainerBase Class Reference

#include "cbase.h"

Inherits CBase.

Inherited by CAsynchBase, CRowPosition, and CTransaction.

List of all members.

Public Member Functions

CContainerBase (SOURCE eObjectType, CMainWindow *pCMainWindow, CMDIChild *pCMDIChild=NULL)
virtual | ~CContainerBase ()
virtual HRESULT | AdviseListener (REFIID riid, DWORD *pdwCookie)
virtual HRESULT | AutoQI (DWORD dwCreateOpts)
virtual HRESULT | AutoRelease ()
virtual HRESULT | FindConnectionPoint (REFIID riid, IConnectionPoint **ppIConnectionPoint)
virtual IUnknown ** | GetInterfaceAddress (REFIID riid)
virtual HRESULT | UnadviseListener (REFIID riid, DWORD *pdwCookie)

Public Attributes

IConnectionPointContainer * | m_pIConnectionPointContainer

Detailed Description

Definition at line 233 of file cbase.h.

Constructor & Destructor Documentation

CContainerBase::CContainerBase | ( | SOURCE | eObjectType,
 |  | CMainWindow * | pCMainWindow,
 |  | CMDIChild * | pCMDIChild = NULL
 | ) |  |

Definition at line 695 of file cbase.cpp.

  : CBase(eObjectType, pCMainWindow, pCMDIChild)
{
  //eBaseClass
  m_eBaseClass =  BASE_CLASS(m_eBaseClass | eCContainerBase);

  //Common OLE DB Interfaces
  m_pIConnectionPointContainer  = NULL;
}

CContainerBase::~CContainerBase ( ) [virtual]

Definition at line 710 of file cbase.cpp.

{
  ReleaseObject(0);
}

Member Function Documentation

HRESULT CContainerBase::AdviseListener | ( | REFIID | riid,
 |  | DWORD * | pdwCookie |
 | ) |  |  | [virtual]

Definition at line 791 of file cbase.cpp.

{
  HRESULT hr = S_OK;

  if(m_pIConnectionPointContainer)
  {
    if(riid == IID_IDBAsynchNotify)
    {
      if(GetOptions()->m_dwNotifyOpts & NOTIFY_IDBASYNCHNOTIFY)
        hr = m_pCMainWindow->m_pCListener->Advise(this, riid, pdwCookie);
    }
    else if(riid == IID_IRowsetNotify)
    {
      if(GetOptions()->m_dwNotifyOpts & NOTIFY_IROWSETNOTIFY)
        hr = m_pCMainWindow->m_pCListener->Advise(this, riid, pdwCookie);
    }
    else if(riid == IID_IRowPositionChange)
    {
      if(GetOptions()->m_dwNotifyOpts & NOTIFY_IROWPOSITIONCHANGE)
        hr = m_pCMainWindow->m_pCListener->Advise(this, riid, pdwCookie);
    }
    else
    {
      ASSERT(!"Unhandled Notification Type!");
    }
  }

  return hr;
}

HRESULT CContainerBase::AutoQI ( DWORD dwCreateOpts ) [virtual]

Implements CBase.

Reimplemented in CAsynchBase, CPropertiesBase, CCommand, CDataset, CDataSource, CEnumerator, CRow, CRowPosition, CDataAccess, CRowset, CSession, CStream, and CTransaction.

Definition at line 734 of file cbase.cpp.

{
  //Delegate First so we have base interfaces
  CBase::AutoQI(dwCreateOpts);

  //[MANDATORY] Obtain [mandatory] interfaces
  if(dwCreateOpts & CREATE_QI_MANDATORY)
  {
  }

  //[OPTIONAL]
  if(dwCreateOpts & CREATE_QI_OPTIONAL)
  {
    OBTAIN_INTERFACE(IConnectionPointContainer);
  }

  return S_OK;
}

HRESULT CContainerBase::AutoRelease ( ) [virtual]

Implements CBase.

Reimplemented in CAsynchBase, CPropertiesBase, CCommand, CDataset, CDataSource, CEnumerator, CRow, CRowPosition, CDataAccess, CRowset, CSession, CStream, and CTransaction.

Definition at line 720 of file cbase.cpp.

{
  //Common OLE DB Interface
  RELEASE_INTERFACE(IConnectionPointContainer);

  //Delegate
  return CBase::AutoRelease();
}

HRESULT CContainerBase::FindConnectionPoint | ( | REFIID | riid,
 |  | IConnectionPoint ** | ppIConnectionPoint |
 | ) |  |  | [virtual]

Definition at line 771 of file cbase.cpp.

{
  HRESULT hr = S_OK;

  if(m_pIConnectionPointContainer)
  {
    //IConnectionPointContainer::FindConnectionPoint
    hr = m_pIConnectionPointContainer->FindConnectionPoint(riid, ppIConnectionPoint);
    TESTC(TRACE_METHOD(hr, L"IConnectionPointContainer::FindConnectionPoint(%s, &0x%p)", GetInterfaceName(riid), ppIConnectionPoint ? *ppIConnectionPoint : NULL));
  }

CLEANUP:
  return hr;
}

IUnknown ** CContainerBase::GetInterfaceAddress ( REFIID riid ) [virtual]

Implements CBase.

Reimplemented in CAsynchBase, CPropertiesBase, CCommand, CDataset, CDataSource, CEnumerator, CRow, CRowPosition, CDataAccess, CRowset, CSession, CStream, and CTransaction.

Definition at line 758 of file cbase.cpp.

{
  HANDLE_GETINTERFACE(IConnectionPointContainer);

  //Otherwise delegate
  return CBase::GetInterfaceAddress(riid);
}

HRESULT CContainerBase::UnadviseListener | ( | REFIID | riid,
 |  | DWORD * | pdwCookie |
 | ) |  |  | [virtual]

Definition at line 826 of file cbase.cpp.

{
  ASSERT(pdwCookie);
  HRESULT hr = S_OK;

  if(m_pIConnectionPointContainer)
  {
    if(*pdwCookie)
      hr = m_pCMainWindow->m_pCListener->Unadvise(this, riid, pdwCookie);
  }

  return hr;
}

Member Data Documentation

IConnectionPointContainer* CContainerBase::m_pIConnectionPointContainer

Definition at line 254 of file cbase.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cbase.h
  • Dataaccess/oledb/rowsetviewer/cbase.cpp
Generated on Wed Nov 13 2024 16:55:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CContext Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes

CContext Class Reference

#include "Context.h"

List of all members.

Public Types

enum {
get_Server = 0x0001, get_Response = 0x0002, get_Request = 0x0004, get_Session = 0x0008,
get_Application = 0x0010, get_All = 0xFFFF
}

Public Member Functions

IApplicationObject * | Application ()
HRESULT | Init (DWORD)
IRequest * | Request ()
IResponse * | Response ()
IServer * | Server ()
ISessionObject * | Session ()

Static Public Member Functions

static HRESULT | GetServerObject (IGetContextProperties *, BSTR, const IID &, void **)

Private Attributes

CComPtr< IApplicationObject > | m_piApplication
CComPtr< IRequest > | m_piRequest
CComPtr< IResponse > | m_piResponse
CComPtr< IServer > | m_piServer
CComPtr< ISessionObject > | m_piSession

Detailed Description

Definition at line 27 of file Context.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
get_Server
get_Response
get_Request
get_Session
get_Application
get_All

Definition at line 30 of file Context.h.

       {
    get_Server    = 0x0001,
    get_Response  = 0x0002,
    get_Request   = 0x0004,
    get_Session   = 0x0008,
    get_Application = 0x0010,
        get_All         = 0xFFFF
  };

Member Function Documentation

IApplicationObject* CContext::Application ( ) [inline]

Definition at line 45 of file Context.h.

{ _ASSERT(m_piApplication!=NULL); return m_piApplication; }

HRESULT CContext::GetServerObject | ( | IGetContextProperties * | pProps,
 |  | BSTR | bstrObjName,
 |  | const IID & | iid,
 |  | void ** | ppObj |
 | ) |  |  | [static]

Definition at line 30 of file Context.Cpp.

{
  HRESULT rc = E_FAIL;
  _ASSERT( pProps );
  _ASSERT( bstrObjName );
  _ASSERT( ppObj );
  if ( pProps && bstrObjName && ppObj )
  {
    *ppObj = NULL;
    CComVariant vt;
    if ( !FAILED( pProps->GetProperty( bstrObjName, &vt ) ) )
    {
      if ( V_VT(&vt) == VT_DISPATCH )
      {
        IDispatch* pDispatch = V_DISPATCH(&vt);
        if ( pDispatch )
        {
          rc = pDispatch->QueryInterface( iid, ppObj );
        }
      }
    }
  }
  return rc;
}

HRESULT CContext::Init ( DWORD dwFlags )

Definition at line 62 of file Context.Cpp.

{
  HRESULT rc = E_FAIL;
  CComPtr<IObjectContext> pObjContext;

  rc = ::GetObjectContext( &pObjContext );
  if ( !FAILED( rc ) )
  {
    CComPtr<IGetContextProperties> pProps;
    rc = pObjContext->QueryInterface( IID_IGetContextProperties, (void**)&pProps );
    if ( !FAILED( rc ) )
    {
      CComBSTR bstrObj;
      if ( dwFlags & get_Request )
      {
        bstrObj = "Request";
        rc = GetServerObject( pProps, bstrObj, IID_IRequest, (void**)&m_piRequest );
      }
      if ( !FAILED(rc) && ( dwFlags & get_Response ) )
      {
        bstrObj = "Response";
        rc = GetServerObject( pProps, bstrObj, IID_IResponse, (void**)&m_piResponse );
      }

      if ( !FAILED(rc) && ( dwFlags & get_Session ) )
      {
        bstrObj = "Session";
        rc = GetServerObject( pProps, bstrObj, IID_ISessionObject, (void**)&m_piSession );
      }

      if ( !FAILED(rc) && ( dwFlags & get_Server ) )
      {
        bstrObj = "Server";
        rc = GetServerObject( pProps, bstrObj, IID_IServer, (void**)&m_piServer );
      }

      if ( !FAILED(rc) && ( dwFlags & get_Application ) )
      {
        bstrObj = "Application";
        rc = GetServerObject( pProps, bstrObj, IID_IApplicationObject, (void**)&m_piApplication );
      }
    }
  }
  return rc;
}

IRequest* CContext::Request ( ) [inline]

Definition at line 41 of file Context.h.

{ _ASSERT(m_piRequest!=NULL); return m_piRequest; }

IResponse* CContext::Response ( ) [inline]

Definition at line 42 of file Context.h.

{ _ASSERT(m_piResponse!=NULL); return m_piResponse; }

IServer* CContext::Server ( ) [inline]

Definition at line 44 of file Context.h.

{ _ASSERT(m_piServer!=NULL); return m_piServer; }

ISessionObject* CContext::Session ( ) [inline]

Definition at line 43 of file Context.h.

{ _ASSERT(m_piSession!=NULL); return m_piSession; }

Member Data Documentation

CComPtr<IApplicationObject> CContext::m_piApplication [private]

Definition at line 54 of file Context.h.

CComPtr<IRequest> CContext::m_piRequest [private]

Definition at line 50 of file Context.h.

CComPtr<IResponse> CContext::m_piResponse [private]

Definition at line 51 of file Context.h.

CComPtr<IServer> CContext::m_piServer [private]

Definition at line 53 of file Context.h.

CComPtr<ISessionObject> CContext::m_piSession [private]

Definition at line 52 of file Context.h.

The documentation for this class was generated from the following files:
  • Web/iis/Components/Cpp/Intermediate/Context.h
  • Web/iis/Components/Cpp/Intermediate/Context.Cpp
Generated on Wed Nov 13 2024 16:55:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CContextAdmin Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CContextAdmin Class Reference

#include "ContextAdmin.h"

List of all members.

Public Member Functions

CContextAdmin ()
STDMETHOD() | get_ContextTypes (WMS_CONTEXT_PLUGIN_CONTEXT_TYPE *pwmsContextTypes)
STDMETHOD() | get_OutputPath (BSTR *pbstrOutputPath)
STDMETHOD() | Initialize (CContextPlugin *pPlugin)
STDMETHOD() | InterfaceSupportsErrorInfo (REFIID riid)
STDMETHOD() | put_ContextTypes (WMS_CONTEXT_PLUGIN_CONTEXT_TYPE wmsContextTypes)
STDMETHOD() | put_OutputPath (BSTR bstrOutputPath)

Private Attributes

CContextPlugin * m_pContextPlugin

Detailed Description

Definition at line 18 of file ContextAdmin.h.

Constructor & Destructor Documentation

CContextAdmin::CContextAdmin ( ) [inline]

Definition at line 24 of file ContextAdmin.h.

    {
        m_pContextPlugin = NULL;
    }

Member Function Documentation

STDMETHODIMP CContextAdmin::get_ContextTypes ( WMS_CONTEXT_PLUGIN_CONTEXT_TYPE * pwmsContextTypes )

Definition at line 94 of file ContextAdmin.cpp.

{
    HRESULT hr = S_OK;
    if( NULL == m_pContextPlugin )
    {
        return( E_UNEXPECTED );
    }

    // The parameters should be validated in GetContextTypes
    hr = m_pContextPlugin->GetContextTypes( pwmsContextTypes );

    return( hr );
}

STDMETHODIMP CContextAdmin::get_OutputPath ( BSTR * pbstrOutputPath )

Definition at line 64 of file ContextAdmin.cpp.

{
    HRESULT hr = S_OK;
    if( NULL == m_pContextPlugin )
    {
        return( E_UNEXPECTED );
    }

    // The parameters should be validated in GetOutputPath
    hr = m_pContextPlugin->GetOutputPath( pbstrOutputPath );

    return( hr );
}

STDMETHODIMP CContextAdmin::Initialize ( CContextPlugin * pPlugin )

Definition at line 35 of file ContextAdmin.cpp.

{
    HRESULT hr = S_OK;

    if( NULL == pPlugin )
    {
        return E_INVALIDARG;
    }

    m_pContextPlugin = pPlugin;

    return( hr );
}

STDMETHODIMP CContextAdmin::InterfaceSupportsErrorInfo ( REFIID riid )

Definition at line 18 of file ContextAdmin.cpp.

{
    static const IID* arr[] =
    {
        &IID_IWMSContextAdmin
    };
    for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++)
    {
        if ( IsEqualGUID( *arr[ i ], riid ) )
        {
            return S_OK;
        }
    }

    return( S_FALSE );
}

STDMETHODIMP CContextAdmin::put_ContextTypes ( WMS_CONTEXT_PLUGIN_CONTEXT_TYPE wmsContextTypes )

Definition at line 79 of file ContextAdmin.cpp.

{
    HRESULT hr = S_OK;
    if( NULL == m_pContextPlugin )
    {
        return( E_UNEXPECTED );
    }

    // The parameters should be validated in SetContextTypes
    hr = m_pContextPlugin->SetContextTypes( wmsContextTypes );

    return( hr );
}

STDMETHODIMP CContextAdmin::put_OutputPath ( BSTR bstrOutputPath )

Definition at line 49 of file ContextAdmin.cpp.

{
    HRESULT hr = S_OK;
    if( NULL == m_pContextPlugin )
    {
        return( E_UNEXPECTED );
    }

    // The parameters should be validated in SetOutputPath
    hr = m_pContextPlugin->SetOutputPath( bstrOutputPath );

    return( hr );
}

Member Data Documentation

CContextPlugin* CContextAdmin::m_pContextPlugin [private]

Definition at line 50 of file ContextAdmin.h.

The documentation for this class was generated from the following files:
  • Multimedia/WindowsMediaServices9/EventNotification/ContextAdmin.h
  • Multimedia/WindowsMediaServices9/EventNotification/ContextAdmin.cpp
Generated on Wed Nov 13 2024 16:55:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CContextMenu Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CContextMenu Class Reference

#include "dsmenu.h"

List of all members.

Public Member Functions

CContextMenu ()
CContextMenu (CShellFolder *psfParent, LPCITEMIDLIST *aPidls=NULL, UINT uItemCount=0)
~CContextMenu ()
~CContextMenu ()
STDMETHODIMP | GetCommandString (UINT_PTR idCmd, UINT uFlags, UINT FAR *reserved, LPSTR pszName, UINT ccMax)
STDMETHODIMP | GetCommandString (UINT_PTR, UINT, LPUINT, LPSTR, UINT)
STDMETHODIMP | Initialize (LPCITEMIDLIST pIDFolder, LPDATAOBJECT pDataObj, HKEY hKeyID)
STDMETHODIMP | InvokeCommand (LPCMINVOKECOMMANDINFO)
STDMETHODIMP | InvokeCommand (LPCMINVOKECOMMANDINFO lpcmi)
STDMETHODIMP | QueryContextMenu (HMENU hShellMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags)
STDMETHODIMP | QueryContextMenu (HMENU, UINT, UINT, UINT, UINT)
STDMETHODIMP | QueryInterface (REFIID, LPVOID FAR *)
void | ShowClipformatInfo ()
STDMETHODIMP_ (DWORD) AddRef()
STDMETHODIMP_ (DWORD) Release()

Private Member Functions

LPITEMIDLIST * | AllocPidlTable (DWORD)
BOOL | DoCopyOrCut (HWND, BOOL)
STDMETHODIMP | DoDelete (VOID)
BOOL | DoExplore (HWND)
BOOL | DoModifyData (HWND)
STDMETHODIMP | DoNewFolder (HWND)
STDMETHODIMP | DoNewItem (HWND)
BOOL | DoOpen (HWND)
BOOL | DoPaste (VOID)
VOID | DoRename (HWND)
BOOL | FillPidlTable (LPCITEMIDLIST *, UINT)
VOID | FreePidlTable (LPITEMIDLIST *)
UINT | InsertBackgroundItems (HMENU, UINT, UINT)
UINT | InsertItems (HMENU, UINT, UINT, UINT)

Private Attributes

LPITEMIDLIST * | m_aPidls
UINT m_cfPrivateData
BOOL m_fBackground
DWORD m_ObjRefCount
IMalloc * | m_pMalloc
CPidlMgr * m_pPidlMgr
CShellFolder * m_psfParent
CComPtr< IDataObject > | m_spDataObj
UINT m_uItemCount

Detailed Description

Definition at line 14 of file dsmenu.h.

Constructor & Destructor Documentation

CContextMenu::CContextMenu ( )

Definition at line 29 of file dsmenu.cpp.

{
  ATLTRACE(_T("CContextMenu::CContextMenu()\n"));
}

CContextMenu::~CContextMenu ( )

Definition at line 34 of file dsmenu.cpp.

{
  ATLTRACE(_T("CContextMenu::~CContextMenu()\n"));
}

CContextMenu::CContextMenu | ( | CShellFolder * | psfParent,
 |  | LPCITEMIDLIST * | aPidls = NULL,
 |  | UINT | uItemCount = 0
 | ) |  |

Definition at line 57 of file ContMenu.Cpp.

{
g_DllRefCount++;

m_ObjRefCount = 1;
m_aPidls = NULL;
m_uItemCount = 0;
m_fBackground = FALSE;

m_psfParent = psfParent;
if(m_psfParent)
   m_psfParent->AddRef();

SHGetMalloc(&m_pMalloc);
if(!m_pMalloc)
   {
   delete this;
   return;
   }

m_pPidlMgr = new CPidlMgr();

m_uItemCount = uItemCount;

if(m_uItemCount)
   {
   m_aPidls = AllocPidlTable(uItemCount);
   if(m_aPidls)
      {
      FillPidlTable(aPidls, uItemCount);
      }
   }
else
   {
   m_fBackground = TRUE;
   }

m_cfPrivateData = RegisterClipboardFormat(CFSTR_SAMPVIEWDATA);

}

CContextMenu::~CContextMenu ( )

Member Function Documentation

LPITEMIDLIST * CContextMenu::AllocPidlTable ( DWORD dwEntries ) [private]

Definition at line 459 of file ContMenu.Cpp.

{
LPITEMIDLIST   *aPidls;

dwEntries++;

aPidls = (LPITEMIDLIST*)m_pMalloc->Alloc(dwEntries * sizeof(LPITEMIDLIST));

if(aPidls)
   {
   //set all of the entries to NULL
   ZeroMemory(aPidls, dwEntries * sizeof(LPITEMIDLIST));
   }

return aPidls;
}

BOOL CContextMenu::DoCopyOrCut | ( | HWND | hWnd,
 |  | BOOL | fCut |
 | ) |  |  | [private]

Definition at line 524 of file ContMenu.Cpp.

{
/*
Copy the data to the clipboard. If this is a cut operation, mark the
item as cut in the list. We will do this in the same way that the shell
does it for the file system where the source data actually gets deleted
when the paste operation occurs.
*/
BOOL  fSuccess = FALSE;

if(OpenClipboard(NULL))
   {
   if(EmptyClipboard())
      {
      HGLOBAL        hMem;
      LPITEMIDLIST   pidlParent;

      pidlParent = m_psfParent->CreateFQPidl(NULL);

      if(pidlParent)
         {
         hMem = CreatePrivateClipboardData(pidlParent, m_aPidls, m_uItemCount, fCut);

         if(SetClipboardData(m_cfPrivateData, hMem))
            {
            fSuccess = TRUE;

            if(fCut)
               {
               CShellView  *pView = (CShellView*)GetViewInterface(hWnd);

               if(pView)
                  {
                  pView->MarkItemsAsCut((LPCITEMIDLIST*)m_aPidls, m_uItemCount);
                  pView->Release();
                  }
               }
            }
         m_pPidlMgr->Delete(pidlParent);
         }
      }

   CloseClipboard();
   }

return fSuccess;
}

STDMETHODIMP CContextMenu::DoDelete ( VOID ) [private]

Definition at line 722 of file ContMenu.Cpp.

{
return m_psfParent->DeleteItems(m_aPidls, m_uItemCount);
}

BOOL CContextMenu::DoExplore ( HWND hWnd ) [private]

Definition at line 664 of file ContMenu.Cpp.

{
LPITEMIDLIST      pidlFQ;
SHELLEXECUTEINFO  sei;

pidlFQ = m_psfParent->CreateFQPidl(m_aPidls[0]);

ZeroMemory(&sei, sizeof(sei));
sei.cbSize = sizeof(sei);
sei.fMask = SEE_MASK_IDLIST | SEE_MASK_CLASSNAME;
sei.lpIDList = pidlFQ;
sei.lpClass = TEXT("folder");
sei.hwnd = hWnd;
sei.nShow = SW_SHOWNORMAL;
sei.lpVerb = TEXT("explore");

BOOL fReturn = ShellExecuteEx(&sei);

m_pPidlMgr->Delete(pidlFQ);

return fReturn;
}

BOOL CContextMenu::DoModifyData ( HWND hwndList ) [private]

Definition at line 821 of file ContMenu.Cpp.

{
TCHAR    szData[MAX_DATA];
INT_PTR  nRet;

//get the item's current data
m_pPidlMgr->GetData(m_aPidls[0], szData, MAX_DATA);

nRet = DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_ITEMDATADLG), hwndList, (DLGPROC)ItemDataDlgProc, (LPARAM)szData);

if(IDOK == nRet)
   {
   m_psfParent->SetItemData(m_aPidls[0], szData);

   return TRUE;
   }

return FALSE;
}

STDMETHODIMP CContextMenu::DoNewFolder ( HWND hWnd ) [private]

Definition at line 736 of file ContMenu.Cpp.

{
HRESULT        hr = E_FAIL;
TCHAR          szName[MAX_PATH];
LPITEMIDLIST   pidl;

m_psfParent->GetUniqueName(TRUE, szName, MAX_PATH);
hr = m_psfParent->AddFolder(szName, &pidl);
if(SUCCEEDED(hr))
   {
   /*
   CShellFolder::AddFolder should have added the new item. Tell the view to
   put the item into edit mode.
   */
   CShellView  *pView = (CShellView*)GetViewInterface(hWnd);
   if(pView)
      {
      pView->EditItem(pidl);
      pView->Release();
      }

   m_pPidlMgr->Delete(pidl);
   }

return hr;
}

STDMETHODIMP CContextMenu::DoNewItem ( HWND hWnd ) [private]

Definition at line 772 of file ContMenu.Cpp.

{
HRESULT        hr;
TCHAR          szName[MAX_PATH];
LPITEMIDLIST   pidl;

m_psfParent->GetUniqueName(FALSE, szName, MAX_PATH);
hr = m_psfParent->AddItem(szName, NULL, &pidl);
if(SUCCEEDED(hr))
   {
   /*
   CShellFolder::AddItem should have added the new item. Tell the view to
   put the item into edit mode.
   */
   CShellView  *pView = (CShellView*)GetViewInterface(hWnd);
   if(pView)
      {
      pView->EditItem(pidl);
      pView->Release();
      }

   m_pPidlMgr->Delete(pidl);
   }

return hr;
}

BOOL CContextMenu::DoOpen ( HWND hWnd ) [private]

Definition at line 693 of file ContMenu.Cpp.

{
LPITEMIDLIST      pidlFQ;
SHELLEXECUTEINFO  sei;

pidlFQ = m_psfParent->CreateFQPidl(m_aPidls[0]);

ZeroMemory(&sei, sizeof(sei));
sei.cbSize = sizeof(sei);
sei.fMask = SEE_MASK_IDLIST | SEE_MASK_CLASSNAME;
sei.lpIDList = pidlFQ;
sei.lpClass = TEXT("folder");
sei.hwnd = hWnd;
sei.nShow = SW_SHOWNORMAL;
sei.lpVerb = TEXT("open");

BOOL fReturn = ShellExecuteEx(&sei);

m_pPidlMgr->Delete(pidlFQ);

return fReturn;
}

BOOL CContextMenu::DoPaste ( VOID ) [private]

Definition at line 578 of file ContMenu.Cpp.

{
BOOL     fSuccess = FALSE;
HGLOBAL  hMem;

OpenClipboard(NULL);

hMem = GetClipboardData(m_cfPrivateData);

if(hMem)
   {
   LPPRIVCLIPDATA pData = (LPPRIVCLIPDATA)GlobalLock(hMem);

   if(pData)
      {
      BOOL           fCut = pData->fCut;
      CShellFolder   *psfFrom = NULL;
      IShellFolder   *psfDesktop;
      LPITEMIDLIST   pidl;

      pidl = (LPITEMIDLIST)((LPBYTE)(pData) + pData->aoffset[0]);
      /*
      This is a fully qualified PIDL, so use the desktop folder to get the
      IShellFolder for this folder.
      */
      SHGetDesktopFolder(&psfDesktop);
      if(psfDesktop)
         {
         psfDesktop->BindToObject(pidl, NULL, IID_IShellFolder, (LPVOID*)&psfFrom);
         psfDesktop->Release();
         }

      if(psfFrom)
         {
         LPITEMIDLIST   *aPidls;

         //allocate an array of PIDLS
         aPidls = AllocPidlTable(pData->cidl - 1);

         if(aPidls)
            {
            UINT  i;

            //fill in the PIDL array
            for(i = 0; i < pData->cidl - 1; i++)
               {
               aPidls[i] = m_pPidlMgr->Copy((LPITEMIDLIST)((LPBYTE)(pData) + pData->aoffset[i + 1]));
               }

            if(SUCCEEDED(m_psfParent->CopyItems(psfFrom, aPidls, pData->cidl - 1)))
               {
               fSuccess = TRUE;

               if(fCut)
                  {
                  psfFrom->DeleteItems(aPidls, pData->cidl - 1);
                  }
               }

            FreePidlTable(aPidls);
            }

         psfFrom->Release();
         }

      GlobalUnlock(hMem);

      if(fSuccess && fCut)
         {
         //a successful cut and paste operation will remove the data from the clipboard
         EmptyClipboard();
         }
      }
   }

CloseClipboard();

return fSuccess;
}

VOID CContextMenu::DoRename ( HWND hWnd ) [private]

Definition at line 805 of file ContMenu.Cpp.

{
CShellView  *pView = (CShellView*)GetViewInterface(hWnd);
if(pView)
   {
   pView->EditItem(m_aPidls[0]);
   pView->Release();
   }
}

BOOL CContextMenu::FillPidlTable | ( | LPCITEMIDLIST * | aPidls,
 |  | UINT | uItemCount |
 | ) |  |  | [private]

Definition at line 500 of file ContMenu.Cpp.

{
if(m_aPidls)
   {
   if(m_pPidlMgr)
      {
      UINT  i;
      for(i = 0; i < uItemCount; i++)
         {
         m_aPidls[i] = m_pPidlMgr->Copy(aPidls[i]);
         }
      return TRUE;
      }
   }

return FALSE;
}

VOID CContextMenu::FreePidlTable ( LPITEMIDLIST * aPidls ) [private]

Definition at line 482 of file ContMenu.Cpp.

{
if(aPidls && m_pPidlMgr)
   {
   UINT  i;
   for(i = 0; aPidls[i]; i++)
      m_pPidlMgr->Delete(aPidls[i]);

   m_pMalloc->Free(aPidls);
   }
}

STDMETHODIMP CContextMenu::GetCommandString | ( | UINT_PTR | idCommand,
 |  | UINT | uFlags,
 |  | LPUINT | lpReserved,
 |  | LPSTR | lpszName,
 |  | UINT | uMaxNameLen
 | ) |  |

Definition at line 387 of file ContMenu.Cpp.

{
HRESULT  hr = E_INVALIDARG;

switch(uFlags)
   {
   case GCS_HELPTEXT:
      switch(idCommand)
         {
         case 0:
            hr = NOERROR;
            break;
         }
      break;

   case GCS_VERBA:
      {
      int   i;
      for(i = 0; -1 != g_VerbMap[i].dwCommand; i++)
         {
         if(g_VerbMap[i].dwCommand == idCommand)
            {
            LocalToAnsi(lpszName, g_VerbMap[i].szVerb, uMaxNameLen);
            hr = NOERROR;
            break;
            }
         }
      }
      break;

   /*
   NT 4.0 with IE 3.0x or no IE will always call this with GCS_VERBW. In this
   case, you need to do the lstrcpyW to the pointer passed.
   */
   case GCS_VERBW:
      {
      int   i;
      for(i = 0; -1 != g_VerbMap[i].dwCommand; i++)
         {
         if(g_VerbMap[i].dwCommand == idCommand)
            {
            LocalToWideChar((LPWSTR)lpszName, g_VerbMap[i].szVerb, uMaxNameLen);
            hr = NOERROR;
            break;
            }
         }
      }
      break;

   case GCS_VALIDATE:
      hr = NOERROR;
      break;
   }

return hr;
}

STDMETHODIMP CContextMenu::GetCommandString | ( | UINT_PTR | idCmd,
 |  | UINT | uFlags,
 |  | UINT FAR * | reserved,
 |  | LPSTR | pszName,
 |  | UINT | ccMax
 | ) |  |

Definition at line 139 of file dsmenu.cpp.

{
  HRESULT hr = S_OK;
  TCHAR szBuffer[MAX_PATH];

  ATLTRACE (_T("CContextMenu::GetCommandString\n"));
  ATLTRACE (_T("\tidCmd is %d.\n"), idCmd);
  if (uFlags != GCS_HELPTEXT)
  {
    ATLTRACE (_T("CDSContextMenu::GetCommand String- flags don't request helptext. flags: %lx\n"),
           uFlags);
    return hr;
  }

  switch ((idCmd))
  {
  case 0:
    if ( !LoadString(_Module.GetModuleInstance(), IDS_SCP_MENU,
                     szBuffer, ARRAYLEN(szBuffer)) )
    break;
  }

  wcscpy ((LPWSTR)pszName, (LPWSTR)(LPCWSTR)szBuffer);
  return hr;
}

STDMETHODIMP CContextMenu::Initialize | ( | LPCITEMIDLIST | pIDFolder,
 |  | LPDATAOBJECT | pDataObj,
 |  | HKEY | hKeyID
 | ) |  |

Definition at line 43 of file dsmenu.cpp.

{

  ATLTRACE(_T("CContextMenu::Initialize.\n"));

  if (pDataObj == NULL)
  {
    return E_INVALIDARG; // no point in going on
  }

  //
  // Store a pointer to the data object
  //
  m_spDataObj = pDataObj;

  return NOERROR;
}

UINT CContextMenu::InsertBackgroundItems | ( | HMENU | hMenu,
 |  | UINT | indexMenu,
 |  | UINT | idCmdFirst |
 | ) |  |  | [private]

Definition at line 847 of file ContMenu.Cpp.

{
HMENU          hPopup;
TCHAR          szText[MAX_PATH];
MENUITEMINFO   mii;

ZeroMemory(&mii, sizeof(mii));
mii.cbSize = sizeof(mii);

//add the View submenu
hPopup = CreatePopupMenu();

if(hPopup)
   {
   AddViewMenuItems(hPopup, idCmdFirst, (UINT)-1, TRUE);

   LoadString(g_hInst, IDS_VIEW, szText, sizeof(szText));
   mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE | MIIM_SUBMENU;
   mii.wID = idCmdFirst + IDM_VIEW;
   mii.fType = MFT_STRING;
   mii.dwTypeData = szText;
   mii.fState = MFS_ENABLED;
   mii.hSubMenu = hPopup;
   InsertMenuItem(   hMenu,
                     indexMenu++,
                     TRUE,
                     &mii);

   //only add a separator if needed
   mii.fMask = MIIM_TYPE;
   GetMenuItemInfo(hMenu, indexMenu, TRUE, &mii);
   if(!(mii.fType & MFT_SEPARATOR))
      {
      ZeroMemory(&mii, sizeof(mii));
      mii.cbSize = sizeof(mii);
      mii.fMask = MIIM_ID | MIIM_TYPE;
      mii.wID = 0;
      mii.fType = MFT_SEPARATOR;
      InsertMenuItem(   hMenu,
                        indexMenu++,
                        TRUE,
                        &mii);
      }
   }

indexMenu += AddFileMenuItems(hMenu, idCmdFirst, indexMenu, TRUE);

//only add a separator if needed
mii.fMask = MIIM_TYPE;
GetMenuItemInfo(hMenu, indexMenu, TRUE, &mii);
if(!(mii.fType & MFT_SEPARATOR))
   {
   ZeroMemory(&mii, sizeof(mii));
   mii.cbSize = sizeof(mii);
   mii.fMask = MIIM_ID | MIIM_TYPE;
   mii.wID = 0;
   mii.fType = MFT_SEPARATOR;
   InsertMenuItem(   hMenu,
                     indexMenu++,
                     TRUE,
                     &mii);
   }

OpenClipboard(NULL);
HGLOBAL  hClip = GetClipboardData(m_cfPrivateData);
CloseClipboard();

LoadString(g_hInst, IDS_PASTE, szText, sizeof(szText));
mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE;
mii.wID = idCmdFirst + IDM_PASTE;
mii.fType = MFT_STRING;
mii.dwTypeData = szText;
mii.fState = (hClip ? MFS_ENABLED : MFS_DISABLED);
InsertMenuItem(   hMenu,
                  indexMenu++,
                  TRUE,
                  &mii);

return indexMenu;
}

UINT CContextMenu::InsertItems | ( | HMENU | hMenu,
 |  | UINT | indexMenu,
 |  | UINT | idCmdFirst,
 |  | UINT | uFlags |
 | ) |  |  | [private]

Definition at line 936 of file ContMenu.Cpp.

{
MENUITEMINFO   mii;
TCHAR          szText[MAX_PATH];
BOOL           fExplore = uFlags & CMF_EXPLORE;
DWORD          dwAttr = SFGAO_CANRENAME |
                           SFGAO_CANDELETE |
                           SFGAO_CANCOPY |
                           SFGAO_CANMOVE |
                           SFGAO_FOLDER;

ZeroMemory(&mii, sizeof(mii));
mii.cbSize = sizeof(mii);

m_psfParent->GetAttributesOf(m_uItemCount, (LPCITEMIDLIST*)m_aPidls, &dwAttr);

//only add the Open and Explore items if all items are folders.
if(dwAttr & SFGAO_FOLDER)
   {
   if(fExplore)
      {
      LoadString(g_hInst, IDS_EXPLORE, szText, sizeof(szText));
      mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE;
      mii.wID = idCmdFirst + IDM_EXPLORE;
      mii.fType = MFT_STRING;
      mii.dwTypeData = szText;
      mii.fState = MFS_ENABLED | MFS_DEFAULT;
      InsertMenuItem(   hMenu,
                        indexMenu++,
                        TRUE,
                        &mii);

      LoadString(g_hInst, IDS_OPEN, szText, sizeof(szText));
      mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE;
      mii.wID = idCmdFirst + IDM_OPEN;
      mii.fType = MFT_STRING;
      mii.dwTypeData = szText;
      mii.fState = MFS_ENABLED;
      InsertMenuItem(   hMenu,
                        indexMenu++,
                        TRUE,
                        &mii);
      }
   else
      {
      LoadString(g_hInst, IDS_OPEN, szText, sizeof(szText));
      mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE;
      mii.wID = idCmdFirst + IDM_OPEN;
      mii.fType = MFT_STRING;
      mii.dwTypeData = szText;
      mii.fState = MFS_ENABLED | MFS_DEFAULT;
      InsertMenuItem(   hMenu,
                        indexMenu++,
                        TRUE,
                        &mii);

      LoadString(g_hInst, IDS_EXPLORE, szText, sizeof(szText));
      mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE;
      mii.wID = idCmdFirst + IDM_EXPLORE;
      mii.fType = MFT_STRING;
      mii.dwTypeData = szText;
      mii.fState = MFS_ENABLED;
      InsertMenuItem(   hMenu,
                        indexMenu++,
                        TRUE,
                        &mii);
      }
   }

if(dwAttr & SFGAO_CANRENAME)
   {
   //only add a separator if needed
   if(GetMenuItemCount(hMenu))
      {
      mii.fMask = MIIM_TYPE;
      GetMenuItemInfo(hMenu, indexMenu, TRUE, &mii);
      if(!(mii.fType & MFT_SEPARATOR))
         {
         ZeroMemory(&mii, sizeof(mii));
         mii.cbSize = sizeof(mii);
         mii.fMask = MIIM_ID | MIIM_TYPE;
         mii.wID = 0;
         mii.fType = MFT_SEPARATOR;
         InsertMenuItem(   hMenu,
                           indexMenu++,
                           TRUE,
                           &mii);
         }
      }

   LoadString(g_hInst, IDS_RENAME, szText, sizeof(szText));
   mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE;
   mii.wID = idCmdFirst + IDM_RENAME;
   mii.fType = MFT_STRING;
   mii.dwTypeData = szText;
   mii.fState = ((uFlags & MYCMF_MULTISELECT) ? MFS_DISABLED : MFS_ENABLED);
   InsertMenuItem(   hMenu,
                     indexMenu++,
                     TRUE,
                     &mii);
   }

//only add a separator if needed
if(GetMenuItemCount(hMenu))
   {
   mii.fMask = MIIM_TYPE;
   GetMenuItemInfo(hMenu, indexMenu, TRUE, &mii);
   if(!(mii.fType & MFT_SEPARATOR))
      {
      mii.fMask = MIIM_ID | MIIM_TYPE;
      mii.wID = 0;
      mii.fType = MFT_SEPARATOR;
      InsertMenuItem(   hMenu,
                        indexMenu++,
                        TRUE,
                        &mii);
      }
   }

LoadString(g_hInst, IDS_CUT, szText, sizeof(szText));
mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE;
mii.wID = idCmdFirst + IDM_CUT;
mii.fType = MFT_STRING;
mii.dwTypeData = szText;
mii.fState = ((dwAttr & SFGAO_CANMOVE) ? MFS_ENABLED : MFS_DISABLED);
InsertMenuItem(   hMenu,
                  indexMenu++,
                  TRUE,
                  &mii);

LoadString(g_hInst, IDS_COPY, szText, sizeof(szText));
mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE;
mii.wID = idCmdFirst + IDM_COPY;
mii.fType = MFT_STRING;
mii.dwTypeData = szText;
mii.fState = ((dwAttr & SFGAO_CANCOPY) ? MFS_ENABLED : MFS_DISABLED);
InsertMenuItem(   hMenu,
                  indexMenu++,
                  TRUE,
                  &mii);

if(dwAttr & SFGAO_CANDELETE)
   {
   //only add a separator if needed
   if(GetMenuItemCount(hMenu))
      {
      mii.fMask = MIIM_TYPE;
      GetMenuItemInfo(hMenu, indexMenu, TRUE, &mii);
      if(!(mii.fType & MFT_SEPARATOR))
         {
         ZeroMemory(&mii, sizeof(mii));
         mii.cbSize = sizeof(mii);
         mii.fMask = MIIM_ID | MIIM_TYPE;
         mii.wID = 0;
         mii.fType = MFT_SEPARATOR;
         InsertMenuItem(   hMenu,
                           indexMenu++,
                           TRUE,
                           &mii);
         }
      }

   LoadString(g_hInst, IDS_DELETE, szText, sizeof(szText));
   mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE;
   mii.wID = idCmdFirst + IDM_DELETE;
   mii.fType = MFT_STRING;
   mii.dwTypeData = szText;
   mii.fState = MFS_ENABLED;
   InsertMenuItem(   hMenu,
                     indexMenu++,
                     TRUE,
                     &mii);
   }

if(!(dwAttr & SFGAO_FOLDER) && !(m_fBackground))
   {
   //only add a separator if needed
   if(GetMenuItemCount(hMenu))
      {
      mii.fMask = MIIM_TYPE;
      GetMenuItemInfo(hMenu, indexMenu, TRUE, &mii);
      if(!(mii.fType & MFT_SEPARATOR))
         {
         ZeroMemory(&mii, sizeof(mii));
         mii.cbSize = sizeof(mii);
         mii.fMask = MIIM_ID | MIIM_TYPE;
         mii.wID = 0;
         mii.fType = MFT_SEPARATOR;
         InsertMenuItem(   hMenu,
                           indexMenu++,
                           TRUE,
                           &mii);
         }
      }

   LoadString(g_hInst, IDS_MODIFY_DATA, szText, sizeof(szText));
   mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE;
   mii.wID = idCmdFirst + IDM_MODIFY_DATA;
   mii.fType = MFT_STRING;
   mii.dwTypeData = szText;
   mii.fState = ((uFlags & MYCMF_MULTISELECT) ? MFS_DISABLED : MFS_ENABLED);
   InsertMenuItem(   hMenu,
                     indexMenu++,
                     TRUE,
                     &mii);
   }

return indexMenu;
}

STDMETHODIMP CContextMenu::InvokeCommand ( LPCMINVOKECOMMANDINFO )
STDMETHODIMP CContextMenu::InvokeCommand ( LPCMINVOKECOMMANDINFO lpcmi )

Definition at line 123 of file dsmenu.cpp.

{
  HRESULT hr = S_OK;
  ATLTRACE (_T("CDSContextMenu::InvokeCommand\n"));
  ATLTRACE (_T("\tlpcmi->lpVerb is %d.\n"), lpcmi->lpVerb);

  switch ((INT_PTR)(lpcmi->lpVerb))
  {
  case 0:
    ShowClipformatInfo();
    break;
  }
  return hr;
}

STDMETHODIMP CContextMenu::QueryContextMenu | ( | HMENU | ,
 |  | UINT | ,
 |  | UINT | ,
 |  | UINT | ,
 |  | UINT |
 | ) |  |
STDMETHODIMP CContextMenu::QueryContextMenu | ( | HMENU | hShellMenu,
 |  | UINT | indexMenu,
 |  | UINT | idCmdFirst,
 |  | UINT | idCmdLast,
 |  | UINT | uFlags
 | ) |  |

Definition at line 89 of file dsmenu.cpp.

{

  TCHAR szBuffer[MAX_PATH];
  UINT nMenuItemsAdded = 0;

  ATLTRACE(_T("CContextMenu::QueryContextMenu.\n"));

  // add them items to your menu, inserting them at indexMenu + the offset for your
  // item.  idCmdFirst / idCmdList is the range you should use, they should
  // not exceed this range.  On exit return the number of items and IDs you claimed,

    if ( !LoadString(_Module.GetModuleInstance(), IDS_SCP_MENU,
                     szBuffer, ARRAYLEN(szBuffer)) )
    {
      ATLTRACE(_T("Failed to load resource for menu item.\n"));
    }
    _InsertMenuHelper(hMenu,
             indexMenu,
             MF_BYPOSITION|MF_STRING,
             idCmdFirst,
             szBuffer, &nMenuItemsAdded);

  return nMenuItemsAdded;
}

STDMETHODIMP CContextMenu::QueryInterface | ( | REFIID | riid,
 |  | LPVOID FAR * | ppReturn
 | ) |  |

Definition at line 135 of file ContMenu.Cpp.

{
*ppReturn = NULL;

if(IsEqualIID(riid, IID_IUnknown))
   {
   *ppReturn = (LPUNKNOWN)(LPCONTEXTMENU)this;
   }

if(IsEqualIID(riid, IID_IContextMenu))
   {
   *ppReturn = (LPCONTEXTMENU)this;
   }

if(IsEqualIID(riid, IID_IShellExtInit))
   {
   *ppReturn = (LPSHELLEXTINIT)this;
   }

if(*ppReturn)
   {
   (*(LPUNKNOWN*)ppReturn)->AddRef();
   return S_OK;
   }

return E_NOINTERFACE;
}

void CContextMenu::ShowClipformatInfo ( )

Definition at line 173 of file dsmenu.cpp.

{
  CSCPCMenuDialog dlg(m_spDataObj);
  dlg.DoModal();
}

CContextMenu::STDMETHODIMP_ ( DWORD )
CContextMenu::STDMETHODIMP_ ( DWORD )

Member Data Documentation

LPITEMIDLIST* CContextMenu::m_aPidls [private]

Definition at line 38 of file ContMenu.h.

UINT CContextMenu::m_cfPrivateData [private]

Definition at line 44 of file ContMenu.h.

BOOL CContextMenu::m_fBackground [private]

Definition at line 43 of file ContMenu.h.

DWORD CContextMenu::m_ObjRefCount [private]

Definition at line 37 of file ContMenu.h.

IMalloc* CContextMenu::m_pMalloc [private]

Definition at line 39 of file ContMenu.h.

CPidlMgr* CContextMenu::m_pPidlMgr [private]

Definition at line 40 of file ContMenu.h.

CShellFolder* CContextMenu::m_psfParent [private]

Definition at line 41 of file ContMenu.h.

CComPtr<IDataObject> CContextMenu::m_spDataObj [private]

Definition at line 56 of file dsmenu.h.

UINT CContextMenu::m_uItemCount [private]

Definition at line 42 of file ContMenu.h.

The documentation for this class was generated from the following files:
  • NetDS/ADSI/samples/DSUI/scpext/scpcmenu/dsmenu.h
  • WinUI/Shell/SampView/ContMenu.h
  • NetDS/ADSI/samples/DSUI/scpext/scpcmenu/dsmenu.cpp
  • WinUI/Shell/SampView/ContMenu.Cpp
Generated on Wed Nov 13 2024 16:55:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CContextMenuExtension Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes

CContextMenuExtension Class Reference

#include "cMenuext.h"

List of all members.

Public Member Functions

CContextMenuExtension ()
~CContextMenuExtension ()
virtual HRESULT STDMETHODCALLTYPE | AddMenuItems (LPDATAOBJECT piDataObject, LPCONTEXTMENUCALLBACK piCallback, long __RPC_FAR *pInsertionAllowed)
virtual HRESULT STDMETHODCALLTYPE | Command (long lCommandID, LPDATAOBJECT piDataObject)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()

Private Member Functions

HRESULT | ExtractData (IDataObject *piDataObject, CLIPFORMAT cfClipFormat, BYTE *pbData, DWORD cbData)
HRESULT | ExtractObjectTypeGUID (IDataObject *piDataObject, GUID *pguidObjectType)
HRESULT | ExtractSnapInCLSID (IDataObject *piDataObject, CLSID *pclsidSnapin)
HRESULT | ExtractString (IDataObject *piDataObject, CLIPFORMAT cfClipFormat, WCHAR *pstr, DWORD cchMaxLength)

Private Attributes

ULONG m_cref

Static Private Attributes

static UINT | s_cfDisplayName = RegisterClipboardFormat(_T_CCF_DISPLAY_NAME)
static UINT | s_cfNodeType = RegisterClipboardFormat(_T_CCF_NODETYPE)
static UINT | s_cfSnapInCLSID = RegisterClipboardFormat(_T_CCF_SNAPIN_CLASSID)

Detailed Description

Definition at line 25 of file cMenuext.h.

Constructor & Destructor Documentation

CContextMenuExtension::CContextMenuExtension ( )

Definition at line 37 of file cMenuext.Cpp.

                                             : m_cref(0)
{
    OBJECT_CREATED
}

CContextMenuExtension::~CContextMenuExtension ( )

Definition at line 42 of file cMenuext.Cpp.

{
    OBJECT_DESTROYED
}

Member Function Documentation

HRESULT CContextMenuExtension::AddMenuItems | ( | LPDATAOBJECT | piDataObject,
 |  | LPCONTEXTMENUCALLBACK | piCallback,
 |  | long __RPC_FAR * | pInsertionAllowed |
 | ) |  |  | [virtual]

Definition at line 150 of file cMenuext.Cpp.

{
    HRESULT hr = S_OK;
    CONTEXTMENUITEM menuItemsTask[] =
    {
        {
            L"People Extension", L"Do an extension thing",
                1, CCM_INSERTIONPOINTID_3RDPARTY_TASK  , 0, 0
        },
        { NULL, NULL, 0, 0, 0 }
    };

    // Loop through and add each of the menu items
    if (*pInsertionAllowed & CCM_INSERTIONALLOWED_TASK)
    {
        for (CONTEXTMENUITEM *m = menuItemsTask; m->strName; m++)
        {
            hr = piCallback->AddItem(m);

            if (FAILED(hr))
                break;
        }
    }

    return hr;

}

HRESULT CContextMenuExtension::Command | ( | long | lCommandID,
 |  | LPDATAOBJECT | piDataObject |
 | ) |  |  | [virtual]

Definition at line 181 of file cMenuext.Cpp.

{
    WCHAR pszName[255];
    HRESULT hr = ExtractString(piDataObject, s_cfDisplayName, pszName, sizeof(pszName));
    MAKE_TSTRPTR_FROMWIDE(ptrname, pszName);

    if (SUCCEEDED(hr)) {
        switch (lCommandID)
        {
        case 1:
            ::MessageBox(NULL, ptrname, _T("Menu Command"), MB_OK|MB_ICONEXCLAMATION);
            break;
        }
    }

    return hr;
}

HRESULT CContextMenuExtension::ExtractData | ( | IDataObject * | piDataObject,
 |  | CLIPFORMAT | cfClipFormat,
 |  | BYTE * | pbData,
 |  | DWORD | cbData |
 | ) |  |  | [private]

Definition at line 89 of file cMenuext.Cpp.

{
    HRESULT hr = S_OK;

    FORMATETC formatetc = {cfClipFormat, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL};
    STGMEDIUM stgmedium = {TYMED_HGLOBAL, NULL};

    stgmedium.hGlobal = ::GlobalAlloc(GPTR, cbData);
    do // false loop
    {
        if (NULL == stgmedium.hGlobal)
        {
            hr = E_OUTOFMEMORY;
            break;
        }
        hr = piDataObject->GetDataHere( &formatetc, &stgmedium );
        if ( FAILED(hr) )
        {
            break;
        }

        BYTE* pbNewData = reinterpret_cast<BYTE*>(stgmedium.hGlobal);
        if (NULL == pbNewData)
        {
            hr = E_UNEXPECTED;
            break;
        }
        ::memcpy( pbData, pbNewData, cbData );
    } while (FALSE); // false loop

    if (NULL != stgmedium.hGlobal)
    {
        ::GlobalFree(stgmedium.hGlobal);
    }
    return hr;
} // ExtractData()

HRESULT CContextMenuExtension::ExtractObjectTypeGUID | ( | IDataObject * | piDataObject,
 |  | GUID * | pguidObjectType |
 | ) |  |  | [private]

Definition at line 142 of file cMenuext.Cpp.

{
    return ExtractData( piDataObject, s_cfNodeType, (PBYTE)pguidObjectType, sizeof(GUID) );
}

HRESULT CContextMenuExtension::ExtractSnapInCLSID | ( | IDataObject * | piDataObject,
 |  | CLSID * | pclsidSnapin |
 | ) |  |  | [private]

Definition at line 137 of file cMenuext.Cpp.

{
    return ExtractData( piDataObject, s_cfSnapInCLSID, (PBYTE)pclsidSnapin, sizeof(CLSID) );
}

HRESULT CContextMenuExtension::ExtractString | ( | IDataObject * | piDataObject,
 |  | CLIPFORMAT | cfClipFormat,
 |  | WCHAR * | pstr,
 |  | DWORD | cchMaxLength |
 | ) |  |  | [private]

Definition at line 129 of file cMenuext.Cpp.

{
    return ExtractData( piDataObject, cfClipFormat, (PBYTE)pstr, cchMaxLength );
}

STDMETHODIMP CContextMenuExtension::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 51 of file cMenuext.Cpp.

{
    if (!ppv)
        return E_FAIL;

    *ppv = NULL;

    if (IsEqualIID(riid, IID_IUnknown))
        *ppv = static_cast<IExtendContextMenu *>(this);
    else if (IsEqualIID(riid, IID_IExtendContextMenu))
        *ppv = static_cast<IExtendContextMenu *>(this);

    if (*ppv)
    {
        reinterpret_cast<IUnknown *>(*ppv)->AddRef();
        return S_OK;
    }

    return E_NOINTERFACE;
}

CContextMenuExtension::STDMETHODIMP_ ( ULONG )
CContextMenuExtension::STDMETHODIMP_ ( ULONG )

Member Data Documentation

ULONG CContextMenuExtension::m_cref [private]

Definition at line 29 of file cMenuext.h.

UINT CContextMenuExtension::s_cfDisplayName = RegisterClipboardFormat(_T_CCF_DISPLAY_NAME) [static, private]

Definition at line 43 of file cMenuext.h.

UINT CContextMenuExtension::s_cfNodeType = RegisterClipboardFormat(_T_CCF_NODETYPE) [static, private]

Definition at line 45 of file cMenuext.h.

UINT CContextMenuExtension::s_cfSnapInCLSID = RegisterClipboardFormat(_T_CCF_SNAPIN_CLASSID) [static, private]

Definition at line 44 of file cMenuext.h.

The documentation for this class was generated from the following files:
  • SysMgmt/MMC/CMenuExt/cMenuext.h
  • SysMgmt/MMC/CMenuExt/cMenuext.Cpp
Generated on Wed Nov 13 2024 16:55:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CContextPlugin Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes

CContextPlugin Class Reference

#include "ContextPlugin.h"

Inherits IWMSContextPlugin.

List of all members.

Public Member Functions

CContextPlugin ()
~CContextPlugin ()
STDMETHOD() | DisablePlugin ()
STDMETHOD() | EnablePlugin (long *pdwFlags, long *pdwHeartbeatPeriod)
HRESULT | GetContextTypes (WMS_CONTEXT_PLUGIN_CONTEXT_TYPE *wmsContexts)
STDMETHOD() | GetCustomAdminInterface (IDispatch **ppValue)
STDMETHOD() | GetHandledEvents (VARIANT *pvarHandledEvents)
HRESULT | GetOutputPath (BSTR *pbstrOutputPath)
STDMETHOD() | InitializePlugin (IWMSContext *pServerContext, IWMSNamedValues *pNamedValues, IWMSClassObject *pClassFactory)
STDMETHOD() | OnEvent (WMS_EVENT *pEvent, IWMSContext *pUserCtx, IWMSContext *pPresentationCtx, IWMSCommandContext *pCommandCtx)
STDMETHOD() | OnHeartbeat ()
HRESULT | SetContextTypes (WMS_CONTEXT_PLUGIN_CONTEXT_TYPE wmsContexts)
HRESULT | SetOutputPath (BSTR bstrOutputPath)
STDMETHOD() | ShutdownPlugin ()

Private Member Functions

HRESULT | CreateArrayOfEvents (VARIANT *pvarEvents, WMS_EVENT_TYPE *pWMSEvents, long nNumEvents)
HRESULT | DumpContextInformation (LPCWSTR wstrEventType, IWMSContext *pUserCtx, IWMSContext *pPresentationCtx, IWMSCommandContext *pCommandContext)
HRESULT | LoadConfigValues ()
HRESULT | OnNotifyBeginUserSession (IWMSContext *pUserCtx, IWMSContext *pPresentationCtx, IWMSCommandContext *pCommandCtx)
HRESULT | OnNotifyCache (IWMSContext *pUserCtx, IWMSContext *pPresentationCtx, IWMSCommandContext *pCommandCtx)
HRESULT | OnNotifyClose (IWMSContext *pUserCtx, IWMSContext *pPresentationCtx, IWMSCommandContext *pCommandCtx)
HRESULT | OnNotifyConnect (IWMSContext *pUserCtx, IWMSContext *pPresentationCtx, IWMSCommandContext *pCommandCtx)
HRESULT | OnNotifyCreateDistributionDataPath (IWMSContext *pUserCtx, IWMSContext *pPresentationCtx, IWMSCommandContext *pCommandCtx)
HRESULT | OnNotifyDescribe (IWMSContext *pUserCtx, IWMSContext *pPresentationCtx, IWMSCommandContext *pCommandCtx)
HRESULT | OnNotifyDestroyDistributionDataPath (IWMSContext *pUserCtx, IWMSContext *pPresentationCtx, IWMSCommandContext *pCommandCtx)
HRESULT | OnNotifyDisconnect (IWMSContext *pUserCtx, IWMSContext *pPresentationCtx, IWMSCommandContext *pCommandCtx)
HRESULT | OnNotifyEndUserSession (IWMSContext *pUserCtx, IWMSContext *pPresentationCtx, IWMSCommandContext *pCommandCtx)
HRESULT | OnNotifyGetParameter (IWMSContext *pUserCtx, IWMSContext *pPresentationCtx, IWMSCommandContext *pCommandCtx)
HRESULT | OnNotifyLimitChange (IWMSContext *pUserCtx, IWMSContext *pPresentationCtx, IWMSCommandContext *pCommandCtx)
HRESULT | OnNotifyLimitHit (IWMSContext *pUserCtx, IWMSContext *pPresentationCtx, IWMSCommandContext *pCommandCtx)
HRESULT | OnNotifyLog (IWMSContext *pUserCtx, IWMSContext *pPresentationCtx, IWMSCommandContext *pCommandCtx)
HRESULT | OnNotifyOpen (IWMSContext *pUserCtx, IWMSContext *pPresentationCtx, IWMSCommandContext *pCommandCtx)
HRESULT | OnNotifyPause (IWMSContext *pUserCtx, IWMSContext *pPresentationCtx, IWMSCommandContext *pCommandCtx)
HRESULT | OnNotifyPlay (IWMSContext *pUserCtx, IWMSContext *pPresentationCtx, IWMSCommandContext *pCommandCtx)
HRESULT | OnNotifyPlaylist (IWMSContext *pUserCtx, IWMSContext *pPresentationCtx, IWMSCommandContext *pCommandCtx)
HRESULT | OnNotifyPlugin (IWMSContext *pUserCtx, IWMSContext *pPresentationCtx, IWMSCommandContext *pCommandCtx)
HRESULT | OnNotifyPublishingPoint (IWMSContext *pUserCtx, IWMSContext *pPresentationCtx, IWMSCommandContext *pCommandCtx)
HRESULT | OnNotifyRemoteCacheClose (IWMSContext *pUserCtx, IWMSContext *pPresentationCtx, IWMSCommandContext *pCommandCtx)
HRESULT | OnNotifyRemoteCacheLog (IWMSContext *pUserCtx, IWMSContext *pPresentationCtx, IWMSCommandContext *pCommandCtx)
HRESULT | OnNotifyRemoteCacheOpen (IWMSContext *pUserCtx, IWMSContext *pPresentationCtx, IWMSCommandContext *pCommandCtx)
HRESULT | OnNotifySelectStreams (IWMSContext *pUserCtx, IWMSContext *pPresentationCtx, IWMSCommandContext *pCommandCtx)
HRESULT | OnNotifyServer (IWMSContext *pUserCtx, IWMSContext *pPresentationCtx, IWMSCommandContext *pCommandCtx)
HRESULT | OnNotifySetParameter (IWMSContext *pUserCtx, IWMSContext *pPresentationCtx, IWMSCommandContext *pCommandCtx)
HRESULT | OnNotifyStop (IWMSContext *pUserCtx, IWMSContext *pPresentationCtx, IWMSCommandContext *pCommandCtx)
HRESULT | OnNotifyValidatePushDistribution (IWMSContext *pUserCtx, IWMSContext *pPresentationCtx, IWMSCommandContext *pCommandCtx)
HRESULT | SaveConfigValues ()
HRESULT | WriteContextInformation (HANDLE hFile, IWMSContext *pContext)

Private Attributes

BSTR | m_bstrOutputPath
IWMSNamedValues * | m_pNamedValues
IWMSServer * | m_pServer
WMS_CONTEXT_PLUGIN_CONTEXT_TYPE m_wmsContexts

Static Private Attributes

static const ContextNameHint | s_CommandContextHintValues []
static const ContextNameHint | s_PresentationContextHintValues []
static const ContextNameHint | s_UserContextHintValues []
static WCHAR * | s_wstrNamedValueContextTypes = "ContextTypes"
static WCHAR * | s_wstrNamedValueOutputPath = "OutputPath"

Detailed Description

Definition at line 26 of file ContextPlugin.h.

Constructor & Destructor Documentation

CContextPlugin::CContextPlugin ( )

Definition at line 135 of file ContextPlugin.cpp.

{
    m_pServer = NULL;
    m_pNamedValues = NULL;
    m_bstrOutputPath = NULL;
    m_wmsContexts = WMS_CONTEXT_PLUGIN_NO_CONTEXT;
}

CContextPlugin::~CContextPlugin ( )

Definition at line 146 of file ContextPlugin.cpp.

{
    if( NULL != m_bstrOutputPath )
    {
        ::SysFreeString( m_bstrOutputPath );
        m_bstrOutputPath = NULL;
    }
}

Member Function Documentation

HRESULT CContextPlugin::CreateArrayOfEvents | ( | VARIANT * | pvarEvents,
 |  | WMS_EVENT_TYPE * | pWMSEvents,
 |  | long | nNumEvents |
 | ) |  |  | [private]

Definition at line 626 of file ContextPlugin.cpp.

{
    HRESULT hr = S_OK;
    long iEvents = 0;
    SAFEARRAY *psa = NULL;
    SAFEARRAYBOUND rgsabound[1];

    if( NULL == pvarEvents )
    {
        return( E_POINTER );
    }

    if( NULL == pWMSEvents || 0 >= nNumEvents )
    {
        return( E_INVALIDARG );
    }

    rgsabound[0].lLbound = 0;
    rgsabound[0].cElements = nNumEvents;

    psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );

    if( NULL == psa )
    {
        return ( E_OUTOFMEMORY );
    }

    for( iEvents = 0; iEvents < nNumEvents && SUCCEEDED( hr ); iEvents++ )
    {
        VARIANT varElement;

        VariantInit( &varElement );

        V_VT( &varElement ) = VT_I4;
        V_I4( &varElement ) = pWMSEvents[ iEvents ];

        hr = SafeArrayPutElement( psa, &iEvents, &varElement );
        VariantClear( &varElement );
    }

    if( FAILED( hr ) )
    {
        SafeArrayDestroy( psa );
        psa = NULL;
    }
    else
    {
        V_VT( pvarEvents ) = VT_ARRAY | VT_VARIANT;
        V_ARRAY( pvarEvents ) = psa;
    }

    return ( hr );
}

STDMETHODIMP CContextPlugin::DisablePlugin ( )

Definition at line 206 of file ContextPlugin.cpp.

{
    return ( S_OK );
}

HRESULT CContextPlugin::DumpContextInformation | ( | LPCWSTR | wstrEventType,
 |  | IWMSContext * | pUserCtx,
 |  | IWMSContext * | pPresentationCtx,
 |  | IWMSCommandContext * | pCommandContext |
 | ) |  |  | [private]

Definition at line 811 of file ContextPlugin.cpp.

{
    HRESULT hr = S_OK;
    UINT uiPrevErrorMode = 0;
    DWORD dwRet = 0;
    DWORD cbWritten = 0;
    SYSTEMTIME sTime;
    WCHAR wstrHeader[MAX_PATH];

    ZeroMemory( wstrHeader, MAX_PATH * sizeof( WCHAR ) );

    if( ( WMS_CONTEXT_PLUGIN_NO_CONTEXT == m_wmsContexts )
        || ( NULL == m_bstrOutputPath )
        || ( '\0' == m_bstrOutputPath[0] ) )
    {
        // We aren't interested in dumping any context information, so just exit with Success
        return( hr );
    }

    // Only keep the file open while dumping this event.
    HANDLE hFile = INVALID_HANDLE_VALUE;

    // This stops the system from popping up an error dialog box if a floppy or CD is missing.
    uiPrevErrorMode = ::SetErrorMode( SEM_FAILCRITICALERRORS );

    hFile = ::CreateFile( m_bstrOutputPath, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL );

    if( INVALID_HANDLE_VALUE == hFile )
    {
        dwRet = GetLastError();
        hr = HRESULT_FROM_WIN32( dwRet );
        goto abort;
    }
    else
    {
        dwRet = GetLastError();

        DWORD dwFileType = ::GetFileType( hFile );
        if( FILE_TYPE_DISK != dwFileType )
        {
            // Invalid File Type, for security reasons
            // we should only open disk files.
            hr = HRESULT_FROM_WIN32( ERROR_FILE_NOT_FOUND );
            goto abort;

        }

        if( ERROR_ALREADY_EXISTS != dwRet )
        {
            // We just opened a new file, we must write the Unicode File bits
            BYTE pWriteBuffer[2];
            pWriteBuffer[0] = 0xFF;
            pWriteBuffer[1] = 0xFE;
            if( !::WriteFile( hFile, (LPVOID) pWriteBuffer, 2, &cbWritten, NULL ) )
            {
                dwRet = GetLastError();
                hr = HRESULT_FROM_WIN32( dwRet );
                goto abort;
            }
        }
        else
        {
            // We need to check to see if the file is Unicode.
            BYTE pReadBuffer[2];
            pReadBuffer[0] = 0;
            pReadBuffer[1] = 0;

            DWORD cbRead = 0;
            if( !::ReadFile( hFile, (LPVOID) pReadBuffer, 2, &cbRead, NULL ) )
            {
                dwRet = GetLastError();
                hr = HRESULT_FROM_WIN32( dwRet );
                goto abort;
            }
            if( cbRead != 0 )
            {
                if( ( 1 == cbRead ) || ( 0xFF != pReadBuffer[0] ) || ( 0xFE != pReadBuffer[1] ) )
                {
                    // This file is not unicode, so error out.
                    hr = HRESULT_FROM_WIN32( ERROR_INVALID_DATA );
                    goto abort;
                }
            }
            else
            {
                // We just opened an empty file, we must write the Unicode File bits
                BYTE pWriteBuffer[2];
                pWriteBuffer[0] = 0xFF;
                pWriteBuffer[1] = 0xFE;
                if( !::WriteFile( hFile, (LPVOID) pWriteBuffer, 2, &cbWritten, NULL ) )
                {
                    dwRet = GetLastError();
                    hr = HRESULT_FROM_WIN32( dwRet );
                    goto abort;
                }
            }
        }
    }

    if( SUCCEEDED( hr ) )
    {
        if( !::SetFilePointer( hFile, 0, 0, FILE_END ) )
        {
            dwRet = GetLastError();
            hr = HRESULT_FROM_WIN32( dwRet );
        }

        if( SUCCEEDED( hr ) )
        {
            // Create a buffer of text to pass to WriteFile
            GetLocalTime( &sTime);
            _snwprintf( wstrHeader, MAX_PATH, CONTEXT_SAMPLE_NEW_EVENT_HEADER,
                            wstrEventType, sTime.wYear, sTime.wMonth, sTime.wDay, sTime.wHour, sTime.wMinute, sTime.wSecond );

            if( !::WriteFile( hFile, (LPVOID) wstrHeader, wcslen( wstrHeader ) * sizeof( WCHAR ), &cbWritten, NULL ) )
            {
                dwRet = GetLastError();
                hr = HRESULT_FROM_WIN32( dwRet );
            }
        }
    }

    // Now do the writing of the information
    if( SUCCEEDED( hr ) && ( WMS_CONTEXT_PLUGIN_USER_CONTEXT & m_wmsContexts ) )
    {
        hr = WriteContextInformation( hFile, pUserCtx );
    }

    if( SUCCEEDED( hr ) && ( WMS_CONTEXT_PLUGIN_PRESENTATION_CONTEXT & m_wmsContexts ) )
    {
        hr = WriteContextInformation( hFile, pPresentationCtx );
    }

    if( SUCCEEDED( hr ) && ( WMS_CONTEXT_PLUGIN_COMMAND_REQUEST_CONTEXT & m_wmsContexts ) )
    {
        IWMSContext *pContext = NULL;
        hr = pCommandCtx->GetCommandRequest( &pContext );
        if( SUCCEEDED( hr ) )
        {
            hr = WriteContextInformation( hFile, pContext );
        }

        if( NULL != pContext )
        {
            pContext->Release();
            pContext = NULL;
        }
    }

    if( SUCCEEDED( hr ) && ( WMS_CONTEXT_PLUGIN_COMMAND_RESPONSE_CONTEXT & m_wmsContexts ) )
    {
        IWMSContext *pContext = NULL;
        hr = pCommandCtx->GetCommandResponse( &pContext );
        if( SUCCEEDED( hr ) )
        {
            hr = WriteContextInformation( hFile, pContext );
        }

        if( NULL != pContext )
        {
            pContext->Release();
            pContext = NULL;
        }
    }

abort:
    if( INVALID_HANDLE_VALUE != hFile )
    {
        CloseHandle( hFile );
        hFile = INVALID_HANDLE_VALUE;
    }

    // revert to previous error mode
    ::SetErrorMode( uiPrevErrorMode );

    return( hr );
}

STDMETHODIMP CContextPlugin::EnablePlugin | ( | long * | pdwFlags,
 |  | long * | pdwHeartbeatPeriod
 | ) |  |

Definition at line 190 of file ContextPlugin.cpp.

{
    if ( ( NULL == pdwFlags ) || ( NULL == pdwHeartbeatPeriod ) )
    {
        return ( E_POINTER );
    }

    // Set the heartbeat period in milliseconds
    *pdwHeartbeatPeriod = 0;

    return ( S_OK );
}

HRESULT CContextPlugin::GetContextTypes ( WMS_CONTEXT_PLUGIN_CONTEXT_TYPE * wmsContexts ) [inline]

Definition at line 75 of file ContextPlugin.h.

    {
        HRESULT hr = E_POINTER;
        if( NULL != wmsContexts )
        {
            *wmsContexts = m_wmsContexts;
            hr = S_OK;
        }
        return( hr );
    };

STDMETHODIMP CContextPlugin::GetCustomAdminInterface ( IDispatch ** ppValue )

Definition at line 249 of file ContextPlugin.cpp.

{
    HRESULT hr = S_OK;

    if ( ( NULL == ppValue ) )
    {
        return( E_POINTER );
    }

    *ppValue = NULL;

    CComObject< CContextAdmin > *spContextAdmin;

    hr = CComObject< CContextAdmin >::CreateInstance( &spContextAdmin );
    if( SUCCEEDED( hr ) )
    {
        CComPtr< IDispatch > spAdmin( spContextAdmin );
        hr = spContextAdmin->Initialize( this );
        if ( SUCCEEDED( hr ) )
        {
            hr = spContextAdmin->QueryInterface( IID_IDispatch, (void **) ppValue );
        }
    }

    return( hr );
}

STDMETHODIMP CContextPlugin::GetHandledEvents ( VARIANT * pvarHandledEvents )

Definition at line 278 of file ContextPlugin.cpp.

{
    HRESULT hr = S_OK;
    if( NULL == pvarHandledEvents )
    {
        return( E_POINTER );
    }

    int nIndex = 0;
    WMS_EVENT_TYPE wmsHandledEvents[ NUM_HANDLED_EVENTS ];
    wmsHandledEvents[ nIndex++ ] = WMS_EVENT_CONNECT;
    wmsHandledEvents[ nIndex++ ] = WMS_EVENT_DISCONNECT;
    wmsHandledEvents[ nIndex++ ] = WMS_EVENT_BEGIN_USER_SESSION;
    wmsHandledEvents[ nIndex++ ] = WMS_EVENT_END_USER_SESSION;
    wmsHandledEvents[ nIndex++ ] = WMS_EVENT_DESCRIBE;
    wmsHandledEvents[ nIndex++ ] = WMS_EVENT_OPEN;
    wmsHandledEvents[ nIndex++ ] = WMS_EVENT_SELECT_STREAMS;
    wmsHandledEvents[ nIndex++ ] = WMS_EVENT_PLAY;
    wmsHandledEvents[ nIndex++ ] = WMS_EVENT_PAUSE;
    wmsHandledEvents[ nIndex++ ] = WMS_EVENT_STOP;
    wmsHandledEvents[ nIndex++ ] = WMS_EVENT_CLOSE;
    wmsHandledEvents[ nIndex++ ] = WMS_EVENT_SET_PARAMETER;
    wmsHandledEvents[ nIndex++ ] = WMS_EVENT_GET_PARAMETER;
    wmsHandledEvents[ nIndex++ ] = WMS_EVENT_VALIDATE_PUSH_DISTRIBUTION;
    wmsHandledEvents[ nIndex++ ] = WMS_EVENT_CREATE_DISTRIBUTION_DATA_PATH;
    wmsHandledEvents[ nIndex++ ] = WMS_EVENT_DESTROY_DISTRIBUTION_DATA_PATH;
    wmsHandledEvents[ nIndex++ ] = WMS_EVENT_LOG;
    wmsHandledEvents[ nIndex++ ] = WMS_EVENT_SERVER;
    wmsHandledEvents[ nIndex++ ] = WMS_EVENT_PUBLISHING_POINT;
    wmsHandledEvents[ nIndex++ ] = WMS_EVENT_LIMIT_CHANGE;
    wmsHandledEvents[ nIndex++ ] = WMS_EVENT_LIMIT_HIT;
    wmsHandledEvents[ nIndex++ ] = WMS_EVENT_PLUGIN;
    wmsHandledEvents[ nIndex++ ] = WMS_EVENT_PLAYLIST;
    wmsHandledEvents[ nIndex++ ] = WMS_EVENT_CACHE;
    wmsHandledEvents[ nIndex++ ] = WMS_EVENT_REMOTE_CACHE_OPEN;
    wmsHandledEvents[ nIndex++ ] = WMS_EVENT_REMOTE_CACHE_CLOSE;
    wmsHandledEvents[ nIndex++ ] = WMS_EVENT_REMOTE_CACHE_LOG;

    hr = CreateArrayOfEvents( pvarHandledEvents, wmsHandledEvents, NUM_HANDLED_EVENTS );

    return( hr );
}

HRESULT CContextPlugin::GetOutputPath ( BSTR * pbstrOutputPath )

Definition at line 596 of file ContextPlugin.cpp.

{
    if( NULL == pbstrOutputPath )
    {
        return( E_POINTER );
    }
    *pbstrOutputPath = NULL;

    HRESULT hr = S_OK;

    if( NULL != m_bstrOutputPath )
    {
        *pbstrOutputPath = ::SysAllocString( m_bstrOutputPath );
    }
    else
    {
        // Our string wasn't set, so we should return the empty string.
        *pbstrOutputPath = ::SysAllocString( L"" );
    }

    if( NULL == *pbstrOutputPath )
    {
        hr = E_OUTOFMEMORY;
    }

    return( hr );
}

STDMETHODIMP CContextPlugin::InitializePlugin | ( | IWMSContext * | pServerContext,
 |  | IWMSNamedValues * | pNamedValues,
 |  | IWMSClassObject * | pClassFactory
 | ) |  |

Definition at line 158 of file ContextPlugin.cpp.

{
    HRESULT hr = S_OK;

    if ( ( NULL == pServerContext )
        || ( NULL == pNamedValues )
        || ( NULL == pClassFactory ) )
    {
        return( E_INVALIDARG );
    }

    hr = pServerContext->GetAndQueryIUnknownValue( const_cast<LPWSTR>( WMS_SERVER ), WMS_SERVER_ID,
                                                   IID_IWMSServer, (IUnknown**) &m_pServer, 0 );

    if( SUCCEEDED( hr ) )
    {
        m_pNamedValues = pNamedValues;
        m_pNamedValues->AddRef();

        hr = LoadConfigValues();
    }

    return( hr );
}

HRESULT CContextPlugin::LoadConfigValues ( ) [private]

Definition at line 437 of file ContextPlugin.cpp.

{
    HRESULT hr = S_OK;
    IWMSNamedValue *pValue = NULL;
    VARIANT var;

    if( NULL == m_pNamedValues )
    {
        return( E_UNEXPECTED );
    }

    VariantInit( &var );

    //
    // Get our properties from the server
    //
    hr = m_pNamedValues->get_Item( CComVariant(CContextPlugin::s_wstrNamedValueOutputPath), &pValue );

    //
    // Get the Output Path Name
    //

    if ( SUCCEEDED(hr) )
    {
        hr = pValue->get_Value(&var);

        if ( SUCCEEDED(hr) )
        {
            hr = ::VariantChangeType( &var, &var, 0, VT_BSTR );
        }

        if ( SUCCEEDED(hr) )
        {
            m_bstrOutputPath = ::SysAllocString( V_BSTR( &var ) );
            if( NULL == m_bstrOutputPath )
            {
                hr = E_OUTOFMEMORY;
                goto abort;
            }
        }
    }

    hr = S_OK; // Default is OK

    VariantClear( &var );
    if( NULL != pValue )
    {
        pValue->Release();
        pValue = NULL;
    }

    //
    // Get the flags for ContextTypes
    //

    hr = m_pNamedValues->get_Item( CComVariant(CContextPlugin::s_wstrNamedValueContextTypes), &pValue );

    if ( SUCCEEDED(hr) )
    {
        hr = pValue->get_Value( &var );

        if ( SUCCEEDED(hr) )
        {
            m_wmsContexts = (WMS_CONTEXT_PLUGIN_CONTEXT_TYPE) V_I4( &var );
        }
    }

    hr = S_OK; // Default is OK
abort:
    VariantClear( &var );
    if( NULL != pValue )
    {
        pValue->Release();
        pValue = NULL;
    }

    return( hr );
}

STDMETHODIMP CContextPlugin::OnEvent | ( | WMS_EVENT * | pEvent,
 |  | IWMSContext * | pUserCtx,
 |  | IWMSContext * | pPresentationCtx,
 |  | IWMSCommandContext * | pCommandCtx
 | ) |  |

Definition at line 324 of file ContextPlugin.cpp.

{
    HRESULT hr = S_OK;

    //
    // The event information must be valid in order to determine what
    // type of event has happened.
    //
    if(  NULL == pEvent )
    {
        return( E_INVALIDARG );
    }

    //
    // The input contexts may be NULL if they are not defined for the
    // specified event.  Verify that any context you intend to use is
    // not NULL before using it.  If you need to use context that is
    // NULL, return E_INVALIDARG to notify the server of the problem.
    //
    switch( pEvent->Type )
    {
    case WMS_EVENT_CONNECT:
        hr = OnNotifyConnect( pUserCtx, pPresentationCtx, pCommandCtx );
        break;
    case WMS_EVENT_DISCONNECT:
        hr = OnNotifyDisconnect( pUserCtx, pPresentationCtx, pCommandCtx );
        break;
    case WMS_EVENT_BEGIN_USER_SESSION:
        hr = OnNotifyBeginUserSession( pUserCtx, pPresentationCtx, pCommandCtx );
        break;
    case WMS_EVENT_END_USER_SESSION:
        hr = OnNotifyEndUserSession( pUserCtx, pPresentationCtx, pCommandCtx );
        break;
    case WMS_EVENT_DESCRIBE:
        hr = OnNotifyDescribe( pUserCtx, pPresentationCtx, pCommandCtx );
        break;
    case WMS_EVENT_OPEN:
        hr = OnNotifyOpen( pUserCtx, pPresentationCtx, pCommandCtx );
        break;
    case WMS_EVENT_SELECT_STREAMS:
        hr = OnNotifySelectStreams( pUserCtx, pPresentationCtx, pCommandCtx );
        break;
    case WMS_EVENT_PLAY:
        hr = OnNotifyPlay( pUserCtx, pPresentationCtx, pCommandCtx );
        break;
    case WMS_EVENT_PAUSE:
        hr = OnNotifyPause( pUserCtx, pPresentationCtx, pCommandCtx );
        break;
    case WMS_EVENT_STOP:
        hr = OnNotifyStop( pUserCtx, pPresentationCtx, pCommandCtx );
        break;
    case WMS_EVENT_CLOSE:
        hr = OnNotifyClose( pUserCtx, pPresentationCtx, pCommandCtx );
        break;
    case WMS_EVENT_SET_PARAMETER:
        hr = OnNotifySetParameter( pUserCtx, pPresentationCtx, pCommandCtx );
        break;
    case WMS_EVENT_GET_PARAMETER:
        hr = OnNotifyGetParameter( pUserCtx, pPresentationCtx, pCommandCtx );
        break;
    case WMS_EVENT_VALIDATE_PUSH_DISTRIBUTION:
        hr = OnNotifyValidatePushDistribution( pUserCtx, pPresentationCtx, pCommandCtx );
        break;
    case WMS_EVENT_CREATE_DISTRIBUTION_DATA_PATH:
        hr = OnNotifyCreateDistributionDataPath( pUserCtx, pPresentationCtx, pCommandCtx );
        break;
    case WMS_EVENT_DESTROY_DISTRIBUTION_DATA_PATH:
        hr = OnNotifyDestroyDistributionDataPath( pUserCtx, pPresentationCtx, pCommandCtx );
        break;
    case WMS_EVENT_LOG:
        hr = OnNotifyLog( pUserCtx, pPresentationCtx, pCommandCtx );
        break;
    case WMS_EVENT_SERVER:
        hr = OnNotifyServer( pUserCtx, pPresentationCtx, pCommandCtx );
        break;
    case WMS_EVENT_PUBLISHING_POINT:
        hr = OnNotifyPublishingPoint( pUserCtx, pPresentationCtx, pCommandCtx );
        break;
    case WMS_EVENT_LIMIT_CHANGE:
        hr = OnNotifyLimitChange( pUserCtx, pPresentationCtx, pCommandCtx );
        break;
    case WMS_EVENT_LIMIT_HIT:
        hr = OnNotifyLimitHit( pUserCtx, pPresentationCtx, pCommandCtx );
        break;
    case WMS_EVENT_PLUGIN:
        hr = OnNotifyPlugin( pUserCtx, pPresentationCtx, pCommandCtx );
        break;
    case WMS_EVENT_PLAYLIST:
        hr = OnNotifyPlaylist( pUserCtx, pPresentationCtx, pCommandCtx );
        break;
    case WMS_EVENT_CACHE:
        hr = OnNotifyCache( pUserCtx, pPresentationCtx, pCommandCtx );
        break;
    case WMS_EVENT_REMOTE_CACHE_OPEN:
        hr = OnNotifyRemoteCacheOpen( pUserCtx, pPresentationCtx, pCommandCtx );
        break;
    case WMS_EVENT_REMOTE_CACHE_CLOSE:
        hr = OnNotifyRemoteCacheClose( pUserCtx, pPresentationCtx, pCommandCtx );
        break;
    case WMS_EVENT_REMOTE_CACHE_LOG:
        hr = OnNotifyRemoteCacheLog( pUserCtx, pPresentationCtx, pCommandCtx );
        break;
    }

    return( hr );
}

STDMETHODIMP CContextPlugin::OnHeartbeat ( )

Definition at line 238 of file ContextPlugin.cpp.

{
    HRESULT hr = S_OK;

    // TODO: Add code that should execute on every Heartbeat Period
    return( hr );
}

HRESULT CContextPlugin::OnNotifyBeginUserSession | ( | IWMSContext * | pUserCtx,
 |  | IWMSContext * | pPresentationCtx,
 |  | IWMSCommandContext * | pCommandCtx |
 | ) |  |  | [private]

Definition at line 1007 of file ContextPlugin.cpp.

{
    HRESULT hr = S_OK;
    hr = DumpContextInformation( L"Begin User Session", pUserCtx, pPresentationCtx, pCommandCtx );
    return( hr );
}

HRESULT CContextPlugin::OnNotifyCache | ( | IWMSContext * | pUserCtx,
 |  | IWMSContext * | pPresentationCtx,
 |  | IWMSCommandContext * | pCommandCtx |
 | ) |  |  | [private]

Definition at line 1175 of file ContextPlugin.cpp.

{
    HRESULT hr = S_OK;
    hr = DumpContextInformation( L"Cache", pUserCtx, pPresentationCtx, pCommandCtx );
    return( hr );
}

HRESULT CContextPlugin::OnNotifyClose | ( | IWMSContext * | pUserCtx,
 |  | IWMSContext * | pPresentationCtx,
 |  | IWMSCommandContext * | pCommandCtx |
 | ) |  |  | [private]

Definition at line 1071 of file ContextPlugin.cpp.

{
    HRESULT hr = S_OK;
    hr = DumpContextInformation( L"Close", pUserCtx, pPresentationCtx, pCommandCtx );
    return( hr );
}

HRESULT CContextPlugin::OnNotifyConnect | ( | IWMSContext * | pUserCtx,
 |  | IWMSContext * | pPresentationCtx,
 |  | IWMSCommandContext * | pCommandCtx |
 | ) |  |  | [private]

Definition at line 991 of file ContextPlugin.cpp.

{
    HRESULT hr = S_OK;
    hr = DumpContextInformation( L"Connect", pUserCtx, pPresentationCtx, pCommandCtx );
    return( hr );
}

HRESULT CContextPlugin::OnNotifyCreateDistributionDataPath | ( | IWMSContext * | pUserCtx,
 |  | IWMSContext * | pPresentationCtx,
 |  | IWMSCommandContext * | pCommandCtx |
 | ) |  |  | [private]

Definition at line 1103 of file ContextPlugin.cpp.

{
    HRESULT hr = S_OK;
    hr = DumpContextInformation( L"Create Distribution Data Path", pUserCtx, pPresentationCtx, pCommandCtx );
    return( hr );
}

HRESULT CContextPlugin::OnNotifyDescribe | ( | IWMSContext * | pUserCtx,
 |  | IWMSContext * | pPresentationCtx,
 |  | IWMSCommandContext * | pCommandCtx |
 | ) |  |  | [private]

Definition at line 1023 of file ContextPlugin.cpp.

{
    HRESULT hr = S_OK;
    hr = DumpContextInformation( L"Describe", pUserCtx, pPresentationCtx, pCommandCtx );
    return( hr );
}

HRESULT CContextPlugin::OnNotifyDestroyDistributionDataPath | ( | IWMSContext * | pUserCtx,
 |  | IWMSContext * | pPresentationCtx,
 |  | IWMSCommandContext * | pCommandCtx |
 | ) |  |  | [private]

Definition at line 1111 of file ContextPlugin.cpp.

{
    HRESULT hr = S_OK;
    hr = DumpContextInformation( L"Destroy Distribution Data Path", pUserCtx, pPresentationCtx, pCommandCtx );
    return( hr );
}

HRESULT CContextPlugin::OnNotifyDisconnect | ( | IWMSContext * | pUserCtx,
 |  | IWMSContext * | pPresentationCtx,
 |  | IWMSCommandContext * | pCommandCtx |
 | ) |  |  | [private]

Definition at line 999 of file ContextPlugin.cpp.

{
    HRESULT hr = S_OK;
    hr = DumpContextInformation( L"Disconnect", pUserCtx, pPresentationCtx, pCommandCtx );
    return( hr );
}

HRESULT CContextPlugin::OnNotifyEndUserSession | ( | IWMSContext * | pUserCtx,
 |  | IWMSContext * | pPresentationCtx,
 |  | IWMSCommandContext * | pCommandCtx |
 | ) |  |  | [private]

Definition at line 1015 of file ContextPlugin.cpp.

{
    HRESULT hr = S_OK;
    hr = DumpContextInformation( L"End User Session", pUserCtx, pPresentationCtx, pCommandCtx );
    return( hr );
}

HRESULT CContextPlugin::OnNotifyGetParameter | ( | IWMSContext * | pUserCtx,
 |  | IWMSContext * | pPresentationCtx,
 |  | IWMSCommandContext * | pCommandCtx |
 | ) |  |  | [private]

Definition at line 1087 of file ContextPlugin.cpp.

{
    HRESULT hr = S_OK;
    hr = DumpContextInformation( L"Get Parameter", pUserCtx, pPresentationCtx, pCommandCtx );
    return( hr );
}

HRESULT CContextPlugin::OnNotifyLimitChange | ( | IWMSContext * | pUserCtx,
 |  | IWMSContext * | pPresentationCtx,
 |  | IWMSCommandContext * | pCommandCtx |
 | ) |  |  | [private]

Definition at line 1143 of file ContextPlugin.cpp.

{
    HRESULT hr = S_OK;
    hr = DumpContextInformation( L"Limit Change", pUserCtx, pPresentationCtx, pCommandCtx );
    return( hr );
}

HRESULT CContextPlugin::OnNotifyLimitHit | ( | IWMSContext * | pUserCtx,
 |  | IWMSContext * | pPresentationCtx,
 |  | IWMSCommandContext * | pCommandCtx |
 | ) |  |  | [private]

Definition at line 1151 of file ContextPlugin.cpp.

{
    HRESULT hr = S_OK;
    hr = DumpContextInformation( L"Limit Hit", pUserCtx, pPresentationCtx, pCommandCtx );
    return( hr );
}

HRESULT CContextPlugin::OnNotifyLog | ( | IWMSContext * | pUserCtx,
 |  | IWMSContext * | pPresentationCtx,
 |  | IWMSCommandContext * | pCommandCtx |
 | ) |  |  | [private]

Definition at line 1119 of file ContextPlugin.cpp.

{
    HRESULT hr = S_OK;
    hr = DumpContextInformation( L"Log", pUserCtx, pPresentationCtx, pCommandCtx );
    return( hr );
}

HRESULT CContextPlugin::OnNotifyOpen | ( | IWMSContext * | pUserCtx,
 |  | IWMSContext * | pPresentationCtx,
 |  | IWMSCommandContext * | pCommandCtx |
 | ) |  |  | [private]

Definition at line 1031 of file ContextPlugin.cpp.

{
    HRESULT hr = S_OK;
    hr = DumpContextInformation( L"Open", pUserCtx, pPresentationCtx, pCommandCtx );
    return( hr );
}

HRESULT CContextPlugin::OnNotifyPause | ( | IWMSContext * | pUserCtx,
 |  | IWMSContext * | pPresentationCtx,
 |  | IWMSCommandContext * | pCommandCtx |
 | ) |  |  | [private]

Definition at line 1055 of file ContextPlugin.cpp.

{
    HRESULT hr = S_OK;
    hr = DumpContextInformation( L"Pause", pUserCtx, pPresentationCtx, pCommandCtx );
    return( hr );
}

HRESULT CContextPlugin::OnNotifyPlay | ( | IWMSContext * | pUserCtx,
 |  | IWMSContext * | pPresentationCtx,
 |  | IWMSCommandContext * | pCommandCtx |
 | ) |  |  | [private]

Definition at line 1047 of file ContextPlugin.cpp.

{
    HRESULT hr = S_OK;
    hr = DumpContextInformation( L"Play", pUserCtx, pPresentationCtx, pCommandCtx );
    return( hr );
}

HRESULT CContextPlugin::OnNotifyPlaylist | ( | IWMSContext * | pUserCtx,
 |  | IWMSContext * | pPresentationCtx,
 |  | IWMSCommandContext * | pCommandCtx |
 | ) |  |  | [private]

Definition at line 1167 of file ContextPlugin.cpp.

{
    HRESULT hr = S_OK;
    hr = DumpContextInformation( L"Playlist", pUserCtx, pPresentationCtx, pCommandCtx );
    return( hr );
}

HRESULT CContextPlugin::OnNotifyPlugin | ( | IWMSContext * | pUserCtx,
 |  | IWMSContext * | pPresentationCtx,
 |  | IWMSCommandContext * | pCommandCtx |
 | ) |  |  | [private]

Definition at line 1159 of file ContextPlugin.cpp.

{
    HRESULT hr = S_OK;
    hr = DumpContextInformation( L"Plugin", pUserCtx, pPresentationCtx, pCommandCtx );
    return( hr );
}

HRESULT CContextPlugin::OnNotifyPublishingPoint | ( | IWMSContext * | pUserCtx,
 |  | IWMSContext * | pPresentationCtx,
 |  | IWMSCommandContext * | pCommandCtx |
 | ) |  |  | [private]

Definition at line 1135 of file ContextPlugin.cpp.

{
    HRESULT hr = S_OK;
    hr = DumpContextInformation( L"Publishing Point", pUserCtx, pPresentationCtx, pCommandCtx );
    return( hr );
}

HRESULT CContextPlugin::OnNotifyRemoteCacheClose | ( | IWMSContext * | pUserCtx,
 |  | IWMSContext * | pPresentationCtx,
 |  | IWMSCommandContext * | pCommandCtx |
 | ) |  |  | [private]

Definition at line 1191 of file ContextPlugin.cpp.

{
    HRESULT hr = S_OK;
    hr = DumpContextInformation( L"Remote Cache Close", pUserCtx, pPresentationCtx, pCommandCtx );
    return( hr );
}

HRESULT CContextPlugin::OnNotifyRemoteCacheLog | ( | IWMSContext * | pUserCtx,
 |  | IWMSContext * | pPresentationCtx,
 |  | IWMSCommandContext * | pCommandCtx |
 | ) |  |  | [private]

Definition at line 1199 of file ContextPlugin.cpp.

{
    HRESULT hr = S_OK;
    hr = DumpContextInformation( L"Remote Cache Log", pUserCtx, pPresentationCtx, pCommandCtx );
    return( hr );
}

HRESULT CContextPlugin::OnNotifyRemoteCacheOpen | ( | IWMSContext * | pUserCtx,
 |  | IWMSContext * | pPresentationCtx,
 |  | IWMSCommandContext * | pCommandCtx |
 | ) |  |  | [private]

Definition at line 1183 of file ContextPlugin.cpp.

{
    HRESULT hr = S_OK;
    hr = DumpContextInformation( L"Remote Cache Open", pUserCtx, pPresentationCtx, pCommandCtx );
    return( hr );
}

HRESULT CContextPlugin::OnNotifySelectStreams | ( | IWMSContext * | pUserCtx,
 |  | IWMSContext * | pPresentationCtx,
 |  | IWMSCommandContext * | pCommandCtx |
 | ) |  |  | [private]

Definition at line 1039 of file ContextPlugin.cpp.

{
    HRESULT hr = S_OK;
    hr = DumpContextInformation( L"Select Streams", pUserCtx, pPresentationCtx, pCommandCtx );
    return( hr );
}

HRESULT CContextPlugin::OnNotifyServer | ( | IWMSContext * | pUserCtx,
 |  | IWMSContext * | pPresentationCtx,
 |  | IWMSCommandContext * | pCommandCtx |
 | ) |  |  | [private]

Definition at line 1127 of file ContextPlugin.cpp.

{
    HRESULT hr = S_OK;
    hr = DumpContextInformation( L"Server", pUserCtx, pPresentationCtx, pCommandCtx );
    return( hr );
}

HRESULT CContextPlugin::OnNotifySetParameter | ( | IWMSContext * | pUserCtx,
 |  | IWMSContext * | pPresentationCtx,
 |  | IWMSCommandContext * | pCommandCtx |
 | ) |  |  | [private]

Definition at line 1079 of file ContextPlugin.cpp.

{
    HRESULT hr = S_OK;
    hr = DumpContextInformation( L"Set Parameter", pUserCtx, pPresentationCtx, pCommandCtx );
    return( hr );
}

HRESULT CContextPlugin::OnNotifyStop | ( | IWMSContext * | pUserCtx,
 |  | IWMSContext * | pPresentationCtx,
 |  | IWMSCommandContext * | pCommandCtx |
 | ) |  |  | [private]

Definition at line 1063 of file ContextPlugin.cpp.

{
    HRESULT hr = S_OK;
    hr = DumpContextInformation( L"Stop", pUserCtx, pPresentationCtx, pCommandCtx );
    return( hr );
}

HRESULT CContextPlugin::OnNotifyValidatePushDistribution | ( | IWMSContext * | pUserCtx,
 |  | IWMSContext * | pPresentationCtx,
 |  | IWMSCommandContext * | pCommandCtx |
 | ) |  |  | [private]

Definition at line 1095 of file ContextPlugin.cpp.

{
    HRESULT hr = S_OK;
    hr = DumpContextInformation( L"Validate Push Distribution", pUserCtx, pPresentationCtx, pCommandCtx );
    return( hr );
}

HRESULT CContextPlugin::SaveConfigValues ( ) [private]

Definition at line 517 of file ContextPlugin.cpp.

{
    HRESULT hr = S_OK;
    IWMSNamedValue *pValue = NULL;
    VARIANT var;

    if( NULL == m_pNamedValues )
    {
        return( E_UNEXPECTED );
    }

    VariantInit( &var );

    //
    // Save our Output Path property
    //
    V_VT( &var ) = VT_BSTR;
    if( NULL == ( V_BSTR( &var ) = ::SysAllocString( m_bstrOutputPath ) ) )
    {
        return( E_OUTOFMEMORY );
    }
    hr = m_pNamedValues->Add( CComBSTR( CContextPlugin::s_wstrNamedValueOutputPath ), var, &pValue );
    VariantClear( &var );
    if( NULL != pValue )
    {
        pValue->Release();
        pValue = NULL;
    }

    VariantInit( &var );

    //
    // Save our Context Types property
    //
    V_VT( &var ) = VT_I4;
    V_I4( &var ) = m_wmsContexts;
    hr = m_pNamedValues->Add( CComBSTR( CContextPlugin::s_wstrNamedValueContextTypes ), var, &pValue );
    VariantClear( &var );

    if( NULL != pValue )
    {
        pValue->Release();
        pValue = NULL;
    }

    return( hr );
}

HRESULT CContextPlugin::SetContextTypes ( WMS_CONTEXT_PLUGIN_CONTEXT_TYPE wmsContexts ) [inline]

Definition at line 65 of file ContextPlugin.h.

    {
        if( ( 0 > wmsContexts )
            || ( ( 2 * WMS_CONTEXT_PLUGIN_COMMAND_RESPONSE_CONTEXT ) <= wmsContexts ) )
        {
            return( E_INVALIDARG );
        }
        m_wmsContexts = wmsContexts;
        return( S_OK );
    };

HRESULT CContextPlugin::SetOutputPath ( BSTR bstrOutputPath )

Definition at line 568 of file ContextPlugin.cpp.

{
    HRESULT hr = S_OK;

    if( NULL != m_bstrOutputPath )
    {
        ::SysFreeString( m_bstrOutputPath );
        m_bstrOutputPath = NULL;
    }

    if( NULL == bstrOutputPath )
    {
        // They just wanted to reset the OutputPath to nothing,
        // meaning no information is sent.
        return( hr );
    }

    m_bstrOutputPath = ::SysAllocString( bstrOutputPath );
    if( NULL == m_bstrOutputPath )
    {
        hr = E_OUTOFMEMORY;
        return( hr );
    }

    return( hr );
}

STDMETHODIMP CContextPlugin::ShutdownPlugin ( )

Definition at line 214 of file ContextPlugin.cpp.

{
    HRESULT hr = S_OK;

    hr = SaveConfigValues();

    if( NULL != m_pServer )
    {
        m_pServer->Release();
        m_pServer = NULL;
    }

    if( NULL != m_pNamedValues )
    {
        m_pNamedValues->Release();
        m_pNamedValues = NULL;
    }

    return( hr );
}

HRESULT CContextPlugin::WriteContextInformation | ( | HANDLE | hFile,
 |  | IWMSContext * | pContext |
 | ) |  |  | [private]

Definition at line 681 of file ContextPlugin.cpp.

{
    HRESULT hr = S_OK;
    ContextNameHint *pContextHintValues = NULL;
    DWORD nValue = 0;
    WMS_CONTEXT_TYPE wmsContextType = WMS_UNKNOWN_CONTEXT_TYPE;
    WCHAR wstrBuffer[MAX_PATH];
    DWORD cbWritten = 0;
    DWORD dwRet = 0;

    if( NULL == pContext )
    {
        // There is no Context, nothing to write
        return( hr );
    }

    hr = pContext->GetContextType( &wmsContextType );

    if( FAILED( hr ) )
    {
        return( hr );
    }

    ZeroMemory( wstrBuffer, MAX_PATH * sizeof( WCHAR ) );

    switch( wmsContextType )
    {
        case WMS_USER_CONTEXT_TYPE:
            // Create a header for this context type
            wcsncpy( wstrBuffer, CONTEXT_SAMPLE_USER_CONTEXT_HEADER, MAX_PATH );
            pContextHintValues = const_cast<ContextNameHint *>(CContextPlugin::s_UserContextHintValues);
            break;
        case WMS_PRESENTATION_CONTEXT_TYPE:
            // Create a header for this context type
            wcsncpy( wstrBuffer, CONTEXT_SAMPLE_PRESENTATION_CONTEXT_HEADER, MAX_PATH );
            pContextHintValues = const_cast<ContextNameHint *>(CContextPlugin::s_PresentationContextHintValues);
            break;
        case WMS_COMMAND_REQUEST_CONTEXT_TYPE:
            // Create a header for this context type
            wcsncpy( wstrBuffer, CONTEXT_SAMPLE_COMMAND_REQUEST_CONTEXT_HEADER, MAX_PATH );
            pContextHintValues = const_cast<ContextNameHint *>(CContextPlugin::s_CommandContextHintValues);
            break;
        case WMS_COMMAND_RESPONSE_CONTEXT_TYPE:
            // Create a header for this context type
            wcsncpy( wstrBuffer, CONTEXT_SAMPLE_COMMAND_RESPONSE_CONTEXT_HEADER, MAX_PATH );
            pContextHintValues = const_cast<ContextNameHint *>(CContextPlugin::s_CommandContextHintValues);
            break;
    }

    if( !::WriteFile( hFile, (LPVOID) wstrBuffer, wcslen( wstrBuffer ) * sizeof( WCHAR ), &cbWritten, NULL ) )
    {
        dwRet = GetLastError();
        hr = HRESULT_FROM_WIN32( dwRet );
        // Failed to write the header should we still continue
        // No!
        return( hr );
    }

    if( NULL == pContextHintValues )
    {
        return( E_UNEXPECTED );
    }

    // Now we loop until -1 and Write the data
    while( ( NULL != pContextHintValues[nValue].wstrContextName ) && ( -1 != pContextHintValues[nValue].lContextHint ) )
    {
        VARIANT varValue;
        VariantInit( &varValue );
        ZeroMemory( wstrBuffer, MAX_PATH * sizeof( WCHAR ) );

        hr = pContext->GetValue( pContextHintValues[nValue].wstrContextName, pContextHintValues[nValue].lContextHint, &varValue, 0 );

        if( SUCCEEDED( hr ) )
        {
            // Write string with data information
            switch( V_VT( &varValue ) )
            {
                case VT_BSTR:
                    _snwprintf( wstrBuffer, MAX_PATH, CONTEXT_SAMPLE_BSTR_TYPE_STRING, pContextHintValues[nValue].wstrContextName, pContextHintValues[nValue].lContextHint, V_BSTR( &varValue ) );
                    break;
                case VT_I4:
                    _snwprintf( wstrBuffer, MAX_PATH, CONTEXT_SAMPLE_I4_TYPE_STRING, pContextHintValues[nValue].wstrContextName, pContextHintValues[nValue].lContextHint, V_I4( &varValue ), V_I4( &varValue ) );
                    break;
                case VT_UI8:
                    _snwprintf( wstrBuffer, MAX_PATH, CONTEXT_SAMPLE_UI8_TYPE_STRING, pContextHintValues[nValue].wstrContextName, pContextHintValues[nValue].lContextHint, V_UI8( &varValue ) );
                    break;
                case VT_CY:
                    _snwprintf( wstrBuffer, MAX_PATH, CONTEXT_SAMPLE_CY_TYPE_STRING, pContextHintValues[nValue].wstrContextName, pContextHintValues[nValue].lContextHint, V_CY( &varValue ) );
                    break;
                case VT_DATE:
                    _snwprintf( wstrBuffer, MAX_PATH, CONTEXT_SAMPLE_DATE_TYPE_STRING, pContextHintValues[nValue].wstrContextName, pContextHintValues[nValue].lContextHint, V_DATE( &varValue ) );
                    break;
                case VT_DECIMAL:
                    _snwprintf( wstrBuffer, MAX_PATH, CONTEXT_SAMPLE_DECIMAL_TYPE_STRING, pContextHintValues[nValue].wstrContextName, pContextHintValues[nValue].lContextHint, V_DECIMAL( &varValue ) );
                    break;
                case VT_UNKNOWN:
                    _snwprintf( wstrBuffer, MAX_PATH, CONTEXT_SAMPLE_UNKNOWN_TYPE_STRING, pContextHintValues[nValue].wstrContextName, pContextHintValues[nValue].lContextHint, V_UNKNOWN( &varValue ) );
                    break;
                case VT_DISPATCH:
                    _snwprintf( wstrBuffer, MAX_PATH, CONTEXT_SAMPLE_DISPATCH_TYPE_STRING, pContextHintValues[nValue].wstrContextName, pContextHintValues[nValue].lContextHint, V_DISPATCH( &varValue ) );
                    break;
                default:
                    _snwprintf( wstrBuffer, MAX_PATH, CONTEXT_SAMPLE_ARRAY_TYPE_STRING, pContextHintValues[nValue].wstrContextName, pContextHintValues[nValue].lContextHint, V_ARRAY( &varValue ) );
                    break;
            }

            if( !::WriteFile( hFile, (LPVOID) wstrBuffer, wcslen( wstrBuffer ) * sizeof( WCHAR ), &cbWritten, NULL ) )
            {
                dwRet = GetLastError();
                hr = HRESULT_FROM_WIN32( dwRet );
            }
        }
        else
        {
            // Value probably didn't exist for this event, don't worry about it
            // good place to put breakpoint
            hr = S_OK;
        }

        // It doesn't hurt to do a VariantClear on an Empty Variant, this way we won't leak anything.
        VariantClear( &varValue );

        nValue ++;
    }

    return( hr );
}

Member Data Documentation

BSTR CContextPlugin::m_bstrOutputPath [private]

Definition at line 133 of file ContextPlugin.h.

IWMSNamedValues* CContextPlugin::m_pNamedValues [private]

Definition at line 131 of file ContextPlugin.h.

IWMSServer* CContextPlugin::m_pServer [private]

Definition at line 130 of file ContextPlugin.h.

WMS_CONTEXT_PLUGIN_CONTEXT_TYPE CContextPlugin::m_wmsContexts [private]

Definition at line 132 of file ContextPlugin.h.

const ContextNameHint CContextPlugin::s_CommandContextHintValues [static, private]

Definition at line 137 of file ContextPlugin.h.

const ContextNameHint CContextPlugin::s_PresentationContextHintValues [static, private]
Initial value:

{
    WMS_PRESENT_STREAM_HEADERS, WMS_PRESENT_STREAM_HEADERS_ID,
    WMS_PRESENT_CONTENT_DESCRIPTION, WMS_PRESENT_CONTENT_DESCRIPTION_ID,
    WMS_PRESENT_PHYSICAL_NAME, WMS_PRESENT_PHYSICAL_NAME_ID,
    WMS_PRESENT_REQUEST_NAME, WMS_PRESENT_REQUEST_NAME_ID,
    WMS_PRESENT_BROADCAST, WMS_PRESENT_BROADCAST_ID,
    WMS_PRESENT_SEEKABLE, WMS_PRESENT_SEEKABLE_ID,
    WMS_PRESENT_RELIABLE, WMS_PRESENT_RELIABLE_ID,
    WMS_PRESENT_BITRATE, WMS_PRESENT_BITRATE_ID,
    WMS_PRESENT_DURATION_HI, WMS_PRESENT_DURATION_HI_ID,
    WMS_PRESENT_DURATION_LO, WMS_PRESENT_DURATION_LO_ID,
    WMS_PRESENT_PLAY_RATE, WMS_PRESENT_PLAY_RATE_ID,
    WMS_PRESENT_START_TIME, WMS_PRESENT_START_TIME_ID,
    WMS_PRESENT_ORIGINAL_PHYSICAL_NAME, WMS_PRESENT_ORIGINAL_PHYSICAL_NAME_ID,
    WMS_PRESENT_ORIGINAL_REQUEST_NAME, WMS_PRESENT_ORIGINAL_REQUEST_NAME_ID,
    WMS_PRESENT_TOTAL_BYTES_SENT_HI, WMS_PRESENT_TOTAL_BYTES_SENT_HI_ID,
    WMS_PRESENT_TOTAL_BYTES_SENT_LO, WMS_PRESENT_TOTAL_BYTES_SENT_LO_ID,
    WMS_PRESENT_TOTAL_PLAY_TIME_HI, WMS_PRESENT_TOTAL_PLAY_TIME_HI_ID,
    WMS_PRESENT_TOTAL_PLAY_TIME_LO, WMS_PRESENT_TOTAL_PLAY_TIME_LO_ID,
    WMS_PRESENT_PLAYLIST_ENTRY_ROLE, WMS_PRESENT_PLAYLIST_ENTRY_ROLE_ID,
    WMS_PRESENT_WMSSINK_SELECTED_BITRATE, WMS_PRESENT_WMSSINK_SELECTED_BITRATE_ID,
    WMS_PRESENT_REDIRECT_LOCATION, WMS_PRESENT_REDIRECT_LOCATION_ID,
    WMS_PRESENT_PREROLL_TIME, WMS_PRESENT_PREROLL_TIME_ID,
    NULL, -1
}

Definition at line 136 of file ContextPlugin.h.

const ContextNameHint CContextPlugin::s_UserContextHintValues [static, private]
Initial value:

{
    WMS_USER_AGENT, WMS_USER_AGENT_ID,
    WMS_USER_GUID, WMS_USER_GUID_ID,
    WMS_USER_NAME, WMS_USER_NAME_ID,
    WMS_USER_IP_ADDRESS, WMS_USER_IP_ADDRESS_ID,
    WMS_USER_IP_ADDRESS_STRING, WMS_USER_IP_ADDRESS_STRING_ID,
    WMS_USER_CONTROL_PROTOCOL, WMS_USER_CONTROL_PROTOCOL_ID,
    WMS_USER_AUTHENTICATOR, WMS_USER_AUTHENTICATOR_ID,
    WMS_USER_ID, WMS_USER_ID_ID,
    WMS_USER_PORT, WMS_USER_PORT_ID,
    WMS_USER_PRESENTATION_CONTEXT, WMS_USER_PRESENTATION_CONTEXT_ID,
    WMS_USER_LINK_BANDWIDTH, WMS_USER_LINK_BANDWIDTH_ID,
    WMS_USER_REFERER, WMS_USER_REFERER_ID,
    WMS_USER_VIA_UPSTREAM_PROXIES, WMS_USER_VIA_UPSTREAM_PROXIES_ID,
    WMS_USER_VIA_DOWNSTREAM_PROXIES, WMS_USER_VIA_DOWNSTREAM_PROXIES_ID,
    WMS_USER_CACHE_CLIENT_COOKIE, WMS_USER_CACHE_CLIENT_COOKIE_ID,
    WMS_USER_CACHE_SERVER_COOKIE, WMS_USER_CACHE_SERVER_COOKIE_ID,
    WMS_USER_PROXY_CLIENT_AGENT, WMS_USER_PROXY_CLIENT_AGENT_ID,
    NULL, -1
}

Definition at line 135 of file ContextPlugin.h.

WCHAR * CContextPlugin::s_wstrNamedValueContextTypes = "ContextTypes" [static, private]

Definition at line 140 of file ContextPlugin.h.

WCHAR * CContextPlugin::s_wstrNamedValueOutputPath = "OutputPath" [static, private]

Definition at line 139 of file ContextPlugin.h.

The documentation for this class was generated from the following files:
  • Multimedia/WindowsMediaServices9/EventNotification/ContextPlugin.h
  • Multimedia/WindowsMediaServices9/EventNotification/ContextPlugin.cpp
Generated on Wed Nov 13 2024 16:55:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CContextSamplePropPage Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Private Member Functions | Private Attributes

CContextSamplePropPage Class Reference

#include "ContextSamplePropPageImpl.h"

List of all members.

Public Types

enum | { IDD = IDD_CONTEXTSAMPLEPROPPAGE }

Public Member Functions

CContextSamplePropPage ()

Private Member Functions

STDMETHOD() | Apply (void)
HRESULT | Connect (void)
HRESULT | GetPluginSetting ()
void | MessageBox (UINT id)
LRESULT | OnInitDialog (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
HRESULT | PopulateControls ()
HRESULT | RetrieveDialogInformation ()
LRESULT | SetDirtyFlag (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)

Private Attributes

CComBSTR | m_bstrOrigOutputPath
CComBSTR | m_bstrOutputPath
BOOL m_fInitializing
CComQIPtr< IWMSContextAdmin > | m_pPluginAdmin
WMS_CONTEXT_PLUGIN_CONTEXT_TYPE m_wmsContextTypes
WMS_CONTEXT_PLUGIN_CONTEXT_TYPE m_wmsOrigContextTypes

Detailed Description

Definition at line 29 of file ContextSamplePropPageImpl.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 37 of file ContextSamplePropPageImpl.h.

{IDD = IDD_CONTEXTSAMPLEPROPPAGE};

Constructor & Destructor Documentation

CContextSamplePropPage::CContextSamplePropPage ( void )

Definition at line 21 of file ContextSamplePropPageImpl.cpp.

{
    m_dwTitleID = IDS_TITLEContextSamplePropPage;
    m_dwHelpFileID = IDS_HELPFILEContextSamplePropPage;
    m_dwDocStringID = IDS_DOCSTRINGContextSamplePropPage;

    m_wmsOrigContextTypes = WMS_CONTEXT_PLUGIN_NO_CONTEXT;
    m_wmsContextTypes = WMS_CONTEXT_PLUGIN_NO_CONTEXT;
    m_fInitializing = TRUE;
}

Member Function Documentation

STDMETHODIMP CContextSamplePropPage::Apply ( void ) [private]

Definition at line 35 of file ContextSamplePropPageImpl.cpp.

{
    HRESULT hr = S_OK;
    long lMaxSize = 0;

    if ( ! m_bDirty )
    {
        return( S_OK );
    }

    hr = RetrieveDialogInformation();

    if( SUCCEEDED( hr ) )
    {
        //
        // Set all the properties that have changed.
        //
        if( !m_pPluginAdmin )
        {
            MessageBox( IDS_SERVER_CONNECT_ERROR );
            return( E_FAIL );
        }
        else
        {
            // Check the old values and only set if they have changed
            if( ( NULL != m_bstrOrigOutputPath.m_str )
                && ( NULL != m_bstrOutputPath.m_str )
                && _wcsicmp( m_bstrOrigOutputPath, m_bstrOutputPath ) )
            {
                m_pPluginAdmin->put_OutputPath( m_bstrOutputPath );
            }

            if( m_wmsOrigContextTypes != m_wmsContextTypes )
            {
                m_pPluginAdmin->put_ContextTypes( m_wmsContextTypes );
            }
        }
    }

    if( SUCCEEDED( hr ) )
    {
        SetDirty( FALSE );
    }

    return( hr );
} //end of Apply.

HRESULT CContextSamplePropPage::Connect ( void ) [private]

Definition at line 99 of file ContextSamplePropPageImpl.cpp.

{
    // Interface pointers are given in the following order:
    // m_ppUnk[0] = Plugin Admin Interface
    // m_ppUnk[1] = Server Interface (IWMSServer)
    // m_ppUnk[2] = Pubpoint Interface (IWMSPublishingPoint)

    // IF m_nObjects == 3 then m_pUnk[2] will have the pubpoint interface

    if( 0 == m_nObjects )
    {
        return( E_UNEXPECTED );
    }

    m_pPluginAdmin = m_ppUnk[0];

    if( ! m_pPluginAdmin )
    {
        return( E_FAIL );
    }

    return( S_OK );
}

HRESULT CContextSamplePropPage::GetPluginSetting ( ) [private]

Definition at line 202 of file ContextSamplePropPageImpl.cpp.

{
    HRESULT hr = S_OK;

    ATLTRACE( "CContextSamplePropPage::GetPluginSetting\n" );

    //
    // Get plugin's properties.
    //
    if( !m_pPluginAdmin )
    {
        MessageBox( IDS_PLUGIN_PROPS_ERROR );
        m_fInitializing = FALSE;
        return( E_FAIL );
    }
    hr = m_pPluginAdmin->get_OutputPath( &m_bstrOrigOutputPath );
    if( FAILED( hr ) )
    {
        MessageBox( IDS_PLUGIN_PROPS_ERROR );
        Deactivate();
        m_fInitializing = FALSE;
        return( hr );
    }
    m_bstrOutputPath = m_bstrOrigOutputPath;

    hr = m_pPluginAdmin->get_ContextTypes( &m_wmsOrigContextTypes );
    if( FAILED( hr ) )
    {
        MessageBox( IDS_PLUGIN_PROPS_ERROR );
        Deactivate();
        m_fInitializing = FALSE;
        return( hr );
    }
    m_wmsContextTypes = m_wmsOrigContextTypes;

    return( hr );
} //end of GetPluginSetting.

void CContextSamplePropPage::MessageBox ( UINT id ) [private]

Definition at line 85 of file ContextSamplePropPageImpl.cpp.

{
    CComBSTR bstrMessage;
    CComBSTR bstrTitle( "Windows Media Services" );

    if( bstrMessage.LoadString( id ) )
    {
        ::MessageBox( m_hWnd, bstrMessage, bstrTitle, MB_OK );
    }
}

LRESULT CContextSamplePropPage::OnInitDialog | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL & | bHandled |
 | ) |  |  | [private]

Definition at line 126 of file ContextSamplePropPageImpl.cpp.

{
    ATLTRACE( "== CContextSamplePropPage::OnInitDialog\n" );

    EnableThemeDialogTexture( m_hWnd, ETDT_ENABLETAB );

    HRESULT hr = S_OK;
    m_fInitializing = TRUE;

    hr = Connect();
    if ( FAILED( hr ) )
    {
        MessageBox( IDS_SERVER_CONNECT_ERROR );
        Deactivate();
        return( m_fInitializing = FALSE );
    }

    hr = GetPluginSetting();
    if( SUCCEEDED( hr ) )
    {
        hr = PopulateControls();
    }

    return( m_fInitializing = FALSE );
} //end of OnInitDialog.

HRESULT CContextSamplePropPage::PopulateControls ( ) [private]

Definition at line 243 of file ContextSamplePropPageImpl.cpp.

{
    HRESULT hr = S_OK;
    bool fEnableMaxSize = false;

    ATLTRACE( "CContextSamplePropPage::PopulateControls\n" );

    //
    // Display the plugin's properties.
    //
    ::EnableWindow( GetDlgItem( IDC_EDIT_OUTPUT_PATH ), TRUE );
    SetDlgItemText( IDC_EDIT_OUTPUT_PATH, ( wchar_t * ) m_bstrOutputPath );
    ::SendMessage( GetDlgItem( IDC_EDIT_OUTPUT_PATH ), EM_SETLIMITTEXT, MAX_PATH - 1, 0 );

    if( WMS_CONTEXT_PLUGIN_USER_CONTEXT & m_wmsContextTypes )
    {
        ::SendMessage( GetDlgItem( IDC_CHECK_USER_CONTEXT ), BM_SETCHECK, BST_CHECKED, 0 );
    }
    else
    {
        ::SendMessage( GetDlgItem( IDC_CHECK_USER_CONTEXT ), BM_SETCHECK, BST_UNCHECKED, 0 );
    }

    if( WMS_CONTEXT_PLUGIN_PRESENTATION_CONTEXT & m_wmsContextTypes )
    {
        ::SendMessage( GetDlgItem( IDC_CHECK_PRESENTATION_CONTEXT ), BM_SETCHECK, BST_CHECKED, 0 );
    }
    else
    {
        ::SendMessage( GetDlgItem( IDC_CHECK_PRESENTATION_CONTEXT ), BM_SETCHECK, BST_UNCHECKED, 0 );
    }

    if( WMS_CONTEXT_PLUGIN_COMMAND_REQUEST_CONTEXT & m_wmsContextTypes )
    {
        ::SendMessage( GetDlgItem( IDC_CHECK_COMMAND_REQUEST_CONTEXT ), BM_SETCHECK, BST_CHECKED, 0 );
    }
    else
    {
        ::SendMessage( GetDlgItem( IDC_CHECK_COMMAND_REQUEST_CONTEXT ), BM_SETCHECK, BST_UNCHECKED, 0 );
    }

    if( WMS_CONTEXT_PLUGIN_COMMAND_RESPONSE_CONTEXT & m_wmsContextTypes )
    {
        ::SendMessage( GetDlgItem( IDC_CHECK_COMMAND_RESPONSE_CONTEXT ), BM_SETCHECK, BST_CHECKED, 0 );
    }
    else
    {
        ::SendMessage( GetDlgItem( IDC_CHECK_COMMAND_RESPONSE_CONTEXT ), BM_SETCHECK, BST_UNCHECKED, 0 );
    }

    return( hr );
} //end of PopulateControls.

HRESULT CContextSamplePropPage::RetrieveDialogInformation ( ) [private]

Definition at line 154 of file ContextSamplePropPageImpl.cpp.

{
    WCHAR wstrOutputPath[MAX_PATH];
    HRESULT hr = S_OK;

    //
    // Grab the new information for the Output Path property.
    //
    if( GetDlgItemText( IDC_EDIT_OUTPUT_PATH, wstrOutputPath, MAX_PATH) )
    {
        m_bstrOutputPath = wstrOutputPath;
        if( NULL == m_bstrOutputPath.m_str )
        {
            hr = E_FAIL;
        }
    }
    else
    {
        // Failed to get text from control
        hr = E_FAIL;
    }

    // reset to zero and then set bits accordingly
    m_wmsContextTypes = WMS_CONTEXT_PLUGIN_NO_CONTEXT;

    if( BST_CHECKED == ::SendMessage( GetDlgItem( IDC_CHECK_USER_CONTEXT ), BM_GETCHECK, 0, 0 ) )
    {
        m_wmsContextTypes = (WMS_CONTEXT_PLUGIN_CONTEXT_TYPE) ( m_wmsContextTypes | WMS_CONTEXT_PLUGIN_USER_CONTEXT );
    }
    if( BST_CHECKED == ::SendMessage( GetDlgItem( IDC_CHECK_PRESENTATION_CONTEXT ), BM_GETCHECK, 0, 0 ) )
    {
        m_wmsContextTypes = (WMS_CONTEXT_PLUGIN_CONTEXT_TYPE) ( m_wmsContextTypes | WMS_CONTEXT_PLUGIN_PRESENTATION_CONTEXT );
    }
    if( BST_CHECKED == ::SendMessage( GetDlgItem( IDC_CHECK_COMMAND_REQUEST_CONTEXT ), BM_GETCHECK, 0, 0 ) )
    {
        m_wmsContextTypes = (WMS_CONTEXT_PLUGIN_CONTEXT_TYPE) ( m_wmsContextTypes | WMS_CONTEXT_PLUGIN_COMMAND_REQUEST_CONTEXT );
    }
    if( BST_CHECKED == ::SendMessage( GetDlgItem( IDC_CHECK_COMMAND_RESPONSE_CONTEXT ), BM_GETCHECK, 0, 0 ) )
    {
        m_wmsContextTypes = (WMS_CONTEXT_PLUGIN_CONTEXT_TYPE) ( m_wmsContextTypes | WMS_CONTEXT_PLUGIN_COMMAND_RESPONSE_CONTEXT );
    }

    return( hr );
}

LRESULT CContextSamplePropPage::SetDirtyFlag | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled |
 | ) |  |  | [inline, private]

Definition at line 70 of file ContextSamplePropPageImpl.h.

  {
      if( !m_fInitializing )
      {
            SetDirty( TRUE );
      }

      return( 0 );
  };

Member Data Documentation

CComBSTR CContextSamplePropPage::m_bstrOrigOutputPath [private]

Definition at line 85 of file ContextSamplePropPageImpl.h.

CComBSTR CContextSamplePropPage::m_bstrOutputPath [private]

Definition at line 86 of file ContextSamplePropPageImpl.h.

BOOL CContextSamplePropPage::m_fInitializing [private]

Definition at line 84 of file ContextSamplePropPageImpl.h.

CComQIPtr<IWMSContextAdmin> CContextSamplePropPage::m_pPluginAdmin [private]

Definition at line 78 of file ContextSamplePropPageImpl.h.

WMS_CONTEXT_PLUGIN_CONTEXT_TYPE CContextSamplePropPage::m_wmsContextTypes [private]

Definition at line 88 of file ContextSamplePropPageImpl.h.

WMS_CONTEXT_PLUGIN_CONTEXT_TYPE CContextSamplePropPage::m_wmsOrigContextTypes [private]

Definition at line 87 of file ContextSamplePropPageImpl.h.

The documentation for this class was generated from the following files:
  • Multimedia/WindowsMediaServices9/EventNotification/ContextSamplePropPage/ContextSamplePropPageImpl.h
  • Multimedia/WindowsMediaServices9/EventNotification/ContextSamplePropPage/ContextSamplePropPageImpl.cpp
Generated on Wed Nov 13 2024 16:55:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CController Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CController Class Reference

#include "APP.Hxx"

List of all members.

Public Member Functions

void | AlertBox (HWND hwnd, UINT ids, UINT fuStyle)
void | ButtonDown (HWND hwnd, LPARAM lParam)
void | ButtonUp (HWND hwnd, LPARAM lParam)
void | Command (HWND hwnd, WPARAM wParam)
void | Create (HWND hwnd, LPARAM lParam)
void | Destroy ()
void | HScroll (HWND hwnd, WPARAM wParam, LPARAM lParam)
void | Init (HWND hwnd)
void | KeyDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
void | KeyUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
void | Paint (HWND hwnd)
void | Size (LPARAM lParam)
void | VScroll (HWND hwnd, WPARAM wParam, LPARAM lParam)

Private Member Functions

void | Page (HWND hwnd, WPARAM wParam)

Private Attributes

DLGPROC | _funAbout
DLGPROC | _funProp
HINSTANCE | _hInst
CBox * _pBox
CModel * _pModel
CScrollableView * _pView

Detailed Description

Definition at line 125 of file APP.Hxx.

Member Function Documentation

void CController::AlertBox | ( | HWND | hwnd,
 |  | UINT | ids,
 |  | UINT | fuStyle
 | ) |  |

Definition at line 75 of file APP.Cxx.

{
    TCHAR szText[100];
    TCHAR szCaption[100];

    LoadString(_hInst, idsText, (LPTSTR)szText, 100);
    LoadString(_hInst, IDS_MSGCAPTION, (LPTSTR)szCaption, 100);

    ::MessageBox (hwnd, (LPTSTR)szText, (LPTSTR)szCaption, fuStyle) ;
};

void CController::ButtonDown | ( | HWND | hwnd,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 240 of file APP.Cxx.

{
    static RECT rc;
    SetCapture (hwnd);

  // second mouse click removes pop-up box
    if( _pBox )
    {
        delete _pBox;
        _pBox = 0;
    _pView->Invalidate(hwnd, &rc);
        return;
    }

  // locate character selected
    CScreenCanvas canvas(hwnd);

    POINT pt = {LOWORD(lParam), HIWORD(lParam)};

    UINT iChar = _pView->Hittest(canvas, pt, _pModel);

    if( iChar == 0xFFFF )
    {
        return;   // no char selected
    }

  // create the pop-up box
    SIZE size = { 4*(INCH1-INCH8)/5, INCH1};
    CBoxFormat bxf(size);

    HFONT hfont = _pModel->GetFont();
    _pBox = new CBox(bxf, iChar, hfont);

  // match current format
    UINT fuFormat;
  _pModel->GetFormat(fuFormat);
  _pBox->SetFormat(fuFormat & DECIMAL);

    canvas.DPtoLP(&pt);
    pt.x -= size.cx/2;
    pt.y -= size.cy/2;
#ifdef UNICODE
    pt.x -= size.cx; // accommodate wider popup
#endif

    GetClientRect(hwnd, &rc);

  // show it
    _pBox->Paint(canvas, pt, rc);

  //--- dead code....
    size = _pBox->GetSize();

  POINT ptSize;
  ptSize.x = size.cx;
  ptSize.y = size.cy;
  canvas.LPtoDP(&ptSize);
  pt.x+=ptSize.x;
  pt.y+=ptSize.y;
}

void CController::ButtonUp | ( | HWND | hwnd,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 303 of file APP.Cxx.

{
    ReleaseCapture();
}

void CController::Command | ( | HWND | hwnd,
 |  | WPARAM | wParam
 | ) |  |

Definition at line 88 of file APP.Cxx.

{
    switch ( wID )
    {
      // File Menu
      case IDM_PRINT:
           {
                CPrintRequest job(hwnd, 1, _pModel->GetMaxPage());

                if(!job.Cancelled() && !job.Error())
                {
                    CPrintCanvas canvas (job);
                    job.Print (_hInst, canvas, _pModel);

                    if(job.Error())
                    {
                        AlertBox (hwnd, IDS_PRINTERR, MB_OK | MB_ICONEXCLAMATION) ;
                    }
                }
           }
           break;

      case IDM_EXIT:
           SendMessage ( hwnd, WM_CLOSE, 0L, 0L );
           break;

      // View Menu
      case IDM_NEXTPAGE:
           Page(hwnd, IDM_NEXTPAGE);
           break;

      case IDM_PREVPAGE:
           Page(hwnd, IDM_PREVPAGE);
           break;

      case IDM_NEXTSECTION:
           Page(hwnd, IDM_NEXTSECTION);
           break;

      case IDM_PREVSECTION:
           Page(hwnd, IDM_PREVSECTION);
           break;

      case IDM_ZOOMIN:
           {
               UINT iScale;
               _pView->GetScale(iScale);
               iScale -= (iScale > 50 ? 25 : 0);
               _pView->SetScale(iScale);
               _pView->Invalidate(hwnd);
           }
           break;

      case IDM_ZOOMOUT:
           {
               UINT iScale;
               _pView->GetScale(iScale);
               iScale += (iScale < 200 ? 25 : 0);
               _pView->SetScale(iScale);
               _pView->Invalidate(hwnd);
           }
           break;

      // Options Menu
      case IDM_FONT:
           _pModel->ChooseFont(hwnd);
           _pView->Invalidate(hwnd);
           break;

     case IDM_DECIMAL:
           {
               UINT fuFormat;
               _pModel->GetFormat(fuFormat);
               fuFormat ^= DECIMAL;
               CheckMenuItem (GetMenu(hwnd), IDM_DECIMAL,
                        fuFormat & DECIMAL ? MF_CHECKED : MF_UNCHECKED ) ;
              _pModel->SetFormat(fuFormat);
           }
           _pView->Invalidate(hwnd);
           break;

      case IDM_ALLPAGES:
           {
               UINT fPageMode;
               _pModel->GetPageMode(fPageMode);
               fPageMode ^= ALLPAGES;
               CheckMenuItem (GetMenu(hwnd), IDM_ALLPAGES,
                        fPageMode & ALLPAGES ? MF_CHECKED : MF_UNCHECKED ) ;
               _pModel->SetPageMode(fPageMode);
           }
           _pView->Invalidate(hwnd);
           break;

       case IDM_SHOWPROP:
            {
                DialogBox( _hInst, TEXT("PROPERTIES"),hwnd, _funProp );
                    _pModel->SetCSet(pCSet);
            }
            _pView->Invalidate(hwnd);
            break;

      // Help Menu
      case IDM_HELP:
           AlertBox ( hwnd, IDS_NOTIMPLEM, MB_ICONINFORMATION | MB_OK);
           break;

      case IDM_ABOUT:
           DialogBox ( _hInst, TEXT("AboutBox"), hwnd, _funAbout );
           break;
     }
}

void CController::Create | ( | HWND | hwnd,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 31 of file APP.Cxx.

{
    HANDLE handle = ((LPCREATESTRUCT) lParam)->hInstance;
    _hInst = (HINSTANCE)handle;
    _funAbout = (DLGPROC) MakeProcInstance((FARPROC)AboutDlgProc, _hInst);
    _funProp = (DLGPROC) MakeProcInstance((FARPROC) PropDlgProc, _hInst );

    // Set up the Main View
    _pView = new CScrollableView(((LPCREATESTRUCT) lParam)->cx,
                                ((LPCREATESTRUCT) lParam)->cy);
    _pView->SetScale(100);

    SetScrollRange(hwnd, SB_VERT, 0, PAGEHEIGHT, FALSE);
    SetScrollRange(hwnd, SB_HORZ, 0, PAGEWIDTH, FALSE);

    SetScrollPos(hwnd, SB_HORZ, 0, TRUE );
    SetScrollPos(hwnd, SB_VERT, 0, TRUE );

    // Set up the Model
    _pModel= new CModel(_hInst, hwnd, HEXADECIMAL, USEDONLY);

    // Set up the initial state of the Menu
    Page(hwnd, IDM_FIRSTPAGE);

    // initially no pop-up character box
    _pBox = 0;
}

void CController::Destroy ( )

Definition at line 59 of file APP.Cxx.

{

    FreeProcInstance((FARPROC)AboutDlgProc);

    delete _pView;
    delete _pModel;
    PostQuitMessage(0);
}

void CController::HScroll | ( | HWND | hwnd,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 343 of file APP.Cxx.

{
  if (_pBox)
  {
    // Remove box by simulating second mouse click
    ButtonDown(hwnd, 0);
    UpdateWindow(hwnd);
  }
    _pView->SetHScrollPos(hwnd, wParam, lParam, _pModel);
}

void CController::Init ( HWND hwnd )
void CController::KeyDown | ( | HWND | hwnd,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 308 of file APP.Cxx.

{
    switch( wParam )
    {
    case VK_PRIOR:
         Page(hwnd, IDM_PREVPAGE);
         break;
    case VK_NEXT:
         Page(hwnd, IDM_NEXTPAGE);
         break;
    case VK_HOME:
         Page(hwnd, IDM_FIRSTPAGE);
         break;
    case VK_END:
         Page(hwnd, IDM_LASTPAGE);
         break;
    case VK_UP:
         _pView->SetVScrollPos(hwnd, SB_LINEUP, lParam, _pModel);
         break;
    case VK_DOWN:
         _pView->SetVScrollPos(hwnd, SB_LINEDOWN, lParam, _pModel);
         break;
    case VK_LEFT:
         _pView->SetHScrollPos(hwnd, SB_LINEUP, lParam, _pModel);
         break;
    case VK_RIGHT:
         _pView->SetHScrollPos(hwnd, SB_LINEDOWN, lParam, _pModel);
         break;
    }
}

void CController::KeyUp | ( | HWND | hwnd,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 339 of file APP.Cxx.

{
}

void CController::Page | ( | HWND | hwnd,
 |  | WPARAM | wParam |
 | ) |  |  | [private]

Definition at line 200 of file APP.Cxx.

{
    UINT iPage = _pModel->GetPage();
    switch (wParam)
    {
    case IDM_PREVPAGE:
        _pModel->PrevPage();
        break;
    case IDM_NEXTPAGE:
        _pModel->NextPage();
        break;
    case IDM_NEXTSECTION:
        _pModel->NextSection();
        break;
    case IDM_PREVSECTION:
        _pModel->PrevSection();
        break;
    case IDM_FIRSTPAGE:
        _pModel->SetPage( 0 );
        break;
    case IDM_LASTPAGE:
        _pModel->SetPage( _pModel->GetMaxPage() -1 );
        break;
    }
    if (iPage != _pModel->GetPage())
    {
        _pView->Invalidate(hwnd);
    }
    HMENU hmenu = GetMenu(hwnd);

    EnableMenuItem (hmenu, IDM_PREVPAGE, _pModel->CanPrevPage()  ?
                      MF_ENABLED : MF_DISABLED | MF_GRAYED ) ;
    EnableMenuItem (hmenu, IDM_NEXTPAGE, _pModel->CanNextPage() ?
                      MF_ENABLED : MF_DISABLED | MF_GRAYED ) ;
    EnableMenuItem (hmenu, IDM_NEXTSECTION, _pModel->CanNextSection() ?
                      MF_ENABLED : MF_DISABLED | MF_GRAYED ) ;
    EnableMenuItem (hmenu, IDM_PREVSECTION,_pModel->CanPrevSection() ?
                      MF_ENABLED : MF_DISABLED | MF_GRAYED ) ;
}

void CController::Paint ( HWND hwnd ) [inline]

Definition at line 156 of file APP.Hxx.

{
   CPaintCanvas canvas (hwnd);

   _pView->Paint(canvas, _pModel, canvas.GetRect());
}

void CController::Size ( LPARAM lParam )

Definition at line 69 of file APP.Cxx.

{
   _pView->SetSize ( LOWORD(lParam), HIWORD(lParam) );
}

void CController::VScroll | ( | HWND | hwnd,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 354 of file APP.Cxx.

{
  if (_pBox)
  {
    // Remove box by simulating second mouse click
    ButtonDown(hwnd, 0);
    UpdateWindow(hwnd);
  }
    _pView->SetVScrollPos(hwnd, wParam, lParam, _pModel);
}

Member Data Documentation

DLGPROC CController::_funAbout [private]

Definition at line 147 of file APP.Hxx.

DLGPROC CController::_funProp [private]

Definition at line 148 of file APP.Hxx.

HINSTANCE CController::_hInst [private]

Definition at line 146 of file APP.Hxx.

CBox* CController::_pBox [private]

Definition at line 152 of file APP.Hxx.

CModel* CController::_pModel [private]

Definition at line 151 of file APP.Hxx.

CScrollableView* CController::_pView [private]

Definition at line 150 of file APP.Hxx.

The documentation for this class was generated from the following files:
  • Multimedia/Gdi/Fonts/GridFont/APP.Hxx
  • Multimedia/Gdi/Fonts/GridFont/APP.Cxx
Generated on Wed Nov 13 2024 16:55:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCounterData Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

CCounterData Struct Reference

List of all members.

Public Attributes

long | m_lHandle
WCHAR | m_wcsName [256]

Detailed Description

Definition at line 41 of file RefClint.Cpp.

Member Data Documentation

long CCounterData::m_lHandle

Definition at line 44 of file RefClint.Cpp.

WCHAR CCounterData::m_wcsName[256]

Definition at line 43 of file RefClint.Cpp.

The documentation for this struct was generated from the following file:
  • SysMgmt/WMI/VC/HiPerfClient/RefClint.Cpp
Generated on Wed Nov 13 2024 16:55:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCreateQueueDialog Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions

CCreateQueueDialog Class Reference

#include "CRQDlg.h"

List of all members.

Public Types

enum | { IDD = IDD_CREATE_QUEUE_DIALOG }

Public Member Functions

CCreateQueueDialog (CWnd *pParent=NULL)
void | GetLabel (TCHAR szLabelBuffer[BUFFERSIZE])
void | GetPathName (TCHAR szPathNameBuffer[BUFFERSIZE])

Public Attributes

CString m_strLabel
CString m_strPathName

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)

Detailed Description

Definition at line 20 of file CRQDlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 28 of file CRQDlg.h.

{ IDD = IDD_CREATE_QUEUE_DIALOG };

Constructor & Destructor Documentation

CCreateQueueDialog::CCreateQueueDialog ( CWnd * pParent = NULL )

Definition at line 31 of file CRQDlg.Cpp.

   : CDialog(CCreateQueueDialog::IDD, pParent)
{

  TCHAR szTmpBuffer[MAX_COMPUTERNAME_LENGTH + 2] ={0};
  DWORD dwTmpBufferSize = MAX_COMPUTERNAME_LENGTH+1;
  if (!GetComputerName(szTmpBuffer, &dwTmpBufferSize))
  {

    AfxMessageBox(_T("The computer name is too long for the buffer specified.\n"));
    exit(1);

  }
  //
  // The following line is OK, but any further concatenations will need a bigger array to be safe.
  //
  _tcsncat(szTmpBuffer, TEXT("\\"), 1);

   //{{AFX_DATA_INIT(CCreateQueueDialog)
   m_strLabel = TEXT("MQ API test");
   m_strPathName = szTmpBuffer;
   //}}AFX_DATA_INIT
}

Member Function Documentation

void CCreateQueueDialog::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 57 of file CRQDlg.Cpp.

{
   CDialog::DoDataExchange(pDX);
   //{{AFX_DATA_MAP(CCreateQueueDialog)
   DDX_Text(pDX, IDC_QUEUE_LABEL, m_strLabel);
   DDV_MaxChars(pDX, m_strLabel, 128);
   DDX_Text(pDX, IDC_QUEUE_PATHNAME, m_strPathName);
   DDV_MaxChars(pDX, m_strPathName, 128);
   //}}AFX_DATA_MAP
}

void CCreateQueueDialog::GetLabel ( TCHAR szLabelBuffer[BUFFERSIZE] ) [inline]

Definition at line 58 of file CRQDlg.h.

  {
    ASSERT(szLabelBuffer != NULL);

    _tcsncpy (szLabelBuffer, LPCTSTR(m_strLabel), BUFFERSIZE-1);
    szLabelBuffer[BUFFERSIZE-1] = '\0';

  }

void CCreateQueueDialog::GetPathName ( TCHAR szPathNameBuffer[BUFFERSIZE] ) [inline]

Definition at line 49 of file CRQDlg.h.

  {
    ASSERT(szPathNameBuffer != NULL);

    _tcsncpy (szPathNameBuffer, LPCTSTR(m_strPathName), BUFFERSIZE-1);
    szPathNameBuffer[BUFFERSIZE-1] = '\0';

  }

Member Data Documentation

CString CCreateQueueDialog::m_strLabel

Definition at line 29 of file CRQDlg.h.

CString CCreateQueueDialog::m_strPathName

Definition at line 30 of file CRQDlg.h.

The documentation for this class was generated from the following files:
  • NetDS/MessageQueuing/MqApiTst/CRQDlg.h
  • NetDS/MessageQueuing/MqApiTst/CRQDlg.Cpp
Generated on Wed Nov 13 2024 16:55:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCreateTable Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CCreateTable Class Reference

#include "CreateTable.h"

List of all members.

Public Member Functions

CCreateTable ()
STDMETHOD() | CreateAccount ()
STDMETHOD() | InterfaceSupportsErrorInfo (REFIID riid)

Detailed Description

Definition at line 10 of file CreateTable.h.

Constructor & Destructor Documentation

CCreateTable::CCreateTable ( ) [inline]

Definition at line 17 of file CreateTable.h.

  {
  }

Member Function Documentation

STDMETHODIMP CCreateTable::CreateAccount ( )

Definition at line 33 of file CreateTable.cpp.

{
  TCHAR strErr[512] = "";

  // Get the ObjectContext object

  CComPtr<IObjectContext> pObjectContext = NULL;

  _RecordsetPtr pRecordset = NULL;
  _ConnectionPtr pConnection;

  HRESULT hr = GetObjectContext(&pObjectContext);

  if (FAILED(hr))
  {
    wsprintf(strErr, "GetObjectContext Failed!");

    goto ErrorHandler;
  }

  // Create ADODB.Connection object and execute SQL statement to create Table

  hr = pConnection.CreateInstance("ADODB.Connection.1");

  if (FAILED(hr))
  {
    wsprintf(strErr, "Create ADODB.Connection object failed!");

    goto ErrorHandler;
  }

  hr = pConnection->Open(CONNECTION, NULL, NULL, NULL);

  if (FAILED(hr))
  {
    wsprintf(strErr, "Open ODBC connection failed!");

    goto ErrorHandler;
  }

  hr = pConnection->Execute(CComBSTR(szSQL), static_cast<VARIANT *>(&vtMissing), adCmdText, &pRecordset);

  if (FAILED(hr))
  {
    wsprintf(strErr, "Create table failed ");

    goto ErrorHandler;
  }

  pObjectContext->SetComplete();

  return S_OK;

ErrorHandler:

  Error(strErr, IID_ICreateTable);

  if (pObjectContext)
    pObjectContext->SetAbort();

  return hr;
}

STDMETHODIMP CCreateTable::InterfaceSupportsErrorInfo ( REFIID riid )

Definition at line 22 of file CreateTable.cpp.

{
  static const IID* arr[] = { &IID_ICreateTable };

  for (int i = 0; i < sizeof(arr) / sizeof(arr[0]); i++)
    if (InlineIsEqualGUID(*arr[i], riid))
      return S_OK;

  return S_FALSE;
}

The documentation for this class was generated from the following files:
  • Web/iis/Components/Cpp/MTXSample/CreateTable.h
  • Web/iis/Components/Cpp/MTXSample/CreateTable.cpp
Generated on Wed Nov 13 2024 16:55:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCriticalSection Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CCriticalSection Class Reference

#include "Critsect.h"

List of all members.

Public Member Functions

CCriticalSection (CRITICAL_SECTION *pcsect, DWORD dwThreadID)
~CCriticalSection ()
void | Enter ()
void | Leave ()

Private Attributes

DWORD cRefs
DWORD m_dwThreadID
CRITICAL_SECTION * | m_pcsect

Detailed Description

Definition at line 18 of file Critsect.h.

Constructor & Destructor Documentation

CCriticalSection::CCriticalSection | ( | CRITICAL_SECTION * | pcsect,
 |  | DWORD | dwThreadID |
 | ) |  |  | [inline]

Definition at line 25 of file Critsect.h.

    {
    m_pcsect = pcsect;
    cRefs = 0;
    m_dwThreadID = dwThreadID;
    };

CCriticalSection::~CCriticalSection ( ) [inline]

Definition at line 33 of file Critsect.h.

    {
    AssertSz(0 == cRefs,"UnReleased Critical Section");
    Assert(m_dwThreadID == GetCurrentThreadId());

    while(cRefs--) // unwind any left over cRefs
    {
        LeaveCriticalSection(m_pcsect);
    }

    };

Member Function Documentation

void CCriticalSection::Enter ( ) [inline]

Definition at line 45 of file Critsect.h.

    {
    EnterCriticalSection(m_pcsect);

    Assert(m_dwThreadID == GetCurrentThreadId());
    ++cRefs;

    Assert(1 == cRefs); // we don't allow nested calls.
    };

void CCriticalSection::Leave ( ) [inline]

Definition at line 55 of file Critsect.h.

    {
    Assert(m_dwThreadID == GetCurrentThreadId());
    Assert(0 < cRefs);

    if (0 >= cRefs)
        return;

    --cRefs;
    Assert(0 == cRefs);

    LeaveCriticalSection(m_pcsect);
    };

Member Data Documentation

DWORD CCriticalSection::cRefs [private]

Definition at line 20 of file Critsect.h.

DWORD CCriticalSection::m_dwThreadID [private]

Definition at line 22 of file Critsect.h.

CRITICAL_SECTION* CCriticalSection::m_pcsect [private]

Definition at line 21 of file Critsect.h.

The documentation for this class was generated from the following file:
  • NetDS/SyncMgr/SyncDir/Critsect.h
Generated on Wed Nov 13 2024 16:55:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCrmDebugCompensator Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CCrmDebugCompensator Class Reference

#include "CrmDebugCompensator.h"

List of all members.

Public Member Functions

CCrmDebugCompensator ()
HRESULT STDMETHODCALLTYPE | AbortRecord (CrmLogRecordRead crmLogRec, BOOL __RPC_FAR *pfForget)
HRESULT STDMETHODCALLTYPE | AbortRecordVariants (VARIANT __RPC_FAR *pLogRecord, VARIANT_BOOL __RPC_FAR *pbForget)
HRESULT STDMETHODCALLTYPE | BeginAbort (BOOL fRecovery)
HRESULT STDMETHODCALLTYPE | BeginAbortVariants (VARIANT_BOOL bRecovery)
HRESULT STDMETHODCALLTYPE | BeginCommit (BOOL fRecovery)
HRESULT STDMETHODCALLTYPE | BeginCommitVariants (VARIANT_BOOL bRecovery)
HRESULT STDMETHODCALLTYPE | BeginPrepare (void)
HRESULT STDMETHODCALLTYPE | BeginPrepareVariants (void)
HRESULT STDMETHODCALLTYPE | CommitRecord (CrmLogRecordRead crmLogRec, BOOL __RPC_FAR *pfForget)
HRESULT STDMETHODCALLTYPE | CommitRecordVariants (VARIANT __RPC_FAR *pLogRecord, VARIANT_BOOL __RPC_FAR *pbForget)
HRESULT STDMETHODCALLTYPE | EndAbort (void)
HRESULT STDMETHODCALLTYPE | EndAbortVariants (void)
HRESULT STDMETHODCALLTYPE | EndCommit (void)
HRESULT STDMETHODCALLTYPE | EndCommitVariants (void)
HRESULT STDMETHODCALLTYPE | EndPrepare (BOOL __RPC_FAR *pfOkToPrepare)
HRESULT STDMETHODCALLTYPE | EndPrepareVariants (VARIANT_BOOL __RPC_FAR *pbOkToPrepare)
HRESULT | FinalConstruct ()
void | FinalRelease ()
HRESULT STDMETHODCALLTYPE | PrepareRecord (CrmLogRecordRead crmLogRec, BOOL __RPC_FAR *pfForget)
HRESULT STDMETHODCALLTYPE | PrepareRecordVariants (VARIANT __RPC_FAR *pLogRecord, VARIANT_BOOL __RPC_FAR *pbForget)
HRESULT STDMETHODCALLTYPE | SetLogControl (ICrmLogControl __RPC_FAR *pLogControl)
HRESULT STDMETHODCALLTYPE | SetLogControlVariants (ICrmLogControl __RPC_FAR *pLogControl)

Public Attributes

CComPtr< IUnknown > | m_pUnkMarshaler

Detailed Description

Definition at line 73 of file CrmDebugCompensator.h.

Constructor & Destructor Documentation

CCrmDebugCompensator::CCrmDebugCompensator ( ) [inline]

Definition at line 81 of file CrmDebugCompensator.h.

  {
    m_pUnkMarshaler = NULL;
  }

Member Function Documentation

HRESULT STDMETHODCALLTYPE CCrmDebugCompensator::AbortRecord | ( | CrmLogRecordRead | crmLogRec,
 |  | BOOL __RPC_FAR * | pfForget
 | ) |  |

Definition at line 370 of file CrmDebugCompensator.Cpp.

{
  ATLTRACE(_T("CCrmDebugCompensator::AbortRecord\n"));

  _ASSERTE(pfForget);

  return S_OK;

} // CCrmDebugCompensator::AbortRecord

HRESULT STDMETHODCALLTYPE CCrmDebugCompensator::AbortRecordVariants | ( | VARIANT __RPC_FAR * | pLogRecord,
 |  | VARIANT_BOOL __RPC_FAR * | pbForget
 | ) |  |

Definition at line 620 of file CrmDebugCompensator.Cpp.

{
  ATLTRACE(_T("CCrmDebugCompensator::AbortRecordVariants\n"));

  _ASSERTE(pbForget);

  return S_OK;

} // CCrmDebugCompensator::AbortRecordVariants

HRESULT STDMETHODCALLTYPE CCrmDebugCompensator::BeginAbort ( BOOL fRecovery )

Definition at line 347 of file CrmDebugCompensator.Cpp.

{
  ATLTRACE(_T("CCrmDebugCompensator::BeginAbort\n"));

  return S_OK;

} // CCrmDebugCompensator::BeginAbort

HRESULT STDMETHODCALLTYPE CCrmDebugCompensator::BeginAbortVariants ( VARIANT_BOOL bRecovery )

Definition at line 597 of file CrmDebugCompensator.Cpp.

{
  ATLTRACE(_T("CCrmDebugCompensator::BeginAbortVariants\n"));

  return S_OK;

} // CCrmDebugCompensator::BeginAbortVariants

HRESULT STDMETHODCALLTYPE CCrmDebugCompensator::BeginCommit ( BOOL fRecovery )

Definition at line 275 of file CrmDebugCompensator.Cpp.

{
  ATLTRACE(_T("CCrmDebugCompensator::BeginCommit\n"));

  return S_OK;

} // CCrmDebugCompensator::BeginCommit

HRESULT STDMETHODCALLTYPE CCrmDebugCompensator::BeginCommitVariants ( VARIANT_BOOL bRecovery )

Definition at line 524 of file CrmDebugCompensator.Cpp.

{
  ATLTRACE(_T("CCrmDebugCompensator::BeginCommitVariants\n"));

  return S_OK;

} // CCrmDebugCompensator::BeginCommitVariants

HRESULT STDMETHODCALLTYPE CCrmDebugCompensator::BeginPrepare ( void )

Definition at line 200 of file CrmDebugCompensator.Cpp.

{
  ATLTRACE(_T("CCrmDebugCompensator::BeginPrepare\n"));

  return S_OK;

} // CCrmDebugCompensator::BeginPrepare

HRESULT STDMETHODCALLTYPE CCrmDebugCompensator::BeginPrepareVariants ( void )

Definition at line 447 of file CrmDebugCompensator.Cpp.

{
  ATLTRACE(_T("CCrmDebugCompensator::BeginPrepareVariants\n"));

  return S_OK;

} // CCrmDebugCompensator::BeginPrepareVariants

HRESULT STDMETHODCALLTYPE CCrmDebugCompensator::CommitRecord | ( | CrmLogRecordRead | crmLogRec,
 |  | BOOL __RPC_FAR * | pfForget
 | ) |  |

Definition at line 298 of file CrmDebugCompensator.Cpp.

{
  ATLTRACE(_T("CCrmDebugCompensator::CommitRecord\n"));

  _ASSERTE(pfForget);

  return S_OK;

} // CCrmDebugCompensator::CommitRecord

HRESULT STDMETHODCALLTYPE CCrmDebugCompensator::CommitRecordVariants | ( | VARIANT __RPC_FAR * | pLogRecord,
 |  | VARIANT_BOOL __RPC_FAR * | pbForget
 | ) |  |

Definition at line 547 of file CrmDebugCompensator.Cpp.

{
  ATLTRACE(_T("CCrmDebugCompensator::CommitRecordVariants\n"));

  _ASSERTE(pbForget);

  return S_OK;

} // CCrmDebugCompensator::CommitRecordVariants

HRESULT STDMETHODCALLTYPE CCrmDebugCompensator::EndAbort ( void )

Definition at line 397 of file CrmDebugCompensator.Cpp.

{
  ATLTRACE(_T("CCrmDebugCompensator::EndAbort\n"));

  return S_OK;

} // CCrmDebugCompensator::EndAbort

HRESULT STDMETHODCALLTYPE CCrmDebugCompensator::EndAbortVariants ( void )

Definition at line 647 of file CrmDebugCompensator.Cpp.

{
  ATLTRACE(_T("CCrmDebugCompensator::EndAbortVariants\n"));

  return S_OK;

} // CCrmDebugCompensator::EndAbortVariants

HRESULT STDMETHODCALLTYPE CCrmDebugCompensator::EndCommit ( void )

Definition at line 325 of file CrmDebugCompensator.Cpp.

{
  ATLTRACE(_T("CCrmDebugCompensator::EndCommit\n"));

  return S_OK;

} // CCrmDebugCompensator::EndCommit

HRESULT STDMETHODCALLTYPE CCrmDebugCompensator::EndCommitVariants ( void )

Definition at line 574 of file CrmDebugCompensator.Cpp.

{
  ATLTRACE(_T("CCrmDebugCompensator::EndCommitVariants\n"));

  return S_OK;

} // CCrmDebugCompensator::EndCommitVariants

HRESULT STDMETHODCALLTYPE CCrmDebugCompensator::EndPrepare ( BOOL __RPC_FAR * pfOkToPrepare )

Definition at line 247 of file CrmDebugCompensator.Cpp.

{
  ATLTRACE(_T("CCrmDebugCompensator::EndPrepare\n"));

  _ASSERTE(pfOkToPrepare);

  *pfOkToPrepare = TRUE;

  return S_OK;

} // CCrmDebugCompensator::EndPrepare

HRESULT STDMETHODCALLTYPE CCrmDebugCompensator::EndPrepareVariants ( VARIANT_BOOL __RPC_FAR * pbOkToPrepare )

Definition at line 496 of file CrmDebugCompensator.Cpp.

{
  ATLTRACE(_T("CCrmDebugCompensator::EndPrepareVariants\n"));

  _ASSERTE(pbOkToPrepare);

  *pbOkToPrepare = VARIANT_TRUE;

  return S_OK;

} // CCrmDebugCompensator::EndPrepareVariants

HRESULT CCrmDebugCompensator::FinalConstruct ( )

Definition at line 130 of file CrmDebugCompensator.Cpp.

{
  ATLTRACE(_T("CCrmDebugCompensator::FinalConstruct\n"));

  return CoCreateFreeThreadedMarshaler(
    GetControllingUnknown(), &m_pUnkMarshaler.p);

} // CCrmDebugCompensator::FinalConstruct

void CCrmDebugCompensator::FinalRelease ( )

Definition at line 151 of file CrmDebugCompensator.Cpp.

{
  ATLTRACE(_T("CCrmDebugCompensator::FinalRelease\n"));

  m_pUnkMarshaler.Release();

} // CCrmDebugCompensator::FinalRelease

HRESULT STDMETHODCALLTYPE CCrmDebugCompensator::PrepareRecord | ( | CrmLogRecordRead | crmLogRec,
 |  | BOOL __RPC_FAR * | pfForget
 | ) |  |

Definition at line 221 of file CrmDebugCompensator.Cpp.

{
  ATLTRACE(_T("CCrmDebugCompensator::PrepareRecord\n"));

  _ASSERTE(pfForget);

  return S_OK;

} // CCrmDebugCompensator::PrepareRecord

HRESULT STDMETHODCALLTYPE CCrmDebugCompensator::PrepareRecordVariants | ( | VARIANT __RPC_FAR * | pLogRecord,
 |  | VARIANT_BOOL __RPC_FAR * | pbForget
 | ) |  |

Definition at line 469 of file CrmDebugCompensator.Cpp.

{
  ATLTRACE(_T("CCrmDebugCompensator::PrepareRecordVariants\n"));

  _ASSERTE(pbForget);

  return S_OK;

} // CCrmDebugCompensator::PrepareRecordVariants

HRESULT CCrmDebugCompensator::SetLogControl ( ICrmLogControl __RPC_FAR * pLogControl )

Definition at line 174 of file CrmDebugCompensator.Cpp.

{
  ATLTRACE(_T("CCrmDebugCompensator::SetLogControl\n"));

  _ASSERTE(pLogControl);

  return S_OK;

} // CCrmDebugCompensator::SetLogControl

HRESULT STDMETHODCALLTYPE CCrmDebugCompensator::SetLogControlVariants ( ICrmLogControl __RPC_FAR * pLogControl )

Definition at line 421 of file CrmDebugCompensator.Cpp.

{
  ATLTRACE(_T("CCrmDebugCompensator::SetLogControlVariants\n"));

  _ASSERTE(pLogControl);

  return S_OK;

} // CCrmDebugCompensator::SetLogControlVariants

Member Data Documentation

CComPtr<IUnknown> CCrmDebugCompensator::m_pUnkMarshaler

Definition at line 110 of file CrmDebugCompensator.h.

The documentation for this class was generated from the following files:
  • Com/Services/Crm/CrmDebug/CrmDebugCompensator.h
  • Com/Services/Crm/CrmDebug/CrmDebugCompensator.Cpp
Generated on Wed Nov 13 2024 16:55:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCrmFilesCompensator Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CCrmFilesCompensator Class Reference

#include "CrmFilesCompensator.h"

List of all members.

Public Member Functions

CCrmFilesCompensator ()
HRESULT STDMETHODCALLTYPE | AbortRecord (CrmLogRecordRead crmLogRec, BOOL __RPC_FAR *pfForget)
HRESULT STDMETHODCALLTYPE | BeginAbort (BOOL fRecovery)
HRESULT STDMETHODCALLTYPE | BeginCommit (BOOL fRecovery)
HRESULT STDMETHODCALLTYPE | BeginPrepare (void)
HRESULT STDMETHODCALLTYPE | CommitRecord (CrmLogRecordRead crmLogRec, BOOL __RPC_FAR *pfForget)
HRESULT STDMETHODCALLTYPE | EndAbort (void)
HRESULT STDMETHODCALLTYPE | EndCommit (void)
HRESULT STDMETHODCALLTYPE | EndPrepare (BOOL __RPC_FAR *pfOkToPrepare)
HRESULT STDMETHODCALLTYPE | GetColumn (CrmLogRecordRead CrmLogRec, LPVARIANT pFormattedLogRecord)
HRESULT STDMETHODCALLTYPE | GetColumnCount (long __RPC_FAR *plColumnCount)
HRESULT STDMETHODCALLTYPE | GetColumnHeaders (LPVARIANT pHeaders)
HRESULT STDMETHODCALLTYPE | GetColumnVariants (VARIANT LogRecord, LPVARIANT pFormattedLogRecord)
HRESULT STDMETHODCALLTYPE | PrepareRecord (CrmLogRecordRead crmLogRec, BOOL __RPC_FAR *pfForget)
HRESULT STDMETHODCALLTYPE | SetLogControl (ICrmLogControl __RPC_FAR *pLogControl)

Private Member Functions

void | MakeVariantArray (int i_iNumVariants, _variant_t *i_vArray, LPVARIANT i_pVarSafeArray)
HRESULT | ProcessLogRecord (CrmLogRecordRead crmLogRec)

Private Attributes

CrmFilesCommandType m_CommandType
ICrmLogControl * | m_pICrmLogControl
WCHAR | m_wszSourceFileName [MAX_PATH]
WCHAR | m_wszTempFileName [MAX_PATH]

Detailed Description

Definition at line 77 of file CrmFilesCompensator.h.

Constructor & Destructor Documentation

CCrmFilesCompensator::CCrmFilesCompensator ( ) [inline]

Definition at line 85 of file CrmFilesCompensator.h.

                         :
     m_pICrmLogControl(NULL)
  {
  }

Member Function Documentation

HRESULT CCrmFilesCompensator::AbortRecord | ( | CrmLogRecordRead | crmLogRec,
 |  | BOOL __RPC_FAR * | pfForget
 | ) |  |

Definition at line 284 of file CrmFilesCompensator.Cpp.

{
    _ASSERTE(pfForget);

    *pfForget = FALSE;

    HRESULT hr = S_OK;

    hr = ProcessLogRecord(crmLogRec);

    _ASSERTE(S_OK == hr);

    if (ct_DeleteFile == m_CommandType)
    {
        // put back the original file

        // is it there already?

        WIN32_FIND_DATAW FindFileData;

        HANDLE hSearch = FindFirstFileW(
                                m_wszSourceFileName,
                                &FindFileData);

        bool fSourceFileExists = (INVALID_HANDLE_VALUE != hSearch);

        hSearch = FindFirstFileW(
                            m_wszTempFileName,
                            &FindFileData);

        bool fTempFileExists = (INVALID_HANDLE_VALUE != hSearch);

        if (!fSourceFileExists)
        {
            _ASSERTE(fTempFileExists);      // it had better exist, otherwise something is hosed

            // was not found, so move (rename) the temp file back

            DWORD dwFlags = MOVEFILE_WRITE_THROUGH;

            BOOL fRc = MoveFileExW(
                            m_wszTempFileName,
                  m_wszSourceFileName,
                            dwFlags);

            _ASSERTE(fRc);

        }

        // clean up temp file

        BOOL fRc = DeleteFileW(m_wszTempFileName);

        // NOTE: we do not care whether this succeeds or not... worst case we leave temp files around

    }

    else
    {
        _ASSERTE(ct_CreateFile == m_CommandType);

        // delete the file we created

        // does it exist?

        WIN32_FIND_DATAW FindFileData;

        HANDLE hSearch = FindFirstFileW(
                                m_wszSourceFileName,
                                &FindFileData);

        if (INVALID_HANDLE_VALUE != hSearch)
        {
            // the file exists, so we must delete it

            BOOL fRc = DeleteFileW(m_wszSourceFileName);

            // IGNORE ERRORS

            // allow for the case where we wrote the log record, but did not create the file

        }
    }

    // OPTIONAL - forget this record

     *pfForget = TRUE;

    // NOTE: this forget is not forced - could force on next record if required

    return S_OK;

} // CCrmFilesCompensator::AbortRecord

HRESULT CCrmFilesCompensator::BeginAbort ( BOOL fRecovery )

Definition at line 263 of file CrmFilesCompensator.Cpp.

{
    // do nothing

    return S_OK;

} // CCrmFilesCompensator::BeginAbort

HRESULT CCrmFilesCompensator::BeginCommit ( BOOL fRecovery )

Definition at line 173 of file CrmFilesCompensator.Cpp.

{
    // do nothing

    return S_OK;

} // CCrmFilesCompensator::BeginCommit

HRESULT CCrmFilesCompensator::BeginPrepare ( void )

Definition at line 100 of file CrmFilesCompensator.Cpp.

{
    // do nothing

    return S_OK;

} // CCrmFilesCompensator::BeginPrepare

HRESULT CCrmFilesCompensator::CommitRecord | ( | CrmLogRecordRead | crmLogRec,
 |  | BOOL __RPC_FAR * | pfForget
 | ) |  |

Definition at line 194 of file CrmFilesCompensator.Cpp.

{
    _ASSERTE(pfForget);

    *pfForget = FALSE;

    HRESULT hr = S_OK;

    hr = ProcessLogRecord(crmLogRec);

    _ASSERTE(S_OK == hr);

    if (ct_DeleteFile == m_CommandType)
    {
        // clean up temp file

        BOOL fRc = DeleteFileW(m_wszTempFileName);

        // NOTE: we do not care whether this succeeds or not... worst case we leave temp files around
    }

    // no cleanup required for "create file"

    // OPTIONAL - forget this record

     *pfForget = TRUE;

    // NOTE: this forget is not forced - could force on next record if required

    return S_OK;

} // CCrmFilesCompensator::CommitRecord

HRESULT CCrmFilesCompensator::EndAbort ( void )

Definition at line 393 of file CrmFilesCompensator.Cpp.

{
    // do nothing

    return S_OK;

} // CCrmFilesCompensator::EndAbort

HRESULT CCrmFilesCompensator::EndCommit ( void )

Definition at line 242 of file CrmFilesCompensator.Cpp.

{
    // do nothing

    return S_OK;

} // CCrmFilesCompensator::EndCommit

HRESULT CCrmFilesCompensator::EndPrepare ( BOOL __RPC_FAR * pfOkToPrepare )

Definition at line 147 of file CrmFilesCompensator.Cpp.

{
    // always vote yes

    _ASSERTE(pfOkToPrepare);

    *pfOkToPrepare = TRUE;

    return S_OK;

} // CCrmFilesCompensator::EndPrepare

HRESULT STDMETHODCALLTYPE CCrmFilesCompensator::GetColumn | ( | CrmLogRecordRead | CrmLogRec,
 |  | LPVARIANT | pFormattedLogRecord
 | ) |  |

Definition at line 586 of file CrmFilesCompensator.Cpp.

{
  HRESULT hr = S_OK;

    hr = ProcessLogRecord(CrmLogRec);

  _ASSERTE(S_OK == hr);

  _variant_t vFields[3];

  if (ct_CreateFile == m_CommandType)
  {
    vFields[0] = L"CreateFile";

    vFields[2] = L"<None>";
  }
  else
  {
    vFields[0] = L"DeleteFile";

    vFields[2] = _variant_t(m_wszTempFileName);
  }

  vFields[1] = _variant_t(m_wszSourceFileName);

  MakeVariantArray(3, vFields, pFormattedLogRecord);

  return S_OK;

} // CCrmFilesCompensator::GetColumn

HRESULT STDMETHODCALLTYPE CCrmFilesCompensator::GetColumnCount ( long __RPC_FAR * plColumnCount )

Definition at line 474 of file CrmFilesCompensator.Cpp.

{
  _ASSERTE(plColumnCount);

  *plColumnCount = 3;

  return S_OK;

} // CCrmFilesCompensator::GetColumnCount

HRESULT STDMETHODCALLTYPE CCrmFilesCompensator::GetColumnHeaders ( LPVARIANT pHeaders )

Definition at line 497 of file CrmFilesCompensator.Cpp.

{
  _ASSERTE(pHeaders);

  _variant_t vCols[3] = { L"Command Type", L"Source File", L"Temp File" };

  MakeVariantArray(3, vCols, pHeaders);

  return S_OK;

} // CCrmFilesCompensator::GetColumnHeaders

HRESULT STDMETHODCALLTYPE CCrmFilesCompensator::GetColumnVariants | ( | VARIANT | LogRecord,
 |  | LPVARIANT | pFormattedLogRecord
 | ) |  |

Definition at line 635 of file CrmFilesCompensator.Cpp.

{
  _ASSERTE(!"NOT IMPLEMENTED");

  return E_FAIL;

} // CCrmFilesCompensator::GetColumnVariants

void CCrmFilesCompensator::MakeVariantArray | ( | int | i_iNumVariants,
 |  | _variant_t * | i_vArray,
 |  | LPVARIANT | i_pVarSafeArray |
 | ) |  |  | [private]

Definition at line 526 of file CrmFilesCompensator.Cpp.

{
    SAFEARRAYBOUND sab;

    sab.cElements = i_iNumVariants;

    sab.lLbound = 1;                    // VB convention

    SAFEARRAY * pSa;

    pSa = SafeArrayCreate(VT_VARIANT, 1, &sab);

    _ASSERTE(pSa);

    VARIANT * pSaVars = NULL;

    SafeArrayAccessData(pSa, (PVOID*)&pSaVars);

    _ASSERTE(pSaVars);

    // copy from the original array to the SafeArray

  for (int i = 0; i < i_iNumVariants; i++)
  {
    // put them in the SafeArray

    pSaVars[i] = i_vArray[i];
  }

    // done filling the SafeArray, put it in a variant

    SafeArrayUnaccessData(pSa);

    _ASSERTE(i_pVarSafeArray);

    i_pVarSafeArray->vt = VT_ARRAY | VT_VARIANT;      // array of variants

    i_pVarSafeArray->parray = pSa;

} // CCrmFilesCompensator::MakeVariantArray

HRESULT CCrmFilesCompensator::PrepareRecord | ( | CrmLogRecordRead | crmLogRec,
 |  | BOOL __RPC_FAR * | pfForget
 | ) |  |

Definition at line 120 of file CrmFilesCompensator.Cpp.

{
    _ASSERTE(pfForget);

    *pfForget = FALSE;

    // do nothing

    return S_OK;

} // CCrmFilesCompensator::PrepareRecord

HRESULT CCrmFilesCompensator::ProcessLogRecord ( CrmLogRecordRead crmLogRec ) [private]

Definition at line 415 of file CrmFilesCompensator.Cpp.

{
    ZeroMemory(&m_wszSourceFileName, MAX_PATH * sizeof(WCHAR));

    ZeroMemory(&m_wszTempFileName, MAX_PATH * sizeof(WCHAR));

    // what kind of log record did we get?

    // initially assume a "create file" log record

    CrmFilesCreateFileLogRecord * pCreateFileRec = (CrmFilesCreateFileLogRecord *)crmLogRec.blobUserData.pBlobData;

    m_CommandType = pCreateFileRec->CommandType;

    if (ct_CreateFile == m_CommandType)
    {
        WCHAR * pName = (WCHAR *)(pCreateFileRec + 1);      // skip over header

    _ASSERTE(pName != NULL);
        wcsncpy(m_wszSourceFileName, pName, pCreateFileRec->dwSourceSize);
    }

    else
    {
        _ASSERTE(ct_DeleteFile == m_CommandType);

        CrmFilesDeleteFileLogRecord * pDeleteFileRec = (CrmFilesDeleteFileLogRecord *)pCreateFileRec;

        // get the source name

        WCHAR * pName = (WCHAR *)(pDeleteFileRec + 1);      // skip over header
    _ASSERTE(pName != NULL);
        wcsncpy(m_wszSourceFileName, pName, pDeleteFileRec->dwSourceSize);

        // get the temp name

        pName += pDeleteFileRec->dwSourceSize;              // skip over source name
    _ASSERTE(pName != NULL);
        wcsncpy(m_wszTempFileName, pName, pDeleteFileRec->dwTempSize);
    }

    return S_OK;

} // CCrmFilesCompensator::ProcessLogRecord

HRESULT CCrmFilesCompensator::SetLogControl ( ICrmLogControl __RPC_FAR * pLogControl )

Definition at line 77 of file CrmFilesCompensator.Cpp.

{
    m_pICrmLogControl = pLogControl;

    _ASSERTE(m_pICrmLogControl);

    return S_OK;

} // CCrmFilesCompensator::SetLogControl

Member Data Documentation

CrmFilesCommandType CCrmFilesCompensator::m_CommandType [private]

Definition at line 173 of file CrmFilesCompensator.h.

ICrmLogControl* CCrmFilesCompensator::m_pICrmLogControl [private]

Definition at line 171 of file CrmFilesCompensator.h.

WCHAR CCrmFilesCompensator::m_wszSourceFileName[MAX_PATH] [private]

Definition at line 175 of file CrmFilesCompensator.h.

WCHAR CCrmFilesCompensator::m_wszTempFileName[MAX_PATH] [private]

Definition at line 177 of file CrmFilesCompensator.h.

The documentation for this class was generated from the following files:
  • Com/Services/Crm/CrmFiles/CrmFilesCompensator.h
  • Com/Services/Crm/CrmFiles/CrmFilesCompensator.Cpp
Generated on Wed Nov 13 2024 16:55:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCrmFilesTest Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Private Types | Private Member Functions | Private Attributes

CCrmFilesTest Class Reference

#include "CrmFilesTestObj.h"

List of all members.

Public Member Functions

CCrmFilesTest ()
STDMETHOD() | Abort ()
STDMETHOD() | Activate ()
STDMETHOD() | Commit ()
STDMETHOD() | CreateFile ()
STDMETHOD() | DeleteFile ()
STDMETHOD() | put_FileName (BSTR newVal)
STDMETHOD() | put_Language (long newVal)
STDMETHOD_ (void, Deactivate)()
STDMETHOD_ (BOOL, CanBePooled)()

Public Attributes

CComPtr< IObjectContext > | m_spObjectContext

Private Types

enum | { crm_VC, crm_VB, crm_VJ, crm_Total }

Private Member Functions

HRESULT | GetCorrectCRM (void)

Private Attributes

_bstr_t | m_bstrFileName
long | m_lLanguage
ICrmFilesWorker * | m_pICrmFilesWorker [crm_Total]
ICrmFilesWorker * | m_pICrmFilesWorkerCurrent

Detailed Description

Definition at line 76 of file CrmFilesTestObj.h.

Member Enumeration Documentation

anonymous enum [private]
Enumerator:
crm_VC
crm_VB
crm_VJ
crm_Total

Definition at line 121 of file CrmFilesTestObj.h.

{ crm_VC, crm_VB, crm_VJ, crm_Total };

Constructor & Destructor Documentation

CCrmFilesTest::CCrmFilesTest ( ) [inline]

Definition at line 83 of file CrmFilesTestObj.h.

                  :
   m_lLanguage(0)
  ,m_pICrmFilesWorkerCurrent(NULL)
  {
  }

Member Function Documentation

STDMETHODIMP CCrmFilesTest::Abort ( )

Definition at line 269 of file CrmFilesTestObj.Cpp.

{
  ATLTRACE(_T("CCrmFilesTest::Abort\r\n"));

  IObjectContext * pContext = m_spObjectContext;

  HRESULT hr = pContext->SetAbort();

  _ASSERTE((S_OK == hr) || (CONTEXT_E_ABORTED == hr));

  return S_OK;

} // CCrmFilesTest::Abort

HRESULT CCrmFilesTest::Activate ( void )

Definition at line 72 of file CrmFilesTestObj.Cpp.

{
  ATLTRACE(_T("CCrmFilesTest::Activate\r\n"));

  m_lLanguage = 0;  // VC is default

  m_pICrmFilesWorkerCurrent = NULL;

  for (int i = 0; i < crm_Total; i++)
  {
    m_pICrmFilesWorker[i] = NULL;
  }

  HRESULT hr = CoGetObjectContext(IID_IObjectContext, (void**)&m_spObjectContext);
  if (SUCCEEDED(hr))
    return S_OK;
  return hr;

} // CCrmFilesTest::Activate

STDMETHODIMP CCrmFilesTest::Commit ( )

Definition at line 242 of file CrmFilesTestObj.Cpp.

{
  ATLTRACE(_T("CCrmFilesTest::Commit\r\n"));

  IObjectContext * pContext = m_spObjectContext;

  HRESULT hr = pContext->SetComplete();

  _ASSERTE((S_OK == hr) || (CONTEXT_E_ABORTED == hr));

  return S_OK;

} // CCrmFilesTest::Commit

STDMETHODIMP CCrmFilesTest::CreateFile ( )

Definition at line 184 of file CrmFilesTestObj.Cpp.

{
  ATLTRACE(_T("CCrmFilesTest::CreateFile\r\n"));

  HRESULT hr = S_OK;

  hr = GetCorrectCRM();

  if (hr != S_OK) return hr;

  hr = m_pICrmFilesWorkerCurrent->CreateFile(m_bstrFileName);

  return hr;

} // CCrmFilesTest::CreateFile

STDMETHODIMP CCrmFilesTest::DeleteFile ( )

Definition at line 213 of file CrmFilesTestObj.Cpp.

{
  ATLTRACE(_T("CCrmFilesTest::DeleteFile\r\n"));

  HRESULT hr = S_OK;

  hr = GetCorrectCRM();

  if (hr != S_OK) return hr;

  hr = m_pICrmFilesWorkerCurrent->DeleteFile(m_bstrFileName);

  return hr;

} // CCrmFilesTest::DeleteFile

HRESULT CCrmFilesTest::GetCorrectCRM ( void ) [private]

Definition at line 320 of file CrmFilesTestObj.Cpp.

{
  ATLTRACE(_T("CCrmFilesTest::GetCorrectCRM\r\n"));

  // if we already have the required CRM, select it

  if (m_pICrmFilesWorker[m_lLanguage])
  {
    m_pICrmFilesWorkerCurrent = m_pICrmFilesWorker[m_lLanguage];

    return S_OK;
  }

  // need to create a new CRM Worker

  HRESULT hr = S_OK;

  const wchar_t* pszProgID = NULL;
    CLSID clsid;

  switch (m_lLanguage)
  {
    case 0: // VC

      pszProgID = L"CrmFilesWorker.CrmFilesWorker.1";
      hr = CLSIDFromProgID(pszProgID, &clsid);

      break;

    case 1: // VB

      pszProgID = L"CrmFilesVB.CrmFilesWorkerVB";
      hr = CLSIDFromProgID(pszProgID, &clsid);

      break;

    case 2: // VJ

      pszProgID = L"crmfilesvj.Worker";
      hr = CLSIDFromProgID(pszProgID, &clsid);

      break;

    default:

      _ASSERTE("ERROR: unknown language type");

      break;

  }; // switch

    _ASSERTE(S_OK == hr);

    // get the CrmFiles CRM Worker

  #if 0
    // don't use smart pointer so we don't have to catch com errors
    IObjectContext * pContext = m_spObjectContext;
  #endif

    hr = CoCreateInstance(
                        clsid,
             NULL, CLSCTX_ALL,
                        __uuidof(ICrmFilesWorker),
                        (void **)&m_pICrmFilesWorker[m_lLanguage]);

    _ASSERTE(S_OK == hr);
    _ASSERTE(m_pICrmFilesWorker[m_lLanguage]);

  m_pICrmFilesWorkerCurrent = m_pICrmFilesWorker[m_lLanguage];

  return S_OK;

} // CCrmFilesTest::GetCorrectCRM

STDMETHODIMP CCrmFilesTest::put_FileName ( BSTR newVal )

Definition at line 161 of file CrmFilesTestObj.Cpp.

{
  ATLTRACE(_T("CCrmFilesTest::put_FileName\r\n"));

  m_bstrFileName = newVal;

  return S_OK;

} // CCrmFilesTest::put_FileName

STDMETHODIMP CCrmFilesTest::put_Language ( long newVal )

Definition at line 295 of file CrmFilesTestObj.Cpp.

{
  ATLTRACE(_T("CCrmFilesTest::put_Language\r\n"));

  m_lLanguage = newVal;

  return S_OK;

} // CCrmFilesTest::put_Language

CCrmFilesTest::STDMETHOD_ | ( | void | ,
 |  | Deactivate |
 | ) |  |
CCrmFilesTest::STDMETHOD_ | ( | BOOL | ,
 |  | CanBePooled |
 | ) |  |

Member Data Documentation

_bstr_t CCrmFilesTest::m_bstrFileName [private]

Definition at line 125 of file CrmFilesTestObj.h.

long CCrmFilesTest::m_lLanguage [private]

Definition at line 123 of file CrmFilesTestObj.h.

ICrmFilesWorker* CCrmFilesTest::m_pICrmFilesWorker[crm_Total] [private]

Definition at line 129 of file CrmFilesTestObj.h.

ICrmFilesWorker* CCrmFilesTest::m_pICrmFilesWorkerCurrent [private]

Definition at line 127 of file CrmFilesTestObj.h.

CComPtr<IObjectContext> CCrmFilesTest::m_spObjectContext

Definition at line 104 of file CrmFilesTestObj.h.

The documentation for this class was generated from the following files:
  • Com/Services/Crm/CrmFilesTest/CrmFilesTestObj.h
  • Com/Services/Crm/CrmFilesTest/CrmFilesTestObj.Cpp
Generated on Wed Nov 13 2024 16:55:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCrmFilesWorker Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CCrmFilesWorker Class Reference

#include "CrmFilesWorker.h"

List of all members.

Public Member Functions

CCrmFilesWorker ()
~CCrmFilesWorker ()
HRESULT STDMETHODCALLTYPE | Activate (void)
BOOL STDMETHODCALLTYPE | CanBePooled (void)
STDMETHOD() | CreateFile (BSTR bstrFileName)
void STDMETHODCALLTYPE | Deactivate (void)
STDMETHOD() | DeleteFile (BSTR bstrFileName)

Private Member Functions

HRESULT | GetCrmLogControl (void)

Private Attributes

int | m_id
ICrmLogControl * | m_pICrmLogControl

Detailed Description

Definition at line 114 of file CrmFilesWorker.h.

Constructor & Destructor Documentation

CCrmFilesWorker::CCrmFilesWorker ( )

Definition at line 202 of file CrmFilesWorker.Cpp.

                                 :
 m_pICrmLogControl(NULL)
{
  srand((unsigned)time(NULL));

  m_id = rand();

  ATLTRACE(_T("CCrmFilesWorker constructor = %08lX, %d\r\n"), this, m_id);

} // CCrmFilesWorker constructor

CCrmFilesWorker::~CCrmFilesWorker ( )

Definition at line 223 of file CrmFilesWorker.Cpp.

{
  ATLTRACE(_T("CCrmFilesWorker destructor = %08lX, %d\r\n"), this, m_id);

    if (m_pICrmLogControl)
    {
        m_pICrmLogControl->Release();
    }

    m_pICrmLogControl = NULL;

} // CCrmFilesWorker destructor

Member Function Documentation

HRESULT STDMETHODCALLTYPE CCrmFilesWorker::Activate ( void )

Definition at line 83 of file CrmFilesWorker.Cpp.

{
  ATLTRACE(_T("CCrmFilesWorker::Activate = %08lX, %d\r\n"), this, m_id);

  m_pICrmLogControl = NULL;

  return S_OK;

} // CCrmFilesWorker::Activate

BOOL STDMETHODCALLTYPE CCrmFilesWorker::CanBePooled ( void )

Definition at line 132 of file CrmFilesWorker.Cpp.

{
  ATLTRACE(_T("CCrmFilesWorker::CanBePooled = %08lX, %d\r\n"), this, m_id);

  return TRUE;

} // CCrmFilesWorker::CanBePooled

STDMETHODIMP CCrmFilesWorker::CreateFile ( BSTR bstrFileName )

Definition at line 302 of file CrmFilesWorker.Cpp.

{
    HRESULT hr = S_OK;

  if (NULL == m_pICrmLogControl)
    {
        hr = GetCrmLogControl();

        _ASSERTE(S_OK == hr);

        if (hr != S_OK)
        {
            return hr;
        }
    }

    _ASSERTE(m_pICrmLogControl);

    // does the file already exist?

    // We must do this because if the file already exists we will fail to create it. The transaction
    // will then abort, and as part of the abort we delete the file that we think we created -
    // so in this case we might end up deleting a file that we did not create.

  HANDLE hFile = ::CreateFileW(
                        bstrFileName,             // pointer to name of the file
                GENERIC_WRITE,              // access (read-write) mode
                0L,                         // share mode
                NULL,                     // pointer to security descriptor
                OPEN_EXISTING,              // how to create
                FILE_ATTRIBUTE_NORMAL,      // file attributes
                NULL);                      // handle to file with attributes to copy

  if (INVALID_HANDLE_VALUE != hFile)
  {
        // file already exists

        CloseHandle(hFile);

      hr = m_pICrmLogControl->ForceTransactionToAbort();

        return hr;
  }

    // WRITE AHEAD - log that we are about to create the file

    CrmFilesCreateFileLogRecord cfr;

    cfr.CommandType = ct_CreateFile;

  _ASSERTE(bstrFileName != NULL);

  cfr.dwSourceSize = (DWORD) wcslen(bstrFileName);

    BLOB blobs[2];

    blobs[0].pBlobData = (BYTE *)&cfr;

    blobs[0].cbSize = sizeof(cfr);

    // avoid copying the file name

    blobs[1].pBlobData = (BYTE *)bstrFileName;

    // wcslen returns # of chars in string, we need # of bytes
  _ASSERTE(bstrFileName != NULL);

    UINT uNumChars = (UINT) wcslen(bstrFileName);

    blobs[1].cbSize = uNumChars * sizeof(WCHAR);

    // write the "create file" log record

    hr = m_pICrmLogControl->WriteLogRecord(
                                blobs,
                                2);
    _ASSERTE(S_OK == hr);

    // force the log to ensure this log record is durable in the log

    hr = m_pICrmLogControl->ForceLog();

    _ASSERTE(S_OK == hr);

    // TRY TO CREATE THE FILE

  hFile = ::CreateFileW(
                    bstrFileName,       // pointer to name of the file
            GENERIC_WRITE,              // access (read-write) mode
            0L,                         // share mode
            NULL,                     // pointer to security descriptor
            CREATE_NEW,                 // how to create
            FILE_ATTRIBUTE_NORMAL,      // file attributes
            NULL);                      // handle to file with attributes to copy

  if (INVALID_HANDLE_VALUE == hFile)
  {
        DWORD dwErr = GetLastError();

      hr = m_pICrmLogControl->ForceTransactionToAbort();

        return hr;
  }

  CloseHandle(hFile);

  return S_OK;

} // CCrmFilesWorker::CreateFile

void STDMETHODCALLTYPE CCrmFilesWorker::Deactivate ( void )

Definition at line 107 of file CrmFilesWorker.Cpp.

{
  ATLTRACE(_T("CCrmFilesWorker::Deactivate = %08lX, %d\r\n"), this, m_id);

    if (m_pICrmLogControl)
    {
        m_pICrmLogControl->Release();
    }

    m_pICrmLogControl = NULL;

} // CCrmFilesWorker::Deactivate

STDMETHODIMP CCrmFilesWorker::DeleteFile ( BSTR bstrFileName )

Definition at line 426 of file CrmFilesWorker.Cpp.

{
    HRESULT hr = S_OK;

  if (NULL == m_pICrmLogControl)
    {
        hr = GetCrmLogControl();

        _ASSERTE(S_OK == hr);

    }

    _ASSERTE(m_pICrmLogControl);

    // does the file exist?

    // We must do this because MoveFileEx has the unfortunate effect that it will create the
    // destination file even if the source file does not exist. If we allowed this to occur,
    // then during compensation we might put back a file that never originally existed.

  HANDLE hFile = ::CreateFileW(
                        bstrFileName,       // pointer to name of the file
                GENERIC_WRITE,              // access (read-write) mode
                0L,                         // share mode
                NULL,                     // pointer to security descriptor
                OPEN_EXISTING,              // how to create
                FILE_ATTRIBUTE_NORMAL,      // file attributes
                NULL);                      // handle to file with attributes to copy

  if (INVALID_HANDLE_VALUE == hFile)
  {
        DWORD dwErr = GetLastError();

      hr = m_pICrmLogControl->ForceTransactionToAbort();

        return hr;
  }

  CloseHandle(hFile);

    // file exists - there is a window here in which it might be deleted by someone else

    WCHAR wszTempFile[MAX_PATH];

    ZeroMemory(wszTempFile, MAX_PATH * sizeof(WCHAR));

    // the file name itself will be unique, so use it

    lstrcatW(wszTempFile, bstrFileName);

    lstrcatW(wszTempFile, L".crmtemp");

    // WRITE AHEAD - log that we are about to delete (rename) the file

    CrmFilesDeleteFileLogRecord dfr;

    dfr.CommandType = ct_DeleteFile;

  _ASSERTE(bstrFileName != NULL);
    dfr.dwSourceSize = (DWORD) wcslen(bstrFileName);

  _ASSERTE(wszTempFile != NULL);
    dfr.dwTempSize = (DWORD) wcslen(wszTempFile);

    BLOB blobs[3];

    blobs[0].pBlobData = (BYTE *)&dfr;

    blobs[0].cbSize = sizeof(dfr);

    // avoid copying the source file name

    blobs[1].pBlobData = (BYTE *)bstrFileName;

    // wcslen returns # of chars in string, we need # of bytes

  _ASSERTE(bstrFileName != NULL);
    UINT uNumChars = (UINT) wcslen(bstrFileName);

    blobs[1].cbSize = uNumChars * sizeof(WCHAR);

    // avoid copying the temp file name

    blobs[2].pBlobData = (BYTE *)wszTempFile;

  _ASSERTE(wszTempFile != NULL);
    uNumChars = (UINT) wcslen(wszTempFile);

    blobs[2].cbSize = uNumChars * sizeof(WCHAR);

    // write the "delete file" log record

    hr = m_pICrmLogControl->WriteLogRecord(
                                blobs,
                                3);
    _ASSERTE(S_OK == hr);

    // force the log to ensure this log record is durable in the log

    hr = m_pICrmLogControl->ForceLog();

    _ASSERTE(S_OK == hr);

    // TRY TO RENAME THE FILE TO A CRM###.TMP FILE

    DWORD dwFlags = MOVEFILE_REPLACE_EXISTING | MOVEFILE_COPY_ALLOWED | MOVEFILE_WRITE_THROUGH;

    BOOL fRc = MoveFileExW(
                    bstrFileName,
          wszTempFile,
                    dwFlags);

    if (!fRc)
    {
        DWORD dwErr = GetLastError();

      hr = m_pICrmLogControl->ForceTransactionToAbort();

        return hr;
    }

  return hr;

} // CCrmFilesWorker::DeleteFile

HRESULT CCrmFilesWorker::GetCrmLogControl ( void ) [private]

Definition at line 248 of file CrmFilesWorker.Cpp.

{
    HRESULT hr = S_OK;

    _ASSERTE(NULL == m_pICrmLogControl);

  hr = CoCreateInstance(
        __uuidof(CRMClerk),
        NULL,
        CLSCTX_INPROC_SERVER,
        __uuidof(ICrmLogControl),
        (void **)&m_pICrmLogControl);

  _ASSERTE(S_OK == hr);
  _ASSERTE(m_pICrmLogControl);

  // try to register our CRM Compensator (try 5X if recovery is in progress)

    for (int i = 0; i < 5; i++)
    {
        hr = m_pICrmLogControl->RegisterCompensator(
                                    L"CrmFilesCompensator.CrmFilesCompensator.1",
                                    L"description goes here",
                  CRMREGFLAG_ALLPHASES);

        if (XACT_E_RECOVERYINPROGRESS == hr)
        {
            Sleep(1000);

            continue;       // try again
        }

        break;
    }

    _ASSERTE(hr == S_OK);

    return hr;

} // CCrmFilesWorker::GetCrmLogControl

Member Data Documentation

int CCrmFilesWorker::m_id [private]

Definition at line 164 of file CrmFilesWorker.h.

ICrmLogControl* CCrmFilesWorker::m_pICrmLogControl [private]

Definition at line 162 of file CrmFilesWorker.h.

The documentation for this class was generated from the following files:
  • Com/Services/Crm/CrmFiles/CrmFilesWorker.h
  • Com/Services/Crm/CrmFiles/CrmFilesWorker.Cpp
Generated on Wed Nov 13 2024 16:55:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCrmMonComp Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes

CCrmMonComp Class Reference

#include "CrmMonCompObj.h"

List of all members.

Public Member Functions

CCrmMonComp ()
STDMETHOD() | AbortTransaction ()
HRESULT | FinalConstruct ()
void | FinalRelease ()
STDMETHOD() | get_ActivityId (VARIANT *pVal)
STDMETHOD() | get_ColumnHeaders (VARIANT *pVal)
STDMETHOD() | get_Description (VARIANT *pVal)
STDMETHOD() | get_FindClerks (long *plNumberOfClerks)
STDMETHOD() | get_FormattedRecord (VARIANT *pVal)
STDMETHOD() | get_NumberOfLogRecords (long *pVal)
STDMETHOD() | get_ProgId (VARIANT *pVal)
STDMETHOD() | get_TransactionState (VARIANT *pVal)
STDMETHOD() | put_TransactionUOW (VARIANT newVal)
STDMETHOD() | SetClerk (long lClerkNumber)
STDMETHOD() | SetRecord (long lRecordNumber)

Public Attributes

CComPtr< IUnknown > | m_pUnkMarshaler

Private Member Functions

HRESULT | CreateCompensator (void)

Private Attributes

long | m_lClerkNumber
long | m_lRecordNumber
ICrmFormatLogRecords * | m_pICrmFormatLogRecords
ICrmMonitor * | m_pICrmMonitor
ICrmMonitorClerks * | m_pICrmMonitorClerks
_variant_t | m_vActivityId
VEC_CLERKS m_vecClerks
_variant_t | m_vTxUOWRequired

Detailed Description

Definition at line 88 of file CrmMonCompObj.h.

Constructor & Destructor Documentation

CCrmMonComp::CCrmMonComp ( ) [inline]

Definition at line 94 of file CrmMonCompObj.h.

                :
   m_pICrmMonitor(NULL)
  ,m_pICrmMonitorClerks(NULL)
  ,m_lClerkNumber(0)
  ,m_lRecordNumber(0)
  ,m_pICrmFormatLogRecords(NULL)
  {
    m_pUnkMarshaler = NULL;
  }

Member Function Documentation

STDMETHODIMP CCrmMonComp::AbortTransaction ( )

Definition at line 593 of file CrmMonCompObj.Cpp.

{
  long lNumClerks = (long) m_vecClerks.size();

  if (0 == lNumClerks)
  {
    ATLTRACE(_T("ERROR: no clerks\r\n"));

    return E_FAIL;
  }

  HRESULT hr = S_OK;

  // transaction will be same for all clerks - get 1st clerk

  CLERK_ENTRY * pce = m_vecClerks.front();

  _ASSERTE(pce);

  ICrmMonitorLogRecords * pICrmMonitorLogRecords = pce->m_pICrmMonitorLogRecords;

  _ASSERTE(pICrmMonitorLogRecords);

  ICrmLogControl * pICrmLogControl = NULL;

  hr = pICrmMonitorLogRecords->QueryInterface(
                    __uuidof(ICrmLogControl),
                    (void **)&pICrmLogControl);

  _ASSERTE(S_OK == hr);
  _ASSERTE(pICrmLogControl);

  hr = pICrmLogControl->ForceTransactionToAbort();

  if (hr != S_OK)
  {
    ATLTRACE(_T("ForceTransactionToAbort, hr = %08lX\r\n"), hr);
  }

  pICrmLogControl->Release();

  return S_OK;

} // CCrmMonComp::AbortTransaction

HRESULT CCrmMonComp::CreateCompensator ( void ) [private]

Definition at line 670 of file CrmMonCompObj.Cpp.

{
  HRESULT hr = S_OK;

  // find the Prog Id

  _variant_t vProgId;

  hr = get_ProgId(&vProgId);

  if (hr != S_OK) return hr;

  // convert the Prog Id to a CLSID

  _bstr_t bstrProgId = vProgId;

  CLSID clsidCompensator;

  hr = CLSIDFromProgID((LPCOLESTR)bstrProgId, &clsidCompensator);

  if (S_OK != hr)
  {
    // attempt to convert stringized CLSID

    hr = CLSIDFromString((LPOLESTR)bstrProgId, &clsidCompensator);
  }

  if (hr != S_OK) return hr;

  // create the compensator - it should be there

  IUnknown * punkCompensator = NULL;

  hr = CoCreateInstance(
      clsidCompensator,
      NULL,
      CLSCTX_ALL,
      __uuidof(IUnknown),
      (void **)&punkCompensator);

  _ASSERTE(S_OK == hr);
  _ASSERTE(punkCompensator);

  // does the compensator support ICrmFormatLogRecords?

  hr = punkCompensator->QueryInterface(
        __uuidof(ICrmFormatLogRecords),
        (void **)&m_pICrmFormatLogRecords);

  punkCompensator->Release();

  if (E_NOINTERFACE == hr)
  {
    m_pICrmFormatLogRecords = NULL;

    return S_OK;
  }

  _ASSERTE(S_OK == hr);
  _ASSERTE(m_pICrmFormatLogRecords);

  return S_OK;

} // CCrmMonComp::CreateCompensator

HRESULT CCrmMonComp::FinalConstruct ( )

Definition at line 75 of file CrmMonCompObj.Cpp.

{
  HRESULT hr = S_OK;

  hr = CoCreateInstance(
      __uuidof(CRMRecoveryClerk),
      NULL,
      CLSCTX_INPROC_SERVER,
      __uuidof(ICrmMonitor),
      (void **)&m_pICrmMonitor);

  _ASSERTE(S_OK == hr);
  _ASSERTE(m_pICrmMonitor);

  return CoCreateFreeThreadedMarshaler(
    GetControllingUnknown(), &m_pUnkMarshaler.p);

} // CCrmMonComp::FinalConstruct

void CCrmMonComp::FinalRelease ( )

Definition at line 106 of file CrmMonCompObj.Cpp.

{
  if (m_pICrmMonitorClerks)
  {
    m_pICrmMonitorClerks->Release();

    m_pICrmMonitorClerks = NULL;
  }

  // clean up clerks array

  for (int i = 0; i < m_vecClerks.size(); i++)
  {
    CLERK_ENTRY * pce = m_vecClerks[i];

    _ASSERTE(pce);

    pce->m_pICrmMonitorLogRecords->Release();

    delete pce;
  }

  _ASSERTE(m_pICrmMonitor);

  m_pICrmMonitor->Release();

  m_pUnkMarshaler.Release();

} // CCrmMonComp::FinalRelease

STDMETHODIMP CCrmMonComp::get_ActivityId ( VARIANT * pVal )

Definition at line 425 of file CrmMonCompObj.Cpp.

{
  _ASSERTE(pVal);

  long lNumClerks = (long) m_vecClerks.size();

  if (0 == lNumClerks)
  {
    ATLTRACE(_T("ERROR: no clerks\r\n"));

    return E_FAIL;
  }

  HRESULT hr = VariantCopy(pVal, &m_vActivityId);

  _ASSERTE(S_OK == hr);

  return S_OK;

} // CCrmMonComp::get_ActivityId

STDMETHODIMP CCrmMonComp::get_ColumnHeaders ( VARIANT * pVal )

Definition at line 747 of file CrmMonCompObj.Cpp.

{
  _ASSERTE(pVal);

  HRESULT hr = S_OK;

  hr = CreateCompensator();

  if (hr != S_OK) return hr;

  // assume compensator cannot provide format info

  _variant_t vHeaders = L"<no column headers available>";

  if (m_pICrmFormatLogRecords)
  {
    // compensator can provide format info

    hr = m_pICrmFormatLogRecords->GetColumnHeaders(&vHeaders);

    _ASSERTE(S_OK == hr);

    m_pICrmFormatLogRecords->Release();

    m_pICrmFormatLogRecords = NULL;
  }

  hr = VariantCopy(pVal, &vHeaders);

  _ASSERTE(S_OK == hr);

  return S_OK;

} // CCrmMonComp::get_ColumnHeaders

STDMETHODIMP CCrmMonComp::get_Description ( VARIANT * pVal )

Definition at line 504 of file CrmMonCompObj.Cpp.

{
  _ASSERTE(pVal);

  long lNumClerks = (long) m_vecClerks.size();

  if (0 == lNumClerks)
  {
    ATLTRACE(_T("ERROR: no clerks\r\n"));

    return E_FAIL;
  }

  HRESULT hr = S_OK;

  CLERK_ENTRY * pce = m_vecClerks[m_lClerkNumber];

  _ASSERTE(pce);

  _variant_t vDescription = L"Unknown Description";

  hr = m_pICrmMonitorClerks->Description(pce->m_vIndex, &vDescription);

  _ASSERTE(S_OK == hr);

  hr = VariantCopy(pVal, &vDescription);

  _ASSERTE(S_OK == hr);

  return S_OK;

} // CCrmMonComp::get_Description

STDMETHODIMP CCrmMonComp::get_FindClerks ( long * plNumberOfClerks )

Definition at line 170 of file CrmMonCompObj.Cpp.

{
  _ASSERTE(plNumberOfClerks);

  long lNumberOfClerks = 0;

  *plNumberOfClerks = lNumberOfClerks;

  HRESULT hr = S_OK;

  _ASSERTE(m_pICrmMonitor);

  if (m_pICrmMonitorClerks)
  {
    m_pICrmMonitorClerks->Release();

    m_pICrmMonitorClerks = NULL;
  }

    hr = m_pICrmMonitor->GetClerks(&m_pICrmMonitorClerks);

    _ASSERTE(S_OK == hr);
    _ASSERTE(m_pICrmMonitorClerks);

  // how many clerks?

  long lClerkCount = 0;

  hr = m_pICrmMonitorClerks->get_Count(&lClerkCount);

    _ASSERTE(S_OK == hr);

  ATLTRACE(_T("lClerkCount = %d\r\n"), lClerkCount);

  if (0 == lClerkCount)
  {
    return S_OK;
  }

  // find and hold the clerk(s) we are looking for

  for (long lIndex = 0; lIndex < lClerkCount; lIndex++)
  {
    _variant_t vIndex = lIndex;

    _variant_t vTxUOWClerk;

    hr = m_pICrmMonitorClerks->TransactionUOW(vIndex, &vTxUOWClerk);

    _ASSERTE(S_OK == hr);

    if (vTxUOWClerk != m_vTxUOWRequired) continue; // not found

    // found it

    ATLTRACE(_T("found clerk # %d\r\n"), lIndex);

    // get the clerk CLSID

    _variant_t vClerkClsid;

    hr = m_pICrmMonitorClerks->Item(vIndex, &vClerkClsid);

    _ASSERTE(S_OK == hr);

    // get the clerk from the recovery clerk

    _variant_t vClerk;

    hr = m_pICrmMonitor->HoldClerk(vClerkClsid, &vClerk);

    // clerk may have gone

    if (E_FAIL == hr)
    {
      ATLTRACE(_T("clerk # %d has gone\r\n"), lIndex);

      continue;
    }

    _ASSERTE(S_OK == hr);

    lNumberOfClerks++;

    _variant_t vActivityId;

    if (1 == lNumberOfClerks)
    {
      // first time, get the activity id

      hr = m_pICrmMonitorClerks->ActivityId(vIndex, &vActivityId);

      _ASSERTE(S_OK == hr);

      m_vActivityId = vActivityId;
    }

    // activity id should be same for all clerks

    _ASSERTE(m_vActivityId == vActivityId);

    IUnknown * punkClerk = (IUnknown *)vClerk;

    _ASSERTE(punkClerk);

    ICrmMonitorLogRecords * pICrmMonitorLogRecords = NULL;

    hr = punkClerk->QueryInterface(
                __uuidof(ICrmMonitorLogRecords),
                (void **)&pICrmMonitorLogRecords);

    _ASSERTE(S_OK == hr);
    _ASSERTE(pICrmMonitorLogRecords);

    punkClerk->Release();

    // put this clerk on the list

    CLERK_ENTRY * pce = new CLERK_ENTRY;

    _ASSERTE(pce);

    pce->m_vIndex = vIndex;

    pce->m_pICrmMonitorLogRecords = pICrmMonitorLogRecords;

    m_vecClerks.push_back(pce);
  }

  *plNumberOfClerks = lNumberOfClerks;

  _ASSERTE(m_vecClerks.size() == lNumberOfClerks);

  return S_OK;

} // CCrmMonComp::FindClerks

STDMETHODIMP CCrmMonComp::get_FormattedRecord ( VARIANT * pVal )

Definition at line 794 of file CrmMonCompObj.Cpp.

{
  _ASSERTE(pVal);

  HRESULT hr = S_OK;

  hr = CreateCompensator();

  if (hr != S_OK) return hr;

  // assume compensator cannot provide record format info

  _variant_t vRecords = L"<no record details available>";

  if (!m_pICrmFormatLogRecords)
  {
    // compensator cannot provide record format info

    hr = VariantCopy(pVal, &vRecords);

    _ASSERTE(S_OK == hr);

    return S_OK;
  }

  // get the required record

  CLERK_ENTRY * pce = m_vecClerks[m_lClerkNumber];

  _ASSERTE(pce);
  _ASSERTE(pce->m_pICrmMonitorLogRecords);

  // is the record requested available?

  long lCount = 0;

  hr = get_NumberOfLogRecords(&lCount);

  if (hr != S_OK) return hr;

  if (m_lRecordNumber >= lCount)
  {
    ATLTRACE(_T("ERROR: no such log record\r\n"));

    return E_FAIL;
  }

  // do we have structured or unstructured records?

  VARIANT_BOOL vbStructuredRecs = VARIANT_FALSE;

  hr = pce->m_pICrmMonitorLogRecords->get_StructuredRecords(&vbStructuredRecs);

  _ASSERTE(S_OK == hr);

  BOOL fStructured = (VARIANT_TRUE == vbStructuredRecs);

  if (fStructured)
  {
    // get the record

    _variant_t vIndexNumber = (_variant_t)m_lRecordNumber;

    _variant_t vLogRecord;

    hr = pce->m_pICrmMonitorLogRecords->GetLogRecordVariants(
                        vIndexNumber,
                        &vLogRecord);
    _ASSERTE(S_OK == hr);

    // format the record

    hr = m_pICrmFormatLogRecords->GetColumnVariants(vLogRecord, &vRecords);

    _ASSERTE(S_OK == hr);
  }

  else
  {
    // is unstructured record here

    // get the record

    CrmLogRecordRead CrmLogRec;

    hr = pce->m_pICrmMonitorLogRecords->GetLogRecord(
                        (DWORD)m_lRecordNumber,
                        &CrmLogRec);
    _ASSERTE(S_OK == hr);

    // format the record

    hr = m_pICrmFormatLogRecords->GetColumn(CrmLogRec, &vRecords);

    _ASSERTE(S_OK == hr);
  }

  m_pICrmFormatLogRecords->Release();

  m_pICrmFormatLogRecords = NULL;

  hr = VariantCopy(pVal, &vRecords);

  _ASSERTE(S_OK == hr);

  return S_OK;

} // CCrmMonComp::get_FormattedRecord

STDMETHODIMP CCrmMonComp::get_NumberOfLogRecords ( long * pVal )

Definition at line 549 of file CrmMonCompObj.Cpp.

{
  _ASSERTE(pVal);

  long lNumClerks = (long) m_vecClerks.size();

  if (0 == lNumClerks)
  {
    ATLTRACE(_T("ERROR: no clerks\r\n"));

    return E_FAIL;
  }

  HRESULT hr = S_OK;

  CLERK_ENTRY * pce = m_vecClerks[m_lClerkNumber];

  _ASSERTE(pce);

  ICrmMonitorLogRecords * pICrmMonitorLogRecords = pce->m_pICrmMonitorLogRecords;

  _ASSERTE(pICrmMonitorLogRecords);

  hr = pICrmMonitorLogRecords->get_Count(pVal);

  _ASSERTE(S_OK == hr);

  return S_OK;

} // CCrmMonComp::get_NumberOfLogRecords

STDMETHODIMP CCrmMonComp::get_ProgId ( VARIANT * pVal )

Definition at line 459 of file CrmMonCompObj.Cpp.

{
  _ASSERTE(pVal);

  long lNumClerks = (long) m_vecClerks.size();

  if (0 == lNumClerks)
  {
    ATLTRACE(_T("ERROR: no clerks\r\n"));

    return E_FAIL;
  }

  HRESULT hr = S_OK;

  CLERK_ENTRY * pce = m_vecClerks[m_lClerkNumber];

  _ASSERTE(pce);

  _variant_t vProgId = L"Unknown ProgId";

  hr = m_pICrmMonitorClerks->ProgIdCompensator(pce->m_vIndex, &vProgId);

  _ASSERTE(S_OK == hr);

  hr = VariantCopy(pVal, &vProgId);

  _ASSERTE(S_OK == hr);

  return S_OK;

} // CCrmMonComp::get_ProgId

STDMETHODIMP CCrmMonComp::get_TransactionState ( VARIANT * pVal )

Definition at line 349 of file CrmMonCompObj.Cpp.

{
  _ASSERTE(pVal);

  long lNumClerks = (long) m_vecClerks.size();

  if (0 == lNumClerks)
  {
    ATLTRACE(_T("ERROR: no clerks\r\n"));

    return E_FAIL;
  }

  HRESULT hr = S_OK;

  // get the transaction state from the 1st clerk only - should be same for all clerks

  CLERK_ENTRY * pce = m_vecClerks.front();

  _ASSERTE(pce);

  ICrmMonitorLogRecords * pICrmMonitorLogRecords = pce->m_pICrmMonitorLogRecords;

  _ASSERTE(pICrmMonitorLogRecords);

  CrmTransactionState txs;

  hr = pICrmMonitorLogRecords->get_TransactionState(&txs);

  _ASSERTE(S_OK == hr);

  ATLTRACE(_T("txs = %d\r\n"), txs);

  _variant_t vTxState = L"Unknown";

  switch (txs)
  {
    case TxState_Active: vTxState = _variant_t("Active"); break;

    case TxState_Committed: vTxState = _variant_t("Committed"); break;

    case TxState_Aborted: vTxState = _variant_t("Aborted"); break;

    case TxState_Indoubt: vTxState = _variant_t("Indoubt"); break;

    default:

      _ASSERTE(!"ERROR: unknown transaction state");

      return E_FAIL;

      break;
  };

  hr = VariantCopy(pVal, &vTxState);

  _ASSERTE(S_OK == hr);

  return S_OK;

} // CCrmMonComp::get_TransactionState

STDMETHODIMP CCrmMonComp::put_TransactionUOW ( VARIANT newVal )

Definition at line 148 of file CrmMonCompObj.Cpp.

{
  HRESULT hr = VariantCopy(&m_vTxUOWRequired, &newVal);

  _ASSERTE(S_OK == hr);

  return S_OK;

} // CCrmMonComp::put_TransactionUOW

STDMETHODIMP CCrmMonComp::SetClerk ( long lClerkNumber )

Definition at line 319 of file CrmMonCompObj.Cpp.

{
  long lNumClerks = (long) m_vecClerks.size();

  if ((lClerkNumber < 0) || (lClerkNumber >= lNumClerks))
  {
    ATLTRACE(_T("ERROR: no such clerk, %d, %d\r\n"), lClerkNumber, lNumClerks);

    return E_FAIL;
  }

  m_lClerkNumber = lClerkNumber;

  return S_OK;

} // CCrmMonComp::SetClerk

STDMETHODIMP CCrmMonComp::SetRecord ( long lRecordNumber )

Definition at line 650 of file CrmMonCompObj.Cpp.

{
  m_lRecordNumber = lRecordNumber;

  return S_OK;

} // CCrmMonComp::SetRecord

Member Data Documentation

long CCrmMonComp::m_lClerkNumber [private]

Definition at line 149 of file CrmMonCompObj.h.

long CCrmMonComp::m_lRecordNumber [private]

Definition at line 151 of file CrmMonCompObj.h.

ICrmFormatLogRecords* CCrmMonComp::m_pICrmFormatLogRecords [private]

Definition at line 153 of file CrmMonCompObj.h.

ICrmMonitor* CCrmMonComp::m_pICrmMonitor [private]

Definition at line 139 of file CrmMonCompObj.h.

ICrmMonitorClerks* CCrmMonComp::m_pICrmMonitorClerks [private]

Definition at line 141 of file CrmMonCompObj.h.

CComPtr<IUnknown> CCrmMonComp::m_pUnkMarshaler

Definition at line 116 of file CrmMonCompObj.h.

_variant_t CCrmMonComp::m_vActivityId [private]

Definition at line 147 of file CrmMonCompObj.h.

VEC_CLERKS CCrmMonComp::m_vecClerks [private]

Definition at line 145 of file CrmMonCompObj.h.

_variant_t CCrmMonComp::m_vTxUOWRequired [private]

Definition at line 143 of file CrmMonCompObj.h.

The documentation for this class was generated from the following files:
  • Com/Services/Crm/CrmMonitor/CrmMonCompObj.h
  • Com/Services/Crm/CrmMonitor/CrmMonCompObj.Cpp
Generated on Wed Nov 13 2024 16:55:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCRMSub Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CCRMSub Class Reference

#include "crmsub.h"

Inherits CSysLCESub.

List of all members.

Public Member Functions

CCRMSub (CComSpy *pSpy)
CCRMSub ()
STDMETHODIMP | GetEventClass (LPGUID guid)
STDMETHODIMP | GetEventType (EventEnum *e)
STDMETHODIMP | GetInterface (IID *iid)
STDMETHOD() | OnCRMAbort (COMSVCSEVENTINFO *pInfo, GUID guidClerkCLSID)
STDMETHOD() | OnCRMAnalyze (COMSVCSEVENTINFO *pInfo, GUID guidClerkCLSID, DWORD dwCrmRecordType, DWORD dwRecordSize)
STDMETHOD() | OnCRMBegin (COMSVCSEVENTINFO *pInfo, GUID guidClerkCLSID, GUID guidActivity, GUID guidTx, WCHAR szProgIdCompensator[64], WCHAR szDescription[64])
STDMETHOD() | OnCRMCheckpoint (COMSVCSEVENTINFO *pInfo, GUID guidApp)
STDMETHOD() | OnCRMCommit (COMSVCSEVENTINFO *pInfo, GUID guidClerkCLSID)
STDMETHOD() | OnCRMDeliver (COMSVCSEVENTINFO *pInfo, GUID guidClerkCLSID, BOOL bVariants, DWORD dwRecordSize)
STDMETHOD() | OnCRMDone (COMSVCSEVENTINFO *pInfo, GUID guidClerkCLSID)
STDMETHOD() | OnCRMForce (COMSVCSEVENTINFO *pInfo, GUID guidClerkCLSID)
STDMETHOD() | OnCRMForget (COMSVCSEVENTINFO *pInfo, GUID guidClerkCLSID)
STDMETHOD() | OnCRMIndoubt (COMSVCSEVENTINFO *pInfo, GUID guidClerkCLSID)
STDMETHOD() | OnCRMPrepare (COMSVCSEVENTINFO *pInfo, GUID guidClerkCLSID)
STDMETHOD() | OnCRMRecoveryDone (COMSVCSEVENTINFO *pInfo, GUID guidApp)
STDMETHOD() | OnCRMRecoveryStart (COMSVCSEVENTINFO *pInfo, GUID guidApp)
STDMETHOD() | OnCRMRelease (COMSVCSEVENTINFO *pInfo, GUID guidClerkCLSID)
STDMETHOD() | OnCRMWrite (COMSVCSEVENTINFO *pInfo, GUID guidClerkCLSID, BOOL bVariants, DWORD dwRecordSize)

Detailed Description

Definition at line 30 of file crmsub.h.

Constructor & Destructor Documentation

CCRMSub::CCRMSub ( CComSpy * pSpy ) [inline]

Definition at line 36 of file crmsub.h.

  {
    m_pSpy = pSpy;
  }

CCRMSub::CCRMSub ( ) [inline]

Definition at line 40 of file crmsub.h.

  {
    m_pSpy = NULL;
  }

Member Function Documentation

STDMETHODIMP CCRMSub::GetEventClass ( LPGUID guid ) [inline, virtual]

Implements CSysLCESub.

Definition at line 54 of file crmsub.h.

{*guid = CLSID_ComServiceEvents;return S_OK;}

STDMETHODIMP CCRMSub::GetEventType ( EventEnum * e ) [inline, virtual]

Implements CSysLCESub.

Definition at line 53 of file crmsub.h.

{*e = CRM;return S_OK;}

STDMETHODIMP CCRMSub::GetInterface ( IID * iid ) [inline, virtual]

Implements CSysLCESub.

Definition at line 55 of file crmsub.h.

{*iid = IID_IComCRMEvents;return S_OK;}

STDMETHODIMP CCRMSub::OnCRMAbort | ( | COMSVCSEVENTINFO * | pInfo,
 |  | GUID | guidClerkCLSID
 | ) |  |

Definition at line 132 of file crmsub.Cpp.

{
  m_pSpy->AddEventToList(pInfo->perfCount, _TEXT("OnCRMAbort"), GuidToBstr(pInfo->guidApp));

  m_pSpy->AddParamValueToList(L"Clerk CLSID", GuidToBstr(guidClerkCLSID));

  IF_AUDIT_DO(OnCRMAbort)(pInfo->perfCount, GuidToBstr(pInfo->guidApp),
               GuidToBstr(guidClerkCLSID)
               );

  return S_OK;

} // CCRMSub::OnCRMAbort

STDMETHODIMP CCRMSub::OnCRMAnalyze | ( | COMSVCSEVENTINFO * | pInfo,
 |  | GUID | guidClerkCLSID,
 |  | DWORD | dwCrmRecordType,
 |  | DWORD | dwRecordSize
 | ) |  |

Definition at line 203 of file crmsub.Cpp.

{
  m_pSpy->AddEventToList(pInfo->perfCount, _TEXT("OnCRMAnalyze"), GuidToBstr(pInfo->guidApp));

  m_pSpy->AddParamValueToList(L"Clerk CLSID", GuidToBstr(guidClerkCLSID));

  // internals info from CrmLogRecordFormat.h

  DWORD dwRecordTypeIndex = (dwCrmRecordType >= 0x20 ? dwCrmRecordType - 0x20 + 4 : dwCrmRecordType);

  TCHAR * aRecordType[] =
  {
    L"None",      // 0x00
    L"LogInfo",     // 0x01
    L"NewClerk",    // 0x02
    L"ClerkList",   // 0x03
    L"ClerkBegin",    // 0x20
    L"Write",     // 0x21
    L"Forget",      // 0x22
    L"ClerkEnd",    // 0x23
  };

  m_pSpy->AddParamValueToList(L"Record Type", aRecordType[dwRecordTypeIndex]);

  TCHAR szRecordSize[32];
  wsprintf(szRecordSize, L"%d", dwRecordSize);
  m_pSpy->AddParamValueToList(L"Record Size", szRecordSize);

  IF_AUDIT_DO(OnCRMAnalyze)(pInfo->perfCount, GuidToBstr(pInfo->guidApp),
               GuidToBstr(guidClerkCLSID),
               aRecordType[dwRecordTypeIndex],
               dwRecordSize
               );

  return S_OK;

} // CCRMSub::OnCRMAnalyze

STDMETHODIMP CCRMSub::OnCRMBegin | ( | COMSVCSEVENTINFO * | pInfo,
 |  | GUID | guidClerkCLSID,
 |  | GUID | guidActivity,
 |  | GUID | guidTx,
 |  | WCHAR | szProgIdCompensator[64],
 |  | WCHAR | szDescription[64]
 | ) |  |

Definition at line 66 of file crmsub.Cpp.

                                                 : hardcoded
      WCHAR szDescription[64])        // NOTE: hardcoded
{
  m_pSpy->AddEventToList(pInfo->perfCount, _TEXT("OnCRMBegin"), GuidToBstr(pInfo->guidApp));

  m_pSpy->AddParamValueToList(L"Clerk CLSID", GuidToBstr(guidClerkCLSID));
  m_pSpy->AddParamValueToList(L"Activity ID", GuidToBstr(guidActivity));
  m_pSpy->AddParamValueToList(L"Transaction UOW ID", GuidToBstr(guidTx));
  m_pSpy->AddParamValueToList(L"Compensator Prog ID", szProgIdCompensator);
  m_pSpy->AddParamValueToList(L"Description", szDescription);

  IF_AUDIT_DO(OnCRMBegin)(pInfo->perfCount, GuidToBstr(pInfo->guidApp),
                 GuidToBstr(guidClerkCLSID),
                 GuidToBstr(guidActivity),
                 GuidToBstr(guidTx),
                 szProgIdCompensator,
                 szDescription
                 );

  return S_OK;

} // CCRMSub::OnCRMBegin

STDMETHODIMP CCRMSub::OnCRMCheckpoint | ( | COMSVCSEVENTINFO * | pInfo,
 |  | GUID | guidApp
 | ) |  |

Definition at line 53 of file crmsub.Cpp.

{
  m_pSpy->AddEventToList(pInfo->perfCount, _TEXT("OnCRMCheckpoint"), GuidToBstr(pInfo->guidApp));

  IF_AUDIT_DO(OnCRMCheckpoint)(pInfo->perfCount, GuidToBstr(pInfo->guidApp));

  return S_OK;

} // CCRMSub::OnCRMCheckpoint

STDMETHODIMP CCRMSub::OnCRMCommit | ( | COMSVCSEVENTINFO * | pInfo,
 |  | GUID | guidClerkCLSID
 | ) |  |

Definition at line 113 of file crmsub.Cpp.

{
  m_pSpy->AddEventToList(pInfo->perfCount, _TEXT("OnCRMCommit"), GuidToBstr(pInfo->guidApp));

  m_pSpy->AddParamValueToList(L"Clerk CLSID", GuidToBstr(guidClerkCLSID));

  IF_AUDIT_DO(OnCRMCommit)(pInfo->perfCount, GuidToBstr(pInfo->guidApp),
               GuidToBstr(guidClerkCLSID)
               );

  return S_OK;

} // CCRMSub::OnCRMCommit

STDMETHODIMP CCRMSub::OnCRMDeliver | ( | COMSVCSEVENTINFO * | pInfo,
 |  | GUID | guidClerkCLSID,
 |  | BOOL | bVariants,
 |  | DWORD | dwRecordSize
 | ) |  |

Definition at line 309 of file crmsub.Cpp.

{
  m_pSpy->AddEventToList(pInfo->perfCount, _TEXT("OnCRMDeliver"), GuidToBstr(pInfo->guidApp));

  m_pSpy->AddParamValueToList(L"Clerk CLSID", GuidToBstr(guidClerkCLSID));

  m_pSpy->AddParamValueToList(L"Variants?",  (bVariants ? L"Yes" : L"No"));

  TCHAR szRecordSize[32];
  wsprintf(szRecordSize, L"%d", dwRecordSize);
  m_pSpy->AddParamValueToList(L"Record Size", szRecordSize);

  IF_AUDIT_DO(OnCRMDeliver)(pInfo->perfCount, GuidToBstr(pInfo->guidApp),
             GuidToBstr(guidClerkCLSID),
             bVariants,
             dwRecordSize
             );

  return S_OK;

} // CCRMSub::OnCRMDeliver

STDMETHODIMP CCRMSub::OnCRMDone | ( | COMSVCSEVENTINFO * | pInfo,
 |  | GUID | guidClerkCLSID
 | ) |  |

Definition at line 168 of file crmsub.Cpp.

{
  m_pSpy->AddEventToList(pInfo->perfCount, _TEXT("OnCRMDone"), GuidToBstr(pInfo->guidApp));

  m_pSpy->AddParamValueToList(L"Clerk CLSID", GuidToBstr(guidClerkCLSID));

  IF_AUDIT_DO(OnCRMDone)(pInfo->perfCount, GuidToBstr(pInfo->guidApp),
               GuidToBstr(guidClerkCLSID)
               );

  return S_OK;

} // CCRMSub::OnCRMDone

STDMETHODIMP CCRMSub::OnCRMForce | ( | COMSVCSEVENTINFO * | pInfo,
 |  | GUID | guidClerkCLSID
 | ) |  |

Definition at line 291 of file crmsub.Cpp.

{
  m_pSpy->AddEventToList(pInfo->perfCount, _TEXT("OnCRMForce"), GuidToBstr(pInfo->guidApp));

  m_pSpy->AddParamValueToList(L"Clerk CLSID", GuidToBstr(guidClerkCLSID));

  IF_AUDIT_DO(OnCRMForce)(pInfo->perfCount, GuidToBstr(pInfo->guidApp),
             GuidToBstr(guidClerkCLSID)
             );

  return S_OK;

} // CCRMSub::OnCRMForce

STDMETHODIMP CCRMSub::OnCRMForget | ( | COMSVCSEVENTINFO * | pInfo,
 |  | GUID | guidClerkCLSID
 | ) |  |

Definition at line 274 of file crmsub.Cpp.

{
  m_pSpy->AddEventToList(pInfo->perfCount, _TEXT("OnCRMForget"), GuidToBstr(pInfo->guidApp));

  m_pSpy->AddParamValueToList(L"Clerk CLSID", GuidToBstr(guidClerkCLSID));

  IF_AUDIT_DO(OnCRMForget)(pInfo->perfCount, GuidToBstr(pInfo->guidApp),
             GuidToBstr(guidClerkCLSID)
             );

  return S_OK;

} // CCRMSub::OnCRMForget

STDMETHODIMP CCRMSub::OnCRMIndoubt | ( | COMSVCSEVENTINFO * | pInfo,
 |  | GUID | guidClerkCLSID
 | ) |  |

Definition at line 150 of file crmsub.Cpp.

{
  m_pSpy->AddEventToList(pInfo->perfCount, _TEXT("OnCRMIndoubt"), GuidToBstr(pInfo->guidApp));

  m_pSpy->AddParamValueToList(L"Clerk CLSID", GuidToBstr(guidClerkCLSID));

  IF_AUDIT_DO(OnCRMIndoubt)(pInfo->perfCount, GuidToBstr(pInfo->guidApp),
               GuidToBstr(guidClerkCLSID)
               );

  return S_OK;

} // CCRMSub::OnCRMIndoubt

STDMETHODIMP CCRMSub::OnCRMPrepare | ( | COMSVCSEVENTINFO * | pInfo,
 |  | GUID | guidClerkCLSID
 | ) |  |

Definition at line 95 of file crmsub.Cpp.

{
  m_pSpy->AddEventToList(pInfo->perfCount, _TEXT("OnCRMPrepare"), GuidToBstr(pInfo->guidApp));

  m_pSpy->AddParamValueToList(L"Clerk CLSID", GuidToBstr(guidClerkCLSID));

  IF_AUDIT_DO(OnCRMPrepare)(pInfo->perfCount, GuidToBstr(pInfo->guidApp),
               GuidToBstr(guidClerkCLSID)
               );

  return S_OK;

} // CCRMSub::OnCRMPrepare

STDMETHODIMP CCRMSub::OnCRMRecoveryDone | ( | COMSVCSEVENTINFO * | pInfo,
 |  | GUID | guidApp
 | ) |  |

Definition at line 40 of file crmsub.Cpp.

{
  m_pSpy->AddEventToList(pInfo->perfCount, _TEXT("OnCRMRecoveryDone"), GuidToBstr(pInfo->guidApp));

  IF_AUDIT_DO(OnCRMRecoveryDone)(pInfo->perfCount, GuidToBstr(pInfo->guidApp));

  return S_OK;

} // CCRMSub::OnCRMRecoveryDone

STDMETHODIMP CCRMSub::OnCRMRecoveryStart | ( | COMSVCSEVENTINFO * | pInfo,
 |  | GUID | guidApp
 | ) |  |

Definition at line 27 of file crmsub.Cpp.

{
  m_pSpy->AddEventToList(pInfo->perfCount, _TEXT("OnCRMRecoveryStart"), GuidToBstr(pInfo->guidApp));

  IF_AUDIT_DO(OnCRMRecoveryStart)(pInfo->perfCount, GuidToBstr(pInfo->guidApp));

  return S_OK;

} // CCRMSub::OnCRMRecoveryStart

STDMETHODIMP CCRMSub::OnCRMRelease | ( | COMSVCSEVENTINFO * | pInfo,
 |  | GUID | guidClerkCLSID
 | ) |  |

Definition at line 185 of file crmsub.Cpp.

{
  m_pSpy->AddEventToList(pInfo->perfCount, _TEXT("OnCRMRelease"), GuidToBstr(pInfo->guidApp));

  m_pSpy->AddParamValueToList(L"Clerk CLSID", GuidToBstr(guidClerkCLSID));

  IF_AUDIT_DO(OnCRMRelease)(pInfo->perfCount, GuidToBstr(pInfo->guidApp),
               GuidToBstr(guidClerkCLSID)
               );

  return S_OK;

} // CCRMSub::OnCRMRelease

STDMETHODIMP CCRMSub::OnCRMWrite | ( | COMSVCSEVENTINFO * | pInfo,
 |  | GUID | guidClerkCLSID,
 |  | BOOL | bVariants,
 |  | DWORD | dwRecordSize
 | ) |  |

Definition at line 247 of file crmsub.Cpp.

{
  m_pSpy->AddEventToList(pInfo->perfCount, _TEXT("OnCRMWrite"), GuidToBstr(pInfo->guidApp));

  m_pSpy->AddParamValueToList(L"Clerk CLSID", GuidToBstr(guidClerkCLSID));

  m_pSpy->AddParamValueToList(L"Variants?",  (bVariants ? L"Yes" : L"No"));

  TCHAR szRecordSize[32];
  wsprintf(szRecordSize, L"%d", dwRecordSize);
  m_pSpy->AddParamValueToList(L"Record Size", szRecordSize);

  IF_AUDIT_DO(OnCRMWrite)(pInfo->perfCount, GuidToBstr(pInfo->guidApp),
             GuidToBstr(guidClerkCLSID),
             bVariants,
             dwRecordSize
             );

  return S_OK;

} // CCRMSub::OnCRMWrite

The documentation for this class was generated from the following files:
  • Com/Administration/Spy/ComSpyCtl/crmsub.h
  • Com/Administration/Spy/ComSpyCtl/crmsub.Cpp
Generated on Wed Nov 13 2024 16:55:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCTypeSet Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Protected Attributes

CCTypeSet Class Reference

#include "Cset.Hxx"

Inherits CSet.

List of all members.

Public Member Functions

CCTypeSet (WORD fC1Mask, WORD fC2Test, WORD fC3Mask)
BOOL | In (WORD iChar)

Protected Member Functions

void | GetPageData (WORD iPage)

Protected Attributes

WORD | _fC1Mask
WORD | _fC2Test
WORD | _fC3Mask
WORD | _iPage
BOOL | _pCharInSet [256]
BOOL | _pPageInSet [256]

Detailed Description

Definition at line 47 of file Cset.Hxx.

Constructor & Destructor Documentation

CCTypeSet::CCTypeSet | ( | WORD | fC1Mask,
 |  | WORD | fC2Test,
 |  | WORD | fC3Mask
 | ) |  |

Definition at line 26 of file Cset.Cxx.

{
  _fC1Mask = fC1Mask;
  _fC2Test = fC2Test;
  _fC3Mask = fC3Mask;
  GetPageData( 0 );  // Page 0 is ALWAYS the default
}

Member Function Documentation

void CCTypeSet::GetPageData ( WORD iPage ) [protected]

Definition at line 45 of file Cset.Cxx.

{
  WORD i;
  TCHAR vchTemp[256];
  WORD vCtype[256];

  for ( i=0; i < 256; i++ )
  {
    vchTemp[i] = iPage+i;
    _pCharInSet[i] = FALSE;
  }
  if( _fC1Mask )
  {
    GetStringTypeEx(0,CT_CTYPE1,vchTemp,256, vCtype);
    for( i=0; i<256;i++ ){
      _pCharInSet[i] = _pCharInSet[i] || (vCtype[i] & _fC1Mask);
    }
  }
  if( _fC2Test )
  {
    GetStringTypeEx(0,CT_CTYPE2,vchTemp,256, vCtype);
    for( i=0; i<256;i++ ){
      _pCharInSet[i] = _pCharInSet[i] || (vCtype[i] == _fC2Test);  //enumerated value
    }
  }
  if( _fC3Mask )
  {
    GetStringTypeEx(0,CT_CTYPE3,vchTemp,256, vCtype);
    for( i=0; i<256;i++ ){
      _pCharInSet[i] = _pCharInSet[i] || (vCtype[i] & _fC3Mask);
    }
  }
  _iPage = iPage;
}

CCTypeSet::In ( WORD iChar ) [virtual]

Implements CSet.

Definition at line 34 of file Cset.Cxx.

{
  WORD iPage = iChar & 0xFF00;
  if( iPage != _iPage )
  {
    GetPageData(iPage);
  }
  return _pCharInSet[iChar &0xFF];
}

Member Data Documentation

WORD CCTypeSet::_fC1Mask [protected]

Definition at line 56 of file Cset.Hxx.

WORD CCTypeSet::_fC2Test [protected]

Definition at line 57 of file Cset.Hxx.

WORD CCTypeSet::_fC3Mask [protected]

Definition at line 58 of file Cset.Hxx.

WORD CCTypeSet::_iPage [protected]

Definition at line 59 of file Cset.Hxx.

BOOL CCTypeSet::_pCharInSet[256] [protected]

Definition at line 54 of file Cset.Hxx.

BOOL CCTypeSet::_pPageInSet[256] [protected]

Definition at line 55 of file Cset.Hxx.

The documentation for this class was generated from the following files:
  • Multimedia/Gdi/Fonts/GridFont/Cset.Hxx
  • Multimedia/Gdi/Fonts/GridFont/Cset.Cxx
Generated on Wed Nov 13 2024 16:55:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCustomError Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CCustomError Class Reference

#include "cerror.h"

Inherits CBase.

List of all members.

Public Member Functions

CCustomError (CMainWindow *pCMainwindow)
virtual | ~CCustomError ()
virtual HRESULT | AutoQI (DWORD dwCreateOpts)
virtual HRESULT | AutoRelease ()
virtual REFIID | GetDefaultInterface ()
virtual IUnknown ** | GetInterfaceAddress (REFIID riid)
virtual WCHAR * | GetObjectDesc ()
virtual LONG | GetObjectImage ()
virtual UINT | GetObjectMenu ()
virtual WCHAR * | GetObjectName ()
virtual HRESULT | GetSQLInfo (BSTR *pbstrSQLState, LONG *plNativeError)

Public Attributes

ISQLErrorInfo * | m_pISQLErrorInfo

Detailed Description

Definition at line 72 of file cerror.h.

Constructor & Destructor Documentation

CCustomError::CCustomError ( CMainWindow * pCMainwindow )

Definition at line 273 of file cerror.cpp.

  : CBase(eCCustomError, pCMainWindow, NULL)
{
  //OLE DB Interfaces
  m_pISQLErrorInfo      = NULL;   //Error interface
}

CCustomError::~CCustomError ( ) [virtual]

Definition at line 284 of file cerror.cpp.

{
  ReleaseObject(0);
}

Member Function Documentation

HRESULT CCustomError::AutoQI ( DWORD dwCreateOpts ) [virtual]

Implements CBase.

Definition at line 321 of file cerror.cpp.

{
  //Delegate First so we have base interfaces
  CBase::AutoQI(dwCreateOpts);

  //[MANDATORY]
  if(dwCreateOpts & CREATE_QI_MANDATORY)
  {
  }

  //[OPTIONAL]
  if(dwCreateOpts & CREATE_QI_OPTIONAL)
  {
    OBTAIN_INTERFACE(ISQLErrorInfo);
  }

  return S_OK;
}

HRESULT CCustomError::AutoRelease ( ) [virtual]

Implements CBase.

Definition at line 307 of file cerror.cpp.

{
  //Error
  RELEASE_INTERFACE(ISQLErrorInfo);

  //Delegate
  return CBase::AutoRelease();
}

virtual REFIID CCustomError::GetDefaultInterface ( ) [inline, virtual]

Implements CBase.

Definition at line 88 of file cerror.h.

{ return IID_ISQLErrorInfo;     }

IUnknown ** CCustomError::GetInterfaceAddress ( REFIID riid ) [virtual]

Implements CBase.

Definition at line 294 of file cerror.cpp.

{
  HANDLE_GETINTERFACE(ISQLErrorInfo);

  //Otherwise delegate
  return CBase::GetInterfaceAddress(riid);
}

WCHAR * CCustomError::GetObjectDesc ( ) [virtual]

Reimplemented from CBase.

Definition at line 345 of file cerror.cpp.

{
  if(!m_strObjectDesc)
  {
    CComBSTR bstr;
    LONG lNativeError = 0;

    //ISQLErrorInfo::GetSQLInfo
    if(SUCCEEDED(GetSQLInfo(&bstr, &lNativeError)) && bstr)
    {
      m_strObjectDesc.CopyFrom(bstr);
    }
  }

  return m_strObjectDesc;
}

virtual LONG CCustomError::GetObjectImage ( ) [inline, virtual]

Implements CBase.

Definition at line 87 of file cerror.h.

{ return IMAGE_ERROR;       }

virtual UINT CCustomError::GetObjectMenu ( ) [inline, virtual]

Implements CBase.

Definition at line 86 of file cerror.h.

{ return IDM_CUSTOMERRORMENU;   }

virtual WCHAR* CCustomError::GetObjectName ( ) [inline, virtual]

Implements CBase.

Definition at line 85 of file cerror.h.

{ return L"Custom Error Object";  }

HRESULT CCustomError::GetSQLInfo | ( | BSTR * | pbstrSQLState,
 |  | LONG * | plNativeError |
 | ) |  |  | [virtual]

Definition at line 367 of file cerror.cpp.

{
  HRESULT hr = S_OK;

  if(m_pISQLErrorInfo)
  {
    //ISQLErrorInfo::GetSQLInfo
    XTEST(hr = m_pISQLErrorInfo->GetSQLInfo(pbstrSQLState, plNativeError));
    TRACE_METHOD(hr, L"ISQLErrorInfo::GetSQLInfo(&\"%s\", &%ld)", pbstrSQLState ? *pbstrSQLState : NULL, plNativeError ? *plNativeError : NULL);
  }

  return hr;
}

Member Data Documentation

ISQLErrorInfo* CCustomError::m_pISQLErrorInfo

Definition at line 100 of file cerror.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cerror.h
  • Dataaccess/oledb/rowsetviewer/cerror.cpp
Generated on Wed Nov 13 2024 16:55:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CCustomPropertyStore Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CCustomPropertyStore Class Reference

#include "pstore.h"

List of all members.

Public Member Functions

CCustomPropertyStore ()
~CCustomPropertyStore ()
void | _SetState (DWORD dwState)
STDMETHODIMP | Clone (ITfPropertyStore **ppClone)
STDMETHODIMP | Divide (ITfRange *pRangeThis, ITfRange *pRangeNew, ITfPropertyStore **ppPropertyStore)
STDMETHODIMP | GetData (VARIANT *pvarValue)
STDMETHODIMP | GetDataType (DWORD *pdwReserved)
STDMETHODIMP | GetPropertyRangeCreator (CLSID *pclsid)
STDMETHODIMP | GetType (GUID *pguidType)
STDMETHODIMP | OnTextUpdated (DWORD dwFlags, ITfRange *pRangeNew, BOOL *pfAccept)
STDMETHODIMP | QueryInterface (REFIID riid, void **ppvObj)
STDMETHODIMP | Serialize (IStream *pStream, ULONG *pcb)
STDMETHODIMP | Shrink (ITfRange *pRangeNew, BOOL *pfFree)
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) AddRef(void)

Private Attributes

LONG | _cRef
DWORD _dwState

Detailed Description

Definition at line 10 of file pstore.h.

Constructor & Destructor Documentation

CCustomPropertyStore::CCustomPropertyStore ( )

Definition at line 17 of file pstore.cpp.

{
    // assign some arbitrary state to this object, for demonstration purposes
    _dwState = GetTickCount();

    DllAddRef();
    _cRef = 1;
}

CCustomPropertyStore::~CCustomPropertyStore ( )

Definition at line 32 of file pstore.cpp.

{
    DllRelease();
}

Member Function Documentation

void CCustomPropertyStore::_SetState ( DWORD dwState ) [inline]

Definition at line 32 of file pstore.h.

    {
        _dwState = dwState;
    }

STDAPI CCustomPropertyStore::Clone ( ITfPropertyStore ** ppClone )

Definition at line 191 of file pstore.cpp.

{
    CCustomPropertyStore *pClone;

    *ppCloneOut = NULL;

    if ((pClone = new CCustomPropertyStore) == NULL)
        return E_OUTOFMEMORY;

    pClone->_dwState = _dwState;

    *ppCloneOut = pClone;

    return S_OK;
}

STDAPI CCustomPropertyStore::Divide | ( | ITfRange * | pRangeThis,
 |  | ITfRange * | pRangeNew,
 |  | ITfPropertyStore ** | ppPropertyStore
 | ) |  |

Definition at line 176 of file pstore.cpp.

{
    // just give up
    // a NULL ppPropertyStore tells TSF to release this store
    *ppPropertyStore = NULL;
    return S_OK;
}

STDAPI CCustomPropertyStore::GetData ( VARIANT * pvarValue )

Definition at line 130 of file pstore.cpp.

{
    pvarValue->vt = VT_I4; // dword value for this store
    pvarValue->lVal = _dwState;
    return S_OK;
}

STDAPI CCustomPropertyStore::GetDataType ( DWORD * pdwReserved )

Definition at line 116 of file pstore.cpp.

{
    // this method is reserved, pdwReserved must be set 0
    *pdwReserved = 0;
    return S_OK;
}

STDAPI CCustomPropertyStore::GetPropertyRangeCreator ( CLSID * pclsid )

Definition at line 214 of file pstore.cpp.

{
    *pclsid = c_clsidMarkTextService;
    return S_OK;
}

STDAPI CCustomPropertyStore::GetType ( GUID * pguidType )

Definition at line 104 of file pstore.cpp.

{
    *pguidType = c_guidCustomProperty;
    return S_OK;
}

STDAPI CCustomPropertyStore::OnTextUpdated | ( | DWORD | dwFlags,
 |  | ITfRange * | pRangeNew,
 |  | BOOL * | pfAccept
 | ) |  |

Definition at line 144 of file pstore.cpp.

{
    // we will throw away this store (give up) anytime the text is modified.
    // If we did set pfAccept TRUE, the store would be maintained.
    *pfAccept = FALSE;
    return S_OK;
}

STDAPI CCustomPropertyStore::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppvObj
 | ) |  |

Definition at line 43 of file pstore.cpp.

{
    if (ppvObj == NULL)
        return E_INVALIDARG;

    *ppvObj = NULL;

    if (IsEqualIID(riid, IID_IUnknown) ||
        IsEqualIID(riid, IID_ITfPropertyStore))
    {
        *ppvObj = (ITfPropertyStore *)this;
    }

    if (*ppvObj)
    {
        AddRef();
        return S_OK;
    }

    return E_NOINTERFACE;
}

STDAPI CCustomPropertyStore::Serialize | ( | IStream * | pStream,
 |  | ULONG * | pcb
 | ) |  |

Definition at line 228 of file pstore.cpp.

{
    return pStream->Write(&_dwState, sizeof(_dwState), pcb);
}

STDAPI CCustomPropertyStore::Shrink | ( | ITfRange * | pRangeNew,
 |  | BOOL * | pfFree
 | ) |  |

Definition at line 159 of file pstore.cpp.

{
    // give up and free this store
    *pfFree = TRUE;
    return S_OK;
}

CCustomPropertyStore::STDMETHODIMP_ ( ULONG )
CCustomPropertyStore::STDMETHODIMP_ ( ULONG )

Member Data Documentation

LONG CCustomPropertyStore::_cRef [private]

Definition at line 39 of file pstore.h.

DWORD CCustomPropertyStore::_dwState [private]

Definition at line 38 of file pstore.h.

The documentation for this class was generated from the following files:
  • WinUI/TSFmark/pstore.h
  • WinUI/TSFmark/pstore.cpp
Generated on Wed Nov 13 2024 16:55:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDataAccess Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CDataAccess Class Reference

#include "crowset.h"

Inherits CAsynchBase.

Inherited by CCommand, CDataset, CRow, and CRowset.

List of all members.

Public Member Functions

CDataAccess (SOURCE eObjectType, CMainWindow *pCMainWindow, CMDIChild *pCMDIChild=NULL)
virtual | ~CDataAccess ()
virtual HRESULT | AddRefAccessor (HACCESSOR hAccessor)
virtual HRESULT | AutoQI (DWORD dwCreateOpts)
virtual HRESULT | AutoRelease ()
virtual HRESULT | CreateAccessor (DBACCESSORFLAGS dwAccessorFlags, DBCOUNTITEM cBindings, const DBBINDING *rgBindings, DBLENGTH cRowSize, HACCESSOR *phAccessor)
virtual HRESULT | CreateAccessors (BINDCOLS eBindCols)
virtual HRESULT | GetColInfo ()
virtual HRESULT | GetColInfo (DBORDINAL *pcColumns, DBCOLUMNINFO **prgColumnInfo, WCHAR **ppStringBuffer, DBORDINAL *pcHiddenColumns)
virtual HRESULT | GetColumnData (const DBBINDING *pBinding, void *pData, DBSTATUS *pdbStatus, DBLENGTH *pdbLength, DBTYPE *pwSubType, WCHAR *pwszValue, ULONG ulMaxSize, DWORD dwFlags, DBTYPE wBackendType)
virtual INT | GetColumnImage (const DBCOLUMNINFO *pColInfo, DBSTATUS dbStatus=DBSTATUS_S_OK)
virtual HRESULT | GetColumnsRowset (CAggregate *pCAggregate, bool fOptColumns, REFIID riid, ULONG cPropSets, DBPROPSET *rgPropSets, IUnknown **ppIUnknown)
virtual IUnknown ** | GetInterfaceAddress (REFIID riid)
virtual HRESULT | ReleaseAccessor (HACCESSOR *phAccessor, BOOL fReleaseAlways=FALSE)
virtual HRESULT | SetColumnData (const DBBINDING *pBinding, void *pData, DBSTATUS dbStatus, DBLENGTH dbLength, WCHAR *pwszValue, DWORD dwFlags, DBTYPE wBackendType)
virtual HRESULT | SetupBindings (BINDCOLS eBindCols, DBCOUNTITEM *cBindings, DBBINDING **prgBindings, DBLENGTH *pcRowSize=NULL)
virtual HRESULT | ValidateAccessor (HACCESSOR hAccessor, ULONG ulRefCount=1)

Public Attributes

CBindings m_Bindings
BOOL m_bSchemaRowset
DBLENGTH | m_cbRowSize
CColumnInfo m_ColumnInfo
HACCESSOR | m_hAccessor
HACCESSOR | m_hBmkAccessor
void * | m_pData
IAccessor * | m_pIAccessor
IColumnsInfo * | m_pIColumnsInfo
IColumnsRowset * | m_pIColumnsRowset
IConvertType * | m_pIConvertType

Detailed Description

Definition at line 189 of file crowset.h.

Constructor & Destructor Documentation

CDataAccess::CDataAccess | ( | SOURCE | eObjectType,
 |  | CMainWindow * | pCMainWindow,
 |  | CMDIChild * | pCMDIChild = NULL
 | ) |  |

Definition at line 22 of file crowset.cpp.

  : CAsynchBase(eObjectType, pCMainWindow, pCMDIChild)
{
  //eBaseClass
  m_eBaseClass = BASE_CLASS(m_eBaseClass | eCDataAccess);

  //Rowset
  m_pIAccessor    = NULL;   //Rowset Interface
  m_pIColumnsInfo   = NULL;   //Rowset Interface
  m_pIConvertType   = NULL;   //Rowset Interface
  m_pIColumnsRowset = NULL;   //Rowset interface

  //Extra Interfaces

  //Accessor
  m_hAccessor     = NULL;
  m_cbRowSize     = 0;
  m_pData       = NULL;

  //Bookmark Accessor
  m_hBmkAccessor    = NULL;
  m_bSchemaRowset   = FALSE;
}

CDataAccess::~CDataAccess ( ) [virtual]

Definition at line 51 of file crowset.cpp.

{
}

Member Function Documentation

HRESULT CDataAccess::AddRefAccessor ( HACCESSOR hAccessor ) [virtual]

Definition at line 468 of file crowset.cpp.

{
  HRESULT hr = S_OK;
  ULONG ulRefCount = 0;

  if(m_pIAccessor)
  {
    //IAccessor::AddRefAccessor
    XTEST(hr = m_pIAccessor->AddRefAccessor(hAccessor, &ulRefCount));
    TESTC(TRACE_METHOD(hr, L"IAccessor::AddRefAccessor(0x%p, &%d)", hAccessor, ulRefCount));
  }

CLEANUP:
  return hr;
}

HRESULT CDataAccess::AutoQI ( DWORD dwCreateOpts ) [virtual]

Reimplemented from CAsynchBase.

Reimplemented in CCommand, CDataset, CRow, and CRowset.

Definition at line 76 of file crowset.cpp.

{
  //Delegate First so we have base interfaces
  CAsynchBase::AutoQI(dwCreateOpts);

  //[MANDATORY] Obtain [mandatory] interfaces
  if(dwCreateOpts & CREATE_QI_MANDATORY)
  {
    OBTAIN_INTERFACE(IColumnsInfo);
    OBTAIN_INTERFACE(IAccessor);
    OBTAIN_INTERFACE(IConvertType);
  }

  //Auto QI
  if(dwCreateOpts & CREATE_QI_OPTIONAL)
  {
    OBTAIN_INTERFACE(IColumnsRowset);
  }

  return S_OK;
}

HRESULT CDataAccess::AutoRelease ( ) [virtual]

Reimplemented from CAsynchBase.

Reimplemented in CCommand, CDataset, CRow, and CRowset.

Definition at line 103 of file crowset.cpp.

{
  //Data
  m_bSchemaRowset   = FALSE;

  //ColInfo
  m_ColumnInfo.RemoveAll();

  //Accessor
  m_Bindings.RemoveAll();
  ReleaseAccessor(&m_hAccessor);
  SAFE_FREE(m_pData);
  ReleaseAccessor(&m_hBmkAccessor);

  //Rowset
  RELEASE_INTERFACE(IAccessor);
  RELEASE_INTERFACE(IColumnsInfo);
  RELEASE_INTERFACE(IConvertType);
  RELEASE_INTERFACE(IColumnsRowset);

  //Delegate
  return CAsynchBase::AutoRelease();
}

HRESULT CDataAccess::CreateAccessor | ( | DBACCESSORFLAGS | dwAccessorFlags,
 |  | DBCOUNTITEM | cBindings,
 |  | const DBBINDING * | rgBindings,
 |  | DBLENGTH | cRowSize,
 |  | HACCESSOR * | phAccessor |
 | ) |  |  | [virtual]

Definition at line 436 of file crowset.cpp.

{
  ASSERT(phAccessor);

  HRESULT hr = E_FAIL;
  DBBINDSTATUS* rgStatus = NULL;

  if(m_pIAccessor)
  {
    //Alloc the space to hold the status
    SAFE_ALLOC(rgStatus, DBBINDSTATUS, cBindings);

    //Create the accessor
    *phAccessor = NULL;
    XTEST(hr = m_pIAccessor->CreateAccessor(dwAccessorFlags, cBindings, rgBindings, cRowSize, phAccessor, rgStatus));
    TRACE_METHOD(hr, L"IAccessor::CreateAccessor(0x%08x, %lu, 0x%p, %lu, &0x%p, 0x%p)", dwAccessorFlags, cBindings, rgBindings, cRowSize, *phAccessor, rgStatus);

    //Display Errors
    TESTC(hr = DisplayAccessorErrors(hr, cBindings, rgBindings, rgStatus));
  }

CLEANUP:
  SAFE_FREE(rgStatus);
  return hr;
}

HRESULT CDataAccess::CreateAccessors ( BINDCOLS eBindCols ) [virtual]

Definition at line 263 of file crowset.cpp.

{
  HRESULT hr = S_OK;
  DBCOUNTITEM cBindings = 0;
  DBBINDING* rgBindings = NULL;

  //Release Previous Accessors
  ReleaseAccessor(&m_hAccessor);
  m_Bindings.RemoveAll();
  SAFE_FREE(m_pData);
  ReleaseAccessor(&m_hBmkAccessor);

  //Delegate
  TESTC(hr = SetupBindings(eBindCols, &cBindings, &rgBindings, &m_cbRowSize));
  TESTC(hr = CreateAccessor(DBACCESSOR_ROWDATA, cBindings, rgBindings, m_cbRowSize, &m_hAccessor));

  //Allocate pData
  SAFE_ALLOC(m_pData, BYTE, m_cbRowSize);

CLEANUP:
  m_Bindings.Attach(cBindings, rgBindings);
  return hr;
}

HRESULT CDataAccess::GetColInfo ( ) [virtual]

Definition at line 132 of file crowset.cpp.

{
  HRESULT     hr = E_FAIL;
  DBORDINAL   cColumnInfo = 0;
  DBCOLUMNINFO* rgColumnInfo = NULL;
  WCHAR*      pwszStringBuffer = NULL;
  DBORDINAL   cHiddenColumns  = 0;

  //Release an Previous Info
  m_ColumnInfo.RemoveAll();

  //Delegate
  TESTC(hr = GetColInfo(&cColumnInfo, &rgColumnInfo, &pwszStringBuffer, &cHiddenColumns));

  //Attach
  m_ColumnInfo.Attach(cColumnInfo, rgColumnInfo, pwszStringBuffer, cHiddenColumns);

CLEANUP:
  return hr;
}

HRESULT CDataAccess::GetColInfo | ( | DBORDINAL * | pcColumns,
 |  | DBCOLUMNINFO ** | prgColumnInfo,
 |  | WCHAR ** | ppStringBuffer,
 |  | DBORDINAL * | pcHiddenColumns |
 | ) |  |  | [virtual]

Definition at line 158 of file crowset.cpp.

{
  HRESULT   hr = E_FAIL;

  if(m_pIColumnsInfo)
  {
    //Get column information from the command object via IColumnsInfo::GetColumnInfo
    XTEST(hr = m_pIColumnsInfo->GetColumnInfo(pcColumns, prgColumnInfo, ppStringBuffer));
    TESTC(TRACE_METHOD(hr, L"IColumnsInfo::GetColumnInfo(&%lu, &0x%p, &0x%p)", pcColumns ? *pcColumns : 0, prgColumnInfo ? *prgColumnInfo : NULL, ppStringBuffer ? *ppStringBuffer : NULL));

    //Obtain any Hidden Columns (if requested by the user)
    if(GetOptions()->m_dwRowsetOpts & ROWSET_HIDDENCOLUMNS)
    {
      //DBPROP_HIDDENCOLUMNS
      if(pcColumns && pcHiddenColumns)
      {
        CComPtr<IRowsetInfo> spRowsetInfo;
        if(SUCCEEDED(m_pIColumnsInfo->QueryInterface(IID_IRowsetInfo, (void**)&spRowsetInfo)))
        {
          if(SUCCEEDED(GetProperty(IID_IRowsetInfo, spRowsetInfo, DBPROP_HIDDENCOLUMNS, DBPROPSET_ROWSET, DBTYPE_I4, pcHiddenColumns)))
            *pcColumns += *pcHiddenColumns;
        }
      }
    }
  }

CLEANUP:
  return hr;
}

HRESULT CDataAccess::GetColumnData | ( | const DBBINDING * | pBinding,
 |  | void * | pData,
 |  | DBSTATUS * | pdbStatus,
 |  | DBLENGTH * | pdbLength,
 |  | DBTYPE * | pwSubType,
 |  | WCHAR * | pwszValue,
 |  | ULONG | ulMaxSize,
 |  | DWORD | dwFlags,
 |  | DBTYPE | wBackendType |
 | ) |  |  | [virtual]

Definition at line 513 of file crowset.cpp.

{
  ASSERT(pBinding);
  ASSERT(pwszValue);
  HRESULT hr = S_OK;
  DBTYPE  wSubType = DBTYPE_EMPTY;

  //STATUS
  DBSTATUS dbStatus   = STATUS_IS_BOUND(*pBinding) ? BINDING_STATUS(*pBinding, pData) : DBSTATUS_E_BADSTATUS;

  //LENGTH is the Actual (Untruncated) length of the string
  //We we need to make sure all operations are off of cbMaxLen and not LENGTH bound
  //NOTE: If the length is not bound, we set the length to our cbMaxLength NOT 0.  This is because
  //many datatypes can still be returned, and our conversion routines are based upon the length...
  DBLENGTH dbLength   = LENGTH_IS_BOUND(*pBinding) ? BINDING_LENGTH(*pBinding, pData) : pBinding->cbMaxLen;

  //VALUE
  pwszValue[0] = wEOL;
  void* pValue = VALUE_IS_BOUND(*pBinding) ? &BINDING_VALUE(*pBinding, pData) : NULL;

  //cbMaxLen
  //NOTE: The maximum size we can possibly read is either the specified cbMaxLen or our
  //data buffer we are retriving into for display...

  switch(dbStatus)
  {
    case DBSTATUS_S_ISNULL:
    case DBSTATUS_S_DEFAULT:
    case DBSTATUS_S_IGNORE:
      hr = S_OK;
      goto CLEANUP;

    case DBSTATUS_S_TRUNCATED:
    case DBSTATUS_S_OK:
      break;

    default:
      hr = E_FAIL;
      goto CLEANUP;
  };

  if(pValue)
  {
    //Handle any special conversions ourselves...
    switch(DBTYPE_SRC_DST(pBinding->wType, DBTYPE_WSTR))
    {
      //DBTYPE_IUNKNOWN => DBTYPE_WSTR
      case DBTYPE_SRC_DST(DBTYPE_IUNKNOWN, DBTYPE_WSTR):
      case DBTYPE_SRC_DST(DBTYPE_IUNKNOWN | DBTYPE_BYREF, DBTYPE_WSTR):
      {
        //Handle BYREF as well. (simple enough)
        if(pBinding->wType & DBTYPE_BYREF)
          pValue = *(void**)pValue;

        //IUnknown is not a required conversion to string (WSTR)
        IUnknown* pIUnknown = *(IUnknown**)pValue;

        //Determine the type of object. (default)
        REFIID iid = pBinding->pObject ? pBinding->pObject->iid : IID_IUnknown;

        //Create a temporary stream wrapper...
        CStream  cStream(m_pCMainWindow);
        cStream.CreateObject(this, iid, pIUnknown);
        cStream.m_wType = wBackendType;

        //Read the Stream Object (numerous different stream objects)
        if(FAILED(hr = cStream.ReadString(iid, 0/*ulOffset*/, (ulMaxSize*sizeof(WCHAR))-sizeof(WCHAR), ulMaxSize, pwszValue)))
        {
          //I have no clue what type of object this is, or was unable to read the
          //stream for some reason, so just display the error
          StringFormat(pwszValue, ulMaxSize, L"%S", GetErrorName(hr));
        }

        //The refcount of the Stream now is 1.
        //Our FreeBindingData frees outofline data...
        break;
      }

      default:
      {
        //Otherwise delegate...
        //NOTE: Make sure we indicate to DataConvert that the input buffer is only
        //as large as the specified length, but is bound by our allocated buffer size,
        //so it doesn't try and read beyond valid memory...
        XTESTC_(hr = DataConvert
          (
            dbStatus,
            dbLength,
            pBinding->cbMaxLen,
            pBinding->wType,
            pValue,
            pBinding->bPrecision,
            pBinding->bScale,

            DBTYPE_WSTR,

            //Status.
            //Only update our status if returned successfully from the provider.
            dbStatus == DBSTATUS_S_OK ? &dbStatus : NULL,
            NULL,
            pwszValue,
            ulMaxSize*sizeof(WCHAR),
            dwConvFlags
          ),S_OK);

        //Indicate a sub type...
        if(pBinding->wType == DBTYPE_VARIANT)
        {
          VARIANT* pVariant = (VARIANT*)pValue;
          wSubType = pVariant->vt;
        }
        break;
      }
    };
  }

  //PostProcessing
  if(SUCCEEDED(hr))
  {
    //Hexadecimal
    if(dwConvFlags & CONV_HEX)
    {
      switch(wBackendType)
      {
        case DBTYPE_I1:
        case DBTYPE_UI1:
        case DBTYPE_I2:
        case DBTYPE_UI2:
        case DBTYPE_I4:
        case DBTYPE_UI4:
          PostProcessString(pwszValue, ulMaxSize, dwConvFlags);
          break;

        default:
          break;
      };
    }

    //Schema Rowsets:
    if(m_bSchemaRowset && (dwConvFlags & CONV_TYPENAME))
    {
      //Special Handling for Known Schema Rowsets,
      //map the "DBTYPE" column from UI2 to a textual name of the Type...
      if(
          (pBinding->iOrdinal == 2    && m_guidSource == DBSCHEMA_PROVIDER_TYPES)
        ||  (pBinding->iOrdinal == 12   && m_guidSource == DBSCHEMA_COLUMNS)
        ||  (pBinding->iOrdinal == 8    && m_guidSource == DBSCHEMA_TABLES_INFO)
        ||  (pBinding->iOrdinal == 10 && m_guidSource == DBSCHEMA_PROCEDURE_COLUMNS)
        )
      {
        //TODO: Why the double conversion?
        ASSERT(wBackendType == DBTYPE_UI2);

        //The SchemaRowset column just contains an string(integer) of the type.
        //(ie: DBTYPE_WSTR = "130".  So we need to convert the string to an int, then to
        //the actual assoicated mapped type name (for ease of viewing without having to
        //have the header handy when viewing schemas).
        DBTYPE wSchemaType;
        if(ConvertToLONG(pwszValue, (LONG*)&wSchemaType, 0/*Min*/, LONG_MAX, 0/*Base*/))
        {
          //NOTE: on failure we have no choice to leave the column as the original
          //returned integer.
          StringCopy(pwszValue, GetDBTypeName(wSchemaType), ulMaxSize);
        }
      }
    }
  }

CLEANUP:
  //Output Params
  if(pdbStatus)
    *pdbStatus = dbStatus;
  if(pdbLength)
    *pdbLength = dbLength;
  if(pwSubType)
    *pwSubType = wSubType;
  return hr;
}

INT CDataAccess::GetColumnImage | ( | const DBCOLUMNINFO * | pColInfo,
 |  | DBSTATUS | dbStatus = DBSTATUS_S_OK |
 | ) |  |  | [virtual]

Definition at line 193 of file crowset.cpp.

{
  //NOTE:  Errors take precidence in the following function over readonly or chapter icons...

  //Otherwise determine image from Status
  switch(dbStatus)
  {
    case DBSTATUS_S_OK:
    case DBSTATUS_S_ISNULL:
    case DBSTATUS_S_DEFAULT:
    case DBSTATUS_S_IGNORE:
      if(pColInfo)
      {
        //Hidden Column?
        if(m_ColumnInfo.IsHidden(pColInfo->iOrdinal))
          return IMAGE_DELETE;

        //Chapter Column (takes precidence)
        if(pColInfo->dwFlags & DBCOLUMNFLAGS_ISCHAPTER)
          return IMAGE_CHAPTER;

        //ReadOnly Column
        if(!(pColInfo->dwFlags & DBCOLUMNFLAGS_WRITE || pColInfo->dwFlags & DBCOLUMNFLAGS_WRITEUNKNOWN))
          return IMAGE_LOCK;
      }
      return IMAGE_NONE;

    case DBSTATUS_S_TRUNCATED:
      return IMAGE_QUESTION;

    default:
      return IMAGE_ERROR;
  }

  return IMAGE_NORMAL;
}

HRESULT CDataAccess::GetColumnsRowset | ( | CAggregate * | pCAggregate,
 |  | bool | fOptColumns,
 |  | REFIID | riid,
 |  | ULONG | cPropSets,
 |  | DBPROPSET * | rgPropSets,
 |  | IUnknown ** | ppIUnknown |
 | ) |  |  | [virtual]

Definition at line 807 of file crowset.cpp.

{
  DBORDINAL i,cOptColumns = 0;
  DBID* rgOptColumns = 0;
  HRESULT hr = S_OK;

  if(!m_pIColumnsRowset)
    return E_FAIL;

  //GetAvailableColumns
  //We just use cRestrictions passed in as the flag
  //to indicate weither to use Optional Columns
  if(fOptColumns)
  {
    XTEST(hr = m_pIColumnsRowset->GetAvailableColumns(&cOptColumns, &rgOptColumns));
    TESTC(TRACE_METHOD(hr, L"IColumnsRowset::GetAvailableColumns(&%lu, &0x%p)", cOptColumns, rgOptColumns));
  }

  //GetColumnsRowset
  XTEST_(hr = m_pIColumnsRowset->GetColumnsRowset(
            pCAggregate,    // punkOuter
            cOptColumns,    // cOptionalColumns
            rgOptColumns,   // rgOptionalColumns
            riid,       // rowset interface
            cPropSets,      // # of properties
            rgPropSets,     // properties
            ppIUnknown),S_OK);  // rowset pointer
  TRACE_METHOD(hr, L"IColumnsRowset::GetColumnsRowset(0x%p, %lu, 0x%p, %s, %d, 0x%p, &0x%p)", pCAggregate, cOptColumns, rgOptColumns, GetInterfaceName(riid), cPropSets, rgPropSets, ppIUnknown ? *ppIUnknown : NULL);

  //Display Errors (if occurred)
  TESTC(hr = DisplayPropErrors(hr, cPropSets, rgPropSets));

  //Handle Aggregation
  if(pCAggregate)
    TESTC(hr = pCAggregate->HandleAggregation(riid, ppIUnknown));

CLEANUP:
  //FreeDBIDs
  for(i=0; i<cOptColumns; i++)
    DBIDFree(&rgOptColumns[i]);
  SAFE_FREE(rgOptColumns);
  return hr;
}

IUnknown ** CDataAccess::GetInterfaceAddress ( REFIID riid ) [virtual]

Reimplemented from CAsynchBase.

Reimplemented in CCommand, CDataset, CRow, and CRowset.

Definition at line 60 of file crowset.cpp.

{
  HANDLE_GETINTERFACE(IAccessor);
  HANDLE_GETINTERFACE(IColumnsInfo);
  HANDLE_GETINTERFACE(IConvertType);
  HANDLE_GETINTERFACE(IColumnsRowset);

  //Otherwise delegate
  return CAsynchBase::GetInterfaceAddress(riid);
}

HRESULT CDataAccess::ReleaseAccessor | ( | HACCESSOR * | phAccessor,
 |  | BOOL | fReleaseAlways = FALSE |
 | ) |  |  | [virtual]

Definition at line 489 of file crowset.cpp.

{
  ASSERT(phAccessor);
  HRESULT hr = S_OK;
  ULONG ulRefCount = 0;

  if(m_pIAccessor && (*phAccessor || fReleaseAlways))
  {
    XTEST(hr = m_pIAccessor->ReleaseAccessor(*phAccessor, &ulRefCount));
    TESTC(TRACE_METHOD(hr, L"IAccessor::ReleaseAccessor(0x%p, &%d)", *phAccessor, ulRefCount));
  }

CLEANUP:
  //Only NULL the handle if the RefCount is 0
  if(ulRefCount == 0)
    *phAccessor = NULL;
  return hr;
}

HRESULT CDataAccess::SetColumnData | ( | const DBBINDING * | pBinding,
 |  | void * | pData,
 |  | DBSTATUS | dbStatus,
 |  | DBLENGTH | dbLength,
 |  | WCHAR * | pwszValue,
 |  | DWORD | dwFlags,
 |  | DBTYPE | wBackendType |
 | ) |  |  | [virtual]

Definition at line 700 of file crowset.cpp.

{
  //NOTE: We ASSERT on pwszValue since DataConvert and even our conversion reqturns will fails
  //for NULL source.  If you really have a NULL string it should be since as an empty
  //string for conversion purposes and DataConvert will set length = 0...
  ASSERT(pwszValue);
  ASSERT(pBinding);

  HRESULT hr = S_OK;
  void* pValue = VALUE_IS_BOUND(*pBinding) ? &BINDING_VALUE(*pBinding, pData) : NULL;
  DBSTATUS  dbDstStatus = dbStatus;
  DBLENGTH  cbDstLength = 0;

  //STATUS
  switch(dbStatus)
  {
    case DBSTATUS_S_OK:
    case DBSTATUS_S_TRUNCATED:
      break;

    default:
      //Any other Status, IGNORE, ISNULL, DEFAULT, ERROR, were done, nothing to convert...
      goto CLEANUP;
  }

  if(pValue)
  {
    //Handle any special conversions ourselves...
    switch(DBTYPE_SRC_DST(pBinding->wType, DBTYPE_WSTR))
    {
      //DBTYPE_IUNKNOWN => DBTYPE_WSTR
      case DBTYPE_SRC_DST(DBTYPE_IUNKNOWN, DBTYPE_WSTR):
      case DBTYPE_SRC_DST(DBTYPE_IUNKNOWN | DBTYPE_BYREF, DBTYPE_WSTR):
      {
        //Handle BYREF as well. (simple enough)
        if(pBinding->wType & DBTYPE_BYREF)
        {
          SAFE_ALLOC(*(void**)pValue, IUnknown*, 1);
          pValue = *(void**)pValue;
        }

        //Create the storage object (buffer) to use for SetData.
        CStorageBuffer* pCStorageBuffer = new CStorageBuffer; //m_cRef=1

        //Create a temporary stream wrapper...
        CStream  cStream(m_pCMainWindow);
        cStream.CreateObject(this, IID_IStream, (IStream*)pCStorageBuffer);
        cStream.m_wType = wBackendType;

        //Now, Set the user entered data into our storage object.
        //NOTE:  We set the Length = total bytes in stream, since some providers
        //requires this ahead of time.  And we reset the stream so the current seek
        //is at the head for when the provider begins to read from the stream on SetData
        cStream.WriteString(IID_ISequentialStream, 0, pwszValue ? wcslen(pwszValue)*sizeof(WCHAR) : 0, pwszValue, &cbDstLength);
        pCStorageBuffer->Seek(0);

        //Passing the object pointer should be suffiencent enough, as the provider
        //will have to QI of the object anyway to determine if it even supports
        //the interface, but since many incorrectly do not we will explictly
        //QI here so the majority of the providers don't crash
        IUnknown* pIUnknown = NULL;
        XTESTC_(pCStorageBuffer->QueryInterface(pBinding->pObject ? pBinding->pObject->iid : IID_IUnknown, (void**)&pIUnknown), S_OK);
        *(IUnknown**)pValue = pIUnknown;

        //The refcount of the Stream now is 2.
        //The provider releases one, and our FreeBindingData fress outofline data...
        break;
      }

      default:
      {
        //Otherwise delegate...
        XTESTC_(hr = DataConvert
          (
            dbStatus,
            dbLength * sizeof(WCHAR),
            dbLength * sizeof(WCHAR) + sizeof(WCHAR),
            DBTYPE_WSTR,
            pwszValue,
            pBinding->bPrecision,
            pBinding->bScale,

            pBinding->wType,
            &dbDstStatus,
            &cbDstLength,
            pValue,
            pBinding->cbMaxLen,
            dwConvFlags
          ),S_OK);
        break;
      }
    };
  }

CLEANUP:
  if(STATUS_IS_BOUND(*pBinding))
    BINDING_STATUS(*pBinding, pData) = dbDstStatus;
  if(LENGTH_IS_BOUND(*pBinding))
    BINDING_LENGTH(*pBinding, pData) = cbDstLength;
  return hr;
}

HRESULT CDataAccess::SetupBindings | ( | BINDCOLS | eBindCols,
 |  | DBCOUNTITEM * | cBindings,
 |  | DBBINDING ** | prgBindings,
 |  | DBLENGTH * | pcRowSize = NULL |
 | ) |  |  | [virtual]

Definition at line 292 of file crowset.cpp.

{
  HRESULT hr = S_OK;

  DBLENGTH dwOffset = 0;
  DBCOUNTITEM i,cBindings = 0;
  DBBINDING* rgBindings = NULL;

  //Only capable of the Following Converions (for Display)
  DWORD dwMaxLength   = GetOptions()->m_dwMaxLength;
  DWORD dwAccessorOpts  = GetOptions()->m_dwAccessorOpts;

  //Alloc the space to hold the Bindings
  SAFE_ALLOC(rgBindings, DBBINDING, m_ColumnInfo.GetCount());

  cBindings = 0;
  for(i=0; i<m_ColumnInfo.GetCount(); i++)
  {
    DBCOLUMNINFO* pColInfo  = &m_ColumnInfo[i];
    DBBINDING*    pBinding  = &rgBindings[cBindings];

    //Setup the Bindings
    pBinding->iOrdinal  = pColInfo->iOrdinal;
    pBinding->obStatus  = dwOffset;
    dwOffset += ROUNDUP(sizeof(DBSTATUS));
    pBinding->obLength  = dwOffset;
    dwOffset += ROUNDUP(sizeof(DBLENGTH));
    pBinding->obValue = dwOffset;

    pBinding->pTypeInfo = NULL;
    pBinding->pBindExt  = NULL;

    pBinding->dwPart  = dwAccessorOpts & (DBPART_VALUE|DBPART_LENGTH|DBPART_STATUS);
    pBinding->dwMemOwner= (dwAccessorOpts & ACCESSOR_OWNED_PROVIDER) ? DBMEMOWNER_PROVIDEROWNED : DBMEMOWNER_CLIENTOWNED;
    pBinding->eParamIO  = DBPARAMIO_NOTPARAM;

    pBinding->dwFlags = 0;
    pBinding->bPrecision= pColInfo->bPrecision;
    pBinding->bScale  = pColInfo->bScale;

    pBinding->pObject = NULL;
    pBinding->wType   = GetOptions()->GetBindingType(pColInfo->wType);
    pBinding->cbMaxLen  = GetMaxDisplaySize(pBinding->wType, pColInfo->wType, pColInfo->ulColumnSize, dwMaxLength);

    //BLOB or IUnknown Bindings
    if(pBinding->wType == DBTYPE_IUNKNOWN || pColInfo->wType == DBTYPE_IUNKNOWN ||
      (pColInfo->dwFlags & DBCOLUMNFLAGS_ISLONG && (dwAccessorOpts & (ACCESSOR_BLOB_ISEQSTREAM|ACCESSOR_BLOB_ILOCKBYTES|ACCESSOR_BLOB_ISTORAGE|ACCESSOR_BLOB_ISTREAM))))
    {
      //For ColumnsRowset
      pBinding->wType   = DBTYPE_IUNKNOWN;
      pBinding->cbMaxLen  = sizeof(IUnknown*);

      //Create pObject
      SAFE_ALLOC(pBinding->pObject, DBOBJECT, 1);
      pBinding->pObject->dwFlags  = STGM_READ;
      pBinding->pObject->iid    = IID_IUnknown;

      //Setup pObject->iid
      if(dwAccessorOpts & ACCESSOR_BLOB_ISEQSTREAM)
        pBinding->pObject->iid    = IID_ISequentialStream;
      else if(dwAccessorOpts & ACCESSOR_BLOB_ISTREAM)
        pBinding->pObject->iid    = IID_IStream;
      else if(dwAccessorOpts & ACCESSOR_BLOB_ILOCKBYTES)
        pBinding->pObject->iid    = IID_ILockBytes;
      else if(dwAccessorOpts & ACCESSOR_BLOB_ISTORAGE)
        pBinding->pObject->iid    = IID_IStorage;
    }

    //Special Handling for other non-OLE DB defined convertable types to WSTR
    //NOTE: The spec requires all supported types to be converted to
    //WSTR, but this only applies where the OLE DB conversion is defined.
    //Some are not defined so we need to bind nativly.
    switch(pColInfo->wType)
    {
      case DBTYPE_IUNKNOWN:
      case DBTYPE_IDISPATCH:
        pBinding->wType   = pColInfo->wType;
        pBinding->cbMaxLen  = sizeof(IUnknown*);
        break;

      case DBTYPE_HCHAPTER:
        pBinding->wType   = pColInfo->wType;
        pBinding->cbMaxLen  = sizeof(HCHAPTER);
        break;

      default:
        //DBTYPE_VECTOR
        if(pColInfo->wType & DBTYPE_VECTOR)
        {
          pBinding->wType   = pColInfo->wType;
          pBinding->cbMaxLen  = sizeof(DBVECTOR);
        }

        //DBTYPE_ARRAY
        if(pColInfo->wType  & DBTYPE_ARRAY)
        {
          pBinding->wType   = pColInfo->wType;
          pBinding->cbMaxLen  = sizeof(SAFEARRAY*);
        }
        break;
    };

    //Offset
    dwOffset += pBinding->cbMaxLen;
    dwOffset = ROUNDUP( dwOffset );

    switch(eBindCols)
    {
      case BIND_ALLCOLS:
        cBindings++;
        break;

      case BIND_ALLCOLSEXPECTBOOKMARK:
        if(pColInfo->iOrdinal != 0)
          cBindings++;
        break;

      case BIND_UPDATEABLECOLS:
        if(pColInfo->dwFlags & DBCOLUMNFLAGS_WRITE || pColInfo->dwFlags & DBCOLUMNFLAGS_WRITEUNKNOWN)
          cBindings++;
        break;

      default:
        ASSERT(!"Unhandled Type!");
        break;
    }
  }

  //Size for pData
  if(pcRowSize)
    *pcRowSize = dwOffset;

CLEANUP:
  //Accessors
  *pcBindings = cBindings;
  *prgBindings = rgBindings;
  return hr;
}

HRESULT CDataAccess::ValidateAccessor | ( | HACCESSOR | hAccessor,
 |  | ULONG | ulRefCount = 1 |
 | ) |  |  | [virtual]

Definition at line 235 of file crowset.cpp.

{
  //Warn user about NULL Accessor handle...
  if(hAccessor == DB_NULL_HACCESSOR || ulRefCount == 0)
  {
    if(IDNO == wMessageBox
      (
        GetFocus(),
        MB_TASKMODAL | MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON1,
        wsz_ERROR,
        L"hAccessor == 0x%p\n"
        L"%s\n\n"
        L"This may crash your Provider...\n"
        L"Do you wish to continue anyway?",
        hAccessor,
        hAccessor == DB_NULL_HROW ? L"Invalid Accessor Handle" : L"Released Accessor Handle"
      )
      )
      return E_FAIL;
  }

  return S_OK;
}

Member Data Documentation

CBindings CDataAccess::m_Bindings

Definition at line 231 of file crowset.h.

BOOL CDataAccess::m_bSchemaRowset

Definition at line 238 of file crowset.h.

DBLENGTH CDataAccess::m_cbRowSize

Reimplemented in CRow, CRow, and CRowset.

Definition at line 233 of file crowset.h.

CColumnInfo CDataAccess::m_ColumnInfo

Definition at line 228 of file crowset.h.

HACCESSOR CDataAccess::m_hAccessor

Definition at line 232 of file crowset.h.

HACCESSOR CDataAccess::m_hBmkAccessor

Definition at line 237 of file crowset.h.

void* CDataAccess::m_pData

Definition at line 234 of file crowset.h.

IAccessor* CDataAccess::m_pIAccessor

Reimplemented in CCommand, and CRowset.

Definition at line 220 of file crowset.h.

IColumnsInfo* CDataAccess::m_pIColumnsInfo

Reimplemented in CCommand, CRow, and CRowset.

Definition at line 221 of file crowset.h.

IColumnsRowset* CDataAccess::m_pIColumnsRowset

Definition at line 225 of file crowset.h.

IConvertType* CDataAccess::m_pIConvertType

Reimplemented in CCommand, CRow, and CRowset.

Definition at line 222 of file crowset.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/crowset.h
  • Dataaccess/oledb/rowsetviewer/crowset.cpp
Generated on Wed Nov 13 2024 16:55:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDataGrid Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CDataGrid Class Reference

#include "datagrid.h"

Inherits CListViewLite.

List of all members.

Public Member Functions

CDataGrid (CMDIChild *pCMDIChild)
virtual | ~CDataGrid ()
virtual HRESULT | AddRefRows (INDEX iIndex)
LPDISPATCH | CaptureImage ()
virtual BOOL | ClearAll (WCHAR *pwszEmptyHeader=NULL)
void | ClearFields ()
void | ClearSelCols ()
short | ColContaining (float X)
virtual BOOL | Create (LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, UINT nID, CCreateContext *pContext=NULL)
BOOL | Create (LPCTSTR lpszWindowName, DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, UINT nID, CFile *pPersist=NULL, BOOL bStorage=FALSE, BSTR bstrLicKey=NULL)
virtual HRESULT | DisplayColumnInfo ()
virtual HRESULT | DisplayData (HROW hRow, INDEX iIndex, DBPROPID dwSourceID=DBPROP_IRowset, bool fAlways=FALSE)
virtual HRESULT | DisplayFetchPosition (INDEX iIndex, BOOL fLastFetchForward)
virtual HRESULT | DisplayRows (DBROWOFFSET lOffset, DBROWCOUNT cRows, DBCOUNTITEM cRowsObtained, HROW *rghRows, BOOL fAdjustFetchPosition=TRUE)
long | GetAddNewMode ()
BOOL GetAllowAddNew ()
BOOL GetAllowArrows ()
BOOL GetAllowDelete ()
BOOL GetAllowRowSizing ()
BOOL GetAllowUpdate ()
long | GetAppearance ()
long | GetApproxCount ()
unsigned long | GetBackColor ()
VARIANT | GetBookmark ()
VARIANT | GetBookmark (long RowNum)
long | GetBorderStyle ()
CString GetCaption ()
CLSID const & | GetClsid ()
short | GetCol ()
BOOL GetColumnHeaders ()
LPDISPATCH | GetColumns ()
BOOL GetCurrentCellModified ()
BOOL GetCurrentCellVisible ()
BOOL GetDataChanged ()
LPDISPATCH | GetDataFormats ()
CString GetDataMember ()
LPUNKNOWN | GetDataSource ()
float | GetDefColWidth ()
BOOL GetEditActive ()
BOOL GetEnabled ()
CString GetErrorText ()
VARIANT | GetFirstRow ()
LPDISPATCH | GetFont ()
unsigned long | GetForeColor ()
LPDISPATCH | GetHeadFont ()
float | GetHeadLines ()
long | GetHWnd ()
long | GetHWndEditor ()
short | GetLeftCol ()
long | GetMarqueeStyle ()
virtual HRESULT | GetNextRows (DBROWOFFSET lOffset, DBROWCOUNT cRows, BOOL fRetry=FALSE)
virtual COptionsSheet * | GetOptions ()
BOOL GetRecordSelectors ()
BOOL GetRightToLeft ()
short | GetRow ()
long | GetRowDividerStyle ()
float | GetRowHeight ()
long | GetScrollBars ()
LPDISPATCH | GetSelBookmarks ()
virtual INDEX | GetSelectedRow (HROW *phRow=NULL, BOOL fValidate=TRUE)
short | GetSelEndCol ()
long | GetSelLength ()
long | GetSelStart ()
short | GetSelStartCol ()
CString GetSelText ()
short | GetSplit ()
LPDISPATCH | GetSplits ()
BOOL GetTabAcrossSplits ()
long | GetTabAction ()
CString GetText ()
short | GetVisibleCols ()
short | GetVisibleRows ()
BOOL GetWrapCellPointer ()
void | HoldFields ()
virtual BOOL | OnColumnClick (INT idCtrl, NMLISTVIEW *pNMListView)
virtual BOOL | OnContextMenu (HWND hWnd, REFPOINTS pts)
virtual BOOL | OnItemActivate (INT idCtrl, NMLISTVIEW *pNMListView)
virtual BOOL | OnKeyDown (WPARAM nVirtKey, LPARAM lKeyData)
virtual BOOL | OnRButtonDown (WPARAM fwKeys, REFPOINTS pts)
virtual BOOL | OnSize (WPARAM nType, REFPOINTS pts)
virtual BOOL | OnVScroll (int nScrollCode, int nPos, HWND hWnd)
void | ReBind ()
void | Refresh ()
virtual HRESULT | RefreshData ()
virtual HRESULT | ReleaseHeldRows ()
virtual HRESULT | ReleaseRows (INDEX iIndex, BOOL fOnlyValidRows)
virtual HRESULT | RestartPosition ()
VARIANT | RowBookmark (short RowNum)
short | RowContaining (float Y)
float | RowTop (short RowNum)
void | Scroll (long Cols, long Rows)
virtual HRESULT | ScrollGrid (DBROWCOUNT cItems)
void | SetAllowAddNew (BOOL bNewValue)
void | SetAllowArrows (BOOL bNewValue)
void | SetAllowDelete (BOOL bNewValue)
void | SetAllowRowSizing (BOOL bNewValue)
void | SetAllowUpdate (BOOL bNewValue)
void | SetAppearance (long nNewValue)
void | SetBackColor (unsigned long newValue)
void | SetBookmark (const VARIANT &newValue)
void | SetBorderStyle (long nNewValue)
void | SetCaption (LPCTSTR lpszNewValue)
void | SetCol (short nNewValue)
void | SetColumnHeaders (BOOL bNewValue)
void | SetCurrentCellModified (BOOL bNewValue)
void | SetCurrentCellVisible (BOOL bNewValue)
void | SetDataChanged (BOOL bNewValue)
void | SetDataMember (LPCTSTR lpszNewValue)
void | SetDefColWidth (float newValue)
void | SetEditActive (BOOL bNewValue)
void | SetEnabled (BOOL bNewValue)
void | SetFirstRow (const VARIANT &newValue)
void | SetForeColor (unsigned long newValue)
void | SetHeadLines (float newValue)
void | SetLeftCol (short nNewValue)
void | SetMarqueeStyle (long nNewValue)
void | SetRecordSelectors (BOOL bNewValue)
void | SetRefDataSource (LPUNKNOWN newValue)
void | SetRefFont (LPDISPATCH newValue)
void | SetRefHeadFont (LPDISPATCH newValue)
void | SetRightToLeft (BOOL bNewValue)
void | SetRow (short nNewValue)
void | SetRowDividerStyle (long nNewValue)
void | SetRowHeight (float newValue)
void | SetScrollBars (long nNewValue)
void | SetSelEndCol (short nNewValue)
void | SetSelLength (long nNewValue)
void | SetSelStart (long nNewValue)
void | SetSelStartCol (short nNewValue)
void | SetSelText (LPCTSTR lpszNewValue)
void | SetSplit (short nNewValue)
void | SetTabAcrossSplits (BOOL bNewValue)
void | SetTabAction (long nNewValue)
void | SetText (LPCTSTR lpszNewValue)
void | SetWrapCellPointer (BOOL bNewValue)
short | SplitContaining (float X, float Y)

Public Attributes

BOOL m_fLastFetchForward
INDEX m_iSelCol
INDEX m_iSelRow
DBROWOFFSET | m_lCurPos
INDEX m_lMaxRows
CMDIChild * m_pCMDIChild

Detailed Description

Definition at line 15 of file datagrid.h.

Constructor & Destructor Documentation

CDataGrid::CDataGrid ( CMDIChild * pCMDIChild )

Definition at line 10136 of file cmdichild.cpp.

{
  ASSERT(pCMDIChild);

  //Data
  m_pCMDIChild      = pCMDIChild;
  m_lMaxRows        = 0;

  //Cursor
  m_fLastFetchForward   = FALSE;
  m_lCurPos       = 0;
}

CDataGrid::~CDataGrid ( ) [virtual]

Definition at line 10153 of file cmdichild.cpp.

{
}

Member Function Documentation

HRESULT CDataGrid::AddRefRows ( INDEX iIndex ) [virtual]

Definition at line 11024 of file cmdichild.cpp.

{
  HRESULT hr = S_OK;
  CRowset*  pCRowset = (CRowset*)m_pCMDIChild->GetObject(eCRowset);

  INDEX cRows = 0;
  HROW* rghRows = NULL;
  ULONG* rgRefCounts = NULL;

  //AddRefRows all Rows
  if(iIndex == LV_ALLITEMS)
  {
    //Find all Rows
    LV_GetAllItems(m_hWnd, &cRows, NULL, (LPARAM**)&rghRows);
  }
  //AddRefRows all selected rows
  else if(iIndex == LV_ALLSELITEMS)
  {
    //Find all Selected Rows
    LV_GetSelItems(m_hWnd, &cRows, NULL, (LPARAM**)&rghRows);
  }
  //AddRefRows 1 Row
  else
  {
    //First need to obtain the LPARAM (hRow) to Release it...
    cRows = 1;
    rghRows[0] = GetItemParam(iIndex);
  }

  //Now AddRefRows in 1 pass
  if(pCRowset && pCRowset->GetObjectType() != eCDataset)
  {
    SAFE_ALLOC(rgRefCounts, ULONG, cRows);
    TESTC(hr = pCRowset->AddRefRows(cRows, rghRows, rgRefCounts));
  }

CLEANUP:
  SAFE_FREE(rghRows);
  SAFE_FREE(rgRefCounts);
  return hr;
}

LPDISPATCH CDataGrid::CaptureImage ( )

Definition at line 722 of file datagrid.cpp.

{
  LPDISPATCH result;
  InvokeHelper(0x65, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, NULL);
  return result;
}

BOOL CDataGrid::ClearAll ( WCHAR * pwszEmptyHeader = NULL ) [virtual]

Definition at line 11082 of file cmdichild.cpp.

{
  // Delete all of the items. (no need to release rows...)
  DeleteAllItems();

  // Delete all of the columns and their names.
  while(DeleteColumn(0));

  //Indicate no Rowset
  if(pwszEmptyName)
  {
    InsertColumn(0, pwszEmptyName);
    SetColumnWidth(0, LVSCW_AUTOSIZE_USEHEADER);
  }

  return TRUE;
}

void CDataGrid::ClearFields ( )

Definition at line 734 of file datagrid.cpp.

{
  InvokeHelper(0x67, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
}

void CDataGrid::ClearSelCols ( )

Definition at line 729 of file datagrid.cpp.

{
  InvokeHelper(0x66, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
}

short CDataGrid::ColContaining ( float X )

Definition at line 739 of file datagrid.cpp.

{
  short result;
  static BYTE parms[] =
    VTS_R4;
  InvokeHelper(0x68, DISPATCH_METHOD, VT_I2, (void*)&result, parms,
    X);
  return result;
}

virtual BOOL CDataGrid::Create | ( | LPCTSTR | lpszClassName,
 |  | LPCTSTR | lpszWindowName,
 |  | DWORD | dwStyle,
 |  | const RECT & | rect,
 |  | CWnd * | pParentWnd,
 |  | UINT | nID,
 |  | CCreateContext * | pContext = NULL |
 | ) |  |  | [inline, virtual]

Definition at line 26 of file datagrid.h.

  { return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID); }

BOOL CDataGrid::Create | ( | LPCTSTR | lpszWindowName,
 |  | DWORD | dwStyle,
 |  | const RECT & | rect,
 |  | CWnd * | pParentWnd,
 |  | UINT | nID,
 |  | CFile * | pPersist = NULL,
 |  | BOOL | bStorage = FALSE,
 |  | BSTR | bstrLicKey = NULL |
 | ) |  |  | [inline]

Definition at line 33 of file datagrid.h.

  { return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID,
    pPersist, bStorage, bstrLicKey); }

HRESULT CDataGrid::DisplayColumnInfo ( ) [virtual]

Definition at line 10467 of file cmdichild.cpp.

{
  INDEX iResult = 0;
  CDataAccess* pCDataAccess = m_pCMDIChild->m_pCDataAccess;

  //Insert the Column Headers.
  //Only display the columns for which are bound in the Accessor

  //Insert Row Header
  InsertColumn(0, pCDataAccess->GetObjectType() == eCDataset ? L"  Cell Ordinal  " : L"  Row Handle  ");

  //Loop through the columns
  for(ULONG i=0; i<pCDataAccess->m_Bindings.GetCount(); i++)
  {
    const DBCOLUMNINFO* pColInfo = pCDataAccess->m_ColumnInfo.GetOrdinal(pCDataAccess->m_Bindings[i].iOrdinal);

    //Get ColumnName
    iResult = InsertColumn(i+1, GetColName(pColInfo), pCDataAccess->GetColumnImage(pColInfo));
  }

  //AutoSize Columns, (including "Row-Handle" column)
  for(i=0; i<pCDataAccess->m_Bindings.GetCount()+1; i++)
    SetColumnWidth(i, LVSCW_AUTOSIZE_USEHEADER);

  //CLEANUP:
    return iResult == LVM_ERR ? E_FAIL : S_OK;
}

HRESULT CDataGrid::DisplayData | ( | HROW | hRow,
 |  | INDEX | iIndex,
 |  | DBPROPID | dwSourceID = DBPROP_IRowset,
 |  | bool | fAlways = FALSE |
 | ) |  |  | [virtual]

Definition at line 10550 of file cmdichild.cpp.

{
  ASSERT(iIndex >=0 && iIndex<ULONG_MAX);
  HRESULT hr = E_FAIL;
  CDataAccess* pCDataAccess = m_pCMDIChild->m_pCDataAccess;
  CRow*    pCRow      = SOURCE_GETOBJECT(pCDataAccess, CRow);
  CRowset*   pCRowset   = SOURCE_GETOBJECT(pCDataAccess, CRowset);
  CDataset*  pCDataset    = SOURCE_GETOBJECT(pCDataAccess, CDataset);
  void* pData = pCDataAccess->m_pData;

  DBSTATUS dbStatus = 0;
  DWORD i,dwConvFlags = GetOptions()->m_dwConvFlags;
  WCHAR wszBuffer[MAX_COL_SIZE+1] = {0};

  //NOTE: We obtain/display the data - unless the users wishes to not obtain
  //the data by default, or this is called from a method that should always obtain data (ie: GetData)
  if(fAlways || !(GetOptions()->m_dwRowsetOpts & ROWSET_NODATA))
  {
    //This displays data from any source.
    if(pCRow && dwSourceID == DBPROP_IRow)
    {
      //IRow::GetColumns
      hr = pCRow->GetColumns(pCRow->m_cColAccess, pCRow->m_rgColAccess);
    }
    else if(pCRowset)
    {
      //IRowset::GetData
      hr = pCRowset->GetData(hRow, NULL, pData, dwSourceID);
    }
    else if(pCDataset)
    {
      hRow = iIndex;

      //IMDDataset::GetCellData
      hr = pCDataset->GetCellData(hRow, hRow);
    }

    //Relax the errors here.  With Get*Data both DB_S/DB_E will return a bad
    //status for 1 or more columns.  Or DataGrid will just display the column
    //status if not S_OK.  So for these errors just display the data anyway...
    if(SUCCEEDED(hr) || hr== DB_E_ERRORSOCCURRED)
    {
      //Display all Columns
      for(i=0; i<pCDataAccess->m_Bindings.GetCount(); i++)
      {
        const DBBINDING* pBinding   = &pCDataAccess->m_Bindings[i];
        const DBCOLUMNINFO* pColInfo  = pCDataAccess->m_ColumnInfo.GetOrdinal(pBinding->iOrdinal);

        //Obtain the column data...
        pCDataAccess->GetColumnData(pBinding, pData, &dbStatus, NULL/*pdbLength*/, NULL, wszBuffer, MAX_COL_SIZE, dwConvFlags | CONV_TYPENAME, pColInfo->wType);

        //Set item in ListView
          SetItemText(iIndex, i+1, wszBuffer);
        SetItemImage(iIndex, i+1, pCDataAccess->GetColumnImage(NULL, dbStatus));
      }

      //Clean outofline memory data
      //TODO - need to free in the case of errors as well.  But have to be careful
      //since the pData may not have been setup yet, or other errors where its undefined...
      pCDataAccess->m_Bindings.FreeData(pData);
    }
  }

  //Now add the "hRow" indicator
  if(hRow)
    StringFormat(wszBuffer, NUMELE(wszBuffer), L"0x%p", hRow);
  else
    StringFormat(wszBuffer, NUMELE(wszBuffer), L"No Handle");
  SetItemText(iIndex, 0, wszBuffer);
  SetItemParam(iIndex, 0, hRow);
    return hr;
}

HRESULT CDataGrid::DisplayFetchPosition | ( | INDEX | iIndex,
 |  | BOOL | fLastFetchForward |
 | ) |  |  | [virtual]

Definition at line 10764 of file cmdichild.cpp.

{
  //Display the direction of the cursor
  SetItemImage(iIndex, 0, fLastFetchForward ? IMAGE_ARROW_DOWN : IMAGE_ARROW_UP);

  //Display the new Selection Bar for this row
  SetItemState(iIndex, 0, LVIS_SELECTED, LVIS_SELECTED);

  //Update our saved cursor position
  m_lCurPos     = iIndex;
  m_fLastFetchForward = fLastFetchForward;

  //Make sure the item is visible
  EnsureVisible(iIndex);
  return S_OK;
}

HRESULT CDataGrid::DisplayRows | ( | DBROWOFFSET | lOffset,
 |  | DBROWCOUNT | cRows,
 |  | DBCOUNTITEM | cRowsObtained,
 |  | HROW * | rghRows,
 |  | BOOL | fAdjustFetchPosition = TRUE |
 | ) |  |  | [virtual]

Definition at line 10633 of file cmdichild.cpp.

{
  HRESULT hr = S_OK;
  DBROWOFFSET lStartIndex = lOffset;
  BOOL fLastFetchForward  = FALSE;

  //Obtain total ListItems
  INDEX cItems = GetItemCount();
  ASSERT(cItems >= 0);

  //  Since RowsetViewer displays the abstract "NextFetchPosition" to
  //  the user and we need to make sure we put the correct rows obtained into
  //  the correct indexs, we need to map the OLE DB Fetch Position into an index
  //  based method for our listview.
  //
  //  The OLE DB Cursor (NextFetchPosition) is always "in-between" rows
  //  Meaning its either before or after the row, (not actually on the row).
  //  For example: If the NFP is before row 2, and cRows=1, then row 2 will be
  //  retrieved, but if it was after then row 3 is retrieved.  Likewise if
  //  NFP is before row and cRows=-1, then row 1 is retrived, but if it was
  //  after then row 2 is retrieved.  Doing a Forward fetch (cRows++) makes
  //  the NFP after that row, and a Backward fetch (cRows--) makes the
  //  NFP appear before.

  //  +---------------+---------------+---------------------------|-----------------------------------+
  //  | LastFetch   | cRows   | StartIndex        | EndIndex            |
  //  +---------------+---------------+---------------------------+-----------------------------------+
  //  |#1 Forward   | Positive  | CurIndex + Offset + 1 | StartIndex + cRowsObtained - 1  |
  //  |#2 Forward   | Negative  | CurIndex + Offset   | StartIndex - cRowsObtained + 1  |
  //  |#3 Backward  | Positive  | CurIndex + Offset   | StartIndex + cRowsObtained - 1  |
  //  |#4 Backward  | Negative  | CurIndex + Offset - 1 | StartIndex - cRowsObtained + 1  |
  //  +---------------+---------------+---------------------------+-----------------------------------+

  //Calculate the StartIndex (using the Table Above)
  if(fAdjustFetchPosition)
  {
    //#1, #2, #3, #4 (Common Case) is just CurIndex + Offset
    lStartIndex = m_lCurPos + lOffset;
    fLastFetchForward = m_fLastFetchForward;

    //#1
    if(fLastFetchForward && cRows > 0)
      lStartIndex += 1;
    //#4
    if(!fLastFetchForward && cRows < 0)
      lStartIndex -= 1;
  }

  //Determine Ending Index
  DBROWOFFSET lEndIndex = lStartIndex;
  if(cRowsObtained)
  {
    if(cRows > 0)
    {
      //#1, #3
      lEndIndex = lStartIndex + cRowsObtained - 1;
      fLastFetchForward = TRUE;
    }
    else
    {
      //#2, #4
      lEndIndex = lStartIndex - cRowsObtained + 1;
      fLastFetchForward = FALSE;
    }

    //Remove Previous Fetch Icon
    if(fAdjustFetchPosition)
      SetItemImage((INDEX)m_lCurPos, 0, IMAGE_NORMAL);

    //Remove Previous Selection Bars
    for(INDEX iIndex=0; iIndex<cItems; iIndex++)
      SetItemState(iIndex, 0, ~LVIS_SELECTED, LVIS_SELECTED);
  }

  //Loop over rows obtained, displaying/updating in the ListView
  for(DBCOUNTITEM iRow=0; iRow<cRowsObtained; iRow++)
  {
    ASSERT(rghRows);

    //Calulate which direction to start with
    HROW hRow = rghRows[iRow];
    INDEX iIndex = (INDEX)(cRows > 0 ? lStartIndex + iRow : lStartIndex - iRow);

    //We may need extra row padding, if fetched out of sequence...
    while(iIndex >= cItems)
    {
      InsertItem(iIndex, 0, L"", 0, IMAGE_NORMAL);
      cItems++;
    }

    //We may need to insert rows before the beginging if scrolling
    //around the rowset...
    while(iIndex < 0)
    {
      InsertItem(0, 0, L"", 0, IMAGE_NORMAL);
      cItems++;

      //A row is being inserted, meaning this shifts all our
      //current indexes by one...
      lStartIndex++;
      lEndIndex++;
      iIndex++;
      m_lCurPos++;
      }

    //Display GetData in the ListView
    hr = DisplayData(hRow, iIndex);
  }

  //Scroll the new rows into view...
  if(cRowsObtained)
  {
    //Adjust our saved Fetched Position
    if(fAdjustFetchPosition)
    {
      //Display the direction of the cursor
      DisplayFetchPosition(lEndIndex, fLastFetchForward);
    }

    //Make sure the item is visible
    EnsureVisible(lEndIndex);
  }

  return hr;
}

long CDataGrid::GetAddNewMode ( )

Definition at line 21 of file datagrid.cpp.

{
  long result;
  InvokeHelper(0x1, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
  return result;
}

BOOL CDataGrid::GetAllowAddNew ( )

Definition at line 28 of file datagrid.cpp.

{
  BOOL result;
  InvokeHelper(0x2, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
  return result;
}

BOOL CDataGrid::GetAllowArrows ( )

Definition at line 43 of file datagrid.cpp.

{
  BOOL result;
  InvokeHelper(0x3, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
  return result;
}

BOOL CDataGrid::GetAllowDelete ( )

Definition at line 58 of file datagrid.cpp.

{
  BOOL result;
  InvokeHelper(0x4, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
  return result;
}

BOOL CDataGrid::GetAllowRowSizing ( )

Definition at line 73 of file datagrid.cpp.

{
  BOOL result;
  InvokeHelper(0x5, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
  return result;
}

BOOL CDataGrid::GetAllowUpdate ( )

Definition at line 88 of file datagrid.cpp.

{
  BOOL result;
  InvokeHelper(0x6, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
  return result;
}

long CDataGrid::GetAppearance ( )

Definition at line 103 of file datagrid.cpp.

{
  long result;
  InvokeHelper(DISPID_APPEARANCE, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
  return result;
}

long CDataGrid::GetApproxCount ( )

Definition at line 118 of file datagrid.cpp.

{
  long result;
  InvokeHelper(0x8, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
  return result;
}

unsigned long CDataGrid::GetBackColor ( )

Definition at line 125 of file datagrid.cpp.

{
  unsigned long result;
  InvokeHelper(DISPID_BACKCOLOR, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
  return result;
}

VARIANT CDataGrid::GetBookmark ( )

Definition at line 140 of file datagrid.cpp.

{
  VARIANT result;
  InvokeHelper(0x9, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL);
  return result;
}

VARIANT CDataGrid::GetBookmark ( long RowNum )

Definition at line 756 of file datagrid.cpp.

{
  VARIANT result;
  static BYTE parms[] =
    VTS_I4;
  InvokeHelper(0x6a, DISPATCH_METHOD, VT_VARIANT, (void*)&result, parms,
    RowNum);
  return result;
}

long CDataGrid::GetBorderStyle ( )

Definition at line 155 of file datagrid.cpp.

{
  long result;
  InvokeHelper(DISPID_BORDERSTYLE, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
  return result;
}

CString CDataGrid::GetCaption ( )

Definition at line 170 of file datagrid.cpp.

{
  CString result;
  InvokeHelper(DISPID_CAPTION, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
  return result;
}

CLSID const& CDataGrid::GetClsid ( ) [inline]

Definition at line 20 of file datagrid.h.

  {
    static CLSID const clsid
      = { 0xcde57a43, 0x8b86, 0x11d0, { 0xb3, 0xc6, 0x0, 0xa0, 0xc9, 0xa, 0xea, 0x82 } };
    return clsid;
  }

short CDataGrid::GetCol ( )

Definition at line 185 of file datagrid.cpp.

{
  short result;
  InvokeHelper(0xa, DISPATCH_PROPERTYGET, VT_I2, (void*)&result, NULL);
  return result;
}

BOOL CDataGrid::GetColumnHeaders ( )

Definition at line 200 of file datagrid.cpp.

{
  BOOL result;
  InvokeHelper(0xb, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
  return result;
}

LPDISPATCH CDataGrid::GetColumns ( )

Definition at line 749 of file datagrid.cpp.

{
  LPDISPATCH result;
  InvokeHelper(0x69, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL);
  return result;
}

BOOL CDataGrid::GetCurrentCellModified ( )

Definition at line 215 of file datagrid.cpp.

{
  BOOL result;
  InvokeHelper(0xc, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
  return result;
}

BOOL CDataGrid::GetCurrentCellVisible ( )

Definition at line 230 of file datagrid.cpp.

{
  BOOL result;
  InvokeHelper(0xd, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
  return result;
}

BOOL CDataGrid::GetDataChanged ( )

Definition at line 245 of file datagrid.cpp.

{
  BOOL result;
  InvokeHelper(0xe, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
  return result;
}

LPDISPATCH CDataGrid::GetDataFormats ( )

Definition at line 715 of file datagrid.cpp.

{
  LPDISPATCH result;
  InvokeHelper(0x2c, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL);
  return result;
}

CString CDataGrid::GetDataMember ( )

Definition at line 275 of file datagrid.cpp.

{
  CString result;
  InvokeHelper(0x2b, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
  return result;
}

LPUNKNOWN CDataGrid::GetDataSource ( )

Definition at line 260 of file datagrid.cpp.

{
  LPUNKNOWN result;
  InvokeHelper(0x2a, DISPATCH_PROPERTYGET, VT_UNKNOWN, (void*)&result, NULL);
  return result;
}

float CDataGrid::GetDefColWidth ( )

Definition at line 290 of file datagrid.cpp.

{
  float result;
  InvokeHelper(0x10, DISPATCH_PROPERTYGET, VT_R4, (void*)&result, NULL);
  return result;
}

BOOL CDataGrid::GetEditActive ( )

Definition at line 305 of file datagrid.cpp.

{
  BOOL result;
  InvokeHelper(0x11, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
  return result;
}

BOOL CDataGrid::GetEnabled ( )

Definition at line 320 of file datagrid.cpp.

{
  BOOL result;
  InvokeHelper(DISPID_ENABLED, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
  return result;
}

CString CDataGrid::GetErrorText ( )

Definition at line 335 of file datagrid.cpp.

{
  CString result;
  InvokeHelper(0x12, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
  return result;
}

VARIANT CDataGrid::GetFirstRow ( )

Definition at line 372 of file datagrid.cpp.

{
  VARIANT result;
  InvokeHelper(0x13, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL);
  return result;
}

LPDISPATCH CDataGrid::GetFont ( )

Reimplemented from CWndLite.

Definition at line 342 of file datagrid.cpp.

{
  LPDISPATCH result;
  InvokeHelper(DISPID_FONT, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL);
  return result;
}

unsigned long CDataGrid::GetForeColor ( )

Definition at line 357 of file datagrid.cpp.

{
  unsigned long result;
  InvokeHelper(DISPID_FORECOLOR, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
  return result;
}

LPDISPATCH CDataGrid::GetHeadFont ( )

Definition at line 387 of file datagrid.cpp.

{
  LPDISPATCH result;
  InvokeHelper(0x14, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL);
  return result;
}

float CDataGrid::GetHeadLines ( )

Definition at line 402 of file datagrid.cpp.

{
  float result;
  InvokeHelper(0x15, DISPATCH_PROPERTYGET, VT_R4, (void*)&result, NULL);
  return result;
}

long CDataGrid::GetHWnd ( )

Definition at line 417 of file datagrid.cpp.

{
  long result;
  InvokeHelper(DISPID_HWND, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
  return result;
}

long CDataGrid::GetHWndEditor ( )

Definition at line 424 of file datagrid.cpp.

{
  long result;
  InvokeHelper(0x16, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
  return result;
}

short CDataGrid::GetLeftCol ( )

Definition at line 431 of file datagrid.cpp.

{
  short result;
  InvokeHelper(0x17, DISPATCH_PROPERTYGET, VT_I2, (void*)&result, NULL);
  return result;
}

long CDataGrid::GetMarqueeStyle ( )

Definition at line 446 of file datagrid.cpp.

{
  long result;
  InvokeHelper(0x19, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
  return result;
}

HRESULT CDataGrid::GetNextRows | ( | DBROWOFFSET | lOffset,
 |  | DBROWCOUNT | cRows,
 |  | BOOL | fRetry = FALSE |
 | ) |  |  | [virtual]

Definition at line 10820 of file cmdichild.cpp.

{
  HRESULT hr    = S_OK;
  HRESULT hrGNR = S_OK;
  CDataAccess* pCDataAccess = m_pCMDIChild->m_pCDataAccess;
  CRowset*  pCRowset    = SOURCE_GETOBJECT(pCDataAccess, CRowset);
  CWaitCursor waitCursor;

  DBCOUNTITEM   cRowsObtained = 0;
  HROW      rghRows[MAX_OPENROWS];
  HROW*     phRows = rghRows;

  //Only use dynamic memory allocation if more rows than our static array
  if((cRows > MAX_OPENROWS) || (cRows < -MAX_OPENROWS))
    phRows = NULL;

  if(pCRowset)
  {
    //Retry is dependednt upon ability to release previously held rows...
    fRetry = fRetry && (GetOptions()->m_dwRowsetOpts & ROWSET_ALWAYSRELEASEROWS);

    while(TRUE)
    {
      //Release previously fetched rows, (if user requested)
      TESTC(hr = ReleaseHeldRows());

      //IRowset::GetNextRows
      TESTC(hr = hrGNR = pCRowset->GetNextRows(lOffset, cRows, &cRowsObtained, &phRows));

      //Now Display the rows...
      TESTC(hr = DisplayRows(lOffset, cRows, cRowsObtained, phRows, TRUE/*fAdjustFetchPosition*/));

      //Some providers may have limitations on the number of rows that can be returned in
      //one call, but the consumer may actually just wish to see all the rows without having
      //to "manually" scroll down one row at a time.  The consumer indicates they wish this
      //behavior by having "ReleaseRowsAlways" on, so we will do whatever possible to obtain
      //all the requested rows - assuming the calling context is "retry-able" - ie: fRetry
      if(fRetry && cRowsObtained)
      {
        //If we are not at the end of the rowset, and not all rows were retrieved
        //then retry.  Provider probably returned DB_S_ROWLIMITEXCEEDED
        if(hrGNR!=DB_S_ENDOFROWSET && cRowsObtained < (DBCOUNTITEM)ABS(cRows))
        {
          cRows -= cRowsObtained;
          continue;
        }
      }

      //Were done...
      break;
    }
  }
  else
  {
    ASSERT(cRows <= MAX_OPENROWS);
    cRowsObtained = ABS(cRows);

    //Now Display the rows...
    TESTC(hr = DisplayRows(lOffset, cRows, cRowsObtained, phRows, TRUE/*fAdjustFetchPosition*/));
  }

CLEANUP:
  //Delete the rows if provider allocated
  if(phRows != rghRows)
    SAFE_FREE(phRows);
  return hr;
}

COptionsSheet * CDataGrid::GetOptions ( ) [virtual]

Definition at line 10162 of file cmdichild.cpp.

{
  return m_pCMDIChild->GetOptions();
}

BOOL CDataGrid::GetRecordSelectors ( )

Definition at line 461 of file datagrid.cpp.

{
  BOOL result;
  InvokeHelper(0x1a, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
  return result;
}

BOOL CDataGrid::GetRightToLeft ( )

Definition at line 476 of file datagrid.cpp.

{
  BOOL result;
  InvokeHelper(0xfffffd9d, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
  return result;
}

short CDataGrid::GetRow ( )

Definition at line 491 of file datagrid.cpp.

{
  short result;
  InvokeHelper(0x1b, DISPATCH_PROPERTYGET, VT_I2, (void*)&result, NULL);
  return result;
}

long CDataGrid::GetRowDividerStyle ( )

Definition at line 506 of file datagrid.cpp.

{
  long result;
  InvokeHelper(0x1c, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
  return result;
}

float CDataGrid::GetRowHeight ( )

Definition at line 521 of file datagrid.cpp.

{
  float result;
  InvokeHelper(0x1d, DISPATCH_PROPERTYGET, VT_R4, (void*)&result, NULL);
  return result;
}

long CDataGrid::GetScrollBars ( )

Definition at line 536 of file datagrid.cpp.

{
  long result;
  InvokeHelper(0xfffffde9, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
  return result;
}

LPDISPATCH CDataGrid::GetSelBookmarks ( )

Definition at line 819 of file datagrid.cpp.

{
  LPDISPATCH result;
  InvokeHelper(0x71, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL);
  return result;
}

INDEX CDataGrid::GetSelectedRow | ( | HROW * | phRow = NULL,
 |  | BOOL | fValidate = TRUE |
 | ) |  |  | [virtual]

Definition at line 10893 of file cmdichild.cpp.

{
  //Find the Selected Item in the ListView
  INDEX iSelRow = GetNextItem(-1, LVNI_SELECTED);
  if(iSelRow == LVM_ERR)
  {
    if(fValidate)
    {
      wMessageBox(GetFocus(), MB_TASKMODAL | MB_ICONHAND | MB_OK | MB_DEFBUTTON1,
        wsz_ERROR, L"Must first select a row...");
    }

    return iSelRow;
  }

  //Otherwise we have a valid row...
  if(phRow)
    *phRow = GetItemParam(iSelRow);

  return iSelRow;
}

short CDataGrid::GetSelEndCol ( )

Definition at line 551 of file datagrid.cpp.

{
  short result;
  InvokeHelper(0x1f, DISPATCH_PROPERTYGET, VT_I2, (void*)&result, NULL);
  return result;
}

long CDataGrid::GetSelLength ( )

Definition at line 566 of file datagrid.cpp.

{
  long result;
  InvokeHelper(0xfffffddc, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
  return result;
}

long CDataGrid::GetSelStart ( )

Definition at line 581 of file datagrid.cpp.

{
  long result;
  InvokeHelper(0xfffffddd, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
  return result;
}

short CDataGrid::GetSelStartCol ( )

Definition at line 596 of file datagrid.cpp.

{
  short result;
  InvokeHelper(0x22, DISPATCH_PROPERTYGET, VT_I2, (void*)&result, NULL);
  return result;
}

CString CDataGrid::GetSelText ( )

Definition at line 611 of file datagrid.cpp.

{
  CString result;
  InvokeHelper(0xfffffdde, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
  return result;
}

short CDataGrid::GetSplit ( )

Definition at line 626 of file datagrid.cpp.

{
  short result;
  InvokeHelper(0x24, DISPATCH_PROPERTYGET, VT_I2, (void*)&result, NULL);
  return result;
}

LPDISPATCH CDataGrid::GetSplits ( )

Definition at line 836 of file datagrid.cpp.

{
  LPDISPATCH result;
  InvokeHelper(0x73, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL);
  return result;
}

BOOL CDataGrid::GetTabAcrossSplits ( )

Definition at line 641 of file datagrid.cpp.

{
  BOOL result;
  InvokeHelper(0x25, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
  return result;
}

long CDataGrid::GetTabAction ( )

Definition at line 656 of file datagrid.cpp.

{
  long result;
  InvokeHelper(0x26, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
  return result;
}

CString CDataGrid::GetText ( )

Definition at line 671 of file datagrid.cpp.

{
  CString result;
  InvokeHelper(0x0, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
  return result;
}

short CDataGrid::GetVisibleCols ( )

Definition at line 686 of file datagrid.cpp.

{
  short result;
  InvokeHelper(0x27, DISPATCH_PROPERTYGET, VT_I2, (void*)&result, NULL);
  return result;
}

short CDataGrid::GetVisibleRows ( )

Definition at line 693 of file datagrid.cpp.

{
  short result;
  InvokeHelper(0x28, DISPATCH_PROPERTYGET, VT_I2, (void*)&result, NULL);
  return result;
}

BOOL CDataGrid::GetWrapCellPointer ( )

Definition at line 700 of file datagrid.cpp.

{
  BOOL result;
  InvokeHelper(0x29, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
  return result;
}

void CDataGrid::HoldFields ( )

Definition at line 766 of file datagrid.cpp.

{
  InvokeHelper(0x6b, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
}

BOOL CDataGrid::OnColumnClick | ( | INT | idCtrl,
 |  | NMLISTVIEW * | pNMListView |
 | ) |  |  | [virtual]

Reimplemented from CListViewLite.

Definition at line 10247 of file cmdichild.cpp.

{
  //Can't edit "Row-Handle" Column
  if(pNMListView->iSubItem == 0)
    return TRUE;

  CWaitCursor waitCursor;

  //Save the SelectedCol so the new dialog box knows which Column were concerned with...
  m_iSelCol = pNMListView->iSubItem-1;
  CRowset* pCRowset = (CRowset*)m_pCMDIChild->GetObject(eCRowset);

  //See if the selected column is a chapter column...
  if(pCRowset)
  {
    if((DBCOUNTITEM)m_iSelCol < pCRowset->m_Bindings.GetCount())
    {
      const DBBINDING* pBinding = &pCRowset->m_Bindings[m_iSelCol];
      const DBCOLUMNINFO* pColInfo = pCRowset->m_ColumnInfo.GetOrdinal(pBinding->iOrdinal);
      if(pColInfo->dwFlags & DBCOLUMNFLAGS_ISCHAPTER)
      {
        //Obtain the Child rowset..
        m_pCMDIChild->GetChapteredChild(m_iSelCol, pBinding);
        return TRUE;
      }
    }
  }

  //Otherwise we will assume the user wants to "edit" the column...
  if(GetItemCount())
  {
    CRow* pCRow     = (CRow*)m_pCMDIChild->GetObject(eCRow);
    CDataset* pCDataset = (CDataset*)m_pCMDIChild->GetObject(eCDataset);
    CRowset* pCRowset = (CRowset*)m_pCMDIChild->GetObject(eCRowset);

    //Determine the Object Type...
    if(pCRow)
      m_pCMDIChild->DisplayDialog(IDD_ROWCHANGE, m_hWnd, CMDIChild::ColumnChangeProc, pCRow, IDM_IROW_SETCOLUMNS);
    else if(pCDataset)
      m_pCMDIChild->DisplayDialog(IDD_ROWCHANGE, m_hWnd, CMDIChild::ColumnChangeProc, pCDataset, IDM_DATASET_GETCELLDATA);
    else if(pCRowset)
      m_pCMDIChild->DisplayDialog(IDD_ROWCHANGE, m_hWnd, CMDIChild::ColumnChangeProc, pCRowset, IDM_SETDATA);
  }

  return TRUE;
}

BOOL CDataGrid::OnContextMenu | ( | HWND | hWnd,
 |  | REFPOINTS | pts |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 10224 of file cmdichild.cpp.

{
  CDataAccess* pCDataAccess = m_pCMDIChild->m_pCDataAccess;

  if(pCDataAccess)
  {
    DisplayContextMenu(
            m_hWnd,
            pCDataAccess->GetObjectMenu(),
            pts,
            m_pCMDIChild->m_pCMainWindow->m_hWnd
            );
    return TRUE;
  }

  return FALSE;
}

BOOL CDataGrid::OnItemActivate | ( | INT | idCtrl,
 |  | NMLISTVIEW * | pNMListView |
 | ) |  |  | [virtual]

Reimplemented from CListViewLite.

Definition at line 10299 of file cmdichild.cpp.

{
  CDataAccess* pCDataAccess = m_pCMDIChild->m_pCDataAccess;
  CRow* pCRow     = SOURCE_GETOBJECT(pCDataAccess, CRow);
  CDataset* pCDataset = SOURCE_GETOBJECT(pCDataAccess, CDataset);
  INDEX iSelCol   = pNMListView->iSubItem-1;

  //If this is a row object, then bring up the SetColumns dialog...
  if(pCRow)
  {
    //IRowChange::SetColumns
    m_pCMDIChild->ChangeSelectedRow(pCRow, IDM_IROW_SETCOLUMNS);
  }
  else if(pCDataset)
  {
    //IMDDataset::GetCellData
    m_pCMDIChild->ChangeSelectedRow(pCDataset, IDM_DATASET_GETCELLDATA);
  }
  else
  {
    CRowset* pCRowset =  SOURCE_GETOBJECT(pCDataAccess, CRowset);
    if(pCRowset)
    {
      //If the parent object is an enumerator, then Double Clicking on the row
      //means you wish to "drill" into that row of the enumerator and call ParseDisplayName...
      if(pCRowset->m_pCParent && pCRowset->m_pCParent->GetObjectType() == eCEnumerator)
      {
        //If enumertor rowset, double-clicking on a row
        //brings up the ParseName object in another window
        CWaitCursor waitCursor;
        m_pCMDIChild->CreateEnumChild();
        return TRUE;
      }

      //See if the selected column is a chapter column...
      if((DBCOUNTITEM)iSelCol < pCRowset->m_Bindings.GetCount())
      {
        const DBBINDING* pBinding = &pCRowset->m_Bindings[iSelCol];
        const DBCOLUMNINFO* pColInfo = pCRowset->m_ColumnInfo.GetOrdinal(pBinding->iOrdinal);
        if(pColInfo->dwFlags & DBCOLUMNFLAGS_ISCHAPTER)
        {
          //Obtain the Child rowset..
          m_pCMDIChild->GetChapteredChild(iSelCol, pBinding);
          return TRUE;
        }
      }

      //Otherwise we just have a "normal" rowset...
      HROW hRow;
      if(GetSelectedRow(&hRow, FALSE) != LVM_ERR)
      {
        CWaitCursor waitCursor;
        IUnknown* pIUnknown = NULL;

        //So either we are drilling into a row object from the rowset, or
        //were are trying to edit the actual data of the row handle
        if(SUCCEEDED(pCRowset->GetRowFromHROW(NULL, hRow, IID_IRow, &pIUnknown)))
        {
          //Create in new window
          CBase* pCObject = m_pCMDIChild->m_pCMainWindow->HandleObjectType(pCRowset, pIUnknown, IID_IRow, eCRow, 0, NULL, CREATE_NEWWINDOW | CREATE_NODISPLAY);
          if(pCObject)
          {
            //Fill in which row handle this row was created from...
            //Just for display purposes...
            CRow* pCRow = SOURCE_GETOBJECT(pCObject, CRow);
            if(pCRow)
              pCRow->m_hSourceRow = hRow;

            pCObject->DisplayObject();
          }
        }
        else
        {
          //Otherwise were just trying to update or view detailed info...
          m_pCMDIChild->ChangeSelectedRow(pCRowset, IDM_SETDATA);
        }

        SAFE_RELEASE(pIUnknown);
      }
    }
  }

  return TRUE;
}

BOOL CDataGrid::OnKeyDown | ( | WPARAM | nVirtKey,
 |  | LPARAM | lKeyData |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 10389 of file cmdichild.cpp.

{
  switch(nVirtKey)
  {
    case VK_DELETE:
    {
      PostMessage(m_pCMDIChild->m_hWnd, WM_COMMAND, GET_WM_COMMAND_MPS(IDM_DELETEROWS, 0, 0));
      return TRUE;
    }

    case VK_INSERT:
    {
      PostMessage(m_pCMDIChild->m_hWnd, WM_COMMAND, GET_WM_COMMAND_MPS(IDM_INSERTROW, 0, 0));
      return TRUE;
    }

    case VK_UP:
      ScrollGrid(-1);
      return TRUE;

    case VK_DOWN:
      ScrollGrid(1);
      return TRUE;

    case VK_PRIOR:
      ScrollGrid(-m_lMaxRows);
      return TRUE;

    case VK_NEXT:
      ScrollGrid(m_lMaxRows);
      return TRUE;

    case VK_TAB:
    {
      MSG msg;
      m_pCMDIChild->m_pCQueryBox->SetFocus();
      PeekMessage(&msg, NULL, 0, 0, PM_REMOVE);
      return TRUE;
    }
  };

  return FALSE;
}

BOOL CDataGrid::OnRButtonDown | ( | WPARAM | fwKeys,
 |  | REFPOINTS | pts |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 10198 of file cmdichild.cpp.

{
  //NOTE: The right mouse button doesn't automatically activate the MDI window...
  CDataAccess* pCDataAccess = m_pCMDIChild->m_pCDataAccess;

  //xPos, yPos are Relative to the Client Area...
  if(pCDataAccess)
  {
    DisplayContextMenu(
            m_hWnd,
            pCDataAccess->GetObjectMenu(),
            pts,
            m_pCMDIChild->m_pCMainWindow->m_hWnd,
            TRUE
            );
    return TRUE;
  }

  return FALSE;
}

BOOL CDataGrid::OnSize | ( | WPARAM | nType,
 |  | REFPOINTS | pts |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 10172 of file cmdichild.cpp.

{
  switch(nType)
  {
    case SIZE_RESTORED:
    case SIZE_MAXIMIZED:
    {
      if(pts.x && pts.y)
      {
        //Obtain the total number of available items (subtract for ScrollBar)
        m_lMaxRows = GetCountPerPage()-1;
        m_lMaxRows = max(m_lMaxRows, 0);  //At least 0
      }

      return FALSE;
    }
  };

  return FALSE;
}

BOOL CDataGrid::OnVScroll | ( | int | nScrollCode,
 |  | int | nPos,
 |  | HWND | hWnd |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 10438 of file cmdichild.cpp.

{
  switch(nScrollCode)
  {
    case SB_LINEUP:
      ScrollGrid(-1);
      break;

    case SB_LINEDOWN:
      ScrollGrid(1);
      break;

    case SB_PAGEUP:
      ScrollGrid(-m_lMaxRows);
      break;

    case SB_PAGEDOWN:
      ScrollGrid(m_lMaxRows);
      break;
  };

  return FALSE;
}

void CDataGrid::ReBind ( )

Definition at line 771 of file datagrid.cpp.

{
  InvokeHelper(0x6c, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
}

void CDataGrid::Refresh ( )

Definition at line 776 of file datagrid.cpp.

{
  InvokeHelper(DISPID_REFRESH, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
}

HRESULT CDataGrid::RefreshData ( ) [virtual]

Definition at line 10500 of file cmdichild.cpp.

{
  CWaitCursor waitCursor;
  HRESULT hr = S_OK;
  CDataAccess* pCDataAccess = m_pCMDIChild->m_pCDataAccess;
  CRow* pCRow         = SOURCE_GETOBJECT(pCDataAccess, CRow);
  CRowset* pCRowset     = SOURCE_GETOBJECT(pCDataAccess, CRowset);
  DWORD dwRowsetOpts      = GetOptions()->m_dwRowsetOpts;

  //Clear ListView object
  ClearAll();

  //Display the Column Headers
  //TODO: Would be nice to optimize this to not require a complete dump of all
  //columns and redisplay, need to split out between create accessor and refresh...
  TESTC(hr = DisplayColumnInfo());

  //Row Object?
  if(pCRow)
  {
    //Insert an empty row into the ListView
    InsertItem(0, 0, L"", 0, IMAGE_NORMAL);

    //Display the row data
    TESTC(hr = DisplayData(pCRow->m_hSourceRow, 0, DBPROP_IRow));
  }
  else
  {
    //Determine the number of rows the user wants (initially)
    //Always obtain more rows than what the grid allows so we can get the scroll bar
    //visable.  This way they can use the scroll bar up/dn to populate more rows
    DBROWCOUNT cRowsToFetch = m_lMaxRows+3;
    if(GetOptions()->m_dwRowsetOpts & ROWSET_ROWSTOFETCH)
      cRowsToFetch = GetOptions()->m_cRowsToFetch;

    if(cRowsToFetch)
      TESTC(hr = GetNextRows(0, cRowsToFetch, TRUE/*fRetry*/));
  }

CLEANUP:
  m_pCMDIChild->UpdateControls();
  return hr;
}

HRESULT CDataGrid::ReleaseHeldRows ( ) [virtual]

Definition at line 10921 of file cmdichild.cpp.

{
  //Release previously fetched rows, (if user requested)
  if(GetOptions()->m_dwRowsetOpts & ROWSET_ALWAYSRELEASEROWS)
  {
    return ReleaseRows(LV_ALLITEMS, TRUE/*fOnlyValidRows*/);
  }

  return S_OK;
}

HRESULT CDataGrid::ReleaseRows | ( | INDEX | iIndex,
 |  | BOOL | fOnlyValidRows |
 | ) |  |  | [virtual]

Definition at line 10937 of file cmdichild.cpp.

{
  HRESULT hr = S_OK;
  CRowset*  pCRowset = (CRowset*)m_pCMDIChild->GetObject(eCRowset);

  INDEX i,cRows = 0;
  INDEX* rgItems = NULL;
  HROW* rghRows = NULL;
  ULONG* rgRefCounts = NULL;

  //Release all rows
  if(iIndex == LV_ALLITEMS)
  {
    //Find all Rows
    LV_GetAllItems(m_hWnd, &cRows, &rgItems, (LPARAM**)&rghRows);
  }
  //Release all selected rows
  else if(iIndex == LV_ALLSELITEMS)
  {
    //Find all Selected Rows
    LV_GetSelItems(m_hWnd, &cRows, &rgItems, (LPARAM**)&rghRows);
  }
  //Release 1 Row
  else
  {
    //First need to obtain the LPARAM (hRow) to Release it...
    //TODO: Shouldn't dynamic allocation here!
    cRows = 1;
    SAFE_ALLOC(rgItems, INDEX, cRows);
    SAFE_ALLOC(rghRows, HROW, cRows);
    rgItems[0] = iIndex;
    rghRows[0] = GetItemParam(iIndex);
  }

  //Release only valid rows
  if(fOnlyValidRows)
  {
    //Loop over all rows...
    ULONG iLastValid = 0;
    for(i=0; i<cRows; i++)
    {
      //Compact out invalid row handles...
      if(rghRows[i] == NULL)
        continue;

      //Inplace shift...
      rghRows[iLastValid] = rghRows[i];
      rgItems[iLastValid] = rgItems[i];
      iLastValid++;
    }
    cRows = iLastValid;
  }

  //Now ReleaseRows in 1 pass
  if(pCRowset && pCRowset->GetObjectType() != eCDataset)
  {
    if(cRows || !fOnlyValidRows)
    {
      SAFE_ALLOC(rgRefCounts, ULONG, cRows);
      TESTC(hr = pCRowset->ReleaseRows(cRows, rghRows, rgRefCounts));
    }
  }

CLEANUP:
  //If any rows have a refcount of 0, we should NULL the row handle
  //so we can detect the error before GetData is called on a release row
  for(i=0; i<cRows; i++)
  {
    if(rgRefCounts[i] == 0)
    {
      //Update the row handle, and the display
      SetItemText(rgItems[i], 0, L"");
      SetItemParam(rgItems[i], 0, DB_NULL_HROW);
    }
  }

  SAFE_FREE(rgItems);
  SAFE_FREE(rghRows);
  SAFE_FREE(rgRefCounts);
  return hr;
}

HRESULT CDataGrid::RestartPosition ( ) [virtual]

Definition at line 10786 of file cmdichild.cpp.

{
  CWaitCursor waitCursor;
  HRESULT hr = S_OK;
  CRowset*  pCRowset = (CRowset*)m_pCMDIChild->GetObject(eCRowset);

  if(pCRowset && pCRowset->m_pIRowset)
  {
    //Release previously fetched rows, (if user requested)
    TESTC(hr = ReleaseHeldRows());

    //RestartPosition...
    TESTC(hr = pCRowset->RestartPosition());
  }

  //Need to remove the "NextFetchPositon" icon from the "old" row
  SetItemImage((INDEX)m_lCurPos, 0, IMAGE_NORMAL);

  m_fLastFetchForward = FALSE;
  m_lCurPos = 0;

  //Need to show the "NextFetchPositon" icon
  SetItemImage((INDEX)m_lCurPos, 0, IMAGE_ARROW_UP);
  EnsureVisible((INDEX)m_lCurPos);

CLEANUP:
  return hr;
}

VARIANT CDataGrid::RowBookmark ( short RowNum )

Definition at line 781 of file datagrid.cpp.

{
  VARIANT result;
  static BYTE parms[] =
    VTS_I2;
  InvokeHelper(0x6d, DISPATCH_METHOD, VT_VARIANT, (void*)&result, parms,
    RowNum);
  return result;
}

short CDataGrid::RowContaining ( float Y )

Definition at line 791 of file datagrid.cpp.

{
  short result;
  static BYTE parms[] =
    VTS_R4;
  InvokeHelper(0x6e, DISPATCH_METHOD, VT_I2, (void*)&result, parms,
    Y);
  return result;
}

float CDataGrid::RowTop ( short RowNum )

Definition at line 801 of file datagrid.cpp.

{
  float result;
  static BYTE parms[] =
    VTS_I2;
  InvokeHelper(0x6f, DISPATCH_METHOD, VT_R4, (void*)&result, parms,
    RowNum);
  return result;
}

void CDataGrid::Scroll | ( | long | Cols,
 |  | long | Rows
 | ) |  |

Definition at line 811 of file datagrid.cpp.

{
  static BYTE parms[] =
    VTS_I4 VTS_I4;
  InvokeHelper(0xdc, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
     Cols, Rows);
}

HRESULT CDataGrid::ScrollGrid ( DBROWCOUNT cItems ) [virtual]

Definition at line 11072 of file cmdichild.cpp.

{
  return GetNextRows(0, cItems, TRUE/*fRetry*/);
}

void CDataGrid::SetAllowAddNew ( BOOL bNewValue )

Definition at line 35 of file datagrid.cpp.

{
  static BYTE parms[] =
    VTS_BOOL;
  InvokeHelper(0x2, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     bNewValue);
}

void CDataGrid::SetAllowArrows ( BOOL bNewValue )

Definition at line 50 of file datagrid.cpp.

{
  static BYTE parms[] =
    VTS_BOOL;
  InvokeHelper(0x3, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     bNewValue);
}

void CDataGrid::SetAllowDelete ( BOOL bNewValue )

Definition at line 65 of file datagrid.cpp.

{
  static BYTE parms[] =
    VTS_BOOL;
  InvokeHelper(0x4, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     bNewValue);
}

void CDataGrid::SetAllowRowSizing ( BOOL bNewValue )

Definition at line 80 of file datagrid.cpp.

{
  static BYTE parms[] =
    VTS_BOOL;
  InvokeHelper(0x5, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     bNewValue);
}

void CDataGrid::SetAllowUpdate ( BOOL bNewValue )

Definition at line 95 of file datagrid.cpp.

{
  static BYTE parms[] =
    VTS_BOOL;
  InvokeHelper(0x6, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     bNewValue);
}

void CDataGrid::SetAppearance ( long nNewValue )

Definition at line 110 of file datagrid.cpp.

{
  static BYTE parms[] =
    VTS_I4;
  InvokeHelper(DISPID_APPEARANCE, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     nNewValue);
}

void CDataGrid::SetBackColor ( unsigned long newValue )

Definition at line 132 of file datagrid.cpp.

{
  static BYTE parms[] =
    VTS_I4;
  InvokeHelper(DISPID_BACKCOLOR, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     newValue);
}

void CDataGrid::SetBookmark ( const VARIANT & newValue )

Definition at line 147 of file datagrid.cpp.

{
  static BYTE parms[] =
    VTS_VARIANT;
  InvokeHelper(0x9, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     &newValue);
}

void CDataGrid::SetBorderStyle ( long nNewValue )

Definition at line 162 of file datagrid.cpp.

{
  static BYTE parms[] =
    VTS_I4;
  InvokeHelper(DISPID_BORDERSTYLE, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     nNewValue);
}

void CDataGrid::SetCaption ( LPCTSTR lpszNewValue )

Definition at line 177 of file datagrid.cpp.

{
  static BYTE parms[] =
    VTS_BSTR;
  InvokeHelper(DISPID_CAPTION, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     lpszNewValue);
}

void CDataGrid::SetCol ( short nNewValue )

Definition at line 192 of file datagrid.cpp.

{
  static BYTE parms[] =
    VTS_I2;
  InvokeHelper(0xa, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     nNewValue);
}

void CDataGrid::SetColumnHeaders ( BOOL bNewValue )

Definition at line 207 of file datagrid.cpp.

{
  static BYTE parms[] =
    VTS_BOOL;
  InvokeHelper(0xb, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     bNewValue);
}

void CDataGrid::SetCurrentCellModified ( BOOL bNewValue )

Definition at line 222 of file datagrid.cpp.

{
  static BYTE parms[] =
    VTS_BOOL;
  InvokeHelper(0xc, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     bNewValue);
}

void CDataGrid::SetCurrentCellVisible ( BOOL bNewValue )

Definition at line 237 of file datagrid.cpp.

{
  static BYTE parms[] =
    VTS_BOOL;
  InvokeHelper(0xd, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     bNewValue);
}

void CDataGrid::SetDataChanged ( BOOL bNewValue )

Definition at line 252 of file datagrid.cpp.

{
  static BYTE parms[] =
    VTS_BOOL;
  InvokeHelper(0xe, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     bNewValue);
}

void CDataGrid::SetDataMember ( LPCTSTR lpszNewValue )

Definition at line 282 of file datagrid.cpp.

{
  static BYTE parms[] =
    VTS_BSTR;
  InvokeHelper(0x2b, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     lpszNewValue);
}

void CDataGrid::SetDefColWidth ( float newValue )

Definition at line 297 of file datagrid.cpp.

{
  static BYTE parms[] =
    VTS_R4;
  InvokeHelper(0x10, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     newValue);
}

void CDataGrid::SetEditActive ( BOOL bNewValue )

Definition at line 312 of file datagrid.cpp.

{
  static BYTE parms[] =
    VTS_BOOL;
  InvokeHelper(0x11, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     bNewValue);
}

void CDataGrid::SetEnabled ( BOOL bNewValue )

Definition at line 327 of file datagrid.cpp.

{
  static BYTE parms[] =
    VTS_BOOL;
  InvokeHelper(DISPID_ENABLED, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     bNewValue);
}

void CDataGrid::SetFirstRow ( const VARIANT & newValue )

Definition at line 379 of file datagrid.cpp.

{
  static BYTE parms[] =
    VTS_VARIANT;
  InvokeHelper(0x13, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     &newValue);
}

void CDataGrid::SetForeColor ( unsigned long newValue )

Definition at line 364 of file datagrid.cpp.

{
  static BYTE parms[] =
    VTS_I4;
  InvokeHelper(DISPID_FORECOLOR, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     newValue);
}

void CDataGrid::SetHeadLines ( float newValue )

Definition at line 409 of file datagrid.cpp.

{
  static BYTE parms[] =
    VTS_R4;
  InvokeHelper(0x15, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     newValue);
}

void CDataGrid::SetLeftCol ( short nNewValue )

Definition at line 438 of file datagrid.cpp.

{
  static BYTE parms[] =
    VTS_I2;
  InvokeHelper(0x17, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     nNewValue);
}

void CDataGrid::SetMarqueeStyle ( long nNewValue )

Definition at line 453 of file datagrid.cpp.

{
  static BYTE parms[] =
    VTS_I4;
  InvokeHelper(0x19, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     nNewValue);
}

void CDataGrid::SetRecordSelectors ( BOOL bNewValue )

Definition at line 468 of file datagrid.cpp.

{
  static BYTE parms[] =
    VTS_BOOL;
  InvokeHelper(0x1a, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     bNewValue);
}

void CDataGrid::SetRefDataSource ( LPUNKNOWN newValue )

Definition at line 267 of file datagrid.cpp.

{
  static BYTE parms[] =
    VTS_UNKNOWN;
  InvokeHelper(0x2a, DISPATCH_PROPERTYPUTREF, VT_EMPTY, NULL, parms,
     newValue);
}

void CDataGrid::SetRefFont ( LPDISPATCH newValue )

Definition at line 349 of file datagrid.cpp.

{
  static BYTE parms[] =
    VTS_DISPATCH;
  InvokeHelper(DISPID_FONT, DISPATCH_PROPERTYPUTREF, VT_EMPTY, NULL, parms,
     newValue);
}

void CDataGrid::SetRefHeadFont ( LPDISPATCH newValue )

Definition at line 394 of file datagrid.cpp.

{
  static BYTE parms[] =
    VTS_DISPATCH;
  InvokeHelper(0x14, DISPATCH_PROPERTYPUTREF, VT_EMPTY, NULL, parms,
     newValue);
}

void CDataGrid::SetRightToLeft ( BOOL bNewValue )

Definition at line 483 of file datagrid.cpp.

{
  static BYTE parms[] =
    VTS_BOOL;
  InvokeHelper(0xfffffd9d, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     bNewValue);
}

void CDataGrid::SetRow ( short nNewValue )

Definition at line 498 of file datagrid.cpp.

{
  static BYTE parms[] =
    VTS_I2;
  InvokeHelper(0x1b, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     nNewValue);
}

void CDataGrid::SetRowDividerStyle ( long nNewValue )

Definition at line 513 of file datagrid.cpp.

{
  static BYTE parms[] =
    VTS_I4;
  InvokeHelper(0x1c, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     nNewValue);
}

void CDataGrid::SetRowHeight ( float newValue )

Definition at line 528 of file datagrid.cpp.

{
  static BYTE parms[] =
    VTS_R4;
  InvokeHelper(0x1d, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     newValue);
}

void CDataGrid::SetScrollBars ( long nNewValue )

Definition at line 543 of file datagrid.cpp.

{
  static BYTE parms[] =
    VTS_I4;
  InvokeHelper(0xfffffde9, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     nNewValue);
}

void CDataGrid::SetSelEndCol ( short nNewValue )

Definition at line 558 of file datagrid.cpp.

{
  static BYTE parms[] =
    VTS_I2;
  InvokeHelper(0x1f, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     nNewValue);
}

void CDataGrid::SetSelLength ( long nNewValue )

Definition at line 573 of file datagrid.cpp.

{
  static BYTE parms[] =
    VTS_I4;
  InvokeHelper(0xfffffddc, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     nNewValue);
}

void CDataGrid::SetSelStart ( long nNewValue )

Definition at line 588 of file datagrid.cpp.

{
  static BYTE parms[] =
    VTS_I4;
  InvokeHelper(0xfffffddd, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     nNewValue);
}

void CDataGrid::SetSelStartCol ( short nNewValue )

Definition at line 603 of file datagrid.cpp.

{
  static BYTE parms[] =
    VTS_I2;
  InvokeHelper(0x22, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     nNewValue);
}

void CDataGrid::SetSelText ( LPCTSTR lpszNewValue )

Definition at line 618 of file datagrid.cpp.

{
  static BYTE parms[] =
    VTS_BSTR;
  InvokeHelper(0xfffffdde, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     lpszNewValue);
}

void CDataGrid::SetSplit ( short nNewValue )

Definition at line 633 of file datagrid.cpp.

{
  static BYTE parms[] =
    VTS_I2;
  InvokeHelper(0x24, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     nNewValue);
}

void CDataGrid::SetTabAcrossSplits ( BOOL bNewValue )

Definition at line 648 of file datagrid.cpp.

{
  static BYTE parms[] =
    VTS_BOOL;
  InvokeHelper(0x25, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     bNewValue);
}

void CDataGrid::SetTabAction ( long nNewValue )

Definition at line 663 of file datagrid.cpp.

{
  static BYTE parms[] =
    VTS_I4;
  InvokeHelper(0x26, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     nNewValue);
}

void CDataGrid::SetText ( LPCTSTR lpszNewValue )

Definition at line 678 of file datagrid.cpp.

{
  static BYTE parms[] =
    VTS_BSTR;
  InvokeHelper(0x0, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     lpszNewValue);
}

void CDataGrid::SetWrapCellPointer ( BOOL bNewValue )

Definition at line 707 of file datagrid.cpp.

{
  static BYTE parms[] =
    VTS_BOOL;
  InvokeHelper(0x29, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
     bNewValue);
}

short CDataGrid::SplitContaining | ( | float | X,
 |  | float | Y
 | ) |  |

Definition at line 826 of file datagrid.cpp.

{
  short result;
  static BYTE parms[] =
    VTS_R4 VTS_R4;
  InvokeHelper(0x72, DISPATCH_METHOD, VT_I2, (void*)&result, parms,
    X, Y);
  return result;
}

Member Data Documentation

BOOL CDataGrid::m_fLastFetchForward

Definition at line 110 of file cmdichild.h.

INDEX CDataGrid::m_iSelCol

Definition at line 107 of file cmdichild.h.

INDEX CDataGrid::m_iSelRow

Definition at line 106 of file cmdichild.h.

DBROWOFFSET CDataGrid::m_lCurPos

Definition at line 111 of file cmdichild.h.

INDEX CDataGrid::m_lMaxRows

Definition at line 105 of file cmdichild.h.

CMDIChild* CDataGrid::m_pCMDIChild

Definition at line 104 of file cmdichild.h.

The documentation for this class was generated from the following files:
  • Dataaccess/ADO/ADOVCGEN/datagrid.h
  • Dataaccess/oledb/rowsetviewer/cmdichild.h
  • Dataaccess/ADO/ADOVCGEN/datagrid.cpp
  • Dataaccess/oledb/rowsetviewer/cmdichild.cpp
Generated on Wed Nov 13 2024 16:56:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDataLinks Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CDataLinks Class Reference

#include "cdatalinks.h"

Inherits CBase.

List of all members.

Public Member Functions

CDataLinks (CMainWindow *pCMainWindow)
virtual | ~CDataLinks ()
virtual HRESULT | AutoQI (DWORD dwCreateOpts)
virtual HRESULT | AutoRelease ()
virtual HRESULT | Create (CBase *pCSource, DWORD dwCSLCTX=CLSCTX_INPROC_SERVER, WCHAR *pwszRemoteServer=NULL)
virtual REFIID | GetDefaultInterface ()
virtual IUnknown ** | GetInterfaceAddress (REFIID riid)
virtual LONG | GetObjectImage ()
virtual UINT | GetObjectMenu ()
virtual WCHAR * | GetObjectName ()
virtual void | OnDefOperation ()
virtual HRESULT | PromptDataSource (CAggregate *pCAggregate, HWND hWndParent, DBPROMPTOPTIONS dwPromptOptions, ULONG cTypeFilters, DBSOURCETYPE *rgTypeFilters, WCHAR *pwszProvFilter, REFIID riid, IUnknown **ppDataSource)
virtual HRESULT | PromptFileName (HWND hWndParent, DBPROMPTOPTIONS dwPromptOptions, WCHAR *pwszDirectory, WCHAR *pwszFileName, WCHAR **ppwszSelectedFile)

Public Attributes

IDBPromptInitialize * | m_pIDBPromptInitialize

Detailed Description

Definition at line 78 of file cdatalinks.h.

Constructor & Destructor Documentation

CDataLinks::CDataLinks ( CMainWindow * pCMainWindow )

Definition at line 310 of file cdatalinks.cpp.

  : CBase(eCDataLinks, pCMainWindow, NULL)
{
  //OLE DB Interfaces
  m_pIDBPromptInitialize    = NULL;   //DataLink interface

  //Data
}

CDataLinks::~CDataLinks ( ) [virtual]

Definition at line 323 of file cdatalinks.cpp.

{
  ReleaseObject(0);
}

Member Function Documentation

HRESULT CDataLinks::AutoQI ( DWORD dwCreateOpts ) [virtual]

Implements CBase.

Definition at line 360 of file cdatalinks.cpp.

{
  //Delegate First so we have base interfaces
  CBase::AutoQI(dwCreateOpts);

  //[MANDATORY]
  if(dwCreateOpts & CREATE_QI_MANDATORY)
  {
    OBTAIN_INTERFACE(IDBPromptInitialize);
  }

  //[OPTIONAL]
  if(dwCreateOpts & CREATE_QI_OPTIONAL)
  {
  }

  return S_OK;
}

HRESULT CDataLinks::AutoRelease ( ) [virtual]

Implements CBase.

Definition at line 346 of file cdatalinks.cpp.

{
  //OLE DB Interfaces
  RELEASE_INTERFACE(IDBPromptInitialize);

  //Delegate
  return CBase::AutoRelease();
}

HRESULT CDataLinks::Create | ( | CBase * | pCSource,
 |  | DWORD | dwCSLCTX = CLSCTX_INPROC_SERVER,
 |  | WCHAR * | pwszRemoteServer = NULL |
 | ) |  |  | [virtual]

Definition at line 384 of file cdatalinks.cpp.

{
  HRESULT   hr = S_OK;
  CComPtr<IUnknown> spUnknown;

  //CLSID_MSDAINITIALIZE
  XTESTC(hr = m_pCMainWindow->m_pCRootEnumerator->CreateInstance(NULL, CLSID_DataLinks, dwCSLCTX, IID_IUnknown, &spUnknown, pwszRemoteServer));

  //Delegate
  TESTC(hr = CBase::CreateObject(pCSource, IID_IUnknown, spUnknown));

CLEANUP:
  return hr;
}

virtual REFIID CDataLinks::GetDefaultInterface ( ) [inline, virtual]

Implements CBase.

Definition at line 94 of file cdatalinks.h.

{ return IID_IDBPromptInitialize; }

IUnknown ** CDataLinks::GetInterfaceAddress ( REFIID riid ) [virtual]

Implements CBase.

Definition at line 333 of file cdatalinks.cpp.

{
  HANDLE_GETINTERFACE(IDBPromptInitialize);

  //Otherwise delegate
  return CBase::GetInterfaceAddress(riid);
}

virtual LONG CDataLinks::GetObjectImage ( ) [inline, virtual]

Implements CBase.

Definition at line 93 of file cdatalinks.h.

{ return IMAGE_DATALINKS;     }

virtual UINT CDataLinks::GetObjectMenu ( ) [inline, virtual]

Implements CBase.

Definition at line 92 of file cdatalinks.h.

{ return IDM_DATALINKSMENU;     }

virtual WCHAR* CDataLinks::GetObjectName ( ) [inline, virtual]

Implements CBase.

Definition at line 91 of file cdatalinks.h.

{ return L"Data Links";       }

void CDataLinks::OnDefOperation ( ) [virtual]

Reimplemented from CBase.

Definition at line 404 of file cdatalinks.cpp.

{
  //PromptDataSource dialog
  CComPtr<IDBInitialize> spDBInitialize;

  //Just display the PromptDataSource dialog directly (common case)
  if(SUCCEEDED(PromptDataSource(NULL, m_pCMainWindow->m_hWnd, DBPROMPTOPTIONS_PROPERTYSHEET, 0, NULL, NULL, IID_IDBInitialize, (IUnknown**)&spDBInitialize)))
  {
    //Handle the returned object...
    //NOTE: Can pontentially return other object types: (ie: CREATE_DETERMINE_TYPE)
    m_pCMainWindow->HandleObjectType(this, spDBInitialize, IID_IDBInitialize, eCDataSource, 0, NULL, CREATE_NEWWINDOW | CREATE_DETERMINE_TYPE | GetOptions()->m_dwCreateOpts);
  }
}

HRESULT CDataLinks::PromptDataSource | ( | CAggregate * | pCAggregate,
 |  | HWND | hWndParent,
 |  | DBPROMPTOPTIONS | dwPromptOptions,
 |  | ULONG | cTypeFilters,
 |  | DBSOURCETYPE * | rgTypeFilters,
 |  | WCHAR * | pwszProvFilter,
 |  | REFIID | riid,
 |  | IUnknown ** | ppDataSource |
 | ) |  |  | [virtual]

Definition at line 423 of file cdatalinks.cpp.

{
  HRESULT hr      = E_FAIL;

  //Defferred Creation
  if(!m_pIUnknown)
    TESTC(hr = Create(NULL));

  if(m_pIDBPromptInitialize)
  {
    //IDBPromptInitialize::PromptDataSource
    //NOTE: Expect S_OK or DB_E_CANCELED, since canceling the dialog always returns DB_E_CANCELED
    XTEST_(hr = m_pIDBPromptInitialize->PromptDataSource(pCAggregate, hWndParent, dwPromptOptions, cTypeFilters, rgTypeFilters, pwszProvFilter, riid, ppDataSource),DB_E_CANCELED);
    TESTC(TRACE_METHOD(hr, L"IDBPromptInitialize::PromptDataSource(0x%p, 0x%p, 0x%08x, %d, 0x%p, \"%s\", %s, &0x%p)", pCAggregate, hWndParent, dwPromptOptions, cTypeFilters, rgTypeFilters, pwszProvFilter, GetInterfaceName(riid), ppDataSource ? *ppDataSource : NULL));

    //Handle Aggregation
    if(pCAggregate)
      TESTC(hr = pCAggregate->HandleAggregation(riid, ppDataSource));
  }

CLEANUP:
  return hr;
}

HRESULT CDataLinks::PromptFileName | ( | HWND | hWndParent,
 |  | DBPROMPTOPTIONS | dwPromptOptions,
 |  | WCHAR * | pwszDirectory,
 |  | WCHAR * | pwszFileName,
 |  | WCHAR ** | ppwszSelectedFile |
 | ) |  |  | [virtual]

Definition at line 452 of file cdatalinks.cpp.

{
  HRESULT hr      = E_FAIL;

  //Defferred Creation
  if(!m_pIUnknown)
    TESTC(hr = Create(NULL));

  if(m_pIDBPromptInitialize)
  {
    //IDBPromptInitalize::PromptFileName
    //NOTE: Expect S_OK or DB_E_CANCELED, since canceling the dialog always returns DB_E_CANCELED
    XTEST_(hr = m_pIDBPromptInitialize->PromptFileName
          (
          hWndParent,             // hWndParent
          dwPromptOptions,          // dwPromptOptions
                pwszDirectory,            // pwszInitialDirectory
                pwszFileName,           // pwszInitialFile
                ppwszSelectedFile         // pwszSelectedFile
          ), DB_E_CANCELED);
    TESTC(TRACE_METHOD(hr, L"IDBPromptInitialize::PromptFileName(0x%p, 0x%08x, \"%s\", \"%s\", &\"%s\")", hWndParent, dwPromptOptions, pwszDirectory, pwszFileName, ppwszSelectedFile ? *ppwszSelectedFile : NULL));
  }

CLEANUP:
  return hr;
}

Member Data Documentation

IDBPromptInitialize* CDataLinks::m_pIDBPromptInitialize

Definition at line 106 of file cdatalinks.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdatalinks.h
  • Dataaccess/oledb/rowsetviewer/cdatalinks.cpp
Generated on Wed Nov 13 2024 16:56:02 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDataNotify Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CDataNotify Class Reference

#include "cData.h"

Inherits RefCount, CNotify, RefCount, and CNotify.

List of all members.

Public Member Functions

CDataNotify ()
CDataNotify ()
~CDataNotify ()
~CDataNotify ()
ULONG STDMETHODCALLTYPE | AddRef (void)
ULONG STDMETHODCALLTYPE | AddRef (void)
HRESULT STDMETHODCALLTYPE | Connect (IUnknown *pUnk)
HRESULT STDMETHODCALLTYPE | Connect (IUnknown *pUnk)
HRESULT STDMETHODCALLTYPE | DataReceived (INmMember *pMember, ULONG uSize, LPBYTE pb, ULONG dwFlags)
HRESULT STDMETHODCALLTYPE | DataReceived (INmMember *pMember, ULONG uSize, LPBYTE pb, ULONG dwFlags)
HRESULT STDMETHODCALLTYPE | DataSent (INmMember *pMember, ULONG uSize, LPBYTE pb)
HRESULT STDMETHODCALLTYPE | DataSent (INmMember *pMember, ULONG uSize, LPBYTE pb)
HRESULT STDMETHODCALLTYPE | Disconnect (void)
HRESULT STDMETHODCALLTYPE | Disconnect (void)
HRESULT STDMETHODCALLTYPE | MemberChanged (NM_MEMBER_NOTIFY uNotify, INmMember *pMember)
HRESULT STDMETHODCALLTYPE | MemberChanged (NM_MEMBER_NOTIFY uNotify, INmMember *pMember)
HRESULT STDMETHODCALLTYPE | NmUI (CONFN uNotify)
HRESULT STDMETHODCALLTYPE | NmUI (CONFN uNotify)
HRESULT STDMETHODCALLTYPE | QueryInterface (REFIID riid, PVOID *ppvObj)
HRESULT STDMETHODCALLTYPE | QueryInterface (REFIID riid, PVOID *ppvObj)
ULONG STDMETHODCALLTYPE | Release (void)
ULONG STDMETHODCALLTYPE | Release (void)

Detailed Description

Definition at line 22 of file cData.h.

Constructor & Destructor Documentation

CDataNotify::CDataNotify ( )

Definition at line 191 of file cData.Cpp.

                         : RefCount(), CNotify()
{
}

CDataNotify::~CDataNotify ( )

Definition at line 202 of file cData.Cpp.

{
}

CDataNotify::CDataNotify ( )
CDataNotify::~CDataNotify ( )

Member Function Documentation

ULONG STDMETHODCALLTYPE CDataNotify::AddRef ( void )

Definition at line 213 of file cData.Cpp.

{
  return RefCount::AddRef();
}

ULONG STDMETHODCALLTYPE CDataNotify::AddRef ( void )
HRESULT STDMETHODCALLTYPE CDataNotify::Connect ( IUnknown * pUnk )

Definition at line 262 of file cData.Cpp.

{
  return CNotify::Connect(pUnk, IID_INmChannelDataNotify, (IUnknown *)this);
}

HRESULT STDMETHODCALLTYPE CDataNotify::Connect ( IUnknown * pUnk )
HRESULT STDMETHODCALLTYPE CDataNotify::DataReceived | ( | INmMember * | pMember,
 |  | ULONG | uSize,
 |  | LPBYTE | pb,
 |  | ULONG | dwFlags
 | ) |  |

Definition at line 319 of file cData.Cpp.

{
  LPTSTR psz = NULL;

  // Warning : Doesn't handle broken packets
  // TODO: Check dwFlags & NM_DF_SEGMENT_END

#ifdef NM2_CHAT_PROTOCOL
  ASSERT(uSize > CB_NM2_HDR);
  if(uSize <= CB_NMUI_HDR)
  {
    return E_FAIL;
  }

  psz = (LPTSTR) (pb + *(LPDWORD) pb);  // skip past header
#else
  psz = (LPTSTR) pb;
#endif /* NM2_CHAT_PROTOCOL */

  DisplayMsg(psz, pMember);

  return S_OK;
}

HRESULT STDMETHODCALLTYPE CDataNotify::DataReceived | ( | INmMember * | pMember,
 |  | ULONG | uSize,
 |  | LPBYTE | pb,
 |  | ULONG | dwFlags
 | ) |  |
HRESULT STDMETHODCALLTYPE CDataNotify::DataSent | ( | INmMember * | pMember,
 |  | ULONG | uSize,
 |  | LPBYTE | pb
 | ) |  |

Definition at line 298 of file cData.Cpp.

{
  LPTSTR psz = NULL;

#ifdef NM2_CHAT_PROTOCOL
  ASSERT(uSize > CB_NM2_HDR);
  if(uSize <= CB_NMUI_HDR)
  {
    return E_FAIL;
  }

  psz = (LPTSTR) (pb + *(LPDWORD) pb);  // skip past header
#else
  psz = (LPTSTR) pb;
#endif /* NM2_CHAT_PROTOCOL */

  DisplayMsg(psz, g_pMemberLocal);

  return S_OK;
}

HRESULT STDMETHODCALLTYPE CDataNotify::DataSent | ( | INmMember * | pMember,
 |  | ULONG | uSize,
 |  | LPBYTE | pb
 | ) |  |
HRESULT STDMETHODCALLTYPE CDataNotify::Disconnect ( void )

Reimplemented from CNotify.

HRESULT STDMETHODCALLTYPE CDataNotify::Disconnect ( void )

Reimplemented from CNotify.

Definition at line 267 of file cData.Cpp.

{
  return CNotify::Disconnect();
}

HRESULT STDMETHODCALLTYPE CDataNotify::MemberChanged | ( | NM_MEMBER_NOTIFY | uNotify,
 |  | INmMember * | pMember
 | ) |  |
HRESULT STDMETHODCALLTYPE CDataNotify::MemberChanged | ( | NM_MEMBER_NOTIFY | uNotify,
 |  | INmMember * | pMember
 | ) |  |

Definition at line 284 of file cData.Cpp.

{
  if (NM_MEMBER_ADDED == uNotify)
  {
    AddMember(pMember);
  }
  else if (NM_MEMBER_REMOVED == uNotify)
  {
    RemoveMember(pMember);
  }

  return S_OK;
}

HRESULT STDMETHODCALLTYPE CDataNotify::NmUI ( CONFN uNotify )

Definition at line 279 of file cData.Cpp.

{
  return S_OK;
}

HRESULT STDMETHODCALLTYPE CDataNotify::NmUI ( CONFN uNotify )
HRESULT STDMETHODCALLTYPE CDataNotify::QueryInterface | ( | REFIID | riid,
 |  | PVOID * | ppvObj
 | ) |  |

Definition at line 224 of file cData.Cpp.

{
  if(NULL == ppvObject)
  {
    return E_POINTER;
  }

  HRESULT hr = S_OK;

  if (riid == IID_IUnknown)
  {
    *ppvObject = (IUnknown *)this;
  }
  else if (riid == IID_INmChannelDataNotify)
  {
    *ppvObject = (INmChannelDataNotify *)this;
  }
  else
  {
    hr = E_NOINTERFACE;
    *ppvObject = NULL;
  }

  if(SUCCEEDED(hr))
  {
    AddRef();
  }

  return hr;
}

HRESULT STDMETHODCALLTYPE CDataNotify::QueryInterface | ( | REFIID | riid,
 |  | PVOID * | ppvObj
 | ) |  |
ULONG STDMETHODCALLTYPE CDataNotify::Release ( void )

Definition at line 219 of file cData.Cpp.

{
  return RefCount::Release();
}

ULONG STDMETHODCALLTYPE CDataNotify::Release ( void )
The documentation for this class was generated from the following files:
  • Web/NetMeeting/NMChat/cData.h
  • Web/NetMeeting/NMUI/cData.h
  • Web/NetMeeting/NMChat/cData.Cpp
  • Web/NetMeeting/NMUI/cData.Cpp
Generated on Wed Nov 13 2024 16:56:02 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDataObject Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Static Public Attributes | Private Types | Private Member Functions | Private Attributes

CDataObject Class Reference

#include "DataObj.h"

List of all members.

Public Member Functions

CDataObject (COleDocument *)
CDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES context)
CDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES context)
CDataObject ()
CDataObject ()
CDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES context)
CDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES context)
CDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES context)
CDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES context)
CDataObject ()
CDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES context)
CDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES context)
CDataObject ()
CDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES context)
CDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES context)
CDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES context)
CDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES context)
CDataObject ()
CDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES context)
CDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES context)
CDataObject ()
CDataObject ()
CDataObject (CShellFolder *, LPCITEMIDLIST *, UINT)
CDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES context)
CDataObject ()
CDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES context)
CDataObject (MMC_COOKIE cookie, DATA_OBJECT_TYPES context)
CDataObject ()
~CDataObject ()
~CDataObject ()
~CDataObject ()
~CDataObject ()
~CDataObject ()
~CDataObject ()
~CDataObject ()
~CDataObject ()
~CDataObject ()
~CDataObject ()
~CDataObject ()
~CDataObject ()
~CDataObject ()
~CDataObject ()
~CDataObject (void)
~CDataObject ()
~CDataObject ()
~CDataObject ()
~CDataObject ()
~CDataObject ()
~CDataObject ()
~CDataObject ()
~CDataObject ()
~CDataObject ()
~CDataObject ()
~CDataObject ()
~CDataObject ()
~CDataObject ()
void | AddMultiSelectCookie (int nIndexCookies, LPARAM lParam)
HRESULT | AddMultiSelectCookie (LONG_PTR nCookie)
HRESULT | AddMultiSelectGuid (GUID *pGuid)
STDMETHODIMP | Clone (LPENUMFORMATETC *)
STDMETHODIMP | DAdvise (LPFORMATETC lpFormatetc, DWORD advf, LPADVISESINK pAdvSink, LPDWORD pdwConnection)
STDMETHODIMP | DAdvise (LPFORMATETC lpFormatetc, DWORD advf, LPADVISESINK pAdvSink, LPDWORD pdwConnection)
STDMETHODIMP | DAdvise (LPFORMATETC lpFormatetc, DWORD advf, LPADVISESINK pAdvSink, LPDWORD pdwConnection)
STDMETHODIMP | DAdvise (LPFORMATETC lpFormatetc, DWORD advf, LPADVISESINK pAdvSink, LPDWORD pdwConnection)
STDMETHODIMP | DAdvise (LPFORMATETC lpFormatetc, DWORD advf, LPADVISESINK pAdvSink, LPDWORD pdwConnection)
STDMETHODIMP | DAdvise (LPFORMATETC lpFormatetc, DWORD advf, LPADVISESINK pAdvSink, LPDWORD pdwConnection)
STDMETHODIMP | DAdvise (LPFORMATETC lpFormatetc, DWORD advf, LPADVISESINK pAdvSink, LPDWORD pdwConnection)
STDMETHODIMP | DAdvise (LPFORMATETC lpFormatetc, DWORD advf, LPADVISESINK pAdvSink, LPDWORD pdwConnection)
STDMETHODIMP | DAdvise (LPFORMATETC lpFormatetc, DWORD advf, LPADVISESINK pAdvSink, LPDWORD pdwConnection)
STDMETHODIMP | DAdvise (LPFORMATETC lpFormatetc, DWORD advf, LPADVISESINK pAdvSink, LPDWORD pdwConnection)
STDMETHODIMP | DAdvise (LPFORMATETC lpFormatetc, DWORD advf, LPADVISESINK pAdvSink, LPDWORD pdwConnection)
STDMETHODIMP | DAdvise (LPFORMATETC lpFormatetc, DWORD advf, LPADVISESINK pAdvSink, LPDWORD pdwConnection)
STDMETHODIMP | DAdvise (LPFORMATETC lpFormatetc, DWORD advf, LPADVISESINK pAdvSink, LPDWORD pdwConnection)
STDMETHODIMP | DAdvise (LPFORMATETC lpFormatetc, DWORD advf, LPADVISESINK pAdvSink, LPDWORD pdwConnection)
STDMETHODIMP | DAdvise (LPFORMATETC lpFormatetc, DWORD advf, LPADVISESINK pAdvSink, LPDWORD pdwConnection)
STDMETHODIMP | DAdvise (LPFORMATETC lpFormatetc, DWORD advf, LPADVISESINK pAdvSink, LPDWORD pdwConnection)
STDMETHODIMP | DAdvise (LPFORMATETC lpFormatetc, DWORD advf, LPADVISESINK pAdvSink, LPDWORD pdwConnection)
STDMETHODIMP | DAdvise (LPFORMATETC lpFormatetc, DWORD advf, LPADVISESINK pAdvSink, LPDWORD pdwConnection)
STDMETHODIMP | DAdvise (LPFORMATETC lpFormatetc, DWORD advf, LPADVISESINK pAdvSink, LPDWORD pdwConnection)
STDMETHODIMP | DAdvise (LPFORMATETC lpFormatetc, DWORD advf, LPADVISESINK pAdvSink, LPDWORD pdwConnection)
STDMETHOD() | DAdvise (FORMATETC *, DWORD, LPADVISESINK, LPDWORD)
STDMETHODIMP | DAdvise (LPFORMATETC lpFormatetc, DWORD advf, LPADVISESINK pAdvSink, LPDWORD pdwConnection)
STDMETHODIMP | DAdvise (LPFORMATETC lpFormatetc, DWORD advf, LPADVISESINK pAdvSink, LPDWORD pdwConnection)
STDMETHODIMP | DAdvise (LPFORMATETC, DWORD, IAdviseSink *, LPDWORD)
STDMETHODIMP | DAdvise (LPFORMATETC lpFormatetc, DWORD advf, LPADVISESINK pAdvSink, LPDWORD pdwConnection)
STDMETHODIMP | DAdvise (LPFORMATETC lpFormatetc, DWORD advf, LPADVISESINK pAdvSink, LPDWORD pdwConnection)
STDMETHODIMP | DAdvise (LPFORMATETC lpFormatetc, DWORD advf, LPADVISESINK pAdvSink, LPDWORD pdwConnection)
STDMETHODIMP | DAdvise (LPFORMATETC, DWORD, LPADVISESINK, LPDWORD)
STDMETHODIMP | DUnadvise (DWORD dwConnection)
STDMETHODIMP | DUnadvise (DWORD dwConnection)
STDMETHODIMP | DUnadvise (DWORD dwConnection)
STDMETHODIMP | DUnadvise (DWORD dwConnection)
STDMETHODIMP | DUnadvise (DWORD dwConnection)
STDMETHODIMP | DUnadvise (DWORD dwConnection)
STDMETHODIMP | DUnadvise (DWORD dwConnection)
STDMETHODIMP | DUnadvise (DWORD dwConnection)
STDMETHODIMP | DUnadvise (DWORD dwConnection)
STDMETHODIMP | DUnadvise (DWORD dwConnection)
STDMETHODIMP | DUnadvise (DWORD dwConnection)
STDMETHODIMP | DUnadvise (DWORD dwConnection)
STDMETHODIMP | DUnadvise (DWORD dwConnection)
STDMETHODIMP | DUnadvise (DWORD dwConnection)
STDMETHODIMP | DUnadvise (DWORD dwConnection)
STDMETHODIMP | DUnadvise (DWORD dwConnection)
STDMETHODIMP | DUnadvise (DWORD dwConnection)
STDMETHODIMP | DUnadvise (DWORD dwConnection)
STDMETHODIMP | DUnadvise (DWORD dwConnection)
STDMETHODIMP | DUnadvise (DWORD dwConnection)
STDMETHODIMP | DUnadvise (DWORD dwConnection)
STDMETHODIMP | DUnadvise (DWORD dwConnection)
STDMETHOD() | DUnadvise (DWORD)
STDMETHODIMP | DUnadvise (DWORD dwConnection)
STDMETHODIMP | DUnadvise (DWORD dwConnection)
STDMETHODIMP | DUnadvise (DWORD dwConnection)
STDMETHODIMP | DUnadvise (DWORD dwConnection)
STDMETHODIMP | DUnadvise (DWORD)
STDMETHODIMP | EnumDAdvise (LPENUMSTATDATA *)
STDMETHODIMP | EnumDAdvise (LPENUMSTATDATA *ppEnumAdvise)
STDMETHODIMP | EnumDAdvise (LPENUMSTATDATA *ppEnumAdvise)
STDMETHODIMP | EnumDAdvise (LPENUMSTATDATA *ppEnumAdvise)
STDMETHODIMP | EnumDAdvise (LPENUMSTATDATA *ppEnumAdvise)
STDMETHODIMP | EnumDAdvise (IEnumSTATDATA **ppEnumAdvise)
STDMETHODIMP | EnumDAdvise (LPENUMSTATDATA *ppEnumAdvise)
STDMETHODIMP | EnumDAdvise (LPENUMSTATDATA *ppEnumAdvise)
STDMETHODIMP | EnumDAdvise (LPENUMSTATDATA *ppEnumAdvise)
STDMETHODIMP | EnumDAdvise (LPENUMSTATDATA *ppEnumAdvise)
STDMETHODIMP | EnumDAdvise (LPENUMSTATDATA *ppEnumAdvise)
STDMETHODIMP | EnumDAdvise (LPENUMSTATDATA *ppEnumAdvise)
STDMETHODIMP | EnumDAdvise (LPENUMSTATDATA *ppEnumAdvise)
STDMETHODIMP | EnumDAdvise (LPENUMSTATDATA *ppEnumAdvise)
STDMETHODIMP | EnumDAdvise (LPENUMSTATDATA *ppEnumAdvise)
STDMETHODIMP | EnumDAdvise (LPENUMSTATDATA *ppEnumAdvise)
STDMETHODIMP | EnumDAdvise (LPENUMSTATDATA *ppEnumAdvise)
STDMETHODIMP | EnumDAdvise (LPENUMSTATDATA *ppEnumAdvise)
STDMETHODIMP | EnumDAdvise (LPENUMSTATDATA *ppEnumAdvise)
STDMETHODIMP | EnumDAdvise (LPENUMSTATDATA *ppEnumAdvise)
STDMETHODIMP | EnumDAdvise (LPENUMSTATDATA *ppEnumAdvise)
STDMETHOD() | EnumDAdvise (LPENUMSTATDATA *)
STDMETHODIMP | EnumDAdvise (LPENUMSTATDATA *ppEnumAdvise)
STDMETHODIMP | EnumDAdvise (LPENUMSTATDATA *ppEnumAdvise)
STDMETHODIMP | EnumDAdvise (LPENUMSTATDATA *ppEnumAdvise)
STDMETHODIMP | EnumDAdvise (LPENUMSTATDATA *ppEnumAdvise)
STDMETHODIMP | EnumDAdvise (LPENUMSTATDATA *ppEnumAdvise)
STDMETHODIMP | EnumDAdvise (LPENUMSTATDATA *ppEnumAdvise)
STDMETHODIMP | EnumFormatEtc (DWORD dwDirection, LPENUMFORMATETC *ppEnumFormatEtc)
STDMETHODIMP | EnumFormatEtc (DWORD dwDirection, LPENUMFORMATETC *ppEnumFormatEtc)
STDMETHODIMP | EnumFormatEtc (DWORD dwDirection, LPENUMFORMATETC *ppEnumFormatEtc)
STDMETHODIMP | EnumFormatEtc (DWORD dwDirection, LPENUMFORMATETC *ppEnumFormatEtc)
STDMETHODIMP | EnumFormatEtc (DWORD dwDirection, LPENUMFORMATETC *ppEnumFormatEtc)
STDMETHODIMP | EnumFormatEtc (DWORD, LPENUMFORMATETC *)
STDMETHODIMP | EnumFormatEtc (DWORD dwDirection, LPENUMFORMATETC *ppEnumFormatEtc)
STDMETHODIMP | EnumFormatEtc (DWORD dwDirection, LPENUMFORMATETC *ppEnumFormatEtc)
STDMETHODIMP | EnumFormatEtc (DWORD dwDirection, LPENUMFORMATETC *ppEnumFormatEtc)
STDMETHODIMP | EnumFormatEtc (DWORD dwDirection, LPENUMFORMATETC *ppEnumFormatEtc)
STDMETHODIMP | EnumFormatEtc (DWORD dwDirection, LPENUMFORMATETC *ppEnumFormatEtc)
STDMETHODIMP | EnumFormatEtc (DWORD dwDirection, LPENUMFORMATETC *ppEnumFormatEtc)
STDMETHODIMP | EnumFormatEtc (DWORD dwDirection, LPENUMFORMATETC *ppEnumFormatEtc)
STDMETHODIMP | EnumFormatEtc (DWORD dwDirection, LPENUMFORMATETC *ppEnumFormatEtc)
STDMETHODIMP | EnumFormatEtc (DWORD dwDirection, LPENUMFORMATETC *ppEnumFormatEtc)
STDMETHODIMP | EnumFormatEtc (DWORD dwDirection, LPENUMFORMATETC *ppEnumFormatEtc)
STDMETHODIMP | EnumFormatEtc (DWORD dwDirection, LPENUMFORMATETC *ppEnumFormatEtc)
STDMETHODIMP | EnumFormatEtc (DWORD dwDirection, LPENUMFORMATETC *ppEnumFormatEtc)
STDMETHODIMP | EnumFormatEtc (DWORD dwDirection, LPENUMFORMATETC *ppEnumFormatEtc)
STDMETHODIMP | EnumFormatEtc (DWORD dwDirection, LPENUMFORMATETC *ppEnumFormatEtc)
STDMETHODIMP | EnumFormatEtc (DWORD dwDirection, LPENUMFORMATETC *ppEnumFormatEtc)
STDMETHODIMP | EnumFormatEtc (DWORD dwDirection, LPENUMFORMATETC *ppEnumFormatEtc)
STDMETHODIMP | EnumFormatEtc (DWORD dwDirection, LPENUMFORMATETC *ppEnumFormatEtc)
STDMETHODIMP | EnumFormatEtc (DWORD dwDirection, LPENUMFORMATETC *ppEnumFormatEtc)
STDMETHOD() | EnumFormatEtc (DWORD, LPENUMFORMATETC *)
STDMETHODIMP | EnumFormatEtc (DWORD, IEnumFORMATETC **)
STDMETHODIMP | EnumFormatEtc (DWORD dwDirection, LPENUMFORMATETC *ppEnumFormatEtc)
STDMETHODIMP | EnumFormatEtc (DWORD dwDirection, LPENUMFORMATETC *ppEnumFormatEtc)
CDelegationBase * GetBaseNodeObject ()
CDelegationBase * GetBaseNodeObject ()
CDelegationBase * GetBaseNodeObject ()
CDelegationBase * GetBaseNodeObject ()
CDelegationBase * GetBaseNodeObject ()
CDelegationBase * GetBaseNodeObject ()
CDelegationBase * GetBaseNodeObject ()
CDelegationBase * GetBaseNodeObject ()
CDelegationBase * GetBaseNodeObject ()
CDelegationBase * GetBaseNodeObject ()
CDelegationBase * GetBaseNodeObject ()
CDelegationBase * GetBaseNodeObject ()
CDelegationBase * GetBaseNodeObject ()
CDelegationBase * GetBaseNodeObject ()
CDelegationBase * GetBaseNodeObject ()
CDelegationBase * GetBaseNodeObject ()
CDelegationBase * GetBaseNodeObject ()
STDMETHODIMP | GetCanonicalFormatEtc (LPFORMATETC lpFormatetcIn, LPFORMATETC lpFormatetcOut)
STDMETHODIMP | GetCanonicalFormatEtc (LPFORMATETC lpFormatetcIn, LPFORMATETC lpFormatetcOut)
STDMETHODIMP | GetCanonicalFormatEtc (LPFORMATETC lpFormatetcIn, LPFORMATETC lpFormatetcOut)
STDMETHODIMP | GetCanonicalFormatEtc (LPFORMATETC lpFormatetcIn, LPFORMATETC lpFormatetcOut)
STDMETHODIMP | GetCanonicalFormatEtc (LPFORMATETC lpFormatetcIn, LPFORMATETC lpFormatetcOut)
STDMETHODIMP | GetCanonicalFormatEtc (LPFORMATETC lpFormatetcIn, LPFORMATETC lpFormatetcOut)
STDMETHODIMP | GetCanonicalFormatEtc (LPFORMATETC lpFormatetcIn, LPFORMATETC lpFormatetcOut)
STDMETHODIMP | GetCanonicalFormatEtc (LPFORMATETC lpFormatetcIn, LPFORMATETC lpFormatetcOut)
STDMETHODIMP | GetCanonicalFormatEtc (LPFORMATETC lpFormatetcIn, LPFORMATETC lpFormatetcOut)
STDMETHODIMP | GetCanonicalFormatEtc (LPFORMATETC, LPFORMATETC)
STDMETHODIMP | GetCanonicalFormatEtc (LPFORMATETC lpFormatetcIn, LPFORMATETC lpFormatetcOut)
STDMETHODIMP | GetCanonicalFormatEtc (LPFORMATETC lpFormatetcIn, LPFORMATETC lpFormatetcOut)
STDMETHODIMP | GetCanonicalFormatEtc (LPFORMATETC lpFormatetcIn, LPFORMATETC lpFormatetcOut)
STDMETHODIMP | GetCanonicalFormatEtc (LPFORMATETC lpFormatetcIn, LPFORMATETC lpFormatetcOut)
STDMETHODIMP | GetCanonicalFormatEtc (LPFORMATETC lpFormatetcIn, LPFORMATETC lpFormatetcOut)
STDMETHODIMP | GetCanonicalFormatEtc (LPFORMATETC lpFormatetcIn, LPFORMATETC lpFormatetcOut)
STDMETHODIMP | GetCanonicalFormatEtc (LPFORMATETC, LPFORMATETC)
STDMETHODIMP | GetCanonicalFormatEtc (LPFORMATETC lpFormatetcIn, LPFORMATETC lpFormatetcOut)
STDMETHODIMP | GetCanonicalFormatEtc (LPFORMATETC lpFormatetcIn, LPFORMATETC lpFormatetcOut)
STDMETHODIMP | GetCanonicalFormatEtc (LPFORMATETC lpFormatetcIn, LPFORMATETC lpFormatetcOut)
STDMETHODIMP | GetCanonicalFormatEtc (LPFORMATETC lpFormatetcIn, LPFORMATETC lpFormatetcOut)
STDMETHODIMP | GetCanonicalFormatEtc (LPFORMATETC lpFormatetcIn, LPFORMATETC lpFormatetcOut)
STDMETHODIMP | GetCanonicalFormatEtc (LPFORMATETC lpFormatetcIn, LPFORMATETC lpFormatetcOut)
STDMETHODIMP | GetCanonicalFormatEtc (LPFORMATETC lpFormatetcIn, LPFORMATETC lpFormatetcOut)
STDMETHOD() | GetCanonicalFormatEtc (LPFORMATETC, LPFORMATETC)
STDMETHODIMP | GetCanonicalFormatEtc (LPFORMATETC lpFormatetcIn, LPFORMATETC lpFormatetcOut)
STDMETHODIMP | GetCanonicalFormatEtc (LPFORMATETC lpFormatetcIn, LPFORMATETC lpFormatetcOut)
STDMETHODIMP | GetCanonicalFormatEtc (LPFORMATETC lpFormatetcIn, LPFORMATETC lpFormatetcOut)
ULONG GetContext ()
DATA_OBJECT_TYPES | GetContext ()
ULONG GetContext ()
DATA_OBJECT_TYPES | GetContext ()
DATA_OBJECT_TYPES | GetContext ()
DATA_OBJECT_TYPES | GetContext ()
DATA_OBJECT_TYPES | GetContext ()
ULONG GetContext ()
DATA_OBJECT_TYPES | GetContext ()
ULONG GetContext ()
DATA_OBJECT_TYPES | GetContext ()
DATA_OBJECT_TYPES | GetContext ()
ULONG GetContext ()
DATA_OBJECT_TYPES | GetContext ()
DATA_OBJECT_TYPES | GetContext ()
ULONG GetContext ()
DATA_OBJECT_TYPES | GetContext ()
DATA_OBJECT_TYPES | GetContext ()
DATA_OBJECT_TYPES | GetContext ()
ULONG GetContext ()
DATA_OBJECT_TYPES | GetContext ()
DATA_OBJECT_TYPES | GetContext ()
ULONG GetContext ()
DATA_OBJECT_TYPES | GetContext ()
DATA_OBJECT_TYPES | GetContext ()
ULONG_PTR | GetCookie ()
ULONG GetCookie ()
MMC_COOKIE | GetCookie ()
ULONG GetCookie ()
INT_PTR | GetCookie ()
ULONG GetCookie ()
ULONG_PTR | GetCookie ()
ULONG GetCookie ()
ULONG GetCookie ()
STDMETHODIMP | GetData (LPFORMATETC lpFormatetcIn, LPSTGMEDIUM lpMedium)
STDMETHODIMP | GetData (LPFORMATETC lpFormatetcIn, LPSTGMEDIUM lpMedium)
STDMETHODIMP | GetData (LPFORMATETC lpFormatetcIn, LPSTGMEDIUM lpMedium)
STDMETHODIMP | GetData (LPFORMATETC lpFormatetcIn, LPSTGMEDIUM lpMedium)
STDMETHODIMP | GetData (LPFORMATETC lpFormatetcIn, LPSTGMEDIUM lpMedium)
STDMETHODIMP | GetData (LPFORMATETC lpFormatetcIn, LPSTGMEDIUM lpMedium)
STDMETHODIMP | GetData (LPFORMATETC lpFormatetcIn, LPSTGMEDIUM lpMedium)
STDMETHODIMP | GetData (FORMATETC *pFormatEtc, STGMEDIUM *pStgMedium)
STDMETHODIMP | GetData (LPFORMATETC lpFormatetcIn, LPSTGMEDIUM lpMedium)
STDMETHODIMP | GetData (LPFORMATETC lpFormatetcIn, LPSTGMEDIUM lpMedium)
STDMETHODIMP | GetData (LPFORMATETC lpFormatetcIn, LPSTGMEDIUM lpMedium)
STDMETHODIMP | GetData (LPFORMATETC lpFormatetcIn, LPSTGMEDIUM lpMedium)
STDMETHODIMP | GetData (LPFORMATETC lpFormatetcIn, LPSTGMEDIUM lpMedium)
STDMETHODIMP | GetData (LPFORMATETC, LPSTGMEDIUM)
STDMETHODIMP | GetData (LPFORMATETC lpFormatetcIn, LPSTGMEDIUM lpMedium)
STDMETHODIMP | GetData (LPFORMATETC lpFormatetcIn, LPSTGMEDIUM lpMedium)
STDMETHODIMP | GetData (LPFORMATETC lpFormatetcIn, LPSTGMEDIUM lpMedium)
STDMETHODIMP | GetData (LPFORMATETC lpFormatetcIn, LPSTGMEDIUM lpMedium)
STDMETHODIMP | GetData (LPFORMATETC lpFormatetcIn, LPSTGMEDIUM lpMedium)
STDMETHODIMP | GetData (LPFORMATETC lpFormatetcIn, LPSTGMEDIUM lpMedium)
STDMETHODIMP | GetData (FORMATETC *pFormatEtc, STGMEDIUM *pStgMedium)
STDMETHODIMP | GetData (LPFORMATETC lpFormatetcIn, LPSTGMEDIUM lpMedium)
STDMETHODIMP | GetData (LPFORMATETC, LPSTGMEDIUM)
STDMETHODIMP | GetData (LPFORMATETC lpFormatetcIn, LPSTGMEDIUM lpMedium)
STDMETHODIMP | GetData (LPFORMATETC lpFormatetcIn, LPSTGMEDIUM lpMedium)
STDMETHODIMP | GetData (FORMATETC *pFormatEtc, STGMEDIUM *pStgMedium)
STDMETHOD() | GetData (LPFORMATETC, LPSTGMEDIUM)
STDMETHODIMP | GetData (LPFORMATETC lpFormatetcIn, LPSTGMEDIUM lpMedium)
STDMETHODIMP | GetDataHere (FORMATETC *pformatetc, STGMEDIUM *pmedium)
STDMETHODIMP | GetDataHere (FORMATETC *pformatetc, STGMEDIUM *pmedium)
STDMETHODIMP | GetDataHere (FORMATETC *pformatetc, STGMEDIUM *pmedium)
STDMETHODIMP | GetDataHere (FORMATETC *pformatetc, STGMEDIUM *pmedium)
STDMETHODIMP | GetDataHere (FORMATETC *pformatetc, STGMEDIUM *pmedium)
STDMETHODIMP | GetDataHere (FORMATETC *pformatetc, STGMEDIUM *pmedium)
STDMETHODIMP | GetDataHere (FORMATETC *pformatetc, STGMEDIUM *pmedium)
STDMETHODIMP | GetDataHere (FORMATETC *pformatetc, STGMEDIUM *pmedium)
STDMETHODIMP | GetDataHere (FORMATETC *pformatetc, STGMEDIUM *pmedium)
STDMETHODIMP | GetDataHere (FORMATETC *pformatetc, STGMEDIUM *pmedium)
STDMETHODIMP | GetDataHere (FORMATETC *pformatetc, STGMEDIUM *pmedium)
STDMETHODIMP | GetDataHere (FORMATETC *pformatetc, STGMEDIUM *pmedium)
STDMETHODIMP | GetDataHere (FORMATETC *pFormatEtc, STGMEDIUM *pStgMedium)
STDMETHODIMP | GetDataHere (LPFORMATETC, LPSTGMEDIUM)
STDMETHODIMP | GetDataHere (FORMATETC *pformatetc, STGMEDIUM *pmedium)
STDMETHODIMP | GetDataHere (FORMATETC *pformatetc, STGMEDIUM *pmedium)
STDMETHODIMP | GetDataHere (FORMATETC *pformatetc, STGMEDIUM *pmedium)
STDMETHODIMP | GetDataHere (FORMATETC *pformatetc, STGMEDIUM *pmedium)
STDMETHODIMP | GetDataHere (FORMATETC *pformatetc, STGMEDIUM *pmedium)
STDMETHODIMP | GetDataHere (FORMATETC *pformatetc, STGMEDIUM *pmedium)
STDMETHODIMP | GetDataHere (FORMATETC *pformatetc, STGMEDIUM *pmedium)
STDMETHODIMP | GetDataHere (FORMATETC *pFormatEtc, STGMEDIUM *pStgMedium)
STDMETHODIMP | GetDataHere (FORMATETC *pformatetc, STGMEDIUM *pmedium)
STDMETHODIMP | GetDataHere (LPFORMATETC, LPSTGMEDIUM)
STDMETHOD() | GetDataHere (LPFORMATETC, LPSTGMEDIUM)
STDMETHODIMP | GetDataHere (FORMATETC *pformatetc, STGMEDIUM *pmedium)
STDMETHODIMP | GetDataHere (FORMATETC *pFormatEtc, STGMEDIUM *pStgMedium)
STDMETHODIMP | GetDataHere (FORMATETC *pformatetc, STGMEDIUM *pmedium)
MMC_COOKIE | GetMultiSelectCookie (int n)
STDMETHODIMP | Next (ULONG, LPFORMATETC, ULONG *)
STDMETHODIMP | QueryGetData (LPFORMATETC lpFormatetc)
STDMETHODIMP | QueryGetData (LPFORMATETC lpFormatetc)
STDMETHODIMP | QueryGetData (LPFORMATETC)
STDMETHODIMP | QueryGetData (LPFORMATETC lpFormatetc)
STDMETHODIMP | QueryGetData (LPFORMATETC lpFormatetc)
STDMETHODIMP | QueryGetData (LPFORMATETC lpFormatetc)
STDMETHODIMP | QueryGetData (LPFORMATETC lpFormatetc)
STDMETHODIMP | QueryGetData (LPFORMATETC lpFormatetc)
STDMETHODIMP | QueryGetData (LPFORMATETC lpFormatetc)
STDMETHODIMP | QueryGetData (LPFORMATETC lpFormatetc)
STDMETHODIMP | QueryGetData (LPFORMATETC lpFormatetc)
STDMETHODIMP | QueryGetData (LPFORMATETC lpFormatetc)
STDMETHODIMP | QueryGetData (LPFORMATETC lpFormatetc)
STDMETHODIMP | QueryGetData (LPFORMATETC lpFormatetc)
STDMETHODIMP | QueryGetData (LPFORMATETC lpFormatetc)
STDMETHODIMP | QueryGetData (LPFORMATETC)
STDMETHODIMP | QueryGetData (LPFORMATETC lpFormatetc)
STDMETHODIMP | QueryGetData (LPFORMATETC lpFormatetc)
STDMETHODIMP | QueryGetData (FORMATETC *pFormatEtc)
STDMETHODIMP | QueryGetData (LPFORMATETC lpFormatetc)
STDMETHODIMP | QueryGetData (LPFORMATETC lpFormatetc)
STDMETHOD() | QueryGetData (LPFORMATETC)
STDMETHODIMP | QueryGetData (LPFORMATETC lpFormatetc)
STDMETHODIMP | QueryGetData (LPFORMATETC lpFormatetc)
STDMETHODIMP | QueryGetData (LPFORMATETC lpFormatetc)
STDMETHODIMP | QueryGetData (LPFORMATETC lpFormatetc)
STDMETHODIMP | QueryGetData (LPFORMATETC lpFormatetc)
STDMETHODIMP | QueryGetData (LPFORMATETC lpFormatetc)
STDMETHOD() | QueryInterface (REFIID, LPVOID *)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID, LPVOID *)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID, LPVOID FAR *)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | Reset (void)
HRESULT | RetrieveMultiSelectCookies (STGMEDIUM *pStgMedium)
HRESULT | RetrieveMultiSelectTypes (STGMEDIUM *pStgMedium)
STDMETHODIMP | SetData (LPFORMATETC lpFormatetc, LPSTGMEDIUM lpMedium, BOOL bRelease)
STDMETHODIMP | SetData (LPFORMATETC lpFormatetc, LPSTGMEDIUM lpMedium, BOOL bRelease)
STDMETHODIMP | SetData (LPFORMATETC lpFormatetc, LPSTGMEDIUM lpMedium, BOOL bRelease)
STDMETHOD() | SetData (LPFORMATETC, LPSTGMEDIUM, BOOL)
STDMETHODIMP | SetData (LPFORMATETC lpFormatetc, LPSTGMEDIUM lpMedium, BOOL bRelease)
STDMETHODIMP | SetData (LPFORMATETC lpFormatetc, LPSTGMEDIUM lpMedium, BOOL bRelease)
STDMETHODIMP | SetData (LPFORMATETC lpFormatetc, LPSTGMEDIUM lpMedium, BOOL bRelease)
STDMETHODIMP | SetData (LPFORMATETC lpFormatetc, LPSTGMEDIUM lpMedium, BOOL bRelease)
STDMETHODIMP | SetData (LPFORMATETC lpFormatetc, LPSTGMEDIUM lpMedium, BOOL bRelease)
STDMETHODIMP | SetData (LPFORMATETC lpFormatetc, LPSTGMEDIUM lpMedium, BOOL bRelease)
STDMETHODIMP | SetData (LPFORMATETC lpFormatetc, LPSTGMEDIUM lpMedium, BOOL bRelease)
STDMETHODIMP | SetData (LPFORMATETC lpFormatetc, LPSTGMEDIUM lpMedium, BOOL bRelease)
STDMETHODIMP | SetData (LPFORMATETC lpFormatetc, LPSTGMEDIUM lpMedium, BOOL bRelease)
STDMETHODIMP | SetData (LPFORMATETC lpFormatetc, LPSTGMEDIUM lpMedium, BOOL bRelease)
STDMETHODIMP | SetData (LPFORMATETC lpFormatetc, LPSTGMEDIUM lpMedium, BOOL bRelease)
STDMETHODIMP | SetData (LPFORMATETC lpFormatetc, LPSTGMEDIUM lpMedium, BOOL bRelease)
STDMETHODIMP | SetData (LPFORMATETC lpFormatetc, LPSTGMEDIUM lpMedium, BOOL bRelease)
STDMETHODIMP | SetData (LPFORMATETC lpFormatetc, LPSTGMEDIUM lpMedium, BOOL bRelease)
STDMETHODIMP | SetData (LPFORMATETC lpFormatetc, LPSTGMEDIUM lpMedium, BOOL bRelease)
STDMETHODIMP | SetData (LPFORMATETC lpFormatetc, LPSTGMEDIUM lpMedium, BOOL bRelease)
STDMETHODIMP | SetData (LPFORMATETC lpFormatetc, LPSTGMEDIUM lpMedium, BOOL bRelease)
STDMETHODIMP | SetData (LPFORMATETC lpFormatetc, LPSTGMEDIUM lpMedium, BOOL bRelease)
STDMETHODIMP | SetData (LPFORMATETC lpFormatetc, LPSTGMEDIUM lpMedium, BOOL bRelease)
STDMETHODIMP | SetData (LPFORMATETC, LPSTGMEDIUM, BOOL)
STDMETHODIMP | SetData (LPFORMATETC lpFormatetc, LPSTGMEDIUM lpMedium, BOOL bRelease)
STDMETHODIMP | SetData (LPFORMATETC, LPSTGMEDIUM, BOOL)
STDMETHODIMP | SetData (LPFORMATETC lpFormatetc, LPSTGMEDIUM lpMedium, BOOL bRelease)
STDMETHODIMP | SetData (LPFORMATETC lpFormatetc, LPSTGMEDIUM lpMedium, BOOL bRelease)
VOID | SetPrivateData (ULONG_PTR uCookie, ULONG uContext)
VOID | SetPrivateData (ULONG uCookie, ULONG uContext)
VOID | SetPrivateData (LONG_PTR uCookie, ULONG uContext)
VOID | SetPrivateData (INT_PTR nCookie, ULONG uContext)
VOID | SetPrivateData (ULONG uCookie, ULONG uContext)
VOID | SetPrivateData (ULONG uCookie, ULONG uContext)
VOID | SetPrivateData (ULONG_PTR uCookie, ULONG uContext)
VOID | SetPrivateData (ULONG uCookie, ULONG uContext)
STDMETHODIMP | Skip (ULONG)
STDMETHOD_ (ULONG, AddRef)(void)
STDMETHOD_ (ULONG, Release)(void)
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (DWORD) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (DWORD) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()

Public Attributes

CEnumFormatEtc * m_pEnumFormatEtc

Static Public Attributes

static UINT | s_cfDisplayName = RegisterClipboardFormat(_T_CCF_DISPLAY_NAME)
static UINT | s_cfInternal = RegisterClipboardFormat(_T_CCF_INTERNAL_SNAPIN)
static UINT | s_cfMultiSelect = RegisterClipboardFormat(_T_CCF_OBJECT_TYPES_IN_MULTI_SELECT)
static UINT | s_cfNodeType = RegisterClipboardFormat(_T_CCF_NODETYPE)
static UINT | s_cfSnapinClsid = RegisterClipboardFormat(_T_CCF_SNAPIN_CLASSID)
static UINT | s_cfSZNodeType = RegisterClipboardFormat(_T_CCF_SZNODETYPE)

Private Types

enum | { MAX_COOKIES = 20 }

Private Member Functions

BOOL AllocPidlTable (DWORD)
BOOL | FillPidlTable (LPCITEMIDLIST *, UINT)
VOID | FreePidlTable (VOID)
HRESULT | RetrieveBaseNodePtr (IStream *ipStream)
HRESULT | RetrieveBaseNodePtr (IStream *ipStream)
HRESULT | RetrieveBaseNodePtr (IStream *ipStream)
HRESULT | RetrieveBaseNodePtr (IStream *ipStream)
HRESULT | RetrieveBaseNodePtr (IStream *ipStream)
HRESULT | RetrieveBaseNodePtr (IStream *ipStream)
HRESULT | RetrieveDataObjPtr (IStream *ipStream)
HRESULT | RetrieveDataObjPtr (IStream *ipStream)
HRESULT | RetrieveDataObjPtr (IStream *ipStream)
HRESULT | RetrieveDataObjPtr (IStream *ipStream)
HRESULT | RetrieveDataObjPtr (IStream *ipStream)
HRESULT | RetrieveDataObjPtr (IStream *ipStream)
HRESULT | RetrieveDisplayString (IStream *ipStream)
HRESULT | RetrieveDisplayString (IStream *ipStream)
HRESULT | RetrieveDisplayString (IStream *ipStream)
HRESULT | RetrieveDisplayString (IStream *ipStream)
HRESULT | RetrieveDisplayString (IStream *ipStream)
HRESULT | RetrieveDisplayString (IStream *ipStream)
HRESULT | RetrieveDisplayString (IStream *ipStream)
HRESULT | RetrieveDisplayString (IStream *ipStream)
HRESULT | RetrieveGuidString (IStream *ipStream)
HRESULT | RetrieveGuidString (IStream *ipStream)
HRESULT | RetrieveGuidString (IStream *ipStream)
HRESULT | RetrieveGuidString (IStream *ipStream)
HRESULT | RetrieveGuidString (IStream *ipStream)
HRESULT | RetrieveGuidString (IStream *ipStream)
HRESULT | RetrieveGuidString (IStream *ipStream)
HRESULT | RetrieveGuidString (IStream *ipStream)
HRESULT | RetrieveNodeAttribs (STGMEDIUM *pStgMedium)
HRESULT | RetrieveNodePropPtr (STGMEDIUM *pStgMedium)
HRESULT | RetrieveNodeTypeFlg (STGMEDIUM *pStgmedium)
HRESULT | RetrieveNodeTypeGuid (IStream *ipStream)
HRESULT | RetrieveNodeTypeGuid (IStream *ipStream)
HRESULT | RetrieveNodeTypeGuid (IStream *ipStream)
HRESULT | RetrieveNodeTypeGuid (IStream *ipStream)
HRESULT | RetrieveNodeTypeGuid (IStream *ipStream)
HRESULT | RetrieveNodeTypeGuid (IStream *ipStream)
HRESULT | RetrieveNodeTypeGuid (IStream *ipStream)
HRESULT | RetrieveNodeTypeGuid (IStream *ipStream)
HRESULT | RetrieveSnapInClassID (IStream *ipStream)
HRESULT | RetrieveSnapInClassID (IStream *ipStream)
HRESULT | RetrieveSnapInClassID (IStream *ipStream)
HRESULT | RetrieveSnapInClassID (IStream *ipStream)
HRESULT | RetrieveSnapInClassID (IStream *ipStream)
HRESULT | RetrieveSnapInClassID (IStream *ipStream)
HRESULT | RetrieveSnapInClassID (IStream *ipStream)
HRESULT | RetrieveSnapInClassID (IStream *ipStream)

Private Attributes

LPITEMIDLIST * | m_aPidls
DWORD m_cDataCount
UINT m_cfEmbedSource
ULONG m_cFormatEtc
UINT m_cfPrivateData
UINT m_cfShellIDList
DATA_OBJECT_TYPES | m_context
CLListImpl< LONG_PTR, LONG_PTR > | m_CookieList
ULONG m_cRef
ULONG m_cref
DWORD m_cRefCount
CLListImpl< GUID *, GUID * > | m_GuidList
ULONG m_iCurrent
MMC_COOKIE | m_lCookie
INT_PTR | m_nCookie
DWORD m_ObjRefCount
LPDATAADVISEHOLDER | m_pDataAdviseHolder
LPFORMATETC | m_pFormatEtc
IMalloc * | m_pMalloc
COleDocument * m_pOleDoc
CPidlMgr * m_pPidlMgr
CShellFolder * m_psfParent
LPSTGMEDIUM | m_pStgMedium
ULONG m_uContext
ULONG_PTR | m_uCookie
ULONG m_uCookie
LONG_PTR | m_uCookie
UINT m_uItemCount
ULONG m_uNodeTypeFlg
MMC_COOKIE * | pCookies

Detailed Description

Definition at line 45 of file DataObj.h.

Member Enumeration Documentation

anonymous enum [private]
Enumerator:
MAX_COOKIES

Definition at line 92 of file dataobj.h.

{ MAX_COOKIES = 20 }; // MAX_COOKIES == MAX_CHILDREN declared

Constructor & Destructor Documentation

CDataObject::CDataObject ( COleDocument * pOleDoc )

Definition at line 38 of file DataObj.Cpp.

{
  OutputDebugString(TEXT("CDataObject's constructor\n"));

  m_pOleDoc = pOleDoc;

  m_pDataAdviseHolder = NULL;

  m_cfEmbedSource = RegisterClipboardFormat(CF_EMBEDSOURCE);
}

CDataObject::~CDataObject ( void )

Definition at line 55 of file DataObj.Cpp.

{
  if(m_pDataAdviseHolder)
    m_pDataAdviseHolder->Release();

  OutputDebugString(TEXT("CDataObject's destructor\n"));
}

CDataObject::CDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | context
 | ) |  |

Definition at line 48 of file dataobj.Cpp.

: m_lCookie(cookie), m_context(context), m_cref(0)
{
}

CDataObject::~CDataObject ( )
CDataObject::CDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | context
 | ) |  |
CDataObject::~CDataObject ( )
CDataObject::CDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | context
 | ) |  |
CDataObject::~CDataObject ( )
CDataObject::CDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | context
 | ) |  |
CDataObject::~CDataObject ( )
CDataObject::CDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | context
 | ) |  |
CDataObject::~CDataObject ( )
CDataObject::CDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | context
 | ) |  |
CDataObject::~CDataObject ( )
CDataObject::CDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | context
 | ) |  |
CDataObject::~CDataObject ( )
CDataObject::CDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | context
 | ) |  |
CDataObject::~CDataObject ( )
CDataObject::CDataObject ( )

Definition at line 24 of file dataobj.cpp.

{
  m_cRef     = 0;
  m_uCookie  = 0;
  m_uContext = 0;

}

CDataObject::~CDataObject ( )
CDataObject::CDataObject ( )
CDataObject::~CDataObject ( )
CDataObject::CDataObject ( )
CDataObject::~CDataObject ( )
CDataObject::CDataObject ( )
CDataObject::~CDataObject ( )
CDataObject::CDataObject ( )
CDataObject::~CDataObject ( )
CDataObject::CDataObject ( )
CDataObject::~CDataObject ( )
CDataObject::CDataObject ( )
CDataObject::~CDataObject ( )
CDataObject::CDataObject ( )
CDataObject::~CDataObject ( )
CDataObject::CDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | context
 | ) |  |
CDataObject::~CDataObject ( )
CDataObject::CDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | context
 | ) |  |
CDataObject::~CDataObject ( )
CDataObject::CDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | context
 | ) |  |
CDataObject::~CDataObject ( )
CDataObject::CDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | context
 | ) |  |
CDataObject::~CDataObject ( )
CDataObject::CDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | context
 | ) |  |
CDataObject::~CDataObject ( )
CDataObject::CDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | context
 | ) |  |
CDataObject::~CDataObject ( )
CDataObject::CDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | context
 | ) |  |
CDataObject::~CDataObject ( )
CDataObject::CDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | context
 | ) |  |
CDataObject::~CDataObject ( )
CDataObject::CDataObject | ( | MMC_COOKIE | cookie,
 |  | DATA_OBJECT_TYPES | context
 | ) |  |
CDataObject::~CDataObject ( )
CDataObject::CDataObject ( )
CDataObject::~CDataObject ( )
CDataObject::CDataObject | ( | CShellFolder * | psfParent,
 |  | LPCITEMIDLIST * | aPidls,
 |  | UINT | uItemCount
 | ) |  |

Definition at line 34 of file DataObj.Cpp.

{
g_DllRefCount++;

m_uItemCount = 0;

m_psfParent = psfParent;
if(m_psfParent)
   m_psfParent->AddRef();

m_ObjRefCount = 1;

m_aPidls = NULL;
SHGetMalloc(&m_pMalloc);
if(!m_pMalloc)
   {
   delete this;
   return;
   }

m_pPidlMgr = new CPidlMgr();

m_uItemCount = uItemCount;

AllocPidlTable(uItemCount);
if(m_aPidls)
   {
   FillPidlTable(aPidls, uItemCount);
   }

m_cfPrivateData = RegisterClipboardFormat(CFSTR_SAMPVIEWDATA);
m_cfShellIDList = RegisterClipboardFormat(CFSTR_SHELLIDLIST);

m_cFormatEtc = 2;
m_pFormatEtc = new FORMATETC[m_cFormatEtc];
SETDefFormatEtc(m_pFormatEtc[0], m_cfPrivateData, TYMED_HGLOBAL);
SETDefFormatEtc(m_pFormatEtc[1], m_cfShellIDList, TYMED_HGLOBAL);

m_iCurrent = 0;
}

CDataObject::~CDataObject ( )

Member Function Documentation

HRESULT CDataObject::AddMultiSelectCookie ( LONG_PTR nCookie )

Definition at line 385 of file dataobj.cpp.

{
  _ASSERT( nCookie > 0 );
  m_CookieList.AddTail( nCookie );     // Add the data object to our list

  return S_OK;
}

void CDataObject::AddMultiSelectCookie | ( | int | nIndexCookies,
 |  | LPARAM | lParam |
 | ) |  |  | [inline]

Definition at line 88 of file dataobj.h.

{ pCookies[nIndexCookies] = (MMC_COOKIE)lParam; }

HRESULT CDataObject::AddMultiSelectGuid ( GUID * pGuid )

Definition at line 401 of file dataobj.cpp.

{
  _ASSERT( NULL != pGuid );
  m_GuidList.AddTail( pGuid );     // Add the GUID to our list

  return S_OK;
}

BOOL CDataObject::AllocPidlTable ( DWORD dwEntries ) [private]

Definition at line 460 of file DataObj.Cpp.

{
m_aPidls = (LPITEMIDLIST*)m_pMalloc->Alloc(dwEntries * sizeof(LPITEMIDLIST));

if(m_aPidls)
   {
   //set all of the entries to NULL
   ZeroMemory(m_aPidls, dwEntries * sizeof(LPITEMIDLIST));
   }

return (m_aPidls != NULL);
}

STDMETHODIMP CDataObject::Clone ( LPENUMFORMATETC * ppEnum )

Definition at line 431 of file DataObj.Cpp.

{
CDataObject* pNew;

*ppEnum = NULL;

// Create the clone.
pNew = new CDataObject(m_psfParent, (LPCITEMIDLIST*)m_aPidls, m_uItemCount);
if (NULL == pNew)
   return E_OUTOFMEMORY;

pNew->m_iCurrent = m_iCurrent;

*ppEnum = pNew;

return S_OK;
}

STDMETHODIMP CDataObject::DAdvise | ( | LPFORMATETC | lpFormatetc,
 |  | DWORD | advf,
 |  | LPADVISESINK | pAdvSink,
 |  | LPDWORD | pdwConnection |
 | ) |  |  | [inline]

Definition at line 64 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DAdvise | ( | LPFORMATETC | lpFormatetc,
 |  | DWORD | advf,
 |  | LPADVISESINK | pAdvSink,
 |  | LPDWORD | pdwConnection |
 | ) |  |  | [inline]

Definition at line 64 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DAdvise | ( | LPFORMATETC | lpFormatetc,
 |  | DWORD | advf,
 |  | LPADVISESINK | pAdvSink,
 |  | LPDWORD | pdwConnection |
 | ) |  |  | [inline]

Definition at line 56 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DAdvise | ( | LPFORMATETC | lpFormatetc,
 |  | DWORD | advf,
 |  | LPADVISESINK | pAdvSink,
 |  | LPDWORD | pdwConnection |
 | ) |  |  | [inline]

Definition at line 56 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DAdvise | ( | LPFORMATETC | lpFormatetc,
 |  | DWORD | advf,
 |  | LPADVISESINK | pAdvSink,
 |  | LPDWORD | pdwConnection |
 | ) |  |  | [inline]

Definition at line 56 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DAdvise | ( | LPFORMATETC | lpFormatetc,
 |  | DWORD | advf,
 |  | LPADVISESINK | pAdvSink,
 |  | LPDWORD | pdwConnection |
 | ) |  |  | [inline]

Definition at line 64 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DAdvise | ( | LPFORMATETC | lpFormatetc,
 |  | DWORD | advf,
 |  | LPADVISESINK | pAdvSink,
 |  | LPDWORD | pdwConnection |
 | ) |  |  | [inline]

Definition at line 64 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DAdvise | ( | LPFORMATETC | lpFormatetc,
 |  | DWORD | advf,
 |  | LPADVISESINK | pAdvSink,
 |  | LPDWORD | pdwConnection |
 | ) |  |  | [inline]

Definition at line 56 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DAdvise | ( | LPFORMATETC | lpFormatetc,
 |  | DWORD | advf,
 |  | LPADVISESINK | pAdvSink,
 |  | LPDWORD | pdwConnection |
 | ) |  |  | [inline]

Definition at line 65 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DAdvise | ( | LPFORMATETC | lpFormatetc,
 |  | DWORD | advf,
 |  | LPADVISESINK | pAdvSink,
 |  | LPDWORD | pdwConnection |
 | ) |  |  | [inline]

Definition at line 64 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DAdvise | ( | LPFORMATETC | lpFormatetc,
 |  | DWORD | advf,
 |  | LPADVISESINK | pAdvSink,
 |  | LPDWORD | pdwConnection |
 | ) |  |  | [inline]

Definition at line 53 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DAdvise | ( | LPFORMATETC | lpFormatetc,
 |  | DWORD | advf,
 |  | LPADVISESINK | pAdvSink,
 |  | LPDWORD | pdwConnection |
 | ) |  |  | [inline]

Definition at line 64 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DAdvise | ( | LPFORMATETC | lpFormatetc,
 |  | DWORD | advf,
 |  | LPADVISESINK | pAdvSink,
 |  | LPDWORD | pdwConnection |
 | ) |  |  | [inline]

Definition at line 64 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DAdvise | ( | LPFORMATETC | lpFormatetc,
 |  | DWORD | advf,
 |  | LPADVISESINK | pAdvSink,
 |  | LPDWORD | pdwConnection |
 | ) |  |  | [inline]

Definition at line 64 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DAdvise | ( | LPFORMATETC | lpFormatetc,
 |  | DWORD | advf,
 |  | LPADVISESINK | pAdvSink,
 |  | LPDWORD | pdwConnection |
 | ) |  |  | [inline]

Definition at line 64 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DAdvise | ( | LPFORMATETC | lpFormatetc,
 |  | DWORD | advf,
 |  | LPADVISESINK | pAdvSink,
 |  | LPDWORD | pdwConnection |
 | ) |  |  | [inline]

Definition at line 64 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DAdvise | ( | LPFORMATETC | lpFormatetc,
 |  | DWORD | advf,
 |  | LPADVISESINK | pAdvSink,
 |  | LPDWORD | pdwConnection |
 | ) |  |  | [inline]

Definition at line 64 of file Dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DAdvise | ( | LPFORMATETC | lpFormatetc,
 |  | DWORD | advf,
 |  | LPADVISESINK | pAdvSink,
 |  | LPDWORD | pdwConnection |
 | ) |  |  | [inline]

Definition at line 56 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DAdvise | ( | LPFORMATETC | lpFormatetc,
 |  | DWORD | advf,
 |  | LPADVISESINK | pAdvSink,
 |  | LPDWORD | pdwConnection |
 | ) |  |  | [inline]

Definition at line 64 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DAdvise | ( | LPFORMATETC | lpFormatetc,
 |  | DWORD | advf,
 |  | LPADVISESINK | pAdvSink,
 |  | LPDWORD | pdwConnection |
 | ) |  |  | [inline]

Definition at line 64 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DAdvise | ( | LPFORMATETC | lpFormatetc,
 |  | DWORD | advf,
 |  | LPADVISESINK | pAdvSink,
 |  | LPDWORD | pdwConnection |
 | ) |  |  | [inline]

Definition at line 69 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DAdvise | ( | LPFORMATETC | lpFormatetc,
 |  | DWORD | advf,
 |  | LPADVISESINK | pAdvSink,
 |  | LPDWORD | pdwConnection |
 | ) |  |  | [inline]

Definition at line 64 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHOD() CDataObject::DAdvise | ( | FORMATETC * | ,
 |  | DWORD | ,
 |  | LPADVISESINK | ,
 |  | LPDWORD |
 | ) |  |
STDMETHODIMP CDataObject::DAdvise | ( | LPFORMATETC | pFE,
 |  | DWORD | advf,
 |  | IAdviseSink * | ppAdviseSink,
 |  | LPDWORD | pdwConnection
 | ) |  |

Definition at line 338 of file DataObj.Cpp.

{
return E_NOTIMPL;
}

STDMETHODIMP CDataObject::DAdvise | ( | LPFORMATETC | pFormatetc,
 |  | DWORD | advf,
 |  | LPADVISESINK | pAdvSink,
 |  | LPDWORD | pdwConnection
 | ) |  |

Definition at line 131 of file DataObj.Cpp.

{
  OutputDebugString(TEXT("CDataObject::DAdvise\n"));

  // if no DataAdviseHolder has been created, then create one.
  if(!m_pDataAdviseHolder)
    CreateDataAdviseHolder(&m_pDataAdviseHolder);

  if(m_pDataAdviseHolder)
  {
    // pass on to the DataAdviseHolder
    return m_pDataAdviseHolder->Advise(this, pFormatetc, advf, pAdvSink, pdwConnection);
  }

  return E_FAIL;
}

STDMETHODIMP CDataObject::DAdvise | ( | LPFORMATETC | lpFormatetc,
 |  | DWORD | advf,
 |  | LPADVISESINK | pAdvSink,
 |  | LPDWORD | pdwConnection |
 | ) |  |  | [inline]

Definition at line 64 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DAdvise | ( | LPFORMATETC | lpFormatetc,
 |  | DWORD | advf,
 |  | LPADVISESINK | pAdvSink,
 |  | LPDWORD | pdwConnection |
 | ) |  |  | [inline]

Definition at line 64 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DAdvise | ( | LPFORMATETC | lpFormatetc,
 |  | DWORD | advf,
 |  | LPADVISESINK | pAdvSink,
 |  | LPDWORD | pdwConnection |
 | ) |  |  | [inline]

Definition at line 56 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DUnadvise ( DWORD dwConnection ) [inline]

Definition at line 67 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DUnadvise ( DWORD dwConnection ) [inline]

Definition at line 59 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DUnadvise ( DWORD dwConnection ) [inline]

Definition at line 59 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DUnadvise ( DWORD dwConnection ) [inline]

Definition at line 59 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DUnadvise ( DWORD dwConnection ) [inline]

Definition at line 67 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DUnadvise ( DWORD dwConnection ) [inline]

Definition at line 68 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DUnadvise ( DWORD dwConnection ) [inline]

Definition at line 59 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DUnadvise ( DWORD dwConnection ) [inline]

Definition at line 67 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DUnadvise ( DWORD dwConnection ) [inline]

Definition at line 67 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DUnadvise ( DWORD dwConnection ) [inline]

Definition at line 56 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DUnadvise ( DWORD dwConnection ) [inline]

Definition at line 67 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DUnadvise ( DWORD dwConnection ) [inline]

Definition at line 67 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DUnadvise ( DWORD dwConnection )

Definition at line 157 of file DataObj.Cpp.

{
  OutputDebugString(TEXT("CDataObject::DUnadvise\n"));

  if(m_pDataAdviseHolder)
  {
    // pass on to the DataAdviseHolder
    return m_pDataAdviseHolder->Unadvise(dwConnection);
  }

  return E_FAIL;
}

STDMETHODIMP CDataObject::DUnadvise ( DWORD dwConnection ) [inline]

Definition at line 67 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DUnadvise ( DWORD dwConnection ) [inline]

Definition at line 67 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DUnadvise ( DWORD dwConnection ) [inline]

Definition at line 67 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DUnadvise ( DWORD dwConnection ) [inline]

Definition at line 67 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DUnadvise ( DWORD dwConnection ) [inline]

Definition at line 59 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DUnadvise ( DWORD dwConnection ) [inline]

Definition at line 67 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DUnadvise ( DWORD dwConnection ) [inline]

Definition at line 67 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DUnadvise ( DWORD dwConnection ) [inline]

Definition at line 67 of file Dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DUnadvise ( DWORD dwConnection ) [inline]

Definition at line 67 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DUnadvise ( DWORD dwConnection ) [inline]

Definition at line 67 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DUnadvise ( DWORD dwConnection ) [inline]

Definition at line 72 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHOD() CDataObject::DUnadvise ( DWORD )
STDMETHODIMP CDataObject::DUnadvise ( DWORD dwConnection )
STDMETHODIMP CDataObject::DUnadvise ( DWORD dwConnection ) [inline]

Definition at line 67 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::DUnadvise ( DWORD dwConnection ) [inline]

Definition at line 59 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumDAdvise ( LPENUMSTATDATA * ppEnumAdvise ) [inline]

Definition at line 62 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumDAdvise ( LPENUMSTATDATA * ppEnumAdvise ) [inline]

Definition at line 70 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumDAdvise ( LPENUMSTATDATA * ppEnumAdvise ) [inline]

Definition at line 62 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumDAdvise ( LPENUMSTATDATA * ppEnumAdvise ) [inline]

Definition at line 62 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumDAdvise ( LPENUMSTATDATA * ppEnumAdvise ) [inline]

Definition at line 71 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumDAdvise ( LPENUMSTATDATA * ppEnumAdvise ) [inline]

Definition at line 62 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumDAdvise ( LPENUMSTATDATA * ppEnumAdvise ) [inline]

Definition at line 70 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumDAdvise ( LPENUMSTATDATA * ppEnumAdvise ) [inline]

Definition at line 70 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumDAdvise ( LPENUMSTATDATA * ppEnumAdvise ) [inline]

Definition at line 70 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumDAdvise ( LPENUMSTATDATA * ppEnumAdvise ) [inline]

Definition at line 70 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumDAdvise ( LPENUMSTATDATA * ppEnumAdvise ) [inline]

Definition at line 70 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumDAdvise ( LPENUMSTATDATA * ppEnumAdvise ) [inline]

Definition at line 59 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumDAdvise ( LPENUMSTATDATA * ppEnumAdvise ) [inline]

Definition at line 70 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumDAdvise ( LPENUMSTATDATA * ppEnumAdvise ) [inline]

Definition at line 70 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumDAdvise ( LPENUMSTATDATA * ppEnumAdvise ) [inline]

Definition at line 70 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumDAdvise ( LPENUMSTATDATA * ppenumAdvise )

Definition at line 306 of file DataObj.Cpp.

{
  OutputDebugString(TEXT("CDataObject::EnumDAdvise\n"));

  // need to NULL the out parameter
  *ppenumAdvise = NULL;

  return m_pDataAdviseHolder->EnumAdvise(ppenumAdvise);
}

STDMETHODIMP CDataObject::EnumDAdvise ( LPENUMSTATDATA * ppEnumAdvise ) [inline]

Definition at line 70 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumDAdvise ( LPENUMSTATDATA * ppEnumAdvise ) [inline]

Definition at line 62 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumDAdvise ( LPENUMSTATDATA * ppEnumAdvise ) [inline]

Definition at line 70 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumDAdvise ( LPENUMSTATDATA * ppEnumAdvise ) [inline]

Definition at line 70 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumDAdvise ( LPENUMSTATDATA * ppEnumAdvise ) [inline]

Definition at line 70 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumDAdvise ( LPENUMSTATDATA * ppEnumAdvise ) [inline]

Definition at line 70 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumDAdvise ( LPENUMSTATDATA * ppEnumAdvise ) [inline]

Definition at line 70 of file Dataobj.h.

    { return E_NOTIMPL; };

STDMETHOD() CDataObject::EnumDAdvise ( LPENUMSTATDATA * )
STDMETHODIMP CDataObject::EnumDAdvise ( LPENUMSTATDATA * ppEnumAdvise ) [inline]

Definition at line 75 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumDAdvise ( IEnumSTATDATA ** ppEnumAdvise )

Definition at line 363 of file DataObj.Cpp.

{
return E_NOTIMPL;
}

STDMETHODIMP CDataObject::EnumDAdvise ( LPENUMSTATDATA * ppEnumAdvise ) [inline]

Definition at line 70 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumDAdvise ( LPENUMSTATDATA * ppEnumAdvise ) [inline]

Definition at line 62 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumFormatEtc | ( | DWORD | dwDirection,
 |  | LPENUMFORMATETC * | ppEnumFormatEtc |
 | ) |  |  | [inline]

Definition at line 52 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumFormatEtc | ( | DWORD | dwDirection,
 |  | LPENUMFORMATETC * | ppEnumFormatEtc |
 | ) |  |  | [inline]

Definition at line 44 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumFormatEtc | ( | DWORD | dwDirection,
 |  | LPENUMFORMATETC * | ppEnumFormatEtc |
 | ) |  |  | [inline]

Definition at line 44 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumFormatEtc | ( | DWORD | dwDirection,
 |  | LPENUMFORMATETC * | ppEnumFormatEtc |
 | ) |  |  | [inline]

Definition at line 44 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumFormatEtc | ( | DWORD | dwDirection,
 |  | LPENUMFORMATETC * | ppEnumFormatEtc |
 | ) |  |  | [inline]

Definition at line 52 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumFormatEtc | ( | DWORD | dwDirection,
 |  | LPENUMFORMATETC * | ppEnumFormatEtc |
 | ) |  |  | [inline]

Definition at line 52 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumFormatEtc | ( | DWORD | dwDirection,
 |  | LPENUMFORMATETC * | ppEnumFormatEtc |
 | ) |  |  | [inline]

Definition at line 44 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumFormatEtc | ( | DWORD | dwDirection,
 |  | LPENUMFORMATETC * | ppEnumFormatEtc |
 | ) |  |  | [inline]

Definition at line 53 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumFormatEtc | ( | DWORD | dwDirection,
 |  | IEnumFORMATETC ** | ppEFE
 | ) |  |

Definition at line 306 of file DataObj.Cpp.

{
*ppEFE = NULL;

if(DATADIR_GET == dwDirection)
   {
   return this->QueryInterface(IID_IEnumFORMATETC, (LPVOID*)ppEFE);
   }

return E_NOTIMPL;
}

STDMETHODIMP CDataObject::EnumFormatEtc | ( | DWORD | dwDirection,
 |  | LPENUMFORMATETC * | ppEnumFormatEtc |
 | ) |  |  | [inline]

Definition at line 52 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumFormatEtc | ( | DWORD | dwDirection,
 |  | LPENUMFORMATETC * | ppEnumFormatEtc |
 | ) |  |  | [inline]

Definition at line 52 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumFormatEtc | ( | DWORD | dwDirection,
 |  | LPENUMFORMATETC * | ppEnumFormatEtc |
 | ) |  |  | [inline]

Definition at line 52 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumFormatEtc | ( | DWORD | dwDirection,
 |  | LPENUMFORMATETC * | ppEnumFormatEtc
 | ) |  |
STDMETHODIMP CDataObject::EnumFormatEtc | ( | DWORD | dwDirection,
 |  | LPENUMFORMATETC * | ppEnumFormatEtc |
 | ) |  |  | [inline]

Definition at line 52 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumFormatEtc | ( | DWORD | dwDirection,
 |  | LPENUMFORMATETC * | ppEnumFormatEtc |
 | ) |  |  | [inline]

Definition at line 52 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumFormatEtc | ( | DWORD | dwDirection,
 |  | LPENUMFORMATETC * | ppEnumFormatEtc |
 | ) |  |  | [inline]

Definition at line 52 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumFormatEtc | ( | DWORD | dwDirection,
 |  | LPENUMFORMATETC * | ppEnumFormatEtc |
 | ) |  |  | [inline]

Definition at line 52 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumFormatEtc | ( | DWORD | dwDirection,
 |  | LPENUMFORMATETC * | ppEnumFormatEtc |
 | ) |  |  | [inline]

Definition at line 52 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumFormatEtc | ( | DWORD | dwDirection,
 |  | LPENUMFORMATETC * | ppEnumFormatEtc |
 | ) |  |  | [inline]

Definition at line 44 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHOD() CDataObject::EnumFormatEtc | ( | DWORD | ,
 |  | LPENUMFORMATETC * |
 | ) |  |
STDMETHODIMP CDataObject::EnumFormatEtc | ( | DWORD | dwDirection,
 |  | LPENUMFORMATETC * | ppEnumFormatEtc |
 | ) |  |  | [inline]

Definition at line 52 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumFormatEtc | ( | DWORD | dwDirection,
 |  | LPENUMFORMATETC * | ppEnumFormatEtc |
 | ) |  |  | [inline]

Definition at line 52 of file Dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumFormatEtc | ( | DWORD | dwDirection,
 |  | LPENUMFORMATETC * | ppEnumFormatEtc |
 | ) |  |  | [inline]

Definition at line 52 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumFormatEtc | ( | DWORD | dwDirection,
 |  | LPENUMFORMATETC * | ppEnumFormatEtc |
 | ) |  |  | [inline]

Definition at line 57 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumFormatEtc | ( | DWORD | dwDirection,
 |  | LPENUMFORMATETC * | ppEnumFormatEtc |
 | ) |  |  | [inline]

Definition at line 52 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumFormatEtc | ( | DWORD | dwDirection,
 |  | LPENUMFORMATETC * | ppEnumFormatEtc |
 | ) |  |  | [inline]

Definition at line 44 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumFormatEtc | ( | DWORD | dwDirection,
 |  | LPENUMFORMATETC * | ppEnumFormatEtc |
 | ) |  |  | [inline]

Definition at line 52 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::EnumFormatEtc | ( | DWORD | dwDirection,
 |  | LPENUMFORMATETC * | ppenumFormatEtc
 | ) |  |

Definition at line 278 of file DataObj.Cpp.

{
  OutputDebugString(TEXT("CDataObject::EnumFormatEtc\n"));

  // need to NULL the out parameter
  *ppenumFormatEtc = NULL;

  if(DATADIR_SET == dwDirection)
    return E_NOTIMPL;

  *ppenumFormatEtc = new CEnumFormatEtc();

  if(*ppenumFormatEtc)
  {
    (*ppenumFormatEtc)->AddRef();
    return S_OK;
  }

  return E_OUTOFMEMORY;
}

BOOL CDataObject::FillPidlTable | ( | LPCITEMIDLIST * | aPidls,
 |  | UINT | uItemCount |
 | ) |  |  | [private]

Definition at line 499 of file DataObj.Cpp.

{
if(m_aPidls)
   {
   if(m_pPidlMgr)
      {
      UINT  i;
      for(i = 0; i < uItemCount; i++)
         {
         m_aPidls[i] = m_pPidlMgr->Copy(aPidls[i]);
         }
      return TRUE;
      }
   }

return FALSE;
}

VOID CDataObject::FreePidlTable ( VOID ) [private]

Definition at line 479 of file DataObj.Cpp.

{
if(m_aPidls && m_pPidlMgr)
   {
   UINT  i;
   for(i = 0; i < m_uItemCount; i++)
      m_pPidlMgr->Delete(m_aPidls[i]);

   m_pMalloc->Free(m_aPidls);

   m_aPidls = NULL;
   }
}

CDelegationBase* CDataObject::GetBaseNodeObject ( ) [inline]

Definition at line 77 of file dataobj.h.

                                         {
        return (CDelegationBase *)m_lCookie;
    }

CDelegationBase* CDataObject::GetBaseNodeObject ( ) [inline]

Definition at line 78 of file dataobj.h.

                                         {
        return (CDelegationBase *)m_lCookie;
    }

CDelegationBase* CDataObject::GetBaseNodeObject ( ) [inline]

Definition at line 77 of file dataobj.h.

                                         {
        return (CDelegationBase *)m_lCookie;
    }

CDelegationBase* CDataObject::GetBaseNodeObject ( ) [inline]

Definition at line 77 of file dataobj.h.

                                         {
        return (CDelegationBase *)m_lCookie;
    }

CDelegationBase* CDataObject::GetBaseNodeObject ( ) [inline]

Definition at line 77 of file dataobj.h.

                                         {
        return (CDelegationBase *)m_lCookie;
    }

CDelegationBase* CDataObject::GetBaseNodeObject ( ) [inline]

Definition at line 77 of file dataobj.h.

                                         {
        return (CDelegationBase *)m_lCookie;
    }

CDelegationBase* CDataObject::GetBaseNodeObject ( ) [inline]

Definition at line 77 of file dataobj.h.

                                         {
        return (CDelegationBase *)m_lCookie;
    }

CDelegationBase* CDataObject::GetBaseNodeObject ( ) [inline]

Definition at line 77 of file dataobj.h.

                                         {
        return (CDelegationBase *)m_lCookie;
    }

CDelegationBase* CDataObject::GetBaseNodeObject ( ) [inline]

Definition at line 77 of file dataobj.h.

                                         {
        return (CDelegationBase *)m_lCookie;
    }

CDelegationBase* CDataObject::GetBaseNodeObject ( ) [inline]

Definition at line 77 of file dataobj.h.

                                         {
        return (CDelegationBase *)m_lCookie;
    }

CDelegationBase* CDataObject::GetBaseNodeObject ( ) [inline]

Definition at line 77 of file dataobj.h.

                                         {
        return (CDelegationBase *)m_lCookie;
    }

CDelegationBase* CDataObject::GetBaseNodeObject ( ) [inline]

Definition at line 77 of file dataobj.h.

                                         {
        return (CDelegationBase *)m_lCookie;
    }

CDelegationBase* CDataObject::GetBaseNodeObject ( ) [inline]

Definition at line 77 of file dataobj.h.

                                         {
        return (CDelegationBase *)m_lCookie;
    }

CDelegationBase* CDataObject::GetBaseNodeObject ( ) [inline]

Definition at line 77 of file dataobj.h.

                                         {
        return (CDelegationBase *)m_lCookie;
    }

CDelegationBase* CDataObject::GetBaseNodeObject ( ) [inline]

Definition at line 77 of file dataobj.h.

                                         {
        return (CDelegationBase *)m_lCookie;
    }

CDelegationBase* CDataObject::GetBaseNodeObject ( ) [inline]

Definition at line 77 of file Dataobj.h.

                                         {
        return (CDelegationBase *)m_lCookie;
    }

CDelegationBase* CDataObject::GetBaseNodeObject ( ) [inline]

Definition at line 77 of file dataobj.h.

                                         {
        return (CDelegationBase *)m_lCookie;
    }

STDMETHODIMP CDataObject::GetCanonicalFormatEtc | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPFORMATETC | lpFormatetcOut |
 | ) |  |  | [inline]

Definition at line 50 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::GetCanonicalFormatEtc | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPFORMATETC | lpFormatetcOut |
 | ) |  |  | [inline]

Definition at line 50 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::GetCanonicalFormatEtc | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPFORMATETC | lpFormatetcOut |
 | ) |  |  | [inline]

Definition at line 58 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::GetCanonicalFormatEtc | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPFORMATETC | lpFormatetcOut |
 | ) |  |  | [inline]

Definition at line 50 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::GetCanonicalFormatEtc | ( | LPFORMATETC | pformatetc,
 |  | LPFORMATETC | pformatetcOut
 | ) |  |

Definition at line 215 of file DataObj.Cpp.

{
  OutputDebugString(TEXT("CDataObject::GetCanonicalFormatEtc\n"));

  HRESULT hr;

  if(!pformatetcOut)
    return E_INVALIDARG;

  //set all out parameters to NULL.
  pformatetcOut->ptd = NULL;

  if(!pformatetc)
    return E_INVALIDARG;

  // OLE2NOTE: we must validate that the format requested is supported
  if(NOERROR != (hr = QueryGetData(pformatetc)))
    return hr;

    /* OLE2NOTE: an app that is insensitive to target device (as
    **    SimpSvr is) should fill in the lpformatOut parameter
    **    but NULL out the "ptd" field; it should return NOERROR if the
    **    input formatetc->ptd what non-NULL. this tells the caller
    **    that it is NOT necessary to maintain a separate screen
    **    rendering and printer rendering. if should return
    **    DATA_S_SAMEFORMATETC if the input and output formatetc's are
    **    identical.
  */

  *pformatetcOut = *pformatetc;

  if(NULL == pformatetc->ptd)
    return DATA_S_SAMEFORMATETC;

  pformatetcOut->ptd = NULL;

  return NOERROR;
}

STDMETHODIMP CDataObject::GetCanonicalFormatEtc | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPFORMATETC | lpFormatetcOut |
 | ) |  |  | [inline]

Definition at line 50 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::GetCanonicalFormatEtc | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPFORMATETC | lpFormatetcOut |
 | ) |  |  | [inline]

Definition at line 59 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::GetCanonicalFormatEtc | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPFORMATETC | lpFormatetcOut |
 | ) |  |  | [inline]

Definition at line 58 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::GetCanonicalFormatEtc | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPFORMATETC | lpFormatetcOut |
 | ) |  |  | [inline]

Definition at line 58 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::GetCanonicalFormatEtc | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPFORMATETC | lpFormatetcOut |
 | ) |  |  | [inline]

Definition at line 58 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::GetCanonicalFormatEtc | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPFORMATETC | lpFormatetcOut |
 | ) |  |  | [inline]

Definition at line 58 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::GetCanonicalFormatEtc | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPFORMATETC | lpFormatetcOut |
 | ) |  |  | [inline]

Definition at line 47 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::GetCanonicalFormatEtc | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPFORMATETC | lpFormatetcOut |
 | ) |  |  | [inline]

Definition at line 58 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::GetCanonicalFormatEtc | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPFORMATETC | lpFormatetcOut |
 | ) |  |  | [inline]

Definition at line 58 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::GetCanonicalFormatEtc | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPFORMATETC | lpFormatetcOut |
 | ) |  |  | [inline]

Definition at line 58 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::GetCanonicalFormatEtc | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPFORMATETC | lpFormatetcOut |
 | ) |  |  | [inline]

Definition at line 58 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::GetCanonicalFormatEtc | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPFORMATETC | lpFormatetcOut |
 | ) |  |  | [inline]

Definition at line 58 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::GetCanonicalFormatEtc | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPFORMATETC | lpFormatetcOut |
 | ) |  |  | [inline]

Definition at line 50 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::GetCanonicalFormatEtc | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPFORMATETC | lpFormatetcOut |
 | ) |  |  | [inline]

Definition at line 58 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::GetCanonicalFormatEtc | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPFORMATETC | lpFormatetcOut |
 | ) |  |  | [inline]

Definition at line 58 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::GetCanonicalFormatEtc | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPFORMATETC | lpFormatetcOut |
 | ) |  |  | [inline]

Definition at line 58 of file Dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::GetCanonicalFormatEtc | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPFORMATETC | lpFormatetcOut |
 | ) |  |  | [inline]

Definition at line 58 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHOD() CDataObject::GetCanonicalFormatEtc | ( | LPFORMATETC | ,
 |  | LPFORMATETC |
 | ) |  |
STDMETHODIMP CDataObject::GetCanonicalFormatEtc | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPFORMATETC | lpFormatetcOut |
 | ) |  |  | [inline]

Definition at line 63 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::GetCanonicalFormatEtc | ( | LPFORMATETC | ,
 |  | LPFORMATETC |
 | ) |  |
STDMETHODIMP CDataObject::GetCanonicalFormatEtc | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPFORMATETC | lpFormatetcOut |
 | ) |  |  | [inline]

Definition at line 58 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::GetCanonicalFormatEtc | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPFORMATETC | lpFormatetcOut |
 | ) |  |  | [inline]

Definition at line 50 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::GetCanonicalFormatEtc | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPFORMATETC | lpFormatetcOut |
 | ) |  |  | [inline]

Definition at line 58 of file dataobj.h.

    { return E_NOTIMPL; };

DATA_OBJECT_TYPES CDataObject::GetContext ( ) [inline]

Definition at line 81 of file dataobj.h.

                                   {
        return m_context;
    }

ULONG CDataObject::GetContext ( ) [inline]

Definition at line 71 of file dataobj.h.

{ return m_uContext; }

DATA_OBJECT_TYPES CDataObject::GetContext ( ) [inline]

Definition at line 81 of file dataobj.h.

                                   {
        return m_context;
    }

ULONG CDataObject::GetContext ( ) [inline]

Definition at line 71 of file dataobj.h.

{ return m_uContext; }

ULONG CDataObject::GetContext ( ) [inline]

Definition at line 71 of file dataobj.h.

{ return m_uContext; }

DATA_OBJECT_TYPES CDataObject::GetContext ( ) [inline]

Definition at line 82 of file dataobj.h.

                                   {
        return m_context;
    }

ULONG CDataObject::GetContext ( ) [inline]

Definition at line 71 of file dataobj.h.

{ return m_uContext; }

DATA_OBJECT_TYPES CDataObject::GetContext ( ) [inline]

Definition at line 81 of file dataobj.h.

                                   {
        return m_context;
    }

DATA_OBJECT_TYPES CDataObject::GetContext ( ) [inline]

Definition at line 81 of file dataobj.h.

                                   {
        return m_context;
    }

DATA_OBJECT_TYPES CDataObject::GetContext ( ) [inline]

Definition at line 81 of file dataobj.h.

                                   {
        return m_context;
    }

DATA_OBJECT_TYPES CDataObject::GetContext ( ) [inline]

Definition at line 81 of file dataobj.h.

                                   {
        return m_context;
    }

DATA_OBJECT_TYPES CDataObject::GetContext ( ) [inline]

Definition at line 81 of file dataobj.h.

                                   {
        return m_context;
    }

ULONG CDataObject::GetContext ( ) [inline]

Definition at line 67 of file dataobj.h.

{ return m_uContext; }

DATA_OBJECT_TYPES CDataObject::GetContext ( ) [inline]

Definition at line 81 of file dataobj.h.

                                   {
        return m_context;
    }

DATA_OBJECT_TYPES CDataObject::GetContext ( ) [inline]

Definition at line 81 of file dataobj.h.

                                   {
        return m_context;
    }

DATA_OBJECT_TYPES CDataObject::GetContext ( ) [inline]

Definition at line 81 of file dataobj.h.

                                   {
        return m_context;
    }

DATA_OBJECT_TYPES CDataObject::GetContext ( ) [inline]

Definition at line 81 of file dataobj.h.

                                   {
        return m_context;
    }

ULONG CDataObject::GetContext ( ) [inline]

Definition at line 71 of file dataobj.h.

{ return m_uContext; }

DATA_OBJECT_TYPES CDataObject::GetContext ( ) [inline]

Definition at line 81 of file dataobj.h.

                                   {
        return m_context;
    }

DATA_OBJECT_TYPES CDataObject::GetContext ( ) [inline]

Definition at line 81 of file dataobj.h.

                                   {
        return m_context;
    }

DATA_OBJECT_TYPES CDataObject::GetContext ( ) [inline]

Definition at line 81 of file dataobj.h.

                                   {
        return m_context;
    }

DATA_OBJECT_TYPES CDataObject::GetContext ( ) [inline]

Definition at line 81 of file Dataobj.h.

                                   {
        return m_context;
    }

ULONG CDataObject::GetContext ( ) [inline]

Definition at line 84 of file dataobj.h.

{ return m_uContext; }

ULONG CDataObject::GetContext ( ) [inline]

Definition at line 71 of file dataobj.h.

{ return m_uContext; }

DATA_OBJECT_TYPES CDataObject::GetContext ( ) [inline]

Definition at line 81 of file dataobj.h.

                                   {
        return m_context;
    }

ULONG_PTR CDataObject::GetCookie ( ) [inline]

Definition at line 72 of file dataobj.h.

{ return m_uCookie;  }

ULONG CDataObject::GetCookie ( ) [inline]

Definition at line 72 of file dataobj.h.

{ return m_uCookie;  }

ULONG CDataObject::GetCookie ( ) [inline]

Definition at line 72 of file dataobj.h.

{ return m_uCookie;  }

INT_PTR CDataObject::GetCookie ( ) [inline]

Definition at line 85 of file dataobj.h.

{ return m_nCookie;  }

MMC_COOKIE CDataObject::GetCookie ( ) [inline]

Definition at line 86 of file dataobj.h.

{ return m_lCookie; }

ULONG CDataObject::GetCookie ( ) [inline]

Definition at line 72 of file dataobj.h.

{ return m_uCookie;  }

ULONG CDataObject::GetCookie ( ) [inline]

Definition at line 68 of file dataobj.h.

{ return m_uCookie;  }   // Returns unique indentifier

ULONG_PTR CDataObject::GetCookie ( ) [inline]

Definition at line 72 of file dataobj.h.

{ return m_uCookie;  }

ULONG CDataObject::GetCookie ( ) [inline]

Definition at line 72 of file dataobj.h.

{ return m_uCookie;  }

STDMETHODIMP CDataObject::GetData | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPSTGMEDIUM | lpMedium |
 | ) |  |  | [inline]

Definition at line 49 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::GetData | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPSTGMEDIUM | lpMedium |
 | ) |  |  | [inline]

Definition at line 41 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::GetData | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPSTGMEDIUM | lpMedium |
 | ) |  |  | [inline]

Definition at line 41 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::GetData | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPSTGMEDIUM | lpMedium |
 | ) |  |  | [inline]

Definition at line 49 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::GetData | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPSTGMEDIUM | lpMedium |
 | ) |  |  | [inline]

Definition at line 41 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::GetData | ( | LPFORMATETC | pFE,
 |  | LPSTGMEDIUM | pStgMedium
 | ) |  |

Definition at line 176 of file DataObj.Cpp.

{
  UNREFERENCED_PARAMETER(pFE);
  UNREFERENCED_PARAMETER(pStgMedium);
  OutputDebugString(TEXT("CDataObject::GetData\n"));

  HRESULT  hr = E_NOTIMPL;

  return hr;
}

STDMETHODIMP CDataObject::GetData | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPSTGMEDIUM | lpMedium |
 | ) |  |  | [inline]

Definition at line 49 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::GetData | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPSTGMEDIUM | lpMedium |
 | ) |  |  | [inline]

Definition at line 41 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::GetData | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPSTGMEDIUM | lpMedium
 | ) |  |
STDMETHODIMP CDataObject::GetData | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPSTGMEDIUM | lpMedium |
 | ) |  |  | [inline]

Definition at line 49 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::GetData | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPSTGMEDIUM | lpMedium |
 | ) |  |  | [inline]

Definition at line 49 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::GetData | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPSTGMEDIUM | lpMedium |
 | ) |  |  | [inline]

Definition at line 49 of file dataobj.h.

    { return E_NOTIMPL; };

HRESULT CDataObject::GetData | ( | FORMATETC * | pFormatEtc,
 |  | STGMEDIUM * | pStgMedium
 | ) |  |

Definition at line 162 of file dataobj.cpp.

{
  HRESULT hResult = DATA_E_FORMATETC;

  if( g_cfNodePropPtr == pFormatEtc->cfFormat )  // Looking for Node Properties
  {
    hResult = RetrieveNodePropPtr( pStgMedium );
  }
  else if( g_cfNodeTypeFlg == pFormatEtc->cfFormat )
  {
    hResult = RetrieveNodeTypeFlg( pStgMedium );
  }

  return hResult;
}

STDMETHODIMP CDataObject::GetData | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPSTGMEDIUM | lpMedium |
 | ) |  |  | [inline]

Definition at line 49 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::GetData | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPSTGMEDIUM | lpMedium |
 | ) |  |  | [inline]

Definition at line 49 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::GetData | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPSTGMEDIUM | lpMedium |
 | ) |  |  | [inline]

Definition at line 49 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::GetData | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPSTGMEDIUM | lpMedium |
 | ) |  |  | [inline]

Definition at line 49 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::GetData | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPSTGMEDIUM | lpMedium |
 | ) |  |  | [inline]

Definition at line 41 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::GetData | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPSTGMEDIUM | lpMedium |
 | ) |  |  | [inline]

Definition at line 49 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::GetData | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPSTGMEDIUM | lpMedium |
 | ) |  |  | [inline]

Definition at line 49 of file Dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::GetData | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPSTGMEDIUM | lpMedium |
 | ) |  |  | [inline]

Definition at line 49 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::GetData | ( | FORMATETC * | pFormatEtc,
 |  | STGMEDIUM * | pStgMedium
 | ) |  |
STDMETHODIMP CDataObject::GetData | ( | LPFORMATETC | ,
 |  | LPSTGMEDIUM |
 | ) |  |
STDMETHOD() CDataObject::GetData | ( | LPFORMATETC | ,
 |  | LPSTGMEDIUM |
 | ) |  |
STDMETHODIMP CDataObject::GetData | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPSTGMEDIUM | lpMedium |
 | ) |  |  | [inline]

Definition at line 49 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::GetData | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPSTGMEDIUM | lpMedium |
 | ) |  |  | [inline]

Definition at line 49 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::GetData | ( | FORMATETC * | pFormatEtc,
 |  | STGMEDIUM * | pStgMedium
 | ) |  |
STDMETHODIMP CDataObject::GetData | ( | LPFORMATETC | lpFormatetcIn,
 |  | LPSTGMEDIUM | lpMedium |
 | ) |  |  | [inline]

Definition at line 49 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::GetDataHere | ( | FORMATETC * | pformatetc,
 |  | STGMEDIUM * | pmedium
 | ) |  |
STDMETHODIMP CDataObject::GetDataHere | ( | FORMATETC * | pformatetc,
 |  | STGMEDIUM * | pmedium
 | ) |  |
HRESULT CDataObject::GetDataHere | ( | FORMATETC * | pformatetc,
 |  | STGMEDIUM * | pmedium
 | ) |  |

Definition at line 101 of file dataobj.Cpp.

{
    const   CLIPFORMAT cf = pFormatEtc->cfFormat;
    IStream *pStream = NULL;

    CDelegationBase *base = GetBaseNodeObject();

    HRESULT hr = CreateStreamOnHGlobal( pMedium->hGlobal, FALSE, &pStream );
    if ( FAILED(hr) )
        return hr;                       // Minimal error checking

    hr = DV_E_FORMATETC;                 // Unknown format

    if (cf == s_cfDisplayName) {
        const _TCHAR *pszName = base->GetDisplayName();

    MAKE_WIDEPTR_FROMTSTR(wszName, pszName);

    // get length of original string and convert it accordingly
        ULONG ulSizeofName = lstrlen(pszName);
        ulSizeofName++;                      // Count null character
        ulSizeofName *= sizeof(WCHAR);

        hr = pStream->Write(wszName, ulSizeofName, NULL);
    } else if (cf == s_cfNodeType) {
        const GUID *pGUID = (const GUID *)&base->getNodeType();

        hr = pStream->Write(pGUID, sizeof(GUID), NULL);
    } else if (cf == s_cfSZNodeType) {
        LPOLESTR szGuid;
        hr = StringFromCLSID(base->getNodeType(), &szGuid);

        if (SUCCEEDED(hr)) {
            hr = pStream->Write(szGuid, wcslen(szGuid), NULL);
            CoTaskMemFree(szGuid);
        }
    } else if (cf == s_cfSnapinClsid) {
        const GUID *pGUID = NULL;
        pGUID = &CLSID_CComponentData;

        hr = pStream->Write(pGUID, sizeof(GUID), NULL);
    } else if (cf == s_cfInternal) {
        // we are being asked to get our this pointer from the IDataObject interface
        // only our own snap-in objects will know how to do this.
        CDataObject *pThis = this;
        hr = pStream->Write( &pThis, sizeof(CDataObject*), NULL );
    }

    pStream->Release();

    return hr;
}

STDMETHODIMP CDataObject::GetDataHere | ( | FORMATETC * | pformatetc,
 |  | STGMEDIUM * | pmedium
 | ) |  |
STDMETHODIMP CDataObject::GetDataHere | ( | FORMATETC * | pFormatEtc,
 |  | STGMEDIUM * | pStgMedium
 | ) |  |
STDMETHODIMP CDataObject::GetDataHere | ( | FORMATETC * | pformatetc,
 |  | STGMEDIUM * | pmedium
 | ) |  |
STDMETHODIMP CDataObject::GetDataHere | ( | FORMATETC * | pformatetc,
 |  | STGMEDIUM * | pmedium
 | ) |  |
STDMETHODIMP CDataObject::GetDataHere | ( | FORMATETC * | pformatetc,
 |  | STGMEDIUM * | pmedium
 | ) |  |
STDMETHODIMP CDataObject::GetDataHere | ( | FORMATETC * | pformatetc,
 |  | STGMEDIUM * | pmedium
 | ) |  |
STDMETHODIMP CDataObject::GetDataHere | ( | LPFORMATETC | pFormatEtc,
 |  | LPSTGMEDIUM | pStgMedium
 | ) |  |

Definition at line 193 of file DataObj.Cpp.

{
  OutputDebugString(TEXT("CDataObject::GetDataHere\n"));

  HRESULT  hr = DATA_E_FORMATETC;

  if(pFormatEtc->cfFormat == m_cfEmbedSource)
  {
    hr = GetOleObjectDataHere( m_pOleDoc->m_pPersistStorage,
      pFormatEtc,
      pStgMedium);
  }

  return hr;
}

STDMETHODIMP CDataObject::GetDataHere | ( | FORMATETC * | pformatetc,
 |  | STGMEDIUM * | pmedium
 | ) |  |
STDMETHODIMP CDataObject::GetDataHere | ( | FORMATETC * | pFormatEtc,
 |  | STGMEDIUM * | pStgMedium
 | ) |  |
STDMETHODIMP CDataObject::GetDataHere | ( | LPFORMATETC | ,
 |  | LPSTGMEDIUM |
 | ) |  |
STDMETHODIMP CDataObject::GetDataHere | ( | FORMATETC * | pformatetc,
 |  | STGMEDIUM * | pmedium
 | ) |  |
STDMETHODIMP CDataObject::GetDataHere | ( | FORMATETC * | pformatetc,
 |  | STGMEDIUM * | pmedium
 | ) |  |
STDMETHODIMP CDataObject::GetDataHere | ( | FORMATETC * | pformatetc,
 |  | STGMEDIUM * | pmedium
 | ) |  |
STDMETHODIMP CDataObject::GetDataHere | ( | FORMATETC * | pformatetc,
 |  | STGMEDIUM * | pmedium
 | ) |  |
STDMETHODIMP CDataObject::GetDataHere | ( | FORMATETC * | pformatetc,
 |  | STGMEDIUM * | pmedium
 | ) |  |
STDMETHODIMP CDataObject::GetDataHere | ( | FORMATETC * | pformatetc,
 |  | STGMEDIUM * | pmedium
 | ) |  |
STDMETHOD() CDataObject::GetDataHere | ( | LPFORMATETC | ,
 |  | LPSTGMEDIUM |
 | ) |  |
STDMETHODIMP CDataObject::GetDataHere | ( | FORMATETC * | pformatetc,
 |  | STGMEDIUM * | pmedium
 | ) |  |
STDMETHODIMP CDataObject::GetDataHere | ( | FORMATETC * | pformatetc,
 |  | STGMEDIUM * | pmedium
 | ) |  |
STDMETHODIMP CDataObject::GetDataHere | ( | FORMATETC * | pformatetc,
 |  | STGMEDIUM * | pmedium
 | ) |  |
STDMETHODIMP CDataObject::GetDataHere | ( | FORMATETC * | pformatetc,
 |  | STGMEDIUM * | pmedium
 | ) |  |
STDMETHODIMP CDataObject::GetDataHere | ( | FORMATETC * | pformatetc,
 |  | STGMEDIUM * | pmedium
 | ) |  |
STDMETHODIMP CDataObject::GetDataHere | ( | FORMATETC * | pformatetc,
 |  | STGMEDIUM * | pmedium
 | ) |  |
STDMETHODIMP CDataObject::GetDataHere | ( | FORMATETC * | pFormatEtc,
 |  | STGMEDIUM * | pStgMedium
 | ) |  |
STDMETHODIMP CDataObject::GetDataHere | ( | FORMATETC * | pformatetc,
 |  | STGMEDIUM * | pmedium
 | ) |  |
MMC_COOKIE CDataObject::GetMultiSelectCookie ( int n ) [inline]

Definition at line 89 of file dataobj.h.

{ return pCookies[n]; }

STDMETHODIMP CDataObject::Next | ( | ULONG | uRequested,
 |  | LPFORMATETC | pFormatEtc,
 |  | ULONG * | pulFetched
 | ) |  |

Definition at line 373 of file DataObj.Cpp.

{
if(NULL == m_pFormatEtc)
   return S_FALSE;

if(NULL != pulFetched)
   *pulFetched = 0L;

if(NULL == pFormatEtc)
   return E_INVALIDARG;

ULONG uFetched;
for(uFetched = 0; m_iCurrent < m_cFormatEtc && uRequested > uFetched; uFetched++)
   {
   *pFormatEtc++ = m_pFormatEtc[m_iCurrent++];
   }

if(NULL != pulFetched)
   *pulFetched = uFetched;

return ((uFetched == uRequested) ? S_OK : S_FALSE);
}

STDMETHODIMP CDataObject::QueryGetData ( LPFORMATETC lpFormatetc ) [inline]

Definition at line 47 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::QueryGetData ( LPFORMATETC lpFormatetc ) [inline]

Definition at line 47 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::QueryGetData ( LPFORMATETC lpFormatetc ) [inline]

Definition at line 47 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::QueryGetData ( LPFORMATETC lpFormatetc ) [inline]

Definition at line 55 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::QueryGetData ( LPFORMATETC lpFormatetc ) [inline]

Definition at line 47 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::QueryGetData ( LPFORMATETC lpFormatetc ) [inline]

Definition at line 55 of file Dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::QueryGetData ( LPFORMATETC lpFormatetc ) [inline]

Definition at line 56 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::QueryGetData ( LPFORMATETC lpFormatetc ) [inline]

Definition at line 55 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::QueryGetData ( LPFORMATETC lpFormatetc ) [inline]

Definition at line 55 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::QueryGetData ( LPFORMATETC )
STDMETHODIMP CDataObject::QueryGetData ( LPFORMATETC lpFormatetc ) [inline]

Definition at line 55 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::QueryGetData ( LPFORMATETC lpFormatetc ) [inline]

Definition at line 55 of file dataobj.h.

    { return E_NOTIMPL; };

HRESULT CDataObject::QueryGetData ( FORMATETC * pFormatEtc )

Definition at line 187 of file dataobj.cpp.

{
  HRESULT hResult = DATA_E_FORMATETC;

  if( (DVASPECT_CONTENT & pFormatEtc->dwAspect) && (TYMED_HGLOBAL & pFormatEtc->tymed) )
  {
    if( g_cfNodePropPtr == pFormatEtc->cfFormat )
    {
      hResult = S_OK;
    }
    else if( g_cfNodeTypeFlg == pFormatEtc->cfFormat )
    {
      hResult = S_OK;
    }
  }

  return hResult;
}

STDMETHODIMP CDataObject::QueryGetData ( LPFORMATETC lpFormatetc ) [inline]

Definition at line 55 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::QueryGetData ( LPFORMATETC pformatetc )

Definition at line 108 of file DataObj.Cpp.

{
  OutputDebugString(TEXT("CDataObject::QueryGetData\n"));

  HRESULT  hr = DATA_E_FORMATETC;

  // check the validity of the formatetc.
  if( (pformatetc->cfFormat == m_cfEmbedSource)  &&
    (pformatetc->dwAspect == DVASPECT_CONTENT) &&
    (pformatetc->tymed == TYMED_ISTORAGE))
  {
    hr = S_OK;
  }

  return hr;
}

STDMETHODIMP CDataObject::QueryGetData ( LPFORMATETC lpFormatetc ) [inline]

Definition at line 55 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::QueryGetData ( LPFORMATETC lpFormatetc ) [inline]

Definition at line 55 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::QueryGetData ( LPFORMATETC lpFormatetc ) [inline]

Definition at line 55 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::QueryGetData ( LPFORMATETC lpFormatetc ) [inline]

Definition at line 55 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::QueryGetData ( LPFORMATETC lpFormatetc ) [inline]

Definition at line 55 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::QueryGetData ( LPFORMATETC lpFormatetc ) [inline]

Definition at line 55 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHOD() CDataObject::QueryGetData ( LPFORMATETC )
STDMETHODIMP CDataObject::QueryGetData ( LPFORMATETC lpFormatetc ) [inline]

Definition at line 60 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::QueryGetData ( LPFORMATETC lpFormatetc ) [inline]

Definition at line 55 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::QueryGetData ( LPFORMATETC lpFormatetc ) [inline]

Definition at line 47 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::QueryGetData ( LPFORMATETC lpFormatetc ) [inline]

Definition at line 55 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::QueryGetData ( LPFORMATETC lpFormatetc ) [inline]

Definition at line 47 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::QueryGetData ( LPFORMATETC lpFormatetc ) [inline]

Definition at line 55 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CDataObject::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CDataObject::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CDataObject::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CDataObject::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CDataObject::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CDataObject::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CDataObject::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CDataObject::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CDataObject::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CDataObject::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppReturn
 | ) |  |

Definition at line 69 of file DataObj.Cpp.

{
  OutputDebugString(TEXT("CDataObject::QueryInterface\n"));

  return m_pOleDoc->QueryInterface(riid, ppReturn);
}

STDMETHODIMP CDataObject::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CDataObject::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CDataObject::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CDataObject::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CDataObject::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CDataObject::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CDataObject::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CDataObject::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CDataObject::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CDataObject::QueryInterface | ( | REFIID | riid,
 |  | LPVOID FAR * | ppvObj
 | ) |  |

Definition at line 48 of file ido.Cpp.

{
  OutputDebugString("In CDataObject::QueryInterface\r\n");

  return m_lpObj->QueryInterface(riid, ppvObj);
};

STDMETHODIMP CDataObject::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CDataObject::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CDataObject::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CDataObject::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CDataObject::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHOD() CDataObject::QueryInterface | ( | REFIID | ,
 |  | LPVOID * |
 | ) |  |
STDMETHODIMP CDataObject::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CDataObject::Reset ( void )

Definition at line 419 of file DataObj.Cpp.

{
m_iCurrent = 0;
return S_OK;
}

HRESULT CDataObject::RetrieveBaseNodePtr ( IStream * ipStream ) [private]
HRESULT CDataObject::RetrieveBaseNodePtr ( IStream * ipStream ) [private]
HRESULT CDataObject::RetrieveBaseNodePtr ( IStream * ipStream ) [private]

Definition at line 230 of file dataobj.cpp.

{
  LPBASENODE pNode = reinterpret_cast<LPBASENODE>(m_uCookie);
  return ipStream->Write( &pNode, sizeof(LPBASENODE), NULL );
}

HRESULT CDataObject::RetrieveBaseNodePtr ( IStream * ipStream ) [private]
HRESULT CDataObject::RetrieveBaseNodePtr ( IStream * ipStream ) [private]
HRESULT CDataObject::RetrieveBaseNodePtr ( IStream * ipStream ) [private]
HRESULT CDataObject::RetrieveDataObjPtr ( IStream * ipStream ) [private]
HRESULT CDataObject::RetrieveDataObjPtr ( IStream * ipStream ) [private]
HRESULT CDataObject::RetrieveDataObjPtr ( IStream * ipStream ) [private]

Definition at line 240 of file dataobj.cpp.

{
  CDataObject* pThis = this;
  return ipStream->Write( &pThis, sizeof(CDataObject*), NULL );
}

HRESULT CDataObject::RetrieveDataObjPtr ( IStream * ipStream ) [private]
HRESULT CDataObject::RetrieveDataObjPtr ( IStream * ipStream ) [private]
HRESULT CDataObject::RetrieveDataObjPtr ( IStream * ipStream ) [private]
HRESULT CDataObject::RetrieveDisplayString ( IStream * ipStream ) [private]
HRESULT CDataObject::RetrieveDisplayString ( IStream * ipStream ) [private]

Definition at line 147 of file dataobj.cpp.

{
  CBaseNode* pNode = reinterpret_cast<CBaseNode*>(m_uCookie);
  LPWSTR pNodeName = pNode->GetNodeName();

  ULONG ulSizeofName = (wcslen(pNodeName) + 1) * sizeof(WCHAR);
  return ipStream->Write(pNodeName, ulSizeofName, NULL);

}

HRESULT CDataObject::RetrieveDisplayString ( IStream * ipStream ) [private]
HRESULT CDataObject::RetrieveDisplayString ( IStream * ipStream ) [private]
HRESULT CDataObject::RetrieveDisplayString ( IStream * ipStream ) [private]
HRESULT CDataObject::RetrieveDisplayString ( IStream * ipStream ) [private]
HRESULT CDataObject::RetrieveDisplayString ( IStream * ipStream ) [private]
HRESULT CDataObject::RetrieveDisplayString ( IStream * ipStream ) [private]
HRESULT CDataObject::RetrieveGuidString ( IStream * ipStream ) [private]
HRESULT CDataObject::RetrieveGuidString ( IStream * ipStream ) [private]
HRESULT CDataObject::RetrieveGuidString ( IStream * ipStream ) [private]

Definition at line 198 of file dataobj.cpp.

{
  LPOLESTR pszGUID;
  GUID     TmpGUID;

  CBaseNode* pNode = reinterpret_cast<CBaseNode*>(m_uCookie);
  CopyMemory( &TmpGUID, pNode->GetNodeGUID(), sizeof(GUID) );

  HRESULT  hResult = StringFromCLSID( TmpGUID, &pszGUID );
  if( S_OK == hResult )
  {
    hResult = ipStream->Write( pszGUID, (wcslen(pszGUID) + 1) * sizeof(WCHAR), NULL );
    CoTaskMemFree( pszGUID );
  }
  return hResult;
}

HRESULT CDataObject::RetrieveGuidString ( IStream * ipStream ) [private]
HRESULT CDataObject::RetrieveGuidString ( IStream * ipStream ) [private]
HRESULT CDataObject::RetrieveGuidString ( IStream * ipStream ) [private]
HRESULT CDataObject::RetrieveGuidString ( IStream * ipStream ) [private]
HRESULT CDataObject::RetrieveGuidString ( IStream * ipStream ) [private]
HRESULT CDataObject::RetrieveMultiSelectCookies ( STGMEDIUM * pStgMedium )

Definition at line 314 of file dataobj.cpp.

{
  HRESULT hResult = S_OK;
  DWORD dwMemSize = (m_CookieList.GetCount() * sizeof(LONG_PTR)) + sizeof(DWORD);

  HGLOBAL hMem =  GlobalAlloc( GMEM_SHARE | GMEM_MOVEABLE, dwMemSize);
  if( NULL == hMem )
    hResult = E_OUTOFMEMORY;
  else
  {
    MULTISELECT_COOKIES* pMSCookies = (MULTISELECT_COOKIES*)GlobalLock( hMem );
    pMSCookies->count = m_CookieList.GetCount();

    LONG nIndex  = 0;
    POSITION Pos = m_CookieList.GetHeadPosition();
    while( Pos )
    {
      pMSCookies->Cookies[nIndex] = m_CookieList.GetNext( Pos );
      nIndex++;
    }

    GlobalUnlock( hMem );
    pStgMedium->hGlobal        = hMem;
    pStgMedium->tymed          = TYMED_HGLOBAL;
    pStgMedium->pUnkForRelease = NULL;
  }
  return hResult;
}

HRESULT CDataObject::RetrieveMultiSelectTypes ( STGMEDIUM * pStgMedium )

Definition at line 349 of file dataobj.cpp.

{
  HRESULT hResult = S_OK;
  DWORD dwMemSize = (m_GuidList.GetCount() * sizeof(GUID)) + sizeof(DWORD);

  DATA_OBJECT_TYPES type = (DATA_OBJECT_TYPES)m_uContext;

  HGLOBAL hMem =  GlobalAlloc( GMEM_SHARE | GMEM_MOVEABLE, dwMemSize );
  if( NULL == hMem )
    hResult = E_OUTOFMEMORY;
  else
  {
    SMMCObjectTypes* pMSObjTypes = (SMMCObjectTypes*)GlobalLock( hMem );
    pMSObjTypes->count = m_GuidList.GetCount();

    LONG nIndex  = 0;
    POSITION Pos = m_GuidList.GetHeadPosition();
    while( Pos )
    {
      CopyMemory( (void*)&pMSObjTypes->guid[nIndex], (void*)m_GuidList.GetNext( Pos ), sizeof(GUID) );
      nIndex++;
    }

    GlobalUnlock( hMem );
    pStgMedium->hGlobal        = hMem;
    pStgMedium->tymed          = TYMED_HGLOBAL;
    pStgMedium->pUnkForRelease = NULL;
  }

  return hResult;
}

HRESULT CDataObject::RetrieveNodeAttribs ( STGMEDIUM * pStgMedium ) [private]

Definition at line 274 of file dataobj.cpp.

{
  HRESULT     hResult = S_OK;
  LPBASENODE  pNode = reinterpret_cast<LPBASENODE>(m_uCookie);

  DWORD dwSize = sizeof(NODE_ATTRIBS);   //BUGLIST:

  HGLOBAL hMem = NULL;
  hMem = GlobalAlloc( GMEM_SHARE | GMEM_MOVEABLE, sizeof(NODE_ATTRIBS));
  if( NULL == hMem )
    hResult = E_OUTOFMEMORY;
  else
  {
    // Set our properties to hGlobal in the StgMedium
    NODE_ATTRIBS* pNodeAttribs = NULL;
    pNodeAttribs = (NODE_ATTRIBS*)GlobalLock( hMem );

    wcscpy( pNodeAttribs->szObjectPath, pNode->GetObjectPath() );

    GlobalUnlock( hMem );                  // Unlock and set the rest of the
    pStgMedium->hGlobal        = hMem;     // StgMedium variables
    pStgMedium->tymed          = TYMED_HGLOBAL;
    pStgMedium->pUnkForRelease = NULL;
  }

  //Just for testing
  //NODE_ATTRIBS* pTestAttribs = NULL;
  //pTestAttribs = reinterpret_cast<NODE_ATTRIBS*>(hMem);
  //pTestAttribs = (NODE_ATTRIBS*)GlobalLock(hMem);

  return hResult;
}

HRESULT CDataObject::RetrieveNodePropPtr ( STGMEDIUM * pStgMedium ) [private]

Definition at line 360 of file dataobj.cpp.

{
  _ASSERT( NULL != pStgMedium );
  HRESULT hResult = S_OK;

  LPBASENODE  pNode = reinterpret_cast<LPBASENODE>(m_uCookie);
  LPNODEPROPS pNodeProps = NULL;
  pNode->GetProperties( &pNodeProps );
  if( NULL == pNodeProps )
  {
    hResult = E_OUTOFMEMORY;
  }
  else
  {
    pStgMedium->hGlobal = (HGLOBAL)pNodeProps;     //
    pStgMedium->tymed   = TYMED_HGLOBAL;
    pStgMedium->pUnkForRelease = NULL;
  }

  return hResult;
}

HRESULT CDataObject::RetrieveNodeTypeFlg ( STGMEDIUM * pStgmedium ) [private]

Definition at line 391 of file dataobj.cpp.

{
  _ASSERT( NULL != pStgMedium );
  HRESULT hResult = S_OK;

  ULONG* pNodeTypeFlg = (ULONG*)::GlobalAlloc( GMEM_SHARE | GMEM_MOVEABLE, sizeof(ULONG) );
  if( NULL == pNodeTypeFlg )
  {
    hResult = E_OUTOFMEMORY;
  }
  else
  {
    pNodeTypeFlg  = (ULONG*)::GlobalLock( pNodeTypeFlg );
    *pNodeTypeFlg = m_uNodeTypeFlg;
    ::GlobalUnlock( pNodeTypeFlg );

    pStgMedium->hGlobal = pNodeTypeFlg;
    pStgMedium->tymed   = TYMED_HGLOBAL;
    pStgMedium->pUnkForRelease = NULL;
  }

  return hResult;
}

HRESULT CDataObject::RetrieveNodeTypeGuid ( IStream * ipStream ) [private]
HRESULT CDataObject::RetrieveNodeTypeGuid ( IStream * ipStream ) [private]
HRESULT CDataObject::RetrieveNodeTypeGuid ( IStream * ipStream ) [private]

Definition at line 182 of file dataobj.cpp.

{
  CBaseNode* pNode = reinterpret_cast<CBaseNode*>(m_uCookie);
  GUID* pGuid = pNode->GetNodeGUID();

  return ipStream->Write( (void*)pGuid, sizeof(GUID), NULL );
}

HRESULT CDataObject::RetrieveNodeTypeGuid ( IStream * ipStream ) [private]
HRESULT CDataObject::RetrieveNodeTypeGuid ( IStream * ipStream ) [private]
HRESULT CDataObject::RetrieveNodeTypeGuid ( IStream * ipStream ) [private]
HRESULT CDataObject::RetrieveNodeTypeGuid ( IStream * ipStream ) [private]
HRESULT CDataObject::RetrieveNodeTypeGuid ( IStream * ipStream ) [private]
HRESULT CDataObject::RetrieveSnapInClassID ( IStream * ipStream ) [private]
HRESULT CDataObject::RetrieveSnapInClassID ( IStream * ipStream ) [private]
HRESULT CDataObject::RetrieveSnapInClassID ( IStream * ipStream ) [private]
HRESULT CDataObject::RetrieveSnapInClassID ( IStream * ipStream ) [private]
HRESULT CDataObject::RetrieveSnapInClassID ( IStream * ipStream ) [private]
HRESULT CDataObject::RetrieveSnapInClassID ( IStream * ipStream ) [private]

Definition at line 165 of file dataobj.cpp.

{
  return ipStream->Write( &CLSID_CComponentData, sizeof(GUID), NULL );
}

HRESULT CDataObject::RetrieveSnapInClassID ( IStream * ipStream ) [private]
HRESULT CDataObject::RetrieveSnapInClassID ( IStream * ipStream ) [private]
STDMETHODIMP CDataObject::SetData | ( | LPFORMATETC | lpFormatetc,
 |  | LPSTGMEDIUM | lpMedium,
 |  | BOOL | bRelease |
 | ) |  |  | [inline]

Definition at line 53 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::SetData | ( | LPFORMATETC | lpFormatetc,
 |  | LPSTGMEDIUM | lpMedium,
 |  | BOOL | bRelease |
 | ) |  |  | [inline]

Definition at line 61 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::SetData | ( | LPFORMATETC | lpFormatetc,
 |  | LPSTGMEDIUM | lpMedium,
 |  | BOOL | bRelease |
 | ) |  |  | [inline]

Definition at line 61 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::SetData | ( | LPFORMATETC | lpFormatetc,
 |  | LPSTGMEDIUM | lpMedium,
 |  | BOOL | bRelease |
 | ) |  |  | [inline]

Definition at line 53 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHOD() CDataObject::SetData | ( | LPFORMATETC | ,
 |  | LPSTGMEDIUM | ,
 |  | BOOL |
 | ) |  |
STDMETHODIMP CDataObject::SetData | ( | LPFORMATETC | lpFormatetc,
 |  | LPSTGMEDIUM | lpMedium,
 |  | BOOL | bRelease |
 | ) |  |  | [inline]

Definition at line 61 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::SetData | ( | LPFORMATETC | lpFormatetc,
 |  | LPSTGMEDIUM | lpMedium,
 |  | BOOL | bRelease |
 | ) |  |  | [inline]

Definition at line 53 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::SetData | ( | LPFORMATETC | lpFormatetc,
 |  | LPSTGMEDIUM | lpMedium,
 |  | BOOL | bRelease |
 | ) |  |  | [inline]

Definition at line 61 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::SetData | ( | LPFORMATETC | lpFormatetc,
 |  | LPSTGMEDIUM | lpMedium,
 |  | BOOL | bRelease |
 | ) |  |  | [inline]

Definition at line 61 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::SetData | ( | LPFORMATETC | lpFormatetc,
 |  | LPSTGMEDIUM | lpMedium,
 |  | BOOL | bRelease |
 | ) |  |  | [inline]

Definition at line 61 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::SetData | ( | LPFORMATETC | lpFormatetc,
 |  | LPSTGMEDIUM | lpMedium,
 |  | BOOL | bRelease |
 | ) |  |  | [inline]

Definition at line 53 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::SetData | ( | LPFORMATETC | lpFormatetc,
 |  | LPSTGMEDIUM | lpMedium,
 |  | BOOL | bRelease |
 | ) |  |  | [inline]

Definition at line 61 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::SetData | ( | LPFORMATETC | lpFormatetc,
 |  | LPSTGMEDIUM | lpMedium,
 |  | BOOL | bRelease |
 | ) |  |  | [inline]

Definition at line 61 of file Dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::SetData | ( | LPFORMATETC | lpFormatetc,
 |  | LPSTGMEDIUM | lpMedium,
 |  | BOOL | bRelease |
 | ) |  |  | [inline]

Definition at line 61 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::SetData | ( | LPFORMATETC | lpFormatetc,
 |  | LPSTGMEDIUM | lpMedium,
 |  | BOOL | bRelease |
 | ) |  |  | [inline]

Definition at line 61 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::SetData | ( | LPFORMATETC | lpFormatetc,
 |  | LPSTGMEDIUM | lpMedium,
 |  | BOOL | bRelease |
 | ) |  |  | [inline]

Definition at line 66 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::SetData | ( | LPFORMATETC | lpFormatetc,
 |  | LPSTGMEDIUM | lpMedium,
 |  | BOOL | bRelease |
 | ) |  |  | [inline]

Definition at line 61 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::SetData | ( | LPFORMATETC | lpFormatetc,
 |  | LPSTGMEDIUM | lpMedium,
 |  | BOOL | bRelease |
 | ) |  |  | [inline]

Definition at line 62 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::SetData | ( | LPFORMATETC | lpFormatetc,
 |  | LPSTGMEDIUM | lpMedium,
 |  | BOOL | bRelease |
 | ) |  |  | [inline]

Definition at line 61 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::SetData | ( | LPFORMATETC | lpFormatetc,
 |  | LPSTGMEDIUM | lpMedium,
 |  | BOOL | bRelease |
 | ) |  |  | [inline]

Definition at line 61 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::SetData | ( | LPFORMATETC | lpFormatetc,
 |  | LPSTGMEDIUM | lpMedium,
 |  | BOOL | bRelease |
 | ) |  |  | [inline]

Definition at line 50 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::SetData | ( | LPFORMATETC | lpFormatetc,
 |  | LPSTGMEDIUM | lpMedium,
 |  | BOOL | bRelease |
 | ) |  |  | [inline]

Definition at line 61 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::SetData | ( | LPFORMATETC | lpFormatetc,
 |  | LPSTGMEDIUM | lpMedium,
 |  | BOOL | bRelease |
 | ) |  |  | [inline]

Definition at line 61 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::SetData | ( | LPFORMATETC | ,
 |  | LPSTGMEDIUM | ,
 |  | BOOL |
 | ) |  |
STDMETHODIMP CDataObject::SetData | ( | LPFORMATETC | lpFormatetc,
 |  | LPSTGMEDIUM | lpMedium,
 |  | BOOL | bRelease |
 | ) |  |  | [inline]

Definition at line 61 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::SetData | ( | LPFORMATETC | lpFormatetc,
 |  | LPSTGMEDIUM | lpMedium,
 |  | BOOL | bRelease |
 | ) |  |  | [inline]

Definition at line 53 of file dataobj.h.

    { return E_NOTIMPL; };

STDMETHODIMP CDataObject::SetData | ( | LPFORMATETC | pformatetc,
 |  | LPSTGMEDIUM | pmedium,
 |  | BOOL | fRelease
 | ) |  |

Definition at line 260 of file DataObj.Cpp.

{
  UNREFERENCED_PARAMETER(pformatetc);
  UNREFERENCED_PARAMETER(pmedium);
  UNREFERENCED_PARAMETER(fRelease);
  OutputDebugString(TEXT("CDataObject::SetData\n"));

  return DATA_E_FORMATETC;
}

STDMETHODIMP CDataObject::SetData | ( | LPFORMATETC | lpFormatetc,
 |  | LPSTGMEDIUM | lpMedium,
 |  | BOOL | bRelease |
 | ) |  |  | [inline]

Definition at line 53 of file dataobj.h.

    { return E_NOTIMPL; };

VOID CDataObject::SetPrivateData | ( | LONG_PTR | uCookie,
 |  | ULONG | uContext
 | ) |  |

Definition at line 141 of file dataobj.cpp.

{
  m_uCookie  = uCookie;
  m_uContext = uContext;
}

VOID CDataObject::SetPrivateData | ( | INT_PTR | nCookie,
 |  | ULONG | uContext
 | ) |  |

Definition at line 198 of file dataobj.cpp.

{
  m_nCookie  = nCookie;
  m_uContext = uContext;
}

VOID CDataObject::SetPrivateData | ( | ULONG | uCookie,
 |  | ULONG | uContext
 | ) |  |
VOID CDataObject::SetPrivateData | ( | ULONG | uCookie,
 |  | ULONG | uContext
 | ) |  |
VOID CDataObject::SetPrivateData | ( | ULONG | uCookie,
 |  | ULONG | uContext
 | ) |  |
VOID CDataObject::SetPrivateData | ( | ULONG_PTR | uCookie,
 |  | ULONG | uContext
 | ) |  |

Definition at line 141 of file dataobj.cpp.

{
  m_uCookie  = uCookie;
  m_uContext = uContext;
}

VOID CDataObject::SetPrivateData | ( | ULONG_PTR | uCookie,
 |  | ULONG | uContext
 | ) |  |
VOID CDataObject::SetPrivateData | ( | ULONG | uCookie,
 |  | ULONG | uContext
 | ) |  |

Definition at line 128 of file dataobj.cpp.

{
  m_uCookie  = uCookie;
  m_uContext = uContext;
}

STDMETHODIMP CDataObject::Skip ( ULONG cSkip )

Definition at line 402 of file DataObj.Cpp.

{
if((m_iCurrent + cSkip) >= m_cFormatEtc)
   return S_FALSE;

m_iCurrent += cSkip;

return S_OK;
}

CDataObject::STDMETHOD_ | ( | ULONG | ,
 |  | Release |
 | ) |  |
CDataObject::STDMETHOD_ | ( | ULONG | ,
 |  | AddRef |
 | ) |  |
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( DWORD )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( ULONG )
CDataObject::STDMETHODIMP_ ( DWORD )
CDataObject::STDMETHODIMP_ ( ULONG )

Member Data Documentation

LPITEMIDLIST* CDataObject::m_aPidls [private]

Definition at line 47 of file DataObj.h.

DWORD CDataObject::m_cDataCount [private]

Definition at line 44 of file DataObj.h.

UINT CDataObject::m_cfEmbedSource [private]

Definition at line 50 of file DataObj.h.

ULONG CDataObject::m_cFormatEtc [private]

Definition at line 53 of file DataObj.h.

UINT CDataObject::m_cfPrivateData [private]

Definition at line 55 of file DataObj.h.

UINT CDataObject::m_cfShellIDList [private]

Definition at line 56 of file DataObj.h.

DATA_OBJECT_TYPES CDataObject::m_context [private]

Definition at line 30 of file dataobj.h.

CLListImpl<LONG_PTR, LONG_PTR > CDataObject::m_CookieList [private]

Definition at line 107 of file dataobj.h.

ULONG CDataObject::m_cref [private]

Definition at line 28 of file dataobj.h.

ULONG CDataObject::m_cRef [private]

Definition at line 24 of file dataobj.h.

DWORD CDataObject::m_cRefCount [private]

Definition at line 41 of file DataObj.h.

CLListImpl<GUID*,GUID*> CDataObject::m_GuidList [private]

Definition at line 108 of file dataobj.h.

ULONG CDataObject::m_iCurrent [private]

Definition at line 52 of file DataObj.h.

MMC_COOKIE CDataObject::m_lCookie [private]

Definition at line 29 of file dataobj.h.

INT_PTR CDataObject::m_nCookie [private]

Definition at line 38 of file dataobj.h.

DWORD CDataObject::m_ObjRefCount [private]

Definition at line 46 of file DataObj.h.

LPDATAADVISEHOLDER CDataObject::m_pDataAdviseHolder [private]

Definition at line 49 of file DataObj.h.

CEnumFormatEtc* CDataObject::m_pEnumFormatEtc

Definition at line 71 of file dataobj.h.

LPFORMATETC CDataObject::m_pFormatEtc [private]

Definition at line 42 of file DataObj.h.

IMalloc* CDataObject::m_pMalloc [private]

Definition at line 48 of file DataObj.h.

COleDocument* CDataObject::m_pOleDoc [private]

Definition at line 48 of file DataObj.h.

CPidlMgr* CDataObject::m_pPidlMgr [private]

Definition at line 49 of file DataObj.h.

CShellFolder* CDataObject::m_psfParent [private]

Definition at line 50 of file DataObj.h.

LPSTGMEDIUM CDataObject::m_pStgMedium [private]

Definition at line 43 of file DataObj.h.

ULONG CDataObject::m_uContext [private]

Definition at line 26 of file dataobj.h.

ULONG_PTR CDataObject::m_uCookie [private]

Definition at line 25 of file dataobj.h.

LONG_PTR CDataObject::m_uCookie [private]

Definition at line 25 of file dataobj.h.

ULONG_PTR CDataObject::m_uCookie [private]

Definition at line 25 of file dataobj.h.

UINT CDataObject::m_uItemCount [private]

Definition at line 51 of file DataObj.h.

ULONG CDataObject::m_uNodeTypeFlg [private]

Definition at line 28 of file dataobj.h.

MMC_COOKIE* CDataObject::pCookies [private]

Definition at line 94 of file dataobj.h.

static UINT CDataObject::s_cfDisplayName = RegisterClipboardFormat(_T_CCF_DISPLAY_NAME) [static]

Definition at line 88 of file dataobj.h.

static UINT CDataObject::s_cfInternal = RegisterClipboardFormat(_T_CCF_INTERNAL_SNAPIN) [static]

Definition at line 91 of file dataobj.h.

UINT CDataObject::s_cfMultiSelect = RegisterClipboardFormat(_T_CCF_OBJECT_TYPES_IN_MULTI_SELECT) [static]

Definition at line 103 of file dataobj.h.

static UINT CDataObject::s_cfNodeType = RegisterClipboardFormat(_T_CCF_NODETYPE) [static]

Definition at line 89 of file dataobj.h.

static UINT CDataObject::s_cfSnapinClsid = RegisterClipboardFormat(_T_CCF_SNAPIN_CLASSID) [static]

Definition at line 90 of file dataobj.h.

static UINT CDataObject::s_cfSZNodeType = RegisterClipboardFormat(_T_CCF_SZNODETYPE) [static]

Definition at line 87 of file dataobj.h.

The documentation for this class was generated from the following files:
  • Com/Fundamentals/ActiveDocument/DoServer/DataObj.h
  • SysMgmt/MMC/Multisel/dataobj.h
  • SysMgmt/MMC/About/dataobj.h
  • SysMgmt/MMC/ActiveX/dataobj.h
  • SysMgmt/MMC/CMenu/dataobj.h
  • SysMgmt/MMC/Complete/dataobj.h
  • SysMgmt/MMC/CutCopy/dataobj.h
  • SysMgmt/MMC/Extens/dataobj.h
  • SysMgmt/MMC/Help/Dataobj.h
  • SysMgmt/MMC/Menubtn/dataobj.h
  • SysMgmt/MMC/mmc2.0/about/dataobj.h
  • SysMgmt/MMC/mmc2.0/contextmenu/dataobj.h
  • SysMgmt/MMC/mmc2.0/dragdrop/dataobj.h
  • SysMgmt/MMC/mmc2.0/help/dataobj.h
  • SysMgmt/MMC/mmc2.0/multisel/dataobj.h
  • SysMgmt/MMC/mmc2.0/proppage/dataobj.h
  • SysMgmt/MMC/mmc2.0/simple/dataobj.h
  • SysMgmt/MMC/mmc2.0/viewex/dataobj.h
  • SysMgmt/MMC/Nameext/dataobj.h
  • SysMgmt/MMC/Nodes/dataobj.h
  • SysMgmt/MMC/Openserv/dataobj.h
  • SysMgmt/MMC/Proppage/dataobj.h
  • SysMgmt/MMC/Simple/dataobj.h
  • SysMgmt/MMC/Taskpads/dataobj.h
  • SysMgmt/MMC/Toolbar/dataobj.h
  • SysMgmt/MMC/WMI/dataobj.h
  • WinUI/Shell/DragImg/DataObj.h
  • WinUI/Shell/SampView/DataObj.h
  • Com/Fundamentals/ActiveDocument/DoServer/DataObj.Cpp
  • Com/Fundamentals/SimpSvr/ido.Cpp
  • Com/Fundamentals/SimpSvr/ido.h
  • SysMgmt/MMC/About/dataobj.Cpp
  • SysMgmt/MMC/ActiveX/dataobj.Cpp
  • SysMgmt/MMC/CMenu/dataobj.Cpp
  • SysMgmt/MMC/Complete/dataobj.Cpp
  • SysMgmt/MMC/CutCopy/dataobj.Cpp
  • SysMgmt/MMC/Extens/dataobj.Cpp
  • SysMgmt/MMC/Help/Dataobj.Cpp
  • SysMgmt/MMC/Menubtn/dataobj.Cpp
  • SysMgmt/MMC/mmc2.0/about/dataobj.cpp
  • SysMgmt/MMC/mmc2.0/contextmenu/dataobj.cpp
  • SysMgmt/MMC/mmc2.0/dragdrop/dataobj.cpp
  • SysMgmt/MMC/mmc2.0/help/dataobj.cpp
  • SysMgmt/MMC/mmc2.0/multisel/dataobj.cpp
  • SysMgmt/MMC/mmc2.0/proppage/dataobj.cpp
  • SysMgmt/MMC/mmc2.0/simple/dataobj.cpp
  • SysMgmt/MMC/mmc2.0/viewex/dataobj.cpp
  • SysMgmt/MMC/Multisel/dataobj.Cpp
  • SysMgmt/MMC/Nameext/dataobj.Cpp
  • SysMgmt/MMC/Nodes/dataobj.Cpp
  • SysMgmt/MMC/Openserv/dataobj.Cpp
  • SysMgmt/MMC/Proppage/dataobj.Cpp
  • SysMgmt/MMC/Simple/dataobj.Cpp
  • SysMgmt/MMC/Taskpads/dataobj.Cpp
  • SysMgmt/MMC/Toolbar/dataobj.Cpp
  • SysMgmt/MMC/WMI/dataobj.Cpp
  • WinUI/Shell/DragImg/DataObj.Cpp
  • WinUI/Shell/SampView/DataObj.Cpp
Generated on Wed Nov 13 2024 16:56:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDataset Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CDataset Class Reference

#include "cdataset.h"

Inherits CDataAccess.

List of all members.

Public Member Functions

CDataset (CMainWindow *pCMainWindow, CMDIChild *pCMDIChild=NULL)
~CDataset ()
virtual HRESULT | AutoQI (DWORD dwCreateOpts)
virtual HRESULT | AutoRelease ()
virtual HRESULT | DisplayObject ()
virtual HRESULT | FreeAxisInfo (DBCOUNTITEM *pcAxis, MDAXISINFO **prgAxisInfo)
virtual HRESULT | GetAxisInfo (DBCOUNTITEM *pcAxis, MDAXISINFO **prgAxisInfo)
virtual HRESULT | GetAxisRowset (CAggregate *pCAggregate, DBCOUNTITEM iAxis, REFIID riid, ULONG cPropSets, DBPROPSET *rgPropSets, IUnknown **ppIUnknown)
virtual HRESULT | GetCellData (DBORDINAL ulStartCell, DBORDINAL ulEndCell)
virtual REFIID | GetDefaultInterface ()
virtual IUnknown ** | GetInterfaceAddress (REFIID riid)
virtual LONG | GetObjectImage ()
virtual UINT | GetObjectMenu ()
virtual WCHAR * | GetObjectName ()

Public Attributes

DBCOUNTITEM | m_cAxis
IMDDataset * | m_pIMDDataset
IMDFind * | m_pIMDFind
IMDRangeRowset * | m_pIMDRangeRowset
MDAXISINFO * | m_rgAxisInfo

Detailed Description

Definition at line 26 of file cdataset.h.

Constructor & Destructor Documentation

CDataset::CDataset | ( | CMainWindow * | pCMainWindow,
 |  | CMDIChild * | pCMDIChild = NULL
 | ) |  |

Definition at line 22 of file cdataset.cpp.

  : CDataAccess(eCDataset, pCMainWindow, pCMDIChild)
{
  //Dataset
  m_pIMDDataset   = NULL;
  m_pIMDFind      = NULL;
  m_pIMDRangeRowset = NULL;

  //Data
  m_cAxis       = 0;
  m_rgAxisInfo    = NULL;
}

CDataset::~CDataset ( )

Definition at line 40 of file cdataset.cpp.

{
  ReleaseObject(0);
}

Member Function Documentation

HRESULT CDataset::AutoQI ( DWORD dwCreateOpts ) [virtual]

Reimplemented from CDataAccess.

Definition at line 71 of file cdataset.cpp.

{
  //Delegate First so we have base interfaces
  CDataAccess::AutoQI(dwCreateOpts);

  //[MANDATORY]
  if(dwCreateOpts & CREATE_QI_MANDATORY)
  {
    OBTAIN_INTERFACE(IMDDataset);
  }

  //[OPTIONAL]
  if(dwCreateOpts & CREATE_QI_OPTIONAL)
  {
    OBTAIN_INTERFACE(IMDFind);
    OBTAIN_INTERFACE(IMDRangeRowset);
  }

  return S_OK;
}

HRESULT CDataset::AutoRelease ( ) [virtual]

Reimplemented from CDataAccess.

Definition at line 50 of file cdataset.cpp.

{
  HRESULT hr = S_OK;

  //Free the AxisInfo
  FreeAxisInfo(&m_cAxis, &m_rgAxisInfo);

  //Interface
  RELEASE_INTERFACE(IMDDataset);
  RELEASE_INTERFACE(IMDFind);
  RELEASE_INTERFACE(IMDRangeRowset);

  //Delegate
  return CDataAccess::AutoRelease();
}

HRESULT CDataset::DisplayObject ( ) [virtual]

Reimplemented from CBase.

Definition at line 237 of file cdataset.cpp.

{
  HRESULT hr = S_OK;

  BINDCOLS eBindCols = (GetOptions()->m_dwAccessorOpts & ACCESSOR_BIND_BOOKMARK ? BIND_ALLCOLS : BIND_ALLCOLSEXPECTBOOKMARK);
  if(m_pCMDIChild)
  {
    //Reset Cursor
    m_pCMDIChild->m_pCDataGrid->m_fLastFetchForward = FALSE;
    m_pCMDIChild->m_pCDataGrid->m_lCurPos = 0;

    //First Clear the existing Window...
    TESTC(hr = m_pCMDIChild->m_pCDataGrid->ClearAll());
  }

  //Create ColumnInfo
  TESTC(hr = GetColInfo());

  //Create Accessors and Setup bindings
  TESTC(hr = CreateAccessors(eBindCols));

  if(m_pCMDIChild)
  {
    //Refresh the Columns and Rows
    TESTC(hr = m_pCMDIChild->m_pCDataGrid->RefreshData());
  }

  //Display the object...
  TESTC(hr = CDataAccess::DisplayObject());

CLEANUP:
  if(m_pCMDIChild)
    m_pCMDIChild->UpdateControls();
  return hr;
}

HRESULT CDataset::FreeAxisInfo | ( | DBCOUNTITEM * | pcAxis,
 |  | MDAXISINFO ** | prgAxisInfo |
 | ) |  |  | [virtual]

Definition at line 135 of file cdataset.cpp.

{
  HRESULT hr = E_FAIL;
  ASSERT(pcAxis && prgAxisInfo);

  if(m_pIMDDataset)
  {
    //IMDDataset::FreeAxisInfo
    XTEST(hr = m_pIMDDataset->FreeAxisInfo(*pcAxis, *prgAxisInfo));
    TESTC(TRACE_METHOD(hr, L"IMDDataset::FreeAxisInfo(%lu, &0x%p)", *pcAxis, *prgAxisInfo));
  }

  //NULL output pointers
  *pcAxis     = 0;
  *prgAxisInfo  = NULL;

CLEANUP:
  return hr;
}

HRESULT CDataset::GetAxisInfo | ( | DBCOUNTITEM * | pcAxis,
 |  | MDAXISINFO ** | prgAxisInfo |
 | ) |  |  | [virtual]

Definition at line 115 of file cdataset.cpp.

{
  HRESULT hr = E_FAIL;

  if(m_pIMDDataset)
  {
    //IMDDataset::GetAxisInfo
    XTEST(hr = m_pIMDDataset->GetAxisInfo(pcAxis, prgAxisInfo));
    TESTC(TRACE_METHOD(hr, L"IMDDataset::GetAxisInfo(%lu, &0x%p)", pcAxis ? *pcAxis : 0, prgAxisInfo ? *prgAxisInfo : NULL));
  }

CLEANUP:
  return hr;
}

HRESULT CDataset::GetAxisRowset | ( | CAggregate * | pCAggregate,
 |  | DBCOUNTITEM | iAxis,
 |  | REFIID | riid,
 |  | ULONG | cPropSets,
 |  | DBPROPSET * | rgPropSets,
 |  | IUnknown ** | ppIUnknown |
 | ) |  |  | [virtual]

Definition at line 197 of file cdataset.cpp.

{
  HRESULT hr = E_FAIL;

  if(m_pIMDDataset)
  {
    //GetAxisInfo (if not already)
    if(m_cAxis == 0)
      TESTC(hr = GetAxisInfo(&m_cAxis, &m_rgAxisInfo));

    //GetAxisRowset
    if(m_cAxis)
    {
      XTEST_(hr = m_pIMDDataset->GetAxisRowset(
                      pCAggregate,
                      iAxis,
                      riid,
                      cPropSets,
                      rgPropSets,
                      ppIUnknown),S_OK);
      TRACE_METHOD(hr, L"IMDDataset::GetAxisRowset(0x%p, %d, %s, %d, 0x%p, &0x%p)", pCAggregate, iAxis, GetInterfaceName(riid), cPropSets, rgPropSets, ppIUnknown ? *ppIUnknown : NULL);
    }

    //Display Errors (if occurred)
    TESTC(hr = DisplayPropErrors(hr, cPropSets, rgPropSets));

    //Handle Aggregation
    if(pCAggregate)
      TESTC(hr = pCAggregate->HandleAggregation(riid, ppIUnknown));
  }

CLEANUP:
  return hr;
}

HRESULT CDataset::GetCellData | ( | DBORDINAL | ulStartCell,
 |  | DBORDINAL | ulEndCell |
 | ) |  |  | [virtual]

Definition at line 161 of file cdataset.cpp.

{
  HRESULT hr = E_FAIL;

  if(m_pIMDDataset)
  {
    //NOTE: Using cbRowSize of IAccessor::CreateAccessor
    //Because this method fetches properties for more than one cell,
    //the provider should know how long each row is. In this context, a "row" means the area
    //allocated in the consumer's buffer to hold all properties pertaining to one cell.
    //This information should be given in the cbRowSize parameter of IAccessor::CreateAccessor.
    //If the value of this parameter is zero, the consumer wants to fetch only one row of data
    //(one cell). In this case, it is an error to specify a ulStartCell different from the
    //ulEndCell.

    //Because of the above in the OLAP spec, we need to make sure our buffer is large enough
    //to hold the number of requested cells...
    if(ulEndCell > ulStartCell && m_cbRowSize)
      SAFE_REALLOC(m_pData, BYTE, m_cbRowSize * (ulEndCell - ulStartCell + 1));

    //IMDDataset::GetCellData
    XTEST(hr = m_pIMDDataset->GetCellData(m_hAccessor, ulStartCell, ulEndCell, m_pData));
    TESTC(TRACE_METHOD(hr, L"IMDDataset::GetCellData(0x%p, 0x%ld, 0x%ld, 0x%p)", m_hAccessor, ulStartCell, ulEndCell, m_pData));
  }

CLEANUP:
  return hr;
}

virtual REFIID CDataset::GetDefaultInterface ( ) [inline, virtual]

Implements CBase.

Definition at line 42 of file cdataset.h.

{ return IID_IMDDataset;  }

IUnknown ** CDataset::GetInterfaceAddress ( REFIID riid ) [virtual]

Reimplemented from CDataAccess.

Definition at line 97 of file cdataset.cpp.

{
  HANDLE_GETINTERFACE(IMDDataset);
  HANDLE_GETINTERFACE(IMDFind);
  HANDLE_GETINTERFACE(IMDRangeRowset);

  //Otherwise delegate
  return CDataAccess::GetInterfaceAddress(riid);
}

virtual LONG CDataset::GetObjectImage ( ) [inline, virtual]

Implements CBase.

Definition at line 41 of file cdataset.h.

{ return IMAGE_CUBE;    }

virtual UINT CDataset::GetObjectMenu ( ) [inline, virtual]

Implements CBase.

Definition at line 40 of file cdataset.h.

{ return IDM_DATASETMENU; }

virtual WCHAR* CDataset::GetObjectName ( ) [inline, virtual]

Implements CBase.

Definition at line 39 of file cdataset.h.

{ return L"Dataset";    }

Member Data Documentation

DBCOUNTITEM CDataset::m_cAxis

Definition at line 60 of file cdataset.h.

IMDDataset* CDataset::m_pIMDDataset

Definition at line 53 of file cdataset.h.

IMDFind* CDataset::m_pIMDFind

Definition at line 56 of file cdataset.h.

IMDRangeRowset* CDataset::m_pIMDRangeRowset

Definition at line 57 of file cdataset.h.

MDAXISINFO* CDataset::m_rgAxisInfo

Definition at line 61 of file cdataset.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdataset.h
  • Dataaccess/oledb/rowsetviewer/cdataset.cpp
Generated on Wed Nov 13 2024 16:56:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDataSource Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Protected Attributes | Friends

CDataSource Class Reference

#include "cdatasource.h"

Inherits CBaseObj, and CPropertiesBase.

List of all members.

Public Member Functions

CDataSource (CMainWindow *pCMainWindow, CMDIChild *pCMDIChild=NULL)
CDataSource ()
CDataSource (LPUNKNOWN)
virtual | ~CDataSource ()
virtual | ~CDataSource ()
~CDataSource (void)
virtual HRESULT | AdminCreateDataSource (CAggregate *pCAggregate, ULONG cPropSets, DBPROPSET *rgPropSets, REFIID riid, IUnknown **ppIUnknown)
virtual HRESULT | AutoQI (DWORD dwCreateOpts)
virtual HRESULT | AutoRelease ()
virtual HRESULT | Connect (HWND hWnd, CDataSource *pCDataSource=NULL)
virtual HRESULT | CreateSession (CAggregate *pCAggregate, REFIID riid, IUnknown **ppIUnknown)
virtual BOOL | Disconnect ()
BOOL | FInit (void)
virtual HRESULT | GetClassID (CLSID *pclsid, WCHAR **ppwszProgID=NULL)
virtual HRESULT | GetConnectionProps ()
virtual REFIID | GetDefaultInterface ()
WCHAR * | GetFilePath (void)
virtual IUnknown ** | GetInterfaceAddress (REFIID riid)
virtual WCHAR * | GetObjectDesc ()
virtual LONG | GetObjectImage ()
virtual UINT | GetObjectMenu ()
virtual WCHAR * | GetObjectName ()
virtual HRESULT | GetProviders ()
virtual BOOL | IsConnected ()
virtual BOOL | IsEqual (CDataSource *pCDataSource)
virtual BOOL | IsSimilar (CDataSource *pCDataSource)
STDMETHODIMP | OpenFile (WCHAR *pwszFileName, CFileIO **ppCFileIO)
STDMETHODIMP | QueryInterface (REFIID, LPVOID *)
VOID | RemoveSession (void)
STDMETHODIMP_ (DBREFCOUNT) AddRef(void)
STDMETHODIMP_ (DBREFCOUNT) Release(void)

Public Attributes

ULONG m_cProviderInfo
CComBSTR | m_cstrDataSource
CComBSTR | m_cstrDBMS
CComBSTR | m_cstrDBMSVer
CComBSTR | m_cstrProviderDesc
CComBSTR | m_cstrProviderName
ULONG m_dwStorageObjects
BOOL m_fConnected
BOOL m_fIRowsetChange
BOOL m_fIRowsetUpdate
BOOL m_fMultipleParamSets
BOOL m_fPrimaryKeysSupported
BOOL m_fReadOnly
LONG | m_lDataSourceType
ICommandText * | m_pICommandText
IDBCreateSession * | m_pIDBCreateSession
IDBDataSourceAdmin * | m_pIDBDataSourceAdmin
IDBInfo * | m_pIDBInfo
IDBInitialize * | m_pIDBInitialize
IDBSchemaRowset * | m_pIDBSchemaRowset
IIndexDefinition * | m_pIIndexDefinition
IOpenRowset * | m_pIOpenRowset
IParseDisplayName * | m_pIParseDisplayName
IPersist * | m_pIPersist
IPersistFile * | m_pIPersistFile
IServiceProvider * | m_pIServiceProvider
ITableDefinition * | m_pITableDefinition
LPUNKNOWN | m_pUnkOuter
WCHAR * | m_pwszCatalog
WCHAR * | m_pwszCatalogLocation
WCHAR * | m_pwszCatalogTerm
WCHAR * | m_pwszDataSource
WCHAR * | m_pwszDBMS
WCHAR * | m_pwszDBMSVer
WCHAR * | m_pwszProviderFileName
WCHAR * | m_pwszProviderName
WCHAR * | m_pwszProviderOLEDBVer
WCHAR * | m_pwszProviderParseName
WCHAR * | m_pwszProviderVer
WCHAR * | m_pwszSchemaTerm
WCHAR * | m_pwszTableTerm
PROVIDERINFO * m_rgProviderInfo
ULONG m_ulActiveSessions

Protected Attributes

DBREFCOUNT | m_cRef
BOOL m_fDBSessionCreated
BOOL m_fDSOInitialized
PIMPIDBCREATESESSION m_pIDBCreateSession
PIMPIDBINFO m_pIDBInfo
PIMPIDBINITIALIZE m_pIDBInitialize
PIMPIDBProperties m_pIDBProperties
CImpIPersist * m_pIPersist
CImpIServiceProvider * m_pIServiceProvider
PCUTILPROP m_pUtilProp
WCHAR | m_wszPath [MAX_PATH]

Friends

class | CDBSession
class | CImpIDBCreateSession
class | CImpIDBInfo
class | CImpIDBInitialize
class | CImpIDBProperties
class | CImpIPersist
class | CImpIServiceProvider

Detailed Description

Definition at line 25 of file cdatasource.h.

Constructor & Destructor Documentation

CDataSource::CDataSource | ( | CMainWindow * | pCMainWindow,
 |  | CMDIChild * | pCMDIChild = NULL
 | ) |  |

Definition at line 22 of file cdatasource.cpp.

  : CPropertiesBase(eCDataSource, pCMainWindow, pCMDIChild)
{
  //OLE DB Interfaces
  m_pIDBCreateSession     = NULL;   //DataSource interface
  m_pIPersist         = NULL;   //DataSource interface

  m_pIDBDataSourceAdmin   = NULL;   //DataSource interface
  m_pIDBInfo          = NULL;   //DataSource interface
  m_pIPersistFile       = NULL;   //DataSource interface

  //Services
  m_pIServiceProvider     = NULL;   //Service interface

  //Properties
  m_lDataSourceType     = DBPROPVAL_DST_TDP;
}

CDataSource::~CDataSource ( void ) [virtual]

Definition at line 45 of file cdatasource.cpp.

{
  ReleaseObject(0);
}

CDataSource::CDataSource ( LPUNKNOWN pUnkOuter )

Definition at line 26 of file datasrc.cpp.

  : CBaseObj( BOT_DATASOURCE )
{

    //  Initialize simple member vars
    m_cRef              = 0L;
    m_pUnkOuter         = pUnkOuter ? pUnkOuter : this;
    m_wszPath[0]        = L'\0';
    m_fDSOInitialized   = FALSE;
    m_fDBSessionCreated = FALSE;
    m_pUtilProp         = NULL;

    //  Initially, NULL all contained interfaces
    m_pIDBInitialize    = NULL;
    m_pIDBProperties  = NULL;
    m_pIDBInfo      = NULL;
  m_pIDBCreateSession = NULL;
  m_pIPersist     = NULL;

  //Data Links optional pages
  m_pIServiceProvider = NULL;

    // Increment global object count.
    OBJECT_CONSTRUCTED();

    return;
}

CDataSource::~CDataSource ( void )
CDataSource::CDataSource ( )

Definition at line 25 of file datasource.cpp.

{
  //OLEDB Interfaces
  m_pIDBInitialize    = NULL; //DataSource
  m_pIOpenRowset      = NULL; //Session
  m_pIDBSchemaRowset    = NULL; //Session
  m_pITableDefinition   = NULL; //Session
  m_pIIndexDefinition   = NULL; //Session
  m_pICommandText     = NULL; //Command

  //ProviderInfo
  m_pwszProviderName    = NULL; //Pointer into m_rgProviderInfo.wszName
  m_pwszProviderParseName = NULL; //Pointer into m_rgProviderInfo.wszParseName
  m_pwszProviderFileName  = NULL; //DBPROP_PROVIDERNAME
  m_pwszProviderVer   = NULL; //DBPROP_PROVIDERVER
  m_pwszProviderOLEDBVer  = NULL; //DBPROP_PROVIDEROLEDBVER

  //Enumerator ProvierInfo
  m_cProviderInfo     = 0;
  m_rgProviderInfo    = NULL;
  m_pIParseDisplayName  = NULL; //Enumerator

  //Properties
  m_fReadOnly       = TRUE; //DBPROP_DATASOURCEREADONLY
  m_fPrimaryKeysSupported = FALSE;//DBPROP_SQLSUPPORT
  m_fMultipleParamSets    = FALSE;//DBPROP_MULTIPLEPARAMSETS
  m_fIRowsetChange    = FALSE;//DBPROP_IRowsetChange
  m_fIRowsetUpdate    = FALSE;//DBPROP_IRowsetUpdate
  m_dwStorageObjects    = 0;  //DBPROP_STRUCTUREDSTORAGE

  m_pwszCatalog     = NULL; //DBPROP_CURRENTCATALOG
  m_pwszCatalogTerm   = NULL; //DBPROP_CATALOGTERM
  m_pwszCatalogLocation = NULL; //DBPROP_CATALOGLOCATION
  m_pwszSchemaTerm    = NULL; //DBPROP_SCHEMATERM
  m_pwszTableTerm     = NULL; //DBPROP_TABLETERM

  //DataSource Info
  m_ulActiveSessions    = 0;  //DBPROP_ACTIVESESSIONS
  m_pwszDataSource    = NULL; //DBPROP_DATASOURCENAME
  m_pwszDBMS        = NULL; //DBPROP_DBMSNAME
  m_pwszDBMSVer     = NULL; //DBPROP_DBMSVER

  m_fConnected = FALSE;
}

virtual CDataSource::~CDataSource ( ) [virtual]

Member Function Documentation

HRESULT CDataSource::AdminCreateDataSource | ( | CAggregate * | pCAggregate,
 |  | ULONG | cPropSets,
 |  | DBPROPSET * | rgPropSets,
 |  | REFIID | riid,
 |  | IUnknown ** | ppIUnknown |
 | ) |  |  | [virtual]

Definition at line 256 of file cdatasource.cpp.

{
  HRESULT hr = S_OK;
  DWORD dwCreateOpts = GetOptions()->m_dwCreateOpts;

  if(m_pIDBDataSourceAdmin)
  {
    //IDBDataSourceAdmin::CreateDataSource
    XTEST(hr = m_pIDBDataSourceAdmin->CreateDataSource(cPropSets, rgPropSets, pCAggregate, riid, ppIUnknown));
    TRACE_METHOD(hr, L"IDBDataSourceAdmin::CreateDataSource(%d, 0x%p, 0x%p, %s, &0x%p)", cPropSets, rgPropSets, pCAggregate, GetInterfaceName(riid), ppIUnknown ? *ppIUnknown : NULL);

    //Display any property errors...
    TESTC(hr = DisplayPropErrors(hr, cPropSets, rgPropSets));

    //Handle Aggregation
    if(pCAggregate)
      pCAggregate->HandleAggregation(riid, ppIUnknown);

    //We are now Initialized
    m_fInitialized = TRUE;

    //Obtain all interfaces, now that we are initialized
    TESTC(hr = AutoQI(dwCreateOpts));
  }

CLEANUP:
  return hr;
}

HRESULT CDataSource::AutoQI ( DWORD dwCreateOpts ) [virtual]

Reimplemented from CPropertiesBase.

Definition at line 106 of file cdatasource.cpp.

{
  //Delegate First so we have base interfaces
  CPropertiesBase::AutoQI(dwCreateOpts);

  //[MANDATORY]
  if(dwCreateOpts & CREATE_QI_MANDATORY)
  {
    OBTAIN_INTERFACE(IDBCreateSession);
    OBTAIN_INTERFACE(IPersist);
  }

  //AutoQI
  if(dwCreateOpts & CREATE_QI_OPTIONAL)
  {
    OBTAIN_INTERFACE(IDBDataSourceAdmin);
    OBTAIN_INTERFACE(IDBInfo);
    OBTAIN_INTERFACE(IPersistFile);

    //Services
    OBTAIN_INTERFACE(IServiceProvider);
  }

  //Are we intialized yet...
  if(m_pIDBProperties && (IsInitialized() || m_pIDBCreateSession))
  {
    //DBPROP_DATASOURCENAME
    GetProperty(IID_IDBProperties, m_pIDBProperties, DBPROP_DATASOURCENAME,     DBPROPSET_DATASOURCEINFO, DBTYPE_BSTR, &m_cstrDataSource);
    //DBPROP_DBMSNAME
    GetProperty(IID_IDBProperties, m_pIDBProperties, DBPROP_DBMSNAME,       DBPROPSET_DATASOURCEINFO, DBTYPE_BSTR, &m_cstrDBMS);
    //DBPROP_DBMSVER
    GetProperty(IID_IDBProperties, m_pIDBProperties, DBPROP_DBMSVER,        DBPROPSET_DATASOURCEINFO, DBTYPE_BSTR, &m_cstrDBMSVer);
    //DBPROP_PROVIDERFILENAME
    GetProperty(IID_IDBProperties, m_pIDBProperties, DBPROP_PROVIDERFILENAME,   DBPROPSET_DATASOURCEINFO, DBTYPE_BSTR, &m_cstrProviderName);
    //DBPROP_PROVIDERFRIENDLYNAME
    GetProperty(IID_IDBProperties, m_pIDBProperties, DBPROP_PROVIDERFRIENDLYNAME, DBPROPSET_DATASOURCEINFO, DBTYPE_BSTR, &m_cstrProviderDesc);
    //DBPROP_DATASOURCE_TYPE
    GetProperty(IID_IDBProperties, m_pIDBProperties, DBPROP_DATASOURCE_TYPE,    DBPROPSET_DATASOURCEINFO, DBTYPE_I4,   &m_lDataSourceType);

    //Only set "Default" properties, if requested by the user
    if(GetOptions()->m_dwRowsetOpts & ROWSET_SETDEFAULTPROPS)
    {
      //Kagera has a problem with OPTIONAL properties, still treating
      //them as SETIFCHEAP and lets you know the NOTSET ones...
      //Instead of always getting DB_S_ERRORSOCCURRED just special case until fixed
      DBPROPOPTIONS dwPropOptions = DBPROPOPTIONS_OPTIONAL;
      if(m_cstrProviderName == L"MSDASQL.DLL")
        dwPropOptions = DBPROPOPTIONS_REQUIRED;

      if(m_pCMDIChild)
      {
        CPropSets* pCPropSets = &m_pCMDIChild->m_CDefPropSets;

        //We want to provide Scrolling Capabilites to the user (if supported)
        if(IsSettableProperty(m_pIDBProperties, DBPROP_CANSCROLLBACKWARDS, DBPROPSET_ROWSET))
          pCPropSets->SetProperty(DBPROP_CANSCROLLBACKWARDS, DBPROPSET_ROWSET, DBTYPE_BOOL, (void*)VARIANT_TRUE, dwPropOptions);
        if(IsSettableProperty(m_pIDBProperties, DBPROP_CANFETCHBACKWARDS, DBPROPSET_ROWSET))
          pCPropSets->SetProperty(DBPROP_CANFETCHBACKWARDS, DBPROPSET_ROWSET, DBTYPE_BOOL, (void*)VARIANT_TRUE, dwPropOptions);

        //Allow the user to change data (if supported)
        if(IsSettableProperty(m_pIDBProperties, DBPROP_IRowsetChange, DBPROPSET_ROWSET))
          pCPropSets->SetProperty(DBPROP_IRowsetChange, DBPROPSET_ROWSET, DBTYPE_BOOL, (void*)VARIANT_TRUE, dwPropOptions);
        if(IsSettableProperty(m_pIDBProperties, DBPROP_UPDATABILITY, DBPROPSET_ROWSET))
          pCPropSets->SetProperty(DBPROP_UPDATABILITY, DBPROPSET_ROWSET, DBTYPE_I4, (void*)(DBPROPVAL_UP_CHANGE | DBPROPVAL_UP_INSERT | DBPROPVAL_UP_DELETE), dwPropOptions);

        //The table may contain BLOBs, and the Provider may require random positioning
        if(IsSettableProperty(m_pIDBProperties, DBPROP_ACCESSORDER, DBPROPSET_ROWSET))
          pCPropSets->SetProperty(DBPROP_ACCESSORDER, DBPROPSET_ROWSET, DBTYPE_I4, (void*)DBPROPVAL_AO_RANDOM, dwPropOptions);

        //Notifications are very useful debugging info (if supported)
        if(IsSettableProperty(m_pIDBProperties, DBPROP_IConnectionPointContainer, DBPROPSET_ROWSET))
          pCPropSets->SetProperty(DBPROP_IConnectionPointContainer, DBPROPSET_ROWSET, DBTYPE_BOOL, (void*)VARIANT_TRUE, dwPropOptions);

        //DBPROP_ISequentialStream
        if(GetOptions()->m_dwAccessorOpts & ACCESSOR_BLOB_ISEQSTREAM &&
          IsSettableProperty(m_pIDBProperties, DBPROP_ISequentialStream, DBPROPSET_ROWSET))
          pCPropSets->SetProperty(DBPROP_ISequentialStream, DBPROPSET_ROWSET, DBTYPE_BOOL, (void*)VARIANT_TRUE, dwPropOptions);
        //DBPROP_ILockBytes
        if(GetOptions()->m_dwAccessorOpts & ACCESSOR_BLOB_ILOCKBYTES &&
          IsSettableProperty(m_pIDBProperties, DBPROP_ILockBytes, DBPROPSET_ROWSET))
          pCPropSets->SetProperty(DBPROP_ILockBytes, DBPROPSET_ROWSET, DBTYPE_BOOL, (void*)VARIANT_TRUE, dwPropOptions);
        //DBPROP_IStorage
        if(GetOptions()->m_dwAccessorOpts & ACCESSOR_BLOB_ISTORAGE &&
          IsSettableProperty(m_pIDBProperties, DBPROP_IStorage, DBPROPSET_ROWSET))
          pCPropSets->SetProperty(DBPROP_IStorage, DBPROPSET_ROWSET, DBTYPE_BOOL, (void*)VARIANT_TRUE, dwPropOptions);
        //DBPROP_IStream
        if(GetOptions()->m_dwAccessorOpts & ACCESSOR_BLOB_ISTREAM &&
          IsSettableProperty(m_pIDBProperties, DBPROP_IStream, DBPROPSET_ROWSET))
          pCPropSets->SetProperty(DBPROP_IStream, DBPROPSET_ROWSET, DBTYPE_BOOL, (void*)VARIANT_TRUE, dwPropOptions);

        //DBPROP_UNIQUEROWS
        //If the user has requested to display Hidden Columns then we need to set UniqueRows
        //Since hidden columns are only returned if UniqueRows==TRUE...
        if(GetOptions()->m_dwRowsetOpts & ROWSET_HIDDENCOLUMNS &&
          IsSettableProperty(m_pIDBProperties, DBPROP_UNIQUEROWS, DBPROPSET_ROWSET))
          pCPropSets->SetProperty(DBPROP_UNIQUEROWS, DBPROPSET_ROWSET, DBTYPE_BOOL, (void*)VARIANT_TRUE, DBPROPOPTIONS_REQUIRED/*DBPROPOPTIONS_OPTIONAL*/);
      }
    }

  }

  return S_OK;
}

HRESULT CDataSource::AutoRelease ( ) [virtual]

Reimplemented from CPropertiesBase.

Definition at line 74 of file cdatasource.cpp.

{
  //DataSource interfaces
  RELEASE_INTERFACE(IDBCreateSession);
  RELEASE_INTERFACE(IPersist);

  RELEASE_INTERFACE(IDBDataSourceAdmin);
  RELEASE_INTERFACE(IDBInfo);
  RELEASE_INTERFACE(IPersistFile);

  //Services
  RELEASE_INTERFACE(IServiceProvider);

  //Extra interfaces

  //Properties
  m_cstrDataSource.Empty();
  m_cstrDBMS.Empty();
  m_cstrDBMSVer.Empty();
  m_cstrProviderName.Empty();
  m_cstrProviderDesc.Empty();

  //Delegate
  return CPropertiesBase::AutoRelease();
}

HRESULT CDataSource::Connect | ( | HWND | hWnd,
 |  | CDataSource * | pCDataSource = NULL |
 | ) |  |  | [virtual]

Definition at line 185 of file datasource.cpp.

{
  ASSERT(hWnd);

  HRESULT       hr;
  ULONG               cPropSets = 0;
  DBPROPSET*      rgPropSets = NULL;

  IDBProperties*    pIDBProperties = NULL;
  IDBCreateSession*   pIDBCreateSession = NULL;

  //Local interface pointers, until we have a connection
  IDBInitialize*    pIDBInitialize = NULL;
  IOpenRowset*    pIOpenRowset = NULL;
  IDBCreateCommand*   pIDBCreateCommand = NULL;
  ICommandText*   pICommandText = NULL;

  ULONG chEaten = 0;
  IMoniker* pIMoniker = NULL;

  //if there is no provider chosen pick something from the enumerator
  if(pCDataSource == NULL)
  {
    //if there is an enumerator
    if (m_pIParseDisplayName)
    {
      //Get the IDBInitalize interface
      //Could just do a CoCreateInstance on the Provider CLSID, but since were using
      //The enumerator, we can be a more general app by using IParseDisplayName
      ASSERT(m_pwszProviderParseName);
      XTESTC(hr = m_pIParseDisplayName->ParseDisplayName(NULL, m_pwszProviderParseName, &chEaten, &pIMoniker));
      XTESTC(hr = BindMoniker(pIMoniker, 0, IID_IDBInitialize, (void**)&pIDBInitialize));
    }
    else
    {
      //if there is no ParseDisplay name there was no enumerator
      //so let try whatever the user typed in if something was typed in
      if (m_pwszProviderName)
      {
        CLSID clsid;
        hr = CLSIDFromProgID(m_pwszProviderName, &clsid);

        if(SUCCEEDED(hr))
        {
          XTESTC(hr = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, IID_IDBInitialize, (void**)&pIDBInitialize));
        }
      }
    }
  }
  else
  {
    //get what was chosen
    CLSID clsid;
    XTESTC(hr = CLSIDFromProgID(m_pwszProviderName, &clsid));
    if (S_OK  == hr)
    {
      XTESTC(hr = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, IID_IDBInitialize, (void**)&pIDBInitialize));
    }
    else
    {
      goto CLEANUP;
    }
  }

  //DBPROP_INIT_HWND
  if(IsSettableProperty(pIDBInitialize, DBPROP_INIT_HWND, DBPROPSET_DBINIT))
    SetProperty(DBPROP_INIT_HWND, DBPROPSET_DBINIT, &cPropSets, &rgPropSets, DBTYPE_I4, (LONG)hWnd);
  //DBPROP_INIT_PROMPT
  if(IsSettableProperty(pIDBInitialize, DBPROP_INIT_PROMPT, DBPROPSET_DBINIT))
    SetProperty(DBPROP_INIT_PROMPT, DBPROPSET_DBINIT, &cPropSets, &rgPropSets, DBTYPE_I2, DBPROMPT_COMPLETE);
  //DBPROP_INIT_MODE
  if(IsSettableProperty(pIDBInitialize, DBPROP_INIT_MODE, DBPROPSET_DBINIT))
    SetProperty(DBPROP_INIT_MODE, DBPROPSET_DBINIT, &cPropSets, &rgPropSets, DBTYPE_I4, DB_MODE_READWRITE | DB_MODE_SHARE_DENY_WRITE);

  //Set the DataSource Properties
  //IDBProperties is a MANDATORY interface, if error try and Initialize anyway
  XTEST(hr = pIDBInitialize->QueryInterface(IID_IDBProperties, (void **)&pIDBProperties));
  XTEST(hr = pIDBProperties->SetProperties(cPropSets, rgPropSets));

  //Initailize
  XTESTC(hr = pIDBInitialize->Initialize());

  //Get the Session Object
  XTESTC(hr = pIDBInitialize->QueryInterface(IID_IDBCreateSession, (void **)&pIDBCreateSession));

  //Create the SessionObject
  XTESTC(hr = pIDBCreateSession->CreateSession(NULL, IID_IOpenRowset, (IUnknown**)&pIOpenRowset));

  //Get the CommandText object - If supported
  if(SUCCEEDED(pIOpenRowset->QueryInterface(IID_IDBCreateCommand, (void**)&pIDBCreateCommand)))
    XTESTC(hr = pIDBCreateCommand->CreateCommand(NULL, IID_ICommandText, (IUnknown**)&pICommandText));

  //Do away with any previous connections
  Disconnect();

  //If we have made it this far, we are successfully connected,
  m_fConnected = TRUE;

  //Save the new connection interfaces
  SAFE_ADDREF(pIDBInitialize);
  m_pIDBInitialize = pIDBInitialize;

  SAFE_ADDREF(pIOpenRowset);
  m_pIOpenRowset  = pIOpenRowset;

  SAFE_ADDREF(pICommandText);
  m_pICommandText = pICommandText;

  //Obtain ITableDefinition/IIndexDefintion if supported
  pIOpenRowset->QueryInterface(IID_ITableDefinition, (void**)&m_pITableDefinition);
  pIOpenRowset->QueryInterface(IID_IIndexDefinition, (void**)&m_pIIndexDefinition);
  pIOpenRowset->QueryInterface(IID_IDBSchemaRowset,  (void**)&m_pIDBSchemaRowset);

  //Now get the connection properties
  QTESTC(hr = GetConnectionProps());

CLEANUP:
  FreeProperties(cPropSets, rgPropSets);

  //Release Interfaces
  SAFE_RELEASE(pIDBInitialize);
  SAFE_RELEASE(pIDBProperties);
  SAFE_RELEASE(pIDBCreateSession);
  SAFE_RELEASE(pIOpenRowset);
  SAFE_RELEASE(pIDBCreateCommand);
  SAFE_RELEASE(pICommandText);
  SAFE_RELEASE(pIMoniker);
  return hr;
}

HRESULT CDataSource::CreateSession | ( | CAggregate * | pCAggregate,
 |  | REFIID | riid,
 |  | IUnknown ** | ppIUnknown |
 | ) |  |  | [virtual]

Definition at line 231 of file cdatasource.cpp.

{
  HRESULT       hr = S_OK;

  if(m_pIDBCreateSession)
  {
    //CreateSession
    TEST(hr = m_pIDBCreateSession->CreateSession(pCAggregate, riid, ppIUnknown));
    TESTC(TRACE_METHOD(hr, L"IDBCreateSession::CreateSession(0x%p, %s, &0x%p)", pCAggregate, GetInterfaceName(riid), ppIUnknown ? *ppIUnknown : NULL));

    //Handle Aggregation
    if(pCAggregate)
      TESTC(hr = pCAggregate->HandleAggregation(riid, ppIUnknown));
  }

CLEANUP:
  return hr;
}

BOOL CDataSource::Disconnect ( ) [virtual]

Definition at line 152 of file datasource.cpp.

{
  //Interfaces
  SAFE_RELEASE(m_pIDBInitialize);
  SAFE_RELEASE(m_pIOpenRowset);
  SAFE_RELEASE(m_pIDBSchemaRowset);
  SAFE_RELEASE(m_pITableDefinition);
  SAFE_RELEASE(m_pIIndexDefinition);
  SAFE_RELEASE(m_pICommandText);

  //Properties
  SAFE_FREE(m_pwszCatalog);
  SAFE_FREE(m_pwszCatalogTerm);
  SAFE_FREE(m_pwszCatalogLocation);
  SAFE_FREE(m_pwszSchemaTerm);
  SAFE_FREE(m_pwszTableTerm);
  SAFE_FREE(m_pwszDataSource);
  SAFE_FREE(m_pwszDBMS);
  SAFE_FREE(m_pwszDBMSVer);

  SAFE_FREE(m_pwszProviderFileName);
  SAFE_FREE(m_pwszProviderVer);
  SAFE_FREE(m_pwszProviderOLEDBVer);

  m_fConnected = FALSE;
  return TRUE;
}

BOOL CDataSource::FInit ( void )

Definition at line 107 of file datasrc.cpp.

{
  // Instantiate the data conversion service object
  if( !g_pIDataConvert )
  {
    CoCreateInstance(CLSID_OLEDB_CONVERSIONLIBRARY,
             NULL,
             CLSCTX_INPROC_SERVER,
             IID_IDataConvert,
             (void **)&g_pIDataConvert);

    //
    // Tell the DC that we are 2.5
    //
    if( g_pIDataConvert )
    {
      DCINFO rgInfo[] = {{DCINFOTYPE_VERSION,{VT_UI4, 0, 0, 0, 0x0}}};
      IDCInfo *pIDCInfo = NULL;

      if( g_pIDataConvert->QueryInterface(IID_IDCInfo, (void **)&pIDCInfo) == S_OK &&
        pIDCInfo )
      {
        // OLE DB Version 02.50
        V_UI4(&rgInfo->vData) = 0x250;
        pIDCInfo->SetInfo(NUMELEM(rgInfo),rgInfo);
        pIDCInfo->Release();
      }
    }
  }
  else
    // Already instantiated, increment reference count
    g_pIDataConvert->AddRef();

    // Allocate properties management object
    m_pUtilProp = new CUtilProp();

    //Allocate contained interface objects
  //[MANDATORY]
    m_pIDBInitialize    = new CImpIDBInitialize( this, m_pUnkOuter );
    m_pIDBProperties  = new CImpIDBProperties( this, m_pUnkOuter );
    m_pIDBCreateSession = new CImpIDBCreateSession( this, m_pUnkOuter );

  //[OPTIONAL]
  m_pIDBInfo      = new CImpIDBInfo( this, m_pUnkOuter );
    m_pIPersist     = new CImpIPersist( this, m_pUnkOuter );
    m_pIServiceProvider = new CImpIServiceProvider( this, m_pUnkOuter );

    return (BOOL) (m_pUtilProp && m_pIDBInitialize && m_pIDBProperties &&
           m_pIDBCreateSession && m_pIDBInfo && m_pIPersist &&
           m_pIServiceProvider);
}

HRESULT CDataSource::GetClassID | ( | CLSID * | pclsid,
 |  | WCHAR ** | ppwszProgID = NULL |
 | ) |  |  | [virtual]

Definition at line 290 of file cdatasource.cpp.

{
  HRESULT hr = S_OK;
  WCHAR* pwszProgID = NULL;

  if(!m_pIPersist)
    return E_FAIL;

  //IPersist::GetClassID
  XTEST(hr = m_pIPersist->GetClassID(pclsid));

  //Obtain ProgID
  if(pclsid)
    pwszProgID = GetProgID(*pclsid);
  TESTC(TRACE_METHOD(hr, L"IPersist::GetClassID(%s)", pwszProgID));

CLEANUP:
  if(ppwszProgID)
    *ppwszProgID = pwszProgID;
  else
    SAFE_FREE(pwszProgID);
  return hr;
}

HRESULT CDataSource::GetConnectionProps ( ) [virtual]

Definition at line 322 of file datasource.cpp.

{
  HRESULT hr = S_OK;
  DWORD dwSqlSupport = 0;

  //DBPROP_CURRENTCATALOG
  hr = GetProperty(m_pIDBInitialize, DBPROP_CURRENTCATALOG,
              DBPROPSET_DATASOURCE, &m_pwszCatalog);

  //DBPROP_CATALOGTERM
  hr = GetProperty(m_pIDBInitialize, DBPROP_CATALOGTERM,
              DBPROPSET_DATASOURCEINFO, &m_pwszCatalogTerm);
  if(!m_pwszCatalogTerm[0])
  {
    SAFE_FREE(m_pwszCatalogTerm);
    m_pwszCatalogTerm = wcsDuplicate(L"Catalog");
  }

  //DBPROP_CATALOGLOCATION
  hr = GetProperty(m_pIDBInitialize, DBPROP_CATALOGLOCATION,
              DBPROPSET_DATASOURCEINFO, &m_pwszCatalogLocation);

  //DBPROP_SCHEMATERM
  hr = GetProperty(m_pIDBInitialize, DBPROP_SCHEMATERM,
              DBPROPSET_DATASOURCEINFO, &m_pwszSchemaTerm);
  if(!m_pwszSchemaTerm[0])
  {
    SAFE_FREE(m_pwszSchemaTerm);
    m_pwszSchemaTerm = wcsDuplicate(L"Schema");
  }

  //DBPROP_TABLETERM
  hr = GetProperty(m_pIDBInitialize, DBPROP_TABLETERM,
              DBPROPSET_DATASOURCEINFO, &m_pwszTableTerm);
  if(!m_pwszTableTerm[0])
  {
    SAFE_FREE(m_pwszTableTerm);
    m_pwszTableTerm = wcsDuplicate(L"Table");
  }

  //DBPROP_ACTIVESESSIONS
  hr = GetProperty(m_pIDBInitialize, DBPROP_ACTIVESESSIONS,
              DBPROPSET_DATASOURCEINFO, &m_ulActiveSessions);

  //DBPROP_DATASOURCENAME
  hr = GetProperty(m_pIDBInitialize, DBPROP_DATASOURCENAME,
              DBPROPSET_DATASOURCEINFO, &m_pwszDataSource);

  //DBPROP_DBMSNAME
  hr = GetProperty(m_pIDBInitialize, DBPROP_DBMSNAME,
              DBPROPSET_DATASOURCEINFO, &m_pwszDBMS);

  //DBPROP_DBMSVER
  hr = GetProperty(m_pIDBInitialize, DBPROP_DBMSVER,
              DBPROPSET_DATASOURCEINFO, &m_pwszDBMSVer);

  //DBPROP_DATASOURCEREADONLY
  hr = GetProperty(m_pIDBInitialize, DBPROP_DATASOURCEREADONLY,
              DBPROPSET_DATASOURCEINFO, &m_fReadOnly);

  //DBPROP_PROVIDERNAME
  hr = GetProperty(m_pIDBInitialize, DBPROP_PROVIDERNAME,
              DBPROPSET_DATASOURCEINFO, &m_pwszProviderFileName);

  //DBPROP_PROVIDERVER
  hr = GetProperty(m_pIDBInitialize, DBPROP_PROVIDERVER,
              DBPROPSET_DATASOURCEINFO, &m_pwszProviderVer);

  //DBPROP_PROVIDEROLEDBVER
  hr = GetProperty(m_pIDBInitialize, DBPROP_PROVIDEROLEDBVER,
              DBPROPSET_DATASOURCEINFO, &m_pwszProviderOLEDBVer);

  //DBPROP_MULTIPLEPARAMSETS
  hr = GetProperty(m_pIDBInitialize, DBPROP_MULTIPLEPARAMSETS,
              DBPROPSET_DATASOURCEINFO, &m_fMultipleParamSets);

  //DBPROP_STRUCTUREDSTORAGE
  hr = GetProperty(m_pIDBInitialize, DBPROP_STRUCTUREDSTORAGE,
              DBPROPSET_DATASOURCEINFO, &m_dwStorageObjects);

  //DBPROP_SQLSUPPORT
  hr = GetProperty(m_pIDBInitialize, DBPROP_SQLSUPPORT,
              DBPROPSET_DATASOURCEINFO, &dwSqlSupport);

  //Are PrimaryKeys supported
  m_fPrimaryKeysSupported = dwSqlSupport & DBPROPVAL_SQL_ANSI89_IEF;

  //DBPROP_IRowsetChange
  m_fIRowsetChange = FALSE;
  if(IsSupportedProperty(m_pIDBInitialize, DBPROP_IRowsetChange, DBPROPSET_ROWSET))
    m_fIRowsetChange = TRUE;

  //DBPROP_IRowsetUpdate
  m_fIRowsetUpdate = FALSE;
  if(IsSupportedProperty(m_pIDBInitialize, DBPROP_IRowsetUpdate, DBPROPSET_ROWSET))
    m_fIRowsetUpdate = TRUE;

  return S_OK;
}

virtual REFIID CDataSource::GetDefaultInterface ( ) [inline, virtual]

Implements CBase.

Definition at line 40 of file cdatasource.h.

{ return IID_IDBProperties;     }

WCHAR* CDataSource::GetFilePath ( void ) [inline]

Definition at line 100 of file datasrc.h.

{ return m_wszPath; };

IUnknown ** CDataSource::GetInterfaceAddress ( REFIID riid ) [virtual]

Reimplemented from CPropertiesBase.

Definition at line 55 of file cdatasource.cpp.

{
  HANDLE_GETINTERFACE(IDBCreateSession);
  HANDLE_GETINTERFACE(IPersist);
  HANDLE_GETINTERFACE(IDBDataSourceAdmin);
  HANDLE_GETINTERFACE(IDBInfo);
  HANDLE_GETINTERFACE(IPersistFile);
  HANDLE_GETINTERFACE(IServiceProvider);

  //Otherwise delegate
  return CPropertiesBase::GetInterfaceAddress(riid);
}

WCHAR * CDataSource::GetObjectDesc ( ) [virtual]

Reimplemented from CBase.

Definition at line 215 of file cdatasource.cpp.

{
  if(!m_strObjectDesc && m_pIPersist)
  {
    CLSID clsid;
    GetClassID(&clsid, &m_strObjectDesc);
  }

  return m_strObjectDesc;
}

virtual LONG CDataSource::GetObjectImage ( ) [inline, virtual]

Implements CBase.

Definition at line 43 of file cdatasource.h.

{ return IMAGE_DATASOURCE;      }

virtual UINT CDataSource::GetObjectMenu ( ) [inline, virtual]

Implements CBase.

Definition at line 39 of file cdatasource.h.

{ return IDM_DATASOURCEMENU;    }

virtual WCHAR* CDataSource::GetObjectName ( ) [inline, virtual]

Implements CBase.

Definition at line 38 of file cdatasource.h.

{ return L"DataSource";       }

HRESULT CDataSource::GetProviders ( ) [virtual]

Definition at line 428 of file datasource.cpp.

{
  HRESULT hr;

  HROW* rghRows = NULL;
  ULONG cRowsObtained = 0;
  IRowset* pIRowset = NULL;

  IAccessor* pIAccessor = NULL;
  HACCESSOR hAccessor = DB_NULL_HACCESSOR;

  //Release Previous ProviderInfo
  m_cProviderInfo = 0;
  SAFE_FREE(m_rgProviderInfo);
  ISourcesRowset* pISourcesRowset = NULL;

  // Bind the user and table name for the list
  const static ULONG cBindings = 4;
  const static DBBINDING rgBindings[cBindings] =
    {
      1,
      offsetof(PROVIDERINFO, wszName),
      0,
      0,
      NULL,
      NULL,
      NULL,
      DBPART_VALUE,
      DBMEMOWNER_CLIENTOWNED,
      DBPARAMIO_NOTPARAM,
      MAX_NAME_LEN,
      0,
      DBTYPE_WSTR,
      0,
      0,

      2,
      offsetof(PROVIDERINFO, wszParseName),
      0,
      0,
      NULL,
      NULL,
      NULL,
      DBPART_VALUE,
      DBMEMOWNER_CLIENTOWNED,
      DBPARAMIO_NOTPARAM,
      MAX_NAME_LEN,
      0,
      DBTYPE_WSTR,
      0,
      0,

      3,
      offsetof(PROVIDERINFO, wszDescription),
      0,
      0,
      NULL,
      NULL,
      NULL,
      DBPART_VALUE,
      DBMEMOWNER_CLIENTOWNED,
      DBPARAMIO_NOTPARAM,
      MAX_NAME_LEN,
      0,
      DBTYPE_WSTR,
      0,
      0,

      4,
      offsetof(PROVIDERINFO, wType),
      0,
      0,
      NULL,
      NULL,
      NULL,
      DBPART_VALUE,
      DBMEMOWNER_CLIENTOWNED,
      DBPARAMIO_NOTPARAM,
      sizeof(DBTYPE),
      0,
      DBTYPE_UI2,
      0,
      0,
  };

  //Initialize the OLE DB Enumerator and Obtain rowset
  hr = CoCreateInstance(CLSID_OLEDB_ENUMERATOR, NULL, CLSCTX_INPROC_SERVER, IID_ISourcesRowset, (void**)&pISourcesRowset);
  if (REGDB_E_CLASSNOTREG == hr)
  {
    //if there is no enumerator, horse'em

    //Alloc room for ProviderInfo
    m_cProviderInfo++;
    SAFE_REALLOC(m_rgProviderInfo, PROVIDERINFO, m_cProviderInfo);
    memset(&m_rgProviderInfo[0], 0, sizeof(PROVIDERINFO));

    wcscpy(m_rgProviderInfo[0].wszName,L"MSDASQL");
    wcscpy(m_rgProviderInfo[0].wszParseName,L"{c8b522cb-5cf3-11ce-ade5-00aa0044773d}");
    wcscpy(m_rgProviderInfo[0].wszDescription,L"Microsoft OLE DB Provider for ODBC Drivers");
    m_rgProviderInfo[0].wType = DBSOURCETYPE_DATASOURCE;

    return hr;
  }

  XTESTC(hr);
  XTESTC(hr = pISourcesRowset->GetSourcesRowset(NULL, IID_IRowset, 0, NULL, (IUnknown**)&pIRowset));

  //Create Accessor
  XTESTC(hr = pIRowset->QueryInterface(IID_IAccessor, (void **)&pIAccessor));
  XTESTC(hr = pIAccessor->CreateAccessor(DBACCESSOR_ROWDATA, cBindings, rgBindings, 0, &hAccessor, NULL));

  //Obtain IParseDisplayName interface
  XTESTC(hr = pISourcesRowset->QueryInterface(IID_IParseDisplayName, (void**)&m_pIParseDisplayName));

  //Loop through the entire returned rowet
  while(TRUE)
  {
    XTESTC(hr = pIRowset->GetNextRows(NULL, 0, MAX_BLOCK_SIZE, &cRowsObtained, &rghRows));

    //ENDOFROWSET
    if(cRowsObtained==0)
      break;

    //Alloc room for ProviderInfo (in chunks)
    SAFE_REALLOC(m_rgProviderInfo, PROVIDERINFO, m_cProviderInfo + cRowsObtained);
    memset(&m_rgProviderInfo[m_cProviderInfo], 0, sizeof(PROVIDERINFO)*cRowsObtained);

    //Loop over rows obtained and get ProviderInfo
    for(ULONG i=0; i<cRowsObtained; i++)
    {
      //Get the Data
      XTESTC(hr = pIRowset->GetData(rghRows[i], hAccessor, (void*)&m_rgProviderInfo[m_cProviderInfo]));

      //Only interested in DATASOURCEs, not other ENUMERATORs
      if(m_rgProviderInfo[m_cProviderInfo].wType == DBSOURCETYPE_DATASOURCE)
        m_cProviderInfo++;
    }

    //Release all the rows
    XTESTC(hr = pIRowset->ReleaseRows(cRowsObtained, rghRows, NULL, NULL, NULL));
    SAFE_FREE(rghRows);
  }

CLEANUP:
  if(hAccessor && pIAccessor)
    XTEST(pIAccessor->ReleaseAccessor(hAccessor,NULL));

  SAFE_RELEASE(pISourcesRowset);
  SAFE_RELEASE(pIRowset);
  SAFE_RELEASE(pIAccessor);
  SAFE_FREE(rghRows);
  return hr;
}

BOOL CDataSource::IsConnected ( ) [virtual]

Definition at line 89 of file datasource.cpp.

{
  return m_fConnected;
}

BOOL CDataSource::IsEqual ( CDataSource * pCDataSource ) [virtual]

Definition at line 123 of file datasource.cpp.

{
  ASSERT(pCDataSource);

  //Must be Connected to compare
  if(!IsConnected() || !pCDataSource->IsConnected())
    return FALSE;

  ASSERT(m_pwszCatalog && pCDataSource->m_pwszCatalog);
  ASSERT(m_pwszDBMS && pCDataSource->m_pwszDBMS);
  ASSERT(m_pwszDBMSVer && pCDataSource->m_pwszDBMSVer);

  //Equal:
  //Must have same Catalog, DBMS, Version
  //Note, Don't have to have the same DataSource Name (an access
  //database can have multiple names for the same file)
  if(wcscmp(m_pwszCatalog, pCDataSource->m_pwszCatalog)==0 &&
    wcscmp(m_pwszDBMS, pCDataSource->m_pwszDBMS)==0 &&
    wcscmp(m_pwszDBMSVer, pCDataSource->m_pwszDBMSVer)==0)
    return TRUE;

  return FALSE;
}

BOOL CDataSource::IsSimilar ( CDataSource * pCDataSource ) [virtual]

Definition at line 99 of file datasource.cpp.

{
  ASSERT(pCDataSource);

  //Must be Connected to compare
  if(!IsConnected() || !pCDataSource->IsConnected())
    return FALSE;

  ASSERT(m_pwszDBMS && pCDataSource->m_pwszDBMS);
  ASSERT(m_pwszDBMSVer && pCDataSource->m_pwszDBMSVer);

  //Similiar: Must be the same DBMS and Version
  if(wcscmp(m_pwszDBMS, pCDataSource->m_pwszDBMS)==0 &&
    wcscmp(m_pwszDBMSVer, pCDataSource->m_pwszDBMSVer)==0)
    return TRUE;

  return FALSE;
}

HRESULT CDataSource::OpenFile | ( | WCHAR * | pwszFileName,
 |  | CFileIO ** | ppCFileIO
 | ) |  |

Definition at line 265 of file datasrc.cpp.

{
  ASSERT(ppCFileIO);
  HRESULT hr = S_OK;
  WCHAR wszFullPath[_MAX_PATH + _MAX_PATH + 1]={0};
  CHAR  szFullPath[_MAX_PATH + _MAX_PATH + 1]={0};

  //open and initialize a file object
  CFileIO* pCFileIO = new CFileIO();
  if(!pCFileIO)
    return E_OUTOFMEMORY;

  //Do we have a base directory
  if(m_wszPath[0])
  {
    //Contruct the filename
    wcsncat(wszFullPath, m_wszPath, wcslen(m_wszPath));
    wcsncat(wszFullPath, L"\\", wcslen(L"\\"));
    wcsncat(wszFullPath, pwszFileName,
        (_MAX_PATH + _MAX_PATH - wcslen(wszFullPath)));

    //Convert to MBCS (stream operations)
    ConvertToMBCS(wszFullPath, szFullPath, _MAX_PATH+_MAX_PATH);

    //Now try to initialize the stream, if successful we are done...
    if(SUCCEEDED(hr = pCFileIO->fInit(  szFullPath )))
      goto CLEANUP;
  }

  //Otherwise its a full filename...
  ConvertToMBCS(pwszFileName, szFullPath, _MAX_PATH+_MAX_PATH);

  //Now try to initialize the stream...
  hr = pCFileIO->fInit(  szFullPath );

CLEANUP:
  if(FAILED( hr ))
    SAFE_DELETE( pCFileIO );
  *ppCFileIO = pCFileIO;
  return hr;
}

STDMETHODIMP CDataSource::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 174 of file datasrc.cpp.

{
    // Is the pointer bad?
    if (ppv == NULL)
        return ResultFromScode( E_INVALIDARG );

    //  Place NULL in *ppv in case of failure
    *ppv = NULL;

    //  This is the non-delegating IUnknown implementation
    if (riid == IID_IUnknown)
        *ppv = (LPVOID) this;
    else if (riid == IID_IDBInitialize)
        *ppv = (LPVOID) m_pIDBInitialize;
  else if (riid == IID_IDBProperties)
        *ppv = (LPVOID) m_pIDBProperties;
    else if (riid == IID_IPersist)
        *ppv = (LPVOID) m_pIPersist;
  else if (riid == IID_IServiceProvider)
    *ppv = (LPVOID) m_pIServiceProvider;
  else
  {
    // These are not valid at Uninit state.
    if( riid == IID_IDBCreateSession )
      *ppv = (LPVOID)m_pIDBCreateSession;
    else if (riid == IID_IDBInfo)
      *ppv = (LPVOID) m_pIDBInfo;

    // Special case for uninitialized.
    if( *ppv && !m_fDSOInitialized )
    {
      *ppv = NULL;
      return ResultFromScode( E_UNEXPECTED );
    }
  }

    //  If we're going to return an interface, AddRef it first
    if (*ppv)
        {
        ((LPUNKNOWN) *ppv)->AddRef();
        return ResultFromScode( S_OK );
        }
    else
        return ResultFromScode( E_NOINTERFACE );
}

VOID CDataSource::RemoveSession ( void ) [inline]

Definition at line 98 of file datasrc.h.

{ m_fDBSessionCreated = FALSE; }

CDataSource::STDMETHODIMP_ ( DBREFCOUNT )
CDataSource::STDMETHODIMP_ ( DBREFCOUNT )

Friends And Related Function Documentation

friend class CDBSession [friend]

Definition at line 51 of file datasrc.h.

friend class CImpIDBCreateSession [friend]

Definition at line 48 of file datasrc.h.

friend class CImpIDBInfo [friend]

Definition at line 46 of file datasrc.h.

friend class CImpIDBInitialize [friend]

Definition at line 45 of file datasrc.h.

friend class CImpIDBProperties [friend]

Definition at line 47 of file datasrc.h.

friend class CImpIPersist [friend]

Definition at line 49 of file datasrc.h.

friend class CImpIServiceProvider [friend]

Definition at line 50 of file datasrc.h.

Member Data Documentation

ULONG CDataSource::m_cProviderInfo

Definition at line 85 of file datasource.h.

DBREFCOUNT CDataSource::m_cRef [protected]

Reimplemented from CBase.

Definition at line 55 of file datasrc.h.

CComBSTR CDataSource::m_cstrDataSource

Definition at line 69 of file cdatasource.h.

CComBSTR CDataSource::m_cstrDBMS

Definition at line 70 of file cdatasource.h.

CComBSTR CDataSource::m_cstrDBMSVer

Definition at line 71 of file cdatasource.h.

CComBSTR CDataSource::m_cstrProviderDesc

Definition at line 74 of file cdatasource.h.

CComBSTR CDataSource::m_cstrProviderName

Definition at line 73 of file cdatasource.h.

ULONG CDataSource::m_dwStorageObjects

Definition at line 94 of file datasource.h.

BOOL CDataSource::m_fConnected

Definition at line 96 of file datasource.h.

BOOL CDataSource::m_fDBSessionCreated [protected]

Definition at line 61 of file datasrc.h.

BOOL CDataSource::m_fDSOInitialized [protected]

Definition at line 59 of file datasrc.h.

BOOL CDataSource::m_fIRowsetChange

Definition at line 92 of file datasource.h.

BOOL CDataSource::m_fIRowsetUpdate

Definition at line 93 of file datasource.h.

BOOL CDataSource::m_fMultipleParamSets

Definition at line 91 of file datasource.h.

BOOL CDataSource::m_fPrimaryKeysSupported

Definition at line 90 of file datasource.h.

BOOL CDataSource::m_fReadOnly

Definition at line 89 of file datasource.h.

LONG CDataSource::m_lDataSourceType

Definition at line 75 of file cdatasource.h.

ICommandText* CDataSource::m_pICommandText

Definition at line 60 of file datasource.h.

PIMPIDBCREATESESSION CDataSource::m_pIDBCreateSession [protected]

Definition at line 71 of file datasrc.h.

IDBCreateSession* CDataSource::m_pIDBCreateSession

Definition at line 57 of file cdatasource.h.

IDBDataSourceAdmin* CDataSource::m_pIDBDataSourceAdmin

Definition at line 61 of file cdatasource.h.

IDBInfo* CDataSource::m_pIDBInfo

Definition at line 62 of file cdatasource.h.

PIMPIDBINFO CDataSource::m_pIDBInfo [protected]

Definition at line 69 of file datasrc.h.

IDBInitialize* CDataSource::m_pIDBInitialize

Reimplemented from CAsynchBase.

Definition at line 55 of file datasource.h.

PIMPIDBINITIALIZE CDataSource::m_pIDBInitialize [protected]

Reimplemented from CAsynchBase.

Definition at line 65 of file datasrc.h.

PIMPIDBProperties CDataSource::m_pIDBProperties [protected]

Reimplemented from CPropertiesBase.

Definition at line 67 of file datasrc.h.

IDBSchemaRowset* CDataSource::m_pIDBSchemaRowset

Definition at line 57 of file datasource.h.

IIndexDefinition* CDataSource::m_pIIndexDefinition

Definition at line 59 of file datasource.h.

IOpenRowset* CDataSource::m_pIOpenRowset

Definition at line 56 of file datasource.h.

IParseDisplayName* CDataSource::m_pIParseDisplayName

Definition at line 62 of file datasource.h.

IPersist* CDataSource::m_pIPersist

Definition at line 58 of file cdatasource.h.

CImpIPersist* CDataSource::m_pIPersist [protected]

Definition at line 73 of file datasrc.h.

IPersistFile* CDataSource::m_pIPersistFile

Definition at line 63 of file cdatasource.h.

CImpIServiceProvider* CDataSource::m_pIServiceProvider [protected]

Definition at line 75 of file datasrc.h.

IServiceProvider* CDataSource::m_pIServiceProvider

Definition at line 66 of file cdatasource.h.

ITableDefinition* CDataSource::m_pITableDefinition

Definition at line 58 of file datasource.h.

LPUNKNOWN CDataSource::m_pUnkOuter

Definition at line 87 of file datasrc.h.

PCUTILPROP CDataSource::m_pUtilProp [protected]

Definition at line 63 of file datasrc.h.

WCHAR* CDataSource::m_pwszCatalog

Definition at line 65 of file datasource.h.

WCHAR* CDataSource::m_pwszCatalogLocation

Definition at line 67 of file datasource.h.

WCHAR* CDataSource::m_pwszCatalogTerm

Definition at line 66 of file datasource.h.

WCHAR* CDataSource::m_pwszDataSource

Definition at line 73 of file datasource.h.

WCHAR* CDataSource::m_pwszDBMS

Definition at line 74 of file datasource.h.

WCHAR* CDataSource::m_pwszDBMSVer

Definition at line 75 of file datasource.h.

WCHAR* CDataSource::m_pwszProviderFileName

Definition at line 80 of file datasource.h.

WCHAR* CDataSource::m_pwszProviderName

Definition at line 78 of file datasource.h.

WCHAR* CDataSource::m_pwszProviderOLEDBVer

Definition at line 82 of file datasource.h.

WCHAR* CDataSource::m_pwszProviderParseName

Definition at line 79 of file datasource.h.

WCHAR* CDataSource::m_pwszProviderVer

Definition at line 81 of file datasource.h.

WCHAR* CDataSource::m_pwszSchemaTerm

Definition at line 68 of file datasource.h.

WCHAR* CDataSource::m_pwszTableTerm

Definition at line 69 of file datasource.h.

PROVIDERINFO* CDataSource::m_rgProviderInfo

Definition at line 86 of file datasource.h.

ULONG CDataSource::m_ulActiveSessions

Definition at line 72 of file datasource.h.

WCHAR CDataSource::m_wszPath[MAX_PATH] [protected]

Definition at line 57 of file datasrc.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdatasource.h
  • Dataaccess/oledb/sampprov/datasrc.h
  • Dataaccess/oledb/tablecopy/datasource.h
  • Dataaccess/oledb/rowsetviewer/cdatasource.cpp
  • Dataaccess/oledb/sampprov/datasrc.cpp
  • Dataaccess/oledb/tablecopy/datasource.cpp
Generated on Wed Nov 13 2024 16:56:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDataXferObj Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes

CDataXferObj Class Reference

#include "dxferObj.h"

List of all members.

Public Member Functions

STDMETHODIMP | DAdvise (FORMATETC FAR *pFormatetc, DWORD advf, LPADVISESINK pAdvSink, DWORD FAR *pdwConnection)
STDMETHODIMP | DUnadvise (DWORD dwConnection)
STDMETHODIMP | EnumDAdvise (LPENUMSTATDATA FAR *ppenumAdvise)
STDMETHODIMP | EnumFormatEtc (DWORD dwDirection, LPENUMFORMATETC FAR *ppenumFormatEtc)
STDMETHODIMP | GetCanonicalFormatEtc (LPFORMATETC pformatetc, LPFORMATETC pformatetcOut)
STDMETHODIMP | GetData (LPFORMATETC pformatetcIn, LPSTGMEDIUM pmedium)
STDMETHODIMP | GetDataHere (LPFORMATETC pformatetc, LPSTGMEDIUM pmedium)
STDMETHODIMP | QueryGetData (LPFORMATETC pformatetc)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID FAR *ppvObj)
STDMETHODIMP | SetData (LPFORMATETC pformatetc, STGMEDIUM FAR *pmedium, BOOL fRelease)
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()

Static Public Member Functions

static CDataXferObj FAR * | Create (CSimpleSite FAR *lpSite, POINTL FAR *pPointl)

Private Member Functions

CDataXferObj ()
~CDataXferObj ()

Private Attributes

LPSTORAGE | m_lpObjStorage
LPOLEOBJECT | m_lpOleObject
int | m_nCount
POINTL | m_pointl
SIZEL | m_sizel

Detailed Description

Definition at line 16 of file dxferObj.h.

Constructor & Destructor Documentation

CDataXferObj::CDataXferObj ( void ) [private]

Definition at line 141 of file dxferObj.Cpp.

{
        // clear the reference count
        m_nCount = 0;

        m_lpObjStorage = NULL;
        m_lpOleObject = NULL;
        m_sizel.cx = m_sizel.cy = 0;
        m_pointl.x = m_pointl.y = 0;
}

CDataXferObj::~CDataXferObj ( ) [private]

Definition at line 179 of file dxferObj.Cpp.

{
        OutputDebugString ("In CDataXferObj's Destructor \r\n");

        if (m_lpOleObject)
           {
           m_lpOleObject->Release();
           m_lpOleObject = NULL;

           // Release the storage for this object
           m_lpObjStorage->Release();
           m_lpObjStorage = NULL;
           }
}

Member Function Documentation

CDataXferObj FAR * CDataXferObj::Create | ( | CSimpleSite FAR * | lpSite,
 |  | POINTL FAR * | pPointl |
 | ) |  |  | [static]

Definition at line 62 of file dxferObj.Cpp.

{
        CDataXferObj FAR * lpTemp = new CDataXferObj();

        if (!lpTemp)
                return NULL;

        // create a sub-storage for the object
        HRESULT hErr = StgCreateDocfile(
                                NULL,
                                STGM_READWRITE | STGM_DIRECT | STGM_SHARE_EXCLUSIVE |
                                        STGM_DELETEONRELEASE,
                                0,
                                &lpTemp->m_lpObjStorage);

        assert(hErr == NOERROR);

        if (hErr != NOERROR)
                {
                delete lpTemp;
                return NULL;
                }

        // Clone the source object
        if (lpSite->m_lpOleObject) {
                // Object is loaded; ask the object to save into the new storage
                LPPERSISTSTORAGE pPersistStorage;

                lpSite->m_lpOleObject->QueryInterface(IID_IPersistStorage,
                                (LPVOID FAR*)&pPersistStorage);
                assert(pPersistStorage);
                OleSave(pPersistStorage, lpTemp->m_lpObjStorage, FALSE);

                // pass NULL so that object application won't forget the real stg
                pPersistStorage->SaveCompleted(NULL);
                pPersistStorage->Release();
        } else {
                // Object not loaded so use cheaper IStorage CopyTo operation
                lpSite->m_lpObjStorage->CopyTo(0, NULL, NULL, lpTemp->m_lpObjStorage);
        }

        OleLoad(lpTemp->m_lpObjStorage, IID_IOleObject, NULL,
                        (LPVOID FAR*)&lpTemp->m_lpOleObject);
        assert(lpTemp->m_lpOleObject);

        lpTemp->m_sizel = lpSite->m_sizel;
        if (pPointl)
                lpTemp->m_pointl = *pPointl;
        else
                lpTemp->m_pointl.x = lpTemp->m_pointl.y = 0;
        return lpTemp;
}

STDMETHODIMP CDataXferObj::DAdvise | ( | FORMATETC FAR * | pFormatetc,
 |  | DWORD | advf,
 |  | LPADVISESINK | pAdvSink,
 |  | DWORD FAR * | pdwConnection |
 | ) |  |  | [inline]

Definition at line 34 of file dxferObj.h.

    { return ResultFromScode(OLE_E_ADVISENOTSUPPORTED); }

STDMETHODIMP CDataXferObj::DUnadvise ( DWORD dwConnection ) [inline]

Definition at line 37 of file dxferObj.h.

    { return ResultFromScode(OLE_E_ADVISENOTSUPPORTED); }

STDMETHODIMP CDataXferObj::EnumDAdvise ( LPENUMSTATDATA FAR * ppenumAdvise ) [inline]

Definition at line 39 of file dxferObj.h.

    { return ResultFromScode(OLE_E_ADVISENOTSUPPORTED); }

STDMETHODIMP CDataXferObj::EnumFormatEtc | ( | DWORD | dwDirection,
 |  | LPENUMFORMATETC FAR * | ppenumFormatEtc
 | ) |  |

Definition at line 387 of file dxferObj.Cpp.

{
        SCODE sc = E_NOTIMPL;

        OutputDebugString("In CDataXferObj::EnumFormatEtc\r\n");
        *ppenumFormatEtc = NULL;

        if (dwDirection == DATADIR_GET) {
                *ppenumFormatEtc = OleStdEnumFmtEtc_Create(
                                sizeof(s_arrGetFmtEtcs)/sizeof(s_arrGetFmtEtcs[0]),
                                s_arrGetFmtEtcs);
                if (*ppenumFormatEtc == NULL)
                        sc = E_OUTOFMEMORY;
                else
                        sc = S_OK;
        }
        return sc;
}

STDMETHODIMP CDataXferObj::GetCanonicalFormatEtc | ( | LPFORMATETC | pformatetc,
 |  | LPFORMATETC | pformatetcOut |
 | ) |  |  | [inline]

Definition at line 43 of file dxferObj.h.

    { pformatetcOut->ptd = NULL; return ResultFromScode(E_NOTIMPL); }

STDMETHODIMP CDataXferObj::GetData | ( | LPFORMATETC | pformatetcIn,
 |  | LPSTGMEDIUM | pmedium
 | ) |  |

Definition at line 445 of file dxferObj.Cpp.

{
        SCODE sc = DV_E_FORMATETC;

        OutputDebugString("In CDataXferObj::GetData\r\n");

        // we must set all out pointer parameters to NULL. */
        pmedium->tymed = TYMED_NULL;
        pmedium->pUnkForRelease = NULL;    // we transfer ownership to caller
        pmedium->hGlobal = NULL;

        // Check the FORMATETC and fill pmedium if valid.
        if ( (pformatetcIn->cfFormat == g_cfEmbeddedObject) &&
                 (pformatetcIn->dwAspect == DVASPECT_CONTENT) &&
                 (pformatetcIn->tymed == TYMED_ISTORAGE) ) {
                 LPPERSISTSTORAGE pPersistStorage;

                 /* render CF_EMBEDDEDOBJECT by asking the object to save
                 **    into a temporary, DELETEONRELEASE IStorage allocated by us.
                 */
                 m_lpOleObject->QueryInterface(
                                 IID_IPersistStorage, (LPVOID FAR*)&pPersistStorage);
                 assert(pPersistStorage);
                 HRESULT hrErr = OleStdGetOleObjectData(
                                        pPersistStorage,
                                        pformatetcIn,
                                        pmedium,
                                        FALSE   /* fUseMemory -- (use file-base stg) */
                 );
                 pPersistStorage->Release();
                 sc =  hrErr ;

        } else if ( (pformatetcIn->cfFormat == g_cfObjectDescriptor) &&
                 (pformatetcIn->dwAspect == DVASPECT_CONTENT) &&
                 (pformatetcIn->tymed == TYMED_HGLOBAL) ) {

                 // render CF_OBJECTDESCRIPTOR data
                 pmedium->hGlobal = OleStdGetObjectDescriptorDataFromOleObject(
                                 m_lpOleObject,
                                 //@@WTK WIN32, UNICODE
                                 //"Simple OLE 2.0 Container",    // string to identify source
                                 OLESTR("Simple OLE 2.0 Container"),    // string to identify source
                                 DVASPECT_CONTENT,
                                 m_pointl,
                                 (LPSIZEL)&m_sizel
                        );
                 if (! pmedium->hGlobal)
                         sc = E_OUTOFMEMORY;
                 else {
                         pmedium->tymed = TYMED_HGLOBAL;
                         sc = S_OK;
                 }

        } else if ( (pformatetcIn->cfFormat == CF_METAFILEPICT) &&
                 (pformatetcIn->dwAspect == DVASPECT_CONTENT) &&
                 (pformatetcIn->tymed == TYMED_MFPICT) ) {

                 // render CF_METAFILEPICT by drawing the object into a metafile DC
                 pmedium->hGlobal = OleStdGetMetafilePictFromOleObject(
                                 m_lpOleObject, DVASPECT_CONTENT, NULL, pformatetcIn->ptd);
                 if (! pmedium->hGlobal)
                         sc = E_OUTOFMEMORY;
                 else {
                         pmedium->tymed = TYMED_MFPICT;
                         sc = S_OK;
                 }
        }

        return  sc ;
}

STDMETHODIMP CDataXferObj::GetDataHere | ( | LPFORMATETC | pformatetc,
 |  | LPSTGMEDIUM | pmedium
 | ) |  |

Definition at line 547 of file dxferObj.Cpp.

{
        SCODE sc = DV_E_FORMATETC;

        OutputDebugString("In CDataXferObj::GetDataHere\r\n");

        // NOTE: pmedium is an IN parameter. we should NOT set
        //           pmedium->pUnkForRelease to NULL

        // Check the FORMATETC and fill pmedium if valid.
        if ( (pformatetc->cfFormat == g_cfEmbeddedObject) &&
                 (pformatetc->dwAspect == DVASPECT_CONTENT) &&
                 (pformatetc->tymed == TYMED_ISTORAGE) ) {
                 LPPERSISTSTORAGE pPersistStorage;

                 /* render CF_EMBEDDEDOBJECT by asking the object to save
                 **    into the IStorage allocated by the caller.
                 */
                 m_lpOleObject->QueryInterface(
                                 IID_IPersistStorage, (LPVOID FAR*)&pPersistStorage);
                 assert(pPersistStorage);
                 HRESULT hrErr = OleStdGetOleObjectData(
                                 pPersistStorage, pformatetc, pmedium,0 /*fUseMemory--N/A*/ );
                 pPersistStorage->Release();
                 sc =  hrErr ;
        }
        return  sc ;
}

STDMETHODIMP CDataXferObj::QueryGetData ( LPFORMATETC pformatetc )

Definition at line 360 of file dxferObj.Cpp.

{
        SCODE sc = DV_E_FORMATETC;

        OutputDebugString("In CDataXferObj::QueryGetData\r\n");

        // check the validity of the formatetc.

        if ( (pformatetc->cfFormat == g_cfEmbeddedObject) &&
                 (pformatetc->dwAspect == DVASPECT_CONTENT) &&
                 (pformatetc->tymed == TYMED_ISTORAGE) )
                sc = S_OK;

        else if ( (pformatetc->cfFormat == g_cfObjectDescriptor) &&
                 (pformatetc->dwAspect == DVASPECT_CONTENT) &&
                 (pformatetc->tymed == TYMED_HGLOBAL) )
                sc = S_OK;

        else if ( (pformatetc->cfFormat == CF_METAFILEPICT) &&
                 (pformatetc->dwAspect == DVASPECT_CONTENT) &&
                 (pformatetc->tymed == TYMED_MFPICT) )
                sc = S_OK;

        return sc;
}

STDMETHODIMP CDataXferObj::QueryInterface | ( | REFIID | riid,
 |  | LPVOID FAR * | ppvObj
 | ) |  |

Definition at line 230 of file dxferObj.Cpp.

{
        OutputDebugString("In CDataXferObj::QueryInterface\r\n");

        if ( riid == IID_IUnknown || riid == IID_IDataObject)
                {
                AddRef();
                *ppvObj = this;
                return NOERROR;
                }

        // unknown interface requested
        *ppvObj = NULL;     // must set out pointer parameters to NULL
        return E_NOINTERFACE;
}

STDMETHODIMP CDataXferObj::SetData | ( | LPFORMATETC | pformatetc,
 |  | STGMEDIUM FAR * | pmedium,
 |  | BOOL | fRelease |
 | ) |  |  | [inline]

Definition at line 49 of file dxferObj.h.

    { return ResultFromScode(E_NOTIMPL); }

CDataXferObj::STDMETHODIMP_ ( ULONG )
CDataXferObj::STDMETHODIMP_ ( ULONG )

Member Data Documentation

LPSTORAGE CDataXferObj::m_lpObjStorage [private]

Definition at line 22 of file dxferObj.h.

LPOLEOBJECT CDataXferObj::m_lpOleObject [private]

Definition at line 23 of file dxferObj.h.

int CDataXferObj::m_nCount [private]

Definition at line 19 of file dxferObj.h.

POINTL CDataXferObj::m_pointl [private]

Definition at line 21 of file dxferObj.h.

SIZEL CDataXferObj::m_sizel [private]

Definition at line 20 of file dxferObj.h.

The documentation for this class was generated from the following files:
  • Com/Fundamentals/SimpDnd/dxferObj.h
  • Com/Fundamentals/SimpDnd/dxferObj.Cpp
Generated on Wed Nov 13 2024 16:56:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDbAlloc Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes

CDbAlloc Class Reference

List of all members.

Public Member Functions

CDbAlloc ()
~CDbAlloc ()
void | operator delete (void FAR *pv)
void FAR * | operator new (size_t cb)
STDMETHOD() | QueryInterface (REFIID riid, void FAR *FAR *ppv)
STDMETHOD_ (void, HeapMinimize)(void)
STDMETHOD_ (int, DidAlloc)(void FAR *pv)
STDMETHOD_ (ULONG, GetSize)(void FAR *pv)
STDMETHOD_ (ULONG, Release)(void)
STDMETHOD_ (ULONG, AddRef)(void)
STDMETHOD_ (void FAR *, Alloc)(ULONG cb)
STDMETHOD_ (void, Free)(void FAR *pv)
STDMETHOD_ (void FAR *, Realloc)(void FAR *pv

Static Public Member Functions

static HRESULT | Create (ULONG options, IDbOutput FAR *pdbout, IMalloc FAR *FAR *ppmalloc)

Public Attributes

ULONG cb

Private Member Functions

void | AddInst (void FAR *pv, ULONG nAlloc, ULONG cb)
void | Assertion (BOOL cond, char FAR *szExpr, char FAR *szFile, UINT uLine, char FAR *szMsg)
void | DelInst (void FAR *pv)
void | DumpInst (CAddrNode FAR *pn)
void | DumpInstTable (void)
CAddrNode FAR * | GetInst (void FAR *pv)
UINT | HashInst (void FAR *pv) const
BOOL | IsEmpty (void)

Private Attributes

ULONG m_cAllocCalls
ULONG m_nBreakAtAllocSize
ULONG m_nBreakAtNthAlloc
IDbOutput FAR * | m_pdbout
ULONG m_refs
CAddrNode FAR * | m_rganode [64]

Static Private Attributes

static const unsigned char | m_rgchSig [4] = { 0xDE, 0xAD, 0xBE, 0xEF }

Detailed Description

Definition at line 220 of file dballoc.Cpp.

Constructor & Destructor Documentation

CDbAlloc::CDbAlloc ( ) [inline]

Definition at line 249 of file dballoc.Cpp.

             {
     m_refs = 1;
     m_pdbout = NULL;
     m_cAllocCalls = 0;
     m_nBreakAtNthAlloc = 0;
     m_nBreakAtAllocSize = 0;
     MEMSET(m_rganode, 0, sizeof(m_rganode));

     g_dwObjectCount++ ;

   }

CDbAlloc::~CDbAlloc ( ) [inline]

Definition at line 261 of file dballoc.Cpp.

{   g_dwObjectCount-- ; }

Member Function Documentation

void CDbAlloc::AddInst | ( | void FAR * | pv,
 |  | ULONG | nAlloc,
 |  | ULONG | cb |
 | ) |  |  | [private]

Definition at line 584 of file dballoc.Cpp.

{
   UINT hash;
   CAddrNode FAR* pn;

   ASSERT(pv != NULL);

   pn = (CAddrNode FAR*)new FAR CAddrNode();

   if (pn == NULL) {
      ASSERT(pn != NULL);
      return;
   }

   pn->m_pv = pv;
   pn->m_cb = cb;
   pn->m_nAlloc = nAlloc;

   hash = HashInst(pv);
   pn->m_next = m_rganode[hash];
   m_rganode[hash] = pn;
}

void CDbAlloc::Assertion | ( | BOOL | cond,
 |  | char FAR * | szExpr,
 |  | char FAR * | szFile,
 |  | UINT | uLine,
 |  | char FAR * | szMsg |
 | ) |  |  | [inline, private]

Definition at line 296 of file dballoc.Cpp.

   {
     m_pdbout->Assertion(cond, szExpr, szFile, uLine, szMsg);
   }

HRESULT CDbAlloc::Create | ( | ULONG | options,
 |  | IDbOutput FAR * | pdbout,
 |  | IMalloc FAR *FAR * | ppmalloc |
 | ) |  |  | [static]

Definition at line 340 of file dballoc.Cpp.

{
   HRESULT hresult;
   CDbAlloc FAR* pmalloc;

   // default the instance of IDbOutput if the user didn't supply one
   if(pdbout == NULL && ((pdbout = CStdDbOutput::Create()) == NULL)){
     hresult = E_OUTOFMEMORY;
     goto LError0;
   }

   pdbout->AddRef();

   if((pmalloc = new FAR CDbAlloc()) == NULL){
     hresult = E_OUTOFMEMORY;
     goto LError1;
   }

   pmalloc->m_pdbout = pdbout;

   *ppmalloc = pmalloc;

   return NOERROR;

LError1:;
   pdbout->Release();
   pmalloc->Release();

LError0:;
   return hresult;
}

void CDbAlloc::DelInst ( void FAR * pv ) [private]

Definition at line 622 of file dballoc.Cpp.

{
   CAddrNode FAR* FAR* ppn, FAR* pnDead;

   for(ppn = &m_rganode[HashInst(pv)]; *ppn != NULL; ppn = &(*ppn)->m_next){
     if((*ppn)->m_pv == pv){
   pnDead = *ppn;
   *ppn = (*ppn)->m_next;
   delete pnDead;
   // make sure it doesnt somehow appear twice
   ASSERT(GetInst(pv) == NULL);
   return;
     }
   }

   // didnt find the instance
   ASSERT(UNREACHED);
}

void CDbAlloc::DumpInst ( CAddrNode FAR * pn ) [private]

Definition at line 656 of file dballoc.Cpp.

{
   if (pn == NULL)
      return;

   m_pdbout->Printf("[0x%lx]  nAlloc=%ld  size=%ld\n",
     pn->m_pv, pn->m_nAlloc, GetSize(pn->m_pv));
}

void CDbAlloc::DumpInstTable ( void ) [private]

Definition at line 705 of file dballoc.Cpp.

{
   UINT u;
   CAddrNode FAR* pn;

   for(u = 0; u < DIM(m_rganode); ++u){
     for(pn = m_rganode[u]; pn != NULL; pn = pn->m_next){
        DumpInst(pn);
     }
   }
}

CAddrNode FAR * CDbAlloc::GetInst ( void FAR * pv ) [private]

Definition at line 643 of file dballoc.Cpp.

{
   CAddrNode FAR* pn;

   for(pn = m_rganode[HashInst(pv)]; pn != NULL; pn = pn->m_next){
     if(pn->m_pv == pv)
      return pn;
   }
   return NULL;
}

UINT CDbAlloc::HashInst ( void FAR * pv ) const [inline, private]

Definition at line 289 of file dballoc.Cpp.

                                            {
     return ((UINT)((ULONG)pv >> 4)) % DIM(m_rganode);
   }

BOOL CDbAlloc::IsEmpty ( void ) [private]

Definition at line 679 of file dballoc.Cpp.

{
   UINT u;

   for(u = 0; u < DIM(m_rganode); ++u){
     if(m_rganode[u] != NULL)
   return FALSE;
   }

   return TRUE;
}

void CDbAlloc::operator delete ( void FAR * pv ) [inline]

Definition at line 245 of file dballoc.Cpp.

                                     {
     FREE(pv);
   }

void FAR* CDbAlloc::operator new ( size_t cb ) [inline]

Definition at line 242 of file dballoc.Cpp.

                                    {
     return MALLOC(cb);
   }

STDMETHODIMP CDbAlloc::QueryInterface | ( | REFIID | riid,
 |  | void FAR *FAR * | ppv
 | ) |  |

Definition at line 377 of file dballoc.Cpp.

{
   if(riid == IID_IUnknown || riid == IID_IMalloc){
     *ppv = this;
     AddRef();
     return NOERROR;
   }
   return E_NOINTERFACE;
}

CDbAlloc::STDMETHOD_ | ( | ULONG | ,
 |  | Release |
 | ) |  |
CDbAlloc::STDMETHOD_ | ( | ULONG | ,
 |  | GetSize |
 | ) |  |
CDbAlloc::STDMETHOD_ | ( | void | ,
 |  | Free |
 | ) |  |
CDbAlloc::STDMETHOD_ | ( | ULONG | ,
 |  | AddRef |
 | ) |  |
CDbAlloc::STDMETHOD_ | ( | void FAR * | ,
 |  | Alloc |
 | ) |  |
CDbAlloc::STDMETHOD_ | ( | int | ,
 |  | DidAlloc |
 | ) |  |
CDbAlloc::STDMETHOD_ | ( | void FAR * | ,
 |  | Realloc |
 | ) |  |
CDbAlloc::STDMETHOD_ | ( | void | ,
 |  | HeapMinimize |
 | ) |  |

Member Data Documentation

ULONG CDbAlloc::cb

Definition at line 235 of file dballoc.Cpp.

ULONG CDbAlloc::m_cAllocCalls [private]

Definition at line 267 of file dballoc.Cpp.

ULONG CDbAlloc::m_nBreakAtAllocSize [private]

Definition at line 271 of file dballoc.Cpp.

ULONG CDbAlloc::m_nBreakAtNthAlloc [private]

Definition at line 268 of file dballoc.Cpp.

IDbOutput FAR* CDbAlloc::m_pdbout [private]

Definition at line 274 of file dballoc.Cpp.

ULONG CDbAlloc::m_refs [private]

Definition at line 266 of file dballoc.Cpp.

CAddrNode FAR* CDbAlloc::m_rganode[64] [private]

Definition at line 275 of file dballoc.Cpp.

const unsigned char CDbAlloc::m_rgchSig = { 0xDE, 0xAD, 0xBE, 0xEF } [static, private]

Definition at line 310 of file dballoc.Cpp.

The documentation for this class was generated from the following file:
  • Com/Fundamentals/OleStd/dballoc.Cpp
Generated on Wed Nov 13 2024 16:56:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDBAuthAdmin Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CDBAuthAdmin Class Reference

#include "dbauthadmin.h"

List of all members.

Public Member Functions

CDBAuthAdmin ()
~CDBAuthAdmin ()
STDMETHOD() | AddUser (BSTR bstrUserName)
STDMETHOD() | GetUsers (BSTR *pbstrUserNames)
STDMETHOD() | Initialize (CDBAuthPlugin *pPlugin)
STDMETHOD() | InterfaceSupportsErrorInfo (REFIID riid)
STDMETHOD() | RemoveUser (BSTR bstrUserName)
STDMETHOD() | VerifyUser (BSTR bstrUserName, VARIANT_BOOL *pbFound)

Private Attributes

CDBAuthPlugin * m_pDBAuthPlugin

Detailed Description

Definition at line 21 of file dbauthadmin.h.

Constructor & Destructor Documentation

CDBAuthAdmin::CDBAuthAdmin ( ) [inline]

Definition at line 28 of file dbauthadmin.h.

    {
        m_pDBAuthPlugin = NULL;
    }

CDBAuthAdmin::~CDBAuthAdmin ( ) [inline]

Definition at line 33 of file dbauthadmin.h.

    {
    }

Member Function Documentation

STDMETHODIMP CDBAuthAdmin::AddUser ( BSTR bstrUserName )

Definition at line 54 of file dbauthadmin.cpp.

{
    if( NULL == bstrUserName )
    {
        return( E_INVALIDARG );
    }

    if( L'\0' == (WCHAR*) *bstrUserName )
    {
        return( S_OK );
    }

    return m_pDBAuthPlugin->AddUser( (LPCWSTR) bstrUserName );
}

HRESULT CDBAuthAdmin::GetUsers ( BSTR * pbstrUserNames )

Definition at line 111 of file dbauthadmin.cpp.

{
    if( NULL == pbstrUserNames )
    {
        return( E_POINTER );
    }

    return( m_pDBAuthPlugin->GetUsers( pbstrUserNames ) );

}

STDMETHODIMP CDBAuthAdmin::Initialize ( CDBAuthPlugin * pPlugin )

Definition at line 38 of file dbauthadmin.cpp.

{
    HRESULT hr = S_OK;

    if( NULL == pPlugin )
    {
        return( E_INVALIDARG );
    }

    m_pDBAuthPlugin = pPlugin;

    return( hr );
}

STDMETHODIMP CDBAuthAdmin::InterfaceSupportsErrorInfo ( REFIID riid )

Definition at line 19 of file dbauthadmin.cpp.

{
    static const IID* arr[] =
    {
        &IID_IDBAuthAdmin
    };
    for ( int i = 0; i < sizeof( arr ) / sizeof( arr[ 0 ] ); i++ )
    {
        if( IsEqualGUID( *arr[ i ], riid ) )
        {
            return( S_OK );
        }
    }

    return( S_FALSE );
}

STDMETHODIMP CDBAuthAdmin::RemoveUser ( BSTR bstrUserName )

Definition at line 71 of file dbauthadmin.cpp.

{
    if( NULL == bstrUserName )
    {
        return( E_INVALIDARG );
    }

    if( L'\0' == (WCHAR*) *bstrUserName )
    {
        return( S_OK );
    }

    return m_pDBAuthPlugin->RemoveUser( (LPCWSTR) bstrUserName );
}

HRESULT CDBAuthAdmin::VerifyUser | ( | BSTR | bstrUserName,
 |  | VARIANT_BOOL * | pbFound
 | ) |  |

Definition at line 88 of file dbauthadmin.cpp.

{
    if( NULL == bstrUserName )
    {
        return( E_INVALIDARG );
    }

    if( NULL == pbFound )
    {
        return( E_POINTER );
    }

    BOOL bFound = FALSE;
    DWORD dwIndex = 0;
    HRESULT hr = m_pDBAuthPlugin->VerifyUserMembership( ( LPCWSTR ) bstrUserName, &bFound, &dwIndex );

    *pbFound = ( SUCCEEDED( hr ) && bFound ) ? VARIANT_TRUE : VARIANT_FALSE;

    return( hr );
}

Member Data Documentation

CDBAuthPlugin* CDBAuthAdmin::m_pDBAuthPlugin [private]

Definition at line 60 of file dbauthadmin.h.

The documentation for this class was generated from the following files:
  • Multimedia/WindowsMediaServices9/Authorization/dbauthadmin.h
  • Multimedia/WindowsMediaServices9/Authorization/dbauthadmin.cpp
Generated on Wed Nov 13 2024 16:56:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDBAuthPlugin Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CDBAuthPlugin Class Reference

#include "dbauthplugin.h"

Inherits IDBAuthPlugin.

List of all members.

Public Member Functions

CDBAuthPlugin ()
~CDBAuthPlugin ()
HRESULT | AddUser (LPCWSTR pwszUserName)
STDMETHOD() | AuthorizeEvent (WMS_EVENT *pEvent, IWMSContext *pUserCtx, IWMSContext *pPresentationCtx, IWMSCommandContext *pCommandCtx, IWMSEventAuthorizationCallback *pCallback, VARIANT Context)
STDMETHOD() | DisablePlugin ()
STDMETHOD() | EnablePlugin (long *pdwFlags, long *pdwHeartbeatPeriod)
STDMETHOD() | GetAuthorizedEvents (VARIANT *pvarAuthorizedEvents)
STDMETHOD() | GetCustomAdminInterface (IDispatch **ppValue)
HRESULT | GetUsers (BSTR *pbstrUserNames)
STDMETHOD() | InitializePlugin (IWMSContext *pServerContext, IWMSNamedValues *pNamedValues, IWMSClassObject *pClassFactory)
STDMETHOD() | OnHeartbeat ()
HRESULT | RemoveUser (LPCWSTR pwszUserName)
STDMETHOD() | ShutdownPlugin ()
HRESULT | VerifyUserMembership (LPCWSTR pwszUserName, BOOL *pfFound, DWORD *pdwIndex)

Private Member Functions

HRESULT | CreateArrayOfEvents (VARIANT *pvarEvents, WMS_EVENT_TYPE *pWMSEvents, long nNumEvents)
HRESULT | GetSIDFromName (LPCWSTR pwszUserName, PSID *ppSid)
void | Lock ()
HRESULT | OnAuthorizeOpen (IWMSContext *pUserCtx, IWMSContext *pPresentationCtx, IWMSCommandContext *pCommandCtx)
void | Unlock ()
BOOL | VerifySidMembership (PSID pSid, DWORD *pdwIndex)

Private Attributes

CRITICAL_SECTION | m_CritSec
CSids * m_pSids
CComPtr< IWMSNamedValues > | m_spNamedValues
CComPtr< IWMSServer > | m_spServer

Detailed Description

Definition at line 44 of file dbauthplugin.h.

Constructor & Destructor Documentation

CDBAuthPlugin::CDBAuthPlugin ( )

Definition at line 22 of file dbauthplugin.cpp.

    : m_pSids( NULL )
{
    InitializeCriticalSection( &m_CritSec );
}

CDBAuthPlugin::~CDBAuthPlugin ( )

Definition at line 31 of file dbauthplugin.cpp.

{
    // Lock when accessing member variables
    if( NULL != m_pSids )
    {
        delete m_pSids;
    }
    DeleteCriticalSection( &m_CritSec );
}

Member Function Documentation

HRESULT CDBAuthPlugin::AddUser ( LPCWSTR pwszUserName )

Definition at line 459 of file dbauthplugin.cpp.

{
    if( ( NULL == pwszUserName ) || ( L'\0' == (WCHAR*) *pwszUserName ) )
    {
        return( E_INVALIDARG );
    }

    HRESULT hr = S_OK;
    PSID pSid = NULL;
    CSids *pNewSids = NULL;

    // Lock when accessing member variables
    Lock();

    do
    {
        if( NULL == m_pSids )
        {
            hr = E_FAIL;
            break;
        }

        hr = GetSIDFromName( pwszUserName, &pSid );
        if( FAILED( hr ) )
        {
            break;
        }

        BOOL bFound = FALSE;
        DWORD dwIndex = 0;
        bFound = VerifySidMembership( pSid, &dwIndex );

        if( bFound )
        {
            // the user already in the list
            // no further action required
            break;
        }

        // create a new CSids and add the user Sid
        hr = m_pSids->CopyAndAddSid( pSid, &pNewSids );
        if( FAILED( hr ) )
        {
            break;
        }

        // persist data using the newly created Sid array
        hr = pNewSids->SetAuthorizedUsers( m_spNamedValues );
        if( FAILED( hr ) )
        {
            break;
        }

        // succeeded in creating new Sids and persist data
        // change member variables
        m_pSids->CleanUp( FALSE );
        delete m_pSids;
        m_pSids = pNewSids;

        // set pNewSids and pSid to NULL so they won't be deleted later
        pNewSids = NULL;
        pSid = NULL;

    }
    while( FALSE );

    Unlock();

    if( NULL != pNewSids )
    {
        pNewSids->CleanUp( FALSE );
        delete pNewSids;
    }

    if( NULL != pSid )
    {
        LocalFree( pSid );
        pSid = NULL;
    }

    return( hr );

}

STDMETHODIMP CDBAuthPlugin::AuthorizeEvent | ( | WMS_EVENT * | pEvent,
 |  | IWMSContext * | pUserCtx,
 |  | IWMSContext * | pPresentationCtx,
 |  | IWMSCommandContext * | pCommandCtx,
 |  | IWMSEventAuthorizationCallback * | pCallback,
 |  | VARIANT | Context
 | ) |  |

Definition at line 246 of file dbauthplugin.cpp.

{
    HRESULT hrAuth = HRESULT_FROM_WIN32( ERROR_NO_SUCH_USER );
    HRESULT hr = S_OK;

    //
    // The event information must be valid in order to determine what
    // type of event needs to be authorized.
    //
    if( ( NULL == pEvent ) )
    {
        return( E_INVALIDARG );
    }

    //
    // The input contexts may be NULL if they are not defined for the
    // specified event.  Verify that any context you intend to use is
    // not NULL before using it.  If you need to use context that is
    // NULL, return E_INVALIDARG to notify the server of the problem.
    //

    switch( pEvent->Type )
    {
    case WMS_EVENT_CONNECT:
        break;
    case WMS_EVENT_OPEN:
        hrAuth = OnAuthorizeOpen( pUserCtx, pPresentationCtx, pCommandCtx );
        break;
    case WMS_EVENT_PLAY:
        break;
    case WMS_EVENT_GET_PARAMETER:
        break;
    case WMS_EVENT_SET_PARAMETER:
        break;
    case WMS_EVENT_VALIDATE_PUSH_DISTRIBUTION:
        break;
    }

    hr = pCallback->OnAuthorizeEvent( hrAuth, Context );
    return( hr );
}

HRESULT CDBAuthPlugin::CreateArrayOfEvents | ( | VARIANT * | pvarEvents,
 |  | WMS_EVENT_TYPE * | pWMSEvents,
 |  | long | nNumEvents |
 | ) |  |  | [private]

Definition at line 297 of file dbauthplugin.cpp.

{
    HRESULT hr = S_OK;
    long iEvents = 0;
    SAFEARRAY *psa = NULL;
    SAFEARRAYBOUND rgsabound[ 1 ];

    if( NULL == pvarEvents )
    {
        return( E_POINTER );
    }

    if( NULL == pWMSEvents || 0 >= nNumEvents )
    {
        return( E_INVALIDARG );
    }

    rgsabound[ 0 ].lLbound = 0;
    rgsabound[ 0 ].cElements = nNumEvents;

    psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );

    if( NULL == psa )
    {
        return ( E_OUTOFMEMORY );
    }

    for( iEvents = 0; iEvents < nNumEvents && SUCCEEDED( hr ); iEvents++ )
    {
        VARIANT varElement;

        VariantInit( &varElement );

        V_VT( &varElement ) = VT_I4;
        V_I4( &varElement ) = pWMSEvents[ iEvents ];

        hr = SafeArrayPutElement( psa, &iEvents, &varElement );
        VariantClear( &varElement );
    }

    if( FAILED( hr ) )
    {
        SafeArrayDestroy( psa );
        psa = NULL;
    }
    else
    {
        V_VT( pvarEvents ) = VT_ARRAY | VT_VARIANT;
        V_ARRAY( pvarEvents ) = psa;
    }

    return( hr );
}

STDMETHODIMP CDBAuthPlugin::DisablePlugin ( )

Definition at line 154 of file dbauthplugin.cpp.

{
    return ( S_OK );
}

STDMETHODIMP CDBAuthPlugin::EnablePlugin | ( | long * | pdwFlags,
 |  | long * | pdwHeartbeatPeriod
 | ) |  |

Definition at line 138 of file dbauthplugin.cpp.

{
    if( NULL == pdwFlags || NULL == pdwHeartbeatPeriod )
    {
        return ( E_POINTER );
    }

    // Set the heartbeat period in milliseconds
    *pdwHeartbeatPeriod = 0000;

    return ( S_OK );
}

STDMETHODIMP CDBAuthPlugin::GetAuthorizedEvents ( VARIANT * pvarAuthorizedEvents )

Definition at line 225 of file dbauthplugin.cpp.

{
    if( NULL == pvarAuthorizedEvents )
    {
        return( E_INVALIDARG );
    }

    HRESULT hr = S_OK;
    int nIndex = 0;
    WMS_EVENT_TYPE wmsAuthorizedEvents[ NUM_AUTHORIZED_EVENTS ];

    wmsAuthorizedEvents[ nIndex++ ] = WMS_EVENT_OPEN;

    hr = CreateArrayOfEvents( pvarAuthorizedEvents, wmsAuthorizedEvents, NUM_AUTHORIZED_EVENTS );
    return( hr );
}

STDMETHODIMP CDBAuthPlugin::GetCustomAdminInterface ( IDispatch ** ppValue )

Definition at line 197 of file dbauthplugin.cpp.

{
    if( ( NULL == ppValue ) )
    {
        return( E_INVALIDARG );
    }

    HRESULT hr = S_OK;

    *ppValue = NULL;

    CComObject<CDBAuthAdmin> *spDBAuthAdmin;

    hr = CComObject<CDBAuthAdmin>::CreateInstance( &spDBAuthAdmin );
    if( SUCCEEDED( hr ) )
    {
        hr = spDBAuthAdmin->Initialize( this /*, m_spNamedValues */ );
        if( SUCCEEDED( hr ) )
        {
            hr = spDBAuthAdmin->QueryInterface( IID_IDispatch, (void **) ppValue );
        }
    }

    return( hr );
}

HRESULT CDBAuthPlugin::GetSIDFromName | ( | LPCWSTR | pwszUserName,
 |  | PSID * | ppSid |
 | ) |  |  | [private]

Definition at line 661 of file dbauthplugin.cpp.

{
    // Translate the user name into a SID

    if( NULL == ppSid )
    {
        return( E_INVALIDARG );
    }

    HRESULT hr = S_OK;
    DWORD dwRetVal = 0;
    SID_NAME_USE SidNameUse;
    DWORD cbSid = 0;
    DWORD cbDomainName = 0;
    LPWSTR wstrDomainName = NULL;
    BOOL fRetVal = FALSE;

    do
    {
        if( !LookupAccountName( NULL,
                                pwszUserName,
                                NULL,
                                &cbSid,
                                NULL,
                                &cbDomainName,
                                &SidNameUse ) )
        {
            dwRetVal = GetLastError();
            if( ERROR_INSUFFICIENT_BUFFER != dwRetVal )
            {
                hr = HRESULT_FROM_WIN32( dwRetVal );
                break;
            }
        }

        *ppSid = (SID *) LocalAlloc( LPTR, cbSid );
        if( NULL == *ppSid )
        {
            hr = E_OUTOFMEMORY;
            break;
        }

        wstrDomainName = new WCHAR[ cbDomainName ];
        if( NULL == wstrDomainName )
        {
            hr = E_OUTOFMEMORY;
            break;
        }

        fRetVal = LookupAccountName( NULL,
                                     pwszUserName,
                                     *ppSid,
                                     &cbSid,
                                     wstrDomainName,
                                     &cbDomainName,
                                     &SidNameUse );

        if( !fRetVal )
        {
            dwRetVal = GetLastError();
            hr = HRESULT_FROM_WIN32( dwRetVal );
            break;
        }

    }
    while( FALSE );

    if( NULL != wstrDomainName )
    {
        delete [] wstrDomainName;
    }

    if( FAILED( hr ) && ( NULL != *ppSid ) )
    {
        LocalFree( *ppSid );
        *ppSid = NULL;
    }

    return( hr );
}

HRESULT CDBAuthPlugin::GetUsers ( BSTR * pbstrUserNames )

Definition at line 628 of file dbauthplugin.cpp.

{
    if( NULL == pbstrUserNames )
    {
        return( E_INVALIDARG );
    }

    HRESULT hr = S_OK;

    // Lock when accessing member variables
    Lock();

    do
    {
        if( NULL == m_pSids )
        {
            hr = E_FAIL;
            break;
        }

        hr = m_pSids->GetUsers( pbstrUserNames );

    }
    while( FALSE );

    Unlock();

    return( hr );

}

STDMETHODIMP CDBAuthPlugin::InitializePlugin | ( | IWMSContext * | pServerContext,
 |  | IWMSNamedValues * | pNamedValues,
 |  | IWMSClassObject * | pClassFactory
 | ) |  |

Definition at line 58 of file dbauthplugin.cpp.

{
    if( ( NULL == pServerContext )
        || ( NULL == pNamedValues )
        || ( NULL == pClassFactory ) )
    {
        return( E_INVALIDARG );
    }

    HRESULT hr = S_OK;
    IWMSServer* pWMSServer = NULL;
    DWORD dwCount = 0;

    // Lock when accessing member variables
    Lock();

    do
    {
        hr = pServerContext->GetAndQueryIUnknownValue( const_cast<LPWSTR>( WMS_SERVER ), WMS_SERVER_ID,
                                                   IID_IWMSServer, (IUnknown**)&pWMSServer, 0 );
        if( FAILED( hr ) )
        {
            break;
        }

        ATLASSERT( NULL != pWMSServer );
        m_spServer.Attach( pWMSServer );
        if( NULL == m_spServer.p )
        {
            hr = E_NOINTERFACE;
            break;
        }

        m_spNamedValues = pNamedValues;
        if( NULL == m_spNamedValues.p )
        {
            hr = E_NOINTERFACE;
            break;
        }

        CSids *pSids = new CSids;
        if( NULL == pSids )
        {
            hr = E_OUTOFMEMORY;
            break;
        }

        if( NULL != m_pSids )
        {
            delete m_pSids;
        }
        m_pSids = pSids;
        pSids = NULL;

        // Get setting from namespace
        hr = m_pSids->GetAuthorizedUsers( m_spNamedValues );
        if( FAILED( hr ) )
        {
            // ignore error when not able to get setting from namespace
            hr = S_OK;
        }

        // TODO: Add any additional initialization here

    }
    while( FALSE );

    Unlock();

    return( hr );
}

void CDBAuthPlugin::Lock ( ) [private]

Definition at line 43 of file dbauthplugin.cpp.

{
    EnterCriticalSection( &m_CritSec );
}

HRESULT CDBAuthPlugin::OnAuthorizeOpen | ( | IWMSContext * | pUserCtx,
 |  | IWMSContext * | pPresentationCtx,
 |  | IWMSCommandContext * | pCommandCtx |
 | ) |  |  | [private]

Definition at line 355 of file dbauthplugin.cpp.

{
    // return S_OK if Open is Authorized, otherwise return E_ACCESSDENIED

    HRESULT hr = S_OK;
    BOOL bFound = FALSE;
    LPWSTR wstrUser = NULL;

    do
    {
        hr = pUserCtx->GetStringValue( const_cast<LPWSTR>( WMS_USER_NAME ),
                                       WMS_USER_NAME_ID,
                                       &wstrUser,
                                       WMS_CONTEXT_GET_PROPERTY_STRING_BY_REFERENCE );
        if( FAILED( hr ) )
        {
            break;
        }

        DWORD dwIndex = 0;
        hr = VerifyUserMembership( wstrUser, &bFound, &dwIndex );

    }
    while( FALSE );

    if( SUCCEEDED( hr ) && bFound )
    {
        return( S_OK );
    }
    else
    {
        return( E_ACCESSDENIED );
    }
}

STDMETHODIMP CDBAuthPlugin::OnHeartbeat ( )

Definition at line 186 of file dbauthplugin.cpp.

{
    HRESULT hr = S_OK;

    // TODO: Add code that should execute on every Heartbeat Period
    return( hr );
}

HRESULT CDBAuthPlugin::RemoveUser ( LPCWSTR pwszUserName )

Definition at line 545 of file dbauthplugin.cpp.

{
    if( ( NULL == pwszUserName ) || ( L'\0' == (WCHAR*) *pwszUserName ) )
    {
        return( E_INVALIDARG );
    }

    HRESULT hr = S_OK;
    BOOL bFound = FALSE;
    CSids *pNewSids = NULL;

    // Lock when accessing member variables
    Lock();

    do
    {
        if( NULL == m_pSids )
        {
            hr = E_FAIL;
            break;
        }

        if( 0 == m_pSids->m_cItems )
        {
            // no user in the list
            // no further action required
            break;
        }

        DWORD dwIndexFound = 0;
        hr = VerifyUserMembership( pwszUserName, &bFound, &dwIndexFound );
        if( FAILED( hr ) )
        {
            break;
        }

        if( !bFound )
        {
            // the user is not in the list
            // no further action required
            break;
        }

        hr = m_pSids->CopyAndRemoveItem( dwIndexFound, &pNewSids );
        if( FAILED( hr ) )
        {
            break;
        }

        // persist data using the newly created Sid array
        hr = pNewSids->SetAuthorizedUsers( m_spNamedValues );
        if( FAILED( hr ) )
        {
            break;
        }

        // succeeded in creating new Sids and persist data
        // change member variables
        LocalFree( m_pSids->m_pSidList[ dwIndexFound ] );
        m_pSids->CleanUp( FALSE );
        delete m_pSids;
        m_pSids = pNewSids;

        // set pNewSids to NULL so they won't be deleted later
        pNewSids = NULL;

    }
    while( FALSE );

    Unlock();

    if( NULL != pNewSids )
    {
        pNewSids->CleanUp( FALSE );
        delete pNewSids;
    }

    return( hr );

}

STDMETHODIMP CDBAuthPlugin::ShutdownPlugin ( )

Definition at line 162 of file dbauthplugin.cpp.

{
    HRESULT hr = S_OK;

    // Lock when accessing member variables
    Lock();

    m_spServer = NULL;
    m_spNamedValues = NULL;

    if( NULL != m_pSids )
    {
        delete m_pSids;
    }
    m_pSids = NULL;

    Unlock();

    return( hr );
}

void CDBAuthPlugin::Unlock ( ) [private]

Definition at line 50 of file dbauthplugin.cpp.

{
    LeaveCriticalSection( &m_CritSec );
}

BOOL CDBAuthPlugin::VerifySidMembership | ( | PSID | pSid,
 |  | DWORD * | pdwIndex |
 | ) |  |  | [private]

Definition at line 433 of file dbauthplugin.cpp.

{

    BOOL bFound = FALSE;

    if( ( NULL == pSid ) || ( NULL == pdwIndex ) )
    {
        return( bFound );
    }

    // Lock when accessing member variables
    Lock();

    if( NULL != m_pSids )
    {
        bFound = m_pSids->MatchSid( pSid, pdwIndex );
    }

    Unlock();

    return( bFound );

}

HRESULT CDBAuthPlugin::VerifyUserMembership | ( | LPCWSTR | pwszUserName,
 |  | BOOL * | pfFound,
 |  | DWORD * | pdwIndex
 | ) |  |

Definition at line 392 of file dbauthplugin.cpp.

{

    if( ( NULL == pfFound ) || ( NULL == pdwIndex ) )
    {
        return( E_INVALIDARG );
    }

    if( ( NULL == pwszUserName ) || ( L'\0' == (WCHAR*) *pwszUserName ) )
    {
        return( E_INVALIDARG );
    }

    HRESULT hr = S_OK;
    PSID pSid = NULL;

    do
    {
        hr = GetSIDFromName( pwszUserName, &pSid );
        if( FAILED( hr ) )
        {
            break;
        }

        *pfFound = VerifySidMembership( pSid, pdwIndex );

    }
    while( FALSE );

    if( NULL != pSid )
    {
        LocalFree( pSid );
        pSid = NULL;
    }

    return( hr );

}

Member Data Documentation

CRITICAL_SECTION CDBAuthPlugin::m_CritSec [private]

Definition at line 100 of file dbauthplugin.h.

CSids* CDBAuthPlugin::m_pSids [private]

Definition at line 99 of file dbauthplugin.h.

CComPtr<IWMSNamedValues> CDBAuthPlugin::m_spNamedValues [private]

Definition at line 98 of file dbauthplugin.h.

CComPtr<IWMSServer> CDBAuthPlugin::m_spServer [private]

Definition at line 97 of file dbauthplugin.h.

The documentation for this class was generated from the following files:
  • Multimedia/WindowsMediaServices9/Authorization/dbauthplugin.h
  • Multimedia/WindowsMediaServices9/Authorization/dbauthplugin.cpp
Generated on Wed Nov 13 2024 16:56:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDBFile Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CDBFile Class Reference

#include "cdbfile.h"

List of all members.

Public Member Functions

CDBFile ()
~CDBFile ()
BOOL | AddRow (CRow *pRow, ATLCOLUMNINFO *prgColInfo, ULONG ulCols)
void | AllocateProxyBuffers (bool bUseBookmarks)
bool | Close ()
int | DeleteRowImmediate (CRow *pRow)
int | ExpandFileAndAdjustRowObjects (ULONG ulBytesNeeded, bool bExpOrCon=EXPAND_FILE)
int | FetchRow (CRow **pRow)
bool | FillRowArray ()
bool | GetFileSchemaInfo (LPCTSTR pszFileName)
ATLCOLUMNINFO * | GetSchemaInfo (ULONG *pNumCols)
HRESULT | InsertRowImmediate (CRow *pRow, ATLCOLUMNINFO *pColInfo, ULONG ulCols, bool bData)
bool | Open (LPCTSTR pszFileName, bool bOpenMode=false)
int | SaveAndReOpenFile ()
HRESULT | UpdateRowImmediate (CRow *pRow, ATLCOLUMNINFO *pColInfo, ULONG ulCols)

Public Attributes

bool | m_bClosed
int | m_cCols
HANDLE m_hFile
HANDLE m_hMapFile
char * | m_pbCurrentPos
char * | m_pbEOF
LPVOID | m_pFileMap
ATLCOLUMNINFO * | m_prgColInfo
CSimpleArray< CRow * > m_Rows
TCHAR | m_szTblNm [MAX_TABLE_NAME_SIZE]

Detailed Description

Definition at line 40 of file cdbfile.h.

Constructor & Destructor Documentation

CDBFile::CDBFile ( ) [inline]

Definition at line 56 of file cdbfile.h.

           :m_bClosed(true),m_prgColInfo(NULL)
  {

  }

CDBFile::~CDBFile ( )

Definition at line 5 of file cdbfile.cpp.

{
  int nSize = m_Rows.GetSize();
  for (int n = 0; n < nSize; n++)
    delete m_Rows[n];
  // Close the file
  if(!m_bClosed)
    Close();
  // Delete the m_prgColInfo
  if (NULL != m_prgColInfo)
    delete m_prgColInfo;
}

Member Function Documentation

BOOL CDBFile::AddRow | ( | CRow * | pRow,
 |  | ATLCOLUMNINFO * | prgColInfo,
 |  | ULONG | ulCols
 | ) |  |

Definition at line 649 of file cdbfile.cpp.

{
  pRow->m_cbRowSize = 0;
  pRow->AllocProxyBuffer(prgColInfo, ulCols);
  pRow->m_pbStartLoc = m_pbEOF + 1;
  BOOL bTmp = m_Rows.Add(pRow);
  if (bTmp == TRUE)
    pRow->m_bmk = m_Rows.GetSize(); // Initialize it
   return bTmp;
}

void CDBFile::AllocateProxyBuffers ( bool bUseBookmarks )

Definition at line 290 of file cdbfile.cpp.

{
  int nSize = m_Rows.GetSize();
  for (int i = 0; i < nSize; i++)
  {
    m_Rows[i]->AllocProxyBuffer(m_prgColInfo, m_cCols);
  }

}

bool CDBFile::Close ( void )

Definition at line 76 of file cdbfile.cpp.

{
  int nFileSize = m_pbEOF - (char *)m_pFileMap + 1;

  UnmapViewOfFile(m_pFileMap);

  CloseHandle(m_hMapFile);

  CloseHandle(m_hFile);

  m_bClosed = true;

  return m_bClosed;
}

int CDBFile::DeleteRowImmediate ( CRow * pRow )

Definition at line 307 of file cdbfile.cpp.

{
  // TODO: could derive row number from the bookmark. Should we do this?

  // CRow contains the starting location and the the row size
  // Special consideration: if this is the last row, there may not be
  // a "\r\n" pair so we need to check for this in the calculations
  // If it is not the last row being deleted then we need to subtract 2 bytes from
  // the file count.
  ULONG ulRow = pRow->m_bmk;
  ULONG ulActRow = ulRow -1;  // Actual Row is Bookmark - 1

  int nRows = m_Rows.GetSize();

  BYTE *  pbOldEOF = (BYTE *)m_pbEOF;

  // check for last element of the array
  //if (ulRow == (ULONG)nRows -1)
  if (ulRow == (ULONG)nRows)
  {
//    m_pbEOF = m_Rows[ulRow]->m_pbStartLoc - 1;
    m_pbEOF = m_Rows[ulActRow]->m_pbStartLoc - 1;
    // For the last element update the bookmark too
    m_Rows[ulActRow]->m_bmk --;
  }
  else
  {
    // Copy record over previous record
    // Row sizes will stay the same.
//    BYTE * pbDest = (BYTE *)m_Rows[ulRow]->m_pbStartLoc;
    BYTE * pbDest = (BYTE *)m_Rows[ulActRow]->m_pbStartLoc;
    BYTE * pbSrc;
    for (int i = ulActRow+1; i < nRows; i++)
    {
      pbSrc = (BYTE *)m_Rows[i]->m_pbStartLoc;
      m_Rows[i]->m_pbStartLoc = (char *)pbDest;
      // m_Rows[i]->m_bmk = m_Rows[i-1]->m_bmk;
      m_Rows[i]->m_bmk --;

      for (int c = 0; c < m_Rows[i]->m_cbRowSize; c++)
      {
        *pbDest++ = *pbSrc++;
      }

      // add carriage return - line feed
      *pbDest++ = '\r';
      *pbDest++ = '\n';

    }
    m_pbEOF = (char *)pbDest-1;  // this will be used to set the end of file when we close the file
  }

  // slide everything up  - this is OK because only ReleaseRows will ever reference the row again
//    m_Rows[ulActRow]->m_bDeleted = true;
  if(1 == m_Rows.GetSize( ))
    m_Rows.RemoveAll();
  else
  {
    if (!(m_Rows.RemoveAt(ulActRow)))
      return S_FALSE;
  }
  // Close and re-open the file so that the transaction is completely done and the file is completely modified
  // This is an expensive operation but is done to ensure that the file is not currupted if the application is terminated
  // and the CDBFile is not closed properly
  SaveAndReOpenFile();

  return S_OK;
}

int CDBFile::ExpandFileAndAdjustRowObjects | ( | ULONG | ulBytesNeeded,
 |  | bool | bExpOrCon = EXPAND_FILE
 | ) |  |

Definition at line 528 of file cdbfile.cpp.

{
  void * pFileMapOld = m_pFileMap;
  int nFileSize = m_pbEOF - (char *)m_pFileMap + 1;

  // commit data to disk
//  BOOL bSuccess = FlushViewOfFile(m_pFileMap, nFileSize);
//  if (!bSuccess)
//    return DBFILE_FLUSH_ERROR;

  pFileMapOld = m_pFileMap;

  UnmapViewOfFile(m_pFileMap);

  CloseHandle(m_hMapFile);

//  SetFilePointer(m_hFile, nFileSize, NULL, FILE_BEGIN);

//  SetEndOfFile(m_hFile);
  // CloseHandle(m_hFile);  don't actually close file

  // re-open and adjust row objects based on a new address potentially
  if(EXPAND_FILE == bExpOrCon)
    m_hMapFile = CreateFileMapping(m_hFile, NULL, PAGE_READWRITE, 0, nFileSize + ulBytesNeeded, NULL);
  else
    m_hMapFile = CreateFileMapping(m_hFile, NULL, PAGE_READWRITE, 0, nFileSize - ulBytesNeeded, NULL);

  if (m_hMapFile == NULL)
  {
    OUT_LINE_FILE();
    return false;
  }

  // Create just one view of the memory-mapped file
  m_pFileMap = MapViewOfFile(m_hMapFile, FILE_MAP_ALL_ACCESS, 0, 0, 0);
  if (m_pFileMap == NULL)
  {
    OUT_LINE_FILE();
    return false;
  }

  // Check to see if the mapping address has changed.  If it has, must recalculate all
  // CRow objects.
  if (m_pFileMap != pFileMapOld)
  {
    // calculate adjustment
    long nAdjustment = (long)m_pFileMap - (long)pFileMapOld;

    int nSize = m_Rows.GetSize();
    for (int iRow = 0; iRow < nSize; iRow++)
    {
      m_Rows[iRow]->m_pbStartLoc += nAdjustment;
    }

    if(EXPAND_FILE == bExpOrCon)
      m_pbEOF += nAdjustment + ulBytesNeeded;
    else
      m_pbEOF += nAdjustment - ulBytesNeeded;
  }
  else
  {
    if(EXPAND_FILE == bExpOrCon)
      m_pbEOF += ulBytesNeeded;
    else
      m_pbEOF -= ulBytesNeeded;
  }

  return 0;
}

int CDBFile::FetchRow ( CRow ** pRow )

Definition at line 117 of file cdbfile.cpp.

{
  if (m_pbCurrentPos > m_pbEOF)
    return LAST_ROW_FETCHED;    // we were already at the end of the line and therefore there is no row to fetch

  CRow *pRow = new CRow;

  pRow->m_pbStartLoc = m_pbCurrentPos;

  int cbRowSize = 0;
  while (m_pbCurrentPos <= m_pbEOF && *m_pbCurrentPos != '\r')
  {
    m_pbCurrentPos++;
    cbRowSize++;
  }

  if (m_pbCurrentPos <= m_pbEOF)
  {
    // not EOF
    if (*m_pbCurrentPos == '\r' && *(m_pbCurrentPos+1) == '\n')
      m_pbCurrentPos+=2;  // skip the carriage return
    else
    {
      if (*m_pbCurrentPos == '\r')
      {
        delete pRow;
        return ERROR_IN_ROW_DATA;  // error because there was a \r without a \n
      }
    }
  }

  pRow->m_cbRowSize = cbRowSize;  // cbRowSize does not include the carriage return - line feed

  // defer filling the CColumn elements until the row is fetched and the data is fetched using IRowset::GetData

  *ppRow = pRow;
  return FETCH_SUCCESS;

}

bool CDBFile::FillRowArray ( )

Definition at line 93 of file cdbfile.cpp.

{
  CRow *pRow;
  m_pbCurrentPos = (char *)m_pFileMap;
  int iIndex = 0;
  int nRet;

  while (nRet = FetchRow(&pRow) == FETCH_SUCCESS)
  {
    // Row fetched successfully. Add it to the array.
    pRow->m_bmk = ++iIndex;
    m_Rows.Add(pRow);
  }

  if (ERROR_IN_ROW_DATA == nRet)
  {
    OUT_LINE_FILE();
    return false; // fatal error
  }

  return true;
}

bool CDBFile::GetFileSchemaInfo ( LPCTSTR pszFileName )

Definition at line 168 of file cdbfile.cpp.

{
//  Do a bunch of stuff to get the schema information from the file

  USES_CONVERSION;

  TCHAR szTmpFileName[_MAX_PATH];
  if(_MAX_PATH < _tcslen(pszFileName) )
  {
    ATLTRACE2(atlTraceDBProvider, 0, "FILE ERROR: File path cannot be larger than 260 characters...\n");
    return false;
  }
  _tcscpy(szTmpFileName,pszFileName);
  szTmpFileName[_tcslen(szTmpFileName) - 3] = 's';

  FILE *fptr;
  if( !(fptr=fopen(szTmpFileName,"r")) )
  {
    ATLTRACE2(atlTraceDBProvider, 0, "FILE ERROR: Schema file cannot be read...\n");
    return false;
  }

  // Start reading the file...
  // Expected Format of the Schema file
    // <Table_Properties> <Column_Properties>[,...n]
    // Syntax :
  // <Table_Properties> ::= <Table_Name> <Number_of_Fields> <New_Line>
  // <Table_Name> ::= <Table_Alphabet>[1,....,20]
  // <Table_Alphabet> ::= [a,...,z] | [0,...9]
  // <Number_of_Fields> ::= [0,...,255]
  // <Table_Properties> ::= <Table_Name> <Number_of_Fields> <New_Line>
  // <Column_Properties> ::= <Column_Name> <Column_Type> <Column_Precision> <Column_Size><New_Line>
  // <Column_Name> ::= <Column_Alphabet>[1,....,20]
  // <Column_Alphabet> ::= [a,...,z] | [0,...9]
  // <Column_Type> ::= DBTYPE_I4 | DBTYPE_STR
  // <Column_Presicion> ::= [1...255]
  // <Column_Size> ::= [1...255]
  // <New_Line> ::= '\n'

    // Get the <Table_Properties>
  char szTblNm[40],szColNm[40],szColType[20];
  ULONG ulNumFld, ulColPrec, ulColSize;
  ulNumFld=ulColPrec=ulColSize =0;

  fscanf(fptr,"%s %d",szTblNm,&ulNumFld);
  if(_tcslen(szTblNm) > 20)
  {
    ATLTRACE2(atlTraceDBProvider, 0, "FILE ERROR: Table Name too long...\n");
    return false;
  }
  else if(ulNumFld > 255 || ulNumFld < 1)
  {
    ATLTRACE2(atlTraceDBProvider, 0, "FILE ERROR: Incorrect Number of fields specified...\n");
    return false;
  }
  // Set the number of columns
  m_cCols = ulNumFld;
  // Set Table_Name
  _tcscpy(m_szTblNm,szTblNm);
  // Build the ColumnInfo structure
  m_prgColInfo = new ATLCOLUMNINFO[(sizeof(ATLCOLUMNINFO) * ulNumFld)];
    // Get the <Column_Properties>
  for(ULONG ulColCnt = 0; ulColCnt < ulNumFld; ulColCnt++)
  {
    fscanf(fptr,"%s %s %d %d",szColNm,szColType,&ulColPrec,&ulColSize);
    if (_tcslen(szColNm) > 20)
    {
      ATLTRACE2(atlTraceDBProvider, 0, "FILE ERROR: Column Name too long...\n");
      return false;
    }
    else if (_tcscmp(szColType,"DBTYPE_I4") != 0 && _tcscmp(szColType,"DBTYPE_STR") != 0 )
    {
      ATLTRACE2(atlTraceDBProvider, 0, "FILE ERROR: Only DBTYPE_I4 or DBTYPE_STR types supported...\n");
      return false;
    }
    else if( (ulColPrec < 1 || ulColPrec > 255) && (_tcscmp(szColType,"DBTYPE_I4") == 0) )
    {
      ATLTRACE2(atlTraceDBProvider, 0, "FILE ERROR: Incorrect Column Precision specified...\n");
      return false;
    }
    else if ((ulColSize < 1 || ulColSize > 255) && (_tcscmp(szColType,"DBTYPE_STR") == 0) )
    {
      ATLTRACE2(atlTraceDBProvider, 0, "FILE ERROR: Incorrect Column Size specified...\n");
      return false;
    }

    // Do the assignment into the ATLCOLUMNINFO structure
    DWORD dwFlags = DBCOLUMNFLAGS_WRITE;
    memset(&m_prgColInfo[ulColCnt], 0, sizeof(ATLCOLUMNINFO));
    m_prgColInfo[ulColCnt].iOrdinal = ulColCnt + 1;
    m_prgColInfo[ulColCnt].columnid.eKind = DBKIND_GUID_NAME; //DBKIND_NAME;
    m_prgColInfo[ulColCnt].pTypeInfo = (ITypeInfo*)NULL;
    m_prgColInfo[ulColCnt].columnid.uGuid.guid = GUID_NULL;
    m_prgColInfo[ulColCnt].dwFlags = dwFlags;
    m_prgColInfo[ulColCnt].bScale = -1;
    // User modifiable Attributes
    m_prgColInfo[ulColCnt].columnid.uName.pwszName = SysAllocString(T2OLE(szColNm));
    m_prgColInfo[ulColCnt].pwszName = SysAllocString(T2OLE(szColNm));
    if(_tcscmp(szColType,"DBTYPE_I4") == 0)
    {
      m_prgColInfo[ulColCnt].ulColumnSize = 4;
      m_prgColInfo[ulColCnt].bPrecision = (BYTE) ulColPrec;
      m_prgColInfo[ulColCnt].wType = DBTYPE_I4;
    }
    else  //DBTYPE_STR
    {
      m_prgColInfo[ulColCnt].ulColumnSize = ulColSize;
      m_prgColInfo[ulColCnt].bPrecision = -1;
      m_prgColInfo[ulColCnt].wType = DBTYPE_STR;
    }
    if(0 == ulColCnt)
      m_prgColInfo[ulColCnt].cbOffset = 0;
    else
      m_prgColInfo[ulColCnt].cbOffset = m_prgColInfo[ulColCnt-1].cbOffset + m_prgColInfo[ulColCnt-1].ulColumnSize;

  }
  return true;
}

ATLCOLUMNINFO * CDBFile::GetSchemaInfo ( ULONG * pNumCols )

Definition at line 159 of file cdbfile.cpp.

{
  // Allocate the column information only once  as the functions we are returning the
  // data from don't free.
  *pNumCols = m_cCols;

  return m_prgColInfo;
}

HRESULT CDBFile::InsertRowImmediate | ( | CRow * | pRow,
 |  | ATLCOLUMNINFO * | pColInfo,
 |  | ULONG | ulCols,
 |  | bool | bData
 | ) |  |

Definition at line 598 of file cdbfile.cpp.

{
  bool bAddEOL=false;
  ULONG ulBytesNeeded;

  if(bData == true)  // Data is contained in the Row
    ulBytesNeeded = pRow->CalculateRowData(prgColInfo, ulCols); // m_cbRowsize == 0 when this called
  else
    ulBytesNeeded = pRow->CreateDefaultRow(prgColInfo, ulCols);
  // If the Number of Bytes required are in Error !!!
  if (ulBytesNeeded < 0)
    return DB_E_DATAOVERFLOW;

  // To accomodate the \r \n at the end of the line
  ulBytesNeeded += 2;

  // Check if the previous line if any had any EOL
  if(pRow->m_bmk > 1)
  {
    if (!(m_Rows[(pRow->m_bmk) - 2]->HasEOL((BYTE*)m_pbEOF)))
    {
      ulBytesNeeded += 2;  // add space needed to add a \r\n which may not be there
                // if this is the last row
      bAddEOL = true;
    }
  }
  // need to make space for updated row
  ExpandFileAndAdjustRowObjects(ulBytesNeeded);

  // add \r\n on end of row if necessary
  if (bAddEOL)
  {
    m_Rows[pRow->m_bmk - 1]->AddEOL();
    // adjust start location of pRow
    pRow->AdjustStartLocationForEOL();
  }

  // now that there is space allocated, simply dump the row's data
  pRow->Update(prgColInfo, ulCols); // write the data to the file

  pRow->AddEOL();

  // commit data to disk
  BOOL bSuccess = FlushViewOfFile(m_pFileMap, m_pbEOF - (char *)m_pFileMap + 1);
  if (!bSuccess)
    return DBFILE_FLUSH_ERROR;

  return 0;

}

bool CDBFile::Open | ( | LPCTSTR | pszFileName,
 |  | bool | bOpenMode = false
 | ) |  |

Definition at line 19 of file cdbfile.cpp.

{
  TCHAR pszFileName[_MAX_PATH];
    _tcscpy(pszFileName,szFileName);
  // Open schema .sxt file
  if (!GetFileSchemaInfo(pszFileName))
  {
    // An error occured opening schema file
    OUT_LINE_FILE();
    return false;
  }

  // Get the Data file from the schema file
  pszFileName[_tcslen(szFileName) - 3] = 't';

  if(true == bOpenMode)
  {
    m_hFile = CreateFile(pszFileName, GENERIC_READ | GENERIC_WRITE, 0 /* open file for exclusive use*/,
           NULL, OPEN_EXISTING, FILE_FLAG_RANDOM_ACCESS, NULL);
  }
  else
  {
    m_hFile = CreateFile(pszFileName, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ /* open file for non-exclusive use*/,
           NULL, OPEN_EXISTING, FILE_FLAG_RANDOM_ACCESS, NULL);
  }

  if (m_hFile == INVALID_HANDLE_VALUE)
  {
    // An error occured opening the file
    OUT_LINE_FILE();
    return false;
  }

  m_hMapFile = CreateFileMapping(m_hFile, NULL, PAGE_READWRITE, 0, 0, NULL);
  if (m_hMapFile == NULL)
  {
    OUT_LINE_FILE();
    return false;
  }

  // Create just one view of the memory-mapped file
  m_pFileMap = MapViewOfFile(m_hMapFile, FILE_MAP_ALL_ACCESS, 0, 0, 0);
  if (m_pFileMap == NULL)
  {
    OUT_LINE_FILE();
    return false;
  }

  m_pbEOF = (char *) m_pFileMap + GetFileSize(m_hFile, NULL) -1;

  m_bClosed = false;

  return true;
}

int CDBFile::SaveAndReOpenFile ( )

Definition at line 470 of file cdbfile.cpp.

{
  void * pFileMapOld = m_pFileMap;
  int nFileSize = m_pbEOF - (char *)m_pFileMap + 1;

  // commit data to disk
  BOOL bSuccess = FlushViewOfFile(m_pFileMap, nFileSize);
  if (!bSuccess)
    return DBFILE_FLUSH_ERROR;

  pFileMapOld = m_pFileMap;

  UnmapViewOfFile(m_pFileMap);

  CloseHandle(m_hMapFile);

  SetFilePointer(m_hFile, nFileSize, NULL, FILE_BEGIN);

  SetEndOfFile(m_hFile);
  // CloseHandle(m_hFile);  don't actually close file

  // re-open and adjust row objects based on a new adjust potentially
  m_hMapFile = CreateFileMapping(m_hFile, NULL, PAGE_READWRITE, 0, 0, NULL);
  if (m_hMapFile == NULL)
  {
    OUT_LINE_FILE();
    return false;
  }

  // Create just one view of the memory-mapped file
  m_pFileMap = MapViewOfFile(m_hMapFile, FILE_MAP_ALL_ACCESS, 0, 0, 0);
  if (m_pFileMap == NULL)
  {
    OUT_LINE_FILE();
    return false;
  }

  // Check to see if the mapping address has changed.  If it has, must recalculate all
  // CRow objects.
  if (m_pFileMap != pFileMapOld)
  {
    // calculate adjustment
    long nAdjustment = (long)m_pFileMap - (long)pFileMapOld;

    int nSize = m_Rows.GetSize();
    for (int iRow = 0; iRow < nSize; iRow++)
    {
      m_Rows[iRow]->m_pbStartLoc += nAdjustment;
    }

    m_pbEOF += nAdjustment;
  }

  return true;
}

HRESULT CDBFile::UpdateRowImmediate | ( | CRow * | pRow,
 |  | ATLCOLUMNINFO * | pColInfo,
 |  | ULONG | ulCols
 | ) |  |

Definition at line 377 of file cdbfile.cpp.

{
  // TODO: currently we are updating the lazy way  - just take and move everything to make
  // space or shrink the row.
  //
  //  If the updated row is smaller than it was before, we will fill the rest of the row with white
  //  space as we will strip off any white space in the reading of the row.
  //
  //  If the updated row is larger than the existing row, we move everything to make
  //  space.  Other algorithms, could be used which wouldn't cause the shuffling of all of the
  //  data but this would probably mean some kind of mechanism of marking rows as deleted.
  //  TODO: need to revist this
  bool bAddEOLtoEOF= false;
  bool bModifyEOF = false;
  ULONG ulBytesNeeded;
  ULONG ulBytesToDelete = 0;
  HRESULT hr = S_OK;

  if ((ulBytesNeeded = pRow->CalculateRowData(prgColInfo, ulCols) )> 0)
  {
    if ( !(pRow->HasEOL((BYTE*)m_pbEOF)) )
    {
      ulBytesNeeded += 2;  // add space needed to add a \r\n which may not be there
                // if this is the last row
      bAddEOLtoEOF = true;
    }
    // Accomodate pre-existing EOL which is not part of the data
    ULONG ulBytesToMove  = 0;
    ulBytesToMove = (ULONG)m_pbEOF - (ULONG)(pRow->m_pbStartLoc + pRow->m_cbRowSize) + 1;

    // need to make space for updated row
    ExpandFileAndAdjustRowObjects(ulBytesNeeded,EXPAND_FILE);
    if(true== bAddEOLtoEOF)
    {
      *(m_pbEOF-1) = '\r';
      *m_pbEOF = '\n';
    }
    // end of current row
    BYTE * pbEOR = NULL;
      pbEOR =  (BYTE *)pRow->m_pbStartLoc + pRow->m_cbRowSize;
    // Move rows to make room for new row
    //Move bytes from end of row to EOF - ulBytesNeeded
    memmove(pbEOR + ulBytesNeeded, pbEOR, ulBytesToMove);
  }
  // If the data updated is less-than previously - implode the data
  else if (0 == ulBytesNeeded )
  {
    // This ulBytesNeeded has to be positive
    ulBytesToDelete = pRow->CalculateRowDataToDelete(prgColInfo, ulCols);
    if(true == m_Rows[m_Rows.m_nSize-1]->HasEOL((BYTE*) m_pbEOF) )
      bModifyEOF = true;

    // Accomodate pre-existing EOL which is not part of the data
    ULONG ulBytesToMove  = 0;
    ulBytesToMove = (ULONG)m_pbEOF - (ULONG)(pRow->m_pbStartLoc + pRow->m_cbRowSize) + 1;

    char*pprevEOF = m_pbEOF;
    ExpandFileAndAdjustRowObjects(ulBytesToDelete, CONTRACT_FILE);

    BYTE * pbEOR = NULL;
    pbEOR =  (BYTE *)pRow->m_pbStartLoc + pRow->m_cbRowSize;
    //Move bytes from end of row to EOF - ulBytesNeeded
    memmove(pbEOR - ulBytesToDelete, pbEOR, ulBytesToMove);
    if(   (ULONG)( pprevEOF - m_pbEOF) == ulBytesToDelete) // The file was not reallocated....
    {  // Since no new memory was allocated for the data
      // there could junk between the current (smaller) EOF and the prev EOF...
      // This could be picked up when writing the file
      memset(m_pbEOF+1, 0, ulBytesToDelete);
    }
  }
   // If the Number of Bytes required are in Error !!!
  else if(ulBytesNeeded < 0)
      return DB_E_DATAOVERFLOW;

  // now that there is space allocated, simply dump the row's data
  pRow->Update(prgColInfo, ulCols); // write the data to the file
  // The Start Location of all the remaining Rows need to be updated...
  if(ulBytesNeeded > 0)
    for(long iRow = pRow->m_bmk; iRow< m_Rows.m_nSize; iRow++)
      m_Rows[iRow]->m_pbStartLoc += ulBytesNeeded;
   else if(0 == ulBytesNeeded)
     for(long iRow = pRow->m_bmk; iRow< m_Rows.m_nSize; iRow++)
      m_Rows[iRow]->m_pbStartLoc -= ulBytesToDelete;

  // commit data to disk
  BOOL bSuccess = FlushViewOfFile(m_pFileMap, m_pbEOF - (char *)m_pFileMap + 1);
  if (!bSuccess)
    return E_OUTOFMEMORY;  // This is a generic error message for the present
//    return DBFILE_FLUSH_ERROR;
  return 0;
}

Member Data Documentation

bool CDBFile::m_bClosed

Definition at line 82 of file cdbfile.h.

int CDBFile::m_cCols

Definition at line 80 of file cdbfile.h.

HANDLE CDBFile::m_hFile

Definition at line 47 of file cdbfile.h.

HANDLE CDBFile::m_hMapFile

Definition at line 48 of file cdbfile.h.

char* CDBFile::m_pbCurrentPos

Definition at line 51 of file cdbfile.h.

char* CDBFile::m_pbEOF

Definition at line 50 of file cdbfile.h.

LPVOID CDBFile::m_pFileMap

Definition at line 49 of file cdbfile.h.

ATLCOLUMNINFO* CDBFile::m_prgColInfo

Definition at line 79 of file cdbfile.h.

CSimpleArray<CRow *> CDBFile::m_Rows

Definition at line 53 of file cdbfile.h.

TCHAR CDBFile::m_szTblNm[MAX_TABLE_NAME_SIZE]

Definition at line 81 of file cdbfile.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/omniprov/source/cdbfile.h
  • Dataaccess/oledb/omniprov/source/cdbfile.cpp
Generated on Wed Nov 13 2024 16:56:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDBSession Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Protected Attributes | Friends

CDBSession Class Reference

#include "dbsess.h"

Inherits CBaseObj.

List of all members.

Public Member Functions

CDBSession (LPUNKNOWN)
~CDBSession (void)
BOOL | FInit (CDataSource *pCDataSource)
STDMETHODIMP | QueryInterface (REFIID, LPVOID *)
STDMETHODIMP_ (DBREFCOUNT) AddRef(void)
STDMETHODIMP_ (DBREFCOUNT) Release(void)

Public Attributes

PCDATASOURCE m_pCDataSource

Protected Attributes

DBREFCOUNT | m_cRef
PIMPIBINDRESOURCE m_pIBindResource
PIMPIDBCREATECOMMAND m_pIDBCreateCommand
PIMPIGETDATASOURCE m_pIGetDataSource
PIMPIOPENROWSET m_pIOpenRowset
PIMPISESSIONPROPERTIES m_pISessionProperties
PCUTILPROP m_pUtilProp

Friends

class | CImpIBindResource
class | CImpICreateCommand
class | CImpIDataSource
class | CImpIGetDataSource
class | CImpIOpenRowset
class | CImpISessionProperties

Detailed Description

Definition at line 38 of file dbsess.h.

Constructor & Destructor Documentation

CDBSession::CDBSession ( LPUNKNOWN pUnkOuter )

Definition at line 25 of file dbsess.cpp.

  : CBaseObj( BOT_SESSION )
{
    //
  // Initialize simple member vars
  //
    m_cRef                = 0L;
  m_pUnkOuter       = pUnkOuter ? pUnkOuter : this;
    m_pUtilProp       = NULL;

    //
    // Initially, NULL all contained interfaces
    //
    m_pIGetDataSource   = NULL;
    m_pIOpenRowset      = NULL;
  m_pISessionProperties = NULL;
  m_pIDBCreateCommand   = NULL;
  m_pIBindResource      = NULL;

    //
  // Pointer to parent object
    //
  m_pCDataSource      = NULL;

    //
    // Increment global object count.
    //
    OBJECT_CONSTRUCTED();
    return;
}

CDBSession::~CDBSession ( void )

Definition at line 66 of file dbsess.cpp.

{
  //
  // Asserts
    //
  assert(m_pCDataSource);
  assert(m_pCDataSource->m_pUnkOuter);

    //
    // Free properties management object
    //
    SAFE_DELETE(m_pUtilProp);

    //
    // Free contained interfaces
    //
    SAFE_DELETE(m_pIGetDataSource);
    SAFE_DELETE(m_pIOpenRowset);
    SAFE_DELETE(m_pISessionProperties);
  SAFE_DELETE(m_pIDBCreateCommand);
  SAFE_DELETE(m_pIBindResource);

    //
    // Release the Data Source Object
    //
  m_pCDataSource->RemoveSession();
  m_pCDataSource->m_pUnkOuter->Release();

    //
    // Decrement global object count.
    //
    OBJECT_DESTRUCTED();
    return;
}

Member Function Documentation

BOOL CDBSession::FInit ( CDataSource * pCDataSource )

Definition at line 113 of file dbsess.cpp.

{
  //
  // Asserts
    //
  assert(pCDataSource);

  //
  // Establish parent object pointer
  //
  m_pCDataSource = pCDataSource;
  m_pCDataSource->m_pUnkOuter->AddRef();

  //
    // Allocate properties management object
  //
    m_pUtilProp = new CUtilProp();

    // Allocate contained interface objects
    m_pIOpenRowset      = new CImpIOpenRowset(this, m_pUnkOuter);
    m_pIGetDataSource   = new CImpIGetDataSource(this, m_pUnkOuter);
  m_pIDBCreateCommand   = new CImpIDBCreateCommand(this, m_pUnkOuter);
    m_pISessionProperties = new CImpISessionProperties(this, m_pUnkOuter);
  m_pIBindResource    = new CImpIBindResource(this, m_pUnkOuter);

    return (BOOL)(m_pUtilProp && m_pIGetDataSource && m_pIOpenRowset &&
              m_pISessionProperties && m_pIDBCreateCommand &&
          m_pIBindResource);
}

STDMETHODIMP CDBSession::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 159 of file dbsess.cpp.

{
    //
    // Check in-params and NULL out-params in case of error
    //
    if( !ppv )
        return (E_INVALIDARG);

    //
    //  This is the non-delegating IUnknown implementation
    //
    if( riid == IID_IUnknown )
        *ppv = (LPVOID) this;
    else if( riid == IID_IGetDataSource )
        *ppv = (LPVOID) m_pIGetDataSource;
    else if( riid == IID_IOpenRowset )
        *ppv = (LPVOID) m_pIOpenRowset;
    else if( riid == IID_ISessionProperties )
        *ppv = (LPVOID) m_pISessionProperties;
  else if( riid == IID_IDBCreateCommand )
    *ppv = (LPVOID) m_pIDBCreateCommand;
  else if( riid == IID_IBindResource )
    *ppv = (LPVOID) m_pIBindResource;
    else {
        *ppv = NULL;
        return (E_NOINTERFACE);
    }

  ((LPUNKNOWN) *ppv)->AddRef();
    return (S_OK);
}

CDBSession::STDMETHODIMP_ ( DBREFCOUNT )
CDBSession::STDMETHODIMP_ ( DBREFCOUNT )

Friends And Related Function Documentation

friend class CImpIBindResource [friend]

Definition at line 46 of file dbsess.h.

friend class CImpICreateCommand [friend]

Definition at line 45 of file dbsess.h.

friend class CImpIDataSource [friend]

Definition at line 43 of file dbsess.h.

friend class CImpIGetDataSource [friend]

Definition at line 41 of file dbsess.h.

friend class CImpIOpenRowset [friend]

Definition at line 42 of file dbsess.h.

friend class CImpISessionProperties [friend]

Definition at line 44 of file dbsess.h.

Member Data Documentation

DBREFCOUNT CDBSession::m_cRef [protected]

Definition at line 50 of file dbsess.h.

PCDATASOURCE CDBSession::m_pCDataSource

Definition at line 77 of file dbsess.h.

PIMPIBINDRESOURCE CDBSession::m_pIBindResource [protected]

Definition at line 68 of file dbsess.h.

PIMPIDBCREATECOMMAND CDBSession::m_pIDBCreateCommand [protected]

Definition at line 65 of file dbsess.h.

PIMPIGETDATASOURCE CDBSession::m_pIGetDataSource [protected]

Definition at line 59 of file dbsess.h.

PIMPIOPENROWSET CDBSession::m_pIOpenRowset [protected]

Definition at line 56 of file dbsess.h.

PIMPISESSIONPROPERTIES CDBSession::m_pISessionProperties [protected]

Definition at line 62 of file dbsess.h.

PCUTILPROP CDBSession::m_pUtilProp [protected]

Definition at line 53 of file dbsess.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/sampprov/dbsess.h
  • Dataaccess/oledb/sampprov/dbsess.cpp
Generated on Wed Nov 13 2024 16:56:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDefClassFactory Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

CDefClassFactory Struct Reference

List of all members.

Public Attributes

IClassFactory | cf
UINT cRef
LPFNCREATEINSTANCE | lpfnCI
UINT FAR * | pcRefDll
const IID FAR * | riidInst

Detailed Description

Definition at line 46 of file DefClsF.C.

Member Data Documentation

IClassFactory CDefClassFactory::cf

Definition at line 48 of file DefClsF.C.

UINT CDefClassFactory::cRef

Definition at line 49 of file DefClsF.C.

LPFNCREATEINSTANCE CDefClassFactory::lpfnCI

Definition at line 50 of file DefClsF.C.

UINT FAR* CDefClassFactory::pcRefDll

Definition at line 51 of file DefClsF.C.

const IID FAR* CDefClassFactory::riidInst

Definition at line 52 of file DefClsF.C.

The documentation for this struct was generated from the following file:
  • WinUI/Shell/DropExt/DefClsF.C
Generated on Wed Nov 13 2024 16:56:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDelegationBase Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Attributes | Static Private Attributes

CDelegationBase Class Reference

#include "delebase.h"

Inherited by CBackground, CBackground, CBackground, CBackgroundFolder, CBackgroundFolder, CBackgroundFolder, CBicycle, CBicycle, CBicycle, CBicycle, CBicycle, CBicycle, CBicycle, CBicycle, CBicycle, CBicycle, CBicycle, CBicycle, CBicycleFolder, CBicycleFolder, CBicycleFolder, CBicycleFolder, CBicycleFolder, CBicycleFolder, CBicycleFolder, CBicycleFolder, CBicycleFolder, CBicycleFolder, CBicycleFolder, CBicycleFolder, CIceSkate, CIceSkate, CIceSkate, CIceSkate, CIceSkate, CIceSkate, CIceSkate, CIceSkate, CIceSkate, CIceSkate, CIceSkate, CIceSkate, CIceSkateFolder, CIceSkateFolder, CIceSkateFolder, CIceSkateFolder, CIceSkateFolder, CIceSkateFolder, CIceSkateFolder, CIceSkateFolder, CIceSkateFolder, CIceSkateFolder, CIceSkateFolder, CIceSkateFolder, CLandBasedVehicle, CLandBasedVehicle, CLandBasedVehicle, CLandBasedVehicle, CLandBasedVehicle, CLandBasedVehicle, CLandBasedVehicle, CLandBasedVehicle, CLandBasedVehicle, CLandBasedVehicle, CLandBasedVehicle, CLandBasedVehicle, CLandBasedVehicle, CPeoplePoweredVehicle, CPeoplePoweredVehicle, CPeoplePoweredVehicle, CPeoplePoweredVehicle, CPeoplePoweredVehicle, CPeoplePoweredVehicle, CPeoplePoweredVehicle, CPeoplePoweredVehicle, CPeoplePoweredVehicle, CPeoplePoweredVehicle, CPeoplePoweredVehicle, CPeoplePoweredVehicle, CPeoplePoweredVehicle, CPerson, CPlane, CRocket, CRocket, CRocket, CRocket, CRocket, CRocket, CRocket, CRocket, CRocket, CRocket, CRocket, CRocket, CRocket, CSkateboard, CSkateboard, CSkateboard, CSkateboard, CSkateboard, CSkateboard, CSkateboard, CSkateboard, CSkateboard, CSkateboard, CSkateboard, CSkateboard, CSkateboardFolder, CSkateboardFolder, CSkateboardFolder, CSkateboardFolder, CSkateboardFolder, CSkateboardFolder, CSkateboardFolder, CSkateboardFolder, CSkateboardFolder, CSkateboardFolder, CSkateboardFolder, CSkateboardFolder, CSkyBasedVehicle, CSkyBasedVehicle, CSkyBasedVehicle, CSkyBasedVehicle, CSkyBasedVehicle, CSkyBasedVehicle, CSkyBasedVehicle, CSkyBasedVehicle, CSkyBasedVehicle, CSkyBasedVehicle, CSkyBasedVehicle, CSkyBasedVehicle, CSkyBasedVehicle, CSkyVehicle, CSpaceFolder, CSpaceFolder, CSpaceStation, CSpaceStation, CSpaceVehicle, CSpaceVehicle, CSpaceVehicle, CSpaceVehicle, CSpaceVehicle, CSpaceVehicle, CSpaceVehicle, CSpaceVehicle, CSpaceVehicle, CSpaceVehicle, CSpaceVehicle, CStaticNode, CStaticNode, CStaticNode, CStaticNode, CStaticNode, CStaticNode, CStaticNode, CStaticNode, CStaticNode, CStaticNode, CStaticNode, CStaticNode, CStaticNode, CStaticNode, CStaticNode, and CStaticNode.

List of all members.

Public Member Functions

CDelegationBase ()
CDelegationBase ()
CDelegationBase ()
CDelegationBase ()
CDelegationBase ()
CDelegationBase ()
CDelegationBase ()
CDelegationBase ()
CDelegationBase ()
CDelegationBase ()
CDelegationBase ()
CDelegationBase ()
CDelegationBase ()
CDelegationBase ()
CDelegationBase ()
CDelegationBase ()
CDelegationBase ()
virtual | ~CDelegationBase ()
virtual | ~CDelegationBase ()
virtual | ~CDelegationBase ()
virtual | ~CDelegationBase ()
virtual | ~CDelegationBase ()
virtual | ~CDelegationBase ()
virtual | ~CDelegationBase ()
virtual | ~CDelegationBase ()
virtual | ~CDelegationBase ()
virtual | ~CDelegationBase ()
virtual | ~CDelegationBase ()
virtual | ~CDelegationBase ()
virtual | ~CDelegationBase ()
virtual | ~CDelegationBase ()
virtual | ~CDelegationBase ()
virtual | ~CDelegationBase ()
virtual | ~CDelegationBase ()
virtual HRESULT | AddImages (IImageList *pImageList, HSCOPEITEM hsi)
virtual HRESULT | CreatePropertyPages (IPropertySheetCallback *lpProvider, LONG_PTR handle)
virtual HRESULT | CreatePropertyPages (IPropertySheetCallback *lpProvider, LONG_PTR handle)
virtual HRESULT | CreatePropertyPages (IPropertySheetCallback *lpProvider, LONG_PTR handle)
virtual HRESULT | CreatePropertyPages (IPropertySheetCallback *lpProvider, LONG_PTR handle)
virtual HRESULT | Expand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
virtual const int | GetBitmapIndex ()=0
virtual const int | GetBitmapIndex ()=0
virtual const int | GetBitmapIndex ()=0
virtual const int | GetBitmapIndex ()=0
virtual const int | GetBitmapIndex ()=0
virtual const int | GetBitmapIndex ()=0
virtual const int | GetBitmapIndex ()=0
virtual const int | GetBitmapIndex ()=0
virtual const int | GetBitmapIndex ()=0
virtual const int | GetBitmapIndex ()=0
virtual const int | GetBitmapIndex ()=0
virtual const int | GetBitmapIndex ()=0
virtual const int | GetBitmapIndex ()=0
virtual const int | GetBitmapIndex ()=0
virtual const int | GetBitmapIndex ()=0
virtual const int | GetBitmapIndex ()=0
virtual const int | GetBitmapIndex ()=0
virtual void | GetChildColumnInfo (RESULTDATAITEM *rdi)
virtual void | GetChildColumnInfo (RESULTDATAITEM *rdi)
virtual void | GetChildColumnInfo (RESULTDATAITEM *rdi)
virtual CDelegationBase * | GetChildPtr (int index)
virtual CDelegationBase * | GetChildPtr (int index)
virtual CDelegationBase * | GetChildPtr (int index)
virtual const LPARAM | GetCookie ()
virtual const LPARAM | GetCookie ()
virtual const LPARAM | GetCookie ()
virtual const LPARAM | GetCookie ()
virtual const LPARAM | GetCookie ()
virtual const LPARAM | GetCookie ()
virtual const LPARAM | GetCookie ()
virtual const LPARAM | GetCookie ()
virtual const LPARAM | GetCookie ()
virtual const LPARAM | GetCookie ()
virtual const LPARAM | GetCookie ()
virtual const LPARAM | GetCookie ()
virtual const LPARAM | GetCookie ()
virtual const LPARAM | GetCookie ()
virtual const LPARAM | GetCookie ()
virtual const LPARAM | GetCookie ()
virtual const LPARAM | GetCookie ()
virtual const _TCHAR * | GetDisplayName (int nCol=0)=0
virtual const _TCHAR * | GetDisplayName (int nCol=0)=0
virtual const _TCHAR * | GetDisplayName (int nCol=0)=0
virtual const _TCHAR * | GetDisplayName (int nCol=0)=0
virtual const _TCHAR * | GetDisplayName (int nCol=0)=0
virtual const _TCHAR * | GetDisplayName (int nCol=0)=0
virtual const _TCHAR * | GetDisplayName (int nCol=0)=0
virtual const _TCHAR * | GetDisplayName (int nCol=0)=0
virtual const _TCHAR * | GetDisplayName (int nCol=0)=0
virtual const _TCHAR * | GetDisplayName (int nCol=0)=0
virtual const _TCHAR * | GetDisplayName (int nCol=0)=0
virtual const _TCHAR * | GetDisplayName (int nCol=0)=0
virtual const _TCHAR * | GetDisplayName (int nCol=0)=0
virtual const _TCHAR * | GetDisplayName (int nCol=0)=0
virtual const _TCHAR * | GetDisplayName (int nCol=0)=0
virtual const _TCHAR * | GetDisplayName (int nCol=0)=0
virtual const _TCHAR * | GetDisplayName (int nCol=0)=0
HANDLE GetHandle ()
HANDLE GetHandle ()
virtual const HANDLE | GetHandle ()
virtual HRESULT | GetListpadInfo (MMC_LISTPAD_INFO *lpListPadInfo)
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual HSCOPEITEM | GetParentScopeItem ()
virtual HRESULT | GetResultViewType (LPOLESTR *ppViewType, long *pViewOptions)
virtual HRESULT | GetResultViewType (LPOLESTR *ppViewType, long *pViewOptions)
virtual HRESULT | GetResultViewType (LPOLESTR *ppViewType, long *pViewOptions)
virtual HRESULT | GetResultViewType (LPOLESTR *ppViewType, long *pViewOptions)
virtual HRESULT | GetResultViewType (LPOLESTR *ppViewType, long *pViewOptions)
virtual HRESULT | GetResultViewType (LPOLESTR *ppViewType, long *pViewOptions)
virtual HRESULT | GetResultViewType (LPOLESTR *ppViewType, long *pViewOptions)
virtual HRESULT | GetResultViewType (LPOLESTR *ppViewType, long *pViewOptions)
virtual HRESULT | GetResultViewType (LPOLESTR *ppViewType, long *pViewOptions)
virtual HRESULT | GetResultViewType (LPOLESTR *ppViewType, long *pViewOptions)
virtual HRESULT | GetResultViewType (LPOLESTR *ppViewType, long *pViewOptions)
virtual HRESULT | GetResultViewType (LPOLESTR *ppViewType, long *pViewOptions)
virtual HRESULT | GetResultViewType (LPOLESTR *ppViewType, long *pViewOptions)
virtual HRESULT | GetResultViewType (LPOLESTR *ppViewType, long *pViewOptions)
virtual HRESULT | GetResultViewType (LPOLESTR *ppViewType, long *pViewOptions)
virtual HRESULT | GetResultViewType (LPOLESTR *ppViewType, long *pViewOptions)
virtual HRESULT | GetResultViewType (LPOLESTR *ppViewType, long *pViewOptions)
virtual MMC_TASK * | GetTaskList (LPOLESTR szTaskGroup, LONG *nCount)
virtual HRESULT | GetTaskpadBackground (MMC_TASK_DISPLAY_OBJECT *pTDO)
virtual HRESULT | GetTaskpadDescription (LPOLESTR *pszDescription)
virtual HRESULT | GetTaskpadTitle (LPOLESTR *pszTitle)
virtual HRESULT | GetWatermarks (HBITMAP *lphWatermark, HBITMAP *lphHeader, HPALETTE *lphPalette, BOOL *bStretch)
virtual HRESULT | GetWatermarks (HBITMAP *lphWatermark, HBITMAP *lphHeader, HPALETTE *lphPalette, BOOL *bStretch)
virtual HRESULT | GetWatermarks (HBITMAP *lphWatermark, HBITMAP *lphHeader, HPALETTE *lphPalette, BOOL *bStretch)
virtual HRESULT | GetWatermarks (HBITMAP *lphWatermark, HBITMAP *lphHeader, HPALETTE *lphPalette, BOOL *bStretch)
virtual HRESULT | HasPropertySheets ()
virtual HRESULT | HasPropertySheets ()
virtual HRESULT | HasPropertySheets ()
virtual HRESULT | HasPropertySheets ()
virtual HRESULT | InitOCX (IUnknown *pUnknown)
virtual HRESULT | OnAddImages (IImageList *pImageList, HSCOPEITEM hsi)
virtual HRESULT | OnAddImages (IImageList *pImageList, HSCOPEITEM hsi)
virtual HRESULT | OnAddImages (IImageList *pImageList, HSCOPEITEM hsi)
virtual HRESULT | OnAddImages (IImageList *pImageList, HSCOPEITEM hsi)
virtual HRESULT | OnAddImages (IImageList *pImageList, HSCOPEITEM hsi)
virtual HRESULT | OnAddImages (IImageList *pImageList, HSCOPEITEM hsi)
virtual HRESULT | OnAddImages (IImageList *pImageList, HSCOPEITEM hsi)
virtual HRESULT | OnAddImages (IImageList *pImageList, HSCOPEITEM hsi)
virtual HRESULT | OnAddImages (IImageList *pImageList, HSCOPEITEM hsi)
virtual HRESULT | OnAddImages (IImageList *pImageList, HSCOPEITEM hsi)
virtual HRESULT | OnAddImages (IImageList *pImageList, HSCOPEITEM hsi)
virtual HRESULT | OnAddImages (IImageList *pImageList, HSCOPEITEM hsi)
virtual HRESULT | OnAddImages (IImageList *pImageList, HSCOPEITEM hsi)
virtual HRESULT | OnAddMenuItems (IContextMenuCallback *pContextMenuCallback, long *pInsertionsAllowed)
virtual HRESULT | OnAddMenuItems (IContextMenuCallback *pContextMenuCallback, long *pInsertionsAllowed)
virtual HRESULT | OnAddMenuItems (IContextMenuCallback *pContextMenuCallback, long *pInsertionsAllowed)
virtual HRESULT | OnButtonClicked (CComponent *pComponent)
virtual HRESULT | OnDelete (IConsole *pConsole)
virtual HRESULT | OnDelete (IConsole *pConsole)
virtual HRESULT | OnDelete (IConsole *pConsoleComp)
virtual HRESULT | OnDeleteScopeItem (IConsoleNameSpace *pConsoleNameSpace)
virtual HRESULT | OnExpand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
virtual HRESULT | OnExpand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
virtual HRESULT | OnExpand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
virtual HRESULT | OnExpand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
virtual HRESULT | OnExpand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
virtual HRESULT | OnExpand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
virtual HRESULT | OnExpand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
virtual HRESULT | OnExpand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
virtual HRESULT | OnExpand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
virtual HRESULT | OnExpand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
virtual HRESULT | OnExpand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
virtual HRESULT | OnExpand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
virtual HRESULT | OnExpand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
virtual HRESULT | OnListpad (IConsole *pConsole, BOOL bAttaching)
virtual HRESULT | OnMenuButtonCommand (IConsole *pConsole, int nMenuId, long lCommandID)
virtual HRESULT | OnMenuCommand (IConsole *pConsole, IConsoleNameSpace *pConsoleNameSpace, long lCommandID, IDataObject *piDataObject)
virtual HRESULT | OnMenuCommand (IConsole *pConsole, long lCommandID)
virtual HRESULT | OnMenuCommand (IConsole *pConsole, long lCommandID)
virtual HRESULT | OnPaste (IConsole *pConsole, CComponentData *pComponentData, CDelegationBase *pPasted)
virtual HRESULT | OnPropertyChange (IConsole *pConsole)
virtual HRESULT | OnPropertyChange (IConsole *pConsole, CComponent *pComponent)
virtual HRESULT | OnPropertyChange (IConsole *pConsole)
virtual HRESULT | OnQueryPaste (CDelegationBase *pPasted)
virtual HRESULT | OnRefresh (IConsole *pConsole)
virtual HRESULT | OnRefresh ()
virtual HRESULT | OnRefresh (IConsole *pConsole)
virtual HRESULT | OnRefresh (IConsole *pConsole)
virtual HRESULT | OnRename (LPOLESTR pszNewName)
virtual HRESULT | OnRename (LPOLESTR pszNewName)
virtual HRESULT | OnRename (LPOLESTR pszNewName)
virtual HRESULT | OnRename (LPOLESTR pszNewName)
virtual HRESULT | OnRename (LPOLESTR pszNewName)
virtual HRESULT | OnRename (LPOLESTR pszNewName)
virtual HRESULT | OnRename (LPOLESTR pszNewName)
virtual HRESULT | OnRename (LPOLESTR pszNewName)
virtual HRESULT | OnRename (LPOLESTR pszNewName)
virtual HRESULT | OnSelect (CComponent *pComponent, BOOL bScope, BOOL bSelect)
virtual HRESULT | OnSelect (IConsole *pConsole, BOOL bScope, BOOL bSelect)
virtual HRESULT | OnSelect (IConsole *pConsole, BOOL bScope, BOOL bSelect)
virtual HRESULT | OnSelect (IConsole *pConsole, BOOL bScope, BOOL bSelect)
virtual HRESULT | OnSelect (IConsole *pConsole, BOOL bScope, BOOL bSelect)
virtual HRESULT | OnSelect (IConsole *pConsole, BOOL bScope, BOOL bSelect)
virtual HRESULT | OnSelect (IConsole *pConsole, BOOL bScope, BOOL bSelect)
virtual HRESULT | OnSelect (IConsole *pConsole, BOOL bScope, BOOL bSelect)
virtual HRESULT | OnSelect (CComponent *pComponent, IConsole *pConsole, BOOL bScope, BOOL bSelect)
virtual HRESULT | OnSelect (IConsole *pConsole, BOOL bScope, BOOL bSelect)
virtual HRESULT | OnSelect (IConsole *pConsole, BOOL bScope, BOOL bSelect)
virtual HRESULT | OnSetMenuButton (IConsole *pConsole, MENUBUTTONDATA *pmbd)
virtual HRESULT | OnSetToolbar (IControlbar *pControlbar, IToolbar *pToolbar, BOOL bScope, BOOL bSelect)
virtual HRESULT | OnSetToolbar (CComponent *pComponent, IControlbar *pControlbar, IToolbar *pToolbar, BOOL bScope, BOOL bSelect)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShowContextHelp (IDisplayHelp *m_ipDisplayHelp, LPOLESTR helpFile)
virtual HRESULT | OnShowContextHelp (IDisplayHelp *m_ipDisplayHelp, LPOLESTR helpFile)
virtual HRESULT | OnShowContextHelp (IDisplayHelp *m_ipDisplayHelp, LPOLESTR helpFile)
virtual HRESULT | OnShowContextHelp (IDisplayHelp *m_ipDisplayHelp, LPOLESTR helpFile)
virtual HRESULT | OnShowContextHelp (IDisplayHelp *m_ipDisplayHelp, LPOLESTR helpFile)
virtual HRESULT | OnToolbarCommand (CComponent *pComponent, IConsole *pConsole, MMC_CONSOLE_VERB verb)
virtual HRESULT | OnToolbarCommand (IConsole *pConsole, MMC_CONSOLE_VERB verb, IDataObject *pDataObject)
virtual HRESULT | OnUpdateItem (IConsole *pConsole, long item, ITEM_TYPE itemtype)
virtual HRESULT | OnUpdateItem (IConsole *pConsole, long item, ITEM_TYPE itemtype)
virtual HRESULT | OnUpdateItem (IConsole *pConsole, long item, ITEM_TYPE itemtype)
virtual HRESULT | Select (IConsole *pConsole, BOOL bScope, BOOL bSelect)
virtual HRESULT | SelectItem (IConsole *pConsole)
virtual HRESULT | SelectItem (IConsole *pConsole)
void | SetComponentData (CComponentData *pComponentData)
void | SetComponentData (CComponentData *pComponentData)
virtual | SetHandle (HANDLE handle)
void | SetHandle (HANDLE handle)
void | SetHandle (HANDLE handle)
virtual HRESULT | SetMenuState (IControlbar *pControlbar, IMenuButton *pMenuButton, BOOL bScope, BOOL bSelect)
virtual void | SetScopeItemValue (HSCOPEITEM hscopeitem)
virtual HRESULT | Show (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | ShowContextHelp (IConsole *pConsole, IDisplayHelp *m_ipDisplayHelp, LPOLESTR helpFile)
virtual HRESULT | TaskNotify (IConsole *pConsole, VARIANT *v1, VARIANT *v2)

Public Attributes

HBITMAP | m_pBMapLg = NULL
HBITMAP | m_pBMapSm = NULL
CComponentData * m_pComponentData

Static Public Attributes

static HBITMAP | m_pBMapLg
static HBITMAP | m_pBMapSm

Protected Member Functions

void | LoadBitmaps ()

Static Protected Member Functions

static void | LoadBitmaps ()
static void | LoadBitmaps ()
static void | LoadBitmaps ()
static void | LoadBitmaps ()
static void | LoadBitmaps ()
static void | LoadBitmaps ()
static void | LoadBitmaps ()
static void | LoadBitmaps ()
static void | LoadBitmaps ()
static void | LoadBitmaps ()
static void | LoadBitmaps ()
static void | LoadBitmaps ()
static void | LoadBitmaps ()

Protected Attributes

BOOL bExpanded

Private Attributes

HANDLE m_handle

Static Private Attributes

static const GUID | thisGuid = { 0x2974380b, 0x4c4b, 0x11d2, { 0x89, 0xd8, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28 } }

Detailed Description

Definition at line 29 of file delebase.h.

Constructor & Destructor Documentation

CDelegationBase::CDelegationBase ( )

Definition at line 29 of file delebase.Cpp.

{

}

CDelegationBase::~CDelegationBase ( ) [virtual]

Definition at line 34 of file delebase.Cpp.

{
}

CDelegationBase::CDelegationBase ( )
virtual CDelegationBase::~CDelegationBase ( ) [virtual]
CDelegationBase::CDelegationBase ( )
virtual CDelegationBase::~CDelegationBase ( ) [virtual]
CDelegationBase::CDelegationBase ( )
virtual CDelegationBase::~CDelegationBase ( ) [virtual]
CDelegationBase::CDelegationBase ( )
virtual CDelegationBase::~CDelegationBase ( ) [virtual]
CDelegationBase::CDelegationBase ( )
virtual CDelegationBase::~CDelegationBase ( ) [virtual]
CDelegationBase::CDelegationBase ( )
virtual CDelegationBase::~CDelegationBase ( ) [virtual]
CDelegationBase::CDelegationBase ( )
virtual CDelegationBase::~CDelegationBase ( ) [virtual]
CDelegationBase::CDelegationBase ( )
virtual CDelegationBase::~CDelegationBase ( ) [virtual]
CDelegationBase::CDelegationBase ( )
virtual CDelegationBase::~CDelegationBase ( ) [virtual]
CDelegationBase::CDelegationBase ( )
virtual CDelegationBase::~CDelegationBase ( ) [virtual]
CDelegationBase::CDelegationBase ( )
virtual CDelegationBase::~CDelegationBase ( ) [virtual]
CDelegationBase::CDelegationBase ( )
virtual CDelegationBase::~CDelegationBase ( ) [virtual]
CDelegationBase::CDelegationBase ( )
virtual CDelegationBase::~CDelegationBase ( ) [virtual]
CDelegationBase::CDelegationBase ( )
virtual CDelegationBase::~CDelegationBase ( ) [virtual]
CDelegationBase::CDelegationBase ( )
virtual CDelegationBase::~CDelegationBase ( ) [virtual]
CDelegationBase::CDelegationBase ( )
virtual CDelegationBase::~CDelegationBase ( ) [virtual]

Member Function Documentation

HRESULT CDelegationBase::AddImages | ( | IImageList * | pImageList,
 |  | HSCOPEITEM | hsi |
 | ) |  |  | [virtual]

Definition at line 46 of file delebase.Cpp.

{
    return pImageList->ImageListSetStrip((long *)m_pBMapSm, // pointer to a handle
        (long *)m_pBMapLg, // pointer to a handle
        0, // index of the first image in the strip
        RGB(0, 128, 128)  // color of the icon mask
        );
}

virtual HRESULT CDelegationBase::CreatePropertyPages | ( | IPropertySheetCallback * | lpProvider,
 |  | LONG_PTR | handle |
 | ) |  |  | [inline, virtual]

Reimplemented in CRocket, CRocket, CStaticNode, CRocket, CBicycle, and CRocket.

Definition at line 59 of file delebase.h.

                         { return S_FALSE; }

virtual HRESULT CDelegationBase::CreatePropertyPages | ( | IPropertySheetCallback * | lpProvider,
 |  | LONG_PTR | handle |
 | ) |  |  | [inline, virtual]

Reimplemented in CRocket, CRocket, CStaticNode, CRocket, CBicycle, and CRocket.

Definition at line 52 of file delebase.h.

                         { return S_FALSE; }

virtual HRESULT CDelegationBase::CreatePropertyPages | ( | IPropertySheetCallback * | lpProvider,
 |  | LONG_PTR | handle |
 | ) |  |  | [inline, virtual]

Reimplemented in CRocket, CRocket, CStaticNode, CRocket, CBicycle, and CRocket.

Definition at line 50 of file delebase.h.

                         { return S_FALSE; }

virtual HRESULT CDelegationBase::CreatePropertyPages | ( | IPropertySheetCallback * | lpProvider,
 |  | LONG_PTR | handle |
 | ) |  |  | [inline, virtual]

Reimplemented in CRocket, CRocket, CStaticNode, CRocket, CBicycle, and CRocket.

Definition at line 50 of file delebase.h.

                         { return S_FALSE; }

virtual HRESULT CDelegationBase::Expand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [inline, virtual]

Reimplemented in CPeoplePoweredVehicle, and CStaticNode.

Definition at line 47 of file delebase.h.

{ return S_FALSE; }

virtual const int CDelegationBase::GetBitmapIndex ( ) [pure virtual]

Implemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

virtual const int CDelegationBase::GetBitmapIndex ( ) [pure virtual]

Implemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

virtual const int CDelegationBase::GetBitmapIndex ( ) [pure virtual]

Implemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

virtual const int CDelegationBase::GetBitmapIndex ( ) [pure virtual]

Implemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

virtual const int CDelegationBase::GetBitmapIndex ( ) [pure virtual]

Implemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

virtual const int CDelegationBase::GetBitmapIndex ( ) [pure virtual]

Implemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

virtual const int CDelegationBase::GetBitmapIndex ( ) [pure virtual]

Implemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

virtual const int CDelegationBase::GetBitmapIndex ( ) [pure virtual]

Implemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

virtual const int CDelegationBase::GetBitmapIndex ( ) [pure virtual]

Implemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

virtual const int CDelegationBase::GetBitmapIndex ( ) [pure virtual]

Implemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

virtual const int CDelegationBase::GetBitmapIndex ( ) [pure virtual]

Implemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

virtual const int CDelegationBase::GetBitmapIndex ( ) [pure virtual]

Implemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

virtual const int CDelegationBase::GetBitmapIndex ( ) [pure virtual]

Implemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

virtual const int CDelegationBase::GetBitmapIndex ( ) [pure virtual]

Implemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

virtual const int CDelegationBase::GetBitmapIndex ( ) [pure virtual]

Implemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

virtual const int CDelegationBase::GetBitmapIndex ( ) [pure virtual]

Implemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

virtual const int CDelegationBase::GetBitmapIndex ( ) [pure virtual]

Implemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

virtual void CDelegationBase::GetChildColumnInfo ( RESULTDATAITEM * rdi ) [inline, virtual]

Reimplemented in CIceSkateFolder, CIceSkateFolder, and CIceSkateFolder.

Definition at line 35 of file delebase.h.

{ }

virtual void CDelegationBase::GetChildColumnInfo ( RESULTDATAITEM * rdi ) [inline, virtual]

Reimplemented in CIceSkateFolder, CIceSkateFolder, and CIceSkateFolder.

Definition at line 37 of file delebase.h.

{ }

virtual void CDelegationBase::GetChildColumnInfo ( RESULTDATAITEM * rdi ) [inline, virtual]

Reimplemented in CIceSkateFolder, CIceSkateFolder, and CIceSkateFolder.

Definition at line 37 of file delebase.h.

{ }

virtual CDelegationBase* CDelegationBase::GetChildPtr ( int index ) [inline, virtual]

Reimplemented in CIceSkateFolder, CIceSkateFolder, and CIceSkateFolder.

Definition at line 41 of file delebase.h.

{ return NULL; }

virtual CDelegationBase* CDelegationBase::GetChildPtr ( int index ) [inline, virtual]

Reimplemented in CIceSkateFolder, CIceSkateFolder, and CIceSkateFolder.

Definition at line 43 of file delebase.h.

{ return NULL; }

virtual CDelegationBase* CDelegationBase::GetChildPtr ( int index ) [inline, virtual]

Reimplemented in CIceSkateFolder, CIceSkateFolder, and CIceSkateFolder.

Definition at line 43 of file delebase.h.

{ return NULL; }

virtual const LPARAM CDelegationBase::GetCookie ( ) [inline, virtual]

Definition at line 37 of file delebase.h.

{ return reinterpret_cast<LPARAM>(this); }

virtual const LPARAM CDelegationBase::GetCookie ( ) [inline, virtual]

Definition at line 37 of file delebase.h.

{ return reinterpret_cast<LPARAM>(this); }

virtual const LPARAM CDelegationBase::GetCookie ( ) [inline, virtual]

Definition at line 40 of file delebase.h.

{ return reinterpret_cast<LPARAM>(this); }

virtual const LPARAM CDelegationBase::GetCookie ( ) [inline, virtual]

Definition at line 38 of file delebase.h.

{ return reinterpret_cast<LPARAM>(this); }

virtual const LPARAM CDelegationBase::GetCookie ( ) [inline, virtual]

Definition at line 40 of file delebase.h.

{ return reinterpret_cast<LPARAM>(this); }

virtual const LPARAM CDelegationBase::GetCookie ( ) [inline, virtual]

Definition at line 37 of file delebase.h.

{ return reinterpret_cast<LPARAM>(this); }

virtual const LPARAM CDelegationBase::GetCookie ( ) [inline, virtual]

Definition at line 37 of file delebase.h.

{ return reinterpret_cast<LPARAM>(this); }

virtual const LPARAM CDelegationBase::GetCookie ( ) [inline, virtual]

Definition at line 37 of file delebase.h.

{ return reinterpret_cast<LPARAM>(this); }

virtual const LPARAM CDelegationBase::GetCookie ( ) [inline, virtual]

Definition at line 37 of file delebase.h.

{ return reinterpret_cast<LPARAM>(this); }

virtual const LPARAM CDelegationBase::GetCookie ( ) [inline, virtual]

Definition at line 37 of file deleBase.h.

{ return reinterpret_cast<LPARAM>(this); }

virtual const LPARAM CDelegationBase::GetCookie ( ) [inline, virtual]

Definition at line 37 of file delebase.h.

{ return reinterpret_cast<LPARAM>(this); }

virtual const LPARAM CDelegationBase::GetCookie ( ) [inline, virtual]

Definition at line 37 of file delebase.h.

{ return reinterpret_cast<LPARAM>(this); }

virtual const LPARAM CDelegationBase::GetCookie ( ) [inline, virtual]

Definition at line 37 of file delebase.h.

{ return reinterpret_cast<LPARAM>(this); }

virtual const LPARAM CDelegationBase::GetCookie ( ) [inline, virtual]

Definition at line 40 of file delebase.h.

{ return reinterpret_cast<LPARAM>(this); }

virtual const LPARAM CDelegationBase::GetCookie ( ) [inline, virtual]

Definition at line 40 of file delebase.h.

{ return reinterpret_cast<LPARAM>(this); }

virtual const LPARAM CDelegationBase::GetCookie ( ) [inline, virtual]

Definition at line 37 of file delebase.h.

{ return reinterpret_cast<LPARAM>(this); }

virtual const LPARAM CDelegationBase::GetCookie ( ) [inline, virtual]

Definition at line 40 of file delebase.h.

{ return reinterpret_cast<LPARAM>(this); }

virtual const _TCHAR* CDelegationBase::GetDisplayName ( int nCol = 0 ) [pure virtual]

Implemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

virtual const _TCHAR* CDelegationBase::GetDisplayName ( int nCol = 0 ) [pure virtual]

Implemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

virtual const _TCHAR* CDelegationBase::GetDisplayName ( int nCol = 0 ) [pure virtual]

Implemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

virtual const _TCHAR* CDelegationBase::GetDisplayName ( int nCol = 0 ) [pure virtual]

Implemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

virtual const _TCHAR* CDelegationBase::GetDisplayName ( int nCol = 0 ) [pure virtual]

Implemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

virtual const _TCHAR* CDelegationBase::GetDisplayName ( int nCol = 0 ) [pure virtual]

Implemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

virtual const _TCHAR* CDelegationBase::GetDisplayName ( int nCol = 0 ) [pure virtual]

Implemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

virtual const _TCHAR* CDelegationBase::GetDisplayName ( int nCol = 0 ) [pure virtual]

Implemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

virtual const _TCHAR* CDelegationBase::GetDisplayName ( int nCol = 0 ) [pure virtual]

Implemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

virtual const _TCHAR* CDelegationBase::GetDisplayName ( int nCol = 0 ) [pure virtual]

Implemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

virtual const _TCHAR* CDelegationBase::GetDisplayName ( int nCol = 0 ) [pure virtual]

Implemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

virtual const _TCHAR* CDelegationBase::GetDisplayName ( int nCol = 0 ) [pure virtual]

Implemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

virtual const _TCHAR* CDelegationBase::GetDisplayName ( int nCol = 0 ) [pure virtual]

Implemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

virtual const _TCHAR* CDelegationBase::GetDisplayName ( int nCol = 0 ) [pure virtual]

Implemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

virtual const _TCHAR* CDelegationBase::GetDisplayName ( int nCol = 0 ) [pure virtual]

Implemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

virtual const _TCHAR* CDelegationBase::GetDisplayName ( int nCol = 0 ) [pure virtual]

Implemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

virtual const _TCHAR* CDelegationBase::GetDisplayName ( int nCol = 0 ) [pure virtual]

Implemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

HANDLE CDelegationBase::GetHandle ( ) [inline]

Reimplemented in CBackground.

Definition at line 72 of file delebase.h.

{ return m_handle; }

virtual const HANDLE CDelegationBase::GetHandle ( ) [inline, virtual]

Reimplemented in CBackground.

Definition at line 39 of file delebase.h.

{ return m_handle; }

HANDLE CDelegationBase::GetHandle ( ) [inline]

Reimplemented in CBackground.

Definition at line 68 of file delebase.h.

{ return m_handle; }

virtual HRESULT CDelegationBase::GetListpadInfo ( MMC_LISTPAD_INFO * lpListPadInfo ) [inline, virtual]

Reimplemented in CBicycleFolder, CSkateboardFolder, and CIceSkateFolder.

Definition at line 57 of file delebase.h.

{ return S_FALSE; }

virtual const GUID& CDelegationBase::getNodeType ( ) [inline, virtual]

Reimplemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

Definition at line 35 of file delebase.h.

{ _ASSERT(FALSE); return IID_NULL; }

virtual const GUID& CDelegationBase::getNodeType ( ) [inline, virtual]

Reimplemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

Definition at line 35 of file delebase.h.

{ _ASSERT(FALSE); return IID_NULL; }

virtual const GUID& CDelegationBase::getNodeType ( ) [inline, virtual]

Reimplemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

Definition at line 38 of file delebase.h.

{ _ASSERT(FALSE); return IID_NULL; }

virtual const GUID& CDelegationBase::getNodeType ( ) [inline, virtual]

Reimplemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

Definition at line 36 of file delebase.h.

{ _ASSERT(FALSE); return IID_NULL; }

virtual const GUID& CDelegationBase::getNodeType ( ) [inline, virtual]

Reimplemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

Definition at line 35 of file delebase.h.

{ _ASSERT(FALSE); return IID_NULL; }

virtual const GUID& CDelegationBase::getNodeType ( ) [inline, virtual]

Reimplemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

Definition at line 35 of file delebase.h.

{ _ASSERT(FALSE); return IID_NULL; }

virtual const GUID& CDelegationBase::getNodeType ( ) [inline, virtual]

Reimplemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

Definition at line 35 of file delebase.h.

{ _ASSERT(FALSE); return IID_NULL; }

virtual const GUID& CDelegationBase::getNodeType ( ) [inline, virtual]

Reimplemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

Definition at line 35 of file delebase.h.

{ _ASSERT(FALSE); return IID_NULL; }

virtual const GUID& CDelegationBase::getNodeType ( ) [inline, virtual]

Reimplemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

Definition at line 38 of file delebase.h.

{ _ASSERT(FALSE); return IID_NULL; }

virtual const GUID& CDelegationBase::getNodeType ( ) [inline, virtual]

Reimplemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

Definition at line 35 of file delebase.h.

{ _ASSERT(FALSE); return IID_NULL; }

virtual const GUID& CDelegationBase::getNodeType ( ) [inline, virtual]

Reimplemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

Definition at line 35 of file delebase.h.

{ _ASSERT(FALSE); return IID_NULL; }

virtual const GUID& CDelegationBase::getNodeType ( ) [inline, virtual]

Reimplemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

Definition at line 35 of file deleBase.h.

{ _ASSERT(FALSE); return IID_NULL; }

virtual const GUID& CDelegationBase::getNodeType ( ) [inline, virtual]

Reimplemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

Definition at line 35 of file delebase.h.

{ _ASSERT(FALSE); return IID_NULL; }

virtual const GUID& CDelegationBase::getNodeType ( ) [inline, virtual]

Reimplemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

Definition at line 35 of file delebase.h.

{ _ASSERT(FALSE); return IID_NULL; }

virtual const GUID& CDelegationBase::getNodeType ( ) [inline, virtual]

Reimplemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

Definition at line 38 of file delebase.h.

{ _ASSERT(FALSE); return IID_NULL; }

virtual const GUID& CDelegationBase::getNodeType ( ) [inline, virtual]

Reimplemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

Definition at line 38 of file delebase.h.

{ _ASSERT(FALSE); return IID_NULL; }

virtual const GUID& CDelegationBase::getNodeType ( ) [inline, virtual]

Reimplemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceStation, CSpaceFolder, CStaticNode, CPlane, CSkyVehicle, CBackground, CBackgroundFolder, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CStaticNode, CLandBasedVehicle, CBicycleFolder, CBicycle, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, and CStaticNode.

Definition at line 38 of file delebase.h.

{ _ASSERT(FALSE); return IID_NULL; }

virtual HSCOPEITEM CDelegationBase::GetParentScopeItem ( ) [inline, virtual]

Reimplemented in CLandBasedVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CSpaceVehicle, and CStaticNode.

Definition at line 46 of file delebase.h.

{ _ASSERT(FALSE); return 0;}

virtual HRESULT CDelegationBase::GetResultViewType | ( | LPOLESTR * | ppViewType,
 |  | long * | pViewOptions |
 | ) |  |  | [inline, virtual]

Reimplemented in CPerson, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CIceSkateFolder, CSkyBasedVehicle, CBicycleFolder, CSkateboardFolder, and CIceSkateFolder.

Definition at line 40 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::GetResultViewType | ( | LPOLESTR * | ppViewType,
 |  | long * | pViewOptions |
 | ) |  |  | [inline, virtual]

Reimplemented in CPerson, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CIceSkateFolder, CSkyBasedVehicle, CBicycleFolder, CSkateboardFolder, and CIceSkateFolder.

Definition at line 43 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::GetResultViewType | ( | LPOLESTR * | ppViewType,
 |  | long * | pViewOptions |
 | ) |  |  | [inline, virtual]

Reimplemented in CPerson, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CIceSkateFolder, CSkyBasedVehicle, CBicycleFolder, CSkateboardFolder, and CIceSkateFolder.

Definition at line 43 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::GetResultViewType | ( | LPOLESTR * | ppViewType,
 |  | long * | pViewOptions |
 | ) |  |  | [inline, virtual]

Reimplemented in CPerson, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CIceSkateFolder, CSkyBasedVehicle, CBicycleFolder, CSkateboardFolder, and CIceSkateFolder.

Definition at line 42 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::GetResultViewType | ( | LPOLESTR * | ppViewType,
 |  | long * | pViewOptions |
 | ) |  |  | [inline, virtual]

Reimplemented in CPerson, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CIceSkateFolder, CSkyBasedVehicle, CBicycleFolder, CSkateboardFolder, and CIceSkateFolder.

Definition at line 43 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::GetResultViewType | ( | LPOLESTR * | ppViewType,
 |  | long * | pViewOptions |
 | ) |  |  | [inline, virtual]

Reimplemented in CPerson, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CIceSkateFolder, CSkyBasedVehicle, CBicycleFolder, CSkateboardFolder, and CIceSkateFolder.

Definition at line 40 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::GetResultViewType | ( | LPOLESTR * | ppViewType,
 |  | long * | pViewOptions |
 | ) |  |  | [inline, virtual]

Reimplemented in CPerson, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CIceSkateFolder, CSkyBasedVehicle, CBicycleFolder, CSkateboardFolder, and CIceSkateFolder.

Definition at line 40 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::GetResultViewType | ( | LPOLESTR * | ppViewType,
 |  | long * | pViewOptions |
 | ) |  |  | [inline, virtual]

Reimplemented in CPerson, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CIceSkateFolder, CSkyBasedVehicle, CBicycleFolder, CSkateboardFolder, and CIceSkateFolder.

Definition at line 40 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::GetResultViewType | ( | LPOLESTR * | ppViewType,
 |  | long * | pViewOptions |
 | ) |  |  | [inline, virtual]

Reimplemented in CPerson, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CIceSkateFolder, CSkyBasedVehicle, CBicycleFolder, CSkateboardFolder, and CIceSkateFolder.

Definition at line 40 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::GetResultViewType | ( | LPOLESTR * | ppViewType,
 |  | long * | pViewOptions |
 | ) |  |  | [inline, virtual]

Reimplemented in CPerson, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CIceSkateFolder, CSkyBasedVehicle, CBicycleFolder, CSkateboardFolder, and CIceSkateFolder.

Definition at line 40 of file deleBase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::GetResultViewType | ( | LPOLESTR * | ppViewType,
 |  | long * | pViewOptions |
 | ) |  |  | [inline, virtual]

Reimplemented in CPerson, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CIceSkateFolder, CSkyBasedVehicle, CBicycleFolder, CSkateboardFolder, and CIceSkateFolder.

Definition at line 40 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::GetResultViewType | ( | LPOLESTR * | ppViewType,
 |  | long * | pViewOptions |
 | ) |  |  | [inline, virtual]

Reimplemented in CPerson, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CIceSkateFolder, CSkyBasedVehicle, CBicycleFolder, CSkateboardFolder, and CIceSkateFolder.

Definition at line 40 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::GetResultViewType | ( | LPOLESTR * | ppViewType,
 |  | long * | pViewOptions |
 | ) |  |  | [inline, virtual]

Reimplemented in CPerson, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CIceSkateFolder, CSkyBasedVehicle, CBicycleFolder, CSkateboardFolder, and CIceSkateFolder.

Definition at line 40 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::GetResultViewType | ( | LPOLESTR * | ppViewType,
 |  | long * | pViewOptions |
 | ) |  |  | [inline, virtual]

Reimplemented in CPerson, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CIceSkateFolder, CSkyBasedVehicle, CBicycleFolder, CSkateboardFolder, and CIceSkateFolder.

Definition at line 40 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::GetResultViewType | ( | LPOLESTR * | ppViewType,
 |  | long * | pViewOptions |
 | ) |  |  | [inline, virtual]

Reimplemented in CPerson, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CIceSkateFolder, CSkyBasedVehicle, CBicycleFolder, CSkateboardFolder, and CIceSkateFolder.

Definition at line 43 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::GetResultViewType | ( | LPOLESTR * | ppViewType,
 |  | long * | pViewOptions |
 | ) |  |  | [inline, virtual]

Reimplemented in CPerson, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CIceSkateFolder, CSkyBasedVehicle, CBicycleFolder, CSkateboardFolder, and CIceSkateFolder.

Definition at line 45 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::GetResultViewType | ( | LPOLESTR * | ppViewType,
 |  | long * | pViewOptions |
 | ) |  |  | [inline, virtual]

Reimplemented in CPerson, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CIceSkateFolder, CSkyBasedVehicle, CBicycleFolder, CSkateboardFolder, and CIceSkateFolder.

Definition at line 45 of file delebase.h.

{ return S_FALSE; }

virtual MMC_TASK* CDelegationBase::GetTaskList | ( | LPOLESTR | szTaskGroup,
 |  | LONG * | nCount |
 | ) |  |  | [inline, virtual]

Reimplemented in CBicycleFolder, CSkateboardFolder, and CIceSkateFolder.

Definition at line 53 of file delebase.h.

{ return NULL; }

virtual HRESULT CDelegationBase::GetTaskpadBackground ( MMC_TASK_DISPLAY_OBJECT * pTDO ) [inline, virtual]

Reimplemented in CBicycleFolder, CSkateboardFolder, and CIceSkateFolder.

Definition at line 56 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::GetTaskpadDescription ( LPOLESTR * pszDescription ) [inline, virtual]

Reimplemented in CBicycleFolder, CSkateboardFolder, and CIceSkateFolder.

Definition at line 55 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::GetTaskpadTitle ( LPOLESTR * pszTitle ) [inline, virtual]

Reimplemented in CBicycleFolder, CSkateboardFolder, and CIceSkateFolder.

Definition at line 54 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::GetWatermarks | ( | HBITMAP * | lphWatermark,
 |  | HBITMAP * | lphHeader,
 |  | HPALETTE * | lphPalette,
 |  | BOOL * | bStretch |
 | ) |  |  | [inline, virtual]

Reimplemented in CRocket, CRocket, CStaticNode, CRocket, CBicycle, and CRocket.

Definition at line 55 of file delebase.h.

                        { return S_FALSE; }

virtual HRESULT CDelegationBase::GetWatermarks | ( | HBITMAP * | lphWatermark,
 |  | HBITMAP * | lphHeader,
 |  | HPALETTE * | lphPalette,
 |  | BOOL * | bStretch |
 | ) |  |  | [inline, virtual]

Reimplemented in CRocket, CRocket, CStaticNode, CRocket, CBicycle, and CRocket.

Definition at line 53 of file delebase.h.

                        { return S_FALSE; }

virtual HRESULT CDelegationBase::GetWatermarks | ( | HBITMAP * | lphWatermark,
 |  | HBITMAP * | lphHeader,
 |  | HPALETTE * | lphPalette,
 |  | BOOL * | bStretch |
 | ) |  |  | [inline, virtual]

Reimplemented in CRocket, CRocket, CStaticNode, CRocket, CBicycle, and CRocket.

Definition at line 62 of file delebase.h.

                        { return S_FALSE; }

virtual HRESULT CDelegationBase::GetWatermarks | ( | HBITMAP * | lphWatermark,
 |  | HBITMAP * | lphHeader,
 |  | HPALETTE * | lphPalette,
 |  | BOOL * | bStretch |
 | ) |  |  | [inline, virtual]

Reimplemented in CRocket, CRocket, CStaticNode, CRocket, CBicycle, and CRocket.

Definition at line 53 of file delebase.h.

                        { return S_FALSE; }

virtual HRESULT CDelegationBase::HasPropertySheets ( ) [inline, virtual]

Reimplemented in CRocket, CRocket, CStaticNode, CRocket, CBicycle, and CRocket.

Definition at line 54 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::HasPropertySheets ( ) [inline, virtual]

Reimplemented in CRocket, CRocket, CStaticNode, CRocket, CBicycle, and CRocket.

Definition at line 61 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::HasPropertySheets ( ) [inline, virtual]

Reimplemented in CRocket, CRocket, CStaticNode, CRocket, CBicycle, and CRocket.

Definition at line 52 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::HasPropertySheets ( ) [inline, virtual]

Reimplemented in CRocket, CRocket, CStaticNode, CRocket, CBicycle, and CRocket.

Definition at line 52 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::InitOCX ( IUnknown * pUnknown ) [inline, virtual]

Definition at line 52 of file delebase.h.

{ return S_FALSE; }

static void CDelegationBase::LoadBitmaps ( ) [inline, static, protected]

Definition at line 59 of file delebase.h.

                            {
        m_pBMapSm = LoadBitmap(g_hinst, MAKEINTRESOURCE(IDR_SMICONS));
        m_pBMapLg = LoadBitmap(g_hinst, MAKEINTRESOURCE(IDR_LGICONS)); }

static void CDelegationBase::LoadBitmaps ( ) [inline, static, protected]

Definition at line 64 of file delebase.h.

                              {
        m_pBMapSm = LoadBitmap(g_hinst, MAKEINTRESOURCE(IDR_SMICONS));
        m_pBMapLg = LoadBitmap(g_hinst, MAKEINTRESOURCE(IDR_LGICONS));
    }

void CDelegationBase::LoadBitmaps ( ) [inline, protected]

Definition at line 61 of file delebase.h.

                       {
        m_pBMapSm = LoadBitmap(g_hinst, MAKEINTRESOURCE(IDR_SMICONS));
        m_pBMapLg = LoadBitmap(g_hinst, MAKEINTRESOURCE(IDR_LGICONS));
    }

static void CDelegationBase::LoadBitmaps ( ) [inline, static, protected]

Definition at line 59 of file delebase.h.

                              {
        m_pBMapSm = LoadBitmap(g_hinst, MAKEINTRESOURCE(IDR_SMICONS));
        m_pBMapLg = LoadBitmap(g_hinst, MAKEINTRESOURCE(IDR_LGICONS));
    }

static void CDelegationBase::LoadBitmaps ( ) [inline, static, protected]

Definition at line 76 of file delebase.h.

                              {
        m_pBMapSm = LoadBitmap(g_hinst, MAKEINTRESOURCE(IDR_SMICONS));
        m_pBMapLg = LoadBitmap(g_hinst, MAKEINTRESOURCE(IDR_LGICONS));
    }

static void CDelegationBase::LoadBitmaps ( ) [inline, static, protected]

Definition at line 65 of file delebase.h.

                              {
        m_pBMapSm = LoadBitmap(g_hinst, MAKEINTRESOURCE(IDR_SMICONS));
        m_pBMapLg = LoadBitmap(g_hinst, MAKEINTRESOURCE(IDR_LGICONS));
    }

static void CDelegationBase::LoadBitmaps ( ) [inline, static, protected]

Definition at line 55 of file delebase.h.

                              {
        m_pBMapSm = LoadBitmap(g_hinst, MAKEINTRESOURCE(IDR_SMICONS));
        m_pBMapLg = LoadBitmap(g_hinst, MAKEINTRESOURCE(IDR_LGICONS));
    }

static void CDelegationBase::LoadBitmaps ( ) [inline, static, protected]

Definition at line 65 of file delebase.h.

                              {
        m_pBMapSm = LoadBitmap(g_hinst, MAKEINTRESOURCE(IDR_SMICONS));
        m_pBMapLg = LoadBitmap(g_hinst, MAKEINTRESOURCE(IDR_LGICONS));
    }

static void CDelegationBase::LoadBitmaps ( ) [inline, static, protected]

Definition at line 60 of file delebase.h.

                              {
        m_pBMapSm = LoadBitmap(g_hinst, MAKEINTRESOURCE(IDR_SMICONS));
        m_pBMapLg = LoadBitmap(g_hinst, MAKEINTRESOURCE(IDR_LGICONS));
    }

static void CDelegationBase::LoadBitmaps ( ) [inline, static, protected]

Definition at line 80 of file delebase.h.

                              {
        m_pBMapSm = LoadBitmap(g_hinst, MAKEINTRESOURCE(IDR_SMICONS));
        m_pBMapLg = LoadBitmap(g_hinst, MAKEINTRESOURCE(IDR_LGICONS));
    }

static void CDelegationBase::LoadBitmaps ( ) [inline, static, protected]

Definition at line 64 of file delebase.h.

                              {
        m_pBMapSm = LoadBitmap(g_hinst, MAKEINTRESOURCE(IDR_SMICONS));
        m_pBMapLg = LoadBitmap(g_hinst, MAKEINTRESOURCE(IDR_LGICONS));
    }

static void CDelegationBase::LoadBitmaps ( ) [inline, static, protected]

Definition at line 65 of file delebase.h.

                              {
        m_pBMapSm = LoadBitmap(g_hinst, MAKEINTRESOURCE(IDR_SMICONS));
        m_pBMapLg = LoadBitmap(g_hinst, MAKEINTRESOURCE(IDR_LGICONS));
    }

static void CDelegationBase::LoadBitmaps ( ) [inline, static, protected]

Definition at line 56 of file delebase.h.

                              {
        m_pBMapSm = LoadBitmap(g_hinst, MAKEINTRESOURCE(IDR_SMICONS));
        m_pBMapLg = LoadBitmap(g_hinst, MAKEINTRESOURCE(IDR_LGICONS));
    }

static void CDelegationBase::LoadBitmaps ( ) [inline, static, protected]

Definition at line 72 of file delebase.h.

                              {
        m_pBMapSm = LoadBitmap(g_hinst, MAKEINTRESOURCE(IDR_SMICONS));
        m_pBMapLg = LoadBitmap(g_hinst, MAKEINTRESOURCE(IDR_LGICONS));
    }

virtual HRESULT CDelegationBase::OnAddImages | ( | IImageList * | pImageList,
 |  | HSCOPEITEM | hsi |
 | ) |  |  | [virtual]

Reimplemented in CBackgroundFolder, CIceSkateFolder, CBackgroundFolder, CIceSkateFolder, CBackgroundFolder, and CIceSkateFolder.

virtual HRESULT CDelegationBase::OnAddImages | ( | IImageList * | pImageList,
 |  | HSCOPEITEM | hsi |
 | ) |  |  | [virtual]

Reimplemented in CBackgroundFolder, CIceSkateFolder, CBackgroundFolder, CIceSkateFolder, CBackgroundFolder, and CIceSkateFolder.

HRESULT CDelegationBase::OnAddImages | ( | IImageList * | pImageList,
 |  | HSCOPEITEM | hsi |
 | ) |  |  | [virtual]

Reimplemented in CBackgroundFolder, CIceSkateFolder, CBackgroundFolder, CIceSkateFolder, CBackgroundFolder, and CIceSkateFolder.

Definition at line 45 of file delebase.Cpp.

{
    return pImageList->ImageListSetStrip((long *)m_pBMapSm, // pointer to a handle
        (long *)m_pBMapLg, // pointer to a handle
        0, // index of the first image in the strip
        RGB(0, 128, 128)  // color of the icon mask
        );
}

virtual HRESULT CDelegationBase::OnAddImages | ( | IImageList * | pImageList,
 |  | HSCOPEITEM | hsi |
 | ) |  |  | [virtual]

Reimplemented in CBackgroundFolder, CIceSkateFolder, CBackgroundFolder, CIceSkateFolder, CBackgroundFolder, and CIceSkateFolder.

virtual HRESULT CDelegationBase::OnAddImages | ( | IImageList * | pImageList,
 |  | HSCOPEITEM | hsi |
 | ) |  |  | [virtual]

Reimplemented in CBackgroundFolder, CIceSkateFolder, CBackgroundFolder, CIceSkateFolder, CBackgroundFolder, and CIceSkateFolder.

virtual HRESULT CDelegationBase::OnAddImages | ( | IImageList * | pImageList,
 |  | HSCOPEITEM | hsi |
 | ) |  |  | [virtual]

Reimplemented in CBackgroundFolder, CIceSkateFolder, CBackgroundFolder, CIceSkateFolder, CBackgroundFolder, and CIceSkateFolder.

virtual HRESULT CDelegationBase::OnAddImages | ( | IImageList * | pImageList,
 |  | HSCOPEITEM | hsi |
 | ) |  |  | [virtual]

Reimplemented in CBackgroundFolder, CIceSkateFolder, CBackgroundFolder, CIceSkateFolder, CBackgroundFolder, and CIceSkateFolder.

virtual HRESULT CDelegationBase::OnAddImages | ( | IImageList * | pImageList,
 |  | HSCOPEITEM | hsi |
 | ) |  |  | [virtual]

Reimplemented in CBackgroundFolder, CIceSkateFolder, CBackgroundFolder, CIceSkateFolder, CBackgroundFolder, and CIceSkateFolder.

virtual HRESULT CDelegationBase::OnAddImages | ( | IImageList * | pImageList,
 |  | HSCOPEITEM | hsi |
 | ) |  |  | [virtual]

Reimplemented in CBackgroundFolder, CIceSkateFolder, CBackgroundFolder, CIceSkateFolder, CBackgroundFolder, and CIceSkateFolder.

virtual HRESULT CDelegationBase::OnAddImages | ( | IImageList * | pImageList,
 |  | HSCOPEITEM | hsi |
 | ) |  |  | [virtual]

Reimplemented in CBackgroundFolder, CIceSkateFolder, CBackgroundFolder, CIceSkateFolder, CBackgroundFolder, and CIceSkateFolder.

virtual HRESULT CDelegationBase::OnAddImages | ( | IImageList * | pImageList,
 |  | HSCOPEITEM | hsi |
 | ) |  |  | [virtual]

Reimplemented in CBackgroundFolder, CIceSkateFolder, CBackgroundFolder, CIceSkateFolder, CBackgroundFolder, and CIceSkateFolder.

virtual HRESULT CDelegationBase::OnAddImages | ( | IImageList * | pImageList,
 |  | HSCOPEITEM | hsi |
 | ) |  |  | [virtual]

Reimplemented in CBackgroundFolder, CIceSkateFolder, CBackgroundFolder, CIceSkateFolder, CBackgroundFolder, and CIceSkateFolder.

virtual HRESULT CDelegationBase::OnAddImages | ( | IImageList * | pImageList,
 |  | HSCOPEITEM | hsi |
 | ) |  |  | [virtual]

Reimplemented in CBackgroundFolder, CIceSkateFolder, CBackgroundFolder, CIceSkateFolder, CBackgroundFolder, and CIceSkateFolder.

virtual HRESULT CDelegationBase::OnAddMenuItems | ( | IContextMenuCallback * | pContextMenuCallback,
 |  | long * | pInsertionsAllowed |
 | ) |  |  | [inline, virtual]

Reimplemented in CLandBasedVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CSpaceVehicle, CPlane, and CSkyVehicle.

Definition at line 48 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnAddMenuItems | ( | IContextMenuCallback * | pContextMenuCallback,
 |  | long * | pInsertionsAllowed |
 | ) |  |  | [inline, virtual]

Reimplemented in CLandBasedVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CSpaceVehicle, CPlane, and CSkyVehicle.

Definition at line 69 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnAddMenuItems | ( | IContextMenuCallback * | pContextMenuCallback,
 |  | long * | pInsertionsAllowed |
 | ) |  |  | [inline, virtual]

Reimplemented in CLandBasedVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CSpaceVehicle, CPlane, and CSkyVehicle.

Definition at line 48 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnButtonClicked ( CComponent * pComponent ) [inline, virtual]

Reimplemented in CRocket.

Definition at line 54 of file delebase.h.

{ return S_FALSE;}

virtual HRESULT CDelegationBase::OnDelete ( IConsole * pConsole ) [inline, virtual]

Reimplemented in CRocket, CRocket, and CRocket.

Definition at line 65 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnDelete ( IConsole * pConsoleComp ) [inline, virtual]

Reimplemented in CRocket, CRocket, and CRocket.

Definition at line 57 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnDelete ( IConsole * pConsole ) [inline, virtual]

Reimplemented in CRocket, CRocket, and CRocket.

Definition at line 62 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnDeleteScopeItem ( IConsoleNameSpace * pConsoleNameSpace ) [inline, virtual]

Reimplemented in CSpaceStation.

Definition at line 66 of file delebase.h.

{ _ASSERT(FALSE); return S_FALSE; }

virtual HRESULT CDelegationBase::OnExpand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [inline, virtual]

Reimplemented in CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CBackgroundFolder, CPeoplePoweredVehicle, CSpaceFolder, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CBackgroundFolder, CPeoplePoweredVehicle, CSpaceFolder, CStaticNode, CBackgroundFolder, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, and CStaticNode.

Definition at line 44 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnExpand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [inline, virtual]

Reimplemented in CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CBackgroundFolder, CPeoplePoweredVehicle, CSpaceFolder, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CBackgroundFolder, CPeoplePoweredVehicle, CSpaceFolder, CStaticNode, CBackgroundFolder, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, and CStaticNode.

Definition at line 50 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnExpand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [inline, virtual]

Reimplemented in CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CBackgroundFolder, CPeoplePoweredVehicle, CSpaceFolder, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CBackgroundFolder, CPeoplePoweredVehicle, CSpaceFolder, CStaticNode, CBackgroundFolder, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, and CStaticNode.

Definition at line 44 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnExpand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [inline, virtual]

Reimplemented in CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CBackgroundFolder, CPeoplePoweredVehicle, CSpaceFolder, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CBackgroundFolder, CPeoplePoweredVehicle, CSpaceFolder, CStaticNode, CBackgroundFolder, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, and CStaticNode.

Definition at line 44 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnExpand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [inline, virtual]

Reimplemented in CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CBackgroundFolder, CPeoplePoweredVehicle, CSpaceFolder, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CBackgroundFolder, CPeoplePoweredVehicle, CSpaceFolder, CStaticNode, CBackgroundFolder, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, and CStaticNode.

Definition at line 44 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnExpand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [inline, virtual]

Reimplemented in CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CBackgroundFolder, CPeoplePoweredVehicle, CSpaceFolder, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CBackgroundFolder, CPeoplePoweredVehicle, CSpaceFolder, CStaticNode, CBackgroundFolder, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, and CStaticNode.

Definition at line 47 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnExpand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [inline, virtual]

Reimplemented in CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CBackgroundFolder, CPeoplePoweredVehicle, CSpaceFolder, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CBackgroundFolder, CPeoplePoweredVehicle, CSpaceFolder, CStaticNode, CBackgroundFolder, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, and CStaticNode.

Definition at line 46 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnExpand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [inline, virtual]

Reimplemented in CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CBackgroundFolder, CPeoplePoweredVehicle, CSpaceFolder, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CBackgroundFolder, CPeoplePoweredVehicle, CSpaceFolder, CStaticNode, CBackgroundFolder, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, and CStaticNode.

Definition at line 54 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnExpand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [inline, virtual]

Reimplemented in CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CBackgroundFolder, CPeoplePoweredVehicle, CSpaceFolder, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CBackgroundFolder, CPeoplePoweredVehicle, CSpaceFolder, CStaticNode, CBackgroundFolder, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, and CStaticNode.

Definition at line 44 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnExpand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [inline, virtual]

Reimplemented in CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CBackgroundFolder, CPeoplePoweredVehicle, CSpaceFolder, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CBackgroundFolder, CPeoplePoweredVehicle, CSpaceFolder, CStaticNode, CBackgroundFolder, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, and CStaticNode.

Definition at line 44 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnExpand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [inline, virtual]

Reimplemented in CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CBackgroundFolder, CPeoplePoweredVehicle, CSpaceFolder, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CBackgroundFolder, CPeoplePoweredVehicle, CSpaceFolder, CStaticNode, CBackgroundFolder, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, and CStaticNode.

Definition at line 45 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnExpand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [inline, virtual]

Reimplemented in CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CBackgroundFolder, CPeoplePoweredVehicle, CSpaceFolder, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CBackgroundFolder, CPeoplePoweredVehicle, CSpaceFolder, CStaticNode, CBackgroundFolder, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, and CStaticNode.

Definition at line 48 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnExpand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [inline, virtual]

Reimplemented in CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CBackgroundFolder, CPeoplePoweredVehicle, CSpaceFolder, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CBackgroundFolder, CPeoplePoweredVehicle, CSpaceFolder, CStaticNode, CBackgroundFolder, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, CStaticNode, CPeoplePoweredVehicle, and CStaticNode.

Definition at line 54 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnListpad | ( | IConsole * | pConsole,
 |  | BOOL | bAttaching |
 | ) |  |  | [inline, virtual]

Reimplemented in CBicycleFolder, and CIceSkateFolder.

Definition at line 49 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnMenuButtonCommand | ( | IConsole * | pConsole,
 |  | int | nMenuId,
 |  | long | lCommandID |
 | ) |  |  | [inline, virtual]

Reimplemented in CRocket.

Definition at line 50 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnMenuCommand | ( | IConsole * | pConsole,
 |  | long | lCommandID |
 | ) |  |  | [inline, virtual]

Reimplemented in CLandBasedVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CPlane, and CSkyVehicle.

Definition at line 49 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnMenuCommand | ( | IConsole * | pConsole,
 |  | long | lCommandID |
 | ) |  |  | [inline, virtual]

Reimplemented in CLandBasedVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CPlane, and CSkyVehicle.

Definition at line 49 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnMenuCommand | ( | IConsole * | pConsole,
 |  | IConsoleNameSpace * | pConsoleNameSpace,
 |  | long | lCommandID,
 |  | IDataObject * | piDataObject |
 | ) |  |  | [inline, virtual]

Reimplemented in CSpaceVehicle.

Definition at line 70 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnPaste | ( | IConsole * | pConsole,
 |  | CComponentData * | pComponentData,
 |  | CDelegationBase * | pPasted |
 | ) |  |  | [inline, virtual]

Reimplemented in CSpaceStation.

Definition at line 63 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnPropertyChange ( IConsole * pConsole ) [inline, virtual]

Reimplemented in CRocket, and CRocket.

Definition at line 58 of file delebase.h.

{ return S_OK; }

virtual HRESULT CDelegationBase::OnPropertyChange ( IConsole * pConsole ) [inline, virtual]

Reimplemented in CRocket, and CRocket.

Definition at line 58 of file delebase.h.

{ return S_OK; }

virtual HRESULT CDelegationBase::OnPropertyChange | ( | IConsole * | pConsole,
 |  | CComponent * | pComponent |
 | ) |  |  | [inline, virtual]

Reimplemented in CRocket.

Definition at line 67 of file delebase.h.

{ return S_OK; }

virtual HRESULT CDelegationBase::OnQueryPaste ( CDelegationBase * pPasted ) [inline, virtual]

Reimplemented in CSpaceStation.

Definition at line 64 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnRefresh ( IConsole * pConsole ) [inline, virtual]

Reimplemented in CRocket, CRocket, and CRocket.

Definition at line 58 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnRefresh ( ) [inline, virtual]

Reimplemented in CBackgroundFolder, CBackgroundFolder, and CBackgroundFolder.

Definition at line 52 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnRefresh ( IConsole * pConsole ) [inline, virtual]

Reimplemented in CRocket, CRocket, and CRocket.

Definition at line 58 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnRefresh ( IConsole * pConsole ) [inline, virtual]

Reimplemented in CRocket, CRocket, and CRocket.

Definition at line 56 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnRename ( LPOLESTR pszNewName ) [inline, virtual]

Reimplemented in CRocket, CRocket, CRocket, CRocket, CRocket, CRocket, CRocket, CRocket, and CRocket.

Definition at line 47 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnRename ( LPOLESTR pszNewName ) [inline, virtual]

Reimplemented in CRocket, CRocket, CRocket, CRocket, CRocket, CRocket, CRocket, CRocket, and CRocket.

Definition at line 53 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnRename ( LPOLESTR pszNewName ) [inline, virtual]

Reimplemented in CRocket, CRocket, CRocket, CRocket, CRocket, CRocket, CRocket, CRocket, and CRocket.

Definition at line 50 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnRename ( LPOLESTR pszNewName ) [inline, virtual]

Reimplemented in CRocket, CRocket, CRocket, CRocket, CRocket, CRocket, CRocket, CRocket, and CRocket.

Definition at line 60 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnRename ( LPOLESTR pszNewName ) [inline, virtual]

Reimplemented in CRocket, CRocket, CRocket, CRocket, CRocket, CRocket, CRocket, CRocket, and CRocket.

Definition at line 47 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnRename ( LPOLESTR pszNewName ) [inline, virtual]

Reimplemented in CRocket, CRocket, CRocket, CRocket, CRocket, CRocket, CRocket, CRocket, and CRocket.

Definition at line 47 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnRename ( LPOLESTR pszNewName ) [inline, virtual]

Reimplemented in CRocket, CRocket, CRocket, CRocket, CRocket, CRocket, CRocket, CRocket, and CRocket.

Definition at line 49 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnRename ( LPOLESTR pszNewName ) [inline, virtual]

Reimplemented in CRocket, CRocket, CRocket, CRocket, CRocket, CRocket, CRocket, CRocket, and CRocket.

Definition at line 60 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnRename ( LPOLESTR pszNewName ) [inline, virtual]

Reimplemented in CRocket, CRocket, CRocket, CRocket, CRocket, CRocket, CRocket, CRocket, and CRocket.

Definition at line 47 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnSelect | ( | IConsole * | pConsole,
 |  | BOOL | bScope,
 |  | BOOL | bSelect |
 | ) |  |  | [inline, virtual]

Reimplemented in CBackgroundFolder, CRocket, CSpaceStation, CRocket, CBackgroundFolder, CRocket, CSpaceStation, CBackgroundFolder, CRocket, CRocket, CRocket, CIceSkate, CIceSkateFolder, CRocket, CBicycle, and CRocket.

Definition at line 57 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnSelect | ( | IConsole * | pConsole,
 |  | BOOL | bScope,
 |  | BOOL | bSelect |
 | ) |  |  | [inline, virtual]

Reimplemented in CBackgroundFolder, CRocket, CSpaceStation, CRocket, CBackgroundFolder, CRocket, CSpaceStation, CBackgroundFolder, CRocket, CRocket, CRocket, CIceSkate, CIceSkateFolder, CRocket, CBicycle, and CRocket.

Definition at line 57 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnSelect | ( | IConsole * | pConsole,
 |  | BOOL | bScope,
 |  | BOOL | bSelect |
 | ) |  |  | [inline, virtual]

Reimplemented in CBackgroundFolder, CRocket, CSpaceStation, CRocket, CBackgroundFolder, CRocket, CSpaceStation, CBackgroundFolder, CRocket, CRocket, CRocket, CIceSkate, CIceSkateFolder, CRocket, CBicycle, and CRocket.

Definition at line 48 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnSelect | ( | CComponent * | pComponent,
 |  | BOOL | bScope,
 |  | BOOL | bSelect |
 | ) |  |  | [inline, virtual]

Reimplemented in CRocket.

Definition at line 49 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnSelect | ( | IConsole * | pConsole,
 |  | BOOL | bScope,
 |  | BOOL | bSelect |
 | ) |  |  | [inline, virtual]

Reimplemented in CBackgroundFolder, CRocket, CSpaceStation, CRocket, CBackgroundFolder, CRocket, CSpaceStation, CBackgroundFolder, CRocket, CRocket, CRocket, CIceSkate, CIceSkateFolder, CRocket, CBicycle, and CRocket.

Definition at line 48 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnSelect | ( | IConsole * | pConsole,
 |  | BOOL | bScope,
 |  | BOOL | bSelect |
 | ) |  |  | [inline, virtual]

Reimplemented in CBackgroundFolder, CRocket, CSpaceStation, CRocket, CBackgroundFolder, CRocket, CSpaceStation, CBackgroundFolder, CRocket, CRocket, CRocket, CIceSkate, CIceSkateFolder, CRocket, CBicycle, and CRocket.

Definition at line 50 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnSelect | ( | IConsole * | pConsole,
 |  | BOOL | bScope,
 |  | BOOL | bSelect |
 | ) |  |  | [inline, virtual]

Reimplemented in CBackgroundFolder, CRocket, CSpaceStation, CRocket, CBackgroundFolder, CRocket, CSpaceStation, CBackgroundFolder, CRocket, CRocket, CRocket, CIceSkate, CIceSkateFolder, CRocket, CBicycle, and CRocket.

Definition at line 51 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnSelect | ( | IConsole * | pConsole,
 |  | BOOL | bScope,
 |  | BOOL | bSelect |
 | ) |  |  | [inline, virtual]

Reimplemented in CBackgroundFolder, CRocket, CSpaceStation, CRocket, CBackgroundFolder, CRocket, CSpaceStation, CBackgroundFolder, CRocket, CRocket, CRocket, CIceSkate, CIceSkateFolder, CRocket, CBicycle, and CRocket.

Definition at line 46 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnSelect | ( | IConsole * | pConsole,
 |  | BOOL | bScope,
 |  | BOOL | bSelect |
 | ) |  |  | [inline, virtual]

Reimplemented in CBackgroundFolder, CRocket, CSpaceStation, CRocket, CBackgroundFolder, CRocket, CSpaceStation, CBackgroundFolder, CRocket, CRocket, CRocket, CIceSkate, CIceSkateFolder, CRocket, CBicycle, and CRocket.

Definition at line 48 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnSelect | ( | CComponent * | pComponent,
 |  | IConsole * | pConsole,
 |  | BOOL | bScope,
 |  | BOOL | bSelect |
 | ) |  |  | [inline, virtual]

Reimplemented in CRocket.

Definition at line 54 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnSelect | ( | IConsole * | pConsole,
 |  | BOOL | bScope,
 |  | BOOL | bSelect |
 | ) |  |  | [inline, virtual]

Reimplemented in CBackgroundFolder, CRocket, CSpaceStation, CRocket, CBackgroundFolder, CRocket, CSpaceStation, CBackgroundFolder, CRocket, CRocket, CRocket, CIceSkate, CIceSkateFolder, CRocket, CBicycle, and CRocket.

Definition at line 48 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnSetMenuButton | ( | IConsole * | pConsole,
 |  | MENUBUTTONDATA * | pmbd |
 | ) |  |  | [inline, virtual]

Reimplemented in CRocket.

Definition at line 53 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnSetToolbar | ( | IControlbar * | pControlbar,
 |  | IToolbar * | pToolbar,
 |  | BOOL | bScope,
 |  | BOOL | bSelect |
 | ) |  |  | [inline, virtual]

Reimplemented in CRocket.

Definition at line 73 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnSetToolbar | ( | CComponent * | pComponent,
 |  | IControlbar * | pControlbar,
 |  | IToolbar * | pToolbar,
 |  | BOOL | bScope,
 |  | BOOL | bSelect |
 | ) |  |  | [inline, virtual]

Reimplemented in CRocket.

Definition at line 53 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [inline, virtual]

Reimplemented in CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CSkyVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSkyBasedVehicle, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, and CSpaceVehicle.

Definition at line 55 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [inline, virtual]

Reimplemented in CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CSkyVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSkyBasedVehicle, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, and CSpaceVehicle.

Definition at line 55 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [inline, virtual]

Reimplemented in CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CSkyVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSkyBasedVehicle, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, and CSpaceVehicle.

Definition at line 45 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [inline, virtual]

Reimplemented in CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CSkyVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSkyBasedVehicle, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, and CSpaceVehicle.

Definition at line 47 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [inline, virtual]

Reimplemented in CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CSkyVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSkyBasedVehicle, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, and CSpaceVehicle.

Definition at line 45 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [inline, virtual]

Reimplemented in CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CSkyVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSkyBasedVehicle, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, and CSpaceVehicle.

Definition at line 45 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [inline, virtual]

Reimplemented in CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CSkyVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSkyBasedVehicle, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, and CSpaceVehicle.

Definition at line 51 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [inline, virtual]

Reimplemented in CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CSkyVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSkyBasedVehicle, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, and CSpaceVehicle.

Definition at line 45 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [inline, virtual]

Reimplemented in CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CSkyVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSkyBasedVehicle, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, and CSpaceVehicle.

Definition at line 50 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [inline, virtual]

Reimplemented in CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CSkyVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSkyBasedVehicle, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, and CSpaceVehicle.

Definition at line 45 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [inline, virtual]

Reimplemented in CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CSkyVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSkyBasedVehicle, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, and CSpaceVehicle.

Definition at line 47 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [inline, virtual]

Reimplemented in CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CSkyVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSkyBasedVehicle, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, and CSpaceVehicle.

Definition at line 45 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [inline, virtual]

Reimplemented in CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSkyBasedVehicle, CSpaceStation, CSkyVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSkyBasedVehicle, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CSpaceVehicle, CBicycleFolder, CSkateboardFolder, CIceSkateFolder, and CSpaceVehicle.

Definition at line 48 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnShowContextHelp | ( | IDisplayHelp * | m_ipDisplayHelp,
 |  | LPOLESTR | helpFile |
 | ) |  |  | [virtual]

Reimplemented in CStaticNode, and CStaticNode.

HRESULT CDelegationBase::OnShowContextHelp | ( | IDisplayHelp * | m_ipDisplayHelp,
 |  | LPOLESTR | helpFile |
 | ) |  |  | [inline, virtual]

Reimplemented in CStaticNode, and CStaticNode.

Definition at line 47 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnShowContextHelp | ( | IDisplayHelp * | m_ipDisplayHelp,
 |  | LPOLESTR | helpFile |
 | ) |  |  | [inline, virtual]

Reimplemented in CStaticNode, and CStaticNode.

Definition at line 44 of file deleBase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnShowContextHelp | ( | IDisplayHelp * | m_ipDisplayHelp,
 |  | LPOLESTR | helpFile |
 | ) |  |  | [inline, virtual]

Reimplemented in CStaticNode, and CStaticNode.

Definition at line 47 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnShowContextHelp | ( | IDisplayHelp * | m_ipDisplayHelp,
 |  | LPOLESTR | helpFile |
 | ) |  |  | [virtual]

Reimplemented in CStaticNode, and CStaticNode.

virtual HRESULT CDelegationBase::OnToolbarCommand | ( | CComponent * | pComponent,
 |  | IConsole * | pConsole,
 |  | MMC_CONSOLE_VERB | verb |
 | ) |  |  | [inline, virtual]

Reimplemented in CRocket.

Definition at line 52 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnToolbarCommand | ( | IConsole * | pConsole,
 |  | MMC_CONSOLE_VERB | verb,
 |  | IDataObject * | pDataObject |
 | ) |  |  | [inline, virtual]

Reimplemented in CRocket.

Definition at line 72 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnUpdateItem | ( | IConsole * | pConsole,
 |  | long | item,
 |  | ITEM_TYPE | itemtype |
 | ) |  |  | [inline, virtual]

Reimplemented in CRocket, CRocket, CSpaceStation, CRocket, and CSpaceStation.

Definition at line 59 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnUpdateItem | ( | IConsole * | pConsole,
 |  | long | item,
 |  | ITEM_TYPE | itemtype |
 | ) |  |  | [inline, virtual]

Reimplemented in CRocket, CRocket, CSpaceStation, CRocket, and CSpaceStation.

Definition at line 59 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::OnUpdateItem | ( | IConsole * | pConsole,
 |  | long | item,
 |  | ITEM_TYPE | itemtype |
 | ) |  |  | [inline, virtual]

Reimplemented in CRocket, CRocket, CSpaceStation, CRocket, and CSpaceStation.

Definition at line 55 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::Select | ( | IConsole * | pConsole,
 |  | BOOL | bScope,
 |  | BOOL | bSelect |
 | ) |  |  | [inline, virtual]

Definition at line 48 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::SelectItem ( IConsole * pConsole ) [inline, virtual]

Definition at line 47 of file delebase.h.

  {
    return pConsole->SelectScopeItem(HSCOPEITEM(m_handle));
  }

virtual HRESULT CDelegationBase::SelectItem ( IConsole * pConsole ) [inline, virtual]

Definition at line 47 of file delebase.h.

  {
    return pConsole->SelectScopeItem(HSCOPEITEM(m_handle));
  }

void CDelegationBase::SetComponentData ( CComponentData * pComponentData ) [inline]

Definition at line 55 of file delebase.h.

{ m_pComponentData = pComponentData; }

void CDelegationBase::SetComponentData ( CComponentData * pComponentData ) [inline]

Definition at line 57 of file delebase.h.

{ m_pComponentData = pComponentData; }

void CDelegationBase::SetHandle ( HANDLE handle ) [inline]

Definition at line 73 of file delebase.h.

{ m_handle = handle; }

virtual CDelegationBase::SetHandle ( HANDLE handle ) [inline, virtual]

Definition at line 40 of file delebase.h.

{ m_handle = handle; }

void CDelegationBase::SetHandle ( HANDLE handle ) [inline]

Definition at line 69 of file delebase.h.

{ m_handle = handle; }

virtual HRESULT CDelegationBase::SetMenuState | ( | IControlbar * | pControlbar,
 |  | IMenuButton * | pMenuButton,
 |  | BOOL | bScope,
 |  | BOOL | bSelect |
 | ) |  |  | [inline, virtual]

Reimplemented in CRocket.

Definition at line 51 of file delebase.h.

                                   { return S_FALSE; }

virtual void CDelegationBase::SetScopeItemValue ( HSCOPEITEM hscopeitem ) [inline, virtual]

Reimplemented in CBicycleFolder, CSkateboardFolder, CIceSkateFolder, CPeoplePoweredVehicle, CSkyBasedVehicle, CSpaceVehicle, and CStaticNode.

Definition at line 45 of file delebase.h.

{ _ASSERT(FALSE); }

virtual HRESULT CDelegationBase::Show | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [inline, virtual]

Reimplemented in CSpaceVehicle.

Definition at line 49 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::ShowContextHelp | ( | IConsole * | pConsole,
 |  | IDisplayHelp * | m_ipDisplayHelp,
 |  | LPOLESTR | helpFile |
 | ) |  |  | [inline, virtual]

Reimplemented in CPerson.

Definition at line 50 of file delebase.h.

{ return S_FALSE; }

virtual HRESULT CDelegationBase::TaskNotify | ( | IConsole * | pConsole,
 |  | VARIANT * | v1,
 |  | VARIANT * | v2 |
 | ) |  |  | [inline, virtual]

Reimplemented in CBicycleFolder, CSkateboardFolder, and CIceSkateFolder.

Definition at line 52 of file delebase.h.

{ return S_FALSE; }

Member Data Documentation

BOOL CDelegationBase::bExpanded [protected]

Definition at line 66 of file delebase.h.

HANDLE CDelegationBase::m_handle [private]

Definition at line 86 of file delebase.h.

static HBITMAP CDelegationBase::m_pBMapLg = NULL

Definition at line 58 of file delebase.h.

HBITMAP CDelegationBase::m_pBMapLg [static]

Definition at line 53 of file delebase.h.

static HBITMAP CDelegationBase::m_pBMapSm = NULL

Definition at line 57 of file delebase.h.

HBITMAP CDelegationBase::m_pBMapSm [static]

Definition at line 52 of file delebase.h.

CComponentData * CDelegationBase::m_pComponentData

Reimplemented in CSpaceStation.

Definition at line 73 of file delebase.h.

static const GUID CDelegationBase::thisGuid = { 0x2974380b, 0x4c4b, 0x11d2, { 0x89, 0xd8, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28 } } [static, private]

Reimplemented in CStaticNode, CLandBasedVehicle, CPerson, CPeoplePoweredVehicle, CSkyBasedVehicle, CRocket, CSpaceVehicle, CBicycle, CBicycleFolder, CSkateboard, CSkateboardFolder, CIceSkate, CIceSkateFolder, CBackground, CBackgroundFolder, CSpaceStation, CSpaceFolder, CPlane, and CSkyVehicle.

Definition at line 47 of file delebase.h.

The documentation for this class was generated from the following files:
  • SysMgmt/MMC/About/delebase.h
  • SysMgmt/MMC/ActiveX/delebase.h
  • SysMgmt/MMC/CMenu/delebase.h
  • SysMgmt/MMC/Complete/delebase.h
  • SysMgmt/MMC/CutCopy/delebase.h
  • SysMgmt/MMC/Extens/delebase.h
  • SysMgmt/MMC/Help/deleBase.h
  • SysMgmt/MMC/Menubtn/delebase.h
  • SysMgmt/MMC/Multisel/delebase.h
  • SysMgmt/MMC/Nameext/delebase.h
  • SysMgmt/MMC/Nodes/delebase.h
  • SysMgmt/MMC/Openserv/delebase.h
  • SysMgmt/MMC/Proppage/delebase.h
  • SysMgmt/MMC/Simple/delebase.h
  • SysMgmt/MMC/Taskpads/delebase.h
  • SysMgmt/MMC/Toolbar/delebase.h
  • SysMgmt/MMC/WMI/delebase.h
  • SysMgmt/MMC/About/delebase.Cpp
  • SysMgmt/MMC/ActiveX/delebase.Cpp
  • SysMgmt/MMC/CMenu/delebase.Cpp
  • SysMgmt/MMC/Complete/delebase.Cpp
  • SysMgmt/MMC/CutCopy/delebase.Cpp
  • SysMgmt/MMC/Extens/delebase.Cpp
  • SysMgmt/MMC/Help/deleBase.Cpp
  • SysMgmt/MMC/Menubtn/delebase.Cpp
  • SysMgmt/MMC/Multisel/delebase.Cpp
  • SysMgmt/MMC/Nameext/delebase.Cpp
  • SysMgmt/MMC/Nodes/delebase.Cpp
  • SysMgmt/MMC/Openserv/delebase.Cpp
  • SysMgmt/MMC/Proppage/delebase.Cpp
  • SysMgmt/MMC/Simple/delebase.Cpp
  • SysMgmt/MMC/Taskpads/delebase.Cpp
  • SysMgmt/MMC/Toolbar/delebase.Cpp
  • SysMgmt/MMC/WMI/delebase.Cpp
Generated on Wed Nov 13 2024 16:56:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDeleteObjectDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes

CDeleteObjectDlg Class Reference

#include "DirectoryObject.h"

List of all members.

Public Types

enum | { IDD = IDD_DELETEOBJECT }

Public Member Functions

CDeleteObjectDlg (CWnd *pParent=NULL)
CString GetObjectName ()

Public Attributes

CString m_sDelete

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
afx_msg void | OnChangeDelete ()
virtual void | OnOK ()

Protected Attributes

CString m_sRDN

Detailed Description

Definition at line 63 of file DirectoryObject.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 71 of file DirectoryObject.h.

{ IDD = IDD_DELETEOBJECT };

Constructor & Destructor Documentation

CDeleteObjectDlg::CDeleteObjectDlg ( CWnd * pParent = NULL )

Definition at line 286 of file DirectoryObject.cpp.

  : CDialog(CDeleteObjectDlg::IDD, pParent)
{
  //{{AFX_DATA_INIT(CDeleteObjectDlg)
  m_sDelete = _T("");
  //}}AFX_DATA_INIT
}

Member Function Documentation

void CDeleteObjectDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 295 of file DirectoryObject.cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CDeleteObjectDlg)
  DDX_Text(pDX, IDC_DELETE, m_sDelete);
  //}}AFX_DATA_MAP
}

CString CDeleteObjectDlg::GetObjectName ( ) [inline]

Definition at line 68 of file DirectoryObject.h.

{ return m_sRDN; }

void CDeleteObjectDlg::OnChangeDelete ( ) [protected]

Definition at line 321 of file DirectoryObject.cpp.

{
    BOOL bEnabled;
  bEnabled = GetDlgItem( IDC_DELETE )->GetWindowTextLength() > 0 ? TRUE : FALSE;
  GetDlgItem( IDOK )->EnableWindow( bEnabled );

}

void CDeleteObjectDlg::OnOK ( ) [protected, virtual]

Definition at line 313 of file DirectoryObject.cpp.

{
    UpdateData( TRUE );
  m_sRDN = m_sDelete;

  CDialog::OnOK();
}

Member Data Documentation

CString CDeleteObjectDlg::m_sDelete

Definition at line 72 of file DirectoryObject.h.

CString CDeleteObjectDlg::m_sRDN [protected]

Definition at line 85 of file DirectoryObject.h.

The documentation for this class was generated from the following files:
  • NetDS/ADSI/samples/General/ADQI/DirectoryObject.h
  • NetDS/ADSI/samples/General/ADQI/DirectoryObject.cpp
Generated on Wed Nov 13 2024 16:56:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDeleteQueueDialog Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions

CDeleteQueueDialog Class Reference

#include "DELQDlg.h"

List of all members.

Public Types

enum | { IDD = IDD_DELETE_QUEUE_DIALOG }

Public Member Functions

CDeleteQueueDialog (CArray< ARRAYQ *, ARRAYQ * > *, CWnd *pParent=NULL)
void | GetPathName (TCHAR szPathName[BUFFERSIZE])

Public Attributes

CComboBox | m_PathNameCB
CArray< ARRAYQ *, ARRAYQ * > * | m_pStrArray
CString m_szPathName

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
virtual BOOL | OnInitDialog ()

Detailed Description

Definition at line 20 of file DELQDlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 28 of file DELQDlg.h.

{ IDD = IDD_DELETE_QUEUE_DIALOG };

Constructor & Destructor Documentation

CDeleteQueueDialog::CDeleteQueueDialog | ( | CArray< ARRAYQ *, ARRAYQ * > * | pStrArray,
 |  | CWnd * | pParent = NULL
 | ) |  |

Definition at line 31 of file DELQDlg.Cpp.

  : CDialog(CDeleteQueueDialog::IDD, pParent)
{
  m_pStrArray = pStrArray;

  //{{AFX_DATA_INIT(CDeleteQueueDialog)
  m_szPathName = _T("");
  //}}AFX_DATA_INIT
}

Member Function Documentation

void CDeleteQueueDialog::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 42 of file DELQDlg.Cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CDeleteQueueDialog)
  DDX_Control(pDX, IDC_DELETE_QUEUE_COMBO, m_PathNameCB);
  DDX_CBString(pDX, IDC_DELETE_QUEUE_COMBO, m_szPathName);
  DDV_MaxChars(pDX, m_szPathName, 4000);
  //}}AFX_DATA_MAP
}

void CDeleteQueueDialog::GetPathName ( TCHAR szPathName[BUFFERSIZE] ) [inline]

Definition at line 53 of file DELQDlg.h.

  {
    ASSERT(szPathName != NULL);

    _tcsncpy (szPathName, m_szPathName, BUFFERSIZE-1);
    szPathName[BUFFERSIZE-1] = '\0';

  }

BOOL CDeleteQueueDialog::OnInitDialog ( ) [protected, virtual]

Definition at line 61 of file DELQDlg.Cpp.

{
  CDialog::OnInitDialog();

  int i;

for  (i=0 ; i<m_pStrArray->GetSize() ; i++)
  VERIFY (m_PathNameCB.AddString((*m_pStrArray)[i]->szPathName) != CB_ERR);

    if (m_PathNameCB.GetCount() > 0) m_PathNameCB.SetCurSel(0);

    return TRUE;  // return TRUE unless you set the focus to a control
                // EXCEPTION: OCX Property Pages should return FALSE
}

Member Data Documentation

CComboBox CDeleteQueueDialog::m_PathNameCB

Definition at line 29 of file DELQDlg.h.

CArray<ARRAYQ*, ARRAYQ*>* CDeleteQueueDialog::m_pStrArray

Definition at line 34 of file DELQDlg.h.

CString CDeleteQueueDialog::m_szPathName

Definition at line 30 of file DELQDlg.h.

The documentation for this class was generated from the following files:
  • NetDS/MessageQueuing/MqApiTst/DELQDlg.h
  • NetDS/MessageQueuing/MqApiTst/DELQDlg.Cpp
Generated on Wed Nov 13 2024 16:56:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDeskBand Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes | Private Member Functions | Static Private Member Functions | Private Attributes

CDeskBand Class Reference

#include "DeskBand.h"

List of all members.

Public Member Functions

CDeskBand ()
~CDeskBand ()
STDMETHOD() | CloseDW (DWORD dwReserved)
STDMETHOD() | ContextSensitiveHelp (BOOL)
STDMETHOD() | GetBandInfo (DWORD, DWORD, DESKBANDINFO *)
STDMETHOD() | GetClassID (LPCLSID)
STDMETHOD() | GetCommandString (UINT_PTR, UINT, LPUINT, LPSTR, UINT)
STDMETHOD() | GetSite (REFIID, LPVOID *)
STDMETHOD() | GetSizeMax (ULARGE_INTEGER *)
STDMETHOD() | GetWindow (HWND *)
STDMETHOD() | HasFocusIO (void)
STDMETHOD() | InvokeCommand (LPCMINVOKECOMMANDINFO)
STDMETHOD() | IsDirty (void)
STDMETHOD() | Load (LPSTREAM)
STDMETHOD() | QueryContextMenu (HMENU, UINT, UINT, UINT, UINT)
STDMETHODIMP | QueryInterface (REFIID, LPVOID *)
STDMETHOD() | ResizeBorderDW (LPCRECT prcBorder, IUnknown *punkToolbarSite, BOOL fReserved)
STDMETHOD() | Save (LPSTREAM, BOOL)
STDMETHOD() | SetSite (IUnknown *)
STDMETHOD() | ShowDW (BOOL fShow)
STDMETHODIMP_ (DWORD) AddRef()
STDMETHODIMP_ (DWORD) Release()
STDMETHOD() | TranslateAcceleratorIO (LPMSG)
STDMETHOD() | UIActivateIO (BOOL, LPMSG)

Protected Attributes

DWORD m_ObjRefCount

Private Member Functions

void | FocusChange (BOOL)
LRESULT | OnCommand (WPARAM wParam, LPARAM lParam)
LRESULT | OnKillFocus (void)
LRESULT | OnPaint (void)
LRESULT | OnSetFocus (void)
LRESULT | OnSize (LPARAM)
BOOL | RegisterAndCreateWindow (void)

Static Private Member Functions

static LRESULT CALLBACK | WndProc (HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam)

Private Attributes

BOOL m_bFocus
DWORD m_dwBandID
DWORD m_dwViewMode
HWND | m_hWnd
HWND | m_hwndParent
IInputObjectSite * | m_pSite

Detailed Description

Definition at line 39 of file DeskBand.h.

Constructor & Destructor Documentation

CDeskBand::CDeskBand ( )

Definition at line 31 of file DeskBand.Cpp.

{
  m_pSite = NULL;

  m_hWnd = NULL;
  m_hwndParent = NULL;

  m_bFocus = FALSE;

  m_dwViewMode = 0;
  m_dwBandID = 0;

  m_ObjRefCount = 1;
  g_DllRefCount++;
}

CDeskBand::~CDeskBand ( )

Definition at line 53 of file DeskBand.Cpp.

{
  //this should have been freed in a call to SetSite(NULL), but just to be safe
  if(m_pSite)
    {
      m_pSite->Release();
      m_pSite = NULL;
    }

  g_DllRefCount--;
}

Member Function Documentation

STDMETHODIMP CDeskBand::CloseDW ( DWORD dwReserved )

Definition at line 237 of file DeskBand.Cpp.

{
  ShowDW(FALSE);

  if(IsWindow(m_hWnd))
    DestroyWindow(m_hWnd);

  m_hWnd = NULL;

  return S_OK;
}

STDMETHODIMP CDeskBand::ContextSensitiveHelp ( BOOL fEnterMode )

Definition at line 196 of file DeskBand.Cpp.

{
  return E_NOTIMPL;
}

void CDeskBand::FocusChange ( BOOL bFocus ) [private]

Definition at line 720 of file DeskBand.Cpp.

{
  m_bFocus = bFocus;

  //inform the input object site that the focus has changed
  if(m_pSite)
    {
      m_pSite->OnFocusChangeIS((IDockingWindow*)this, bFocus);
    }
}

STDMETHODIMP CDeskBand::GetBandInfo | ( | DWORD | dwBandID,
 |  | DWORD | dwViewMode,
 |  | DESKBANDINFO * | pdbi
 | ) |  |

Definition at line 393 of file DeskBand.Cpp.

{
  if(pdbi)
    {
      m_dwBandID = dwBandID;
      m_dwViewMode = dwViewMode;

      if(pdbi->dwMask & DBIM_MINSIZE)
  {
    if(DBIF_VIEWMODE_FLOATING & dwViewMode)
      {
        pdbi->ptMinSize.x = 200;
        pdbi->ptMinSize.y = 400;
      }
    else
      {
        pdbi->ptMinSize.x = DB_MIN_SIZE_X;
        pdbi->ptMinSize.y = DB_MIN_SIZE_Y;
      }
  }

      if(pdbi->dwMask & DBIM_MAXSIZE)
  {
    pdbi->ptMaxSize.x = -1;
    pdbi->ptMaxSize.y = -1;
  }

      if(pdbi->dwMask & DBIM_INTEGRAL)
  {
    pdbi->ptIntegral.x = 1;
    pdbi->ptIntegral.y = 1;
  }

      if(pdbi->dwMask & DBIM_ACTUAL)
  {
    pdbi->ptActual.x = 100;
    pdbi->ptActual.y = 100;
  }

      if(pdbi->dwMask & DBIM_TITLE)
  {
    lstrcpyW(pdbi->wszTitle, L"Sample Desk Band");
  }

      if(pdbi->dwMask & DBIM_MODEFLAGS)
  {
    pdbi->dwModeFlags = DBIMF_NORMAL;

    pdbi->dwModeFlags |= DBIMF_VARIABLEHEIGHT;
  }

      if(pdbi->dwMask & DBIM_BKCOLOR)
  {
    //Use the default background color by removing this flag.
    pdbi->dwMask &= ~DBIM_BKCOLOR;
  }

      return S_OK;
    }

  return E_INVALIDARG;
}

STDMETHODIMP CDeskBand::GetClassID ( LPCLSID pClassID )

Definition at line 471 of file DeskBand.Cpp.

{
  *pClassID = CLSID_SampleDeskBand;

  return S_OK;
}

STDMETHODIMP CDeskBand::GetCommandString | ( | UINT_PTR | idCommand,
 |  | UINT | uFlags,
 |  | LPUINT | lpReserved,
 |  | LPSTR | lpszName,
 |  | UINT | uMaxNameLen
 | ) |  |

Definition at line 580 of file DeskBand.Cpp.

{
  HRESULT  hr = E_INVALIDARG;

  switch(uFlags)
    {
    case GCS_HELPTEXT:
      switch(idCommand)
  {
  case IDM_COMMAND:
    lstrcpyn(lpszName, TEXT("Desk Band command help text"), uMaxNameLen);
    hr = NOERROR;
    break;
  }
      break;

    case GCS_VERB:
      switch(idCommand)
  {
  case IDM_COMMAND:
    lstrcpyn(lpszName, TEXT("command"), uMaxNameLen);
    hr = NOERROR;
    break;
  }
      break;

    case GCS_VALIDATE:
      hr = NOERROR;
      break;
    }

  return hr;
}

STDMETHODIMP CDeskBand::GetSite | ( | REFIID | riid,
 |  | LPVOID * | ppvReturn
 | ) |  |

Definition at line 372 of file DeskBand.Cpp.

{
  *ppvReturn = NULL;

  if(m_pSite)
    return m_pSite->QueryInterface(riid, ppvReturn);

  return E_FAIL;
}

STDMETHODIMP CDeskBand::GetSizeMax ( ULARGE_INTEGER * pul )

Definition at line 517 of file DeskBand.Cpp.

{
  return E_NOTIMPL;
}

STDMETHODIMP CDeskBand::GetWindow ( HWND * phWnd )

Definition at line 183 of file DeskBand.Cpp.

{
  *phWnd = m_hWnd;

  return S_OK;
}

STDMETHODIMP CDeskBand::HasFocusIO ( void )

Definition at line 293 of file DeskBand.Cpp.

{
  if(m_bFocus)
    return S_OK;

  return S_FALSE;
}

STDMETHODIMP CDeskBand::InvokeCommand ( LPCMINVOKECOMMANDINFO lpcmi )

Definition at line 559 of file DeskBand.Cpp.

{
  switch (LOWORD(lpcmi->lpVerb))
    {
    case IDM_COMMAND:
      MessageBox(lpcmi->hwnd, TEXT("Desk Band Command selected."), TEXT("Sample Desk Band"), MB_OK | MB_ICONINFORMATION);
      break;

    default:
      return E_INVALIDARG;
    }

  return NOERROR;
}

STDMETHODIMP CDeskBand::IsDirty ( void )

Definition at line 484 of file DeskBand.Cpp.

{
  return S_FALSE;
}

STDMETHODIMP CDeskBand::Load ( LPSTREAM pStream )

Definition at line 495 of file DeskBand.Cpp.

{
  return S_OK;
}

LRESULT CDeskBand::OnCommand | ( | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private]

Definition at line 694 of file DeskBand.Cpp.

{
  return 0;
}

LRESULT CDeskBand::OnKillFocus ( void ) [private]

Definition at line 750 of file DeskBand.Cpp.

{
  FocusChange(FALSE);

  return 0;
}

LRESULT CDeskBand::OnPaint ( void ) [private]

Definition at line 671 of file DeskBand.Cpp.

{
  PAINTSTRUCT ps;
  RECT        rc;

  BeginPaint(m_hWnd, &ps);

  GetClientRect(m_hWnd, &rc);
  SetTextColor(ps.hdc, RGB(0, 0, 0));
  SetBkMode(ps.hdc, TRANSPARENT);
  DrawText(ps.hdc, TEXT("Sample Desk Band"), -1, &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER);

  EndPaint(m_hWnd, &ps);

  return 0;
}

LRESULT CDeskBand::OnSetFocus ( void ) [private]

Definition at line 737 of file DeskBand.Cpp.

{
  FocusChange(TRUE);

  return 0;
}

LRESULT CDeskBand::OnSize ( LPARAM lParam ) [private]

Definition at line 705 of file DeskBand.Cpp.

{
  int   cx, cy;

  cx = LOWORD(lParam);
  cy = HIWORD(lParam);
  return 0;
}

STDMETHODIMP CDeskBand::QueryContextMenu | ( | HMENU | hMenu,
 |  | UINT | indexMenu,
 |  | UINT | idCmdFirst,
 |  | UINT | idCmdLast,
 |  | UINT | uFlags
 | ) |  |

Definition at line 533 of file DeskBand.Cpp.

{
  if(!(CMF_DEFAULTONLY & uFlags))
    {
      InsertMenu( hMenu,
      indexMenu,
      MF_STRING | MF_BYPOSITION,
      idCmdFirst + IDM_COMMAND,
      "&Desk Band Command");

      return MAKE_HRESULT(SEVERITY_SUCCESS, 0, USHORT(IDM_COMMAND + 1));
    }

  return MAKE_HRESULT(SEVERITY_SUCCESS, 0, USHORT(0));
}

STDMETHODIMP CDeskBand::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppReturn
 | ) |  |

Definition at line 76 of file DeskBand.Cpp.

{
  *ppReturn = NULL;

  //IUnknown
  if(IsEqualIID(riid, IID_IUnknown))
    {
      *ppReturn = this;
    }

  //IOleWindow
  else if(IsEqualIID(riid, IID_IOleWindow))
    {
      *ppReturn = (IOleWindow*)this;
    }

  //IDockingWindow
  else if(IsEqualIID(riid, IID_IDockingWindow))
    {
      *ppReturn = (IDockingWindow*)this;
    }

  //IInputObject
  else if(IsEqualIID(riid, IID_IInputObject))
    {
      *ppReturn = (IInputObject*)this;
    }

  //IObjectWithSite
  else if(IsEqualIID(riid, IID_IObjectWithSite))
    {
      *ppReturn = (IObjectWithSite*)this;
    }

  //IDeskBand
  else if(IsEqualIID(riid, IID_IDeskBand))
    {
      *ppReturn = (IDeskBand*)this;
    }

  //IPersist
  else if(IsEqualIID(riid, IID_IPersist))
    {
      *ppReturn = (IPersist*)this;
    }

  //IPersistStream
  else if(IsEqualIID(riid, IID_IPersistStream))
    {
      *ppReturn = (IPersistStream*)this;
    }

  //IContextMenu
  else if(IsEqualIID(riid, IID_IContextMenu))
    {
      *ppReturn = (IContextMenu*)this;
    }

  if(*ppReturn)
    {
      (*(LPUNKNOWN*)ppReturn)->AddRef();
      return S_OK;
    }

  return E_NOINTERFACE;
}

BOOL CDeskBand::RegisterAndCreateWindow ( void ) [private]

Definition at line 763 of file DeskBand.Cpp.

{
  //If the window doesn't exist yet, create it now.
  if(!m_hWnd)
    {
      //Can't create a child window without a parent.
      if(!m_hwndParent)
  {
    return FALSE;
  }

      //If the window class has not been registered, then do so.
      WNDCLASS wc;
      if(!GetClassInfo(g_hInst, DB_CLASS_NAME, &wc))
  {
    ZeroMemory(&wc, sizeof(wc));
    wc.style          = CS_HREDRAW | CS_VREDRAW | CS_GLOBALCLASS;
    wc.lpfnWndProc    = (WNDPROC)WndProc;
    wc.cbClsExtra     = 0;
    wc.cbWndExtra     = 0;
    wc.hInstance      = g_hInst;
    wc.hIcon          = NULL;
    wc.hCursor        = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground  = (HBRUSH)CreateSolidBrush(RGB(192, 0, 0));
    wc.lpszMenuName   = NULL;
    wc.lpszClassName  = DB_CLASS_NAME;

    if(!RegisterClass(&wc))
      {
        //If RegisterClass fails, CreateWindow below will fail.
      }
  }

      RECT  rc;

      GetClientRect(m_hwndParent, &rc);

      //Create the window. The WndProc will set m_hWnd.
      CreateWindowEx(   0,
      DB_CLASS_NAME,
      NULL,
      WS_CHILD | WS_CLIPSIBLINGS | WS_BORDER,
      rc.left,
      rc.top,
      rc.right - rc.left,
      rc.bottom - rc.top,
      m_hwndParent,
      NULL,
      g_hInst,
      (LPVOID)this);

    }

  return (NULL != m_hWnd);
}

STDMETHODIMP CDeskBand::ResizeBorderDW | ( | LPCRECT | prcBorder,
 |  | IUnknown * | punkToolbarSite,
 |  | BOOL | fReserved
 | ) |  |

Definition at line 255 of file DeskBand.Cpp.

{
  /*
    This method is never called for Band Objects.
*/
  return E_NOTIMPL;
}

STDMETHODIMP CDeskBand::Save | ( | LPSTREAM | pStream,
 |  | BOOL | fClearDirty
 | ) |  |

Definition at line 506 of file DeskBand.Cpp.

{
  return S_OK;
}

STDMETHODIMP CDeskBand::SetSite ( IUnknown * punkSite )

Definition at line 325 of file DeskBand.Cpp.

{
  //If a site is being held, release it.
  if(m_pSite)
    {
      m_pSite->Release();
      m_pSite = NULL;
    }

  //If punkSite is not NULL, a new site is being set.
  if(punkSite)
    {
      //Get the parent window.
      IOleWindow  *pOleWindow;

      m_hwndParent = NULL;

      if(SUCCEEDED(punkSite->QueryInterface(IID_IOleWindow, (LPVOID*)&pOleWindow)))
  {
    pOleWindow->GetWindow(&m_hwndParent);
    pOleWindow->Release();
  }

      if(!m_hwndParent)
  return E_FAIL;

      if(!RegisterAndCreateWindow())
  return E_FAIL;

   //Get and keep the IInputObjectSite pointer.
      if(SUCCEEDED(punkSite->QueryInterface(IID_IInputObjectSite, (LPVOID*)&m_pSite)))
  {
    return S_OK;
  }

      return E_FAIL;
    }

  return S_OK;
}

STDMETHODIMP CDeskBand::ShowDW ( BOOL fShow )

Definition at line 212 of file DeskBand.Cpp.

{
  if(m_hWnd)
    {
      if(fShow)
  {
    //show our window
    ShowWindow(m_hWnd, SW_SHOW);
  }
      else
  {
    //hide our window
    ShowWindow(m_hWnd, SW_HIDE);
  }
    }

  return S_OK;
}

CDeskBand::STDMETHODIMP_ ( DWORD )
CDeskBand::STDMETHODIMP_ ( DWORD )
STDMETHODIMP CDeskBand::TranslateAcceleratorIO ( LPMSG pMsg )

Definition at line 309 of file DeskBand.Cpp.

{
  return S_FALSE;
}

STDMETHODIMP CDeskBand::UIActivateIO | ( | BOOL | fActivate,
 |  | LPMSG | pMsg
 | ) |  |

Definition at line 276 of file DeskBand.Cpp.

{
  if(fActivate)
    SetFocus(m_hWnd);

  return S_OK;
}

LRESULT CALLBACK CDeskBand::WndProc | ( | HWND | hWnd,
 |  | UINT | uMessage,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static, private]

Definition at line 629 of file DeskBand.Cpp.

{
  CDeskBand  *pThis = (CDeskBand*)GetWindowLongPtr(hWnd, GWLP_USERDATA);

  switch (uMessage)
    {
    case WM_NCCREATE:
      {
  LPCREATESTRUCT lpcs = (LPCREATESTRUCT)lParam;
  pThis = (CDeskBand*)(lpcs->lpCreateParams);
  SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)pThis);

  //set the window handle
  pThis->m_hWnd = hWnd;
      }
      break;

    case WM_PAINT:
      return pThis->OnPaint();

    case WM_COMMAND:
      return pThis->OnCommand(wParam, lParam);

    case WM_SETFOCUS:
      return pThis->OnSetFocus();

    case WM_KILLFOCUS:
      return pThis->OnKillFocus();

    case WM_SIZE:
      return pThis->OnSize(lParam);
    }

  return DefWindowProc(hWnd, uMessage, wParam, lParam);
}

Member Data Documentation

BOOL CDeskBand::m_bFocus [private]

Definition at line 91 of file DeskBand.h.

DWORD CDeskBand::m_dwBandID [private]

Definition at line 95 of file DeskBand.h.

DWORD CDeskBand::m_dwViewMode [private]

Definition at line 94 of file DeskBand.h.

HWND CDeskBand::m_hWnd [private]

Definition at line 93 of file DeskBand.h.

HWND CDeskBand::m_hwndParent [private]

Definition at line 92 of file DeskBand.h.

DWORD CDeskBand::m_ObjRefCount [protected]

Definition at line 46 of file DeskBand.h.

IInputObjectSite* CDeskBand::m_pSite [private]

Definition at line 96 of file DeskBand.h.

The documentation for this class was generated from the following files:
  • WinUI/Shell/BandObjs/DeskBand.h
  • WinUI/Shell/BandObjs/DeskBand.Cpp
Generated on Wed Nov 13 2024 16:56:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDeviceFinderCallback Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Private Attributes

CDeviceFinderCallback Class Reference

#include "genericucpdlg.h"

List of all members.

Public Member Functions

CDeviceFinderCallback ()
~CDeviceFinderCallback ()
STDMETHOD() | DeviceAdded (LONG lFindData, IUPnPDevice *pDevice)
STDMETHOD() | DeviceRemoved (LONG lFindData, BSTR bstrUDN)
STDMETHOD() | SearchComplete (LONG lFindData)
void | SetDialogPointer (CGenericUCPDlg *pDialog)

Static Public Member Functions

static CDeviceFinderCallback * | Create ()

Private Attributes

CGenericUCPDlg * m_pGenericUCPDlg

Detailed Description

Definition at line 26 of file genericucpdlg.h.

Constructor & Destructor Documentation

CDeviceFinderCallback::CDeviceFinderCallback ( ) [inline]

Definition at line 33 of file genericucpdlg.h.

{};

CDeviceFinderCallback::~CDeviceFinderCallback ( ) [inline]

Definition at line 34 of file genericucpdlg.h.

{};

Member Function Documentation

CDeviceFinderCallback * CDeviceFinderCallback::Create ( void ) [static]

Definition at line 1841 of file GenericUCPDlg.cpp.

{
    CComObject<CDeviceFinderCallback> * pCallback = NULL;
    pCallback->CreateInstance(&pCallback);
    pCallback->GetUnknown()->AddRef();
    return pCallback;
}

HRESULT CDeviceFinderCallback::DeviceAdded | ( | LONG | lFindData,
 |  | IUPnPDevice * | pDevice
 | ) |  |

Definition at line 1882 of file GenericUCPDlg.cpp.

{
  HRESULT HR = S_OK;
  TRACE(_T("Device Added\n"));
  m_pGenericUCPDlg->AddDevice(pDevice);
  return HR;
}

HRESULT CDeviceFinderCallback::DeviceRemoved | ( | LONG | lFindData,
 |  | BSTR | bstrUDN
 | ) |  |

Definition at line 1908 of file GenericUCPDlg.cpp.

{
  TRACE(_T("Device Removed\n"));
  m_pGenericUCPDlg->RemoveDevice(bstrUDN);
  return S_OK;
}

HRESULT CDeviceFinderCallback::SearchComplete ( LONG lFindData )

Definition at line 1931 of file GenericUCPDlg.cpp.

{
    TRACE(_T("Search Complete\n"));
  m_pGenericUCPDlg->m_StatusText.SetWindowText(_T("Device Search Completed"));

  if(m_pGenericUCPDlg->m_DeviceCombo.GetCount()==0){
    m_pGenericUCPDlg->MessageBox(_T("Found no devices"));
  }
  return S_OK;
}

void CDeviceFinderCallback::SetDialogPointer ( CGenericUCPDlg * pDialog )

Definition at line 1863 of file GenericUCPDlg.cpp.

                                                                   {
  m_pGenericUCPDlg=pDialog;
}

Member Data Documentation

CGenericUCPDlg* CDeviceFinderCallback::m_pGenericUCPDlg [private]

Definition at line 31 of file genericucpdlg.h.

The documentation for this class was generated from the following files:
  • NetDS/upnp/GenericUCP/CPP/genericucpdlg.h
  • NetDS/upnp/GenericUCP/CPP/GenericUCPDlg.cpp
Generated on Wed Nov 13 2024 16:56:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDeviceNode Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes

CDeviceNode Class Reference

#include "devicenode.h"

Inherits CBaseNode, CBaseNode, CBaseNode, CBaseNode, CBaseNode, and CBaseNode.

List of all members.

Public Member Functions

CDeviceNode ()
CDeviceNode ()
CDeviceNode ()
CDeviceNode ()
CDeviceNode ()
CDeviceNode ()
virtual | ~CDeviceNode ()
virtual | ~CDeviceNode ()
virtual | ~CDeviceNode ()
virtual | ~CDeviceNode ()
virtual | ~CDeviceNode ()
virtual | ~CDeviceNode ()
HRESULT | AddFolderNode (NODE_PROPERTIES *pProperties)
HRESULT | AddMenuItems (LPCONTEXTMENUCALLBACK ipCallback, long __RPC_FAR *pInsertionAllowed)
HRESULT | AddMenuItems (LPCONTEXTMENUCALLBACK ipCallback, long __RPC_FAR *pInsertionAllowed)
HRESULT | AddMenuItems (LPCONTEXTMENUCALLBACK ipCallback, long __RPC_FAR *pInsertionAllowed)
HRESULT | AddMenuItems (LPCONTEXTMENUCALLBACK ipCallback, long __RPC_FAR *pInsertionAllowed)
HRESULT | AddMenuItems (LPCONTEXTMENUCALLBACK ipCallback, long __RPC_FAR *pInsertionAllowed)
HRESULT | AddMenuItems (LPCONTEXTMENUCALLBACK ipCallback, long __RPC_FAR *pInsertionAllowed)
HRESULT | Command (long lCommandID)
HRESULT | Command (long lCommandID)
HRESULT | Command (long lCommandID)
HRESULT | Command (long lCommandID)
HRESULT | Command (long lCommandID)
HRESULT | Command (long lCommandID)
HRESULT | ControlbarNotify (LPARAM nArg, LPARAM lParam, LONG_PTR pComp)
HRESULT | CreatePropertyPages (LPPROPERTYSHEETCALLBACK lpCallback, LONG_PTR Handle)
HRESULT | CreatePropertyPages (LPPROPERTYSHEETCALLBACK lpCallback, LONG_PTR Handle)
DWORD GetAttributes ()
LPWSTR | GetAttributeString ()
HRESULT | GetDisplayInfo (SCOPEDATAITEM *pSDI)
HRESULT | GetDisplayInfo (RESULTDATAITEM *pRDI)
HRESULT | GetDisplayInfo (SCOPEDATAITEM *pSDI)
HRESULT | GetDisplayInfo (RESULTDATAITEM *pRDI)
HRESULT | GetDisplayInfo (SCOPEDATAITEM *pSDI)
HRESULT | GetDisplayInfo (RESULTDATAITEM *pRDI)
HRESULT | GetDisplayInfo (RESULTDATAITEM *pRDI)
HRESULT | GetDisplayInfo (SCOPEDATAITEM *pSDI)
HRESULT | GetDisplayInfo (RESULTDATAITEM *pRDI)
HRESULT | GetDisplayInfo (SCOPEDATAITEM *pSDI)
HRESULT | GetDisplayInfo (SCOPEDATAITEM *pSDI)
HRESULT | GetDisplayInfo (RESULTDATAITEM *pRDI)
GUID & | GetNodeGUID ()
GUID & | GetNodeGUID ()
GUID & | GetNodeGUID ()
GUID & | GetNodeGUID ()
GUID & | GetNodeGUID ()
GUID & | GetNodeGUID ()
ULONG GetNodeType ()
ULONG GetNodeType ()
ULONG GetNodeType ()
ULONG GetNodeType ()
ULONG GetNodeType ()
ULONG GetNodeType ()
LPWSTR | GetObjectPath ()
HRESULT | GetProperties (LPNODEPROPS *ppNodeProps)
HRESULT | GetProperty (BSTR bstrPropertyName, PBSTR pbstrProperty)
HRESULT | GetResultViewType2 (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pRVTinfo)
HRESULT | GetResultViewType2 (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pRVTinfo)
HRESULT | GetResultViewType2 (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pRVTinfo)
HRESULT | GetResultViewType2 (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pRVTinfo)
HRESULT | GetResultViewType2 (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pRVTinfo)
HRESULT | GetResultViewType2 (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pRVTinfo)
HRESULT | GetWatermarks (HBITMAP __RPC_FAR *lphWatermark, HBITMAP __RPC_FAR *lphHeader, HPALETTE __RPC_FAR *lphPalette, BOOL __RPC_FAR *bStretch)
HRESULT | GetWatermarks (HBITMAP __RPC_FAR *lphWatermark, HBITMAP __RPC_FAR *lphHeader, HPALETTE __RPC_FAR *lphPalette, BOOL __RPC_FAR *bStretch)
HRESULT | Initialize (NODE_PROPERTIES *pNodeProps)
HRESULT | Initialize (LPNODEPROPS pNodeProps)
HRESULT | Initialize (NODE_PROPERTIES *pNodeProps)
HRESULT | Initialize (NODE_PROPERTIES *pNodeProps)
HRESULT | Initialize (NODE_PROPERTIES *pNodeProps)
HRESULT | Initialize (NODE_PROPERTIES *pNodeProps)
BOOL | IsAttributeSet (DWORD dwAttribute)
HRESULT | OnContextHelp (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnCutOrMove (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnDelete (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pComponent)
HRESULT | OnDelete (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnDelete (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnExpand (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pCompData)
HRESULT | OnExpand (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pCompData)
HRESULT | OnExpand (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pCompData)
HRESULT | OnExpand (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pCompData)
HRESULT | OnExpand (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pCompData)
HRESULT | OnExpand (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pCompData)
HRESULT | OnPaste (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnQueryPaste (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnRemoveChildren (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pCompData)
HRESULT | OnRemoveChildren (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pCompData)
HRESULT | OnRemoveChildren (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pCompData)
HRESULT | OnRemoveChildren (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pCompData)
HRESULT | OnRemoveChildren (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pCompData)
HRESULT | OnRemoveChildren (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pCompData)
HRESULT | OnRename (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnRename (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnRename (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnSelect (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnSelect (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pComponent)
HRESULT | OnSelect (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnSelect (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pComponent)
HRESULT | OnSelect (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnSelect (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnShow (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnShow (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnShow (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pComponent)
HRESULT | OnShow (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnShow (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnShow (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pComponent)
HRESULT | OnViewChange (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnViewChange (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | QueryForPropertyPage ()
HRESULT | QueryForPropertyPage ()
VOID | RemoveAttribute (DWORD dwAttribute)
VOID | RemoveChildNode (LONG_PTR pChildNode)
VOID | SetAttribute (DWORD dwAttribute)
VOID | ToggleStatus ()
VOID | ToggleStatus ()
VOID | ToggleStatus ()
VOID | ToggleStatus ()
VOID | ToggleStatus ()
VOID | ToggleStatus ()

Static Public Member Functions

static LRESULT CALLBACK | DeviceNodeWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)

Public Attributes

HWND | m_hAddFolderDlg

Private Member Functions

HRESULT | DeleteChildItems (LPCONSOLENAMESPACE2 ipCNS2)
HRESULT | DeleteChildItems (LPCONSOLENAMESPACE2 ipCNS)
HRESULT | DeleteChildItems (LPCONSOLENAMESPACE2 ipCNS2)
HRESULT | DeleteChildItems (LPCONSOLENAMESPACE2 ipCNS2)
HRESULT | DeleteChildItems (LPCONSOLENAMESPACE2 ipCNS)
HRESULT | DeleteChildItems (LPCONSOLENAMESPACE2 ipCNS)
HRESULT | InitDefaultFolder ()
HRESULT | InsertChildItems (LPCONSOLENAMESPACE2 ipCNS2)
HRESULT | InsertChildItems (LPCONSOLENAMESPACE2 ipCNS2)
HRESULT | InsertChildItems (LPCONSOLENAMESPACE2 ipCNS2)
HRESULT | InsertChildItems (LPCONSOLENAMESPACE2 ipCNS)
HRESULT | InsertChildItems (LPCONSOLENAMESPACE2 ipCNS)
HRESULT | InsertChildItems (LPCONSOLENAMESPACE2 ipCNS)
HRESULT | RefreshNodeList ()
HRESULT | RefreshNodeList ()
HRESULT | RefreshNodeList ()
HRESULT | RefreshNodeList ()
HRESULT | RefreshNodeList ()
VOID | RemoveChildNodes ()
VOID | RemoveNodes ()
VOID | RemoveNodes ()
VOID | RemoveNodes ()
VOID | RemoveNodes ()
VOID | RemoveNodes ()

Private Attributes

BOOL m_bOnlineStatus
DWORD m_dwAttributes
HWND | m_hMessageWnd
HSCOPEITEM | m_hParentNode
CLListImpl< CBaseNode
*, CBaseNode * > 		m_NodeList
CComponentData * m_pCompData
CStaticNode * m_pParentNode
LPWSTR | m_wzStatus

Static Private Attributes

static GUID | m_thisGUID = CLSID_DeviceNode
static GUID | thisGUID = CLSID_DeviceNode

Detailed Description

Definition at line 30 of file devicenode.h.

Constructor & Destructor Documentation

CDeviceNode::CDeviceNode ( )

Definition at line 34 of file devicenode.cpp.

{
  m_SDI.mask        = DEFAULT_SDI_MASK;
  m_SDI.displayname = MMC_CALLBACK;
  m_SDI.cChildren   = 1;              // Determines if the '+' is displayed
  m_SDI.lParam      = reinterpret_cast<LPARAM>(this);

  m_dwAttributes    = 0;
  m_wzStatus        = NULL;
  m_hParentNode     = NULL;
  m_pCompData       = NULL;
}

CDeviceNode::~CDeviceNode ( ) [virtual]

Definition at line 48 of file devicenode.cpp.

{
}

CDeviceNode::CDeviceNode ( )
virtual CDeviceNode::~CDeviceNode ( ) [virtual]
CDeviceNode::CDeviceNode ( )
virtual CDeviceNode::~CDeviceNode ( ) [virtual]
CDeviceNode::CDeviceNode ( )
virtual CDeviceNode::~CDeviceNode ( ) [virtual]
CDeviceNode::CDeviceNode ( )
virtual CDeviceNode::~CDeviceNode ( ) [virtual]
CDeviceNode::CDeviceNode ( )
virtual CDeviceNode::~CDeviceNode ( ) [virtual]

Member Function Documentation

HRESULT CDeviceNode::AddFolderNode ( NODE_PROPERTIES * pProperties )

Definition at line 514 of file devicenode.cpp.

{
  _ASSERT( NULL != pProperties );

  CFolderNode* pNode   = NULL;
  HRESULT      hResult = S_FALSE;

  // In this case we always have the same parent
  pProperties->pParentObject  = reinterpret_cast<LONG_PTR>(this);
  pProperties->pComponentData = reinterpret_cast<LONG_PTR>(m_pCompData);

  pNode = new CFolderNode;             // Create and initialize the new
  pNode->Initialize( pProperties );    // node, then add to our linked
  m_NodeList.AddTail( pNode );         // list, then insert the node

  pNode->m_SDI.relativeID = m_hParentNode;

  LPCONSOLENAMESPACE2 ipCNS = NULL;
  hResult = m_pCompData->GetInterface( REQUEST_ICONSOLENAMESPACE, (LONG_PTR*)&ipCNS );
  if( S_OK != hResult )
    return hResult;

  hResult = ipCNS->InsertItem( &pNode->m_SDI );

  return hResult;
}

HRESULT CDeviceNode::AddMenuItems | ( | LPCONTEXTMENUCALLBACK | ipCallback,
 |  | long __RPC_FAR * | pInsertionAllowed |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 476 of file devicenode.cpp.

{
  _ASSERT( NULL != ipCallback );
  HRESULT hResult = S_FALSE;

  static CONTEXTMENUITEM ctxMenu[2];
    ctxMenu[0].lCommandID        = IDM_NEW_FOLDER;
    ctxMenu[0].lInsertionPointID = CCM_INSERTIONPOINTID_PRIMARY_NEW;
    ctxMenu[0].fFlags            = 0;
    ctxMenu[0].fSpecialFlags     = 0;
    ctxMenu[0].strName           = L"New Folder...";
    ctxMenu[0].strStatusBarText  = L"Add a new folder";

    ctxMenu[1].lCommandID        = IDM_TOGGLE_STATUS;
    ctxMenu[1].lInsertionPointID = CCM_INSERTIONPOINTID_PRIMARY_TASK;
    ctxMenu[1].fFlags            = 0;
    ctxMenu[1].fSpecialFlags     = 0;
    ctxMenu[1].strName           = L"Toggle Online Status";
    ctxMenu[1].strStatusBarText  = L"Toggles the device status";

  // Add the Add new folder command
  if( CCM_INSERTIONALLOWED_NEW & *pInsertionAllowed )
  {
    hResult = ipCallback->AddItem( &ctxMenu[0] );
  }

  // Add the Toggle item to the Task menu if allowed...
  if( CCM_INSERTIONALLOWED_TASK & *pInsertionAllowed )
  {
    hResult = ipCallback->AddItem( &ctxMenu[1] );
  }

  return hResult;
}

HRESULT CDeviceNode::AddMenuItems | ( | LPCONTEXTMENUCALLBACK | ipCallback,
 |  | long __RPC_FAR * | pInsertionAllowed |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::AddMenuItems | ( | LPCONTEXTMENUCALLBACK | ipCallback,
 |  | long __RPC_FAR * | pInsertionAllowed |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::AddMenuItems | ( | LPCONTEXTMENUCALLBACK | ipCallback,
 |  | long __RPC_FAR * | pInsertionAllowed |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::AddMenuItems | ( | LPCONTEXTMENUCALLBACK | ipCallback,
 |  | long __RPC_FAR * | pInsertionAllowed |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::AddMenuItems | ( | LPCONTEXTMENUCALLBACK | ipCallback,
 |  | long __RPC_FAR * | pInsertionAllowed |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::Command ( long lCommandID ) [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::Command ( long lCommandID ) [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::Command ( long lCommandID ) [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::Command ( long lCommandID ) [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::Command ( long lCommandID ) [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::Command ( long lCommandID ) [virtual]

Implements CBaseNode.

Definition at line 517 of file devicenode.cpp.

{
  HRESULT hResult = S_OK;

  switch( lCommandID )
  {
    case IDM_TOGGLE_STATUS:
    {
      ToggleStatus();
      break;
    }
    case IDM_NEW_FOLDER:
    {
      MsgBox( _T("New Folders not supported"), _T("Test") );
      break;
    }
    default:
      hResult = S_FALSE;
      break;

  }
  return hResult;
}

HRESULT CDeviceNode::ControlbarNotify | ( | LPARAM | nArg,
 |  | LPARAM | lParam,
 |  | LONG_PTR | pComp |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 689 of file devicenode.cpp.

{
  HRESULT hResult = S_FALSE;
  BOOL bScope  = (BOOL)LOWORD(nArg);
  BOOL bSelect = (BOOL)HIWORD(nArg);

  CComponent* pComponent = reinterpret_cast<CComponent*>(pComp);

  IControlbar* ipControlbar = NULL;
  hResult = pComponent->GetInterface( REQUEST_ICONTROLBAR, (LONG_PTR*)&ipControlbar );
  if( S_OK != hResult )
    return hResult;

  IToolbar* ipToolbar = NULL;
  hResult = pComponent->GetInterface( REQUEST_IDEVICETOOLBAR, (LONG_PTR*)&ipToolbar );
  if( S_OK != hResult )
    return hResult;

  if( TRUE == bSelect )
  {
    hResult = ipControlbar->Attach(TOOLBAR, (LPUNKNOWN)ipToolbar);
    hResult = ipToolbar->SetButtonState( IDM_NEW_FOLDER, ENABLED, TRUE );
    hResult = ipToolbar->SetButtonState( IDM_TOGGLE_STATUS, ENABLED, TRUE );
  }
  else
  {
    hResult = ipControlbar->Detach( (LPUNKNOWN)ipToolbar );
  }

  return hResult;
}

HRESULT CDeviceNode::CreatePropertyPages | ( | LPPROPERTYSHEETCALLBACK | lpCallback,
 |  | LONG_PTR | Handle |
 | ) |  |  | [inline, virtual]

Implements CBaseNode.

Definition at line 53 of file devicenode.h.

            { return E_NOTIMPL; }

HRESULT CDeviceNode::CreatePropertyPages | ( | LPPROPERTYSHEETCALLBACK | lpCallback,
 |  | LONG_PTR | Handle |
 | ) |  |  | [inline, virtual]

Implements CBaseNode.

Definition at line 53 of file devicenode.h.

            { return E_NOTIMPL; }

HRESULT CDeviceNode::DeleteChildItems ( LPCONSOLENAMESPACE2 ipCNS ) [private]
HRESULT CDeviceNode::DeleteChildItems ( LPCONSOLENAMESPACE2 ipCNS ) [private]
HRESULT CDeviceNode::DeleteChildItems ( LPCONSOLENAMESPACE2 ipCNS ) [private]
HRESULT CDeviceNode::DeleteChildItems ( LPCONSOLENAMESPACE2 ipCNS2 ) [private]
HRESULT CDeviceNode::DeleteChildItems ( LPCONSOLENAMESPACE2 ipCNS2 ) [private]

Definition at line 318 of file devicenode.cpp.

{
  _ASSERT( NULL != ipCNS2 );

  POSITION    Pos     = m_NodeList.GetHeadPosition();
  HSCOPEITEM  hItem   = NULL;
  LPBASENODE  pNode   = NULL;
  HRESULT     hResult = S_FALSE;

  while( Pos )                         // Delete everything...
  {
    pNode = m_NodeList.GetNext( Pos );
    hItem = (HSCOPEITEM)pNode->m_SDI.ID;
    if( 0 != hItem )
      hResult = ipCNS2->DeleteItem( hItem, TRUE );
  }

  return hResult;
}

HRESULT CDeviceNode::DeleteChildItems ( LPCONSOLENAMESPACE2 ipCNS2 ) [private]
LRESULT CALLBACK CDeviceNode::DeviceNodeWndProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 124 of file devicenode.cpp.

{
  switch( uMsg )
  {
    // Since we registered the WndClass in Initialize, our WndProc will be
    // called with WM_CREATE right away.  Store our 'hWnd' pointer in the
    // CREATESTRUCT so we can retreive it later to get back to the specific
    // instance of CComponentData
    //
    case WM_CREATE:
    {
      LPCREATESTRUCT lpcs = (LPCREATESTRUCT)lParam;
      SetWindowLongPtr( hWnd, 0, (LONG_PTR)lpcs->lpCreateParams );
      break;
    }

    // This is our custom message which could have been sent from a worker
    // thread, or in this case a modeless dialog.  We retrieve our 'this'
    // pointer from the WndClass and cast it to a CComponentData pointer.
    // WPARAM is cast to a NODE_PROPERTIES struct which can be used to
    // call AddDeviceNode()
    //
    case WM_ADDNEW_NODE:
    {
      CDeviceNode* pThisNode = (CDeviceNode*)GetWindowLongPtr( hWnd, 0 );
      NODE_PROPERTIES* pProps = (NODE_PROPERTIES*)wParam;
      pThisNode->AddFolderNode( pProps );
      break;
    }

    // This message is sent by the AddDeviceDlg to let us know it's
    // being terminated.  Set our member handle to NULL so the item
    // will be show on the context menu
    //
    case WM_DIALOG_CLOSED:
    {
      CDeviceNode* pThisNode = (CDeviceNode*)GetWindowLongPtr( hWnd, 0 );
      pThisNode->m_hAddFolderDlg = NULL;
      break;
    }
    default:
      return DefWindowProc( hWnd, uMsg, wParam, lParam );
  }
  return 0;
}

DWORD CDeviceNode::GetAttributes ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 107 of file devicenode.h.

{ return 0; }

LPWSTR CDeviceNode::GetAttributeString ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 106 of file devicenode.h.

{ return m_pAttributeStr; }

HRESULT CDeviceNode::GetDisplayInfo ( SCOPEDATAITEM * pSDI ) [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::GetDisplayInfo ( RESULTDATAITEM * pRDI ) [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::GetDisplayInfo ( SCOPEDATAITEM * pSDI ) [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::GetDisplayInfo ( SCOPEDATAITEM * pSDI ) [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::GetDisplayInfo ( RESULTDATAITEM * pRDI ) [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::GetDisplayInfo ( RESULTDATAITEM * pRDI ) [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::GetDisplayInfo ( SCOPEDATAITEM * pSDI ) [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::GetDisplayInfo ( SCOPEDATAITEM * pSDI ) [virtual]

Implements CBaseNode.

Definition at line 116 of file devicenode.cpp.

{
  _ASSERT( NULL != pSDI );
  pSDI->displayname = m_pwszNodeName;

  return S_OK;
}

HRESULT CDeviceNode::GetDisplayInfo ( RESULTDATAITEM * pRDI ) [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::GetDisplayInfo ( RESULTDATAITEM * pRDI ) [virtual]

Implements CBaseNode.

Definition at line 128 of file devicenode.cpp.

{
  _ASSERT( NULL != pRDI );

  HRESULT hResult = S_OK;

  if( pRDI->mask & RDI_STR )         // Console is requesting strings...
  {                                  // for each column
    switch( pRDI->nCol )
    {
      case 0:
        pRDI->str = m_pwszNodeName;
        break;

      case 1:                        // Attributes not supported yet
        pRDI->str = m_wzStatus;
        break;

      default:
        hResult = S_FALSE;
        TRACE_VAL(_T("GetDisplayInfo"), _T("Column"), pRDI->nCol );
        break;
    }
  }
  if( pRDI->mask & RDI_IMAGE )       // Looking for an image?
  {
    pRDI->nImage = m_SDI.nImage;
  }

  TRACE_HRESULT(_T("GetDisplayInfo"), hResult );
  return hResult;

}

HRESULT CDeviceNode::GetDisplayInfo ( SCOPEDATAITEM * pSDI ) [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::GetDisplayInfo ( RESULTDATAITEM * pRDI ) [virtual]

Implements CBaseNode.

GUID& CDeviceNode::GetNodeGUID ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 42 of file devicenode.h.

{ return m_thisGUID; }

GUID& CDeviceNode::GetNodeGUID ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 44 of file devicenode.h.

{ return thisGUID; }

GUID& CDeviceNode::GetNodeGUID ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 42 of file devicenode.h.

{ return thisGUID; };

GUID& CDeviceNode::GetNodeGUID ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 42 of file devicenode.h.

{ return thisGUID; };

GUID& CDeviceNode::GetNodeGUID ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 42 of file devicenode.h.

{ return thisGUID; }

GUID& CDeviceNode::GetNodeGUID ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 42 of file devicenode.h.

{ return thisGUID; }

ULONG CDeviceNode::GetNodeType ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 41 of file devicenode.h.

{ return NODETYPE_DEVICE; }

ULONG CDeviceNode::GetNodeType ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 41 of file devicenode.h.

{ return NODETYPE_DEVICE; }

ULONG CDeviceNode::GetNodeType ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 41 of file devicenode.h.

{ return NODETYPE_DEVICE; };

ULONG CDeviceNode::GetNodeType ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 41 of file devicenode.h.

{ return NODETYPE_DEVICE; };

ULONG CDeviceNode::GetNodeType ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 43 of file devicenode.h.

{ return NODETYPE_DEVICE; }

ULONG CDeviceNode::GetNodeType ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 41 of file devicenode.h.

{ return NODETYPE_DEVICE; }

LPWSTR CDeviceNode::GetObjectPath ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 108 of file devicenode.h.

{ return NULL; }

HRESULT CDeviceNode::GetProperties ( LPNODEPROPS * ppNodeProps ) [virtual]

Implements CBaseNode.

Definition at line 110 of file devicenode.cpp.

{
  _ASSERT( NULL == *ppNodeProps );
  return E_NOTIMPL;
}

HRESULT CDeviceNode::GetProperty | ( | BSTR | bstrPropertyName,
 |  | PBSTR | pbstrProperty |
 | ) |  |  | [inline, virtual]

Implements CBaseNode.

Definition at line 43 of file devicenode.h.

{ return E_NOTIMPL; }

HRESULT CDeviceNode::GetResultViewType2 | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pRVTinfo |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::GetResultViewType2 | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pRVTinfo |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::GetResultViewType2 | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pRVTinfo |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 98 of file devicenode.cpp.

{
  LPOLESTR pszDescStr = (LPOLESTR)CoTaskMemAlloc( sizeof(L"DefaultListView")+1 );
  if( NULL == pszDescStr )
    return E_OUTOFMEMORY;

  wcscpy( pszDescStr, L"DefaultListView" );
  pRVTinfo->pstrPersistableViewDescription = pszDescStr;

  return S_OK;
}

HRESULT CDeviceNode::GetResultViewType2 | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pRVTinfo |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::GetResultViewType2 | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pRVTinfo |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::GetResultViewType2 | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pRVTinfo |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::GetWatermarks | ( | HBITMAP __RPC_FAR * | lphWatermark,
 |  | HBITMAP __RPC_FAR * | lphHeader,
 |  | HPALETTE __RPC_FAR * | lphPalette,
 |  | BOOL __RPC_FAR * | bStretch |
 | ) |  |  | [inline, virtual]

Implements CBaseNode.

Definition at line 56 of file devicenode.h.

            { return E_NOTIMPL; }

HRESULT CDeviceNode::GetWatermarks | ( | HBITMAP __RPC_FAR * | lphWatermark,
 |  | HBITMAP __RPC_FAR * | lphHeader,
 |  | HPALETTE __RPC_FAR * | lphPalette,
 |  | BOOL __RPC_FAR * | bStretch |
 | ) |  |  | [inline, virtual]

Implements CBaseNode.

Definition at line 56 of file devicenode.h.

            { return E_NOTIMPL; }

HRESULT CDeviceNode::InitDefaultFolder ( ) [private]

Definition at line 572 of file devicenode.cpp.

{
  NODEPROPS NodeProps;
  NodeProps.pComponentData = reinterpret_cast<LONG_PTR>(m_pCompData);
  NodeProps.pParentObject  = reinterpret_cast<LONG_PTR>(this);
  NodeProps.dwAttributes   = 0;
  NodeProps.nChildCount    = INIT_DEFAULT_NODE;

  RemoveNodes();             // Clean the node list

  LPBASENODE pNode = NULL;
  wcscpy( NodeProps.szNodeName, gwszFOLDER_NODE_NAME );
  pNode = new CFolderNode;
  pNode->Initialize( &NodeProps );
  m_NodeList.AddTail( pNode );

  return S_OK;
}

HRESULT CDeviceNode::Initialize ( LPNODEPROPS pNodeProps ) [virtual]

Implements CBaseNode.

Definition at line 58 of file devicenode.cpp.

{
  _ASSERT( NULL != pNodeProps );

  UINT   nLen   = wcslen( pNodeProps->szNodeName ) + 1;
  LPWSTR pszTmp = (LPWSTR)CoTaskMemAlloc(nLen * sizeof(WCHAR));
  wcscpy( pszTmp, pNodeProps->szNodeName );
  if( NULL != m_pwszNodeName )
    CoTaskMemFree( m_pwszNodeName );

  m_pwszNodeName = pszTmp;
  m_pCompData    = reinterpret_cast<CComponentData*>(pNodeProps->pComponentData);
  m_pParentNode  = reinterpret_cast<CStaticNode*>(pNodeProps->pParentObject);
  m_dwAttributes = pNodeProps->dwAttributes;

  if( INIT_DEFAULT_NODE == pNodeProps->nChildCount )
  {
    InitDefaultFolder();
  }

  // Set images according to device type
  //
  if( pNodeProps->dwAttributes & ATTRIBUTE_BACKUP_DEVICE )
  {
    m_SDI.nImage      = IMG_DEVICE_DEFAULT;
    m_SDI.nOpenImage  = IMG_DEVICE_DEFAULT;
    m_dwAttributes   |= ATTRIBUTE_BACKUP_DEVICE;
  }
  else
  {
    m_SDI.nImage      = IMG_DRIVE_DEFAULT;
    m_SDI.nOpenImage  = IMG_DRIVE_DEFAULT;
    m_dwAttributes   |= ~ATTRIBUTE_BACKUP_DEVICE;
  }

  m_wzStatus      = L"Online";    // Node successfully initialized
  m_bOnlineStatus = STATUS_ONLINE;

  return S_OK;
}

HRESULT CDeviceNode::Initialize ( NODE_PROPERTIES * pNodeProps ) [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::Initialize ( NODE_PROPERTIES * pNodeProps ) [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::Initialize ( NODE_PROPERTIES * pNodeProps ) [virtual]

Implements CBaseNode.

Definition at line 56 of file devicenode.cpp.

{
  _ASSERT( NULL != pNodeProps );

  UINT   nLen   = wcslen( pNodeProps->szNodeName ) + 1;
  LPWSTR pszTmp = (LPWSTR)CoTaskMemAlloc(nLen * sizeof(WCHAR));
  wcscpy( pszTmp, pNodeProps->szNodeName );
  if( NULL != m_pwszNodeName )
    CoTaskMemFree( m_pwszNodeName );

  m_pwszNodeName = pszTmp;
  m_pCompData    = reinterpret_cast<CComponentData*>(pNodeProps->pComponentData);

  RefreshNodeList();                   // Add child nodes
                                       // and set images

  if( pNodeProps->dwAttributes & ATTRIBUTE_BACKUP_DEVICE )
  {
    m_SDI.nImage      = IMG_DEVICE_DEFAULT;
    m_SDI.nOpenImage  = IMG_DEVICE_DEFAULT;
    m_dwAttributes   |= ATTRIBUTE_BACKUP_DEVICE;
  }
  else
  {
    m_SDI.nImage      = IMG_DRIVE_DEFAULT;
    m_SDI.nOpenImage  = IMG_DRIVE_DEFAULT;
    m_dwAttributes   |= ~ATTRIBUTE_BACKUP_DEVICE;
  }

  m_wzStatus      = L"Online";    // Node successfully initialized
  m_bOnlineStatus = STATUS_ONLINE;

  return S_OK;
}

HRESULT CDeviceNode::Initialize ( NODE_PROPERTIES * pNodeProps ) [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::Initialize ( NODE_PROPERTIES * pNodeProps ) [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::InsertChildItems ( LPCONSOLENAMESPACE2 ipCNS ) [private]
HRESULT CDeviceNode::InsertChildItems ( LPCONSOLENAMESPACE2 ipCNS ) [private]
HRESULT CDeviceNode::InsertChildItems ( LPCONSOLENAMESPACE2 ipCNS ) [private]
HRESULT CDeviceNode::InsertChildItems ( LPCONSOLENAMESPACE2 ipCNS2 ) [private]
HRESULT CDeviceNode::InsertChildItems ( LPCONSOLENAMESPACE2 ipCNS2 ) [private]
HRESULT CDeviceNode::InsertChildItems ( LPCONSOLENAMESPACE2 ipCNS2 ) [private]

Definition at line 343 of file devicenode.cpp.

{
  _ASSERT( NULL != ipCNS2 );
  _ASSERT( NULL != m_hParentNode );

  HRESULT    hResult = S_FALSE;
  POSITION   Pos     = m_NodeList.GetHeadPosition();
  LPBASENODE pNode   = NULL;

  while( Pos )
  {
    pNode   = m_NodeList.GetNext( Pos );
    pNode->m_SDI.relativeID = m_hParentNode;
    hResult = ipCNS2->InsertItem( &pNode->m_SDI );
  }

  return hResult;
}

BOOL CDeviceNode::IsAttributeSet ( DWORD dwAttribute ) [inline, virtual]

Implements CBaseNode.

Definition at line 103 of file devicenode.h.

{ return FALSE; }

HRESULT CDeviceNode::OnContextHelp | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 305 of file devicenode.cpp.

{
  HRESULT   hResult = S_FALSE;
  CComponent* pComp = reinterpret_cast<CComponent*>(pComponent);

  LPOLESTR pszBaseHelpPath  = GetHelpFilePath();
  LPOLESTR pszTopicPath     = L"::/DeviceNodes.html";

  // Allocate space for the topic string
  SIZE_T nBasePathLen  = wcslen( pszBaseHelpPath );
  SIZE_T nTopicPathLen = wcslen( pszTopicPath );
  SIZE_T nBufferSize   = (nBasePathLen + nTopicPathLen + 1) * sizeof(WCHAR);

  // Build the topic string
  LPOLESTR pszThisTopicPath = (LPOLESTR)CoTaskMemAlloc( nBufferSize );
  wcscpy( pszThisTopicPath, pszBaseHelpPath );
  wcscat( pszThisTopicPath, pszTopicPath );

  // Request a pointer to IDisplayHelp
  IDisplayHelp* ipDisplayHelp = NULL;
  pComp->GetInterface( REQUEST_IDISPLAYHELP, (LONG_PTR*)&ipDisplayHelp );

  hResult = ipDisplayHelp->ShowTopic( pszThisTopicPath );

  TRACE_HRESULT(_T("OnContextHelp"), hResult );   // Return value is not used
  return hResult;
}

HRESULT CDeviceNode::OnCutOrMove | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 475 of file devicenode.cpp.

{
  // Device nodes can't be Cut/Pasted to other nodes to we don't
  // need to handle this notification

  return S_FALSE;
}

HRESULT CDeviceNode::OnDelete | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [inline, virtual]

Implements CBaseNode.

Definition at line 71 of file devicenode.h.

            { return E_NOTIMPL; }

HRESULT CDeviceNode::OnDelete | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [inline, virtual]

Implements CBaseNode.

Definition at line 72 of file devicenode.h.

            { return E_NOTIMPL; }

HRESULT CDeviceNode::OnDelete | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [inline, virtual]

Implements CBaseNode.

Definition at line 60 of file devicenode.h.

            { return E_NOTIMPL; }

HRESULT CDeviceNode::OnExpand | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 274 of file devicenode.cpp.

{
  HRESULT hResult = S_FALSE;

  // Cache HSCOPEITEM of Parent
  m_hParentNode = static_cast<HSCOPEITEM>(nParam);

  if( NULL == m_pCompData )
    m_pCompData = reinterpret_cast<CComponentData*>(pCompData);

  // Request an IConsoleNameSpace2 pointer from CComponentData
  LPCONSOLENAMESPACE2 ipCNS = NULL;
  hResult = m_pCompData->GetInterface( REQUEST_ICONSOLENAMESPACE, (LONG_PTR*)&ipCNS );
  if( S_OK != hResult )
    return hResult;

  hResult = DeleteChildItems( ipCNS );
  hResult = InsertChildItems( ipCNS );

  //TRACE_HRESULT( _T("OnExpand"), hResult );
  return hResult;
}

HRESULT CDeviceNode::OnExpand | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::OnExpand | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 240 of file devicenode.cpp.

{
  HRESULT hResult = S_FALSE;

  if( NULL == m_pCompData )
    m_pCompData = reinterpret_cast<CComponentData*>(pCompData);

  // Request an IConsoleNameSpace2 pointer from CComponentData
  LPCONSOLENAMESPACE2 ipCNS2 = NULL;
  hResult = m_pCompData->GetInterface( REQUEST_ICONSOLENAMESPACE2, (LONG_PTR*)&ipCNS2 );
  if( S_OK != hResult )
    return hResult;

  ipCNS2->AddRef();
  m_hParentNode = (HSCOPEITEM)nParam;  // Cache HSCOPEITEM of Parent

  hResult = DeleteChildItems( ipCNS2 );
  hResult = InsertChildItems( ipCNS2 );

  ipCNS2->Release();

  TRACE_HRESULT( _T("OnExpand"), hResult );
  return hResult;
}

HRESULT CDeviceNode::OnExpand | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::OnExpand | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::OnExpand | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::OnPaste | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 404 of file devicenode.cpp.

{
  _ASSERT( NULL != nArg );
  _ASSERT( NULL != pComponent );
  HRESULT hResult = S_FALSE;
  CComponent* pComp = reinterpret_cast<CComponent*>(pComponent);
  LPDATAOBJECT ipSourceDO = reinterpret_cast<LPDATAOBJECT>(nArg);

  do
  {
    // Test to see if the data object supports the clipformat we need
    FORMATETC NodePropFormatEtc = NP_FORMATETC;
    hResult = ipSourceDO->QueryGetData( &NodePropFormatEtc );
    BREAK_ON_ERROR( hResult );

    STGMEDIUM StgMedium = {TYMED_HGLOBAL, NULL};
    hResult = ipSourceDO->GetData( &NodePropFormatEtc, &StgMedium );
    BREAK_ON_ERROR( hResult );

    HGLOBAL hMemBlock = ::GlobalLock( StgMedium.hGlobal );
    LPNODEPROPS pNodeProps = (LPNODEPROPS)hMemBlock;

    // Set variables which must be local
    pNodeProps->pParentObject  = reinterpret_cast<LONG_PTR>(this);
    pNodeProps->pComponentData = reinterpret_cast<LONG_PTR>(m_pCompData);

    // Now add the new node
    CFolderNode* pNode = NULL;
    pNode = new CFolderNode;
    pNode->Initialize( pNodeProps );
    m_NodeList.AddTail( pNode );

    // Now do some housekeeping, and test that everything went OK....
    BOOL    bStatus = ::GlobalUnlock( StgMedium.hGlobal );
    HGLOBAL hReturn = ::GlobalFree( StgMedium.hGlobal );
    _ASSERT( NULL == hReturn );

    if( NULL != nParam )
    {
      // We must AddRef it becuase MMC will release it once when we
      // return, and again when CFolderNode::OnCutOrMove returns.
      //
      BOOL* pbPasted = reinterpret_cast<BOOL*>(nParam);
      ULONG nCount = ipSourceDO->AddRef();
      *pbPasted = reinterpret_cast<BOOL>(ipSourceDO);
    }

    // Insert the new node and select it
    //
    LPCONSOLENAMESPACE2 ipCNS = NULL;
    hResult = m_pCompData->GetInterface( REQUEST_ICONSOLENAMESPACE, (LONG_PTR*)&ipCNS );
    pNode->m_SDI.relativeID = m_SDI.ID;
    hResult = ipCNS->InsertItem( &pNode->m_SDI );

    LPCONSOLE3 ipConsole3 = NULL;
    hResult = m_pCompData->GetInterface( REQUEST_ICONSOLE, (LONG_PTR*)&ipConsole3 );
    hResult = ipConsole3->SelectScopeItem( m_SDI.ID );

  }while(0);

  return hResult;
}

HRESULT CDeviceNode::OnQueryPaste | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 380 of file devicenode.cpp.

{
  _ASSERT( NULL != nArg );
  // Make the default operation "Copy Here" as opposed to "Move Here"
  DWORD* pdwDefaultOperation = reinterpret_cast<DWORD*>(nParam);
  *pdwDefaultOperation = MMC_DEFAULT_OPERATION_COPY;

  ULONG nTypeFlag = ExtractNodeTypeFlg( reinterpret_cast<LPDATAOBJECT>(nArg) );
  return (NODETYPE_FOLDER == nTypeFlag) ? S_OK : S_FALSE;
}

HRESULT CDeviceNode::OnRemoveChildren | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::OnRemoveChildren | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 273 of file devicenode.cpp.

{
  HRESULT hResult = S_FALSE;

  if( NULL == m_pCompData )
    m_pCompData = reinterpret_cast<CComponentData*>(pCompData);

  LPCONSOLENAMESPACE2 ipCNS2 = NULL;
  hResult = m_pCompData->GetInterface( REQUEST_ICONSOLENAMESPACE2, (LONG_PTR*)&ipCNS2 );
  if( S_OK != hResult )
    return hResult;

  ipCNS2->AddRef();
                                       // Deletes HSCOPEITEMS only...
  hResult = DeleteChildItems( ipCNS2 );

  POSITION   Pos   = m_NodeList.GetHeadPosition();
  LPBASENODE pNode = NULL;
  while( Pos )                         // Delete everything...
  {
    pNode = m_NodeList.GetNext( Pos );
    pNode->OnRemoveChildren( ipDataObject, nArg, nParam, pCompData );
    delete pNode;
  }

  m_NodeList.RemoveAll();            // Cleans up the list

  ipCNS2->Release();

  TRACE_HRESULT( _T("OnRemoveChildren"), hResult );
  return hResult;

}

HRESULT CDeviceNode::OnRemoveChildren | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 305 of file devicenode.cpp.

{
  HRESULT hResult = S_FALSE;

  if( NULL == m_pCompData )
    m_pCompData = reinterpret_cast<CComponentData*>(pCompData);

  LPCONSOLENAMESPACE2 ipCNS = NULL;
  hResult = m_pCompData->GetInterface( REQUEST_ICONSOLENAMESPACE, (LONG_PTR*)&ipCNS );
  if( S_OK != hResult )
    return hResult;
                                       // Deletes HSCOPEITEMS only...
  hResult = DeleteChildItems( ipCNS );

  POSITION   Pos   = m_NodeList.GetHeadPosition();
  LPBASENODE pNode = NULL;
  while( Pos )                         // Delete everything...
  {
    pNode = m_NodeList.GetNext( Pos );
    pNode->OnRemoveChildren( ipDataObject, nArg, nParam, pCompData );
    delete pNode;
  }

  m_NodeList.RemoveAll();            // Cleans up the list

  //TRACE_HRESULT( _T("OnRemoveChildren"), hResult );
  return hResult;
}

HRESULT CDeviceNode::OnRemoveChildren | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::OnRemoveChildren | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::OnRemoveChildren | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::OnRename | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::OnRename | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [inline, virtual]

Implements CBaseNode.

Definition at line 57 of file devicenode.h.

            { return E_NOTIMPL; }

HRESULT CDeviceNode::OnRename | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 344 of file devicenode.cpp.

{
  _ASSERT( NULL != ipDataObject );
  HRESULT hResult = S_OK;

  LPWSTR pszTmpName = NULL;
  LPWSTR pszNewName = (LPWSTR)nParam;  // New name
  LONG   nLen = wcslen( pszNewName ) + 1;

  pszTmpName = (LPWSTR)CoTaskMemAlloc(nLen * sizeof(WCHAR));
  if( NULL == pszTmpName )
  {
    hResult = S_FALSE;                 // Can't change the name
  }
  else
  {
    wcscpy( pszTmpName, pszNewName );
    CoTaskMemFree( m_pwszNodeName );   // Free existing name...
    m_pwszNodeName = pszTmpName;       // Assign new name to pointer
  }
  return hResult;
}

HRESULT CDeviceNode::OnSelect | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 170 of file devicenode.cpp.

{
  HRESULT hResult = S_FALSE;

  // Not setting verbs for this node

  TRACE_HRESULT(_T("OnSelect"), hResult );
  return hResult;
}

HRESULT CDeviceNode::OnSelect | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 195 of file devicenode.cpp.

{
  HRESULT hResult = S_FALSE;
  BOOL    fScopePane = LOWORD(nArg);
  BOOL    fSelected  = HIWORD(nArg);

  CComponent* pComp  = reinterpret_cast<CComponent*>(pComponent);

  if( TRUE == fSelected )
  {
    IConsoleVerb* ipConsoleVerb = NULL;
    hResult = pComp->GetInterface( REQUEST_ICONSOLEVERB, (LONG_PTR*)&ipConsoleVerb );
    if( S_OK != hResult )
     return hResult;

    // DRAGDROP: Add MMC_VERB_PASTE for this object only
    hResult = ipConsoleVerb->SetVerbState( MMC_VERB_PASTE, ENABLED, TRUE );

    // Support renaming of device nodes
    hResult = ipConsoleVerb->SetVerbState( MMC_VERB_RENAME, ENABLED, TRUE );
  }
  //TRACE_HRESULT(_T("OnSelect"), hResult );
  return hResult;
}

HRESULT CDeviceNode::OnSelect | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::OnSelect | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::OnSelect | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::OnSelect | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::OnShow | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::OnShow | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::OnShow | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 188 of file devicenode.cpp.

{
  HRESULT  hResult = S_FALSE;

  CComponent* pComp = reinterpret_cast<CComponent*>(pComponent);

  LPHEADERCTRL2  ipHeaderCtrl2 = NULL;
  hResult = pComp->GetInterface( REQUEST_IHEADERCTRL2, (LONG_PTR*)&ipHeaderCtrl2 );
  if( S_OK != hResult )
   return hResult;

  LPRESULTDATA  ipResultData = NULL;
  hResult = pComp->GetInterface( REQUEST_IRESULTDATA, (LONG_PTR*)&ipResultData );
  if( S_OK != hResult )
   return hResult;

  ipHeaderCtrl2->AddRef();
  ipResultData->AddRef();

  if( TRUE == nArg )  // Selecting a scope node
  {
    do
    {
      hResult = ipHeaderCtrl2->InsertColumn( 0, L"Folder Name", 0, 150 );
      BREAK_ON_ERROR( hResult );

      hResult = ipHeaderCtrl2->InsertColumn( 1, L"Attributes", 0, 150 );
      BREAK_ON_ERROR( hResult );

      hResult = ipResultData->ModifyViewStyle( MMC_NOSORTHEADER, (MMC_RESULT_VIEW_STYLE)NULL );
      BREAK_ON_ERROR( hResult );

    }while(0);
  }
  else // not handling deselect notifications
  {
  }

  ipHeaderCtrl2->Release();
  ipResultData->Release();

  TRACE_HRESULT(_T("OnShow"), hResult );
  return hResult;
}

HRESULT CDeviceNode::OnShow | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 228 of file devicenode.cpp.

{
  HRESULT  hResult = S_FALSE;

  CComponent* pComp = reinterpret_cast<CComponent*>(pComponent);

  LPHEADERCTRL2  ipHeaderCtrl = NULL;
  hResult = pComp->GetInterface( REQUEST_IHEADERCTRL, (LONG_PTR*)&ipHeaderCtrl );
  if( S_OK != hResult )
   return hResult;

  LPRESULTDATA  ipResultData = NULL;
  hResult = pComp->GetInterface( REQUEST_IRESULTDATA, (LONG_PTR*)&ipResultData );
  if( S_OK != hResult )
   return hResult;

  if( TRUE == nArg )  // Selecting a scope node
  {
    do
    {
      hResult = ipHeaderCtrl->InsertColumn( 0, L"Folder Name", 0, 150 );
      BREAK_ON_ERROR( hResult );

      hResult = ipHeaderCtrl->InsertColumn( 1, L"Attributes", 0, 150 );
      BREAK_ON_ERROR( hResult );

      hResult = ipResultData->ModifyViewStyle( MMC_NOSORTHEADER, (MMC_RESULT_VIEW_STYLE)NULL );
      BREAK_ON_ERROR( hResult );

    }while(0);
  }
  else // not handling deselect notifications
  {
  }

  //TRACE_HRESULT(_T("OnShow"), hResult );
  return hResult;
}

HRESULT CDeviceNode::OnShow | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::OnShow | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CDeviceNode::OnViewChange | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [inline, virtual]

Reimplemented from CBaseNode.

Definition at line 58 of file devicenode.h.

            { return E_NOTIMPL; }

HRESULT CDeviceNode::OnViewChange | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [inline, virtual]

Reimplemented from CBaseNode.

Definition at line 63 of file devicenode.h.

            { return E_NOTIMPL; }

HRESULT CDeviceNode::QueryForPropertyPage ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 50 of file devicenode.h.

            { return E_NOTIMPL; }

HRESULT CDeviceNode::QueryForPropertyPage ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 50 of file devicenode.h.

            { return E_NOTIMPL; }

HRESULT CDeviceNode::RefreshNodeList ( ) [private]

Definition at line 368 of file devicenode.cpp.

{
  NODE_PROPERTIES NodeProps;
  NodeProps.pComponentData = reinterpret_cast<LONG_PTR>(m_pCompData);
  NodeProps.pParentObject  = reinterpret_cast<LONG_PTR>(this);

  WCHAR  szNames[1][32];
  wcscpy( szNames[0], L"Root Folder" );

  RemoveNodes();             // Clean the node list

  LPBASENODE pNode = NULL;
  for( DWORD i = 0; i < 1; i++ )
  {
    wcscpy( NodeProps.szNodeName, szNames[i] );
    pNode = new CFolderNode;
    pNode->Initialize( &NodeProps );
    m_NodeList.AddTail( pNode );
  }

  return S_OK;
}

HRESULT CDeviceNode::RefreshNodeList ( ) [private]
HRESULT CDeviceNode::RefreshNodeList ( ) [private]
HRESULT CDeviceNode::RefreshNodeList ( ) [private]
HRESULT CDeviceNode::RefreshNodeList ( ) [private]
VOID CDeviceNode::RemoveAttribute ( DWORD dwAttribute ) [inline, virtual]

Implements CBaseNode.

Definition at line 105 of file devicenode.h.

{}

VOID CDeviceNode::RemoveChildNode ( LONG_PTR pChildNode )

Definition at line 497 of file devicenode.cpp.

{
  CBaseNode* pNode  = NULL;
  CBaseNode* pChild = reinterpret_cast<CBaseNode*>(pChildNode);
  POSITION   NewPos = m_NodeList.GetHeadPosition();
  POSITION   OldPos = NULL;
  while( NewPos )
  {
    OldPos = NewPos;                   // Need to save this
    pNode = m_NodeList.GetNext( NewPos );
    if( pNode == pChild )
    {
      m_NodeList.RemoveAt( OldPos );
      continue;                        // Exit, found it
    }
  }
}

VOID CDeviceNode::RemoveChildNodes ( ) [private]

Definition at line 371 of file devicenode.cpp.

{
  LPBASENODE pNode = NULL;
  POSITION   Pos   = m_NodeList.GetHeadPosition();
  while( Pos )
  {
    pNode = m_NodeList.GetNext( Pos );
    delete pNode;
  }
  m_NodeList.RemoveAll();              // Clean the list
}

VOID CDeviceNode::RemoveNodes ( ) [private]

Definition at line 396 of file devicenode.cpp.

{
  LPBASENODE pNode = NULL;
  POSITION   Pos   = m_NodeList.GetHeadPosition();
  while( Pos )
  {
    pNode = m_NodeList.GetNext( Pos );
    delete pNode;
  }
  m_NodeList.RemoveAll();              // Clean the list
}

VOID CDeviceNode::RemoveNodes ( ) [private]
VOID CDeviceNode::RemoveNodes ( ) [private]
VOID CDeviceNode::RemoveNodes ( ) [private]
VOID CDeviceNode::RemoveNodes ( ) [private]
VOID CDeviceNode::SetAttribute ( DWORD dwAttribute ) [inline, virtual]

Implements CBaseNode.

Definition at line 104 of file devicenode.h.

{}

VOID CDeviceNode::ToggleStatus ( )
VOID CDeviceNode::ToggleStatus ( )
VOID CDeviceNode::ToggleStatus ( )
VOID CDeviceNode::ToggleStatus ( )
VOID CDeviceNode::ToggleStatus ( )
VOID CDeviceNode::ToggleStatus ( )

Definition at line 412 of file devicenode.cpp.

{
  // First we have to set the image indexes according to the Online Status
  // and the device type
  //
  if( STATUS_ONLINE == m_bOnlineStatus )
  {
    m_bOnlineStatus = STATUS_OFFLINE;
    m_wzStatus      = L"Offline";
    if( m_dwAttributes & ATTRIBUTE_BACKUP_DEVICE )
    {
      m_SDI.nImage      = IMG_DEVICE_OFFLINE;
      m_SDI.nOpenImage  = IMG_DEVICE_OFFLINE;
    }
    else
    {
      m_SDI.nImage      = IMG_DRIVE_OFFLINE;
      m_SDI.nOpenImage  = IMG_DRIVE_OFFLINE;
    }
  }
  else
  {
    m_bOnlineStatus = STATUS_ONLINE;
    m_wzStatus      = L"Online";
    if( m_dwAttributes & ATTRIBUTE_BACKUP_DEVICE )
    {
      m_SDI.nImage      = IMG_DEVICE_DEFAULT;
      m_SDI.nOpenImage  = IMG_DEVICE_DEFAULT;
    }
    else
    {
      m_SDI.nImage      = IMG_DRIVE_DEFAULT;
      m_SDI.nOpenImage  = IMG_DRIVE_DEFAULT;
    }
  }
  // This is a scope node, so GetDisplayInfo will only ask for images for
  // this node when it is in the Result Pane.  To change the image for the
  // the Scope Pane we need to call IConsoleNameSpace2::SetItem().  This
  // call forces the scope node to be redrawn.
  //
  SCOPEDATAITEM  sdi;
  ZeroMemory( &sdi, sizeof(SCOPEDATAITEM) );
  sdi.mask        = SDI_IMAGE | SDI_OPENIMAGE ;
  sdi.ID          = m_SDI.ID;
  sdi.nImage      = m_SDI.nImage;
  sdi.nOpenImage  = m_SDI.nOpenImage;

  // Request an IConsoleNameSpace2 pointer from CComponentData
  HRESULT  hResult = S_FALSE;
  LPCONSOLENAMESPACE2 ipCNS2 = NULL;
  hResult = m_pCompData->GetInterface( REQUEST_ICONSOLENAMESPACE2, (LONG*)&ipCNS2 );
  if( S_OK == hResult )
    hResult = ipCNS2->SetItem( &sdi );

}

Member Data Documentation

BOOL CDeviceNode::m_bOnlineStatus [private]

Definition at line 78 of file devicenode.h.

DWORD CDeviceNode::m_dwAttributes [private]

Reimplemented from CBaseNode.

Definition at line 75 of file devicenode.h.

HWND CDeviceNode::m_hAddFolderDlg

Definition at line 96 of file devicenode.h.

HWND CDeviceNode::m_hMessageWnd [private]

Definition at line 89 of file devicenode.h.

HSCOPEITEM CDeviceNode::m_hParentNode [private]

Definition at line 76 of file devicenode.h.

CLListImpl< CBaseNode *, CBaseNode * > CDeviceNode::m_NodeList [private]

Definition at line 80 of file devicenode.h.

CComponentData * CDeviceNode::m_pCompData [private]

Definition at line 81 of file devicenode.h.

CStaticNode* CDeviceNode::m_pParentNode [private]

Definition at line 95 of file devicenode.h.

GUID CDeviceNode::m_thisGUID = CLSID_DeviceNode [static, private]

Definition at line 84 of file devicenode.h.

LPWSTR CDeviceNode::m_wzStatus [private]

Definition at line 77 of file devicenode.h.

static GUID CDeviceNode::thisGUID = CLSID_DeviceNode [static, private]

Definition at line 74 of file devicenode.h.

The documentation for this class was generated from the following files:
  • SysMgmt/MMC/mmc2.0/contextmenu/devicenode.h
  • SysMgmt/MMC/mmc2.0/dragdrop/devicenode.h
  • SysMgmt/MMC/mmc2.0/help/devicenode.h
  • SysMgmt/MMC/mmc2.0/multisel/devicenode.h
  • SysMgmt/MMC/mmc2.0/proppage/devicenode.h
  • SysMgmt/MMC/mmc2.0/viewex/devicenode.h
  • SysMgmt/MMC/mmc2.0/contextmenu/devicenode.cpp
  • SysMgmt/MMC/mmc2.0/dragdrop/devicenode.cpp
  • SysMgmt/MMC/mmc2.0/help/devicenode.cpp
  • SysMgmt/MMC/mmc2.0/multisel/devicenode.cpp
  • SysMgmt/MMC/mmc2.0/proppage/devicenode.cpp
  • SysMgmt/MMC/mmc2.0/viewex/devicenode.cpp
Generated on Wed Nov 13 2024 16:56:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDeviceProp Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes

CDeviceProp Class Reference

#include "deviceprop.h"

List of all members.

Public Types

enum | { IDD = IDD_DEVPROP_DIALOG }

Public Member Functions

CDeviceProp (CWnd *pParent=NULL)
CDeviceProp (IUPnPDevice *pDevice, CWnd *pParent=NULL)
~CDeviceProp ()

Public Attributes

CEdit | m_DeviceType
CEdit | m_FriendlyName
CEdit | m_Manufacturer
CEdit | m_ManufacturerUrl
CEdit | m_ModelDescription
CEdit | m_ModelName
CEdit | m_ModelNumber
CEdit | m_ModelUrl
CButton | m_OkButton
CEdit | m_PresentationUrl
CEdit | m_SerialNumber
CEdit | m_UDN
CEdit | m_UPC

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
virtual BOOL | OnInitDialog ()
afx_msg void | OnOk ()

Private Member Functions

void | PrintTextToEditBox (CEdit *pEditBox, BSTR bstrPrintText, HRESULT hrCheck)

Private Attributes

IUPnPDevice * | pCurrentDevice

Detailed Description

Definition at line 20 of file deviceprop.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 29 of file deviceprop.h.

{ IDD = IDD_DEVPROP_DIALOG };

Constructor & Destructor Documentation

CDeviceProp::CDeviceProp ( CWnd * pParent = NULL )
CDeviceProp::CDeviceProp | ( | IUPnPDevice * | pDevice,
 |  | CWnd * | pParent = NULL
 | ) |  |

Definition at line 26 of file deviceprop.cpp.

: CDialog(CDeviceProp::IDD, pParent)
{
  //{{AFX_DATA_INIT(CDeviceProp)
  //}}AFX_DATA_INIT
    pCurrentDevice=pDevice;
  pCurrentDevice->AddRef();
}

CDeviceProp::~CDeviceProp ( )

Definition at line 35 of file deviceprop.cpp.

                         {

  pCurrentDevice->Release();
}

Member Function Documentation

void CDeviceProp::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 40 of file deviceprop.cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CDeviceProp)
  DDX_Control(pDX, IDC_OK, m_OkButton);
  DDX_Control(pDX, IDC_EDITUPC, m_UPC);
  DDX_Control(pDX, IDC_EDITUDN, m_UDN);
  DDX_Control(pDX, IDC_EDITSERIALNUMBER, m_SerialNumber);
  DDX_Control(pDX, IDC_EDITPRESENTATIONURL, m_PresentationUrl);
  DDX_Control(pDX, IDC_EDITMODELURL, m_ModelUrl);
  DDX_Control(pDX, IDC_EDITMODELNUMBER, m_ModelNumber);
  DDX_Control(pDX, IDC_EDITMODELNAME, m_ModelName);
  DDX_Control(pDX, IDC_EDITMODELDESCRIPTION, m_ModelDescription);
  DDX_Control(pDX, IDC_EDITMANUFACTURERURL, m_ManufacturerUrl);
  DDX_Control(pDX, IDC_EDITMANUFACTURER, m_Manufacturer);
  DDX_Control(pDX, IDC_EDITFRIENDLYNAME, m_FriendlyName);
  DDX_Control(pDX, IDC_EDITDEVICETYPE, m_DeviceType);
  //}}AFX_DATA_MAP
}

BOOL CDeviceProp::OnInitDialog ( ) [protected, virtual]

Definition at line 94 of file deviceprop.cpp.

{
    CDialog::OnInitDialog();

  HRESULT hr=S_OK;
  BSTR  bstrTemp = NULL;

  // Print all the properties to the respective edit boxes.

  hr=pCurrentDevice->get_UniqueDeviceName(&bstrTemp);
  PrintTextToEditBox(&m_UDN, bstrTemp, hr);
  SysFreeString(bstrTemp);

  hr=pCurrentDevice->get_FriendlyName(&bstrTemp);
  PrintTextToEditBox(&m_FriendlyName, bstrTemp, hr);
  SysFreeString(bstrTemp);

  hr=pCurrentDevice->get_Type(&bstrTemp);
  PrintTextToEditBox(&m_DeviceType, bstrTemp, hr);
  SysFreeString(bstrTemp);

  hr=pCurrentDevice->get_PresentationURL(&bstrTemp);
  PrintTextToEditBox(&m_PresentationUrl, bstrTemp, hr);
  SysFreeString(bstrTemp);

  hr=pCurrentDevice->get_ManufacturerName(&bstrTemp);
  PrintTextToEditBox(&m_Manufacturer, bstrTemp, hr);
  SysFreeString(bstrTemp);

  hr=pCurrentDevice->get_ManufacturerURL(&bstrTemp);
  PrintTextToEditBox(&m_ManufacturerUrl, bstrTemp, hr);
  SysFreeString(bstrTemp);

  hr=pCurrentDevice->get_ModelName(&bstrTemp);
  PrintTextToEditBox(&m_ModelName, bstrTemp, hr);
  SysFreeString(bstrTemp);

  hr=pCurrentDevice->get_ModelNumber(&bstrTemp);
  PrintTextToEditBox(&m_ModelNumber, bstrTemp, hr);
  SysFreeString(bstrTemp);

  hr=pCurrentDevice->get_Description(&bstrTemp);
  PrintTextToEditBox(&m_ModelDescription, bstrTemp, hr);
  SysFreeString(bstrTemp);

  hr=pCurrentDevice->get_ModelURL(&bstrTemp);
  PrintTextToEditBox(&m_ModelUrl, bstrTemp, hr);
  SysFreeString(bstrTemp);

  hr=pCurrentDevice->get_UPC(&bstrTemp);
  PrintTextToEditBox(&m_UPC, bstrTemp, hr);
  SysFreeString(bstrTemp);

  hr=pCurrentDevice->get_SerialNumber(&bstrTemp);
  PrintTextToEditBox(&m_SerialNumber, bstrTemp, hr);
  SysFreeString(bstrTemp);

    return TRUE;
}

void CDeviceProp::OnOk ( ) [protected]

Definition at line 70 of file deviceprop.cpp.

{
  // TODO: Add your control notification handler code here
  EndDialog(1);
  return;
}

void CDeviceProp::PrintTextToEditBox | ( | CEdit * | pEditBox,
 |  | BSTR | bstrPrintText,
 |  | HRESULT | hrCheck |
 | ) |  |  | [private]

Definition at line 170 of file deviceprop.cpp.

{
  TCHAR tszPropertyString[DATA_BUFSIZE];
  if( hrCheck != S_OK ){
    PrintErrorText(hrCheck);
  }
  else{
    _sntprintf(tszPropertyString, DATA_BUFSIZE-1, _T("%S"), bstrPrintText);
    (*pEditBox).SetWindowText(tszPropertyString);
  }

}

Member Data Documentation

CEdit CDeviceProp::m_DeviceType

Definition at line 42 of file deviceprop.h.

CEdit CDeviceProp::m_FriendlyName

Definition at line 41 of file deviceprop.h.

CEdit CDeviceProp::m_Manufacturer

Definition at line 40 of file deviceprop.h.

CEdit CDeviceProp::m_ManufacturerUrl

Definition at line 39 of file deviceprop.h.

CEdit CDeviceProp::m_ModelDescription

Definition at line 38 of file deviceprop.h.

CEdit CDeviceProp::m_ModelName

Definition at line 37 of file deviceprop.h.

CEdit CDeviceProp::m_ModelNumber

Definition at line 36 of file deviceprop.h.

CEdit CDeviceProp::m_ModelUrl

Definition at line 35 of file deviceprop.h.

CButton CDeviceProp::m_OkButton

Definition at line 30 of file deviceprop.h.

CEdit CDeviceProp::m_PresentationUrl

Definition at line 34 of file deviceprop.h.

CEdit CDeviceProp::m_SerialNumber

Definition at line 33 of file deviceprop.h.

CEdit CDeviceProp::m_UDN

Definition at line 32 of file deviceprop.h.

CEdit CDeviceProp::m_UPC

Definition at line 31 of file deviceprop.h.

IUPnPDevice* CDeviceProp::pCurrentDevice [private]

Definition at line 64 of file deviceprop.h.

The documentation for this class was generated from the following files:
  • NetDS/upnp/GenericUCP/CPP/deviceprop.h
  • NetDS/upnp/GenericUCP/CPP/deviceprop.cpp
Generated on Wed Nov 13 2024 16:56:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDialogBase Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CDialogBase Class Reference

#include "wizard.h"

Inherited by CProgress, CS1Dialog, CS2Dialog, CS3Dialog, CS4Dialog, CTypesDialog, and CWizard.

List of all members.

Public Member Functions

CDialogBase (HWND hWnd, HINSTANCE hInst)
virtual | ~CDialogBase ()
virtual ULONG | Destroy ()
virtual ULONG | Display ()=0

Public Attributes

HINSTANCE | m_hInst
HWND | m_hWnd

Detailed Description

Definition at line 57 of file wizard.h.

Constructor & Destructor Documentation

CDialogBase::CDialogBase | ( | HWND | hWnd,
 |  | HINSTANCE | hInst
 | ) |  |

Definition at line 27 of file wizard.cpp.

{
  ASSERT(hInst);

  m_hWnd  = hWnd;
  m_hInst = hInst;
}

CDialogBase::~CDialogBase ( ) [virtual]

Definition at line 39 of file wizard.cpp.

{
  Destroy();
}

Member Function Documentation

ULONG CDialogBase::Destroy ( ) [virtual]

Reimplemented in CProgress.

Definition at line 49 of file wizard.cpp.

{
  if(m_hWnd)
  {
    EndDialog(m_hWnd, 0);
    m_hWnd = NULL;
  }

  return 0;
}

virtual ULONG CDialogBase::Display ( ) [pure virtual]

Implemented in CProgress, CS1Dialog, CS2Dialog, CS3Dialog, CS4Dialog, CTypesDialog, and CWizard.

Member Data Documentation

HINSTANCE CDialogBase::m_hInst

Definition at line 70 of file wizard.h.

HWND CDialogBase::m_hWnd

Definition at line 69 of file wizard.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/tablecopy/wizard.h
  • Dataaccess/oledb/tablecopy/wizard.cpp
Generated on Wed Nov 13 2024 16:56:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDialogLite Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Public Attributes

CDialogLite Class Reference

#include "cdialoglite.h"

Inherits CWndLite.

Inherited by CAboutDlg, CAlterColumnDlg, CAlterIndexDlg, CAlterTableDlg, CConstraintDlg, CEditValueDlg, CExecuteParamDlg, CInterfaceDlg, CPropertiesDlg, and CPropPageLite.

List of all members.

Public Member Functions

CDialogLite (UINT uIDD=0)
virtual | ~CDialogLite ()
virtual HWND | CreateDlg (HWND hWndParent)
virtual LRESULT | DoModal (HWND hWndParent)
virtual void | EndDialog (int nResult)
virtual BOOL | HandleMessage (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
virtual BOOL | OnActivate (UINT fActive, UINT fMinimized, HWND hWndPrevious)
virtual BOOL | OnCancel ()
virtual BOOL | OnInitDialog ()
virtual BOOL | OnOK ()

Static Public Member Functions

static INT_PTR WINAPI | DlgProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)

Public Attributes

BOOL m_fModal
UINT m_uIDD

Detailed Description

Definition at line 333 of file cdialoglite.h.

Constructor & Destructor Documentation

CDialogLite::CDialogLite ( UINT uIDD = 0 )

Definition at line 1500 of file cdialoglite.cpp.

{
  m_uIDD    = uIDD;
  m_fModal  = TRUE;
}

CDialogLite::~CDialogLite ( ) [virtual]

Definition at line 1511 of file cdialoglite.cpp.

{
}

Member Function Documentation

HWND CDialogLite::CreateDlg ( HWND hWndParent ) [virtual]

Definition at line 1577 of file cdialoglite.cpp.

{
  //Modeless (non-Modal) Dialog Box
  m_hWndParent  = hWndParent;
  m_fModal    = FALSE;
  return CreateDialogParam(GetAppLite()->m_hInstance, MAKEINTRESOURCE(m_uIDD), m_hWndParent, DlgProc, (LPARAM)this);
}

INT_PTR WINAPI CDialogLite::DlgProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 1639 of file cdialoglite.cpp.

{
  CDialogLite* pCDialogLite = (CDialogLite*)GetThis(hWnd);

  switch (msg)
  {
    case WM_INITDIALOG:
    {
      //Save the Window Handle
      pCDialogLite = (CDialogLite*)lParam;
      pCDialogLite->m_hWnd = hWnd;

      //Save the "this" pointer
      SetThis(hWnd, pCDialogLite);
      return pCDialogLite->OnInitDialog();
    }
  };

  if(pCDialogLite)
    return pCDialogLite->HandleMessage(hWnd, msg, wParam, lParam);

  return FALSE;
};

LRESULT CDialogLite::DoModal ( HWND hWndParent ) [virtual]

Definition at line 1564 of file cdialoglite.cpp.

{
  //Modal Dialog Box
  m_hWndParent  = hWndParent;
  m_fModal    = TRUE;
  return DisplayDialog(m_uIDD, m_hWndParent, DlgProc, (LPARAM)this);
}

void CDialogLite::EndDialog ( int nResult ) [virtual]

Definition at line 1590 of file cdialoglite.cpp.

{
    ::EndDialog(m_hWnd, nResult);
}

BOOL CDialogLite::HandleMessage | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Reimplemented in CPropPageLite.

Definition at line 1600 of file cdialoglite.cpp.

{
  switch(msg)
  {
    case WM_COMMAND:
    {
      UINT wNotifyCode  = HIWORD(wParam); // notification code
      UINT iID      = LOWORD(wParam); // item, control, or accelerator identifier
      HWND hWndCtrl   = (HWND)lParam;   // handle of control

      //Filter out any Control Notification codes
      //  wNotifyCode   - Specifies the notification code if the message is from a control. If the message is from an accelerator, this parameter is 1. If the message is from a menu, this parameter is 0.
      //  wID       - Specifies the identifier of the menu item, control, or accelerator.
      //  hwndCtl     - Identifies the control sending the message if the message is from a control. Otherwise, this parameter is NULL.
      if(hWndCtrl && wNotifyCode)
        return OnCommandNotify(wNotifyCode, iID, hWndCtrl);

      //We are only interested in the following
      switch(iID)
      {
        case IDOK:
          return OnOK();

        case IDCANCEL:
          return OnCancel();
      };
      break;
    }
  };

  //Otherwise pass onto our main window handler
  return CWndLite::HandleMessage(hWnd, msg, wParam, lParam);
}

BOOL CDialogLite::OnActivate | ( | UINT | fActive,
 |  | UINT | fMinimized,
 |  | HWND | hWndPrevious |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 1530 of file cdialoglite.cpp.

{
  if(!m_fModal)
    CAppLite::m_hWndModeless = fActive ? m_hWnd : NULL;

  return FALSE;
}

BOOL CDialogLite::OnCancel ( ) [virtual]

Reimplemented in CPropPageLite.

Definition at line 1553 of file cdialoglite.cpp.

{
  EndDialog(IDCANCEL);
  return TRUE;
}

BOOL CDialogLite::OnInitDialog ( ) [virtual]

Reimplemented in CAboutDlg, CInterfaceDlg, CEditValueDlg, CFullConnectProvider, CFullConnectProperties, CFullConnectSecurity, CFullConnectOptions, CAboutDlg, COptionsDataSource, COptionsCommand, COptionsAccessor, COptionsRowset, COptionsNotify, COptionsError, and CAboutDlg.

Definition at line 1520 of file cdialoglite.cpp.

{
  return TRUE;
}

BOOL CDialogLite::OnOK ( ) [virtual]

Reimplemented in CInterfaceDlg, CEditValueDlg, and CPropPageLite.

Definition at line 1543 of file cdialoglite.cpp.

{
  EndDialog(IDOK);
  return TRUE;
}

Member Data Documentation

BOOL CDialogLite::m_fModal

Definition at line 358 of file cdialoglite.h.

UINT CDialogLite::m_uIDD

Definition at line 357 of file cdialoglite.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialoglite.h
  • Dataaccess/oledb/rowsetviewer/cdialoglite.cpp
Generated on Wed Nov 13 2024 16:56:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDialogStream Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CDialogStream Class Reference

List of all members.

Public Member Functions

CDialogStream (HGLOBAL hResource)
~CDialogStream ()
BOOL __stdcall | Align16 ()
BOOL __stdcall | Align32 ()
short __stdcall | GetInt16 ()
int __stdcall | GetInt32 ()
int __stdcall | GetInt8 ()
TCHAR *__stdcall | GetStr ()
unsigned short __stdcall | GetUInt16 ()
BOOL __stdcall | Move (int cbBytes)
BOOL __stdcall | Undo16 ()

Private Attributes

char * | m_pch

Detailed Description

Definition at line 325 of file msiloc.cpp.

Constructor & Destructor Documentation

CDialogStream::CDialogStream ( HGLOBAL hResource )

Definition at line 4104 of file msiloc.cpp.

  : m_pch((char*)hResource)
{
  // Constructor
}

CDialogStream::~CDialogStream ( )

Definition at line 4110 of file msiloc.cpp.

{
  // Destructor
}

Member Function Documentation

BOOL CDialogStream::Align16 ( )

Definition at line 4082 of file msiloc.cpp.

{
  m_pch = (char*)(int(m_pch) + 1 & ~ 1);
  return TRUE;
}

BOOL CDialogStream::Align32 ( )

Definition at line 4074 of file msiloc.cpp.

{
  m_pch = (char*)(int(m_pch) + 3 & ~ 3);
  return TRUE;
}

short CDialogStream::GetInt16 ( )

Definition at line 4006 of file msiloc.cpp.

{
  short i = *(short*)m_pch;
  m_pch += sizeof(short);
  return i;
}

int CDialogStream::GetInt32 ( )

Definition at line 4024 of file msiloc.cpp.

{
  int i = *(int*)m_pch;
  m_pch += sizeof(int);
  return i;
}

int CDialogStream::GetInt8 ( )

Definition at line 4033 of file msiloc.cpp.

{
  int i = *(unsigned char*)m_pch;
  m_pch += sizeof(unsigned char);
  return i;
}

TCHAR * CDialogStream::GetStr ( )

Definition at line 4044 of file msiloc.cpp.

{
  TCHAR* sz = NULL;

  int cchwide = lstrlenW((wchar_t*)m_pch);
#ifdef UNICODE
  sz = new TCHAR[cchwide + 1];
  if ( !sz )
    return NULL;
  lstrcpyW(sz, (wchar_t*)m_pch);
#else
  // what codepage to use to translate?
  int cb = WideCharToMultiByte(CP_ACP, 0, (wchar_t*)m_pch, -1, 0, 0, 0, 0);
  sz = new TCHAR[cb+1];
  if ( !sz )
    return NULL;
  BOOL fUsedDefault;
  if (0 == WideCharToMultiByte(CP_ACP, 0, (wchar_t*)m_pch, -1, sz, cb, 0, &fUsedDefault))
  {
    delete [] sz;
    return NULL;
  }
#endif // UNICODE

  m_pch += 2*(cchwide+1);
  return sz;
}

unsigned short CDialogStream::GetUInt16 ( )

Definition at line 4015 of file msiloc.cpp.

{
  unsigned short i = *(unsigned short*)m_pch;
  m_pch += sizeof(unsigned short);
  return i;
}

BOOL CDialogStream::Move ( int cbBytes )

Definition at line 4098 of file msiloc.cpp.

{
  m_pch += cbBytes;
  return TRUE;
}

BOOL CDialogStream::Undo16 ( )

Definition at line 4090 of file msiloc.cpp.

{
  m_pch -= sizeof(unsigned short);
  return TRUE;
}

Member Data Documentation

char* CDialogStream::m_pch [private]

Definition at line 341 of file msiloc.cpp.

The documentation for this class was generated from the following file:
  • SysMgmt/Msi/msiloc/msiloc.cpp
Generated on Wed Nov 13 2024 16:56:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDimmer Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CDimmer Class Reference

#include "Dimmer.h"

List of all members.

Public Member Functions

CDimmer ()
CDimmer ()
CDimmer ()
~CDimmer ()
STDMETHOD() | GetServiceObject (BSTR bstrUDN, BSTR bstrServiceId, IDispatch **ppdispService)
STDMETHODIMP | GetServiceObject (BSTR bstrUDN, BSTR bstrServiceId, IDispatch **ppdispService)
STDMETHOD() | GetServiceObject (BSTR bstrUDN, BSTR bstrServiceId, IDispatch **ppdispService)
STDMETHOD() | Initialize (BSTR bstrXMLDesc, BSTR bstrDeviceIdentifier, BSTR bstrInitString)
STDMETHOD() | Initialize (BSTR bstrXMLDesc, BSTR bstrDeviceIdentifier, BSTR bstrInitString)
STDMETHODIMP | Initialize (BSTR bstrXMLDesc, BSTR deviceID, BSTR bstrInitString)

Private Attributes

BSTR | descriptionDoc
IDispatch * | pDisPtrs [NUM_TEMPLATE_UDNS_IN_DESCDOC][MAX_NOSERVICE_PER_DEVICE]
BSTR | serviceIDDeviceMap [NUM_TEMPLATE_UDNS_IN_DESCDOC][MAX_NOSERVICE_PER_DEVICE]
BSTR | UDNmapping [NUM_TEMPLATE_UDNS_IN_DESCDOC][2]

Detailed Description

Definition at line 11 of file Dimmer.h.

Constructor & Destructor Documentation

CDimmer::CDimmer ( ) [inline]

Definition at line 18 of file Dimmer.h.

  {
  }

CDimmer::CDimmer ( ) [inline]

Definition at line 18 of file Dimmer.h.

  {
  }

CDimmer::CDimmer ( )
CDimmer::~CDimmer ( )

Definition at line 35 of file Dimmer.cpp.

{
  INT i,j;
  for(i=0;i<NUM_TEMPLATE_UDNS_IN_DESCDOC;i++)
    for(j=0;j<MAX_NOSERVICE_PER_DEVICE;j++)
      if(pDisPtrs[i][j]!=NULL)
      {
        pDisPtrs[i][j]->Release();
        pDisPtrs[i][j]=NULL;
      }

  //free the strings allocated for the table mapping the template UDN to real UDN
  SysFreeString(UDNmapping[0][0]);

  //free the strings allocated for the table mapping devices to Service ID's
  SysFreeString(serviceIDDeviceMap[0][0]);

}

Member Function Documentation

STDMETHODIMP CDimmer::GetServiceObject | ( | BSTR | bstrUDN,
 |  | BSTR | bstrServiceId,
 |  | IDispatch ** | ppdispService |
 | ) |  |  | [inline]

Definition at line 39 of file Dimmer.h.

  {
    if (ppdispService == NULL)
      return E_POINTER;

    return E_NOTIMPL;
  }

STDMETHOD() CDimmer::GetServiceObject | ( | BSTR | bstrUDN,
 |  | BSTR | bstrServiceId,
 |  | IDispatch ** | ppdispService |
 | ) |  |  | [inline]

Definition at line 39 of file Dimmer.h.

  {
    if (ppdispService == NULL)
      return E_POINTER;

    return E_NOTIMPL;
  }

STDMETHODIMP CDimmer::GetServiceObject | ( | BSTR | bstrUDN,
 |  | BSTR | bstrServiceId,
 |  | IDispatch ** | ppdispService
 | ) |  |
STDMETHODIMP CDimmer::Initialize | ( | BSTR | bstrXMLDesc,
 |  | BSTR | bstrDeviceIdentifier,
 |  | BSTR | bstrInitString |
 | ) |  |  | [inline]

Definition at line 35 of file Dimmer.h.

  {
    return E_NOTIMPL;
  }

STDMETHODIMP CDimmer::Initialize | ( | BSTR | bstrXMLDesc,
 |  | BSTR | deviceID,
 |  | BSTR | bstrInitString
 | ) |  |
STDMETHOD() CDimmer::Initialize | ( | BSTR | bstrXMLDesc,
 |  | BSTR | bstrDeviceIdentifier,
 |  | BSTR | bstrInitString |
 | ) |  |  | [inline]

Definition at line 35 of file Dimmer.h.

  {
    return E_NOTIMPL;
  }

Member Data Documentation

BSTR CDimmer::descriptionDoc [private]

Definition at line 24 of file Dimmer.h.

IDispatch* CDimmer::pDisPtrs[NUM_TEMPLATE_UDNS_IN_DESCDOC][MAX_NOSERVICE_PER_DEVICE] [private]

Definition at line 34 of file Dimmer.h.

BSTR CDimmer::serviceIDDeviceMap[NUM_TEMPLATE_UDNS_IN_DESCDOC][MAX_NOSERVICE_PER_DEVICE] [private]

Definition at line 31 of file Dimmer.h.

BSTR CDimmer::UDNmapping[NUM_TEMPLATE_UDNS_IN_DESCDOC][2] [private]

Definition at line 27 of file Dimmer.h.

The documentation for this class was generated from the following files:
  • NetDS/upnp/StepByStep/Step2/Dimmer.h
  • NetDS/upnp/StepByStep/Step4/Dimmer.h
  • NetDS/upnp/StepByStep/Step3/Dimmer.h
  • NetDS/upnp/StepByStep/Step4/Dimmer.cpp
Generated on Wed Nov 13 2024 16:56:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDimmerService Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CDimmerService Class Reference

#include "DimmerService.h"

List of all members.

Public Member Functions

CDimmerService ()
CDimmerService ()
CDimmerService ()
~CDimmerService ()
STDMETHOD() | Advise (IUPnPEventSink *pesSubscriber)
STDMETHOD() | Advise (IUPnPEventSink *pesSubscriber)
STDMETHOD() | Advise (IUPnPEventSink *punkSubscriber)
STDMETHOD() | get_dimLevel (LONG *pdimLevel)
STDMETHOD() | get_dimLevel (LONG *dLevel)
STDMETHOD() | get_Power (VARIANT_BOOL *pval)
STDMETHOD() | get_Power (VARIANT_BOOL *pPower)
STDMETHOD() | GetConfigDetails (VARIANT_BOOL *powerVal, LONG *dLevel)
STDMETHOD() | GetConfigDetails (VARIANT_BOOL *ppowerVal, LONG *pdLevel)
STDMETHOD() | GetDimLevel (LONG *dLevel)
STDMETHOD() | GetDimLevel (LONG *pdLevel)
STDMETHOD() | GetPowerValue (VARIANT_BOOL *powerVal)
STDMETHOD() | GetPowerValue (VARIANT_BOOL *ppowerVall)
STDMETHOD() | PowerOff ()
STDMETHOD() | PowerOff ()
STDMETHOD() | PowerOn ()
STDMETHOD() | PowerOn ()
STDMETHOD() | SetDimLevel (LONG dLevel)
STDMETHOD() | SetDimLevel (LONG dLevel)
STDMETHOD() | Unadvise (IUPnPEventSink *pesSubscriber)
STDMETHOD() | Unadvise (IUPnPEventSink *punkSubscriber)
STDMETHOD() | Unadvise (IUPnPEventSink *pesSubscriber)

Private Attributes

CRITICAL_SECTION | csSync
LONG | dimnessLevel
IUPnPEventSink * | esEventingManager
VARIANT_BOOL | power

Detailed Description

Definition at line 11 of file DimmerService.h.

Constructor & Destructor Documentation

CDimmerService::CDimmerService ( ) [inline]

Definition at line 18 of file DimmerService.h.

  {
  }

CDimmerService::CDimmerService ( ) [inline]

Definition at line 20 of file DimmerService.h.

  {
  }

CDimmerService::CDimmerService ( )
CDimmerService::~CDimmerService ( )

Definition at line 19 of file DimmerService.cpp.

{
  //Cleanup before the service exits
    if (esEventingManager)
  {
        // we have to release the pointer to the Eventing Manager Interface on shutdown
        esEventingManager->Release();
        esEventingManager = NULL;
    }

  DeleteCriticalSection(&csSync);
}

Member Function Documentation

HRESULT CDimmerService::Advise ( IUPnPEventSink * pesSubscriber ) [inline]

Definition at line 35 of file DimmerService.h.

  {
    return E_NOTIMPL;
  }

STDMETHOD() CDimmerService::Advise ( IUPnPEventSink * punkSubscriber )
STDMETHOD() CDimmerService::Advise ( IUPnPEventSink * pesSubscriber ) [inline]

Definition at line 38 of file DimmerService.h.

  {
    return E_NOTIMPL;
  }

HRESULT CDimmerService::get_dimLevel ( LONG * pdimLevel ) [inline]

Definition at line 54 of file DimmerService.h.

  {
    if (pdimLevel == NULL)
      return E_POINTER;

    return E_NOTIMPL;
  }

STDMETHOD() CDimmerService::get_dimLevel ( LONG * dLevel )
HRESULT CDimmerService::get_Power ( VARIANT_BOOL * pPower ) [inline]

Definition at line 47 of file DimmerService.h.

  {
    if (pPower == NULL)
      return E_POINTER;

    return E_NOTIMPL;
  }

STDMETHOD() CDimmerService::get_Power ( VARIANT_BOOL * pval )
STDMETHOD() CDimmerService::GetConfigDetails | ( | VARIANT_BOOL * | powerVal,
 |  | LONG * | dLevel
 | ) |  |
HRESULT CDimmerService::GetConfigDetails | ( | VARIANT_BOOL * | ppowerVal,
 |  | LONG * | pdLevel |
 | ) |  |  | [inline]

Definition at line 87 of file DimmerService.h.

  {
    if (ppowerVal == NULL)
      return E_POINTER;

    if (pdLevel == NULL)
      return E_POINTER;

    return E_NOTIMPL;
  }

STDMETHOD() CDimmerService::GetDimLevel ( LONG * dLevel )
HRESULT CDimmerService::GetDimLevel ( LONG * pdLevel ) [inline]

Definition at line 80 of file DimmerService.h.

  {
    if (pdLevel == NULL)
      return E_POINTER;

    return E_NOTIMPL;
  }

STDMETHOD() CDimmerService::GetPowerValue ( VARIANT_BOOL * powerVal )
HRESULT CDimmerService::GetPowerValue ( VARIANT_BOOL * ppowerVall ) [inline]

Definition at line 69 of file DimmerService.h.

  {
    if (ppowerVall == NULL)
      return E_POINTER;

    return E_NOTIMPL;
  }

STDMETHOD() CDimmerService::PowerOff ( )
HRESULT CDimmerService::PowerOff ( ) [inline]

Definition at line 65 of file DimmerService.h.

  {
    return E_NOTIMPL;
  }

STDMETHOD() CDimmerService::PowerOn ( )
HRESULT CDimmerService::PowerOn ( ) [inline]

Definition at line 61 of file DimmerService.h.

  {
    return E_NOTIMPL;
  }

HRESULT CDimmerService::SetDimLevel ( LONG dLevel ) [inline]

Definition at line 76 of file DimmerService.h.

  {
    return E_NOTIMPL;
  }

STDMETHOD() CDimmerService::SetDimLevel ( LONG dLevel )
STDMETHOD() CDimmerService::Unadvise ( IUPnPEventSink * pesSubscriber ) [inline]

Definition at line 42 of file DimmerService.h.

  {
    return E_NOTIMPL;
  }

STDMETHOD() CDimmerService::Unadvise ( IUPnPEventSink * punkSubscriber )
HRESULT CDimmerService::Unadvise ( IUPnPEventSink * pesSubscriber ) [inline]

Definition at line 39 of file DimmerService.h.

  {
    return E_NOTIMPL;
  }

Member Data Documentation

CRITICAL_SECTION CDimmerService::csSync [private]

Definition at line 45 of file DimmerService.h.

LONG CDimmerService::dimnessLevel [private]

Definition at line 41 of file DimmerService.h.

IUPnPEventSink* CDimmerService::esEventingManager [private]

Definition at line 42 of file DimmerService.h.

VARIANT_BOOL CDimmerService::power [private]

Definition at line 40 of file DimmerService.h.

The documentation for this class was generated from the following files:
  • NetDS/upnp/StepByStep/Step2/DimmerService.h
  • NetDS/upnp/StepByStep/Step4/DimmerService.h
  • NetDS/upnp/StepByStep/Step3/DimmerService.h
  • NetDS/upnp/StepByStep/Step4/DimmerService.cpp
Generated on Wed Nov 13 2024 16:56:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDisdrawApp Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CDisdrawApp Class Reference

#include "DisDraw.h"

Inherits CWinApp, and CWinApp.

List of all members.

Public Member Functions

CDisdrawApp ()
CDisdrawApp ()
virtual BOOL | InitInstance ()
virtual BOOL | InitInstance ()

Detailed Description

Definition at line 29 of file DisDraw.h.

Constructor & Destructor Documentation

CDisdrawApp::CDisdrawApp ( )

Definition at line 44 of file DisDraw.Cpp.

{
  // TODO: add construction code here,
  // Place all significant initialization in InitInstance
}

CDisdrawApp::CDisdrawApp ( )

Member Function Documentation

BOOL CDisdrawApp::InitInstance ( void ) [virtual]

Reimplemented from CWinApp.

Definition at line 58 of file DisDraw.Cpp.

{
  // Standard initialization
  // If you are not using these features and wish to reduce the size
  //  of your final executable, you should remove from the following
  //  the specific initialization routines you do not need.

#ifdef _AFXDLL
  Enable3dControls();     // Call this when using MFC in a shared DLL
#else
  Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif

  //
  // Prompt for the user's name
  //
  char mbsUserName[MAX_USERNAME_LEN];
  DWORD dwNumBytes = MAX_USERNAME_LEN;
  GetUserName(mbsUserName, &dwNumBytes);
  CLoginDlg dlgLogin;
  dlgLogin.m_strLogin = mbsUserName;
  if (dlgLogin.DoModal() == IDCANCEL || dlgLogin.m_strLogin == "" )
  {
    return FALSE;
  }

  dlgLogin.m_strLogin.MakeUpper();

  CDisdrawDlg dlg;
  m_pMainWnd = &dlg;
  dlg.m_strLogin = dlgLogin.m_strLogin;
  int nResponse = dlg.DoModal();
  if (nResponse == IDOK)
  {
    // TODO: Place code here to handle when the dialog is
    //  dismissed with OK
  }
  else if (nResponse == IDCANCEL)
  {
    // TODO: Place code here to handle when the dialog is
    //  dismissed with Cancel
  }

  // Since the dialog has been closed, return FALSE so that we exit the
  //  application, rather than start the application's message pump.
  return FALSE;
}

virtual BOOL CDisdrawApp::InitInstance ( ) [virtual]

Reimplemented from CWinApp.

The documentation for this class was generated from the following files:
  • NetDS/MessageQueuing/c_draw/DisDraw.h
  • NetDS/MessageQueuing/mqf_draw/mqfdraw.h
  • NetDS/MessageQueuing/c_draw/DisDraw.Cpp
  • NetDS/MessageQueuing/mqf_draw/mqfdraw.cpp
Generated on Wed Nov 13 2024 16:56:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDisdrawDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Attributes

CDisdrawDlg Class Reference

#include "DrawDlg.h"

List of all members.

Public Types

enum | { IDD = IDD_DISDRAW_DIALOG }
enum | { IDD = IDD_DISDRAW_DIALOG }

Public Member Functions

CDisdrawDlg (CWnd *pParent=NULL)
CDisdrawDlg (CWnd *pParent=NULL)
void | SendKeystroke (UINT uChar)
void | SendKeystroke (UINT uChar)
void | SendMouseMovement (LINE lineNew)
void | SendMouseMovement (LINE lineNew)

Public Attributes

CButton | m_btnAddQueue
CButton | m_btnAttach
CButton | m_CancelButton
CEdit | m_cComputerInput
CStatic | m_cComputerLabel
CStatic | m_cConnectionMode
CButton | m_cContinueButton
CButton | m_cDsFrame
CButton | m_cFriendFrame
CButton | m_cMessageFrame
CButton | m_cQueueFrame
CEdit | m_cQueueInput
CStatic | m_cQueueLabel
CButton | m_cRadioDS
CButton | m_cRadioExpress
CButton | m_cRadioPrivate
CButton | m_cRadioPublic
CButton | m_cRadioRecoverable
CButton | m_cRadioWorkgroup
CDrawArea m_drawScribble
HANDLE m_hqIncoming
HANDLE m_hqOutgoing
int | m_iDelivery
unsigned int | m_iFormatNameList
int | m_iRadioDS
int | m_iType
CString m_strFriend
CString m_strLogin
CString m_strRemoteComputerName
WCHAR * | m_wcsFormatNameList

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
virtual void | DoDataExchange (CDataExchange *pDX)
void | initializeUi (BOOL fConnectedToDS)
BOOL IsDsEnabledLocaly ()
afx_msg void | OnButtonAddQueue ()
afx_msg void | OnButtonAttach ()
afx_msg void | OnButtonAttach ()
afx_msg void | OnChangeEditFriend ()
afx_msg void | OnChangeEditFriendComputer ()
afx_msg void | OnClose ()
afx_msg void | OnClose ()
afx_msg void | OnConnect ()
virtual BOOL | OnInitDialog ()
virtual BOOL | OnInitDialog ()
afx_msg void | OnPaint ()
afx_msg void | OnPaint ()
afx_msg HCURSOR | OnQueryDragIcon ()
afx_msg HCURSOR | OnQueryDragIcon ()
afx_msg void | OnRadioPrivatequeue ()
afx_msg void | OnRadioPublicqueue ()
BOOL OpenPrivateReceiveQueue ()
BOOL OpenPrivateReceiveQueue ()
BOOL OpenReceiveQueue ()
BOOL OpenReceiveQueue ()
void | startReceiveUpdateThread ()
void | startReceiveUpdateThread ()

Protected Attributes

HICON | m_hIcon

Private Attributes

BOOL m_fDsEnabledLocaly

Detailed Description

Definition at line 21 of file DrawDlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 39 of file DrawDlg.h.

{ IDD = IDD_DISDRAW_DIALOG };

anonymous enum
Enumerator:
IDD

Definition at line 47 of file drawdlg.h.

{ IDD = IDD_DISDRAW_DIALOG };

Constructor & Destructor Documentation

CDisdrawDlg::CDisdrawDlg ( CWnd * pParent = NULL )

Definition at line 40 of file DrawDlg.Cpp.

  : CDialog(CDisdrawDlg::IDD, pParent)
{
  //{{AFX_DATA_INIT(CDisdrawDlg)
  m_strFriend = _T("");
  m_iDelivery = 0;
  m_iRadioDS = 0;
  m_strRemoteComputerName = _T("");
  //}}AFX_DATA_INIT
  // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
  m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

CDisdrawDlg::CDisdrawDlg ( CWnd * pParent = NULL )

Member Function Documentation

void CDisdrawDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 53 of file DrawDlg.Cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CDisdrawDlg)
  DDX_Control(pDX, IDC_STATIC_C_LABEL, m_cComputerLabel);
  DDX_Control(pDX, IDCANCEL, m_CancelButton);
  DDX_Control(pDX, IDC_STATIC_Q_LABEL, m_cQueueLabel);
  DDX_Control(pDX, IDC_STATIC_CHOOSE_MESSAGE, m_cMessageFrame);
  DDX_Control(pDX, IDC_STATIC_CHOOSE_DS, m_cDsFrame);
  DDX_Control(pDX, IDC_RADIO_EXPRESS, m_cRadioExpress);
  DDX_Control(pDX, IDC_RADIO_DS, m_cRadioDS);
  DDX_Control(pDX, IDC_EDIT_FRIEND_COMPUTER, m_cComputerInput);
  DDX_Control(pDX, IDC_EDIT_FRIEND, m_cQueueInput);
  DDX_Control(pDX, IDC_CONTINUE, m_cContinueButton);
  DDX_Control(pDX, IDC_DRAWAREA_SCRIBLLE, m_drawScribble);
  DDX_Control(pDX, IDC_BUTTON_ATTACH, m_btnAttach);
  DDX_Text(pDX, IDC_EDIT_FRIEND, m_strFriend);
  DDV_MaxChars(pDX, m_strFriend, 50);
  DDX_Radio(pDX, IDC_RADIO_EXPRESS, m_iDelivery);
  DDX_Radio(pDX, IDC_RADIO_DS, m_iRadioDS);
  DDX_Text(pDX, IDC_EDIT_FRIEND_COMPUTER, m_strRemoteComputerName);
  DDV_MaxChars(pDX, m_strRemoteComputerName, 50);
    DDX_Control(pDX, IDC_RADIO_WORKGROUP, m_cRadioWorkgroup);
    DDX_Control(pDX, IDC_RADIO_RECOVERABLE, m_cRadioRecoverable);
  //}}AFX_DATA_MAP

}

virtual void CDisdrawDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]
void CDisdrawDlg::initializeUi ( BOOL fConnectedToDS ) [protected]

Definition at line 807 of file DrawDlg.Cpp.

{
    if(fConnectedToDS)
    {
        //
        // Show the relevant controls for a DS-enabled computer.
        //
        m_cDsFrame.ShowWindow(SW_SHOW);
        m_cRadioDS.ShowWindow(SW_SHOW);
        m_cRadioWorkgroup.ShowWindow(SW_SHOW);
        m_cContinueButton.ShowWindow(SW_SHOW);
        m_CancelButton.ShowWindow(SW_SHOW);

    }
    else
    {
        //
        //Show the relevant controls for a DS-disabled computer.
        //
        m_cMessageFrame.ShowWindow(SW_SHOW);
        m_cRadioExpress.ShowWindow(SW_SHOW);
        m_cRadioRecoverable.ShowWindow(SW_SHOW);
        m_cQueueInput.ShowWindow(SW_SHOW);
        m_cQueueLabel.ShowWindow(SW_SHOW);
        m_cComputerInput.ShowWindow(SW_SHOW);
        m_cComputerLabel.ShowWindow(SW_SHOW);
        m_CancelButton.ShowWindow(SW_SHOW);
        m_btnAttach.ShowWindow(SW_SHOW);

    }

}

BOOL CDisdrawDlg::IsDsEnabledLocaly ( ) [protected]

Definition at line 709 of file DrawDlg.Cpp.

                   :

      The routine checks whether the local computer is DS-enabled
      or DS-disabled.

Arguments:

      None

Return Value:

      TRUE     -  DS-enabled.
      FALSE    -  DS-disabled.

--*/

{

    MQPRIVATEPROPS PrivateProps;
    QMPROPID       aPropId[MAX_VAR];
    MQPROPVARIANT  aPropVar[MAX_VAR];
    DWORD          cProp;
    HRESULT        hr;
    //
    // Prepare a DS-enabled property.
    //
    cProp = 0;

    aPropId[cProp] = PROPID_PC_DS_ENABLED;
    aPropVar[cProp].vt = VT_NULL;
    ++cProp;
    //
    // Create a PRIVATEPROPS structure.
    //
    PrivateProps.cProp = cProp;
  PrivateProps.aPropID = aPropId;
  PrivateProps.aPropVar = aPropVar;
    PrivateProps.aStatus = NULL;

    //
    // Retrieve the information.
    //

    //
    // This code is used to detect a DS connection.
    // This code is designed to allow compilation on both
    // Windows NT 4.0 and Windows 2000.
    //
    HINSTANCE hMqrtLibrary = GetModuleHandle(TEXT("mqrt.dll"));
  ASSERT(hMqrtLibrary != NULL);

    typedef HRESULT (APIENTRY *MQGetPrivateComputerInformation_ROUTINE)(LPCWSTR , MQPRIVATEPROPS*);
    MQGetPrivateComputerInformation_ROUTINE pfMQGetPrivateComputerInformation =
          (MQGetPrivateComputerInformation_ROUTINE)GetProcAddress(hMqrtLibrary,
                           "MQGetPrivateComputerInformation");
    if(pfMQGetPrivateComputerInformation == NULL)
    {
        //
        // There is no entry point in the DLL that matches this routine.
        // It must be an old version of mqrt.dll -> product one.
        // It will be OK to handle this case as the case of DS-enabled computer.
        //
        return TRUE;
    }

  hr = pfMQGetPrivateComputerInformation(
             NULL,
           &PrivateProps);
  if(FAILED(hr))
  {
        //
        // We were not able to determine whether the computer is DS-enabled or DS-disabled.
        // Notify the user and assume the worst case (i.e., the computer is DS-disasbled).
        //
        MessageBox("No DS connection can be detected.");
        return FALSE;
    }

    if(PrivateProps.aPropVar[0].boolVal == 0)
    {
        //
        // DS-disabled.
        //
        return FALSE;
    }

    return TRUE;

}

void CDisdrawDlg::OnButtonAddQueue ( ) [protected]

Definition at line 696 of file drawdlg.cpp.

{
  CWaitCursor wait;
  WCHAR wcsFormatName[MAX_FORMAT_NAME_LEN];
  UpdateData(TRUE);
  if (!m_fDsEnabledLocaly)
    m_iType = 1;
  if (0 == m_iType) // public queue
  {

    m_strFriend.MakeUpper();

    if (!LocateQueue(m_strFriend, wcsFormatName, MAX_FORMAT_NAME_LEN))
      {
        AfxMessageBox("No such friend queue was found.");
        return;
    }

  }
  else
  {
    //
    // Connect to a computer in workgroup (direct) mode.
    //

    //
    // Obtain the names of the friend queue and the remote computer.
    //
    m_strFriend.MakeUpper();
    m_strRemoteComputerName.MakeUpper();

    //
    // Verify that the friend queue exists. Because we are connecting to
    // a private queue, we cannot obtain its format name through the DS,
    // and we shall asuume that it exists and shall try to open it.
    //

    //
    // Form the format name.
    //
    char mbsFormatName[MAX_FORMAT_NAME_LEN];
    int n = _snprintf(mbsFormatName, MAX_FORMAT_NAME_LEN - 1, "DIRECT=OS:%s\\private$\\%s", (LPCTSTR)m_strRemoteComputerName, (LPCTSTR)m_strFriend);
    if(n < 0)
    {
      AfxMessageBox("The format name is too long for the buffer specified. Exiting...");
      exit(1);
    }

    mbsFormatName[n] = L'\0';
    mbstowcs(wcsFormatName, mbsFormatName, MAX_FORMAT_NAME_LEN);

  }

  //
  // Make sure that there is enough space for the new format name.
  //
  if((wcslen(m_wcsFormatNameList) + wcslen(wcsFormatName) + 2) > m_iFormatNameList)
  {
    UINT iLength = m_iFormatNameList + FORMAT_NAME_LIST_LEN + 1;

    WCHAR *tempList = new WCHAR[iLength];
    if (tempList == NULL)
    {
      AfxMessageBox("There is insufficient memory. Exiting...");
      exit(1);
    }

    wcsncpy(tempList, m_wcsFormatNameList, iLength - 1);
    tempList[iLength - 1] = '\0';

    m_iFormatNameList += FORMAT_NAME_LIST_LEN + 1;
    delete []  m_wcsFormatNameList;
    m_wcsFormatNameList = tempList;
  }
  if(m_wcsFormatNameList[0] != L'\0')
    wcsncat(m_wcsFormatNameList, L",", 1);

  //
  // Add the new format name to the list.
  //
  wcsncat(m_wcsFormatNameList, wcsFormatName, wcslen(wcsFormatName) + 1);

  m_btnAttach.EnableWindow(TRUE);
  strTitle = strTitle + " " + m_strFriend;

}

void CDisdrawDlg::OnButtonAttach ( ) [protected]

Definition at line 582 of file DrawDlg.Cpp.

{

    //
    // The constructor changes the cursor to an hourglass.
    // When the object goes out of scope, the cursor changes back to normal.
    //
    CWaitCursor wait ;
    WCHAR wcsFormatName[MAX_FORMAT_NAME_LEN];

  if(m_fDsEnabledLocaly && m_iRadioDS == 0)
    {
        //
        // Connect with a remote computer in standard mode.
        //

        //
      // Obtain the name of the friend queue.
      //
      UpdateData(TRUE);
      m_strFriend.MakeUpper();
        //
        // Make sure the friend queue exists.
        //
      if (!LocateQueue(m_strFriend, wcsFormatName, MAX_FORMAT_NAME_LEN))
      {
        AfxMessageBox("No such queue exists.");
        return;
      }

    }
    else if(!m_fDsEnabledLocaly || m_iRadioDS == 1)
    {
        //
        // Connect with a remote computer in direct mode.
        //

        //
      // Obtain the name of the friend queue and the remote computer.
      //
      UpdateData(TRUE);
      m_strFriend.MakeUpper();
        m_strRemoteComputerName.MakeUpper();

        //
        // Make sure the friend queue exists. Since we are connecting to
        // a private queue, we cannot obtain its format name from the
        // directory service (DS), so we will asuume it exists and try to open it.
        //

      //
      // Open the friend queue for sending (in direct mode)
        // Please Note:
        // Opening a remote queue for sending will always
        // succeed even if the queue or computer does not exist.
        // When working in direct mode, we must use private queues.
        // We cannot know whether a given private queue on another computer exists or not,
        // so here we will just assume that it does. To make the application more robust,
        // an acknowledgement queue should be created on the local computer, and
        // a request for acknowledgement messages should be added to the messages sent.
        // Then the application can notify the user when a negative adknowledgement message
        // (NACK) is received.
        //

        //
        // Compose the format name.
        //
        char mbsFormatName[MAX_FORMAT_NAME_LEN];
        sprintf(mbsFormatName,"DIRECT=OS:%s\\private$\\%s",m_strRemoteComputerName,m_strFriend);
        mbstowcs(wcsFormatName,mbsFormatName,MAX_FORMAT_NAME_LEN);

    }

    //
  // Open the remote queue for sending.
    // The action is the same in both cases.
  //
  HANDLE hqNewFriend;
  HRESULT hr = MQOpenQueue(wcsFormatName, MQ_SEND_ACCESS, MQ_DENY_NONE , &hqNewFriend);
  if (FAILED(hr))
    AfxMessageBox("The remote queue cannot be opened.");

  else
  {
    //
    // Close the previous friend queue and update the title bar.
    //
    if (m_hqOutgoing != NULL)
        {
      MQCloseQueue(m_hqOutgoing);
        }
    m_hqOutgoing = hqNewFriend;
    CString strTitle = m_strLogin + " connected to " + m_strFriend;
    SetWindowText(strTitle);
    m_btnAttach.EnableWindow(FALSE);
  }

}

afx_msg void CDisdrawDlg::OnButtonAttach ( ) [protected]
void CDisdrawDlg::OnChangeEditFriend ( ) [protected]

Definition at line 685 of file DrawDlg.Cpp.

{

  m_btnAttach.EnableWindow(TRUE);
}

void CDisdrawDlg::OnChangeEditFriendComputer ( ) [protected]

Definition at line 1038 of file DrawDlg.Cpp.

{
    //
    // Allow specifying another remote computer.
    //
  m_btnAttach.EnableWindow(TRUE);

}

void CDisdrawDlg::OnClose ( ) [protected]

Definition at line 692 of file DrawDlg.Cpp.

{
  // TODO: Add your message handler code here and/or call default.

  //
  // Close any open queues.
  //
  if (m_hqIncoming != NULL)
    MQCloseQueue(m_hqIncoming);

  if (m_hqOutgoing != NULL)
    MQCloseQueue(m_hqOutgoing);

  CDialog::OnClose();
}

afx_msg void CDisdrawDlg::OnClose ( ) [protected]
void CDisdrawDlg::OnConnect ( ) [protected]

Definition at line 845 of file DrawDlg.Cpp.

{
    //
    // See what the user selected.
    //
    UpdateData(TRUE);
    if(m_iRadioDS == 0)
    {
        //
        // The DS is enabled locally, and the user chose to connect in standard mode.
        //

         CWaitCursor wait ;

        //
      // Open the receiving queue and receive incoming messages.
      //

        if (OpenReceiveQueue())
        {
            startReceiveUpdateThread();
        }
      else
        {
        AfxMessageBox("The receiving queue cannot be opened.");
        }

        //
        // Hide relevant controls.
        //
        m_cDsFrame.ShowWindow(SW_HIDE);
        m_cRadioDS.ShowWindow(SW_HIDE);
        m_cRadioWorkgroup.ShowWindow(SW_HIDE);
        m_cContinueButton.ShowWindow(SW_HIDE);

        //
        // Show relevant controls.
        //

        m_cMessageFrame.ShowWindow(SW_SHOW);
        m_cRadioExpress.ShowWindow(SW_SHOW);
        m_cRadioRecoverable.ShowWindow(SW_SHOW);
        m_cQueueInput.ShowWindow(SW_SHOW);
        m_cQueueLabel.ShowWindow(SW_SHOW);

        m_CancelButton.ShowWindow(SW_SHOW);
        m_btnAttach.ShowWindow(SW_SHOW);

    }
    else//m_iRadio == 1
    {
        //
        // The DS is enabled locally, and the user chose to connect in direct mode.
        //
        //
        // The constructor changes the cursor to an hourglass.
        // When the object goes out of scope, the cursor changes back to normal.
        //
        CWaitCursor wait ;

        //
      // Open the receiving private queue and receive incoming messages.
      //

        if (OpenPrivateReceiveQueue())
        {
            startReceiveUpdateThread();
        }
      else
        {
        AfxMessageBox("The receiving queue cannot be opened.");
        }

        //
        // Hide relevant controls.
        //
        m_cDsFrame.ShowWindow(SW_HIDE);
        m_cRadioDS.ShowWindow(SW_HIDE);
        m_cRadioWorkgroup.ShowWindow(SW_HIDE);
        m_cContinueButton.ShowWindow(SW_HIDE);

        //
        // Show relevant controls.
        //
        m_cMessageFrame.ShowWindow(SW_SHOW);
        m_cRadioExpress.ShowWindow(SW_SHOW);
        m_cRadioRecoverable.ShowWindow(SW_SHOW);
        m_cQueueInput.ShowWindow(SW_SHOW);
        m_cQueueLabel.ShowWindow(SW_SHOW);
        m_cComputerInput.ShowWindow(SW_SHOW);
        m_cComputerLabel.ShowWindow(SW_SHOW);
        m_CancelButton.ShowWindow(SW_SHOW);
        m_btnAttach.ShowWindow(SW_SHOW);

    }

}

BOOL CDisdrawDlg::OnInitDialog ( ) [protected, virtual]

Definition at line 365 of file DrawDlg.Cpp.

{
  CDialog::OnInitDialog();

  // Set the icon for this dialog box.  The framework does this automatically
  //  when the application's main window is not a dialog box.
  SetIcon(m_hIcon, TRUE);     // Use the large icon.
  SetIcon(m_hIcon, FALSE);    // Use the small icon.

  //
  // Display the logon name in the title bar.
  //
  SetWindowText(m_strLogin);

  //
  // No queues are open yet.
  //
  m_hqIncoming = NULL;
  m_hqOutgoing = NULL;

    //
    // Establish connection mode.
    //
    m_fDsEnabledLocaly = IsDsEnabledLocaly();

    if (!m_fDsEnabledLocaly)
    {
        //
        // The computer is DS-disabled. This is the right place to open the receiving queue
        // because it is a local private queue. This operation is not time-consuming.
        //
        //
      // Open the receiving queue and receive incoming messages.
      //

        if (OpenPrivateReceiveQueue())
        {
            startReceiveUpdateThread();
        }
      else
        {
            //
            // The receiving queue could not be opened.
            //
        MessageBox("The receiving queue cannot be opened.");
        }

    }

    initializeUi(m_fDsEnabledLocaly);

    return TRUE;  // Return TRUE unless you set the focus to a control.
}

virtual BOOL CDisdrawDlg::OnInitDialog ( ) [protected, virtual]
void CDisdrawDlg::OnPaint ( void ) [protected]

Definition at line 426 of file DrawDlg.Cpp.

{
  if (IsIconic())
  {
    CPaintDC dc(this); // Device context for painting

    SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

    // Center the icon in the client rectangle.
    int cxIcon = GetSystemMetrics(SM_CXICON);
    int cyIcon = GetSystemMetrics(SM_CYICON);
    CRect rect;
    GetClientRect(&rect);
    int x = (rect.Width() - cxIcon + 1) / 2;
    int y = (rect.Height() - cyIcon + 1) / 2;

    // Draw the icon.
    dc.DrawIcon(x, y, m_hIcon);
  }
  else
  {
    CDialog::OnPaint();
  }
}

afx_msg void CDisdrawDlg::OnPaint ( ) [protected]
HCURSOR CDisdrawDlg::OnQueryDragIcon ( ) [protected]

Definition at line 454 of file DrawDlg.Cpp.

{
  return (HCURSOR) m_hIcon;
}

afx_msg HCURSOR CDisdrawDlg::OnQueryDragIcon ( ) [protected]
void CDisdrawDlg::OnRadioPrivatequeue ( ) [protected]

Definition at line 983 of file drawdlg.cpp.

{
    m_cComputerLabel.ShowWindow(SW_SHOW);
    m_cComputerInput.ShowWindow(SW_SHOW);
}

void CDisdrawDlg::OnRadioPublicqueue ( ) [protected]

Definition at line 989 of file drawdlg.cpp.

{
    m_cComputerLabel.ShowWindow(SW_HIDE);
    m_cComputerInput.ShowWindow(SW_HIDE);
}

BOOL CDisdrawDlg::OpenPrivateReceiveQueue ( ) [protected]
BOOL CDisdrawDlg::OpenPrivateReceiveQueue ( ) [protected]

Definition at line 947 of file DrawDlg.Cpp.

{

    //
    // Compose the pathname to the receiving queue and make it private.
    //
    char mbsPathName[MQ_MAX_Q_NAME_LEN];
    DWORD dwNumChars = MQ_MAX_Q_NAME_LEN;
    GetComputerName(mbsPathName, &dwNumChars);
  strcat(mbsPathName, "\\");
    strcat(mbsPathName,"private$");
    strcat(mbsPathName, "\\");
  strcat(mbsPathName, m_strLogin);

    //
    // Prepare the properties of the receiving queue.
    //
    DWORD cProps = 0;
    QUEUEPROPID  aPropId[3];
    MQPROPVARIANT aPropVar[3];
  MQQUEUEPROPS propsQueue;

  WCHAR wcsPathName[MQ_MAX_Q_NAME_LEN];
  mbstowcs(wcsPathName, mbsPathName, MQ_MAX_Q_NAME_LEN);
  aPropId[cProps]      = PROPID_Q_PATHNAME;
  aPropVar[cProps].vt    = VT_LPWSTR;
  aPropVar[cProps].pwszVal = wcsPathName;
  cProps++;

  aPropId[cProps]      = PROPID_Q_TYPE;
  aPropVar[cProps].vt    = VT_CLSID;
  aPropVar[cProps].puuid   = &guidDrawType;
  cProps++;

  WCHAR wcsLabel[MQ_MAX_Q_LABEL_LEN];
  mbstowcs(wcsLabel, m_strLogin, MQ_MAX_Q_LABEL_LEN);
  aPropId[cProps]      = PROPID_Q_LABEL;
  aPropVar[cProps].vt    = VT_LPWSTR;
  aPropVar[cProps].pwszVal = wcsLabel;
  cProps++;

  propsQueue.cProp  = cProps;
  propsQueue.aPropID  = aPropId;
  propsQueue.aPropVar = aPropVar;
  propsQueue.aStatus  = NULL;

  //
  // Create the receiving queue.
  //
    WCHAR wcsFormatName[MAX_FORMAT_NAME_LEN];
  dwNumChars = MAX_FORMAT_NAME_LEN;
  HRESULT hr = MQCreateQueue(NULL, &propsQueue, wcsFormatName, &dwNumChars);

  if (FAILED(hr) && hr != MQ_ERROR_QUEUE_EXISTS)
    {
    return FALSE;
    }

    if( hr ==  MQ_ERROR_QUEUE_EXISTS)
    {
        //
      // If the receiving queue already exists, obtain its format name.
      //

        WCHAR wcsLoginName[MQ_MAX_Q_NAME_LEN];
        mbstowcs(wcsLoginName, m_strLogin, MQ_MAX_Q_LABEL_LEN);
        swprintf(wcsFormatName,L"DIRECT=OS:.\\private$\\%s",wcsLoginName);

    }

    //
  // Open the receiving queue (a local private queue).
  //

  hr = MQOpenQueue(wcsFormatName,
                             MQ_RECEIVE_ACCESS,
                             MQ_DENY_NONE ,
                             &m_hqIncoming);

  if (FAILED(hr))
    {
    return FALSE;
    }
    return TRUE;

}

BOOL CDisdrawDlg::OpenReceiveQueue ( ) [protected]

Definition at line 169 of file DrawDlg.Cpp.

{
    //
    // Do not create the receiving queue if it already exists in the enterprise.
    //
    HRESULT hr;
  WCHAR wcsFormatName[MAX_FORMAT_NAME_LEN];
    if (!LocateQueue(m_strLogin, wcsFormatName, MAX_FORMAT_NAME_LEN))
    {
      //
      // Form the pathname of the receiving queue.
      //
      char mbsPathName[MQ_MAX_Q_NAME_LEN];
      DWORD dwNumChars = MQ_MAX_Q_NAME_LEN;
      GetComputerName(mbsPathName, &dwNumChars);
    strcat(mbsPathName, "\\");
    strcat(mbsPathName, m_strLogin);

      //
      // Prepare the receiving queue properties.
      //
      DWORD cProps = 0;
      QUEUEPROPID  aPropId[3];
      MQPROPVARIANT aPropVar[3];
      MQQUEUEPROPS propsQueue;

    WCHAR wcsPathName[MQ_MAX_Q_NAME_LEN];
    mbstowcs(wcsPathName, mbsPathName, MQ_MAX_Q_NAME_LEN);
      aPropId[cProps]      = PROPID_Q_PATHNAME;
      aPropVar[cProps].vt    = VT_LPWSTR;
      aPropVar[cProps].pwszVal = wcsPathName;
      cProps++;

      aPropId[cProps]      = PROPID_Q_TYPE;
      aPropVar[cProps].vt    = VT_CLSID;
      aPropVar[cProps].puuid   = &guidDrawType;
      cProps++;

    WCHAR wcsLabel[MQ_MAX_Q_LABEL_LEN];
    mbstowcs(wcsLabel, m_strLogin, MQ_MAX_Q_LABEL_LEN);
      aPropId[cProps]      = PROPID_Q_LABEL;
      aPropVar[cProps].vt    = VT_LPWSTR;
      aPropVar[cProps].pwszVal = wcsLabel;
      cProps++;

      propsQueue.cProp  = cProps;
      propsQueue.aPropID  = aPropId;
      propsQueue.aPropVar = aPropVar;
      propsQueue.aStatus  = NULL;

      //
      // Create the receiving queue.
      //
      dwNumChars = MAX_FORMAT_NAME_LEN;
      hr = MQCreateQueue(NULL, &propsQueue, wcsFormatName, &dwNumChars);

      //
      // If the receiving queue already exists, obtain its format name.
      //
      if (hr == MQ_ERROR_QUEUE_EXISTS)
        hr = MQPathNameToFormatName(wcsPathName, wcsFormatName, &dwNumChars);

      if (FAILED(hr))
        return FALSE;
    }

  //
  // Open the receiving queue (it may be necessary to retry due to replication latency).
  //
    int iCount = 0;
  while ((hr = MQOpenQueue(wcsFormatName,
                             MQ_RECEIVE_ACCESS,
                             MQ_DENY_NONE ,
                             &m_hqIncoming)) == MQ_ERROR_QUEUE_NOT_FOUND)
    {

        Sleep (500);
        iCount++;
        if (iCount >=30)
        {
            //
            // A period of 15 seconds past without locating the queue.
            // We allow the user to stop attempts to open the queue.
            //
            int iRes = MessageBox("The receiving queue was not located.\nDo you want to continue searching?",
                                NULL,
                                MB_YESNO);
            if(iRes == IDYES)
            {
                //
                // Continue searching.
                //
                iCount =0;
            }
            else
            {
                //
                // Stop searching.
                //
                break;
            }
        }
    }

  if (FAILED(hr))
    return FALSE;

  return TRUE;
}

BOOL CDisdrawDlg::OpenReceiveQueue ( ) [protected]
void CDisdrawDlg::SendKeystroke ( UINT uChar )
void CDisdrawDlg::SendKeystroke ( UINT uChar )

Definition at line 460 of file DrawDlg.Cpp.

{
  //
  // Send the keystroke to the friend queue, if there is one.
  //
  if (m_hqOutgoing != NULL)
  {
    //
    // Prepare the message properties to send the message.
    //
    DWORD cProps = 0;
    MQMSGPROPS    propsMessage;
    MQPROPVARIANT aPropVar[5];
    MSGPROPID     aPropId[5];

    WCHAR wcsBody[1];
    swprintf(wcsBody, L"%c", uChar);
    aPropId[cProps]       = PROPID_M_BODY;
    aPropVar[cProps].vt     = VT_UI1 | VT_VECTOR;
    aPropVar[cProps].caub.cElems = sizeof(wcsBody);
    aPropVar[cProps].caub.pElems = (UCHAR *)wcsBody;
    cProps++;

    WCHAR wcsLabel[MQ_MAX_MSG_LABEL_LEN];
    swprintf(wcsLabel, L"Key: %c", uChar);
    aPropId[cProps]       = PROPID_M_LABEL;
    aPropVar[cProps].vt     = VT_LPWSTR;
    aPropVar[cProps].pwszVal  = wcsLabel;
    cProps++;

        UpdateData(TRUE);
    aPropId[cProps]       = PROPID_M_DELIVERY;
    aPropVar[cProps].vt     = VT_UI1;
    aPropVar[cProps].bVal   = m_iDelivery;
    cProps++;

    aPropId[cProps]       = PROPID_M_PRIORITY;
    aPropVar[cProps].vt     = VT_UI1;
    aPropVar[cProps].bVal   = 4;
    cProps++;

    aPropId[cProps]       = PROPID_M_BODY_TYPE;
    aPropVar[cProps].vt     = VT_UI4;
    aPropVar[cProps].lVal   = (long)VT_BSTR;
    cProps++;

    propsMessage.cProp    = cProps;
    propsMessage.aPropID  = aPropId;
    propsMessage.aPropVar = aPropVar;
    propsMessage.aStatus  = NULL;

    //
    // Send the message to the outgoing queue.
    //
    MQSendMessage(m_hqOutgoing, &propsMessage, NULL);
  }
}

void CDisdrawDlg::SendMouseMovement ( LINE lineNew )
void CDisdrawDlg::SendMouseMovement ( LINE lineNew )

Definition at line 520 of file DrawDlg.Cpp.

{
  //
  // Send the line to the friend queue, if there is one.
  //
  if (m_hqOutgoing != NULL)
  {
    //
    // Prepare the message properties to send the message.
    //
    DWORD cProps = 0;
    MQMSGPROPS    propsMessage;
    MQPROPVARIANT aPropVar[5];
    MSGPROPID     aPropId[5];

    WCHAR wcsBody[MAX_MSG_BODY_LEN];
    swprintf(wcsBody, L"%07ld%07ld%07ld%07ld",
         line.ptStart.x, line.ptStart.y, line.ptEnd.x, line.ptEnd.y);
    aPropId[cProps]       = PROPID_M_BODY;
    aPropVar[cProps].vt     = VT_UI1 | VT_VECTOR;
    aPropVar[cProps].caub.cElems = sizeof(wcsBody);
    aPropVar[cProps].caub.pElems = (UCHAR *)wcsBody;
    cProps++;

    WCHAR wcsLabel[MQ_MAX_MSG_LABEL_LEN];
    swprintf(wcsLabel, L"%ld,%ld To %ld,%ld",
         line.ptStart.x, line.ptStart.y, line.ptEnd.x, line.ptEnd.y);
    aPropId[cProps]       = PROPID_M_LABEL;
    aPropVar[cProps].vt     = VT_LPWSTR;
    aPropVar[cProps].pwszVal  = wcsLabel;
    cProps++;

        UpdateData(TRUE);
    aPropId[cProps]       = PROPID_M_DELIVERY;
    aPropVar[cProps].vt     = VT_UI1;
    aPropVar[cProps].bVal   = m_iDelivery;
    cProps++;

    aPropId[cProps]       = PROPID_M_PRIORITY;
    aPropVar[cProps].vt     = VT_UI1;
    aPropVar[cProps].bVal   = 3;
    cProps++;

    aPropId[cProps]       = PROPID_M_BODY_TYPE;
    aPropVar[cProps].vt     = VT_UI4;
    aPropVar[cProps].lVal   = (long)VT_BSTR;
    cProps++;

    propsMessage.cProp    = cProps;
    propsMessage.aPropID  = aPropId;
    propsMessage.aPropVar = aPropVar;
    propsMessage.aStatus  = NULL;

    //
    // Send the message to the outgoing queue.
    //
    MQSendMessage(m_hqOutgoing, &propsMessage, NULL);
  }
}

void CDisdrawDlg::startReceiveUpdateThread ( ) [protected]
void CDisdrawDlg::startReceiveUpdateThread ( ) [protected]

Definition at line 1048 of file DrawDlg.Cpp.

{
    DWORD dwThreadID=NULL;
    CreateThread(NULL,
                 0,
                 (LPTHREAD_START_ROUTINE)ReceiveUpdates,
                 this,
                 0,
                 &dwThreadID);
    if( dwThreadID == NULL)
    {
       MessageBox("The system failed to initialize receiving queue.\nNo Drawing will be received");
    }

}

Member Data Documentation

CButton CDisdrawDlg::m_btnAddQueue

Definition at line 66 of file drawdlg.h.

CButton CDisdrawDlg::m_btnAttach

Definition at line 51 of file DrawDlg.h.

CButton CDisdrawDlg::m_CancelButton

Definition at line 41 of file DrawDlg.h.

CEdit CDisdrawDlg::m_cComputerInput

Definition at line 47 of file DrawDlg.h.

CStatic CDisdrawDlg::m_cComputerLabel

Definition at line 40 of file DrawDlg.h.

CStatic CDisdrawDlg::m_cConnectionMode

Definition at line 67 of file drawdlg.h.

CButton CDisdrawDlg::m_cContinueButton

Definition at line 49 of file DrawDlg.h.

CButton CDisdrawDlg::m_cDsFrame

Definition at line 44 of file DrawDlg.h.

CButton CDisdrawDlg::m_cFriendFrame

Definition at line 48 of file drawdlg.h.

CButton CDisdrawDlg::m_cMessageFrame

Definition at line 43 of file DrawDlg.h.

CButton CDisdrawDlg::m_cQueueFrame

Definition at line 53 of file drawdlg.h.

CEdit CDisdrawDlg::m_cQueueInput

Definition at line 48 of file DrawDlg.h.

CStatic CDisdrawDlg::m_cQueueLabel

Definition at line 42 of file DrawDlg.h.

CButton CDisdrawDlg::m_cRadioDS

Definition at line 46 of file DrawDlg.h.

CButton CDisdrawDlg::m_cRadioExpress

Definition at line 45 of file DrawDlg.h.

CButton CDisdrawDlg::m_cRadioPrivate

Definition at line 65 of file drawdlg.h.

CButton CDisdrawDlg::m_cRadioPublic

Definition at line 64 of file drawdlg.h.

CButton CDisdrawDlg::m_cRadioRecoverable

Definition at line 57 of file DrawDlg.h.

CButton CDisdrawDlg::m_cRadioWorkgroup

Definition at line 56 of file DrawDlg.h.

CDrawArea CDisdrawDlg::m_drawScribble

Definition at line 50 of file DrawDlg.h.

BOOL CDisdrawDlg::m_fDsEnabledLocaly [private]

Definition at line 92 of file DrawDlg.h.

HICON CDisdrawDlg::m_hIcon [protected]

Definition at line 73 of file DrawDlg.h.

HANDLE CDisdrawDlg::m_hqIncoming

Definition at line 34 of file DrawDlg.h.

HANDLE CDisdrawDlg::m_hqOutgoing

Definition at line 35 of file DrawDlg.h.

int CDisdrawDlg::m_iDelivery

Definition at line 53 of file DrawDlg.h.

unsigned int CDisdrawDlg::m_iFormatNameList

Definition at line 42 of file drawdlg.h.

int CDisdrawDlg::m_iRadioDS

Definition at line 54 of file DrawDlg.h.

int CDisdrawDlg::m_iType

Definition at line 61 of file drawdlg.h.

CString CDisdrawDlg::m_strFriend

Definition at line 52 of file DrawDlg.h.

CString CDisdrawDlg::m_strLogin

Definition at line 33 of file DrawDlg.h.

CString CDisdrawDlg::m_strRemoteComputerName

Definition at line 55 of file DrawDlg.h.

WCHAR* CDisdrawDlg::m_wcsFormatNameList

Definition at line 40 of file drawdlg.h.

The documentation for this class was generated from the following files:
  • NetDS/MessageQueuing/c_draw/DrawDlg.h
  • NetDS/MessageQueuing/mqf_draw/drawdlg.h
  • NetDS/MessageQueuing/c_draw/DrawDlg.Cpp
  • NetDS/MessageQueuing/mqf_draw/drawdlg.cpp
Generated on Wed Nov 13 2024 16:56:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDisplayAttributeInfo Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Private Attributes

CDisplayAttributeInfo Class Reference

List of all members.

Public Member Functions

STDMETHODIMP | GetAttributeInfo (TF_DISPLAYATTRIBUTE *ptfDisplayAttr)
STDMETHODIMP | GetDescription (BSTR *pbstrDesc)
STDMETHODIMP | GetGUID (GUID *pguid)
STDMETHODIMP | QueryInterface (REFIID riid, void **ppvObj)
STDMETHODIMP | Reset ()
STDMETHODIMP | SetAttributeInfo (const TF_DISPLAYATTRIBUTE *ptfDisplayAttr)
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) AddRef(void)

Static Private Attributes

static const TF_DISPLAYATTRIBUTE | _c_DefaultDisplayAttribute

Detailed Description

Definition at line 15 of file dap.cpp.

Member Function Documentation

STDAPI CDisplayAttributeInfo::GetAttributeInfo ( TF_DISPLAYATTRIBUTE * ptfDisplayAttr )

Definition at line 124 of file dap.cpp.

{
    HKEY hKeyAttributeInfo;
    LONG lResult;
    DWORD cbData;

    if (ptfDisplayAttr == NULL)
        return E_INVALIDARG;

    lResult = E_FAIL;

    if (RegOpenKeyEx(HKEY_CURRENT_USER, c_szAttributeInfoKey, 0, KEY_READ, &hKeyAttributeInfo) == ERROR_SUCCESS)
    {
        cbData = sizeof(*ptfDisplayAttr);

        lResult = RegQueryValueEx(hKeyAttributeInfo, c_szAttributeInfoValueName,
                                  NULL, NULL,
                                  (LPBYTE)ptfDisplayAttr, &cbData);

        RegCloseKey(hKeyAttributeInfo);
    }

    if (lResult != ERROR_SUCCESS || cbData != sizeof(*ptfDisplayAttr))
    {
        // go with the defaults
        *ptfDisplayAttr = _c_DefaultDisplayAttribute;
    }

    return S_OK;
}

STDAPI CDisplayAttributeInfo::GetDescription ( BSTR * pbstrDesc )

Definition at line 101 of file dap.cpp.

{
    BSTR bstrDesc;

    if (pbstrDesc == NULL)
        return E_INVALIDARG;

    *pbstrDesc = NULL;

    if ((bstrDesc = SysAllocString(L"Mark Display Attribute")) == NULL)
        return E_OUTOFMEMORY;

    *pbstrDesc = bstrDesc;

    return S_OK;
}

STDAPI CDisplayAttributeInfo::GetGUID ( GUID * pguid )

Definition at line 85 of file dap.cpp.

{
    if (pguid == NULL)
        return E_INVALIDARG;

    *pguid = c_guidMarkDisplayAttribute;

    return S_OK;
}

STDAPI CDisplayAttributeInfo::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppvObj
 | ) |  |

Definition at line 57 of file dap.cpp.

{
    if (ppvObj == NULL)
        return E_INVALIDARG;

    *ppvObj = NULL;

    if (IsEqualIID(riid, IID_IUnknown) ||
        IsEqualIID(riid, IID_ITfDisplayAttributeInfo))
    {
        *ppvObj = (ITfDisplayAttributeInfo *)this;
    }

    if (*ppvObj)
    {
        AddRef();
        return S_OK;
    }

    return E_NOINTERFACE;
}

STDAPI CDisplayAttributeInfo::Reset ( void )

Definition at line 188 of file dap.cpp.

{
    return SetAttributeInfo(&_c_DefaultDisplayAttribute);
}

STDAPI CDisplayAttributeInfo::SetAttributeInfo ( const TF_DISPLAYATTRIBUTE * ptfDisplayAttr )

Definition at line 161 of file dap.cpp.

{
    HKEY hKeyAttributeInfo;
    LONG lResult;

    lResult = RegCreateKeyEx(HKEY_CURRENT_USER, c_szAttributeInfoKey, 0, TEXT(""),
                             REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL,
                             &hKeyAttributeInfo, NULL);

    if (lResult != ERROR_SUCCESS)
        return E_FAIL;

    lResult = RegSetValueEx(hKeyAttributeInfo, c_szAttributeInfoValueName,
                            0, REG_BINARY, (const BYTE *)ptfDisplayAttr,
                            sizeof(*ptfDisplayAttr));

    RegCloseKey(hKeyAttributeInfo);

    return (lResult == ERROR_SUCCESS) ? S_OK : E_FAIL;
}

CDisplayAttributeInfo::STDMETHODIMP_ ( ULONG ) [inline]

Definition at line 24 of file dap.cpp.

    {
        return DllRelease();
    }

CDisplayAttributeInfo::STDMETHODIMP_ ( ULONG ) [inline]

Definition at line 20 of file dap.cpp.

    {
        return DllAddRef();
    }

Member Data Documentation

const TF_DISPLAYATTRIBUTE CDisplayAttributeInfo::_c_DefaultDisplayAttribute [static, private]
Initial value:
{
    { TF_CT_COLORREF, RGB(255, 0, 0) },
    { TF_CT_NONE, 0 },
    TF_LS_SOLID,
    FALSE,
    { TF_CT_COLORREF, RGB(255, 0, 0) },
    TF_ATTR_INPUT
}

Definition at line 37 of file dap.cpp.

The documentation for this class was generated from the following file:
  • WinUI/TSFmark/dap.cpp
Generated on Wed Nov 13 2024 16:56:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDlgDest Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions

CDlgDest Class Reference

#include "dlgdest.h"

List of all members.

Public Types

enum | { IDD = IDD_DST }

Public Member Functions

CDlgDest (CWnd *pParent=NULL)
~CDlgDest (void)
void | Create (void)
virtual void | OnCancel ()
afx_msg void | OnComboBitdepth ()
afx_msg void | OnComboSamplerate ()
afx_msg void | OnComboWaveformat ()
afx_msg HBRUSH | OnCtlColor (CDC *pDC, CWnd *pWnd, UINT nCtlColor)
afx_msg void | OnEditValidbits ()
virtual BOOL | OnInitDialog ()
afx_msg void | OnLButtonDown (UINT nFlags, CPoint point)
afx_msg void | OnLButtonUp (UINT nFlags, CPoint point)
afx_msg void | OnMouseMove (UINT nFlags, CPoint point)
virtual void | OnOK ()
afx_msg void | OnPlay ()
afx_msg void | OnRemix ()
afx_msg void | OnStop ()
void | RecalcDependantVariables (void)
void | Update (void)
virtual LRESULT | WindowProc (UINT, WPARAM, LPARAM)

Public Attributes

CButton | m_butPlay
CButton | m_butStop
CStatic | m_cAveBitsPerSec
ULONG m_cbData
CStatic | m_cChannelMask
CStatic | m_cChannels
CComboBox | m_comboBitDepth
CComboBox | m_comboFormat
CComboBox | m_comboSampleRate
CStatic | m_cOutput
CButton | m_cRemix
CEdit | m_cValidBits
BOOL m_fDragging
BOOL m_fPlayable
LPWAVEHDR | m_lpwhdr
PBYTE | m_pbData
CPoint m_ptPosInCaption
CWnd * | m_pwndParent
CString m_strChannelMask
WAVEFORMATEXTENSIBLE | m_wfExt
UINT m_wValidBitsPerSample

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)

Detailed Description

Definition at line 17 of file dlgdest.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 43 of file dlgdest.h.

{ IDD = IDD_DST };

Constructor & Destructor Documentation

CDlgDest::CDlgDest ( CWnd * pParent = NULL )

Definition at line 82 of file dlgdest.cpp.

  : CDialog(CDlgDest::IDD, pParent),
    m_pwndParent(pParent),
    m_pbData(NULL),
    m_fPlayable(FALSE),
    m_fDragging(FALSE),
  m_cbData( 0 ),
    m_lpwhdr( 0 )
{
  //{{AFX_DATA_INIT(CDlgDest)
  m_wValidBitsPerSample = 0;
  m_strChannelMask = _T("0x00000000");
  //}}AFX_DATA_INIT

    m_wfExt.Format.wFormatTag = WAVE_FORMAT_PCM;
    m_wfExt.Format.cbSize = 0;
    m_wfExt.Format.wBitsPerSample = 16;
    m_wfExt.Format.nChannels = 0;
    m_wfExt.Format.nBlockAlign = 4;
    m_wfExt.Format.nSamplesPerSec = 44100;
    m_wfExt.Format.nAvgBytesPerSec = m_wfExt.Format.nBlockAlign * m_wfExt.Format.nSamplesPerSec;
    m_wfExt.Samples.wValidBitsPerSample = 16;
    m_wfExt.dwChannelMask = 0;
    m_wfExt.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
    m_wValidBitsPerSample = m_wfExt.Samples.wValidBitsPerSample;
}

CDlgDest::~CDlgDest ( void )

Definition at line 115 of file dlgdest.cpp.

{
  SafeLocalFree( m_pbData );
    SafeLocalFree( m_lpwhdr );
}

Member Function Documentation

void CDlgDest::Create ( void )

Definition at line 126 of file dlgdest.cpp.

{
    CDialog::Create(CDlgDest::IDD, m_pwndParent);
}

void CDlgDest::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 33 of file dlgdest.cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CDlgDest)
  DDX_Control(pDX, IDC_SPEAKERFLAGS, m_cChannelMask);
  DDX_Control(pDX, IDC_AVEBITS, m_cAveBitsPerSec);
  DDX_Control(pDX, IDC_REMIX, m_cRemix);
  DDX_Control(pDX, IDC_EDIT_VALIDBITS, m_cValidBits);
  DDX_Control(pDX, IDC_CHANNELS, m_cChannels);
  DDX_Control(pDX, IDC_OUTPUT, m_cOutput);
  DDX_Control(pDX, IDC_COMBO_BITDEPTH, m_comboBitDepth);
  DDX_Control(pDX, IDC_COMBO_SAMPLERATE, m_comboSampleRate);
  DDX_Control(pDX, IDC_COMBO_WAVEFORMAT, m_comboFormat);
  DDX_Control(pDX, IDC_PLAY, m_butPlay);
    DDX_Control(pDX, IDC_STOP, m_butStop);
  DDX_Text(pDX, IDC_EDIT_VALIDBITS, m_wValidBitsPerSample);
  DDV_MinMaxUInt(pDX, m_wValidBitsPerSample, 0, 65535);
  DDX_Text(pDX, IDC_SPEAKERFLAGS, m_strChannelMask);
  //}}AFX_DATA_MAP
}

void CDlgDest::OnCancel ( ) [virtual]

Definition at line 653 of file dlgdest.cpp.

{
    // do nothing
}

void CDlgDest::OnComboBitdepth ( )

Definition at line 534 of file dlgdest.cpp.

{
    m_wfExt.Format.wBitsPerSample = (USHORT)m_comboBitDepth.GetItemData(m_comboBitDepth.GetCurSel());
    m_wfExt.Samples.wValidBitsPerSample = min(m_wfExt.Samples.wValidBitsPerSample, m_wfExt.Format.wBitsPerSample);
    m_wValidBitsPerSample = m_wfExt.Samples.wValidBitsPerSample;
    RecalcDependantVariables();
    UpdateData(FALSE);      // update m_wValidBitsPerSample display
}

void CDlgDest::OnComboSamplerate ( )

Definition at line 526 of file dlgdest.cpp.

{
    m_wfExt.Format.nSamplesPerSec = ( DWORD )m_comboSampleRate.GetItemData(m_comboSampleRate.GetCurSel());
    RecalcDependantVariables();
}

void CDlgDest::OnComboWaveformat ( )

Definition at line 545 of file dlgdest.cpp.

{
    m_wfExt.Format.wFormatTag = (WORD)m_comboFormat.GetItemData(m_comboFormat.GetCurSel());
    switch(m_wfExt.Format.wFormatTag)
    {
        case WAVE_FORMAT_PCM:
            m_wfExt.Format.cbSize = 0;
            break;

        case WAVE_FORMAT_IEEE_FLOAT:
            m_wfExt.Format.cbSize = 0;
            break;

        case WAVE_FORMAT_EXTENSIBLE:
            m_wfExt.Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX);
            break;

        default:
            MessageBox("Format type not supported", "MultiChan : Warning", MB_ICONWARNING | MB_OK);
            break;
    }
}

HBRUSH CDlgDest::OnCtlColor | ( | CDC * | pDC,
 |  | CWnd * | pWnd,
 |  | UINT | nCtlColor
 | ) |  |

Definition at line 660 of file dlgdest.cpp.

{
  HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);

    if((nCtlColor == CTLCOLOR_STATIC))
    {
        if(pWnd->m_hWnd == m_cOutput.m_hWnd)
        {
            pDC->SetBkColor(GetSysColor(COLOR_ACTIVECAPTION));
            pDC->SetTextColor(GetSysColor(COLOR_CAPTIONTEXT));
            return GetSysColorBrush(COLOR_ACTIVECAPTION);
        }
    }

  return hbr;
}

void CDlgDest::OnEditValidbits ( )

Definition at line 639 of file dlgdest.cpp.

{
    UpdateData(TRUE);
    m_wfExt.Samples.wValidBitsPerSample = LOWORD(m_wValidBitsPerSample);
}

BOOL CDlgDest::OnInitDialog ( ) [virtual]

Definition at line 148 of file dlgdest.cpp.

{
  CDialog::OnInitDialog();

    int c,i;

    i = m_comboFormat.AddString("WAVE_FORMAT_PCM");
    m_comboFormat.SetItemData(i, WAVE_FORMAT_PCM);
    i = m_comboFormat.AddString("WAVE_FORMAT_EXTENSIBLE");
    m_comboFormat.SetItemData(i, WAVE_FORMAT_EXTENSIBLE);

    char sz[10];
    for(c = 0; c < ARRAY_ELEMENTS(rgnSampleRate); c++)
    {
        _snprintf(sz, 10, "%d", rgnSampleRate[c]);
        i = m_comboSampleRate.AddString(sz);
        m_comboSampleRate.SetItemData(i, rgnSampleRate[c]);
    }

    for(c = 0; c < ARRAY_ELEMENTS(rgnBitDepth); c++)
    {
        _snprintf(sz, 10, "%d", rgnBitDepth[c]);
        i = m_comboBitDepth.AddString(sz);
        m_comboBitDepth.SetItemData(i, rgnBitDepth[c]);
    }

    m_comboSampleRate.SelectString(0, "44100");
    m_comboBitDepth.SelectString(0, "16");
    m_comboFormat.SelectString(0, "WAVE_FORMAT_PCM");

  return TRUE;  // return TRUE unless you set the focus to a control
                // EXCEPTION: OCX Property Pages should return FALSE
}

void CDlgDest::OnLButtonDown | ( | UINT | nFlags,
 |  | CPoint | point
 | ) |  |

Definition at line 683 of file dlgdest.cpp.

{
  RECT    rcClient;

    m_cOutput.GetClientRect(&rcClient);
    m_cOutput.MapWindowPoints(this, &rcClient);
    m_fDragging = PtInRect(&rcClient, point);

    if(m_fDragging)
    {
        SetCapture();
        m_fDragging = TRUE;
        m_ptPosInCaption = point;
    }

    CDialog::OnLButtonDown(nFlags, point);

    SetFocus();
    SetWindowPos(&wndTop, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE);
}

void CDlgDest::OnLButtonUp | ( | UINT | nFlags,
 |  | CPoint | point
 | ) |  |

Definition at line 709 of file dlgdest.cpp.

{
  m_fDragging = FALSE;
    ReleaseCapture();

  CDialog::OnLButtonUp(nFlags, point);
}

void CDlgDest::OnMouseMove | ( | UINT | nFlags,
 |  | CPoint | point
 | ) |  |

Definition at line 722 of file dlgdest.cpp.

{
  RECT    rcClientParent;

    GetParent()->GetClientRect(&rcClientParent);
    GetParent()->MapWindowPoints(this, &rcClientParent);
    if(PtInRect(&rcClientParent, point))
    {
        if(m_fDragging)
        {
            CRect   rcWindow;
            CRect   rcParent;
            CPoint  pt(point.x - m_ptPosInCaption.x, point.y - m_ptPosInCaption.y);

            GetWindowRect(&rcWindow);
            GetParent()->GetWindowRect(&rcParent);

            rcWindow.OffsetRect(pt);
            rcWindow -= rcParent.TopLeft();

            SetWindowPos(NULL, rcWindow.left, rcWindow.top, 0,0, SWP_NOZORDER | SWP_NOSIZE);
        }
    }
    else
    {
        ReleaseCapture();
        m_fDragging = FALSE;
    }
}

void CDlgDest::OnOK ( ) [virtual]

Definition at line 648 of file dlgdest.cpp.

{
    // do nothing
}

void CDlgDest::OnPlay ( )

Definition at line 420 of file dlgdest.cpp.

{
  MMRESULT  mmRes       = MMSYSERR_NOERROR;

    //
    //  must not be in use
    //
    ASSERT( 0 == g_hwo );

    if( 0 == m_lpwhdr )
    {
        m_lpwhdr = ( LPWAVEHDR )LocalAlloc( LPTR, sizeof( WAVEHDR ) );
        if( 0 == m_lpwhdr )
        {
            MessageBox( "Insufficient memory for rendering !", "MultiChan : Error", MB_ICONEXCLAMATION | MB_OK );
            return;
        }
    }

  m_lpwhdr->dwBufferLength = m_cbData;
    m_lpwhdr->lpData = ( char * )m_pbData;

    //
    //  open wave device
    //
    mmRes = waveOutOpen(    &g_hwo,             //  handle of the output device
                            WAVE_MAPPER,          //  as appropriate
                            ( WAVEFORMATEX* )&m_wfExt,    //  describe what's next
                            ( DWORD_PTR )WavePlayFileCB,  //  the callback
                            ( DWORD_PTR )this,        //  object issuing the request
                            CALLBACK_FUNCTION       //  callback via function
                       );
  if(TrapMMError(mmRes, "waveOutOpen"))
  {
        //
        //  prepare the header
        //
    mmRes = waveOutPrepareHeader(g_hwo, m_lpwhdr, sizeof(WAVEHDR));
    if(TrapMMError(mmRes, "waveOutPrepareHeader"))
    {
            //
            //  revert playable state
            //
            WaveTogglePlayback( WAVE_TOGGLE_DESTINATION, WAVE_TOGGLE_DISABLE );

            //
            //  start singing
            //
      mmRes = waveOutWrite(g_hwo, m_lpwhdr, sizeof(WAVEHDR));
      TrapMMError(mmRes, "waveOutWrite");

        }       //  prepare header
    }           //  open
}               //  OnPlay

void CDlgDest::OnRemix ( )

Definition at line 193 of file dlgdest.cpp.

{
    CDlgSrc * pdlgSrc   = 0;
    ULONG       cMaxSamples = 0;
    UINT        nSample;
    ULONG       cbSample;

    // move over, bacon
    SafeLocalFree(m_pbData);

    //
    // update UI
    //
    Update();

    //
    // determine the max number of samples
    //
    ULONG   cSamplesSrcThisFormat = 0;
  for
  (
    POSITION  pos = g_listSources.GetHeadPosition();
    pos;
  )
    {
        pdlgSrc = g_listSources.GetNext(pos);

        cSamplesSrcThisFormat = MulDiv(
                      m_wfExt.Format.nSamplesPerSec,
                      pdlgSrc->m_cSamples,
                      pdlgSrc->m_wfx.nSamplesPerSec
                  );
        cMaxSamples = max(cMaxSamples, cSamplesSrcThisFormat);
    }

    //
  //  determine the length of the buffer required
  //
    cbSample = m_wfExt.Format.nChannels * m_wfExt.Format.wBitsPerSample / 8;
    m_cbData = cbSample * cMaxSamples;
    m_pbData = (PBYTE)LocalAlloc(LPTR, m_cbData);
    if( 0 == m_pbData)
  {
    MessageBox( "Insufficient memory to complete the task.", "MultiChan : Error", MB_OK | MB_ICONSTOP );
    return;
  }

    //
    // copy data from each src to the dst
    //

    MMRESULT        mmRes;
    HACMSTREAM      has;
    ULONG           cbConversion;
    PVOID           pvConversion;
    ACMSTREAMHEADER ash;
    ULONG           cSamplesOut;
    BOOL            fRes = FALSE;
    WAVEFORMATEX    wfxConversion;

  wfxConversion.wFormatTag    = WAVE_FORMAT_PCM;
  wfxConversion.cbSize      = 0;
  wfxConversion.nChannels     = 1;
  wfxConversion.nSamplesPerSec  = m_wfExt.Format.nSamplesPerSec;
  wfxConversion.wBitsPerSample  = m_wfExt.Format.wBitsPerSample;
  wfxConversion.nBlockAlign   = wfxConversion.wBitsPerSample / 8;
  wfxConversion.nAvgBytesPerSec = wfxConversion.nBlockAlign * wfxConversion.nSamplesPerSec;

  //
  // for each SRC (src dialog), convert it's buffer into 1 channel of the Dst format
  //
  for
  (
      pos = g_listSources.GetHeadPosition();
    pos;
  )
    {
        pdlgSrc = g_listSources.GetNext(pos);

        //
        // first, convert dlg format to dest format using ACM
        //

        // open an appropriate ACM driver
        mmRes =
            acmStreamOpen
            (
                &has,
                NULL,
                &pdlgSrc->m_wfx,
                &wfxConversion,
                NULL,   //wFilter,
                NULL,
                0,
                ACM_STREAMOPENF_NONREALTIME
            );

        if(!TrapMMError(mmRes, "acmStreamOpen"))
            break;

    //
        //  how big a buffer do we need to convert this one channel?
    //  in any case, acm overestimates the size of the buffer needed
    //  if the acm size is used when copying we will exceed the boundaries of our allocated m_pbData
    //
        mmRes =
            acmStreamSize
            (
                has,
                pdlgSrc->m_cbData,
                &cbConversion,
                ACM_STREAMSIZEF_SOURCE
            );

        if(!TrapMMError(mmRes, "acmStreamSize"))
            break;

        // alloc
        pvConversion = LocalAlloc(LPTR, cbConversion);
        if(!(fRes = (pvConversion != NULL)))
        {
            MessageBox("Not enough memory for ACM operation", "MultiChan : Error!", MB_ICONEXCLAMATION | MB_OK);
            break;
        }

        // be prepared!
    ZeroMemory(&ash, sizeof(ACMSTREAMHEADER));
    ash.cbStruct  = sizeof(ACMSTREAMHEADER);
    ash.pbSrc   = (PBYTE)pdlgSrc->m_pvData;
    ash.cbSrcLength = pdlgSrc->m_cbData;
    ash.pbDst   = (PBYTE)pvConversion;
    ash.cbDstLength = cbConversion;

        mmRes = acmStreamPrepareHeader(has, &ash, 0);
        if(!TrapMMError(mmRes, "acmStreamPrepareHeader"))
            break;

        // do it
        mmRes = acmStreamConvert(has, &ash, 0);
        if(!TrapMMError(mmRes, "acmStreamConvert"))
            break;

        // clean up
        mmRes = acmStreamUnprepareHeader(has, &ash, 0) |
                acmStreamClose(has, 0);
        if(!TrapMMError(mmRes, "acmStreamUnprepareHeader"))
            break;

        //
        // now copy the data from conversion buffer to final output buffer
        //
        cSamplesOut = ( cbConversion > m_cbData ) ?
            ( m_cbData / wfxConversion.nBlockAlign ) :
            ( cbConversion / wfxConversion.nBlockAlign );

        switch(wfxConversion.nBlockAlign)
        {
            case 1:     // 8-bit
            {
                // stagger dest
                PBYTE   pbDst = m_pbData + pdlgSrc->m_nChannel;
                PBYTE   pbSrc = (PBYTE)pvConversion;

                for(nSample = 0; nSample < cSamplesOut; nSample++)
                {
                    *pbDst = *pbSrc++;
                    pbDst += m_wfExt.Format.nChannels;
                }

                break;
            }

            case 2:     // 16-bit
            {
                // stagger dest
                PUSHORT pusDst = ((PUSHORT)m_pbData) + pdlgSrc->m_nChannel;
                PUSHORT pusSrc = (PUSHORT)pvConversion;

                for(nSample = 0; nSample < cSamplesOut; nSample++)
                {
                    *pusDst = *pusSrc++;
                    pusDst += m_wfExt.Format.nChannels;
                }

                break;
            }

            case 3:     // 24-bit
            {
                typedef struct {
                    BYTE b[3];
                } S24BITS, *PS24BITS;

                // stagger dest
                PS24BITS psDst = ((PS24BITS)m_pbData) + pdlgSrc->m_nChannel;
                PS24BITS psSrc = (PS24BITS)pvConversion;

                for(nSample = 0; nSample < cSamplesOut; nSample++)
                {
                    *psDst = *psSrc++;
                    psDst += m_wfExt.Format.nChannels;
                }

                break;
            }

            default:
                ASSERT(0);
        }

        // clean up
        SafeLocalFree( pvConversion );
  }

    if(fRes)
    {
        // make playable
        m_fPlayable = TRUE;
        m_butPlay.EnableWindow(m_fPlayable);
    }
}

void CDlgDest::OnStop ( )

Definition at line 480 of file dlgdest.cpp.

{
    MMRESULT    mmRes       = MMSYSERR_NOERROR;

    //
    //  ensure validity
    //
    ASSERT( g_hwo );
    ASSERT( !m_fPlayable );

    //
    //  stop playback
    //
    mmRes = waveOutReset( g_hwo );
    TrapMMError( mmRes, "waveOutReset" );

}   //  OnStop

void CDlgDest::RecalcDependantVariables ( void )

Definition at line 503 of file dlgdest.cpp.

{
    m_wfExt.Format.nBlockAlign    = m_wfExt.Format.wBitsPerSample * m_wfExt.Format.nChannels / 8;
    m_wfExt.Format.nAvgBytesPerSec  = m_wfExt.Format.nBlockAlign * m_wfExt.Format.nSamplesPerSec;

  // update UI
    char sz[100];
    _snprintf(sz, 100, "%d", m_wfExt.Format.nAvgBytesPerSec);
    SetDlgItemText(IDC_AVEBITS, sz);
}

void CDlgDest::Update ( void )

Definition at line 573 of file dlgdest.cpp.

{
    // update dwChannelMask
    CDlgSrc*    pdlgSrc   = 0;
    BOOL        fGotSources = (0 != g_listSources.GetCount() );

    m_cRemix.EnableWindow( fGotSources );
    m_cValidBits.EnableWindow( fGotSources );
    m_cChannels.EnableWindow( fGotSources );
    m_cOutput.EnableWindow( fGotSources );
    m_comboBitDepth.EnableWindow( fGotSources );
    m_comboSampleRate.EnableWindow( fGotSources );
    m_cAveBitsPerSec.EnableWindow( fGotSources );
    m_cChannelMask.EnableWindow( fGotSources );
    m_comboFormat.EnableWindow( fGotSources );
    m_butPlay.EnableWindow( fGotSources  && m_pbData );
    m_butStop.EnableWindow( !fGotSources  );

    //
    //  setting channel mask - if SPEAKER_NOT_SPECIFIED, don't mind
    //
    m_wfExt.dwChannelMask = 0;

  for
  (
    POSITION    pos   = g_listSources.GetHeadPosition();
    pos;
  )
  {
        //
    //  iterative step
    //
    pdlgSrc = g_listSources.GetNext(pos);

        if( !(SPEAKER_NOT_SPECIFIED & pdlgSrc->m_dwChannelMask) )
            m_wfExt.dwChannelMask |= pdlgSrc->m_dwChannelMask;
  } //  for

    m_wfExt.dwChannelMask &= 0x7fffffff;        //  correct any deviations

  //
  // set up a proper WAVEFORMATEXTENSIBLE (number of channels = the number of SRC dialogs that were created)
  //
  m_wfExt.Format.nChannels = (WORD)g_listSources.GetCount();
  if(m_wfExt.Format.nChannels > 2)
  {
    m_wfExt.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
    m_wfExt.Format.cbSize   = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX);
    m_comboFormat.SelectString(0, "WAVE_FORMAT_EXTENSIBLE");
  }

  RecalcDependantVariables();
  m_wValidBitsPerSample = m_wfExt.Samples.wValidBitsPerSample;

  // update UI
  char sz[100];
  _snprintf(sz, 100, "%d", m_wfExt.Format.nChannels);
  SetDlgItemText(IDC_CHANNELS, sz);

  m_strChannelMask.Format("0x%08x", m_wfExt.dwChannelMask);
  UpdateData(FALSE);

}

LRESULT CDlgDest::WindowProc | ( | UINT | nMessage,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [virtual]

Definition at line 763 of file dlgdest.cpp.

{
    MMRESULT    mmRes = MMSYSERR_NOERROR;

    switch( nMessage )
    {
        case    WM_START_PLAYBACK:
            {
                break;
            }
        case    WM_STOP_PLAYBACK:
            {
                //
                //  revert playable state
                //
                WaveTogglePlayback( WAVE_TOGGLE_DESTINATION, WAVE_TOGGLE_ALLOW );

                //
                //  unprepare and release
                //
                mmRes = waveOutUnprepareHeader( g_hwo, m_lpwhdr, sizeof( WAVEHDR ) );
                if( TrapMMError( mmRes, "waveOutUnprepareHeader" ) )
                {
                    mmRes = waveOutClose( g_hwo );
                    TrapMMError( mmRes, "waveOutClose" );

                    g_hwo = 0;
                }

                break;
            }
    }
    return( CWnd::WindowProc( nMessage, wParam, lParam ) );
}

Member Data Documentation

CButton CDlgDest::m_butPlay

Definition at line 53 of file dlgdest.h.

CButton CDlgDest::m_butStop

Definition at line 54 of file dlgdest.h.

CStatic CDlgDest::m_cAveBitsPerSec

Definition at line 45 of file dlgdest.h.

ULONG CDlgDest::m_cbData

Definition at line 32 of file dlgdest.h.

CStatic CDlgDest::m_cChannelMask

Definition at line 44 of file dlgdest.h.

CStatic CDlgDest::m_cChannels

Definition at line 48 of file dlgdest.h.

CComboBox CDlgDest::m_comboBitDepth

Definition at line 50 of file dlgdest.h.

CComboBox CDlgDest::m_comboFormat

Definition at line 52 of file dlgdest.h.

CComboBox CDlgDest::m_comboSampleRate

Definition at line 51 of file dlgdest.h.

CStatic CDlgDest::m_cOutput

Definition at line 49 of file dlgdest.h.

CButton CDlgDest::m_cRemix

Definition at line 46 of file dlgdest.h.

CEdit CDlgDest::m_cValidBits

Definition at line 47 of file dlgdest.h.

BOOL CDlgDest::m_fDragging

Definition at line 34 of file dlgdest.h.

BOOL CDlgDest::m_fPlayable

Definition at line 33 of file dlgdest.h.

LPWAVEHDR CDlgDest::m_lpwhdr

Definition at line 29 of file dlgdest.h.

PBYTE CDlgDest::m_pbData

Definition at line 31 of file dlgdest.h.

CPoint CDlgDest::m_ptPosInCaption

Definition at line 35 of file dlgdest.h.

CWnd* CDlgDest::m_pwndParent

Definition at line 28 of file dlgdest.h.

CString CDlgDest::m_strChannelMask

Definition at line 56 of file dlgdest.h.

WAVEFORMATEXTENSIBLE CDlgDest::m_wfExt

Definition at line 30 of file dlgdest.h.

UINT CDlgDest::m_wValidBitsPerSample

Definition at line 55 of file dlgdest.h.

The documentation for this class was generated from the following files:
  • Multimedia/Audio/multichan/dlgdest.h
  • Multimedia/Audio/multichan/dlgdest.cpp
Generated on Wed Nov 13 2024 16:56:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDlgIADs Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions

CDlgIADs Class Reference

#include "ADs.h"

List of all members.

Public Types

enum | { IDD = IDD_IADS }

Public Member Functions

CDlgIADs (LPUNKNOWN, CWnd *pParent=NULL)
~CDlgIADs ()

Public Attributes

CComboBox | m_cAttrList
CListBox | m_cValueList
IADs * | m_pADs
CString m_sADsPath
CString m_sClass
CString m_sGUID
CString m_sName
CString m_sParent
CString m_sSchema

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
afx_msg void | OnBindGuid ()
afx_msg void | OnCopy ()
afx_msg void | OnDblClkAttrValue ()
afx_msg void | OnGet ()
afx_msg void | OnGetEx ()
afx_msg void | OnGetInfo ()
afx_msg void | OnGetInfoex ()
virtual BOOL | OnInitDialog ()
afx_msg void | OnParentPath ()
afx_msg void | OnPut ()
afx_msg void | OnPutEx ()
afx_msg void | OnSchemaPath ()
afx_msg void | OnSelChangeAttrList ()
afx_msg void | OnSetInfo ()

Detailed Description

Definition at line 17 of file ADs.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 25 of file ADs.h.

{ IDD = IDD_IADS };

Constructor & Destructor Documentation

CDlgIADs::CDlgIADs | ( | LPUNKNOWN | pUnk,
 |  | CWnd * | pParent = NULL
 | ) |  |

Definition at line 33 of file ADs.cpp.

  : CDialog(CDlgIADs::IDD, pParent)
{
  //{{AFX_DATA_INIT(CDlgIADs)
  m_sADsPath = _T("");
  m_sClass = _T("");
  m_sName = _T("");
  m_sParent = _T("");
  m_sSchema = _T("");
  m_sGUID = _T("");
  //}}AFX_DATA_INIT

  ///////////////////////////////////////
  // Get the IADs pointer and save it
  /////////////////////////////////////
  HRESULT hr;
  m_pADs = NULL;
  hr = pUnk->QueryInterface( IID_IADs, (void **) &m_pADs );
  if ( !SUCCEEDED(hr) )
  {
    AfxMessageBox(_T("Fatal Error! QI for IADs failed"));
    return;
  }
  pUnk->Release();

}

CDlgIADs::~CDlgIADs ( )

Definition at line 62 of file ADs.cpp.

{
  if ( m_pADs )
  {
    m_pADs->Release();
  }
}

Member Function Documentation

void CDlgIADs::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 70 of file ADs.cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CDlgIADs)
  DDX_Control(pDX, IDC_ATTRVALUE, m_cValueList);
  DDX_Control(pDX, IDC_ATTRLIST, m_cAttrList);
  DDX_Text(pDX, IDC_ADSPATH, m_sADsPath);
  DDX_Text(pDX, IDC_CLASS, m_sClass);
  DDX_Text(pDX, IDC_NAME, m_sName);
  DDX_Text(pDX, IDC_PARENT, m_sParent);
  DDX_Text(pDX, IDC_SCHEMA, m_sSchema);
  DDX_Text(pDX, IDC_GUID, m_sGUID);
  //}}AFX_DATA_MAP
}

void CDlgIADs::OnBindGuid ( ) [protected]

Definition at line 555 of file ADs.cpp.

{
  CWaitCursor wait;
  CComBSTR bstrPath;
  IUnknown *pUnk = NULL;
  HRESULT hr;
  UpdateData(TRUE); // Retrieve from UI

  CComPtr<IADsPathname> pPathname=NULL;
  BSTR bstr;
  BSTR bstrProvider;
  BSTR bstrServer;

  hr = CoCreateInstance( CLSID_Pathname, NULL, CLSCTX_INPROC_SERVER, IID_IADsPathname, (void**) &pPathname );

  RETURN_ON_FAILURE(hr);

  hr = m_pADs->get_ADsPath(&bstr);

  RETURN_ON_FAILURE(hr);

  /////////////////////////////////////////////////
  // Usage: PathName to find out the provider
  ///////////////////////////////////////////////////
  hr = pPathname->Set( bstr, ADS_SETTYPE_FULL );
  SysFreeString( bstr );
  RETURN_ON_FAILURE(hr);

  hr = pPathname->Retrieve(ADS_FORMAT_PROVIDER, &bstrProvider );
  RETURN_ON_FAILURE(hr);

  if ( wcscmp( bstrProvider, L"LDAP") != 0 )
  {
    AfxMessageBox(_T("Only LDAP: (Active Directory Provider) knows about <GUID=xxxx> syntax"));
    SysFreeString( bstrProvider );
    return;
  }

  /////////////////////////////////////////////////
  // Usage: PathName to find out the server
  ///////////////////////////////////////////////////
  hr = pPathname->Retrieve(ADS_FORMAT_SERVER, &bstrServer );

  if ( hr == E_ADS_BAD_PATHNAME ) // Serverless binding ( can work only from DS aware client )
  {
    bstrServer = SysAllocString(L"");
  }

  ///////////////////////////////////////////////
  // Now build the LDAP://server/<GUID=xxx
  //////////////////////////////////////////////

  bstrPath = bstrProvider;
  bstrPath.Append(_T("://"));
  if ( wcslen( bstrServer ) ) // Server based binding ?
  {
     bstrPath.AppendBSTR( bstrServer );
   bstrPath.Append(_T("/"));
   SysFreeString( bstrServer );
  }
  bstrPath.Append(_T("<GUID="));
  bstrPath.Append( m_sGUID );
  bstrPath.Append(_T(">") );

  // we don't need these bstrs anymore
  SysFreeString( bstrProvider );

  // Now Bind using GUID

  hr = App->ADsOpenObject( bstrPath, IID_IUnknown, (void**) &pUnk );

  /////////////////////////////////////
  // Bring up the IADs Dialog
  ///////////////////////////////////////
  if ( SUCCEEDED(hr) )
  {
    pUnk->AddRef();
    CDlgIADs dlg( pUnk, this );
    dlg.DoModal();
    pUnk->Release();
  }
  else
  {
    AfxMessageBox( GetErrorMessage(hr) );
    return;
  }

}

void CDlgIADs::OnCopy ( ) [protected]

Definition at line 730 of file ADs.cpp.

{
  CString s;
  HANDLE hMem;
  int idx;

  idx = m_cValueList.GetCurSel();

  if ( idx == LB_ERR )
  {
    return;
  }

  m_cValueList.GetText( idx, s );

  if ( !OpenClipboard() )
  {
    return;
  }
  EmptyClipboard();

  hMem = GlobalAlloc( GMEM_DDESHARE, sizeof(TCHAR) * (s.GetLength() + 1) );
  if ( hMem )
  {
    LPTSTR pMem;
    pMem = (LPTSTR) GlobalLock( hMem );
    lstrcpyn( pMem, s, s.GetLength()+1);
    GlobalUnlock(hMem);
    SetClipboardData( CF_TEXT, hMem );
  }

  CloseClipboard();

}

void CDlgIADs::OnDblClkAttrValue ( ) [protected]

Definition at line 662 of file ADs.cpp.

{
  int idx;
  HRESULT hr;

  idx = m_cValueList.GetCurSel();
  if ( idx == LB_ERR )
  {
    return;
  }

  // If someone click this it may be an interface that has the UI.
  // The interface value start with --> in the UI
  CString s;
  int xx;
  CString sArrow = ARROW_SYMBOL;
  m_cValueList.GetText( idx, s );

  if ( s.Find(sArrow,0 ) == 0 )
  {
    s = s.Mid( sArrow.GetLength() );

    // Find the appropriate dialog box
    xx=0;
    while( !IsEqualIID( *adsiIfs[xx].pIID, IID_NULL ) && s != adsiIfs[xx].szIf  )
    {
       xx++;
    }

      if ( adsiIfs[xx].pFn )
    {

      CString sAttr;
      VARIANT var;

      // We need to get the value again
      USES_CONVERSION;
      m_cAttrList.GetLBText( m_cAttrList.GetCurSel(), sAttr );
      hr = m_pADs->Get( T2OLE(sAttr), &var);
      if ( SUCCEEDED(hr) )
      {
          IUnknown *pUnk;
        hr = V_DISPATCH(&var)->QueryInterface( IID_IUnknown, (void**) &pUnk );
        if ( SUCCEEDED(hr) )
        {
              (*adsiIfs[xx].pFn)( pUnk, NULL );
        }
      }
    }
      else
    {
         AfxMessageBox(_T("No UI implemented yet"));
    }

    return;

  }

}

void CDlgIADs::OnGet ( ) [protected]

Definition at line 218 of file ADs.cpp.

{
   CString sAttr;
   CStringList sList;
   VARIANT var;
   HRESULT hr;
   m_cAttrList.GetLBText( m_cAttrList.GetCurSel(), sAttr );

   if ( sAttr == STRING_SEPARATOR )
   {
     MessageBeep(0);
     return;
   }

   m_cValueList.ResetContent();

   USES_CONVERSION;
   /////////////////////////////
   // Get the attribute
   ////////////////////////////////
   hr = m_pADs->Get( T2OLE(sAttr), &var);

   ////////////////////////////////
   // UI: populate the listbox
   ////////////////////////////////
   if ( SUCCEEDED(hr) )
   {

    hr = VariantToStringList(  var, sList );

    if ( SUCCEEDED(hr) )
    {
      PopulateListBoxFromStringList( m_cValueList, sList );
    }

    VariantClear(&var);
   }
   else
   {
     CString s;
     s = GetErrorMessage( hr );
     m_cValueList.AddString( s );
   }

}

void CDlgIADs::OnGetEx ( ) [protected]

Definition at line 274 of file ADs.cpp.

{

   CString sAttr;
   CStringList sList;
   VARIANT var;
   HRESULT hr;
   m_cAttrList.GetLBText( m_cAttrList.GetCurSel(), sAttr );
   m_cValueList.ResetContent();

   USES_CONVERSION;
   /////////////////////////////
   // GetEx the attribute
   ////////////////////////////////
   hr = m_pADs->GetEx( T2OLE(sAttr), &var);

   ////////////////////////////////
   // UI: populate the listbox
   ////////////////////////////////
   if ( SUCCEEDED(hr) )
   {

    hr = VariantToStringList(  var, sList );

    if ( SUCCEEDED(hr) )
    {
      PopulateListBoxFromStringList( m_cValueList, sList );
    }

    VariantClear(&var);
   }

}

void CDlgIADs::OnGetInfo ( ) [protected]

Definition at line 316 of file ADs.cpp.

{
  HRESULT hr;
  ASSERT(m_pADs);

  hr = m_pADs->GetInfo();
  if (!SUCCEEDED(hr) )
  {
    AfxMessageBox(GetErrorMessage(hr));
    return;
  }
  else
  {
    AfxMessageBox(_T("Succeed"));
  }
}

void CDlgIADs::OnGetInfoex ( ) [protected]

Definition at line 361 of file ADs.cpp.

{
  CGetInfoExDlg dlg;
  VARIANT var;
  HRESULT hr;

  if ( dlg.DoModal() == IDOK )
  {
    CString s;
    CString sAttr;
    CStringList sList;
    int idx;

    s = dlg.GetAttribute();
    //////////////////////////////////////////
    // Parse and put them in the string list
    //////////////////////////////////////////
    idx = s.Find(_T(","));
    while( idx != -1 )
    {
       sAttr = s.Mid(0, idx );
       sAttr.TrimLeft(); sAttr.TrimRight();
       sList.AddTail( sAttr );
       s = s.Mid( idx + 1 );
       idx = s.Find(_T(","));
    }
    s.TrimLeft(); s.TrimRight();
    sList.AddTail( s );

    /////////////////////////////////
    // Convert stringlist to variant
    ////////////////////////////////
    hr = StringListToVariant( var, sList);
    if ( SUCCEEDED(hr) )
    {
      ///////////////////////////////
      // Now do the real work!!
      ///////////////////////////////
      hr = m_pADs->GetInfoEx( var, 0 );
      if (!SUCCEEDED(hr) )
      {
        AfxMessageBox(GetErrorMessage(hr));
      }
      VariantClear(&var);
    }

  }

}

BOOL CDlgIADs::OnInitDialog ( ) [protected, virtual]

Definition at line 109 of file ADs.cpp.

{
  HRESULT hr;
  VARIANT var;
  BSTR    bstr;
  CStringList sList;

  CDialog::OnInitDialog();

  ASSERT( m_pADs );
  VariantInit(&var);
  //////////////////////////
  // Get the IADs Properties
  /////////////////////////

  // Path
  hr = m_pADs->get_ADsPath( &bstr );
  if ( SUCCEEDED(hr) )
  {
     m_sADsPath = bstr;
     SysFreeString(bstr);
  }

  // Name
  hr = m_pADs->get_Name( &bstr );
  if ( SUCCEEDED(hr) )
  {
     m_sName = bstr;
     SysFreeString(bstr);
  }

  // Parent
  hr = m_pADs->get_Parent( &bstr );
  if ( SUCCEEDED(hr) )
  {
     m_sParent = bstr;
     SysFreeString(bstr);
  }

  // Schema
  hr = m_pADs->get_Schema( &bstr );
  if ( SUCCEEDED(hr) )
  {
     m_sSchema = bstr;
     SysFreeString(bstr);
  }

    // Class
  hr = m_pADs->get_Class( &bstr );
  if ( SUCCEEDED(hr) )
  {
     m_sClass = bstr;
     SysFreeString(bstr);
  }

  // GUID
  hr = m_pADs->get_GUID( &bstr );
  if ( SUCCEEDED(hr) )
  {
     m_sGUID = bstr;
     SysFreeString(bstr);
  }

  if ( m_sGUID.GetLength() == 0 )
  {
    GetDlgItem(IDC_BINDGUID)->EnableWindow( FALSE );
  }

  ///////////////////////////////////////////////////////////////
  //
  // Enumerate all attributes in this object
  // Steps:
  //  1. Get the object's schema information
  //  2. Bind to that schema
  //  3. QI for Class
  //  4. Enumerate the Mandatory and Optional Attributes
  //
  /////////////////////////////////////////////////////////////
  USES_CONVERSION;
  IADsClass *pClass;
  hr = App->ADsOpenObject(T2OLE(m_sSchema), IID_IADsClass, (void**) &pClass );
  if ( SUCCEEDED(hr) )
  {
      m_cAttrList.ResetContent(); // Clear the list box content.

     // Mandatory
     pClass->get_MandatoryProperties( &var );
     VariantToStringList(  var, sList );
     PopulateComboBoxFromStringList( m_cAttrList, sList );
     VariantClear(&var);

     //  A separator to seperate mandatory and optional attributes
     m_cAttrList.AddString( STRING_SEPARATOR);

     // Optional
     pClass->get_OptionalProperties( &var );
     VariantToStringList(  var, sList );
     PopulateComboBoxFromStringList( m_cAttrList, sList );
     VariantClear(&var);
  }

  UpdateData(FALSE);

  return TRUE;  // return TRUE unless you set the focus to a control
                // EXCEPTION: OCX Property Pages should return FALSE
}

void CDlgIADs::OnParentPath ( ) [protected]

Definition at line 477 of file ADs.cpp.

{
    HRESULT hr;
    UpdateData(TRUE); // Retrieve from UI

      USES_CONVERSION;
    IUnknown *pUnk;
    CWaitCursor wait;

    hr = App->ADsOpenObject( T2OLE( m_sParent ), IID_IUnknown, (void**) &pUnk );

    /////////////////////////////////////
    // Bring up the IADsContainer Dialog
    ///////////////////////////////////////
    if ( SUCCEEDED(hr) )
    {
      pUnk->AddRef();
      CDlgIADsContainer dlg( pUnk, this );
      dlg.DoModal();

      pUnk->Release();
    }
    else
    {
      AfxMessageBox( GetErrorMessage(hr) );
    }

}

void CDlgIADs::OnPut ( ) [protected]

Definition at line 414 of file ADs.cpp.

{
  // TODO: Add your control notification handler code here

}

void CDlgIADs::OnPutEx ( ) [protected]

Definition at line 420 of file ADs.cpp.

{
  // TODO: Add your control notification handler code here

}

void CDlgIADs::OnSchemaPath ( ) [protected]

Definition at line 509 of file ADs.cpp.

{
    HRESULT hr;
    UpdateData(TRUE); // Retrieve from UI

      USES_CONVERSION;
    IUnknown *pUnk;
    IADs     *pADs;
    BSTR      bstr;
    CWaitCursor wait;

    hr = App->ADsOpenObject( T2OLE( m_sSchema ), IID_IADs, (void**) &pADs );
    RETURN_ON_FAILURE(hr);

    hr = pADs->get_Parent( &bstr );
    pADs->Release();

    RETURN_ON_FAILURE(hr);

    hr = App->ADsOpenObject( bstr, IID_IUnknown, (void**) &pUnk );
    SysFreeString( bstr );

    /////////////////////////////////////
    // Bring up the IADsContainer Dialog
    ///////////////////////////////////////
    if ( SUCCEEDED(hr) )
    {
      pUnk->AddRef();
      CDlgIADsContainer dlg( pUnk, this );
      dlg.DoModal();

      pUnk->Release();
    }

}

void CDlgIADs::OnSelChangeAttrList ( ) [protected]

Definition at line 657 of file ADs.cpp.

{
  OnGet();
}

void CDlgIADs::OnSetInfo ( ) [protected]

Definition at line 337 of file ADs.cpp.

{
  HRESULT hr;
  ASSERT(m_pADs);

  hr = m_pADs->GetInfo();
  if (!SUCCEEDED(hr) )
  {
    AfxMessageBox(GetErrorMessage(hr));
    return;
  }
  else
  {
    AfxMessageBox(_T("Succeed"));
  }

}

Member Data Documentation

CComboBox CDlgIADs::m_cAttrList

Definition at line 27 of file ADs.h.

CListBox CDlgIADs::m_cValueList

Definition at line 26 of file ADs.h.

IADs* CDlgIADs::m_pADs

Definition at line 33 of file ADs.h.

CString CDlgIADs::m_sADsPath

Definition at line 28 of file ADs.h.

CString CDlgIADs::m_sClass

Definition at line 29 of file ADs.h.

CString CDlgIADs::m_sGUID

Definition at line 34 of file ADs.h.

CString CDlgIADs::m_sName

Definition at line 30 of file ADs.h.

CString CDlgIADs::m_sParent

Definition at line 31 of file ADs.h.

CString CDlgIADs::m_sSchema

Definition at line 32 of file ADs.h.

The documentation for this class was generated from the following files:
  • NetDS/ADSI/samples/General/ADQI/ADs.h
  • NetDS/ADSI/samples/General/ADQI/ADs.cpp
Generated on Wed Nov 13 2024 16:56:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDlgIADsContainer Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions

CDlgIADsContainer Class Reference

#include "adscontainer.h"

List of all members.

Public Types

enum | { IDD = IDD_IADSCONTAINER }

Public Member Functions

CDlgIADsContainer (LPUNKNOWN pUnk, CWnd *pParent=NULL)
~CDlgIADsContainer ()

Public Attributes

CListBox | m_cChildList
CString m_sFilter

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
HRESULT | EnumerateChildren ()
afx_msg void | OnDblClkChildrenList ()
afx_msg void | OnDelete ()
virtual BOOL | OnInitDialog ()
afx_msg void | OnMove ()
virtual void | OnOK ()
afx_msg void | OnRename ()
afx_msg void | OnSet ()
afx_msg void | OnView ()

Protected Attributes

IADsContainer * | m_pCont
CStringList | m_sClassList

Private Member Functions

BOOL | GetClassAndName (CString &sClass, CString &sName)

Detailed Description

Definition at line 18 of file adscontainer.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 27 of file adscontainer.h.

{ IDD = IDD_IADSCONTAINER };

Constructor & Destructor Documentation

CDlgIADsContainer::CDlgIADsContainer | ( | LPUNKNOWN | pUnk,
 |  | CWnd * | pParent = NULL
 | ) |  |

Definition at line 34 of file adscontainer.cpp.

  : CDialog(CDlgIADsContainer::IDD, pParent)
{
  //{{AFX_DATA_INIT(CDlgIADsContainer)
  m_sFilter = _T("");
  //}}AFX_DATA_INIT

  ///////////////////////////////////////
  // Get the IADsContainer pointer and save it as a member
  /////////////////////////////////////
  HRESULT hr;
  m_pCont = NULL;
  hr = pUnk->QueryInterface( IID_IADsContainer, (void **) &m_pCont );
  if ( !SUCCEEDED(hr) )
  {
    AfxMessageBox(_T("Fatal Error! QI for IADs failed"));
    return;
  }
  pUnk->Release();

}

CDlgIADsContainer::~CDlgIADsContainer ( )

Definition at line 56 of file adscontainer.cpp.

{

  if ( m_pCont )
  {
     m_pCont->Release();
  }
}

Member Function Documentation

void CDlgIADsContainer::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 66 of file adscontainer.cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CDlgIADsContainer)
  DDX_Control(pDX, IDC_CHILDRENLIST, m_cChildList);
  DDX_Text(pDX, IDC_FILTER, m_sFilter);
  //}}AFX_DATA_MAP
}

HRESULT CDlgIADsContainer::EnumerateChildren ( ) [protected]

Definition at line 216 of file adscontainer.cpp.

{
  HRESULT hr=S_OK;
  VARIANT var;
  ULONG   lFetch;

  m_cChildList.ResetContent();
  m_sClassList.RemoveAll();

  //////////////////////////////////////////////////////
  // Use the ADSI Helper APIs to enumerate Children
  ////////////////////////////////////////////////////
  IEnumVARIANT *pEnum;
  IDispatch  *pDisp;
  IADs     *pADs;
  BSTR        bstr;
  CString       s;

  VariantInit(&var);
  hr = ADsBuildEnumerator( m_pCont, &pEnum );
  if ( !SUCCEEDED(hr) )
  {
    return S_FALSE;
  }

  hr = ADsEnumerateNext( pEnum, 1, &var, &lFetch );
  while( hr == S_OK )
  {
    if ( lFetch == 1 )
    {
        pDisp = V_DISPATCH(&var);
      ///////////////////////////
      // Get the Child Name
      /////////////////////////////
      hr = pDisp->QueryInterface( IID_IADs, (void**)&pADs );
      if ( SUCCEEDED(hr) )
      {
        pADs->get_Name(&bstr);
        s = bstr;
        m_cChildList.AddString( s );
        SysFreeString(bstr);

        ///////////////////////////////////////////////
        // While we're holding the child's object
        // let's get the class info for later use.
        // The class info will be used for getting the actual object
        // via IADsContainer::GetObject) when the user wants to view
        // object in detail.
        // We could have stored the ADsPath as well.
        //////////////////////////////////////////////
        pADs->get_Class(&bstr);
        s = bstr;
        m_sClassList.AddTail( s );
        SysFreeString(bstr);

        pADs->Release();
      }

      VariantClear(&var);
    }
    hr = ADsEnumerateNext( pEnum, 1, &var, &lFetch );
    };

  // Free Enumerator
  ADsFreeEnumerator( pEnum );

  return S_OK;

}

BOOL CDlgIADsContainer::GetClassAndName | ( | CString & | sClass,
 |  | CString & | sName |
 | ) |  |  | [private]

Definition at line 182 of file adscontainer.cpp.

{
  int idx;
  POSITION pos;

  idx = m_cChildList.GetCurSel();
  if ( idx == LB_ERR )
  {
    return FALSE;
  }

  m_cChildList.GetText( idx, sName );
  pos = m_sClassList.FindIndex( idx );
  if ( pos == NULL )
  {
    return FALSE;
  }

  sClass = m_sClassList.GetAt(pos);
    return TRUE;

}

void CDlgIADsContainer::OnDblClkChildrenList ( ) [protected]

Definition at line 144 of file adscontainer.cpp.

{
  OnView();
}

void CDlgIADsContainer::OnDelete ( ) [protected]

Definition at line 152 of file adscontainer.cpp.

{
  CString sName;
  CString sClass;
  HRESULT hr;

  if ( !GetClassAndName( sClass, sName) )
  {
    return;
  }

  ///////////////////////
  // Delete Now
  ////////////////////////
  USES_CONVERSION;
  ///////////////////////////////////////////////////////////////
  // For example m_pCont->Delete(L"user", L"cn=jsmith");
  ////////////////////////////////////////////////////////////////
  hr = m_pCont->Delete( T2OLE( sClass ), T2OLE( sName ) );
  if (!SUCCEEDED(hr) )
  {
    AfxMessageBox( GetErrorMessage(hr));
      return;
  }
  EnumerateChildren();
}

BOOL CDlgIADsContainer::OnInitDialog ( ) [protected, virtual]

Definition at line 90 of file adscontainer.cpp.

{

  CDialog::OnInitDialog();
  EnumerateChildren();
  return TRUE;  // return TRUE unless you set the focus to a control
                // EXCEPTION: OCX Property Pages should return FALSE
}

void CDlgIADsContainer::OnMove ( ) [protected]

Definition at line 375 of file adscontainer.cpp.

{
  CMoveDlg dlg;
  if ( dlg.DoModal() == IDOK )
  {
    CString sADsPath;
    IDispatch *pDisp;
    USES_CONVERSION;
    HRESULT hr;

    sADsPath = dlg.GetObjectPath();
    hr = m_pCont->MoveHere( T2OLE(sADsPath), NULL, &pDisp );
    pDisp->Release();
    RETURN_ON_FAILURE(hr);

    EnumerateChildren(); // Refresh the list

  }

}

void CDlgIADsContainer::OnOK ( ) [protected, virtual]

Definition at line 396 of file adscontainer.cpp.

{
  m_sClassList.RemoveAll();
  CDialog::OnOK();
}

void CDlgIADsContainer::OnRename ( ) [protected]

Definition at line 299 of file adscontainer.cpp.

{
   CString sName;
   CString sNewName;
   CString sClass;

   if ( !GetClassAndName( sClass,  sName) )
   {
     return;
   }

   CRenameDlg dlg( sName );

   if ( dlg.DoModal() == IDOK )
   {
    //////////////////////////////////////////////////////////////////
    // To Rename we need:
    //  1. A new name ( we'll get it from the rename dialog box )
    //  2. ADsPath of the object to be renamed
    //  3. The container where the child lives.
    /////////////////////////////////////////////////////////////////

    sNewName = dlg.GetName();

    //////////////////////////////////////////////////
    // Get the child's ADsPath,
    // First we can use IADsContainer::GetObject
    /////////////////////////////////////////////////////
    USES_CONVERSION;
    IDispatch *pDisp;
    IADs    *pADs;
    BSTR    bstrPath;
    CString sADsPath;
    HRESULT   hr;

    hr = m_pCont->GetObject(T2OLE(sClass), T2OLE(sName), &pDisp );
    if ( !SUCCEEDED(hr) )
    {
      return;
    }

    hr = pDisp->QueryInterface( IID_IADs, (void**) &pADs );
    pDisp->Release();

    ////////////////////////////////
    // Now get the child's ADsPath
    //////////////////////////////////
    if ( !SUCCEEDED(hr) )
    {
      return;
    }

    pADs->get_ADsPath( &bstrPath );
    pADs->Release();

    ////////////////////////////////////////////////////
    // We have all the information, time to rename  //
    ////////////////////////////////////////////////////
    hr = m_pCont->MoveHere( bstrPath, T2OLE(sNewName), &pDisp );
    SysFreeString( bstrPath );

    if ( !SUCCEEDED(hr) )
    {
      AfxMessageBox(GetErrorMessage(hr));
      return;
    }
    pDisp->Release();

    // Refresh the list
    EnumerateChildren();

   }

}

void CDlgIADsContainer::OnSet ( ) [protected]

Definition at line 405 of file adscontainer.cpp.

{
  CStringList sList;
  VARIANT var;
  HRESULT hr;

  UpdateData(TRUE);
  VariantInit(&var);

  // The user may enter many classes to filter 'user,group'
  StringToStringList( m_sFilter, sList );
  StringListToVariant(var, sList );

  hr = m_pCont->put_Filter( var );

  VariantClear(&var);

  if ( !SUCCEEDED(hr) )
  {
    AfxMessageBox(GetErrorMessage(hr));
      return;
  }

  EnumerateChildren();

}

void CDlgIADsContainer::OnView ( ) [protected]

Definition at line 104 of file adscontainer.cpp.

{
  ASSERT( m_pCont );

  CString sName;
  CString sClass;
  HRESULT hr;

  if ( !GetClassAndName( sClass, sName) )
  {
    return;
  }

  USES_CONVERSION;
  IDispatch *pDisp;
  IUnknown  *pUnk;
  hr = m_pCont->GetObject(T2OLE(sClass), T2OLE(sName), &pDisp );
  if ( !SUCCEEDED(hr) )
  {
    return;
  }

  pDisp->QueryInterface( IID_IUnknown, (void**) &pUnk );
  pDisp->Release();

  /////////////////////////////////
  // Bring up the dialog box
  ////////////////////////////////////
  pUnk->AddRef();
  CDlgIADs dlg( pUnk );
  dlg.DoModal();
  pUnk->Release();

}

Member Data Documentation

CListBox CDlgIADsContainer::m_cChildList

Definition at line 28 of file adscontainer.h.

IADsContainer* CDlgIADsContainer::m_pCont [protected]

Definition at line 43 of file adscontainer.h.

CStringList CDlgIADsContainer::m_sClassList [protected]

Definition at line 44 of file adscontainer.h.

CString CDlgIADsContainer::m_sFilter

Definition at line 29 of file adscontainer.h.

The documentation for this class was generated from the following files:
  • NetDS/ADSI/samples/General/ADQI/adscontainer.h
  • NetDS/ADSI/samples/General/ADQI/adscontainer.cpp
Generated on Wed Nov 13 2024 16:56:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDlgIADsLargeInteger Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes

CDlgIADsLargeInteger Class Reference

#include "ADsLargeInteger.h"

List of all members.

Public Types

enum | { IDD = IDD_LARGEINTEGER }

Public Member Functions

CDlgIADsLargeInteger (LPUNKNOWN, CWnd *pParent=NULL)
~CDlgIADsLargeInteger ()

Public Attributes

long | m_lHiPart
long | m_lLowPart

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
virtual BOOL | OnInitDialog ()
virtual void | OnOK ()

Protected Attributes

IADsLargeInteger * | m_pLargeInt

Detailed Description

Definition at line 13 of file ADsLargeInteger.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 22 of file ADsLargeInteger.h.

{ IDD = IDD_LARGEINTEGER };

Constructor & Destructor Documentation

CDlgIADsLargeInteger::CDlgIADsLargeInteger | ( | LPUNKNOWN | pUnk,
 |  | CWnd * | pParent = NULL
 | ) |  |

Definition at line 18 of file ADsLargeInteger.cpp.

  : CDialog(CDlgIADsLargeInteger::IDD, pParent)
{
  //{{AFX_DATA_INIT(CDlgIADsLargeInteger)
  m_lHiPart = 0;
  m_lLowPart = 0;
  //}}AFX_DATA_INIT

  HRESULT hr;
  m_pLargeInt = NULL;

  hr = pUnk->QueryInterface( IID_IADsLargeInteger, (void **) &m_pLargeInt );
  pUnk->Release();

  if ( !SUCCEEDED(hr) )
  {
    AfxMessageBox(_T("Fatal Error! QI for IADsLargeInteger failed"));
    return;
  }

}

CDlgIADsLargeInteger::~CDlgIADsLargeInteger ( )

Definition at line 45 of file ADsLargeInteger.cpp.

{
  if ( m_pLargeInt )
  {
    m_pLargeInt->Release();
  }
}

Member Function Documentation

void CDlgIADsLargeInteger::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 54 of file ADsLargeInteger.cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CDlgIADsLargeInteger)
  DDX_Text(pDX, IDC_HIPART, m_lHiPart);
  DDX_Text(pDX, IDC_LOWPART, m_lLowPart);
  //}}AFX_DATA_MAP
}

BOOL CDlgIADsLargeInteger::OnInitDialog ( ) [protected, virtual]

Definition at line 78 of file ADsLargeInteger.cpp.

{
  CDialog::OnInitDialog();

  if ( m_pLargeInt )
  {
    m_pLargeInt->get_HighPart( &m_lHiPart );
    m_pLargeInt->get_LowPart( &m_lLowPart );
    UpdateData(FALSE);
  }

  return TRUE;  // return TRUE unless you set the focus to a control
                // EXCEPTION: OCX Property Pages should return FALSE
}

void CDlgIADsLargeInteger::OnOK ( ) [protected, virtual]

Definition at line 72 of file ADsLargeInteger.cpp.

{

  CDialog::OnOK();
}

Member Data Documentation

long CDlgIADsLargeInteger::m_lHiPart

Definition at line 23 of file ADsLargeInteger.h.

long CDlgIADsLargeInteger::m_lLowPart

Definition at line 24 of file ADsLargeInteger.h.

IADsLargeInteger* CDlgIADsLargeInteger::m_pLargeInt [protected]

Definition at line 37 of file ADsLargeInteger.h.

The documentation for this class was generated from the following files:
  • NetDS/ADSI/samples/General/ADQI/ADsLargeInteger.h
  • NetDS/ADSI/samples/General/ADQI/ADsLargeInteger.cpp
Generated on Wed Nov 13 2024 16:56:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDlgIADsOpenDSObject Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes

CDlgIADsOpenDSObject Class Reference

#include "ADsOpenDSObject.h"

List of all members.

Public Types

enum | { IDD = IDD_IADSOPENDSOBJECT }

Public Member Functions

CDlgIADsOpenDSObject (LPUNKNOWN pUnk, LPUNKNOWN *ppNew, CWnd *pParent=NULL)
~CDlgIADsOpenDSObject ()

Public Attributes

BOOL m_bClearText
BOOL m_bEncrypt
BOOL m_bFastBind
BOOL m_bNoAuthentication
BOOL m_bPrompt
BOOL m_bReadOnly
BOOL m_bSealing
BOOL m_bSecured
BOOL m_bSigning
CString m_sADsPath
CString m_sPassword
CString m_sUserName

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
afx_msg void | OnChangeADsPath ()
afx_msg void | OnChangeUsername ()
virtual BOOL | OnInitDialog ()
virtual void | OnOK ()

Protected Attributes

IADsOpenDSObject * | m_pOpenDS
LPUNKNOWN * | m_ppUnk

Detailed Description

Definition at line 13 of file ADsOpenDSObject.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 21 of file ADsOpenDSObject.h.

{ IDD = IDD_IADSOPENDSOBJECT };

Constructor & Destructor Documentation

CDlgIADsOpenDSObject::CDlgIADsOpenDSObject | ( | LPUNKNOWN | pUnk,
 |  | LPUNKNOWN * | ppNew,
 |  | CWnd * | pParent = NULL
 | ) |  |

Definition at line 39 of file ADsOpenDSObject.cpp.

  : CDialog(CDlgIADsOpenDSObject::IDD, pParent)
{
  //{{AFX_DATA_INIT(CDlgIADsOpenDSObject)
  m_sPassword = _T("");
  m_sUserName = _T("");
  m_bEncrypt = FALSE;
  m_bReadOnly = FALSE;
  m_bSecured = FALSE;
  m_bPrompt = FALSE;
  m_bNoAuthentication = FALSE;
  m_sADsPath = _T("");
  m_bClearText = FALSE;
  m_bFastBind = FALSE;
  m_bSealing = FALSE;
  m_bSigning = FALSE;
  //}}AFX_DATA_INIT

  HRESULT hr;
  m_pOpenDS = NULL;
  m_ppUnk = ppNew;

  hr = pUnk->QueryInterface( IID_IADsOpenDSObject, (void **) &m_pOpenDS );
  if ( !SUCCEEDED(hr) )
  {
    // Give warning... ADsOpenObject has the same functionality as IADsOpenDSObject,
    // the only different is the IADsOpenDSObject normally lives on the namespace object
    AfxMessageBox(_T("Warning: QI for IADsOpenDSObject failed, we will use ADsOpenObject()"));
  }

  CComPtr<IADs> pADs=NULL;
  BSTR bstr;
  hr = pUnk->QueryInterface( IID_IADs, (void**) &pADs );
  if ( SUCCEEDED(hr) )
  {
    pADs->get_ADsPath( &bstr );
    m_sADsPath = bstr;
        SysFreeString( bstr );
  }

  pUnk->Release();

}

CDlgIADsOpenDSObject::~CDlgIADsOpenDSObject ( )

Definition at line 91 of file ADsOpenDSObject.cpp.

{
  if ( m_pOpenDS )
  {
    m_pOpenDS->Release();
  }

}

Member Function Documentation

void CDlgIADsOpenDSObject::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 100 of file ADsOpenDSObject.cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CDlgIADsOpenDSObject)
  DDX_Text(pDX, IDC_PASSWORD, m_sPassword);
  DDX_Text(pDX, IDC_USERNAME, m_sUserName);
  DDX_Check(pDX, IDC_ENCRYPT, m_bEncrypt);
  DDX_Check(pDX, IDC_READONLY, m_bReadOnly);
  DDX_Check(pDX, IDC_SECURED, m_bSecured);
  DDX_Check(pDX, IDC_PROMPTCREDENTIAL, m_bPrompt);
  DDX_Check(pDX, IDC_NOAUTHENTICATION, m_bNoAuthentication);
  DDX_Text(pDX, IDC_ADSPATH, m_sADsPath);
  DDX_Check(pDX, IDC_CLEARTEXT, m_bClearText);
  DDX_Check(pDX, IDC_FASTBIND, m_bFastBind);
  DDX_Check(pDX, IDC_SEALING, m_bSealing);
  DDX_Check(pDX, IDC_SIGNING, m_bSigning);
  //}}AFX_DATA_MAP
}

void CDlgIADsOpenDSObject::OnChangeADsPath ( ) [protected]

Definition at line 268 of file ADsOpenDSObject.cpp.

{
   OnChangeUsername();
}

void CDlgIADsOpenDSObject::OnChangeUsername ( ) [protected]

Definition at line 253 of file ADsOpenDSObject.cpp.

{

  BOOL bADsLength;

  //////////////////////////////////////////////////////////////
  // Turn off/on the OK button depending if ADsPath Edit box is filled.
  //////////////////////////////////////////////////////////////////////

  bADsLength  = GetDlgItem(IDC_ADSPATH)->GetWindowTextLength() > 0 ? TRUE : FALSE;

  GetDlgItem( IDOK )->EnableWindow( bADsLength );
}

BOOL CDlgIADsOpenDSObject::OnInitDialog ( ) [protected, virtual]

Definition at line 274 of file ADsOpenDSObject.cpp.

{
  CDialog::OnInitDialog();

  // Get the current DN;
    OnChangeUsername();

  UpdateData(FALSE); // update to relect the UI
  return TRUE;  // return TRUE unless you set the focus to a control
                // EXCEPTION: OCX Property Pages should return FALSE
}

void CDlgIADsOpenDSObject::OnOK ( ) [protected, virtual]

Definition at line 130 of file ADsOpenDSObject.cpp.

{
  HRESULT hr;
  DWORD dwFlag;

  UpdateData(TRUE);

  dwFlag = 0;
  if ( m_bSecured )
  {
     dwFlag |=  ADS_SECURE_AUTHENTICATION;
  }

  if ( m_bReadOnly )
  {
     dwFlag |= ADS_READONLY_SERVER;
  }

  if ( m_bEncrypt )
  {
    dwFlag |=   ADS_USE_ENCRYPTION;
  }

  if ( m_bPrompt )
  {
    dwFlag |= ADS_PROMPT_CREDENTIALS;
  }

  if ( m_bNoAuthentication )
  {
    dwFlag = ADS_NO_AUTHENTICATION;
  }

  if ( m_bFastBind )
  {
    dwFlag |= ADS_FAST_BIND;
  }

  if ( m_bSigning )
  {
    dwFlag |= ADS_USE_SIGNING;
  }

  if ( m_bSealing )
  {
    dwFlag |= ADS_USE_SEALING;
  }

  USES_CONVERSION;
  LPWSTR pszUser=NULL;
  LPWSTR pszPwd=NULL;
  IUnknown *pNewUnk;

  if ( !m_sUserName.IsEmpty() )
  {
    pszUser = T2OLE(m_sUserName);
  }

  pszPwd  = T2OLE(m_sPassword);

  if ( pszUser == NULL )
  {
    hr = ADsGetObject( T2OLE(m_sADsPath), IID_IUnknown, (void**) &pNewUnk );
  }
  else
  {
    if ( m_pOpenDS )
    {

        hr = m_pOpenDS->OpenDSObject( T2OLE(m_sADsPath), pszUser, pszPwd,
                                      dwFlag, (IDispatch**) &pNewUnk );

    }
    else
    {
      hr = ADsOpenObject( T2OLE(m_sADsPath), pszUser, pszPwd,
                          dwFlag, IID_IUnknown, (void**) &pNewUnk );

    }
  }

  if ( !SUCCEEDED(hr) )
  {
    AfxMessageBox(GetErrorMessage(hr));
    return;
  }

  //////////////////////////////////////////////////////////////////////
  // Save it so, somebody can ask the pointer with its credentials have
  // been validated
  ////////////////////////////////////////////////////////////////////

  if (SUCCEEDED(hr) )
  {
    *m_ppUnk = pNewUnk;  // new validate iunkown;
    ////////////////////////////////////////////////////////////
    // IMPORTANT!!: DO NOT SAVE THE PASSWORD IN MEMORY
    ///////////////////////////////////////////////////////////
    if ( pszUser )
    {
      App->SetCredentials( OLE2T(pszUser), dwFlag ); // save it for later use
    }
    else
    {
      App->SetCredentials( _T(""), dwFlag ); // save it for later use
    }

  }

  CDialog::OnOK();
}

Member Data Documentation

BOOL CDlgIADsOpenDSObject::m_bClearText

Definition at line 30 of file ADsOpenDSObject.h.

BOOL CDlgIADsOpenDSObject::m_bEncrypt

Definition at line 24 of file ADsOpenDSObject.h.

BOOL CDlgIADsOpenDSObject::m_bFastBind

Definition at line 31 of file ADsOpenDSObject.h.

BOOL CDlgIADsOpenDSObject::m_bNoAuthentication

Definition at line 28 of file ADsOpenDSObject.h.

BOOL CDlgIADsOpenDSObject::m_bPrompt

Definition at line 27 of file ADsOpenDSObject.h.

BOOL CDlgIADsOpenDSObject::m_bReadOnly

Definition at line 25 of file ADsOpenDSObject.h.

BOOL CDlgIADsOpenDSObject::m_bSealing

Definition at line 32 of file ADsOpenDSObject.h.

BOOL CDlgIADsOpenDSObject::m_bSecured

Definition at line 26 of file ADsOpenDSObject.h.

BOOL CDlgIADsOpenDSObject::m_bSigning

Definition at line 33 of file ADsOpenDSObject.h.

IADsOpenDSObject* CDlgIADsOpenDSObject::m_pOpenDS [protected]

Definition at line 46 of file ADsOpenDSObject.h.

LPUNKNOWN* CDlgIADsOpenDSObject::m_ppUnk [protected]

Definition at line 47 of file ADsOpenDSObject.h.

CString CDlgIADsOpenDSObject::m_sADsPath

Definition at line 29 of file ADsOpenDSObject.h.

CString CDlgIADsOpenDSObject::m_sPassword

Definition at line 22 of file ADsOpenDSObject.h.

CString CDlgIADsOpenDSObject::m_sUserName

Definition at line 23 of file ADsOpenDSObject.h.

The documentation for this class was generated from the following files:
  • NetDS/ADSI/samples/General/ADQI/ADsOpenDSObject.h
  • NetDS/ADSI/samples/General/ADQI/ADsOpenDSObject.cpp
Generated on Wed Nov 13 2024 16:56:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDlgIADsPropertyList Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes

CDlgIADsPropertyList Class Reference

#include "ADsPropertyList.h"

List of all members.

Public Types

enum | { IDD = IDD_PROPERTYLIST }

Public Member Functions

CDlgIADsPropertyList (LPUNKNOWN pUnk, CWnd *pParent=NULL)
~CDlgIADsPropertyList ()

Public Attributes

CComboBox | m_cADsType
CListBox | m_cValueList
CString m_sAttribute

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
afx_msg void | OnGet ()
virtual BOOL | OnInitDialog ()
afx_msg void | OnPurge ()

Protected Attributes

IADsPropertyList * | m_pPropList

Detailed Description

Definition at line 13 of file ADsPropertyList.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 21 of file ADsPropertyList.h.

{ IDD = IDD_PROPERTYLIST };

Constructor & Destructor Documentation

CDlgIADsPropertyList::CDlgIADsPropertyList | ( | LPUNKNOWN | pUnk,
 |  | CWnd * | pParent = NULL
 | ) |  |

Definition at line 28 of file ADsPropertyList.cpp.

  : CDialog(CDlgIADsPropertyList::IDD, pParent)
{
  //{{AFX_DATA_INIT(CDlgIADsPropertyList)
  m_sAttribute = _T("");
  //}}AFX_DATA_INIT

  HRESULT hr;
  m_pPropList = NULL;
  hr = pUnk->QueryInterface( IID_IADsPropertyList, (void **) &m_pPropList );
  if ( !SUCCEEDED(hr) )
  {
    AfxMessageBox(_T("Fatal Error! QI for IADsPropertyList failed"));
    return;
  }
  pUnk->Release();

  //////////////////////////////////////////
  // Retrieve the data to the cache
  ////////////////////////////////////////////
  IADs *pADs=NULL;
  hr = m_pPropList->QueryInterface( IID_IADs, (void**) &pADs );
  if ( SUCCEEDED(hr) )
  {
    hr = pADs->GetInfo();
    pADs->Release();
  }

}

CDlgIADsPropertyList::~CDlgIADsPropertyList ( )

Definition at line 61 of file ADsPropertyList.cpp.

{
  if ( m_pPropList )
  {
     m_pPropList->Release();
  }

}

Member Function Documentation

void CDlgIADsPropertyList::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 70 of file ADsPropertyList.cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CDlgIADsPropertyList)
  DDX_Control(pDX, IDC_VALUELIST, m_cValueList);
  DDX_Control(pDX, IDC_ADSTYPE, m_cADsType);
  DDX_Text(pDX, IDC_ATTRIBUTE, m_sAttribute);
  //}}AFX_DATA_MAP
}

void CDlgIADsPropertyList::OnGet ( ) [protected]

Definition at line 112 of file ADsPropertyList.cpp.

{

  HRESULT hr;
  CString s;
  BSTR    bstr;
  VARIANT var;
  IDispatch *pDispatch;
  IADsPropertyEntry *pEntry;
  IADsPropertyValue *pValue;
  LONG  lADsType;

  UpdateData(TRUE);
  m_cValueList.ResetContent();

  bstr = m_sAttribute.AllocSysString();
  hr = m_pPropList->GetPropertyItem( bstr, m_cADsType.GetCurSel()+1, &var );
  SysFreeString( bstr );

  if ( SUCCEEDED(hr) )
  {
    pDispatch = V_DISPATCH( &var );
    hr = pDispatch->QueryInterface( IID_IADsPropertyEntry, (void**) &pEntry );
    VariantClear( &var );

    // IADsPropertyEntry
    if ( SUCCEEDED(hr) )
    {
      CPtrList dList;

      // get_Values return array of VT_DISPATH
       hr = pEntry->get_Values( &var );

       pEntry->get_ADsType( &lADsType);

       hr = VariantToPtrList( var, dList );

       pEntry->Release();

       ////////////////////////////
       // IADsPropertyValue
       /////////////////////////////
       if ( SUCCEEDED(hr) )
       {
        POSITION pos;
        pos = dList.GetHeadPosition();
        while ( pos != NULL )
        {
          pDispatch = (IDispatch*) dList.GetAt(pos);
          hr = pDispatch->QueryInterface( IID_IADsPropertyValue, (void**) &pValue );

          if ( SUCCEEDED(hr) )
          {
            pValue->AddRef();
            hr = PropertyValueToString( lADsType, pValue, s );
            m_cValueList.AddString( s );
            pValue->Release();
          }
          dList.GetNext(pos);
        }

       }

       dList.RemoveAll();
       VariantClear(&var);

    }

  }
}

BOOL CDlgIADsPropertyList::OnInitDialog ( ) [protected, virtual]

Definition at line 97 of file ADsPropertyList.cpp.

{
  CDialog::OnInitDialog();
  m_cADsType.SetCurSel(ADSTYPE_CASE_IGNORE_STRING-1); //Most attributes are string
  return TRUE;  // return TRUE unless you set the focus to a control
                // EXCEPTION: OCX Property Pages should return FALSE
}

void CDlgIADsPropertyList::OnPurge ( ) [protected]

Definition at line 186 of file ADsPropertyList.cpp.

{
  HRESULT hr;

  hr = m_pPropList->PurgePropertyList();

  if ( !SUCCEEDED(hr) )
  {
    AfxMessageBox(GetErrorMessage(hr));
  }
}

Member Data Documentation

CComboBox CDlgIADsPropertyList::m_cADsType

Definition at line 23 of file ADsPropertyList.h.

CListBox CDlgIADsPropertyList::m_cValueList

Definition at line 22 of file ADsPropertyList.h.

IADsPropertyList* CDlgIADsPropertyList::m_pPropList [protected]

Definition at line 37 of file ADsPropertyList.h.

CString CDlgIADsPropertyList::m_sAttribute

Definition at line 24 of file ADsPropertyList.h.

The documentation for this class was generated from the following files:
  • NetDS/ADSI/samples/General/ADQI/ADsPropertyList.h
  • NetDS/ADSI/samples/General/ADQI/ADsPropertyList.cpp
Generated on Wed Nov 13 2024 16:56:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDlgIADsSecurityDescriptor Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes

CDlgIADsSecurityDescriptor Class Reference

#include "security.h"

List of all members.

Public Types

enum | { IDD = IDD_SECURITY }

Public Member Functions

CDlgIADsSecurityDescriptor (LPUNKNOWN, CWnd *pParent=NULL)
~CDlgIADsSecurityDescriptor ()

Public Attributes

CListBox | m_cACEList

Protected Member Functions

void | DisplayACE (IADsAccessControlEntry *pACE)
void | DisplayAceObjectType (UINT nID, CString &sObjectType)
virtual void | DoDataExchange (CDataExchange *pDX)
virtual BOOL | OnInitDialog ()
afx_msg void | OnSelChangeAceList ()
void | PopulateACL (IADsAccessControlList *pACL)
void | ResetAceMaskControls ()
void | ResetAcePtr ()

Protected Attributes

CPtrList | m_acePtrList
IADsSecurityDescriptor * | m_pSecurityDesc
CADsSearch m_search

Detailed Description

Definition at line 14 of file security.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 23 of file security.h.

{ IDD = IDD_SECURITY };

Constructor & Destructor Documentation

CDlgIADsSecurityDescriptor::CDlgIADsSecurityDescriptor | ( | LPUNKNOWN | pUnk,
 |  | CWnd * | pParent = NULL
 | ) |  |

Definition at line 29 of file security.cpp.

  : CDialog(CDlgIADsSecurityDescriptor::IDD, pParent)
{
  //{{AFX_DATA_INIT(CDlgIADsSecurityDescriptor)
  //}}AFX_DATA_INIT

  HRESULT hr;
  m_pSecurityDesc = NULL;

  hr = pUnk->QueryInterface( IID_IADsSecurityDescriptor, (void **) &m_pSecurityDesc );
  pUnk->Release();

  if ( !SUCCEEDED(hr) )
  {
    AfxMessageBox(_T("Fatal Error! QI for IADsSecurityDescriptor failed"));
    return;
  }

}

CDlgIADsSecurityDescriptor::~CDlgIADsSecurityDescriptor ( )

Definition at line 54 of file security.cpp.

{
  ResetAcePtr();
  if ( m_pSecurityDesc )
  {
    m_pSecurityDesc->Release();
  }

}

Member Function Documentation

void CDlgIADsSecurityDescriptor::DisplayACE ( IADsAccessControlEntry * pACE ) [protected]

Definition at line 241 of file security.cpp.

{
  LONG aceMask;
  LONG aceType;
  int idx;
  BSTR bstr;
  CString sObjectType;

  ASSERT( pACE );

  ///////////////////////////////////////////////////
  //  Get Access Mask, Ace Type and Object Type
  ////////////////////////////////////////////////////
  if( !SUCCEEDED(pACE->get_AccessMask(&aceMask)) )
  {
    return;
  }
  if ( !SUCCEEDED(pACE->get_AceType(&aceType)) )
  {
    return;
  }

  if ( !SUCCEEDED(pACE->get_ObjectType(&bstr)) )
  {
    return;
  }

  sObjectType = bstr;
  SysFreeString( bstr );

  //////////////////////////////////////
  // Display the type
  //////////////////////////////////////
  int aceTypeList[] =
  {
    ADS_ACETYPE_ACCESS_ALLOWED,
      ADS_ACETYPE_ACCESS_DENIED,
    ADS_ACETYPE_ACCESS_ALLOWED_OBJECT,
    ADS_ACETYPE_ACCESS_DENIED_OBJECT,
    ADS_ACETYPE_SYSTEM_AUDIT,
    ADS_ACETYPE_SYSTEM_AUDIT_OBJECT,
  };

  int sel = -1;
  for( idx=0; idx < (sizeof(aceTypeList)/sizeof(int)); idx++ )
  {
    if ( aceType  == aceTypeList[idx] )
    {
      sel = idx;
      break;
    }
  }
  ((CComboBox*)GetDlgItem(IDC_ACETYPE))->SetCurSel( sel );

  /////////////////////////////////////
  // Display the aces mask
  /////////////////////////////////////
  ResetAceMaskControls(); // Reset the UI

  // Standard ACE Rights
  if ( aceMask &  ADS_RIGHT_DELETE )
  {
    CheckDlgButton( IDC_DELETEOBJECT, TRUE );
  }

  if ( aceMask & ADS_RIGHT_READ_CONTROL )
  {
    CheckDlgButton( IDC_READPERMISSION, TRUE );
  }

  if ( aceMask & ADS_RIGHT_WRITE_DAC )
  {
    CheckDlgButton( IDC_MODIFYPERMISSION, TRUE );
  }

  if ( aceMask & ADS_RIGHT_WRITE_OWNER )
  {
    CheckDlgButton( IDC_MODIFYOWNER, TRUE );
  }

  // Directory ACE Rights
  if ( aceMask & ADS_RIGHT_DS_CREATE_CHILD )
  {
    CheckDlgButton( IDC_CREATECHILD, TRUE );
    DisplayAceObjectType( IDC_CREATECHILD_EDIT, sObjectType );
  }

  if ( aceMask & ADS_RIGHT_DS_DELETE_CHILD )
  {
     CheckDlgButton( IDC_DELETECHILD, TRUE );
     DisplayAceObjectType( IDC_DELETECHILD_EDIT, sObjectType );
  }

  if ( aceMask & ADS_RIGHT_ACTRL_DS_LIST )
  {
     CheckDlgButton( IDC_LISTCONTENT, TRUE );
  }

  if ( aceMask & ADS_RIGHT_DS_SELF )
  {
    CheckDlgButton( IDC_LISTOBJECT, TRUE );
  }

  if ( aceMask & ADS_RIGHT_DS_DELETE_TREE )
  {
    CheckDlgButton( IDC_DELETETREE, TRUE );
  }

  if ( aceMask & ( ADS_RIGHT_DS_READ_PROP  |  ADS_RIGHT_DS_WRITE_PROP | 0x100) &&
     ( (aceType == ADS_ACETYPE_ACCESS_ALLOWED_OBJECT)  |
       (aceType == ADS_ACETYPE_ACCESS_DENIED_OBJECT)  )
     )
  {
    CheckDlgButton( IDC_EXTENDEDRIGHT, TRUE );
    DisplayAceObjectType( IDC_EXTENDEDRIGHT_EDIT, sObjectType );

  }
  else
  {
    if ( aceMask & ADS_RIGHT_DS_READ_PROP )
    {
      CheckDlgButton( IDC_READPROP, TRUE );
      DisplayAceObjectType( IDC_READPROP_EDIT, sObjectType );
    }

    if ( aceMask & ADS_RIGHT_DS_WRITE_PROP )
    {
      CheckDlgButton( IDC_WRITEPROP, TRUE );
      DisplayAceObjectType( IDC_WRITEPROP_EDIT, sObjectType );
    }
  }

}

void CDlgIADsSecurityDescriptor::DisplayAceObjectType | ( | UINT | nID,
 |  | CString & | sObjectType |
 | ) |  |  | [protected]

Definition at line 384 of file security.cpp.

{
  if ( sObjectType.IsEmpty() )
  {
    SetDlgItemText( nID, _T("ALL") );
  }
  else
  {
    SetDlgItemText( nID, sObjectType );
  }

}

void CDlgIADsSecurityDescriptor::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 65 of file security.cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CDlgIADsSecurityDescriptor)
  DDX_Control(pDX, IDC_ACELIST, m_cACEList);
  //}}AFX_DATA_MAP
}

BOOL CDlgIADsSecurityDescriptor::OnInitDialog ( ) [protected, virtual]

Definition at line 170 of file security.cpp.

{
  CDialog::OnInitDialog();

  if ( m_pSecurityDesc == NULL )
  {
    return TRUE;
  }

  /////////////////////////////////////////////
  // Populate the DACL
  ////////////////////////////////////////////
  HRESULT hr;
  IDispatch *pDisp;

  IADsAccessControlList *pACL;
  hr = m_pSecurityDesc->get_DiscretionaryAcl( &pDisp );
  if (!SUCCEEDED(hr) )
  {
    AfxMessageBox(GetErrorMessage(hr));
    return TRUE;
  }

  hr = pDisp->QueryInterface( IID_IADsAccessControlList, (void**) &pACL );
  pDisp->Release();

  if ( SUCCEEDED(hr) )
  {
    PopulateACL( pACL );
  }

  return TRUE;  // return TRUE unless you set the focus to a control
                // EXCEPTION: OCX Property Pages should return FALSE
}

void CDlgIADsSecurityDescriptor::OnSelChangeAceList ( ) [protected]

Definition at line 208 of file security.cpp.

{
  int idx=0;

  ///////////////////////////////////////////////////
  // Seach the ACEs
  ////////////////////////////////////////////////
  idx = m_cACEList.GetCurSel();
  if ( idx == LB_ERR )
  {
    return;
  }

  POSITION pos = m_acePtrList.FindIndex( idx );
  IADsAccessControlEntry *pACE = NULL;
  if ( !pos )
  {
    return;
  }

  ///////////////////////////////////////////////////
  // Now we can disply the ACE characteristics
  ////////////////////////////////////////////////////
    pACE = (IADsAccessControlEntry *) m_acePtrList.GetAt( pos );
  if ( pACE )
  {
    pACE->AddRef();
    DisplayACE( pACE );
  }
}

void CDlgIADsSecurityDescriptor::PopulateACL ( IADsAccessControlList * pACL ) [protected]

Definition at line 83 of file security.cpp.

{
  ASSERT( pACL );
  HRESULT hr;
  ULONG   lFetch;

  IEnumVARIANT *pEnum;
  LPUNKNOWN     pUnk;
  VARIANT       var;
  IDispatch  *pDisp;
  BSTR      bstr;
  CString     s;

  IADsAccessControlEntry *pACE;

  m_cACEList.ResetContent();
  ResetAcePtr();

  hr = pACL->get__NewEnum( &pUnk );
  if ( !SUCCEEDED(hr) )
  {
    return;
  }

  hr = pUnk->QueryInterface( IID_IEnumVARIANT, (void**) &pEnum );
  if ( !SUCCEEDED(hr) )
  {
    return;
  }

  hr = pEnum->Next( 1, &var, &lFetch );

  while( hr == S_OK )
  {
    if ( lFetch == 1 )
    {
      if ( VT_DISPATCH != V_VT(&var) )
      {
        break;
      }

        pDisp = V_DISPATCH(&var);
      ///////////////////////////
      // Get the ACE
      /////////////////////////////
      hr = pDisp->QueryInterface( IID_IADsAccessControlEntry, (void**)&pACE );
      if ( SUCCEEDED(hr) )
      {
        pACE->get_Trustee(&bstr);
        s = bstr;
        SysFreeString(bstr);
        m_cACEList.AddString( s );
        m_acePtrList.AddTail( pACE ); //save the pointer for future use,
                                   // we don't need to Release() it.

      }

      VariantClear(&var);
    }
    hr = pEnum->Next( 1, &var, &lFetch );

    };

  pACL->Release();
}

void CDlgIADsSecurityDescriptor::ResetAceMaskControls ( ) [protected]

Definition at line 397 of file security.cpp.

{
   CheckDlgButton( IDC_DELETEOBJECT, FALSE );
   CheckDlgButton( IDC_READPERMISSION, FALSE );
   CheckDlgButton( IDC_CREATECHILD, FALSE );
   CheckDlgButton( IDC_DELETECHILD, FALSE );
   CheckDlgButton( IDC_LISTCONTENT, FALSE );
   CheckDlgButton( IDC_LISTOBJECT, FALSE );
   CheckDlgButton( IDC_DELETETREE, FALSE );
   CheckDlgButton( IDC_READPROP, FALSE );
   CheckDlgButton( IDC_WRITEPROP, FALSE );

   SetDlgItemText( IDC_CREATECHILD_EDIT, _T("") );
   SetDlgItemText( IDC_DELETECHILD_EDIT, _T("") );
   SetDlgItemText( IDC_READPROP_EDIT, _T("") );
   SetDlgItemText( IDC_WRITEPROP_EDIT, _T("") );
   SetDlgItemText( IDC_EXTENDEDRIGHT_EDIT, _T("") );

}

void CDlgIADsSecurityDescriptor::ResetAcePtr ( ) [protected]

Definition at line 155 of file security.cpp.

{
  POSITION pos;
  IADsAccessControlList *pACE;
  pos = m_acePtrList.GetHeadPosition();
  while( pos != NULL )
  {
      pACE = (IADsAccessControlList*) m_acePtrList.GetAt( pos );
    pACE->Release();
    m_acePtrList.GetNext( pos );
  }
  m_acePtrList.RemoveAll();
}

Member Data Documentation

CPtrList CDlgIADsSecurityDescriptor::m_acePtrList [protected]

Definition at line 44 of file security.h.

CListBox CDlgIADsSecurityDescriptor::m_cACEList

Definition at line 24 of file security.h.

IADsSecurityDescriptor* CDlgIADsSecurityDescriptor::m_pSecurityDesc [protected]

Definition at line 43 of file security.h.

CADsSearch CDlgIADsSecurityDescriptor::m_search [protected]

Definition at line 45 of file security.h.

The documentation for this class was generated from the following files:
  • NetDS/ADSI/samples/General/ADQI/security.h
  • NetDS/ADSI/samples/General/ADQI/security.cpp
Generated on Wed Nov 13 2024 16:56:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDlgIDirectoryObject Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes

CDlgIDirectoryObject Class Reference

#include "DirectoryObject.h"

List of all members.

Public Types

enum | { IDD = IDD_IDIRECTORYOBJECT }

Public Member Functions

CDlgIDirectoryObject (LPUNKNOWN pUnk, CWnd *pParent=NULL)
~CDlgIDirectoryObject ()

Public Attributes

CEdit | m_cAttributes
CListBox | m_cValueList
CString m_sAttributes
CString m_sClass
CString m_sDN
CString m_sParent
CString m_sRDN
CString m_sSchema

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
afx_msg void | OnChangeAttribute ()
afx_msg void | OnDelete ()
afx_msg void | OnGet ()
virtual BOOL | OnInitDialog ()
void | ShowAttributes ()

Protected Attributes

IDirectoryObject * | m_pDirObject

Detailed Description

Definition at line 17 of file DirectoryObject.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 25 of file DirectoryObject.h.

{ IDD = IDD_IDIRECTORYOBJECT };

Constructor & Destructor Documentation

CDlgIDirectoryObject::CDlgIDirectoryObject | ( | LPUNKNOWN | pUnk,
 |  | CWnd * | pParent = NULL
 | ) |  |

Definition at line 28 of file DirectoryObject.cpp.

  : CDialog(CDlgIDirectoryObject::IDD, pParent)
{
  //{{AFX_DATA_INIT(CDlgIDirectoryObject)
  m_sDN = _T("");
  m_sRDN = _T("");
  m_sSchema = _T("");
  m_sClass = _T("");
  m_sParent = _T("");
  m_sAttributes = _T("");
  //}}AFX_DATA_INIT

  HRESULT hr;
  m_pDirObject = NULL;
  hr = pUnk->QueryInterface( IID_IDirectoryObject, (void **) &m_pDirObject );
  if ( !SUCCEEDED(hr) )
  {
    AfxMessageBox(_T("Fatal Error! QI for IDirectoryObject failed"));
    return;
  }
  pUnk->Release();

  ShowAttributes();

}

CDlgIDirectoryObject::~CDlgIDirectoryObject ( )

Definition at line 55 of file DirectoryObject.cpp.

{
  if ( m_pDirObject )
  {
    m_pDirObject->Release();
  }
}

Member Function Documentation

void CDlgIDirectoryObject::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 63 of file DirectoryObject.cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CDlgIDirectoryObject)
  DDX_Control(pDX, IDC_ATTRIBUTE, m_cAttributes);
  DDX_Control(pDX, IDC_VALUELIST, m_cValueList);
  DDX_Text(pDX, IDC_DN, m_sDN);
  DDX_Text(pDX, IDC_RDN, m_sRDN);
  DDX_Text(pDX, IDC_SCHEMA, m_sSchema);
  DDX_Text(pDX, IDC_CLASS, m_sClass);
  DDX_Text(pDX, IDC_PARENT, m_sParent);
  DDX_Text(pDX, IDC_ATTRIBUTE, m_sAttributes);
  //}}AFX_DATA_MAP
}

void CDlgIDirectoryObject::OnChangeAttribute ( ) [protected]

Definition at line 266 of file DirectoryObject.cpp.

{
  BOOL bEnabled;
  bEnabled = m_cAttributes.GetWindowTextLength() > 0 ? TRUE : FALSE;
  GetDlgItem( IDC_GET )->EnableWindow( bEnabled );

}

void CDlgIDirectoryObject::OnDelete ( ) [protected]

Definition at line 127 of file DirectoryObject.cpp.

{
  CDeleteObjectDlg dlg;
  CString s, sMsg;
  HRESULT hr;

  if ( dlg.DoModal() == IDOK )
  {
     USES_CONVERSION;
     // Example: CN=jsmith
     s  = dlg.GetObjectName();
     hr = m_pDirObject->DeleteDSObject( T2OLE(s) );
  }

  if ( SUCCEEDED(hr) )
  {
    sMsg.Format(_T("Object '%s' was sucessfully deleted"), s);
    AfxMessageBox( sMsg );
  }
  else
  {
    AfxMessageBox(GetErrorMessage(hr));
    return;
  }

}

void CDlgIDirectoryObject::OnGet ( ) [protected]

Definition at line 162 of file DirectoryObject.cpp.

{
   CStringList sList;
   UINT nCount;
   HRESULT hr;

   UpdateData(TRUE);

   StringToStringList(m_sAttributes, sList );
   nCount = sList.GetCount();
   if ( nCount == 0 )
   {
     return;
   }

   ///////////////////////////////////////
   // Now build the Attribute Names List
   ///////////////////////////////////////
   POSITION     pos;
   DWORD      dwNumAttr;
   LPWSTR     *pAttrNames=NULL;
   ADS_ATTR_INFO  *pAttrInfo;
   DWORD      dwReturn;

   USES_CONVERSION;

   pAttrNames = (LPWSTR*) AllocADsMem( sizeof(LPWSTR) * nCount );
   pos = sList.GetHeadPosition();
   dwNumAttr = 0;
   while( pos != NULL )
   {
     pAttrNames[dwNumAttr] = T2OLE(sList.GetAt(pos));
     dwNumAttr++;
     sList.GetNext(pos);
   }

   /////////////////////////////////////////
   // Get attributes value requested
   // Note: The order is not necessarily the same as
   //       requested via pAttrNames.
   ///////////////////////////////////////////
   hr = m_pDirObject->GetObjectAttributes( pAttrNames, dwNumAttr, &pAttrInfo, &dwReturn );

   if ( SUCCEEDED(hr) )
   {
    DWORD idx;
    CString sDisplay;
    CStringList sValueList;
    UINT nCount;
    POSITION pos;

    m_cValueList.ResetContent();

    for( idx=0; idx < dwReturn; idx++)
    {
          ADsToStringList( pAttrInfo[idx].pADsValues, pAttrInfo[idx].dwNumValues, sValueList );
      sDisplay = OLE2T(pAttrInfo[idx].pszAttrName);
      sDisplay += _T(":");
      m_cValueList.AddString( sDisplay );
      nCount = sValueList.GetCount();
      if ( nCount == 0 ) // can not find/convert the value
      {
        m_cValueList.AddString(_T(" > [No Value]"));
        continue;
      }
      else
      {
        pos = sValueList.GetHeadPosition();
        while( pos != NULL )
        {
          sDisplay = _T(" > ");
          sDisplay += sValueList.GetAt(pos);
          m_cValueList.AddString( sDisplay );
          sValueList.GetNext(pos);
        }

      }

    }

    sValueList.RemoveAll();
   }

   ///////////////////////////////////////////////////////////
   // Use FreADsMem for all memory obtained from ADSI call
   /////////////////////////////////////////////////////////////
   FreeADsMem( pAttrInfo );
   FreeADsMem( pAttrNames );

}

BOOL CDlgIDirectoryObject::OnInitDialog ( ) [protected, virtual]

Definition at line 274 of file DirectoryObject.cpp.

{
  CDialog::OnInitDialog();

  OnChangeAttribute();
  return TRUE;  // return TRUE unless you set the focus to a control
                // EXCEPTION: OCX Property Pages should return FALSE
}

void CDlgIDirectoryObject::ShowAttributes ( ) [protected]

Definition at line 94 of file DirectoryObject.cpp.

{
  ADS_OBJECT_INFO *pInfo;
  HRESULT hr;

  hr = m_pDirObject->GetObjectInformation(&pInfo);
  if (!SUCCEEDED(hr) )
  {
    return;
  }

  /////////////////////////////////////////////
  // Show the attributes in the UI
  /////////////////////////////////////////////
  USES_CONVERSION;

  m_sRDN    = OLE2T(pInfo->pszRDN);
  m_sDN   = OLE2T(pInfo->pszObjectDN);
  m_sParent = OLE2T(pInfo->pszParentDN);
  m_sClass  = OLE2T(pInfo->pszClassName);
  m_sSchema = OLE2T(pInfo->pszSchemaDN);

  ///////////////////////////////////////////////////////////
  // Do not forget to clean-up the memory using FreeADsMem!
  //////////////////////////////////////////////////////////
  FreeADsMem( pInfo );

}

Member Data Documentation

CEdit CDlgIDirectoryObject::m_cAttributes

Definition at line 26 of file DirectoryObject.h.

CListBox CDlgIDirectoryObject::m_cValueList

Definition at line 27 of file DirectoryObject.h.

IDirectoryObject* CDlgIDirectoryObject::m_pDirObject [protected]

Definition at line 47 of file DirectoryObject.h.

CString CDlgIDirectoryObject::m_sAttributes

Definition at line 33 of file DirectoryObject.h.

CString CDlgIDirectoryObject::m_sClass

Definition at line 31 of file DirectoryObject.h.

CString CDlgIDirectoryObject::m_sDN

Definition at line 28 of file DirectoryObject.h.

CString CDlgIDirectoryObject::m_sParent

Definition at line 32 of file DirectoryObject.h.

CString CDlgIDirectoryObject::m_sRDN

Definition at line 29 of file DirectoryObject.h.

CString CDlgIDirectoryObject::m_sSchema

Definition at line 30 of file DirectoryObject.h.

The documentation for this class was generated from the following files:
  • NetDS/ADSI/samples/General/ADQI/DirectoryObject.h
  • NetDS/ADSI/samples/General/ADQI/DirectoryObject.cpp
Generated on Wed Nov 13 2024 16:56:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDlgIDirectorySearch Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes

CDlgIDirectorySearch Class Reference

#include "DirectorySearch.h"

List of all members.

Public Types

enum | { IDD = IDD_IDIRECTORYSEARCH }

Public Member Functions

CDlgIDirectorySearch (LPUNKNOWN pUnk, CWnd *pParent=NULL)
~CDlgIDirectorySearch ()

Public Attributes

BOOL m_bAsynch
BOOL m_bAttrib
BOOL m_bCacheResult
BOOL m_bEnableFilter
CComboBox | m_CADsSearchScope
CEdit | m_cAttrList
CButton | m_cCacheResult
CComboBox | m_cChaseReferrals
CButton | m_cEnableFilter
CButton | m_cExecute
CEdit | m_cFilter
CListCtrl | m_cListView
int | m_nDeref
UINT m_nPageSize
UINT m_nSizeLimit
UINT m_nTimeLimit
UINT m_nTimeOut
CString m_sFilter
CString m_sSortOn

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
afx_msg void | OnChangeFilter ()
afx_msg void | OnDblClickListView (NMHDR *pNMHDR, LRESULT *pResult)
afx_msg void | OnEnabled ()
afx_msg void | OnExecute ()
virtual BOOL | OnInitDialog ()
virtual void | OnOK ()

Protected Attributes

IDirectorySearch * | m_pSearch

Detailed Description

Definition at line 13 of file DirectorySearch.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 21 of file DirectorySearch.h.

{ IDD = IDD_IDIRECTORYSEARCH };

Constructor & Destructor Documentation

CDlgIDirectorySearch::CDlgIDirectorySearch | ( | LPUNKNOWN | pUnk,
 |  | CWnd * | pParent = NULL
 | ) |  |

Definition at line 29 of file DirectorySearch.cpp.

  : CDialog(CDlgIDirectorySearch::IDD, pParent)
{
  //{{AFX_DATA_INIT(CDlgIDirectorySearch)
  m_sFilter = _T("");
  m_bEnableFilter = FALSE;
  m_nTimeOut = 0;
  m_bCacheResult = FALSE;
  m_nPageSize = 0;
  m_sSortOn = _T("");
  m_nTimeLimit = 0;
  m_nSizeLimit = 0;
  m_bAsynch = FALSE;
  m_bAttrib = FALSE;
  m_nDeref = -1;
  //}}AFX_DATA_INIT
  HRESULT hr;
  m_pSearch = NULL;
  hr = pUnk->QueryInterface( IID_IDirectorySearch, (void **) &m_pSearch );
  if ( !SUCCEEDED(hr) )
  {
    AfxMessageBox(_T("Fatal Error! QI for IDirectorySearch failed"));
    return;
  }
  pUnk->Release();

}

CDlgIDirectorySearch::~CDlgIDirectorySearch ( )

Definition at line 60 of file DirectorySearch.cpp.

{
  if ( m_pSearch )
  {
    m_pSearch->Release();
  }
}

Member Function Documentation

void CDlgIDirectorySearch::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 68 of file DirectorySearch.cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CDlgIDirectorySearch)
  DDX_Control(pDX, IDC_ATTRIBUTE, m_cAttrList);
  DDX_Control(pDX, IDC_LISTVIEW, m_cListView);
  DDX_Control(pDX, IDC_CHASEREFERRAL, m_cChaseReferrals);
  DDX_Control(pDX, IDC_CACHERESULTS, m_cCacheResult);
  DDX_Control(pDX, IDC_SEARCHSCOPE, m_CADsSearchScope);
  DDX_Control(pDX, IDC_ENABLED, m_cEnableFilter);
  DDX_Control(pDX, IDC_EXECUTE, m_cExecute);
  DDX_Control(pDX, IDC_FILTER, m_cFilter);
  DDX_Text(pDX, IDC_FILTER, m_sFilter);
  DDX_Check(pDX, IDC_ENABLED, m_bEnableFilter);
  DDX_Text(pDX, IDC_TIMEOUT, m_nTimeOut);
  DDX_Check(pDX, IDC_CACHERESULTS, m_bCacheResult);
  DDX_Text(pDX, IDC_PAGESIZE, m_nPageSize);
  DDX_Text(pDX, IDC_SORTON, m_sSortOn);
  DDX_Text(pDX, IDC_TIMELIMIT, m_nTimeLimit);
  DDX_Text(pDX, IDC_SIZELIMIT, m_nSizeLimit);
  DDX_Check(pDX, IDC_ASYNCH, m_bAsynch);
  DDX_Check(pDX, IDC_ATTRIBONLY, m_bAttrib);
  DDX_CBIndex(pDX, IDC_DEREF, m_nDeref);
  //}}AFX_DATA_MAP
}

void CDlgIDirectorySearch::OnChangeFilter ( ) [protected]

Definition at line 529 of file DirectorySearch.cpp.

{
  BOOL bExecEnabled;

  bExecEnabled = m_cFilter.GetWindowTextLength() > 0 ? TRUE :FALSE;
  m_cExecute.EnableWindow( bExecEnabled );
}

void CDlgIDirectorySearch::OnDblClickListView | ( | NMHDR * | pNMHDR,
 |  | LRESULT * | pResult |
 | ) |  |  | [protected]

Definition at line 598 of file DirectorySearch.cpp.

{
   int idx;
   *pResult = 0;

   idx = m_cListView.GetNextItem(-1, LVNI_SELECTED);
   if ( idx == -1 )
   {
     return;
   }

   CHeaderCtrl *pHeader;
   int nCount;
     pHeader = m_cListView.GetHeaderCtrl();
   if ( !pHeader )
   {
     return;
   }
   nCount = pHeader->GetItemCount();

   // Get the text
   CString s;
   s = m_cListView.GetItemText( idx, nCount-1 );

   if ( !s.GetLength() )
   {
     return;
   }

   USES_CONVERSION;
   HRESULT hr;
   IUnknown *pUnk=NULL;
   CString sUserName;

    hr = App->ADsOpenObject( T2OLE( s ), IID_IUnknown, (void**) &pUnk );

    /////////////////////////////////////
    // Bring up the IADs Dialog
    ///////////////////////////////////////
    if ( SUCCEEDED(hr) )
    {
      pUnk->AddRef();
      CDlgIADs dlg( pUnk );
      dlg.DoModal();
      pUnk->Release();
    }
    else
    {
      AfxMessageBox(GetErrorMessage(hr));
    }

}

void CDlgIDirectorySearch::OnEnabled ( ) [protected]

Definition at line 558 of file DirectorySearch.cpp.

{
   UpdateData(TRUE);

   // Enable/Disable Edit Boxes
   GetDlgItem( IDC_TIMEOUT )->EnableWindow(m_bEnableFilter);
   GetDlgItem( IDC_SEARCHSCOPE )->EnableWindow(m_bEnableFilter);
   GetDlgItem( IDC_PAGESIZE )->EnableWindow(m_bEnableFilter);
   GetDlgItem( IDC_SORTON )->EnableWindow(m_bEnableFilter);
   GetDlgItem( IDC_CHASEREFERRAL )->EnableWindow(m_bEnableFilter);
   GetDlgItem( IDC_TIMELIMIT )->EnableWindow(m_bEnableFilter);
   GetDlgItem( IDC_SIZELIMIT )->EnableWindow(m_bEnableFilter);
   GetDlgItem( IDC_ASYNCH )->EnableWindow(m_bEnableFilter);
   GetDlgItem( IDC_CACHERESULTS )->EnableWindow(m_bEnableFilter);
   GetDlgItem( IDC_ATTRIBONLY )->EnableWindow(m_bEnableFilter);
   GetDlgItem( IDC_DEREF )->EnableWindow(m_bEnableFilter);

   // Enabled/Disabled Texts
   GetDlgItem( IDC_TIMEOUT_TXT )->EnableWindow(m_bEnableFilter);
   GetDlgItem( IDC_SEARCHSCOPE_TXT )->EnableWindow(m_bEnableFilter);
   GetDlgItem( IDC_PAGESIZE_TXT )->EnableWindow(m_bEnableFilter);
   GetDlgItem( IDC_SORTON_TXT )->EnableWindow(m_bEnableFilter);
   GetDlgItem( IDC_CHASEREFERRAL_TXT )->EnableWindow(m_bEnableFilter);
   GetDlgItem( IDC_TIMELIMIT_TXT )->EnableWindow(m_bEnableFilter);
   GetDlgItem( IDC_SIZELIMIT_TXT )->EnableWindow(m_bEnableFilter);
   GetDlgItem( IDC_DEREF_TXT )->EnableWindow(m_bEnableFilter);

}

void CDlgIDirectorySearch::OnExecute ( ) [protected]

Definition at line 117 of file DirectorySearch.cpp.

{
  ASSERT( m_pSearch );
  CWaitCursor wait;

  UpdateData(TRUE); // Get data from the Dialog Box
  HRESULT hr;
  ADS_SEARCH_HANDLE hSearch;
  ADS_SEARCH_COLUMN col;
  CString s;
  int idx=0;
  int nCount;
  LPWSTR *pszAttr=NULL;
  POSITION pos;
  USES_CONVERSION;

  /////////////////////////////////
  // Reset the Total Number
  //////////////////////////////////
  SetDlgItemText( IDC_TOTAL, _T(""));

  /////////////////////////////////////////////
  // Get the attribute list, and preparing..
  ///////////////////////////////////////////
  CStringList sAttrList;
  m_cListView.DeleteAllItems(); // Reset the UI

    while( m_cListView.DeleteColumn(0))
  {
    ;
  }

  //////////////////////////////////////////////////
  // Preparing for attribute list
  // and columns to display
  CString sTemp;
  m_cAttrList.GetWindowText(s);

  // we need to add adspath, so that we can refer to this object later when user dblclk the item
  if ( !s.IsEmpty() )
  {
    sTemp = s;
    sTemp.MakeLower();
    if ( s.Find(_T("adspath"),0) == -1 )
    {
      s += _T(",ADsPath");
    }
  }

  // convert to string list for easy manipulation
  StringToStringList( s, sAttrList );

  nCount = sAttrList.GetCount();
  idx=0;
  if ( nCount )
  {

    pszAttr = (LPWSTR*) AllocADsMem( nCount * sizeof(LPWSTR));

    pos = sAttrList.GetHeadPosition();
    while ( pos != NULL )
    {
      s = sAttrList.GetAt(pos);
      pszAttr[idx] = T2OLE(s);
      sAttrList.GetNext(pos );
      idx++;
    }
  }
  else
  {
    nCount = -1;
  }

  /////////////////////////////////////////
  // BEGIN  Set the preferences
  ///////////////////////////////////////
  DWORD dwCountPref = 0;
  ADS_SEARCHPREF_INFO prefInfo[ MAX_SEARCH_PREF ];
  ADS_SORTKEY *pSortKey = NULL;

  if ( m_bEnableFilter == FALSE )
  {
    // Reset the preference
    m_pSearch->SetSearchPreference( prefInfo, dwCountPref );
  }
  else // Preferences are specified
  {
    ////////////////////////
    // Timeout Pref
    ////////////////////////////
    if ( m_nTimeOut != 0 )
    {
      prefInfo[dwCountPref].dwSearchPref = ADS_SEARCHPREF_TIMEOUT;
      prefInfo[dwCountPref].vValue.dwType = ADSTYPE_INTEGER;
      prefInfo[dwCountPref].vValue.Integer = m_nTimeOut;
      dwCountPref++;
    }

    //////////////////////////////
    // Search Scope
    /////////////////////////////
    idx = m_CADsSearchScope.GetCurSel();
    if ( idx != CB_ERR )
    {
      prefInfo[dwCountPref].dwSearchPref = ADS_SEARCHPREF_SEARCH_SCOPE;
      prefInfo[dwCountPref].vValue.dwType = ADSTYPE_INTEGER;
      prefInfo[dwCountPref].vValue.Integer = idx;
      dwCountPref++;
    }

    ///////////////////////////////////////////////////
    // Cache Result. The default is to cache the result
    /////////////////////////////////////////////////
    if ( !m_bCacheResult )
    {
      prefInfo[dwCountPref].dwSearchPref = ADS_SEARCHPREF_SEARCH_SCOPE;
      prefInfo[dwCountPref].vValue.dwType = ADSTYPE_BOOLEAN;
      prefInfo[dwCountPref].vValue.Boolean = FALSE;
      dwCountPref++;
    }

    //////////////////////////////////////////////////
    // Page Size
    ///////////////////////////////////////////////////
    if ( m_nPageSize > 0 )
    {
      prefInfo[dwCountPref].dwSearchPref = ADS_SEARCHPREF_PAGESIZE;
      prefInfo[dwCountPref].vValue.dwType = ADSTYPE_INTEGER;;
      prefInfo[dwCountPref].vValue.Integer = m_nPageSize;
      dwCountPref++;
    }

    ////////////////////////////////////////////////
    // Chase Referrals
    ///////////////////////////////////////////////
    idx = m_cChaseReferrals.GetCurSel();
    if ( idx != CB_ERR )
    {
      prefInfo[dwCountPref].dwSearchPref = ADS_SEARCHPREF_CHASE_REFERRALS;
      prefInfo[dwCountPref].vValue.dwType = ADSTYPE_INTEGER;
      switch( idx )
      {
      case 0:
         prefInfo[dwCountPref].vValue.Integer = ADS_CHASE_REFERRALS_NEVER;
         break;
      case 1:
         prefInfo[dwCountPref].vValue.Integer = ADS_CHASE_REFERRALS_SUBORDINATE;
         break;
      case 2:
         prefInfo[dwCountPref].vValue.Integer = ADS_CHASE_REFERRALS_EXTERNAL;
         break;
      default:
         prefInfo[dwCountPref].vValue.Integer = ADS_CHASE_REFERRALS_EXTERNAL;

      }

      dwCountPref++;
    }

    ///////////////////////////////////////////////
    // Sort On
    ////////////////////////////////////////////////
    if ( !m_sSortOn.IsEmpty() )
    {
      CStringList sList;
      UINT nCount;
      prefInfo[dwCountPref].dwSearchPref = ADS_SEARCHPREF_SORT_ON;
      prefInfo[dwCountPref].vValue.dwType = ADSTYPE_PROV_SPECIFIC;
        StringToStringList( m_sSortOn, sList );

      nCount = sList.GetCount();
      if ( nCount >  0 )
      {
        POSITION pos;
        pos= sList.GetHeadPosition();
        pSortKey = (ADS_SORTKEY *) LocalAlloc( LMEM_FIXED | LMEM_ZEROINIT, sizeof(ADS_SORTKEY) * nCount );
        idx = 0;
        while( pos != NULL )
        {
          pSortKey[idx].pszAttrType = T2OLE(sList.GetAt(pos));
          pSortKey[idx].pszReserved = NULL;
          pSortKey[idx].fReverseorder =0;

          // Next
          idx++;
          sList.GetNext( pos );
        }

        prefInfo[dwCountPref].vValue.ProviderSpecific.dwLength = sizeof(ADS_SORTKEY) * nCount;
        prefInfo[dwCountPref].vValue.ProviderSpecific.lpValue = (LPBYTE) pSortKey;
        dwCountPref++;
      }

    }

    //////////////////////////////////////////////
    // Size Limit
    //////////////////////////////////////////////
    if ( m_nSizeLimit > 0 )
    {
            prefInfo[dwCountPref].dwSearchPref = ADS_SEARCHPREF_SIZE_LIMIT;
            prefInfo[dwCountPref].vValue.dwType = ADSTYPE_INTEGER;
            prefInfo[dwCountPref].vValue.Integer = m_nSizeLimit;
      dwCountPref++;
    }

    //////////////////////////////////////////////////
    // A Synchronous
    ///////////////////////////////////////////////////
    if ( m_bAsynch )
    {
      prefInfo[dwCountPref].dwSearchPref = ADS_SEARCHPREF_ASYNCHRONOUS;
            prefInfo[dwCountPref].vValue.dwType = ADSTYPE_BOOLEAN;
            prefInfo[dwCountPref].vValue.Integer = TRUE;
      dwCountPref++;

    }

    /////////////////////////////////////////////////////
    //  Attribute Type Only
    //////////////////////////////////////////////////////
    if ( m_bAttrib )
    {
      prefInfo[dwCountPref].dwSearchPref = ADS_SEARCHPREF_ATTRIBTYPES_ONLY;
            prefInfo[dwCountPref].vValue.dwType = ADSTYPE_BOOLEAN;
            prefInfo[dwCountPref].vValue.Integer = TRUE;
      dwCountPref++;

    }

    /////////////////////////////////////////////////////
    //  Derefence Alias
    //////////////////////////////////////////////////////
    if ( m_nDeref != CB_ERR )
    {
      prefInfo[dwCountPref].dwSearchPref = ADS_SEARCHPREF_DEREF_ALIASES;
            prefInfo[dwCountPref].vValue.dwType = ADSTYPE_INTEGER;
            prefInfo[dwCountPref].vValue.Integer = m_nDeref;
      dwCountPref++;

    }

    ///////////////////////////////////////////////
    // Now Set the selected preferences
    //////////////////////////////////////////////
    hr = m_pSearch->SetSearchPreference( prefInfo, dwCountPref );

  }

  /////////////////////////////////////////
  // END  Set the preferences
  ///////////////////////////////////////

  ////////////////////////////////////////
  // Execute the Search
  //////////////////////////////////////
  DWORD dwCount=0;

  hr = m_pSearch->ExecuteSearch(T2OLE(m_sFilter), pszAttr, nCount, &hSearch );

  ////////////////////////////////
  //// cleanup
  ////////////////////////////////
  if ( pszAttr )
  {
      FreeADsMem( pszAttr );
  }

  if ( pSortKey )
  {
    LocalFree( pSortKey );
  }

  if ( !SUCCEEDED(hr) )
  {
    AfxMessageBox(GetErrorMessage(hr));
    return;
  }

  ////////////////////////////////////////////////////////
  // Enumerate the rows
  ////////////////////////////////////////////////////////

  sAttrList.RemoveAll();

  /////////////////////////////////////////////////////////
  // Retrieve the column names returned from the server
  ///////////////////////////////////////////////////////////
  LPWSTR pszColumn;
  hr = m_pSearch->GetFirstRow( hSearch );

  if ( !SUCCEEDED(hr) )
  {
    return;
  }

  idx=0;
  while( (hr=m_pSearch->GetNextColumnName( hSearch, &pszColumn )) != S_ADS_NOMORE_COLUMNS )
  {
    s = OLE2T( pszColumn );
    m_cListView.InsertColumn(idx, s, LVCFMT_LEFT, 150 ); // adding columns to the UI
    sAttrList.AddTail(s);
    FreeADsMem( pszColumn );
    idx++;
  }

  /////////////////////////////////////////////
  // Start iterating the result set
  ////////////////////////////////////////////
  int nCol;
  CStringList sValueList;

    do
  {
    nCol=0;
    pos = sAttrList.GetHeadPosition();

    while( pos != NULL )
    {

        s = sAttrList.GetAt(pos); //column name

      // Get the Name and display it in the list
      hr = m_pSearch->GetColumn( hSearch, T2OLE(s), &col );
      if ( SUCCEEDED(hr) )
      {
        s =_T("");

        if ( col.dwADsType != ADSTYPE_INVALID ) // if we request for attrib only, no value will be returned
        {
          ADsToStringList(col.pADsValues, col.dwNumValues, sValueList );
          StringListToString( sValueList, s );
        }

        if ( nCol )
        {
          m_cListView.SetItemText(0,nCol, s);
        }
        else
        {
           m_cListView.InsertItem(0, s);
        }

        m_pSearch->FreeColumn( &col );
      }

      nCol++;
      sAttrList.GetNext(pos);

    }
    dwCount++;
    /////////////////////////////
    //Display the total so far
    ////////////////////////////////
    s.Format("%ld object(s)", dwCount );
    SetDlgItemText( IDC_TOTAL, s );

  }
  while( (hr=m_pSearch->GetNextRow( hSearch)) != S_ADS_NOMORE_ROWS );

  m_pSearch->CloseSearchHandle( hSearch );

}

BOOL CDlgIDirectorySearch::OnInitDialog ( ) [protected, virtual]

Definition at line 537 of file DirectorySearch.cpp.

{
  CDialog::OnInitDialog();

  // Initialize to a default search
  m_cFilter.SetWindowText(_T("(objectClass=*)"));
  m_cAttrList.SetWindowText(_T("cn"));

  OnChangeFilter();
  OnEnabled();

  m_cCacheResult.SetCheck( 1 );

  return TRUE;  // return TRUE unless you set the focus to a control
                // EXCEPTION: OCX Property Pages should return FALSE
}

void CDlgIDirectorySearch::OnOK ( ) [protected, virtual]

Definition at line 590 of file DirectorySearch.cpp.

{
  CDialog::OnOK();
}

Member Data Documentation

BOOL CDlgIDirectorySearch::m_bAsynch

Definition at line 38 of file DirectorySearch.h.

BOOL CDlgIDirectorySearch::m_bAttrib

Definition at line 39 of file DirectorySearch.h.

BOOL CDlgIDirectorySearch::m_bCacheResult

Definition at line 33 of file DirectorySearch.h.

BOOL CDlgIDirectorySearch::m_bEnableFilter

Definition at line 31 of file DirectorySearch.h.

CComboBox CDlgIDirectorySearch::m_CADsSearchScope

Definition at line 26 of file DirectorySearch.h.

CEdit CDlgIDirectorySearch::m_cAttrList

Definition at line 22 of file DirectorySearch.h.

CButton CDlgIDirectorySearch::m_cCacheResult

Definition at line 25 of file DirectorySearch.h.

CComboBox CDlgIDirectorySearch::m_cChaseReferrals

Definition at line 24 of file DirectorySearch.h.

CButton CDlgIDirectorySearch::m_cEnableFilter

Definition at line 27 of file DirectorySearch.h.

CButton CDlgIDirectorySearch::m_cExecute

Definition at line 28 of file DirectorySearch.h.

CEdit CDlgIDirectorySearch::m_cFilter

Definition at line 29 of file DirectorySearch.h.

CListCtrl CDlgIDirectorySearch::m_cListView

Definition at line 23 of file DirectorySearch.h.

int CDlgIDirectorySearch::m_nDeref

Definition at line 40 of file DirectorySearch.h.

UINT CDlgIDirectorySearch::m_nPageSize

Definition at line 34 of file DirectorySearch.h.

UINT CDlgIDirectorySearch::m_nSizeLimit

Definition at line 37 of file DirectorySearch.h.

UINT CDlgIDirectorySearch::m_nTimeLimit

Definition at line 36 of file DirectorySearch.h.

UINT CDlgIDirectorySearch::m_nTimeOut

Definition at line 32 of file DirectorySearch.h.

IDirectorySearch* CDlgIDirectorySearch::m_pSearch [protected]

Definition at line 53 of file DirectorySearch.h.

CString CDlgIDirectorySearch::m_sFilter

Definition at line 30 of file DirectorySearch.h.

CString CDlgIDirectorySearch::m_sSortOn

Definition at line 35 of file DirectorySearch.h.

The documentation for this class was generated from the following files:
  • NetDS/ADSI/samples/General/ADQI/DirectorySearch.h
  • NetDS/ADSI/samples/General/ADQI/DirectorySearch.cpp
Generated on Wed Nov 13 2024 16:56:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDlgSrc Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions

CDlgSrc Class Reference

#include "dlgsrc.h"

List of all members.

Public Types

enum | { IDD = IDD_SRC }

Public Member Functions

CDlgSrc (CWnd *)
~CDlgSrc (void)
BOOL | AquireData (WAVEFORMATEX *, PVOID, ULONG, UINT)
void | Create (LPCSTR, SIZE, DWORD)
void | SetChannelNum (UINT)
virtual LRESULT | WindowProc (UINT, WPARAM, LPARAM)

Public Attributes

CButton | m_butClose
CButton | m_butPlay
CButton | m_butStop
ULONG m_cbData
CStatic | m_cInput
CComboBox | m_comboSpeaker
ULONG m_cSamples
DWORD m_dwChannelMask
BOOL m_fDragging
BOOL m_fPlayable
BOOL m_fUse
LPWAVEHDR | m_lpwhdr
UINT m_nChannel
int | m_nSpeaker
CPoint m_ptPosInCaption
PVOID m_pvData
CWnd * | m_pwndParent
CString m_strName
WAVEFORMATEX | m_wfx

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
virtual void | OnCancel ()
afx_msg void | OnComboSpeaker ()
afx_msg HBRUSH | OnCtlColor (CDC *, CWnd *, UINT)
virtual BOOL | OnInitDialog ()
afx_msg void | OnLButtonDown (UINT, CPoint)
afx_msg void | OnLButtonUp (UINT, CPoint)
afx_msg void | OnMouseMove (UINT, CPoint)
virtual void | OnOK ()
afx_msg void | OnPlay ()
afx_msg void | OnStop ()

Detailed Description

Definition at line 23 of file dlgsrc.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 62 of file dlgsrc.h.

{ IDD = IDD_SRC };  //  Identifier

Constructor & Destructor Documentation

CDlgSrc::CDlgSrc ( CWnd * pParent )

Definition at line 104 of file dlgsrc.cpp.

  : CDialog(CDlgSrc::IDD, pParent),
    m_strName(TEXT("")),
    m_pwndParent(pParent),
    m_cSamples(0),
    m_cbData(0),
    m_nChannel(0),
    m_dwChannelMask(SPEAKER_FRONT_LEFT),
    m_fDragging(FALSE),
    m_fPlayable( FALSE ),
    m_lpwhdr( 0 )
{
  //{{AFX_DATA_INIT(CDlgSrc)
  m_fUse = TRUE;
  m_nSpeaker = 0;
  m_strName = _T("");
  //}}AFX_DATA_INIT

    ZeroMemory( &m_wfx, sizeof( WAVEFORMATEX ) );
}

CDlgSrc::~CDlgSrc ( void )

Definition at line 132 of file dlgsrc.cpp.

{
  //
  //  update speaker mask
  //
  if( g_pdlgDest )
    g_pdlgDest->m_wfExt.dwChannelMask ^= m_dwChannelMask;

  //
  //  release memory
  //
  SafeLocalFree( m_pvData );
  SafeLocalFree( m_lpwhdr );
}

Member Function Documentation

BOOL CDlgSrc::AquireData | ( | WAVEFORMATEX * | pwfx,
 |  | PVOID | pvData,
 |  | ULONG | cbData,
 |  | UINT | nChannelFrom
 | ) |  |

Definition at line 219 of file dlgsrc.cpp.

{
    ASSERT( pwfx );

    if (! (pwfx && (pwfx->cbSize == 0) && pvData && cbData))
        return FALSE;

    CopyMemory(&m_wfx, pwfx, sizeof(m_wfx));

  GUID  guid = (( WAVEFORMATEXTENSIBLE * )pwfx)->SubFormat;

  if( IS_VALID_WAVEFORMATEX_GUID( &guid ) )
  {
    m_wfx.wFormatTag = EXTRACT_WAVEFORMATEX_ID( &guid );
  }
  //
  //  else no op
  //
    m_wfx.nChannels = 1;
    m_wfx.nBlockAlign = m_wfx.wBitsPerSample / 8;
    m_wfx.nAvgBytesPerSec = m_wfx.nBlockAlign * m_wfx.nSamplesPerSec;

    // a little more UI
    char sz[100];
    _snprintf(sz, 100, "%d", pwfx->wBitsPerSample);
    SetDlgItemText(IDC_BITDEPTH, sz);
    _snprintf(sz, 100, "%d", pwfx->nSamplesPerSec);
    SetDlgItemText(IDC_SAMPLERATE, sz);

    //
    // extract nChannelFrom-th channel from the data
    // should be pretty much a no-op for already-mono formats
    //
    ULONG   nSample;
  USHORT  nBytes = pwfx->wBitsPerSample / 8;

    m_cSamples = cbData / pwfx->nBlockAlign;
    m_cbData = m_wfx.nBlockAlign * m_cSamples;
    m_pvData = LocalAlloc(LPTR, m_cbData);
    if( 0 == m_pvData)
  {
    MessageBox( "Insufficient memory to complete the task.", "MultiChan : Error", MB_OK | MB_ICONSTOP );
    return( FALSE );
  }

  //
  //  Adding support for multi-channel input
  //
  if( 1 == pwfx->nChannels )
  {
    //
    //  trivial copy
    //
        ASSERT(m_cbData == cbData);
    CopyMemory( m_pvData, pvData, m_cbData );
  }
  else
  {
    //
    //  m channels, n bit depth
    //  extract out every other m-th group of n bits
    //  repeat for m_cSamples
    //
    BYTE * pbDest = (BYTE * )m_pvData;
    BYTE * pbSrc = ( BYTE * )pvData;

    //
    //  start with the appropriate channel; channels are 0-based
    //
    pbSrc+= nChannelFrom * ( pwfx->wBitsPerSample / 8 );

    for( nSample = 0; nSample < m_cSamples; nSample++ )
    {
      USHORT  nCount = nBytes;
      while( nCount-- )
        *pbDest++ = *pbSrc++;

      pbSrc+= (pwfx->nChannels - 1) * nBytes;
    }
  }

  return( TRUE );
}   //  CDglSrc::AcquireData

void CDlgSrc::Create | ( | LPCSTR | strName,
 |  | SIZE | sizeInitPos,
 |  | DWORD | dwChannelMask
 | ) |  |

Definition at line 154 of file dlgsrc.cpp.

{
    CDialog::Create( CDlgSrc::IDD, m_pwndParent );

    //
    //  position the dialog for that nice cascade effect
    //
    CRect rect;

    GetClientRect( &rect );

    rect.OffsetRect( *(LPPOINT(&sizeInitPos)) );
    rect.right += 4;
    rect.bottom += 4;
    MoveWindow( &rect, TRUE );

    //
    //  set window text
    //
    m_strName = strName;

    //
    //  populate the speakers combo
    //  speaker positions are defined in KSMedia.h or in MMReg.h
    //
    int i;
    int c;
    for( c = 0; c < ARRAY_ELEMENTS( cdrSpeakers ); c++ )
    {
        i = m_comboSpeaker.AddString( cdrSpeakers[c].pstrRep );         //  friendly name
        m_comboSpeaker.SetItemData( i, cdrSpeakers[c].dwConstant );     //  index
        if( cdrSpeakers[c].dwConstant == dwChannelMask )                //  check out of range
            m_nSpeaker = c;
    }

    m_dwChannelMask = dwChannelMask;                                    //  overall channel mask

    //
    //  make playable
    //
    m_fPlayable = TRUE;
  m_butPlay.EnableWindow( m_fPlayable );
  m_butStop.EnableWindow( !m_fPlayable );

    //
    // update controls
    //
    UpdateData( FALSE );
}   //  CDglSrc::Create

void CDlgSrc::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 63 of file dlgsrc.cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CDlgSrc)
  DDX_Control(pDX, IDOK, m_butClose);
    DDX_Control( pDX, IDC_PLAY, m_butPlay );
    DDX_Control( pDX, IDC_STOP, m_butStop );
  DDX_Control(pDX, IDC_INPUT, m_cInput);
  DDX_Control(pDX, IDC_COMBO_SPEAKER, m_comboSpeaker);
  DDX_Check(pDX, IDC_USE, m_fUse);
  DDX_CBIndex(pDX, IDC_COMBO_SPEAKER, m_nSpeaker);
  DDX_Text(pDX, IDC_INPUT, m_strName);
  //}}AFX_DATA_MAP
}

void CDlgSrc::OnCancel ( ) [inline, protected, virtual]

Definition at line 446 of file dlgsrc.cpp.

{
    POSITION pos = g_listSources.Find(this, NULL);
    g_listSources.RemoveAt(pos);
    g_pChildView->UpdateDialogs();
    delete this;
}   //  CDglSrc::OnCancel

void CDlgSrc::OnComboSpeaker ( ) [protected]

Definition at line 316 of file dlgsrc.cpp.

{
    //
    //  prepare
    //
    int     nSpeaker = m_nSpeaker;

    UpdateData(TRUE);

    //
    //  make selection
    //
    m_dwChannelMask = ( DWORD )m_comboSpeaker.GetItemData(m_nSpeaker);

    //
    //  validate selection
    //
    if(! ((CChildView*)m_pwndParent)->UpdateDialogs())
    {
        MessageBox("There is already a channel with that speaker config", "MultiChan : Error!", MB_ICONSTOP | MB_OK);
        m_nSpeaker = nSpeaker;
        UpdateData( FALSE );
    }
}

HBRUSH CDlgSrc::OnCtlColor | ( | CDC * | pDC,
 |  | CWnd * | pWnd,
 |  | UINT | nCtlColor |
 | ) |  |  | [protected]

Definition at line 459 of file dlgsrc.cpp.

{
  HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);

    if((nCtlColor == CTLCOLOR_STATIC))
    {
        if(pWnd->m_hWnd == m_cInput.m_hWnd)
        {
            pDC->SetTextColor(GetSysColor(COLOR_CAPTIONTEXT));
            pDC->SetBkMode(TRANSPARENT);  //BkColor(GetSysColor(COLOR_ACTIVECAPTION));
            return GetSysColorBrush(COLOR_ACTIVECAPTION);
        }
    }

  return hbr;
}   //  CDglSrc::OnCtlColor

BOOL CDlgSrc::OnInitDialog ( ) [protected, virtual]

Definition at line 568 of file dlgsrc.cpp.

{
  CDialog::OnInitDialog();

    HICON hIcon = LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_CHECK));
    m_butClose.SetIcon(hIcon);
  return TRUE;  // return TRUE unless you set the focus to a control
                // EXCEPTION: OCX Property Pages should return FALSE
}   //  CDlgSrc::OnInitDialog

void CDlgSrc::OnLButtonDown | ( | UINT | nFlags,
 |  | CPoint | point |
 | ) |  |  | [protected]

Definition at line 485 of file dlgsrc.cpp.

{
  RECT    rcClient;

    m_cInput.GetClientRect(&rcClient);
    m_cInput.MapWindowPoints(this, &rcClient);
    m_fDragging = PtInRect(&rcClient, point);

    if(m_fDragging)
    {
        SetCapture();
        m_fDragging = TRUE;
        m_ptPosInCaption = point;
    }

    CDialog::OnLButtonDown(nFlags, point);

    SetFocus();
    SetWindowPos(&wndTop, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE);
}   //  CDglSrc::OnLButtonDown

void CDlgSrc::OnLButtonUp | ( | UINT | nFlags,
 |  | CPoint | point |
 | ) |  |  | [protected]

Definition at line 514 of file dlgsrc.cpp.

{
  m_fDragging = FALSE;
    ReleaseCapture();

  CDialog::OnLButtonUp(nFlags, point);
}   //  CDglSrc::OnLButtonUp

void CDlgSrc::OnMouseMove | ( | UINT | nFlags,
 |  | CPoint | point |
 | ) |  |  | [protected]

Definition at line 530 of file dlgsrc.cpp.

{
  RECT    rcClientParent;

    GetParent()->GetClientRect(&rcClientParent);
    GetParent()->MapWindowPoints(this, &rcClientParent);
    if(PtInRect(&rcClientParent, point))
    {
        if(m_fDragging)
        {
            CRect   rcWindow;
            CRect   rcParent;
            CPoint  pt(point.x - m_ptPosInCaption.x, point.y - m_ptPosInCaption.y);

            GetWindowRect(&rcWindow);
            GetParent()->GetWindowRect(&rcParent);

            rcWindow.OffsetRect(pt);
            rcWindow -= rcParent.TopLeft();

            SetWindowPos(NULL, rcWindow.left, rcWindow.top, 0,0, SWP_NOZORDER | SWP_NOSIZE);
        }
    }
    else
    {
        ReleaseCapture();
        m_fDragging = FALSE;
    }
}   //  CDglSrc::OnMouseMove

void CDlgSrc::OnOK ( ) [inline, protected, virtual]

Definition at line 432 of file dlgsrc.cpp.

{
    POSITION pos = g_listSources.Find(this, NULL);
    g_listSources.RemoveAt(pos);
    g_pChildView->UpdateDialogs();
    delete this;
}   //  CDglSrc::OnOK

void CDlgSrc::OnPlay ( ) [protected]

Definition at line 345 of file dlgsrc.cpp.

{
  MMRESULT  mmRes = MMSYSERR_NOERROR;

    //
    //  ensure validity
    //
  ASSERT( 0 == g_hwo );
    ASSERT( m_fPlayable );

    //
    //  first usage ?
    //
    if( 0 == m_lpwhdr )
    {
        m_lpwhdr = ( LPWAVEHDR )LocalAlloc( LPTR, sizeof( WAVEHDR ) );
        if( 0 == m_lpwhdr )
        {
            MessageBox( "Insufficient memory for rendering !", "MultiChan : Error", MB_ICONEXCLAMATION | MB_OK );
            return;
        }
    }

    m_lpwhdr->dwBufferLength = m_cbData;
    m_lpwhdr->lpData = (char*)m_pvData;

    //
    //  using a callback mechanism to allow synch playback
    //
    mmRes = waveOutOpen(    &g_hwo,
                            WAVE_MAPPER,
                            &m_wfx,
                            ( DWORD_PTR )WavePlayFileCB,
                            ( DWORD_PTR )this,
                            CALLBACK_FUNCTION
                        );
  if( TrapMMError(mmRes, "waveOutOpen") )
  {
    mmRes = waveOutPrepareHeader( g_hwo, m_lpwhdr, sizeof(WAVEHDR) );
    if( TrapMMError(mmRes, "waveOutPrepareHeader") )
    {
            //
            //  revert playable state
      //  disable any other dialog
            //
      WaveTogglePlayback( this, WAVE_TOGGLE_DISABLE );

            //
            //  start singing
            //
      mmRes = waveOutWrite( g_hwo, m_lpwhdr, sizeof(WAVEHDR));
      TrapMMError(mmRes, "waveOutWrite");
        }   //  prepare header
    }       //  open
}           //  CDlgSrc::OnPlay

void CDlgSrc::OnStop ( ) [inline, protected]

Definition at line 408 of file dlgsrc.cpp.

{
    MMRESULT    mmRes = MMSYSERR_NOERROR;

    //
    //  ensure validity
    //
    ASSERT( g_hwo );
    ASSERT( !m_fPlayable );

    //
    //  stop playback
    //
    mmRes = waveOutReset( g_hwo );
    TrapMMError( mmRes, "waveOutReset" );

}   //  CDglSrc::OnStop

void CDlgSrc::SetChannelNum ( UINT nChannel ) [inline]

Definition at line 116 of file dlgsrc.h.

{
    char sz[10];
    m_nChannel = nChannel;
    _snprintf(sz, 10, "%d", nChannel);
    SetDlgItemText( IDC_CHANNELNUM, sz );
}   //  CDglSrc::SetChannelNum

LRESULT CDlgSrc::WindowProc | ( | UINT | nMessage,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [virtual]

Definition at line 584 of file dlgsrc.cpp.

{
    MMRESULT    mmRes = MMSYSERR_NOERROR;

    switch( nMessage )
    {
    case    WM_START_PLAYBACK:
        {
            break;
        }
    case    WM_STOP_PLAYBACK:
        {
            //
            //  revert playable state
            //
            WaveTogglePlayback( this, WAVE_TOGGLE_ALLOW );

            //
            //  unprepare and release
            //
            mmRes = waveOutUnprepareHeader( g_hwo, m_lpwhdr, sizeof( WAVEHDR ) );
            if( TrapMMError( mmRes, "waveOutUnprepareHeader" ) )
            {
                mmRes = waveOutClose( g_hwo );
                TrapMMError( mmRes, "waveOutClose" );

                g_hwo = 0;
            }
            break;
        }
    }
    return( CDialog::WindowProc( nMessage, wParam, lParam ) );
}

Member Data Documentation

CButton CDlgSrc::m_butClose

Definition at line 63 of file dlgsrc.h.

CButton CDlgSrc::m_butPlay

Definition at line 64 of file dlgsrc.h.

CButton CDlgSrc::m_butStop

Definition at line 65 of file dlgsrc.h.

ULONG CDlgSrc::m_cbData

Definition at line 40 of file dlgsrc.h.

CStatic CDlgSrc::m_cInput

Definition at line 66 of file dlgsrc.h.

CComboBox CDlgSrc::m_comboSpeaker

Definition at line 67 of file dlgsrc.h.

ULONG CDlgSrc::m_cSamples

Definition at line 41 of file dlgsrc.h.

DWORD CDlgSrc::m_dwChannelMask

Definition at line 42 of file dlgsrc.h.

BOOL CDlgSrc::m_fDragging

Definition at line 45 of file dlgsrc.h.

BOOL CDlgSrc::m_fPlayable

Definition at line 46 of file dlgsrc.h.

BOOL CDlgSrc::m_fUse

Definition at line 68 of file dlgsrc.h.

LPWAVEHDR CDlgSrc::m_lpwhdr

Definition at line 38 of file dlgsrc.h.

UINT CDlgSrc::m_nChannel

Definition at line 44 of file dlgsrc.h.

int CDlgSrc::m_nSpeaker

Definition at line 69 of file dlgsrc.h.

CPoint CDlgSrc::m_ptPosInCaption

Definition at line 47 of file dlgsrc.h.

PVOID CDlgSrc::m_pvData

Definition at line 39 of file dlgsrc.h.

CWnd* CDlgSrc::m_pwndParent

Definition at line 37 of file dlgsrc.h.

CString CDlgSrc::m_strName

Definition at line 70 of file dlgsrc.h.

WAVEFORMATEX CDlgSrc::m_wfx

Definition at line 43 of file dlgsrc.h.

The documentation for this class was generated from the following files:
  • Multimedia/Audio/multichan/dlgsrc.h
  • Multimedia/Audio/multichan/dlgsrc.cpp
Generated on Wed Nov 13 2024 16:56:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDllData Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

CDllData Class Reference

#include "ComObjI.h"

List of all members.

Public Attributes

HINSTANCE | hDllInst
int | iUserCount
CMsgBox * | pMsgBox

Detailed Description

Definition at line 54 of file ComObjI.h.

Member Data Documentation

HINSTANCE CDllData::hDllInst

Definition at line 58 of file ComObjI.h.

int CDllData::iUserCount

Definition at line 57 of file DllSkelI.h.

CMsgBox * CDllData::pMsgBox

Definition at line 61 of file ComObjI.h.

The documentation for this class was generated from the following files:
  • Com/Fundamentals/TutSamp/ComObj/ComObjI.h
  • Com/Fundamentals/TutSamp/DllSkel/DllSkelI.h
Generated on Wed Nov 13 2024 16:56:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDllShared Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

CDllShared Class Reference

#include "DllSkelI.h"

List of all members.

Public Attributes

int | iHelloCount
int | iUserCount

Detailed Description

Definition at line 71 of file DllSkelI.h.

Member Data Documentation

int CDllShared::iHelloCount

Definition at line 76 of file DllSkelI.h.

int CDllShared::iUserCount

Definition at line 79 of file DllSkelI.h.

The documentation for this class was generated from the following file:
  • Com/Fundamentals/TutSamp/DllSkel/DllSkelI.h
Generated on Wed Nov 13 2024 16:56:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDog Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CDog Class Reference

#include "cDog.h"

List of all members.

Public Member Functions

CDog ()
~CDog ()
STDMETHOD() | Bark ()
STDMETHOD() | QueryInterface (REFIID riid, LPVOID FAR *ppvObj)
STDMETHOD() | Scratch ()
STDMETHOD_ (ULONG, Release)(void)
STDMETHOD_ (ULONG, AddRef)(void)

Private Attributes

LONG | m_cRef

Detailed Description

Definition at line 20 of file cDog.h.

Constructor & Destructor Documentation

CDog::CDog ( ) [inline]

Definition at line 32 of file cDog.h.

{ m_cRef = 0; InterlockedIncrement(&g_cObjects); }

CDog::~CDog ( ) [inline]

Definition at line 33 of file cDog.h.

{ InterlockedDecrement(&g_cObjects); }

Member Function Documentation

STDMETHODIMP CDog::Bark ( )

Definition at line 59 of file iDog.Cpp.

{
  OutputDebugString("Bark!");
  return S_OK;
}

STDMETHOD() CDog::QueryInterface | ( | REFIID | riid,
 |  | LPVOID FAR * | ppvObj
 | ) |  |
STDMETHODIMP CDog::Scratch ( )

Definition at line 65 of file iDog.Cpp.

{
  OutputDebugString("Scratch, scratch...");
  return S_OK;
}

CDog::STDMETHOD_ | ( | ULONG | ,
 |  | Release |
 | ) |  |
CDog::STDMETHOD_ | ( | ULONG | ,
 |  | AddRef |
 | ) |  |

Member Data Documentation

LONG CDog::m_cRef [private]

Definition at line 35 of file cDog.h.

The documentation for this class was generated from the following files:
  • Com/Fundamentals/CustomSurrogate/Dog/cDog.h
  • Com/Fundamentals/CustomSurrogate/Dog/iDog.Cpp
Generated on Wed Nov 13 2024 16:56:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDownloadBindStatusCallback Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CDownloadBindStatusCallback Class Reference

#include "setupui.h"

List of all members.

Public Member Functions

CDownloadBindStatusCallback (CDownloadUI *piDownloadUI)
~CDownloadBindStatusCallback ()
unsigned long __stdcall | AddRef ()
HRESULT __stdcall | GetBindInfo (DWORD *, BINDINFO *)
HRESULT __stdcall | GetPriority (LONG *)
HRESULT __stdcall | OnDataAvailable (DWORD, DWORD, FORMATETC *, STGMEDIUM *)
HRESULT __stdcall | OnLowResource (DWORD)
HRESULT __stdcall | OnObjectAvailable (REFIID, IUnknown *)
HRESULT __stdcall | OnProgress (ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
HRESULT __stdcall | OnStartBinding (DWORD, IBinding *)
HRESULT __stdcall | OnStopBinding (HRESULT, LPCWSTR)
HRESULT __stdcall | QueryInterface (const IID &riid, void **ppvObj)
unsigned long __stdcall | Release ()

Private Attributes

int | m_iRefCnt
CDownloadUI * m_pDownloadUI
ULONG m_ulProgressSoFar

Detailed Description

Definition at line 74 of file setupui.h.

Constructor & Destructor Documentation

CDownloadBindStatusCallback::CDownloadBindStatusCallback ( CDownloadUI * piDownloadUI )

Definition at line 316 of file setupui.cpp.

                                                                                : m_pDownloadUI(pDownloadUI), m_iRefCnt(1), m_ulProgressSoFar(0)
{
}

CDownloadBindStatusCallback::~CDownloadBindStatusCallback ( )

Definition at line 324 of file setupui.cpp.

{
}

Member Function Documentation

unsigned long CDownloadBindStatusCallback::AddRef ( void )

Definition at line 351 of file setupui.cpp.

{
    return ++m_iRefCnt;
}

HRESULT __stdcall CDownloadBindStatusCallback::GetBindInfo | ( | DWORD * | ,
 |  | BINDINFO * |  |
 | ) |  |  | [inline]

Definition at line 89 of file setupui.h.

{return S_OK;}

HRESULT __stdcall CDownloadBindStatusCallback::GetPriority ( LONG * ) [inline]

Definition at line 85 of file setupui.h.

{return S_OK;}

HRESULT __stdcall CDownloadBindStatusCallback::OnDataAvailable | ( | DWORD | ,
 |  | DWORD | ,
 |  | FORMATETC * | ,
 |  | STGMEDIUM * |  |
 | ) |  |  | [inline]

Definition at line 90 of file setupui.h.

{return S_OK;}

HRESULT __stdcall CDownloadBindStatusCallback::OnLowResource ( DWORD ) [inline]

Definition at line 86 of file setupui.h.

{return S_OK;}

HRESULT __stdcall CDownloadBindStatusCallback::OnObjectAvailable | ( | REFIID | ,
 |  | IUnknown * |  |
 | ) |  |  | [inline]

Definition at line 91 of file setupui.h.

{return S_OK;}

HRESULT CDownloadBindStatusCallback::OnProgress | ( | ULONG | ulProgress,
 |  | ULONG | ulProgressMax,
 |  | ULONG | ulStatusCode,
 |  | LPCWSTR | szStatusText
 | ) |  |

Definition at line 372 of file setupui.cpp.

{
    switch (ulStatusCode)
    {
    case BINDSTATUS_BEGINDOWNLOADDATA:
        {
            // initialize progress bar with max # of ticks
            m_pDownloadUI->InitProgressBar(ulProgressMax);

            // init progress so far
            m_ulProgressSoFar = 0;

            // check for cancel
            if (m_pDownloadUI->HasUserCanceled())
                return E_ABORT;

            // fall through
        }
    case BINDSTATUS_DOWNLOADINGDATA:
        {
            // calculate how far we have moved since the last time
            ULONG ulProgIncrement = ulProgress - m_ulProgressSoFar;

            // set progress so far to current value
            m_ulProgressSoFar = ulProgress;

            // send progress message (if we have progressed)
            if (ulProgIncrement > 0)
                m_pDownloadUI->IncrementProgressBar(ulProgIncrement);

            // check for cancel
            if(m_pDownloadUI->HasUserCanceled())
                return E_ABORT;

            break;
        }
    case BINDSTATUS_ENDDOWNLOADDATA:
        {
            // send any remaining progress to complete download portion of progress bar
            ULONG ulProgIncrement = ulProgressMax - m_ulProgressSoFar;
            if (ulProgIncrement > 0)
                m_pDownloadUI->IncrementProgressBar(ulProgIncrement);

            // check for cancel
            if(m_pDownloadUI->HasUserCanceled())
                return E_ABORT;

            break;
        }
    }

    return S_OK;
}

HRESULT __stdcall CDownloadBindStatusCallback::OnStartBinding | ( | DWORD | ,
 |  | IBinding * |  |
 | ) |  |  | [inline]

Definition at line 84 of file setupui.h.

{return S_OK;}

HRESULT __stdcall CDownloadBindStatusCallback::OnStopBinding | ( | HRESULT | ,
 |  | LPCWSTR |  |
 | ) |  |  | [inline]

Definition at line 88 of file setupui.h.

{return S_OK;}

HRESULT CDownloadBindStatusCallback::QueryInterface | ( | const IID & | riid,
 |  | void ** | ppvObj
 | ) |  |

Definition at line 332 of file setupui.cpp.

{
    if (!ppvObj)
        return E_INVALIDARG;

    if (riid == IID_IUnknown || riid == IID_IDownloadBindStatusCallback)
    {
        *ppvObj = this;
        AddRef();
        return NOERROR;
    }
    *ppvObj = 0;
    return E_NOINTERFACE;
}

unsigned long CDownloadBindStatusCallback::Release ( void )

Definition at line 360 of file setupui.cpp.

{
    if (--m_iRefCnt != 0)
        return m_iRefCnt;
    delete this;
    return 0;
}

Member Data Documentation

int CDownloadBindStatusCallback::m_iRefCnt [private]

Definition at line 94 of file setupui.h.

CDownloadUI* CDownloadBindStatusCallback::m_pDownloadUI [private]

Definition at line 93 of file setupui.h.

ULONG CDownloadBindStatusCallback::m_ulProgressSoFar [private]

Definition at line 95 of file setupui.h.

The documentation for this class was generated from the following files:
  • SysMgmt/Msi/setup.exe/setupui.h
  • SysMgmt/Msi/setup.exe/setupui.cpp
Generated on Wed Nov 13 2024 16:56:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDownloadUI Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CDownloadUI Class Reference

#include "setupui.h"

List of all members.

Public Member Functions

CDownloadUI ()
~CDownloadUI ()
HWND | GetCurrentWindow ()
bool | HasUserCanceled ()
void | IncrementProgressBar (ULONG ulProgress)
bool | Initialize (HINSTANCE hInst, HWND hwndParent, LPCSTR szCaption)
void | InitProgressBar (ULONG ulProgressMax)
irmProgress | SetActionText (LPCSTR szAction)
irmProgress | SetBannerText (LPCSTR szBanner)
void | SetUserCancel ()
bool | Terminate ()

Private Attributes

bool | m_fInitialized
bool | m_fUserCancel
HINSTANCE | m_hInst
HWND | m_hwndParent
HWND | m_hwndProgress
char | m_szCaption [MAX_STR_CAPTION]
ULONG m_ulProgressMax
ULONG m_ulProgressSoFar

Detailed Description

Definition at line 39 of file setupui.h.

Constructor & Destructor Documentation

CDownloadUI::CDownloadUI ( )

Definition at line 27 of file setupui.cpp.

                         : m_hwndProgress(0), m_hwndParent(0), m_hInst(0),
                            m_fInitialized(false), m_fUserCancel(false),
                            m_ulProgressMax(0), m_ulProgressSoFar(0)
{
    lstrcpy(m_szCaption, "");
}

CDownloadUI::~CDownloadUI ( )

Definition at line 38 of file setupui.cpp.

{
}

Member Function Documentation

HWND CDownloadUI::GetCurrentWindow ( )

Definition at line 201 of file setupui.cpp.

{
    return (m_hwndProgress) ? m_hwndProgress : m_hwndParent;
}

bool CDownloadUI::HasUserCanceled ( )

Definition at line 219 of file setupui.cpp.

{
    return (m_fUserCancel);
}

void CDownloadUI::IncrementProgressBar ( ULONG ulProgress )

Definition at line 291 of file setupui.cpp.

{
    // increment progress bar

    HWND hwndProgBar = WIN::GetDlgItem(m_hwndProgress, IDC_DOWNLOAD_PROGRESSBAR);
    WIN::SendMessage(hwndProgBar, PBM_DELTAPOS, /* WPARAM = */ (WPARAM) (ulProgress), /* LPARAM = */ 0);

    m_ulProgressSoFar += ulProgress;

    // message pump
    MSG msg;
    while (WIN::PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
    {
        if (!WIN::IsDialogMessage(m_hwndProgress, &msg))
        {
            WIN::TranslateMessage(&msg);
            WIN::DispatchMessage(&msg);
        }
    }
}

bool CDownloadUI::Initialize | ( | HINSTANCE | hInst,
 |  | HWND | hwndParent,
 |  | LPCSTR | szCaption
 | ) |  |

Definition at line 104 of file setupui.cpp.

{
    INITCOMMONCONTROLSEX iccData = {sizeof(INITCOMMONCONTROLSEX), ICC_PROGRESS_CLASS};
    COMCTL32::InitCommonControlsEx(&iccData);

    char szText[MAX_STR_CAPTION] = {0};

    // set member variables
    m_hwndParent = hwndParent;
    m_hInst = hInst;

    if (MAX_STR_CAPTION < lstrlen(szCaption))
    {
        lstrcpyn(m_szCaption, szCaption, MAX_STR_CAPTION);
    }
    else
    {
        lstrcpy(m_szCaption, szCaption);
    }

    if (!m_hwndProgress)
    {
        // create Progress Dialog
        m_hwndProgress = WIN::CreateDialogParam(m_hInst, MAKEINTRESOURCE(IDD_PROGRESS), m_hwndParent, ProgressProc, (LPARAM)this);
        if (!m_hwndProgress)
            return false;

        // set window caption
        WIN::SetWindowText(m_hwndProgress, m_szCaption);

        // center dialog on screen
        int iDialogLeft, iDialogTop, iDialogWidth, iDialogHeight;
        ::GetScreenCenterCoord(m_hwndProgress, iDialogLeft, iDialogTop, iDialogWidth, iDialogHeight);
        WIN::MoveWindow(m_hwndProgress, iDialogLeft, iDialogTop, iDialogWidth, iDialogHeight, TRUE);

        // set CANCEL button text
        WIN::LoadString(m_hInst, IDS_CANCEL, szText, MAX_STR_CAPTION);
        WIN::SetDlgItemText(m_hwndProgress, IDC_DOWNLOAD_CANCEL, szText);

        // set to foreground and make visible all controls
        WIN::SetFocus(WIN::GetDlgItem(m_hwndProgress, IDC_DOWNLOAD_PROGRESSBAR));
        WIN::ShowWindow(WIN::GetDlgItem(m_hwndProgress, IDC_DOWNLOAD_CANCEL), SW_SHOW);
        WIN::SetForegroundWindow(m_hwndProgress);
        WIN::ShowWindow(WIN::GetDlgItem(m_hwndProgress, IDC_DOWNLOAD_PROGRESSBAR), SW_SHOW);

        // set icon
        HICON hIcon = (HICON) WIN::LoadIcon(m_hInst, MAKEINTRESOURCE(IDI_INSTALLER));
        if (hIcon)
            WIN::SendMessage(m_hwndProgress, WM_SETICON, ICON_BIG, (LPARAM)hIcon);

        // make window visible
        WIN::ShowWindow(m_hwndProgress, SW_SHOW);
    }

    // message pump
    MSG msg;
    while (WIN::PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
    {
        if (!WIN::IsDialogMessage(m_hwndProgress, &msg))
        {
            WIN::TranslateMessage(&msg);
            WIN::DispatchMessage(&msg);
        }
    }

    m_fInitialized = true;

    return true;
}

void CDownloadUI::InitProgressBar ( ULONG ulProgressMax )

Definition at line 262 of file setupui.cpp.

{
    // init progress bar values
    m_ulProgressMax         = ulProgressMax;
    m_ulProgressSoFar       = 0;

    // set range on progress bar of [0, ulProgressMax]
    HWND hwndProgBar = WIN::GetDlgItem(m_hwndProgress, IDC_DOWNLOAD_PROGRESSBAR);
    WIN::SendMessage(hwndProgBar, PBM_SETRANGE32, /* WPARAM = */ 0, /* LPARAM = */ m_ulProgressMax);

    // initialize the position of the progress bar -- forward direction, so set at 0
    WIN::SendMessage(hwndProgBar, PBM_SETPOS, /* WPARAM = */ (WPARAM)0, /* LPARAM = */ 0);

    // message pump
    MSG msg;
    while (WIN::PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
    {
        if (!WIN::IsDialogMessage(m_hwndProgress, &msg))
        {
            WIN::TranslateMessage(&msg);
            WIN::DispatchMessage(&msg);
        }
    }
}

irmProgress CDownloadUI::SetActionText ( LPCSTR szAction )

Definition at line 245 of file setupui.cpp.

{
    if (!m_fInitialized)
        return irmNotInitialized;

    if (m_fUserCancel)
        return irmCancel;

    WIN::SetDlgItemText(m_hwndProgress, IDC_DOWNLOAD_ACTIONTEXT, szAction);

    return irmOK;
}

irmProgress CDownloadUI::SetBannerText ( LPCSTR szBanner )

Definition at line 228 of file setupui.cpp.

{
    if (!m_fInitialized)
        return irmNotInitialized;

    if (m_fUserCancel)
        return irmCancel;

    WIN::SetDlgItemText(m_hwndProgress, IDC_DOWNLOAD_BANNER, szBanner);

    return irmOK;
}

void CDownloadUI::SetUserCancel ( )

Definition at line 210 of file setupui.cpp.

{
    m_fUserCancel = true;
}

bool CDownloadUI::Terminate ( )

Definition at line 178 of file setupui.cpp.

{
    if (m_hwndProgress)
    {
        // destroy the progress window
        WIN::DestroyWindow(m_hwndProgress);
        m_hwndProgress = 0;
    }

    m_hInst                 = 0;
    m_hwndParent            = 0;
    m_fInitialized          = false;
    m_fUserCancel           = false;
    m_ulProgressMax         = 0;
    m_ulProgressSoFar       = 0;

    return true;
}

Member Data Documentation

bool CDownloadUI::m_fInitialized [private]

Definition at line 62 of file setupui.h.

bool CDownloadUI::m_fUserCancel [private]

Definition at line 63 of file setupui.h.

HINSTANCE CDownloadUI::m_hInst [private]

Definition at line 57 of file setupui.h.

HWND CDownloadUI::m_hwndParent [private]

Definition at line 60 of file setupui.h.

HWND CDownloadUI::m_hwndProgress [private]

Definition at line 59 of file setupui.h.

char CDownloadUI::m_szCaption[MAX_STR_CAPTION] [private]

Definition at line 61 of file setupui.h.

ULONG CDownloadUI::m_ulProgressMax [private]

Definition at line 64 of file setupui.h.

ULONG CDownloadUI::m_ulProgressSoFar [private]

Definition at line 65 of file setupui.h.

The documentation for this class was generated from the following files:
  • SysMgmt/Msi/setup.exe/setupui.h
  • SysMgmt/Msi/setup.exe/setupui.cpp
Generated on Wed Nov 13 2024 16:56:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDragSource Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CDragSource Class Reference

#include "Dragsrc.h"

List of all members.

Public Member Functions

CDragSource ()
~CDragSource ()
STDMETHOD() | GiveFeedback (DWORD)
STDMETHOD() | QueryContinueDrag (BOOL, DWORD)
STDMETHOD() | QueryInterface (REFIID, LPVOID *)
STDMETHOD_ (ULONG, AddRef)(void)
STDMETHOD_ (ULONG, Release)(void)

Private Attributes

DWORD m_cRefCount

Detailed Description

Definition at line 32 of file Dragsrc.h.

Constructor & Destructor Documentation

CDragSource::CDragSource ( )

Definition at line 30 of file Dragsrc.Cpp.

{
m_cRefCount = 1;
}

CDragSource::~CDragSource ( )

Definition at line 41 of file Dragsrc.Cpp.

{
}

Member Function Documentation

STDMETHODIMP CDragSource::GiveFeedback ( DWORD dwEffect )

Definition at line 120 of file Dragsrc.Cpp.

{
return DRAGDROP_S_USEDEFAULTCURSORS;
}

STDMETHODIMP CDragSource::QueryContinueDrag | ( | BOOL | fEscapePressed,
 |  | DWORD | grfKeyState
 | ) |  |

Definition at line 131 of file Dragsrc.Cpp.

{
if(fEscapePressed)
   return DRAGDROP_S_CANCEL;

if(!(grfKeyState & MK_LBUTTON))
   return DRAGDROP_S_DROP;

return S_OK;
}

STDMETHODIMP CDragSource::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppvOut
 | ) |  |

Definition at line 56 of file Dragsrc.Cpp.

{
*ppvOut = NULL;

//IUnknown
if(IsEqualIID(riid, IID_IUnknown))
   {
   *ppvOut = this;
   }

//IDropSource
else if(IsEqualIID(riid, IID_IDropSource))
   {
   *ppvOut = (IDropSource*)this;
   }

if(*ppvOut)
   {
   (*(LPUNKNOWN*)ppvOut)->AddRef();
   return S_OK;
   }

return E_NOINTERFACE;
}

CDragSource::STDMETHOD_ | ( | ULONG | ,
 |  | Release |
 | ) |  |
CDragSource::STDMETHOD_ | ( | ULONG | ,
 |  | AddRef |
 | ) |  |

Member Data Documentation

DWORD CDragSource::m_cRefCount [private]

Definition at line 35 of file Dragsrc.h.

The documentation for this class was generated from the following files:
  • WinUI/Shell/DragImg/Dragsrc.h
  • WinUI/Shell/DragImg/Dragsrc.Cpp
Generated on Wed Nov 13 2024 16:56:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDrawArea Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Protected Attributes

CDrawArea Class Reference

#include "DrawArea.h"

List of all members.

Public Member Functions

CDrawArea ()
CDrawArea ()
CDrawArea ()
virtual | ~CDrawArea ()
virtual | ~CDrawArea ()
virtual | ~CDrawArea ()
void | AddKeystroke (char *mbsKey)
void | AddKeystroke (char *mbsKey)
void | AddKeystroke (char *mbsKey)
void | AddLine (LINE line)
void | AddLine (LINE line)
void | AddLine (LINE line)

Protected Member Functions

afx_msg HBRUSH | CtlColor (CDC *pDC, UINT nCtlColor)
afx_msg HBRUSH | CtlColor (CDC *pDC, UINT nCtlColor)
afx_msg HBRUSH | CtlColor (CDC *pDC, UINT nCtlColor)
afx_msg void | OnChar (UINT nChar, UINT nRepCnt, UINT nFlags)
afx_msg void | OnChar (UINT nChar, UINT nRepCnt, UINT nFlags)
afx_msg void | OnChar (UINT nChar, UINT nRepCnt, UINT nFlags)
afx_msg void | OnKeyDown (UINT nChar, UINT nRepCnt, UINT nFlags)
afx_msg void | OnKeyDown (UINT nChar, UINT nRepCnt, UINT nFlags)
afx_msg void | OnKeyDown (UINT nChar, UINT nRepCnt, UINT nFlags)
afx_msg void | OnLButtonDblClk (UINT nFlags, CPoint point)
afx_msg void | OnLButtonDblClk (UINT nFlags, CPoint point)
afx_msg void | OnLButtonDblClk (UINT nFlags, CPoint point)
afx_msg void | OnLButtonDown (UINT nFlags, CPoint point)
afx_msg void | OnLButtonDown (UINT nFlags, CPoint point)
afx_msg void | OnLButtonDown (UINT nFlags, CPoint point)
afx_msg void | OnMouseMove (UINT nFlags, CPoint point)
afx_msg void | OnMouseMove (UINT nFlags, CPoint point)
afx_msg void | OnMouseMove (UINT nFlags, CPoint point)
afx_msg void | OnPaint ()
afx_msg void | OnPaint ()
afx_msg void | OnPaint ()
afx_msg void | OnRButtonUp (UINT nFlags, CPoint point)
afx_msg void | OnRButtonUp (UINT nFlags, CPoint point)
afx_msg void | OnRButtonUp (UINT nFlags, CPoint point)
afx_msg BOOL | OnSetCursor (CWnd *pWnd, UINT nHitTest, UINT message)
afx_msg BOOL | OnSetCursor (CWnd *pWnd, UINT nHitTest, UINT message)
afx_msg BOOL | OnSetCursor (CWnd *pWnd, UINT nHitTest, UINT message)
afx_msg void | OnSetFocus (CWnd *pOldWnd)
afx_msg void | OnSetFocus (CWnd *pOldWnd)
afx_msg void | OnSetFocus (CWnd *pOldWnd)

Protected Attributes

CList< LINE, LINE & > m_listLines
CPoint m_ptLast

Detailed Description

Definition at line 27 of file DrawArea.h.

Constructor & Destructor Documentation

CDrawArea::CDrawArea ( )

Definition at line 31 of file DrawArea.Cpp.

{
}

CDrawArea::~CDrawArea ( ) [virtual]

Definition at line 35 of file DrawArea.Cpp.

{
}

CDrawArea::CDrawArea ( )
virtual CDrawArea::~CDrawArea ( ) [virtual]
CDrawArea::CDrawArea ( )
virtual CDrawArea::~CDrawArea ( ) [virtual]

Member Function Documentation

void CDrawArea::AddKeystroke ( char * mbsKey )

Definition at line 58 of file DrawArea.Cpp.

{
  //
  // The backspace keystroke should erase the preceding character.
  //
  if (mbsKey[0] == VK_BACK)
  {
    int nStart, nEnd;
    GetSel(nStart, nEnd);
    SetSel(nEnd-1, nEnd);
    mbsKey[0] = '\0';

        //
        // Erasing a line feed should erase the preceding carriage return.
        //
        CString strText;
        GetWindowText(strText);
        int iLength = strText.GetLength();
        if (iLength > 0 && strText.GetAt(strText.GetLength() - 1) == '\n')
            SetSel(nEnd-2, nEnd);
  }

  //
  // Append a line feed to a carriage return.
  //
  else if (mbsKey[0] == VK_RETURN)
  {
    mbsKey[1] = '\xa';
    mbsKey[2] = '\0';
  }
  //
  // Store the new keystroke.
  //
  ReplaceSel(mbsKey);
}

void CDrawArea::AddKeystroke ( char * mbsKey )
void CDrawArea::AddKeystroke ( char * mbsKey )
void CDrawArea::AddLine ( LINE line )

Definition at line 95 of file DrawArea.Cpp.

{
  //
  // Set the clipping region for the drawing.
  //
  CClientDC dc(this);
  RECT rect;
  GetClientRect(&rect);
  CRgn rgn;
  rgn.CreateRectRgnIndirect(&rect);
  dc.SelectClipRgn(&rgn);

  //
  // Draw the line and save it for redrawing.
  //
  dc.MoveTo(line.ptStart);
  dc.LineTo(line.ptEnd);
    m_listLines.AddTail(line);
}

void CDrawArea::AddLine ( LINE line )
void CDrawArea::AddLine ( LINE line )
afx_msg HBRUSH CDrawArea::CtlColor | ( | CDC * | pDC,
 |  | UINT | nCtlColor |
 | ) |  |  | [protected]
HBRUSH CDrawArea::CtlColor | ( | CDC * | pDC,
 |  | UINT | nCtlColor |
 | ) |  |  | [protected]

Definition at line 230 of file DrawArea.Cpp.

{
  // TODO: Change any attributes of the DC here.
  pDC->SetBkColor(GetSysColor(COLOR_MENU));

  // TODO: Return a non-NULL brush if the parent's handler should not be called.
  return HBRUSH((CBrush *)pDC->SelectStockObject(LTGRAY_BRUSH));
}

afx_msg HBRUSH CDrawArea::CtlColor | ( | CDC * | pDC,
 |  | UINT | nCtlColor |
 | ) |  |  | [protected]
afx_msg void CDrawArea::OnChar | ( | UINT | nChar,
 |  | UINT | nRepCnt,
 |  | UINT | nFlags |
 | ) |  |  | [protected]
void CDrawArea::OnChar | ( | UINT | nChar,
 |  | UINT | nRepCnt,
 |  | UINT | nFlags |
 | ) |  |  | [protected]

Definition at line 256 of file DrawArea.Cpp.

{
  // TODO: Add your message handler code here and/or call default.
  ((CDisdrawDlg *)GetParent())->SendKeystroke(nChar);

  CEdit::OnChar(nChar, nRepCnt, nFlags);

  RedrawWindow();
}

afx_msg void CDrawArea::OnChar | ( | UINT | nChar,
 |  | UINT | nRepCnt,
 |  | UINT | nFlags |
 | ) |  |  | [protected]
afx_msg void CDrawArea::OnKeyDown | ( | UINT | nChar,
 |  | UINT | nRepCnt,
 |  | UINT | nFlags |
 | ) |  |  | [protected]
void CDrawArea::OnKeyDown | ( | UINT | nChar,
 |  | UINT | nRepCnt,
 |  | UINT | nFlags |
 | ) |  |  | [protected]

Definition at line 240 of file DrawArea.Cpp.

{
  // TODO: Add your message handler code here and/or call default.

  switch (nChar)
  {
  case VK_LEFT:
  case VK_RIGHT:
  case VK_UP:
  case VK_DOWN:
  case VK_HOME: break;
  default:    CEdit::OnKeyDown(nChar, nRepCnt, nFlags);
  }
}

afx_msg void CDrawArea::OnKeyDown | ( | UINT | nChar,
 |  | UINT | nRepCnt,
 |  | UINT | nFlags |
 | ) |  |  | [protected]
afx_msg void CDrawArea::OnLButtonDblClk | ( | UINT | nFlags,
 |  | CPoint | point |
 | ) |  |  | [protected]
afx_msg void CDrawArea::OnLButtonDblClk | ( | UINT | nFlags,
 |  | CPoint | point |
 | ) |  |  | [protected]
void CDrawArea::OnLButtonDblClk | ( | UINT | nFlags,
 |  | CPoint | point |
 | ) |  |  | [protected]

Definition at line 267 of file DrawArea.Cpp.

{
  // TODO: Add your message handler code here and/or call default.
}

afx_msg void CDrawArea::OnLButtonDown | ( | UINT | nFlags,
 |  | CPoint | point |
 | ) |  |  | [protected]
void CDrawArea::OnLButtonDown | ( | UINT | nFlags,
 |  | CPoint | point |
 | ) |  |  | [protected]

Definition at line 116 of file DrawArea.Cpp.

{
  // TODO: Add your message handler code here and/or call default.

  m_ptLast = point;
  SetFocus();
}

afx_msg void CDrawArea::OnLButtonDown | ( | UINT | nFlags,
 |  | CPoint | point |
 | ) |  |  | [protected]
afx_msg void CDrawArea::OnMouseMove | ( | UINT | nFlags,
 |  | CPoint | point |
 | ) |  |  | [protected]
void CDrawArea::OnMouseMove | ( | UINT | nFlags,
 |  | CPoint | point |
 | ) |  |  | [protected]

Definition at line 125 of file DrawArea.Cpp.

{
  // TODO: Add your message handler code here and/or call default.

  if (nFlags & MK_LBUTTON)
  {
    //
    // Add the line drawn to the drawing.
    //
    LINE line;
    line.ptStart = m_ptLast;
    line.ptEnd = point;
        AddLine(line);

    //
    // Send the line to the friend queue.
    //
    ((CDisdrawDlg *)GetParent())->SendMouseMovement(line);

    //
    // Remember the end point of the line.
    //
    m_ptLast = point;
  }
}

afx_msg void CDrawArea::OnMouseMove | ( | UINT | nFlags,
 |  | CPoint | point |
 | ) |  |  | [protected]
afx_msg void CDrawArea::OnPaint ( ) [protected]
afx_msg void CDrawArea::OnPaint ( ) [protected]
void CDrawArea::OnPaint ( void ) [protected]

Definition at line 152 of file DrawArea.Cpp.

{
  CPaintDC dc(this); // device context for painting

  // TODO: Add your message handler code here.

  //
  // Set the clipping region for the drawing.
  //
  RECT rect;
  GetClientRect(&rect);
  CRgn rgn;
  rgn.CreateRectRgnIndirect(&rect);
  dc.SelectClipRgn(&rgn);

  //
  // Erase the drawing area.
  //
  dc.FillSolidRect(&rect, GetSysColor(COLOR_MENU));

  //
  // Redisplay the text.
  //
    CString strText;
    GetWindowText(strText);
    dc.SelectStockObject(ANSI_VAR_FONT);
    rect.top++;
    rect.left++;
    dc.DrawText(strText, &rect, DT_TOP | DT_WORDBREAK);

  //
  // Redraw each line.
  //
  LINE line;
  POSITION posLine = m_listLines.GetHeadPosition();
  while (posLine != NULL)
  {
    line = m_listLines.GetNext(posLine);
    dc.MoveTo(line.ptStart);
    dc.LineTo(line.ptEnd);
  }

  // Do not call CEdit::OnPaint() for painting messages.
}

afx_msg void CDrawArea::OnRButtonUp | ( | UINT | nFlags,
 |  | CPoint | point |
 | ) |  |  | [protected]
afx_msg void CDrawArea::OnRButtonUp | ( | UINT | nFlags,
 |  | CPoint | point |
 | ) |  |  | [protected]
void CDrawArea::OnRButtonUp | ( | UINT | nFlags,
 |  | CPoint | point |
 | ) |  |  | [protected]

Definition at line 198 of file DrawArea.Cpp.

{
  // TODO: Add your message handler code here and/or call default.

  //
  // Clear the drawing area.
  //
  SetSel(0, -1);
  Clear();
  m_listLines.RemoveAll();
  RedrawWindow();
}

afx_msg BOOL CDrawArea::OnSetCursor | ( | CWnd * | pWnd,
 |  | UINT | nHitTest,
 |  | UINT | message |
 | ) |  |  | [protected]
BOOL CDrawArea::OnSetCursor | ( | CWnd * | pWnd,
 |  | UINT | nHitTest,
 |  | UINT | message |
 | ) |  |  | [protected]

Definition at line 212 of file DrawArea.Cpp.

{
  // TODO: Add your message handler code here and/or call default.

  return 0;
}

afx_msg BOOL CDrawArea::OnSetCursor | ( | CWnd * | pWnd,
 |  | UINT | nHitTest,
 |  | UINT | message |
 | ) |  |  | [protected]
void CDrawArea::OnSetFocus ( CWnd * pOldWnd ) [protected]

Definition at line 220 of file DrawArea.Cpp.

{
  CEdit::OnSetFocus(pOldWnd);

  // TODO: Add your message handler code here.

  HideCaret();
}

afx_msg void CDrawArea::OnSetFocus ( CWnd * pOldWnd ) [protected]
afx_msg void CDrawArea::OnSetFocus ( CWnd * pOldWnd ) [protected]

Member Data Documentation

CList< LINE, LINE & > CDrawArea::m_listLines [protected]

Definition at line 38 of file DrawArea.h.

CPoint CDrawArea::m_ptLast [protected]

Definition at line 37 of file DrawArea.h.

The documentation for this class was generated from the following files:
  • NetDS/MessageQueuing/c_draw/DrawArea.h
  • NetDS/MessageQueuing/Imp_Draw/DrawArea.h
  • NetDS/MessageQueuing/mqf_draw/drawarea.h
  • NetDS/MessageQueuing/c_draw/DrawArea.Cpp
  • NetDS/MessageQueuing/Imp_Draw/DrawArea.Cpp
  • NetDS/MessageQueuing/mqf_draw/drawarea.cpp
Generated on Wed Nov 13 2024 16:56:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDropObject Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CDropObject Class Reference

#include "cdialoglite.h"

List of all members.

Public Member Functions

CDropObject ()
virtual | ~CDropObject ()
STDMETHODIMP | DAdvise (FORMATETC *pformatetc, DWORD advf, IAdviseSink *pAdvSink, DWORD *pdwConnection)
STDMETHODIMP | DUnadvise (DWORD dwConnection)
STDMETHODIMP | EnumDAdvise (IEnumSTATDATA **ppenumAdvise)
STDMETHODIMP | EnumFormatEtc (DWORD dwDirection, IEnumFORMATETC **ppenumFormatEtc)
STDMETHODIMP | GetCanonicalFormatEtc (FORMATETC *pformatectIn, FORMATETC *pformatetcOut)
STDMETHODIMP | GetData (FORMATETC *pformatetcIn, STGMEDIUM *pmedium)
STDMETHODIMP | GetDataHere (FORMATETC *pformatetc, STGMEDIUM *pmedium)
STDMETHODIMP | QueryGetData (FORMATETC *pformatetc)
STDMETHODIMP | QueryInterface (REFIID riid, void **ppvObject)
STDMETHODIMP | SetData (FORMATETC *pformatetc, STGMEDIUM *pmedium, BOOL fRelease)
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()

Private Attributes

ULONG m_cRef

Detailed Description

Definition at line 1145 of file cdialoglite.h.

Constructor & Destructor Documentation

CDropObject::CDropObject ( )

Definition at line 5626 of file cdialoglite.cpp.

{
  //IUnknown
  m_cRef = 0;
}

CDropObject::~CDropObject ( ) [virtual]

Definition at line 5637 of file cdialoglite.cpp.

{
}

Member Function Documentation

STDMETHODIMP CDropObject::DAdvise | ( | FORMATETC * | pformatetc,
 |  | DWORD | advf,
 |  | IAdviseSink * | pAdvSink,
 |  | DWORD * | pdwConnection
 | ) |  |

Definition at line 5753 of file cdialoglite.cpp.

{
  return E_NOTIMPL;
}

STDMETHODIMP CDropObject::DUnadvise ( DWORD dwConnection )

Definition at line 5763 of file cdialoglite.cpp.

{
  return E_NOTIMPL;
}

STDMETHODIMP CDropObject::EnumDAdvise ( IEnumSTATDATA ** ppenumAdvise )

Definition at line 5773 of file cdialoglite.cpp.

{
  return E_NOTIMPL;
}

STDMETHODIMP CDropObject::EnumFormatEtc | ( | DWORD | dwDirection,
 |  | IEnumFORMATETC ** | ppenumFormatEtc
 | ) |  |

Definition at line 5744 of file cdialoglite.cpp.

{
  return E_NOTIMPL;
}

STDMETHODIMP CDropObject::GetCanonicalFormatEtc | ( | FORMATETC * | pformatectIn,
 |  | FORMATETC * | pformatetcOut
 | ) |  |

Definition at line 5726 of file cdialoglite.cpp.

{
  return E_NOTIMPL;
}

STDMETHODIMP CDropObject::GetData | ( | FORMATETC * | pformatetcIn,
 |  | STGMEDIUM * | pmedium
 | ) |  |

Definition at line 5697 of file cdialoglite.cpp.

{
  return E_NOTIMPL;
}

STDMETHODIMP CDropObject::GetDataHere | ( | FORMATETC * | pformatetc,
 |  | STGMEDIUM * | pmedium
 | ) |  |

Definition at line 5707 of file cdialoglite.cpp.

{
  return E_NOTIMPL;
}

STDMETHODIMP CDropObject::QueryGetData ( FORMATETC * pformatetc )

Definition at line 5717 of file cdialoglite.cpp.

{
  return E_NOTIMPL;
}

STDMETHODIMP CDropObject::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppvObject
 | ) |  |
STDMETHODIMP CDropObject::SetData | ( | FORMATETC * | pformatetc,
 |  | STGMEDIUM * | pmedium,
 |  | BOOL | fRelease
 | ) |  |

Definition at line 5735 of file cdialoglite.cpp.

{
  return E_NOTIMPL;
}

CDropObject::STDMETHODIMP_ ( ULONG )
CDropObject::STDMETHODIMP_ ( ULONG )

Member Data Documentation

ULONG CDropObject::m_cRef [private]

Definition at line 1172 of file cdialoglite.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialoglite.h
  • Dataaccess/oledb/rowsetviewer/cdialoglite.cpp
Generated on Wed Nov 13 2024 16:56:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDropSource Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CDropSource Class Reference

#include "cdialoglite.h"

List of all members.

Public Member Functions

CDropSource ()
CDropSource ()
virtual | ~CDropSource ()
~CDropSource ()
STDMETHODIMP | GiveFeedback (DWORD dwEffect)
STDMETHODIMP | GiveFeedback (DWORD)
STDMETHODIMP | QueryContinueDrag (BOOL fEscapePressed, DWORD grfKeyState)
STDMETHODIMP | QueryContinueDrag (BOOL, DWORD)
STDMETHODIMP | QueryInterface (REFIID riid, void **ppvObject)
STDMETHODIMP | QueryInterface (REFIID, LPVOID *)
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()

Private Attributes

ULONG m_cRef
DWORD m_ObjRefCount

Detailed Description

Definition at line 1180 of file cdialoglite.h.

Constructor & Destructor Documentation

CDropSource::CDropSource ( void )

Definition at line 5784 of file cdialoglite.cpp.

{
  //IUnknown
  m_cRef = 0;
}

CDropSource::~CDropSource ( void ) [virtual]

Definition at line 5795 of file cdialoglite.cpp.

{
}

CDropSource::CDropSource ( )
CDropSource::~CDropSource ( )

Member Function Documentation

STDMETHODIMP CDropSource::GiveFeedback ( DWORD dwEffect )

Definition at line 327 of file ids.Cpp.

{
  return DRAGDROP_S_USEDEFAULTCURSORS;
}

STDMETHODIMP CDropSource::GiveFeedback ( DWORD )
STDMETHODIMP CDropSource::QueryContinueDrag | ( | BOOL | ,
 |  | DWORD |
 | ) |  |
STDMETHODIMP CDropSource::QueryContinueDrag | ( | BOOL | fEscapePressed,
 |  | DWORD | grfKeyState
 | ) |  |

Definition at line 288 of file ids.Cpp.

{
  if (fEscapePressed)
    return DRAGDROP_S_CANCEL;
  else if (!(grfKeyState & MK_LBUTTON))
    return DRAGDROP_S_DROP;
  else
    return NOERROR;
}

STDMETHODIMP CDropSource::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppvObject
 | ) |  |
STDMETHODIMP CDropSource::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 5829 of file cdialoglite.cpp.

{
  if(!ppv)
    return E_INVALIDARG;
  *ppv = NULL;

  //IUNKNOWN
  if(riid == IID_IUnknown)
    *ppv = this;
  else if(riid == IID_IDropSource)
    *ppv = (IDropSource*)this;

  if(*ppv)
  {
    ((IUnknown*)(*ppv))->AddRef();
    return S_OK;
  }

  return E_NOINTERFACE;
}

CDropSource::STDMETHODIMP_ ( ULONG )
CDropSource::STDMETHODIMP_ ( ULONG )
CDropSource::STDMETHODIMP_ ( ULONG )
CDropSource::STDMETHODIMP_ ( ULONG )

Member Data Documentation

ULONG CDropSource::m_cRef [private]

Definition at line 1200 of file cdialoglite.h.

DWORD CDropSource::m_ObjRefCount [private]

Definition at line 32 of file DropSrc.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialoglite.h
  • WinUI/Shell/SampView/DropSrc.h
  • Com/Fundamentals/SimpDnd/ids.Cpp
  • Dataaccess/oledb/rowsetviewer/cdialoglite.cpp
  • WinUI/Shell/SampView/DropSrc.Cpp
Generated on Wed Nov 13 2024 16:56:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDropTarget Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CDropTarget Class Reference

#include "cdialoglite.h"

List of all members.

Public Member Functions

CDropTarget ()
CDropTarget (void)
CDropTarget (CShellFolder *)
virtual | ~CDropTarget ()
~CDropTarget ()
~CDropTarget (void)
STDMETHODIMP | DragEnter (IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
STDMETHOD() | DragEnter (LPDATAOBJECT, DWORD, POINTL, LPDWORD)
STDMETHOD() | DragEnter (LPDATAOBJECT, DWORD, POINTL, LPDWORD)
STDMETHOD() | DragLeave (void)
STDMETHODIMP | DragLeave ()
STDMETHOD() | DragLeave (VOID)
STDMETHOD() | DragOver (DWORD, POINTL, LPDWORD)
STDMETHOD() | DragOver (DWORD, POINTL, LPDWORD)
STDMETHODIMP | DragOver (DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
STDMETHODIMP | Drop (IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
STDMETHOD() | Drop (LPDATAOBJECT, DWORD, POINTL, LPDWORD)
STDMETHOD() | Drop (LPDATAOBJECT, DWORD, POINTL, LPDWORD)
STDMETHOD() | QueryInterface (REFIID, LPVOID *)
STDMETHODIMP | QueryInterface (REFIID riid, void **ppvObject)
STDMETHOD() | QueryInterface (REFIID, LPVOID *)
STDMETHOD_ (ULONG, AddRef)(void)
STDMETHOD_ (ULONG, Release)(void)
STDMETHOD_ (ULONG, AddRef)(void)
STDMETHOD_ (ULONG, Release)(void)
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()

Private Member Functions

LPITEMIDLIST * | AllocPidlTable (DWORD)
void | DisplayFileNames (HWND, HGLOBAL)
BOOL DoDrop (HGLOBAL, BOOL)
VOID | FreePidlTable (LPITEMIDLIST *)
DWORD GetDropEffectFromKeyState (DWORD)
BOOL QueryDrop (DWORD, LPDWORD)
BOOL | QueryDrop (DWORD grfKeyState, LPDWORD pdwEffect)

Private Attributes

UINT m_cfPrivateData
ULONG m_cRef
ULONG m_cRefCount
BOOL m_fAcceptFmt
ULONG m_ObjRefCount
IDropTargetHelper * | m_pDropTargetHelper
IMalloc * | m_pMalloc
CPidlMgr * m_pPidlMgr
CShellFolder * m_psfParent

Detailed Description

Definition at line 1208 of file cdialoglite.h.

Constructor & Destructor Documentation

CDropTarget::CDropTarget ( void )

Definition at line 5877 of file cdialoglite.cpp.

{
  //IUnknown
  m_cRef = 0;
}

CDropTarget::~CDropTarget ( void ) [virtual]

Definition at line 5888 of file cdialoglite.cpp.

{
}

CDropTarget::CDropTarget ( void )
CDropTarget::~CDropTarget ( void )
CDropTarget::CDropTarget ( CShellFolder * psfParent )

Definition at line 31 of file DropTgt.Cpp.

{
g_DllRefCount++;

m_psfParent = psfParent;
if(m_psfParent)
   m_psfParent->AddRef();
else
   {
   delete this;
   return;
   }

m_pPidlMgr = new CPidlMgr();
if(!m_pPidlMgr)
   {
   delete this;
   return;
   }

SHGetMalloc(&m_pMalloc);
if(!m_pMalloc)
   {
   delete this;
   return;
   }

m_ObjRefCount = 1;

m_fAcceptFmt = FALSE;

m_cfPrivateData = RegisterClipboardFormat(CFSTR_SAMPVIEWDATA);
}

CDropTarget::~CDropTarget ( )

Member Function Documentation

LPITEMIDLIST * CDropTarget::AllocPidlTable ( DWORD dwEntries ) [private]

Definition at line 396 of file DropTgt.Cpp.

{
LPITEMIDLIST   *aPidls;

dwEntries++;

aPidls = (LPITEMIDLIST*)m_pMalloc->Alloc(dwEntries * sizeof(LPITEMIDLIST));

if(aPidls)
   {
   //set all of the entries to NULL
   ZeroMemory(aPidls, dwEntries * sizeof(LPITEMIDLIST));
   }

return aPidls;
}

void CDropTarget::DisplayFileNames | ( | HWND | hwndOwner,
 |  | HGLOBAL | hgFiles |
 | ) |  |  | [private]

Definition at line 314 of file DropTgt.Cpp.

{
UINT     i,
         nFiles;
LPTSTR   pszFiles;
UINT     cchSize;

nFiles = DragQueryFile((HDROP)hgFiles, 0xFFFFFFFF, NULL, 0);

// MAX_PATH + 1 for the "\n" at the end of each path, and another 1 for the null terminator
cchSize = nFiles * (MAX_PATH + 1) + 1;
pszFiles = new TCHAR[cchSize];

if(pszFiles)
   {
   LPTSTR   pszTemp;

   for(i = 0, pszTemp = pszFiles; i < nFiles; i++, pszTemp += lstrlen(pszTemp))
      {
      DragQueryFile((HDROP)hgFiles, i, pszTemp, MAX_PATH);
      lstrcat(pszTemp, TEXT("\n")); // we have room for this \n at the end of each path
      }

   SetForegroundWindow(hwndOwner);

   MessageBox(hwndOwner, pszFiles, TEXT("Files Dropped"), MB_OK | MB_ICONINFORMATION);

   delete [] pszFiles;
   }
}

BOOL CDropTarget::DoDrop | ( | HGLOBAL | hMem,
 |  | BOOL | fCut |
 | ) |  |  | [private]

Definition at line 312 of file DropTgt.Cpp.

{
BOOL     fSuccess = FALSE;

if(hMem)
   {
   LPPRIVCLIPDATA pData = (LPPRIVCLIPDATA)GlobalLock(hMem);

   if(pData)
      {
      CShellFolder   *psfFrom = NULL;
      IShellFolder   *psfDesktop;
      LPITEMIDLIST   pidl;

      pidl = (LPITEMIDLIST)((LPBYTE)(pData) + pData->aoffset[0]);
      /*
      This is a fully qualified PIDL, so use the desktop folder to get the
      IShellFolder for this folder.
      */
      SHGetDesktopFolder(&psfDesktop);
      if(psfDesktop)
         {
         //if the source and the target folders are the same, this is a NOOP
         LPITEMIDLIST   pidlThisFolder = m_psfParent->CreateFQPidl(NULL);

         if(pidlThisFolder)
            {
            if(0 != psfDesktop->CompareIDs(0, pidl, pidlThisFolder))
               {
               psfDesktop->BindToObject(pidl, NULL, IID_IShellFolder, (LPVOID*)&psfFrom);
               }

            m_pPidlMgr->Delete(pidlThisFolder);
            }

         psfDesktop->Release();
         }

      if(psfFrom)
         {
         LPITEMIDLIST   *aPidls;

         //allocate an array of PIDLS
         aPidls = AllocPidlTable(pData->cidl - 1);

         if(aPidls)
            {
            UINT  i;

            //fill in the PIDL array
            for(i = 0; i < pData->cidl - 1; i++)
               {
               aPidls[i] = m_pPidlMgr->Copy((LPITEMIDLIST)((LPBYTE)(pData) + pData->aoffset[i + 1]));
               }

            if(SUCCEEDED(m_psfParent->CopyItems(psfFrom, aPidls, pData->cidl - 1)))
               {
               fSuccess = TRUE;

               if(fCut)
                  {
                  psfFrom->DeleteItems(aPidls, pData->cidl - 1);
                  }
               }

            FreePidlTable(aPidls);
            }

         psfFrom->Release();
         }

      GlobalUnlock(hMem);
      }
   }

return fSuccess;
}

STDMETHODIMP CDropTarget::DragEnter | ( | IDataObject * | pDataObj,
 |  | DWORD | grfKeyState,
 |  | POINTL | pt,
 |  | DWORD * | pdwEffect
 | ) |  |

Definition at line 5948 of file cdialoglite.cpp.

{
  ASSERT(pDataObj);
  ASSERT(pdwEffect);
  *pdwEffect = DROPEFFECT_COPY;
  return S_OK;
}

STDMETHOD() CDropTarget::DragEnter | ( | LPDATAOBJECT | ,
 |  | DWORD | ,
 |  | POINTL | ,
 |  | LPDWORD |
 | ) |  |
STDMETHODIMP CDropTarget::DragEnter | ( | LPDATAOBJECT | pDataObj,
 |  | DWORD | grfKeyState,
 |  | POINTL | pointl,
 |  | LPDWORD | pdwEffect
 | ) |  |

Definition at line 611 of file idt.Cpp.

{
        OutputDebugString("In IDT::DragEnter\r\n");

        /* Determine if the drag source data object offers a data format
        **  that we understand. we accept only creating embedded objects.
        */
        m_fCanDropCopy = ((OleQueryCreateFromData(pDataObj) == NOERROR) ?
                        TRUE : FALSE);
        m_fCanDropLink = FALSE; // linking NOT supported in this simple sample

        if (m_fCanDropCopy || m_fCanDropLink)
                InitDragFeedback(pDataObj, pointl);

        BOOL fDragScroll = DoDragScroll ( pointl );

        if (QueryDrop(grfKeyState,pointl,fDragScroll,pdwEffect))
                DrawDragFeedback( pointl );

        return NOERROR;
}

STDMETHODIMP CDropTarget::DragLeave ( VOID )

Definition at line 200 of file DropTgt.Cpp.

{
m_fAcceptFmt = FALSE;

return S_OK;
}

STDMETHODIMP CDropTarget::DragLeave ( )

Definition at line 717 of file idt.Cpp.

{
        OutputDebugString("In IDT::DragLeave\r\n");

        UndrawDragFeedback();

        return S_OK;
}

STDMETHOD() CDropTarget::DragLeave ( void )
STDMETHODIMP CDropTarget::DragOver | ( | DWORD | grfKeyState,
 |  | POINTL | pt,
 |  | DWORD * | pdwEffect
 | ) |  |

Definition at line 5961 of file cdialoglite.cpp.

{
  ASSERT(pdwEffect);
  *pdwEffect = DROPEFFECT_COPY;
  return S_OK;
}

STDMETHOD() CDropTarget::DragOver | ( | DWORD | ,
 |  | POINTL | ,
 |  | LPDWORD |
 | ) |  |
STDMETHODIMP CDropTarget::DragOver | ( | DWORD | grfKeyState,
 |  | POINTL | pointl,
 |  | LPDWORD | pdwEffect
 | ) |  |

Definition at line 675 of file idt.Cpp.

{
        OutputDebugString("In IDT::DragOver\r\n");

        BOOL fDragScroll = DoDragScroll ( pointl );

        if (QueryDrop(grfKeyState,pointl,fDragScroll,pdwEffect))
                DrawDragFeedback( pointl );
        else
                UndrawDragFeedback();

        return NOERROR;
}

STDMETHODIMP CDropTarget::Drop | ( | LPDATAOBJECT | pDataObj,
 |  | DWORD | grfKeyState,
 |  | POINTL | pointl,
 |  | LPDWORD | pdwEffect
 | ) |  |

Definition at line 772 of file idt.Cpp.

{
        FORMATETC fmtetc;
        SCODE sc = S_OK;

        OutputDebugString("In IDT::Drop\r\n");

        UndrawDragFeedback();

        if (pDataObj && QueryDrop(grfKeyState,pointl,FALSE,pdwEffect))
                {
                m_pDoc->m_lpSite = CSimpleSite::Create(m_pDoc);
                // keep same aspect as drop source
                m_pDoc->m_lpSite->m_dwDrawAspect = m_dwSrcAspect;

                // in order to specify a particular drawing Aspect we must
                // pass a FORMATETC* to OleCreateFromData
                fmtetc.cfFormat = NULL;             // use whatever for drawing
                fmtetc.ptd = NULL;
                fmtetc.lindex = -1;
                fmtetc.dwAspect = m_dwSrcAspect;    // desired drawing aspect
                fmtetc.tymed = TYMED_NULL;

                HRESULT hrErr = OleCreateFromData (
                                                        pDataObj,
                                                        IID_IOleObject,
                                                        OLERENDER_DRAW,
                                                        &fmtetc,
                                                        &m_pDoc->m_lpSite->m_OleClientSite,
                                                        m_pDoc->m_lpSite->m_lpObjStorage,
                                                        (LPVOID FAR *)&m_pDoc->m_lpSite->m_lpOleObject);

                if (hrErr == NOERROR)
                        {
                        m_pDoc->m_lpSite->InitObject(FALSE /* fCreateNew */);
                        m_pDoc->DisableInsertObject();
                        }
                else
                        sc = hrErr;
                }

        return sc;
}

STDMETHOD() CDropTarget::Drop | ( | LPDATAOBJECT | ,
 |  | DWORD | ,
 |  | POINTL | ,
 |  | LPDWORD |
 | ) |  |
STDMETHODIMP CDropTarget::Drop | ( | IDataObject * | pDataObj,
 |  | DWORD | grfKeyState,
 |  | POINTL | pt,
 |  | DWORD * | pdwEffect
 | ) |  |

Definition at line 5983 of file cdialoglite.cpp.

{
  ASSERT(pdwEffect);
  ASSERT(pDataObj);
  *pdwEffect = DROPEFFECT_COPY;
  HRESULT hr = S_OK;

  //FORMATC structure
  FORMATETC DataFormat =
    {
    CF_HDROP,
    NULL,
    DVASPECT_CONTENT,
    -1,
    TYMED_HGLOBAL
    };

  //STGMEDIUM Structure
  STGMEDIUM Medium;
  memset(&Medium, 0, sizeof(STGMEDIUM));

  //NOTE: If your only dealing with Dragging and Dropping Files
  //you can more simply just use WM_DROPFILES instead of implementing
  //this interface setting everything up, etc...

  //Obtain the Data...
  if(SUCCEEDED(hr = pDataObj->GetData(&DataFormat, &Medium)))
  {
    HDROP hDrop = (HDROP)Medium.hGlobal;

    //Obtain the number of files...
    UINT cFiles = DragQueryFile(hDrop, (UINT)-1, NULL, 0);

    //For every file...
    for(ULONG iFile=0; iFile<cFiles; iFile++)
    {
      CHAR szFileName[_MAX_PATH];

      DragQueryFile(hDrop, iFile, szFileName, NUMELE(szFileName));
      wMessageBox(GetFocus(), MB_TASKMODAL | MB_ICONERROR | MB_OK,
        wsz_INFO, L"File %d: %S", iFile+1, szFileName);
    }
  }

//CLEANUP:
  return hr;
}

VOID CDropTarget::FreePidlTable ( LPITEMIDLIST * aPidls ) [private]

Definition at line 419 of file DropTgt.Cpp.

{
if(aPidls && m_pPidlMgr)
   {
   UINT  i;
   for(i = 0; aPidls[i]; i++)
      m_pPidlMgr->Delete(aPidls[i]);

   m_pMalloc->Free(aPidls);
   }
}

DWORD CDropTarget::GetDropEffectFromKeyState ( DWORD dwKeyState ) [private]

Definition at line 286 of file DropTgt.Cpp.

{
//move is the default
DWORD dwDropEffect = DROPEFFECT_MOVE;

if(dwKeyState & MK_CONTROL)
   {
   if(dwKeyState & MK_SHIFT)
      {
      dwDropEffect = DROPEFFECT_LINK;
      }
   else
      {
      dwDropEffect = DROPEFFECT_COPY;
      }
   }

return dwDropEffect;
}

BOOL CDropTarget::QueryDrop | ( | DWORD | grfKeyState,
 |  | LPDWORD | pdwEffect |
 | ) |  |  | [private]

Definition at line 268 of file DropTgt.Cpp.

{
DWORD dwOKEffects = *pdwEffect;

if(!m_fAcceptFmt)
   {
   *pdwEffect = DROPEFFECT_NONE;
   return FALSE;
   }

*pdwEffect = OleStdGetDropEffect(grfKeyState);
if(*pdwEffect == 0)
   {
   // No modifier keys used by user while dragging.
   if (DROPEFFECT_COPY & dwOKEffects)
      *pdwEffect = DROPEFFECT_COPY;
   else if (DROPEFFECT_MOVE & dwOKEffects)
      *pdwEffect = DROPEFFECT_MOVE;
   else if (DROPEFFECT_LINK & dwOKEffects)
      *pdwEffect = DROPEFFECT_LINK;
   else
      {
      *pdwEffect = DROPEFFECT_NONE;
      }
   }
else
   {
   // Check if the drag source application allows the drop effect desired by user.
   // The drag source specifies this in DoDragDrop
   if(!(*pdwEffect & dwOKEffects))
      *pdwEffect = DROPEFFECT_NONE;

   // We don't accept links
   if(*pdwEffect == DROPEFFECT_LINK)
      *pdwEffect = DROPEFFECT_NONE;
   }

return (DROPEFFECT_NONE == *pdwEffect) ? FALSE : TRUE;
}

BOOL CDropTarget::QueryDrop | ( | DWORD | ,
 |  | LPDWORD |  |
 | ) |  |  | [private]
STDMETHOD() CDropTarget::QueryInterface | ( | REFIID | ,
 |  | LPVOID * |
 | ) |  |
STDMETHODIMP CDropTarget::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 5922 of file cdialoglite.cpp.

{
  if(!ppv)
    return E_INVALIDARG;
  *ppv = NULL;

  //IUNKNOWN
  if(riid == IID_IUnknown)
    *ppv = this;
  else if(riid == IID_IDropTarget)
    *ppv = (IDropTarget*)this;

  if(*ppv)
  {
    ((IUnknown*)(*ppv))->AddRef();
    return S_OK;
  }

  return E_NOINTERFACE;
}

STDMETHODIMP CDropTarget::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppvObject
 | ) |  |
CDropTarget::STDMETHOD_ | ( | ULONG | ,
 |  | Release |
 | ) |  |
CDropTarget::STDMETHOD_ | ( | ULONG | ,
 |  | AddRef |
 | ) |  |
CDropTarget::STDMETHOD_ | ( | ULONG | ,
 |  | Release |
 | ) |  |
CDropTarget::STDMETHOD_ | ( | ULONG | ,
 |  | AddRef |
 | ) |  |
CDropTarget::STDMETHODIMP_ ( ULONG )
CDropTarget::STDMETHODIMP_ ( ULONG )

Member Data Documentation

UINT CDropTarget::m_cfPrivateData [private]

Definition at line 59 of file DropTgt.h.

ULONG CDropTarget::m_cRef [private]

Definition at line 1230 of file cdialoglite.h.

ULONG CDropTarget::m_cRefCount [private]

Definition at line 33 of file DropTgt.h.

BOOL CDropTarget::m_fAcceptFmt [private]

Definition at line 34 of file DropTgt.h.

ULONG CDropTarget::m_ObjRefCount [private]

Definition at line 57 of file DropTgt.h.

IDropTargetHelper* CDropTarget::m_pDropTargetHelper [private]

Definition at line 35 of file DropTgt.h.

IMalloc* CDropTarget::m_pMalloc [private]

Definition at line 56 of file DropTgt.h.

CPidlMgr* CDropTarget::m_pPidlMgr [private]

Definition at line 55 of file DropTgt.h.

CShellFolder* CDropTarget::m_psfParent [private]

Definition at line 54 of file DropTgt.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialoglite.h
  • WinUI/Shell/DragImg/DropTgt.h
  • WinUI/Shell/SampView/DropTgt.h
  • Com/Fundamentals/SimpDnd/idt.Cpp
  • Dataaccess/oledb/rowsetviewer/cdialoglite.cpp
  • WinUI/Shell/DragImg/DropTgt.Cpp
  • WinUI/Shell/SampView/DropTgt.Cpp
Generated on Wed Nov 13 2024 16:56:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDSLAdvancedPage Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CDSLAdvancedPage Class Reference

#include "datasrc.h"

Inherits CPropertyPage.

List of all members.

Public Member Functions

CDSLAdvancedPage ()
virtual | ~CDSLAdvancedPage ()
virtual BOOL | HandleMessage (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)

Detailed Description

Definition at line 448 of file datasrc.h.

Constructor & Destructor Documentation

CDSLAdvancedPage::CDSLAdvancedPage ( )

Definition at line 693 of file datasrc.cpp.

  : CPropertyPage(CLSID_SampProvAdvancedPage, IDD_DSL_ADVANCED)
{
}

CDSLAdvancedPage::~CDSLAdvancedPage ( ) [virtual]

Definition at line 702 of file datasrc.cpp.

{
}

Member Function Documentation

BOOL CDSLAdvancedPage::HandleMessage | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [virtual]

Reimplemented from CPropertyPage.

Definition at line 712 of file datasrc.cpp.

{
  return FALSE;
}

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/sampprov/datasrc.h
  • Dataaccess/oledb/sampprov/datasrc.cpp
Generated on Wed Nov 13 2024 16:56:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDSLConnectionPage Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CDSLConnectionPage Class Reference

#include "datasrc.h"

Inherits CPropertyPage.

List of all members.

Public Member Functions

CDSLConnectionPage ()
virtual | ~CDSLConnectionPage ()
virtual BOOL | HandleMessage (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
STDMETHODIMP | Load (IPropertyBag __RPC_FAR *pPropBag, IErrorLog __RPC_FAR *pErrorLog)
STDMETHODIMP | Save (IPropertyBag __RPC_FAR *pPropBag, BOOL fClearDirty, BOOL fSaveAllProperties)

Protected Attributes

VARIANT | m_vDataSource

Detailed Description

Definition at line 419 of file datasrc.h.

Constructor & Destructor Documentation

CDSLConnectionPage::CDSLConnectionPage ( )

Definition at line 553 of file datasrc.cpp.

  : CPropertyPage(CLSID_SampProvConnectionPage, IDD_DSL_CONNECTION)
{
  VariantInit(&m_vDataSource);
}

CDSLConnectionPage::~CDSLConnectionPage ( ) [virtual]

Definition at line 563 of file datasrc.cpp.

{
  VariantClear(&m_vDataSource);
}

Member Function Documentation

BOOL CDSLConnectionPage::HandleMessage | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [virtual]

Reimplemented from CPropertyPage.

Definition at line 573 of file datasrc.cpp.

{
  switch (message)
  {
    case WM_COMMAND:
    {
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        break;
      }

      switch(GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDB_BROWSE_DIRECTORY:
        {
          //Obtain the current value for the default
          CHAR szDirectory[MAX_QUERY_LEN] = {0};
          SendMessage(GetDlgItem(m_hWnd, IDE_DATASOURCE), WM_GETTEXT, MAX_QUERY_LEN, (LPARAM)szDirectory);

          //Display Common Dialog to obtain Directory...
          BROWSEINFO browseInfo;
          memset( &browseInfo, 0, sizeof(browseInfo));
          browseInfo.hwndOwner    = m_hWnd;
          browseInfo.pidlRoot     = NULL;
          browseInfo.pszDisplayName = szDirectory;
          browseInfo.lpszTitle    = "Browse for default directory";;
          browseInfo.ulFlags      = 0;
          browseInfo.lpfn       = NULL;
          browseInfo.lParam     = 0;
          browseInfo.iImage     = 0;

          //Display Common Dialog to obtain File To Load...
          ITEMIDLIST* pidl = SHBrowseForFolder(&browseInfo);
          if(pidl)
          {
            //Obtain the file path from the ITemID...
            if(SHGetPathFromIDList(pidl, szDirectory))
            {
              //Update the Property value on the Dialog...
              SendMessage(GetDlgItem(m_hWnd, IDE_DATASOURCE), WM_SETTEXT, 0, (LPARAM)szDirectory);
            }

            SAFE_FREE(pidl);
          }
          break;
        }
      };
      break;
    }
  };

  return FALSE;
}

STDMETHODIMP CDSLConnectionPage::Load | ( | IPropertyBag __RPC_FAR * | pPropBag,
 |  | IErrorLog __RPC_FAR * | pErrorLog
 | ) |  |

Reimplemented from CPropertyPage.

STDMETHODIMP CDSLConnectionPage::Save | ( | IPropertyBag __RPC_FAR * | pPropBag,
 |  | BOOL | fClearDirty,
 |  | BOOL | fSaveAllProperties
 | ) |  |

Reimplemented from CPropertyPage.

Definition at line 661 of file datasrc.cpp.

{
  if(!pPropBag)
    return E_INVALIDARG;

  //Obtain the Property value from the Dialog...
  WCHAR wszBuffer[MAX_QUERY_LEN] = {0};
  wSendMessage(GetDlgItem(m_hWnd, IDE_DATASOURCE), WM_GETTEXT, MAX_QUERY_LEN, wszBuffer);

  //Indicate this page is dirty...
  ASSERT(m_pIPropertyPageSite);
  m_pIPropertyPageSite->OnStatusChange(PROPPAGESTATUS_DIRTY);

  //Store it into our variant...
  VariantClear(&m_vDataSource);
  V_VT(&m_vDataSource)  = VT_BSTR;
  V_BSTR(&m_vDataSource)  = SysAllocString(wszBuffer);

  //Delegate
  return pPropBag->Write(L"Data Source", &m_vDataSource);
}

Member Data Documentation

VARIANT CDSLConnectionPage::m_vDataSource [protected]

Definition at line 440 of file datasrc.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/sampprov/datasrc.h
  • Dataaccess/oledb/sampprov/datasrc.cpp
Generated on Wed Nov 13 2024 16:56:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDSLContextBox Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CDSLContextBox Class Reference

#include "cdialog.h"

Inherits CListBoxLite.

List of all members.

Public Member Functions

virtual BOOL OnKeyDown (WPARAM nVirtKey, LPARAM lKeyData)

Detailed Description

Definition at line 534 of file cdialog.h.

Member Function Documentation

virtual BOOL CDSLContextBox::OnKeyDown | ( | WPARAM | nVirtKey,
 |  | LPARAM | lKeyData |
 | ) |  |  | [inline, virtual]

Reimplemented from CWndLite.

Definition at line 540 of file cdialog.h.

  {
    switch(nVirtKey)
    {
      case VK_TAB:
      {
        MSG msg;
        PeekMessage(&msg, NULL, 0, 0, PM_REMOVE);

        //Tab - ends dialog
        SendMessage(m_hWndParent, WM_COMMAND, GET_WM_COMMAND_MPS(IDOK, m_hWndParent, 0));
        return TRUE;
      }

      default:
        break;
    };

    return FALSE;
  }

The documentation for this class was generated from the following file:
  • Dataaccess/oledb/rowsetviewer/cdialog.h
Generated on Wed Nov 13 2024 16:56:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDynamic Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CDynamic Class Reference

#include "dynamic.h"

List of all members.

Public Member Functions

CDynamic ()
~CDynamic ()
STDMETHOD() | _NewEnum (IUnknown **ppunk)
STDMETHOD() | Add (VARIANT *pItem, VARIANT *pKey=&vtMissing, VARIANT *pBefore=&vtMissing, VARIANT *pAfter=&vtMissing)
STDMETHOD() | Count (long *pVal)
STDMETHOD() | DisconnectObject (DWORD dwReserved)
STDMETHOD() | GetClassID (GUID *pClassID)
STDMETHOD() | GetMarshalSizeMax (REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlFlags, ULONG *pSize)
STDMETHOD() | GetSizeMax (_ULARGE_INTEGER *pCbSize)
STDMETHOD() | GetUnmarshalClass (REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlFlags, CLSID *pCid)
STDMETHOD() | InitNew ()
STDMETHOD() | InterfaceSupportsErrorInfo (REFIID riid)
STDMETHOD() | IsDirty ()
STDMETHOD() | Item (VARIANT *pIndex, VARIANT *pVal)
STDMETHOD() | Load (IStream *pStm)
STDMETHOD() | MarshalInterface (IStream *pStm, REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlFlags)
STDMETHOD() | ReleaseMarshalData (IStream *pStm)
STDMETHOD() | Remove (VARIANT *pIndex)
STDMETHOD() | Save (IStream *pStm, int fClearDirty)
STDMETHOD() | UnmarshalInterface (IStream *pStm, REFIID riid, void **ppv)

Private Member Functions

void | Clear ()

Private Attributes

bool | m_bRequiresSave
bstr2long m_IndexMap
long2bstr m_MapIndex
int | m_nGrow
int | m_nReserve
varvect m_VarVect

Detailed Description

Definition at line 19 of file dynamic.h.

Constructor & Destructor Documentation

CDynamic::CDynamic ( ) [inline]

Definition at line 29 of file dynamic.h.

  {
    Clear();
  }

CDynamic::~CDynamic ( ) [inline]

Definition at line 34 of file dynamic.h.

  {
  }

Member Function Documentation

STDMETHODIMP CDynamic::_NewEnum ( IUnknown ** ppunk )

Definition at line 81 of file dynamic.Cpp.

{
  // STL Vectors are held in contiguous memory - so
  // we can use CComEnum to get the items out - cool!
  if (pVal == NULL)
    return E_POINTER;
  *pVal = NULL;
  typedef CComObject<CComEnum<IEnumVARIANT, &IID_IEnumVARIANT, VARIANT, _Copy<VARIANT> > > enumvar;
  enumvar* pEnumVar = new enumvar;
  _ASSERTE(pEnumVar);
  HRESULT hRes = pEnumVar->Init(m_VarVect.begin(), m_VarVect.end(), NULL, AtlFlagCopy);
  if (SUCCEEDED(hRes))
    hRes = pEnumVar->QueryInterface(IID_IEnumVARIANT, (void**)pVal);
  if (FAILED(hRes))
    delete pEnumVar;
  return hRes;
}

STDMETHODIMP CDynamic::Add | ( | VARIANT * | pItem,
 |  | VARIANT * | pKey = &vtMissing,
 |  | VARIANT * | pBefore = &vtMissing,
 |  | VARIANT * | pAfter = &vtMissing
 | ) |  |

Definition at line 99 of file dynamic.Cpp.

{
  // create a CFastVariant and add it to the collection
  HRESULT hr = E_FAIL;
  long nDistance, nCount, nRemap;
  _bstr_t bstrKey;

  // STL is not thread-safe
  // so use a Critical Section to project
  // it's delecate structures
  Lock();

  if (pBefore->vt != VT_ERROR && pAfter->vt != VT_ERROR)
  {
    hr = DISP_E_BADPARAMCOUNT;
  }
  else
  {
    long nAdvance;
    _bstr_t bstrKeyIn;
    varvect::iterator it = m_VarVect.begin();
    int nCap = m_VarVect.capacity();
    if (nCap > m_nReserve)
    {
      m_nReserve += m_nGrow;
      m_VarVect.reserve(m_nReserve);
    }

    // Where in the vector should the new item go?
    if (pBefore->vt == VT_BSTR)
    {
      bstrKeyIn = pBefore->bstrVal;
      nAdvance = m_IndexMap[bstrKeyIn] - 1;
      std::advance(it, nAdvance);
    }
    else if (pAfter->vt == VT_BSTR)
    {
      bstrKeyIn = pAfter->bstrVal;
      nAdvance = m_IndexMap[bstrKeyIn];
      std::advance(it, nAdvance);
    }
    else
    {
      it = m_VarVect.end();
    }

    it = m_VarVect.insert(it, *pItem);
    nDistance = std::distance( m_VarVect.begin(), it) + 1;

    // If we don't have a key, just fabricate one from
    // the location in the vector.
    if (pKey->vt == VT_BSTR)
    {
      bstrKeyIn = pKey->bstrVal;
    }
    else
    {
      WCHAR wszKey[64];
      swprintf(wszKey, L"%lu", nDistance);
      bstrKeyIn = wszKey;
    }

    // Since we are adding a new entry to the vector,
    // we need to adjust all the affected items in the
    // lookup maps to compensate for the newly increase
    // index into the Vector.
    for (nCount = m_VarVect.size() - 1; nCount >= nDistance; nCount--)
    {
      bstrKey = m_MapIndex[nCount];
      nRemap = m_IndexMap[bstrKey] + 1;

      m_IndexMap[bstrKey] = nRemap;
      m_MapIndex.erase(nCount);
      m_MapIndex[nRemap] = bstrKey;
    }

    // Add the new entry into the Index Maps - there will be a newly
    // opened space in the logical sequence by the above code.
    m_IndexMap.insert(bstr2long::value_type(bstrKeyIn.copy(), nDistance));
    m_MapIndex.insert(long2bstr::value_type(nDistance, bstrKeyIn.copy()));
    m_bRequiresSave = true;
  }
  // Anyone else can play, now!
  Unlock();
  return S_OK;
}

void CDynamic::Clear ( ) [private]

Definition at line 9 of file dynamic.Cpp.

{
  m_nReserve = 50;
  m_nGrow = 50;
  m_bRequiresSave = false;

  m_VarVect.clear();
  m_IndexMap.clear();
  m_MapIndex.clear();

  m_VarVect.reserve(m_nReserve);
}

STDMETHODIMP CDynamic::Count ( long * pVal )

Definition at line 36 of file dynamic.Cpp.

{
  // STL is not thread-safe
  // so use a Critical Section to project
  // it's delecate structures
  Lock();

  if (pVal == NULL)
    return E_POINTER;
  *pVal = m_VarVect.size();

  // Anyone else can play, now!
  Unlock();
  return S_OK;
}

STDMETHOD() CDynamic::DisconnectObject ( DWORD dwReserved ) [inline]

Definition at line 105 of file dynamic.h.

  {
    // Proxy and Object are not connected -- nothing to do
    return E_NOTIMPL;
  }

STDMETHOD() CDynamic::GetClassID ( GUID * pClassID ) [inline]

Definition at line 114 of file dynamic.h.

  {
    if (pClassID == NULL)
      return E_POINTER;

    *pClassID = GetObjectCLSID();

    return S_OK;
  }

STDMETHOD() CDynamic::GetMarshalSizeMax | ( | REFIID | riid,
 |  | void * | pv,
 |  | DWORD | dwDestContext,
 |  | void * | pvDestContext,
 |  | DWORD | mshlFlags,
 |  | ULONG * | pSize |
 | ) |  |  | [inline]

Definition at line 68 of file dynamic.h.

  {
    _ULARGE_INTEGER ul;
    HRESULT hr;

    ul.LowPart = 0;
    ul.HighPart = 0;
    hr = GetSizeMax(&ul);

    if (SUCCEEDED(hr))
      *pSize = ul.LowPart;

    return hr;
  }

STDMETHOD() CDynamic::GetSizeMax ( _ULARGE_INTEGER * pCbSize ) [inline]

Definition at line 195 of file dynamic.h.

  {
    if (pCbSize == NULL)
      return E_POINTER;

    long nSize = 0, colCount = 0, n = 0;
    HRESULT hr = S_OK;
    VARIANT vItem;

    hr = Count(&colCount);

    nSize += sizeof((long)COLLECTION_VERSION); // version
    nSize += sizeof(colCount); // count
    nSize += sizeof(m_bRequiresSave); // save

    for (n = 1; n <= colCount; n++)
    {
      CFastVariant item(n);
      CFastVariant vKey((BSTR)m_MapIndex[n]);

      nSize += GetVariantSize(vKey);

      hr = Item(&item, &vItem);
      nSize += GetVariantSize(vItem);
      VariantClear(&vItem);
    }
    pCbSize->LowPart = nSize;
    return hr;
  }

STDMETHOD() CDynamic::GetUnmarshalClass | ( | REFIID | riid,
 |  | void * | pv,
 |  | DWORD | dwDestContext,
 |  | void * | pvDestContext,
 |  | DWORD | mshlFlags,
 |  | CLSID * | pCid |
 | ) |  |  | [inline]

Definition at line 62 of file dynamic.h.

  {
    *pCid = GetObjectCLSID();
    return S_OK;
  }

STDMETHOD() CDynamic::InitNew ( ) [inline]

Definition at line 225 of file dynamic.h.

  {
    long n;
    long count;
    HRESULT hr = S_OK;

    hr = Count(&count);
    if (SUCCEEDED(hr))
    {
      for (n=0;(n < count && SUCCEEDED(hr)); n++)
      {
        _variant_t vIndex(n);
        hr = Remove(&vIndex);
      }
      m_bRequiresSave = false;
    }
    return hr;
  }

STDMETHODIMP CDynamic::InterfaceSupportsErrorInfo ( REFIID riid )

Definition at line 22 of file dynamic.Cpp.

{
  static const IID* arr[] =
  {
    &IID_IEntity
  };
  for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++)
  {
    if (::InlineIsEqualGUID(*arr[i],riid))
      return S_OK;
  }
  return S_FALSE;
}

STDMETHOD() CDynamic::IsDirty ( void ) [inline]

Definition at line 124 of file dynamic.h.

  {
    HRESULT hr = S_FALSE;

    if (m_bRequiresSave)
    {
      hr = S_OK;
    }
    return hr;
  }

STDMETHODIMP CDynamic::Item | ( | VARIANT * | pIndex,
 |  | VARIANT * | pVal
 | ) |  |

Definition at line 52 of file dynamic.Cpp.

{
  if (pVal == NULL)
    return E_POINTER;

  long nIndex = 0;

  pVal->vt = VT_EMPTY;
  pVal->punkVal = NULL;

  // How are we being addressed - by key or by index?
  if (pIndex->vt == VT_BSTR)
  {
    _bstr_t bstrKey(pIndex->bstrVal);
    nIndex = m_IndexMap[bstrKey];
  }
  else // by index
  {
    _variant_t varIndex(pIndex);
    nIndex = (long)varIndex;
  }

  // use 1-based index, VB like
  if (((long)nIndex < 1) || ((long)nIndex > (m_VarVect.size())))
    return E_INVALIDARG;
  VariantCopy(pVal, &m_VarVect[(long)nIndex-1]);
  return S_OK;
}

STDMETHOD() CDynamic::Load ( IStream * pStm ) [inline]

Definition at line 135 of file dynamic.h.

  {
    long nSize = 0, colCount = 0, n = 0, nVer = 0;
    HRESULT hr = S_OK;

    hr = Count(&colCount);

    *pStm >> (long)nVer; // version

    if (nVer < COLLECTION_VERSION)
      return STG_E_OLDFORMAT;

    *pStm >> colCount; // count
    *pStm >> m_bRequiresSave; // count

    for (n = 1; (n <= colCount && SUCCEEDED(hr)); n++)
    {
      CFastVariant v;
      CFastVariant vKey;

      *pStm >> vKey;

      hr = v.ReadFromStream(pStm);
      if (SUCCEEDED(hr))
        hr = Add(&v, &vKey);
    }

    return hr;
  }

STDMETHOD() CDynamic::MarshalInterface | ( | IStream * | pStm,
 |  | REFIID | riid,
 |  | void * | pv,
 |  | DWORD | dwDestContext,
 |  | void * | pvDestContext,
 |  | DWORD | mshlFlags |
 | ) |  |  | [inline]

Definition at line 83 of file dynamic.h.

  {
    return Save(pStm, FALSE);
  }

STDMETHOD() CDynamic::ReleaseMarshalData ( IStream * pStm ) [inline]

Definition at line 99 of file dynamic.h.

  {
    // Nothing to do
    return E_NOTIMPL;
  }

STDMETHODIMP CDynamic::Remove ( VARIANT * pIndex )

Definition at line 186 of file dynamic.Cpp.

{
  // STL is not thread-safe
  // so use a Critical Section to project
  // it's delecate structures
  Lock();

  // create a CFastVariant and add it to the collection
  long nIndex, nCount, nRemap;
  _bstr_t bstrKey;
  varvect::iterator it = m_VarVect.begin();

  if (pItem->vt == VT_BSTR)
  {
    _bstr_t bstrKey(pItem->bstrVal);
    nIndex = m_IndexMap[bstrKey];
  }
  else
  {
    _variant_t varIndex(pItem);
    nIndex = (long)varIndex;
  }

  // Remove the item from the vector,
  // and delete it's index map entries
  std::advance(it, nIndex - 1);
  m_VarVect.erase(it);
  bstrKey = m_MapIndex[nIndex];
  m_MapIndex.erase(nIndex);
  m_IndexMap.erase(bstrKey);

  // Since we are removing an entry from the vector,
  // we need to adjust all the affected items in the
  // lookup maps to compensate for the newly decreased
  // index into the Vector.
  for (nCount = nIndex + 1; nCount <= m_VarVect.size(); nCount++)
  {
    bstrKey = m_MapIndex[nCount];
    nRemap = m_IndexMap[bstrKey];

    m_IndexMap[bstrKey] = nRemap - 1;
    m_MapIndex.erase(nCount);
    m_MapIndex[nRemap-1] = bstrKey;
  }
  m_bRequiresSave = true;

  Unlock();
  return S_OK;
}

STDMETHOD() CDynamic::Save | ( | IStream * | pStm,
 |  | int | fClearDirty |
 | ) |  |  | [inline]

Definition at line 165 of file dynamic.h.

  {
    long nSize = 0, colCount = 0, n = 0;
    HRESULT hr = S_OK;

    hr = Count(&colCount);

    *pStm << (long)COLLECTION_VERSION; // version
    *pStm << colCount; // count
    *pStm << m_bRequiresSave; // save

    for (n = 1; (n <= colCount && SUCCEEDED(hr)); n++)
    {
      CFastVariant v;
      CFastVariant item(n);
      CFastVariant vKey;

      hr = Item(&item, &v);
      vKey = (LPCWSTR)m_MapIndex[n];
      *pStm << vKey;

      hr = v.WriteToStream(pStm);
    }

    if (fClearDirty)
      m_bRequiresSave = false;

    return hr;
  }

STDMETHOD() CDynamic::UnmarshalInterface | ( | IStream * | pStm,
 |  | REFIID | riid,
 |  | void ** | ppv |
 | ) |  |  | [inline]

Definition at line 88 of file dynamic.h.

  {
    HRESULT hr = Load(pStm);

    if (SUCCEEDED(hr))
    {
      hr = QueryInterface(riid, ppv);
    }
    return hr;
  }

Member Data Documentation

bool CDynamic::m_bRequiresSave [private]

Definition at line 249 of file dynamic.h.

bstr2long CDynamic::m_IndexMap [private]

Definition at line 247 of file dynamic.h.

long2bstr CDynamic::m_MapIndex [private]

Definition at line 248 of file dynamic.h.

int CDynamic::m_nGrow [private]

Definition at line 250 of file dynamic.h.

int CDynamic::m_nReserve [private]

Definition at line 251 of file dynamic.h.

varvect CDynamic::m_VarVect [private]

Definition at line 246 of file dynamic.h.

The documentation for this class was generated from the following files:
  • Com/Tools/EntityProxy/DataServices/dynamic.h
  • Com/Tools/EntityProxy/DataServices/dynamic.Cpp
Generated on Wed Nov 13 2024 16:56:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CDynamicResultset Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CDynamicResultset Class Reference

#include "resultset.h"

List of all members.

Public Member Functions

STDMETHOD_ (ULONG, Release)()

Detailed Description

Definition at line 282 of file resultset.h.

Member Function Documentation

CDynamicResultset::STDMETHOD_ | ( | ULONG | ,
 |  | Release |  |
 | ) |  |  | [inline]

Definition at line 285 of file resultset.h.

  {
    ULONG l = InternalRelease();
    if (l == 0)
      delete this;
    return 1;
  }

The documentation for this class was generated from the following file:
  • Com/Tools/EntityProxy/DataServices/resultset.h
Generated on Wed Nov 13 2024 16:56:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CEapCfg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CEapCfg Class Reference

#include "CeapCfg.h"

List of all members.

Public Member Functions

CEapCfg ()
DeclareIEAPProviderConfigMembers (IMPL)

Detailed Description

Definition at line 33 of file CeapCfg.h.

Constructor & Destructor Documentation

CEapCfg::CEapCfg ( ) [inline]

Definition at line 39 of file CeapCfg.h.

{}

Member Function Documentation

CEapCfg::DeclareIEAPProviderConfigMembers ( IMPL )
The documentation for this class was generated from the following file:
  • NetDS/RRas/Eap/CeapCfg.h
Generated on Wed Nov 13 2024 16:56:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CEditBoxLite Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CEditBoxLite Class Reference

#include "cdialoglite.h"

Inherits CSplitterLite.

Inherited by CRichEditLite.

List of all members.

Public Member Functions

CEditBoxLite (HWND hWndParent=NULL, UINT nID=0)
virtual | ~CEditBoxLite ()
BOOL CanPaste ()
void | Copy ()
void | Cut ()
INDEX | GetLine (INDEX iLine, CHAR *pszBuffer, ULONG ulMaxSize)
INDEX GetLineCount ()
virtual BOOL | GetSel (INDEX *piMin, INDEX *piMax)
virtual BOOL | GetSel (CHARRANGE *pcr)
INDEX | GetTextRange (CHARRANGE &cr, WCHAR *pwszBuffer)
INDEX | GetTextRange (CHARRANGE &cr, CHAR *pszBuffer)
INDEX | LineIndex (INDEX nLine)
INDEX | LineLength (INDEX nStartChar)
void | LineScroll (INDEX nLines, INDEX nChars=0)
virtual BOOL | OnCreate (CREATESTRUCT *pCREATESTRUCT)
void | Paste ()
virtual void | ReplaceAll (LPCWSTR pwszString, bool bReplaceAll=FALSE, bool fHighlight=FALSE)
virtual void | ReplaceSel (LPCWSTR pwszString, bool bCanUndo)
BOOL | Save (LPCWSTR pwszFileName)
BOOL ScrollCaret ()
LRESULT | SetOptions (UINT dwOptions, UINT fOperation=ECOOP_OR)
BOOL | SetReadOnly (bool bReadOnly)
virtual void | SetSel (INDEX iMin, INDEX iMax)

Detailed Description

Definition at line 403 of file cdialoglite.h.

Constructor & Destructor Documentation

CEditBoxLite::CEditBoxLite | ( | HWND | hWndParent = NULL,
 |  | UINT | nID = 0
 | ) |  |

Definition at line 2156 of file cdialoglite.cpp.

  : CSplitterLite(hWndParent, nID)
{
}

CEditBoxLite::~CEditBoxLite ( ) [virtual]

Definition at line 2166 of file cdialoglite.cpp.

{
}

Member Function Documentation

BOOL CEditBoxLite::CanPaste ( ) [inline]

Definition at line 425 of file cdialoglite.h.

{ return (BOOL)SendMessage(m_hWnd, EM_CANPASTE, 0, 0);                      }

void CEditBoxLite::Copy ( ) [inline]

Definition at line 427 of file cdialoglite.h.

{ SendMessage(m_hWnd, WM_COPY, 0, 0);                             }

void CEditBoxLite::Cut ( ) [inline]

Definition at line 426 of file cdialoglite.h.

{ SendMessage(m_hWnd, WM_CUT, 0, 0);                              }

INDEX CEditBoxLite::GetLine | ( | INDEX | iLine,
 |  | CHAR * | pszBuffer,
 |  | ULONG | ulMaxSize
 | ) |  |

Definition at line 2253 of file cdialoglite.cpp.

{
  ASSERT(pszBuffer && ulMaxSize);

  //Get the Text for this Line
  //EM_GETLINE assumes the first byte of the buffer
  //indicates the total size of the buffer
  ((WORD*)pszBuffer)[0] = (WORD)(ulMaxSize-1);
  INDEX iChars = (INDEX)SendMessage(m_hWnd, EM_GETLINE, iLine, (LPARAM)pszBuffer);

  //Supposedly EM_GETLINE doesn't contain a NULL Terminator?!
  pszBuffer[min((ULONG)iChars, ulMaxSize)] = EOL;
  return iChars;
}

INDEX CEditBoxLite::GetLineCount ( ) [inline]

Definition at line 434 of file cdialoglite.h.

{ return (INDEX)SendMessage(m_hWnd, EM_GETLINECOUNT, 0, 0);                   }

virtual BOOL CEditBoxLite::GetSel | ( | INDEX * | piMin,
 |  | INDEX * | piMax |
 | ) |  |  | [inline, virtual]

Definition at line 415 of file cdialoglite.h.

{ CHARRANGE cr; BOOL bReturn = GetSel(&cr); if(piMin) *piMin = cr.cpMin;  if(piMax) *piMax = cr.cpMax; return bReturn;    }

virtual BOOL CEditBoxLite::GetSel ( CHARRANGE * pcr ) [inline, virtual]

Definition at line 416 of file cdialoglite.h.

{ ASSERT(pcr); SendMessageA(m_hWnd, EM_GETSEL, (WPARAM)&pcr->cpMin, (LPARAM)&pcr->cpMax); return pcr->cpMin != pcr->cpMax;  }

INDEX CEditBoxLite::GetTextRange | ( | CHARRANGE & | cr,
 |  | WCHAR * | pwszBuffer
 | ) |  |

Definition at line 2189 of file cdialoglite.cpp.

{
  //With EM_GETTEXTRANGE (Since their is not a W-unicode and A-ansi version), the message
  //is completly based upon how you created the window.  Since we currently only
  //call this from CreateIndirect (ANSI) we just assume this...
  if(m_bUnicodeMsg)
  {
    TEXTRANGEW tr;
    tr.chrg = cr;
    tr.lpstrText = pwszBuffer;

    return (INDEX)::SendMessage(m_hWnd, EM_GETTEXTRANGE, 0, (LPARAM)&tr);
  }
  else
  {
    CHAR szBuffer[MAX_QUERY_LEN] = {0};

    TEXTRANGEA tr;
    tr.chrg = cr;
    tr.lpstrText = szBuffer;

    INDEX lReturn = (INDEX)::SendMessage(m_hWnd, EM_GETTEXTRANGE, 0, (LPARAM)&tr);
    ConvertToWCHAR(szBuffer, pwszBuffer, cr.cpMax - cr.cpMin);
    return lReturn;
  }
}

INDEX CEditBoxLite::GetTextRange | ( | CHARRANGE & | cr,
 |  | CHAR * | pszBuffer
 | ) |  |

Definition at line 2221 of file cdialoglite.cpp.

{
  //With EM_GETTEXTRANGE (Since their is not a W-unicode and A-ansi version), the message
  //is completly based upon how you created the window.  Since we currently only
  //call this from CreateIndirect (ANSI) we just assume this...
  if(m_bUnicodeMsg)
  {
    WCHAR wszBuffer[MAX_QUERY_LEN] = {0};

    TEXTRANGEW tr;
    tr.chrg = cr;
    tr.lpstrText = wszBuffer;

    INDEX lReturn = (INDEX)::SendMessage(m_hWnd, EM_GETTEXTRANGE, 0, (LPARAM)&tr);
    ConvertToMBCS(wszBuffer, pszBuffer, cr.cpMax - cr.cpMin);
    return lReturn;
  }
  else
  {
    TEXTRANGEA tr;
    tr.chrg = cr;
    tr.lpstrText = pszBuffer;

    return (INDEX)::SendMessage(m_hWnd, EM_GETTEXTRANGE, 0, (LPARAM)&tr);
  }
}

INDEX CEditBoxLite::LineIndex ( INDEX nLine ) [inline]

Definition at line 420 of file cdialoglite.h.

{ return (INDEX)SendMessage(m_hWnd, EM_LINEINDEX, nLine, 0);                  }

INDEX CEditBoxLite::LineLength ( INDEX nStartChar ) [inline]

Definition at line 421 of file cdialoglite.h.

{ return (INDEX)SendMessage(m_hWnd, EM_LINELENGTH, nStartChar, 0);                }

void CEditBoxLite::LineScroll | ( | INDEX | nLines,
 |  | INDEX | nChars = 0 |
 | ) |  |  | [inline]

Definition at line 422 of file cdialoglite.h.

{ SendMessage(m_hWnd, EM_LINESCROLL, nChars, nLines);                     }

BOOL CEditBoxLite::OnCreate ( CREATESTRUCT * pCREATESTRUCT ) [virtual]

Reimplemented from CWndLite.

Definition at line 2175 of file cdialoglite.cpp.

{
  //SubClass the window
  SubClassWindow(WndProc);

  //Delegate
  return CSplitterLite::OnCreate(pCREATESTRUCT);
}

void CEditBoxLite::Paste ( ) [inline]

Definition at line 428 of file cdialoglite.h.

{ SendMessage(m_hWnd, WM_PASTE, 0, 0);                              }

void CEditBoxLite::ReplaceAll | ( | LPCWSTR | pwszString,
 |  | bool | bReplaceAll = FALSE,
 |  | bool | fHighlight = FALSE |
 | ) |  |  | [virtual]

Definition at line 2304 of file cdialoglite.cpp.

{
  if(pwszString)
  {
    INDEX iStartPos = 0;
    INDEX iStartPos2 = 0;
    INDEX iEndPos = 0;
    INDEX iEndPos2 = 0;

    if(bReplaceAll)
    {
      //Replace the entire text?
      SetSel(0, -1);
    }
    else
    {
      //Obtain the Selected Text Start and End Positions
      GetSel(&iStartPos, &iEndPos);
    }

    //Replace the Selection
    ReplaceSel(pwszString, TRUE/*fCanUndo*/);

    //Make sure the replacement is visible...
    ScrollCaret();

    if(bHighlight)
    {
      if(bReplaceAll)
      {
        //Highlight all the text...
        SetSel(0, -1);
      }
      else
      {
        //Highlight the text we used...
        GetSel(&iStartPos2, &iEndPos2);
        SetSel(iStartPos, iEndPos2);
      }
    }
  }
}

virtual void CEditBoxLite::ReplaceSel | ( | LPCWSTR | pwszString,
 |  | bool | bCanUndo |
 | ) |  |  | [inline, virtual]

Definition at line 431 of file cdialoglite.h.

{ wSendMessage(m_hWnd, EM_REPLACESEL, (WPARAM)bCanUndo, (WCHAR*)pwszString);          }

BOOL CEditBoxLite::Save ( LPCWSTR pwszFileName )

Definition at line 2273 of file cdialoglite.cpp.

{
  CFileLite cFile;
  CHAR szBuffer[MAX_QUERY_LEN];

  //Open the file, (prompt if error)
  if(FAILED(cFile.Open(pwszFileName, GENERIC_WRITE, 0, CREATE_ALWAYS, TRUE)))
    return FALSE;

  //Loop over all lines in the RichEdit control and write to the file...
  //Copy the contents of this ListBox to the destination...
  INDEX iCount = GetLineCount();
  for(INDEX i=0; i<iCount; i++)
  {
    //Get this line from the Control
    if(!GetLine(i, szBuffer, MAX_NAME_LEN))
      break;

    //Blast it to the file...
    cFile.Write(szBuffer);
    cFile.Write(wWndEOL);
  }

  return TRUE;
}

BOOL CEditBoxLite::ScrollCaret ( ) [inline]

Definition at line 429 of file cdialoglite.h.

{ return (BOOL)SendMessage(m_hWnd, EM_SCROLLCARET, 0, 0);                   }

LRESULT CEditBoxLite::SetOptions | ( | UINT | dwOptions,
 |  | UINT | fOperation = ECOOP_OR |
 | ) |  |  | [inline]

Definition at line 423 of file cdialoglite.h.

{ return SendMessage(m_hWnd, EM_SETOPTIONS, fOperation, dwOptions);               }

BOOL CEditBoxLite::SetReadOnly ( bool bReadOnly ) [inline]

Definition at line 419 of file cdialoglite.h.

{ return (BOOL)SendMessage(m_hWnd, EM_SETREADONLY, bReadOnly, 0L);                }

virtual void CEditBoxLite::SetSel | ( | INDEX | iMin,
 |  | INDEX | iMax |
 | ) |  |  | [inline, virtual]

Definition at line 414 of file cdialoglite.h.

{ SendMessage(m_hWnd, EM_SETSEL, (WPARAM)iMin, (LPARAM)iMax); }

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialoglite.h
  • Dataaccess/oledb/rowsetviewer/cdialoglite.cpp
Generated on Wed Nov 13 2024 16:56:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CEditSessionBase Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes | Private Attributes

CEditSessionBase Class Reference

#include "editsess.h"

Inherited by CCompositionEditSession, CFlipDocEditSession, CFlipEditSession, CHelloEditSession, CKeystrokeEditSession, CKeystrokeEditSession, CPropertyEditSession, CTerminateCompositionEditSession, and CUpdateTextEditSession.

List of all members.

Public Member Functions

CEditSessionBase (ITfContext *pContext)
CEditSessionBase (ITfContext *pContext)
virtual | ~CEditSessionBase ()
virtual | ~CEditSessionBase ()
virtual STDMETHODIMP | DoEditSession (TfEditCookie ec)=0
virtual STDMETHODIMP | DoEditSession (TfEditCookie ec)=0
STDMETHODIMP | QueryInterface (REFIID riid, void **ppvObj)
STDMETHODIMP | QueryInterface (REFIID riid, void **ppvObj)
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP_ (ULONG) Release(void)

Protected Attributes

ITfContext * | _pContext

Private Attributes

LONG | _cRef

Detailed Description

Definition at line 10 of file editsess.h.

Constructor & Destructor Documentation

CEditSessionBase::CEditSessionBase ( ITfContext * pContext ) [inline]

Definition at line 13 of file editsess.h.

    {
        _cRef = 1;
        _pContext = pContext;
        _pContext->AddRef();
    }

virtual CEditSessionBase::~CEditSessionBase ( ) [inline, virtual]

Definition at line 19 of file editsess.h.

    {
        _pContext->Release();
    }

CEditSessionBase::CEditSessionBase ( ITfContext * pContext ) [inline]

Definition at line 13 of file editsess.h.

    {
        _cRef = 1;
        _pContext = pContext;
        _pContext->AddRef();
    }

virtual CEditSessionBase::~CEditSessionBase ( ) [inline, virtual]

Definition at line 19 of file editsess.h.

    {
        _pContext->Release();
    }

Member Function Documentation

virtual STDMETHODIMP CEditSessionBase::DoEditSession ( TfEditCookie ec ) [pure virtual]

Implemented in CFlipDocEditSession, CFlipEditSession, CHelloEditSession, CKeystrokeEditSession, CUpdateTextEditSession, CCompositionEditSession, CTerminateCompositionEditSession, CKeystrokeEditSession, and CPropertyEditSession.

virtual STDMETHODIMP CEditSessionBase::DoEditSession ( TfEditCookie ec ) [pure virtual]

Implemented in CFlipDocEditSession, CFlipEditSession, CHelloEditSession, CKeystrokeEditSession, CUpdateTextEditSession, CCompositionEditSession, CTerminateCompositionEditSession, CKeystrokeEditSession, and CPropertyEditSession.

STDMETHODIMP CEditSessionBase::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppvObj |
 | ) |  |  | [inline]

Definition at line 25 of file editsess.h.

    {
        if (ppvObj == NULL)
            return E_INVALIDARG;

        *ppvObj = NULL;

        if (IsEqualIID(riid, IID_IUnknown) ||
            IsEqualIID(riid, IID_ITfEditSession))
        {
            *ppvObj = (ITfLangBarItemButton *)this;
        }

        if (*ppvObj)
        {
            AddRef();
            return S_OK;
        }

        return E_NOINTERFACE;
    }

STDMETHODIMP CEditSessionBase::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppvObj |
 | ) |  |  | [inline]

Definition at line 25 of file editsess.h.

    {
        if (ppvObj == NULL)
            return E_INVALIDARG;

        *ppvObj = NULL;

        if (IsEqualIID(riid, IID_IUnknown) ||
            IsEqualIID(riid, IID_ITfEditSession))
        {
            *ppvObj = (ITfLangBarItemButton *)this;
        }

        if (*ppvObj)
        {
            AddRef();
            return S_OK;
        }

        return E_NOINTERFACE;
    }

CEditSessionBase::STDMETHODIMP_ ( ULONG ) [inline]

Definition at line 50 of file editsess.h.

    {
        LONG cr = --_cRef;

        assert(_cRef >= 0);

        if (_cRef == 0)
        {
            delete this;
        }

        return cr;
    }

CEditSessionBase::STDMETHODIMP_ ( ULONG ) [inline]

Definition at line 46 of file editsess.h.

    {
        return ++_cRef;
    }

CEditSessionBase::STDMETHODIMP_ ( ULONG ) [inline]

Definition at line 50 of file editsess.h.

    {
        LONG cr = --_cRef;

        assert(_cRef >= 0);

        if (_cRef == 0)
        {
            delete this;
        }

        return cr;
    }

CEditSessionBase::STDMETHODIMP_ ( ULONG ) [inline]

Definition at line 46 of file editsess.h.

    {
        return ++_cRef;
    }

Member Data Documentation

LONG CEditSessionBase::_cRef [private]

Definition at line 71 of file editsess.h.

ITfContext * CEditSessionBase::_pContext [protected]

Definition at line 68 of file editsess.h.

The documentation for this class was generated from the following files:
  • WinUI/TSFcase/editsess.h
  • WinUI/TSFmark/editsess.h
Generated on Wed Nov 13 2024 16:56:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CEditValueDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CEditValueDlg Class Reference

#include "cdialog.h"

Inherits CDialogLite.

List of all members.

Public Member Functions

CEditValueDlg (UINT nID, WCHAR *pwszTitle)
virtual | ~CEditValueDlg ()
virtual WCHAR * | GetValue ()
virtual HRESULT | GetVariant (DBTYPE wType, VARIANT *pVariant)
virtual BOOL | OnInitDialog ()
virtual BOOL | OnOK ()
virtual void | SetReqType (DBTYPE wType)
virtual void | SetValue (WCHAR *pwszValue)
virtual HRESULT | SetVariant (VARIANT *pVariant)

Protected Attributes

CRichEditLite m_editValue
WCHAR * | m_pwszTitle
WCHAR * | m_pwszValue
DBTYPE | m_wReqType

Detailed Description

Definition at line 173 of file cdialog.h.

Constructor & Destructor Documentation

CEditValueDlg::CEditValueDlg | ( | UINT | nID,
 |  | WCHAR * | pwszTitle
 | ) |  |

Definition at line 5181 of file cdialog.cpp.

  : CDialogLite(nID)
{
  ASSERT(pwszTitle);

  //Title
  m_pwszTitle   = pwszTitle;

  //String
  m_pwszValue   = NULL;
  m_wReqType    = DBTYPE_WSTR;
}

CEditValueDlg::~CEditValueDlg ( ) [virtual]

Definition at line 5199 of file cdialog.cpp.

{
  //Value
  SAFE_FREE(m_pwszValue);
}

Member Function Documentation

virtual WCHAR* CEditValueDlg::GetValue ( ) [inline, virtual]

Definition at line 186 of file cdialog.h.

{ return m_pwszValue;     }

HRESULT CEditValueDlg::GetVariant | ( | DBTYPE | wType,
 |  | VARIANT * | pVariant |
 | ) |  |  | [virtual]

Definition at line 5288 of file cdialog.cpp.

{
  ASSERT(pVariant);
  ASSERT(m_wReqType);

  return StringToVariant(m_pwszValue, wType, pVariant);
}

BOOL CEditValueDlg::OnInitDialog ( ) [virtual]

Reimplemented from CDialogLite.

Definition at line 5210 of file cdialog.cpp.

{
  CWaitCursor waitCursor;

  //Update Title and Window
  SetWindowText(m_pwszTitle);

  //Setup the Value
  m_editValue.CreateIndirect(m_hWnd, IDE_VALUE);
  if(m_pwszValue)
    m_editValue.SetWindowText(m_pwszValue);

  //Delegate
  CenterDialog(m_hWnd);
  return CDialogLite::OnInitDialog();
}

BOOL CEditValueDlg::OnOK ( ) [virtual]

Reimplemented from CDialogLite.

Definition at line 5232 of file cdialog.cpp.

{
  CWaitCursor waitCursor;

  if(m_wReqType)
  {
    //Obtain the value argument
    SAFE_FREE(m_pwszValue);
    m_pwszValue = m_editValue.GetWindowText();

    //Need to validate (and obtain) the value, so we know it can be converted to the requested type.
    //If not then do not continue (return FALSE), so the user gets another chance
    //to correct the value...
    if(m_wReqType != DBTYPE_WSTR)
    {
      CVariant cVariant;
      if(FAILED(StringToVariant(m_pwszValue, m_wReqType, &cVariant)))
      {
        wMessageBox(m_editValue.m_hWnd, MB_TASKMODAL | MB_ICONERROR | MB_OK,  wsz_ERROR,
          L"Unable to convert specified string \"%s\", to %s", m_pwszValue, GetDBTypeName(m_wReqType));
        m_editValue.SetFocus();
        return FALSE;
      }
    }
  }

  //Delegate
  return CDialogLite::OnOK();
}

virtual void CEditValueDlg::SetReqType ( DBTYPE wType ) [inline, virtual]

Definition at line 187 of file cdialog.h.

{ m_wReqType = wType;     }

virtual void CEditValueDlg::SetValue ( WCHAR * pwszValue ) [inline, virtual]

Definition at line 185 of file cdialog.h.

{ SAFE_FREE(m_pwszValue); m_pwszValue = wcsDuplicate(pwszValue);  }

HRESULT CEditValueDlg::SetVariant ( VARIANT * pVariant ) [virtual]

Definition at line 5267 of file cdialog.cpp.

{
  HRESULT hr = S_OK;
  ASSERT(pVariant);
  CVariant cVariant;

  //Make sure we can convert to a string value
  hr = cVariant.ChangeType(DBTYPE_BSTR, pVariant);
  if(SUCCEEDED(hr))
  {
    ASSERT(cVariant.vt == VT_BSTR);
    SetValue(V_BSTR(&cVariant));
  }
  return hr;
}

Member Data Documentation

CRichEditLite CEditValueDlg::m_editValue [protected]

Definition at line 202 of file cdialog.h.

WCHAR* CEditValueDlg::m_pwszTitle [protected]

Definition at line 195 of file cdialog.h.

WCHAR* CEditValueDlg::m_pwszValue [protected]

Definition at line 198 of file cdialog.h.

DBTYPE CEditValueDlg::m_wReqType [protected]

Definition at line 199 of file cdialog.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialog.h
  • Dataaccess/oledb/rowsetviewer/cdialog.cpp
Generated on Wed Nov 13 2024 16:56:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CellData Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

CellData Struct Reference

#include "table.h"

List of all members.

Public Attributes

DWORD flags
int | nchars
Props props
LPSTR ptext
LPWSTR | pwzText

Detailed Description

Definition at line 247 of file table.h.

Member Data Documentation

DWORD CellData::flags

Definition at line 251 of file table.h.

int CellData::nchars

Definition at line 248 of file table.h.

Props CellData::props

Definition at line 250 of file table.h.

LPSTR CellData::ptext

Definition at line 249 of file table.h.

LPWSTR CellData::pwzText

Definition at line 252 of file table.h.

The documentation for this struct was generated from the following file:
  • Begin/sdkdiff/table.h
Generated on Wed Nov 13 2024 16:56:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CellDataList Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

CellDataList Struct Reference

#include "table.h"

List of all members.

Public Attributes

DWORD_PTR | id
int | ncells
lpCellData plist
long | row
int | startcell

Detailed Description

Definition at line 256 of file table.h.

Member Data Documentation

DWORD_PTR CellDataList::id

Definition at line 257 of file table.h.

int CellDataList::ncells

Definition at line 260 of file table.h.

lpCellData CellDataList::plist

Definition at line 261 of file table.h.

long CellDataList::row

Definition at line 258 of file table.h.

int CellDataList::startcell

Definition at line 259 of file table.h.

The documentation for this struct was generated from the following file:
  • Begin/sdkdiff/table.h
Generated on Wed Nov 13 2024 16:56:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CellPos Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

CellPos Struct Reference

#include "table.h"

List of all members.

Public Attributes

int | clipend
int | clipstart
int | size
int | start

Detailed Description

Definition at line 301 of file table.h.

Member Data Documentation

int CellPos::clipend

Definition at line 304 of file table.h.

int CellPos::clipstart

Definition at line 303 of file table.h.

int CellPos::size

Definition at line 305 of file table.h.

int CellPos::start

Definition at line 302 of file table.h.

The documentation for this struct was generated from the following file:
  • Begin/sdkdiff/table.h
Generated on Wed Nov 13 2024 16:56:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CEmptyVolumeCache Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CEmptyVolumeCache Class Reference

#include "EmptyVolumeCache.h"

List of all members.

Public Member Functions

CEmptyVolumeCache ()
~CEmptyVolumeCache ()
STDMETHODIMP | Deactivate (LPDWORD pdwFlags)
STDMETHODIMP | GetSpaceUsed (DWORDLONG *pdwSpaceUsed, IEmptyVolumeCacheCallBack *picb)
STDMETHODIMP | Initialize (HKEY hKey, LPCWSTR pcwszVolume, LPWSTR *ppwszDisplayName, LPWSTR *ppwszDescription, DWORD *pdwFlags)
STDMETHODIMP | InitializeEx (HKEY hKey, LPCWSTR pcwszVolume, LPCWSTR pcwszKeyName, LPWSTR *ppwszDisplayName, LPWSTR *ppwszDescription, LPWSTR *ppwszBtnText, DWORD *pdwFlags)
STDMETHODIMP | Purge (DWORDLONG dwSpaceToFree, IEmptyVolumeCacheCallBack *picb)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppvObject)
STDMETHODIMP | ShowProperties (HWND hWnd)
STDMETHODIMP_ (ULONG) AddRef(VOID)
STDMETHODIMP_ (ULONG) Release(VOID)

Private Attributes

ULONG m_nRefCount

Detailed Description

Definition at line 23 of file EmptyVolumeCache.h.

Constructor & Destructor Documentation

CEmptyVolumeCache::CEmptyVolumeCache ( )

Definition at line 24 of file EmptyVolumeCache.Cpp.

{
    m_nRefCount = 0;
    nDllRefCount++;
}

CEmptyVolumeCache::~CEmptyVolumeCache ( )

Definition at line 30 of file EmptyVolumeCache.Cpp.

{
    nDllRefCount--;
}

Member Function Documentation

STDMETHODIMP CEmptyVolumeCache::Deactivate ( LPDWORD pdwFlags )

Definition at line 91 of file EmptyVolumeCache.Cpp.

{
    //
    //  The disk cleanup manager is shutting down. Set any
    //  appropriate flags and return
    //
    *pdwFlags = 0;
    return S_OK;
}

STDMETHODIMP CEmptyVolumeCache::GetSpaceUsed | ( | DWORDLONG * | pdwSpaceUsed,
 |  | IEmptyVolumeCacheCallBack * | picb
 | ) |  |

Definition at line 102 of file EmptyVolumeCache.Cpp.

{
    //
    //  Determine the amount of disk space our cleanup handler can
    //  free.
    //
    //  In this sample, we will make up a bogus size by determining
    //  the total size of the files in the Windows directory.
    //
    //  bUpdateProgress is used to determine if GetSpaceUsed should
    //  call IEmptyVolumeCacheCallback::ScanProgress. If picb is
    //  NULL, ScanProgress is not called.
    //
    BOOL bUpdateProgress = (picb != NULL);
    WIN32_FIND_DATA wfd;
    HANDLE hFind = NULL;
    HRESULT hResult = S_FALSE;
    TCHAR szWindowsDir[MAX_PATH];
    *pdwSpaceUsed = 0;

    GetWindowsDirectory (szWindowsDir, MAX_PATH);
    PathAppend (szWindowsDir, TEXT("*.*"));

    if ((hFind = FindFirstFile (szWindowsDir, &wfd)) == INVALID_HANDLE_VALUE)
        goto done;

    do
    {
        hResult = S_OK;
        if (!(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
        {
            *pdwSpaceUsed += MAKEDWORDLONG(wfd.nFileSizeHigh, wfd.nFileSizeLow);
            if (bUpdateProgress)
                hResult = picb->ScanProgress (*pdwSpaceUsed, 0, NULL);
        }
    } while (FindNextFile (hFind, &wfd) && hResult == S_OK);

    if (hResult == S_OK)
        if (bUpdateProgress)
            picb->ScanProgress (*pdwSpaceUsed, EVCCBF_LASTNOTIFICATION, NULL);
    FindClose (hFind);

done:
    return hResult;
}

STDMETHODIMP CEmptyVolumeCache::Initialize | ( | HKEY | hKey,
 |  | LPCWSTR | pcwszVolume,
 |  | LPWSTR * | ppwszDisplayName,
 |  | LPWSTR * | ppwszDescription,
 |  | DWORD * | pdwFlags
 | ) |  |

Definition at line 150 of file EmptyVolumeCache.Cpp.

{
    //
    //  The disk cleanup handler is being initialized. Allocate
    //  memory for the Display Name and Description strings using
    //  the task's memory allocator. These strings will be freed by
    //  the disk cleanup manager. Also, set any appropriate flags
    //  for the disk cleanup handler.
    //
    //  If the EVCF_SETTINGSMODE flag is set, Initialize/InitializeEx
    //  is responsible for deleting files.
    //
    HRESULT hResult = NOERROR;

    //
    //  We may need to delete the files here if EVCF_SETTINGSMODE is set.
    //
    if (*pdwFlags & EVCF_SETTINGSMODE)
    {
        DWORDLONG dwSpaceUsed = 0;

        GetSpaceUsed (&dwSpaceUsed, NULL);
        Purge (dwSpaceUsed, NULL);
    }

    //
    //  Load the Display Name text
    //
    *ppwszDisplayName = (LPWSTR) CoTaskMemAlloc (MAX_DISPLAY_LEN * sizeof (WCHAR));
    if (*ppwszDisplayName)
    {
#ifdef UNICODE
        LoadString (hDllInstance, IDS_DISPLAY, *ppwszDisplayName, MAX_DISPLAY_LEN);
#else
        CHAR szDisplayName[MAX_DISPLAY_LEN];
        LoadString (hDllInstance, IDS_DISPLAY, szDisplayName, MAX_DISPLAY_LEN);
        MultiByteToWideChar (CP_ACP, 0, szDisplayName, -1, *ppwszDisplayName, MAX_DISPLAY_LEN);
#endif
    }

    //
    //  Load the Description text
    //
    *ppwszDescription = (LPWSTR) CoTaskMemAlloc (MAX_DESCRIPTION_LEN * sizeof (WCHAR));
    if (*ppwszDescription)
    {
#ifdef UNICODE
        LoadString (hDllInstance, IDS_DESCRIPTION, *ppwszDescription, MAX_DESCRIPTION_LEN);
#else
        CHAR szDisplayName[MAX_DESCRIPTION_LEN];
        LoadString (hDllInstance, IDS_DESCRIPTION, szDisplayName, MAX_DESCRIPTION_LEN);
        MultiByteToWideChar (CP_ACP, 0, szDisplayName, -1, *ppwszDescription, MAX_DESCRIPTION_LEN);
#endif
    }

    *pdwFlags = EVCF_HASSETTINGS | EVCF_ENABLEBYDEFAULT;

    return hResult;
}

STDMETHODIMP CEmptyVolumeCache::InitializeEx | ( | HKEY | hKey,
 |  | LPCWSTR | pcwszVolume,
 |  | LPCWSTR | pcwszKeyName,
 |  | LPWSTR * | ppwszDisplayName,
 |  | LPWSTR * | ppwszDescription,
 |  | LPWSTR * | ppwszBtnText,
 |  | DWORD * | pdwFlags
 | ) |  |

Definition at line 267 of file EmptyVolumeCache.Cpp.

{
    HRESULT hResult = Initialize (hKey, pcwszVolume, ppwszDisplayName, ppwszDescription, pdwFlags);

    //
    //  Load the button text
    //
    *ppwszBtnText = (LPWSTR) CoTaskMemAlloc (MAX_DESCRIPTION_LEN * sizeof (WCHAR));
    if (*ppwszBtnText)
    {
#ifdef UNICODE
        LoadString (hDllInstance, IDS_BUTTONTEXT, *ppwszBtnText, MAX_BUTTONTEXT_LEN);
#else
        CHAR szDisplayName[MAX_BUTTONTEXT_LEN];
        LoadString (hDllInstance, IDS_BUTTONTEXT, szDisplayName, MAX_BUTTONTEXT_LEN);
        MultiByteToWideChar (CP_ACP, 0, szDisplayName, -1, *ppwszBtnText, MAX_BUTTONTEXT_LEN);
#endif
    }

    return hResult;
}

STDMETHODIMP CEmptyVolumeCache::Purge | ( | DWORDLONG | dwSpaceToFree,
 |  | IEmptyVolumeCacheCallBack * | picb
 | ) |  |

Definition at line 215 of file EmptyVolumeCache.Cpp.

{
    //
    //  Delete unneeded files.
    //
    //  In this sample, we do not delete any files. However, we
    //  report that we actually did something by calling
    //  IEmptyVolumeCacheCallback::PurgeProgress.
    //
    //  bUpdateProgress is used to determine if GetSpaceUsed should
    //  call IEmptyVolumeCacheCallback::PurgeProgress. If picb is
    //  NULL, PurgeProgress is not called.
    //
    BOOL bUpdateProgress = (picb != NULL);

    if (bUpdateProgress)
        picb->PurgeProgress (dwSpaceToFree, 0, EVCCBF_LASTNOTIFICATION, NULL);
    return S_OK;
}

STDMETHODIMP CEmptyVolumeCache::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppvObject
 | ) |  |

Definition at line 38 of file EmptyVolumeCache.Cpp.

{
    HRESULT hr = E_NOINTERFACE;

    *ppvObject = NULL;
    if (IsEqualIID (riid, IID_IUnknown) ||
        IsEqualIID (riid, IID_IEmptyVolumeCache) ||
        IsEqualIID (riid, IID_IEmptyVolumeCache2))
    {
        *ppvObject = (LPVOID)(LPUNKNOWN) this;
    }

    if (*ppvObject != NULL)
    {
        ((LPUNKNOWN)*ppvObject)->AddRef ();
        hr = S_OK;
    }
    return hr;
}

STDMETHODIMP CEmptyVolumeCache::ShowProperties ( HWND hWnd )

Definition at line 237 of file EmptyVolumeCache.Cpp.

{
    //
    //  Display the Properties dialog for this disk cleanup handler.
    //  If the cleanup handler does not support a Properties dialog
    //  do not specify EVCF_HASSETTINGS in Initialize/InitializeEx.
    //
    //  In this sample we just create a message box to tell the user
    //  that there are no properties to set.
    MessageBox (hWnd,
                TEXT("There are no actual properties to display here."),
                TEXT("Properties"),
                MB_OK | MB_ICONINFORMATION);
    return S_OK;
}

CEmptyVolumeCache::STDMETHODIMP_ ( ULONG )
CEmptyVolumeCache::STDMETHODIMP_ ( ULONG )

Member Data Documentation

ULONG CEmptyVolumeCache::m_nRefCount [private]

Definition at line 49 of file EmptyVolumeCache.h.

The documentation for this class was generated from the following files:
  • WinUI/Shell/DiskCleanupHandler/EmptyVolumeCache.h
  • WinUI/Shell/DiskCleanupHandler/EmptyVolumeCache.Cpp
Generated on Wed Nov 13 2024 16:56:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CEnlistTransaction Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CEnlistTransaction Class Reference

#include "EnlistTransaction.h"

List of all members.

Public Member Functions

CEnlistTransaction ()
STDMETHOD() | CreateInstance (BSTR bstrProgId, IDispatch **ppDispatch)
STDMETHOD() | EnlistTransaction (BSTR bstrTipUrl)
STDMETHOD() | InterfaceSupportsErrorInfo (REFIID riid)

Protected Attributes

CComBSTR | m_bstrTipUrl

Detailed Description

Definition at line 10 of file EnlistTransaction.h.

Constructor & Destructor Documentation

CEnlistTransaction::CEnlistTransaction ( ) [inline]

Definition at line 17 of file EnlistTransaction.h.

  {
  }

Member Function Documentation

STDMETHODIMP CEnlistTransaction::CreateInstance | ( | BSTR | bstrProgId,
 |  | IDispatch ** | ppDispatch
 | ) |  |

Definition at line 36 of file EnlistTransaction.Cpp.

{
   HRESULT            hr          = S_OK;
   ICreateWithTipTransactionEx* pCreateWithTipTx  = NULL;
   GUID             guidObj       = {0};
   GUID             guidByotServer    = {0};
   MULTI_QI           mqi         = {0};

  // TODO: Add your implementation code here

  if (NULL == bstrProgId || NULL == ppDispatch)
    return E_POINTER;

  hr = CLSIDFromProgID(bstrProgId, &guidObj);
  if (FAILED(hr))
    return hr;

  hr = CLSIDFromProgID(L"Byot.ByotServerEx", &guidByotServer);
  if (FAILED(hr))
    return hr;

  mqi.pIID  = &IID_ICreateWithTipTransactionEx;
  mqi.pItf  = pCreateWithTipTx;
  mqi.hr    = S_OK;

  hr = CoCreateInstanceEx(guidByotServer,
              NULL,
              CLSCTX_INPROC_SERVER,
              NULL,
              1,
              &mqi);
  if (FAILED(hr))
    return hr;

  if (FAILED(mqi.hr))
    return hr;

  pCreateWithTipTx = (ICreateWithTipTransactionEx*)mqi.pItf;
  hr = pCreateWithTipTx->CreateInstance(m_bstrTipUrl,
                  guidObj,
                  IID_IDispatch,
                  (void**)ppDispatch);
  pCreateWithTipTx->Release();

  return hr;
}

STDMETHODIMP CEnlistTransaction::EnlistTransaction ( BSTR bstrTipUrl )

Definition at line 24 of file EnlistTransaction.Cpp.

{
  // TODO: Add your implementation code here

  if (!bstrTipUrl)
    return E_POINTER;

  m_bstrTipUrl = bstrTipUrl;

  return S_OK;
}

STDMETHODIMP CEnlistTransaction::InterfaceSupportsErrorInfo ( REFIID riid )

Definition at line 10 of file EnlistTransaction.Cpp.

{
  static const IID* arr[] =
  {
    &IID_IEnlistTransaction
  };
  for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++)
  {
    if (::InlineIsEqualGUID(*arr[i],riid))
      return S_OK;
  }
  return S_FALSE;
}

Member Data Documentation

CComBSTR CEnlistTransaction::m_bstrTipUrl [protected]

Definition at line 41 of file EnlistTransaction.h.

The documentation for this class was generated from the following files:
  • Com/Services/BYOT/Server/BYOTTxEnlister/EnlistTransaction.h
  • Com/Services/BYOT/Server/BYOTTxEnlister/EnlistTransaction.Cpp
Generated on Wed Nov 13 2024 16:56:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CEntity Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes

CEntity Class Reference

#include "entity.h"

List of all members.

Public Member Functions

CEntity ()
~CEntity ()
STDMETHOD() | _NewEnum (LPUNKNOWN *pVal)
STDMETHOD() | Add (VARIANT *pItem, VARIANT *pKey=&vtMissing, VARIANT *pBefore=&vtMissing, VARIANT *pAfter=&vtMissing)
STDMETHOD() | Append (VARIANT *pItem, VARIANT *pKey)
void | Clear ()
STDMETHOD() | Count (long *pVal)
STDMETHOD() | DisconnectObject (DWORD dwReserved)
STDMETHOD() | get_DeleteCommand (BSTR *pVal)
STDMETHOD() | get_DeleteStoredProcedure (BSTR *pVal)
STDMETHOD() | get_EditMode (ColEditModeEnum *pVal)
STDMETHOD() | get_Field (VARIANT *Index, VARIANT *pVal)
STDMETHOD() | get_InsertCommand (BSTR *pVal)
STDMETHOD() | get_InsertStoredProcedure (BSTR *pVal)
STDMETHOD() | get_Key (long Index, BSTR *pVal)
STDMETHOD() | get_KeyField (BSTR *pVal)
STDMETHOD() | get_ReadCommand (BSTR *pVal)
STDMETHOD() | get_ReadStoredProcedure (BSTR *pVal)
STDMETHOD() | get_UpdateCommand (BSTR *pVal)
STDMETHOD() | get_UpdateStoredProcedure (BSTR *pVal)
STDMETHOD() | GetClassID (GUID *pClassID)
STDMETHOD() | GetMarshalSizeMax (REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlFlags, ULONG *pSize)
unsigned long | GetPersistSize (bool bWithMetaData=true)
HRESULT | GetPersistSizeMax (_ULARGE_INTEGER *pCbSize, bool bWithMetaData=true)
STDMETHOD() | GetSizeMax (_ULARGE_INTEGER *pCbSize)
STDMETHOD() | GetUnmarshalClass (REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlFlags, CLSID *pCid)
STDMETHOD() | Initialize (long Size)
STDMETHOD() | InitNew ()
STDMETHOD() | Insert (long Index, BSTR Key, VARIANT *Value)
STDMETHOD() | InterfaceSupportsErrorInfo (REFIID riid)
HRESULT | InternalInsert (long Index, LPCWSTR wszKey, long *pnValue)
HRESULT | InternalInsert (long Index, LPCWSTR wszKey, VARIANT *pValue, VARTYPE vt)
HRESULT | InternalInsert (long Index, LPCWSTR wszKey, WCHAR *wszValue)
STDMETHOD() | IsDirty ()
STDMETHOD() | Item (VARIANT *pIndex, VARIANT *pVal)
STDMETHOD() | Load (IStream *pStm)
HRESULT | LoadFromStream (IStream *pStm, bool bWithMetaData=true)
STDMETHOD() | MarshalInterface (IStream *pStm, REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlFlags)
STDMETHOD() | put_DeleteStoredProcedure (BSTR newVal)
STDMETHOD() | put_EditMode (ColEditModeEnum newVal)
STDMETHOD() | put_Field (VARIANT *Index, VARIANT *newVal)
STDMETHOD() | put_InsertStoredProcedure (BSTR newVal)
STDMETHOD() | put_Key (long Index, BSTR newVal)
STDMETHOD() | put_KeyField (BSTR newVal)
STDMETHOD() | put_ReadStoredProcedure (BSTR newVal)
STDMETHOD() | put_Recordset (_Recordset *newVal)
STDMETHOD() | put_UpdateStoredProcedure (BSTR newVal)
STDMETHOD() | ReleaseMarshalData (IStream *pStm)
STDMETHOD() | Remove (VARIANT *pIndex)
STDMETHOD() | Save (IStream *pStm, int fClearDirty)
HRESULT | SaveToStream (IStream *pStm, int fClearDirty, bool bWithMetaData=true)
STDMETHOD() | UnmarshalInterface (IStream *pStm, REFIID riid, void **ppv)

Public Attributes

CStaticMap m_keyMap
CFastVariant * m_pContents
VARTYPE * | m_Type
CString m_wszDeleteStoredProc
CString m_wszInsertStoredProc
CString m_wszKeyField
CString m_wszReadStoredProc
CString m_wszUpdateStoredProc

Private Member Functions

void | ClearArrays ()
DECLARE_FIXED_ALLOC (CEntity)
WCHAR * | ExtractParams (WCHAR *wszParams)

Private Attributes

bool | m_bRequiresSave
ColEditModeEnum m_EditMode
long | m_nCount
long | m_nMaxCount

Detailed Description

Definition at line 11 of file entity.h.

Constructor & Destructor Documentation

CEntity::CEntity ( ) [inline]

Definition at line 24 of file entity.h.

  {
    Clear();
  }

CEntity::~CEntity ( ) [inline]

Definition at line 29 of file entity.h.

  {
    ClearArrays();
  }

Member Function Documentation

STDMETHODIMP CEntity::_NewEnum ( LPUNKNOWN * pVal )

Definition at line 101 of file entity.Cpp.

{
  if (pVal == NULL)
    return E_POINTER;
  *pVal = NULL;
  typedef CComObject<CComEnum<IEnumVARIANT, &IID_IEnumVARIANT, VARIANT, _Copy<VARIANT> > > enumvar;
  enumvar* pEnumVar = new enumvar;
  _ASSERTE(pEnumVar);
  HRESULT hRes = pEnumVar->Init(&m_pContents[0], &m_pContents[m_nMaxCount], NULL, AtlFlagCopy);
  if (SUCCEEDED(hRes))
    hRes = pEnumVar->QueryInterface(IID_IEnumVARIANT, (void**)pVal);
  if (FAILED(hRes))
    delete pEnumVar;
  return hRes;
}

STDMETHODIMP CEntity::Add | ( | VARIANT * | pItem,
 |  | VARIANT * | pKey = &vtMissing,
 |  | VARIANT * | pBefore = &vtMissing,
 |  | VARIANT * | pAfter = &vtMissing
 | ) |  |

Definition at line 236 of file entity.Cpp.

{
  HRESULT hr = S_OK;

  if (pKey->vt != VT_BSTR)
  {
    hr = DISP_E_TYPEMISMATCH;
  }
  else if (pBefore->vt != VT_ERROR || pAfter->vt != VT_ERROR)
  {
    hr = DISP_E_BADPARAMCOUNT;
  }
  else
  {
    hr = Insert(m_nCount + 1, pKey->bstrVal, pItem);
  }
  return hr;
}

STDMETHODIMP CEntity::Append | ( | VARIANT * | pItem,
 |  | VARIANT * | pKey
 | ) |  |

Definition at line 451 of file entity.Cpp.

{
  HRESULT hr = S_OK;

  if (pKey->vt != VT_BSTR)
  {
    hr = DISP_E_TYPEMISMATCH;
  }
  else
  {
    hr = Insert(m_nCount + 1, pKey->bstrVal, pItem);
  }
  return hr;
}

void CEntity::Clear ( )

Definition at line 50 of file entity.Cpp.

{
  m_bRequiresSave = false;
  m_EditMode = colEditNone;
  m_nMaxCount = 0;
  m_nCount = 0;
  m_wszUpdateStoredProc.Empty();
  m_wszReadStoredProc.Empty();
  m_wszKeyField.Empty();
  m_wszDeleteStoredProc.Empty();
  m_wszInsertStoredProc.Empty();
  m_keyMap.RemoveAll();
  m_pContents = NULL;
  m_Type = NULL;

  ClearArrays();
}

void CEntity::ClearArrays ( ) [private]

Definition at line 68 of file entity.Cpp.

{
  m_keyMap.ClearArray();

  if (m_pContents != NULL)
  {
    delete [] m_pContents;
    m_pContents = NULL;
  }
  if (m_Type != NULL)
  {
    delete [] m_Type;
    m_Type = NULL;
  }
}

STDMETHODIMP CEntity::Count ( long * pVal )

Definition at line 117 of file entity.Cpp.

{
  *Count = m_nMaxCount;

  return S_OK;
}

CEntity::DECLARE_FIXED_ALLOC ( CEntity ) [private]
STDMETHOD() CEntity::DisconnectObject ( DWORD dwReserved ) [inline]

Definition at line 141 of file entity.h.

  {
    // Proxy and Object are not connected -- nothing to do
    return E_NOTIMPL;
  }

WCHAR * CEntity::ExtractParams ( WCHAR * wszParams ) [private]

Definition at line 12 of file entity.Cpp.

{
  register long nCol;
  WCHAR *wszParam = wszParams;
  register VARIANT* pVal;
  register LPCWSTR wszName;
  int nChars = 0;

  if (m_nMaxCount <= 0) return wszParams;

  for (nCol = 0; nCol < m_nMaxCount; nCol++)
  {
    pVal = &m_pContents[nCol];
    wszName = (LPCWSTR)m_keyMap.m_aKey[nCol];
    wszParam[0] = L'@';
    wszParam++;

    wszParam += WriteNamedParam(wszParam, wszName, pVal);
  }
  wszParam[-2] = L'\0';
  return wszParams;
}

STDMETHODIMP CEntity::get_DeleteCommand ( BSTR * pVal )

Definition at line 481 of file entity.Cpp.

{
  WCHAR wszSQL[4196];
  _variant_t val;
  long nIndex;

  wszSQL[0] = L'\0';

  nIndex = m_keyMap.Lookup(m_wszKeyField);

  if (nIndex >= 0 && m_wszDeleteStoredProc[0] != L'\0')
  {
    val = m_pContents[nIndex];
    BuildExecCommand(wszSQL, m_wszDeleteStoredProc, m_wszKeyField, &val);
    *pVal = SysAllocString(wszSQL);
  }
  else
  {
    *pVal = NULL;
  }
  return S_OK;
}

STDMETHODIMP CEntity::get_DeleteStoredProcedure ( BSTR * pVal )

Definition at line 466 of file entity.Cpp.

{
  *pVal = _bstr_t(m_wszDeleteStoredProc).copy();

  return S_OK;
}

STDMETHODIMP CEntity::get_EditMode ( ColEditModeEnum * pVal )

Definition at line 260 of file entity.Cpp.

{
  if (m_bRequiresSave && m_EditMode == colEditNone)
  {
    m_EditMode = colEditInProgress;
  }
  *pVal = m_EditMode;

  return S_OK;
}

STDMETHODIMP CEntity::get_Field | ( | VARIANT * | Index,
 |  | VARIANT * | pVal
 | ) |  |

Definition at line 306 of file entity.Cpp.

{
  return Item(Index, pVal);
}

STDMETHODIMP CEntity::get_InsertCommand ( BSTR * pVal )

Definition at line 519 of file entity.Cpp.

{
  HRESULT hr = S_OK;
  WCHAR wszParams[4096];
  WCHAR wszSQL[4196];

  wszParams[0] = L'\0';
  wszSQL[0] = L'\0';

  if (m_wszInsertStoredProc[0] != L'\0')
  {
    WriteChars(wszSQL, L"EXEC", (LPCWSTR)m_wszInsertStoredProc, (LPCWSTR)ExtractParams(wszParams));
//    SWPRINTF(wszSQL, L"EXEC %s %s", (LPCWSTR)m_wszInsertStoredProc, (LPCWSTR)ExtractParams(wszParams));
    *pVal = SysAllocString(wszSQL);
  }
  else
  {
    *pVal = NULL;
  }
  return hr;
}

STDMETHODIMP CEntity::get_InsertStoredProcedure ( BSTR * pVal )

Definition at line 504 of file entity.Cpp.

{
  *pVal = _bstr_t(m_wszInsertStoredProc).copy();

  return S_OK;
}

STDMETHODIMP CEntity::get_Key | ( | long | Index,
 |  | BSTR * | pVal
 | ) |  |

Definition at line 279 of file entity.Cpp.

{
  if (Index > 0 && Index <= m_nMaxCount)
  {
    *pVal = _bstr_t(m_keyMap.m_aKey[Index - 1]).copy();
  }
  else
    return AtlReportError(GetObjectCLSID(), "Array has not been initialized", IID_IEntity, E_FAIL);
  return S_OK;
}

STDMETHODIMP CEntity::get_KeyField ( BSTR * pVal )

Definition at line 412 of file entity.Cpp.

{
  *pVal = _bstr_t(m_wszKeyField).copy();

  return S_OK;
}

STDMETHODIMP CEntity::get_ReadCommand ( BSTR * pVal )

Definition at line 428 of file entity.Cpp.

{
  WCHAR wszSQL[4196];
  _variant_t val;
  long nIndex;

  wszSQL[0] = L'\0';

  nIndex = m_keyMap.Lookup(m_wszKeyField);

  if (nIndex >= 0 && m_wszReadStoredProc[0] != L'\0')
  {
    val = m_pContents[nIndex];
    BuildExecCommand(wszSQL, m_wszReadStoredProc, m_wszKeyField, &val);
    *pVal = SysAllocString(wszSQL);
  }
  else
  {
    *pVal = NULL;
  }
  return S_OK;
}

STDMETHODIMP CEntity::get_ReadStoredProcedure ( BSTR * pVal )

Definition at line 375 of file entity.Cpp.

{
  *pVal = _bstr_t(m_wszReadStoredProc).copy();

  return S_OK;
}

STDMETHODIMP CEntity::get_UpdateCommand ( BSTR * pVal )

Definition at line 391 of file entity.Cpp.

{
  WCHAR wszParams[4096];
  WCHAR wszSQL[4196];

  wszParams[0] = L'\0';
  wszSQL[0] = L'\0';

  if (m_wszUpdateStoredProc[0] != L'\0')
  {
//    SWPRINTF(wszSQL, L"EXEC %s %s", (LPCWSTR)m_wszUpdateStoredProc, (LPCWSTR)ExtractParams(wszParams));
    WriteChars(wszSQL, L"EXEC", (LPCWSTR)m_wszUpdateStoredProc, (LPCWSTR)ExtractParams(wszParams));
    *pVal = SysAllocString(wszSQL);
  }
  else
  {
    *pVal = NULL;
  }
  return S_OK;
}

STDMETHODIMP CEntity::get_UpdateStoredProcedure ( BSTR * pVal )

Definition at line 359 of file entity.Cpp.

{
  *pVal = _bstr_t(m_wszUpdateStoredProc).copy();

  return S_OK;
}

STDMETHOD() CEntity::GetClassID ( GUID * pClassID ) [inline]

Definition at line 150 of file entity.h.

  {
    if (pClassID == NULL)
      return E_POINTER;

    *pClassID = GetObjectCLSID();

    return S_OK;
  }

STDMETHOD() CEntity::GetMarshalSizeMax | ( | REFIID | riid,
 |  | void * | pv,
 |  | DWORD | dwDestContext,
 |  | void * | pvDestContext,
 |  | DWORD | mshlFlags,
 |  | ULONG * | pSize |
 | ) |  |  | [inline]

Definition at line 104 of file entity.h.

  {
    _ULARGE_INTEGER ul;
    HRESULT hr;

    ul.LowPart = 0;
    ul.HighPart = 0;
    hr = GetSizeMax(&ul);

    if (SUCCEEDED(hr))
      *pSize = ul.LowPart;

    return hr;
  }

unsigned long CEntity::GetPersistSize ( bool bWithMetaData = true ) [inline]

Definition at line 89 of file entity.h.

  {
    _ULARGE_INTEGER ul;
    HRESULT hr;

    ul.LowPart = 0;
    ul.HighPart = 0;
    hr = GetPersistSizeMax(&ul, bWithMetaData);

    if (SUCCEEDED(hr))
      return ul.LowPart;
    else
      return 0;
  }

HRESULT CEntity::GetPersistSizeMax | ( | _ULARGE_INTEGER * | pCbSize,
 |  | bool | bWithMetaData = true |
 | ) |  |  | [inline]

Definition at line 256 of file entity.h.

  {
    if (pCbSize == NULL)
      return E_POINTER;

    long nSize = 0, n = 0;
    HRESULT hr = S_OK;

    CFastVariant update((LPCWSTR)m_wszUpdateStoredProc);
    CFastVariant read((LPCWSTR)m_wszReadStoredProc);
    CFastVariant insert((LPCWSTR)m_wszInsertStoredProc);
    CFastVariant deletesp((LPCWSTR)m_wszDeleteStoredProc);
    CFastVariant key((LPCWSTR)m_wszKeyField);

    nSize += sizeof((long)ARRAY_VERSION); // version
    nSize += sizeof(m_nMaxCount); // count
    nSize += sizeof(m_bRequiresSave); // save
    nSize += sizeof(m_EditMode); // edit

    nSize += GetVariantSize(update);
    nSize += GetVariantSize(insert);
    nSize += GetVariantSize(deletesp);
    nSize += GetVariantSize(read);
    nSize += GetVariantSize(key);

    for (n = 0; n < m_nMaxCount; n++)
    {
      if (bWithMetaData)
      {
        CFastVariant vKey((LPCWSTR)m_keyMap.m_aKey[n]);

        nSize += GetVariantSize(vKey);
      }
      nSize += sizeof(long); // edit
      nSize += GetVariantSize(m_pContents[n]);
    }
    pCbSize->LowPart = nSize;
    return hr;
  }

STDMETHOD() CEntity::GetSizeMax ( _ULARGE_INTEGER * pCbSize ) [inline]

Definition at line 251 of file entity.h.

  {
    return GetPersistSizeMax(pCbSize, true);
  }

STDMETHOD() CEntity::GetUnmarshalClass | ( | REFIID | riid,
 |  | void * | pv,
 |  | DWORD | dwDestContext,
 |  | void * | pvDestContext,
 |  | DWORD | mshlFlags,
 |  | CLSID * | pCid |
 | ) |  |  | [inline]

Definition at line 83 of file entity.h.

  {
    *pCid = GetObjectCLSID();
    return S_OK;
  }

STDMETHODIMP CEntity::Initialize ( long Size )

Definition at line 84 of file entity.Cpp.

{
  HRESULT hr = S_OK;
  Clear();

  m_nMaxCount = Size;
  ClearArrays();

  m_keyMap.Initialize(Size);
  ATLASSERT(m_pContents == NULL);
  ATLASSERT(m_Type == NULL);
  m_pContents = new CFastVariant[Size + 1];
  m_Type = new VARTYPE[Size + 1];

  return hr;
}

STDMETHOD() CEntity::InitNew ( ) [inline]

Definition at line 296 of file entity.h.

  {
    HRESULT hr = S_OK;

    Clear();

    return hr;
  }

STDMETHODIMP CEntity::Insert | ( | long | Index,
 |  | BSTR | Key,
 |  | VARIANT * | Value
 | ) |  |

Definition at line 217 of file entity.Cpp.

{
  HRESULT hr = S_OK;
  if (Index <= m_nMaxCount && Index > 0)
  {
    m_keyMap.Add(Key, SysStringLen(Key), Index - 1);

    hr = VariantCopy(&m_pContents[Index - 1], pValue);
    m_Type[Index - 1] = pValue->vt;

    m_bRequiresSave = true;
    if (Index > m_nCount)
      m_nCount = Index;
  }
  else
    return AtlReportError(GetObjectCLSID(), "Array has not been initialized to size required", IID_IEntity, E_FAIL);
  return hr;
}

STDMETHODIMP CEntity::InterfaceSupportsErrorInfo ( REFIID riid )

Definition at line 36 of file entity.Cpp.

{
  static const IID* arr[] =
  {
    &IID_IEntity
  };
  for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++)
  {
    if (::InlineIsEqualGUID(*arr[i],riid))
      return S_OK;
  }
  return S_FALSE;
}

HRESULT CEntity::InternalInsert | ( | long | Index,
 |  | LPCWSTR | wszKey,
 |  | VARIANT * | pValue,
 |  | VARTYPE | vt
 | ) |  |

Definition at line 148 of file entity.Cpp.

{
  HRESULT hr = S_OK;
  if (Index <= m_nMaxCount && Index > 0)
  {
    m_keyMap.AddNoLen(wszKey, Index - 1);

    hr = VariantCopy(&m_pContents[Index - 1], pValue);
    m_Type[Index - 1] = vt;

    m_bRequiresSave = true;
    if (Index > m_nCount)
    {
      m_nCount = Index;
    }
  }
  else
    return AtlReportError(GetObjectCLSID(), "Array has not been initialized to size required", IID_IEntity, E_FAIL);
  return hr;
}

HRESULT CEntity::InternalInsert | ( | long | Index,
 |  | LPCWSTR | wszKey,
 |  | WCHAR * | wszValue
 | ) |  |

Definition at line 169 of file entity.Cpp.

{
  HRESULT hr = S_OK;
  if (Index <= m_nMaxCount && Index > 0)
  {
    m_keyMap.AddNoLen(wszKey, Index - 1);

    ATLASSERT(m_pContents[Index - 1].vt == VT_EMPTY);

    m_pContents[Index - 1].bstrVal = SysAllocString(wszValue);
    m_pContents[Index - 1].vt = VT_BSTR;
    m_Type[Index - 1] = VT_BSTR;

    m_bRequiresSave = true;
    if (Index > m_nCount)
    {
      m_nCount = Index;
    }
  }
  else
    return AtlReportError(GetObjectCLSID(), "Array has not been initialized to size required", IID_IEntity, E_FAIL);
  return hr;
}

HRESULT CEntity::InternalInsert | ( | long | Index,
 |  | LPCWSTR | wszKey,
 |  | long * | pnValue
 | ) |  |

Definition at line 193 of file entity.Cpp.

{
  HRESULT hr = S_OK;
  if (Index <= m_nMaxCount && Index > 0)
  {
    m_keyMap.AddNoLen(wszKey, Index - 1);

    ATLASSERT(m_pContents[Index - 1].vt == VT_EMPTY);

    m_pContents[Index - 1].lVal = *pnValue;
    m_pContents[Index - 1].vt = VT_I4;
    m_Type[Index - 1] = VT_I4;

    m_bRequiresSave = true;
    if (Index > m_nCount)
    {
      m_nCount = Index;
    }
  }
  else
    return AtlReportError(GetObjectCLSID(), "Array has not been initialized to size required", IID_IEntity, E_FAIL);
  return hr;
}

STDMETHOD() CEntity::IsDirty ( void ) [inline]

Definition at line 160 of file entity.h.

  {
    HRESULT hr = S_FALSE;

    if (m_bRequiresSave)
    {
      hr = S_OK;
    }
    return hr;
  }

STDMETHODIMP CEntity::Item | ( | VARIANT * | pIndex,
 |  | VARIANT * | pVal
 | ) |  |

Definition at line 124 of file entity.Cpp.

{
  HRESULT hr = S_OK;
  long nIndex = 0;
  if (Index->vt == VT_BSTR)
  {
    nIndex = m_keyMap.Lookup(Index->bstrVal);
  }
  else
  {
    _variant_t vIndex(*Index);
    nIndex = (long)vIndex - 1;
  }

  if (nIndex >= 0 && nIndex <= m_nMaxCount)
  {
    if (SUCCEEDED(hr))
      hr = VariantCopy(Value, &m_pContents[nIndex]);
  }
  else
    return AtlReportError(GetObjectCLSID(), "Cannot locate item", IID_IEntity, E_FAIL);
  return hr;
}

STDMETHOD() CEntity::Load ( IStream * pStm ) [inline]

Definition at line 208 of file entity.h.

  {
    return LoadFromStream(pStm, true);;
  }

HRESULT CEntity::LoadFromStream | ( | IStream * | pStm,
 |  | bool | bWithMetaData = true |
 | ) |  |  | [inline]

Definition at line 171 of file entity.h.

  {
    long nSize = 0,  n = 0, nVer = 0;
    HRESULT hr = S_OK;

    *pStm >> (long)nVer; // version

    if (nVer < ARRAY_VERSION)
      return STG_E_OLDFORMAT;

    *pStm >> m_nMaxCount; // count

    Initialize(m_nMaxCount);

    *pStm >> m_bRequiresSave; // count
    *pStm >> m_EditMode; // count

    if (bWithMetaData)
    {
      *pStm >> m_wszUpdateStoredProc;
      *pStm >> m_wszReadStoredProc;
      *pStm >> m_wszDeleteStoredProc;
      *pStm >> m_wszInsertStoredProc;
      *pStm >> m_wszKeyField;
    }

    for (n = 0; (n < m_nMaxCount && SUCCEEDED(hr)); n++)
    {
      if (bWithMetaData)
        *pStm >> m_keyMap.m_aKey[n];
      *pStm >> (VARTYPE)m_Type[n];
      hr = m_pContents[n].ReadFromStream(pStm);
    }
    m_keyMap.m_nSize = m_nMaxCount;
    return hr;
  }

STDMETHOD() CEntity::MarshalInterface | ( | IStream * | pStm,
 |  | REFIID | riid,
 |  | void * | pv,
 |  | DWORD | dwDestContext,
 |  | void * | pvDestContext,
 |  | DWORD | mshlFlags |
 | ) |  |  | [inline]

Definition at line 119 of file entity.h.

  {
    return Save(pStm, FALSE);
  }

STDMETHODIMP CEntity::put_DeleteStoredProcedure ( BSTR newVal )

Definition at line 473 of file entity.Cpp.

{
  long nLen = SysStringLen(newVal);
  m_wszDeleteStoredProc.AssignCopy(nLen, newVal);
  m_bRequiresSave = true;
  return S_OK;
}

STDMETHODIMP CEntity::put_EditMode ( ColEditModeEnum newVal )

Definition at line 271 of file entity.Cpp.

{
  m_EditMode = newVal;
  if (m_EditMode == colEditNone)
    m_bRequiresSave = false;
  return S_OK;
}

STDMETHODIMP CEntity::put_Field | ( | VARIANT * | Index,
 |  | VARIANT * | newVal
 | ) |  |

Definition at line 311 of file entity.Cpp.

{
  HRESULT hr = S_OK;
  long nIndex = 0;
  if (Index->vt == VT_BSTR)
  {
    nIndex = m_keyMap.Lookup(Index->bstrVal);
  }
  else
  {
    _variant_t vIndex(*Index);
    nIndex = (long)vIndex - 1;
  }

  if (nIndex >= 0 && nIndex <= m_nMaxCount)
  {
    if ((nIndex+1) > m_nCount)
      m_nCount = (nIndex+1);

    if (newVal->vt == m_Type[nIndex] || newVal->vt == VT_NULL)
    {
      hr = VariantCopy(&m_pContents[nIndex], newVal);
    }
    else
    {
      hr = VariantChangeType(&m_pContents[nIndex], newVal, 0, m_Type[nIndex]);
    }

// Currently there is a clear separation between NULL and empty strings.
// If you require empty strings to be treated as NULLs then uncomment the following
// code.
/*
    if (m_pContents[nIndex].vt == VT_BSTR)
    {
      if (SysStringLen(m_pContents[nIndex].bstrVal) <= 0)
      {
        VariantClear(&m_pContents[nIndex]);
        m_pContents[nIndex].vt = VT_NULL;
      }
    }
*/
    m_bRequiresSave = true;
  }
  else
    return AtlReportError(GetObjectCLSID(), "Cannot locate item", IID_IEntity, E_FAIL);
  return hr;
}

STDMETHODIMP CEntity::put_InsertStoredProcedure ( BSTR newVal )

Definition at line 511 of file entity.Cpp.

{
  long nLen = SysStringLen(newVal);
  m_wszInsertStoredProc.AssignCopy(nLen, newVal);
  m_bRequiresSave = true;
  return S_OK;
}

STDMETHODIMP CEntity::put_Key | ( | long | Index,
 |  | BSTR | newVal
 | ) |  |

Definition at line 290 of file entity.Cpp.

{
  if (Index > 0 && Index <= m_nMaxCount)
  {
    int nLen = SysStringLen(newVal);
    m_keyMap.m_aKey[Index -1].AssignCopy(nLen, newVal);
    m_bRequiresSave = true;
    if (Index > m_nCount)
      m_nCount = Index;
  }
  else
    return AtlReportError(GetObjectCLSID(), "Array has not been initialized", IID_IEntity, E_FAIL);

  return S_OK;
}

STDMETHODIMP CEntity::put_KeyField ( BSTR newVal )

Definition at line 419 of file entity.Cpp.

{
  int nLen = SysStringLen(newVal);
  m_wszKeyField.AssignCopy(nLen, newVal);
  m_bRequiresSave = true;

  return S_OK;
}

STDMETHODIMP CEntity::put_ReadStoredProcedure ( BSTR newVal )

Definition at line 382 of file entity.Cpp.

{
  int nLen = SysStringLen(newVal);
  m_wszReadStoredProc.AssignCopy(nLen, newVal);
  m_bRequiresSave = true;

  return S_OK;
}

STDMETHODIMP CEntity::put_Recordset ( _Recordset * newVal )

Definition at line 9 of file entity_except.Cpp.

{
  HRESULT hr = S_OK;
  try
  {
    _RecordsetPtr spRecordset = newVal;
    FieldsPtr spFields = spRecordset->Fields;
    long nRSCount = spFields->Count;
    long iCol;

    if (spRecordset->GetadoEOF() != VARIANT_TRUE)
    {
      hr = Initialize(nRSCount);
      if (SUCCEEDED(hr))
      {
        for (iCol = 0; iCol < nRSCount && SUCCEEDED(hr); iCol++)
        {
          hr = Insert(iCol + 1, spFields->Item[iCol]->Name, &spFields->Item[iCol]->Value);
        }
      }
    }
  }
  catch (_com_error e)
  {
    hr = e.Error();
  }
  return hr;
}

STDMETHODIMP CEntity::put_UpdateStoredProcedure ( BSTR newVal )

Definition at line 366 of file entity.Cpp.

{
  int nLen = SysStringLen(newVal);
  m_wszUpdateStoredProc.AssignCopy(nLen, newVal);
  m_bRequiresSave = true;

  return S_OK;
}

STDMETHOD() CEntity::ReleaseMarshalData ( IStream * pStm ) [inline]

Definition at line 135 of file entity.h.

  {
    // Nothing to do
    return E_NOTIMPL;
  }

STDMETHODIMP CEntity::Remove ( VARIANT * pIndex )

Definition at line 255 of file entity.Cpp.

{
  return E_NOTIMPL;
}

STDMETHOD() CEntity::Save | ( | IStream * | pStm,
 |  | int | fClearDirty |
 | ) |  |  | [inline]

Definition at line 213 of file entity.h.

  {
    return SaveToStream(pStm, fClearDirty, true);
  }

HRESULT CEntity::SaveToStream | ( | IStream * | pStm,
 |  | int | fClearDirty,
 |  | bool | bWithMetaData = true |
 | ) |  |  | [inline]

Definition at line 218 of file entity.h.

  {
    long nSize = 0, n = 0;
    HRESULT hr = S_OK;

    *pStm << (long)ARRAY_VERSION; // version
    *pStm << m_nMaxCount; // count
    *pStm << m_bRequiresSave; // save
    *pStm << m_EditMode; // edit

    if (bWithMetaData)
    {
      *pStm << (LPCWSTR)m_wszUpdateStoredProc;
      *pStm << (LPCWSTR)m_wszReadStoredProc;
      *pStm << (LPCWSTR)m_wszDeleteStoredProc;
      *pStm << (LPCWSTR)m_wszInsertStoredProc;
      *pStm << (LPCWSTR)m_wszKeyField;
    }

    for (n = 0; (n < m_nMaxCount && SUCCEEDED(hr)); n++)
    {
      if (bWithMetaData)
        *pStm << (LPCWSTR)m_keyMap.m_aKey[n];
      *pStm << (VARTYPE)m_Type[n];
      m_pContents[n].WriteToStream(pStm);
    }

    if (fClearDirty)
      m_bRequiresSave = false;

    return hr;
  }

STDMETHOD() CEntity::UnmarshalInterface | ( | IStream * | pStm,
 |  | REFIID | riid,
 |  | void ** | ppv |
 | ) |  |  | [inline]

Definition at line 124 of file entity.h.

  {
    HRESULT hr = Load(pStm);

    if (SUCCEEDED(hr))
    {
      hr = QueryInterface(riid, ppv);
    }
    return hr;
  }

Member Data Documentation

bool CEntity::m_bRequiresSave [private]

Definition at line 320 of file entity.h.

ColEditModeEnum CEntity::m_EditMode [private]

Definition at line 317 of file entity.h.

CStaticMap CEntity::m_keyMap

Definition at line 312 of file entity.h.

long CEntity::m_nCount [private]

Definition at line 318 of file entity.h.

long CEntity::m_nMaxCount [private]

Definition at line 319 of file entity.h.

CFastVariant* CEntity::m_pContents

Definition at line 313 of file entity.h.

VARTYPE* CEntity::m_Type

Definition at line 314 of file entity.h.

CString CEntity::m_wszDeleteStoredProc

Definition at line 308 of file entity.h.

CString CEntity::m_wszInsertStoredProc

Definition at line 309 of file entity.h.

CString CEntity::m_wszKeyField

Definition at line 310 of file entity.h.

CString CEntity::m_wszReadStoredProc

Definition at line 307 of file entity.h.

CString CEntity::m_wszUpdateStoredProc

Definition at line 306 of file entity.h.

The documentation for this class was generated from the following files:
  • Com/Tools/EntityProxy/DataServices/entity.h
  • Com/Tools/EntityProxy/DataServices/entity.Cpp
  • Com/Tools/EntityProxy/DataServices/entity_except.Cpp
Generated on Wed Nov 13 2024 16:56:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CEnumConnectionPoints Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions

CEnumConnectionPoints Class Reference

Inherits CEnumXXX< CEnumConnectionPoints, LPCONNECTIONPOINT, IEnumConnectionPoints >.

List of all members.

Public Member Functions

CEnumConnectionPoints (LPUNKNOWN lpUnk, DWORD nCount)
~CEnumConnectionPoints ()
bool __stdcall | Copy (LPCONNECTIONPOINT *lpCPLeft, LPCONNECTIONPOINT lpCPRight)
virtual void __stdcall | FinalRelease ()

Private Member Functions

CEnumConnectionPoints ()
CEnumConnectionPoints (const CEnumConnectionPoints &)
CEnumConnectionPoints * operator& ()
CEnumConnectionPoints * | operator& () const
CEnumConnectionPoints & | operator= (const CEnumConnectionPoints &)

Detailed Description

Definition at line 41 of file CConnectionPT.cpp.

Constructor & Destructor Documentation

CEnumConnectionPoints::CEnumConnectionPoints ( ) [private]
CEnumConnectionPoints::CEnumConnectionPoints ( const CEnumConnectionPoints & ) [private]
CEnumConnectionPoints::CEnumConnectionPoints | ( | LPUNKNOWN | lpUnk,
 |  | DWORD | nCount
 | ) |  |

Definition at line 188 of file CConnectionPT.cpp.

                                                                          :
  CEnumXXX<CEnumConnectionPoints, LPCONNECTIONPOINT, IEnumConnectionPoints>(lpUnk, IID_IEnumConnectionPoints, nCount)
{
  DEBUGTRACE(_T("In CEnumConnectionPoints ctor"));
}

CEnumConnectionPoints::~CEnumConnectionPoints ( )

Definition at line 195 of file CConnectionPT.cpp.

{
  DEBUGTRACE(_T("In CEnumConnectionPoints dtor"));
}

Member Function Documentation

bool __stdcall CEnumConnectionPoints::Copy | ( | LPCONNECTIONPOINT * | lpCPLeft,
 |  | LPCONNECTIONPOINT | lpCPRight
 | ) |  |

Definition at line 200 of file CConnectionPT.cpp.

{
  DEBUGTRACE(_T("In CEnumConnectionPoints::Copy"));
  // data will have already been verified during creation no need to do so here
  *lpCPLeft = lpCPRight;
  (*lpCPLeft)->AddRef();
  return true;
}

void __stdcall CEnumConnectionPoints::FinalRelease ( ) [virtual]

Reimplemented from CEnumXXX< CEnumConnectionPoints, LPCONNECTIONPOINT, IEnumConnectionPoints >.

Definition at line 209 of file CConnectionPT.cpp.

{
  DEBUGTRACE(_T("In CEnumConnectionPoints::FinalRelease()"));
  CEnumXXX<CEnumConnectionPoints, LPCONNECTIONPOINT, IEnumConnectionPoints>::FinalRelease();
}

CEnumConnectionPoints* CEnumConnectionPoints::operator& ( ) [private]
CEnumConnectionPoints* CEnumConnectionPoints::operator& ( ) const [private]
CEnumConnectionPoints& CEnumConnectionPoints::operator= ( const CEnumConnectionPoints & ) [private]
The documentation for this class was generated from the following file:
  • Com/async/server/CConnectionPT.cpp
Generated on Wed Nov 13 2024 16:56:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CEnumConnections Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions

CEnumConnections Class Reference

Inherits CEnumXXX< CEnumConnections, CONNECTDATA, IEnumConnections >.

List of all members.

Public Member Functions

CEnumConnections (LPUNKNOWN lpUnk, DWORD nCount)
~CEnumConnections ()
bool __stdcall | Copy (CONNECTDATA *connLeft, CONNECTDATA &connRight)
void __stdcall | FinalRelease ()

Private Member Functions

CEnumConnections ()
CEnumConnections (const CEnumConnections &)
CEnumConnections * operator& ()
CEnumConnections * | operator& () const
CEnumConnections & | operator= (const CEnumConnections &)

Detailed Description

Definition at line 23 of file CConnectionPT.cpp.

Constructor & Destructor Documentation

CEnumConnections::CEnumConnections ( ) [private]
CEnumConnections::CEnumConnections ( const CEnumConnections & ) [private]
CEnumConnections::CEnumConnections | ( | LPUNKNOWN | lpUnk,
 |  | DWORD | nCount
 | ) |  |

Definition at line 435 of file CConnectionPT.cpp.

                                                                :
  CEnumXXX<CEnumConnections, CONNECTDATA, IEnumConnections>(lpUnk, IID_IEnumConnections, nCount)

{
  DEBUGTRACE(_T("In CEnumConnections ctor"));
}

CEnumConnections::~CEnumConnections ( )

Definition at line 442 of file CConnectionPT.cpp.

{
  DEBUGTRACE(_T("In CEnumConnections dtor"));
}

Member Function Documentation

bool __stdcall CEnumConnections::Copy | ( | CONNECTDATA * | connLeft,
 |  | CONNECTDATA & | connRight
 | ) |  |

Definition at line 447 of file CConnectionPT.cpp.

{
  DEBUGTRACE(_T("In CEnumConnections::Copy"));
  // data will have already been verified during creation no need to do so here
  *connLeft = connRight;
  (*connLeft).pUnk->AddRef();
  return true;
}

void __stdcall CEnumConnections::FinalRelease ( ) [virtual]

Reimplemented from CEnumXXX< CEnumConnections, CONNECTDATA, IEnumConnections >.

Definition at line 456 of file CConnectionPT.cpp.

{
  DEBUGTRACE(_T("In CEnumConnections::FinalRelease()"));
  CEnumXXX<CEnumConnections, CONNECTDATA, IEnumConnections>::FinalRelease();
}

CEnumConnections* CEnumConnections::operator& ( ) [private]
CEnumConnections* CEnumConnections::operator& ( ) const [private]
CEnumConnections& CEnumConnections::operator= ( const CEnumConnections & ) [private]
The documentation for this class was generated from the following file:
  • Com/async/server/CConnectionPT.cpp
Generated on Wed Nov 13 2024 16:56:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CEnumDisplayAttributeInfo Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CEnumDisplayAttributeInfo Class Reference

List of all members.

Public Member Functions

CEnumDisplayAttributeInfo ()
~CEnumDisplayAttributeInfo ()
STDMETHODIMP | Clone (IEnumTfDisplayAttributeInfo **ppEnum)
STDMETHODIMP | Next (ULONG ulCount, ITfDisplayAttributeInfo **rgInfo, ULONG *pcFetched)
STDMETHODIMP | QueryInterface (REFIID riid, void **ppvObj)
STDMETHODIMP | Reset ()
STDMETHODIMP | Skip (ULONG ulCount)
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP_ (ULONG) Release(void)

Private Attributes

LONG | _cRef
LONG | _iIndex

Detailed Description

Definition at line 193 of file dap.cpp.

Constructor & Destructor Documentation

CEnumDisplayAttributeInfo::CEnumDisplayAttributeInfo ( )

Definition at line 221 of file dap.cpp.

{
    DllAddRef();

    _iIndex = 0;
    _cRef = 1;
}

CEnumDisplayAttributeInfo::~CEnumDisplayAttributeInfo ( )

Definition at line 235 of file dap.cpp.

{
    DllRelease();
}

Member Function Documentation

STDAPI CEnumDisplayAttributeInfo::Clone ( IEnumTfDisplayAttributeInfo ** ppEnum )

Definition at line 307 of file dap.cpp.

{
    CEnumDisplayAttributeInfo *pClone;

    if (ppEnum == NULL)
        return E_INVALIDARG;

    *ppEnum = NULL;

    if ((pClone = new CEnumDisplayAttributeInfo) == NULL)
        return E_OUTOFMEMORY;

    // the clone should match this object's state
    pClone->_iIndex = _iIndex;

    *ppEnum = pClone;

    return S_OK;
}

STDAPI CEnumDisplayAttributeInfo::Next | ( | ULONG | ulCount,
 |  | ITfDisplayAttributeInfo ** | rgInfo,
 |  | ULONG * | pcFetched
 | ) |  |

Definition at line 334 of file dap.cpp.

{
    ULONG cFetched;

    if (pcFetched == NULL)
    {
        // technically this is only legal if ulCount == 1, but we won't check
        pcFetched = &cFetched;
    }

    *pcFetched = 0;

    if (ulCount == 0)
        return S_OK;

    // we only have a single display attribute to enum, so this is trivial

    if (_iIndex == 0)
    {
        *rgInfo = &g_DisplayAttributeInfo;
        (*rgInfo)->AddRef();
        *pcFetched = 1;
        _iIndex++;
    }

    return (*pcFetched == ulCount) ? S_OK : S_FALSE;
}

STDAPI CEnumDisplayAttributeInfo::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppvObj
 | ) |  |

Definition at line 246 of file dap.cpp.

{
    if (ppvObj == NULL)
        return E_INVALIDARG;

    *ppvObj = NULL;

    if (IsEqualIID(riid, IID_IUnknown) ||
        IsEqualIID(riid, IID_IEnumTfDisplayAttributeInfo))
    {
        *ppvObj = (IEnumTfDisplayAttributeInfo *)this;
    }

    if (*ppvObj)
    {
        AddRef();
        return S_OK;
    }

    return E_NOINTERFACE;
}

STDAPI CEnumDisplayAttributeInfo::Reset ( void )

Definition at line 369 of file dap.cpp.

{
    _iIndex = 0;
    return S_OK;
}

STDAPI CEnumDisplayAttributeInfo::Skip ( ULONG ulCount )

Definition at line 382 of file dap.cpp.

{
    // we have only a single item to enum
    // so we can just skip it and avoid any overflow errors
    if (ulCount > 0 && _iIndex == 0)
    {
        _iIndex++;
    }
    return S_OK;
}

CEnumDisplayAttributeInfo::STDMETHODIMP_ ( ULONG )
CEnumDisplayAttributeInfo::STDMETHODIMP_ ( ULONG )

Member Data Documentation

LONG CEnumDisplayAttributeInfo::_cRef [private]

Definition at line 212 of file dap.cpp.

LONG CEnumDisplayAttributeInfo::_iIndex [private]

Definition at line 211 of file dap.cpp.

The documentation for this class was generated from the following file:
  • WinUI/TSFmark/dap.cpp
Generated on Wed Nov 13 2024 16:56:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CEnumerator Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CEnumerator Class Reference

#include "cenum.h"

Inherits CPropertiesBase.

List of all members.

Public Member Functions

CEnumerator (CMainWindow *pCMainWindow, CMDIChild *pCMDIChild=NULL)
virtual | ~CEnumerator ()
virtual HRESULT | AutoQI (DWORD dwCreateOpts)
virtual HRESULT | AutoRelease ()
virtual HRESULT | Create (REFCLSID clsid)
virtual HRESULT | CreateEnumInfo (REFCLSID clsid=GUID_NULL, BOOL fRefresh=FALSE)
virtual HRESULT | CreateInstance (CAggregate *pCAggregate, REFCLSID clsid, DWORD dwCLSCTX, REFIID riid, IUnknown **ppIUnknown, WCHAR *pwszRemoteServer=NULL)
virtual HRESULT | EnumerateInfo (ULONG *pcEnumInfo, ENUMINFO **prgEnumInfo)
virtual REFIID | GetDefaultInterface ()
virtual IUnknown ** | GetInterfaceAddress (REFIID riid)
virtual WCHAR * | GetObjectDesc ()
virtual LONG | GetObjectImage ()
virtual UINT | GetObjectMenu ()
virtual WCHAR * | GetObjectName ()
virtual HRESULT | GetSourcesRowset (CAggregate *pCAggregate, REFIID riid, ULONG cPropSets, DBPROPSET *rgPropSets, IUnknown **ppIUnknown)
virtual void | OnDefOperation ()
virtual HRESULT | ParseDisplayName (WCHAR *pwszParseName, DWORD dwCLSCTX, REFIID riid, IUnknown **ppIUnknown, CBase **ppCSource, DWORD dwConnectOpts=0, WCHAR *pwszRemoteServer=NULL)

Public Attributes

ULONG m_cEnumInfo
IParseDisplayName * | m_pIParseDisplayName
ISourcesRowset * | m_pISourcesRowset
ENUMINFO * m_rgEnumInfo

Detailed Description

Definition at line 42 of file cenum.h.

Constructor & Destructor Documentation

CEnumerator::CEnumerator | ( | CMainWindow * | pCMainWindow,
 |  | CMDIChild * | pCMDIChild = NULL
 | ) |  |

Definition at line 22 of file cenum.cpp.

  : CPropertiesBase(eCEnumerator, pCMainWindow, pCMDIChild)
{
  //[MANDATORY]
  m_pISourcesRowset     = NULL;   //Enumerator interface
  m_pIParseDisplayName    = NULL;   //Enumerator interface

  //[OPTIONAL]

  //Enumerator ProvierInfo
  m_cEnumInfo       = 0;
  m_rgEnumInfo      = NULL;
}

CEnumerator::~CEnumerator ( ) [virtual]

Definition at line 41 of file cenum.cpp.

{
  ReleaseObject(0);

  m_cEnumInfo     = 0;
  SAFE_FREE(m_rgEnumInfo);
}

Member Function Documentation

HRESULT CEnumerator::AutoQI ( DWORD dwCreateOpts ) [virtual]

Reimplemented from CPropertiesBase.

Definition at line 85 of file cenum.cpp.

{
  //Delegate First so we have base interfaces
  CPropertiesBase::AutoQI(dwCreateOpts);

  //[MANDATORY]
  if(dwCreateOpts & CREATE_QI_MANDATORY)
  {
    OBTAIN_INTERFACE(IParseDisplayName);
    OBTAIN_INTERFACE(ISourcesRowset);
  }

  //AutoQI
  if(dwCreateOpts & CREATE_QI_OPTIONAL)
  {
    //[OPTIONAL]
  }

  return S_OK;
}

HRESULT CEnumerator::AutoRelease ( ) [virtual]

Reimplemented from CPropertiesBase.

Definition at line 68 of file cenum.cpp.

{
  //[MANDATORY]
  RELEASE_INTERFACE(ISourcesRowset);
  RELEASE_INTERFACE(IParseDisplayName);

  //[OPTIONAL]

  //Delegate
  return CPropertiesBase::AutoRelease();
}

HRESULT CEnumerator::Create ( REFCLSID clsid ) [virtual]

Definition at line 323 of file cenum.cpp.

{
  HRESULT hr = S_OK;
  CComPtr<IParseDisplayName>  spParseDisplayName;

  //Initialize the Enumerator and Obtain rowset
  m_guidSource = clsid;
  TESTC(hr = CreateInstance(NULL, clsid, CLSCTX_ALL, IID_IParseDisplayName, (IUnknown**)&spParseDisplayName));

  //Now Delegate to our generic Enumerator method
  TESTC(hr = CreateObject(NULL, IID_IParseDisplayName, spParseDisplayName));

CLEANUP:
  return hr;
}

HRESULT CEnumerator::CreateEnumInfo | ( | REFCLSID | clsid = GUID_NULL,
 |  | BOOL | fRefresh = FALSE |
 | ) |  |  | [virtual]

Definition at line 344 of file cenum.cpp.

{
  HRESULT hr = S_OK;

  //Create the Enumerator, if we haven't already...
  if(clsid!=GUID_NULL && !m_pIParseDisplayName)
    TESTC(hr = Create(clsid));

  //Free Previous Info
  if(fRefresh || !m_cEnumInfo)
  {
    m_cEnumInfo = 0;
    SAFE_FREE(m_rgEnumInfo)

    //Obtain the Enumerator Info from the rowset...
    TESTC(hr = EnumerateInfo(&m_cEnumInfo, &m_rgEnumInfo));
  }

CLEANUP:
  return hr;
}

HRESULT CEnumerator::CreateInstance | ( | CAggregate * | pCAggregate,
 |  | REFCLSID | clsid,
 |  | DWORD | dwCLSCTX,
 |  | REFIID | riid,
 |  | IUnknown ** | ppIUnknown,
 |  | WCHAR * | pwszRemoteServer = NULL |
 | ) |  |  | [virtual]

Definition at line 279 of file cenum.cpp.

{
  HRESULT hr = S_OK;

  //CLSID to String (just for display purposes...)
  WCHAR* pwszProgID = GetProgID(clsid);

  //Determine which method to use...
  if(dwCLSCTX & CLSCTX_REMOTE_SERVER)
  {
    //Setup ServerInfo...
    COSERVERINFO  ServerInfo  = { 0, pwszRemoteServer, NULL, 0};
    MULTI_QI    MultiQI   = { &riid, NULL, S_OK};

    //CoCreateInstanceEx
    hr = CoCreateInstanceEx(clsid, pCAggregate, dwCLSCTX, &ServerInfo, 1, &MultiQI);
    TESTC(TRACE_METHOD(hr, L"CoCreateInstanceEx(%s, 0x%p, 0x%08x, 0x%p, 1, 0x%p)", pwszProgID, pCAggregate, dwCLSCTX, &ServerInfo, &MultiQI));

    //Output pointer from the MultiQI
    if(ppIUnknown)
      *ppIUnknown = MultiQI.pItf;
  }
  else
  {
    //CoCreateInstance
    hr = CoCreateInstance(clsid, pCAggregate, dwCLSCTX, riid, (void**)ppIUnknown);
    TESTC(TRACE_METHOD(hr, L"CoCreateInstance(%s, 0x%p, 0x%08x, %s, &0x%p)", pwszProgID, pCAggregate, dwCLSCTX, GetInterfaceName(riid), ppIUnknown ? *ppIUnknown : NULL));
  }

  //Handle Aggregation
  if(pCAggregate)
    TESTC(hr = pCAggregate->HandleAggregation(riid, ppIUnknown));

CLEANUP:
  SAFE_FREE(pwszProgID);
  return hr;
}

HRESULT CEnumerator::EnumerateInfo | ( | ULONG * | pcEnumInfo,
 |  | ENUMINFO ** | prgEnumInfo |
 | ) |  |  | [virtual]

Definition at line 371 of file cenum.cpp.

{
  HRESULT hr = E_FAIL;
  ASSERT(pcEnumInfo);
  ASSERT(prgEnumInfo);

  HROW rghRows[MAX_BLOCK_SIZE];
  HROW* phRows = rghRows;
  DBCOUNTITEM cRowsObtained = 0;
  CComPtr<IRowset> spRowset = NULL;
  HACCESSOR hAccessor = DB_NULL_HACCESSOR;
  CRowset cRowset(m_pCMainWindow);

  //Make our lives easier
  ULONG cEnumInfo = 0;
  ENUMINFO* rgEnumInfo = NULL;

  // Bind the user and table name for the list
  const static DBCOUNTITEM cBindings = 5;
  const static DBBINDING rgBindings[cBindings] =
    {
      1,
      offsetof(ENUMINFO, wszName),
      0,
      0,
      NULL,
      NULL,
      NULL,
      DBPART_VALUE,
      DBMEMOWNER_CLIENTOWNED,
      DBPARAMIO_NOTPARAM,
      MAX_NAME_LEN,
      0,
      DBTYPE_WSTR,
      0,
      0,

      2,
      offsetof(ENUMINFO, wszParseName),
      0,
      0,
      NULL,
      NULL,
      NULL,
      DBPART_VALUE,
      DBMEMOWNER_CLIENTOWNED,
      DBPARAMIO_NOTPARAM,
      MAX_NAME_LEN,
      0,
      DBTYPE_WSTR,
      0,
      0,

      3,
      offsetof(ENUMINFO, wszDescription),
      0,
      0,
      NULL,
      NULL,
      NULL,
      DBPART_VALUE,
      DBMEMOWNER_CLIENTOWNED,
      DBPARAMIO_NOTPARAM,
      MAX_NAME_LEN,
      0,
      DBTYPE_WSTR,
      0,
      0,

      4,
      offsetof(ENUMINFO, eType),
      0,
      0,
      NULL,
      NULL,
      NULL,
      DBPART_VALUE,
      DBMEMOWNER_CLIENTOWNED,
      DBPARAMIO_NOTPARAM,
      sizeof(USHORT),
      0,
      DBTYPE_UI2,
      0,
      0,

      5,
      offsetof(ENUMINFO, fIsParent),
      0,
      0,
      NULL,
      NULL,
      NULL,
      DBPART_VALUE,
      DBMEMOWNER_CLIENTOWNED,
      DBPARAMIO_NOTPARAM,
      sizeof(VARIANT_BOOL),
      0,
      DBTYPE_BOOL,
      0,
      0,
  };

  //ISourcesRowset::GetSourcesRowset
  TESTC(hr = GetSourcesRowset(NULL, IID_IRowset, 0, NULL, (IUnknown**)&spRowset));
  TESTC(hr = cRowset.CreateObject(this, IID_IRowset, spRowset));

  //Create Accessor
  TESTC(hr = cRowset.CreateAccessor(DBACCESSOR_ROWDATA, cBindings, (DBBINDING*)rgBindings, 0, &hAccessor));

  //Loop through the entire returned rowset
  while(TRUE)
  {
    TESTC(hr = cRowset.GetNextRows(0, MAX_BLOCK_SIZE, &cRowsObtained, &phRows));

    //ENDOFROWSET
    if(cRowsObtained==0)
      break;

    //Alloc room for ProviderInfo (in chunks)
    SAFE_REALLOC(rgEnumInfo, ENUMINFO, cEnumInfo + cRowsObtained);
    memset(&rgEnumInfo[cEnumInfo], 0, sizeof(ENUMINFO) * (size_t)cRowsObtained);

    //Loop over rows obtained and get ProviderInfo
    for(ULONG i=0; i<cRowsObtained; i++)
    {
      //Get the Data
      TESTC(hr = cRowset.GetData(rghRows[i], hAccessor, (void*)&rgEnumInfo[cEnumInfo]));
      cEnumInfo++;
    }

    //Release all the rows
    TESTC(hr = cRowset.ReleaseRows(cRowsObtained, rghRows));
  }

  //Special handling for Root Enumerator
  if(m_guidSource == CLSID_OLEDB_ENUMERATOR)
  {
    //NOTE:  The Root Enumerator doesn't include itself in the List of Enumerators
    //This is good for the case of tree controls would be never ending, but bad
    //for apps like this one, where you might want to see the "rowset" of the Root
    //Enum.  So to get arround this I will just add it to the list manually

    //Alloc room for extra MSDAENUM additon
    SAFE_REALLOC(rgEnumInfo, ENUMINFO, cEnumInfo + 2);
    StringCopy(rgEnumInfo[cEnumInfo].wszName,   L"MSDAENUM", MAX_NAME_LEN);
    StringCopy(rgEnumInfo[cEnumInfo].wszParseName,  L"{c8b522d0-5cf3-11ce-ade5-00aa0044773d}",  MAX_NAME_LEN);
    StringCopy(rgEnumInfo[cEnumInfo].wszDescription,L"Microsoft OLE DB Root Enumerator", MAX_NAME_LEN);
    rgEnumInfo[cEnumInfo].eType           = DBSOURCETYPE_ENUMERATOR;
    rgEnumInfo[cEnumInfo].fIsParent         = VARIANT_TRUE;
    cEnumInfo++;

    //Also add the RootBinder to the list of valid progids.
    StringCopy(rgEnumInfo[cEnumInfo].wszName,   L"MSDAURL.Binder", MAX_NAME_LEN);
    StringCopy(rgEnumInfo[cEnumInfo].wszParseName,  L"{FF151822-B0BF-11D1-A80D-000000000000}", MAX_NAME_LEN);
    StringCopy(rgEnumInfo[cEnumInfo].wszDescription,L"Microsoft OLE DB Root Binder for Internet Publishing", MAX_NAME_LEN);
    rgEnumInfo[cEnumInfo].eType           = DBSOURCETYPE_ENUMERATOR;
    rgEnumInfo[cEnumInfo].fIsParent         = VARIANT_TRUE;
    cEnumInfo++;
  }

CLEANUP:
  //Now update the output params
  *pcEnumInfo = cEnumInfo;
  *prgEnumInfo = rgEnumInfo;

  cRowset.ReleaseAccessor(&hAccessor);
  return hr;
}

virtual REFIID CEnumerator::GetDefaultInterface ( ) [inline, virtual]

Implements CBase.

Definition at line 58 of file cenum.h.

{ return IID_ISourcesRowset;  }

IUnknown ** CEnumerator::GetInterfaceAddress ( REFIID riid ) [virtual]

Reimplemented from CPropertiesBase.

Definition at line 54 of file cenum.cpp.

{
  HANDLE_GETINTERFACE(ISourcesRowset);
  HANDLE_GETINTERFACE(IParseDisplayName);

  //Otherwise delegate
  return CPropertiesBase::GetInterfaceAddress(riid);
}

WCHAR * CEnumerator::GetObjectDesc ( ) [virtual]

Reimplemented from CBase.

Definition at line 111 of file cenum.cpp.

{
  if(!m_strObjectDesc && m_guidSource != GUID_NULL)
  {
    if(m_guidSource == CLSID_OLEDB_ENUMERATOR)
      m_strObjectDesc.CopyFrom(L"Root Enumerator");
    else
      m_strObjectDesc.CopyFrom(GetProgID(m_guidSource));
  }

  return m_strObjectDesc;
}

virtual LONG CEnumerator::GetObjectImage ( ) [inline, virtual]

Implements CBase.

Definition at line 57 of file cenum.h.

{ return IMAGE_OBJECTS;     }

virtual UINT CEnumerator::GetObjectMenu ( ) [inline, virtual]

Implements CBase.

Definition at line 56 of file cenum.h.

{ return IDM_ENUMERATORMENU;  }

virtual WCHAR* CEnumerator::GetObjectName ( ) [inline, virtual]

Implements CBase.

Definition at line 55 of file cenum.h.

{ return L"Enumerator";     }

HRESULT CEnumerator::GetSourcesRowset | ( | CAggregate * | pCAggregate,
 |  | REFIID | riid,
 |  | ULONG | cPropSets,
 |  | DBPROPSET * | rgPropSets,
 |  | IUnknown ** | ppIUnknown |
 | ) |  |  | [virtual]

Definition at line 250 of file cenum.cpp.

{
  HRESULT hr = S_OK;

  if(m_pISourcesRowset)
  {
    XTEST_(hr = m_pISourcesRowset->GetSourcesRowset(pCAggregate, riid, cPropSets, rgPropSets, ppIUnknown),S_OK);
    TRACE_METHOD(hr, L"ISourcesRowset::GetSourcesRowset(0x%p, %s, %d, 0x%p, &0x%p)", pCAggregate, GetInterfaceName(riid), cPropSets, rgPropSets, ppIUnknown ? *ppIUnknown : NULL);
  }

  //Display Errors (if occurred)
  TESTC(hr = DisplayPropErrors(hr, cPropSets, rgPropSets));

  //Handle Aggregation
  if(pCAggregate)
    TESTC(hr = pCAggregate->HandleAggregation(riid, ppIUnknown));

CLEANUP:
  return hr;
}

void CEnumerator::OnDefOperation ( ) [virtual]

Reimplemented from CBase.

Definition at line 129 of file cenum.cpp.

{
  if(m_pISourcesRowset)
    m_pCMainWindow->DisplayDialog(IDD_GETSOURCESROWSET, GetFocus(), CMainWindow::GetSourcesRowsetProc, this);
}

HRESULT CEnumerator::ParseDisplayName | ( | WCHAR * | pwszParseName,
 |  | DWORD | dwCLSCTX,
 |  | REFIID | riid,
 |  | IUnknown ** | ppIUnknown,
 |  | CBase ** | ppCSource,
 |  | DWORD | dwConnectOpts = 0,
 |  | WCHAR * | pwszRemoteServer = NULL |
 | ) |  |  | [virtual]

Definition at line 140 of file cenum.cpp.

{
  ASSERT(pwszParseName);

  CComPtr<IMoniker> spMoniker;
  CComPtr<IBindCtx> spBindCtx;
  ULONG chEaten = 0;
  CLSID clsid;
  HRESULT hr = E_FAIL;

  CBase* pCSource = NULL;

  //Try and use ParseDisplayName
  //Otherwise we may be forced to just try CoCreateInstance if not installed...
  //Also cannot use ParseDisplayName if trying to aggregate ServiceComponents
  if(m_pIParseDisplayName && !(dwConnectOpts & CREATE_USESERVICECOMP))
  {
    if(dwCLSCTX)
    {
      //Setup BIND_OPTS
      BIND_OPTS2 BindOps2;
      BindOps2.cbStruct   = sizeof(BIND_OPTS2);
      BindOps2.grfFlags   = BIND_MAYBOTHERUSER;
      BindOps2.grfMode    = STGM_READWRITE;
      BindOps2.dwTickCountDeadline = 0;
      BindOps2.dwTrackFlags = 1;
      BindOps2.dwClassContext = dwCLSCTX;
      BindOps2.locale     = GetSystemDefaultLCID();
      BindOps2.pServerInfo  = NULL;

      //Setup ServerInfo just incase we need it...
      COSERVERINFO  ServerInfo  = { 0, pwszRemoteServer, NULL, 0};

      //Setup RemoteServer is specified
      if(dwCLSCTX & CLSCTX_REMOTE_SERVER)
        BindOps2.pServerInfo = &ServerInfo;

      //If this fails for some reason, we can still continue...
      hr = CreateBindCtx(0, &spBindCtx);
      if(SUCCEEDED(hr) && spBindCtx)
        hr = spBindCtx->SetBindOptions(&BindOps2);

      //If it does fail we will just release the Bind Context and pass
      //IParseDisplayName NULL and let it choose the CLXCTX...
      if(FAILED(hr))
        spBindCtx.Release();
    }

    //ParseDisplayName
    //Don't display error, since we have our own retry logic...
    hr = m_pIParseDisplayName->ParseDisplayName(spBindCtx, pwszParseName, &chEaten, &spMoniker);
    TRACE_METHOD(hr, L"IParseDisplayName::ParseDisplayName(0x%p, \"%s\", &%d, &0x%p)", spBindCtx, pwszParseName, chEaten, spMoniker);

    if(SUCCEEDED(hr))
    {
      XTEST(hr = BindMoniker(spMoniker, 0, riid, (void**)ppIUnknown));
      TESTC(TRACE_METHOD(hr, L"BindMoniker(0x%p, 0, %s, &0x%p)", spBindCtx, GetInterfaceName(riid), ppIUnknown ? *ppIUnknown : NULL));
      pCSource = this;
    }
  }

  //If Not using RootEnum or for some reason the RootEnum failed,
  if(m_pIParseDisplayName == NULL || FAILED(hr))
  {
    //Find the CLSID from the ParseName
    //The user may have entered a ProgID or a CLSID
    //Since the ParseName is a CLSID, try the common case first...
    if(FAILED(hr = CLSIDFromString(pwszParseName, &clsid)))
      XTESTC(hr = CLSIDFromProgID(pwszParseName, &clsid));

    //If using Service Components
    if(dwConnectOpts & CREATE_USESERVICECOMP)
    {
      if(dwCLSCTX == CLSCTX_INPROC_SERVER)
      {
        //Can just reuse our Main DataLink object...
        TESTC(hr = m_pCMainWindow->m_pCServiceComp->CreateDBInstance(clsid, NULL, CLSCTX_INPROC_SERVER, riid, ppIUnknown));
        pCSource = m_pCMainWindow->m_pCServiceComp;
      }
      else
      {
        //If not inproc we just create a stand alone Data Link object
        //We do this again here, incase you want Remoted Providers...
        CServiceComp* pCServiceComp = new CServiceComp(m_pCMainWindow);
        TESTC(pCServiceComp->Create(NULL, dwCLSCTX, pwszRemoteServer));

        //The provider is always "inproc" to wherever the ServiceComponents are:
        TESTC(hr = pCServiceComp->CreateDBInstance(clsid, NULL, CLSCTX_INPROC_SERVER, riid, ppIUnknown));
        pCSource = pCServiceComp;
      }
    }
    else
    {
      //Delegate
      XTESTC(hr = CreateInstance(NULL, clsid, dwCLSCTX, riid, ppIUnknown, pwszRemoteServer));
      pCSource = NULL;
    }
  }

CLEANUP:
  if(ppCSource)
    *ppCSource = pCSource;
  return hr;
}

Member Data Documentation

ULONG CEnumerator::m_cEnumInfo

Definition at line 78 of file cenum.h.

IParseDisplayName* CEnumerator::m_pIParseDisplayName

Definition at line 73 of file cenum.h.

ISourcesRowset* CEnumerator::m_pISourcesRowset

Definition at line 72 of file cenum.h.

ENUMINFO* CEnumerator::m_rgEnumInfo

Definition at line 79 of file cenum.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cenum.h
  • Dataaccess/oledb/rowsetviewer/cenum.cpp
Generated on Wed Nov 13 2024 16:56:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CEnumFormatEtc Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CEnumFormatEtc Class Reference

#include "DataObj.h"

List of all members.

Public Member Functions

CEnumFormatEtc (void)
CEnumFormatEtc (ULONG, LPFORMATETC)
CEnumFormatEtc (LPFORMATETC pFE, int numberItems)
~CEnumFormatEtc (void)
~CEnumFormatEtc (void)
~CEnumFormatEtc (void)
STDMETHODIMP | Clone (LPENUMFORMATETC *)
STDMETHODIMP | Clone (IEnumFORMATETC **)
STDMETHOD() | Clone (IEnumFORMATETC **)
STDMETHODIMP | Next (ULONG, LPFORMATETC, ULONG *)
STDMETHOD() | Next (ULONG, LPFORMATETC, ULONG *)
STDMETHODIMP | Next (ULONG, LPFORMATETC, ULONG *)
STDMETHODIMP | QueryInterface (REFIID, VOID **)
STDMETHOD() | QueryInterface (REFIID, LPVOID *)
STDMETHODIMP | QueryInterface (REFIID, LPVOID *)
STDMETHODIMP | Reset (void)
STDMETHODIMP | Reset (void)
STDMETHOD() | Reset (void)
STDMETHODIMP | Skip (ULONG)
STDMETHOD() | Skip (ULONG)
STDMETHODIMP | Skip (ULONG)
STDMETHOD_ (ULONG, Release)(void)
STDMETHOD_ (ULONG, AddRef)(void)
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) AddRef(void)

Private Attributes

ULONG m_cfe
UINT m_cfEmbedSource
ULONG m_cItems
ULONG m_cRef
DWORD m_cRefCount
ULONG m_iCur
ULONG m_ObjRefCount
LPFORMATETC | m_prgfe
LPFORMATETC | m_pStrFE

Detailed Description

Definition at line 80 of file DataObj.h.

Constructor & Destructor Documentation

CEnumFormatEtc::CEnumFormatEtc ( void )

Definition at line 327 of file DataObj.Cpp.

{
  OutputDebugString(TEXT("CEnumFormatEtc's constructor\n"));

  m_ObjRefCount = 0;

  m_iCur = 0;

  m_cfEmbedSource = RegisterClipboardFormat(CF_EMBEDSOURCE);
}

CEnumFormatEtc::~CEnumFormatEtc ( void )

Definition at line 344 of file DataObj.Cpp.

{
  OutputDebugString(TEXT("CEnumFormatEtc's destructor\n"));
}

CEnumFormatEtc::CEnumFormatEtc | ( | ULONG | cFE,
 |  | LPFORMATETC | prgFE
 | ) |  |

Definition at line 25 of file enumformatetc.cpp.

    {
    UINT        i;

    m_cRef=0;
    m_iCur=0;
    m_cfe=cFE;
    m_prgfe=new FORMATETC[(UINT)cFE];

    if (NULL!=m_prgfe)
        {
        for (i=0; i < cFE; i++)
            m_prgfe[i]=prgFE[i];
        }

    return;
    }

CEnumFormatEtc::~CEnumFormatEtc ( void )
CEnumFormatEtc::CEnumFormatEtc | ( | LPFORMATETC | pFE,
 |  | int | numberItems
 | ) |  |

Definition at line 32 of file Enumfe.Cpp.

{
m_cRefCount = 1;

m_iCur = 0;

m_pStrFE = new FORMATETC[nItems];

if (m_pStrFE)
    {
    CopyMemory((LPBYTE)m_pStrFE, (LPBYTE)pFE, sizeof(FORMATETC) * nItems);
    m_cItems = nItems;
    }
else
    {
    m_cItems = 0;
    }
}

CEnumFormatEtc::~CEnumFormatEtc ( void )

Member Function Documentation

STDMETHODIMP CEnumFormatEtc::Clone ( LPENUMFORMATETC * ppEnum )

Definition at line 481 of file DataObj.Cpp.

{
  OutputDebugString(TEXT("CEnumFormatEtc::Clone\n"));

  CEnumFormatEtc* pNew;

  *ppEnum = NULL;

  // Create the clone.
  pNew = new CEnumFormatEtc();
  if (NULL == pNew)
    return (ResultFromScode(E_OUTOFMEMORY));

  pNew->AddRef();
  pNew->m_iCur = m_iCur;

  *ppEnum = pNew;

  return S_OK;
}

STDMETHOD() CEnumFormatEtc::Clone ( IEnumFORMATETC ** )
STDMETHODIMP CEnumFormatEtc::Clone ( IEnumFORMATETC ** ppCloneEnumFormatEtc )

Definition at line 199 of file Enumfe.Cpp.

{
CEnumFormatEtc *newEnum;

if(NULL == ppCloneEnumFormatEtc)
   return S_FALSE;

newEnum = new CEnumFormatEtc(m_pStrFE, m_cItems);

if(newEnum ==NULL)
   return E_OUTOFMEMORY;

newEnum->AddRef();
newEnum->m_iCur = m_iCur;

*ppCloneEnumFormatEtc = newEnum;

return S_OK;
}

STDMETHOD() CEnumFormatEtc::Next | ( | ULONG | ,
 |  | LPFORMATETC | ,
 |  | ULONG * |
 | ) |  |
STDMETHODIMP CEnumFormatEtc::Next | ( | ULONG | ,
 |  | LPFORMATETC | ,
 |  | ULONG * |
 | ) |  |
STDMETHODIMP CEnumFormatEtc::Next | ( | ULONG | cRequested,
 |  | LPFORMATETC | pFE,
 |  | ULONG * | puFetched
 | ) |  |

Definition at line 419 of file DataObj.Cpp.

{
  UNREFERENCED_PARAMETER(cRequested);
  OutputDebugString(TEXT("CEnumFormatEtc::Next\n"));

  if(m_iCur > 0)
  {
    *puFetched = 0;
    return S_FALSE;
  }

  // CLIPFORMAT is a WORD
  pFE->cfFormat = (WORD)m_cfEmbedSource;
  pFE->dwAspect = DVASPECT_CONTENT;
  pFE->tymed = TYMED_ISTORAGE;

  *puFetched = 1;

  m_iCur++;

  return S_OK;
}

STDMETHODIMP CEnumFormatEtc::QueryInterface | ( | REFIID | riid,
 |  | VOID ** | ppv
 | ) |  |

Definition at line 73 of file enumformatetc.cpp.

    {
    *ppv=NULL;

    /*
     * Enumerators are separate objects, not the data object, so
     * we only need to support out IUnknown and IEnumFORMATETC
     * interfaces here with no concern for aggregation.
     */
    if (IID_IUnknown==riid || IID_IEnumFORMATETC==riid)
        *ppv=this;

    //AddRef any interface we'll return.
    if (NULL!=*ppv)
        {
        ((LPUNKNOWN)*ppv)->AddRef();
        return NOERROR;
        }

    return ResultFromScode(E_NOINTERFACE);
    }

STDMETHODIMP CEnumFormatEtc::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppReturn
 | ) |  |

Definition at line 355 of file DataObj.Cpp.

{
  OutputDebugString(TEXT("CEnumFormatEtc::QueryInterface\n"));

  *ppReturn = NULL;

  if(IsEqualIID(riid, IID_IUnknown))
  {
    *ppReturn = (LPVOID)this;
  }
  else if(IsEqualIID(riid, IID_IEnumFORMATETC))
  {
    *ppReturn = (LPVOID)this;
  }

  if(NULL != *ppReturn)
  {
    ((LPUNKNOWN)*ppReturn)->AddRef();
    return NOERROR;
  }

  return E_NOINTERFACE;
}

STDMETHOD() CEnumFormatEtc::QueryInterface | ( | REFIID | ,
 |  | LPVOID * |
 | ) |  |
STDMETHOD() CEnumFormatEtc::Reset ( void )
STDMETHODIMP CEnumFormatEtc::Reset ( void )
STDMETHODIMP CEnumFormatEtc::Reset ( void )

Definition at line 466 of file DataObj.Cpp.

{
  OutputDebugString(TEXT("CEnumFormatEtc::Reset\n"));

  m_iCur = 0;

  return S_OK;
}

STDMETHOD() CEnumFormatEtc::Skip ( ULONG )
STDMETHODIMP CEnumFormatEtc::Skip ( ULONG cSkip )

Definition at line 448 of file DataObj.Cpp.

{
  OutputDebugString(TEXT("CEnumFormatEtc::Skip\n"));

  if((m_iCur + cSkip) > 1)
    return S_FALSE;

  m_iCur += cSkip;

  return S_OK;
}

STDMETHODIMP CEnumFormatEtc::Skip ( ULONG )
CEnumFormatEtc::STDMETHOD_ | ( | ULONG | ,
 |  | AddRef |
 | ) |  |
CEnumFormatEtc::STDMETHOD_ | ( | ULONG | ,
 |  | Release |
 | ) |  |
CEnumFormatEtc::STDMETHODIMP_ ( ULONG )
CEnumFormatEtc::STDMETHODIMP_ ( ULONG )
CEnumFormatEtc::STDMETHODIMP_ ( ULONG )
CEnumFormatEtc::STDMETHODIMP_ ( ULONG )

Member Data Documentation

ULONG CEnumFormatEtc::m_cfe [private]

Definition at line 28 of file enumformatetc.h.

UINT CEnumFormatEtc::m_cfEmbedSource [private]

Definition at line 85 of file DataObj.h.

ULONG CEnumFormatEtc::m_cItems [private]

Definition at line 38 of file Enumfe.h.

ULONG CEnumFormatEtc::m_cRef [private]

Definition at line 26 of file enumformatetc.h.

DWORD CEnumFormatEtc::m_cRefCount [private]

Definition at line 35 of file Enumfe.h.

ULONG CEnumFormatEtc::m_iCur [private]

Definition at line 84 of file DataObj.h.

ULONG CEnumFormatEtc::m_ObjRefCount [private]

Definition at line 83 of file DataObj.h.

LPFORMATETC CEnumFormatEtc::m_prgfe [private]

Definition at line 29 of file enumformatetc.h.

LPFORMATETC CEnumFormatEtc::m_pStrFE [private]

Definition at line 36 of file Enumfe.h.

The documentation for this class was generated from the following files:
  • Com/Fundamentals/ActiveDocument/DoServer/DataObj.h
  • SysMgmt/MMC/mmc2.0/dragdrop/enumformatetc.h
  • WinUI/Shell/DragImg/Enumfe.h
  • Com/Fundamentals/ActiveDocument/DoServer/DataObj.Cpp
  • SysMgmt/MMC/mmc2.0/dragdrop/enumformatetc.cpp
  • WinUI/Shell/DragImg/Enumfe.Cpp
Generated on Wed Nov 13 2024 16:56:28 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CEnumIDList Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CEnumIDList Class Reference

#include "Enumidl.h"

List of all members.

Public Member Functions

CEnumIDList (LPCTSTR, DWORD)
~CEnumIDList ()
STDMETHOD() | Clone (LPENUMIDLIST *)
STDMETHOD() | Next (DWORD, LPITEMIDLIST *, LPDWORD)
STDMETHOD() | QueryInterface (REFIID, LPVOID *)
STDMETHOD() | Reset (VOID)
STDMETHOD() | Skip (DWORD)
STDMETHOD_ (DWORD, AddRef)()
STDMETHOD_ (DWORD, Release)()

Private Member Functions

BOOL | AddToEnumList (LPITEMIDLIST)
BOOL | CreateEnumList (VOID)
BOOL | DeleteList (VOID)

Private Attributes

DWORD m_dwFlags
DWORD m_ObjRefCount
LPENUMLIST m_pCurrent
LPENUMLIST m_pFirst
LPENUMLIST m_pLast
LPMALLOC | m_pMalloc
CPidlMgr * m_pPidlMgr
TCHAR | m_szPath [MAX_PATH]

Detailed Description

Definition at line 43 of file Enumidl.h.

Constructor & Destructor Documentation

CEnumIDList::CEnumIDList | ( | LPCTSTR | pszPath,
 |  | DWORD | dwFlags
 | ) |  |

Definition at line 32 of file Enumidl.Cpp.

{
g_DllRefCount++;

m_pFirst = m_pLast = m_pCurrent = NULL;

m_szPath[0] = 0;
if(pszPath)
   lstrcpyn(m_szPath, pszPath, MAX_PATH);

m_dwFlags = dwFlags;

m_pPidlMgr = new CPidlMgr();
if(!m_pPidlMgr)
   {
   delete this;
   return;
   }

//get the shell's IMalloc pointer
//we'll keep this until we get destroyed
if(FAILED(SHGetMalloc(&m_pMalloc)))
   {
   delete this;
   return;
   }

if(!CreateEnumList())
   {
   delete this;
   return;
   }

m_ObjRefCount = 1;
}

CEnumIDList::~CEnumIDList ( )

Definition at line 74 of file Enumidl.Cpp.

{
DeleteList();

if(m_pMalloc)
   m_pMalloc->Release();

if(m_pPidlMgr)
   delete m_pPidlMgr;

g_DllRefCount--;
}

Member Function Documentation

BOOL CEnumIDList::AddToEnumList ( LPITEMIDLIST pidl ) [private]

Definition at line 355 of file Enumidl.Cpp.

{
LPENUMLIST  pNew;

pNew = (LPENUMLIST)m_pMalloc->Alloc(sizeof(ENUMLIST));

if(pNew)
   {
   //set the next pointer
   pNew->pNext = NULL;
   pNew->pidl = pidl;

   //is this the first item in the list?
   if(!m_pFirst)
      {
      m_pFirst = pNew;
      m_pCurrent = m_pFirst;
      }

   if(m_pLast)
      {
      //add the new item to the end of the list
      m_pLast->pNext = pNew;
      }

   //update the last item pointer
   m_pLast = pNew;

   return TRUE;
   }

return FALSE;
}

STDMETHODIMP CEnumIDList::Clone ( LPENUMIDLIST * ppEnum )

Definition at line 226 of file Enumidl.Cpp.

{
HRESULT  hr = E_OUTOFMEMORY;

*ppEnum = new CEnumIDList(m_szPath, m_dwFlags);

if(*ppEnum)
   {
   LPENUMLIST  pTemp;

   //synchronize the current pointer
   for(pTemp = m_pFirst; pTemp != m_pCurrent; pTemp = pTemp->pNext)
      {
      (*ppEnum)->Skip(1);
      }
   hr = S_OK;
   }

return hr;
}

BOOL CEnumIDList::CreateEnumList ( VOID ) [private]

Definition at line 253 of file Enumidl.Cpp.

{
LPITEMIDLIST   pidl;

//enumerate the folders
if(m_dwFlags & SHCONTF_FOLDERS)
   {
   HANDLE            hFind;
   WIN32_FIND_DATA   wfd;
   TCHAR             szTemp[MAX_PATH];

   lstrcpyn(szTemp, m_szPath, ARRAYSIZE(szTemp));
   SmartAppendBackslash(szTemp, ARRAYSIZE(szTemp));
   StrCatBuff(szTemp, TEXT("*.*"), ARRAYSIZE(szTemp));

   hFind = FindFirstFile(szTemp, &wfd);

   if(INVALID_HANDLE_VALUE != hFind)
      {
      do
         {
         if((FILE_ATTRIBUTE_DIRECTORY & wfd.dwFileAttributes) &&
            ((wfd.dwFileAttributes & FILTER_ATTRIBUTES) == FILTER_ATTRIBUTES) &&
            lstrcmpi(wfd.cFileName, TEXT(".")) &&
            lstrcmpi(wfd.cFileName, TEXT("..")))
            {
            //We found one of our directories. Make sure it contains a data file.
            TCHAR szFolder[MAX_PATH];
            lstrcpyn(szFolder, wfd.cFileName, ARRAYSIZE(szFolder));

            //build the path of the directory or file found
            lstrcpyn(szTemp, m_szPath, ARRAYSIZE(szTemp));
            SmartAppendBackslash(szTemp, ARRAYSIZE(szTemp));
            StrCatBuff(szTemp, wfd.cFileName, ARRAYSIZE(szTemp));
            SmartAppendBackslash(szTemp, ARRAYSIZE(szTemp));
            StrCatBuff(szTemp, c_szDataFile, ARRAYSIZE(szTemp));
            HANDLE   hDataFile = FindFirstFile(szTemp, &wfd);
            if(INVALID_HANDLE_VALUE != hDataFile)
               {
               FindClose(hDataFile);

               pidl = m_pPidlMgr->CreateFolderPidl(szFolder);

               if(pidl)
                  AddToEnumList(pidl);
               }

            }
         }
      while(FindNextFile(hFind, &wfd));

      FindClose(hFind);
      }

   }

//enumerate the non-folder items
if(m_dwFlags & SHCONTF_NONFOLDERS)
   {
   TCHAR    szDataFile[MAX_PATH];
   TCHAR    szKeys[10000] = TEXT("");
   LPTSTR   pStr;

   BuildDataFileName(szDataFile, m_szPath, MAX_PATH);

   //get the items from the [Items] section

   //now enumerate the items in the INI file
   GetPrivateProfileString(   c_szSection,
                              NULL,
                              TEXT(""),
                              szKeys,
                              sizeof(szKeys),
                              szDataFile);

   for(pStr = szKeys; *pStr; pStr += lstrlen(pStr) + 1)
      {
      TCHAR szData[MAX_DATA];

      GetPrivateProfileString(   c_szSection,
                                 pStr,
                                 TEXT(""),
                                 szData,
                                 MAX_DATA,
                                 szDataFile);

      pidl = m_pPidlMgr->CreateItemPidl(pStr, szData);

      if(pidl)
         AddToEnumList(pidl);
      }
   }

return TRUE;
}

BOOL CEnumIDList::DeleteList ( VOID ) [private]

Definition at line 395 of file Enumidl.Cpp.

{
LPENUMLIST  pDelete;

while(m_pFirst)
   {
   pDelete = m_pFirst;
   m_pFirst = pDelete->pNext;

   //free the pidl
   m_pPidlMgr->Delete(pDelete->pidl);

   //free the list item
   m_pMalloc->Free(pDelete);
   }

m_pFirst = m_pLast = m_pCurrent = NULL;

return TRUE;
}

STDMETHOD() CEnumIDList::Next | ( | DWORD | ,
 |  | LPITEMIDLIST * | ,
 |  | LPDWORD |
 | ) |  |
STDMETHODIMP CEnumIDList::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppReturn
 | ) |  |

Definition at line 93 of file Enumidl.Cpp.

{
*ppReturn = NULL;

//IUnknown
if(IsEqualIID(riid, IID_IUnknown))
   {
   *ppReturn = this;
   }

//IEnumIDList
else if(IsEqualIID(riid, IID_IEnumIDList))
   {
   *ppReturn = (IEnumIDList*)this;
   }

if(*ppReturn)
   {
   (*(LPUNKNOWN*)ppReturn)->AddRef();
   return S_OK;
   }

return E_NOINTERFACE;
}

STDMETHODIMP CEnumIDList::Reset ( VOID )

Definition at line 213 of file Enumidl.Cpp.

{
m_pCurrent = m_pFirst;

return S_OK;
}

STDMETHODIMP CEnumIDList::Skip ( DWORD dwSkip )

Definition at line 187 of file Enumidl.Cpp.

{
DWORD    dwIndex;
HRESULT  hr = S_OK;

for(dwIndex = 0; dwIndex < dwSkip; dwIndex++)
   {
   //is this the last item in the list?
   if(!m_pCurrent)
      {
      hr = S_FALSE;
      break;
      }

   m_pCurrent = m_pCurrent->pNext;
   }

return hr;
}

CEnumIDList::STDMETHOD_ | ( | DWORD | ,
 |  | Release |
 | ) |  |
CEnumIDList::STDMETHOD_ | ( | DWORD | ,
 |  | AddRef |
 | ) |  |

Member Data Documentation

DWORD CEnumIDList::m_dwFlags [private]

Definition at line 52 of file Enumidl.h.

DWORD CEnumIDList::m_ObjRefCount [private]

Definition at line 46 of file Enumidl.h.

LPENUMLIST CEnumIDList::m_pCurrent [private]

Definition at line 50 of file Enumidl.h.

LPENUMLIST CEnumIDList::m_pFirst [private]

Definition at line 48 of file Enumidl.h.

LPENUMLIST CEnumIDList::m_pLast [private]

Definition at line 49 of file Enumidl.h.

LPMALLOC CEnumIDList::m_pMalloc [private]

Definition at line 47 of file Enumidl.h.

CPidlMgr* CEnumIDList::m_pPidlMgr [private]

Definition at line 51 of file Enumidl.h.

TCHAR CEnumIDList::m_szPath[MAX_PATH] [private]

Definition at line 53 of file Enumidl.h.

The documentation for this class was generated from the following files:
  • WinUI/Shell/SampView/Enumidl.h
  • WinUI/Shell/SampView/Enumidl.Cpp
Generated on Wed Nov 13 2024 16:56:28 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CEnumStorageResource Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CEnumStorageResource Class Reference

#include "CEnumStorageResource.h"

Inherits IWMIServices, CClusterUtils, and CMgdClusCfgInit.

List of all members.

Public Member Functions

CEnumStorageResource (void)
virtual | ~CEnumStorageResource (void)
STDMETHOD() | Clone (IEnumClusCfgManagedResources **ppEnumClusCfgStorageDevicesOut)
STDMETHOD() | Count (DWORD *pnCountOut)
HRESULT | HrNodeResourceCallback (HRESOURCE hResourceIn)
STDMETHOD() | Initialize (IUnknown *punkCallbackIn, LCID lcidIn)
STDMETHOD() | Next (ULONG cNumberRequestedIn, IClusCfgManagedResourceInfo **rgpManagedResourceInfoOut, ULONG *pcNumberFetchedOut)
STDMETHOD() | Reset (void)
STDMETHOD() | SetWbemServices (IWbemServices *pIWbemServicesIn)
STDMETHOD() | Skip (ULONG cNumberToSkipIn)

Private Member Functions

CEnumStorageResource (const CEnumStorageResource &nodeSrc)
HRESULT | HrAddObjectToArray (IUnknown *punkIn)
HRESULT | HrConvertDeviceVolumeToLogicalDisk (BSTR bstrDeviceVolumeIn, BSTR *pbstrLogicalDiskOut)
HRESULT | HrConvertDeviceVolumeToWMIDeviceID (BSTR bstrDeviceVolumeIn, BSTR *pbstrWMIDeviceIDOut)
HRESULT | HrFindDiskWithLogicalDisk (WCHAR cLogicalDiskIn, ULONG *pidxDiskOut)
HRESULT | HrFindDiskWithWMIDeviceID (BSTR bstrWMIDeviceIDIn, ULONG *pidxDiskOut)
HRESULT | HrFixupDisks (void)
HRESULT | HrGetBootLogicalDisk (BSTR *pbstrBootDeviceOut)
HRESULT | HrGetClusterDiskInfo (HRESOURCE hResourceIn, CLUS_SCSI_ADDRESS *pcsaOut, DWORD *pdwSignatureOut)
HRESULT | HrGetClusterProperties (HRESOURCE hResourceIn, BSTR *pbstrResourceNameOut)
HRESULT | HrGetCrashDumpLogicalDisk (BSTR *pbstrCrashDumpLogicalDiskOut)
HRESULT | HrGetDisks (void)
HRESULT | HrGetPageFileLogicalDisks (IClusCfgCallback *picccIn, WCHAR szLogicalDisksOut[26], int *pcLogicalDisksOut)
HRESULT | HrGetSCSIInfo (ULONG idxDiskIn, ULONG *pulSCSIBusOut, ULONG *pulSCSIPortOut)
HRESULT | HrGetSystemDevice (BSTR *pbstrSystemDeviceOut)
HRESULT | HrIsLogicalDiskNTFS (BSTR bstrLogicalDiskIn)
HRESULT | HrIsSystemBusManaged (void)
HRESULT | HrLoadEnum (void)
HRESULT | HrLogDiskInfo (IWbemClassObject *pDiskIn)
HRESULT | HrProcessWMIDiskObject (IWbemClassObject *pDiskIn)
HRESULT | HrPruneCrashDumpBus (BOOL fPruneBusIn, ULONG *pcPrunedInout)
HRESULT | HrPruneDisks (ULONG ulSCSIBusIn, ULONG ulSCSIPortIn, const GUID *pcguidMajorIdIn, int nMsgIdIn, int nRefIdIn, ULONG *pulRemovedOut)
HRESULT | HrPruneDynamicDisks (ULONG *pcPrunedInout)
HRESULT | HrPruneGPTDisks (ULONG *pcPrunedInout)
HRESULT | HrPrunePageFileDiskBuses (BOOL fPruneBusIn, ULONG *pcPrunedInout)
HRESULT | HrPruneSystemDisks (void)
HRESULT | HrSetThisDiskToBeManaged (ULONG ulSCSITidIn, ULONG ulSCSILunIn, BOOL fIsQuorumIn, BSTR bstrResourceNameIn, DWORD dwSignatureIn)
HRESULT | HrSortDisksByIndex (void)
HRESULT | IsDiskSCSI (IWbemClassObject *pDiskIn)
void | LogPrunedDisk (IUnknown *punkIn, ULONG ulSCSIBusIn, ULONG ulSCSIPortIn)
const CEnumStorageResource & | operator= (const CEnumStorageResource &nodeSrc)
void | RemoveDiskFromArray (ULONG idxDiskIn)

Private Attributes

BSTR | m_bstrBootDevice
BSTR | m_bstrBootLogicalDisk
BSTR | m_bstrCrashDumpLogicalDisk
BSTR | m_bstrSystemDevice
BSTR | m_bstrSystemLogicalDisk
BSTR | m_bstrSystemWMIDeviceID
DWORD m_cDiskCount
BOOL m_fLoadedDevices
ULONG m_idxEnumNext
ULONG m_idxNext
IWbemServices * | m_pIWbemServices
IUnknown *(* | m_prgDisks )[]

Detailed Description

Definition at line 56 of file CEnumStorageResource.h.

Constructor & Destructor Documentation

CEnumStorageResource::CEnumStorageResource ( void )

Definition at line 56 of file CEnumStorageResource.cpp.

    : m_fLoadedDevices( FALSE )
{
    m_pIWbemServices = NULL;
    m_prgDisks = NULL;
    m_idxNext = 0;
    m_idxEnumNext = 0;
    m_bstrBootDevice = NULL;
    m_bstrSystemDevice = NULL;
    m_bstrBootLogicalDisk = NULL;
    m_bstrSystemLogicalDisk = NULL;
    m_bstrSystemWMIDeviceID = NULL;
    m_cDiskCount = 0;
    m_bstrCrashDumpLogicalDisk = NULL;

} //*** CEnumStorageResource::CEnumStorageResource

CEnumStorageResource::~CEnumStorageResource ( void ) [virtual]

Definition at line 90 of file CEnumStorageResource.cpp.

{
    ULONG   idx;

    if ( m_pIWbemServices != NULL )
    {
        m_pIWbemServices->Release();
    } // if:

    for ( idx = 0; idx < m_idxNext; idx++ )
    {
        //
        //  Sparse array so we need to check for NULL...
        //

        if ( (*m_prgDisks)[ idx ] != NULL )
        {
            ((*m_prgDisks)[ idx ])->Release();
        } // end if: is there a pointer at the index?
    } // for: each index in the array...

    HeapFree( GetProcessHeap(), 0, m_prgDisks );

    SysFreeString( m_bstrBootDevice );
    SysFreeString( m_bstrSystemDevice );
    SysFreeString( m_bstrBootLogicalDisk );
    SysFreeString( m_bstrSystemLogicalDisk );
    SysFreeString( m_bstrSystemWMIDeviceID );
    SysFreeString( m_bstrCrashDumpLogicalDisk );

} //*** CEnumStorageResource::~CEnumStorageResource

CEnumStorageResource::CEnumStorageResource ( const CEnumStorageResource & nodeSrc ) [private]

Member Function Documentation

STDMETHODIMP CEnumStorageResource::Clone ( IEnumClusCfgManagedResources ** ppEnumClusCfgStorageDevicesOut )

Definition at line 582 of file CEnumStorageResource.cpp.

{
    HRESULT hr = S_OK;

    //
    // Make sure required arguments were specified.
    //

    if ( ppEnumClusCfgStorageDevicesOut == NULL )
    {
        hr = E_POINTER;
        STATUS_REPORT_REF(
              TASKID_Major_Find_Devices
            , TASKID_Minor_Clone_Enum_StorageResource
            , IDS_ERROR_NULL_POINTER
            , IDS_ERROR_NULL_POINTER_REF
            , hr
            );
        goto Cleanup;
    } // if:

    //
    // TODO: perform a deep copy of the objects in the enumeration.
    //

    hr = E_NOTIMPL;

Cleanup:

    return hr;

} //*** CEnumStorageResource::Clone

STDMETHODIMP CEnumStorageResource::Count ( DWORD * pnCountOut )

Definition at line 641 of file CEnumStorageResource.cpp.

{
    HRESULT hr = S_OK;

    //
    // Make sure required arguments were specified.
    //

    if ( pnCountOut == NULL )
    {
        hr = E_POINTER;
        goto Cleanup;
    } // if:

    //
    // Load the enumeration if not already done.
    //

    if ( m_fLoadedDevices == FALSE )
    {
        hr = HrLoadEnum();
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:
    } // if:

    //
    // Return the number of items in the enumeration.
    //

    *pnCountOut = m_cDiskCount;

Cleanup:

    return hr;

} //*** CEnumStorageResource::Count

HRESULT CEnumStorageResource::HrAddObjectToArray ( IUnknown * punkIn ) [private]

Definition at line 1312 of file CEnumStorageResource.cpp.

{
    assert( punkIn != NULL );

    HRESULT     hr = S_OK;
    IUnknown *  ((*prgpunks)[]) = NULL;

    //
    //  Grow the array to hold the passed in object.
    //

    prgpunks = (IUnknown *((*)[])) HEAPREALLOC( m_prgDisks, sizeof( IUnknown * ) * ( m_idxNext + 1 ), HEAP_ZERO_MEMORY );
    if ( prgpunks == NULL )
    {
        hr = E_OUTOFMEMORY;
        STATUS_REPORT_REF( TASKID_Major_Find_Devices, TASKID_Minor_HrAddObjectToArray, IDS_ERROR_OUTOFMEMORY, IDS_ERROR_OUTOFMEMORY_REF, hr );
        goto Cleanup;
    } // if:

    m_prgDisks = prgpunks;

    (*m_prgDisks)[ m_idxNext++ ] = punkIn;
    punkIn->AddRef();
    m_cDiskCount += 1;

    goto Cleanup;

Cleanup:

    return hr;

} //*** CEnumStorageResource::HrAddObjectToArray

HRESULT CEnumStorageResource::HrConvertDeviceVolumeToLogicalDisk | ( | BSTR | bstrDeviceVolumeIn,
 |  | BSTR * | pbstrLogicalDiskOut |
 | ) |  |  | [private]

Definition at line 3270 of file CEnumStorageResource.cpp.

{
    assert( pbstrLogicalDiskOut != NULL );

    HRESULT     hr = S_OK;
    BOOL        fRet = FALSE;
    size_t      cchMountPoint = 0;
    WCHAR *     pwszMountPoint = NULL;
    WCHAR       szVolume[  MAX_PATH ];
    DWORD       sc = ERROR_SUCCESS;
    DWORD       cchPaths = 64;
    WCHAR *     pwszPaths = NULL;
    WCHAR *     pwszEOS = NULL;

    cchMountPoint = wcslen( g_szNameSpaceRoot ) + wcslen( bstrDeviceVolumeIn ) + 2;
    pwszMountPoint = new WCHAR[ cchMountPoint ];
    if ( pwszMountPoint == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if:

    hr = StringCchCopyW( pwszMountPoint, cchMountPoint, g_szNameSpaceRoot );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    hr = StringCchCatExW( pwszMountPoint, cchMountPoint, bstrDeviceVolumeIn, &pwszEOS, NULL, 0 );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    //
    //  Append a trailing \ and re-terminate the string.
    //

    pwszEOS[ 0 ] = L'\\';
    pwszEOS[ 1 ] = L'\0';

    fRet = GetVolumeNameForVolumeMountPoint( pwszMountPoint, szVolume, RTL_NUMBER_OF( szVolume ) );
    if ( fRet == FALSE )
    {
        sc = GetLastError();
        hr = HRESULT_FROM_WIN32( sc );

        LOG_STATUS_REPORT_STRING( L"[MyStorageResource] GetVolumeNameForVolumeMountPoint() failed.  Mount point is '%1!ws!'.", pwszMountPoint, hr );

        //
        //  GetVolumeNameForVolumeMountPoint() is no longer supported for IA64 EFI partitions.  If the error is
        //  ERROR_INVALID_FUNCTION then we should try to get the device number using an IOCTL.
        //
        if ( HRESULT_CODE( hr ) == ERROR_INVALID_FUNCTION )
        {
            LOG_STATUS_REPORT_STRING( L"[MyStorageResource] Device volume '%1!ws!' must be an IA64 EFI volume.", bstrDeviceVolumeIn, hr );
        } // if:

        goto Cleanup;
    } // if:

    pwszPaths = new WCHAR[ cchPaths ];
    if ( pwszPaths == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if:

    //
    //  Since the device name that is passed in is for a volume there will never be more than
    //  one logical disk in the multisz pwszPaths.
    //

    fRet = GetVolumePathNamesForVolumeName( szVolume, pwszPaths, cchPaths, &cchPaths );
    if ( fRet == FALSE )
    {
        sc = GetLastError();
        if ( sc == ERROR_MORE_DATA )
        {
            cchPaths++;

            delete [] pwszPaths;
            pwszPaths = new WCHAR[ cchPaths ];
            if ( pwszPaths == NULL )
            {
                hr = E_OUTOFMEMORY;
                goto Cleanup;
            } // if:

            fRet = GetVolumePathNamesForVolumeName( szVolume, pwszPaths, cchPaths, &cchPaths );
        } // if:
    } // else:

    if ( fRet == FALSE )
    {
        sc = GetLastError();
        hr = HRESULT_FROM_WIN32( sc );
        LOG_STATUS_REPORT_STRING( L"[MyStorageResource] GetVolumePathNamesForVolumeName() failed. Volume is is '%1!ws!'.", szVolume, hr );
        goto Cleanup;
    } // if:

    *pbstrLogicalDiskOut = SysAllocString( pwszPaths );
    if ( *pbstrLogicalDiskOut == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if:

Cleanup:

    delete [] pwszPaths;

    delete [] pwszMountPoint;

    return hr;

} //*** CEnumStorageResource::HrConvertDeviceVolumeToLogicalDisk

HRESULT CEnumStorageResource::HrConvertDeviceVolumeToWMIDeviceID | ( | BSTR | bstrDeviceVolumeIn,
 |  | BSTR * | pbstrWMIDeviceIDOut |
 | ) |  |  | [private]

Definition at line 3416 of file CEnumStorageResource.cpp.

{
    HRESULT                 hr = S_OK;
    HANDLE                  hVolume = NULL;
    DWORD                   dwSize;
    DWORD                   sc;
    STORAGE_DEVICE_NUMBER   sdnDevNumber;
    BOOL                    fRet;
    size_t                  cchDevice;
    WCHAR *                 pwszDevice = NULL;
    WCHAR                   sz[ 64 ];

    cchDevice = wcslen( g_szNameSpaceRoot ) + wcslen( bstrDeviceVolumeIn ) + 2;
    pwszDevice = new WCHAR[ cchDevice ];
    if ( pwszDevice == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if:

    hr = StringCchCopyW( pwszDevice, cchDevice, g_szNameSpaceRoot );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    hr = StringCchCatW( pwszDevice, cchDevice, bstrDeviceVolumeIn );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    //
    // get handle to partition
    //

    hVolume = CreateFileW(
                        pwszDevice
                      , GENERIC_READ
                      , FILE_SHARE_READ
                      , NULL
                      , OPEN_EXISTING
                      , FILE_ATTRIBUTE_NORMAL
                      , NULL
                      );

    if ( hVolume == INVALID_HANDLE_VALUE )
    {
        sc = GetLastError();
        hr = HRESULT_FROM_WIN32( sc );
        goto Cleanup;
    } // if:

    //
    // issue storage class ioctl to get drive and partition numbers
    // for this device
    //

    fRet = DeviceIoControl(
                          hVolume
                        , IOCTL_STORAGE_GET_DEVICE_NUMBER
                        , NULL
                        , 0
                        , &sdnDevNumber
                        , sizeof( sdnDevNumber )
                        , &dwSize
                        , NULL
                        );
    if ( fRet == FALSE )
    {
        sc = GetLastError();
        hr = HRESULT_FROM_WIN32( sc );
        goto Cleanup;
    } // if:

    hr = StringCchPrintfW( sz, RTL_NUMBER_OF( sz ), g_szPhysicalDriveFormat, sdnDevNumber.DeviceNumber );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    *pbstrWMIDeviceIDOut = SysAllocString( sz );
    if ( *pbstrWMIDeviceIDOut == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if:

Cleanup:

    if ( hVolume != NULL )
    {
        CloseHandle( hVolume );
    } // if:

    delete [] pwszDevice;

    return hr;

} //*** CEnumStorageResource::HrConvertDeviceVolumeToWMIDeviceID

HRESULT CEnumStorageResource::HrFindDiskWithLogicalDisk | ( | WCHAR | cLogicalDiskIn,
 |  | ULONG * | pidxDiskOut |
 | ) |  |  | [private]

Definition at line 1758 of file CEnumStorageResource.cpp.

{
    assert( pidxDiskOut != NULL );

    HRESULT                             hr = S_OK;
    IStorageProperties *                piccpdp = NULL;
    ULONG                               idx;
    bool                                fFoundIt = false;
    IUnknown *                          punk;

    for ( idx = 0; idx < m_idxNext; idx++ )
    {
        punk = (*m_prgDisks)[ idx ];    // don't ref
        if ( punk != NULL )
        {
            hr = punk->TypeSafeQI( IStorageProperties, &piccpdp );
            if ( FAILED( hr ) )
            {
                goto Cleanup;
            } // if:

            hr = piccpdp->IsThisLogicalDisk( cLogicalDiskIn );
            if ( FAILED( hr ) )
            {
                goto Cleanup;
            } // if:

            if ( hr == S_OK )
            {
                fFoundIt = true;
                break;
            } // if:

            piccpdp->Release();
            piccpdp = NULL;
        } // if:
    } // for:

    if ( fFoundIt == FALSE )
    {
        hr = S_FALSE;
    } // if:

    if ( pidxDiskOut != NULL )
    {
        *pidxDiskOut = idx;
    } // if:

Cleanup:

    if ( piccpdp != NULL )
    {
        piccpdp->Release();
    } // if:

    return hr;

} //*** CEnumStorageResource::HrFindDiskWithLogicalDisk

HRESULT CEnumStorageResource::HrFindDiskWithWMIDeviceID | ( | BSTR | bstrWMIDeviceIDIn,
 |  | ULONG * | pidxDiskOut |
 | ) |  |  | [private]

Definition at line 2369 of file CEnumStorageResource.cpp.

{
    assert( pidxDiskOut != NULL );

    HRESULT                             hr = S_OK;
    IStorageProperties *                piccpdp = NULL;
    ULONG                               idx;
    bool                                fFoundIt = false;
    IUnknown *                          punk;
    BSTR                                bstrDeviceID = NULL;

    for ( idx = 0; idx < m_idxNext; idx++ )
    {
        punk = (*m_prgDisks)[ idx ];    // don't ref
        if ( punk != NULL )
        {
            hr = punk->TypeSafeQI( IStorageProperties, &piccpdp );
            if ( FAILED( hr ) )
            {
                goto Cleanup;
            } // if:

            hr = piccpdp->HrGetDeviceID( &bstrDeviceID );
            if ( FAILED( hr ) )
            {
                goto Cleanup;
            } // if:

            if ( NBSTRCompareW( bstrWMIDeviceIDIn, bstrDeviceID ) == 0 )
            {
                fFoundIt = true;
                break;
            } // if:

            piccpdp->Release();
            piccpdp = NULL;

            SysFreeString( bstrDeviceID );
            bstrDeviceID = NULL;
        } // if:
    } // for:

    if ( fFoundIt == FALSE )
    {
        hr = S_FALSE;
    } // if:

    if ( pidxDiskOut != NULL )
    {
        *pidxDiskOut = idx;
    } // if:

Cleanup:

    if ( piccpdp != NULL )
    {
        piccpdp->Release();
    } // if:

    SysFreeString( bstrDeviceID );

    return hr;

} //*** CEnumStorageResource::HrFindDiskWithWMIDeviceID

HRESULT CEnumStorageResource::HrFixupDisks ( void ) [private]

Definition at line 1372 of file CEnumStorageResource.cpp.

{
    HRESULT hr = S_OK;

    //
    //  If the cluster service is running then load any managed disk
    //  resources that we own.
    //

    hr = HrIsClusterServiceRunning();
    if ( hr == S_OK )
    {
        hr = HrEnumNodeResources( GetNodeName() );
    } // if: the cluster service is running on this node
    else if ( hr == S_FALSE )
    {
        hr = S_OK;
    } // else: cluster service is not running on this node

    return hr;

} //*** CEnumStorageResource::HrFixupDisks

HRESULT CEnumStorageResource::HrGetBootLogicalDisk ( BSTR * pbstrBootDeviceOut ) [private]

Definition at line 3734 of file CEnumStorageResource.cpp.

{
    assert( pbstrBootLogicalDiskOut != NULL );

    HRESULT hr = S_OK;
    DWORD   sc;
    WCHAR   szWindowsDir[ MAX_PATH ];
    WCHAR   szVolume[ MAX_PATH ];
    BOOL    fRet;

    sc = GetWindowsDirectoryW( szWindowsDir, RTL_NUMBER_OF( szWindowsDir ) );
    if ( sc == 0 )
    {
        sc = GetLastError();
        hr = HRESULT_FROM_WIN32( sc );
        LOG_STATUS_REPORT( L"[MyStorageResource] GetWindowsDirectory() failed.", hr );
        goto Cleanup;
    } // if:

    fRet = GetVolumePathName( szWindowsDir, szVolume, RTL_NUMBER_OF( szVolume ) );
    if ( fRet == FALSE )
    {
        sc = GetLastError();
        hr = HRESULT_FROM_WIN32( sc );
        LOG_STATUS_REPORT( L"[MyStorageResource] GetVolumePathName() failed.", hr );
        goto Cleanup;
    } // if:

    *pbstrBootLogicalDiskOut = SysAllocString( szVolume );
    if ( *pbstrBootLogicalDiskOut == NULL )
    {
        hr = E_OUTOFMEMORY;
    } // if:

Cleanup:

    return hr;

} //*** CEnumStorageResource::HrGetBootLogicalDisk

HRESULT CEnumStorageResource::HrGetClusterDiskInfo | ( | HRESOURCE | hResourceIn,
 |  | CLUS_SCSI_ADDRESS * | pcsaOut,
 |  | DWORD * | pdwSignatureOut |
 | ) |  |  | [private]

Definition at line 1512 of file CEnumStorageResource.cpp.

{
    HRESULT                 hr = S_OK;
    DWORD                   sc;
    CClusPropValueList      cpvl;
    CLUSPROP_BUFFER_HELPER  cbhValue = { NULL };

    sc = cpvl.ScGetResourceValueList( hResourceIn, CLUSCTL_RESOURCE_STORAGE_GET_DISK_INFO );
    if ( sc != ERROR_SUCCESS )
    {
        hr = HRESULT_FROM_WIN32( sc );
        goto Cleanup;
    } // if:

    sc = cpvl.ScMoveToFirstValue();
    if ( sc != ERROR_SUCCESS )
    {
        hr = HRESULT_FROM_WIN32( sc );
        goto Cleanup;
    } // if:

    for ( ; ; )
    {
        cbhValue = cpvl;

        switch ( cbhValue.pSyntax->dw )
        {
            case CLUSPROP_SYNTAX_PARTITION_INFO :
            {
                break;
            } // case: CLUSPROP_SYNTAX_PARTITION_INFO

            case CLUSPROP_SYNTAX_DISK_SIGNATURE :
            {
                *pdwSignatureOut = cbhValue.pDiskSignatureValue->dw;
                break;
            } // case: CLUSPROP_SYNTAX_DISK_SIGNATURE

            case CLUSPROP_SYNTAX_SCSI_ADDRESS :
            {
                pcsaOut->dw = cbhValue.pScsiAddressValue->dw;
                break;
            } // case: CLUSPROP_SYNTAXscSI_ADDRESS

            case CLUSPROP_SYNTAX_DISK_NUMBER :
            {
                break;
            } // case: CLUSPROP_SYNTAX_DISK_NUMBER

        } // switch:

        sc = cpvl.ScMoveToNextValue();
        if ( sc == ERROR_SUCCESS )
        {
            continue;
        } // if:

        if ( sc == ERROR_NO_MORE_ITEMS )
        {
            break;
        } // if: error occurred moving to the next value

        hr = HRESULT_FROM_WIN32( sc );
        goto Cleanup;
    } // for: each value in the value list

Cleanup:

    return hr;

} //*** CEnumStorageResource::HrGetClusterDiskInfo

HRESULT CEnumStorageResource::HrGetClusterProperties | ( | HRESOURCE | hResourceIn,
 |  | BSTR * | pbstrResourceNameOut |
 | ) |  |  | [private]

Definition at line 2547 of file CEnumStorageResource.cpp.

{
    assert( hResourceIn != NULL );
    assert( pbstrResourceNameOut != NULL );

    HRESULT                 hr = S_OK;
    DWORD                   sc;
    DWORD                   cbBuffer;
    WCHAR *                 pwszBuffer = NULL;

    cbBuffer = 0;
    sc = ClusterResourceControl(
                        hResourceIn,
                        NULL,
                        CLUSCTL_RESOURCE_GET_NAME,
                        NULL,
                        NULL,
                        NULL,
                        cbBuffer,
                        &cbBuffer
                        );

    if ( sc != ERROR_SUCCESS )
    {
        hr = HRESULT_FROM_WIN32( sc );
        goto Cleanup;
    }

    // cbBuffer contains the byte count, not the char count.
    pwszBuffer = new WCHAR[(cbBuffer/sizeof(WCHAR))+1];

    if ( pwszBuffer == NULL )
    {
        hr = ERROR_OUTOFMEMORY;
        goto Cleanup;
    }

    sc = ClusterResourceControl(
                        hResourceIn,
                        NULL,
                        CLUSCTL_RESOURCE_GET_NAME,
                        NULL,
                        NULL,
                        pwszBuffer,
                        cbBuffer,
                        &cbBuffer
                        );
    if ( sc != ERROR_SUCCESS )
    {
        hr = HRESULT_FROM_WIN32( sc );
        goto Cleanup;
    }

    if ( wcslen( pwszBuffer ) == 0 )
    {
        LOG_STATUS_REPORT_STRING( L"The Name of a %1!ws! resource was empty!", GetResTypeName(), hr );
    }

    *pbstrResourceNameOut = SysAllocString( pwszBuffer );

    hr = S_OK;

Cleanup:

    delete [] pwszBuffer;

    return hr;

} //*** CEnumStorageResource::HrGetClusterProperties

HRESULT CEnumStorageResource::HrGetCrashDumpLogicalDisk ( BSTR * pbstrCrashDumpLogicalDiskOut ) [private]

Definition at line 3797 of file CEnumStorageResource.cpp.

{
    assert( pbstrCrashDumpLogicalDiskOut != NULL );

    HRESULT hr = S_OK;
    DWORD   sc;
    HKEY    hKey = NULL;
    WCHAR * pwszDumpFile = NULL;
    WCHAR * pwszExpandedDumpFile = NULL;
    DWORD   cbDumpFile = 0;
    DWORD   cchExpandedDumpFile = 0;
    BSTR    bstr = NULL;
    DWORD   dwType;

    sc = RegOpenKeyEx( HKEY_LOCAL_MACHINE, L"System\\CurrentControlSet\\Control\\CrashControl", 0, KEY_READ, &hKey );
    if ( sc != ERROR_SUCCESS )
    {
        hr = HRESULT_FROM_WIN32( sc );
        LOG_STATUS_REPORT( L"[MyStorageResource] [HrGetCrashDumpLogicalDisk] RegOpenKeyEx() failed.", hr );
        goto Cleanup;
    } // if:

    sc = RegQueryValueEx( hKey, L"DumpFile", NULL, NULL, NULL, &cbDumpFile );
    if ( sc != ERROR_SUCCESS )
    {
        hr = HRESULT_FROM_WIN32( sc );
        LOG_STATUS_REPORT( L"[MyStorageResource] [HrGetCrashDumpLogicalDisk] RegQueryValueEx() failed.", hr );
        goto Cleanup;
    } // if:

    pwszDumpFile = new WCHAR[ cbDumpFile / sizeof( WCHAR ) ];
    if ( pwszDumpFile == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if:

    sc = RegQueryValueEx( hKey, L"DumpFile", NULL, &dwType, (BYTE *) pwszDumpFile, &cbDumpFile );
    if ( sc != ERROR_SUCCESS )
    {
        hr = HRESULT_FROM_WIN32( sc );
        LOG_STATUS_REPORT( L"[MyStorageResource] [HrGetCrashDumpLogicalDisk] RegQueryValueEx() failed.", hr );
        goto Cleanup;
    } // if:

    if ( ( dwType != REG_SZ ) && ( dwType != REG_EXPAND_SZ ) )
    {
        hr = ERROR_DATATYPE_MISMATCH;
        LOG_STATUS_REPORT_STRING( L"[MyStorageResource] RegQueryValueEx() invalid type %1!d!", dwType, hr );
        goto Cleanup;
    } // if:

    cchExpandedDumpFile = ExpandEnvironmentStrings( pwszDumpFile, NULL, 0 );
    if ( cchExpandedDumpFile > 0 )
    {
        pwszExpandedDumpFile = new WCHAR[ cchExpandedDumpFile ];
        if( pwszExpandedDumpFile == NULL )
        {
            hr = E_OUTOFMEMORY;
            goto Cleanup;
        } // if:
        cchExpandedDumpFile = ExpandEnvironmentStrings( pwszDumpFile, pwszExpandedDumpFile, cchExpandedDumpFile );
    } // if: success

    if ( cchExpandedDumpFile == 0 )
    {
        hr = HRESULT_FROM_WIN32( GetLastError() );
        goto Cleanup;
    } // if:

    bstr = SysAllocString( pwszExpandedDumpFile );
    if ( bstr == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if:

    *pbstrCrashDumpLogicalDiskOut = bstr;
    bstr = NULL;

Cleanup:

    SysFreeString( bstr );

    delete [] pwszExpandedDumpFile;
    delete [] pwszDumpFile;

    if ( hKey != NULL )
    {
        RegCloseKey( hKey );
    } // if:

    return hr;

} //*** CEnumStorageResource::HrGetCrashDumpLogicalDisk

HRESULT CEnumStorageResource::HrGetDisks ( void ) [private]

Definition at line 710 of file CEnumStorageResource.cpp.

{
    HRESULT                 hr = S_OK;
    BSTR                    bstrClass;
    IEnumWbemClassObject *  piewcoDisks = NULL;
    ULONG                   ulReturned;
    IWbemClassObject *      piwcoDisk = NULL;

    //
    // Create the WMI class string for creating the enumeration.
    //

    bstrClass = SysAllocString( L"Win32_DiskDrive" );
    if ( bstrClass == NULL )
    {
        hr = E_OUTOFMEMORY;
        STATUS_REPORT_REF(
              TASKID_Major_Find_Devices
            , TASKID_Minor_HrGetDisks
            , IDS_ERROR_OUTOFMEMORY
            , IDS_ERROR_OUTOFMEMORY_REF
            , hr
            );
        goto Cleanup;
    } // if:

    //
    // Create the enumeration by querying WMI for objects of the specified class.
    //

    hr = m_pIWbemServices->CreateInstanceEnum( bstrClass, WBEM_FLAG_SHALLOW, NULL, &piewcoDisks );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    //
    // Loop through the enumeration returned from WMI and add objects to our
    // enumeration if they meet our criteria.
    //

    for ( ; ; )
    {
        hr = piewcoDisks->Next( WBEM_INFINITE, 1, &piwcoDisk, &ulReturned );
        if ( ( hr == S_OK ) && ( ulReturned == 1 ) )
        {
            //
            // Log information about this item to the log file.
            //

            hr = HrLogDiskInfo( piwcoDisk );
            if ( FAILED( hr ) )
            {
                goto Cleanup;
            } // if:

            //
            // Find out if this is a SCSI disk or not.  Only add the disk
            // if it is a SCSI disk.
            //
            // TODO: Determine if this is valid for your storage resource.
            //

            hr = IsDiskSCSI( piwcoDisk );
            if ( FAILED( hr ) )
            {
                goto Cleanup;
            } // if: failed to get SCSI info about disk

            //
            // Create a local copy of the disk info and add it to our array
            // if it is a SCSI disk.
            //

            if ( hr == S_OK )
            {
                hr = HrProcessWMIDiskObject( piwcoDisk );
                if ( FAILED( hr ) )
                {
                    goto Cleanup;
                } // if: failed to create and add disk to the array
            } // if: disk is SCSI

            piwcoDisk->Release();
            piwcoDisk = NULL;
        } // if: an object was returned
        else if ( ( hr == S_FALSE ) && ( ulReturned == 0 ) )
        {
            hr = S_OK;
            break;
        } // else if: no objects returned
        else
        {
            STATUS_REPORT_STRING_REF(
                      TASKID_Major_Find_Devices
                    , TASKID_Minor_WQL_Disk_Qry_Next_Failed
                    , IDS_ERROR_WQL_QRY_NEXT_FAILED
                    , bstrClass
                    , IDS_ERROR_WQL_QRY_NEXT_FAILED_REF
                    , hr
                    );
            goto Cleanup;
        } // else: error getting next object
    } // for: ever

    //
    // Reset the enumeration index to the beginning and indicate that we have
    // loaded the enumeration.
    //

    m_idxEnumNext = 0;
    m_fLoadedDevices = TRUE;

Cleanup:

    if ( piwcoDisk != NULL )
    {
        piwcoDisk->Release();
    } // if:

    if ( piewcoDisks != NULL )
    {
        piewcoDisks->Release();
    } // if:

    SysFreeString( bstrClass );

    return hr;

} //*** CEnumStorageResource::HrGetDisks

HRESULT CEnumStorageResource::HrGetPageFileLogicalDisks | ( | IClusCfgCallback * | picccIn,
 |  | WCHAR | szLogicalDisksOut[26],
 |  | int * | pcLogicalDisksOut |
 | ) |  |  | [private]

Definition at line 3539 of file CEnumStorageResource.cpp.

{
    HRESULT                 hr = S_FALSE;
    IEnumWbemClassObject *  pPagingFiles = NULL;
    BSTR                    bstrClass;
    ULONG                   ulReturned;
    IWbemClassObject *      pPagingFile = NULL;
    VARIANT                 var;
    int                     idx;

    UNREFERENCED_PARAMETER( picccIn );

    bstrClass = SysAllocString( L"Win32_PageFile" );
    if ( bstrClass == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if:

    hr = m_pIWbemServices->CreateInstanceEnum( bstrClass, WBEM_FLAG_SHALLOW, NULL, &pPagingFiles );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    VariantInit( &var );

    for ( idx = 0; idx < sizeof( szLogicalDisksOut ); idx++ )
    {
        hr = pPagingFiles->Next( WBEM_INFINITE, 1, &pPagingFile, &ulReturned );
        if ( ( hr == S_OK ) && ( ulReturned == 1 ) )
        {
            VariantClear( &var );

            hr = HrGetWMIProperty( pPagingFile, L"Drive", VT_BSTR, &var );
            if ( FAILED( hr ) )
            {
                goto Cleanup;
            } // if:

            CharUpper( var.bstrVal );

            szLogicalDisksOut[ idx ] = var.bstrVal[ 0 ];

            pPagingFile->Release();
            pPagingFile = NULL;
        } // if:
        else if ( ( hr == S_FALSE ) && ( ulReturned == 0 ) )
        {
            hr = S_OK;
            break;
        } // else if:
        else
        {
            goto Cleanup;
        } // else:
    } // for:

    if ( pcLogicalDisksOut != NULL )
    {
        *pcLogicalDisksOut = idx;
    } // if:

Cleanup:

    VariantClear( &var );

    SysFreeString( bstrClass );

    if ( pPagingFile != NULL )
    {
        pPagingFile->Release();
    } // if:

    if ( pPagingFiles != NULL )
    {
        pPagingFiles->Release();
    } // if:

    return hr;

} //*** CEnumStorageResource::HrGetPageFileLogicalDisks

HRESULT CEnumStorageResource::HrGetSCSIInfo | ( | ULONG | idxDiskIn,
 |  | ULONG * | pulSCSIBusOut,
 |  | ULONG * | pulSCSIPortOut |
 | ) |  |  | [private]

Definition at line 1845 of file CEnumStorageResource.cpp.

{
    assert( pulSCSIBusOut != NULL );
    assert( pulSCSIPortOut != NULL );

    HRESULT                             hr = S_OK;
    IStorageProperties *                piccpdp = NULL;

    hr = ((*m_prgDisks)[ idxDiskIn ])->TypeSafeQI( IStorageProperties, &piccpdp );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    hr = piccpdp->HrGetSCSIBus( pulSCSIBusOut );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    hr = piccpdp->HrGetSCSIPort( pulSCSIPortOut );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

Cleanup:

    if ( piccpdp != NULL )
    {
        piccpdp->Release();
    } // if:

    return hr;

} //*** CEnumStorageResource::HrGetSCSIInfo

HRESULT CEnumStorageResource::HrGetSystemDevice ( BSTR * pbstrSystemDeviceOut ) [private]

Definition at line 3645 of file CEnumStorageResource.cpp.

{
    assert( pbstrSystemDeviceOut != NULL );

    HRESULT hr = S_OK;
    DWORD   sc;
    HKEY    hKey = NULL;
    WCHAR * pwszSystemDevice = NULL;
    DWORD   cbSystemDevice = 0;
    DWORD   dwType;

    sc = RegOpenKeyEx( HKEY_LOCAL_MACHINE, L"System\\Setup", 0, KEY_READ, &hKey );
    if ( sc != ERROR_SUCCESS )
    {
        hr = HRESULT_FROM_WIN32( sc );
        LOG_STATUS_REPORT( L"[MyStorageResource] RegOpenKeyEx() failed.", hr );
        goto Cleanup;
    } // if:

    sc = RegQueryValueEx( hKey, L"SystemPartition", NULL, NULL, NULL, &cbSystemDevice );
    if ( sc != ERROR_SUCCESS )
    {
        hr = HRESULT_FROM_WIN32( sc );
        LOG_STATUS_REPORT( L"[MyStorageResource] RegQueryValueEx() failed.", hr );
        goto Cleanup;
    } // if:

    pwszSystemDevice = new WCHAR[ cbSystemDevice / sizeof( WCHAR ) ];
    if ( pwszSystemDevice == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if:

    sc = RegQueryValueEx( hKey, L"SystemPartition", NULL, &dwType, (BYTE *) pwszSystemDevice, &cbSystemDevice );
    if ( sc != ERROR_SUCCESS )
    {
        hr = HRESULT_FROM_WIN32( sc );
        LOG_STATUS_REPORT( L"[MyStorageResource] RegQueryValueEx() failed.", hr );
        goto Cleanup;
    } // if:

    if (dwType != REG_SZ)
    {
        hr = ERROR_DATATYPE_MISMATCH;
        LOG_STATUS_REPORT_STRING( L"[MyStorageResource] RegQueryValueEx() invalid type %1!d!", dwType, hr );
        goto Cleanup;
    } // if:

    *pbstrSystemDeviceOut = SysAllocString( pwszSystemDevice );
    if ( *pbstrSystemDeviceOut == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if:

Cleanup:

    delete [] pwszSystemDevice;

    if ( hKey != NULL )
    {
        RegCloseKey( hKey );
    } // if:

    return hr;

} //*** CEnumStorageResource::HrGetSystemDevice

HRESULT CEnumStorageResource::HrIsLogicalDiskNTFS ( BSTR bstrLogicalDiskIn ) [private]

Definition at line 2111 of file CEnumStorageResource.cpp.

{
    assert( bstrLogicalDiskIn != NULL );

    HRESULT             hr = S_OK;
    IWbemClassObject *  pLogicalDisk = NULL;
    BSTR                bstrPath = NULL;
    WCHAR               sz[ 64 ];
    VARIANT             var;
    size_t              cch;

    VariantInit( &var );

    cch = wcslen( bstrLogicalDiskIn );
    if ( cch > 3 )
    {
        hr = E_INVALIDARG;
        STATUS_REPORT_REF( TASKID_Major_Find_Devices, TASKID_Minor_HrIsLogicalDiskNTFS_InvalidArg, IDS_ERROR_INVALIDARG, IDS_ERROR_INVALIDARG_REF, hr );
        goto Cleanup;
    } // if:

    //
    //  truncate off any trailing \'s
    //
    if ( bstrLogicalDiskIn[ cch - 1 ] == L'\\' )
    {
        bstrLogicalDiskIn[ cch - 1 ] = '\0';
    } // if:

    //
    //  If we have just the logical disk without the trailing colon...
    //
    if ( wcslen( bstrLogicalDiskIn ) == 1 )
    {
        hr = StringCchPrintfW( sz, RTL_NUMBER_OF( sz ), L"Win32_LogicalDisk.DeviceID=\"%ws:\"", bstrLogicalDiskIn );
    } // if:
    else
    {
        hr = StringCchPrintfW( sz, RTL_NUMBER_OF( sz ), L"Win32_LogicalDisk.DeviceID=\"%ws\"", bstrLogicalDiskIn );
    } // else:

    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    bstrPath = SysAllocString( sz );
    if ( bstrPath == NULL )
    {
        hr = E_OUTOFMEMORY;
        STATUS_REPORT_REF( TASKID_Major_Find_Devices, TASKID_Minor_HrIsLogicalDiskNTFS, IDS_ERROR_OUTOFMEMORY, IDS_ERROR_OUTOFMEMORY_REF, hr );
    } // if:

    hr = m_pIWbemServices->GetObject( bstrPath, WBEM_FLAG_RETURN_WBEM_COMPLETE, NULL, &pLogicalDisk, NULL );
    if ( FAILED( hr ) )
    {
        STATUS_REPORT_STRING_REF(
                  TASKID_Major_Find_Devices
                , TASKID_Minor_WMI_Get_LogicalDisk_Failed
                , IDS_ERROR_WMI_GET_LOGICALDISK_FAILED
                , bstrLogicalDiskIn
                , IDS_ERROR_WMI_GET_LOGICALDISK_FAILED_REF
                , hr
                );
        goto Cleanup;
    } // if:

    hr = HrGetWMIProperty( pLogicalDisk, L"FileSystem", VT_BSTR, &var );
    if (FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    CharUpper( var.bstrVal );

    if ( NStringCompareW( var.bstrVal, SysStringLen( var.bstrVal ), L"NTFS", RTL_NUMBER_OF( L"NTFS" ) ) != 0 )
    {
        hr = S_FALSE;
    } // if:

Cleanup:

    if ( pLogicalDisk != NULL )
    {
        pLogicalDisk->Release();
    } // if:

    VariantClear( &var );

    SysFreeString( bstrPath );

    return hr;

} //*** CEnumStorageResource::HrIsLogicalDiskNTFS

HRESULT CEnumStorageResource::HrIsSystemBusManaged ( void ) [private]

Definition at line 2465 of file CEnumStorageResource.cpp.

{
    HRESULT hr = S_FALSE;
    DWORD   sc;
    HKEY    hKey = NULL;
    DWORD   dwData;
    DWORD   cbData = sizeof( dwData );
    DWORD   dwType;

    sc = RegOpenKeyEx( HKEY_LOCAL_MACHINE, L"SYSTEM\\CURRENTCONTROLSET\\SERVICES\\ClusSvc\\Parameters", 0, KEY_READ, &hKey );
    if ( sc == ERROR_FILE_NOT_FOUND )
    {
        goto Cleanup;       // not yet a cluster node.  Return S_FALSE.
    } // if:

    if ( sc != ERROR_SUCCESS )
    {
        hr = HRESULT_FROM_WIN32( sc );
        LOG_STATUS_REPORT( L"[MyStorageResource] RegOpenKeyEx() failed.", hr );
        goto Cleanup;
    } // if:

    sc = RegQueryValueEx( hKey, L"ManageDisksOnSystemBuses", NULL, &dwType, (LPBYTE) &dwData, &cbData );
    if ( sc == ERROR_FILE_NOT_FOUND )
    {
        goto Cleanup;       // value not found.  Return S_FALSE.
    } // if:

    if ( sc != ERROR_SUCCESS )
    {
        hr = HRESULT_FROM_WIN32( sc );
        LOG_STATUS_REPORT( L"[MyStorageResource] RegQueryValueEx() failed.", hr );
        goto Cleanup;
    } // if:

    if (dwType != REG_DWORD)
    {
        HRESULT hrTemp = S_OK;
        hr = HRESULT_FROM_WIN32( ERROR_DATATYPE_MISMATCH );
        LOG_STATUS_REPORT_STRING( L"[MyStorageResource] RegQueryValueEx() invalid data type %1!d!.", dwType, hrTemp );
    }
    else if ( dwData > 0)
    {
        hr = S_OK;
    } // if:

Cleanup:

    if ( hKey != NULL )
    {
        RegCloseKey( hKey );
    } // if:

    return hr;

} //*** CEnumStorageResource::HrIsSystemBusManaged

HRESULT CEnumStorageResource::HrLoadEnum ( void ) [private]

Definition at line 2678 of file CEnumStorageResource.cpp.

{
    HRESULT hr = S_OK;

    hr = HrGetDisks();
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    hr = HrPruneSystemDisks();
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    hr = HrSortDisksByIndex();
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    hr = HrIsNodeClustered();
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    if ( hr == S_OK )
    {
        hr = HrFixupDisks();
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:
    } // if:

    hr = S_OK;  // could have been S_FALSE

Cleanup:

    return hr;

} //*** CEnumStorageResource::HrLoadEnum

HRESULT CEnumStorageResource::HrLogDiskInfo ( IWbemClassObject * pDiskIn ) [private]

Definition at line 2230 of file CEnumStorageResource.cpp.

{
    assert( pDiskIn != NULL );

    HRESULT hr = S_OK;
    VARIANT varDeviceID;
    VARIANT varSCSIBus;
    VARIANT varSCSIPort;
    VARIANT varSCSILun;
    VARIANT varSCSITid;
    BSTR    bstr = NULL;

    VariantInit( &varDeviceID );
    VariantInit( &varSCSIBus );
    VariantInit( &varSCSIPort );
    VariantInit( &varSCSILun );
    VariantInit( &varSCSITid );

    hr = HrGetWMIProperty( pDiskIn, L"DeviceID", VT_BSTR, &varDeviceID );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    hr = IsDiskSCSI( pDiskIn );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    //
    // Disk is SCSI...
    //
    if ( hr == S_OK )
    {
        hr = HrGetWMIProperty( pDiskIn, L"SCSIBus", VT_I4, &varSCSIBus );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:

        hr = HrGetWMIProperty( pDiskIn, L"SCSITargetId", VT_I4, &varSCSITid );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:

        hr = HrGetWMIProperty( pDiskIn, L"SCSILogicalUnit", VT_I4, &varSCSILun );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:

        hr = HrGetWMIProperty( pDiskIn, L"SCSIPort", VT_I4, &varSCSIPort );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:

        hr = HrFormatStringIntoBSTR(
                      L"[MyStorageResource] Found SCSI disk '%1!ws!' on Bus '%2!d!' and Port '%3!d!'; at TID '%4!d!' and LUN '%5!d!'"
                    , &bstr
                    , varDeviceID.bstrVal
                    , varSCSIBus.iVal
                    , varSCSIPort.iVal
                    , varSCSITid.iVal
                    , varSCSILun.iVal
                    );

        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:

        LOG_STATUS_REPORT( bstr, hr );
    } // if:
    else
    {
        HRESULT hrTemp;
        CLSID   clsidMinorId;

        hrTemp = CoCreateGuid( &clsidMinorId );
        if ( FAILED( hrTemp ) )
        {
            LOG_STATUS_REPORT( L"[MyStorageResource] Could not create a guid for a non-scsi disk minor task ID", S_OK );
            clsidMinorId = IID_NULL;
        } // if:

        //
        //  Reset hr to S_OK since we don't want a yellow bang in the UI.  Finding non-scsi disks is expected
        //  and should cause as little concern as possible.
        //
        hr = S_OK;
        STATUS_REPORT_REF( TASKID_Major_Find_Devices, TASKID_Minor_Non_SCSI_Disks, IDS_INFO_NON_SCSI_DISKS, IDS_INFO_NON_SCSI_DISKS_REF, hr );
        STATUS_REPORT_STRING_REF( TASKID_Minor_Non_SCSI_Disks, clsidMinorId, IDS_ERROR_FOUND_NON_SCSI_DISK, varDeviceID.bstrVal, IDS_ERROR_FOUND_NON_SCSI_DISK_REF, hr );
    } // else:

Cleanup:

    VariantClear( &varDeviceID );
    VariantClear( &varSCSIBus );
    VariantClear( &varSCSIPort );
    VariantClear( &varSCSILun );
    VariantClear( &varSCSITid );

    SysFreeString( bstr );

    return hr;

} //*** CEnumStorageResource::HrLogDiskInfo

HRESULT CEnumStorageResource::HrNodeResourceCallback ( HRESOURCE hResourceIn )

Definition at line 1422 of file CEnumStorageResource.cpp.

{
    HRESULT                 hr = S_OK;
    CLUS_SCSI_ADDRESS       csa;
    DWORD                   dwSignature;
    BOOL                    fIsQuorum;
    BSTR                    bstrResourceName = NULL;

    //
    //  NB:
    //
    //  Since this example is for physical disks we have used that string here.
    //  In your own plug in component you wll use your resource type here.
    //

    if ( ResUtilResourceTypesEqual( GetResTypeName(), hResourceIn ) == FALSE )
    {
        //
        //  If this resource is not a managed disk then we simply want to
        //  skip it.
        //

        hr = S_FALSE;
        goto Cleanup;
    } // if:

    hr = HrIsCoreResource( hResourceIn );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    fIsQuorum = ( hr == S_OK );

    hr = HrGetClusterDiskInfo( hResourceIn, &csa, &dwSignature );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    hr = HrGetClusterProperties( hResourceIn, &bstrResourceName );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    hr = HrSetThisDiskToBeManaged( csa.TargetId, csa.Lun, fIsQuorum, bstrResourceName, dwSignature );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    goto Cleanup;

Cleanup:

    SysFreeString( bstrResourceName );

    return hr;

} //*** CEnumStorageResource::HrNodeResourceCallback

HRESULT CEnumStorageResource::HrProcessWMIDiskObject ( IWbemClassObject * pDiskIn ) [private]

Definition at line 861 of file CEnumStorageResource.cpp.

{
    assert( m_pIWbemServices != NULL );

    HRESULT             hr = S_FALSE;
    IUnknown *          punk = NULL;
    IWMIObject *        piwo = NULL;
    BOOL                fRetainObject = TRUE;

    //
    // Create an instance of the CStorageResource object.
    //

    hr = CoCreateInstance( CLSID_CStorageResource, NULL, CLSCTX_INPROC_SERVER, IID_IUnknown, reinterpret_cast< void ** >( &punk ) );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    assert( punk != NULL );

    //
    // Initialize the newly created object.
    //

    hr = HrSetInitialize( punk, GetCallback(), GetLCID() );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    hr = HrSetWbemServices( punk, m_pIWbemServices );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    hr = punk->TypeSafeQI( IWMIObject, &piwo );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    assert( piwo != NULL );

    hr = piwo->SetWbemObject( pDiskIn, &fRetainObject );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    if ( fRetainObject )
    {
        hr = HrAddObjectToArray( punk );
    } // if:

Cleanup:

    if ( piwo != NULL )
    {
        piwo->Release();
    } // if:

    if ( punk != NULL )
    {
        punk->Release();
    } // if:

    return hr;

} //*** CEnumStorageResource::HrProcessWMIDiskObject

HRESULT CEnumStorageResource::HrPruneCrashDumpBus | ( | BOOL | fPruneBusIn,
 |  | ULONG * | pcPrunedInout |
 | ) |  |  | [private]

Definition at line 2954 of file CEnumStorageResource.cpp.

{
    assert( pcPrunedInout != NULL );
    assert( m_bstrCrashDumpLogicalDisk != NULL );

    HRESULT hr = S_OK;
    ULONG   ulSCSIBus;
    ULONG   ulSCSIPort;
    ULONG   idx;
    ULONG   cPruned = 0;

    //
    //  Prune the bus with disks that have paging files.
    //

    hr = HrFindDiskWithLogicalDisk( m_bstrCrashDumpLogicalDisk[ 0 ], &idx );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    if ( hr == S_OK )
    {
        //
        //  Should we prune the whole bus, or just the system disk itself?
        //

        if ( fPruneBusIn )
        {
            hr = HrGetSCSIInfo( idx, &ulSCSIBus, &ulSCSIPort );
            if ( FAILED( hr ) )
            {
                goto Cleanup;
            } // if:

            STATUS_REPORT( TASKID_Major_Find_Devices, TASKID_Minor_Pruning_CrashDump_Disk_Bus, IDS_INFO_PRUNING_CRASHDUMP_BUS, hr );
            hr = HrPruneDisks(
                              ulSCSIBus
                            , ulSCSIPort
                            , &TASKID_Minor_Pruning_CrashDump_Disk_Bus
                            , IDS_INFO_CRASHDUMPDISK_PRUNED
                            , IDS_INFO_CRASHDUMPDISK_PRUNED_REF
                            , &cPruned
                            );
            if ( FAILED( hr ) )
            {
                goto Cleanup;
            } // if:
        } // if:
        else
        {
            RemoveDiskFromArray( idx );
            cPruned++;
        } // else:
    } // if:

    *pcPrunedInout = cPruned;
    hr = S_OK;

Cleanup:

    return hr;

} //*** CEnumStorageResource::HrPruneCrashDumpBus

HRESULT CEnumStorageResource::HrPruneDisks | ( | ULONG | ulSCSIBusIn,
 |  | ULONG | ulSCSIPortIn,
 |  | const GUID * | pcguidMajorIdIn,
 |  | int | nMsgIdIn,
 |  | int | nRefIdIn,
 |  | ULONG * | pulRemovedOut |
 | ) |  |  | [private]

Definition at line 1911 of file CEnumStorageResource.cpp.

{
    assert( pulRemovedOut != NULL );

    HRESULT                             hr = S_OK;
    IStorageProperties *                piccpdp = NULL;
    ULONG                               idx;
    IUnknown *                          punk;
    ULONG                               ulSCSIBus;
    ULONG                               ulSCSIPort;
    ULONG                               cRemoved = 0;

    for ( idx = 0; idx < m_idxNext; idx++ )
    {
        punk = (*m_prgDisks)[ idx ];                                                        // don't ref
        if ( punk != NULL )
        {
            hr = punk->TypeSafeQI( IStorageProperties, &piccpdp );
            if ( FAILED( hr ) )
            {
                goto Cleanup;
            } // if:

            hr = piccpdp->HrGetSCSIBus( &ulSCSIBus );
            if ( FAILED( hr ) )
            {
                goto Cleanup;
            } // if:

            hr = piccpdp->HrGetSCSIPort( &ulSCSIPort );
            if ( FAILED( hr ) )
            {
                goto Cleanup;
            } // if:

            if ( ( ulSCSIBusIn == ulSCSIBus ) && ( ulSCSIPortIn == ulSCSIPort ) )
            {
                BSTR                            bstr = NULL;
                IClusCfgManagedResourceInfo *   piccmri = NULL;
                HRESULT                         hrTemp;
                CLSID   clsidMinorId;

                hrTemp = CoCreateGuid( &clsidMinorId );
                if ( FAILED( hrTemp ) )
                {
                    LOG_STATUS_REPORT( L"[MyStorageResource] Could not create a guid for a pruning disk minor task ID", S_OK );
                    clsidMinorId = IID_NULL;
                } // if:

                LogPrunedDisk( punk, ulSCSIBusIn, ulSCSIPortIn );

                ((*m_prgDisks)[ idx ])->TypeSafeQI( IClusCfgManagedResourceInfo, &piccmri );
                piccmri->GetName( &bstr );
                if ( piccmri != NULL )
                {
                    piccmri->Release();
                } // if:

                STATUS_REPORT_STRING_REF( *pcguidMajorIdIn, clsidMinorId, nMsgIdIn, bstr != NULL ? bstr : L"????", nRefIdIn, hr );
                RemoveDiskFromArray( idx );
                cRemoved++;
                SysFreeString( bstr );
            } // if:

            piccpdp->Release();
            piccpdp = NULL;
        } // if:
    } // for:

    if ( pulRemovedOut != NULL )
    {
        *pulRemovedOut = cRemoved;
    } // if:

Cleanup:

    if ( piccpdp != NULL )
    {
        piccpdp->Release();
    } // if:

    return hr;

} //*** CEnumStorageResource::HrPruneDisks

HRESULT CEnumStorageResource::HrPruneDynamicDisks ( ULONG * pcPrunedInout ) [private]

Definition at line 3041 of file CEnumStorageResource.cpp.

{
    assert( pcPrunedInout != NULL );

    HRESULT                             hr = S_OK;
    ULONG                               idx;
    ULONG                               cPruned = 0;
    IStorageProperties *                piccpdp = NULL;
    HRESULT                             hrTemp;
    CLSID                               clsidMinorId;
    BSTR                                bstrDiskName = NULL;
    BSTR                                bstrDeviceName = NULL;

    for ( idx = 0; idx < m_idxNext; idx++ )
    {
        if ( (*m_prgDisks)[ idx ] != NULL )
        {
            hr = ((*m_prgDisks)[ idx ])->TypeSafeQI( IStorageProperties, &piccpdp );
            if ( FAILED( hr ) )
            {
                goto Cleanup;
            } // if:

            hr = piccpdp->HrIsDynamicDisk();
            if ( FAILED( hr ) )
            {
                goto Cleanup;
            } // if:

            if ( hr == S_OK )
            {
                ((*m_prgDisks)[ idx ])->Release();
                (*m_prgDisks)[ idx ] = NULL;
                cPruned++;

                hrTemp = piccpdp->HrGetDiskNames( &bstrDiskName, &bstrDeviceName );
                if ( FAILED( hrTemp ) )
                {
                    LOG_STATUS_REPORT( L"Could not get the name of the disk", hrTemp );
                    bstrDiskName = NULL;
                    bstrDeviceName = NULL;
                } // if:

                hrTemp = CoCreateGuid( &clsidMinorId );
                if ( FAILED( hrTemp ) )
                {
                    LOG_STATUS_REPORT( L"Could not create a guid for a dynamic disk minor task ID", hrTemp );
                    clsidMinorId = IID_NULL;
                } // if:

                STATUS_REPORT_REF( TASKID_Major_Find_Devices, TASKID_Minor_Non_SCSI_Disks, IDS_INFO_NON_SCSI_DISKS, IDS_INFO_NON_SCSI_DISKS_REF, hr );
                STATUS_REPORT_STRING2_REF(
                          TASKID_Minor_Non_SCSI_Disks
                        , clsidMinorId
                        , IDS_ERROR_LDM_DISK
                        , bstrDeviceName != NULL ? bstrDeviceName : L"<unknown>"
                        , bstrDiskName != NULL ? bstrDiskName : L"<unknown>"
                        , IDS_ERROR_LDM_DISK_REF
                        , hr
                        );
            } // if:

            piccpdp->Release();
            piccpdp = NULL;

            SysFreeString( bstrDiskName );
            bstrDiskName = NULL;

            SysFreeString( bstrDeviceName );
            bstrDeviceName = NULL;
        } // end if:
    } // for:

    *pcPrunedInout = cPruned;
    hr = S_OK;

Cleanup:

    if ( piccpdp != NULL )
    {
        piccpdp->Release();
    } // if:

    SysFreeString( bstrDiskName );
    SysFreeString( bstrDeviceName );

    return hr;

} //*** CEnumStorageResource::HrPruneDynamicDisks

HRESULT CEnumStorageResource::HrPruneGPTDisks ( ULONG * pcPrunedInout ) [private]

Definition at line 3153 of file CEnumStorageResource.cpp.

{
    assert( pcPrunedInout != NULL );

    HRESULT                             hr = S_OK;
    ULONG                               idx;
    ULONG                               cPruned = 0;
    IStorageProperties *                piccpdp = NULL;
    HRESULT                             hrTemp;
    CLSID                               clsidMinorId;
    BSTR                                bstrDiskName = NULL;
    BSTR                                bstrDeviceName = NULL;

    for ( idx = 0; idx < m_idxNext; idx++ )
    {
        if ( (*m_prgDisks)[ idx ] != NULL )
        {
            hr = ((*m_prgDisks)[ idx ])->TypeSafeQI( IStorageProperties, &piccpdp );
            if ( FAILED( hr ) )
            {
                goto Cleanup;
            } // if:

            hr = piccpdp->HrIsGPTDisk();
            if ( FAILED( hr ) )
            {
                goto Cleanup;
            } // if:

            if ( hr == S_OK )
            {
                ((*m_prgDisks)[ idx ])->Release();
                (*m_prgDisks)[ idx ] = NULL;
                cPruned++;

                hrTemp = piccpdp->HrGetDiskNames( &bstrDiskName, &bstrDeviceName );
                if ( FAILED( hrTemp ) )
                {
                    LOG_STATUS_REPORT( L"Could not get the name of the disk", hrTemp );
                    bstrDiskName = NULL;
                    bstrDeviceName = NULL;
                } // if:

                hrTemp = CoCreateGuid( &clsidMinorId );
                if ( FAILED( hrTemp ) )
                {
                    LOG_STATUS_REPORT( L"Could not create a guid for a dynamic disk minor task ID", hrTemp );
                    clsidMinorId = IID_NULL;
                } // if:

                STATUS_REPORT_REF( TASKID_Major_Find_Devices, TASKID_Minor_Non_SCSI_Disks, IDS_INFO_NON_SCSI_DISKS, IDS_INFO_NON_SCSI_DISKS_REF, hr );
                STATUS_REPORT_STRING2_REF(
                          TASKID_Minor_Non_SCSI_Disks
                        , clsidMinorId
                        , IDS_INFO_GPT_DISK
                        , bstrDeviceName != NULL ? bstrDeviceName : L"<unknown>"
                        , bstrDiskName != NULL ? bstrDiskName : L"<unknown>"
                        , IDS_ERROR_LDM_DISK_REF
                        , hr
                        );
            } // if:

            piccpdp->Release();
            piccpdp = NULL;

            SysFreeString( bstrDiskName );
            bstrDiskName = NULL;

            SysFreeString( bstrDeviceName );
            bstrDeviceName = NULL;
        } // end if:
    } // for:

    *pcPrunedInout = cPruned;
    hr = S_OK;

Cleanup:

    if ( piccpdp != NULL )
    {
        piccpdp->Release();
    } // if:

    SysFreeString( bstrDiskName );
    SysFreeString( bstrDeviceName );

    return hr;

} //*** CEnumStorageResource::HrPruneGPTDisks

HRESULT CEnumStorageResource::HrPrunePageFileDiskBuses | ( | BOOL | fPruneBusIn,
 |  | ULONG * | pcPrunedInout |
 | ) |  |  | [private]

Definition at line 2851 of file CEnumStorageResource.cpp.

{
    assert( pcPrunedInout != NULL );

    HRESULT         hr = S_OK;
    WCHAR           szPageFileDisks[ 26 ];
    int             cPageFileDisks = 0;
    int             idxPageFileDisk;
    ULONG           ulSCSIBus;
    ULONG           ulSCSIPort;
    ULONG           idx;
    ULONG           cPruned = 0;

    //
    //  Prune the bus with disks that have paging files.
    //

    hr = HrGetPageFileLogicalDisks( GetCallback(), szPageFileDisks, &cPageFileDisks );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    if ( cPageFileDisks > 0 )
    {
        for ( idxPageFileDisk = 0; idxPageFileDisk < cPageFileDisks; idxPageFileDisk++ )
        {
            hr = HrFindDiskWithLogicalDisk( szPageFileDisks[ idxPageFileDisk ], &idx );
            if ( FAILED( hr ) )
            {
                goto Cleanup;
            } // if:

            if ( hr == S_OK )
            {
                //
                //  Should we prune the whole bus, or just the system disk itself?
                //

                if ( fPruneBusIn )
                {
                    hr = HrGetSCSIInfo( idx, &ulSCSIBus, &ulSCSIPort );
                    if ( FAILED( hr ) )
                    {
                        goto Cleanup;
                    } // if:

                    STATUS_REPORT( TASKID_Major_Find_Devices, TASKID_Minor_Pruning_PageFile_Disk_Bus, IDS_INFO_PRUNING_PAGEFILEDISK_BUS, hr );
                    hr = HrPruneDisks(
                                      ulSCSIBus
                                    , ulSCSIPort
                                    , &TASKID_Minor_Pruning_PageFile_Disk_Bus
                                    , IDS_INFO_PAGEFILEDISK_PRUNED
                                    , IDS_INFO_PAGEFILEDISK_PRUNED_REF
                                    , &cPruned
                                    );
                    if ( FAILED( hr ) )
                    {
                        goto Cleanup;
                    } // if:
                } // if:
                else
                {
                    RemoveDiskFromArray( idx );
                    cPruned++;
                } // else:
            } // if:
        } // for:
    } // if:

    *pcPrunedInout = cPruned;
    hr = S_OK;

Cleanup:

    return hr;

} //*** CEnumStorageResource::HrPrunePageFileDiskBuses

HRESULT CEnumStorageResource::HrPruneSystemDisks ( void ) [private]

Definition at line 956 of file CEnumStorageResource.cpp.

{
    assert( m_bstrSystemLogicalDisk != NULL );
    assert( m_bstrBootLogicalDisk != NULL );

    HRESULT                 hr = S_OK;
    ULONG                   idx;
    ULONG                   ulSCSIBus;
    ULONG                   ulSCSIPort;
    IStorageProperties *    piccpdp = NULL;
    IUnknown *              punk = NULL;
    ULONG                   cRemoved = 0;
    ULONG                   cTemp = 0;
    BOOL                    fSystemAndBootTheSame;
    BOOL                    fPruneBus = FALSE;

    //
    //  Minor optimization when the system and boot disk are the same disk.
    //

    fSystemAndBootTheSame =   ( m_bstrSystemLogicalDisk != NULL )
                            ? ( m_bstrBootLogicalDisk[ 0 ] == m_bstrSystemLogicalDisk[ 0 ] )
                            : FALSE;

    //
    //  The system bus is usually not managed.  It is managed when a registry
    //  entry has been made to make it managed.  It is usually done when the
    //  system bus is a storage area network.
    //
    //  NB:
    //      This is only applicable to physical disks.  Your custom resource
    //      type will most likely not care about this.
    //

    hr = HrIsSystemBusManaged();
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    //
    //  If the system bus is not managed then we need to prune the disks on those buses
    //  that contain system, boot, and pagefile disks.
    //

    fPruneBus = ( hr == S_FALSE );

    //
    //  Prune the disks on the system buses.  If the system disks are IDE they won't
    //  be in the list.
    //

    //
    //  Find the boot disk(s).  Could be a volume with more than one disk.
    //

    for ( ; ; )
    {
        hr = HrFindDiskWithLogicalDisk( m_bstrBootLogicalDisk[ 0 ], &idx );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:

        if ( hr == S_OK )
        {

            //
            //  Should we prune the whole bus, or just the boot disk itself?
            //  Typically we need to prune the entire bus, but when the
            //  special registry entry tells us not to then we only prune the
            //  spindles themselves.
            //

            if ( fPruneBus )
            {
                hr = HrGetSCSIInfo( idx, &ulSCSIBus, &ulSCSIPort );
                if ( FAILED( hr ) )
                {
                    goto Cleanup;
                } // if:

                //
                //  Tell the UI that we are pruning the boot disk bus...
                //

                STATUS_REPORT( TASKID_Major_Find_Devices, TASKID_Minor_Pruning_Boot_Disk_Bus, IDS_INFO_PRUNING_BOOTDISK_BUS, hr );
                hr = HrPruneDisks(
                                  ulSCSIBus
                                , ulSCSIPort
                                , &TASKID_Minor_Pruning_Boot_Disk_Bus
                                , IDS_INFO_BOOTDISK_PRUNED
                                , IDS_INFO_BOOTDISK_PRUNED_REF
                                , &cTemp
                                );
                if ( FAILED( hr ) )
                {
                    goto Cleanup;
                } // if:

                cRemoved += cTemp;
            } // if: prune all disks from the boot disk SCSI bus
            else
            {
                RemoveDiskFromArray( idx );
                cRemoved++;
            } // else: only prune boot disk

            continue;
        } // if:

        break;
    } // for: each volume in the logical disk

    //
    //  Prune the system disk bus if it is not the same as the boot disk bus.
    //

    if ( fSystemAndBootTheSame == FALSE )
    {
        if ( m_bstrSystemLogicalDisk != NULL )
        {
            assert( m_bstrSystemWMIDeviceID == NULL );
            hr = HrFindDiskWithLogicalDisk( m_bstrSystemLogicalDisk[ 0 ], &idx );
        } // if:
        else
        {
            assert( m_bstrSystemLogicalDisk == NULL );
            hr = HrFindDiskWithWMIDeviceID( m_bstrSystemWMIDeviceID, &idx );
        } // else:

        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:

        if ( hr == S_OK )
        {
            //
            //  Should we prune the whole bus, or just the system disk itself?
            //

            if ( fPruneBus )
            {
                hr = HrGetSCSIInfo( idx, &ulSCSIBus, &ulSCSIPort );
                if ( FAILED( hr ) )
                {
                    goto Cleanup;
                } // if:

                //
                //  Tell the UI that we are pruning the system disk bus...
                //

                STATUS_REPORT( TASKID_Major_Find_Devices, TASKID_Minor_Pruning_System_Disk_Bus, IDS_INFO_PRUNING_SYSTEMDISK_BUS, hr );
                hr = HrPruneDisks(
                                  ulSCSIBus
                                , ulSCSIPort
                                , &TASKID_Minor_Pruning_System_Disk_Bus
                                , IDS_INFO_SYSTEMDISK_PRUNED
                                , IDS_INFO_SYSTEMDISK_PRUNED_REF
                                , &cTemp
                                );
                if ( FAILED( hr ) )
                {
                    goto Cleanup;
                } // if:

                cRemoved += cTemp;
            } // if: prune system disk bus
            else
            {
                RemoveDiskFromArray( idx );
                cRemoved++;
            } // else: only prune the system disk
        } // if:
    } // if:

    //
    //  Now prune the busses that have page file disks on them.
    //

    hr = HrPrunePageFileDiskBuses( fPruneBus, &cTemp );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    cRemoved += cTemp;

    //
    //  Now prune the bus that has a crash dump file disk.
    //

    hr = HrPruneCrashDumpBus( fPruneBus, &cTemp );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    cRemoved += cTemp;

    //
    //  Now prune the off any remaining dynamic disks.  Dynamic disks cannot
    //  be physical disks.  There may be a different plug in component that
    //  managed those disks.
    //

    hr = HrPruneDynamicDisks( &cTemp );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    cRemoved += cTemp;

    //
    //  Now prune the off any remaining GPT disks.  GPT disks are not
    //  compatible with clustering at this time.
    //

    hr = HrPruneGPTDisks( &cTemp );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    cRemoved += cTemp;

    //
    //  Last ditch effort to properly set the managed state of the remaining disks.
    //

    for ( idx = 0; ( cRemoved < m_idxNext ) && ( idx < m_idxNext ); idx++ )
    {
        //
        //  Sparse array.
        //

        punk = (*m_prgDisks)[ idx ];    // don't ref
        if ( punk != NULL )
        {
            hr = punk->TypeSafeQI( IStorageProperties, &piccpdp );
            if ( FAILED( hr ) )
            {
                LOG_STATUS_REPORT( L"Could not query for the IStorageProperties interface.", hr );
                goto Cleanup;
            } // if:

            //
            //  Give the disk a chance to figure out for itself if it should be managed.
            //

            hr = piccpdp->CanBeManaged();
            if ( FAILED( hr ) )
            {
                goto Cleanup;
            } // if:

            piccpdp->Release();
            piccpdp = NULL;
        } // if: index has a pointer
    } // for: each index in the array

    //
    //  Minor optimization.  If we removed all of the elements reset the enum next to 0.
    //

    if ( cRemoved == m_idxNext )
    {
        m_idxNext = 0;
    } // if:

    hr = S_OK;
    goto Cleanup;

Cleanup:

    if ( piccpdp != NULL )
    {
        piccpdp->Release();
    } // if:

    return hr;

} //*** CEnumStorageResource::HrPruneSystemDisks

HRESULT CEnumStorageResource::HrSetThisDiskToBeManaged | ( | ULONG | ulSCSITidIn,
 |  | ULONG | ulSCSILunIn,
 |  | BOOL | fIsQuorumIn,
 |  | BSTR | bstrResourceNameIn,
 |  | DWORD | dwSignatureIn |
 | ) |  |  | [private]

Definition at line 1614 of file CEnumStorageResource.cpp.

{
    HRESULT                         hr = S_OK;
    ULONG                           idx;
    IUnknown *                      punk = NULL;
    IClusCfgManagedResourceInfo *   piccmri = NULL;
    WCHAR                           sz[ 64 ];
    BSTR                            bstrUID = NULL;
    DWORD                           dwSignature;
    IStorageProperties *            piccpdp = NULL;

    UNREFERENCED_PARAMETER( dwSignatureIn );

    hr = StringCchPrintfW( sz, RTL_NUMBER_OF( sz ), L"%s SCSI Tid %ld, SCSI Lun %ld", GetDisplayName(), ulSCSITidIn, ulSCSILunIn );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    //
    //  Find the disk that has the passes in TID and Lun and set it
    //  to be managed.
    //

    for ( idx = 0; idx < m_idxNext; idx++ )
    {
        punk = (*m_prgDisks)[ idx ];                                                        // don't ref
        if ( punk != NULL )
        {
            hr = punk->TypeSafeQI( IClusCfgManagedResourceInfo, &piccmri );
            if ( FAILED( hr ) )
            {
                goto Cleanup;
            } // if:

            hr = piccmri->GetUID( &bstrUID );
            if ( FAILED( hr ) )
            {
                goto Cleanup;
            } // if:

            if ( NIStringCompareW( bstrUID, SysStringLen( bstrUID ), sz, RTL_NUMBER_OF( sz ) ) == 0 )
            {
                hr = piccmri->TypeSafeQI( IStorageProperties, &piccpdp );
                if ( FAILED( hr ) )
                {
                    goto Cleanup;
                } // if:

                hr = piccpdp->HrGetSignature( &dwSignature );
                if ( FAILED( hr ) )
                {
                    goto Cleanup;
                } // if:

                hr = piccpdp->HrSetFriendlyName( bstrResourceNameIn );
                if ( FAILED( hr ) )
                {
                    goto Cleanup;
                } // if:

                piccpdp->Release();
                piccpdp = NULL;

                //
                //  May want to do more with this later...
                //

                assert( dwSignatureIn == dwSignature );

                hr = piccmri->SetManaged( TRUE );
                if ( FAILED( hr ) )
                {
                    goto Cleanup;
                } // if:

                hr = piccmri->SetQuorumResource( fIsQuorumIn );
                if ( FAILED( hr ) )
                {
                    goto Cleanup;
                } // if:

                break;
            } // if:

            SysFreeString( bstrUID );
            bstrUID = NULL;
            piccmri->Release();
            piccmri = NULL;
        } // if:
    } // for:

Cleanup:

    if ( piccpdp != NULL )
    {
        piccpdp->Release();
    } // if:

    if ( piccmri != NULL )
    {
        piccmri->Release();
    } // if:

    SysFreeString( bstrUID );

    return hr;

} //*** CEnumStorageResource::HrSetThisDiskToBeManaged

HRESULT CEnumStorageResource::HrSortDisksByIndex ( void ) [private]

Definition at line 2749 of file CEnumStorageResource.cpp.

{
    HRESULT         hr = S_OK;
    SIndexedDisk *  prgIndexedDisks = NULL;
    size_t          idxCurrentDisk = 0;
    size_t          idxSortedDisk = 0;
    size_t          cDisks = 0;

    //
    //  Count the number of non-null pointers in the array
    //

    for ( idxCurrentDisk = 0; idxCurrentDisk < m_idxNext; ++idxCurrentDisk )
    {
        if ( (*m_prgDisks)[ idxCurrentDisk ] != NULL )
        {
            cDisks += 1;
        } // if:
    } // for:

    if ( cDisks < 2 ) // no sorting to do; also avoid calling new[] with zero array size
    {
        goto Cleanup;
    } // if:

    //
    //  Make a compact array of indexed disks
    //

    prgIndexedDisks = new SIndexedDisk[ cDisks ];
    if ( prgIndexedDisks == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if:

    //
    //  Initialize the array of indexed disks
    //

    for ( idxCurrentDisk = 0; idxCurrentDisk < m_idxNext; ++idxCurrentDisk )
    {
        if ( (*m_prgDisks)[ idxCurrentDisk ] != NULL )
        {
            hr = prgIndexedDisks[ idxSortedDisk ].HrInit( (*m_prgDisks)[ idxCurrentDisk ] );
            if ( FAILED( hr ) )
            {
                goto Cleanup;
            } // if:

            idxSortedDisk += 1;
        } // if current disk pointer in original array is not null
    } // for each disk pointer in the original array

    InsertionSort( prgIndexedDisks, cDisks, SIndexedDiskLessThan() );

    //
    //  Copy the sorted pointers back into the original array, padding extra
    //  space with nulls
    //

    for ( idxCurrentDisk = 0; idxCurrentDisk < m_idxNext; ++idxCurrentDisk)
    {
        if ( idxCurrentDisk < cDisks)
        {
            (*m_prgDisks)[ idxCurrentDisk ] = prgIndexedDisks[ idxCurrentDisk ].punkDisk;
        } // if:
        else
        {
            (*m_prgDisks)[ idxCurrentDisk ] = NULL;
        } // else:
    } // for each slot in the original array

Cleanup:

    delete [] prgIndexedDisks;

    return hr;

} //*** CEnumStorageResource::HrSortDisksByIndex

STDMETHODIMP CEnumStorageResource::Initialize | ( | IUnknown * | punkCallbackIn,
 |  | LCID | lcidIn
 | ) |  |

Reimplemented from CMgdClusCfgInit.

Definition at line 152 of file CEnumStorageResource.cpp.

{
    HRESULT         hr = S_OK;
    IWbemServices * pIWbemServices = NULL;

    //
    // Initialize the base class.
    //

    hr = CMgdClusCfgInit::Initialize( punkCallbackIn, lcidIn );
    if ( FAILED( hr ) )
    {
        //
        //  Base class will log the error if possible.
        //

        goto Cleanup;
    } // if: base classs initialization failed

    //
    // Do custom initialization - get a handle to the WBEM service.
    //

    hr = HrInitializeWbemConnection( &pIWbemServices );
    if ( FAILED( hr ) )
    {
        STATUS_REPORT_REF(
                      TASKID_Major_Find_Devices
                    , TASKID_Minor_InitWbem_Enum_StorageResource
                    , IDS_ERROR_WBEM_CONNECTION_FAILURE
                    , IDS_ERROR_WBEM_CONNECTION_FAILURE_REF
                    , hr
                    );
        goto Cleanup;
    } // if: HrInitializeWbemConnection failed

    hr = SetWbemServices( pIWbemServices );
    if ( FAILED( hr ) )
    {
        STATUS_REPORT_REF(
                      TASKID_Major_Find_Devices
                    , TASKID_Minor_InitWbem_Enum_StorageResource
                    , IDS_ERROR_WBEM_CONNECTION_FAILURE
                    , IDS_ERROR_WBEM_CONNECTION_FAILURE_REF
                    , hr
                    );
        goto Cleanup;
    } // if: SetWbemServices failed

    hr = HrGetSystemDevice( &m_bstrSystemDevice );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    hr = HrConvertDeviceVolumeToLogicalDisk( m_bstrSystemDevice, &m_bstrSystemLogicalDisk );
    if ( HRESULT_CODE( hr ) == ERROR_INVALID_FUNCTION )
    {

        //
        // System volume is an EFI volume on IA64 and won't have a logical disk.
        //

        hr = HrConvertDeviceVolumeToWMIDeviceID( m_bstrSystemDevice, &m_bstrSystemWMIDeviceID );
        assert( m_bstrSystemLogicalDisk == NULL );
        assert( m_bstrSystemWMIDeviceID != NULL );
    } // if:

    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    hr = HrGetBootLogicalDisk( &m_bstrBootLogicalDisk );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    hr = HrIsLogicalDiskNTFS( m_bstrBootLogicalDisk );
    if ( hr == S_FALSE )
    {
        STATUS_REPORT_REF(
                  TASKID_Major_Find_Devices
                , TASKID_Minor_Boot_Partition_Not_NTFS
                , IDS_WARN_BOOT_PARTITION_NOT_NTFS
                , IDS_WARN_BOOT_PARTITION_NOT_NTFS_REF
                , hr
                );
        hr = S_OK;
    } // if:

    hr = HrGetCrashDumpLogicalDisk( &m_bstrCrashDumpLogicalDisk );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

Cleanup:

    if ( pIWbemServices != NULL )
    {
        pIWbemServices->Release();
    } // if:

    return hr;

} //*** CEnumStorageResource::Initialize

HRESULT CEnumStorageResource::IsDiskSCSI ( IWbemClassObject * pDiskIn ) [private]

Definition at line 1263 of file CEnumStorageResource.cpp.

{
    assert( pDiskIn != NULL );

    HRESULT hr;
    VARIANT var;

    VariantInit( &var );

    hr = HrGetWMIProperty( pDiskIn, L"InterfaceType", VT_BSTR, &var );
    if ( SUCCEEDED( hr ) )
    {
        if ( ( NStringCompareW( L"SCSI", RTL_NUMBER_OF( L"SCSI" ), var.bstrVal, SysStringLen( var.bstrVal ) ) == 0 ) )
        {
            hr = S_OK;
        } // if:
        else
        {
            hr = S_FALSE;
        } // else:
    } // if:

    VariantClear( &var );

    return hr;

} //*** CEnumStorageResource::IsDiskSCSI

void CEnumStorageResource::LogPrunedDisk | ( | IUnknown * | punkIn,
 |  | ULONG | ulSCSIBusIn,
 |  | ULONG | ulSCSIPortIn |
 | ) |  |  | [private]

Definition at line 2028 of file CEnumStorageResource.cpp.

{
    assert( punkIn != NULL );

    HRESULT                             hr = S_OK;
    IClusCfgManagedResourceInfo *       piccmri = NULL;
    IStorageProperties *                piccpdp = NULL;
    BSTR                                bstrName = NULL;
    BSTR                                bstrUID = NULL;
    BSTR                                bstr = NULL;

    hr = punkIn->TypeSafeQI( IClusCfgManagedResourceInfo, &piccmri );
    if ( SUCCEEDED( hr ) )
    {
        hr = piccmri->GetUID( &bstrUID );
        piccmri->Release();
    } // if:

    if ( FAILED( hr ) )
    {
        bstrUID = SysAllocString( L"<Unknown>" );
    } // if:

    hr = punkIn->TypeSafeQI( IStorageProperties, &piccpdp );
    if ( SUCCEEDED( hr ) )
    {
        hr = piccpdp->HrGetDeviceID( &bstrName );
        piccpdp->Release();
    } // if:

    if ( FAILED( hr ) )
    {
        bstrName = SysAllocString( L"<Unknown>" );
    } // if:

    hr = HrFormatStringIntoBSTR(
                  L"[MyStorageResource] Pruning SCSI disk '%1!ws!', on Bus '%2!d!' and Port '%3!d!'; at '%4!ws!'"
                , &bstr
                , bstrName
                , ulSCSIBusIn
                , ulSCSIPortIn
                , bstrUID
                );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    LOG_STATUS_REPORT( bstr, hr );

Cleanup:

    SysFreeString( bstrName );
    SysFreeString( bstrUID );
    SysFreeString( bstr );

} //*** CEnumStorageResource::LogPrunedDisk

STDMETHODIMP CEnumStorageResource::Next | ( | ULONG | cNumberRequestedIn,
 |  | IClusCfgManagedResourceInfo ** | rgpManagedResourceInfoOut,
 |  | ULONG * | pcNumberFetchedOut
 | ) |  |

Definition at line 375 of file CEnumStorageResource.cpp.

{
    HRESULT                         hr = S_FALSE;
    ULONG                           cFetched = 0;
    IClusCfgManagedResourceInfo *   pccsdi;
    IUnknown *                      punk;
    ULONG                           ulStop;

    //
    // Make sure required arguments were specified.
    //

    if ( rgpManagedResourceInfoOut == NULL )
    {
        hr = E_POINTER;
        STATUS_REPORT_REF(
              TASKID_Major_Find_Devices
            , TASKID_Minor_Next_Enum_StorageResource
            , IDS_ERROR_NULL_POINTER
            , IDS_ERROR_NULL_POINTER_REF
            , hr
            );
        goto Cleanup;
    } // if:

    //
    //  TODO:
    //
    //  Replace the following sample code with code that finds and loads your
    //  resources (device) of your resource type.
    //

    //
    // Load the enumeration if not already done.
    //

    if ( m_fLoadedDevices == FALSE )
    {
        hr = HrLoadEnum();
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:
    } // if: enumeration not loaded yet

    //
    // Return the number of objects requested by the caller in the
    // caller's pointer array.
    //

    ulStop = min( cNumberRequestedIn, ( m_idxNext - m_idxEnumNext ) );

    for ( hr = S_OK; ( cFetched < ulStop ) && ( m_idxEnumNext < m_idxNext ); m_idxEnumNext++ )
    {
        //
        //  This is a sparse array...
        //

        punk = (*m_prgDisks)[ m_idxEnumNext ];
        if ( punk != NULL )
        {
            hr = punk->TypeSafeQI( IClusCfgManagedResourceInfo, &pccsdi );
            if ( FAILED( hr ) )
            {
                break;
            } // if:

            rgpManagedResourceInfoOut[ cFetched++ ] = pccsdi;
        } // if: entry found in the enumeration
    } // for: each resource to be returned to the caller

    //
    // If a failure occurs, release the objects that have already been added
    // to the caller's pointer array.
    //

    if ( FAILED( hr ) )
    {
        //
        //  Back up the enum index
        //

        m_idxEnumNext -= cFetched;

        while ( cFetched != 0 )
        {
            (rgpManagedResourceInfoOut[ --cFetched ])->Release();
            rgpManagedResourceInfoOut[ cFetched ] = NULL;
        } // for: each pointer in the out array

        goto Cleanup;
    } // if: failure occurred getting objects from the enumeration

    //
    //  If the number returned is less than the number requested then we must
    //  return S_FALSE -- even if we are out of data.  That is the contract
    //  that we have as a COM enumerator...
    //

    if ( cFetched < cNumberRequestedIn )
    {
        hr = S_FALSE;
    } // if:

Cleanup:

    if ( pcNumberFetchedOut != NULL )
    {
        *pcNumberFetchedOut = cFetched;
    } // if:

    return hr;

} //*** CEnumStorageResource::Next

const CEnumStorageResource& CEnumStorageResource::operator= ( const CEnumStorageResource & nodeSrc ) [private]
void CEnumStorageResource::RemoveDiskFromArray ( ULONG idxDiskIn ) [private]

Definition at line 2641 of file CEnumStorageResource.cpp.

{
    assert( idxDiskIn < m_idxNext );

    ((*m_prgDisks)[ idxDiskIn ])->Release();
    (*m_prgDisks)[ idxDiskIn ] = NULL;

    m_cDiskCount -= 1;

} //*** CEnumStorageResource::RemoveDiskFromArray

STDMETHODIMP CEnumStorageResource::Reset ( void )

Definition at line 553 of file CEnumStorageResource.cpp.

{
    m_idxEnumNext = 0;

    return S_OK;

} //*** CEnumStorageResource::Reset

STDMETHODIMP CEnumStorageResource::SetWbemServices ( IWbemServices * pIWbemServicesIn )

Definition at line 291 of file CEnumStorageResource.cpp.

{
    HRESULT hr = S_OK;

    //
    // Make sure required arguments were specified.
    //

    if ( pIWbemServicesIn == NULL )
    {
        hr = E_POINTER;
        STATUS_REPORT_REF(
              TASKID_Major_Find_Devices
            , TASKID_Minor_SetWbemServices_Enum_StorageResource
            , IDS_ERROR_NULL_POINTER
            , IDS_ERROR_NULL_POINTER_REF
            , hr
            );
        goto Cleanup;
    } // if:

    m_pIWbemServices = pIWbemServicesIn;
    m_pIWbemServices->AddRef();

Cleanup:

    return hr;

} //*** CEnumStorageResource::SetWbemServices

STDMETHODIMP CEnumStorageResource::Skip ( ULONG cNumberToSkipIn )

Definition at line 513 of file CEnumStorageResource.cpp.

{
    HRESULT hr = S_OK;

    m_idxEnumNext += cNumberToSkipIn;
    if ( m_idxEnumNext >= m_idxNext )
    {
        //
        //  Could not skip the full amount...  Set the enum index to the end
        //  of the data and return S_FALSE.
        //

        m_idxEnumNext = m_idxNext;
        hr = S_FALSE;
    } // if:

    return hr;

} //*** CEnumStorageResource::Skip

Member Data Documentation

BSTR CEnumStorageResource::m_bstrBootDevice [private]

Definition at line 101 of file CEnumStorageResource.h.

BSTR CEnumStorageResource::m_bstrBootLogicalDisk [private]

Definition at line 103 of file CEnumStorageResource.h.

BSTR CEnumStorageResource::m_bstrCrashDumpLogicalDisk [private]

Definition at line 106 of file CEnumStorageResource.h.

BSTR CEnumStorageResource::m_bstrSystemDevice [private]

Definition at line 102 of file CEnumStorageResource.h.

BSTR CEnumStorageResource::m_bstrSystemLogicalDisk [private]

Definition at line 104 of file CEnumStorageResource.h.

BSTR CEnumStorageResource::m_bstrSystemWMIDeviceID [private]

Definition at line 105 of file CEnumStorageResource.h.

DWORD CEnumStorageResource::m_cDiskCount [private]

Definition at line 107 of file CEnumStorageResource.h.

BOOL CEnumStorageResource::m_fLoadedDevices [private]

Definition at line 96 of file CEnumStorageResource.h.

ULONG CEnumStorageResource::m_idxEnumNext [private]

Definition at line 100 of file CEnumStorageResource.h.

ULONG CEnumStorageResource::m_idxNext [private]

Definition at line 99 of file CEnumStorageResource.h.

IWbemServices* CEnumStorageResource::m_pIWbemServices [private]

Definition at line 97 of file CEnumStorageResource.h.

IUnknown*(* CEnumStorageResource::m_prgDisks)[] [private]

Definition at line 98 of file CEnumStorageResource.h.

The documentation for this class was generated from the following files:
  • WinBase/Cluster/Win2003/MyStorageResource/CEnumStorageResource.h
  • WinBase/Cluster/Win2003/MyStorageResource/CEnumStorageResource.cpp
Generated on Wed Nov 13 2024 16:56:28 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CEnumSyncMgrItems Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CEnumSyncMgrItems Class Reference

#include "Settings.h"

Inherits CGenericEnum.

List of all members.

Public Member Functions

CEnumSyncMgrItems (LPGENERICITEMLIST pContactItemList, DWORD cOffset)
STDMETHODIMP | Clone (ISyncMgrEnumItems **ppenum)
virtual void | DeleteThisObject ()
STDMETHODIMP | Next (ULONG celt, LPSYNCMGRITEM rgelt, ULONG *pceltFetched)
STDMETHODIMP | QueryInterface (REFIID, LPVOID FAR *)
STDMETHODIMP | Reset ()
STDMETHODIMP | Skip (ULONG celt)
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()

Detailed Description

Definition at line 160 of file Settings.h.

Constructor & Destructor Documentation

CEnumSyncMgrItems::CEnumSyncMgrItems | ( | LPGENERICITEMLIST | pContactItemList,
 |  | DWORD | cOffset
 | ) |  |

Definition at line 1793 of file Settings.Cpp.

    : CGenericEnum(pGenericItemList,cOffset)
{
}

Member Function Documentation

STDMETHODIMP CEnumSyncMgrItems::Clone ( ISyncMgrEnumItems ** ppenum )

Definition at line 1985 of file Settings.Cpp.

{
*ppenum = new  CEnumSyncMgrItems(m_pGenericItemList,m_cOffset);

    return *ppenum ? NOERROR : E_OUTOFMEMORY;
}

void CEnumSyncMgrItems::DeleteThisObject ( ) [virtual]

Implements CGenericEnum.

Definition at line 1811 of file Settings.Cpp.

{
    delete this;
}

STDMETHODIMP CEnumSyncMgrItems::Next | ( | ULONG | celt,
 |  | LPSYNCMGRITEM | rgelt,
 |  | ULONG * | pceltFetched
 | ) |  |

Definition at line 1899 of file Settings.Cpp.

{
HRESULT hr = NOERROR;
ULONG ulFetchCount = celt;
ULONG ulTransferCount = 0;
LPSYNCMGRITEM pGenericItem;

    if ( (m_cOffset + celt) > m_pGenericItemList->dwNumItems)
    {
    ulFetchCount = m_pGenericItemList->dwNumItems - m_cOffset;
    hr = S_FALSE;
    }

    pGenericItem = rgelt;

    while (ulFetchCount--)
    {
    LPSAMPLEITEMSETTINGS pNextSyncMgrItem;

        Assert(m_pNextItem->cbSize == sizeof(SAMPLEITEMSETTINGS));

        pNextSyncMgrItem = (LPSAMPLEITEMSETTINGS) m_pNextItem;

    memcpy(pGenericItem,&(pNextSyncMgrItem->syncmgrItem),sizeof(SYNCMGRITEM));
    m_pNextItem = m_pNextItem->pNextGenericItem; // add error checking
    ++m_cOffset;
        ++ulTransferCount;
    ++pGenericItem;
    }

    if (pceltFetched)
    {
        *pceltFetched = ulTransferCount;
    }

    return hr;
}

STDMETHODIMP CEnumSyncMgrItems::QueryInterface | ( | REFIID | riid,
 |  | LPVOID FAR * | ppv
 | ) |  |

Reimplemented from CGenericEnum.

Definition at line 1829 of file Settings.Cpp.

{
    *ppv = NULL;

    if (IsEqualIID(riid, IID_IUnknown))
    {
        *ppv = (LPUNKNOWN) this;
    }
    else if (IsEqualIID(riid, IID_ISyncMgrEnumItems))
    {
        *ppv = (LPSYNCMGRENUMITEMS) this;
    }
    if (*ppv)
    {
        AddRef();

        return NOERROR;
    }

    return E_NOINTERFACE;
}

STDMETHODIMP CEnumSyncMgrItems::Reset ( void )

Reimplemented from CGenericEnum.

Definition at line 1967 of file Settings.Cpp.

{
    return CGenericEnum::Reset();
}

STDMETHODIMP CEnumSyncMgrItems::Skip ( ULONG celt )

Reimplemented from CGenericEnum.

Definition at line 1949 of file Settings.Cpp.

{
    return CGenericEnum::Skip(celt);
}

CEnumSyncMgrItems::STDMETHODIMP_ ( ULONG )

Reimplemented from CGenericEnum.

CEnumSyncMgrItems::STDMETHODIMP_ ( ULONG )

Reimplemented from CGenericEnum.

The documentation for this class was generated from the following files:
  • NetDS/SyncMgr/SyncDir/Settings.h
  • NetDS/SyncMgr/SyncDir/Settings.Cpp
Generated on Wed Nov 13 2024 16:56:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CEnumTASK Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CEnumTASK Class Reference

#include "enumtask.h"

List of all members.

Public Member Functions

CEnumTASK (MMC_TASK *pTaskList, ULONG nTasks)
virtual | ~CEnumTASK ()
virtual HRESULT STDMETHODCALLTYPE | Clone (IEnumTASK __RPC_FAR *__RPC_FAR *ppenum)
virtual HRESULT STDMETHODCALLTYPE | Next (ULONG celt, MMC_TASK __RPC_FAR *rgelt, ULONG __RPC_FAR *pceltFetched)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
virtual HRESULT STDMETHODCALLTYPE | Reset (void)
virtual HRESULT STDMETHODCALLTYPE | Skip (ULONG celt)
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()

Private Attributes

ULONG m_cref
ULONG m_CurrTask
MMC_TASK * | m_pTaskList
ULONG m_TaskCount

Detailed Description

Definition at line 25 of file enumtask.h.

Constructor & Destructor Documentation

CEnumTASK::CEnumTASK | ( | MMC_TASK * | pTaskList,
 |  | ULONG | nTasks
 | ) |  |

Definition at line 30 of file enumtask.Cpp.

    : m_pTaskList(pTaskList), m_TaskCount(nTasks), m_CurrTask(0)
{
}

CEnumTASK::~CEnumTASK ( ) [virtual]

Definition at line 35 of file enumtask.Cpp.

{
    if (m_pTaskList)
        delete [] m_pTaskList;
}

Member Function Documentation

HRESULT CEnumTASK::Clone ( IEnumTASK __RPC_FAR *__RPC_FAR * ppenum ) [virtual]

Definition at line 108 of file enumtask.Cpp.

{
    return E_NOTIMPL;
}

HRESULT CEnumTASK::Next | ( | ULONG | celt,
 |  | MMC_TASK __RPC_FAR * | rgelt,
 |  | ULONG __RPC_FAR * | pceltFetched |
 | ) |  |  | [virtual]

Definition at line 78 of file enumtask.Cpp.

{
    *pceltFetched = 0;

  if (m_CurrTask < m_TaskCount) {
    if (rgelt != NULL) {
      CopyMemory(rgelt, &m_pTaskList[m_CurrTask++], sizeof(MMC_TASK));
      *pceltFetched = 1;
    }
  }

    return (*pceltFetched != 0) ? S_OK : S_FALSE;
}

STDMETHODIMP CEnumTASK::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 41 of file enumtask.Cpp.

{
    if (!ppv)
        return E_FAIL;

    *ppv = NULL;

    if (IsEqualIID(riid, IID_IUnknown))
        *ppv = static_cast<IEnumTASK *>(this);
    else if (IsEqualIID(riid, IID_IEnumTASK))
        *ppv = static_cast<IEnumTASK *>(this);

    if (*ppv)
    {
        reinterpret_cast<IUnknown *>(*ppv)->AddRef();
        return S_OK;
    }

    return E_NOINTERFACE;
}

HRESULT CEnumTASK::Reset ( void ) [virtual]

Definition at line 101 of file enumtask.Cpp.

{
    m_CurrTask = 0;

    return S_OK;
}

HRESULT CEnumTASK::Skip ( ULONG celt ) [virtual]

Definition at line 95 of file enumtask.Cpp.

{
    return E_NOTIMPL;
}

CEnumTASK::STDMETHODIMP_ ( ULONG )
CEnumTASK::STDMETHODIMP_ ( ULONG )

Member Data Documentation

ULONG CEnumTASK::m_cref [private]

Definition at line 59 of file enumtask.h.

ULONG CEnumTASK::m_CurrTask [private]

Definition at line 57 of file enumtask.h.

MMC_TASK* CEnumTASK::m_pTaskList [private]

Definition at line 55 of file enumtask.h.

ULONG CEnumTASK::m_TaskCount [private]

Definition at line 56 of file enumtask.h.

The documentation for this class was generated from the following files:
  • SysMgmt/MMC/Taskpads/enumtask.h
  • SysMgmt/MMC/Taskpads/enumtask.Cpp
Generated on Wed Nov 13 2024 16:56:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CEnumXXX< T, ELT_T, IFACE > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Private Member Functions

CEnumXXX< T, ELT_T, IFACE > Class Template Reference

#include "CEnumXXX.h"

List of all members.

Public Member Functions

virtual | ~CEnumXXX ()
virtual ULONG __stdcall | AddRef ()
virtual HRESULT __stdcall | Clone (IFACE **ppenum)
virtual void __stdcall | FinalRelease ()
virtual HRESULT __stdcall | Next (ULONG celt, ELT_T *rgelt, PULONG pceltFetched)
virtual HRESULT __stdcall | QueryInterface (REFIID iid, PVOID *ppv)
virtual ULONG __stdcall | Release ()
virtual HRESULT __stdcall | Reset (void)
virtual HRESULT __stdcall | Skip (ULONG celt)

Static Public Member Functions

static T *__stdcall | Create (LPUNKNOWN lpUnk, DWORD nCount, ELT_T *elemlist)

Public Attributes

ULONG m_cELT
ULONG m_cRef
ULONG m_iCur
REFIID | m_iid
LPUNKNOWN | m_lpunk
ELT_T * | m_prgELT

Protected Member Functions

CEnumXXX (LPUNKNOWN lpUnk, REFIID iid, DWORD nCount)
virtual bool __stdcall | Init (ELT_T *elemlist)

Private Member Functions

CEnumXXX ()

Detailed Description

template<class T, class ELT_T, class IFACE>
class CEnumXXX< T, ELT_T, IFACE >

Definition at line 22 of file CEnumXXX.h.

Constructor & Destructor Documentation

template<class T , class ELT_T , class IFACE >
CEnumXXX< T, ELT_T, IFACE >::CEnumXXX | ( | LPUNKNOWN | lpUnk,
 |  | REFIID | iid,
 |  | DWORD | nCount |
 | ) |  |  | [protected]

Definition at line 20 of file CEnumXXX.cpp.

    : m_lpunk(lpUnk), m_iid(iid), m_cRef(0), m_iCur(0), m_cELT(nCount), m_prgELT(NULL)
{
  _ASSERT(m_lpunk);
}

template<class T , class ELT_T , class IFACE >
CEnumXXX< T, ELT_T, IFACE >::~CEnumXXX ( ) [virtual]

Definition at line 27 of file CEnumXXX.cpp.

{
  RELEASEINTERFACE(m_lpunk);  // Release the strong lock on the container interface add in the call to QI
  delete [] m_prgELT;
}

template<class T, class ELT_T, class IFACE>
CEnumXXX< T, ELT_T, IFACE >::CEnumXXX ( ) [inline, private]

Definition at line 46 of file CEnumXXX.h.

:m_iid(CLSID_NULL) {};

Member Function Documentation

template<class T , class ELT_T , class IFACE >
ULONG __stdcall CEnumXXX< T, ELT_T, IFACE >::AddRef ( ) [virtual]

Definition at line 116 of file CEnumXXX.cpp.

{
  DEBUGTRACE(_T("In CEnumXXX::AddRef refcounts = %i"), m_cRef+1);
/*
 * Need to AddRef the Container since it owns the list of elements to be enumerated
 */
  m_lpunk->AddRef();  // Add a strong lock on the container interface
  return InterlockedIncrement(reinterpret_cast<PLONG>(&m_cRef));
}

template<class T , class ELT_T , class IFACE>
HRESULT __stdcall CEnumXXX< T, ELT_T, IFACE >::Clone ( IFACE ** ppenum ) [virtual]

Definition at line 208 of file CEnumXXX.cpp.

{
  CHECKPOINTER(ppenum);

  ELT_T* prgELT = new ELT_T[m_cELT];
  if (!prgELT)
    return E_OUTOFMEMORY;

  for (DWORD i = 0; i < m_cELT; i++)
    prgELT[i] = m_prgELT[i];

  T* penum = Create(m_lpunk, m_cELT, prgELT);
  return penum->QueryInterface(m_iid, reinterpret_cast<PVOID*>(ppenum));
}

template<class T , class ELT_T, class IFACE >
T *__stdcall CEnumXXX< T, ELT_T, IFACE >::Create | ( | LPUNKNOWN | lpUnk,
 |  | DWORD | nCount,
 |  | ELT_T * | elemlist |
 | ) |  |  | [static]

Definition at line 35 of file CEnumXXX.cpp.

{
  T* penum = new T(lpUnk, nCount);
  if ( penum && penum->Init(elemlist))
    return penum;
  else
  {
    delete penum;
    return NULL;
  }
}

template<class T , class ELT_T , class IFACE >
void __stdcall CEnumXXX< T, ELT_T, IFACE >::FinalRelease ( ) [virtual]

Reimplemented in CEnumConnections, and CEnumConnectionPoints.

Definition at line 144 of file CEnumXXX.cpp.

{
  DEBUGTRACE(_T("CEnumXXX::FinalRelease"));
}

template<class T , class ELT_T, class IFACE >
bool __stdcall CEnumXXX< T, ELT_T, IFACE >::Init ( ELT_T * elemlist ) [protected, virtual]

Definition at line 50 of file CEnumXXX.cpp.

{
#if 0
  m_prgELT = new ELT_T[m_cELT];
  if (!m_prgELT)
    return false;

  for (DWORD i = 0; i < m_cELT; i++)
    m_prgELT[i] = elemlist[i];
#endif

/*
 * Note this can be a shallow copy since CEnumXXX maintains a refcount on the "owner"
 * of this class _and_ the "owner" agrees never to free the memory until it _itself_
 * is destroyed. A typical useage will be this
 *
 *  CEnumConnectionPoints *penum = CEnumConnectionPoints::Create(this, m_cCP, elemlist);
  HRESULT hr = penum->QueryInterface(IID_IEnumConnectionPoints, reinterpret_cast<PVOID*>(ppenum));
 *
 * Each time this class returns an interface via QueryInterface it will addref the "owners"
 * lpUnk pointer. There by assuring that the memory passed in is valid for the life of this interface.
 */
  _ASSERT(elemlist);
  m_prgELT = elemlist;
  return true;
}

template<class T , class ELT_T, class IFACE >
HRESULT __stdcall CEnumXXX< T, ELT_T, IFACE >::Next | ( | ULONG | celt,
 |  | ELT_T * | rgelt,
 |  | PULONG | pceltFetched |
 | ) |  |  | [virtual]

Definition at line 150 of file CEnumXXX.cpp.

{
  HRESULT hr;

  if (celt == 0 || (!pceltFetched && celt > 1))
    return E_INVALIDARG;

  CHECKPOINTER(rgelt);

  if (celt > m_cELT - m_iCur)
  {
    celt = m_cELT - m_iCur;
    celt == 0 ? (hr = E_FAIL) : (hr = S_FALSE);
  }
  else
    hr = S_OK;

  DWORD i,j;
  T* pT = static_cast<T*>(this);

  for (j=0, i=m_iCur; j < celt; i++,j++)
  {
    CHECKPOINTER(&rgelt[j]);
    if (!pT->Copy(&rgelt[j], m_prgELT[i])) // the semantics of Copy are entirely determined by the object being enumerated
      return E_FAIL;
  }
  m_iCur = i;
  if (pceltFetched)
    *pceltFetched = j;

  return hr;
}

template<class T , class ELT_T , class IFACE >
HRESULT __stdcall CEnumXXX< T, ELT_T, IFACE >::QueryInterface | ( | REFIID | iid,
 |  | PVOID * | ppv |
 | ) |  |  | [virtual]

Definition at line 91 of file CEnumXXX.cpp.

{
#if defined(_DEBUG)
  LPWSTR lpstrIID;
  StringFromIID(iid, &lpstrIID);
  DEBUGTRACE(_TEXT("CEnumXXX::QueryInterface has been asked for %S"), lpstrIID);
  CoTaskMemFree(lpstrIID);
#endif

  CHECKPOINTER(ppv);

  if (iid == IID_IUnknown || iid == m_iid)
  {
    *ppv = reinterpret_cast<IFACE*>(this);
    static_cast<LPUNKNOWN>(*ppv)->AddRef();
    return S_OK;
  }
  else
  {
    *ppv = NULL;
    return E_NOINTERFACE;
  }
}

template<class T , class ELT_T , class IFACE >
ULONG __stdcall CEnumXXX< T, ELT_T, IFACE >::Release ( ) [virtual]

Definition at line 128 of file CEnumXXX.cpp.

{
  _ASSERT(m_cRef > 0); // not thread safe
  DEBUGTRACE(_T("In CEnumXXX::Release refcounts = %i"), m_cRef-1);

  if (InterlockedDecrement(reinterpret_cast<PLONG>(&m_cRef)) == 0)
  {
    FinalRelease();
    delete this;
    return 0;
  }
  m_lpunk->Release(); // Release strong lock added in by the AddRef()
  return m_cRef;
}

template<class T , class ELT_T , class IFACE >
HRESULT __stdcall CEnumXXX< T, ELT_T, IFACE >::Reset ( void ) [virtual]

Definition at line 201 of file CEnumXXX.cpp.

{
  m_iCur = 0;
  return S_OK;
}

template<class T , class ELT_T , class IFACE >
HRESULT __stdcall CEnumXXX< T, ELT_T, IFACE >::Skip ( ULONG celt ) [virtual]

Definition at line 184 of file CEnumXXX.cpp.

{
  HRESULT hr;
  if (celt + m_iCur > m_cELT)
  {
    m_iCur = m_cELT;
    hr = S_FALSE;
  }
  else
  {
    m_iCur += celt;
    hr = S_OK;
  }
  return hr;
}

Member Data Documentation

template<class T, class ELT_T, class IFACE>
ULONG CEnumXXX< T, ELT_T, IFACE >::m_cELT

Definition at line 28 of file CEnumXXX.h.

template<class T, class ELT_T, class IFACE>
ULONG CEnumXXX< T, ELT_T, IFACE >::m_cRef

Definition at line 26 of file CEnumXXX.h.

template<class T, class ELT_T, class IFACE>
ULONG CEnumXXX< T, ELT_T, IFACE >::m_iCur

Definition at line 27 of file CEnumXXX.h.

template<class T, class ELT_T, class IFACE>
REFIID CEnumXXX< T, ELT_T, IFACE >::m_iid

Definition at line 31 of file CEnumXXX.h.

template<class T, class ELT_T, class IFACE>
LPUNKNOWN CEnumXXX< T, ELT_T, IFACE >::m_lpunk

Definition at line 30 of file CEnumXXX.h.

template<class T, class ELT_T, class IFACE>
ELT_T* CEnumXXX< T, ELT_T, IFACE >::m_prgELT

Definition at line 29 of file CEnumXXX.h.

The documentation for this class was generated from the following files:
  • Com/async/server/CEnumXXX.h
  • Com/async/server/CEnumXXX.cpp
Generated on Wed Nov 13 2024 16:56:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CError Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CError Class Reference

#include "cerror.h"

Inherits CBase.

List of all members.

Public Member Functions

CError (CMainWindow *pCMainwindow)
virtual | ~CError ()
virtual HRESULT | AutoQI (DWORD dwCreateOpts)
virtual HRESULT | AutoRelease ()
virtual HRESULT | GetCustomErrorObject (ULONG ulRecordNum, REFIID riid, IUnknown **ppObject)
virtual REFIID | GetDefaultInterface ()
virtual HRESULT | GetDescription (BSTR *pbstrDescription)
virtual HRESULT | GetErrorInfo (ULONG ulRecordNum, LCID lcid, IErrorInfo **ppErrorInfo)
virtual HRESULT | GetGUID (GUID *pGuid)
virtual HRESULT | GetHelpContext (DWORD *pdwHelpContext)
virtual HRESULT | GetHelpFile (BSTR *pbstrHelpFile)
virtual IUnknown ** | GetInterfaceAddress (REFIID riid)
virtual WCHAR * | GetObjectDesc ()
virtual LONG | GetObjectImage ()
virtual UINT | GetObjectMenu ()
virtual WCHAR * | GetObjectName ()
virtual HRESULT | GetRecordCount (ULONG *pulCount)
virtual HRESULT | GetSource (BSTR *pbstrSource)

Public Attributes

IErrorInfo * | m_pIErrorInfo
IErrorRecords * | m_pIErrorRecords

Detailed Description

Definition at line 25 of file cerror.h.

Constructor & Destructor Documentation

CError::CError ( CMainWindow * pCMainwindow )

Definition at line 22 of file cerror.cpp.

  : CBase(eCError, pCMainWindow, NULL)
{
  //OLE DB Interfaces
  m_pIErrorInfo       = NULL;   //Error interface
  m_pIErrorRecords      = NULL;   //Error interface
}

CError::~CError ( ) [virtual]

Definition at line 34 of file cerror.cpp.

{
  ReleaseObject(0);
}

Member Function Documentation

HRESULT CError::AutoQI ( DWORD dwCreateOpts ) [virtual]

Implements CBase.

Definition at line 73 of file cerror.cpp.

{
  //Delegate First so we have base interfaces
  CBase::AutoQI(dwCreateOpts);

  //[MANDATORY]
  if(dwCreateOpts & CREATE_QI_MANDATORY)
  {
    OBTAIN_INTERFACE(IErrorInfo);
    OBTAIN_INTERFACE(IErrorRecords);
  }

  //[OPTIONAL]
  if(dwCreateOpts & CREATE_QI_OPTIONAL)
  {
  }

  return S_OK;
}

HRESULT CError::AutoRelease ( ) [virtual]

Implements CBase.

Definition at line 58 of file cerror.cpp.

{
  //Error
  RELEASE_INTERFACE(IErrorInfo);
  RELEASE_INTERFACE(IErrorRecords);

  //Delegate
  return CBase::AutoRelease();
}

HRESULT CError::GetCustomErrorObject | ( | ULONG | ulRecordNum,
 |  | REFIID | riid,
 |  | IUnknown ** | ppObject |
 | ) |  |  | [virtual]

Definition at line 235 of file cerror.cpp.

{
  HRESULT hr = S_OK;

  if(m_pIErrorRecords)
  {
    //IErrorRecords::GetCustomErrorObject
    XTEST(hr = m_pIErrorRecords->GetCustomErrorObject(ulRecordNum, riid, ppObject));
    TRACE_METHOD(hr, L"IErrorRecords::GetCustomErrorObject(%lu, %s, &%p)", ulRecordNum, GetInterfaceName(riid), ppObject ? *ppObject : NULL);
  }

  return hr;
}

virtual REFIID CError::GetDefaultInterface ( ) [inline, virtual]

Implements CBase.

Definition at line 41 of file cerror.h.

{ return IID_IErrorInfo;  }

HRESULT CError::GetDescription ( BSTR * pbstrDescription ) [virtual]

Definition at line 115 of file cerror.cpp.

{
  HRESULT hr = S_OK;

  if(m_pIErrorInfo)
  {
    //IErrorInfo::GetDescription
    XTEST(hr = m_pIErrorInfo->GetDescription(pbstrDescription));
    TRACE_METHOD(hr, L"IErrorInfo::GetDescription(&\"%s\")", pbstrDescription ? *pbstrDescription : NULL);
  }

  return hr;
}

HRESULT CError::GetErrorInfo | ( | ULONG | ulRecordNum,
 |  | LCID | lcid,
 |  | IErrorInfo ** | ppErrorInfo |
 | ) |  |  | [virtual]

Definition at line 254 of file cerror.cpp.

{
  HRESULT hr = S_OK;

  if(m_pIErrorRecords)
  {
    //IErrorRecords::GetErrorInfo
    XTEST(hr = m_pIErrorRecords->GetErrorInfo(ulRecordNum, lcid, ppErrorInfo));
    TRACE_METHOD(hr, L"IErrorRecords::GetErrorInfo(%lu, %ld, &%p)", ulRecordNum, lcid, ppErrorInfo ? *ppErrorInfo : NULL);
  }

  return hr;
}

HRESULT CError::GetGUID ( GUID * pGuid ) [virtual]

Definition at line 191 of file cerror.cpp.

{
  HRESULT hr = S_OK;
  WCHAR* pwszProgID = NULL;

  if(m_pIErrorInfo)
  {
    //IErrorInfo::GetGUID
    XTEST(hr = m_pIErrorInfo->GetGUID(pGuid));

    if(pGuid)
      pwszProgID = GetProgID(*pGuid);
    TRACE_METHOD(hr, L"IErrorInfo::GetGuid(&\"%s\")", pwszProgID);
  }

  SAFE_FREE(pwszProgID);
  return hr;
}

HRESULT CError::GetHelpContext ( DWORD * pdwHelpContext ) [virtual]

Definition at line 172 of file cerror.cpp.

{
  HRESULT hr = S_OK;

  if(m_pIErrorInfo)
  {
    //IErrorInfo::GetHelpContext
    XTEST(hr = m_pIErrorInfo->GetHelpContext(pdwHelpContext));
    TRACE_METHOD(hr, L"IErrorInfo::GetHelpContext(&0x%08x)", pdwHelpContext ? *pdwHelpContext : NULL);
  }

  return hr;
}

HRESULT CError::GetHelpFile ( BSTR * pbstrHelpFile ) [virtual]

Definition at line 153 of file cerror.cpp.

{
  HRESULT hr = S_OK;

  if(m_pIErrorInfo)
  {
    //IErrorInfo::GetHelpFile
    XTEST(hr = m_pIErrorInfo->GetHelpFile(pbstrHelpFile));
    TRACE_METHOD(hr, L"IErrorInfo::GetHelpFile(&\"%s\")", pbstrHelpFile ? *pbstrHelpFile : NULL);
  }

  return hr;
}

IUnknown ** CError::GetInterfaceAddress ( REFIID riid ) [virtual]

Implements CBase.

Definition at line 44 of file cerror.cpp.

{
  HANDLE_GETINTERFACE(IErrorInfo);
  HANDLE_GETINTERFACE(IErrorRecords);

  //Otherwise delegate
  return CBase::GetInterfaceAddress(riid);
}

WCHAR * CError::GetObjectDesc ( ) [virtual]

Reimplemented from CBase.

Definition at line 98 of file cerror.cpp.

{
  if(!m_strObjectDesc)
  {
    CComBSTR bstr;
    if(SUCCEEDED(GetDescription(&bstr)) && bstr)
      m_strObjectDesc.CopyFrom(bstr);
  }

  return m_strObjectDesc;
}

virtual LONG CError::GetObjectImage ( ) [inline, virtual]

Implements CBase.

Definition at line 40 of file cerror.h.

{ return IMAGE_ERROR;   }

virtual UINT CError::GetObjectMenu ( ) [inline, virtual]

Implements CBase.

Definition at line 39 of file cerror.h.

{ return IDM_ERRORMENU;   }

virtual WCHAR* CError::GetObjectName ( ) [inline, virtual]

Implements CBase.

Definition at line 38 of file cerror.h.

{ return L"Error Object"; }

HRESULT CError::GetRecordCount ( ULONG * pulCount ) [virtual]

Definition at line 215 of file cerror.cpp.

{
  HRESULT hr = S_OK;

  if(m_pIErrorRecords)
  {
    //IErrorRecords::GetRecordCount
    XTEST(hr = m_pIErrorRecords->GetRecordCount(pulCount));
    TRACE_METHOD(hr, L"IErrorRecords::GetRecordCount(&%d)", pulCount ? *pulCount : NULL);
  }

  return hr;
}

HRESULT CError::GetSource ( BSTR * pbstrSource ) [virtual]

Definition at line 134 of file cerror.cpp.

{
  HRESULT hr = S_OK;

  if(m_pIErrorInfo)
  {
    //IErrorInfo::GetSource
    XTEST(hr = m_pIErrorInfo->GetSource(pbstrSource));
    TRACE_METHOD(hr, L"IErrorInfo::GetSource(&\"%s\")", pbstrSource ? *pbstrSource : NULL);
  }

  return hr;
}

Member Data Documentation

IErrorInfo* CError::m_pIErrorInfo

Definition at line 60 of file cerror.h.

IErrorRecords* CError::m_pIErrorRecords

Definition at line 61 of file cerror.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cerror.h
  • Dataaccess/oledb/rowsetviewer/cerror.cpp
Generated on Wed Nov 13 2024 16:56:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CERTEXITSAMPLELib::CCertExitSample Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • CERTEXITSAMPLELib
  • CERTEXITSAMPLELib::CCertExitSample

CERTEXITSAMPLELib::CCertExitSample Class Reference

import "certxsam.idl";

Detailed Description

Definition at line 35 of file certxsam.idl.

The documentation for this class was generated from the following file:
  • Security/CertServices/Exit/C++/Windows.Net/certxsam.idl
Generated on Wed Nov 13 2024 16:58:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CERTEXITSAMPLELib::CCertManageExitModuleSample Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • CERTEXITSAMPLELib
  • CERTEXITSAMPLELib::CCertManageExitModuleSample

CERTEXITSAMPLELib::CCertManageExitModuleSample Class Reference

import "certxsam.idl";

Detailed Description

Definition at line 44 of file certxsam.idl.

The documentation for this class was generated from the following file:
  • Security/CertServices/Exit/C++/Windows.Net/certxsam.idl
Generated on Wed Nov 13 2024 16:58:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CERTPOLICYSAMPLELib::CCertManagePolicyModuleSample Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • CERTPOLICYSAMPLELib
  • CERTPOLICYSAMPLELib::CCertManagePolicyModuleSample

CERTPOLICYSAMPLELib::CCertManagePolicyModuleSample Class Reference

import "certpsam.idl";

Detailed Description

Definition at line 45 of file certpsam.idl.

The documentation for this class was generated from the following file:
  • Security/CertServices/Policy/C++/Windows.Net/certpsam.idl
Generated on Wed Nov 13 2024 16:58:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CERTPOLICYSAMPLELib::CCertPolicySample Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • CERTPOLICYSAMPLELib
  • CERTPOLICYSAMPLELib::CCertPolicySample

CERTPOLICYSAMPLELib::CCertPolicySample Class Reference

import "certpsam.idl";

Detailed Description

Definition at line 36 of file certpsam.idl.

The documentation for this class was generated from the following file:
  • Security/CertServices/Policy/C++/Windows.Net/certpsam.idl
Generated on Wed Nov 13 2024 16:58:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CEvent Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CEvent Class Reference

#include "CEvent.h"

Inherits AppEvents.

List of all members.

Public Member Functions

CEvent ()
~CEvent ()
DECLARE_UNKNOWN HRESULT __stdcall Beep (short alert)

Public Attributes

DWORD m_cRef

Detailed Description

Definition at line 25 of file CEvent.h.

Constructor & Destructor Documentation

CEvent::CEvent ( ) [inline]

Definition at line 28 of file CEvent.h.

           : m_cRef(0)

CEvent::~CEvent ( ) [inline]

Definition at line 34 of file CEvent.h.

  {

Member Function Documentation

DECLARE_UNKNOWN HRESULT __stdcall CEvent::Beep ( short alert ) [inline]

Implements AppEvents.

Definition at line 41 of file CEvent.h.

  {
    Sleep(1500);
    MessageBeep(alert);

Member Data Documentation

DWORD CEvent::m_cRef

Definition at line 26 of file CEvent.h.

The documentation for this class was generated from the following file:
  • Com/async/client/CEvent.h
Generated on Wed Nov 13 2024 16:56:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CEventSink Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CEventSink Class Reference

#include "EventSink.h"

List of all members.

Public Member Functions

CEventSink (HWND hwnd)
CEventSink ()
~CEventSink ()
STDMETHOD() | Invoke (DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pdispparams, VARIANT *pvarResult, EXCEPINFO *pexcepinfo, UINT *puArgErr)
void | OnClick ()
void | OnMouseOut ()
void | OnMouseOver ()
STDMETHOD_ (SCODE, Indicate)(long lObjectCount

Public Attributes

HWND | m_hwnd
CBehavior * m_pBehavior
BOOL mouseDown

Detailed Description

Definition at line 40 of file people.Cpp.

Constructor & Destructor Documentation

CEventSink::CEventSink ( HWND hwnd ) [inline]

Definition at line 43 of file people.Cpp.

: m_hwnd(hwnd){}

CEventSink::~CEventSink ( ) [inline]

Definition at line 44 of file people.Cpp.

{};

CEventSink::CEventSink ( ) [inline]

Definition at line 26 of file EventSink.h.

               :
    m_pBehavior(NULL),
    mouseDown(FALSE)
  {

  }

Member Function Documentation

STDMETHODIMP CEventSink::Invoke | ( | DISPID | dispidMember,
 |  | REFIID | riid,
 |  | LCID | lcid,
 |  | WORD | wFlags,
 |  | DISPPARAMS * | pdispparams,
 |  | VARIANT * | pvarResult,
 |  | EXCEPINFO * | pexcepinfo,
 |  | UINT * | puArgErr
 | ) |  |

Definition at line 15 of file EventSink.cpp.

{
  long X = NULL;
  long Y = NULL;

  HRESULT hr = NULL;
  IHTMLEventObj* pEvent = NULL;

    switch (dispidMember)
  {
    case DISPID_HTMLDOCUMENTEVENTS_ONMOUSEDOWN:
      // Calculate parameters for ClipCursor
      POINT ptElemOriginLocal, ptElemOriginGlobal;
      IHTMLWindow3* pWin3;
      long winTop, winLeft;
      RECT clipRect;

      ptElemOriginLocal.x = HANDLE_RADIUS;
      ptElemOriginLocal.y = HANDLE_RADIUS;

      m_pBehavior->m_pPaintSite->TransformLocalToGlobal(ptElemOriginLocal, &ptElemOriginGlobal);

      m_pBehavior->m_spWin->QueryInterface(IID_IHTMLWindow3, (void**)&pWin3);
      pWin3->get_screenTop(&winTop);
      pWin3->get_screenLeft(&winLeft);
      pWin3->Release();

      clipRect.top = m_pBehavior->m_rtElemCorners.top + ptElemOriginGlobal.y + winTop;
      clipRect.bottom = m_pBehavior->m_rtElemCorners.bottom + ptElemOriginGlobal.y + winTop;
      clipRect.left = m_pBehavior->m_rtElemCorners.left + ptElemOriginGlobal.x + winLeft;
      clipRect.right = m_pBehavior->m_rtElemCorners.right + ptElemOriginGlobal.x + winLeft;

      // Invoke ClipCursor
      ClipCursor(&clipRect);

      // Prevent selection on this element
      m_pBehavior->m_spSel->empty();
      OnClick();
      break;

    case DISPID_HTMLDOCUMENTEVENTS2_ONMOUSEUP:
      // Prevent selection on this element
      m_pBehavior->m_spSel->empty();
      mouseDown = FALSE;

      // Free mouse cursor to move anywhere on screen
      ClipCursor(NULL);

      m_pBehavior->m_lPartID = -1;
      m_pBehavior->m_pPaintSite->InvalidateRect(NULL);
      break;

    case DISPID_HTMLDOCUMENTEVENTS2_ONMOUSEMOVE:
      // Prevent selection on this element
      m_pBehavior->m_spSel->empty();

      // If mouse button is not down, don't do anything
      if (mouseDown != TRUE) break;

      // Otherwise, recalculate position of the handle being moved and redraw
      hr = m_pBehavior->GetEventObject(&pEvent);

      // Obtain X & Y
      hr = pEvent->get_offsetY(&Y);
      hr = pEvent->get_offsetX(&X);

      m_pBehavior->m_ptPolyCorners[m_pBehavior->m_lPartID].x = X;
      m_pBehavior->m_ptPolyCorners[m_pBehavior->m_lPartID].y = Y;

      m_pBehavior->m_pPaintSite->InvalidateRect(NULL);
      pEvent->Release();

      break;

    default:
      break;
    }

    return S_OK;
}

void CEventSink::OnClick ( )

Definition at line 105 of file EventSink.cpp.

{
  if (!m_pBehavior) return;

  HRESULT hr = NULL;
  IHTMLEventObj* pEvent = NULL;

  long X = NULL;
  long Y = NULL;

  hr = m_pBehavior->GetEventObject(&pEvent);

  // Obtain X & Y
  hr = pEvent->get_offsetY(&Y);
  hr = pEvent->get_offsetX(&X);

  POINT mousePoint;
  mousePoint.x = X;
  mousePoint.y = Y;

  m_pBehavior->m_lPartID = -1;

  for (int i = 0; i < 4; i++)
  {
    if (m_pBehavior->Distance(mousePoint, m_pBehavior->m_ptPolyCorners[i]) <= HANDLE_RADIUS)
    {
      m_pBehavior->m_lPartID = i;
      m_pBehavior->m_pPaintSite->InvalidateRect(NULL);
      mouseDown = TRUE;
    }
  }

  pEvent->Release();
}

void CEventSink::OnMouseOut ( )
void CEventSink::OnMouseOver ( )
CEventSink::STDMETHOD_ | ( | SCODE | ,
 |  | Indicate |
 | ) |  |

Member Data Documentation

HWND CEventSink::m_hwnd

Definition at line 100 of file people.Cpp.

CBehavior* CEventSink::m_pBehavior

Definition at line 23 of file EventSink.h.

BOOL CEventSink::mouseDown

Definition at line 24 of file EventSink.h.

The documentation for this class was generated from the following files:
  • SysMgmt/MMC/WMI/people.Cpp
  • Web/Browser/RenderBehave/renderproject/EventSink.h
  • Web/Browser/RenderBehave/renderproject/EventSink.cpp
Generated on Wed Nov 13 2024 16:56:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CEvtStoreSub Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CEvtStoreSub Class Reference

#include "evtstoresub.h"

Inherits CSysLCESub.

List of all members.

Public Member Functions

CEvtStoreSub (CComSpy *pSpy)
CEvtStoreSub ()
STDMETHODIMP | GetEventClass (LPGUID guid)
STDMETHODIMP | GetEventType (EventEnum *e)
STDMETHODIMP | GetInterface (IID *iid)

Public Attributes

EOC_ChangeType BSTR | bstrEventClassID
CComSpy BSTR | bstrEventClassID
EOC_ChangeType BSTR | bstrPublisherID
CComSpy BSTR | bstrPublisherID
EOC_ChangeType BSTR | bstrSubscriptionID
CComSpy BSTR | bstrSubscriptionID
EOC_ChangeType | changeType
CComSpy * pSpy

Detailed Description

Definition at line 32 of file evtstoresub.h.

Constructor & Destructor Documentation

CEvtStoreSub::CEvtStoreSub ( CComSpy * pSpy ) [inline]

Definition at line 37 of file evtstoresub.h.

  {
    m_pSpy = pSpy;
  }

CEvtStoreSub::CEvtStoreSub ( ) [inline]

Definition at line 42 of file evtstoresub.h.

  {
    m_pSpy = NULL;
  }

Member Function Documentation

STDMETHODIMP CEvtStoreSub::GetEventClass ( LPGUID guid ) [inline, virtual]

Implements CSysLCESub.

Definition at line 57 of file evtstoresub.h.

{*guid = CLSID_EventObjectChange;return S_OK;}

STDMETHODIMP CEvtStoreSub::GetEventType ( EventEnum * e ) [inline, virtual]

Implements CSysLCESub.

Definition at line 56 of file evtstoresub.h.

{*e = EventStore;return S_OK;}

STDMETHODIMP CEvtStoreSub::GetInterface ( IID * iid ) [inline, virtual]

Implements CSysLCESub.

Definition at line 58 of file evtstoresub.h.

{*iid = IID_IEventObjectChange;return S_OK;}

Member Data Documentation

EOC_ChangeType BSTR CEvtStoreSub::bstrEventClassID

Definition at line 66 of file evtstoresub.h.

CComSpy BSTR CEvtStoreSub::bstrEventClassID

Definition at line 79 of file evtstoresub.h.

EOC_ChangeType BSTR CEvtStoreSub::bstrPublisherID

Definition at line 70 of file evtstoresub.h.

CComSpy BSTR CEvtStoreSub::bstrPublisherID

Definition at line 83 of file evtstoresub.h.

EOC_ChangeType BSTR CEvtStoreSub::bstrSubscriptionID

Definition at line 62 of file evtstoresub.h.

CComSpy BSTR CEvtStoreSub::bstrSubscriptionID

Definition at line 75 of file evtstoresub.h.

EOC_ChangeType CEvtStoreSub::changeType

Definition at line 62 of file evtstoresub.h.

CComSpy * CEvtStoreSub::pSpy

Definition at line 75 of file evtstoresub.h.

The documentation for this class was generated from the following file:
  • Com/Administration/Spy/ComSpyCtl/evtstoresub.h
Generated on Wed Nov 13 2024 16:56:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CException Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CException Class Reference

#include "Except.Hxx"

List of all members.

Public Member Functions

CException (long lError)
long | GetErrorCode ()
unsigned long | GetInfo (void) const
void | SetInfo (unsigned dbgInfo)

Protected Attributes

unsigned long | _dbgInfo
long | _lError

Detailed Description

Definition at line 23 of file Except.Hxx.

Constructor & Destructor Documentation

CException::CException ( long lError ) [inline]

Definition at line 26 of file Except.Hxx.

: _lError(lError), _dbgInfo(0) {}

Member Function Documentation

long CException::GetErrorCode ( ) [inline]

Definition at line 27 of file Except.Hxx.

{ return _lError;}

unsigned long CException::GetInfo ( void ) const [inline]

Definition at line 29 of file Except.Hxx.

{ return _dbgInfo; }

void CException::SetInfo ( unsigned dbgInfo ) [inline]

Definition at line 28 of file Except.Hxx.

{ _dbgInfo = dbgInfo; }

Member Data Documentation

unsigned long CException::_dbgInfo [protected]

Definition at line 34 of file Except.Hxx.

long CException::_lError [protected]

Definition at line 33 of file Except.Hxx.

The documentation for this class was generated from the following file:
  • WinBase/Indexing/IFilter/Except.Hxx
Generated on Wed Nov 13 2024 16:56:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CExceptionSub Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CExceptionSub Class Reference

#include "exceptionsub.h"

Inherits CSysLCESub.

List of all members.

Public Member Functions

CExceptionSub (CComSpy *pSpy)
CExceptionSub ()
STDMETHODIMP | GetEventClass (LPGUID guid)
STDMETHODIMP | GetEventType (EventEnum *e)
STDMETHODIMP | GetInterface (IID *iid)
STDMETHODIMP | OnExceptionUser (COMSVCSEVENTINFO *pInfo, ULONG code, ULONG64 addr, LPCOLESTR pszStackTrace)

Detailed Description

Definition at line 30 of file exceptionsub.h.

Constructor & Destructor Documentation

CExceptionSub::CExceptionSub ( CComSpy * pSpy ) [inline]

Definition at line 35 of file exceptionsub.h.

  {
    m_pSpy = pSpy;
  }

CExceptionSub::CExceptionSub ( ) [inline]

Definition at line 40 of file exceptionsub.h.

  {
    m_pSpy = NULL;
  }

Member Function Documentation

STDMETHODIMP CExceptionSub::GetEventClass ( LPGUID guid ) [inline, virtual]

Implements CSysLCESub.

Definition at line 54 of file exceptionsub.h.

{*guid = CLSID_ComServiceEvents;return S_OK;}

STDMETHODIMP CExceptionSub::GetEventType ( EventEnum * e ) [inline, virtual]

Implements CSysLCESub.

Definition at line 53 of file exceptionsub.h.

{*e = Exception;return S_OK;}

STDMETHODIMP CExceptionSub::GetInterface ( IID * iid ) [inline, virtual]

Implements CSysLCESub.

Definition at line 55 of file exceptionsub.h.

{*iid = IID_IComExceptionEvents;return S_OK;}

STDMETHODIMP CExceptionSub::OnExceptionUser | ( | COMSVCSEVENTINFO * | pInfo,
 |  | ULONG | code,
 |  | ULONG64 | addr,
 |  | LPCOLESTR | pszStackTrace |
 | ) |  |  | [inline]

Definition at line 57 of file exceptionsub.h.

  {
    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnExceptionUser"), GuidToBstr(pInfo->guidApp));

    WCHAR szCode[16];
    wsprintfW(szCode, L"0x%08X", code);
    m_pSpy -> AddParamValueToList(L"code", szCode);

    WCHAR szAddress[32];
    wsprintfW(szAddress, L"0x%016X", addr);
    m_pSpy -> AddParamValueToList(L"Address", szAddress);

    m_pSpy -> AddParamValueToList(L"StackTrace", pszStackTrace);
    return S_OK;

    IF_AUDIT_DO(OnExceptionUser)(pInfo->perfCount,GuidToBstr(pInfo->guidApp),
                    szCode,
                    szAddress,
                    pszStackTrace
                    );
  }

The documentation for this class was generated from the following file:
  • Com/Administration/Spy/ComSpyCtl/exceptionsub.h
Generated on Wed Nov 13 2024 16:56:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CExecuteParamDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CExecuteParamDlg Class Reference

#include "cdialog.h"

Inherits CDialogLite, and CRowsetViewerDlg.

List of all members.

Public Member Functions

CExecuteParamDlg (CMDIChild *pCMDIChild)
CListViewLite * GetActiveParam ()
CListViewLite * GetActiveValue ()
virtual BOOL | OnAddParameter ()
virtual BOOL | OnAddSet (INDEX iParamSet, BOOL fUseDefaults=TRUE)
virtual BOOL | OnCancel ()
virtual BOOL | OnCommand (UINT iID, HWND hWndCtrl)
virtual BOOL | OnContextMenu (HWND hWnd, REFPOINTS pts)
virtual BOOL | OnDelParameter ()
virtual BOOL | OnDelSet (INDEX iParamSet)
virtual BOOL | OnInitDialog ()
virtual BOOL | OnNotify (INT idCtrl, NMHDR *pNMHDR)
virtual BOOL | OnOK ()
virtual BOOL | OnStatusChange (DBSTATUS dbStatus)

Protected Attributes

CTabLite m_tabParamSets
CVector< CListViewLite
*, ULONG_PTR > 		m_vecParams
CVector< CListViewLite
*, ULONG_PTR > 		m_vecValues

Detailed Description

Definition at line 842 of file cdialog.h.

Constructor & Destructor Documentation

CExecuteParamDlg::CExecuteParamDlg ( CMDIChild * pCMDIChild )

Definition at line 6298 of file cdialog.cpp.

  : CDialogLite(IDD_PARAMEXECUTE), CRowsetViewerDlg(NULL, pCMDIChild)
{
}

Member Function Documentation

CListViewLite * CExecuteParamDlg::GetActiveParam ( )

Definition at line 6715 of file cdialog.cpp.

{
  //Obtain the active tab
  INDEX iParamSet = m_tabParamSets.GetCurSel();
  if(iParamSet == LVM_ERR)
    return NULL;

  //Return the active listview
  return m_vecParams[iParamSet];
}

CListViewLite * CExecuteParamDlg::GetActiveValue ( )

Definition at line 6731 of file cdialog.cpp.

{
  //Obtain the active tab
  INDEX iParamSet = m_tabParamSets.GetCurSel();
  if(iParamSet == LVM_ERR)
    return NULL;

  //Return the active listview
  return m_vecValues[iParamSet];
}

BOOL CExecuteParamDlg::OnAddParameter ( ) [virtual]

Definition at line 6520 of file cdialog.cpp.

{
  WCHAR wszBuffer[MAX_NAME_LEN];

  //Loop over all paramsets...
  for(INDEX iParamSet=0; iParamSet<m_tabParamSets.GetItemCount(); iParamSet++)
  {
    //Make our lives easier
    CListViewLite* plistParams = m_vecParams[iParamSet];
    CListViewLite* plistValues = m_vecValues[iParamSet];

    //Get the Total Number of ListView Items
    INDEX cItems = plistParams->GetItemCount();
    if(cItems != LVM_ERR)
    {
      //Insert a new Parameter
      StringFormat(wszBuffer, NUMELE(wszBuffer), L"Parameter %lu", cItems+1);
      plistParams->InsertItem(cItems, 0,  wszBuffer);
      plistParams->InsertItem(cItems, 1,  L"0");
      plistParams->InsertItem(cItems, 2,  L"DBSTATUS_S_OK");
      plistValues->InsertItem(cItems, 0,  L"Enter Parameter Value...");

      //Set Item State to Checked/Unchecked
      plistParams->SetItemState(cItems, 0,  INDEXTOSTATEIMAGEMASK(STATE_CHECKED),  LVIS_STATEIMAGEMASK);
    }
  }

  return TRUE;
}

BOOL CExecuteParamDlg::OnAddSet | ( | INDEX | iParamSet,
 |  | BOOL | fUseDefaults = TRUE |
 | ) |  |  | [virtual]

Definition at line 6581 of file cdialog.cpp.

{
  //Add the new Tab
  WCHAR wszBuffer[MAX_NAME_LEN];
  StringFormat(wszBuffer, NUMELE(wszBuffer), L"ParamSet %lu", iParamSet+1);
  m_tabParamSets.InsertItem(iParamSet, wszBuffer);

  //Obtain the bounding rectangle
  //NOTE: We have to do this AFTER we insert the tab so that it includes
  //the vertical size of the tab, otherwise we will end up using the space
  //needed by the later inserted tab...
  RECT rect;
  GetClientRect(m_tabParamSets.m_hWnd, &rect);
  m_tabParamSets.AdjustRect(&rect);
  int  cxInside   = rect.right - rect.left;
  int  cyInside   = rect.bottom - rect.top;

  //Create the Params ListView (dynamically...)
  CListViewLite* plistParams = new CListViewLite;
  plistParams->Create(m_tabParamSets.m_hWnd, WC_LISTVIEWW, NULL, IDL_PARAMNAMES,
                WS_TABSTOP | WS_CHILD | /*WS_VISIBLE |*/ WS_BORDER | WS_VSCROLL | /*LVS_SINGLESEL |*/ LVS_AUTOARRANGE | LVS_REPORT | LVS_EDITLABELS | LVS_SHOWSELALWAYS, WS_EX_CLIENTEDGE,
                rect.left, rect.top, cxInside/2, cyInside);
  m_vecParams.AddElement(plistParams);

  //Create the Values ListView (dynamically...)
  CListViewLite* plistValues = new CListViewLite;
  plistValues->Create(m_tabParamSets.m_hWnd, WC_LISTVIEWW, NULL, IDL_PARAMVALUES,
                WS_TABSTOP | WS_CHILD | /*WS_VISIBLE |*/ WS_BORDER | WS_VSCROLL | /*LVS_SINGLESEL |*/ LVS_AUTOARRANGE | LVS_REPORT | LVS_EDITLABELS | LVS_SHOWSELALWAYS, WS_EX_CLIENTEDGE,
                rect.left + cxInside/2, rect.top, cxInside - cxInside/2, cyInside);
  m_vecValues.AddElement(plistValues);

  //Use Extended ListView Styles!
  SendMessage(plistParams->m_hWnd, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE | LVS_EX_CHECKBOXES, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE | LVS_EX_CHECKBOXES);
  SendMessage(plistValues->m_hWnd, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE);

  //Set image list to the Window
  ListView_SetImageList(plistParams->m_hWnd, ImageList_LoadImage(GetAppLite()->m_hInstance, MAKEINTRESOURCE(IDB_STATE), 16, 16, CLR_DEFAULT , IMAGE_BITMAP, LR_DEFAULTCOLOR), LVSIL_STATE);
  ListView_SetImageList(plistValues->m_hWnd, ImageList_LoadImage(GetAppLite()->m_hInstance, MAKEINTRESOURCE(IDB_IMAGE), 16, 16, CLR_DEFAULT , IMAGE_BITMAP, LR_DEFAULTCOLOR), LVSIL_SMALL);

  //We need to the ListView
  //Headers/Columns contain ColInfo information
  //Rows are per columns
  plistParams->InsertColumn(0,  L"Parameter");
  plistParams->InsertColumn(1,  L"Length");
  plistParams->InsertColumn(2,  L"Status");
  plistValues->InsertColumn(0,  L"Value");

  //This new set needs to have the same number of parameters as the first set...
  if(fUseDefaults)
  {
    INDEX cParams = max(m_vecParams[0]->GetItemCount(), 1);
    for(INDEX iParam=0; iParam<cParams; iParam++)
    {
      //Parameters
      StringFormat(wszBuffer, NUMELE(wszBuffer), L"Parameter %lu", iParam+1);
      plistParams->InsertItem(iParam, 0,  wszBuffer);
      plistParams->InsertItem(iParam, 1,  L"0");
      plistParams->InsertItem(iParam, 2,  L"DBSTATUS_S_OK");
      plistValues->InsertItem(iParam, 0,  L"Enter Parameter Value...");
    }
  }

  //AutoSize column
  plistParams->SetColumnWidth(0,  LVSCW_AUTOSIZE_USEHEADER);
  plistParams->SetColumnWidth(1,  LVSCW_AUTOSIZE_USEHEADER);
  plistParams->SetColumnWidth(2,  LVSCW_AUTOSIZE_USEHEADER);
  plistValues->SetColumnWidth(0,  LVSCW_AUTOSIZE_USEHEADER);

  //Now select this new tab
  m_tabParamSets.SetCurSel(iParamSet, TRUE/*fSendNotification*/);
  return TRUE;
}

BOOL CExecuteParamDlg::OnCancel ( ) [virtual]

Definition at line 6502 of file cdialog.cpp.

{
  //Remove all the sets...
  //NOTE: Since were actually removing the tab, the indexes compact, so
  //we only need to keep removing the first tab...
  INDEX cParamSets = m_tabParamSets.GetItemCount();
  for(INDEX i=0; i<cParamSets; i++)
    OnDelSet(0);

  //Delegate
  return CDialogLite::OnCancel();
}

BOOL CExecuteParamDlg::OnCommand | ( | UINT | iID,
 |  | HWND | hWndCtrl |
 | ) |  |  | [virtual]

Definition at line 6781 of file cdialog.cpp.

{
  switch(iID)
  {
    ON_COMMAND(IDB_ADD,         OnAddParameter())
    ON_COMMAND(IDB_DELETE,        OnDelParameter())

    //WThe user always adds at the end..
    ON_COMMAND(IDB_ADDSET,        OnAddSet(m_tabParamSets.GetItemCount()))

    //NOTE: We don't allow the user to delete the first (default) set...
    ON_COMMAND(IDB_DELETESET,     m_tabParamSets.GetItemCount()>1 ? OnDelSet(m_tabParamSets.GetItemCount()-1) : FALSE)

    ON_COMMAND(IDM_DBSTATUS_S_OK,   OnStatusChange(DBSTATUS_S_OK))
    ON_COMMAND(IDM_DBSTATUS_S_ISNULL, OnStatusChange(DBSTATUS_S_ISNULL))
    ON_COMMAND(IDM_DBSTATUS_S_DEFAULT,  OnStatusChange(DBSTATUS_S_DEFAULT))
    ON_COMMAND(IDM_DBSTATUS_S_IGNORE, OnStatusChange(DBSTATUS_S_IGNORE))
  };

  return FALSE;
}

BOOL CExecuteParamDlg::OnContextMenu | ( | HWND | hWnd,
 |  | REFPOINTS | pts |
 | ) |  |  | [virtual]

Definition at line 6747 of file cdialog.cpp.

{
  //Obtain the active ListView
  CListViewLite* plistParams = GetActiveParam();
  if(plistParams)
  {
    //Must have selected a row to change status
    INDEX iSel = plistParams->GetNextItem(-1, LVNI_SELECTED);
    if(iSel == LVM_ERR)
      return FALSE;

    //Make sure the Param listview is being selected.
    //NOTE: the hWnd of the control is the tab window, so we have to use
    //the hittest to correctly determine which child...
    //NOTE: ContextMenu is in Screen Coordinates
    if(plistParams->HitTest(pts, NULL, FALSE/*fClientCoords*/) != LVM_ERR)
    {
      //Display Menu
      DisplayContextMenu(
                m_hWnd,
                IDM_CHANGESTATUS,
                pts,
                m_hWnd
                );
    }
  }
  return TRUE;
}

BOOL CExecuteParamDlg::OnDelParameter ( ) [virtual]

Definition at line 6555 of file cdialog.cpp.

{
  //Loop over all paramsets...
  for(INDEX iParamSet=0; iParamSet<m_tabParamSets.GetItemCount(); iParamSet++)
  {
    //Make our lives easier
    CListViewLite* plistParams = m_vecParams[iParamSet];
    CListViewLite* plistValues = m_vecValues[iParamSet];

    //Get the Total Number of ListView Items
    INDEX cItems = plistParams->GetItemCount();
    if(cItems != LVM_ERR)
    {
      //Delete the Last Item
      plistParams->DeleteItem(cItems-1);
      plistValues->DeleteItem(cItems-1);
    }
  }
  return TRUE;
}

BOOL CExecuteParamDlg::OnDelSet ( INDEX iParamSet ) [virtual]

Definition at line 6659 of file cdialog.cpp.

{
  INDEX cTabs = m_tabParamSets.GetItemCount();
  INDEX iNextTab = iParamSet<(cTabs-1) ? iParamSet+1 : max(0, iParamSet-1);

  //Display the next tab (before deleting the previous selection)
  //ie: SelChanging needs to inform its going away...
  m_tabParamSets.SetCurSel(iNextTab, TRUE/*fSendNotification*/);

  //Delete the Tab
  m_tabParamSets.DeleteItem(iParamSet);

  //Now delete the dynamic listviews
  CListViewLite* plistParams = m_vecParams[iParamSet];
  plistParams->OnDestroy();
  SAFE_DELETE(plistParams);

  //Now delete the dynamic listviews
  CListViewLite* plistValues = m_vecValues[iParamSet];
  plistValues->OnDestroy();
  SAFE_DELETE(plistValues);

  //Now remove the listview from the vectors
  m_vecParams.RemoveAt(iParamSet);
  m_vecValues.RemoveAt(iParamSet);

  //Refresh the tabs...
  m_tabParamSets.SetCurSel(m_tabParamSets.GetCurSel(), TRUE/*fSendNotification*/);
  return TRUE;
}

BOOL CExecuteParamDlg::OnInitDialog ( ) [virtual]

Definition at line 6308 of file cdialog.cpp.

{
  CWaitCursor waitCursor;
  WCHAR   wszBuffer[MAX_COL_SIZE];

  //Command
  CCommand* pCCommand = SOURCE_GETOBJECT(m_pCMDIChild->m_pCSource, CCommand);
  CParameters& rParameters  = pCCommand->m_Parameters;
  CBindings&  rBindings   = rParameters.GetBindings();
  DB_UPARAMS cParamSets   = max(rParameters.GetParams().cParamSets, 1);
  DWORD dwConvFlags     = GetOptions()->m_dwConvFlags;

  //Tab Control
  m_tabParamSets.CreateIndirect(m_hWnd, IDP_TABS);

  //Add all the Tabs
  ASSERT(m_vecParams.GetCount() == 0);
  ASSERT(m_vecValues.GetCount() == 0);
  for(ULONG iParamSet=0; iParamSet<cParamSets; iParamSet++)
  {
    //Add the tab
    OnAddSet(iParamSet, rBindings.GetCount()==0/*fUseDefaults*/);
    CListViewLite* plistParams = m_vecParams[iParamSet];
    CListViewLite* plistValues = m_vecValues[iParamSet];

    //Now add the previously setup data (if any)
    DBLENGTH  dbLength = 0;
    DBSTATUS  dbStatus = DBSTATUS_S_OK;

    //Display the data for this paramset...
    for(ULONG i=0; i<rBindings.GetCount(); i++)
    {
      const DBBINDING* pBinding = &rBindings[i];

      //Value
      //Get the Length, Status, Data for this Column
      pCCommand->GetColumnData(pBinding, rParameters.GetData(iParamSet), &dbStatus, &dbLength, NULL, wszBuffer, MAX_COL_SIZE, dwConvFlags, pBinding->wType);

      //Insert the Data into the list (make an "easy" edit)
      plistValues->InsertItem(i, 0, wszBuffer, (LPARAM)pBinding->wType, 0);

      //Insert Parameter Name
      StringFormat(wszBuffer, NUMELE(wszBuffer), L"Parameter %lu", i+1);
      plistParams->InsertItem(i, 0, wszBuffer);

      //Insert the Length into the List
      if(LENGTH_IS_BOUND(*pBinding))
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"%lu", dbLength);
      else
        StringCopy(wszBuffer, L"Not Bound", MAX_COL_SIZE);
      plistParams->InsertItem(i, 1, wszBuffer);

      //Insert the Status into the List
      plistParams->InsertItem(i, 2, STATUS_IS_BOUND(*pBinding) ? GetStatusName(dbStatus) : L"Not Bound");

      //Set Item State to Checked/Unchecked
      plistParams->SetItemState(i, 0,  INDEXTOSTATEIMAGEMASK(STATE_CHECKED),  LVIS_STATEIMAGEMASK);
    }

    //AutoSize column (now that the data is inserted)
    plistParams->SetColumnWidth(0,  LVSCW_AUTOSIZE_USEHEADER);
    plistParams->SetColumnWidth(1,  LVSCW_AUTOSIZE_USEHEADER);
    plistParams->SetColumnWidth(2,  LVSCW_AUTOSIZE_USEHEADER);
    plistValues->SetColumnWidth(0,  LVSCW_AUTOSIZE_USEHEADER);
  }

  //Now activate the default Parameter Set
  m_tabParamSets.SetCurSel(0, TRUE/*fSendNotification*/);
  CenterDialog(m_hWnd);
  return CDialogLite::OnInitDialog();
}

BOOL CExecuteParamDlg::OnNotify | ( | INT | idCtrl,
 |  | NMHDR * | pNMHDR |
 | ) |  |  | [virtual]

Definition at line 6808 of file cdialog.cpp.

{
  switch(pNMHDR->code)
  {
    case TCN_SELCHANGE:
    {
      if(pNMHDR->idFrom == IDP_TABS)
      {
        //Obtain the active listview
        CListViewLite* plistParams = GetActiveParam();
        CListViewLite* plistValues = GetActiveValue();

        //Show the new active listviews
        if(plistParams && plistValues)
        {
          plistParams->ShowWindow(SW_SHOW);
          plistParams->UpdateWindow();
          plistValues->ShowWindow(SW_SHOW);
          plistValues->UpdateWindow();
        }
        return TRUE;
      }

      return FALSE;
    }

    case TCN_SELCHANGING:
    {
      if(pNMHDR->idFrom == IDP_TABS)
      {
        //Obtain the active listview
        CListViewLite* plistParams = GetActiveParam();
        CListViewLite* plistValues = GetActiveValue();

        //Hide the old listviews
        if(plistParams && plistValues)
        {
          plistParams->ShowWindow(SW_HIDE);
          plistValues->ShowWindow(SW_HIDE);
        }
        return TRUE;
      }

      return FALSE;
    }

    //Since we have "TwoClickActive" on this will get sent
    //Whenever a row is clicked on twice!
    //This functionality used to be done with NM_DBCLK
    case LVN_ITEMACTIVATE:
    {
      //Obtain the active listview
      CListViewLite* plistValues = GetActiveValue();
      if(plistValues)
      {
        //Obtain the SelectedRow
        INDEX iSel = plistValues->GetNextItem(-1, LVNI_SELECTED);
        if(iSel == LVM_ERR)
          return FALSE;

        //Now edit this label
        plistValues->EditLabel(iSel);
      }
      return TRUE;
    }

    case LVN_BEGINLABELEDIT:
      return FALSE;//allow the user to change the value of the item.

    case LVN_ENDLABELEDIT:
    {
      LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;

      //Obtain the active listview
      CListViewLite* plistValues = GetActiveValue();
      if(plistValues)
      {
        //Now update the ListView with the new value
        if(pDispInfo->item.pszText)
        {

          WCHAR wszBuffer[MAX_NAME_LEN]={0};
          ConvertToWCHAR(pDispInfo->item.pszText, wszBuffer, MAX_NAME_LEN);
          plistValues->SetItemText(pDispInfo->item.iItem, 0, wszBuffer);
        }
      }
      return TRUE; //Allow the edited change
    }

    case LVN_ITEMCHANGED:
    {
      NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;

      if(pNMListView->uNewState & LVNI_FOCUSED &&
        pNMListView->uNewState & LVNI_SELECTED)
      {
        //Obtain the active listview
        CListViewLite* plistParams = GetActiveParam();
        CListViewLite* plistValues = GetActiveValue();
        if(plistParams && plistValues)
        {
          if(idCtrl == IDL_PARAMVALUES)
          {
            SyncSibling(plistParams->m_hWnd, plistValues->m_hWnd);
                  return TRUE;
          }

          if(idCtrl == IDL_PARAMNAMES)
          {
            SyncSibling(plistValues->m_hWnd, plistParams->m_hWnd);
            return TRUE;
          }
        }
        return FALSE;
      }
    }
  }

  return FALSE;
}

BOOL CExecuteParamDlg::OnOK ( ) [virtual]

Definition at line 6385 of file cdialog.cpp.

{
  CWaitCursor waitCursor;

  //Get the "this" pointer
  CCommand* pCCommand = SOURCE_GETOBJECT(m_pCMDIChild->m_pCSource, CCommand);
  CParameters& rParameters = pCCommand->m_Parameters;
  HRESULT hr = S_OK;

  //Setup ParamInfo
  DBPARAMINFO* rgParamInfo = NULL;
  DB_UPARAMS cParamsProv = 0;
  DBPARAMINFO* rgParamInfoProv = NULL;
  WCHAR* pwszNamesBuffer = NULL;
  WCHAR* pwszCommandText = NULL;

  ULONG iParam,iParamSet = 0;
  DB_UPARAMS cParams = 0;
  DB_UPARAMS cParamSets = m_tabParamSets.GetItemCount();

  //SetCommandText
  BOOL fSetCommandText = ::IsDlgButtonChecked(m_hWndParent, IDB_SETCOMMANDTEXT);
  BOOL fSetCommandStream = ::IsDlgButtonChecked(m_hWndParent, IDB_SETCOMMANDSTREAM);

  //Obtain the number of parameters (Items) in the list
  //NOTE: Since all the sets have the same number of parameters, and we are
  //guareenteed at least one set, we only need to check the first set...
  cParams = m_vecParams[0]->GetItemCount();
  cParams = cParams == LVM_ERR ? 0 : cParams;

  //Default ParameterInfo
  //NOTE: Some providers cannot derive parameter information
  //or the user may have only setup param info for some parameters, so by default
  //create parameter info for all params bound as INPUT and WSTR (or binding type).
  SAFE_ALLOC(rgParamInfo, DBPARAMINFO, cParams);
  for(iParam=0; iParam<cParams; iParam++)
  {
    //Setup the ParamInfo
    rgParamInfo[iParam].iOrdinal  = iParam+1;
    rgParamInfo[iParam].dwFlags   = DBPARAMFLAGS_ISINPUT;
    rgParamInfo[iParam].pwszName  = NULL;
    rgParamInfo[iParam].ulParamSize = MAX_COL_SIZE;
    rgParamInfo[iParam].pTypeInfo = NULL;
    rgParamInfo[iParam].wType   = GetOptions()->GetBindingType(DBTYPE_WSTR);
    rgParamInfo[iParam].bPrecision  = 0;
    rgParamInfo[iParam].bScale    = 0;
  }

  //Did the user indicate they wanted to set the command text...
  if(fSetCommandText || fSetCommandStream)
  {
    //SetCommandText
    pwszCommandText = m_pCMDIChild->m_pCQueryBox->GetSelectedText();
    if(fSetCommandText)
      hr = pCCommand->SetCommandText(pwszCommandText);
    else
      hr = pCCommand->SetCommandStream(pwszCommandText);

    //Prepare - we have to prepare for GetParameterInfo
    hr = pCCommand->Prepare(0);
  }

  //Try to obtain more info about the params (native type for bindings)
  if(SUCCEEDED(hr = pCCommand->GetParameterInfo(&cParamsProv, &rgParamInfoProv, &pwszNamesBuffer)))
  {
    //Loop over the info returned from the provider
    for(ULONG iParam=0; iParam<cParamsProv; iParam++)
    {
      DBPARAMINFO* pParamInfo = &rgParamInfoProv[iParam];

      //Update our default ParamInfo...
      if(pParamInfo->iOrdinal && pParamInfo->iOrdinal <= cParams)
      {
        //NOTE: Some providers seem not to be able to determine
        //if the parameter is input or output, and do not return any flags.
        //This will fail accessor creation, unless some flag is set, so turn
        //on INPUT if none of the directional flags are on...
        if(!BIT_SET(pParamInfo->dwFlags, DBPARAMFLAGS_ISINPUT) && !BIT_SET(pParamInfo->dwFlags, DBPARAMFLAGS_ISOUTPUT))
          pParamInfo->dwFlags |= DBPARAMFLAGS_ISINPUT;

        ASSERT(rgParamInfo[pParamInfo->iOrdinal-1].iOrdinal == pParamInfo->iOrdinal);
        memcpy(&rgParamInfo[pParamInfo->iOrdinal-1], pParamInfo, sizeof(DBPARAMINFO));
      }
    }
  }

  //Create Parameter Accessor
  TESTC(hr = pCCommand->CreateParamAccessor(cParams, rgParamInfo, cParamSets));

  //Setup Data Buffer
  //Loop through all the parameter sets
  for(iParamSet=0; iParamSet<cParamSets; iParamSet++)
    TESTC(hr = m_pCMDIChild->GetListViewValues(m_vecParams[iParamSet]->m_hWnd, m_vecValues[iParamSet]->m_hWnd, pCCommand, rParameters.GetBindings(), rParameters.GetData(iParamSet)));

CLEANUP:
  SAFE_FREE(rgParamInfo);
  SAFE_FREE(rgParamInfoProv);
  SAFE_FREE(pwszNamesBuffer);
  SAFE_FREE(pwszCommandText);

  //Don't exit if we can't successfully create a parameter from the data entered...
  if(FAILED(hr))
    return FALSE;

  //Remove all the sets...
  //NOTE: Since were actually removing the tab, the indexes compact, so
  //we only need to keep removing the first tab...
  for(iParamSet=0; iParamSet<cParamSets; iParamSet++)
    OnDelSet(0);
  return CDialogLite::OnOK();
}

BOOL CExecuteParamDlg::OnStatusChange ( DBSTATUS dbStatus ) [virtual]

Definition at line 6695 of file cdialog.cpp.

{
  CListViewLite* plistParams = GetActiveParam();
  if(plistParams)
  {
    //Insert the Status into the List
    INDEX iSelRow = plistParams->GetNextItem(-1, LVNI_SELECTED);
    if(iSelRow == LVM_ERR)
      return FALSE;

    plistParams->InsertItem(iSelRow, 2, GetStatusName(dbStatus));
  }
  return TRUE;
}

Member Data Documentation

CTabLite CExecuteParamDlg::m_tabParamSets [protected]

Definition at line 871 of file cdialog.h.

CVector<CListViewLite*, ULONG_PTR> CExecuteParamDlg::m_vecParams [protected]

Definition at line 872 of file cdialog.h.

CVector<CListViewLite*, ULONG_PTR> CExecuteParamDlg::m_vecValues [protected]

Definition at line 873 of file cdialog.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialog.h
  • Dataaccess/oledb/rowsetviewer/cdialog.cpp
Generated on Wed Nov 13 2024 16:56:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CExeModule Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CExeModule Class Reference

#include "stdafx.h"

List of all members.

Public Member Functions

void | MonitorShutdown ()
void | MonitorShutdown ()
void | MonitorShutdown ()
void | MonitorShutdown ()
void | MonitorShutdown ()
void | MonitorShutdown ()
bool | StartMonitor ()
bool | StartMonitor ()
bool | StartMonitor ()
bool | StartMonitor ()
bool | StartMonitor ()
bool | StartMonitor ()
LONG | Unlock ()
LONG | Unlock ()
LONG | Unlock ()
LONG | Unlock ()
LONG | Unlock ()
LONG | Unlock ()
LONG | Unlock ()
LONG | Unlock ()

Public Attributes

bool | bActivity
DWORD dwThreadID
HANDLE hEventShutdown

Detailed Description

Definition at line 39 of file stdafx.h.

Member Function Documentation

void CExeModule::MonitorShutdown ( )

Definition at line 65 of file fullsvr.Cpp.

{
    while (1)
    {
        WaitForSingleObject(hEventShutdown, INFINITE);
        DWORD dwWait=0;
        do
        {
            bActivity = false;
            dwWait = WaitForSingleObject(hEventShutdown, dwTimeOut);
        } while (dwWait == WAIT_OBJECT_0);
        // timed out
        if (!bActivity && m_nLockCnt == 0) // if no activity let's really bail
        {
#if _WIN32_WINNT >= 0x0400 & defined(_ATL_FREE_THREADED)
            CoSuspendClassObjects();
            if (!bActivity && m_nLockCnt == 0)
#endif
                break;
        }
    }
    CloseHandle(hEventShutdown);
    PostThreadMessage(dwThreadID, WM_QUIT, 0, 0);
}

void CExeModule::MonitorShutdown ( )
void CExeModule::MonitorShutdown ( )
void CExeModule::MonitorShutdown ( )
void CExeModule::MonitorShutdown ( )
void CExeModule::MonitorShutdown ( )
bool CExeModule::StartMonitor ( )
bool CExeModule::StartMonitor ( )
bool CExeModule::StartMonitor ( )
bool CExeModule::StartMonitor ( )

Definition at line 90 of file fullsvr.Cpp.

{
    hEventShutdown = CreateEvent(NULL, false, false, NULL);
    if (hEventShutdown == NULL)
        return false;
    DWORD dwThreadID;
    hMonitorThread = CreateThread(NULL, 0, MonitorProc, this, 0, &dwThreadID);
    return (hMonitorThread != NULL);
}

bool CExeModule::StartMonitor ( )
bool CExeModule::StartMonitor ( )
LONG CExeModule::Unlock ( )

Definition at line 27 of file ComSpy.Cpp.

{
  LONG l = CComModule::Unlock();
  if (l == 0)
  {
#if _WIN32_WINNT >= 0x0400
    if (CoSuspendClassObjects() == S_OK)
      PostThreadMessage(dwThreadID, WM_QUIT, 0, 0);
#else
    PostThreadMessage(dwThreadID, WM_QUIT, 0, 0);
#endif
  }
  return l;
}

LONG CExeModule::Unlock ( )
LONG CExeModule::Unlock ( )
LONG CExeModule::Unlock ( )
LONG CExeModule::Unlock ( )
LONG CExeModule::Unlock ( )
LONG CExeModule::Unlock ( )
LONG CExeModule::Unlock ( )

Member Data Documentation

bool CExeModule::bActivity

Definition at line 47 of file stdafx.h.

DWORD CExeModule::dwThreadID

Definition at line 43 of file stdafx.h.

HANDLE CExeModule::hEventShutdown

Definition at line 44 of file stdafx.h.

The documentation for this class was generated from the following files:
  • Com/Fundamentals/AsyncCalls/CallBackClient/stdafx.h
  • Com/Fundamentals/AsyncCalls/FullSvr/stdafx.h
  • Com/Fundamentals/DCom/TimeOuts/Server/StdAfx.h
  • Com/Services/Object_Pooling/OPBankSample/OPBank/stdafx.h
  • Web/Browser/EditCommands/StdAfx.h
  • Web/Browser/EditFeatures/StdAfx.h
  • Web/Browser/EditGlyphs/StdAfx.h
  • Web/Browser/EditHost/StdAfx.h
  • Com/Administration/Spy/ComSpy/ComSpy.Cpp
  • Com/Fundamentals/AsyncCalls/CallBackClient/callbackclient.Cpp
  • Com/Fundamentals/AsyncCalls/FullSvr/fullsvr.Cpp
  • Com/Fundamentals/DCom/TimeOuts/Server/Server.Cpp
  • Com/Services/Object_Pooling/OPBankSample/OPBank/OPBank.Cpp
  • Web/Browser/EditCommands/EdCommands.cpp
  • Web/Browser/EditFeatures/EdCommands.cpp
  • Web/Browser/EditGlyphs/EdGlyphs.cpp
  • Web/Browser/EditHost/EdHost.cpp
Generated on Wed Nov 13 2024 16:56:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CExList< TYPE > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CExList< TYPE > Class Template Reference

#include "cexlist.h"

List of all members.

Public Member Functions

CExList ()
virtual | ~CExList ()
virtual POS | AddHead (TYPE element)
virtual POS | AddTail (TYPE element)
virtual POS | Find (TYPE element)
virtual POS | FindIndex (ULONG iIndex)
virtual TYPE | GetAt (POS position) const
virtual ULONG | GetCount ()
virtual TYPE | GetHead ()
virtual POS | GetHeadPosition ()
virtual TYPE | GetNext (POS &position)
virtual TYPE | GetPrev (POS &position)
virtual TYPE | GetTail ()
virtual POS | GetTailPosition ()
virtual POS | InsertAfter (POS position, TYPE element)
virtual POS | InsertBefore (POS position, TYPE element)
virtual BOOL | IsEmpty ()
virtual void | RemoveAll ()
virtual TYPE | RemoveAt (POS position)
virtual TYPE | RemoveHead ()
virtual TYPE | RemoveTail ()
virtual TYPE | SetAt (POS position, TYPE element)

Private Attributes

CNode< TYPE > * | m_pHeadNode
CNode< TYPE > * | m_pTailNode
ULONG m_ulElements

Detailed Description

template<class TYPE>
class CExList< TYPE >

Definition at line 61 of file cexlist.h.

Constructor & Destructor Documentation

template<class TYPE >
CExList< TYPE >::CExList ( )

Definition at line 118 of file cexlist.h.

{
  //constructor
  m_pHeadNode = NULL;
  m_pTailNode = NULL;
  m_ulElements = 0;
}

template<class TYPE >
CExList< TYPE >::~CExList ( ) [virtual]

Definition at line 130 of file cexlist.h.

{
  //Remove all elements
  RemoveAll();
}

Member Function Documentation

template<class TYPE>
POS CExList< TYPE >::AddHead ( TYPE element ) [virtual]

Definition at line 141 of file cexlist.h.

{
  //Add to the Head of the CExList, (stack)
  CNode<TYPE>* pHeadNode = new CNode<TYPE>(element, NULL, m_pHeadNode);

  //If there was a list hook the head->prev to the new head
  if(m_pHeadNode)
    m_pHeadNode->m_pPrevNode = pHeadNode;

  //If there isn't a tail element, hook it to the head
  if(!m_pTailNode)
    m_pTailNode = pHeadNode;

  m_pHeadNode = pHeadNode;
  m_ulElements++;
  return m_pHeadNode;
}

template<class TYPE>
POS CExList< TYPE >::AddTail ( TYPE element ) [virtual]

Definition at line 164 of file cexlist.h.

{
  //Add to the m_pTailNode of the CExList
  CNode<TYPE>* pTailNode = new CNode<TYPE>(element, m_pTailNode, 0);

  //if previously empty
  if(!m_pHeadNode)
    m_pHeadNode = pTailNode;
  else
    m_pTailNode->m_pNextNode = pTailNode;

  m_pTailNode = pTailNode;
  m_ulElements++;
  return m_pTailNode;
}

template<class TYPE>
POS CExList< TYPE >::Find ( TYPE element ) [virtual]

Definition at line 284 of file cexlist.h.

{
  //return pointer to found element
  for(CNode<TYPE>* p = m_pHeadNode; p; p = p->m_pNextNode)
    if(p->m_data == element)
    return p;   // return position to found CNode

  return NULL;  // return NULL if not found
}

template<class TYPE >
POS CExList< TYPE >::FindIndex ( ULONG iIndex ) [virtual]

Definition at line 467 of file cexlist.h.

{
  CNode<TYPE>* pNode = m_pHeadNode;

  //Find the specified index
  while(iIndex--)
    pNode = pNode->m_pNextNode;

  return (POS)pNode;
}

template<class TYPE >
TYPE CExList< TYPE >::GetAt ( POS position ) const [inline, virtual]

Definition at line 257 of file cexlist.h.

{
  return ((CNode<TYPE>*)position)->m_data;
}

template<class TYPE >
ULONG CExList< TYPE >::GetCount ( ) [inline, virtual]

Definition at line 404 of file cexlist.h.

{
  // return the Length
  return m_ulElements;
}

template<class TYPE >
TYPE CExList< TYPE >::GetHead ( ) [inline, virtual]

Definition at line 206 of file cexlist.h.

{
  //return Head element value
  return m_pHeadNode->m_data;
}

template<class TYPE >
POS CExList< TYPE >::GetHeadPosition ( ) [inline, virtual]

Definition at line 186 of file cexlist.h.

{
  //return Head element Position
  return m_pHeadNode;
}

template<class TYPE >
TYPE CExList< TYPE >::GetNext ( POS & position ) [inline, virtual]

Definition at line 227 of file cexlist.h.

{
  //Set position to the next element
  CNode<TYPE>* pNode = (CNode<TYPE>*)position;
  position = pNode->m_pNextNode;

  //return the current element
  return pNode->m_data;
}

template<class TYPE >
TYPE CExList< TYPE >::GetPrev ( POS & position ) [inline, virtual]

Definition at line 242 of file cexlist.h.

{
  //Set position to the next element
  CNode<TYPE>* pNode = (CNode<TYPE>*)position;
  position = pNode->m_pPrevNode;

  //return the current element
  return pNode->m_data;
}

template<class TYPE >
TYPE CExList< TYPE >::GetTail ( ) [inline, virtual]

Definition at line 216 of file cexlist.h.

{
  // return Tail element value
  return m_pTailNode->m_data;
}

template<class TYPE >
POS CExList< TYPE >::GetTailPosition ( ) [inline, virtual]

Definition at line 196 of file cexlist.h.

{
  //return Tail element Position
  return m_pTailNode;
}

template<class TYPE>
POS CExList< TYPE >::InsertAfter | ( | POS | position,
 |  | TYPE | element |
 | ) |  |  | [virtual]

Definition at line 443 of file cexlist.h.

{
  //insert after the position
  if(position == m_pTailNode)     // Add after the m_pTailNode
    return AddTail(element);

  CNode<TYPE>* pOldNode = (CNode<TYPE>*)position;

  //other wise a little more difficult
  CNode<TYPE>* pNewNode = new CNode<TYPE>(element, pOldNode, pOldNode->m_pNextNode);

  //Hook up before after nodes to it
  pOldNode->m_pNextNode->m_pPrevNode = pNewNode;
  pOldNode->m_pNextNode = pNewNode;

  m_ulElements++;
  return pNewNode;
}

template<class TYPE>
POS CExList< TYPE >::InsertBefore | ( | POS | position,
 |  | TYPE | element |
 | ) |  |  | [virtual]

Definition at line 415 of file cexlist.h.

{
  //insert before the position
  if(position == m_pHeadNode)    // Add before Head
    return AddHead(element);

  CNode<TYPE>* pOldNode = (CNode<TYPE>*)position;

  //otherwise a little more difficult
  CNode<TYPE>* pNewNode = new CNode<TYPE>(element, pOldNode->m_pPrevNode, pOldNode);

  //Create the new node
  pNewNode->m_pNextNode = new CNode<TYPE>(element, pOldNode->m_pPrevNode, pOldNode->m_pNextNode);

  //Hook up before after nodes to it
  pOldNode->m_pPrevNode->m_pNextNode = pNewNode;
  pOldNode->m_pPrevNode = pNewNode;

  m_ulElements++;
  return pNewNode;
}

template<class TYPE >
BOOL CExList< TYPE >::IsEmpty ( void ) [inline, virtual]

Definition at line 299 of file cexlist.h.

{
  // returns TRUE if Empty
  return m_ulElements == 0;
}

template<class TYPE >
void CExList< TYPE >::RemoveAll ( ) [virtual]

Definition at line 383 of file cexlist.h.

{
  // Remove all items from the CExList
  CNode<TYPE>* pNode = m_pHeadNode;
  while(pNode)
  {
    CNode<TYPE>* pTemp = pNode;
    pNode = pNode->m_pNextNode;
    delete pTemp;
  }

  m_pHeadNode   = NULL;
  m_pTailNode   = NULL;
  m_ulElements  = 0;
}

template<class TYPE >
TYPE CExList< TYPE >::RemoveAt ( POS position ) [virtual]

Definition at line 355 of file cexlist.h.

{
  //Remove CExList[position]
  CNode<TYPE>* pNode = (CNode<TYPE>*)position;
  TYPE oldData = pNode->m_data;

  // If removing the head
  if (pNode == m_pHeadNode)
    m_pHeadNode = pNode->m_pNextNode;
  else
    pNode->m_pPrevNode->m_pNextNode = pNode->m_pNextNode;

  //If removing the tail
  if (pNode == m_pTailNode)
    m_pTailNode = pNode->m_pPrevNode;
  else
    pNode->m_pNextNode->m_pPrevNode = pNode->m_pPrevNode;

  m_ulElements--;
  delete pNode;
  return oldData;
}

template<class TYPE >
TYPE CExList< TYPE >::RemoveHead ( ) [virtual]

Definition at line 311 of file cexlist.h.

{
  //Remove and return from the Head of the List
  CNode<TYPE>* pHeadNode = m_pHeadNode; // pointer to the Removed node
  TYPE element = GetHead();       //make a copy, before deleteing

  m_pHeadNode = pHeadNode->m_pNextNode;   // reroute Head to exclude the first element
  if(m_pHeadNode)
    m_pHeadNode->m_pPrevNode = NULL;
  else
    m_pTailNode = NULL;

  m_ulElements--;
  delete pHeadNode;           // delete head
  return element;
}

template<class TYPE >
TYPE CExList< TYPE >::RemoveTail ( ) [virtual]

Definition at line 333 of file cexlist.h.

{
  //Remove and return from the m_pTailNode of the CExList
  CNode<TYPE>* pTailNode = m_pTailNode->m_pPrevNode;
  TYPE element = GetTail();  //make a copy before deleteing

  m_pTailNode = pTailNode;
  if(m_pTailNode)
    m_pTailNode->m_pNextNode = NULL;
  else
    m_pHeadNode = NULL;

  m_ulElements--;
  delete m_pTailNode;
  return element;
}

template<class TYPE>
TYPE CExList< TYPE >::SetAt | ( | POS | position,
 |  | TYPE | element |
 | ) |  |  | [inline, virtual]

Definition at line 266 of file cexlist.h.

{
  //Save the old data
  CNode<TYPE>* pNode = (CNode<TYPE>*)position;
  TYPE oldData = pNode->m_data;

  //Store new data
  pNode->m_data = element;

  //return olddata
  return oldData;
}

Member Data Documentation

template<class TYPE>
CNode<TYPE>* CExList< TYPE >::m_pHeadNode [private]

Definition at line 108 of file cexlist.h.

template<class TYPE>
CNode<TYPE>* CExList< TYPE >::m_pTailNode [private]

Definition at line 109 of file cexlist.h.

template<class TYPE>
ULONG CExList< TYPE >::m_ulElements [private]

Definition at line 110 of file cexlist.h.

The documentation for this class was generated from the following file:
  • Dataaccess/osp/vc/cexlist.h
Generated on Wed Nov 13 2024 16:56:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CExplorerBar Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes | Private Member Functions | Static Private Member Functions | Private Attributes

CExplorerBar Class Reference

#include "ExplrBar.h"

List of all members.

Public Member Functions

CExplorerBar ()
~CExplorerBar ()
STDMETHOD() | CloseDW (DWORD dwReserved)
STDMETHOD() | ContextSensitiveHelp (BOOL)
STDMETHOD() | GetBandInfo (DWORD, DWORD, DESKBANDINFO *)
STDMETHOD() | GetClassID (LPCLSID)
STDMETHOD() | GetSite (REFIID, LPVOID *)
STDMETHOD() | GetSizeMax (ULARGE_INTEGER *)
STDMETHOD() | GetWindow (HWND *)
STDMETHOD() | HasFocusIO (void)
STDMETHOD() | IsDirty (void)
STDMETHOD() | Load (LPSTREAM)
STDMETHODIMP | QueryInterface (REFIID, LPVOID *)
STDMETHOD() | ResizeBorderDW (LPCRECT prcBorder, IUnknown *punkToolbarSite, BOOL fReserved)
STDMETHOD() | Save (LPSTREAM, BOOL)
STDMETHOD() | SetSite (IUnknown *)
STDMETHOD() | ShowDW (BOOL fShow)
STDMETHODIMP_ (DWORD) Release()
STDMETHODIMP_ (DWORD) AddRef()
STDMETHOD() | TranslateAcceleratorIO (LPMSG)
STDMETHOD() | UIActivateIO (BOOL, LPMSG)

Protected Attributes

DWORD m_ObjRefCount

Private Member Functions

void | FocusChange (BOOL)
LRESULT | OnCommand (WPARAM wParam, LPARAM lParam)
LRESULT | OnKillFocus (void)
LRESULT | OnPaint (void)
LRESULT | OnSetFocus (void)
BOOL | RegisterAndCreateWindow (void)

Static Private Member Functions

static LRESULT CALLBACK | WndProc (HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam)

Private Attributes

BOOL m_bFocus
DWORD m_dwBandID
DWORD m_dwViewMode
HWND | m_hWnd
HWND | m_hwndParent
IInputObjectSite * | m_pSite

Detailed Description

Definition at line 37 of file ExplrBar.h.

Constructor & Destructor Documentation

CExplorerBar::CExplorerBar ( )

Definition at line 31 of file ExplrBar.Cpp.

{
m_pSite = NULL;

m_hWnd = NULL;
m_hwndParent = NULL;

m_bFocus = FALSE;

m_dwViewMode = 0;
m_dwBandID = 0;

m_ObjRefCount = 1;
g_DllRefCount++;
}

CExplorerBar::~CExplorerBar ( )

Definition at line 53 of file ExplrBar.Cpp.

{
//this should have been freed in a call to SetSite(NULL), but just to be safe
if(m_pSite)
   {
   m_pSite->Release();
   m_pSite = NULL;
   }

g_DllRefCount--;
}

Member Function Documentation

STDMETHODIMP CExplorerBar::CloseDW ( DWORD dwReserved )

Definition at line 231 of file ExplrBar.Cpp.

{
ShowDW(FALSE);

if(IsWindow(m_hWnd))
   DestroyWindow(m_hWnd);

m_hWnd = NULL;

return S_OK;
}

STDMETHODIMP CExplorerBar::ContextSensitiveHelp ( BOOL fEnterMode )

Definition at line 190 of file ExplrBar.Cpp.

{
return E_NOTIMPL;
}

void CExplorerBar::FocusChange ( BOOL bFocus ) [private]

Definition at line 590 of file ExplrBar.Cpp.

{
m_bFocus = bFocus;

//inform the input object site that the focus has changed
if(m_pSite)
   {
   m_pSite->OnFocusChangeIS((IDockingWindow*)this, bFocus);
   }
}

STDMETHODIMP CExplorerBar::GetBandInfo | ( | DWORD | dwBandID,
 |  | DWORD | dwViewMode,
 |  | DESKBANDINFO * | pdbi
 | ) |  |

Definition at line 387 of file ExplrBar.Cpp.

{
if(pdbi)
   {
   m_dwBandID = dwBandID;
   m_dwViewMode = dwViewMode;

   if(pdbi->dwMask & DBIM_MINSIZE)
      {
      pdbi->ptMinSize.x = MIN_SIZE_X;
      pdbi->ptMinSize.y = MIN_SIZE_Y;
      }

   if(pdbi->dwMask & DBIM_MAXSIZE)
      {
      pdbi->ptMaxSize.x = -1;
      pdbi->ptMaxSize.y = -1;
      }

   if(pdbi->dwMask & DBIM_INTEGRAL)
      {
      pdbi->ptIntegral.x = 1;
      pdbi->ptIntegral.y = 1;
      }

   if(pdbi->dwMask & DBIM_ACTUAL)
      {
      pdbi->ptActual.x = 0;
      pdbi->ptActual.y = 0;
      }

   if(pdbi->dwMask & DBIM_TITLE)
      {
      lstrcpyW(pdbi->wszTitle, L"Sample Explorer Bar");
      }

   if(pdbi->dwMask & DBIM_MODEFLAGS)
      {
      pdbi->dwModeFlags = DBIMF_VARIABLEHEIGHT;
      }

   if(pdbi->dwMask & DBIM_BKCOLOR)
      {
      //Use the default background color by removing this flag.
      pdbi->dwMask &= ~DBIM_BKCOLOR;
      }

   return S_OK;
   }

return E_INVALIDARG;
}

STDMETHODIMP CExplorerBar::GetClassID ( LPCLSID pClassID )

Definition at line 455 of file ExplrBar.Cpp.

{
*pClassID = CLSID_SampleExplorerBar;

return S_OK;
}

STDMETHODIMP CExplorerBar::GetSite | ( | REFIID | riid,
 |  | LPVOID * | ppvReturn
 | ) |  |

Definition at line 366 of file ExplrBar.Cpp.

{
*ppvReturn = NULL;

if(m_pSite)
   return m_pSite->QueryInterface(riid, ppvReturn);

return E_FAIL;
}

STDMETHODIMP CExplorerBar::GetSizeMax ( ULARGE_INTEGER * pul )

Definition at line 501 of file ExplrBar.Cpp.

{
return E_NOTIMPL;
}

STDMETHODIMP CExplorerBar::GetWindow ( HWND * phWnd )

Definition at line 177 of file ExplrBar.Cpp.

{
*phWnd = m_hWnd;

return S_OK;
}

STDMETHODIMP CExplorerBar::HasFocusIO ( void )

Definition at line 287 of file ExplrBar.Cpp.

{
if(m_bFocus)
   return S_OK;

return S_FALSE;
}

STDMETHODIMP CExplorerBar::IsDirty ( void )

Definition at line 468 of file ExplrBar.Cpp.

{
return S_FALSE;
}

STDMETHODIMP CExplorerBar::Load ( LPSTREAM pStream )

Definition at line 479 of file ExplrBar.Cpp.

{
return S_OK;
}

LRESULT CExplorerBar::OnCommand | ( | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private]

Definition at line 579 of file ExplrBar.Cpp.

{
return 0;
}

LRESULT CExplorerBar::OnKillFocus ( void ) [private]

Definition at line 620 of file ExplrBar.Cpp.

{
FocusChange(FALSE);

return 0;
}

LRESULT CExplorerBar::OnPaint ( void ) [private]

Definition at line 556 of file ExplrBar.Cpp.

{
PAINTSTRUCT ps;
RECT        rc;

BeginPaint(m_hWnd, &ps);

GetClientRect(m_hWnd, &rc);
SetTextColor(ps.hdc, RGB(255, 255, 255));
SetBkMode(ps.hdc, TRANSPARENT);
DrawText(ps.hdc, TEXT("Sample Explorer Bar"), -1, &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER);

EndPaint(m_hWnd, &ps);

return 0;
}

LRESULT CExplorerBar::OnSetFocus ( void ) [private]

Definition at line 607 of file ExplrBar.Cpp.

{
FocusChange(TRUE);

return 0;
}

STDMETHODIMP CExplorerBar::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppReturn
 | ) |  |

Definition at line 76 of file ExplrBar.Cpp.

{
*ppReturn = NULL;

//IUnknown
if(IsEqualIID(riid, IID_IUnknown))
   {
   *ppReturn = this;
   }

//IOleWindow
else if(IsEqualIID(riid, IID_IOleWindow))
   {
   *ppReturn = (IOleWindow*)this;
   }

//IDockingWindow
else if(IsEqualIID(riid, IID_IDockingWindow))
   {
   *ppReturn = (IDockingWindow*)this;
   }

//IInputObject
else if(IsEqualIID(riid, IID_IInputObject))
   {
   *ppReturn = (IInputObject*)this;
   }

//IObjectWithSite
else if(IsEqualIID(riid, IID_IObjectWithSite))
   {
   *ppReturn = (IObjectWithSite*)this;
   }

//IDeskBand
else if(IsEqualIID(riid, IID_IDeskBand))
   {
   *ppReturn = (IDeskBand*)this;
   }

//IPersist
else if(IsEqualIID(riid, IID_IPersist))
   {
   *ppReturn = (IPersist*)this;
   }

//IPersistStream
else if(IsEqualIID(riid, IID_IPersistStream))
   {
   *ppReturn = (IPersistStream*)this;
   }

if(*ppReturn)
   {
   (*(LPUNKNOWN*)ppReturn)->AddRef();
   return S_OK;
   }

return E_NOINTERFACE;
}

BOOL CExplorerBar::RegisterAndCreateWindow ( void ) [private]

Definition at line 633 of file ExplrBar.Cpp.

{
//If the window doesn't exist yet, create it now.
if(!m_hWnd)
   {
   //Can't create a child window without a parent.
   if(!m_hwndParent)
      {
      return FALSE;
      }

   //If the window class has not been registered, then do so.
   WNDCLASS wc;
   if(!GetClassInfo(g_hInst, EB_CLASS_NAME, &wc))
      {
      ZeroMemory(&wc, sizeof(wc));
      wc.style          = CS_HREDRAW | CS_VREDRAW | CS_GLOBALCLASS;
      wc.lpfnWndProc    = (WNDPROC)WndProc;
      wc.cbClsExtra     = 0;
      wc.cbWndExtra     = 0;
      wc.hInstance      = g_hInst;
      wc.hIcon          = NULL;
      wc.hCursor        = LoadCursor(NULL, IDC_ARROW);
      wc.hbrBackground  = (HBRUSH)CreateSolidBrush(RGB(0, 0, 192));
      wc.lpszMenuName   = NULL;
      wc.lpszClassName  = EB_CLASS_NAME;

      if(!RegisterClass(&wc))
         {
         //If RegisterClass fails, CreateWindow below will fail.
         }
      }

   RECT  rc;

   GetClientRect(m_hwndParent, &rc);

   //Create the window. The WndProc will set m_hWnd.
   CreateWindowEx(   0,
                     EB_CLASS_NAME,
                     NULL,
                     WS_CHILD | WS_CLIPSIBLINGS | WS_BORDER,
                     rc.left,
                     rc.top,
                     rc.right - rc.left,
                     rc.bottom - rc.top,
                     m_hwndParent,
                     NULL,
                     g_hInst,
                     (LPVOID)this);

   }

return (NULL != m_hWnd);
}

STDMETHODIMP CExplorerBar::ResizeBorderDW | ( | LPCRECT | prcBorder,
 |  | IUnknown * | punkToolbarSite,
 |  | BOOL | fReserved
 | ) |  |

Definition at line 249 of file ExplrBar.Cpp.

{
/*
This method is never called for Band Objects.
*/
return E_NOTIMPL;
}

STDMETHODIMP CExplorerBar::Save | ( | LPSTREAM | pStream,
 |  | BOOL | fClearDirty
 | ) |  |

Definition at line 490 of file ExplrBar.Cpp.

{
return S_OK;
}

STDMETHODIMP CExplorerBar::SetSite ( IUnknown * punkSite )

Definition at line 319 of file ExplrBar.Cpp.

{
//If a site is being held, release it.
if(m_pSite)
   {
   m_pSite->Release();
   m_pSite = NULL;
   }

//If punkSite is not NULL, a new site is being set.
if(punkSite)
   {
   //Get the parent window.
   IOleWindow  *pOleWindow;

   m_hwndParent = NULL;

   if(SUCCEEDED(punkSite->QueryInterface(IID_IOleWindow, (LPVOID*)&pOleWindow)))
      {
      pOleWindow->GetWindow(&m_hwndParent);
      pOleWindow->Release();
      }

   if(!m_hwndParent)
      return E_FAIL;

   if(!RegisterAndCreateWindow())
      return E_FAIL;

   //Get and keep the IInputObjectSite pointer.
   if(SUCCEEDED(punkSite->QueryInterface(IID_IInputObjectSite, (LPVOID*)&m_pSite)))
      {
      return S_OK;
      }

   return E_FAIL;
   }

return S_OK;
}

STDMETHODIMP CExplorerBar::ShowDW ( BOOL fShow )

Definition at line 206 of file ExplrBar.Cpp.

{
if(m_hWnd)
   {
   if(fShow)
      {
      //show our window
      ShowWindow(m_hWnd, SW_SHOW);
      }
   else
      {
      //hide our window
      ShowWindow(m_hWnd, SW_HIDE);
      }
   }

return S_OK;
}

CExplorerBar::STDMETHODIMP_ ( DWORD )
CExplorerBar::STDMETHODIMP_ ( DWORD )
STDMETHODIMP CExplorerBar::TranslateAcceleratorIO ( LPMSG pMsg )

Definition at line 303 of file ExplrBar.Cpp.

{
return S_FALSE;
}

STDMETHODIMP CExplorerBar::UIActivateIO | ( | BOOL | fActivate,
 |  | LPMSG | pMsg
 | ) |  |

Definition at line 270 of file ExplrBar.Cpp.

{
if(fActivate)
   SetFocus(m_hWnd);

return S_OK;
}

LRESULT CALLBACK CExplorerBar::WndProc | ( | HWND | hWnd,
 |  | UINT | uMessage,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static, private]

Definition at line 517 of file ExplrBar.Cpp.

{
CExplorerBar  *pThis = (CExplorerBar*)GetWindowLongPtr(hWnd, GWLP_USERDATA);

switch (uMessage)
   {
   case WM_NCCREATE:
      {
      LPCREATESTRUCT lpcs = (LPCREATESTRUCT)lParam;
      pThis = (CExplorerBar*)(lpcs->lpCreateParams);
      SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)pThis);

      //set the window handle
      pThis->m_hWnd = hWnd;
      }
      break;

   case WM_PAINT:
      return pThis->OnPaint();

   case WM_COMMAND:
      return pThis->OnCommand(wParam, lParam);

   case WM_SETFOCUS:
      return pThis->OnSetFocus();

   case WM_KILLFOCUS:
      return pThis->OnKillFocus();
   }

return DefWindowProc(hWnd, uMessage, wParam, lParam);
}

Member Data Documentation

BOOL CExplorerBar::m_bFocus [private]

Definition at line 83 of file ExplrBar.h.

DWORD CExplorerBar::m_dwBandID [private]

Definition at line 87 of file ExplrBar.h.

DWORD CExplorerBar::m_dwViewMode [private]

Definition at line 86 of file ExplrBar.h.

HWND CExplorerBar::m_hWnd [private]

Definition at line 85 of file ExplrBar.h.

HWND CExplorerBar::m_hwndParent [private]

Definition at line 84 of file ExplrBar.h.

DWORD CExplorerBar::m_ObjRefCount [protected]

Definition at line 43 of file ExplrBar.h.

IInputObjectSite* CExplorerBar::m_pSite [private]

Definition at line 88 of file ExplrBar.h.

The documentation for this class was generated from the following files:
  • WinUI/Shell/BandObjs/ExplrBar.h
  • WinUI/Shell/BandObjs/ExplrBar.Cpp
Generated on Wed Nov 13 2024 16:56:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CExtBuffer Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CExtBuffer Class Reference

#include "extbuff.h"

List of all members.

Public Member Functions

CExtBuffer (void)
~CExtBuffer (void)
STDMETHODIMP | FInit (ULONG cItemMax, ULONG cbItem, ULONG cbPage)
STDMETHODIMP | GetFirstLastItemH (HACCESSOR &hItemFirst, HACCESSOR &hItemLast)
STDMETHODIMP | GetItemOfExtBuffer (HACCESSOR hItem, VOID *pvItem)
STDMETHODIMP | InsertIntoExtBuffer (VOID *pvItem, HACCESSOR &hItem)
void * | operator[] (DBCOUNTITEM nIndex)

Private Member Functions

CExtBuffer (const CExtBuffer &p)
CExtBuffer & | operator= (const CExtBuffer &p)

Private Attributes

ULONG m_cbAlloc
ULONG m_cbItem
ULONG m_cbReserved
ULONG m_cItem
ULONG m_dbAlloc
BYTE * | m_rgItem

Detailed Description

Definition at line 23 of file extbuff.h.

Constructor & Destructor Documentation

CExtBuffer::CExtBuffer ( const CExtBuffer & p ) [private]
CExtBuffer::CExtBuffer ( void )

Definition at line 33 of file extbuff.cpp.

{
    m_cItem   = 0;
    m_cbAlloc = 0;
    m_rgItem  = NULL;
}

CExtBuffer::~CExtBuffer ( void )

Definition at line 49 of file extbuff.cpp.

{
    if (m_cbAlloc)
        VirtualFree((VOID *) m_rgItem, m_cbAlloc, MEM_DECOMMIT );

    if (m_rgItem)
        VirtualFree((VOID *) m_rgItem, 0, MEM_RELEASE );
}

Member Function Documentation

STDMETHODIMP CExtBuffer::FInit | ( | ULONG | cItemMax,
 |  | ULONG | cbItem,
 |  | ULONG | cbPage
 | ) |  |

Definition at line 69 of file extbuff.cpp.

{
    BYTE  *pb;

    m_cbReserved = ((cbItem *cItemMax) / cbPage + 1) *cbPage;
    m_rgItem = (BYTE *) VirtualAlloc( NULL, m_cbReserved, MEM_RESERVE, PAGE_READWRITE );

    if (m_rgItem == NULL)
        return ResultFromScode( E_OUTOFMEMORY );

    m_cbItem  = cbItem;
    m_dbAlloc = (cbItem / cbPage + 1) *cbPage;
    pb = (BYTE *) VirtualAlloc( m_rgItem, m_dbAlloc, MEM_COMMIT, PAGE_READWRITE );
    if (pb == NULL)
        {
        VirtualFree((VOID *) m_rgItem, 0, MEM_RELEASE );
        m_rgItem = NULL;
        return ResultFromScode( E_OUTOFMEMORY );
        }

    m_cbAlloc = m_dbAlloc;
    return ResultFromScode( S_OK );
}

STDMETHODIMP CExtBuffer::GetFirstLastItemH | ( | HACCESSOR & | hItemFirst,
 |  | HACCESSOR & | hItemLast
 | ) |  |

Definition at line 197 of file extbuff.cpp.

{
    hItemFirst = 1;
    hItemLast  = m_cItem;
    return ResultFromScode( S_OK );
}

STDMETHODIMP CExtBuffer::GetItemOfExtBuffer | ( | HACCESSOR | hItem,
 |  | VOID * | pvItem
 | ) |  |

Definition at line 175 of file extbuff.cpp.

{
    if ((hItem > m_cItem) || (hItem == 0) ) {
        *((PACCESSOR *)pvItem) = NULL;
    return ResultFromScode( DB_E_BADACCESSORHANDLE );
  }

    memcpy((BYTE *) pvItem, (m_rgItem + (hItem - 1) *m_cbItem), m_cbItem );
    return ResultFromScode( S_OK );
}

STDMETHODIMP CExtBuffer::InsertIntoExtBuffer | ( | VOID * | pvItem,
 |  | HACCESSOR & | hItem
 | ) |  |

Definition at line 132 of file extbuff.cpp.

{
    ULONG cbOffset;

    cbOffset = m_cItem*m_cbItem;
    if ((cbOffset + m_cbItem) > m_cbAlloc)
        {
        BYTE *pb;

        if ((m_cbAlloc + m_dbAlloc) > m_cbReserved)
            pb = NULL;
        else
            pb = (BYTE *) VirtualAlloc( m_rgItem + m_cbAlloc,
                                        m_dbAlloc,
                                        MEM_COMMIT,
                                        PAGE_READWRITE );
        if (pb == NULL)
            {
            return ResultFromScode( E_OUTOFMEMORY );
            }
        m_cbAlloc += m_dbAlloc;
        }

    memcpy((m_rgItem + cbOffset), (BYTE *) pvItem, m_cbItem );
    m_cItem++;
    hItem = m_cItem;

    return ResultFromScode( S_OK );
}

CExtBuffer& CExtBuffer::operator= ( const CExtBuffer & p ) [private]
void * CExtBuffer::operator[] ( DBCOUNTITEM nIndex )

Definition at line 105 of file extbuff.cpp.

{
    // Return ptr to element [n], where n = 1...m_cItem.
    // Returns NULL if 'n' is out of range.
    //
    // You must use InsertIntoExtBuffer to add new elements.
    // Thereafter you can use this operator to retrieve the address of the item.
    // (You can't delete an element, but you can overwrite its space.)

    if (1 <= hItem && hItem <= m_cItem)
        return m_rgItem + (hItem - 1) *m_cbItem;
    else
        return NULL;
}

Member Data Documentation

ULONG CExtBuffer::m_cbAlloc [private]

Definition at line 33 of file extbuff.h.

ULONG CExtBuffer::m_cbItem [private]

Definition at line 27 of file extbuff.h.

ULONG CExtBuffer::m_cbReserved [private]

Definition at line 31 of file extbuff.h.

ULONG CExtBuffer::m_cItem [private]

Definition at line 29 of file extbuff.h.

ULONG CExtBuffer::m_dbAlloc [private]

Definition at line 35 of file extbuff.h.

BYTE* CExtBuffer::m_rgItem [private]

Definition at line 37 of file extbuff.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/sampprov/extbuff.h
  • Dataaccess/oledb/sampprov/extbuff.cpp
Generated on Wed Nov 13 2024 16:56:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CExtendContextMenuEx Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CExtendContextMenuEx Class Reference

#include "contextmenuex.h"

List of all members.

Public Member Functions

CExtendContextMenuEx ()
~CExtendContextMenuEx ()
HRESULT STDMETHODCALLTYPE | AddMenuItems (LPDATAOBJECT ipDataObject, LPCONTEXTMENUCALLBACK ipCallback, long __RPC_FAR *pInsertionAllowed)
HRESULT STDMETHODCALLTYPE | Command (long lCommandID, LPDATAOBJECT piDataObject)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()

Private Attributes

ULONG m_cRef

Detailed Description

Definition at line 22 of file contextmenuex.h.

Constructor & Destructor Documentation

CExtendContextMenuEx::CExtendContextMenuEx ( )

Definition at line 77 of file contextmenuex.cpp.

{
  InterlockedIncrement((long*)&g_uObjectCount);

  m_cRef = 0;

  TRACE_START(_T("New instance of CExtendContextMenuEx") );
}

CExtendContextMenuEx::~CExtendContextMenuEx ( )

Definition at line 87 of file contextmenuex.cpp.

{
  InterlockedDecrement((long*)&g_uObjectCount);
}

Member Function Documentation

HRESULT CExtendContextMenuEx::AddMenuItems | ( | LPDATAOBJECT | ipDataObject,
 |  | LPCONTEXTMENUCALLBACK | ipCallback,
 |  | long __RPC_FAR * | pInsertionAllowed
 | ) |  |

Definition at line 100 of file contextmenuex.cpp.

{
  _ASSERT( NULL != ipCallback );
  HRESULT hResult = S_FALSE;

  static CONTEXTMENUITEM ctxMenu;
    ctxMenu.lCommandID        = IDM_QUERY_ATTRIBS;
    ctxMenu.lInsertionPointID = CCM_INSERTIONPOINTID_3RDPARTY_TASK;
    ctxMenu.fFlags            = 0;
    ctxMenu.fSpecialFlags     = 0;
    ctxMenu.strName           = L"Query Attributes";
    ctxMenu.strStatusBarText  = L"Query Device Attributes";

  // Add the Query item to the Task menu if allowed...
  if( CCM_INSERTIONALLOWED_TASK & *pInsertionAllowed )
  {
    hResult = ipCallback->AddItem( &ctxMenu );
  }

  return hResult;
}

HRESULT CExtendContextMenuEx::Command | ( | long | lCommandID,
 |  | LPDATAOBJECT | piDataObject
 | ) |  |

Definition at line 129 of file contextmenuex.cpp.

{
  HRESULT hResult = S_OK;

  switch( lCommandID )
  {
    case IDM_QUERY_ATTRIBS:
    {
      MsgBox( _T("New Queries not supported"), _T("Test") );
      break;
    }
    default:
      hResult = S_FALSE;
      break;

  }
  return hResult;
}

STDMETHODIMP CExtendContextMenuEx::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 31 of file contextmenuex.cpp.

{
  if( !ppv )
    return E_FAIL;

  *ppv = NULL;

  if( IsEqualIID(riid, IID_IUnknown) )
    *ppv = static_cast<IExtendContextMenu*>(this);
  else if( IsEqualIID(riid, IID_IExtendContextMenu) )
    *ppv = static_cast<IExtendContextMenu*>(this);

  if( *ppv )
  {
    reinterpret_cast<IUnknown*>(*ppv)->AddRef();
    return S_OK;
  }

  return E_NOINTERFACE;
}

CExtendContextMenuEx::STDMETHODIMP_ ( ULONG )
CExtendContextMenuEx::STDMETHODIMP_ ( ULONG )

Member Data Documentation

ULONG CExtendContextMenuEx::m_cRef [private]

Definition at line 25 of file contextmenuex.h.

The documentation for this class was generated from the following files:
  • SysMgmt/MMC/mmc2.0/contextmenuex/contextmenuex.h
  • SysMgmt/MMC/mmc2.0/contextmenuex/contextmenuex.cpp
Generated on Wed Nov 13 2024 16:56:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CExtendPropertySheet Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes

CExtendPropertySheet Class Reference

#include "proppagex.h"

List of all members.

Public Member Functions

CExtendPropertySheet ()
~CExtendPropertySheet ()
HRESULT STDMETHODCALLTYPE | CreatePropertyPages (LPPROPERTYSHEETCALLBACK lpProvider, LONG_PTR Handle, LPDATAOBJECT ipIDataObject)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
HRESULT STDMETHODCALLTYPE | QueryPagesFor (LPDATAOBJECT ipDataObject)
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()

Private Member Functions

BOOL | IsAttributeSet (DWORD dwAttribute)
BOOL | OnApplyChanges (HWND hPage, WPARAM wParam, LPARAM lParam)
BOOL | OnInitPropPage (HWND hPage, WPARAM wParam, LPARAM lParam)

Static Private Member Functions

static BOOL CALLBACK | PPageWndProcX (HWND hPage, UINT uMsg, WPARAM wParam, LPARAM lParam)

Private Attributes

ULONG m_cRef
DWORD m_dwXAttribs
ULONG m_nPageCount
NODE_ATTRIBS m_pNodeAttribs

Detailed Description

Definition at line 22 of file proppagex.h.

Constructor & Destructor Documentation

CExtendPropertySheet::CExtendPropertySheet ( )

Definition at line 77 of file proppagex.cpp.

{
  InterlockedIncrement((long*)&g_uObjectCount);

  //XPROPPAGE:  Register the clipformat
  g_cfNodeAttrPtr  = RegisterClipboardFormat( T_CCF_ATTRIB_PTR );

  m_cRef         = 0;
  m_nPageCount   = 1;
  m_dwXAttribs   = 0;

  TRACE_START(_T("New instance of CExtendPropertySheet") );
}

CExtendPropertySheet::~CExtendPropertySheet ( )

Definition at line 92 of file proppagex.cpp.

{
  InterlockedDecrement((long*)&g_uObjectCount);
}

Member Function Documentation

STDMETHODIMP CExtendPropertySheet::CreatePropertyPages | ( | LPPROPERTYSHEETCALLBACK | lpProvider,
 |  | LONG_PTR | Handle,
 |  | LPDATAOBJECT | ipIDataObject
 | ) |  |

Definition at line 107 of file proppagex.cpp.

{
  _ASSERT( NULL != ipDataObject );
  HRESULT hResult = S_FALSE;

  // Setup the struct we need to retrive the data
  STGMEDIUM StgMedium = { TYMED_HGLOBAL,  NULL  };
  FORMATETC FormatEtc = { g_cfNodeAttrPtr, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };

  // Ask the data object for a pointer to NODE_ATTRIBS
  hResult = ipDataObject->GetData( &FormatEtc, &StgMedium );
  NODE_ATTRIBS*  pTmpAttribs = (NODE_ATTRIBS*)GlobalLock( StgMedium.hGlobal );

  // Copy the data into a local buffer
  wcscpy( m_pNodeAttribs.szObjectPath, pTmpAttribs->szObjectPath );

  // Now we can unlock and free hGlobal
  GlobalUnlock( StgMedium.hGlobal );
  GlobalFree( StgMedium.hGlobal );

  HPROPSHEETPAGE hPPage = NULL;
  PROPSHEETPAGE  psp;
  ZeroMemory( &psp, sizeof(PROPSHEETPAGE) );

  psp.dwSize      = sizeof(PROPSHEETPAGE);
  psp.dwFlags     = PSP_DEFAULT | PSP_USETITLE;  // | PSP_HASHELP;
  psp.hInstance   = g_hInst;
  psp.pszTemplate = MAKEINTRESOURCE(IDD_PPAGE0);
  psp.pfnDlgProc  = PPageWndProcX;
  psp.lParam      = reinterpret_cast<LPARAM>(this);
  psp.pszTitle    = _T("Extended");
  psp.pfnCallback = NULL;

  hPPage  = ::CreatePropertySheetPage( &psp );

  hResult = lpCallback->AddPage( hPPage );

  return hResult;
}

BOOL CExtendPropertySheet::IsAttributeSet ( DWORD dwAttribute ) [private]

Definition at line 282 of file proppagex.cpp.

{
  return (m_dwXAttribs & dwAttribute) ? TRUE : FALSE;
}

BOOL CExtendPropertySheet::OnApplyChanges | ( | HWND | hPage,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private]

Definition at line 269 of file proppagex.cpp.

{
  // In this sample we're not saving changes.
  return TRUE;
}

BOOL CExtendPropertySheet::OnInitPropPage | ( | HWND | hPage,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private]

Definition at line 246 of file proppagex.cpp.

{
  LRESULT lResult = 0;

  HWND hCompressCtrl  = GetDlgItem( hPage, IDC_ATTR_COMPRESSED );
  HWND hEncryptedCtrl = GetDlgItem( hPage, IDC_ATTR_ENCRYPTED  );

  if( TRUE == IsAttributeSet( ATTRIBUTE_DATA_COMPRESSED ) )
    lResult = SendMessage( hCompressCtrl,  BM_SETCHECK, BST_CHECKED, 0 );

  if( TRUE == IsAttributeSet( ATTRIBUTE_DATA_ENCRYPTED ) )
    lResult = SendMessage( hEncryptedCtrl,  BM_SETCHECK, BST_CHECKED, 0 );

  return TRUE;
}

BOOL CALLBACK CExtendPropertySheet::PPageWndProcX | ( | HWND | hPage,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static, private]

Definition at line 172 of file proppagex.cpp.

{
  static CExtendPropertySheet* pApp = NULL;
         BOOL bReturn = FALSE;

  switch( uMsg )                       // Begin message switch
  {
    case WM_INITDIALOG:
    {
      // Cache the pointer to the calling instance of CExtendPropertySheet
      // and call it's OnInitPropPage method
      PROPSHEETPAGE* psp = (PROPSHEETPAGE*)lParam;
      pApp = reinterpret_cast<CExtendPropertySheet*>(psp->lParam);
      pApp->OnInitPropPage( hPage, wParam, lParam );
      break;
    }
    case WM_HELP:
    {
      // Not handling WM_HELP in this sample
      break;
    }
    case WM_COMMAND:
    {
      // Activate the 'Apply' button if the user clicked a button
      if( BN_CLICKED == HIWORD(wParam) )
        SendMessage(GetParent(hPage), PSM_CHANGED, (WPARAM)hPage, 0);

      break;
    }
    case WM_DESTROY:
    {
      TRACE_START( _T("WM_DESTROY") );
      bReturn = TRUE;
    }

    case WM_NOTIFY:
    {
      if( 0 == lParam )  //BUGLIST:  AV if we don't do this
        return 0;

      switch( (reinterpret_cast<NMHDR*>(lParam))->code )
      {
        case PSN_APPLY:      // Really the 'OK' button
        {
          pApp->OnApplyChanges( hPage, wParam, lParam );
          return PSNRET_NOERROR;
        }
        case PSN_HELP:
        {
          return PSNRET_NOERROR;
        }
        default:
        {
          break;
        }
      } //end lParam->code switch
    } // end WM_NOTIFY

    default: break;

  } // end uMsg switch

  return bReturn;

}

STDMETHODIMP CExtendPropertySheet::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 31 of file proppagex.cpp.

{
  if( !ppv )
    return E_FAIL;

  *ppv = NULL;

  if( IsEqualIID(riid, IID_IUnknown) )
    *ppv = static_cast<IExtendPropertySheet*>(this);
  else if( IsEqualIID(riid, IID_IExtendPropertySheet) )
    *ppv = static_cast<IExtendPropertySheet*>(this);

  if( *ppv )
  {
    reinterpret_cast<IUnknown*>(*ppv)->AddRef();
    return S_OK;
  }

  return E_NOINTERFACE;
}

STDMETHODIMP CExtendPropertySheet::QueryPagesFor ( LPDATAOBJECT ipDataObject )

Definition at line 155 of file proppagex.cpp.

{
  _ASSERT( NULL != ipDataObject );
  return S_OK;
}

CExtendPropertySheet::STDMETHODIMP_ ( ULONG )
CExtendPropertySheet::STDMETHODIMP_ ( ULONG )

Member Data Documentation

ULONG CExtendPropertySheet::m_cRef [private]

Definition at line 25 of file proppagex.h.

DWORD CExtendPropertySheet::m_dwXAttribs [private]

Definition at line 28 of file proppagex.h.

ULONG CExtendPropertySheet::m_nPageCount [private]

Definition at line 26 of file proppagex.h.

NODE_ATTRIBS CExtendPropertySheet::m_pNodeAttribs [private]

Definition at line 27 of file proppagex.h.

The documentation for this class was generated from the following files:
  • SysMgmt/MMC/mmc2.0/proppagex/proppagex.h
  • SysMgmt/MMC/mmc2.0/proppagex/proppagex.cpp
Generated on Wed Nov 13 2024 16:56:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CExtObject Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Protected Attributes

CExtObject Class Reference

#include "ExtObj.h"

List of all members.

Public Member Functions

CExtObject (void)
CExtObject (void)
STDMETHOD() | AddContextMenuItems (IUnknown *piDataIn, IWCContextMenuCallback *piCallbackIn)
BOOL | BWizard (void) const
BOOL | BWizard (void) const
LONG | Cobj (void) const
LONG | Cobj (void) const
CLUADMEX_OBJECT_TYPE | Cot ()
CLUADMEX_OBJECT_TYPE | Cot ()
STDMETHOD() | CreatePropertySheetPages (IUnknown *piDataIn, IWCPropertySheetCallback *piCallbackIn)
STDMETHOD() | CreatePropertySheetPages (IUnknown *piDataIn, IWCPropertySheetCallback *piCallbackIn)
STDMETHOD() | CreateWizardPages (IUnknown *piDataIn, IWCWizardCallback *piCallbackIn)
STDMETHOD() | CreateWizardPages (IUnknown *piDataIn, IWCWizardCallback *piCallbackIn)
DECLARE_REGISTRY (CExtObject, _T("CLUADMEX.ClipBookServerEx"), _T("CLUADMEX.ClipBookServerEx"), IDS_CLUADMEX_COMOBJ_DESC, THREADFLAGS_APARTMENT)
DECLARE_REGISTRY (CExtObject, _T("CLUADMEX.FileShareSampleEx"), _T("CLUADMEX.FileShareSampleEx"), IDS_CLUADMEX_COMOBJ_DESC, THREADFLAGS_APARTMENT)
HCLUSTER | Hcluster (void) const
HCLUSTER | Hcluster (void) const
HFONT | Hfont (void) const
HFONT | Hfont (void) const
HICON | Hicon (void) const
HICON | Hicon (void) const
HRESULT | HrGetObjectInfo (void)
HRESULT | HrGetObjectInfo (void)
STDMETHOD() | InterfaceSupportsErrorInfo (REFIID riid)
STDMETHOD() | InterfaceSupportsErrorInfo (REFIID riid)
STDMETHOD() | InvokeCommand (ULONG nCommandIDIn, IUnknown *piDataIn)
LCID | Lcid (void) const
LCID | Lcid (void) const
IWCWizardCallback * | PiWizardCallback (void) const
IWCWizardCallback * | PiWizardCallback (void) const
CObjData * | PodObjData (void)
CObjData * | PodObjData (void)

Protected Member Functions

virtual | ~CExtObject (void)
virtual | ~CExtObject (void)
HRESULT | HrGetUIInfo (IUnknown *piDataIn)
HRESULT | HrGetUIInfo (IUnknown *piDataIn)
HRESULT | HrSaveData (IUnknown *piDataIn)
HRESULT | HrSaveData (IUnknown *piDataIn)

Protected Attributes

BOOL m_bWizard
LONG | m_cobj
HCLUSTER | m_hCluster
HFONT | m_hfont
HICON | m_hicon
LCID | m_lcid
CPageList m_lpg
IUnknown * | m_piData
IWCWizardCallback * | m_piWizardCallback
CObjData * m_podObjData

Detailed Description

Definition at line 54 of file ExtObj.h.

Constructor & Destructor Documentation

CExtObject::CExtObject ( void )

Definition at line 48 of file ExtObj.cpp.

{
    m_piData = NULL;
    m_piWizardCallback = NULL;
    m_bWizard = FALSE;

    m_lcid = NULL;
    m_hfont = NULL;
    m_hicon = NULL;
    m_hCluster = NULL;
    m_cobj = 0;
    m_podObjData = NULL;

} //*** CExtObject::CExtObject

CExtObject::~CExtObject ( void ) [protected, virtual]

Definition at line 79 of file ExtObj.cpp.

{
    POSITION    pos = NULL;

    //
    // Release the data interface.
    //

    if ( m_piData != NULL )
    {
        m_piData->Release();
        m_piData = NULL;
    } // if:  we have a data interface pointer

    //
    // Release the wizard callback interface.
    //

    if ( m_piWizardCallback != NULL )
    {
        m_piWizardCallback->Release();
        m_piWizardCallback = NULL;
    } // if:  we have a wizard callback interface pointer

    //
    // Delete the pages.
    //

    pos = m_lpg.GetHeadPosition();
    while ( pos != NULL )
    {
        delete m_lpg.GetNext(pos);
    } // while:  more pages in the list

    //
    // Delete the object.
    //

    delete m_podObjData;
    m_podObjData = NULL;

} //*** CExtObject::~CExtObject

CExtObject::CExtObject ( void )
virtual CExtObject::~CExtObject ( void ) [protected, virtual]

Member Function Documentation

STDMETHODIMP CExtObject::AddContextMenuItems | ( | IUnknown * | piDataIn,
 |  | IWCContextMenuCallback * | piCallbackIn
 | ) |  |

Definition at line 607 of file ExtObj.cpp.

{
    HRESULT     hr = S_OK;

    AFX_MANAGE_STATE( AfxGetStaticModuleState() );

    //
    // Validate the parameters.
    //

    if ( (piDataIn == NULL) || (piCallbackIn == NULL) )
    {
        hr = E_INVALIDARG;
        goto Cleanup;
    } // if: not all interfaces not specified

    //
    //  Since the MFC collection classes can throw exceptions a minimal try
    //  catch block is needed.
    //

    try
    {
        //
        // Get info about displaying UI.
        //

        hr = HrGetUIInfo( piDataIn );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:  error getting UI info

        //
        // Save the data.
        //

        hr = HrSaveData( piDataIn );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:  error saving data from host

        //
        //  Add the context menu.
        //

        hr = m_podObjData->AddContextMenuItems( piCallbackIn );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:  error saving data from host
    } // try:
    catch ( CMemoryException * pme )
    {
        //
        //  An MFC memory exception occurred.
        //

        TRACE( _T("CExtObject::AddContextMenuItems() - Failed to add menu items\n") );

        pme->Delete();
        hr = E_OUTOFMEMORY;
    } // catch: MFC memory exception.
    catch( ... )
    {
        //
        //  An unknown exception occurred.
        //

        hr = E_UNEXPECTED;
    } // catch: anything.

Cleanup:

    //
    //  Contractually obligated to release these interfaces. Cluadmin did
    //  an AddRef on them before we were called.
    //

    piDataIn->Release();
    piCallbackIn->Release();

    return hr;

} //*** CExtObject::AddContextMenuItems

BOOL CExtObject::BWizard ( void ) const [inline]

Definition at line 123 of file ExtObj.h.

{ return m_bWizard; }

BOOL CExtObject::BWizard ( void ) const [inline]

Definition at line 146 of file ExtObj.h.

{ return m_bWizard; }

LONG CExtObject::Cobj ( void ) const [inline]

Definition at line 130 of file ExtObj.h.

{ return m_cobj; }

LONG CExtObject::Cobj ( void ) const [inline]

Definition at line 153 of file ExtObj.h.

{ return m_cobj; }

CLUADMEX_OBJECT_TYPE CExtObject::Cot ( void ) [inline]

Definition at line 113 of file ExtObj.h.

{ return (m_podObjData != NULL) ? m_podObjData->Cot() : CLUADMEX_OT_NONE; }

CLUADMEX_OBJECT_TYPE CExtObject::Cot ( void ) [inline]

Definition at line 136 of file ExtObj.h.

{ return (m_podObjData != NULL) ? m_podObjData->Cot() : CLUADMEX_OT_NONE; }

STDMETHOD() CExtObject::CreatePropertySheetPages | ( | IUnknown * | piDataIn,
 |  | IWCPropertySheetCallback * | piCallbackIn
 | ) |  |
STDMETHODIMP CExtObject::CreatePropertySheetPages | ( | IUnknown * | piDataIn,
 |  | IWCPropertySheetCallback * | piCallbackIn
 | ) |  |

Definition at line 204 of file ExtObj.cpp.

{
    HRESULT             hr = S_OK;
    CRuntimeClass **    pprtc = NULL;
    int                 irtc = 0;
    CBasePropertyPage * ppage = NULL;
    POSITION            pos = NULL;

    AFX_MANAGE_STATE( AfxGetStaticModuleState() );

    //
    // Validate the parameters.
    //

    if ( (piDataIn == NULL) || (piCallbackIn == NULL) )
    {
        hr = E_INVALIDARG;
        goto Cleanup;
    } // if:  all interfaces not specified

    //
    //  Since the MFC collection classes can throw exceptions a minimal try
    //  catch block is needed.
    //

    try
    {
        //
        // Get info about displaying UI.
        //

        hr = HrGetUIInfo( piDataIn );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:  error getting UI info

        //
        // Save the data.
        //

        hr = HrSaveData( piDataIn );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:  error saving data from host

        //
        // Delete any previous pages.
        //

        pos = m_lpg.GetHeadPosition();
        while ( pos != NULL )
        {
            delete m_lpg.GetNext( pos );
        } // while:  more pages in the list

        m_lpg.RemoveAll();

        //
        // Create property pages.
        //

        ASSERT( m_podObjData != NULL );
        hr = m_podObjData->GetPropertySheetPages( &pprtc );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if: failed to get the property sheet pages.

        //
        // Create each page.
        //

        for ( irtc = 0 ; pprtc[ irtc ] != NULL ; irtc++ )
        {
            //
            // Create the page.
            //

            ppage = static_cast< CBasePropertyPage * >( pprtc[ irtc ]->CreateObject() );
            ASSERT( ppage->IsKindOf( pprtc[ irtc ] ) );

            //
            // Add it to the list.
            //

            m_lpg.AddTail( ppage );

            //
            // Initialize the property page.
            //

            hr = ppage->HrInit( this );
            if ( FAILED( hr ) )
            {
                goto Cleanup;
            } // if:  error initializing the page

            //
            // Create the page.
            //

            hr = ppage->HrCreatePage();
            if ( FAILED( hr ) )
            {
                goto Cleanup;
            } // if:  error creating the page

            //
            // Add it to the property sheet.
            //

            hr = piCallbackIn->AddPropertySheetPage( reinterpret_cast< LONG * >( ppage->Hpage() ) );
            if ( FAILED( hr ) )
            {
                goto Cleanup;
            } // if:  error adding the page to the sheet
        } // for:  each page in the list
    } // try:
    catch ( CMemoryException * pme )
    {
        //
        //  An MFC memory exception occurred.
        //

        TRACE( _T("CExtObject::CreatePropetySheetPages() - Failed to add property page\n") );

        pme->Delete();
        hr = E_OUTOFMEMORY;
    } // catch:  MFC memory exception.
    catch( ... )
    {
        //
        //  An unknown exception occurred.
        //

        hr = E_UNEXPECTED;
    } // catch: anything.

Cleanup:

    //
    //  Contractually obligated to release these interfaces. Cluadmin did
    //  an AddRef on them before we were called.
    //

    piDataIn->Release();
    piCallbackIn->Release();

    return hr;

} //*** CExtObject::CreatePropertySheetPages

STDMETHOD() CExtObject::CreateWizardPages | ( | IUnknown * | piDataIn,
 |  | IWCWizardCallback * | piCallbackIn
 | ) |  |
STDMETHODIMP CExtObject::CreateWizardPages | ( | IUnknown * | piDataIn,
 |  | IWCWizardCallback * | piCallbackIn
 | ) |  |

Definition at line 393 of file ExtObj.cpp.

{
    HRESULT             hr = S_OK;
    CRuntimeClass **    pprtc = NULL;
    int                 irtc = 0;
    CBasePropertyPage * ppage = NULL;
    POSITION            pos = NULL;

    AFX_MANAGE_STATE( AfxGetStaticModuleState() );

    //
    // Validate the parameters.
    //

    if ( (piDataIn == NULL) || (piCallbackIn == NULL) )
    {
        hr = E_INVALIDARG;
        goto Cleanup;
    } // if:  all interfaces not specified

    //
    //  Since the MFC collection classes can throw exceptions a minimal try
    //  catch block is needed.
    //

    try
    {
        //
        // Get info about displaying UI.
        //

        hr = HrGetUIInfo( piDataIn );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:  error getting UI info

        //
        // Save the data.
        //

        hr = HrSaveData( piDataIn );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:  error saving data from host

        //
        // Delete any previous pages.
        //

        pos = m_lpg.GetHeadPosition();
        while ( pos != NULL )
        {
            delete m_lpg.GetNext( pos );
        } // while:  more pages in the list

        m_lpg.RemoveAll();

        //
        // Update our callback pointer.
        //

        piCallbackIn->AddRef();
        m_piWizardCallback = piCallbackIn;

        m_bWizard = TRUE;

        //
        // Create property pages.
        //

        ASSERT( m_podObjData != NULL );
        hr = m_podObjData->GetWizardPages( &pprtc );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if: failed to get the wizard pages.

        //
        // Create each page.
        //

        for ( irtc = 0 ; pprtc[ irtc ] != NULL ; irtc++ )
        {
            //
            // Create the page.
            //

            ppage = static_cast< CBasePropertyPage * >( pprtc[ irtc ]->CreateObject() );
            ASSERT( ppage->IsKindOf( pprtc[ irtc ] ) );

            //
            // Add it to the list.
            //

            m_lpg.AddTail( ppage );

            //
            // Initialize the property page.
            //

            hr = ppage->HrInit( this );
            if ( FAILED( hr ) )
            {
                goto Cleanup;
            } // if:  error initializing the page

            //
            // Create the page.
            //

            hr = ppage->HrCreatePage();
            if ( FAILED( hr ) )
            {
                goto Cleanup;
            } // if:  error creating the page

            //
            // Add it to the property sheet.
            //

            hr = piCallbackIn->AddWizardPage( reinterpret_cast< LONG * >( ppage->Hpage() ) );
            if ( FAILED( hr ) )
            {
                goto Cleanup;
            } // if:  error adding the page to the sheet
        } // for:  each page in the list
    } // try:
    catch ( CMemoryException * pme )
    {
        //
        //  An MFC memory exception occurred.
        //

        TRACE( _T("CExtObject::CreateWizardPages() - Failed to add wizard page\n") );

        pme->Delete();
        hr = E_OUTOFMEMORY;
    } // catch: MFC memory exception.
    catch( ... )
    {
        //
        //  An unknown exception occurred.
        //

        hr = E_UNEXPECTED;
    } // catch: anything.

Cleanup:

    //
    //  If we failed for any reason then we need to cleanup up the wizard
    //  callback interface if we saved it off.
    //

    if ( FAILED( hr ) )
    {
        if ( m_piWizardCallback == piCallbackIn )
        {
            m_piWizardCallback->Release();
            m_piWizardCallback = NULL;
        } // if: already saved interface pointer
    } // if:  error occurred

    //
    //  Contractually obligated to release these interfaces. Cluadmin did
    //  an AddRef on them before we were called.
    //

    piDataIn->Release();
    piCallbackIn->Release();

    return hr;

} //*** CExtObject::CreateWizardPages

CExtObject::DECLARE_REGISTRY | ( | CExtObject | ,
 |  | _T("CLUADMEX.FileShareSampleEx") | ,
 |  | _T("CLUADMEX.FileShareSampleEx") | ,
 |  | IDS_CLUADMEX_COMOBJ_DESC | ,
 |  | THREADFLAGS_APARTMENT |
 | ) |  |
CExtObject::DECLARE_REGISTRY | ( | CExtObject | ,
 |  | _T("CLUADMEX.ClipBookServerEx") | ,
 |  | _T("CLUADMEX.ClipBookServerEx") | ,
 |  | IDS_CLUADMEX_COMOBJ_DESC | ,
 |  | THREADFLAGS_APARTMENT |
 | ) |  |
HCLUSTER CExtObject::Hcluster ( void ) const [inline]

Definition at line 129 of file ExtObj.h.

{ return m_hCluster; }

HCLUSTER CExtObject::Hcluster ( void ) const [inline]

Definition at line 152 of file ExtObj.h.

{ return m_hCluster; }

HFONT CExtObject::Hfont ( void ) const [inline]

Definition at line 143 of file ExtObj.h.

{ return m_hfont; }

HFONT CExtObject::Hfont ( void ) const [inline]

Definition at line 120 of file ExtObj.h.

{ return m_hfont; }

HICON CExtObject::Hicon ( void ) const [inline]

Definition at line 121 of file ExtObj.h.

{ return m_hicon; }

HICON CExtObject::Hicon ( void ) const [inline]

Definition at line 144 of file ExtObj.h.

{ return m_hicon; }

HRESULT CExtObject::HrGetObjectInfo ( void )
HRESULT CExtObject::HrGetObjectInfo ( void )

Definition at line 754 of file ExtObj.cpp.

{
    HRESULT hr = S_OK;

    //
    // Delete the old object and create a new one.
    //

    delete m_podObjData;
    m_podObjData = NULL;

    hr = CObjData::S_HrCreateObject( m_piData, &m_podObjData );

    return hr;

} //*** CExtObject::HrGetObjectInfo

HRESULT CExtObject::HrGetUIInfo ( IUnknown * piDataIn ) [protected]

Definition at line 600 of file ExtObj.cpp.

{
    ASSERT( piDataIn != NULL );

    HRESULT             hr = S_OK;
    IGetClusterUIInfo * pi = NULL;

    //
    // Save info about all types of objects.
    //

    hr = piDataIn->QueryInterface( IID_IGetClusterUIInfo, reinterpret_cast< LPVOID * >( &pi ) );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:  error querying for interface

    m_lcid = pi->GetLocale();
    m_hfont = pi->GetFont();
    m_hicon = pi->GetIcon();

Cleanup:

    if ( pi != NULL )
    {
        pi->Release();
    } // if:

    return hr;

} //*** CExtObject::HrGetUIInfo

HRESULT CExtObject::HrGetUIInfo ( IUnknown * piDataIn ) [protected]
HRESULT CExtObject::HrSaveData ( IUnknown * piDataIn ) [protected]

Definition at line 662 of file ExtObj.cpp.

{
    ASSERT( piDataIn != NULL );

    HRESULT                 hr = S_OK;
    IGetClusterDataInfo *   pi = NULL;

    //
    //  Save the new piData interface.
    //

    if ( piDataIn != m_piData )
    {
        if ( m_piData != NULL )
        {
            m_piData->Release();
        } // if:  interface queried for previously

        piDataIn->AddRef();
        m_piData = piDataIn;
    } // if:  different data interface pointer

    //
    // Save info about all types of objects.
    //

    hr = piDataIn->QueryInterface( IID_IGetClusterDataInfo, reinterpret_cast< LPVOID * >( &pi ) );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:  error querying for interface

    m_hCluster = pi->GetClusterHandle();

    m_cobj = pi->GetObjectCount();
    if ( m_cobj != 1 )  // We only have support for one selected object.
    {
        hr = E_NOTIMPL;
        goto Cleanup;
    } // if:  too many objects for us to handle

    //
    // Save info about this object.
    //

    hr = HrGetObjectInfo();
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

Cleanup:

    if ( pi != NULL )
    {
        pi->Release();
    } // if:

    return hr;

} //*** CExtObject::HrSaveData

HRESULT CExtObject::HrSaveData ( IUnknown * piDataIn ) [protected]
STDMETHODIMP CExtObject::InterfaceSupportsErrorInfo ( REFIID riid )

Definition at line 145 of file ExtObj.cpp.

{
    HRESULT hr = S_FALSE;
    int iiid = 0;
    static const IID * rgiid[] =
    {
          &IID_IWEExtendPropertySheet
        , &IID_IWEExtendWizard
    };

    for ( iiid = 0 ; iiid < sizeof( rgiid ) / sizeof( rgiid[ 0 ] ) ; iiid++ )
    {
        if ( ::InlineIsEqualGUID( *rgiid[ iiid ], riid ) )
        {
            hr = S_OK;
            goto Cleanup;
        } // if: found a matching IID
    } // for: each interface we support

Cleanup:

    return hr;

} //*** CExtObject::InterfaceSupportsErrorInfo

STDMETHOD() CExtObject::InterfaceSupportsErrorInfo ( REFIID riid )
HRESULT CExtObject::InvokeCommand | ( | ULONG | nCommandIDIn,
 |  | IUnknown * | piDataIn
 | ) |  |

Definition at line 727 of file ExtObj.cpp.

{
    HRESULT hr = S_OK;

    AFX_MANAGE_STATE( AfxGetStaticModuleState() );

    //
    // Check parameters.
    //
    if ( piDataIn == NULL )
    {
        hr = E_INVALIDARG;
        goto Cleanup;
    } // if:  interface not specified

    //
    //  Since the MFC collection classes can throw exceptions a minimal try
    //  catch block is needed.
    //

    try
    {
        //
        // Get info about displaying UI.
        //

        hr = HrGetUIInfo( piDataIn );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:  error getting UI info

        //
        // Save the data.
        //

        hr = HrSaveData( piDataIn );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:

        ASSERT( m_podObjData != NULL );
        hr = m_podObjData->InvokeCommand( nCommandIDIn );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:
    } // try:
    catch ( CMemoryException * pme )
    {
        //
        //  An MFC memory exception occurred.
        //

        TRACE( _T("CExtObject::InvokeCommand() - Invoking the context menu command failed\n") );

        pme->Delete();
        hr = E_OUTOFMEMORY;
    } // catch: MFC memory exception.
    catch( ... )
    {
        //
        //  An unknown exception occurred.
        //

        hr = E_UNEXPECTED;
    } // catch: anything.

Cleanup:

    //
    //  Contractually obligated to release these interfaces. Cluadmin did
    //  an AddRef on them before we were called.
    //

    piDataIn->Release();

    return hr;

} //*** CExtObject::InvokeCommand

LCID CExtObject::Lcid ( void ) const [inline]

Definition at line 119 of file ExtObj.h.

{ return m_lcid; }

LCID CExtObject::Lcid ( void ) const [inline]

Definition at line 142 of file ExtObj.h.

{ return m_lcid; }

IWCWizardCallback* CExtObject::PiWizardCallback ( void ) const [inline]

Definition at line 122 of file ExtObj.h.

{ return m_piWizardCallback; }

IWCWizardCallback* CExtObject::PiWizardCallback ( void ) const [inline]

Definition at line 145 of file ExtObj.h.

{ return m_piWizardCallback; }

CObjData* CExtObject::PodObjData ( void ) [inline]

Definition at line 131 of file ExtObj.h.

{ return m_podObjData; }

CObjData* CExtObject::PodObjData ( void ) [inline]

Definition at line 154 of file ExtObj.h.

{ return m_podObjData; }

Member Data Documentation

BOOL CExtObject::m_bWizard [protected]

Definition at line 142 of file ExtObj.h.

LONG CExtObject::m_cobj [protected]

Definition at line 157 of file ExtObj.h.

HCLUSTER CExtObject::m_hCluster [protected]

Definition at line 156 of file ExtObj.h.

HFONT CExtObject::m_hfont [protected]

Definition at line 149 of file ExtObj.h.

HICON CExtObject::m_hicon [protected]

Definition at line 150 of file ExtObj.h.

LCID CExtObject::m_lcid [protected]

Definition at line 148 of file ExtObj.h.

CPageList CExtObject::m_lpg [protected]

Definition at line 170 of file ExtObj.h.

IUnknown * CExtObject::m_piData [protected]

Definition at line 140 of file ExtObj.h.

IWCWizardCallback * CExtObject::m_piWizardCallback [protected]

Definition at line 141 of file ExtObj.h.

CObjData * CExtObject::m_podObjData [protected]

Definition at line 159 of file ExtObj.h.

The documentation for this class was generated from the following files:
  • WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/ExtObj.h
  • WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/ExtObj.h
  • WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/ExtObj.cpp
  • WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/ExtObj.cpp
Generated on Wed Nov 13 2024 16:56:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CExtPageUser Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends

CExtPageUser Class Reference

#include "extpageuser.h"

Inherits CPropertyPage.

List of all members.

Public Types

enum | { IDD = IDD_USER_PAGE_EXT }

Public Member Functions

CExtPageUser (CWizExtUser *pWizExt)
virtual | ~CExtPageUser ()
afx_msg void | OnChangePicture ()
afx_msg void | OnClearPicture ()
virtual BOOL | OnInitDialog ()
virtual BOOL | OnKillActive ()
virtual BOOL | OnSetActive ()

Private Member Functions

CButton * | GetChangePictureButton ()
CButton * | GetClearPictureButton ()
CEdit * | GetIDEdit ()
CEdit * | GetPathEdit ()
CStatic * | GetPicture ()
void | GetSummaryInfo (BSTR *pBstrText)
void | SetWizardButtons ()
HRESULT | WriteDataHelper ()

Private Attributes

CWizExtUser * m_pWizExt
CThumbNailPhotoHolder m_thumbNailPhotoHolder

Friends

class | CWizExtUser

Detailed Description

Definition at line 19 of file extpageuser.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 32 of file extpageuser.h.

{ IDD = IDD_USER_PAGE_EXT};

Constructor & Destructor Documentation

CExtPageUser::CExtPageUser ( CWizExtUser * pWizExt ) [inline]

Definition at line 22 of file extpageuser.h.

    : CPropertyPage(IDD_USER_PAGE_EXT)
  {
    m_pWizExt = pWizExt;
  }

virtual CExtPageUser::~CExtPageUser ( ) [inline, virtual]

Definition at line 28 of file extpageuser.h.

  {
  }

Member Function Documentation

CButton* CExtPageUser::GetChangePictureButton ( ) [inline, private]

Definition at line 43 of file extpageuser.h.

{ return (CButton*)GetDlgItem(IDC_BUTTON_CHANGE_PICTURE); }

CButton* CExtPageUser::GetClearPictureButton ( ) [inline, private]

Definition at line 44 of file extpageuser.h.

{ return (CButton*)GetDlgItem(IDC_BUTTON_CLEAR_PICTURE); }

CEdit* CExtPageUser::GetIDEdit ( ) [inline, private]

Definition at line 46 of file extpageuser.h.

{ return (CEdit*)GetDlgItem(IDC_EDIT_EMPLOYEE_ID); }

CEdit* CExtPageUser::GetPathEdit ( ) [inline, private]

Definition at line 45 of file extpageuser.h.

{ return (CEdit*)GetDlgItem(IDC_EDIT_PICTURE_PATH); }

CStatic* CExtPageUser::GetPicture ( ) [inline, private]

Definition at line 47 of file extpageuser.h.

{ return (CStatic*)GetDlgItem(IDC_PICTURE_DISPLAY); }

void CExtPageUser::GetSummaryInfo ( BSTR * pBstrText ) [private]

Definition at line 126 of file extpageuser.cpp.

{
  //
  // Format the summary string which will be displayed on the finish page of the wizard.
  //
  CString szEmployeeID;
  GetIDEdit()->GetWindowText(szEmployeeID);

  CString strSummary;
  strSummary.Format(_T("Extension summary:\n\tEmployee ID: %s\n"), (LPCWSTR)szEmployeeID);

  //
  // Copy to BSTR
  //
  *pBstrText = ::SysAllocString(strSummary);

}

void CExtPageUser::OnChangePicture ( )

Definition at line 75 of file extpageuser.cpp.

{
  //
  // just call the thumbnail photo holder to do the job
  //
  m_thumbNailPhotoHolder.Change(m_hWnd);
}

void CExtPageUser::OnClearPicture ( )

Definition at line 85 of file extpageuser.cpp.

{
  //
  // just call the thumbnail photo holder to do the job
  //
  m_thumbNailPhotoHolder.Clear();
}

BOOL CExtPageUser::OnInitDialog ( ) [virtual]

Definition at line 21 of file extpageuser.cpp.

{
  BOOL bResult = CPropertyPage::OnInitDialog();

  //
  // Set the name of the container
  //
  SetDlgItemText(IDC_EDIT_CONTAINER, m_pWizExt->GetContainerCanonicalName());

  //
  // Set the class icon
  //
  ((CStatic*)GetDlgItem(IDC_STATIC_ICON))->SetIcon(m_pWizExt->GetClassIcon());

  //
  // Initialize the object that manipulates the thumbnail photo
  //
  m_thumbNailPhotoHolder.Initialize(GetPathEdit()->m_hWnd, GetPicture()->m_hWnd);

  return bResult;
}

BOOL CExtPageUser::OnKillActive ( ) [virtual]

Definition at line 43 of file extpageuser.cpp.

{
  //
  // Write changes to temporary object
  //
  ASSERT(m_pWizExt != NULL);
  return (SUCCEEDED(WriteDataHelper()));
}

BOOL CExtPageUser::OnSetActive ( ) [virtual]

Definition at line 52 of file extpageuser.cpp.

{
  //
  // Make sure we reset the next/back buttons state, just in case
  // some other extension changes it
  //
  SetWizardButtons();

  return TRUE;
}

void CExtPageUser::SetWizardButtons ( ) [private]

Definition at line 63 of file extpageuser.cpp.

{
  ASSERT(m_pWizExt != NULL);

  //
  // Always enable the next button, we allow to have
  // the fields not filled in.
  //

  HRESULT hr = m_pWizExt->GetIDsAdminNewObj()->SetButtons(0, TRUE /*bValid*/);
}

HRESULT CExtPageUser::WriteDataHelper ( ) [private]

Definition at line 95 of file extpageuser.cpp.

{
  ASSERT(m_pWizExt->GetObj() != NULL);
  //
  // Write the data from the page to the temporary object given to the extension
  // by SetObject()
  //

  HRESULT hr = S_OK;

  CString szEmployeeID;
  GetIDEdit()->GetWindowText(szEmployeeID);
  hr = SetStringAttribute(m_pWizExt->GetObj(), _T("employeeID"), szEmployeeID);
  if (FAILED(hr))
  {
    // Format and display error message
    CString szErrorMessage;
    szErrorMessage.Format(_T("Failed to set employeeID to %s, hr = 0x%x"), (LPCWSTR)szEmployeeID, hr);
    AfxMessageBox(szErrorMessage);
    return hr;
  }

  //
  // Set the thumbnail photo in the temporary object
  //
  hr = m_thumbNailPhotoHolder.Write(m_pWizExt->GetObj());

  return hr;
}

Friends And Related Function Documentation

friend class CWizExtUser [friend]

Definition at line 60 of file extpageuser.h.

Member Data Documentation

CWizExtUser* CExtPageUser::m_pWizExt [private]

Definition at line 59 of file extpageuser.h.

CThumbNailPhotoHolder CExtPageUser::m_thumbNailPhotoHolder [private]

Definition at line 56 of file extpageuser.h.

The documentation for this class was generated from the following files:
  • NetDS/ADSI/samples/DSUI/userext/userwizard/extpageuser.h
  • NetDS/ADSI/samples/DSUI/userext/userwizard/extpageuser.cpp
Generated on Wed Nov 13 2024 16:56:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CExtractIcon Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CExtractIcon Class Reference

#include "ExtrIcon.h"

List of all members.

Public Member Functions

CExtractIcon (LPCITEMIDLIST)
~CExtractIcon ()
STDMETHOD() | Extract (LPCTSTR, UINT, HICON *, HICON *, UINT)
STDMETHOD() | GetIconLocation (UINT, LPTSTR, UINT, LPINT, LPUINT)
STDMETHOD() | QueryInterface (REFIID riid, LPVOID *ppvObj)
STDMETHOD_ (ULONG, AddRef)(VOID)
STDMETHOD_ (ULONG, Release)(VOID)

Private Attributes

DWORD m_ObjRefCount
LPITEMIDLIST | m_pidl
CPidlMgr * m_pPidlMgr

Detailed Description

Definition at line 36 of file ExtrIcon.h.

Constructor & Destructor Documentation

CExtractIcon::CExtractIcon ( LPCITEMIDLIST pidl )

Definition at line 30 of file ExtrIcon.Cpp.

{
g_DllRefCount++;

m_pPidlMgr = new CPidlMgr();
if(!m_pPidlMgr)
   {
   delete this;
   return;
   }

m_pidl = m_pPidlMgr->Copy(pidl);

m_ObjRefCount = 1;
}

CExtractIcon::~CExtractIcon ( )

Definition at line 52 of file ExtrIcon.Cpp.

{
if(m_pidl)
   {
   m_pPidlMgr->Delete(m_pidl);
   m_pidl = NULL;
   }

if(m_pPidlMgr)
   {
   delete m_pPidlMgr;
   }

g_DllRefCount--;
}

Member Function Documentation

STDMETHODIMP CExtractIcon::Extract | ( | LPCTSTR | pszFile,
 |  | UINT | nIconIndex,
 |  | HICON * | phiconLarge,
 |  | HICON * | phiconSmall,
 |  | UINT | nIconSize
 | ) |  |

Definition at line 182 of file ExtrIcon.Cpp.

{
*phiconLarge = ImageList_GetIcon(g_himlLarge, nIconIndex, ILD_TRANSPARENT);
*phiconSmall = ImageList_GetIcon(g_himlSmall, nIconIndex, ILD_TRANSPARENT);

return S_OK;
}

STDMETHODIMP CExtractIcon::GetIconLocation | ( | UINT | uFlags,
 |  | LPTSTR | szIconFile,
 |  | UINT | cchMax,
 |  | LPINT | piIndex,
 |  | LPUINT | puFlags
 | ) |  |

Definition at line 143 of file ExtrIcon.Cpp.

{
//tell the shell to always call Extract
*puFlags = GIL_NOTFILENAME;

//the pidl is either a value or a folder, so find out which it is
if(m_pPidlMgr->IsFolder(m_pPidlMgr->GetLastItem(m_pidl)))
   {
   //its a folder
   if(uFlags & GIL_OPENICON)
      {
      //tell Extract to return the open folder icon
      *piIndex = ICON_INDEX_FOLDEROPEN;
      }
   else
      {
      //tell Extract to return the closed folder icon
      *piIndex = ICON_INDEX_FOLDER;
      }
   }
else
   {
   //its not a folder
   *piIndex = ICON_INDEX_ITEM;  //tell Extract to return the item icon
   }

return S_OK;
}

STDMETHODIMP CExtractIcon::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 79 of file ExtrIcon.Cpp.

{
*ppReturn = NULL;

//IUnknown
if(IsEqualIID(riid, IID_IUnknown))
   {
   *ppReturn = this;
   }

//IExtractIcon
else if(IsEqualIID(riid, IID_IExtractIcon))
   {
   *ppReturn = (IExtractIcon*)this;
   }

if(*ppReturn)
   {
   (*(LPUNKNOWN*)ppReturn)->AddRef();
   return S_OK;
   }

return E_NOINTERFACE;
}

CExtractIcon::STDMETHOD_ | ( | ULONG | ,
 |  | Release |
 | ) |  |
CExtractIcon::STDMETHOD_ | ( | ULONG | ,
 |  | AddRef |
 | ) |  |

Member Data Documentation

DWORD CExtractIcon::m_ObjRefCount [private]

Definition at line 39 of file ExtrIcon.h.

LPITEMIDLIST CExtractIcon::m_pidl [private]

Definition at line 40 of file ExtrIcon.h.

CPidlMgr* CExtractIcon::m_pPidlMgr [private]

Definition at line 41 of file ExtrIcon.h.

The documentation for this class was generated from the following files:
  • WinUI/Shell/SampView/ExtrIcon.h
  • WinUI/Shell/SampView/ExtrIcon.Cpp
Generated on Wed Nov 13 2024 16:56:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CFactory Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Static Private Attributes | Friends

CFactory Class Reference

#include "cfactory.h"

List of all members.

Public Member Functions

CFactory (const CFactoryData *pFactoryData)
CFactory (const CLSID &ClsId)
CFactory ()
CFactory ()
~CFactory ()
~CFactory ()
~CFactory ()
STDMETHODIMP | CreateInstance (IUnknown *pUnkwnOuter, REFIID riid, void **ppv)
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, LPVOID *)
STDMETHOD() | FindBehavior (BSTR bstrBehavior, BSTR bstrBehaviorUrl, IElementBehaviorSite *pSite, IElementBehavior **ppBehavior)
STDMETHODIMP | LockServer (BOOL bLock)
STDMETHODIMP | LockServer (BOOL)
STDMETHODIMP | QueryInterface (REFIID riid, void **ppv)
STDMETHODIMP | QueryInterface (REFIID, LPVOID *)
STDMETHOD() | SetInterfaceSafetyOptions (REFIID riid, DWORD dwOptionSetMask, DWORD dwEnabledOptions)
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP_ (ULONG) AddRef(void)

Static Public Member Functions

static BOOL | IsLocked ()
static DWORD | lockCount ()
static HRESULT | RegisterAll ()
static HRESULT | UnregisterAll ()

Protected Attributes

const CFactoryData * | m_pFactoryData

Private Member Functions

CFactory ()
virtual ULONG __stdcall | AddRef ()
virtual HRESULT __stdcall | CreateInstance (IUnknown *pUnknownOuter, const IID &iid, void **ppv)
virtual HRESULT __stdcall | LockServer (BOOL bLock)
virtual HRESULT __stdcall | QueryInterface (const IID &iid, void **ppv)
virtual ULONG __stdcall | Release ()

Private Attributes

CLSID m_ClsId
long | m_cRef
ULONG m_cRef

Static Private Attributes

static long | s_cServerLocks = 0

Friends

HRESULT _stdcall | CUnknown::Quit ()

Detailed Description

Definition at line 99 of file cfactory.h.

Constructor & Destructor Documentation

CFactory::CFactory ( ) [inline, private]

Definition at line 113 of file cfactory.h.

{};

CFactory::CFactory ( const CFactoryData * pFactoryData )

Definition at line 51 of file cfactory.cpp.

: m_cRef(0), m_pFactoryData(pFactoryData)
{
  DEBUGTRACE(_T("In CFactory ctor"));
  _ASSERT(m_pFactoryData);
  g_clsid = *m_pFactoryData->m_pCLSID;
  g_progID = m_pFactoryData->m_szProgID;
}

CFactory::~CFactory ( )

Definition at line 61 of file cfactory.cpp.

{
  DEBUGTRACE(_T("In CFactory dtor"));
}

CFactory::CFactory ( )
CFactory::~CFactory ( )
CFactory::CFactory ( const CLSID & ClsId )

Definition at line 185 of file OleSrvr.Cpp.

{
    m_cRef = 0;
    m_ClsId = ClsId;
    ObjectCreated(0);
}

CFactory::~CFactory ( )
CFactory::CFactory ( ) [inline]

Definition at line 22 of file Factory.h.

  {
  }

Member Function Documentation

ULONG CFactory::AddRef ( ) [private, virtual]

Definition at line 92 of file cfactory.cpp.

{
  return InterlockedIncrement(&m_cRef);
}

HRESULT __stdcall CFactory::CreateInstance | ( | IUnknown * | pUnknownOuter,
 |  | const IID & | iid,
 |  | void ** | ppv |
 | ) |  |  | [private, virtual]

Definition at line 110 of file cfactory.cpp.

{
  DEBUGTRACE(_T("In IClassFactory::CreateInstance"));
  HRESULT hr;
  CHECKPOINTER(ppv);

  // Aggregate only if the requested IID is IID_IUnknown.
  if ((pUnknownOuter != NULL) && (iid != IID_IUnknown))
  {
    hr = CLASS_E_NOAGGREGATION;
    goto END;
  }

  _ASSERT(m_pFactoryData->version == MAKEVERSION(1, 0));

  // Create the component.
  CUnknown* pNewComponent;
  hr = m_pFactoryData->CreateInstance(pUnknownOuter, &pNewComponent);

  if (FAILED(hr))
  {
    goto END;
  }

  // Initialize the component.
  pNewComponent->NondelegatingAddRef();
  hr = pNewComponent->Init(m_pFactoryData);
  if (SUCCEEDED(hr))
  {
    // Get the requested interface.
    hr = pNewComponent->NondelegatingQueryInterface(iid, ppv);
  }
  pNewComponent->NondelegatingRelease();
END:
  DEBUGTRACE(_T("IClassFactory::CreateInstance returning [%X]"), hr);
  return hr ;
}

STDMETHODIMP CFactory::CreateInstance | ( | LPUNKNOWN | pUnkOuter,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 245 of file OleSrvr.Cpp.

{
    IUnknown* pObj;
    HRESULT  hr;

    //
    //  Defaults
    //
    *ppvObj=NULL;
    hr = E_OUTOFMEMORY;

    //
    // We aren't supporting aggregation.
    //
    if (pUnkOuter)
        return CLASS_E_NOAGGREGATION;

    if (m_ClsId == CLSID_MyEventProvider)
    {
        pObj = (IWbemProviderInit *) new CMyEventProvider;
    }

    if (!pObj)
        return hr;

    //
    //  Initialize the object and verify that it can return the
    //  interface in question.
    //
    hr = pObj->QueryInterface(riid, ppvObj);

    //
    // Kill the object if initial creation or Init failed.
    //
    if (FAILED(hr))
        delete pObj;

    return hr;
}

STDMETHODIMP CFactory::CreateInstance | ( | IUnknown * | pUnkwnOuter,
 |  | REFIID | riid,
 |  | void ** | ppv
 | ) |  |

Definition at line 531 of file component.cxx.

{
   HRESULT hr;
   CSimpleClass* pObject = new CSimpleClass();

   hr=pObject->QueryInterface(riid, ppv);
   if (FAILED(hr)) {
      delete pObject;
      return hr;
   }
   pObject->Release();
   return S_OK;
};

STDMETHODIMP CFactory::FindBehavior | ( | BSTR | bstrBehavior,
 |  | BSTR | bstrBehaviorUrl,
 |  | IElementBehaviorSite * | pSite,
 |  | IElementBehavior ** | ppBehavior
 | ) |  |

Definition at line 13 of file Factory.cpp.

{
   HRESULT hr;
   CComObject<CBehavior>* pBehavior;

   // Create a Behavior object.
   hr = CComObject<CBehavior>::CreateInstance(&pBehavior);

   if (SUCCEEDED(hr))
   {
    hr = pBehavior->QueryInterface(IID_IElementBehavior, (void**)ppBehavior );
   }

   return hr;
}

static BOOL CFactory::IsLocked ( ) [inline, static]

Definition at line 156 of file cfactory.h.

  { return (CFactory::s_cServerLocks > 0);}

static DWORD CFactory::lockCount ( ) [inline, static]

Definition at line 160 of file cfactory.h.

  { return CFactory::s_cServerLocks;}

STDMETHODIMP CFactory::LockServer ( BOOL bLock ) [private, virtual]

Definition at line 152 of file cfactory.cpp.

{
  DEBUGTRACE(_T("IClassFactory::LockServer called with bLock = [%s]"), bLock ? "TRUE" : "FALSE");
  if (bLock)
  {
    InterlockedIncrement(&s_cServerLocks);
#if !defined(_DLL_SERVER_)
    CoAddRefServerProcess();
#endif // _DLL_SERVER_
  }
  else
  {
    InterlockedDecrement(&s_cServerLocks);
#if !defined(_DLL_SERVER_)
    if (CoReleaseServerProcess() == 0) // Last reference to server time to cleanup and exit
#if defined(_APARTMENT_)
      PostQuitMessage(0);
#else // Free Threaded
      SetEvent(g_CloseEvent);
#endif // _APARTMENT_
#endif // _DLL_SERVER_
  }
  return S_OK;
}

STDMETHODIMP CFactory::LockServer ( BOOL )
STDMETHODIMP CFactory::LockServer ( BOOL bLock )
STDMETHODIMP CFactory::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 210 of file OleSrvr.Cpp.

{
    *ppv = 0;

    if (IID_IUnknown==riid || IID_IClassFactory==riid)
    {
        *ppv = this;
        AddRef();
        return NOERROR;
    }

    return E_NOINTERFACE;
}

virtual HRESULT __stdcall CFactory::QueryInterface | ( | const IID & | iid,
 |  | void ** | ppv |
 | ) |  |  | [private, virtual]
STDMETHODIMP CFactory::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppv
 | ) |  |

Definition at line 69 of file cfactory.cpp.

{
#if defined(_DEBUG)
  LPWSTR lpstrIID;
  StringFromIID(iid, &lpstrIID);
  DEBUGTRACE(_TEXT("IClassFactory::QueryInterface has been asked for %S"), lpstrIID);
  CoTaskMemFree(lpstrIID);
#endif
  CHECKPOINTER(ppv);

  if ((iid == IID_IUnknown) || (iid == IID_IClassFactory))
  {
    *ppv = this;
  }
  else
  {
    *ppv = NULL;
    return E_NOINTERFACE;
  }
  static_cast<LPUNKNOWN>(*ppv)->AddRef();
  return S_OK;
}

HRESULT CFactory::RegisterAll ( ) [static]

Definition at line 180 of file cfactory.cpp.

{
  HRESULT hr;
  for(int i = 0 ; i < g_cFactoryDataEntries ; i++)
    if (FAILED(hr = RegisterServer(g_hModule, g_FactoryDataArray[i])))
      break;
  return hr;
}

ULONG CFactory::Release ( ) [private, virtual]

Definition at line 97 of file cfactory.cpp.

{
  if (InterlockedDecrement(&m_cRef) == 0)
  {
    delete this;
    return 0;
  }
  return m_cRef;
}

STDMETHOD() CFactory::SetInterfaceSafetyOptions | ( | REFIID | riid,
 |  | DWORD | dwOptionSetMask,
 |  | DWORD | dwEnabledOptions |
 | ) |  |  | [inline]

Definition at line 41 of file Factory.h.

  {
    m_dwCurrentSafety = m_dwCurrentSafety  & ~dwEnabledOptions | dwOptionSetMask;
    return S_OK;
  }

CFactory::STDMETHODIMP_ ( ULONG )
CFactory::STDMETHODIMP_ ( ULONG )
CFactory::STDMETHODIMP_ ( ULONG )
CFactory::STDMETHODIMP_ ( ULONG )
HRESULT CFactory::UnregisterAll ( ) [static]

Definition at line 189 of file cfactory.cpp.

{
  HRESULT hr;
  for(int i = 0 ; i < g_cFactoryDataEntries ; i++)
    if (FAILED(hr = UnregisterServer(g_hModule, g_FactoryDataArray[i])))
      break;
  return hr;
}

Friends And Related Function Documentation

HRESULT _stdcall CUnknown::Quit ( ) [friend]

Member Data Documentation

CLSID CFactory::m_ClsId [private]

Definition at line 65 of file OleSrvr.Cpp.

ULONG CFactory::m_cRef [private]

Definition at line 33 of file component.hxx.

ULONG CFactory::m_cRef [private]

Definition at line 146 of file cfactory.h.

const CFactoryData* CFactory::m_pFactoryData [protected]

Definition at line 165 of file cfactory.h.

long CFactory::s_cServerLocks = 0 [static, private]

Definition at line 150 of file cfactory.h.

The documentation for this class was generated from the following files:
  • Com/async/server/cfactory.h
  • Com/Fundamentals/Pipes/LocalServer/component.hxx
  • SysMgmt/WMI/VC/EventProvider/OleSrvr.Cpp
  • Web/Browser/RenderBehave/renderproject/Factory.h
  • Com/async/server/cfactory.cpp
  • Com/Fundamentals/Pipes/LocalServer/component.cxx
  • Web/Browser/RenderBehave/renderproject/Factory.cpp
Generated on Wed Nov 13 2024 16:56:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CFactoryData Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CFactoryData Struct Reference

#include "cfactory.h"

List of all members.

Public Member Functions

BOOL | IsClassID (const CLSID &clsid) const

Public Attributes

FPCREATEINSTANCE | CreateInstance
bool | m_fProxy
LCID | m_lcid
DWORD m_LibVersion
DWORD m_oleMisc
LPCSTR | m_oleVerbs
const CLSID * | m_pCLSID
const GUID * | m_pLIBID
LPCSTR | m_RegistryName
LPCSTR | m_szAppName
LPCSTR | m_szname
LPOLESTR m_szProgID
LPOLESTR m_szVerIndProgID
SERVERTYPE server
LPCSTR | threadingModel
DWORD version

Detailed Description

Definition at line 39 of file cfactory.h.

Member Function Documentation

BOOL CFactoryData::IsClassID ( const CLSID & clsid ) const [inline]

Definition at line 72 of file cfactory.h.

    { return (*m_pCLSID == clsid) ;}

Member Data Documentation

FPCREATEINSTANCE CFactoryData::CreateInstance

Definition at line 54 of file cfactory.h.

bool CFactoryData::m_fProxy

Definition at line 85 of file cfactory.h.

LCID CFactoryData::m_lcid

Definition at line 79 of file cfactory.h.

DWORD CFactoryData::m_LibVersion

Definition at line 82 of file cfactory.h.

DWORD CFactoryData::m_oleMisc

Definition at line 91 of file cfactory.h.

LPCSTR CFactoryData::m_oleVerbs

Definition at line 88 of file cfactory.h.

const CLSID* CFactoryData::m_pCLSID

Definition at line 51 of file cfactory.h.

const GUID* CFactoryData::m_pLIBID

Definition at line 76 of file cfactory.h.

LPCSTR CFactoryData::m_RegistryName

Definition at line 57 of file cfactory.h.

LPCSTR CFactoryData::m_szAppName

Definition at line 69 of file cfactory.h.

LPCSTR CFactoryData::m_szname

Definition at line 66 of file cfactory.h.

LPOLESTR CFactoryData::m_szProgID

Definition at line 60 of file cfactory.h.

LPOLESTR CFactoryData::m_szVerIndProgID

Definition at line 63 of file cfactory.h.

SERVERTYPE CFactoryData::server

Definition at line 45 of file cfactory.h.

LPCSTR CFactoryData::threadingModel

Definition at line 48 of file cfactory.h.

DWORD CFactoryData::version

Definition at line 42 of file cfactory.h.

The documentation for this struct was generated from the following file:
  • Com/async/server/cfactory.h
Generated on Wed Nov 13 2024 16:56:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CFastVariant Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions

CFastVariant Class Reference

#include "utils.h"

List of all members.

Public Member Functions

CFastVariant ()
CFastVariant (const CFastVariant &varSrc)
CFastVariant (bool bSrc)
CFastVariant (IDispatch *pSrc)
CFastVariant (IUnknown *pSrc)
CFastVariant (int nSrc)
CFastVariant (BSTR bstrSrc)
CFastVariant (BYTE nSrc)
CFastVariant (short nSrc)
CFastVariant (const VARIANT &varSrc)
CFastVariant (LPCOLESTR lpszSrc)
CFastVariant (long nSrc, VARTYPE vtSrc=VT_I4)
CFastVariant (float fltSrc)
CFastVariant (LPCSTR lpszSrc)
CFastVariant (double dblSrc)
CFastVariant (CY cySrc)
~CFastVariant ()
HRESULT | Attach (VARIANT *pSrc)
HRESULT | ChangeType (VARTYPE vtNew, const VARIANT *pSrc=NULL)
HRESULT | Clear ()
HRESULT | Copy (const VARIANT *pSrc)
HRESULT | Detach (VARIANT *pDest)
HRESULT | InternalClear ()
void | InternalCopy (const VARIANT *pSrc)
bool | operator!= (const VARIANT &varSrc) const
bool | operator< (const VARIANT &varSrc) const
CFastVariant & | operator= (bool bSrc)
CFastVariant & | operator= (int nSrc)
CFastVariant & | operator= (LPCSTR lpszSrc)
CFastVariant & | operator= (long nSrc)
CFastVariant & | operator= (const VARIANT &varSrc)
CFastVariant & | operator= (CY cySrc)
CFastVariant & | operator= (float fltSrc)
CFastVariant & | operator= (short nSrc)
CFastVariant & | operator= (const CFastVariant &varSrc)
CFastVariant & | operator= (BSTR bstrSrc)
CFastVariant & | operator= (BYTE nSrc)
CFastVariant & | operator= (double dblSrc)
CFastVariant & | operator= (LPCOLESTR lpszSrc)
CFastVariant & | operator= (IUnknown *pSrc)
CFastVariant & | operator= (IDispatch *pSrc)
bool | operator== (const VARIANT &varSrc) const
bool | operator> (const VARIANT &varSrc) const
HRESULT | ReadFromStream (IStream *pStream)
HRESULT | WriteToStream (IStream *pStream)

Private Member Functions

DECLARE_FIXED_ALLOC (CFastVariant)

Detailed Description

Definition at line 13 of file utils.h.

Constructor & Destructor Documentation

CFastVariant::CFastVariant ( ) [inline]

Definition at line 18 of file utils.h.

  {
    vt = VT_EMPTY;
  }

CFastVariant::~CFastVariant ( ) [inline]

Definition at line 22 of file utils.h.

  {
    Clear();
  }

CFastVariant::CFastVariant ( const VARIANT & varSrc ) [inline]

Definition at line 27 of file utils.h.

  {
    vt = VT_EMPTY;
    InternalCopy(&varSrc);
  }

CFastVariant::CFastVariant ( const CFastVariant & varSrc ) [inline]

Definition at line 33 of file utils.h.

  {
    vt = VT_EMPTY;
    InternalCopy(&varSrc);
  }

CFastVariant::CFastVariant ( BSTR bstrSrc ) [inline]

Definition at line 39 of file utils.h.

  {
    vt = VT_EMPTY;
    *this = bstrSrc;
  }

CFastVariant::CFastVariant ( LPCOLESTR lpszSrc ) [inline]

Definition at line 44 of file utils.h.

  {
    vt = VT_EMPTY;
    *this = lpszSrc;
  }

CFastVariant::CFastVariant ( LPCSTR lpszSrc ) [inline]

Definition at line 51 of file utils.h.

  {
    vt = VT_EMPTY;
    *this = lpszSrc;
  }

CFastVariant::CFastVariant ( bool bSrc ) [inline]

Definition at line 58 of file utils.h.

  {
    vt = VT_BOOL;
#pragma warning(disable: 4310) // cast truncates constant value
    boolVal = bSrc ? VARIANT_TRUE : VARIANT_FALSE;
#pragma warning(default: 4310) // cast truncates constant value
  }

CFastVariant::CFastVariant ( int nSrc ) [inline]

Definition at line 66 of file utils.h.

  {
    vt = VT_I4;
    lVal = nSrc;
  }

CFastVariant::CFastVariant ( BYTE nSrc ) [inline]

Definition at line 71 of file utils.h.

  {
    vt = VT_UI1;
    bVal = nSrc;
  }

CFastVariant::CFastVariant ( short nSrc ) [inline]

Definition at line 76 of file utils.h.

  {
    vt = VT_I2;
    iVal = nSrc;
  }

CFastVariant::CFastVariant | ( | long | nSrc,
 |  | VARTYPE | vtSrc = VT_I4 |
 | ) |  |  | [inline]

Definition at line 81 of file utils.h.

  {
    ATLASSERT(vtSrc == VT_I4 || vtSrc == VT_ERROR);
    vt = vtSrc;
    lVal = nSrc;
  }

CFastVariant::CFastVariant ( float fltSrc ) [inline]

Definition at line 87 of file utils.h.

  {
    vt = VT_R4;
    fltVal = fltSrc;
  }

CFastVariant::CFastVariant ( double dblSrc ) [inline]

Definition at line 92 of file utils.h.

  {
    vt = VT_R8;
    dblVal = dblSrc;
  }

CFastVariant::CFastVariant ( CY cySrc ) [inline]

Definition at line 97 of file utils.h.

  {
    vt = VT_CY;
    cyVal.Hi = cySrc.Hi;
    cyVal.Lo = cySrc.Lo;
  }

CFastVariant::CFastVariant ( IDispatch * pSrc ) [inline]

Definition at line 103 of file utils.h.

  {
    vt = VT_DISPATCH;
    pdispVal = pSrc;
    // Need to AddRef as VariantClear will Release
    if (pdispVal != NULL)
      pdispVal->AddRef();
  }

CFastVariant::CFastVariant ( IUnknown * pSrc ) [inline]

Definition at line 111 of file utils.h.

  {
    vt = VT_UNKNOWN;
    punkVal = pSrc;
    // Need to AddRef as VariantClear will Release
    if (punkVal != NULL)
      punkVal->AddRef();
  }

Member Function Documentation

HRESULT CFastVariant::Attach ( VARIANT * pSrc ) [inline]

Definition at line 376 of file utils.h.

  {
    // Clear out the variant
    HRESULT hr = Clear();
    if (!FAILED(hr))
    {
      // Copy the contents and give control to CFastVariant
      memcpy(this, pSrc, sizeof(VARIANT));
      pSrc->vt = VT_EMPTY;
      hr = S_OK;
    }
    return hr;
  }

HRESULT CFastVariant::ChangeType | ( | VARTYPE | vtNew,
 |  | const VARIANT * | pSrc = NULL |
 | ) |  |  | [inline]

Definition at line 406 of file utils.h.

  {
    VARIANT* pVar = const_cast<VARIANT*>(pSrc);
    // Convert in place if pSrc is NULL
    if (pVar == NULL)
      pVar = this;
    // Do nothing if doing in place convert and vts not different
    return ::VariantChangeType(this, pVar, 0, vtNew);
  }

HRESULT CFastVariant::Clear ( ) [inline]

Definition at line 363 of file utils.h.

  {
    if (vt != VT_EMPTY)
      return ::VariantClear(this);
    else
      return S_OK;
  }

HRESULT CFastVariant::Copy ( const VARIANT * pSrc ) [inline]

Definition at line 371 of file utils.h.

  {
    return ::VariantCopy(this, const_cast<VARIANT*>(pSrc));
  }

CFastVariant::DECLARE_FIXED_ALLOC ( CFastVariant ) [private]
HRESULT CFastVariant::Detach ( VARIANT * pDest ) [inline]

Definition at line 390 of file utils.h.

  {
    HRESULT hr = S_OK;
    if (pDest->vt != VT_EMPTY)
      hr = ::VariantClear(pDest);
    // Clear out the variant
    if (!FAILED(hr))
    {
      // Copy the contents and remove control from CFastVariant
      memcpy(pDest, this, sizeof(VARIANT));
      vt = VT_EMPTY;
      hr = S_OK;
    }
    return hr;
  }

HRESULT CFastVariant::InternalClear ( ) [inline]

Definition at line 421 of file utils.h.

  {
    HRESULT hr = Clear();
    ATLASSERT(SUCCEEDED(hr));
    if (FAILED(hr))
    {
      vt = VT_ERROR;
      scode = hr;
    }
    return hr;
  }

void CFastVariant::InternalCopy ( const VARIANT * pSrc ) [inline]

Definition at line 433 of file utils.h.

  {
    HRESULT hr = Copy(pSrc);
    if (FAILED(hr))
    {
      vt = VT_ERROR;
      scode = hr;
    }
  }

bool CFastVariant::operator!= ( const VARIANT & varSrc ) const [inline]

Definition at line 354 of file utils.h.

{return VarCmp((VARIANT*)this, (VARIANT*)&varSrc, LOCALE_USER_DEFAULT, 0)!=VARCMP_EQ;}

bool CFastVariant::operator< ( const VARIANT & varSrc ) const [inline]

Definition at line 356 of file utils.h.

{return VarCmp((VARIANT*)this, (VARIANT*)&varSrc, LOCALE_USER_DEFAULT, 0)==VARCMP_LT;}

CFastVariant& CFastVariant::operator= ( int nSrc ) [inline]

Definition at line 190 of file utils.h.

  {
    if (vt != VT_I4)
    {
      InternalClear();
      vt = VT_I4;
    }
    lVal = nSrc;

    return *this;
  }

CFastVariant& CFastVariant::operator= ( BSTR bstrSrc ) [inline]

Definition at line 133 of file utils.h.

  {
    InternalClear();
    vt = VT_BSTR;
    bstrVal = ::SysAllocString(bstrSrc);
    if (bstrVal == NULL && bstrSrc != NULL)
    {
      vt = VT_ERROR;
      scode = E_OUTOFMEMORY;
    }
    return *this;
  }

CFastVariant& CFastVariant::operator= ( IUnknown * pSrc ) [inline]

Definition at line 280 of file utils.h.

  {
    InternalClear();
    vt = VT_UNKNOWN;
    punkVal = pSrc;

    // Need to AddRef as VariantClear will Release
    if (punkVal != NULL)
      punkVal->AddRef();
    return *this;
  }

CFastVariant& CFastVariant::operator= ( const CFastVariant & varSrc ) [inline]

Definition at line 122 of file utils.h.

  {
    InternalCopy(&varSrc);
    return *this;
  }

CFastVariant& CFastVariant::operator= ( BYTE nSrc ) [inline]

Definition at line 202 of file utils.h.

  {
    if (vt != VT_UI1)
    {
      InternalClear();
      vt = VT_UI1;
    }
    bVal = nSrc;
    return *this;
  }

CFastVariant& CFastVariant::operator= ( IDispatch * pSrc ) [inline]

Definition at line 269 of file utils.h.

  {
    InternalClear();
    vt = VT_DISPATCH;
    pdispVal = pSrc;
    // Need to AddRef as VariantClear will Release
    if (pdispVal != NULL)
      pdispVal->AddRef();
    return *this;
  }

CFastVariant& CFastVariant::operator= ( LPCSTR lpszSrc ) [inline]

Definition at line 161 of file utils.h.

  {
    USES_CONVERSION;
    InternalClear();
    vt = VT_BSTR;
    bstrVal = ::SysAllocString(A2COLE(lpszSrc));

    if (bstrVal == NULL && lpszSrc != NULL)
    {
      vt = VT_ERROR;
      scode = E_OUTOFMEMORY;
    }
    return *this;
  }

CFastVariant& CFastVariant::operator= ( double dblSrc ) [inline]

Definition at line 246 of file utils.h.

  {
    if (vt != VT_R8)
    {
      InternalClear();
      vt = VT_R8;
    }
    dblVal = dblSrc;
    return *this;
  }

CFastVariant& CFastVariant::operator= ( const VARIANT & varSrc ) [inline]

Definition at line 127 of file utils.h.

  {
    InternalCopy(&varSrc);
    return *this;
  }

CFastVariant& CFastVariant::operator= ( long nSrc ) [inline]

Definition at line 224 of file utils.h.

  {
    if (vt != VT_I4)
    {
      InternalClear();
      vt = VT_I4;
    }
    lVal = nSrc;
    return *this;
  }

CFastVariant& CFastVariant::operator= ( LPCOLESTR lpszSrc ) [inline]

Definition at line 146 of file utils.h.

  {
    InternalClear();
    vt = VT_BSTR;
    bstrVal = ::SysAllocString(lpszSrc);

    if (bstrVal == NULL && lpszSrc != NULL)
    {
      vt = VT_ERROR;
      scode = E_OUTOFMEMORY;
    }
    return *this;
  }

CFastVariant& CFastVariant::operator= ( short nSrc ) [inline]

Definition at line 213 of file utils.h.

  {
    if (vt != VT_I2)
    {
      InternalClear();
      vt = VT_I2;
    }
    iVal = nSrc;
    return *this;
  }

CFastVariant& CFastVariant::operator= ( CY cySrc ) [inline]

Definition at line 257 of file utils.h.

  {
    if (vt != VT_CY)
    {
      InternalClear();
      vt = VT_CY;
    }
    cyVal.Hi = cySrc.Hi;
    cyVal.Lo = cySrc.Lo;
    return *this;
  }

CFastVariant& CFastVariant::operator= ( float fltSrc ) [inline]

Definition at line 235 of file utils.h.

  {
    if (vt != VT_R4)
    {
      InternalClear();
      vt = VT_R4;
    }
    fltVal = fltSrc;
    return *this;
  }

CFastVariant& CFastVariant::operator= ( bool bSrc ) [inline]

Definition at line 177 of file utils.h.

  {
    if (vt != VT_BOOL)
    {
      InternalClear();
      vt = VT_BOOL;
    }
  #pragma warning(disable: 4310) // cast truncates constant value
    boolVal = bSrc ? VARIANT_TRUE : VARIANT_FALSE;
  #pragma warning(default: 4310) // cast truncates constant value
    return *this;
  }

bool CFastVariant::operator== ( const VARIANT & varSrc ) const [inline]

Definition at line 295 of file utils.h.

  {
    if (this == &varSrc)
      return true;

    // Variants not equal if types don't match
    if (vt != varSrc.vt)
      return false;

    // Check type specific values
    switch (vt)
    {
      case VT_EMPTY:
      case VT_NULL:
        return true;

      case VT_BOOL:
        return boolVal == varSrc.boolVal;

      case VT_UI1:
        return bVal == varSrc.bVal;

      case VT_I2:
        return iVal == varSrc.iVal;

      case VT_I4:
        return lVal == varSrc.lVal;

      case VT_R4:
        return fltVal == varSrc.fltVal;

      case VT_R8:
        return dblVal == varSrc.dblVal;

      case VT_BSTR:
        return (::SysStringByteLen(bstrVal) == ::SysStringByteLen(varSrc.bstrVal)) &&
            (::memcmp(bstrVal, varSrc.bstrVal, ::SysStringByteLen(bstrVal)) == 0);

      case VT_ERROR:
        return scode == varSrc.scode;

      case VT_DISPATCH:
        return pdispVal == varSrc.pdispVal;

      case VT_UNKNOWN:
        return punkVal == varSrc.punkVal;

      default:
        ATLASSERT(false);
        // fall through
    }

    return false;
  }

bool CFastVariant::operator> ( const VARIANT & varSrc ) const [inline]

Definition at line 357 of file utils.h.

{return VarCmp((VARIANT*)this, (VARIANT*)&varSrc, LOCALE_USER_DEFAULT, 0)==VARCMP_GT;}

HRESULT CFastVariant::ReadFromStream ( IStream * pStream ) [inline]

Definition at line 512 of file utils.h.

{
  ATLASSERT(pStream != NULL);
  HRESULT hr = S_OK;
  if (vt != VT_EMPTY)
    hr = VariantClear(this);
  if (FAILED(hr))
    return hr;
  VARTYPE vtRead;
  hr = pStream->Read(&vtRead, sizeof(VARTYPE), NULL);
  if (hr == S_FALSE)
    hr = E_FAIL;
  if (FAILED(hr))
    return hr;

  vt = vtRead;
  int cbRead = 0;
  switch (vtRead)
  {
  case VT_UNKNOWN:
  case VT_DISPATCH:
    {
      punkVal = NULL;
      hr = OleLoadFromStream(pStream,
        (vtRead == VT_UNKNOWN) ? IID_IUnknown : IID_IDispatch,
        (void**)&punkVal);
      if (hr == REGDB_E_CLASSNOTREG)
        hr = S_OK;
      return S_OK;
    }
  case VT_UI1:
  case VT_I1:
    cbRead = sizeof(BYTE);
    break;
  case VT_I2:
  case VT_UI2:
  case VT_BOOL:
    cbRead = sizeof(short);
    break;
  case VT_I4:
  case VT_UI4:
  case VT_R4:
  case VT_INT:
  case VT_UINT:
  case VT_ERROR:
  case VT_NULL:
    cbRead = sizeof(long);
    break;
  case VT_R8:
  case VT_CY:
  case VT_DATE:
    cbRead = sizeof(double);
    break;
  default:
    break;
  }
  if (cbRead != 0)
  {
    hr = pStream->Read((void*) &bVal, cbRead, NULL);
    if (hr == S_FALSE)
      hr = E_FAIL;
    return hr;
  }
  CComBSTR bstrRead;

  hr = bstrRead.ReadFromStream(pStream);
  if (FAILED(hr))
    return hr;
  vt = VT_BSTR;
  bstrVal = bstrRead.Detach();
  if (vtRead != VT_BSTR)
    hr = ChangeType(vtRead);
  return hr;
}

HRESULT CFastVariant::WriteToStream ( IStream * pStream ) [inline]

Definition at line 444 of file utils.h.

{
  HRESULT hr = pStream->Write(&vt, sizeof(VARTYPE), NULL);
  if (FAILED(hr))
    return hr;

  int cbWrite = 0;
  switch (vt)
  {
  case VT_UNKNOWN:
  case VT_DISPATCH:
    {
      CComPtr<IPersistStream> spStream;
      if (punkVal != NULL)
      {
        hr = punkVal->QueryInterface(IID_IPersistStream, (void**)&spStream);
        if (FAILED(hr))
          return hr;
      }
      if (spStream != NULL)
        return OleSaveToStream(spStream, pStream);
      else
        return WriteClassStm(pStream, CLSID_NULL);
    }
  case VT_UI1:
  case VT_I1:
    cbWrite = sizeof(BYTE);
    break;
  case VT_I2:
  case VT_UI2:
  case VT_BOOL:
    cbWrite = sizeof(short);
    break;
  case VT_I4:
  case VT_UI4:
  case VT_R4:
  case VT_INT:
  case VT_UINT:
  case VT_ERROR:
  case VT_NULL:
    cbWrite = sizeof(long);
    break;
  case VT_R8:
  case VT_CY:
  case VT_DATE:
    cbWrite = sizeof(double);
    break;
  default:
    break;
  }
  if (cbWrite != 0)
    return pStream->Write((void*) &bVal, cbWrite, NULL);

  CComBSTR bstrWrite;
  CFastVariant varBSTR;
  if (vt != VT_BSTR)
  {
    hr = VariantChangeType(&varBSTR, this, VARIANT_NOVALUEPROP, VT_BSTR);
    if (FAILED(hr))
      return hr;
    bstrWrite = varBSTR.bstrVal;
  }
  else
    bstrWrite = bstrVal;

  return bstrWrite.WriteToStream(pStream);
}

The documentation for this class was generated from the following file:
  • Com/Tools/EntityProxy/DataServices/utils.h
Generated on Wed Nov 13 2024 16:56:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CFileIdx Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CFileIdx Class Reference

#include "fileidx.h"

List of all members.

Public Member Functions

CFileIdx (void)
~CFileIdx (void)
BOOL | DeleteRow (DBCOUNTITEM ulDex)
BOOL | fInit (void)
ULONG | GetRowOffset (DBCOUNTITEM ulDex)
BOOL | IsDeleted (DBCOUNTITEM ulDex)
BOOL | SetIndex (DBCOUNTITEM ulDex, ULONG ulOffset)

Private Member Functions

BOOL | ReAlloc (DBCOUNTITEM ulRows)

Private Attributes

LPFILEDEX m_rgDex
DBCOUNTITEM | m_ulDexCnt

Detailed Description

Definition at line 30 of file fileidx.h.

Constructor & Destructor Documentation

CFileIdx::CFileIdx ( void )

Definition at line 24 of file fileidx.cpp.

{
    m_rgDex = NULL;
    m_ulDexCnt = 0;
}

CFileIdx::~CFileIdx ( void )

Definition at line 38 of file fileidx.cpp.

{
  SAFE_FREE(m_rgDex);
}

Member Function Documentation

BOOL CFileIdx::DeleteRow ( DBCOUNTITEM ulDex )

Definition at line 126 of file fileidx.cpp.

{
    // Index should alway be valid
    assert((0 <= ulDex) && (m_ulDexCnt > ulDex));

    // Mark Row
    m_rgDex[ulDex].bStatus = DELETED_ROW;

    return TRUE;
}

BOOL CFileIdx::fInit ( void )

Definition at line 52 of file fileidx.cpp.

{
    //Allocate Offset Array
    m_rgDex = (LPFILEDEX) PROVIDER_ALLOC( ARRAY_INIT_SIZE * sizeof( FILEDEX ) );
    if (NULL == m_rgDex)
        return FALSE;

    m_ulDexCnt = ARRAY_INIT_SIZE;
    return TRUE;
}

ULONG CFileIdx::GetRowOffset ( DBCOUNTITEM ulDex )

Definition at line 167 of file fileidx.cpp.

{
    // Index should alway be valid
    assert((0 <= ulDex) && (m_ulDexCnt > ulDex));

    return m_rgDex[ulDex].ulOffset;
}

BOOL CFileIdx::IsDeleted ( DBCOUNTITEM ulDex )

Definition at line 148 of file fileidx.cpp.

{
    // Index should alway be valid and Check deletion status
    if ( ((ulDex <= 0) || (ulDex > m_ulDexCnt)) ||
     (DELETED_ROW != m_rgDex[ulDex].bStatus) )
        return FALSE;

    return TRUE;
}

BOOL CFileIdx::ReAlloc ( DBCOUNTITEM ulRows ) [private]

Definition at line 75 of file fileidx.cpp.

{
    VOID* pDex;

    // Change the array size
    pDex = PROVIDER_REALLOC( m_rgDex, ((m_ulDexCnt + ulRows) * sizeof( FILEDEX )));
    if( !pDex )
        return FALSE;

  m_ulDexCnt += ulRows;
    m_rgDex = (FILEDEX*) pDex;
    return TRUE;
}

BOOL CFileIdx::SetIndex | ( | DBCOUNTITEM | ulDex,
 |  | ULONG | ulOffset
 | ) |  |

Definition at line 101 of file fileidx.cpp.

{
    // Check index and realloc if beyond our current range
    if (m_ulDexCnt <= ulDex)
        if (FALSE == ReAlloc( ARRAY_INIT_SIZE ))
            return FALSE;

    m_rgDex[ulDex].ulOffset = ulOffset;
    m_rgDex[ulDex].bStatus = FALSE;

    return TRUE;
}

Member Data Documentation

LPFILEDEX CFileIdx::m_rgDex [private]

Definition at line 34 of file fileidx.h.

DBCOUNTITEM CFileIdx::m_ulDexCnt [private]

Definition at line 36 of file fileidx.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/sampprov/fileidx.h
  • Dataaccess/oledb/sampprov/fileidx.cpp
Generated on Wed Nov 13 2024 16:56:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CFileIO Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CFileIO Class Reference

#include "fileio.h"

List of all members.

Public Member Functions

CFileIO (void)
~CFileIO (void)
HRESULT | DeleteRow (DBCOUNTITEM ulRow)
HRESULT | Fetch (DBCOUNTITEM ulRow)
HRESULT | fInit (LPTSTR pstrFileName)
HRESULT | GatherColumnInfo ()
DBCOLUMNINFO * | GetColInfo ()
BYTE * | GetColNameHeap ()
ULONG GetColNameHeapSize ()
DBORDINAL | GetColumnCnt ()
COLUMNDATA * | GetColumnData (DBORDINAL cCols, ROWBUFF *pRowBuff)
HRESULT | GetColumnName (DBORDINAL cCols, LPTSTR *pptstrName=NULL)
HRESULT | GetDataTypes (DBORDINAL cCols, SWORD *pswType, UDWORD *pudwColDef, BOOL *pfSigned)
DBCOUNTITEM | GetRowCnt ()
DBLENGTH | GetRowSize ()
HRESULT | IsDeleted (DBCOUNTITEM ulRow)
BOOL IsReadOnly ()
HRESULT | ParseRowValues ()
HRESULT | SetColumnBind (DBORDINAL cCols, PCOLUMNDATA pColumn)
HRESULT | UpdateRow (DBCOUNTITEM ulRow, BYTE *pbProvRow, UPDTYPE eUpdateType)

Private Member Functions

HRESULT | FillBinding (DBORDINAL cColumn, LPTSTR pvCopy)
HRESULT | GenerateFileInfo ()
HRESULT | ParseColumnNames (LPTSTR ptstrInput)
HRESULT | ParseDataTypes ()

Private Attributes

ULONG m_cbHeapUsed
DBLENGTH | m_cbRowSize
DBORDINAL | m_cColumns
DBCOUNTITEM | m_cRows
CFileIdx m_FileIdx
BOOL m_FileReadOnly
BYTE * | m_pbHeap
LPTSTR m_pColNames
LPTSTR m_pvInput
DBCOLUMNINFO | m_rgdbcolinfo [MAX_COLUMNS]
DBLENGTH | m_rgdwDataOffsets [MAX_COLUMNS]
BOOL | m_rgfSigned [MAX_COLUMNS]
LPTSTR | m_rgpColNames [MAX_COLUMNS]
PCOLUMNDATA | m_rgpColumnData [MAX_COLUMNS]
SDWORD | m_rgsdwMaxLen [MAX_COLUMNS]
SWORD | m_rgswColType [MAX_COLUMNS]
UDWORD | m_rgudwColSize [MAX_COLUMNS]
ULONG m_ulDataTypeOffset

Detailed Description

Definition at line 29 of file fileio.h.

Constructor & Destructor Documentation

CFileIO::CFileIO ( void )

Definition at line 32 of file fileio.cpp.

{
  memset(&m_rgpColumnData, 0, sizeof(PCOLUMNDATA) * MAX_COLUMNS);

    m_pColNames        = NULL;
    m_pvInput          = NULL;
    m_ulDataTypeOffset = 0;
    m_cColumns         = 0;
    m_cRows            = 0;
  m_FileReadOnly     = FALSE;
  m_pbHeap         = NULL;
  m_cbHeapUsed       = 0;
  m_cbRowSize      = 0;
}

CFileIO::~CFileIO ( void )

Definition at line 53 of file fileio.cpp.

{
  // Release buffer for column names (pointed to by m_rgdbcolinfo).
    if (m_pbHeap)
        VirtualFree((VOID *) m_pbHeap, 0, MEM_RELEASE );

    // Close file
    if (is_open())
        close();

    // Delete buffers
    SAFE_DELETE( m_pColNames );
    SAFE_DELETE( m_pvInput );
}

Member Function Documentation

HRESULT CFileIO::DeleteRow ( DBCOUNTITEM ulRow )

Definition at line 402 of file fileio.cpp.

{
    assert( is_open());
    assert( m_pvInput );

    // Check the Row Number
    if ((ulRow < 1) || (ulRow > m_cRows))
        return ResultFromScode( E_FAIL );

    // If already deleted, just ignore.
    if (TRUE == m_FileIdx.IsDeleted( ulRow ))
        return ResultFromScode( S_OK );

    // Set the File Pointer
    seekg( m_FileIdx.GetRowOffset( ulRow ));
    clear();

    // Delete the row in the file and mark the status
    // as deleted in the index Array
    getline( m_pvInput, MAX_INPUT_BUFFER );
    if (good())
        {
        // Set the number bytes in the stream minus
        // the null terminator to this pattern
        memset( m_pvInput, '@', gcount() - 1 );
        seekp( m_FileIdx.GetRowOffset( ulRow ));
        clear();
        write( m_pvInput, gcount() - 1 );
        if (bad())
            return ResultFromScode( E_FAIL );
        else
            flush();
        }
    else
        return ResultFromScode( E_FAIL );

    m_FileIdx.DeleteRow( ulRow );

    return ResultFromScode( S_OK );
}

HRESULT CFileIO::Fetch ( DBCOUNTITEM ulRow )

Definition at line 486 of file fileio.cpp.

{
    assert( is_open());
    assert( m_rgpColumnData );
    assert( m_rgsdwMaxLen );

    // Check the Row Number
    if ((ulRow < 1))
        return ResultFromScode( E_FAIL );

    //Check end of Result Set
    if (ulRow > m_cRows)
        return ResultFromScode( S_FALSE );

    // Set the File Pointer to the row.
    seekg( m_FileIdx.GetRowOffset( ulRow ));
    clear();

    // If already deleted, just ignore.
    if (TRUE == m_FileIdx.IsDeleted( ulRow ))
        return ResultFromScode( S_OK );

    // Retrieve the column names record
    getline( m_pvInput, MAX_INPUT_BUFFER );

    if (good() && 0 < gcount())
  {
        //Flag a Delete from another user
        if ( strncmp(m_pvInput, "@", sizeof(char)) == 0 )
    {
      DeleteRow( ulRow );
      return ResultFromScode( S_OK );
    }

    // Parse the row
        return ParseRowValues();
  }

    return ResultFromScode( E_FAIL );
}

HRESULT CFileIO::FillBinding | ( | DBORDINAL | cColumn,
 |  | LPTSTR | pvCopy |
 | ) |  |  | [private]

Definition at line 632 of file fileio.cpp.

{
    assert( m_rgswColType );
    assert( m_rgpColumnData );
    assert( m_rgsdwMaxLen );

    // Null Value
    if (!pvCopy)
        {
        m_rgpColumnData[cColumn]->dwStatus = DBSTATUS_S_ISNULL;
        return ResultFromScode( S_OK );
        }

    switch (m_rgswColType[cColumn])
        {
    case TYPE_CHAR:
        lstrcpyn((LPTSTR) m_rgpColumnData[cColumn]->bData, pvCopy, m_rgsdwMaxLen[cColumn] + sizeof( char ) );
        m_rgpColumnData[cColumn]->dwLength = lstrlen( (LPTSTR) m_rgpColumnData[cColumn]->bData );
        m_rgpColumnData[cColumn]->dwStatus = DBSTATUS_S_OK;
        break;

    case TYPE_SLONG:
        *(ULONG*) m_rgpColumnData[cColumn]->bData = atol( pvCopy );
        m_rgpColumnData[cColumn]->dwLength = 4;
        m_rgpColumnData[cColumn]->dwStatus = DBSTATUS_S_OK;
        break;

    default:
        assert( !"Unknown Data Type" );
        break;
        }

    return ResultFromScode( S_OK );
}

HRESULT CFileIO::fInit ( LPTSTR pstrFileName )
HRESULT CFileIO::GatherColumnInfo ( )

Definition at line 779 of file fileio.cpp.

{
    HRESULT         hr;
    LPWSTR          lpwstr;
    int             cchFree, cchWide;
    DBCOLUMNINFO *  pcolinfo = NULL;
    DBLENGTH        dwOffset;
    DBORDINAL       cCols;
    int             cbName;
    SWORD           swCSVType;
    UDWORD          cbColDef;
    DWORD           dwdbtype;
  BOOL      fSigned;
  SDWORD *    rgcbLen = NULL;
  DBLENGTH *    rgdwOffsets = NULL;

  // Heap for column names.
    // Commit it all, then de-commit and release once we know size.
    m_pbHeap = (BYTE *) VirtualAlloc( NULL,
                                      MAX_HEAP_SIZE,
                                      MEM_RESERVE | MEM_COMMIT,
                                      PAGE_READWRITE );

  if( !m_pbHeap )
  {
    hr = ResultFromScode(E_OUTOFMEMORY);
    goto EXIT;
  }

    //----------------------------------
    // Gather column info
    //----------------------------------

    lpwstr  = (LPWSTR) m_pbHeap;
    cchFree = MAX_HEAP_SIZE / 2;

    pcolinfo  = &(m_rgdbcolinfo[1]);
  rgcbLen   = m_rgsdwMaxLen;
  rgdwOffsets = m_rgdwDataOffsets;

    dwOffset = offsetof( ROWBUFF, cdData );

    for (cCols=1; cCols <= m_cColumns; cCols++, pcolinfo++)
        {
        LPTSTR ptstrName;

        // Get Column Names and Lengths
        hr = GetColumnName(cCols, &ptstrName);
        if (FAILED( hr ))
      {
            hr = ResultFromScode( E_FAIL );
      goto EXIT;
      }

        // Store the Column Name in the Heap
        if (cchFree)
            {
            cbName = lstrlen( ptstrName );
            if (cbName)
                cchWide = MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, ptstrName, (int) cbName, lpwstr, cchFree );
            else
                cchWide = 0;
            pcolinfo->pwszName = lpwstr;
            lpwstr += cchWide;

            cchFree -= cchWide;
            if (cchFree)
                {
                *lpwstr++ = 0;
                cchFree--;
                }
            else
                *(lpwstr - 1) = 0;
            }
        else
            pcolinfo->pwszName = NULL;

        // Get DataTypes and Precision
        hr = GetDataTypes(cCols,
                        &swCSVType, // CSV data type
                        &cbColDef,  // Precision
                        &fSigned  // Signed or Unsigned
                        );
        if (FAILED( hr ))
            return ResultFromScode( E_FAIL );

        // We use ordinal numbers for our columns
        pcolinfo->columnid.eKind          = DBKIND_GUID_PROPID;
        pcolinfo->columnid.uGuid.guid     = GUID_NULL;
        pcolinfo->columnid.uName.ulPropid = (ULONG) cCols;

        // Determine the OLE DB type, for binding.
        hr = GetInternalTypeFromCSVType( swCSVType,         // in
                                         fSigned,         // in
                                         &dwdbtype );       // out, DBTYPE to show client
        if (FAILED( hr ))
      {
            hr = ResultFromScode( E_FAIL );
      goto EXIT;
      }

        // Check for overflow of size.
        rgcbLen[cCols] = cbColDef;
        rgcbLen[cCols] = MIN( rgcbLen[cCols], MAX_BIND_LEN );

        pcolinfo->iOrdinal    = cCols;
        pcolinfo->wType     = (DBTYPE) dwdbtype;
        pcolinfo->pTypeInfo     = NULL;
        pcolinfo->ulColumnSize  = rgcbLen[cCols];
    pcolinfo->bPrecision  = (BYTE) ~0;
    pcolinfo->bScale    = (BYTE) ~0;
        pcolinfo->dwFlags       = 0;

        // Is it a string datatype
    if(pcolinfo->wType != DBTYPE_STR)
      pcolinfo->bPrecision = (BYTE)cbColDef;

        // Is it a fixed length datatype
        if(pcolinfo->wType != DBTYPE_STR)
          pcolinfo->dwFlags |= DBCOLUMNFLAGS_ISFIXEDLENGTH;

        // We do support nulls
        pcolinfo->dwFlags |= DBCOLUMNFLAGS_ISNULLABLE;
        pcolinfo->dwFlags |= DBCOLUMNFLAGS_MAYBENULL;

        //We should always be able to write to the column
        pcolinfo->dwFlags |= DBCOLUMNFLAGS_WRITE;

        // Set the offset from the start of the row,
        // for this column, then advance past.
        dwOffset = ROUND_UP( dwOffset, COLUMN_ALIGNVAL );
        rgdwOffsets[cCols] = dwOffset;
        dwOffset += offsetof( COLUMNDATA, bData ) + rgcbLen[cCols];
        }

    m_cbRowSize = ROUND_UP( dwOffset, COLUMN_ALIGNVAL );
    m_cbHeapUsed = MAX_HEAP_SIZE - 2*cchFree;

    // Decommit unused memory in our column-name buffer.
    // We know it will never grow beyond what it is now.
    // Decommit all pages past where we currently are.
    BYTE  *pDiscardPage;
    ptrdiff_t  ulSize;
    pDiscardPage = (BYTE *) ROUND_UP( lpwstr, g_dwPageSize );
    ulSize       = MAX_HEAP_SIZE - (pDiscardPage - m_pbHeap);
    if (ulSize > 0)
        VirtualFree( pDiscardPage, ulSize, MEM_DECOMMIT );
    assert( '\0' == (*lpwstr = '\0'));  // We shouldn't generate a mem fault.

EXIT:
  if( FAILED(hr) )
  {
    if( m_pbHeap )
    {
      VirtualFree((VOID *) m_pbHeap, 0, MEM_RELEASE );
    }
    m_cbRowSize = m_cbHeapUsed = 0;
    return hr;
  }
  else
    return ResultFromScode( S_OK );
}

HRESULT CFileIO::GenerateFileInfo ( ) [private]

Definition at line 330 of file fileio.cpp.

{
    ULONG ulDex = 0;
    ULONG ulSavePos;

    // Generate Column Info, if NULL is returned, a problem
    // was encountered while reading the Column Names.
    if (S_FALSE != GetColumnName( 0, NULL ))
        return ResultFromScode( E_FAIL );

    // Generate DataType Mapping, if FALSE is returned, a problem
    // was encountered while reading the DataTypes
    if (S_FALSE != GetDataTypes( 0, NULL, NULL, NULL ))
        return ResultFromScode( E_FAIL );

    // Create and Initialize the Index Array
    if (FALSE == m_FileIdx.fInit())
        return ResultFromScode( E_FAIL );

  // Cache essentail column metadata
  if (FAILED(GatherColumnInfo()))
    return ResultFromScode( E_FAIL );

    // Obtain the starting offset for each row
    seekg( m_ulDataTypeOffset );
    ulSavePos = tellg();
    getline( m_pvInput, MAX_INPUT_BUFFER );
    while (good() && !eof())
        {
        //Ignore Deleted Lines
        if ('@' != *m_pvInput && '\0' != *m_pvInput)
            m_FileIdx.SetIndex( ulDex++, ulSavePos );
        ulSavePos = tellg();
        getline( m_pvInput, MAX_INPUT_BUFFER );
        }

    // Store the number of rows
    m_cRows = ulDex - 1;

    return ResultFromScode( S_OK );
}

DBCOLUMNINFO* CFileIO::GetColInfo ( ) [inline]

Definition at line 95 of file fileio.h.

{ return m_rgdbcolinfo; };

BYTE* CFileIO::GetColNameHeap ( ) [inline]

Definition at line 97 of file fileio.h.

{ return m_pbHeap; };

ULONG CFileIO::GetColNameHeapSize ( ) [inline]

Definition at line 99 of file fileio.h.

{ return m_cbHeapUsed; };

DBORDINAL CFileIO::GetColumnCnt ( ) [inline]

Definition at line 89 of file fileio.h.

{ return m_cColumns; };

COLUMNDATA * CFileIO::GetColumnData | ( | DBORDINAL | cCols,
 |  | ROWBUFF * | pRowBuff
 | ) |  |

Definition at line 948 of file fileio.cpp.

{
    assert( is_open());
    assert( m_rgdwDataOffsets );

    // If the column number is in range then return
    // the pointer
    if ((0 == cCols) || (m_cColumns < cCols))
        return NULL;

    return (COLUMNDATA *)((BYTE *)pRowBuff + m_rgdwDataOffsets[cCols]);
}

HRESULT CFileIO::GetColumnName | ( | DBORDINAL | cCols,
 |  | LPTSTR * | pptstrName = NULL
 | ) |  |
HRESULT CFileIO::GetDataTypes | ( | DBORDINAL | cCols,
 |  | SWORD * | pswType,
 |  | UDWORD * | pudwColDef,
 |  | BOOL * | pfSigned
 | ) |  |

Definition at line 217 of file fileio.cpp.

{
    HRESULT hr;

    // Column number greater than MAX
    if (cCols > MAX_COLUMNS)
        return ResultFromScode( E_FAIL );

    // If Data Types have not been retrieved,
    // then retrieve them into the internal array
    if (0 == m_ulDataTypeOffset)
        {
        seekg( 0L );
        clear();

        // To retrieve the Column Data Types, we need
        // to skip the first row and get to the 2nd row
        getline( m_pvInput, MAX_INPUT_BUFFER );
        m_ulDataTypeOffset = tellg();
        getline( m_pvInput, MAX_INPUT_BUFFER );

        // Check Stream status
        if (bad() || 0 == gcount())
            return ResultFromScode( E_FAIL );

        // Parse the datatypes from the stream.
        hr = ParseDataTypes();
        if (FAILED( hr ))
            return hr;

        return ResultFromScode( S_FALSE );
        }

    assert( pswType || pudwColDef || pfSigned );

    // If the column number is in range then return
    // the pointer
    if ((0 == cCols) || (m_cColumns < cCols))
        return ResultFromScode( E_FAIL );
    else
        {
        *pswType = m_rgswColType[cCols];
        *pudwColDef = m_rgudwColSize[cCols];
        *pfSigned = m_rgfSigned[cCols];
        return ResultFromScode( S_OK );
        }
}

DBCOUNTITEM CFileIO::GetRowCnt ( ) [inline]

Definition at line 91 of file fileio.h.

{ return m_cRows; };

DBLENGTH CFileIO::GetRowSize ( ) [inline]

Definition at line 101 of file fileio.h.

{ return m_cbRowSize; };

HRESULT CFileIO::IsDeleted ( DBCOUNTITEM ulRow )

Definition at line 381 of file fileio.cpp.

{
    // Already deleted
    if (TRUE == m_FileIdx.IsDeleted( ulRow ))
        return ResultFromScode( S_OK );
    else
        return ResultFromScode( S_FALSE );
}

BOOL CFileIO::IsReadOnly ( ) [inline]

Definition at line 93 of file fileio.h.

{ return m_FileReadOnly; };

HRESULT CFileIO::ParseColumnNames ( LPTSTR ptstrInput ) [private]

Definition at line 174 of file fileio.cpp.

{
    LPTSTR  pvInput = ptstrInput;

    ASSERT( pvInput );

    // Set first column pointer
    if ('\0' != *pvInput)
        {
        m_rgpColNames[++m_cColumns] = pvInput;
        }

    // Null Terminate each column
    while ('\0' != *pvInput)
        {
        // Check for Comma
        if (0 == strncmp( ",", pvInput, sizeof(char)))
            {
            memcpy( pvInput, "", sizeof(char));

            if (0 != strncmp( "", (pvInput+1), sizeof(char)))
                {
                m_rgpColNames[++m_cColumns] = (pvInput+1);
                }
            }

        pvInput++;
        }

    return ResultFromScode( S_OK );
}

HRESULT CFileIO::ParseDataTypes ( ) [private]

Definition at line 280 of file fileio.cpp.

{
    DBORDINAL cColumn = 0;
    LPSTR     pVal, pOpen;

    assert( m_pvInput );

    pVal = strtok( m_pvInput, ",\0" );
    if (NULL == pVal)
        return ResultFromScode( E_FAIL );

    while (NULL != pVal)
        {
        cColumn++;

        if (0 == _strnicmp( pVal, CHAR_STRING, CHAR_STRING_SIZE ))
            {
            m_rgswColType[cColumn] = TYPE_CHAR;
            pOpen = strstr( pVal, "(" );
            m_rgudwColSize[cColumn] = atol( ++pOpen );
            m_rgfSigned[cColumn] = FALSE;
            }
        else if (0 == _strnicmp( pVal, SLONG_STRING, SLONG_STRING_SIZE ))
            {
            m_rgswColType[cColumn] = TYPE_SLONG;
            m_rgudwColSize[cColumn] = 4;
            m_rgfSigned[cColumn] = TRUE;
            }
        else
            return ResultFromScode( E_FAIL );

        pVal = strtok( NULL, ",\0" );
        }

    // should have exactly the same number of types as we have columns
    if (cColumn != m_cColumns)
        return ResultFromScode( E_FAIL );

    return ResultFromScode( S_OK );
}

HRESULT CFileIO::ParseRowValues ( void )

Definition at line 539 of file fileio.cpp.

{
    DBORDINAL cColumns = 0;
    DWORD     cQuotes = 0;
    LPTSTR    pvCopy,
              pvInput,
              pLastQuote;

    pLastQuote = NULL;
    pvCopy = NULL;
    pvInput = m_pvInput;

    assert( pvInput );
    assert( m_cColumns > 0 );

    while ('\0' != *pvInput)
        {

        // Check for Quotes
        if (0 == strncmp( "\"", pvInput, sizeof( char )))
            {
            pLastQuote = pvInput;
            cQuotes++;
            goto TermCheck;
            }

        // Check for Comma
        // NOTE: THIS won't handle """
        if (0 == strncmp( ",", pvInput, sizeof( char )) &&
             0 == cQuotes % 2)
            {
            if (pLastQuote)
                memcpy( pLastQuote, "", sizeof( char ));
            else
                memcpy( pvInput, "", sizeof( char ));

            // Increment Columns processed
            cColumns++;

            //          TRACE(pvCopy ? pvCopy : "<NULL>");
            if (FAILED( FillBinding( cColumns, pvCopy )))
                return ResultFromScode( E_FAIL );

            pLastQuote = NULL;
            pvCopy = NULL;
            cQuotes = 0;
            goto TermCheck;
            }

        //Valid First character for next column
        if (NULL == pvCopy)
            pvCopy = pvInput;

        TermCheck:
        // Check for Final Null Terminator
        if (0 == strncmp( "", (pvInput+1), sizeof(char)))
            {
            //If we are to the null terminator and have unbalanced "'s
            //then we fail
            if (0 != cQuotes % 2)
                return ResultFromScode( E_FAIL );

            if (pLastQuote)
                memcpy( pLastQuote, "", sizeof(char));

            // Increment Columns processed
            cColumns++;

            //          TRACE(pvCopy ? pvCopy : "<NULL>");
            if (FAILED( FillBinding( cColumns, pvCopy )))
                return ResultFromScode( E_FAIL );
            }

        pvInput++;
        }

    // Check that we returned the correct number of columns
    if (cColumns < m_cColumns)
        return ResultFromScode( E_FAIL );

    return ResultFromScode( S_OK );
}

HRESULT CFileIO::SetColumnBind | ( | DBORDINAL | cCols,
 |  | PCOLUMNDATA | pColumn
 | ) |  |

Definition at line 454 of file fileio.cpp.

{
    assert( is_open());
    assert( m_rgpColumnData );

    // If the column number is in range then return
    // the pointer
    if ((0 == cCols) || (m_cColumns < cCols))
        return ResultFromScode( E_FAIL );

    // Expect valid pointer
    assert( pColumn );

    m_rgpColumnData[cCols] = pColumn;

    return ResultFromScode( S_OK );
}

HRESULT CFileIO::UpdateRow | ( | DBCOUNTITEM | ulRow,
 |  | BYTE * | pbProvRow,
 |  | UPDTYPE | eUpdateType
 | ) |  |

Definition at line 680 of file fileio.cpp.

{
    LPSTR       pvInput = m_pvInput;
  CHAR    szTmpBuff[MAX_BIND_LEN+1];
    PCOLUMNDATA pColData;
    DBORDINAL   cCols;
    int         nCnt;

  assert( is_open());
    assert( m_rgdwDataOffsets );

  // Fix up Row count
  if( eUpdateType == INSERT )
    m_cRows++;

  // Delete old Row
  if( (eUpdateType == UPDATE) &&
    (FAILED( DeleteRow( ulRow ))) )
      return ResultFromScode( E_FAIL );

  // Fix up Row offset value
  seekg( 0, ios::end );
  m_FileIdx.SetIndex( ulRow, tellg() );

    // Check the Row Number
    if ((ulRow < 0) || (ulRow > m_cRows))
        return ResultFromScode( E_FAIL );

    // Updated Rows are added to the end of the file, the row number will
    // remain the same until the rowset is closed, because the old
    // offset is deleted and the new is put in it's place.
    for (cCols = 1; cCols <= m_cColumns; cCols++)
        {
        nCnt = 0;

        pColData = GetColumnData(cCols, (ROWBUFF *)pbProvRow);

        // Handle NULL Data
        if (pColData->dwStatus != DBSTATUS_S_ISNULL)
            {
            switch (m_rgswColType[cCols])
                {
            case TYPE_CHAR:
        strncpy( szTmpBuff, (LPSTR)pColData->bData, pColData->dwLength );
        szTmpBuff[pColData->dwLength] = '\0';
                nCnt = wsprintf( pvInput, "\"%s\"", szTmpBuff );
                break;

            case TYPE_SLONG:
                nCnt = wsprintf( pvInput, "%d",
                    (signed long) *pColData->bData );
                break;

            default:
                assert( !"Unknown Data Type" );
                break;

                }

            }

        //Calculate the next append area
        pvInput = (pvInput + (nCnt * sizeof(char)));

        if (cCols == m_cColumns)
            lstrcat( pvInput, "\n" );
        else
            {
            lstrcat( pvInput, "," );
            pvInput = (pvInput + sizeof(char));
            }
        }

    // Write Stream to File
  // If Update change in place or InsertRow add to the end
  seekg( m_FileIdx.GetRowOffset( ulRow ) );

    clear();
    write( m_pvInput, lstrlen( m_pvInput ));
    if (bad())
        return ResultFromScode( E_FAIL );
    else
        flush();

    return ResultFromScode( S_OK );
}

Member Data Documentation

ULONG CFileIO::m_cbHeapUsed [private]

Definition at line 65 of file fileio.h.

DBLENGTH CFileIO::m_cbRowSize [private]

Definition at line 67 of file fileio.h.

DBORDINAL CFileIO::m_cColumns [private]

Definition at line 35 of file fileio.h.

DBCOUNTITEM CFileIO::m_cRows [private]

Definition at line 33 of file fileio.h.

CFileIdx CFileIO::m_FileIdx [private]

Definition at line 55 of file fileio.h.

BOOL CFileIO::m_FileReadOnly [private]

Definition at line 57 of file fileio.h.

BYTE* CFileIO::m_pbHeap [private]

Definition at line 63 of file fileio.h.

LPTSTR CFileIO::m_pColNames [private]

Definition at line 37 of file fileio.h.

LPTSTR CFileIO::m_pvInput [private]

Definition at line 51 of file fileio.h.

DBCOLUMNINFO CFileIO::m_rgdbcolinfo[MAX_COLUMNS] [private]

Definition at line 59 of file fileio.h.

DBLENGTH CFileIO::m_rgdwDataOffsets[MAX_COLUMNS] [private]

Definition at line 61 of file fileio.h.

BOOL CFileIO::m_rgfSigned[MAX_COLUMNS] [private]

Definition at line 45 of file fileio.h.

LPTSTR CFileIO::m_rgpColNames[MAX_COLUMNS] [private]

Definition at line 39 of file fileio.h.

PCOLUMNDATA CFileIO::m_rgpColumnData[MAX_COLUMNS] [private]

Definition at line 47 of file fileio.h.

SDWORD CFileIO::m_rgsdwMaxLen[MAX_COLUMNS] [private]

Definition at line 49 of file fileio.h.

SWORD CFileIO::m_rgswColType[MAX_COLUMNS] [private]

Definition at line 41 of file fileio.h.

UDWORD CFileIO::m_rgudwColSize[MAX_COLUMNS] [private]

Definition at line 43 of file fileio.h.

ULONG CFileIO::m_ulDataTypeOffset [private]

Definition at line 53 of file fileio.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/sampprov/fileio.h
  • Dataaccess/oledb/sampprov/fileio.cpp
Generated on Wed Nov 13 2024 16:56:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CFileLite Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CFileLite Class Reference

#include "cdialoglite.h"

List of all members.

Public Member Functions

CFileLite ()
virtual | ~CFileLite ()
virtual HRESULT | Close ()
virtual BOOL | DetermineUnicode ()
virtual HRESULT | Flush ()
virtual BOOL | IsEOF ()
virtual BOOL | IsOpen ()
virtual BOOL | IsUnicode ()
virtual HRESULT | Open (LPCSTR pszFileName, DWORD dwDesiredAccess=GENERIC_READ, DWORD dwShareMode=FILE_SHARE_READ, DWORD dwCreationDisposition=OPEN_EXISTING, BOOL fDisplayDialog=FALSE, HWND hWndParent=NULL)
virtual HRESULT | Open (LPCWSTR pwszFileName, DWORD dwDesiredAccess=GENERIC_READ, DWORD dwShareMode=FILE_SHARE_READ, DWORD dwCreationDisposition=OPEN_EXISTING, BOOL fDisplayDialog=FALSE, HWND hWndParent=NULL)
virtual HRESULT | Read (ULONG cbBytes, CHAR *pszText, ULONG *pcbRead=NULL)
virtual HRESULT | Read (ULONG cbBytes, WCHAR *pwszText, ULONG *pcbRead=NULL)
virtual HRESULT | ReadBytes (ULONG cbBytes, BYTE *rgBytes, ULONG *pcbRead=NULL)
virtual DWORD | Seek (LONG lDistanceToMove, DWORD dwOrigin)
virtual void | SetUnicode (BOOL bUnicode=TRUE)
virtual HRESULT | Write (LPCSTR pszText, ULONG *pcbWritten=NULL)
virtual HRESULT | Write (LPCWSTR pwszText, ULONG *pcbWritten=NULL)
virtual HRESULT | WriteBytes (ULONG cBytes, BYTE *rgBytes, ULONG *pcbWritten=NULL)
virtual HRESULT | WriteFormat (LPCWSTR pwszFmt,...)
virtual HRESULT | WriteQuoted (LPCWSTR pwszText)

Private Attributes

BOOL m_bEOF
BOOL m_bUnicode
ULONG m_cbRead
ULONG m_cbWritten
HANDLE m_hFile

Detailed Description

Definition at line 1091 of file cdialoglite.h.

Constructor & Destructor Documentation

CFileLite::CFileLite ( )

Definition at line 4618 of file cdialoglite.cpp.

{
  m_hFile   = NULL;
  m_bEOF    = FALSE;

  m_bUnicode  = FALSE;
  m_cbWritten = 0;
  m_cbRead  = 0;
}

CFileLite::~CFileLite ( ) [virtual]

Definition at line 4633 of file cdialoglite.cpp.

{
  //Cannot Call Virtual function from destructor
  CFileLite::Close();
}

Member Function Documentation

HRESULT CFileLite::Close ( void ) [virtual]

Definition at line 5082 of file cdialoglite.cpp.

{
  if(m_hFile)
  {
    Flush();
    CloseHandle(m_hFile);
  }

  m_hFile   = NULL;
  m_bEOF    = FALSE;
  m_cbWritten = 0;
  m_cbRead  = 0;
  return S_OK;
}

BOOL CFileLite::DetermineUnicode ( ) [virtual]

Definition at line 4737 of file cdialoglite.cpp.

{
  //When you open a file in Notepad, Notepad calls a Win32 function named IsTextUnicode.
  //This function determines whether the file uses Unicode. If the file starts with the
  //conventional signature for Unicode the BOM U+FEFF it knows to treat the file as Unicode.
  //(Notepad always adds a BOM to a Unicode file when saving it and hides it again when opening
  //the file.) If there is no BOM, IsTextUnicode can only guess whether the file uses Unicode
  //based on a number of rules (described in the Visual C++ 2 documentation of IsTextUnicode).
  if(!m_cbRead)
  {
    //If we have not read any characters yet, we need to read the first 2 characters
    //(which may contain the BOM - Byte Order Mark) to determine if unicode or MBCS format
    WCHAR wBOM = wEOL;
    if(ReadFile(m_hFile, &wBOM, sizeof(wBOM), &m_cbRead, NULL))
    {
      if(wBOM == UNICODE_BYTE_ORDER_MARK)
      {
        //Unicode file
        m_bUnicode = TRUE;
      }
      else
      {
        //Otherwise its not Unicode, and the bytes we just read are real
        //data, so "unread" them by moving the seek pointer back...
        Seek(-(LONG)m_cbRead, FILE_CURRENT);
        m_bUnicode = FALSE;
      }
    }
  }

  return m_bUnicode;
}

HRESULT CFileLite::Flush ( ) [virtual]

Definition at line 5068 of file cdialoglite.cpp.

{
  if(m_hFile)
  {
//    return FlushFileBuffers(m_hFile) ? S_OK : E_FAIL;
  }

  return S_OK;
}

virtual BOOL CFileLite::IsEOF ( ) [inline, virtual]

Definition at line 1123 of file cdialoglite.h.

{ return m_bEOF;      }

virtual BOOL CFileLite::IsOpen ( ) [inline, virtual]

Definition at line 1122 of file cdialoglite.h.

{ return m_hFile != NULL; }

virtual BOOL CFileLite::IsUnicode ( ) [inline, virtual]

Definition at line 1126 of file cdialoglite.h.

{ return m_bUnicode;    }

HRESULT CFileLite::Open | ( | LPCWSTR | pwszFileName,
 |  | DWORD | dwDesiredAccess = GENERIC_READ,
 |  | DWORD | dwShareMode = FILE_SHARE_READ,
 |  | DWORD | dwCreationDisposition = OPEN_EXISTING,
 |  | BOOL | fDisplayDialog = FALSE,
 |  | HWND | hWndParent = NULL |
 | ) |  |  | [virtual]

Definition at line 4644 of file cdialoglite.cpp.

{
  ASSERT(m_hFile == NULL);

  if(IsUnicodeOS())
  {
    m_hFile = CreateFileW
          (
            pwszFileName,
            dwDesiredAccess,          // access (read-write) mode
            dwShareMode,            // share mode
            NULL,               // pointer to security attributes
            dwCreationDisposition,        // how to create
            FILE_ATTRIBUTE_NORMAL,        // file attributes
            NULL                // handle to file with attributes to copy
          );

    if(m_hFile==INVALID_HANDLE_VALUE)
    {
      if(fDisplayDialog)
      {
        wMessageBox(hWndParent, MB_TASKMODAL | MB_ICONERROR | MB_OK, wsz_ERROR, L"Unable to open file \"%s\", make sure File Name and Path are valid", pwszFileName);
        if(hWndParent)
          SetFocus(hWndParent);
      }
      m_hFile = NULL;
    }
  }
  else
  {
    static CHAR szFileName[MAX_NAME_LEN] = {0};
    ConvertToMBCS(pwszFileName, szFileName, MAX_NAME_LEN);

    //Delegate
    return Open(szFileName, dwDesiredAccess, dwShareMode, dwCreationDisposition,
            fDisplayDialog, hWndParent);
  }

  return m_hFile ? S_OK : E_FAIL;
}

HRESULT CFileLite::Open | ( | LPCSTR | pszFileName,
 |  | DWORD | dwDesiredAccess = GENERIC_READ,
 |  | DWORD | dwShareMode = FILE_SHARE_READ,
 |  | DWORD | dwCreationDisposition = OPEN_EXISTING,
 |  | BOOL | fDisplayDialog = FALSE,
 |  | HWND | hWndParent = NULL |
 | ) |  |  | [virtual]

Definition at line 4690 of file cdialoglite.cpp.

{
  ASSERT(m_hFile == NULL);

  m_hFile = CreateFileA
        (
          pszFileName,
          dwDesiredAccess,          // access (read-write) mode
          dwShareMode,            // share mode
          NULL,               // pointer to security attributes
          dwCreationDisposition,        // how to create
          FILE_ATTRIBUTE_NORMAL,        // file attributes
          NULL                // handle to file with attributes to copy
        );

  if(m_hFile==INVALID_HANDLE_VALUE)
  {
    if(fDisplayDialog)
    {
      wMessageBox(hWndParent, MB_TASKMODAL | MB_ICONERROR | MB_OK, wsz_ERROR, L"Unable to open file \"%S\", make sure File Name and Path are valid", pszFileName);
      if(hWndParent)
        SetFocus(hWndParent);
    }
    m_hFile = NULL;
  }

  return m_hFile ? S_OK : E_FAIL;
}

HRESULT CFileLite::Read | ( | ULONG | cbBytes,
 |  | WCHAR * | pwszText,
 |  | ULONG * | pcbRead = NULL |
 | ) |  |  | [virtual]

Definition at line 4775 of file cdialoglite.cpp.

{
  ULONG cbRead = 0;
  HRESULT hr = S_OK;

  if(m_hFile && pwszText)
  {
    if(DetermineUnicode())
    {
      //The file is Unicode, just read directly into unicode string
      hr = ReadBytes(cbBytes, (BYTE*)pwszText, &cbRead);
    }
    else
    {
      static CHAR szBuffer[MAX_QUERY_LEN] = {0};

      //The file is MBCS, conversion is required to Unicode string
      hr = ReadBytes(min(cbBytes/2, sizeof(szBuffer)), (BYTE*)szBuffer, &cbRead);
      if(SUCCEEDED(hr))
      {
        ConvertToWCHAR(szBuffer, pwszText, cbBytes);
        cbRead = cbRead*sizeof(WCHAR);
      }
    }
  }

  if(pcbRead)
    *pcbRead = cbRead;
  return hr;
}

HRESULT CFileLite::Read | ( | ULONG | cbBytes,
 |  | CHAR * | pszText,
 |  | ULONG * | pcbRead = NULL |
 | ) |  |  | [virtual]

Definition at line 4811 of file cdialoglite.cpp.

{
  ULONG cbRead = 0;
  HRESULT hr = S_OK;

  if(m_hFile && pszText)
  {
    if(DetermineUnicode())
    {
      static WCHAR wszBuffer[MAX_QUERY_LEN] = {0};

      //The file is Unicode, conversion is required to MBCS string
      hr = ReadBytes(min(cbBytes*2, sizeof(wszBuffer)), (BYTE*)wszBuffer, &cbRead);
      if(SUCCEEDED(hr))
      {
        ConvertToMBCS(wszBuffer, pszText, cbBytes);
        cbRead = cbRead/sizeof(WCHAR);
      }
    }
    else
    {
      //The file is MBCS, just read directly from the stream
      hr = ReadBytes(cbBytes, (BYTE*)pszText, &cbRead);
    }
  }

  if(pcbRead)
    *pcbRead = cbRead;
  return hr;
}

HRESULT CFileLite::ReadBytes | ( | ULONG | cbBytes,
 |  | BYTE * | rgBytes,
 |  | ULONG * | pcbRead = NULL |
 | ) |  |  | [virtual]

Definition at line 4847 of file cdialoglite.cpp.

{
  ULONG cbRead = 0;
  HRESULT hr = S_OK;

  if(m_hFile && cbBytes)
  {
    ASSERT(rgBytes);

    //Read from the file...
    if(ReadFile(m_hFile, rgBytes, cbBytes, &cbRead, NULL))
    {
      if(cbBytes == cbRead)
        hr = S_OK;
      else
        hr = S_FALSE;
    }
    else
    {
      hr = E_FAIL;
    }
  }

  if(pcbRead)
    *pcbRead = cbRead;

  m_bEOF = (hr != S_OK);
  return hr;
}

DWORD CFileLite::Seek | ( | LONG | lDistanceToMove,
 |  | DWORD | dwOrigin |
 | ) |  |  | [virtual]

Definition at line 4724 of file cdialoglite.cpp.

{
  if(m_hFile)
    return SetFilePointer(m_hFile, lDistanceToMove, NULL, dwOrigin);

  return 0;
}

virtual void CFileLite::SetUnicode ( BOOL bUnicode = TRUE ) [inline, virtual]

Definition at line 1127 of file cdialoglite.h.

{ m_bUnicode = bUnicode;  }

HRESULT CFileLite::Write | ( | LPCSTR | pszText,
 |  | ULONG * | pcbWritten = NULL |
 | ) |  |  | [virtual]

Definition at line 4915 of file cdialoglite.cpp.

{
  ULONG cbWritten = 0;
  HRESULT hr = S_OK;

  if(m_hFile && pszText)
  {
    if(IsUnicode())
    {
      //The file is Unicode, but the string is ANSI
      //Conversion required...
      static WCHAR wszBuffer[MAX_QUERY_LEN] = {0};
      ConvertToWCHAR(pszText, wszBuffer, MAX_QUERY_LEN);

      hr = WriteBytes(wcslen(wszBuffer)*sizeof(WCHAR), (BYTE*)wszBuffer, &cbWritten);
    }
    else
    {
      //The File is ANSI(MBCS), just directly write out the stream of bytes
      //to MBCS before writting it directly to the file...
      hr = WriteBytes(strlen(pszText)*sizeof(CHAR), (BYTE*)pszText, &cbWritten);
    }
  }

  if(pcbWritten)
    *pcbWritten = cbWritten;
  return hr;
}

HRESULT CFileLite::Write | ( | LPCWSTR | pwszText,
 |  | ULONG * | pcbWritten = NULL |
 | ) |  |  | [virtual]

Definition at line 4882 of file cdialoglite.cpp.

{
  ULONG cbWritten = 0;
  HRESULT hr = S_OK;

  if(m_hFile && pwszText)
  {
    if(IsUnicode())
    {
      //The file is Unicode, just directly write out the stream of unicode bytes
      hr = WriteBytes(wcslen(pwszText)*sizeof(WCHAR), (BYTE*)pwszText, &cbWritten);
    }
    else
    {
      //The File is ANSI(MBCS), but the string is Unicode
      //Conversion required...
      static CHAR szBuffer[MAX_QUERY_LEN] = {0};
      ConvertToMBCS(pwszText, szBuffer, MAX_QUERY_LEN);

      hr = WriteBytes(strlen(szBuffer)*sizeof(CHAR), (BYTE*)szBuffer, &cbWritten);
    }
  }

  if(pcbWritten)
    *pcbWritten = cbWritten;
  return hr;
}

HRESULT CFileLite::WriteBytes | ( | ULONG | cBytes,
 |  | BYTE * | rgBytes,
 |  | ULONG * | pcbWritten = NULL |
 | ) |  |  | [virtual]

Definition at line 4949 of file cdialoglite.cpp.

{
  ULONG cbWritten = 0;
  HRESULT hr = S_OK;

  if(m_hFile && cBytes)
  {
    ASSERT(rgBytes);

    //When saving as a Unicode Text file, Notepad always writes out a byte order mark (BOM)
    //Unicode character U+FEFF as the first Unicode character in a file.
    //It uses this character (and not the file extension) to help it distinguish Unicode text
    //from other data.
    if(IsUnicode() && !m_cbWritten)
    {
      //If the file format is Unicode, and we haven't written any bytes to file
      //yet then write out the BOM (Byte Order Mark) to indicate unicode.
      WriteFile(m_hFile, &UNICODE_BYTE_ORDER_MARK, sizeof(UNICODE_BYTE_ORDER_MARK), &m_cbWritten, NULL);
    }

    //Output to the file
    if(WriteFile(m_hFile, rgBytes, cBytes, &cbWritten, NULL))
      hr = S_OK;
    else
      hr = E_FAIL;
  }

  if(pcbWritten)
    *pcbWritten = cbWritten;
  return hr;
}

HRESULT CFileLite::WriteFormat | ( | LPCWSTR | pwszFmt,
 |  |  | ... |
 | ) |  |  | [virtual]

Definition at line 5041 of file cdialoglite.cpp.

{
  if(!IsOpen())
    return S_OK;

  va_list   marker;
  WCHAR   wszBuffer[MAX_QUERY_LEN];

  // Use format and arguements as input
  //This version will not overwrite the stack, since it only copies
  //upto the max size of the array
  va_start(marker, pwszFmt);
  _vsnwprintf(wszBuffer, MAX_QUERY_LEN, pwszFmt, marker);
  va_end(marker);

  //Make sure there is a NULL Terminator, vsnwprintf will not copy
  //the terminator if length==MAX_QUERY_LEN
  wszBuffer[MAX_QUERY_LEN-1] = wEOL;

  //Delegate
  return Write(wszBuffer);
}

HRESULT CFileLite::WriteQuoted ( LPCWSTR pwszText ) [virtual]

Definition at line 4986 of file cdialoglite.cpp.

{
  if(pwszText == NULL)
  {
    //Simple, empty string within quotes...
    Write(L"\"\"");
  }
  else if(wcschr(pwszText, L'\'')==NULL)
  {
    //String doesn't have embedded single quotes, so we can safely use this for outside
    Write(L"\'");
    Write(pwszText);
    Write(L"\'");
  }
  else if(wcschr(pwszText, L'\"')==NULL)
  {
    //String doesn't have embedded double quotes, so we can safely use this for outside
    Write(L"\"");
    Write(pwszText);
    Write(L"\"");
  }
  else
  {
    //String contains both single and double quotes!
    //We will need to double the embedded single quotes, so their is no confusion
    //on where the string begins or ends...
    Write(L"\'");

    LPCWSTR pwszString = pwszText;
    WCHAR* pwszQuote = wcschr(pwszString, L'\'');
    while(pwszQuote && pwszString[0])
    {
      //Output upto the single quote, and output two single quotes
      *pwszQuote = L'\0';
      Write(pwszString);
      Write(L"\'\'");
      *pwszQuote = L'\'';

      //Move to the next part of the string after what we have already output'ed
      pwszString = pwszQuote + 1;
      pwszQuote = wcschr(pwszString, L'\'');
    }

    //Output the rest of the string
    Write(pwszString);
    Write(L"\'");
  }

  return S_OK;
}

Member Data Documentation

BOOL CFileLite::m_bEOF [private]

Definition at line 1133 of file cdialoglite.h.

BOOL CFileLite::m_bUnicode [private]

Definition at line 1135 of file cdialoglite.h.

ULONG CFileLite::m_cbRead [private]

Definition at line 1137 of file cdialoglite.h.

ULONG CFileLite::m_cbWritten [private]

Definition at line 1136 of file cdialoglite.h.

HANDLE CFileLite::m_hFile [private]

Definition at line 1132 of file cdialoglite.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialoglite.h
  • Dataaccess/oledb/rowsetviewer/cdialoglite.cpp
Generated on Wed Nov 13 2024 16:56:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CFileShareSampleApp Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CFileShareSampleApp Class Reference

Inherits CWinApp.

List of all members.

Public Member Functions

virtual int | ExitInstance ()
virtual BOOL | InitInstance ()

Detailed Description

Definition at line 80 of file File Share SampleEx.cpp.

Member Function Documentation

int CFileShareSampleApp::ExitInstance ( void ) [virtual]

Reimplemented from CWinApp.

Definition at line 135 of file File Share SampleEx.cpp.

{
    _Module.Term();

    return CWinApp::ExitInstance();

}  //*** CFileShareSampleApp::ExitInstance

BOOL CFileShareSampleApp::InitInstance ( void ) [virtual]

Reimplemented from CWinApp.

Definition at line 110 of file File Share SampleEx.cpp.

{
    _Module.Init( ObjectMap, m_hInstance );

    return CWinApp::InitInstance();

}  //*** CFileShareSampleApp::InitInstance

The documentation for this class was generated from the following file:
  • WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/File Share SampleEx.cpp
Generated on Wed Nov 13 2024 16:56:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CFileShareSampleParamsPage Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes

CFileShareSampleParamsPage Class Reference

#include "ResProp.h"

Inherits CBasePropertyPage.

List of all members.

Public Types

enum | { IDD = IDD_PP_FILESHARESAMPLE_PARAMETERS }

Public Member Functions

CFileShareSampleParamsPage (void)
virtual BOOL | OnSetActive ()

Public Attributes

CEdit | m_editPath
CEdit | m_editShareName
DWORD m_nMaxUsers
DWORD m_nPrevMaxUsers
CString m_strPath
CString m_strPrevPath
CString m_strPrevRemark
CString m_strPrevShareName
CString m_strRemark
CString m_strShareName

Protected Types

enum {
epropShareName, epropPath, epropRemark, epropMaxUsers,
epropMAX
}

Protected Member Functions

BOOL | BAllRequiredFieldsPresent (void) const
virtual DWORD | Cprops (void) const
virtual void | DoDataExchange (CDataExchange *pDX)
afx_msg void | OnChangeRequiredField ()
virtual BOOL | OnInitDialog ()
virtual const CObjectProperty * | Pprops (void) const

Protected Attributes

CObjectProperty | m_rgProps [epropMAX]

Detailed Description

Definition at line 56 of file ResProp.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 73 of file ResProp.h.

{ IDD = IDD_PP_FILESHARESAMPLE_PARAMETERS };

anonymous enum [protected]
Enumerator:
epropShareName
epropPath
epropRemark
epropMaxUsers
epropMAX

Definition at line 87 of file ResProp.h.

    {
        epropShareName,
        epropPath,
        epropRemark,
        epropMaxUsers,
        epropMAX
    };

Constructor & Destructor Documentation

CFileShareSampleParamsPage::CFileShareSampleParamsPage ( void )

Definition at line 71 of file ResProp.cpp.

    : CBasePropertyPage( CFileShareSampleParamsPage::IDD )
{
    //
    //  TODO: Modify the following lines to represent the data displayed on this page.
    //

    //{{AFX_DATA_INIT(CFileShareSampleParamsPage)
    m_strShareName = _T("");
    m_strPath = _T("");
    m_strRemark = _T("");
    m_nMaxUsers = static_cast< DWORD >( 4294967295 );
    //}}AFX_DATA_INIT

    // Setup the property array.
    {
        m_rgProps[ epropShareName ].Set( REGPARAM_FILESHARESAMPLE_SHARENAME, m_strShareName, m_strPrevShareName );
        m_rgProps[ epropPath ].SetExpandSz( REGPARAM_FILESHARESAMPLE_PATH, m_strPath, m_strPrevPath );
        m_rgProps[ epropRemark ].Set( REGPARAM_FILESHARESAMPLE_REMARK, m_strRemark, m_strPrevRemark );
        m_rgProps[ epropMaxUsers ].Set( REGPARAM_FILESHARESAMPLE_MAXUSERS, m_nMaxUsers, m_nPrevMaxUsers );
    } // Setup the property array

    m_iddPropertyPage = IDD_PP_FILESHARESAMPLE_PARAMETERS;
    m_iddWizardPage = IDD_WIZ_FILESHARESAMPLE_PARAMETERS;

} //*** CFileShareSampleParamsPage::CFileShareSampleParamsPage

Member Function Documentation

BOOL CFileShareSampleParamsPage::BAllRequiredFieldsPresent ( void ) const [protected]

Definition at line 300 of file ResProp.cpp.

{
    BOOL    fPresent;

    if ( 0
        || (m_editShareName.GetWindowTextLength() == 0)
        || (m_editPath.GetWindowTextLength() == 0)
        )
    {
        fPresent = FALSE;
    } // if: required field not present
    else
    {
        fPresent = TRUE;
    } // else: all required fields are present

    return fPresent;

} //*** CFileShareSampleParamsPage::BAllRequiredFieldsPresent

virtual DWORD CFileShareSampleParamsPage::Cprops ( void ) const [inline, protected, virtual]

Reimplemented from CBasePropertyPage.

Definition at line 108 of file ResProp.h.

{ return sizeof( m_rgProps ) / sizeof( CObjectProperty ); }

void CFileShareSampleParamsPage::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Reimplemented from CBasePropertyPage.

Definition at line 116 of file ResProp.cpp.

{
    if ( ! pDXIn->m_bSaveAndValidate || ! BSaved() )
    {
        AFX_MANAGE_STATE( AfxGetStaticModuleState() );

        //
        //  TODO: Modify the following lines to represent the data displayed on this page.
        //

        //  {{AFX_DATA_MAP(CFileShareSampleParamsPage)
        DDX_Control( pDXIn, IDC_PP_FILESHARESAMPLE_SHARENAME, m_editShareName );
        DDX_Control( pDXIn, IDC_PP_FILESHARESAMPLE_PATH, m_editPath );
        DDX_Text( pDXIn, IDC_PP_FILESHARESAMPLE_SHARENAME, m_strShareName );
        DDX_Text( pDXIn, IDC_PP_FILESHARESAMPLE_PATH, m_strPath );
        DDX_Text( pDXIn, IDC_PP_FILESHARESAMPLE_REMARK, m_strRemark );
        DDX_Text( pDXIn, IDC_PP_FILESHARESAMPLE_MAXUSERS, m_nMaxUsers );
        //}}AFX_DATA_MAP

        //
        //  Handle numeric parameters.
        //

        if ( ! BBackPressed() )
        {
            DDX_Number(
                  pDXIn
                , IDC_PP_FILESHARESAMPLE_MAXUSERS
                , m_nMaxUsers
                , static_cast< DWORD >( 0 )
                , static_cast< DWORD >( 4294967295 )
                , FALSE /*bSigned*/
                );
        } // if: back button not pressed

        //
        //  TODO: Add any additional field validation here.
        //

        if ( pDXIn->m_bSaveAndValidate )
        {
            //
            //  Make sure all required fields are present.
            //

            if ( ! BBackPressed() )
            {
                DDV_RequiredText( pDXIn, IDC_PP_FILESHARESAMPLE_SHARENAME, IDC_PP_FILESHARESAMPLE_SHARENAME_LABEL, m_strShareName );
                DDV_RequiredText( pDXIn, IDC_PP_FILESHARESAMPLE_PATH, IDC_PP_FILESHARESAMPLE_PATH_LABEL, m_strPath );
            } // if: back button not pressed
        } // if: saving data from dialog
    } // if: not saving or haven't saved yet

    CBasePropertyPage::DoDataExchange( pDXIn );

} //*** CFileShareSampleParamsPage::DoDataExchange

void CFileShareSampleParamsPage::OnChangeRequiredField ( void ) [protected]

Definition at line 269 of file ResProp.cpp.

{
    AFX_MANAGE_STATE( AfxGetStaticModuleState() );

    OnChangeCtrl();

    if ( BWizard() )
    {
        EnableNext( BAllRequiredFieldsPresent() );
    } // if: displaying a wizard

} //*** CFileShareSampleParamsPage::OnChangeRequiredField

BOOL CFileShareSampleParamsPage::OnInitDialog ( void ) [protected, virtual]

Reimplemented from CBasePropertyPage.

Definition at line 196 of file ResProp.cpp.

{
    AFX_MANAGE_STATE( AfxGetStaticModuleState() );

    CBasePropertyPage::OnInitDialog();

    //
    //  TODO: Limit the size of the text that can be entered in edit controls.
    //

    //
    //  Return TRUE unless you set the focus to a control.
    //
    //  EXCEPTION: OCX Property Pages should return FALSE..
    //

    return TRUE;

} //*** CFileShareSampleParamsPage::OnInitDialog

BOOL CFileShareSampleParamsPage::OnSetActive ( void ) [virtual]

Reimplemented from CBasePropertyPage.

Definition at line 237 of file ResProp.cpp.

{
    AFX_MANAGE_STATE( AfxGetStaticModuleState() );

    // Enable/disable the Next/Finish button.
    if ( BWizard() )
    {
        EnableNext( BAllRequiredFieldsPresent() );
    } // if: displaying a wizard

    return CBasePropertyPage::OnSetActive();

} //*** CFileShareSampleParamsPage::OnSetActive

virtual const CObjectProperty* CFileShareSampleParamsPage::Pprops ( void ) const [inline, protected, virtual]

Reimplemented from CBasePropertyPage.

Definition at line 107 of file ResProp.h.

{ return m_rgProps; }

Member Data Documentation

CEdit CFileShareSampleParamsPage::m_editPath

Definition at line 75 of file ResProp.h.

CEdit CFileShareSampleParamsPage::m_editShareName

Definition at line 74 of file ResProp.h.

DWORD CFileShareSampleParamsPage::m_nMaxUsers

Definition at line 79 of file ResProp.h.

DWORD CFileShareSampleParamsPage::m_nPrevMaxUsers

Definition at line 84 of file ResProp.h.

CObjectProperty CFileShareSampleParamsPage::m_rgProps[epropMAX] [protected]

Definition at line 95 of file ResProp.h.

CString CFileShareSampleParamsPage::m_strPath

Definition at line 77 of file ResProp.h.

CString CFileShareSampleParamsPage::m_strPrevPath

Definition at line 82 of file ResProp.h.

CString CFileShareSampleParamsPage::m_strPrevRemark

Definition at line 83 of file ResProp.h.

CString CFileShareSampleParamsPage::m_strPrevShareName

Definition at line 81 of file ResProp.h.

CString CFileShareSampleParamsPage::m_strRemark

Definition at line 78 of file ResProp.h.

CString CFileShareSampleParamsPage::m_strShareName

Definition at line 76 of file ResProp.h.

The documentation for this class was generated from the following files:
  • WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/ResProp.h
  • WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/ResProp.cpp
Generated on Wed Nov 13 2024 16:56:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CFileStream Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes | Private Attributes

CFileStream Class Reference

#include "cstream.h"

List of all members.

Public Member Functions

CFileStream ()
virtual | ~CFileStream ()
STDMETHODIMP | Clone (IStream **ppstm)
HRESULT | CloseFile ()
STDMETHODIMP | Commit (DWORD grfCommitFlags)
STDMETHODIMP | CopyTo (IStream *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten)
STDMETHODIMP | LockRegion (ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
HRESULT | OpenFile (WCHAR *pwszFile, WCHAR *pwszMode)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | Read (void *pv, ULONG cb, ULONG *pcbRead)
STDMETHODIMP | Revert ()
STDMETHODIMP | Seek (LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
STDMETHODIMP | SetSize (ULARGE_INTEGER libNewSize)
STDMETHODIMP | Stat (STATSTG *pstatstg, DWORD grfStatFlag)
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP | UnlockRegion (ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
STDMETHODIMP | Write (const void *pv, ULONG cb, ULONG *pcbWritten)

Protected Attributes

FILE * | m_pFile

Private Attributes

ULONG m_cRef

Detailed Description

Definition at line 169 of file cstream.h.

Constructor & Destructor Documentation

CFileStream::CFileStream ( )

Definition at line 884 of file cstream.cpp.

{
  m_pFile = NULL;
  m_cRef  = 1;
}

CFileStream::~CFileStream ( ) [virtual]

Definition at line 890 of file cstream.cpp.

{
  CloseFile();
}

Member Function Documentation

HRESULT CFileStream::Clone ( IStream ** ppstm )

Definition at line 1067 of file cstream.cpp.

{
  return E_NOTIMPL;
}

HRESULT CFileStream::CloseFile ( )

Definition at line 915 of file cstream.cpp.

{
  if(m_pFile)
    fclose(m_pFile);

  return S_OK;
}

HRESULT CFileStream::Commit ( DWORD grfCommitFlags )

Definition at line 1037 of file cstream.cpp.

{
  return E_NOTIMPL;
}

HRESULT CFileStream::CopyTo | ( | IStream * | pstm,
 |  | ULARGE_INTEGER | cb,
 |  | ULARGE_INTEGER * | pcbRead,
 |  | ULARGE_INTEGER * | pcbWritten
 | ) |  |

Definition at line 1029 of file cstream.cpp.

{
  return E_NOTIMPL;
}

HRESULT CFileStream::LockRegion | ( | ULARGE_INTEGER | libOffset,
 |  | ULARGE_INTEGER | cb,
 |  | DWORD | dwLockType
 | ) |  |

Definition at line 1047 of file cstream.cpp.

{
  return E_NOTIMPL;
}

HRESULT CFileStream::OpenFile | ( | WCHAR * | pwszFile,
 |  | WCHAR * | pwszMode
 | ) |  |

Definition at line 895 of file cstream.cpp.

{
  if(IsUnicodeOS())
  {
    m_pFile = _wfopen(pwszFile, pwszMode);
  }
  else
  {
    CHAR szFileName[MAX_NAME_LEN];
    ConvertToMBCS(pwszFile, szFileName, MAX_NAME_LEN);
    CHAR szMode[MAX_NAME_LEN];
    ConvertToMBCS(pwszMode, szMode, MAX_NAME_LEN);

    m_pFile = fopen(szFileName, szMode);
  }

  return m_pFile ? S_OK : STG_E_ACCESSDENIED;
}

STDMETHODIMP CFileStream::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CFileStream::Read | ( | void * | pv,
 |  | ULONG | cb,
 |  | ULONG * | pcbRead
 | ) |  |

Definition at line 965 of file cstream.cpp.

{
  ULONG cbRead = 0;

  //Parameter checking
  if(!m_pFile)
    return STG_E_INVALIDHANDLE;
  if(!pv)
    return STG_E_INVALIDPOINTER;
  if(cb == 0)
    return S_OK;

  //Read from the file...
  cbRead = fread(pv, sizeof(BYTE), cb, m_pFile);

  //Results..
  if(pcbRead)
    *pcbRead = cbRead;
  return cbRead==cb ? S_OK : S_FALSE;
}

HRESULT CFileStream::Revert ( void )

Definition at line 1042 of file cstream.cpp.

{
  return E_NOTIMPL;
}

HRESULT CFileStream::Seek | ( | LARGE_INTEGER | dlibMove,
 |  | DWORD | dwOrigin,
 |  | ULARGE_INTEGER * | plibNewPosition
 | ) |  |

Definition at line 1009 of file cstream.cpp.

{
  //Parameter checking
  if(!m_pFile)
    return STG_E_INVALIDHANDLE;

  //Seek
  LONG lNewPosition = fseek(m_pFile, dlibMove.LowPart, dwOrigin);
  if (lNewPosition >= 0 && plibNewPosition)
    plibNewPosition->LowPart = lNewPosition;

  return (lNewPosition >= 0) ? S_OK : E_FAIL;
}

HRESULT CFileStream::SetSize ( ULARGE_INTEGER libNewSize )

Definition at line 1024 of file cstream.cpp.

{
  return E_NOTIMPL;
}

HRESULT CFileStream::Stat | ( | STATSTG * | pstatstg,
 |  | DWORD | grfStatFlag
 | ) |  |

Definition at line 1061 of file cstream.cpp.

{
  return E_NOTIMPL;
}

CFileStream::STDMETHODIMP_ ( ULONG )
CFileStream::STDMETHODIMP_ ( ULONG )
HRESULT CFileStream::UnlockRegion | ( | ULARGE_INTEGER | libOffset,
 |  | ULARGE_INTEGER | cb,
 |  | DWORD | dwLockType
 | ) |  |

Definition at line 1054 of file cstream.cpp.

{
  return E_NOTIMPL;
}

STDMETHODIMP CFileStream::Write | ( | const void * | pv,
 |  | ULONG | cb,
 |  | ULONG * | pcbWritten
 | ) |  |

Definition at line 987 of file cstream.cpp.

{
  ULONG cbWritten = 0;

  //Parameter checking
  if(!m_pFile)
    return STG_E_INVALIDHANDLE;
  if(!pv)
    return STG_E_INVALIDPOINTER;
  if(cb == 0)
    return S_OK;

  //Read from the file...
  cbWritten = fwrite(pv, sizeof(BYTE), cb, m_pFile);

  //Results..
  if(pcbWritten)
    *pcbWritten = cbWritten;
  return cbWritten==cb ? S_OK : S_FALSE;
}

Member Data Documentation

ULONG CFileStream::m_cRef [private]

Definition at line 230 of file cstream.h.

FILE* CFileStream::m_pFile [protected]

Definition at line 227 of file cstream.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cstream.h
  • Dataaccess/oledb/rowsetviewer/cstream.cpp
Generated on Wed Nov 13 2024 16:56:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CFileTransferNotify Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CFileTransferNotify Class Reference

#include "cft.h"

Inherits RefCount, and CNotify.

List of all members.

Public Member Functions

CFileTransferNotify ()
~CFileTransferNotify ()
ULONG STDMETHODCALLTYPE | AddRef (void)
HRESULT STDMETHODCALLTYPE | Connect (IUnknown *pUnk)
HRESULT STDMETHODCALLTYPE | Disconnect (void)
HRESULT STDMETHODCALLTYPE | FtUpdate (CONFN uNotify, INmFt *pFt)
HRESULT STDMETHODCALLTYPE | MemberChanged (NM_MEMBER_NOTIFY uNotify, INmMember *pMember)
HRESULT STDMETHODCALLTYPE | NmUI (CONFN uNotify)
HRESULT STDMETHODCALLTYPE | QueryInterface (REFIID riid, PVOID *ppvObj)
ULONG STDMETHODCALLTYPE | Release (void)

Detailed Description

Definition at line 21 of file cft.h.

Constructor & Destructor Documentation

CFileTransferNotify::CFileTransferNotify ( )

Definition at line 98 of file cft.cpp.

                                         : RefCount(), CNotify()
{
  OBJECT_MSG(TEXT("CFileTransferNotify created"));
}

CFileTransferNotify::~CFileTransferNotify ( )

Definition at line 103 of file cft.cpp.

{
  OBJECT_MSG(TEXT("CFileTransferNotify destroyed"));
}

Member Function Documentation

ULONG STDMETHODCALLTYPE CFileTransferNotify::AddRef ( void )

Definition at line 115 of file cft.cpp.

{
  return RefCount::AddRef();
}

HRESULT STDMETHODCALLTYPE CFileTransferNotify::Connect ( IUnknown * pUnk )

Definition at line 165 of file cft.cpp.

{
  return CNotify::Connect(pUnk, IID_INmChannelFtNotify, (IUnknown *)this);
}

HRESULT STDMETHODCALLTYPE CFileTransferNotify::Disconnect ( void )

Reimplemented from CNotify.

Definition at line 170 of file cft.cpp.

{
  return CNotify::Disconnect();
}

HRESULT STDMETHODCALLTYPE CFileTransferNotify::FtUpdate | ( | CONFN | uNotify,
 |  | INmFt * | pFt
 | ) |  |

Definition at line 196 of file cft.cpp.

{
  if  (NULL == pFt)
  {
    ERROR_MSG(TEXT("FtUpdate: NULL == pFt"));
    return E_POINTER;
  }

  ULONG     ulBytes = 0     ;
  INmMember * pMember = NULL    ;
  BSTR      bstrName  = NULL    ;
  LPTSTR      psz   = NULL    ;
  HRESULT     hr    = NO_ERROR  ;

  TCHAR sz[MAX_PATH + 1];

  hr = pFt->GetBytesTransferred(&ulBytes);
  if(FAILED(hr))
  {
    ERROR_MSG(TEXT("GetBytes Failed hr=%s"), GetHrSz(hr));
  }

  // get the Member object of the sender
  hr = pFt->GetMember(&pMember);
  if(FAILED(hr))
  {
    ERROR_MSG(TEXT("GetMember Failed hr=%s"), GetHrSz(hr));
    return hr;
  }

  NM_FT_STATE uState;
  pFt->GetState(&uState);

  if(NULL == pMember)
  {
    ZeroMemory(sz, (MAX_PATH + 1) * sizeof(TCHAR));

    // file being sent to all members of the conference
    _tcsncpy(sz, TEXT("BROADCAST\0"), MAX_PATH);

  NOTIFY_MSG(TEXT("CFileTransferNotify::FtUpdate uNotify=%s, State = %d, pFt=%08X, bytes=%d from %s\0"),
      GetConfnSz(uNotify), uState, pFt, ulBytes, sz);

  }
  else
  {
    hr = pMember->GetName(&bstrName);
    if(FAILED(hr))
    {
      ERROR_MSG(TEXT("GetName Failed hr=%s"), GetHrSz(hr));
    }

    psz = PszFromBstr(bstrName);

    SysFreeString(bstrName);
    pMember->Release();

    if  (NULL == psz)
    {
      ERROR_MSG(TEXT("FtUpdate: NULL == psz"));
      return E_FAIL;
    }

  NOTIFY_MSG(TEXT("CFileTransferNotify::FtUpdate uNotify=%s, State = %d, pFt=%08X, bytes=%d from %s"),
      GetConfnSz(uNotify), uState, pFt, ulBytes, psz);

    FreePlpv(&psz);

  }

  return S_OK;
}

HRESULT STDMETHODCALLTYPE CFileTransferNotify::MemberChanged | ( | NM_MEMBER_NOTIFY | uNotify,
 |  | INmMember * | pMember
 | ) |  |

Definition at line 189 of file cft.cpp.

{
  NOTIFY_MSG(TEXT("CFileTransferNotify::MemberChanged uNotify=%d pMember=%08X, pChannel=%08X"), uNotify, pMember, CNotify::GetPunk());

  return S_OK;
}

HRESULT STDMETHODCALLTYPE CFileTransferNotify::NmUI ( CONFN uNotify )

Definition at line 182 of file cft.cpp.

{
  NOTIFY_MSG(TEXT("CFileTransferNotify::NmUI uNotify=%08X, pChannel=%08X"), uNotify, CNotify::GetPunk());
  return S_OK;
}

HRESULT STDMETHODCALLTYPE CFileTransferNotify::QueryInterface | ( | REFIID | riid,
 |  | PVOID * | ppvObj
 | ) |  |

Definition at line 126 of file cft.cpp.

{
  if  (NULL == ppvObject)
    return E_POINTER;

  HRESULT hr = NO_ERROR;

  if (riid == IID_IUnknown)
  {
    *ppvObject = (IUnknown *)this;
    OBJECT_MSG(TEXT("CFileTransferNotify::QueryInterface(): Returning IUnknown."));
  }
  else if (riid == IID_INmChannelFtNotify)
  {
    *ppvObject = (INmChannelNotify *)this;
    OBJECT_MSG(TEXT("CChannelFtNotify::QueryInterface(): Returning INmChannelFtNotify."));
  }
  else
  {
    hr = E_NOINTERFACE;
    *ppvObject = NULL;
    OBJECT_MSG(TEXT("CFileTransferNotify::QueryInterface(): Called on unknown interface."));
  }

  if SUCCEEDED(hr)
  {
    AddRef();
  }

  return hr;
}

ULONG STDMETHODCALLTYPE CFileTransferNotify::Release ( void )

Definition at line 121 of file cft.cpp.

{
  return RefCount::Release();
}

The documentation for this class was generated from the following files:
  • Web/NetMeeting/NMUI/cft.h
  • Web/NetMeeting/NMUI/cft.cpp
Generated on Wed Nov 13 2024 16:56:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CFileViewer Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Protected Attributes | Friends

CFileViewer Class Reference

#include "FVText.h"

Inherits com::ms::com::IUnknown.

List of all members.

Public Member Functions

CFileViewer (LPUNKNOWN, HINSTANCE, PFNDESTROYED)
~CFileViewer (void)
STDMETHODIMP | FileShow (LPFVSHOWINFO pvsi)
STDMETHODIMP | FileShowInit (LPFILEVIEWERSITE lpfsi)
HRESULT | Init (void)
LPVOID | MemAlloc (ULONG)
void | MemFree (LPVOID)
STDMETHODIMP | PrintTo (LPSTR, BOOL)
STDMETHODIMP | QueryInterface (REFIID, PPVOID)
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) AddRef(void)
LPSTR String (UINT)

Protected Member Functions

void | ChildrenResize (void)
BOOL | DropFiles (HDROP)
HRESULT | FileLoad (void)
BOOL | FInitFrameControls (void)
void | FontChange (VIEWFONTOPTION)
BOOL | FOpenAs (void)
void | OnCommand (WORD, WORD, HWND)
LPSTR PszToolTip (UINT)
void | ReplaceWindowModeChange (void)
void | ViewportResize (void)
void | ViewportScrollSet (void)

Protected Attributes

CLSID m_clsID
ULONG m_cRef
int | m_cyPPI
UINT m_cyStatus
UINT m_cyTools
BOOL m_fClassReg
BOOL m_fLoadCalled
BOOL m_fPostQuitMsg
BOOL m_fShowInit
BOOL m_fStatusVisible
BOOL m_fToolsVisible
DWORD m_grfMode
HACCEL | m_hAccel
HFONT | m_hFont
HINSTANCE | m_hInst
HGLOBAL m_hMemText
HWND | m_hWnd
HWND | m_hWndOld
HWND | m_hWndStatus
HWND | m_hWndToolbar
HWND | m_hWndViewport
LPFILEVIEWERSITE | m_lpfsi
PFNDESTROYED m_pfnDestroy
PIMPIFILEVIEWER m_pIFileViewer
PIMPIPERSISTFILE m_pIPersistFile
PCStatusHelper m_pSH
PCStringTable m_pST
LPSTR m_pszPath
LPUNKNOWN | m_pUnkOuter
LPFVSHOWINFO | m_pvsi
int | m_xPos
int | m_yPos

Friends

class | CImpIFileViewer
class | CImpIPersistFile
LRESULT WINAPI | FileViewerFrameProc (HWND, UINT, WPARAM, LPARAM)
LRESULT WINAPI | ViewportWndProc (HWND, UINT, WPARAM, LPARAM)

Detailed Description

Definition at line 103 of file FVText.h.

Constructor & Destructor Documentation

CFileViewer::CFileViewer | ( | LPUNKNOWN | pUnkOuter,
 |  | HINSTANCE | hInst,
 |  | PFNDESTROYED | pfnDestroy
 | ) |  |

Definition at line 33 of file FVText.Cpp.

{
    m_cRef=0;
    m_pUnkOuter=pUnkOuter;
    m_hInst=hInst;
    m_pfnDestroy=pfnDestroy;
    m_lpfsi = NULL;

    //MODIFY:  Change this CLSID to your own
    m_clsID=CLSID_FileViewerText;

    m_pszPath=NULL;
    m_grfMode=0L;
    m_fLoadCalled=FALSE;
    m_fShowInit=FALSE;
    m_fPostQuitMsg=TRUE;

    //NULL any contained interfaces initially.
    m_pIPersistFile=NULL;
    m_pIFileViewer=NULL;
    m_pvsi = NULL;

    m_pST=NULL;
    m_pSH=NULL;
    m_fClassReg=FALSE;

    m_hWnd=NULL;
    m_hWndOld = NULL;
    m_hWndToolbar=NULL;
    m_hWndStatus=NULL;
    m_hWndViewport=NULL;

    //MODIFY:  Initalize viewer-specific values
    m_hMemText=NULL;
    m_hFont=NULL;
    m_xPos=0;
    m_yPos=0;
    return;
}

CFileViewer::~CFileViewer ( void )

Definition at line 79 of file FVText.Cpp.

{
    //MODIFY:  m_hMemText and m_hFont are viewer-specific.
    if (NULL!=m_hMemText)
        GlobalFree(m_hMemText);

    if (NULL!=m_hFont)
        DeleteObject(m_hFont);

    //MODIFY:  Do any other viewer-specific cleanup
    //Destroying the parent destroys the children as well
    if (NULL!=m_hWnd)
    {
        m_fPostQuitMsg = FALSE;    // Destroy from here implies not from our loop
        DestroyWindow(m_hWnd);
    }

     // Unregistering the classes is important for DLL's because we
     // should not assume that whoever loaded us (the task) is going
     // to quit anytime soon and unregister the class.  Normally
     // QVStub is going to quit, but a test app like TestFV does not
     // which can cause some development headaches.
    if (m_fClassReg)
        {
        UnregisterClass(String(IDS_CLASSFRAME),    m_hInst);
        UnregisterClass(String(IDS_CLASSVIEWPORT), m_hInst);
        }

    if (NULL!=m_pSH)
        delete m_pSH;

    if (NULL!=m_pST)
        delete m_pST;

    //Free the pathname string from IPersistFile::Load if we got one
    MemFree(m_pszPath);

    //Free contained interfaces.
    if (NULL!=m_pIPersistFile)
        delete m_pIPersistFile;

    if (NULL!=m_pIFileViewer)
        delete m_pIFileViewer;
    if (NULL!=m_lpfsi)
        m_lpfsi->Release();

    return;
}

Member Function Documentation

void CFileViewer::ChildrenResize ( void ) [protected]

Definition at line 583 of file FVText.Cpp.

{
    RECT        rc;

    GetClientRect(m_hWnd, &rc);

    //We resize toolbar and status bar regardless of visibility
    SetWindowPos(m_hWndToolbar, NULL, 0, 0
        , rc.right-rc.left, m_cyTools
        , SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);

    SetWindowPos(m_hWndStatus, NULL, 0, rc.bottom-m_cyStatus
        , rc.right-rc.left, m_cyStatus
        , SWP_NOZORDER | SWP_NOACTIVATE);

    ViewportResize();
    return;
}

BOOL CFileViewer::DropFiles ( HDROP hdrop ) [protected]

Definition at line 869 of file FVText.Cpp.

{
    // We should now proces the files that were dropped on us
    char    szPath[MAX_PATH];
    int     cb;

    // For now only process the first file.
    if (DragQueryFile(hdrop, 0, szPath, sizeof(szPath)) > 0)
    {
        ODSsz("CFileViewer::DropFiles filename=%s", szPath);

        // Need to convert the string to ole string...
        cb = (lstrlen(szPath)+1) * sizeof(OLECHAR);
        mbstowcs(m_pvsi->strNewFile, szPath, cb);

        // Now get the window rectangle to use to display this in...
        GetWindowRect(m_hWnd, &m_pvsi->rect);
        m_pvsi->dwFlags |= (FVSIF_RECT | FVSIF_NEWFILE);

        // Should check for failure but now sure what to do with it anyway
        QueryInterface(IID_IUnknown, (LPVOID *)&m_pvsi->punkRel);
        ODSlu("CFileViewer::DropFiles Query Interface(%x)", m_pvsi->punkRel);
    }

    DragFinish(hdrop);
    return TRUE;
}

HRESULT CFileViewer::FileLoad ( void ) [protected]

Definition at line 346 of file FVText.Cpp.

{
    HRESULT     hr;
    HGLOBAL     hMem=NULL;
    LPSTR       psz;
    OLECHAR     szwFile[512];

    //MODIFY: Load your own file type here.
    if (NULL==m_pszPath)
        return ResultFromScode(E_UNEXPECTED);

     // This FileViewer is registered for a .TXT extension that
     // is either in a compound file (single stream called "Text"
     // or in a flat text file.  This sample is meant to show
     // how to open and work with both types of files.
    //Make Unicode copy of filename
    mbstowcs(szwFile, m_pszPath, sizeof(szwFile)/sizeof(szwFile[0]));

     // CAREFUL:  StgIsStorageFile returns S_FALSE if not--
     //           don't use SUCCEEDED to test the return value!
    if (NOERROR==StgIsStorageFile(szwFile))
        {
        LPSTORAGE   pIStorage=NULL;
        LPSTREAM    pIStream=NULL;
        STATSTG     stat;

        //Case for a compound file, open it and the text stream
        hr=StgOpenStorage(szwFile, NULL, m_grfMode, NULL, 0
            , &pIStorage);

        if (FAILED(hr))
            {
            ODS("CFileViewer::FileLoad failed StgOpenStorage");
            return hr;
            }

        mbstowcs(szwFile, "Text", sizeof(szwFile));

        hr=pIStorage->OpenStream(szwFile, 0, STGM_DIRECT | STGM_READ
            | STGM_SHARE_EXCLUSIVE, 0, &pIStream);

        if (SUCCEEDED(hr))
            {
            //Determine the amount of text and allocate memory
            hr=pIStream->Stat(&stat, STATFLAG_NONAME);

            if (SUCCEEDED(hr))
                {
                hMem=GlobalAlloc(GHND, stat.cbSize.LowPart+1);

                if (NULL!=hMem)
                    {
                     // Now load the text into the controls.
                     // GlobalLock will always work because we
                     // allocated at least 1 byte.
                    psz=(LPSTR)GlobalLock(hMem);
                    hr=pIStream->Read((LPVOID)psz
                        , stat.cbSize.LowPart, NULL);
                    GlobalUnlock(hMem);
                    }
                else
                    {
                    ODS("CFileViewer::FileLoad failed to allocate memory");
                    hr=ResultFromScode(E_OUTOFMEMORY);
                    }
                }

            pIStream->Release();
            }
        else
            {
            ODS("CFileViewer::FileLoad failed StgOpenStorage");
            }

        pIStorage->Release();
        }
    else
        {
        int         hFile=NULL;
        OFSTRUCT    of;
        DWORD       cb, cbRead;

         // Case for straight text file, open and read.  In opening
         // the file, mask off the upper word or m_grfMode which
         // contains the compound file specific flags.  The lower
         // word has OpenFile flags (consistent between
         // StgOpenStorage and OpenFile).
        hFile=OpenFile(m_pszPath, &of
            , (UINT)(m_grfMode & 0x0000FFFF));

        if (HFILE_ERROR==hFile)
            {
            ODS("CFileViewer::FileLoad failed OpenFile");
            return ResultFromScode(STG_E_FILENOTFOUND);
            }

        //Scan to end and then back to determine file size.
        cb=_llseek(hFile, 0L, 2);
        _llseek(hFile, 0L, 0);

        hMem=GlobalAlloc(GHND, cb+1);

        if (NULL!=hMem)
            {
             // Now load the text into the controls.  GlobalLock will
             // always work because we allocated at least 1 byte
            psz=(LPSTR)GlobalLock(hMem);
            cbRead=_lread(hFile, psz, (UINT)cb);
            GlobalUnlock(hMem);

            hr=ResultFromScode((cb==cbRead) ? S_OK : STG_E_READFAULT);
            }
        else
            {
            ODS("CFileViewer::FileLoad failed to allocate memory");
            hr=ResultFromScode(E_OUTOFMEMORY);
            }

        _lclose(hFile);
        }

    //Set edit control to read-only:  no modifications allowed!
    if (SUCCEEDED(hr) && NULL!=hMem)
        {
        if (NULL!=m_hMemText)
            GlobalFree(m_hMemText);

        //Make the text current and repaint.
        m_hMemText=hMem;
        InvalidateRect(m_hWndViewport, NULL, TRUE);
        UpdateWindow(m_hWndViewport);
        }

    return hr;
}

STDMETHODIMP CFileViewer::FileShow ( LPFVSHOWINFO pvsi )

Definition at line 237 of file FVText.Cpp.

{
    MSG             msg;

    // We need to handle the case where the ShowInitialize may have
    // failed and we set the hwnd to NULL and the hwndOld is not NULL.
    // and the FVSIF_NEWFAILED is set.  In this case set the hwnd Back
    // to the old hwnd...
    if ((pvsi->dwFlags & FVSIF_NEWFAILED) && (m_hWnd == NULL))
    {
        m_hWnd = m_hWndOld;
    }

    if (!IsWindow (m_hWnd))
            return ResultFromScode(E_UNEXPECTED);

    m_pvsi = pvsi;

    // If the new failed flag was passed to us we know that we got here
    // because we tried to view a file and it failed, so simply go back
    // to message loop...
    if ((pvsi->dwFlags & FVSIF_NEWFAILED) == 0)
    {
        if (pvsi->dwFlags & FVSIF_RECT)
            SetWindowPos(m_hWnd, NULL, pvsi->rect.left, pvsi->rect.top,
                    pvsi->rect.right - pvsi->rect.left, pvsi->rect.bottom - pvsi->rect.top,
                    SWP_NOZORDER | SWP_NOACTIVATE);
        ShowWindow(m_hWnd, pvsi->iShow);

        if (SW_HIDE!=pvsi->iShow)
        {
            SetForegroundWindow(m_hWnd);
            UpdateWindow(m_hWnd);
        }

        // If there is an Old window destroy it now
        // It would be nicer to reuse the window!
        if (pvsi->dwFlags & FVSIF_PINNED)
        {
            m_lpfsi->SetPinnedWindow(NULL);
            m_lpfsi->SetPinnedWindow(m_hWnd);

            HMENU hMenu=GetMenu(m_hWnd);
            CheckMenuItem(hMenu, IDM_VIEWREPLACE, MF_BYCOMMAND|MF_CHECKED);
        }

        if (SW_HIDE!=pvsi->iShow)
            UpdateWindow(m_hWnd);

        if ((NULL!=m_hWndOld) && IsWindow(m_hWndOld))
        {
            ODS("CFileViewer::FileShow Destroy Previous hwnd");
            m_fPostQuitMsg = FALSE; // Don't destroy the queue for this one.
            DestroyWindow(m_hWndOld);
            m_hWndOld = NULL;
        }

        if (NULL!=pvsi->punkRel)
        {
            ODSlu("CFileViewer::FileShow Release of previous viewers punkRel(%x)", pvsi->punkRel);
            pvsi->punkRel->Release();
            pvsi->punkRel = NULL;
        }
    }

    while (GetMessage(&msg, NULL, 0,0 ))
        {
        if (!TranslateAccelerator(m_hWnd, m_hAccel, &msg))
            {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
            }
        // If there is a new file bail out now.
        if (m_pvsi->dwFlags & FVSIF_NEWFILE)
            break;
        }

    //MODIFY:  Perform cleanup here.
    return NOERROR;
}

STDMETHODIMP CFileViewer::FileShowInit ( LPFILEVIEWERSITE lpfsi )

Definition at line 140 of file FVText.Cpp.

{
    HRESULT         hr;
    HMENU           hMenu;

    //MODIFY:  Do pre-show initialization here.
    if (m_lpfsi != lpfsi)
    {
        if (NULL!=m_lpfsi)
            m_lpfsi->Release();

        m_lpfsi = lpfsi;
        lpfsi->AddRef();
    }

    //Default error code
    hr=ResultFromScode(E_OUTOFMEMORY);

    //Create the main window passing "this" to it
    m_hWndOld = m_hWnd;
    m_hWnd=CreateWindow(String(IDS_CLASSFRAME)
        , String(IDS_CAPTION), WS_MINIMIZEBOX | WS_OVERLAPPEDWINDOW
        | WS_CLIPCHILDREN, CW_USEDEFAULT , CW_USEDEFAULT, 350, 450
        , NULL, NULL, m_hInst, (LPVOID)this);

    if (NULL==m_hWnd)
        {
        ODS("CFileViewer::FileShow failed to create main window.");
        return hr;
        }

    // Let us accept files.
    DragAcceptFiles(m_hWnd, TRUE);

    if (!FInitFrameControls())
        {
        ODS("CFileViewer::FileShow failed to create frame tools.");
        return hr;
        }

    //Set initial view menu item checks
    hMenu=GetMenu(m_hWnd);
    CheckMenuItem(hMenu, IDM_VIEWTOOLBAR, MF_BYCOMMAND | MF_CHECKED);
    CheckMenuItem(hMenu, IDM_VIEWSTATUSBAR, MF_BYCOMMAND | MF_CHECKED);

    m_fToolsVisible=TRUE;
    m_fStatusVisible=TRUE;

    m_pSH->MessageDisplay(ID_MSGREADY);

     // ViewportResize puts the viewport window created here
     // in the right location, so we don't have to worry
     // about initial position.

    m_hWndViewport=CreateWindowEx(WS_EX_CLIENTEDGE
        , String(IDS_CLASSVIEWPORT), "Viewport"
        , WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL
        , 0, 0, 100, 100, m_hWnd, (HMENU)ID_VIEWPORT
        , m_hInst, (LPVOID)this);

    if (NULL==m_hWndViewport)
        {
        ODS("CFileViewer::FileShow failed to create viewport.");
        return hr;
        }

    ViewportResize();

     // Go load the file.  This means pulling into memory whatever
     // is necessary for the initial display.
    hr=FileLoad();

    if (FAILED(hr))
        {
        ODS("CFileViewer::FileShow failed to load file.");
        return hr;
        }

    m_hAccel=LoadAccelerators(m_hInst
        , MAKEINTRESOURCE(IDR_ACCELERATORS));

    //Tell IFileViewer::Show it's OK to call it
    m_fShowInit=TRUE;
    return NOERROR;
}

BOOL CFileViewer::FInitFrameControls ( void ) [protected]

Definition at line 130 of file FVInit.Cpp.

    {
    BOOL        fRet;
    RECT        rc;
    TBBUTTON    rgtb[CTBBUTTONS];

     // Initialize the toolbar button array.  This uses the TOOLS.BMP
     // resource which has three buttons and one separator.  The
     // buttons are tied to File/Open As and Increase/Decrease Font
     // size.
    rgtb[0].iBitmap=IDBT_OPENAS;
    rgtb[0].idCommand=IDM_FILEOPENAS;
    rgtb[0].fsState=TBSTATE_ENABLED;
    rgtb[0].fsStyle=TBSTYLE_BUTTON;
    rgtb[0].dwData=0L;
    rgtb[0].iString=0;

    rgtb[1].iBitmap=0;
    rgtb[1].idCommand=0;
    rgtb[1].fsState=TBSTATE_ENABLED;
    rgtb[1].fsStyle=TBSTYLE_SEP;
    rgtb[1].dwData=0L;
    rgtb[1].iString=0;

    rgtb[2].iBitmap=IDBT_FONTSIZEINCREASE;
    rgtb[2].idCommand=IDM_VIEWFONTINCREASE;
    rgtb[2].fsState=TBSTATE_ENABLED;
    rgtb[2].fsStyle=TBSTYLE_BUTTON;
    rgtb[2].dwData=0L;
    rgtb[2].iString=0;

    rgtb[3].iBitmap=IDBT_FONTSIZEDECREASE;
    rgtb[3].idCommand=IDM_VIEWFONTDECREASE;
    rgtb[3].fsState=TBSTATE_ENABLED;
    rgtb[3].fsStyle=TBSTYLE_BUTTON;
    rgtb[3].dwData=0L;
    rgtb[3].iString=0;

     // Open as button:  call SHGetIconOfFile to retrieve
     // the image, then overwrite it in the toolbar bitmap we send
     // to CreateToolbarEx.  If SHGetIconOfFile fails, then just
     // use the one in the toolbar bitmap already.
     //
    m_hWndToolbar=CreateToolbarEx(m_hWnd, TBSTYLE_TOOLTIPS
  | WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS, ID_TOOLBAR
  , CTBBITMAPS, m_hInst, IDB_TOOLS, rgtb, CTBBUTTONS
  , 0, 0, 0, 0, sizeof(TBBUTTON));

    if (NULL==m_hWndToolbar)
  {
  ODS("CFileViewer::FInitFrameTools failed to create toolbar");
  return FALSE;
  }

     // Remember the height for resizing this and the viewport.
     // Use window rectangles for toolbars.
    GetWindowRect(m_hWndToolbar, &rc);
    m_cyTools=rc.bottom-rc.top;

     // Status line
    m_hWndStatus=CreateStatusWindow(WS_CHILD | WS_VISIBLE
  , String(IDS_MSGREADY), m_hWnd, ID_STATUSBAR);

    if (NULL==m_hWndStatus)
  {
  ODS("CFileViewer::FInitFrameTools failed to create status bar");
  return FALSE;
  }

     // Remember the height for resizing this and the viewport.
     // Use client rectangle for status lines.
    GetClientRect(m_hWndStatus, &rc);
    m_cyStatus=rc.bottom-rc.top;

     // Create a status bar helper and tell it what messages
     // to use.  This object will be called from WM_MENUSELECT
     // in FileViewerFrameProc in FVPROC.CPP.
    m_pSH=new CStatusHelper(m_hWndStatus, m_hInst);

    if (NULL==m_pSH)
  return FALSE;

    fRet=m_pSH->MessageMap(m_hWnd, IDR_STATMESSAGEMAP, IDS_STATUSMSGMIN
  , IDS_STATUSMSGMAX, CCHSTATUSMSGMAX, ID_MENUFILE, ID_MENUHELP
  , ID_MSGREADY, ID_MSGEMPTY, ID_MENUSYS);

    return fRet;
    }

void CFileViewer::FontChange ( VIEWFONTOPTION uOpt ) [protected]

Definition at line 713 of file FVText.Cpp.

{
    HFONT       hFont;
    LOGFONT     lf;
    CHOOSEFONT  cf;
    BOOL        fChange=TRUE;
    int         z;

     // We have a system font from the constructor, so m_hFont
     // will never be NULL, but assert it anyway.
    D(if (NULL==m_hFont) ODS("Assertion Failed:  m_hFont is NULL"););

    GetObject(m_hFont, sizeof(lf), &lf);
     // Each option is responsible for manipulating
     // the LOGFONT structure in some way.  If there
     // is nothing to do, they set fChange to FALSE
    switch (uOpt)
        {
        case VIEWFONT_SELECT:
            memset(&cf, 0, sizeof(CHOOSECOLOR));
            cf.lStructSize=sizeof(CHOOSECOLOR);
            cf.hwndOwner  =m_hWnd;
            cf.lpLogFont  =&lf;
            cf.nSizeMin   =FONTSIZETHRESHOLDMIN;
            cf.nSizeMax   =FONTSIZETHRESHOLDMAX;

            cf.Flags=CF_SCREENFONTS | CF_INITTOLOGFONTSTRUCT
                | CF_FORCEFONTEXIST;

            if (!ChooseFont(&cf))
                {
                D(DWORD dwErr=CommDlgExtendedError();
                ODSlu("FVTEXT.DLL:  ChooseFont failed with %lu", dwErr););

                fChange=FALSE;
                }

            break;

        case VIEWFONT_INCREASESIZE:
            //Convert logical size to point size.
            z=MulDiv(-lf.lfHeight, 72, m_cyPPI);

            //Vary the size increase depending on point size.
            if (z < FONTSIZETHRESHOLDMAX)
                {
                if (z < FONTSIZETHRESHOLDLOW)
                    z+=FONTSIZEDELTASMALL;
                else
                    {
                    if (z < FONTSIZETHRESHOLDMID)
                        z+=FONTSIZEDELTAMEDIUM;
                    else
                        z+=FONTSIZEDELTALARGE;
                    }

                //Convert point size to logical size.
                lf.lfHeight=MulDiv(-z, m_cyPPI, 72);
                }
            else
                fChange=FALSE;

            break;

        case VIEWFONT_DECREASESIZE:
            //Convert logical size to point size.
            z=MulDiv(-lf.lfHeight, 72, m_cyPPI);

            //Vary the size decrease depending on point size.
            if (z > FONTSIZETHRESHOLDMIN)
                {
                if (z > FONTSIZETHRESHOLDMID)
                    z-=FONTSIZEDELTALARGE;
                else
                    {
                    if (z > FONTSIZETHRESHOLDLOW)
                        z-=FONTSIZEDELTAMEDIUM;
                    else
                        z-=FONTSIZEDELTASMALL;
                    }

                //Convert point size to logical size.
                lf.lfHeight=MulDiv(-z, m_cyPPI, 72);
                }
            else
                fChange=FALSE;

            break;

        default:
            fChange=FALSE;
        }

    //Return now if we didn't change anything.
    if (!fChange)
        return;

    //Now switch fonts and update the viewport.
    hFont=CreateFontIndirect(&lf);

    if (NULL!=hFont)
        {
        if (NULL!=m_hFont)
            DeleteObject(m_hFont);

        m_hFont=hFont;

        ViewportScrollSet();

        //Repaint the viewport
        InvalidateRect(m_hWndViewport, NULL, TRUE);
        UpdateWindow(m_hWndViewport);
        }

    return;
}

BOOL CFileViewer::FOpenAs ( void ) [protected]

Definition at line 690 of file FVText.Cpp.

{
    SHELLEXECUTEINFO sei = {sizeof(sei), 0, m_hWnd, "open",
            m_pszPath, NULL, NULL, SW_SHOWNORMAL, m_hInst};

    return ShellExecuteEx(&sei);
}

HRESULT CFileViewer::Init ( void )

Definition at line 31 of file FVInit.Cpp.

    {
    LPUNKNOWN       pIUnknown=(LPUNKNOWN)this;
    WNDCLASS        wc;
    HRESULT         hr;
    HDC             hDC;

    //Default error code
    hr=ResultFromScode(E_OUTOFMEMORY);

    // Make pIUnknown point to outer unknown if we get one.
    // The interfaces allocated below are always given an IUnknown
    // to which they delegate at all times.  This will be either
    // the CFileViewer object's IUnknown itself or the outer
    // unknown if this object is aggregated.  The interfaces
    // need not know which case is being used.
    if (NULL!=m_pUnkOuter)
  pIUnknown=m_pUnkOuter;

    //Allocate contained interfaces.
    m_pIPersistFile=new CImpIPersistFile(this, pIUnknown);

    if (NULL==m_pIPersistFile)
  return hr;

    m_pIFileViewer=new CImpIFileViewer(this, pIUnknown);

    if (NULL==m_pIFileViewer)
  return hr;

    m_pST=new CStringTable(m_hInst);

    if (NULL==m_pST)
  return hr;

    // Go load the strings we need in CFileViewer::String.
    if (!m_pST->FInit(IDS_MIN, IDS_MAX, CCHSTRINGMAX))
  return hr;

    //Register window classes that we'll need to display the file
    wc.style         = CS_HREDRAW | CS_VREDRAW;
    wc.lpfnWndProc   = FileViewerFrameProc;
    wc.cbClsExtra    = 0;
    wc.cbWndExtra    = CBWNDEXTRAFRAME;
    wc.hInstance     = m_hInst;
    wc.hIcon         = LoadIcon(m_hInst, "Icon");
    wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH)(COLOR_APPWORKSPACE+1);
    wc.lpszMenuName  = MAKEINTRESOURCE(IDR_MENU);
    wc.lpszClassName = String(IDS_CLASSFRAME);

    if (!RegisterClass(&wc))
  return hr;

    // MODIFY:  This is the viewport window that does the work
    // of displaying the data.  Modify it to your needs.
    wc.style         = CS_HREDRAW | CS_VREDRAW;
    wc.lpfnWndProc   = ViewportWndProc;
    wc.cbClsExtra    = 0;
    wc.cbWndExtra    = CBWNDEXTRAVIEWPORT;
    wc.hInstance     = m_hInst;
    wc.hIcon         = NULL;
    wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
    wc.lpszMenuName  = MAKEINTRESOURCE(IDR_MENU);
    wc.lpszClassName = String(IDS_CLASSVIEWPORT);

    if (!RegisterClass(&wc))
  return hr;

    m_fClassReg=TRUE;

    // Create a default fixed pitch font for the Viewport.  We
    // use Courier New here instead of say, SYSTEM_FIXED_FONT
    // because we want the font sizing buttons to work normally
     // when this window appears, and the system fonts do not
     // scale, but Courier New does.  Default is 10 point calculated
     // from 10*PIXELSPERINCH/72.
    hDC=GetDC(NULL);
    m_cyPPI=GetDeviceCaps(hDC, LOGPIXELSY);
    ReleaseDC(NULL, hDC);

    m_hFont=CreateFont(MulDiv(-10, m_cyPPI, 72)
  , 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE
  , ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS
  , DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, "Courier New");

    return NOERROR;
    }

LPVOID CFileViewer::MemAlloc ( ULONG cb )

Definition at line 234 of file FVInit.Cpp.

    {
    LPMALLOC    pIMalloc;
    LPVOID      pv;
    HRESULT     hr;

    if (FAILED(hr = CoGetMalloc(MEMCTX_TASK, &pIMalloc)))
  {
  ODSu("CFileViewer::MemAlloc CoGetMalloc failed %ld", hr);

  if (hr == CO_E_NOTINITIALIZED)
      {
      if ((FAILED(hr=CoInitialize(NULL))) ||
      FAILED(hr=CoGetMalloc(MEMCTX_TASK, &pIMalloc)))
    {
    ODSu("CFileViewer::MemAlloc CoInitialize/CoGetMalloc failed %x", hr);
    return NULL;
    }

      }
  else
      return NULL;
  }

    pv=pIMalloc->Alloc(cb);
    pIMalloc->Release();
    return pv;
    }

void CFileViewer::MemFree ( LPVOID pv )

Definition at line 267 of file FVInit.Cpp.

    {
    LPMALLOC    pIMalloc;

    if (NULL==pv)
  {
  ODS("CFileViewer::MemFree passed NULL pointer");
  return;
  }

    if (FAILED(CoGetMalloc(MEMCTX_SHARED, &pIMalloc)))
  {
  ODS("CFileViewer::MemFree CoGetMalloc failed");
  return;
  }

    pIMalloc->Free(pv);
    pIMalloc->Release();
    return;
    }

void CFileViewer::OnCommand | ( | WORD | wID,
 |  | WORD | wCode,
 |  | HWND | hWndCtl |
 | ) |  |  | [protected]

Definition at line 492 of file FVText.Cpp.

{
    //MODIFY:  Do your command processing here.
    switch (wID)
        {
        case IDM_FILEOPENAS:
            if (FOpenAs())
                PostMessage(m_hWnd, WM_CLOSE, 0, 0L);
            break;

        case IDM_FILEPAGESETUP:
            //Not implemented in this sample
            break;

        case IDM_FILEPRINT:
            //Not implemented in this sample
            break;

        case IDM_FILEEXIT:
            PostMessage(m_hWnd, WM_CLOSE, 0, 0L);
            break;

        case IDM_VIEWTOOLBAR:
            m_fToolsVisible=!m_fToolsVisible;

            CheckMenuItem(GetMenu(m_hWnd), IDM_VIEWTOOLBAR
                , MF_BYCOMMAND | (m_fToolsVisible
                ? MF_CHECKED : MF_UNCHECKED));

            ShowWindow(m_hWndToolbar, m_fToolsVisible
                ? SW_SHOW : SW_HIDE);

            //Resize the viewport window
            ViewportResize();
            break;

        case IDM_VIEWSTATUSBAR:
            m_fStatusVisible=!m_fStatusVisible;

            CheckMenuItem(GetMenu(m_hWnd), IDM_VIEWSTATUSBAR
                , MF_BYCOMMAND | (m_fStatusVisible
                ? MF_CHECKED : MF_UNCHECKED));

            ShowWindow(m_hWndStatus, m_fStatusVisible
                ? SW_SHOW : SW_HIDE);

            //Resize the viewport window
            ViewportResize();
            break;
        case IDM_VIEWREPLACE:
            // Switch the Replace mode
            ReplaceWindowModeChange();
            break;
        case IDM_VIEWFONT:
            FontChange(VIEWFONT_SELECT);
            break;

        case IDM_VIEWFONTINCREASE:
            FontChange(VIEWFONT_INCREASESIZE);
            break;

        case IDM_VIEWFONTDECREASE:
            FontChange(VIEWFONT_DECREASESIZE);
            break;

        case IDM_HELPCONTENTS:
            MessageBox(m_hWnd, String(IDS_NOHELP)
                , String(IDS_CAPTION), MB_OK);
            break;

        case IDM_HELPABOUT:
            DialogBox(m_hInst, MAKEINTRESOURCE(IDD_ABOUT), m_hWnd
                , (DLGPROC)AboutProc);
            break;
        }

    return;
}

STDMETHODIMP CFileViewer::PrintTo | ( | LPSTR | pszDriver,
 |  | BOOL | fSuppressUI
 | ) |  |

Definition at line 332 of file FVText.Cpp.

    {
    //Printing not implemented in this sample
    //MODIFY:  Add your printing code here.
    return ResultFromScode(E_NOTIMPL);
}

LPSTR CFileViewer::PszToolTip ( UINT uID ) [protected]

Definition at line 910 of file FVText.Cpp.

{
    UINT        iString, iStatusMsg;

    switch (uID)
        {
        case IDM_FILEOPENAS:
            iString=IDS_TOOLTIPOPENAS;
            iStatusMsg=IDM_FILEOPENAS;
            break;

        case IDM_VIEWFONTINCREASE:
            iString=IDS_TOOLTIPFONTINC;
            iStatusMsg=ID_TIPFONTINC;
            break;

        case IDM_VIEWFONTDECREASE:
            iString=IDS_TOOLTIPFONTDEC;
            iStatusMsg=ID_TIPFONTDEC;
            break;

        default:
            return NULL;
        }

    m_pSH->MessageDisplay(iStatusMsg);
    return String(iString);
}

STDMETHODIMP CFileViewer::QueryInterface | ( | REFIID | riid,
 |  | PPVOID | ppv
 | ) |  |

Definition at line 290 of file FVInit.Cpp.

    {
    *ppv=NULL;

     //The only calls for IUnknown are either in a nonaggregated
     // case or when created in an aggregation, so in either case
     // always return our IUnknown for IID_IUnknown.
    if (IsEqualIID(riid, IID_IUnknown))
  *ppv=(LPVOID)this;

    //IPersist is base of IPersistFile
    if (IsEqualIID(riid, IID_IPersist)
  || IsEqualIID(riid, IID_IPersistFile))
  *ppv=(LPVOID)m_pIPersistFile;

    if (IsEqualIID(riid, IID_IFileViewer))
  *ppv=(LPVOID)m_pIFileViewer;

    //AddRef any interface we'll return.
    if (NULL!=*ppv)
  {
  ((LPUNKNOWN)*ppv)->AddRef();
  return NOERROR;
  }

    return ResultFromScode(E_NOINTERFACE);
    }

void CFileViewer::ReplaceWindowModeChange ( void ) [protected]

Definition at line 839 of file FVText.Cpp.

{
    HWND hwnd;
    UINT  uCheck = MF_BYCOMMAND;

    if (m_lpfsi)
    {
        m_lpfsi->GetPinnedWindow(&hwnd);
        if ((HWND)NULL==hwnd)
        {
            m_lpfsi->SetPinnedWindow(m_hWnd);
            uCheck = MF_BYCOMMAND | MF_CHECKED;
        }
        else
        {
            if (hwnd==m_hWnd)
                m_lpfsi->SetPinnedWindow(NULL);
        }

    }

    HMENU hMenu=GetMenu(m_hWnd);
    CheckMenuItem(hMenu, IDM_VIEWREPLACE, uCheck);
}

CFileViewer::STDMETHODIMP_ ( ULONG )
CFileViewer::STDMETHODIMP_ ( ULONG )
LPSTR CFileViewer::String ( UINT uID )

Definition at line 224 of file FVInit.Cpp.

    {
    return (*m_pST)[uID];
    }

void CFileViewer::ViewportResize ( void ) [protected]

Definition at line 608 of file FVText.Cpp.

{
    RECT        rc;
    UINT        dy1, dy2;

    GetClientRect(m_hWnd, &rc);

    dy1=m_fToolsVisible  ? m_cyTools  : 0;
    dy2=m_fStatusVisible ? m_cyStatus : 0;

    //We resize toolbar and status bar regardless of visibility
    SetWindowPos(m_hWndViewport, NULL, 0, dy1
        , rc.right-rc.left, rc.bottom-rc.top-dy1-dy2
        , SWP_NOZORDER | SWP_NOACTIVATE);

    ViewportScrollSet();
    return;
}

void CFileViewer::ViewportScrollSet ( void ) [protected]

Definition at line 633 of file FVText.Cpp.

{
    RECT        rc, rcFmt;
    LPSTR       psz;
    HDC         hDC;
    HFONT       hFont;
    SCROLLINFO  si;

    if (NULL==m_hMemText)
        return;

    psz=(LPSTR)GlobalLock(m_hMemText);
    hDC=GetDC(m_hWndViewport);
    hFont=(HFONT)SelectObject(hDC, m_hFont);

     // Set initially large formatting rectangle, and let
     // DrawText walk all over it.
    SetRect(&rcFmt, 0, 0, 32767, 32767);
    DrawText(hDC, psz, -1, &rcFmt, DT_LEFT | DT_CALCRECT
        | DT_EXPANDTABS);

    SelectObject(hDC, hFont);
    ReleaseDC(m_hWndViewport, hDC);

    GetClientRect(m_hWndViewport, &rc);

    //Scroll ranges are draw rect minus visible rect, +1 for buffer
    // First set the horizontal scrollbars information...
    si.cbSize = sizeof(si);
    si.fMask = SIF_RANGE | SIF_POS | SIF_PAGE;
    si.nMin = 0;
    si.nMax = (rcFmt.right-rcFmt.left)+1;
    si.nPage = rc.right;
    si.nPos = 0;
    SetScrollInfo(m_hWndViewport, SB_HORZ, &si, TRUE);
    m_xPos=0;

    // Now Set the vertical scrollbar
    si.nMax = (rcFmt.bottom-rcFmt.top)+1;
    si.nPage = rc.bottom;
    SetScrollInfo(m_hWndViewport, SB_VERT, &si, TRUE);
    m_yPos=0;

    GlobalUnlock(m_hMemText);
    return;
}

Friends And Related Function Documentation

friend class CImpIFileViewer [friend]

Definition at line 107 of file FVText.h.

friend class CImpIPersistFile [friend]

Definition at line 106 of file FVText.h.

LRESULT WINAPI FileViewerFrameProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |  |
 | ) |  |  | [friend]

Definition at line 27 of file FVProc.Cpp.

    {
    LONG_PTR        lTemp;
    PCFileViewer    pObj;
    LPTOOLTIPTEXT   pTTT;

    //This is invalid until WM_NCCREATE is called.
    pObj=(PCFileViewer)GetWindowLongPtr(hWnd, FVWL_OBJECTPOINTER);

    switch (iMsg)
        {
        case WM_NCCREATE:
            //Save the the CFileViewer object pointer we're passed
            lTemp=(LONG_PTR)((LPCREATESTRUCT)lParam)->lpCreateParams;
            SetWindowLongPtr(hWnd, FVWL_OBJECTPOINTER, lTemp);
            return DefWindowProc(hWnd, iMsg, wParam, lParam);

        case WM_COMMAND:
            pObj->OnCommand(LOWORD(wParam), HIWORD(wParam), (HWND)lParam);
            break;

        case WM_NOTIFY:
             // The toolbar, created with TBSTYLE_TOOLTIPS, will
             // send notifications for each button.  lParam will
             // be an LPTOOLTIPTEXT in such a case, but even when
             // the structure is something different it will always
             // have a hdr field of type NMHDR as the first field
             // which we use to see if it comes from the toolbar.
             // The notification we want is TTN_NEEDTEXT.
            pTTT=(LPTOOLTIPTEXT)lParam;

            if (NULL==pTTT)
                return 0L;

            if (TTN_NEEDTEXT==pTTT->hdr.code)
                pTTT->lpszText=pObj->PszToolTip((UINT)(pTTT->hdr.idFrom));

            return 0L;

        case WM_CLOSE:
            DestroyWindow(hWnd);
            break;

    case WM_DESTROY:
            if (NULL != pObj)
            {
                ODSu("FileViewerFrameProc Quit? %u", pObj->m_fPostQuitMsg);
                if (pObj->m_fPostQuitMsg)
                    PostQuitMessage(0);
                pObj->m_fPostQuitMsg = TRUE;    // One shot that it did not...

                if (pObj->m_hWnd == hWnd)
                    pObj->m_hWnd = NULL;        // Don't try to destroy this again...
            }
            break;

        case WM_SIZE:
            //Resize frame tools and viewport
            pObj->ChildrenResize();
            break;

        case WM_MENUSELECT:
            //Win32 Parameters are wItem, wFlags, and hMenu
            pObj->m_pSH->MenuSelect(LOWORD(wParam)
                , HIWORD(wParam), (HMENU)lParam);
            break;

        case WM_DROPFILES:
            // We have a new file dropped on us so we need to pass this
            // information back to the caller of the viewer...
            pObj->DropFiles((HDROP)wParam);
            break;

        default:
            return DefWindowProc(hWnd, iMsg, wParam, lParam);
        }

    return 0L;
    }

LRESULT WINAPI ViewportWndProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |  |
 | ) |  |  | [friend]

Definition at line 118 of file FVProc.Cpp.

    {
    LONG_PTR        lTemp;
    PCFileViewer    pObj;
    PAINTSTRUCT     ps;

    //This is invalid until WM_NCCREATE is called.
    pObj=(PCFileViewer)GetWindowLongPtr(hWnd, VPWL_OBJECTPOINTER);

    switch (iMsg)
        {
        case WM_NCCREATE:
            //Save the the CFileViewer object pointer we're passed
            lTemp=(LONG_PTR)((LPCREATESTRUCT)lParam)->lpCreateParams;
            SetWindowLongPtr(hWnd, VPWL_OBJECTPOINTER, lTemp);
            return DefWindowProc(hWnd, iMsg, wParam, lParam);

        case WM_PAINT:
            BeginPaint(hWnd, &ps);

            if (NULL!=pObj->m_hMemText)
                {
                LPSTR       psz;
                RECT        rc;
                HFONT       hFont;

                GetClientRect(hWnd, &rc);

                SetTextColor(ps.hdc, GetSysColor(COLOR_WINDOWTEXT));
                SetBkColor(ps.hdc, GetSysColor(COLOR_WINDOW));
                hFont=(HFONT)SelectObject(ps.hdc, pObj->m_hFont);

                psz=(LPSTR)GlobalLock(pObj->m_hMemText);

                 // We can use the client area rectangle here for
                 // drawing since we also use DT_NOCLIP, so we'll
                 // always draw all over the client area.
                OffsetRect(&rc, -pObj->m_xPos, -pObj->m_yPos);
                DrawText(ps.hdc, psz, -1, &rc, DT_LEFT
                    | DT_NOCLIP| DT_EXPANDTABS);

                GlobalUnlock(pObj->m_hMemText);
                SelectObject(ps.hdc, hFont);
                }
            EndPaint(hWnd, &ps);
            break;

        case WM_MOUSEMOVE:
             // If this message is already displayed, CStatusHelper
             // will just ignore this call and return very fast.
            pObj->m_pSH->MessageDisplay(ID_MSGCHOOSEOPEN);
            break;

        case WM_RBUTTONDOWN:
            {
            HMENU           hMenu, hMenuRes;
            POINT           pt;
            UINT            i, cItems;

            //Load our context menu.
            hMenuRes=LoadMenu(pObj->m_hInst
                , MAKEINTRESOURCE(IDR_MENUVIEWPORT));

            if (NULL==hMenuRes)
                break;

             // Make a copy popup menu because you cannot
             // use a resource-loaded menu with TrackPopupMenu.
            cItems=GetMenuItemCount(hMenuRes);
            hMenu=CreatePopupMenu();

            for (i=0; i < cItems; i++)
                {
                char    szItem[80];
                int     id, uFlags;

                GetMenuString(hMenuRes, i, szItem, sizeof(szItem)
                    , MF_BYPOSITION);
                id=GetMenuItemID(hMenuRes, i);

                uFlags=(0==id) ? MF_SEPARATOR : MF_STRING | MF_ENABLED;
                AppendMenu(hMenu, uFlags, id, szItem);
                }

            DestroyMenu(hMenuRes);

            pt.x=LOWORD(lParam);
            pt.y=HIWORD(lParam);
            ClientToScreen(hWnd, &pt);

            //Messages sent to frame window from this menu.
            TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON
                , pt.x, pt.y, 0, pObj->m_hWnd, NULL);

            DestroyMenu(hMenu);
            }
            break;

        case WM_HSCROLL:
        case WM_VSCROLL:
            {
            int             iTmp;
            UINT            idScroll;
            SCROLLINFO      si;

            idScroll=(WM_HSCROLL==iMsg) ? SB_HORZ : SB_VERT;

            si.cbSize = sizeof(SCROLLINFO);
            si.fMask = SIF_PAGE | SIF_POS | SIF_RANGE;
            GetScrollInfo(hWnd, idScroll, &si);

            iTmp=si.nPos;

            switch (LOWORD(wParam))
                {
                case SB_LINEUP:     si.nPos -= 20;  break;
                case SB_PAGEUP:     si.nPos -=si.nPage;  break;
                case SB_LINEDOWN:   si.nPos += 20;  break;
                case SB_PAGEDOWN:   si.nPos +=si.nPage;  break;

                case SB_THUMBPOSITION:
                case SB_THUMBTRACK:
                    si.nPos=HIWORD(wParam);
                    break;
                }

            si.nPos=max(si.nMin, min(si.nPos, si.nMax));

            if (si.nPos!=iTmp)
                {
                //Set the new position and scroll the window
                SetScrollPos(hWnd, idScroll, si.nPos, TRUE);

                if (SB_HORZ==idScroll)
                    {
                    pObj->m_xPos=si.nPos;
                    ScrollWindow(hWnd, iTmp-si.nPos, 0, NULL, NULL);
                    }
                else
                    {
                    pObj->m_yPos=si.nPos;
                    ScrollWindow(hWnd, 0, iTmp-si.nPos, NULL, NULL);
                    }

                UpdateWindow(hWnd);
                }
            }
            break;

        default:
            return DefWindowProc(hWnd, iMsg, wParam, lParam);
        }

    return 0L;
    }

Member Data Documentation

CLSID CFileViewer::m_clsID [protected]

Definition at line 121 of file FVText.h.

ULONG CFileViewer::m_cRef [protected]

Definition at line 114 of file FVText.h.

int CFileViewer::m_cyPPI [protected]

Definition at line 156 of file FVText.h.

UINT CFileViewer::m_cyStatus [protected]

Definition at line 137 of file FVText.h.

UINT CFileViewer::m_cyTools [protected]

Definition at line 136 of file FVText.h.

BOOL CFileViewer::m_fClassReg [protected]

Definition at line 127 of file FVText.h.

BOOL CFileViewer::m_fLoadCalled [protected]

Definition at line 124 of file FVText.h.

BOOL CFileViewer::m_fPostQuitMsg [protected]

Definition at line 128 of file FVText.h.

BOOL CFileViewer::m_fShowInit [protected]

Definition at line 125 of file FVText.h.

BOOL CFileViewer::m_fStatusVisible [protected]

Definition at line 140 of file FVText.h.

BOOL CFileViewer::m_fToolsVisible [protected]

Definition at line 139 of file FVText.h.

DWORD CFileViewer::m_grfMode [protected]

Definition at line 123 of file FVText.h.

HACCEL CFileViewer::m_hAccel [protected]

Definition at line 134 of file FVText.h.

HFONT CFileViewer::m_hFont [protected]

Definition at line 155 of file FVText.h.

HINSTANCE CFileViewer::m_hInst [protected]

Definition at line 117 of file FVText.h.

HGLOBAL CFileViewer::m_hMemText [protected]

Definition at line 154 of file FVText.h.

HWND CFileViewer::m_hWnd [protected]

Definition at line 129 of file FVText.h.

HWND CFileViewer::m_hWndOld [protected]

Definition at line 130 of file FVText.h.

HWND CFileViewer::m_hWndStatus [protected]

Definition at line 132 of file FVText.h.

HWND CFileViewer::m_hWndToolbar [protected]

Definition at line 131 of file FVText.h.

HWND CFileViewer::m_hWndViewport [protected]

Definition at line 133 of file FVText.h.

LPFILEVIEWERSITE CFileViewer::m_lpfsi [protected]

Definition at line 119 of file FVText.h.

PFNDESTROYED CFileViewer::m_pfnDestroy [protected]

Definition at line 118 of file FVText.h.

PIMPIFILEVIEWER CFileViewer::m_pIFileViewer [protected]

Definition at line 147 of file FVText.h.

PIMPIPERSISTFILE CFileViewer::m_pIPersistFile [protected]

Definition at line 146 of file FVText.h.

PCStatusHelper CFileViewer::m_pSH [protected]

Definition at line 143 of file FVText.h.

PCStringTable CFileViewer::m_pST [protected]

Definition at line 142 of file FVText.h.

LPSTR CFileViewer::m_pszPath [protected]

Definition at line 122 of file FVText.h.

LPUNKNOWN CFileViewer::m_pUnkOuter [protected]

Definition at line 116 of file FVText.h.

LPFVSHOWINFO CFileViewer::m_pvsi [protected]

Definition at line 148 of file FVText.h.

int CFileViewer::m_xPos [protected]

Definition at line 157 of file FVText.h.

int CFileViewer::m_yPos [protected]

Definition at line 158 of file FVText.h.

The documentation for this class was generated from the following files:
  • WinUI/Shell/FileView/FVText.h
  • WinUI/Shell/FileView/FVInit.Cpp
  • WinUI/Shell/FileView/FVText.Cpp
Generated on Wed Nov 13 2024 16:56:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CFixedAlloc Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Classes | Public Member Functions | Protected Attributes

CFixedAlloc Class Reference

#include "heap.h"

List of all members.

Classes

struct | CNode

Public Member Functions

CFixedAlloc (UINT nAllocSize, UINT nBlockSize=64)
~CFixedAlloc ()
void * | Alloc ()
void | Free (void *p)
void | FreeAll ()
UINT GetAllocSize ()

Protected Attributes

UINT m_nAllocSize
UINT m_nBlockSize
CPlex * m_pBlocks
CNode * m_pNodeFree
CRITICAL_SECTION | m_protect

Detailed Description

Definition at line 24 of file heap.h.

Constructor & Destructor Documentation

CFixedAlloc::CFixedAlloc | ( | UINT | nAllocSize,
 |  | UINT | nBlockSize = 64
 | ) |  |

Definition at line 29 of file heap.Cpp.

{
  m_nAllocSize = nAllocSize;
  m_nBlockSize = nBlockSize;
  m_pNodeFree = NULL;
  m_pBlocks = NULL;
  InitializeCriticalSection(&m_protect);
}

CFixedAlloc::~CFixedAlloc ( )

Definition at line 38 of file heap.Cpp.

{
  FreeAll();
  DeleteCriticalSection(&m_protect);
}

Member Function Documentation

void* CFixedAlloc::Alloc ( ) [inline]

Definition at line 35 of file heap.h.

  {
    EnterCriticalSection(&m_protect);
    if (m_pNodeFree == NULL)
    {
      CPlex* pNewBlock;
      // add another block
      pNewBlock = CPlex::Create(m_pBlocks, m_nBlockSize, m_nAllocSize);

      // chain them into free list
      CNode* pNode = (CNode*)pNewBlock->data();
      // free in reverse order to make it easier to debug
      (BYTE*&)pNode += (m_nAllocSize * m_nBlockSize) - m_nAllocSize;
      for (int i = m_nBlockSize-1; i >= 0; i--, (BYTE*&)pNode -= m_nAllocSize)
      {
        pNode->pNext = m_pNodeFree;
        m_pNodeFree = pNode;
      }
    }

    // remove the first available node from the free list
    void* pNode = m_pNodeFree;
    m_pNodeFree = m_pNodeFree->pNext;

    LeaveCriticalSection(&m_protect);
    return pNode;
  }

void CFixedAlloc::Free ( void * p ) [inline]

Definition at line 63 of file heap.h.

  {
    if (p != NULL)
    {
      EnterCriticalSection(&m_protect);

      // simply return the node to the free list
      CNode* pNode = (CNode*)p;
      pNode->pNext = m_pNodeFree;
      m_pNodeFree = pNode;
      LeaveCriticalSection(&m_protect);
    }
  }

void CFixedAlloc::FreeAll ( )

Definition at line 44 of file heap.Cpp.

{
  EnterCriticalSection(&m_protect);
  m_pBlocks->FreeDataChain();
  m_pBlocks = NULL;
  m_pNodeFree = NULL;
  LeaveCriticalSection(&m_protect);
}

UINT CFixedAlloc::GetAllocSize ( ) [inline]

Definition at line 31 of file heap.h.

{ return m_nAllocSize; }

Member Data Documentation

UINT CFixedAlloc::m_nAllocSize [protected]

Definition at line 88 of file heap.h.

UINT CFixedAlloc::m_nBlockSize [protected]

Definition at line 89 of file heap.h.

CPlex* CFixedAlloc::m_pBlocks [protected]

Definition at line 90 of file heap.h.

CNode* CFixedAlloc::m_pNodeFree [protected]

Definition at line 91 of file heap.h.

CRITICAL_SECTION CFixedAlloc::m_protect [protected]

Definition at line 92 of file heap.h.

The documentation for this class was generated from the following files:
  • Com/Tools/EntityProxy/DataServices/heap.h
  • Com/Tools/EntityProxy/DataServices/heap.Cpp
Generated on Wed Nov 13 2024 16:56:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CFixedAlloc::CNode Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • CFixedAlloc
  • CFixedAlloc::CNode
Public Attributes

CFixedAlloc::CNode Struct Reference

#include "heap.h"

List of all members.

Public Attributes

CNode * pNext

Detailed Description

Definition at line 83 of file heap.h.

Member Data Documentation

CNode* CFixedAlloc::CNode::pNext

Definition at line 85 of file heap.h.

The documentation for this struct was generated from the following file:
  • Com/Tools/EntityProxy/DataServices/heap.h
Generated on Wed Nov 13 2024 16:56:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CFlipDocEditSession Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CFlipDocEditSession Class Reference

Inherits CEditSessionBase.

List of all members.

Public Member Functions

CFlipDocEditSession (ITfContext *pContext)
STDMETHODIMP DoEditSession (TfEditCookie ec)

Detailed Description

Definition at line 11 of file flipdoc.cpp.

Constructor & Destructor Documentation

CFlipDocEditSession::CFlipDocEditSession ( ITfContext * pContext ) [inline]

Definition at line 12 of file flipdoc.cpp.

{

Member Function Documentation

STDAPI CFlipDocEditSession::DoEditSession ( TfEditCookie ec ) [virtual]

Implements CEditSessionBase.

Definition at line 67 of file flipdoc.cpp.

{
    ITfRange *pRangeStart;

    // get the head of the doc
    if (_pContext->GetStart(ec, &pRangeStart) != S_OK)
        return E_FAIL;

    // do the work
    ToggleCase(ec, pRangeStart, TRUE);

    pRangeStart->Release();

    return S_OK;
}

The documentation for this class was generated from the following file:
  • WinUI/TSFcase/flipdoc.cpp
Generated on Wed Nov 13 2024 16:56:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CFlipEditSession Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CFlipEditSession Class Reference

Inherits CEditSessionBase.

List of all members.

Public Member Functions

CFlipEditSession (ITfContext *pContext)
STDMETHODIMP DoEditSession (TfEditCookie ec)

Detailed Description

Definition at line 11 of file flipsel.cpp.

Constructor & Destructor Documentation

CFlipEditSession::CFlipEditSession ( ITfContext * pContext ) [inline]

Definition at line 14 of file flipsel.cpp.

: CEditSessionBase(pContext) {}

Member Function Documentation

STDAPI CFlipEditSession::DoEditSession ( TfEditCookie ec ) [virtual]

Implements CEditSessionBase.

Definition at line 67 of file flipsel.cpp.

{
    TF_SELECTION tfSelection;
    ULONG cFetched;

    // get the selection
    if (_pContext->GetSelection(ec, TF_DEFAULT_SELECTION, 1, &tfSelection, &cFetched) != S_OK ||
        cFetched == 0)
    {
        // no selection
        return S_OK;
    }

    // do the work
    ToggleCase(ec, tfSelection.range, FALSE);

    // release the range
    tfSelection.range->Release();

    return S_OK;
}

The documentation for this class was generated from the following file:
  • WinUI/TSFcase/flipsel.cpp
Generated on Wed Nov 13 2024 16:56:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CFolderNode Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes

CFolderNode Class Reference

#include "foldernode.h"

Inherits CBaseNode, CBaseNode, CBaseNode, CBaseNode, CBaseNode, and CBaseNode.

List of all members.

Public Member Functions

CFolderNode ()
CFolderNode ()
CFolderNode ()
CFolderNode ()
CFolderNode ()
CFolderNode ()
virtual | ~CFolderNode ()
virtual | ~CFolderNode ()
virtual | ~CFolderNode ()
virtual | ~CFolderNode ()
virtual | ~CFolderNode ()
virtual | ~CFolderNode ()
HRESULT | AddMenuItems (LPCONTEXTMENUCALLBACK ipCallback, long __RPC_FAR *pInsertionAllowed)
HRESULT | AddMenuItems (LPCONTEXTMENUCALLBACK ipCallback, long __RPC_FAR *pInsertionAllowed)
HRESULT | AddMenuItems (LPCONTEXTMENUCALLBACK ipCallback, long __RPC_FAR *pInsertionAllowed)
HRESULT | AddMenuItems (LPCONTEXTMENUCALLBACK ipCallback, long __RPC_FAR *pInsertionAllowed)
HRESULT | AddMenuItems (LPCONTEXTMENUCALLBACK ipCallback, long __RPC_FAR *pInsertionAllowed)
HRESULT | AddMenuItems (LPCONTEXTMENUCALLBACK ipCallback, long __RPC_FAR *pInsertionAllowed)
HRESULT | Command (long lCommandID)
HRESULT | Command (long lCommandID)
HRESULT | Command (long lCommandID)
HRESULT | Command (long lCommandID)
HRESULT | Command (long lCommandID)
HRESULT | Command (long lCommandID)
HRESULT | ControlbarNotify (LPARAM nArg, LPARAM lParam, LONG_PTR pComp)
HRESULT | CreatePropertyPages (LPPROPERTYSHEETCALLBACK lpCallback, LONG_PTR Handle)
HRESULT | CreatePropertyPages (LPPROPERTYSHEETCALLBACK lpCallback, LONG_PTR Handle)
DWORD GetAttributes ()
LPWSTR | GetAttributeString ()
HRESULT | GetDisplayInfo (RESULTDATAITEM *pRDI)
HRESULT | GetDisplayInfo (RESULTDATAITEM *pRDI)
HRESULT | GetDisplayInfo (SCOPEDATAITEM *pSDI)
HRESULT | GetDisplayInfo (RESULTDATAITEM *pRDI)
HRESULT | GetDisplayInfo (SCOPEDATAITEM *pSDI)
HRESULT | GetDisplayInfo (RESULTDATAITEM *pRDI)
HRESULT | GetDisplayInfo (RESULTDATAITEM *pRDI)
HRESULT | GetDisplayInfo (SCOPEDATAITEM *pSDI)
HRESULT | GetDisplayInfo (RESULTDATAITEM *pRDI)
HRESULT | GetDisplayInfo (SCOPEDATAITEM *pSDI)
HRESULT | GetDisplayInfo (SCOPEDATAITEM *pSDI)
HRESULT | GetDisplayInfo (SCOPEDATAITEM *pSDI)
GUID & | GetNodeGUID ()
GUID & | GetNodeGUID ()
GUID & | GetNodeGUID ()
GUID & | GetNodeGUID ()
GUID & | GetNodeGUID ()
GUID & | GetNodeGUID ()
ULONG GetNodeType ()
ULONG GetNodeType ()
ULONG GetNodeType ()
ULONG GetNodeType ()
ULONG GetNodeType ()
ULONG GetNodeType ()
LPWSTR | GetObjectPath ()
HRESULT | GetProperties (LPNODEPROPS *ppNodeProps)
HRESULT | GetProperty (BSTR bstrPropertyName, PBSTR pbstrProperty)
HRESULT | GetResultViewType2 (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pRVTinfo)
HRESULT | GetResultViewType2 (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pRVTinfo)
HRESULT | GetResultViewType2 (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pRVTinfo)
HRESULT | GetResultViewType2 (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pRVTinfo)
HRESULT | GetResultViewType2 (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pRVTinfo)
HRESULT | GetResultViewType2 (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pRVTinfo)
HRESULT | GetWatermarks (HBITMAP __RPC_FAR *lphWatermark, HBITMAP __RPC_FAR *lphHeader, HPALETTE __RPC_FAR *lphPalette, BOOL __RPC_FAR *bStretch)
HRESULT | GetWatermarks (HBITMAP __RPC_FAR *lphWatermark, HBITMAP __RPC_FAR *lphHeader, HPALETTE __RPC_FAR *lphPalette, BOOL __RPC_FAR *bStretch)
HRESULT | Initialize (LPNODEPROPS pNodeProps)
HRESULT | Initialize (LPNODEPROPS pNodeProps)
HRESULT | Initialize (NODE_PROPERTIES *pNodeProps)
HRESULT | Initialize (NODE_PROPERTIES *pNodeProps)
HRESULT | Initialize (NODE_PROPERTIES *pNodeProps)
HRESULT | Initialize (NODE_PROPERTIES *pNodeProps)
BOOL | IsAttributeSet (DWORD dwAttribute)
HRESULT | OnContextHelp (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnCutOrMove (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnDelete (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnDelete (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pComponent)
HRESULT | OnDelete (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnExpand (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pCompData)
HRESULT | OnExpand (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pCompData)
HRESULT | OnExpand (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pCompData)
HRESULT | OnExpand (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pCompData)
HRESULT | OnExpand (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pCompData)
HRESULT | OnExpand (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pCompData)
HRESULT | OnPaste (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnQueryPaste (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnRemoveChildren (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pCompData)
HRESULT | OnRemoveChildren (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pCompData)
HRESULT | OnRemoveChildren (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pCompData)
HRESULT | OnRemoveChildren (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pCompData)
HRESULT | OnRemoveChildren (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pCompData)
HRESULT | OnRemoveChildren (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pCompData)
HRESULT | OnRename (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pCompData)
HRESULT | OnRename (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pCompData)
HRESULT | OnRename (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnSelect (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnSelect (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pComponent)
HRESULT | OnSelect (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnSelect (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pComponent)
HRESULT | OnSelect (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnSelect (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnShow (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnShow (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnShow (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pComponent)
HRESULT | OnShow (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnShow (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnShow (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pComponent)
HRESULT | OnViewChange (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnViewChange (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnViewChange (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pComponent)
HRESULT | OnViewChange (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnViewChange (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | QueryForPropertyPage ()
HRESULT | QueryForPropertyPage ()
VOID | RemoveAttribute (DWORD dwAttribute)
VOID | RemoveChildNode (LONG_PTR pChildNode)
VOID | RemoveChildNode (LONG_PTR pChildNode)
VOID | RemoveVirtualFile (CVirtualFile *pDeadNode)
VOID | RemoveVirtualFile (CVirtualFile *pDeadNode)
VOID | RemoveVirtualFile (CVirtualFile *pDeadNode)
VOID | SetAttribute (DWORD dwAttribute)

Static Public Member Functions

static LRESULT CALLBACK | FolderNodeWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
static LRESULT CALLBACK | FolderNodeWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
static LRESULT CALLBACK | FolderNodeWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
static LRESULT CALLBACK | FolderNodeWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
static LRESULT CALLBACK | FolderNodeWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)

Public Attributes

HWND | m_hAddVFileDlg

Private Member Functions

HRESULT | AddVirtualFile (NODE_PROPERTIES *pProps=NULL)
HRESULT | AddVirtualFile (NODE_PROPERTIES *pProps=NULL)
HRESULT | AddVirtualFile (NODE_PROPERTIES *pProps=NULL)
HRESULT | AddVirtualFile (NODE_PROPERTIES *pProps=NULL)
HRESULT | AddVirtualFile (NODE_PROPERTIES *pProps=NULL)
HRESULT | EnumerateResultItems (LPRESULTDATA ipResultData)
HRESULT | EnumerateResultItems (LPRESULTDATA ipResultData)
HRESULT | EnumerateResultItems (LPRESULTDATA ipResultData)
HRESULT | EnumerateResultItems (LPRESULTDATA ipResultData)
HRESULT | EnumerateResultItems (LPRESULTDATA ipResultData)
HRESULT | InitDefaultVFile ()
HRESULT | InitDefaultVFile ()
HRESULT | RefreshNodeList ()
HRESULT | RefreshNodeList ()
HRESULT | RefreshNodeList ()
VOID | RemoveChildNodes ()
VOID | RemoveNodes ()
VOID | RemoveNodes ()
VOID | RemoveNodes ()
VOID | RemoveNodes ()

Private Attributes

DWORD m_dwAttributes
HWND | m_hMessageWnd
CLListImpl< CVirtualFile
*, CVirtualFile * > 		m_NodeList
CComponentData * m_pCompData
CDeviceNode * m_pParentNode

Static Private Attributes

static GUID | m_thisGUID = CLSID_CFolderNode
static GUID | thisGUID = CLSID_CFolderNode

Detailed Description

Definition at line 29 of file foldernode.h.

Constructor & Destructor Documentation

CFolderNode::CFolderNode ( )

Definition at line 33 of file foldernode.cpp.

{
  m_SDI.mask        = DEFAULT_SDI_MASK;
  m_SDI.displayname = MMC_CALLBACK;
  m_SDI.nImage      = IMG_FOLDER_DEFAULT;
  m_SDI.nOpenImage  = IMG_FOLDER_DEFAULT;
  m_SDI.cChildren   = 0;              // Determines if the '+' is displayed
  m_SDI.lParam      = reinterpret_cast<LPARAM>(this);

  m_dwAttributes    = 0;
  m_pCompData       = NULL;
}

CFolderNode::~CFolderNode ( ) [virtual]

Definition at line 47 of file foldernode.cpp.

{
}

CFolderNode::CFolderNode ( )
virtual CFolderNode::~CFolderNode ( ) [virtual]
CFolderNode::CFolderNode ( )
virtual CFolderNode::~CFolderNode ( ) [virtual]
CFolderNode::CFolderNode ( )
virtual CFolderNode::~CFolderNode ( ) [virtual]
CFolderNode::CFolderNode ( )
virtual CFolderNode::~CFolderNode ( ) [virtual]
CFolderNode::CFolderNode ( )
virtual CFolderNode::~CFolderNode ( ) [virtual]

Member Function Documentation

HRESULT CFolderNode::AddMenuItems | ( | LPCONTEXTMENUCALLBACK | ipCallback,
 |  | long __RPC_FAR * | pInsertionAllowed |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 260 of file foldernode.cpp.

{
  return E_NOTIMPL;
}

HRESULT CFolderNode::AddMenuItems | ( | LPCONTEXTMENUCALLBACK | ipCallback,
 |  | long __RPC_FAR * | pInsertionAllowed |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CFolderNode::AddMenuItems | ( | LPCONTEXTMENUCALLBACK | ipCallback,
 |  | long __RPC_FAR * | pInsertionAllowed |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CFolderNode::AddMenuItems | ( | LPCONTEXTMENUCALLBACK | ipCallback,
 |  | long __RPC_FAR * | pInsertionAllowed |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CFolderNode::AddMenuItems | ( | LPCONTEXTMENUCALLBACK | ipCallback,
 |  | long __RPC_FAR * | pInsertionAllowed |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CFolderNode::AddMenuItems | ( | LPCONTEXTMENUCALLBACK | ipCallback,
 |  | long __RPC_FAR * | pInsertionAllowed |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CFolderNode::AddVirtualFile ( NODE_PROPERTIES * pProps = NULL ) [private]

Definition at line 502 of file foldernode.cpp.

{
  _ASSERT( NULL != pProps );
  HRESULT hResult = S_FALSE;

  pProps->pParentObject  = reinterpret_cast<LONG_PTR>(this);
  pProps->pComponentData = reinterpret_cast<LONG_PTR>(m_pCompData);

  CVirtualFile* pNode = NULL;
  pNode = new CVirtualFile;
  pNode->Initialize( pProps );
  m_NodeList.AddTail( pNode );

  LPCONSOLE3 ipConsole = NULL;
  hResult = m_pCompData->GetInterface( REQUEST_ICONSOLE, (LONG_PTR*)&ipConsole );
  if( S_OK != hResult )
    return hResult;

  LPDATAOBJECT pDO = NULL;
  m_pCompData->QueryDataObject( (MMC_COOKIE)this, CCT_SCOPE, &pDO );

  ipConsole->UpdateAllViews( pDO, 0, 0 );
  pDO->Release();

  return hResult;
}

HRESULT CFolderNode::AddVirtualFile ( NODE_PROPERTIES * pProps = NULL ) [private]
HRESULT CFolderNode::AddVirtualFile ( NODE_PROPERTIES * pProps = NULL ) [private]
HRESULT CFolderNode::AddVirtualFile ( NODE_PROPERTIES * pProps = NULL ) [private]
HRESULT CFolderNode::AddVirtualFile ( NODE_PROPERTIES * pProps = NULL ) [private]
HRESULT CFolderNode::Command ( long lCommandID ) [virtual]

Implements CBaseNode.

HRESULT CFolderNode::Command ( long lCommandID ) [virtual]

Implements CBaseNode.

HRESULT CFolderNode::Command ( long lCommandID ) [virtual]

Implements CBaseNode.

HRESULT CFolderNode::Command ( long lCommandID ) [virtual]

Implements CBaseNode.

Definition at line 270 of file foldernode.cpp.

{
  return E_NOTIMPL;
}

HRESULT CFolderNode::Command ( long lCommandID ) [virtual]

Implements CBaseNode.

HRESULT CFolderNode::Command ( long lCommandID ) [virtual]

Implements CBaseNode.

HRESULT CFolderNode::ControlbarNotify | ( | LPARAM | nArg,
 |  | LPARAM | lParam,
 |  | LONG_PTR | pComp |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 461 of file foldernode.cpp.

{
  return E_NOTIMPL;
}

HRESULT CFolderNode::CreatePropertyPages | ( | LPPROPERTYSHEETCALLBACK | lpCallback,
 |  | LONG_PTR | Handle |
 | ) |  |  | [inline, virtual]

Implements CBaseNode.

Definition at line 55 of file foldernode.h.

            { return E_NOTIMPL; }

HRESULT CFolderNode::CreatePropertyPages | ( | LPPROPERTYSHEETCALLBACK | lpCallback,
 |  | LONG_PTR | Handle |
 | ) |  |  | [inline, virtual]

Implements CBaseNode.

Definition at line 55 of file foldernode.h.

            { return E_NOTIMPL; }

HRESULT CFolderNode::EnumerateResultItems ( LPRESULTDATA ipResultData ) [private]
HRESULT CFolderNode::EnumerateResultItems ( LPRESULTDATA ipResultData ) [private]

Definition at line 790 of file foldernode.cpp.

{
  _ASSERT( NULL != ipResultData );
  HRESULT hResult = S_OK;

  if( FALSE == m_NodeList.IsEmpty() )
    hResult = ipResultData->DeleteAllRsltItems();

  if( S_OK == hResult )
  {
    CVirtualFile*  pNode = NULL;
    POSITION       Pos   = m_NodeList.GetHeadPosition();
    while( Pos )
    {
      pNode = m_NodeList.GetNext( Pos );
      hResult = ipResultData->InsertItem( &pNode->m_RDI );
      _ASSERT( S_OK == hResult );
    }
  }

  //TRACE_HRESULT( _T("EnumerateResultItems"), hResult );
  return hResult;
}

HRESULT CFolderNode::EnumerateResultItems ( LPRESULTDATA ipResultData ) [private]
HRESULT CFolderNode::EnumerateResultItems ( LPRESULTDATA ipResultData ) [private]
HRESULT CFolderNode::EnumerateResultItems ( LPRESULTDATA ipResultData ) [private]
LRESULT CALLBACK CFolderNode::FolderNodeWndProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 138 of file foldernode.cpp.

{
  switch( uMsg )
  {
    case WM_CREATE:
    {
      LPCREATESTRUCT lpcs = (LPCREATESTRUCT)lParam;
      SetWindowLongPtr( hWnd, 0, (LONG_PTR)lpcs->lpCreateParams );
      break;
    }

    case WM_ADD_VIRTUALFILE:
    {
      CFolderNode* pThisNode = (CFolderNode*)GetWindowLongPtr( hWnd, 0 );
      NODE_PROPERTIES* pProps = (NODE_PROPERTIES*)wParam;
      pThisNode->AddVirtualFile( pProps );
      break;
    }

    case WM_VIRTUALFILE_CLOSED:
    {
      CFolderNode* pThisNode = (CFolderNode*)GetWindowLongPtr( hWnd, 0 );
      pThisNode->m_hAddVFileDlg = NULL;
      break;
    }
    default:
      return DefWindowProc( hWnd, uMsg, wParam, lParam );
  }
  return 0;
}

static LRESULT CALLBACK CFolderNode::FolderNodeWndProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]
static LRESULT CALLBACK CFolderNode::FolderNodeWndProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]
static LRESULT CALLBACK CFolderNode::FolderNodeWndProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]
static LRESULT CALLBACK CFolderNode::FolderNodeWndProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]
DWORD CFolderNode::GetAttributes ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 112 of file foldernode.h.

{ return 0; }

LPWSTR CFolderNode::GetAttributeString ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 111 of file foldernode.h.

{ return m_pAttributeStr; }

HRESULT CFolderNode::GetDisplayInfo ( SCOPEDATAITEM * pSDI ) [virtual]

Implements CBaseNode.

HRESULT CFolderNode::GetDisplayInfo ( RESULTDATAITEM * pRDI ) [virtual]

Implements CBaseNode.

HRESULT CFolderNode::GetDisplayInfo ( SCOPEDATAITEM * pSDI ) [virtual]

Implements CBaseNode.

Definition at line 95 of file foldernode.cpp.

{
  _ASSERT( NULL != pSDI );
  pSDI->displayname = m_pwszNodeName;

  return S_OK;
}

HRESULT CFolderNode::GetDisplayInfo ( SCOPEDATAITEM * pSDI ) [virtual]

Implements CBaseNode.

HRESULT CFolderNode::GetDisplayInfo ( RESULTDATAITEM * pRDI ) [virtual]

Implements CBaseNode.

HRESULT CFolderNode::GetDisplayInfo ( RESULTDATAITEM * pRDI ) [virtual]

Implements CBaseNode.

HRESULT CFolderNode::GetDisplayInfo ( SCOPEDATAITEM * pSDI ) [virtual]

Implements CBaseNode.

HRESULT CFolderNode::GetDisplayInfo ( RESULTDATAITEM * pRDI ) [virtual]

Implements CBaseNode.

HRESULT CFolderNode::GetDisplayInfo ( SCOPEDATAITEM * pSDI ) [virtual]

Implements CBaseNode.

HRESULT CFolderNode::GetDisplayInfo ( RESULTDATAITEM * pRDI ) [virtual]

Implements CBaseNode.

Definition at line 107 of file foldernode.cpp.

{
  _ASSERT( NULL != pRDI );

  HRESULT hResult = S_OK;

  if( pRDI->mask & RDI_STR )         // Console is requesting strings...
  {                                  // for each column
    switch( pRDI->nCol )
    {
      case 0:
        pRDI->str = m_pwszNodeName;
        break;

      case 1:                        // Attributes not supported yet
        pRDI->str = L"No attributes";
        break;

      default:
        hResult = S_FALSE;
        TRACE_VAL(_T("GetDisplayInfo"), _T("Column"), pRDI->nCol );
        break;
    }
  }
  if( pRDI->mask & RDI_IMAGE )       // Looking for an image?
  {
    pRDI->nImage = m_SDI.nImage;
  }

  TRACE_HRESULT(_T("GetDisplayInfo"), hResult );
  return hResult;

}

HRESULT CFolderNode::GetDisplayInfo ( SCOPEDATAITEM * pSDI ) [virtual]

Implements CBaseNode.

HRESULT CFolderNode::GetDisplayInfo ( RESULTDATAITEM * pRDI ) [virtual]

Implements CBaseNode.

GUID& CFolderNode::GetNodeGUID ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 43 of file foldernode.h.

{ return thisGUID; }

GUID& CFolderNode::GetNodeGUID ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 45 of file foldernode.h.

{ return thisGUID; }

GUID& CFolderNode::GetNodeGUID ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 43 of file foldernode.h.

{ return thisGUID; }

GUID& CFolderNode::GetNodeGUID ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 41 of file foldernode.h.

{ return thisGUID; }

GUID& CFolderNode::GetNodeGUID ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 43 of file foldernode.h.

{ return thisGUID; }

GUID& CFolderNode::GetNodeGUID ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 44 of file foldernode.h.

{ return m_thisGUID; }

ULONG CFolderNode::GetNodeType ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 42 of file foldernode.h.

{ return NODETYPE_FOLDER; }

ULONG CFolderNode::GetNodeType ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 42 of file foldernode.h.

{ return NODETYPE_FOLDER; }

ULONG CFolderNode::GetNodeType ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 42 of file foldernode.h.

{ return NODETYPE_FOLDER; }

ULONG CFolderNode::GetNodeType ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 40 of file foldernode.h.

{ return NODETYPE_FOLDER; }

ULONG CFolderNode::GetNodeType ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 44 of file foldernode.h.

{ return NODETYPE_FOLDER; }

ULONG CFolderNode::GetNodeType ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 43 of file foldernode.h.

{ return NODETYPE_FOLDER; }

LPWSTR CFolderNode::GetObjectPath ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 113 of file foldernode.h.

{ return NULL; }

HRESULT CFolderNode::GetProperties ( LPNODEPROPS * ppNodeProps ) [virtual]

Implements CBaseNode.

Definition at line 186 of file foldernode.cpp.

{
  _ASSERT( NULL == *ppNodeProps );

  LONG nChildCount = m_NodeList.GetCount();
  LONG nBlockSize  = (nChildCount * sizeof(CHILDPROPS)) + sizeof(NODEPROPS);

  HGLOBAL hMemBlock = NULL;
  hMemBlock = ::GlobalAlloc( GMEM_SHARE | GMEM_MOVEABLE, nBlockSize );
  if( NULL == hMemBlock )
    return E_OUTOFMEMORY;

  hMemBlock = ::GlobalLock( hMemBlock );
  LPNODEPROPS pTmpProps = (LPNODEPROPS)hMemBlock;

  ZeroMemory( pTmpProps, nBlockSize );
  wcscpy( pTmpProps->szNodeName,  m_pwszNodeName );
  pTmpProps->pComponentData = NULL;        // Pointers not used for DragDrop
  pTmpProps->pParentObject  = NULL;
  pTmpProps->dwAttributes   = m_dwAttributes;
  pTmpProps->nChildCount    = nChildCount;
  pTmpProps->nBlockSize     = nBlockSize;

  LPCHILDPROPS pChProps = &pTmpProps->pChildProps;
  BYTE* pCounter = (BYTE*)&pTmpProps->pChildProps;

  CVirtualFile* pNode = NULL;
  POSITION   Pos = m_NodeList.GetHeadPosition();
  while( Pos )
  {
    pNode = m_NodeList.GetNext( Pos );
    wcscpy( pChProps->szNodeName, pNode->GetNodeName() );
    pChProps->dwAttributes = pNode->GetAttributes();
    pCounter += sizeof(CHILDPROPS);    // Next element in the array
    pChProps = (LPCHILDPROPS)pCounter;
  }

  ::GlobalUnlock( hMemBlock );
  *ppNodeProps = (LPNODEPROPS)hMemBlock;

  return S_OK;
}

HRESULT CFolderNode::GetProperty | ( | BSTR | bstrPropertyName,
 |  | PBSTR | pbstrProperty |
 | ) |  |  | [inline, virtual]

Implements CBaseNode.

Definition at line 44 of file foldernode.h.

{ return E_NOTIMPL; }

HRESULT CFolderNode::GetResultViewType2 | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pRVTinfo |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CFolderNode::GetResultViewType2 | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pRVTinfo |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CFolderNode::GetResultViewType2 | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pRVTinfo |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CFolderNode::GetResultViewType2 | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pRVTinfo |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CFolderNode::GetResultViewType2 | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pRVTinfo |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CFolderNode::GetResultViewType2 | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pRVTinfo |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 77 of file foldernode.cpp.

{
  LPOLESTR pszDescStr = (LPOLESTR)CoTaskMemAlloc( sizeof(L"DefaultListView")+1 );
  if( NULL == pszDescStr )
    return E_OUTOFMEMORY;

  wcscpy( pszDescStr, L"DefaultListView" );
  pRVTinfo->pstrPersistableViewDescription = pszDescStr;

  return S_OK;
}

HRESULT CFolderNode::GetWatermarks | ( | HBITMAP __RPC_FAR * | lphWatermark,
 |  | HBITMAP __RPC_FAR * | lphHeader,
 |  | HPALETTE __RPC_FAR * | lphPalette,
 |  | BOOL __RPC_FAR * | bStretch |
 | ) |  |  | [inline, virtual]

Implements CBaseNode.

Definition at line 58 of file foldernode.h.

            { return E_NOTIMPL; }

HRESULT CFolderNode::GetWatermarks | ( | HBITMAP __RPC_FAR * | lphWatermark,
 |  | HBITMAP __RPC_FAR * | lphHeader,
 |  | HPALETTE __RPC_FAR * | lphPalette,
 |  | BOOL __RPC_FAR * | bStretch |
 | ) |  |  | [inline, virtual]

Implements CBaseNode.

Definition at line 58 of file foldernode.h.

            { return E_NOTIMPL; }

HRESULT CFolderNode::InitDefaultVFile ( ) [private]

Definition at line 706 of file foldernode.cpp.

{
  NODE_PROPERTIES NodeProps;
  NodeProps.pComponentData = reinterpret_cast<LONG_PTR>(m_pCompData);
  NodeProps.pParentObject  = reinterpret_cast<LONG_PTR>(this);
  NodeProps.dwAttributes   = ATTRIBUTE_DATA_ARCHIVE;

  RemoveNodes();             // Clean the node list

  CVirtualFile* pNode = NULL;
  wcscpy( NodeProps.szNodeName, gwszVFILE_NODE_NAME );
  pNode = new CVirtualFile;
  pNode->Initialize( &NodeProps );
  m_NodeList.AddTail( pNode );

  return S_OK;
}

HRESULT CFolderNode::InitDefaultVFile ( ) [private]
HRESULT CFolderNode::Initialize ( NODE_PROPERTIES * pNodeProps ) [virtual]

Implements CBaseNode.

HRESULT CFolderNode::Initialize ( NODE_PROPERTIES * pNodeProps ) [virtual]

Implements CBaseNode.

Definition at line 55 of file foldernode.cpp.

{
  _ASSERT( NULL != pNodeProps );

  UINT   nLen   = wcslen( pNodeProps->szNodeName ) + 1;
  LPWSTR pszTmp = (LPWSTR)CoTaskMemAlloc(nLen * sizeof(WCHAR));
  wcscpy( pszTmp, pNodeProps->szNodeName );
  if( NULL != m_pwszNodeName )
    CoTaskMemFree( m_pwszNodeName );

  m_pwszNodeName = pszTmp;
  m_pCompData    = reinterpret_cast<CComponentData*>(pNodeProps->pComponentData);

  return S_OK;
}

HRESULT CFolderNode::Initialize ( NODE_PROPERTIES * pNodeProps ) [virtual]

Implements CBaseNode.

HRESULT CFolderNode::Initialize ( NODE_PROPERTIES * pNodeProps ) [virtual]

Implements CBaseNode.

HRESULT CFolderNode::Initialize ( LPNODEPROPS pNodeProps ) [virtual]

Implements CBaseNode.

Definition at line 64 of file foldernode.cpp.

{
  _ASSERT( NULL != pNodeProps );
  HRESULT hResult = S_OK;

  UINT   nLen   = wcslen( pNodeProps->szNodeName ) + 1;
  LPWSTR pszTmp = (LPWSTR)CoTaskMemAlloc(nLen * sizeof(WCHAR));
  wcscpy( pszTmp, pNodeProps->szNodeName );
  if( NULL != m_pwszNodeName )
    CoTaskMemFree( m_pwszNodeName );

  m_pwszNodeName = pszTmp;
  m_pCompData    = reinterpret_cast<CComponentData*>(pNodeProps->pComponentData);
  m_pParentNode  = reinterpret_cast<CDeviceNode*>(pNodeProps->pParentObject);

  CVirtualFile* pNode  = NULL;
  LONG  nChildCount    = pNodeProps->nChildCount;
  LPCHILDPROPS pChProp = &pNodeProps->pChildProps;
  BYTE* pCounter = (BYTE*)pChProp;

  if( INIT_DEFAULT_NODE == pNodeProps->nChildCount )
  {
    InitDefaultVFile();
  }
  else
  {
    pNodeProps->pComponentData = reinterpret_cast<LONG_PTR>(m_pCompData);
    pNodeProps->pParentObject  = reinterpret_cast<LONG_PTR>(this);
    pNodeProps->nChildCount    = 0;

    // Create a new VirtualFile node for each ChildProperties struct
    // in the array
    //
    for( LONG nCount = 0; nCount < nChildCount; nCount++ )
    {
      wcscpy( pNodeProps->szNodeName, pChProp->szNodeName );
      pNodeProps->dwAttributes = pChProp->dwAttributes;
      pNode = new CVirtualFile;
      pNode->Initialize( pNodeProps );
      m_NodeList.AddTail( pNode );
      pCounter += sizeof(CHILDPROPS);
      pChProp = (LPCHILDPROPS)pCounter;
    }
  }

  // We create a hidden window to allow us to communicate with modeless
  // dialogs and other objects which run in a seperate thread.
  //
  WNDCLASS wc;
  ZeroMemory(&wc, sizeof(WNDCLASS));
  wc.cbWndExtra    = sizeof(this);
  wc.lpfnWndProc   = FolderNodeWndProc;
  wc.hInstance     = g_hInst;
  wc.lpszClassName = _T("FolderNodeMessageWindow");

  RegisterClass( &wc );
  m_hMessageWnd = CreateWindow( _T("FolderNodeMessageWindow"), NULL,
                                0, 0, 0, 0, 0, NULL, 0, g_hInst, this);

  if( NULL == m_hMessageWnd )
    hResult = S_FALSE;

  return hResult;
}

HRESULT CFolderNode::Initialize ( LPNODEPROPS pNodeProps ) [virtual]

Implements CBaseNode.

BOOL CFolderNode::IsAttributeSet ( DWORD dwAttribute ) [inline, virtual]

Implements CBaseNode.

Definition at line 108 of file foldernode.h.

{ return FALSE; }

HRESULT CFolderNode::OnContextHelp | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 343 of file foldernode.cpp.

{
  HRESULT   hResult = S_FALSE;
  CComponent* pComp = reinterpret_cast<CComponent*>(pComponent);

  LPOLESTR pszBaseHelpPath  = GetHelpFilePath();
  LPOLESTR pszTopicPath     = L"::/FolderNodes.html";

  // Allocate space for the topic string
  SIZE_T nBasePathLen  = wcslen( pszBaseHelpPath );
  SIZE_T nTopicPathLen = wcslen( pszTopicPath );
  SIZE_T nBufferSize   = (nBasePathLen + nTopicPathLen + 1) * sizeof(WCHAR);

  // Build the topic string
  LPOLESTR pszThisTopicPath = (LPOLESTR)CoTaskMemAlloc( nBufferSize );
  wcscpy( pszThisTopicPath, pszBaseHelpPath );
  wcscat( pszThisTopicPath, pszTopicPath );

  // Request a pointer to IDisplayHelp
  IDisplayHelp* ipDisplayHelp = NULL;
  pComp->GetInterface( REQUEST_IDISPLAYHELP, (LONG_PTR*)&ipDisplayHelp );

  hResult = ipDisplayHelp->ShowTopic( pszThisTopicPath );

  TRACE_HRESULT(_T("OnContextHelp"), hResult );   // Return value is not used
  return hResult;
}

HRESULT CFolderNode::OnCutOrMove | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 589 of file foldernode.cpp.

{
  _ASSERT( NULL != m_pParentNode );
  _ASSERT( NULL != m_pCompData );
  HRESULT hResult = S_FALSE;

  LPCONSOLENAMESPACE2 ipCNS = NULL;
  hResult = m_pCompData->GetInterface( REQUEST_ICONSOLENAMESPACE, (LONG_PTR*)&ipCNS );
  hResult = ipCNS->DeleteItem( m_SDI.ID, TRUE );

  m_pParentNode->RemoveChildNode( (LONG_PTR)this );

  delete this;               // Now we can delete ourselves

  return hResult;
}

HRESULT CFolderNode::OnDelete | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [inline, virtual]

Implements CBaseNode.

Definition at line 74 of file foldernode.h.

            { return E_NOTIMPL; }

HRESULT CFolderNode::OnDelete | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [inline, virtual]

Implements CBaseNode.

Definition at line 74 of file foldernode.h.

            { return E_NOTIMPL; }

HRESULT CFolderNode::OnDelete | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [inline, virtual]

Implements CBaseNode.

Definition at line 62 of file foldernode.h.

            { return E_NOTIMPL; }

HRESULT CFolderNode::OnExpand | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CFolderNode::OnExpand | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 220 of file foldernode.cpp.

{
  HRESULT hResult = S_FALSE;

  if( NULL == m_pCompData )
    m_pCompData = reinterpret_cast<CComponentData*>(pCompData);

  TRACE_HRESULT( _T("OnExpand"), hResult );
  return hResult;              // Not expanding anything
}

HRESULT CFolderNode::OnExpand | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 396 of file foldernode.cpp.

{
  HRESULT hResult = S_FALSE;

  if( NULL == m_pCompData )
    m_pCompData = reinterpret_cast<CComponentData*>(pCompData);

  //TRACE_HRESULT( _T("OnExpand"), hResult );
  return hResult;              // Not expanding anything
}

HRESULT CFolderNode::OnExpand | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CFolderNode::OnExpand | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CFolderNode::OnExpand | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CFolderNode::OnPaste | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 514 of file foldernode.cpp.

{
  _ASSERT( NULL != nArg );
  _ASSERT( NULL != pComponent );

  HRESULT hResult = S_FALSE;
  CComponent* pComp = reinterpret_cast<CComponent*>(pComponent);
  LPDATAOBJECT ipSourceDO = reinterpret_cast<LPDATAOBJECT>(nArg);

  do
  {
    // Test to see if the data object supports the clipformat we need
    FORMATETC NodePropFormatEtc = NP_FORMATETC;
    hResult = ipSourceDO->QueryGetData( &NodePropFormatEtc );
    BREAK_ON_ERROR( hResult );

    STGMEDIUM StgMedium = {TYMED_HGLOBAL, NULL};
    hResult = ipSourceDO->GetData( &NodePropFormatEtc, &StgMedium );
    BREAK_ON_ERROR( hResult );

    NODE_PROPERTIES* pNodeProps = NULL;
    pNodeProps = (NODE_PROPERTIES*)::GlobalLock( StgMedium.hGlobal );

    // Set variables which must be local
    pNodeProps->pParentObject  = reinterpret_cast<LONG_PTR>(this);
    pNodeProps->pComponentData = reinterpret_cast<LONG_PTR>(m_pCompData);

    // Now add the new node
    CVirtualFile* pNode = NULL;
    pNode = new CVirtualFile;
    pNode->Initialize( pNodeProps );
    m_NodeList.AddTail( pNode );

    // Now do some housekeeping, and test that everything went OK....
    BOOL    bStatus = ::GlobalUnlock( StgMedium.hGlobal );
    HGLOBAL hReturn = ::GlobalFree( StgMedium.hGlobal );
    _ASSERT( NULL == hReturn );

    if( NULL != nParam )
    {
      // We must AddRef it becuase MMC will release it once when we
      // return, and again when CFolderNode::OnCutOrMove returns.
      //
      BOOL* pbPasted = reinterpret_cast<BOOL*>(nParam);
      ULONG nCount = ipSourceDO->AddRef();
      *pbPasted = reinterpret_cast<BOOL>(ipSourceDO);
    }

    // Force ourself to be selected so the new result items
    // will be displayed
    //
//    LPCONSOLE3 ipConsole3 = NULL;
//    hResult = m_pCompData->GetInterface( REQUEST_ICONSOLE, (LONG_PTR*)&ipConsole3 );
//    hResult = ipConsole3->SelectScopeItem( m_SDI.ID );

    LPCONSOLE3 ipConsole3 = NULL;
    hResult = m_pCompData->GetInterface( REQUEST_ICONSOLE, (LONG_PTR*)&ipConsole3 );
    if( S_OK != hResult )
    return hResult;

    hResult = ipConsole3->UpdateAllViews( ipDataObject, 0, (LONG_PTR)this );
  }while(0);

  return hResult;
}

HRESULT CFolderNode::OnQueryPaste | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 494 of file foldernode.cpp.

{
  _ASSERT( NULL != nArg );
  ULONG nTypeFlag = ExtractNodeTypeFlg( reinterpret_cast<LPDATAOBJECT>(nArg) );
  return (NODETYPE_VFILE == nTypeFlag) ? S_OK : S_FALSE;
}

HRESULT CFolderNode::OnRemoveChildren | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 239 of file foldernode.cpp.

{
  HRESULT hResult = S_FALSE;

  // This method not used in this project

  TRACE_HRESULT( _T("OnRemoveChildren"), hResult );
  return hResult;
}

HRESULT CFolderNode::OnRemoveChildren | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CFolderNode::OnRemoveChildren | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 414 of file foldernode.cpp.

{
  HRESULT hResult = S_OK;      // Just delete our child nodes, the
                               // corresponding result items are cleaned
  RemoveNodes();               // up in MMCN_SHOW -> FALSE

  //TRACE_HRESULT( _T("OnRemoveChildren"), hResult );
  return hResult;
}

HRESULT CFolderNode::OnRemoveChildren | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CFolderNode::OnRemoveChildren | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CFolderNode::OnRemoveChildren | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CFolderNode::OnRename | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CFolderNode::OnRename | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 458 of file foldernode.cpp.

{
  _ASSERT( NULL != ipDataObject );
  HRESULT hResult = S_OK;

  LPWSTR pszTmpName = NULL;
  LPWSTR pszNewName = (LPWSTR)nParam;  // New name
  LONG   nLen = wcslen( pszNewName ) + 1;

  pszTmpName = (LPWSTR)CoTaskMemAlloc(nLen * sizeof(WCHAR));
  if( NULL == pszTmpName )
  {
    hResult = S_FALSE;                 // Can't change the name
  }
  else
  {
    wcscpy( pszTmpName, pszNewName );
    CoTaskMemFree( m_pwszNodeName );   // Free existing name...
    m_pwszNodeName = pszTmpName;       // Assign new name to pointer
  }
  return hResult;
}

HRESULT CFolderNode::OnRename | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [inline, virtual]

Implements CBaseNode.

Definition at line 59 of file foldernode.h.

            { return E_NOTIMPL; }

HRESULT CFolderNode::OnSelect | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CFolderNode::OnSelect | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CFolderNode::OnSelect | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 149 of file foldernode.cpp.

{
  HRESULT hResult = S_FALSE;

  // Not setting verbs for this node

  TRACE_HRESULT(_T("OnSelect"), hResult );
  return hResult;
}

HRESULT CFolderNode::OnSelect | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 311 of file foldernode.cpp.

{
  HRESULT hResult    = S_FALSE;
  BOOL    fScopePane = LOWORD(nArg);
  BOOL    fSelected  = HIWORD(nArg);

  if( TRUE == fSelected )
  {
    CComponent* pComp = reinterpret_cast<CComponent*>(pComponent);

    IConsoleVerb* ipConsoleVerb = NULL;
    hResult = pComp->GetInterface( REQUEST_ICONSOLEVERB, (LONG_PTR*)&ipConsoleVerb );

    // DRAGDROP: Add MMC_VERB_CUT/COPY/PASTE for this object only
    hResult = ipConsoleVerb->SetVerbState( MMC_VERB_CUT,   ENABLED, TRUE );
    hResult = ipConsoleVerb->SetVerbState( MMC_VERB_COPY,  ENABLED, TRUE );
    hResult = ipConsoleVerb->SetVerbState( MMC_VERB_PASTE, ENABLED, TRUE );

    // Enable Rename as well
    hResult = ipConsoleVerb->SetVerbState( MMC_VERB_RENAME, ENABLED, TRUE );
  }

  //TRACE_HRESULT(_T("OnSelect"), hResult );
  return hResult;
}

HRESULT CFolderNode::OnSelect | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CFolderNode::OnSelect | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CFolderNode::OnShow | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 167 of file foldernode.cpp.

{
  HRESULT  hResult = S_FALSE;

  CComponent* pComp = reinterpret_cast<CComponent*>(pComponent);

  LPHEADERCTRL2  ipHeaderCtrl2 = NULL;
  hResult = pComp->GetInterface( REQUEST_IHEADERCTRL2, (LONG_PTR*)&ipHeaderCtrl2 );
  if( S_OK != hResult )
   return hResult;

  LPRESULTDATA  ipResultData = NULL;
  hResult = pComp->GetInterface( REQUEST_IRESULTDATA, (LONG_PTR*)&ipResultData );
  if( S_OK != hResult )
   return hResult;

  ipHeaderCtrl2->AddRef();
  ipResultData->AddRef();

  if( TRUE == nArg )  // Selecting a scope node
  {
    do
    {
      hResult = ipHeaderCtrl2->InsertColumn( 0, L"File Name", 0, 150 );
      BREAK_ON_ERROR( hResult );

      hResult = ipHeaderCtrl2->InsertColumn( 1, L"Attributes", 0, 150 );
      BREAK_ON_ERROR( hResult );

      hResult = ipResultData->ModifyViewStyle( MMC_NOSORTHEADER, (MMC_RESULT_VIEW_STYLE)NULL );
      BREAK_ON_ERROR( hResult );

    }while(0);
  }
  else // not handling deselect notifications
  {
  }

  ipHeaderCtrl2->Release();
  ipResultData->Release();

  TRACE_HRESULT(_T("OnShow"), hResult );
  return hResult;
}

HRESULT CFolderNode::OnShow | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CFolderNode::OnShow | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 345 of file foldernode.cpp.

{
  HRESULT  hResult = S_FALSE;

  CComponent* pComp = reinterpret_cast<CComponent*>(pComponent);

  LPHEADERCTRL2  ipHeaderCtrl = NULL;
  hResult = pComp->GetInterface( REQUEST_IHEADERCTRL, (LONG_PTR*)&ipHeaderCtrl );
  if( S_OK != hResult )
    return hResult;

  LPRESULTDATA  ipResultData = NULL;
  hResult = pComp->GetInterface( REQUEST_IRESULTDATA, (LONG_PTR*)&ipResultData );
  if( S_OK != hResult )
    return hResult;

  if( TRUE == nArg )         // Selecting a scope node
  {
    do
    {
      hResult = ipHeaderCtrl->InsertColumn( 0, L"File Name", 0, 150 );
      BREAK_ON_ERROR( hResult );

      hResult = ipHeaderCtrl->InsertColumn( 1, L"Attributes", 0, 150 );
      BREAK_ON_ERROR( hResult );

      hResult = ipResultData->ModifyViewStyle( MMC_NOSORTHEADER, (MMC_RESULT_VIEW_STYLE)NULL );
      BREAK_ON_ERROR( hResult );

      hResult = EnumerateResultItems( ipResultData );
      BREAK_ON_ERROR( hResult );

    }while(0);
  }
  else                       // Clean up result items on deselection
  {
    hResult = ipResultData->DeleteAllRsltItems();
  }

  //TRACE_HRESULT(_T("OnShow"), hResult );
  return hResult;
}

HRESULT CFolderNode::OnShow | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CFolderNode::OnShow | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CFolderNode::OnShow | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CFolderNode::OnViewChange | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Reimplemented from CBaseNode.

Definition at line 431 of file foldernode.cpp.

{
  HRESULT hResult = S_FALSE;
  LPRESULTDATA ipResultData = NULL;

  CComponent* pComp = reinterpret_cast<CComponent*>(pComponent);
  hResult = pComp->GetInterface( REQUEST_IRESULTDATA, (LONG_PTR*)&ipResultData );

  LONG_PTR pScopeCookie = pComp->GetScopeCookie();

  if( pScopeCookie == (LONG_PTR)this )
    hResult = EnumerateResultItems( ipResultData );

  //TRACE_HRESULT( _T("OnViewChange"), hResult );
  return hResult;
}

HRESULT CFolderNode::OnViewChange | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Reimplemented from CBaseNode.

HRESULT CFolderNode::OnViewChange | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Reimplemented from CBaseNode.

HRESULT CFolderNode::OnViewChange | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Reimplemented from CBaseNode.

HRESULT CFolderNode::OnViewChange | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Reimplemented from CBaseNode.

Definition at line 315 of file foldernode.cpp.

{
  HRESULT hResult = S_FALSE;
  LPRESULTDATA ipResultData = NULL;

  CComponent* pComp = reinterpret_cast<CComponent*>(pComponent);
  hResult = pComp->GetInterface( REQUEST_IRESULTDATA, (LONG_PTR*)&ipResultData );
  if( S_OK != hResult )
    return hResult;

  hResult = EnumerateResultItems( ipResultData );

  TRACE_HRESULT( _T("OnViewChange"), hResult );
  return hResult;
}

HRESULT CFolderNode::QueryForPropertyPage ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 52 of file foldernode.h.

            { return E_NOTIMPL; }

HRESULT CFolderNode::QueryForPropertyPage ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 52 of file foldernode.h.

            { return E_NOTIMPL; }

HRESULT CFolderNode::RefreshNodeList ( ) [private]

Definition at line 441 of file foldernode.cpp.

{
  NODE_PROPERTIES NodeProps;
  ZeroMemory( &NodeProps, sizeof(NODE_PROPERTIES) );
  NodeProps.pParentObject  = reinterpret_cast<LONG_PTR>(this);
  NodeProps.pComponentData = reinterpret_cast<LONG_PTR>(m_pCompData);
  NodeProps.dwAttributes   = 0;

  WCHAR  szNames[1][32];
  wcscpy( szNames[0], L"Virtual File 1" );

  RemoveNodes();             // Clean the node list

  CVirtualFile* pNode = NULL;
  for( DWORD i = 0; i < 1; i++ )
  {
    wcscpy( NodeProps.szNodeName, szNames[i] );
    pNode = new CVirtualFile;
    pNode->Initialize( &NodeProps );
    m_NodeList.AddTail( pNode );
  }

  return S_OK;
}

HRESULT CFolderNode::RefreshNodeList ( ) [private]
HRESULT CFolderNode::RefreshNodeList ( ) [private]
VOID CFolderNode::RemoveAttribute ( DWORD dwAttribute ) [inline, virtual]

Implements CBaseNode.

Definition at line 110 of file foldernode.h.

{}

VOID CFolderNode::RemoveChildNode ( LONG_PTR pChildNode )
VOID CFolderNode::RemoveChildNode ( LONG_PTR pChildNode )

Definition at line 682 of file foldernode.cpp.

{
  CVirtualFile* pNode  = NULL;
  CVirtualFile* pChild = reinterpret_cast<CVirtualFile*>(pChildNode);
  POSITION      NewPos = m_NodeList.GetHeadPosition();
  POSITION      OldPos = NULL;
  while( NewPos )
  {
    OldPos = NewPos;                   // Need to save this
    pNode = m_NodeList.GetNext( NewPos );
    if( pNode == pChild )
    {
      m_NodeList.RemoveAt( OldPos );
      continue;                        // Exit, found it
    }
  }
}

VOID CFolderNode::RemoveChildNodes ( ) [private]

Definition at line 436 of file foldernode.cpp.

{
  CVirtualFile* pNode = NULL;
  POSITION   Pos   = m_NodeList.GetHeadPosition();
  while( Pos )
  {
    pNode = m_NodeList.GetNext( Pos );
    delete pNode;
  }
  m_NodeList.RemoveAll();              // Clean the list
}

VOID CFolderNode::RemoveNodes ( ) [private]

Definition at line 727 of file foldernode.cpp.

{
  CVirtualFile* pNode = NULL;
  POSITION   Pos = m_NodeList.GetHeadPosition();
  while( Pos )
  {
    pNode = m_NodeList.GetNext( Pos );
    delete pNode;
  }
  m_NodeList.RemoveAll();              // Clean the list
}

VOID CFolderNode::RemoveNodes ( ) [private]
VOID CFolderNode::RemoveNodes ( ) [private]
VOID CFolderNode::RemoveNodes ( ) [private]
VOID CFolderNode::RemoveVirtualFile ( CVirtualFile * pDeadNode )
VOID CFolderNode::RemoveVirtualFile ( CVirtualFile * pDeadNode )
VOID CFolderNode::RemoveVirtualFile ( CVirtualFile * pDeadNode )

Definition at line 481 of file foldernode.cpp.

{
  CVirtualFile* pNode = NULL;
  POSITION     NewPos = m_NodeList.GetHeadPosition();
  POSITION     OldPos = NULL;
  while( NewPos )
  {
    OldPos = NewPos;                   // Need to save this
    pNode = m_NodeList.GetNext( NewPos );
    if( pNode == pDeadNode )
    {
      m_NodeList.RemoveAt( OldPos );
      continue;                        // Exit, found it
    }
  }
}

VOID CFolderNode::SetAttribute ( DWORD dwAttribute ) [inline, virtual]

Implements CBaseNode.

Definition at line 109 of file foldernode.h.

{}

Member Data Documentation

DWORD CFolderNode::m_dwAttributes [private]

Reimplemented from CBaseNode.

Definition at line 64 of file foldernode.h.

HWND CFolderNode::m_hAddVFileDlg

Definition at line 93 of file foldernode.h.

HWND CFolderNode::m_hMessageWnd [private]

Definition at line 89 of file foldernode.h.

CLListImpl< CVirtualFile *, CVirtualFile * > CFolderNode::m_NodeList [private]

Definition at line 87 of file foldernode.h.

CComponentData * CFolderNode::m_pCompData [private]

Definition at line 65 of file foldernode.h.

CDeviceNode * CFolderNode::m_pParentNode [private]

Definition at line 90 of file foldernode.h.

GUID CFolderNode::m_thisGUID = CLSID_CFolderNode [static, private]

Definition at line 85 of file foldernode.h.

static GUID CFolderNode::thisGUID = CLSID_CFolderNode [static, private]

Definition at line 63 of file foldernode.h.

The documentation for this class was generated from the following files:
  • SysMgmt/MMC/mmc2.0/contextmenu/foldernode.h
  • SysMgmt/MMC/mmc2.0/dragdrop/foldernode.h
  • SysMgmt/MMC/mmc2.0/help/foldernode.h
  • SysMgmt/MMC/mmc2.0/multisel/foldernode.h
  • SysMgmt/MMC/mmc2.0/proppage/foldernode.h
  • SysMgmt/MMC/mmc2.0/viewex/foldernode.h
  • SysMgmt/MMC/mmc2.0/contextmenu/foldernode.cpp
  • SysMgmt/MMC/mmc2.0/dragdrop/foldernode.cpp
  • SysMgmt/MMC/mmc2.0/help/foldernode.cpp
  • SysMgmt/MMC/mmc2.0/multisel/foldernode.cpp
  • SysMgmt/MMC/mmc2.0/proppage/foldernode.cpp
  • SysMgmt/MMC/mmc2.0/viewex/foldernode.cpp
Generated on Wed Nov 13 2024 16:56:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CFont Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CFont Class Reference

#include "Font.Hxx"

List of all members.

Public Member Functions

CFont (HFONT hfont)
CFont (TCHAR *szFace, int iHeight, BOOL fBold=FALSE, BOOL fItalic=FALSE, BOOL fUnder=FALSE)
~CFont ()
BOOL | Choose (HWND hwnd)
BOOL | Create (LOGFONT &lf)
operator HFONT () const
BOOL | Update (int iHeight, BOOL fBold=FALSE)

Protected Attributes

BOOL _fDel
HFONT | _hfont

Detailed Description

Definition at line 7 of file Font.Hxx.

Constructor & Destructor Documentation

CFont::CFont ( HFONT hfont )

Definition at line 16 of file Font.Cxx.

{
    _hfont = hfont;
    _fDel = FALSE;       // owned elsewhere
}

CFont::CFont | ( | TCHAR * | szFace,
 |  | int | iHeight,
 |  | BOOL | fBold = FALSE,
 |  | BOOL | fItalic = FALSE,
 |  | BOOL | fUnder = FALSE
 | ) |  |

Definition at line 22 of file Font.Cxx.

{
    LOGFONT lf;
    _fDel = FALSE;      // not initialized

    memset(&lf,0,sizeof (LOGFONT));
    // rude but effective: truncate
    if( lstrlen( szFace ) > (sizeof(lf.lfFaceName)/sizeof(TCHAR)) )
    {
        szFace[sizeof(lf.lfFaceName)/sizeof(TCHAR)] = TEXT('\0');
    }
    lstrcpyn(lf.lfFaceName, szFace, sizeof(lf.lfFaceName)/sizeof(TCHAR));

    lf.lfHeight = iHeight * 20;         // twips internal, points in API

    if( fBold )
    {
        lf.lfWeight = FW_BOLD;
    }
    lf.lfItalic = (BYTE)fItalic;
    lf.lfUnderline = (BYTE)fUnder;
    Create(lf);
}

CFont::~CFont ( )

Definition at line 61 of file Font.Cxx.

{
    if( _fDel )
    {
        DeleteObject(_hfont);
    }
}

Member Function Documentation

BOOL CFont::Choose ( HWND hwnd )

Definition at line 82 of file Font.Cxx.

{
    CHOOSEFONT cf ;
    LOGFONT lf ;

    GetObject(_hfont, sizeof(LOGFONT), &lf);

    // match from TWIPS to LOGPIXELS used in common Dialog
    CScreenCanvas canvas(NULL);
    lf.lfHeight = MulDiv(lf.lfHeight,GetDeviceCaps(canvas, LOGPIXELSY),INCH1);

    lf.lfCharSet = ANSI_CHARSET;

    cf.lStructSize      = sizeof (CHOOSEFONT) ;
    cf.hwndOwner        = hwnd ;
    cf.hDC              = NULL ;
    cf.lpLogFont        = &lf ;
    cf.iPointSize       = 0 ;
    cf.Flags            = CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS
                                                 | CF_EFFECTS ;
    cf.rgbColors        = 0L ;
    cf.lCustData        = 0L ;
    cf.lpfnHook         = NULL ;
    cf.lpTemplateName   = NULL ;
    cf.hInstance        = NULL ;
    cf.lpszStyle        = NULL ;
    cf.nFontType        = 0 ;               // Returned from ChooseFont
    cf.nSizeMin         = 0 ;
    cf.nSizeMax         = 0 ;

    if( !ChooseFont (&cf) )
    {
        return FALSE;
    }
//    MessageBox( hwnd, lf.lfFaceName, TEXT("Font Chosen"), MB_OK );

    // adjust back to using TWIPS
    lf.lfHeight = MulDiv(lf.lfHeight,INCH1,GetDeviceCaps(canvas, LOGPIXELSY));
    lf.lfWidth=0;               // font mapper knows best

    // create the font
    return Create(lf);
}

BOOL CFont::Create ( LOGFONT & lf )

Definition at line 46 of file Font.Cxx.

{
    if( _fDel )
    {
        DeleteObject(_hfont);
        _fDel = FALSE;
    }
    if( _hfont = CreateFontIndirect(&lf) )
    {
        _fDel = TRUE;
        return TRUE;
    }
    return FALSE;
}

CFont::operator HFONT ( ) const [inline]

Definition at line 16 of file Font.Hxx.

                { return _hfont; }

BOOL CFont::Update | ( | int | iHeight,
 |  | BOOL | fBold = FALSE
 | ) |  |

Definition at line 69 of file Font.Cxx.

{
    LOGFONT lf;
    GetObject(_hfont, sizeof(LOGFONT), &lf);
    lf.lfWeight = (fBold ? FW_BOLD : FW_NORMAL );

    lf.lfHeight = iHeight * 20;         // twips internal, points in API

    return Create(lf);
}

Member Data Documentation

BOOL CFont::_fDel [protected]

Definition at line 21 of file Font.Hxx.

HFONT CFont::_hfont [protected]

Definition at line 20 of file Font.Hxx.

The documentation for this class was generated from the following files:
  • Multimedia/Gdi/Fonts/GridFont/Font.Hxx
  • Multimedia/Gdi/Fonts/GridFont/Font.Cxx
Generated on Wed Nov 13 2024 16:56:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CFontRange Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes | Friends

CFontRange Class Reference

#include "Grid.Hxx"

List of all members.

Public Member Functions

~CFontRange ()
BOOL IsPageUsed (UINT nPage)
void | SetFontRange (HWND hwnd, HFONT hfont)

Private Member Functions

BOOL | CountUCSegments (HDC hdc)
void | SwapShort (PUSHORT p)
void | SwapULong (PULONG p)

Private Attributes

UINT | _fPageUsed [256]

Friends

class | CTextGrid

Detailed Description

Definition at line 247 of file Grid.Hxx.

Constructor & Destructor Documentation

CFontRange::~CFontRange ( )

Definition at line 858 of file Grid.Cxx.

{
    if (vStartCount != NULL)
        LocalFree (LocalHandle (vStartCount));
    if (vEndCount != NULL)
        LocalFree (LocalHandle (vEndCount));
}

Member Function Documentation

BOOL CFontRange::CountUCSegments ( HDC hdc ) [private]

Definition at line 872 of file Grid.Cxx.

{
#define CMAPHEX 0x70616d63 // = "cmap" (reversed)
#define NBYTES   256
#define OFFSETERROR 0
#define MBERROR TEXT("Application Error.")
#define MBERRORFLAGS MB_OK | MB_ICONHAND

typedef struct tagTABLE{
    USHORT platformID;
    USHORT encodingID;
    ULONG  offset;
} TABLE, *PTABLE;

typedef struct tagSUBTABLE{
    USHORT format;
    USHORT length;
    USHORT version;
    USHORT segCountX2;
    USHORT searchRange;
    USHORT entrySelector;
    USHORT rangeShift;
} SUBTABLE, *PSUBTABLE;

    DWORD       cbData;
    USHORT      aShort[2];
    DWORD       nBytes;
    USHORT      i, nTables;
    PTABLE      pTable;
    PSUBTABLE   pSubTable;
    ULONG       offset,offsetFormat4;
    BYTE        buffer[NBYTES];

    // find number of encoding tables, second long in cmap
    nBytes = GetFontData(hdc, CMAPHEX, 0, aShort, 4);
    if (nBytes == GDI_ERROR || nBytes == 0) //GDI error or no cmap table
        return FALSE;
    nTables = aShort[1];
    SwapShort (&nTables);

    // limit ourself to 32 encoding tables (largely enough)
    cbData = nTables * sizeof(TABLE);
    if (cbData >NBYTES)
      {
      MessageBox (NULL, TEXT("cbData >NBYTES"),MBERROR , MBERRORFLAGS);
      return FALSE;
      }

    // get array of encoding tables.
    // Check each one for PlatformId = 3, Encoding ID = 1.
    nBytes=GetFontData (hdc, CMAPHEX, 4, buffer, cbData);
    pTable = (PTABLE)buffer;
    offsetFormat4 = OFFSETERROR;
    for (i = 0; i< nTables; i++)
      {
        SwapShort (&(pTable->encodingID));
        SwapShort (&(pTable->platformID));
        if ((pTable->platformID == 3)&&(pTable->encodingID == 1))
            {
            offsetFormat4 = pTable->offset;
            SwapULong (&offsetFormat4);
            break;
            }
        pTable++;
        }
    if (offsetFormat4 == OFFSETERROR) //Can not find 3,1 subtable
        return FALSE;

    /* Get the beginning of the subtable, especially the segment count */
    nBytes=GetFontData (hdc, CMAPHEX, offsetFormat4, buffer, sizeof(SUBTABLE));
    pSubTable = (PSUBTABLE) buffer;
    SwapShort (&(pSubTable->format));
    SwapShort (&(pSubTable->segCountX2));
    if (pSubTable->format != 4)
        {
        MessageBox (NULL, TEXT("format !=4"), MBERROR, MBERRORFLAGS);
        return FALSE;
        }
    vSegCount = pSubTable->segCountX2 / 2;

    /* Now that we know how many segments that the font contains,
     *  free up the old memory, and realloc. the two global arrays.
     */
    if (vStartCount != NULL)
        LocalFree (LocalHandle (vStartCount));
    if (vEndCount != NULL)
        LocalFree (LocalHandle (vEndCount));
    vStartCount = (USHORT *)LocalAlloc (LPTR, vSegCount * sizeof(USHORT));
    vEndCount = (USHORT *)LocalAlloc (LPTR, vSegCount * sizeof(USHORT));
    if ((vStartCount == NULL) || (vEndCount == NULL))
        {
        MessageBox (NULL, TEXT("LocalAlloc failed"), MBERROR, MBERRORFLAGS);
        return FALSE;
        }

    /* read in the array of endCount values */
    offset = offsetFormat4
           + (7 * sizeof (USHORT));  /* skip constant # bytes in subtable */
    cbData = vSegCount * sizeof (USHORT);
    nBytes=GetFontData (hdc, CMAPHEX, offset, vEndCount, cbData );
    for (i = 0; i<vSegCount; i++)
        SwapShort (& (vEndCount[i]));

    /* read in the array of startCount values */
    offset = offsetFormat4
           + (7 * sizeof (USHORT))   /* skip constant # bytes in subtable */
           + (vSegCount * sizeof (USHORT)) /* skip endCount array */
           + sizeof (USHORT);             /* skip reservedPad */
    cbData = vSegCount * sizeof (USHORT);
    nBytes=GetFontData (hdc, CMAPHEX, offset, vStartCount, cbData );
    for (i = 0; i<vSegCount; i++)
        SwapShort (& (vStartCount[i]));

    return TRUE;
}

BOOL CFontRange::IsPageUsed ( UINT nPage ) [inline]

Definition at line 253 of file Grid.Hxx.

{ return _fPageUsed[nPage]; };

void CFontRange::SetFontRange | ( | HWND | hwnd,
 |  | HFONT | hfont
 | ) |  |

Definition at line 839 of file Grid.Cxx.

{
    CScreenCanvas scanvas(hwnd);     // provide the DC
    CFontSelect fs(scanvas, hfont);

    USHORT   i;

    for (i=0;i<256;i++)
        _fPageUsed[i]=FALSE;         // assume no page used
#ifdef UNICODE
    if (CountUCSegments(scanvas))    // set page used flag for relevant pages
        for (i=0;i<vSegCount;i++) _fPageUsed[(vStartCount[i] & 0xFF00) >> 8] = TRUE;
    else                             // if the font is not TrueType, set only the 1st page
        _fPageUsed[0] =TRUE;
#else
    _fPageUsed[0] =TRUE;
#endif
}

void CFontRange::SwapShort ( PUSHORT p ) [private]

Definition at line 989 of file Grid.Cxx.

{
SHORT temp;

    temp =(SHORT)( HIBYTE (*p) + (LOBYTE(*p) << 8));
    *p = temp;
}

void CFontRange::SwapULong ( PULONG p ) [private]

Definition at line 999 of file Grid.Cxx.

{
ULONG temp;

    temp = (LONG) ((BYTE) *p);
    temp <<= 8;
    *p >>=8;

    temp += (LONG) ((BYTE) *p);
    temp <<= 8;
    *p >>=8;

    temp += (LONG) ((BYTE) *p);
    temp <<= 8;
    *p >>=8;

    temp += (LONG) ((BYTE) *p);
    *p = temp;
}

Friends And Related Function Documentation

friend class CTextGrid [friend]

Definition at line 249 of file Grid.Hxx.

Member Data Documentation

UINT CFontRange::_fPageUsed[256] [private]

Definition at line 260 of file Grid.Hxx.

The documentation for this class was generated from the following files:
  • Multimedia/Gdi/Fonts/GridFont/Grid.Hxx
  • Multimedia/Gdi/Fonts/GridFont/Grid.Cxx
Generated on Wed Nov 13 2024 16:56:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CFontSelect Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CFontSelect Class Reference

#include "Font.Hxx"

List of all members.

Public Member Functions

CFontSelect (CCanvas &canvas, HFONT hfont)
~CFontSelect ()

Protected Attributes

CCanvas & _canvas
HFONT _hfontOld

Detailed Description

Definition at line 25 of file Font.Hxx.

Constructor & Destructor Documentation

CFontSelect::CFontSelect | ( | CCanvas & | canvas,
 |  | HFONT | hfont |
 | ) |  |  | [inline]

Definition at line 28 of file Font.Hxx.

                                                  :
            _canvas(canvas)
        {
            _hfontOld = SelectFont(_canvas, hfont);
        };

CFontSelect::~CFontSelect ( ) [inline]

Definition at line 34 of file Font.Hxx.

        {
            // Make sure font is not selected, so it can be deleted
            SelectFont(_canvas, _hfontOld);
        }

Member Data Documentation

CCanvas& CFontSelect::_canvas [protected]

Definition at line 41 of file Font.Hxx.

HFONT CFontSelect::_hfontOld [protected]

Definition at line 40 of file Font.Hxx.

The documentation for this class was generated from the following file:
  • Multimedia/Gdi/Fonts/GridFont/Font.Hxx
Generated on Wed Nov 13 2024 16:56:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CFontSet Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CFontSet Class Reference

#include "Cset.Hxx"

Inherits CSet.

List of all members.

Public Member Functions

CFontSet (HWND hwnd, HFONT hfont)

Detailed Description

Definition at line 65 of file Cset.Hxx.

Constructor & Destructor Documentation

CFontSet::CFontSet | ( | HWND | hwnd,
 |  | HFONT | hfont
 | ) |  |
The documentation for this class was generated from the following file:
  • Multimedia/Gdi/Fonts/GridFont/Cset.Hxx
Generated on Wed Nov 13 2024 16:56:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CFrame Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Protected Attributes | Friends

CFrame Class Reference

#include "Framer.h"

List of all members.

Public Member Functions

CFrame (HINSTANCE, HINSTANCE, LPSTR, int)
~CFrame (void)
HACCEL | Accelerators (void)
void | Close ()
STDMETHODIMP | ContextSensitiveHelp (BOOL)
STDMETHODIMP | EnableModeless (BOOL)
STDMETHODIMP | Exec (const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANTARG *pvaIn, VARIANTARG *pvaOut)
STDMETHODIMP | GetBorder (LPRECT)
STDMETHODIMP | GetWindow (HWND *)
BOOL | Init (UINT, int, int, int, int)
STDMETHODIMP | InsertMenus (HMENU, LPOLEMENUGROUPWIDTHS)
HINSTANCE | Instance (void)
WPARAM | MessageLoop (void)
STDMETHODIMP | QueryInterface (REFIID, void **)
STDMETHODIMP | QueryStatus (const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
STDMETHODIMP | RemoveMenus (HMENU)
STDMETHODIMP | RequestBorderSpace (LPCBORDERWIDTHS)
STDMETHODIMP | SetActiveObject (LPOLEINPLACEACTIVEOBJECT, LPCOLESTR)
STDMETHODIMP | SetBorderSpace (LPCBORDERWIDTHS)
STDMETHODIMP | SetMenu (HMENU, HOLEMENU, HWND)
STDMETHODIMP | SetStatusText (LPCOLESTR)
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP | TranslateAccelerator (LPMSG, WORD)
HWND | Window (void)

Protected Member Functions

BOOL CreateObject (LPTSTR)
LRESULT | OnCommand (HWND, WPARAM, LPARAM)
BOOL OpenDialog (LPTSTR, UINT)
BOOL | RegisterAllClasses (void)
void | ResizeClientWindow (UINT, UINT, UINT, UINT)

Protected Attributes

BORDERWIDTHS | m_bwIP
ULONG m_cRef
DWORD m_dwIDCounter
BOOL m_fHaveObject
BOOL m_fInContextHelp
BOOL m_fInitialized
BOOL m_fInObjectHelp
BOOL m_fOurMenuShowing
BOOL m_fUsingOurHelp
HACCEL | m_hAccel
HINSTANCE | m_hInst
HINSTANCE | m_hInstPrev
HMENU | m_hMenuHelp
HMENU | m_hMenuOrg
HMENU | m_hMenuTop
HWND | m_hWnd
HWND | m_hWndClient
HWND | m_hWndObj
int | m_nCmdShow
HMENU * | m_phMenu
IOleInPlaceActiveObject * | m_pIOleIPActiveObject
IStorage * | m_pIStorage
class CSite * | m_pSite
LPTSTR m_pszCmdLine

Friends

LRESULT APIENTRY | ClientWndProc (HWND, UINT, WPARAM, LPARAM)
LRESULT APIENTRY | FrameWndProc (HWND, UINT, WPARAM, LPARAM)

Detailed Description

Definition at line 96 of file Framer.h.

Constructor & Destructor Documentation

CFrame::CFrame | ( | HINSTANCE | hInst,
 |  | HINSTANCE | hInstPrev,
 |  | LPSTR | pszCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 75 of file Framer.Cpp.

    {
  UNREFERENCED_PARAMETER(pszCmdLine);
    m_hInst=hInst;
    m_hWnd=NULL;
    m_hInstPrev=hInstPrev;
    m_nCmdShow=nCmdShow;

    m_phMenu=NULL;
    m_hAccel=NULL;
    m_hWndClient=NULL;

    m_fInitialized=FALSE;
    m_pIStorage=NULL;
    m_dwIDCounter=0;

    m_hMenuOrg=NULL;
    m_hMenuTop=NULL;
  m_hMenuHelp=NULL;
  m_fInObjectHelp=FALSE;
  m_fUsingOurHelp=FALSE;

    m_fHaveObject=FALSE;
  m_hWndObj=NULL;

    m_pSite=NULL;
    m_fOurMenuShowing=TRUE;
    SetRect(&m_bwIP, 0, 0, 0, 0);
    m_fInContextHelp=FALSE;
    m_pIOleIPActiveObject=NULL;

    return;
    }

CFrame::~CFrame ( void )

Definition at line 112 of file Framer.Cpp.

    {
    if (NULL!=m_hWndClient)
        DestroyWindow(m_hWndClient);

    //Frees the temp file.
    ReleaseInterface(m_pIStorage);

    //m_pSite cleaned up in Close

    //Accelerators freed automatically.

  //Destroy the special help menu
  if (NULL!=m_hMenuHelp)
    DestroyMenu(m_hMenuHelp);

    //Free the menu handle array
    if (NULL!=m_phMenu)
        delete []((UINT *)m_phMenu);

    if (m_fInitialized)
        OleUninitialize();

    return;
    }

Member Function Documentation

HACCEL CFrame::Accelerators ( void ) [inline]

Definition at line 154 of file Framer.h.

          { return m_hAccel; }

void CFrame::Close ( void )

Definition at line 476 of file Framer.Cpp.

    {
  RECT  rc;

    if (NULL!=m_pSite)
        {
    CSite *pSite=m_pSite;        //Prevents reentry
    m_pSite=NULL;

        pSite->Close(FALSE);         //Frees the object
        pSite->Destroy(m_pIStorage); //Cleans up the storage
        pSite->Release();            //Frees the site
        }

  m_fHaveObject=FALSE;
    SetRect(&m_bwIP, 0, 0, 0, 0);

  GetClientRect(m_hWnd, &rc);
  ResizeClientWindow(rc.left, rc.top, rc.right-rc.left
    , rc.bottom-rc.top);

  //Force repaint to remove "have object" message
  InvalidateRect(m_hWndClient, NULL, TRUE);
  UpdateWindow(m_hWndClient);

    return;
    }

STDMETHODIMP CFrame::ContextSensitiveHelp ( BOOL fEnterMode )

Definition at line 931 of file Framer.Cpp.

    {
    /*
     * Don't bother if there is no active object since we don't do
     * context help on our own.
     */
    if (NULL==m_pIOleIPActiveObject)
        return NOERROR;

    //If the state changes, notify the active object.
    if (m_fInContextHelp!=fEnterMode)
        {
        m_fInContextHelp=fEnterMode;
        m_pIOleIPActiveObject->ContextSensitiveHelp(fEnterMode);
        }

    return NOERROR;
    }

BOOL CFrame::CreateObject ( LPTSTR pszFile ) [protected]

Definition at line 432 of file Framer.Cpp.

    {
    m_pSite=new CSite(++m_dwIDCounter, m_hWndClient, this);

    if (NULL==m_pSite)
        return FALSE;

    m_pSite->AddRef();  //So we can free with Release

    /*
     * Now tell the site to create an object in it using the filename
     * and the storage we opened.  The site will create a sub-storage
     * for the doc object's use.
     */
    if (!m_pSite->Create(pszFile, m_pIStorage))
        return FALSE;

    m_fHaveObject=TRUE;

    //We created the thing, now activate it with "Show"
    m_pSite->Activate(OLEIVERB_SHOW);

  //Force repaint to show "have object" message
  InvalidateRect(m_hWndClient, NULL, TRUE);
  UpdateWindow(m_hWndClient);
    return TRUE;
    }

STDMETHODIMP CFrame::EnableModeless ( BOOL fEnable )

Definition at line 1331 of file Framer.Cpp.

    {
  UNREFERENCED_PARAMETER(fEnable);
    return NOERROR;
    }

STDMETHODIMP CFrame::Exec | ( | const GUID * | pguidCmdGroup,
 |  | DWORD | nCmdID,
 |  | DWORD | nCmdexecopt,
 |  | VARIANTARG * | pvaIn,
 |  | VARIANTARG * | pvaOut
 | ) |  |

Definition at line 1396 of file Framer.Cpp.

  {
  UNREFERENCED_PARAMETER(pguidCmdGroup);
  UNREFERENCED_PARAMETER(nCmdID);
  UNREFERENCED_PARAMETER(nCmdexecopt);
  UNREFERENCED_PARAMETER(pvaIn);
  UNREFERENCED_PARAMETER(pvaOut);
  return OLECMDERR_E_UNKNOWNGROUP;
  }

STDMETHODIMP CFrame::GetBorder ( LPRECT prcBorder )

Definition at line 968 of file Framer.Cpp.

    {
    if (NULL==prcBorder)
        return E_INVALIDARG;

    //We return all the client area space
    GetClientRect(m_hWnd, prcBorder);
    return NOERROR;
    }

STDMETHODIMP CFrame::GetWindow ( HWND * phWnd )

Definition at line 908 of file Framer.Cpp.

    {
    *phWnd=m_hWnd;
    return NOERROR;
    }

BOOL CFrame::Init | ( | UINT | cMenus,
 |  | int | x,
 |  | int | y,
 |  | int | cx,
 |  | int | cy
 | ) |  |

Definition at line 157 of file Framer.Cpp.

    {
    HMENU               hMenu;
    UINT                uTemp;
    RECT                rc;

    //1.  Initialize OLE
    if (SUCCEEDED(OleInitialize(NULL)))
        m_fInitialized=TRUE;
    else
        return FALSE;

    //2.  Register window classes
    if (NULL==m_hInstPrev)
        {
        if (!RegisterAllClasses())
            return FALSE;
        }

    //3.  Create the main window and client-area window
    m_hWnd=CreateWindow(SZCLASSFRAME, TEXT("DocObject Framer")
        , WS_MINIMIZEBOX | WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN
        , x, y, cx, cy, NULL, NULL, m_hInst, this);

    if (NULL==m_hWnd)
        return FALSE;

    GetClientRect(m_hWnd, &rc);

    m_hWndClient=CreateWindow(SZCLASSCLIENT, SZCLASSCLIENT
        , WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | WS_CLIPSIBLINGS
        , rc.left, rc.top, rc.right-rc.left
        , rc.bottom-rc.top, m_hWnd, NULL, m_hInst, this);

    if (NULL==m_hWndClient)
        return FALSE;

    //4. Allocate menu array for use with in-place menu merging.
    m_phMenu=new HMENU[cMenus];
    hMenu=GetMenu(m_hWnd);
    m_hMenuOrg=hMenu;

    for (uTemp=0; uTemp < cMenus; uTemp++)
        m_phMenu[uTemp]=GetSubMenu(hMenu, uTemp);

  //Also load the special help menu
  m_hMenuHelp=LoadMenu(m_hInst
    , MAKEINTRESOURCE(IDR_MENUHELP));

    //5.  Load accelerators
    m_hAccel=LoadAccelerators(m_hInst
        , MAKEINTRESOURCE(IDR_ACCELERATORS));

    if (NULL==m_hAccel)
        return FALSE;

    //6.  Make us all visible.
    ShowWindow(m_hWnd, m_nCmdShow);
    UpdateWindow(m_hWnd);

    /*
     * 7.  Create a temp file for all embedded files.  Note that in this
     *     sample we don't save any changes to DocObjects because we
   *     don't manage any storage directly.
   */
    if (FAILED(StgCreateDocfile(NULL, STGM_TRANSACTED | STGM_READWRITE
        | STGM_SHARE_EXCLUSIVE | STGM_CREATE| STGM_DELETEONRELEASE
        , 0, &m_pIStorage)))
        return FALSE;

    return TRUE;
    }

STDMETHODIMP CFrame::InsertMenus | ( | HMENU | hMenu,
 |  | LPOLEMENUGROUPWIDTHS | pMGW
 | ) |  |

Definition at line 1123 of file Framer.Cpp.

    {
  //Copy our File menu into the shared menu.
    InsertMenu(hMenu, 0, MF_BYPOSITION | MF_POPUP, (UINT_PTR)m_phMenu[0]
        , TEXT("&File"));

    pMGW->width[0]=1;
    pMGW->width[2]=0;
    pMGW->width[4]=0;

  /*
   * Add the special help menu which is the first item in
   * the m_hMenuHelp popup that's sitting around.
   */
  InsertMenu(hMenu, 1, MF_BYPOSITION | MF_POPUP
      , (UINT_PTR)m_hMenuHelp, TEXT("&Help"));

  //Tell the object we added our Help menu
  pMGW->width[5]=1;
    return NOERROR;
    }

HINSTANCE CFrame::Instance ( void ) [inline]

Definition at line 148 of file Framer.h.

          { return m_hInst; }

WPARAM CFrame::MessageLoop ( void )

Definition at line 543 of file Framer.Cpp.

    {
    MSG     msg;

    while (GetMessage(&msg, NULL, 0,0 ))
        {
        //Always give the object first crack at translation.
        if (NULL!=m_pIOleIPActiveObject)
            {
            HRESULT     hr;

            hr=m_pIOleIPActiveObject->TranslateAccelerator(&msg);

            //If the object translated the accelerator, we're done
            if (NOERROR==hr)
                continue;
            }

        if (!::TranslateAccelerator(m_hWnd, m_hAccel, &msg))
            {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
            }
        }

    return msg.wParam;
    }

LRESULT CFrame::OnCommand | ( | HWND | hWnd,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected]

Definition at line 305 of file Framer.Cpp.

    {
    TCHAR           szFile[MAX_PATH];
    BOOL            fOK;
    PCHourglass     pHour;
    WORD            wID=LOWORD(wParam);

    switch (wID)
        {
        case IDM_FILEOPEN:
            /*
             * This will be disabled if we already have an object.
             * User must File/Close first to get back here.
             *
             * Otherwise open the File/Open dialog
             */
            szFile[0]=0;
            if (!OpenDialog(szFile, MAX_PATH))
                return 0L;

            pHour=new CHourglass;
            fOK=CreateObject(szFile);
            delete pHour;
            return 0;

        case IDM_FILECLOSE:
            Close();
            break;

        case IDM_FILEEXIT:
            PostMessage(hWnd, WM_CLOSE, 0, 0L);
            break;

        case IDM_HELPABOUT:
            DialogBox(m_hInst, MAKEINTRESOURCE(IDD_ABOUT)
                , m_hWnd, (DLGPROC)AboutProc);
            break;

        case IDM_ENTERCONTEXTHELP:
        case IDM_ESCAPECONTEXTHELP:
            //Notify the object on entry and exit.
            ContextSensitiveHelp(IDM_ENTERCONTEXTHELP==wID);
            break;

        default:
           return DefWindowProc(hWnd, WM_COMMAND, wParam, lParam);

        }

    return 0L;
    }

BOOL CFrame::OpenDialog | ( | LPTSTR | pszFile,
 |  | UINT | cchFile |
 | ) |  |  | [protected]

Definition at line 382 of file Framer.Cpp.

    {
    OPENFILENAME        ofn;
    static TCHAR        szFilter[80]=TEXT("All Files (*.*)\0*.*\0\0");
    BOOL                fRet;
   #ifdef DEBUG
    DWORD               dwErr;
   #endif

    if (NULL==pszFile)
        return FALSE;

    memset(&ofn, 0, sizeof(OPENFILENAME));
    ofn.lStructSize      =sizeof(OPENFILENAME);
    ofn.hwndOwner        =m_hWnd;

    ofn.lpstrFilter      =szFilter;
    ofn.nFilterIndex     =1L;

    ofn.lpstrTitle       =NULL;
    ofn.lpstrFile        =pszFile;
    ofn.nMaxFile         =cchFile;

    ofn.lpstrDefExt      =TEXT("*");
    ofn.Flags            =OFN_HIDEREADONLY | OFN_FILEMUSTEXIST;

    fRet=GetOpenFileName(&ofn);

   #ifdef DEBUG
    dwErr=CommDlgExtendedError();
   #endif
    return fRet;
    }

STDMETHODIMP CFrame::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppv
 | ) |  |

Definition at line 851 of file Framer.Cpp.

    {
    /*
     * We only know IOleInPlaceFrame and its base interfaces as well
     * as a bogus IOleCommandTarget to make PowerPoint happy.
   */
    *ppv=NULL;

    if (IID_IUnknown==riid || IID_IOleInPlaceUIWindow==riid
        || IID_IOleWindow==riid || IID_IOleInPlaceFrame==riid)
        *ppv=(IOleInPlaceFrame *)this;

  if (IID_IOleCommandTarget==riid)
        *ppv=(IOleCommandTarget *)this;

    if (NULL!=*ppv)
        {
        ((LPUNKNOWN)*ppv)->AddRef();
        return NOERROR;
        }

    return E_NOINTERFACE;
    }

STDMETHODIMP CFrame::QueryStatus | ( | const GUID * | pguidCmdGroup,
 |  | ULONG | cCmds,
 |  | OLECMD | prgCmds[],
 |  | OLECMDTEXT * | pCmdText
 | ) |  |
BOOL CFrame::RegisterAllClasses ( void ) [protected]

Definition at line 248 of file Framer.Cpp.

    {
    WNDCLASS        wc;

    //Field that are the same for all windows.
    wc.style         = CS_HREDRAW | CS_VREDRAW;
    wc.hInstance     = m_hInst;
    wc.cbClsExtra    = 0;

    //Register the Frame window
    wc.lpfnWndProc   = FrameWndProc;
    wc.cbWndExtra    = CBFRAMEWNDEXTRA;
    wc.hIcon         = LoadIcon(m_hInst, TEXT("Icon"));
    wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = NULL;
    wc.lpszMenuName  = MAKEINTRESOURCE(IDR_MENU);
    wc.lpszClassName = SZCLASSFRAME;

    if (!RegisterClass(&wc))
        return FALSE;

    //Register the do-nothing Client window
    wc.lpfnWndProc   = ClientWndProc;
    wc.cbWndExtra    = CBCLIENTWNDEXTRA;
    wc.hIcon         = NULL;
    wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
    wc.lpszMenuName  = NULL;
    wc.lpszClassName = SZCLASSCLIENT;

    if (!RegisterClass(&wc))
        return FALSE;

    return TRUE;
    }

STDMETHODIMP CFrame::RemoveMenus ( HMENU hMenu )

Definition at line 1245 of file Framer.Cpp.

    {
    int         cItems, i, j;
    HMENU       hMenuT;

  /*
     * To be defensive, loop through this menu removing anything
     * we recognize (that is, anything in m_phMenu) just in case
     * the server didn't clean it up right.  At least we can
     * give ourselves the prophylactic benefit.
     */

    if (NULL==hMenu)
        return NOERROR;

    cItems=GetMenuItemCount(hMenu);

    /*
     * Walk backwards down the menu.  For each popup, see if it
     * matches any other popup we know about, and if so, remove
     * it from the shared menu.
     */
    for (i=cItems; i >=0; i--)
        {
        hMenuT=GetSubMenu(hMenu, i);

        for (j=0; j <= CMENUS; j++)
            {
      //Remove any owned popup, or our special help menu
            if (hMenuT==m_phMenu[j]
                || (hMenuT==m_hMenuHelp && m_hMenuHelp!=NULL))
                RemoveMenu(hMenu, i, MF_BYPOSITION);
            }
        }

  m_fUsingOurHelp=FALSE;

    //The menu should now be empty.
    return NOERROR;
    }

STDMETHODIMP CFrame::RequestBorderSpace ( LPCBORDERWIDTHS pBW )

Definition at line 999 of file Framer.Cpp.

    {
  UNREFERENCED_PARAMETER(pBW);
    //Framer has no border space restrictions
    return NOERROR;
    }

void CFrame::ResizeClientWindow | ( | UINT | x,
 |  | UINT | y,
 |  | UINT | cx,
 |  | UINT | cy |
 | ) |  |  | [protected]

Definition at line 519 of file Framer.Cpp.

  {
  SetWindowPos(m_hWndClient, NULL, x, y, cx, cy
        , SWP_NOZORDER | SWP_NOACTIVATE);

    //Tell the site to tell the object.
  if (NULL!=m_pSite)
      m_pSite->UpdateObjectRects();

  return;
  }

STDMETHODIMP CFrame::SetActiveObject | ( | LPOLEINPLACEACTIVEOBJECT | pIIPActiveObj,
 |  | LPCOLESTR | pszObj
 | ) |  |

Definition at line 1086 of file Framer.Cpp.

    {
  UNREFERENCED_PARAMETER(pszObj);
    if (NULL!=m_pIOleIPActiveObject)
        m_pIOleIPActiveObject->Release();

    //NULLs m_pIOleIPActiveObject if pIIPActiveObj is NULL
    m_pIOleIPActiveObject=pIIPActiveObj;

    if (NULL!=m_pIOleIPActiveObject)
        m_pIOleIPActiveObject->AddRef();

  m_pIOleIPActiveObject->GetWindow(&m_hWndObj);
    return NOERROR;
    }

STDMETHODIMP CFrame::SetBorderSpace ( LPCBORDERWIDTHS pBW )

Definition at line 1027 of file Framer.Cpp.

    {
    RECT            rc;

    /*
     * Since we have no tools, we can accept anything the object sends
     * and must therefore adjust the client-area window accordingly.
     */

    /*
     * If pBW is NULL, the object is not interested in tools, so we
     * don't have to do anything.  In either case we need to save
     * the toolspace allocations in order to resize the client window
     * correctly.
     */
    if (NULL==pBW)
        {
        if (!m_fOurMenuShowing)
            SetMenu(NULL, NULL, NULL);

        SetRect(&m_bwIP, 0, 0, 0, 0);
        GetClientRect( m_hWnd, &rc );
        }
    else
        {
        GetClientRect(m_hWnd, &rc);
        rc.left  +=pBW->left;
        rc.right -=pBW->right;
        rc.top   +=pBW->top;
        rc.bottom-=pBW->bottom;

        m_bwIP=*pBW;
        }

  ResizeClientWindow(rc.left, rc.top, rc.right-rc.left
    , rc.bottom-rc.top);

    return NOERROR;
    }

STDMETHODIMP CFrame::SetMenu | ( | HMENU | hMenu,
 |  | HOLEMENU | hOLEMenu,
 |  | HWND | hWndObj
 | ) |  |

Definition at line 1167 of file Framer.Cpp.

    {
    HRESULT         hr;

    /*
     * Our responsibilities here are to put the menu on the frame
     * window and call OleSetMenuDescriptor.
     */

    if (NULL==hMenu)
        {
        //Prevent redundant calls, or debug warnings on startup.
        if (NULL==m_hMenuTop)
            return NOERROR;

        hMenu=m_hMenuTop;
        m_hMenuTop=NULL;
        m_fOurMenuShowing=TRUE;
        }
    else
        {
        m_hMenuTop=m_hMenuOrg;
        m_fOurMenuShowing=FALSE;

    /*
     * Check if our Help menu has anything added to it.  If so, then
     * remember to forward menu messages.  If not, remove the Help
     * menu altogether (destroying it after removing our normal Help
     * popup, as we also do in RemoveMenus.
     */
    if (CHELPITEMS!=GetMenuItemCount(m_hMenuHelp))
      m_fUsingOurHelp=TRUE;
    else
      {
      UINT  i, cItems;

      cItems=GetMenuItemCount(hMenu);

      //Find m_hMenuHelp in the menu and remove it.
      for (i=0; i < cItems; i++)
        {
        if (GetSubMenu(hMenu, i)==m_hMenuHelp)
          {
          RemoveMenu(hMenu, i, MF_BYPOSITION);
          break;
          }
        }
      }
        }

    if (NULL!=hMenu)
        ::SetMenu(m_hWnd, hMenu);

    DrawMenuBar(m_hWnd);

    hr=OleSetMenuDescriptor(hOLEMenu, m_hWnd, hWndObj, NULL, NULL);
    return hr;
    }

STDMETHODIMP CFrame::SetStatusText ( LPCOLESTR pszText )

Definition at line 1307 of file Framer.Cpp.

    {
  UNREFERENCED_PARAMETER(pszText);
    //We have no status line...
    return E_NOTIMPL;
    }

CFrame::STDMETHODIMP_ ( ULONG )
CFrame::STDMETHODIMP_ ( ULONG )
STDMETHODIMP CFrame::TranslateAccelerator | ( | LPMSG | pMSG,
 |  | WORD | wID
 | ) |  |

Definition at line 1360 of file Framer.Cpp.

    {
  UNREFERENCED_PARAMETER(pMSG);
    /*
     * wID already has anything translated from m_hAccel for us,
     * so we can just check for the commands we want and process
     * them instead of calling TranslateAccelerator which would be
     * redundant and which also has a possibility of dispatching to
     * the wrong window.
     */
    if (IDM_ENTERCONTEXTHELP==wID || IDM_ESCAPECONTEXTHELP==wID)
        {
        //wID properly expands to 32-bits
        OnCommand(m_hWnd, (WPARAM)wID, 0L);
        return NOERROR;
        }

    return S_FALSE;
    }

HWND CFrame::Window ( void ) [inline]

Definition at line 151 of file Framer.h.

          { return m_hWnd; }

Friends And Related Function Documentation

LRESULT APIENTRY ClientWndProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |  |
 | ) |  |  | [friend]

Definition at line 756 of file Framer.Cpp.

    {
    PCFrame         pFR;
  PAINTSTRUCT   ps;

    pFR=(PCFrame)GetWindowLongPtr(hWnd, CLIENTWL_STRUCTURE);

    switch (iMsg)
        {
        case WM_NCCREATE:
            pFR=(PCFrame)((LPCREATESTRUCT)lParam)->lpCreateParams;

            SetWindowLongPtr(hWnd, CLIENTWL_STRUCTURE, (LONG_PTR)pFR);
            return DefWindowProc(hWnd, iMsg, wParam, lParam);

        case WM_PAINT:
      BeginPaint(hWnd, &ps);

      if (pFR->m_fHaveObject)
        {
        static TCHAR szMsg[]={TEXT("A non-DocObject is open or loaded. Use File/Close to destroy it.")};

        SetBkColor(ps.hdc, GetSysColor(COLOR_WINDOW));
        TextOut(ps.hdc, 0, 0, szMsg, lstrlen(szMsg));
        }

      EndPaint(hWnd, &ps);
            break;

        default:
            return DefWindowProc(hWnd, iMsg, wParam, lParam);
        }

    return 0L;
    }

LRESULT APIENTRY FrameWndProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |  |
 | ) |  |  | [friend]

CFrame encapsulates a main application window.

Definition at line 582 of file Framer.Cpp.

    {
    PCFrame         pFR;
    RECT            rc;
    HMENU           hMenu;

    pFR=(PCFrame)GetWindowLongPtr(hWnd, FRAMEWL_STRUCTURE);

    switch (iMsg)
        {
        case WM_NCCREATE:
            pFR=(PCFrame)((LPCREATESTRUCT)lParam)->lpCreateParams;

            SetWindowLongPtr(hWnd, FRAMEWL_STRUCTURE, (LONG_PTR)pFR);
            return DefWindowProc(hWnd, iMsg, wParam, lParam);

        case WM_DESTROY:
            PostQuitMessage(0);
            break;

        case WM_CLOSE:
            pFR->Close();
            DestroyWindow(hWnd);
            break;

        case WM_ERASEBKGND:
            //Client area window always manages painting
            return FALSE;

        case WM_SIZE:
            //Tell the in-place object about the new frame size
            GetClientRect(hWnd, &rc);

            if (NULL!=pFR->m_pIOleIPActiveObject)
                pFR->m_pIOleIPActiveObject->ResizeBorder(&rc, pFR, TRUE);

            /*
             * Resize the client, which is done in all cases since this window
       * is the parent of the DocObject, plus we need to tell the
       * DocObject of the new size through IOleDocumentView::SetRect.
       */
            rc.left  +=pFR->m_bwIP.left;
            rc.right -=pFR->m_bwIP.right;
            rc.top   +=pFR->m_bwIP.top;
            rc.bottom-=pFR->m_bwIP.bottom;

      pFR->ResizeClientWindow(rc.left, rc.top, rc.right-rc.left
        , rc.bottom-rc.top);

            break;

        case WM_SETFOCUS:
            if (NULL!=pFR->m_pIOleIPActiveObject)
                {
                HWND    hWndObj;

                pFR->m_pIOleIPActiveObject->GetWindow(&hWndObj);
                SetFocus(hWndObj);
                }

            return TRUE;

    case WM_INITMENU:
      pFR->m_fInObjectHelp=FALSE;
      break;

    case WM_MENUSELECT:
        {
        UINT fuFlags=(UINT)HIWORD(wParam);
        UINT uItem=(UINT)LOWORD(wParam);

        if (MF_POPUP & fuFlags)
          {
          /*
           * If we're inside our m_hMenuHelp, and uItem is
           * not zero (first item on the menu, which is ours),
           * then we must be in an object-supplied menu.
           *
           * Therefore we set our flag and forward the message
           * as well as others that occur later.  Otherwise we
           * clear the flag so we get messages again.
           */
          if (NULL!=pFR->m_hMenuHelp
            && (HMENU)lParam==pFR->m_hMenuHelp)
            {
            pFR->m_fInObjectHelp=(0!=uItem);

            if (pFR->m_fInObjectHelp)
              SendMessage(pFR->m_hWndObj, iMsg, wParam, lParam);
            }
          }
        else
          {
          //Forward the message on
          if (pFR->m_fInObjectHelp)
            {
            SendMessage(pFR->m_hWndObj, iMsg, wParam, lParam);
            break;
            }
          }
        }
      break;

    case WM_INITMENUPOPUP:
      /*
       * If we're in the object's Help menu, forward to
       * the object received in IOleInPlaceFrame::SetActiveObject
       */
      if (pFR->m_fInObjectHelp && NULL!=pFR->m_hWndObj)
        SendMessage(pFR->m_hWndObj, iMsg, wParam, lParam);

      //Skip the system menu
            if (TRUE==(BOOL)HIWORD(lParam))
                break;

        /*
             * If we have an object, enable Close, otherwise
             * enable Open.
             */
            hMenu=(HMENU)wParam;

            if (hMenu==pFR->m_phMenu[0])
                {
                UINT uTempE=MF_BYCOMMAND | MF_ENABLED;
                UINT uTempD=MF_BYCOMMAND | MF_DISABLED | MF_GRAYED;

                EnableMenuItem(hMenu, IDM_FILEOPEN
                    , pFR->m_fHaveObject ? uTempD : uTempE);
                EnableMenuItem(hMenu, IDM_FILECLOSE
                    , pFR->m_fHaveObject ? uTempE : uTempD);
                }

            break;

        case WM_COMMAND:
      if (pFR->m_fInObjectHelp)
        {
        SendMessage(pFR->m_hWndObj, iMsg, wParam, lParam);
        break;
        }
      else
              return pFR->OnCommand(hWnd, wParam, lParam);

    case WM_ACTIVATEAPP:
      if (NULL!=pFR->m_pIOleIPActiveObject)
        {
        HRESULT hr;
        hr=pFR->m_pIOleIPActiveObject->OnFrameWindowActivate((BOOL)wParam);
        }
      break;

        default:
            return DefWindowProc(hWnd, iMsg, wParam, lParam);
        }

    return 0L;
    }

Member Data Documentation

BORDERWIDTHS CFrame::m_bwIP [protected]

Definition at line 132 of file Framer.h.

ULONG CFrame::m_cRef [protected]

Definition at line 105 of file Framer.h.

DWORD CFrame::m_dwIDCounter [protected]

Definition at line 117 of file Framer.h.

BOOL CFrame::m_fHaveObject [protected]

Definition at line 128 of file Framer.h.

BOOL CFrame::m_fInContextHelp [protected]

Definition at line 133 of file Framer.h.

BOOL CFrame::m_fInitialized [protected]

Definition at line 115 of file Framer.h.

BOOL CFrame::m_fInObjectHelp [protected]

Definition at line 124 of file Framer.h.

BOOL CFrame::m_fOurMenuShowing [protected]

Definition at line 125 of file Framer.h.

BOOL CFrame::m_fUsingOurHelp [protected]

Definition at line 123 of file Framer.h.

HACCEL CFrame::m_hAccel [protected]

Definition at line 112 of file Framer.h.

HINSTANCE CFrame::m_hInst [protected]

Definition at line 103 of file Framer.h.

HINSTANCE CFrame::m_hInstPrev [protected]

Definition at line 107 of file Framer.h.

HMENU CFrame::m_hMenuHelp [protected]

Definition at line 122 of file Framer.h.

HMENU CFrame::m_hMenuOrg [protected]

Definition at line 120 of file Framer.h.

HMENU CFrame::m_hMenuTop [protected]

Definition at line 121 of file Framer.h.

HWND CFrame::m_hWnd [protected]

Definition at line 104 of file Framer.h.

HWND CFrame::m_hWndClient [protected]

Definition at line 113 of file Framer.h.

HWND CFrame::m_hWndObj [protected]

Definition at line 129 of file Framer.h.

int CFrame::m_nCmdShow [protected]

Definition at line 109 of file Framer.h.

HMENU* CFrame::m_phMenu [protected]

Definition at line 111 of file Framer.h.

IOleInPlaceActiveObject* CFrame::m_pIOleIPActiveObject [protected]

Definition at line 135 of file Framer.h.

IStorage* CFrame::m_pIStorage [protected]

Definition at line 116 of file Framer.h.

class CSite* CFrame::m_pSite [protected]

Definition at line 131 of file Framer.h.

LPTSTR CFrame::m_pszCmdLine [protected]

Definition at line 108 of file Framer.h.

The documentation for this class was generated from the following files:
  • Com/Fundamentals/ActiveDocument/Framer/Framer.h
  • Com/Fundamentals/ActiveDocument/Framer/Framer.Cpp
Generated on Wed Nov 13 2024 16:56:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CFrameFormat Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes | Protected Member Functions

CFrameFormat Class Reference

#include "Grid.Hxx"

Inherits CBlockFormat.

Inherited by CPageFormat.

List of all members.

Public Attributes

CFont _fontHeader
CFont _fontLabel

Protected Member Functions

CFrameFormat ()

Detailed Description

Definition at line 153 of file Grid.Hxx.

Constructor & Destructor Documentation

CFrameFormat::CFrameFormat ( ) [protected]

Definition at line 507 of file Grid.Cxx.

                           :
    _fontHeader  (TEXT("Arial"), -12, TRUE),
    _fontLabel   (TEXT("Arial"), -10, TRUE)
{
}

Member Data Documentation

CFont CFrameFormat::_fontHeader

Definition at line 156 of file Grid.Hxx.

CFont CFrameFormat::_fontLabel

Definition at line 157 of file Grid.Hxx.

The documentation for this class was generated from the following files:
  • Multimedia/Gdi/Fonts/GridFont/Grid.Hxx
  • Multimedia/Gdi/Fonts/GridFont/Grid.Cxx
Generated on Wed Nov 13 2024 16:56:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CFrameWndLite Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CFrameWndLite Class Reference

#include "cdialoglite.h"

Inherits CWndLite.

Inherited by CMDIFrameLite.

List of all members.

Public Member Functions

CFrameWndLite ()
virtual | ~CFrameWndLite ()
virtual BOOL | Create (HWND hWndParent, WCHAR *pwszClassName, WCHAR *pwszWindowName, UINT uID, HICON hIcon, DWORD dwStyle=WS_OVERLAPPEDWINDOW, DWORD dwExStyle=WS_EX_APPWINDOW, int x=CW_USEDEFAULT, int y=CW_USEDEFAULT, int cx=CW_USEDEFAULT, int cy=CW_USEDEFAULT)
virtual BOOL | OnClose ()
virtual BOOL | OnDestroy ()
virtual BOOL | OnNotify (INT idCtrl, NMHDR *pNMHDR)
virtual void | OnToolTip (INT idCtrl, NMHDR *pNMHDR)
virtual BOOL | PreTranslateMessage (MSG *pmsg)

Detailed Description

Definition at line 256 of file cdialoglite.h.

Constructor & Destructor Documentation

CFrameWndLite::CFrameWndLite ( )

Definition at line 1107 of file cdialoglite.cpp.

{
}

CFrameWndLite::~CFrameWndLite ( ) [virtual]

Definition at line 1116 of file cdialoglite.cpp.

{
}

Member Function Documentation

BOOL CFrameWndLite::Create | ( | HWND | hWndParent,
 |  | WCHAR * | pwszClassName,
 |  | WCHAR * | pwszWindowName,
 |  | UINT | uID,
 |  | HICON | hIcon,
 |  | DWORD | dwStyle = WS_OVERLAPPEDWINDOW,
 |  | DWORD | dwExStyle = WS_EX_APPWINDOW,
 |  | int | x = CW_USEDEFAULT,
 |  | int | y = CW_USEDEFAULT,
 |  | int | cx = CW_USEDEFAULT,
 |  | int | cy = CW_USEDEFAULT |
 | ) |  |  | [virtual]

Definition at line 1125 of file cdialoglite.cpp.

{
  HINSTANCE hInstance = GetAppLite()->m_hInstance;
  DWORD dwResult = 0;
/*
  //TODO:
  //Left in for the truely UNICODE port

   if(IsUnicodeOS() && 0)
  {
    //Setup the Structure
    WNDCLASSEXW wc;
    wc.cbSize     = sizeof(WNDCLASSEXW);
    wc.style      = 0;
    wc.lpfnWndProc    = WndProc;
    wc.cbClsExtra   = 0;
    wc.cbWndExtra   = 0;
    wc.hInstance    = hInstance;
    wc.hIcon      = hIcon;
    wc.hCursor      = LoadCursorW(NULL, (LPWSTR)IDC_ARROW);
    wc.hbrBackground  = (HBRUSH)(COLOR_APPWORKSPACE+1);
    wc.lpszMenuName   = MAKEINTRESOURCEW(uID);
    wc.lpszClassName  = pwszClassName;
    wc.hIconSm      = hIcon;

    //Register the window class
    dwResult = RegisterClassExW(&wc);
  }
  else
  {
*/    CHAR szClassName[MAX_NAME_LEN];
    ConvertToMBCS(pwszClassName, szClassName, MAX_NAME_LEN);

    //Setup the Structure
    WNDCLASSEXA wc;
    wc.cbSize     = sizeof(WNDCLASSEXA);
    wc.style      = 0;
    wc.lpfnWndProc    = WndProc;
    wc.cbClsExtra   = 0;
    wc.cbWndExtra   = 0;
    wc.hInstance    = hInstance;
    wc.hIcon      = hIcon;
    wc.hCursor      = LoadCursorA(NULL, (LPSTR)IDC_ARROW);
    wc.hbrBackground  = (HBRUSH)(COLOR_APPWORKSPACE+1);
    wc.lpszMenuName   = MAKEINTRESOURCEA(uID);
    wc.lpszClassName  = szClassName;
    wc.hIconSm      = hIcon;

    //Register the window class
    dwResult = RegisterClassExA(&wc);
/*  }
*/
  //Now actually Create the Window
  if(dwResult)
  {
    //Delegate
    CWndLite::Create(hWndParent, pwszClassName, pwszWindowName, NULL,
            dwStyle, dwExStyle, x, y, cx, cy);
  }

  return m_hWnd != NULL;
}

BOOL CFrameWndLite::OnClose ( ) [virtual]

Reimplemented from CWndLite.

Definition at line 1240 of file cdialoglite.cpp.

{
  return DestroyWindow();
}

BOOL CFrameWndLite::OnDestroy ( ) [virtual]

Reimplemented from CWndLite.

Reimplemented in CMDIFrameLite, and CMainWindow.

Definition at line 1250 of file cdialoglite.cpp.

{
  PostQuitMessage(0);

  //Delegate
  return CWndLite::OnDestroy();
}

BOOL CFrameWndLite::OnNotify | ( | INT | idCtrl,
 |  | NMHDR * | pNMHDR |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Reimplemented in CMDIFrameLite.

Definition at line 1206 of file cdialoglite.cpp.

{
  //The ToolBar and Menu always send the message to the FrameWindow, and we need
  //to delegate the message to our the child windows...
  switch(pNMHDR->code)
  {
    ON_COMMAND(TTN_NEEDTEXT, OnToolTip(idCtrl, pNMHDR));
  };

  //Delegate
  return CWndLite::OnNotify(idCtrl, pNMHDR);
}

void CFrameWndLite::OnToolTip | ( | INT | idCtrl,
 |  | NMHDR * | pNMHDR |
 | ) |  |  | [virtual]

Definition at line 1224 of file cdialoglite.cpp.

{
  // Display the ToolTip text.
  LPTOOLTIPTEXTA lpToolTipText = (LPTOOLTIPTEXTA)pNMHDR;

  //Load the ToolTip string from the resource...
  static CHAR szBuffer[MAX_NAME_LEN];
  LoadStringA(GetAppLite()->m_hInstance, (UINT)lpToolTipText->hdr.idFrom, szBuffer, MAX_NAME_LEN);
  lpToolTipText->lpszText = szBuffer;
}

BOOL CFrameWndLite::PreTranslateMessage ( MSG * pmsg ) [virtual]

Reimplemented in CMDIFrameLite.

Definition at line 1196 of file cdialoglite.cpp.

{
  return FALSE;
}

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialoglite.h
  • Dataaccess/oledb/rowsetviewer/cdialoglite.cpp
Generated on Wed Nov 13 2024 16:56:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CFreeTest Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CFreeTest Class Reference

#include "FreeTest.h"

List of all members.

Public Member Functions

CFreeTest ()
STDMETHOD() Exercise (void)

Detailed Description

Definition at line 29 of file FreeTest.h.

Constructor & Destructor Documentation

CFreeTest::CFreeTest ( ) [inline]

Definition at line 35 of file FreeTest.h.

  {
  }

Member Function Documentation

STDMETHODIMP CFreeTest::Exercise ( void )

Definition at line 49 of file FreeTest.Cpp.

{

  DWORD dwCount, dwValue = 0;

  // we only use a CriticalSection for time comparisons with the other clases.
  // There is nothing in this function that would require a critsec

  // get into our critical section
  EnterCriticalSection(&g_csSync);

  for (dwCount = 0; dwCount < LOOPCOUNT; dwCount++)
    dwValue += dwCount;

  LeaveCriticalSection(&g_csSync);

  return S_OK;
}

The documentation for this class was generated from the following files:
  • Com/Services/Concurrency/SyncComp/FreeObject/FreeTest.h
  • Com/Services/Concurrency/SyncComp/FreeObject/FreeTest.Cpp
Generated on Wed Nov 13 2024 16:56:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CFtNotify Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CFtNotify Class Reference

#include "CConf.h"

Inherits RefCount, and CNotify.

List of all members.

Public Member Functions

CFtNotify ()
~CFtNotify ()
ULONG STDMETHODCALLTYPE | AddRef (void)
HRESULT STDMETHODCALLTYPE | Connect (IUnknown *pUnk)
HRESULT STDMETHODCALLTYPE | Disconnect (void)
HRESULT STDMETHODCALLTYPE | FtUpdate (CONFN uNotify, INmFt *pFt)
HRESULT STDMETHODCALLTYPE | MemberChanged (NM_MEMBER_NOTIFY uNotify, INmMember *pMember)
HRESULT STDMETHODCALLTYPE | NmUI (CONFN uNotify)
HRESULT STDMETHODCALLTYPE | QueryInterface (REFIID riid, PVOID *ppvObj)
ULONG STDMETHODCALLTYPE | Release (void)

Detailed Description

Definition at line 22 of file CConf.h.

Constructor & Destructor Documentation

CFtNotify::CFtNotify ( )

Definition at line 366 of file CConf.Cpp.

                     : RefCount(), CNotify()
{
}

CFtNotify::~CFtNotify ( )

Definition at line 377 of file CConf.Cpp.

{
}

Member Function Documentation

ULONG STDMETHODCALLTYPE CFtNotify::AddRef ( void )

Definition at line 388 of file CConf.Cpp.

{
  return RefCount::AddRef();
}

HRESULT STDMETHODCALLTYPE CFtNotify::Connect ( IUnknown * pUnk )

Definition at line 435 of file CConf.Cpp.

{
  return CNotify::Connect(pUnk, IID_INmChannelFtNotify, (IUnknown *)this);
}

HRESULT STDMETHODCALLTYPE CFtNotify::Disconnect ( void )

Reimplemented from CNotify.

Definition at line 440 of file CConf.Cpp.

{
  return CNotify::Disconnect();
}

HRESULT STDMETHODCALLTYPE CFtNotify::FtUpdate | ( | CONFN | uNotify,
 |  | INmFt * | pFt
 | ) |  |

Definition at line 462 of file CConf.Cpp.

{
  if (NULL != pFt)
  {
    UpdateProgress(uNotify);
  }

  if  ((CONFN_FT_COMPLETE == uNotify) || (CONFN_FT_CANCELED == uNotify))
  {
    PostMessage(ghwndMain, WM_QUIT, 0, 0);
  }

  return S_OK;
}

HRESULT STDMETHODCALLTYPE CFtNotify::MemberChanged | ( | NM_MEMBER_NOTIFY | uNotify,
 |  | INmMember * | pMember
 | ) |  |

Definition at line 457 of file CConf.Cpp.

{
  return S_OK;
}

HRESULT STDMETHODCALLTYPE CFtNotify::NmUI ( CONFN uNotify )

Definition at line 452 of file CConf.Cpp.

{
  return S_OK;
}

HRESULT STDMETHODCALLTYPE CFtNotify::QueryInterface | ( | REFIID | riid,
 |  | PVOID * | ppvObj
 | ) |  |

Definition at line 399 of file CConf.Cpp.

{
  if  (NULL == ppvObject)
    return E_POINTER;

  HRESULT hr = NO_ERROR;

  if (riid == IID_IUnknown)
  {
    *ppvObject = (IUnknown *)this;
  }
  else if (riid == IID_INmChannelFtNotify)
  {
    *ppvObject = (INmChannelFtNotify *)this;
  }
  else
  {
    hr = E_NOINTERFACE;
    *ppvObject = NULL;
  }

  if SUCCEEDED(hr)
  {
    AddRef();
  }

  return hr;
}

ULONG STDMETHODCALLTYPE CFtNotify::Release ( void )

Definition at line 394 of file CConf.Cpp.

{
  return RefCount::Release();
}

The documentation for this class was generated from the following files:
  • Web/NetMeeting/NMFT/CConf.h
  • Web/NetMeeting/NMFT/CConf.Cpp
Generated on Wed Nov 13 2024 16:56:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CFullConnect Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Public Attributes

CFullConnect Class Reference

#include "cdialog.h"

Inherits CPropSheetLite, and CRowsetViewerDlg.

List of all members.

Public Member Functions

CFullConnect (CMainWindow *pCMainWindow)
virtual | ~CFullConnect ()
virtual BOOL | AddRecentConfig (WCHAR *pwszConfigName=NULL)
virtual BOOL | AddRecentFile (WCHAR *pwszFileName)
virtual HRESULT | CreateProviderInstance (REFIID riid, IUnknown **ppIUnknown, CBase **ppCSource=NULL)
virtual INT_PTR | Display (HWND hWndParent, CEnumerator *pCEnumerator=NULL, ENUMINFO *pEnumInfo=NULL)
virtual HRESULT | DisplayBrowseEnumInfo (HWND hWnd)
virtual HRESULT | FullConnect ()
virtual HRESULT | GetAdvProperties ()
virtual HRESULT | GetPropSets ()
virtual HRESULT | InitPropCombo (HWND hWndCombo, ULONG cItems, const WIDENAMEMAP *rgNameMap, LPARAM lParam)
virtual BOOL | LoadDefaults ()
virtual BOOL | LoadRecentConfig (ULONG iRecentConfig)
virtual BOOL | LoadRecentFile (ULONG iRecentFile)
virtual BOOL | RemoveRecentConfig (WCHAR *pwszConfigName)
virtual BOOL | RemoveRecentFile (WCHAR *pwszFileName)
virtual BOOL | ResetDefaults ()
virtual BOOL | SaveDefaults ()

Static Public Member Functions

static INT_PTR WINAPI | BrowseEnumeratorProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)

Public Attributes

CFullConnectOptions m_COptions
CFullConnectProperties m_CProperties
CPropSets m_CPropSets
CFullConnectProvider m_CProvider
CFullConnectSecurity m_CSecurity
ENUMINFO m_EnumInfo
UINT m_idSource
CList< WCHAR *, WCHAR * > | m_listConfigs
CList< WCHAR *, WCHAR * > | m_listFiles
CEnumerator * m_pCEnumerator
WCHAR | m_wszConfigName [MAX_NAME_LEN+1]

Detailed Description

Definition at line 440 of file cdialog.h.

Constructor & Destructor Documentation

CFullConnect::CFullConnect ( CMainWindow * pCMainWindow )

Definition at line 1510 of file cdialog.cpp.

  : CPropSheetLite("Full Connect"), CRowsetViewerDlg(pCMainWindow)
{
  AddPage(&m_CProvider);
  AddPage(&m_CProperties);
  AddPage(&m_CSecurity);
  AddPage(&m_COptions);

  WCHAR wszBuffer[MAX_NAME_LEN+1];
  ULONG cBytes = 0;

  //Enum
  m_pCEnumerator    = NULL;
  memset(&m_EnumInfo, 0, sizeof(ENUMINFO));
  StringCopy(m_EnumInfo.wszName,    L"MSDASQL", MAX_NAME_LEN);
  StringCopy(m_EnumInfo.wszParseName, L"MSDASQL", MAX_NAME_LEN);

  //Reset all Defaults
  ResetDefaults();

  //Load Configuration Name, so we know which configuration is the default
  GetRegEntry(HKEY_ROWSETVIEWER, wszCONFIG_KEY, L"DefaultConfig", m_wszConfigName, MAX_NAME_LEN);

  //Load Recent Configurations
  for(ULONG i=0; i<MAX_RECENTCONFIGS; i++)
  {
    cBytes = sizeof(wszBuffer);
    if(S_OK != GetRegEnumValue(HKEY_ROWSETVIEWER, wszRECENTCONFIG_KEY, i, wszBuffer, &cBytes))
      break;

    m_listConfigs.AddTail(wcsDuplicate(wszBuffer));
  }

  //Load Recent File
  for(i=0; i<MAX_RECENTFILES; i++)
  {
    cBytes = sizeof(wszBuffer);
    if(S_OK != GetRegEnumValue(HKEY_ROWSETVIEWER, wszRECENTFILE_KEY, i, wszBuffer, &cBytes))
      break;

    m_listFiles.AddTail(wcsDuplicate(wszBuffer));
  }
}

CFullConnect::~CFullConnect ( ) [virtual]

Definition at line 1559 of file cdialog.cpp.

{
  //Save Recent Configs
  DelRegEntry(HKEY_ROWSETVIEWER, wszRECENTCONFIG_KEY);
  while(!m_listConfigs.IsEmpty())
  {
    WCHAR* pwszConfigName = m_listConfigs.RemoveHead();
    if(FAILED(SetRegEntry(HKEY_ROWSETVIEWER, wszRECENTCONFIG_KEY, pwszConfigName, MAX_NAME_LEN)))
      break;

    SAFE_FREE(pwszConfigName);
  }

  //Save Recent Files
  DelRegEntry(HKEY_ROWSETVIEWER, wszRECENTFILE_KEY);
  while(!m_listFiles.IsEmpty())
  {
    WCHAR* pwszFileName = m_listFiles.RemoveHead();
    if(FAILED(SetRegEntry(HKEY_ROWSETVIEWER, wszRECENTFILE_KEY, pwszFileName, MAX_NAME_LEN)))
      break;

    SAFE_FREE(pwszFileName);
  }
}

Member Function Documentation

BOOL CFullConnect::AddRecentConfig ( WCHAR * pwszConfigName = NULL ) [virtual]

Definition at line 1771 of file cdialog.cpp.

{
  //Bascially the Alogythym for updating the Recent Configurations
  //is similar to a FIFO stack.  Lastest items become #1 and all other items
  //are moved down.  The only exception is if the item already exists
  //then it is brought up to number one and all other items are reordered...
  if(pwszConfigName == NULL)
    pwszConfigName = m_wszConfigName;

  //Make sure it doesn't already exist in the list
  RemoveRecentConfig(pwszConfigName);

  //Now add it to the list
  m_listConfigs.AddHead(wcsDuplicate(pwszConfigName));

  //Make sure the list is less than the Max
  if(m_listConfigs.GetCount() > MAX_RECENTCONFIGS)
  {
    pwszConfigName = m_listConfigs.RemoveTail();
    SAFE_FREE(pwszConfigName);
  }
  return TRUE;
}

BOOL CFullConnect::AddRecentFile ( WCHAR * pwszFileName ) [virtual]

Definition at line 1844 of file cdialog.cpp.

{
  //Bascially the Alogythym for updating the Recent Files
  //is similar to a FIFO stack.  Lastest items become #1 and all other items
  //are moved down.  The only exception is if the item already exists
  //then it is brought up to number one and all other items are reordered...
  ASSERT(pwszFileName);

  //Make sure it doesn't already exist in the list
  RemoveRecentFile(pwszFileName);

  //Now add it to the list
  m_listFiles.AddHead(wcsDuplicate(pwszFileName));

  //Make sure the list is less than the Max
  if(m_listFiles.GetCount() > MAX_RECENTFILES)
  {
    pwszFileName = m_listFiles.RemoveTail();
    SAFE_FREE(pwszFileName);
  }
  return TRUE;
}

INT_PTR WINAPI CFullConnect::BrowseEnumeratorProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 1930 of file cdialog.cpp.

{
  switch (message)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;

      //save off the this pointer
      CFullConnect* pThis = (CFullConnect*)SetThis(hWnd, (void*)lParam);
      CEnumerator* pCRootEnum =  pThis->m_pCMainWindow->m_pCRootEnumerator;

      //Controls
      CComboBoxLite comboProvider(hWnd, IDC_PROVIDER);
      CListViewLite listviewEnum(hWnd, IDL_LISTVIEW);

      //We may need to connect to the RootEnumerator, if not done already
      pCRootEnum->CreateEnumInfo(CLSID_OLEDB_ENUMERATOR);

      //Setup ListView
      SendMessage(listviewEnum.m_hWnd, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE);
      listviewEnum.InsertColumn(0, L"SOURCES_NAME");

      //Set image list to the ListView
      ListView_SetImageList(listviewEnum.m_hWnd, ImageList_LoadImage(GetAppLite()->m_hInstance, MAKEINTRESOURCE(IDB_IMAGE), 16, 16, CLR_DEFAULT , IMAGE_BITMAP, LR_DEFAULTCOLOR), LVSIL_SMALL);

      //We just need to fill in a combo box with the same values
      //from the Root Enumerator, but only displaying Enumerators...
      for(ULONG i=0; i<pCRootEnum->m_cEnumInfo; i++)
      {
        if(pCRootEnum->m_rgEnumInfo[i].eType == DBSOURCETYPE_ENUMERATOR)
        {
          //Add the name to the list
          //Since we have the CBS_SORT turned on, the order in the Combo Box does
          //not match our array, so we pass the array index (lParam) as the item data
          comboProvider.AddString(pCRootEnum->m_rgEnumInfo[i].wszName, (LPARAM)&pCRootEnum->m_rgEnumInfo[i]);
        }
      }

      //Try to do a smart guess on which Enumerator.
      //Since the spec doesn't have a actual way of prgrammatically
      //assoiciating providers with their enumerators, we will try and search
      //the enumerator name for the providers name...
      //So if using MSDASQL, it will find MSDASQL Enumerator
      INDEX iIndex = comboProvider.FindString(pThis->m_EnumInfo.wszName, -1);
      comboProvider.SetCurSel(iIndex!=CB_ERR ? iIndex : 0);

      //AutoSize Header
      listviewEnum.SetColumnWidth(0, LVSCW_AUTOSIZE_USEHEADER);

      //Send a selection change to the ComboBox so it updates everything
      SendMessage(hWnd, WM_COMMAND, GET_WM_COMMAND_MPS(IDC_PROVIDER, hWnd, CBN_SELCHANGE));
      CenterDialog(hWnd);
      return TRUE;
    }

    case WM_COMMAND:
    {
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      //LBN_SELCHANGE ListBox Selection change
      switch(GET_WM_COMMAND_CMD(wParam, lParam))
      {
        //Selection change in a list box occurred
        case LBN_SELCHANGE:
        {
          //Get the "this" pointer
          CFullConnect* pThis = (CFullConnect*)GetThis(hWnd);
          CEnumerator* pCRootEnum =  pThis->m_pCMainWindow->m_pCRootEnumerator;

          //Controls
          CComboBoxLite comboProvider(hWnd, IDC_PROVIDER);
          CListViewLite listviewEnum(hWnd, IDL_LISTVIEW);

          //The Selection has changed...
          listviewEnum.DeleteAllItems();
          listviewEnum.EnableWindow(FALSE);

          //Update the Window Title - with the Description
          INDEX iIndex = comboProvider.GetCurSel();
          ENUMINFO* pEnumInfo = (ENUMINFO*)comboProvider.GetItemParam(iIndex);

          if(pEnumInfo && (LPARAM)pEnumInfo!=CB_ERR)
            wSendMessage(hWnd, WM_SETTEXT, 0, pEnumInfo->wszDescription);
          return 0;
        }
      }

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDB_CONNECT:
        {
          //Get the "this" pointer
          CFullConnect* pThis = (CFullConnect*)GetThis(hWnd);

          //Fill in Enum Dialog
          pThis->DisplayBrowseEnumInfo(hWnd);
          return 0;
        }

        case IDOK:
        {
          CWaitCursor waitCursor;

          //Get the "this" pointer
          CFullConnect* pThis = (CFullConnect*)GetThis(hWnd);
          WCHAR wszBuffer[MAX_NAME_LEN] = {0};

          //Controls
          CListViewLite listviewEnum(hWnd, IDL_LISTVIEW);
          INDEX iSelRow = listviewEnum.GetNextItem(-1, LVNI_SELECTED);

          //Need to obtain Enum selection from the ListView
          listviewEnum.GetItemText(iSelRow, 0, wszBuffer, MAX_NAME_LEN);

          //Now replace the entire edit box with the new selected value
          CEditBoxLite editSource;
          editSource.CreateIndirect(pThis->m_CProvider.m_hWnd, pThis->m_idSource);

          //Just update value
          editSource.ReplaceAll(wszBuffer, TRUE/*bReplaceAll*/);
          EndDialog(hWnd, TRUE);
          return 0;
        }

        case IDCANCEL:
        {
          EndDialog(hWnd, FALSE);
          return 0;
        }
      }
      break;
    }//WM_COMMAND

    case WM_NOTIFY:
    {
      LV_DISPINFO* pDispInfo = (LV_DISPINFO*)lParam;

      switch(pDispInfo->hdr.code)
      {
        //Since we have "TwoClickActive" on this will get sent
        //Whenever a row is clicked on twice!
        //This functionality used to be done with NM_DBCLK
        case LVN_ITEMACTIVATE:
        {
          //Send an OK message
          SendMessage(hWnd, WM_COMMAND, GET_WM_COMMAND_MPS(IDOK, hWnd, 0));
          return 0;
        }
      }
      break;
    }//WM_NOTIFY
  }

  return FALSE;
}

HRESULT CFullConnect::CreateProviderInstance | ( | REFIID | riid,
 |  | IUnknown ** | ppIUnknown,
 |  | CBase ** | ppCSource = NULL |
 | ) |  |  | [virtual]

Definition at line 2316 of file cdialog.cpp.

{
  //Which Enumerator, Root Enum or passed in enumerator...
  CEnumerator* pCEnumerator       = m_pCEnumerator ? m_pCEnumerator : m_pCMainWindow->m_pCRootEnumerator;
  HRESULT hr = S_OK;

  //Delegate out the Enumerator to instansiate this object
  TESTC(hr = pCEnumerator->ParseDisplayName(m_EnumInfo.wszParseName, m_COptions.m_dwCLSCTX, riid, ppIUnknown, ppCSource, m_COptions.m_dwConnectOpts, m_COptions.m_wszRemoteServer));

CLEANUP:
  return hr;
}

INT_PTR CFullConnect::Display | ( | HWND | hWndParent,
 |  | CEnumerator * | pCEnumerator = NULL,
 |  | ENUMINFO * | pEnumInfo = NULL |
 | ) |  |  | [virtual]

Definition at line 1899 of file cdialog.cpp.

{
  //If an Enumerator is passed in, it represents the enumerator to use for instanting the object...
  //Otherwise if NULL - it uses the Root Enumerator Object...
  m_pCEnumerator = pCEnumerator;
  if(pEnumInfo)
  {
    ResetDefaults();
    memcpy(&m_EnumInfo, pEnumInfo, sizeof(ENUMINFO));
  }
  else
  {
    //Load the defaults for this configuration
    LoadDefaults();
  }

  //Display the Property Sheet
    if(DoModal(hWndParent) >=0 )
  {
    //Now display focus to the new MDIChildWindow (if successful...)
        ::SetFocus(::GetWindow(m_pCMainWindow->m_hWndMDIClient, GW_CHILD));
  }

  return TRUE;
}

HRESULT CFullConnect::DisplayBrowseEnumInfo ( HWND hWnd ) [virtual]

Definition at line 2097 of file cdialog.cpp.

{
  HRESULT hr = S_OK;

  ULONG i = 0;
  ENUMINFO* rgEnumInfo = NULL;
  WCHAR wszBuffer[MAX_NAME_LEN];
  CComPtr<IParseDisplayName> spParseDisplayName;
  WCHAR* pwszParseName = NULL;
  CEnumerator* pCEnumerator = new CEnumerator(m_pCMainWindow);
  CBase* pCSource = NULL;

  //Controls
  CComboBoxLite comboProvider(hWnd, IDC_PROVIDER);
  CListViewLite listviewEnum(hWnd, IDL_LISTVIEW);

  //Clear Previous Items
  listviewEnum.DeleteAllItems();
  listviewEnum.EnableWindow(FALSE);

  //Obtain the Specified ParseName
  INDEX iSel = comboProvider.GetCurSel();
  if(iSel == CB_ERR)
  {
    wszBuffer[0] = wEOL;
    comboProvider.GetWindowText(wszBuffer, MAX_NAME_LEN);
    pwszParseName = wszBuffer;
  }
  else
  {
    ENUMINFO* pEnumInfo = (ENUMINFO*)comboProvider.GetItemParam(iSel);
    pwszParseName = pEnumInfo->wszParseName;
  }

  //Connect to the specified Enumerator
  TESTC(hr = m_pCMainWindow->m_pCRootEnumerator->ParseDisplayName(pwszParseName, CLSCTX_ALL, IID_IParseDisplayName, (IUnknown**)&spParseDisplayName, &pCSource));

  //Obtain the Enumerator Rowset
  TESTC(hr = pCEnumerator->CreateObject(pCSource, IID_IParseDisplayName, spParseDisplayName));
  TESTC(hr = pCEnumerator->CreateEnumInfo());

  //Now loop through the EnumInfo and Display in the ListView
  //SOURCES_NAME
  for(i=0; i<pCEnumerator->m_cEnumInfo; i++)
    listviewEnum.InsertItem(i, 0, pCEnumerator->m_rgEnumInfo[i].wszName);
  listviewEnum.EnableWindow(TRUE);

CLEANUP:
  SAFE_FREE(rgEnumInfo);
  SAFE_RELEASE(pCEnumerator);
  return hr;
}

HRESULT CFullConnect::FullConnect ( ) [virtual]

Definition at line 2513 of file cdialog.cpp.

{
  CWaitCursor waitCursor;
  HRESULT hr = S_OK;
  CBase* pCSource = NULL;
  CBase* pCObject = NULL;
  CComPtr<IUnknown> spUnknown;

  //Obtain instance of Provider/Enum (if haven't done so already)...
  TESTC(hr = CreateProviderInstance(IID_IUnknown, &spUnknown, &pCSource));

  //Setup PropSets from all saved options
  TESTC(hr = GetPropSets());

  //Connect using the specified properties
  //NOTE: Can pontentially return other object types: (ie: CREATE_DETERMINE_TYPE)
  pCObject = m_pCMainWindow->HandleObjectType(pCSource, spUnknown, IID_IUnknown, eCDataSource, m_CPropSets.GetCount(), m_CPropSets.GetPropSets(), CREATE_NEWWINDOW | CREATE_DETERMINE_TYPE | m_COptions.m_dwConnectOpts | CREATE_NODISPLAY);
  if(!pCObject)
    TESTC(hr = E_FAIL);

  //Update the Object...
  pCObject->m_dwCLSCTX = m_COptions.m_dwCLSCTX;
  if(pCObject->m_pCMDIChild)
    pCObject->m_pCMDIChild->SetConfig(m_wszConfigName);

  //Now Display the object...
  pCObject->DisplayObject();

CLEANUP:
  return hr;
}

HRESULT CFullConnect::GetAdvProperties ( ) [virtual]

Definition at line 2186 of file cdialog.cpp.

{
  HRESULT hr = S_OK;
  CComPtr<IDBProperties> spDBProperties;
  ULONG iPropSet = 0;
  CPropertiesDlg sCPropertiesDlg(m_pCMainWindow);

  //Obtain instance of Provider/Enum (if we haven't done so already)
  TESTC(hr = m_CProvider.GetProviderName());
  TESTC(hr = CreateProviderInstance(IID_IDBProperties, (IUnknown**)&spDBProperties));

  //GetProperties (incase we haven't already)
  TESTC(hr = GetPropSets());

  //Bring up the SetProperties Dialog
  TESTC(hr = sCPropertiesDlg.SetProperties(m_CProperties.m_hWnd, &DBPROPSET_DBINITALL, IID_IDBProperties, spDBProperties, spDBProperties, &m_CPropSets));

  //Now read just our saved values...
  //Add update Dialogs, we only need to update values our dialogs know
  //about, all other properties are just saved in the set and added later...
  for(iPropSet=0; iPropSet<m_CPropSets.GetCount(); iPropSet++)
  {
    const DBPROPSET* pPropSet = &m_CPropSets[iPropSet];
    for(ULONG iProp=0; iProp<pPropSet->cProperties; iProp++)
    {
      DBPROP* pProp = &pPropSet->rgProperties[iProp];
      if(pPropSet->guidPropertySet == DBPROPSET_DBINIT)
      {
        switch(pProp->dwPropertyID)
        {
          //Provider Page
          case DBPROP_INIT_LOCATION:
            VariantToString(&pProp->vValue, m_CProvider.m_wszLocation, MAX_NAME_LEN, CONV_VARBOOL);
            break;

          case DBPROP_INIT_DATASOURCE:
            VariantToString(&pProp->vValue, m_CProvider.m_wszDataSource, MAX_NAME_LEN, CONV_VARBOOL);
            break;

          case DBPROP_AUTH_USERID:
            VariantToString(&pProp->vValue, m_CProvider.m_wszUserID, MAX_NAME_LEN, CONV_VARBOOL);
            break;

          case DBPROP_AUTH_PASSWORD:
            VariantToString(&pProp->vValue, m_CProvider.m_wszPassword, MAX_NAME_LEN, CONV_VARBOOL);
            break;

          case DBPROP_INIT_PROMPT:
            m_CProvider.m_dwPromptProp = V_I2(&pProp->vValue);
            break;

          case DBPROP_INIT_HWND:
            //Note: This works for 32bit as well as 64bit values (since HWND varies).
            //Reason, the variant is a union, so all values are placed into the same
            //starting location, so we simply take the adress and cast to the type.
            m_CProvider.m_hWndProp    = *(HWND*)&V_I4(&pProp->vValue);
            break;

          //Propeerties Page
          case DBPROP_INIT_PROVIDERSTRING:
            VariantToString(&pProp->vValue, m_CProperties.m_wszProvString, MAX_NAME_LEN, CONV_VARBOOL);
            break;

          case DBPROP_INIT_CATALOG:
            VariantToString(&pProp->vValue, m_CProperties.m_wszCatalog, MAX_NAME_LEN, CONV_VARBOOL);
            break;

          case DBPROP_INIT_LCID:
            m_CProperties.m_dwlcidProp = V_I4(&pProp->vValue);
            break;

          case DBPROP_INIT_ASYNCH:
            m_CProperties.m_dwAsynchProp = V_I4(&pProp->vValue);
            break;

          case DBPROP_INIT_TIMEOUT:
            m_CProperties.m_dwTimeoutProp = V_I4(&pProp->vValue);
            break;

          case DBPROP_INIT_MODE:
            m_CProperties.m_dwModeProp = V_I4(&pProp->vValue);
            break;

          //Security Page
          case DBPROP_INIT_PROTECTION_LEVEL:
            m_CSecurity.m_dwProtectionProp = V_I4(&pProp->vValue);
            break;

          case DBPROP_INIT_IMPERSONATION_LEVEL:
            m_CSecurity.m_dwImpersonateProp = V_I4(&pProp->vValue);
            break;

          case DBPROP_AUTH_MASK_PASSWORD:
            m_CSecurity.m_dwMaskPasswordProp = V_BOOL(&pProp->vValue);
            break;

          case DBPROP_AUTH_ENCRYPT_PASSWORD:
            m_CSecurity.m_dwEncryptPasswordProp = V_BOOL(&pProp->vValue);
            break;

          case DBPROP_AUTH_CACHE_AUTHINFO:
            m_CSecurity.m_dwCacheProp = V_BOOL(&pProp->vValue);
            break;

          case DBPROP_AUTH_PERSIST_SENSITIVE_AUTHINFO:
            m_CSecurity.m_dwPersistProp = V_BOOL(&pProp->vValue);
            break;

          case DBPROP_AUTH_PERSIST_ENCRYPTED:
            m_CSecurity.m_dwPersistEncryptProp = V_BOOL(&pProp->vValue);
            break;

          case DBPROP_AUTH_INTEGRATED:
            VariantToString(&pProp->vValue, m_CSecurity.m_wszIntegrated, MAX_NAME_LEN, CONV_VARBOOL);
            break;
        }
      }
    }
  };

CLEANUP:
  return hr;
}

HRESULT CFullConnect::GetPropSets ( ) [virtual]

Definition at line 2334 of file cdialog.cpp.

{
  HRESULT hr = S_OK;

  //Free Previous Properties
  //This method gets called whenever connect gets called.
  //So the user may or may not have called 'More', which would have already
  //Obtained these properties.  Also the user may have updated the dialogs
  //afterwards, so bascially it boils down to the fact we need to "reget" all
  //Properties that are in the dialog, and save all the prev properties (More)
  ULONG cPropSets = 0;
  DBPROPSET* rgPropSets = NULL;
  m_CPropSets.Detach(&cPropSets, &rgPropSets);

  //Setup Properties from Provider Page
  if(m_CProvider.m_wszLocation[0])
    m_CPropSets.SetProperty(DBPROP_INIT_LOCATION,   DBPROPSET_DBINIT, DBTYPE_BSTR, m_CProvider.m_wszLocation);
  if(m_CProvider.m_wszDataSource[0])
    m_CPropSets.SetProperty(DBPROP_INIT_DATASOURCE,   DBPROPSET_DBINIT, DBTYPE_BSTR, m_CProvider.m_wszDataSource);
  if(m_CProvider.m_wszUserID[0])
    m_CPropSets.SetProperty(DBPROP_AUTH_USERID,     DBPROPSET_DBINIT, DBTYPE_BSTR, m_CProvider.m_wszUserID);
  if(m_CProvider.m_wszPassword[0])
    m_CPropSets.SetProperty(DBPROP_AUTH_PASSWORD,   DBPROPSET_DBINIT, DBTYPE_BSTR, m_CProvider.m_wszPassword);
  if(m_CProvider.m_dwPromptProp != NOTSET)
    m_CPropSets.SetProperty(DBPROP_INIT_PROMPT,     DBPROPSET_DBINIT, DBTYPE_I2,  (void*)(LONG_PTR)m_CProvider.m_dwPromptProp);

  //By default we will set HWND if the user has requested a prompt value (except noprompt), or
  //the user has explicitly set the hwnd themselves in the Advanced Properties...
  if(m_CProvider.m_hWndProp != (HWND)NOTSET || (m_CProvider.m_dwPromptProp != NOTSET && m_CProvider.m_dwPromptProp != DBPROMPT_NOPROMPT))
  {
    //Setup our "dynamic" window handle property...
    //NOTE: We have to do this here, since this needs to not only be a valid window handle,
    //must it also be the full connect dialog handle, so that if the provider displays a prompt
    //dialog its "modal" to this one and not the main window...

    //Note: On 64bit HWND is I8 instead of I4
    DBTYPE wType = (sizeof(HWND)==8) ? DBTYPE_I8 : DBTYPE_I4;
    HWND hWnd = (m_CProvider.m_hWndProp != (HWND)NOTSET) ? m_CProvider.m_hWndProp : m_CProvider.m_hWnd;
    m_CPropSets.SetProperty(DBPROP_INIT_HWND,     DBPROPSET_DBINIT, wType, (void*)hWnd);
  }

  //Setup Properties from Properties Page
  if(m_CProperties.m_wszProvString[0])
    m_CPropSets.SetProperty(DBPROP_INIT_PROVIDERSTRING, DBPROPSET_DBINIT, DBTYPE_BSTR, m_CProperties.m_wszProvString);
  if(m_CProperties.m_wszCatalog[0])
    m_CPropSets.SetProperty(DBPROP_INIT_CATALOG,    DBPROPSET_DBINIT, DBTYPE_BSTR, m_CProperties.m_wszCatalog);
  if(m_CProperties.m_dwTimeoutProp != NOTSET)
    m_CPropSets.SetProperty(DBPROP_INIT_TIMEOUT,    DBPROPSET_DBINIT, DBTYPE_I4,  (void*)(LONG_PTR)m_CProperties.m_dwTimeoutProp);
  if(m_CProperties.m_dwAsynchProp != NOTSET)
    m_CPropSets.SetProperty(DBPROP_INIT_ASYNCH,     DBPROPSET_DBINIT, DBTYPE_I4,  (void*)(LONG_PTR)m_CProperties.m_dwAsynchProp);
  if(m_CProperties.m_dwlcidProp != NOTSET)
    m_CPropSets.SetProperty(DBPROP_INIT_LCID,     DBPROPSET_DBINIT, DBTYPE_I4,  (void*)(LONG_PTR)m_CProperties.m_dwlcidProp);
  if(m_CProperties.m_dwModeProp != NOTSET)
    m_CPropSets.SetProperty(DBPROP_INIT_MODE,     DBPROPSET_DBINIT, DBTYPE_I4,  (void*)(LONG_PTR)m_CProperties.m_dwModeProp);

  //Setup Properties from Security Page
  if(m_CSecurity.m_dwProtectionProp != NOTSET)
    m_CPropSets.SetProperty(DBPROP_INIT_PROTECTION_LEVEL,DBPROPSET_DBINIT, DBTYPE_I4,   (void*)(LONG_PTR)m_CSecurity.m_dwProtectionProp);
  if(m_CSecurity.m_dwImpersonateProp != NOTSET)
    m_CPropSets.SetProperty(DBPROP_INIT_IMPERSONATION_LEVEL,DBPROPSET_DBINIT, DBTYPE_I4,  (void*)(LONG_PTR)m_CSecurity.m_dwImpersonateProp);
  if(m_CSecurity.m_dwMaskPasswordProp != NOTSET)
    m_CPropSets.SetProperty(DBPROP_AUTH_MASK_PASSWORD,  DBPROPSET_DBINIT, DBTYPE_BOOL,    (void*)(LONG_PTR)m_CSecurity.m_dwMaskPasswordProp);
  if(m_CSecurity.m_dwEncryptPasswordProp != NOTSET)
    m_CPropSets.SetProperty(DBPROP_AUTH_ENCRYPT_PASSWORD,DBPROPSET_DBINIT, DBTYPE_BOOL, (void*)(LONG_PTR)m_CSecurity.m_dwEncryptPasswordProp);
  if(m_CSecurity.m_dwCacheProp != NOTSET)
    m_CPropSets.SetProperty(DBPROP_AUTH_CACHE_AUTHINFO, DBPROPSET_DBINIT, DBTYPE_BOOL,    (void*)(LONG_PTR)m_CSecurity.m_dwCacheProp);
  if(m_CSecurity.m_dwPersistProp != NOTSET)
    m_CPropSets.SetProperty(DBPROP_AUTH_PERSIST_SENSITIVE_AUTHINFO, DBPROPSET_DBINIT, DBTYPE_BOOL,  (void*)(LONG_PTR)m_CSecurity.m_dwPersistProp);
  if(m_CSecurity.m_dwPersistEncryptProp != NOTSET)
    m_CPropSets.SetProperty(DBPROP_AUTH_PERSIST_ENCRYPTED,  DBPROPSET_DBINIT, DBTYPE_BOOL,  (void*)(LONG_PTR)m_CSecurity.m_dwPersistEncryptProp);
  if(m_CSecurity.m_wszIntegrated[0])
    m_CPropSets.SetProperty(DBPROP_AUTH_INTEGRATED,   DBPROPSET_DBINIT, DBTYPE_BSTR,    m_CSecurity.m_wszIntegrated);

  //Loop over all the Advanced Properties set,
  //And adjust any of the existing property options or type.
  //Always use the "latest" value specified in the dialogs, but the Advncaed
  //is the only way to set the type or options (REQUIRED/OPTIONAL)...

  //If there are properties that exist out side of the ones avilable in the
  //dialogs, jusat set it, it may be an provider specific property,
  //or a newly added one to the group...
  for(ULONG iPropSet=0; iPropSet<cPropSets; iPropSet++)
  {
    DBPROPSET* pPropSet = &rgPropSets[iPropSet];
    for(ULONG iProp=0; iProp<pPropSet->cProperties; iProp++)
    {
      DBPROP* pProp = &pPropSet->rgProperties[iProp];
      if(pPropSet->guidPropertySet != DBPROPSET_DBINIT)
      {
        //Otherwise this is not a settable property through the
        //Dialogs, so just add the property, since it may be a
        //provider specific property or newly added to DBINIT set...
        m_CPropSets.SetProperty(pProp->dwPropertyID, pPropSet->guidPropertySet, DBTYPE_VARIANT, &pProp->vValue, pProp->dwOptions);
        break;
      }
      else
      {
        //DBPROPSET_DBINIT - Probably alread included from the dialogs
        switch(pProp->dwPropertyID)
        {
          //Provider Page
          case DBPROP_INIT_LOCATION:
          case DBPROP_INIT_DATASOURCE:
          case DBPROP_AUTH_USERID:
          case DBPROP_AUTH_PASSWORD:
          case DBPROP_INIT_PROMPT:
          case DBPROP_INIT_HWND:

          //Propeerties Page
          case DBPROP_INIT_PROVIDERSTRING:
          case DBPROP_INIT_CATALOG:
          case DBPROP_INIT_LCID:
          case DBPROP_INIT_ASYNCH:
          case DBPROP_INIT_TIMEOUT:
          case DBPROP_INIT_MODE:

          //Security Page
          case DBPROP_INIT_PROTECTION_LEVEL:
          case DBPROP_INIT_IMPERSONATION_LEVEL:
          case DBPROP_AUTH_MASK_PASSWORD:
          case DBPROP_AUTH_ENCRYPT_PASSWORD:
          case DBPROP_AUTH_CACHE_AUTHINFO:
          case DBPROP_AUTH_PERSIST_SENSITIVE_AUTHINFO:
          case DBPROP_AUTH_PERSIST_ENCRYPTED:
          case DBPROP_AUTH_INTEGRATED:
          {
            //All off these properties are available through the Dialogs
            //But not all the options and types are.  So if this property
            //exists in the current set, then adjust any options and types...
            //Since these are only exposed in the Advnaced page...

            //Find this property in the current set...
            DBPROP* pPropFound = m_CPropSets.FindProperty(pProp->dwPropertyID, pPropSet->guidPropertySet, pProp->colid);
            if(pPropFound)
            {
              //Override any options - from advanced
              pPropFound->dwOptions = pProp->dwOptions;
              //Override any wType - from advanced
              pPropFound->vValue.vt = pProp->vValue.vt;
              //Override any colid - from advanced
              //memcpy(pProp->colid, pProp->colid, sizeof(DBID));
            }
            else
            {
              //It may not have been found in the current set
              //since the dialog may have been Empty, ("").  Its hard
              //to determine what empty means in a edit box, does it mean
              //Empty String, NULL, not set, or VT_EMPTY.
              //If this property exists in the Advanced set this is where
              //we will obtain this information...

              //The Advanced Page will always override the edit boxes...
              if(pProp->vValue.vt == VT_EMPTY || (pProp->vValue.vt == VT_BSTR && pProp->vValue.bstrVal && !pProp->vValue.bstrVal[0]))
                m_CPropSets.SetProperty(pProp->dwPropertyID, pPropSet->guidPropertySet, DBTYPE_VARIANT, &pProp->vValue, pProp->dwOptions);
            }
            break;
          }

          default:
          {
            //Otherwise this is not a settable property through the
            //Dialogs, so just add the property, since it may be a
            //provider specific property or newly added to DBINIT set...
            m_CPropSets.SetProperty(pProp->dwPropertyID, pPropSet->guidPropertySet, DBTYPE_VARIANT, &pProp->vValue, pProp->dwOptions);
            break;
          }
        }
      }
    }
  };

  FreeProperties(&cPropSets, &rgPropSets);
  return hr;
}

HRESULT CFullConnect::InitPropCombo | ( | HWND | hWndCombo,
 |  | ULONG | cItems,
 |  | const WIDENAMEMAP * | rgNameMap,
 |  | LPARAM | lParam |
 | ) |  |  | [virtual]

Definition at line 2156 of file cdialog.cpp.

{
  //Remove any existing Data
  SendMessage(hWndCombo,  CB_RESETCONTENT, 0, 0);
  INDEX iDefSel = 0;

  //First Item of every Property Combo is "No Set"
  INDEX iSel = (INDEX)SendMessage(hWndCombo, CB_ADDSTRING, 0, (LPARAM)"Not Set");
  SendMessage(hWndCombo,  CB_SETITEMDATA, iSel, (LPARAM)NOTSET);

  //Fill in all Combo values...
  for(ULONG i=0; i<cItems; i++)
  {
    iSel = (INDEX)wSendMessage(hWndCombo, CB_ADDSTRING, 0, rgNameMap[i].pwszName);
    SendMessage(hWndCombo, CB_SETITEMDATA,  iSel, (LPARAM)rgNameMap[i].lItem);

    if(rgNameMap[i].lItem == lParam)
      iDefSel = iSel;
  }

  //Set the specified Default
  SendMessage(hWndCombo,  CB_SETCURSEL, iDefSel, 0);
  return S_OK;
}

BOOL CFullConnect::LoadDefaults ( ) [virtual]

Definition at line 1633 of file cdialog.cpp.

{
  //Need to remove any previously set properties.
  //Specifically any Advanced properties, since this is a new configuration
  m_CPropSets.RemoveAll();

  //Configuration Name
  if(m_wszConfigName[0] == wEOL)
    StringCopy(m_wszConfigName, L"(Default)", MAX_NAME_LEN);

  //Formulate the key
  WCHAR wszKeyName[MAX_NAME_LEN];
  StringFormat(wszKeyName, NUMELE(wszKeyName), L"%s\\%s", wszCONFIG_KEY, m_wszConfigName);

  //Selected Provider
  GetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"Provider",       m_EnumInfo.wszName, MAX_NAME_LEN);
  GetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"ParseName",      m_EnumInfo.wszParseName, MAX_NAME_LEN);

  //Provider Page
  GetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"Location",       m_CProvider.m_wszLocation, MAX_NAME_LEN);
  GetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"DataSource",     m_CProvider.m_wszDataSource, MAX_NAME_LEN);
  GetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"UserID",       m_CProvider.m_wszUserID, MAX_NAME_LEN);
  GetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"Password",       m_CProvider.m_wszPassword, MAX_NAME_LEN);
  GetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"PromptProp",     (ULONG*)&m_CProvider.m_dwPromptProp);
  m_CProvider.m_hWndProp  = (HWND)NOTSET;

  //Properties Page
  GetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"ProvString",     m_CProperties.m_wszProvString, MAX_NAME_LEN);
  GetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"Catalog",        m_CProperties.m_wszCatalog, MAX_NAME_LEN);
  GetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"lcidProp",       (ULONG*)&m_CProperties.m_dwlcidProp);
  GetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"AsynchProp",     (ULONG*)&m_CProperties.m_dwAsynchProp);
  GetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"TimeoutProp",      (ULONG*)&m_CProperties.m_dwTimeoutProp);
  GetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"ModeProp",       (ULONG*)&m_CProperties.m_dwModeProp);

  //Security Page
  GetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"ProtectionProp",   (ULONG*)&m_CSecurity.m_dwProtectionProp);
  GetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"ImpersonateProp",    (ULONG*)&m_CSecurity.m_dwImpersonateProp);
  GetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"MaskPasswordProp",   (ULONG*)&m_CSecurity.m_dwMaskPasswordProp);
  GetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"EncryptPasswordProp",  (ULONG*)&m_CSecurity.m_dwEncryptPasswordProp);
  GetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"CacheProp",      (ULONG*)&m_CSecurity.m_dwCacheProp);
  GetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"PersistProp",      (ULONG*)&m_CSecurity.m_dwPersistProp);
  GetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"PersistEncryptProp", (ULONG*)&m_CSecurity.m_dwPersistEncryptProp);
  GetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"Integrated",     m_CSecurity.m_wszIntegrated, MAX_NAME_LEN);

  //Options Page
  GetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"CLSCTX",       &m_COptions.m_dwCLSCTX);
  GetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"RemoteServer",     m_COptions.m_wszRemoteServer, MAX_NAME_LEN);
  GetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"ConnectOptions",   &m_COptions.m_dwConnectOpts);
  return TRUE;
}

BOOL CFullConnect::LoadRecentConfig ( ULONG iRecentConfig ) [virtual]

Definition at line 1753 of file cdialog.cpp.

{
  ASSERT(iRecentConfig < m_listConfigs.GetCount());

  //Set the active config
  StringCopy(m_wszConfigName, m_listConfigs.GetAt(m_listConfigs.FindIndex(iRecentConfig)), MAX_NAME_LEN);

  //Load the saved properties and Connect
  LoadDefaults();
  FullConnect();
  return TRUE;
}

BOOL CFullConnect::LoadRecentFile ( ULONG iRecentFile ) [virtual]

Definition at line 1827 of file cdialog.cpp.

{
  ASSERT(iRecentFile < m_listFiles.GetCount());

  //Obtain the Selected File
  WCHAR* pwszFileName = m_listFiles.GetAt(m_listFiles.FindIndex(iRecentFile));

  //Load the saved properties and Connect
  m_pCMainWindow->m_pCServiceComp->ConnectFromFile(pwszFileName);
  return TRUE;
}

BOOL CFullConnect::RemoveRecentConfig ( WCHAR * pwszConfigName ) [virtual]

Definition at line 1800 of file cdialog.cpp.

{
  ASSERT(pwszConfigName);

  //Make sure it doesn't allready exist in the list
  POSITION pos = m_listConfigs.GetHeadPosition();
  while(pos)
  {
    POSITION posSave = pos;
    WCHAR* pwszName = m_listConfigs.GetNext(pos);
    if(StringCompare(pwszName, pwszConfigName))
    {
      //Remove this item and Add to the head
      pwszName = m_listConfigs.RemoveAt(posSave);
      SAFE_FREE(pwszName);
      return TRUE;
    }
  }

  return TRUE;
}

BOOL CFullConnect::RemoveRecentFile ( WCHAR * pwszFileName ) [virtual]

Definition at line 1872 of file cdialog.cpp.

{
  ASSERT(pwszFileName);

  //Make sure it doesn't allready exist in the list
  POSITION pos = m_listFiles.GetHeadPosition();
  while(pos)
  {
    POSITION posSave = pos;
    WCHAR* pwszName = m_listFiles.GetNext(pos);
    if(StringCompare(pwszName, pwszFileName))
    {
      //Remove this item and Add to the head
      pwszName = m_listFiles.RemoveAt(posSave);
      SAFE_FREE(pwszName);
      return TRUE;
    }
  }

  return TRUE;
}

BOOL CFullConnect::ResetDefaults ( ) [virtual]

Definition at line 1589 of file cdialog.cpp.

{
  //Configuration Name
  StringCopy(m_wszConfigName, L"(Default)", MAX_NAME_LEN);

  //Provider Page
  m_CProvider.m_wszLocation[0]    = wEOL;     //DBPROP_INIT_LOCATION
  m_CProvider.m_wszDataSource[0]    = wEOL;     //DBPROP_INIT_DATASOURCE
  m_CProvider.m_wszUserID[0]      = wEOL;     //DBPROP_AUTH_USERID
  m_CProvider.m_wszPassword[0]    = wEOL;     //DBPROP_AUTH_PASSWORD
  m_CProvider.m_dwPromptProp      = DBPROMPT_COMPLETE;
  m_CProvider.m_hWndProp        = (HWND)NOTSET;

  //Properties Page
  m_CProperties.m_wszProvString[0]  = wEOL;     //DBPROP_INIT_PROVIDERSTRING
  m_CProperties.m_wszCatalog[0]   = wEOL;     //DBPROP_INIT_CATALOG
  m_CProperties.m_dwlcidProp      = NOTSET;

  m_CProperties.m_dwAsynchProp    = NOTSET;
  m_CProperties.m_dwTimeoutProp   = NOTSET;
  m_CProperties.m_dwModeProp      = NOTSET;

  //Security Page
  m_CSecurity.m_dwProtectionProp    = NOTSET;
  m_CSecurity.m_dwImpersonateProp   = NOTSET;
  m_CSecurity.m_dwMaskPasswordProp  = NOTSET;
  m_CSecurity.m_dwEncryptPasswordProp = NOTSET;
  m_CSecurity.m_dwCacheProp     = NOTSET;
  m_CSecurity.m_dwPersistProp     = NOTSET;
  m_CSecurity.m_dwPersistEncryptProp  = NOTSET;
  m_CSecurity.m_wszIntegrated[0]    = wEOL;     // DBPROP_INIT_INTEGRATED

  //Options Page
  m_COptions.m_dwCLSCTX       = CLSCTX_INPROC_SERVER;
  m_COptions.m_wszRemoteServer[0]   = wEOL;
  m_COptions.m_dwConnectOpts      = CREATE_INITIALIZE | CREATE_SETPROPERTIES;
  return TRUE;
}

BOOL CFullConnect::SaveDefaults ( ) [virtual]

Definition at line 1689 of file cdialog.cpp.

{
  //Obtain the Configuration Name
  m_CProvider.m_comboConfig.GetSelText(m_wszConfigName, MAX_NAME_LEN);
  m_CProvider.m_comboConfig.SetSelText(m_wszConfigName, TRUE/*fAddItem*/);

  //Configuration Name
  if(m_wszConfigName[0] == wEOL)
    StringCopy(m_wszConfigName, L"(Default)", MAX_NAME_LEN);

  //Save Configuration Name, so we know which configuration is the default
  SetRegEntry(HKEY_ROWSETVIEWER, wszCONFIG_KEY, L"DefaultConfig", m_wszConfigName);

  //Formulate the key
  WCHAR wszKeyName[MAX_NAME_LEN];
  StringFormat(wszKeyName, NUMELE(wszKeyName), L"%s\\%s", wszCONFIG_KEY, m_wszConfigName);

  //Selected Provider
  SetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"Provider",       m_EnumInfo.wszName);
  SetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"ParseName",      m_EnumInfo.wszParseName);

  //Provider Page
  SetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"Location",       m_CProvider.m_wszLocation);
  SetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"DataSource",     m_CProvider.m_wszDataSource);
  SetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"UserID",       m_CProvider.m_wszUserID);
  SetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"Password",       m_CProvider.m_wszPassword);
  SetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"PromptProp",     m_CProvider.m_dwPromptProp);

  //NOTE: The Window handle doesn't get persisted...
//  m_hWndProp

  //Properties Page
  SetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"ProvString",     m_CProperties.m_wszProvString);
  SetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"Catalog",        m_CProperties.m_wszCatalog);
  SetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"lcidProp",       m_CProperties.m_dwlcidProp);
  SetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"AsynchProp",     m_CProperties.m_dwAsynchProp);
  SetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"TimeoutProp",      m_CProperties.m_dwTimeoutProp);
  SetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"ModeProp",       m_CProperties.m_dwModeProp);

  //Security Page
  SetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"ProtectionProp",   m_CSecurity.m_dwProtectionProp);
  SetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"ImpersonateProp",    m_CSecurity.m_dwImpersonateProp);
  SetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"MaskPasswordProp",   m_CSecurity.m_dwMaskPasswordProp);
  SetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"EncryptPasswordProp",  m_CSecurity.m_dwEncryptPasswordProp);
  SetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"CacheProp",      m_CSecurity.m_dwCacheProp);
  SetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"PersistProp",      m_CSecurity.m_dwPersistProp);
  SetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"PersistEncryptProp", m_CSecurity.m_dwPersistEncryptProp);
  SetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"Integrated",     m_CSecurity.m_wszIntegrated);

  //Options Page
  SetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"CLSCTX",       m_COptions.m_dwCLSCTX);
  SetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"RemoteServer",     m_COptions.m_wszRemoteServer);
  SetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"ConnectOptions",   m_COptions.m_dwConnectOpts);

  //Update the Saved Configurations (now that successfuly connected)
  AddRecentConfig();
  return TRUE;
}

Member Data Documentation

CFullConnectOptions CFullConnect::m_COptions

Definition at line 482 of file cdialog.h.

CFullConnectProperties CFullConnect::m_CProperties

Definition at line 480 of file cdialog.h.

CPropSets CFullConnect::m_CPropSets

Definition at line 490 of file cdialog.h.

CFullConnectProvider CFullConnect::m_CProvider

Definition at line 479 of file cdialog.h.

CFullConnectSecurity CFullConnect::m_CSecurity

Definition at line 481 of file cdialog.h.

ENUMINFO CFullConnect::m_EnumInfo

Definition at line 487 of file cdialog.h.

UINT CFullConnect::m_idSource

Definition at line 483 of file cdialog.h.

CList<WCHAR*, WCHAR*> CFullConnect::m_listConfigs

Definition at line 457 of file cdialog.h.

CList<WCHAR*, WCHAR*> CFullConnect::m_listFiles

Definition at line 463 of file cdialog.h.

CEnumerator* CFullConnect::m_pCEnumerator

Definition at line 486 of file cdialog.h.

WCHAR CFullConnect::m_wszConfigName[MAX_NAME_LEN+1]

Definition at line 493 of file cdialog.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialog.h
  • Dataaccess/oledb/rowsetviewer/cdialog.cpp
Generated on Wed Nov 13 2024 16:56:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CFullConnectOptions Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CFullConnectOptions Class Reference

#include "cdialog.h"

Inherits CPropPageLite.

List of all members.

Public Member Functions

CFullConnectOptions ()
virtual BOOL | OnCommand (UINT iID, HWND hWndCtrl)
virtual BOOL | OnInitDialog ()
virtual BOOL | OnKillActive ()
virtual BOOL | OnSetActive ()
virtual BOOL | RefreshOptions ()
virtual BOOL | UpdateOptions ()

Public Attributes

DWORD m_dwCLSCTX
DWORD m_dwConnectOpts
WCHAR | m_wszRemoteServer [MAX_NAME_LEN+1]

Detailed Description

Definition at line 414 of file cdialog.h.

Constructor & Destructor Documentation

CFullConnectOptions::CFullConnectOptions ( )

Definition at line 1367 of file cdialog.cpp.

  : CPropPageLite(IDD_FULLCONNECT_OPTIONS, "Options")
{
}

Member Function Documentation

BOOL CFullConnectOptions::OnCommand | ( | UINT | iID,
 |  | HWND | hWndCtrl |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 1413 of file cdialog.cpp.

{
  switch(iID)
  {
    ON_COMMAND(IDB_REMOTE_SERVER, ::EnableWindow(::GetDlgItem(m_hWnd, IDE_REMOTESERVER), ::IsDlgButtonChecked(m_hWnd, IDB_REMOTE_SERVER)))
  };

  return FALSE;
}

BOOL CFullConnectOptions::OnInitDialog ( ) [virtual]

Reimplemented from CDialogLite.

Definition at line 1376 of file cdialog.cpp.

{
  CWaitCursor waitCursor;

  //Refresh Options
  RefreshOptions();

  //Delegate
  return CPropPageLite::OnInitDialog();
}

BOOL CFullConnectOptions::OnKillActive ( ) [virtual]

Reimplemented from CPropPageLite.

Definition at line 1403 of file cdialog.cpp.

{
  return UpdateOptions();
}

BOOL CFullConnectOptions::OnSetActive ( ) [virtual]

Reimplemented from CPropPageLite.

Definition at line 1392 of file cdialog.cpp.

{
  RefreshOptions();
  return TRUE;
}

BOOL CFullConnectOptions::RefreshOptions ( ) [virtual]

Definition at line 1428 of file cdialog.cpp.

{
  CFullConnect* pCFullConnect = (CFullConnect*)GetParent();
  CMainWindow* pCMainWindow = pCFullConnect->m_pCMainWindow;

  //Set CLSCTX to previous saved values
  CheckDlgButton(IDB_INPROC_SERVER,       BST2STATE(m_dwCLSCTX & CLSCTX_INPROC_SERVER));
  CheckDlgButton(IDB_LOCAL_SERVER,        BST2STATE(m_dwCLSCTX & CLSCTX_LOCAL_SERVER));
  CheckDlgButton(IDB_REMOTE_SERVER,       BST2STATE(m_dwCLSCTX & CLSCTX_REMOTE_SERVER));
  CheckDlgButton(IDB_INPROC_HANDLER,        BST2STATE(m_dwCLSCTX & CLSCTX_INPROC_HANDLER));
  wSendMessage(GetDlgItem(IDE_REMOTESERVER),    WM_SETTEXT, 0, m_wszRemoteServer);
    ::EnableWindow(GetDlgItem(IDE_REMOTESERVER), m_dwCLSCTX & CLSCTX_REMOTE_SERVER);

  //Set Connection Options to previous saved values
  CheckDlgButton(IDB_INIT_INITIALIZE,       BST2STATE(m_dwConnectOpts & CREATE_INITIALIZE));
  CheckDlgButton(IDB_INIT_SETPROPERTIES,      BST2STATE(m_dwConnectOpts & CREATE_SETPROPERTIES));

  //NOTE: Currently these options are repeaded from the Global dialog (since we reuse it)
  //Just allow setting/unsetting global options here for convinence, but these are not
  //saved per configuration, since all other objects after this point would need to reference this
  //making it difficult unless we did it for just connection QI's and the rest are based upon global
  //settings...
  CheckDlgButton(IDB_QI_MANDATORY,        BST2STATE(pCMainWindow->GetOptions()->m_dwCreateOpts & CREATE_QI_MANDATORY));
  CheckDlgButton(IDB_QI_OPTIONAL,         BST2STATE(pCMainWindow->GetOptions()->m_dwCreateOpts & CREATE_QI_OPTIONAL));

  //Set Other Options
  CheckDlgButton(IDB_USESERVICECOMP,        BST2STATE(m_dwConnectOpts & CREATE_USESERVICECOMP));
  return TRUE;
}

BOOL CFullConnectOptions::UpdateOptions ( ) [virtual]

Definition at line 1463 of file cdialog.cpp.

{
  CFullConnect* pCFullConnect = (CFullConnect*)GetParent();
  CMainWindow* pCMainWindow = pCFullConnect->m_pCMainWindow;

  //Obtain CLSCTX
  m_dwCLSCTX = 0;
  if(IsDlgButtonChecked(IDB_INPROC_SERVER))
    m_dwCLSCTX |= CLSCTX_INPROC_SERVER;
  if(IsDlgButtonChecked(IDB_LOCAL_SERVER))
    m_dwCLSCTX |= CLSCTX_LOCAL_SERVER;
  if(IsDlgButtonChecked(IDB_REMOTE_SERVER))
    m_dwCLSCTX |= CLSCTX_REMOTE_SERVER;
  if(IsDlgButtonChecked(IDB_INPROC_HANDLER))
    m_dwCLSCTX |= CLSCTX_INPROC_HANDLER;

  //Obtain RemoteServer
  wSendMessage(GetDlgItem(IDE_REMOTESERVER), WM_GETTEXT, MAX_NAME_LEN, m_wszRemoteServer);

  //Obtain Connection Options
  m_dwConnectOpts = 0;
  if(IsDlgButtonChecked(IDB_INIT_INITIALIZE))
    m_dwConnectOpts |= CREATE_INITIALIZE;
  if(IsDlgButtonChecked(IDB_INIT_SETPROPERTIES))
    m_dwConnectOpts |= CREATE_SETPROPERTIES;

  //NOTE: Currently these options are repeaded from the Global dialog (since we reuse it)
  //Just allow setting/unsetting global options here for convinence, but these are not
  //saved per configuration, since all other objects after this point would need to reference this
  //making it difficult unless we did it for just connection QI's and the rest are based upon global
  //settings...
  ENABLE_BIT(pCMainWindow->GetOptions()->m_dwCreateOpts, CREATE_QI_MANDATORY, IsDlgButtonChecked(IDB_QI_MANDATORY));
  ENABLE_BIT(pCMainWindow->GetOptions()->m_dwCreateOpts, CREATE_QI_OPTIONAL,  IsDlgButtonChecked(IDB_QI_OPTIONAL));

  //Obtain Other Options
  if(IsDlgButtonChecked(IDB_USESERVICECOMP))
    m_dwConnectOpts |= CREATE_USESERVICECOMP;
  return TRUE;
}

Member Data Documentation

DWORD CFullConnectOptions::m_dwCLSCTX

Definition at line 430 of file cdialog.h.

DWORD CFullConnectOptions::m_dwConnectOpts

Definition at line 432 of file cdialog.h.

WCHAR CFullConnectOptions::m_wszRemoteServer[MAX_NAME_LEN+1]

Definition at line 431 of file cdialog.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialog.h
  • Dataaccess/oledb/rowsetviewer/cdialog.cpp
Generated on Wed Nov 13 2024 16:56:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CFullConnectProperties Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CFullConnectProperties Class Reference

#include "cdialog.h"

Inherits CPropPageLite.

List of all members.

Public Member Functions

CFullConnectProperties ()
virtual BOOL | OnCommand (UINT iID, HWND hWndCtrl)
virtual BOOL | OnInitDialog ()
virtual BOOL | OnKillActive ()
virtual BOOL | OnSetActive ()
virtual BOOL | RefreshProperties ()
virtual BOOL | UpdateProperties ()

Public Attributes

LONG | m_dwAsynchProp
LCID | m_dwlcidProp
LONG | m_dwModeProp
LONG | m_dwTimeoutProp
WCHAR | m_wszCatalog [MAX_NAME_LEN+1]
WCHAR | m_wszProvString [MAX_NAME_LEN+1]

Detailed Description

Definition at line 354 of file cdialog.h.

Constructor & Destructor Documentation

CFullConnectProperties::CFullConnectProperties ( )

Definition at line 904 of file cdialog.cpp.

  : CPropPageLite(IDD_FULLCONNECT_PROPERTIES, "Properties")
{
}

Member Function Documentation

BOOL CFullConnectProperties::OnCommand | ( | UINT | iID,
 |  | HWND | hWndCtrl |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 1075 of file cdialog.cpp.

{
  CFullConnect* pCFullConnect = (CFullConnect*)GetParent();

  switch(iID)
  {
    case IDB_MOREPROPERTIES:
    {
      pCFullConnect->GetAdvProperties();
      RefreshProperties();
      return TRUE;
    }

    case IDB_BROWSE_PROVSTRING:
    {
      pCFullConnect->m_idSource = IDE_PROVSTRING;

      POINTS pts;
      GetWindowPos(GetDlgItem(IDB_BROWSE_PROVSTRING), &pts);

      //Display the Context Menu
      DisplayContextMenu(
            m_hWnd,
            IDM_BROWSE_OPTION,
            pts,
            m_hWnd
            );
      return TRUE;
    }

    case IDM_BROWSE_FILE:
    {
      WCHAR* pwszTitle = NULL;
      WCHAR* pwszBuffer = NULL;

      switch(pCFullConnect->m_idSource)
      {
        case IDE_PROVSTRING:
        {
          pwszTitle = L"DBPROP_INIT_PROVIDERSTRING";
          pwszBuffer = m_wszProvString;
          break;
        }

        default:
          ASSERT(!"Unhandled Source!");
          break;
      }

      //Display Common Dialog to obtain DataSource...
      //This is for providers that take a filename/path for this property
      if(SUCCEEDED(BrowseOpenFileName(GetAppLite()->m_hInstance, m_hWnd, pwszTitle, pwszBuffer, MAX_NAME_LEN, NULL, L"DataSource Files (.dsn;.kag;.sav)\0*.dsn;*.kag;*.sav;\0DataBase Files (.mdb;.db;.dbf)\0*.mdb;*.db;*.dbf;\0Program Files (.xls;.clb)\0*.xls;*.clb;\0Text Files (.txt;.csv)\0*.txt;*.csv\0All Files (*.*)\0*.*\0\0")))
      {
        CEditBoxLite editSource;
        editSource.CreateIndirect(m_hWnd, pCFullConnect->m_idSource);

        //Just update value
        editSource.ReplaceAll(pwszBuffer);
      }
      return TRUE;
    }

    case IDM_BROWSE_ENUM:
    {
      DisplayDialog(IDD_BROWSE_ENUM, m_hWnd, CFullConnect::BrowseEnumeratorProc, (LPARAM)pCFullConnect);
      return TRUE;
    }
  };

  return FALSE;
}

BOOL CFullConnectProperties::OnInitDialog ( ) [virtual]

Reimplemented from CDialogLite.

Definition at line 913 of file cdialog.cpp.

{
  //PropertySheet (BackPointer)
  CFullConnect* pCFullConnect = (CFullConnect*)GetParent();
  CWaitCursor waitCursor;

  HWND hWndAsynch   = GetDlgItem(IDC_ASYNCH);
  HWND hWndLocale   = GetDlgItem(IDC_LOCALE);
  HWND hWndMode   = GetDlgItem(IDL_MODE);

  //DBPROP_INIT_ASYNCH
  const static WIDENAMEMAP rgAsynch[] =
  {
    VALUE_WCHAR(DBPROPVAL_ASYNCH_INITIALIZE),
  };

  //Fill in AsynchCombo
  pCFullConnect->InitPropCombo(hWndAsynch, NUMELE(rgAsynch), rgAsynch, m_dwAsynchProp);

  //Fill in LocaleCombo
  pCFullConnect->InitPropCombo(hWndLocale, g_cLCID, g_rgLCID, m_dwlcidProp);

  //DBPROP_INIT_MODE
  const static WIDENAMEMAP rgMode[] =
  {
    VALUE_WCHAR(DB_MODE_READ),
    VALUE_WCHAR(DB_MODE_WRITE),
    VALUE_WCHAR(DB_MODE_READWRITE),
    VALUE_WCHAR(DB_MODE_SHARE_DENY_READ),
    VALUE_WCHAR(DB_MODE_SHARE_DENY_WRITE),
    VALUE_WCHAR(DB_MODE_SHARE_EXCLUSIVE),
    VALUE_WCHAR(DB_MODE_SHARE_DENY_NONE),
  };

  //Fill in Mode ListBox
  SendMessage(hWndMode, LB_RESETCONTENT, 0, 0);
  for(ULONG i=0; i<NUMELE(rgMode); i++)
  {
    INDEX iSel = (INDEX)wSendMessage(hWndMode, LB_ADDSTRING, 0, rgMode[i].pwszName);
    SendMessage(hWndMode, LB_SETITEMDATA, iSel, (LPARAM)rgMode[i].lItem);
  }

  //Restore Saved Values
  RefreshProperties();

  //Delegate
  return CPropPageLite::OnInitDialog();
}

BOOL CFullConnectProperties::OnKillActive ( ) [virtual]

Reimplemented from CPropPageLite.

Definition at line 978 of file cdialog.cpp.

{
  return UpdateProperties();
}

BOOL CFullConnectProperties::OnSetActive ( ) [virtual]

Reimplemented from CPropPageLite.

Definition at line 967 of file cdialog.cpp.

{
  RefreshProperties();
  return TRUE;
}

BOOL CFullConnectProperties::RefreshProperties ( ) [virtual]

Definition at line 988 of file cdialog.cpp.

{
  HWND hWndMode   = GetDlgItem(IDL_MODE);
  CComboBoxLite   comboAsynch(m_hWnd, IDC_ASYNCH);
  CComboBoxLite   comboLocale(m_hWnd, IDC_LOCALE);

  //Restore Saved Values - Properties
  wSendMessage(GetDlgItem(IDE_PROVSTRING),  WM_SETTEXT, 0, m_wszProvString);
  wSendMessage(GetDlgItem(IDC_CATALOG),   WM_SETTEXT, 0, m_wszCatalog);

  //Timeout
  if(m_dwTimeoutProp != NOTSET)
    wSendMessageFmt(GetDlgItem(IDE_TIMEOUT),  WM_SETTEXT, 0, L"%d", m_dwTimeoutProp);

  //Fill in AsynchCombo
  comboAsynch.SetSelValue(m_dwAsynchProp);

  //Fill in LocaleCombo
  comboLocale.SetSelValue(m_dwlcidProp);

  //Fill in Mode ListBox
  INDEX iCount = (INDEX)SendMessage(hWndMode, LB_GETCOUNT, 0, 0);
  for(LONG i=0; i<iCount; i++)
  {
    //Reselect Mode Options (turn it on or off...)
    LPARAM lParam = SendMessage(hWndMode, LB_GETITEMDATA, i, 0);

    if(m_dwModeProp == NOTSET)
       SendMessage(hWndMode, LB_SETSEL, 0, i); //Turn off
    else
       SendMessage(hWndMode, LB_SETSEL, (lParam & m_dwModeProp) == lParam, i);
  }

  return TRUE;
}

BOOL CFullConnectProperties::UpdateProperties ( ) [virtual]

Definition at line 1029 of file cdialog.cpp.

{
  //Retrieve Values from Properties Sheet
  HWND hWndAsynch = GetDlgItem(IDC_ASYNCH);
  HWND hWndLocale = GetDlgItem(IDC_LOCALE);
  HWND hWndMode = GetDlgItem(IDL_MODE);

  wSendMessage(GetDlgItem(IDE_PROVSTRING),  WM_GETTEXT, MAX_NAME_LEN, m_wszProvString);
  wSendMessage(GetDlgItem(IDC_CATALOG),   WM_GETTEXT, MAX_NAME_LEN, m_wszCatalog);

  //Obtain Asynch Value
  INDEX iSel = (INDEX)SendMessage(hWndAsynch, CB_GETCURSEL, 0, 0);
  m_dwAsynchProp = (DWORD)SendMessage(hWndAsynch, CB_GETITEMDATA, iSel, 0);

  //Obtain Locale Value
  iSel = (INDEX)SendMessage(hWndLocale, CB_GETCURSEL, 0, 0);
  m_dwlcidProp = (DWORD)SendMessage(hWndLocale, CB_GETITEMDATA, iSel, 0);

  //Timeout
  m_dwTimeoutProp = NOTSET;
  if(!GetEditBoxValue(GetDlgItem(IDE_TIMEOUT), &m_dwTimeoutProp, 0/*Min*/, LONG_MAX/*Max*/, TRUE))
  {
    m_dwTimeoutProp = NOTSET;
    return FALSE;
  }

  //Obtain all Mode Selected Items...
  INDEX iSelCount = (INDEX)SendMessage(hWndMode, LB_GETSELCOUNT, 0, 0);
  ASSERT(iSelCount < 20);
  LONG rgSelItems[20];
  SendMessage(hWndMode, LB_GETSELITEMS, (WPARAM)20, (LPARAM)rgSelItems);

  m_dwModeProp = iSelCount ? 0 : NOTSET;
  for(LONG i=0; i<iSelCount; i++)
  {
    m_dwModeProp |= SendMessage(hWndMode, LB_GETITEMDATA, rgSelItems[i], 0);
  }

  return TRUE;
}

Member Data Documentation

LONG CFullConnectProperties::m_dwAsynchProp

Definition at line 373 of file cdialog.h.

LCID CFullConnectProperties::m_dwlcidProp

Definition at line 372 of file cdialog.h.

LONG CFullConnectProperties::m_dwModeProp

Definition at line 375 of file cdialog.h.

LONG CFullConnectProperties::m_dwTimeoutProp

Definition at line 374 of file cdialog.h.

WCHAR CFullConnectProperties::m_wszCatalog[MAX_NAME_LEN+1]

Definition at line 371 of file cdialog.h.

WCHAR CFullConnectProperties::m_wszProvString[MAX_NAME_LEN+1]

Definition at line 370 of file cdialog.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialog.h
  • Dataaccess/oledb/rowsetviewer/cdialog.cpp
Generated on Wed Nov 13 2024 16:56:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CFullConnectProvider Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CFullConnectProvider Class Reference

#include "cdialog.h"

Inherits CPropPageLite.

List of all members.

Public Member Functions

CFullConnectProvider ()
virtual HRESULT | GetProviderName ()
virtual BOOL | OnApply ()
virtual BOOL | OnCommand (UINT iID, HWND hWndCtrl)
virtual BOOL | OnCommandNotify (INT wNotifyCode, INT iID, HWND hWndCtrl)
virtual BOOL | OnDropDown (INT iID, HWND hWndCtrl)
virtual BOOL | OnInitDialog ()
virtual BOOL | OnKillActive ()
virtual BOOL | OnSelChange (INT iID, HWND hWndCtrl)
virtual BOOL | OnSetActive ()
virtual BOOL | RefreshEnum (BOOL fReconnect=FALSE)
virtual BOOL | RefreshProvider ()
virtual BOOL | UpdateProvider ()

Public Attributes

CComboBoxLite m_comboConfig
CComboBoxEx m_comboProvider
LONG | m_dwPromptProp
HWND | m_hWndProp
WCHAR | m_wszDataSource [MAX_NAME_LEN+1]
WCHAR | m_wszLocation [MAX_NAME_LEN+1]
WCHAR | m_wszPassword [MAX_NAME_LEN+1]
WCHAR | m_wszUserID [MAX_NAME_LEN+1]

Detailed Description

Definition at line 313 of file cdialog.h.

Constructor & Destructor Documentation

CFullConnectProvider::CFullConnectProvider ( )

Definition at line 414 of file cdialog.cpp.

  : CPropPageLite(IDD_FULLCONNECT_PROVIDER, "Provider")
{
}

Member Function Documentation

HRESULT CFullConnectProvider::GetProviderName ( ) [virtual]

Definition at line 755 of file cdialog.cpp.

{
  CFullConnect* pCFullConnect = (CFullConnect*)GetParent();
  ENUMINFO* pEnumInfo = &pCFullConnect->m_EnumInfo;

  //Obtain Provider from DropDown
  INDEX iIndex = m_comboProvider.GetCurSel();
  if(iIndex != CB_ERR)
  {
    //Since we have the CBS_SORT turned on.
    //we store the pointer ENUMINFO object in the item data
    ENUMINFO* pEnumInfoData = (ENUMINFO*)m_comboProvider.GetItemParam(iIndex);
    if(pEnumInfoData && (LPARAM)pEnumInfoData!=CB_ERR)
      memcpy(pEnumInfo, pEnumInfoData, sizeof(ENUMINFO));
  }
  else
  {
    //The user must have typed in a Provider Name directly
    //This may not map to a provider in the list, so assume the name is a ProgID/CLSID
    memset(pEnumInfo, 0, sizeof(ENUMINFO));
    m_comboProvider.GetWindowText(pEnumInfo->wszName, MAX_NAME_LEN);
    m_comboProvider.GetWindowText(pEnumInfo->wszParseName, MAX_NAME_LEN);
  }

  //Display Provider Info (Title of Window)
  wSendMessageFmt(::GetParent(m_hWnd), WM_SETTEXT, 0, L"Full Connect - %s", pEnumInfo->wszDescription[0] ? pEnumInfo->wszDescription : L"No Descripition Available");
  return S_OK;
}

BOOL CFullConnectProvider::OnApply ( ) [virtual]

Reimplemented from CPropPageLite.

Definition at line 482 of file cdialog.cpp.

{
  //PropertySheet (BackPointer)
  CFullConnect* pCFullConnect = (CFullConnect*)GetParent();
  CMainWindow* pCMainWindow = pCFullConnect->m_pCMainWindow;

  CWaitCursor waitCursor;
  GetProviderName();

  // Make a connection using the supplied values
  if(FAILED(pCFullConnect->FullConnect()))
    return FALSE;

  //Auto Save?
  BOOL bAutoSave = IsDlgButtonChecked(IDB_AUTOSAVE);
  if(bAutoSave)
    pCFullConnect->SaveDefaults();

  //Update Options
  ENABLE_BIT(pCMainWindow->GetOptions()->m_dwCreateOpts, CREATE_NO_AUTOSAVE, !bAutoSave);

  //delegate
  return CPropPageLite::OnApply();
}

BOOL CFullConnectProvider::OnCommand | ( | UINT | iID,
 |  | HWND | hWndCtrl |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 531 of file cdialog.cpp.

{
  CFullConnect* pCFullConnect = (CFullConnect*)GetParent();

  switch(iID)
  {
    case IDB_DEFAULTS:
    {
      pCFullConnect->ResetDefaults();
      return TRUE;
    }

    case IDB_CONFIG_SAVE:
    {
      //Now update registry
      UpdateProvider();
      pCFullConnect->SaveDefaults();
      return TRUE;
    }

    case IDB_CONFIG_REMOVE:
    {
      //Obtain the Selected Combo Text
      INDEX iSel = m_comboConfig.GetSelText(pCFullConnect->m_wszConfigName, MAX_NAME_LEN);

      //Remove this item from the ComboBox
      m_comboConfig.DeleteString(iSel);

      //Formulate the key
      WCHAR wszKeyName[MAX_NAME_LEN];
      StringFormat(wszKeyName, NUMELE(wszKeyName), L"%s\\%s", wszCONFIG_KEY, pCFullConnect->m_wszConfigName);

      //Now Remove this Item from the registry
      DelRegEntry(HKEY_ROWSETVIEWER, wszKeyName, TRUE/*fSubKeys*/);

      //We need to make sure this is not the default Config
      wszKeyName[0] = EOL;
      GetRegEntry(HKEY_ROWSETVIEWER, wszCONFIG_KEY, L"DefaultConfig", wszKeyName, MAX_NAME_LEN);
      if(StringCompare(wszKeyName, pCFullConnect->m_wszConfigName))
        SetRegEntry(HKEY_ROWSETVIEWER, wszCONFIG_KEY, L"DefaultConfig", L"(Default)");

      //And Remove it from our Recent Config List
      pCFullConnect->RemoveRecentConfig(pCFullConnect->m_wszConfigName);
      pCFullConnect->m_wszConfigName[0] = EOL;
      return TRUE;
    }

    case IDB_BROWSE_LOCATION:
    {
      pCFullConnect->m_idSource = IDE_LOCATION;

      POINTS pts;
      GetWindowPos(GetDlgItem(IDB_BROWSE_LOCATION), &pts);

      //Display the Context Menu
      DisplayContextMenu(
            m_hWnd,
            IDM_BROWSE_OPTION,
            pts,
            m_hWnd
            );
      return TRUE;
    }

    case IDB_BROWSE_DATASOURCE:
    {
      pCFullConnect->m_idSource = IDE_DATASOURCE;

      POINTS pts;
      GetWindowPos(GetDlgItem(IDB_BROWSE_DATASOURCE), &pts);

      //Display the Context Menu
      DisplayContextMenu(
            m_hWnd,
            IDM_BROWSE_OPTION,
            pts,
            m_hWnd
            );
      return TRUE;
    }

    case IDM_BROWSE_FILE:
    {
      WCHAR* pwszTitle = NULL;
      WCHAR* pwszBuffer = NULL;

      switch(pCFullConnect->m_idSource)
      {
        case IDE_DATASOURCE:
        {
          pwszTitle = L"DBPROP_INIT_DATASOURCE";
          pwszBuffer = m_wszDataSource;
          break;
        }

        case IDE_LOCATION:
        {
          pwszTitle = L"DBPROP_INIT_LOCATION";
          pwszBuffer = m_wszLocation;
          break;
        }

        default:
          ASSERT(!"Unhandled Source!");
          break;
      }

      //Display Common Dialog to obtain DataSource...
      //This is for providers that take a filename/path for this property
      if(SUCCEEDED(BrowseOpenFileName(GetAppLite()->m_hInstance, m_hWnd, pwszTitle, pwszBuffer, MAX_NAME_LEN, NULL, L"DataSource Files (.dsn;.kag;.sav)\0*.dsn;*.kag;*.sav;\0DataBase Files (.mdb;.db;.dbf)\0*.mdb;*.db;*.dbf;\0Program Files (.xls;.clb)\0*.xls;*.clb;\0Text Files (.txt;.csv)\0*.txt;*.csv\0All Files (*.*)\0*.*\0\0")))
      {
        CEditBoxLite editSource;
        editSource.CreateIndirect(m_hWnd, pCFullConnect->m_idSource);

        //Just update value
        editSource.ReplaceAll(pwszBuffer);
      }
      return TRUE;
    }

    case IDM_BROWSE_ENUM:
    {
      DisplayDialog(IDD_BROWSE_ENUM, m_hWnd, CFullConnect::BrowseEnumeratorProc, (LPARAM)pCFullConnect);
      return TRUE;
    }
  };

  return FALSE;
}

BOOL CFullConnectProvider::OnCommandNotify | ( | INT | wNotifyCode,
 |  | INT | iID,
 |  | HWND | hWndCtrl |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 665 of file cdialog.cpp.

{
  switch(wNotifyCode)
  {
    case CBN_SELCHANGE:
    {
      if(OnSelChange(iID, hWndCtrl))
        return TRUE;
      break;
    }

    case CBN_DROPDOWN:
    {
      if(OnDropDown(iID, hWndCtrl))
        return TRUE;
      break;
    }
  };

  //Otherwise Delegate
  return CWndLite::OnCommandNotify(wNotifyCode, iID, hWndCtrl);
}

BOOL CFullConnectProvider::OnDropDown | ( | INT | iID,
 |  | HWND | hWndCtrl |
 | ) |  |  | [virtual]

Definition at line 693 of file cdialog.cpp.

{
  switch(iID)
  {
    case IDC_PROVIDER:
    {
      CWaitCursor waitCursor;

      //NOTE: The Provider Combo box is deferred
      //since it requires the Root Enumerator which is quite
      //expensive, so only populate the provider combo
      //when user presses the drop down, otherwise it defaults
      //to their saved provider or MSDASQL...
      RefreshEnum();
      return TRUE;
    }
  };

  return FALSE;
}

BOOL CFullConnectProvider::OnInitDialog ( ) [virtual]

Reimplemented from CDialogLite.

Definition at line 423 of file cdialog.cpp.

{
  CWaitCursor waitCursor;

  //PropertySheet (BackPointer)
  CFullConnect* pCFullConnect = (CFullConnect*)GetParent();
  CMainWindow* pCMainWindow = pCFullConnect->m_pCMainWindow;

  //Controls...
  m_comboConfig.CreateIndirect(m_hWnd, IDC_CONFIG);

  //CombBoxEx (allows images and indentation)
  m_comboProvider.CreateIndirect(m_hWnd, IDC_PROVIDER);
  SendMessage(m_comboProvider.m_hWnd, CBEM_SETIMAGELIST, 0, (LPARAM)ImageList_LoadImage(GetAppLite()->m_hInstance, MAKEINTRESOURCE(IDB_IMAGE), 16, 16, CLR_DEFAULT , IMAGE_BITMAP, LR_DEFAULTCOLOR));

  //Setup our "dynamic" window handle property...
  //NOTE: We have to do this here, since this needs to not only be a valid window handle,
  //must it also be the full connect dialog handle, so that if the provider displays a prompt
  //dialog its "modal" to this one and not the main window...
  m_hWndProp    = (HWND)NOTSET;

  //Auto Save
  CheckDlgButton(IDB_AUTOSAVE,  BST2STATE(!(pCMainWindow->GetOptions()->m_dwCreateOpts & CREATE_NO_AUTOSAVE)));

  //Fill in Enumerator list
  //NOTE: The Enumerator Combo drop down is deferred, since its quite expensive.
  //The drop down is populated once the drop down is selected.  Before population
  //it defaults to the users saved config provider, or MSDASQL if not saved...

  //Obtain the property values for DBPROP_INIT_PROMPT
  ULONG cPropVals = 0;
  const WIDENAMEMAP* rgPropVals = NULL;
  if(SUCCEEDED(GetStaticPropValues(DBPROP_INIT_PROMPT, DBPROPSET_DBINIT, &cPropVals, &rgPropVals)))
  {
    //Fill in Prompt Combo
    pCFullConnect->InitPropCombo(GetDlgItem(IDC_PROMPT), cPropVals, rgPropVals, m_dwPromptProp == NOTSET ? 0 : m_dwPromptProp);
  }

  //Load all items from the Registry
  //Limit it to the first 200 registry entries!
  //So we don't spend all day loading this combo box!
  WCHAR wszBuffer[MAX_NAME_LEN];
  for(ULONG i=0; i<200; i++)
  {
    if(S_OK != GetRegEnumKey(HKEY_ROWSETVIEWER, wszCONFIG_KEY, i, wszBuffer, MAX_NAME_LEN))
      break;

    m_comboConfig.AddString(wszBuffer);
  }

  //Delegate
  return CPropPageLite::OnInitDialog();
}

BOOL CFullConnectProvider::OnKillActive ( ) [virtual]

Reimplemented from CPropPageLite.

Definition at line 521 of file cdialog.cpp.

{
  return UpdateProvider();
}

BOOL CFullConnectProvider::OnSelChange | ( | INT | iID,
 |  | HWND | hWndCtrl |
 | ) |  |  | [virtual]

Definition at line 718 of file cdialog.cpp.

{
  CFullConnect* pCFullConnect = (CFullConnect*)GetParent();

  switch(iID)
  {
    case IDC_CONFIG:
    {
      //Obtain the Selected Combo Text
      m_comboConfig.GetSelText(pCFullConnect->m_wszConfigName, MAX_NAME_LEN);

      //Now we need to update the FullConnect for this Config
      pCFullConnect->LoadDefaults();
      RefreshProvider();
      return TRUE;
    }

    case IDC_PROVIDER:
    {
      //Need to remove any previously set properties.
      //Specifically any Advanced properties, since this is a new configuration
      pCFullConnect->m_CPropSets.RemoveAll();

      //Save the newly selected provider
      GetProviderName();
      return TRUE;
    }
  };

  return FALSE;
}

BOOL CFullConnectProvider::OnSetActive ( ) [virtual]

Reimplemented from CPropPageLite.

Definition at line 511 of file cdialog.cpp.

{
  RefreshProvider();
  return TRUE;
}

BOOL CFullConnectProvider::RefreshEnum ( BOOL fReconnect = FALSE ) [virtual]

Definition at line 789 of file cdialog.cpp.

{
  CFullConnect* pCFullConnect = (CFullConnect*)GetParent();
  CMainWindow* pCMainWindow = pCFullConnect->m_pCMainWindow;
  ENUMINFO* pEnumInfo = &pCFullConnect->m_EnumInfo;

  //Remove all previous entries
  m_comboProvider.ResetContent();

  //Initialize the Enumerator to establish a list of
  //Providers and Enumerators, if we don'thave them already
  if(pCFullConnect->m_pCEnumerator == NULL)
  {
    CEnumerator* pCRootEnum = pCMainWindow->m_pCRootEnumerator;

    //No need to check the HRESULT since CEnumerator is capable of instantiating
    //objects, even without the RootEnum...
    pCRootEnum->CreateEnumInfo(CLSID_OLEDB_ENUMERATOR, fReconnect);

    //Fill out the provider name combo box.
    for(ULONG i=0; i<pCRootEnum->m_cEnumInfo; i++)
    {
      ENUMINFO* pEnumInfo = &pCRootEnum->m_rgEnumInfo[i];

      //Determine the Image to use
      UINT iImage = IMAGE_QUESTION;
      if(pEnumInfo->eType == DBSOURCETYPE_DATASOURCE)
        iImage = IMAGE_NORMAL;
      else if(pEnumInfo->eType == DBSOURCETYPE_ENUMERATOR)
        iImage = IMAGE_OBJECTS;
      else if(pEnumInfo->eType == DBSOURCETYPE_BINDER)
        iImage = IMAGE_CHAPTER;
      else if(pEnumInfo->eType == DBSOURCETYPE_DATASOURCE_MDP)
        iImage = IMAGE_CUBE;

      //Add the name to the list
      //Since we have the CBS_SORT turned on.
      //we store the pointer ENUMINFO object in the item data
      m_comboProvider.InsertItem(-1/*iItem*/, pEnumInfo->wszName, (LPARAM)pEnumInfo, PARAM_NONE/*iIndent*/, iImage, iImage);
    }
  }

  //Try to find Previous Selection by default
  m_comboProvider.SetSelText(pEnumInfo->wszName, TRUE/*fAddItem*/);

  //Obtain Provider
  GetProviderName();
  return TRUE;
}

BOOL CFullConnectProvider::RefreshProvider ( ) [virtual]

Definition at line 845 of file cdialog.cpp.

{
  CFullConnect* pCFullConnect = (CFullConnect*)GetParent();

  //Try to find our Saved Provider
  m_comboProvider.SetSelText(pCFullConnect->m_EnumInfo.wszName, TRUE/*fAddItem*/);

  //Obtain Provider from DropDown
  GetProviderName();

  //Restore Saved Values - Properties
  wSendMessage(GetDlgItem(IDE_LOCATION),    WM_SETTEXT, 0, m_wszLocation);
  wSendMessage(GetDlgItem(IDE_DATASOURCE),  WM_SETTEXT, 0, m_wszDataSource);
  wSendMessage(GetDlgItem(IDE_USERID),    WM_SETTEXT, 0, m_wszUserID);
  wSendMessage(GetDlgItem(IDE_PASSWORD),    WM_SETTEXT, 0, m_wszPassword);

  //Set Prompt Combo
  CComboBoxLite comboPrompt(m_hWnd, IDC_PROMPT);
  comboPrompt.SetSelValue(m_dwPromptProp);

  //Try to find our Defaut Configuration
  m_comboConfig.SetSelText(pCFullConnect->m_wszConfigName, TRUE/*fAddItem*/);
  return TRUE;
}

BOOL CFullConnectProvider::UpdateProvider ( ) [virtual]

Definition at line 875 of file cdialog.cpp.

{
  CFullConnect* pCFullConnect = (CFullConnect*)GetParent();

  //Obtain Provider Selection
  GetProviderName();

  //Obtain Property Values
  wSendMessage(GetDlgItem(IDE_LOCATION),    WM_GETTEXT, MAX_NAME_LEN, m_wszLocation);
  wSendMessage(GetDlgItem(IDE_DATASOURCE),  WM_GETTEXT, MAX_NAME_LEN, m_wszDataSource);
  wSendMessage(GetDlgItem(IDE_USERID),    WM_GETTEXT, MAX_NAME_LEN, m_wszUserID);
  wSendMessage(GetDlgItem(IDE_PASSWORD),    WM_GETTEXT, MAX_NAME_LEN, m_wszPassword);

  //Obtain Prompt Value
  INDEX iSel = (INDEX)SendMessage(GetDlgItem(IDC_PROMPT), CB_GETCURSEL, 0, 0);
  m_dwPromptProp = (DWORD)SendMessage(GetDlgItem(IDC_PROMPT), CB_GETITEMDATA, iSel, 0);

  //Obtain Configuration Name
  m_comboConfig.GetSelText(pCFullConnect->m_wszConfigName, MAX_NAME_LEN);
  return TRUE;
}

Member Data Documentation

CComboBoxLite CFullConnectProvider::m_comboConfig

Definition at line 345 of file cdialog.h.

CComboBoxEx CFullConnectProvider::m_comboProvider

Definition at line 346 of file cdialog.h.

LONG CFullConnectProvider::m_dwPromptProp

Definition at line 341 of file cdialog.h.

HWND CFullConnectProvider::m_hWndProp

Definition at line 342 of file cdialog.h.

WCHAR CFullConnectProvider::m_wszDataSource[MAX_NAME_LEN+1]

Definition at line 338 of file cdialog.h.

WCHAR CFullConnectProvider::m_wszLocation[MAX_NAME_LEN+1]

Definition at line 337 of file cdialog.h.

WCHAR CFullConnectProvider::m_wszPassword[MAX_NAME_LEN+1]

Definition at line 340 of file cdialog.h.

WCHAR CFullConnectProvider::m_wszUserID[MAX_NAME_LEN+1]

Definition at line 339 of file cdialog.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialog.h
  • Dataaccess/oledb/rowsetviewer/cdialog.cpp
Generated on Wed Nov 13 2024 16:56:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CFullConnectSecurity Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CFullConnectSecurity Class Reference

#include "cdialog.h"

Inherits CPropPageLite.

List of all members.

Public Member Functions

CFullConnectSecurity ()
virtual BOOL | OnCommand (UINT iID, HWND hWndCtrl)
virtual BOOL | OnInitDialog ()
virtual BOOL | OnKillActive ()
virtual BOOL | OnSetActive ()
virtual BOOL | RefreshSecurity ()
virtual BOOL | UpdateSecurity ()

Public Attributes

VARIANT_BOOL | m_dwCacheProp
VARIANT_BOOL | m_dwEncryptPasswordProp
LONG | m_dwImpersonateProp
VARIANT_BOOL | m_dwMaskPasswordProp
VARIANT_BOOL | m_dwPersistEncryptProp
VARIANT_BOOL | m_dwPersistProp
LONG | m_dwProtectionProp
WCHAR | m_wszIntegrated [MAX_NAME_LEN+1]

Detailed Description

Definition at line 383 of file cdialog.h.

Constructor & Destructor Documentation

CFullConnectSecurity::CFullConnectSecurity ( )

Definition at line 1153 of file cdialog.cpp.

  : CPropPageLite(IDD_FULLCONNECT_SECURITY, "Security")
{
}

Member Function Documentation

BOOL CFullConnectSecurity::OnCommand | ( | UINT | iID,
 |  | HWND | hWndCtrl |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 1231 of file cdialog.cpp.

{
  CFullConnect* pCFullConnect = (CFullConnect*)GetParent();

  switch(iID)
  {
    case IDB_BROWSE_INTEGRATED:
    {
      pCFullConnect->m_idSource = IDE_INTEGRATED;

      POINTS pts;
      GetWindowPos(GetDlgItem(IDB_BROWSE_INTEGRATED), &pts);

      //Display the Context Menu
      DisplayContextMenu(
            m_hWnd,
            IDM_BROWSE_OPTION,
            pts,
            m_hWnd
            );
      return TRUE;
    }

    case IDM_BROWSE_FILE:
    {
      WCHAR* pwszTitle = NULL;
      WCHAR* pwszBuffer = NULL;

      switch(pCFullConnect->m_idSource)
      {
        case IDE_INTEGRATED:
        {
          pwszTitle = L"DBPROP_AUTH_INTEGRATED";
          pwszBuffer = m_wszIntegrated;
          break;
        }

        default:
          ASSERT(!"Unhandled Source!");
          break;
      }

      //Display Common Dialog to obtain DataSource...
      //This is for providers that take a filename/path for this property
      if(SUCCEEDED(BrowseOpenFileName(GetAppLite()->m_hInstance, m_hWnd, pwszTitle, pwszBuffer, MAX_NAME_LEN, NULL, L"DataSource Files (.dsn;.kag;.sav)\0*.dsn;*.kag;*.sav;\0DataBase Files (.mdb;.db;.dbf)\0*.mdb;*.db;*.dbf;\0Program Files (.xls;.clb)\0*.xls;*.clb;\0Text Files (.txt;.csv)\0*.txt;*.csv\0All Files (*.*)\0*.*\0\0")))
      {
        CEditBoxLite editSource;
        editSource.CreateIndirect(m_hWnd, pCFullConnect->m_idSource);

        //Just update value
        editSource.ReplaceAll(pwszBuffer);
      }
      return TRUE;
    }

    case IDM_BROWSE_ENUM:
    {
      DisplayDialog(IDD_BROWSE_ENUM, m_hWnd, CFullConnect::BrowseEnumeratorProc, (LPARAM)pCFullConnect);
      return TRUE;
    }
  };

  return FALSE;
}

BOOL CFullConnectSecurity::OnInitDialog ( ) [virtual]

Reimplemented from CDialogLite.

Definition at line 1162 of file cdialog.cpp.

{
  CWaitCursor waitCursor;

  //PropertySheet (BackPointer)
  CFullConnect* pCFullConnect = (CFullConnect*)GetParent();

  HWND hWndProtection = GetDlgItem(IDC_PROTECTION);
  HWND hWndImpersonation = GetDlgItem(IDC_IMPERSONATE);

  //DBPROP_INIT_PROTECTION_LEVEL
  const static WIDENAMEMAP rgProtection[] =
  {
    VALUE_WCHAR(DB_PROT_LEVEL_NONE),
    VALUE_WCHAR(DB_PROT_LEVEL_CONNECT),
    VALUE_WCHAR(DB_PROT_LEVEL_CALL),
    VALUE_WCHAR(DB_PROT_LEVEL_PKT),
    VALUE_WCHAR(DB_PROT_LEVEL_PKT_INTEGRITY),
    VALUE_WCHAR(DB_PROT_LEVEL_PKT_PRIVACY),
  };

  //Fill in ProtectionCombo
  pCFullConnect->InitPropCombo(hWndProtection, NUMELE(rgProtection), rgProtection, m_dwProtectionProp);

  //DBPROP_INIT_IMPERSONATION_LEVEL
  const static WIDENAMEMAP rgImpersonation[] =
  {
    VALUE_WCHAR(DB_IMP_LEVEL_ANONYMOUS),
    VALUE_WCHAR(DB_IMP_LEVEL_IDENTIFY),
    VALUE_WCHAR(DB_IMP_LEVEL_IMPERSONATE),
    VALUE_WCHAR(DB_IMP_LEVEL_DELEGATE),
  };

  //Fill in ImpersonationCombo
  pCFullConnect->InitPropCombo(hWndImpersonation, NUMELE(rgImpersonation), rgImpersonation, m_dwImpersonateProp);

  //Restore Saved Values
  RefreshSecurity();

  //Delegate
  return CPropPageLite::OnInitDialog();
}

BOOL CFullConnectSecurity::OnKillActive ( ) [virtual]

Reimplemented from CPropPageLite.

Definition at line 1221 of file cdialog.cpp.

{
  return UpdateSecurity();
}

BOOL CFullConnectSecurity::OnSetActive ( ) [virtual]

Reimplemented from CPropPageLite.

Definition at line 1210 of file cdialog.cpp.

{
  RefreshSecurity();
  return TRUE;
}

BOOL CFullConnectSecurity::RefreshSecurity ( ) [virtual]

Definition at line 1301 of file cdialog.cpp.

{
  CComboBoxLite     comboProtection(m_hWnd, IDC_PROTECTION);
  CComboBoxLite     comboImpersonation(m_hWnd, IDC_IMPERSONATE);

  //Fill in ProtectionCombo
  comboProtection.SetSelValue(m_dwProtectionProp);

  //Fill in ImpersonationCombo
  comboImpersonation.SetSelValue(m_dwImpersonateProp);

  //Restore Saved Values
  CheckDlgButton(IDB_MASKPASSWORD,    m_dwMaskPasswordProp == VARIANT_TRUE ? BST_CHECKED : m_dwMaskPasswordProp == VARIANT_FALSE ? BST_INDETERMINATE : BST_UNCHECKED);
  CheckDlgButton(IDB_ENCRYPTPASSWORD,   m_dwEncryptPasswordProp == VARIANT_TRUE ? BST_CHECKED : m_dwEncryptPasswordProp == VARIANT_FALSE ? BST_INDETERMINATE : BST_UNCHECKED);
  CheckDlgButton(IDB_CACHEINFO,     m_dwCacheProp == VARIANT_TRUE ? BST_CHECKED : m_dwCacheProp == VARIANT_FALSE ? BST_INDETERMINATE : BST_UNCHECKED);
  CheckDlgButton(IDB_PERSISTINFO,     m_dwPersistProp == VARIANT_TRUE ? BST_CHECKED : m_dwPersistProp == VARIANT_FALSE ? BST_INDETERMINATE : BST_UNCHECKED);
  CheckDlgButton(IDB_ENCRYPTINFO,     m_dwPersistEncryptProp == VARIANT_TRUE ? BST_CHECKED : m_dwPersistEncryptProp == VARIANT_FALSE ? BST_INDETERMINATE : BST_UNCHECKED);

  //Restore Save Values - Integrated
  wSendMessage(GetDlgItem(IDE_INTEGRATED),  WM_SETTEXT, 0, m_wszIntegrated);
  return TRUE;
}

BOOL CFullConnectSecurity::UpdateSecurity ( ) [virtual]

Definition at line 1329 of file cdialog.cpp.

{
  //Retrieve Values from Security Sheet
  HWND hWndProtection = GetDlgItem(IDC_PROTECTION);
  HWND hWndImpersonate = GetDlgItem(IDC_IMPERSONATE);

  //Obtain Protection Value
  INDEX iSel = (INDEX)SendMessage(hWndProtection, CB_GETCURSEL, 0, 0);
  m_dwProtectionProp = (DWORD)SendMessage(hWndProtection, CB_GETITEMDATA, iSel, 0);

  //Obtain Impersonate Value
  iSel = (INDEX)SendMessage(hWndImpersonate, CB_GETCURSEL, 0, 0);
  m_dwImpersonateProp = (DWORD)SendMessage(hWndImpersonate, CB_GETITEMDATA, iSel, 0);

  //MaskPassword
  m_dwMaskPasswordProp = IsDlgButtonChecked(IDB_MASKPASSWORD) == BST_CHECKED ? VARIANT_TRUE : IsDlgButtonChecked(IDB_MASKPASSWORD) == BST_INDETERMINATE ? VARIANT_FALSE : NOTSET;

  //m_dwEncryptPasswordProp
  m_dwEncryptPasswordProp  = IsDlgButtonChecked(IDB_ENCRYPTPASSWORD) == BST_CHECKED ? VARIANT_TRUE : IsDlgButtonChecked(IDB_ENCRYPTPASSWORD) == BST_INDETERMINATE ? VARIANT_FALSE : NOTSET;

  //m_dwCacheProp
  m_dwCacheProp = IsDlgButtonChecked(IDB_CACHEINFO) == BST_CHECKED ? VARIANT_TRUE : IsDlgButtonChecked(IDB_CACHEINFO) == BST_INDETERMINATE ? VARIANT_FALSE : NOTSET;

  //m_dwPersistProp
  m_dwPersistProp = IsDlgButtonChecked(IDB_PERSISTINFO) == BST_CHECKED ? VARIANT_TRUE : IsDlgButtonChecked(IDB_PERSISTINFO) == BST_INDETERMINATE ? VARIANT_FALSE : NOTSET;

  //m_dwPersistEncryptProp
  m_dwPersistEncryptProp = IsDlgButtonChecked(IDB_ENCRYPTINFO) == BST_CHECKED ? VARIANT_TRUE : IsDlgButtonChecked(IDB_ENCRYPTINFO) == BST_INDETERMINATE ? VARIANT_FALSE : NOTSET;

  wSendMessage(GetDlgItem(IDE_INTEGRATED),  WM_GETTEXT, MAX_NAME_LEN, m_wszIntegrated);
  return TRUE;
}

Member Data Documentation

VARIANT_BOOL CFullConnectSecurity::m_dwCacheProp

Definition at line 403 of file cdialog.h.

VARIANT_BOOL CFullConnectSecurity::m_dwEncryptPasswordProp

Definition at line 402 of file cdialog.h.

LONG CFullConnectSecurity::m_dwImpersonateProp

Definition at line 400 of file cdialog.h.

VARIANT_BOOL CFullConnectSecurity::m_dwMaskPasswordProp

Definition at line 401 of file cdialog.h.

VARIANT_BOOL CFullConnectSecurity::m_dwPersistEncryptProp

Definition at line 405 of file cdialog.h.

VARIANT_BOOL CFullConnectSecurity::m_dwPersistProp

Definition at line 404 of file cdialog.h.

LONG CFullConnectSecurity::m_dwProtectionProp

Definition at line 399 of file cdialog.h.

WCHAR CFullConnectSecurity::m_wszIntegrated[MAX_NAME_LEN+1]

Definition at line 406 of file cdialog.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialog.h
  • Dataaccess/oledb/rowsetviewer/cdialog.cpp
Generated on Wed Nov 13 2024 16:56:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CFullPropSpec Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CFullPropSpec Class Reference

#include "PropSpec.Hxx"

List of all members.

Public Member Functions

CFullPropSpec ()
CFullPropSpec (GUID const &guidPropSet, PROPID pidProperty)
CFullPropSpec (CFullPropSpec const &Property)
CFullPropSpec (GUID const &guidPropSet, WCHAR const *wcsProperty)
~CFullPropSpec ()
FULLPROPSPEC * | CastToStruct ()
FULLPROPSPEC const * | CastToStruct () const
WCHAR const * | GetPropertyName () const
PROPID | GetPropertyPropid () const
GUID const & | GetPropSet () const
PROPSPEC | GetPropSpec () const
BOOL | IsPropertyName () const
BOOL | IsPropertyPropid () const
BOOL | IsValid () const
void | operator delete (void *p)
void * | operator new (size_t size)
void * | operator new (size_t size, void *p)
int | operator!= (CFullPropSpec const &prop) const
CFullPropSpec & | operator= (CFullPropSpec const &Property)
int | operator== (CFullPropSpec const &prop) const
BOOL | SetProperty (WCHAR const *wcsProperty)
void | SetProperty (PROPID pidProperty)
void | SetPropSet (GUID const &guidPropSet)

Private Attributes

GUID | _guidPropSet
PROPSPEC | _psProperty

Detailed Description

Definition at line 25 of file PropSpec.Hxx.

Constructor & Destructor Documentation

CFullPropSpec::CFullPropSpec ( )

Definition at line 27 of file PropSpec.Cxx.

{
    memset( &_guidPropSet, 0, sizeof( _guidPropSet ) );
    _psProperty.ulKind = PRSPEC_PROPID;
    _psProperty.propid = 0;
}

CFullPropSpec::CFullPropSpec | ( | GUID const & | guidPropSet,
 |  | PROPID | pidProperty
 | ) |  |

Definition at line 45 of file PropSpec.Cxx.

        : _guidPropSet( guidPropSet )
{
    _psProperty.ulKind = PRSPEC_PROPID;
    _psProperty.propid = pidProperty;
}

CFullPropSpec::CFullPropSpec | ( | GUID const & | guidPropSet,
 |  | WCHAR const * | wcsProperty
 | ) |  |

Definition at line 63 of file PropSpec.Cxx.

        : _guidPropSet( guidPropSet )
{
    _psProperty.ulKind = PRSPEC_PROPID;
    SetProperty( wcsProperty );
}

CFullPropSpec::CFullPropSpec ( CFullPropSpec const & Property )

Definition at line 81 of file PropSpec.Cxx.

        : _guidPropSet( src._guidPropSet )
{
    _psProperty.ulKind = src._psProperty.ulKind;

    if ( _psProperty.ulKind == PRSPEC_LPWSTR )
    {
        if ( src._psProperty.lpwstr )
        {
            _psProperty.ulKind = PRSPEC_PROPID;
            SetProperty( src._psProperty.lpwstr );
        }
        else
            _psProperty.lpwstr = 0;

    }
    else
    {
        _psProperty.propid = src._psProperty.propid;
    }
}

CFullPropSpec::~CFullPropSpec ( )

Definition at line 134 of file PropSpec.Cxx.

{
    if ( _psProperty.ulKind == PRSPEC_LPWSTR &&
         _psProperty.lpwstr )
    {
        CoTaskMemFree( _psProperty.lpwstr );
    }
}

Member Function Documentation

FULLPROPSPEC* CFullPropSpec::CastToStruct ( ) [inline]
FULLPROPSPEC const* CFullPropSpec::CastToStruct ( ) const [inline]
WCHAR const * CFullPropSpec::GetPropertyName ( ) const [inline]

Definition at line 146 of file PropSpec.Hxx.

{
    return( _psProperty.lpwstr );
}

PROPID CFullPropSpec::GetPropertyPropid ( ) const [inline]

Definition at line 151 of file PropSpec.Hxx.

{
    return( _psProperty.propid );
}

GUID const & CFullPropSpec::GetPropSet ( ) const [inline]

Definition at line 136 of file PropSpec.Hxx.

{
    return( _guidPropSet );
}

PROPSPEC CFullPropSpec::GetPropSpec ( ) const [inline]

Definition at line 141 of file PropSpec.Hxx.

{
    return( _psProperty );
}

BOOL CFullPropSpec::IsPropertyName ( ) const [inline]

Definition at line 156 of file PropSpec.Hxx.

{
    return( _psProperty.ulKind == PRSPEC_LPWSTR );
}

BOOL CFullPropSpec::IsPropertyPropid ( ) const [inline]

Definition at line 161 of file PropSpec.Hxx.

{
    return( _psProperty.ulKind == PRSPEC_PROPID );
}

BOOL CFullPropSpec::IsValid ( ) const [inline]

Definition at line 125 of file PropSpec.Hxx.

{
    return ( _psProperty.ulKind == PRSPEC_PROPID ||
             0 != _psProperty.lpwstr );
}

void CFullPropSpec::operator delete ( void * p ) [inline]

Definition at line 119 of file PropSpec.Hxx.

{
    if ( p )
        CoTaskMemFree( p );
}

void * CFullPropSpec::operator new | ( | size_t | size,
 |  | void * | p |
 | ) |  |  | [inline]

Definition at line 114 of file PropSpec.Hxx.

{
    return( p );
}

void * CFullPropSpec::operator new ( size_t size ) [inline]

Definition at line 107 of file PropSpec.Hxx.

{
    void * p = CoTaskMemAlloc( size );

    return( p );
}

int CFullPropSpec::operator!= ( CFullPropSpec const & prop ) const

Definition at line 210 of file PropSpec.Cxx.

{
    if (*this == prop)
        return( 0 );
    else
        return( 1 );
}

CFullPropSpec & CFullPropSpec::operator= ( CFullPropSpec const & Property )

Definition at line 118 of file PropSpec.Cxx.

{
    //
    // Clean up.
    //

    CFullPropSpec::~CFullPropSpec();

#pragma warning( disable : 4291 )           // unmatched operator new
    new (this) CFullPropSpec( Property );
#pragma warning( default : 4291 )

    return *this;
}

int CFullPropSpec::operator== ( CFullPropSpec const & prop ) const

Definition at line 184 of file PropSpec.Cxx.

{
    if ( memcmp( &prop._guidPropSet,
                 &_guidPropSet,
                 sizeof( _guidPropSet ) ) != 0 ||
         prop._psProperty.ulKind != _psProperty.ulKind )
    {
        return( 0 );
    }

    switch( _psProperty.ulKind )
    {
    case PRSPEC_LPWSTR:
        return( _wcsicmp( GetPropertyName(), prop.GetPropertyName() ) == 0 );
        break;

    case PRSPEC_PROPID:
        return( GetPropertyPropid() == prop.GetPropertyPropid() );
        break;

    default:
        return( 0 );
        break;
    }
}

void CFullPropSpec::SetProperty ( PROPID pidProperty )

Definition at line 144 of file PropSpec.Cxx.

{
    if ( _psProperty.ulKind == PRSPEC_LPWSTR &&
         0 != _psProperty.lpwstr )
    {
        CoTaskMemFree( _psProperty.lpwstr );
    }

    _psProperty.ulKind = PRSPEC_PROPID;
    _psProperty.propid = pidProperty;
}

BOOL CFullPropSpec::SetProperty ( WCHAR const * wcsProperty )

Definition at line 156 of file PropSpec.Cxx.

{
    if ( _psProperty.ulKind == PRSPEC_LPWSTR &&
         0 != _psProperty.lpwstr )
    {
        CoTaskMemFree( _psProperty.lpwstr );
    }

    _psProperty.ulKind = PRSPEC_LPWSTR;

    int len = (int) ( (wcslen( wcsProperty ) + 1) * sizeof( WCHAR ) );

    _psProperty.lpwstr = (WCHAR *)CoTaskMemAlloc( len );

    if ( 0 != _psProperty.lpwstr )
    {
        memcpy( _psProperty.lpwstr,
                wcsProperty,
                len );
        return( TRUE );
    }
    else
    {
        _psProperty.lpwstr = 0;
        return( FALSE );
    }
}

void CFullPropSpec::SetPropSet ( GUID const & guidPropSet ) [inline]

Definition at line 131 of file PropSpec.Hxx.

{
    _guidPropSet = guidPropSet;
}

Member Data Documentation

GUID CFullPropSpec::_guidPropSet [private]

Definition at line 97 of file PropSpec.Hxx.

PROPSPEC CFullPropSpec::_psProperty [private]

Definition at line 98 of file PropSpec.Hxx.

The documentation for this class was generated from the following files:
  • WinBase/Indexing/IFilter/PropSpec.Hxx
  • WinBase/Indexing/IFilter/PropSpec.Cxx
Generated on Wed Nov 13 2024 16:56:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CFullServ Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CFullServ Class Reference

#include "fullserv.h"

List of all members.

Public Member Functions

CFullServ ()
STDMETHOD() | CreateCall (REFIID riid1, IUnknown *pUnk, REFIID riid2, IUnknown **ppObj)
STDMETHOD() | Sum (int i, int j, int *sum)
STDMETHOD() | Work (int i, int j, int *sum)

Detailed Description

Definition at line 39 of file fullserv.h.

Constructor & Destructor Documentation

CFullServ::CFullServ ( ) [inline]

Definition at line 47 of file fullserv.h.

  {
  }

Member Function Documentation

STDMETHODIMP CFullServ::CreateCall | ( | REFIID | riid1,
 |  | IUnknown * | pUnk,
 |  | REFIID | riid2,
 |  | IUnknown ** | ppObj
 | ) |  |

Definition at line 86 of file fullserv.Cpp.

{
  HRESULT hr;
  IFullServ * pIFullServ;
  if (ppObj == NULL) return E_POINTER;

  //We only support one async interface: AsyncIFullServ + check for proper
  //aggregation
  if((riid1 != IID_AsyncIFullServ) || (pUnk && (riid2 != IID_IUnknown)))
    return E_INVALIDARG;

  //Obtain a pointer to the synchronous IFullServ interface
  hr = ((IFullServ * )this)->QueryInterface(IID_IFullServ,(void**)&pIFullServ);
  _ASSERT(SUCCEEDED(hr));

  //Create our object
  CComPolyObject<CAsyncFullServ>* pPolyFullServ = NULL;
  hr = CComPolyObject<CAsyncFullServ>::CreateInstance(pUnk,&pPolyFullServ);

  if(FAILED(hr)){
    pIFullServ->Release();
    return hr;
  }

  //Store pointer to the synchronous interface
  pPolyFullServ->m_contained.Init(pIFullServ);
  pIFullServ->Release();

  //Return requested interface
  hr = pPolyFullServ->QueryInterface(riid2,(void**)ppObj);

  return hr;
}

STDMETHODIMP CFullServ::Sum | ( | int | i,
 |  | int | j,
 |  | int * | sum
 | ) |  |

Definition at line 44 of file fullserv.Cpp.

                                                  {
  *sum = i + j;
  return S_OK;
}

STDMETHODIMP CFullServ::Work | ( | int | i,
 |  | int | j,
 |  | int * | sum
 | ) |  |

Definition at line 60 of file fullserv.Cpp.

                                                  {

  for(int k = 0; k < 10000; k++){
    for(int l = 0; l < 10000; l++){
    }
  }

  *sum = i + j;
  return S_OK;
}

The documentation for this class was generated from the following files:
  • Com/Fundamentals/AsyncCalls/FullSvr/fullserv.h
  • Com/Fundamentals/AsyncCalls/FullSvr/fullserv.Cpp
Generated on Wed Nov 13 2024 16:56:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CFVClassFactory Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CFVClassFactory Class Reference

#include "FileView.h"

List of all members.

Public Member Functions

CFVClassFactory (void)
~CFVClassFactory (void)
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, PPVOID)
STDMETHODIMP | LockServer (BOOL)
STDMETHODIMP | QueryInterface (REFIID, PPVOID)
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP_ (ULONG) Release(void)

Protected Attributes

ULONG m_cRef

Detailed Description

Definition at line 63 of file FileView.h.

Constructor & Destructor Documentation

CFVClassFactory::CFVClassFactory ( void )

Definition at line 142 of file FileView.Cpp.

    {
    m_cRef=0L;
    return;
    }

CFVClassFactory::~CFVClassFactory ( void )

Definition at line 153 of file FileView.Cpp.

    {
    return;
    }

Member Function Documentation

STDMETHODIMP CFVClassFactory::CreateInstance | ( | LPUNKNOWN | pUnkOuter,
 |  | REFIID | riid,
 |  | PPVOID | ppvObj
 | ) |  |

Definition at line 219 of file FileView.Cpp.

    {
    PCFileViewer        pObj;
    HRESULT             hr;

    *ppvObj=NULL;
    hr=ResultFromScode(E_OUTOFMEMORY);

    //Verify that a controlling unknown asks for IUnknown
    if (NULL!=pUnkOuter && !IsEqualIID(riid, IID_IUnknown))
        return ResultFromScode(E_NOINTERFACE);

     // MODIFY:  If you use a different object than CFileViewer
    // be sure to change the name and parameters here.  I do
    // recommend that you continue to follow this model, however,
    // and just modify CFileViewer as necessary.
    //Create the object passing function to notify on destruction.
    pObj=new CFileViewer(pUnkOuter, g_hInst, ObjectDestroyed);

    if (NULL==pObj)
        return hr;

    //MODIFY:  Add other parameters to Init as necessary.
    hr=pObj->Init();

    if (SUCCEEDED(hr))
        {
        //Return the requested interface
        hr=pObj->QueryInterface(riid, ppvObj);

        if (SUCCEEDED(hr))
            {
            //Everything worked:  count the object
            g_cObj++;
            return NOERROR;
            }
        }

    //Kill the object if anything failed after creation.
    delete pObj;

    return hr;
    }

STDMETHODIMP CFVClassFactory::LockServer ( BOOL fLock )

Definition at line 276 of file FileView.Cpp.

    {
    if (fLock)
        g_cLock++;
    else
        g_cLock--;

    return NOERROR;
    }

STDMETHODIMP CFVClassFactory::QueryInterface | ( | REFIID | riid,
 |  | PPVOID | ppv
 | ) |  |

Definition at line 161 of file FileView.Cpp.

    {
    *ppv=NULL;

    //Any interface on this object is the object pointer.
    if (IsEqualIID(riid, IID_IUnknown)
        || IsEqualIID(riid, IID_IClassFactory))
        *ppv=(LPVOID)this;

     // If we actually assign an interface to ppv we need to AddRef
     // it since we're returning a new pointer.
    if (NULL!=*ppv)
        {
        ((LPUNKNOWN)*ppv)->AddRef();
        return NOERROR;
        }

    return ResultFromScode(E_NOINTERFACE);
    }

CFVClassFactory::STDMETHODIMP_ ( ULONG )
CFVClassFactory::STDMETHODIMP_ ( ULONG )

Member Data Documentation

ULONG CFVClassFactory::m_cRef [protected]

Definition at line 66 of file FileView.h.

The documentation for this class was generated from the following files:
  • WinUI/Shell/FileView/FileView.h
  • WinUI/Shell/FileView/FileView.Cpp
Generated on Wed Nov 13 2024 16:56:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CGdiplusInit Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CGdiplusInit Class Reference

#include "BitmapWnd.h"

List of all members.

Public Member Functions

CGdiplusInit (Gdiplus::DebugEventProc debugEventCallback=0, BOOL suppressBackgroundThread=FALSE, BOOL suppressExternalCodecs=FALSE)
~CGdiplusInit ()

Private Attributes

Gdiplus::Status StartupStatus
ULONG_PTR Token

Detailed Description

Definition at line 81 of file BitmapWnd.h.

Constructor & Destructor Documentation

CGdiplusInit::CGdiplusInit | ( | Gdiplus::DebugEventProc | debugEventCallback = 0,
 |  | BOOL | suppressBackgroundThread = FALSE,
 |  | BOOL | suppressExternalCodecs = FALSE |
 | ) |  |  | [inline]

Definition at line 84 of file BitmapWnd.h.

    {
        Gdiplus::GdiplusStartupInput StartupInput(
            debugEventCallback,
            suppressBackgroundThread,
            suppressExternalCodecs
        );

        StartupStatus = Gdiplus::GdiplusStartup(
            &Token,
            &StartupInput,
            this
        );
    }

CGdiplusInit::~CGdiplusInit ( ) [inline]

Definition at line 103 of file BitmapWnd.h.

    {
        if (StartupStatus == Gdiplus::Ok)
        {
            Gdiplus::GdiplusShutdown(Token);
        }
    }

Member Data Documentation

Gdiplus::Status CGdiplusInit::StartupStatus [private]

Definition at line 112 of file BitmapWnd.h.

ULONG_PTR CGdiplusInit::Token [private]

Definition at line 113 of file BitmapWnd.h.

The documentation for this class was generated from the following file:
  • Multimedia/wia/GetImage/BitmapWnd.h
Generated on Wed Nov 13 2024 16:56:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CGenerateRC Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CGenerateRC Class Reference

List of all members.

Public Member Functions

CGenerateRC (const TCHAR *szDatabase, const TCHAR *szSavedDatabase)
~CGenerateRC ()
BOOL IsInErrorState ()
UINT | OutputDialog (TCHAR *szDialog, BOOL fBinary)
UINT | OutputDialogs (BOOL fBinary)
UINT | OutputString (TCHAR *szTable, TCHAR *szColumn)

Private Member Functions

UINT CreateResourceFile ()
TCHAR * | EscapeSlashAndQuoteForRC (TCHAR *szStr)
UINT Initialize ()
BOOL | OutputControls (TCHAR *szDialog)
UINT OutputDialogFinalize ()
UINT | OutputDialogInit (BOOL fBinary)
UINT OutputStringInit ()
BOOL | PrintDimensions (int x, int y, int wd, int ht)
UINT VerifyDatabaseCodepage ()
BOOL WriteBinaries ()
BOOL | WriteControlToRC (TCHAR *szDialog, TCHAR *szCtrlName, TCHAR *szCtrlType, TCHAR *szCtrlText, TCHAR *szCtrlProperty, int x, int y, int wd, int ht, int attrib)
BOOL | WriteDialogToRC (TCHAR *szDialog, TCHAR *szTitle, int x, int y, int wd, int ht, int attrib)
BOOL | WriteRadioButtons (TCHAR *szDialog, TCHAR *szRBGroup, TCHAR *szProperty, int x, int y, int attrib)
BOOL | WriteStdWinCtrl (int iResId, const TCHAR *resType, TCHAR *szCtrlText, int x, int y, int wd, int ht, int attrib)
BOOL | WriteWin32Ctrl (int iResId, const TCHAR *szClass, TCHAR *szCtrlText, TCHAR *szAttrib, int x, int y, int wd, int ht, int attrib)

Private Attributes

int | m_cWriteFileErr
BOOL m_fError
BOOL m_fWroteBinary
MSIHANDLE | m_hDatabase
HANDLE m_hFile
int | m_iCtrlResID
int | m_iStrResID
const TCHAR * | m_szDatabase
const TCHAR * | m_szOrigDb

Detailed Description

Definition at line 243 of file msiloc.cpp.

Constructor & Destructor Documentation

CGenerateRC::CGenerateRC | ( | const TCHAR * | szDatabase,
 |  | const TCHAR * | szSavedDatabase |
 | ) |  |  | [inline]

Definition at line 246 of file msiloc.cpp.

                                                                     : m_szDatabase(szSavedDatabase), m_szOrigDb(szDatabase),
    m_hFile(0), m_hDatabase(0), m_iCtrlResID(0), m_fError(FALSE), m_cWriteFileErr(0), m_iStrResID(0), m_fWroteBinary(FALSE){};

CGenerateRC::~CGenerateRC ( )

Definition at line 353 of file msiloc.cpp.

{
  UINT iStat;
  if (m_hFile)
    CloseHandle(m_hFile);
  if (m_hDatabase)
  {
    // commit database for internal tables
    // only commit database if no errors
    if (!m_fError && !m_cWriteFileErr)
    {
      if (ERROR_SUCCESS != (iStat = MsiDatabaseCommit(m_hDatabase)))
        _tprintf(TEXT("!! DATABASE COMMIT FAILED.  Error = %d\n"), iStat);
    }
    else
      _tprintf(TEXT("!! NO CHANGES SAVED TO DATABASE. '%d' WriteFile errors occured. Error state = %s\n"), m_cWriteFileErr, m_fError ? TEXT("ERRORS OCCURED") : TEXT("NO ERRORS"));
    MsiCloseHandle(m_hDatabase);
  }
}

Member Function Documentation

UINT CGenerateRC::CreateResourceFile ( ) [private]

Definition at line 377 of file msiloc.cpp.

{
  // assumption of database with ".msi" extension
  // resource file generated from the database we are saving to
  // if m_szDatabase = NULL, then no output database specified, so use m_szOrigDb
  // if m_szDatabase, then output database specified, so use m_szDatabase

  int cchLen = _tcslen(m_szDatabase ? m_szDatabase : m_szOrigDb) + 1;
  TCHAR* szFile = new TCHAR[cchLen];
  if ( !szFile )
    return m_fError = true, ERROR_OUTOFMEMORY;

  // copy database name over
  if (FAILED(StringCchCopy(szFile, cchLen, m_szDatabase ? m_szDatabase : m_szOrigDb)))
  {
    delete [] szFile;
    return m_fError = TRUE, ERROR_FUNCTION_FAILED;
  }

  // ensure input conforms to {base}.msi format
  //                                12345
  // cchLen must be >= 6 since .msi plus \0 is 5
  if (cchLen < 6
    || szFile[cchLen-5] != '.'
    || (szFile[cchLen-4] != 'm' && szFile[cchLen-4] != 'M')
    || (szFile[cchLen-3] != 's' && szFile[cchLen-3] != 'S')
    || (szFile[cchLen-2] != 'i' && szFile[cchLen-2] != 'I'))
  {
    delete [] szFile;
    return m_fError = TRUE, ERROR_FUNCTION_FAILED;
  }

  // remove "msi" and change to "rc"
  szFile[cchLen-4] = 'r';
  szFile[cchLen-3] = 'c';
  szFile[cchLen-2] = '\0';

  if (m_szDatabase)
    _tprintf(TEXT("LOG>> Original Database: %s, Saved Database: %s, Generated RC File: %s\n"), m_szOrigDb, m_szDatabase, szFile);
  else
    _tprintf(TEXT("LOG>> Database: %s, Generated RC file: %s\n"), m_szOrigDb , szFile);

  // attempt to create resource file
  m_hFile = CreateFile(szFile, GENERIC_WRITE, FILE_SHARE_WRITE,
                0, CREATE_ALWAYS, 0, 0);
  if (!m_hFile)
  {
    _tprintf(TEXT("Unable to create resource file: %s\n"), szFile);
    return m_fError = TRUE, ERROR_FUNCTION_FAILED;
  }

  // write required headers to resource file (needed for successful compilation)
  DWORD dwBytesWritten = 0;
  // need <windows.h> for most rc requirements
  if (!WriteFile(m_hFile, szWndwHdrFile, sizeof(szWndwHdrFile)-sizeof(TCHAR), &dwBytesWritten, 0))
    m_cWriteFileErr++;
  if (!WriteFile(m_hFile, szCRLF, sizeof(szCRLF)-sizeof(TCHAR), &dwBytesWritten, 0))
    m_cWriteFileErr++;
  // need <commctrl.h> for listview control
  if (!WriteFile(m_hFile, szCommCtrlHdrFile, sizeof(szCommCtrlHdrFile)-sizeof(TCHAR), &dwBytesWritten, 0))
    m_cWriteFileErr++;
  if (!WriteFile(m_hFile, szCRLF, sizeof(szCRLF)-sizeof(TCHAR), &dwBytesWritten, 0))
    m_cWriteFileErr++;

  // whitespace output (required)
  if (!WriteFile(m_hFile, szCRLF, sizeof(szCRLF)-sizeof(TCHAR), &dwBytesWritten, 0))
    m_cWriteFileErr++;
  if (!WriteFile(m_hFile, szCRLF, sizeof(szCRLF)-sizeof(TCHAR), &dwBytesWritten, 0))
    m_cWriteFileErr++;

  // return success
  return m_cWriteFileErr ? ERROR_FUNCTION_FAILED : ERROR_SUCCESS;
}

TCHAR * CGenerateRC::EscapeSlashAndQuoteForRC ( TCHAR * szStr ) [private]

Definition at line 1652 of file msiloc.cpp.

{
  TCHAR* szNewStr = 0;

  // check for NULL str
  if (szStr == 0)
    return szNewStr;

  // determine if str contains any esc char
  int cEscChar = 0;
  TCHAR* pch = szStr;
  while (*pch != 0)
  {
    if (*pch == TEXT('\\') || *pch == TEXT('"'))
      cEscChar++;
    pch++;
  }

  if (cEscChar == 0)
  {
    int iLen = _tcslen(szStr) + 1; // for null
    szNewStr = new TCHAR[iLen];
    if ( !szNewStr )
      return NULL;
    if (FAILED(StringCchCopy(szNewStr, iLen, szStr)))
    {
      delete [] szNewStr;
      return NULL;
    }
  }
  else
  {
    int iLen = _tcslen(szStr) + 1 + cEscChar;
    szNewStr = new TCHAR[iLen];
    if ( !szNewStr )
      return NULL;
    pch = szStr;
    TCHAR* pchNew = szNewStr;
    while (*pch != 0)
    {
      if (*pch == TEXT('\\'))
        *pchNew++ = TEXT('\\');
      else if (*pch == TEXT('"'))
        *pchNew++ = TEXT('"');
      *pchNew++ = *pch++;
    }
    *pchNew = TEXT('\0');
  }

  return szNewStr;
}

UINT CGenerateRC::Initialize ( void ) [private]

Definition at line 1110 of file msiloc.cpp.

{
  UINT iStat;
  // open database if not already open
  assert(m_szOrigDb);
  if (!m_hDatabase)
  {
    // if m_szDatabase is specified, then we use it for specifying an output database
    iStat = MsiOpenDatabase(m_szOrigDb, m_szDatabase ? m_szDatabase : MSIDBOPEN_TRANSACT, &m_hDatabase);
    if (ERROR_SUCCESS != iStat)
    {
      _tprintf(TEXT("LOG_ERROR>> Unable to open database %s\n"), m_szOrigDb);
      return m_fError = TRUE, iStat; // error - ABORT
    }
  }

  // verify database codepage is NEUTRAL
  if  (ERROR_SUCCESS != (iStat = VerifyDatabaseCodepage()))
    return m_fError = TRUE, iStat; // error - ABORT

  // create resource file if not already created
  if (!m_hFile && ERROR_SUCCESS != (iStat = CreateResourceFile()))
  {
    _tprintf(TEXT("LOG_ERROR>> Unable to create resource file.\n"));
    return m_fError = TRUE, iStat; // error - ABORT
  }

  return ERROR_SUCCESS;
}

BOOL CGenerateRC::IsInErrorState ( ) [inline]

Definition at line 253 of file msiloc.cpp.

{return m_fError;}

BOOL CGenerateRC::OutputControls ( TCHAR * szDialog ) [private]

Definition at line 1838 of file msiloc.cpp.

{
  // It's possible that one could output the controls in the correct tab order.
  // It's fairly easy for export if you remember to output
  // all non tab order controls first.  The Control_Next column of the Control table would be
  // used as well as the Control_First column of the Dialog table.  Control_First is the start
  // of the tab order.  Control_Next is the next control in the tab order.  It is difficult to
  // handle the tab order when importing if you allow the tab order to change between export
  // and import.
  UINT iStat;

  // only have controls to write if Control table exists
  MSICONDITION eCond = MsiDatabaseIsTablePersistent(m_hDatabase, TEXT("Control"));
  if (eCond == MSICONDITION_ERROR)
  {
    _tprintf(TEXT("LOG_ERROR>> MsiDatabaseIsTablePersistent(Control)\n"));
    return m_fError = TRUE, FALSE; // error - ABORT
  }
  // require Control table to be persistent
  if (eCond != MSICONDITION_TRUE)
  {
    _tprintf(TEXT("LOG: Control table is not persistent or present\n"));
    return TRUE;
  }

  // open view on Control table
  PMSIHANDLE hViewControl = 0;
  PMSIHANDLE hRec = MsiCreateRecord(1);
  if (ERROR_SUCCESS != (iStat = MsiDatabaseOpenView(m_hDatabase, sqlControl, &hViewControl))
    || ERROR_SUCCESS != (iStat = MsiRecordSetString(hRec, 1, szDialog))
    || ERROR_SUCCESS != (iStat = MsiViewExecute(hViewControl, hRec)))
    return m_fError = TRUE, FALSE; // error - ABORT

  // begin fetching rows from Control table
  PMSIHANDLE hRecControl = 0;
  while (ERROR_NO_MORE_ITEMS != (iStat = MsiViewFetch(hViewControl, &hRecControl)))
  {
    if (ERROR_SUCCESS != iStat)
      return m_fError = TRUE, FALSE; // error - ABORT

    /**********************************************
     obtain all values for control
    ***********************************************/
    // control's type determines how control is output to resource file
    // 1st call, obtain size needed
    // 2nd call, get string

    DWORD cchLen = 0;
    if (ERROR_MORE_DATA != (iStat = MsiRecordGetString(hRecControl, iccType, TEXT(""), &cchLen)))
      return m_fError = TRUE, FALSE;
    TCHAR* szCtrlType = new TCHAR[++cchLen];
    if ( !szCtrlType )
      return m_fError = TRUE, FALSE; // ERROR_OUTOFMEMORY

    if (ERROR_SUCCESS != (iStat = MsiRecordGetString(hRecControl, iccType, szCtrlType, &cchLen)))
    {
      delete [] szCtrlType;
      return m_fError = TRUE, FALSE; // error - ABORT
    }

    cchLen = 0;
    if (ERROR_MORE_DATA != (iStat = MsiRecordGetString(hRecControl, iccName, TEXT(""), &cchLen)))
    {
      delete [] szCtrlType;
      return m_fError = TRUE, FALSE;
    }
    TCHAR* szCtrlName = new TCHAR[++cchLen];
    if ( !szCtrlName )
    {
      delete [] szCtrlType;
      return m_fError = TRUE, FALSE; // ERROR_OUTOFMEMORY
    }
    if (ERROR_SUCCESS != (iStat = MsiRecordGetString(hRecControl, iccName, szCtrlName, &cchLen)))
    {
      delete [] szCtrlType;
      delete [] szCtrlName;
      return m_fError = TRUE, FALSE; // error - ABORT
    }

    cchLen = 0;
    if (ERROR_MORE_DATA != (iStat = MsiRecordGetString(hRecControl, iccText, TEXT(""), &cchLen)))
    {
      delete [] szCtrlType;
      delete [] szCtrlName;
      return m_fError = TRUE, FALSE; // error - ABORT
    }
    TCHAR* szCtrlText = new TCHAR[++cchLen];
    if ( !szCtrlText )
    {
      delete [] szCtrlType;
      delete [] szCtrlName;
      return m_fError = TRUE, FALSE; // error - ABORT
    }
    if (ERROR_SUCCESS != (iStat = MsiRecordGetString(hRecControl, iccText, szCtrlText, &cchLen)))
    {
      delete [] szCtrlType;
      delete [] szCtrlName;
      delete [] szCtrlText;
      return m_fError = TRUE, FALSE; // error - ABORT
    }

    cchLen = 0;
    if (ERROR_MORE_DATA != (iStat = MsiRecordGetString(hRecControl, iccProperty, TEXT(""), &cchLen)))
    {
      delete [] szCtrlType;
      delete [] szCtrlName;
      delete [] szCtrlText;
      return m_fError = TRUE, FALSE; // error - ABORT
    }
    TCHAR* szCtrlProperty = new TCHAR[++cchLen];
    if ( !szCtrlProperty )
    {
      delete [] szCtrlType;
      delete [] szCtrlName;
      delete [] szCtrlText;
      return m_fError = TRUE, FALSE; // error - ABORT
    }
    if (ERROR_SUCCESS != (iStat = MsiRecordGetString(hRecControl, iccProperty, szCtrlProperty, &cchLen)))
    {
      delete [] szCtrlType;
      delete [] szCtrlName;
      delete [] szCtrlText;
      delete [] szCtrlProperty;
      return m_fError = TRUE, FALSE; // error - ABORT
    }

    // get x, y, wd, ht, and attrib values
    int x,y,wd,ht,attrib;
    x      = MsiRecordGetInteger(hRecControl, iccX);
    y      = MsiRecordGetInteger(hRecControl, iccY);
    wd     = MsiRecordGetInteger(hRecControl, iccWd);
    ht     = MsiRecordGetInteger(hRecControl, iccHt);
    attrib = MsiRecordGetInteger(hRecControl, iccAttrib);

#ifdef DEBUG
  _tprintf(TEXT("LOG>>\tWriting control <%s>\n"), szCtrlName);
#endif

    if (!WriteControlToRC(szDialog, szCtrlName, szCtrlType, szCtrlText, szCtrlProperty, x, y, wd, ht, attrib))
    {
      delete [] szCtrlType;
      delete [] szCtrlName;
      delete [] szCtrlText;
      delete [] szCtrlProperty;
      return m_fError = TRUE, FALSE; // error - ABORT
    }
  }

  // return success
  return TRUE;
}

UINT CGenerateRC::OutputDialog | ( | TCHAR * | szDialog,
 |  | BOOL | fBinary
 | ) |  |

Definition at line 1518 of file msiloc.cpp.

{
  // write out specified dialog in Dialog table
  // According to MSDN, new applications should use DIALOGEX resource instead of DIALOG

  UINT iStat;
  if (ERROR_SUCCESS != (iStat = OutputDialogInit(fBinary)))
    return m_fError = TRUE, iStat; // error - ABORT

  // prepare Dialog strResource --> Dialog mapping table
  PMSIHANDLE hViewDlgMap = 0;
  PMSIHANDLE hViewDialog = 0;
  PMSIHANDLE hRecDlgMap = MsiCreateRecord(2);
  PMSIHANDLE hRecFindDlg = MsiCreateRecord(1);
  if (ERROR_SUCCESS != (iStat = MsiDatabaseOpenView(m_hDatabase, sqlDlgMap, &hViewDlgMap))
    || ERROR_SUCCESS != (iStat = MsiViewExecute(hViewDlgMap, 0))
    || ERROR_SUCCESS != (iStat = MsiDatabaseOpenView(m_hDatabase, sqlDialogSpecific, &hViewDialog))
    || ERROR_SUCCESS != (iStat = MsiRecordSetString(hRecFindDlg, 1, szDialog))
    || ERROR_SUCCESS != (iStat = MsiViewExecute(hViewDialog, hRecFindDlg)))
    return m_fError = TRUE, iStat; // error - ABORT

  // fetch specified Dialog from Dialog table and output to .rc file
  PMSIHANDLE hRecDialog = 0;
  if (ERROR_SUCCESS == (iStat = MsiViewFetch(hViewDialog, &hRecDialog)))
  {
    // write out the bitmaps and icons from the Binary table
#ifdef DEBUG
    if (!fBinary)
      _tprintf(TEXT("LOG>> SKIPPING Binary data export.\n"));
#endif
    if (fBinary && !m_fWroteBinary && !WriteBinaries())
      return m_fError = TRUE, ERROR_FUNCTION_FAILED; // error - ABORT

    // use dialog name as nameID
    // Reasoning: guarantees uniqueness since Dialog name is primary key of table
    // Potential caveat:  Dialog strId is stored in ALL CAPS. Installer is case-sensitive
    //   so we must store a mapping between this and original.  Could have case where we
    //   try Action1 and ACTion1 as two different strIds.  RC will fail on this

    // update Dialog Mapping table with information
    if (ERROR_SUCCESS != (iStat = MsiRecordSetString(hRecDlgMap, 2, szDialog)))
      return m_fError = TRUE, iStat;

    DWORD cchTempDialog = _tcslen(szDialog) + 1;
    TCHAR* szTempDialog = new TCHAR[cchTempDialog];
    if ( !szTempDialog )
      return m_fError = TRUE, ERROR_OUTOFMEMORY;

    if (FAILED(StringCchCopy(szTempDialog, cchTempDialog, szDialog)))
    {
      delete [] szTempDialog;
      return m_fError = TRUE, ERROR_FUNCTION_FAILED;
    }

    // resource file format, ALL CAPS
    if (ERROR_SUCCESS != (iStat = MsiRecordSetString(hRecDlgMap, 1, _tcsupr(szTempDialog))))
    {
      delete [] szTempDialog;
      return m_fError = TRUE, iStat;
    }

    // update _RESDialogs table, note:  we will overwrite pre-existing. Rely on rc.exe to bail
    if (ERROR_SUCCESS != (iStat = MsiViewModify(hViewDlgMap, MSIMODIFY_ASSIGN, hRecDlgMap)))
    {
      delete [] szTempDialog;
      return m_fError = TRUE, iStat; // error - ABORT
    }

    // get x, y, wd, ht, and attrib values
    int x,y,wd,ht,attrib;
    x      = MsiRecordGetInteger(hRecDialog, idcX);
    y      = MsiRecordGetInteger(hRecDialog, idcY);
    wd     = MsiRecordGetInteger(hRecDialog, idcWd);
    ht     = MsiRecordGetInteger(hRecDialog, idcHt);
    attrib = MsiRecordGetInteger(hRecDialog, idcAttrib);

    // obtain title of dialog
    DWORD cchTitle = 0;
    if (ERROR_MORE_DATA != (iStat = MsiRecordGetString(hRecDialog, idcTitle, TEXT(""), &cchTitle)))
    {
      delete [] szTempDialog;
      return m_fError = TRUE, iStat;
    }

    TCHAR* szTitle = new TCHAR[++cchTitle];
    if ( !szTitle )
    {
      delete [] szTempDialog;
      return m_fError = TRUE, ERROR_OUTOFMEMORY;
    }

    if (ERROR_SUCCESS != (iStat = MsiRecordGetString(hRecDialog, idcTitle, szTitle, &cchTitle)))
    {
      delete [] szTempDialog;
      delete [] szTitle;
      return m_fError = TRUE, iStat; // error - ABORT
    }

    if (!WriteDialogToRC(szDialog, szTitle, x, y, wd, ht, attrib))
    {
      delete [] szTempDialog;
      delete [] szTitle;
      return m_fError = TRUE, ERROR_FUNCTION_FAILED; // error - ABORT
    }

    delete [] szTempDialog;
    szTempDialog = NULL;

    delete [] szTitle;
    szTitle = NULL;

  }
  else if (ERROR_NO_MORE_ITEMS == iStat)
  {
    _tprintf(TEXT("LOG_ERROR>> Dialog '%s' not found in Dialog table\n"), szDialog);
    if (ERROR_SUCCESS != (iStat = OutputDialogFinalize()))
      return m_fError = TRUE, iStat;
    return ERROR_SUCCESS; // error, but not fatal...keep processing
  }
  else
  {
    _tprintf(TEXT("LOG_ERROR>> MsiViewFetch(specific dialog)\n"));
    return iStat;
  }

  if (ERROR_SUCCESS != (iStat = OutputDialogFinalize()))
    return m_fError = TRUE, iStat; // error - ABORT

  return ERROR_SUCCESS;
}

UINT CGenerateRC::OutputDialogFinalize ( ) [private]

Definition at line 1142 of file msiloc.cpp.

{
  // update _RESControls table with MAX_RESOURCE_ID
  PMSIHANDLE hViewCtrlMark = 0;
  PMSIHANDLE hRecMaxRcId = MsiCreateRecord(3);
  UINT iStat;
  if (ERROR_SUCCESS != (iStat = MsiDatabaseOpenView(m_hDatabase, sqlCtrlMark, &hViewCtrlMark))
    || ERROR_SUCCESS != (iStat = MsiViewExecute(hViewCtrlMark, 0))
    || ERROR_SUCCESS != (iStat = MsiRecordSetString(hRecMaxRcId, 1, TEXT("MAX_RESOURCE_ID")))
    || ERROR_SUCCESS != (iStat = MsiRecordSetString(hRecMaxRcId, 2, TEXT("MAX_RESOURCE_ID")))
    || ERROR_SUCCESS != (iStat = MsiRecordSetInteger(hRecMaxRcId, 3, m_iCtrlResID))
    || ERROR_SUCCESS != (iStat = MsiViewModify(hViewCtrlMark, MSIMODIFY_ASSIGN, hRecMaxRcId)))
    return m_fError = TRUE, iStat; // error - ABORT

#ifdef DEBUG
  _tprintf(TEXT("LOG>>...END WRITING DIALOG DATA TO RESOURCE FILE...\n"));
#endif

  return ERROR_SUCCESS;
}

UINT CGenerateRC::OutputDialogInit ( BOOL fBinary ) [private]

Definition at line 1273 of file msiloc.cpp.

{
  UINT iStat;
  if (ERROR_SUCCESS != (iStat = Initialize()))
    return m_fError = TRUE, iStat; // error - ABORT

  // only output if Dialog table exists
  MSICONDITION eCond = MsiDatabaseIsTablePersistent(m_hDatabase, TEXT("Dialog"));
  if (eCond == MSICONDITION_ERROR)
  {
    _tprintf(TEXT("LOG_ERROR>> MsiDatabaseIsTablePersistent(Dialog)\n"));
    return m_fError = TRUE, ERROR_FUNCTION_FAILED; // error - ABORT
  }
  // require PERSISTENT tables
  if (eCond != MSICONDITION_TRUE)
  {
    _tprintf(TEXT("LOG>> Dialog table is not persistent or does not exist\n"));
    return ERROR_SUCCESS;
  }

  /**********************************************************************************
   create internal table for mapping DIALOGS to Dialogs (resource file stores
   strings IDs in ALL CAPS.  Installer is case-sensitive
   TABLE: _RESDialogs
   COLUMNS: RCStr (String, Primary Key), Dialog (String, Primary Key)
  ***********************************************************************************/

  // see if _RESDialogs table is already there
  MSICONDITION eCondition = MsiDatabaseIsTablePersistent(m_hDatabase, TEXT("_RESDialogs"));
  if (eCondition == MSICONDITION_TRUE)
  {
    // table persistent
#ifdef DEBUG
    _tprintf(TEXT("LOG>> _RESDialogs Table is Present.\n"));
#endif
  }
  else if (eCondition == MSICONDITION_FALSE || eCondition == MSICONDITION_ERROR) // error or table temporary
    return m_fError = TRUE, ERROR_FUNCTION_FAILED; // error - ABORT
  else
  {
    // table not exist -- create it
    PMSIHANDLE h_DlgMarkingView = 0;
    if (ERROR_SUCCESS != (iStat = MsiDatabaseOpenView(m_hDatabase, sqlCreateDlgMap, &h_DlgMarkingView))
      || ERROR_SUCCESS != (iStat = MsiViewExecute(h_DlgMarkingView, 0)))
      return m_fError = TRUE, iStat; // error - ABORT
  }

  /**********************************************************************************
   create internal table for managing resource IDs of controls
   TABLE: _RESControls
   COLUMNS: Dialog_ (String, Primary Key), Control_ (String, Primary Key), RCID (Int)
  ***********************************************************************************/

  // see if _RESControls table is already there
  eCondition = MsiDatabaseIsTablePersistent(m_hDatabase, TEXT("_RESControls"));
  if (eCondition == MSICONDITION_TRUE)
  {
    // table persistent
    // find the last resource Id
    PMSIHANDLE hViewSelMaxRc = 0;
    PMSIHANDLE hRecMaxRc = 0;
    if (ERROR_SUCCESS != (iStat = MsiDatabaseOpenView(m_hDatabase, sqlSelMaxRcId, &hViewSelMaxRc))
      || ERROR_SUCCESS != (iStat = MsiViewExecute(hViewSelMaxRc, 0))
      || ERROR_SUCCESS != (iStat = MsiViewFetch(hViewSelMaxRc, &hRecMaxRc)))
      return m_fError = TRUE, iStat; // error - ABORT

    // update resource Id
    m_iCtrlResID = MsiRecordGetInteger(hRecMaxRc, 1);

#ifdef DEBUG
  _tprintf(TEXT("LOG>> _RESControls Table is Present. MAX RES ID = %d\n"), m_iCtrlResID);
#endif

  }
  else if (eCondition == MSICONDITION_ERROR || eCondition == MSICONDITION_FALSE) // error or temporary
    return m_fError = TRUE, ERROR_FUNCTION_FAILED;
  else
  {
    // table not exist -- create it
    PMSIHANDLE h_CtrlMarkingView = 0;
    if (ERROR_SUCCESS != (iStat = MsiDatabaseOpenView(m_hDatabase, sqlCreateCtrlMark, &h_CtrlMarkingView))
      || ERROR_SUCCESS != (iStat = MsiViewExecute(h_CtrlMarkingView, 0)))
      return m_fError = TRUE, iStat; // error - ABORT
  }

#ifdef DEBUG
  _tprintf(TEXT("LOG>>...BEGIN WRITING DIALOG DATA TO RESOURCE FILE...\n"));
#endif

  return ERROR_SUCCESS;
}

UINT CGenerateRC::OutputDialogs ( BOOL fBinary )

Definition at line 1367 of file msiloc.cpp.

{
  // write out each dialog in Dialog table
  // According to MSDN, new applications should use DIALOGEX resource instead of DIALOG

  UINT iStat;
  if (ERROR_SUCCESS != (iStat = OutputDialogInit(fBinary)))
    return m_fError = TRUE, iStat; // error - ABORT

    // write out the bitmaps and icons from the Binary table
#ifdef DEBUG
  if (!fBinary)
    _tprintf(TEXT("LOG>> SKIPPING Binary data export.\n"));
#endif
  if (fBinary && !m_fWroteBinary && !WriteBinaries())
    return m_fError = TRUE, ERROR_FUNCTION_FAILED; // error - ABORT

  // prepare Dialog strResource --> Dialog mapping table
  PMSIHANDLE hViewDlgMap = 0;
  PMSIHANDLE hRecDlgMap = MsiCreateRecord(2);
  PMSIHANDLE hViewDialog = 0;
  if (ERROR_SUCCESS != (iStat = MsiDatabaseOpenView(m_hDatabase, sqlDlgMap, &hViewDlgMap))
    || ERROR_SUCCESS != (iStat = MsiViewExecute(hViewDlgMap, 0))
    || ERROR_SUCCESS != (iStat = MsiDatabaseOpenView(m_hDatabase, sqlDialog, &hViewDialog))
    || ERROR_SUCCESS != (iStat = MsiViewExecute(hViewDialog, 0)))
    return m_fError = TRUE, iStat; // error - ABORT

  // fetch all row records of dialogs from Dialog table and output to .rc file
  PMSIHANDLE hRecDialog = 0;
  while (ERROR_NO_MORE_ITEMS != (iStat = MsiViewFetch(hViewDialog, &hRecDialog)))
  {
    if (ERROR_SUCCESS != iStat)
      return m_fError = TRUE, iStat; // error - ABORT

    // use dialog name as nameID
    // Reasoning: guarantees uniqueness since Dialog name is primary key of table
    // Potential caveat:  Dialog strId is stored in ALL CAPS. Installer is case-sensitive
    //   so we must store a mapping between this and original.  Could have case where we
    //   try Action1 and ACTion1 as two different strIds.  RC will fail on this

    // 1st call, obtain size needed
    // 2nd call, get string
    DWORD cchDialog = 0;
    if (ERROR_MORE_DATA != (iStat = MsiRecordGetString(hRecDialog, idcName, TEXT(""), &cchDialog)))
      return m_fError = TRUE, iStat;
    TCHAR* szDialog = new TCHAR[++cchDialog];
    if ( !szDialog )
      return m_fError = TRUE, ERROR_OUTOFMEMORY;
    if (ERROR_SUCCESS != (iStat = MsiRecordGetString(hRecDialog, idcName, szDialog, &cchDialog)))
    {
      delete [] szDialog;
      return m_fError = TRUE, iStat; // error - ABORT
    }

    // update Dialog Mapping table with information
    if (ERROR_SUCCESS != (iStat = MsiRecordSetString(hRecDlgMap, 2, szDialog)))
    {
      delete [] szDialog;
      return m_fError = TRUE, iStat;
    }

    DWORD cchTempDialog = _tcslen(szDialog) + 1;
    TCHAR* szTempDialog = new TCHAR[cchTempDialog];
    if ( !szTempDialog )
    {
      delete [] szDialog;
      return m_fError = TRUE, ERROR_OUTOFMEMORY;
    }

    if (FAILED(StringCchCopy(szTempDialog, cchTempDialog, szDialog)))
    {
      delete [] szDialog;
      delete [] szTempDialog;
      return m_fError = TRUE, ERROR_FUNCTION_FAILED;
    }

    // resource file format -- ALL CAPS
    if (ERROR_SUCCESS != (iStat = MsiRecordSetString(hRecDlgMap, 1, _tcsupr(szTempDialog))))
    {
      delete [] szDialog;
      delete [] szTempDialog;
      return m_fError = TRUE, iStat;
    }

    // update _RESDialogs table, note:  we will overwrite pre-existing. Rely on rc.exe to bail
    if (ERROR_SUCCESS != (iStat = MsiViewModify(hViewDlgMap, MSIMODIFY_ASSIGN, hRecDlgMap)))
    {
      delete [] szDialog;
      delete [] szTempDialog;
      return m_fError = TRUE, iStat; // error - ABORT
    }

    // get x, y, wd, ht, and attrib values
    int x,y,wd,ht,attrib;
    x      = MsiRecordGetInteger(hRecDialog, idcX);
    y      = MsiRecordGetInteger(hRecDialog, idcY);
    wd     = MsiRecordGetInteger(hRecDialog, idcWd);
    ht     = MsiRecordGetInteger(hRecDialog, idcHt);
    attrib = MsiRecordGetInteger(hRecDialog, idcAttrib);

    // obtain title of dialog
    DWORD cchTitle = 0;
    if (ERROR_MORE_DATA != (iStat = MsiRecordGetString(hRecDialog, idcTitle, TEXT(""), &cchTitle)))
    {
      delete [] szDialog;
      delete [] szTempDialog;
      return m_fError = TRUE, iStat;
    }

    TCHAR* szTitle = new TCHAR[++cchTitle];
    if ( !szTitle )
    {
      delete [] szDialog;
      delete [] szTempDialog;
      return m_fError = TRUE, ERROR_OUTOFMEMORY;
    }
    if (ERROR_SUCCESS != (iStat = MsiRecordGetString(hRecDialog, idcTitle, szTitle, &cchTitle)))
    {
      delete [] szDialog;
      delete [] szTempDialog;
      delete [] szTitle;
      return m_fError = TRUE, iStat; // error - ABORT
    }

    if (!WriteDialogToRC(szDialog, szTitle, x, y, wd, ht, attrib))
    {
      delete [] szDialog;
      delete [] szTempDialog;
      delete [] szTitle;
      return m_fError = TRUE, ERROR_FUNCTION_FAILED; // error - ABORT
    }

    delete [] szDialog;
    szDialog = NULL;
    delete [] szTempDialog;
    szTempDialog = NULL;
    delete [] szTitle;
    szTitle = NULL;
  }

  if (ERROR_SUCCESS != (iStat = OutputDialogFinalize()))
    return m_fError = TRUE, iStat; // error - ABORT

  // return success
  return ERROR_SUCCESS;
}

UINT CGenerateRC::OutputString | ( | TCHAR * | szTable,
 |  | TCHAR * | szColumn
 | ) |  |

Definition at line 706 of file msiloc.cpp.

{
  UINT iStat;
  if (ERROR_SUCCESS != (iStat = Initialize()))
    return m_fError = TRUE, iStat; // error - ABORT

  // initialize _RESStrings marking table
  if (ERROR_SUCCESS != (iStat = OutputStringInit()))
    return m_fError = TRUE, iStat; // error - ABORT

  // verify table exists
  MSICONDITION eCond = MsiDatabaseIsTablePersistent(m_hDatabase, szTable);
  switch (eCond)
  {
  case MSICONDITION_FALSE: // table is temporary
  case MSICONDITION_NONE: // table does not exist
    _tprintf(TEXT("LOG_ERROR>> TABLE: %s is temporary or does not exist.\n"), szTable);
    return m_fError = TRUE, ERROR_FUNCTION_FAILED; // error - ABORT
  case MSICONDITION_ERROR: // error occured
    _tprintf(TEXT("LOG_ERROR>> MsiDatabaseIsTablePersistent\n"));
    return m_fError = TRUE, ERROR_FUNCTION_FAILED; // error - ABORT
  case MSICONDITION_TRUE: // table is persistent
    break;
  default:
    assert(0);
    return m_fError = TRUE, ERROR_FUNCTION_FAILED;
  }

  // build query to open view on table
  PMSIHANDLE hRecPrimaryKeys = 0;
  if (ERROR_SUCCESS != (iStat = MsiDatabaseGetPrimaryKeys(m_hDatabase, szTable, &hRecPrimaryKeys)))
    return m_fError = TRUE, iStat; // error - ABORT
  int cPrimaryKeys = MsiRecordGetFieldCount(hRecPrimaryKeys);

  // determine length of list of column names for query
  DWORD cchKeyColumns = 0;
  int iCol;
  for (iCol=1; iCol<=cPrimaryKeys; iCol++)
  {
    DWORD cchLen = 0;
    if (ERROR_MORE_DATA != MsiRecordGetString(hRecPrimaryKeys, iCol, TEXT(""), &cchLen))
      return m_fError = TRUE, ERROR_FUNCTION_FAILED;
    cchKeyColumns += cchLen + 3; // extra 3 is for enclosing back ticks '`' and ','
  }

  TCHAR* szKeyCols = new TCHAR[++cchKeyColumns];
  if ( !szKeyCols )
    return m_fError = TRUE, ERROR_OUTOFMEMORY;

  ZeroMemory(szKeyCols, cchKeyColumns*sizeof(TCHAR));
  DWORD cchRemain = cchKeyColumns;
  TCHAR* pchKeyCols = szKeyCols;
  for (iCol=1; iCol<=cPrimaryKeys; iCol++)
  {
    if (iCol != 1)
    {
      *pchKeyCols++ = ',';
      cchRemain--;
    }

    *pchKeyCols++ = '`';
    cchRemain--;

    DWORD cchLen = cchRemain;
    if (ERROR_SUCCESS != (iStat = MsiRecordGetString(hRecPrimaryKeys, iCol, pchKeyCols, &cchLen)))
    {
      delete [] szKeyCols;
      return m_fError = TRUE, iStat;
    }

    pchKeyCols += cchLen;
    *pchKeyCols++ = '`';
    cchRemain -= (cchLen + 1);
  }

  szKeyCols[cchKeyColumns-1] = '\0'; // ensure null terminated

  DWORD cchSQL = _tcslen(sqlStrCol) + _tcslen(szKeyCols) + _tcslen(szColumn) + _tcslen(szTable) + 1;
  TCHAR* szSQL = new TCHAR[cchSQL];
  if ( !szSQL )
  {
    delete [] szKeyCols;
    return m_fError = TRUE, ERROR_OUTOFMEMORY;
  }

  if (FAILED(StringCchPrintf(szSQL, cchSQL, sqlStrCol, szKeyCols, szColumn, szTable)))
  {
    delete [] szKeyCols;
    delete [] szSQL;
    return m_fError = TRUE, ERROR_FUNCTION_FAILED;
  }

  PMSIHANDLE hViewStrCol = 0;

  // open view
  if (ERROR_SUCCESS != (iStat = MsiDatabaseOpenView(m_hDatabase, szSQL, &hViewStrCol)))
  {
    if (ERROR_BAD_QUERY_SYNTAX == iStat)
      _tprintf(TEXT("LOG_ERROR>> Query failed, probably because the column '%s' does not exist in table '%s'\n"), szColumn, szTable);
    else
      _tprintf(TEXT("LOG_ERROR>> MsiDatabaseOpenView(Column=%s, Table=%s)\n"), szColumn, szTable);

    delete [] szKeyCols;
    delete [] szSQL;
    return m_fError = TRUE, iStat; // error - ABORT
  }

  delete [] szKeyCols;
  szKeyCols = NULL;
  delete [] szSQL;
  szSQL = NULL;

  if (ERROR_SUCCESS != (iStat = MsiViewExecute(hViewStrCol, 0)))
    return m_fError = TRUE, iStat; // error - ABORT

  // verify column is localizable
  PMSIHANDLE hRecColNames = 0;
  PMSIHANDLE hRecColType = 0;
  if (ERROR_SUCCESS != (iStat = MsiViewGetColumnInfo(hViewStrCol, MSICOLINFO_NAMES, &hRecColNames)))
  {
    return m_fError = TRUE, iStat; // error - ABORT
  }
  int cCols = MsiRecordGetFieldCount(hRecColNames);
  int iStrCol = 0;
  for (int iFindCol = 1; iFindCol <= cCols; iFindCol++)
  {
    TCHAR szColumnName[72] = {0};
    DWORD cchColumnName = sizeof(szColumnName)/sizeof(szColumnName[0]);
    if (ERROR_SUCCESS != (iStat = MsiRecordGetString(hRecColNames, iFindCol, szColumnName, &cchColumnName)))
      return m_fError = TRUE, iStat; // error - ABORT
    if (_tcscmp(szColumnName, szColumn) == 0)
    {
      iStrCol = iFindCol;
      break;
    }
  }
  if (!iStrCol
    || ERROR_SUCCESS != (iStat = MsiViewGetColumnInfo(hViewStrCol, MSICOLINFO_TYPES, &hRecColType)))
  {
    _tprintf(TEXT("LOG_ERROR>> MsiViewGetColumnInfo\n"));
    return m_fError = TRUE, iStat; // error - ABORT
  }
  DWORD cchColType = 0;
  if (ERROR_MORE_DATA != MsiRecordGetString(hRecColType, iStrCol, TEXT(""), &cchColType))
    return m_fError = TRUE, iStat;

  TCHAR* szColType = new TCHAR[++cchColType];
  if ( !szColType )
    return m_fError = TRUE, ERROR_OUTOFMEMORY;

  if (ERROR_SUCCESS != (iStat = MsiRecordGetString(hRecColType, iStrCol, szColType, &cchColType))
    || cchColType < 2)
  {
    delete [] szColType;
    return m_fError = TRUE, iStat; // error - ABORT
  }

  // for column to be localizable, first char in szColType must be an 'L' or an 'l'
  if (*szColType != 'L' && *szColType != 'l')
  {
    _tprintf(TEXT("LOG_ERROR>> Column '%s' of Table '%s' is not localizable\n"), szColumn, szTable);
    delete [] szColType;
    return m_fError = TRUE, ERROR_FUNCTION_FAILED; // error - ABORT
  }

  delete [] szColType;

  // write whitespace for readability
  // whitespace in .rc file for readability
  DWORD dwWritten = 0;
  if (!WriteFile(m_hFile, szCRLF, sizeof(szCRLF)-sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;
  if (!WriteFile(m_hFile, szCRLF, sizeof(szCRLF)-sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;

  // output STRINGTABLE resource header
  // format is:
  //  STRINGTABLE  [[optional-statements]]  {      stringID string      . . .  }
  /*STRINGTABLE*/
  if (!WriteFile(m_hFile, resStringTable, _tcslen(resStringTable)*sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;
  /*<tab>{*/
  if (!WriteFile(m_hFile, szTab, sizeof(szTab)-sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;
  if (!WriteFile(m_hFile, szCurlyBeg, sizeof(szCurlyBeg)-sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;
  if (!WriteFile(m_hFile, szCRLF, sizeof(szCRLF)-sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;

  // output all strings
  PMSIHANDLE hRecStr = 0;
  while (ERROR_SUCCESS == (iStat = MsiViewFetch(hViewStrCol, &hRecStr)))
  {
    // string to localize is at cPrimaryKeys+1 in record hRecStr

    // determine length of key identifier
    DWORD cchKeyIdentifier = 0;
    int iKey;
    for (iKey = 1; iKey <= cPrimaryKeys; iKey++)
    {
      DWORD cchLen = 0;
      if (ERROR_MORE_DATA != (iStat = MsiRecordGetString(hRecStr, iKey, TEXT(""), &cchLen)))
        return m_fError = TRUE, iStat;
      cchKeyIdentifier += cchLen + 1; // add extra 1 for ':'
    }

    TCHAR* szKeyIdentifier = new TCHAR[++cchKeyIdentifier];
    if ( !szKeyIdentifier )
      return m_fError = TRUE, ERROR_OUTOFMEMORY;

    ZeroMemory(szKeyIdentifier, cchKeyIdentifier*sizeof(TCHAR));

    DWORD cchKeyRemain = cchKeyIdentifier;
    TCHAR* pchKeyIdentifier = szKeyIdentifier;
    for (iKey=1; iKey<=cPrimaryKeys; iKey++)
    {
      if (iKey != 1)
      {
        *pchKeyIdentifier++ = ':';
        cchKeyRemain--;
      }

      DWORD cchLen = cchKeyRemain;
      if (ERROR_SUCCESS != (iStat = MsiRecordGetString(hRecStr, iKey, pchKeyIdentifier, &cchLen)))
      {
        delete [] szKeyIdentifier;
        return m_fError = TRUE, iStat;
      }

      pchKeyIdentifier += cchLen;
      cchKeyRemain -= cchLen;
    }

    // ensure null terminated
    szKeyIdentifier[cchKeyIdentifier-1] = '\0';

    int iResId = 0;

    DWORD cchFindSQL = _tcslen(sqlFindStrResId) + _tcslen(szTable) + _tcslen(szColumn) + _tcslen(szKeyIdentifier) + 1;
    TCHAR* szFindSQL = new TCHAR[cchFindSQL];
    if ( !szFindSQL )
    {
      delete [] szKeyIdentifier;
      return m_fError = TRUE, ERROR_OUTOFMEMORY;
    }

    if (FAILED(StringCchPrintf(szFindSQL, cchFindSQL, sqlFindStrResId, szTable, szColumn, szKeyIdentifier)))
    {
      delete [] szKeyIdentifier;
      delete [] szFindSQL;
      return m_fError = TRUE, ERROR_FUNCTION_FAILED;
    }

    PMSIHANDLE hViewFindRes = 0;
    PMSIHANDLE hRecFindRes = 0;
    if (ERROR_SUCCESS != (iStat = MsiDatabaseOpenView(m_hDatabase, szFindSQL, &hViewFindRes)))
    {
      delete [] szKeyIdentifier;
      delete [] szFindSQL;
      return m_fError = TRUE, iStat;
    }

    delete [] szFindSQL;
    szFindSQL = NULL;

    if (ERROR_SUCCESS != (iStat = MsiViewExecute(hViewFindRes, 0)))
    {
      delete [] szKeyIdentifier;
      return m_fError = TRUE, iStat; // error - ABORT
    }
    if (ERROR_SUCCESS == (iStat = MsiViewFetch(hViewFindRes, &hRecFindRes)))
    {
      // grab res id
      iResId = MsiRecordGetInteger(hRecFindRes, 1);
    }
    else if (ERROR_NO_MORE_ITEMS == iStat)
    {
      // use next available resource Id
      iResId = ++m_iStrResID;
    }
    else
    {
      delete [] szKeyIdentifier;
      return m_fError = TRUE, iStat; // error - ABORT
    }

    // output string to resource file
    DWORD cchLenStr = 0;
    if (ERROR_MORE_DATA != (iStat = MsiRecordGetString(hRecStr, cPrimaryKeys+1, TEXT(""), &cchLenStr)))
    {
      delete [] szKeyIdentifier;
      return m_fError = TRUE, iStat;
    }

    TCHAR* szStr = new TCHAR[++cchLenStr];
    if ( !szStr )
    {
      delete [] szKeyIdentifier;
      return m_fError = TRUE, ERROR_OUTOFMEMORY;
    }

    if (ERROR_SUCCESS != (iStat = MsiRecordGetString(hRecStr, cPrimaryKeys+1, szStr, &cchLenStr)))
    {
      delete [] szKeyIdentifier;
      delete [] szStr;
      return m_fError = TRUE, iStat; // error - ABORT
    }
#ifdef DEBUG
    _tprintf(TEXT("LOG>> WRITING string '%s'. TABLE:%s COLUMN:%s KEY:%s\n"), szStr, szTable, szColumn, szKeyIdentifier);
#endif
    // escape chars in str
    TCHAR* szEscTitle = EscapeSlashAndQuoteForRC(szStr);
    if ( !szEscTitle )
    {
      delete [] szKeyIdentifier;
      delete [] szStr;
      return m_fError = TRUE, ERROR_OUTOFMEMORY;
    }

    if (_tcslen(szEscTitle) > iMaxResStrLen)
    {
      _tprintf(TEXT("!! >> STR TOO LONG FOR RC FILE >> STRING: %s FROM TABLE: %s, COLUMN: %s, KEY: %s\n"), szStr, szTable, szColumn, szKeyIdentifier);
      delete [] szKeyIdentifier;
      delete [] szStr;
      delete [] szEscTitle;
      continue; // can't output this
    }

    delete [] szStr;
    szStr = NULL;

    /*<tab>ID*/
    if (!WriteFile(m_hFile, szTab, sizeof(szTab)-sizeof(TCHAR), &dwWritten, 0))
      m_cWriteFileErr++;
    TCHAR szTempBuf[10] = {0};

    if (FAILED(StringCchPrintf(szTempBuf, sizeof(szTempBuf)/sizeof(szTempBuf[0]), TEXT("%d"), iResId)))
    {
      delete [] szKeyIdentifier;
      return m_fError = TRUE, ERROR_FUNCTION_FAILED;
    }

    if (!WriteFile(m_hFile, szTempBuf, _tcslen(szTempBuf)*sizeof(TCHAR), &dwWritten, 0))
      m_cWriteFileErr++;

    /*,<tab>"str"*/
    if (!WriteFile(m_hFile, szCommaTab, sizeof(szCommaTab)-sizeof(TCHAR), &dwWritten, 0))
      m_cWriteFileErr++;
    if (!WriteFile(m_hFile, szQuotes, sizeof(szQuotes)-sizeof(TCHAR), &dwWritten, 0))
      m_cWriteFileErr++;
    if (!WriteFile(m_hFile, szEscTitle, _tcslen(szEscTitle)*sizeof(TCHAR), &dwWritten, 0))
      m_cWriteFileErr++;
    delete [] szEscTitle;
    if (!WriteFile(m_hFile, szQuotes, sizeof(szQuotes)-sizeof(TCHAR), &dwWritten, 0))
      m_cWriteFileErr++;
    if (!WriteFile(m_hFile, szCRLF, sizeof(szCRLF)-sizeof(TCHAR), &dwWritten, 0))
      m_cWriteFileErr++;

    // update resid in _RESStrings
    PMSIHANDLE hViewRes = 0;
    PMSIHANDLE hRecInsertStr = MsiCreateRecord(4);
    if (ERROR_SUCCESS != (iStat = MsiDatabaseOpenView(m_hDatabase, sqlInsertStr, &hViewRes))
      || ERROR_SUCCESS != (iStat = MsiViewExecute(hViewRes, 0))
      || ERROR_SUCCESS != (iStat = MsiRecordSetInteger(hRecInsertStr, 4, iResId))
      || ERROR_SUCCESS != (iStat = MsiRecordSetString(hRecInsertStr, 1, szTable))
      || ERROR_SUCCESS != (iStat = MsiRecordSetString(hRecInsertStr, 2, szColumn))
      || ERROR_SUCCESS != (iStat = MsiRecordSetString(hRecInsertStr, 3, szKeyIdentifier))
      || ERROR_SUCCESS != (iStat = MsiViewModify(hViewRes, MSIMODIFY_ASSIGN, hRecInsertStr)))
    {
      delete [] szKeyIdentifier;
      return m_fError = TRUE, iStat;
    }

    delete [] szKeyIdentifier;
    szKeyIdentifier = NULL;

  }
  if (iStat != ERROR_NO_MORE_ITEMS)
    return m_fError = TRUE, iStat; // error - ABORT

  /*}*/
  if (!WriteFile(m_hFile, szCRLF, sizeof(szCRLF)-sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;
  if (!WriteFile(m_hFile, szCurlyEnd, sizeof(szCurlyEnd)-sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;

  // update _RESStrings table with MAX_RESOURCE_ID
  PMSIHANDLE hViewStrMark = 0;
  PMSIHANDLE hRecMaxRcId = MsiCreateRecord(4);
  if (ERROR_SUCCESS != (iStat = MsiDatabaseOpenView(m_hDatabase, sqlStrMark, &hViewStrMark))
    || ERROR_SUCCESS != (iStat = MsiViewExecute(hViewStrMark, 0))
    || ERROR_SUCCESS != (iStat = MsiRecordSetString(hRecMaxRcId, 1, TEXT("MAX_RESOURCE_ID")))
    || ERROR_SUCCESS != (iStat = MsiRecordSetString(hRecMaxRcId, 2, TEXT("MAX_RESOURCE_ID")))
    || ERROR_SUCCESS != (iStat = MsiRecordSetString(hRecMaxRcId, 3, TEXT("")))
    || ERROR_SUCCESS != (iStat = MsiRecordSetInteger(hRecMaxRcId, 4, m_iStrResID))
    || ERROR_SUCCESS != (iStat = MsiViewModify(hViewStrMark, MSIMODIFY_ASSIGN, hRecMaxRcId)))
    return m_fError = TRUE, iStat; // error - ABORT

  return ERROR_SUCCESS;
}

UINT CGenerateRC::OutputStringInit ( ) [private]

Definition at line 664 of file msiloc.cpp.

{
  /**********************************************************************************
   create internal table for mapping string IDs to strings
   TABLE: _RESStrings
   COLUMNS: RCID (Short, Primary Key), Table (String), Column (String), Key (String)
  ***********************************************************************************/
  UINT iStat;
  // see if _RESStrings table is already there
  MSICONDITION eCondition = MsiDatabaseIsTablePersistent(m_hDatabase, TEXT("_RESStrings"));
  if (eCondition == MSICONDITION_TRUE)
  {
    // table persistent
    // find the last resource Id
    PMSIHANDLE hViewSelMaxRc = 0;
    PMSIHANDLE hRecMaxRc = 0;
    if (ERROR_SUCCESS != (iStat = MsiDatabaseOpenView(m_hDatabase, sqlSelMaxStrRcId, &hViewSelMaxRc))
      || ERROR_SUCCESS != (iStat = MsiViewExecute(hViewSelMaxRc, 0))
      || ERROR_SUCCESS != (iStat = MsiViewFetch(hViewSelMaxRc, &hRecMaxRc)))
      return m_fError = TRUE, iStat; // error - ABORT

    // update resource Id
    m_iStrResID = MsiRecordGetInteger(hRecMaxRc, 1);
#ifdef DEBUG
  _tprintf(TEXT("LOG>> _RESStrings Table is Present. MAX RES ID = %d\n"), m_iStrResID);
#endif
  }
  else if (eCondition == MSICONDITION_FALSE || eCondition == MSICONDITION_ERROR) // error or table temporary
    return m_fError = TRUE, ERROR_FUNCTION_FAILED; // error - ABORT
  else
  {
    // table not exist -- create it
    PMSIHANDLE h_StrMarkingView = 0;
    if (ERROR_SUCCESS != (iStat = MsiDatabaseOpenView(m_hDatabase, sqlCreateStrMap, &h_StrMarkingView))
      || ERROR_SUCCESS != (iStat = MsiViewExecute(h_StrMarkingView, 0)))
      return m_fError = TRUE, iStat; // error - ABORT
  }
  return ERROR_SUCCESS;
}

BOOL CGenerateRC::PrintDimensions | ( | int | x,
 |  | int | y,
 |  | int | wd,
 |  | int | ht |
 | ) |  |  | [private]

Definition at line 1791 of file msiloc.cpp.

{
  TCHAR szTempBuf[64] = {0};
  DWORD dwWritten;

  /*<tab>x*/
  if (!WriteFile(m_hFile, szTab, sizeof(szTab)-sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;

  if (FAILED(StringCchPrintf(szTempBuf, sizeof(szTempBuf)/sizeof(szTempBuf[0]), TEXT("%d"), x)))
    return m_fError = TRUE, FALSE;

  if (!WriteFile(m_hFile, szTempBuf, _tcslen(szTempBuf)*sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;
  /*,<tab>y*/
  if (!WriteFile(m_hFile, szCommaTab, sizeof(szCommaTab)-sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;

  if (FAILED(StringCchPrintf(szTempBuf, sizeof(szTempBuf)/sizeof(szTempBuf[0]), TEXT("%d"), y)))
    return m_fError = TRUE, FALSE;

  if (!WriteFile(m_hFile, szTempBuf, _tcslen(szTempBuf)*sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;
  /*,<tab>wd*/
  if (!WriteFile(m_hFile, szCommaTab, sizeof(szCommaTab)-sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;

  if (FAILED(StringCchPrintf(szTempBuf, sizeof(szTempBuf)/sizeof(szTempBuf[0]), TEXT("%d"), wd)))
    return m_fError = TRUE, FALSE;

  if (!WriteFile(m_hFile, szTempBuf, _tcslen(szTempBuf)*sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;
  /*,<tab>ht*/
  if (!WriteFile(m_hFile, szCommaTab, sizeof(szCommaTab)-sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;

  if (FAILED(StringCchPrintf(szTempBuf, sizeof(szTempBuf)/sizeof(szTempBuf[0]), TEXT("%d"), ht)))
    return m_fError = TRUE, FALSE;
  if (!WriteFile(m_hFile, szTempBuf, _tcslen(szTempBuf)*sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;

  // return success
  return TRUE;
}

UINT CGenerateRC::VerifyDatabaseCodepage ( ) [private]

Definition at line 1165 of file msiloc.cpp.

{
  UINT iStat;

  // only output from language neutral database
  TCHAR szTempPath[MAX_PATH+1] = {0};
  DWORD cchRet = GetTempPath(sizeof(szTempPath)/sizeof(szTempPath[0]), szTempPath);
  if (0 == cchRet || cchRet > sizeof(szTempPath)/sizeof(szTempPath[0]))
    return m_fError = TRUE, ERROR_FUNCTION_FAILED;

  // export _ForceCodepage table so can verify codepage
  if (ERROR_SUCCESS != (iStat = MsiDatabaseExport(m_hDatabase, TEXT("_ForceCodepage"), szTempPath, szCodepageExport)))
  {
    _tprintf(TEXT("LOG_ERROR>> MsiDatabaseExport(_ForceCodepage)\n"));
    return m_fError = TRUE, iStat; // error - ABORT
  }

  // open _ForceCodepage.idt to read it
  DWORD cchFullPath = _tcslen(szTempPath) + _tcslen(szCodepageExport) + 1;
  TCHAR* szFullPath = new TCHAR[cchFullPath];
  if ( !szFullPath )
    return m_fError = TRUE, ERROR_OUTOFMEMORY;

  if (FAILED(StringCchPrintf(szFullPath, cchFullPath, TEXT("%s%s"), szTempPath, szCodepageExport)))
  {
    delete [] szFullPath;
    return m_fError = TRUE, ERROR_OUTOFMEMORY;
  }

  HANDLE hFile = CreateFile(szFullPath, GENERIC_READ, FILE_SHARE_READ, (LPSECURITY_ATTRIBUTES)0, OPEN_EXISTING, FILE_FLAG_DELETE_ON_CLOSE, 0);
  if (hFile == NULL)
  {
    _tprintf(TEXT("LOG_ERROR>> OpenFile(_ForceCodepage.idt)\n"));
    delete [] szFullPath;
    return m_fError = TRUE, iStat; // error - ABORT
  }

  delete [] szFullPath;
  szFullPath = NULL;

  // read file for information
  DWORD dwSize = GetFileSize(hFile, NULL);
  if (0xFFFFFFFF == dwSize)
    return m_fError = TRUE, ERROR_FUNCTION_FAILED; // error - ABORT

  char* szBuf = new char[dwSize+1];
  if ( !szBuf )
  {
    CloseHandle(hFile);
    return m_fError = TRUE, ERROR_OUTOFMEMORY;
  }

  DWORD dwRead = 0;
  if (!ReadFile(hFile, (LPVOID)szBuf, dwSize, &dwRead, NULL)
    || 0 == dwRead)
  {
    delete [] szBuf;
    CloseHandle(hFile);
    return m_fError = TRUE, ERROR_FUNCTION_FAILED; // error - ABORT
  }
  // parse buffer
  // format should be : blank line, blank line, "codepage<tab>_ForceCodepage"
  char* pch = szBuf;
  int cBlankLines = 0;
  while (dwRead && cBlankLines != 2)
  {
    if (*pch == '\n')
      cBlankLines++;
    pch++;
    dwRead--;
  }
  if (!dwRead || cBlankLines != 2)
  {
    _tprintf(TEXT("LOG_ERROR>> Invalid ForceCodepage idt format\n"));
    delete [] szBuf;
    CloseHandle(hFile);
    return m_fError = TRUE, ERROR_FUNCTION_FAILED;
  }
  // codepage is next
  char* pchCodepage = pch;
  while (dwRead && *pch != ' ' && *pch != '\t')
  {
    pch++;
    dwRead--;
  }
  assert(dwRead);
  *pch = '\0';
  // convert codepage to int
  UINT uiCodepage = strtoul(pchCodepage, NULL, 10);

  delete [] szBuf;
  szBuf = NULL;

  if (uiCodepage != 0) // 0 is language neutral
  {
    _tprintf(TEXT("LOG_ERROR>> DATABASE IS NOT LANGUAGE NEUTRAL. CANNOT EXPORT\n"));
    _tprintf(TEXT("LOG_ERROR>> CURRENT CODEPAGE IS %d\n"), uiCodepage);
    CloseHandle(hFile);
    return m_fError = TRUE, ERROR_FUNCTION_FAILED; // error - ABORT
  }
  if (!CloseHandle(hFile))
    return m_fError = TRUE, ERROR_FUNCTION_FAILED; // error - ABORT

  return ERROR_SUCCESS;
}

BOOL CGenerateRC::WriteBinaries ( ) [private]

Definition at line 453 of file msiloc.cpp.

{
  m_fWroteBinary = TRUE;
  MSICONDITION eCond = MsiDatabaseIsTablePersistent(m_hDatabase, TEXT("Binary"));
  if (eCond == MSICONDITION_ERROR)
  {
    _tprintf(TEXT("LOG_ERROR>> MsiDatabaseIsTablePersisent(Binary)\n"));
    return m_fError = TRUE, FALSE; // error - ABORT
  }
  if (eCond != MSICONDITION_TRUE)
  {
    _tprintf(TEXT("LOG>> Binary table does not exist or is not persistent\n"));
    return TRUE;
  }

#ifdef DEBUG
  _tprintf(TEXT("LOG>>...BEGIN WRITING BINARY DATA TO RESOURCE FILE...\n"));
#endif

  UINT uiStat = ERROR_SUCCESS;
  PMSIHANDLE hViewBinary = 0;
  if (ERROR_SUCCESS != MsiDatabaseOpenView(m_hDatabase, sqlBinary, &hViewBinary)
    || ERROR_SUCCESS != MsiViewExecute(hViewBinary, 0))
    return m_fError = TRUE, FALSE; // error - ABORT

  PMSIHANDLE hRecBinary = 0;
  bdtBinaryDataType bdt;
  DWORD dwWritten = 0;
  while (ERROR_SUCCESS == (uiStat = MsiViewFetch(hViewBinary, &hRecBinary)))
  {
    TCHAR szFileBuf[2*MAX_PATH+1] = {0};
    TCHAR szPathBuf[MAX_PATH+1] = {0};
    DWORD cchLen = 0;

    if (ERROR_MORE_DATA != MsiRecordGetString(hRecBinary, ibcName, TEXT(""), &cchLen))
      return m_fError = TRUE, FALSE;

    TCHAR* szName = new TCHAR[++cchLen];
    if ( !szName )
      return m_fError = TRUE, FALSE;

    if (ERROR_SUCCESS != (uiStat = MsiRecordGetString(hRecBinary, ibcName, szName, &cchLen)))
    {
      delete [] szName;
      return m_fError = TRUE, FALSE; // error - ABORT
    }

    // find the temp directory to dump out the binary data into temp files
    DWORD cchRet = GetTempPath(sizeof(szPathBuf)/sizeof(szPathBuf[0]), szPathBuf);
    if (0 == cchRet || cchRet > sizeof(szPathBuf)/sizeof(szPathBuf[0]))
    {
      delete [] szName;
      return m_fError = TRUE, FALSE; // error - ABORT
    }

    // generate a temporary file name, prefix with IBD for Installer Binary Data
    if (0 == GetTempFileName(szPathBuf, TEXT("IBD"), 0, szFileBuf))
    {
      delete [] szName;
      return m_fError = TRUE, FALSE; // error - ABORT
    }

    // create the file
    HANDLE hBinFile = CreateFile(szFileBuf, GENERIC_WRITE, FILE_SHARE_WRITE, 0, OPEN_ALWAYS, 0, 0);
    // verify handle
    if (hBinFile == INVALID_HANDLE_VALUE)
    {
      delete [] szName;
      return m_fError = TRUE, FALSE; // error - ABORT
    }

#ifdef DEBUG
  _tprintf(TEXT("LOG>>Binary data temp file created: '%s'\n"), szFileBuf);
#endif

    // read in stream of data and write to file
    char szStream[1024] = {0};
    DWORD cbBuf = sizeof(szStream);
    BOOL fFirstRun = TRUE;
    do
    {
      if (MsiRecordReadStream(hRecBinary, ibcData, szStream, &cbBuf) != ERROR_SUCCESS)
      {
        delete [] szName;
        return m_fError = TRUE, FALSE;
      }

      if (fFirstRun)
      {
        // binary data prefixed with "BM" in stream

        if (cbBuf >= 2)
        {
          if (szStream[0] == 'B' && szStream[1] == 'M')
            bdt = bdtBitmap;
          else if (szStream[0] == 0xFF && szStream[1] == 0xD8)
            bdt = bdtJPEG;
          else if (szStream[0] == 'M' && szStream[1] == 'Z')
            bdt = bdtEXE_DLL_SCRIPT; // 'MZ prefix with exe's and dll's
          else if (szStream[0] == 0x00 && szStream[1] == 0x00)
            bdt = bdtIcon;
          else
            bdt = bdtEXE_DLL_SCRIPT;
        }
        else
          bdt = bdtEXE_DLL_SCRIPT;
#ifdef DEBUG
        if (fFirstRun && bdt != bdtEXE_DLL_SCRIPT)
          _tprintf(TEXT("LOG>> Writing <%s> '%s'\n"), bdt == bdtIcon ? TEXT("ICON") : ((bdt == bdtJPEG) ? TEXT("JPEG") : TEXT("BITMAP")), szName);
#endif // DEBUG
        fFirstRun = FALSE;
      }

      if (cbBuf && bdt != bdtEXE_DLL_SCRIPT)
      {
        if (!WriteFile(hBinFile, szStream, cbBuf, &dwWritten, 0))
        {
          delete [] szName;
          return m_fError = TRUE, FALSE; // error - ABORT
        }
      }
    }
    while (cbBuf == sizeof(szStream) && bdt != bdtEXE_DLL_SCRIPT);

    // close file
    if (!CloseHandle(hBinFile))
    {
      delete [] szName;
      return m_fError = TRUE, FALSE; // error - ABORT
    }

    if (bdt == bdtEXE_DLL_SCRIPT)
    {
      delete [] szName;
      continue; // skip over DLL and EXE binary data, not UI related
    }

    // output to resource file
    // escape chars in str
    TCHAR* szEscTitle = EscapeSlashAndQuoteForRC(szFileBuf);

    if ( !szEscTitle )
    {
      delete [] szName;
      return m_fError = TRUE, FALSE;
    }

    if (_tcslen(szEscTitle) > iMaxResStrLen)
    {
      _tprintf(TEXT("!! >> STR TOO LONG FOR RC FILE >> BITMAP FILE: %s\n"), szName);
      delete [] szName;
      delete [] szEscTitle;
      continue; // can't output this
    }
    /*NAMEID<tab>*/
    if (!WriteFile(m_hFile, szName, _tcslen(szName)*sizeof(TCHAR), &dwWritten, 0))
      m_cWriteFileErr++;
    if (!WriteFile(m_hFile, szTab, sizeof(szTab)-sizeof(TCHAR), &dwWritten, 0))
      m_cWriteFileErr++;
    switch (bdt)
    {
    case bdtBitmap: /*BITMAP*/
      if (!WriteFile(m_hFile, resBitmap, _tcslen(resBitmap)*sizeof(TCHAR), &dwWritten, 0))
        m_cWriteFileErr++;
      break;
    case bdtJPEG:   /*JPEG*/
      if (!WriteFile(m_hFile, resJPEG, _tcslen(resJPEG)*sizeof(TCHAR), &dwWritten, 0))
        m_cWriteFileErr++;
      break;
    case bdtIcon: /*ICON*/
      if (!WriteFile(m_hFile, resIcon, _tcslen(resIcon)*sizeof(TCHAR), &dwWritten, 0))
        m_cWriteFileErr++;
      break;
    default:
      return m_fError = TRUE, FALSE; // error - ABORT
    }
    /*<tab>"filename"*/
    if (!WriteFile(m_hFile, szTab, sizeof(szTab)-sizeof(TCHAR), &dwWritten, 0))
      m_cWriteFileErr++;
    if (!WriteFile(m_hFile, szQuotes, sizeof(szQuotes)-sizeof(TCHAR), &dwWritten, 0))
      m_cWriteFileErr++;
    if (!WriteFile(m_hFile, szEscTitle, _tcslen(szEscTitle)*sizeof(TCHAR), &dwWritten, 0))
      m_cWriteFileErr++;

    delete [] szEscTitle;

    if (!WriteFile(m_hFile, szQuotes, sizeof(szQuotes)-sizeof(TCHAR), &dwWritten, 0))
      m_cWriteFileErr++;
    if (!WriteFile(m_hFile, szCRLF, sizeof(szCRLF)-sizeof(TCHAR), &dwWritten, 0))
      m_cWriteFileErr++;

    delete [] szName;
  }
  if (ERROR_NO_MORE_ITEMS != uiStat)
    return m_fError = TRUE, FALSE; // error - ABORT

  // whitespace in .rc file for readability
  if (!WriteFile(m_hFile, szCRLF, sizeof(szCRLF)-sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;
  if (!WriteFile(m_hFile, szCRLF, sizeof(szCRLF)-sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;

#ifdef DEBUG
  _tprintf(TEXT("LOG>>...END WRITING BINARY DATA TO RESOURCE FILE...\n"));
#endif

  return TRUE;
}

BOOL CGenerateRC::WriteControlToRC | ( | TCHAR * | szDialog,
 |  | TCHAR * | szCtrlName,
 |  | TCHAR * | szCtrlType,
 |  | TCHAR * | szCtrlText,
 |  | TCHAR * | szCtrlProperty,
 |  | int | x,
 |  | int | y,
 |  | int | wd,
 |  | int | ht,
 |  | int | attrib |
 | ) |  |  | [private]

Definition at line 2009 of file msiloc.cpp.

{
  assert(szCtrlType != NULL);

  int iResId = 0;
  // attempt to find resource ID if previously used
  DWORD cchFindIdSQL = _tcslen(sqlFindResId) + _tcslen(szDialog) + _tcslen(szCtrlName) + 1;
  TCHAR* szFindIdSQL = new TCHAR[cchFindIdSQL];
  if ( !szFindIdSQL )
    return m_fError = TRUE, FALSE; // ERROR_OUTOFMEMORY

  if (FAILED(StringCchPrintf(szFindIdSQL, cchFindIdSQL, sqlFindResId, szDialog, szCtrlName)))
  {
    delete [] szFindIdSQL;
    return m_fError = TRUE, FALSE;
  }

  PMSIHANDLE hViewFindRes = 0;
  PMSIHANDLE hRecFindRes = 0;
  UINT iStat;
  if (ERROR_SUCCESS != (iStat = MsiDatabaseOpenView(m_hDatabase, szFindIdSQL, &hViewFindRes)))
  {
    delete [] szFindIdSQL;
    return m_fError = TRUE, FALSE; // error - ABORT
  }

  delete [] szFindIdSQL;
  szFindIdSQL = NULL;

  if (ERROR_SUCCESS != (iStat = MsiViewExecute(hViewFindRes, 0)))
    return m_fError = TRUE, FALSE; // error - ABORT
  if (ERROR_SUCCESS == (iStat = MsiViewFetch(hViewFindRes, &hRecFindRes)))
  {
    // grab res id
    iResId = MsiRecordGetInteger(hRecFindRes, 1);
  }
  else if (ERROR_NO_MORE_ITEMS == iStat)
  {
    // use next available resource Id
    iResId = ++m_iCtrlResID;
  }
  else
    return m_fError = TRUE, FALSE; // error - ABORT

  if (0 == _tcscmp(szCtrlType, szMsiPushbutton))
  {
    // StdWin
    if (!WriteStdWinCtrl(iResId, resPushButton, szCtrlText, x, y, wd, ht, attrib))
      return m_fError = TRUE, FALSE; // error - ABORT
  }
  else if (0 == _tcscmp(szCtrlType, szMsiText))
  {
    // Win32
    if (!WriteWin32Ctrl(iResId, resStaticClass, szCtrlText, TEXT("SS_LEFT"), x, y, wd, ht, attrib))
      return m_fError = TRUE, FALSE; // error - ABORT
  }
  else if (0 == _tcscmp(szCtrlType, szMsiBillboard))
  {
    // StdWin
    // output GROUPBOX for placeholder for billboard
    // it's possible one could output Billboards here, but you would need to connect changes in
    // the billboard size back and forth with the dialog dimensions on which it is displayed
    if (!WriteStdWinCtrl(iResId, resGroupBox, szCtrlText, x, y, wd, ht, attrib))
      return m_fError = TRUE, FALSE;
  }
  else if (0 == _tcscmp(szCtrlType, szMsiVolumeCostList))
  {
    // Win32
    if (!WriteWin32Ctrl(iResId, resListViewClass, szCtrlText, TEXT("WS_GROUP"), x, y, wd, ht, attrib))
      return m_fError = TRUE, FALSE; // error - ABORT
  }
  else if (0 == _tcscmp(szCtrlType, szMsiCheckBox))
  {
    // StdWin
    if (!WriteStdWinCtrl(iResId, resCheckBox, szCtrlText, x, y, wd, ht, attrib))
      return m_fError = TRUE, FALSE; // error - ABORT
  }
  else if (0 == _tcscmp(szCtrlType, szMsiGroupBox))
  {
    // StdWin
    if (!WriteStdWinCtrl(iResId, resGroupBox, szCtrlText, x, y, wd, ht, attrib))
      return m_fError = TRUE, FALSE; // error - ABORT
  }
  else if (0 == _tcscmp(szCtrlType, szMsiRadioButtonGroup))
  {
    // StdWin
    if (!WriteStdWinCtrl(iResId, resGroupBox, szCtrlText, x, y, wd, ht, attrib))
      return m_fError = TRUE, FALSE; // error - ABORT
    // write out radiobuttons
    if (!WriteRadioButtons(szDialog, szCtrlName, szCtrlProperty, x, y, attrib))
      return m_fError = TRUE, FALSE; // error - ABORT
  }
  else if (0 == _tcscmp(szCtrlType, szMsiListBox))
  {
    // Win32
    if (!WriteWin32Ctrl(iResId, resListBoxClass, szCtrlText, TEXT("LBS_STANDARD"), x, y, wd, ht, attrib))
      return m_fError = TRUE, FALSE; // error - ABORT
  }
  else if ((0 == _tcscmp(szCtrlType, szMsiEdit))
        || (0 == _tcscmp(szCtrlType, szMsiPathEdit))
        || (0 == _tcscmp(szCtrlType, szMsiMaskedEdit)))
  {
    // Win32
    if (!WriteWin32Ctrl(iResId, resEditClass, szCtrlText, TEXT("0x000"), x, y, wd, ht, attrib))
      return m_fError = TRUE, FALSE; // error - ABORT
  }
  else if (0 == _tcscmp(szCtrlType, szMsiProgressBar))
  {
    // Win32
    if (!WriteWin32Ctrl(iResId, resProgBar32Class, szCtrlText, TEXT("0x000"), x, y, wd, ht, attrib))
      return m_fError = TRUE, FALSE; // error - ABORT
  }
  else if (0 == _tcscmp(szCtrlType, szMsiDirList))
  {
    // Win32
    if (!WriteWin32Ctrl(iResId, resListViewClass, szCtrlText, TEXT("WS_BORDER"), x, y, wd, ht, attrib))
      return m_fError = TRUE, FALSE; // error - ABORT
  }
  else if (0 == _tcscmp(szCtrlType, szMsiList))
  {
    // Win32
    if (!WriteWin32Ctrl(iResId, resListViewClass, szCtrlText, TEXT("WS_BORDER"), x, y, wd, ht, attrib))
      return m_fError = TRUE, FALSE; // error - ABORT
  }
  else if (0 == _tcscmp(szCtrlType, szMsiComboBox))
  {
    // Win32
    if (!WriteWin32Ctrl(iResId, resComboBoxClass, szCtrlText, TEXT("CBS_AUTOHSCROLL"), x, y, wd, ht, attrib))
      return m_fError = TRUE, FALSE; // error - ABORT
  }
  else if (0 == _tcscmp(szCtrlType, szMsiDirCombo))
  {
    // Win32
    if (!WriteWin32Ctrl(iResId, resComboBoxClass, szCtrlText, TEXT("WS_VSCROLL"), x, y, wd, ht, attrib))
      return m_fError = TRUE, FALSE; // error - ABORT
  }
  else if (0 == _tcscmp(szCtrlType, szMsiVolSelCombo))
  {
    // Win32
    if (!WriteWin32Ctrl(iResId, resComboBoxClass, szCtrlText, TEXT("WS_VSCROLL"), x, y, wd, ht, attrib))
      return m_fError = TRUE, FALSE; // error - ABORT
  }
  else if (0 == _tcscmp(szCtrlType, szMsiBitmap))
  {
    // Win32
    if (!WriteWin32Ctrl(iResId, resStaticClass, szCtrlText, TEXT("SS_BITMAP | SS_CENTERIMAGE"), x, y, wd, ht, attrib))
      return m_fError = TRUE, FALSE; // error - ABORT
  }
  else if (0 == _tcscmp(szCtrlType, szMsiIcon))
  {
    // Win32
    if (!WriteWin32Ctrl(iResId, resStaticClass, szCtrlText, TEXT("SS_ICON | SS_CENTERIMAGE"), x, y, wd, ht, attrib))
      return m_fError = TRUE, FALSE; // error - ABORT
  }
  else if (0 == _tcscmp(szCtrlType, szMsiSelTree))
  {
    // Win32
    if (!WriteWin32Ctrl(iResId, resSelTreeClass, szCtrlText, TEXT("WS_BORDER"), x, y, wd, ht, attrib))
      return m_fError = TRUE, FALSE; // error - ABORT
  }
  else if (0 == _tcscmp(szCtrlType, szMsiLine))
  {
    // Win32
    if (!WriteWin32Ctrl(iResId, resStaticClass, szCtrlText, TEXT("SS_ETCHEDHORZ | SS_SUNKEN"), x, y, wd, ht, attrib))
      return m_fError = TRUE, FALSE; // error - ABORT
  }
  else if (0 == _tcscmp(szCtrlType, szMsiScrollableText))
  {
    // Win32
    if (!WriteWin32Ctrl(iResId, resRichEditClass, szCtrlText, TEXT("WS_GROUP"), x, y, wd, ht, attrib))
      return m_fError = TRUE, FALSE; // error - ABORT
  }
  else
  {
    // unsupported control type
    _tprintf(TEXT("!! >> Control Type: '%s' is unsupported\n"), szCtrlType);
    return m_fError = TRUE, FALSE;
  }

  // update _RESControls table with new info
  PMSIHANDLE hViewRes = 0;
  PMSIHANDLE hRecInsertCtrl = MsiCreateRecord(3);
  if (ERROR_SUCCESS != (iStat = MsiDatabaseOpenView(m_hDatabase, sqlInsertCtrl, &hViewRes))
    || ERROR_SUCCESS != (iStat = MsiViewExecute(hViewRes, 0))
    || ERROR_SUCCESS != (iStat = MsiRecordSetString(hRecInsertCtrl, 1, szDialog))
    || ERROR_SUCCESS != (iStat = MsiRecordSetString(hRecInsertCtrl, 2, szCtrlName))
    || ERROR_SUCCESS != (iStat = MsiRecordSetInteger(hRecInsertCtrl, 3, iResId))
    || ERROR_SUCCESS != (iStat = MsiViewModify(hViewRes, MSIMODIFY_ASSIGN, hRecInsertCtrl)))
  {
    _tprintf(TEXT("!! >> Unable to update _RESControls table\n"));
    return m_fError = TRUE, FALSE;
  }

  // return success
  return TRUE;
}

BOOL CGenerateRC::WriteDialogToRC | ( | TCHAR * | szDialog,
 |  | TCHAR * | szTitle,
 |  | int | x,
 |  | int | y,
 |  | int | wd,
 |  | int | ht,
 |  | int | attrib |
 | ) |  |  | [private]

Definition at line 1706 of file msiloc.cpp.

{
#ifdef DEBUG
  _tprintf(TEXT("LOG>> Writing <%s> Dialog\n"), szDialog);
#endif
  // Format for DIALOGEX is:
  // nameID DIALOGEX x, y, width, height [ , helpID]]  [[ optional-statements]]  {control-statements}

  // write out to file

  DWORD dwWritten;
  /*nameId*/
  if (!WriteFile(m_hFile, szDialog, _tcslen(szDialog)*sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;
  /*<tab>DIALOGEX*/
  if (!WriteFile(m_hFile, szTab, sizeof(szTab)-sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;
  if (!WriteFile(m_hFile, resDialog, sizeof(resDialog)-sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;
  /*x, y, wd, ht DIMENSIONS*/
  if (!PrintDimensions(x, y, wd, ht))
    return m_fError = TRUE, FALSE; // error - ABORT

  // At this point, one could optionally output the HelpId

  /*<tab>CAPTION<tab>"str"*/
  if (!WriteFile(m_hFile, szTab, sizeof(szTab)-sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;
  if (!WriteFile(m_hFile, tokCaption, sizeof(tokCaption)-sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;
  if (!WriteFile(m_hFile, szTab, sizeof(szTab)-sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;
  if (!WriteFile(m_hFile, szQuotes, sizeof(szQuotes)-sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;

  // escape chars in str
  TCHAR* szEscTitle = EscapeSlashAndQuoteForRC(szTitle);
  if ( !szEscTitle )
    return m_fError = TRUE, FALSE; // ERROR_OUTOFMEMORY
  if (_tcslen(szEscTitle) > iMaxResStrLen)
  {
    _tprintf(TEXT("!! >> STR TOO LONG FOR RC FILE >> DIALOG: %s\n"), szDialog);
    if (FAILED(StringCchCopy(szEscTitle, _tcslen(szEscTitle) + 1, strOverLimit)))
    {
      delete [] szEscTitle;
      return m_fError = TRUE, FALSE;
    }
  }
  if (!WriteFile(m_hFile, szEscTitle, _tcslen(szEscTitle)*sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;

  delete [] szEscTitle;

  if (!WriteFile(m_hFile, szQuotes, sizeof(szQuotes)-sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;
  //attributes are ignored at this time (would require conversion from Installer to Windows and masking of Installer specific)
  /*<tab>{*/
  if (!WriteFile(m_hFile, szTab, sizeof(szTab)-sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;
  if (!WriteFile(m_hFile, szCurlyBeg, sizeof(szCurlyBeg)-sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;

  if (!WriteFile(m_hFile, szCRLF, sizeof(szCRLF)-sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;
  // Select all controls associated with said dialog and output
  if (!OutputControls(szDialog))
    return m_fError = TRUE, FALSE; // error - ABORT
  if (!WriteFile(m_hFile, szCurlyEnd, sizeof(szCurlyEnd)-sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;
  if (!WriteFile(m_hFile, szCRLF, sizeof(szCRLF)-sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;

  // whitespace in .rc file for readability
  if (!WriteFile(m_hFile, szCRLF, sizeof(szCRLF)-sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;
  if (!WriteFile(m_hFile, szCRLF, sizeof(szCRLF)-sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;

  // return success
  return TRUE;
}

BOOL CGenerateRC::WriteRadioButtons | ( | TCHAR * | szDialog,
 |  | TCHAR * | szRBGroup,
 |  | TCHAR * | szProperty,
 |  | int | x,
 |  | int | y,
 |  | int | attrib |
 | ) |  |  | [private]

Definition at line 2210 of file msiloc.cpp.

{
  // Format for RadioButton is
  //  RADIOBUTTON<tab>"str",<tab>RESID,<tab>x,<tab>y,<tab>wd,<tab>ht[[,<tab> STYLE ]]
  // radiobuttons come from the RadioButton table based on the Property of the RBGroup in the Control table
  // radiobutton dimensions (X and Y) are local to the radiobutton group
  // because you can have multiple radiobutton groups with the same property in a dialog, we have to use the following
  // scheme when updating the _RESControls table:
  // Dialog<tab>RadioButtonGroup:Property:Order<tab>RESID

  // make sure radiobutton table exists
  MSICONDITION eCond = MsiDatabaseIsTablePersistent(m_hDatabase, TEXT("RadioButton"));
  switch (eCond)
  {
  case MSICONDITION_ERROR:
  case MSICONDITION_NONE:
  case MSICONDITION_FALSE:
    _tprintf(TEXT("LOG_ERROR>> RadioButton table does not exist, is not persistent, or an error occured.\n"));
    return m_fError = TRUE, FALSE; // error - ABORT
  case MSICONDITION_TRUE:
    break;
  default:
    assert(0);
  }
  int iResId = 0;

  // open view on RadioButton table
  PMSIHANDLE hViewRB = 0;
  PMSIHANDLE hRecExec = MsiCreateRecord(1);
  if (ERROR_SUCCESS != MsiDatabaseOpenView(m_hDatabase, sqlRadioButton, &hViewRB)
    || ERROR_SUCCESS != MsiRecordSetString(hRecExec, 1, szProperty)
    || ERROR_SUCCESS != MsiViewExecute(hViewRB, hRecExec))
  {
    return m_fError = TRUE, FALSE; // error - ABORT
  }
  // fetch record
  PMSIHANDLE hRecRB = 0;
  UINT iStat;
  while (ERROR_SUCCESS == (iStat = MsiViewFetch(hViewRB, &hRecRB)))
  {
    DWORD cchLen = 0;
    if (ERROR_MORE_DATA != MsiRecordGetString(hRecRB, irbcText, TEXT(""), &cchLen))
      return m_fError = TRUE, FALSE;
    TCHAR* szRBText = new TCHAR[++cchLen];
    if ( !szRBText )
      return m_fError = TRUE, FALSE; // ERROR_OUTOFMEMORY
    if (ERROR_SUCCESS != (iStat = MsiRecordGetString(hRecRB, irbcText, szRBText, &cchLen)))
    {
      _tprintf(TEXT("LOG_ERROR>> MsiRecordGetString(radio button text).  %d\n"), iStat);
      delete [] szRBText;
      return m_fError = TRUE, FALSE; // error - ABORT
    }
    int iRBX = MsiRecordGetInteger(hRecRB, irbcX);
    int iRBY = MsiRecordGetInteger(hRecRB, irbcY);
    int iRBWd = MsiRecordGetInteger(hRecRB, irbcWd);
    int iRBHt = MsiRecordGetInteger(hRecRB, irbcHt);

    // grab order value
    int iOrder = MsiRecordGetInteger(hRecRB, irbcOrder);

    // attempt to find resource ID if previously used
    DWORD cchGeneratedName = _tcslen(szRBGroup) + _tcslen(szProperty) + 25; // 25 = null + 2 ':' + iOrder
    TCHAR* szGeneratedName = new TCHAR[cchGeneratedName];
    if ( !szGeneratedName )
    {
      delete [] szRBText;
      return m_fError = TRUE, FALSE; // ERROR_OUTOFMEMORY
    }

    if (FAILED(StringCchPrintf(szGeneratedName, cchGeneratedName, TEXT("%s:%s:%d"), szRBGroup, szProperty, iOrder)))
    {
      delete [] szRBText;
      delete [] szGeneratedName;
      return m_fError = TRUE, FALSE;
    }

    DWORD cchSQL = _tcslen(sqlFindResId) + _tcslen(szDialog) + _tcslen(szGeneratedName) + 1;
    TCHAR* szSQL = new TCHAR[cchSQL];
    if ( !szSQL )
    {
      delete [] szRBText;
      delete [] szGeneratedName;
      return m_fError = TRUE, FALSE; // ERROR_OUTOFMEMORY
    }

    if (FAILED(StringCchPrintf(szSQL, cchSQL, sqlFindResId, szDialog, szGeneratedName)))
    {
      delete [] szRBText;
      delete [] szGeneratedName;
      delete [] szSQL;
      return m_fError = TRUE, FALSE;
    }

    PMSIHANDLE hViewFindRes = 0;
    PMSIHANDLE hRecFindRes = 0;
    if (ERROR_SUCCESS != (iStat = MsiDatabaseOpenView(m_hDatabase, szSQL, &hViewFindRes))
      || ERROR_SUCCESS != (iStat = MsiViewExecute(hViewFindRes, 0)))
    {
      delete [] szRBText;
      delete [] szGeneratedName;
      delete [] szSQL;
      return m_fError = TRUE, FALSE;
    }
    if (ERROR_SUCCESS == (iStat = MsiViewFetch(hViewFindRes, &hRecFindRes)))
    {
      // grab res id
      iResId = MsiRecordGetInteger(hRecFindRes, 1);
    }
    else if (ERROR_NO_MORE_ITEMS == iStat)
    {
      // use next available resource Id
      iResId = ++m_iCtrlResID;
    }
    else
    {
      delete [] szRBText;
      delete [] szGeneratedName;
      delete [] szSQL;
      return m_fError = TRUE, FALSE;
    }

    delete [] szSQL;
    szSQL = NULL;

    TCHAR szTempBuf[64] = {0};
    DWORD dwWritten = 0;
    /*KEYWORD*/
    if (!WriteFile(m_hFile, resRadioButton, _tcslen(resRadioButton)*sizeof(TCHAR), &dwWritten, 0))
      m_cWriteFileErr++;
    /*<tab>"str",*/
    if (!WriteFile(m_hFile, szTab, sizeof(szTab)-sizeof(TCHAR), &dwWritten, 0))
      m_cWriteFileErr++;
    if (!WriteFile(m_hFile, szQuotes, sizeof(szQuotes)-sizeof(TCHAR), &dwWritten, 0))
      m_cWriteFileErr++;
    // escape chars in str
    TCHAR* szEscText = EscapeSlashAndQuoteForRC(szRBText);
    if ( !szEscText )
    {
      delete [] szRBText;
      delete [] szGeneratedName;
      return m_fError = TRUE, FALSE;
    }
    if (_tcslen(szEscText) > iMaxResStrLen)
    {
      _tprintf(TEXT("!! >> STR TOO LONG FOR RC FILE >> CONTROL ID: %d\n"), iResId);
      if (FAILED(StringCchCopy(szEscText, _tcslen(szEscText) + 1, strOverLimit)))
      {
        delete [] szEscText;
        delete [] szRBText;
        delete [] szGeneratedName;
        return m_fError = TRUE, FALSE;
      }
    }
    if (!WriteFile(m_hFile, szEscText, _tcslen(szEscText)*sizeof(TCHAR), &dwWritten, 0))
      m_cWriteFileErr++;
    delete [] szEscText;
    if (!WriteFile(m_hFile, szQuotes, sizeof(szQuotes)-sizeof(TCHAR), &dwWritten, 0))
      m_cWriteFileErr++;
    if (!WriteFile(m_hFile, szCommaTab, sizeof(szCommaTab)-sizeof(TCHAR), &dwWritten, 0))
      m_cWriteFileErr++;
    /*<tab>RESId,*/
    if (!WriteFile(m_hFile, szTab, sizeof(szTab)-sizeof(TCHAR), &dwWritten, 0))
      m_cWriteFileErr++;

    if (FAILED(StringCchPrintf(szTempBuf, sizeof(szTempBuf)/sizeof(szTempBuf[0]), TEXT("%d"), iResId)))
    {
      delete [] szRBText;
      delete [] szGeneratedName;
      return m_fError = TRUE, FALSE;
    }

    if (!WriteFile(m_hFile, szTempBuf, _tcslen(szTempBuf)*sizeof(TCHAR), &dwWritten, 0))
      m_cWriteFileErr++;
    if (!WriteFile(m_hFile, szCommaTab, sizeof(szCommaTab)-sizeof(TCHAR), &dwWritten, 0))
      m_cWriteFileErr++;
    /*x, y, wd, ht DIMENSIONS*/
    // for RB, X & Y dimensions are local to group, so must add in group's x and y
    if (!PrintDimensions(x+iRBX, y+iRBY, iRBWd, iRBHt))
    {
      delete [] szRBText;
      delete [] szGeneratedName;
      return m_fError = TRUE, FALSE; // error - ABORT
    }
    //attributes are ignored at this time (would require conversion from Installer to Windows and masking of Installer specific)
    if (attrib & msidbControlAttributesBitmap)
    {
      // control with bitmap picture -- want to prevent localization of picture property names
      /*,<tab>BS_BITMAP*/
      if (!WriteFile(m_hFile, szCommaTab, sizeof(szCommaTab)-sizeof(TCHAR), &dwWritten, 0))
        m_cWriteFileErr++;

      if (FAILED(StringCchPrintf(szTempBuf, sizeof(szTempBuf)/sizeof(szTempBuf[0]), TEXT("%s"), TEXT("BS_BITMAP"))))
      {
        delete [] szRBText;
        delete [] szGeneratedName;
        return m_fError = TRUE, FALSE;
      }

      if (!WriteFile(m_hFile, szTempBuf, _tcslen(szTempBuf)*sizeof(TCHAR), &dwWritten,0))
        m_cWriteFileErr++;
    }
    else if (attrib & msidbControlAttributesIcon)
    {
      // control with icon picture
      /*<tab>BS_ICON*/
      if(!WriteFile(m_hFile, szCommaTab, sizeof(szCommaTab)-sizeof(TCHAR), &dwWritten, 0))
        m_cWriteFileErr++;

      if (FAILED(StringCchPrintf(szTempBuf, sizeof(szTempBuf)/sizeof(szTempBuf[0]), TEXT("%s"), TEXT("BS_ICON"))))
      {
        delete [] szRBText;
        delete [] szGeneratedName;
        return m_fError = TRUE, FALSE;
      }

      if (!WriteFile(m_hFile, szTempBuf, _tcslen(szTempBuf)*sizeof(TCHAR), &dwWritten,0))
        m_cWriteFileErr++;
    }
    if (!WriteFile(m_hFile, szCRLF, sizeof(szCRLF)-sizeof(TCHAR), &dwWritten, 0))
      m_cWriteFileErr++;

    // update _RESControls table with new info
    PMSIHANDLE hViewRes = 0;
    PMSIHANDLE hRecInsertCtrl = MsiCreateRecord(3);
    if (ERROR_SUCCESS != (iStat = MsiDatabaseOpenView(m_hDatabase, sqlInsertCtrl, &hViewRes))
      || ERROR_SUCCESS != (iStat = MsiViewExecute(hViewRes, 0))
      || ERROR_SUCCESS != (iStat = MsiRecordSetString(hRecInsertCtrl, 1, szDialog))
      || ERROR_SUCCESS != (iStat = MsiRecordSetString(hRecInsertCtrl, 2, szGeneratedName))
      || ERROR_SUCCESS != (iStat = MsiRecordSetInteger(hRecInsertCtrl, 3, iResId))
      || ERROR_SUCCESS != (iStat = MsiViewModify(hViewRes, MSIMODIFY_ASSIGN, hRecInsertCtrl)))
    {
      _tprintf(TEXT("!! >> Unable to update _RESControls table\n"));
      delete [] szRBText;
      delete [] szGeneratedName;
      return m_fError = TRUE, FALSE;
    }

    delete [] szRBText;
    szRBText = NULL;
    delete [] szGeneratedName;
    szGeneratedName = NULL;
  }
  if (ERROR_NO_MORE_ITEMS != iStat)// doesn't catch where property never in RadioButton table
  {
    _tprintf(TEXT("LOG_ERROR>> MsiViewFetch(RadioButton table)\n"));
    return m_fError = TRUE, FALSE; // error - ABORT
  }

  // return success
  return TRUE;
}

BOOL CGenerateRC::WriteStdWinCtrl | ( | int | iResId,
 |  | const TCHAR * | resType,
 |  | TCHAR * | szCtrlText,
 |  | int | x,
 |  | int | y,
 |  | int | wd,
 |  | int | ht,
 |  | int | attrib |
 | ) |  |  | [private]

Definition at line 2464 of file msiloc.cpp.

{
  // Format for StdWinCtrl is
  //   KEYWORD<tab>"str",<tab>RESID,<tab>x,<tab>y,<tab>wd,<tab>ht[[,<tab> STYLE ]]
  // Keyword can be one of PUSHBUTTON, CHECKBOX, GROUPBOX

  TCHAR szTempBuf[64] = {0};
  DWORD dwWritten = 0;
  /*KEYWORD*/
  if (!WriteFile(m_hFile, resType, _tcslen(resType)*sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;
  /*<tab>"str",*/
  if (!WriteFile(m_hFile, szTab, sizeof(szTab)-sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;
  if (!WriteFile(m_hFile, szQuotes, sizeof(szQuotes)-sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;
  // escape chars in str
  TCHAR* szEscText = EscapeSlashAndQuoteForRC(szCtrlText);
  if ( !szEscText )
    return m_fError = TRUE, FALSE; // ERROR_OUTOFMEMORY

  if (_tcslen(szEscText) > iMaxResStrLen)
  {
    _tprintf(TEXT("!! >> STR TOO LONG FOR RC FILE >> CONTROL ID: %d\n"), iResId);
    if (FAILED(StringCchCopy(szEscText, _tcslen(szEscText) + 1, strOverLimit)))
    {
      delete [] szEscText;
      return m_fError = TRUE, FALSE;
    }
  }
  if (!WriteFile(m_hFile, szEscText, _tcslen(szEscText)*sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;

  delete [] szEscText;
  szEscText = NULL;

  if (!WriteFile(m_hFile, szQuotes, sizeof(szQuotes)-sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;
  if (!WriteFile(m_hFile, szCommaTab, sizeof(szCommaTab)-sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;
  /*<tab>RESId,*/
  if (!WriteFile(m_hFile, szTab, sizeof(szTab)-sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;

  if (FAILED(StringCchPrintf(szTempBuf, sizeof(szTempBuf)/sizeof(szTempBuf[0]), TEXT("%d"), iResId)))
    return m_fError = TRUE, FALSE;

  if (!WriteFile(m_hFile, szTempBuf, _tcslen(szTempBuf)*sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;
  if (!WriteFile(m_hFile, szCommaTab, sizeof(szCommaTab)-sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;
  /*x, y, wd, ht DIMENSIONS*/
  if (!PrintDimensions(x, y, wd, ht))
    return FALSE; // error - ABORT
  //attributes are ignored at this time (would require conversion from Installer to Windows and masking of Installer specific)
  // valid picture controls are CheckBox, PushButton, and RadioButtons
  if (0 != _tcscmp(resType, szMsiGroupBox))
  {
    if (attrib & msidbControlAttributesBitmap)
    {
      // control with bitmap picture -- want to prevent localization of picture property names
      /*,<tab>BS_BITMAP*/
      if (!WriteFile(m_hFile, szCommaTab, sizeof(szCommaTab)-sizeof(TCHAR), &dwWritten, 0))
        m_cWriteFileErr++;

      if (FAILED(StringCchPrintf(szTempBuf, sizeof(szTempBuf)/sizeof(szTempBuf[0]), TEXT("%s"), TEXT("BS_BITMAP"))))
        return m_fError = TRUE, FALSE;

      if (!WriteFile(m_hFile, szTempBuf, _tcslen(szTempBuf)*sizeof(TCHAR), &dwWritten,0))
        m_cWriteFileErr++;
    }
    else if (attrib & msidbControlAttributesIcon)
    {
      // control with icon picture
      /*<tab>BS_ICON*/
      if(!WriteFile(m_hFile, szCommaTab, sizeof(szCommaTab)-sizeof(TCHAR), &dwWritten, 0))
        m_cWriteFileErr++;

      if (FAILED(StringCchPrintf(szTempBuf, sizeof(szTempBuf)/sizeof(szTempBuf[0]), TEXT("%s"), TEXT("BS_ICON"))))
        return m_fError = TRUE, FALSE;
      if (!WriteFile(m_hFile, szTempBuf, _tcslen(szTempBuf)*sizeof(TCHAR), &dwWritten,0))
        m_cWriteFileErr++;
    }
  }
  if (!WriteFile(m_hFile, szCRLF, sizeof(szCRLF)-sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;

  // return success
  return TRUE;
}

BOOL CGenerateRC::WriteWin32Ctrl | ( | int | iResId,
 |  | const TCHAR * | szClass,
 |  | TCHAR * | szCtrlText,
 |  | TCHAR * | szAttrib,
 |  | int | x,
 |  | int | y,
 |  | int | wd,
 |  | int | ht,
 |  | int | attrib |
 | ) |  |  | [private]

Definition at line 2557 of file msiloc.cpp.

{
  // Format for StdWinCtrl is
  //   CONTROL<tab>"str",<tab>RESID,<tab>class,<tab>attrib,<tab>x,<tab>y,<tab>wd,<tab>ht[[,<tab> STYLE ]]

  TCHAR szTempBuf[64] = {0};
  DWORD dwWritten = 0;
  /*CONTROL*/
  if (!WriteFile(m_hFile, resControl, _tcslen(resControl)*sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;
  /*<tab>"str",*/
  if (!WriteFile(m_hFile, szTab, sizeof(szTab)-sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;
  if (!WriteFile(m_hFile, szQuotes, sizeof(szQuotes)-sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;
  // escape chars in str
  TCHAR* szEscText = EscapeSlashAndQuoteForRC(szCtrlText);
  if ( !szEscText )
    return m_fError = TRUE, FALSE; // ERROR_OUTOFMEMORY

  if (_tcslen(szEscText) > iMaxResStrLen)
  {
    _tprintf(TEXT("!! >> STR TOO LONG FOR RC FILE >> CONTROL ID:%d\n"), iResId);
    if (FAILED(StringCchCopy(szEscText, _tcslen(szEscText) + 1, strOverLimit)))
    {
      delete [] szEscText;
      return m_fError = TRUE, FALSE;
    }
  }
  if (!WriteFile(m_hFile, szEscText, _tcslen(szEscText)*sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;

  delete [] szEscText;
  szEscText = NULL;

  if (!WriteFile(m_hFile, szQuotes, sizeof(szQuotes)-sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;
  if (!WriteFile(m_hFile, szCommaTab, sizeof(szCommaTab)-sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;
  /*<tab>RESId,*/
  if (FAILED(StringCchPrintf(szTempBuf, sizeof(szTempBuf)/sizeof(szTempBuf[0]), TEXT("%d"), iResId)))
    return m_fError = TRUE, FALSE;
  if (!WriteFile(m_hFile, szTempBuf, _tcslen(szTempBuf)*sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;
  if (!WriteFile(m_hFile, szCommaTab, sizeof(szCommaTab)-sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;
  /*<tab>class,*/
  if (!WriteFile(m_hFile, szClass, _tcslen(szClass)*sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;
  if (!WriteFile(m_hFile, szCommaTab, sizeof(szCommaTab)-sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;
  /*<tab>attrib,*/
  if (!WriteFile(m_hFile, szAttrib, _tcslen(szAttrib)*sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;
  if (!WriteFile(m_hFile, szCommaTab, sizeof(szCommaTab)-sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;
  /*x, y, wd, ht DIMENSIONS*/
  if (!PrintDimensions(x, y, wd, ht))
    return FALSE; // error - ABORT
  //attributes are ignored at this time (would require conversion from Installer to Windows and masking of Installer specific)
  if (!WriteFile(m_hFile, szCRLF, sizeof(szCRLF)-sizeof(TCHAR), &dwWritten, 0))
    m_cWriteFileErr++;

  // return success
  return TRUE;
}

Member Data Documentation

int CGenerateRC::m_cWriteFileErr [private]

Definition at line 280 of file msiloc.cpp.

BOOL CGenerateRC::m_fError [private]

Definition at line 278 of file msiloc.cpp.

BOOL CGenerateRC::m_fWroteBinary [private]

Definition at line 279 of file msiloc.cpp.

MSIHANDLE CGenerateRC::m_hDatabase [private]

Definition at line 275 of file msiloc.cpp.

HANDLE CGenerateRC::m_hFile [private]

Definition at line 274 of file msiloc.cpp.

int CGenerateRC::m_iCtrlResID [private]

Definition at line 276 of file msiloc.cpp.

int CGenerateRC::m_iStrResID [private]

Definition at line 277 of file msiloc.cpp.

const TCHAR* CGenerateRC::m_szDatabase [private]

Definition at line 272 of file msiloc.cpp.

const TCHAR* CGenerateRC::m_szOrigDb [private]

Definition at line 273 of file msiloc.cpp.

The documentation for this class was generated from the following file:
  • SysMgmt/Msi/msiloc/msiloc.cpp
Generated on Wed Nov 13 2024 16:56:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CGenericEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CGenericEnum Class Reference

#include "Enum.h"

Inherited by CEnumSyncMgrItems.

List of all members.

Public Member Functions

CGenericEnum (LPGENERICITEMLIST pGenericItemList, DWORD cOffset)
~CGenericEnum ()
STDMETHODIMP | Clone (CGenericEnum **ppenum)
virtual void | DeleteThisObject ()=0
STDMETHODIMP | Next (ULONG celt, LPGENERICITEM rgelt, ULONG *pceltFetched)
STDMETHODIMP | QueryInterface (REFIID, LPVOID FAR *)
STDMETHODIMP | Reset ()
STDMETHODIMP | Skip (ULONG celt)
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()

Public Attributes

DWORD m_cOffset
DWORD m_cRef
LPGENERICITEMLIST m_pGenericItemList
LPGENERICITEM m_pNextItem

Detailed Description

Definition at line 38 of file Enum.h.

Constructor & Destructor Documentation

CGenericEnum::CGenericEnum | ( | LPGENERICITEMLIST | pGenericItemList,
 |  | DWORD | cOffset
 | ) |  |

Definition at line 31 of file Enum.Cpp.

{
DWORD dwItemIndex;
m_cRef                   = 1;   // give the intial reference
m_pGenericItemList   = pGenericItemList;
m_cOffset                = cOffset;

    AddRef_ItemList(m_pGenericItemList); // increment our hold on shared memory.

    // set the current item to point to next record.
    m_pNextItem = m_pGenericItemList->pFirstGenericItem;
    dwItemIndex = cOffset;

    // this is a bug if this happens so assert in final.
    if (dwItemIndex > m_pGenericItemList->dwNumItems)
        dwItemIndex = 0;

    // move the nextItem pointer to the proper position
    while(dwItemIndex--)
    {
    m_pNextItem = m_pNextItem->pNextGenericItem;
    ++m_cOffset;

    if (NULL == m_pNextItem)
        break; // Again, another error.
    }
}

CGenericEnum::~CGenericEnum ( )

Definition at line 74 of file Enum.Cpp.

{
    Release_ItemList(m_pGenericItemList); // decrement our hold on shared memory.
}

Member Function Documentation

STDMETHODIMP CGenericEnum::Clone ( CGenericEnum ** ppenum )

Definition at line 263 of file Enum.Cpp.

{
    return E_NOTIMPL;
}

virtual void CGenericEnum::DeleteThisObject ( ) [pure virtual]

Implemented in CEnumSyncMgrItems.

STDMETHODIMP CGenericEnum::Next | ( | ULONG | celt,
 |  | LPGENERICITEM | rgelt,
 |  | ULONG * | pceltFetched
 | ) |  |

Definition at line 157 of file Enum.Cpp.

{
HRESULT hr = NOERROR;
ULONG ulFetchCount = celt;
ULONG ulNumFetched = 0;
LPGENERICITEM pGenericItem;

    if ( (m_cOffset + celt) > m_pGenericItemList->dwNumItems)
    {
    ulFetchCount = m_pGenericItemList->dwNumItems - m_cOffset;
    hr = S_FALSE;
    }

    pGenericItem = rgelt;

    while (ulFetchCount--)
    {
    *pGenericItem = *(m_pNextItem->pNextGenericItem);
    m_pNextItem = m_pNextItem->pNextGenericItem; // add error checking
    ++m_cOffset;
        ++ulNumFetched;
    ++pGenericItem;
    }

    if (pceltFetched)
    {
        *pceltFetched = ulNumFetched;
    }

    return hr;
}

STDMETHODIMP CGenericEnum::QueryInterface | ( | REFIID | riid,
 |  | LPVOID FAR * | ppv
 | ) |  |

Reimplemented in CEnumSyncMgrItems.

Definition at line 94 of file Enum.Cpp.

{
    return E_NOINTERFACE;
}

STDMETHODIMP CGenericEnum::Reset ( void )

Reimplemented in CEnumSyncMgrItems.

Definition at line 242 of file Enum.Cpp.

{
    m_pNextItem = m_pGenericItemList->pFirstGenericItem;
    return NOERROR;
}

STDMETHODIMP CGenericEnum::Skip ( ULONG celt )

Reimplemented in CEnumSyncMgrItems.

Definition at line 203 of file Enum.Cpp.

{
HRESULT hr;

    if ( (m_cOffset + celt) > m_pGenericItemList->dwNumItems)
    {
    m_cOffset = m_pGenericItemList->dwNumItems;
    m_pNextItem = NULL;
    hr = S_FALSE;
    }
    else
    {
    while (celt--)
    {
        ++m_cOffset;
        m_pNextItem = m_pNextItem->pNextGenericItem;
    }

    hr = NOERROR;
    }

    return hr;
}

CGenericEnum::STDMETHODIMP_ ( ULONG )

Reimplemented in CEnumSyncMgrItems, and CEnumSyncMgrItems.

CGenericEnum::STDMETHODIMP_ ( ULONG )

Reimplemented in CEnumSyncMgrItems, and CEnumSyncMgrItems.

Member Data Documentation

DWORD CGenericEnum::m_cOffset

Definition at line 42 of file Enum.h.

DWORD CGenericEnum::m_cRef

Definition at line 41 of file Enum.h.

LPGENERICITEMLIST CGenericEnum::m_pGenericItemList

Definition at line 43 of file Enum.h.

LPGENERICITEM CGenericEnum::m_pNextItem

Definition at line 44 of file Enum.h.

The documentation for this class was generated from the following files:
  • NetDS/SyncMgr/SyncDir/Enum.h
  • NetDS/SyncMgr/SyncDir/Enum.Cpp
Generated on Wed Nov 13 2024 16:56:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CGenericUCPApp Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CGenericUCPApp Class Reference

#include "genericucp.h"

Inherits CWinApp.

List of all members.

Public Member Functions

CGenericUCPApp ()
virtual int | ExitInstance ()
virtual BOOL | InitInstance ()

Detailed Description

Definition at line 33 of file genericucp.h.

Constructor & Destructor Documentation

CGenericUCPApp::CGenericUCPApp ( )

Definition at line 36 of file genericucp.cpp.

{
}

Member Function Documentation

int CGenericUCPApp::ExitInstance ( void ) [virtual]

Reimplemented from CWinApp.

Definition at line 89 of file genericucp.cpp.

{
  CoUninitialize();// Uninitialize the COM
  return 0;
}

BOOL CGenericUCPApp::InitInstance ( void ) [virtual]

Reimplemented from CWinApp.

Definition at line 48 of file genericucp.cpp.

{

  AfxInitRichEdit();

  AfxEnableControlContainer();

  CCommandLineInfo cmdInfo;
  ParseCommandLine(cmdInfo);

  if (cmdInfo.m_bRunEmbedded || cmdInfo.m_bRunAutomated)
  {
    return TRUE;
  }

  if(CoInitialize(NULL)!=S_OK){
    TRACE(_T("CoInitialize failed\n"));
    return FALSE; // Return if COM initialization failed
  }

  // Standard initialization

#ifdef _AFXDLL
  Enable3dControls();     // Call this when using MFC in a shared DLL
#else
  Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif

  CGenericUCPDlg dlg;
  m_pMainWnd = &dlg;

  dlg.DoModal();

  // Since the dialog has been closed, return FALSE so that we exit the
  //  application, rather than start the application's message pump.
  return FALSE;
}

The documentation for this class was generated from the following files:
  • NetDS/upnp/GenericUCP/CPP/genericucp.h
  • NetDS/upnp/GenericUCP/CPP/genericucp.cpp
Generated on Wed Nov 13 2024 16:56:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CGenericUCPDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes

CGenericUCPDlg Class Reference

#include "genericucpdlg.h"

List of all members.

Public Types

enum | { IDD = IDD_GENERICUCP_DIALOG }

Public Member Functions

CGenericUCPDlg (CWnd *pParent=NULL)
~CGenericUCPDlg ()
void | AddDevice (IUPnPDevice *pDevice)
void | RemoveDevice (BSTR bstrUDN)

Public Attributes

CEdit | m_ActionInArgument
CEdit | m_ActionName
CEdit | m_ActionOutArgument
CButton | m_AsyncFind
CButton | m_CloseApp
CComboBox | m_DeviceCombo
CButton | m_DeviceProperties
CStatic | m_EventText
CButton | m_FindByType
CButton | m_FindByUDN
CComboBox | m_FindCombo
CButton | m_InvokeAction
CButton | m_Presentation
CButton | m_QueryVariable
CEdit | m_SCPDURL
CComboBox | m_ServiceCombo
CButton | m_StartDiscovery
CStatic | m_StatusText
CEdit | m_VariableName
CButton | m_ViewSCPD

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
afx_msg void | OnAppAbout ()
afx_msg void | OnAsyncFind ()
afx_msg void | OnClose ()
afx_msg void | OnCloseClick ()
afx_msg void | OnDevpropClick ()
afx_msg void | OnDiscoveryClicked ()
afx_msg void | OnFindByType ()
afx_msg void | OnFindbyUDN ()
virtual BOOL | OnInitDialog ()
afx_msg void | OnInvokeAction ()
afx_msg void | OnPaint ()
afx_msg HCURSOR | OnQueryDragIcon ()
afx_msg void | OnQueryVariable ()
afx_msg void | OnSelEndOkComboDevice ()
afx_msg void | OnSelEndOkComboService ()
afx_msg void | OnSysCommand (UINT nID, LPARAM lParam)
virtual BOOL | PreTranslateMessage (MSG *)

Protected Attributes

HICON | m_hIcon

Private Member Functions

void | ClearAllDataStructures (BOOL fClearFindCombo)
void | ClearDeviceCombo ()
void | ClearServiceCombo ()
BOOL | fFileExists (LPTSTR ptszFileName)
void | InitializeDevTypeArray ()
void | InitializeUDNList ()
int | iNumberOfInArguments (TCHAR *tszString)
void | ProcessAsyncFind (BSTR bstrSearchType)
void | ProcessFindByType (BSTR bstrSearchType)
void | ProcessFindByUDN (BSTR bstrSearchType)
void | StopAsyncFindIfStarted ()

Private Attributes

CStringArray | m_astrDevType
BOOL m_fAsyncFindRunning
LONG | m_lAsyncFindHandle
IUPnPDeviceFinder * | m_pDeviceFinder
IUPnPDeviceFinderCallback * | m_pDeviceFinderCallback
IUPnPServiceCallback * | m_pServiceCallback

Detailed Description

Definition at line 82 of file genericucpdlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 93 of file genericucpdlg.h.

{ IDD = IDD_GENERICUCP_DIALOG };

Constructor & Destructor Documentation

CGenericUCPDlg::CGenericUCPDlg ( CWnd * pParent = NULL )

Definition at line 94 of file GenericUCPDlg.cpp.

   : CDialog(CGenericUCPDlg::IDD, pParent)
{
   HRESULT hr = S_OK;

   // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
   m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);

   // Create a device finder callback object
   m_pDeviceFinderCallback = NULL;
   m_pDeviceFinderCallback = CDeviceFinderCallback::Create();
   if (m_pDeviceFinderCallback == NULL)
   {
      MessageBox(
         _T("Error: DeviceFinderCallback object creation failed")
         );
   }
   else
   {
      ((CDeviceFinderCallback*)m_pDeviceFinderCallback)->SetDialogPointer(
                                                            this
                                                            );
   }

   // Create a service callback object
   m_pServiceCallback = NULL;
   m_pServiceCallback = CServiceCallback::Create();
   if (m_pServiceCallback == NULL)
   {
      MessageBox(_T("Error: ServiceCallback object creation failed"));
   }
   else
   {
      ((CServiceCallback*)m_pServiceCallback)->SetDialogPointer(this);
   }

}

CGenericUCPDlg::~CGenericUCPDlg ( )

Definition at line 149 of file GenericUCPDlg.cpp.

{
   // Destructor
   ReleaseObj(m_pServiceCallback);
   m_pServiceCallback = NULL;
   ReleaseObj(m_pDeviceFinderCallback);
   m_pDeviceFinderCallback = NULL;
   StopAsyncFindIfStarted();
   ReleaseObj(m_pDeviceFinder);
   m_pDeviceFinder = NULL;
}

Member Function Documentation

void CGenericUCPDlg::AddDevice ( IUPnPDevice * pDevice )

Definition at line 1117 of file GenericUCPDlg.cpp.

{
   //We are going to add a device
   HRESULT hr=S_OK;
   BSTR bstrFriendlyName = NULL;

   hr = pDevice->get_FriendlyName(&bstrFriendlyName);
   if (SUCCEEDED(hr))
   {
      pDevice->AddRef(); // Add Ref for the device
      TCHAR tszFriendlyName[DATA_BUFSIZE];
      TCHAR tszStatusString[DATA_BUFSIZE];
      _sntprintf(tszFriendlyName, DATA_BUFSIZE-1, _T("%S"), bstrFriendlyName);
      _sntprintf(
          tszStatusString,
          DATA_BUFSIZE - 1,
          _T("Added Device %s"),
          tszFriendlyName
          );

      m_StatusText.SetWindowText(tszStatusString);

      int nCount = m_DeviceCombo.GetCount(); // Find the end of the list

      m_DeviceCombo.AddString(tszFriendlyName);

      // Explicitly AddRef for passing off the ownership to the combolist item.
      pDevice->AddRef();

      // Add the item at the end of the combolist
      m_DeviceCombo.SetItemDataPtr(nCount, pDevice);
      pDevice->Release(); // Release the current ownership of the pointer

      if (nCount==0)
      {
         m_DeviceCombo.SetCurSel(0);
         OnSelEndOkComboDevice();
      }

      SysFreeString(bstrFriendlyName);
   }
   else
   {
      PrintErrorText(hr);
      m_StatusText.SetWindowText(
                      _T("Error: FriendlyName failed for device added failed")
                      );
   }
}

void CGenericUCPDlg::ClearAllDataStructures ( BOOL fClearFindCombo ) [private]

Definition at line 435 of file GenericUCPDlg.cpp.

{
   // We are going to clear all the combo boxes and all the COM interfaces.
   if (fClearFindCombo)
   {
  // Clear the find combo box
  m_FindCombo.ResetContent();
  m_astrDevType.RemoveAll();
   }

   ClearDeviceCombo();
   ClearServiceCombo();

   m_StatusText.SetWindowText(_T(""));
   m_EventText.SetWindowText(_T(""));
}

void CGenericUCPDlg::ClearDeviceCombo ( void ) [private]

Definition at line 376 of file GenericUCPDlg.cpp.

{
    IUPnPDevice *pDevice = NULL;

  // We are going to release the device pointers we have stored in ItemDataPtr of each item
    int nCount = m_DeviceCombo.GetCount();

  for (int i=0; i < nCount; i++){
        pDevice = (IUPnPDevice *) m_DeviceCombo.GetItemDataPtr(i);
        ReleaseObj(pDevice);
  }
    m_DeviceCombo.ResetContent();
}

void CGenericUCPDlg::ClearServiceCombo ( void ) [private]

Definition at line 405 of file GenericUCPDlg.cpp.

{
    IUPnPService *pService = NULL;

  // We are going to release the service pointers we have stored in ItemDataPtr of each item
    int nCount = m_ServiceCombo.GetCount();

  for (int i=0; i < nCount; i++){
        pService = (IUPnPService *) m_ServiceCombo.GetItemDataPtr(i);
        ReleaseObj(pService);
  }
    m_ServiceCombo.ResetContent();
  m_EventText.SetWindowText(_T("")); // Clear  the event text
}

void CGenericUCPDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 163 of file GenericUCPDlg.cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CGenericUCPDlg)
  DDX_Control(pDX, IDC_VARIABLENAME, m_VariableName);
  DDX_Control(pDX, IDC_ACTIONNAME, m_ActionName);
  DDX_Control(pDX, IDC_STATUS, m_StatusText);
  DDX_Control(pDX, IDC_EVENTS, m_EventText);
  DDX_Control(pDX, IDC_VIEWSCPD, m_ViewSCPD);
  DDX_Control(pDX, IDC_SCPDURL, m_SCPDURL);
  DDX_Control(pDX, IDC_PRESENTATION, m_Presentation);
  DDX_Control(pDX, IDC_QUERYVARIABLE, m_QueryVariable);
  DDX_Control(pDX, IDC_INVOKEACTION, m_InvokeAction);
  DDX_Control(pDX, IDC_DISCOVERY, m_StartDiscovery);
  DDX_Control(pDX, IDC_DEVPROP, m_DeviceProperties);
  DDX_Control(pDX, IDC_COMBOSERVICE, m_ServiceCombo);
  DDX_Control(pDX, IDC_COMBOFIND, m_FindCombo);
  DDX_Control(pDX, IDC_COMBODEVICE, m_DeviceCombo);
  DDX_Control(pDX, IDC_CLOSE, m_CloseApp);
  DDX_Control(pDX, IDC_ACTIONOUTARGUMENT, m_ActionOutArgument);
  DDX_Control(pDX, IDC_ACTIONINARGUMENT, m_ActionInArgument);
  DDX_Control(pDX, IDC_FINDBYTYPE, m_FindByType);
  DDX_Control(pDX, IDC_FINDBYUDN, m_FindByUDN);
  DDX_Control(pDX, IDC_ASYNCFIND, m_AsyncFind);
  //}}AFX_DATA_MAP
}

BOOL CGenericUCPDlg::fFileExists ( LPTSTR ptszFileName ) [private]

Definition at line 1001 of file GenericUCPDlg.cpp.

{
    DWORD   dwValue;
    dwValue = GetFileAttributes(ptszFileName);

    if (dwValue == -1 )
    {
  // Return false if we are not able to get the file attributes
        return FALSE;
    }
    else
    {
  return TRUE;
    }
}

void CGenericUCPDlg::InitializeDevTypeArray ( ) [private]

Definition at line 928 of file GenericUCPDlg.cpp.

{
   // First remove all the stored elements in the devType array
   m_astrDevType.RemoveAll();

   // Also remove the items in the FindCombo
   m_FindCombo.ResetContent();

   // Check whether the file devtype.txt exists
   if (!fFileExists(_T("devtype.txt")))
   {
      // devtype.txt file doesn't exist
      m_StatusText.SetWindowText(_T("Warning: devType.txt doesn't exist"));
      return;
   }

   // We can start reading the file
   CStdioFile fileDevType;
   if (!fileDevType.Open(_T("devtype.txt"), CFile::modeRead|CFile::typeText))
   {
      MessageBox(_T("Error: Can't open the devtype.txt file"));
      return;
   }

   CString strLine;
   while (fileDevType.ReadString(strLine))
   {
      // We have got one line at a time
      if (!strLine.IsEmpty())
      {
         // We are going to split the string first
         int iSpacePos;
         iSpacePos = strLine.Find(' '); // Find the first space character
         if (iSpacePos == -1) //space character not found
         {
            MessageBox(
               _T("Error: Malformed line in devType.txt, no space " \
               "type and description")
               );
            fileDevType.Close();
            return;
         }

         CString strDeviceType = strLine.Left(iSpacePos);
         CString strDeviceDesc = strLine.Right(
                                            strLine.GetLength() - iSpacePos - 1
                                            );

         // We are going to add this to the szaDevType Array
         m_astrDevType.Add(strDeviceType);
         //Also add the device description to the findCombo
         m_FindCombo.AddString(strDeviceDesc);
      }
   }

   fileDevType.Close();
   m_FindCombo.SetCurSel(0); // Select the first item in the list
}

void CGenericUCPDlg::InitializeUDNList ( ) [private]

Definition at line 1032 of file GenericUCPDlg.cpp.

{
   // Also remove the items in the FindCombo
   m_FindCombo.ResetContent();

   // Check whether the file udn.txt exists
   if (!fFileExists(_T("udn.txt")))
   {
      // udn.txt file doesn't exist
      m_StatusText.SetWindowText(_T("Warning: udn.txt doesn't exist"));
      return;
   }

   // We can start reading the file

   CStdioFile fileDevType;
   if (!fileDevType.Open(_T("udn.txt"), CFile::modeRead|CFile::typeText))
   {
       MessageBox(_T("Error: Can't open the udn.txt file"));
       return;
   }

   CString strLine;
   while (fileDevType.ReadString(strLine))
   {
      // We have got one line at a time
      if (!strLine.IsEmpty())
      {
         m_FindCombo.AddString(strLine);
      }
   }

   fileDevType.Close();
   m_FindCombo.SetCurSel(0); // Select the first item in the list

}

int CGenericUCPDlg::iNumberOfInArguments ( TCHAR * tszString ) [private]

Definition at line 1810 of file GenericUCPDlg.cpp.

{
  int iCount = 0;
  TCHAR *token;
  token = _tcstok(tszString, _T(" "));
  while(token!=NULL){
    iCount++;
    token = _tcstok(NULL, _T(" "));
  }
  return iCount;
}

void CGenericUCPDlg::OnAppAbout ( ) [protected]

Definition at line 68 of file GenericUCPDlg.cpp.

{
  CAboutDlg aboutDlg;
  aboutDlg.DoModal();
}

void CGenericUCPDlg::OnAsyncFind ( ) [protected]

Definition at line 520 of file GenericUCPDlg.cpp.

{
   // We are going to do AsyncFind
   // Hence we are going to load the FindCombo with the list of the types
   // from devType.txt.
   StopAsyncFindIfStarted();
   ClearAllDataStructures(TRUE);
   InitializeDevTypeArray();
}

void CGenericUCPDlg::OnClose ( ) [protected]

Definition at line 2092 of file GenericUCPDlg.cpp.

{
  ClearAllDataStructures(TRUE);
  CDialog::OnClose();
}

void CGenericUCPDlg::OnCloseClick ( ) [protected]

Definition at line 1790 of file GenericUCPDlg.cpp.

{
  EndDialog(1);
  return;
}

void CGenericUCPDlg::OnDevpropClick ( ) [protected]

Definition at line 1405 of file GenericUCPDlg.cpp.

{
   int iSelectedDevice;
   IUPnPDevice* pDevice = NULL;

   // We have to show the properties of the current device
   iSelectedDevice = m_DeviceCombo.GetCurSel();
   if (iSelectedDevice != CB_ERR)
   {
      pDevice =
          (IUPnPDevice*)m_DeviceCombo.GetItemDataPtr(iSelectedDevice);
      CDeviceProp dlg(pDevice);
      dlg.DoModal();
   }
   else
   {
      MessageBox(_T("No device selected"));
   }

}

void CGenericUCPDlg::OnDiscoveryClicked ( ) [protected]

Definition at line 545 of file GenericUCPDlg.cpp.

{
    // Disable the StartDiscovey Button if the find is a synchronous find.
    if (m_FindByType.GetCheck() || m_FindByUDN.GetCheck())
    {
       m_StartDiscovery.EnableWindow(FALSE);
    }

    HRESULT hr = S_OK;
    CString strWindowString;

    StopAsyncFindIfStarted(); // If AsyncFind is in progress, stop it
    ClearAllDataStructures(FALSE); // Don't clear the find combo box

    m_StatusText.SetWindowText(_T("Discovery Clicked"));
    m_EventText.SetWindowText(_T(""));

    // Check if we chosen an item in the list
    m_FindCombo.GetWindowText(strWindowString);
    if(strWindowString.IsEmpty() && m_FindCombo.GetCurSel()==-1)
    {
        MessageBox(_T("Select one of the items from the list"));
        return;
    }

    // We have to get the search parameters
    CString strSearchParameter;
    if(m_FindByType.GetCheck() || m_AsyncFind.GetCheck())
    {
        if(m_FindCombo.GetCurSel()==-1)
        {
            strSearchParameter=strWindowString; // Get it from the edit box
        }
        else
        {
            strSearchParameter=m_astrDevType[m_FindCombo.GetCurSel()];
        }
    }
    else
    {
        if(m_FindByUDN.GetCheck())
        {
            strSearchParameter=strWindowString;
        }
    }

    ReleaseObj(m_pDeviceFinder);
    m_pDeviceFinder = NULL;

    // Instantiate the device finder object
    hr = CoCreateInstance( CLSID_UPnPDeviceFinder,
                           NULL,
                           CLSCTX_SERVER,
                           IID_IUPnPDeviceFinder,
                           (LPVOID *)&m_pDeviceFinder);

    if(hr!=S_OK)
    {
        m_StatusText.SetWindowText(
                        _T("CoCreateInstance failed for device finder object")
                        );
        PrintErrorText(hr);
        return;
    }

    BSTR bstrSearchType = NULL;
    bstrSearchType = strSearchParameter.AllocSysString();
    if (bstrSearchType != NULL)
    {
        if(m_FindByType.GetCheck())
        {
            // We have to process the FindByType.
            ProcessFindByType(bstrSearchType);
            m_StartDiscovery.EnableWindow(TRUE);
        }
        else if (m_FindByUDN.GetCheck())
        {
            // We have to process the FindByUDN.
            ProcessFindByUDN(bstrSearchType);
            m_StartDiscovery.EnableWindow(TRUE);
        }
        else if (m_AsyncFind.GetCheck())
        {
            // We have to process the AsyncFind.
            ProcessAsyncFind(bstrSearchType);
            SysFreeString(bstrSearchType);

            // We should not release the device finder object.
            // Hence we are going to handle the exit here
            return;
        }
        m_StatusText.SetWindowText(_T("End of discovery process"));

  if(m_DeviceCombo.GetCount()>0)
        {
            m_DeviceCombo.SetCurSel(0);
            OnSelEndOkComboDevice();
        }

  SysFreeString(bstrSearchType);

        // We are not releasing the device finder interface in the case of
        // async find
        ReleaseObj(m_pDeviceFinder);

        m_pDeviceFinder = NULL;
    }

}

void CGenericUCPDlg::OnFindByType ( ) [protected]

Definition at line 468 of file GenericUCPDlg.cpp.

{
   // We are going to do a FindByType
   // Hence we are going to load the FindCombo with the list of the types
   // from devType.txt.

   StopAsyncFindIfStarted();
   ClearAllDataStructures(TRUE);
   InitializeDevTypeArray();
}

void CGenericUCPDlg::OnFindbyUDN ( ) [protected]

Definition at line 494 of file GenericUCPDlg.cpp.

{

   // We are going to do a FindByUDN
   // Hence we are going to load the FindCombo with the list of the types
   // from UDN.txt.
   StopAsyncFindIfStarted();
   ClearAllDataStructures(TRUE);
   InitializeUDNList();
}

BOOL CGenericUCPDlg::OnInitDialog ( ) [protected, virtual]

Definition at line 232 of file GenericUCPDlg.cpp.

{
  CDialog::OnInitDialog();

  // Add "About..." menu item to system menu.

  // IDM_ABOUTBOX must be in the system command range.
  ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
  ASSERT(IDM_ABOUTBOX < 0xF000);

  CMenu* pSysMenu = GetSystemMenu(FALSE);
  if (pSysMenu != NULL)
  {
    CString strAboutMenu;
    strAboutMenu.LoadString(IDS_ABOUTBOX);
    if (!strAboutMenu.IsEmpty())
    {
      pSysMenu->AppendMenu(MF_SEPARATOR);
      pSysMenu->AppendMenu(
                                     MF_STRING,
                                     IDM_ABOUTBOX,
                                     strAboutMenu
                                     );
    }
  }

  // Set the icon for this dialog.  The framework does this automatically
  //  when the application's main window is not a dialog
  SetIcon(m_hIcon, TRUE);     // Set big icon
  SetIcon(m_hIcon, FALSE);    // Set small icon
  m_pDeviceFinder = NULL;
  m_fAsyncFindRunning = FALSE; // Async Find is not running
  m_DeviceCombo.SetCurSel(-1);
  m_ServiceCombo.SetCurSel(-1);

        // Grow the size of the array five at a time
  m_astrDevType.SetSize(5,5);
  m_AsyncFind.SetCheck(TRUE);

        // Initialize the Device Types.
        InitializeDevTypeArray();

  // Tell the user to click on Start Discovery Button
  m_StatusText.SetWindowText(
            _T("Choose the type of device discovery and proceed")
            );

  return TRUE;
}

void CGenericUCPDlg::OnInvokeAction ( ) [protected]

Definition at line 1544 of file GenericUCPDlg.cpp.

{
    HRESULT hr=S_OK;
    TCHAR tszString[DATA_BUFSIZE];
    TCHAR tszTempString[DATA_BUFSIZE];
    CString strArg;
    CString strAction;
    int iCurrentDevice, iCurrentService;
    int i, iCount;
    long lIndex;

    // We are going to query the variable which is present in the variable edit box
    m_ActionOutArgument.SetWindowText(_T(""));

    iCurrentDevice=m_DeviceCombo.GetCurSel();
    if(iCurrentDevice!=CB_ERR)
    {
        iCurrentService=m_ServiceCombo.GetCurSel();
        if(iCurrentService!=CB_ERR)
        {
            m_ActionName.GetWindowText(strAction);
            if(!strAction.IsEmpty())
            {
                BSTR bstrActionName = NULL;
                bstrActionName=strAction.AllocSysString();
                if(bstrActionName!=NULL)
                {
                    m_ActionInArgument.GetWindowText(
                                          tszString,
                                          DATA_BUFSIZE - 1
                                          );

                    // Make a copy of the read string so that the main string
                    // is not modified
                    SafeStrCopy(tszTempString, tszString, DATA_BUFSIZE);

                    int iArgs = iNumberOfInArguments(tszTempString); // Get the number of arguments in the inArguments edit box

                    VARIANT vaActionArgs, vaArray, vaOutArgs, vaRet, vaOutElement;
                    VARIANT**          ppVars = NULL;
                    SAFEARRAY          *psaArgs = NULL;
                    long               lPos;
                    long    lLBound = 0L, lUBound = 0L; // For out arguments

                    //Initialize all the variants
                    VariantInit(&vaActionArgs);
                    VariantInit(&vaArray);
                    VariantInit(&vaOutArgs);
                    VariantInit(&vaRet);
                    VariantInit(&vaOutElement);

                    if(!(FAILED(HrCreateSafeArray(VT_VARIANT, iArgs, &psaArgs))||
                         FAILED(HrCreateArgVariants(iArgs, &ppVars))))
                    {
                        VariantSetArray(psaArgs, vaArray);
                        VariantSetVar(&vaArray, vaActionArgs);
                        vaArray.pparray=&psaArgs;

                        // Get the in arguments
                        // Put the arguments as strings

                        TCHAR *token;
                        iCount=0; // Initialize the counter
                        token = _tcstok(tszString, _T(" "));
                        while(token!=NULL)
                        {
                            ASSERT(iCount<iArgs); // Make sure
                            strArg=token;
                            ppVars[iCount]->vt=VT_BSTR;
                            ppVars[iCount]->bstrVal=strArg.AllocSysString(); // Converting the argument into a BSTR
                            token = _tcstok(NULL, _T(" ")); // We have the space character as the separator
                            iCount++;
                        }

                        for(i=0; i<iArgs; i++)
                        {
                            lPos=i+1;
                            SafeArrayPutElement(psaArgs, &lPos, ppVars[i]);
                        }

                        IUPnPService *pService=NULL;
                        pService = (IUPnPService *)m_ServiceCombo.GetItemDataPtr(iCurrentService);
                        pService->AddRef();
                        hr = pService->InvokeAction( bstrActionName,
                                                     vaActionArgs,
                                                     &vaOutArgs,
                                                     &vaRet);

                        if(SUCCEEDED(hr))
                        {

                            // We have to print the return value and out arguments
                            *tszString=0; // Empty the string
                            *tszTempString=0; // Empty the string

                            if(vaRet.vt!=VT_EMPTY)
                            {
                                hr=VariantChangeType(&vaRet, &vaRet, VARIANT_ALPHABOOL, VT_BSTR);
                                if(SUCCEEDED(hr))
                                {
                                    _sntprintf(
                                        tszTempString,
                                        DATA_BUFSIZE - 1,
                                        _T("%S "),
                                        vaRet.bstrVal
                                        );
                                    _tcsncat(
                                        tszString,
                                        tszTempString,
                                        DATA_BUFSIZE - 1
                                        );
                                }
                                else
                                {
                                    PrintErrorText(hr);
                                    m_StatusText.SetWindowText(
                                       _T("Error getting the return value for"
                                          " the action invoked")
                                       );
                                }
                            }

                            // We have to process the out arguments now
                            hr = HrGetSafeArrayBounds(
                                    vaOutArgs.parray,
                                    &lLBound,
                                    &lUBound
                                    );
                            if(SUCCEEDED(hr))
                            {
                                // We have got the bounds of the arguments
                                for (lIndex = lLBound;
                                    lIndex<=lUBound;
                                    ++lIndex
                                    )
                                {
                                    VariantClear(&vaOutElement);
                                    hr = HrGetVariantElement(
                                            vaOutArgs.parray,
                                            lIndex,
                                            &vaOutElement
                                            );
                                    if(SUCCEEDED(hr))
                                    {
                                        hr = VariantChangeType(
                                                &vaOutElement,
                                                &vaOutElement,
                                                VARIANT_ALPHABOOL,
                                                VT_BSTR
                                                );
                                        if (SUCCEEDED(hr))
                                        {
                                           _sntprintf(
                                               tszTempString,
                                               DATA_BUFSIZE - 1,
                                               _T("%S "),
                                               vaOutElement.bstrVal
                                               );
                                            _tcsncat(
                                                tszString,
                                                tszTempString,
                                                (DATA_BUFSIZE -
                                                 _tcslen(tszString) - 1)
                                                );
                                        }
                                        else
                                        {
                                            PrintErrorText(hr);
                                            m_StatusText.SetWindowText(
                                               _T("Error changing the out"
                                                  " argument type for the"
                                                  " action invoked")
                                                  );
                                        }
                                    }
                                    else
                                    {
                                        m_StatusText.SetWindowText(_T("Error getting the out argument for the action invoked"));
                                        PrintErrorText(hr);
                                    }
                                } // For loop

                                VariantClear(&vaOutElement);
                            }

                            m_ActionOutArgument.SetWindowText(tszString); // Print the return value and out arguments.
                        }
                        else
                        {
                            PrintErrorText(hr);
                        }
                        if(NULL != ppVars)
                            HrDestroyArgVariants(iArgs, &ppVars);
                        if(NULL != psaArgs)
                        {
                            SafeArrayDestroy(psaArgs);
                        }
                        ReleaseObj(pService);
                    }

                    VariantClear(&vaActionArgs);
                    VariantClear(&vaArray);
                    VariantClear(&vaOutArgs);
                    VariantClear(&vaRet);
                    VariantClear(&vaOutElement);
                    SysFreeString(bstrActionName);
                }
                else
                {
                    MessageBox(_T("Error: Could not allocate the memory for BSTR"));
                }

            }
            else
            {
                MessageBox(_T("Please specify an action name"));
            }

        }
        else
        {
            MessageBox(_T("No service selected"));
        }
    }
    else
    {
        MessageBox(_T("No device selected"));
    }
}

void CGenericUCPDlg::OnPaint ( void ) [protected]

Definition at line 328 of file GenericUCPDlg.cpp.

{
  if (IsIconic())
  {
    CPaintDC dc(this); // device context for painting

    SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

    // Center icon in client rectangle
    int cxIcon = GetSystemMetrics(SM_CXICON);
    int cyIcon = GetSystemMetrics(SM_CYICON);
    CRect rect;
    GetClientRect(&rect);
    int x = (rect.Width() - cxIcon + 1) / 2;
    int y = (rect.Height() - cyIcon + 1) / 2;

    // Draw the icon
    dc.DrawIcon(x, y, m_hIcon);
  }
  else
  {
    CDialog::OnPaint();
  }
}

HCURSOR CGenericUCPDlg::OnQueryDragIcon ( ) [protected]

Definition at line 355 of file GenericUCPDlg.cpp.

{
  return (HCURSOR) m_hIcon;
}

void CGenericUCPDlg::OnQueryVariable ( ) [protected]

Definition at line 1440 of file GenericUCPDlg.cpp.

{
   HRESULT hr=S_OK;
   TCHAR tszMessage[DATA_BUFSIZE];
   CString strVariable;
   int iCurrentDevice, iCurrentService;

   // We are going to query the variable which is present in the variable
   // edit box
   m_ActionOutArgument.SetWindowText(_T(""));

   iCurrentDevice = m_DeviceCombo.GetCurSel();

   if (iCurrentDevice != CB_ERR)
   {
      iCurrentService = m_ServiceCombo.GetCurSel();
      if (iCurrentService != CB_ERR)
      {
         m_VariableName.GetWindowText(strVariable);
         if (!strVariable.IsEmpty())
         {
            BSTR bstrVariableName = NULL;
            bstrVariableName=strVariable.AllocSysString();
            if (bstrVariableName!=NULL)
            {
               VARIANT varValue;
               VariantInit(&varValue);
               IUPnPService* pService;
               pService=(IUPnPService*)m_ServiceCombo.GetItemDataPtr(
                                                         iCurrentService
                                                         );
               pService->AddRef();
               hr = pService->QueryStateVariable(bstrVariableName, &varValue);

               if (SUCCEEDED(hr))
               {
                  hr = VariantChangeType(
                          &varValue,
                          &varValue,
                          VARIANT_ALPHABOOL,
                          VT_BSTR
                          );

                  if (SUCCEEDED(hr))
                  {
                    _sntprintf(
                        tszMessage,
                        DATA_BUFSIZE - 1,
                        _T("%S"),
                        varValue.bstrVal
                        );
                     m_ActionOutArgument.SetWindowText(tszMessage);
                  }
                  else
                  {
                     PrintErrorText(hr);
                  }
               }
               else
               {
                  PrintErrorText(hr);
               }

               ReleaseObj(pService);
               VariantClear (&varValue);
               SysFreeString(bstrVariableName);
            }
            else
            {
         MessageBox(_T("Error: Could not allocate the memory for BSTR"));
            }
         }
         else
         {
      MessageBox(_T("Please specify a query variable"));
         }
      }
      else
      {
         MessageBox(_T("No service selected"));
      }
   }
   else
   {
      MessageBox(_T("No device selected"));
   }

}

void CGenericUCPDlg::OnSelEndOkComboDevice ( ) [protected]

Definition at line 1247 of file GenericUCPDlg.cpp.

{
  // Current Device is changed
  TRACE(_T("SelendokDevice\n"));

  HRESULT hr = S_OK;
  IUPnPDevice *pDevice=NULL;
  IUPnPServices* pServices = NULL;
  IUnknown *punkEnum = NULL;
  IEnumUnknown *pEU = NULL;
  int iSelectedItem;
  long lIndex;
  m_StatusText.SetWindowText(_T(""));
  m_EventText.SetWindowText(_T(""));
  iSelectedItem = m_DeviceCombo.GetCurSel();
  if(iSelectedItem!=CB_ERR){
    pDevice=(IUPnPDevice *) m_DeviceCombo.GetItemDataPtr(iSelectedItem);
    pDevice->AddRef();
    ClearServiceCombo();
    hr = pDevice->get_Services(&pServices);
    if(hr==S_OK){
      long lCount;
      hr = pServices->get_Count(&lCount);
      if(SUCCEEDED(hr)){
        if(lCount!=0){
          // We have to get a IEnumUnknown pointer
          hr = pServices->get__NewEnum(&punkEnum);
          if(SUCCEEDED(hr)){
            hr = punkEnum->QueryInterface(IID_IEnumUnknown, (VOID **) &pEU);
            if(SUCCEEDED(hr)){
              for(lIndex = 0; lIndex<lCount; lIndex++){
                IUnknown *punkService = NULL;
                IUPnPService *pService=NULL;
                hr = pEU->Next(1, &punkService, NULL);
                if(SUCCEEDED(hr)){
                  // Get a IUPnPService pointer to the service just got
                  hr = punkService->QueryInterface(IID_IUPnPService, (VOID **)&pService);
                  if(SUCCEEDED(hr)){
                    BSTR bstrServiceId = NULL;
                    hr = pService->get_Id(&bstrServiceId);
                    if(SUCCEEDED(hr)){
                      TCHAR tszServiceId[DATA_BUFSIZE];
                      _sntprintf(tszServiceId, DATA_BUFSIZE-1, _T("%S"), bstrServiceId);
                      m_ServiceCombo.AddString(tszServiceId);
                      m_ServiceCombo.SetItemDataPtr((int)lIndex, pService);
                      SysFreeString(bstrServiceId);
                    }
                    else{
                      PrintErrorText(hr);
                      m_StatusText.SetWindowText(_T("Error: get_Id failed"));
                      ReleaseObj(pService);
                      ReleaseObj(punkService);
                      break;
                    }
                  }
                  else{
                    m_StatusText.SetWindowText(_T("Error: QueryInterface for IUPnPService failed"));
                    ReleaseObj(punkService);
                    break;
                  }
                  ReleaseObj(punkService);
                }
                else{
                  m_StatusText.SetWindowText(_T("Error: Traversing the service list using Next method failed"));
                  break; // Get out of the for loop
                }

              }//For loop
              if(m_ServiceCombo.GetCount()>0){
                m_ServiceCombo.SetCurSel(0);
                OnSelEndOkComboService();
              }
              ReleaseObj(pEU);
            }
            else{
              PrintErrorText(hr);
              m_StatusText.SetWindowText(_T("Error: QueryInterface for IID_IEnumUnknown failed"));
            }
            ReleaseObj(punkEnum);
          }
          else{
            PrintErrorText(hr);
            m_StatusText.SetWindowText(_T("get__NewEnum in IUPnPServices failed"));
          }
        }
        else{
          MessageBox(_T("Found no services"));
        }
      }
      else{
        PrintErrorText(hr);
        m_StatusText.SetWindowText(_T("get_Count in IUPnPServices failed"));
      }
      ReleaseObj(pServices);
    }
    else{
      PrintErrorText(hr);
      m_StatusText.SetWindowText(_T("Error: Getting services for the current device failed"));
    }
    ReleaseObj(pDevice); // Release the pDevice which is the currently selected device
  }
}

void CGenericUCPDlg::OnSelEndOkComboService ( ) [protected]

Definition at line 1363 of file GenericUCPDlg.cpp.

{
   HRESULT hr = S_OK;
   IUPnPService* pService = NULL;

   int iSelectedItem ;

   iSelectedItem = m_ServiceCombo.GetCurSel();

   if (iSelectedItem!=CB_ERR)
   {
      pService=(IUPnPService*)m_ServiceCombo.GetItemDataPtr(
                                                m_ServiceCombo.GetCurSel()
                                                );
      pService->AddRef();
      m_EventText.SetWindowText(_T(""));
      hr = pService->AddCallback(m_pServiceCallback);

      if (FAILED(hr))
      {
     PrintErrorText(hr);
   m_StatusText.SetWindowText(_T("Error: AddCallback failed"));
      }
      ReleaseObj(pService);
   }
}

void CGenericUCPDlg::OnSysCommand | ( | UINT | nID,
 |  | LPARAM | lParam |
 | ) |  |  | [protected]

Definition at line 311 of file GenericUCPDlg.cpp.

{
  if ((nID & 0xFFF0) == IDM_ABOUTBOX)
  {
    CAboutDlg dlgAbout;
    dlgAbout.DoModal();
  }
  else
  {
    CDialog::OnSysCommand(nID, lParam);
  }
}

BOOL CGenericUCPDlg::PreTranslateMessage ( MSG * pMsg ) [protected, virtual]

Definition at line 285 of file GenericUCPDlg.cpp.

{
  if (pMsg->message==WM_KEYDOWN && pMsg->wParam==VK_RETURN)
  {
    DWORD def_id=GetDefID();
    if (def_id!=0)
    {
      CWnd *wnd=FromHandle(pMsg->hwnd);
      // you may implement other ways of testing, e.g.
      //  comparing to array of CWnd*, comparing to array of IDs etc.
      char class_name[16];
      if (GetClassName(wnd->GetSafeHwnd(),class_name,sizeof(class_name))!=0)
      {
        if (_strnicmp(class_name,"edit",5)==0)
        {
          return TRUE;
          // discard the message!
        }
      }
    }
  }
  // be a good citizen - call the base class
  return CDialog::PreTranslateMessage(pMsg);
}

void CGenericUCPDlg::ProcessAsyncFind ( BSTR bstrSearchType ) [private]

Definition at line 862 of file GenericUCPDlg.cpp.

{
   HRESULT hr = S_OK;

   ASSERT(m_pDeviceFinder);
   m_StatusText.SetWindowText(_T("AsyncFind selected"));

   // We have to start the AsyncFind.
   if (m_pDeviceFinderCallback!=NULL)
   {
       hr = m_pDeviceFinder->CreateAsyncFind(
                                bstrSearchType,
                                NULL,
                                m_pDeviceFinderCallback,
                                &m_lAsyncFindHandle
                                );
       if (SUCCEEDED(hr))
       {
          hr = m_pDeviceFinder->StartAsyncFind(m_lAsyncFindHandle);
          if (SUCCEEDED(hr))
          {
             m_fAsyncFindRunning = TRUE;
          }
          else
          {
             PrintErrorText(hr);
             m_StatusText.SetWindowText(
                             _T("Error: StartAsyncFind failed")
                             );
             hr = m_pDeviceFinder->CancelAsyncFind(m_lAsyncFindHandle);
             if (FAILED(hr))
             {
                m_StatusText.SetWindowText(_T("CancelAsyncFind failed"));
                PrintErrorText(hr);
             }
          }
       }
       else
       {
          PrintErrorText(hr);
          m_StatusText.SetWindowText(_T("Error: CreateAsyncFind failed"));
       }
   }
   else
   {
      m_StatusText.SetWindowText(
                      _T("DeviceFinderCallback object is not available")
                      );
   }
}

void CGenericUCPDlg::ProcessFindByType ( BSTR bstrSearchType ) [private]

Definition at line 671 of file GenericUCPDlg.cpp.

{
   // We have to process FindByType search
   HRESULT hr = S_OK;
   IUPnPDevices* pDevices = NULL;
   IUnknown* punkEnum = NULL;
   IEnumUnknown *pEU = NULL;

   ASSERT(m_pDeviceFinder);
   m_StatusText.SetWindowText(_T("FindByType selected"));
   hr = m_pDeviceFinder->FindByType(bstrSearchType, 0,  &pDevices);
   if (SUCCEEDED(hr))
   {
      // We have to enumerate the devices
      long lCount;
      hr = pDevices->get_Count(&lCount);
      if (SUCCEEDED(hr))
      {
         if (lCount != 0)
         {
            hr = pDevices->get__NewEnum(&punkEnum);
            if (SUCCEEDED(hr))
            {
               hr = punkEnum->QueryInterface(IID_IEnumUnknown, (VOID **) &pEU);
               if (SUCCEEDED(hr))
               {
                  for (long lIndex = 0; lIndex<lCount; lIndex++)
                  {
                     IUnknown* punkDevice = NULL;
                     IUPnPDevice* pDevice=NULL;
                     hr = pEU->Next(1, &punkDevice, NULL);
                     if (SUCCEEDED(hr))
                     {
                        // Get a IUPnPDevice pointer to the device just got
                        hr = punkDevice->QueryInterface(
                                            IID_IUPnPDevice,
                                            (VOID **)&pDevice
                                            );
                        if (SUCCEEDED(hr))
                        {
                           // Add the found device to the device list
                           // Get the friendly name of the device
                           BSTR bstrFriendlyName = NULL;
                           hr = pDevice->get_FriendlyName(&bstrFriendlyName);
                           if (SUCCEEDED(hr))
                           {
                              TCHAR tszFriendlyName[DATA_BUFSIZE];
                              _sntprintf(
                                  tszFriendlyName,
                                  DATA_BUFSIZE - 1,
                                  _T("%S"),
                                  bstrFriendlyName
                                  );
                              m_DeviceCombo.AddString(tszFriendlyName);
                              m_DeviceCombo.SetItemDataPtr(
                                               (int)lIndex,
                                               pDevice
                                               );
                              SysFreeString(bstrFriendlyName);
                           }
                           else
                           {
                              m_StatusText.SetWindowText(
                                              _T("Error: FriendlyName failed")
                                              );
                              PrintErrorText(hr);
                              ReleaseObj(pDevice);
                              ReleaseObj(punkDevice);
                              break;
                           }
                        }
                        else
                        {
                            m_StatusText.SetWindowText(
                             _T("Error: QueryInterface for IUPnPDevice failed")
                             );
                            PrintErrorText(hr);
                            ReleaseObj(punkDevice);
                            break;
                        }
                        ReleaseObj(punkDevice);
                     }
                     else
                     {
                        m_StatusText.SetWindowText(
                           _T("Error: Traversing the device list using Next"
                              " method failed")
                           );
                        PrintErrorText(hr);
                        break; // Get out of the for loop
                     }
                  } // For loop
                  ReleaseObj(pEU);
               }
               else
               {
                  m_StatusText.SetWindowText(
                      _T("Error: QueryInterface for IID_IEnumUnknown failed")
                      );
                  PrintErrorText(hr);
               }
               ReleaseObj(punkEnum);
            }
            else
            {
               m_StatusText.SetWindowText(
                               _T("get__NewEnum in IUPnPDevices failed")
                               );
               PrintErrorText(hr);
            }
         }
         else
         {
            MessageBox(_T("Found no devices"));
         }
      }
      else
      {
         m_StatusText.SetWindowText(_T("get_Count in IUPnPDevices failed"));
         PrintErrorText(hr);
      }
      ReleaseObj(pDevices);
   }
   else
   {
      m_StatusText.SetWindowText(_T("FindByType failed"));
      PrintErrorText(hr);
   }
}

void CGenericUCPDlg::ProcessFindByUDN ( BSTR bstrSearchType ) [private]

Definition at line 816 of file GenericUCPDlg.cpp.

{
  // FindByUDN selected
  HRESULT hr= S_OK;

  m_StatusText.SetWindowText(_T("FindByUDN selected"));
  ASSERT(m_pDeviceFinder);
  IUPnPDevice* pDevice = NULL;
  hr = m_pDeviceFinder->FindByUDN(bstrSearchType, &pDevice);
  if(hr==S_OK){
    // Found a device with given udn
    // Add the found device to the device list
    // Get the friendly name of the device
    BSTR bstrFriendlyName = NULL;
    hr = pDevice->get_FriendlyName(&bstrFriendlyName);
    if(SUCCEEDED(hr)){
      TCHAR tszFriendlyName[DATA_BUFSIZE];
      _sntprintf(tszFriendlyName, DATA_BUFSIZE-1, _T("%S"), bstrFriendlyName);
      m_DeviceCombo.AddString(tszFriendlyName);
      m_DeviceCombo.SetItemDataPtr(0, pDevice); // Add as the first element
      SysFreeString(bstrFriendlyName);
    }
    else{
      m_StatusText.SetWindowText(_T("Error: FriendlyName failed"));
      PrintErrorText(hr);
    }
  }
  else{
    MessageBox(_T("Found no device with given udn"));
  }
}

void CGenericUCPDlg::RemoveDevice ( BSTR bstrUDN )

Definition at line 1182 of file GenericUCPDlg.cpp.

{
    //We are going to remove the device
    HRESULT hr=S_OK;
    IUPnPDevice *pDevice = NULL;
    BSTR bstrTemp = NULL;

    // We are going to release the device pointers we have stored in ItemDataPtr of each item
    int nCount = m_DeviceCombo.GetCount();

    for (int i=0; i < nCount; i++)
    {
        pDevice = (IUPnPDevice *) m_DeviceCombo.GetItemDataPtr(i);

        pDevice->AddRef();

        // Check if the device pointer is the one we want
        hr=pDevice->get_UniqueDeviceName(&bstrTemp);

        if(SUCCEEDED(hr))
        {
            if(wcscmp(bstrTemp, bstrUDN)==0)
            {
                // This is the removed device
                ReleaseObj(pDevice); //Since we are going to remove the device, we have to release it totally.
                m_DeviceCombo.DeleteString(i);
                i--; // So that we search the next device in the list
                nCount--;

                break;
            }

            SysFreeString(bstrTemp);

            bstrTemp = NULL;
        }
        else
        {
            PrintErrorText(hr);
            m_StatusText.SetWindowText(_T("Error: GetUniqueDeviceName failed for the device in the list"));
        }
        ReleaseObj(pDevice);
    }

    if ( bstrTemp != NULL )
    {
        SysFreeString(bstrTemp);
    }

}

void CGenericUCPDlg::StopAsyncFindIfStarted ( ) [private]

Definition at line 1083 of file GenericUCPDlg.cpp.

{
   HRESULT hr = S_OK;

   // This will stop the async find if it is in progress
   if (m_fAsyncFindRunning == TRUE)
   {
      ASSERT(m_pDeviceFinder != NULL);
      hr = m_pDeviceFinder->CancelAsyncFind(m_lAsyncFindHandle);
      if (FAILED(hr))
      {
         m_StatusText.SetWindowText(_T("CancelAsyncFind failed"));
         MessageBox("Cancel Async Find Failed.", "Error");
      }

      m_fAsyncFindRunning=FALSE;
   }
}

Member Data Documentation

CEdit CGenericUCPDlg::m_ActionInArgument

Definition at line 110 of file genericucpdlg.h.

CEdit CGenericUCPDlg::m_ActionName

Definition at line 95 of file genericucpdlg.h.

CEdit CGenericUCPDlg::m_ActionOutArgument

Definition at line 109 of file genericucpdlg.h.

CStringArray CGenericUCPDlg::m_astrDevType [private]

Definition at line 168 of file genericucpdlg.h.

CButton CGenericUCPDlg::m_AsyncFind

Definition at line 113 of file genericucpdlg.h.

CButton CGenericUCPDlg::m_CloseApp

Definition at line 108 of file genericucpdlg.h.

CComboBox CGenericUCPDlg::m_DeviceCombo

Definition at line 107 of file genericucpdlg.h.

CButton CGenericUCPDlg::m_DeviceProperties

Definition at line 104 of file genericucpdlg.h.

CStatic CGenericUCPDlg::m_EventText

Definition at line 97 of file genericucpdlg.h.

BOOL CGenericUCPDlg::m_fAsyncFindRunning [private]

Definition at line 167 of file genericucpdlg.h.

CButton CGenericUCPDlg::m_FindByType

Definition at line 111 of file genericucpdlg.h.

CButton CGenericUCPDlg::m_FindByUDN

Definition at line 112 of file genericucpdlg.h.

CComboBox CGenericUCPDlg::m_FindCombo

Definition at line 106 of file genericucpdlg.h.

HICON CGenericUCPDlg::m_hIcon [protected]

Definition at line 125 of file genericucpdlg.h.

CButton CGenericUCPDlg::m_InvokeAction

Definition at line 102 of file genericucpdlg.h.

LONG CGenericUCPDlg::m_lAsyncFindHandle [private]

Definition at line 166 of file genericucpdlg.h.

IUPnPDeviceFinder* CGenericUCPDlg::m_pDeviceFinder [private]

Definition at line 164 of file genericucpdlg.h.

IUPnPDeviceFinderCallback* CGenericUCPDlg::m_pDeviceFinderCallback [private]

Definition at line 172 of file genericucpdlg.h.

CButton CGenericUCPDlg::m_Presentation

Definition at line 100 of file genericucpdlg.h.

IUPnPServiceCallback* CGenericUCPDlg::m_pServiceCallback [private]

Definition at line 173 of file genericucpdlg.h.

CButton CGenericUCPDlg::m_QueryVariable

Definition at line 101 of file genericucpdlg.h.

CEdit CGenericUCPDlg::m_SCPDURL

Definition at line 99 of file genericucpdlg.h.

CComboBox CGenericUCPDlg::m_ServiceCombo

Definition at line 105 of file genericucpdlg.h.

CButton CGenericUCPDlg::m_StartDiscovery

Definition at line 103 of file genericucpdlg.h.

CStatic CGenericUCPDlg::m_StatusText

Definition at line 96 of file genericucpdlg.h.

CEdit CGenericUCPDlg::m_VariableName

Definition at line 94 of file genericucpdlg.h.

CButton CGenericUCPDlg::m_ViewSCPD

Definition at line 98 of file genericucpdlg.h.

The documentation for this class was generated from the following files:
  • NetDS/upnp/GenericUCP/CPP/genericucpdlg.h
  • NetDS/upnp/GenericUCP/CPP/GenericUCPDlg.cpp
Generated on Wed Nov 13 2024 16:56:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CGetInfoExDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes

CGetInfoExDlg Class Reference

#include "ADs.h"

List of all members.

Public Types

enum | { IDD = IDD_GETINFOEX }

Public Member Functions

CGetInfoExDlg (CWnd *pParent=NULL)
CString GetAttribute ()

Public Attributes

CString m_sAttrText

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
virtual void | OnOK ()

Protected Attributes

CString m_sAttr

Detailed Description

Definition at line 73 of file ADs.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 82 of file ADs.h.

{ IDD = IDD_GETINFOEX };

Constructor & Destructor Documentation

CGetInfoExDlg::CGetInfoExDlg ( CWnd * pParent = NULL )

Definition at line 441 of file ADs.cpp.

  : CDialog(CGetInfoExDlg::IDD, pParent)
{
  //{{AFX_DATA_INIT(CGetInfoExDlg)
  m_sAttrText = _T("");
  //}}AFX_DATA_INIT
}

Member Function Documentation

void CGetInfoExDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 450 of file ADs.cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CGetInfoExDlg)
  DDX_Text(pDX, IDC_ATTR, m_sAttrText);
  //}}AFX_DATA_MAP
}

CString CGetInfoExDlg::GetAttribute ( ) [inline]

Definition at line 78 of file ADs.h.

{ return m_sAttr; }

void CGetInfoExDlg::OnOK ( ) [protected, virtual]

Definition at line 467 of file ADs.cpp.

{
  UpdateData(TRUE);
  m_sAttr = m_sAttrText;
  CDialog::OnOK();
}

Member Data Documentation

CString CGetInfoExDlg::m_sAttr [protected]

Definition at line 97 of file ADs.h.

CString CGetInfoExDlg::m_sAttrText

Definition at line 83 of file ADs.h.

The documentation for this class was generated from the following files:
  • NetDS/ADSI/samples/General/ADQI/ADs.h
  • NetDS/ADSI/samples/General/ADQI/ADs.cpp
Generated on Wed Nov 13 2024 16:56:37 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CGetReceipt Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CGetReceipt Class Reference

#include "getrec.h"

List of all members.

Public Member Functions

CGetReceipt ()
CGetReceipt ()
STDMETHOD() | GetNextReceipt (OUT long *plReceiptNo)
STDMETHOD() | GetNextReceipt (OUT long *plReceiptNo)
STDMETHOD() | InterfaceSupportsErrorInfo (REFIID riid)
STDMETHOD() | InterfaceSupportsErrorInfo (REFIID riid)

Detailed Description

Definition at line 32 of file getrec.h.

Constructor & Destructor Documentation

CGetReceipt::CGetReceipt ( ) [inline]

Definition at line 39 of file getrec.h.

{}

CGetReceipt::CGetReceipt ( ) [inline]

Definition at line 40 of file getreceipt.h.

{}

Member Function Documentation

STDMETHODIMP CGetReceipt::GetNextReceipt ( OUT long * plReceiptNo )

Definition at line 58 of file getrec.Cpp.

                                                               {

  HRESULT hr = S_OK;

  IObjectContext* pObjectContext = NULL;

  ISharedPropertyGroupManager* spmMgr = NULL;
  ISharedPropertyGroup* spmGroup = NULL;
  ISharedProperty* spmPropNextReceipt = NULL;
  ISharedProperty* spmPropMaxNum = NULL;

  IUpdateReceipt* pObjUpdateReceipt = NULL;

  CComVariant vNextReceipt;

  long lErrFlag = 0;
  BSTR sErr = NULL;
  LONG lIsolationMode = LockMethod;
  LONG lReleaseMode = Process;
  CComVariant vMaxNum;
  VARIANT_BOOL bExists = VARIANT_FALSE;

  hr = CoGetObjectContext(IID_IObjectContext, (void**)&pObjectContext);
  if (!pObjectContext)
  {
    sErr = SysAllocString(L"No Object Context in GetNextReceipt");
    goto end;
  }

  // Create the SharedPropertyGroupManager
  hr = CoCreateInstance (CLSID_SharedPropertyGroupManager, NULL, CLSCTX_ALL, IID_ISharedPropertyGroupManager, (void**)&spmMgr);
  if (FAILED(hr))
  {
    sErr = SysAllocString(L"Failed to create CLSID_SharedPropertyGroupManager");
    goto end;
  }

  // Create the SharedPropertyGroup

  hr = spmMgr->CreatePropertyGroup (L"Receipt", &lIsolationMode, &lReleaseMode, &bExists, &spmGroup);
  if (FAILED(hr))
  {
    sErr = SysAllocString(L"Failed to create 'Receipt' group in SPM");
    goto end;
  }

  // Create the two shared properties
  hr = spmGroup->CreateProperty (L"Next", &bExists, &spmPropNextReceipt);
  if (FAILED(hr))
  {
    sErr = SysAllocString(L"Failed to create 'Next' property in SPM");
    goto end;
  }

  hr = spmGroup->CreateProperty (L"MaxNum", &bExists, &spmPropMaxNum);
  if (FAILED(hr))
  {
    sErr = SysAllocString(L"Failed to create 'MaxNum' property in SPM");
    goto end;
  }

  // Obtain their current values
  hr = spmPropNextReceipt->get_Value (&vNextReceipt);
  _ASSERTE(hr==S_OK);
  hr = spmPropMaxNum->get_Value (&vMaxNum);
  _ASSERTE(hr==S_OK);

  // Does MaxNum require an update?
  if (vNextReceipt.lVal >= vMaxNum.lVal)
  {

    // Create an UpdateReceipt object
    hr = CoCreateInstance (CLSID_CUpdateReceipt, NULL, CLSCTX_ALL, IID_IUpdateReceipt,  (void**)&pObjUpdateReceipt);
    if (FAILED(hr))
    {
      sErr = SysAllocString(L"Failed to create UpdateReceipt object");
      goto end;

    }

    // Update NextReceipt
    hr = pObjUpdateReceipt->Update (&vNextReceipt.lVal);
    if (FAILED(hr))
      goto end; // ErrorInfo populated

    // Update NextReceipt shared property
    hr = spmPropNextReceipt->put_Value (vNextReceipt);
    _ASSERTE(hr==S_OK);

    // Update MaxNum shared property
    vMaxNum.lVal = vNextReceipt.lVal + 100;
    hr = spmPropMaxNum->put_Value (vMaxNum);
    _ASSERTE(hr == S_OK);
  }

  // Increment NextReceipt shared property
  vNextReceipt.lVal ++;
  hr = spmPropNextReceipt->put_Value (vNextReceipt);
  _ASSERTE(hr==S_OK);
  *plReceiptNo = vNextReceipt.lVal;
end:

  if (sErr)
  {

    AtlReportError( CLSID_CGetReceipt, sErr, IID_IGetReceipt, hr);
    if (pObjectContext)
      pObjectContext -> SetAbort();
    SysFreeString(sErr);

  }

  else
  {
    // We're finished and happy
    pObjectContext->SetComplete();

  }

  // Resource cleanup
  if (pObjectContext)
    pObjectContext->Release();

  if (spmMgr)
    spmMgr->Release();

  if (spmGroup)
    spmGroup->Release();

  if (spmPropNextReceipt)
    spmPropNextReceipt->Release();

  if (spmPropMaxNum)
    spmPropMaxNum->Release();

  if (pObjUpdateReceipt)
    pObjUpdateReceipt->Release();

  return hr;
}

STDMETHOD() CGetReceipt::GetNextReceipt ( OUT long * plReceiptNo )
STDMETHOD() CGetReceipt::InterfaceSupportsErrorInfo ( REFIID riid )
STDMETHODIMP CGetReceipt::InterfaceSupportsErrorInfo ( REFIID riid )

Definition at line 35 of file getrec.Cpp.

{
  static const IID* arr[] =
  {
    &IID_IGetReceipt,
  };

  for (int i=0;i<sizeof(arr)/sizeof(arr[0]);i++)
  {
    // refer to guiddef.h
    if (::InlineIsEqualGUID(*arr[i],riid))
      return S_OK;
  }
  return S_FALSE;
}

The documentation for this class was generated from the following files:
  • Com/Services/Object_Pooling/OPBankSample/Account.VC/getrec.h
  • Com/Services/Transaction/SampleBank/VCAcct/getreceipt.h
  • Com/Services/Object_Pooling/OPBankSample/Account.VC/getrec.Cpp
  • Com/Services/Transaction/SampleBank/VCAcct/getreceipt.Cpp
Generated on Wed Nov 13 2024 16:56:37 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CGrid Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Protected Attributes

CGrid Class Reference

#include "Grid.Hxx"

Inherits IGrid.

Inherited by CLineGrid, and CTextGrid.

List of all members.

Public Member Functions

CGrid ()
STDMETHOD() | Detach ()
STDMETHOD() | Draw (RECT rcBounds, RECT rcUpdate, LONG lDrawFlags, HDC hdc, LPVOID pvDrawObject)
STDMETHOD() | FindBehavior (BSTR bstrBehavior, BSTR bstrBehaviorUrl, IElementBehaviorSite *pSite, IElementBehavior **ppBehavior)
STDMETHOD() | get_GridSize (long *pVal)
STDMETHOD() | GetPainterInfo (HTML_PAINTER_INFO *pInfo)
STDMETHOD() | HitTestPoint (POINT pt, BOOL *pbHit, LONG *plPartID)
STDMETHOD() | Init (IElementBehaviorSite *pBehaviorSite)
STDMETHOD() | Notify (LONG lEvent, VARIANT *pVar)
STDMETHOD() | OnResize (SIZE size)
virtual void | Paint (CCanvas &canvas, RECT rc, POINT pt)=0
STDMETHOD() | put_GridSize (long newVal)
STDMETHOD() | SetInterfaceSafetyOptions (REFIID riid, DWORD dwOptionSetMask, DWORD dwEnabledOptions)
void | Trace (WCHAR *message)

Public Attributes

long | m_lClientLeft
long | m_lClientTop
long | m_lGridSize
CComPtr< IHTMLPaintSite > | m_spPaintSite
CComPtr< IElementBehaviorSite > | m_spSite

Protected Attributes

UINT _cCol
UINT _cRow
SIZE | _size

Detailed Description

Definition at line 53 of file Grid.Hxx.

Constructor & Destructor Documentation

CGrid::CGrid ( ) [inline]

Definition at line 31 of file Grid.h.

          : m_lGridSize(50)
  {
  }

Member Function Documentation

STDMETHODIMP CGrid::Detach ( )

Definition at line 58 of file Grid.cpp.

{
  m_spPaintSite->InvalidateRect(NULL);
  return S_OK;
}

STDMETHODIMP CGrid::Draw | ( | RECT | rcBounds,
 |  | RECT | rcUpdate,
 |  | LONG | lDrawFlags,
 |  | HDC | hdc,
 |  | LPVOID | pvDrawObject
 | ) |  |

Definition at line 65 of file Grid.cpp.

{
  HPEN redPen = (HPEN)CreatePen(PS_DOT, 0, RGB(0xff, 0x99, 0x99));
  HPEN oldPen = (HPEN)SelectObject(hdc, redPen);

  long lFirstLine = rcBounds.left;

  for (int i = lFirstLine; i <= rcBounds.right; i += m_lGridSize)
  {
    MoveToEx(hdc, i, rcBounds.top, NULL);
    LineTo(hdc, i, rcBounds.bottom);
  }

  lFirstLine = rcBounds.top;

  for (i = lFirstLine ; i <= rcBounds.bottom; i += m_lGridSize)
  {
    MoveToEx(hdc, rcBounds.left, i,  NULL);
    LineTo(hdc, rcBounds.right, i);
  }

  return S_OK;
}

STDMETHODIMP CGrid::FindBehavior | ( | BSTR | bstrBehavior,
 |  | BSTR | bstrBehaviorUrl,
 |  | IElementBehaviorSite * | pSite,
 |  | IElementBehavior ** | ppBehavior
 | ) |  |

Definition at line 131 of file Grid.cpp.

{
  HRESULT hr;

  hr = this->QueryInterface(IID_IElementBehavior, (void**)ppBehavior );

  return hr;
}

STDMETHODIMP CGrid::get_GridSize ( long * pVal )

Definition at line 15 of file Grid.cpp.

{
  pVal = &m_lGridSize;

  return S_OK;
}

STDMETHODIMP CGrid::GetPainterInfo ( HTML_PAINTER_INFO * pInfo )

Definition at line 91 of file Grid.cpp.

{
  if (pInfo == NULL)
    return E_POINTER;

  pInfo->lFlags = HTMLPAINTER_TRANSPARENT;
  pInfo->lZOrder = HTMLPAINT_ZORDER_BELOW_CONTENT;

  memset(&pInfo->iidDrawObject, 0, sizeof(IID));

  pInfo->rcExpand.left = 0;
  pInfo->rcExpand.right = 0;
  pInfo->rcExpand.top = 0;
  pInfo->rcExpand.bottom = 0;

  return S_OK;
}

STDMETHODIMP CGrid::HitTestPoint | ( | POINT | pt,
 |  | BOOL * | pbHit,
 |  | LONG * | plPartID
 | ) |  |

Definition at line 109 of file Grid.cpp.

{
  if (pbHit == NULL)
    return E_POINTER;

  if (plPartID == NULL)
    return E_POINTER;

  return E_NOTIMPL;
}

STDMETHODIMP CGrid::Init ( IElementBehaviorSite * pBehaviorSite )

Definition at line 31 of file Grid.cpp.

{
  HRESULT hr;
  IHTMLElement* pBody;
  IHTMLElement2* pBody2;

  pBehaviorSite->GetElement(&pBody);
  pBody->QueryInterface(IID_IHTMLElement2, (void**)&pBody2);

  pBody2->get_clientTop(&m_lClientTop);
  pBody2->get_clientLeft(&m_lClientLeft);
  m_spSite = pBehaviorSite;

  hr = m_spSite->QueryInterface(IID_IHTMLPaintSite, (void**)&m_spPaintSite);

  return hr;
}

STDMETHODIMP CGrid::Notify | ( | LONG | lEvent,
 |  | VARIANT * | pVar
 | ) |  |

Definition at line 50 of file Grid.cpp.

{
  if (pVar == NULL)
    return E_POINTER;

  return E_NOTIMPL;
}

STDMETHODIMP CGrid::OnResize ( SIZE size )

Definition at line 89 of file Grid.cpp.

{return S_OK;}

virtual void CGrid::Paint | ( | CCanvas & | canvas,
 |  | RECT | rc,
 |  | POINT | pt |
 | ) |  |  | [pure virtual]

Implemented in CLineGrid, and CTextGrid.

STDMETHODIMP CGrid::put_GridSize ( long newVal )

Definition at line 22 of file Grid.cpp.

{
  m_lGridSize = newVal;
  m_spPaintSite->InvalidateRect(NULL);

  return S_OK;
}

STDMETHODIMP CGrid::SetInterfaceSafetyOptions | ( | REFIID | riid,
 |  | DWORD | dwOptionSetMask,
 |  | DWORD | dwEnabledOptions
 | ) |  |

Definition at line 121 of file Grid.cpp.

{
     // Set the safety options we have been asked to set.
  m_dwCurrentSafety = m_dwCurrentSafety  & ~dwEnabledOptions | dwOptionSetMask;
  return S_OK;
}

void CGrid::Trace ( WCHAR * message ) [inline]

Definition at line 77 of file Grid.h.

  {
    MessageBoxW(NULL, message, L"Trace", NULL);
  }

Member Data Documentation

UINT CGrid::_cCol [protected]

Definition at line 59 of file Grid.Hxx.

UINT CGrid::_cRow [protected]

Definition at line 60 of file Grid.Hxx.

SIZE CGrid::_size [protected]

Definition at line 58 of file Grid.Hxx.

long CGrid::m_lClientLeft

Definition at line 52 of file Grid.h.

long CGrid::m_lClientTop

Definition at line 51 of file Grid.h.

long CGrid::m_lGridSize

Definition at line 50 of file Grid.h.

CComPtr<IHTMLPaintSite> CGrid::m_spPaintSite

Definition at line 49 of file Grid.h.

CComPtr<IElementBehaviorSite> CGrid::m_spSite

Definition at line 48 of file Grid.h.

The documentation for this class was generated from the following files:
  • Multimedia/Gdi/Fonts/GridFont/Grid.Hxx
  • Web/Browser/EditHost/Grid.h
  • Web/Browser/EditHost/Grid.cpp
Generated on Wed Nov 13 2024 16:56:37 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CGridIt Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CGridIt Class Reference

#include "Grid.Hxx"

List of all members.

Public Member Functions

CGridIt (UINT cCol, UINT cRow, SIZE size, POINT pt)
UINT Col ()
COORD | Cx ()
COORD | Cy ()
BOOL Done ()
void | operator++ ()
UINT Row ()

Protected Attributes

UINT _cCol
UINT _cRow
COORD | _cx
COORD | _cy
UINT _iCol
UINT _iRow
POINT | _pt
SIZE | _size

Detailed Description

Definition at line 10 of file Grid.Hxx.

Constructor & Destructor Documentation

CGridIt::CGridIt | ( | UINT | cCol,
 |  | UINT | cRow,
 |  | SIZE | size,
 |  | POINT | pt |
 | ) |  |  | [inline]

Definition at line 13 of file Grid.Hxx.

                                                           :
                _pt(pt), _size(size), _cCol(cCol), _cRow(cRow),
                _iRow(0), _iCol(0), _cx(pt.x), _cy(pt.y)
        {}

Member Function Documentation

UINT CGridIt::Col ( ) [inline]

Definition at line 21 of file Grid.Hxx.

{ return _iCol; };

COORD CGridIt::Cx ( ) [inline]

Definition at line 23 of file Grid.Hxx.

{ return _cx; }

COORD CGridIt::Cy ( ) [inline]

Definition at line 24 of file Grid.Hxx.

{ return _cy; }

BOOL CGridIt::Done ( ) [inline]

Definition at line 18 of file Grid.Hxx.

{ return _iCol == _cCol; };

void CGridIt::operator++ ( ) [inline]

Definition at line 26 of file Grid.Hxx.

        {
            if( !Done())
            {
                _iRow++;
                _cy+=_size.cy;
                if( _iRow == _cRow )
                {
                    _iRow = 0;
                    _cy = _pt.y;
                    _iCol++;
                    _cx += _size.cx;
                }
            }
        }

UINT CGridIt::Row ( ) [inline]

Definition at line 20 of file Grid.Hxx.

{ return _iRow; };

Member Data Documentation

UINT CGridIt::_cCol [protected]

Definition at line 46 of file Grid.Hxx.

UINT CGridIt::_cRow [protected]

Definition at line 44 of file Grid.Hxx.

COORD CGridIt::_cx [protected]

Definition at line 48 of file Grid.Hxx.

COORD CGridIt::_cy [protected]

Definition at line 48 of file Grid.Hxx.

UINT CGridIt::_iCol [protected]

Definition at line 47 of file Grid.Hxx.

UINT CGridIt::_iRow [protected]

Definition at line 45 of file Grid.Hxx.

POINT CGridIt::_pt [protected]

Definition at line 42 of file Grid.Hxx.

SIZE CGridIt::_size [protected]

Definition at line 43 of file Grid.Hxx.

The documentation for this class was generated from the following file:
  • Multimedia/Gdi/Fonts/GridFont/Grid.Hxx
Generated on Wed Nov 13 2024 16:56:37 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CGroupData Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Private Attributes

CGroupData Class Reference

#include "ExtObjData.h"

Inherits CObjData, and CObjData.

List of all members.

Public Member Functions

virtual HRESULT | AddContextMenuItems (IWCContextMenuCallback *piCallbackIn)
virtual HRESULT | AddContextMenuItems (IWCContextMenuCallback *piCallbackIn)
HGROUP | GetHGroup (void)
HGROUP | GetHGroup (void)
virtual HRESULT | InvokeCommand (ULONG nCommandIDIn)
virtual HRESULT | InvokeCommand (ULONG nCommandIDIn)

Protected Member Functions

virtual HRESULT | HrInitialize (IUnknown *piDataIn)
virtual HRESULT | HrInitialize (IUnknown *piDataIn)

Private Attributes

HGROUP | m_hGroup

Detailed Description

Definition at line 181 of file ExtObjData.h.

Member Function Documentation

HRESULT CGroupData::AddContextMenuItems ( IWCContextMenuCallback * piCallbackIn ) [virtual]

Reimplemented from CObjData.

Definition at line 791 of file ExtObjData.cpp.

{
    HRESULT hr = S_OK;

    ASSERT( piCallbackIn != NULL );

    hr = AddContextMenuItem(
              piCallbackIn
            , IDS_GROUP_MENU_ITEM_1
            , IDS_GROUP_MENU_ITEM_1_DESC
            , GROUP_MENU_ID_1
            , MF_ENABLED
            );

    return hr;

} //*** CGroupData::AddContextMenuItems

virtual HRESULT CGroupData::AddContextMenuItems ( IWCContextMenuCallback * piCallbackIn ) [virtual]

Reimplemented from CObjData.

HGROUP CGroupData::GetHGroup ( void ) [inline]

Definition at line 195 of file ExtObjData.h.

{ return m_hGroup; };

HGROUP CGroupData::GetHGroup ( void ) [inline]

Definition at line 195 of file ExtObjData.h.

{ return m_hGroup; };

virtual HRESULT CGroupData::HrInitialize ( IUnknown * piDataIn ) [protected, virtual]

Reimplemented from CObjData.

HRESULT CGroupData::HrInitialize ( IUnknown * piDataIn ) [protected, virtual]

Reimplemented from CObjData.

Definition at line 704 of file ExtObjData.cpp.

{
    HRESULT                 hr = S_OK;
    IGetClusterGroupInfo *  piGroupInfo = NULL;

    ASSERT( piDataIn != NULL );

    //
    // Initialize the base class.
    //

    hr = CObjData::HrInitialize( piDataIn );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if: error initializing the base class

    //
    // Initialize member variables to default values.
    //

    m_hGroup = NULL;

    //
    // Set the object type.
    //

    m_cot = CLUADMEX_OT_GROUP;

    //
    // Get an interface pointer to IGetClusterGroupInfo.
    //

    hr = piDataIn->QueryInterface( IID_IGetClusterGroupInfo, reinterpret_cast< LPVOID * >( &piGroupInfo ) );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if: error querying for interface

    //
    // Get a copy of the handle.  Don't free this handle - it's just a copy.
    //

    m_hGroup = piGroupInfo->GetGroupHandle( 0 );
    ASSERT( m_hGroup != NULL );
    if ( m_hGroup == NULL )
    {
        hr = E_HANDLE;
        goto Cleanup;
    } // if: error getting the group handle

Cleanup:

    if ( piGroupInfo != NULL )
    {
        piGroupInfo->Release();
    } // if:

    return hr;

} //*** CGroupData::HrInitialize

virtual HRESULT CGroupData::InvokeCommand ( ULONG nCommandIDIn ) [virtual]

Reimplemented from CObjData.

HRESULT CGroupData::InvokeCommand ( ULONG nCommandIDIn ) [virtual]

Reimplemented from CObjData.

Definition at line 830 of file ExtObjData.cpp.

{
    HRESULT hr = S_OK;

    switch ( nCommandIDIn )
    {
        case GROUP_MENU_ID_1:

            //
            //  TODO:  Implement your menu item here
            //

            hr = S_OK;
            break;

        default:
            hr = E_NOTIMPL;
            break;
    } // switch: nCommandIDIn

    return hr;

} //*** CGroupData::InvokeCommand

Member Data Documentation

HGROUP CGroupData::m_hGroup [private]

Definition at line 185 of file ExtObjData.h.

The documentation for this class was generated from the following files:
  • WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/ExtObjData.h
  • WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/ExtObjData.h
  • WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/ExtObjData.cpp
  • WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/ExtObjData.cpp
Generated on Wed Nov 13 2024 16:56:37 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CHandler Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CHandler Class Reference

#include "handler.h"

List of all members.

Public Member Functions

CHandler ()
STDMETHODIMP | GetRecordset (BSTR conn, BSTR args, BSTR query, _Recordset **ppRS)
STDMETHOD() | InterfaceSupportsErrorInfo (REFIID riid)
STDMETHODIMP | OpenConnection (BSTR conn, BSTR args, long lFlags, BSTR *pQuery, _Connection **ppConnection)
STDMETHODIMP | Reconnect (BSTR conn, BSTR args, _Recordset *pRS)

Detailed Description

Definition at line 31 of file handler.h.

Constructor & Destructor Documentation

CHandler::CHandler ( )

Definition at line 100 of file handler.cpp.

{
}

Member Function Documentation

STDMETHODIMP CHandler::GetRecordset | ( | BSTR | conn,
 |  | BSTR | args,
 |  | BSTR | query,
 |  | _Recordset ** | ppRS
 | ) |  |

Definition at line 105 of file handler.cpp.

{
  HRESULT hr;
  BSTR query2 = SysAllocString(query ? query : L"");

  try
  {
    CUtilComPtr<IErrorInfo> pErrorInfo;

    {
      CUtilComPtr<_Connection> pConn;

      *ppRS = NULL;
      hr = OpenConnection(conn, args, 2, &query2, &pConn);
      if (SUCCEEDED(hr))
        hr = GetADORecordset(pConn, query2, ppRS);

      if (FAILED(hr))
      {
        //Get ADO's error info from OLE, then give it back
        if (GetErrorInfo(0, &pErrorInfo) == S_OK)
          SetErrorInfo(0, pErrorInfo);
        if (*ppRS)
        {
          (*ppRS)->Release();
          *ppRS = NULL;
        }
      }
    }
    if (FAILED(hr))
    {
      //ADO cleared out the error info when the Connect object died. Reset it here.
      SetErrorInfo(0, pErrorInfo);
    }
  }
  catch(HRESULT hrCaught)
  {
    hr = hrCaught;
  }
  catch(...)
  {
    hr = E_FAIL;
  }
  SysFreeString(query2);
  return hr;
}

STDMETHODIMP CHandler::InterfaceSupportsErrorInfo ( REFIID riid )

Definition at line 262 of file handler.cpp.

{
  if (IsEqualGUID(riid, IID_IDataFactoryHandler))
    return S_OK;
  return S_FALSE;
}

STDMETHODIMP CHandler::OpenConnection | ( | BSTR | conn,
 |  | BSTR | args,
 |  | long | lFlags,
 |  | BSTR * | pQuery,
 |  | _Connection ** | ppConnection
 | ) |  |

Definition at line 206 of file handler.cpp.

{
  HRESULT hr;

  try
  {
    CUtil util;
    CUtilComPtr<_Connection> pConn;

    *ppConnection = NULL;
    util.SetIniFile(args);
    util.SetConn(conn);
    if (!util.HasReadAccess())
      util.RaiseError(HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED));
    if (lFlags & 1)  // For ReadWrite
    {
      if (!util.HasWriteAccess())
        util.RaiseError(HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED));
    }

    if ((lFlags & 2) && pQuery)
    {
      // For GetRecordset(), etc.
      if (*pQuery)
      {
        util.SetSql(*pQuery);
        SysFreeString(*pQuery);
      }
      else
        util.SetSql(L"");
      *pQuery = SysAllocString(util.GetSql());
    }

    WCHAR *pwsz = util.GetConn();
    CUtilBSTR bstrConn(pwsz);
    hr = DoADOConnect(bstrConn, &pConn);
    if (SUCCEEDED(hr))
      *ppConnection = pConn.Detach();
  }
  catch(HRESULT hrCaught)
  {
    hr = hrCaught;
  }
  catch(...)
  {
    hr = E_FAIL;
  }
  return hr;
}

STDMETHODIMP CHandler::Reconnect | ( | BSTR | conn,
 |  | BSTR | args,
 |  | _Recordset * | pRS
 | ) |  |

Definition at line 157 of file handler.cpp.

{
  HRESULT hr;

  try
  {
    CUtilComPtr<IErrorInfo> pErrorInfo;

    {
      CUtilComPtr<_Connection> pConn;

      hr = OpenConnection(conn, args, 1, NULL, &pConn);
      if (SUCCEEDED(hr))
        hr = ADOReconnect(pRS, pConn);

      if (FAILED(hr))
      {
        //Get ADO's error info from OLE, then give it back
        if (GetErrorInfo(0, &pErrorInfo) == S_OK)
          SetErrorInfo(0, pErrorInfo);
      }
    }
    if (FAILED(hr))
    {
      //ADO cleared out the error info when the Connect object died. Reset it here.
      SetErrorInfo(0, pErrorInfo);
    }
  }
  catch(HRESULT hrCaught)
  {
    hr = hrCaught;
  }
  catch(...)
  {
    hr = E_FAIL;
  }
  return hr;
}

The documentation for this class was generated from the following files:
  • Dataaccess/rds/handler/vc/handler.h
  • Dataaccess/rds/handler/vc/handler.cpp
Generated on Wed Nov 13 2024 16:56:37 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CHello Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CHello Class Reference

List of all members.

Public Member Functions

CHello ()
ULONG STDMETHODCALLTYPE | AddRef ()
HRESULT STDMETHODCALLTYPE | HelloProc (unsigned char *pszString)
HRESULT STDMETHODCALLTYPE | QueryInterface (REFIID iid, void **ppv)
ULONG STDMETHODCALLTYPE | Release ()

Private Member Functions

~CHello ()

Private Attributes

unsigned long | m_cRef

Detailed Description

Definition at line 32 of file cHello.Cxx.

Constructor & Destructor Documentation

CHello::~CHello ( ) [inline, private]

Definition at line 38 of file cHello.Cxx.

    {
        DecrementLockCount();
        ObjectDestroyed();
    }

CHello::CHello ( ) [inline]

Definition at line 46 of file cHello.Cxx.

    {
        m_cRef = 1;
        ObjectCreated();
        IncrementLockCount();
    }

Member Function Documentation

ULONG STDMETHODCALLTYPE CHello::AddRef ( )

Definition at line 74 of file cHello.Cxx.

{
    InterlockedIncrement((long *) &m_cRef);
    return m_cRef;
}

HRESULT STDMETHODCALLTYPE CHello::HelloProc ( unsigned char * pszString )

Definition at line 90 of file cHello.Cxx.

{
    printf("HelloProc: %s \n", pszString);
    return S_OK;
}

HRESULT STDMETHODCALLTYPE CHello::QueryInterface | ( | REFIID | iid,
 |  | void ** | ppv
 | ) |  |

Definition at line 106 of file cHello.Cxx.

{
    HRESULT hr;

    if ( IsEqualGUID( iid, IID_IUnknown ) ||
         IsEqualGUID( iid, IID_IHello ) )
    {
        *ppv = (IHello *) this;
        AddRef();
      hr = S_OK;
    }
    else
    {
        *ppv = 0;
        hr = E_NOINTERFACE;
    }

    return hr;
}

ULONG STDMETHODCALLTYPE CHello::Release ( )

Definition at line 143 of file cHello.Cxx.

{
    unsigned long count;

    count = m_cRef - 1;

    if(InterlockedDecrement((long *) &m_cRef) == 0)
    {
        count = 0;
        delete this;
    }

    return count;
}

Member Data Documentation

unsigned long CHello::m_cRef [private]

Definition at line 35 of file cHello.Cxx.

The documentation for this class was generated from the following file:
  • Com/Fundamentals/Object/OHello/cHello.Cxx
Generated on Wed Nov 13 2024 16:56:37 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CHelloClassFactory Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CHelloClassFactory Class Reference

List of all members.

Public Member Functions

CHelloClassFactory ()
ULONG STDMETHODCALLTYPE | AddRef ()
HRESULT STDMETHODCALLTYPE | CreateInstance (IUnknown *punkOuter, REFIID riid, void **ppv)
HRESULT STDMETHODCALLTYPE | LockServer (BOOL fLock)
HRESULT STDMETHODCALLTYPE | QueryInterface (REFIID iid, void **ppv)
ULONG STDMETHODCALLTYPE | Release ()

Private Member Functions

~CHelloClassFactory ()

Private Attributes

unsigned long | m_cRef

Detailed Description

Definition at line 164 of file cHello.Cxx.

Constructor & Destructor Documentation

CHelloClassFactory::~CHelloClassFactory ( ) [inline, private]

Definition at line 170 of file cHello.Cxx.

    {
        ObjectDestroyed();
    }

CHelloClassFactory::CHelloClassFactory ( ) [inline]

Definition at line 177 of file cHello.Cxx.

    {
        m_cRef = 1;
        ObjectCreated();
    }

Member Function Documentation

ULONG STDMETHODCALLTYPE CHelloClassFactory::AddRef ( )

Definition at line 211 of file cHello.Cxx.

{
    InterlockedIncrement((long *) &m_cRef);
    return m_cRef;
}

HRESULT STDMETHODCALLTYPE CHelloClassFactory::CreateInstance | ( | IUnknown * | punkOuter,
 |  | REFIID | riid,
 |  | void ** | ppv
 | ) |  |

Definition at line 228 of file cHello.Cxx.

{
    HRESULT hr;
    CHello *pHello;

    if(punkOuter != 0)
    {
        //The CHello class doesn't support aggregation.
        return CLASS_E_NOAGGREGATION;
    }

    pHello = new CHello();
    if(pHello != 0)
    {
        hr = pHello->QueryInterface(riid, ppv);
        pHello->Release();
    }
    else
    {
        hr = E_OUTOFMEMORY;
        *ppv = 0;
    }

    return hr;
}

HRESULT STDMETHODCALLTYPE CHelloClassFactory::LockServer ( BOOL fLock )

Definition at line 273 of file cHello.Cxx.

{
    if (fLock == TRUE)
        IncrementLockCount();
    else
        DecrementLockCount();

    return S_OK;
}

HRESULT STDMETHODCALLTYPE CHelloClassFactory::QueryInterface | ( | REFIID | iid,
 |  | void ** | ppv
 | ) |  |

Definition at line 295 of file cHello.Cxx.

{
    HRESULT hr;

    if ( IsEqualGUID( iid, IID_IUnknown) ||
         IsEqualGUID( iid, IID_IClassFactory ) )
    {
        *ppv = this;
        AddRef();
        hr = S_OK;
    }
    else
    {
        *ppv = 0;
        hr = E_NOINTERFACE;
    }

    return hr;
}

ULONG STDMETHODCALLTYPE CHelloClassFactory::Release ( )

Definition at line 326 of file cHello.Cxx.

{
    unsigned long count;

    count = m_cRef - 1;

    if(InterlockedDecrement((long *) &m_cRef) == 0)
    {
        count = 0;

        ObjectDestroyed();
    }

    return count;
}

Member Data Documentation

unsigned long CHelloClassFactory::m_cRef [private]

Definition at line 167 of file cHello.Cxx.

The documentation for this class was generated from the following file:
  • Com/Fundamentals/Object/OHello/cHello.Cxx
Generated on Wed Nov 13 2024 16:56:37 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CHelloEditSession Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CHelloEditSession Class Reference

Inherits CEditSessionBase.

List of all members.

Public Member Functions

CHelloEditSession (ITfContext *pContext)
STDMETHODIMP DoEditSession (TfEditCookie ec)

Detailed Description

Definition at line 11 of file hello.cpp.

Constructor & Destructor Documentation

CHelloEditSession::CHelloEditSession ( ITfContext * pContext ) [inline]

Definition at line 14 of file hello.cpp.

: CEditSessionBase(pContext) {}

Member Function Documentation

STDAPI CHelloEditSession::DoEditSession ( TfEditCookie ec ) [virtual]

Implements CEditSessionBase.

Definition at line 67 of file hello.cpp.

{
    InsertTextAtSelection(ec, _pContext, L"Hello world!", (ULONG)wcslen(L"Hello world!"));
    return S_OK;
}

The documentation for this class was generated from the following file:
  • WinUI/TSFcase/hello.cpp
Generated on Wed Nov 13 2024 16:56:37 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CHILD_PROPERTIES Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

CHILD_PROPERTIES Struct Reference

#include "basenode.h"

List of all members.

Public Attributes

DWORD dwAttributes
WCHAR szNodeName [MAX_NAME_LEN]

Detailed Description

Definition at line 43 of file basenode.h.

Member Data Documentation

DWORD CHILD_PROPERTIES::dwAttributes

Definition at line 46 of file basenode.h.

WCHAR CHILD_PROPERTIES::szNodeName[MAX_NAME_LEN]

Definition at line 45 of file basenode.h.

The documentation for this struct was generated from the following file:
  • SysMgmt/MMC/mmc2.0/dragdrop/basenode.h
Generated on Wed Nov 13 2024 16:56:37 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CHILDWINDOWDATA Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

CHILDWINDOWDATA Struct Reference

#include "MDIChild.h"

List of all members.

Public Attributes

RECT | ANDRect
RECT | ANDTextRect
RECT | BlackRect
RECT | BlackTextRect
RECT | BoxRect
RECT | DrawingRect
HWND | hWndFormatListBox
PICONRESOURCE pIR
RECT | WhiteRect
RECT | WhiteTextRect
RECT | XORImageRect
RECT | XORRect
RECT | XORTextRect

Detailed Description

Definition at line 34 of file MDIChild.h.

Member Data Documentation

RECT CHILDWINDOWDATA::ANDRect

Definition at line 43 of file MDIChild.h.

RECT CHILDWINDOWDATA::ANDTextRect

Definition at line 43 of file MDIChild.h.

RECT CHILDWINDOWDATA::BlackRect

Definition at line 40 of file MDIChild.h.

RECT CHILDWINDOWDATA::BlackTextRect

Definition at line 40 of file MDIChild.h.

RECT CHILDWINDOWDATA::BoxRect

Definition at line 38 of file MDIChild.h.

RECT CHILDWINDOWDATA::DrawingRect

Definition at line 39 of file MDIChild.h.

HWND CHILDWINDOWDATA::hWndFormatListBox

Definition at line 36 of file MDIChild.h.

PICONRESOURCE CHILDWINDOWDATA::pIR

Definition at line 37 of file MDIChild.h.

RECT CHILDWINDOWDATA::WhiteRect

Definition at line 41 of file MDIChild.h.

RECT CHILDWINDOWDATA::WhiteTextRect

Definition at line 41 of file MDIChild.h.

RECT CHILDWINDOWDATA::XORImageRect

Definition at line 44 of file MDIChild.h.

RECT CHILDWINDOWDATA::XORRect

Definition at line 42 of file MDIChild.h.

RECT CHILDWINDOWDATA::XORTextRect

Definition at line 42 of file MDIChild.h.

The documentation for this struct was generated from the following file:
  • WinUI/Resource/Iconpro/MDIChild.h
Generated on Wed Nov 13 2024 16:56:37 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CHiPerfProvider Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes | Static Private Attributes

CHiPerfProvider Class Reference

#include "BasicHiPerf.h"

List of all members.

Public Member Functions

CHiPerfProvider ()
~CHiPerfProvider ()
STDMETHODIMP | CreateRefreshableEnum (IWbemServices *pNamespace, LPCWSTR wszClass, IWbemRefresher *pRefresher, long lFlags, IWbemContext *pContext, IWbemHiPerfEnum *pHiPerfEnum, long *plId)
STDMETHODIMP | CreateRefreshableObject (IWbemServices __RPC_FAR *pNamespace, IWbemObjectAccess __RPC_FAR *pTemplate, IWbemRefresher __RPC_FAR *pRefresher, long lFlags, IWbemContext __RPC_FAR *pContext, IWbemObjectAccess __RPC_FAR *__RPC_FAR *ppRefreshable, long __RPC_FAR *plId)
STDMETHODIMP | CreateRefresher (IWbemServices __RPC_FAR *pNamespace, long lFlags, IWbemRefresher __RPC_FAR *__RPC_FAR *ppRefresher)
STDMETHODIMP | GetObjects (IWbemServices *pNamespace, long lNumObjects, IWbemObjectAccess **apObj, long lFlags, IWbemContext *pContext)
STDMETHODIMP | Initialize (LPWSTR wszUser, long lFlags, LPWSTR wszNamespace, LPWSTR wszLocale, IWbemServices __RPC_FAR *pNamespace, IWbemContext __RPC_FAR *pCtx, IWbemProviderInitSink __RPC_FAR *pInitSink)
STDMETHODIMP | QueryInstances (IWbemServices __RPC_FAR *pNamespace, WCHAR __RPC_FAR *wszClass, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemObjectSink __RPC_FAR *pSink)
STDMETHODIMP | QueryInterface (REFIID riid, void **ppv)
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP | StopRefreshing (IWbemRefresher __RPC_FAR *pRefresher, long lId, long lFlags)

Private Attributes

long | m_lRef
IWbemClassObject * | m_pTemplate

Static Private Attributes

static CSampleDataSource * | m_pSampleDS = NULL

Detailed Description

Definition at line 236 of file BasicHiPerf.h.

Constructor & Destructor Documentation

CHiPerfProvider::CHiPerfProvider ( )

Definition at line 269 of file BasicHiPerf.Cpp.

                                 : m_lRef(0), m_pTemplate(NULL)
//////////////////////////////////////////////////////////////
//
//  Constructor
//
//////////////////////////////////////////////////////////////
//ok
{
  // Increment the global COM object counter
  // =======================================

  InterlockedIncrement(&g_lObjects);
}

CHiPerfProvider::~CHiPerfProvider ( )

Definition at line 283 of file BasicHiPerf.Cpp.

{
  long lObjCount = 0;

    // Release the template
  // ====================

  if (NULL != m_pTemplate)
            m_pTemplate->Release();

  // Decrement the global COM object counter
  // =======================================

  lObjCount = InterlockedDecrement(&g_lObjects);

  // If this is the last object, delete our data source
  // ==================================================

  if ((0 == lObjCount) && (NULL != m_pSampleDS))
  {
    delete m_pSampleDS;
    m_pSampleDS = NULL;
  }
}

Member Function Documentation

STDMETHODIMP CHiPerfProvider::CreateRefreshableEnum | ( | IWbemServices * | pNamespace,
 |  | LPCWSTR | wszClass,
 |  | IWbemRefresher * | pRefresher,
 |  | long | lFlags,
 |  | IWbemContext * | pContext,
 |  | IWbemHiPerfEnum * | pHiPerfEnum,
 |  | long * | plId
 | ) |  |

Definition at line 759 of file BasicHiPerf.Cpp.

              :
//    pNamespace    - A pointer to the relevant namespace.
//    wszClass    - The class name for the requested enumerator.
//    pRefresher    - The refresher object for which we will add
//              the enumerator
//    lFlags      - Reserved.
//    pContext    - Not used here.
//    pHiPerfEnum   - The enumerator to add to the refresher.
//    plId      - A provider specified ID for the enumerator.
//
//////////////////////////////////////////////////////////////////////
//ok
{

  //Impersonate the client
  HRESULT hr = CoImpersonateClient () ;
  if ( FAILED ( hr ) && hr != RPC_E_CALL_COMPLETE)
  {
    return hr ;
  }

  //  Check to see if call is at lower than RPC_C_IMP_LEVEL_IMPERSONATE level. If that's the case,
  //  the provider will not be able to impersonate the client to access the protected resources.

  DWORD t_CurrentImpersonationLevel = GetCurrentImpersonationLevel () ;
  if ( t_CurrentImpersonationLevel < RPC_C_IMP_LEVEL_IMPERSONATE )
  {
    //  Revert before we perform any operations
    CoRevertToSelf () ;

    hr = WBEM_E_ACCESS_DENIED;
    return hr ;
  }

    // The refresher being supplied by the caller is actually
    // one of our own refreshers, so a simple cast is convenient
    // so that we can access private members.

  CRefresher *pOurRefresher = (CRefresher *) pRefresher;

  // Add the enumerator to the refresher
  // The ID is generated by AddEnum.
  // ===================================

  hr = pOurRefresher->AddEnum(pHiPerfEnum, plId);
  return hr;
}

STDMETHODIMP CHiPerfProvider::CreateRefreshableObject | ( | IWbemServices __RPC_FAR * | pNamespace,
 |  | IWbemObjectAccess __RPC_FAR * | pTemplate,
 |  | IWbemRefresher __RPC_FAR * | pRefresher,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pContext,
 |  | IWbemObjectAccess __RPC_FAR *__RPC_FAR * | ppRefreshable,
 |  | long __RPC_FAR * | plId
 | ) |  |

Definition at line 678 of file BasicHiPerf.Cpp.

              :
//    pNamespace    - A pointer to the relevant namespace in WINMGMT.
//    pTemplate   - A pointer to a copy of the object which is to be
//              added.  This object itself cannot be used, as
//              it not owned locally.
//    pRefresher    - The refresher to which to add the object.
//    lFlags      - Not used.
//    pContext    - Not used here.
//    ppRefreshable - A pointer to the internal object which was added
//              to the refresher.
//    plId      - The Object Id (for identification during removal).
//
//////////////////////////////////////////////////////////////////////
//ok
{

  HRESULT hRes = WBEM_NO_ERROR;

  //Impersonate the client
  hRes = CoImpersonateClient () ;
  if ( FAILED ( hRes ) && hRes != RPC_E_CALL_COMPLETE)
  {
    return hRes ;
  }

  //  Check to see if call is at lower than RPC_C_IMP_LEVEL_IMPERSONATE level. If that's the case,
  //  the provider will not be able to impersonate the client to access the protected resources.

  DWORD t_CurrentImpersonationLevel = GetCurrentImpersonationLevel () ;
  if ( t_CurrentImpersonationLevel < RPC_C_IMP_LEVEL_IMPERSONATE )
  {
    //  Revert before we perform any operations
    CoRevertToSelf () ;

    hRes = WBEM_E_ACCESS_DENIED;
    return hRes ;
  }

 // Find out which instance is being requested for addition
  // =======================================================

    if (pNamespace == 0 || pTemplate == 0 || pRefresher == 0)
        return WBEM_E_INVALID_PARAMETER;

    // The refresher being supplied by the caller is actually
    // one of our own refreshers, so a simple cast is convenient
    // so that we can access private members.
  // =========================================================

  CRefresher *pOurRefresher = (CRefresher *) pRefresher;

  // Add the object to the refresher. The ID is set by AddObject
  // ===========================================================

    hRes = pOurRefresher->AddObject(pTemplate, ppRefreshable, plId);

  if (FAILED(hRes))
    return hRes;

    return WBEM_NO_ERROR;
}

STDMETHODIMP CHiPerfProvider::CreateRefresher | ( | IWbemServices __RPC_FAR * | pNamespace,
 |  | long | lFlags,
 |  | IWbemRefresher __RPC_FAR *__RPC_FAR * | ppRefresher
 | ) |  |

Definition at line 621 of file BasicHiPerf.Cpp.

              :
//    pNamespace    - A pointer to the relevant namespace.  Not used.
//    lFlags      - Reserved.
//    ppRefresher   - Receives the requested refresher.
//
//////////////////////////////////////////////////////////////////////
//ok
{
  //Impersonate the client
  HRESULT hRes = CoImpersonateClient () ;
  if ( FAILED ( hRes ) && hRes != RPC_E_CALL_COMPLETE)
  {
    return hRes ;
  }

  //  Check to see if call is at lower than RPC_C_IMP_LEVEL_IMPERSONATE level. If that's the case,
  //  the provider will not be able to impersonate the client to access the protected resources.

  DWORD t_CurrentImpersonationLevel = GetCurrentImpersonationLevel () ;
  if ( t_CurrentImpersonationLevel < RPC_C_IMP_LEVEL_IMPERSONATE )
  {
    //  Revert before we perform any operations
    CoRevertToSelf () ;

    hRes = WBEM_E_ACCESS_DENIED;
    return hRes ;
  }

    if (pNamespace == 0 || ppRefresher == 0)
        return WBEM_E_INVALID_PARAMETER;

    // Construct and initialize a new empty refresher
  // ==============================================

  CRefresher* pNewRefresher = new CRefresher(this, m_pSampleDS);
  if (pNewRefresher == NULL)
    return WBEM_E_OUT_OF_MEMORY;

  pNewRefresher->Initialize(m_pTemplate);

    // Follow COM rules and AddRef() the thing before sending it back
  // ==============================================================

    pNewRefresher->AddRef();
    *ppRefresher = pNewRefresher;

    return WBEM_NO_ERROR;
}

STDMETHODIMP CHiPerfProvider::GetObjects | ( | IWbemServices * | pNamespace,
 |  | long | lNumObjects,
 |  | IWbemObjectAccess ** | apObj,
 |  | long | lFlags,
 |  | IWbemContext * | pContext
 | ) |  |

Definition at line 885 of file BasicHiPerf.Cpp.

              :
//    pNamespace    - A pointer to the relevant namespace.
//    lNumObjects   - The number of instances being returned.
//    apObj     - The array of instances being returned.
//    lFlags      - Reserved.
//    pContext    - Not used here.
//
//////////////////////////////////////////////////////////////////////
//ok
{
  HRESULT hRes = WBEM_NO_ERROR;

  //Impersonate the client
  hRes = CoImpersonateClient () ;
  if ( FAILED ( hRes ) && hRes != RPC_E_CALL_COMPLETE)
  {
    return hRes ;
  }

  //  Check to see if call is at lower than RPC_C_IMP_LEVEL_IMPERSONATE level. If that's the case,
  //  the provider will not be able to impersonate the client to access the protected resources.

  DWORD t_CurrentImpersonationLevel = GetCurrentImpersonationLevel () ;
  if ( t_CurrentImpersonationLevel < RPC_C_IMP_LEVEL_IMPERSONATE )
  {
    //  Revert before we perform any operations
    CoRevertToSelf () ;

    hRes = WBEM_E_ACCESS_DENIED;
    return hRes ;
  }

  int nIndex = 0;
  DWORD dwID = 0;

  IWbemObjectAccess*  pCurrObj;

  // Cycle through the list of objects, updating each one
  // ====================================================

  for (nIndex = 0; nIndex < lNumObjects; nIndex++)
  {
    pCurrObj = apObj[nIndex];

    hRes = m_pSampleDS->UpdateInstance(pCurrObj);
    if (FAILED(hRes))
      break;
  }

  return hRes;
}

STDMETHODIMP CHiPerfProvider::Initialize | ( | LPWSTR | wszUser,
 |  | long | lFlags,
 |  | LPWSTR | wszNamespace,
 |  | LPWSTR | wszLocale,
 |  | IWbemServices __RPC_FAR * | pNamespace,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemProviderInitSink __RPC_FAR * | pInitSink
 | ) |  |

Definition at line 370 of file BasicHiPerf.Cpp.

              :
//    wszUser     - The current user.
//    lFlags      - Reserved.
//    wszNamespace  - The namespace for which we are being activated.
//    wszLocale   - The locale under which we are to be running.
//    pNamespace    - An active pointer back into the current namespace
//              from which we can retrieve schema objects.
//    pCtx      - The user's context object.  We simply reuse this
//              during any reentrant operations into WINMGMT.
//    pInitSink   - The sink to which we indicate our readiness.
//
//////////////////////////////////////////////////////////////////////
//ok
{
  HRESULT hRes = WBEM_NO_ERROR;

    IWbemObjectAccess *pAccess = NULL;
  BSTR strObject = NULL;
  BSTR strPropName = NULL;

  if (wszNamespace == 0 || pNamespace == 0 || pInitSink == 0)
  {
      pInitSink->SetStatus(WBEM_E_FAILED , 0);
      return WBEM_NO_ERROR;
  }

    // Get a sample class object for initialization purposes
  // =====================================================

  strObject = SysAllocString(SAMPLE_CLASS);
  if (strObject == NULL)
  {
      pInitSink->SetStatus(WBEM_E_OUT_OF_MEMORY , 0);
      return WBEM_NO_ERROR;
  }

  hRes = pNamespace->GetObject(strObject, 0, pCtx, &m_pTemplate, 0);

  SysFreeString(strObject);

    if (FAILED(hRes))
  {
      pInitSink->SetStatus(WBEM_E_FAILED , 0);
      return WBEM_NO_ERROR;
  }

  // Initialize the datasource.  If the static member
  // is not null, then it has already been setup.
  // ================================================

  if (NULL == m_pSampleDS)
  {
    m_pSampleDS = new CSampleDataSource;

    if (NULL == m_pSampleDS)
    {
      pInitSink->SetStatus(WBEM_E_FAILED , 0);
      return WBEM_NO_ERROR;
    }

    m_pSampleDS->Initialize(m_pTemplate);
  }

  // Initialize the global access handle for the object ID.
  // If it is not null, then it has already been setup.
  // ======================================================

  if (NULL == g_hID)
  {
    // Get the IWbemObjectAccess interface to the object
    // =================================================

    hRes = m_pTemplate->QueryInterface(IID_IWbemObjectAccess, (PVOID*)&pAccess);

    if (FAILED(hRes))
      return hRes;

    // Get the name property access handle
    // ===================================

    strPropName = SysAllocString(L"Name");
    if (strPropName == NULL)
    {
      pInitSink->SetStatus(WBEM_E_OUT_OF_MEMORY , 0);
      return WBEM_NO_ERROR;
    }

    hRes = pAccess->GetPropertyHandle(strPropName, 0, &g_hID);

    pAccess->Release();
    SysFreeString(strPropName);

    if (FAILED(hRes))
    {
      pInitSink->SetStatus(WBEM_E_FAILED , 0);
      return WBEM_NO_ERROR;
    }
}

    // We now have all the instances ready to go and the name handle
  // stored.  Tell WINMGMT that we're ready to start 'providing'
  // =============================================================

    pInitSink->SetStatus(WBEM_S_INITIALIZED, 0);

    return WBEM_NO_ERROR;
}

STDMETHODIMP CHiPerfProvider::QueryInstances | ( | IWbemServices __RPC_FAR * | pNamespace,
 |  | WCHAR __RPC_FAR * | wszClass,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemObjectSink __RPC_FAR * | pSink
 | ) |  |

Definition at line 501 of file BasicHiPerf.Cpp.

              :
//    pNamespace    - A pointer to the relevant namespace.  This
//              should not be AddRef'ed.
//    wszClass    - The class name for which instances are required.
//    lFlags      - Reserved.
//    pCtx      - The user-supplied context (not used here).
//    pSink     - The sink to which to deliver the objects.  The objects
//              can be delivered synchronously through the duration
//              of this call or asynchronously (assuming we
//              had a separate thread).  A IWbemObjectSink::SetStatus
//              call is required at the end of the sequence.
//
//////////////////////////////////////////////////////////////////////
//ok
{
  HRESULT hRes = WBEM_NO_ERROR;

  //Impersonate the client
  hRes = CoImpersonateClient () ;
  if ( FAILED ( hRes ) && hRes != RPC_E_CALL_COMPLETE)
  {
    return hRes ;
  }

  //  Check to see if call is at lower than RPC_C_IMP_LEVEL_IMPERSONATE level. If that's the case,
  //  the provider will not be able to impersonate the client to access the protected resources.

  DWORD t_CurrentImpersonationLevel = GetCurrentImpersonationLevel () ;
  if ( t_CurrentImpersonationLevel < RPC_C_IMP_LEVEL_IMPERSONATE )
  {
    //  Revert before we perform any operations
    CoRevertToSelf () ;

    hRes = WBEM_E_ACCESS_DENIED;
    return hRes ;
  }

  IWbemClassObject* pObjectCopy = NULL;
  IWbemObjectAccess*  pAccessCopy = NULL;

    if (pNamespace == 0 || wszClass == 0 || pSink == 0)
        return WBEM_E_INVALID_PARAMETER;

  // Loop through all instances, indicating an updated version
  // to the object sink
  // =========================================================

    for (int i = 0; i < NUM_INSTANCES; i++)
    {
    // Create a new instance from the template
    // =======================================

    hRes = m_pTemplate->SpawnInstance(0, &pObjectCopy);
    if (FAILED(hRes))
      break;

    // Obtain the IWbemObjectAccess interface
    // ======================================

    hRes = pObjectCopy->QueryInterface(IID_IWbemObjectAccess, (PVOID*)&pAccessCopy);
    if (FAILED(hRes))
    {
      pObjectCopy->Release();
      break;
    }

    // Set the ID
    // ==========

    WCHAR wszName[20];
    StringCbPrintfW(wszName, sizeof(wszName), L"%i", i);

    pAccessCopy->WritePropertyValue(g_hID, (long)(wcslen(wszName)+1)*sizeof(WCHAR), (byte *)wszName);

    // Initialize the counters
    // =======================

    hRes = m_pSampleDS->UpdateInstance(pAccessCopy);

    // Release the IWbemObjectAccess handle (values are maintained in IWbemClassObject interface)
    // ==========================================================================================

    pAccessCopy->Release();

    if (FAILED(hRes))
    {
      pObjectCopy->Release();
      break;
    }

        // Send a copy back to the caller
    // ==============================

        pSink->Indicate(1, &pObjectCopy);

        pObjectCopy->Release();    // Don't need this any more
    }

    // Tell WINMGMT we are all finished supplying objects
  // ==================================================

    pSink->SetStatus(0, WBEM_NO_ERROR, 0, 0);

    return WBEM_NO_ERROR;
}

STDMETHODIMP CHiPerfProvider::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppv
 | ) |  |

Definition at line 320 of file BasicHiPerf.Cpp.

              :
//    riid  - the ID of the requested interface
//    ppv   - a pointer to the interface pointer
//
//////////////////////////////////////////////////////////////
//ok
{
    if(riid == IID_IUnknown)
        *ppv = (LPVOID)(IUnknown*)(IWbemProviderInit*)this;
    else if(riid == IID_IWbemProviderInit)
        *ppv = (LPVOID)(IWbemProviderInit*)this;
  else if (riid == IID_IWbemHiPerfProvider)
    *ppv = (LPVOID)(IWbemHiPerfProvider*)this;
  else return E_NOINTERFACE;

  ((IUnknown*)*ppv)->AddRef();
  return WBEM_NO_ERROR;
}

CHiPerfProvider::STDMETHODIMP_ ( ULONG )
CHiPerfProvider::STDMETHODIMP_ ( ULONG )
STDMETHODIMP CHiPerfProvider::StopRefreshing | ( | IWbemRefresher __RPC_FAR * | pRefresher,
 |  | long | lId,
 |  | long | lFlags
 | ) |  |

Definition at line 827 of file BasicHiPerf.Cpp.

              :
//    pRefresher      - The refresher object from which we are to
//                remove the perf object.
//    lId         - The ID of the object.
//    lFlags        - Not used.
//
//////////////////////////////////////////////////////////////////////
//ok
{
  HRESULT hRes = WBEM_NO_ERROR;

  //Impersonate the client
  hRes = CoImpersonateClient () ;
  if ( FAILED ( hRes ) && hRes != RPC_E_CALL_COMPLETE)
  {
    return hRes ;
  }

  //  Check to see if call is at lower than RPC_C_IMP_LEVEL_IMPERSONATE level. If that's the case,
  //  the provider will not be able to impersonate the client to access the protected resources.

  DWORD t_CurrentImpersonationLevel = GetCurrentImpersonationLevel () ;
  if ( t_CurrentImpersonationLevel < RPC_C_IMP_LEVEL_IMPERSONATE )
  {
    //  Revert before we perform any operations
    CoRevertToSelf () ;

    hRes = WBEM_E_ACCESS_DENIED;
    return hRes ;
  }

    // The refresher being supplied by the caller is actually
    // one of our own refreshers, so a simple cast is convenient
    // so that we can access private members.
  // =========================================================

    CRefresher *pOurRefresher = (CRefresher *) pRefresher;

  // An ID that is less than MAX_ENUMERATORS is an enumerator ID.
  // Everything else is an object ID
  // ============================================================

  if (lId < MAX_ENUMERATORS)
    hRes = pOurRefresher->RemoveEnum(lId);
  else
    hRes = pOurRefresher->RemoveObject(lId);

  return hRes;
}

Member Data Documentation

long CHiPerfProvider::m_lRef [private]

Definition at line 238 of file BasicHiPerf.h.

CSampleDataSource * CHiPerfProvider::m_pSampleDS = NULL [static, private]

Definition at line 243 of file BasicHiPerf.h.

IWbemClassObject* CHiPerfProvider::m_pTemplate [private]

Definition at line 248 of file BasicHiPerf.h.

The documentation for this class was generated from the following files:
  • SysMgmt/WMI/VC/HiPerfProvider/BasicHiPerf.h
  • SysMgmt/WMI/VC/HiPerfProvider/BasicHiPerf.Cpp
Generated on Wed Nov 13 2024 16:56:37 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CHMMSampleApp Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CHMMSampleApp Class Reference

#include "AdvClient.h"

Inherits CWinApp.

List of all members.

Public Member Functions

CHMMSampleApp ()
virtual int | ExitInstance ()
virtual BOOL | InitInstance ()
BOOL | InitSecurity (void)

Detailed Description

Definition at line 37 of file AdvClient.h.

Constructor & Destructor Documentation

CHMMSampleApp::CHMMSampleApp ( )

Definition at line 42 of file AdvClient.cpp.

{
  // TODO: add construction code here,
  // Place all significant initialization in InitInstance
}

Member Function Documentation

int CHMMSampleApp::ExitInstance ( void ) [virtual]

Reimplemented from CWinApp.

Definition at line 178 of file AdvClient.cpp.

{
  CoUninitialize();

  return CWinApp::ExitInstance();
}

BOOL CHMMSampleApp::InitInstance ( void ) [virtual]

Reimplemented from CWinApp.

Definition at line 112 of file AdvClient.cpp.

{
  // OLE initialization. This is 'lighter' than OleInitialize()
  //  which also setups DnD, etc.
  if(SUCCEEDED(CoInitialize(NULL)))
  {
    if(!InitSecurity())
    {
      AfxMessageBox(_T("CoInitializeSecurity Failed"));
      return FALSE;
    }
  }
  else // didnt CoInitialize()
  {
    AfxMessageBox(_T("CoInitialize Failed"));
    return FALSE;
  } // endif OleInitialize()

  // Standard initialization
  // If you are not using these features and wish to reduce the size
  //  of your final executable, you should remove from the following
  //  the specific initialization routines you do not need.

#ifdef _AFXDLL
  Enable3dControls();     // Call this when using MFC in a shared DLL
#else
  Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif

  CAdvClientDlg dlg;
  m_pMainWnd = &dlg;
  INT_PTR nResponse = dlg.DoModal();
  if (nResponse == IDOK)
  {
    // TODO: Place code here to handle when the dialog is
    //  dismissed with OK
  }
  else if (nResponse == IDCANCEL)
  {
    // TODO: Place code here to handle when the dialog is
    //  dismissed with Cancel
  }

  // Since the dialog has been closed, return FALSE so that we exit the
  //  application, rather than start the application's message pump.
  return FALSE;
}

BOOL CHMMSampleApp::InitSecurity ( void )

Definition at line 73 of file AdvClient.cpp.

{
  // NOTE: dwAuthnLevel needs to be set to RPC_C_AUTHN_LEVEL_NONE
  // if you would like to perform asynchronous WMI operations remotely in
  // environments where "Local System" account does not have a network identity
  // (such as non-Kerberos environments).
  // However, setting dwAuthnLevel to RPC_C_AUTHN_LEVEL_NONE
  // creates a security vulnerability in your client application.
  // It is therefore advisable to use semi-synchronous APIs for WMI event
  // and data retrieval instead.

  HRESULT hres = CoInitializeSecurity(NULL, -1, NULL, NULL,
                RPC_C_AUTHN_LEVEL_PKT_PRIVACY,
                RPC_C_IMP_LEVEL_IMPERSONATE,
                                NULL,
                EOAC_SECURE_REFS, //change to EOAC_NONE if you change dwAuthnLevel to RPC_C_AUTHN_LEVEL_NONE
                NULL);
    return SUCCEEDED(hres);
}

The documentation for this class was generated from the following files:
  • SysMgmt/WMI/VC/AdvClient/AdvClient.h
  • SysMgmt/WMI/VC/AdvClient/AdvClient.cpp
Generated on Wed Nov 13 2024 16:56:37 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CHourglass Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CHourglass Class Reference

CHourglass: Manages the hourglass and mouse capture.

#include "Framer.h"

List of all members.

Public Member Functions

CHourglass (void)
CHourglass (HWND hWnd)
~CHourglass (void)

Protected Attributes

HCURSOR | m_hCur
HWND | m_hWndCapture

Detailed Description

Definition at line 198 of file Framer.h.

Constructor & Destructor Documentation

CHourglass::CHourglass ( void ) [inline]

Definition at line 205 of file Framer.h.

            {
            m_hCur=SetCursor(LoadCursor(NULL, IDC_WAIT));
            m_hWndCapture=NULL;
            return;
            }

CHourglass::CHourglass ( HWND hWnd ) [inline]

Definition at line 212 of file Framer.h.

            {
            m_hCur=SetCursor(LoadCursor(NULL, IDC_WAIT));

            if (NULL!=hWnd)
                {
                m_hWndCapture=hWnd;
                SetCapture(hWnd);
                }

            return;
            }

CHourglass::~CHourglass ( void ) [inline]

Definition at line 225 of file Framer.h.

            {
            if (NULL!=m_hWndCapture)
                ReleaseCapture();

            SetCursor(m_hCur);
            return;
            }

Member Data Documentation

HCURSOR CHourglass::m_hCur [protected]

Definition at line 202 of file Framer.h.

HWND CHourglass::m_hWndCapture [protected]

Definition at line 201 of file Framer.h.

The documentation for this class was generated from the following file:
  • Com/Fundamentals/ActiveDocument/Framer/Framer.h
Generated on Wed Nov 13 2024 16:56:37 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CHtmlElemBagEntry Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CHtmlElemBagEntry Class Reference

#include "Bag.Hxx"

List of all members.

Public Member Functions

CHtmlElemBagEntry ()
~CHtmlElemBagEntry ()
CHtmlElement * GetHtmlElement ()
HtmlTokenType GetTokenType ()
void | SetHtmlElement (CHtmlElement *pHtmlElement)
void | SetTokenType (HtmlTokenType eTokType)

Private Attributes

HtmlTokenType _eTokType
CHtmlElement * _pHtmlElement

Detailed Description

Definition at line 26 of file Bag.Hxx.

Constructor & Destructor Documentation

CHtmlElemBagEntry::CHtmlElemBagEntry ( )

Definition at line 27 of file Bag.Cxx.

    : _pHtmlElement(0),
      _eTokType(GenericToken)
{
}

CHtmlElemBagEntry::~CHtmlElemBagEntry ( )

Definition at line 43 of file Bag.Cxx.

{
    delete _pHtmlElement;
}

Member Function Documentation

CHtmlElement* CHtmlElemBagEntry::GetHtmlElement ( ) [inline]

Definition at line 34 of file Bag.Hxx.

{ return _pHtmlElement; }

HtmlTokenType CHtmlElemBagEntry::GetTokenType ( ) [inline]

Definition at line 37 of file Bag.Hxx.

{ return _eTokType; }

void CHtmlElemBagEntry::SetHtmlElement ( CHtmlElement * pHtmlElement ) [inline]

Definition at line 33 of file Bag.Hxx.

{ _pHtmlElement = pHtmlElement; }

void CHtmlElemBagEntry::SetTokenType ( HtmlTokenType eTokType ) [inline]

Definition at line 36 of file Bag.Hxx.

{ _eTokType = eTokType; }

Member Data Documentation

HtmlTokenType CHtmlElemBagEntry::_eTokType [private]

Definition at line 41 of file Bag.Hxx.

CHtmlElement* CHtmlElemBagEntry::_pHtmlElement [private]

Definition at line 40 of file Bag.Hxx.

The documentation for this class was generated from the following files:
  • WinBase/Indexing/IFilter/Bag.Hxx
  • WinBase/Indexing/IFilter/Bag.Cxx
Generated on Wed Nov 13 2024 16:56:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CHtmlElement Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Protected Attributes

CHtmlElement Class Reference

#include "HtmlElem.Hxx"

Inherited by CAnchorTag, CImageTag, CInputTag, CMetaTag, CPropertyTag, CScriptTag, CStartOfFileElement, and CTextElement.

List of all members.

Public Member Functions

CHtmlElement (CHtmlIFilter &htmlIFilter, CSerialStream &serialStream)
virtual | ~CHtmlElement ()
virtual SCODE | GetChunk (STAT_CHUNK *pStat)=0
virtual SCODE | GetText (ULONG *pcwcOutput, WCHAR *awcBuffer)=0
virtual SCODE | GetValue (PROPVARIANT **ppPropValue)
virtual void | InitFilterRegion (ULONG &idChunkSource, ULONG &cwcStartSource, ULONG &cwcLenSource)
virtual void | InitStatChunk (STAT_CHUNK *pStat)=0

Protected Member Functions

SCODE | SkipRemainingTextAndGotoNextChunk (STAT_CHUNK *pStat)
SCODE | SwitchToNextHtmlElement (STAT_CHUNK *pStat)

Protected Attributes

WCHAR | _aTempBuffer [TEMP_BUFFER_SIZE]
CHtmlIFilter & _htmlIFilter
CHtmlScanner _scanner
CSerialStream & _serialStream

Detailed Description

Definition at line 28 of file HtmlElem.Hxx.

Constructor & Destructor Documentation

CHtmlElement::CHtmlElement | ( | CHtmlIFilter & | htmlIFilter,
 |  | CSerialStream & | serialStream
 | ) |  |

Definition at line 30 of file HtmlElem.Cxx.

    : _htmlIFilter(htmlIFilter),
      _serialStream(serialStream),
      _scanner(htmlIFilter, serialStream)
{
}

virtual CHtmlElement::~CHtmlElement ( ) [inline, virtual]

Definition at line 33 of file HtmlElem.Hxx.

{}

Member Function Documentation

virtual SCODE CHtmlElement::GetChunk ( STAT_CHUNK * pStat ) [pure virtual]

Implemented in CAnchorTag, CImageTag, CInputTag, CMetaTag, CPropertyTag, CScriptTag, CStartOfFileElement, CTextElement, and CTitleTag.

virtual SCODE CHtmlElement::GetText | ( | ULONG * | pcwcOutput,
 |  | WCHAR * | awcBuffer |
 | ) |  |  | [pure virtual]

Implemented in CAnchorTag, CImageTag, CInputTag, CMetaTag, CPropertyTag, CScriptTag, CStartOfFileElement, CTextElement, and CTitleTag.

SCODE CHtmlElement::GetValue ( PROPVARIANT ** ppPropValue ) [virtual]

Reimplemented in CMetaTag, CScriptTag, and CTitleTag.

Definition at line 48 of file HtmlElem.Cxx.

{
    return FILTER_E_NO_VALUES;
}

void CHtmlElement::InitFilterRegion | ( | ULONG & | idChunkSource,
 |  | ULONG & | cwcStartSource,
 |  | ULONG & | cwcLenSource |
 | ) |  |  | [virtual]

Reimplemented in CTextElement.

Definition at line 65 of file HtmlElem.Cxx.

{
    idChunkSource = 0;
    cwcStartSource = 0;
    cwcLenSource = 0;
}

virtual void CHtmlElement::InitStatChunk ( STAT_CHUNK * pStat ) [pure virtual]

Implemented in CAnchorTag, CImageTag, CInputTag, CMetaTag, CPropertyTag, CScriptTag, CStartOfFileElement, and CTextElement.

SCODE CHtmlElement::SkipRemainingTextAndGotoNextChunk ( STAT_CHUNK * pStat ) [protected]

Definition at line 115 of file HtmlElem.Cxx.

{
    ULONG ulBufSize  = TEMP_BUFFER_SIZE;

    //
    // Loop until text in current chunk has been exhausted
    //
    SCODE sc = GetText( &ulBufSize, _aTempBuffer );
    while ( SUCCEEDED(sc) )
    {
        sc = GetText( &ulBufSize, _aTempBuffer );
    }

    sc = GetChunk( pStat );

    return sc;
}

SCODE CHtmlElement::SwitchToNextHtmlElement ( STAT_CHUNK * pStat ) [protected]

Definition at line 86 of file HtmlElem.Cxx.

{
    CToken token;

    _scanner.SkipCharsUntilNextRelevantToken( token );
    HtmlTokenType eTokType = token.GetTokenType();
    if ( eTokType == EofToken )
        return FILTER_E_END_OF_CHUNKS;

    CHtmlElement *pHtmlElemNext = _htmlIFilter.QueryHtmlElement( eTokType );
    Win4Assert( pHtmlElemNext );
    pHtmlElemNext->InitStatChunk( pStat );
    _htmlIFilter.ChangeState( pHtmlElemNext );

    return S_OK;
}

Member Data Documentation

WCHAR CHtmlElement::_aTempBuffer[TEMP_BUFFER_SIZE] [protected]

Definition at line 51 of file HtmlElem.Hxx.

CHtmlIFilter& CHtmlElement::_htmlIFilter [protected]

Definition at line 48 of file HtmlElem.Hxx.

CHtmlScanner CHtmlElement::_scanner [protected]

Definition at line 50 of file HtmlElem.Hxx.

CSerialStream& CHtmlElement::_serialStream [protected]

Definition at line 49 of file HtmlElem.Hxx.

The documentation for this class was generated from the following files:
  • WinBase/Indexing/IFilter/HtmlElem.Hxx
  • WinBase/Indexing/IFilter/HtmlElem.Cxx
Generated on Wed Nov 13 2024 16:56:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CHtmlElementBag Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CHtmlElementBag Class Reference

#include "Bag.Hxx"

List of all members.

Public Member Functions

CHtmlElementBag (unsigned cElems)
~CHtmlElementBag ()
void | AddElement (HtmlTokenType eTokType, CHtmlElement *pHtmlElement)
CHtmlElement * | QueryElement (HtmlTokenType eTokType)

Private Attributes

CHtmlElemBagEntry * _aBagEntry
unsigned | _uCurSize
unsigned | _uMaxSize

Detailed Description

Definition at line 53 of file Bag.Hxx.

Constructor & Destructor Documentation

CHtmlElementBag::CHtmlElementBag ( unsigned cElems )

Definition at line 59 of file Bag.Cxx.

    : _uMaxSize(cElems),
      _uCurSize(0)
{
    _aBagEntry = newk(mtNewX, NULL) CHtmlElemBagEntry[cElems];
}

CHtmlElementBag::~CHtmlElementBag ( )

Definition at line 76 of file Bag.Cxx.

{
    delete[] _aBagEntry;
}

Member Function Documentation

void CHtmlElementBag::AddElement | ( | HtmlTokenType | eTokType,
 |  | CHtmlElement * | pHtmlElement
 | ) |  |

Definition at line 94 of file Bag.Cxx.

{
    Win4Assert( _uCurSize < _uMaxSize );

    _aBagEntry[_uCurSize].SetTokenType( eTokType );
    _aBagEntry[_uCurSize].SetHtmlElement( pHtmlElement );
    _uCurSize++;
}

CHtmlElement * CHtmlElementBag::QueryElement ( HtmlTokenType eTokType )

Definition at line 116 of file Bag.Cxx.

{
    for (unsigned i=0; i<_uCurSize; i++)
    {
        if ( _aBagEntry[i].GetTokenType() == eTokType )
            return _aBagEntry[i].GetHtmlElement();
    }

    htmlDebugOut(( DEB_ERROR,
                 "Unknown Html token type 0x%x in CHtmlElementBag::QueryElement\n",
                 eTokType ));
    Win4Assert( !"Cannot map Html token type" );
    return 0;
}

Member Data Documentation

CHtmlElemBagEntry* CHtmlElementBag::_aBagEntry [private]

Definition at line 64 of file Bag.Hxx.

unsigned CHtmlElementBag::_uCurSize [private]

Definition at line 66 of file Bag.Hxx.

unsigned CHtmlElementBag::_uMaxSize [private]

Definition at line 65 of file Bag.Hxx.

The documentation for this class was generated from the following files:
  • WinBase/Indexing/IFilter/Bag.Hxx
  • WinBase/Indexing/IFilter/Bag.Cxx
Generated on Wed Nov 13 2024 16:56:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CHtmlIFilter Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CHtmlIFilter Class Reference

#include "HtmlFilt.Hxx"

Inherits CHtmlIFilterBase.

List of all members.

Public Member Functions

CHtmlIFilter ()
~CHtmlIFilter ()
SCODE STDMETHODCALLTYPE | BindRegion (FILTERREGION origPos, REFIID riid, void **ppunk)
void | ChangeState (CHtmlElement *pHtmlElemNewState)
BOOL FFilterContent ()
SCODE STDMETHODCALLTYPE | GetChunk (STAT_CHUNK *pStat)
SCODE STDMETHODCALLTYPE | GetClassID (CLSID *pClassID)
SCODE STDMETHODCALLTYPE | GetCurFile (LPWSTR *ppszFileName)
CHtmlElement * GetCurHtmlElement ()
LCID | GetLocale ()
ULONG GetNextChunkId ()
SCODE STDMETHODCALLTYPE | GetText (ULONG *pcwcOutput, WCHAR *awcBuffer)
SCODE STDMETHODCALLTYPE | GetValue (PROPVARIANT **ppPropValue)
SCODE STDMETHODCALLTYPE | Init (ULONG grfFlags, ULONG cAttributes, FULLPROPSPEC const *aAttributes, ULONG *pFlags)
SCODE STDMETHODCALLTYPE | IsDirty ()
BOOL | IsStopToken (CToken &token)
SCODE STDMETHODCALLTYPE | Load (LPCWSTR pszFileName, DWORD dwMode)
CHtmlElement * | QueryHtmlElement (HtmlTokenType eTokType)
SCODE STDMETHODCALLTYPE | Save (LPCWSTR pszFileName, BOOL fRemember)
SCODE STDMETHODCALLTYPE | SaveCompleted (LPCWSTR pszFileName)
void | SetLocale (LCID locale)

Private Member Functions

BOOL IsNonHtmlFile ()

Private Attributes

ULONG _cAttributes
BOOL _fFilterContent
BOOL _fFilterMetaTag
BOOL _fFilterScriptTag
BOOL _fNonHtmlFile
CHtmlElementBag _htmlElementBag
LCID | _locale
CFullPropSpec * _pAttributes
CHtmlElement * _pHtmlElement
WCHAR * | _pwszFileName
CSerialStream _serialStream
ULONG _ulChunkID

Detailed Description

Definition at line 31 of file HtmlFilt.Hxx.

Constructor & Destructor Documentation

CHtmlIFilter::CHtmlIFilter ( )

Definition at line 43 of file HtmlFilt.Cxx.

    : _pHtmlElement(0),
      _fNonHtmlFile(FALSE),
      _fFilterContent(FALSE),
      _fFilterMetaTag(FALSE),
      _fFilterScriptTag(FALSE),
      _cAttributes(0),
      _pAttributes(0),
      _pwszFileName(0),
      _ulChunkID(0),
      _locale(GetSystemDefaultLCID()),
      _htmlElementBag( COUNT_OF_HTML_ELEMENTS )
{
    //
    // Setup various Html elements
    //
    _htmlElementBag.AddElement( TextToken, newk(mtNewX, NULL) CTextElement( *this, _serialStream ) );

    _htmlElementBag.AddElement( StartOfFileToken, newk(mtNewX, NULL) CStartOfFileElement( *this, _serialStream ) );

    CFullPropSpec psTitle( CLSID_SummaryInformation, PID_TITLE );
    _htmlElementBag.AddElement( TitleToken, newk(mtNewX, NULL) CTitleTag( *this,
                                                                          _serialStream,
                                                                          psTitle,
                                                                          TitleToken ) );

    CFullPropSpec psHeading1( CLSID_HtmlInformation, PID_HEADING_1 );
    _htmlElementBag.AddElement( Heading1Token, newk(mtNewX, NULL) CPropertyTag( *this,
                                                                                _serialStream,
                                                                                psHeading1,
                                                                                Heading1Token ) );

    CFullPropSpec psHeading2( CLSID_HtmlInformation, PID_HEADING_2 );
    _htmlElementBag.AddElement( Heading2Token, newk(mtNewX, NULL) CPropertyTag( *this,
                                                                                _serialStream,
                                                                                psHeading2,
                                                                                Heading2Token ) );

    CFullPropSpec psHeading3( CLSID_HtmlInformation, PID_HEADING_3 );
    _htmlElementBag.AddElement( Heading3Token, newk(mtNewX, NULL) CPropertyTag( *this,
                                                                                _serialStream,
                                                                                psHeading3,
                                                                                Heading3Token ) );

    CFullPropSpec psHeading4( CLSID_HtmlInformation, PID_HEADING_4 );
    _htmlElementBag.AddElement( Heading4Token, newk(mtNewX, NULL) CPropertyTag( *this,
                                                                                _serialStream,
                                                                                psHeading4,
                                                                                Heading4Token ) );

    CFullPropSpec psHeading5( CLSID_HtmlInformation, PID_HEADING_5 );
    _htmlElementBag.AddElement( Heading5Token, newk(mtNewX, NULL) CPropertyTag( *this,
                                                                                _serialStream,
                                                                                psHeading5,
                                                                                Heading5Token ) );

    CFullPropSpec psHeading6( CLSID_HtmlInformation, PID_HEADING_6 );
    _htmlElementBag.AddElement( Heading6Token, newk(mtNewX, NULL) CPropertyTag( *this,
                                                                                _serialStream,
                                                                                psHeading6,
                                                                                Heading6Token ) );

    _htmlElementBag.AddElement( AnchorToken, newk(mtNewX, NULL) CAnchorTag( *this, _serialStream ) );

    _htmlElementBag.AddElement( InputToken, newk(mtNewX, NULL) CInputTag( *this, _serialStream ) );

    _htmlElementBag.AddElement( ImageToken, newk(mtNewX, NULL) CImageTag( *this, _serialStream ) );

    //
    // Read classid of meta information from registry
    //
    const WCHAR *pszKey = L"system\\currentcontrolset\\control\\HtmlFilter";
    CRegAccess regMetaInfo( HKEY_LOCAL_MACHINE, pszKey );

    const MAX_VALUE_LENGTH = 100;
    WCHAR wszValue[MAX_VALUE_LENGTH];
    _fFilterMetaTag = regMetaInfo.Get( L"MetaTagClsid", wszValue, MAX_VALUE_LENGTH );

    if ( _fFilterMetaTag )
    {
        GUID ClsidMetaInformation;

        StringToClsid( wszValue, ClsidMetaInformation );
        _htmlElementBag.AddElement( MetaToken, newk(mtNewX, NULL) CMetaTag( *this,
                                                                            _serialStream,
                                                                            ClsidMetaInformation ) );
    }

    //
    // Read classid of scripts from registry
    //
    CRegAccess regScriptInfo( HKEY_LOCAL_MACHINE, pszKey );

    _fFilterScriptTag = regScriptInfo.Get( L"ScriptTagClsid", wszValue, MAX_VALUE_LENGTH );

    if ( _fFilterScriptTag )
    {
        GUID ClsidScriptInformation;

        StringToClsid( wszValue, ClsidScriptInformation );
        _htmlElementBag.AddElement( ScriptToken, newk(mtNewX, NULL) CScriptTag( *this,
                                                                                _serialStream,
                                                                                ClsidScriptInformation ) );
    }

    //
    // Set the start state to StartOfFile mode
    //
    _pHtmlElement = _htmlElementBag.QueryElement( StartOfFileToken );
}

CHtmlIFilter::~CHtmlIFilter ( )

Definition at line 162 of file HtmlFilt.Cxx.

{
    delete[] _pAttributes;
    delete[] _pwszFileName;
}

Member Function Documentation

SCODE STDMETHODCALLTYPE CHtmlIFilter::BindRegion | ( | FILTERREGION | origPos,
 |  | REFIID | riid,
 |  | void ** | ppunk |
 | ) |  |  | [virtual]

Implements CHtmlIFilterBase.

Definition at line 181 of file HtmlFilt.Cxx.

{
    return E_NOTIMPL;
}

void CHtmlIFilter::ChangeState ( CHtmlElement * pHtmlElemNewState )

Definition at line 451 of file HtmlFilt.Cxx.

{
    _pHtmlElement = pHtmlElemNewState;
}

BOOL CHtmlIFilter::FFilterContent ( ) [inline]

Definition at line 78 of file HtmlFilt.Hxx.

{ return _fFilterContent; }

SCODE STDMETHODCALLTYPE CHtmlIFilter::GetChunk ( STAT_CHUNK * pStat ) [virtual]

Implements CHtmlIFilterBase.

Definition at line 502 of file HtmlFilt.Cxx.

{
    //
    // IE workaround, don't filter non-Html files such as .gif
    //
    if ( _fNonHtmlFile )
        return FILTER_E_END_OF_CHUNKS;

    SCODE sc = S_OK;

    _se_translator_function tf = _set_se_translator( SystemExceptionTranslator );

    try
    {
        sc = _pHtmlElement->GetChunk( pStat );
    }
    catch( CException& e )
    {
        htmlDebugOut(( DEB_ERROR,
                       "Caught exception 0x%x in CHtmlIFilter::GetChunk\n",
                       e.GetErrorCode() ));

        sc = GetOleError( e );
    }

    _set_se_translator( tf );

    return sc;
}

SCODE STDMETHODCALLTYPE CHtmlIFilter::GetClassID ( CLSID * pClassID ) [virtual]

Implements CHtmlIFilterBase.

Definition at line 198 of file HtmlFilt.Cxx.

{
    *pClassID = CLSID_HtmlIFilter;
    return S_OK;
}

SCODE STDMETHODCALLTYPE CHtmlIFilter::GetCurFile ( LPWSTR * ppszFileName ) [virtual]

Implements CHtmlIFilterBase.

Definition at line 295 of file HtmlFilt.Cxx.

{
    if ( _pwszFileName == 0 )
        return E_FAIL;

    unsigned cLen = (unsigned) wcslen( _pwszFileName ) + 1;
    *ppwszFileName = (WCHAR *)CoTaskMemAlloc( cLen*sizeof(WCHAR) );

    SCODE sc = S_OK;
    if ( *ppwszFileName )
        wcscpy( *ppwszFileName, _pwszFileName );
    else
        sc = E_OUTOFMEMORY;

    return sc;
}

CHtmlElement* CHtmlIFilter::GetCurHtmlElement ( ) [inline]

Definition at line 74 of file HtmlFilt.Hxx.

{ return _pHtmlElement; }

LCID CHtmlIFilter::GetLocale ( ) [inline]

Definition at line 80 of file HtmlFilt.Hxx.

{ return _locale; }

ULONG CHtmlIFilter::GetNextChunkId ( )

Definition at line 482 of file HtmlFilt.Cxx.

{
    Win4Assert( _ulChunkID != ULONG_MAX );

    return ++_ulChunkID;
}

SCODE STDMETHODCALLTYPE CHtmlIFilter::GetText | ( | ULONG * | pcwcOutput,
 |  | WCHAR * | awcBuffer |
 | ) |  |  | [virtual]

Implements CHtmlIFilterBase.

Definition at line 546 of file HtmlFilt.Cxx.

{
    //
    // IE workaround, don't filter non-Html files such as .gif
    //
    if ( _fNonHtmlFile )
        return FILTER_E_NO_TEXT;

    SCODE sc = S_OK;

    _se_translator_function tf = _set_se_translator( SystemExceptionTranslator );

    try
    {
        sc = _pHtmlElement->GetText( pcwcOutput, awcOutput );
    }
    catch( CException& e )
    {
        htmlDebugOut(( DEB_ERROR,
                       "Caught exception 0x%x in CHtmlIFilter::GetText\n",
                       e.GetErrorCode() ));

        sc = GetOleError( e );
    }

    _set_se_translator( tf );

    return sc;
}

SCODE STDMETHODCALLTYPE CHtmlIFilter::GetValue ( PROPVARIANT ** ppPropValue ) [virtual]

Implements CHtmlIFilterBase.

Definition at line 585 of file HtmlFilt.Cxx.

{
    //
    // IE workaround, don't filter non-Html files such as .gif
    //
    if ( _fNonHtmlFile )
        return FILTER_E_NO_VALUES;

    SCODE sc = S_OK;

    _se_translator_function tf = _set_se_translator( SystemExceptionTranslator );

    try
    {
        sc = _pHtmlElement->GetValue( ppPropValue );
    }
    catch( CException& e )
    {
        htmlDebugOut(( DEB_ERROR,
                       "Caught exception 0x%x in CHtmlIFilter::GetValue\n",
                       e.GetErrorCode() ));

        sc = GetOleError( e );
    }

    _set_se_translator( tf );

    return sc;
}

SCODE STDMETHODCALLTYPE CHtmlIFilter::Init | ( | ULONG | grfFlags,
 |  | ULONG | cAttributes,
 |  | FULLPROPSPEC const * | aAttributes,
 |  | ULONG * | pFlags |
 | ) |  |  | [virtual]

Implements CHtmlIFilterBase.

Definition at line 327 of file HtmlFilt.Cxx.

{
    SCODE sc = S_OK;

    *pFlags = 0;  // There are no OLE docfile properties for .htm files.

    //
    // IE workaround, don't filter non-Html files such as .gif
    //
    if ( _fNonHtmlFile )
        return S_OK;

    _se_translator_function tf = _set_se_translator( SystemExceptionTranslator );

    try
    {

        _fFilterContent = FALSE;

        if ( _cAttributes > 0 )
        {
            delete[] _pAttributes;
            _pAttributes = 0;
            _cAttributes = 0;
        }

        if ( cAttributes > 0 )
        {
            //
            // Filter properties specified in pAttributes
            //
            _pAttributes = newk(mtNewX, NULL) CFullPropSpec[cAttributes];
            _cAttributes = cAttributes;

            CFullPropSpec *pAttrib = (CFullPropSpec *) pAttributes;

            for (unsigned i=0; i<cAttributes; i++)
            {
                if ( pAttrib[i].IsPropertyPropid()
                     && pAttrib[i].GetPropertyPropid() == PID_STG_CONTENTS
                     && pAttrib[i].GetPropSet() == CLSID_Storage )
                {
                    _fFilterContent = TRUE;
                }

                _pAttributes[i] = pAttrib[i];
            }
        }
        else if ( grfFlags & IFILTER_INIT_APPLY_INDEX_ATTRIBUTES )
        {
            //
            // Filter contents and all pseudo-properties
            //
            _fFilterContent = TRUE;

            const COUNT_ATTRIBUTES = 8;
            _pAttributes = newk(mtNewX, NULL) CFullPropSpec[COUNT_ATTRIBUTES];
            _cAttributes = COUNT_ATTRIBUTES;

            _pAttributes[0].SetPropSet( CLSID_SummaryInformation );
            _pAttributes[0].SetProperty( PID_TITLE );

            _pAttributes[1].SetPropSet( CLSID_HtmlInformation );
            _pAttributes[1].SetProperty( PID_HREF );

            _pAttributes[2].SetPropSet( CLSID_HtmlInformation );
            _pAttributes[2].SetProperty( PID_HEADING_1 );

            _pAttributes[3].SetPropSet( CLSID_HtmlInformation );
            _pAttributes[3].SetProperty( PID_HEADING_2 );

            _pAttributes[4].SetPropSet( CLSID_HtmlInformation );
            _pAttributes[4].SetProperty( PID_HEADING_3 );

            _pAttributes[5].SetPropSet( CLSID_HtmlInformation );
            _pAttributes[5].SetProperty( PID_HEADING_4 );

            _pAttributes[6].SetPropSet( CLSID_HtmlInformation );
            _pAttributes[6].SetProperty( PID_HEADING_5 );

            _pAttributes[7].SetPropSet( CLSID_HtmlInformation );
            _pAttributes[7].SetProperty( PID_HEADING_6 );
        }
        else if ( grfFlags == 0 )
        {
            //
            // Filter only contents
            //
            _fFilterContent = TRUE;
        }

        _pHtmlElement = _htmlElementBag.QueryElement( StartOfFileToken );
        _ulChunkID = 0;
        _serialStream.Init( _pwszFileName );
    }
    catch( CException& e)
    {
        htmlDebugOut(( DEB_ERROR,
                       "Exception 0x%x caught in CHtmlIFilter::Init\n",
                       e.GetErrorCode() ));
        sc = GetOleError( e );
    }

    _set_se_translator( tf );

    return sc;
}

SCODE STDMETHODCALLTYPE CHtmlIFilter::IsDirty ( void ) [virtual]

Implements CHtmlIFilterBase.

Definition at line 212 of file HtmlFilt.Cxx.

{
    return S_FALSE;
}

BOOL CHtmlIFilter::IsNonHtmlFile ( ) [private]

Definition at line 661 of file HtmlFilt.Cxx.

{
    WCHAR *pwszExtension = 0;

    for ( int i=(int) ( wcslen(_pwszFileName)-1); i>=0; i-- )
    {
        if ( _pwszFileName[i] == L'.' )
        {
            pwszExtension = &_pwszFileName[i+1];
            break;
        }
    }

    //
    // No extension, then assume it's an html file
    //
    if ( 0 == pwszExtension )
        return FALSE;

    switch( pwszExtension[0] )
    {
    case L'a':
    case L'A':
        if ( _wcsicmp( pwszExtension, L"aif" ) == 0
             || _wcsicmp( pwszExtension, L"aifc" ) == 0
             || _wcsicmp( pwszExtension, L"aiff" ) == 0
             || _wcsicmp( pwszExtension, L"au" ) == 0 )
        {
            return TRUE;
        }

        break;

    case L'g':
    case L'G':
        if ( _wcsicmp( pwszExtension, L"gif" ) == 0 )
            return TRUE;

        break;

    case L'j':
    case L'J':
        if ( _wcsicmp( pwszExtension, L"jfif" ) == 0
             || _wcsicmp( pwszExtension, L"jpe" ) == 0
             || _wcsicmp( pwszExtension, L"jpeg" ) == 0
             || _wcsicmp( pwszExtension, L"jpg" ) == 0 )
        {
            return TRUE;
        }

        break;

    case L's':
    case L'S':
        if ( _wcsicmp( pwszExtension, L"snd" ) == 0 )
            return TRUE;

        break;

    case L'x':
    case L'X':
        if ( _wcsicmp( pwszExtension, L"xbm" ) == 0 )
            return TRUE;

        break;

    default:
        return FALSE;
    }

    return FALSE;
}

BOOL CHtmlIFilter::IsStopToken ( CToken & token )

Definition at line 627 of file HtmlFilt.Cxx.

{
    HtmlTokenType tokType = token.GetTokenType();
    if ( ( tokType == InputToken || tokType == ImageToken )  && _fFilterContent
         || tokType == MetaToken && _fFilterMetaTag
         || tokType == ScriptToken && _fFilterScriptTag )
    {
        return TRUE;
    }

    if ( token.GetTokenType() == GenericToken
         || token.GetTokenType() == BreakToken )
        return FALSE;

    for ( unsigned i=0; i<_cAttributes; i++ )
    {
        if ( token.IsMatchProperty( _pAttributes[i] ) )
            return TRUE;
    }

    return FALSE;
}

SCODE STDMETHODCALLTYPE CHtmlIFilter::Load | ( | LPCWSTR | pszFileName,
 |  | DWORD | dwMode |
 | ) |  |  | [virtual]

Implements CHtmlIFilterBase.

Definition at line 228 of file HtmlFilt.Cxx.

{
    if ( _pwszFileName != 0 )
    {
        delete _pwszFileName;
        _pwszFileName = 0;
    }

    _se_translator_function tf = _set_se_translator( SystemExceptionTranslator );

    SCODE sc = S_OK;
    try
    {
        unsigned cLen = (unsigned) wcslen( psszFileName ) + 1;
        _pwszFileName = newk(mtNewX, NULL) WCHAR[cLen];
        wcscpy( _pwszFileName, psszFileName );

        _fNonHtmlFile = IsNonHtmlFile();
    }
    catch( CException& e )
    {
        htmlDebugOut(( DEB_ERROR, "Exception 0x%x caught in CHtmlIFilter::Load", e.GetErrorCode() ));

        sc = GetOleError( e );
    }

    _set_se_translator( tf );

    return sc;
}

CHtmlElement * CHtmlIFilter::QueryHtmlElement ( HtmlTokenType eTokType )

Definition at line 467 of file HtmlFilt.Cxx.

{
    return _htmlElementBag.QueryElement( eTokType );
}

SCODE STDMETHODCALLTYPE CHtmlIFilter::Save | ( | LPCWSTR | pszFileName,
 |  | BOOL | fRemember |
 | ) |  |  | [virtual]

Implements CHtmlIFilterBase.

Definition at line 267 of file HtmlFilt.Cxx.

{
    return E_FAIL;
}

SCODE STDMETHODCALLTYPE CHtmlIFilter::SaveCompleted ( LPCWSTR pszFileName ) [virtual]

Implements CHtmlIFilterBase.

Definition at line 280 of file HtmlFilt.Cxx.

{
    return E_FAIL;
}

void CHtmlIFilter::SetLocale ( LCID locale ) [inline]

Definition at line 81 of file HtmlFilt.Hxx.

{ _locale = locale; }

Member Data Documentation

ULONG CHtmlIFilter::_cAttributes [private]

Definition at line 97 of file HtmlFilt.Hxx.

BOOL CHtmlIFilter::_fFilterContent [private]

Definition at line 93 of file HtmlFilt.Hxx.

BOOL CHtmlIFilter::_fFilterMetaTag [private]

Definition at line 94 of file HtmlFilt.Hxx.

BOOL CHtmlIFilter::_fFilterScriptTag [private]

Definition at line 95 of file HtmlFilt.Hxx.

BOOL CHtmlIFilter::_fNonHtmlFile [private]

Definition at line 87 of file HtmlFilt.Hxx.

CHtmlElementBag CHtmlIFilter::_htmlElementBag [private]

Definition at line 104 of file HtmlFilt.Hxx.

LCID CHtmlIFilter::_locale [private]

Definition at line 102 of file HtmlFilt.Hxx.

CFullPropSpec* CHtmlIFilter::_pAttributes [private]

Definition at line 98 of file HtmlFilt.Hxx.

CHtmlElement* CHtmlIFilter::_pHtmlElement [private]

Definition at line 86 of file HtmlFilt.Hxx.

WCHAR* CHtmlIFilter::_pwszFileName [private]

Definition at line 100 of file HtmlFilt.Hxx.

CSerialStream CHtmlIFilter::_serialStream [private]

Definition at line 105 of file HtmlFilt.Hxx.

ULONG CHtmlIFilter::_ulChunkID [private]

Definition at line 101 of file HtmlFilt.Hxx.

The documentation for this class was generated from the following files:
  • WinBase/Indexing/IFilter/HtmlFilt.Hxx
  • WinBase/Indexing/IFilter/HtmlFilt.Cxx
Generated on Wed Nov 13 2024 16:56:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CHtmlIFilterBase Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Protected Attributes

CHtmlIFilterBase Class Reference

#include "HtmlIFlt.Hxx"

Inherited by CHtmlIFilter.

List of all members.

Public Member Functions

virtual ULONG STDMETHODCALLTYPE | AddRef ()
virtual SCODE STDMETHODCALLTYPE | BindRegion (FILTERREGION origPos, REFIID riid, void **ppunk)=0
virtual SCODE STDMETHODCALLTYPE | GetChunk (STAT_CHUNK *pStat)=0
virtual SCODE STDMETHODCALLTYPE | GetClassID (CLSID *pClassID)=0
virtual SCODE STDMETHODCALLTYPE | GetCurFile (LPWSTR *ppszFileName)=0
virtual SCODE STDMETHODCALLTYPE | GetText (ULONG *pcwcBuffer, WCHAR *awcBuffer)=0
virtual SCODE STDMETHODCALLTYPE | GetValue (PROPVARIANT **ppPropValue)=0
virtual SCODE STDMETHODCALLTYPE | Init (ULONG grfFlags, ULONG cAttributes, FULLPROPSPEC const *aAttributes, ULONG *pFlags)=0
virtual SCODE STDMETHODCALLTYPE | IsDirty ()=0
virtual SCODE STDMETHODCALLTYPE | Load (LPCWSTR pszFileName, DWORD dwMode)=0
virtual SCODE STDMETHODCALLTYPE | QueryInterface (REFIID riid, void **ppvObject)
virtual ULONG STDMETHODCALLTYPE | Release ()
virtual SCODE STDMETHODCALLTYPE | Save (LPCWSTR pszFileName, BOOL fRemember)=0
virtual SCODE STDMETHODCALLTYPE | SaveCompleted (LPCWSTR pszFileName)=0

Protected Member Functions

CHtmlIFilterBase ()
virtual | ~CHtmlIFilterBase ()

Protected Attributes

long | _uRefs

Detailed Description

Definition at line 34 of file HtmlIFlt.Hxx.

Constructor & Destructor Documentation

CHtmlIFilterBase::CHtmlIFilterBase ( ) [protected]

Definition at line 59 of file HtmlIFlt.Cxx.

{
    _uRefs = 1;
    InterlockedIncrement( &gulcInstances );
}

CHtmlIFilterBase::~CHtmlIFilterBase ( ) [protected, virtual]

Definition at line 75 of file HtmlIFlt.Cxx.

{
    InterlockedDecrement( &gulcInstances );
}

Member Function Documentation

ULONG STDMETHODCALLTYPE CHtmlIFilterBase::AddRef ( void ) [virtual]

Definition at line 126 of file HtmlIFlt.Cxx.

{
    return InterlockedIncrement( &_uRefs );
}

virtual SCODE STDMETHODCALLTYPE CHtmlIFilterBase::BindRegion | ( | FILTERREGION | origPos,
 |  | REFIID | riid,
 |  | void ** | ppunk |
 | ) |  |  | [pure virtual]

Implemented in CHtmlIFilter.

virtual SCODE STDMETHODCALLTYPE CHtmlIFilterBase::GetChunk ( STAT_CHUNK * pStat ) [pure virtual]

Implemented in CHtmlIFilter.

virtual SCODE STDMETHODCALLTYPE CHtmlIFilterBase::GetClassID ( CLSID * pClassID ) [pure virtual]

Implemented in CHtmlIFilter.

virtual SCODE STDMETHODCALLTYPE CHtmlIFilterBase::GetCurFile ( LPWSTR * ppszFileName ) [pure virtual]

Implemented in CHtmlIFilter.

virtual SCODE STDMETHODCALLTYPE CHtmlIFilterBase::GetText | ( | ULONG * | pcwcBuffer,
 |  | WCHAR * | awcBuffer |
 | ) |  |  | [pure virtual]

Implemented in CHtmlIFilter.

virtual SCODE STDMETHODCALLTYPE CHtmlIFilterBase::GetValue ( PROPVARIANT ** ppPropValue ) [pure virtual]

Implemented in CHtmlIFilter.

virtual SCODE STDMETHODCALLTYPE CHtmlIFilterBase::Init | ( | ULONG | grfFlags,
 |  | ULONG | cAttributes,
 |  | FULLPROPSPEC const * | aAttributes,
 |  | ULONG * | pFlags |
 | ) |  |  | [pure virtual]

Implemented in CHtmlIFilter.

virtual SCODE STDMETHODCALLTYPE CHtmlIFilterBase::IsDirty ( ) [pure virtual]

Implemented in CHtmlIFilter.

virtual SCODE STDMETHODCALLTYPE CHtmlIFilterBase::Load | ( | LPCWSTR | pszFileName,
 |  | DWORD | dwMode |
 | ) |  |  | [pure virtual]

Implemented in CHtmlIFilter.

SCODE STDMETHODCALLTYPE CHtmlIFilterBase::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppvObject |
 | ) |  |  | [virtual]

Definition at line 93 of file HtmlIFlt.Cxx.

{
    if ( 0 == ppvObject )
        return E_INVALIDARG;

    *ppvObject = 0;

    if ( IID_IPersistFile == riid )
        *ppvObject = (IUnknown *)(IPersist *)(IPersistFile *)this;
    else if ( IID_IFilter == riid )
        *ppvObject = (IUnknown *)(IFilter *)this;
    else if ( IID_IPersist == riid )
        *ppvObject = (IUnknown *)(IPersist *)(IPersistFile *)this;
    else if ( IID_IPersistFile == riid )
        *ppvObject = (IUnknown *)(IPersistFile *)this;
    else if ( IID_IUnknown  == riid )
        *ppvObject = (IUnknown *)(IPersistFile *)this;
    else
        return E_NOINTERFACE;

    AddRef();
    return S_OK;
} //QueryInterface

ULONG STDMETHODCALLTYPE CHtmlIFilterBase::Release ( void ) [virtual]

Definition at line 139 of file HtmlIFlt.Cxx.

{
    unsigned long uTmp = InterlockedDecrement( &_uRefs );

    if ( 0 == uTmp )
        delete this;

    return(uTmp);
}

virtual SCODE STDMETHODCALLTYPE CHtmlIFilterBase::Save | ( | LPCWSTR | pszFileName,
 |  | BOOL | fRemember |
 | ) |  |  | [pure virtual]

Implemented in CHtmlIFilter.

virtual SCODE STDMETHODCALLTYPE CHtmlIFilterBase::SaveCompleted ( LPCWSTR pszFileName ) [pure virtual]

Implemented in CHtmlIFilter.

Member Data Documentation

long CHtmlIFilterBase::_uRefs [protected]

Definition at line 91 of file HtmlIFlt.Hxx.

The documentation for this class was generated from the following files:
  • WinBase/Indexing/IFilter/HtmlIFlt.Hxx
  • WinBase/Indexing/IFilter/HtmlIFlt.Cxx
Generated on Wed Nov 13 2024 16:56:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CHtmlIFilterCF Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Protected Attributes | Friends

CHtmlIFilterCF Class Reference

#include "HtmlIFlt.Hxx"

List of all members.

Public Member Functions

CHtmlIFilterCF ()
virtual ULONG STDMETHODCALLTYPE | AddRef ()
virtual SCODE STDMETHODCALLTYPE | CreateInstance (IUnknown *pUnkOuter, REFIID riid, void **ppvObject)
virtual SCODE STDMETHODCALLTYPE | LockServer (BOOL fLock)
virtual SCODE STDMETHODCALLTYPE | QueryInterface (REFIID riid, void **ppvObject)
virtual ULONG STDMETHODCALLTYPE | Release ()

Protected Member Functions

virtual | ~CHtmlIFilterCF ()

Protected Attributes

long | _uRefs

Friends

SCODE STDMETHODCALLTYPE | DllGetClassObject (REFCLSID cid, REFIID iid, void **ppvObj)

Detailed Description

Definition at line 102 of file HtmlIFlt.Hxx.

Constructor & Destructor Documentation

CHtmlIFilterCF::CHtmlIFilterCF ( )

Definition at line 157 of file HtmlIFlt.Cxx.

{
    _uRefs = 1;
    InterlockedIncrement( &gulcInstances );
}

CHtmlIFilterCF::~CHtmlIFilterCF ( ) [protected, virtual]

Definition at line 173 of file HtmlIFlt.Cxx.

{
    InterlockedDecrement( &gulcInstances );
}

Member Function Documentation

ULONG STDMETHODCALLTYPE CHtmlIFilterCF::AddRef ( void ) [virtual]

Definition at line 218 of file HtmlIFlt.Cxx.

{
    return InterlockedIncrement( &_uRefs );
}

SCODE STDMETHODCALLTYPE CHtmlIFilterCF::CreateInstance | ( | IUnknown * | pUnkOuter,
 |  | REFIID | riid,
 |  | void ** | ppvObject |
 | ) |  |  | [virtual]

Definition at line 254 of file HtmlIFlt.Cxx.

{
    CHtmlIFilter *  pIUnk = 0;
    SCODE sc = S_OK;

    _se_translator_function tf = _set_se_translator( SystemExceptionTranslator );

    try
    {
        pIUnk = newk(mtNewX, NULL) CHtmlIFilter();
        sc = pIUnk->QueryInterface(  riid , ppvObject );

        if( SUCCEEDED(sc) )
            pIUnk->Release();  // Release extra refcount from QueryInterface
    }
    catch(CException& e)
    {
        Win4Assert( 0 == pIUnk );

        htmlDebugOut(( DEB_ERROR,
                       "Exception 0x%x caught in CHtmlIFilterCF::CreateInstance",
                       e.GetErrorCode() ));
        sc = GetOleError( e );
    }

    _set_se_translator( tf );

    return (sc);
}

SCODE STDMETHODCALLTYPE CHtmlIFilterCF::LockServer ( BOOL fLock ) [virtual]

Definition at line 298 of file HtmlIFlt.Cxx.

{
    if(fLock)
        InterlockedIncrement( &gulcInstances );
    else
        InterlockedDecrement( &gulcInstances );

    return(S_OK);
}

SCODE STDMETHODCALLTYPE CHtmlIFilterCF::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppvObject |
 | ) |  |  | [virtual]

Definition at line 191 of file HtmlIFlt.Cxx.

{
    if ( 0 == ppvObject )
        return E_INVALIDARG;

    *ppvObject = 0;

    if ( IID_IClassFactory == riid )
        *ppvObject = (IUnknown *)(IClassFactory *)this;
    else if ( IID_IUnknown  == riid )
        *ppvObject = (IUnknown *)this;
    else
        return E_NOINTERFACE;

    AddRef();
    return S_OK;
} //QueryInterface

ULONG STDMETHODCALLTYPE CHtmlIFilterCF::Release ( void ) [virtual]

Definition at line 231 of file HtmlIFlt.Cxx.

{
    unsigned long uTmp = InterlockedDecrement( &_uRefs );

    if ( 0 == uTmp )
        delete this;

    return(uTmp);
}

Friends And Related Function Documentation

SCODE STDMETHODCALLTYPE DllGetClassObject | ( | REFCLSID | cid,
 |  | REFIID | iid,
 |  | void ** | ppvObj |
 | ) |  |  | [friend]

Definition at line 1064 of file HtmlProp.Cxx.

{
    IUnknown * pUnk = 0;

    if ( CLSID_HtmlPropIFilter == cid ||
         CLSID_HtmlPropClass   == cid )
    {
        pUnk = new HtmlPropIFilterCF;

        if ( 0 == pUnk )
            return E_OUTOFMEMORY;
    }
    else
    {
        *ppvObj = 0;
        return E_NOINTERFACE;
    }

    SCODE sc = pUnk->QueryInterface( iid, ppvObj );

    pUnk->Release();

    return sc;
} //DllGetClassObject

Member Data Documentation

long CHtmlIFilterCF::_uRefs [protected]

Definition at line 126 of file HtmlIFlt.Hxx.

The documentation for this class was generated from the following files:
  • WinBase/Indexing/IFilter/HtmlIFlt.Hxx
  • WinBase/Indexing/IFilter/HtmlIFlt.Cxx
Generated on Wed Nov 13 2024 16:56:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CHtmlScanner Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CHtmlScanner Class Reference

#include "HtmlScan.Hxx"

List of all members.

Public Member Functions

CHtmlScanner (CHtmlIFilter &htmlIFilter, CSerialStream &serialStream)
~CHtmlScanner ()
void | EatTag ()
void | GetBlockOfChars (ULONG cCharsNeeded, WCHAR *awcInputBuf, ULONG &cCharsScanned, CToken &token)
void | ReadTagIntoBuffer ()
void | ScanTag (CToken &token)
void | ScanTagBuffer (WCHAR *awcName, WCHAR *&pwcValue, unsigned &uLenValue)
void | SkipCharsUntilNextRelevantToken (CToken &token)

Private Member Functions

void | EatBlanks ()
void | EatText ()
void | GrowTagBuffer ()
void | TagNameToToken (WCHAR *awcTagName, CToken &token)

Private Attributes

unsigned | _cTagCharsRead
CHtmlIFilter & _htmlIFilter
WCHAR * | _pwcTagBuf
CSerialStream & _serialStream
unsigned | _uLenTagBuf

Detailed Description

Definition at line 78 of file HtmlScan.Hxx.

Constructor & Destructor Documentation

CHtmlScanner::CHtmlScanner | ( | CHtmlIFilter & | htmlIFilter,
 |  | CSerialStream & | serialStream
 | ) |  |

Definition at line 54 of file HtmlScan.Cxx.

    : _htmlIFilter(htmlIFilter),
      _serialStream(serialStream),
      _uLenTagBuf(TAG_BUFFER_SIZE),
      _cTagCharsRead(0)
{
    _pwcTagBuf = newk(mtNewX, NULL) WCHAR[ TAG_BUFFER_SIZE ];
}

CHtmlScanner::~CHtmlScanner ( )

Definition at line 73 of file HtmlScan.Cxx.

{
    delete[] _pwcTagBuf;
}

Member Function Documentation

void CHtmlScanner::EatBlanks ( ) [private]

Definition at line 432 of file HtmlScan.Cxx.

{
    if ( _serialStream.Eof() )
        return;

    WCHAR wch = _serialStream.GetChar();
    while ( iswspace(wch) && !_serialStream.Eof() )
        wch = _serialStream.GetChar();

    if ( !iswspace(wch) )
        _serialStream.UnGetChar( wch );
}

void CHtmlScanner::EatTag ( )

Definition at line 389 of file HtmlScan.Cxx.

{
    if ( _serialStream.Eof() )
        return;

    WCHAR wch = _serialStream.GetChar();
    while ( wch != L'>' &&  !_serialStream.Eof() )
        wch = _serialStream.GetChar();
}

void CHtmlScanner::EatText ( ) [private]

Definition at line 409 of file HtmlScan.Cxx.

{
    if ( _serialStream.Eof() )
        return;

    WCHAR wch = _serialStream.GetChar();
    while ( wch != L'<' && !_serialStream.Eof() )
        wch = _serialStream.GetChar();

    if ( wch == L'<' )
        _serialStream.UnGetChar( wch );
}

void CHtmlScanner::GetBlockOfChars | ( | ULONG | cCharsNeeded,
 |  | WCHAR * | awcInputBuf,
 |  | ULONG & | cCharsScanned,
 |  | CToken & | token
 | ) |  |

Definition at line 95 of file HtmlScan.Cxx.

{
    cCharsScanned = 0;

    while ( cCharsNeeded > 0 )
    {
        if ( _serialStream.Eof() )
        {
            token.SetTokenType( EofToken );
            return;
        }

        WCHAR wch = _serialStream.GetChar();
        if ( wch == L'<' )
        {
            //
            // Html tag encountered
            //
            ScanTag( token );
            return;
        }
        else
        {
            //
            // &lt; and &gt; were mapped to Unicode chars from private use area
            // to avoid collision with '<' and '>' chars in Html tags. Map them
            // back to '<' and '>'.
            //
            if ( wch == PRIVATE_USE_MAPPING_FOR_LT )
                wch = L'<';
            else if ( wch == PRIVATE_USE_MAPPING_FOR_GT )
                wch = L'>';

            awcBuffer[cCharsScanned++] = wch;
            cCharsNeeded--;
        }
    }
}

void CHtmlScanner::GrowTagBuffer ( ) [private]

Definition at line 671 of file HtmlScan.Cxx.

{
    WCHAR *pwcNewTagBuf = newk(mtNewX, NULL) WCHAR[2 * _uLenTagBuf];
    RtlCopyMemory( pwcNewTagBuf,
                   _pwcTagBuf,
                   _uLenTagBuf * sizeof(WCHAR) );

    delete[] _pwcTagBuf;
    _uLenTagBuf *= 2;
    _pwcTagBuf = pwcNewTagBuf;
}

void CHtmlScanner::ReadTagIntoBuffer ( )

Definition at line 291 of file HtmlScan.Cxx.

{
    _cTagCharsRead = 0;

    if ( _serialStream.Eof() )
        return;

    WCHAR wch = _serialStream.GetChar();
    while ( wch != L'>' )
    {
        if ( _cTagCharsRead >= _uLenTagBuf )
            GrowTagBuffer();
        Win4Assert( _cTagCharsRead < _uLenTagBuf );

        _pwcTagBuf[_cTagCharsRead++] = wch;

        if ( _serialStream.Eof() )
            return;
        wch = _serialStream.GetChar();
    }
}

void CHtmlScanner::ScanTag ( CToken & token )

Definition at line 214 of file HtmlScan.Cxx.

{

    EatBlanks();

    if ( _serialStream.Eof() )
    {
        token.SetTokenType( EofToken );
        return;
    }
    WCHAR wch = _serialStream.GetChar();

    token.SetStartTokenFlag( TRUE );
    if ( wch == L'/' )
    {
        //
        // This is an end tag
        //
        token.SetStartTokenFlag( FALSE );
        EatBlanks();

        if ( _serialStream.Eof() )
        {
            token.SetTokenType( EofToken );
            return;
        }
        wch = _serialStream.GetChar();
    }

    WCHAR awcTagName[MAX_TAG_LENGTH+1];
    unsigned uLenTag = 0;

    //
    // Scan the tag name into szTagName. We scan MAX_TAG_LENGTH
    // characters only, because anything longer is most probably
    // a bogus tag.
    //
    while ( !iswspace(wch)
            && wch != L'>'
            && uLenTag < MAX_TAG_LENGTH )
    {
        awcTagName[uLenTag++] = wch;

        if ( _serialStream.Eof() )
            break;
        wch = _serialStream.GetChar();
    }
    awcTagName[uLenTag] = 0;

    if ( _serialStream.Eof() )
    {
        token.SetTokenType( EofToken );
        return;
    }
    else if ( wch == L'>' || uLenTag == MAX_TAG_LENGTH )
    {
        //
        // Push char back into input stream because a subsequent GetChar()
        // will be expecting to see the char in the input
        //
        _serialStream.UnGetChar( wch );
    }

    TagNameToToken( awcTagName, token );
}

void CHtmlScanner::ScanTagBuffer | ( | WCHAR * | awcName,
 |  | WCHAR *& | pwcValue,
 |  | unsigned & | uLenValue
 | ) |  |

Definition at line 329 of file HtmlScan.Cxx.

{
    unsigned uLenName = (unsigned) wcslen( awcName );

    if ( _cTagCharsRead <= uLenName )
    {
        //
        // Pattern to match is longer than scanned tag
        //
        pwcValue = 0;
        uLenValue = 0;

        return;
    }

    for ( unsigned i=0; i<_cTagCharsRead-uLenName; i++ )
    {
        BOOL fMatch = TRUE;
        for ( unsigned j=0; j<uLenName; j++ )
        {
            //
            // Case insensitive match
            //
            if ( towlower(awcName[j]) != towlower(_pwcTagBuf[i+j]) )
            {
                fMatch = FALSE;
                break;
            }
        }

        if ( fMatch )
        {
            unsigned k = i + uLenName;
            while ( _pwcTagBuf[k] != L'"' && k < _cTagCharsRead )
                k++;

            uLenValue = k - (i + uLenName);
            pwcValue = &_pwcTagBuf[i+uLenName];

            return;
        }
    }

    uLenValue = 0;
    pwcValue = 0;
}

void CHtmlScanner::SkipCharsUntilNextRelevantToken ( CToken & token )

Definition at line 155 of file HtmlScan.Cxx.

{
    //
    // Loop until we find a stop token or end of file
    //
    for (;;)
    {
        if ( _serialStream.Eof() )
        {
            token.SetTokenType( EofToken );
            return;
        }

        WCHAR wch = _serialStream.GetChar();
        if ( wch == L'<' )
        {
            ScanTag( token );

            if ( token.GetTokenType() == EofToken
                 || _htmlIFilter.IsStopToken( token ) )
            {
                return;
            }
            else
            {
                //
                // Uninteresting tag, hence skip tag
                //
                EatTag();
            }
        }
        else
        {
            //
            // Vanilla text
            //
            if ( _htmlIFilter.FFilterContent() )
            {
                _serialStream.UnGetChar( wch );
                token.SetTokenType( TextToken );
                return;
            }
            else
                EatText();
        }
    }
}

void CHtmlScanner::TagNameToToken | ( | WCHAR * | awcTagName,
 |  | CToken & | token |
 | ) |  |  | [private]

Definition at line 459 of file HtmlScan.Cxx.

{
    //
    // The number of interesting Html tags will be small, hence no need for
    // a table lookup
    //
    switch( awcTagName[0] )
    {
    case L'a':
    case L'A':
        if ( _wcsicmp( awcTagName, L"a" ) == 0 )
        {
            token.SetTokenType( AnchorToken );
            token.SetPropset( CLSID_HtmlInformation );
            token.SetPropid( PID_HREF );
        }
        else if ( _wcsicmp( awcTagName, L"address" ) == 0 )
            token.SetTokenType( BreakToken );
        else
            token.SetTokenType( GenericToken );

        break;

    case L'b':
    case L'B':
        if ( _wcsicmp( awcTagName, L"br" ) == 0
             || _wcsicmp( awcTagName, L"blockquote" ) == 0 )
        {
            token.SetTokenType( BreakToken );
        }
        else
            token.SetTokenType( GenericToken );

        break;

    case L'd':
    case L'D':
        if ( _wcsicmp( awcTagName, L"dd" ) == 0
             || _wcsicmp( awcTagName, L"dl" ) == 0
             || _wcsicmp( awcTagName, L"dt" ) == 0 )
        {
            token.SetTokenType( BreakToken );
        }
        else
            token.SetTokenType( GenericToken );

        break;

    case L'f':
    case L'F':
        if ( _wcsicmp( awcTagName, L"form" ) == 0 )
            token.SetTokenType( BreakToken );
        else
            token.SetTokenType( GenericToken );

        break;

    case L'h':
    case L'H':
        if ( _wcsicmp( awcTagName, L"h1" ) == 0 )
        {
            token.SetTokenType( Heading1Token );
            token.SetPropset( CLSID_HtmlInformation );
            token.SetPropid( PID_HEADING_1 );
        }
        else if ( _wcsicmp( awcTagName, L"h2" ) == 0 )
        {
            token.SetTokenType( Heading2Token );
            token.SetPropset( CLSID_HtmlInformation );
            token.SetPropid( PID_HEADING_2 );
        }
        else if ( _wcsicmp( awcTagName, L"h3" ) == 0 )
        {
            token.SetTokenType( Heading3Token );
            token.SetPropset( CLSID_HtmlInformation );
            token.SetPropid( PID_HEADING_3 );
        }
        else if ( _wcsicmp( awcTagName, L"h4" ) == 0 )
        {
            token.SetTokenType( Heading4Token );
            token.SetPropset( CLSID_HtmlInformation );
            token.SetPropid( PID_HEADING_4 );
        }
        else if ( _wcsicmp( awcTagName, L"h5" ) == 0 )
        {
            token.SetTokenType( Heading5Token );
            token.SetPropset( CLSID_HtmlInformation );
            token.SetPropid( PID_HEADING_5 );
        }
        else if ( _wcsicmp( awcTagName, L"h6" ) == 0 )
        {
            token.SetTokenType( Heading6Token );
            token.SetPropset( CLSID_HtmlInformation );
            token.SetPropid( PID_HEADING_6 );
        }
        else
            token.SetTokenType( GenericToken );

        break;

    case L'i':
    case L'I':
        if ( _wcsicmp( awcTagName, L"input" ) == 0 )
            token.SetTokenType( InputToken );
        else if ( _wcsicmp( awcTagName, L"img" ) == 0 )
            token.SetTokenType( ImageToken );
        else
            token.SetTokenType( GenericToken );

        break;

    case L'l':
    case L'L':
        if ( _wcsicmp( awcTagName, L"li" ) == 0 )
            token.SetTokenType( BreakToken );
        else
            token.SetTokenType( GenericToken );

        break;

    case L'm':
    case L'M':
        if ( _wcsicmp( awcTagName, L"math" ) == 0 )
            token.SetTokenType( BreakToken );
        else if (  _wcsicmp( awcTagName, L"meta" ) == 0 )
            token.SetTokenType( MetaToken );
        else
            token.SetTokenType( GenericToken );

        break;

    case L'o':
    case L'O':
        if ( _wcsicmp( awcTagName, L"ol" ) == 0 )
            token.SetTokenType( BreakToken );
        else
            token.SetTokenType( GenericToken );

        break;

    case L'p':
    case L'P':
        if ( _wcsicmp( awcTagName, L"p" ) == 0 )
            token.SetTokenType( BreakToken );
        else
            token.SetTokenType( GenericToken );

        break;

    case L's':
    case L'S':
        if ( _wcsicmp( awcTagName, L"script" ) == 0 )
            token.SetTokenType( ScriptToken );
        else
            token.SetTokenType( GenericToken );

        break;

    case L't':
    case L'T':
        if ( _wcsicmp( awcTagName, L"title" ) == 0 )
        {
            token.SetTokenType( TitleToken );
            token.SetPropset( CLSID_SummaryInformation );
            token.SetPropid( PID_TITLE );
        }
        else if ( _wcsicmp( awcTagName, L"table" ) == 0
                  || _wcsicmp( awcTagName, L"th" ) == 0
                  || _wcsicmp( awcTagName, L"tr" ) == 0
                  || _wcsicmp( awcTagName, L"td" ) == 0 )
            token.SetTokenType( BreakToken );
        else
            token.SetTokenType( GenericToken );

        break;

    case L'u':
    case L'U':
        if ( _wcsicmp( awcTagName, L"ul" ) == 0 )
            token.SetTokenType( BreakToken );
        else
            token.SetTokenType( GenericToken );

        break;

    case L'!':
        if  ( _wcsicmp( awcTagName, L"!--" ) == 0 )
            token.SetTokenType( CommentToken );
        else
            token.SetTokenType( GenericToken );

        break;

    default:
        //
        // It's an uninteresting tag
        //
        token.SetTokenType( GenericToken );
    }
}

Member Data Documentation

unsigned CHtmlScanner::_cTagCharsRead [private]

Definition at line 108 of file HtmlScan.Hxx.

CHtmlIFilter& CHtmlScanner::_htmlIFilter [private]

Definition at line 104 of file HtmlScan.Hxx.

WCHAR* CHtmlScanner::_pwcTagBuf [private]

Definition at line 106 of file HtmlScan.Hxx.

CSerialStream& CHtmlScanner::_serialStream [private]

Definition at line 105 of file HtmlScan.Hxx.

unsigned CHtmlScanner::_uLenTagBuf [private]

Definition at line 107 of file HtmlScan.Hxx.

The documentation for this class was generated from the following files:
  • WinBase/Indexing/IFilter/HtmlScan.Hxx
  • WinBase/Indexing/IFilter/HtmlScan.Cxx
Generated on Wed Nov 13 2024 16:56:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CHuman Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CHuman Class Reference

#include "Human.h"

List of all members.

Public Member Functions

CHuman ()
STDMETHODIMP | EnterNewGame (IN BSTR bstrLocalName, OUT VARIANT *pvGameID, OUT VARIANT *pvName, OUT VARIANT *pvOrder)
STDMETHODIMP | GetNewMove (IN long lGameID, IN long lOrder, OUT VARIANT *pvName, OUT VARIANT *pvFoeX, OUT VARIANT *pvFoeY, OUT VARIANT *pvWin, OUT VARIANT *pvUpdate)
STDMETHODIMP | NewMove (IN long lGameID, IN long lOrder, IN long lX, IN long lY, OUT VARIANT *pvWin)

Private Member Functions

long | HowManyTurns ()
void | InitArray ()
STDMETHOD() | InterfaceSupportsErrorInfo (REFIID riid)
bool | IsWin (long lPlayer)
HRESULT | LoadArray (long lGameID)
HRESULT | SaveArray (long lGameID)

Private Attributes

long | plField [3][3]

Detailed Description

Definition at line 27 of file Human.h.

Constructor & Destructor Documentation

CHuman::CHuman ( ) [inline]

Definition at line 34 of file Human.h.

{}

Member Function Documentation

STDMETHODIMP CHuman::EnterNewGame | ( | IN BSTR | bstrLocalName,
 |  | OUT VARIANT * | pvGameID,
 |  | OUT VARIANT * | pvName,
 |  | OUT VARIANT * | pvOrder
 | ) |  |

Definition at line 41 of file Human.Cpp.

                                         {

  HRESULT hr = S_OK;

  IObjectContext* pObjectContext = NULL;

  ISharedPropertyGroupManager* spmMgr = NULL;
  ISharedPropertyGroup* spmGroup = NULL;

  ISharedProperty* spmPropCounter = NULL;
  ISharedProperty* spmPropFirstName = NULL;
  ISharedProperty* spmPropSecondName = NULL;
  ISharedProperty* spmPropState = NULL;

  pvGameID->vt = VT_I4;
  pvName->vt = VT_BSTR;
  pvOrder->vt = VT_I4;

  long lGameID = 0;
  long lOrder = 0;

  try {

    // Get the object context
    THROW_ERR ( hr = GetObjectContext (&pObjectContext) );
    if (pObjectContext == NULL) {
      THROW_ERR ( E_FAIL );
    }

    // Create the SharedPropertyGroupManager
    THROW_ERR ( pObjectContext->CreateInstance (CLSID_SharedPropertyGroupManager, IID_ISharedPropertyGroupManager, (void**)&spmMgr) );

    // Create the SharedPropertyGroup
    LONG lIsolationMode = LockMethod;
    LONG lReleaseMode = Process;
    VARIANT_BOOL bExists = VARIANT_FALSE;
    THROW_ERR ( spmMgr->CreatePropertyGroup (L"TicTacToe", &lIsolationMode, &lReleaseMode, &bExists, &spmGroup) );

    // Create SharedProperties
    CComVariant vCounter;

    THROW_ERR ( spmGroup->CreateProperty (L"Counter", &bExists, &spmPropCounter) );
    THROW_ERR ( spmPropCounter->get_Value (&vCounter) );

    CComVariant vSecondName;
    CComVariant vState;

    TCHAR szBuf [512];
    BSTR bstrSecondName;
    BSTR bstrFirstName;
    BSTR bstrState;

    // Find first open two-human game
    if (vCounter.lVal == 0) {
      vCounter.lVal = 1;
    } else {
      long lScan = 1;
      bool bFlag = false;
      while (lScan < vCounter.lVal && !bFlag) {

        wsprintf (szBuf, _T("%dState"), lScan);
        bstrState = TCHAR2BSTR (szBuf);
        THROW_ERR ( spmGroup->CreateProperty (bstrState, &bExists, &spmPropState) );
        ::SysFreeString (bstrState);

        THROW_ERR ( spmPropState->get_Value (&vState) );

        if (vState.lVal < 2) {

          // Found a game
          bFlag = true;
        } else
          lScan ++;

        THROW_ERR ( spmPropState->Release() );
      }

      vCounter.lVal = lGameID = lScan;
    }

    wsprintf (szBuf, _T("%dSecondName"), vCounter.lVal);
    bstrSecondName = TCHAR2BSTR (szBuf);
    wsprintf (szBuf, _T("%dState"), vCounter.lVal);
    bstrState = TCHAR2BSTR (szBuf);
    wsprintf (szBuf, _T("%dFirstName"), vCounter.lVal);
    bstrFirstName = TCHAR2BSTR (szBuf);

    THROW_ERR ( spmGroup->CreateProperty (bstrFirstName, &bExists, &spmPropFirstName) );
    THROW_ERR ( spmGroup->CreateProperty (bstrSecondName, &bExists, &spmPropSecondName) );
    THROW_ERR ( spmGroup->CreateProperty (bstrState, &bExists, &spmPropState) );

    ::SysFreeString (bstrFirstName);
    ::SysFreeString (bstrSecondName);
    ::SysFreeString (bstrState);

    // Get current state
    THROW_ERR ( spmPropState->get_Value (&vState) );

    // State table
    // ===========
    // 0 - No one in game
    // 1 - One player lurking
    // 2 - Second player joined
    // 3 - First player's turn
    // 4 - Second player's turn

    // Is this the first time this property has been accessed?
    if (!bExists)
      vState.lVal = 0;

    // Is there someone lurking already?
    if (vState.lVal == 1) {

      CComVariant vFirstName;

      // Get opponent's name
      THROW_ERR ( spmPropFirstName->get_Value (&vFirstName) );

      // Submit own name
      CComVariant vSecondName2;
      vSecondName2.vt = VT_BSTR;

      vSecondName2.bstrVal = ::SysAllocString (bstrLocalName);
      THROW_ERR ( spmPropSecondName->put_Value (vSecondName2) );
      ::SysFreeString (vSecondName2.bstrVal);

      // Update state
      vState.lVal = 2;
      THROW_ERR ( spmPropState->put_Value (vState) );

      // Assign gameID
      lGameID = vCounter.lVal;

      // Initialize the game screen array
      InitArray();
      THROW_ERR ( SaveArray(lGameID) );

      // Prepare return values
      pvName->bstrVal = ::SysAllocString (vFirstName.bstrVal);
      pvOrder->lVal = 2;
      pvGameID->lVal = lGameID;

    } else {

      CComVariant vFirstName;
      vFirstName.vt = VT_BSTR;

      // Update first name
      vFirstName.bstrVal = ::SysAllocString (bstrLocalName);
      THROW_ERR ( spmPropFirstName->put_Value (vFirstName) );
      ::SysFreeString (vFirstName.bstrVal);

      // Update counter for next game
      vCounter.lVal = vCounter.lVal + 1;
      THROW_ERR ( spmPropCounter->put_Value (vCounter) );

      // Update state
      vState.lVal = 1;
      THROW_ERR ( spmPropState->put_Value (vState) );

      // Assign gameID
      lGameID = vCounter.lVal - 1;

      // Prepare return values
      pvName->bstrVal = ::SysAllocString (L"No one");
      pvOrder->lVal = 1;
      pvGameID->lVal = lGameID;
    }

    // We're finished and happy
    pObjectContext->SetComplete();

  } catch (HRESULT hr) {

    // Create an ErrorInfo object
    ICreateErrorInfo* pCreateErrInfo = NULL;
    IErrorInfo* pErrInfo = NULL;

    CreateErrorInfo (&pCreateErrInfo);
    pCreateErrInfo->QueryInterface (IID_IErrorInfo, (LPVOID FAR*) &pErrInfo);

    // Fill in error information
    TCHAR szErr [512];
    wsprintf (szErr, _T("Error %d occurred in Human::EnterNewGame()"), hr);
    BSTR bstrDesc = TCHAR2BSTR (szErr);

    pCreateErrInfo->SetGUID (IID_IComputer);
    pCreateErrInfo->SetSource (L"Computer");
    pCreateErrInfo->SetDescription (bstrDesc);
    ::SysFreeString (bstrDesc);

    // Confirm error information
    SetErrorInfo (0, pErrInfo);

    // Clean up the error objects
    if (pCreateErrInfo)
      pCreateErrInfo->Release();

    if (pErrInfo)
      pErrInfo->Release();

    // Indicate our unhappiness
    if (pObjectContext)
      pObjectContext->SetAbort();

    hr = E_FAIL;
  }

  if (pObjectContext)
    pObjectContext->Release();

  if (spmMgr)
    spmMgr->Release();

  if (spmGroup)
    spmGroup->Release();

  if (spmPropCounter)
    spmPropCounter->Release();

  if (spmPropFirstName)
    spmPropFirstName->Release();

  if (spmPropSecondName)
    spmPropSecondName->Release();

  if (spmPropState)
    spmPropState->Release();

  return hr;
}

STDMETHODIMP CHuman::GetNewMove | ( | IN long | lGameID,
 |  | IN long | lOrder,
 |  | OUT VARIANT * | pvName,
 |  | OUT VARIANT * | pvFoeX,
 |  | OUT VARIANT * | pvFoeY,
 |  | OUT VARIANT * | pvWin,
 |  | OUT VARIANT * | pvUpdate
 | ) |  |

Definition at line 465 of file Human.Cpp.

                                        {

  // Win protocol
  // ============
  // 0  -> move did not end game
  // 1  -> player won (won't occur in this function)
  // -1 -> remote player won
  // 2  -> player's move tied the game (won't occur in this function)
  // -2 -> remote player's move tied the game

  HRESULT hr = S_OK;

  IObjectContext* pObjectContext = NULL;

  ISharedPropertyGroupManager* spmMgr = NULL;
  ISharedPropertyGroup* spmGroup = NULL;
  ISharedProperty* spmPropState = NULL;
  ISharedProperty* spmPropX = NULL;
  ISharedProperty* spmPropY = NULL;
  ISharedProperty* spmPropWin = NULL;
  ISharedProperty* spmPropSecondName = NULL;

  pvName->vt = VT_BSTR;
  pvFoeX->vt = VT_I4;
  pvFoeY->vt = VT_I4;
  pvWin->vt = VT_I4;
  pvUpdate->vt = VT_I4;

  long lWin = 0;
  long lUpdate = 0;
  long lX = 0;
  long lY = 0;

  try {

    // Get the object context
    THROW_ERR ( hr = GetObjectContext(&pObjectContext) );
    if (pObjectContext == NULL) {
      THROW_ERR ( E_FAIL );
    }

    // Create the SharedPropertyGroupManager
    THROW_ERR ( pObjectContext->CreateInstance (CLSID_SharedPropertyGroupManager,
      IID_ISharedPropertyGroupManager, (void**)&spmMgr) );

    // Create the SharedPropertyGroup
    LONG lIsolationMode = LockMethod;
    LONG lReleaseMode = Process;
    VARIANT_BOOL bExists = VARIANT_FALSE;
    THROW_ERR ( spmMgr->CreatePropertyGroup (L"TicTacToe", &lIsolationMode, &lReleaseMode,
      &bExists, &spmGroup) );

    // Create SharedProperties
    BSTR bstrState;
    BSTR bstrX;
    BSTR bstrY;
    BSTR bstrWin;
    BSTR bstrSecondName;
    TCHAR szBuf[512];
    wsprintf (szBuf, _T("%dState"), lGameID);
    bstrState = TCHAR2BSTR (szBuf);
    wsprintf (szBuf, _T("%dX"), lGameID);
    bstrX = TCHAR2BSTR (szBuf);
    wsprintf (szBuf, _T("%dY"), lGameID);
    bstrY = TCHAR2BSTR (szBuf);
    wsprintf (szBuf, _T("%dWin"), lGameID);
    bstrWin = TCHAR2BSTR (szBuf);
    wsprintf (szBuf, _T("%dSecondName"), lGameID);
    bstrSecondName = TCHAR2BSTR (szBuf);

    THROW_ERR ( spmGroup->CreateProperty (bstrState, &bExists, &spmPropState) );
    THROW_ERR ( spmGroup->CreateProperty (bstrX, &bExists, &spmPropX) );
    THROW_ERR ( spmGroup->CreateProperty (bstrY, &bExists, &spmPropY) );
    THROW_ERR ( spmGroup->CreateProperty (bstrWin, &bExists, &spmPropWin) );
    THROW_ERR ( spmGroup->CreateProperty (bstrSecondName, &bExists, &spmPropSecondName) );

    ::SysFreeString (bstrState);
    ::SysFreeString (bstrX);
    ::SysFreeString (bstrY);
    ::SysFreeString (bstrWin);
    ::SysFreeString (bstrSecondName);

    // Get state and move parameters
    CComVariant vState;
    CComVariant vX;
    CComVariant vY;
    CComVariant vWin;
    CComVariant vSecondName;
    THROW_ERR ( spmPropState->get_Value (&vState) );
    THROW_ERR ( spmPropX->get_Value (&vX) );
    THROW_ERR ( spmPropY->get_Value (&vY) );
    THROW_ERR ( spmPropWin->get_Value (&vWin) );
    THROW_ERR ( spmPropSecondName->get_Value (&vSecondName) );

    switch (vState.lVal) {

    case (0):

      // Shouldn't happen
      THROW_ERR ( E_FAIL);
      break;

    case (1):

      // Still waiting for next player to join
      lUpdate = 0;
      break;

    case (2):

      // Other player just joined
      if (lOrder == 1) {
        lUpdate = 2;
        pvName->bstrVal = ::SysAllocString (vSecondName.bstrVal);

        // It's now the first player's turn
        vState.lVal = 3;
        THROW_ERR ( spmPropState->put_Value (vState) );
      }

      break;

    case (3):
    case (4):

      long lTemp;
      if (vState.lVal == 3)
        lTemp = 1;
      else
        lTemp = 2;

      // Has other player moved?
      if (lOrder == lTemp) {

        // Other player has moved
        lX = vX.lVal;
        lY = vY.lVal;
        lWin = vWin.lVal;
        lUpdate = 1;

      } else {

        // Waiting for other player to move
        lUpdate = 0;
      }

      break;

    default:

      // Shouldn't happen
      THROW_ERR ( E_FAIL );
      break;
    }

    // Prepare return values
    pvFoeX->lVal = lX;
    pvFoeY->lVal = lY;
    pvWin->lVal = lWin;
    pvUpdate->lVal = lUpdate;

    // We are finished and happy
    pObjectContext->SetComplete();

  } catch (HRESULT hr) {

    // Create an ErrorInfo object
    ICreateErrorInfo* pCreateErrInfo = NULL;
    IErrorInfo* pErrInfo = NULL;

    CreateErrorInfo (&pCreateErrInfo);
    pCreateErrInfo->QueryInterface (IID_IErrorInfo, (LPVOID FAR*) &pErrInfo);

    // Fill in error information
    TCHAR szErr [512];
    wsprintf (szErr, _T("Error %d occurred in Human::GetNewMove()"), hr);
    BSTR bstrDesc = TCHAR2BSTR (szErr);
    pCreateErrInfo->SetGUID (IID_IComputer);
    pCreateErrInfo->SetSource (L"Computer");
    pCreateErrInfo->SetDescription (bstrDesc);
    ::SysFreeString (bstrDesc);

    // Confirm error information
    SetErrorInfo (0, pErrInfo);

    // Clean up the error objects
    if (pCreateErrInfo)
      pCreateErrInfo->Release();

    if (pErrInfo)
      pErrInfo->Release();

    // Indicate our unhappiness
    if (pObjectContext)
      pObjectContext->SetAbort();

    hr = E_FAIL;
  }

  if (pObjectContext)
    pObjectContext->Release();

  if (spmMgr)
    spmMgr->Release();

  if (spmGroup)
    spmGroup->Release();

  if (spmPropState)
    spmPropState->Release();

  if (spmPropX)
    spmPropX->Release();

  if (spmPropY)
    spmPropY->Release();

  if (spmPropWin)
    spmPropWin->Release();

  if (spmPropSecondName)
    spmPropSecondName->Release();

  return hr;
}

long CHuman::HowManyTurns ( ) [private]

Definition at line 715 of file Human.Cpp.

                           {

  long lTurns = 0;

  for (int i = 0; i < 3; i ++) {
    for (int j = 0; j < 3; j ++) {
      if (plField[i][j] > 0) {
        lTurns ++;
      }
    }
  }

  return lTurns;
}

void CHuman::InitArray ( ) [inline, private]

Definition at line 39 of file Human.h.

                                 {
    for (int i = 0; i < 3; i ++)
      for (int j = 0; j < 3; j ++)
        plField[i][j] = 0;
  }

STDMETHODIMP CHuman::InterfaceSupportsErrorInfo ( REFIID riid ) [private]

Definition at line 25 of file Human.Cpp.

{
  static const IID* arr[] =
  {
    &IID_IHuman,
  };

  for (int i=0;i<sizeof(arr)/sizeof(arr[0]);i++)
  {
    if (::InlineIsEqualGUID(*arr[i],riid))
      return S_OK;
  }
  return S_FALSE;
}

bool CHuman::IsWin ( long lPlayer ) [private]

Definition at line 695 of file Human.Cpp.

                                {

  bool bWin = false;

  for (int i = 0; i < 3; i ++) {
    if (plField [i][0] == plField [i][1] && plField [i][1] == plField [i][2] && plField [i][0] == lPlayer)
      bWin = true;
    if (plField [0][i] == plField [1][i] && plField [1][i] == plField [2][i] && plField [0][i] == lPlayer)
      bWin = true;
  }

  if (plField [0][0] == plField [1][1] && plField [1][1] == plField [2][2] && plField [1][1] == lPlayer)
    bWin = true;
  if (plField [2][0] == plField [1][1] && plField [1][1] == plField [0][2] && plField [1][1] == lPlayer)
    bWin = true;

  return bWin;
}

HRESULT CHuman::LoadArray ( long lGameID ) [private]

Definition at line 731 of file Human.Cpp.

                                       {

  HRESULT hr = S_OK;

  IObjectContext* pObjectContext = NULL;

  ISharedPropertyGroupManager* spmMgr = NULL;
  ISharedPropertyGroup* spmGroup = NULL;
  ISharedProperty* spmPropField[3][3];

  // Get context
  hr = GetObjectContext(&pObjectContext);

  // Create the SharedPropertyGroupManager
  hr = pObjectContext->CreateInstance (CLSID_SharedPropertyGroupManager, IID_ISharedPropertyGroupManager, (void**)&spmMgr);

  // Create the SharedPropertyGroup
  LONG lIsolationMode = LockMethod;
  LONG lReleaseMode = Process;
  VARIANT_BOOL bExists = VARIANT_FALSE;
  hr = spmMgr->CreatePropertyGroup (L"TicTacToe", &lIsolationMode, &lReleaseMode, &bExists, &spmGroup);

  // Load the field SharedProperties
  TCHAR szBuf [512];
  BSTR bstrField;
  CComVariant vField;

  for (long i = 0; i < 3; i ++ ) {
    for (long j = 0; j < 3; j ++) {

      wsprintf (szBuf, _T("%dField%d%d"), lGameID, i, j);
      bstrField = TCHAR2BSTR (szBuf);
      hr = spmGroup->CreateProperty (bstrField, &bExists, &spmPropField[i][j]);
      ::SysFreeString (bstrField);

      hr = spmPropField[i][j]->get_Value (&vField);
      plField[i][j] = vField.lVal;
    }
  }

  if (pObjectContext)
    pObjectContext->Release();

  if (spmMgr)
    spmMgr->Release();

  if (spmGroup)
    spmGroup->Release();

  for (i = 0; i < 3; i ++) {
    for (long j = 0; j < 3; j ++) {
      if (spmPropField[i][j]) {
        spmPropField[i][j]->Release();
      }
    }
  }

  return hr;
}

STDMETHODIMP CHuman::NewMove | ( | IN long | lGameID,
 |  | IN long | lOrder,
 |  | IN long | lX,
 |  | IN long | lY,
 |  | OUT VARIANT * | pvWin
 | ) |  |

Definition at line 275 of file Human.Cpp.

                                                                                {

  // Win protocol
  // ============
  // 0  -> move did not end game
  // 1  -> player won
  // -1 -> remote player won (won't occur in this function)
  // 2  -> player's move tied the game
  // -2 -> remote player's move tied the game (won't occur in this function)

  HRESULT hr = S_OK;

  IObjectContext* pObjectContext = NULL;

  ISharedPropertyGroupManager* spmMgr = NULL;
  ISharedPropertyGroup* spmGroup = NULL;

  ISharedProperty* spmPropState = NULL;
  ISharedProperty* spmPropX = NULL;
  ISharedProperty* spmPropY = NULL;
  ISharedProperty* spmPropWin = NULL;

  pvWin->vt = VT_I4;

  long lWin = 0;

  try {

    // Get the object context
    THROW_ERR ( hr = GetObjectContext(&pObjectContext) );
    if (pObjectContext == NULL) {
      THROW_ERR ( E_FAIL );
    }

    // Create the SharedPropertyGroupManager
    THROW_ERR ( pObjectContext->CreateInstance (CLSID_SharedPropertyGroupManager,
      IID_ISharedPropertyGroupManager, (void**)&spmMgr) );

    // Create the SharedPropertyGroup
    LONG lIsolationMode = LockMethod;
    LONG lReleaseMode = Process;
    VARIANT_BOOL bExists = VARIANT_FALSE;
    THROW_ERR ( spmMgr->CreatePropertyGroup (L"TicTacToe", &lIsolationMode, &lReleaseMode,
      &bExists, &spmGroup) );

    // Create SharedProperties
    BSTR bstrState;
    BSTR bstrX;
    BSTR bstrY;
    BSTR bstrWin;
    TCHAR szBuf[512];
    wsprintf (szBuf, _T("%dState"), lGameID);
    bstrState = TCHAR2BSTR (szBuf);
    wsprintf (szBuf, _T("%dX"), lGameID);
    bstrX = TCHAR2BSTR (szBuf);
    wsprintf (szBuf, _T("%dY"), lGameID);
    bstrY = TCHAR2BSTR (szBuf);
    wsprintf (szBuf, _T("%dWin"), lGameID);
    bstrWin = TCHAR2BSTR (szBuf);

    THROW_ERR ( spmGroup->CreateProperty (bstrState, &bExists, &spmPropState) );
    THROW_ERR ( spmGroup->CreateProperty (bstrX, &bExists, &spmPropX) );
    THROW_ERR ( spmGroup->CreateProperty (bstrY, &bExists, &spmPropY) );
    THROW_ERR ( spmGroup->CreateProperty (bstrWin, &bExists, &spmPropWin) );

    ::SysFreeString (bstrState);
    ::SysFreeString (bstrX);
    ::SysFreeString (bstrY);
    ::SysFreeString (bstrWin);

    CComVariant vState;
    CComVariant vX;
    CComVariant vY;
    CComVariant vWin;
    vState.vt = VT_I4;
    vX.vt = VT_I4;
    vY.vt = VT_I4;
    vWin.vt = VT_I4;

    // Load screen data
    THROW_ERR ( LoadArray(lGameID) );

    // Save player's move to local storage and to Spam
    plField[lX][lY] = lOrder;

    vX.lVal = lX;
    vY.lVal = lY;
    THROW_ERR ( spmPropX->put_Value (vX) );
    THROW_ERR ( spmPropY->put_Value (vY) );

    // Submit new state
    if (lOrder == 1)
      vState.lVal = 4;
    else
      vState.lVal = 3;

    THROW_ERR ( spmPropState->put_Value (vState) );

    // Commit move to global storage
    THROW_ERR ( SaveArray (lGameID) );

    // Check for win
    if (IsWin (lOrder)) {

      // Player wins
      lWin = 1;

      // Other player loses
      vWin.lVal = - 1;
      THROW_ERR ( spmPropWin->put_Value (vWin) );
    }

    else if (HowManyTurns() == 9) {

      // Player ties on his move
      lWin = 2;

      // Other player ties on opponent's move
      vWin.lVal = - 2;
      THROW_ERR ( spmPropWin->put_Value (vWin) );
    }

    // Prepare return values
    pvWin->lVal = lWin;

    // We're happy and finished
    pObjectContext->SetComplete();

  } catch (HRESULT hr) {

    // Create an ErrorInfo object
    ICreateErrorInfo* pCreateErrInfo = NULL;
    IErrorInfo* pErrInfo = NULL;

    CreateErrorInfo (&pCreateErrInfo);
    pCreateErrInfo->QueryInterface (IID_IErrorInfo, (LPVOID FAR*) &pErrInfo);

    // Fill in error information
    TCHAR szErr [512];
    wsprintf (szErr, _T("Error %d occurred in Human::NewMove()"), hr);
    BSTR bstrDesc = TCHAR2BSTR (szErr);
    pCreateErrInfo->SetGUID (IID_IComputer);
    pCreateErrInfo->SetSource (L"Computer");
    pCreateErrInfo->SetDescription (bstrDesc);
    ::SysFreeString (bstrDesc);

    // Confirm error information
    SetErrorInfo (0, pErrInfo);

    // Clean up the error objects
    if (pCreateErrInfo)
      pCreateErrInfo->Release();

    if (pErrInfo)
      pErrInfo->Release();

    // Indicate our unhappiness
    if (pObjectContext)
      pObjectContext->SetAbort();

    hr = E_FAIL;
  }

  if (pObjectContext)
    pObjectContext->Release();

  if (spmMgr)
    spmMgr->Release();

  if (spmGroup)
    spmGroup->Release();

  if (spmPropState)
    spmPropState->Release();

  if (spmPropX)
    spmPropX->Release();

  if (spmPropY)
    spmPropY->Release();

  if (spmPropWin)
    spmPropWin->Release();

  return hr;

}

HRESULT CHuman::SaveArray ( long lGameID ) [private]

Definition at line 792 of file Human.Cpp.

                                       {

  HRESULT hr = S_OK;

  IObjectContext* pObjectContext = NULL;

  ISharedPropertyGroupManager* spmMgr = NULL;
  ISharedPropertyGroup* spmGroup = NULL;
  ISharedProperty* spmPropField[3][3];

  // Get context
  hr = GetObjectContext(&pObjectContext);

  // Create the SharedPropertyGroupManager
  hr = pObjectContext->CreateInstance (CLSID_SharedPropertyGroupManager, IID_ISharedPropertyGroupManager, (void**)&spmMgr);

  // Create the SharedPropertyGroup
  LONG lIsolationMode = LockMethod;
  LONG lReleaseMode = Process;
  VARIANT_BOOL bExists = VARIANT_FALSE;
  hr = spmMgr->CreatePropertyGroup (L"TicTacToe", &lIsolationMode, &lReleaseMode, &bExists, &spmGroup);

  // Save the field shared properties
  TCHAR szBuf [512];
  BSTR bstrField;
  CComVariant vField;
  vField.vt = VT_I4;

  for (long i = 0; i < 3; i ++ ) {
    for (long j = 0; j < 3; j ++) {

      wsprintf (szBuf, _T("%dField%d%d"), lGameID, i, j);
      bstrField = TCHAR2BSTR (szBuf);
      hr = spmGroup->CreateProperty (bstrField, &bExists, &spmPropField[i][j]);
      ::SysFreeString (bstrField);

      vField.lVal = plField[i][j];
      hr = spmPropField[i][j]->put_Value (vField);
    }
  }

  if (pObjectContext)
    pObjectContext->Release();

  if (spmMgr)
    spmMgr->Release();

  if (spmGroup)
    spmGroup->Release();

  for (i = 0; i < 3; i ++) {
    for (long j = 0; j < 3; j ++) {
      if (spmPropField[i][j]) {
        spmPropField[i][j]->Release();
      }
    }
  }

  return hr;
}

Member Data Documentation

long CHuman::plField[3][3] [private]

Definition at line 37 of file Human.h.

The documentation for this class was generated from the following files:
  • Com/Services/Shared_Property_Manager/TServer/Human.h
  • Com/Services/Shared_Property_Manager/TServer/Human.Cpp
Generated on Wed Nov 13 2024 16:56:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CIceSkate Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes | Static Private Attributes

CIceSkate Class Reference

#include "people.h"

Inherits CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, and CDelegationBase.

List of all members.

Public Member Functions

CIceSkate (int i)
CIceSkate (int i)
CIceSkate (int i)
CIceSkate (int i)
CIceSkate (int i)
CIceSkate (int i)
CIceSkate (int i)
CIceSkate (int i)
CIceSkate (int i)
CIceSkate (int i)
CIceSkate (int i)
CIceSkate (int i)
virtual | ~CIceSkate ()
virtual | ~CIceSkate ()
virtual | ~CIceSkate ()
virtual | ~CIceSkate ()
virtual | ~CIceSkate ()
virtual | ~CIceSkate ()
virtual | ~CIceSkate ()
virtual | ~CIceSkate ()
virtual | ~CIceSkate ()
virtual | ~CIceSkate ()
virtual | ~CIceSkate ()
virtual | ~CIceSkate ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
bool | IsSelected () const
virtual HRESULT | OnSelect (IConsole *pConsole, BOOL bScope, BOOL bSelect)

Private Attributes

bool | bSelected
int | id

Static Private Attributes

static const GUID | thisGuid = { 0xf6c660b1, 0x9353, 0x11d2, { 0x99, 0x67, 0x0, 0x80, 0xc7, 0xdc, 0xb3, 0xdc } }

Detailed Description

Definition at line 99 of file people.h.

Constructor & Destructor Documentation

CIceSkate::CIceSkate ( int i ) [inline]

Definition at line 101 of file people.h.

: id(i) { }

virtual CIceSkate::~CIceSkate ( ) [inline, virtual]

Definition at line 102 of file people.h.

{}

CIceSkate::CIceSkate ( int i ) [inline]

Definition at line 109 of file people.h.

: id(i) { }

virtual CIceSkate::~CIceSkate ( ) [inline, virtual]

Definition at line 110 of file people.h.

{}

CIceSkate::CIceSkate ( int i ) [inline]

Definition at line 101 of file people.h.

: id(i) { }

virtual CIceSkate::~CIceSkate ( ) [inline, virtual]

Definition at line 102 of file people.h.

{}

CIceSkate::CIceSkate ( int i ) [inline]

Definition at line 101 of file people.h.

: id(i) { }

virtual CIceSkate::~CIceSkate ( ) [inline, virtual]

Definition at line 102 of file people.h.

{}

CIceSkate::CIceSkate ( int i ) [inline]

Definition at line 101 of file people.h.

: id(i) { }

virtual CIceSkate::~CIceSkate ( ) [inline, virtual]

Definition at line 102 of file people.h.

{}

CIceSkate::CIceSkate ( int i ) [inline]

Definition at line 101 of file people.h.

: id(i) { }

virtual CIceSkate::~CIceSkate ( ) [inline, virtual]

Definition at line 102 of file people.h.

{}

CIceSkate::CIceSkate ( int i ) [inline]

Definition at line 101 of file people.h.

: id(i) { }

virtual CIceSkate::~CIceSkate ( ) [inline, virtual]

Definition at line 102 of file people.h.

{}

CIceSkate::CIceSkate ( int i ) [inline]

Definition at line 101 of file people.h.

: id(i) { }

virtual CIceSkate::~CIceSkate ( ) [inline, virtual]

Definition at line 102 of file people.h.

{}

CIceSkate::CIceSkate ( int i ) [inline]

Definition at line 101 of file people.h.

: id(i) { }

virtual CIceSkate::~CIceSkate ( ) [inline, virtual]

Definition at line 102 of file people.h.

{}

CIceSkate::CIceSkate ( int i ) [inline]

Definition at line 118 of file people.h.

: id(i), bSelected(false) { }

virtual CIceSkate::~CIceSkate ( ) [inline, virtual]

Definition at line 119 of file people.h.

{}

CIceSkate::CIceSkate ( int i ) [inline]

Definition at line 101 of file people.h.

: id(i) { }

virtual CIceSkate::~CIceSkate ( ) [inline, virtual]

Definition at line 102 of file people.h.

{}

CIceSkate::CIceSkate ( int i ) [inline]

Definition at line 178 of file people.h.

: id(i) { }

virtual CIceSkate::~CIceSkate ( ) [inline, virtual]

Definition at line 179 of file people.h.

{}

Member Function Documentation

virtual const int CIceSkate::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 106 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CIceSkate::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 106 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CIceSkate::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 106 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CIceSkate::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 106 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CIceSkate::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 183 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CIceSkate::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 106 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CIceSkate::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 114 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CIceSkate::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 106 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CIceSkate::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 106 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CIceSkate::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 106 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CIceSkate::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 106 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CIceSkate::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 123 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const _TCHAR* CIceSkate::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

virtual const _TCHAR* CIceSkate::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

virtual const _TCHAR* CIceSkate::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

virtual const _TCHAR* CIceSkate::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

virtual const _TCHAR* CIceSkate::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

virtual const _TCHAR* CIceSkate::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

virtual const _TCHAR* CIceSkate::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

const _TCHAR * CIceSkate::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

Definition at line 296 of file people.Cpp.

{
    static _TCHAR buf[128];

    _stprintf(buf, _T("Ice Skate #%d"), id);

    return buf;
}

virtual const _TCHAR* CIceSkate::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

virtual const _TCHAR* CIceSkate::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

virtual const _TCHAR* CIceSkate::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

virtual const _TCHAR* CIceSkate::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

virtual const GUID& CIceSkate::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 113 of file people.h.

{ return thisGuid; }

virtual const GUID& CIceSkate::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 122 of file people.h.

{ return thisGuid; }

virtual const GUID& CIceSkate::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 105 of file people.h.

{ return thisGuid; }

virtual const GUID& CIceSkate::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 105 of file people.h.

{ return thisGuid; }

virtual const GUID& CIceSkate::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 105 of file people.h.

{ return thisGuid; }

virtual const GUID& CIceSkate::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 105 of file people.h.

{ return thisGuid; }

virtual const GUID& CIceSkate::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 105 of file people.h.

{ return thisGuid; }

virtual const GUID& CIceSkate::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 182 of file people.h.

{ return thisGuid; }

virtual const GUID& CIceSkate::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 105 of file people.h.

{ return thisGuid; }

virtual const GUID& CIceSkate::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 105 of file people.h.

{ return thisGuid; }

virtual const GUID& CIceSkate::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 105 of file people.h.

{ return thisGuid; }

virtual const GUID& CIceSkate::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 105 of file people.h.

{ return thisGuid; }

bool CIceSkate::IsSelected ( ) const [inline]

Definition at line 135 of file people.h.

{ return bSelected; }

HRESULT CIceSkate::OnSelect | ( | IConsole * | pConsole,
 |  | BOOL | bScope,
 |  | BOOL | bSelect |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 594 of file people.Cpp.

{
    bSelected = bSelect ? true : false;

    return S_FALSE;
}

Member Data Documentation

bool CIceSkate::bSelected [private]

Definition at line 132 of file people.h.

int CIceSkate::id [private]

Definition at line 112 of file people.h.

static const GUID CIceSkate::thisGuid = { 0xf6c660b1, 0x9353, 0x11d2, { 0x99, 0x67, 0x0, 0x80, 0xc7, 0xdc, 0xb3, 0xdc } } [static, private]

Reimplemented from CDelegationBase.

Definition at line 110 of file people.h.

The documentation for this class was generated from the following files:
  • SysMgmt/MMC/CMenu/people.h
  • SysMgmt/MMC/Complete/people.h
  • SysMgmt/MMC/CutCopy/people.h
  • SysMgmt/MMC/Extens/people.h
  • SysMgmt/MMC/Menubtn/people.h
  • SysMgmt/MMC/Multisel/people.h
  • SysMgmt/MMC/Nodes/people.h
  • SysMgmt/MMC/Openserv/people.h
  • SysMgmt/MMC/Proppage/people.h
  • SysMgmt/MMC/Taskpads/people.h
  • SysMgmt/MMC/Toolbar/people.h
  • SysMgmt/MMC/WMI/people.h
  • SysMgmt/MMC/CMenu/people.Cpp
  • SysMgmt/MMC/Complete/people.Cpp
  • SysMgmt/MMC/CutCopy/people.Cpp
  • SysMgmt/MMC/Extens/people.Cpp
  • SysMgmt/MMC/Menubtn/people.Cpp
  • SysMgmt/MMC/Multisel/people.Cpp
  • SysMgmt/MMC/Nodes/people.Cpp
  • SysMgmt/MMC/Openserv/people.Cpp
  • SysMgmt/MMC/Proppage/people.Cpp
  • SysMgmt/MMC/Taskpads/people.Cpp
  • SysMgmt/MMC/Toolbar/people.Cpp
  • SysMgmt/MMC/WMI/people.Cpp
Generated on Wed Nov 13 2024 16:56:39 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CIceSkateFolder Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Types | Private Attributes | Static Private Attributes

CIceSkateFolder Class Reference

#include "people.h"

Inherits CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, and CDelegationBase.

List of all members.

Public Member Functions

CIceSkateFolder ()
CIceSkateFolder ()
CIceSkateFolder ()
CIceSkateFolder ()
CIceSkateFolder ()
CIceSkateFolder ()
CIceSkateFolder ()
CIceSkateFolder ()
CIceSkateFolder ()
CIceSkateFolder ()
CIceSkateFolder ()
CIceSkateFolder ()
virtual | ~CIceSkateFolder ()
virtual | ~CIceSkateFolder ()
virtual | ~CIceSkateFolder ()
virtual | ~CIceSkateFolder ()
virtual | ~CIceSkateFolder ()
virtual | ~CIceSkateFolder ()
virtual | ~CIceSkateFolder ()
virtual | ~CIceSkateFolder ()
virtual | ~CIceSkateFolder ()
virtual | ~CIceSkateFolder ()
virtual | ~CIceSkateFolder ()
virtual | ~CIceSkateFolder ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual void | GetChildColumnInfo (RESULTDATAITEM *rdi)
virtual void | GetChildColumnInfo (RESULTDATAITEM *rdi)
virtual void | GetChildColumnInfo (RESULTDATAITEM *rdi)
virtual CDelegationBase * | GetChildPtr (int index)
virtual CDelegationBase * | GetChildPtr (int index)
virtual CDelegationBase * | GetChildPtr (int index)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual HRESULT | GetListpadInfo (MMC_LISTPAD_INFO *lpListPadInfo)
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual HSCOPEITEM | GetParentScopeItem ()
virtual HRESULT | GetResultViewType (LPOLESTR *ppViewType, long *pViewOptions)
virtual HRESULT | GetResultViewType (LPOLESTR *ppViewType, long *pViewOptions)
virtual HRESULT | GetResultViewType (LPOLESTR *ppViewType, long *pViewOptions)
virtual HRESULT | GetResultViewType (LPOLESTR *ppViewType, long *pViewOptions)
virtual MMC_TASK * | GetTaskList (LPOLESTR szTaskGroup, LONG *nCount)
virtual HRESULT | GetTaskpadBackground (MMC_TASK_DISPLAY_OBJECT *pTDO)
virtual HRESULT | GetTaskpadDescription (LPOLESTR *pszDescription)
virtual HRESULT | GetTaskpadTitle (LPOLESTR *pszTitle)
virtual HRESULT | OnAddImages (IImageList *pImageList, HSCOPEITEM hsi)
virtual HRESULT | OnAddImages (IImageList *pImageList, HSCOPEITEM hsi)
virtual HRESULT | OnAddImages (IImageList *pImageList, HSCOPEITEM hsi)
virtual HRESULT | OnListpad (IConsole *pConsole, BOOL bAttaching)
virtual HRESULT | OnSelect (IConsole *pConsole, BOOL bScope, BOOL bSelect)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual void | SetScopeItemValue (HSCOPEITEM hscopeitem)
virtual HRESULT | TaskNotify (IConsole *pConsole, VARIANT *v1, VARIANT *v2)

Private Types

enum | { NUMBER_OF_CHILDREN = 20 }
enum | { NUMBER_OF_CHILDREN = 20 }
enum | { NUMBER_OF_CHILDREN = 20 }
enum | { NUMBER_OF_CHILDREN = 20 }
enum | { NUMBER_OF_CHILDREN = 20 }
enum | { NUMBER_OF_CHILDREN = 20 }
enum | { NUMBER_OF_CHILDREN = 20 }
enum | { NUMBER_OF_CHILDREN = 20 }
enum | { NUMBER_OF_CHILDREN = 20 }
enum | { NUMBER_OF_CHILDREN = 20 }
enum | { NUMBER_OF_CHILDREN = 20 }
enum | { NUMBER_OF_CHILDREN = 20 }

Private Attributes

CDelegationBase * | children [NUMBER_OF_CHILDREN]
CIceSkate * | children [NUMBER_OF_CHILDREN]
HSCOPEITEM | m_hParentHScopeItem

Static Private Attributes

static const GUID | thisGuid = { 0xf6c660b0, 0x9353, 0x11d2, { 0x99, 0x67, 0x0, 0x80, 0xc7, 0xdc, 0xb3, 0xdc } }

Detailed Description

Definition at line 115 of file people.h.

Member Enumeration Documentation

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 132 of file people.h.

{ NUMBER_OF_CHILDREN = 20 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 144 of file people.h.

{ NUMBER_OF_CHILDREN = 20 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 140 of file people.h.

{ NUMBER_OF_CHILDREN = 5000 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 132 of file people.h.

{ NUMBER_OF_CHILDREN = 20 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 132 of file people.h.

{ NUMBER_OF_CHILDREN = 20 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 140 of file people.h.

{ NUMBER_OF_CHILDREN = 5000 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 140 of file people.h.

{ NUMBER_OF_CHILDREN = 5000 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 132 of file people.h.

{ NUMBER_OF_CHILDREN = 20 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 132 of file people.h.

{ NUMBER_OF_CHILDREN = 20 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 166 of file people.h.

{ NUMBER_OF_CHILDREN = 20 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 132 of file people.h.

{ NUMBER_OF_CHILDREN = 20 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 209 of file people.h.

{ NUMBER_OF_CHILDREN = 20 };

Constructor & Destructor Documentation

CIceSkateFolder::CIceSkateFolder ( )

Definition at line 148 of file people.Cpp.

{
    for (int n = 0; n < NUMBER_OF_CHILDREN; n++) {
        children[n] = new CIceSkate(n + 1);
    }
}

CIceSkateFolder::~CIceSkateFolder ( ) [virtual]

Definition at line 155 of file people.Cpp.

{
    for (int n = 0; n < NUMBER_OF_CHILDREN; n++)
        if (children[n]) {
            delete children[n];
        }
}

CIceSkateFolder::CIceSkateFolder ( )
virtual CIceSkateFolder::~CIceSkateFolder ( ) [virtual]
CIceSkateFolder::CIceSkateFolder ( )
virtual CIceSkateFolder::~CIceSkateFolder ( ) [virtual]
CIceSkateFolder::CIceSkateFolder ( )
virtual CIceSkateFolder::~CIceSkateFolder ( ) [virtual]
CIceSkateFolder::CIceSkateFolder ( )
virtual CIceSkateFolder::~CIceSkateFolder ( ) [virtual]
CIceSkateFolder::CIceSkateFolder ( )
virtual CIceSkateFolder::~CIceSkateFolder ( ) [virtual]
CIceSkateFolder::CIceSkateFolder ( )
virtual CIceSkateFolder::~CIceSkateFolder ( ) [virtual]
CIceSkateFolder::CIceSkateFolder ( )
virtual CIceSkateFolder::~CIceSkateFolder ( ) [virtual]
CIceSkateFolder::CIceSkateFolder ( )
virtual CIceSkateFolder::~CIceSkateFolder ( ) [virtual]
CIceSkateFolder::CIceSkateFolder ( )
virtual CIceSkateFolder::~CIceSkateFolder ( ) [virtual]
CIceSkateFolder::CIceSkateFolder ( )
virtual CIceSkateFolder::~CIceSkateFolder ( ) [virtual]
CIceSkateFolder::CIceSkateFolder ( )
virtual CIceSkateFolder::~CIceSkateFolder ( ) [virtual]

Member Function Documentation

virtual const int CIceSkateFolder::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 122 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CIceSkateFolder::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 122 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CIceSkateFolder::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 123 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CIceSkateFolder::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 122 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CIceSkateFolder::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 199 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CIceSkateFolder::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 122 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CIceSkateFolder::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 130 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CIceSkateFolder::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 122 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CIceSkateFolder::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 122 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CIceSkateFolder::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 145 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CIceSkateFolder::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 123 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CIceSkateFolder::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 123 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual void CIceSkateFolder::GetChildColumnInfo ( RESULTDATAITEM * rdi ) [virtual]

Reimplemented from CDelegationBase.

void CIceSkateFolder::GetChildColumnInfo ( RESULTDATAITEM * rdi ) [virtual]

Reimplemented from CDelegationBase.

Definition at line 174 of file people.Cpp.

{
    if (rdi->mask & RDI_STR)
    {
        LPCTSTR pszT = children[rdi->nIndex]->GetDisplayName(rdi->nCol);
        MAKE_WIDEPTR_FROMTSTR_ALLOC(pszW, pszT);
        rdi->str = pszW;
    }

    if (rdi->mask & RDI_IMAGE)
        rdi->nImage = children[rdi->nIndex]->GetBitmapIndex();
}

virtual void CIceSkateFolder::GetChildColumnInfo ( RESULTDATAITEM * rdi ) [virtual]

Reimplemented from CDelegationBase.

virtual CDelegationBase* CIceSkateFolder::GetChildPtr ( int index ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 125 of file people.h.

                                                  {
    return (index < NUMBER_OF_CHILDREN) ? children[index] : NULL;
  }

virtual CDelegationBase* CIceSkateFolder::GetChildPtr ( int index ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 125 of file people.h.

                                                  {
    return (index < NUMBER_OF_CHILDREN) ? children[index] : NULL;
  }

virtual CDelegationBase* CIceSkateFolder::GetChildPtr ( int index ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 125 of file people.h.

                                                  {
    return (index < NUMBER_OF_CHILDREN) ? children[index] : NULL;
  }

virtual const _TCHAR* CIceSkateFolder::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 120 of file people.h.

{ return _T("Ice Skates"); }

virtual const _TCHAR* CIceSkateFolder::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 197 of file people.h.

{ return _T("Ice Skates"); }

virtual const _TCHAR* CIceSkateFolder::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 120 of file people.h.

{ return _T("Ice Skates"); }

virtual const _TCHAR* CIceSkateFolder::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 120 of file people.h.

{ return _T("Ice Skates"); }

virtual const _TCHAR* CIceSkateFolder::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 120 of file people.h.

{ return _T("Ice Skates"); }

virtual const _TCHAR* CIceSkateFolder::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 128 of file people.h.

{ return _T("Ice Skates"); }

virtual const _TCHAR* CIceSkateFolder::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 120 of file people.h.

{ return _T("Ice Skates"); }

virtual const _TCHAR* CIceSkateFolder::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 120 of file people.h.

{ return _T("Ice Skates"); }

virtual const _TCHAR* CIceSkateFolder::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 120 of file people.h.

{ return _T("Ice Skates"); }

virtual const _TCHAR* CIceSkateFolder::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 143 of file people.h.

{ return _T("Ice Skates (listpad)"); }

virtual const _TCHAR* CIceSkateFolder::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 120 of file people.h.

{ return _T("Ice Skates"); }

virtual const _TCHAR* CIceSkateFolder::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 120 of file people.h.

{ return _T("Ice Skates"); }

HRESULT CIceSkateFolder::GetListpadInfo ( MMC_LISTPAD_INFO * lpListPadInfo ) [virtual]

Reimplemented from CDelegationBase.

Definition at line 504 of file people.Cpp.

{
        lpListPadInfo->szTitle = OleDuplicateString(L"Ice Skates");
        lpListPadInfo->szButtonText = OleDuplicateString(L"Special");
        lpListPadInfo->nCommandID = 101;
        return S_OK;
}

virtual const GUID& CIceSkateFolder::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 121 of file people.h.

{ return thisGuid; }

virtual const GUID& CIceSkateFolder::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 198 of file people.h.

{ return thisGuid; }

virtual const GUID& CIceSkateFolder::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 122 of file people.h.

{ return thisGuid; }

virtual const GUID& CIceSkateFolder::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 121 of file people.h.

{ return thisGuid; }

virtual const GUID& CIceSkateFolder::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 121 of file people.h.

{ return thisGuid; }

virtual const GUID& CIceSkateFolder::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 121 of file people.h.

{ return thisGuid; }

virtual const GUID& CIceSkateFolder::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 121 of file people.h.

{ return thisGuid; }

virtual const GUID& CIceSkateFolder::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 121 of file people.h.

{ return thisGuid; }

virtual const GUID& CIceSkateFolder::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 129 of file people.h.

{ return thisGuid; }

virtual const GUID& CIceSkateFolder::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 144 of file people.h.

{ return thisGuid; }

virtual const GUID& CIceSkateFolder::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 122 of file people.h.

{ return thisGuid; }

virtual const GUID& CIceSkateFolder::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 122 of file people.h.

{ return thisGuid; }

virtual HSCOPEITEM CIceSkateFolder::GetParentScopeItem ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 132 of file people.h.

{ return m_hParentHScopeItem; }

HRESULT CIceSkateFolder::GetResultViewType | ( | LPOLESTR * | ppViewType,
 |  | long * | pViewOptions |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 166 of file people.Cpp.

{
    *ppViewType = NULL;
    *pViewOptions = MMC_VIEW_OPTIONS_OWNERDATALIST;

    return S_OK;
}

virtual HRESULT CIceSkateFolder::GetResultViewType | ( | LPOLESTR * | ppViewType,
 |  | long * | pViewOptions |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CIceSkateFolder::GetResultViewType | ( | LPOLESTR * | ppViewType,
 |  | long * | pViewOptions |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CIceSkateFolder::GetResultViewType | ( | LPOLESTR * | ppViewType,
 |  | long * | pViewOptions |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

MMC_TASK * CIceSkateFolder::GetTaskList | ( | LPOLESTR | szTaskGroup,
 |  | LONG * | nCount |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 390 of file people.Cpp.

{
    *nCount = 4;

    MMC_TASK *tasks = new MMC_TASK[*nCount];

    for (int t = 0; t < *nCount; t++) {
        tasks[t].sDisplayObject.eDisplayType = MMC_TASK_DISPLAY_TYPE_BITMAP;
        tasks[t].sDisplayObject.uBitmap.szMouseOverBitmap = CreateResourcePath(g_hinst, L"buttonover.bmp");
        tasks[t].sDisplayObject.uBitmap.szMouseOffBitmap = CreateResourcePath(g_hinst, L"buttonoff.bmp");

        switch (t) {
        case 0:
            tasks[t].szText = OleDuplicateString(L"Sharpen Skate");
            tasks[t].szHelpString = OleDuplicateString(L"Click here to Sharpen skate");

            break;
        case 1:
            tasks[t].szText = OleDuplicateString(L"Tighten skate laces");
            tasks[t].szHelpString = OleDuplicateString(L"Click here to Tighten skate");

            break;
        case 2:
            tasks[t].szText = OleDuplicateString(L"Wear skate");
            tasks[t].szHelpString = OleDuplicateString(L"Click here to Wear skate");

            break;
        case 3:
            tasks[t].szText = OleDuplicateString(L"Remove skate");
            tasks[t].szHelpString = OleDuplicateString(L"Click here to Remove skate");

            break;
        }

        tasks[t].eActionType = MMC_ACTION_ID;
        tasks[t].nCommandID = t;
    }

    return tasks;
}

HRESULT CIceSkateFolder::GetTaskpadBackground ( MMC_TASK_DISPLAY_OBJECT * pTDO ) [virtual]

Reimplemented from CDelegationBase.

Definition at line 497 of file people.Cpp.

{
        pTDO->eDisplayType = MMC_TASK_DISPLAY_TYPE_BITMAP;
        pTDO->uBitmap.szMouseOverBitmap = CreateResourcePath(g_hinst, L"iceskate.bmp");
        return S_OK;
}

HRESULT CIceSkateFolder::GetTaskpadDescription ( LPOLESTR * pszDescription ) [virtual]

Reimplemented from CDelegationBase.

Definition at line 491 of file people.Cpp.

{
        *pszDescription = OleDuplicateString(L"This is a sample task pad for ice skate nodes");
        return S_OK;
}

HRESULT CIceSkateFolder::GetTaskpadTitle ( LPOLESTR * pszTitle ) [virtual]

Reimplemented from CDelegationBase.

Definition at line 485 of file people.Cpp.

{
        *pszTitle = OleDuplicateString(L"Iceskate Tasks");
        return S_OK;
}

virtual HRESULT CIceSkateFolder::OnAddImages | ( | IImageList * | pImageList,
 |  | HSCOPEITEM | hsi |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

HRESULT CIceSkateFolder::OnAddImages | ( | IImageList * | pImageList,
 |  | HSCOPEITEM | hsi |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 189 of file people.Cpp.

{
    return pImageList->ImageListSetStrip((long *)m_pBMapSm, // pointer to a handle
        (long *)m_pBMapLg, // pointer to a handle
        0, // index of the first image in the strip
        RGB(0, 128, 128)  // color of the icon mask
        );
}

virtual HRESULT CIceSkateFolder::OnAddImages | ( | IImageList * | pImageList,
 |  | HSCOPEITEM | hsi |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

HRESULT CIceSkateFolder::OnListpad | ( | IConsole * | pConsole,
 |  | BOOL | bAttaching |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 529 of file people.Cpp.

{
    HRESULT      hr = S_OK;

    IHeaderCtrl *pHeaderCtrl = NULL;
    IResultData *pResultData = NULL;
    IImageList  *pImageList  = NULL;

    if (bAttaching) {
        hr = pConsole->QueryResultImageList(&pImageList);
        _ASSERT( SUCCEEDED(hr) );

        hr = pImageList->ImageListSetStrip((long *)m_pBMapSm, // pointer to a handle
                                           (long *)m_pBMapLg, // pointer to a handle
                                           0, // index of the first image in the strip
                                           RGB(0, 128, 128)  // color of the icon mask
            );
        _ASSERT( SUCCEEDED(hr) );

        pImageList->Release();

        hr = pConsole->QueryInterface(IID_IHeaderCtrl, (void **)&pHeaderCtrl);
        _ASSERT( SUCCEEDED(hr) );

        hr = pConsole->QueryInterface(IID_IResultData, (void **)&pResultData);
        _ASSERT( SUCCEEDED(hr) );

        // Set the column headers in the results pane
        hr = pHeaderCtrl->InsertColumn( 0, L"Name                ", 0, MMCLV_AUTO );
        _ASSERT( S_OK == hr );
        hr = pHeaderCtrl->InsertColumn( 1, L"Sharpness           ", 0, MMCLV_AUTO );
        _ASSERT( S_OK == hr );

        // insert items here
        RESULTDATAITEM rdi;

        hr = pResultData->DeleteAllRsltItems();
        _ASSERT( SUCCEEDED(hr) );

        if (!bExpanded) {
            // create the child nodes, then expand them
            for (int n = 0; n < NUMBER_OF_CHILDREN; n++) {
                ZeroMemory(&rdi, sizeof(RESULTDATAITEM) );
                rdi.mask       = RDI_STR       |   // Displayname is valid
                    RDI_IMAGE     |
                    RDI_PARAM;        // nImage is valid

                rdi.nImage      = children[n]->GetBitmapIndex();
                rdi.str         = MMC_CALLBACK;
                rdi.nCol        = 0;
                rdi.lParam      = (LPARAM)children[n];

                hr = pResultData->InsertItem( &rdi );

                _ASSERT( SUCCEEDED(hr) );
            }
        }

        pHeaderCtrl->Release();
        pResultData->Release();
    }

    return hr;
}

HRESULT CIceSkateFolder::OnSelect | ( | IConsole * | pConsole,
 |  | BOOL | bScope,
 |  | BOOL | bSelect |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 512 of file people.Cpp.

{
    IConsole2 *pConsole2;
    HRESULT hr = S_OK;

    if (TRUE == bSelect) {
        hr = pConsole->QueryInterface(IID_IConsole2, (void **)&pConsole2);

        if (SUCCEEDED(hr)) {
            hr = pConsole2->SetStatusText(L"Hello, you've selected the ice skate folder");
            pConsole2->Release();
        }
    }

    return hr;
}

virtual HRESULT CIceSkateFolder::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CIceSkateFolder::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CIceSkateFolder::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CIceSkateFolder::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CIceSkateFolder::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CIceSkateFolder::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

HRESULT CIceSkateFolder::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 163 of file people.Cpp.

{
    HRESULT      hr = S_OK;

    IHeaderCtrl *pHeaderCtrl = NULL;
    IResultData *pResultData = NULL;

    if (bShow) {
        hr = pConsole->QueryInterface(IID_IHeaderCtrl, (void **)&pHeaderCtrl);
        _ASSERT( SUCCEEDED(hr) );

        hr = pConsole->QueryInterface(IID_IResultData, (void **)&pResultData);
        _ASSERT( SUCCEEDED(hr) );

        // Set the column headers in the results pane
        hr = pHeaderCtrl->InsertColumn( 0, L"Name                ", 0, MMCLV_AUTO );
        _ASSERT( S_OK == hr );

        // insert items here
        RESULTDATAITEM rdi;

        hr = pResultData->DeleteAllRsltItems();
        _ASSERT( SUCCEEDED(hr) );

        if (!bExpanded) {
            // create the child nodes, then expand them
            for (int n = 0; n < NUMBER_OF_CHILDREN; n++) {
                ZeroMemory(&rdi, sizeof(RESULTDATAITEM) );
                rdi.mask       = RDI_STR       |   // Displayname is valid
                    RDI_IMAGE     |
                    RDI_PARAM;        // nImage is valid

                rdi.nImage      = children[n]->GetBitmapIndex();
                rdi.str         = MMC_CALLBACK;
                rdi.nCol        = 0;
                rdi.lParam      = (LPARAM)children[n];

                hr = pResultData->InsertItem( &rdi );

                _ASSERT( SUCCEEDED(hr) );
            }
        }

        pHeaderCtrl->Release();
        pResultData->Release();
    }

    return hr;
}

virtual HRESULT CIceSkateFolder::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CIceSkateFolder::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CIceSkateFolder::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CIceSkateFolder::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual void CIceSkateFolder::SetScopeItemValue ( HSCOPEITEM hscopeitem ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 131 of file people.h.

{ m_hParentHScopeItem = hscopeitem; }

HRESULT CIceSkateFolder::TaskNotify | ( | IConsole * | pConsole,
 |  | VARIANT * | v1,
 |  | VARIANT * | v2 |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 431 of file people.Cpp.

{
    RESULTDATAITEM rdi;
    IResultData *pResultData;

    ZeroMemory(&rdi, sizeof(RESULTDATAITEM));

    HRESULT hr = S_OK;

    hr = pConsole->QueryInterface(IID_IResultData, (void **)&pResultData);

    if (SUCCEEDED(hr)) {

        rdi.mask = RDI_STATE | RDI_PARAM;  // Use selected state to get param.
        rdi.nState = LVIS_SELECTED | LVIS_FOCUSED;
        rdi.nIndex = -1;  // Start looking for selected item from top of list view

        hr = pResultData->GetNextItem(&rdi);

        pResultData->Release();
    }

    if (SUCCEEDED(hr)) {
        _TCHAR buf[256];

        switch (v1->lVal) {
        case 0:
            wsprintf(buf, _T("Skate %d sharpened."), rdi.nIndex);

            break;
        case 1:
            wsprintf(buf, _T("Skate %d tightened."), rdi.nIndex);

            break;
        case 2:
            wsprintf(buf, _T("Wearing skate %d."), rdi.nIndex);

            break;
        case 3:
            wsprintf(buf, _T("Skate %d removed."), rdi.nIndex);

            break;
        case 101:
            wsprintf(buf, _T("Special skate task choosen (%d)."), rdi.nIndex);

            break;
        }

        MessageBox(NULL, buf, _T("Task Notification"), MB_OK | MB_ICONINFORMATION);
    }

    return hr;
}

Member Data Documentation

CDelegationBase * CIceSkateFolder::children [private]

Definition at line 133 of file people.h.

CIceSkate* CIceSkateFolder::children[NUMBER_OF_CHILDREN] [private]

Definition at line 167 of file people.h.

HSCOPEITEM CIceSkateFolder::m_hParentHScopeItem [private]

Definition at line 142 of file people.h.

static const GUID CIceSkateFolder::thisGuid = { 0xf6c660b0, 0x9353, 0x11d2, { 0x99, 0x67, 0x0, 0x80, 0xc7, 0xdc, 0xb3, 0xdc } } [static, private]

Reimplemented from CDelegationBase.

Definition at line 130 of file people.h.

The documentation for this class was generated from the following files:
  • SysMgmt/MMC/CMenu/people.h
  • SysMgmt/MMC/Complete/people.h
  • SysMgmt/MMC/CutCopy/people.h
  • SysMgmt/MMC/Extens/people.h
  • SysMgmt/MMC/Menubtn/people.h
  • SysMgmt/MMC/Multisel/people.h
  • SysMgmt/MMC/Nodes/people.h
  • SysMgmt/MMC/Openserv/people.h
  • SysMgmt/MMC/Proppage/people.h
  • SysMgmt/MMC/Taskpads/people.h
  • SysMgmt/MMC/Toolbar/people.h
  • SysMgmt/MMC/WMI/people.h
  • SysMgmt/MMC/CMenu/people.Cpp
  • SysMgmt/MMC/Complete/people.Cpp
  • SysMgmt/MMC/CutCopy/people.Cpp
  • SysMgmt/MMC/Extens/people.Cpp
  • SysMgmt/MMC/Menubtn/people.Cpp
  • SysMgmt/MMC/Multisel/people.Cpp
  • SysMgmt/MMC/Nodes/people.Cpp
  • SysMgmt/MMC/Openserv/people.Cpp
  • SysMgmt/MMC/Proppage/people.Cpp
  • SysMgmt/MMC/Taskpads/people.Cpp
  • SysMgmt/MMC/Toolbar/people.Cpp
  • SysMgmt/MMC/WMI/people.Cpp
Generated on Wed Nov 13 2024 16:56:40 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CIdentitySub Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CIdentitySub Class Reference

#include "Identitysub.h"

Inherits CSysLCESub.

List of all members.

Public Member Functions

CIdentitySub (CComSpy *pSpy)
CIdentitySub ()
STDMETHODIMP | GetEventClass (LPGUID guid)
STDMETHODIMP | GetEventType (EventEnum *e)
STDMETHODIMP | GetInterface (IID *iid)
STDMETHODIMP | OnIISRequestInfo (COMSVCSEVENTINFO *pInfo, ULONG64 ObjId, LPCOLESTR pszClientIP, LPCOLESTR pszServerIP, LPCOLESTR pszURL)

Detailed Description

Definition at line 30 of file Identitysub.h.

Constructor & Destructor Documentation

CIdentitySub::CIdentitySub ( CComSpy * pSpy ) [inline]

Definition at line 35 of file Identitysub.h.

  {
    m_pSpy = pSpy;
  }

CIdentitySub::CIdentitySub ( ) [inline]

Definition at line 40 of file Identitysub.h.

  {
    m_pSpy = NULL;
  }

Member Function Documentation

STDMETHODIMP CIdentitySub::GetEventClass ( LPGUID guid ) [inline, virtual]

Implements CSysLCESub.

Definition at line 54 of file Identitysub.h.

{*guid = CLSID_ComServiceEvents;return S_OK;}

STDMETHODIMP CIdentitySub::GetEventType ( EventEnum * e ) [inline, virtual]

Implements CSysLCESub.

Definition at line 53 of file Identitysub.h.

{*e = Identity;return S_OK;}

STDMETHODIMP CIdentitySub::GetInterface ( IID * iid ) [inline, virtual]

Implements CSysLCESub.

Definition at line 55 of file Identitysub.h.

{*iid = IID_IComIdentityEvents;return S_OK;}

STDMETHODIMP CIdentitySub::OnIISRequestInfo | ( | COMSVCSEVENTINFO * | pInfo,
 |  | ULONG64 | ObjId,
 |  | LPCOLESTR | pszClientIP,
 |  | LPCOLESTR | pszServerIP,
 |  | LPCOLESTR | pszURL |
 | ) |  |  | [inline]

Definition at line 57 of file Identitysub.h.

  {
    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnIISRequestInfo"), GuidToBstr(pInfo->guidApp));

    WCHAR szObjectID[32];
    wsprintfW(szObjectID, L"0x%016X", ObjId);
    m_pSpy -> AddParamValueToList(L"ObjectID", szObjectID);

    m_pSpy -> AddParamValueToList(L"ClientIP", pszClientIP);
    m_pSpy -> AddParamValueToList(L"ServerIP", pszServerIP);
    m_pSpy -> AddParamValueToList(L"URL", pszURL);

    IF_AUDIT_DO(OnIISRequestInfo)(pInfo->perfCount, GuidToBstr(pInfo->guidApp),
                  szObjectID,
                  pszClientIP,
                  pszServerIP,
                  pszURL
                  );

    return S_OK;
  }

The documentation for this class was generated from the following file:
  • Com/Administration/Spy/ComSpyCtl/Identitysub.h
Generated on Wed Nov 13 2024 16:56:40 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CImageTag Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CImageTag Class Reference

#include "ImageTag.Hxx"

Inherits CHtmlElement.

List of all members.

Public Member Functions

CImageTag (CHtmlIFilter &htmlIFilter, CSerialStream &serialStream)
virtual SCODE | GetChunk (STAT_CHUNK *pStat)
virtual SCODE | GetText (ULONG *pcwcOutput, WCHAR *awcBuffer)
virtual void | InitStatChunk (STAT_CHUNK *pStat)

Private Attributes

unsigned | _cValueChars
unsigned | _cValueCharsFiltered
WCHAR * | _pwcValueBuf

Detailed Description

Definition at line 25 of file ImageTag.Hxx.

Constructor & Destructor Documentation

CImageTag::CImageTag | ( | CHtmlIFilter & | htmlIFilter,
 |  | CSerialStream & | serialStream
 | ) |  |

Definition at line 31 of file ImageTag.Cxx.

    : CHtmlElement(htmlIFilter, serialStream),
      _pwcValueBuf(0),
      _cValueChars(0),
      _cValueCharsFiltered(0)
{
}

Member Function Documentation

SCODE CImageTag::GetChunk ( STAT_CHUNK * pStat ) [virtual]

Implements CHtmlElement.

Definition at line 52 of file ImageTag.Cxx.

{
    SCODE sc = SwitchToNextHtmlElement( pStat );

    return sc;
}

SCODE CImageTag::GetText | ( | ULONG * | pcwcOutput,
 |  | WCHAR * | awcBuffer |
 | ) |  |  | [virtual]

Implements CHtmlElement.

Definition at line 72 of file ImageTag.Cxx.

{
    ULONG cCharsRemaining = _cValueChars - _cValueCharsFiltered;

    if ( cCharsRemaining == 0 )
    {
        *pcwcOutput = 0;
        return FILTER_E_NO_MORE_TEXT;
    }

    if ( *pcwcOutput < cCharsRemaining )
    {
        RtlCopyMemory( awcBuffer,
                       _pwcValueBuf + _cValueCharsFiltered,
                       *pcwcOutput * sizeof(WCHAR) );
        _cValueCharsFiltered += *pcwcOutput;

        return S_OK;
    }
    else
    {
        RtlCopyMemory( awcBuffer,
                       _pwcValueBuf + _cValueCharsFiltered,
                       cCharsRemaining * sizeof(WCHAR) );
        _cValueCharsFiltered += cCharsRemaining;
        *pcwcOutput = cCharsRemaining;

        return FILTER_S_LAST_TEXT;
    }
}

void CImageTag::InitStatChunk ( STAT_CHUNK * pStat ) [virtual]

Implements CHtmlElement.

Definition at line 115 of file ImageTag.Cxx.

{
    //
    // Read the alt field of image tag
    //
    _scanner.ReadTagIntoBuffer();
    _scanner.ScanTagBuffer( L"alt=\"", _pwcValueBuf, _cValueChars );

    _cValueCharsFiltered = 0;

    pStat->idChunk = _htmlIFilter.GetNextChunkId();
    pStat->flags = CHUNK_TEXT;
    pStat->locale = _htmlIFilter.GetLocale();
    pStat->attribute.guidPropSet = CLSID_Storage;
    pStat->attribute.psProperty.ulKind = PRSPEC_PROPID;
    pStat->attribute.psProperty.propid = PID_STG_CONTENTS;
    pStat->breakType = CHUNK_EOS;
    pStat->idChunkSource = pStat->idChunk;
    pStat->cwcStartSource = 0;
    pStat->cwcLenSource = 0;
}

Member Data Documentation

unsigned CImageTag::_cValueChars [private]

Definition at line 38 of file ImageTag.Hxx.

unsigned CImageTag::_cValueCharsFiltered [private]

Definition at line 39 of file ImageTag.Hxx.

WCHAR* CImageTag::_pwcValueBuf [private]

Definition at line 37 of file ImageTag.Hxx.

The documentation for this class was generated from the following files:
  • WinBase/Indexing/IFilter/ImageTag.Hxx
  • WinBase/Indexing/IFilter/ImageTag.Cxx
Generated on Wed Nov 13 2024 16:56:40 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CImp_DrawApp Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CImp_DrawApp Class Reference

#include "Imp_Draw.h"

Inherits CWinApp.

List of all members.

Public Member Functions

CImp_DrawApp ()
virtual BOOL InitInstance ()

Detailed Description

Definition at line 35 of file Imp_Draw.h.

Constructor & Destructor Documentation

CImp_DrawApp::CImp_DrawApp ( )

Definition at line 41 of file Imp_Draw.Cpp.

{
  // TODO: add construction code here,
  // Place all significant initialization in InitInstance
}

Member Function Documentation

BOOL CImp_DrawApp::InitInstance ( void ) [virtual]

Reimplemented from CWinApp.

Definition at line 55 of file Imp_Draw.Cpp.

{
  // Standard initialization
  // If you are not using these features and wish to reduce the size
  //  of your final executable, you should remove from the following
  //  the specific initialization routines you do not need.

#ifdef _AFXDLL
  Enable3dControls();     // Call this when using MFC in a shared DLL
#else
  Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif

  CImp_DrawDlg dlg;
  m_pMainWnd = &dlg;
  int nResponse = dlg.DoModal();
  if (nResponse == IDOK)
  {
    // TODO: Place code here to handle when the dialog is
    //  dismissed with OK
  }
  else if (nResponse == IDCANCEL)
  {
    // TODO: Place code here to handle when the dialog is
    //  dismissed with Cancel
  }

  // Since the dialog has been closed, return FALSE so that we exit the
  //  application, rather than start the application's message pump.
  return FALSE;
}

The documentation for this class was generated from the following files:
  • NetDS/MessageQueuing/Imp_Draw/Imp_Draw.h
  • NetDS/MessageQueuing/Imp_Draw/Imp_Draw.Cpp
Generated on Wed Nov 13 2024 16:56:40 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CImp_DrawDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Classes | Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes

CImp_DrawDlg Class Reference

#include "Imp_Dlg.h"

List of all members.

Classes

struct | Line

Public Types

enum | { IDD = IDD_IMP_DRAW_DIALOG }

Public Member Functions

CImp_DrawDlg (CWnd *pParent=NULL)
~CImp_DrawDlg ()
void | Arrived (IDispatch *pdispQueue, long lErrorCode, long lCursor)
void | HandleErrors (_com_error &comerr)
void | initializeUI (BOOL fConnectedToDS)
BOOL IsDsEnabledLocaly ()
void | SendKeystroke (UINT uChar)
void | SendMouseMovement (LINE line)

Public Attributes

CButton | m_btnAttach
CButton | m_CancelButton
CEdit | m_cComputerInput
CStatic | m_cComputerLabel
CButton | m_cContinueButton
CButton | m_cDsFrame
int | m_cLines
CButton | m_cMessageFrame
CEdit | m_cQueueInput
CStatic | m_cQueueLabel
CButton | m_cRadioDS
CButton | m_cRadioExpress
CButton | m_cRadioRecoverable
CButton | m_cRadioWorkgroup
CString m_csFriendName
CString m_csLogin
CString m_csScreenText
CDrawArea m_drawScribble
int | m_iArraySize
int | m_iRadio
int | m_iRadioDS
int | m_iWasText
long | m_lLastX
long | m_lLastY
IMSMQMessagePtr | m_msgOut
IMSMQEventPtr | m_qevent
IMSMQQueuePtr | m_qFriend
IMSMQQueuePtr | m_queue
CString m_strRemoteComputerName
_variant_t | m_vtFriendName
_variant_t | m_vtguidDraw
_variant_t | m_vtLogin

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
CString GetComputerName ()
CString GetUserName ()
CString | LoginPrompt (CString DefaultName)
afx_msg void | OnButtonAttach ()
afx_msg void | OnConnect ()
virtual BOOL | OnInitDialog ()
afx_msg void | OnPaint ()
afx_msg HCURSOR | OnQueryDragIcon ()
BOOL OpenPrivateReceiveQueue ()
BOOL OpenReceiveQueue ()

Protected Attributes

BOOL m_fDsEnabledLocaly
HICON | m_hIcon
CMSMQEventHandler * m_pHandler

Detailed Description

Definition at line 32 of file Imp_Dlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 43 of file Imp_Dlg.h.

{ IDD = IDD_IMP_DRAW_DIALOG };

Constructor & Destructor Documentation

CImp_DrawDlg::CImp_DrawDlg ( CWnd * pParent = NULL )

Definition at line 31 of file Imp_Dlg.Cpp.

  : CDialog(CImp_DrawDlg::IDD, pParent)
{
  //{{AFX_DATA_INIT(CImp_DrawDlg)
  m_csFriendName = _T("");
  m_iRadio = 0;
  //}}AFX_DATA_INIT
    m_iRadioDS = 0;
    m_strRemoteComputerName = _T("");

  // Note that LoadIcon does not require a subsequent DestroyIcon in Win32.
  m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);

  // Initialize my data members
  m_vtguidDraw = "{151ceac0-acb5-11cf-8b51-0020af929546}";
  m_vtFriendName = "";
  m_pHandler = NULL;
}

CImp_DrawDlg::~CImp_DrawDlg ( )

Definition at line 50 of file Imp_Dlg.Cpp.

{
  if (m_pHandler)
    delete m_pHandler;  // Handler's destructor releases the event object.
};

Member Function Documentation

void CImp_DrawDlg::Arrived | ( | IDispatch * | pdispQueue,
 |  | long | lErrorCode,
 |  | long | lCursor
 | ) |  |

Definition at line 276 of file Imp_Dlg.Cpp.

{
  if (lErrorCode != S_OK)
  {
    // This code is what will run if the _DMSMQEventEvents->ArrivedError() Event is called.
    char szErr[30]  = "";
    itoa(lErrorCode, szErr, 16);
    CString tempString = "Method returned HRESULT: ";
    tempString += szErr;
    MessageBox(tempString, NULL, MB_ICONSTOP | MB_OK);
    return;
  };

  IMSMQMessagePtr msgIn;
  LINE      line;
  char*     strTextIn = "";
  _variant_t    vtTimeout((short) 100);
  _bstr_t     btBody;

  try
  {
    IMSMQQueuePtr q(pdispQueue);    // Creates an MSMQQueue smart pointer pointing to pdispQueue
    msgIn = q->Receive(&vtMissing, &vtMissing, &vtMissing, &vtTimeout); // Any messages?
    btBody = msgIn->Body;       // Copy the message body to my own bstr.

    strTextIn = (char*) btBody;     // Convert to char*.
    if (msgIn->BodyLength == 2)
      m_drawScribble.AddKeystroke(strTextIn);
    else
    {
      int iRes = sscanf(strTextIn, "%07ld%07ld%07ld%07ld",
        &line.ptStart.x, &line.ptStart.y,
        &line.ptEnd.x, &line.ptEnd.y);

      if (iRes != 0 && iRes != EOF)
      {
        m_drawScribble.AddLine(line);
      }
    };
  }
  catch(_com_error &comerr)
  {
    HandleErrors(comerr);
  };

  m_queue->EnableNotification(m_qevent);    // IMPORTANT: After you receive an event, you must re-enable
                        // event notification.
};

void CImp_DrawDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 56 of file Imp_Dlg.Cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CImp_DrawDlg)
  DDX_Control(pDX, IDC_DRAWAREA_SCRIBLLE, m_drawScribble);
  DDX_Text(pDX, IDC_EDIT_FRIEND, m_csFriendName);
  DDV_MaxChars(pDX, m_csFriendName, 50);
  DDX_Radio(pDX, IDC_RADIO_EXPRESS, m_iRadio);
  DDX_Control(pDX, IDC_STATIC_C_LABEL, m_cComputerLabel);
  DDX_Control(pDX, IDCANCEL, m_CancelButton);
  DDX_Control(pDX, IDC_STATIC_Q_LABEL, m_cQueueLabel);
  DDX_Control(pDX, IDC_STATIC_CHOOSE_MESSAGE, m_cMessageFrame);
  DDX_Control(pDX, IDC_STATIC_CHOOSE_DS, m_cDsFrame);
  DDX_Control(pDX, IDC_RADIO_EXPRESS, m_cRadioExpress);
  DDX_Control(pDX, IDC_RADIO_DS, m_cRadioDS);
  DDX_Control(pDX, IDC_EDIT_FRIEND_COMPUTER, m_cComputerInput);
  DDX_Control(pDX, IDC_EDIT_FRIEND, m_cQueueInput);
  DDX_Control(pDX, IDC_CONTINUE, m_cContinueButton);
  DDX_Control(pDX, IDC_BUTTON_ATTACH, m_btnAttach);
  DDX_Radio(pDX, IDC_RADIO_DS, m_iRadioDS);
  DDX_Text(pDX, IDC_EDIT_FRIEND_COMPUTER, m_strRemoteComputerName);
  DDV_MaxChars(pDX, m_strRemoteComputerName, 50);
    DDX_Control(pDX, IDC_RADIO_WORKGROUP, m_cRadioWorkgroup);
    DDX_Control(pDX, IDC_RADIO_RECOVERABLE, m_cRadioRecoverable);
  //}}AFX_DATA_MAP

}

CString CImp_DrawDlg::GetComputerName ( ) [protected]

Definition at line 119 of file Imp_Dlg.Cpp.

{
  DWORD dwsize = 255;
  char username[255];
  if (::GetComputerName(&username[0], &dwsize))
    return username;
  return "";
}

CString CImp_DrawDlg::GetUserName ( ) [protected]

Definition at line 110 of file Imp_Dlg.Cpp.

{
  DWORD dwsize = 255;
  char username[255];
  if (::GetUserName(&username[0], &dwsize))
    return username;
  return "";
};

void CImp_DrawDlg::HandleErrors ( _com_error & comerr )

Definition at line 342 of file Imp_Dlg.Cpp.

{
  HRESULT hr = comerr.Error();
  char szErr[30] = "";
  itoa(hr, szErr, 16);
  CString tempString = "The method returned the error code 0x";
  tempString += szErr;
  tempString += ".  Exiting.";
  MessageBox(tempString, NULL, MB_ICONSTOP | MB_OK);
  AfxAbort();
};

void CImp_DrawDlg::initializeUI ( BOOL fConnectedToDS )

Definition at line 643 of file Imp_Dlg.Cpp.

{
    if(fConnectedToDS)
    {
        //
        // The local computer is DS-enabled. Show the relevant controls.
        //
        m_cDsFrame.ShowWindow(SW_SHOW);
        m_cRadioDS.ShowWindow(SW_SHOW);
        m_cRadioWorkgroup.ShowWindow(SW_SHOW);
        m_cContinueButton.ShowWindow(SW_SHOW);
        m_CancelButton.ShowWindow(SW_SHOW);
    }
    else
    {
        //
        // The local computer is DS-disabled. Show the relevant controls.
        //
        m_cMessageFrame.ShowWindow(SW_SHOW);
        m_cRadioExpress.ShowWindow(SW_SHOW);
        m_cRadioRecoverable.ShowWindow(SW_SHOW);
        m_cQueueInput.ShowWindow(SW_SHOW);
        m_cQueueLabel.ShowWindow(SW_SHOW);
        m_cComputerInput.ShowWindow(SW_SHOW);
        m_cComputerLabel.ShowWindow(SW_SHOW);
        m_CancelButton.ShowWindow(SW_SHOW);
        m_btnAttach.ShowWindow(SW_SHOW);
    }

}

BOOL CImp_DrawDlg::IsDsEnabledLocaly ( )

Definition at line 598 of file Imp_Dlg.Cpp.

{
    BOOL fDSConnection = FALSE;
     IMSMQApplicationPtr qapp;
    //
    // This should work on Windows NT 4.0 and on Windows 2000 and later.
    //
    try
    {
     qapp.CreateInstance("MSMQ.MSMQApplication");
    }
    catch(_com_error &comerr)
  {
        HandleErrors(comerr);
  };

    //
    // This part handles the diffrence between Windows NT 4.0 and Windows 2000 and later.
    // It should work only on Windows 2000 and later.
    //
    try
    {
        IMSMQApplication2Ptr qapp2 = qapp;
        fDSConnection = qapp2->GetIsDsEnabled();
    }
  catch(_com_error &comerr)
  {
        HRESULT hr = comerr.Error();
    if (hr == E_NOINTERFACE || hr == E_POINTER)
        {
      //
            // No such interface is implemented, we must be using MSMQ 1.0.
            // We can continue as if the local computer is DS-enabled.
            //
            return TRUE;
        }
        else
        {
            HandleErrors(comerr);
        }
  };
    return fDSConnection;
}

CString CImp_DrawDlg::LoginPrompt ( CString DefaultName ) [protected]

Definition at line 141 of file Imp_Dlg.Cpp.

{
  CLoginDlg dialog;
  dialog.m_strLogin = DefaultName;
  UINT uId = dialog.DoModal();
    if (uId ==IDCANCEL)
    {
        //
        // exit
        //
        OnCancel();
    }
  return dialog.m_strLogin;
};

void CImp_DrawDlg::OnButtonAttach ( ) [protected]

Definition at line 456 of file Imp_Dlg.Cpp.

{

    //
    // Change the cursor to an hourglass. The constructor changes the cursor.
    // When the object goes out of scope, the cursor returns back to normal
    //
    CWaitCursor wait ;

    UpdateData(TRUE);
    IMSMQQueryPtr   queryFriend("MSMQ.MSMQQuery");  // Creates an MSMQQuery object
  IMSMQQueueInfoPtr qinfoFriend;
  IMSMQQueueInfosPtr  qinfos;

  try
    {

      if(m_fDsEnabledLocaly && m_iRadioDS == 0)
        {
            //
            // Connect to a computer in domain (standard) mode.
            //

        m_csFriendName.MakeUpper();
        m_vtFriendName = m_csFriendName;

            //
            // Locate the queue.
            //
        qinfos = queryFriend->LookupQueue(&vtMissing,&m_vtguidDraw, &m_vtFriendName);
        qinfos->Reset();
        qinfoFriend = qinfos->Next();
        if (qinfoFriend == NULL)
        {
          MessageBox("No such friend queue was found.");
        return;
        }

        }
        else if(!m_fDsEnabledLocaly || m_iRadioDS == 1)
        {
            //
            // Connect to a computer in workgroup (direct) mode.
            //

        //
            // Obtain the remote queue name and the computer name.
            //

        m_csFriendName.MakeUpper();
            if (m_strRemoteComputerName == TEXT(""))
            {
                //
                // If no remote computer name was entered, connect to the local computer.
                //

                m_strRemoteComputerName = TEXT(GetComputerName()) ;
            }
            m_strRemoteComputerName.MakeUpper();
            //
            // Construct the direct format name.
            //
        qinfoFriend.CreateInstance("MSMQ.MSMQQueueInfo");
            CString strTemp = "DIRECT=OS:";
        qinfoFriend->FormatName = (_bstr_t) LPCTSTR(strTemp + m_strRemoteComputerName + "\\private$\\" + m_csFriendName);
        qinfoFriend->Label = (_bstr_t) LPCTSTR(m_csLogin);
            //
            // When working in workgroup (direct) mode, we must use private queues. We are
            // unable to know whether a given private queue on another computer exists or not,
            // so here we shall just assume that it does. To make the application more robust,
            // an acknowledgment queue should be created on the local computer, and
            // a request for acknowledgment messages should be added to the sent messages.
            // Then the application can notify the user when a NACK message is received.
            //

        }
        //
    // If we have another friend queue open, close it.
        //
    if (m_qFriend != NULL && m_qFriend->IsOpen)
        {
      m_qFriend->Close();
        }
        //
        // Open the remote queue.
        //
    m_qFriend = qinfoFriend->Open(MQ_SEND_ACCESS, MQ_DENY_NONE);
    SetWindowText(m_csLogin + " - Connected to " + m_csFriendName);
    }
    catch (_com_error &comerr)
  {
        HRESULT hr = comerr.Error();
    if (hr != MQ_ERROR_QUEUE_NOT_FOUND )
        {
        HandleErrors(comerr);
        }
        else
        {
            MessageBox("The friend queue cannot be opened.");
        }

    }

}

void CImp_DrawDlg::OnConnect ( ) [protected]

Definition at line 675 of file Imp_Dlg.Cpp.

{
    //
    // See what the user selected.
    //
    UpdateData(TRUE);
    if(m_iRadioDS == 0)
    {
        //
        // Access to the DS is enabled, and the user chose to connect in domain (standard) mode.
        //
        //
      // Open the receiving queue and receive incoming messages.
      //
        CWaitCursor wait;
        if (!OpenReceiveQueue())
        {
            //
            // The attempt to open the receiving queue failed.
            //
            MessageBox("The receiving queue cannot be opened.");

        }

        //
        // Hide relevant controls.
        //
        m_cDsFrame.ShowWindow(SW_HIDE);
        m_cRadioDS.ShowWindow(SW_HIDE);
        m_cRadioWorkgroup.ShowWindow(SW_HIDE);
        m_cContinueButton.ShowWindow(SW_HIDE);

        //
        // -> Show relevant controls.
        //

        m_cMessageFrame.ShowWindow(SW_SHOW);
        m_cRadioExpress.ShowWindow(SW_SHOW);
        m_cRadioRecoverable.ShowWindow(SW_SHOW);
        m_cQueueInput.ShowWindow(SW_SHOW);
        m_cQueueLabel.ShowWindow(SW_SHOW);

        m_CancelButton.ShowWindow(SW_SHOW);
        m_btnAttach.ShowWindow(SW_SHOW);

    }
    else//m_iRadio == 1
    {
        //
        // Access to the DS is enabled, and the user chose to connect in workgroup (direct) mode.
        //
        //
      // Open the receiving queue and receive incoming messages.
      //
        CWaitCursor wait ;
        if (!OpenPrivateReceiveQueue())
        {
            //
            // The attempt to open the receiving queue failed.
            //
            MessageBox("The receiving queue cannot be opened.");

        }

        //
        // ->Hide relevant controls.
        //
        m_cDsFrame.ShowWindow(SW_HIDE);
        m_cRadioDS.ShowWindow(SW_HIDE);
        m_cRadioWorkgroup.ShowWindow(SW_HIDE);
        m_cContinueButton.ShowWindow(SW_HIDE);

        //
        //-> Show relevant controls.
        //
        m_cMessageFrame.ShowWindow(SW_SHOW);
        m_cRadioExpress.ShowWindow(SW_SHOW);
        m_cRadioRecoverable.ShowWindow(SW_SHOW);
        m_cQueueInput.ShowWindow(SW_SHOW);
        m_cQueueLabel.ShowWindow(SW_SHOW);
        m_cComputerInput.ShowWindow(SW_SHOW);
        m_cComputerLabel.ShowWindow(SW_SHOW);
        m_CancelButton.ShowWindow(SW_SHOW);
        m_btnAttach.ShowWindow(SW_SHOW);

    }
}

BOOL CImp_DrawDlg::OnInitDialog ( ) [protected, virtual]

Definition at line 377 of file Imp_Dlg.Cpp.

{
  CDialog::OnInitDialog();

  // Set the icon for this dialog. The framework does this automatically
  // when the application's main window is not a dialog box.
  SetIcon(m_hIcon, TRUE);     // Set big icon
  SetIcon(m_hIcon, FALSE);    // Set small icon

    //
    // Display the Logon dialog box.
    //
    CString csDefaultQueueName = GetUserName();
  m_csLogin = LoginPrompt(csDefaultQueueName);
    while (m_csLogin == "")
    {
      m_csLogin = LoginPrompt(csDefaultQueueName);
    }
    SetWindowText(m_csLogin);

    //
    // First, we have to initialize COM.
    //
  if (!AfxOleInit())
  {
    MessageBox("Failed to initialize COM.");
    exit(1);
  }

    //
    // Establish whether the local computer is enabled to access the directory
  // service (DS) and set the UI accordingly.
    //
    m_fDsEnabledLocaly = IsDsEnabledLocaly();

    if(!m_fDsEnabledLocaly)
    {
        //
        // The computer is DS-disabled. This is the right place to open the receiving queue
        // because it is a local private queue. This operation is not time-consuming.
        //
        //
      // Open the receiving queue and receive incoming messages.
      //
        if (!OpenPrivateReceiveQueue())
        {
            //
            // The attempt to open the receiving queue failed.
            //
            MessageBox("The receiving queue cannot be opened.");

        }
    }
    initializeUI(m_fDsEnabledLocaly);

    return TRUE;  // Return TRUE unless you set the focus to a control.
}

void CImp_DrawDlg::OnPaint ( void ) [protected]

Definition at line 565 of file Imp_Dlg.Cpp.

{
  if (IsIconic())
  {
    CPaintDC dc(this); // Device context for painting

    SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

    // Center the icon the in client rectangle.
    int cxIcon = GetSystemMetrics(SM_CXICON);
    int cyIcon = GetSystemMetrics(SM_CYICON);
    CRect rect;
    GetClientRect(&rect);
    int x = (rect.Width() - cxIcon + 1) / 2;
    int y = (rect.Height() - cyIcon + 1) / 2;

    // Draw the icon.
    dc.DrawIcon(x, y, m_hIcon);
  }
  else
  {
    CDialog::OnPaint();
  }
}

HCURSOR CImp_DrawDlg::OnQueryDragIcon ( ) [protected]

Definition at line 592 of file Imp_Dlg.Cpp.

{
  return (HCURSOR) m_hIcon;
}

BOOL CImp_DrawDlg::OpenPrivateReceiveQueue ( ) [protected]

Definition at line 869 of file Imp_Dlg.Cpp.

{
    try
  {

    IMSMQQueueInfoPtr qinfo;
    m_msgOut.CreateInstance("MSMQ.MSMQMessage");
    m_csLogin.MakeUpper();
    m_vtLogin = m_csLogin;

        //
        // Private queues cannot be located using a regular LookupQueue call.
        // If the queue doesn't exist, we'll try to create it and open it.
        //
        try
        {
        qinfo.CreateInstance("MSMQ.MSMQQueueInfo");
        CString csComputerName = GetComputerName();
        if (csComputerName == "")
            {
          csComputerName = ".";
            }
            qinfo->PathName = (_bstr_t) LPCTSTR(csComputerName + "\\private$\\" + m_csLogin);
        qinfo->Label = (_bstr_t) LPCTSTR(m_csLogin);
        qinfo->ServiceTypeGuid = (_bstr_t) m_vtguidDraw;
        qinfo->Create();      // Create this queue.
        }
        catch (_com_error &comerr)
        {
            HRESULT hr = comerr.Error();
      if (hr != MQ_ERROR_QUEUE_EXISTS )
            {
        throw comerr;
            }
        }

    for (int i = 0; i < 5; i++)
        {
      // We'll try to open it five times in case its creation takes time to replicate
      try
      {
        m_queue = NULL;
        m_queue = qinfo->Open(MQ_RECEIVE_ACCESS, MQ_DENY_NONE);
        if (m_queue != NULL)
                {
                    //
                    // The queue was found.
                    //
                    break;
                }
      }
      catch (_com_error &comerr)
      {
        HRESULT hr = comerr.Error();
        if (hr != MQ_ERROR_QUEUE_NOT_FOUND )
                {
          throw comerr;
                }
      }
    }

        if (m_queue == NULL)
    {
      //
            // The queue cannot be opened.
            //
      return FALSE;
    };

    // Now we'll link up with the event source.
    // The first five lines below imitate the following VB lines.

    // Dim WithEvents m_qevent as MSMQ.MSMQEvent
    // Set m_qevent = new MSMQ.MSMQEvent

    m_qevent.CreateInstance("MSMQ.MSMQEvent");
    if (m_pHandler)
        {
      delete m_pHandler;
        }
    m_pHandler = new CMSMQEventHandler();
    HRESULT hr = m_pHandler->AdviseSource(m_qevent);

    if (SUCCEEDED(hr))
        {
            //
            // If we connected in Advise Source,
        // tell MSMQ that we want events.
            //
      hr = m_queue->EnableNotification(m_qevent);
        }
  }
  catch (_com_error &comerr)
  {

        HandleErrors(comerr);
  }

    return TRUE; // The queue was opened successfully.

}

BOOL CImp_DrawDlg::OpenReceiveQueue ( ) [protected]

Definition at line 763 of file Imp_Dlg.Cpp.

{
    try
  {

    CString csComputerName;
    IMSMQQueryPtr   query("MSMQ.MSMQQuery");
    IMSMQQueueInfoPtr qinfo;
    IMSMQQueueInfosPtr  qinfos;

        //
    // Note:  You can instantiate a smart pointer from a ProgID using one of
    // two methods. As above (the query object), you can pass the ProgID during
    // construction or, as below (m_msgOut), you can call the CreateInstance()
    // member function.
        //
    m_msgOut.CreateInstance("MSMQ.MSMQMessage");
    m_csLogin.MakeUpper();

    m_vtLogin = m_csLogin;
    qinfos = query->LookupQueue(&vtMissing,&m_vtguidDraw, &m_vtLogin);  // Look for the user's queue.
    qinfos->Reset();
    qinfo = qinfos->Next();

        //
        // If the queue does not exist, create it.
        //
    if (qinfo == NULL)
    {
      qinfo.CreateInstance("MSMQ.MSMQQueueInfo");
      csComputerName = GetComputerName();
      if (csComputerName == "")
            {
        csComputerName = ".";
            }
      qinfo->PathName = (_bstr_t) LPCTSTR(csComputerName + "\\" + m_csLogin);
      qinfo->Label = (_bstr_t) LPCTSTR(m_csLogin);
      qinfo->ServiceTypeGuid = (_bstr_t) m_vtguidDraw;
      qinfo->Create();      // Create this queue.
    };

    for (int i = 0; i < 5; i++)
        {
      // Try to open it five times in case its creation takes time to replicate.
      try
      {
        m_queue = NULL;
        m_queue = qinfo->Open(MQ_RECEIVE_ACCESS, MQ_DENY_NONE);
        if (m_queue != NULL)
                {
                    //
                    // The queue was found.
                    //
                    break;
                }
      }
      catch (_com_error &comerr)
      {
        HRESULT hr = comerr.Error();
        if (hr != MQ_ERROR_QUEUE_NOT_FOUND)
                {
          throw comerr;
                }
      }
    }

        if (m_queue == NULL)
    {
      //
            // The queue cannot be opened.
            //
      return FALSE;
    };

    // Now we'll link up with the event source.
    // The first five lines below imitate the following VB lines.

    // Dim WithEvents m_qevent as MSMQ.MSMQEvent
    // Set m_qevent = new MSMQ.MSMQEvent

    m_qevent.CreateInstance("MSMQ.MSMQEvent");
    if (m_pHandler)
        {
      delete m_pHandler;
        }
    m_pHandler = new CMSMQEventHandler();
    HRESULT hr = m_pHandler->AdviseSource(m_qevent);

    if (SUCCEEDED(hr))
        {
            //
            // If we connected in Advise Source,
        // tell MSMQ that we want events.
            //
      hr = m_queue->EnableNotification(m_qevent);
        }
  }
  catch (_com_error &comerr)
  {
    HandleErrors(comerr);
  };

    return TRUE; // The queue was opened successfully.

}

void CImp_DrawDlg::SendKeystroke ( UINT uChar )

Definition at line 227 of file Imp_Dlg.Cpp.

{
  try
  {
    // First, the friend queue must be defined and opened.
    if (m_qFriend != NULL && m_qFriend->IsOpen)
    {
      // Next, push the character into a variant.
      _variant_t vtChar((char*)&uChar);

      // Now set up the message properties.
      m_msgOut->Priority = 4;
      m_msgOut->Body = &vtChar;
      m_msgOut->Label = "Key: " + uChar;
      m_msgOut->Delivery = m_iRadio;

      // Lastly, send the message.
      m_msgOut->Send(m_qFriend);
    };
  }
  catch(_com_error &comerr)
  {
    HandleErrors(comerr);
  };
};

void CImp_DrawDlg::SendMouseMovement ( LINE line )

Definition at line 173 of file Imp_Dlg.Cpp.

{
  try
  {
    if (m_qFriend != NULL && m_qFriend->IsOpen)
    {
      m_msgOut->Priority = 3;

      /* Pack the data into one line (twice). */
      WCHAR wcsBody[MAX_MSG_BODY_LEN];
      swprintf(wcsBody, L"%07ld%07ld%07ld%07ld",
           line.ptStart.x, line.ptStart.y, line.ptEnd.x, line.ptEnd.y);

      WCHAR wcsLabel[MQ_MAX_MSG_LABEL_LEN];
      swprintf(wcsLabel, L"%07ld,%07ld To %07ld,%07ld",
           line.ptStart.x, line.ptStart.y, line.ptEnd.x, line.ptEnd.y);

      /* Initialize a variant with the wcsbody data. */
      _variant_t  vtBody(wcsBody);

      // Setup the message properties.
      m_msgOut->Body = vtBody;
      m_msgOut->Label = wcsLabel;
      m_msgOut->Delivery = m_iRadio;

      // Send the message.
      m_msgOut->Send(m_qFriend);
    };
  }
  catch(_com_error &comerr)
  {
    HandleErrors(comerr);
  };
};

Member Data Documentation

CButton CImp_DrawDlg::m_btnAttach

Definition at line 57 of file Imp_Dlg.h.

CButton CImp_DrawDlg::m_CancelButton

Definition at line 48 of file Imp_Dlg.h.

CEdit CImp_DrawDlg::m_cComputerInput

Definition at line 54 of file Imp_Dlg.h.

CStatic CImp_DrawDlg::m_cComputerLabel

Definition at line 47 of file Imp_Dlg.h.

CButton CImp_DrawDlg::m_cContinueButton

Definition at line 56 of file Imp_Dlg.h.

CButton CImp_DrawDlg::m_cDsFrame

Definition at line 51 of file Imp_Dlg.h.

int CImp_DrawDlg::m_cLines

Definition at line 82 of file Imp_Dlg.h.

CButton CImp_DrawDlg::m_cMessageFrame

Definition at line 50 of file Imp_Dlg.h.

CEdit CImp_DrawDlg::m_cQueueInput

Definition at line 55 of file Imp_Dlg.h.

CStatic CImp_DrawDlg::m_cQueueLabel

Definition at line 49 of file Imp_Dlg.h.

CButton CImp_DrawDlg::m_cRadioDS

Definition at line 53 of file Imp_Dlg.h.

CButton CImp_DrawDlg::m_cRadioExpress

Definition at line 52 of file Imp_Dlg.h.

CButton CImp_DrawDlg::m_cRadioRecoverable

Definition at line 61 of file Imp_Dlg.h.

CButton CImp_DrawDlg::m_cRadioWorkgroup

Definition at line 60 of file Imp_Dlg.h.

CString CImp_DrawDlg::m_csFriendName

Definition at line 45 of file Imp_Dlg.h.

CString CImp_DrawDlg::m_csLogin

Definition at line 86 of file Imp_Dlg.h.

CString CImp_DrawDlg::m_csScreenText

Definition at line 84 of file Imp_Dlg.h.

CDrawArea CImp_DrawDlg::m_drawScribble

Definition at line 44 of file Imp_Dlg.h.

BOOL CImp_DrawDlg::m_fDsEnabledLocaly [protected]

Definition at line 111 of file Imp_Dlg.h.

HICON CImp_DrawDlg::m_hIcon [protected]

Definition at line 112 of file Imp_Dlg.h.

int CImp_DrawDlg::m_iArraySize

Definition at line 83 of file Imp_Dlg.h.

int CImp_DrawDlg::m_iRadio

Definition at line 46 of file Imp_Dlg.h.

int CImp_DrawDlg::m_iRadioDS

Definition at line 58 of file Imp_Dlg.h.

int CImp_DrawDlg::m_iWasText

Definition at line 85 of file Imp_Dlg.h.

long CImp_DrawDlg::m_lLastX

Definition at line 79 of file Imp_Dlg.h.

long CImp_DrawDlg::m_lLastY

Definition at line 80 of file Imp_Dlg.h.

IMSMQMessagePtr CImp_DrawDlg::m_msgOut

Definition at line 91 of file Imp_Dlg.h.

CMSMQEventHandler* CImp_DrawDlg::m_pHandler [protected]

Definition at line 118 of file Imp_Dlg.h.

IMSMQEventPtr CImp_DrawDlg::m_qevent

Definition at line 89 of file Imp_Dlg.h.

IMSMQQueuePtr CImp_DrawDlg::m_qFriend

Definition at line 90 of file Imp_Dlg.h.

IMSMQQueuePtr CImp_DrawDlg::m_queue

Definition at line 88 of file Imp_Dlg.h.

CString CImp_DrawDlg::m_strRemoteComputerName

Definition at line 59 of file Imp_Dlg.h.

_variant_t CImp_DrawDlg::m_vtFriendName

Definition at line 76 of file Imp_Dlg.h.

_variant_t CImp_DrawDlg::m_vtguidDraw

Definition at line 77 of file Imp_Dlg.h.

_variant_t CImp_DrawDlg::m_vtLogin

Definition at line 75 of file Imp_Dlg.h.

The documentation for this class was generated from the following files:
  • NetDS/MessageQueuing/Imp_Draw/Imp_Dlg.h
  • NetDS/MessageQueuing/Imp_Draw/Imp_Dlg.Cpp
Generated on Wed Nov 13 2024 16:56:40 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CImp_DrawDlg::Line Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • CImp_DrawDlg
  • CImp_DrawDlg::Line
Public Attributes

CImp_DrawDlg::Line Struct Reference

#include "Imp_Dlg.h"

List of all members.

Public Attributes

long | X1
long | X2
long | Y1
long | Y2

Detailed Description

Definition at line 67 of file Imp_Dlg.h.

Member Data Documentation

long CImp_DrawDlg::Line::X1

Definition at line 69 of file Imp_Dlg.h.

long CImp_DrawDlg::Line::X2

Definition at line 71 of file Imp_Dlg.h.

long CImp_DrawDlg::Line::Y1

Definition at line 70 of file Imp_Dlg.h.

long CImp_DrawDlg::Line::Y2

Definition at line 72 of file Imp_Dlg.h.

The documentation for this struct was generated from the following file:
  • NetDS/MessageQueuing/Imp_Draw/Imp_Dlg.h
Generated on Wed Nov 13 2024 16:56:40 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CImpAuth Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CImpAuth Class Reference

#include "Sample1.h"

List of all members.

Public Member Functions

CImpAuth ()
~CImpAuth ()
virtual ULONG STDMETHODCALLTYPE | AddRef (void)
virtual HRESULT STDMETHODCALLTYPE | Authenticate (HWND *phwnd, LPWSTR *pwszUserName, LPWSTR *pwszPassword)
virtual HRESULT STDMETHODCALLTYPE | QueryInterface (REFIID iid, void **ppvObject)
virtual ULONG STDMETHODCALLTYPE | Release (void)
HRESULT | Set (LPWSTR wszUserName, LPWSTR wszPassword)

Private Attributes

ULONG m_nRefs
LPWSTR | m_wszPassword
LPWSTR | m_wszUserName

Detailed Description

Definition at line 69 of file Sample1.h.

Constructor & Destructor Documentation

CImpAuth::CImpAuth ( )

Definition at line 19 of file IAuth.Cpp.

{
   m_nRefs = 0;
   m_wszUserName = NULL;
   m_wszPassword = NULL;
}

CImpAuth::~CImpAuth ( )

Definition at line 29 of file IAuth.Cpp.

{
   if(NULL != m_wszUserName)
   {
      delete [] m_wszUserName;
   }

   if(NULL != m_wszPassword)
   {
      delete [] m_wszPassword;
   }
}

Member Function Documentation

ULONG CImpAuth::AddRef ( void ) [virtual]

Definition at line 70 of file IAuth.Cpp.

{
   return (++m_nRefs);
}

HRESULT STDMETHODCALLTYPE CImpAuth::Authenticate | ( | HWND * | phwnd,
 |  | LPWSTR * | pwszUserName,
 |  | LPWSTR * | pwszPassword |
 | ) |  |  | [virtual]

Definition at line 102 of file IAuth.Cpp.

{
   if(   (NULL == phwnd)
      || (NULL == pwszUserName)
      || (NULL == pwszPassword) )
   {
      return E_INVALIDARG;
   }

   if( (NULL == m_wszUserName) || (NULL == m_wszPassword) )
   {
      *phwnd = GetDesktopWindow();

      *pwszUserName = NULL;

      *pwszPassword = NULL;
   }
   else
   {
      *phwnd = (HWND)INVALID_HANDLE_VALUE;

      *pwszUserName = (LPWSTR)CoTaskMemAlloc(
                                 (wcslen(m_wszUserName) + 1) * sizeof(WCHAR));
      if(NULL == *pwszUserName)
      {
         *pwszUserName = NULL;

         return E_OUTOFMEMORY;
      }

      *pwszPassword = (LPWSTR)CoTaskMemAlloc(
                                 (wcslen(m_wszPassword) + 1) * sizeof(WCHAR));
      if(NULL == *pwszPassword)
      {
         CoTaskMemFree(*pwszUserName);
         *pwszUserName=NULL;

         return E_OUTOFMEMORY;
      }

      wcscpy(*pwszUserName, m_wszUserName);

      wcscpy(*pwszPassword, m_wszPassword);
   }

   return S_OK;
}

HRESULT CImpAuth::QueryInterface | ( | REFIID | iid,
 |  | void ** | ppvObject |
 | ) |  |  | [virtual]

Definition at line 45 of file IAuth.Cpp.

{
   if(NULL == ppvObject)
   {
      return E_INVALIDARG;
   }

   if((IID_IAuthenticate == iid)
      || (IID_IUnknown == iid))
   {
      *ppvObject = this;
      m_nRefs++;

      return S_OK;
   }
   else
   {
      *ppvObject = NULL;
      return E_NOINTERFACE;
   }
}

ULONG CImpAuth::Release ( void ) [virtual]

Definition at line 78 of file IAuth.Cpp.

{
   ULONG nRef = (--m_nRefs);

   if(0 >= nRef)
   {
      delete this;
   }

   return nRef;
}

HRESULT CImpAuth::Set | ( | LPWSTR | wszUserName,
 |  | LPWSTR | wszPassword
 | ) |  |

Definition at line 161 of file IAuth.Cpp.

{
   if((NULL == wszUserName)
      || (NULL == wszPassword))
   {
      return E_INVALIDARG;
   }

   m_wszUserName = DuplicateWSTR(wszUserName);
   if(NULL == m_wszUserName)
   {
      return E_OUTOFMEMORY;
   }

   m_wszPassword = DuplicateWSTR(wszPassword);
   if(NULL == m_wszPassword)
   {
      delete [] m_wszPassword;
      return E_OUTOFMEMORY;
   }

   return S_OK;
}

Member Data Documentation

ULONG CImpAuth::m_nRefs [private]

Definition at line 97 of file Sample1.h.

LPWSTR CImpAuth::m_wszPassword [private]

Definition at line 100 of file Sample1.h.

LPWSTR CImpAuth::m_wszUserName [private]

Definition at line 99 of file Sample1.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/internetpublishing/ippsample/Sample1.h
  • Dataaccess/oledb/internetpublishing/ippsample/IAuth.Cpp
Generated on Wed Nov 13 2024 16:56:40 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CImpIAccessor Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes | Friends

CImpIAccessor Class Reference

#include "accessor.h"

List of all members.

Public Member Functions

DEFINE_DEFAULT_IUNKNOWN_ADDREF_RELEASE
STDMETHODIMP 		AddRefAccessor (HACCESSOR hAccessor, DBREFCOUNT *pcRefCounts)
STDMETHODIMP | CopyAccessors (LPEXTBUFFER pextbufferAccessor)
STDMETHODIMP | CreateAccessor (DBACCESSORFLAGS, DBCOUNTITEM, const DBBINDING rgBindings[], DBLENGTH, HACCESSOR *, DBBINDSTATUS rgStatus[])
DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR (CBaseObj, CImpIAccessor)
STDMETHODIMP | FInit (BOOL fUnderRowset)
STDMETHODIMP | GetBindings (HACCESSOR, DBACCESSORFLAGS *, DBCOUNTITEM *, DBBINDING **)
STDMETHODIMP | ReleaseAccessor (HACCESSOR, DBREFCOUNT *)

Private Attributes

LPEXTBUFFER m_pextbufferAccessor

Friends

class | CImpIAccessor
class | CCommand
class | CRowset

Detailed Description

Definition at line 17 of file accessor.h.

Member Function Documentation

STDMETHODIMP CImpIAccessor::AddRefAccessor | ( | HACCESSOR | hAccessor,
 |  | DBREFCOUNT * | pcRefCounts
 | ) |  |

Definition at line 79 of file accessor.cpp.

{
    // Retrieve our accessor structure from the client's hAccessor,
    // free it, then mark accessor ptr as unused.
    // We do not re-use accessor handles.  This way, we hope
    // to catch more client errors.  (Also, ExtBuffer doesn't
    // maintain a free list, so it doesn't know how to.)

    PACCESSOR   pAccessor;

    if( pcRefCounts )
    *pcRefCounts = 0;

  m_pextbufferAccessor->GetItemOfExtBuffer(hAccessor, &pAccessor);
    if( !pAccessor )
        return DB_E_BADACCESSORHANDLE;

  InterlockedIncrement((LONG*)&(pAccessor->cRef));

  if( pcRefCounts )
    *pcRefCounts = (DBREFCOUNT)(pAccessor->cRef);

  return ResultFromScode( S_OK );
}

STDMETHODIMP CImpIAccessor::CopyAccessors ( LPEXTBUFFER pextbufferAccessor )

Definition at line 446 of file accessor.cpp.

{
  HACCESSOR hAccessor, hAccessorFirst, hAccessorLast, hAccessorDup;
  ULONG   cbAccessor;
  PACCESSOR paccessor=NULL, paccessorNew=NULL, paccessorNull=NULL;
  HRESULT   hr;

  assert(pextbufferAccessor);

  if(pextbufferAccessor)
  {
    // Get the number of available accessors.
    m_pextbufferAccessor->GetFirstLastItemH(hAccessorFirst, hAccessorLast);

    for(hAccessor=hAccessorFirst; hAccessor <= hAccessorLast; hAccessor++)
    {
      hr = m_pextbufferAccessor->GetItemOfExtBuffer(hAccessor, &paccessor );
      if( FAILED(hr) )
        return hr;

      if (paccessor == NULL)
        paccessorNew = paccessorNull;
      else
      {
        // Allocate space for the accessor structure.
        // 64 bit TODO
        cbAccessor = sizeof(ACCESSOR)
                + (ULONG)(paccessor->cBindings ?
                  (ULONG)(paccessor->cBindings-1) : 0)
                  * sizeof(DBBINDING);

        paccessorNew = (PACCESSOR) new BYTE [cbAccessor];
        if (paccessorNew == NULL)
          return ResultFromScode(E_OUTOFMEMORY);

        memcpy( paccessorNew, paccessor, cbAccessor);

        paccessorNew->cRef = 1;
      }

      // Insert accessor ptr into the new buffer.
      hr = pextbufferAccessor->InsertIntoExtBuffer(&paccessorNew, hAccessorDup);

      // Can fail because of Out-Of-Memory condition.
      if(FAILED(hr))
      {
        SAFE_DELETE(paccessorNew);
        return hr;
      }
    }
  }

  return NOERROR;
}

STDMETHODIMP CImpIAccessor::CreateAccessor | ( | DBACCESSORFLAGS | dwAccessorFlags,
 |  | DBCOUNTITEM | cBindings,
 |  | const DBBINDING | rgBindings[],
 |  | DBLENGTH | cbRowSize,
 |  | HACCESSOR * | phAccessor,
 |  | DBBINDSTATUS | rgStatus[]
 | ) |  |

Definition at line 126 of file accessor.cpp.

{
    PACCESSOR   pAccessor;
    HACCESSOR   hAccessor;
    DBCOUNTITEM cBind;
    DBORDINAL   cCols;
    HRESULT     hr;

    // Check Parameters
    if( (cBindings && !rgBindings) || (phAccessor == NULL) )
        return ResultFromScode( E_INVALIDARG );

    // init out params
    *phAccessor = NULL;

  // Check if we have a correct accessor type
    if ( dwAccessorFlags & DBACCESSOR_PASSBYREF )
        return ResultFromScode( DB_E_BYREFACCESSORNOTSUPPORTED );

  // Only allow DBACCESSOR_ROWDATA and DBACCESSOR_OPTIMIZED
    if ( (dwAccessorFlags & ~DBACCESSOR_OPTIMIZED ) != DBACCESSOR_ROWDATA )
        return ResultFromScode( DB_E_BADACCESSORFLAGS );

  // Check for NULL Accessor on the Command Object
  // Also check for NULL Accessor on a read only rowset
  if( (m_pObj->GetBaseObjectType() == BOT_COMMAND && !cBindings) ||
    (m_pObj->GetBaseObjectType() == BOT_ROWSET  && !cBindings && !((CRowset *)m_pObj)->SupportIRowsetChange()) )
    return ResultFromScode( DB_E_NULLACCESSORNOTSUPPORTED );

  // Check for Optimized Accessor on the Rowset Object after Fetch
  if( (dwAccessorFlags & DBACCESSOR_OPTIMIZED) &&
    m_pObj->GetBaseObjectType() == BOT_ROWSET && ((CRowset *)m_pObj)->m_cRows )
    return ResultFromScode( DB_E_BADACCESSORFLAGS );

  // Initialize the status array to DBBINDSTATUS_OK.
  // 64 bit TODO
  if ( rgStatus )
    memset(rgStatus, 0x00, (ULONG)(cBindings * sizeof(DBBINDSTATUS)));

    // Check on the bindings the user gave us.
    for (cBind=0, hr=NOERROR; cBind < cBindings; cBind++)
    {
    // other binding problems forbidden by OLE-DB
        const DBTYPE currType = rgBindings[cBind].wType;
        const DBTYPE currTypePtr = currType &
                  (DBTYPE_BYREF|DBTYPE_ARRAY|DBTYPE_VECTOR);
    const DBTYPE currTypeBase = currType &
              ~(DBTYPE_BYREF|DBTYPE_ARRAY|DBTYPE_VECTOR);
        const DWORD  currFlags = rgBindings[cBind].dwFlags;

        cCols = rgBindings[cBind].iOrdinal;

    // Check for a Bad Ordinal
    if( m_pObj->GetBaseObjectType() == BOT_ROWSET )
    {
      // make sure column number is in range
      if ( !(0 < cCols && cCols <= ((CRowset *) m_pObj)->m_cCols) )
      {
        // Set Bind status to DBBINDSTATUS_BADORDINAL
        hr = ResultFromScode( DB_E_ERRORSOCCURRED );
        if ( rgStatus )
          rgStatus[cBind] = DBBINDSTATUS_BADORDINAL;
        continue;
      }
    }

    // At least one of these valid parts has to be set. In SetData I assume it is the case.
        if ( !(rgBindings[cBind].dwPart & (DBPART_VALUE|DBPART_LENGTH|DBPART_STATUS)) )
    {
      // Set Bind status to DBBINDSTATUS_BADBINDINFO
            hr = ResultFromScode( DB_E_ERRORSOCCURRED );
      if ( rgStatus )
        rgStatus[cBind] = DBBINDSTATUS_BADBINDINFO;
        }

    // dwPart is something other than value, length, or status
    else if ( (rgBindings[cBind].dwPart & ~(DBPART_VALUE|DBPART_LENGTH|DBPART_STATUS)) )
    {
      // Set Bind status to DBBINDSTATUS_BADBINDINFO
            hr = ResultFromScode( DB_E_ERRORSOCCURRED );
      if ( rgStatus )
        rgStatus[cBind] = DBBINDSTATUS_BADBINDINFO;
        }

    // wType was DBTYPE_EMPTY or DBTYPE_NULL
    else if ( (currType==DBTYPE_EMPTY || currType==DBTYPE_NULL) )
    {
      // Set Bind status to DBBINDSTATUS_BADBINDINFO
            hr = ResultFromScode( DB_E_ERRORSOCCURRED );
      if ( rgStatus )
        rgStatus[cBind] = DBBINDSTATUS_BADBINDINFO;
        }

    // wType was DBTYPE_BYREF or'ed with DBTYPE_EMPTY, NULL, or RESERVED
    else if ( ((currType & DBTYPE_BYREF) &&
        (currTypeBase == DBTYPE_EMPTY || currTypeBase == DBTYPE_NULL ||
         currType & DBTYPE_RESERVED)) )
    {
      // Set Bind status to DBBINDSTATUS_BADBINDINFO
            hr = ResultFromScode( DB_E_ERRORSOCCURRED );
      if ( rgStatus )
        rgStatus[cBind] = DBBINDSTATUS_BADBINDINFO;
        }

    // dwFlags was DBBINDFLAG_HTML and the type was not a String
    else if ( currFlags && (currFlags != DBBINDFLAG_HTML ||
         (currTypeBase != DBTYPE_STR  &&
          currTypeBase != DBTYPE_WSTR &&
          currTypeBase != DBTYPE_BSTR)) )
    {
      // Set Bind status to DBBINDSTATUS_BADBINDINFO
            hr = ResultFromScode( DB_E_ERRORSOCCURRED );
      if ( rgStatus )
        rgStatus[cBind] = DBBINDSTATUS_BADBINDINFO;
        }

    // wType was used with more than one type indicators
    else if ( !(currTypePtr == 0 || currTypePtr == DBTYPE_BYREF ||
        currTypePtr == DBTYPE_ARRAY || currTypePtr == DBTYPE_VECTOR) )
    {
      // Set Bind status to DBBINDSTATUS_BADBINDINFO
            hr = ResultFromScode( DB_E_ERRORSOCCURRED );
      if ( rgStatus )
        rgStatus[cBind] = DBBINDSTATUS_BADBINDINFO;
        }

    // wType was a non pointer type with provider owned memory
    else if ( !currTypePtr &&
       rgBindings[cBind].dwMemOwner==DBMEMOWNER_PROVIDEROWNED )
    {
      // Set Bind status to DBBINDSTATUS_BADBINDINFO
            hr = ResultFromScode( DB_E_ERRORSOCCURRED );
      if ( rgStatus )
        rgStatus[cBind] = DBBINDSTATUS_BADBINDINFO;
        }

    // we only support client owned memory
    else if ( rgBindings[cBind].dwMemOwner != DBMEMOWNER_CLIENTOWNED )
    {
      // Set Bind status to DBBINDSTATUS_BADBINDINFO
            hr = ResultFromScode( DB_E_ERRORSOCCURRED );
      if ( rgStatus )
        rgStatus[cBind] = DBBINDSTATUS_BADBINDINFO;
        }
    }

    // Any errors amongst those checks?
    if (hr != NOERROR)
    {
        return hr;
    }

    // Make a copy of the client's binding array, and the type of binding.
  // 64 bit TODO
    pAccessor = (ACCESSOR *) new BYTE[sizeof( ACCESSOR ) + ((ULONG)cBindings - 1) *sizeof( DBBINDING )];
    if ( pAccessor == NULL )
        return ResultFromScode( E_OUTOFMEMORY );

    // We store a ptr to the newly created variable-sized ACCESSOR.
    // We have an array of ptrs (to ACCESSOR's).
    // The handle is the index into the array of ptrs.
    // The InsertIntoExtBuffer function appends to the end of the array.
    assert( m_pextbufferAccessor );
    hr = m_pextbufferAccessor->InsertIntoExtBuffer(&pAccessor, hAccessor);
    if ( FAILED( hr ) )
  {
        SAFE_DELETE( pAccessor );
        return ResultFromScode( E_OUTOFMEMORY );
  }
    assert( hAccessor );

    // Copy the client's bindings into the ACCESSOR.
    pAccessor->dwAccessorFlags  = dwAccessorFlags;
    pAccessor->cBindings    = cBindings;
    pAccessor->cRef       = 1;    // Establish Reference count.
  // 64 bit TODO
  memcpy( &(pAccessor->rgBindings[0]), &rgBindings[0], (ULONG)cBindings*sizeof( DBBINDING ));

    // fill out-param and return
    *phAccessor = hAccessor;
    return ResultFromScode( S_OK );
}

CImpIAccessor::DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR | ( | CBaseObj | ,
 |  | CImpIAccessor |
 | ) |  |
STDMETHODIMP CImpIAccessor::FInit ( BOOL fUnderRowset )

Definition at line 28 of file accessor.cpp.

{
  // Create the Extended Buffer array.
    // This is an array of pointers to malloc'd accessors.
    m_pextbufferAccessor = (LPEXTBUFFER) new CExtBuffer;
    if (m_pextbufferAccessor == NULL || FAILED( m_pextbufferAccessor->FInit( 1, sizeof( PACCESSOR ), g_dwPageSize )))
        return ResultFromScode( E_OUTOFMEMORY );

  // If aggregated under Rowset do the following:
  if(fUnderRowset)
  {
    // For efficiency reasons put a copy of the accessors buffer
    // directly on the CRowset object.
    ((CRowset *)m_pObj)->m_pextbufferAccessor = m_pextbufferAccessor;

    HRESULT     hr;
    CCommand      *pCCommand;
    CImpIAccessor *pIAccessorCommand;

    // See if there are any accessors created on the Command object, and if so
    // copy their handles so they can be used on the Rowset.
    pCCommand = ((CRowset *)m_pObj)->m_pCreator;
    if(pCCommand)
    {
      if(SUCCEEDED(pCCommand->QueryInterface(IID_IAccessor, (void **)&pIAccessorCommand)) && pIAccessorCommand)
      {
        // Copy handles.
        hr = pIAccessorCommand->CopyAccessors(m_pextbufferAccessor);
        pIAccessorCommand->Release();
        if(FAILED(hr))
          return hr;
      }
    }
  }

  return NOERROR;
}

STDMETHODIMP CImpIAccessor::GetBindings | ( | HACCESSOR | hAccessor,
 |  | DBACCESSORFLAGS * | pdwAccessorFlags,
 |  | DBCOUNTITEM * | pcBindings,
 |  | DBBINDING ** | prgBindings
 | ) |  |

Definition at line 329 of file accessor.cpp.

{
    // Retrieve our accessor structure from the client's hAccessor,
    // make a copy of the bindings for the user, then done.
    PACCESSOR   pAccessor;
    ULONG       cBindingSize;

    // init out-params
  if( pdwAccessorFlags )
    *pdwAccessorFlags = 0;
  if( pcBindings )
    *pcBindings = 0;
  if ( prgBindings )
    *prgBindings = NULL;

    // check parameters
    if (!pdwAccessorFlags || !pcBindings || !prgBindings)
        return ResultFromScode( E_INVALIDARG );

    // Validate Accessor Handle
    m_pextbufferAccessor->GetItemOfExtBuffer(hAccessor, &pAccessor);
    if( !pAccessor )
        return DB_E_BADACCESSORHANDLE;

    // Allocate and return Array of bindings
  // 64 bit TODO
    cBindingSize = (ULONG)pAccessor->cBindings * sizeof( DBBINDING );
  if ( cBindingSize )
    *prgBindings = (DBBINDING *) PROVIDER_ALLOC( cBindingSize );

  // Check the Allocation
  if ( ( *prgBindings == NULL ) && ( cBindingSize ) )
        return ResultFromScode( E_OUTOFMEMORY );

    *pdwAccessorFlags = pAccessor->dwAccessorFlags;
    *pcBindings = pAccessor->cBindings;
    memcpy( *prgBindings, pAccessor->rgBindings, cBindingSize );

    // all went well..
    return ResultFromScode( S_OK );
}

STDMETHODIMP CImpIAccessor::ReleaseAccessor | ( | HACCESSOR | hAccessor,
 |  | DBREFCOUNT * | pcRefCounts
 | ) |  |

Definition at line 387 of file accessor.cpp.

{
    // Retrieve our accessor structure from the client's hAccessor,
    // free it, then mark accessor ptr as unused.
    // We do not re-use accessor handles.  This way, we hope
    // to catch more client errors.  (Also, ExtBuffer doesn't
    // maintain a free list, so it doesn't know how to.)

    PACCESSOR   pAccessor;

  if( pcRefCounts )
    *pcRefCounts = 0;

    m_pextbufferAccessor->GetItemOfExtBuffer(hAccessor, &pAccessor);
    if( !pAccessor )
        return DB_E_BADACCESSORHANDLE;

    // Free the actual structure.
  InterlockedDecrement((LONG*)&(pAccessor->cRef));

  if( pAccessor->cRef <= 0 )
  {
    SAFE_DELETE( pAccessor );
    if( pcRefCounts )
      *pcRefCounts = 0;

      // Store a null in our array-of-ptrs,
      // so we know next time that it is invalid.
      // (operator[] returns a ptr to the space where the ptr is stored.)
      *(PACCESSOR*) ((*m_pextbufferAccessor)[hAccessor]) = NULL;
  }
  else
  {
    if( pcRefCounts )
      *pcRefCounts = (DBREFCOUNT)(pAccessor->cRef);
  }

    return ResultFromScode( S_OK );
}

Friends And Related Function Documentation

friend class CImpIAccessor [friend]

Definition at line 20 of file accessor.h.

friend class CCommand [friend]

Definition at line 22 of file accessor.h.

friend class CRowset [friend]

Definition at line 21 of file accessor.h.

Member Data Documentation

LPEXTBUFFER CImpIAccessor::m_pextbufferAccessor [private]

Definition at line 28 of file accessor.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/sampprov/accessor.h
  • Dataaccess/oledb/sampprov/accessor.cpp
Generated on Wed Nov 13 2024 16:56:40 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CImpIAdviseSink Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Protected Attributes

CImpIAdviseSink Class Reference

#include "Site.h"

List of all members.

Public Member Functions

CImpIAdviseSink (class CSite *, IUnknown *)
~CImpIAdviseSink (void)
STDMETHODIMP | QueryInterface (REFIID, void **)
STDMETHODIMP_ (void) OnRename(LPMONIKER)
STDMETHODIMP_ (void) OnViewChange(DWORD
STDMETHODIMP_ (void) OnDataChange(LPFORMATETC
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP_ (void) OnSave(void)
STDMETHODIMP_ (void) OnClose(void)

Public Attributes

LONG
LPSTGMEDIUM

Protected Attributes

ULONG m_cRef
class CSite * | m_pSite
LPUNKNOWN | m_pUnkOuter

Detailed Description

Definition at line 56 of file Site.h.

Constructor & Destructor Documentation

CImpIAdviseSink::CImpIAdviseSink | ( | class CSite * | ,
 |  | IUnknown * |
 | ) |  |
CImpIAdviseSink::~CImpIAdviseSink ( void )

Definition at line 46 of file IAdvSink.Cpp.

    {
    return;
    }

Member Function Documentation

STDMETHODIMP CImpIAdviseSink::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppv
 | ) |  |

Definition at line 63 of file IAdvSink.Cpp.

    {
    return m_pUnkOuter->QueryInterface(riid, ppv);
    }

CImpIAdviseSink::STDMETHODIMP_ ( void )
CImpIAdviseSink::STDMETHODIMP_ ( void )
CImpIAdviseSink::STDMETHODIMP_ ( void )
CImpIAdviseSink::STDMETHODIMP_ ( void )
CImpIAdviseSink::STDMETHODIMP_ ( void )
CImpIAdviseSink::STDMETHODIMP_ ( ULONG )
CImpIAdviseSink::STDMETHODIMP_ ( ULONG )

Member Data Documentation

CImpIAdviseSink::LONG

Definition at line 72 of file Site.h.

CImpIAdviseSink::LPSTGMEDIUM

Definition at line 71 of file Site.h.

ULONG CImpIAdviseSink::m_cRef [protected]

Definition at line 59 of file Site.h.

class CSite* CImpIAdviseSink::m_pSite [protected]

Definition at line 60 of file Site.h.

LPUNKNOWN CImpIAdviseSink::m_pUnkOuter [protected]

Definition at line 61 of file Site.h.

The documentation for this class was generated from the following files:
  • Com/Fundamentals/ActiveDocument/Framer/Site.h
  • Com/Fundamentals/ActiveDocument/Framer/IAdvSink.Cpp
Generated on Wed Nov 13 2024 16:56:40 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CImpIBindResource Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CImpIBindResource Class Reference

#include "binder.h"

List of all members.

Public Member Functions

DEFINE_DEFAULT_IUNKNOWN_ADDREF_RELEASE
STDMETHODIMP 		Bind (IUnknown *pUnkOuter, LPCOLESTR pwszURL, DWORD dwBindFlags, REFGUID rguid, REFIID riid, IAuthenticate *pAuthenticate, DBIMPLICITSESSION *pImplSession, DWORD *pdwBindStatus, IUnknown **ppUnk)
HRESULT | BindDSO (IUnknown *pUnkOuter, REFIID riid, BOOL fWaitForInit, WCHAR *pwszDataSource, IUnknown **ppUnk)
HRESULT | BindRow (IUnknown *pUnkOuter, REFIID riid, DBIMPLICITSESSION *pImplSession, WCHAR *pwszDataSource, WCHAR *pwszFile, ULONG ulRowNum, IUnknown **ppUnk)
HRESULT | BindRowset (IUnknown *pUnkOuter, REFIID riid, DBIMPLICITSESSION *pImplSession, WCHAR *pwszDataSource, WCHAR *pwszFile, IUnknown **ppUnk)
HRESULT | BindSession (IUnknown *pUnkOuter, REFIID riid, WCHAR *pwszDataSource, IUnknown **ppUnk)
HRESULT | BindSession (DBIMPLICITSESSION *pImplSession, WCHAR *pwszDataSource)
HRESULT | BindStream (IUnknown *pUnkOuter, REFIID riid, DBIMPLICITSESSION *pImplSession, WCHAR *pwszDataSource, WCHAR *pwszFile, ULONG ulRowNum, IUnknown **ppUnk)
DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR (CBaseObj, CImpIBindResource)
BOOL | FindKeyword (LPCOLESTR pwszURL, LPCOLESTR pwszKeyword, WCHAR **ppwszToken)
HRESULT | ParseURL (LPCOLESTR pwszURL, WCHAR **ppwszDataSource, WCHAR **ppwszTableName, ULONG *pulRowNum)
HRESULT | ValidateBindArgs (IUnknown *pUnkOuter, LPCOLESTR pwszURL, DBBINDURLFLAG dwBindFlags, REFGUID rguid, REFIID riid, DBIMPLICITSESSION *pImplSession, IAuthenticate *pAuthenticate, DWORD *pdwBindStatus, IUnknown **ppUnk)

Detailed Description

Definition at line 83 of file binder.h.

Member Function Documentation

DEFINE_DEFAULT_IUNKNOWN_ADDREF_RELEASE STDMETHODIMP CImpIBindResource::Bind | ( | IUnknown * | pUnkOuter,
 |  | LPCOLESTR | pwszURL,
 |  | DWORD | dwBindFlags,
 |  | REFGUID | rguid,
 |  | REFIID | riid,
 |  | IAuthenticate * | pAuthenticate,
 |  | DBIMPLICITSESSION * | pImplSession,
 |  | DWORD * | pdwBindStatus,
 |  | IUnknown ** | ppUnk
 | ) |  |
HRESULT CImpIBindResource::BindDSO | ( | IUnknown * | pUnkOuter,
 |  | REFIID | riid,
 |  | BOOL | fWaitForInit,
 |  | WCHAR * | pwszDataSource,
 |  | IUnknown ** | ppUnk
 | ) |  |

Definition at line 182 of file binder.cpp.

{
  HRESULT       hr        = E_FAIL;
  IGetDataSource *  pIGetDataSource = NULL;
  IDBProperties *   pIDBProperties  = NULL;
  IDBInitialize *   pIDBInitialize  = NULL;
  CDataSource *   pDataSource   = NULL;
  ULONG       cPropSets   = 0;
  DBPROPSET *     rgPropSets    = NULL;

  if( BOT_SESSION == m_pObj->GetBaseObjectType() )
  {
    // In this case the datasource is alreay initialized
    if( fWaitForInit )
      return E_INVALIDARG;

    // Obtain an instance of the current session Session::IBindResource
    // pUnkOuter is always ignored when the DSO already exists
    TESTC(hr = ((CDBSession*)m_pObj)->QueryInterface(IID_IGetDataSource, (void**)&pIGetDataSource));
    TESTC(hr = pIGetDataSource->GetDataSource(riid, ppUnk));
  }
  else
  {
    // create DSO (aggregating if necessary)
    pDataSource = new CDataSource(pUnkOuter);
    if( pDataSource == NULL || !pDataSource->FInit() )
    {
      hr = E_OUTOFMEMORY;
      SAFE_DELETE(pDataSource);
      goto CLEANUP;
    }

    // initialize the DSO with the cached properties
    TESTC(hr = pDataSource->QueryInterface(IID_IDBProperties, (void**)&pIDBProperties));
    TESTC(hr = pDataSource->QueryInterface(IID_IDBInitialize, (void**)&pIDBInitialize));

    // Get the cached initialization properties
    // and set them on the requested DataSource
    TESTC(hr = ((CBinder*)m_pObj)->m_pUtilProp->GetProperties(PROPSET_DSO, 0,
                        NULL, &cPropSets, &rgPropSets));
    TESTC(hr = pIDBProperties->SetProperties(cPropSets, rgPropSets));

    // Set the DBPROP_INIT_DATASOURCE property if specified in the URL
    if( pwszDataSource )
    {
      DBPROPSET PropSet;
      DBPROP    PropDataSource;

      PropSet.guidPropertySet = DBPROPSET_DBINIT;
      PropSet.rgProperties  = &PropDataSource;
      PropSet.cProperties   = 1;

      PropDataSource.dwPropertyID   = DBPROP_INIT_DATASOURCE;
      PropDataSource.dwOptions    = DBPROPOPTIONS_REQUIRED;
      PropDataSource.dwStatus     = 0;
      V_VT(&PropDataSource.vValue)  = VT_BSTR;
      V_BSTR(&PropDataSource.vValue)  = SysAllocString(pwszDataSource);

      if( FAILED(hr = pIDBProperties->SetProperties(1, &PropSet)) )
      {
        VariantClear(&PropDataSource.vValue);
        goto CLEANUP;
      }
      VariantClear(&PropDataSource.vValue);
    }

    if( !fWaitForInit )
    {
      // Initialize
      TESTC(hr = pIDBInitialize->Initialize());
    }

    // Return the requested interface
    TESTC(hr = pDataSource->QueryInterface(riid, (void**)ppUnk));
  }

  hr = S_OK;

CLEANUP:

  // release properties
  FreeProperties(&cPropSets, &rgPropSets);

  SAFE_RELEASE(pIGetDataSource);
  SAFE_RELEASE(pIDBProperties);
  SAFE_RELEASE(pIDBInitialize);

  return hr;
}

HRESULT CImpIBindResource::BindRow | ( | IUnknown * | pUnkOuter,
 |  | REFIID | riid,
 |  | DBIMPLICITSESSION * | pImplSession,
 |  | WCHAR * | pwszDataSource,
 |  | WCHAR * | pwszFile,
 |  | ULONG | ulRowNum,
 |  | IUnknown ** | ppUnk
 | ) |  |

Definition at line 442 of file binder.cpp.

{
  HRESULT     hr  = E_FAIL;
  CDBSession *  pCSession = NULL;
  CFileIO *   pFileio = NULL;
  CRow *      pCRow = NULL;

  if( BOT_SESSION != m_pObj->GetBaseObjectType() && pImplSession )
  {
    TESTC(hr = BindSession(pImplSession, pwszDataSource));
    TESTC(hr = pImplSession->pSession->QueryInterface(IID_IUnknown, (void**)&pCSession));
  }
  else
    TESTC(hr = BindSession(NULL, IID_IUnknown, pwszDataSource, (IUnknown**)&pCSession));

  //Try to open the file...
  TESTC(hr = pCSession->m_pCDataSource->OpenFile(pwszFile, &pFileio));

  // If no row number specified, just fetch the first 1
  if( ulRowNum == 0 )
    ulRowNum = 1;

  if( pFileio->GetRowCnt() < ulRowNum )
  {
    hr = DB_E_NOTFOUND;
    goto CLEANUP;
  }

  pCRow = new CRow(pUnkOuter);
  if( !pCRow || !pCRow->FInit(pCSession, pFileio, ulRowNum) )
  {
    hr = E_OUTOFMEMORY;
    goto CLEANUP;
  }

  TESTC(hr = pCRow->QueryInterface(riid, (LPVOID*)ppUnk));

CLEANUP:

  if( FAILED(hr) )
  {
    if( DB_E_NOTABLE == hr )
      hr = DB_E_NOTFOUND;

    SAFE_DELETE(pCRow);
  }

  SAFE_RELEASE(pCSession);

  return hr;
}

HRESULT CImpIBindResource::BindRowset | ( | IUnknown * | pUnkOuter,
 |  | REFIID | riid,
 |  | DBIMPLICITSESSION * | pImplSession,
 |  | WCHAR * | pwszDataSource,
 |  | WCHAR * | pwszFile,
 |  | IUnknown ** | ppUnk
 | ) |  |

Definition at line 392 of file binder.cpp.

{
  HRESULT     hr        = E_FAIL;
  IOpenRowset * pIOpenRowset  = NULL;
  DBID      TableID;

  if( BOT_SESSION != m_pObj->GetBaseObjectType() && pImplSession )
  {
    TESTC(hr = BindSession(pImplSession, pwszDataSource));
    TESTC(hr = pImplSession->pSession->QueryInterface(IID_IOpenRowset, (void**)&pIOpenRowset));
  }
  else
    TESTC(hr = BindSession(NULL, IID_IOpenRowset, pwszDataSource, (IUnknown**)&pIOpenRowset));

  TableID.eKind     = DBKIND_NAME;
  TableID.uName.pwszName  = pwszFile;

  TESTC(hr = pIOpenRowset->OpenRowset(pUnkOuter, &TableID, NULL, riid,
    0, NULL, ppUnk));

  hr = S_OK;

CLEANUP:

  if( DB_E_NOTABLE == hr )
    hr = DB_E_NOTFOUND;

  SAFE_RELEASE(pIOpenRowset);

  return hr;
}

HRESULT CImpIBindResource::BindSession | ( | IUnknown * | pUnkOuter,
 |  | REFIID | riid,
 |  | WCHAR * | pwszDataSource,
 |  | IUnknown ** | ppUnk
 | ) |  |

Definition at line 288 of file binder.cpp.

{
  HRESULT       hr          = E_FAIL;
  IDBCreateSession *  pIDBCreateSession = NULL;

  if( BOT_SESSION == m_pObj->GetBaseObjectType() )
  {
    // Obtain an instance of the current session Session::IBindResource
    // pUnkOuter is always ignored when the DSO already exists
    TESTC(hr = ((CDBSession*)m_pObj)->QueryInterface(riid, (void**)ppUnk));
  }
  else
  {
    // bind a DSO first
    TESTC(hr = BindDSO(NULL, IID_IDBCreateSession, FALSE, pwszDataSource,
              (IUnknown**)&pIDBCreateSession));

    // Create Session.
    TESTC(hr = pIDBCreateSession->CreateSession(pUnkOuter, riid, (IUnknown**)ppUnk));
  }

  hr = S_OK;

CLEANUP:

  SAFE_RELEASE(pIDBCreateSession);

  return hr;
}

HRESULT CImpIBindResource::BindSession | ( | DBIMPLICITSESSION * | pImplSession,
 |  | WCHAR * | pwszDataSource
 | ) |  |

Definition at line 333 of file binder.cpp.

{
  HRESULT       hr          = E_FAIL;
  IDBCreateSession *  pIDBCreateSession = NULL;

  // check arguments
  if( !pImplSession || !pImplSession->piid )
  {
    hr = E_INVALIDARG;
    goto CLEANUP;
  }

  if( pImplSession->pUnkOuter && IID_IUnknown != *(pImplSession->piid) )
  {
    hr = DB_E_NOAGGREGATION;
    goto CLEANUP;
  }

  // This method should not be called when on a session's
  // implementation of IBindResource.
  // pImplSession should just be ignored in this case
  if( BOT_SESSION == m_pObj->GetBaseObjectType() )
    return E_FAIL;

  // bind a DSO first
  TESTC(hr = BindDSO(NULL, IID_IDBCreateSession, FALSE, pwszDataSource,
            (IUnknown**)&pIDBCreateSession));

  //Create Session.
  pImplSession->pSession = NULL;
  TESTC(hr = pIDBCreateSession->CreateSession(pImplSession->pUnkOuter,
    *(pImplSession->piid), (IUnknown**)&pImplSession->pSession));

  hr = S_OK;

CLEANUP:

  if (FAILED(hr))
    pImplSession->pSession = NULL;

  SAFE_RELEASE(pIDBCreateSession);

  return hr;
}

HRESULT CImpIBindResource::BindStream | ( | IUnknown * | pUnkOuter,
 |  | REFIID | riid,
 |  | DBIMPLICITSESSION * | pImplSession,
 |  | WCHAR * | pwszDataSource,
 |  | WCHAR * | pwszFile,
 |  | ULONG | ulRowNum,
 |  | IUnknown ** | ppUnk
 | ) |  |

Definition at line 513 of file binder.cpp.

{
  HRESULT     hr  = E_FAIL;
  CRow *      pCRow = NULL;
  CStream *   pCStream = NULL;

  TESTC(hr = BindRow(NULL, IID_IUnknown, pImplSession, pwszDataSource,
          pwszFile, ulRowNum, (IUnknown **)&pCRow));

  pCStream = new CStream(pUnkOuter);
  if( pCStream && pCStream->FInit(pCRow, pCRow->GetRowBuff()) )
    hr = pCStream->QueryInterface(riid, (LPVOID *)ppUnk);
  else
    hr = E_OUTOFMEMORY;

CLEANUP:
  if( FAILED(hr) )
  {
    if( DB_E_NOTABLE == hr )
      hr = DB_E_NOTFOUND;

    SAFE_DELETE(pCStream);
  }

  SAFE_RELEASE(pCRow);

  return hr;
}

CImpIBindResource::DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR | ( | CBaseObj | ,
 |  | CImpIBindResource |
 | ) |  |
BOOL CImpIBindResource::FindKeyword | ( | LPCOLESTR | pwszURL,
 |  | LPCOLESTR | pwszKeyword,
 |  | WCHAR ** | ppwszToken
 | ) |  |

Definition at line 731 of file binder.cpp.

{
  assert( pwszKeyword && pwszURL && ppwszToken );

  while( *pwszURL )
    {
    const WCHAR* p1 = pwszURL;
    const WCHAR* p2 = pwszKeyword;

        while(*p1 && *p2 && (towlower(*p1)==towlower(*p2)) )
      p1++, p2++;

        if( !*p2 )
    {
      const WCHAR* pTokBegin = NULL;
      const WCHAR* pTokEnd = NULL;

      pTokBegin = pwszURL + wcslen(pwszKeyword);
      while( iswspace(*pTokBegin) )
        pTokBegin++;

      if( *pTokBegin == L'=' )
      {
        pTokBegin += 1;
        while( iswspace(*pTokBegin) )
          pTokBegin++;

        pTokEnd = pTokBegin;
        while( *pTokEnd && *pTokEnd != L',' )
          pTokEnd++;

        *ppwszToken = new WCHAR [pTokEnd - pTokBegin + 1];
        if( !ppwszToken )
          return FALSE;

        wcsncpy(*ppwszToken, pTokBegin, pTokEnd - pTokBegin);
        *(*ppwszToken + (pTokEnd - pTokBegin)) = L'\0';
        return TRUE;
      }
      return FALSE;
    }

        pwszURL++;
    }

  return FALSE;
}

HRESULT CImpIBindResource::ParseURL | ( | LPCOLESTR | pwszURL,
 |  | WCHAR ** | ppwszDataSource,
 |  | WCHAR ** | ppwszTableName,
 |  | ULONG * | pulRowNum
 | ) |  |

Definition at line 673 of file binder.cpp.

{
  // parse the URL for destination file.
  // The sample provider recognizes URLs of the form
  // sampprov: [datasource=c:\oledbtst], file=customer.csv, [row=n]
  //
  // The datasource keyword is ignored when using a session object's
  // IBindResource implementation.

  const WCHAR * pwsz = NULL;
  WCHAR *     pwszRowNum = NULL;
  WCHAR *     pwszStop = NULL;
  ULONG     cchPrefix = (sizeof(SAMPPROV_URL_PREFIX)-sizeof(WCHAR))/sizeof(WCHAR);

  if( !pwszURL )
    return E_INVALIDARG;

  // Check that the prefix is of the form  "sampprov:..."
  if( 0 != _wcsnicmp(pwszURL, SAMPPROV_URL_PREFIX, cchPrefix) ||
    L':' != *(pwszURL+cchPrefix) )
    return DB_E_NOTFOUND;

  pwsz = pwszURL+cchPrefix;
  while ( iswspace(*pwsz) )
    pwsz++;

  FindKeyword(pwsz, g_wszDataSourceKeyword, ppwszDataSource);
  FindKeyword(pwsz, g_wszFileKeyword, ppwszTableName);

  if( FindKeyword(pwsz, g_wszRowKeyword, &pwszRowNum) )
  {
    *pulRowNum = wcstol(pwszRowNum, &pwszStop, 10);
    if( pwszStop && pwszStop[0] != L'\0' )
    {
      delete [] pwszRowNum;
      return DB_E_NOTFOUND;
    }
    delete [] pwszRowNum;
  }

    return S_OK;
}

HRESULT CImpIBindResource::ValidateBindArgs | ( | IUnknown * | pUnkOuter,
 |  | LPCOLESTR | pwszURL,
 |  | DBBINDURLFLAG | dwBindFlags,
 |  | REFGUID | rguid,
 |  | REFIID | riid,
 |  | DBIMPLICITSESSION * | pImplSession,
 |  | IAuthenticate * | pAuthenticate,
 |  | DWORD * | pdwBindStatus,
 |  | IUnknown ** | ppUnk
 | ) |  |

Definition at line 563 of file binder.cpp.

{
    // Check in-params and NULL out-params in case of error
  *pdwBindStatus = DBBINDURLSTATUS_S_OK;

  if ( ppUnk )
    *ppUnk = NULL;

  if( !ppUnk || !pwszURL )
    return E_INVALIDARG;

  if( pUnkOuter && riid != IID_IUnknown )
    return DB_E_NOAGGREGATION;

  if( riid == IID_NULL )
    return E_NOINTERFACE;

  if( dwBindFlags == 0 )
    return E_INVALIDARG;

  if( pImplSession )
  {
    if( pImplSession->piid == NULL )
    {
      return E_INVALIDARG;
    }

    if( pImplSession->pUnkOuter && (*(pImplSession->piid) != IID_IUnknown) )
    {
      return DB_E_NOAGGREGATION;
    }
  }

  // Special cases - Detect invalid or unsupported flags

  // WAITFORINIT is only valid for DBGUID_DSO
  if( rguid != DBGUID_DSO && (dwBindFlags & DBBINDURLFLAG_WAITFORINIT) )
    return E_INVALIDARG;

  // OUTPUT flag is ignored when binding to DBGUID_ROWSET
  if( rguid != DBGUID_ROWSET && (dwBindFlags & DBBINDURLFLAG_OUTPUT) )
    return E_INVALIDARG;

  // WAITFORINIT and OUTPUT have been handled
  // Sample Provider has no notion of a hierarchy, so the recursive flag is always ignored
  dwBindFlags &= ~(DBBINDURLFLAG_WAITFORINIT | DBBINDURLFLAG_OUTPUT | DBBINDURLFLAG_RECURSIVE);

  if( dwBindFlags &
    ~(DBBINDURLFLAG_READWRITE | DBBINDURLFLAG_SHARE_DENY_NONE | DBBINDURLFLAG_SHARE_EXCLUSIVE) )
  {
    if( dwBindFlags & DBBINDURLFLAG_ASYNCHRONOUS )
    {
      return DB_E_ASYNCNOTSUPPORTED;
    }
    else
      return E_INVALIDARG;
  }

  // Allow the bind to succeed, but warn user
  if( dwBindFlags & DBBINDURLFLAG_SHARE_EXCLUSIVE )
  {
    *pdwBindStatus = DBBINDURLSTATUS_S_DENYTYPENOTSUPPORTED;
  }

  if( rguid == DBGUID_DSO || rguid == DBGUID_SESSION )
  {
    if( dwBindFlags & ~(DBBINDURLFLAG_READ) )
    {
      return E_INVALIDARG;
    }
  }
  else if( rguid == DBGUID_ROW || rguid == DBGUID_ROWSET )
  {
    NULL;
  }
  else if( rguid == DBGUID_STREAM )
  {
    // Sample Provider's Streams are read only
    if( dwBindFlags & DBBINDURLFLAG_WRITE )
      return DB_E_READONLY;
  }
  else
  {
    // invalid rguid
    return DB_E_NOTSUPPORTED;
  }

  return S_OK;
}

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/sampprov/binder.h
  • Dataaccess/oledb/sampprov/binder.cpp
Generated on Wed Nov 13 2024 16:56:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CImpIColumnsInfo Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CImpIColumnsInfo Class Reference

#include "rowset.h"

List of all members.

Public Member Functions

DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR (CBaseObj, CImpIColumnsInfo)
DEFINE_DEFAULT_IUNKNOWN_ADDREF_RELEASE
STDMETHODIMP 		GetColumnInfo (DBORDINAL *, DBCOLUMNINFO **, WCHAR **)
STDMETHODIMP MapColumnIDs (DBORDINAL, const DBID rgColumnIDs[], DBORDINAL rgColumns[])

Detailed Description

Definition at line 222 of file rowset.h.

Member Function Documentation

CImpIColumnsInfo::DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR | ( | CBaseObj | ,
 |  | CImpIColumnsInfo |
 | ) |  |
STDMETHODIMP CImpIColumnsInfo::GetColumnInfo | ( | DBORDINAL * | pcColumns,
 |  | DBCOLUMNINFO ** | prgInfo,
 |  | WCHAR ** | ppStringsBuffer
 | ) |  |

Definition at line 28 of file colinfo.cpp.

{
  HRESULT     hr = S_OK;
  DBORDINAL   cCols = 0;
  DBORDINAL   cExtraCols = 0;
  DBORDINAL   cbHeapUsed = 0;
  DBORDINAL   cIter = 0;
  BYTE *      pbHeap = NULL;
  WCHAR *     pwstrBuffer = NULL;
  DBCOLUMNINFO *  rgdbcolinfo = NULL;
    DBCOLUMNINFO *  rgdbInternalcolinfo = NULL;
  DBCOLUMNINFO *  rgdbExtracolinfo = NULL;
  CRowset *   pCRowset = NULL;
  CFileIO *   pFileio = NULL;

  //
  // Asserts
    //
  assert(m_pObj);

    //
    // Check in-params and NULL out-params in case of error
    //
  if( pcColumns )
    *pcColumns = 0;

  if( prgInfo )
    *prgInfo = NULL;

  if( ppStringsBuffer )
    *ppStringsBuffer = NULL;

    if( !pcColumns || !prgInfo || !ppStringsBuffer )
        return E_INVALIDARG;

  //
  // Get the Column Information off of the Command or Rowset
  //
  if( m_pObj->GetBaseObjectType() == BOT_COMMAND )
  {
    //
    // Asserts
    //
    assert(((CCommand *) m_pObj)->m_pCSession);
    assert(((CCommand *) m_pObj)->m_pCSession->m_pCDataSource);

    //
    // Check that a command has been set
    //
    if( !((CCommand *) m_pObj)->IsCommandSet() )
      return DB_E_NOCOMMAND;

    //
    // Try to open the file...
    //
    hr = ((CCommand *) m_pObj)->m_pCSession->m_pCDataSource->OpenFile(
               ((CCommand *) m_pObj)->GetCommandText(), &pFileio);
    if( FAILED(hr) )
      return hr;
  }
  else
  {
    if( m_pObj->GetBaseObjectType() == BOT_ROWSET )
      pFileio = ((CRowset *) m_pObj)->GetFileObj();
    else
    {
      pFileio = ((CRow *) m_pObj)->GetFileObj();

      cExtraCols = ((CRow *) m_pObj)->GetExtraColCount();
      rgdbExtracolinfo = ((CRow *) m_pObj)->GetExtraColumnInfo();
    }
  }

  //
  // Get the column count and delete unneeded info
  //
  cCols       = pFileio->GetColumnCnt();
  pbHeap        = pFileio->GetColNameHeap();
  cbHeapUsed      = pFileio->GetColNameHeapSize();
  rgdbInternalcolinfo = pFileio->GetColInfo();

  //
  // Return the column information
  //
  SAFE_ALLOC(rgdbcolinfo, DBCOLUMNINFO, (cCols + cExtraCols) * sizeof(DBCOLUMNINFO));
  SAFE_ALLOC(pwstrBuffer, WCHAR, cbHeapUsed);

  // 64 bit TODO
  memcpy(rgdbcolinfo, &(rgdbInternalcolinfo[1]), (ULONG)cCols*sizeof(DBCOLUMNINFO));
  memcpy(rgdbcolinfo+cCols, rgdbExtracolinfo, (ULONG)cExtraCols*sizeof(DBCOLUMNINFO));

  //
  // Need to fix up column ordinals for extra columns
  //
  for (cIter=cCols; cIter < cCols+cExtraCols; cIter++)
    rgdbcolinfo[cIter].iOrdinal = cIter+1;

  //
  // Copy the heap for column names.
  //
  if( cbHeapUsed )
  {
    ptrdiff_t dp;

    // 64 bit TODO
    memcpy(pwstrBuffer, pbHeap, (DBORDINAL)cbHeapUsed);
    dp = (DBBYTEOFFSET)pwstrBuffer - (DBBYTEOFFSET)(pbHeap);
    dp >>= 1;

    // Loop through columns and adjust pointers to column names.
    for (ULONG icol=0; icol < cCols; icol++)
    {
      if( rgdbcolinfo[icol].pwszName )
        rgdbcolinfo[icol].pwszName += dp;
    }
  }

    //
  // Assign in the values
  //
    *pcColumns       = cCols + cExtraCols;
  *prgInfo         = rgdbcolinfo;
    *ppStringsBuffer = pwstrBuffer;

CLEANUP:

  //
  // Cleanup the File Information
  //
  if( m_pObj->GetBaseObjectType() == BOT_COMMAND )
    SAFE_DELETE(pFileio);

  if( FAILED(hr) )
  {
    SAFE_DELETE(rgdbcolinfo);
    SAFE_DELETE(pwstrBuffer);
  }

    return hr;
}

STDMETHODIMP CImpIColumnsInfo::MapColumnIDs | ( | DBORDINAL | cColumnIDs,
 |  | const DBID | rgColumnIDs[],
 |  | DBORDINAL | rgColumns[]
 | ) |  |

Definition at line 185 of file colinfo.cpp.

{
  DBORDINAL cCols = 0;
  ULONG   ulError = 0;

  //
  // Asserts
    //
  assert(m_pObj);

    //
  // NO-OP if cColumnIds is 0
  //
  if( cColumnIDs == 0 )
        return S_OK;

    //
    // Check in-params and NULL out-params in case of error
    //
    if( !rgColumnIDs || !rgColumns )
        return E_INVALIDARG;

  //
  // Get the Column count
  //
  if( m_pObj->GetBaseObjectType() == BOT_COMMAND )
  {
    HRESULT hr = E_FAIL;
    CFileIO * pFileio = NULL;

    //
    // Asserts
    //
    assert(((CCommand *) m_pObj)->m_pCSession);
    assert(((CCommand *) m_pObj)->m_pCSession->m_pCDataSource);

    //
    // Check that a command has been set
    //
    if( !((CCommand *) m_pObj)->IsCommandSet() )
      return DB_E_NOCOMMAND;

    //
    // Open the File and get the column count
    //
    hr = ((CCommand *) m_pObj)->m_pCSession->m_pCDataSource->OpenFile(
              ((CCommand *) m_pObj)->GetCommandText(), &pFileio);
    if( FAILED(hr) )
      return hr;

    cCols = pFileio->GetColumnCnt();
    SAFE_DELETE(pFileio);
  }
  else
  {
    if( m_pObj->GetBaseObjectType() == BOT_ROWSET )
      cCols = ((CRowset *) m_pObj)->m_cCols;
    else
      cCols = ((CRow *) m_pObj)->GetFileObj()->GetColumnCnt();
  }

    //
  // Walk the Column ID structs and determine the ordinal value
  //
    for (ULONG i=0; i < cColumnIDs; i++)
    {
    if( m_pObj->GetBaseObjectType() == BOT_ROW &&
      IsEqualDBID(&rgColumnIDs[i], &DBROWCOL_DEFAULTSTREAM) )
    {
      rgColumns[i] = cCols + DEFAULT_STREAM_ORDINAL;
    }
        else if( (rgColumnIDs[i].eKind != DBKIND_GUID_PROPID) ||
         (rgColumnIDs[i].uGuid.guid != GUID_NULL)     ||
         (rgColumnIDs[i].uName.ulPropid < 1)          ||
         (rgColumnIDs[i].uName.ulPropid > cCols) )
        {
            rgColumns[i] = DB_INVALIDCOLUMN;
            ulError++;
        }
    else
            rgColumns[i] = rgColumnIDs[i].uName.ulPropid;
    }

  //
  // Return the correct HResult
  //
  return ulError ? (ulError < cColumnIDs) ?
      DB_S_ERRORSOCCURRED : DB_E_ERRORSOCCURRED : S_OK;
}

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/sampprov/rowset.h
  • Dataaccess/oledb/sampprov/colinfo.cpp
Generated on Wed Nov 13 2024 16:56:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CImpICommandProperties Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CImpICommandProperties Class Reference

#include "command.h"

List of all members.

Public Member Functions

DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR (CCommand, CImpICommandProperties)
DEFINE_DEFAULT_IUNKNOWN_ADDREF_RELEASE
STDMETHODIMP 		GetProperties (const ULONG cPropertySets, const DBPROPIDSET rgPropertySets[], ULONG *pcProperties, DBPROPSET **prgProperties)
STDMETHODIMP SetProperties (ULONG cPropertySets, DBPROPSET rgPropertySets[])

Detailed Description

Definition at line 178 of file command.h.

Member Function Documentation

CImpICommandProperties::DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR | ( | CCommand | ,
 |  | CImpICommandProperties |
 | ) |  |
STDMETHODIMP CImpICommandProperties::GetProperties | ( | const ULONG | cPropertySets,
 |  | const DBPROPIDSET | rgPropertySets[],
 |  | ULONG * | pcProperties,
 |  | DBPROPSET ** | prgProperties
 | ) |  |

Definition at line 675 of file command.cpp.

{
  HRESULT hr;

  assert( m_pObj );
  assert( m_pObj->m_pUtilProp );

  //NOTE: Since we are non-chaptered, we just ignore the
  // rowset name argument.

  hr = m_pObj->m_pUtilProp->GetPropertiesArgChk(
        PROPSET_ROWSET,
        cPropertySets,
        rgPropertySets,
        pcProperties,
        prgProperties);
  if( SUCCEEDED(hr) )
  {
    hr = m_pObj->m_pUtilProp->GetProperties(
          PROPSET_ROWSET,
          cPropertySets,
          rgPropertySets,
          pcProperties,
          prgProperties);
  }

  // Just return the HResult
  return hr;
}

STDMETHODIMP CImpICommandProperties::SetProperties | ( | ULONG | cPropertySets,
 |  | DBPROPSET | rgPropertySets[]
 | ) |  |

Definition at line 722 of file command.cpp.

{
    HRESULT hr = E_FAIL;

    //
  // Asserts
    //
  assert( m_pObj );
    assert( m_pObj->m_pUtilProp );

    //
  // Quick return if the Count of Properties is 0
    //
  if( cPropertySets == 0 )
    return S_OK;

    //
    // Check in-params and NULL out-params in case of error
    //
  hr=m_pObj->m_pUtilProp->SetPropertiesArgChk(cPropertySets, rgPropertySets);

  if( FAILED(hr) )
    return hr;

    //
  // Don't allow properties to be set if we've got a rowset open
    //
  if( m_pObj->IsRowsetOpen() )
    return DB_E_OBJECTOPEN;

  return m_pObj->m_pUtilProp->SetProperties(PROPSET_ROWSET,
                        cPropertySets, rgPropertySets);
}

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/sampprov/command.h
  • Dataaccess/oledb/sampprov/command.cpp
Generated on Wed Nov 13 2024 16:56:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CImpICommandText Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CImpICommandText Class Reference

#include "command.h"

List of all members.

Public Member Functions

STDMETHODIMP | Cancel ()
DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR (CCommand, CImpICommandText)
STDMETHODIMP | Execute (IUnknown *pUnkOuter, REFIID riid, DBPARAMS *pParams, DBROWCOUNT *pcRowsAffected, IUnknown **ppRowset)
DEFINE_DEFAULT_IUNKNOWN_ADDREF_RELEASE
STDMETHODIMP 		GetCommandText (GUID *pguidDialect, LPOLESTR *ppwszCommand)
STDMETHODIMP | GetDBSession (REFIID riid, IUnknown **ppSession)
STDMETHODIMP | SetCommandText (REFGUID rguidDialect, LPCOLESTR pwszCommand)

Detailed Description

Definition at line 148 of file command.h.

Member Function Documentation

STDMETHODIMP CImpICommandText::Cancel ( void )

Definition at line 369 of file command.cpp.

{
  if( m_pObj->m_dwStatus & CMD_EXECUTING )
    return DB_E_CANTCANCEL;

  return S_OK;
}

CImpICommandText::DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR | ( | CCommand | ,
 |  | CImpICommandText |
 | ) |  |
STDMETHODIMP CImpICommandText::Execute | ( | IUnknown * | pUnkOuter,
 |  | REFIID | riid,
 |  | DBPARAMS * | pParams,
 |  | DBROWCOUNT * | pcRowsAffected,
 |  | IUnknown ** | ppRowset
 | ) |  |

Definition at line 398 of file command.cpp.

{
  HRESULT   hr, hrProp = S_OK;
  UDWORD    dwFlags = 0;
  UDWORD    dwStatus=0;
  ULONG   cPropSets = 0;
  ULONG   ul;
  ULONG   ul2;
  DBPROPSET *rgPropSets = NULL;
  const IID*  pIID = &IID_ICommand;

    CFileIO*    pFileio = NULL;
    CRowset*    pRowset = NULL;

  BOOL    fCreateRowObject = FALSE;
  DBCOUNTITEM cRowsObtained = 0;
  HROW *    phRow = NULL;
  IRowset * pIRowset = NULL;
  IGetRow * pIGetRow = NULL;

  assert( m_pObj->m_pUtilProp );

  // Initialize Return Buffers
  if( ppRowset )
    *ppRowset = NULL;

  if( pcRowsAffected )
    *pcRowsAffected = -1;

  if( riid != IID_NULL && !ppRowset )
    return ResultFromScode( E_INVALIDARG );

  // Only 1 ParamSet if ppRowset is non-Null
  if( pParams && (pParams->cParamSets > 1) && ppRowset )
    return ResultFromScode( E_INVALIDARG );

  // Check that a command has been set
  if( !m_pObj->IsCommandSet() )
    return DB_E_NOCOMMAND;

  // We do not allow the riid to be anything other than IID_IUnknown for aggregation
  if( pUnkOuter && riid != IID_IUnknown )
    return ResultFromScode( DB_E_NOAGGREGATION );

  // Set Status
  m_pObj->m_dwStatus |= CMD_EXECUTING;

  // Check to see if IID_IOpenRowset is calling Execute to
  // open a rowset.
  if( m_pObj->m_guidImpersonate != GUID_NULL )
  {
    assert(m_pObj->m_guidImpersonate == IID_IOpenRowset);
    pIID = &m_pObj->m_guidImpersonate;
  }

  hr = m_pObj->m_pUtilProp->GetProperties(
          PROPSET_ROWSET,
          0,
          NULL,
          &cPropSets,
          &rgPropSets);

  if( hr != S_OK )
  {
    // The only valid reason to fail is out of memory case
    assert( hr == E_OUTOFMEMORY );
    goto exit;
  }

  // Traverse the properties to see if a ROW object is requested.
  for(ul=0;ul<cPropSets; ul++)
  {
    for(ul2=0;ul2<rgPropSets[ul].cProperties; ul2++)
    {
      // Check if a row object was requested.
      // DBPROP_IRow, DBPROP_IRowChange, and DBPROP_IRowSchemaChange indicate
      // that a ROW object is desired.
      // Sample Provider does not support IRowSchemaChange so no need to check for that
      // property
      if( (rgPropSets[ul].rgProperties[ul2].dwPropertyID == DBPROP_IRow ||
         rgPropSets[ul].rgProperties[ul2].dwPropertyID == DBPROP_IRowChange) &&
        rgPropSets[ul].rgProperties[ul2].dwStatus == DBPROPSTATUS_OK &&
        V_BOOL(&rgPropSets[ul].rgProperties[ul2].vValue) == VARIANT_TRUE )
        fCreateRowObject = TRUE;
    }
  }

  //Try to open the file...
  if(FAILED(hr = m_pObj->m_pCSession->m_pCDataSource->OpenFile(m_pObj->m_strCmdText, &pFileio)))
    goto exit;

    // open and initialize a rowset\cursor object
    pRowset = new CRowset( fCreateRowObject ? NULL : pUnkOuter );
    if (!pRowset)
  {
        SAFE_DELETE( pFileio );
        hr = E_OUTOFMEMORY;
    goto exit;
  }

  // Initialize the rowset\cursor.
    // For now, since don't yet support "settable" properties, so no properties to pass.
    // The rowset will always create all of its interfaces.
    // This is all-or-nothing.

  //Assign creator pointer. Used to keep track of open rowsets
    pRowset->m_pCreator = m_pObj;
  pRowset->m_pCreator->m_pUnkOuter->AddRef();

    if( !pRowset->FInit(
            pFileio,
            (*pIID == IID_IOpenRowset) ? (CBaseObj *) m_pObj->m_pCSession : (CBaseObj *) m_pObj,
            m_pObj->m_strCmdText,
            m_pObj->m_pCSession->m_pCDataSource->GetFilePath()
            ) )
  {
        SAFE_DELETE( pRowset );
        hr = DB_E_NOTABLE;
    goto exit;
  }

  // set the properties
  if ( cPropSets )
    hr = pRowset->GetCUtilProp()->SetProperties(PROPSET_ROWSET, cPropSets, rgPropSets);

  // If all the properties set were OPTIONAL then we return
  // DB_S_ERRORSOCCURRED and continue.
  for(ul=0;ul<cPropSets; ul++)
  {
    for(ul2=0;ul2<rgPropSets[ul].cProperties; ul2++)
    {
      // Check for a required property that failed, if found, we must return
      // DB_E_ERRORSOCCURRED
      if( (rgPropSets[ul].rgProperties[ul2].dwStatus != DBPROPSTATUS_OK) &&
        (rgPropSets[ul].rgProperties[ul2].dwOptions != DBPROPOPTIONS_OPTIONAL) )
      {
          SAFE_DELETE( pRowset );
          hr = DB_E_ERRORSOCCURRED;
          goto exit;
      }
    }
  }

  // Optional property failure is still a success
  if( hr == DB_E_ERRORSOCCURRED )
    hrProp = DB_S_ERRORSOCCURRED;

  // if properties failed or ppRowset NULL
  if( (FAILED(hr) && (hrProp==S_OK)) ||
    (!ppRowset) )
    {
        SAFE_DELETE( pRowset );
    goto exit;
    }

    // get requested interface pointer on rowset\cursor
  if( fCreateRowObject || riid == IID_IRow || riid == IID_IRowChange )
  {
    hr = E_FAIL;

    if( FAILED(pRowset->QueryInterface(IID_IRowset, (LPVOID *)&pIRowset)) )
      goto exit;

    if( FAILED(pIRowset->GetNextRows(DB_NULL_HCHAPTER, 0, 1, &cRowsObtained, &phRow)) )
      goto exit;

    assert( cRowsObtained == 1);
    if( FAILED(pRowset->QueryInterface(IID_IGetRow, (LPVOID *)&pIGetRow)) )
      goto exit;

    if( FAILED(hr = pIGetRow->GetRowFromHROW(pUnkOuter, phRow[0], riid, ppRowset)) )
      goto exit;

    // Sample Provider does not support selection using a critera.
    // Hence, DB_S_NOTSINGLETON is reported simply if the target file
    // contains more than one row.
    if( pRowset->GetFileObj()->GetRowCnt() > 1 )
      hr = DB_S_NOTSINGLETON;
    else
      hr = S_OK;
  }
  else
  {
    hr = pRowset->QueryInterface( riid, (void **) ppRowset );
    if( FAILED(hr) )
    {
      // Special case IID_NULL
      if( riid == IID_NULL )
        hr = S_OK;

      SAFE_DELETE( pRowset );
      goto exit;
    }
  }

  if (SUCCEEDED(hr))
    m_pObj->IncrementOpenRowsets();

  SAFE_RELEASE(pIRowset);
  SAFE_RELEASE(pIGetRow);

exit:

  if( FAILED(hr) )
    SAFE_DELETE(pRowset);

  // Free the RowHandle
  SAFE_FREE(phRow);

  // Exiting the execution state
  m_pObj->m_dwStatus &= ~CMD_EXECUTING;

  for (ul=0; ul < cPropSets; ul++)
    SAFE_FREE(rgPropSets[ul].rgProperties);

  SAFE_FREE(rgPropSets);

  return hr;
}

STDMETHODIMP CImpICommandText::GetCommandText | ( | GUID * | pguidDialect,
 |  | LPOLESTR * | ppwszCommand
 | ) |  |

Definition at line 245 of file command.cpp.

{
  HRESULT   hr;

  // Check Function Arguments
  if( ppwszCommand == NULL )
  {
    hr = ResultFromScode(E_INVALIDARG);
    goto exit;
  }

  *ppwszCommand = NULL;

  // If the command has not been set, make sure the buffer
  // contains an empty stringt to return to the consumer
  if( !m_pObj->IsCommandSet() )
  {
    hr = ResultFromScode(DB_E_NOCOMMAND);
    goto exit;
  }

  assert( m_pObj->m_strCmdText );

  hr = NOERROR;

  if(  pguidDialect != NULL &&
    *pguidDialect != DBGUID_DEFAULT &&
    *pguidDialect != DBGUID_SAMPLEDIALECT )
  {
    hr = DB_S_DIALECTIGNORED;
    *pguidDialect = DBGUID_DEFAULT;
  }

  // Allocate memory for the string we're going to return to the caller
  *ppwszCommand = (LPWSTR) PROVIDER_ALLOC(
          (wcslen(m_pObj->m_strCmdText) + 1) * sizeof(WCHAR));

  if( !(*ppwszCommand) )
  {
    hr = ResultFromScode(E_OUTOFMEMORY);
    goto exit;
  }

  // Copy our saved text into the newly allocated string
  wcscpy(*ppwszCommand, m_pObj->m_strCmdText);

exit:

  if( FAILED(hr) && pguidDialect )
    memset(pguidDialect, 0, sizeof(GUID));

  return hr;
}

STDMETHODIMP CImpICommandText::GetDBSession | ( | REFIID | riid,
 |  | IUnknown ** | ppSession
 | ) |  |

Definition at line 637 of file command.cpp.

{
  HRESULT hr;

  assert( m_pObj->m_pCSession );

  // Check Arguments
  if( ppSession == NULL )
    return ResultFromScode(E_INVALIDARG);

  // Query for the interface on the session object.  If failure,
  // return the error from QueryInterface.
  hr = m_pObj->m_pCSession->GetOuterUnknown()->QueryInterface(riid, (VOID**)ppSession);
  if( FAILED(hr) )
  {
    *ppSession = NULL;
    return hr;
  }

  return ResultFromScode(S_OK);
}

STDMETHODIMP CImpICommandText::SetCommandText | ( | REFGUID | rguidDialect,
 |  | LPCOLESTR | pwszCommand
 | ) |  |

Definition at line 314 of file command.cpp.

{
  HRESULT hr = S_OK;

  // Don't allow text to be set if we've got a rowset open
  if( m_pObj->IsRowsetOpen() )
    return ResultFromScode(DB_E_OBJECTOPEN);

  // Check Dialect
  if( rguidDialect != DBGUID_SAMPLEDIALECT &&
    rguidDialect != DBGUID_DEFAULT )
    return ResultFromScode(DB_E_DIALECTNOTSUPPORTED);

  if( !pwszCommand || *pwszCommand == L'\0' )
  {
    // Free the current string
    SAFE_DELETE_ARRAY(m_pObj->m_strCmdText);
    m_pObj->m_dwStatus &= ~CMD_TEXT_SET;
    return NOERROR;
  }

  WCHAR * pwszCMD = new WCHAR[wcslen(pwszCommand)+1];

  if ( !pwszCMD )
    hr = ResultFromScode(E_OUTOFMEMORY);

  // Free the old memory and set the text
  SAFE_DELETE_ARRAY(m_pObj->m_strCmdText);
  m_pObj->m_strCmdText = pwszCMD;
  wcscpy(m_pObj->m_strCmdText, pwszCommand);

  // Set status flag that we have set text
  m_pObj->m_dwStatus |= CMD_TEXT_SET;

  return NOERROR;
}

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/sampprov/command.h
  • Dataaccess/oledb/sampprov/command.cpp
Generated on Wed Nov 13 2024 16:56:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CImpIConvertType Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CImpIConvertType Class Reference

#include "rowset.h"

List of all members.

Public Member Functions

DEFINE_DEFAULT_IUNKNOWN_ADDREF_RELEASE
STDMETHODIMP 		CanConvert (DBTYPE wFromType, DBTYPE wToType, DBCONVERTFLAGS dwConvertFlags)
DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR (CBaseObj, CImpIConvertType)

Detailed Description

Definition at line 300 of file rowset.h.

Member Function Documentation

STDMETHODIMP CImpIConvertType::CanConvert | ( | DBTYPE | wFromType,
 |  | DBTYPE | wToType,
 |  | DBCONVERTFLAGS | dwConvertFlags
 | ) |  |

Definition at line 28 of file cvttype.cpp.

{
  //
  // We only support conversions on Rowsets, we only allow DBCONVERTFLAGS_COLUMN
  //
  if( (dwConvertFlags & ~(DBCONVERTFLAGS_ISLONG |
              DBCONVERTFLAGS_ISFIXEDLENGTH |
              DBCONVERTFLAGS_FROMVARIANT)) != DBCONVERTFLAGS_COLUMN )
    return (DB_E_BADCONVERTFLAG);

  //
  // Make sure that we check that the type is a variant if they say so
  //
  if( dwConvertFlags & DBCONVERTFLAGS_FROMVARIANT )
  {
    DBTYPE  wVtType = wFromType & VT_TYPEMASK;

    //
    // Take out all of the Valid VT_TYPES (36 is VT_RECORD in VC 6)
    //
    if( (wVtType > VT_DECIMAL && wVtType < VT_I1) ||
      ((wVtType > VT_LPWSTR && wVtType < VT_FILETIME) && wVtType != 36) ||
      (wVtType > VT_CLSID) )
      return (DB_E_BADTYPE);
  }

  //
  // Don't allow _ISLONG on fixed-length types
  //
  if( dwConvertFlags & DBCONVERTFLAGS_ISLONG )
    switch( wFromType & ~(DBTYPE_RESERVED|DBTYPE_VECTOR|DBTYPE_ARRAY|DBTYPE_BYREF) )
    {
    case DBTYPE_BYTES:
    case DBTYPE_STR:
    case DBTYPE_WSTR:
    case DBTYPE_VARNUMERIC:
      break;

    default:
      return (DB_E_BADCONVERTFLAG);
    }

  //
  // If the DC is not there, try to create it again
  if( !g_pIDataConvert )
  {
    CoCreateInstance(CLSID_OLEDB_CONVERSIONLIBRARY,
                NULL,
                CLSCTX_INPROC_SERVER,
                IID_IDataConvert,
                (void**)&g_pIDataConvert);

    //
    // Tell the DC that we are 2.5
    //
    if( g_pIDataConvert )
    {
      DCINFO rgInfo[] = {{DCINFOTYPE_VERSION,{VT_UI4, 0, 0, 0, 0x0}}};
      IDCInfo *pIDCInfo = NULL;

      if( g_pIDataConvert->QueryInterface(IID_IDCInfo, (void **)&pIDCInfo) == S_OK &&
        pIDCInfo )
      {
        // OLE DB Version 02.50
        V_UI4(&rgInfo->vData) = 0x250;
        pIDCInfo->SetInfo(NUMELEM(rgInfo),rgInfo);
        pIDCInfo->Release();
      }
    }
    else
      return (S_FALSE);
  }

  //
  // Ask the conversion library for the answer
  //
  return (g_pIDataConvert->CanConvert(wFromType, wToType));
}

CImpIConvertType::DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR | ( | CBaseObj | ,
 |  | CImpIConvertType |
 | ) |  |
The documentation for this class was generated from the following files:
  • Dataaccess/oledb/sampprov/rowset.h
  • Dataaccess/oledb/sampprov/cvttype.cpp
Generated on Wed Nov 13 2024 16:56:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CImpICreateRow Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CImpICreateRow Class Reference

#include "binder.h"

List of all members.

Public Member Functions

DEFINE_DEFAULT_IUNKNOWN_ADDREF_RELEASE
STDMETHODIMP 		CreateRow (IUnknown *pUnkOuter, LPCOLESTR pwszURL, DWORD dwBindFlags, REFGUID rguid, REFIID riid, IAuthenticate *pAuthenticate, DBIMPLICITSESSION *pImplSession, DWORD *pdwBindStatus, LPOLESTR *ppwszNewURL, IUnknown **ppUnk)
DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR (CBinder, CImpICreateRow)

Detailed Description

Definition at line 195 of file binder.h.

Member Function Documentation

DEFINE_DEFAULT_IUNKNOWN_ADDREF_RELEASE STDMETHODIMP CImpICreateRow::CreateRow | ( | IUnknown * | pUnkOuter,
 |  | LPCOLESTR | pwszURL,
 |  | DWORD | dwBindFlags,
 |  | REFGUID | rguid,
 |  | REFIID | riid,
 |  | IAuthenticate * | pAuthenticate,
 |  | DBIMPLICITSESSION * | pImplSession,
 |  | DWORD * | pdwBindStatus,
 |  | LPOLESTR * | ppwszNewURL,
 |  | IUnknown ** | ppUnk
 | ) |  |
CImpICreateRow::DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR | ( | CBinder | ,
 |  | CImpICreateRow |
 | ) |  |
The documentation for this class was generated from the following file:
  • Dataaccess/oledb/sampprov/binder.h
Generated on Wed Nov 13 2024 16:56:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CImpIDBBinderProperties Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CImpIDBBinderProperties Class Reference

#include "binder.h"

List of all members.

Public Member Functions

DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR (CBinder, CImpIDBBinderProperties)
DEFINE_DEFAULT_IUNKNOWN_ADDREF_RELEASE
STDMETHODIMP 		GetProperties (ULONG cPropertySets, const DBPROPIDSET rgPropertySets[], ULONG *pcPropertySets, DBPROPSET **prgPropertySets)
STDMETHODIMP | GetPropertyInfo (ULONG cPropertySets, const DBPROPIDSET rgPropertySets[], ULONG *pcPropertyInfoSets, DBPROPINFOSET **prgPropertyInfoSets, WCHAR **ppDescBuffer)
STDMETHODIMP | Reset ()
STDMETHODIMP | SetProperties (ULONG cPropertySets, DBPROPSET rgPropertySets[])

Detailed Description

Definition at line 225 of file binder.h.

Member Function Documentation

CImpIDBBinderProperties::DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR | ( | CBinder | ,
 |  | CImpIDBBinderProperties |
 | ) |  |
DEFINE_DEFAULT_IUNKNOWN_ADDREF_RELEASE STDMETHODIMP CImpIDBBinderProperties::GetProperties | ( | ULONG | cPropertySets,
 |  | const DBPROPIDSET | rgPropertySets[],
 |  | ULONG * | pcPropertySets,
 |  | DBPROPSET ** | prgPropertySets
 | ) |  |
STDMETHODIMP CImpIDBBinderProperties::GetPropertyInfo | ( | ULONG | cPropertySets,
 |  | const DBPROPIDSET | rgPropertySets[],
 |  | ULONG * | pcPropertyInfoSets,
 |  | DBPROPINFOSET ** | prgPropertyInfoSets,
 |  | WCHAR ** | ppDescBuffer
 | ) |  |
STDMETHODIMP CImpIDBBinderProperties::Reset ( void )

Definition at line 1054 of file binder.cpp.

{
  PCUTILPROP  pCUtilProp = NULL;

  pCUtilProp = new CUtilProp();
  if( !pCUtilProp )
    return E_OUTOFMEMORY;

  SAFE_DELETE( m_pObj->m_pUtilProp );
  m_pObj->m_pUtilProp = pCUtilProp;

  return S_OK;
}

STDMETHODIMP CImpIDBBinderProperties::SetProperties | ( | ULONG | cPropertySets,
 |  | DBPROPSET | rgPropertySets[]
 | ) |  |

Definition at line 1011 of file binder.cpp.

{
    HRESULT hr = E_FAIL;

  //
  // Asserts
  //
  assert( m_pObj );
    assert( m_pObj->m_pUtilProp );

  //
  // Quick return if the Count of cPropertySets is 0
  //
  if( cPropertySets == 0 )
    return S_OK;

    //
    // Check in-params and NULL out-params in case of error
    //
  hr=m_pObj->m_pUtilProp->SetPropertiesArgChk(cPropertySets, rgPropertySets);

  if( FAILED(hr) )
    return hr;

  //
    // just pass this call on to the utility object that manages our properties
  //
    return m_pObj->m_pUtilProp->SetProperties(PROPSET_DSO,
                        cPropertySets, rgPropertySets);
}

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/sampprov/binder.h
  • Dataaccess/oledb/sampprov/binder.cpp
Generated on Wed Nov 13 2024 16:56:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CImpIDBCreateCommand Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions

CImpIDBCreateCommand Class Reference

#include "dbsess.h"

List of all members.

Public Member Functions

DEFINE_DEFAULT_IUNKNOWN_ADDREF_RELEASE
STDMETHODIMP 		CreateCommand (IUnknown *, REFIID, IUnknown **)
DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR (CDBSession, CImpIDBCreateCommand)

Private Member Functions

DEFINE_DEFAULT_IUNKNOWN_MEMBER_DATA (CDBSession)

Detailed Description

Definition at line 170 of file dbsess.h.

Member Function Documentation

STDMETHODIMP CImpIDBCreateCommand::CreateCommand | ( | IUnknown * | pUnkOuter,
 |  | REFIID | riid,
 |  | IUnknown ** | ppCommand
 | ) |  |

Definition at line 366 of file dbsess.cpp.

{
    //
    // Check in-params and NULL out-params in case of error
    //
  if( !ppCommand )
    return (E_INVALIDARG);

  *ppCommand = NULL;

    //
  // We do not allow any other iid than IID_IUnknown for aggregation
    //
  if( pUnkOuter && riid != IID_IUnknown )
    return (DB_E_NOAGGREGATION);

  //
  // This is the outer unknown from the user, for the new Command,
  // not to be confused with the outer unknown of this DBSession object.
  //
  HRESULT hr = E_OUTOFMEMORY;
  CCommand* pCCommand = new CCommand(m_pObj, pUnkOuter);

  if( !pCCommand || FAILED(hr=pCCommand->FInit()) )
  {
    SAFE_DELETE(pCCommand);
    return (hr);
  }

  hr = pCCommand->QueryInterface(riid, (void **) ppCommand);

    if( FAILED(hr) )
        SAFE_DELETE(pCCommand);

  return (hr);
}

CImpIDBCreateCommand::DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR | ( | CDBSession | ,
 |  | CImpIDBCreateCommand |
 | ) |  |
CImpIDBCreateCommand::DEFINE_DEFAULT_IUNKNOWN_MEMBER_DATA ( CDBSession ) [private]
The documentation for this class was generated from the following files:
  • Dataaccess/oledb/sampprov/dbsess.h
  • Dataaccess/oledb/sampprov/dbsess.cpp
Generated on Wed Nov 13 2024 16:56:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CImpIDBCreateSession Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CImpIDBCreateSession Class Reference

#include "datasrc.h"

List of all members.

Public Member Functions

DEFINE_DEFAULT_IUNKNOWN_ADDREF_RELEASE
STDMETHODIMP 		CreateSession (IUnknown *, REFIID, IUnknown **)
DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR (CDataSource, CImpIDBCreateSession)

Detailed Description

Definition at line 133 of file datasrc.h.

Member Function Documentation

STDMETHODIMP CImpIDBCreateSession::CreateSession | ( | IUnknown * | pUnkOuter,
 |  | REFIID | riid,
 |  | IUnknown ** | ppDBSession
 | ) |  |

Definition at line 33 of file crtsess.cpp.

{
  //
  // Asserts
    //
  assert(m_pObj);

    //
    // Check in-params and NULL out-params in case of error
    //
    if( !ppDBSession )
        return (E_INVALIDARG);

    *ppDBSession = NULL;

    //
  // Check to see if the DSO is Uninitialized
    //
  if( !m_pObj->m_fDSOInitialized )
        return (E_UNEXPECTED);

    //
    // This Data Source object can only create 1 DBSession...
    //
    if( m_pObj->m_fDBSessionCreated )
        return (DB_E_OBJECTCREATIONLIMITREACHED);

    //
  // We do not allow any other iid than IID_IUnknown for aggregation
    //
  if( pUnkOuter && riid != IID_IUnknown )
    return (DB_E_NOAGGREGATION);

    //
    // Open a DBSession object
    //
    CDBSession* pDBSession = new CDBSession(pUnkOuter);

    if( !pDBSession || !pDBSession->FInit(m_pObj) )
  {
        SAFE_DELETE(pDBSession);
        return (E_OUTOFMEMORY);
  }

    //
    // Get requested interface pointer on DBSession
    //
    HRESULT hr=pDBSession->QueryInterface(riid, (void **)ppDBSession);

    if( FAILED(hr) )
  {
        SAFE_DELETE(pDBSession);
    return (hr);
  }

  m_pObj->m_fDBSessionCreated = TRUE;
    return (hr);
}

CImpIDBCreateSession::DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR | ( | CDataSource | ,
 |  | CImpIDBCreateSession |
 | ) |  |
The documentation for this class was generated from the following files:
  • Dataaccess/oledb/sampprov/datasrc.h
  • Dataaccess/oledb/sampprov/crtsess.cpp
Generated on Wed Nov 13 2024 16:56:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CImpIDBInfo Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CImpIDBInfo Class Reference

#include "datasrc.h"

List of all members.

Public Member Functions

DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR (CDataSource, CImpIDBInfo)
DEFINE_DEFAULT_IUNKNOWN_ADDREF_RELEASE
STDMETHODIMP 		GetKeywords (LPWSTR *ppwsKeywords)
STDMETHODIMP GetLiteralInfo (ULONG cLiterals, const DBLITERAL rgLiterals[], ULONG *pcLiteralInfo, DBLITERALINFO **prgLiteralInfo, WCHAR **ppCharBuffer)

Detailed Description

Definition at line 193 of file datasrc.h.

Member Function Documentation

CImpIDBInfo::DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR | ( | CDataSource | ,
 |  | CImpIDBInfo |
 | ) |  |
STDMETHODIMP CImpIDBInfo::GetKeywords ( LPWSTR * ppwsKeywords )

Definition at line 27 of file dbprop.cpp.

{
    //
  // Asserts
    //
    assert(m_pObj);

    //
    // Check in-params and NULL out-params in case of error
    //
    if( !ppwszKeywords )
    return E_INVALIDARG;

  *ppwszKeywords = NULL;

    //
  // Check to see if initialized
    //
  if( !m_pObj->m_fDSOInitialized )
    return E_UNEXPECTED;

    return S_OK;
}

STDMETHODIMP CImpIDBInfo::GetLiteralInfo | ( | ULONG | cLiterals,
 |  | const DBLITERAL | rgLiterals[],
 |  | ULONG * | pcLiteralInfo,
 |  | DBLITERALINFO ** | prgLiteralInfo,
 |  | WCHAR ** | ppCharBuffer
 | ) |  |

Definition at line 65 of file dbprop.cpp.

{
    HRESULT hr = DB_E_ERRORSOCCURRED;
  ULONG   ulIndex = 0;

    //
  // Asserts
    //
    assert(m_pObj);

    //
    // Check in-params and NULL out-params in case of error
    //
  if( pcLiteralInfo )
    *pcLiteralInfo = 0;

  if( prgLiteralInfo )
    *prgLiteralInfo = NULL;

  if( ppCharBuffer )
    *ppCharBuffer = NULL;

    //
  // Check input and output values pointers
    //
    if( cLiterals && !rgLiterals )
        return E_INVALIDARG;

    if( !pcLiteralInfo || !prgLiteralInfo || !ppCharBuffer )
        return E_INVALIDARG;

    //
  // Check to see if initialized
    //
  if( !m_pObj->m_fDSOInitialized )
    return E_UNEXPECTED;

    //
  // If cLiterals is 0, ignore rgLiterals
  // return all supported values
    //
  if( cLiterals == 0 )
    return S_OK;

    //
  // Allocate memory for DBLITERALINFO array
    //
    SAFE_ALLOC(*prgLiteralInfo, DBLITERALINFO, cLiterals);

    //
  // Process each of the DBLITERAL values that are in the restriction array
    //
  *pcLiteralInfo = cLiterals;

  for(ulIndex=0; ulIndex < cLiterals; ulIndex++)
  {
    (*prgLiteralInfo)[ulIndex].lt = rgLiterals[ulIndex];
    (*prgLiteralInfo)[ulIndex].fSupported = FALSE;
    (*prgLiteralInfo)[ulIndex].pwszLiteralValue = NULL;
    (*prgLiteralInfo)[ulIndex].pwszInvalidChars = NULL;
    (*prgLiteralInfo)[ulIndex].pwszInvalidStartingChars = NULL;
    (*prgLiteralInfo)[ulIndex].cchMaxLen = 0;
  }

CLEANUP:

  return hr;
}

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/sampprov/datasrc.h
  • Dataaccess/oledb/sampprov/dbprop.cpp
Generated on Wed Nov 13 2024 16:56:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CImpIDBInitialize Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CImpIDBInitialize Class Reference

#include "datasrc.h"

List of all members.

Public Member Functions

DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR (CDataSource, CImpIDBInitialize)
DEFINE_DEFAULT_IUNKNOWN_ADDREF_RELEASE
STDMETHODIMP 		Initialize (void)
STDMETHODIMP Uninitialize (void)

Detailed Description

Definition at line 111 of file datasrc.h.

Member Function Documentation

CImpIDBInitialize::DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR | ( | CDataSource | ,
 |  | CImpIDBInitialize |
 | ) |  |
STDMETHODIMP CImpIDBInitialize::Initialize ( void )

Definition at line 30 of file dbinit.cpp.

{
    ASSERT( m_pObj );
  CHAR szDataSource[MAX_PATH + MAX_PATH + 1] = {0};

  HRESULT   hr;
  ULONG   cPropSets = 0;
  DBPROPSET*  rgPropSets = NULL;

  WCHAR* pwszDataSource = NULL;
    int  nPrompt = DBPROMPT_NOPROMPT;
  HWND hWnd = NULL;

  IDBPromptInitialize* pIDBPromptInitialize = NULL;
  IDBProperties*     pIDBProperties       = NULL;

    if(m_pObj->m_fDSOInitialized)
        return ResultFromScode( DB_E_ALREADYINITIALIZED );

  //Setup Properties
  const ULONG cProperties   = 3;
  DBPROPID  rgProperties[cProperties] = { DBPROP_INIT_DATASOURCE, DBPROP_INIT_PROMPT, DBPROP_INIT_HWND };

  const ULONG cPropertyIDSets = 1;
  DBPROPIDSET rgPropertyIDSets[cPropertyIDSets];
  rgPropertyIDSets[0].guidPropertySet   = DBPROPSET_DBINIT;
  rgPropertyIDSets[0].rgPropertyIDs   = rgProperties;
  rgPropertyIDSets[0].cPropertyIDs    = cProperties;

    //Get the property values
    hr = m_pObj->m_pUtilProp->GetProperties(PROPSET_DSO, cPropertyIDSets, rgPropertyIDSets, &cPropSets, &rgPropSets );
  if(SUCCEEDED(hr))
  {
    pwszDataSource  = V_BSTR(&rgPropSets[0].rgProperties[0].vValue);
    nPrompt     = V_I2(&rgPropSets[0].rgProperties[1].vValue);

#ifdef _WIN64
    hWnd      = (HWND)V_I8(&rgPropSets[0].rgProperties[2].vValue);
#else
    hWnd      = (HWND)V_I4(&rgPropSets[0].rgProperties[2].vValue);
#endif
    //Convert Directory to MBCS
    ConvertToMBCS(pwszDataSource, szDataSource, sizeof(szDataSource));
  }

  // if caller didn't supply a directory path, ask the user
    if ((nPrompt == DBPROMPT_PROMPT) ||
    ((nPrompt == DBPROMPT_COMPLETE || nPrompt == DBPROMPT_COMPLETEREQUIRED) && (!SetCurrentDirectory(szDataSource))) )
    {
      //Use our current DataSource as defaults for properties
    TESTC(hr = QueryInterface(IID_IDBProperties, (void**)&pIDBProperties));

    //Use the Data Links Dialog to prompt...
    TESTC(hr = CoCreateInstance(CLSID_DataLinks, NULL, CLSCTX_ALL, IID_IDBPromptInitialize, (void**)&pIDBPromptInitialize));
    TESTC(hr = pIDBPromptInitialize->PromptDataSource(NULL, hWnd, DBPROMPTOPTIONS_PROPERTYSHEET | DBPROMPTOPTIONS_DISABLE_PROVIDER_SELECTION, 0, NULL, NULL, IID_IDBProperties, (IUnknown**)&pIDBProperties));

    //Free the Previous Properties
    FreeProperties(&cPropSets, &rgPropSets);
    pwszDataSource = NULL;

    //Now Data Links has put the user choosen properties onto our data source, we just need to
    //reobtain the property values...
    hr = m_pObj->m_pUtilProp->GetProperties(PROPSET_DSO, cPropertyIDSets, rgPropertyIDSets, &cPropSets, &rgPropSets );
    if(SUCCEEDED(hr))
    {
      pwszDataSource  = V_BSTR(&rgPropSets[0].rgProperties[0].vValue);
      nPrompt     = V_I2(&rgPropSets[0].rgProperties[1].vValue);

#ifdef _WIN64
      hWnd      = (HWND)V_I8(&rgPropSets[0].rgProperties[2].vValue);
#else
      hWnd      = (HWND)V_I4(&rgPropSets[0].rgProperties[2].vValue);
#endif
      //Convert Directory to MBCS
      ConvertToMBCS(pwszDataSource, szDataSource, sizeof(szDataSource));
    }
  }

  //NOTE:  We don't require DBPROP_INIT_DATASOURCE.  If the DataSource property is passed
  //in then we will use that to represent the current directory.  This will allow the user
  //to only have to specify the filename in OpenRowset, and not the full path...
  if(szDataSource[0])
  {
    // Get the current Directory
    CHAR szCurrentDir[MAX_PATH];
    GetCurrentDirectory( MAX_PATH, szCurrentDir );

    //See if the directory passed is valid...
    if(!SetCurrentDirectory( szDataSource ))
    {
      hr = DB_E_ERRORSOCCURRED;
      goto CLEANUP;
    }

    // Restore to the original directory.
    SetCurrentDirectory( szCurrentDir );
    wcsncpy( m_pObj->m_wszPath, pwszDataSource, MAX_PATH);
  }
  else
  {
    m_pObj->m_wszPath[0] = wEOL;
  }

  //We are now initialized...
  m_pObj->m_fDSOInitialized = TRUE;
  hr = S_OK;

CLEANUP:
  FreeProperties(&cPropSets, &rgPropSets);
  SAFE_RELEASE(pIDBPromptInitialize);
  SAFE_RELEASE(pIDBProperties);
  return hr;
}

STDMETHODIMP CImpIDBInitialize::Uninitialize ( void )

Definition at line 156 of file dbinit.cpp.

{
    assert( m_pObj );

    if (!m_pObj->m_fDSOInitialized)
        {
        // data source object is not initialized; do nothing
        return ResultFromScode( S_OK );
        }
    else
        {
        if (!m_pObj->m_fDBSessionCreated)
            {
            // DSO initialized, but no DBSession has been created.
            // So, reset DSO to uninitialized state
            m_pObj->m_fDSOInitialized = FALSE;
            return ResultFromScode( S_OK );
            }
        else
            {
            // DBSession has already been created; trying to uninit
            // the DSO now is an error
            return ResultFromScode( DB_E_OBJECTOPEN );
            }
        }
}

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/sampprov/datasrc.h
  • Dataaccess/oledb/sampprov/dbinit.cpp
Generated on Wed Nov 13 2024 16:56:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CImpIDBProperties Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CImpIDBProperties Class Reference

#include "datasrc.h"

List of all members.

Public Member Functions

DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR (CDataSource, CImpIDBProperties)
DEFINE_DEFAULT_IUNKNOWN_ADDREF_RELEASE
STDMETHODIMP 		GetProperties (ULONG cPropertySets, const DBPROPIDSET rgPropertySets[], ULONG *pcProperties, DBPROPSET **prgProperties)
STDMETHODIMP | GetPropertyInfo (ULONG cPropertySets, const DBPROPIDSET rgPropertySets[], ULONG *pcPropertyInfoSets, DBPROPINFOSET **prgPropertyInfoSets, WCHAR **ppDescBuffer)
STDMETHODIMP | SetProperties (ULONG cPropertySets, DBPROPSET rgPropertySets[])

Detailed Description

Definition at line 152 of file datasrc.h.

Member Function Documentation

CImpIDBProperties::DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR | ( | CDataSource | ,
 |  | CImpIDBProperties |
 | ) |  |
STDMETHODIMP CImpIDBProperties::GetProperties | ( | ULONG | cPropertySets,
 |  | const DBPROPIDSET | rgPropertySets[],
 |  | ULONG * | pcProperties,
 |  | DBPROPSET ** | prgProperties
 | ) |  |

Definition at line 193 of file dbprop.cpp.

{
    HRESULT hr = E_FAIL;

    //
  // Asserts
    //
  assert(m_pObj);
    assert(m_pObj->m_pUtilProp);

    //
    // Check in-params and NULL out-params in case of error
    //
  hr = m_pObj->m_pUtilProp->GetPropertiesArgChk(
                  m_pObj->m_fDSOInitialized ?
                  PROPSET_DSOINIT :
                  PROPSET_DSO,
                  cPropertySets,
                  rgPropertySets,
                  pcProperties,
                  prgProperties );
  if( FAILED(hr) )
    return hr;

    //
    // Just pass this call on to the utility object that manages our properties
    //
    return m_pObj->m_pUtilProp->GetProperties(
                  m_pObj->m_fDSOInitialized ?
                  PROPSET_DSOINIT :
                  PROPSET_DSO,
                  cPropertySets,
                  rgPropertySets,
                  pcProperties,
                  prgProperties );
}

STDMETHODIMP CImpIDBProperties::GetPropertyInfo | ( | ULONG | cPropertySets,
 |  | const DBPROPIDSET | rgPropertySets[],
 |  | ULONG * | pcPropertyInfoSets,
 |  | DBPROPINFOSET ** | prgPropertyInfoSets,
 |  | WCHAR ** | ppDescBuffer
 | ) |  |

Definition at line 155 of file dbprop.cpp.

{
    //
  // Asserts
    //
  assert(m_pObj);
    assert(m_pObj->m_pUtilProp);

    //
    // Just pass this call on to the utility object that manages our properties
    //
    return m_pObj->m_pUtilProp->GetPropertyInfo(
                  m_pObj->m_fDSOInitialized,
                  cPropertySets,
                  rgPropertySets,
                  pcPropertyInfoSets,
                  prgPropertyInfoSets,
                  ppDescBuffer );
}

STDMETHODIMP CImpIDBProperties::SetProperties | ( | ULONG | cPropertySets,
 |  | DBPROPSET | rgPropertySets[]
 | ) |  |

Definition at line 245 of file dbprop.cpp.

{
    HRESULT hr = E_FAIL;

    //
  // Asserts
    //
  assert(m_pObj);
    assert(m_pObj->m_pUtilProp);

    //
  // No-op if cPropertySets is 0
    //
  if( cPropertySets == 0 )
    return S_OK;

    //
    // Check in-params and NULL out-params in case of error
    //
  hr=m_pObj->m_pUtilProp->SetPropertiesArgChk(cPropertySets, rgPropertySets);

  if( FAILED(hr) )
    return hr;

    //
    // Just pass this call on to the utility object that manages our properties
    //
    return m_pObj->m_pUtilProp->SetProperties(
                  m_pObj->m_fDSOInitialized ?
                  PROPSET_DSOINIT : PROPSET_DSO,
                  cPropertySets,
                  rgPropertySets );
}

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/sampprov/datasrc.h
  • Dataaccess/oledb/sampprov/dbprop.cpp
Generated on Wed Nov 13 2024 16:56:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CImpIFileViewer Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CImpIFileViewer Class Reference

#include "FVText.h"

List of all members.

Public Member Functions

CImpIFileViewer (PCFileViewer, LPUNKNOWN)
~CImpIFileViewer (void)
STDMETHODIMP | PrintTo (LPSTR, BOOL)
STDMETHODIMP | QueryInterface (REFIID, PPVOID)
STDMETHODIMP | Show (LPFVSHOWINFO pvsi)
STDMETHODIMP | ShowInitialize (LPFILEVIEWERSITE lpfsi)
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP_ (ULONG) Release(void)

Private Attributes

PCFileViewer m_pObj
LPUNKNOWN | m_pUnkOuter

Detailed Description

Definition at line 236 of file FVText.h.

Constructor & Destructor Documentation

CImpIFileViewer::CImpIFileViewer | ( | PCFileViewer | pObj,
 |  | LPUNKNOWN | pUnkOuter
 | ) |  |

Definition at line 30 of file IFileVW.Cpp.

    {
    m_pObj=pObj;
    m_pUnkOuter=pUnkOuter;
    return;
    }

CImpIFileViewer::~CImpIFileViewer ( void )

Definition at line 42 of file IFileVW.Cpp.

    {
    return;
    }

Member Function Documentation

STDMETHODIMP CImpIFileViewer::PrintTo | ( | LPSTR | pszDriver,
 |  | BOOL | fSuppressUI
 | ) |  |

Definition at line 83 of file IFileVW.Cpp.

    {
     // Printing not implemented in this sample, but
     // make a stub call anyway.
    return m_pObj->PrintTo(pszDriver, fSuppressUI);
    }

STDMETHODIMP CImpIFileViewer::QueryInterface | ( | REFIID | riid,
 |  | PPVOID | ppv
 | ) |  |

Definition at line 53 of file IFileVW.Cpp.

    {
    return m_pUnkOuter->QueryInterface(riid, ppv);
    }

STDMETHODIMP CImpIFileViewer::Show ( LPFVSHOWINFO pvsi )

Definition at line 127 of file IFileVW.Cpp.

    {
    if (!m_pObj->m_fShowInit)
        return ResultFromScode(E_UNEXPECTED);

    m_pObj->FileShow(pvsi);
    return NOERROR;
    }

STDMETHODIMP CImpIFileViewer::ShowInitialize ( LPFILEVIEWERSITE lpfsi )

Definition at line 104 of file IFileVW.Cpp.

    {
    return m_pObj->FileShowInit(lpfsi);
    }

CImpIFileViewer::STDMETHODIMP_ ( ULONG )
CImpIFileViewer::STDMETHODIMP_ ( ULONG )

Member Data Documentation

PCFileViewer CImpIFileViewer::m_pObj [private]

Definition at line 239 of file FVText.h.

LPUNKNOWN CImpIFileViewer::m_pUnkOuter [private]

Definition at line 240 of file FVText.h.

The documentation for this class was generated from the following files:
  • WinUI/Shell/FileView/FVText.h
  • WinUI/Shell/FileView/IFileVW.Cpp
Generated on Wed Nov 13 2024 16:56:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CImpIGetDataSource Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CImpIGetDataSource Class Reference

#include "dbsess.h"

List of all members.

Public Member Functions

DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR (CDBSession, CImpIGetDataSource)
DEFINE_DEFAULT_IUNKNOWN_ADDREF_RELEASE
STDMETHODIMP 		GetDataSource (REFIID, IUnknown **)

Detailed Description

Definition at line 98 of file dbsess.h.

Member Function Documentation

CImpIGetDataSource::DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR | ( | CDBSession | ,
 |  | CImpIGetDataSource |
 | ) |  |
STDMETHODIMP CImpIGetDataSource::GetDataSource | ( | REFIID | riid,
 |  | IUnknown ** | ppDataSource
 | ) |  |

Definition at line 243 of file dbsess.cpp.

{
  //
  // Asserts
    //
  assert(m_pObj);
  assert(m_pObj->m_pCDataSource);
  assert(m_pObj->m_pCDataSource->m_pUnkOuter);

    //
    // Check in-params and NULL out-params in case of error
    //
  if( !ppDataSource )
    return (E_INVALIDARG);

  //
  // Handle Aggregated DataSource (if aggregated)
  //
  return m_pObj->m_pCDataSource->m_pUnkOuter->QueryInterface(riid, (LPVOID*)ppDataSource);
}

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/sampprov/dbsess.h
  • Dataaccess/oledb/sampprov/dbsess.cpp
Generated on Wed Nov 13 2024 16:56:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CImpIGetRow Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CImpIGetRow Class Reference

#include "rowset.h"

List of all members.

Public Member Functions

DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR (CRowset, CImpIGetRow)
DEFINE_DEFAULT_IUNKNOWN_ADDREF_RELEASE
STDMETHODIMP 		GetRowFromHROW (IUnknown *pIUnkOuter, HROW hRow, REFIID riid, IUnknown **ppUnk)
STDMETHODIMP GetURLFromHROW (HROW hRow, LPOLESTR *ppwszURL)

Detailed Description

Definition at line 323 of file rowset.h.

Member Function Documentation

CImpIGetRow::DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR | ( | CRowset | ,
 |  | CImpIGetRow |
 | ) |  |
STDMETHODIMP CImpIGetRow::GetRowFromHROW | ( | IUnknown * | pIUnkOuter,
 |  | HROW | hRow,
 |  | REFIID | riid,
 |  | IUnknown ** | ppUnk
 | ) |  |

Definition at line 31 of file igetrow.cpp.

{
  HRESULT hr = S_OK;
  CRow* pCRow = NULL;

  if( NULL == ppUnk )
    return E_INVALIDARG;

  *ppUnk = NULL;

  if( pIUnkOuter && riid != IID_IUnknown )
    return DB_E_NOAGGREGATION;

  if( DB_NULL_HROW == hRow )
    return DB_E_BADROWHANDLE;

  //Create a CRow object
  pCRow = new CRow(pIUnkOuter);
  if( NULL == pCRow || !pCRow->FInit(m_pObj) )
    return E_OUTOFMEMORY;

  hr = pCRow->QueryInterface(riid, (void**)ppUnk);
  if( SUCCEEDED(hr) )
  {
    //Set the row handle to this object...
    hr = pCRow->SetRowHandle(hRow);
  }
  else
  {
    delete pCRow;
  }

  return hr;
}

STDMETHODIMP CImpIGetRow::GetURLFromHROW | ( | HROW | hRow,
 |  | LPOLESTR * | ppwszURL
 | ) |  |

Definition at line 83 of file igetrow.cpp.

{
  ULONG     cchLenURL = 0;
  ROWBUFF *   pRowBuff = NULL;
  static WCHAR  s_wszURLFmt[] = L"SampProv:Datasource=%s,File=%s,Row=%d";

  assert( m_pObj );

  if( !ppwszURL )
    return E_INVALIDARG;

  *ppwszURL = NULL;

  if( DB_NULL_HROW == hRow ||
    m_pObj->m_prowbitsIBuffer->IsSlotSet( (ULONG)hRow ) != S_OK )
        return DB_E_BADROWHANDLE;

  pRowBuff = m_pObj->GetRowBuff( hRow, TRUE );
    assert( pRowBuff && pRowBuff->ulRefCount );

  if ( m_pObj->m_pFileio &&
     m_pObj->m_pFileio->IsDeleted( (DBBKMARK) pRowBuff->pbBmk ) == S_OK )
    return DB_E_DELETEDROW;

  cchLenURL = wcslen(s_wszURLFmt) + (2 * MAX_PATH) + INT_DISPLAY_SIZE;
  *ppwszURL = (WCHAR *)PROVIDER_ALLOC( cchLenURL * sizeof(WCHAR));

  if( *ppwszURL )
  {
    swprintf(*ppwszURL, s_wszURLFmt, m_pObj->m_wszDataSourcePath,
          m_pObj->m_wszFilePath, (DBBKMARK) pRowBuff->pbBmk);

    return S_OK;
  }
  else
    return E_OUTOFMEMORY;
}

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/sampprov/rowset.h
  • Dataaccess/oledb/sampprov/igetrow.cpp
Generated on Wed Nov 13 2024 16:56:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CImpIGetSession Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CImpIGetSession Class Reference

#include "row.h"

List of all members.

Public Member Functions

DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR (CRow, CImpIGetSession)
DEFINE_DEFAULT_IUNKNOWN_ADDREF_RELEASE
STDMETHODIMP 		GetSession (REFIID riid, IUnknown **ppSession)

Detailed Description

Definition at line 159 of file row.h.

Member Function Documentation

CImpIGetSession::DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR | ( | CRow | ,
 |  | CImpIGetSession |
 | ) |  |
STDMETHODIMP CImpIGetSession::GetSession | ( | REFIID | riid,
 |  | IUnknown ** | ppSession
 | ) |  |

Definition at line 687 of file row.cpp.

{
  CRowset *   pCRowset = NULL;
  CBaseObj *    pCRowsetParent = NULL;
  CDBSession *  pCSession = NULL;

  //
  // Asserts
    //
  assert(m_pObj);
  assert(m_pObj->m_pParentObj);

  if( NULL == ppunkSession )
    return (E_INVALIDARG);

  *ppunkSession = NULL;

  if( BOT_SESSION == m_pObj->m_pParentObj->GetBaseObjectType() )
  {
    pCSession = (CDBSession *)m_pObj->m_pParentObj;
  }
  else
  {
    assert( BOT_ROWSET == m_pObj->m_pParentObj->GetBaseObjectType() );
    pCRowset = (CRowset *)m_pObj->m_pParentObj;
    if( !pCRowset )
      return E_FAIL;

    pCRowsetParent = pCRowset->m_pParentObj;
    if( !pCRowsetParent )
      return E_FAIL;

    if( BOT_SESSION == pCRowsetParent->GetBaseObjectType() )
      pCSession = (CDBSession *)pCRowsetParent;
    else if( BOT_COMMAND == pCRowsetParent->GetBaseObjectType() )
      pCSession = ((CCommand *)pCRowsetParent)->m_pCSession;
    else
      return E_FAIL;
  }

  if( pCSession )
    return pCSession->GetOuterUnknown()->QueryInterface(riid, (LPVOID*)ppunkSession);
  else
    return DB_E_NOSOURCEOBJECT;
}

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/sampprov/row.h
  • Dataaccess/oledb/sampprov/row.cpp
Generated on Wed Nov 13 2024 16:56:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CImpIGetSourceRow Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CImpIGetSourceRow Class Reference

#include "stream.h"

List of all members.

Public Member Functions

DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR (CStream, CImpIGetSourceRow)
DEFINE_DEFAULT_IUNKNOWN_ADDREF_RELEASE
STDMETHODIMP 		GetSourceRow (REFIID riid, IUnknown **ppRow)

Detailed Description

Definition at line 76 of file stream.h.

Member Function Documentation

CImpIGetSourceRow::DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR | ( | CStream | ,
 |  | CImpIGetSourceRow |
 | ) |  |
STDMETHODIMP CImpIGetSourceRow::GetSourceRow | ( | REFIID | riid,
 |  | IUnknown ** | ppRow
 | ) |  |

Definition at line 194 of file stream.cpp.

{
  assert( m_pObj );
  assert( m_pObj->m_pParentObj );

  //Null output arg
  if( ppRow )
    *ppRow = NULL;

  //Check for E_INVALIDARG condition
  if( NULL == ppRow )
    return E_INVALIDARG;

  return m_pObj->m_pParentObj->GetOuterUnknown()->QueryInterface(riid, (LPVOID*)ppRow);
}

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/sampprov/stream.h
  • Dataaccess/oledb/sampprov/stream.cpp
Generated on Wed Nov 13 2024 16:56:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CImpIOleClientSite Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CImpIOleClientSite Class Reference

#include "Site.h"

List of all members.

Public Member Functions

CImpIOleClientSite (class CSite *, IUnknown *)
~CImpIOleClientSite (void)
STDMETHODIMP | GetContainer (LPOLECONTAINER *)
STDMETHODIMP | GetMoniker (DWORD, DWORD, LPMONIKER *)
STDMETHODIMP | OnShowWindow (BOOL)
STDMETHODIMP | QueryInterface (REFIID, void **)
STDMETHODIMP | RequestNewObjectLayout (void)
STDMETHODIMP | SaveObject (void)
STDMETHODIMP | ShowObject (void)
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) AddRef(void)

Protected Attributes

ULONG m_cRef
class CSite * | m_pSite
LPUNKNOWN | m_pUnkOuter

Detailed Description

Definition at line 29 of file Site.h.

Constructor & Destructor Documentation

CImpIOleClientSite::CImpIOleClientSite | ( | class CSite * | ,
 |  | IUnknown * |
 | ) |  |
CImpIOleClientSite::~CImpIOleClientSite ( void )

Definition at line 46 of file ICliSite.Cpp.

    {
    return;
    }

Member Function Documentation

STDMETHODIMP CImpIOleClientSite::GetContainer ( LPOLECONTAINER * ppContainer )

Definition at line 123 of file ICliSite.Cpp.

    {
    *ppContainer=NULL;
    return E_NOINTERFACE;
    }

STDMETHODIMP CImpIOleClientSite::GetMoniker | ( | DWORD | dwAssign,
 |  | DWORD | dwWhich,
 |  | LPMONIKER * | ppmk
 | ) |  |

Definition at line 117 of file ICliSite.Cpp.

    {
    return E_NOTIMPL;
    }

STDMETHODIMP CImpIOleClientSite::OnShowWindow ( BOOL fShow )

Definition at line 135 of file ICliSite.Cpp.

    {
    return NOERROR;
    }

STDMETHODIMP CImpIOleClientSite::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppv
 | ) |  |

Definition at line 63 of file ICliSite.Cpp.

    {
    return m_pUnkOuter->QueryInterface(riid, ppv);
    }

STDMETHODIMP CImpIOleClientSite::RequestNewObjectLayout ( void )

Definition at line 130 of file ICliSite.Cpp.

    {
    return E_NOTIMPL;
    }

STDMETHODIMP CImpIOleClientSite::SaveObject ( void )

Definition at line 99 of file ICliSite.Cpp.

    {
    m_pSite->Update();
    return NOERROR;
    }

STDMETHODIMP CImpIOleClientSite::ShowObject ( void )

Definition at line 140 of file ICliSite.Cpp.

    {
    return NOERROR;
    }

CImpIOleClientSite::STDMETHODIMP_ ( ULONG )
CImpIOleClientSite::STDMETHODIMP_ ( ULONG )

Member Data Documentation

ULONG CImpIOleClientSite::m_cRef [protected]

Definition at line 32 of file Site.h.

class CSite* CImpIOleClientSite::m_pSite [protected]

Definition at line 33 of file Site.h.

LPUNKNOWN CImpIOleClientSite::m_pUnkOuter [protected]

Definition at line 34 of file Site.h.

The documentation for this class was generated from the following files:
  • Com/Fundamentals/ActiveDocument/Framer/Site.h
  • Com/Fundamentals/ActiveDocument/Framer/ICliSite.Cpp
Generated on Wed Nov 13 2024 16:56:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CImpIOleDocumentSite Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CImpIOleDocumentSite Class Reference

#include "Site.h"

List of all members.

Public Member Functions

CImpIOleDocumentSite (class CSite *, IUnknown *)
~CImpIOleDocumentSite (void)
STDMETHODIMP | ActivateMe (IOleDocumentView *)
STDMETHODIMP | QueryInterface (REFIID, void **)
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) AddRef(void)

Protected Attributes

ULONG m_cRef
class CSite * | m_pSite
LPUNKNOWN | m_pUnkOuter

Detailed Description

Definition at line 116 of file Site.h.

Constructor & Destructor Documentation

CImpIOleDocumentSite::CImpIOleDocumentSite | ( | class CSite * | ,
 |  | IUnknown * |
 | ) |  |
CImpIOleDocumentSite::~CImpIOleDocumentSite ( void )

Definition at line 46 of file IDocSite.Cpp.

    {
    return;
    }

Member Function Documentation

STDMETHODIMP CImpIOleDocumentSite::ActivateMe ( IOleDocumentView * pView )

Definition at line 98 of file IDocSite.Cpp.

    {
    RECT                rc;
    IOleDocument*       pDoc;

    /*
     * If we're passed a NULL view pointer, then try to get one from
     * the document object (the object within us).
     */
    if (NULL==pView)
        {

        if (FAILED(m_pSite->m_pObj->QueryInterface(IID_IOleDocument
            , (void **)&pDoc)))
            return E_FAIL;

        if (FAILED(pDoc->CreateView(m_pSite->m_pImpIOleIPSite
            , m_pSite->m_pIStream, 0, &pView)))
            return E_OUTOFMEMORY;

        // Release doc pointer since CreateView is a good com method that addrefs
        pDoc->Release();
        }
    else
        {
        //Make sure that the view has our client site
        pView->SetInPlaceSite(m_pSite->m_pImpIOleIPSite);

        //We're holding onto the pointer, so AddRef it.
        pView->AddRef();
        }

    /*
     * Activation steps, now that we have a view:
     *
     *  1.  Call IOleDocumentView::SetInPlaceSite (assume done since
     *      either the view already knows, or IOleDocument::CreateView
     *      has done it already.
     *
     *  2.  Call IOleDocumentView::SetRect to give a bunch of space to
     *      the view.  In our case this is the whole client area of
     *      the CPages window.  (Patron doesn't use SetRectComplex)
     *
     *  3.  Call IOleDocumentView::Show to make the thing visible.
     *
     *  4.  Call IOleDocumentView::UIActivate to finish the job.
     *
     */

    m_pSite->m_fDocObj=TRUE;
    m_pSite->m_pIOleDocView=pView;

    //This sets up toolbars and menus first
    pView->UIActivate(TRUE);

    //Set the window size sensitive to new toolbars
    GetClientRect(m_pSite->m_hWnd, &rc);
    pView->SetRect(&rc);

  //Makes it all active
    pView->Show(TRUE);
    return NOERROR;
    }

STDMETHODIMP CImpIOleDocumentSite::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppv
 | ) |  |

Definition at line 62 of file IDocSite.Cpp.

    {
    return m_pUnkOuter->QueryInterface(riid, ppv);
    }

CImpIOleDocumentSite::STDMETHODIMP_ ( ULONG )
CImpIOleDocumentSite::STDMETHODIMP_ ( ULONG )

Member Data Documentation

ULONG CImpIOleDocumentSite::m_cRef [protected]

Definition at line 119 of file Site.h.

class CSite* CImpIOleDocumentSite::m_pSite [protected]

Definition at line 120 of file Site.h.

LPUNKNOWN CImpIOleDocumentSite::m_pUnkOuter [protected]

Definition at line 121 of file Site.h.

The documentation for this class was generated from the following files:
  • Com/Fundamentals/ActiveDocument/Framer/Site.h
  • Com/Fundamentals/ActiveDocument/Framer/IDocSite.Cpp
Generated on Wed Nov 13 2024 16:56:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CImpIOleInPlaceSite Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CImpIOleInPlaceSite Class Reference

#include "Site.h"

List of all members.

Public Member Functions

CImpIOleInPlaceSite (class CSite *, IUnknown *)
~CImpIOleInPlaceSite (void)
STDMETHODIMP | CanInPlaceActivate (void)
STDMETHODIMP | ContextSensitiveHelp (BOOL)
STDMETHODIMP | DeactivateAndUndo (void)
STDMETHODIMP | DiscardUndoState (void)
STDMETHODIMP | GetWindow (HWND *)
STDMETHODIMP | GetWindowContext (LPOLEINPLACEFRAME *, LPOLEINPLACEUIWINDOW *, LPRECT, LPRECT, LPOLEINPLACEFRAMEINFO)
STDMETHODIMP | OnInPlaceActivate (void)
STDMETHODIMP | OnInPlaceDeactivate (void)
STDMETHODIMP | OnPosRectChange (LPCRECT)
STDMETHODIMP | OnUIActivate (void)
STDMETHODIMP | OnUIDeactivate (BOOL)
STDMETHODIMP | QueryInterface (REFIID, void **)
STDMETHODIMP | Scroll (SIZE)
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP_ (ULONG) Release(void)

Protected Attributes

ULONG m_cRef
class CSite * | m_pSite
LPUNKNOWN | m_pUnkOuter

Detailed Description

Definition at line 82 of file Site.h.

Constructor & Destructor Documentation

CImpIOleInPlaceSite::CImpIOleInPlaceSite | ( | class CSite * | ,
 |  | IUnknown * |
 | ) |  |
CImpIOleInPlaceSite::~CImpIOleInPlaceSite ( void )

Definition at line 46 of file IIpSite.Cpp.

    {
    return;
    }

Member Function Documentation

STDMETHODIMP CImpIOleInPlaceSite::CanInPlaceActivate ( void )

Definition at line 151 of file IIpSite.Cpp.

    {
    /*
     * We can always in-place activate--no restrictions for DocObjects.
     * We don't worry about other cases since CSite only ever creates
     * embedded files.
     */
    return NOERROR;
    }

STDMETHODIMP CImpIOleInPlaceSite::ContextSensitiveHelp ( BOOL fEnterMode )

Definition at line 124 of file IIpSite.Cpp.

    {
    return NOERROR;
    }

STDMETHODIMP CImpIOleInPlaceSite::DeactivateAndUndo ( void )

Definition at line 291 of file IIpSite.Cpp.

    {
    m_pSite->m_pIOleIPObject->InPlaceDeactivate();
    return NOERROR;
    }

STDMETHODIMP CImpIOleInPlaceSite::DiscardUndoState ( void )

Definition at line 315 of file IIpSite.Cpp.

    {
    return E_NOTIMPL;
    }

STDMETHODIMP CImpIOleInPlaceSite::GetWindow ( HWND * phWnd )

Definition at line 99 of file IIpSite.Cpp.

    {
    //This is the client-area window in the frame
    *phWnd=m_pSite->m_hWnd;
    return NOERROR;
    }

STDMETHODIMP CImpIOleInPlaceSite::GetWindowContext | ( | LPOLEINPLACEFRAME * | ppIIPFrame,
 |  | LPOLEINPLACEUIWINDOW * | ppIIPUIWindow,
 |  | LPRECT | prcPos,
 |  | LPRECT | prcClip,
 |  | LPOLEINPLACEFRAMEINFO | pFI
 | ) |  |

Definition at line 357 of file IIpSite.Cpp.

    {
    *ppIIPUIWindow=NULL;
    m_pSite->m_pFR->QueryInterface(IID_IOleInPlaceFrame
        , (void **)ppIIPFrame);

    if (NULL!=prcPos)
        GetClientRect(m_pSite->m_hWnd, prcPos);

    *prcClip=*prcPos;

    pFI->cb=sizeof(OLEINPLACEFRAMEINFO);
    pFI->fMDIApp=FALSE;
    pFI->hwndFrame=m_pSite->m_pFR->Window();
    pFI->haccel=m_pSite->m_pFR->Accelerators();
    pFI->cAccelEntries=CACCELERATORS;

    return NOERROR;
    }

STDMETHODIMP CImpIOleInPlaceSite::OnInPlaceActivate ( void )

Definition at line 180 of file IIpSite.Cpp.

    {
    m_pSite->m_pObj->QueryInterface(IID_IOleInPlaceObject
        , (void **)&m_pSite->m_pIOleIPObject);

    return NOERROR;
    }

STDMETHODIMP CImpIOleInPlaceSite::OnInPlaceDeactivate ( void )

Definition at line 206 of file IIpSite.Cpp.

    {
    /*
     * Since we don't have an Undo command, we can tell the object
     * right away to discard its Undo state.
     */
    m_pSite->Activate(OLEIVERB_DISCARDUNDOSTATE);
    ReleaseInterface(m_pSite->m_pIOleIPObject);
    return NOERROR;
    }

STDMETHODIMP CImpIOleInPlaceSite::OnPosRectChange ( LPCRECT prcPos )

Definition at line 422 of file IIpSite.Cpp.

    {
    //Not needed for DocObjects
    return E_NOTIMPL;
    }

STDMETHODIMP CImpIOleInPlaceSite::OnUIActivate ( void )

Definition at line 235 of file IIpSite.Cpp.

    {
    //No state we have to set up here.
    return NOERROR;
    }

STDMETHODIMP CImpIOleInPlaceSite::OnUIDeactivate ( BOOL fUndoable )

Definition at line 261 of file IIpSite.Cpp.

    {
    //Set focus back to the frame
    SetFocus(m_pSite->m_pFR->Window());

    //Show our menu again
    m_pSite->m_pFR->SetMenu(NULL, NULL, NULL);

    return NOERROR;
    }

STDMETHODIMP CImpIOleInPlaceSite::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppv
 | ) |  |

Definition at line 62 of file IIpSite.Cpp.

    {
    return m_pUnkOuter->QueryInterface(riid, ppv);
    }

STDMETHODIMP CImpIOleInPlaceSite::Scroll ( SIZE sz )

Definition at line 398 of file IIpSite.Cpp.

    {
    //Not needed for DocObjects
    return E_NOTIMPL;
    }

CImpIOleInPlaceSite::STDMETHODIMP_ ( ULONG )
CImpIOleInPlaceSite::STDMETHODIMP_ ( ULONG )

Member Data Documentation

ULONG CImpIOleInPlaceSite::m_cRef [protected]

Definition at line 85 of file Site.h.

class CSite* CImpIOleInPlaceSite::m_pSite [protected]

Definition at line 86 of file Site.h.

LPUNKNOWN CImpIOleInPlaceSite::m_pUnkOuter [protected]

Definition at line 87 of file Site.h.

The documentation for this class was generated from the following files:
  • Com/Fundamentals/ActiveDocument/Framer/Site.h
  • Com/Fundamentals/ActiveDocument/Framer/IIpSite.Cpp
Generated on Wed Nov 13 2024 16:56:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CImpIOpenRowset Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CImpIOpenRowset Class Reference

#include "dbsess.h"

List of all members.

Public Member Functions

DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR (CDBSession, CImpIOpenRowset)
DEFINE_DEFAULT_IUNKNOWN_ADDREF_RELEASE
STDMETHODIMP 		OpenRowset (IUnknown *, DBID *, DBID *, REFIID, ULONG, DBPROPSET[], IUnknown **)

Detailed Description

Definition at line 117 of file dbsess.h.

Member Function Documentation

CImpIOpenRowset::DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR | ( | CDBSession | ,
 |  | CImpIOpenRowset |
 | ) |  |
STDMETHODIMP CImpIOpenRowset::OpenRowset | ( | IUnknown * | pUnkOuter,
 |  | DBID * | pTableID,
 |  | DBID * | pIndexID,
 |  | REFIID | riid,
 |  | ULONG | cPropertySets,
 |  | DBPROPSET | rgPropertySets[],
 |  | IUnknown ** | ppRowset
 | ) |  |

Definition at line 33 of file opnrowst.cpp.

{
  CCommand*       pCCommand = NULL;
  ICommandText*     pICmdText = NULL;
  ICommandProperties*   pICmdProp = NULL;
    CRowset*    pRowset = NULL;

    HRESULT     hr;
  HRESULT   hrProp  = ResultFromScode( S_OK );
  ULONG   ul,ul2;

    assert( m_pObj );
  assert( m_pObj->m_pUtilProp );

    // NULL out-params in case of error
    if( ppRowset )
      *ppRowset = NULL;

    // Check Arguments
  if ( !pTableID && !pIndexID )
        return ResultFromScode( E_INVALIDARG );

  if ( riid == IID_NULL)
        return ResultFromScode( E_NOINTERFACE );

  // Check Arguments for use by properties
  if( cPropertySets )
  {
    hr = m_pObj->m_pUtilProp->SetPropertiesArgChk(cPropertySets,
                            rgPropertySets);
    if( FAILED(hr) )
      return hr;
  }

  // We only accept NULL for pIndexID
  if( pIndexID )
    return ResultFromScode( DB_E_NOINDEX );

  // If the eKind is not known to use, basically it
  // means we have no table identifier
  if ( (!pTableID ) || ( pTableID->eKind != DBKIND_NAME ) ||
     ( (pTableID->eKind == DBKIND_NAME) && (!(pTableID->uName.pwszName)) ) ||
     ( wcslen(pTableID->uName.pwszName) == 0 ) ||
     ( wcslen(pTableID->uName.pwszName) > _MAX_FNAME ) )
    return ResultFromScode( DB_E_NOTABLE );

  // We do not allow the riid to be anything other than IID_IUnknown for aggregation
  if ( (pUnkOuter) && (riid != IID_IUnknown) )
    return ResultFromScode( DB_E_NOAGGREGATION );

  // Create a Command Object
  // This is the outer unknown from the user, for the new Command,
  // not to be confused with the outer unknown of this DBSession object.
  pCCommand = new CCommand(m_pObj, NULL);
  if (pCCommand)
  {
    hr = pCCommand->FInit();
    if( FAILED(hr) )
    {
      delete pCCommand; // clean up.
      pCCommand = NULL;
    }
  }
  else
  {
    // Since Ctor failed, it cannot know to Release pUnkOuter,
    // so we must do it here since we are owner.
    if (pUnkOuter)
      pUnkOuter->Release();
    hr = E_OUTOFMEMORY;
  }

  if( pCCommand )
  {
    // Since we are using the command objects interfaces to impersonate
    // doing IOpenRowset, we need to tell the command object to post errors
    // as IID_IOpenRowset
    pCCommand->SetImpersonateIID(&IID_IOpenRowset);

    // Allocate buffer for Table Name.
    if( FAILED(hr = pCCommand->QueryInterface(IID_ICommandText, (LPVOID*)&pICmdText)) )
    {
      assert(!"QI for ICmdText failed");
      goto EXIT;
    }
    assert( pICmdText );
    if( FAILED(hr = pICmdText->SetCommandText(DBGUID_DEFAULT, pTableID->uName.pwszName)) )
    {
      // Process Errors
      goto EXIT;
    }

    // Process Properties
    if( cPropertySets > 0 )
    {
      if( FAILED(hr = pCCommand->QueryInterface(IID_ICommandProperties, (LPVOID*)&pICmdProp)) )
      {
        assert(!"QI for ICmdProp failed");
        goto EXIT;
      }
      assert( pICmdProp );
      hr = (pICmdProp->SetProperties(cPropertySets, rgPropertySets));
      if( (hr == DB_E_ERRORSOCCURRED) ||
        (hr == DB_S_ERRORSOCCURRED) )
      {
        // If all the properties set were SETIFCHEAP then we can set
        // our status to DB_S_ERRORSOCCURRED and continue.
        for(ul=0;ul<cPropertySets; ul++)
        {
          for(ul2=0;ul2<rgPropertySets[ul].cProperties; ul2++)
          {
            // Check for a required property that failed, if found, we must return
            // DB_E_ERRORSOCCURRED
            if( (rgPropertySets[ul].rgProperties[ul2].dwStatus != DBPROPSTATUS_OK) &&
              (rgPropertySets[ul].rgProperties[ul2].dwOptions != DBPROPOPTIONS_SETIFCHEAP) )
            {
              hr = ResultFromScode(DB_E_ERRORSOCCURRED);
              goto EXIT;
            }
          }
        }
        hrProp = DB_S_ERRORSOCCURRED;
      }
      else if( FAILED(hr) )
      {
        goto EXIT;
      }
    }

    // Open the rowset using ::Execute
    // ppRowset buffer.
    if( ppRowset )
    {
      hr = pICmdText->Execute(pUnkOuter, riid, NULL, NULL, ppRowset);

      // Sample Provider's property handling is simplistic.
      // All property errors should have been caught by the previous
      // call to ::SetProperties.
      // Assume that a failure was caused by something other
      // than bad properties.
      // So, no need for property post-processing
    }
  }

EXIT:
  if( pICmdText )
    pICmdText->Release();
  if( pICmdProp )
    pICmdProp->Release();

  // DB_S_ERRORSOCCURRED must take precedence over DB_S_NOTSINGLETON
  return (hr == S_OK || hr == DB_S_NOTSINGLETON) ? hrProp : hr;
}

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/sampprov/dbsess.h
  • Dataaccess/oledb/sampprov/opnrowst.cpp
Generated on Wed Nov 13 2024 16:56:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CImpIPersist Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CImpIPersist Class Reference

#include "datasrc.h"

List of all members.

Public Member Functions

DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR (CDataSource, CImpIPersist)
DEFINE_DEFAULT_IUNKNOWN_ADDREF_RELEASE
STDMETHODIMP 		GetClassID (CLSID *pClassID)

Detailed Description

Definition at line 226 of file datasrc.h.

Member Function Documentation

CImpIPersist::DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR | ( | CDataSource | ,
 |  | CImpIPersist |
 | ) |  |
STDMETHODIMP CImpIPersist::GetClassID ( CLSID * pClassID )

Definition at line 26 of file persist.cpp.

{
    //
    // Check in-params and NULL out-params in case of error
    //
  if( !pClassID )
    return (E_FAIL);

  memcpy(pClassID, &CLSID_SampProv, sizeof(CLSID));
  return (S_OK);
}

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/sampprov/datasrc.h
  • Dataaccess/oledb/sampprov/persist.cpp
Generated on Wed Nov 13 2024 16:56:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CImpIPersistFile Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CImpIPersistFile Class Reference

#include "FVText.h"

List of all members.

Public Member Functions

CImpIPersistFile (PCFileViewer, LPUNKNOWN)
~CImpIPersistFile (void)
STDMETHODIMP | GetClassID (LPCLSID)
STDMETHODIMP | GetCurFile (LPOLESTR *)
STDMETHODIMP | IsDirty (void)
STDMETHODIMP | Load (LPCOLESTR, DWORD)
STDMETHODIMP | QueryInterface (REFIID, PPVOID)
STDMETHODIMP | Save (LPCOLESTR, BOOL)
STDMETHODIMP | SaveCompleted (LPCOLESTR)
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP_ (ULONG) Release(void)

Private Attributes

PCFileViewer m_pObj
LPUNKNOWN | m_pUnkOuter

Detailed Description

Definition at line 206 of file FVText.h.

Constructor & Destructor Documentation

CImpIPersistFile::CImpIPersistFile | ( | PCFileViewer | pObj,
 |  | LPUNKNOWN | pUnkOuter
 | ) |  |

Definition at line 31 of file IPerFile.Cpp.

    {
    m_pObj=pObj;
    m_pUnkOuter=pUnkOuter;
    return;
    }

CImpIPersistFile::~CImpIPersistFile ( void )

Definition at line 43 of file IPerFile.Cpp.

    {
    return;
    }

Member Function Documentation

STDMETHODIMP CImpIPersistFile::GetClassID ( LPCLSID pClsID )

Definition at line 81 of file IPerFile.Cpp.

    {
    *pClsID=m_pObj->m_clsID;
    return NOERROR;
    }

STDMETHODIMP CImpIPersistFile::GetCurFile ( LPOLESTR * ppszFile )

Definition at line 204 of file IPerFile.Cpp.

    {
    LPOLESTR    psz;
    ULONG       cb;

     // No modifications are necessary to this code:  it simply
     // copies the CFileViewer::m_pszPath string into a piece
     // of memory and stores the pointer at *ppszFile.
    //Load must be called, of course.
    if (m_pObj->m_fLoadCalled)
        {
        ODS("IPersistFile::GetCurFile called without IPersistFile::Load");
        return ResultFromScode(E_UNEXPECTED);
        }

    if (NULL==ppszFile)
        {
        ODS("IPersistFile::GetCurFile called with NULL pointer");
        return ResultFromScode(E_INVALIDARG);
        }

    cb=(lstrlen(m_pObj->m_pszPath)+1)*sizeof(OLECHAR);
    psz=(LPOLESTR)m_pObj->MemAlloc(cb);

    if (NULL==psz)
        {
        ODS("IPersistFile::GetCurFile failed to allocate duplicate pathname");
        return ResultFromScode(E_OUTOFMEMORY);
        }

    //Copy the ANSI filename to the new memory, converting to Unicode
    mbstowcs(psz, m_pObj->m_pszPath, cb);

    //Save the pointer which is not caller's responsibility
    *ppszFile=psz;
    return NOERROR;
    }

STDMETHODIMP CImpIPersistFile::IsDirty ( void )

Definition at line 95 of file IPerFile.Cpp.

    {
    return ResultFromScode(S_FALSE);
    }

STDMETHODIMP CImpIPersistFile::Load | ( | LPCOLESTR | pszFile,
 |  | DWORD | grfMode
 | ) |  |

Definition at line 113 of file IPerFile.Cpp.

    {
    char        szFile[MAX_PATH];
    LPSTR       psz;

     // No modifications are necessary to this code:  it simply
     // copies the parameters into the CFileViewer::m_pszPath and
     // m_grfMode members for use in IFileViewer::ShowInitialize
     // and IFileViewer::Show later on.

    //We should never be called twice
    if (NULL!=m_pObj->m_pszPath)
    {
        // Review:: Make sure everything else is handled correctly
        m_pObj->m_fLoadCalled = FALSE;  // handle error case
        m_pObj->MemFree(m_pObj->m_pszPath);
        m_pObj->m_pszPath = NULL;

    }

    if (NULL==pszFile)
        {
        ODS("IPersistFile::Load called with NULL pointer");
        return ResultFromScode(E_INVALIDARG);
        }

    //Convert Unicode filename to ANSI
    wcstombs(szFile, pszFile, sizeof(szFile));

    int cch = lstrlen(szFile)+1;
  psz=(LPSTR)m_pObj->MemAlloc(cch);

    if (NULL==psz)
        {
        ODS("IPersistFile::Load failed to allocate duplicate pathname");
        return ResultFromScode(E_OUTOFMEMORY);
        }

    //Copy the ANSI filename and the mode to use in opening it.
    lstrcpyn(psz, szFile, cch);
    m_pObj->m_pszPath=psz;
    m_pObj->m_grfMode=grfMode;

    //Remember that this function has been called.
    m_pObj->m_fLoadCalled=TRUE;
    return NOERROR;
    }

STDMETHODIMP CImpIPersistFile::QueryInterface | ( | REFIID | riid,
 |  | PPVOID | ppv
 | ) |  |

Definition at line 55 of file IPerFile.Cpp.

    {
    return m_pUnkOuter->QueryInterface(riid, ppv);
    }

STDMETHODIMP CImpIPersistFile::Save | ( | LPCOLESTR | pszFile,
 |  | BOOL | fRemember
 | ) |  |

Definition at line 170 of file IPerFile.Cpp.

    {
    ODS("IPersistFile::Save called...unexpected");
    return ResultFromScode(E_NOTIMPL);
    }

STDMETHODIMP CImpIPersistFile::SaveCompleted ( LPCOLESTR pszFile )

Definition at line 183 of file IPerFile.Cpp.

    {
    ODS("IPersistFile::SaveCompleted called...unexpected");
    return ResultFromScode(E_NOTIMPL);
    }

CImpIPersistFile::STDMETHODIMP_ ( ULONG )
CImpIPersistFile::STDMETHODIMP_ ( ULONG )

Member Data Documentation

PCFileViewer CImpIPersistFile::m_pObj [private]

Definition at line 209 of file FVText.h.

LPUNKNOWN CImpIPersistFile::m_pUnkOuter [private]

Definition at line 210 of file FVText.h.

The documentation for this class was generated from the following files:
  • WinUI/Shell/FileView/FVText.h
  • WinUI/Shell/FileView/IPerFile.Cpp
Generated on Wed Nov 13 2024 16:56:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CImpIRow Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CImpIRow Class Reference

#include "row.h"

List of all members.

Public Member Functions

DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR (CRow, CImpIRow)
DEFINE_DEFAULT_IUNKNOWN_ADDREF_RELEASE
STDMETHODIMP 		GetColumns (DBORDINAL cColumns, DBCOLUMNACCESS rgColumns[])
STDMETHODIMP | GetSourceRowset (REFIID riid, IUnknown **ppRowset, HROW *phRow)
STDMETHODIMP | Open (IUnknown *pIUnkOuter, DBID *pColumnID, REFGUID rguidColumnType, DWORD dwBindFlags, REFIID riid, IUnknown **ppUnk)

Detailed Description

Definition at line 127 of file row.h.

Member Function Documentation

CImpIRow::DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR | ( | CRow | ,
 |  | CImpIRow |
 | ) |  |
STDMETHODIMP CImpIRow::GetColumns | ( | DBORDINAL | cColumns,
 |  | DBCOLUMNACCESS | rgColumns[]
 | ) |  |

Definition at line 407 of file row.cpp.

{
  HRESULT     hr;
  DBORDINAL   cCols;
  DBORDINAL   cIter;
  DBORDINAL   cErrorCount;
  ROWBUFF *   pRowBuff = NULL;
  COLUMNDATA *  pColumnData = NULL;
  CFileIO *   pFileio = NULL;
  DBCOLUMNINFO *  rgdbcolumninfo = NULL;
  CStream *   pCStream = NULL;

  //
  // Asserts
    //
  assert( m_pObj );

  // cColumns == 0 is a no-op
  if( cColumns == 0 )
    return S_OK;

  if( !rgColumns )
    return E_INVALIDARG;

  // Check to see if we have a DC
  if( !g_pIDataConvert )
    return E_FAIL;

  pFileio = m_pObj->GetFileObj();
  assert( pFileio );

    // Internal error for a 0 reference count on this row,
    // since we depend on the slot-set stuff.
    pRowBuff = m_pObj->GetRowBuff();
    assert( pRowBuff->ulRefCount );

  // Check for the Deleted Row
  if ( pFileio->IsDeleted( (DBBKMARK) pRowBuff->pbBmk ) == S_OK )
        return DB_E_DELETEDROW;

    cErrorCount = 0;
  rgdbcolumninfo = pFileio->GetColInfo();
    for (cIter = 0; cIter < cColumns; cIter++)
  {
    if( IsEqualDBID(&rgColumns[cIter].columnid, &DBROWCOL_DEFAULTSTREAM) )
    {
      if( rgColumns[cIter].wType == DBTYPE_IUNKNOWN )
      {
        pCStream = new CStream(NULL);
        if( pCStream && pCStream->FInit(m_pObj, pRowBuff) )
        {
          //Obtain the requested interface
          pCStream->AddRef();
          if( rgColumns[cIter].pData )
            *((IUnknown **)rgColumns[cIter].pData) = (IUnknown *)pCStream;
          else
            pCStream->Release();

          rgColumns[cIter].dwStatus = DBSTATUS_S_OK;
          rgColumns[cIter].cbDataLen = sizeof(IUnknown *);
        }
        else
        {
          rgColumns[cIter].dwStatus = DBSTATUS_E_CANTCREATE;
          cErrorCount++;

        }
      }
      else
      {
        rgColumns[cIter].dwStatus = DBSTATUS_E_BADACCESSOR;
        cErrorCount++;
      }
      continue;
    }

    if( !m_pObj->GetColumnOrdinal(pFileio, &rgColumns[cIter].columnid, &cCols) )
    {
      rgColumns[cIter].dwStatus = DBSTATUS_E_DOESNOTEXIST;
      cErrorCount++;
      continue;
    }

    pColumnData = pFileio->GetColumnData(cCols, pRowBuff);

        hr = g_pIDataConvert->DataConvert(
                rgdbcolumninfo[cCols].wType,  // src Type
                rgColumns[cIter].wType,     // dst Type
                pColumnData->dwLength,      // src Length
                &rgColumns[cIter].cbDataLen,  // dst Length
                &(pColumnData->bData),      // pSrc
                rgColumns[cIter].pData,     // pDst
                rgColumns[cIter].cbMaxLen,    // cbMaxLen
                pColumnData->dwStatus,      // src Status
                &rgColumns[cIter].dwStatus,   // dst Status
                rgColumns[cIter].bPrecision,  // bPrecision for conversion to DBNUMERIC
        rgColumns[cIter].bScale,    // bScale for conversion to DBNUMERIC
        DBDATACONVERT_DEFAULT);

    if (hr != S_OK)
            cErrorCount++;
  }

  // Return S_OK if all columns retrieved with successful status
    // Return DB_S_ERRORSOCCURED on failure to retrieve one or more column values
    // Return DB_E_ERRORSOCCURED on failure to retrieve all column values

  return cErrorCount ? ( cErrorCount < cColumns ) ?
    ResultFromScode( DB_S_ERRORSOCCURRED ) :
    ResultFromScode( DB_E_ERRORSOCCURRED ) :
    ResultFromScode( S_OK );
}

STDMETHODIMP CImpIRow::GetSourceRowset | ( | REFIID | riid,
 |  | IUnknown ** | ppRowset,
 |  | HROW * | phRow
 | ) |  |

Definition at line 533 of file row.cpp.

{
  HRESULT   hr;
  CRowset * pCRowset = NULL;
  IUnknown *  pSourceRowset = NULL;
  ROWBUFF * pRowBuff = NULL;

  //
  // Asserts
    //
  assert(m_pObj);
  assert(m_pObj->m_pParentObj);

  if( !ppRowset && !phRow )
    return E_INVALIDARG;

  if( ppRowset )
    *ppRowset = NULL;
  if( phRow )
    *phRow = DB_NULL_HROW;

  if( BOT_SESSION == m_pObj->m_pParentObj->GetBaseObjectType() )
    return DB_E_NOSOURCEOBJECT;

  pCRowset = (CRowset *)m_pObj->m_pParentObj;
  if( !pCRowset )
    return E_FAIL;

  hr = pCRowset->m_pUnkOuter->QueryInterface(riid, (LPVOID *)&pSourceRowset);
  if( FAILED(hr) )
    return hr;

  // Check for the Deleted Row
    pRowBuff = pCRowset->GetRowBuff( (DBCOUNTITEM)m_pObj->m_hRow, TRUE );
    assert( pRowBuff && pRowBuff->ulRefCount );

  if ( pCRowset->m_pFileio &&
     pCRowset->m_pFileio->IsDeleted( (DBBKMARK) pRowBuff->pbBmk ) == S_OK )
  {
    pSourceRowset->Release();
        return DB_E_DELETEDROW;
  }

  if( ppRowset )
    *ppRowset = pSourceRowset;
  else
    pSourceRowset->Release();

  if( phRow )
  {
    // return the HROW and add a refcout
    *phRow = m_pObj->m_hRow;

    pRowBuff->ulRefCount++;
    pCRowset->m_ulRowRefCount++;
  }

  return S_OK;
}

STDMETHODIMP CImpIRow::Open | ( | IUnknown * | pIUnkOuter,
 |  | DBID * | pColumnID,
 |  | REFGUID | rguidColumnType,
 |  | DWORD | dwBindFlags,
 |  | REFIID | riid,
 |  | IUnknown ** | ppUnk
 | ) |  |

Definition at line 608 of file row.cpp.

{
  HRESULT   hr = S_OK;
  CStream * pCStream = NULL;
  CFileIO * pFileio = NULL;
  ROWBUFF * pRowBuff = NULL;

  //
  // Asserts
    //
  assert(m_pObj);

  if( ppUnk )
    *ppUnk = NULL;

  if(!pColumnID )
    return E_INVALIDARG;

  if( pUnkOuter && riid != IID_IUnknown )
    return DB_E_NOAGGREGATION;

  pFileio = m_pObj->GetFileObj();
  pRowBuff = m_pObj->GetRowBuff();

  if( pFileio->IsDeleted( (DBBKMARK) pRowBuff->pbBmk ) == S_OK )
        return DB_E_DELETEDROW;

  // The only supported object valued column is the default stream object
  if( rguidColumnType != DBGUID_STREAM &&
    rguidColumnType != GUID_NULL )
    return DB_E_OBJECTMISMATCH;

  if( IsEqualDBID(pColumnID, &DBROWCOL_DEFAULTSTREAM) )
  {
    pCStream = new CStream(pUnkOuter);
    if( pCStream && pCStream->FInit(m_pObj, pRowBuff) )
    {
      //Obtain the requested interface
      hr = pCStream->QueryInterface(riid, (void**)ppUnk);
    }
    else
      hr = E_OUTOFMEMORY;
  }
  else
  {
    //Either this columnid does not exist or
    //this columnid is not an object valued column
    if( !m_pObj->GetColumnOrdinal(pFileio, pColumnID, NULL) )
    {
      hr = DB_E_BADCOLUMNID;
    }
    else
      hr = DB_E_OBJECTMISMATCH;
  }

  if( FAILED(hr) )
    SAFE_DELETE( pCStream );

  return hr;
}

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/sampprov/row.h
  • Dataaccess/oledb/sampprov/row.cpp
Generated on Wed Nov 13 2024 16:56:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CImpIRowChange Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CImpIRowChange Class Reference

#include "row.h"

List of all members.

Public Member Functions

DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR (CRow, CImpIRowChange)
DEFINE_DEFAULT_IUNKNOWN_ADDREF_RELEASE
STDMETHODIMP 		SetColumns (DBORDINAL cColumns, DBCOLUMNACCESS rgColumns[])

Detailed Description

Definition at line 177 of file row.h.

Member Function Documentation

CImpIRowChange::DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR | ( | CRow | ,
 |  | CImpIRowChange |
 | ) |  |
STDMETHODIMP CImpIRowChange::SetColumns | ( | DBORDINAL | cColumns,
 |  | DBCOLUMNACCESS | rgColumns[]
 | ) |  |

Definition at line 749 of file row.cpp.

{
  HRESULT     hr;
  DBORDINAL   cIter = 0;
  DBORDINAL   cErrorCount = 0;
  DBORDINAL   cCols = 0;
  DWORD     dwSrcStatus;
  ROWBUFF *   pRowBuff = NULL;
  COLUMNDATA *  pColumnData = NULL;
  BYTE *      rgbRowDataSave = NULL;
  DBCOLUMNINFO *  rgdbcolumninfo = NULL;
  CFileIO *   pFileio = NULL;

  //
  // Asserts
    //
  assert( m_pObj );
  assert( m_pObj->m_pParentObj );

  // cColumns == 0 is a no-op
  if( cColumns == 0 )
    return S_OK;

  if( !rgColumns )
    return E_INVALIDARG;

  // Check to see if we have a DC
  if( !g_pIDataConvert )
    return E_FAIL;

  pFileio   = m_pObj->GetFileObj();
    pRowBuff  = m_pObj->GetRowBuff();

    // Is row handle deleted?
    if ( pFileio->IsDeleted((DBBKMARK) ((PROWBUFF) pRowBuff)->pbBmk ) == S_OK )
        return DB_E_DELETEDROW;

    rgbRowDataSave = new BYTE[m_pObj->m_cbRowSize];
    if ( rgbRowDataSave == NULL )
        return E_OUTOFMEMORY;

    // Save the row.
    memcpy( rgbRowDataSave, pRowBuff, m_pObj->m_cbRowSize );

  rgdbcolumninfo = pFileio->GetColInfo();
    for (cIter = 0; cIter < cColumns; cIter++)
  {
    // Check the Status for DBSTATUS_S_IGNORE
    dwSrcStatus = rgColumns[cIter].dwStatus;
    if( dwSrcStatus == DBSTATUS_S_IGNORE )
      continue;

    if( IsEqualDBID(&rgColumns[cIter].columnid, &DBROWCOL_DEFAULTSTREAM) )
    {
      // Default stream column is read only
      rgColumns[cIter].dwStatus = DBSTATUS_E_PERMISSIONDENIED;
      cErrorCount++;
      continue;
    }
    else
    {
      if( !m_pObj->GetColumnOrdinal(pFileio, &rgColumns[cIter].columnid, &cCols) )
      {
        rgColumns[cIter].dwStatus = DBSTATUS_E_DOESNOTEXIST;
        cErrorCount++;
        continue;
      }
    }

    pColumnData = pFileio->GetColumnData(cCols, pRowBuff);

        // Check the Status for DBSTATUS_S_DEFAULT
    if( dwSrcStatus == DBSTATUS_S_DEFAULT )
      dwSrcStatus = DBSTATUS_S_ISNULL;

        // Check the Status of the value being sent in
    if( (dwSrcStatus != DBSTATUS_S_OK && dwSrcStatus != DBSTATUS_S_ISNULL &&
       dwSrcStatus != DBSTATUS_S_IGNORE && dwSrcStatus != DBSTATUS_S_DEFAULT) )
    {
      rgColumns[cIter].dwStatus = DBSTATUS_E_BADSTATUS;
      cErrorCount++;
      continue;
    }

    hr = g_pIDataConvert->DataConvert(
        rgColumns[cIter].wType,         // src Type
                rgdbcolumninfo[cCols].wType,      // dst Type
                rgColumns[cIter].cbDataLen,       // src Length
                (DBLENGTH *)&(pColumnData->dwLength),   // dst Length
                rgColumns[cIter].pData,         // pSrc
                &(pColumnData->bData),          // pDst
                rgColumns[cIter].cbMaxLen,        // cbMaxLen
                dwSrcStatus,              // src Status
                &(pColumnData->dwStatus),       // dst Status
                rgColumns[cIter].bPrecision,      // bPrecision for conversion to DBNUMERIC
        rgColumns[cIter].bScale,        // bScale for conversion to DBNUMERIC
        DBDATACONVERT_SETDATABEHAVIOR);

    // fatal error
    if( FAILED(hr) )
    {
      cErrorCount++;
      rgColumns[cIter].dwStatus = pColumnData->dwStatus;
      continue;
    }
  }

    // Carry out the update.
    if( FAILED( pFileio->UpdateRow((DBBKMARK) ((PROWBUFF) pRowBuff)->pbBmk, (BYTE *)pRowBuff, UPDATE )) )
  {
        // Restore the row to its previous state
        memcpy( pRowBuff, rgbRowDataSave, m_pObj->m_cbRowSize );
        return ResultFromScode( E_FAIL );
  }

    delete [] rgbRowDataSave;

  // Return S_OK if all columns were updated
    // Return DB_S_ERRORSOCCURED one or more columns failed to be updated
    // Return DB_E_ERRORSOCCURED on failure to set all columns

  return cErrorCount ? ( cErrorCount < cColumns ) ?
      ResultFromScode( DB_S_ERRORSOCCURRED ) :
      ResultFromScode( DB_E_ERRORSOCCURRED ) :
      ResultFromScode( S_OK );
}

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/sampprov/row.h
  • Dataaccess/oledb/sampprov/row.cpp
Generated on Wed Nov 13 2024 16:56:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CImpIRowset Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CImpIRowset Class Reference

#include "rowset.h"

List of all members.

Public Member Functions

STDMETHODIMP | AddRefRows (DBCOUNTITEM, const HROW rghRows[], DBREFCOUNT rgRefCounts[], DBROWSTATUS rgRowStatus[])
DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR (CRowset, CImpIRowset)
DEFINE_DEFAULT_IUNKNOWN_ADDREF_RELEASE
STDMETHODIMP 		GetData (HROW, HACCESSOR, void *)
STDMETHODIMP | GetNextRows (HCHAPTER, DBROWOFFSET, DBROWCOUNT, DBCOUNTITEM *, HROW **)
STDMETHODIMP | ReleaseRows (DBCOUNTITEM, const HROW rghRows[], DBROWOPTIONS rgRowOptions[], DBREFCOUNT rgRefCounts[], DBROWSTATUS rgRowStatus[])
STDMETHODIMP | RestartPosition (HCHAPTER)

Detailed Description

Definition at line 175 of file rowset.h.

Member Function Documentation

STDMETHODIMP CImpIRowset::AddRefRows | ( | DBCOUNTITEM | cRows,
 |  | const HROW | rghRows[],
 |  | DBREFCOUNT | rgRefCounts[],
 |  | DBROWSTATUS | rgRowStatus[]
 | ) |  |

Definition at line 500 of file irowset.cpp.

{
    HRESULT hr        = S_OK;
    DBCOUNTITEM chRow   = 0L;
    DBCOUNTITEM cErrors   = 0L;
    ROWBUFF     *pRowBuff = NULL;

    // check params
    if ( cRows && !rghRows )
        return ResultFromScode( E_INVALIDARG );

    // for each of the HROWs the caller provided...
    for (chRow = 0; chRow < cRows; chRow++)
  {
        // check the row handle
    if( ((m_pObj->m_prowbitsIBuffer)->IsSlotSet((ULONG) rghRows[chRow]) == S_OK) &&
      (pRowBuff=m_pObj->GetRowBuff((DBCOUNTITEM) rghRows[chRow], TRUE )) &&
      (m_pObj->m_pFileio->IsDeleted((DBBKMARK) pRowBuff->pbBmk) != S_OK) )
    {
      // bump refcount
      pRowBuff = m_pObj->GetRowBuff((DBCOUNTITEM) rghRows[chRow], TRUE );
      assert( pRowBuff->ulRefCount != 0 );
      assert( m_pObj->m_ulRowRefCount != 0 );
      ++pRowBuff->ulRefCount;
      ++m_pObj->m_ulRowRefCount;

      // stuff new refcount into caller's array
      if ( rgRefCounts )
        rgRefCounts[chRow] = pRowBuff->ulRefCount;

      if ( rgRowStatus )
        rgRowStatus[chRow] = DBROWSTATUS_S_OK;
    }
    else
    {
      if ( rgRefCounts )
        rgRefCounts[chRow] = 0;

      if ( rgRowStatus )
      {
        if ( pRowBuff && m_pObj->m_pFileio->IsDeleted((DBBKMARK) pRowBuff->pbBmk) == S_OK )
          rgRowStatus[chRow] = DBROWSTATUS_E_DELETED;
        else
          rgRowStatus[chRow] = DBROWSTATUS_E_INVALID;
      }

            ++ cErrors;
    }
  }

  // If everything went OK except errors in rows use DB_S_ERRORSOCCURRED.
  return cErrors ? ( cErrors < cRows ) ?
      ResultFromScode( DB_S_ERRORSOCCURRED ) :
      ResultFromScode( DB_E_ERRORSOCCURRED ) :
      ResultFromScode( S_OK );
}

CImpIRowset::DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR | ( | CRowset | ,
 |  | CImpIRowset |
 | ) |  |
STDMETHODIMP CImpIRowset::GetData | ( | HROW | hRow,
 |  | HACCESSOR | hAccessor,
 |  | void * | pData
 | ) |  |

Definition at line 32 of file irowset.cpp.

{
    PACCESSOR   pAccessor;
    DBORDINAL   cCols;
  DBORDINAL   cBind;
    ROWBUFF     *pRowBuff;
    COLUMNDATA    *pColumnData;
    DBBINDING   *pBinding;
    DBCOUNTITEM   cBindings;
    DBORDINAL   cErrorCount;
    DBTYPE      dwSrcType;
    DBTYPE      dwDstType;
    void      *pSrc;
    void      *pDst;
    DBBYTEOFFSET  ulSrcLength;
    DBLENGTH*   pulDstLength;
    DBLENGTH    cbDstMaxLength;
    ULONG     dwSrcStatus;
    ULONG     *pdwDstStatus;
    DWORD     dwPart;
    HRESULT     hr;

  DBCOLUMNINFO *  rgdbcolumninfo = NULL;

    // Coerce data for row 'hRow', according to hAccessor.
    // Put in location 'pData'.  Offsets and types are in hAccessor's bindings.
    //
  // Return S_OK if all columns retrieved with successful status
    // Return DB_S_ERRORSOCCURED on failure to retrieve one or more column values
    // Return DB_E_ERRORSOCCURED on failure to retrieve all column values

    // GetItemOfExtBuffer is basically operator[].
    // It takes an index (or handle) (referenced from 1...n),
    // and a ptr for where to write the data.
    //
    // It holds ptrs to a variable-length ACCESSOR struct.
    // So we get the ACCESSOR ptr for the client's accessor handle.

    assert( m_pObj->m_pextbufferAccessor );
    m_pObj->m_pextbufferAccessor->GetItemOfExtBuffer(hAccessor, &pAccessor);
    if( !pAccessor )
        return DB_E_BADACCESSORHANDLE;

    assert( pAccessor );
    cBindings = pAccessor->cBindings;
    pBinding  = pAccessor->rgBindings;

    // IsSlotSet returns S_OK    if row is marked.
    //                   S_FALSE if row is not marked.
    // The "mark" means that there is data present in the row.
    // Rows are [1...n], slot marks are [0...n-1].
    if (m_pObj->m_prowbitsIBuffer->IsSlotSet( (ULONG) hRow ) != S_OK)
        return ResultFromScode( DB_E_BADROWHANDLE );

  // Ensure a place to put data, unless the accessor is the null accessor then
    // a NULL pData is okay.
    if ( pData == NULL && cBindings != 0 )
        return ResultFromScode( E_INVALIDARG );

  // Check to see if we have a DC
  if( !g_pIDataConvert)
    return (E_FAIL);

    // Internal error for a 0 reference count on this row,
    // since we depend on the slot-set stuff.
    pRowBuff = m_pObj->GetRowBuff( (DBCOUNTITEM) hRow, TRUE );
    assert( pRowBuff->ulRefCount );

  // Check for the Deleted Row
  if ( m_pObj->m_pFileio->IsDeleted( (DBBKMARK) pRowBuff->pbBmk ) == S_OK )
        return ResultFromScode( DB_E_DELETEDROW );

    cErrorCount = 0;
  rgdbcolumninfo = m_pObj->m_pFileio->GetColInfo();
    for (cBind=0; cBind < cBindings; cBind++)
  {
    cCols = pBinding[cBind].iOrdinal;

        // make sure column number is in range
        if ( !(0 < cCols && cCols <= m_pObj->m_cCols) )
            return ResultFromScode( DB_E_BADORDINAL );

        pColumnData    = m_pObj->m_pFileio->GetColumnData(cCols, pRowBuff);

        dwSrcType      = rgdbcolumninfo[cCols].wType;
        pSrc           = &(pColumnData->bData);
        ulSrcLength    = pColumnData->dwLength;
        dwSrcStatus    = pColumnData->dwStatus;
        cbDstMaxLength = pBinding[cBind].cbMaxLen;
        dwDstType      = pBinding[cBind].wType;
        dwPart         = pBinding[cBind].dwPart;

        pDst           = dwPart & DBPART_VALUE ? ((BYTE *) pData + pBinding[cBind].obValue) : NULL;
        pulDstLength   = dwPart & DBPART_LENGTH ? (DBLENGTH *) ((BYTE*) pData + pBinding[cBind].obLength) : NULL;
        pdwDstStatus   = dwPart & DBPART_STATUS ? (ULONG *) ((BYTE*) pData + pBinding[cBind].obStatus) : NULL;

        hr = g_pIDataConvert->DataConvert(
                dwSrcType,
                dwDstType,
                ulSrcLength,
                pulDstLength,
                pSrc,
                pDst,
                cbDstMaxLength,
                dwSrcStatus,
                pdwDstStatus,
                pBinding[cBind].bPrecision, // bPrecision for conversion to DBNUMERIC
        pBinding[cBind].bScale,   // bScale for conversion to DBNUMERIC
        DBDATACONVERT_DEFAULT);

    // rounding or truncation or can't coerce
    if (hr != S_OK)
            cErrorCount++;
  }

    // We report any lossy conversions with a special status.
    // Note that DB_S_ERRORSOCCURED is a success, rather than failure.
  return cErrorCount ? ( cErrorCount < cBindings ) ?
    ( DB_S_ERRORSOCCURRED ) : ( DB_E_ERRORSOCCURRED ) : ( S_OK );
}

STDMETHODIMP CImpIRowset::GetNextRows | ( | HCHAPTER | hChapter,
 |  | DBROWOFFSET | lRowOffset,
 |  | DBROWCOUNT | cRows,
 |  | DBCOUNTITEM * | pcRowsObtained,
 |  | HROW ** | prghRows
 | ) |  |

Definition at line 174 of file irowset.cpp.

{
    ULONG   cRowsTmp;
    ULONG   cSlotAlloc =0;
    DBROWCOUNT  irow, ih;
    ULONG   cRowFirst, cRowLast;
    PROWBUFF  prowbuff;
    HRESULT   hr;
  BOOL    fCanHoldRows = FALSE;
  DBPROPIDSET rgPropertyIDSets[1];
  ULONG   cPropertySets;
  DBPROPSET*  prgPropertySets;
  DBPROPID  rgPropId[1];

    // init out-params
  if ( pcRowsObtained )
    *pcRowsObtained = 0;

    // Check validity of arguments.
    if ( pcRowsObtained == NULL || prghRows == NULL )
        return ResultFromScode( E_INVALIDARG );

    // No-op case always succeeds.
    if ( cRows == 0 )
        return ResultFromScode( S_OK );

    // This implementation doesn't support scrolling backward.
    if ( cRows < 0 )
        return ResultFromScode( DB_E_CANTFETCHBACKWARDS );

    // This implementation doesn't support scrolling backward.
    if ( lRowOffset < 0 )
        return ResultFromScode( DB_E_CANTSCROLLBACKWARDS );

    // Get the value of the DBPROP_CANHOLDROWS property
  rgPropertyIDSets[0].guidPropertySet = DBPROPSET_ROWSET;
  rgPropertyIDSets[0].rgPropertyIDs = rgPropId;
  rgPropertyIDSets[0].cPropertyIDs  = 1;
  rgPropId[0]             = DBPROP_CANHOLDROWS;

    m_pObj->m_pUtilProp->GetProperties(
                  PROPSET_ROWSET,
                  1,
                  rgPropertyIDSets,
                  &cPropertySets,
                  &prgPropertySets );

  // Get the Prompt value
  if( V_BOOL(&prgPropertySets->rgProperties->vValue) == VARIANT_TRUE )
    fCanHoldRows = TRUE;

  // Free the memory
  SAFE_FREE(prgPropertySets[0].rgProperties);
  SAFE_FREE(prgPropertySets);

    // Are there any unreleased rows?
    if( ((m_pObj->m_prowbitsIBuffer)->ArrayEmpty() != S_OK) && (!fCanHoldRows) )
        return ResultFromScode( DB_E_ROWSNOTRELEASED );

    // Is the cursor fully materialized (end-of-cursor condition)?
    if (m_pObj->m_dwStatus & STAT_ENDOFCURSOR)
        return ResultFromScode( DB_S_ENDOFROWSET );

    assert( m_pObj->m_rgbRowData );
    if (FAILED( m_pObj->Rebind((BYTE *) m_pObj->GetRowBuff( m_pObj->m_irowMin, TRUE ))))
        return ResultFromScode( E_FAIL );

    //
    // Fetch Data
    //
    if (lRowOffset)
        {
        // Calculate the new position
        m_pObj->m_irowFilePos += lRowOffset;

        // Check if skip causes END_OF_ROWSET
        if (m_pObj->m_irowFilePos > m_pObj->m_pFileio->GetRowCnt() ||
            m_pObj->m_irowFilePos <= 0)
            {
            m_pObj->m_dwStatus |= STAT_ENDOFCURSOR;
            return ResultFromScode( DB_S_ENDOFROWSET );
            }
        }

  if (FAILED( hr = GetNextSlots( m_pObj->m_pIBuffer, (ULONG)cRows, &cRowFirst )))
        return hr;

    cSlotAlloc = (ULONG)cRows;

    for (irow =1; irow <= cRows; irow++)
        {
    // Setup the row
    prowbuff = m_pObj->GetRowBuff( cRowFirst + irow - 1, TRUE );
    memset(prowbuff->cdData, 0, m_pObj->m_cbRowSize);
    if (FAILED( m_pObj->Rebind((BYTE *) prowbuff)))
      return ResultFromScode( E_FAIL );

    // Get the Data from the File into the row buffer
        if (S_FALSE == ( hr = m_pObj->m_pFileio->Fetch( m_pObj->m_irowFilePos + irow )))
            {
            m_pObj->m_dwStatus |= STAT_ENDOFCURSOR;
            break;
            }
        else
            {
            if (FAILED( hr ))
                return ResultFromScode( E_FAIL );
            }
        }

    cRowsTmp = (ULONG)(irow - 1); //Irow will be +1 because of For Loop
    m_pObj->m_irowLastFilePos = m_pObj->m_irowFilePos;
    m_pObj->m_irowFilePos += cRowsTmp;

    //
    // Through fetching many rows of data
    //
    // Allocate row handles for client.
    // Note that we need to use IMalloc for this.
    //
    // Should only malloc cRowsTmp, instead of cRows.
    //
    // Modified to use IMalloc.
    // Should malloc cRows, since client will assume it's that big.
    //

    *pcRowsObtained = cRowsTmp;

  if ( *prghRows == NULL && cRowsTmp )
        *prghRows = (HROW *) PROVIDER_ALLOC( cRows*sizeof( HROW ));

    if ( *prghRows == NULL  && cRowsTmp )
        return ResultFromScode( E_OUTOFMEMORY );

    //
    // Fill in the status information: Length, IsNull
    // May be able to wait until first call to GetData,
    // but have to do it sometime.
    //
    // Suggest keeping an array of structs of accessor info.
    // One element is whether accessor requires any status info or length info.
    // Then we could skip this whole section.
    //
    // Added check for cRowsTmp to MarkRows call.
    // Don't want to call if cRowsTmp==0.
    // (Range passed to MarkRows is inclusive, so can't specify marking 0 rows.)
    //
    // Note that SetSlots is a CBitArray member function -- not an IBuffer function.
    //
    // Bits are [0...n-1], row handles are [1...n].
    //
    // Cleanup. Row handles, bits, indices are the same [m....(m+n)], where m is some # >0,
    //
    // Added row-wise reference counts and cursor-wise reference counts.
    //

    // Set row handles, fix data length field and compute data status field.//
    m_pObj->m_cRows   = cRowsTmp;
    cRowLast = cRowFirst + cRowsTmp - 1;

    // Cleanup extra slots where no hRow actually was put..
    //  ** Because of less rows than asked for
    //  ** Because of temporary for for data transfer.
    if (cSlotAlloc > (cRowsTmp))
        if (FAILED( hr = ReleaseSlots( m_pObj->m_pIBuffer, cRowFirst + cRowsTmp, (cSlotAlloc - cRowsTmp))))
            return hr;

    for (irow = (LONG) (cRowFirst), ih =0; irow <= (LONG) cRowLast; irow++, ih++)
        {
        // Increment the rows-read count,
        // then store it as the bookmark in the very first DWORD of the row.
        prowbuff = m_pObj->GetRowBuff( irow, TRUE );

        // Insert the bookmark and its row number (from 1...n) into a hash table.
        // This allows us to quickly determine the presence of a row in mem, given the bookmark.
        // The bookmark is contained in the row buffer, at the very beginning.
        // Bookmark is the row number within the entire result set [1...num_rows_read].

        // This was a new Bookmark, not in memory,
        // so return to user (in *prghRows) the hRow we stored.
        prowbuff->ulRefCount++;
        prowbuff->pbBmk = (BYTE*) m_pObj->m_irowLastFilePos + ih + 1;
        m_pObj->m_ulRowRefCount++;

        (*prghRows)[ih] = (HROW) ( irow );
        }

    if (m_pObj->m_dwStatus & STAT_ENDOFCURSOR)
        return ResultFromScode( DB_S_ENDOFROWSET );
    else
        return ResultFromScode( S_OK );
}

STDMETHODIMP CImpIRowset::ReleaseRows | ( | DBCOUNTITEM | cRows,
 |  | const HROW | rghRows[],
 |  | DBROWOPTIONS | rgRowOptions[],
 |  | DBREFCOUNT | rgRefCounts[],
 |  | DBROWSTATUS | rgRowStatus[]
 | ) |  |

Definition at line 388 of file irowset.cpp.

{
    HRESULT hr        = S_OK;
    DBCOUNTITEM chRow   = 0L;
    DBCOUNTITEM cErrors   = 0L;
    ROWBUFF     *pRowBuff = NULL;

    // check params
    if ( cRows && !rghRows )
        return ResultFromScode( E_INVALIDARG );

    while ( chRow < cRows )
  {
        // check the row handle
    hr = (m_pObj->m_prowbitsIBuffer)->IsSlotSet((ULONG) rghRows[chRow]);
        if ( (hr == S_OK) && (m_pObj->m_ulRowRefCount) &&
       (pRowBuff=m_pObj->GetRowBuff((DBCOUNTITEM) rghRows[chRow], TRUE)) &&
       (pRowBuff->ulRefCount) )
    {
            // Found valid row, so decrement reference counts.
            // (Internal error for refcount to be 0 here, since slot set.)
            --pRowBuff->ulRefCount;
            --m_pObj->m_ulRowRefCount;

      // stuff new refcount into caller's array
      if ( rgRefCounts )
        rgRefCounts[chRow] = pRowBuff->ulRefCount;

      if ( rgRowStatus )
        rgRowStatus[chRow] = DBROWSTATUS_S_OK;

            if ( pRowBuff->ulRefCount == 0 )
                ReleaseSlots( m_pObj->m_pIBuffer, (ULONG) rghRows[chRow], 1 );
    }
        else
    {
            // It is an error for client to try to release a row
            // for which "IsSetSlot" is false.  Client gave us an invalid handle.
            // Ignore it (we can't release it...) and report error when done.
      if ( rgRefCounts )
        rgRefCounts[chRow] = 0;

      if ( rgRowStatus )
        rgRowStatus[chRow] = DBROWSTATUS_E_INVALID;

            ++ cErrors;
    }

    chRow++;
  }

  // If everything went OK except errors in rows use DB_S_ERRORSOCCURRED.
  return cErrors ? ( cErrors < cRows ) ?
      ResultFromScode( DB_S_ERRORSOCCURRED ) :
      ResultFromScode( DB_E_ERRORSOCCURRED ) :
      ResultFromScode( S_OK );
}

STDMETHODIMP CImpIRowset::RestartPosition ( HCHAPTER hChapter )

Definition at line 470 of file irowset.cpp.

{
  // make sure all rows have been released
  // Fail even if CANHOLDROWS is true
    if( ((m_pObj->m_prowbitsIBuffer)->ArrayEmpty() != S_OK) )
        return ResultFromScode( DB_E_ROWSNOTRELEASED );

    // set "next fetch" position to the start of the rowset
  m_pObj->m_irowFilePos = 0;

    // clear "end of cursor" flag
    m_pObj->m_dwStatus &= ~STAT_ENDOFCURSOR;

    return ResultFromScode( S_OK );
}

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/sampprov/rowset.h
  • Dataaccess/oledb/sampprov/irowset.cpp
Generated on Wed Nov 13 2024 16:56:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CImpIRowsetChange Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CImpIRowsetChange Class Reference

#include "rowset.h"

Inherits IRowsetChange.

List of all members.

Public Member Functions

DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR (CRowset, CImpIRowsetChange)
STDMETHODIMP | DeleteRows (HCHAPTER, DBCOUNTITEM, const HROW rghRows[], DBROWSTATUS rgRowStatus[])
STDMETHODIMP | InsertRow (HCHAPTER hChapter, HACCESSOR hAccessor, void *pData, HROW *phRow)
DEFINE_DEFAULT_IUNKNOWN_ADDREF_RELEASE
STDMETHODIMP 		SetData (HROW, HACCESSOR, void *)

Detailed Description

Definition at line 201 of file rowset.h.

Member Function Documentation

CImpIRowsetChange::DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR | ( | CRowset | ,
 |  | CImpIRowsetChange |
 | ) |  |
STDMETHODIMP CImpIRowsetChange::DeleteRows | ( | HCHAPTER | hChapter,
 |  | DBCOUNTITEM | cRows,
 |  | const HROW | rghRows[],
 |  | DBROWSTATUS | rgRowStatus[]
 | ) |  |

Definition at line 222 of file rowchng.cpp.

{
    DBCOUNTITEM chRow       = 0L;
    DBCOUNTITEM cErrors     = 0L;
    BYTE*   pbProvRow = NULL;

    // If No Row handle, just return.
    if( cRows == 0 )
        return( S_OK );

    // Check for Invalid Arguments
    if ( !rghRows )
        return( E_INVALIDARG );

    // Process row handles
    while (chRow < cRows)
    {
    if( rgRowStatus )
      rgRowStatus[chRow] = DBROWSTATUS_S_OK;

        // Is row handle valid
        if( (m_pObj->m_prowbitsIBuffer)->IsSlotSet( (ULONG)rghRows[chRow]) != S_OK )
        {
            // Log Error
      if( rgRowStatus )
        rgRowStatus[chRow]= DBROWSTATUS_E_INVALID;

            cErrors++;
            chRow++;
            continue;
    }

        // Get RowBuffer to look at which row this applies to
        pbProvRow = (BYTE *) (m_pObj->GetRowBuff((DBCOUNTITEM) rghRows[chRow], TRUE ));

        // Has row already been deleted
        // S_OK means deleted
        if( m_pObj->m_pFileio->IsDeleted((DBBKMARK) ((PROWBUFF) pbProvRow)->pbBmk ) == S_OK )
        {
      if( rgRowStatus )
        rgRowStatus[chRow] = DBROWSTATUS_E_DELETED;
            cErrors++;
            chRow++;
            continue;
        }

        // Delete the Row,
        if( m_pObj->m_pFileio->DeleteRow((DBBKMARK) ((PROWBUFF) pbProvRow)->pbBmk) != S_OK )
        {
      // Some better decision as to what rowstatus to set could be done here..
      if( rgRowStatus )
        rgRowStatus[chRow] = DBROWSTATUS_E_FAIL;
            cErrors++;
            chRow++;
            continue;
        }

    // Delete worked correctly
    chRow++;

  } //while

  // If everything went OK except errors in rows use DB_S_ERRORSOCCURRED.
  return cErrors ? ( cErrors < cRows ) ?
    ( DB_S_ERRORSOCCURRED ) : ( DB_E_ERRORSOCCURRED ) : ( S_OK );
}

STDMETHODIMP CImpIRowsetChange::InsertRow | ( | HCHAPTER | hChapter,
 |  | HACCESSOR | hAccessor,
 |  | void * | pData,
 |  | HROW * | phRow
 | ) |  |

Definition at line 306 of file rowchng.cpp.

{
    DBORDINAL       cCols;
  DBCOUNTITEM   cBind;
    BYTE*           pbProvRow;
    HRESULT         hr;
    ULONG     irow;
    DBCOUNTITEM     cBindings;
    DBBINDING*      pBinding;
    DBCOUNTITEM     cErrorCount;
    DBTYPE          dwSrcType;
    DBTYPE          dwDstType;
    void*           pSrc;
    void*           pDst;
    ULONG           dwSrcLength;
    DBLENGTH*   pdwDstLength;
    DBLENGTH        cbDstMaxLength;
    DWORD           dwSrcStatus;
    DWORD*          pdwDstStatus;
    DWORD           dwPart;
    PCOLUMNDATA     pColumnData;
    PACCESSOR       paccessor = NULL;
    BYTE*           rgbRowDataSave = NULL;
  BOOL      fCanHoldRows = FALSE;
  DBPROPIDSET   rgPropertyIDSets[1];
  ULONG     cPropertySets;
  DBPROPSET*    prgPropertySets;
  DBPROPID    rgPropId[1];
  DBCOLUMNINFO *  rgdbcolumninfo = NULL;

  // Initialize values
  if( phRow )
    *phRow = NULL;

    // Check the Accessor Handle
  assert( m_pObj->m_pextbufferAccessor );
  if( FAILED( m_pObj->m_pextbufferAccessor->GetItemOfExtBuffer(hAccessor, &paccessor)) )
        return( DB_E_BADACCESSORHANDLE );

    // Ensure a source of data.
    assert( paccessor );
    if( paccessor->cBindings && !pData )
        return( E_INVALIDARG );

    // Get the value of the DBPROP_CANHOLDROWS property
  rgPropertyIDSets[0].guidPropertySet = DBPROPSET_ROWSET;
  rgPropertyIDSets[0].rgPropertyIDs = rgPropId;
  rgPropertyIDSets[0].cPropertyIDs  = 1;
  rgPropId[0]             = DBPROP_CANHOLDROWS;

    assert( m_pObj->m_pUtilProp );
  m_pObj->m_pUtilProp->GetProperties(
                  PROPSET_ROWSET,
                  1,
                  rgPropertyIDSets,
                  &cPropertySets,
                  &prgPropertySets );

  // Get the Prompt value
  if( V_BOOL(&prgPropertySets->rgProperties->vValue) == VARIANT_TRUE )
    fCanHoldRows = TRUE;

  // Free the memory
  SAFE_FREE(prgPropertySets[0].rgProperties);
  SAFE_FREE(prgPropertySets);

    // Are there any unreleased rows?
    if( ((m_pObj->m_prowbitsIBuffer)->ArrayEmpty() != S_OK) && (!fCanHoldRows) )
        return( DB_E_ROWSNOTRELEASED );

    if( FAILED( hr = GetNextSlots( m_pObj->m_pIBuffer, 1, &irow )) )
        return hr;

    if( FAILED( m_pObj->Rebind((BYTE *) m_pObj->GetRowBuff( irow, TRUE ))) )
        return( E_FAIL );

    // Get the rowbuffer and set the new bookmark
  pbProvRow = (BYTE *) (m_pObj->GetRowBuff( irow, TRUE ));
    ((PROWBUFF) pbProvRow)->ulRefCount++;
    ((PROWBUFF) pbProvRow)->pbBmk = (BYTE*) m_pObj->m_pFileio->GetRowCnt()+1;
    m_pObj->m_ulRowRefCount++;

    cBindings = paccessor->cBindings;
    pBinding  = paccessor->rgBindings;

  // NULL Accessor (set Status to NULL)
  if( !cBindings )
  {
    for (cCols = 1; cCols <= m_pObj->m_cCols; cCols++)
    {
      pColumnData = m_pObj->m_pFileio->GetColumnData(cCols, (ROWBUFF *) pbProvRow);
      pColumnData->dwStatus = DBSTATUS_S_ISNULL;
    }
  }

    // Apply accessor to data.
  rgdbcolumninfo = m_pObj->m_pFileio->GetColInfo();
    for (cBind = 0, cErrorCount = 0; cBind < cBindings; cBind++)
  {
        cCols = pBinding[cBind].iOrdinal;

        // make sure column number is in range
        if( cCols < 1 || cCols > m_pObj->m_cCols )
            return( DB_E_BADORDINAL );

    pColumnData = m_pObj->m_pFileio->GetColumnData(cCols, (ROWBUFF *)pbProvRow);

        dwSrcType      = pBinding[cBind].wType;
        pDst           = &(pColumnData->bData);
        pdwDstLength   = (DBBYTEOFFSET *) &(pColumnData->dwLength);
        pdwDstStatus   = &(pColumnData->dwStatus);
        cbDstMaxLength = pBinding[cBind].cbMaxLen;

        dwPart         = pBinding[cBind].dwPart;
        dwDstType      = rgdbcolumninfo[cCols].wType;

        // Get the Length
    if( dwPart & DBPART_LENGTH )
      dwSrcLength = *(ULONG *)((BYTE*)pData + pBinding[cBind].obLength);
    else
      dwSrcLength = 0;

        // Get the Status
        if( dwPart & DBPART_STATUS )
      dwSrcStatus = *(ULONG *)((BYTE*)pData + pBinding[cBind].obStatus);
    else
      dwSrcStatus = DBSTATUS_S_OK;

        // Check the Status for DBSTATUS_S_DEFAULT
    if( dwSrcStatus == DBSTATUS_S_DEFAULT )
      dwSrcStatus = DBSTATUS_S_ISNULL;

        // Check the Status for DBSTATUS_S_IGNORE
    if( dwSrcStatus == DBSTATUS_S_IGNORE ||
      dwSrcStatus == DBSTATUS_S_ISNULL )
      continue;

        // Check the Status of the value being sent in
    if( dwSrcStatus != DBSTATUS_S_OK )
    {
      *(ULONG *)((BYTE*)pData + pBinding[cBind].obStatus) = DBSTATUS_E_BADSTATUS;
      cErrorCount++;
      continue;
    }

        // Get the Value
    if( (dwPart & DBPART_VALUE) == 0 )
    {
            if( dwPart & DBPART_STATUS )
        *(ULONG *)((BYTE*)pData + pBinding[cBind].obStatus) = DBSTATUS_E_UNAVAILABLE;

      cErrorCount++;
      continue;
    }
        else
    {
            pSrc = (void *) ((BYTE*) pData + pBinding[cBind].obValue);
    }

    // Check to see if we have a DC
    if( !g_pIDataConvert )
      return( E_FAIL );

        hr = g_pIDataConvert->DataConvert(
        dwSrcType,
                dwDstType,
                dwSrcLength,
                pdwDstLength,
                pSrc,
                pDst,
                cbDstMaxLength,
                dwSrcStatus,
                pdwDstStatus,
                pBinding[cBind].bPrecision, // bPrecision for conversion to DBNUMERIC
        pBinding[cBind].bScale,   // bScale for conversion to DBNUMERIC
        (DBDATACONVERT_SETDATABEHAVIOR |
         (!dwSrcLength ? DBDATACONVERT_LENGTHFROMNTS : 0)));

    // fatal error
    if( FAILED( hr ) )
            return hr;

    // rounding or truncation or can't coerce
    if( hr != S_OK )
            cErrorCount++;
  }

  // If all bindings are bad and not a NULL Accessor
  if( !cBindings || cErrorCount < cBindings )
  {
    // Carry out the insert.
    if( FAILED(m_pObj->m_pFileio->UpdateRow((DBBKMARK) ((PROWBUFF) pbProvRow)->pbBmk, pbProvRow, INSERT )) )
      return( E_FAIL );

    // Set the RowHandle
    if( phRow )
      *phRow = irow;
  }

  // If everything went OK except errors in rows use DB_S_ERRORSOCCURRED.
  return cErrorCount ? ( cErrorCount < cBindings ) ?
    ( DB_S_ERRORSOCCURRED ) : ( DB_E_ERRORSOCCURRED ) : ( S_OK );
}

STDMETHODIMP CImpIRowsetChange::SetData | ( | HROW | hRow,
 |  | HACCESSOR | hAccessor,
 |  | void * | pData
 | ) |  |

Definition at line 37 of file rowchng.cpp.

{
    DBORDINAL       cCols;
  DBCOUNTITEM   cBind;
    BYTE*           pbProvRow;
    HRESULT         hr;
    DBCOUNTITEM     cBindings;
    DBBINDING*      pBinding;
    DBCOUNTITEM     cErrorCount;
    DBTYPE          dwSrcType;
    DBTYPE          dwDstType;
    DWORD           dwPart;
    ULONG           dwSrcLength;
    DWORD           dwSrcStatus;
    void*           pSrc;
    void*           pDst;
    DBLENGTH*   pdwDstLength;
    DBLENGTH        cbDstMaxLength;
    DWORD*          pdwDstStatus;
    PCOLUMNDATA     pColumnData;
    PACCESSOR       paccessor = NULL;
    BYTE*           rgbRowDataSave = NULL;
  DBCOLUMNINFO *  rgdbcolumninfo = NULL;

    // Is row handle right?
    assert( m_pObj->m_prowbitsIBuffer );
    if( (m_pObj->m_prowbitsIBuffer)->IsSlotSet( (ULONG)hRow ) != S_OK )
        return( DB_E_BADROWHANDLE );

    // Check the Accessor Handle
    assert( m_pObj->m_pextbufferAccessor );
  if( FAILED(m_pObj->m_pextbufferAccessor->GetItemOfExtBuffer(hAccessor, &paccessor)))
        return( DB_E_BADACCESSORHANDLE );

    // Ensure a source of data.
    assert( paccessor );
    if( paccessor->cBindings && !pData )
        return( E_INVALIDARG );

    pbProvRow = (BYTE *)(m_pObj->GetRowBuff((DBCOUNTITEM) hRow, TRUE ));

    // Is row handle deleted?
    if( m_pObj->m_pFileio->IsDeleted((DBBKMARK) ((PROWBUFF) pbProvRow)->pbBmk ) == S_OK )
        return( DB_E_DELETEDROW );

    rgbRowDataSave = (BYTE *) malloc( m_pObj->m_cbTotalRowSize );
    if( !rgbRowDataSave )
        return( E_OUTOFMEMORY );

    // Save the row.
    memcpy( rgbRowDataSave, pbProvRow, m_pObj->m_cbTotalRowSize );

    cBindings = paccessor->cBindings;
    pBinding  = paccessor->rgBindings;

    // Apply accessor to data.
  rgdbcolumninfo = m_pObj->m_pFileio->GetColInfo();
    for (cBind = 0, cErrorCount = 0; cBind < cBindings; cBind++)
  {
        cCols = pBinding[cBind].iOrdinal;

        // make sure column number is in range
        if( cCols < 1 || cCols > m_pObj->m_cCols )
            return( DB_E_BADORDINAL );

    pColumnData    = m_pObj->m_pFileio->GetColumnData(cCols, (ROWBUFF *)pbProvRow);

        dwSrcType      = pBinding[cBind].wType;
        pDst           = &(pColumnData->bData);
        pdwDstLength   = (DBBYTEOFFSET *) &(pColumnData->dwLength);
        pdwDstStatus   = &(pColumnData->dwStatus);
        cbDstMaxLength = pBinding[cBind].cbMaxLen;

        dwPart         = pBinding[cBind].dwPart;
        dwDstType      = rgdbcolumninfo[cCols].wType;

        // Get the Length
    if( dwPart & DBPART_LENGTH )
      dwSrcLength = *(ULONG *)((BYTE*)pData + pBinding[cBind].obLength);
    else
      dwSrcLength = 0;

        // Get the Status
        if( dwPart & DBPART_STATUS )
      dwSrcStatus = *(ULONG *)((BYTE*)pData + pBinding[cBind].obStatus);
    else
      dwSrcStatus = DBSTATUS_S_OK;

        // Check the Status for DBSTATUS_S_DEFAULT
    if( dwSrcStatus == DBSTATUS_S_DEFAULT )
      dwSrcStatus = DBSTATUS_S_ISNULL;

        // Check the Status for DBSTATUS_S_IGNORE
    if( dwSrcStatus == DBSTATUS_S_IGNORE ||
      dwSrcStatus == DBSTATUS_S_ISNULL )
      continue;

        // Check the Status of the value being sent in
    if( dwSrcStatus != DBSTATUS_S_OK )
    {
      *(ULONG *)((BYTE*)pData + pBinding[cBind].obStatus) = DBSTATUS_E_BADSTATUS;
      cErrorCount++;
      continue;
    }

        // Get the Value
    if( (dwPart & DBPART_VALUE) == 0 )
    {
            if( dwPart & DBPART_STATUS )
        *(ULONG *)((BYTE*)pData + pBinding[cBind].obStatus) = DBSTATUS_E_UNAVAILABLE;

      cErrorCount++;
      continue;
    }
        else
    {
            pSrc = (void *) ((BYTE*) pData + pBinding[cBind].obValue);
    }

    // Check to see if we have a DC
    if( !g_pIDataConvert )
      return( E_FAIL );

    hr = g_pIDataConvert->DataConvert(
        dwSrcType,
                dwDstType,
                dwSrcLength,
                pdwDstLength,
                pSrc,
                pDst,
                cbDstMaxLength,
                dwSrcStatus,
                pdwDstStatus,
                pBinding[cBind].bPrecision, // bPrecision for conversion to DBNUMERIC
        pBinding[cBind].bScale,   // bScale for conversion to DBNUMERIC
        (DBDATACONVERT_SETDATABEHAVIOR |
         (!dwSrcLength ? DBDATACONVERT_LENGTHFROMNTS : 0)));

        if( dwPart & DBPART_STATUS )
      *(ULONG *)((BYTE*)pData + pBinding[cBind].obStatus) = *pdwDstStatus;

    // fatal error
    if( FAILED( hr ) && hr != DB_E_ERRORSOCCURRED )
            return hr;

    // rounding or truncation or can't coerce
    if( hr != S_OK )
      cErrorCount++;
  }

    // Carry out the update.
    if( FAILED( m_pObj->m_pFileio->UpdateRow((DBBKMARK) ((PROWBUFF) pbProvRow)->pbBmk, pbProvRow, UPDATE )) )
  {
        // Restore the row to its previous state
        memcpy( pbProvRow, rgbRowDataSave, m_pObj->m_cbTotalRowSize );
    free( rgbRowDataSave );
        return( E_FAIL );
  }

    free( rgbRowDataSave );

  // If everything went OK except errors in rows use DB_S_ERRORSOCCURRED.
  return cErrorCount ? ( cErrorCount < cBindings ) ?
    ( DB_S_ERRORSOCCURRED ) : ( DB_E_ERRORSOCCURRED ) : ( S_OK );
}

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/sampprov/rowset.h
  • Dataaccess/oledb/sampprov/rowchng.cpp
Generated on Wed Nov 13 2024 16:56:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CImpIRowsetIdentity Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CImpIRowsetIdentity Class Reference

#include "rowset.h"

List of all members.

Public Member Functions

DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR (CRowset, CImpIRowsetIdentity)
DEFINE_DEFAULT_IUNKNOWN_ADDREF_RELEASE
STDMETHODIMP 		IsSameRow (HROW hThisRow, HROW hThatRow)

Detailed Description

Definition at line 278 of file rowset.h.

Member Function Documentation

CImpIRowsetIdentity::DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR | ( | CRowset | ,
 |  | CImpIRowsetIdentity |
 | ) |  |
STDMETHODIMP CImpIRowsetIdentity::IsSameRow | ( | HROW | hThisRow,
 |  | HROW | hThatRow
 | ) |  |

Definition at line 30 of file irowiden.cpp.

{
  //
  // Asserts
    //
  assert(m_pObj);
  assert(m_pObj->m_prowbitsIBuffer);
  assert(m_pObj->m_pFileio);

    //
  // Check validity of input handles
    //
  if( m_pObj->m_prowbitsIBuffer->IsSlotSet((ULONG)hThisRow) != S_OK ||
    m_pObj->m_prowbitsIBuffer->IsSlotSet((ULONG)hThatRow) != S_OK )
    return (DB_E_BADROWHANDLE);

    //
  // Obtain a pointers to corresponding row buffers.
    //
  PROWBUFF prowbuffThis = m_pObj->GetRowBuff((DBCOUNTITEM)hThisRow, TRUE);
  PROWBUFF prowbuffThat = m_pObj->GetRowBuff((DBCOUNTITEM)hThatRow, TRUE);

    //
  // Check to see if the row is Deleted
    //
  if( m_pObj->m_pFileio->IsDeleted((DBBKMARK) prowbuffThis->pbBmk) == S_OK ||
    m_pObj->m_pFileio->IsDeleted((DBBKMARK) prowbuffThat->pbBmk) == S_OK )
    return (DB_E_DELETEDROW);

    //
  // Check for a released row handle (most likely).
    //
  return (hThisRow == hThatRow) ? S_OK : S_FALSE;
}

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/sampprov/rowset.h
  • Dataaccess/oledb/sampprov/irowiden.cpp
Generated on Wed Nov 13 2024 16:56:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CImpIRowsetInfo Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CImpIRowsetInfo Class Reference

#include "rowset.h"

List of all members.

Public Member Functions

DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR (CRowset, CImpIRowsetInfo)
STDMETHODIMP | GetProperties (const ULONG cPropertySets, const DBPROPIDSET rgPropertySets[], ULONG *pcProperties, DBPROPSET **prgProperties)
DEFINE_DEFAULT_IUNKNOWN_ADDREF_RELEASE
STDMETHODIMP 		GetReferencedRowset (DBORDINAL iOrdinal, REFIID rrid, IUnknown **ppReferencedRowset)
STDMETHODIMP | GetSpecification (REFIID, IUnknown **)

Detailed Description

Definition at line 243 of file rowset.h.

Member Function Documentation

CImpIRowsetInfo::DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR | ( | CRowset | ,
 |  | CImpIRowsetInfo |
 | ) |  |
STDMETHODIMP CImpIRowsetInfo::GetProperties | ( | const ULONG | cPropertySets,
 |  | const DBPROPIDSET | rgPropertySets[],
 |  | ULONG * | pcProperties,
 |  | DBPROPSET ** | prgProperties
 | ) |  |

Definition at line 73 of file rowinfo.cpp.

{
    HRESULT hr;

  //
  // Asserts
    //
  assert(m_pObj);
    assert(m_pObj->m_pUtilProp);

    //
    // Check in-params and NULL out-params in case of error
    //
  hr = m_pObj->m_pUtilProp->GetPropertiesArgChk(PROPSET_ROWSET,cPropertySets,
                  rgPropertySets,pcProperties,prgProperties);
  if( FAILED(hr) )
    return hr;

    //
    // Just pass this call on to the utility object that manages our properties
    //
    return m_pObj->m_pUtilProp->GetProperties(PROPSET_ROWSET,cPropertySets,
                  rgPropertySets,pcProperties,prgProperties);
}

STDMETHODIMP CImpIRowsetInfo::GetReferencedRowset | ( | DBORDINAL | iOrdinal,
 |  | REFIID | rrid,
 |  | IUnknown ** | ppReferencedRowset
 | ) |  |

Definition at line 30 of file rowinfo.cpp.

{
  //
  // Asserts
    //
  assert( m_pObj );

    //
    // Check in-params and NULL out-params in case of error
    //
  if( !ppReferencedRowset )
        return( E_INVALIDARG );

  *ppReferencedRowset = NULL;

    //
  // The oridinal was greater than the number of columns that we have.
    //
  if( iOrdinal == 0 || iOrdinal > m_pObj->m_cCols )
    return( DB_E_BADORDINAL );

    //
  // Since we don't support bookmarks, this will alway return an error
    //
    return( DB_E_NOTAREFERENCECOLUMN );
}

STDMETHODIMP CImpIRowsetInfo::GetSpecification | ( | REFIID | riid,
 |  | IUnknown ** | ppSpecification
 | ) |  |

Definition at line 114 of file rowinfo.cpp.

{
    //
  // Asserts
    //
  assert(m_pObj);
  assert(m_pObj->m_pParentObj);
  assert(m_pObj->m_pParentObj->GetOuterUnknown());

    //
    // Check in-params and NULL out-params in case of error
    //
    if( !ppSpecification )
        return (E_INVALIDARG);

    *ppSpecification = NULL;

  return m_pObj->m_pParentObj->GetOuterUnknown()->QueryInterface(riid,(void**)ppSpecification);
}

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/sampprov/rowset.h
  • Dataaccess/oledb/sampprov/rowinfo.cpp
Generated on Wed Nov 13 2024 16:56:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CImpIServiceProvider Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CImpIServiceProvider Class Reference

#include "datasrc.h"

List of all members.

Public Member Functions

DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR (CDataSource, CImpIServiceProvider)
DEFINE_DEFAULT_IUNKNOWN_ADDREF_RELEASE
STDMETHODIMP 		QueryService (REFGUID guidService, REFIID riid, void **ppvObject)

Detailed Description

Definition at line 246 of file datasrc.h.

Member Function Documentation

CImpIServiceProvider::DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR | ( | CDataSource | ,
 |  | CImpIServiceProvider |
 | ) |  |
STDMETHODIMP CImpIServiceProvider::QueryService | ( | REFGUID | guidService,
 |  | REFIID | riid,
 |  | void ** | ppvObject
 | ) |  |

Definition at line 314 of file datasrc.cpp.

{
  HRESULT hr = S_OK;
  if(!ppvObject)
    return E_INVALIDARG;
  *ppvObject = NULL;

  //DSL property Pages
  if(guidService == OLEDB_SVC_DSLPropertyPages)
  {
    CImpISpecifyPropertyPages* pCImpISpecifyPropertyPages = new CImpISpecifyPropertyPages;
    if(!pCImpISpecifyPropertyPages)
      return E_OUTOFMEMORY;

    return pCImpISpecifyPropertyPages->QueryInterface(IID_ISpecifyPropertyPages, ppvObject);
  }
  else
  {
//    TODO? hr = SVC_E_UNKNOWNSERVICE;
    hr = E_FAIL;
  }

  return hr;
}

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/sampprov/datasrc.h
  • Dataaccess/oledb/sampprov/datasrc.cpp
Generated on Wed Nov 13 2024 16:56:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CImpISessionProperties Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CImpISessionProperties Class Reference

#include "dbsess.h"

List of all members.

Public Member Functions

DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR (CDBSession, CImpISessionProperties)
DEFINE_DEFAULT_IUNKNOWN_ADDREF_RELEASE
STDMETHODIMP 		GetProperties (ULONG cPropertySets, const DBPROPIDSET rgPropertySets[], ULONG *pcProperties, DBPROPSET **prgProperties)
STDMETHODIMP SetProperties (ULONG cPropertySets, DBPROPSET rgPropertySets[])

Detailed Description

Definition at line 136 of file dbsess.h.

Member Function Documentation

CImpISessionProperties::DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR | ( | CDBSession | ,
 |  | CImpISessionProperties |
 | ) |  |
STDMETHODIMP CImpISessionProperties::GetProperties | ( | ULONG | cPropertySets,
 |  | const DBPROPIDSET | rgPropertySets[],
 |  | ULONG * | pcProperties,
 |  | DBPROPSET ** | prgProperties
 | ) |  |

Definition at line 278 of file dbsess.cpp.

{
    HRESULT hr;

  //
  // Asserts
    //
  assert(m_pObj);
    assert(m_pObj->m_pUtilProp);

    //
    // Check in-params and NULL out-params in case of error
    //
  hr = m_pObj->m_pUtilProp->GetPropertiesArgChk(PROPSET_SESSION,
        cPropertySets, rgPropertySets, pcProperties, prgProperties);

  if( FAILED(hr) )
    return hr;

    //
    // Just pass this call on to the utility object that manages our properties
    //
    return m_pObj->m_pUtilProp->GetProperties(PROPSET_SESSION, cPropertySets,
                  rgPropertySets, pcProperties, prgProperties);
}

STDMETHODIMP CImpISessionProperties::SetProperties | ( | ULONG | cPropertySets,
 |  | DBPROPSET | rgPropertySets[]
 | ) |  |

Definition at line 319 of file dbsess.cpp.

{
    HRESULT hr = E_FAIL;

    //
  // Asserts
    //
  assert( m_pObj );
    assert( m_pObj->m_pUtilProp );

    //
  // Quick return if the Count of cPropertySets is 0
    //
  if( cPropertySets == 0 )
    return S_OK;

    //
    // Check in-params and NULL out-params in case of error
    //
  hr=m_pObj->m_pUtilProp->SetPropertiesArgChk(cPropertySets, rgPropertySets);

  if( FAILED(hr) )
    return hr;

    //
    // Just pass this call on to the utility object that manages our properties
    //
    return m_pObj->m_pUtilProp->SetProperties(PROPSET_SESSION,
                        cPropertySets, rgPropertySets);
}

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/sampprov/dbsess.h
  • Dataaccess/oledb/sampprov/dbsess.cpp
Generated on Wed Nov 13 2024 16:56:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CImpISpecifyPropertyPages Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CImpISpecifyPropertyPages Class Reference

#include "datasrc.h"

List of all members.

Public Member Functions

CImpISpecifyPropertyPages ()
virtual | ~CImpISpecifyPropertyPages ()
STDMETHODIMP | GetPages (CAUUID *pPages)
DEFINE_ADDREF_RELEASE STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)

Private Attributes

ULONG m_cRef

Detailed Description

Definition at line 265 of file datasrc.h.

Constructor & Destructor Documentation

CImpISpecifyPropertyPages::CImpISpecifyPropertyPages ( ) [inline]

Definition at line 271 of file datasrc.h.

    {
      m_cRef    = 0;
    }

virtual CImpISpecifyPropertyPages::~CImpISpecifyPropertyPages ( ) [inline, virtual]

Definition at line 275 of file datasrc.h.

    {
    }

Member Function Documentation

STDMETHODIMP CImpISpecifyPropertyPages::GetPages ( CAUUID * pPages ) [inline]

Definition at line 300 of file datasrc.h.

    {
      //Outer array is consumer allocated.
      HRESULT hr = E_OUTOFMEMORY;
      if(!pPages)
        return E_INVALIDARG;

      //Inner sets are provider allocaed
      pPages->cElems = 2;
      SAFE_ALLOC(pPages->pElems, GUID, pPages->cElems);

      //Fill in the array
      pPages->pElems[0] = CLSID_SampProvConnectionPage;
      pPages->pElems[1] = CLSID_SampProvAdvancedPage;
      hr = S_OK;

    CLEANUP:
      return hr;
    }

DEFINE_ADDREF_RELEASE STDMETHODIMP CImpISpecifyPropertyPages::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv |
 | ) |  |  | [inline]

Definition at line 280 of file datasrc.h.

    {
      if(!ppv)
        return E_INVALIDARG;

      if(riid == IID_IUnknown)
        *ppv = (IUnknown*)this;
      else if(riid == IID_ISpecifyPropertyPages)
        *ppv = (ISpecifyPropertyPages*)this;
      else
      {
        *ppv = NULL;
        return E_NOINTERFACE;
      }

      SAFE_ADDREF(*ppv);
      return S_OK;
    }

Member Data Documentation

ULONG CImpISpecifyPropertyPages::m_cRef [private]

Definition at line 268 of file datasrc.h.

The documentation for this class was generated from the following file:
  • Dataaccess/oledb/sampprov/datasrc.h
Generated on Wed Nov 13 2024 16:56:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CImpIStream Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CImpIStream Class Reference

#include "stream.h"

List of all members.

Public Member Functions

STDMETHODIMP | Clone (IStream **ppstm)
STDMETHODIMP | Commit (DWORD grfCommitFlags)
STDMETHODIMP | CopyTo (IStream *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten)
DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR (CStream, CImpIStream)
STDMETHODIMP | LockRegion (ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
DEFINE_DEFAULT_IUNKNOWN_ADDREF_RELEASE
STDMETHODIMP 		Read (void *pv, ULONG cb, ULONG *pcbRead)
STDMETHODIMP | Revert ()
STDMETHODIMP | Seek (LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
STDMETHODIMP | SetSize (ULARGE_INTEGER libNewSize)
STDMETHODIMP | Stat (STATSTG *pstatstg, DWORD grfStatFlag)
STDMETHODIMP | UnlockRegion (ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
STDMETHODIMP | Write (const void *pv, ULONG cb, ULONG *pcbWritten)

Detailed Description

Definition at line 94 of file stream.h.

Member Function Documentation

HRESULT CImpIStream::Clone ( IStream ** ppstm )

Definition at line 473 of file stream.cpp.

{
  return E_NOTIMPL;
}

HRESULT CImpIStream::Commit ( DWORD grfCommitFlags )

Definition at line 366 of file stream.cpp.

{
  return S_OK;
}

HRESULT CImpIStream::CopyTo | ( | IStream * | pstm,
 |  | ULARGE_INTEGER | cb,
 |  | ULARGE_INTEGER * | pcbRead,
 |  | ULARGE_INTEGER * | pcbWritten
 | ) |  |

Definition at line 347 of file stream.cpp.

{
  return E_NOTIMPL;
}

CImpIStream::DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR | ( | CStream | ,
 |  | CImpIStream |
 | ) |  |
HRESULT CImpIStream::LockRegion | ( | ULARGE_INTEGER | libOffset,
 |  | ULARGE_INTEGER | cb,
 |  | DWORD | dwLockType
 | ) |  |

Definition at line 395 of file stream.cpp.

{
  return STG_E_INVALIDFUNCTION;
}

HRESULT CImpIStream::Read | ( | void * | pv,
 |  | ULONG | cb,
 |  | ULONG * | pcbRead
 | ) |  |

Definition at line 222 of file stream.cpp.

{
  assert( m_pObj );
  assert( m_pObj->m_pParentObj );

  ULONG cbRead = 0;
  ULONG cBytesLeft = 0;
  ULONG cBytesRead = 0;

  if( !pv )
    return STG_E_INVALIDPOINTER;

  if( cb == 0 )
    return S_OK;

  cBytesLeft = m_pObj->m_cMaxSize > m_pObj->m_iPos ? m_pObj->m_cMaxSize - m_pObj->m_iPos : 0;
  cBytesRead = cb > cBytesLeft ? cBytesLeft : cb;

  //if no more bytes to retrive return
  if(cBytesLeft == 0)
    return S_FALSE;

  //Copy to users buffer the number of bytes requested or remaining
  memcpy(pv, (void*)((BYTE*)m_pObj->m_pBuffer + m_pObj->m_iPos), cBytesRead);

  if(pcbRead)
    *pcbRead = cBytesRead;

  m_pObj->m_iPos += cBytesRead;

  if(cb != cBytesRead)
    return S_FALSE;

  return S_OK;
}

HRESULT CImpIStream::Revert ( void )

Definition at line 381 of file stream.cpp.

{
  return S_OK;
}

HRESULT CImpIStream::Seek | ( | LARGE_INTEGER | dlibMove,
 |  | DWORD | dwOrigin,
 |  | ULARGE_INTEGER * | plibNewPosition
 | ) |  |

Definition at line 284 of file stream.cpp.

{
  DWORDLONG ullOffset = 0;
  HRESULT   hr = S_OK;
  CStream * pCStream = (CStream *) m_pObj;

  //Determine with respect to what the origin is...
  switch(dwOrigin)
  {
    case STREAM_SEEK_SET:
      ullOffset = dlibMove.QuadPart;
      break;

    case STREAM_SEEK_CUR:
      ullOffset = pCStream->m_iPos + dlibMove.QuadPart;
      break;

    case STREAM_SEEK_END:
      ullOffset = pCStream->m_cMaxSize + dlibMove.QuadPart;
      break;

    default:
      //The value of the dwOrigin parameter is not valid
      return STG_E_INVALIDFUNCTION;
  };

  //Make sure the new offset is within the range, for some reason ::Seek
  //allows going off the end of the stream...
  if( ullOffset < 0 || ullOffset > pCStream->m_cMaxSize )
    return STG_E_INVALIDFUNCTION;

  //Reset the current buffer position
  pCStream->m_iPos = (ULONG)ullOffset;

  if(plibNewPosition)
    plibNewPosition->QuadPart = pCStream->m_iPos;

  return hr;
}

HRESULT CImpIStream::SetSize ( ULARGE_INTEGER libNewSize )

Definition at line 334 of file stream.cpp.

{
  return E_NOTIMPL;
}

HRESULT CImpIStream::Stat | ( | STATSTG * | pstatstg,
 |  | DWORD | grfStatFlag
 | ) |  |

Definition at line 434 of file stream.cpp.

{
  if(!pstatstg)
    return STG_E_INVALIDPOINTER;
#if 0
  //Initialize the struct
  memset(pstatstg, 0, sizeof(STATSTG));

  //Set the string...
  if(grfStatFlag & STATFLAG_NONAME)
    pstatstg->pwcsName = NULL;
  else if(grfStatFlag & STATFLAG_DEFAULT)
    pstatstg->pwcsName = wcsDuplicate(L"Sample Provider Storage Object...");
  else
    return STG_E_INVALIDFLAG;

  //type
  pstatstg->type = STGTY_STREAM;
  pstatstg->grfMode = STGM_READ;
  pstatstg->grfLocksSupported = 0;

  ULARGE_INTEGER largeInteger = { m_pObj->m_cMaxSize };
  pstatstg->cbSize = largeInteger;
#endif

  return S_OK;
}

HRESULT CImpIStream::UnlockRegion | ( | ULARGE_INTEGER | libOffset,
 |  | ULARGE_INTEGER | cb,
 |  | DWORD | dwLockType
 | ) |  |

Definition at line 413 of file stream.cpp.

{
  //Locking is optional
  return STG_E_INVALIDFUNCTION;
}

HRESULT CImpIStream::Write | ( | const void * | pv,
 |  | ULONG | cb,
 |  | ULONG * | pcbWritten
 | ) |  |

Definition at line 268 of file stream.cpp.

{
  // Sample Provider's stream are strictly read only
  return STG_E_ACCESSDENIED;
}

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/sampprov/stream.h
  • Dataaccess/oledb/sampprov/stream.cpp
Generated on Wed Nov 13 2024 16:56:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CImportRes Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CImportRes Class Reference

List of all members.

Public Member Functions

CImportRes (const TCHAR *szDatabase, const TCHAR *szSaveDatabase, const TCHAR *szDLLFile)
~CImportRes ()
UINT | ImportDialog (TCHAR *szDialog)
UINT ImportDialogs ()
UINT ImportStrings ()
BOOL IsInErrorState ()
BOOL | LoadDialog (HINSTANCE hModule, const TCHAR *szType, TCHAR *szDialog)
BOOL | LoadString (HINSTANCE hModule, const TCHAR *szType, TCHAR *szString)
BOOL | SetCodePage (WORD wLang)
void | SetErrorState (BOOL fState)
void | SetFoundLang (BOOL fValue)
BOOL WasLanguagePreviouslyFound ()

Private Member Functions

UINT ImportDlgInit ()
UINT Initialize ()
UINT VerifyDatabaseCodepage ()

Private Attributes

BOOL m_fError
BOOL m_fFoundLang
BOOL m_fSetCodepage
MSIHANDLE | m_hControl
MSIHANDLE | m_hDatabase
MSIHANDLE | m_hDialog
HINSTANCE | m_hInst
MSIHANDLE | m_hRadioButton
const TCHAR * | m_szDatabase
const TCHAR * | m_szDLLFile
const TCHAR * | m_szOrigDb

Detailed Description

Definition at line 286 of file msiloc.cpp.

Constructor & Destructor Documentation

CImportRes::CImportRes | ( | const TCHAR * | szDatabase,
 |  | const TCHAR * | szSaveDatabase,
 |  | const TCHAR * | szDLLFile |
 | ) |  |  | [inline]

Definition at line 289 of file msiloc.cpp.

                                                                                : m_szDatabase(szSaveDatabase), m_szOrigDb(szDatabase), m_szDLLFile(szDLLFile), m_hDatabase(0), m_fError(FALSE),
        m_hControl(0), m_hDialog(0), m_hRadioButton(0), m_hInst(0), m_fSetCodepage(FALSE), m_fFoundLang(FALSE){};

CImportRes::~CImportRes ( )

Definition at line 2636 of file msiloc.cpp.

{
  UINT iStat;
  if (m_hDatabase)
  {
    // only commit database if no errors
    if (!m_fError)
    {
      if (ERROR_SUCCESS != (iStat = MsiDatabaseCommit(m_hDatabase)))
        _tprintf(TEXT("!! DATABASE COMMIT FAILED. Error = %d\n"), iStat);
    }
    else
      _tprintf(TEXT("NO CHANGES SAVED TO DATABASE DUE TO ERROR\n"));
    MsiCloseHandle(m_hDatabase);
  }
  if (m_hControl)
    MsiCloseHandle(m_hControl);
  if (m_hDialog)
    MsiCloseHandle(m_hDialog);
  if (m_hRadioButton)
    MsiCloseHandle(m_hRadioButton);
  if (m_hInst)
    FreeLibrary(m_hInst);

}

Member Function Documentation

UINT CImportRes::ImportDialog ( TCHAR * szDialog )

Definition at line 2782 of file msiloc.cpp.

{
  UINT iStat = Initialize();
  if (ERROR_SUCCESS != iStat)
    return m_fError = TRUE, iStat; // error - ABORT

  if (ERROR_SUCCESS != (iStat = ImportDlgInit()))
    return m_fError = TRUE, iStat; // error - ABORT

  // convert dialog name to resource identifier (all upper case)
  _tcsupr(szDialog);

#ifdef DEBUG
  _tprintf(TEXT("LOG>>...BEGIN SEARCH FOR DIALOG <%s>...\n"), szDialog);
#endif

  // load dialog
  if (!LoadDialog(m_hInst, RT_DIALOG, szDialog))
  {
    _tprintf(TEXT("LOG_ERROR>> UNABLE LOAD DIALOG: %s\n"), szDialog);
    return ERROR_FUNCTION_FAILED; // fatal error state set in LoadDialog
  }

  return ERROR_SUCCESS;
}

UINT CImportRes::ImportDialogs ( )

Definition at line 2900 of file msiloc.cpp.

{
  UINT iStat = Initialize();
  if (ERROR_SUCCESS != iStat)
    return m_fError = TRUE, iStat; // error - ABORT
  if (ERROR_SUCCESS != (iStat = ImportDlgInit()))
    return m_fError = TRUE, iStat; // error - ABORT

#ifdef DEBUG
  _tprintf(TEXT("LOG>>...BEGIN DIALOG RESOURCE ENUMERATION...\n"));
#endif

  // enumerate through dialog resources
  BOOL fOK = EnumResourceNames(m_hInst, RT_DIALOG, EnumDialogCallback, (long)this);
  if (!fOK)
    return m_fError = TRUE, ERROR_FUNCTION_FAILED; // error - ABORT

#ifdef DEBUG
  _tprintf(TEXT("LOG>>...END DIALOG RESOURCE ENUMERATION...\n"));
#endif

  return ERROR_SUCCESS;
}

UINT CImportRes::ImportDlgInit ( ) [private]

Definition at line 2810 of file msiloc.cpp.

{
  // open up view on Dialog table
  UINT iStat;
  if (!m_hDialog)
  {
    if (ERROR_SUCCESS != (iStat = MsiDatabaseOpenView(m_hDatabase, sqlDialogImport, &m_hDialog)))
      return m_fError = TRUE, iStat; // error - ABORT
  }
  // open up view on Control table
  if (!m_hControl)
  {
    if (ERROR_SUCCESS != (iStat = MsiDatabaseOpenView(m_hDatabase, sqlControlImport, &m_hControl)))
    {
      if (ERROR_BAD_QUERY_SYNTAX != iStat)
        return m_fError = TRUE, iStat; // error - ABORT
    }
  }
  // open up view on RadioButton table
  if (!m_hRadioButton)
  {
    if (ERROR_SUCCESS != (iStat = MsiDatabaseOpenView(m_hDatabase, sqlRadioButtonImport, &m_hRadioButton)))
    {
      if (ERROR_BAD_QUERY_SYNTAX != iStat)
        return ERROR_SUCCESS; // they just don't have a radiobutton table
      else
        return m_fError = TRUE, iStat; // error - ABORT
    }
  }

  return ERROR_SUCCESS;
}

UINT CImportRes::ImportStrings ( )

Definition at line 2876 of file msiloc.cpp.

{
  UINT iStat = Initialize();
  if (ERROR_SUCCESS != iStat)
    return m_fError = TRUE, iStat; // error - ABORT

#ifdef DEBUG
  _tprintf(TEXT("LOG>>...BEGIN STRING RESOURCE ENUMERATION...\n"));
#endif

  // enumerate through string resources
  BOOL fOK = EnumResourceNames(m_hInst, RT_STRING, EnumStringCallback, (long)this);
  if (!fOK)
    return m_fError = TRUE, ERROR_FUNCTION_FAILED; // error - ABORT

#ifdef DEBUG
  _tprintf(TEXT("LOG>>...END STRING RESOURCE ENUMERATION...\n"));
#endif

  return ERROR_SUCCESS;
}

UINT CImportRes::Initialize ( void ) [private]

Definition at line 2845 of file msiloc.cpp.

{
  // attempt to load the DLL in memory
  if (!m_hInst)
  {
    m_hInst = LoadLibrary(m_szDLLFile);
    if (NULL == m_hInst)
    {
      _tprintf(TEXT("LOG_ERROR>> Unable to load DLL '%s'\n"), m_szDLLFile);
      return m_fError = TRUE, ERROR_FUNCTION_FAILED; // error - ABORT
    }
  }

  // open up database in TRANSACT mode so we can update
  if (!m_hDatabase)
  {
    assert(m_szOrigDb);
    // open up existing database in transacted mode, or specify a new database for creation
    UINT iStat;
    if (ERROR_SUCCESS != (iStat = MsiOpenDatabase(m_szOrigDb, m_szDatabase ? m_szDatabase : MSIDBOPEN_TRANSACT, &m_hDatabase)))
    {
      _tprintf(TEXT("LOG_ERROR>> Unable to open database '%s'\n"), m_szOrigDb);
      return m_fError = TRUE, iStat; // error - ABORT
    }
    _tprintf(TEXT("LOG>> Database opened from-->%s, Database saving to-->%s\n"),m_szOrigDb, m_szDatabase ? m_szDatabase : m_szOrigDb);
  }
  return ERROR_SUCCESS;
}

BOOL CImportRes::IsInErrorState ( ) [inline]

Definition at line 296 of file msiloc.cpp.

{return m_fError;}

BOOL CImportRes::LoadDialog | ( | HINSTANCE | hModule,
 |  | const TCHAR * | szType,
 |  | TCHAR * | szDialog
 | ) |  |

! don't appear to be aligned on word boundary, instead have extra 16 though ??

Definition at line 3272 of file msiloc.cpp.

{
  // Find dialog resource into memory
  HRSRC hrsrc = FindResource(hModule, szDialog, szType);
  if (hrsrc == NULL)
  {
    _tprintf(TEXT("LOG_ERROR>> DIALOG RESOURCE: %s NOT FOUND!\n"), szDialog);
    // not set error state here we could be attempting to load individual dlg resources and we want to continue
    return FALSE;
  }

  // Load resource
  HGLOBAL hResource = LoadResource(hModule, hrsrc);
  if (hResource == NULL)
    return m_fError = TRUE, FALSE; // error - ABORT

  // Create stream object to read from resource in memory
  CDialogStream DialogRes(LockResource(hResource));

  const unsigned short STANDARD_MARKER = 0xFFFF;

  ////////////////////////////////////////////////////////////////
  //                  Dialog Information                        //
  //                                                            //
  // stored as DLGTEMPLATEEX (should not have DLGTEMPLATE)      //
      /*  typedef struct {
        WORD      dlgVer;
        WORD      signature;
        DWORD     helpID;
        DWORD     exStyle;
        DWORD     style;
        WORD      cDlgItems;
        short     x;
        short     y;
        short     cx;
        short     cy;
        sz_Or_Ord menu;
        sz_Or_Ord windowClass;
        WCHAR     title[titleLen];
      // The following members exist only if the style member is
      // set to DS_SETFONT or DS_SHELLFONT.
        short     pointsize;
        short     weight;
        short     italic;
        WCHAR     typeface[stringLen];
      } DLGTEMPLATEEX; */
  ////////////////////////////////////////////////////////////////

  ////////////////////////////////////////////////////////////////////
  // DLGTEMPLATE structure does not have dlgVer, signature, helpID,
  //             weight, or italic members
  //

  /* dlgVer */
  unsigned short iDlgVer = DialogRes.GetUInt16();
  BOOL fOldVersion = FALSE;
  if (iDlgVer != 1)
  {
    // we have the old style -- DLGTEMPLATE + DLGITEMTEMPLATE
    fOldVersion = TRUE;
    DialogRes.Undo16();
  }
  if (!fOldVersion)
  {
    /* signature */
    DialogRes.GetInt16();
    /* helpID */
    DialogRes.GetInt32();
  }
  /* Extended Style + Style */
  int iDlgStyle = DialogRes.GetInt32() | DialogRes.GetInt32();
  /* Number of Controls on Dialog */
  unsigned short iNumCtrl  = DialogRes.GetUInt16();
  /* X-coord (maps to HCentering value) */
  unsigned short iDlgXDim  = DialogRes.GetUInt16();
  /* Y-coord (maps to VCentering value) */
  unsigned short iDlgYDim  = DialogRes.GetUInt16();
  /* width */
  unsigned short iDlgWdDim = DialogRes.GetUInt16();
  /* height */
  unsigned short iDlgHtDim = DialogRes.GetUInt16();
  /* menu, aligned on WORD boundary */
  DialogRes.Align16();
  unsigned short iDlgMenu = DialogRes.GetUInt16();
  if (iDlgMenu == STANDARD_MARKER)
    DialogRes.GetInt16(); // ordinal menu value
  else if (iDlgMenu != 0x0000)
  {
    TCHAR* szMenu = DialogRes.GetStr();
    if (szMenu)
      delete [] szMenu;
  }
  /* class, aligned on WORD boundary */
  DialogRes.Align16();
  unsigned short iDlgClass = DialogRes.GetUInt16();
  if (iDlgClass == STANDARD_MARKER)
    DialogRes.GetInt16(); // ordinal window class value
  else if (iDlgClass != 0x00)
  {
    TCHAR* szClass = DialogRes.GetStr();
    if (szClass)
      delete [] szClass;
  }
  /* title, aligned on WORD boundary */
  DialogRes.Align16();
  TCHAR* szDlgTitle = DialogRes.GetStr();
  if ( !szDlgTitle )
    return m_fError = TRUE, TRUE;
  /* font */
  if (iDlgStyle & DS_SETFONT)
  {
    /* font point size */
    short iDlgPtSize = DialogRes.GetInt16();
    if (!fOldVersion)
    {
      /* font weight */
      short iDlgFontWt = DialogRes.GetInt16();
      /* font italic */
      short iDlgFontItalic = DialogRes.GetInt16();
    }
    /* font typeface, aligned on WORD boundary */
    DialogRes.Align16();
    TCHAR* szFont = DialogRes.GetStr();
    if (szFont)
      delete [] szFont;
  }

#ifdef DEBUG
  _tprintf(TEXT("LOG>> DIALOG '%s' with '%d' controls at x=%d,y=%d,wd=%d,ht=%d. Title = \"%s\"\n"),
        szDialog,iNumCtrl,iDlgXDim,iDlgYDim,iDlgWdDim,iDlgHtDim,szDlgTitle);
#endif

  /* find dialog in Dialog table, if fail, we ignore */
  //UNSUPPORTED: additional dialogs

  // first find match to dialog in _RESDialogs table
  PMSIHANDLE hViewFindDlgInstlrName = 0;
  PMSIHANDLE hRecDlgInstlrName = 0;
  PMSIHANDLE hRecDlgRESName = MsiCreateRecord(1);
  assert(hRecDlgRESName);
  UINT iStat;
  if (ERROR_SUCCESS != MsiRecordSetString(hRecDlgRESName, 1, szDialog)
    || ERROR_SUCCESS != MsiDatabaseOpenView(m_hDatabase, sqlDialogInstallerName, &hViewFindDlgInstlrName)
    || ERROR_SUCCESS != MsiViewExecute(hViewFindDlgInstlrName, hRecDlgRESName)
    || ERROR_SUCCESS != (iStat = MsiViewFetch(hViewFindDlgInstlrName, &hRecDlgInstlrName))
    || ERROR_SUCCESS != MsiViewExecute(m_hDialog, hRecDlgInstlrName))
  {
    delete [] szDlgTitle;
    return m_fError = TRUE, TRUE;
  }

  // fetch dialog for update
  PMSIHANDLE hRecDlg = 0;
  if (ERROR_SUCCESS != (iStat = MsiViewFetch(m_hDialog, &hRecDlg)))
  {
    assert(iStat == ERROR_NO_MORE_ITEMS);
    // could be ERROR_NO_MORE_ITEMS -- someone removed the dialog
    _tprintf(TEXT("LOG_ERROR>> Dialog '%s' not found in database '%s'. New Dialogs are not supported.\n"), szDialog, m_szDatabase);
    delete [] szDlgTitle;
    return m_fError = TRUE, TRUE; // error - ABORT, but TRUE to continue processing
  }

  // update dialog
  if (ERROR_SUCCESS != MsiRecordSetInteger(hRecDlg, idiHCentering, iDlgXDim)
    || ERROR_SUCCESS != MsiRecordSetInteger(hRecDlg, idiVCentering, iDlgYDim)
    || ERROR_SUCCESS != MsiRecordSetInteger(hRecDlg, idiWidth, iDlgWdDim)
    || ERROR_SUCCESS != MsiRecordSetInteger(hRecDlg, idiHeight, iDlgHtDim))
  {
    delete [] szDlgTitle;
    return m_fError = TRUE, TRUE;
  }

  if (_tcscmp(strOverLimit, szDlgTitle) != 0) // don't update if "!! STR OVER LIMIT !!"
  {
    if (ERROR_SUCCESS != MsiRecordSetString(hRecDlg, idiTitle, szDlgTitle))
    {
      delete [] szDlgTitle;
      return m_fError = TRUE, TRUE;
    }
  }

  if (ERROR_SUCCESS != (iStat = MsiViewModify(m_hDialog, MSIMODIFY_UPDATE, hRecDlg)))
  {
    _tprintf(TEXT("LOG_ERROR>>Failed to update Dialog '%s'.\n"), szDialog);
    delete [] szDlgTitle;
    return m_fError = TRUE, TRUE; // error - ABORT, but TRUE to continue with other Dialogs
  }

  delete [] szDlgTitle;
  szDlgTitle = NULL;

  ///////////////////////////////////////////////////////////////////////
  //                  Control Information                              //
  //                                                                   //
  // stored as DLGITEMTEMPLATEEX (should not have DLGITEMTEMPLATE)     //
  /*  typedef struct {
      DWORD  helpID;
      DWORD  exStyle;
      DWORD  style;
      short  x;
      short  y;
      short  cx;
      short  cy;
      WORD   id;
      sz_Or_Ord windowClass;
      sz_Or_Ord title;
      WORD   extraCount;
    } DLGITEMTEMPLATEEX; */
  /////////////////////////////////////////////////////////////////////////

  /////////////////////////////////////////////////////////////////////////
  // DLGITEMTEMPLATE does not have helpID
  //
  if (iNumCtrl > 0 && !m_hControl)
  {
    _tprintf(TEXT("LOG_ERROR>> Unable to update controls.  Control table does not exist\n"));
    return m_fError = TRUE, TRUE; // error - ABORT, but TRUE to continue processing
  }
  PMSIHANDLE hViewCtrlInstallerName = 0;
  PMSIHANDLE hRecCtrl = 0;
  PMSIHANDLE hRecRadioButton = MsiCreateRecord(2);
  PMSIHANDLE hRecCtrlResId = MsiCreateRecord(1);
  assert(hRecCtrlResId);
  if (ERROR_SUCCESS != MsiDatabaseOpenView(m_hDatabase, sqlControlInstallerName, &hViewCtrlInstallerName))
  {
    _tprintf(TEXT("LOG_ERROR>> _RESControls table is missing from database\n"));
    return m_fError = TRUE, TRUE;
  }
  bool fRadioButton = false;
  // cycle through the controls
  for (int i = 1; i <= iNumCtrl; i++)
  {
    /* DLGITEMTEMPLATEEX is aligned on a DWORD boundary */
    DialogRes.Align32();

    fRadioButton = false;

    if (!fOldVersion)
    {
      /* helpID */
      DialogRes.GetInt32();
    }
    /* exStyle | style */
    int iCtrlAttrib = DialogRes.GetInt32() | DialogRes.GetInt32();
    /* x */
    unsigned short iCtrlXDim = DialogRes.GetUInt16();
    /* y */
    unsigned short iCtrlYDim = DialogRes.GetUInt16();
    /* cx */
    unsigned short iCtrlWdDim = DialogRes.GetUInt16();
    /* cy */
    unsigned short iCtrlHtDim = DialogRes.GetUInt16();
    /* id */
    unsigned short iCtrlId = DialogRes.GetUInt16();
    /* windowClass -- aligned on word boundary*/
    if (!fOldVersion)
      DialogRes.GetInt16(); //!! don't appear to be aligned on word boundary, instead have extra 16 though ??
    else
      DialogRes.Align16();
    unsigned short iWndwClass = DialogRes.GetUInt16();
    if (iWndwClass == STANDARD_MARKER)
    {
      // pre-defined window class
      unsigned short iCtrlWindowClass = DialogRes.GetUInt16();
      switch (iCtrlWindowClass)
      {
      case 0x0080: // button
        if (iCtrlAttrib & BS_RADIOBUTTON)
          fRadioButton = true;
        break;
      case 0x0081: // edit
        break;
      case 0x0082: // static
        break;
      case 0x0083: // list box
        break;
      case 0x0084: // scroll bar
        break;
      case 0x0085: // combo box
        break;
      default: assert(0);
        break;
      }
    }
    else
    {
      // custom window class, stored as str
      DialogRes.Undo16();
      TCHAR* szCtrlType = DialogRes.GetStr();
      if (szCtrlType)
        delete [] szCtrlType;
    }

    /* title -- aligned on word boundary*/
    DialogRes.Align16();
    TCHAR* szCtrlText = 0;
    if (DialogRes.GetUInt16() == STANDARD_MARKER)
    {
      // ordinal
      DialogRes.GetInt16();
    }
    else
    {
      // str title
      DialogRes.Undo16();
      szCtrlText = DialogRes.GetStr();
    }
    if ( !szCtrlText )
      return m_fError = TRUE, TRUE;

    /* extra count */
    short iCtrlCreationData = DialogRes.GetInt16();
    if (iCtrlCreationData > 0)
    {
      DialogRes.Align16(); // data begins at next WORD boundary
      DialogRes.Move(iCtrlCreationData);
    }

    // find control's real name (for use with Installer)
    if (ERROR_SUCCESS != MsiRecordSetInteger(hRecCtrlResId, 1, iCtrlId)
      || ERROR_SUCCESS != MsiViewExecute(hViewCtrlInstallerName, hRecCtrlResId))
    {
      delete [] szCtrlText;
      return m_fError = TRUE, TRUE;
    }

    // fetch control's real name
    if (ERROR_SUCCESS != (iStat = MsiViewFetch(hViewCtrlInstallerName, &hRecCtrl)))
    {
      if (ERROR_NO_MORE_ITEMS == iStat)
      {
        // new control, unsupported feature
        _tprintf(TEXT("LOG_ERROR>>\t Control with ID '%d' not found. New Controls are not supported.\n"), iCtrlId);
      }

      delete [] szCtrlText;
      return m_fError = TRUE, TRUE; // error - ABORT, but TRUE to continue processing
    }

    DWORD dwName = 0;
    if (ERROR_MORE_DATA != MsiRecordGetString(hRecCtrl, 2, TEXT(""), &dwName))
    {
      delete [] szCtrlText;
      return m_fError = TRUE, TRUE;
    }

    TCHAR* szCtrlName = new TCHAR[++dwName];
    if ( !szCtrlName )
    {
      delete [] szCtrlText;
      return m_fError = TRUE, FALSE;
    }

    if (ERROR_SUCCESS != MsiRecordGetString(hRecCtrl, 2, szCtrlName, &dwName))
    {
      delete [] szCtrlText;
      delete [] szCtrlName;
      return m_fError = TRUE, TRUE;
    }
#ifdef DEBUG
    _tprintf(TEXT("LOG>>\tCONTROL '%d' ('%s') at x=%d,y=%d,wd=%d,ht=%d. Text = \"%s\"\n"),
      iCtrlId,szCtrlName,iCtrlXDim,iCtrlYDim,iCtrlWdDim,iCtrlHtDim,szCtrlText);
#endif

    // fetch control's info for update
    // for radiobuttons, we have to get it from the radiobutton table
    // we also have to parse the szCtrlName string to get out the property and order keys used in the radiobutton table
    // assumes that radiobuttons follow group:property:order syntax
    if (fRadioButton && !_tcschr(szCtrlName, ':'))
      fRadioButton = false; // not really a radiobutton, just the group encapsulating them

    PMSIHANDLE hRecRBExec = 0;
    if (fRadioButton)
    {
      if (!m_hRadioButton)
      {
        _tprintf(TEXT("LOG_ERROR>> RadioButtons found, but no RadioButton table exists in the database\n"));
        delete [] szCtrlText;
        delete [] szCtrlName;
        return m_fError = TRUE, TRUE; // error - ABORT, but TRUE to continue processing
      }
      // parse name RadioButtonGroup:Property:Order
      TCHAR* szRBGroup = _tcstok(szCtrlName, szTokenSeps);
      if ( !szRBGroup )
      {
        delete [] szCtrlText;
        delete [] szCtrlName;
        return m_fError = TRUE, TRUE;
      }
      TCHAR* szRBProperty = _tcstok(NULL, szTokenSeps);
      if ( !szRBProperty )
      {
        delete [] szCtrlText;
        delete [] szCtrlName;
        return m_fError = TRUE, TRUE;
      }
      TCHAR* szRBOrder = _tcstok(NULL, szTokenSeps);
      if ( !szRBOrder )
      {
        delete [] szCtrlText;
        delete [] szCtrlName;
        return m_fError = TRUE, TRUE;
      }
      int iRBOrder = _ttoi(szRBOrder);
#ifdef DEBUG
      _tprintf(TEXT("LOG>> RadioButton belongs to RBGroup: %s, Property: %s, and has Order=%d"), szRBGroup, szRBProperty, iRBOrder);
#endif
      hRecRBExec = MsiCreateRecord(2);
      if (ERROR_SUCCESS != MsiRecordSetString(hRecRBExec, 1, szRBProperty)
        || ERROR_SUCCESS != MsiRecordSetInteger(hRecRBExec, 2, iRBOrder))
      {
        delete [] szCtrlText;
        delete [] szCtrlName;
        return m_fError = TRUE, TRUE;
      }
    }
    if (ERROR_SUCCESS != MsiViewExecute(fRadioButton ? m_hRadioButton : m_hControl, fRadioButton ? hRecRBExec : hRecCtrl))
    {
      delete [] szCtrlText;
      delete [] szCtrlName;
      return m_fError = TRUE, TRUE;
    }
    PMSIHANDLE hRecCtrlUpdate = 0;
    if (ERROR_SUCCESS != (iStat = MsiViewFetch(fRadioButton ? m_hRadioButton : m_hControl, &hRecCtrlUpdate)))
    {
      if (ERROR_NO_MORE_ITEMS == iStat)
      {
        // control has been removed from database
        _tprintf(TEXT("LOG_ERROR>>\t Control with ID '%d' not found in database.\n"), iCtrlId);
      }

      delete [] szCtrlText;
      delete [] szCtrlName;
      return m_fError = TRUE, TRUE; // error - ABORT, but TRUE to continue processing
    }

    // update info
    if (!fRadioButton)
    {
      if (ERROR_SUCCESS != MsiRecordSetInteger(hRecCtrlUpdate, iciX, iCtrlXDim)
        || ERROR_SUCCESS != MsiRecordSetInteger(hRecCtrlUpdate, iciY, iCtrlYDim))
      {
        delete [] szCtrlText;
        delete [] szCtrlName;
        return m_fError = TRUE, TRUE;
      }
    }
    if (ERROR_SUCCESS != MsiRecordSetInteger(hRecCtrlUpdate, fRadioButton ? irbiWidth : iciWidth, iCtrlWdDim)
      || ERROR_SUCCESS != MsiRecordSetInteger(hRecCtrlUpdate, fRadioButton ? irbiHeight : iciHeight, iCtrlHtDim))
    {
      delete [] szCtrlText;
      delete [] szCtrlName;
      return m_fError = TRUE, TRUE;
    }
    if (0 != _tcscmp(strOverLimit, szCtrlText)) // don't update if "!! STR OVER LIMIT !!"
    {
      if (ERROR_SUCCESS != MsiRecordSetString(hRecCtrlUpdate, fRadioButton ? irbiText : iciText, szCtrlText))
      {
        delete [] szCtrlText;
        delete [] szCtrlName;
        return m_fError = TRUE, TRUE;
      }
    }
    if (ERROR_SUCCESS != (iStat = MsiViewModify(fRadioButton ? m_hRadioButton : m_hControl, MSIMODIFY_UPDATE, hRecCtrlUpdate)))
    {
      _tprintf(TEXT("LOG_ERROR>>Failed to update Control '%d'.\n"), iCtrlId);
      delete [] szCtrlText;
      delete [] szCtrlName;
      return m_fError = TRUE, TRUE; // error - ABORT, but TRUE to continue with other Dialogs
    }

    delete [] szCtrlText;
    delete [] szCtrlName;
    if (ERROR_SUCCESS != MsiViewClose(hViewCtrlInstallerName)) // for re-execute
      return m_fError = TRUE, TRUE;
  }

  return TRUE;
}

BOOL CImportRes::LoadString | ( | HINSTANCE | hModule,
 |  | const TCHAR * | szType,
 |  | TCHAR * | szString
 | ) |  |

Definition at line 2926 of file msiloc.cpp.

{
  PMSIHANDLE hViewStrId = 0;
  PMSIHANDLE hRecStrId = 0;
  UINT iStat;
  if (ERROR_SUCCESS != (iStat = MsiDatabaseOpenView(m_hDatabase, sqlStringInstallerName, &hViewStrId)))
  {
    _tprintf(TEXT("LOG_ERROR>> _RESStrings table is missing from database.\n"));
    return m_fError = TRUE, FALSE;
  }

  int iFirst = (int(szStringName) - 1) * 16;
  TCHAR rgchBuffer[512] = {0}; // 512 should be large enough for any string in resource file
  DWORD cchBuffer = sizeof(rgchBuffer)/sizeof(TCHAR);
  for (int i = 0; i < 16; i++)
  {
    int cchWritten = ::LoadString(hModule, iFirst + i, rgchBuffer, cchBuffer);
    if (cchWritten == 0)
      continue; // null string

    if (_tcscmp(rgchBuffer, strOverLimit) == 0)
      continue; // string greater than limit, leave alone

    // use id of string to find table, column, and row it belongs to
    PMSIHANDLE hRecExec = MsiCreateRecord(1);
    if (ERROR_SUCCESS != (iStat = MsiRecordSetInteger(hRecExec, 1, iFirst + i))
      || ERROR_SUCCESS != (iStat = MsiViewExecute(hViewStrId, hRecExec))
      || ERROR_SUCCESS != (iStat = MsiViewFetch(hViewStrId, &hRecStrId)))
      return m_fError = TRUE, FALSE;

    // we now have the table and column and row
    // want to SELECT `column` from `table` WHERE row matches
    DWORD cchLen = 0;
    if (ERROR_MORE_DATA != MsiRecordGetString(hRecStrId, 1, TEXT(""), &cchLen))
      return m_fError = TRUE, FALSE;
    TCHAR* szTable = new TCHAR[++cchLen];
    if ( !szTable )
      return m_fError = TRUE, FALSE; // ERROR_OUTOFMEMORY
    if (ERROR_SUCCESS != MsiRecordGetString(hRecStrId, 1, szTable, &cchLen))
    {
      delete [] szTable;
      return m_fError = TRUE, FALSE;
    }

    cchLen = 0;
    if (ERROR_MORE_DATA != MsiRecordGetString(hRecStrId, 2, TEXT(""), &cchLen))
    {
      delete [] szTable;
      return m_fError = TRUE, FALSE;
    }
    TCHAR* szColumn = new TCHAR[++cchLen];
    if ( !szColumn )
    {
      delete [] szTable;
      return m_fError = TRUE, FALSE; // ERROR_OUTOFMEMORY
    }
    if (ERROR_SUCCESS != MsiRecordGetString(hRecStrId, 2, szColumn, &cchLen))
    {
      delete [] szTable;
      delete [] szColumn;
      return m_fError = TRUE, FALSE;
    }

    cchLen = 0;
    if (ERROR_MORE_DATA != MsiRecordGetString(hRecStrId, 3, TEXT(""), &cchLen))
    {
      delete [] szTable;
      delete [] szColumn;
      return m_fError = TRUE, FALSE;
    }
    TCHAR* szKey = new TCHAR[++cchLen];
    if ( !szKey )
    {
      delete [] szTable;
      delete [] szColumn;
      return m_fError = TRUE, FALSE;
    }
    if (ERROR_SUCCESS != MsiRecordGetString(hRecStrId, 3, szKey, &cchLen))
    {
      delete [] szTable;
      delete [] szColumn;
      delete [] szKey;
      return m_fError = TRUE, FALSE;
    }

    // need to determine how big to make WHERE clause, i.e. # of primary keys
    PMSIHANDLE hRecPrimaryKeys = 0;
    if (ERROR_SUCCESS != (iStat = MsiDatabaseGetPrimaryKeys(m_hDatabase, szTable, &hRecPrimaryKeys)))
    {
      delete [] szTable;
      delete [] szColumn;
      delete [] szKey;
      return m_fError = TRUE, FALSE;
    }
    int cKeys = MsiRecordGetFieldCount(hRecPrimaryKeys);

    // determine number of keys in "szKey" by counting # of ':'
    TCHAR* pch = szKey;
    int cKeyFromTable = 1;
    while (pch != 0 && *pch != '\0')
    {
      if (*pch++ == ':')
        cKeyFromTable++;
    }

    if (cKeyFromTable != cKeys)
    {
      delete [] szTable;
      delete [] szColumn;
      delete [] szKey;
      return m_fError = TRUE, FALSE;
    }

    int iKey;

    // determine length of Primary key column names
    DWORD cchColNames = 0;
    for (iKey = 1; iKey <= cKeys; iKey++)
    {
      DWORD cchTemp = 0;
      if (ERROR_MORE_DATA == MsiRecordGetString(hRecPrimaryKeys, iKey, TEXT(""), &cchTemp))
        cchColNames += cchTemp;
    }

    if (0 == cchColNames)
    {
      delete [] szTable;
      delete [] szColumn;
      delete [] szKey;
      return m_fError = TRUE, FALSE;
    }

    // sql query length is sqlStringImport + szColumn + szTable + WHERE clause
    //  where clause is ' AND ' + KeyColumn='KeyColumnValue' at max for each key
    DWORD cchStrSQL = _tcslen(sqlStringImport)
            + _tcslen(szColumn)
            + _tcslen(szTable)
            + cKeys*_tcslen(TEXT(" AND "))
            + cchColNames
            + cKeys*2 // for enclosing '' on string columns
            + _tcslen(szKey)
            + 1;
    TCHAR* szStrSQL = new TCHAR[cchStrSQL];
    if ( !szStrSQL )
    {
      delete [] szTable;
      delete [] szColumn;
      delete [] szKey;
      return m_fError = TRUE, FALSE;
    }
    if (FAILED(StringCchPrintf(szStrSQL, cchStrSQL, sqlStringImport, szColumn, szTable)))
    {
      delete [] szTable;
      delete [] szColumn;
      delete [] szKey;
      delete [] szStrSQL;
      return m_fError = TRUE, FALSE;
    }

    // need to get column types
    TCHAR sqlTemp[255] = {0};
    if (FAILED(StringCchPrintf(sqlTemp, sizeof(sqlTemp)/sizeof(sqlTemp[0]), sqlStrTemp, szTable)))
    {
      delete [] szTable;
      delete [] szColumn;
      delete [] szKey;
      delete [] szStrSQL;
      return m_fError = TRUE, FALSE;
    }

    PMSIHANDLE hViewTemp = 0;
    if (ERROR_SUCCESS != (iStat = MsiDatabaseOpenView(m_hDatabase, sqlTemp, &hViewTemp))
      || ERROR_SUCCESS != MsiViewExecute(hViewTemp, 0))
    {
      delete [] szTable;
      delete [] szColumn;
      delete [] szKey;
      delete [] szStrSQL;
      return m_fError = TRUE, FALSE;
    }
    PMSIHANDLE hRecColInfo = 0;
    if (ERROR_SUCCESS != (iStat = MsiViewGetColumnInfo(hViewTemp, MSICOLINFO_TYPES, &hRecColInfo)))
    {
      delete [] szTable;
      delete [] szColumn;
      delete [] szKey;
      delete [] szStrSQL;
      return m_fError = TRUE, FALSE;
    }

    // for each primary key, add to WHERE clause
    TCHAR szColType[10] = {0};
    DWORD cchColType = sizeof(szColType)/sizeof(TCHAR);
    for (iKey = 1; iKey <= cKeys; iKey++)
    {
      DWORD cchKey = 0;
      if (ERROR_MORE_DATA != MsiRecordGetString(hRecPrimaryKeys, iKey, TEXT(""), &cchKey))
      {
        delete [] szTable;
        delete [] szColumn;
        delete [] szKey;
        delete [] szStrSQL;
        return m_fError = TRUE, FALSE;
      }
      TCHAR* szPrimaryKeyCol = new TCHAR[++cchKey];
      if ( !szPrimaryKeyCol )
      {
        delete [] szTable;
        delete [] szColumn;
        delete [] szKey;
        delete [] szStrSQL;
        return m_fError = TRUE, FALSE; // ERROR_OUTOFMEMORY
      }
      if (ERROR_SUCCESS != (iStat = MsiRecordGetString(hRecPrimaryKeys, iKey, szPrimaryKeyCol, &cchKey)))
      {
        delete [] szTable;
        delete [] szColumn;
        delete [] szKey;
        delete [] szStrSQL;
        delete [] szPrimaryKeyCol;
        return m_fError = TRUE, FALSE;
      }

      if (ERROR_SUCCESS != (iStat = MsiRecordGetString(hRecColInfo, iKey, szColType, &cchColType)))
      {
        delete [] szTable;
        delete [] szColumn;
        delete [] szKey;
        delete [] szStrSQL;
        delete [] szPrimaryKeyCol;
        return m_fError = TRUE, FALSE;
      }

      cchColType = sizeof(szColType)/sizeof(TCHAR); // reset

      TCHAR* szKeyValue = NULL;
      if (iKey == 1)
        szKeyValue = _tcstok(szKey, szTokenSeps);
      else
        szKeyValue = _tcstok(NULL, szTokenSeps);

      if ( !szKeyValue )
      {
        delete [] szTable;
        delete [] szColumn;
        delete [] szKey;
        delete [] szStrSQL;
        delete [] szPrimaryKeyCol;
        return m_fError = TRUE, FALSE;
      }

      if (iKey != 1)
      {
        if (FAILED(StringCchCat(szStrSQL, cchStrSQL, TEXT(" AND "))))
        {
          delete [] szTable;
          delete [] szColumn;
          delete [] szKey;
          delete [] szStrSQL;
          delete [] szPrimaryKeyCol;
          return m_fError = TRUE, FALSE;
        }
      }

      if (FAILED(StringCchCat(szStrSQL, cchStrSQL, szPrimaryKeyCol)))
      {
        delete [] szTable;
        delete [] szColumn;
        delete [] szKey;
        delete [] szStrSQL;
        delete [] szPrimaryKeyCol;
        return m_fError = TRUE, FALSE;
      }

      if ((*szColType | 0x20) == 'i') // integer
      {
        if (FAILED(StringCchCat(szStrSQL, cchStrSQL, TEXT("=")))
          || FAILED(StringCchCat(szStrSQL, cchStrSQL, szKeyValue)))
        {
          delete [] szTable;
          delete [] szColumn;
          delete [] szKey;
          delete [] szStrSQL;
          delete [] szPrimaryKeyCol;
          return m_fError = TRUE, FALSE;
        }
      }
      else if ((*szColType | 0x20) == 's' || (*szColType | 0x20) == 'l')
      {
        // string constants must be enclosed in 'str'
        if (FAILED(StringCchCat(szStrSQL, cchStrSQL, TEXT("='")))
          || FAILED(StringCchCat(szStrSQL, cchStrSQL, szKeyValue))
          || FAILED(StringCchCat(szStrSQL, cchStrSQL, TEXT("'"))))
        {
          delete [] szTable;
          delete [] szColumn;
          delete [] szKey;
          delete [] szStrSQL;
          delete [] szPrimaryKeyCol;
          return m_fError = TRUE, FALSE;
        }
      }
      else
      {
        assert(0); // unexpected column type
        delete [] szTable;
        delete [] szColumn;
        delete [] szKey;
        delete [] szStrSQL;
        delete [] szPrimaryKeyCol;
        return m_fError = TRUE, FALSE;
      }
      delete [] szPrimaryKeyCol;
    }

    // now grab row from table
    PMSIHANDLE hViewRow = 0;
    PMSIHANDLE hRecRow = 0;
    if (ERROR_SUCCESS != (iStat = MsiDatabaseOpenView(m_hDatabase, szStrSQL, &hViewRow))
      || ERROR_SUCCESS != (iStat = MsiViewExecute(hViewRow, 0))
      || ERROR_SUCCESS != (iStat = MsiViewFetch(hViewRow, &hRecRow))
      || ERROR_SUCCESS != (iStat = MsiRecordSetString(hRecRow, 1, rgchBuffer))
      || ERROR_SUCCESS != (iStat = MsiViewModify(hViewRow, MSIMODIFY_UPDATE, hRecRow)))
    {
      _tprintf(TEXT("LOG_ERROR>> ROW: %s is Missing From Table: %s\n"), szKey, szTable);
      delete [] szTable;
      delete [] szColumn;
      delete [] szKey;
      delete [] szStrSQL;
      return m_fError = TRUE, FALSE;
    }

    // clean-up
    delete [] szStrSQL;
    delete [] szTable;
    delete [] szColumn;
    delete [] szKey;
  }//For block of 16 string table strings

  return TRUE;
}

BOOL CImportRes::SetCodePage ( WORD wLang )

Definition at line 3755 of file msiloc.cpp.

{
  // if we have already set the codepage, we don't need to do it again
  if (m_fSetCodepage)
    return TRUE;

  DWORD dwLocale = MAKELCID(wLang, SORT_DEFAULT);
  TCHAR szLocaleBuf[7]; // from MSDN, max # char allowed is 6
  int cch = GetLocaleInfo(dwLocale, LOCALE_IDEFAULTANSICODEPAGE, szLocaleBuf, sizeof(szLocaleBuf)/sizeof(TCHAR));
  if (0 == cch)
    return m_fError = TRUE, FALSE;

  // GetLocaleInfo always returns information in text format
  // Numeric data is written in decimal format
  // Expect numeric data because ask for CodePage...need to convert to int
  TCHAR* szStop;
  g_uiCodePage = _tcstoul(szLocaleBuf, &szStop, 0);

  //verify database's codepage
  // database's codepage must either be language NEUTRAL or match g_uiCodepage
  if (ERROR_SUCCESS != VerifyDatabaseCodepage())
    return m_fError = TRUE, FALSE;

  // verify codepage is available on system
  // A code page is considered valid only if it is installed in the system.
  if (!IsValidCodePage(g_uiCodePage))
    return m_fError = TRUE, FALSE; // codepage not valid for this system

  // set codepage in database using _ForceCodepage table
  // find temp directory
  TCHAR szTempPath[MAX_PATH+1] = {0};
  DWORD cchRet = GetTempPath(sizeof(szTempPath)/sizeof(szTempPath[0]), szTempPath);
  if (0 == cchRet || cchRet > sizeof(szTempPath)/sizeof(szTempPath[0]))
    return m_fError = TRUE, FALSE;

  // create full path (TEMP directory already has backslash)
  DWORD cchFileFullPath = _tcslen(szTempPath) + _tcslen(szCodepageFile) + 1;
  TCHAR* szFileFullPath = new TCHAR[cchFileFullPath];
  if ( !szFileFullPath )
    return m_fError = TRUE, FALSE;
  if (FAILED(StringCchPrintf(szFileFullPath, cchFileFullPath, TEXT("%s%s"), szTempPath, szCodepageFile)))
  {
    delete [] szFileFullPath;
    return m_fError = TRUE, FALSE;
  }
  DWORD dwWritten = 0;
  HANDLE hFile = CreateFile(szFileFullPath, GENERIC_WRITE, FILE_SHARE_WRITE, 0, CREATE_ALWAYS, 0, 0);
  if (!hFile)
  {
    _tprintf(TEXT("!! Unable to set codepage of database.\n"));
    delete [] szFileFullPath;
    return m_fError = TRUE, FALSE;
  }

  /*********************************
   FORMAT FOR FORCING CODEPAGE
  **********************************/
  // blank line
  // blank line
  // codepage<tab>_ForceCodepage
  DWORD cchCodepage = _tcslen(szLocaleBuf) + _tcslen(szForceCodepage) + _tcslen(TEXT("\r\n\r\n%s\t%s\r\n")) + 1;
  TCHAR* szCodepage = new TCHAR[cchCodepage];
  if ( !szCodepage )
  {
    delete [] szFileFullPath;
    return m_fError = TRUE, FALSE;
  }

  if (FAILED(StringCchPrintf(szCodepage, cchCodepage, TEXT("\r\n\r\n%s\t%s\r\n"), szLocaleBuf, szForceCodepage)))
  {
    delete [] szFileFullPath;
    delete [] szCodepage;
    return m_fError = TRUE, FALSE;
  }

#ifdef UNICODE
  int cchAnsi = WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK, szCodepage, -1, NULL, 0, NULL, NULL);
  char* szBuf = new char[cchAnsi];
  if ( !szBuf )
  {
    delete [] szFileFullPath;
    delete [] szCodepage;
    return m_fError = TRUE, FALSE;
  }
  if (0 == WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK, szCodepage, -1, szBuf, cchAnsi, NULL, NULL))
  {
    delete [] szFileFullPath;
    delete [] szCodepage;
    delete [] szBuf;
    return m_fError = TRUE, FALSE;
  }
  if (!WriteFile(hFile, szBuf, strlen(szBuf), &dwWritten, 0))
  {
    delete [] szFileFullPath;
    delete [] szCodepage;
    delete [] szBuf;
    return m_fError = TRUE, FALSE;
  }
  delete [] szBuf;
#else
  if (!WriteFile(hFile, szCodepage, cchCodepage-1, &dwWritten, 0))
  {
    delete [] szFileFullPath;
    delete [] szCodepage;
    return m_fError = TRUE, FALSE;
  }
#endif

  delete [] szCodepage;

  if (!CloseHandle(hFile))
  {
    delete [] szFileFullPath;
    return m_fError = TRUE, FALSE;
  }

  // set codepage of database
  UINT iStat = MsiDatabaseImport(m_hDatabase, szTempPath, szCodepageFile);
  if (iStat != ERROR_SUCCESS)
  {
    _tprintf(TEXT("!! Unable to set codepage of database. Error = %d\n"), iStat);
    delete [] szFileFullPath;
    return m_fError = TRUE, FALSE;
  }

  // attempt to delete the file we created for clean-up
  DeleteFile(szFileFullPath);

  delete [] szFileFullPath;

  // update status flage
  m_fSetCodepage = TRUE;

  return TRUE;
}

void CImportRes::SetErrorState ( BOOL fState ) [inline]

Definition at line 302 of file msiloc.cpp.

{ m_fError = fState; }

void CImportRes::SetFoundLang ( BOOL fValue ) [inline]

Definition at line 299 of file msiloc.cpp.

{ m_fFoundLang = fValue; }

UINT CImportRes::VerifyDatabaseCodepage ( ) [private]

Definition at line 2676 of file msiloc.cpp.

{
  UINT iStat;
  // only output from language neutral database
  TCHAR szTempPath[MAX_PATH+1] = {0};
  DWORD cchRet = GetTempPath(sizeof(szTempPath)/sizeof(szTempPath[0]), szTempPath);
  if (0 == cchRet || cchRet > sizeof(szTempPath)/sizeof(szTempPath[0]))
    return m_fError = TRUE, ERROR_FUNCTION_FAILED;

  // export _ForceCodepage table so can verify codepage
  if (ERROR_SUCCESS != (iStat = MsiDatabaseExport(m_hDatabase, TEXT("_ForceCodepage"), szTempPath, szCodepageExport)))
  {
    _tprintf(TEXT("LOG_ERROR>> MsiDatabaseExport(_ForceCodepage)\n"));
    return m_fError = TRUE, iStat; // error - ABORT
  }
  // open _ForceCodepage.idt to read it
  DWORD cchFullPath = _tcslen(szTempPath) + _tcslen(szCodepageExport) + 1;
  TCHAR* szFullPath = new TCHAR[cchFullPath];
  if ( !szFullPath )
    return m_fError = TRUE, ERROR_OUTOFMEMORY;

  if (FAILED(StringCchPrintf(szFullPath, cchFullPath, TEXT("%s%s"), szTempPath, szCodepageExport)))
  {
    delete [] szFullPath;
    return m_fError = TRUE, ERROR_FUNCTION_FAILED;
  }
  HANDLE hFile = CreateFile(szFullPath, GENERIC_READ, FILE_SHARE_READ, (LPSECURITY_ATTRIBUTES)0, OPEN_EXISTING, FILE_FLAG_DELETE_ON_CLOSE, 0);
  if (hFile == NULL)
  {
    _tprintf(TEXT("LOG_ERROR>> OpenFile(_ForceCodepage.idt)\n"));
    delete [] szFullPath;
    return m_fError = TRUE, iStat; // error - ABORT
  }

  delete [] szFullPath;
  szFullPath = NULL;

  // read file for information
  DWORD dwSize = GetFileSize(hFile, NULL);
  if (0xFFFFFFFF == dwSize)
  {
    CloseHandle(hFile);
    return m_fError = TRUE, ERROR_FUNCTION_FAILED; // error - ABORT
  }

  char* szBuf = new char[dwSize+1];
  if ( !szBuf )
  {
    CloseHandle(hFile);
    return m_fError = TRUE, ERROR_OUTOFMEMORY;
  }

  DWORD dwRead = 0;
  if (!ReadFile(hFile, (LPVOID)szBuf, dwSize, &dwRead, NULL)
    || 0 == dwRead)
  {
    delete [] szBuf;
    CloseHandle(hFile);
    return m_fError = TRUE, ERROR_FUNCTION_FAILED; // error - ABORT
  }
  // parse buffer
  // format should be : blank line, blank line, "codepage<tab>_ForceCodepage"
  char* pch = szBuf;
  int cBlankLines = 0;
  while (dwRead && cBlankLines != 2)
  {
    if (*pch == '\n')
      cBlankLines++;
    pch++;
    dwRead--;
  }
  if (!dwRead || cBlankLines != 2)
  {
    _tprintf(TEXT("LOG_ERROR>> Invalid ForceCodepage idt format\n"));
    delete [] szBuf;
    CloseHandle(hFile);
    return m_fError = TRUE, ERROR_FUNCTION_FAILED;
  }
  // codepage is next
  char* pchCodepage = pch;
  while (dwRead && *pch != ' ' && *pch != '\t')
  {
    pch++;
    dwRead--;
  }
  assert(dwRead);
  *pch = '\0';
  // convert codepage to int
  UINT uiCodepage = strtoul(pchCodepage, NULL, 10);
  delete [] szBuf;
  szBuf = NULL;
  if (uiCodepage != 0 && uiCodepage != g_uiCodePage) // 0 is language neutral
  {
    _tprintf(TEXT("LOG_ERROR>> DATABASE IS NOT LANGUAGE NEUTRAL OR OF SAME CODEPAGE AS RESOURCE STRINGS. CANNOT IMPORT\n"));
    _tprintf(TEXT("LOG_ERROR>> DATABASE CODEPAGE= %d\n"), uiCodepage);
    CloseHandle(hFile);
    return m_fError = TRUE, ERROR_FUNCTION_FAILED; // error - ABORT
  }
  if (!CloseHandle(hFile))
    return m_fError = TRUE, ERROR_FUNCTION_FAILED; // error - ABORT

  return ERROR_SUCCESS;
}

BOOL CImportRes::WasLanguagePreviouslyFound ( ) [inline]

Definition at line 298 of file msiloc.cpp.

{return m_fFoundLang;}

Member Data Documentation

BOOL CImportRes::m_fError [private]

Definition at line 316 of file msiloc.cpp.

BOOL CImportRes::m_fFoundLang [private]

Definition at line 319 of file msiloc.cpp.

BOOL CImportRes::m_fSetCodepage [private]

Definition at line 318 of file msiloc.cpp.

MSIHANDLE CImportRes::m_hControl [private]

Definition at line 313 of file msiloc.cpp.

MSIHANDLE CImportRes::m_hDatabase [private]

Definition at line 312 of file msiloc.cpp.

MSIHANDLE CImportRes::m_hDialog [private]

Definition at line 314 of file msiloc.cpp.

HINSTANCE CImportRes::m_hInst [private]

Definition at line 317 of file msiloc.cpp.

MSIHANDLE CImportRes::m_hRadioButton [private]

Definition at line 315 of file msiloc.cpp.

const TCHAR* CImportRes::m_szDatabase [private]

Definition at line 310 of file msiloc.cpp.

const TCHAR* CImportRes::m_szDLLFile [private]

Definition at line 311 of file msiloc.cpp.

const TCHAR* CImportRes::m_szOrigDb [private]

Definition at line 309 of file msiloc.cpp.

The documentation for this class was generated from the following file:
  • SysMgmt/Msi/msiloc/msiloc.cpp
Generated on Wed Nov 13 2024 16:56:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CInitStringBox Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CInitStringBox Class Reference

#include "cdialog.h"

Inherits CRichEditLite.

List of all members.

Public Member Functions

virtual BOOL OnKeyDown (WPARAM nVirtKey, LPARAM lKeyData)

Detailed Description

Definition at line 502 of file cdialog.h.

Member Function Documentation

virtual BOOL CInitStringBox::OnKeyDown | ( | WPARAM | nVirtKey,
 |  | LPARAM | lKeyData |
 | ) |  |  | [inline, virtual]

Definition at line 508 of file cdialog.h.

  {
    switch(nVirtKey)
    {
      case VK_TAB:
      case VK_DOWN:
      {
        MSG msg;
        PeekMessage(&msg, NULL, 0, 0, PM_REMOVE);
        SendMessage(m_hWndParent, WM_COMMAND, GET_WM_COMMAND_MPS(IDB_BROWSE_PROVIDER, m_hWndParent, 0));
        return TRUE;
      }

      default:
        break;
    };

    return FALSE;
  }

The documentation for this class was generated from the following file:
  • Dataaccess/oledb/rowsetviewer/cdialog.h
Generated on Wed Nov 13 2024 16:56:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CInkInputWnd Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CInkInputWnd Class Reference

#include "ChildWnds.h"

List of all members.

Public Member Functions

CInkInputWnd ()
CInkInputWnd ()
LRESULT | OnPaint (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
LRESULT | OnPaint (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
void | SetGuide (const _InkRecoGuide &irg)
void | SetGuide (const _InkRecoGuide &irg)
void | SetRowsCols (int iRows, int iColumns)
void | SetRowsCols (int iRows, int iColumns)

Private Attributes

int | m_cColumns
int | m_cRows
int | m_iMidline
POINT | m_ptGridLT
RECT | m_rcDrawnBox
SIZE | m_szWritingBox

Detailed Description

Definition at line 34 of file ChildWnds.h.

Constructor & Destructor Documentation

CInkInputWnd::CInkInputWnd ( )

Definition at line 56 of file ChildWnds.cpp.

                           : m_cRows(0), m_cColumns(0), m_iMidline(-1)
{
    m_ptGridLT.x = m_ptGridLT.y = 0;
    m_szWritingBox.cx = m_szWritingBox.cy = 0;
    ::SetRectEmpty(&m_rcDrawnBox);
}

CInkInputWnd::CInkInputWnd ( )

Member Function Documentation

LRESULT CInkInputWnd::OnPaint | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 143 of file ChildWnds.cpp.

{
    RECT rcClip;
    if (FALSE == GetUpdateRect(&rcClip))
        return 0;   // there's no update region, so no painting is needed

    PAINTSTRUCT ps;
    HDC hdc = BeginPaint(&ps);
    if (hdc == NULL)
        return 0;

    // Get the rectangle to paint.
    GetClipBox(hdc, &rcClip);

    // Paint the background.
    ::FillRect(hdc, &rcClip, (HBRUSH)::GetStockObject(DC_BRUSH));

    // Calculate the grid rectangle. Assume that if there are any guides,
    // they are either boxes or horizontal lines.
    RECT rcGrid = {m_ptGridLT.x, m_ptGridLT.y, 0,
                   m_ptGridLT.y + m_szWritingBox.cy * m_cRows};
    if (0 == m_cColumns && 0 != m_cRows)
    {
        rcGrid.right = rcClip.right;
    }
    else
    {
        rcGrid.right = m_ptGridLT.x + m_szWritingBox.cx * m_cColumns;
    }

    // Draw the guide grid, if it's visible and not empty.
    RECT rcVisible;
    if (FALSE == ::IsRectEmpty(&rcGrid)
         && TRUE == ::IntersectRect(&rcVisible, &rcGrid, &rcClip))
    {

        // Create a thin lightgray pen to draw the guides.
        HPEN hPen = ::CreatePen(PS_SOLID, 1, RGB(192, 192, 192));
        HGDIOBJ hOldPen = ::SelectObject(hdc, hPen);

        if (0 == m_cColumns)
        {
             // Draw horizontal lines at the bottom side of the guide's DrawnBox
            int iY = rcClip.top - ((rcClip.top - m_ptGridLT.y) % m_szWritingBox.cy) + m_rcDrawnBox.bottom;
            for (int iRow = (rcClip.top - m_ptGridLT.y) / m_szWritingBox.cy;
                 (iRow < m_cRows) && (iY < rcClip.bottom);
                 iRow++, iY += m_szWritingBox.cy)
            {
                ::MoveToEx(hdc, rcClip.left, iY, NULL);
                ::LineTo(hdc, rcClip.right, iY);
            }
        }
        else
        {
            // Draw boxes
            int iY = rcClip.top - ((rcClip.top - m_ptGridLT.y) % m_szWritingBox.cy);
            for (int iRow = (rcClip.top - m_ptGridLT.y) / m_szWritingBox.cy;
                 (iRow < m_cRows) && (iY < rcClip.bottom);
                 iRow++, iY += m_szWritingBox.cy)
            {
                int iX = rcClip.left - ((rcClip.left - m_ptGridLT.x) % m_szWritingBox.cx);
                RECT rcBox = m_rcDrawnBox;
                ::OffsetRect(&rcBox, iX, iY);
                for (int iCol = (rcClip.left - m_ptGridLT.x) / m_szWritingBox.cx;
                     (iCol < m_cColumns) && (rcBox.left < rcClip.right);
                     iCol++)
                {
                    ::Rectangle(hdc, rcBox.left, rcBox.top, rcBox.right, rcBox.bottom);
                    ::OffsetRect(&rcBox, m_szWritingBox.cx, 0);
                }
            }
        }

        // Restore the dc and delete the pen
        ::SelectObject(hdc, hOldPen);
        ::DeleteObject(hPen);
    }

    EndPaint(&ps);
    return 0;
}

LRESULT CInkInputWnd::OnPaint | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL & | bHandled
 | ) |  |
void CInkInputWnd::SetGuide ( const _InkRecoGuide & irg )
void CInkInputWnd::SetGuide ( const _InkRecoGuide & irg )

Definition at line 79 of file ChildWnds.cpp.

{
    // Initialize the data members with values from the recognition guide structure
    m_ptGridLT.x = irg.rectWritingBox.left;
    m_ptGridLT.y = irg.rectWritingBox.top;
    m_szWritingBox.cx = irg.rectWritingBox.right - irg.rectWritingBox.left;
    m_szWritingBox.cy = irg.rectWritingBox.bottom - irg.rectWritingBox.top;
    m_rcDrawnBox = irg.rectDrawnBox;
    m_iMidline = irg.midline;
    m_cRows = irg.cRows;
    m_cColumns = irg.cColumns;

    // Update the window
    if (IsWindow())
    {
        Invalidate();
    }
}

void CInkInputWnd::SetRowsCols | ( | int | iRows,
 |  | int | iColumns
 | ) |  |

Definition at line 113 of file ChildWnds.cpp.

{
    m_cRows = iRows;
    m_cColumns = iColumns;

    // Update the window
    if (IsWindow())
    {
        Invalidate();
    }
}

void CInkInputWnd::SetRowsCols | ( | int | iRows,
 |  | int | iColumns
 | ) |  |

Member Data Documentation

int CInkInputWnd::m_cColumns [private]

Definition at line 42 of file ChildWnds.h.

int CInkInputWnd::m_cRows [private]

Definition at line 41 of file ChildWnds.h.

int CInkInputWnd::m_iMidline [private]

Definition at line 43 of file ChildWnds.h.

POINT CInkInputWnd::m_ptGridLT [private]

Definition at line 38 of file ChildWnds.h.

RECT CInkInputWnd::m_rcDrawnBox [private]

Definition at line 40 of file ChildWnds.h.

SIZE CInkInputWnd::m_szWritingBox [private]

Definition at line 39 of file ChildWnds.h.

The documentation for this class was generated from the following files:
  • TabletPC/AdvReco/ChildWnds.h
  • TabletPC/MultiReco/ChildWnds.h
  • TabletPC/AdvReco/ChildWnds.cpp
  • TabletPC/MultiReco/ChildWnds.cpp
Generated on Wed Nov 13 2024 16:56:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CInputTag Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CInputTag Class Reference

#include "InputTag.Hxx"

Inherits CHtmlElement.

List of all members.

Public Member Functions

CInputTag (CHtmlIFilter &htmlIFilter, CSerialStream &serialStream)
virtual SCODE | GetChunk (STAT_CHUNK *pStat)
virtual SCODE | GetText (ULONG *pcwcOutput, WCHAR *awcBuffer)
virtual void | InitStatChunk (STAT_CHUNK *pStat)

Private Attributes

unsigned | _cValueChars
unsigned | _cValueCharsFiltered
WCHAR * | _pwcValueBuf

Detailed Description

Definition at line 25 of file InputTag.Hxx.

Constructor & Destructor Documentation

CInputTag::CInputTag | ( | CHtmlIFilter & | htmlIFilter,
 |  | CSerialStream & | serialStream
 | ) |  |

Definition at line 31 of file InputTag.Cxx.

    : CHtmlElement(htmlIFilter, serialStream),
      _pwcValueBuf(0),
      _cValueChars(0),
      _cValueCharsFiltered(0)
{
}

Member Function Documentation

SCODE CInputTag::GetChunk ( STAT_CHUNK * pStat ) [virtual]

Implements CHtmlElement.

Definition at line 52 of file InputTag.Cxx.

{
    SCODE sc = SwitchToNextHtmlElement( pStat );

    return sc;
}

SCODE CInputTag::GetText | ( | ULONG * | pcwcOutput,
 |  | WCHAR * | awcBuffer |
 | ) |  |  | [virtual]

Implements CHtmlElement.

Definition at line 72 of file InputTag.Cxx.

{
    ULONG cCharsRemaining = _cValueChars - _cValueCharsFiltered;

    if ( cCharsRemaining == 0 )
    {
        *pcwcOutput = 0;
        return FILTER_E_NO_MORE_TEXT;
    }

    if ( *pcwcOutput < cCharsRemaining )
    {
        RtlCopyMemory( awcBuffer,
                       _pwcValueBuf + _cValueCharsFiltered,
                       *pcwcOutput * sizeof(WCHAR) );
        _cValueCharsFiltered += *pcwcOutput;

        return S_OK;
    }
    else
    {
        RtlCopyMemory( awcBuffer,
                       _pwcValueBuf + _cValueCharsFiltered,
                       cCharsRemaining * sizeof(WCHAR) );
        _cValueCharsFiltered += cCharsRemaining;
        *pcwcOutput = cCharsRemaining;

        return FILTER_S_LAST_TEXT;
    }
}

void CInputTag::InitStatChunk ( STAT_CHUNK * pStat ) [virtual]

Implements CHtmlElement.

Definition at line 115 of file InputTag.Cxx.

{
    _cValueCharsFiltered = 0;

    pStat->idChunk = _htmlIFilter.GetNextChunkId();
    pStat->flags = CHUNK_TEXT;
    pStat->locale = _htmlIFilter.GetLocale();
    pStat->attribute.guidPropSet = CLSID_Storage;
    pStat->attribute.psProperty.ulKind = PRSPEC_PROPID;
    pStat->attribute.psProperty.propid = PID_STG_CONTENTS;
    pStat->breakType = CHUNK_EOS;
    pStat->idChunkSource = pStat->idChunk;
    pStat->cwcStartSource = 0;
    pStat->cwcLenSource = 0;

    _scanner.ReadTagIntoBuffer();

    //
    // Check input type
    //
    WCHAR *pwcType;
    unsigned cwcType;
    _scanner.ScanTagBuffer( L"type=\"", pwcType, cwcType );

    if ( cwcType == 6           // 6 == wcslen( L"hidden" )
         && _wcsnicmp( pwcType, L"hidden", 6 ) == 0 )
    {
        //
        // Input is hidden, so don't output value field
        //
        _pwcValueBuf = 0;
        _cValueChars = 0;

        return;
    }

    //
    // Read the value field
    //
    _scanner.ScanTagBuffer( L"value=\"", _pwcValueBuf, _cValueChars );
}

Member Data Documentation

unsigned CInputTag::_cValueChars [private]

Definition at line 38 of file InputTag.Hxx.

unsigned CInputTag::_cValueCharsFiltered [private]

Definition at line 39 of file InputTag.Hxx.

WCHAR* CInputTag::_pwcValueBuf [private]

Definition at line 37 of file InputTag.Hxx.

The documentation for this class was generated from the following files:
  • WinBase/Indexing/IFilter/InputTag.Hxx
  • WinBase/Indexing/IFilter/InputTag.Cxx
Generated on Wed Nov 13 2024 16:56:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CInstanceSub Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CInstanceSub Class Reference

#include "instancesub.h"

Inherits CSysLCESub.

List of all members.

Public Member Functions

CInstanceSub (CComSpy *pSpy)
CInstanceSub ()
STDMETHODIMP | GetEventClass (LPGUID guid)
STDMETHODIMP | GetEventType (EventEnum *e)
STDMETHODIMP | GetInterface (IID *iid)
STDMETHODIMP | OnObjectCreate (COMSVCSEVENTINFO *pInfo, REFGUID guidActivity, REFCLSID clsid, REFGUID tsid, ULONG64 CtxtID, ULONG64 ObjectID)
STDMETHODIMP | OnObjectDestroy (COMSVCSEVENTINFO *pInfo, ULONG64 CtxtID)

Detailed Description

Definition at line 30 of file instancesub.h.

Constructor & Destructor Documentation

CInstanceSub::CInstanceSub ( CComSpy * pSpy ) [inline]

Definition at line 35 of file instancesub.h.

  {
    m_pSpy = pSpy;
  }

CInstanceSub::CInstanceSub ( ) [inline]

Definition at line 40 of file instancesub.h.

  {
    m_pSpy = NULL;
  }

Member Function Documentation

STDMETHODIMP CInstanceSub::GetEventClass ( LPGUID guid ) [inline, virtual]

Implements CSysLCESub.

Definition at line 54 of file instancesub.h.

{*guid = CLSID_ComServiceEvents;return S_OK;}

STDMETHODIMP CInstanceSub::GetEventType ( EventEnum * e ) [inline, virtual]

Implements CSysLCESub.

Definition at line 53 of file instancesub.h.

{*e = Instance;return S_OK;}

STDMETHODIMP CInstanceSub::GetInterface ( IID * iid ) [inline, virtual]

Implements CSysLCESub.

Definition at line 55 of file instancesub.h.

{*iid = IID_IComInstanceEvents;return S_OK;}

STDMETHODIMP CInstanceSub::OnObjectCreate | ( | COMSVCSEVENTINFO * | pInfo,
 |  | REFGUID | guidActivity,
 |  | REFCLSID | clsid,
 |  | REFGUID | tsid,
 |  | ULONG64 | CtxtID,
 |  | ULONG64 | ObjectID |
 | ) |  |  | [inline]

Definition at line 57 of file instancesub.h.

  {

    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnObjectCreate"), GuidToBstr(pInfo->guidApp));

    CComBSTR sGuidActivity = GuidToBstr(guidActivity);
    CComBSTR sClsid = GuidToBstr(clsid);
    CComBSTR sTsid = GuidToBstr(tsid);

    m_pSpy -> AddParamValueToList(L"guidActivity", sGuidActivity);
    m_pSpy -> AddParamValueToList(L"clsid", sClsid);
    m_pSpy -> AddParamValueToList(L"tsid", sTsid);

    WCHAR szCtxtID[32];
    wsprintfW(szCtxtID,L"0x%016X", CtxtID);
    m_pSpy -> AddParamValueToList(L"CtxtID", szCtxtID);

    WCHAR szObjectID[32];
    wsprintfW(szObjectID,L"0x%016X", ObjectID);
    m_pSpy -> AddParamValueToList(L"ObjectID", szObjectID);

    IF_AUDIT_DO(OnObjectCreate)(pInfo->perfCount, GuidToBstr(pInfo->guidApp),
                  sGuidActivity,
                  sClsid,
                  sTsid,
                  szCtxtID,
                  szObjectID);

    return S_OK;
  }

STDMETHODIMP CInstanceSub::OnObjectDestroy | ( | COMSVCSEVENTINFO * | pInfo,
 |  | ULONG64 | CtxtID |
 | ) |  |  | [inline]

Definition at line 90 of file instancesub.h.

  {
    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnObjectDestroy"),  GuidToBstr(pInfo->guidApp));

    WCHAR szCtxtID[32];
    wsprintfW(szCtxtID,L"0x%016X", CtxtID);
    m_pSpy -> AddParamValueToList(L"CtxtID", szCtxtID);

    IF_AUDIT_DO(OnObjectDestroy)(pInfo->perfCount,GuidToBstr(pInfo->guidApp),
                   szCtxtID);

    return S_OK;
  }

The documentation for this class was generated from the following file:
  • Com/Administration/Spy/ComSpyCtl/instancesub.h
Generated on Wed Nov 13 2024 16:56:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CInstPro Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CInstPro Class Reference

#include "Sample.h"

List of all members.

Public Member Functions

CInstPro (BSTR ObjectPath=NULL, BSTR User=NULL, BSTR Password=NULL, IWbemContext *pCtx=NULL)
~CInstPro (void)
HRESULT STDMETHODCALLTYPE | CancelAsyncCall (IWbemObjectSink __RPC_FAR *pSink)
HRESULT STDMETHODCALLTYPE | CreateClassEnum (const BSTR Superclass, long lFlags, IWbemContext __RPC_FAR *pCtx, IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum)
HRESULT STDMETHODCALLTYPE | CreateClassEnumAsync (const BSTR Superclass, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemObjectSink __RPC_FAR *pResponseHandler)
HRESULT STDMETHODCALLTYPE | CreateInstanceEnum (const BSTR Class, long lFlags, IWbemContext __RPC_FAR *pCtx, IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum)
HRESULT STDMETHODCALLTYPE | CreateInstanceEnumAsync (const BSTR Class, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemObjectSink __RPC_FAR *pResponseHandler)
HRESULT STDMETHODCALLTYPE | DeleteClass (const BSTR Class, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult)
HRESULT STDMETHODCALLTYPE | DeleteClassAsync (const BSTR Class, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemObjectSink __RPC_FAR *pResponseHandler)
HRESULT STDMETHODCALLTYPE | DeleteInstance (const BSTR ObjectPath, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult)
HRESULT STDMETHODCALLTYPE | DeleteInstanceAsync (const BSTR ObjectPath, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemObjectSink __RPC_FAR *pResponseHandler)
HRESULT STDMETHODCALLTYPE | ExecMethod (const BSTR, const BSTR, long, IWbemContext *, IWbemClassObject *, IWbemClassObject **, IWbemCallResult **)
HRESULT STDMETHODCALLTYPE | ExecMethodAsync (const BSTR, const BSTR, long, IWbemContext *, IWbemClassObject *, IWbemObjectSink *)
HRESULT STDMETHODCALLTYPE | ExecNotificationQuery (const BSTR QueryLanguage, const BSTR Query, long lFlags, IWbemContext __RPC_FAR *pCtx, IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum)
HRESULT STDMETHODCALLTYPE | ExecNotificationQueryAsync (const BSTR QueryLanguage, const BSTR Query, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemObjectSink __RPC_FAR *pResponseHandler)
HRESULT STDMETHODCALLTYPE | ExecQuery (const BSTR QueryLanguage, const BSTR Query, long lFlags, IWbemContext __RPC_FAR *pCtx, IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum)
HRESULT STDMETHODCALLTYPE | ExecQueryAsync (const BSTR QueryLanguage, const BSTR Query, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemObjectSink __RPC_FAR *pResponseHandler)
SCODE | GetByPath (BSTR Path, IWbemClassObject FAR *FAR *pObj, IWbemContext *pCtx)
HRESULT STDMETHODCALLTYPE | GetObject (const BSTR ObjectPath, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemClassObject __RPC_FAR *__RPC_FAR *ppObject, IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult)
HRESULT STDMETHODCALLTYPE | GetObjectAsync (const BSTR ObjectPath, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemObjectSink __RPC_FAR *pResponseHandler)
HRESULT STDMETHODCALLTYPE | Initialize (LPWSTR pszUser, LONG lFlags, LPWSTR pszNamespace, LPWSTR pszLocale, IWbemServices *pNamespace, IWbemContext *pCtx, IWbemProviderInitSink *pInitSink)
HRESULT STDMETHODCALLTYPE | OpenNamespace (const BSTR Namespace, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemServices __RPC_FAR *__RPC_FAR *ppWorkingNamespace, IWbemCallResult __RPC_FAR *__RPC_FAR *ppResult)
HRESULT STDMETHODCALLTYPE | PutClass (IWbemClassObject __RPC_FAR *pObject, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult)
HRESULT STDMETHODCALLTYPE | PutClassAsync (IWbemClassObject __RPC_FAR *pObject, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemObjectSink __RPC_FAR *pResponseHandler)
HRESULT STDMETHODCALLTYPE | PutInstance (IWbemClassObject __RPC_FAR *pInst, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult)
HRESULT STDMETHODCALLTYPE | PutInstanceAsync (IWbemClassObject __RPC_FAR *pInst, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemObjectSink __RPC_FAR *pResponseHandler)
STDMETHODIMP | QueryInterface (REFIID, PPVOID)
HRESULT STDMETHODCALLTYPE | QueryObjectSink (long lFlags, IWbemObjectSink __RPC_FAR *__RPC_FAR *ppResponseHandler)
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP_ (ULONG) Release(void)

Protected Attributes

ULONG m_cRef
IWbemServices * | m_pNamespace

Detailed Description

Definition at line 30 of file Sample.h.

Constructor & Destructor Documentation

CInstPro::CInstPro | ( | BSTR | ObjectPath = NULL,
 |  | BSTR | User = NULL,
 |  | BSTR | Password = NULL,
 |  | IWbemContext * | pCtx = NULL
 | ) |  |

Definition at line 42 of file InstProv.Cpp.

{
    m_pNamespace = NULL;
    m_cRef=0;
    InterlockedIncrement(&g_cObj);
    return;
}

CInstPro::~CInstPro ( void )

Definition at line 50 of file InstProv.Cpp.

{
    if(m_pNamespace)
        m_pNamespace->Release();
    InterlockedDecrement(&g_cObj);
    return;
}

Member Function Documentation

HRESULT STDMETHODCALLTYPE CInstPro::CancelAsyncCall ( IWbemObjectSink __RPC_FAR * pSink ) [inline]

Definition at line 68 of file Sample.h.

                                                         {return WBEM_E_NOT_SUPPORTED;};

HRESULT STDMETHODCALLTYPE CInstPro::CreateClassEnum | ( | const BSTR | Superclass,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IEnumWbemClassObject __RPC_FAR *__RPC_FAR * | ppEnum |
 | ) |  |  | [inline]

Definition at line 112 of file Sample.h.

                                                                           {return WBEM_E_NOT_SUPPORTED;};

HRESULT STDMETHODCALLTYPE CInstPro::CreateClassEnumAsync | ( | const BSTR | Superclass,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemObjectSink __RPC_FAR * | pResponseHandler |
 | ) |  |  | [inline]

Definition at line 118 of file Sample.h.

                                                                    {return WBEM_E_NOT_SUPPORTED;};

HRESULT STDMETHODCALLTYPE CInstPro::CreateInstanceEnum | ( | const BSTR | Class,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IEnumWbemClassObject __RPC_FAR *__RPC_FAR * | ppEnum |
 | ) |  |  | [inline]

Definition at line 148 of file Sample.h.

                                                                           {return WBEM_E_NOT_SUPPORTED;};

HRESULT STDMETHODCALLTYPE CInstPro::CreateInstanceEnumAsync | ( | const BSTR | Class,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemObjectSink __RPC_FAR * | pResponseHandler
 | ) |  |
HRESULT STDMETHODCALLTYPE CInstPro::DeleteClass | ( | const BSTR | Class,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemCallResult __RPC_FAR *__RPC_FAR * | ppCallResult |
 | ) |  |  | [inline]

Definition at line 100 of file Sample.h.

                                                                                {return WBEM_E_NOT_SUPPORTED;};

HRESULT STDMETHODCALLTYPE CInstPro::DeleteClassAsync | ( | const BSTR | Class,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemObjectSink __RPC_FAR * | pResponseHandler |
 | ) |  |  | [inline]

Definition at line 106 of file Sample.h.

                                                                    {return WBEM_E_NOT_SUPPORTED;};

HRESULT STDMETHODCALLTYPE CInstPro::DeleteInstance | ( | const BSTR | ObjectPath,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemCallResult __RPC_FAR *__RPC_FAR * | ppCallResult |
 | ) |  |  | [inline]

Definition at line 136 of file Sample.h.

                                                                                {return WBEM_E_NOT_SUPPORTED;};

HRESULT STDMETHODCALLTYPE CInstPro::DeleteInstanceAsync | ( | const BSTR | ObjectPath,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemObjectSink __RPC_FAR * | pResponseHandler |
 | ) |  |  | [inline]

Definition at line 142 of file Sample.h.

                                                                    {return WBEM_E_NOT_SUPPORTED;};

HRESULT STDMETHODCALLTYPE CInstPro::ExecMethod | ( | const | BSTR,
 |  | const | BSTR,
 |  | long | ,
 |  | IWbemContext * | ,
 |  | IWbemClassObject * | ,
 |  | IWbemClassObject ** | ,
 |  | IWbemCallResult ** |  |
 | ) |  |  | [inline]

Definition at line 188 of file Sample.h.

                                                                      {return WBEM_E_NOT_SUPPORTED;}

HRESULT STDMETHODCALLTYPE CInstPro::ExecMethodAsync | ( | const | BSTR,
 |  | const | BSTR,
 |  | long | ,
 |  | IWbemContext * | ,
 |  | IWbemClassObject * | ,
 |  | IWbemObjectSink * |  |
 | ) |  |  | [inline]

Definition at line 191 of file Sample.h.

                                                                {return WBEM_E_NOT_SUPPORTED;}

HRESULT STDMETHODCALLTYPE CInstPro::ExecNotificationQuery | ( | const BSTR | QueryLanguage,
 |  | const BSTR | Query,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IEnumWbemClassObject __RPC_FAR *__RPC_FAR * | ppEnum |
 | ) |  |  | [inline]

Definition at line 174 of file Sample.h.

                                                                           {return WBEM_E_NOT_SUPPORTED;};

HRESULT STDMETHODCALLTYPE CInstPro::ExecNotificationQueryAsync | ( | const BSTR | QueryLanguage,
 |  | const BSTR | Query,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemObjectSink __RPC_FAR * | pResponseHandler |
 | ) |  |  | [inline]

Definition at line 181 of file Sample.h.

                                                                    {return WBEM_E_NOT_SUPPORTED;};

HRESULT STDMETHODCALLTYPE CInstPro::ExecQuery | ( | const BSTR | QueryLanguage,
 |  | const BSTR | Query,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IEnumWbemClassObject __RPC_FAR *__RPC_FAR * | ppEnum |
 | ) |  |  | [inline]

Definition at line 160 of file Sample.h.

                                                                           {return WBEM_E_NOT_SUPPORTED;};

HRESULT STDMETHODCALLTYPE CInstPro::ExecQueryAsync | ( | const BSTR | QueryLanguage,
 |  | const BSTR | Query,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemObjectSink __RPC_FAR * | pResponseHandler |
 | ) |  |  | [inline]

Definition at line 167 of file Sample.h.

                                                                    {return WBEM_E_NOT_SUPPORTED;};

SCODE CInstPro::GetByPath | ( | BSTR | Path,
 |  | IWbemClassObject FAR *FAR * | pObj,
 |  | IWbemContext * | pCtx
 | ) |  |

Definition at line 271 of file InstProv.Cpp.

{
    SCODE sc = S_OK;

    int iCnt;

    // do a simple path parse.  The path will look something like
    // InstProvSamp.MyKey="a"
    // Create a test string with just the part between quotes.

    WCHAR wcTest[MAX_PATH+1];
  memset(wcTest, NULL, sizeof(wcTest));
  StringCbCopyW(wcTest, sizeof(wcTest), ObjectPath);

    WCHAR * pwcTest, * pwcCompare = NULL;
    int iNumQuotes = 0;
    for(pwcTest = wcTest; *pwcTest; pwcTest++)
        if(*pwcTest == L'\"')
        {
            iNumQuotes++;
            if(iNumQuotes == 1)
            {
                pwcCompare = pwcTest+1;
            }
            else if(iNumQuotes == 2)
            {
                *pwcTest = NULL;
                break;
            }
        }
        else if(*pwcTest == L'.')
            *pwcTest = NULL;    // issolate the class name.
    if(iNumQuotes != 2)
        return WBEM_E_FAILED;

    // check the instance list for a match.

    for(iCnt = 0; iCnt < glNumInst; iCnt++)
    {
        if(!_wcsicmp(MyDefs[iCnt].pwcKey, pwcCompare))
        {
            sc = CreateInst(m_pNamespace,MyDefs[iCnt].pwcKey,
                    MyDefs[iCnt].lValue, ppObj, wcTest, pCtx);
            return sc;
        }
    }

    return WBEM_E_NOT_FOUND;
}

HRESULT STDMETHODCALLTYPE CInstPro::GetObject | ( | const BSTR | ObjectPath,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemClassObject __RPC_FAR *__RPC_FAR * | ppObject,
 |  | IWbemCallResult __RPC_FAR *__RPC_FAR * | ppCallResult |
 | ) |  |  | [inline]

Definition at line 75 of file Sample.h.

                                                                                {return WBEM_E_NOT_SUPPORTED;};

HRESULT STDMETHODCALLTYPE CInstPro::GetObjectAsync | ( | const BSTR | ObjectPath,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemObjectSink __RPC_FAR * | pResponseHandler
 | ) |  |
STDMETHODIMP CInstPro::Initialize | ( | LPWSTR | pszUser,
 |  | LONG | lFlags,
 |  | LPWSTR | pszNamespace,
 |  | LPWSTR | pszLocale,
 |  | IWbemServices * | pNamespace,
 |  | IWbemContext * | pCtx,
 |  | IWbemProviderInitSink * | pInitSink
 | ) |  |

Definition at line 114 of file InstProv.Cpp.

{

  if(! pNamespace)
  {
      pInitSink->SetStatus(WBEM_E_FAILED , 0);
  }
  else
  {
    m_pNamespace = pNamespace;
      m_pNamespace->AddRef();
    pInitSink->SetStatus(WBEM_S_INITIALIZED, 0);
  }

    return WBEM_S_NO_ERROR;
}

HRESULT STDMETHODCALLTYPE CInstPro::OpenNamespace | ( | const BSTR | Namespace,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemServices __RPC_FAR *__RPC_FAR * | ppWorkingNamespace,
 |  | IWbemCallResult __RPC_FAR *__RPC_FAR * | ppResult |
 | ) |  |  | [inline]

Definition at line 61 of file Sample.h.

                                                                                {return WBEM_E_NOT_SUPPORTED;};

HRESULT STDMETHODCALLTYPE CInstPro::PutClass | ( | IWbemClassObject __RPC_FAR * | pObject,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemCallResult __RPC_FAR *__RPC_FAR * | ppCallResult |
 | ) |  |  | [inline]

Definition at line 88 of file Sample.h.

                                                                                {return WBEM_E_NOT_SUPPORTED;};

HRESULT STDMETHODCALLTYPE CInstPro::PutClassAsync | ( | IWbemClassObject __RPC_FAR * | pObject,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemObjectSink __RPC_FAR * | pResponseHandler |
 | ) |  |  | [inline]

Definition at line 94 of file Sample.h.

                                                                    {return WBEM_E_NOT_SUPPORTED;};

HRESULT STDMETHODCALLTYPE CInstPro::PutInstance | ( | IWbemClassObject __RPC_FAR * | pInst,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemCallResult __RPC_FAR *__RPC_FAR * | ppCallResult |
 | ) |  |  | [inline]

Definition at line 124 of file Sample.h.

                                                                                {return WBEM_E_NOT_SUPPORTED;};

HRESULT STDMETHODCALLTYPE CInstPro::PutInstanceAsync | ( | IWbemClassObject __RPC_FAR * | pInst,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemObjectSink __RPC_FAR * | pResponseHandler |
 | ) |  |  | [inline]

Definition at line 130 of file Sample.h.

                                                                    {return WBEM_E_NOT_SUPPORTED;};

STDMETHODIMP CInstPro::QueryInterface | ( | REFIID | riid,
 |  | PPVOID | ppv
 | ) |  |

Definition at line 68 of file InstProv.Cpp.

{
    *ppv=NULL;

    // Since we have dual inheritance, it is necessary to cast the return type

    if(riid== IID_IWbemServices)
       *ppv=(IWbemServices*)this;

    if(IID_IUnknown==riid || riid== IID_IWbemProviderInit)
       *ppv=(IWbemProviderInit*)this;

    if (NULL!=*ppv) {
        AddRef();
        return NOERROR;
        }
    else
        return E_NOINTERFACE;

}

HRESULT STDMETHODCALLTYPE CInstPro::QueryObjectSink | ( | long | lFlags,
 |  | IWbemObjectSink __RPC_FAR *__RPC_FAR * | ppResponseHandler |
 | ) |  |  | [inline]

Definition at line 71 of file Sample.h.

                                                                                {return WBEM_E_NOT_SUPPORTED;};

CInstPro::STDMETHODIMP_ ( ULONG )
CInstPro::STDMETHODIMP_ ( ULONG )

Member Data Documentation

ULONG CInstPro::m_cRef [protected]

Definition at line 33 of file Sample.h.

IWbemServices* CInstPro::m_pNamespace [protected]

Definition at line 34 of file Sample.h.

The documentation for this class was generated from the following files:
  • SysMgmt/WMI/VC/InstProv/Sample.h
  • SysMgmt/WMI/VC/InstProv/InstProv.Cpp
Generated on Wed Nov 13 2024 16:56:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CInterfaceDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Protected Attributes

CInterfaceDlg Class Reference

#include "cdialog.h"

Inherits CDialogLite.

Inherited by CMultipleResultsDlg.

List of all members.

Public Member Functions

CInterfaceDlg (UINT nID, WCHAR *pwszTitle, REFIID riid)
virtual | ~CInterfaceDlg ()
virtual CAggregate * | GetAggregate ()
virtual REFIID | GetSelInterface ()
virtual BOOL | OnAggregation ()
virtual BOOL | OnCommand (UINT iID, HWND hWndCtrl)
virtual BOOL | OnInitDialog ()
virtual BOOL | OnOK ()
virtual BOOL | OnUpdate ()
virtual IUnknown ** | ppUnknown ()
virtual IUnknown * | pUnknown ()

Public Attributes

BOOL m_fAggregation
BOOL m_fOutput

Protected Attributes

CComboBoxGuid m_CComboInterface
IID m_iid
CAggregate * m_pCAggregate
IUnknown * | m_pIUnknown
IUnknown ** | m_ppIUnknown
WCHAR * | m_pwszTitle

Detailed Description

Definition at line 121 of file cdialog.h.

Constructor & Destructor Documentation

CInterfaceDlg::CInterfaceDlg | ( | UINT | nID,
 |  | WCHAR * | pwszTitle,
 |  | REFIID | riid
 | ) |  |

Definition at line 5041 of file cdialog.cpp.

  : CDialogLite(nID)
{
  //Title
  m_pwszTitle   = pwszTitle;

  //Aggregation
  m_fAggregation  = FALSE;  //Default
  m_pCAggregate = NULL;

  //riid
  m_iid     = riid;

  //Output
  m_fOutput   = TRUE;   //Default
  m_pIUnknown   = NULL;
  m_ppIUnknown  = NULL;
}

CInterfaceDlg::~CInterfaceDlg ( ) [virtual]

Definition at line 5065 of file cdialog.cpp.

{
  //Aggregation
  SAFE_RELEASE(m_pCAggregate);

  //Output
  SAFE_RELEASE(m_pIUnknown);
}

Member Function Documentation

virtual CAggregate* CInterfaceDlg::GetAggregate ( ) [inline, virtual]

Definition at line 139 of file cdialog.h.

{ return m_pCAggregate;       }

virtual REFIID CInterfaceDlg::GetSelInterface ( ) [inline, virtual]

Definition at line 138 of file cdialog.h.

{ return m_iid;           }

BOOL CInterfaceDlg::OnAggregation ( ) [virtual]

Definition at line 5161 of file cdialog.cpp.

{
  //Aggregation Combo Selection has changed...
  //If we are now using Aggregation, automatically change the requested
  //riid to IID_IUnknown, since its an error otherwise...
  if(IsDlgButtonChecked(IDB_AGGREGATION))
  {
    m_CComboInterface.SetGuid(IID_IUnknown);
  }

  return TRUE;
}

BOOL CInterfaceDlg::OnCommand | ( | UINT | iID,
 |  | HWND | hWndCtrl |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 5146 of file cdialog.cpp.

{
  switch(iID)
  {
    //File Menu
    ON_COMMAND(IDB_AGGREGATION,   OnAggregation())
  }

  return CDialogLite::OnCommand(iID, hWndCtrl);
}

BOOL CInterfaceDlg::OnInitDialog ( ) [virtual]

Reimplemented from CDialogLite.

Definition at line 5079 of file cdialog.cpp.

{
  CWaitCursor waitCursor;

  //Update Title and Window
  if(m_pwszTitle)
    wSendMessage(m_hWnd, WM_SETTEXT, 0, m_pwszTitle);

  //Setup the Aggregation Button
  SAFE_RELEASE(m_pCAggregate);
  CheckDlgButton(IDB_AGGREGATION, BST2STATE(m_fAggregation));   //Default

  //Setup the Interface Combo
  m_CComboInterface.CreateIndirect(m_hWnd, IDC_INTERFACE);
  m_CComboInterface.Populate(g_cInterfaceMaps, g_rgInterfaceMaps);
  m_CComboInterface.SetGuid(m_iid);

  //Setup the ppIUnknown Button
  SAFE_RELEASE(m_pIUnknown);
  CheckDlgButton(IDB_OUTPUT, BST2STATE(m_fOutput));     //Default

  CenterDialog(m_hWnd);
  return CDialogLite::OnInitDialog();
}

BOOL CInterfaceDlg::OnOK ( ) [virtual]

Reimplemented from CDialogLite.

Definition at line 5109 of file cdialog.cpp.

{
  CWaitCursor waitCursor;

  //Update all our items...
  OnUpdate();

  //Delegate
  return CDialogLite::OnOK();
}

BOOL CInterfaceDlg::OnUpdate ( ) [virtual]

Definition at line 5125 of file cdialog.cpp.

{
  //Obtain the Aggregation argument
  if(IsDlgButtonChecked(IDB_AGGREGATION))
    m_pCAggregate = new CAggregate();

  //Obtain the riid argument
  m_iid = m_CComboInterface.GetGuid();

  //Obtain the Output (ppIUnknown) argument
  if(IsDlgButtonChecked(IDB_OUTPUT))
    m_ppIUnknown = &m_pIUnknown;

  return TRUE;
}

virtual IUnknown** CInterfaceDlg::ppUnknown ( ) [inline, virtual]

Definition at line 142 of file cdialog.h.

{   return m_ppIUnknown;        }

virtual IUnknown* CInterfaceDlg::pUnknown ( ) [inline, virtual]

Definition at line 143 of file cdialog.h.

{   return m_pIUnknown;         }

Member Data Documentation

CComboBoxGuid CInterfaceDlg::m_CComboInterface [protected]

Definition at line 164 of file cdialog.h.

BOOL CInterfaceDlg::m_fAggregation

Definition at line 146 of file cdialog.h.

BOOL CInterfaceDlg::m_fOutput

Definition at line 147 of file cdialog.h.

IID CInterfaceDlg::m_iid [protected]

Definition at line 157 of file cdialog.h.

CAggregate* CInterfaceDlg::m_pCAggregate [protected]

Definition at line 154 of file cdialog.h.

IUnknown* CInterfaceDlg::m_pIUnknown [protected]

Definition at line 160 of file cdialog.h.

IUnknown** CInterfaceDlg::m_ppIUnknown [protected]

Definition at line 161 of file cdialog.h.

WCHAR* CInterfaceDlg::m_pwszTitle [protected]

Definition at line 151 of file cdialog.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialog.h
  • Dataaccess/oledb/rowsetviewer/cdialog.cpp
Generated on Wed Nov 13 2024 16:56:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CIntTrace Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Public Attributes

CIntTrace Class Reference

#include "ctrace.h"

Inherits CRichEditLite.

List of all members.

Public Member Functions

CIntTrace (CMainWindow *pCMainWindow)
virtual | ~CIntTrace ()
virtual HRESULT | Clear ()
virtual COptionsSheet * | GetOptions ()
virtual BOOL | OnCommand (UINT iID, HWND hWndCtrl)
virtual BOOL | OnContextMenu (HWND hWnd, REFPOINTS pts)
virtual BOOL | OnRButtonDown (WPARAM fwKeys, REFPOINTS pts)
virtual BOOL | OnUpdateCommand (HMENU hMenu, UINT nID, DWORD *pdwFlags)
virtual BOOL | OnUpdateOutputSelected ()
virtual void | OutputIndent (ULONG cIndentLevel)
virtual void | OutputLineEnd ()
virtual void | OutputText (DWORD dwMask, COLORREF dwColor, WCHAR *pwszText)
virtual void | OutputTextFmt (DWORD dwMask, COLORREF dwColor, WCHAR *pwszFmt,...)

Static Public Member Functions

static CIntTrace * | GetTrace ()
static ULONG | TraceAddRef (IUnknown *pIUnknown, WCHAR *pwszText)
static HRESULT | TraceMethod (HRESULT hrActual, WCHAR *pwszFmt,...)
static HRESULT | TraceNotification (DWORD dwNotifyType, HRESULT hrVeto, WCHAR *pwszInterface, WCHAR *pwszMethod, WCHAR *pwszParams,...)
static HRESULT | TraceQI (IUnknown *pIUnknown, REFIID riid, IUnknown **ppIUnknown, WCHAR *pwszFmt=L"IUnknown")
static ULONG | TraceRelease (IUnknown **ppIUnknown, WCHAR *pwszText, ULONG ulExpectedRefCount=1)

Public Attributes

CMainWindow * m_pCMainWindow
ULONG m_ulNestingLevel

Detailed Description

Definition at line 38 of file ctrace.h.

Constructor & Destructor Documentation

CIntTrace::CIntTrace ( CMainWindow * pCMainWindow )

Definition at line 24 of file ctrace.cpp.

{
  //Data
  ASSERT(pCMainWindow);
  m_pCMainWindow    = pCMainWindow;

  //TraceProvider
  m_ulNestingLevel      = 0;
}

CIntTrace::~CIntTrace ( ) [virtual]

Definition at line 39 of file ctrace.cpp.

{
}

Member Function Documentation

HRESULT CIntTrace::Clear ( ) [virtual]

Definition at line 443 of file ctrace.cpp.

{
  //Select all the Text and Cut it...
  //This method allows the text to be undone...
//  SendMessage(m_hWnd, EM_SETSEL, 0, -1);
//  SendMessage(m_hWnd, WM_CUT, 0, 0);

  //Since this window is ReadOnly, we can't Cut it, we can only delete...
  SendMessage(m_hWnd, WM_SETTEXT, 0, (LPARAM)"");
  return S_OK;
}

COptionsSheet * CIntTrace::GetOptions ( ) [virtual]

Definition at line 48 of file ctrace.cpp.

{
  return m_pCMainWindow->GetOptions();
}

CIntTrace * CIntTrace::GetTrace ( ) [static]

Definition at line 227 of file ctrace.cpp.

{
  CMainWindow* pCMainWindow = (CMainWindow*)CAppLite::m_pCMainWindow;
  if(pCMainWindow)
  {
    if(pCMainWindow->m_pCMDITrace)
      return pCMainWindow->m_pCMDITrace->m_pCTrace;
  }

  return NULL;
}

BOOL CIntTrace::OnCommand | ( | UINT | iID,
 |  | HWND | hWndCtrl |
 | ) |  |  | [virtual]

Definition at line 133 of file ctrace.cpp.

{
  switch(iID)
  {
    //Editing
    ON_COMMAND(IDM_CLEARNOTIFYWINDOW,       Clear())
    ON_COMMAND(IDM_COPYNOTIFYWINDOW,        SendMessage(m_hWnd, WM_COPY, 0, 0))

    //Notifications
    ON_COMMAND(IDM_NOTIFY_S_OK,           m_pCMainWindow->m_pCListener->SetReturnValue(S_OK))
    ON_COMMAND(IDM_NOTIFY_S_FALSE,          m_pCMainWindow->m_pCListener->SetReturnValue(S_FALSE))
    ON_COMMAND(IDM_NOTIFY_S_UNWANTEDPHASE,      m_pCMainWindow->m_pCListener->SetReturnValue(DB_S_UNWANTEDPHASE))
    ON_COMMAND(IDM_NOTIFY_S_UNWANTEDREASON,     m_pCMainWindow->m_pCListener->SetReturnValue(DB_S_UNWANTEDREASON))
    ON_COMMAND(IDM_NOTIFY_E_FAIL,         m_pCMainWindow->m_pCListener->SetReturnValue(E_FAIL))
  };

  return FALSE;
}

BOOL CIntTrace::OnContextMenu | ( | HWND | hWnd,
 |  | REFPOINTS | pts |
 | ) |  |  | [virtual]

Definition at line 78 of file ctrace.cpp.

{
  DisplayContextMenu(
            hWnd,
            IDM_NOTIFYMENU,
            pts,
            m_pCMainWindow->GetWnd()
            );
  return  TRUE;
}

BOOL CIntTrace::OnRButtonDown | ( | WPARAM | fwKeys,
 |  | REFPOINTS | pts |
 | ) |  |  | [virtual]

Definition at line 58 of file ctrace.cpp.

{
  //NOTE: The right mouse button doesn't automatically activate the MDI window...
  m_pCMainWindow->MDIActivate(m_hWndParent);

  //xPos, yPos are Relative to the Client Area...
  DisplayContextMenu(
            m_hWnd,
            IDM_NOTIFYMENU,
            pts,
            m_pCMainWindow->GetWnd(),
            TRUE
            );
  return TRUE;
}

BOOL CIntTrace::OnUpdateCommand | ( | HMENU | hMenu,
 |  | UINT | nID,
 |  | DWORD * | pdwFlags |
 | ) |  |  | [virtual]

Definition at line 94 of file ctrace.cpp.

{
  switch(nID)
  {
    //Editing
    ON_COMMAND_UI_ENABLED(IDM_CLEARNOTIFYWINDOW,      TRUE)
    ON_COMMAND_UI_ENABLED(IDM_COPYNOTIFYWINDOW,       OnUpdateOutputSelected())

    //Notifications
    ON_COMMAND_UI_CHECKED(IDM_NOTIFY_S_OK,          m_pCMainWindow->m_pCListener->GetReturnValue() == S_OK)
    ON_COMMAND_UI_CHECKED(IDM_NOTIFY_S_FALSE,       m_pCMainWindow->m_pCListener->GetReturnValue() == S_FALSE)
    ON_COMMAND_UI_CHECKED(IDM_NOTIFY_S_UNWANTEDPHASE,   m_pCMainWindow->m_pCListener->GetReturnValue() == DB_S_UNWANTEDPHASE)
    ON_COMMAND_UI_CHECKED(IDM_NOTIFY_S_UNWANTEDREASON,    m_pCMainWindow->m_pCListener->GetReturnValue() == DB_S_UNWANTEDREASON)
    ON_COMMAND_UI_CHECKED(IDM_NOTIFY_E_FAIL,        m_pCMainWindow->m_pCListener->GetReturnValue() == E_FAIL)
  };

  return FALSE;
}

BOOL CIntTrace::OnUpdateOutputSelected ( ) [virtual]

Definition at line 118 of file ctrace.cpp.

{
  INDEX iStartPos = 0;
  INDEX iEndPos = 0;

  //Cut/Copy is only enabled - if something is selected.
  SendMessage(m_hWnd, EM_GETSEL, (WPARAM)&iStartPos, (LPARAM)&iEndPos);
  return iStartPos != iEndPos;
}

void CIntTrace::OutputIndent ( ULONG cIndentLevel ) [virtual]

Definition at line 216 of file ctrace.cpp.

{
  for(ULONG i=0; i<cIndentLevel; i++)
    OutputText(0, 0, L"\t");
}

void CIntTrace::OutputLineEnd ( ) [virtual]

Definition at line 156 of file ctrace.cpp.

{
  //Standard MultiLine Edit Controls require (\r\n)
  //Anything else results in no line break
  //Even RichEdit controls "\n" works but when copying to text files they are lost
  ReplaceSel(L"\r\n", TRUE);
}

void CIntTrace::OutputText | ( | DWORD | dwMask,
 |  | COLORREF | dwColor,
 |  | WCHAR * | pwszText |
 | ) |  |  | [virtual]

Definition at line 197 of file ctrace.cpp.

{
  ASSERT(pwszText);

  //No-op - no output window...
  if(m_hWnd)
  {
    //Move the Caret to the End
    SetSel(LONG_MAX, LONG_MAX);
    //Append the New String
    ReplaceSel(pwszText, FALSE, dwMask, dwColor);
  }
}

void CIntTrace::OutputTextFmt | ( | DWORD | dwMask,
 |  | COLORREF | dwColor,
 |  | WCHAR * | pwszFmt,
 |  |  | ... |
 | ) |  |  | [virtual]

Definition at line 169 of file ctrace.cpp.

{
  ASSERT(pwszFmt);

  va_list   marker;
  WCHAR   wszBuffer[MAX_QUERY_LEN];

  // Use format and arguements as input
  //This version will not overwrite the stack, since it only copies
  //upto the max size of the array
  va_start(marker, pwszFmt);
  _vsnwprintf(wszBuffer, MAX_QUERY_LEN, pwszFmt, marker);
  va_end(marker);

  //Make sure there is a NULL Terminator, vsnwprintf will not copy
  //the terminator if length==MAX_NAME_LEN
  wszBuffer[MAX_QUERY_LEN-1] = wEOL;

  //Delegate
  OutputText(dwMask, dwColor, wszBuffer);
}

ULONG CIntTrace::TraceAddRef | ( | IUnknown * | pIUnknown,
 |  | WCHAR * | pwszText |
 | ) |  |  | [static]

Definition at line 244 of file ctrace.cpp.

{
  ULONG ulRefCount = 0;

  //AddRef
  if(pIUnknown)
  {
    ulRefCount = pIUnknown->AddRef();

    CIntTrace* pCTrace = GetTrace();
    if(pCTrace)
    {
      if(NOTIFY_ADDREF & pCTrace->GetOptions()->m_dwNotifyOpts)
      {
        pCTrace->OutputTextFmt(0, 0, L"%s::AddRef() - %d", pwszFmt ? pwszFmt : L"IUnknown", ulRefCount);
        pCTrace->OutputLineEnd();
      }
    }
  }

  return ulRefCount;
}

HRESULT CIntTrace::TraceMethod | ( | HRESULT | hrActual,
 |  | WCHAR * | pwszFmt,
 |  |  | ... |
 | ) |  |  | [static]

Definition at line 332 of file ctrace.cpp.

{
  ASSERT(pwszFmt);
  CIntTrace* pCTrace = GetTrace();
  if(pCTrace)
  {
    DWORD dwNotifyOpts = pCTrace->GetOptions()->m_dwNotifyOpts;
    if(dwNotifyOpts & NOTIFY_OLEDB)
    {
      //Only if the user is interested in this message
      va_list   marker;
      WCHAR   wszBuffer[MAX_QUERY_LEN];

      // Use format and arguements as input
      //This version will not overwrite the stack, since it only copies
      //upto the max size of the array
      va_start(marker, pwszFmt);
      _vsnwprintf(wszBuffer, MAX_QUERY_LEN, pwszFmt, marker);
      va_end(marker);

      //Make sure there is a NULL Terminator, vsnwprintf will not copy
      //the terminator if length==MAX_NAME_LEN
      wszBuffer[MAX_QUERY_LEN-1] = wEOL;

      //Colored Errors
      DWORD dwMask = FAILED(hrActual) ? (CFM_BOLD | CFM_COLOR) : hrActual!=S_OK ? CFM_BOLD : 0;
      DWORD dwColor = RGB_RED;

      //Delegate
      pCTrace->OutputTextFmt(dwMask, dwColor, L"%s - %S", wszBuffer, GetErrorName(hrActual));
      pCTrace->OutputLineEnd();
    }
  }

  return hrActual;
}

HRESULT CIntTrace::TraceNotification | ( | DWORD | dwNotifyType,
 |  | HRESULT | hrVeto,
 |  | WCHAR * | pwszInterface,
 |  | WCHAR * | pwszMethod,
 |  | WCHAR * | pwszParams,
 |  |  | ... |
 | ) |  |  | [static]

Definition at line 374 of file ctrace.cpp.

{
  ASSERT(pwszParams);
  CIntTrace* pCTrace = GetTrace();
  if(pCTrace)
  {
    DWORD dwNotifyOpts = pCTrace->GetOptions()->m_dwNotifyOpts;
    WCHAR wszBuffer[MAX_QUERY_LEN] = {0};
    BOOL fShowVeto = (dwNotifyOpts & NOTIFY_PROMPTVETO) && (dwNotifyType & (NOTIFY_IDBASYNCHNOTIFY | NOTIFY_IROWSETNOTIFY | NOTIFY_IROWPOSITIONCHANGE));

    //Only if the user is interested in this message
    if(dwNotifyOpts & dwNotifyType || fShowVeto)
    {
      va_list   marker;

      // Use format and arguements as input
      //This version will not overwrite the stack, since it only copies
      //upto the max size of the array
      va_start(marker, pwszParams);
      _vsnwprintf(wszBuffer, MAX_QUERY_LEN, pwszParams, marker);
      va_end(marker);

      //Make sure there is a NULL Terminator, vsnwprintf will not copy
      //the terminator if length==MAX_NAME_LEN
      wszBuffer[MAX_QUERY_LEN-1] = wEOL;
    }

    //Do we need to prompt for Accept or veto?
    if(fShowVeto)
    {
      hrVeto = S_OK;
      if(IDCANCEL == wMessageBox(GetFocus(), MB_TASKMODAL | MB_ICONQUESTION | MB_OKCANCEL | MB_DEFBUTTON1,
        L"Received Notification",
        L"%s::%s\n"
        L"%s\n\n"
        L"'OK' - Accept notification, 'CANCEL' - Veto Notification",
        pwszInterface,
        pwszMethod,
        wszBuffer
        ))
      {
        hrVeto = S_FALSE;
      }
    }

    //Only if the user is interested in this message
    if(dwNotifyOpts & dwNotifyType)
    {
      //Colored Errors
      DWORD dwMask = FAILED(hrVeto) ? (CFM_BOLD | CFM_COLOR) : hrVeto!=S_OK ? CFM_BOLD : CFM_COLOR;
      DWORD dwColor = FAILED(hrVeto) ? RGB_RED : RGB_DARK_GREEN;

      //Now acutally output the Notification to the trace
      pCTrace->OutputTextFmt(dwMask, dwColor, L"\t%s::%s%s - %S", pwszInterface, pwszMethod, wszBuffer, GetErrorName(hrVeto));
      pCTrace->OutputLineEnd();
    }
  }
  return hrVeto;
}

HRESULT CIntTrace::TraceQI | ( | IUnknown * | pIUnknown,
 |  | REFIID | riid,
 |  | IUnknown ** | ppIUnknown,
 |  | WCHAR * | pwszFmt = L"IUnknown" |
 | ) |  |  | [static]

Definition at line 307 of file ctrace.cpp.

{
  HRESULT hr = S_OK;

  if(pIUnknown)
  {
    //QueryInterface
    hr = pIUnknown->QueryInterface(riid, (void**)ppIUnknown);

    CIntTrace* pCTrace = GetTrace();
    if(pCTrace)
    {
      if(NOTIFY_QI & pCTrace->GetOptions()->m_dwNotifyOpts)
        TraceMethod(hr, L"%s::QueryInterface(%s, &0x%p)", pwszFmt ? pwszFmt : L"IUnknown", GetInterfaceName(riid), ppIUnknown ? *ppIUnknown : NULL);
    }
  }

  return hr;
}

ULONG CIntTrace::TraceRelease | ( | IUnknown ** | ppIUnknown,
 |  | WCHAR * | pwszText,
 |  | ULONG | ulExpectedRefCount = 1 |
 | ) |  |  | [static]

Definition at line 272 of file ctrace.cpp.

{
  ULONG ulRefCount = 0;

  //Release
  if(ppIUnknown && *ppIUnknown)
  {
    //Actual Release and NULL pointer
    ulRefCount = (*ppIUnknown)->Release();
    *ppIUnknown = NULL;

    //Trace
    CIntTrace* pCTrace = GetTrace();
    if(pCTrace)
    {
      if(NOTIFY_RELEASE & pCTrace->GetOptions()->m_dwNotifyOpts)
      {
        pCTrace->OutputTextFmt(0, 0, L"%s::Release() - %d", pwszFmt ? pwszFmt : L"IUnknown", ulRefCount);
        pCTrace->OutputLineEnd();
      }
    }

    //Display Errors if RefCount is not what is expected...
    if(ulExpectedRefCount==0 && ulRefCount!=0)
      DisplayRefCountErrors(pwszFmt, ulRefCount, ulExpectedRefCount);
  }

  return ulRefCount;
}

Member Data Documentation

CMainWindow* CIntTrace::m_pCMainWindow

Definition at line 73 of file ctrace.h.

ULONG CIntTrace::m_ulNestingLevel

Definition at line 74 of file ctrace.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/ctrace.h
  • Dataaccess/oledb/rowsetviewer/ctrace.cpp
Generated on Wed Nov 13 2024 16:56:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CIsapiCertPolicyFilter Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Private Member Functions

CIsapiCertPolicyFilter Class Reference

#include "isapiCertPolicy.h"

List of all members.

Public Member Functions

CIsapiCertPolicyFilter ()
~CIsapiCertPolicyFilter ()
virtual BOOL | GetFilterVersion (PHTTP_FILTER_VERSION pVer)
virtual DWORD | OnAuthentication (CHttpFilterContext *pCtxt, PHTTP_FILTER_AUTHENT pAuthent)

Static Private Member Functions

static BOOL | CheckCertPolicy (const _bstr_t &bstrCert)
static BOOL | MatchExtendedKeyUsage (CAPICOM::IEKUPtr EKU, BOOL *pfMatchOid)
static BOOL | MatchExtendedKeyUsage (CAPICOM::ICertificate2Ptr Cert)
static BOOL | MatchIssuerThumbprint (CAPICOM::ICertificate2Ptr Cert)

Detailed Description

Definition at line 10 of file isapiCertPolicy.h.

Constructor & Destructor Documentation

CIsapiCertPolicyFilter::CIsapiCertPolicyFilter ( )

Definition at line 104 of file isapiCertPolicy.cpp.

{
}

CIsapiCertPolicyFilter::~CIsapiCertPolicyFilter ( )

Definition at line 109 of file isapiCertPolicy.cpp.

{
}

Member Function Documentation

BOOL CIsapiCertPolicyFilter::CheckCertPolicy ( const _bstr_t & bstrCert ) [static, private]

Definition at line 272 of file isapiCertPolicy.cpp.

{
    CAPICOM::ICertificate2Ptr Cert(__uuidof(CAPICOM::Certificate));

    Cert->Import(bstrCert);

    BOOL fOk = MatchIssuerThumbprint(Cert);

    if (fOk)
    {
        fOk =  MatchExtendedKeyUsage(Cert);
    }

    return fOk;
}

BOOL CIsapiCertPolicyFilter::GetFilterVersion ( PHTTP_FILTER_VERSION pVer ) [virtual]

Definition at line 114 of file isapiCertPolicy.cpp.

{
    // DebugBreak() can be useful for debugging startup code
    // uncomment these lines as needed for testing

//  #if defined(_DEBUG) || defined(DEBUG) /////////////////////
//      DebugBreak();
//  #endif // defined(_DEBUG) || defined(DEBUG) ///////////////

    // Call default implementation for initialization
    CHttpFilter::GetFilterVersion(pVer);

    // Clear the flags set by base class
    pVer->dwFlags &= ~SF_NOTIFY_ORDER_MASK;

    // Set the flags we are interested in
    //
    // Note: Using SF_NOTIFY_AUTHENTICATION and OnAuthentication
    // allows early termination of the connecton.  However, if you
    // need access to the authenticated user name (for exampe to
    // enforce a match with the certificate) then
    // SF_NOTIFY_AUTH_COMPLETE can be used with an implementation
    // of OnAuthComplete. See the ISAPI Filter documentation in
    // the IISSDK for additional information.

    pVer->dwFlags |= SF_NOTIFY_SECURE_PORT | SF_NOTIFY_ORDER_DEFAULT |
        SF_NOTIFY_AUTHENTICATION;

    // Load description string
    TCHAR sz[SF_MAX_FILTER_DESC_LEN+1];
    ISAPIVERIFY(::LoadString(AfxGetResourceHandle(),
            IDS_FILTER, sz, SF_MAX_FILTER_DESC_LEN));
    _tcscpy(pVer->lpszFilterDesc, sz);
    return TRUE;
}

BOOL CIsapiCertPolicyFilter::MatchExtendedKeyUsage ( CAPICOM::ICertificate2Ptr Cert ) [static, private]

Definition at line 227 of file isapiCertPolicy.cpp.

{
    CAPICOM::IExtendedKeyUsagePtr ExUsage(Cert->ExtendedKeyUsage());
    BOOL fMatch = FALSE;
    BOOL fOk = TRUE;

    // Extended Key Usage represents restrictions if present

    if (0 != ExUsage->IsPresent)
    {
        CAPICOM::IEKUsPtr EKUs(ExUsage->EKUs);
        int iEkuCnt = EKUs->Count;
        int iMatchCnt = 0;

        // If the certificate doesn't have at least as many
        // EKUs as we have OIDs to match, then don't even try.

        if (gc_iMatchOidCnt <= iEkuCnt)
        {
            // BOOL array to track our matches,
            // start with none matched
            BOOL afMatchOid[gc_iMatchOidCnt] = {FALSE};

            for (
                int iEku = 1;
                fOk && iEku <= iEkuCnt && iMatchCnt < gc_iMatchOidCnt;
                ++iEku)
            {
                // For Each EKU in EKUs, while more OIDs to match

                fMatch = MatchExtendedKeyUsage(EKUs->Item[iEku], afMatchOid);

                if (fMatch)
                {
                    // Count this match
                    ++iMatchCnt;
                }
            }
        }
        fOk = fOk && (gc_iMatchOidCnt == iMatchCnt);
    }

    return fOk;
}

BOOL CIsapiCertPolicyFilter::MatchExtendedKeyUsage | ( | CAPICOM::IEKUPtr | EKU,
 |  | BOOL * | pfMatchOid |
 | ) |  |  | [static, private]

Definition at line 197 of file isapiCertPolicy.cpp.

{
    bool fMatch = FALSE;
    _bstr_t bstrOid(EKU->OID, FALSE);

    // For each Match Oid, while not matched

    for (
        int iOid = 0;
        iOid < gc_iMatchOidCnt && !fMatch;
        ++iOid)
    {
        // Skips OIDs we've already matched
        if (!pfMatchOid[iOid])
        {
            fMatch = (
                !!bstrOid &&
                0 == lstrcmpW(bstrOid, gc_apszMatchOid[iOid]));

            if (fMatch)
            {
                // This OID matched, don't check for it any more
                pfMatchOid[iOid] = TRUE;
            }
        }
    }
    return fMatch;
}

BOOL CIsapiCertPolicyFilter::MatchIssuerThumbprint ( CAPICOM::ICertificate2Ptr Cert ) [static, private]

Definition at line 153 of file isapiCertPolicy.cpp.

{
    CAPICOM::IChainPtr Chain(__uuidof(CAPICOM::Chain));
    CAPICOM::ICertificatesPtr Certs(NULL);

    BOOL fOk = Chain->Build(Cert);

    if (fOk)
    {
        Certs = Chain->Certificates;
        fOk = (2 <= Certs->Count);
    }

    if (fOk)
    {
        CAPICOM::ICertificate2Ptr ParentCert(Certs->Item[2]);
        _bstr_t bstrThumbprint(ParentCert->Thumbprint, FALSE);

        fOk = !!bstrThumbprint;

        if (fOk)
        {
            BOOL fFound = FALSE;

            for (
                int iThumbprint = 0;
                iThumbprint < gc_iThumbPrintCnt && !fFound;
                ++iThumbprint)
            {
                fFound = (0 == lstrcmpiW(
                    bstrThumbprint,
                    gc_apszThumbprint[iThumbprint]));
            }
            fOk = fOk && fFound;
        }
    }

    return fOk;
}

DWORD CIsapiCertPolicyFilter::OnAuthentication | ( | CHttpFilterContext * | pCtxt,
 |  | PHTTP_FILTER_AUTHENT | pAuthent |
 | ) |  |  | [virtual]

Definition at line 289 of file isapiCertPolicy.cpp.

{
    DWORD dwRet = SF_STATUS_REQ_FINISHED;

    try {
        BOOL fOk = TRUE;
        BOOL fHaveCert = FALSE;

        char CertificateBuf[8192];
        CERT_CONTEXT_EX ccex;
        ccex.cbAllocated = sizeof(CertificateBuf);
        ccex.CertContext.pbCertEncoded = (BYTE*)CertificateBuf;
        ccex.dwCertificateFlags = 0;
        DWORD dwSize = sizeof(ccex);

        fOk = pCtxt->ServerSupportFunction(
            (enum SF_REQ_TYPE)HSE_REQ_GET_CERT_INFO_EX,
            (LPVOID)&ccex,
            &dwSize,
            NULL);

        if (fOk)
        {
            // Do we have a cert?
            fHaveCert = (1 == (1 & ccex.dwCertificateFlags));
        }

        if (fHaveCert)
        {
            // convert ccex's Cert to BSTR

            _bstr_t bstrCert(
                SysAllocStringLen(
                    (OLECHAR * )ccex.CertContext.pbCertEncoded,
                    (ccex.CertContext.cbCertEncoded+1)/2),
                FALSE);

            fOk = CheckCertPolicy(bstrCert);
        }

        if (fOk)
        {
            // Passed checks
            dwRet = SF_STATUS_REQ_NEXT_NOTIFICATION;
        }
        else
        {
            // Error or failed to validate show:
            // HTTP 403.16 - Forbidden: Client certificate untrusted or invalid

            // Write HTTP Header
            DWORD dwBytes = sizeof(g_szHttpHeader) - 1;
            pCtxt->WriteClient((LPVOID)g_szHttpHeader, &dwBytes, 0);

            // Write Error Message

            dwBytes = sizeof(g_szHttpError403_16) - 1;
            pCtxt->WriteClient((LPVOID)g_szHttpError403_16, &dwBytes, 0);
        }
    }
    catch(...)
    {
        // Unexpected Exception, show HTTP 500 - Internal server error

        // Write HTTP Header
        DWORD dwBytes = sizeof(g_szHttpHeader) - 1;
        pCtxt->WriteClient((LPVOID)g_szHttpHeader, &dwBytes, 0);

        // Write Error Message

        dwBytes = sizeof(g_szHttpError500) - 1;
        pCtxt->WriteClient((LPVOID)g_szHttpError500, &dwBytes, 0);
    }

    return dwRet;
}

The documentation for this class was generated from the following files:
  • Security/capicom/cpp/isapiCertPolicy/isapiCertPolicy.h
  • Security/capicom/cpp/isapiCertPolicy/isapiCertPolicy.cpp
Generated on Wed Nov 13 2024 16:56:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CISeqStream Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CISeqStream Class Reference

#include "table.h"

List of all members.

Public Member Functions

CISeqStream ()
virtual | ~CISeqStream ()
virtual BOOL | Clear ()
virtual BOOL | CompareData (void *pBuffer)
virtual ULONG | Length ()
virtual | operator void *const ()
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | Read (void __RPC_FAR *pv, ULONG cb, ULONG __RPC_FAR *pcbRead)
virtual BOOL | Seek (ULONG iPos)
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP | Write (const void __RPC_FAR *pv, ULONG cb, ULONG __RPC_FAR *pcbWritten)
virtual HRESULT | Write (ISequentialStream *pISeqStream, ULONG *pcbWritten)

Private Attributes

ULONG m_cBufSize
ULONG m_cRef
ULONG m_iPos
void * | m_pBuffer

Detailed Description

Definition at line 187 of file table.h.

Constructor & Destructor Documentation

CISeqStream::CISeqStream ( )

Definition at line 1910 of file table.cpp.

{
  m_iPos         = 0;
  m_cRef       = 0;
  m_pBuffer      = NULL;
  m_cBufSize     = 0;

  //The constructor AddRef's
  AddRef();
}

CISeqStream::~CISeqStream ( ) [virtual]

Definition at line 1922 of file table.cpp.

{
  //Shouldn't have any references left
  ASSERT(m_cRef == 0);
  SAFE_FREE(m_pBuffer);
}

Member Function Documentation

BOOL CISeqStream::Clear ( ) [virtual]

Definition at line 1974 of file table.cpp.

{
  //Frees the buffer
  m_iPos       = 0;
  m_cBufSize     = 0;

  SAFE_FREE(m_pBuffer);
  return TRUE;
}

BOOL CISeqStream::CompareData ( void * pBuffer ) [virtual]

Definition at line 1984 of file table.cpp.

{
  ASSERT(pBuffer);

  //Quick and easy way to compare user buffer with the stream
  return memcmp(pBuffer, m_pBuffer, m_cBufSize)==0;
}

virtual ULONG CISeqStream::Length ( ) [inline, virtual]

Definition at line 197 of file table.h.

{ return m_cBufSize; };

virtual CISeqStream::operator void *const ( ) [inline, virtual]

Definition at line 199 of file table.h.

{ return m_pBuffer; };

STDMETHODIMP CISeqStream::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CISeqStream::Read | ( | void __RPC_FAR * | pv,
 |  | ULONG | cb,
 |  | ULONG __RPC_FAR * | pcbRead
 | ) |  |
BOOL CISeqStream::Seek ( ULONG iPos ) [virtual]

Definition at line 1964 of file table.cpp.

{
  //Make sure the desired position is within the buffer
  ASSERT(iPos == 0 || iPos < m_cBufSize);

  //Reset the current buffer position
  m_iPos = iPos;
  return TRUE;
}

CISeqStream::STDMETHODIMP_ ( ULONG )
CISeqStream::STDMETHODIMP_ ( ULONG )
HRESULT CISeqStream::Write | ( | ISequentialStream * | pISeqStream,
 |  | ULONG * | pcbWritten |
 | ) |  |  | [virtual]

Definition at line 2053 of file table.cpp.

{
  //Parameter checking
  if(!pISeqStream)
    return STG_E_INVALIDPOINTER;

  if(pcbWritten)
    *pcbWritten = 0;

  HRESULT hr = S_OK;
  ULONG cbRead = MAX_STREAM_BLOCK_SIZE;

  //Need to read (in chunks) from the Stream passed in and sotre in our CISeqStream object
  while(hr==S_OK && cbRead==MAX_STREAM_BLOCK_SIZE)
  {
    //Keep appending the data to the end of our buffer
    SAFE_REALLOC(m_pBuffer, BYTE, m_cBufSize + MAX_STREAM_BLOCK_SIZE);
    hr = pISeqStream->Read((BYTE*)m_pBuffer + m_cBufSize, MAX_STREAM_BLOCK_SIZE, &cbRead);
    m_cBufSize += cbRead;

    if(pcbWritten)
      *pcbWritten += cbRead;
  }

CLEANUP:
  return S_OK;
}

STDMETHODIMP CISeqStream::Write | ( | const void __RPC_FAR * | pv,
 |  | ULONG | cb,
 |  | ULONG __RPC_FAR * | pcbWritten
 | ) |  |

Member Data Documentation

ULONG CISeqStream::m_cBufSize [private]

Definition at line 225 of file table.h.

ULONG CISeqStream::m_cRef [private]

Definition at line 222 of file table.h.

ULONG CISeqStream::m_iPos [private]

Definition at line 226 of file table.h.

void* CISeqStream::m_pBuffer [private]

Definition at line 224 of file table.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/tablecopy/table.h
  • Dataaccess/oledb/tablecopy/table.cpp
Generated on Wed Nov 13 2024 16:56:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CKeystrokeEditSession Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CKeystrokeEditSession Class Reference

Inherits CEditSessionBase, and CEditSessionBase.

List of all members.

Public Member Functions

CKeystrokeEditSession (ITfContext *pContext, WPARAM wParam)
CKeystrokeEditSession (CMarkTextService *pMark, ITfContext *pContext, WPARAM wParam)
~CKeystrokeEditSession ()
STDMETHODIMP | DoEditSession (TfEditCookie ec)
STDMETHODIMP | DoEditSession (TfEditCookie ec)

Private Attributes

CMarkTextService * _pMark
WPARAM | _wParam

Detailed Description

Definition at line 11 of file keys.cpp.

Constructor & Destructor Documentation

CKeystrokeEditSession::CKeystrokeEditSession | ( | ITfContext * | pContext,
 |  | WPARAM | wParam |
 | ) |  |  | [inline]

Definition at line 14 of file keys.cpp.

                                                               : CEditSessionBase(pContext)
    {
        _wParam = wParam;
    }

CKeystrokeEditSession::CKeystrokeEditSession | ( | CMarkTextService * | pMark,
 |  | ITfContext * | pContext,
 |  | WPARAM | wParam |
 | ) |  |  | [inline]

Definition at line 14 of file keys.cpp.

                                                                                : CEditSessionBase(pContext)
    {
        _pMark = pMark;
        _pMark->AddRef();
        _wParam = wParam;
    }

CKeystrokeEditSession::~CKeystrokeEditSession ( ) [inline]

Definition at line 20 of file keys.cpp.

    {
        _pMark->Release();
    }

Member Function Documentation

STDAPI CKeystrokeEditSession::DoEditSession ( TfEditCookie ec ) [virtual]

Implements CEditSessionBase.

Definition at line 217 of file keys.cpp.

{
    WCHAR wc;

    // we want to toggle the english case of the keystroke
    // nb: this is quick-and-dirty code, not intended to demonstrate the
    // correct way to flip capitalization!

    if (GetKeyState(VK_SHIFT) & 0x8000)
    {
        // shift-key, make it lowercase
        wc = (WCHAR)(_wParam | 32);
    }
    else
    {
        // else make it capital
        wc = (WCHAR)_wParam;
    }

    InsertTextAtSelection(ec, _pContext, &wc, 1);

    return S_OK;
}

STDMETHODIMP CKeystrokeEditSession::DoEditSession ( TfEditCookie ec ) [virtual]

Implements CEditSessionBase.

Member Data Documentation

CMarkTextService* CKeystrokeEditSession::_pMark [private]

Definition at line 29 of file keys.cpp.

WPARAM CKeystrokeEditSession::_wParam [private]

Definition at line 23 of file keys.cpp.

The documentation for this class was generated from the following files:
  • WinUI/TSFcase/keys.cpp
  • WinUI/TSFmark/keys.cpp
Generated on Wed Nov 13 2024 16:56:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CLandBasedVehicle Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Types | Private Attributes | Static Private Attributes

CLandBasedVehicle Class Reference

#include "land.h"

Inherits CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, and CDelegationBase.

List of all members.

Public Member Functions

CLandBasedVehicle (CComponentData *pComponentData=NULL)
CLandBasedVehicle ()
CLandBasedVehicle ()
CLandBasedVehicle ()
CLandBasedVehicle ()
CLandBasedVehicle ()
CLandBasedVehicle ()
CLandBasedVehicle ()
CLandBasedVehicle ()
CLandBasedVehicle ()
CLandBasedVehicle ()
CLandBasedVehicle ()
CLandBasedVehicle (CComponentData *pComponentData=NULL)
virtual | ~CLandBasedVehicle ()
virtual | ~CLandBasedVehicle ()
virtual | ~CLandBasedVehicle ()
virtual | ~CLandBasedVehicle ()
virtual | ~CLandBasedVehicle ()
virtual | ~CLandBasedVehicle ()
virtual | ~CLandBasedVehicle ()
virtual | ~CLandBasedVehicle ()
virtual | ~CLandBasedVehicle ()
virtual | ~CLandBasedVehicle ()
virtual | ~CLandBasedVehicle ()
virtual | ~CLandBasedVehicle ()
virtual | ~CLandBasedVehicle ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual HSCOPEITEM | GetParentScopeItem ()
virtual HRESULT | OnAddMenuItems (IContextMenuCallback *pContextMenuCallback, long *pInsertionsAllowed)
virtual HRESULT | OnMenuCommand (IConsole *pConsole, long lCommandID)
virtual void | SetScopeItemValue (LONG scopeitem)

Private Types

enum | { IDM_NEW_LAND = 2 }
enum | { IDM_NEW_LAND = 2 }
enum | { IDM_NEW_LAND = 2 }
enum | { IDM_NEW_LAND = 2 }
enum | { IDM_NEW_LAND = 2 }
enum | { IDM_NEW_LAND = 2 }
enum | { IDM_NEW_LAND = 2 }
enum | { IDM_NEW_LAND = 2 }
enum | { IDM_NEW_LAND = 2 }
enum | { IDM_NEW_LAND = 2 }
enum | { IDM_NEW_LAND = 2 }
enum | { IDM_NEW_LAND = 2 }
enum | { IDM_NEW_LAND = 2 }

Private Attributes

HSCOPEITEM | m_hParentHScopeItem

Static Private Attributes

static const GUID | thisGuid = { 0x2974380e, 0x4c4b, 0x11d2, { 0x89, 0xd8, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28 } }

Detailed Description

Definition at line 26 of file land.h.

Member Enumeration Documentation

anonymous enum [private]
Enumerator:
IDM_NEW_LAND

Definition at line 38 of file land.h.

{ IDM_NEW_LAND = 2 };

anonymous enum [private]
Enumerator:
IDM_NEW_LAND

Definition at line 41 of file land.h.

{ IDM_NEW_LAND = 2 };

anonymous enum [private]
Enumerator:
IDM_NEW_LAND

Definition at line 39 of file land.h.

{ IDM_NEW_LAND = 2 };

anonymous enum [private]
Enumerator:
IDM_NEW_LAND

Definition at line 36 of file land.h.

{ IDM_NEW_LAND = 2 };

anonymous enum [private]
Enumerator:
IDM_NEW_LAND

Definition at line 36 of file land.h.

{ IDM_NEW_LAND = 2 };

anonymous enum [private]
Enumerator:
IDM_NEW_LAND

Definition at line 39 of file land.h.

{ IDM_NEW_LAND = 2 };

anonymous enum [private]
Enumerator:
IDM_NEW_LAND

Definition at line 36 of file land.h.

{ IDM_NEW_LAND = 2 };

anonymous enum [private]
Enumerator:
IDM_NEW_LAND

Definition at line 36 of file land.h.

{ IDM_NEW_LAND = 2 };

anonymous enum [private]
Enumerator:
IDM_NEW_LAND

Definition at line 36 of file land.h.

{ IDM_NEW_LAND = 2 };

anonymous enum [private]
Enumerator:
IDM_NEW_LAND

Definition at line 36 of file land.h.

{ IDM_NEW_LAND = 2 };

anonymous enum [private]
Enumerator:
IDM_NEW_LAND

Definition at line 36 of file land.h.

{ IDM_NEW_LAND = 2 };

anonymous enum [private]
Enumerator:
IDM_NEW_LAND

Definition at line 40 of file land.h.

{ IDM_NEW_LAND = 2 };

anonymous enum [private]
Enumerator:
IDM_NEW_LAND

Definition at line 36 of file land.h.

{ IDM_NEW_LAND = 2 };

Constructor & Destructor Documentation

CLandBasedVehicle::CLandBasedVehicle ( CComponentData * pComponentData = NULL ) [inline]

Definition at line 28 of file land.h.

    { m_pComponentData = pComponentData; }

virtual CLandBasedVehicle::~CLandBasedVehicle ( ) [inline, virtual]

Definition at line 31 of file land.h.

{}

CLandBasedVehicle::CLandBasedVehicle ( ) [inline]

Definition at line 27 of file land.h.

{ }

virtual CLandBasedVehicle::~CLandBasedVehicle ( ) [inline, virtual]

Definition at line 29 of file land.h.

{}

CLandBasedVehicle::CLandBasedVehicle ( ) [inline]

Definition at line 27 of file land.h.

{ }

virtual CLandBasedVehicle::~CLandBasedVehicle ( ) [inline, virtual]

Definition at line 29 of file land.h.

{}

CLandBasedVehicle::CLandBasedVehicle ( ) [inline]

Definition at line 27 of file land.h.

{ }

virtual CLandBasedVehicle::~CLandBasedVehicle ( ) [inline, virtual]

Definition at line 29 of file land.h.

{}

CLandBasedVehicle::CLandBasedVehicle ( ) [inline]

Definition at line 27 of file land.h.

{ }

virtual CLandBasedVehicle::~CLandBasedVehicle ( ) [inline, virtual]

Definition at line 29 of file land.h.

{}

CLandBasedVehicle::CLandBasedVehicle ( ) [inline]

Definition at line 27 of file land.h.

{ }

virtual CLandBasedVehicle::~CLandBasedVehicle ( ) [inline, virtual]

Definition at line 29 of file land.h.

{}

CLandBasedVehicle::CLandBasedVehicle ( ) [inline]

Definition at line 27 of file land.h.

{ }

virtual CLandBasedVehicle::~CLandBasedVehicle ( ) [inline, virtual]

Definition at line 29 of file land.h.

{}

CLandBasedVehicle::CLandBasedVehicle ( ) [inline]

Definition at line 27 of file land.h.

{ }

virtual CLandBasedVehicle::~CLandBasedVehicle ( ) [inline, virtual]

Definition at line 29 of file land.h.

{}

CLandBasedVehicle::CLandBasedVehicle ( ) [inline]

Definition at line 27 of file land.h.

{ }

virtual CLandBasedVehicle::~CLandBasedVehicle ( ) [inline, virtual]

Definition at line 29 of file land.h.

{}

CLandBasedVehicle::CLandBasedVehicle ( ) [inline]

Definition at line 27 of file land.h.

{ }

virtual CLandBasedVehicle::~CLandBasedVehicle ( ) [inline, virtual]

Definition at line 29 of file land.h.

{}

CLandBasedVehicle::CLandBasedVehicle ( ) [inline]

Definition at line 27 of file land.h.

{ }

virtual CLandBasedVehicle::~CLandBasedVehicle ( ) [inline, virtual]

Definition at line 29 of file land.h.

{}

CLandBasedVehicle::CLandBasedVehicle ( CComponentData * pComponentData = NULL ) [inline]

Definition at line 27 of file land.h.

    { m_pComponentData = pComponentData; }

virtual CLandBasedVehicle::~CLandBasedVehicle ( ) [inline, virtual]

Definition at line 30 of file land.h.

{}

CLandBasedVehicle::CLandBasedVehicle ( ) [inline]

Definition at line 27 of file land.h.

{ }

virtual CLandBasedVehicle::~CLandBasedVehicle ( ) [inline, virtual]

Definition at line 29 of file land.h.

{}

Member Function Documentation

virtual const int CLandBasedVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 35 of file land.h.

{ return INDEX_LANDICON; }

virtual const int CLandBasedVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 33 of file land.h.

{ return INDEX_LANDICON; }

virtual const int CLandBasedVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 33 of file land.h.

{ return INDEX_LANDICON; }

virtual const int CLandBasedVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 33 of file land.h.

{ return INDEX_LANDICON; }

virtual const int CLandBasedVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 33 of file land.h.

{ return INDEX_LANDICON; }

virtual const int CLandBasedVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 33 of file land.h.

{ return INDEX_LANDICON; }

virtual const int CLandBasedVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 33 of file land.h.

{ return INDEX_LANDICON; }

virtual const int CLandBasedVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 34 of file land.h.

{ return INDEX_LANDICON; }

virtual const int CLandBasedVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 33 of file land.h.

{ return INDEX_LANDICON; }

virtual const int CLandBasedVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 33 of file land.h.

{ return INDEX_LANDICON; }

virtual const int CLandBasedVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 33 of file land.h.

{ return INDEX_LANDICON; }

virtual const int CLandBasedVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 33 of file land.h.

{ return INDEX_LANDICON; }

virtual const int CLandBasedVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 33 of file land.h.

{ return INDEX_LANDICON; }

virtual const _TCHAR* CLandBasedVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 31 of file land.h.

{ return _T("Land-based Vehicles"); }

virtual const _TCHAR* CLandBasedVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 31 of file land.h.

{ return _T("Land-based Vehicles"); }

virtual const _TCHAR* CLandBasedVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 31 of file land.h.

{ return _T("Land-based Vehicles"); }

virtual const _TCHAR* CLandBasedVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 31 of file land.h.

{ return _T("Land-based Vehicles"); }

virtual const _TCHAR* CLandBasedVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 31 of file land.h.

{ return _T("Land-based Vehicles"); }

virtual const _TCHAR* CLandBasedVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 32 of file land.h.

{ return _T("Land-based Vehicles"); }

virtual const _TCHAR* CLandBasedVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 31 of file land.h.

{ return _T("Land-based Vehicles"); }

virtual const _TCHAR* CLandBasedVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 31 of file land.h.

{ return _T("Land-based Vehicles"); }

virtual const _TCHAR* CLandBasedVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 31 of file land.h.

{ return _T("Land-based Vehicles"); }

virtual const _TCHAR* CLandBasedVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 33 of file land.h.

{ return _T("Land-based Vehicles"); }

virtual const _TCHAR* CLandBasedVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 31 of file land.h.

{ return _T("Land-based Vehicles"); }

virtual const _TCHAR* CLandBasedVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 31 of file land.h.

{ return _T("Land-based Vehicles"); }

virtual const _TCHAR* CLandBasedVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 31 of file land.h.

{ return _T("Land-based Vehicles"); }

virtual const GUID& CLandBasedVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 32 of file land.h.

{ return thisGuid; }

virtual const GUID& CLandBasedVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 32 of file land.h.

{ return thisGuid; }

virtual const GUID& CLandBasedVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 32 of file land.h.

{ return thisGuid; }

virtual const GUID& CLandBasedVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 32 of file land.h.

{ return thisGuid; }

virtual const GUID& CLandBasedVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 32 of file land.h.

{ return thisGuid; }

virtual const GUID& CLandBasedVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 32 of file land.h.

{ return thisGuid; }

virtual const GUID& CLandBasedVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 32 of file land.h.

{ return thisGuid; }

virtual const GUID& CLandBasedVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 32 of file land.h.

{ return thisGuid; }

virtual const GUID& CLandBasedVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 32 of file land.h.

{ return thisGuid; }

virtual const GUID& CLandBasedVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 34 of file land.h.

{ return thisGuid; }

virtual const GUID& CLandBasedVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 32 of file land.h.

{ return thisGuid; }

virtual const GUID& CLandBasedVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 33 of file land.h.

{ return thisGuid; }

virtual const GUID& CLandBasedVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 32 of file land.h.

{ return thisGuid; }

virtual HSCOPEITEM CLandBasedVehicle::GetParentScopeItem ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 36 of file land.h.

{ return m_hParentHScopeItem; }

HRESULT CLandBasedVehicle::OnAddMenuItems | ( | IContextMenuCallback * | pContextMenuCallback,
 |  | long * | pInsertionsAllowed |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 29 of file land.Cpp.

{
    HRESULT hr = S_OK;
    CONTEXTMENUITEM menuItemsNew[] =
    {
        {
            L"Land based", L"Add a new land based vehicle",
                IDM_NEW_LAND, CCM_INSERTIONPOINTID_PRIMARY_NEW, 0, CCM_SPECIAL_DEFAULT_ITEM
        },
        { NULL, NULL, 0, 0, 0 }
    };

    // Loop through and add each of the menu items
    if (*pInsertionsAllowed & CCM_INSERTIONALLOWED_NEW)
    {
        for (LPCONTEXTMENUITEM m = menuItemsNew; m->strName; m++)
        {
            hr = pContextMenuCallback->AddItem(m);

            if (FAILED(hr))
                break;
        }
    }

    return hr;
}

HRESULT CLandBasedVehicle::OnMenuCommand | ( | IConsole * | pConsole,
 |  | long | lCommandID |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 56 of file land.Cpp.

{
    switch (lCommandID)
    {
    case IDM_NEW_LAND:
        pConsole->MessageBox(L"This sample does not create a new item\nSee Complete sample for a demonstration", L"Menu Command", MB_OK|MB_ICONINFORMATION, NULL);
        break;
    }

    return S_OK;
}

virtual void CLandBasedVehicle::SetScopeItemValue ( LONG scopeitem ) [inline, virtual]

Definition at line 35 of file land.h.

{ m_hParentHScopeItem = scopeitem; }

Member Data Documentation

HSCOPEITEM CLandBasedVehicle::m_hParentHScopeItem [private]

Definition at line 41 of file land.h.

static const GUID CLandBasedVehicle::thisGuid = { 0x2974380e, 0x4c4b, 0x11d2, { 0x89, 0xd8, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28 } } [static, private]

Reimplemented from CDelegationBase.

Definition at line 41 of file land.h.

The documentation for this class was generated from the following files:
  • SysMgmt/MMC/ActiveX/land.h
  • SysMgmt/MMC/CMenu/land.h
  • SysMgmt/MMC/Complete/land.h
  • SysMgmt/MMC/CutCopy/land.h
  • SysMgmt/MMC/Extens/land.h
  • SysMgmt/MMC/Menubtn/land.h
  • SysMgmt/MMC/Multisel/land.h
  • SysMgmt/MMC/Nodes/land.h
  • SysMgmt/MMC/Openserv/land.h
  • SysMgmt/MMC/Proppage/land.h
  • SysMgmt/MMC/Taskpads/land.h
  • SysMgmt/MMC/Toolbar/land.h
  • SysMgmt/MMC/WMI/land.h
  • SysMgmt/MMC/ActiveX/land.Cpp
  • SysMgmt/MMC/CMenu/land.Cpp
  • SysMgmt/MMC/Complete/land.Cpp
  • SysMgmt/MMC/CutCopy/land.Cpp
  • SysMgmt/MMC/Extens/land.Cpp
  • SysMgmt/MMC/Menubtn/land.Cpp
  • SysMgmt/MMC/Multisel/land.Cpp
  • SysMgmt/MMC/Nodes/land.Cpp
  • SysMgmt/MMC/Openserv/land.Cpp
  • SysMgmt/MMC/Proppage/land.Cpp
  • SysMgmt/MMC/Taskpads/land.Cpp
  • SysMgmt/MMC/Toolbar/land.Cpp
  • SysMgmt/MMC/WMI/land.Cpp
Generated on Wed Nov 13 2024 16:56:44 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CLangBarItemButton Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CLangBarItemButton Class Reference

List of all members.

Public Member Functions

CLangBarItemButton (CCaseTextService *pCase)
CLangBarItemButton (CMarkTextService *pMark)
~CLangBarItemButton ()
~CLangBarItemButton ()
STDMETHODIMP | AdviseSink (REFIID riid, IUnknown *punk, DWORD *pdwCookie)
STDMETHODIMP | AdviseSink (REFIID riid, IUnknown *punk, DWORD *pdwCookie)
STDMETHODIMP | GetIcon (HICON *phIcon)
STDMETHODIMP | GetIcon (HICON *phIcon)
STDMETHODIMP | GetInfo (TF_LANGBARITEMINFO *pInfo)
STDMETHODIMP | GetInfo (TF_LANGBARITEMINFO *pInfo)
STDMETHODIMP | GetStatus (DWORD *pdwStatus)
STDMETHODIMP | GetStatus (DWORD *pdwStatus)
STDMETHODIMP | GetText (BSTR *pbstrText)
STDMETHODIMP | GetText (BSTR *pbstrText)
STDMETHODIMP | GetTooltipString (BSTR *pbstrToolTip)
STDMETHODIMP | GetTooltipString (BSTR *pbstrToolTip)
STDMETHODIMP | InitMenu (ITfMenu *pMenu)
STDMETHODIMP | InitMenu (ITfMenu *pMenu)
STDMETHODIMP | OnClick (TfLBIClick click, POINT pt, const RECT *prcArea)
STDMETHODIMP | OnClick (TfLBIClick click, POINT pt, const RECT *prcArea)
STDMETHODIMP | OnMenuSelect (UINT wID)
STDMETHODIMP | OnMenuSelect (UINT wID)
STDMETHODIMP | QueryInterface (REFIID riid, void **ppvObj)
STDMETHODIMP | QueryInterface (REFIID riid, void **ppvObj)
STDMETHODIMP | Show (BOOL fShow)
STDMETHODIMP | Show (BOOL fShow)
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP | UnadviseSink (DWORD dwCookie)
STDMETHODIMP | UnadviseSink (DWORD dwCookie)

Private Attributes

LONG | _cRef
CCaseTextService * _pCase
ITfLangBarItemSink * | _pLangBarItemSink
CMarkTextService * _pMark
TF_LANGBARITEMINFO | _tfLangBarItemInfo

Detailed Description

Definition at line 30 of file langbar.cpp.

Constructor & Destructor Documentation

CLangBarItemButton::CLangBarItemButton ( CCaseTextService * pCase )

Definition at line 72 of file langbar.cpp.

{
    DllAddRef();

    _tfLangBarItemInfo.clsidService = c_clsidCaseTextService;
    _tfLangBarItemInfo.guidItem = c_guidLangBarItemButton;
    _tfLangBarItemInfo.dwStyle = TF_LBI_STYLE_BTN_MENU;
    _tfLangBarItemInfo.ulSort = 0;
    SafeStringCopy(_tfLangBarItemInfo.szDescription, ARRAYSIZE(_tfLangBarItemInfo.szDescription), LANGBAR_ITEM_DESC);

    _pCase = pCase;
    _pCase->AddRef();
    _pLangBarItemSink = NULL;

    _cRef = 1;
}

CLangBarItemButton::~CLangBarItemButton ( )

Definition at line 95 of file langbar.cpp.

{
    DllRelease();
    _pCase->Release();
}

CLangBarItemButton::CLangBarItemButton ( CMarkTextService * pMark )

Definition at line 70 of file langbar.cpp.

{
    DllAddRef();

    _tfLangBarItemInfo.clsidService = c_clsidMarkTextService;
    _tfLangBarItemInfo.guidItem = c_guidLangBarItemButton;
    _tfLangBarItemInfo.dwStyle = TF_LBI_STYLE_BTN_MENU;
    _tfLangBarItemInfo.ulSort = 0;
    SafeStringCopy(_tfLangBarItemInfo.szDescription, ARRAYSIZE(_tfLangBarItemInfo.szDescription), LANGBAR_ITEM_DESC);

    _pMark = pMark;
    _pMark->AddRef();
    _pLangBarItemSink = NULL;

    _cRef = 1;
}

CLangBarItemButton::~CLangBarItemButton ( )

Member Function Documentation

STDAPI CLangBarItemButton::AdviseSink | ( | REFIID | riid,
 |  | IUnknown * | punk,
 |  | DWORD * | pdwCookie
 | ) |  |

Definition at line 304 of file langbar.cpp.

{
    if (!IsEqualIID(IID_ITfLangBarItemSink, riid))
        return CONNECT_E_CANNOTCONNECT;

    if (_pLangBarItemSink != NULL)
        return CONNECT_E_ADVISELIMIT;

    if (punk->QueryInterface(IID_ITfLangBarItemSink, (void **)&_pLangBarItemSink) != S_OK)
    {
        _pLangBarItemSink = NULL;
        return E_NOINTERFACE;
    }

    *pdwCookie = CASE_LANGBARITEMSINK_COOKIE;
    return S_OK;
}

STDMETHODIMP CLangBarItemButton::AdviseSink | ( | REFIID | riid,
 |  | IUnknown * | punk,
 |  | DWORD * | pdwCookie
 | ) |  |
STDAPI CLangBarItemButton::GetIcon ( HICON * phIcon )

Definition at line 278 of file langbar.cpp.

{
    *phIcon = (HICON)LoadImage(g_hInst, TEXT("IDI_CASE"), IMAGE_ICON, 16, 16, 0);

    return (*phIcon != NULL) ? S_OK : E_FAIL;
}

STDMETHODIMP CLangBarItemButton::GetIcon ( HICON * phIcon )
STDAPI CLangBarItemButton::GetInfo ( TF_LANGBARITEMINFO * pInfo )

Definition at line 172 of file langbar.cpp.

{
    *pInfo = _tfLangBarItemInfo;
    return S_OK;
}

STDMETHODIMP CLangBarItemButton::GetInfo ( TF_LANGBARITEMINFO * pInfo )
STDMETHODIMP CLangBarItemButton::GetStatus ( DWORD * pdwStatus )
STDAPI CLangBarItemButton::GetStatus ( DWORD * pdwStatus )

Definition at line 184 of file langbar.cpp.

{
    *pdwStatus = 0;
    return S_OK;
}

STDAPI CLangBarItemButton::GetText ( BSTR * pbstrText )

Definition at line 291 of file langbar.cpp.

{
    *pbstrText = SysAllocString(LANGBAR_ITEM_DESC);

    return (*pbstrText == NULL) ? E_OUTOFMEMORY : S_OK;
}

STDMETHODIMP CLangBarItemButton::GetText ( BSTR * pbstrText )
STDMETHODIMP CLangBarItemButton::GetTooltipString ( BSTR * pbstrToolTip )
STDAPI CLangBarItemButton::GetTooltipString ( BSTR * pbstrToolTip )

Definition at line 207 of file langbar.cpp.

{
    *pbstrToolTip = SysAllocString(LANGBAR_ITEM_DESC);

    return (*pbstrToolTip == NULL) ? E_OUTOFMEMORY : S_OK;
}

STDAPI CLangBarItemButton::InitMenu ( ITfMenu * pMenu )

Definition at line 231 of file langbar.cpp.

{
    int i;
    DWORD dwFlags;

    for (i=0; i<ARRAYSIZE(c_rgMenuItems); i++)
    {
        switch (i)
        {
            case MENU_SHOWSNOOP_INDEX:
                dwFlags = _pCase->_IsSnoopWndVisible() ? TF_LBMENUF_CHECKED : 0;
                break;

            case MENU_FLIPKEYS_INDEX:
                dwFlags = _pCase->_IsKeyFlipping() ? TF_LBMENUF_CHECKED : 0;
                break;

            default:
                // all other items are plain
                dwFlags = 0;
                break;
        }

        pMenu->AddMenuItem(i, dwFlags, NULL, NULL, c_rgMenuItems[i].pchDesc, (ULONG)wcslen(c_rgMenuItems[i].pchDesc), NULL);
    }

    return S_OK;
}

STDMETHODIMP CLangBarItemButton::InitMenu ( ITfMenu * pMenu )
STDAPI CLangBarItemButton::OnClick | ( | TfLBIClick | click,
 |  | POINT | pt,
 |  | const RECT * | prcArea
 | ) |  |

Definition at line 220 of file langbar.cpp.

{
    return S_OK;
}

STDMETHODIMP CLangBarItemButton::OnClick | ( | TfLBIClick | click,
 |  | POINT | pt,
 |  | const RECT * | prcArea
 | ) |  |
STDAPI CLangBarItemButton::OnMenuSelect ( UINT wID )

Definition at line 266 of file langbar.cpp.

{
    c_rgMenuItems[wID].pfnHandler(_pCase);
    return S_OK;
}

STDMETHODIMP CLangBarItemButton::OnMenuSelect ( UINT wID )
STDAPI CLangBarItemButton::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppvObj
 | ) |  |

Definition at line 107 of file langbar.cpp.

{
    if (ppvObj == NULL)
        return E_INVALIDARG;

    *ppvObj = NULL;

    if (IsEqualIID(riid, IID_IUnknown) ||
        IsEqualIID(riid, IID_ITfLangBarItem) ||
        IsEqualIID(riid, IID_ITfLangBarItemButton))
    {
        *ppvObj = (ITfLangBarItemButton *)this;
    }
    else if (IsEqualIID(riid, IID_ITfSource))
    {
        *ppvObj = (ITfSource *)this;
    }

    if (*ppvObj)
    {
        AddRef();
        return S_OK;
    }

    return E_NOINTERFACE;
}

STDMETHODIMP CLangBarItemButton::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppvObj
 | ) |  |
STDAPI CLangBarItemButton::Show ( BOOL fShow )

Definition at line 196 of file langbar.cpp.

{
    return E_NOTIMPL;
}

STDMETHODIMP CLangBarItemButton::Show ( BOOL fShow )
CLangBarItemButton::STDMETHODIMP_ ( ULONG )
CLangBarItemButton::STDMETHODIMP_ ( ULONG )
CLangBarItemButton::STDMETHODIMP_ ( ULONG )
CLangBarItemButton::STDMETHODIMP_ ( ULONG )
STDAPI CLangBarItemButton::UnadviseSink ( DWORD dwCookie )

Definition at line 328 of file langbar.cpp.

{
    if (dwCookie != CASE_LANGBARITEMSINK_COOKIE)
        return CONNECT_E_NOCONNECTION;

    if (_pLangBarItemSink == NULL)
        return CONNECT_E_NOCONNECTION;

    _pLangBarItemSink->Release();
    _pLangBarItemSink = NULL;

    return S_OK;
}

STDMETHODIMP CLangBarItemButton::UnadviseSink ( DWORD dwCookie )

Member Data Documentation

LONG CLangBarItemButton::_cRef [private]

Definition at line 63 of file langbar.cpp.

CCaseTextService* CLangBarItemButton::_pCase [private]

Definition at line 60 of file langbar.cpp.

ITfLangBarItemSink * CLangBarItemButton::_pLangBarItemSink [private]

Definition at line 61 of file langbar.cpp.

CMarkTextService* CLangBarItemButton::_pMark [private]

Definition at line 58 of file langbar.cpp.

TF_LANGBARITEMINFO CLangBarItemButton::_tfLangBarItemInfo [private]

Definition at line 62 of file langbar.cpp.

The documentation for this class was generated from the following files:
  • WinUI/TSFcase/langbar.cpp
  • WinUI/TSFmark/langbar.cpp
Generated on Wed Nov 13 2024 16:56:44 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CLanguageResourceSampleCF Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Protected Attributes | Friends

CLanguageResourceSampleCF Class Reference

#include "lrsample.HXX"

List of all members.

Public Member Functions

CLanguageResourceSampleCF ()
ULONG STDMETHODCALLTYPE | AddRef ()
HRESULT STDMETHODCALLTYPE | CreateInstance (IUnknown *pUnkOuter, REFIID riid, void **ppvObject)
HRESULT STDMETHODCALLTYPE | LockServer (BOOL fLock)
HRESULT STDMETHODCALLTYPE | QueryInterface (REFIID riid, void **ppvObject)
ULONG STDMETHODCALLTYPE | Release ()

Protected Member Functions

~CLanguageResourceSampleCF ()

Protected Attributes

long | _lRefs

Friends

HRESULT STDMETHODCALLTYPE | DllGetClassObject (REFCLSID cid, REFIID iid, void **ppvObj)

Detailed Description

Definition at line 49 of file lrsample.HXX.

Constructor & Destructor Documentation

CLanguageResourceSampleCF::CLanguageResourceSampleCF ( )

Definition at line 587 of file lrsample.CXX.

                                                     :
    _lRefs( 1 )
{
    InterlockedIncrement( &g_cInstances );
} //CLanguageResourceSampleCF

CLanguageResourceSampleCF::~CLanguageResourceSampleCF ( ) [protected]

Definition at line 601 of file lrsample.CXX.

{
    InterlockedDecrement( &g_cInstances );
} //~LanguageResourceSampleCF

Member Function Documentation

ULONG STDMETHODCALLTYPE CLanguageResourceSampleCF::AddRef ( void )

Definition at line 650 of file lrsample.CXX.

{
    return InterlockedIncrement( &_lRefs );
} //AddRef

HRESULT STDMETHODCALLTYPE CLanguageResourceSampleCF::CreateInstance | ( | IUnknown * | pUnkOuter,
 |  | REFIID | riid,
 |  | void ** | ppvObject
 | ) |  |

Definition at line 689 of file lrsample.CXX.

{
    *ppvObject = 0;

    if ( IID_IStemmer == riid )
        *ppvObject = new CSampleStemmer();
    else if ( IID_IWordBreaker == riid )
        *ppvObject = new CSampleWordBreaker();
    else
        return E_NOINTERFACE;

    if ( 0 == *ppvObject )
        return E_OUTOFMEMORY;

    return S_OK;
} //CreateInstance

HRESULT STDMETHODCALLTYPE CLanguageResourceSampleCF::LockServer ( BOOL fLock )

Definition at line 721 of file lrsample.CXX.

{
    if ( fLock )
        InterlockedIncrement( &g_cInstances );
    else
        InterlockedDecrement( &g_cInstances );

    return S_OK;
} //LockServer

HRESULT STDMETHODCALLTYPE CLanguageResourceSampleCF::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppvObject
 | ) |  |

Definition at line 619 of file lrsample.CXX.

{
    if ( 0 == ppvObject )
        return E_INVALIDARG;

    if ( IID_IClassFactory == riid )
        *ppvObject = (IUnknown *) (IClassFactory *) this;
    else if ( IID_IUnknown == riid )
        *ppvObject = (IUnknown *) (IPersist *) this;
    else
    {
        *ppvObject = 0;
        return E_NOINTERFACE;
    }

    AddRef();
    return S_OK;
} //QueryInterface

ULONG STDMETHODCALLTYPE CLanguageResourceSampleCF::Release ( void )

Definition at line 665 of file lrsample.CXX.

{
    long lTmp = InterlockedDecrement( &_lRefs );

    if ( 0 == lTmp )
        delete this;

    return lTmp;
} //Release

Friends And Related Function Documentation

HRESULT STDMETHODCALLTYPE DllGetClassObject | ( | REFCLSID | cid,
 |  | REFIID | iid,
 |  | void ** | ppvObj |
 | ) |  |  | [friend]

Definition at line 1064 of file HtmlProp.Cxx.

{
    IUnknown * pUnk = 0;

    if ( CLSID_HtmlPropIFilter == cid ||
         CLSID_HtmlPropClass   == cid )
    {
        pUnk = new HtmlPropIFilterCF;

        if ( 0 == pUnk )
            return E_OUTOFMEMORY;
    }
    else
    {
        *ppvObj = 0;
        return E_NOINTERFACE;
    }

    SCODE sc = pUnk->QueryInterface( iid, ppvObj );

    pUnk->Release();

    return sc;
} //DllGetClassObject

Member Data Documentation

long CLanguageResourceSampleCF::_lRefs [protected]

Definition at line 75 of file lrsample.HXX.

The documentation for this class was generated from the following files:
  • WinBase/Indexing/lrsample/lrsample.HXX
  • WinBase/Indexing/lrsample/lrsample.CXX
Generated on Wed Nov 13 2024 16:56:44 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Class1 Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Static Public Member Functions

Class1 Class Reference

List of all members.

Static Public Member Functions

static void main (String[] args)

Detailed Description

Definition at line 23 of file Class1.java.

Member Function Documentation

static void Class1::main ( String[] args ) [inline, static]

Definition at line 26 of file Class1.java.

  {
    int i;

    //Create the server
    FullServ pFullServ = new FullServ();

    //QueryInterface for ICallFactory
    ICallFactory pICallFactory = (ICallFactory)pFullServ;

    //Create the call object
    AsyncIFullServ arrayAsyncIFullServ[] = new AsyncIFullServ[1];
    pICallFactory.CreateCall(AsyncIFullServ.iid,null,AsyncIFullServ.iid,arrayAsyncIFullServ);
    AsyncIFullServ pAsyncIFullServ = arrayAsyncIFullServ[0];

    //QueryInterface for ISynchronize
    ISynchronize pISynchronize = (ISynchronize) pAsyncIFullServ;

    //Begin non-blocking call
    pAsyncIFullServ.Begin_Sum(2,3);

    System.out.println("Waiting for call completion.");
    //Wait for call completion
    try{
      pISynchronize.Wait(0,-1);// -1 = INFINITE
    }catch(com.ms.com.ComFailException cfe){
      System.err.println("Error during Wait");
      return;
    }
    //Finish the call
    i = pAsyncIFullServ.Finish_Sum();

    System.out.println("2 + 3 = " + i );

    System.out.println("\n\nPress Enter to continue..\n \n");
    try{System.in.read();}
    catch(IOException e){}

  }

The documentation for this class was generated from the following file:
  • Com/Fundamentals/AsyncCalls/JavaClient/Class1.java
Generated on Wed Nov 13 2024 16:56:44 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CLBSub Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CLBSub Class Reference

#include "lbsub.h"

Inherits CSysLCESub.

List of all members.

Public Member Functions

CLBSub (CComSpy *pSpy)
CLBSub ()
STDMETHODIMP | EngineDefined (BSTR bstrPropName, VARIANT *varPropValue, BSTR bstrClsidEng)
STDMETHODIMP | GetEventClass (LPGUID guid)
STDMETHODIMP | GetEventType (EventEnum *e)
STDMETHODIMP | GetInterface (IID *iid)
STDMETHODIMP | TargetDown (BSTR bstrServerName, BSTR bstrClsidEng)
STDMETHODIMP | TargetUp (BSTR bstrServerName, BSTR bstrClsidEng)

Detailed Description

Definition at line 30 of file lbsub.h.

Constructor & Destructor Documentation

CLBSub::CLBSub ( CComSpy * pSpy ) [inline]

Definition at line 35 of file lbsub.h.

  {
    m_pSpy = pSpy;
  }

CLBSub::CLBSub ( ) [inline]

Definition at line 40 of file lbsub.h.

  {
    m_pSpy = NULL;
  }

Member Function Documentation

STDMETHODIMP CLBSub::EngineDefined | ( | BSTR | bstrPropName,
 |  | VARIANT * | varPropValue,
 |  | BSTR | bstrClsidEng |
 | ) |  |  | [inline]

Definition at line 87 of file lbsub.h.

  {
    //This event has not been implemented yet and will be active in the future.
    return S_OK;
  }

STDMETHODIMP CLBSub::GetEventClass ( LPGUID guid ) [inline, virtual]

Implements CSysLCESub.

Definition at line 54 of file lbsub.h.

{*guid = CLSID_LBEvents;return S_OK;}

STDMETHODIMP CLBSub::GetEventType ( EventEnum * e ) [inline, virtual]

Implements CSysLCESub.

Definition at line 53 of file lbsub.h.

{*e = LoadBalancing;return S_OK;}

STDMETHODIMP CLBSub::GetInterface ( IID * iid ) [inline, virtual]

Implements CSysLCESub.

Definition at line 55 of file lbsub.h.

{*iid = IID_ILBEvents;return S_OK;}

STDMETHODIMP CLBSub::TargetDown | ( | BSTR | bstrServerName,
 |  | BSTR | bstrClsidEng |
 | ) |  |  | [inline]

Definition at line 73 of file lbsub.h.

  {
    LONGLONG perfCount = 0;
    ::QueryPerformanceCounter( (LARGE_INTEGER *)&perfCount );

    m_pSpy -> AddEventToList(perfCount, OLESTR("Target Down"), OLESTR("COM+ Load Balancing"));
    m_pSpy -> AddParamValueToList(L"ServerName", bstrServerName);
    m_pSpy -> AddParamValueToList(L"Engine ID", bstrClsidEng);

    IF_AUDIT_DO(TargetDown)(perfCount,bstrServerName,bstrClsidEng);

    return S_OK;
  }

STDMETHODIMP CLBSub::TargetUp | ( | BSTR | bstrServerName,
 |  | BSTR | bstrClsidEng |
 | ) |  |  | [inline]

Definition at line 58 of file lbsub.h.

  {
    LONGLONG perfCount = 0;
    ::QueryPerformanceCounter( (LARGE_INTEGER *)&perfCount );

    m_pSpy -> AddEventToList(perfCount, OLESTR("Target Up"), OLESTR("COM+ Load Balancing"));
    m_pSpy -> AddParamValueToList(L"ServerName", bstrServerName);
    m_pSpy -> AddParamValueToList(L"Engine ID", bstrClsidEng);

    IF_AUDIT_DO(TargetUp)(perfCount,bstrServerName,bstrClsidEng);

    return S_OK;
  }

The documentation for this class was generated from the following file:
  • Com/Administration/Spy/ComSpyCtl/lbsub.h
Generated on Wed Nov 13 2024 16:56:44 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CLDisp Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Private Attributes

CLDisp Class Reference

#include "LDisp.h"

List of all members.

Public Member Functions

CLDisp ()
STDMETHOD() | Alloc (long *pJAustin)
STDMETHOD() | CreateResource (const RESTYPID ResTypId, RESID *pResId, TIMEINSECS *SecsFreeBeforeDestroy)
STDMETHOD() | DeAlloc (long JAustin)
DECLARE_CLASSFACTORY_SINGLETON (CLDisp)
DECLARE_PROTECT_FINAL_CONSTRUCT ()
STDMETHOD() | DestroyResource (const RESID ResId)
STDMETHOD() | DestroyResourceS (constSRESID ResId)
STDMETHOD() | EnlistResource (const RESID ResId, const TRANSID TransId)
HRESULT | FinalConstruct ()
void | FinalRelease ()
STDMETHOD() | RateResource (const RESTYPID ResTypId, const RESID ResId, const BOOL fRequiresTransactionEnlistment, RESOURCERATING *pRating)
STDMETHOD() | ResetResource (const RESID ResId)

Public Attributes

CComPtr< IUnknown > | m_pUnkMarshaler

Private Attributes

CComAutoCriticalSection | m_cs
IDispenserManager * | m_pDispMan
IHolder * | m_pHolder

Detailed Description

Definition at line 12 of file LDisp.h.

Constructor & Destructor Documentation

CLDisp::CLDisp ( ) [inline]

Definition at line 30 of file LDisp.h.

  {
    m_pUnkMarshaler = NULL;
  }

Member Function Documentation

STDMETHODIMP CLDisp::Alloc ( long * pJAustin )

Definition at line 18 of file LDisp.Cpp.

{
  //if we don't have a valid pointer to the Dispenser Manager, fail.
  if(m_pDispMan)
  {
    *pJAustin = NULL;
    //We pass the pointer to JAustin to alloc Resource.
    //Once it returns to us, the dispenser manager has set
    //JAustin equal to a specific RESID.  We return this to the
    //client, and which time the client has a RESID.
    return m_pHolder->AllocResource((RESID)1, (RESID *)pJAustin);
  }

  return E_FAIL;

}

HRESULT CLDisp::CreateResource | ( | const RESTYPID | ResTypId,
 |  | RESID * | pResId,
 |  | TIMEINSECS * | SecsFreeBeforeDestroy
 | ) |  |

Definition at line 51 of file LDisp.Cpp.

{

  if(1 != ResTypId)
    return E_FAIL;

  int * j = new int; //allocate an integer
  *pResId = (RESID)j; //convert the pointer to the integer to a RESID.
  *pSecsFreeBeforeDestroy = 20;

  return S_OK;
}

STDMETHODIMP CLDisp::DeAlloc ( long JAustin )

Definition at line 37 of file LDisp.Cpp.

{
  //If we don't have a valid pointer to a dispenser manager, fail.
 if(m_pDispMan)
  {
   //call free resource, specifying which resource to free.
   return m_pHolder->FreeResource((RESID)JAustin);
  }
  else return E_FAIL;

}

CLDisp::DECLARE_CLASSFACTORY_SINGLETON ( CLDisp )
CLDisp::DECLARE_PROTECT_FINAL_CONSTRUCT ( )
HRESULT CLDisp::DestroyResource ( const RESID ResId )

Definition at line 93 of file LDisp.Cpp.

{
  delete (int *)ResId;
  return S_OK;
}

HRESULT CLDisp::DestroyResourceS ( constSRESID ResId )

Definition at line 100 of file LDisp.Cpp.

{return E_FAIL;}

HRESULT CLDisp::EnlistResource | ( | const RESID | ResId,
 |  | const TRANSID | TransId
 | ) |  |

Definition at line 81 of file LDisp.Cpp.

{return E_FAIL;}

HRESULT CLDisp::FinalConstruct ( ) [inline]

Definition at line 44 of file LDisp.h.

  {
    //Get a pointer to the dispenser manager, and register
    //this dispenser with it.
    HRESULT hr;
    hr = GetDispenserManager(&m_pDispMan);
    IDispenserDriver * pDriver;
    hr = GetUnknown()->QueryInterface(IID_IDispenserDriver, (void **)&pDriver);
    hr = m_pDispMan->RegisterDispenser(pDriver,L"LDispenser", &m_pHolder);

    //aggregate the free threaded marshaler.
    return CoCreateFreeThreadedMarshaler(
      GetControllingUnknown(), &m_pUnkMarshaler.p);
  }

void CLDisp::FinalRelease ( ) [inline]

Definition at line 59 of file LDisp.h.

  {
    //de-aggregate the free threaded marshaller
    m_pUnkMarshaler.Release();
  }

HRESULT CLDisp::RateResource | ( | const RESTYPID | ResTypId,
 |  | const RESID | ResId,
 |  | const BOOL | fRequiresTransactionEnlistment,
 |  | RESOURCERATING * | pRating
 | ) |  |

Definition at line 70 of file LDisp.Cpp.

{
  *pRating = 100; //perfectly suited.
  return S_OK;
}

HRESULT CLDisp::ResetResource ( const RESID ResId )

Definition at line 87 of file LDisp.Cpp.

{return S_OK;}

Member Data Documentation

CComAutoCriticalSection CLDisp::m_cs [private]

Definition at line 21 of file LDisp.h.

IDispenserManager* CLDisp::m_pDispMan [private]

Definition at line 20 of file LDisp.h.

IHolder* CLDisp::m_pHolder [private]

Definition at line 19 of file LDisp.h.

CComPtr<IUnknown> CLDisp::m_pUnkMarshaler

Definition at line 65 of file LDisp.h.

The documentation for this class was generated from the following files:
  • Com/Services/Resource_Dispenser/LDisp.h
  • Com/Services/Resource_Dispenser/LDisp.Cpp
Generated on Wed Nov 13 2024 16:56:44 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CLERK_ENTRY Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

CLERK_ENTRY Struct Reference

#include "CrmMonCompObj.h"

List of all members.

Public Attributes

ICrmMonitorLogRecords * | m_pICrmMonitorLogRecords
_variant_t | m_vIndex

Detailed Description

Definition at line 68 of file CrmMonCompObj.h.

Member Data Documentation

ICrmMonitorLogRecords* CLERK_ENTRY::m_pICrmMonitorLogRecords

Definition at line 72 of file CrmMonCompObj.h.

_variant_t CLERK_ENTRY::m_vIndex

Definition at line 70 of file CrmMonCompObj.h.

The documentation for this struct was generated from the following file:
  • Com/Services/Crm/CrmMonitor/CrmMonCompObj.h
Generated on Wed Nov 13 2024 16:56:44 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ClientList Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Classes | Public Member Functions | Private Types | Private Attributes

ClientList Class Reference

#include "clntlst.h"

List of all members.

Classes

struct | _tag_LIST_NODE
class | Iterator

Public Member Functions

ClientList ()
~ClientList ()
VOID | GetIterator (OUT ClientList::Iterator &It) const
HRESULT | InsertBack (RqsClient *pClient)
HRESULT | RemoveItem (RqsClient *pClient)

Private Types

typedef struct
ClientList::_tag_LIST_NODE 		LISTNODE

Private Attributes

int | m_iCount
LISTNODE * m_pHead
LISTNODE * m_pTail

Detailed Description

Definition at line 15 of file clntlst.h.

Member Typedef Documentation

typedef struct ClientList::_tag_LIST_NODE ClientList::LISTNODE [private]

Constructor & Destructor Documentation

ClientList::ClientList ( ) [inline]

Definition at line 76 of file clntlst.h.

    {
        m_pHead = m_pTail = NULL;

ClientList::~ClientList ( ) [inline]

Definition at line 82 of file clntlst.h.

    {
        while (NULL != m_pHead)
        {
            LISTNODE* pTemp = m_pHead->pNext;
            RuFree(m_pHead);
            m_pHead = pTemp;

Member Function Documentation

VOID ClientList::GetIterator ( OUT ClientList::Iterator & It ) const [inline]

Definition at line 129 of file clntlst.h.

    {
        if (m_pHead)
        {
            It.m_pHead = m_pHead;
            It.m_pTail = m_pTail;
        }
        else
        {
            It.m_pHead = NULL;
            It.m_pTail = NULL;
        }

HRESULT ClientList::InsertBack ( RqsClient * pClient ) [inline]

Definition at line 92 of file clntlst.h.

    {
        HRESULT hr = S_OK;

        if (m_pTail)
        {
            m_pTail->pNext = (LISTNODE*)RuAlloc(sizeof(LISTNODE), TRUE);
            if(m_pTail->pNext)
            {
                m_pTail->pNext->pClient = pClient;
                m_pTail->pNext->pNext = NULL;
                m_pTail = m_pTail->pNext;
                m_iCount++;
            }
            else
            {
                hr = E_OUTOFMEMORY;
            }
        }
        else
        {
            m_pHead = m_pTail = (LISTNODE*)RuAlloc(sizeof(LISTNODE), TRUE);
            if (m_pHead)
            {
                m_pHead->pClient = pClient;
                m_pHead->pNext = NULL;
                m_iCount = 1;
            }
            else
            {
                hr = E_OUTOFMEMORY;
            }
        }

HRESULT ClientList::RemoveItem ( RqsClient * pClient ) [inline]

Definition at line 145 of file clntlst.h.

    {
        HRESULT hr = S_FALSE;
        //
        //  Remove the first node with the given Client pointer.
        //
        if (m_pHead)
        {
            LISTNODE* pCurrent = m_pHead;
            LISTNODE* pFollower = NULL;

      while (pCurrent)
      {
        if (pCurrent->pClient == pClient)
        {
          //
          //  We have an item to remove
          //
          if (pFollower)
          {
            pFollower->pNext = pCurrent->pNext;
            if (pCurrent == m_pTail)
            {
              m_pTail = pFollower;
            }
          }
          else
          {
            m_pHead = pCurrent->pNext;
            if(pCurrent == m_pTail)
            {
              m_pTail = m_pHead;
            }
          }

          RuFree(pCurrent);
          pCurrent = NULL;
          m_iCount--;
          hr = S_OK;
        }
        else
        {
          pFollower = pCurrent;
          pCurrent = pCurrent->pNext;
        }
      }
        }

Member Data Documentation

int ClientList::m_iCount [private]

Definition at line 24 of file clntlst.h.

LISTNODE* ClientList::m_pHead [private]

Definition at line 22 of file clntlst.h.

LISTNODE* ClientList::m_pTail [private]

Definition at line 23 of file clntlst.h.

The documentation for this class was generated from the following file:
  • NetDS/RRas/rqs/server/clntlst.h
Generated on Wed Nov 13 2024 16:56:44 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ClientList::_tag_LIST_NODE Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • ClientList
  • ClientList::_tag_LIST_NODE
Public Attributes

ClientList::_tag_LIST_NODE Struct Reference

List of all members.

Public Attributes

RqsClient * pClient
struct _tag_LIST_NODE * pNext

Detailed Description

Definition at line 16 of file clntlst.h.

Member Data Documentation

RqsClient* ClientList::_tag_LIST_NODE::pClient

Definition at line 16 of file clntlst.h.

struct _tag_LIST_NODE* ClientList::_tag_LIST_NODE::pNext

Definition at line 15 of file clntlst.h.

The documentation for this struct was generated from the following file:
  • NetDS/RRas/rqs/server/clntlst.h
Generated on Wed Nov 13 2024 16:56:44 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ClientList::Iterator Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • ClientList
  • ClientList::Iterator
Public Member Functions | Private Attributes

ClientList::Iterator Class Reference

#include "clntlst.h"

List of all members.

Public Member Functions

Iterator ()
~Iterator ()
BOOL | AtEnd () const
RqsClient * | GetItem () const
BOOL Next ()

Private Attributes

friend | ClientList
LISTNODE * m_pCurrent
LISTNODE * m_pHead
LISTNODE * m_pTail

Detailed Description

Definition at line 28 of file clntlst.h.

Constructor & Destructor Documentation

ClientList::Iterator::Iterator ( ) [inline]

Definition at line 33 of file clntlst.h.

:
        Iterator() : m_pHead(NULL), m_pTail(NULL), m_pCurrent(NULL){};

ClientList::Iterator::~Iterator ( ) [inline]

Definition at line 34 of file clntlst.h.

:
        Iterator() : m_pHead(NULL), m_pTail(NULL), m_pCurrent(NULL){};

Member Function Documentation

BOOL ClientList::Iterator::AtEnd ( ) const [inline]

Definition at line 52 of file clntlst.h.

        {

RqsClient* ClientList::Iterator::GetItem ( ) const [inline]

Definition at line 57 of file clntlst.h.

        {
            if (m_pCurrent)
            {
                return m_pCurrent->pClient;
            }
            else
            {
                return NULL;

BOOL ClientList::Iterator::Next ( ) [inline]

Definition at line 36 of file clntlst.h.

                    {};

        BOOL Next()
        {
            BOOL bReturn = TRUE;

            if (m_pCurrent)
            {
                m_pCurrent = m_pCurrent->pNext;
            }
            else
            {
                bReturn = FALSE;
            }

Member Data Documentation

friend ClientList::Iterator::ClientList [private]

Definition at line 30 of file clntlst.h.

LISTNODE* ClientList::Iterator::m_pCurrent [private]

Definition at line 73 of file clntlst.h.

LISTNODE* ClientList::Iterator::m_pHead [private]

Definition at line 71 of file clntlst.h.

LISTNODE* ClientList::Iterator::m_pTail [private]

Definition at line 72 of file clntlst.h.

The documentation for this class was generated from the following file:
  • NetDS/RRas/rqs/server/clntlst.h
Generated on Wed Nov 13 2024 16:56:44 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CLine Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Classes | Public Member Functions | Public Attributes | Private Attributes

CLine Class Reference

#include "Line.h"

Inherits IMyPersistStreamImpl< CLine >.

List of all members.

Classes

struct | LINEDATA

Public Member Functions

CLine ()
STDMETHOD() | get_x1 (long *pVal)
STDMETHOD() | get_x2 (long *pVal)
STDMETHOD() | get_y1 (long *pVal)
STDMETHOD() | get_y2 (long *pVal)
STDMETHOD() | IMyPersistStreamImpl_GetSizeMax (ULARGE_INTEGER FAR *pcbSize)
STDMETHOD() | IMyPersistStreamImpl_Load (LPSTREAM pStm)
STDMETHOD() | IMyPersistStreamImpl_Save (LPSTREAM pStm, BOOL fClearDirty)
STDMETHOD() | InterfaceSupportsErrorInfo (REFIID riid)
STDMETHOD() | put_x1 (long newVal)
STDMETHOD() | put_x2 (long newVal)
STDMETHOD() | put_y1 (long newVal)
STDMETHOD() | put_y2 (long newVal)

Public Attributes

BOOL m_bRequiresSave

Private Attributes

LINEDATA m_Line

Detailed Description

Definition at line 34 of file Line.h.

Constructor & Destructor Documentation

CLine::CLine ( ) [inline]

Definition at line 50 of file Line.h.

  {
  }

Member Function Documentation

STDMETHODIMP CLine::get_x1 ( long * pVal )

Definition at line 35 of file Line.Cpp.

{
  *pVal = m_Line.x1;
  return S_OK;
}

STDMETHODIMP CLine::get_x2 ( long * pVal )

Definition at line 62 of file Line.Cpp.

{
  *pVal = m_Line.x2;

  return S_OK;
}

STDMETHODIMP CLine::get_y1 ( long * pVal )

Definition at line 48 of file Line.Cpp.

{
  *pVal = m_Line.y1;

  return S_OK;
}

STDMETHODIMP CLine::get_y2 ( long * pVal )

Definition at line 76 of file Line.Cpp.

{
  *pVal = m_Line.y2;

  return S_OK;
}

STDMETHODIMP CLine::IMyPersistStreamImpl_GetSizeMax ( ULARGE_INTEGER FAR * pcbSize )

Definition at line 131 of file Line.Cpp.

{
  pcbSize->LowPart = (DWORD)(sizeof(LINEDATA));
  pcbSize->HighPart = 0L;
  return NOERROR;
}

STDMETHODIMP CLine::IMyPersistStreamImpl_Load ( LPSTREAM pStm )

Definition at line 90 of file Line.Cpp.

{
    ULONG           cb;
    HRESULT         hr;

    if (NULL==pIStream)
        return ResultFromScode(E_POINTER);
    //
    // Read an object from the stream.
    //
    hr=pIStream->Read(&m_Line, sizeof(LINEDATA), &cb);
    if (FAILED(hr))
        return hr;
    if (sizeof(LINEDATA) != cb)
        return E_FAIL;

  return NOERROR;
}

STDMETHODIMP CLine::IMyPersistStreamImpl_Save | ( | LPSTREAM | pStm,
 |  | BOOL | fClearDirty
 | ) |  |

Definition at line 111 of file Line.Cpp.

{
    ULONG           cb;
    HRESULT         hr;

    if (NULL==pIStream)
        return ResultFromScode(E_POINTER);

    //
    // Write an object into the stream.
    //
    hr=pIStream->Write(&m_Line, (ULONG)sizeof(LINEDATA), &cb);

    if (FAILED(hr) || sizeof(LINEDATA)!=cb)
       return ResultFromScode(STG_E_WRITEFAULT);

  return NOERROR;
}

STDMETHODIMP CLine::InterfaceSupportsErrorInfo ( REFIID riid )

Definition at line 20 of file Line.Cpp.

{
  static const IID* arr[] =
  {
    &IID_ILine,
  };
  for (int i=0;i<sizeof(arr)/sizeof(arr[0]);i++)
  {
    if ( ::InlineIsEqualGUID(*arr[i], riid) )

      return S_OK;
  }
  return S_FALSE;
}

STDMETHODIMP CLine::put_x1 ( long newVal )

Definition at line 41 of file Line.Cpp.

{
  m_Line.x1 = newVal;

  return S_OK;
}

STDMETHODIMP CLine::put_x2 ( long newVal )

Definition at line 69 of file Line.Cpp.

{
  m_Line.x2 = newVal;

  return S_OK;
}

STDMETHODIMP CLine::put_y1 ( long newVal )

Definition at line 55 of file Line.Cpp.

{
  m_Line.y1 = newVal;

  return S_OK;
}

STDMETHODIMP CLine::put_y2 ( long newVal )

Definition at line 83 of file Line.Cpp.

{
  m_Line.y2 = newVal;

  return S_OK;
}

Member Data Documentation

BOOL CLine::m_bRequiresSave

Definition at line 66 of file Line.h.

LINEDATA CLine::m_Line [private]

Definition at line 47 of file Line.h.

The documentation for this class was generated from the following files:
  • NetDS/MessageQueuing/MQPers/GraphObj/Line.h
  • NetDS/MessageQueuing/MQPers/GraphObj/Line.Cpp
Generated on Wed Nov 13 2024 16:56:44 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CLine::LINEDATA Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • CLine
  • CLine::LINEDATA
Public Attributes

CLine::LINEDATA Struct Reference

List of all members.

Public Attributes

long | x1
long | x2
long | y1
long | y2

Detailed Description

Definition at line 42 of file Line.h.

Member Data Documentation

long CLine::LINEDATA::x1

Definition at line 43 of file Line.h.

long CLine::LINEDATA::x2

Definition at line 44 of file Line.h.

long CLine::LINEDATA::y1

Definition at line 43 of file Line.h.

long CLine::LINEDATA::y2

Definition at line 44 of file Line.h.

The documentation for this struct was generated from the following file:
  • NetDS/MessageQueuing/MQPers/GraphObj/Line.h
Generated on Wed Nov 13 2024 16:56:44 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CLineGrid Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CLineGrid Class Reference

#include "Grid.Hxx"

Inherits CGrid.

List of all members.

Public Member Functions

CLineGrid (UINT cCol, UINT cRow, SIZE size)
void | Paint (CCanvas &canvas, RECT rc, POINT pt)
void | SetStyle (int iStyle=PS_DOT)
void | SetWeight (int nWeight=1)

Protected Attributes

int | _iStyle
int | _nWeight

Detailed Description

Definition at line 65 of file Grid.Hxx.

Constructor & Destructor Documentation

CLineGrid::CLineGrid | ( | UINT | cCol,
 |  | UINT | cRow,
 |  | SIZE | size
 | ) |  |

Definition at line 48 of file Grid.Cxx.

{
    _size = size;
    _cCol = cCol;
    _cRow = cRow;
    SetStyle();
    SetWeight();
}

Member Function Documentation

void CLineGrid::Paint | ( | CCanvas & | canvas,
 |  | RECT | rc,
 |  | POINT | pt |
 | ) |  |  | [virtual]

Implements CGrid.

Definition at line 67 of file Grid.Cxx.

{
    int cx, cy;
    UINT i;

    // set up pen
    CBlackPen pen(canvas, _iStyle, _nWeight);

    // Draw the grid
    for(cx = pt.x, i=0; i<=_cCol; i++, cx+=_size.cx )
    {
        if( cx >= rc.left && cx <= rc.right )
        {
            canvas.Line(cx, pt.y,
                        cx, pt.y+_cRow*_size.cy);
        }
    }
    for(cy = pt.y, i=0; i<=_cRow; i++, cy+=_size.cy )
    {
        if( cy >= rc.top && cy <= rc.bottom )
        {
            canvas.Line(pt.x,                cy,
                        pt.x+_cCol*_size.cx, cy);
        }
    }
}

void CLineGrid::SetStyle ( int iStyle = PS_DOT )

Definition at line 57 of file Grid.Cxx.

{
    _iStyle = iStyle;
}

void CLineGrid::SetWeight ( int nWeight = 1 )

Definition at line 62 of file Grid.Cxx.

{
    _nWeight = nWeight*20;  // internal twips, API is points
}

Member Data Documentation

int CLineGrid::_iStyle [protected]

Definition at line 73 of file Grid.Hxx.

int CLineGrid::_nWeight [protected]

Definition at line 74 of file Grid.Hxx.

The documentation for this class was generated from the following files:
  • Multimedia/Gdi/Fonts/GridFont/Grid.Hxx
  • Multimedia/Gdi/Fonts/GridFont/Grid.Cxx
Generated on Wed Nov 13 2024 16:56:44 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CLinkable Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CLinkable Class Reference

#include "linkable.h"

Inherited by CListHeader, and CThreadData.

List of all members.

Public Member Functions

CLinkable ()
~CLinkable ()
void | InsertAfter (CLinkable *other)
void | InsertBefore (CLinkable *other)
BOOL IsLinked ()
CLinkable * Next ()
CLinkable * Previous ()
void | Remove ()

Private Attributes

CLinkable * m_pNext
CLinkable * m_pPrev

Detailed Description

Definition at line 32 of file linkable.h.

Constructor & Destructor Documentation

CLinkable::CLinkable ( ) [inline]

Definition at line 37 of file linkable.h.

{ m_pNext = m_pPrev = this; }

CLinkable::~CLinkable ( ) [inline]

Definition at line 40 of file linkable.h.

{ Remove(); }

Member Function Documentation

void CLinkable::InsertAfter ( CLinkable * other )

Definition at line 37 of file linkable.Cpp.

{
  CLinkable* prev = that->m_pPrev;
  CLinkable* next = that->m_pNext;

  prev->m_pNext = next;
  next->m_pPrev = prev;

  next = this->m_pNext;

  this->m_pNext = that;
  that->m_pPrev = this;
  that->m_pNext = next;
  next->m_pPrev = that;
}

void CLinkable::InsertBefore ( CLinkable * other )

Definition at line 61 of file linkable.Cpp.

{
  CLinkable* prev = that->m_pPrev;
  CLinkable* next = that->m_pNext;

  prev->m_pNext = next;
  next->m_pPrev = prev;

  prev = this->m_pPrev;

  prev->m_pNext = that;
  that->m_pPrev = prev;
  that->m_pNext = this;
  this->m_pPrev = that;
}

BOOL CLinkable::IsLinked ( ) [inline]

Definition at line 43 of file linkable.h.

{ return ( m_pNext != this ); }

CLinkable* CLinkable::Next ( ) [inline]

Definition at line 46 of file linkable.h.

{ return m_pNext; }

CLinkable* CLinkable::Previous ( ) [inline]

Definition at line 49 of file linkable.h.

{ return m_pPrev; }

void CLinkable::Remove ( )

Definition at line 85 of file linkable.Cpp.

{
  CLinkable* prev = m_pPrev;
  CLinkable* next = m_pNext;

  prev->m_pNext = next;
  next->m_pPrev = prev;

  m_pPrev = m_pNext = this;
}

Member Data Documentation

CLinkable* CLinkable::m_pNext [private]

Definition at line 61 of file linkable.h.

CLinkable* CLinkable::m_pPrev [private]

Definition at line 62 of file linkable.h.

The documentation for this class was generated from the following files:
  • Com/Services/Object_Pooling/OPBankSample/OPBank/linkable.h
  • Com/Services/Object_Pooling/OPBankSample/OPBank/linkable.Cpp
Generated on Wed Nov 13 2024 16:56:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CList< TYPE, ARG_TYPE > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CList< TYPE, ARG_TYPE > Class Template Reference

#include "list.h"

List of all members.

Public Member Functions

CList ()
CList ()
virtual | ~CList ()
virtual | ~CList ()
virtual POSITION | AddHead (ARG_TYPE element)
virtual LISTPOS | AddHead (TYPE element)
virtual POSITION | AddTail (ARG_TYPE element)
virtual LISTPOS | AddTail (TYPE element)
virtual LISTPOS | Find (TYPE element)
virtual POSITION | Find (ARG_TYPE element, POSITION startAfter=NULL) const
virtual LISTPOS | FindIndex (ULONG iIndex)
virtual POSITION | FindIndex (ULONG iIndex) const
virtual TYPE | GetAt (POSITION position) const
virtual TYPE | GetAt (LISTPOS position) const
virtual TYPE & | GetAt (POSITION position)
virtual ULONG | GetCount ()
ULONG | GetCount () const
virtual TYPE | GetHead ()
TYPE | GetHead () const
TYPE & | GetHead ()
virtual LISTPOS | GetHeadPosition ()
POSITION | GetHeadPosition () const
virtual TYPE | GetNext (POSITION &position) const
virtual TYPE & | GetNext (POSITION &position)
virtual TYPE | GetNext (LISTPOS &position)
virtual TYPE | GetPrev (POSITION &position) const
virtual TYPE & | GetPrev (POSITION &position)
virtual TYPE | GetPrev (LISTPOS &position)
TYPE & | GetTail ()
virtual TYPE | GetTail ()
TYPE | GetTail () const
virtual LISTPOS | GetTailPosition ()
POSITION | GetTailPosition () const
virtual LISTPOS | InsertAfter (LISTPOS position, TYPE element)
virtual POSITION | InsertAfter (POSITION position, ARG_TYPE element)
virtual LISTPOS | InsertBefore (LISTPOS position, TYPE element)
virtual POSITION | InsertBefore (POSITION position, ARG_TYPE element)
BOOL | IsEmpty () const
virtual BOOL | IsEmpty ()
virtual void | RemoveAll ()
void | RemoveAll ()
virtual TYPE | RemoveAt (LISTPOS position)
virtual TYPE | RemoveAt (POSITION position)
virtual TYPE | RemoveHead ()
virtual TYPE | RemoveHead ()
virtual TYPE | RemoveTail ()
virtual TYPE | RemoveTail ()
virtual TYPE | SetAt (LISTPOS position, TYPE element)
virtual void | SetAt (POSITION position, ARG_TYPE element)

Private Attributes

CNode< TYPE > * | m_pHeadNode
CNode< TYPE > * | m_pNodeHead
CNode< TYPE > * | m_pNodeTail
CNode< TYPE > * | m_pTailNode
ULONG m_ulElements

Detailed Description

template<class TYPE, class ARG_TYPE>
class CList< TYPE, ARG_TYPE >

Definition at line 78 of file list.h.

Constructor & Destructor Documentation

template<class TYPE >
CList< TYPE >::CList ( )

Definition at line 140 of file list.h.

{
    //constructor
    m_pNodeHead        = NULL;
    m_pNodeTail        = NULL;
    m_ulElements    = 0;
}

template<class TYPE >
CList< TYPE >::~CList ( ) [virtual]

Definition at line 152 of file list.h.

{
    //Remove all elements
    RemoveAll();
}

template<class TYPE, class ARG_TYPE>
CList< TYPE, ARG_TYPE >::CList ( )
template<class TYPE, class ARG_TYPE>
virtual CList< TYPE, ARG_TYPE >::~CList ( ) [virtual]

Member Function Documentation

template<class TYPE , class ARG_TYPE>
POSITION CList< TYPE, ARG_TYPE >::AddHead ( ARG_TYPE element ) [virtual]

Definition at line 163 of file list.h.

{
    //Add to the Head of the CList, (stack)
    CNode<TYPE>* pNewNode = new CNode<TYPE>(NULL, m_pNodeHead);
    if(pNewNode)
    {
        pNewNode->m_data = element;

        //If there was a list hook the head->prev to the new head
        if(m_pNodeHead)
            m_pNodeHead->m_pPrev = pNewNode;
        else
            m_pNodeTail = pNewNode;

        m_pNodeHead = pNewNode;
        m_ulElements++;
    }
    return pNewNode;
}

template<class TYPE>
LISTPOS CList< TYPE >::AddHead ( TYPE element ) [virtual]

Definition at line 142 of file list.h.

{
  //Add to the Head of the CList, (stack)
  CNode<TYPE>* pHeadNode = new CNode<TYPE>(element, NULL, m_pHeadNode);
  ASSERT(pHeadNode);

  //If there was a list hook the head->prev to the new head
  if(m_pHeadNode)
    m_pHeadNode->m_pPrevNode = pHeadNode;

  //If there isn't a tail element, hook it to the head
  if(!m_pTailNode)
    m_pTailNode = pHeadNode;

  m_pHeadNode = pHeadNode;
  m_ulElements++;
  return m_pHeadNode;
}

template<class TYPE , class ARG_TYPE>
POSITION CList< TYPE, ARG_TYPE >::AddTail ( ARG_TYPE element ) [virtual]

Definition at line 188 of file list.h.

{
    //Add to the m_pNodeTail of the CList
    CNode<TYPE>* pNewNode = new CNode<TYPE>(m_pNodeTail, NULL);
    if(pNewNode)
    {
        pNewNode->m_data = element;

        if(m_pNodeTail != NULL)
            m_pNodeTail->m_pNext = pNewNode;
        else
            m_pNodeHead = pNewNode;

        m_pNodeTail = pNewNode;
        m_ulElements++;
    }
    return pNewNode;
}

template<class TYPE>
LISTPOS CList< TYPE >::AddTail ( TYPE element ) [virtual]

Definition at line 166 of file list.h.

{
  //Add to the m_pTailNode of the CList
  CNode<TYPE>* pTailNode = new CNode<TYPE>(element, m_pTailNode, 0);
  ASSERT(pTailNode);

  //if previously empty
  if(!m_pHeadNode)
    m_pHeadNode = pTailNode;
  else
    m_pTailNode->m_pNextNode = pTailNode;

  m_pTailNode = pTailNode;
  m_ulElements++;
  return m_pTailNode;
}

template<class TYPE>
LISTPOS CList< TYPE >::Find ( TYPE element ) [virtual]

Definition at line 296 of file list.h.

{
  //return pointer to found element
  for(CNode<TYPE>* p = m_pHeadNode; p; p = p->m_pNextNode)
    if(p->m_data == element)
    return p;   // return position to found CNode

  return NULL;  // return NULL if not found
}

template<class TYPE , class ARG_TYPE>
POSITION CList< TYPE, ARG_TYPE >::Find | ( | ARG_TYPE | element,
 |  | POSITION | startAfter = NULL |
 | ) |  |  | const [virtual]

Definition at line 520 of file list.h.

{
    CNode<TYPE>* pNode = m_pNodeHead;
    if(pPosAfter)
        pNode = ((CNode<TYPE>*)pPosAfter)->m_pNext;

    //return pointer to found element
    for(CNode<TYPE>* p = pNode; p != NULL; p = p->m_pNext)
      if(p->m_data == element)
        return p;   // return position to found CNode

    return NULL;  // return NULL if not found
}

template<class TYPE >
LISTPOS CList< TYPE >::FindIndex ( ULONG iIndex ) [virtual]

Definition at line 485 of file list.h.

{
  ASSERT(iIndex>=0 && iIndex<m_ulElements);

  CNode<TYPE>* pNode = m_pHeadNode;

  //Find the specified index
  while(iIndex--)
    pNode = pNode->m_pNextNode;

  return (LISTPOS)pNode;
}

template<class TYPE , class ARG_TYPE >
POSITION CList< TYPE, ARG_TYPE >::FindIndex ( ULONG iIndex ) const [virtual]

Definition at line 502 of file list.h.

{
    ASSERT(iIndex>=0 && iIndex<m_ulElements);

    CNode<TYPE>* pNode = m_pNodeHead;

    //Find the specified index
    while(iIndex--)
        pNode = pNode->m_pNext;

    return (POSITION)pNode;
}

template<class TYPE , class ARG_TYPE >
TYPE CList< TYPE, ARG_TYPE >::GetAt ( POSITION position ) const [virtual]

Definition at line 281 of file list.h.

{
    ASSERT(position);
    CNode<TYPE>* pNode = (CNode<TYPE>*)position;
    return pNode->m_data;
}

template<class TYPE >
TYPE CList< TYPE >::GetAt ( LISTPOS position ) const [inline, virtual]

Definition at line 266 of file list.h.

{
  ASSERT(position);
  return ((CNode<TYPE>*)position)->m_data;
}

template<class TYPE , class ARG_TYPE >
TYPE & CList< TYPE, ARG_TYPE >::GetAt ( POSITION position ) [virtual]

Definition at line 292 of file list.h.

{
    ASSERT(position);
    CNode<TYPE>* pNode = (CNode<TYPE>*)position;
    return pNode->m_data;
}

template<class TYPE >
ULONG CList< TYPE >::GetCount ( ) [inline, virtual]

Definition at line 422 of file list.h.

{
  // return the Length
  return m_ulElements;
}

template<class TYPE, class ARG_TYPE>
ULONG CList< TYPE, ARG_TYPE >::GetCount ( ) const [inline]

Definition at line 132 of file list.h.

{    return m_ulElements;    }

template<class TYPE, class ARG_TYPE>
virtual TYPE CList< TYPE, ARG_TYPE >::GetHead ( ) [virtual]
template<class TYPE, class ARG_TYPE>
TYPE CList< TYPE, ARG_TYPE >::GetHead ( ) const [inline]

Definition at line 111 of file list.h.

{     ASSERT(m_pNodeHead);    return m_pNodeHead->m_data;        }

template<class TYPE >
TYPE CList< TYPE >::GetHead ( ) [inline]

Definition at line 112 of file list.h.

{     ASSERT(m_pNodeHead);    return m_pNodeHead->m_data;        }

template<class TYPE >
LISTPOS CList< TYPE >::GetHeadPosition ( ) [inline, virtual]

Definition at line 189 of file list.h.

{
  //return Head element Position
  return m_pHeadNode;
}

template<class TYPE, class ARG_TYPE>
POSITION CList< TYPE, ARG_TYPE >::GetHeadPosition ( ) const [inline]

Definition at line 108 of file list.h.

{    return m_pNodeHead; }

template<class TYPE , class ARG_TYPE >
TYPE & CList< TYPE, ARG_TYPE >::GetNext ( POSITION & position ) [virtual]

Definition at line 230 of file list.h.

{
    ASSERT(position);

    //Set position to the next element
    CNode<TYPE>* pNode = (CNode<TYPE>*)position;
    position = pNode->m_pNext;

    //return the current element
    return pNode->m_data;
}

template<class TYPE >
TYPE CList< TYPE >::GetNext ( LISTPOS & position ) [inline, virtual]

Definition at line 232 of file list.h.

{
  ASSERT(position);

  //Set position to the next element
  CNode<TYPE>* pNode = (CNode<TYPE>*)position;
  position = pNode->m_pNextNode;

  //return the current element
  return pNode->m_data;
}

template<class TYPE , class ARG_TYPE >
TYPE CList< TYPE, ARG_TYPE >::GetNext ( POSITION & position ) const [virtual]

Definition at line 213 of file list.h.

{
    ASSERT(position);

    //Set position to the next element
    CNode<TYPE>* pNode = (CNode<TYPE>*)position;
    position = pNode->m_pNext;

    //return the current element
    return pNode->m_data;
}

template<class TYPE , class ARG_TYPE >
TYPE CList< TYPE, ARG_TYPE >::GetPrev ( POSITION & position ) const [virtual]

Definition at line 247 of file list.h.

{
    ASSERT(position);

    //Set position to the next element
    CNode<TYPE>* pNode = (CNode<TYPE>*)position;
    position = pNode->m_pPrev;

    //return the current element
    return pNode->m_data;
}

template<class TYPE , class ARG_TYPE >
TYPE & CList< TYPE, ARG_TYPE >::GetPrev ( POSITION & position ) [virtual]

Definition at line 264 of file list.h.

{
    ASSERT(position);

    //Set position to the next element
    CNode<TYPE>* pNode = (CNode<TYPE>*)position;
    position = pNode->m_pPrev;

    //return the current element
    return pNode->m_data;
}

template<class TYPE >
TYPE CList< TYPE >::GetPrev ( LISTPOS & position ) [inline, virtual]

Definition at line 249 of file list.h.

{
  ASSERT(position);

  //Set position to the next element
  CNode<TYPE>* pNode = (CNode<TYPE>*)position;
  position = pNode->m_pPrevNode;

  //return the current element
  return pNode->m_data;
}

template<class TYPE, class ARG_TYPE>
virtual TYPE CList< TYPE, ARG_TYPE >::GetTail ( ) [virtual]
template<class TYPE, class ARG_TYPE>
TYPE CList< TYPE, ARG_TYPE >::GetTail ( ) const [inline]

Definition at line 113 of file list.h.

{     ASSERT(m_pNodeTail);    return m_pNodeTail->m_data;        }

template<class TYPE >
TYPE CList< TYPE >::GetTail ( ) [inline]

Definition at line 114 of file list.h.

{     ASSERT(m_pNodeTail);    return m_pNodeTail->m_data;        }

template<class TYPE >
LISTPOS CList< TYPE >::GetTailPosition ( ) [inline, virtual]

Definition at line 199 of file list.h.

{
  //return Tail element Position
  return m_pTailNode;
}

template<class TYPE, class ARG_TYPE>
POSITION CList< TYPE, ARG_TYPE >::GetTailPosition ( ) const [inline]

Definition at line 109 of file list.h.

{    return m_pNodeTail; }

template<class TYPE , class ARG_TYPE>
POSITION CList< TYPE, ARG_TYPE >::InsertAfter | ( | POSITION | position,
 |  | ARG_TYPE | element |
 | ) |  |  | [virtual]

Definition at line 468 of file list.h.

{
    //insert after the position
    if(position == m_pNodeTail)     // Add after the m_pNodeTail
      return AddTail(element);

    CNode<TYPE>* pOldNode = (CNode<TYPE>*)position;

    //other wise a little more difficult
    CNode<TYPE>* pNewNode = new CNode<TYPE>(pOldNode, pOldNode->m_pNext);
    if(pNewNode)
    {
        pNewNode->m_data = element;

        //Hook up before after nodes to it
        if(pOldNode->m_pNext)
        {
            pOldNode->m_pNext->m_pPrev = pNewNode;
        }
        else
        {
            m_pNodeTail = pNewNode;
        }

        m_ulElements++;
    }
    return pNewNode;
}

template<class TYPE>
LISTPOS CList< TYPE >::InsertAfter | ( | LISTPOS | position,
 |  | TYPE | element |
 | ) |  |  | [virtual]

Definition at line 461 of file list.h.

{
  //insert after the position
  if(position == m_pTailNode)     // Add after the m_pTailNode
    return AddTail(element);

  CNode<TYPE>* pOldNode = (CNode<TYPE>*)position;

  //other wise a little more difficult
  CNode<TYPE>* pNewNode = new CNode<TYPE>(element, pOldNode, pOldNode->m_pNextNode);

  //Hook up before after nodes to it
  pOldNode->m_pNextNode->m_pPrevNode = pNewNode;
  pOldNode->m_pNextNode = pNewNode;

  m_ulElements++;
  return pNewNode;
}

template<class TYPE>
LISTPOS CList< TYPE >::InsertBefore | ( | LISTPOS | position,
 |  | TYPE | element |
 | ) |  |  | [virtual]

Definition at line 433 of file list.h.

{
  //insert before the position
  if(position == m_pHeadNode)    // Add before Head
    return AddHead(element);

  CNode<TYPE>* pOldNode = (CNode<TYPE>*)position;

  //otherwise a little more difficult
  CNode<TYPE>* pNewNode = new CNode<TYPE>(element, pOldNode->m_pPrevNode, pOldNode);

  //Create the new node
  pNewNode->m_pNextNode = new CNode<TYPE>(element, pOldNode->m_pPrevNode, pOldNode->m_pNextNode);

  //Hook up before after nodes to it
  pOldNode->m_pPrevNode->m_pNextNode = pNewNode;
  pOldNode->m_pPrevNode = pNewNode;

  m_ulElements++;
  return pNewNode;
}

template<class TYPE , class ARG_TYPE>
POSITION CList< TYPE, ARG_TYPE >::InsertBefore | ( | POSITION | position,
 |  | ARG_TYPE | element |
 | ) |  |  | [virtual]

Definition at line 433 of file list.h.

{
    //insert before the position
    if(position == m_pNodeHead)    // Add before Head
      return AddHead(element);

    CNode<TYPE>* pOldNode = (CNode<TYPE>*)position;

    //otherwise a little more difficult
    CNode<TYPE>* pNewNode = new CNode<TYPE>(pOldNode->m_pPrev, pOldNode);
    if(pNewNode)
    {
        pNewNode->m_data = element;

        //Hook up before after nodes to it
        if(pOldNode->m_pPrev)
        {
            pOldNode->m_pPrev->m_pNext = pNewNode;
        }
        else
        {
            m_pNodeHead = pNewNode;
        }

        m_ulElements++;
    }
    return pNewNode;
}

template<class TYPE, class ARG_TYPE>
BOOL CList< TYPE, ARG_TYPE >::IsEmpty ( void ) const [inline]

Definition at line 131 of file list.h.

{    return m_ulElements==0; }

template<class TYPE >
BOOL CList< TYPE >::IsEmpty ( void ) [inline, virtual]

Definition at line 311 of file list.h.

{
  // returns TRUE if Empty
  return m_ulElements == 0;
}

template<class TYPE >
void CList< TYPE >::RemoveAll ( )

Definition at line 412 of file list.h.

{
    // Remove all items from the CList
    CNode<TYPE>* pNode = m_pNodeHead;
    while(pNode)
    {
        CNode<TYPE>* pTemp = pNode;
        pNode = pNode->m_pNext;
        delete pTemp;
    }

    m_pNodeHead   = NULL;
    m_pNodeTail   = NULL;
    m_ulElements    = 0;
}

template<class TYPE, class ARG_TYPE>
virtual void CList< TYPE, ARG_TYPE >::RemoveAll ( ) [virtual]
template<class TYPE >
TYPE CList< TYPE >::RemoveAt ( LISTPOS position ) [virtual]

Definition at line 371 of file list.h.

{
  //Remove CList[position]
  ASSERT(position);

  CNode<TYPE>* pNode = (CNode<TYPE>*)position;
  TYPE oldData = pNode->m_data;

  // If removing the head
  if (pNode == m_pHeadNode)
    m_pHeadNode = pNode->m_pNextNode;
  else
    pNode->m_pPrevNode->m_pNextNode = pNode->m_pNextNode;

  //If removing the tail
  if (pNode == m_pTailNode)
    m_pTailNode = pNode->m_pPrevNode;
  else
    pNode->m_pNextNode->m_pPrevNode = pNode->m_pPrevNode;

  m_ulElements--;
  delete pNode;
  return oldData;
}

template<class TYPE , class ARG_TYPE >
TYPE CList< TYPE, ARG_TYPE >::RemoveAt ( POSITION position ) [virtual]

Definition at line 377 of file list.h.

{
    //Remove CList[position]
    ASSERT(position);
    CNode<TYPE>* pOldNode = (CNode<TYPE>*)position;
    TYPE element = GetAt(position);  //make a copy before deleteing

    // If removing the head
    if(pOldNode == m_pNodeHead)
    {
        m_pNodeHead = pOldNode->m_pNext;
    }
    else
    {
        pOldNode->m_pPrev->m_pNext = pOldNode->m_pNext;
    }

    if (pOldNode == m_pNodeTail)
    {
        m_pNodeTail = pOldNode->m_pPrev;
    }
    else
    {
        pOldNode->m_pNext->m_pPrev = pOldNode->m_pPrev;
    }

    m_ulElements--;
    delete pOldNode;
    return element;
}

template<class TYPE >
TYPE CList< TYPE >::RemoveHead ( ) [virtual]

Definition at line 319 of file list.h.

{
    //Remove and return from the Head of the List
    ASSERT(m_pNodeHead);

    CNode<TYPE>* pOldHead = m_pNodeHead;    // pointer to the Removed node
    TYPE element = GetHead();                //make a copy, before deleteing

    m_pNodeHead = pOldHead->m_pNext;    // reroute Head to exclude the first element
    if(m_pNodeHead)
    {
        ASSERT(m_pNodeTail);
        m_pNodeHead->m_pPrev = NULL;
    }
    else
    {
        m_pNodeTail = NULL;
    }

    m_ulElements--;
    delete pOldHead;                        // delete head
    return element;
}

template<class TYPE, class ARG_TYPE>
virtual TYPE CList< TYPE, ARG_TYPE >::RemoveHead ( ) [virtual]
template<class TYPE, class ARG_TYPE>
virtual TYPE CList< TYPE, ARG_TYPE >::RemoveTail ( ) [virtual]
template<class TYPE >
TYPE CList< TYPE >::RemoveTail ( ) [virtual]

Definition at line 348 of file list.h.

{
    //Remove and return from the m_pNodeTail of the CList
    ASSERT(m_pNodeTail);

    CNode<TYPE>* pOldTail = m_pNodeTail;
    TYPE element = GetTail();  //make a copy before deleteing

    m_pNodeTail = pOldTail->m_pPrev;
    if(m_pNodeTail)
    {
        ASSERT(m_pNodeHead);
        m_pNodeTail->m_pNext = NULL;
    }
    else
    {
        m_pNodeHead = NULL;
    }

    m_ulElements--;
    delete pOldTail;
    return element;
}

template<class TYPE>
TYPE CList< TYPE >::SetAt | ( | LISTPOS | position,
 |  | TYPE | element |
 | ) |  |  | [inline, virtual]

Definition at line 276 of file list.h.

{
  ASSERT(position);

  //Save the old data
  CNode<TYPE>* pNode = (CNode<TYPE>*)position;
  TYPE oldData = pNode->m_data;

  //Store new data
  pNode->m_data = element;

  //return olddata
  return oldData;
}

template<class TYPE , class ARG_TYPE>
void CList< TYPE, ARG_TYPE >::SetAt | ( | POSITION | position,
 |  | ARG_TYPE | element |
 | ) |  |  | [virtual]

Definition at line 303 of file list.h.

{
    ASSERT(position);

    //Save the old data
    CNode<TYPE>* pNode = (CNode<TYPE>*)position;

    //Store new data
    pNode->m_data = element;
}

Member Data Documentation

template<class TYPE, class ARG_TYPE>
CNode<TYPE>* CList< TYPE, ARG_TYPE >::m_pHeadNode [private]

Definition at line 108 of file list.h.

template<class TYPE, class ARG_TYPE>
CNode<TYPE>* CList< TYPE, ARG_TYPE >::m_pNodeHead [private]

Definition at line 89 of file list.h.

template<class TYPE, class ARG_TYPE>
CNode<TYPE>* CList< TYPE, ARG_TYPE >::m_pNodeTail [private]

Definition at line 90 of file list.h.

template<class TYPE, class ARG_TYPE>
CNode<TYPE>* CList< TYPE, ARG_TYPE >::m_pTailNode [private]

Definition at line 109 of file list.h.

template<class TYPE, class ARG_TYPE>
ULONG CList< TYPE, ARG_TYPE >::m_ulElements [private]

Definition at line 92 of file list.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/list.h
  • Dataaccess/oledb/tablecopy/list.h
Generated on Wed Nov 13 2024 16:56:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CListBoxLite Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CListBoxLite Class Reference

#include "cdialoglite.h"

Inherits CWndLite.

Inherited by CDSLContextBox.

List of all members.

Public Member Functions

CListBoxLite (HWND hWndParent=NULL, UINT nID=0)
virtual | ~CListBoxLite ()
virtual INDEX | AddString (WCHAR *pwszString)
virtual INDEX | DeleteString (WPARAM wParam)
virtual INDEX | GetCount ()
virtual INDEX | GetCurSel () const
virtual LPARAM | GetItemParam (INDEX nIndex) const
virtual INDEX | GetText (INDEX nIndex, WCHAR *pwszBuffer)
virtual INDEX | GetTextLen (INDEX nIndex)
virtual BOOL | OnCommandNotify (INT wNotifyCode, INT iID, HWND hWndCtrl)
virtual BOOL | OnDblClk (INT iID, HWND hWndCtrl)
virtual INDEX | SetCurSel (WPARAM nSelect)
virtual BOOL | SetItemParam (INDEX nIndex, LPARAM lParam)

Detailed Description

Definition at line 664 of file cdialoglite.h.

Constructor & Destructor Documentation

CListBoxLite::CListBoxLite | ( | HWND | hWndParent = NULL,
 |  | UINT | nID = 0
 | ) |  |

Definition at line 2926 of file cdialoglite.cpp.

  : CWndLite(hWndParent, nID)
{
}

CListBoxLite::~CListBoxLite ( ) [virtual]

Definition at line 2936 of file cdialoglite.cpp.

{
}

Member Function Documentation

virtual INDEX CListBoxLite::AddString ( WCHAR * pwszString ) [inline, virtual]

Definition at line 680 of file cdialoglite.h.

{ return (INDEX)wSendMessage(m_hWnd,  LB_ADDSTRING, 0, pwszString);       }

virtual INDEX CListBoxLite::DeleteString ( WPARAM wParam ) [inline, virtual]

Definition at line 681 of file cdialoglite.h.

{ return (INDEX)wSendMessage(m_hWnd,  LB_DELETESTRING, wParam, 0);    }

virtual INDEX CListBoxLite::GetCount ( ) [inline, virtual]

Definition at line 688 of file cdialoglite.h.

{ return (INDEX)::SendMessage(m_hWnd, LB_GETCOUNT, 0, 0); }

virtual INDEX CListBoxLite::GetCurSel ( ) const [inline, virtual]

Definition at line 679 of file cdialoglite.h.

{ return (INDEX)::SendMessage(m_hWnd, LB_GETCURSEL, 0, 0);            }

virtual LPARAM CListBoxLite::GetItemParam ( INDEX nIndex ) const [inline, virtual]

Definition at line 686 of file cdialoglite.h.

{ return ::SendMessage(m_hWnd,  LB_GETITEMDATA, nIndex, 0);         }

virtual INDEX CListBoxLite::GetText | ( | INDEX | nIndex,
 |  | WCHAR * | pwszBuffer |
 | ) |  |  | [inline, virtual]

Definition at line 682 of file cdialoglite.h.

{ return (INDEX)wSendMessage(m_hWnd,  LB_GETTEXT, nIndex, pwszBuffer);      }

virtual INDEX CListBoxLite::GetTextLen ( INDEX nIndex ) [inline, virtual]

Definition at line 683 of file cdialoglite.h.

{ return (INDEX)::SendMessage(m_hWnd, LB_GETTEXTLEN, nIndex, 0); }

BOOL CListBoxLite::OnCommandNotify | ( | INT | wNotifyCode,
 |  | INT | iID,
 |  | HWND | hWndCtrl |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 2945 of file cdialoglite.cpp.

{
  switch(wNotifyCode)
  {
    case LBN_DBLCLK:
    {
      if(OnDblClk(iID, hWndCtrl))
        return TRUE;
      break;
    }
  };

  //Otherwise Delegate
  return CWndLite::OnCommandNotify(wNotifyCode, iID, hWndCtrl);
}

BOOL CListBoxLite::OnDblClk | ( | INT | iID,
 |  | HWND | hWndCtrl |
 | ) |  |  | [virtual]

Definition at line 2966 of file cdialoglite.cpp.

{
  return FALSE;
}

virtual INDEX CListBoxLite::SetCurSel ( WPARAM nSelect ) [inline, virtual]

Definition at line 678 of file cdialoglite.h.

{ return (INDEX)::SendMessage(m_hWnd, LB_SETCURSEL, nSelect, 0);      }

virtual BOOL CListBoxLite::SetItemParam | ( | INDEX | nIndex,
 |  | LPARAM | lParam |
 | ) |  |  | [inline, virtual]

Definition at line 685 of file cdialoglite.h.

{ return ::SendMessage(m_hWnd,  LB_SETITEMDATA, nIndex, lParam) != CB_ERR;      }

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialoglite.h
  • Dataaccess/oledb/rowsetviewer/cdialoglite.cpp
Generated on Wed Nov 13 2024 16:56:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CListener Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CListener Class Reference

#include "clistener.h"

List of all members.

Public Member Functions

CListener ()
virtual | ~CListener ()
virtual HRESULT | Advise (IConnectionPoint *pIConnectionPoint, DWORD *pdwCookie)
virtual HRESULT | Advise (CContainerBase *pCCPointBase, REFIID riid, DWORD *pdwCookie)
virtual HRESULT | GetReturnValue ()
STDMETHODIMP | OnFieldChange (IRowset *pIRowset, HROW hRow, DBORDINAL cColumns, DBORDINAL rgColumns[], DBREASON eReason, DBEVENTPHASE ePhase, BOOL fCantDeny)
STDMETHODIMP | OnLowResource (DB_DWRESERVE dwReserved)
STDMETHODIMP | OnProgress (HCHAPTER hChapter, DBASYNCHOP eOperation, DBCOUNTITEM ulProgress, DBCOUNTITEM ulProgressMax, DBASYNCHPHASE eAsynchPhase, LPOLESTR pwszStatusText)
STDMETHODIMP | OnRowChange (IRowset *pIRowset, DBCOUNTITEM cRows, const HROW rghRows[], DBREASON eReason, DBEVENTPHASE ePhase, BOOL fCantDeny)
STDMETHODIMP | OnRowPositionChange (DBREASON eReason, DBEVENTPHASE ePhase, BOOL fCantDeny)
STDMETHODIMP | OnRowsetChange (IRowset *pIRowset, DBREASON eReason, DBEVENTPHASE ePhase, BOOL fCantDeny)
STDMETHODIMP | OnStop (HCHAPTER hChapter, DBASYNCHOP eOperation, HRESULT hrStatus, LPOLESTR pwszStatusText)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
virtual HRESULT | SetReturnValue (HRESULT hrReturn)
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) AddRef(void)
virtual HRESULT | Unadvise (IConnectionPoint *pIConnectionPoint, DWORD *pdwCookie)
virtual HRESULT | Unadvise (CContainerBase *pCCPointBase, REFIID riid, DWORD *pdwCookie)

Protected Attributes

ULONG m_cRef
HRESULT | m_hrReturn

Detailed Description

Definition at line 25 of file clistener.h.

Constructor & Destructor Documentation

CListener::CListener ( )

Definition at line 22 of file clistener.cpp.

{
  m_cRef = 1;
  m_hrReturn = S_OK;
}

CListener::~CListener ( ) [virtual]

Definition at line 32 of file clistener.cpp.

{
}

Member Function Documentation

HRESULT CListener::Advise | ( | CContainerBase * | pCCPointBase,
 |  | REFIID | riid,
 |  | DWORD * | pdwCookie |
 | ) |  |  | [virtual]

Definition at line 59 of file clistener.cpp.

{
  HRESULT hr = S_OK;
  ASSERT(pCPoint);
  CComPtr<IConnectionPoint> spCP;

  if(pCPoint->m_pIConnectionPointContainer)
  {
    //Obtain the connection point
    hr = pCPoint->FindConnectionPoint(riid, &spCP);
    if(SUCCEEDED(hr))
    {
      //Delegate
      TESTC(hr = Advise(spCP, pdwCookie));
    }
  }

CLEANUP:
  return hr;
}

HRESULT CListener::Advise | ( | IConnectionPoint * | pIConnectionPoint,
 |  | DWORD * | pdwCookie |
 | ) |  |  | [virtual]

Definition at line 85 of file clistener.cpp.

{
  HRESULT hr = S_OK;

  if(pIConnectionPoint)
  {
    //Now we can advise the connection
    //TODO64: Note COM has not changed the Advise output cookie, so we still display it as 0x%08x instead of 0x%p
    XTEST(hr = pIConnectionPoint->Advise((IRowsetNotify*)this, pdwCookie));
    TESTC(TRACE_METHOD(hr, L"IConnectionPoint::Advise(0x%p, &0x%08x)", this, pdwCookie ? *pdwCookie : 0));
  }

CLEANUP:
  return hr;
}

HRESULT CListener::GetReturnValue ( ) [virtual]

Definition at line 50 of file clistener.cpp.

{
  return m_hrReturn;
}

STDMETHODIMP CListener::OnFieldChange | ( | IRowset * | pIRowset,
 |  | HROW | hRow,
 |  | DBORDINAL | cColumns,
 |  | DBORDINAL | rgColumns[],
 |  | DBREASON | eReason,
 |  | DBEVENTPHASE | ePhase,
 |  | BOOL | fCantDeny
 | ) |  |
STDMETHODIMP CListener::OnLowResource ( DB_DWRESERVE dwReserved )

Definition at line 278 of file clistener.cpp.

{
  //Output Notification
  return TRACE_NOTIFICATION(NOTIFY_IDBASYNCHNOTIFY, m_hrReturn, L"IDBAsynchNotify", L"OnLowResource", L"(0x%p)", dwReserved);
}

STDMETHODIMP CListener::OnProgress | ( | HCHAPTER | hChapter,
 |  | DBASYNCHOP | eOperation,
 |  | DBCOUNTITEM | ulProgress,
 |  | DBCOUNTITEM | ulProgressMax,
 |  | DBASYNCHPHASE | eAsynchPhase,
 |  | LPOLESTR | pwszStatusText
 | ) |  |

Definition at line 291 of file clistener.cpp.

{
  //Output Notification
  return TRACE_NOTIFICATION(NOTIFY_IDBASYNCHNOTIFY, m_hrReturn, L"IDBAsynchNotify", L"OnProgress", L"(0x%p, %s, %lu, %lu, %s, %s)", hChapter, GetAsynchReason(eOperation), ulProgress, ulProgressMax, GetAsynchPhase(eAsynchPhase), pwszStatusText);
}

STDMETHODIMP CListener::OnRowChange | ( | IRowset * | pIRowset,
 |  | DBCOUNTITEM | cRows,
 |  | const HROW | rghRows[],
 |  | DBREASON | eReason,
 |  | DBEVENTPHASE | ePhase,
 |  | BOOL | fCantDeny
 | ) |  |
STDMETHODIMP CListener::OnRowPositionChange | ( | DBREASON | eReason,
 |  | DBEVENTPHASE | ePhase,
 |  | BOOL | fCantDeny
 | ) |  |

Definition at line 325 of file clistener.cpp.

{
  //Output Notification
  return TRACE_NOTIFICATION(NOTIFY_IROWPOSITIONCHANGE, m_hrReturn, L"IRowPositionChange", L"OnRowPositionChange", L"(%s, %s, %s)", GetReasonName(eReason), GetPhaseName(ePhase), fCantDeny ? L"TRUE" : L"FALSE");
}

STDMETHODIMP CListener::OnRowsetChange | ( | IRowset * | pIRowset,
 |  | DBREASON | eReason,
 |  | DBEVENTPHASE | ePhase,
 |  | BOOL | fCantDeny
 | ) |  |
STDMETHODIMP CListener::OnStop | ( | HCHAPTER | hChapter,
 |  | DBASYNCHOP | eOperation,
 |  | HRESULT | hrStatus,
 |  | LPOLESTR | pwszStatusText
 | ) |  |
STDMETHODIMP CListener::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 178 of file clistener.cpp.

{
  if(!ppv)
    return E_INVALIDARG;
  *ppv = NULL;

  if(riid == IID_IUnknown)
    *ppv = (IUnknown*)(IRowsetNotify*)this;
  else if(riid == IID_IRowsetNotify)
    *ppv = (IRowsetNotify*)this;
  else if(riid == IID_IDBAsynchNotify)
    *ppv = (IDBAsynchNotify*)this;
  else if(riid == IID_IRowPositionChange)
    *ppv = (IRowPositionChange*)this;

  if(*ppv)
  {
    ((IUnknown*)*ppv)->AddRef();
    return S_OK;
  }
  else
  {
    return E_NOINTERFACE;
  }

}

HRESULT CListener::SetReturnValue ( HRESULT hrReturn ) [virtual]

Definition at line 40 of file clistener.cpp.

{
  m_hrReturn = hrReturn;
  return S_OK;
}

CListener::STDMETHODIMP_ ( ULONG )
CListener::STDMETHODIMP_ ( ULONG )
HRESULT CListener::Unadvise | ( | CContainerBase * | pCCPointBase,
 |  | REFIID | riid,
 |  | DWORD * | pdwCookie |
 | ) |  |  | [virtual]

Definition at line 106 of file clistener.cpp.

{
  HRESULT hr = S_OK;
  ASSERT(pCCPointBase);
  ASSERT(pdwCookie);
  CComPtr<IConnectionPoint> spCP;

  if(*pdwCookie && pCCPointBase->m_pIConnectionPointContainer)
  {
    //Obtain the connection point
    hr = pCCPointBase->FindConnectionPoint(riid, &spCP);
    if(SUCCEEDED(hr))
    {
      //Delegate
      TESTC(hr = Unadvise(spCP, pdwCookie));
    }
  }

CLEANUP:
  return hr;
}

HRESULT CListener::Unadvise | ( | IConnectionPoint * | pIConnectionPoint,
 |  | DWORD * | pdwCookie |
 | ) |  |  | [virtual]

Definition at line 133 of file clistener.cpp.

{
  HRESULT hr = S_OK;
  ASSERT(pdwCookie);

  if(pIConnectionPoint)
  {
    //Now we can Unadvise the connection
    XTEST(hr = pIConnectionPoint->Unadvise(*pdwCookie));
    TESTC(TRACE_METHOD(hr, L"IConnectionPoint::Unadvise(0x%08x)", *pdwCookie));
    *pdwCookie = 0;
  }

CLEANUP:
  return hr;
}

Member Data Documentation

ULONG CListener::m_cRef [protected]

Definition at line 113 of file clistener.h.

HRESULT CListener::m_hrReturn [protected]

Definition at line 114 of file clistener.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/clistener.h
  • Dataaccess/oledb/rowsetviewer/clistener.cpp
Generated on Wed Nov 13 2024 16:56:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CListHeader Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CListHeader Class Reference

#include "linkable.h"

Inherits CLinkable.

List of all members.

Public Member Functions

CListHeader ()
~CListHeader ()
CLinkable * First ()
void | InsertFirst (CLinkable *other)
void | InsertLast (CLinkable *other)
BOOL IsEmpty ()
CLinkable * Last ()

Detailed Description

Definition at line 71 of file linkable.h.

Constructor & Destructor Documentation

CListHeader::CListHeader ( ) [inline]

Definition at line 77 of file linkable.h.

{}

CListHeader::~CListHeader ( ) [inline]

Definition at line 80 of file linkable.h.

{};

Member Function Documentation

CLinkable* CListHeader::First ( ) [inline]

Definition at line 86 of file linkable.h.

{ return Next(); }

void CListHeader::InsertFirst ( CLinkable * other ) [inline]

Definition at line 92 of file linkable.h.

{ InsertAfter( other ); }

void CListHeader::InsertLast ( CLinkable * other ) [inline]

Definition at line 95 of file linkable.h.

{ InsertBefore( other ); }

BOOL CListHeader::IsEmpty ( void ) [inline]

Definition at line 83 of file linkable.h.

{ return !IsLinked(); }

CLinkable* CListHeader::Last ( ) [inline]

Definition at line 89 of file linkable.h.

{ return Previous(); }

The documentation for this class was generated from the following file:
  • Com/Services/Object_Pooling/OPBankSample/OPBank/linkable.h
Generated on Wed Nov 13 2024 16:56:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CListViewLite Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CListViewLite Class Reference

#include "cdialoglite.h"

Inherits CSplitterLite.

Inherited by CDataGrid.

List of all members.

Public Member Functions

CListViewLite (HWND hWndParent=NULL, UINT nID=0)
virtual | ~CListViewLite ()
BOOL DeleteAllItems ()
BOOL | DeleteColumn (INDEX nCol)
BOOL | DeleteItem (INDEX iItem)
HWND | EditLabel (INDEX iItem)
BOOL | EnsureVisible (INDEX iItem, bool fPartialOK=FALSE)
INDEX | GetColumnWidth (INDEX nCol)
INDEX GetCountPerPage ()
INDEX GetItemCount ()
INT | GetItemImage (INDEX iItem, INDEX iSubItem=0)
LPARAM | GetItemParam (INDEX iItem)
UINT | GetItemState (INDEX iItem, UINT nMask)
INDEX | GetItemText (INDEX iItem, INDEX iSubItem, WCHAR *wszName, ULONG ulMaxChars)
INDEX | GetNextItem (INDEX iItem, INT nFlags)
INDEX | HitTest (REFPOINTS pts, UINT *pFlags=NULL, BOOL fClientCoords=TRUE)
INDEX | InsertColumn (INDEX iColumn, WCHAR *wszName, INT iImage=IMAGE_NONE)
INDEX | InsertItem (INDEX iItem, INDEX iSubItem, WCHAR *wszName, LPARAM lParam=PARAM_NONE, INT iImage=IMAGE_NONE, UINT iState=IMAGE_NONE, UINT iStateMask=IMAGE_NONE)
virtual BOOL | OnColumnClick (INT idCtrl, NMLISTVIEW *pNMListView)
virtual BOOL | OnCreate (CREATESTRUCT *pCREATESTRUCT)
virtual BOOL | OnItemActivate (INT idCtrl, NMLISTVIEW *pNMListView)
virtual BOOL | OnItemChanged (INT idCtrl, NMLISTVIEW *pNMListView)
virtual BOOL | OnNotify (INT idCtrl, NMHDR *pNMHDR)
BOOL | SetColumn (INDEX iColumn, WCHAR *wszName, INT iImage=IMAGE_NONE)
BOOL | SetColumnWidth (INDEX nCol, INT cx)
BOOL | SetItemImage (INDEX iItem, INDEX iSubItem, INT iImage)
BOOL | SetItemParam (INDEX iItem, INDEX iSubItem, LPARAM lParam)
BOOL | SetItemState (INDEX iItem, INDEX iSubItem, UINT iState, UINT iStateMask)
BOOL | SetItemText (INDEX iItem, INDEX iSubItem, WCHAR *pwszName)

Detailed Description

Definition at line 700 of file cdialoglite.h.

Constructor & Destructor Documentation

CListViewLite::CListViewLite | ( | HWND | hWndParent = NULL,
 |  | UINT | nID = 0
 | ) |  |

Definition at line 2976 of file cdialoglite.cpp.

  : CSplitterLite(hWndParent, nID)
{
}

CListViewLite::~CListViewLite ( ) [virtual]

Definition at line 2986 of file cdialoglite.cpp.

{
}

Member Function Documentation

BOOL CListViewLite::DeleteAllItems ( ) [inline]

Definition at line 718 of file cdialoglite.h.

{ return (BOOL)SendMessage(m_hWnd, LVM_DELETEALLITEMS, 0, 0L);                }

BOOL CListViewLite::DeleteColumn ( INDEX nCol ) [inline]

Definition at line 716 of file cdialoglite.h.

{ return (BOOL)SendMessage(m_hWnd, LVM_DELETECOLUMN, nCol, 0);                }

BOOL CListViewLite::DeleteItem ( INDEX iItem ) [inline]

Definition at line 717 of file cdialoglite.h.

{ return (BOOL)SendMessage(m_hWnd, LVM_DELETEITEM, iItem, 0L);                }

HWND CListViewLite::EditLabel ( INDEX iItem ) [inline]

Definition at line 726 of file cdialoglite.h.

{ return (HWND)SendMessage(m_hWnd, LVM_EDITLABEL, iItem, 0L);               }

BOOL CListViewLite::EnsureVisible | ( | INDEX | iItem,
 |  | bool | fPartialOK = FALSE |
 | ) |  |  | [inline]

Definition at line 723 of file cdialoglite.h.

{ return (BOOL)SendMessage(m_hWnd, LVM_ENSUREVISIBLE, iItem, MAKELPARAM(fPartialOK, 0));  }

INDEX CListViewLite::GetColumnWidth ( INDEX nCol ) [inline]

Definition at line 720 of file cdialoglite.h.

{ return (INDEX)SendMessage(m_hWnd, LVM_GETCOLUMNWIDTH, nCol, 0);             }

INDEX CListViewLite::GetCountPerPage ( ) [inline]

Definition at line 725 of file cdialoglite.h.

{ return (INDEX)SendMessage(m_hWnd, LVM_GETCOUNTPERPAGE, 0, 0);               }

INDEX CListViewLite::GetItemCount ( ) [inline]

Definition at line 724 of file cdialoglite.h.

{ return (INDEX)SendMessage(m_hWnd, LVM_GETITEMCOUNT, 0, 0);                }

INT CListViewLite::GetItemImage | ( | INDEX | iItem,
 |  | INDEX | iSubItem = 0
 | ) |  |

Definition at line 3086 of file cdialoglite.cpp.

{
  return LV_GetItemImage(m_hWnd, iItem, iSubItem);
}

LPARAM CListViewLite::GetItemParam ( INDEX iItem )

Definition at line 3157 of file cdialoglite.cpp.

{
  return LV_GetItemParam(m_hWnd, iItem, 0);
}

UINT CListViewLite::GetItemState | ( | INDEX | iItem,
 |  | UINT | nMask |
 | ) |  |  | [inline]

Definition at line 722 of file cdialoglite.h.

{ return (UINT)SendMessage(m_hWnd, LVM_GETITEMSTATE, iItem, nMask);             }

INDEX CListViewLite::GetItemText | ( | INDEX | iItem,
 |  | INDEX | iSubItem,
 |  | WCHAR * | wszName,
 |  | ULONG | ulMaxChars
 | ) |  |

Definition at line 3166 of file cdialoglite.cpp.

{
  return LV_GetItemText(m_hWnd, iItem, iSubItem, wszName, ulMaxChars);
}

INDEX CListViewLite::GetNextItem | ( | INDEX | iItem,
 |  | INT | nFlags |
 | ) |  |  | [inline]

Definition at line 719 of file cdialoglite.h.

{ return (INDEX)SendMessage(m_hWnd, LVM_GETNEXTITEM, iItem, MAKELPARAM(nFlags, 0));     }

INDEX CListViewLite::HitTest | ( | REFPOINTS | pts,
 |  | UINT * | pFlags = NULL,
 |  | BOOL | fClientCoords = TRUE
 | ) |  |

Definition at line 3176 of file cdialoglite.cpp.

{
  LVHITTESTINFO lvHitInfo = {{pts.x, pts.y}, 0, 0};
  if(!fClientCoords)
    ScreenToClient(m_hWnd, &lvHitInfo.pt);

  //LVM_HITTEST
  INDEX iItem = (INDEX)SendMessage(m_hWnd, LVM_HITTEST, 0, (LPARAM)&lvHitInfo);
  if(pFlags)
    *pFlags = lvHitInfo.flags;

  return iItem;
}

INDEX CListViewLite::InsertColumn | ( | INDEX | iColumn,
 |  | WCHAR * | wszName,
 |  | INT | iImage = IMAGE_NONE
 | ) |  |

Definition at line 3148 of file cdialoglite.cpp.

{
  return LV_InsertColumn(m_hWnd, iColumn, wszName, iImage);
}

INDEX CListViewLite::InsertItem | ( | INDEX | iItem,
 |  | INDEX | iSubItem,
 |  | WCHAR * | wszName,
 |  | LPARAM | lParam = PARAM_NONE,
 |  | INT | iImage = IMAGE_NONE,
 |  | UINT | iState = IMAGE_NONE,
 |  | UINT | iStateMask = IMAGE_NONE
 | ) |  |

Definition at line 3056 of file cdialoglite.cpp.

{
  return LV_InsertItem(m_hWnd, iItem, iSubItem, wszName, lParam, iImage, iState, iStateMask);
}

BOOL CListViewLite::OnColumnClick | ( | INT | idCtrl,
 |  | NMLISTVIEW * | pNMListView |
 | ) |  |  | [virtual]

Reimplemented in CDataGrid.

Definition at line 3027 of file cdialoglite.cpp.

{
  return FALSE;
}

BOOL CListViewLite::OnCreate ( CREATESTRUCT * pCREATESTRUCT ) [virtual]

Reimplemented from CWndLite.

Definition at line 2995 of file cdialoglite.cpp.

{
  //SubClass the window
  SubClassWindow(WndProc);

  //Delegate
  return CSplitterLite::OnCreate(pCREATESTRUCT);
}

BOOL CListViewLite::OnItemActivate | ( | INT | idCtrl,
 |  | NMLISTVIEW * | pNMListView |
 | ) |  |  | [virtual]

Reimplemented in CDataGrid.

Definition at line 3037 of file cdialoglite.cpp.

{
  return FALSE;
}

BOOL CListViewLite::OnItemChanged | ( | INT | idCtrl,
 |  | NMLISTVIEW * | pNMListView |
 | ) |  |  | [virtual]

Definition at line 3046 of file cdialoglite.cpp.

{
  return FALSE;
}

BOOL CListViewLite::OnNotify | ( | INT | idCtrl,
 |  | NMHDR * | pNMHDR |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 3009 of file cdialoglite.cpp.

{
  switch(pNMHDR->code)
  {
    ON_COMMAND(LVN_COLUMNCLICK,   OnColumnClick(idCtrl, (NMLISTVIEW*)pNMHDR));
    ON_COMMAND(LVN_ITEMACTIVATE,  OnItemActivate(idCtrl, (NMLISTVIEW*)pNMHDR));
    ON_COMMAND(LVN_ITEMCHANGED,   OnItemChanged(idCtrl, (NMLISTVIEW*)pNMHDR));
  };

  //Delegate
  return CSplitterLite::OnNotify(idCtrl, pNMHDR);
}

BOOL CListViewLite::SetColumn | ( | INDEX | iColumn,
 |  | WCHAR * | wszName,
 |  | INT | iImage = IMAGE_NONE
 | ) |  |

Definition at line 3116 of file cdialoglite.cpp.

{
  ULONG dwMask = LVCF_TEXT | LVCF_FMT | LVCF_SUBITEM;
  INT dwFmt = LVCFMT_LEFT;
  if(iImage != IMAGE_NONE)
  {
    dwMask |= LVCF_IMAGE;
    dwFmt |= LVCFMT_IMAGE;
  }

  //LVM_SETCOLUMN
  if(IsUnicodeOS())
  {
    //Setup LVM_SETCOLUMN
    LV_COLUMNW lvColumnHeader = { dwMask, dwFmt, 0, wszName, 0, 0, iImage, 0};
    return (BOOL)SendMessage(m_hWnd, LVM_SETCOLUMNW, (WPARAM)iColumn, (LPARAM)&lvColumnHeader);
  }
  else
  {
    //Setup LVM_SETCOLUMN
    CHAR szBuffer[MAX_NAME_LEN];
    LV_COLUMNA lvColumnHeader = { dwMask, dwFmt, 0, szBuffer, 0, 0, iImage, 0};
    ConvertToMBCS(wszName, szBuffer, MAX_NAME_LEN);
    return (BOOL)SendMessage(m_hWnd, LVM_SETCOLUMNA, (WPARAM)iColumn, (LPARAM)&lvColumnHeader);
  }
}

BOOL CListViewLite::SetColumnWidth | ( | INDEX | nCol,
 |  | INT | cx |
 | ) |  |  | [inline]

Definition at line 721 of file cdialoglite.h.

{ return (BOOL)SendMessage(m_hWnd, LVM_SETCOLUMNWIDTH, nCol, MAKELPARAM(cx, 0));      }

BOOL CListViewLite::SetItemImage | ( | INDEX | iItem,
 |  | INDEX | iSubItem,
 |  | INT | iImage
 | ) |  |

Definition at line 3096 of file cdialoglite.cpp.

{
  return LV_SetItemImage(m_hWnd, iItem, iSubItem, iImage);
}

BOOL CListViewLite::SetItemParam | ( | INDEX | iItem,
 |  | INDEX | iSubItem,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 3106 of file cdialoglite.cpp.

{
  return LV_SetItemParam(m_hWnd, iItem, iSubItem, lParam);
}

BOOL CListViewLite::SetItemState | ( | INDEX | iItem,
 |  | INDEX | iSubItem,
 |  | UINT | iState,
 |  | UINT | iStateMask
 | ) |  |

Definition at line 3076 of file cdialoglite.cpp.

{
  return LV_SetItemState(m_hWnd, iItem, iSubItem, iState, iStateMask);
}

BOOL CListViewLite::SetItemText | ( | INDEX | iItem,
 |  | INDEX | iSubItem,
 |  | WCHAR * | pwszName
 | ) |  |

Definition at line 3066 of file cdialoglite.cpp.

{
  return LV_SetItemText(m_hWnd, iItem, iSubItem, pwszName);
}

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialoglite.h
  • Dataaccess/oledb/rowsetviewer/cdialoglite.cpp
Generated on Wed Nov 13 2024 16:56:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CLListImpl< TYPE, ARG_TYPE > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Classes | Public Member Functions | Protected Member Functions | Protected Attributes

CLListImpl< TYPE, ARG_TYPE > Class Template Reference

#include "llistimpl.h"

List of all members.

Classes

struct | CNode

Public Member Functions

CLListImpl (int nBlockSize=10)
CLListImpl (int nBlockSize=10)
CLListImpl (int nBlockSize=10)
CLListImpl (int nBlockSize=10)
CLListImpl (int nBlockSize=10)
CLListImpl (int nBlockSize=10)
~CLListImpl ()
~CLListImpl ()
~CLListImpl ()
~CLListImpl ()
~CLListImpl ()
~CLListImpl ()
void | AddHead (CLListImpl *pNewList)
void | AddHead (CLListImpl *pNewList)
POSITION | AddHead (ARG_TYPE NewElement)
POSITION | AddHead (ARG_TYPE NewElement)
void | AddHead (CLListImpl *pNewList)
POSITION | AddHead (ARG_TYPE NewElement)
void | AddHead (CLListImpl *pNewList)
POSITION | AddHead (ARG_TYPE NewElement)
POSITION | AddHead (ARG_TYPE NewElement)
void | AddHead (CLListImpl *pNewList)
void | AddHead (CLListImpl *pNewList)
POSITION | AddHead (ARG_TYPE NewElement)
POSITION | AddTail (ARG_TYPE NewElement)
void | AddTail (CLListImpl *pNewList)
POSITION | AddTail (ARG_TYPE NewElement)
void | AddTail (CLListImpl *pNewList)
POSITION | AddTail (ARG_TYPE NewElement)
void | AddTail (CLListImpl *pNewList)
POSITION | AddTail (ARG_TYPE NewElement)
void | AddTail (CLListImpl *pNewList)
POSITION | AddTail (ARG_TYPE NewElement)
POSITION | AddTail (ARG_TYPE NewElement)
void | AddTail (CLListImpl *pNewList)
void | AddTail (CLListImpl *pNewList)
POSITION | Find (ARG_TYPE SearchValue, POSITION StartAfter=NULL) const
POSITION | Find (ARG_TYPE SearchValue, POSITION StartAfter=NULL) const
POSITION | Find (ARG_TYPE SearchValue, POSITION StartAfter=NULL) const
POSITION | Find (ARG_TYPE SearchValue, POSITION StartAfter=NULL) const
POSITION | Find (ARG_TYPE SearchValue, POSITION StartAfter=NULL) const
POSITION | Find (ARG_TYPE SearchValue, POSITION StartAfter=NULL) const
POSITION | FindIndex (int nIndex) const
POSITION | FindIndex (int nIndex) const
POSITION | FindIndex (int nIndex) const
POSITION | FindIndex (int nIndex) const
POSITION | FindIndex (int nIndex) const
POSITION | FindIndex (int nIndex) const
TYPE & | GetAt (POSITION Position)
TYPE | GetAt (POSITION Position) const
TYPE & | GetAt (POSITION Position)
TYPE | GetAt (POSITION Position) const
TYPE & | GetAt (POSITION Position)
TYPE | GetAt (POSITION Position) const
TYPE & | GetAt (POSITION Position)
TYPE | GetAt (POSITION Position) const
TYPE & | GetAt (POSITION Position)
TYPE | GetAt (POSITION Position) const
TYPE & | GetAt (POSITION Position)
TYPE | GetAt (POSITION Position) const
int | GetCount () const
int | GetCount () const
int | GetCount () const
int | GetCount () const
int | GetCount () const
int | GetCount () const
TYPE | GetHead () const
TYPE | GetHead () const
TYPE | GetHead () const
TYPE & | GetHead ()
TYPE & | GetHead ()
TYPE & | GetHead ()
TYPE & | GetHead ()
TYPE | GetHead () const
TYPE | GetHead () const
TYPE & | GetHead ()
TYPE | GetHead () const
TYPE & | GetHead ()
POSITION | GetHeadPosition () const
POSITION | GetHeadPosition () const
POSITION | GetHeadPosition () const
POSITION | GetHeadPosition () const
POSITION | GetHeadPosition () const
POSITION | GetHeadPosition () const
TYPE & | GetNext (POSITION &rPosition)
TYPE & | GetNext (POSITION &rPosition)
TYPE & | GetNext (POSITION &rPosition)
TYPE | GetNext (POSITION &rPosition) const
TYPE | GetNext (POSITION &rPosition) const
TYPE & | GetNext (POSITION &rPosition)
TYPE | GetNext (POSITION &rPosition) const
TYPE & | GetNext (POSITION &rPosition)
TYPE | GetNext (POSITION &rPosition) const
TYPE & | GetNext (POSITION &rPosition)
TYPE | GetNext (POSITION &rPosition) const
TYPE | GetNext (POSITION &rPosition) const
TYPE | GetPrev (POSITION &rPosition) const
TYPE & | GetPrev (POSITION &rPosition)
TYPE | GetPrev (POSITION &rPosition) const
TYPE & | GetPrev (POSITION &rPosition)
TYPE | GetPrev (POSITION &rPosition) const
TYPE & | GetPrev (POSITION &rPosition)
TYPE | GetPrev (POSITION &rPosition) const
TYPE & | GetPrev (POSITION &rPosition)
TYPE | GetPrev (POSITION &rPosition) const
TYPE & | GetPrev (POSITION &rPosition)
TYPE | GetPrev (POSITION &rPosition) const
TYPE & | GetPrev (POSITION &rPosition)
TYPE | GetTail () const
TYPE | GetTail () const
TYPE | GetTail () const
TYPE & | GetTail ()
TYPE & | GetTail ()
TYPE | GetTail () const
TYPE & | GetTail ()
TYPE & | GetTail ()
TYPE & | GetTail ()
TYPE & | GetTail ()
TYPE | GetTail () const
TYPE | GetTail () const
POSITION | GetTailPosition () const
POSITION | GetTailPosition () const
POSITION | GetTailPosition () const
POSITION | GetTailPosition () const
POSITION | GetTailPosition () const
POSITION | GetTailPosition () const
POSITION | InsertAfter (POSITION position, ARG_TYPE newElement)
POSITION | InsertAfter (POSITION position, ARG_TYPE newElement)
POSITION | InsertAfter (POSITION position, ARG_TYPE newElement)
POSITION | InsertAfter (POSITION position, ARG_TYPE newElement)
POSITION | InsertAfter (POSITION position, ARG_TYPE newElement)
POSITION | InsertAfter (POSITION position, ARG_TYPE newElement)
POSITION | InsertBefore (POSITION position, ARG_TYPE newElement)
POSITION | InsertBefore (POSITION position, ARG_TYPE newElement)
POSITION | InsertBefore (POSITION position, ARG_TYPE newElement)
POSITION | InsertBefore (POSITION position, ARG_TYPE newElement)
POSITION | InsertBefore (POSITION position, ARG_TYPE newElement)
POSITION | InsertBefore (POSITION position, ARG_TYPE newElement)
BOOL | IsEmpty () const
BOOL | IsEmpty () const
BOOL | IsEmpty () const
BOOL | IsEmpty () const
BOOL | IsEmpty () const
BOOL | IsEmpty () const
void | RemoveAll ()
void | RemoveAll ()
void | RemoveAll ()
void | RemoveAll ()
void | RemoveAll ()
void | RemoveAll ()
void | RemoveAt (POSITION Position)
void | RemoveAt (POSITION Position)
void | RemoveAt (POSITION Position)
void | RemoveAt (POSITION Position)
void | RemoveAt (POSITION Position)
void | RemoveAt (POSITION Position)
TYPE | RemoveHead ()
TYPE | RemoveHead ()
TYPE | RemoveHead ()
TYPE | RemoveHead ()
TYPE | RemoveHead ()
TYPE | RemoveHead ()
TYPE | RemoveTail ()
TYPE | RemoveTail ()
TYPE | RemoveTail ()
TYPE | RemoveTail ()
TYPE | RemoveTail ()
TYPE | RemoveTail ()
void | SetAt (POSITION Pos, ARG_TYPE NewElement)
void | SetAt (POSITION Pos, ARG_TYPE NewElement)
void | SetAt (POSITION Pos, ARG_TYPE NewElement)
void | SetAt (POSITION Pos, ARG_TYPE NewElement)
void | SetAt (POSITION Pos, ARG_TYPE NewElement)
void | SetAt (POSITION Pos, ARG_TYPE NewElement)

Protected Member Functions

void | FreeNode (CNode *)
void | FreeNode (CNode *)
void | FreeNode (CNode *)
void | FreeNode (CNode *)
void | FreeNode (CNode *)
void | FreeNode (CNode *)
CNode * NewNode (CNode *, CNode *)
CNode * NewNode (CNode *, CNode *)
CNode * NewNode (CNode *, CNode *)
CNode * NewNode (CNode *, CNode *)
CNode * NewNode (CNode *, CNode *)
CNode * NewNode (CNode *, CNode *)

Protected Attributes

int | m_nBlockSize
int | m_nCount
struct CPlex * | m_pBlocks
CNode * m_pNodeFree
CNode * m_pNodeHead
CNode * m_pNodeTail

Detailed Description

template<class TYPE, class ARG_TYPE>
class CLListImpl< TYPE, ARG_TYPE >

Definition at line 68 of file llistimpl.h.

Constructor & Destructor Documentation

template<class TYPE , class ARG_TYPE >
CLListImpl< TYPE, ARG_TYPE >::CLListImpl ( int nBlockSize = 10 )

Definition at line 257 of file llistimpl.h.

{
  _ASSERT( nBlockSize > 0 );

  m_nCount     = 0;
  m_pNodeHead  = m_pNodeTail = m_pNodeFree = NULL;
  m_pBlocks    = NULL;
  m_nBlockSize = nBlockSize;
}

template<class TYPE , class ARG_TYPE >
CLListImpl< TYPE, ARG_TYPE >::~CLListImpl ( )

Definition at line 282 of file llistimpl.h.

{
  RemoveAll();
  _ASSERT(m_nCount == 0);
}

template<class TYPE, class ARG_TYPE>
CLListImpl< TYPE, ARG_TYPE >::CLListImpl ( int nBlockSize = 10 )
template<class TYPE, class ARG_TYPE>
CLListImpl< TYPE, ARG_TYPE >::~CLListImpl ( )
template<class TYPE, class ARG_TYPE>
CLListImpl< TYPE, ARG_TYPE >::CLListImpl ( int nBlockSize = 10 )
template<class TYPE, class ARG_TYPE>
CLListImpl< TYPE, ARG_TYPE >::~CLListImpl ( )
template<class TYPE, class ARG_TYPE>
CLListImpl< TYPE, ARG_TYPE >::CLListImpl ( int nBlockSize = 10 )
template<class TYPE, class ARG_TYPE>
CLListImpl< TYPE, ARG_TYPE >::~CLListImpl ( )
template<class TYPE, class ARG_TYPE>
CLListImpl< TYPE, ARG_TYPE >::CLListImpl ( int nBlockSize = 10 )
template<class TYPE, class ARG_TYPE>
CLListImpl< TYPE, ARG_TYPE >::~CLListImpl ( )
template<class TYPE, class ARG_TYPE>
CLListImpl< TYPE, ARG_TYPE >::CLListImpl ( int nBlockSize = 10 )
template<class TYPE, class ARG_TYPE>
CLListImpl< TYPE, ARG_TYPE >::~CLListImpl ( )

Member Function Documentation

template<class TYPE , class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::AddHead ( ARG_TYPE NewElement )

Definition at line 354 of file llistimpl.h.

{
  _ASSERT( NULL != NewElement );

  CNode* pNewNode = NewNode( NULL, m_pNodeHead );
  pNewNode->data = NewElement;
  if( NULL != m_pNodeHead )
    m_pNodeHead->pPrev = pNewNode;
  else
    m_pNodeTail = pNewNode;

  m_pNodeHead = pNewNode;
  return (POSITION)pNewNode;
}

template<class TYPE , class ARG_TYPE>
void CLListImpl< TYPE, ARG_TYPE >::AddHead ( CLListImpl< TYPE, ARG_TYPE > * pNewList )

Definition at line 388 of file llistimpl.h.

{
  _ASSERT( NULL != pNewList );

  // Add a list of same elements to head (maintain order)
  POSITION Pos = pNewList->GetTailPosition();
  while( NULL != Pos )
    AddHead(pNewList->GetPrev( Pos ));
}

template<class TYPE, class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::AddHead ( ARG_TYPE NewElement )
template<class TYPE, class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::AddHead ( ARG_TYPE NewElement )
template<class TYPE, class ARG_TYPE>
void CLListImpl< TYPE, ARG_TYPE >::AddHead ( CLListImpl< TYPE, ARG_TYPE > * pNewList )
template<class TYPE, class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::AddHead ( ARG_TYPE NewElement )
template<class TYPE, class ARG_TYPE>
void CLListImpl< TYPE, ARG_TYPE >::AddHead ( CLListImpl< TYPE, ARG_TYPE > * pNewList )
template<class TYPE, class ARG_TYPE>
void CLListImpl< TYPE, ARG_TYPE >::AddHead ( CLListImpl< TYPE, ARG_TYPE > * pNewList )
template<class TYPE, class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::AddHead ( ARG_TYPE NewElement )
template<class TYPE, class ARG_TYPE>
void CLListImpl< TYPE, ARG_TYPE >::AddHead ( CLListImpl< TYPE, ARG_TYPE > * pNewList )
template<class TYPE, class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::AddHead ( ARG_TYPE NewElement )
template<class TYPE, class ARG_TYPE>
void CLListImpl< TYPE, ARG_TYPE >::AddHead ( CLListImpl< TYPE, ARG_TYPE > * pNewList )
template<class TYPE, class ARG_TYPE>
void CLListImpl< TYPE, ARG_TYPE >::AddTail ( CLListImpl< TYPE, ARG_TYPE > * pNewList )
template<class TYPE, class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::AddTail ( ARG_TYPE NewElement )
template<class TYPE, class ARG_TYPE>
void CLListImpl< TYPE, ARG_TYPE >::AddTail ( CLListImpl< TYPE, ARG_TYPE > * pNewList )
template<class TYPE, class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::AddTail ( ARG_TYPE NewElement )
template<class TYPE, class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::AddTail ( ARG_TYPE NewElement )
template<class TYPE, class ARG_TYPE>
void CLListImpl< TYPE, ARG_TYPE >::AddTail ( CLListImpl< TYPE, ARG_TYPE > * pNewList )
template<class TYPE , class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::AddTail ( ARG_TYPE NewElement )

Definition at line 371 of file llistimpl.h.

{
  _ASSERT( NULL != NewElement );

  CNode* pNewNode = NewNode( m_pNodeTail, NULL );
  pNewNode->data = NewElement;
  if( NULL != m_pNodeTail )
    m_pNodeTail->pNext = pNewNode;
  else
    m_pNodeHead = pNewNode;

  m_pNodeTail = pNewNode;
  return (POSITION)pNewNode;
}

template<class TYPE, class ARG_TYPE>
void CLListImpl< TYPE, ARG_TYPE >::AddTail ( CLListImpl< TYPE, ARG_TYPE > * pNewList )
template<class TYPE , class ARG_TYPE>
void CLListImpl< TYPE, ARG_TYPE >::AddTail ( CLListImpl< TYPE, ARG_TYPE > * pNewList )

Definition at line 400 of file llistimpl.h.

{
  _ASSERT( NULL != pNewList );

  // Add a list of same elements
  POSITION Pos = pNewList->GetHeadPosition();
  while( NULL != Pos )
    AddTail(pNewList->GetNext( Pos ));
}

template<class TYPE, class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::AddTail ( ARG_TYPE NewElement )
template<class TYPE, class ARG_TYPE>
void CLListImpl< TYPE, ARG_TYPE >::AddTail ( CLListImpl< TYPE, ARG_TYPE > * pNewList )
template<class TYPE, class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::AddTail ( ARG_TYPE NewElement )
template<class TYPE, class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::Find | ( | ARG_TYPE | SearchValue,
 |  | POSITION | StartAfter = NULL |
 | ) |  |  | const
template<class TYPE, class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::Find | ( | ARG_TYPE | SearchValue,
 |  | POSITION | StartAfter = NULL |
 | ) |  |  | const
template<class TYPE, class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::Find | ( | ARG_TYPE | SearchValue,
 |  | POSITION | StartAfter = NULL |
 | ) |  |  | const
template<class TYPE , class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::Find | ( | ARG_TYPE | SearchValue,
 |  | POSITION | StartAfter = NULL |
 | ) |  |  | const

Definition at line 556 of file llistimpl.h.

{
  _ASSERT( NULL != SearchValue );

  CNode* pNode = (CNode*)StartAfter;
  if( NULL == pNode )
  {
    pNode = m_pNodeHead;  // start at head
  }
  else
  {
    _ASSERT( IsValidAddress( pNode, sizeof(CNode)) );
    pNode = pNode->pNext;  // start after the one specified
  }

  for (; pNode != NULL; pNode = pNode->pNext)
    if (CompareElements<TYPE>(&pNode->data, &searchValue))
      return (POSITION)pNode;

  return NULL;
}

template<class TYPE, class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::Find | ( | ARG_TYPE | SearchValue,
 |  | POSITION | StartAfter = NULL |
 | ) |  |  | const
template<class TYPE, class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::Find | ( | ARG_TYPE | SearchValue,
 |  | POSITION | StartAfter = NULL |
 | ) |  |  | const
template<class TYPE, class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::FindIndex ( int nIndex ) const
template<class TYPE, class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::FindIndex ( int nIndex ) const
template<class TYPE, class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::FindIndex ( int nIndex ) const
template<class TYPE , class ARG_TYPE >
POSITION CLListImpl< TYPE, ARG_TYPE >::FindIndex ( int nIndex ) const

Definition at line 540 of file llistimpl.h.

{
  if( nIndex >= m_nCount || nIndex < 0 )
    return NULL;  // went too far

  CNode* pNode = m_pNodeHead;
  while (nIndex--)
  {
    _ASSERT( IsValidAddress( pNode, sizeof(CNode)) );
    pNode = pNode->pNext;
  }
  return (POSITION)pNode;
}

template<class TYPE, class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::FindIndex ( int nIndex ) const
template<class TYPE, class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::FindIndex ( int nIndex ) const
template<class TYPE, class ARG_TYPE>
void CLListImpl< TYPE, ARG_TYPE >::FreeNode ( CNode * ) [protected]
template<class TYPE, class ARG_TYPE>
void CLListImpl< TYPE, ARG_TYPE >::FreeNode ( CNode * ) [protected]
template<class TYPE, class ARG_TYPE>
void CLListImpl< TYPE, ARG_TYPE >::FreeNode ( CNode * ) [protected]
template<class TYPE , class ARG_TYPE >
void CLListImpl< TYPE, ARG_TYPE >::FreeNode ( CLListImpl< TYPE, ARG_TYPE >::CNode * pNode ) [protected]

Definition at line 340 of file llistimpl.h.

{
  (pNode->data).~TYPE();
  pNode->pNext = m_pNodeFree;
  m_pNodeFree = pNode;
  m_nCount--;
  _ASSERT(m_nCount >= 0);  // make sure we don't underflow

  // if no more elements, cleanup completely
  if( 0 == m_nCount )
    RemoveAll();
}

template<class TYPE, class ARG_TYPE>
void CLListImpl< TYPE, ARG_TYPE >::FreeNode ( CNode * ) [protected]
template<class TYPE, class ARG_TYPE>
void CLListImpl< TYPE, ARG_TYPE >::FreeNode ( CNode * ) [protected]
template<class TYPE, class ARG_TYPE>
TYPE& CLListImpl< TYPE, ARG_TYPE >::GetAt ( POSITION Position )
template<class TYPE, class ARG_TYPE>
TYPE CLListImpl< TYPE, ARG_TYPE >::GetAt ( POSITION Position ) const
template<class TYPE, class ARG_TYPE>
TYPE& CLListImpl< TYPE, ARG_TYPE >::GetAt ( POSITION Position )
template<class TYPE , class ARG_TYPE >
TYPE CLListImpl< TYPE, ARG_TYPE >::GetAt ( POSITION Position ) const [inline]

Definition at line 240 of file llistimpl.h.

  {
    CNode* pNode = (CNode*) Position;
    _ASSERT( IsValidAddress(pNode, sizeof(CNode)) );
    return pNode->data;
  }

template<class TYPE, class ARG_TYPE>
TYPE CLListImpl< TYPE, ARG_TYPE >::GetAt ( POSITION Position ) const
template<class TYPE , class ARG_TYPE >
TYPE & CLListImpl< TYPE, ARG_TYPE >::GetAt ( POSITION Position ) [inline]

Definition at line 232 of file llistimpl.h.

  {
    CNode* pNode = (CNode*)Position;
    _ASSERT( IsValidAddress(pNode, sizeof(CNode)) );
    return pNode->data;
  }

template<class TYPE, class ARG_TYPE>
TYPE& CLListImpl< TYPE, ARG_TYPE >::GetAt ( POSITION Position )
template<class TYPE, class ARG_TYPE>
TYPE CLListImpl< TYPE, ARG_TYPE >::GetAt ( POSITION Position ) const
template<class TYPE, class ARG_TYPE>
TYPE& CLListImpl< TYPE, ARG_TYPE >::GetAt ( POSITION Position )
template<class TYPE, class ARG_TYPE>
TYPE CLListImpl< TYPE, ARG_TYPE >::GetAt ( POSITION Position ) const
template<class TYPE, class ARG_TYPE>
TYPE& CLListImpl< TYPE, ARG_TYPE >::GetAt ( POSITION Position )
template<class TYPE, class ARG_TYPE>
TYPE CLListImpl< TYPE, ARG_TYPE >::GetAt ( POSITION Position ) const
template<class TYPE, class ARG_TYPE>
int CLListImpl< TYPE, ARG_TYPE >::GetCount ( ) const
template<class TYPE , class ARG_TYPE >
int CLListImpl< TYPE, ARG_TYPE >::GetCount ( ) const [inline]

Definition at line 152 of file llistimpl.h.

  { return m_nCount; }

template<class TYPE, class ARG_TYPE>
int CLListImpl< TYPE, ARG_TYPE >::GetCount ( ) const
template<class TYPE, class ARG_TYPE>
int CLListImpl< TYPE, ARG_TYPE >::GetCount ( ) const
template<class TYPE, class ARG_TYPE>
int CLListImpl< TYPE, ARG_TYPE >::GetCount ( ) const
template<class TYPE, class ARG_TYPE>
int CLListImpl< TYPE, ARG_TYPE >::GetCount ( ) const
template<class TYPE, class ARG_TYPE>
TYPE& CLListImpl< TYPE, ARG_TYPE >::GetHead ( )
template<class TYPE, class ARG_TYPE>
TYPE CLListImpl< TYPE, ARG_TYPE >::GetHead ( ) const
template<class TYPE, class ARG_TYPE>
TYPE& CLListImpl< TYPE, ARG_TYPE >::GetHead ( )
template<class TYPE, class ARG_TYPE>
TYPE CLListImpl< TYPE, ARG_TYPE >::GetHead ( ) const
template<class TYPE , class ARG_TYPE >
TYPE CLListImpl< TYPE, ARG_TYPE >::GetHead ( ) const [inline]

Definition at line 167 of file llistimpl.h.

  {
    _ASSERT( NULL != m_pNodeHead );
    return m_pNodeHead->data;
  }

template<class TYPE, class ARG_TYPE>
TYPE& CLListImpl< TYPE, ARG_TYPE >::GetHead ( )
template<class TYPE, class ARG_TYPE>
TYPE CLListImpl< TYPE, ARG_TYPE >::GetHead ( ) const
template<class TYPE , class ARG_TYPE >
TYPE & CLListImpl< TYPE, ARG_TYPE >::GetHead ( ) [inline]

Definition at line 160 of file llistimpl.h.

  {
    _ASSERT( NULL != m_pNodeHead );
    return m_pNodeHead->data;
  }

template<class TYPE, class ARG_TYPE>
TYPE& CLListImpl< TYPE, ARG_TYPE >::GetHead ( )
template<class TYPE, class ARG_TYPE>
TYPE& CLListImpl< TYPE, ARG_TYPE >::GetHead ( )
template<class TYPE, class ARG_TYPE>
TYPE CLListImpl< TYPE, ARG_TYPE >::GetHead ( ) const
template<class TYPE, class ARG_TYPE>
TYPE CLListImpl< TYPE, ARG_TYPE >::GetHead ( ) const
template<class TYPE, class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::GetHeadPosition ( ) const
template<class TYPE, class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::GetHeadPosition ( ) const
template<class TYPE, class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::GetHeadPosition ( ) const
template<class TYPE, class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::GetHeadPosition ( ) const
template<class TYPE, class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::GetHeadPosition ( ) const
template<class TYPE , class ARG_TYPE >
POSITION CLListImpl< TYPE, ARG_TYPE >::GetHeadPosition ( ) const [inline]

Definition at line 188 of file llistimpl.h.

  { return (POSITION)m_pNodeHead; }

template<class TYPE, class ARG_TYPE>
TYPE& CLListImpl< TYPE, ARG_TYPE >::GetNext ( POSITION & rPosition )
template<class TYPE, class ARG_TYPE>
TYPE CLListImpl< TYPE, ARG_TYPE >::GetNext ( POSITION & rPosition ) const
template<class TYPE , class ARG_TYPE >
TYPE & CLListImpl< TYPE, ARG_TYPE >::GetNext ( POSITION & rPosition ) [inline]

Definition at line 196 of file llistimpl.h.

  {
    CNode* pNode = (CNode*) rPosition;
    _ASSERT(IsValidAddress(pNode, sizeof(CNode)));
    rPosition = (POSITION) pNode->pNext;
    return pNode->data;
  }

template<class TYPE , class ARG_TYPE >
TYPE CLListImpl< TYPE, ARG_TYPE >::GetNext ( POSITION & rPosition ) const [inline]

Definition at line 205 of file llistimpl.h.

  {
    CNode* pNode = (CNode*) rPosition;
    _ASSERT(IsValidAddress(pNode, sizeof(CNode)));
    rPosition = (POSITION) pNode->pNext;
    return pNode->data;
  }

template<class TYPE, class ARG_TYPE>
TYPE CLListImpl< TYPE, ARG_TYPE >::GetNext ( POSITION & rPosition ) const
template<class TYPE, class ARG_TYPE>
TYPE& CLListImpl< TYPE, ARG_TYPE >::GetNext ( POSITION & rPosition )
template<class TYPE, class ARG_TYPE>
TYPE& CLListImpl< TYPE, ARG_TYPE >::GetNext ( POSITION & rPosition )
template<class TYPE, class ARG_TYPE>
TYPE CLListImpl< TYPE, ARG_TYPE >::GetNext ( POSITION & rPosition ) const
template<class TYPE, class ARG_TYPE>
TYPE& CLListImpl< TYPE, ARG_TYPE >::GetNext ( POSITION & rPosition )
template<class TYPE, class ARG_TYPE>
TYPE CLListImpl< TYPE, ARG_TYPE >::GetNext ( POSITION & rPosition ) const
template<class TYPE, class ARG_TYPE>
TYPE& CLListImpl< TYPE, ARG_TYPE >::GetNext ( POSITION & rPosition )
template<class TYPE, class ARG_TYPE>
TYPE CLListImpl< TYPE, ARG_TYPE >::GetNext ( POSITION & rPosition ) const
template<class TYPE , class ARG_TYPE >
TYPE & CLListImpl< TYPE, ARG_TYPE >::GetPrev ( POSITION & rPosition ) [inline]

Definition at line 214 of file llistimpl.h.

  {
    CNode* pNode = (CNode*) rPosition;
    _ASSERT( IsValidAddress(pNode, sizeof(CNode)) );
    rPosition = (POSITION) pNode->pPrev;
    return pNode->data;
  }

template<class TYPE, class ARG_TYPE>
TYPE& CLListImpl< TYPE, ARG_TYPE >::GetPrev ( POSITION & rPosition )
template<class TYPE, class ARG_TYPE>
TYPE& CLListImpl< TYPE, ARG_TYPE >::GetPrev ( POSITION & rPosition )
template<class TYPE, class ARG_TYPE>
TYPE CLListImpl< TYPE, ARG_TYPE >::GetPrev ( POSITION & rPosition ) const
template<class TYPE, class ARG_TYPE>
TYPE CLListImpl< TYPE, ARG_TYPE >::GetPrev ( POSITION & rPosition ) const
template<class TYPE, class ARG_TYPE>
TYPE& CLListImpl< TYPE, ARG_TYPE >::GetPrev ( POSITION & rPosition )
template<class TYPE , class ARG_TYPE >
TYPE CLListImpl< TYPE, ARG_TYPE >::GetPrev ( POSITION & rPosition ) const [inline]

Definition at line 223 of file llistimpl.h.

  {
    CNode* pNode = (CNode*) rPosition;
    ASSERT( IsValidAddress(pNode, sizeof(CNode)) );
    rPosition = (POSITION) pNode->pPrev;
    return pNode->data;
  }

template<class TYPE, class ARG_TYPE>
TYPE CLListImpl< TYPE, ARG_TYPE >::GetPrev ( POSITION & rPosition ) const
template<class TYPE, class ARG_TYPE>
TYPE& CLListImpl< TYPE, ARG_TYPE >::GetPrev ( POSITION & rPosition )
template<class TYPE, class ARG_TYPE>
TYPE& CLListImpl< TYPE, ARG_TYPE >::GetPrev ( POSITION & rPosition )
template<class TYPE, class ARG_TYPE>
TYPE CLListImpl< TYPE, ARG_TYPE >::GetPrev ( POSITION & rPosition ) const
template<class TYPE, class ARG_TYPE>
TYPE CLListImpl< TYPE, ARG_TYPE >::GetPrev ( POSITION & rPosition ) const
template<class TYPE, class ARG_TYPE>
TYPE CLListImpl< TYPE, ARG_TYPE >::GetTail ( ) const
template<class TYPE, class ARG_TYPE>
TYPE CLListImpl< TYPE, ARG_TYPE >::GetTail ( ) const
template<class TYPE, class ARG_TYPE>
TYPE CLListImpl< TYPE, ARG_TYPE >::GetTail ( ) const
template<class TYPE , class ARG_TYPE >
TYPE & CLListImpl< TYPE, ARG_TYPE >::GetTail ( ) [inline]

Definition at line 174 of file llistimpl.h.

  {
    _ASSERT( NULL != m_pNodeTail );
    return m_pNodeTail->data;
  }

template<class TYPE, class ARG_TYPE>
TYPE CLListImpl< TYPE, ARG_TYPE >::GetTail ( ) const
template<class TYPE, class ARG_TYPE>
TYPE& CLListImpl< TYPE, ARG_TYPE >::GetTail ( )
template<class TYPE, class ARG_TYPE>
TYPE& CLListImpl< TYPE, ARG_TYPE >::GetTail ( )
template<class TYPE, class ARG_TYPE>
TYPE& CLListImpl< TYPE, ARG_TYPE >::GetTail ( )
template<class TYPE , class ARG_TYPE >
TYPE CLListImpl< TYPE, ARG_TYPE >::GetTail ( ) const [inline]

Definition at line 181 of file llistimpl.h.

  {
    _ASSERT( NULL != m_pNodeTail );
    return m_pNodeTail->data;
  }

template<class TYPE, class ARG_TYPE>
TYPE& CLListImpl< TYPE, ARG_TYPE >::GetTail ( )
template<class TYPE, class ARG_TYPE>
TYPE CLListImpl< TYPE, ARG_TYPE >::GetTail ( ) const
template<class TYPE, class ARG_TYPE>
TYPE& CLListImpl< TYPE, ARG_TYPE >::GetTail ( )
template<class TYPE, class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::GetTailPosition ( ) const
template<class TYPE , class ARG_TYPE >
POSITION CLListImpl< TYPE, ARG_TYPE >::GetTailPosition ( ) const [inline]

Definition at line 192 of file llistimpl.h.

  { return (POSITION)m_pNodeTail; }

template<class TYPE, class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::GetTailPosition ( ) const
template<class TYPE, class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::GetTailPosition ( ) const
template<class TYPE, class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::GetTailPosition ( ) const
template<class TYPE, class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::GetTailPosition ( ) const
template<class TYPE, class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::InsertAfter | ( | POSITION | position,
 |  | ARG_TYPE | newElement
 | ) |  |
template<class TYPE, class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::InsertAfter | ( | POSITION | position,
 |  | ARG_TYPE | newElement
 | ) |  |
template<class TYPE , class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::InsertAfter | ( | POSITION | position,
 |  | ARG_TYPE | newElement
 | ) |  |

Definition at line 480 of file llistimpl.h.

{
  ASSERT( NULL != NewElement );

  if( NULL == Position )
    return AddTail( NewElement ); // insert after nothing -> tail of the list

  // Insert it before position
  CNode* pOldNode = (CNode*)Position;
  _ASSERT( IsValidAddress( pOldNode, sizeof(CNode) ) );
  CNode* pNewNode = NewNode( pOldNode, pOldNode->pNext );
  pNewNode->data = NewElement;

  if( NULL != pOldNode->pNext )
  {
    _ASSERT( IsValidAddress( pOldNode->pNext, sizeof(CNode)) );
    pOldNode->pNext->pPrev = pNewNode;
  }
  else
  {
    _ASSERT( pOldNode == m_pNodeTail );
    m_pNodeTail = pNewNode;
  }
  pOldNode->pNext = pNewNode;
  return (POSITION)pNewNode;
}

template<class TYPE, class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::InsertAfter | ( | POSITION | position,
 |  | ARG_TYPE | newElement
 | ) |  |
template<class TYPE, class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::InsertAfter | ( | POSITION | position,
 |  | ARG_TYPE | newElement
 | ) |  |
template<class TYPE, class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::InsertAfter | ( | POSITION | position,
 |  | ARG_TYPE | newElement
 | ) |  |
template<class TYPE, class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::InsertBefore | ( | POSITION | position,
 |  | ARG_TYPE | newElement
 | ) |  |
template<class TYPE , class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::InsertBefore | ( | POSITION | position,
 |  | ARG_TYPE | newElement
 | ) |  |

Definition at line 452 of file llistimpl.h.

{
  _ASSERT( NULL != NewElement );

  if( NULL == Position )
    return AddHead( NewElement ); // insert before nothing -> head of the list

  // Insert it before position
  CNode* pOldNode = (CNode*)Position;
  CNode* pNewNode = NewNode( pOldNode->pPrev, pOldNode );
  pNewNode->data  = NewElement;

  if( NULL != pOldNode->pPrev )
  {
    _ASSERT( IsValidAddress( pOldNode->pPrev, sizeof(CNode)) );
    pOldNode->pPrev->pNext = pNewNode;
  }
  else
  {
    _ASSERT( pOldNode == m_pNodeHead );
    m_pNodeHead = pNewNode;
  }
  pOldNode->pPrev = pNewNode;
  return (POSITION)pNewNode;
}

template<class TYPE, class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::InsertBefore | ( | POSITION | position,
 |  | ARG_TYPE | newElement
 | ) |  |
template<class TYPE, class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::InsertBefore | ( | POSITION | position,
 |  | ARG_TYPE | newElement
 | ) |  |
template<class TYPE, class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::InsertBefore | ( | POSITION | position,
 |  | ARG_TYPE | newElement
 | ) |  |
template<class TYPE, class ARG_TYPE>
POSITION CLListImpl< TYPE, ARG_TYPE >::InsertBefore | ( | POSITION | position,
 |  | ARG_TYPE | newElement
 | ) |  |
template<class TYPE, class ARG_TYPE>
BOOL CLListImpl< TYPE, ARG_TYPE >::IsEmpty ( ) const
template<class TYPE , class ARG_TYPE >
BOOL CLListImpl< TYPE, ARG_TYPE >::IsEmpty ( void ) const [inline]

Definition at line 156 of file llistimpl.h.

  { return m_nCount == 0; }

template<class TYPE, class ARG_TYPE>
BOOL CLListImpl< TYPE, ARG_TYPE >::IsEmpty ( ) const
template<class TYPE, class ARG_TYPE>
BOOL CLListImpl< TYPE, ARG_TYPE >::IsEmpty ( ) const
template<class TYPE, class ARG_TYPE>
BOOL CLListImpl< TYPE, ARG_TYPE >::IsEmpty ( ) const
template<class TYPE, class ARG_TYPE>
BOOL CLListImpl< TYPE, ARG_TYPE >::IsEmpty ( ) const
template<class TYPE , class ARG_TYPE >
CLListImpl< TYPE, ARG_TYPE >::CNode * CLListImpl< TYPE, ARG_TYPE >::NewNode | ( | CLListImpl< TYPE, ARG_TYPE >::CNode * | pPrev,
 |  | CLListImpl< TYPE, ARG_TYPE >::CNode * | pNext |
 | ) |  |  | [protected]

Definition at line 307 of file llistimpl.h.

{
  if( NULL == m_pNodeFree )
  {
    // add another block
    CPlex* pNewBlock = CPlex::Create( m_pBlocks, m_nBlockSize, sizeof(CNode) );

    // chain them into free list
    CNode* pNode = (CNode*) pNewBlock->data();
    // free in reverse order to make it easier to debug
    pNode += m_nBlockSize - 1;
    for( int i = m_nBlockSize-1; i >= 0; i--, pNode-- )
    {
      pNode->pNext = m_pNodeFree;
      m_pNodeFree = pNode;
    }
  }
  _ASSERT( NULL != m_pNodeFree );  // we must have something

  CLListImpl::CNode* pNode = m_pNodeFree;
  m_pNodeFree = m_pNodeFree->pNext;
  pNode->pPrev = pPrev;
  pNode->pNext = pNext;
  m_nCount++;
  _ASSERT(m_nCount > 0);  // make sure we don't overflow

  new (&pNode->data) TYPE; // Placement new

  return pNode;
}

template<class TYPE, class ARG_TYPE>
CNode* CLListImpl< TYPE, ARG_TYPE >::NewNode | ( | CNode * | ,
 |  | CNode * |  |
 | ) |  |  | [protected]
template<class TYPE, class ARG_TYPE>
CNode* CLListImpl< TYPE, ARG_TYPE >::NewNode | ( | CNode * | ,
 |  | CNode * |  |
 | ) |  |  | [protected]
template<class TYPE, class ARG_TYPE>
CNode* CLListImpl< TYPE, ARG_TYPE >::NewNode | ( | CNode * | ,
 |  | CNode * |  |
 | ) |  |  | [protected]
template<class TYPE, class ARG_TYPE>
CNode* CLListImpl< TYPE, ARG_TYPE >::NewNode | ( | CNode * | ,
 |  | CNode * |  |
 | ) |  |  | [protected]
template<class TYPE, class ARG_TYPE>
CNode* CLListImpl< TYPE, ARG_TYPE >::NewNode | ( | CNode * | ,
 |  | CNode * |  |
 | ) |  |  | [protected]
template<class TYPE, class ARG_TYPE>
void CLListImpl< TYPE, ARG_TYPE >::RemoveAll ( )
template<class TYPE, class ARG_TYPE>
void CLListImpl< TYPE, ARG_TYPE >::RemoveAll ( )
template<class TYPE, class ARG_TYPE>
void CLListImpl< TYPE, ARG_TYPE >::RemoveAll ( )
template<class TYPE, class ARG_TYPE>
void CLListImpl< TYPE, ARG_TYPE >::RemoveAll ( )
template<class TYPE, class ARG_TYPE>
void CLListImpl< TYPE, ARG_TYPE >::RemoveAll ( )
template<class TYPE , class ARG_TYPE >
void CLListImpl< TYPE, ARG_TYPE >::RemoveAll ( )

Definition at line 268 of file llistimpl.h.

{
  // destroy elements
  CNode* pNode;
  for( pNode = m_pNodeHead; pNode != NULL; pNode = pNode->pNext )
    (pNode->data).~TYPE();

  m_nCount = 0;
  m_pNodeHead = m_pNodeTail = m_pNodeFree = NULL;
  m_pBlocks->FreeDataChain();
  m_pBlocks = NULL;
}

template<class TYPE, class ARG_TYPE>
void CLListImpl< TYPE, ARG_TYPE >::RemoveAt ( POSITION Position )
template<class TYPE , class ARG_TYPE >
void CLListImpl< TYPE, ARG_TYPE >::RemoveAt ( POSITION Position )

Definition at line 509 of file llistimpl.h.

{
  _ASSERT( NULL != Position );

  CNode* pOldNode = (CNode*)Position;
  _ASSERT( IsValidAddress( pOldNode, sizeof(CNode)) );

  // Remove pOldNode from list
  if( pOldNode == m_pNodeHead )
  {
    m_pNodeHead = pOldNode->pNext;
  }
  else
  {
    _ASSERT( IsValidAddress( pOldNode->pPrev, sizeof(CNode)) );
    pOldNode->pPrev->pNext = pOldNode->pNext;
  }
  if( pOldNode == m_pNodeTail )
  {
    m_pNodeTail = pOldNode->pPrev;
  }
  else
  {
    _ASSERT( IsValidAddress( pOldNode->pNext, sizeof(CNode)) );
    pOldNode->pNext->pPrev = pOldNode->pPrev;
  }
  FreeNode( pOldNode );
}

template<class TYPE, class ARG_TYPE>
void CLListImpl< TYPE, ARG_TYPE >::RemoveAt ( POSITION Position )
template<class TYPE, class ARG_TYPE>
void CLListImpl< TYPE, ARG_TYPE >::RemoveAt ( POSITION Position )
template<class TYPE, class ARG_TYPE>
void CLListImpl< TYPE, ARG_TYPE >::RemoveAt ( POSITION Position )
template<class TYPE, class ARG_TYPE>
void CLListImpl< TYPE, ARG_TYPE >::RemoveAt ( POSITION Position )
template<class TYPE, class ARG_TYPE>
TYPE CLListImpl< TYPE, ARG_TYPE >::RemoveHead ( )
template<class TYPE, class ARG_TYPE>
TYPE CLListImpl< TYPE, ARG_TYPE >::RemoveHead ( )
template<class TYPE , class ARG_TYPE >
TYPE CLListImpl< TYPE, ARG_TYPE >::RemoveHead ( )

Definition at line 412 of file llistimpl.h.

{
  _ASSERT( NULL != m_pNodeHead );  // don't call on empty list !!!
  _ASSERT( IsValidAddress( m_pNodeHead, sizeof(CNode)) );

  CNode* pOldNode = m_pNodeHead;
  TYPE returnValue = pOldNode->data;

  m_pNodeHead = pOldNode->pNext;
  if( NULL != m_pNodeHead )
    m_pNodeHead->pPrev = NULL;
  else
    m_pNodeTail = NULL;

  FreeNode(pOldNode);
  return returnValue;
}

template<class TYPE, class ARG_TYPE>
TYPE CLListImpl< TYPE, ARG_TYPE >::RemoveHead ( )
template<class TYPE, class ARG_TYPE>
TYPE CLListImpl< TYPE, ARG_TYPE >::RemoveHead ( )
template<class TYPE, class ARG_TYPE>
TYPE CLListImpl< TYPE, ARG_TYPE >::RemoveHead ( )
template<class TYPE, class ARG_TYPE>
TYPE CLListImpl< TYPE, ARG_TYPE >::RemoveTail ( )
template<class TYPE, class ARG_TYPE>
TYPE CLListImpl< TYPE, ARG_TYPE >::RemoveTail ( )
template<class TYPE, class ARG_TYPE>
TYPE CLListImpl< TYPE, ARG_TYPE >::RemoveTail ( )
template<class TYPE , class ARG_TYPE >
TYPE CLListImpl< TYPE, ARG_TYPE >::RemoveTail ( )

Definition at line 432 of file llistimpl.h.

{
  _ASSERT( NULL != m_pNodeTail );  // don't call on empty list !!!
  _ASSERT( IsValidAddress( m_pNodeTail, sizeof(CNode)) );

  CNode* pOldNode = m_pNodeTail;
  TYPE returnValue = pOldNode->data;

  m_pNodeTail = pOldNode->pPrev;
  if( NULL != m_pNodeTail )
    m_pNodeTail->pNext = NULL;
  else
    m_pNodeHead = NULL;

  FreeNode(pOldNode);
  return returnValue;
}

template<class TYPE, class ARG_TYPE>
TYPE CLListImpl< TYPE, ARG_TYPE >::RemoveTail ( )
template<class TYPE, class ARG_TYPE>
TYPE CLListImpl< TYPE, ARG_TYPE >::RemoveTail ( )
template<class TYPE, class ARG_TYPE>
void CLListImpl< TYPE, ARG_TYPE >::SetAt | ( | POSITION | Pos,
 |  | ARG_TYPE | NewElement
 | ) |  |
template<class TYPE, class ARG_TYPE>
void CLListImpl< TYPE, ARG_TYPE >::SetAt | ( | POSITION | Pos,
 |  | ARG_TYPE | NewElement
 | ) |  |
template<class TYPE , class ARG_TYPE>
void CLListImpl< TYPE, ARG_TYPE >::SetAt | ( | POSITION | Pos,
 |  | ARG_TYPE | NewElement |
 | ) |  |  | [inline]

Definition at line 248 of file llistimpl.h.

  {
    CNode* pNode = (CNode*)Pos;
    _ASSERT( IsValidAddress(pNode, sizeof(CNode)) );
    pNode->data = newElement;
  }

template<class TYPE, class ARG_TYPE>
void CLListImpl< TYPE, ARG_TYPE >::SetAt | ( | POSITION | Pos,
 |  | ARG_TYPE | NewElement
 | ) |  |
template<class TYPE, class ARG_TYPE>
void CLListImpl< TYPE, ARG_TYPE >::SetAt | ( | POSITION | Pos,
 |  | ARG_TYPE | NewElement
 | ) |  |
template<class TYPE, class ARG_TYPE>
void CLListImpl< TYPE, ARG_TYPE >::SetAt | ( | POSITION | Pos,
 |  | ARG_TYPE | NewElement
 | ) |  |

Member Data Documentation

template<class TYPE, class ARG_TYPE>
int CLListImpl< TYPE, ARG_TYPE >::m_nBlockSize [protected]

Definition at line 135 of file llistimpl.h.

template<class TYPE, class ARG_TYPE>
int CLListImpl< TYPE, ARG_TYPE >::m_nCount [protected]

Definition at line 132 of file llistimpl.h.

template<class TYPE, class ARG_TYPE>
struct CPlex * CLListImpl< TYPE, ARG_TYPE >::m_pBlocks [protected]

Definition at line 134 of file llistimpl.h.

template<class TYPE, class ARG_TYPE>
CNode * CLListImpl< TYPE, ARG_TYPE >::m_pNodeFree [protected]

Definition at line 133 of file llistimpl.h.

template<class TYPE, class ARG_TYPE>
CNode * CLListImpl< TYPE, ARG_TYPE >::m_pNodeHead [protected]

Definition at line 130 of file llistimpl.h.

template<class TYPE, class ARG_TYPE>
CNode * CLListImpl< TYPE, ARG_TYPE >::m_pNodeTail [protected]

Definition at line 131 of file llistimpl.h.

The documentation for this class was generated from the following files:
  • SysMgmt/MMC/mmc2.0/contextmenu/llistimpl.h
  • SysMgmt/MMC/mmc2.0/dragdrop/llistimpl.h
  • SysMgmt/MMC/mmc2.0/help/llistimpl.h
  • SysMgmt/MMC/mmc2.0/multisel/llistimpl.h
  • SysMgmt/MMC/mmc2.0/proppage/llistimpl.h
  • SysMgmt/MMC/mmc2.0/viewex/llistimpl.h
Generated on Wed Nov 13 2024 16:56:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CLListImpl< TYPE, ARG_TYPE >::CNode Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • CLListImpl< TYPE, ARG_TYPE >
  • CLListImpl< TYPE, ARG_TYPE >::CNode
Public Attributes

CLListImpl< TYPE, ARG_TYPE >::CNode Struct Reference

#include "llistimpl.h"

List of all members.

Public Attributes

TYPE data
CNode * pNext
CNode * pPrev

Detailed Description

template<class TYPE, class ARG_TYPE>
struct CLListImpl< TYPE, ARG_TYPE >::CNode

Definition at line 75 of file llistimpl.h.

Member Data Documentation

template<class TYPE, class ARG_TYPE>
TYPE CLListImpl< TYPE, ARG_TYPE >::CNode::data

Definition at line 79 of file llistimpl.h.

template<class TYPE, class ARG_TYPE>
CNode * CLListImpl< TYPE, ARG_TYPE >::CNode::pNext

Definition at line 77 of file llistimpl.h.

template<class TYPE, class ARG_TYPE>
CNode * CLListImpl< TYPE, ARG_TYPE >::CNode::pPrev

Definition at line 78 of file llistimpl.h.

The documentation for this struct was generated from the following files:
  • SysMgmt/MMC/mmc2.0/contextmenu/llistimpl.h
  • SysMgmt/MMC/mmc2.0/dragdrop/llistimpl.h
  • SysMgmt/MMC/mmc2.0/help/llistimpl.h
  • SysMgmt/MMC/mmc2.0/multisel/llistimpl.h
  • SysMgmt/MMC/mmc2.0/proppage/llistimpl.h
  • SysMgmt/MMC/mmc2.0/viewex/llistimpl.h
Generated on Wed Nov 13 2024 16:56:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CLocateDialog Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions

CLocateDialog Class Reference

#include "LocatDlg.h"

List of all members.

Public Types

enum | { IDD = IDD_LOCATE_DIALOG }

Public Member Functions

CLocateDialog (CWnd *pParent=NULL)
void | GetLabel (TCHAR szLabelBuffer[BUFFERSIZE])

Public Attributes

CString m_szLabel

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)

Detailed Description

Definition at line 21 of file LocatDlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 29 of file LocatDlg.h.

{ IDD = IDD_LOCATE_DIALOG };

Constructor & Destructor Documentation

CLocateDialog::CLocateDialog ( CWnd * pParent = NULL )

Definition at line 31 of file LocatDlg.Cpp.

  : CDialog(CLocateDialog::IDD, pParent)
{
  //{{AFX_DATA_INIT(CLocateDialog)
  m_szLabel = TEXT("MQ API test");
  //}}AFX_DATA_INIT
}

Member Function Documentation

void CLocateDialog::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 40 of file LocatDlg.Cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CLocateDialog)
  DDX_Text(pDX, IDC_LOCATE_LABEL, m_szLabel);
  DDV_MaxChars(pDX, m_szLabel, 128);
  //}}AFX_DATA_MAP
}

void CLocateDialog::GetLabel ( TCHAR szLabelBuffer[BUFFERSIZE] ) [inline]

Definition at line 51 of file LocatDlg.h.

  {
    ASSERT(szLabelBuffer != NULL);

    _tcsncpy (szLabelBuffer, m_szLabel, BUFFERSIZE-1);
    szLabelBuffer[BUFFERSIZE-1] = '\0';

  }

Member Data Documentation

CString CLocateDialog::m_szLabel

Definition at line 30 of file LocatDlg.h.

The documentation for this class was generated from the following files:
  • NetDS/MessageQueuing/MqApiTst/LocatDlg.h
  • NetDS/MessageQueuing/MqApiTst/LocatDlg.Cpp
Generated on Wed Nov 13 2024 16:56:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CLock Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CLock Class Reference

#include "Critsect.h"

List of all members.

Public Member Functions

CLock (CLockHandler *pLockHandler)
~CLock ()
void | Enter ()
void | Leave ()

Private Attributes

DWORD cRefs
DWORD m_dwThreadID
CLockHandler * m_pLockHandler

Detailed Description

Definition at line 91 of file Critsect.h.

Constructor & Destructor Documentation

CLock::CLock ( CLockHandler * pLockHandler ) [inline]

Definition at line 98 of file Critsect.h.

    {
    m_pLockHandler = pLockHandler;
    cRefs = 0;
    m_dwThreadID = GetCurrentThreadId();
    };

CLock::~CLock ( ) [inline]

Definition at line 106 of file Critsect.h.

    {
    AssertSz(0 == cRefs,"UnReleased Lock");
    Assert(m_dwThreadID == GetCurrentThreadId());

    while(cRefs--) // unwind any left over cRefs
    {
        m_pLockHandler->UnLock();
    }

    };

Member Function Documentation

void CLock::Enter ( ) [inline]

Definition at line 118 of file Critsect.h.

    {
    Assert(m_dwThreadID == GetCurrentThreadId());

    ++cRefs;
    Assert(1 == cRefs); // we don't allow nested calls.
    m_pLockHandler->Lock(m_dwThreadID);
    };

void CLock::Leave ( ) [inline]

Definition at line 127 of file Critsect.h.

    {
    Assert(m_dwThreadID == GetCurrentThreadId());
    Assert(0 < cRefs);

    if (0 >= cRefs)
        return;

    --cRefs;
    Assert(0 == cRefs);
    m_pLockHandler->UnLock();

    };

Member Data Documentation

DWORD CLock::cRefs [private]

Definition at line 93 of file Critsect.h.

DWORD CLock::m_dwThreadID [private]

Definition at line 95 of file Critsect.h.

CLockHandler* CLock::m_pLockHandler [private]

Definition at line 94 of file Critsect.h.

The documentation for this class was generated from the following file:
  • NetDS/SyncMgr/SyncDir/Critsect.h
Generated on Wed Nov 13 2024 16:56:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CLockHandler Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CLockHandler Class Reference

#include "Critsect.h"

Inherited by CSettings [private], and CSyncMgrHandler.

List of all members.

Public Member Functions

CLockHandler ()
~CLockHandler ()
DWORD GetLockThreadId ()
void | Lock (DWORD dwThreadId)
void | UnLock ()

Private Attributes

friend | CLock
CRITICAL_SECTION | m_CriticalSection
DWORD m_dwLockThreadId

Detailed Description

Definition at line 72 of file Critsect.h.

Constructor & Destructor Documentation

CLockHandler::CLockHandler ( )

Definition at line 28 of file Critsect.Cpp.

{
    m_dwLockThreadId = 0;
    InitializeCriticalSection(&m_CriticalSection);
}

CLockHandler::~CLockHandler ( )

Definition at line 48 of file Critsect.Cpp.

{
    Assert (0 == m_dwLockThreadId);
    DeleteCriticalSection(&m_CriticalSection);
}

Member Function Documentation

DWORD CLockHandler::GetLockThreadId ( ) [inline]

Definition at line 80 of file Critsect.h.

{ return m_dwLockThreadId; };

void CLockHandler::Lock ( DWORD dwThreadId )

Definition at line 68 of file Critsect.Cpp.

{
    EnterCriticalSection(&m_CriticalSection);

    m_dwLockThreadId = dwThreadId;
}

void CLockHandler::UnLock ( )

Definition at line 89 of file Critsect.Cpp.

{
    m_dwLockThreadId = 0;
    LeaveCriticalSection(&m_CriticalSection);
}

Member Data Documentation

friend CLockHandler::CLock [private]

Definition at line 86 of file Critsect.h.

CRITICAL_SECTION CLockHandler::m_CriticalSection [private]

Definition at line 80 of file Critsect.h.

DWORD CLockHandler::m_dwLockThreadId [private]

Definition at line 84 of file Critsect.h.

The documentation for this class was generated from the following files:
  • NetDS/SyncMgr/SyncDir/Critsect.h
  • NetDS/SyncMgr/SyncDir/Critsect.Cpp
Generated on Wed Nov 13 2024 16:56:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CLogFile Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CLogFile Class Reference

#include "LogFile.h"

List of all members.

Public Member Functions

CLogFile ()
~CLogFile ()

Private Member Functions

STDMETHOD() | Activate ()
STDMETHOD() | Construct (IDispatch *pCtorObj)
STDMETHOD_ (BOOL, CanBePooled)()
STDMETHOD_ (VOID, Deactivate)()
STDMETHOD() | Write (BSTR buf, DWORD dwID)

Private Attributes

HANDLE m_hFile
IContextState * | m_pContextState

Detailed Description

Definition at line 29 of file LogFile.h.

Constructor & Destructor Documentation

CLogFile::CLogFile ( ) [inline]

Definition at line 37 of file LogFile.h.

  {
  }

CLogFile::~CLogFile ( )

Definition at line 41 of file LogFile.Cpp.

{
  // close the file
  CloseHandle(m_hFile);
}

Member Function Documentation

HRESULT CLogFile::Activate ( void ) [private]

Definition at line 57 of file LogFile.Cpp.

{
  IObjectContext* pObjectContext;

  // get our context
  HRESULT hr = GetObjectContext(&pObjectContext);
  if (FAILED(hr))
    return hr;

  // now get the ContextState
  hr = pObjectContext->QueryInterface(IID_IContextState, (void **)&m_pContextState);
  if (FAILED(hr))
  {
    pObjectContext->Release();
    return hr;
  }
  return hr;

}

HRESULT CLogFile::Construct ( IDispatch * pCtorObj ) [private]

Definition at line 114 of file LogFile.Cpp.

{
  // first we need to get the IObjectConstructString from the IDispatch
  // passed in

  IObjectConstructString  *pOCS = NULL;
  HRESULT hr = pCtorObj->QueryInterface(IID_IObjectConstructString, (void **)&pOCS);
  if FAILED(hr)
    return hr;

  // get the construction string
  BSTR  bstrLogFileName;
  hr = pOCS->get_ConstructString(&bstrLogFileName);
  if FAILED(hr)
  {
    // free our file name string
    SysFreeString(bstrLogFileName);
    pOCS->Release();
    return hr;
  }

  // if we didn't get a value then default
  if (!bstrLogFileName)
    return E_FAIL;

  // open the file
  m_hFile = CreateFile(bstrLogFileName,
              GENERIC_WRITE,
              FILE_SHARE_READ,
              NULL,
              OPEN_ALWAYS,
              FILE_ATTRIBUTE_NORMAL,
              NULL);
  if (m_hFile == INVALID_HANDLE_VALUE)
  {
    // free our file name string
    SysFreeString(bstrLogFileName);
    pOCS->Release();
    return E_FAIL;
  }

  // if we have a new file the size will be zero so write out the Unicode
  // byte order
  DWORD dwSize = GetFileSize(m_hFile, NULL);
  DWORD dwBytesWritten = 0;
  ULONG dwUnicodeByteOrder = 0xFEFF;  // Unicode stream header
  if (dwSize == 0)
  {
    if (!WriteFile(m_hFile, &dwUnicodeByteOrder, 2, &dwBytesWritten, NULL))
    {
      // free our file name string
      SysFreeString(bstrLogFileName);
      pOCS->Release();
      return E_FAIL;
    }
  }

  // free our file name string
  SysFreeString(bstrLogFileName);

  pOCS->Release();

  return S_OK;
}

CLogFile::STDMETHOD_ | ( | BOOL | ,
 |  | CanBePooled |  |
 | ) |  |  | [private]
CLogFile::STDMETHOD_ | ( | VOID | ,
 |  | Deactivate |  |
 | ) |  |  | [private]
STDMETHODIMP CLogFile::Write | ( | BSTR | buf,
 |  | DWORD | dwID |
 | ) |  |  | [private]

Definition at line 189 of file LogFile.Cpp.

{

  HRESULT hr = S_OK;

  DWORD dwPos = 0;
  DWORD dwBytesWritten = 0;
  _bstr_t newBuf;
  DWORD dwBufLen = 0;

  // get the local date and time
  int nSize = GetDateFormat(NULL, 0, NULL, NULL, NULL, 0);
  WCHAR* sBuffer = new WCHAR[nSize];
  GetDateFormatW(NULL, 0, NULL, NULL, sBuffer, nSize);
  newBuf = sBuffer;
  delete [] sBuffer;

  newBuf += L" ";

  nSize = GetTimeFormat(NULL, 0, NULL, NULL, NULL, 0);
  sBuffer = new WCHAR[nSize];
  GetTimeFormatW(NULL, 0, NULL, NULL, sBuffer, nSize);
  newBuf += sBuffer;
  delete [] sBuffer;

  // put the proc ID and the text passed in on
  sBuffer = new WCHAR[200];
  wsprintfW(sBuffer, L" : ProcID = %#08x : ", dwID);
  newBuf += sBuffer;
  delete [] sBuffer;
  newBuf += buf;

  dwBufLen = SysStringByteLen(newBuf);

    dwPos = SetFilePointer(m_hFile, 0, NULL, FILE_END);
    if (!WriteFile(m_hFile, (wchar_t *)newBuf, dwBufLen, &dwBytesWritten, NULL))
  {
    hr = E_FAIL;
  }

    m_pContextState->SetDeactivateOnReturn(TRUE);

  return hr;
}

Member Data Documentation

HANDLE CLogFile::m_hFile [private]

Definition at line 67 of file LogFile.h.

IContextState* CLogFile::m_pContextState [private]

Definition at line 68 of file LogFile.h.

The documentation for this class was generated from the following files:
  • Com/Services/Object_Pooling/PoolTest/LogWriter/LogFile.h
  • Com/Services/Object_Pooling/PoolTest/LogWriter/LogFile.Cpp
Generated on Wed Nov 13 2024 16:56:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CLoginDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions

CLoginDlg Class Reference

#include "LoginDlg.h"

List of all members.

Public Types

enum | { IDD = IDD_LOGIN }
enum | { IDD = IDD_LOGIN }
enum | { IDD = IDD_LOGIN }

Public Member Functions

CLoginDlg (CWnd *pParent=NULL)
CLoginDlg (CWnd *pParent=NULL)
CLoginDlg (CWnd *pParent=NULL)

Public Attributes

BOOL m_fDsEnabledLocaly
CString m_strLogin

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
virtual void | DoDataExchange (CDataExchange *pDX)
virtual void | DoDataExchange (CDataExchange *pDX)
BOOL IsDsEnabledLocaly ()

Detailed Description

Definition at line 21 of file LoginDlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 29 of file LoginDlg.h.

{ IDD = IDD_LOGIN };

anonymous enum
Enumerator:
IDD

Definition at line 28 of file LoginDlg.h.

{ IDD = IDD_LOGIN };

anonymous enum
Enumerator:
IDD

Definition at line 28 of file logindlg.h.

{ IDD = IDD_LOGIN };

Constructor & Destructor Documentation

CLoginDlg::CLoginDlg ( CWnd * pParent = NULL )

Definition at line 31 of file LoginDlg.Cpp.

  : CDialog(CLoginDlg::IDD, pParent)
{
  //{{AFX_DATA_INIT(CLoginDlg)
  m_strLogin = _T("");
  //}}AFX_DATA_INIT
}

CLoginDlg::CLoginDlg ( CWnd * pParent = NULL )
CLoginDlg::CLoginDlg ( CWnd * pParent = NULL )

Member Function Documentation

void CLoginDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 40 of file LoginDlg.Cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CLoginDlg)
  DDX_Text(pDX, IDC_EDIT_LOGIN, m_strLogin);
  //}}AFX_DATA_MAP
}

virtual void CLoginDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]
virtual void CLoginDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]
BOOL CLoginDlg::IsDsEnabledLocaly ( ) [protected]

Definition at line 63 of file logindlg.cpp.

                   :

      The routine checks whether the local computer is operating in domain (DS-enabled) mode
      or in workgroup (DS-disabled) mode.

Arguments:

      None

Return Value:

      TRUE     -  domain (DS-enabled) mode.
      FALSE    -  workgroup (DS-disabled) mode.

--*/

{

    MQPRIVATEPROPS PrivateProps;
    QMPROPID       aPropId[MAX_VAR];
    MQPROPVARIANT  aPropVar[MAX_VAR];
    DWORD          cProp;
    HRESULT        hr;
    //
    // Specify the PROPID_PC_DS_ENABLED property, which indicates whether
  // the computer is enabled to access the directory service.
    //
    cProp = 0;

    aPropId[cProp] = PROPID_PC_DS_ENABLED;
    aPropVar[cProp].vt = VT_NULL;
    ++cProp;
    //
    // Create a PRIVATEPROPS structure.
    //
    PrivateProps.cProp = cProp;
  PrivateProps.aPropID = aPropId;
  PrivateProps.aPropVar = aPropVar;
    PrivateProps.aStatus = NULL;

    //
    // Retrieve the information.
    //

    //
    // This code is used to detect a DS connection.
    // This code is designed to allow compilation both on
    // NT 4.0 and on Windows 2000 adn later.
    //
    HINSTANCE hMqrtLibrary = GetModuleHandle(TEXT("mqrt.dll"));
  if(hMqrtLibrary == NULL)
  {
    AfxMessageBox("An incomplete installation of MSMQ was detected. Exiting...");
    exit(1);
  }

    typedef HRESULT (APIENTRY *MQGetPrivateComputerInformation_ROUTINE)(LPCWSTR , MQPRIVATEPROPS*);
    MQGetPrivateComputerInformation_ROUTINE pfMQGetPrivateComputerInformation =
          (MQGetPrivateComputerInformation_ROUTINE)GetProcAddress(hMqrtLibrary,
                           "MQGetPrivateComputerInformation");
    if(pfMQGetPrivateComputerInformation == NULL)
    {
        //
        // There is no entry point in the DLL matching this routine.
        // It must be an old version of mqrt.dll (MSMQ 1.0).
        // It will be OK to handle this case as a case of domain (DS-enabled) mode.
        //
        return TRUE;
    }

  hr = pfMQGetPrivateComputerInformation(
             NULL,
           &PrivateProps);
  if(FAILED(hr))
  {
        //
        // We were not able to determine whether the local computer is enabled to access the DS.
        // Notify the user and assume the worst case, i.e., that access to the DS is disasbled.
        //
        AfxMessageBox("No connection to the DS was detected.");
        return FALSE;
    }

    if(PrivateProps.aPropVar[0].boolVal == 0)
    {
        //
        // DS-disabled.
        //
        return FALSE;
    }

    return TRUE;

}

Member Data Documentation

BOOL CLoginDlg::m_fDsEnabledLocaly

Definition at line 32 of file logindlg.h.

CString CLoginDlg::m_strLogin

Definition at line 30 of file LoginDlg.h.

The documentation for this class was generated from the following files:
  • NetDS/MessageQueuing/c_draw/LoginDlg.h
  • NetDS/MessageQueuing/Imp_Draw/LoginDlg.h
  • NetDS/MessageQueuing/mqf_draw/logindlg.h
  • NetDS/MessageQueuing/c_draw/LoginDlg.Cpp
  • NetDS/MessageQueuing/Imp_Draw/LoginDlg.Cpp
  • NetDS/MessageQueuing/mqf_draw/logindlg.cpp
Generated on Wed Nov 13 2024 16:56:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CLUADMEXLib::CoClipBookServerEx Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • CLUADMEXLib
  • CLUADMEXLib::CoClipBookServerEx

CLUADMEXLib::CoClipBookServerEx Class Reference

import "ExtObjID.idl";

Detailed Description

Definition at line 37 of file ExtObjID.idl.

The documentation for this class was generated from the following file:
  • WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/ExtObjID.idl
Generated on Wed Nov 13 2024 16:58:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CLUADMEXLib::CoFileShareSampleEx Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • CLUADMEXLib
  • CLUADMEXLib::CoFileShareSampleEx

CLUADMEXLib::CoFileShareSampleEx Class Reference

import "ExtObjID.idl";

Detailed Description

Definition at line 37 of file ExtObjID.idl.

The documentation for this class was generated from the following file:
  • WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/ExtObjID.idl
Generated on Wed Nov 13 2024 16:58:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMain Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Attributes

CMain Class Reference

#include "Main.h"

List of all members.

Public Types

enum | { IDD = IDD_MAIN }

Public Member Functions

CMain ()
~CMain ()
LRESULT | OnCancel (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnClickedRadio_COMPlusSync (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnClickedRadio_Free (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnClickedRadio_STA (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnClickedStart (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnInitDialog (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
LRESULT | OnSize (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
LRESULT | OnTimer (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
void | UpdateCounters (DWORD lDelta)
void | UpdateUI (void)

Static Public Member Functions

static LRESULT | ThreadStart (LPVOID lp)

Private Types

enum | { eSTA = STA_OFFSET, eFree = FREE_OFFSET, eCOMPlus = COMSYNC_OFFSET }

Private Attributes

enum CMain:: { ... } | e_compType
BOOL m_bStop
DWORD m_curThreadCount
DWORD volatile | m_dwMaxTime
DWORD volatile | m_dwMinTime
DWORD m_dwTotalIters
DWORD m_dwTotalTime
DWORD m_iCookie
int | m_iIters

Detailed Description

Definition at line 31 of file Main.h.

Member Enumeration Documentation

anonymous enum [private]
Enumerator:
eSTA
eFree
eCOMPlus

Definition at line 35 of file Main.h.

       {
    eSTA = STA_OFFSET,
    eFree = FREE_OFFSET,
    eCOMPlus = COMSYNC_OFFSET
  } e_compType;

anonymous enum
Enumerator:
IDD

Definition at line 60 of file Main.h.

{ IDD = IDD_MAIN };

Constructor & Destructor Documentation

CMain::CMain ( ) [inline]

Definition at line 49 of file Main.h.

  {
    m_dwMaxTime = m_dwMinTime = m_dwTotalIters = m_dwTotalTime = 0 ;
    m_curThreadCount = 0;
    m_bStop = 0;
  }

CMain::~CMain ( ) [inline]

Definition at line 56 of file Main.h.

  {
  }

Member Function Documentation

LRESULT CMain::OnCancel | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled |
 | ) |  |  | [inline]

Definition at line 77 of file Main.h.

  {
    EndDialog(wID);
    return 0;
  }

LRESULT CMain::OnClickedRadio_COMPlusSync | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled |
 | ) |  |  | [inline]

Definition at line 88 of file Main.h.

  {
    e_compType = eCOMPlus;
    return 0;
  }

LRESULT CMain::OnClickedRadio_Free | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled |
 | ) |  |  | [inline]

Definition at line 93 of file Main.h.

  {
    e_compType = eFree;
    return 0;
  }

LRESULT CMain::OnClickedRadio_STA | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled |
 | ) |  |  | [inline]

Definition at line 98 of file Main.h.

  {
    e_compType = eSTA;
    return 0;
  }

LRESULT CMain::OnClickedStart | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 190 of file Main.Cpp.

{
  int iThread, iMaxThread;
  HANDLE *aThread;
  HRESULT hRes = S_OK;
  MSG msg;
  int iCountSignled = 0;
  DWORD result = 0;
  static BOOL bButtonCancel = FALSE;

  // check and see if we are a Start or Cancel
  if (bButtonCancel == TRUE)
  {
    // we are cancel so increment our variable. Our threads are watching this value
    // and will terminate when it isn't zero
    InterlockedIncrement((LONG*)&m_bStop);
  }
  else
  {
    // make our button a cancel
    SetDlgItemText(IDC_START, "Cancel");
    bButtonCancel = TRUE;
    // clear our stop indicator
    m_bStop = 0;

    // get an hourglass
      HCURSOR cOld=SetCursor(LoadCursor(NULL, IDC_WAIT));

    // disable our radio buttons
    ::EnableWindow(GetDlgItem(IDC_RADIO_COMSYNC), FALSE);
    ::EnableWindow(GetDlgItem(IDC_RADIO_FREE), FALSE);
    ::EnableWindow(GetDlgItem(IDC_RADIO_STA), FALSE);

    // set our timer to do the UI updates
    SetTimer(IDT_UIUPDATE, 1000);

    // reset all of the counters
    m_dwMaxTime = m_dwTotalIters = 0;
    m_dwTotalTime = 0;
    m_dwMinTime = MAXDWORD;
    m_curThreadCount = 0;

    // get the Thread count and the number of iterations
    iMaxThread = GetDlgItemInt(IDC_THREADCOUNT, NULL, FALSE);
    m_iIters = GetDlgItemInt(IDC_ITERCOUNT, NULL, FALSE);

    // set up our thread calling arrary for the handles
    aThread = new HANDLE[iMaxThread];

    // -----------
    // get the correct COM object and register it in the GIT
    // -----------
    ISyncTestPtr  pSyncTest;

    // depending on the select depends on what object we create
    switch (e_compType)
    {
      case eSTA:
        pSyncTest.CreateInstance(__uuidof(STATest));
        break;
      case eFree:
        pSyncTest.CreateInstance(__uuidof(FreeTest));
        break;
      case eCOMPlus:
        pSyncTest.CreateInstance(__uuidof(ComSyncTest));
        break;
    }

    // register our object in the GIT
    hRes = g_pGIT->RegisterInterfaceInGlobal(pSyncTest, __uuidof(ISyncTest), &m_iCookie);
    _ASSERTE(SUCCEEDED(hRes));

    // spin up all of the threads - we start suspended so we have a better chance of getting
    // all the threads running at one time
    for (iThread = 0; iThread < iMaxThread; iThread++)
    {
      aThread[iThread] = CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE) ThreadStart, (LPVOID) this, CREATE_SUSPENDED , NULL);
    }

    // let all the threads start
    for (iThread = 0; iThread < iMaxThread; iThread++)
    {
      ResumeThread(aThread[iThread]);
    }

    // wait for the threads to be done but keep pumping message
    while (iMaxThread > 0)
    {
      // wait for a message or a thread to exit
      result = WaitForMultipleObjects((iMaxThread > MAXIMUM_WAIT_OBJECTS) ? MAXIMUM_WAIT_OBJECTS : iMaxThread, aThread, FALSE, 250);
      // pump any messages that have built up
      while (PeekMessage(&msg, NULL, NULL, NULL, PM_REMOVE))
      {
        DispatchMessage(&msg);
      }
      // if we failed just ASSERT we shouldn't be failing
      if (result == WAIT_FAILED)
      {
        result = GetLastError();
        _ASSERTE(FALSE);
      }
      else
      // -----------
      // if one of our objects completed then close that handle and remove
      // that handle from the array of handles to wait on
      // -----------
      if (result < WAIT_OBJECT_0 + iMaxThread)
      {
        // move the last handle we were waiting on into the spot we just finished

        // make sure we close the handle before we lose it
        CloseHandle(aThread[result-WAIT_OBJECT_0]);
        // replace the handle of the thread that just ended with the last one in the list
        aThread[result-WAIT_OBJECT_0] = aThread[iMaxThread - 1];
        // we have one less thread to watch
        iMaxThread--;
      }
    }

    // Stop the timer and update our UI one last time
    KillTimer(IDT_UIUPDATE);
    UpdateUI();

    // remove our object from the GIT
    hRes = g_pGIT->RevokeInterfaceFromGlobal(m_iCookie);
    _ASSERTE(SUCCEEDED(hRes));

    // clean up
    delete[] aThread;

    // enable our radio buttons
    ::EnableWindow(GetDlgItem(IDC_RADIO_COMSYNC), TRUE);
    ::EnableWindow(GetDlgItem(IDC_RADIO_FREE), TRUE);
    ::EnableWindow(GetDlgItem(IDC_RADIO_STA), TRUE);

    // put cursor back
      cOld=SetCursor(LoadCursor(NULL, IDC_WAIT));

    // put our button back
    bButtonCancel = FALSE;
    SetDlgItemText(IDC_START, "Start");
  }

  return 0;
}

LRESULT CMain::OnInitDialog | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 159 of file Main.Cpp.

{
  // start with the STA radio button checked
  SendDlgItemMessage(IDC_RADIO_STA, BM_SETCHECK, BST_CHECKED);
  e_compType = eSTA;

  // set up some default threads and iterations
  SendDlgItemMessage(IDC_THREADCOUNT, EM_LIMITTEXT, 4);
  SetDlgItemText(IDC_THREADCOUNT, _T("50"));

  SendDlgItemMessage(IDC_ITERCOUNT, EM_LIMITTEXT, 6);
  SetDlgItemText(IDC_ITERCOUNT, _T("1000"));

  // Center ourselves
  CenterWindow();

  return 1;  // Let the system set the focus
}

LRESULT CMain::OnSize | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL & | bHandled |
 | ) |  |  | [inline]

Definition at line 82 of file Main.h.

  {
    // TODO : Add Code for message handler. Call DefWindowProc if necessary.
    return 0;
  }

LRESULT CMain::OnTimer | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 344 of file Main.Cpp.

{
  // just forward the call
  UpdateUI();
  return 0;
}

LRESULT CMain::ThreadStart ( LPVOID lp ) [static]

Definition at line 60 of file Main.Cpp.

{
  CMain     *pThis;
  HRESULT     hRes = S_OK;
  LARGE_INTEGER llTick1, llTick2, llFreq;
  DWORD     lDeltaTick = 0;
  ISyncTestPtr  pSyncTest;
  int       iIter;

  // cast our incoming void pointer to our class
  pThis = (CMain*)lp;

  // increment the number of running threads
  InterlockedIncrement((LONG *)&pThis->m_curThreadCount);

  hRes = CoInitializeEx(NULL, COINIT_MULTITHREADED);
  _ASSERTE(SUCCEEDED(hRes));

  // get the interface of the created object from the GIT
  hRes = g_pGIT->GetInterfaceFromGlobal(pThis->m_iCookie, __uuidof(ISyncTest), (void **)&pSyncTest);
  _ASSERTE(SUCCEEDED(hRes));

  // get the frequency of our counter
  QueryPerformanceFrequency(&llFreq);

  // call the Exercise function the number of times desired
  for (iIter = 0;iIter < pThis->m_iIters; iIter++)
  {
    // watch for a signal to stop
    if (pThis->m_bStop)
      break;

    // get the starting tick
    QueryPerformanceCounter(&llTick1);

    // make a call into the object
    hRes = pSyncTest->Exercise();
      _ASSERTE(SUCCEEDED(hRes));

    // get the ending tick
    QueryPerformanceCounter(&llTick2);

    // calculate our elapsed time in ms
    lDeltaTick = (DWORD) ((float)(llTick2.LowPart - llTick1.LowPart) / llFreq.LowPart * 1000);

    // update all of our counters
    pThis->UpdateCounters(lDeltaTick);
  }

  // decrement the number of threads
  InterlockedDecrement((LONG *)&pThis->m_curThreadCount);

  CoUninitialize();

  return 0;
}

void CMain::UpdateCounters ( DWORD lDelta )

Definition at line 126 of file Main.Cpp.

{
  DWORD curValue;

  // update the counters used by the UI

  InterlockedIncrement((LONG*)&m_dwTotalIters);
  InterlockedExchangeAdd((LONG*)&m_dwTotalTime, lDelta);

  // compare and change our values.
  // this is where we need m_dwMaxTime and m_dwMinTime to be volatile
  curValue = m_dwMaxTime;
  if (lDelta > curValue)
  {
    InterlockedCompareExchange((LONG*)&m_dwMaxTime, lDelta, curValue);
  }
  else
  {
    curValue = m_dwMinTime;
    if (lDelta <= curValue)
    {
      InterlockedCompareExchange((LONG*)&m_dwMinTime, lDelta, curValue);
    }
  }
}

void CMain::UpdateUI ( void )

Definition at line 358 of file Main.Cpp.

{
  // we just need to update the UI when our timer fires

  TCHAR szBuffer[40];

  // update the UI
  SetDlgItemInt(IDC_MAXTIMEBASE + e_compType, m_dwMaxTime);
  SetDlgItemInt(IDC_MINTIMEBASE + e_compType, m_dwMinTime);

  _snprintf(szBuffer, 40, "%4.2f", (float) m_dwTotalTime / m_dwTotalIters);
  SetDlgItemText(IDC_AVGTIMEBASE + e_compType, szBuffer);

  _snprintf(szBuffer, 40, "%ld", m_dwTotalIters);
  SetDlgItemText(IDC_ITERTOTAL, szBuffer);

  SetDlgItemInt(IDC_THREADRUNNING, m_curThreadCount);

}

Member Data Documentation

enum { ... } CMain::e_compType [private]
BOOL CMain::m_bStop [private]

Definition at line 46 of file Main.h.

DWORD CMain::m_curThreadCount [private]

Definition at line 43 of file Main.h.

DWORD volatile CMain::m_dwMaxTime [private]

Definition at line 41 of file Main.h.

DWORD volatile CMain::m_dwMinTime [private]

Definition at line 41 of file Main.h.

DWORD CMain::m_dwTotalIters [private]

Definition at line 42 of file Main.h.

DWORD CMain::m_dwTotalTime [private]

Definition at line 42 of file Main.h.

DWORD CMain::m_iCookie [private]

Definition at line 45 of file Main.h.

int CMain::m_iIters [private]

Definition at line 44 of file Main.h.

The documentation for this class was generated from the following files:
  • Com/Services/Concurrency/SyncComp/Main.h
  • Com/Services/Concurrency/SyncComp/Main.Cpp
Generated on Wed Nov 13 2024 16:56:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMainFrame Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Protected Attributes

CMainFrame Class Reference

#include "mainfrm.h"

List of all members.

Public Member Functions

CMainFrame ()
virtual | ~CMainFrame ()
virtual | ~CMainFrame ()
virtual | ~CMainFrame ()
virtual | ~CMainFrame ()
void | Add2OpenedQueuePathNameArray (ARRAYQ *NewPath)
void | Add2PathNameArray (ARRAYQ *NewPath)
void | ClassToString (unsigned short MsgClass, LPTSTR pszStatus)
void | CleanPathNameArray ()
void | DisplayOpenedQueuePathNameArray ()
void | DisplayPathNameArray ()
BOOL | GetQueueHandle (TCHAR *pszPathName, QUEUEHANDLE *phClosedQueueHandle)
BOOL | IsFormatName (TCHAR *pszName)
BOOL IsOpenedQueueArrayEmpty ()
void | MoveToOpenedQueuePathNameArray (TCHAR *pszPathName, TCHAR *pszFormatName, QUEUEHANDLE hQueue, DWORD dwAccess)
void | MoveToPathNameArray (TCHAR *pszPathName)
virtual BOOL | OnCmdMsg (UINT nID, int nCode, void *pExtra, AFX_CMDHANDLERINFO *pHandlerInfo)
virtual BOOL | PreCreateWindow (CREATESTRUCT &cs)
virtual BOOL | PreCreateWindow (CREATESTRUCT &cs)
virtual BOOL | PreCreateWindow (CREATESTRUCT &cs)
virtual BOOL | PreCreateWindow (CREATESTRUCT &cs)
ARRAYQ * | RemoveFromOpenedQueuePathNameArray (TCHAR *pszPathName)
ARRAYQ * | RemoveFromPathNameArray (TCHAR *pszPathFormatName)
BOOL | TranslatePathNameToFormatName (TCHAR *pszPathName, TCHAR *pszFormatName)
void | UpdatePathNameArrays ()

Protected Member Functions

CMainFrame ()
CMainFrame ()
CMainFrame ()
afx_msg void | OnApiCloseQueue ()
afx_msg void | OnApiCreateQueue ()
afx_msg void | OnApiDeleteQueue ()
afx_msg void | OnApiLocate ()
afx_msg void | OnApiOpenQueue ()
afx_msg void | OnApiReceiveMessage ()
afx_msg void | OnApiSendMessage ()
afx_msg int | OnCreate (LPCREATESTRUCT lpCreateStruct)
afx_msg int | OnCreate (LPCREATESTRUCT lpCreateStruct)
afx_msg int | OnCreate (LPCREATESTRUCT lpCreateStruct)
afx_msg void | OnMixerPlay ()
afx_msg void | OnSetFocus (CWnd *pOldWnd)
void | OnUpdateFrameTitle (BOOL bAddToTitle)
afx_msg void | OnUpdateMixerPlay (CCmdUI *pCmdUI)

Protected Attributes

CArray< ARRAYQ *, ARRAYQ * > | m_OpenedQueuePathNameArray
CArray< ARRAYQ *, ARRAYQ * > | m_PathNameArray
CDialogBar | m_wndDlgBar
CStatusBar | m_wndStatusBar
CToolBar | m_wndToolBar
CChildView m_wndView

Detailed Description

Definition at line 18 of file mainfrm.h.

Constructor & Destructor Documentation

CMainFrame::CMainFrame ( )

Definition at line 44 of file mainfrm.cpp.

{
  // TODO: add member initialization code here

}

CMainFrame::~CMainFrame ( ) [virtual]

Definition at line 50 of file mainfrm.cpp.

{
}

CMainFrame::CMainFrame ( ) [protected]
virtual CMainFrame::~CMainFrame ( ) [virtual]
CMainFrame::CMainFrame ( ) [protected]
virtual CMainFrame::~CMainFrame ( ) [virtual]
CMainFrame::CMainFrame ( ) [protected]
virtual CMainFrame::~CMainFrame ( ) [virtual]

Member Function Documentation

void CMainFrame::Add2OpenedQueuePathNameArray ( ARRAYQ * NewPath ) [inline]

Definition at line 128 of file MainFrm.h.

                      {m_OpenedQueuePathNameArray.Add(NewPath);}

void CMainFrame::Add2PathNameArray ( ARRAYQ * NewPath ) [inline]

Definition at line 99 of file MainFrm.h.

{m_PathNameArray.Add(NewPath);}

void CMainFrame::ClassToString | ( | unsigned short | MsgClass,
 |  | LPTSTR | pszStatus
 | ) |  |

Definition at line 691 of file MainFrm.Cpp.

    {
      //
      // Loop through the StringClass array to find MsgClass.
      //
      ASSERT(pszStatus != NULL);

      DWORD dwIndex = 0;
      while (StringClass[dwIndex].pszDescription != NULL)
      {
        if (StringClass[dwIndex].mclass == MsgClass)
        {
          _tcsncpy(pszStatus, StringClass[dwIndex].pszDescription, BUFFERSIZE*2 -1);
          pszStatus[BUFFERSIZE*2 -1] = '\0';
          return;
        }
        dwIndex++;
      }

      //
      // MsgClass was not found, so print the default error.
      //
      _stprintf(pszStatus,TEXT("The NACK (0x%X) message was read successfully."), MsgClass);
    }

void CMainFrame::CleanPathNameArray ( )

Definition at line 325 of file MainFrm.Cpp.

    {
      ARRAYQ* pQueue;

      while (m_PathNameArray.GetSize() > 0)
      {
        pQueue = m_PathNameArray[0];
        m_PathNameArray.RemoveAt(0);
        delete pQueue;
      }
    }

void CMainFrame::DisplayOpenedQueuePathNameArray ( )

Definition at line 632 of file MainFrm.Cpp.

    {
      int Index;
      int MaxIndex = m_OpenedQueuePathNameArray.GetSize();
      TCHAR szMsgBuffer[BUFFERSIZE];

      _stprintf(szMsgBuffer, TEXT("   Currently Opened Queues :"));
      PrintToScreen(szMsgBuffer);
      //
      // Loop through the open queue path name array.
      //
      for (Index=0; Index<MaxIndex; Index++)
      {
        //
        // Print the path names or format names.
        //

        if (m_OpenedQueuePathNameArray[Index]->bFormatNameOnly==TRUE)
        {
          _stprintf(szMsgBuffer, TEXT("\t%d. %s"),Index+1, m_OpenedQueuePathNameArray[Index]->szFormatName);
          PrintToScreen(szMsgBuffer);

        }
        else
        {

          _stprintf(szMsgBuffer, TEXT("\t%d. %s"),Index+1, m_OpenedQueuePathNameArray[Index]->szPathName);
          PrintToScreen(szMsgBuffer);
        }
      }
    }

void CMainFrame::DisplayPathNameArray ( )

Definition at line 595 of file MainFrm.Cpp.

    {
      int Index;
      int MaxIndex = m_PathNameArray.GetSize();
      TCHAR szMsgBuffer[BUFFERSIZE];

      _stprintf(szMsgBuffer, TEXT("   Located Queues :"));
      PrintToScreen(szMsgBuffer);
      //
      // Loop through the path name array.
      //
      for (Index=0; Index<MaxIndex; Index++)
      {
        //
        // Print the path names or format names.
        //

        if (m_PathNameArray[Index]->bFormatNameOnly==TRUE)
        {
          _stprintf(szMsgBuffer, TEXT("\t%d. %s"),Index+1, m_PathNameArray[Index]->szFormatName);
          PrintToScreen(szMsgBuffer);

        }
        else
        {
          _stprintf(szMsgBuffer, TEXT("\t%d. %s"),Index+1, m_PathNameArray[Index]->szPathName);
          PrintToScreen(szMsgBuffer);
        }
      }
    }

BOOL CMainFrame::GetQueueHandle | ( | TCHAR * | pszPathName,
 |  | QUEUEHANDLE * | phClosedQueueHandle
 | ) |  |

Definition at line 498 of file MainFrm.Cpp.

    {
      int Index;
      int MaxIndex = m_OpenedQueuePathNameArray.GetSize();
      ARRAYQ* pQueue;

      //
      // Loop through the open queue path name array.
      //
      for (Index = 0; Index<MaxIndex; Index++)
      {
        if (m_OpenedQueuePathNameArray[Index]->bFormatNameOnly==TRUE)
        {
          if (_tcscmp(szPathFormatName, m_OpenedQueuePathNameArray[Index]->szFormatName)==0)
          {
            //
            // A match was found.
            //
            pQueue = m_OpenedQueuePathNameArray[Index];
            *phClosedQueueHandle = pQueue->hHandle;
            return TRUE;
          }
        }
        else
        {

          if (_tcscmp(szPathFormatName, m_OpenedQueuePathNameArray[Index]->szPathName)==0)
          {
            //
            // A match was found.
            //
            pQueue = m_OpenedQueuePathNameArray[Index];
            *phClosedQueueHandle = pQueue->hHandle;
            return TRUE;
          }
        }
      }
      return FALSE; // No match was found.
    }

BOOL CMainFrame::IsFormatName ( TCHAR * pszName )

Definition at line 2012 of file MainFrm.Cpp.

{
  int Index;
  int MaxIndex = m_OpenedQueuePathNameArray.GetSize();

  for (Index=0; Index<MaxIndex; Index++)
  {
    if (_tcscmp(pszName, m_OpenedQueuePathNameArray[Index]->szFormatName) == 0)
    {
      return TRUE;
    }
  }

  MaxIndex=m_PathNameArray.GetSize();
  for (Index=0; Index<MaxIndex; Index++)
  {
    if (_tcscmp(pszName, m_PathNameArray[Index]->szFormatName) == 0)
    {
      return TRUE;
    }
  }
  return FALSE;
}

BOOL CMainFrame::IsOpenedQueueArrayEmpty ( )

Definition at line 388 of file MainFrm.Cpp.

    {
      if (m_OpenedQueuePathNameArray.GetSize() <= 0)
      {
        return TRUE;
      }
      else
      {
        return FALSE;
      }
    }

void CMainFrame::MoveToOpenedQueuePathNameArray | ( | TCHAR * | pszPathName,
 |  | TCHAR * | pszFormatName,
 |  | QUEUEHANDLE | hQueue,
 |  | DWORD | dwAccess
 | ) |  |

Definition at line 407 of file MainFrm.Cpp.

    {
      ARRAYQ* pQueue=NULL;
      //check whether pQueue is listed in the Located Queue.
      pQueue = RemoveFromPathNameArray(szPathName);
      //if not found in located Q:Allocated new ARRAYQ.
      if (pQueue==NULL)
      {
        pQueue=new ARRAYQ;
        if (pQueue==NULL)
        {
          AfxMessageBox(_T("Could not Allocate memory in function CMainFrame::MoveToOpenedQueuePathNameArray. Exiting"));
          exit (1);
        }
        _tcsncpy(pQueue->szFormatName,szFormatName,MAX_Q_PATHNAME_LEN-1);
        pQueue->szFormatName[MAX_Q_PATHNAME_LEN-1] = '\0';
        _tcsncpy(pQueue->szPathName,szPathName,MAX_Q_PATHNAME_LEN-1);
        pQueue->szFormatName[MAX_Q_PATHNAME_LEN-1] = '\0';
        if (_tcscmp(pQueue->szPathName,_T(""))==0)
        {
          pQueue->bFormatNameOnly=true;
        }
      }
      pQueue->hHandle = hQueue;                     // add Queue Handle.
      pQueue->dwAccess = dwAccess;                  // add Queue Access rights.

      Add2OpenedQueuePathNameArray(pQueue);
    }

void CMainFrame::MoveToPathNameArray ( TCHAR * pszPathName )

Definition at line 443 of file MainFrm.Cpp.

    {
      ARRAYQ* pQueue;

      pQueue = RemoveFromOpenedQueuePathNameArray(pszPathName);
      Add2PathNameArray(pQueue);
    }

void CMainFrame::OnApiCloseQueue ( ) [protected]

Definition at line 1126 of file MainFrm.Cpp.

    {

      TCHAR szPathNameBuffer[MAX_Q_PATHNAME_LEN];
      TCHAR szMsgBuffer[BUFFERSIZE];

      HRESULT hr;

      DWORD dwFormatNameBufferLength = MAX_Q_PATHNAME_LEN;

      QUEUEHANDLE hClosedQueueHandle;

      //
      // Display the Close Queue dialog box.
      //
      CCloseQueueDialog CloseQueueDialog(&m_OpenedQueuePathNameArray);

      if (CloseQueueDialog.DoModal() == IDCANCEL)
      {
        return;
      }

      CloseQueueDialog.GetPathName(szPathNameBuffer);

      //
      // Get the handle of the queue to be closed.
      //
      if (GetQueueHandle(szPathNameBuffer, &hClosedQueueHandle) == FALSE)
      {
        //
        // An error occurred, so display a message.
        //
        _stprintf(szMsgBuffer, TEXT("The queue could not be closed because it was not opened before."));
        MessageBox(szMsgBuffer, TEXT("ERROR"), MB_OK);
        return;
      }

      //
      // Close the queue.
      //
      hr = MQCloseQueue(hClosedQueueHandle);   // The handle of the queue to be closed is passed.
      if (FAILED(hr))
      {
        //
        // An error occurred, so display a message.
        //
        _stprintf(szMsgBuffer, TEXT("MQCloseQueue failed. Error code: 0x%x."),hr);
        MessageBox(szMsgBuffer, TEXT("ERROR"), MB_OK);
      }
      else
      {
        //
        // Success was achieved, so write in the edit control.
        //
        _stprintf(szMsgBuffer, TEXT("The queue %s was closed successfully."), szPathNameBuffer);
        PrintToScreen(szMsgBuffer);
        //
        // Move the queue from the open queue path name array to the path name array.
        //
        MoveToPathNameArray(szPathNameBuffer);
      }
    }

void CMainFrame::OnApiCreateQueue ( ) [protected]

Definition at line 725 of file MainFrm.Cpp.

    {
      // TODO: Add your command handler code here.

      TCHAR szMsgBuffer[BUFFERSIZE];

      MQQUEUEPROPS QueueProps;
      MQPROPVARIANT aVariant[MAXINDEX];
      QUEUEPROPID aPropId[MAXINDEX];
      DWORD PropIdCount = 0;
      HRESULT hr;

      PSECURITY_DESCRIPTOR pSecurityDescriptor;

      TCHAR szPathNameBuffer[MAX_Q_PATHNAME_LEN];
      TCHAR szFormatNameBuffer[MAX_Q_FORMATNAME_LEN];
      TCHAR szLabelBuffer[MAX_Q_PATHNAME_LEN];
      DWORD dwFormatNameBufferLength = MAX_Q_FORMATNAME_LEN;

      //
      // Display the Create Queue dialog box.
      //
      CCreateQueueDialog CreateQueueDialog;

      if(CreateQueueDialog.DoModal() == IDCANCEL)
      {
        return;
      }
      CreateQueueDialog.GetPathName(szPathNameBuffer);
      CreateQueueDialog.GetLabel(szLabelBuffer);

      //
      // Get the input fields from the dialog box
      // and prepare the property array PROPVARIANT.
      //

      //
      // Set the PROPID_Q_PATHNAME property.
      //
      aPropId[PropIdCount] = PROPID_Q_PATHNAME;    // PropId
      aVariant[PropIdCount].vt = VT_LPWSTR;        // Type
      aVariant[PropIdCount].pwszVal = new WCHAR[MAX_Q_PATHNAME_LEN];
      _mqscpy(aVariant[PropIdCount].pwszVal, szPathNameBuffer); // Value

      PropIdCount++;

      //
      // Set the PROPID_Q_LABEL property.
      //
      aPropId[PropIdCount] = PROPID_Q_LABEL;    // PropId
      aVariant[PropIdCount].vt = VT_LPWSTR;     // Type
      aVariant[PropIdCount].pwszVal = new WCHAR[MAX_Q_PATHNAME_LEN];
      _mqscpy(aVariant[PropIdCount].pwszVal, szLabelBuffer); // Value

      PropIdCount++;

      //
      // Initialize the MQEUEUPROPS structure.
      //
      QueueProps.cProp = PropIdCount;           //Number of properties
      QueueProps.aPropID = aPropId;             //Identifiers of properties
      QueueProps.aPropVar = aVariant;           // Value of properties
      QueueProps.aStatus = NULL;                //No error reports

      //
      // No security is defined (default).
      //
      pSecurityDescriptor = NULL;

      //
      // Create the queue.
      //
    #ifdef UNICODE
      hr = MQCreateQueue(
          pSecurityDescriptor,            //Security
          &QueueProps,                    //Queue properties
          szFormatNameBuffer,             //Output: Format name
          &dwFormatNameBufferLength       //Output: Format name length
          );
    #else
      WCHAR szwFormatNameBuffer[MAX_Q_FORMATNAME_LEN];
      hr = MQCreateQueue(
          pSecurityDescriptor,            //Security
          &QueueProps,                    //Queue properties
          szwFormatNameBuffer,            //Output: Format name
          &dwFormatNameBufferLength       //Output: Format name length
          );

      if (SUCCEEDED(hr))
      {
        size_t rc =wcstombs(szFormatNameBuffer, szwFormatNameBuffer, dwFormatNameBufferLength);
        if (rc == (size_t)(-1))
        {
          AfxMessageBox("An unsupported wide character was encountered. Exiting...");
          exit(1);
        }
      }
    #endif

      if (FAILED(hr))
      {
        //
        // An error occurred, so display a message.
        //
        _stprintf(szMsgBuffer, TEXT("MQCreateQueue failed. Error code: 0x%x."),hr);
        MessageBox(szMsgBuffer, TEXT("ERROR"), MB_OK);
      }
      else
      {
        //
        // Success was achieved, so write to the edit control.
        //
        _stprintf(szMsgBuffer, TEXT("The queue %s was created successfully. ( FormatName: %s )"),
          szPathNameBuffer, szFormatNameBuffer);
        PrintToScreen(szMsgBuffer);

        //
        // Add the new queue to the path name array.
        //
        ARRAYQ* pNewQueue = new ARRAYQ;
        if (pNewQueue == NULL)
          return;

        //
        // Save the path name and the format name in the ARRAYQ structure.
        //
        _tcsncpy (pNewQueue->szPathName, szPathNameBuffer, MAX_Q_PATHNAME_LEN-1);
        pNewQueue->szPathName[MAX_Q_PATHNAME_LEN-1] = '\0';

        _tcsncpy (pNewQueue->szFormatName, szFormatNameBuffer, MAX_Q_FORMATNAME_LEN-1);
        pNewQueue->szFormatName[MAX_Q_FORMATNAME_LEN-1] = '\0';

        Add2PathNameArray(pNewQueue);

      }

      //
      // Free the allocated memory.
      //
      delete   aVariant[0].pwszVal;
      delete   aVariant[1].pwszVal;
    }

void CMainFrame::OnApiDeleteQueue ( ) [protected]

Definition at line 879 of file MainFrm.Cpp.

    {
      // TODO: Add your command handler code here.
      TCHAR szPathNameBuffer[MAX_Q_PATHNAME_LEN];
      TCHAR szFormatNameBuffer[MAX_Q_PATHNAME_LEN];
      TCHAR szMsgBuffer[BUFFERSIZE];

      HRESULT hr;

      DWORD dwFormatNameBufferLength = MAX_Q_PATHNAME_LEN;

      CDeleteQueueDialog DeleteQueueDialog(&m_PathNameArray);

      //
      // Display the Delete Queue dialog box.
      //
      if (DeleteQueueDialog.DoModal() == IDCANCEL)
      {
        return;
      }

      DeleteQueueDialog.GetPathName(szPathNameBuffer);

      //
      // Translate the path name to a format name using the ARRAYQ array.
      //
      if (TranslatePathNameToFormatName(szPathNameBuffer, szFormatNameBuffer) == FALSE)
      {
        //
        // An error occurred, so display a message.
        //
        _stprintf(szMsgBuffer, TEXT("The queue was not found."));
        MessageBox(szMsgBuffer, TEXT("ERROR"), MB_OK);
        return;
      }

      //
      // Delete the queue.
      //
    #ifdef UNICODE
      hr = MQDeleteQueue(szFormatNameBuffer);  // Format name of the queue to be deleted
    #else
      WCHAR szwFormatNameBuffer[MAX_Q_FORMATNAME_LEN];
      size_t rc = mbstowcs(szwFormatNameBuffer, szFormatNameBuffer, _tcslen(szFormatNameBuffer)+1);
      if (rc == (size_t)(-1))
      {
        AfxMessageBox("An unsupported wide character was encountered. Exiting...");
        exit(1);
      }
      hr = MQDeleteQueue(szwFormatNameBuffer);  // Format name of the queue to be deleted
    #endif

      if (FAILED(hr))
      {
        //
        // An error occurred, so display a message.
        //
        _stprintf(szMsgBuffer, TEXT("MQDeleteQueue failed. Error code: 0x%x."),hr);
        MessageBox(szMsgBuffer, TEXT("ERROR"), MB_OK);
      }
      else
      {
        //
        // Success was achieved, so write in the edit control.
        //
        _stprintf(szMsgBuffer, TEXT("The queue %s was deleted successfully."), szPathNameBuffer);
        PrintToScreen(szMsgBuffer);
        //
        // Delete the name from the path name array.
        //
        ARRAYQ* DeletedQueue = RemoveFromPathNameArray(szPathNameBuffer);
        if (DeletedQueue != NULL)
        {
          delete DeletedQueue;
        }
      }
    }

void CMainFrame::OnApiLocate ( ) [protected]

Definition at line 1778 of file MainFrm.Cpp.

    {
      // TODO: Add your command handler code here.
      TCHAR szMsgBuffer[BUFFERSIZE];
      TCHAR szLabelBuffer[BUFFERSIZE];

      HRESULT hr;

      MQPROPERTYRESTRICTION PropertyRestriction;
      MQRESTRICTION  Restriction;
      MQCOLUMNSET    Column;
      QUEUEPROPID    aPropId[2]; // only two properties to retrieve
      HANDLE         hEnum;
      DWORD       cQueue;
      MQPROPVARIANT   aPropVar[MAX_VAR] = {0};
      ARRAYQ*         pArrayQ;
      DWORD       i;
      DWORD           dwColumnCount = 0;
      DWORD dwFormatNameLength = MAX_Q_FORMATNAME_LEN;

      CLocateDialog LocateDialog;

      //
      // Display the Receive Message dialog box.
      //
      if (LocateDialog.DoModal() == IDCANCEL)
      {
        return;
      }

      //
      // Retrieve the label from the dialog box.
      //
      LocateDialog.GetLabel(szLabelBuffer);

      //
      // Clean the path name array before locating queues.
      //
      CleanPathNameArray();

      //
      // Prepare parameters for locating queues.
      //

      //
      // Prepare a property restriction.
      // Restriction: All queues with PROPID_Q_LABEL equal to "MQ API test."
      //
      PropertyRestriction.rel = PREQ;
      PropertyRestriction.prop = PROPID_Q_LABEL;
      PropertyRestriction.prval.vt = VT_LPWSTR;
    #ifdef UNICODE
      PropertyRestriction.prval.pwszVal = szLabelBuffer;
    #else
      DWORD size = _tcslen(szLabelBuffer) +1;
      PropertyRestriction.prval.pwszVal = new WCHAR[size];
      AnsiStringToUnicode(PropertyRestriction.prval.pwszVal, szLabelBuffer,size);
    #endif

      //
      // Prepare a restriction with one property restriction.
      //
      Restriction.cRes = 1;
      Restriction.paPropRes = &PropertyRestriction;

      //
      // Specify the properties that should be returned by the query.
      // Only the path name is important.
      //
      aPropId[dwColumnCount] = PROPID_Q_PATHNAME;
      dwColumnCount++;

      aPropId[dwColumnCount] = PROPID_Q_INSTANCE;
      dwColumnCount++;

      Column.cCol = dwColumnCount;
      Column.aCol = aPropId;

      //
      // Run the query to locate the queues.
      //
      hr = MQLocateBegin(
          NULL,           // Start search at the top.
          &Restriction,   // Restriction
          &Column,        // Properties to be retrieved
          NULL,           // No sort order
          &hEnum          // Enumeration handle
          );

      if(FAILED(hr))
      {
        //
        // An error occurred, so display a message.
        //
        _stprintf(szMsgBuffer,
          TEXT("MQLocateBegin failed. Error code: 0x%x."),hr);
        MessageBox(szMsgBuffer, TEXT("ERROR"), MB_OK);
        return;
      }

      //
      // Get the results.
      //
      cQueue = MAX_VAR;

      //
      // If cQueue == 0, no Variants were retrieved in the last call to MQLocateNext.
      //
      while (cQueue != 0)
      {
        hr = MQLocateNext(
            hEnum,      // Handle returned by MQLocateBegin
            &cQueue,    // Size of aPropVar
            aPropVar    // OUT: an array of MQPROPVARIANT for receiving the results
            );

        if(FAILED(hr))
        {
          //
          // An error occurred, so display a message.
          //
          _stprintf(szMsgBuffer,
            TEXT("MQLocateNext failed. Error code: 0x%x."),hr);
          MessageBox(szMsgBuffer, TEXT("ERROR"), MB_OK);
          return;
        }

        for (i=0; i<cQueue; i++)
        {
          //
          // Add the new path names to the path name array.
          //
          pArrayQ = new ARRAYQ;
          if (!pArrayQ)
            return;

    #ifdef UNICODE
          wcsncpy (pArrayQ->szPathName, aPropVar[i].pwszVal, MAX_Q_PATHNAME_LEN-1);
          pArrayQ->szPathName[MAX_Q_PATHNAME_LEN - 1] = '\0';

    #else
          size_t rc = wcstombs(pArrayQ->szPathName, aPropVar[i].pwszVal, MAX_Q_PATHNAME_LEN-1);
          if (rc == (size_t)(-1))
          {
            AfxMessageBox("An unsupported wide character was encountered. Ignoring queue.");
            MQFreeMemory(aPropVar[i].pwszVal);
            i = i + 1;
            delete pArrayQ;
            continue;
          }
    #endif

          //
          // Free the memory allocated by MSMQ.
          //
          MQFreeMemory(aPropVar[i].pwszVal);

          //
          // Move to the next property.
          //
          i = i + 1;

          //
          // Get the format name of the queue and add the queue to the path name array.
          //
    #ifdef UNICODE
          hr = MQInstanceToFormatName(aPropVar[i].puuid, pArrayQ->szFormatName, &dwFormatNameLength);
    #else
          WCHAR szwFormatNameBuffer[MAX_Q_FORMATNAME_LEN];
          hr = MQInstanceToFormatName(aPropVar[i].puuid, szwFormatNameBuffer, &dwFormatNameLength);
          if (SUCCEEDED(hr))
          {
            size_t rwc = wcstombs(pArrayQ->szFormatName, szwFormatNameBuffer, dwFormatNameLength);
            if (rwc == (size_t)(-1))
            {
              AfxMessageBox("An unsupported wide character was encountered. Exiting...");
              exit(1);
            }
          }
    #endif

          if(FAILED(hr))
          {
            //
            // An error occurred, so display a message.
            //
            _stprintf (szMsgBuffer,
              TEXT("MQInstanceToFormatName failed. Error code: 0x%x."),hr);
            MessageBox(szMsgBuffer, TEXT("ERROR"), MB_OK);
          }

          //
          // Add the new queue to the path name array.
          //
          Add2PathNameArray(pArrayQ);
        }
      }

      //
      // End the locate operation.
      //
      hr = MQLocateEnd(hEnum);   // handle returned by MQLocateBegin
      if(FAILED(hr))
      {
        //
        // An error occurred, so display a message.
        //
        _stprintf (szMsgBuffer,
          TEXT("MQLocateEnd failed. Error code: 0x%x."),hr);
        MessageBox(szMsgBuffer, TEXT("ERROR"), MB_OK);
        return;
      }

      //
      // Display the queues found during the query.
      //
      _stprintf (szMsgBuffer, TEXT("Locate Operation completed successfully"));
      PrintToScreen(szMsgBuffer);
      UpdatePathNameArrays();
      DisplayPathNameArray();
      DisplayOpenedQueuePathNameArray();
    }

void CMainFrame::OnApiOpenQueue ( ) [protected]

Definition at line 965 of file MainFrm.Cpp.

    {
      // TODO: Add your command handler code here.
      TCHAR szPathNameBuffer[MAX_Q_PATHNAME_LEN];
      TCHAR szFormatNameBuffer[MAX_Q_PATHNAME_LEN];
      TCHAR szAccessBuffer[ACCESSBUFFERSIZE];
      TCHAR szMsgBuffer[BUFFERSIZE];
      WCHAR szwFormatNameBuffer[MAX_Q_FORMATNAME_LEN]={0};
      DWORD dwFormatNameSize=MAX_Q_FORMATNAME_LEN;
      HRESULT hrFormatName;
      HRESULT hrPathName;

      DWORD dwFormatNameBufferLength = MAX_Q_PATHNAME_LEN;
      DWORD dwAccess;

      QUEUEHANDLE hQueue;

      COpenQueueDialog OpenQueueDialog(&m_PathNameArray);

      //
      // Display the Open Queue dialog box.
      //
      if (OpenQueueDialog.DoModal() == IDCANCEL)
      {
        return;
      }

      OpenQueueDialog.GetPathName(szPathNameBuffer);
      OpenQueueDialog.GetFormatName(szFormatNameBuffer);
      dwAccess = OpenQueueDialog.GetAccess();
      //
      // Set the access buffer string.
      //
      switch (dwAccess)
      {
      case (MQ_RECEIVE_ACCESS | MQ_SEND_ACCESS):

        _tcsncpy(szAccessBuffer, TEXT("MQ_RECEIVE_ACCESS, MQ_SEND_ACCESS."), 34);
        szAccessBuffer[34] = '\0';
        break;

      case MQ_RECEIVE_ACCESS:

        _tcsncpy(szAccessBuffer, TEXT("MQ_RECEIVE_ACCESS."), 18);
        szAccessBuffer[18] = '\0';
        break;

      case MQ_SEND_ACCESS:

        _tcsncpy(szAccessBuffer, TEXT("MQ_SEND_ACCESS."), 15);
        szAccessBuffer[15] = '\0';
        break;

      default:

        _tcsncpy(szAccessBuffer, TEXT("NONE."), 5);
        szAccessBuffer[5] = '\0';
        break;
      }

      //Try Open The Q. using format name given.

#ifdef UNICODE
      hrFormatName = MQOpenQueue(szFormatNameBuffer,dwAccess,0,&hQueue);
#else
      size_t rc = mbstowcs(szwFormatNameBuffer, szFormatNameBuffer, _tcslen(szFormatNameBuffer)+1);
      if (rc == (size_t)(-1))
      {
        AfxMessageBox("An unsupported wide character was encountered. Exiting...");
        exit(1);
      }

      hrFormatName = MQOpenQueue(
          szwFormatNameBuffer,    // Format name of the queue to be opened.
          dwAccess,               // Access rights to the queue.
          0,                      // No exclusive receive.
          &hQueue                 // OUT: handle to the opened queue.
          );

#endif
      //
      //If failed to open Q. using format name,open The Q. using path name given.
      //
      if (FAILED(hrFormatName))
      {

#ifdef UNICODE
        //Traslate PathName to FormatName
        MQPathNameToFormatName(szPathNameBuffer,szwFormatNameBuffer,&dwFormatNameSize);
        //Open The Q.
        hrPathName = MQOpenQueue(szwFormatNameBuffer,dwAccess,0,&hQueue);
#else
        WCHAR szwPathNameBuffer[MAX_Q_FORMATNAME_LEN]={0};

        size_t rc = mbstowcs(szwPathNameBuffer, szPathNameBuffer, _tcslen(szPathNameBuffer)+1);
        if (rc == (size_t)(-1))
        {
          AfxMessageBox("An unsupported wide character was encountered. Exiting...");
          exit(1);
        }

        MQPathNameToFormatName(szwPathNameBuffer,szwFormatNameBuffer,&dwFormatNameSize);

        hrPathName = MQOpenQueue(
            szwFormatNameBuffer,    // Format name of the queue to be opened.
            dwAccess,               // Access rights to the queue.
            0,                      // No exclusive receive.
            &hQueue                 // OUT: handle to the opened queue.
            );

#endif

      }

      //Results
      if (FAILED(hrPathName)&&FAILED(hrFormatName))
      {

      //
      // An error occurred, so display a message.
      //
        if (szFormatNameBuffer[0]!=0)
        {
          _stprintf(szMsgBuffer, TEXT("MQOpenQueue failed. Error code: 0x%x."),hrFormatName);
        }
        else
        {
          _stprintf(szMsgBuffer, TEXT("MQOpenQueue failed. Error code: 0x%x."),hrPathName);
        }
        MessageBox(szMsgBuffer, TEXT("ERROR"), MB_OK);

      }
      else
      {
        //
        // Success was achieved, so write in the edit control.
        //
        _stprintf(szMsgBuffer,
          TEXT("The queue %s was opened successfully.\r\n\tQueueHandle: 0x%x\r\n\tQueue Access : %s"),
          szPathNameBuffer,
          (UINT)hQueue,
          szAccessBuffer);
        PrintToScreen(szMsgBuffer);

        //
        // Move the queue to the array of opened queue path names.
        //

        MoveToOpenedQueuePathNameArray(szPathNameBuffer,szFormatNameBuffer,hQueue, dwAccess);
      }

    }

void CMainFrame::OnApiReceiveMessage ( ) [protected]

Definition at line 1480 of file MainFrm.Cpp.

    {
      TCHAR szPathNameBuffer[MAX_Q_PATHNAME_LEN];
      TCHAR szMsgBuffer[2*BUFFERSIZE];
      TCHAR szDomainName[BUFFERSIZE];
       TCHAR szAccountName[BUFFERSIZE];
      DWORD dwActNameSize = sizeof(szAccountName);
      DWORD dwDomNameSize = sizeof(szDomainName);
      TCHAR szTextSid[BUFFERSIZE];
      DWORD dwTextSidSize = sizeof(szTextSid);
      BYTE  blobBuffer[BUFFERSIZE];

      MQMSGPROPS MsgProps;
      MQPROPVARIANT aVariant[MAXINDEX];
      MSGPROPID aPropId[MAXINDEX];
      DWORD PropIdCount = 0;

      HRESULT hr;

      WCHAR szMessageLabelBuffer[BUFFERSIZE];
      DWORD dwTimeout;

      QUEUEHANDLE hQueue;

      CReceiveWaitDialog    WaitDialog;
      CReceiveMessageDialog ReceiveMessageDialog(&m_OpenedQueuePathNameArray);

      //
      // Display the Receive Message dialog box.
      //
      if (ReceiveMessageDialog.DoModal() == IDCANCEL)
      {
        return;
      }

      ReceiveMessageDialog.DestroyWindow();
      ReceiveMessageDialog.GetPathName(szPathNameBuffer);

      //
      // Get the queue handle.
      //
      if (GetQueueHandle(szPathNameBuffer, &hQueue) == FALSE)
      {
        //
        // An error occurred, so display a message.
        //
        _stprintf(szMsgBuffer, TEXT("GetQueueHandle failed. The queue was not found in array of opened queues."));
        MessageBox(szMsgBuffer, TEXT("ERROR"), MB_OK);
        return;
      }

      //
      // Retrieve the properties form the dialog box.
      //
      dwTimeout = ReceiveMessageDialog.GetTimeout();

      //
      // Prepare the property array PROPVARIANT of
      // message properties that we want to receive.
      //

      //
      // Set the PROPID_M_BODY property.
      //
      aPropId[PropIdCount] = PROPID_M_BODY;                                // PropId
      aVariant[PropIdCount].vt = VT_VECTOR|VT_UI1;                         // Type
      aVariant[PropIdCount].caub.cElems = ReceiveMessageDialog.GetBodySize();
      aVariant[PropIdCount].caub.pElems = (unsigned char *) new
                     char [ aVariant[PropIdCount].caub.cElems ];

      int iBodyIndex = PropIdCount;
      PropIdCount++;

      //
      // Set the PROPID_M_LABEL property.
      //
      aPropId[PropIdCount] = PROPID_M_LABEL;                   // PropId
      aVariant[PropIdCount].vt = VT_LPWSTR;                    // Type
      aVariant[PropIdCount].pwszVal = szMessageLabelBuffer;

      PropIdCount++;

      //
      // Set the PROPID_M_PRIORITY property.
      //
      aPropId[PropIdCount] = PROPID_M_PRIORITY;               // PropId
      aVariant[PropIdCount].vt = VT_UI1;                      // Type

      PropIdCount++;

      //
      // Set the PROPID_M_CLASS property.
      //
      aPropId[PropIdCount] = PROPID_M_CLASS;                  // PropId
      aVariant[PropIdCount].vt = VT_UI2;                      // Type

      PropIdCount++;

      //
      // Set the PROPID_M_AUTHENTICATED property.
      //
      aPropId[PropIdCount] = PROPID_M_AUTHENTICATED;          // PropId
      aVariant[PropIdCount].vt = VT_UI1;                      // Type

      PropIdCount++;

      //
      // Set the PROPID_M_SENDERID property.
      //
      aPropId[PropIdCount] = PROPID_M_SENDERID;               // PropId
      aVariant[PropIdCount].vt = VT_UI1|VT_VECTOR;            // Type
      aVariant[PropIdCount].blob.pBlobData = blobBuffer;
      aVariant[PropIdCount].blob.cbSize = sizeof(blobBuffer);

      PropIdCount++;

      //
      // Set the PROPID_M_PRIV_LEVEL property.
      //
      aPropId[PropIdCount] = PROPID_M_PRIV_LEVEL;             // PropId
      aVariant[PropIdCount].vt = VT_UI4;                      // Type

      PropIdCount++;

      //
      // Set the PROPID_M_LABEL_LEN property.
      //
      aPropId[PropIdCount] = PROPID_M_LABEL_LEN;              // PropId
      aVariant[PropIdCount].vt = VT_UI4;                      // Type
      aVariant[PropIdCount].ulVal = BUFFERSIZE;               // Value

      PropIdCount++;

      //
      // Initialize the MQMSGPROPS structure.
      //
      MsgProps.cProp = PropIdCount;       // Number of properties
      MsgProps.aPropID = aPropId;         // Identifiers of properties
      MsgProps.aPropVar = aVariant;       // Value of properties
      MsgProps.aStatus  = NULL;           // No error report

      //
      // Display a message window until the message is received from the queue.
      //
      WaitDialog.Create(IDD_WAIT_DIALOG,pMainView);
      WaitDialog.ShowWindow(SW_SHOWNORMAL);
      WaitDialog.UpdateWindow();
      WaitDialog.CenterWindow();
      pMainView->RedrawWindow();

      //
      // Receive the message.
      //
      hr = MQReceiveMessage(
             hQueue,               // Handle to the queue
             dwTimeout,            // Max time (msec) to wait for the message
             MQ_ACTION_RECEIVE,    // Action
             &MsgProps,            // Properties to retrieve
             NULL,                 // No OVERLAPPED structure
             NULL,                 // No callback function
             NULL,                 // No cursor
             NULL                  // No transaction
             );

      WaitDialog.ShowWindow(SW_HIDE);

      if(hr == MQ_ERROR_IO_TIMEOUT)
      {
        _stprintf(szMsgBuffer, TEXT("MQReceiveMessage failed, The time-out period expired."));
        MessageBox(szMsgBuffer, TEXT("ERROR"), MB_OK);
      }
      else if(hr != MQ_OK)
      {
        //
        // An error occurred, so display a message.
        //
        _stprintf(szMsgBuffer, TEXT("MQReceiveMessage failed. Error code: 0x%x."),hr);
        MessageBox(szMsgBuffer, TEXT("ERROR"), MB_OK);
      }
      else
      {
        //
        // Success was achieved, so write in the edit control.
        //
        ClassToString(aVariant[3].uiVal,szMsgBuffer);
        PrintToScreen(szMsgBuffer);

        //
        // Print some of the message properties.
        //
    #ifdef UNICODE
        _stprintf(szMsgBuffer, TEXT("\tLabel: %s"), (WCHAR *)(aVariant[1].pwszVal));
    #else
        {
          PCHAR lpLable = UnicodeStringToAnsiString((WCHAR *)(aVariant[1].pwszVal));
          _stprintf(szMsgBuffer, TEXT("\tLabel: %s"), lpLable);
          delete [] lpLable;
        }
    #endif
        PrintToScreen(szMsgBuffer);

        //
        // Print the body only if the message is not an acknowledgment or report message.
        // (This is done because there is no message body in acknowledgment messages.)
        //
        if (aVariant[3].bVal == MQMSG_CLASS_NORMAL)
        {
    #ifdef UNICODE
          _stprintf(szMsgBuffer, TEXT("\tBody : %s"), (WCHAR *)(aVariant[0].caub.pElems));
    #else
          {
            PCHAR pBody = UnicodeStringToAnsiString((WCHAR *)(aVariant[0].caub.pElems));
            _stprintf(szMsgBuffer, TEXT("\tBody : %s"), pBody);
            delete [] pBody;
          }
    #endif
          PrintToScreen(szMsgBuffer);
        }

        _stprintf(szMsgBuffer, TEXT("\tPriority : %d"), aVariant[2].bVal);
        PrintToScreen(szMsgBuffer);

        //
        // Print Sender ID
        //
        //
        // See if we're running on NT or Win95.
        //
        OSVERSIONINFO OsVerInfo;

        OsVerInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
        GetVersionEx(&OsVerInfo);

        if (OsVerInfo.dwPlatformId == VER_PLATFORM_WIN32_NT)
        {
          //
          //  On NT
          //
          SID_NAME_USE peUse;
          if (LookupAccountSid(NULL,
                     blobBuffer,
                     szAccountName,
                     &dwActNameSize,
                     szDomainName,
                     &dwDomNameSize,
                     &peUse) )
          {
            _stprintf(szMsgBuffer, TEXT("\tUser: %s\\%s"), szDomainName, szAccountName);
            PrintToScreen(szMsgBuffer);
          }
        }
        else
        {
          //
          // LookupAccountSid is not implemented on Win95,
          // Instead print the textual SID.
          //
          if ( GetTextualSid((PSID)blobBuffer, szTextSid, &dwTextSidSize))
          {
            _stprintf(szMsgBuffer, TEXT("\tUser SID : %s"), szTextSid);
            PrintToScreen(szMsgBuffer);
          }
        }
        //
        // Print "authenticated" or "not authenticated."
        //
        if (aVariant[4].bVal)
          PrintToScreen(TEXT("\tMessage is authenticated."));
        else
          PrintToScreen(TEXT("\tMessage is not authenticated."));

        //
        // Print "encrypted" or "not encrypted."
        //
        if (aVariant[6].ulVal)
          PrintToScreen(TEXT("\tMessage is encrypted."));
        else
          PrintToScreen(TEXT("\tMessage is not Encrypted."));
       }

       delete aVariant[ iBodyIndex ].caub.pElems;
    }

void CMainFrame::OnApiSendMessage ( ) [protected]

Definition at line 1205 of file MainFrm.Cpp.

    {
      // TODO: Add your command handler code here.

      TCHAR szPathNameBuffer[MAX_Q_PATHNAME_LEN]={0};
      TCHAR szAdminPathNameBuffer[MAX_Q_PATHNAME_LEN]={0};
      TCHAR szAdminFormatNameBuffer[MAX_Q_FORMATNAME_LEN]={0};
      TCHAR szMsgBuffer[BUFFERSIZE]={0};

      MQMSGPROPS MsgProps;
      MQPROPVARIANT aVariant[MAXINDEX];
      MSGPROPID aPropId[MAXINDEX];
      DWORD PropIdCount = 0;

      HRESULT hr;

      unsigned char bPriority;
      unsigned char bDelivery;
      unsigned char bJournal;
      unsigned char bDeadLetter;
      unsigned char bAuthenticated;
      unsigned char bEncrypted;
      unsigned char bAcknowledge;

      WCHAR szMessageBodyBuffer [BUFFERSIZE];
      WCHAR szMessageLabelBuffer[BUFFERSIZE];
      DWORD dwTimeToReachQueue;
      DWORD dwTimeToBeReceived;

      QUEUEHANDLE hQueue;

      CSendMessageDialog SendMessageDialog(&m_OpenedQueuePathNameArray);

      //
      // Display the Send Message dialog box.
      //
      if (SendMessageDialog.DoModal() == IDCANCEL)
      {
        return;
      }

      //
      // Retrieve the properties from the dialog box.
      //
      SendMessageDialog.GetPathName(szPathNameBuffer);
      SendMessageDialog.GetAdminPathName(szAdminPathNameBuffer);
      bPriority = SendMessageDialog.GetPriority();
      bDelivery = SendMessageDialog.GetDelivery();
      bJournal = SendMessageDialog.GetJournal();
      bDeadLetter = SendMessageDialog.GetDeadLetter();
      bAuthenticated = SendMessageDialog.GetAuthenticated();
      bEncrypted = SendMessageDialog.GetEncrypted();
      bAcknowledge = SendMessageDialog.GetAcknowledge();
      SendMessageDialog.GetMessageBody(szLastMessageBody);
      SendMessageDialog.GetMessageLabel(szLastMessageLabel);
      dwTimeToReachQueue = SendMessageDialog.GetTimeToReachQueue();
      dwTimeToBeReceived = SendMessageDialog.GetTimeToBeReceived();

      //
      // Update the properties of the last message.
      //
      _mqscpy(szMessageBodyBuffer, szLastMessageBody);
      _mqscpy(szMessageLabelBuffer, szLastMessageLabel);

      //
      // Get the target queue handle.
      //
      if (GetQueueHandle(szPathNameBuffer, &hQueue) == FALSE)
      {
        //
        // An error occurred, so display a message.
        //
        _stprintf(szMsgBuffer, TEXT("GetQueueHandle failed. Queue not opened yet."));
        MessageBox(szMsgBuffer, TEXT("ERROR"), MB_OK);
        return;
      }

      //
      // Get the administration queue format name.
      //
      if (szAdminPathNameBuffer[0] != 0)
      {
        if (TranslatePathNameToFormatName(szAdminPathNameBuffer, szAdminFormatNameBuffer) == FALSE)
        {
          //
          // An error occurred, so display a message.
          //
          _stprintf(szMsgBuffer, TEXT("TranslatePathNameToFormatName failed, Queue has not been opened yet."));
          MessageBox(szMsgBuffer, TEXT("ERROR"), MB_OK);
          return;
        }
      }

      //
      // Prepare the property array PROPVARIANT.
      //

      //
      // Set the PROPID_M_PRIORITY property.
      //
      aPropId[PropIdCount] = PROPID_M_PRIORITY;    // PropId
      aVariant[PropIdCount].vt = VT_UI1;           // Type
      aVariant[PropIdCount].bVal = bPriority;      // Value

      PropIdCount++;

      //
      // Set the PROPID_M_DELIVERY property.
      //
      aPropId[PropIdCount] = PROPID_M_DELIVERY;    // PropId
      aVariant[PropIdCount].vt = VT_UI1;           // Type
      aVariant[PropIdCount].bVal = bDelivery;      // Value

      PropIdCount++;

      //
      // Set the PROPID_M_ACKNOWLEDGE property.
      //
      aPropId[PropIdCount] = PROPID_M_ACKNOWLEDGE; // PropId
      aVariant[PropIdCount].vt = VT_UI1;           // Type
      aVariant[PropIdCount].bVal = bAcknowledge;   // Value

      PropIdCount++;

      //
      // Set the PROPID_M_BODY property.
      //
      aPropId[PropIdCount] = PROPID_M_BODY;                  // PropId
      aVariant[PropIdCount].vt = VT_VECTOR|VT_UI1;           // Type
      aVariant[PropIdCount].caub.cElems =
        (wcslen(szMessageBodyBuffer) + 1) * sizeof(WCHAR); // Value
      aVariant[PropIdCount].caub.pElems = (unsigned char *)szMessageBodyBuffer;

      PropIdCount++;

      //
      // Set the PROPID_M_LABEL property.
      //
      aPropId[PropIdCount] = PROPID_M_LABEL;                  // PropId
      aVariant[PropIdCount].vt = VT_LPWSTR;                   // Type
      aVariant[PropIdCount].pwszVal = szMessageLabelBuffer;     // Value

      PropIdCount++;

      //
      // Set the PROPID_M_TIME_TO_REACH_QUEUE property.
      //
      aPropId[PropIdCount] = PROPID_M_TIME_TO_REACH_QUEUE;    // PropId
      aVariant[PropIdCount].vt = VT_UI4;                      // Type
      aVariant[PropIdCount].ulVal = dwTimeToReachQueue;       // Value

      PropIdCount++;

      //
      // Set the PROPID_M_TIME_TO_BE_RECEIVED property.
      //
      aPropId[PropIdCount] = PROPID_M_TIME_TO_BE_RECEIVED;    // PropId
      aVariant[PropIdCount].vt = VT_UI4;                      // Type
      aVariant[PropIdCount].ulVal = dwTimeToBeReceived;       // Value

      PropIdCount++;

      if (bJournal || bDeadLetter)
      {
        //
        // Set the PROPID_M_JOURNAL property.
        //
        aPropId[PropIdCount] = PROPID_M_JOURNAL;            // PropId
        aVariant[PropIdCount].vt = VT_UI1;                  // Type

        if (bJournal)
          aVariant[PropIdCount].bVal = MQMSG_JOURNAL;
        else
          aVariant[PropIdCount].bVal = 0;
        if (bDeadLetter)
          aVariant[PropIdCount].bVal |= MQMSG_DEADLETTER;

        PropIdCount++;
      }

      if (bAuthenticated)
      {
        //
        // Set the PROPID_M_AUTH_LEVEL property.
        //
        aPropId[PropIdCount] = PROPID_M_AUTH_LEVEL;            // PropId
        aVariant[PropIdCount].vt = VT_UI4;                     // Type
        aVariant[PropIdCount].ulVal = MQMSG_AUTH_LEVEL_ALWAYS; // Value

        PropIdCount++;
      }

      if (bEncrypted)
      {
        //
        // Set the PROPID_M_ENCRYPTION_ALG property.
        //
        aPropId[PropIdCount] = PROPID_M_PRIV_LEVEL;                 // PropId
        aVariant[PropIdCount].vt = VT_UI4;                          // Type
        aVariant[PropIdCount].ulVal = MQMSG_PRIV_LEVEL_BODY_BASE;   // Value

        PropIdCount++;
      }

      //
      // Set the PROPID_M_ADMIN_QUEUE property.
      //
      if (szAdminFormatNameBuffer[0] != 0)
      {
        aPropId[PropIdCount] = PROPID_M_ADMIN_QUEUE;               // PropId
        aVariant[PropIdCount].vt = VT_LPWSTR;                      // Type
      #ifdef UNICODE
        aVariant[PropIdCount].pwszVal = szAdminFormatNameBuffer;   // Value
      #else
        WCHAR szwAdminFormatNameBuffer[MAX_Q_FORMATNAME_LEN];
        size_t rc = mbstowcs(szwAdminFormatNameBuffer,
                szAdminFormatNameBuffer,
                _tcslen(szAdminFormatNameBuffer)+1);
        if (rc == (size_t)(-1))
        {
          AfxMessageBox("An unsupported wide character was encountered. Exiting...");
          exit(1);
        }
        aVariant[PropIdCount].pwszVal = szwAdminFormatNameBuffer;  // Value
      #endif

      PropIdCount++;
      }
      //
      // Initialize the MQMSGPROPS structure.
      //
      MsgProps.cProp = PropIdCount;       // Number of properties
      MsgProps.aPropID = aPropId;         // Identifiers of properties
      MsgProps.aPropVar = aVariant;       // Value of properties
      MsgProps.aStatus  = NULL;           // No error report

      //
      // Send the message.
      //
      hr = MQSendMessage(
          hQueue,                     // Handle to the queue.
          &MsgProps,                  // Message properties to be sent
          NULL                        // No transaction
          );

      if (FAILED(hr))
      {
        //
        // An error occurred, so display a message.
        //
        _stprintf(szMsgBuffer, TEXT("MQSendMessage failed. Error code: 0x%x."),hr);
        MessageBox(szMsgBuffer, TEXT("ERROR"), MB_OK);
      }
      else
      {
        //
        // Success was achieved, so write in the edit control.
        //
        _stprintf(szMsgBuffer, TEXT("The Message \"%s\" was sent successfully."), szLastMessageLabel);
        PrintToScreen(szMsgBuffer);
      }
    }

BOOL CMainFrame::OnCmdMsg | ( | UINT | nID,
 |  | int | nCode,
 |  | void * | pExtra,
 |  | AFX_CMDHANDLERINFO * | pHandlerInfo |
 | ) |  |  | [virtual]

Definition at line 124 of file mainfrm.cpp.

{
  // let the view have first crack at the command
  if (m_wndView.OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
    return TRUE;

  // otherwise, do default handling
  return CFrameWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
}

afx_msg int CMainFrame::OnCreate ( LPCREATESTRUCT lpCreateStruct ) [protected]
afx_msg int CMainFrame::OnCreate ( LPCREATESTRUCT lpCreateStruct ) [protected]
int CMainFrame::OnCreate ( LPCREATESTRUCT lpCreateStruct ) [protected]

Definition at line 54 of file mainfrm.cpp.

{
  if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
    return -1;
  // create a view to occupy the client area of the frame
  if (!m_wndView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW,
    CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL))
  {
    TRACE0("Failed to create view window\n");
    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
  m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
    CBRS_TOOLTIPS | CBRS_FLYBY);

  return 0;
}

void CMainFrame::OnMixerPlay ( ) [protected]

Definition at line 135 of file mainfrm.cpp.

{
  // TODO: Add your command handler code here

}

void CMainFrame::OnSetFocus ( CWnd * pOldWnd ) [protected]

Definition at line 118 of file mainfrm.cpp.

{
  // forward focus to the view window
  m_wndView.SetFocus();
}

void CMainFrame::OnUpdateFrameTitle ( BOOL bAddToTitle ) [protected]

Definition at line 2006 of file MainFrm.Cpp.

    {
      SetWindowText (TEXT("MQ API test"));
    }

void CMainFrame::OnUpdateMixerPlay ( CCmdUI * pCmdUI ) [protected]

Definition at line 141 of file mainfrm.cpp.

{
  // TODO: Add your command update UI handler code here

}

virtual BOOL CMainFrame::PreCreateWindow ( CREATESTRUCT & cs ) [virtual]
BOOL CMainFrame::PreCreateWindow ( CREATESTRUCT & cs ) [virtual]

Definition at line 88 of file mainfrm.cpp.

{
  if( !CFrameWnd::PreCreateWindow(cs) )
    return FALSE;
  // TODO: Modify the Window class or styles here by modifying
  //  the CREATESTRUCT cs

  cs.dwExStyle &= ~WS_EX_CLIENTEDGE;
  cs.lpszClass = AfxRegisterWndClass(0);
  return TRUE;
}

virtual BOOL CMainFrame::PreCreateWindow ( CREATESTRUCT & cs ) [virtual]
virtual BOOL CMainFrame::PreCreateWindow ( CREATESTRUCT & cs ) [virtual]
ARRAYQ * CMainFrame::RemoveFromOpenedQueuePathNameArray ( TCHAR * pszPathName )

Definition at line 345 of file MainFrm.Cpp.

    {
      int Index;
      int MaxIndex = m_OpenedQueuePathNameArray.GetSize();
      ARRAYQ* pQueue;

      //
      // Loop through the open queue path name array.
      //
      for (Index=0; Index<MaxIndex; Index++)
      {
        if (m_OpenedQueuePathNameArray[Index]->bFormatNameOnly==TRUE)
        {
          if (_tcscmp(szFormatPathName, m_OpenedQueuePathNameArray[Index]->szFormatName) == 0)
          {
            pQueue = m_OpenedQueuePathNameArray[Index];
            m_OpenedQueuePathNameArray.RemoveAt(Index);
            return pQueue;
          }
        }
        else
        {
          if (_tcscmp(szFormatPathName, m_OpenedQueuePathNameArray[Index]->szPathName) == 0)
          {
            //
            // A match was found.
            //
            pQueue = m_OpenedQueuePathNameArray[Index];
            m_OpenedQueuePathNameArray.RemoveAt(Index);
            return pQueue;
          }
        }
      }
      return NULL; // No match was found.
    }

ARRAYQ * CMainFrame::RemoveFromPathNameArray ( TCHAR * pszPathFormatName )

Definition at line 280 of file MainFrm.Cpp.

    {
      int Index;
      int MaxIndex = m_PathNameArray.GetSize();
      ARRAYQ* pQueue;

      //
      // Loop through the path name array.
      //
      for (Index=0; Index<MaxIndex; Index++)
      {
        if (m_PathNameArray[Index]->bFormatNameOnly==TRUE)
        {
          if (_tcscmp(szFormatPathName, m_PathNameArray[Index]->szFormatName) == 0)
          {
            //
            // A match was found.
            //
            pQueue = m_PathNameArray[Index];
            m_PathNameArray.RemoveAt(Index);
            return pQueue;
          }
        }
        else
        {
          if (_tcscmp(szFormatPathName, m_PathNameArray[Index]->szPathName) == 0)
          {
            //
            // A match was found.
            //
            pQueue = m_PathNameArray[Index];
            m_PathNameArray.RemoveAt(Index);
            return pQueue;
          }
        }
      }
      return NULL; // No match was found.
    }

BOOL CMainFrame::TranslatePathNameToFormatName | ( | TCHAR * | pszPathName,
 |  | TCHAR * | pszFormatName
 | ) |  |

Definition at line 546 of file MainFrm.Cpp.

    {
      //
      //check valid parameters
      //
      if (szPathName==NULL)
      {
        return FALSE;
      }
      DWORD dwFormatNameSize=MAX_Q_FORMATNAME_LEN;
      HRESULT hr;

#ifdef UNICODE
      hr = MQPathNameToFormatName(szPathName,szFormatName,&dwFormatNameSize);
#else
      WCHAR szwPathName[MAX_Q_FORMATNAME_LEN]={0};
      WCHAR szwFormatName[MAX_Q_FORMATNAME_LEN]={0};

      size_t rc = mbstowcs(szwPathName,szPathName,MAX_Q_FORMATNAME_LEN-1);
      if (rc == (size_t)(-1))
      {
        AfxMessageBox(_T("An unsupported wide character was encountered. Exiting..."));
        exit(1);
      }

      hr = MQPathNameToFormatName(szwPathName,szwFormatName,&dwFormatNameSize);
      wcstombs(szFormatName,szwFormatName,MAX_Q_FORMATNAME_LEN);

#endif
      if (FAILED(hr))
      {
        if (IsFormatName(szPathName)==TRUE)
        {
          _tcsncpy(szFormatName,szPathName,MAX_Q_PATHNAME_LEN);
          return TRUE;

        }
        return FALSE;
      }
      return TRUE;

    }

void CMainFrame::UpdatePathNameArrays ( )

Definition at line 458 of file MainFrm.Cpp.

    {
      int PathNameIndex;
      int OpenedPathNameIndex;
      int MaxOpenedPathNameIndex = m_OpenedQueuePathNameArray.GetSize();
      ARRAYQ* pQueue;

      //
      // Loop through the open queue path name array.
      //
      for (OpenedPathNameIndex=0; OpenedPathNameIndex<MaxOpenedPathNameIndex; OpenedPathNameIndex++)
      {
        for (PathNameIndex=0; PathNameIndex<m_PathNameArray.GetSize(); PathNameIndex++)
        {
          if (_tcscmp(m_OpenedQueuePathNameArray[OpenedPathNameIndex]->szPathName,
            m_PathNameArray[PathNameIndex]->szPathName) == 0)
          {
            //
            // A match was found, so remove it from path name array.
            //
            pQueue = m_PathNameArray[PathNameIndex];
            m_PathNameArray.RemoveAt(PathNameIndex);
            delete pQueue;
            //
            // Get out of the inner for loop.
            //
            break;
          }
        }
      }
    }

Member Data Documentation

CArray<ARRAYQ*, ARRAYQ*> CMainFrame::m_OpenedQueuePathNameArray [protected]

Definition at line 80 of file MainFrm.h.

CArray<ARRAYQ*, ARRAYQ*> CMainFrame::m_PathNameArray [protected]

Definition at line 75 of file MainFrm.h.

CDialogBar CMainFrame::m_wndDlgBar [protected]

Definition at line 52 of file mainfrm.h.

CStatusBar CMainFrame::m_wndStatusBar [protected]

Definition at line 49 of file mainfrm.h.

CToolBar CMainFrame::m_wndToolBar [protected]

Definition at line 50 of file mainfrm.h.

CChildView CMainFrame::m_wndView [protected]

Definition at line 53 of file mainfrm.h.

The documentation for this class was generated from the following files:
  • Multimedia/Audio/multichan/mainfrm.h
  • NetDS/MessageQueuing/MqApiTst/MainFrm.h
  • WinBase/WtsApi/WtsApi/MainFrm.h
  • NetDS/fax/PrintSdi/MainFrm.h
  • Multimedia/Audio/multichan/mainfrm.cpp
  • NetDS/fax/PrintSdi/MainFrm.Cpp
  • NetDS/MessageQueuing/MqApiTst/MainFrm.Cpp
  • WinBase/WtsApi/WtsApi/MainFrm.Cpp
Generated on Wed Nov 13 2024 16:56:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMainWindow Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes

CMainWindow Class Reference

#include "cmainwindow.h"

Inherits com::ms::com::IUnknown, and CMDIFrameLite.

List of all members.

Public Member Functions

CMainWindow ()
CMainWindow ()
virtual | ~CMainWindow ()
virtual INT_PTR | DisplayDialog (UINT uID, HWND hWndParent, DLGPROC lpDialogFunc, CBase *pCObject, UINT idSource=0)
int | DoModal ()
virtual CBase * | GetObject (SOURCE eSource=eCUnknown, BOOL fAlways=FALSE)
virtual CBase ** | GetObjectAddress (SOURCE eSource=eCUnknown)
virtual COptionsSheet * | GetOptions ()
virtual CBase * | HandleObjectType (CBase *pCSource, IUnknown *pIUnknown, REFIID riid, SOURCE eSource, ULONG cPropSets, DBPROPSET *rgPropSets, DWORD dwFlags)
virtual BOOL | LoadSettings ()
virtual void | OnAbort (CAsynchBase *pCAsynchBase)
virtual void | OnAbout ()
virtual void | OnAddRef (CBase *pCBase)
virtual void | OnAdvise (CConnectionPoint *pCConnectionPoint)
virtual void | OnArrangeIcons ()
virtual void | OnAutoQI (CBase *pCBase)
virtual void | OnCascade ()
virtual void | OnCloseAll ()
virtual BOOL | OnCommand (UINT iID, HWND hWndCtrl)
virtual void | OnConnect ()
virtual BOOL | OnCreate (LPCREATESTRUCT lpCreateStruct)
virtual void | OnCreateFileMoniker ()
virtual void | OnDataLinks ()
virtual BOOL | OnDestroy ()
virtual void | OnDisconnect ()
virtual BOOL | OnDropFiles (HDROP hDrop)
virtual void | OnFindConnectionPoint (CContainerBase *pCCPointBase, REFIID riid)
virtual void | OnGetConnectionInterface (CConnectionPoint *pCConnectionPoint)
virtual void | OnGetDataSource ()
virtual void | OnGetStatus (CAsynchBase *pCAsynchBase)
virtual void | OnInitialize (CAsynchBase *pCAsynchBase)
virtual BOOL | OnInitialUpdate ()
virtual BOOL | OnInitMenuPopup (HMENU hMenu, UINT uPos, BOOL fSysMenu)
virtual void | OnLoadRecentConfig (UINT iID)
virtual void | OnLoadRecentFile (UINT iID)
virtual void | OnLoadStringFromStorage (WCHAR *pwszFileName=NULL)
virtual BOOL | OnMenuSelect (UINT uID)
virtual void | OnNextWindow (BOOL fNextWindow)
virtual void | OnObjectsWindow ()
virtual void | OnOptions ()
virtual void | OnPromptDataSource (BOOL fAdvanced=FALSE)
virtual void | OnPromptFileName (BOOL fAdvanced=FALSE)
virtual void | OnQueryInterface (CBase *pCBase)
virtual void | OnRelease (CBase *pCBase)
virtual void | OnReleaseAll (CBase *pCBase, BOOL fChildren=FALSE)
virtual void | OnRootBinder ()
virtual void | OnRootEnumerator ()
virtual void | OnServiceComponents ()
virtual BOOL | OnSize (WPARAM nType, REFPOINTS pts)
virtual void | OnSupportErrorInfo (CBase *pCBase)
virtual void | OnTile (BOOL fHorizontal)
virtual void | OnTraceWindow ()
virtual void | OnUnadvise (CConnectionPoint *pCConnectionPoint)
virtual void | OnUninitialize (CAsynchBase *pCAsynchBase)
virtual BOOL | OnUpdateCommand (HMENU hMenu, UINT nID, DWORD *pdwFlags)
STDMETHOD() | QueryInterface (REFIID iid, LPVOID *ppvObj)
virtual BOOL | RemoveAllChildren ()
virtual BOOL | SaveSettings ()
STDMETHOD_ (ULONG, AddRef)()
STDMETHOD_ (ULONG, Release)()
virtual BOOL | UpdateControls ()

Static Public Member Functions

static INT_PTR WINAPI | BindResourceProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | EnumPropertiesProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | ErrorRecordsProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | GetDataSourceProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | GetSourcesRowsetProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | PromptDataSourceProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | PromptFileNameProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static ATOM | Register ()
static INT_PTR WINAPI | RegisterProviderProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | StreamViewerProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)

Public Attributes

CStatusBarLite m_CStatusBar
CToolBarLite m_CToolBar
HCURSOR | m_hCurSizeNS
HIMAGELIST | m_hImageList
HMODULE | m_hLibRichEdit10
HMODULE | m_hLibRichEdit20
HIMAGELIST | m_hStateList
ULONG m_idSource
CList< ITransaction
*, ITransaction * > 		m_listTransactions
CDataLinks * m_pCDataLinks
CFullConnect * m_pCFullConnect
CListener * m_pCListener
CMDIObjects * m_pCMDIObjects
CMDITrace * m_pCMDITrace
COptionsSheet * m_pCOptionsSheet
CBinder * m_pCRootBinder
CEnumerator * m_pCRootEnumerator
CServiceComp * m_pCServiceComp
CBase * m_pCSource

Private Member Functions

LRESULT | OnFromScannerOrCamera ()

Static Private Member Functions

static LRESULT CALLBACK | WindowProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)

Private Attributes

BOOL m_bDisplayWaitCursor
LONG | m_cRef
HWND | m_hMDIClient
LONG | m_nNumImages
CComPtr< WiaWrap::CEventCallback > | m_pEventCallback

Detailed Description

Definition at line 104 of file cmainwindow.h.

Constructor & Destructor Documentation

CMainWindow::CMainWindow ( )

Definition at line 40 of file mwclass.Cxx.

{
    _hlb = NULL;
    _hbmpStorage = _hbmpStream = NULL;
}

CMainWindow::~CMainWindow ( ) [virtual]

Definition at line 59 of file mwclass.Cxx.

{
    DeleteObject(_hbmpStorage);
    DeleteObject(_hbmpStream);
    PostQuitMessage(0);
}

CMainWindow::CMainWindow ( )

Member Function Documentation

INT_PTR WINAPI CMainWindow::BindResourceProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 3091 of file cmainwindow.cpp.

{
  static CComboBoxGuid    s_CComboInterface;
  static INDEX        iSavedType      = 3;  //DBGUID_ROW
  static DWORD        dwSavedBindFlags  = DBBINDURLFLAG_READ;
  static BOOL fAggregation  = FALSE;      //Default
  static BOOL fOutput     = TRUE;       //Default

  switch(message)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;

      //Save the "this" pointer
      CMainWindow* pThis    = (CMainWindow*)SetThis(hWnd, (void*)lParam);

      INDEX iSel = 0;
      HWND hWndURL    = ::GetDlgItem(hWnd, IDE_URL);
      HWND hWndObjectType = ::GetDlgItem(hWnd, IDC_OBJECTTYPE);
      HWND hWndBindFlags  = ::GetDlgItem(hWnd, IDL_BINDFLAGS);
      HWND hWndProperties = ::GetDlgItem(hWnd, IDB_SETPROPERTIES);

      //Set the Title (since this is shared with ICreateRow)
      if(pThis->m_idSource == IDM_ICREATEROW_CREATEROW)
      {
        SendMessage(hWnd, WM_SETTEXT, 0, (LPARAM)"ICreateRow::CreateRow");
        SendMessage(::GetDlgItem(hWnd, IDOK), WM_SETTEXT, 0, (LPARAM)"CreateRow");
      }

      //Enable Properties
      switch(pThis->m_pCSource->GetObjectType())
      {
        case eCRow:
        case eCSession:
                    ::EnableWindow(hWndProperties, FALSE);
          break;
      }

      //Fill In URL default
      wSendMessage(hWndURL, WM_SETTEXT, 0, pThis->m_pCRootBinder->m_pwszURL);

      //Fill In ObjectType drop down
      for(ULONG i=0; i<g_cObjectTypeMaps; i++)
      {
        iSel = (INDEX)wSendMessage(hWndObjectType, CB_ADDSTRING, 0, g_rgObjectTypeMaps[i].pwszName);
        SendMessage(hWndObjectType, CB_SETITEMDATA, iSel, (LPARAM)&g_rgObjectTypeMaps[i]);
      }
      SendMessage(hWndObjectType, CB_SETCURSEL, iSavedType, 0);

      //Aggregation
            ::CheckDlgButton(hWnd, IDB_AGGREGATION,    BST2STATE(fAggregation));

      //Output (ppIUnknown)
            ::CheckDlgButton(hWnd, IDB_OUTPUT,     BST2STATE(fOutput));

      //Interface List...
      s_CComboInterface.CreateIndirect(hWnd, IDC_INTERFACE);
      s_CComboInterface.Populate(g_cInterfaceMaps, g_rgInterfaceMaps);
      if(s_CComboInterface.RestoreSelection() == CB_ERR)
        s_CComboInterface.SetGuid(IID_IRow);

      //BindFlags List...
      SendMessage(hWndBindFlags, LB_RESETCONTENT, 0, 0);
      for(i=0; i<g_cBindURLMaps; i++)
      {
        //BindFlags Name
        iSel = (INDEX)wSendMessage(hWndBindFlags, LB_ADDSTRING, 0, g_rgBindURLMaps[i].pwszName);
        SendMessage(hWndBindFlags, LB_SETITEMDATA, iSel, (LPARAM)g_rgBindURLMaps[i].lItem);

        //Select Saved BindFlags
        if((dwSavedBindFlags & g_rgBindURLMaps[i].lItem) == (DWORD)g_rgBindURLMaps[i].lItem)
           SendMessage(hWndBindFlags, LB_SETSEL, TRUE, i);
      }

      //Allow the horizontal scroll bar
      SendMessage(hWndBindFlags, LB_SETHORIZONTALEXTENT, 500, 0);
      CenterDialog(hWnd);
      return TRUE;
    }

    case WM_COMMAND:
    {
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDB_SETPROPERTIES:
        {
          //Get the "this" pointer
          CMainWindow* pThis        = (CMainWindow*)GetThis(hWnd);
          IDBProperties* pIDBProperties = SOURCE_GETINTERFACE(pThis->m_pCSource, IDBProperties);

          //SetProperties
          CPropertiesDlg sCPropertiesDlg(pThis);
          sCPropertiesDlg.SetProperties(hWnd, NULL/*No Default PropSet*/, IID_IDBProperties, pIDBProperties, pIDBProperties);
          return 0;
        }

        case IDB_AGGREGATION:
        {
          //Aggregation Combo Selection has changed...
          //If we are now using Aggregation, automatically change the requested
          //riid to IID_IUnknown, since its an error otherwise...
          if(::IsDlgButtonChecked(hWnd, IDB_AGGREGATION))
            s_CComboInterface.SetGuid(IID_IUnknown);
          return 0;
        }

        case IDOK:
        {
          CWaitCursor waitCursor;

          //Get the "this" pointer
          CMainWindow* pThis    = (CMainWindow*)GetThis(hWnd);
          IUnknown* pIUnknown   = NULL;

          HWND hWndURL    = ::GetDlgItem(hWnd, IDE_URL);
          HWND hWndObjectType = ::GetDlgItem(hWnd, IDC_OBJECTTYPE);
          HWND hWndBindFlags  = ::GetDlgItem(hWnd, IDL_BINDFLAGS);
          BOOL dwWindowFlags  = CREATE_NEWWINDOW;
          HRESULT hr = S_OK;

          DBBINDURLSTATUS dwBindStatus = 0;
          WCHAR* pwszNewURL = NULL;

          //URL
          SAFE_FREE(pThis->m_pCRootBinder->m_pwszURL);
          pThis->m_pCRootBinder->m_pwszURL = wGetWindowText(hWndURL);

          //ObjectType
          iSavedType = (INDEX)SendMessage(hWndObjectType, CB_GETCURSEL, 0, 0);
          WIDEGUIDMAP* pObjectMap = (WIDEGUIDMAP*)SendMessage(hWndObjectType, CB_GETITEMDATA, iSavedType, 0);
          GUID guidObjectType = *pObjectMap->pGuid;

          //Obtain the Aggregation argument
          CAggregate* pCAggregate = NULL;
          fAggregation = ::IsDlgButtonChecked(hWnd, IDB_AGGREGATION);
          if(fAggregation)
            pCAggregate = new CAggregate();

          //Obtain the Output (ppIUnknown) argument
          fOutput = ::IsDlgButtonChecked(hWnd, IDB_OUTPUT);

          //Interface
          REFIID riid = s_CComboInterface.GetGuid();

          //BindFlags
          //Obtain all Selected BindFlags...
          INDEX iSelCount = (INDEX)SendMessage(hWndBindFlags, LB_GETSELCOUNT, 0, 0);
          ASSERT(iSelCount < 20);
          LONG rgSelItems[20];
          SendMessage(hWndBindFlags, LB_GETSELITEMS, (WPARAM)20, (LPARAM)rgSelItems);

          dwSavedBindFlags = 0;
          for(LONG i=0; i<iSelCount; i++)
            dwSavedBindFlags |= SendMessage(hWndBindFlags, LB_GETITEMDATA, rgSelItems[i], 0);

          switch(pThis->m_idSource)
          {
            case IDM_ICREATEROW_CREATEROW:
            {
              ICreateRow* pICreateRow = SOURCE_GETINTERFACE(pThis->m_pCSource, ICreateRow);
              ASSERT(pICreateRow);

              //ICreateRow::CreateRow
              XTEST(hr = pICreateRow->CreateRow(pCAggregate, pThis->m_pCRootBinder->m_pwszURL, dwSavedBindFlags, guidObjectType,  riid, NULL, NULL, &dwBindStatus, &pwszNewURL, fOutput ? &pIUnknown : NULL));
              TESTC(TRACE_METHOD(hr, L"ICreateRow::CreateRow(0x%p, \"%s\", 0x%08x, %s, %s, NULL, NULL, &0x%p, &\"%s\", &0x%p)", pCAggregate, pThis->m_pCRootBinder->m_pwszURL, dwSavedBindFlags, GetObjectTypeName(guidObjectType), GetInterfaceName(riid), &dwBindStatus, pwszNewURL, pIUnknown));
              break;
            }

            case IDM_IBINDRESOURCE_BIND:
            {
              IBindResource* pIBindResource = SOURCE_GETINTERFACE(pThis->m_pCSource, IBindResource);
              ASSERT(pIBindResource);

              //IBindResource::Bind
              XTEST(hr = pIBindResource->Bind(pCAggregate, pThis->m_pCRootBinder->m_pwszURL, dwSavedBindFlags, guidObjectType,  riid, NULL, NULL, &dwBindStatus, fOutput ? &pIUnknown : NULL));
              TESTC(TRACE_METHOD(hr, L"IBindResource::Bind(0x%p, \"%s\", 0x%08x, %s, %s, NULL, NULL, &0x%p, &0x%p)", pCAggregate, pThis->m_pCRootBinder->m_pwszURL, dwSavedBindFlags, GetObjectTypeName(guidObjectType), GetInterfaceName(riid), &dwBindStatus, pIUnknown));
            }
              break;

            default:
              ASSERT(!"Unhandled Type!");
              break;
          };

          //Do we create in a new window?  If this is called from a session object
          //and we are interested in a DSO, or Session, then just use the same
          //Window, since Bind returns the same existing object addref'd
          if(pThis->m_pCSource->GetObjectType() == eCSession && (guidObjectType == DBGUID_DSO || guidObjectType == DBGUID_SESSION))
            dwWindowFlags = CREATE_FINDWINDOW;

          //Handle Aggregation
          if(pCAggregate)
            pCAggregate->HandleAggregation(riid, &pIUnknown);

          //Handle the returned object type...
          //All bind objects are by default returned in there own window...
          //NOTE: We already know the object type, or eCUnknown is passed
          if(!pThis->HandleObjectType(pThis->m_pCSource, pIUnknown, riid, GuidToSourceType(guidObjectType), 0, NULL, dwWindowFlags))
            TESTC(hr = E_FAIL);

        CLEANUP:
          SAFE_RELEASE(pCAggregate);
          SAFE_RELEASE(pIUnknown);

          SAFE_FREE(pwszNewURL);
          if(SUCCEEDED(hr))
            EndDialog(hWnd, TRUE);
          return 0;
        }

        case IDCANCEL:
        {
          EndDialog(hWnd, FALSE);
          return 0;
        }
      }
      break;
    }//WM_COMMAND
  }

  return FALSE;
}

INT_PTR CMainWindow::DisplayDialog | ( | UINT | uID,
 |  | HWND | hWndParent,
 |  | DLGPROC | lpDialogFunc,
 |  | CBase * | pCObject,
 |  | UINT | idSource = 0 |
 | ) |  |  | [virtual]

Definition at line 241 of file cmainwindow.cpp.

{
  m_idSource = idSource;
  m_pCSource = pCObject;
  return ::DisplayDialog(uID, hWndParent, lpDialogFunc, (LPARAM)this);
}

int CMainWindow::DoModal ( )

Definition at line 115 of file MainWnd.cpp.

{
    MSG msg;

    while (GetMessage(&msg, NULL, 0, 0))
    {
        if (!TranslateMDISysAccel(m_hMDIClient, &msg))
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
    }

    return (int) msg.wParam;
}

INT_PTR WINAPI CMainWindow::EnumPropertiesProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 3776 of file cmainwindow.cpp.

{
  static CDSLContextBox   s_CDSLContextBox;
  static CRichEditLite    s_CEditSource;

  switch(message)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;

      //save off the this pointer
      CMainWindow* pThis      = (CMainWindow*)SetThis(hWnd, (void*)lParam);
      HRESULT hr = S_OK;

      IDBProperties* pIDBProperties = NULL;
      ULONG iPropSet,cPropInfoSets = 0;
      DBPROPINFOSET* rgPropInfoSets = NULL;
      WCHAR* pStringBuffer = NULL;
      IUnknown* pIUnknown = NULL;

      INDEX iStart = 0;
      INDEX iEnd = 0;
      RECT rect, rectDlg;
      POINT pt = {0, 0};

      //Create the ListBox
      s_CDSLContextBox.CreateIndirect(hWnd, IDL_VALUES);
      s_CDSLContextBox.SubClassWindow(WndProc);

      //Obtain the currently entered connection string
      //NOTE: We don't subclass the initstring here, since we have already done it
      //in the caller function - GetDataSourceProc
      s_CEditSource.CreateIndirect(GetParent(hWnd), IDE_INITSTRING);
      WCHAR* pwszInitString = s_CEditSource.GetWindowText();
      BOOL fDisplayedInfo = FALSE;

      if(pwszInitString)
      {
        CHAR szBuffer[MAX_NAME_LEN] = {0};

        //Obtain the current cursor location, to determine what info the user really wants...
        s_CEditSource.GetSel(&iStart, &iEnd);
        if(iStart)
        {
          //End is limited to our buffer size...
          iEnd = min(iEnd, MAX_NAME_LEN-1);

          //If the last character was an = sign, then we probably want a list of providers.
          CHARRANGE cr = { 0, (LONG)iEnd };
          s_CEditSource.GetTextRange(cr, szBuffer);
        }

        //Value Context
        if(szBuffer[iEnd ? iEnd-1 : 0] == '=')
        {
          //Provider Enumerator?
          if( (iEnd >= 12 /*"Data Source"*/ && (_stricmp(&szBuffer[iEnd-12], "Data Source=")==0 || _stricmp(&szBuffer[iEnd-12], "data Source=")==0)) ||
            (iEnd >= 4 /*"DSN"*/ && (_stricmp(&szBuffer[iEnd-4], "DSN=")==0 || _stricmp(&szBuffer[iEnd-4], "dsn=")==0)) )
          {
            //Root Enumerator
            CEnumerator* pCRootEnum = pThis->m_pCRootEnumerator;

            //We may need to connect to the RootEnumerator, if not done already
            pCRootEnum->CreateEnumInfo(CLSID_OLEDB_ENUMERATOR);

            //Fill out the ListBox
            for(ULONG i=0; i<pCRootEnum->m_cEnumInfo; i++)
            {
              ENUMINFO* pEnumInfo = &pCRootEnum->m_rgEnumInfo[i];
              if(pEnumInfo->eType ==  DBSOURCETYPE_ENUMERATOR)
              {
                WCHAR wszSubName[10] = {0};
                wcsncpy(wszSubName, pEnumInfo->wszName, 7);
                wszSubName[7] = L'\0';

                //See if anything in the string assoicates it with this enumerator...
                //If no provider is specified, the default provider is MSDASQL so use that enumerator
                if(wcsstr(pwszInitString, wszSubName) ||
                  (wcsstr(pwszInitString, L"Provider")==NULL && wcsstr(pwszInitString, L"provider")==NULL && StringCompare(pEnumInfo->wszName, L"MSDASQL Enumerator")) )
                {
                  CEnumerator cEnum(pThis);

                  //Create this enumerator.
                  TESTC(hr = pCRootEnum->ParseDisplayName(pEnumInfo->wszParseName, CLSCTX_INPROC_SERVER, IID_IUnknown, &pIUnknown, NULL));
                  TESTC(hr = cEnum.CreateObject(pCRootEnum, IID_IUnknown, pIUnknown));
                  TESTC(hr = cEnum.CreateEnumInfo());

                  //Now display the enuminfo
                  for(ULONG iEnum=0; iEnum<cEnum.m_cEnumInfo; iEnum++)
                  {
                    //Add the name to the list
                    s_CDSLContextBox.AddString(cEnum.m_rgEnumInfo[iEnum].wszName);
                  }
                  fDisplayedInfo = TRUE;
                  break;
                }
              }
            }
          }
          //Catalog?
          else if(iEnd >= 8 /*"Catalog"*/ && (_stricmp(&szBuffer[iEnd-8], "Catalog=")==0 || _stricmp(&szBuffer[iEnd-8], "catalog=")==0) )
          {
            CDataSource cDataSource(pThis);
            CSession cSession(pThis);

            //Obtain the current provider...
            //If the user has typed enough, (Provider=) then they will get that provider
            //otherwise DSL defaults to MSDASQL
            TESTC(hr = pThis->m_pCServiceComp->GetDataSource(NULL, pThis->GetOptions()->m_dwCLSCTX, pwszInitString, IID_IDBProperties, (IUnknown**)&pIDBProperties));
            TESTC(hr = cDataSource.CreateObject(pThis->m_pCServiceComp, IID_IDBProperties, pIDBProperties));
            TESTC(hr = cDataSource.Initialize());

            //Create Session
            XTESTC(hr = cDataSource.CreateSession(NULL, IID_IUnknown, &pIUnknown));
            TESTC(hr = cSession.CreateObject(&cDataSource, IID_IUnknown, pIUnknown));

            //Obtain SchemaInfo
            if(cSession.m_pIDBSchemaRowset)
            {
              SAFE_RELEASE(pIUnknown);
              WCHAR wszBuffer[MAX_NAME_LEN];
              HACCESSOR hAccessor = NULL;
              DBCOUNTITEM cRowsObtained = 0;
              HROW rghRows[MAX_BLOCK_SIZE];
              HROW* phRows = rghRows;
              CRowset cRowset(pThis);

              //DBSCHEMA_CATALOGS
              TESTC(hr = cSession.GetSchemaRowset(NULL, DBSCHEMA_CATALOGS, 0, NULL, IID_IUnknown, 0, NULL, &pIUnknown));
              TESTC(hr = cRowset.CreateObject(&cSession, IID_IUnknown, pIUnknown));

              //Bind only the CATALOG_NAME column...
              const static DBCOUNTITEM cBindings = 1;
              DBBINDING rgBindings[cBindings] =
              {
                  1,    //iOrinal
                  0,    //pData = phChapter + 0 offset = phChapter
                  0,
                  0,
                  NULL,
                  NULL,
                  NULL,
                  DBPART_VALUE,
                  DBMEMOWNER_CLIENTOWNED,
                  DBPARAMIO_NOTPARAM,
                  sizeof(wszBuffer),
                  0,
                  DBTYPE_WSTR,
                  0,
                  0,
              };

              //Create the Accessor...
              TESTC(hr = cRowset.CreateAccessor(DBACCESSOR_ROWDATA, cBindings, rgBindings, 0, &hAccessor));

              //Loop through all the rows...
              while(TRUE)
              {
                hr = cRowset.GetNextRows(0, MAX_BLOCK_SIZE, &cRowsObtained, &phRows);
                if(FAILED(hr) || cRowsObtained==0)
                  break;

                //Loop over rows obtained...
                for(ULONG i=0; i<cRowsObtained; i++)
                {
                  //Get the Data
                  wszBuffer[0] = wEOL;  //Since were not binding status...
                  TESTC(hr = cRowset.GetData(rghRows[i], hAccessor, wszBuffer));

                  //Add the name to the list
                  s_CDSLContextBox.AddString(wszBuffer);
                  fDisplayedInfo = TRUE;
                }

                //Release all the rows
                TESTC(hr = cRowset.ReleaseRows(cRowsObtained, rghRows));
              }

              //Release Accessor
              TESTC(cRowset.ReleaseAccessor(&hAccessor));
            }
          }
          //Root Enumerator?
          else if(iEnd >= 9 /*"Provider"*/ && (_stricmp(&szBuffer[iEnd-9], "Provider=")==0 || _stricmp(&szBuffer[iEnd-9], "provider=")==0) )
          {
            //Root Enumerator
            CEnumerator* pCRootEnum = pThis->m_pCRootEnumerator;

            //We may need to connect to the RootEnumerator, if not done already
            pCRootEnum->CreateEnumInfo(CLSID_OLEDB_ENUMERATOR);

            //Fill out the ListBox
            for(ULONG i=0; i<pCRootEnum->m_cEnumInfo; i++)
            {
              //Add the name to the list
              s_CDSLContextBox.AddString(pCRootEnum->m_rgEnumInfo[i].wszName);
            }
            fDisplayedInfo = TRUE;
          }
          else
          {
            //Default Values?
            s_CDSLContextBox.AddString(L";");
            s_CDSLContextBox.AddString(L"True");
            s_CDSLContextBox.AddString(L"False");
            fDisplayedInfo = TRUE;
          }
        }
        //Not a value context
        else
        {
          //Property Description Context?
          if(szBuffer[iEnd ? iEnd-1 : 0] == ' ' || szBuffer[iEnd ? iEnd-1 : 0] == ';')
          {
            //Obtain the current provider...
            //If the user has typed enough, (Provider=) then they will get that provider
            //otherwise DSL defaults to MSDASQL
            TESTC(hr = pThis->m_pCServiceComp->GetDataSource(NULL, pThis->GetOptions()->m_dwCLSCTX, pwszInitString, IID_IDBProperties, (IUnknown**)&pIDBProperties));

            //Obtain all property descriptions...
            TESTC(hr = pIDBProperties->GetPropertyInfo(0, NULL, &cPropInfoSets, &rgPropInfoSets, &pStringBuffer));

            //Loop through and display properties...
            for(iPropSet=0; iPropSet<cPropInfoSets; iPropSet++)
            {
              DBPROPINFOSET* pPropInfoSet = &rgPropInfoSets[iPropSet];
              for(ULONG iProp=0; iProp<pPropInfoSet->cPropertyInfos; iProp++)
              {
                //Add this property to the list...
                DBPROPINFO* pPropInfo = &pPropInfoSet->rgPropertyInfos[iProp];
                s_CDSLContextBox.AddString(pPropInfo->pwszDescription);
              }
            }
            fDisplayedInfo = TRUE;
          }
        }
      }

      if(!fDisplayedInfo)
      {
        //No InitString, so just populate listbox with special reserved words for DSL
        s_CDSLContextBox.AddString(L"Provider=");
        s_CDSLContextBox.AddString(L"=");
        s_CDSLContextBox.AddString(L";");
        s_CDSLContextBox.AddString(L"\"");
        s_CDSLContextBox.AddString(L"'");
      }

      //Obain the current cursor location, where to place the dialog...
      GetWindowRect(s_CEditSource.m_hWnd, &rect);
      GetWindowRect(hWnd, &rectDlg);

      //NOTE: RichEdit 1.0 EM_POSFROMCHAR requires an a &point for the first param and
      //charpos for the second, RichEdit 2.0 is completly different!  Since this RichEdit
      //box was created with the resource editor, we can be assured that its always
      //"RICHEDIT" which is 1.0, if this ever changes this will crash!
      SendMessage(s_CEditSource.m_hWnd, EM_POSFROMCHAR, (WPARAM)&pt, (LPARAM)iStart);

      //Place the dialog
      MoveWindow(hWnd, rect.left + pt.x, rect.bottom, rectDlg.right-rectDlg.left, rectDlg.bottom-rectDlg.top, TRUE);

    CLEANUP:
      FreeProperties(&cPropInfoSets, &rgPropInfoSets);
      SAFE_FREE(pStringBuffer);
      SAFE_RELEASE(pIDBProperties);
      SAFE_RELEASE(pIUnknown);
      SAFE_FREE(pwszInitString);

      if(FAILED(hr))
        EndDialog(hWnd, FALSE);
      return TRUE;
    }

    case WM_COMMAND:
    {
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        switch(GET_WM_COMMAND_CMD(wParam, lParam))
        {
          //Selection change in a list box occurred
          case LBN_DBLCLK:
          {
            //Double-Click, send OK to end dialog...
            SendMessage(hWnd, WM_COMMAND, GET_WM_COMMAND_MPS(IDOK, hWnd, 0));
            return 0;
          }
        };

        break;
      };

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDOK:
        {
          CWaitCursor waitCursor;
          WCHAR wszBuffer[MAX_QUERY_LEN] = {0};

          //Obtain all Options Selected Items...
          INDEX iSel = s_CDSLContextBox.GetCurSel();
          if(iSel != LB_ERR)
          {
            //Obtain this property description
            s_CDSLContextBox.GetText(iSel, wszBuffer);

            //Now replace the entire edit box with the new selected value
            s_CEditSource.ReplaceAll(wszBuffer);
          }

          EndDialog(hWnd, TRUE);
          return 0;
        }

        case IDCANCEL:
        {
          EndDialog(hWnd, FALSE);
          return 0;
        }
      }
      break;
    }//WM_COMMAND
  }

  return FALSE;
}

INT_PTR WINAPI CMainWindow::ErrorRecordsProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 2359 of file cmainwindow.cpp.

{
  static CComboBoxLite    s_CComboRecord;
  static CComboBoxLite    s_CComboLCID;
  static ULONG  ulRecord  = 0;                //Default
  static LCID   lcid    = GetSystemDefaultLCID();     //Default
  static BOOL   fOutput   = TRUE;               //Default

  switch(message)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;

      //Save the "this" pointer
      CMainWindow* pThis  = (CMainWindow*)SetThis(hWnd, (void*)lParam);
      CError* pCError   = SOURCE_GETOBJECT(pThis->m_pCSource, CError);
      ULONG cRecords = 0;
      WCHAR wszBuffer[POINTER_DISPLAYSIZE] = {0};
      HRESULT hr = S_OK;

      //Obtain the total number of error records...
      hr = pCError->GetRecordCount(&cRecords);
      if(FAILED(hr) || !cRecords)
        cRecords=0;

      //Record List...
      s_CComboRecord.CreateIndirect(hWnd, IDC_RECORD);
      for(ULONG i=0; i<cRecords; i++)
      {
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"%d", i);
        s_CComboRecord.AddString(wszBuffer, i);
      }
      StringFormat(wszBuffer, NUMELE(wszBuffer), L"%d", ulRecord);
      s_CComboRecord.SetSelText(wszBuffer, TRUE/*fAddItem*/);

      //LCID List...
      s_CComboLCID.CreateIndirect(hWnd, IDC_LCID);
      s_CComboLCID.Populate(g_cLCID, g_rgLCID);
      if(s_CComboLCID.SetSelValue(lcid) == CB_ERR)
      {
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"%d", lcid);
        s_CComboLCID.SetSelText(wszBuffer, TRUE/*fAddItem*/);
      }

      //Output (ppIUnknown)
            ::CheckDlgButton(hWnd, IDB_OUTPUT,     BST2STATE(fOutput));

      CenterDialog(hWnd);
      return TRUE;
    }

    case WM_COMMAND:
    {
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDOK:
        {
          CWaitCursor waitCursor;

          //Get the "this" pointer
          CMainWindow* pThis  = (CMainWindow*)GetThis(hWnd);
          CError* pCError   = SOURCE_GETOBJECT(pThis->m_pCSource, CError);
          IErrorInfo* pIErrorInfo = NULL;
          HRESULT hr = S_OK;

          //Obtain the Output (ppIUnknown) argument
          fOutput   = ::IsDlgButtonChecked(hWnd, IDB_OUTPUT);

          //Record
          if(!GetEditBoxValue(s_CComboRecord.m_hWnd, (LONG*)&ulRecord, 0/*Min*/))
            return FALSE;

          //LCID
          lcid = (LCID)s_CComboLCID.GetItemParam(s_CComboLCID.GetCurSel());
          if(lcid == CB_ERR)
          {
            if(!GetEditBoxValue(s_CComboLCID.m_hWnd, (LONG*)&lcid, 0/*Min*/))
              return FALSE;
          }

          //IErrorRecords::GetErrorInfo
          hr = pCError->GetErrorInfo(ulRecord, lcid, fOutput ? &pIErrorInfo : NULL);

          //Display the ErrorInfo object returned
          if(SUCCEEDED(hr))
            pThis->HandleObjectType(pCError, pIErrorInfo, IID_IErrorInfo, eCError, 0, NULL, 0/*dwFlags*/);
          TRACE_RELEASE(pIErrorInfo, L"IErrorInfo");

          if(SUCCEEDED(hr))
            EndDialog(hWnd, TRUE);
          return 0;
        }

        case IDCANCEL:
        {
          EndDialog(hWnd, FALSE);
          return 0;
        }
      }
      break;
    }//WM_COMMAND
  }

  return FALSE;
}

INT_PTR WINAPI CMainWindow::GetDataSourceProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 3617 of file cmainwindow.cpp.

{
  static CComboBoxGuid  s_CComboInterface;
  static CInitStringBox s_CInitStringBox;
  static BOOL fUseExistingDSO   = FALSE;
  static BOOL fAggregation    = FALSE;      //Default
  static BOOL fOutput       = TRUE;       //Default

  switch(msg)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;

      //Save the "this" pointer
      CMainWindow* pThis        = (CMainWindow*)SetThis(hWnd, (void*)lParam);
      CServiceComp*  pCServiceComp  = SOURCE_GETOBJECT(pThis->m_pCSource, CServiceComp);
      ASSERT(pCServiceComp);

      //Set the Saved InitString
      s_CInitStringBox.CreateIndirect(hWnd, IDE_INITSTRING);
      s_CInitStringBox.SetWindowText(pCServiceComp->m_pwszInitString);
      s_CInitStringBox.SubClassWindow(WndProc);

      //Aggregation
            ::CheckDlgButton(hWnd, IDB_AGGREGATION,    BST2STATE(fAggregation));

      //Output (ppIUnknown)
            ::CheckDlgButton(hWnd, IDB_OUTPUT,     BST2STATE(fOutput));

      //Interface List...
      s_CComboInterface.CreateIndirect(hWnd, IDC_INTERFACE);
      s_CComboInterface.Populate(g_cInterfaceMaps, g_rgInterfaceMaps);
      if(s_CComboInterface.RestoreSelection() == CB_ERR)
        s_CComboInterface.SetGuid(IID_IDBInitialize);

      //Existing DSO
            ::CheckDlgButton(hWnd, IDB_EXISTING_DSO, BST2STATE(fUseExistingDSO));
      CenterDialog(hWnd);
      return TRUE;
    }

    case WM_COMMAND:
    {
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
        break;

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDB_OPTIONS:
        {
          //Get the "this" pointer
          CMainWindow* pThis = (CMainWindow*)GetThis(hWnd);

          //Bring up the Main Window Options
          pThis->OnOptions();
          return 0;
        }

        case IDB_AGGREGATION:
        {
          //Aggregation Combo Selection has changed...
          //If we are now using Aggregation, automatically change the requested
          //riid to IID_IUnknown, since its an error otherwise...
          if(::IsDlgButtonChecked(hWnd, IDB_AGGREGATION))
            s_CComboInterface.SetGuid(IID_IUnknown);
          return 0;
        }

        case IDOK:
        {
          CWaitCursor waitCursor;

          //Get the "this" pointer
          CMainWindow*  pThis     = (CMainWindow*)GetThis(hWnd);
          IUnknown*   pIUnknown   = NULL;
          HRESULT hr = S_OK;

          CServiceComp*  pCServiceComp  = SOURCE_GETOBJECT(pThis->m_pCSource, CServiceComp);
          ASSERT(pCServiceComp);

          //Get the InitString from the EditBox
          SAFE_FREE(pCServiceComp->m_pwszInitString);
          pCServiceComp->m_pwszInitString = s_CInitStringBox.GetWindowText();

          //Obtain the Aggregation argument
          CAggregate* pCAggregate = NULL;
          fAggregation = ::IsDlgButtonChecked(hWnd, IDB_AGGREGATION);
          if(fAggregation)
            pCAggregate = new CAggregate();

          //Obtain the Output (ppIUnknown) argument
          fOutput = ::IsDlgButtonChecked(hWnd, IDB_OUTPUT);

          //Interface
          REFIID riid = s_CComboInterface.GetGuid();

          //Obtain the correct MDI Child
          CMDIChild* pCMDIChild = (CMDIChild*)pThis->FindWindow(L"MDICHILD");

          //Existing DataSource
          fUseExistingDSO = ::IsDlgButtonChecked(hWnd, IDB_EXISTING_DSO);
          if(fUseExistingDSO && pCMDIChild && fOutput)
          {
            //Release is called on input, for successful cases...
            //I don't want them to release my DataSource, so AddRef...
            pIUnknown = SOURCE_GETINTERFACE(pCMDIChild->GetObject(eCDataSource), IUnknown);
            SAFE_ADDREF(pIUnknown);
          }

          //GetDataSource - with the specified InitString
          //NOTE:  The release of the input/ouput datasource is a likely tricky
          // 1.  *ppIUnknown == NULL on input - Succeeded - output 1 reference
          // 2.  *ppIUnknown == NULL on input - Failed  - output NULL
          // 3.  *ppIUnknown != NULL on input - Succeeded - input is released, and output is QI'd. (in effect refcount has not changed)
          // 4.  *ppIUnknown != NULL on input - Failed  - input is untouched, output is NULL. (in effect refcount has not changed)
          //Although this seems a little odd, its entirly optimized for the consumer
          //All we have to do is AddRef the input and always release the output
          TESTC(hr = pCServiceComp->GetDataSource(pCAggregate, pThis->GetOptions()->m_dwCLSCTX, pCServiceComp->m_pwszInitString, riid, fOutput ? &pIUnknown : NULL));

          //Handle the returned object...
          //NOTE: Can pontentially return other object types: (ie: CREATE_DETERMINE_TYPE)
          if(!pThis->HandleObjectType(pCServiceComp, pIUnknown, riid, eCDataSource, 0, NULL, CREATE_NEWWINDOW | CREATE_DETERMINE_TYPE | pThis->GetOptions()->m_dwCreateOpts))
            TESTC(hr = E_FAIL);

        CLEANUP:
          SAFE_RELEASE(pCAggregate);
          SAFE_RELEASE(pIUnknown);
          if(SUCCEEDED(hr))
            EndDialog(hWnd, TRUE);
          return 0;
        }

        case IDB_BROWSE_PROVIDER:
        {
          CMainWindow* pThis = (CMainWindow*)GetThis(hWnd);
          pThis->DisplayDialog(IDD_SIMPLE_LISTBOX, hWnd, CMainWindow::EnumPropertiesProc, pThis->m_pCSource, pThis->m_idSource);
          return 0;
        }

        case IDCANCEL:
        {
          EndDialog(hWnd, FALSE);
          return 0;
        }
      }
      break;
    }//WM_COMMAND
  }

  return FALSE;
}

CBase * CMainWindow::GetObject | ( | SOURCE | eSource = eCUnknown,
 |  | BOOL | fAlways = FALSE |
 | ) |  |  | [virtual]

Definition at line 1666 of file cmainwindow.cpp.

{
  CBase** ppCBase = GetObjectAddress(eSource);
  if(ppCBase)
  {
    CBase* pCBase = *ppCBase;
    if(pCBase && (eSource==eCUnknown || pCBase->GetObjectType()==eSource || pCBase->GetBaseType() & eSource) && (fAlways || pCBase->m_pIUnknown))
      return pCBase;
  }

  return NULL;
}

CBase ** CMainWindow::GetObjectAddress ( SOURCE eSource = eCUnknown ) [virtual]

Definition at line 1684 of file cmainwindow.cpp.

{
  CBase** ppCObject = NULL;

  switch(eSource)
  {
    case eCBinder:
      ppCObject = (CBase**)&m_pCRootBinder;
      break;

    case eCEnumerator:
      ppCObject = (CBase**)&m_pCRootEnumerator;
      break;

    case eCServiceComp:
      ppCObject = (CBase**)&m_pCServiceComp;
      break;

    case eCDataLinks:
      ppCObject = (CBase**)&m_pCDataLinks;
      break;

    case eCUnknown:
      //Determine "Last" object type...
      if(m_pCRootEnumerator && m_pCRootEnumerator->m_pIUnknown)
        return (CBase**)&m_pCRootEnumerator;
      else if(m_pCRootBinder && m_pCRootBinder->m_pIUnknown)
        return (CBase**)&m_pCRootBinder;
      else if(m_pCServiceComp && m_pCServiceComp->m_pIUnknown)
        return (CBase**)&m_pCServiceComp;
      else if(m_pCDataLinks && m_pCDataLinks->m_pIUnknown)
        return (CBase**)&m_pCDataLinks;
      break;

    default:
      break;
  };

  return ppCObject;
}

virtual COptionsSheet* CMainWindow::GetOptions ( ) [inline, virtual]

Definition at line 189 of file cmainwindow.h.

{ return m_pCOptionsSheet;      }

INT_PTR WINAPI CMainWindow::GetSourcesRowsetProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 3467 of file cmainwindow.cpp.

{
  static CComboBoxGuid  s_CComboInterface;
  static CPropSets    s_CPropSets;

  static BOOL fUseProps   = TRUE;     //Default
  static BOOL fAggregation  = FALSE;    //Default
  static BOOL fOutput     = TRUE;     //Default

  switch(message)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;

      //Save the "this" pointer
      CMainWindow* pThis = (CMainWindow*)SetThis(hWnd, (void*)lParam);

      //Use Properties
            ::CheckDlgButton(hWnd, IDB_USEPROPERTIES,  BST2STATE(fUseProps));

      //Aggregation
            ::CheckDlgButton(hWnd, IDB_AGGREGATION,    BST2STATE(fAggregation));

      //Output (ppIUnknown)
            ::CheckDlgButton(hWnd, IDB_OUTPUT,     BST2STATE(fOutput));

      //Only set these "Default" properties, if requested by the user
      if(pThis->GetOptions()->m_dwRowsetOpts & ROWSET_SETDEFAULTPROPS)
      {
        //DBPROP_CANHOLDROWS is required by the OLE DB Spec - Level-0 Conformance
        //Since it is also legal to set a ReadOnly property, just blindy set it...
        s_CPropSets.SetProperty(DBPROP_CANHOLDROWS, DBPROPSET_ROWSET, DBTYPE_BOOL, (void*)VARIANT_TRUE, DBPROPOPTIONS_REQUIRED);
      }

      //Interface List...
      s_CComboInterface.CreateIndirect(hWnd, IDC_INTERFACE);
      s_CComboInterface.Populate(g_cInterfaceMaps, g_rgInterfaceMaps);
      if(s_CComboInterface.RestoreSelection() == CB_ERR)
        s_CComboInterface.SetGuid(IID_IRowset);

      CenterDialog(hWnd);
      return TRUE;
    }

    case WM_COMMAND:
    {
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDB_SETPROPERTIES:
        {
          //Get the "this" pointer
          CMainWindow* pThis      = (CMainWindow*)GetThis(hWnd);
          CEnumerator* pCEnumerator = SOURCE_GETPARENT(pThis->m_pCSource, CEnumerator);

          CPropertiesDlg sCPropertiesDlg(pThis);
          sCPropertiesDlg.SetProperties(hWnd, &DBPROPSET_ROWSETALL, IID_IRowsetInfo, NULL, pCEnumerator ? pCEnumerator->m_pIDBProperties : NULL, &s_CPropSets);
          return 0;
        }

        case IDB_AGGREGATION:
        {
          //Aggregation Combo Selection has changed...
          //If we are now using Aggregation, automatically change the requested
          //riid to IID_IUnknown, since its an error otherwise...
          if(::IsDlgButtonChecked(hWnd, IDB_AGGREGATION))
            s_CComboInterface.SetGuid(IID_IUnknown);
          return 0;
        }

        case IDOK:
        {
          CWaitCursor waitCursor;

          //Get the "this" pointer
          CMainWindow* pThis      = (CMainWindow*)GetThis(hWnd);
          CEnumerator* pCEnumerator = SOURCE_GETOBJECT(pThis->m_pCSource, CEnumerator);
          CMDIChild*   pCMDIChild   = pCEnumerator ? pCEnumerator->m_pCMDIChild : NULL;

          HRESULT hr = S_OK;
          IUnknown* pIUnknown = NULL;

          ULONG cPropSets = 0;
          DBPROPSET* rgPropSets = NULL;

          //Obtain the Aggregation argument
          CAggregate* pCAggregate = NULL;
          fAggregation = ::IsDlgButtonChecked(hWnd, IDB_AGGREGATION);
          if(fAggregation)
            pCAggregate = new CAggregate();

          //Obtain the Output (ppIUnknown) argument
          fOutput = ::IsDlgButtonChecked(hWnd, IDB_OUTPUT);

          //Interface
          REFIID riid = s_CComboInterface.GetGuid();

          //Use Properties
          fUseProps = ::IsDlgButtonChecked(hWnd, IDB_USEPROPERTIES);
          if(fUseProps)
          {
            cPropSets = s_CPropSets.GetCount();
            rgPropSets = s_CPropSets.GetPropSets();
          }

          //ISourcesRowset::GetSourcesRowset
          hr = pCEnumerator->GetSourcesRowset(pCAggregate, riid, cPropSets, rgPropSets, fOutput ? &pIUnknown : NULL);

          //Process the Rowset
          if(SUCCEEDED(hr))
          {
            //NOTE: Can pontentially return other object types: (ie: CREATE_DETERMINE_TYPE)
            if(!pThis->HandleObjectType(pCEnumerator, pIUnknown, riid, eCRowset, 0, NULL, pCMDIChild ? CREATE_NEWWINDOW_IFEXISTS | CREATE_DETERMINE_TYPE : CREATE_NEWWINDOW | CREATE_DETERMINE_TYPE))
              hr = E_FAIL;
          }

          SAFE_RELEASE(pIUnknown);
          SAFE_RELEASE(pCAggregate);

          if(SUCCEEDED(hr))
            EndDialog(hWnd, TRUE);
          return 0;
        }

        case IDCANCEL:
        {
          EndDialog(hWnd, FALSE);
          return 0;
        }
      }
      break;
    }//WM_COMMAND
  }

  return FALSE;
}

CBase * CMainWindow::HandleObjectType | ( | CBase * | pCSource,
 |  | IUnknown * | pIUnknown,
 |  | REFIID | riid,
 |  | SOURCE | eSource,
 |  | ULONG | cPropSets,
 |  | DBPROPSET * | rgPropSets,
 |  | DWORD | dwFlags |
 | ) |  |  | [virtual]

Definition at line 4490 of file cmainwindow.cpp.

{
  CWaitCursor waitCursor;
  HRESULT hr = S_OK;
  CMDIChild*  pCMDIChild  = pCSource ? pCSource->m_pCMDIChild : NULL;
  CMDIChild*  pCNewChild  = NULL;
  CBase*    pCObject  = NULL;
  DWORD dwCreateOpts    = GetOptions()->m_dwCreateOpts;

  //No-op
  if(!pIUnknown)
    return NULL;

  if(dwFlags & CREATE_DETERMINE_TYPE)
  {
    //Don't rely upon the caller knowing exactly what the object type is...
    //Since many OLE DB methods can return different objects depending upon interface or properties
    //requested.  So use the "suggested" type as an optimizing starting point, and if not
    //then proceed the hard way to determine exactly what it is...
    eSource = DetermineObjectType(pIUnknown, eSource);
  }

  //Does the object already exists, we may need to create a new window
  if(pCMDIChild && (dwFlags & CREATE_NEWWINDOW_IFEXISTS))
  {
    //NOTE: Some objects occupy the same location (address) - (ie: only one is active at a time).
    //For example: Only one DataSet, Row, or Rowset will be within a MDIChild, but all reside
    //in the base class CDataAccess for simplity (no special casing).  Because of this you can't
    //just do ->GetObject(eSource) since it will return NULL if not the exact object type, but
    //their could still be another type of object present.  For example, a rowset -> row,
    //if we asked for GetObject(eCRow) we would get NULL, and think we don't need to create
    //antoher window, but in reality the "address" is already taken for another object.  The
    //reason we use GetObjectAddress instread of GetObject.
    CBase** ppCBase = pCMDIChild->GetObjectAddress(eSource);
    if(ppCBase)
    {
      CBase* pCBase = *ppCBase;
      if(pCBase && pCBase->m_pIUnknown)
      {
        //If its not the same object then create a new window.  This way the
        //user knows if the object returned is the same as before or not...
        if(!pCBase->IsSameObject(pIUnknown))
          dwFlags |= CREATE_NEWWINDOW;
      }
    }
  }

  //Do we need to find the parent window
  if(pCSource && (dwFlags & CREATE_FINDWINDOW))
  {
    //Unless we find the window, we will have to create a new one...
    dwFlags |= CREATE_NEWWINDOW;

    //Try to find the parent window...
    CBase* pCParent = pCSource->GetParent(eSource);
    if(pCParent)
    {
      if(pCParent->m_pIUnknown && !pCParent->IsSameObject(pIUnknown))
      {
        //Found window/object, but an object already exists of this type,
        //and its not the same object.  Looks like a different object was
        //returned.  Display the new object, so the user visually sees that
        //a new object was created, and not just the parent returned...
        dwFlags |= CREATE_NEWWINDOW;
      }
      else
      {
        //Since we found the parent, we need to use the parent for this object/display
        pCSource  = pCParent->m_pCParent;
        pCMDIChild  = pCParent->m_pCMDIChild;

        //Found window and object.
        if(pCMDIChild)
          MDIActivate(pCMDIChild->GetWnd());
        dwFlags &= ~CREATE_NEWWINDOW;
      }
    }
  }

  //Create a new window...
  if(dwFlags & CREATE_NEWWINDOW)
  {
    pCNewChild = NULL;
    pCMDIChild = NULL;
  }

  //Now that we know the type, do the appropiate thing...
  switch(eSource)
  {
    case eCBinder:
    {
      //Stand Alone Object (no window required)
      CBinder* pCBinder = new CBinder(this);
      pCObject = pCBinder;

      //Binder - Connect using the passed in Instance
      TESTC(hr = pCBinder->CreateObject(pCSource, riid, pIUnknown));

      //Binder - SetProperties
      if(cPropSets)
        TESTC(hr = pCBinder->SetProperties(cPropSets, rgPropSets));
      break;
    }

    case eCEnumerator:
    {
      //Stand Alone Object (no window required)
      CEnumerator* pCEnumerator = new CEnumerator(this);
      pCObject = pCEnumerator;

      //Enum - Connect using the passed in Instance
      TESTC(hr = pCEnumerator->CreateObject(pCSource, riid, pIUnknown));

      //Enum - SetProperties
      if(cPropSets && dwFlags & CREATE_SETPROPERTIES)
        TESTC(hr = pCEnumerator->SetProperties(cPropSets, rgPropSets));

      //Enum - Initialize
      if(dwFlags & CREATE_INITIALIZE)
      {
        //Initialize and Obtain interfaces
        TESTC(hr = pCEnumerator->Initialize());
      }
      break;
    }

    case eCDataSource:
    {
      //Object requires a window
      if(!pCMDIChild)
        pCNewChild = pCMDIChild = new CMDIChild(this);

      //If the user has requested to Initialize the object, then don't AutoQI
      //for optional interfaces until after Initialization.  This way we improve
      //performance and help to allow pooling.  We do want to QI for Optional
      //interfaces if not going to initialize since the object may already
      //be initialized or the user may want optional interfaces before initialization
      if(dwFlags & CREATE_INITIALIZE)
        ENABLE_BIT(dwCreateOpts, CREATE_QI_OPTIONAL, FALSE);

      //Defferred Object
      if(!pCMDIChild->m_pCDataSource)
        pCMDIChild->m_pCDataSource = new CDataSource(NULL, pCMDIChild);
      CDataSource* pCDataSource = pCMDIChild->m_pCDataSource;
      pCObject = pCDataSource;

      //Create the Object
      TESTC(hr = pCDataSource->CreateObject(pCSource, riid, pIUnknown, dwCreateOpts));

      //DataSource - SetProperties
      if(cPropSets && (dwFlags & CREATE_SETPROPERTIES))
        TESTC(hr = pCDataSource->SetProperties(cPropSets, rgPropSets));

      //DataSource - Initialize
      if(dwFlags & CREATE_INITIALIZE)
      {
        //Initialize and Obtain datasource interfaces
        TESTC(hr = pCDataSource->Initialize());
      }

      //Create Session
      //Since this is a generic routine, we are not totally sure that we are initialized
      //or not.  The CREATE_INITIALIZE flag is a good indication, but this could be called
      //from other places that return initialized DSOs (Bind for example) and we want to provide
      //the user with a helper to provide the sub objects.  So if IDBCreateSession is exposed
      //try and create a session, but don't popup the error to the user. It will be in the trace.
      if((dwCreateOpts & CREATE_QI_MANDATORY) /*&& d(wFlags & CREATE_INITIALIZE)*/)
      {
        //NOTE: We only "automatically" create a session if the user requests
        //MANDATORY interfaces, we have IDBCreateSession,
        //and there already isn't an existing session
        if(pCDataSource->m_pIDBCreateSession && !pCMDIChild->GetObject(eCSession))
        {
          //Recurse
          IUnknown* pIUnkSession = NULL;

          //IDBCreateSession::CreateSession
          //NOTE: Don't fail creation of the object if CreateSession fails...
          //NOTE: We don't use IID_IOpenRowset since its not a required session interface
          //if the DataSource if of type MDP exclusively...
          if(SUCCEEDED(pCDataSource->CreateSession(NULL, IID_IUnknown, (IUnknown**)&pIUnkSession)))
            HandleObjectType(pCDataSource, pIUnkSession, IID_IUnknown, eCSession, 0, NULL, CREATE_NEWWINDOW_IFEXISTS);
          SAFE_RELEASE(pIUnkSession);
        }
      }
      break;
    }

    case eCSession:
    {
      //Object requires a window
      if(!pCMDIChild)
        pCNewChild = pCMDIChild = new CMDIChild(this);

      //Defferred Object
      if(!pCMDIChild->m_pCSession)
        pCMDIChild->m_pCSession = new CSession(NULL, pCMDIChild);
      CSession* pCSession = pCMDIChild->m_pCSession;
      pCObject = pCSession;

      //Update our Session object
      TESTC(hr = pCSession->CreateObject(pCSource, riid, pIUnknown));

      //Command (optional - provider may not support commands)
      //NOTE: We only "automatically" create a command if the user requests
      //MANDATORY interfaces, we have IDBCreateCommand,
      //and there already isn't an existing command
      if(dwCreateOpts & CREATE_QI_MANDATORY)
      {
        if(pCSession->m_pIDBCreateCommand && !pCMDIChild->GetObject(eCCommand))
        {
          //Recurse
          ICommand* pICommand = NULL;

          //NOTE: Don't fail creation of the object if CreateCommand fails...
          if(SUCCEEDED(pCSession->CreateCommand(NULL, IID_ICommand, (IUnknown**)&pICommand)))
            HandleObjectType(pCSession, pICommand, IID_ICommand, eCCommand, 0, NULL, CREATE_NEWWINDOW_IFEXISTS);
          SAFE_RELEASE(pICommand);
        }
      }
      break;
    }

    case eCCommand:
    {
      //Object requires a window
      if(!pCMDIChild)
        pCNewChild = pCMDIChild = new CMDIChild(this);

      //Defferred Object
      if(!pCMDIChild->m_pCCommand)
        pCMDIChild->m_pCCommand = new CCommand(NULL, pCMDIChild);
      CCommand* pCCommand = pCMDIChild->m_pCCommand;
      pCObject = pCCommand;

      //Update our Command object (and set default properties)
      TESTC(hr = pCCommand->CreateObject(pCSource, riid, pIUnknown));

      //Command - SetProperties
      if(cPropSets)
        TESTC(hr = pCCommand->SetProperties(cPropSets, rgPropSets));

      //We should set the default properties on the Command object as well...
      if(GetOptions()->m_dwRowsetOpts & ROWSET_SETDEFAULTPROPS)
      {
        if(pCMDIChild->m_CDefPropSets.GetCount())
          pCCommand->SetProperties(pCMDIChild->m_CDefPropSets.GetCount(), pCMDIChild->m_CDefPropSets.GetPropSets());
      }
      break;
    }

    case eCMultipleResults:
      //Object requires a window
      if(!pCMDIChild)
        pCNewChild = pCMDIChild = new CMDIChild(this);

      //Defferred Object
      if(!pCMDIChild->m_pCMultipleResults)
        pCMDIChild->m_pCMultipleResults = new CMultipleResults(NULL, pCMDIChild);
      pCObject = pCMDIChild->m_pCMultipleResults;

      //Obtain IMultipleResults
      TESTC(hr = pCMDIChild->m_pCMultipleResults->CreateObject(pCSource, riid, pIUnknown));
      break;

    case eCRowset:
    {
      //Object requires a window
      if(!pCMDIChild)
        pCNewChild = pCMDIChild = new CMDIChild(this);

      //NOTE: We delete the previous class, since we may be creating a different type
      //Only if its of a different type, (so we don't have duplicate similar objects in the tree...
      CRowset* pCRowset = SOURCE_GETOBJECT(pCMDIChild->m_pCDataAccess, CRowset);
      if(!pCRowset)
      {
        SAFE_RELEASE(pCMDIChild->m_pCDataAccess);
        pCRowset = new CRowset(NULL, pCMDIChild);
      }
      pCObject = pCMDIChild->m_pCDataAccess = pCRowset;

      //Now, update our rowset object with the rowset pointer
      TESTC(hr = pCRowset->CreateObject(pCSource, riid, pIUnknown));

      //Do we need to restart the cursor before displaying this object?
      if(dwFlags & CREATE_RESTARTPOSITION)
      {
        pCRowset->RestartPosition();
      }
      break;
    }

    case eCRow:
    {
      //Object requires a window
      if(!pCMDIChild)
        pCNewChild = pCMDIChild = new CMDIChild(this);

      //NOTE: We delete the previous class, since we may be creating a different type
      //Only if its of a different type, (so we don't have duplicate similar objects in the tree...
      CRow* pCRow = SOURCE_GETOBJECT(pCMDIChild->m_pCDataAccess, CRow);
      if(!pCRow)
      {
        SAFE_RELEASE(pCMDIChild->m_pCDataAccess);
        pCRow = new CRow(NULL, pCMDIChild);
      }
      pCObject = pCMDIChild->m_pCDataAccess = pCRow;

      //Update our row object (in new window always)
      TESTC(hr = pCRow->CreateObject(pCSource, riid, pIUnknown));

      //Create the command object off the row by default...
      //NOTE: We only "automatically" create a command if the user requests
      //MANDATORY interfaces, we have IDBCreateCommand,
      //and there already isn't an existing command
      if(dwCreateOpts & CREATE_QI_MANDATORY)
      {
        if(pCRow->m_pIDBCreateCommand && !pCMDIChild->GetObject(eCCommand))
        {
          //Recurse
          ICommand* pICommand = NULL;
          if(SUCCEEDED(pCRow->CreateCommand(NULL, IID_ICommand, (IUnknown**)&pICommand)))
            HandleObjectType(pCRow, pICommand, IID_ICommand, eCCommand, 0, NULL, CREATE_NEWWINDOW_IFEXISTS);
          SAFE_RELEASE(pICommand);
        }
      }
      break;
    }

    case eCStream:
    {
      //Stand Alone Object (no window required)
      CStream* pCStream = new CStream(this);
      pCObject = pCStream;

      //Update our Stream object
      TESTC(hr = pCStream->CreateObject(pCSource, riid, pIUnknown));
      break;
    }

    case eCDataset:
    {
      //Object requires a window
      if(!pCMDIChild)
        pCNewChild = pCMDIChild = new CMDIChild(this);

      //NOTE: We delete the previous class, since we may be creating a different type
      //Only if its of a different type, (so we don't have duplicate similar objects in the tree...
      CDataset* pCDataset = SOURCE_GETOBJECT(pCMDIChild->m_pCDataAccess, CDataset);
      if(!pCDataset)
      {
        SAFE_RELEASE(pCMDIChild->m_pCDataAccess);
        pCDataset = new CDataset(NULL, pCMDIChild);
      }
      pCObject = pCMDIChild->m_pCDataAccess = pCDataset;

      //Update our data set
      TESTC(hr = pCDataset->CreateObject(pCSource, riid, pIUnknown));
      break;
    }

    case eCServiceComp:
      pCObject = m_pCServiceComp;

      //Update our object
      TESTC(hr = m_pCServiceComp->CreateObject(pCSource, riid, pIUnknown));
      break;

    case eCDataLinks:
      //Object requires a window
      if(!pCMDIChild)
        pCNewChild = pCMDIChild = new CMDIChild(this);

      //Defferred Object
      if(!m_pCDataLinks)
        m_pCDataLinks = new CDataLinks(this);
      pCObject = m_pCDataLinks;

      //Update our object
      TESTC(hr = m_pCDataLinks->CreateObject(pCSource, riid, pIUnknown));
      break;

    case eCTransaction:
    {
      //Stand Alone Object (no window required)
      CTransaction* pCTransaction = new CTransaction(this);
      pCObject = pCTransaction;

      //Update our object
      TESTC(hr = pCTransaction->CreateObject(pCSource, riid, pIUnknown));
      break;
    }

    case eCTransactionOptions:
    {
      //Stand Alone Object (no window required)
      CTransactionOptions* pCTransactionOptions = new CTransactionOptions(this);
      pCObject = pCTransactionOptions;

      //Update our object
      TESTC(hr = pCTransactionOptions->CreateObject(pCSource, riid, pIUnknown));
      break;
    }

    case eCError:
    {
      //Stand Alone Object (no window required)
      CError* pCError = new CError(this);
      pCObject = pCError;

      //Update our object
      TESTC(hr = pCError->CreateObject(pCSource, riid, pIUnknown));
      break;
     }

    case eCCustomError:
    {
      //Stand Alone Object (no window required)
      CCustomError* pCCustomError = new CCustomError(this);
      pCObject = pCCustomError;

      //Update our object
      TESTC(hr = pCCustomError->CreateObject(pCSource, riid, pIUnknown));
      break;
     }

    case eCRowPosition:
    {
      //Stand Alone Object (no window required)
      CRowPosition* pCRowPosition = new CRowPosition(this);
      pCObject = pCRowPosition;

      //Update our object
      TESTC(hr = pCRowPosition->CreateObject(pCSource, riid, pIUnknown));

      //Now Initialize (if source was a rowset)...
      if(dwFlags & CREATE_INITIALIZE)
        TESTC(hr = pCRowPosition->Initialize(pCSource ? pCSource->m_pIUnknown : NULL));
      break;
    }

    case eCConnectionPoint:
    {
      //Stand Alone Object (no window required)
      CConnectionPoint* pCConnectionPoint = new CConnectionPoint(this);
      pCObject = pCConnectionPoint;

      //Update our object
      TESTC(hr = pCConnectionPoint->CreateObject(pCSource, riid, pIUnknown));
      break;
    }

    case eCUnknown:
    {
      //Stand Alone Object (no window required)
      CUnknown* pCUnknown = new CUnknown(this);
      pCObject = pCUnknown;

      //Update our object
      TESTC(hr = pCUnknown->CreateObject(pCSource, riid, pIUnknown));

      //Inform user that we don't have a clue what type of object this is?
      wMessageBox(GetFocus(), MB_OK|MB_ICONWARNING|MB_SYSTEMMODAL, wsz_WARNING,
        L"The object returned does not support any of the mandatory interfaces for any recognized OLE DB Object?\n");
      break;
    }

    default:
      ASSERT(!"Unhandled Object Type!");
      TESTC(hr = E_FAIL);
      break;
  };

  //Now display the new window
  if(pCNewChild)
  {
    //Copy(AddRef) the previous objects for this wiindow...
    if(pCObject)
    {
      CBase* pCParent = pCObject->m_pCParent;
      while(pCParent)
      {
        //Copy into our objects, if they don't already exist...
        CBase** ppCBase = pCNewChild->GetObjectAddress(pCParent->GetObjectType());
        if(ppCBase && *ppCBase==NULL)
        {
          //NOTE: We don't want to replace objects of the same type.
          //For example: If the parent of this object is of the same
          //type, (IRowset -> ColumnsRowset) then we don't need to replace
          //the current object.  The simplest way to do this is to only
          //replace NULL addresses (ie: *ppCBase == NULL)
          SAFE_ADDREF(pCParent);
          *ppCBase = pCParent;
        }

        pCParent = pCParent->m_pCParent;
      }
    }

    //Create the new window...
    pCNewChild->Create(m_hWndMDIClient, L"MDICHILD", NULL, IDR_ROWSETVIEWER, ImageList_GetIcon(m_hImageList, IMAGE_OBJECTS, ILD_NORMAL));
  }

  //Display the object, unless the caller app wishes to...
  if(!(dwFlags & CREATE_NODISPLAY))
    pCObject->DisplayObject();

CLEANUP:
  if(FAILED(hr) || !pCObject)
  {
    SAFE_DELETE(pCNewChild);
    pCObject = NULL;
  }

  UpdateControls();
  return pCObject;
}

BOOL CMainWindow::LoadSettings ( ) [virtual]

Definition at line 1769 of file cmainwindow.cpp.

{
  HKEY hOptionsKey = NULL;
  memset(&m_wndPlacement, 0, sizeof(m_wndPlacement));

  //Open the key to make things a little quicker and direct...
  TESTC_(OpenRegKey(HKEY_ROWSETVIEWER, wszOPTIONS_KEY, 0, KEY_READ, &hOptionsKey),S_OK);

  //Window Positions
  GetRegEntry(hOptionsKey, NULL, L"WinPosition",    &m_wndPlacement,  sizeof(m_wndPlacement), NULL);

CLEANUP:
  CloseRegKey(hOptionsKey);
  return TRUE;
}

void CMainWindow::OnAbort ( CAsynchBase * pCAsynchBase ) [virtual]

Definition at line 2105 of file cmainwindow.cpp.

{
  if(pCAsynchBase && pCAsynchBase->m_pIDBAsynchStatus)
  {
    CWaitCursor waitCursor;

    //IDBAsynchStatus::Abort
    XTEST(pCAsynchBase->Abort(NULL, DBASYNCHOP_OPEN));
  }
}

void CMainWindow::OnAbout ( ) [virtual]

Definition at line 1811 of file cmainwindow.cpp.

{
  CAboutDlg aboutDlg;
  aboutDlg.DoModal(m_hWnd);
}

void CMainWindow::OnAddRef ( CBase * pCBase ) [virtual]

Definition at line 1876 of file cmainwindow.cpp.

{
  if(pCBase && pCBase->m_pIUnknown)
  {
    CWaitCursor waitCursor;
    pCBase->ObjectAddRef();
  }
}

void CMainWindow::OnAdvise ( CConnectionPoint * pCConnectionPoint ) [virtual]

Definition at line 2063 of file cmainwindow.cpp.

{
  if(pCConnectionPoint && pCConnectionPoint->m_pIConnectionPoint)
  {
    m_pCListener->Advise(pCConnectionPoint->m_pIConnectionPoint, &pCConnectionPoint->m_dwCookie);
  }
}

void CMainWindow::OnArrangeIcons ( ) [virtual]

Definition at line 3057 of file cmainwindow.cpp.

{
  // let MDI Client arrange iconic MDI children
  SendMessage(m_hWndMDIClient, WM_MDIICONARRANGE, 0, 0);
}

void CMainWindow::OnAutoQI ( CBase * pCBase ) [virtual]

Definition at line 1990 of file cmainwindow.cpp.

{
  if(pCBase && pCBase->m_pIUnknown)
  {
    CWaitCursor waitCursor;

    //Obtain all interfaces
    pCBase->AutoQI(CREATE_QI_MANDATORY | CREATE_QI_OPTIONAL);

    //Also "redraw" the object now that more interfaces are available for use
    //For Example: If the rowset was originally obtained with AutiQI off, and
    //now the user wished to see the rowset, we display the object...
    pCBase->DisplayObject();

    //And update any common controls...
    UpdateControls();
    if(pCBase->m_pCMDIChild)
      pCBase->m_pCMDIChild->UpdateControls();
  }
}

void CMainWindow::OnCascade ( ) [virtual]

Definition at line 3047 of file cmainwindow.cpp.

{
  // let MDI Client cascade MDI children
  SendMessage(m_hWndMDIClient, WM_MDICASCADE, 0, 0);
}

void CMainWindow::OnCloseAll ( ) [virtual]

Definition at line 3067 of file cmainwindow.cpp.

{
  CWaitCursor waitCursor;

  RemoveAllChildren();
  UpdateControls();
}

BOOL CMainWindow::OnCommand | ( | UINT | iID,
 |  | HWND | hWndCtrl |
 | ) |  |  | [virtual]

Reimplemented from CMDIFrameLite.

Definition at line 864 of file cmainwindow.cpp.

{
  HRESULT hr = S_OK;
  DWORD dwValue = 0;

  //Is there an active object...
  CBase*        pCObject        = m_pCMDIObjects->m_pCObjTree->GetSelectedObject();
  CContainerBase*   pCContainerBase     = SOURCE_GETOBJECT(pCObject, CContainerBase);
  CAsynchBase*    pCAsynchBase      = SOURCE_GETOBJECT(pCObject, CAsynchBase);
  CConnectionPoint* pCConnectionPoint   = SOURCE_GETOBJECT(pCObject, CConnectionPoint);
  CRowPosition*   pCRowPosition     = SOURCE_GETOBJECT(pCObject, CRowPosition);
  CError*       pCError         = SOURCE_GETOBJECT(pCObject, CError);
  CStream*      pCStream        = SOURCE_GETOBJECT(pCObject, CStream);

  //Setup the Source info
  m_idSource = iID;
  m_pCSource = pCObject;

  switch(iID)
  {
    //File Menu
    ON_COMMAND(IDM_EXIT,                  OnClose())
//    ON_COMMAND(IDM_SAVE,                  OnSave())
//    ON_COMMAND(IDM_SAVEAS,                  OnSave(TRUE))

    ON_COMMAND(IDM_FULLCONNECT,               OnConnect())
    ON_COMMAND(IDM_FULLDISCONNECT,              OnDisconnect())

    ///////////////////////////////////////////////////////////////////
    // IUnknown
    //
    ///////////////////////////////////////////////////////////////////
    ON_COMMAND(IDM_UNKNOWN_ADDREF,                  OnAddRef(pCObject))
    ON_COMMAND(IDM_DATASOURCE_ADDREF,               OnAddRef(pCObject))
    ON_COMMAND(IDM_SESSION_ADDREF,                  OnAddRef(pCObject))
    ON_COMMAND(IDM_COMMAND_ADDREF,                  OnAddRef(pCObject))
    ON_COMMAND(IDM_MULTIPLERESULTS_ADDREF,              OnAddRef(pCObject))
    ON_COMMAND(IDM_ROWSET_ADDREF,                 OnAddRef(pCObject))
    ON_COMMAND(IDM_ROW_ADDREF,                    OnAddRef(pCObject))
    ON_COMMAND(IDM_STREAM_ADDREF,                 OnAddRef(pCObject))
    ON_COMMAND(IDM_ENUMERATOR_ADDREF,               OnAddRef(pCObject))
    ON_COMMAND(IDM_BINDER_ADDREF,                 OnAddRef(pCObject))
    ON_COMMAND(IDM_SERVICECOMP_ADDREF,                OnAddRef(pCObject))
    ON_COMMAND(IDM_DATALINKS_ADDREF,                OnAddRef(pCObject))
    ON_COMMAND(IDM_DATASET_ADDREF,                  OnAddRef(pCObject))
    ON_COMMAND(IDM_TRANSACTION_ADDREF,                OnAddRef(pCObject))
    ON_COMMAND(IDM_TRANSACTIONOPTIONS_ADDREF,           OnAddRef(pCObject))
    ON_COMMAND(IDM_ERROR_ADDREF,                  OnAddRef(pCObject))
    ON_COMMAND(IDM_CUSTOMERROR_ADDREF,                OnAddRef(pCObject))
    ON_COMMAND(IDM_ROWPOS_ADDREF,                 OnAddRef(pCObject))
    ON_COMMAND(IDM_CONNECTIONPOINT_ADDREF,              OnAddRef(pCObject))
    ON_COMMAND(IDM_POOLINFO_ADDREF,                 OnAddRef(pCObject))

    ON_COMMAND(IDM_IUNKNOWN_RELEASE,                OnRelease(pCObject))
    ON_COMMAND(IDM_IUNKNOWN_QUERYINTERFACE,             OnQueryInterface(pCObject))
    ON_COMMAND(IDM_IUNKNOWN_AUTOQI,                 OnAutoQI(pCObject))
    ON_COMMAND(IDM_IUNKNOWN_RELEASEALL,               OnReleaseAll(pCObject))
    ON_COMMAND(IDM_IUNKNOWN_RELEASECHILDREN,            OnReleaseAll(pCObject, TRUE/*fChildren*/))

    ///////////////////////////////////////////////////////////////////
    // ISupportErrorInfo
    //
    ///////////////////////////////////////////////////////////////////
    ON_COMMAND(IDM_ISUPPORTERRORINFO,               OnSupportErrorInfo(pCObject))

    ///////////////////////////////////////////////////////////////////
    // ISupportErrorInfo
    //
    ///////////////////////////////////////////////////////////////////
    ON_COMMAND(IDM_ICPC_FINDCONNECTIONPOINT,            OnFindConnectionPoint(pCContainerBase, IID_IDBAsynchNotify))
    ON_COMMAND(IDM_ICPC_ENUMCONNECTIONPOINTS,           FALSE)

    ///////////////////////////////////////////////////////////////////
    // IConnectionPoint
    //
    ///////////////////////////////////////////////////////////////////
    ON_COMMAND(IDM_ICONNECTIONPOINT_GETCONNECTIONINTERFACE,     OnGetConnectionInterface(pCConnectionPoint))
    ON_COMMAND(IDM_ICONNECTIONPOINT_ADVISE,             OnAdvise(pCConnectionPoint))
    ON_COMMAND(IDM_ICONNECTIONPOINT_UNADVISE,           OnUnadvise(pCConnectionPoint))
    ON_COMMAND(IDM_ICONNECTIONPOINT_ENUMCONNECTIONS,        FALSE)
    ON_COMMAND(IDM_ICONNECTIONPOINT_GETCONNECTIONPOINTCONTAINER,  FALSE)

    ///////////////////////////////////////////////////////////////////
    // IDBAsynchStatus
    //
    ///////////////////////////////////////////////////////////////////
    ON_COMMAND(IDM_IDBASYNCHSTATUS_ABORT,             OnAbort(pCAsynchBase))
    ON_COMMAND(IDM_IDBASYNCHSTATUS_GETSTATUS,           OnGetStatus(pCAsynchBase))
    ON_COMMAND(IDM_IDBINITIALIZE_INITIALIZE,            OnInitialize(pCAsynchBase))
    ON_COMMAND(IDM_IDBINITIALIZE_UNINITIALIZE,            OnUninitialize(pCAsynchBase))

    ///////////////////////////////////////////////////////////////////
    // IDBProperties
    //
    ///////////////////////////////////////////////////////////////////
    case IDM_IDBPROPERTIES_SETPROPERTIES:
    {
      IDBProperties* pIDBProperties = SOURCE_GETINTERFACE(pCObject, IDBProperties);
      if(pIDBProperties)
      {
        CDataSource* pCDataSource = SOURCE_GETOBJECT(pCObject, CDataSource);

        CPropertiesDlg sCPropertiesDlg(this);
        sCPropertiesDlg.SetProperties(m_hWnd, pCDataSource ? (pCDataSource->IsInitialized() ? &DBPROPSET_DATASOURCEALL : &DBPROPSET_DBINITALL) : NULL, IID_IDBProperties, pIDBProperties, pIDBProperties);
      }
      return TRUE;
    }

    case IDM_IDBPROPERTIES_GETPROPERTIES:
    {
      IDBProperties* pIDBProperties = SOURCE_GETINTERFACE(pCObject, IDBProperties);
      if(pIDBProperties)
      {
        CPropertiesDlg sCPropertiesDlg(this);
        sCPropertiesDlg.GetProperties(m_hWnd, &DBPROPSET_DATASOURCEALL, IID_IDBProperties, pIDBProperties, pIDBProperties);
      }
      return TRUE;
    }

    case IDM_IDBPROPERTIES_GETPROPERTYINFO:
    {
      IDBProperties* pIDBProperties = SOURCE_GETINTERFACE(pCObject, IDBProperties);
      if(pIDBProperties)
      {
        CPropertiesDlg sCPropertiesDlg(this);
        sCPropertiesDlg.GetPropertyInfo(m_hWnd, &DBPROPSET_DATASOURCEALL, IID_IDBProperties, pIDBProperties);
      }
      return TRUE;
    }

    ///////////////////////////////////////////////////////////////////
    // IBindResource
    //
    ///////////////////////////////////////////////////////////////////
    case IDM_IBINDRESOURCE_BIND:
      if(SOURCE_GETINTERFACE(pCObject, IBindResource))
        DisplayDialog(IDD_BINDRESOURCE, m_hWnd, CMainWindow::BindResourceProc, pCObject, iID);
      return TRUE;

    case IDM_ICREATEROW_CREATEROW:
      if(SOURCE_GETINTERFACE(pCObject, ICreateRow))
        DisplayDialog(IDD_BINDRESOURCE, m_hWnd, CMainWindow::BindResourceProc, pCObject, iID);
      return TRUE;

    case IDM_IREGISTERPROVIDER_SETURLMAPPING:
      if(SOURCE_GETINTERFACE(pCObject, IRegisterProvider))
        DisplayDialog(IDD_URLMAPPING, m_hWnd, CMainWindow::RegisterProviderProc, pCObject, iID);
      return TRUE;

    case IDM_IREGISTERPROVIDER_GETURLMAPPING:
      if(SOURCE_GETINTERFACE(pCObject, IRegisterProvider))
        DisplayDialog(IDD_URLMAPPING, m_hWnd, CMainWindow::RegisterProviderProc, pCObject, iID);
      return TRUE;

    case IDM_IREGISTERPROVIDER_UNREGISTERPROVIDER:
      if(SOURCE_GETINTERFACE(pCObject, IRegisterProvider))
        DisplayDialog(IDD_URLMAPPING, m_hWnd, CMainWindow::RegisterProviderProc, pCObject, iID);
      return TRUE;

    case IDM_IDBBINDERPROPERTIES_RESET:
    {
      IDBBinderProperties* pIDBBinderProperties = SOURCE_GETINTERFACE(pCObject, IDBBinderProperties);
      if(pIDBBinderProperties)
      {
        CWaitCursor waitCursor;

        //IDBBinderProperties::Reset
        XTEST(hr = pIDBBinderProperties->Reset());
        TRACE_METHOD(hr, L"IDBBinderProperties::Reset()");
      }
      return TRUE;
    }

    ///////////////////////////////////////////////////////////////////
    // Stream
    //
    ///////////////////////////////////////////////////////////////////
    case IDM_ISTREAM_READ:
    case IDM_ISTREAM_WRITE:
    case IDM_ISEQSTREAM_READ:
    case IDM_ISEQSTREAM_WRITE:
      if(pCStream)
        DisplayDialog(IDD_STREAM_VIEWER, m_hWnd, CMainWindow::StreamViewerProc, pCObject, iID);
      return TRUE;

    case IDM_ISTREAM_CLONE:
      if(pCStream)
      {
        IStream* pIStream = NULL;

        //IStream::Clone
        if(SUCCEEDED(pCStream->Clone(&pIStream)))
        {
          //Display the new object
          HandleObjectType(pCStream, pIStream, IID_IStream, eCStream, 0, NULL, CREATE_DETERMINE_TYPE);
        }

        SAFE_RELEASE(pIStream);
      }
      return TRUE;

    case IDM_ISTREAM_SEEK:
      if(pCStream)
      {
        LARGE_INTEGER lgOffset;
        lgOffset.QuadPart = 0;

        //IStream::Seek
        XTEST(pCStream->Seek(lgOffset, STREAM_SEEK_SET, NULL));
      }
      return TRUE;

    case IDM_ISTREAM_STAT:
      if(pCStream)
      {
        STATSTG statstg;
        pCStream->Stat(&statstg);
      }
      return TRUE;

    ///////////////////////////////////////////////////////////////////
    // Enumerator
    //
    ///////////////////////////////////////////////////////////////////
    case IDM_ISOURCESROWSET_GETSOURCESROWSET:
      if(SOURCE_GETINTERFACE(pCObject, ISourcesRowset))
        DisplayDialog(IDD_GETSOURCESROWSET, m_hWnd, CMainWindow::GetSourcesRowsetProc, pCObject, iID);
      return TRUE;

    //Service Components
    ON_COMMAND(IDM_IDATAINITIALIZE_CREATEDBINSTANCE,        OnConnect())
    ON_COMMAND(IDM_IDATAINITIALIZE_CREATEDBINSTANCEEX,        OnConnect())
    ON_COMMAND(IDM_IDATAINITIALIZE_LOADSTRINGFROMSTORAGE,     OnLoadStringFromStorage())
    ON_COMMAND(IDM_IDATAINITIALIZE_GETDATASOURCE,         OnGetDataSource())
    ON_COMMAND(IDM_IDBPROMPTINITIALIZE_PROMPTDATASOURCE,      OnPromptDataSource())
    ON_COMMAND(IDM_IDBPROMPTINITIALIZE_PROMPTDATASOURCE_ADVANCED, OnPromptDataSource(TRUE/*fAdvanced*/))
    ON_COMMAND(IDM_IDBPROMPTINITIALIZE_PROMPTFILENAME,        OnPromptFileName())
    ON_COMMAND(IDM_IDBPROMPTINITIALIZE_PROMPTFILENAME_ADVANCED,   OnPromptFileName(TRUE/*fAdvanced*/))

    //IDataInitialize
    case IDM_IDATAINITIALIZE_GETINITIALIZATIONSTRING:
    case IDM_IDATAINITIALIZE_GETINITIALIZATIONSTRING_NOPASSWORD:
      if(m_pCServiceComp)
      {
        CWaitCursor waitCursor;

        //Password
        WCHAR* pwszInitString = NULL;
        boolean fIncludePassword = (iID == IDM_IDATAINITIALIZE_GETINITIALIZATIONSTRING);

        //Obtain the Active DataSource
        IUnknown* pIUnknown = NULL;
        CMDIChild* pCMDIChild = (CMDIChild*)FindWindow(L"MDICHILD");
        if(pCMDIChild)
          pIUnknown = SOURCE_GETINTERFACE(pCMDIChild->GetObject(eCDataSource), IUnknown);

        //GetInitializationString
        m_pCServiceComp->GetInitString(pIUnknown, fIncludePassword, &pwszInitString);
        SAFE_FREE(pwszInitString);
      }
      return TRUE;

    //IDataInitialize
    case IDM_IDATAINITIALIZE_WRITESTRINGTOSTORAGE:
      if(m_pCServiceComp)
      {
        CWaitCursor waitCursor;

        WCHAR* pwszInitString = NULL;
        boolean fIncludePassword = TRUE;

        //Use active object...
        CServiceComp* pCServiceComp = m_pCServiceComp;

        //Obtain the Active DataSource
        IUnknown* pIUnknown = NULL;
        CMDIChild* pCMDIChild = (CMDIChild*)FindWindow(L"MDICHILD");
        if(pCMDIChild)
          pIUnknown = SOURCE_GETINTERFACE(pCMDIChild->GetObject(eCDataSource), IUnknown);

        //Get the InitString for this DataSource
        hr = pCServiceComp->GetInitString(pIUnknown, fIncludePassword, &pwszInitString);
        if(SUCCEEDED(hr))
        {
          //Find the FileName to Save as...
          WCHAR wszFileName[MAX_QUERY_LEN] = {0};

          //Display Common Dialog to obtain File To Save...
          hr = BrowseSaveFileName(GetAppLite()->m_hInstance, m_hWnd, L"IDataInitialize::WriteStringToStorage", wszFileName, MAX_QUERY_LEN, L"udl", L"Microsoft Data Link Files (.udl)\0*.udl\0All Files (*.*)\0*.*\0\0");
          if(SUCCEEDED(hr))
            pCServiceComp->SaveInitString(wszFileName, pwszInitString);
        }
        SAFE_FREE(pwszInitString);
      }
      return TRUE;

    ON_COMMAND(IDM_CREATEFILEMONIKER,           OnCreateFileMoniker())

    ON_COMMAND(IDM_CREATE_ROOTBINDER,           OnRootBinder())
    ON_COMMAND(IDM_CREATE_ROOTENUMERATOR,         OnRootEnumerator())
    ON_COMMAND(IDM_CREATE_SERVICECOMPONENTS,        OnServiceComponents())
    ON_COMMAND(IDM_CREATE_DATALINKS,            OnDataLinks())

    ON_COMMAND(IDM_RECENTCONFIG1,             OnLoadRecentConfig(iID - IDM_RECENTCONFIG1))
    ON_COMMAND(IDM_RECENTCONFIG2,             OnLoadRecentConfig(iID - IDM_RECENTCONFIG1))
    ON_COMMAND(IDM_RECENTCONFIG3,             OnLoadRecentConfig(iID - IDM_RECENTCONFIG1))
    ON_COMMAND(IDM_RECENTCONFIG4,             OnLoadRecentConfig(iID - IDM_RECENTCONFIG1))
    ON_COMMAND(IDM_RECENTCONFIG5,             OnLoadRecentConfig(iID - IDM_RECENTCONFIG1))
    ON_COMMAND(IDM_RECENTCONFIG6,             OnLoadRecentConfig(iID - IDM_RECENTCONFIG1))
    ON_COMMAND(IDM_RECENTCONFIG7,             OnLoadRecentConfig(iID - IDM_RECENTCONFIG1))
    ON_COMMAND(IDM_RECENTCONFIG8,             OnLoadRecentConfig(iID - IDM_RECENTCONFIG1))
    ON_COMMAND(IDM_RECENTCONFIG9,             OnLoadRecentConfig(iID - IDM_RECENTCONFIG1))
    ON_COMMAND(IDM_RECENTCONFIG10,              OnLoadRecentConfig(iID - IDM_RECENTCONFIG1))

    ON_COMMAND(IDM_RECENTFILE1,               OnLoadRecentFile(iID - IDM_RECENTFILE1))
    ON_COMMAND(IDM_RECENTFILE2,               OnLoadRecentFile(iID - IDM_RECENTFILE1))
    ON_COMMAND(IDM_RECENTFILE3,               OnLoadRecentFile(iID - IDM_RECENTFILE1))
    ON_COMMAND(IDM_RECENTFILE4,               OnLoadRecentFile(iID - IDM_RECENTFILE1))
    ON_COMMAND(IDM_RECENTFILE5,               OnLoadRecentFile(iID - IDM_RECENTFILE1))
    ON_COMMAND(IDM_RECENTFILE6,               OnLoadRecentFile(iID - IDM_RECENTFILE1))
    ON_COMMAND(IDM_RECENTFILE7,               OnLoadRecentFile(iID - IDM_RECENTFILE1))
    ON_COMMAND(IDM_RECENTFILE8,               OnLoadRecentFile(iID - IDM_RECENTFILE1))
    ON_COMMAND(IDM_RECENTFILE9,               OnLoadRecentFile(iID - IDM_RECENTFILE1))
    ON_COMMAND(IDM_RECENTFILE10,              OnLoadRecentFile(iID - IDM_RECENTFILE1))

    //DataSource Menu

    //Session Menu

    //Command Menu

    //Rowset Menu
    case IDM_CREATE_ROWPOSITION:
      if(m_pCRootEnumerator)
      {
        CWaitCursor waitCursor;
        IUnknown* pIUnknown = NULL;

        //Create the Row Position object...
        hr = m_pCRootEnumerator->CreateInstance(NULL, CLSID_OLEDB_ROWPOSITIONLIBRARY, CLSCTX_ALL, IID_IUnknown, (IUnknown**)&pIUnknown);
        if(SUCCEEDED(hr))
          HandleObjectType(pCObject, pIUnknown, IID_IUnknown, eCRowPosition, 0, NULL, pCObject ? CREATE_INITIALIZE : 0);
        TRACE_RELEASE(pIUnknown, L"IUnknown");
      }
      return TRUE;

    case IDM_IROWPOS_INITIALIZE:
      if(pCRowPosition && pCRowPosition->m_pIRowPosition)
      {
        CWaitCursor waitCursor;
        IUnknown* pIUnknown = NULL;
        CMDIChild* pCMDIChild = (CMDIChild*)FindWindow(L"MDICHILD");
        if(pCMDIChild)
          pIUnknown = SOURCE_GETINTERFACE(pCMDIChild->GetObject(eCRowset), IUnknown);

        //Initialize RowPosition Object to use the current rowset object...
        pCRowPosition->Initialize(pIUnknown);
      }
      return TRUE;

    case IDM_IROWPOS_GETROWSET:
      if(pCRowPosition && pCRowPosition->m_pIRowPosition)
      {
        CInterfaceDlg interfaceDlg(IDD_INTERFACE, L"IRowPosition::GetRowset", IID_IRowset);
        if(interfaceDlg.DoModal(m_hWnd) == IDOK)
        {
          CWaitCursor waitCursor;

          //IRowPosition::GetRowset
          IUnknown* pIUnknown = NULL;

          //What type of object, let our helper determine...
          if(SUCCEEDED(hr = pCRowPosition->GetRowset(interfaceDlg.GetSelInterface(), &pIUnknown)))
            HandleObjectType(pCRowPosition, pIUnknown, interfaceDlg.GetSelInterface(), eCRowset, 0, NULL, CREATE_FINDWINDOW);
          TRACE_RELEASE(pIUnknown, L"IUnknown");
        }
      }
      return TRUE;

    case IDM_IROWPOS_CLEARROWPOSITION:
      if(pCRowPosition && pCRowPosition->m_pIRowPosition)
      {
        CWaitCursor waitCursor;

        XTEST(hr = pCRowPosition->m_pIRowPosition->ClearRowPosition());
        TRACE_METHOD(hr, L"IRowPosition::ClearRowPosition()");
      }
      return TRUE;

    case IDM_IROWPOS_SETROWPOSITION:
      if(pCRowPosition && pCRowPosition->m_pIRowPosition)
      {
        //Find the SelectedRow
        HROW hRow = NULL;
        HCHAPTER hChapter = NULL;
        CMDIChild* pCMDIChild = (CMDIChild*)FindWindow(L"MDICHILD");
        if(pCMDIChild)
        {
          pCMDIChild->m_pCDataGrid->GetSelectedRow(&hRow);
          CRowset* pCRowset = (CRowset*)pCMDIChild->GetObject(eCRowset);
          if(pCRowset)
            hChapter = pCRowset->m_hChapter;
        }

        CWaitCursor waitCursor;

        //Set RowPosition
        XTEST(hr = pCRowPosition->m_pIRowPosition->SetRowPosition(hChapter, hRow, DBPOSITION_OK));
        TRACE_METHOD(hr, L"IRowPosition::SetRowPosition(0x%p, 0x%p, %d)", hChapter, hRow, DBPOSITION_OK);
      }
      return TRUE;

    case IDM_IROWPOS_GETROWPOSITION:
      if(pCRowPosition && pCRowPosition->m_pIRowPosition)
      {
        CWaitCursor waitCursor;

        HCHAPTER hChapter = NULL;
        HROW hRow = NULL;
        DBPOSITIONFLAGS dwPositionFlag = DBPOSITION_OK;
        IRowset* pIRowset = NULL;

        //IRowPosition::GetRowPoisition
        XTEST(hr = pCRowPosition->m_pIRowPosition->GetRowPosition(&hChapter, &hRow, &dwPositionFlag));
        TRACE_METHOD(hr, L"IRowPosition::GetRowPosition(&0x%p, &0x%p, &%d)", hChapter, hRow, dwPositionFlag);

        //Now release the info...
        if(SUCCEEDED(hr) && hRow)
        {
          //The simplest is to just obtain the Rowset that this RowPosition object is
          //initialized to, and then call ReleaseRows...
          if(SUCCEEDED(pCRowPosition->GetRowset(IID_IRowset, (IUnknown**)&pIRowset)))
          {
            ULONG ulRefCount = 0;
            DBROWSTATUS ulRowStatus = 0;

            //IRowset::ReleaseRows
            hr = pIRowset->ReleaseRows(1, &hRow, NULL, &ulRefCount, &ulRowStatus);
            TRACE_METHOD(hr, L"IRowset::ReleaseRows(%lu, &0x%p, NULL, &%d, &%d)", 1, hRow, ulRefCount, ulRowStatus);

            //Release the rowset...
            TRACE_RELEASE(pIRowset, L"IUnknown");
          }
        }
      }
      return TRUE;

    //Row Menu

    //Error Menu
    ON_COMMAND(IDM_DISPLAYERRORINFO,            DisplayErrorInfo(S_OK))

    case IDM_GETERRORINFO:
    {
      IErrorInfo* pIErrorInfo = NULL;

      //Obtain an errorinfo...
      XTEST(hr = GetErrorInfo(0, &pIErrorInfo));
      TRACE_METHOD(hr, L"GetErrorInfo(0, &0x%p)", pIErrorInfo);

      if(SUCCEEDED(hr) && pIErrorInfo)
        HandleObjectType(NULL/*pCSource*/, pIErrorInfo, IID_IErrorInfo, eCError, 0/*cPropSets*/, NULL/*rgPropSets*/, 0/*dwFlags*/);
      TRACE_RELEASE(pIErrorInfo, L"IErrorInfo");
      break;
    }

    case IDM_SETERRORINFO:
    {
      XTEST(hr = SetErrorInfo(0, NULL));
      TRACE_METHOD(hr, L"SetErrorInfo(0, NULL)");
      break;
    }

    //IErrorInfo
    case IDM_ERRORINFO_GETDESCRIPTION:
      if(pCError)
      {
        //IErrorInfo::GetDescription
        CComBSTR bstrDescription;
        pCError->GetDescription(&bstrDescription);
      }
      return TRUE;

    case IDM_ERRORINFO_GETGUID:
      if(pCError)
      {
        GUID guid;

        //IErrorInfo::GetGUID
        pCError->GetGUID(&guid);
      }
      return TRUE;

    case IDM_ERRORINFO_GETHELPCONTEXT:
      if(pCError)
      {
        DWORD dwHelpContext = 0;

        //IErrorInfo::GetHelpContext
        pCError->GetHelpContext(&dwHelpContext);
      }
      return TRUE;

    case IDM_ERRORINFO_GETHELPFILE:
      if(pCError)
      {
        //IErrorInfo::GetHelpFile
        CComBSTR bstrHelpFile;
        pCError->GetHelpFile(&bstrHelpFile);
      }
      return TRUE;

    case IDM_ERRORINFO_GETSOURCE:
      if(pCError)
      {
        //IErrorInfo::GetSource
        CComBSTR bstrSource;
        pCError->GetSource(&bstrSource);
      }
      return TRUE;

    //IErrorRecords
    case IDM_ERRORRECORDS_GETRECORDCOUNT:
      if(pCError)
      {
        ULONG ulCount = 0;

        //IErrorRecords::GetRecordCount
        pCError->GetRecordCount(&ulCount);
      }
      return TRUE;

    case IDM_ERRORRECORDS_GETCUSTOMERROROBJECT:
      if(pCError)
      {
        CInterfaceDlg interfaceDlg(IDD_INTERFACE, L"IErrorRecords::GetCustomErrorObject", IID_ISQLErrorInfo);
        if(interfaceDlg.DoModal(m_hWnd) == IDOK)
        {
          CWaitCursor waitCursor;
          ULONG ulRecord = 0;

          //IErrorRecords::GetCustomErrorObject
          //What type of object, let our helper determine...
          if(SUCCEEDED(hr = pCError->GetCustomErrorObject(ulRecord, interfaceDlg.GetSelInterface(), interfaceDlg.ppUnknown())))
            HandleObjectType(pCError, interfaceDlg.pUnknown(), interfaceDlg.GetSelInterface(), eCCustomError, 0, NULL, 0/*dwFlags*/);
        }
      }
      return TRUE;

    case IDM_ERRORRECORDS_GETERRORINFO:
      if(pCError)
        DisplayDialog(IDD_ERRORRECORDS, m_hWnd, CMainWindow::ErrorRecordsProc, pCError);
      return TRUE;

    case IDM_SQLERRORINFO_GETSQLINFO:
    {
      CCustomError* pCCustomError = SOURCE_GETOBJECT(pCObject, CCustomError);
      if(pCCustomError && pCCustomError->m_pISQLErrorInfo)
      {
        CComBSTR bstr;
        LONG lNativeError = 0;

        //ISQLErrorInfo::GetSQLInfo
        hr = pCCustomError->GetSQLInfo(&bstr, &lNativeError);
      }
      return TRUE;
    }

    //Objects Menu

    //Tools Menu
    ON_COMMAND(IDM_OPTIONS,       OnOptions())
    ON_COMMAND(IDM_TRACEWINDOW,     OnTraceWindow())
    ON_COMMAND(IDM_OBJECTSWINDOW,   OnObjectsWindow())

    //Window Menu
    ON_COMMAND(IDM_CLOSEWINDOW,     OnDisconnect())

    ON_COMMAND(IDM_TILEHORIZONTAL,    OnTile(TRUE))
    ON_COMMAND(IDM_TILEVERTICAL,    OnTile(FALSE))
    ON_COMMAND(IDM_CASCADE,       OnCascade())
    ON_COMMAND(IDM_ARRANGEICONS,    OnArrangeIcons())
    ON_COMMAND(IDM_AUTOPOSITION,    OnAutoPosition())
    ON_COMMAND(IDM_CLOSEALL,      OnCloseAll())
    ON_COMMAND(IDM_NEXTWINDOW,      OnNextWindow(TRUE))
    ON_COMMAND(IDM_PREVWINDOW,      OnNextWindow(FALSE))

    //Help Menu
    ON_COMMAND(IDM_ABOUT,       OnAbout())
  };

  return CMDIFrameLite::OnCommand(iID, hWndCtrl);
}

void CMainWindow::OnConnect ( ) [virtual]

Definition at line 2174 of file cmainwindow.cpp.

{
  CWaitCursor waitCursor;

  //Bring up FullConnect dialog
  m_pCFullConnect->Display(m_hWnd);
  UpdateControls();
}

BOOL CMainWindow::OnCreate ( LPCREATESTRUCT lpCreateStruct ) [virtual]

Definition at line 114 of file cmainwindow.cpp.

{
  //Create the client area first...
  CMDIFrameLite::OnCreate(lpCreateStruct);

  //Load Saved Settings
  LoadSettings();

  //ToolBar
  const static TBBUTTON rgButtons[] =
  {
    { 0, IDM_FULLCONNECT,               TBSTATE_ENABLED,  TBSTYLE_BUTTON, 0L, 0},
    { 1, IDM_FULLDISCONNECT,              TBSTATE_ENABLED,  TBSTYLE_BUTTON, 0L, 0},
    { 0, 0,                       TBSTATE_ENABLED,  TBSTYLE_SEP,  0L, 0},
    { 2, IDM_IDBCREATESESSION_CREATESESSION,      TBSTATE_ENABLED,  TBSTYLE_BUTTON, 0L, 0},
    { 0, 0,                       TBSTATE_ENABLED,  TBSTYLE_SEP,  0L, 0},
    { 3, IDM_OPENROWSET,                TBSTATE_ENABLED,  TBSTYLE_BUTTON, 0L, 0},
    { 4, IDM_EXECUTE,                 TBSTATE_ENABLED,  TBSTYLE_BUTTON, 0L, 0},
    { 0, 0,                       TBSTATE_ENABLED,  TBSTYLE_SEP,  0L, 0},
    { 5, IDM_RESTARTPOSITION,             TBSTATE_ENABLED,  TBSTYLE_BUTTON, 0L, 0},
    { 6, IDM_REFRESH,                 TBSTATE_ENABLED,  TBSTYLE_BUTTON, 0L, 0},
    { 7, IDM_GETSCHEMAROWSET,             TBSTATE_ENABLED,  TBSTYLE_BUTTON, 0L, 0},
    { 0, 0,                       TBSTATE_ENABLED,  TBSTYLE_SEP,  0L, 0},
    { 8, IDM_SETDATA,                 TBSTATE_ENABLED,  TBSTYLE_BUTTON, 0L, 0},
    { 9, IDM_INSERTROW,                 TBSTATE_ENABLED,  TBSTYLE_BUTTON, 0L, 0},
    {10, IDM_DELETEROWS,                TBSTATE_ENABLED,  TBSTYLE_BUTTON, 0L, 0},
    { 0, 0,                       TBSTATE_ENABLED,  TBSTYLE_SEP,  0L, 0},
    {11, IDM_UPDATE,                  TBSTATE_ENABLED,  TBSTYLE_BUTTON, 0L, 0},
    {12, IDM_UNDO,                    TBSTATE_ENABLED,  TBSTYLE_BUTTON, 0L, 0},
    { 0, 0,                       TBSTATE_ENABLED,  TBSTYLE_SEP,  0L, 0},
  };
  m_CToolBar.Create(m_hWnd, ID_TOOLBAR, IDB_TOOLBAR, NUMELE(rgButtons), (TBBUTTON*)rgButtons);

  //Status Bar...
  m_CStatusBar.Create(m_hWnd, ID_STATUSBAR);
  m_CStatusBar.SetText(L"", STATUSBAR_TEXT, 0/*SBT_NOBORDERS*/);
  m_CStatusBar.SetText(L"", STATUSBAR_DESC, 0);

  //Controls
  m_pCListener    = new CListener();
  m_pCMDITrace    = new CMDITrace(this);
  m_pCMDIObjects    = new CMDIObjects(this);

  //See if we can load the new version RichEdit Controls
  //NOTE:  We always need to load the older one, since the Dialog Resource uses the old "RICHEDIT".
  //The newer one, we will try and use for the tracing window...
  m_hLibRichEdit20 = LoadLibrary("RICHED20.DLL");

  //All systems must have the RichEdit controls for RowsetViewer to work.
  //The resource, (built with the VC resource editor, hard codes to the 1.0 version = richedt32)
  //So dialogs will not appear if for some reason this dialog or its dependencies are missing...
  GETLASTERROR(m_hLibRichEdit10 = LoadLibrary("RICHED32.DLL"));

  //Objects
  m_pCFullConnect   = new CFullConnect(this);
  m_pCOptionsSheet  = new COptionsSheet;
  m_pCRootBinder    = new CBinder(this);
  m_pCRootEnumerator  = new CEnumerator(this);
  m_pCServiceComp   = new CServiceComp(this);

  //Deferred Objects
  m_pCDataLinks   = NULL;

  //Load Cursors
  m_hCurSizeNS = LoadCursor(NULL, MAKEINTRESOURCE(IDC_SIZENS));

  //Register this window for Drag and Drop capabilities...
  DragAcceptFiles(m_hWnd, TRUE/*fAccept*/);
  return TRUE;
}

void CMainWindow::OnCreateFileMoniker ( ) [virtual]

Definition at line 2235 of file cmainwindow.cpp.

{
  WCHAR wszFileName[MAX_QUERY_LEN] = {0};
  IMoniker* pIMoniker = NULL;
  IBindCtx* pIBindCtx = NULL;

  //Display Common Dialog to obtain File To Load...
  HRESULT hr = BrowseOpenFileName(GetAppLite()->m_hInstance, m_hWnd, L"CreateFileMoniker", wszFileName, MAX_QUERY_LEN, L"udl", L"Microsoft Data Link Files (.udl)\0*.udl\0All Files (*.*)\0*.*\0\0");
  if(SUCCEEDED(hr))
  {
    //CreateFileMoniker
    //TODO: Do we just want to create this as a tree object, and let the user play with
    //it or always just call BindToObject?
    XTEST(hr = CreateFileMoniker(wszFileName, &pIMoniker));
    TESTC(TRACE_METHOD(hr, L"CreateFileMoniker(\"%s\", &0x%p)", wszFileName, pIMoniker));

    //Need to ask for the riid...
    CInterfaceDlg interfaceDlg(IDD_INTERFACE, L"IMoniker::BindToObject", IID_IDBInitialize);
    if(interfaceDlg.DoModal(GetFocus()) == IDOK)
    {
      CWaitCursor waitCursor;

      //Setup BIND_OPTS
      BIND_OPTS2 BindOps2;
      BindOps2.cbStruct   = sizeof(BIND_OPTS2);
      BindOps2.grfFlags   = BIND_MAYBOTHERUSER;
      BindOps2.grfMode    = STGM_READWRITE;
      BindOps2.dwTickCountDeadline = 0;
      BindOps2.dwTrackFlags = 1;
      BindOps2.dwClassContext = CLSCTX_INPROC_SERVER;
      BindOps2.locale     = GetSystemDefaultLCID();
      BindOps2.pServerInfo  = NULL;

      //If this fails for some reason, we may be albe to still continue...
      hr = CreateBindCtx(0, &pIBindCtx);
      if(SUCCEEDED(hr) && pIBindCtx)
        hr = pIBindCtx->SetBindOptions(&BindOps2);

      //IMoniker::BindToObject
      XTEST(hr = pIMoniker->BindToObject(pIBindCtx, NULL, interfaceDlg.GetSelInterface(), (void**)interfaceDlg.ppUnknown()));
      TESTC(TRACE_METHOD(hr, L"IMoniker::BindToObject(0x%p, 0x%p, %s, &0x%p)", pIBindCtx, NULL, GetInterfaceName(interfaceDlg.GetSelInterface()), interfaceDlg.pUnknown()));

      //Now dump the resultant object into our tree...
      //Make a guess that its probably a datasource
      //NOTE: Can pontentially return other object types: (ie: CREATE_DETERMINE_TYPE)
      if(!HandleObjectType(NULL, interfaceDlg.pUnknown(), interfaceDlg.GetSelInterface(), eCDataSource, 0, NULL, CREATE_NEWWINDOW | CREATE_DETERMINE_TYPE | GetOptions()->m_dwCreateOpts))
        TESTC(hr = E_FAIL);
    }
  }

CLEANUP:
  TRACE_RELEASE(pIMoniker, L"IMoniker");
  TRACE_RELEASE(pIBindCtx, L"IBindCtx");
}

void CMainWindow::OnDataLinks ( ) [virtual]

Definition at line 2910 of file cmainwindow.cpp.

{
  //NOTE:  Creating Service Components is deferred.
  if(!m_pCDataLinks || !m_pCDataLinks->m_pIDBPromptInitialize)
  {
    //Deferred Object Creation
    if(!m_pCDataLinks)
      m_pCDataLinks = new CDataLinks(this);

    CWaitCursor waitCursor;
    m_pCDataLinks->Create(NULL);
  }

  //Not only create the object so it ends up in the tree, but actually
  //automatically bring up the dialog, so its not always a 2 step process...
  m_pCDataLinks->OnDefOperation();
}

BOOL CMainWindow::OnDestroy ( ) [virtual]

Reimplemented from CMDIFrameLite.

Definition at line 216 of file cmainwindow.cpp.

{
  //Save Settings
  SaveSettings();

  //Remove all MDIChildren....
  RemoveAllChildren();

  //Now remove the MDI Objects Tree window
  MDIDestroy(m_pCMDIObjects->m_hWnd);
  //Now remove the MDI Trace window
  MDIDestroy(m_pCMDITrace->m_hWnd);

  //Unregister this window for Drag and Drop capabilities...
  DragAcceptFiles(m_hWnd, FALSE/*fAccept*/);

  //Delegate
  return CMDIFrameLite::OnDestroy();
}

void CMainWindow::OnDisconnect ( ) [virtual]

Definition at line 3016 of file cmainwindow.cpp.

{
  CWaitCursor waitCursor;

  //Disconnect and destroy this window
  CMDIChild* pCMDIChild = (CMDIChild*)GetActiveWindow(L"MDICHILD");
  if(pCMDIChild)
  {
    //Tell the window to destroy itself
    MDIDestroy(pCMDIChild->m_hWnd);
    SAFE_DELETE(pCMDIChild);
    UpdateControls();
  }
}

BOOL CMainWindow::OnDropFiles ( HDROP hDrop ) [virtual]

Reimplemented from CWndLite.

Definition at line 253 of file cmainwindow.cpp.

{
  //Obtain the number of files...
  UINT cFiles = DragQueryFile(hDrop, (UINT)-1, NULL, 0);

  //For every file...
  for(ULONG iFile=0; iFile<cFiles; iFile++)
  {
    WCHAR wszFileName[_MAX_PATH];
    WCHAR wszExt[_MAX_EXT];

    if(IsUnicodeOS())
    {
      DragQueryFileW(hDrop, iFile, wszFileName, NUMELE(wszFileName));
    }
    else
    {
      CHAR szFileName[_MAX_PATH]={0};
      DragQueryFileA(hDrop, iFile, szFileName, NUMELE(szFileName));
      ConvertToWCHAR(szFileName, wszFileName, _MAX_PATH);
    }

    _wsplitpath(wszFileName, NULL, NULL, NULL, wszExt);
    {
      //Load the UDL file
      OnLoadStringFromStorage(wszFileName);
    }
  }

  return TRUE;
}

void CMainWindow::OnFindConnectionPoint | ( | CContainerBase * | pCCPointBase,
 |  | REFIID | riid |
 | ) |  |  | [virtual]

Definition at line 2039 of file cmainwindow.cpp.

{
  if(pCCPoint && pCCPoint->m_pIConnectionPointContainer)
  {
    //Display the Generic interface list...
    CInterfaceDlg interfaceDlg(IDD_INTERFACE, L"IConnectionPointContainer::FindConnectionPoint", riid);
    if(interfaceDlg.DoModal(GetFocus()) == IDOK)
    {
      CWaitCursor waitCursor;
      IConnectionPoint* pIConnectionPoint = NULL;

      //IConnectionPointContainer::FindConnectionPoint
      if(SUCCEEDED(pCCPoint->FindConnectionPoint(interfaceDlg.GetSelInterface(), &pIConnectionPoint)))
        HandleObjectType(pCCPoint, pIConnectionPoint, interfaceDlg.GetSelInterface(), eCConnectionPoint, 0, NULL, CREATE_NEWWINDOW_IFEXISTS);
      TRACE_RELEASE(pIConnectionPoint, L"IConnectionPoint");
    }
  }
}

LRESULT CMainWindow::OnFromScannerOrCamera ( ) [private]

Definition at line 296 of file MainWnd.cpp.

{
    HRESULT hr;

    m_bDisplayWaitCursor = TRUE;

    // Launch the get image dialog

    WiaWrap::CComPtrArray<IStream> ppStream;

    hr = WiaWrap::WiaGetImage(
        m_hMDIClient,
        StiDeviceTypeDefault,
        0,
        WIA_INTENT_NONE,
        NULL,
        NULL,
        NULL,
        NULL,
        NULL,
        &ppStream.Count(),
        &ppStream
    );

    m_bDisplayWaitCursor = FALSE;

    // If there was an error, display an error message box

  if (FAILED(hr))
    {
    TCHAR szError[DEFAULT_STRING_SIZE] = _T("");

    LoadString(g_hInstance, IDS_ERROR_GET_IMAGE_DLG, szError, COUNTOF(szError));

        MessageBox(m_hMDIClient, szError, NULL, MB_ICONHAND | MB_OK);
  }

    // Open a new window for each successfully transferred image

    for (int i = 0; i < ppStream.Count(); ++i)
    {
        CComPtr<CBitmapWnd> pBitmapWnd = new CBitmapWnd(ppStream[i]);

        if (pBitmapWnd != NULL)
        {
            m_nNumImages += 1;

            TCHAR szFormat[DEFAULT_STRING_SIZE] = _T("%d");

        LoadString(g_hInstance, IDS_BITMAP_WINDOW_TITLE, szFormat, COUNTOF(szFormat));

        TCHAR szTitle[DEFAULT_STRING_SIZE];

          _sntprintf(szTitle, COUNTOF(szTitle) - 1, szFormat, m_nNumImages);

            szTitle[COUNTOF(szTitle) - 1] = _T('\0');

            CreateWindowEx(
                WS_EX_MDICHILD,
                _T("BitmapWindow"),
                szTitle,
                WS_OVERLAPPEDWINDOW | WS_VISIBLE,
                CW_USEDEFAULT,
                CW_USEDEFAULT,
                CW_USEDEFAULT,
                CW_USEDEFAULT,
                m_hMDIClient,
                NULL,
                g_hInstance,
                pBitmapWnd
            );
        }
    }

    return 0;
}

void CMainWindow::OnGetConnectionInterface ( CConnectionPoint * pCConnectionPoint ) [virtual]

Definition at line 2089 of file cmainwindow.cpp.

{
  if(pCConnectionPoint && pCConnectionPoint->m_pIConnectionPoint)
  {
    CWaitCursor waitCursor;
    IID iid;

    pCConnectionPoint->GetConnectionInterface(&iid);
  }
}

void CMainWindow::OnGetDataSource ( ) [virtual]

Definition at line 2225 of file cmainwindow.cpp.

{
  //Default Operation for DataLinks is GetDataSource...
  m_pCServiceComp->OnDefOperation();
}

void CMainWindow::OnGetStatus ( CAsynchBase * pCAsynchBase ) [virtual]

Definition at line 2120 of file cmainwindow.cpp.

{
  if(pCAsynchBase && pCAsynchBase->m_pIDBAsynchStatus)
  {
    CWaitCursor waitCursor;

    DBCOUNTITEM ulProgress = 0;
    DBCOUNTITEM ulProgressMax = 0;
    DBASYNCHPHASE ulAsynchPhase = 0;
    LPOLESTR pwszStatusText = NULL;

    //IDBAsynchStatus::GetStatus
    XTEST(pCAsynchBase->GetStatus(NULL, DBASYNCHOP_OPEN, &ulProgress, &ulProgressMax, &ulAsynchPhase, &pwszStatusText));
    SAFE_FREE(pwszStatusText);
  }
}

void CMainWindow::OnInitialize ( CAsynchBase * pCAsynchBase ) [virtual]

Definition at line 2142 of file cmainwindow.cpp.

{
  if(pCAsynchBase && pCAsynchBase->m_pIDBInitialize)
  {
    CWaitCursor waitCursor;

    pCAsynchBase->Initialize();
    UpdateControls();
  }
}

BOOL CMainWindow::OnInitialUpdate ( ) [virtual]

Reimplemented from CWndLite.

Definition at line 190 of file cmainwindow.cpp.

{
  //Make sure the MDIClient area is sized correctly before displaying the
  //MDIChild windows...
  SIZE size = GetClientSize(m_hWnd);
  POINTS pts = { (SHORT)size.cx, (SHORT)size.cy };
  OnSize(0, pts);

  //Display the Objects Window
  //NOTE: We display the objects window first so we can use the
  //font from the tree with our output window...
  OnObjectsWindow();

  //Display the Trace Window
  OnTraceWindow();

  //Update the Controls
  UpdateControls();
  return TRUE;
}

BOOL CMainWindow::OnInitMenuPopup | ( | HMENU | hMenu,
 |  | UINT | uPos,
 |  | BOOL | fSysMenu |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 1520 of file cmainwindow.cpp.

{
  //NOTE: Having every menu item in all objects menu have unique ids, makes adding the same interface
  //to another object very painful, and causes manually editing the menu resources, making sure its
  //added to OnUpdateCommand for enabling/disabling the menu item, as well as adding another
  //case in OnCommand for the same interface!

  //Instead we have devised a design where we can intitally set the item data of every menu
  //to contain the object identifier.  This way we can always obtain the stored data of the menu
  //and instantly know the type of object this interface/method is called from.  Saves hundreads
  //of lines of code, and almost ellimiates all places to remember to add code to...

  //To do this we must first know what menu we have.  This is also a designed that all object
  //menu have as the first item an "IUnknown" menu, which contains as the first element
  //a IDM_*_ADDREF call, so we know exactly the object source...

  //Obtain the first SubMenu
  HMENU hSubMenu = GetSubMenu(hMenu, 0);
  if(hSubMenu)
  {
    SOURCE eSource = eInvalid;
    ULONG ulMenuID = GetMenuItemID(hSubMenu, 0);

    switch(ulMenuID)
    {
      case IDM_UNKNOWN_ADDREF:
        eSource = eCUnknown;
        break;
      case IDM_DATASOURCE_ADDREF:
        eSource = eCDataSource;
        break;
      case IDM_SESSION_ADDREF:
        eSource = eCSession;
        break;
      case IDM_COMMAND_ADDREF:
        eSource = eCCommand;
        break;
      case IDM_MULTIPLERESULTS_ADDREF:
        eSource = eCMultipleResults;
        break;
      case IDM_ROWSET_ADDREF:
        eSource = eCRowset;
        break;
      case IDM_ROW_ADDREF:
        eSource = eCRow;
        break;
      case IDM_STREAM_ADDREF:
        eSource = eCStream;
        break;
      case IDM_ENUMERATOR_ADDREF:
        eSource = eCEnumerator;
        break;
      case IDM_BINDER_ADDREF:
        eSource = eCBinder;
        break;
      case IDM_SERVICECOMP_ADDREF:
        eSource = eCServiceComp;
        break;
      case IDM_DATALINKS_ADDREF:
        eSource = eCDataLinks;
        break;
      case IDM_DATASET_ADDREF:
        eSource = eCDataset;
        break;
      case IDM_TRANSACTION_ADDREF:
        eSource = eCTransaction;
        break;
      case IDM_TRANSACTIONOPTIONS_ADDREF:
        eSource = eCTransactionOptions;
        break;
      case IDM_ERROR_ADDREF:
        eSource = eCError;
        break;
      case IDM_CUSTOMERROR_ADDREF:
        eSource = eCCustomError;
        break;
      case IDM_ROWPOS_ADDREF:
        eSource = eCRowPosition;
        break;
      case IDM_CONNECTIONPOINT_ADDREF:
        eSource = eCConnectionPoint;
        break;
      default:
  //      ASSERT(!"Unknown Menu?");
        break;
    };

    //Store this object as an data value of the menu and all sub menus...
    if(eSource != eInvalid)
      SetSubMenuData(hMenu, 0, TRUE/*fByPosition*/, eSource);

    CBase* pCBase     = NULL;

    //Now that we know what object the menu refers to, select
    //the corresponding object in the tree...
    CMDIChild* pCMDIChild = (CMDIChild*)GetActiveWindow(L"MDICHILD");
    if(pCMDIChild)
    {
      pCBase = pCMDIChild->GetObject(eSource);
      if(!pCBase)
      {
        //Try and work backwards...
        pCBase = pCMDIChild->GetObject();
        if(pCBase && (pCBase->GetObjectType() != eSource))
          pCBase = pCBase->GetParent(eSource);
      }
    }

    //If the MDIChild window is not active, try and guess which object this action
    //is for by the selected object in the tree...
    if(!pCBase)
    {
      //If the objects window is active
      CMDIObjects* pCMDIObjects = m_pCMDIObjects;
      if(pCMDIObjects)
      {
        //we know exactly what object this refers to...
        pCBase = pCMDIObjects->m_pCObjTree->GetSelectedObject();
        if(pCBase)
        {
          //If its not the correct type, then maybe its the parent...
          if(pCBase->GetObjectType() != eSource)
            pCBase = pCBase->GetParent(eSource);
        }
      }
    }

    //Maybe its part of the main window...
    if(!pCBase)
      pCBase = GetObject(eSource);

    //Select the object
    if(pCBase)
      m_pCMDIObjects->m_pCObjTree->SelectObject(pCBase);
  }

  //Delegate
  return CMDIFrameLite::OnInitMenuPopup(hMenu, uPos, fSysMenu);
}

void CMainWindow::OnLoadRecentConfig ( UINT iID ) [virtual]

Definition at line 2933 of file cmainwindow.cpp.

{
  if(m_pCFullConnect)
    m_pCFullConnect->LoadRecentConfig(iID);
}

void CMainWindow::OnLoadRecentFile ( UINT iID ) [virtual]

Definition at line 2943 of file cmainwindow.cpp.

{
  if(m_pCFullConnect)
    m_pCFullConnect->LoadRecentFile(iID);
}

void CMainWindow::OnLoadStringFromStorage ( WCHAR * pwszFileName = NULL ) [virtual]

Definition at line 2188 of file cmainwindow.cpp.

{
  CWaitCursor waitCursor;
  WCHAR wszFileName[MAX_QUERY_LEN] = {0};
  HRESULT hr = S_OK;

  //Display Common Dialog to obtain File To Load...
  if(!pwszFileName)
  {
    hr = BrowseOpenFileName(GetAppLite()->m_hInstance, m_hWnd, L"IDataInitialize::LoadStringFromStorage", wszFileName, MAX_QUERY_LEN, L"udl", L"Microsoft Data Link Files (.udl)\0*.udl\0All Files (*.*)\0*.*\0\0");
    pwszFileName = wszFileName;
  }

  //Load the UDL file
  if(SUCCEEDED(hr))
  {
    WCHAR* pwszInitString = NULL;

    //Now LoadStringFromStorage
    hr = m_pCServiceComp->LoadInitString(pwszFileName, &pwszInitString);
    if(SUCCEEDED(hr))
    {
      SAFE_FREE(m_pCServiceComp->m_pwszInitString);
      m_pCServiceComp->m_pwszInitString = pwszInitString;

      //Need to bring up the GetDataSource Dialog
      DisplayDialog(IDD_DATAINIT_GETDATASOURCE, m_hWnd, CMainWindow::GetDataSourceProc, m_pCServiceComp);
      UpdateControls();
    }
  }
}

BOOL CMainWindow::OnMenuSelect ( UINT uID ) [virtual]

Reimplemented from CWndLite.

Definition at line 1480 of file cmainwindow.cpp.

{
  //TODO - status text should probably also be for free...

  if(uID)
  {
    WCHAR wszBuffer[MAX_NAME_LEN+1] = {0};

    if(IsUnicodeOS())
    {
      //Load the string from the StringTable in the resource
      //To diaply the text associated with this menu item...
      LoadStringW(GetAppLite()->m_hInstance, uID, wszBuffer, MAX_NAME_LEN);
      m_CStatusBar.SetText(wszBuffer, STATUSBAR_TEXT, 0/*SBT_NOBORDERS*/);
    }
    else
    {
      CHAR szBuffer[MAX_NAME_LEN];

      LoadStringA(GetAppLite()->m_hInstance, uID, szBuffer, MAX_NAME_LEN);
      ConvertToWCHAR(szBuffer, wszBuffer, MAX_NAME_LEN);
      m_CStatusBar.SetText(wszBuffer, STATUSBAR_TEXT, 0/*SBT_NOBORDERS*/);
    }

  }
  else
  {
    //Otherwise we are using the Status Bar to indicate
    //the number of selected variations
    UpdateControls();
  }

  return TRUE;
}

void CMainWindow::OnNextWindow ( BOOL fNextWindow ) [virtual]

Definition at line 3079 of file cmainwindow.cpp.

{
  CWndLite* pCWndLite = GetActiveWindow();
  if(pCWndLite)
    SendMessage(m_hWndMDIClient, WM_MDINEXT, (WPARAM)pCWndLite->m_hWnd, fNextWindow ? 1 : 0);
}

void CMainWindow::OnObjectsWindow ( ) [virtual]

Definition at line 2994 of file cmainwindow.cpp.

{
  //Is the Objects window already active?
  CWndLite* pCWndLite = FindWindow(L"MDIOBJECTS");
  if(pCWndLite)
  {
    //Just activate the existing window...
    MDIActivate(pCWndLite->m_hWnd);
    pCWndLite->ShowWindow(SW_SHOWNORMAL);
  }
  else
  {
    //Create and Display the Window...
    m_pCMDIObjects->Create(m_hWndMDIClient, L"MDIOBJECTS", L"Objects", IDR_ROWSETVIEWER, ImageList_GetIcon(m_hImageList, IMAGE_OBJECTS, ILD_NORMAL));
  }
}

void CMainWindow::OnOptions ( ) [virtual]

Definition at line 2954 of file cmainwindow.cpp.

{
  if(m_pCFullConnect)
  {
    //Bring up the Property Sheet, and save if user pressed APPLY (OK)
    if(m_pCOptionsSheet->DoModal(m_hWnd) == IDOK)
    {
      CWaitCursor waitCursor;
      m_pCOptionsSheet->SaveOptions();
    }
  }
}

void CMainWindow::OnPromptDataSource ( BOOL fAdvanced = FALSE ) [virtual]

Definition at line 2295 of file cmainwindow.cpp.

{
  if(m_pCDataLinks && m_pCDataLinks->m_pIDBPromptInitialize)
  {
    if(fAdvanced)
    {
      //Bring up dialog to allow setting of all parameters...
      DisplayDialog(IDD_PROMPTDATASOURCE, m_hWnd, CMainWindow::PromptDataSourceProc, m_pCDataLinks);
    }
    else
    {
      //Default Operation for DataLinks is to Prompt...
      m_pCDataLinks->OnDefOperation();
    }

    UpdateControls();
  }
}

void CMainWindow::OnPromptFileName ( BOOL fAdvanced = FALSE ) [virtual]

Definition at line 2318 of file cmainwindow.cpp.

{
  if(m_pCDataLinks && m_pCDataLinks->m_pIDBPromptInitialize)
  {
    if(fAdvanced)
    {
      //Bring up dialog to allow setting of all parameters...
      m_pCSource = m_pCDataLinks;
      DisplayDialog(IDD_PROMPTFILENAME, m_hWnd, CMainWindow::PromptFileNameProc, m_pCDataLinks);
    }
    else
    {
      WCHAR* pwszSelectedFile = NULL;

      //Just display the PromptFileName dialog directly (common case)
      if(SUCCEEDED(m_pCDataLinks->PromptFileName(
                m_hWnd,               // hWndParent
                0,                  // dwPromptOptions
                      NULL,               // pwszInitialDirectory
                      NULL,               // pwszInitialFile
                      &pwszSelectedFile         // pwszSelectedFile
                )))
      {
        //Delegate, and Connect from the Selected File
        m_pCServiceComp->ConnectFromFile(pwszSelectedFile);
      }

      SAFE_FREE(pwszSelectedFile);
    }

    UpdateControls();
  }
}

void CMainWindow::OnQueryInterface ( CBase * pCBase ) [virtual]

Definition at line 1966 of file cmainwindow.cpp.

{
  if(pCBase && pCBase->m_pIUnknown)
  {
    CInterfaceDlg interfaceDlg(IDD_INTERFACE, L"IUnknown::QueryInterface", pCBase->GetDefaultInterface());
    if(interfaceDlg.DoModal(GetFocus()) == IDOK)
    {
      CWaitCursor waitCursor;

      //IUnknown::QueryInterface
      pCBase->ObjectQI(interfaceDlg.GetSelInterface(), interfaceDlg.ppUnknown());

      UpdateControls();
      if(pCBase->m_pCMDIChild)
        pCBase->m_pCMDIChild->UpdateControls();
    }
  }
}

void CMainWindow::OnRelease ( CBase * pCBase ) [virtual]

Definition at line 1890 of file cmainwindow.cpp.

{
  if(pCBase && pCBase->m_pIUnknown)
  {
    CWaitCursor waitCursor;

    //Release this object
    pCBase->ObjectRelease();
    UpdateControls();

    //Update the Window
    CMDIChild* pCMDIChild = pCBase->m_pCMDIChild;
    if(pCMDIChild)
    {
      //if there are no more objects remaining for this window,
      //there is no real reason to display it...
      if(!pCMDIChild->GetObject())
      {
        //No objects left, remove the window...
        MDIDestroy(pCMDIChild->m_hWnd);
        SAFE_DELETE(pCMDIChild);
      }
      else
      {
        //There is at least one object, just update the controls...
        pCMDIChild->UpdateControls();
      }
    }
  }
}

void CMainWindow::OnReleaseAll | ( | CBase * | pCBase,
 |  | BOOL | fChildren = FALSE |
 | ) |  |  | [virtual]

Definition at line 1926 of file cmainwindow.cpp.

{
  if(pCBase && pCBase->m_pIUnknown)
  {
    CWaitCursor waitCursor;

    //Release children
    if(fChildren)
      pCBase->ReleaseChildren();

    //Now, Release this object
    pCBase->ReleaseObject();
    UpdateControls();

    //Update the Window
    CMDIChild* pCMDIChild = pCBase->m_pCMDIChild;
    if(pCMDIChild)
    {
      //if there are no more objects remaining for this window,
      //there is no real reason to display it...
      CBase* pCBase = pCMDIChild->GetObject();
      if(!pCBase || pCBase->m_pCMDIChild!=pCMDIChild)
      {
        //No objects left, remove the window...
        MDIDestroy(pCMDIChild->m_hWnd);
        SAFE_DELETE(pCMDIChild);
      }
      else
      {
        //There is at least one object, just update the controls...
        pCMDIChild->UpdateControls();
      }
    }
  }
}

void CMainWindow::OnRootBinder ( ) [virtual]

Definition at line 2853 of file cmainwindow.cpp.

{
  //NOTE:  Creating the root binder is deferred.
  if(!m_pCRootBinder->m_pIBindResource)
  {
    CWaitCursor waitCursor;
    m_pCRootBinder->CreateBinder(CLSID_RootBinder);
  }

  //Not only create the object so it ends up in the tree, but actually
  //automatically bring up the dialog, so its not always a 2 step process...
  m_pCRootBinder->OnDefOperation();
}

void CMainWindow::OnRootEnumerator ( ) [virtual]

Definition at line 2872 of file cmainwindow.cpp.

{
  //NOTE:  Creating the Root Enumerator is deferred.
  if(!m_pCRootEnumerator->m_pISourcesRowset)
  {
    CWaitCursor waitCursor;
    m_pCRootEnumerator->Create(CLSID_OLEDB_ENUMERATOR);
  }

  //Not only create the object so it ends up in the tree, but actually
  //automatically bring up the dialog, so its not always a 2 step process...
  m_pCRootEnumerator->OnDefOperation();
}

void CMainWindow::OnServiceComponents ( ) [virtual]

Definition at line 2891 of file cmainwindow.cpp.

{
  //NOTE:  Creating Service Components is deferred.
  if(!m_pCServiceComp->m_pIDataInitialize)
  {
    CWaitCursor waitCursor;
    m_pCServiceComp->Create(NULL);
  }

  //Not only create the object so it ends up in the tree, but actually
  //automatically bring up the dialog, so its not always a 2 step process...
  OnGetDataSource();
}

BOOL CMainWindow::OnSize | ( | WPARAM | nType,
 |  | REFPOINTS | pts |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 1730 of file cmainwindow.cpp.

{
  ASSERT(m_CToolBar.m_hWnd);
  ASSERT(m_CStatusBar.m_hWnd);

  // calculate proper text height for tool and status bars
  SIZE sizeToolBar  = GetWindowSize(m_CToolBar.m_hWnd);
  SIZE sizeStatusBar  = GetWindowSize(m_CStatusBar.m_hWnd);

  switch(nType)
  {
    case SIZE_RESTORED:
    case SIZE_MAXIMIZED:
    {
      if(pts.x && pts.y)
      {
        //ToolBar
        MoveWindow(m_CToolBar.m_hWnd, 0, 0, pts.x, sizeToolBar.cy, /*FALSE*/TRUE);

        //StatusBar
        MoveWindow(m_CStatusBar.m_hWnd, 0, pts.y-sizeStatusBar.cy, pts.x, sizeStatusBar.cy, /*FALSE*/TRUE);

        //MDI Client Area
        MoveWindow(m_hWndMDIClient,   0, sizeToolBar.cy, pts.x, pts.y-sizeToolBar.cy-sizeStatusBar.cy, /*FALSE*/TRUE);
        return TRUE;
      }

      return FALSE;
    }
  };

  return FALSE;
}

void CMainWindow::OnSupportErrorInfo ( CBase * pCBase ) [virtual]

Definition at line 2016 of file cmainwindow.cpp.

{
  if(pCBase && pCBase->m_pISupportErrorInfo)
  {
    HRESULT hr = S_OK;

    CInterfaceDlg interfaceDlg(IDD_INTERFACE, L"ISupportErrorInfo::InterfaceSupportsErrorInfo", pCBase->GetDefaultInterface());
    if(interfaceDlg.DoModal(GetFocus()) == IDOK)
    {
      CWaitCursor waitCursor;

      //ISupportErrorInfo::InterfaceSupportsErrorInfo
      XTEST(hr = pCBase->m_pISupportErrorInfo->InterfaceSupportsErrorInfo(interfaceDlg.GetSelInterface()));
      TRACE_METHOD(hr, L"ISupportErrorInfo::InterfaceSupportsErrorInfo(%s)", GetInterfaceName(interfaceDlg.GetSelInterface()));
    }
  }
}

void CMainWindow::OnTile ( BOOL fHorizontal ) [virtual]

Definition at line 3036 of file cmainwindow.cpp.

{
  //let MDI Client tile the MDI children
  SendMessage(m_hWndMDIClient, WM_MDITILE, fHorizontal ? MDITILE_HORIZONTAL : MDITILE_VERTICAL, 0);
}

void CMainWindow::OnTraceWindow ( ) [virtual]

Definition at line 2972 of file cmainwindow.cpp.

{
  //Is the trace window already active?
  CWndLite* pCWndLite = FindWindow(L"MDITRACE");
  if(pCWndLite)
  {
    //Just activate the existing window...
    MDIActivate(pCWndLite->m_hWnd);
    pCWndLite->ShowWindow(SW_SHOWNORMAL);
  }
  else
  {
    //Create and Display the Window...
    m_pCMDITrace->Create(m_hWndMDIClient, L"MDITRACE", L"Output", IDR_ROWSETVIEWER, ImageList_GetIcon(m_hImageList, IMAGE_FORM, ILD_NORMAL));
  }
}

void CMainWindow::OnUnadvise ( CConnectionPoint * pCConnectionPoint ) [virtual]

Definition at line 2076 of file cmainwindow.cpp.

{
  if(pCConnectionPoint && pCConnectionPoint->m_pIConnectionPoint)
  {
    m_pCListener->Unadvise(pCConnectionPoint->m_pIConnectionPoint, &pCConnectionPoint->m_dwCookie);
  }
}

void CMainWindow::OnUninitialize ( CAsynchBase * pCAsynchBase ) [virtual]

Definition at line 2158 of file cmainwindow.cpp.

{
  if(pCAsynchBase && pCAsynchBase->m_pIDBInitialize)
  {
    CWaitCursor waitCursor;

    pCAsynchBase->Uninitialize();
    UpdateControls();
  }
}

BOOL CMainWindow::OnUpdateCommand | ( | HMENU | hMenu,
 |  | UINT | nID,
 |  | DWORD * | pdwFlags |
 | ) |  |  | [virtual]

Reimplemented from CMDIFrameLite.

Definition at line 290 of file cmainwindow.cpp.

{
  //Determine the source object for this menu
  SOURCE eSource = (SOURCE)GetMenuData(hMenu, 0, TRUE/*fByPosition*/);

  //Is there an active object, make sure its the same type as the selected object
  CBase*  pCObject  = m_pCMDIObjects->m_pCObjTree->GetSelectedObject();
  if(pCObject && pCObject->GetObjectType() != eSource)
    pCObject = NULL;

  //Reset Resent Configurations
  if(GetMenuItemID(hMenu, 0)==IDM_RECENTCONFIG1)
  {
    WCHAR wszBuffer[MAX_NAME_LEN+10];
    CHAR  szBuffer[MAX_NAME_LEN+10];
    CList<WCHAR*,WCHAR*>* pCList = &m_pCFullConnect->m_listConfigs;

    ASSERT(pCList);
    LONG cRecentConfigs = pCList->GetCount();

    //Remove all menu items
    if(cRecentConfigs)
    {
      INT iMenuItems = GetMenuItemCount(hMenu);
      for(INT i=0; i<iMenuItems; i++)
        DeleteMenu(hMenu, 0, MF_BYPOSITION);
    }

    //Display all Recent Configs
    for(LONG i=0; i<cRecentConfigs; i++)
    {
      StringFormat(wszBuffer, NUMELE(wszBuffer), L"&%d - %s", i+1, pCList->GetAt(pCList->FindIndex(i)));
      ConvertToMBCS(wszBuffer, szBuffer, NUMELE(szBuffer));
      AppendMenu(hMenu, MF_STRING, IDM_RECENTCONFIG1 + i, szBuffer);
    }
  }

  //Reset Resent Files
  if(GetMenuItemID(hMenu, 0)==IDM_RECENTFILE1)
  {
    CHAR szBuffer[MAX_NAME_LEN+10];
    WCHAR wszBuffer[MAX_NAME_LEN+10];
    CList<WCHAR*,WCHAR*>* pCList = &m_pCFullConnect->m_listFiles;

    ASSERT(pCList);
    LONG cRecentFiles = pCList->GetCount();

    //Remove all menu items
    if(cRecentFiles)
    {
      INT iMenuItems = GetMenuItemCount(hMenu);
      for(INT i=0; i<iMenuItems; i++)
        DeleteMenu(hMenu, 0, MF_BYPOSITION);
    }

    //Display all Recent Files
    for(LONG i=0; i<cRecentFiles; i++)
    {
      StringFormat(wszBuffer, NUMELE(wszBuffer), L"&%d - %s", i+1, pCList->GetAt(pCList->FindIndex(i)));
      ConvertToMBCS(wszBuffer, szBuffer, NUMELE(szBuffer));
      AppendMenu(hMenu, MF_STRING, IDM_RECENTFILE1 + i, szBuffer);
    }
  }

  switch(nID)
  {
    ///////////////////////////////////////////////////////////////////
    // File Menu
    //
    ///////////////////////////////////////////////////////////////////
    ON_COMMAND_UI_ENABLED(IDM_FULLCONNECT,                  TRUE)
    ON_COMMAND_UI_ENABLED(IDM_FULLDISCONNECT,               GetActiveWindow(L"MDICHILD") ? TRUE : FALSE)
    //----------------------------
    ON_COMMAND_UI_ENABLED(IDM_CREATE_ROOTBINDER,              TRUE)
    ON_COMMAND_UI_ENABLED(IDM_CREATE_ROOTENUMERATOR,            TRUE)
    ON_COMMAND_UI_ENABLED(IDM_CREATE_SERVICECOMPONENTS,           TRUE)
    ON_COMMAND_UI_ENABLED(IDM_CREATE_DATALINKS,               TRUE)
    //----------------------------
    ON_COMMAND_UI_ENABLED(IDM_RECENTCONFIG1,                m_pCFullConnect->m_listConfigs.GetCount())
    ON_COMMAND_UI_ENABLED(IDM_RECENTCONFIG2,                m_pCFullConnect->m_listConfigs.GetCount())
    ON_COMMAND_UI_ENABLED(IDM_RECENTCONFIG3,                m_pCFullConnect->m_listConfigs.GetCount())
    ON_COMMAND_UI_ENABLED(IDM_RECENTCONFIG4,                m_pCFullConnect->m_listConfigs.GetCount())
    ON_COMMAND_UI_ENABLED(IDM_RECENTCONFIG5,                m_pCFullConnect->m_listConfigs.GetCount())
    ON_COMMAND_UI_ENABLED(IDM_RECENTCONFIG6,                m_pCFullConnect->m_listConfigs.GetCount())
    ON_COMMAND_UI_ENABLED(IDM_RECENTCONFIG7,                m_pCFullConnect->m_listConfigs.GetCount())
    ON_COMMAND_UI_ENABLED(IDM_RECENTCONFIG8,                m_pCFullConnect->m_listConfigs.GetCount())
    ON_COMMAND_UI_ENABLED(IDM_RECENTCONFIG9,                m_pCFullConnect->m_listConfigs.GetCount())
    ON_COMMAND_UI_ENABLED(IDM_RECENTCONFIG10,               m_pCFullConnect->m_listConfigs.GetCount())
    //----------------------------
    ON_COMMAND_UI_ENABLED(IDM_RECENTFILE1,                  m_pCFullConnect->m_listFiles.GetCount())
    ON_COMMAND_UI_ENABLED(IDM_RECENTFILE2,                  m_pCFullConnect->m_listFiles.GetCount())
    ON_COMMAND_UI_ENABLED(IDM_RECENTFILE3,                  m_pCFullConnect->m_listFiles.GetCount())
    ON_COMMAND_UI_ENABLED(IDM_RECENTFILE4,                  m_pCFullConnect->m_listFiles.GetCount())
    ON_COMMAND_UI_ENABLED(IDM_RECENTFILE5,                  m_pCFullConnect->m_listFiles.GetCount())
    ON_COMMAND_UI_ENABLED(IDM_RECENTFILE6,                  m_pCFullConnect->m_listFiles.GetCount())
    ON_COMMAND_UI_ENABLED(IDM_RECENTFILE7,                  m_pCFullConnect->m_listFiles.GetCount())
    ON_COMMAND_UI_ENABLED(IDM_RECENTFILE8,                  m_pCFullConnect->m_listFiles.GetCount())
    ON_COMMAND_UI_ENABLED(IDM_RECENTFILE9,                  m_pCFullConnect->m_listFiles.GetCount())
    ON_COMMAND_UI_ENABLED(IDM_RECENTFILE10,                 m_pCFullConnect->m_listFiles.GetCount())
    //----------------------------
    ON_COMMAND_UI_ENABLED(IDM_EXIT,                     TRUE)

    ///////////////////////////////////////////////////////////////////
    // Unknown
    //
    ///////////////////////////////////////////////////////////////////
    ON_COMMAND_UI_ENABLED(IDM_UNKNOWN_ADDREF,               SOURCE_GETINTERFACE(pCObject, IUnknown))
    ON_COMMAND_UI_ENABLED(IDM_IUNKNOWN_RELEASE,               SOURCE_GETINTERFACE(pCObject, IUnknown))
    ON_COMMAND_UI_ENABLED(IDM_IUNKNOWN_QUERYINTERFACE,            SOURCE_GETINTERFACE(pCObject, IUnknown))
    ON_COMMAND_UI_ENABLED(IDM_IUNKNOWN_AUTOQI,                SOURCE_GETINTERFACE(pCObject, IUnknown))
    ON_COMMAND_UI_ENABLED(IDM_IUNKNOWN_RELEASEALL,              SOURCE_GETINTERFACE(pCObject, IUnknown))
    ON_COMMAND_UI_ENABLED(IDM_IUNKNOWN_RELEASECHILDREN,           SOURCE_GETINTERFACE(pCObject, IUnknown))
    //----------------------------
    ON_COMMAND_UI_ENABLED(IDM_ISUPPORTERRORINFO,              SOURCE_GETINTERFACE(pCObject, ISupportErrorInfo))

    ///////////////////////////////////////////////////////////////////
    // DataSource
    //
    ///////////////////////////////////////////////////////////////////
    ON_COMMAND_UI_ENABLED(IDM_DATASOURCE_ADDREF,              SOURCE_GETINTERFACE(pCObject, IUnknown))
    //----------------------------
    ON_COMMAND_UI_ENABLED(IDM_IDBINITIALIZE_INITIALIZE,           SOURCE_GETINTERFACE(pCObject, IDBInitialize))
    ON_COMMAND_UI_ENABLED(IDM_IDBINITIALIZE_UNINITIALIZE,         SOURCE_GETINTERFACE(pCObject, IDBInitialize))
    ON_COMMAND_UI_ENABLED(IDM_IDBCREATESESSION_CREATESESSION,       SOURCE_GETINTERFACE(pCObject, IDBCreateSession))
    ON_COMMAND_UI_ENABLED(IDM_IDBPROPERTIES_GETPROPERTYINFO,        SOURCE_GETINTERFACE(pCObject, IDBProperties))
    ON_COMMAND_UI_ENABLED(IDM_IDBPROPERTIES_GETPROPERTIES,          SOURCE_GETINTERFACE(pCObject, IDBProperties))
    ON_COMMAND_UI_ENABLED(IDM_IDBPROPERTIES_SETPROPERTIES,          SOURCE_GETINTERFACE(pCObject, IDBProperties))
    ON_COMMAND_UI_ENABLED(IDM_IPERSIST_GETCLASSID,              SOURCE_GETINTERFACE(pCObject, IPersist))
    //----------------------------
    ON_COMMAND_UI_ENABLED(IDM_ICPC_FINDCONNECTIONPOINT,           SOURCE_GETINTERFACE(pCObject, IConnectionPointContainer))
    ON_COMMAND_UI_ENABLED(IDM_ICPC_ENUMCONNECTIONPOINTS,          FALSE)
    ON_COMMAND_UI_ENABLED(IDM_IDBASYNCHSTATUS_ABORT,            SOURCE_GETINTERFACE(pCObject, IDBAsynchStatus))
    ON_COMMAND_UI_ENABLED(IDM_IDBASYNCHSTATUS_GETSTATUS,          SOURCE_GETINTERFACE(pCObject, IDBAsynchStatus))
    ON_COMMAND_UI_ENABLED(IDM_IDATASOURCEADMIN_CREATEDATASOURCE,      SOURCE_GETINTERFACE(pCObject, IDBDataSourceAdmin))
    ON_COMMAND_UI_ENABLED(IDM_IDATASOURCEADMIN_DESTROYDATASOURCE,     SOURCE_GETINTERFACE(pCObject, IDBDataSourceAdmin))
    ON_COMMAND_UI_ENABLED(IDM_IDATASOURCEADMIN_GETCREATIONPROPERTIES,   SOURCE_GETINTERFACE(pCObject, IDBDataSourceAdmin))
    ON_COMMAND_UI_ENABLED(IDM_IDATASOURCEADMIN_MODIFYDATASOURCE,      SOURCE_GETINTERFACE(pCObject, IDBDataSourceAdmin))
    ON_COMMAND_UI_ENABLED(IDM_IDBINFO_GETKEYWORDS,              SOURCE_GETINTERFACE(pCObject, IDBInfo))
    ON_COMMAND_UI_ENABLED(IDM_IDBINFO_GETLITERALINFO,           SOURCE_GETINTERFACE(pCObject, IDBInfo))
    ON_COMMAND_UI_ENABLED(IDM_IPERSISTFILE_LOAD,              SOURCE_GETINTERFACE(pCObject, IPersistFile))
    ON_COMMAND_UI_ENABLED(IDM_IPERSISTFILE_SAVE,              SOURCE_GETINTERFACE(pCObject, IPersistFile))
    ON_COMMAND_UI_ENABLED(IDM_IPERSISTFILE_SAVECOMPLETED,         SOURCE_GETINTERFACE(pCObject, IPersistFile))
    ON_COMMAND_UI_ENABLED(IDM_IPERSISTFILE_GETCURFILE,            SOURCE_GETINTERFACE(pCObject, IPersistFile))
    ON_COMMAND_UI_ENABLED(IDM_IPERSISTFILE_ISDIRTY,             SOURCE_GETINTERFACE(pCObject, IPersistFile))
    //----------------------------
    ON_COMMAND_UI_ENABLED(IDM_IGETPOOL_GETPOOL,               FALSE)
    ON_COMMAND_UI_ENABLED(IDM_IGETPOOL_GETPOOLSTATE,            FALSE)
    ON_COMMAND_UI_ENABLED(IDM_ISERVICEPROVIDER,               SOURCE_GETINTERFACE(pCObject, IServiceProvider))
    //----------------------------

    ///////////////////////////////////////////////////////////////////
    // Session
    //
    ///////////////////////////////////////////////////////////////////
    ON_COMMAND_UI_ENABLED(IDM_SESSION_ADDREF,               SOURCE_GETINTERFACE(pCObject, IUnknown))
    //----------------------------
    ON_COMMAND_UI_ENABLED(IDM_GETDATASOURCE,                SOURCE_GETINTERFACE(pCObject, IGetDataSource))
    ON_COMMAND_UI_ENABLED(IDM_OPENROWSET,                 SOURCE_GETINTERFACE(pCObject, IOpenRowset))
    ON_COMMAND_UI_ENABLED(IDM_ISESSIONPROPERTIES_GETPROPERTIES,       SOURCE_GETINTERFACE(pCObject, ISessionProperties))
    ON_COMMAND_UI_ENABLED(IDM_ISESSIONPROPERTIES_SETPROPERTIES,       SOURCE_GETINTERFACE(pCObject, ISessionProperties))
    //----------------------------
    ON_COMMAND_UI_ENABLED(IDM_IDBCREATECOMMAND_CREATECOMMAND,       SOURCE_GETINTERFACE(pCObject, IDBCreateCommand))
    ON_COMMAND_UI_ENABLED(IDM_GETSCHEMAS,                 SOURCE_GETINTERFACE(pCObject, IDBSchemaRowset))
    ON_COMMAND_UI_ENABLED(IDM_GETSCHEMAROWSET,                SOURCE_GETINTERFACE(pCObject, IDBSchemaRowset))
    ON_COMMAND_UI_ENABLED(IDM_INDEX_CREATEINDEX,              SOURCE_GETINTERFACE(pCObject, IIndexDefinition))
    ON_COMMAND_UI_ENABLED(IDM_INDEX_DROPINDEX,                SOURCE_GETINTERFACE(pCObject, IIndexDefinition))
    ON_COMMAND_UI_ENABLED(IDM_INDEX_ALTERINDEX,               SOURCE_GETINTERFACE(pCObject, IAlterIndex))
    ON_COMMAND_UI_ENABLED(IDM_TABLE_CREATETABLE,              SOURCE_GETINTERFACE(pCObject, ITableDefinition))
    ON_COMMAND_UI_ENABLED(IDM_TABLE_ADDCOLUMN,                SOURCE_GETINTERFACE(pCObject, ITableDefinition))
    ON_COMMAND_UI_ENABLED(IDM_TABLE_DROPCOLUMN,               SOURCE_GETINTERFACE(pCObject, ITableDefinition))
    ON_COMMAND_UI_ENABLED(IDM_TABLE_DROPTABLE,                SOURCE_GETINTERFACE(pCObject, ITableDefinition))
    ON_COMMAND_UI_ENABLED(IDM_TABLE_CREATETABLEWITHCONSTRAINTS,       NULL); //SOURCE_GETINTERFACE(pCObject, ITableDefinitionWithConstraints))
    ON_COMMAND_UI_ENABLED(IDM_TABLE_ADDCONSTRAINT,              SOURCE_GETINTERFACE(pCObject, ITableDefinitionWithConstraints))
    ON_COMMAND_UI_ENABLED(IDM_TABLE_DROPCONSTRAINT,             SOURCE_GETINTERFACE(pCObject, ITableDefinitionWithConstraints))
    ON_COMMAND_UI_ENABLED(IDM_TABLE_ALTERTABLE,               SOURCE_GETINTERFACE(pCObject, IAlterTable))
    ON_COMMAND_UI_ENABLED(IDM_TABLE_ALTERCOLUMN,              SOURCE_GETINTERFACE(pCObject, IAlterTable))
    ON_COMMAND_UI_ENABLED(IDM_ITRANSACTIONLOCAL_GETOPTIONSOBJECT,     SOURCE_GETINTERFACE(pCObject, ITransactionLocal))
    ON_COMMAND_UI_ENABLED(IDM_ITRANSACTIONLOCAL_STARTTRANSACTION,     SOURCE_GETINTERFACE(pCObject, ITransactionLocal))
    ON_COMMAND_UI_ENABLED(IDM_ITRANSACTIONOBJECT_GETTRANSACTIONOBJECT,    SOURCE_GETINTERFACE(pCObject, ITransactionObject))
    ON_COMMAND_UI_ENABLED(IDM_ITRANSACTIONJOIN_GETOPTIONSOBJECT,      SOURCE_GETINTERFACE(pCObject, ITransactionJoin))
    ON_COMMAND_UI_ENABLED(IDM_ITRANSACTIONJOIN_JOINTRANSACTION,       SOURCE_GETINTERFACE(pCObject, ITransactionJoin))
    ON_COMMAND_UI_ENABLED(IDM_ITRANSACTIONJOIN_RELEASETRANSACTION,      SOURCE_GETINTERFACE(pCObject, ITransactionJoin))
#ifdef MTSTXN
    ON_COMMAND_UI_ENABLED(IDM_ITRANSACTIONDISPENSOR_BEGINTRANSACTION,   SOURCE_GETINTERFACE(pCObject, ITransactionJoin))
#else  //MTSTXN
    ON_COMMAND_UI_ENABLED(IDM_ITRANSACTIONDISPENSOR_BEGINTRANSACTION,   FALSE)
#endif //MTSTXN
    //----------------------------
    //----------------------------

    ////////////////////////////////////////////////////////////////
    // Command
    //
    ////////////////////////////////////////////////////////////////
    ON_COMMAND_UI_ENABLED(IDM_COMMAND_ADDREF,               SOURCE_GETINTERFACE(pCObject, IUnknown))
    //----------------------------
    ON_COMMAND_UI_ENABLED(IDM_IACCESSOR_GETBINDINGS,            SOURCE_GETINTERFACE(pCObject, IAccessor))
    ON_COMMAND_UI_ENABLED(IDM_IACCESSOR_ADDREFACCESSOR,           SOURCE_GETINTERFACE(pCObject, IAccessor))
    ON_COMMAND_UI_ENABLED(IDM_IACCESSOR_RELEASEACCESSOR,          SOURCE_GETINTERFACE(pCObject, IAccessor))
    ON_COMMAND_UI_ENABLED(IDM_IACCESSOR_CREATEACCESSOR,           SOURCE_GETINTERFACE(pCObject, IAccessor))
    ON_COMMAND_UI_ENABLED(IDM_ICOLUMNSINFO_GETCOLUMNINFO,         SOURCE_GETINTERFACE(pCObject, IColumnsInfo))
    ON_COMMAND_UI_ENABLED(IDM_ICOLUMNSINFO_MAPCOLUMNIDS,          FALSE)
    ON_COMMAND_UI_ENABLED(IDM_EXECUTE,                    SOURCE_GETINTERFACE(pCObject, ICommand))
    ON_COMMAND_UI_ENABLED(IDM_COMMAND_CANCEL,               SOURCE_GETINTERFACE(pCObject, ICommand))
    ON_COMMAND_UI_ENABLED(IDM_COMMAND_GETDBSESSION,             SOURCE_GETINTERFACE(pCObject, ICommand))
    ON_COMMAND_UI_ENABLED(IDM_COMMAND_GETPROPERTIES,            SOURCE_GETINTERFACE(pCObject, ICommandProperties))
    ON_COMMAND_UI_ENABLED(IDM_COMMAND_SETPROPERTIES,            SOURCE_GETINTERFACE(pCObject, ICommandProperties))
    ON_COMMAND_UI_ENABLED(IDM_SETCOMMANDTEXT,               SOURCE_GETINTERFACE(pCObject, ICommandText))
    ON_COMMAND_UI_ENABLED(IDM_GETCOMMANDTEXT,               SOURCE_GETINTERFACE(pCObject, ICommandText))
    ON_COMMAND_UI_ENABLED(IDM_SETCOMMANDSTREAM,               SOURCE_GETINTERFACE(pCObject, ICommandStream))
    ON_COMMAND_UI_ENABLED(IDM_GETCOMMANDSTREAM,               SOURCE_GETINTERFACE(pCObject, ICommandStream))
    ON_COMMAND_UI_ENABLED(IDM_COMMANDTEXT_EXECUTE,              SOURCE_GETINTERFACE(pCObject, ICommandText))
    ON_COMMAND_UI_ENABLED(IDM_ICONVERTTYPE_CANCONVERT,            SOURCE_GETINTERFACE(pCObject, IConvertType))
    //----------------------------
    ON_COMMAND_UI_ENABLED(IDM_ICOLUMNSROWSET_GETCOLUMNSROWSET,        SOURCE_GETINTERFACE(pCObject, IColumnsRowset))
    ON_COMMAND_UI_ENABLED(IDM_ICOLUMNSROWSET_GETAVAILABLECOLUMNS,     FALSE)
    ON_COMMAND_UI_ENABLED(IDM_COMMANDPREPARE,               SOURCE_GETINTERFACE(pCObject, ICommandPrepare))
    ON_COMMAND_UI_ENABLED(IDM_COMMANDUNPREPARE,               SOURCE_GETINTERFACE(pCObject, ICommandPrepare))
    ON_COMMAND_UI_ENABLED(IDM_COMMANDPERSIST_DELETECOMMAND,         SOURCE_GETINTERFACE(pCObject, ICommandPersist))
    ON_COMMAND_UI_ENABLED(IDM_COMMANDPERSIST_GETCURRENTCOMMAND,       SOURCE_GETINTERFACE(pCObject, ICommandPersist))
    ON_COMMAND_UI_ENABLED(IDM_COMMANDPERSIST_LOADCOMMAND,         SOURCE_GETINTERFACE(pCObject, ICommandPersist))
    ON_COMMAND_UI_ENABLED(IDM_COMMANDPERSIST_SAVECOMMAND,         SOURCE_GETINTERFACE(pCObject, ICommandPersist))
    ON_COMMAND_UI_ENABLED(IDM_GETPARAMETERINFO,               SOURCE_GETINTERFACE(pCObject, ICommandWithParameters))
    ON_COMMAND_UI_ENABLED(IDM_SETPARAMETERINFO,               SOURCE_GETINTERFACE(pCObject, ICommandWithParameters))
    ON_COMMAND_UI_ENABLED(IDM_MAPPARAMETERNAMES,              FALSE)
    //----------------------------
    //----------------------------
    ON_COMMAND_UI_ENABLED(IDM_COMMAND_CLEARCOMMAND,             SOURCE_GETINTERFACE(pCObject, ICommand))

    ///////////////////////////////////////////////////////////////////
    // Rowset
    //
    ///////////////////////////////////////////////////////////////////
    ON_COMMAND_UI_ENABLED(IDM_ROWSET_ADDREF,                SOURCE_GETINTERFACE(pCObject, IUnknown))
    //----------------------------
    ON_COMMAND_UI_ENABLED(IDM_GETDATA,                    SOURCE_GETINTERFACE(pCObject, IRowset))
    ON_COMMAND_UI_ENABLED(IDM_GETNEXTROWS,                  SOURCE_GETINTERFACE(pCObject, IRowset))
    ON_COMMAND_UI_ENABLED(IDM_RELEASEROWS,                  SOURCE_GETINTERFACE(pCObject, IRowset))
    ON_COMMAND_UI_ENABLED(IDM_ADDREFROWS,                 SOURCE_GETINTERFACE(pCObject, IRowset))
    ON_COMMAND_UI_ENABLED(IDM_REFRESH,                    SOURCE_GETINTERFACE(pCObject, IRowset))
    ON_COMMAND_UI_ENABLED(IDM_RESTARTPOSITION,                SOURCE_GETINTERFACE(pCObject, IRowset))
    ON_COMMAND_UI_ENABLED(IDM_RELEASEALLROWS,               SOURCE_GETINTERFACE(pCObject, IRowset))

    ON_COMMAND_UI_ENABLED(IDM_IROWSET_GETPROPERTIES,            SOURCE_GETINTERFACE(pCObject, IRowsetInfo))
    ON_COMMAND_UI_ENABLED(IDM_GETSPECIFICATION,               SOURCE_GETINTERFACE(pCObject, IRowsetInfo))
    ON_COMMAND_UI_ENABLED(IDM_GETREFERENCEDROWSET,              SOURCE_GETINTERFACE(pCObject, IRowsetInfo))
    //----------------------------
    ON_COMMAND_UI_ENABLED(IDM_INSERTROW,                  SOURCE_GETINTERFACE(pCObject, IRowsetChange))
    ON_COMMAND_UI_ENABLED(IDM_DELETEROWS,                 SOURCE_GETINTERFACE(pCObject, IRowsetChange))
    ON_COMMAND_UI_ENABLED(IDM_SETDATA,                    SOURCE_GETINTERFACE(pCObject, IRowsetChange))
    ON_COMMAND_UI_ENABLED(IDM_IROWSETFIND_FINDNEXTROW,            SOURCE_GETINTERFACE(pCObject, IRowsetFind))
    ON_COMMAND_UI_ENABLED(IDM_IROWSETINDENTITY_ISSAMEROW,         SOURCE_GETINTERFACE(pCObject, IRowsetIdentity))
    ON_COMMAND_UI_ENABLED(IDM_IROWSETLOCATE_GETDATA,            SOURCE_GETINTERFACE(pCObject, IRowsetLocate))
    ON_COMMAND_UI_ENABLED(IDM_IROWSETLOCATE_COMPARE,            SOURCE_GETINTERFACE(pCObject, IRowsetLocate))
    ON_COMMAND_UI_ENABLED(IDM_IROWSETLOCATE_GETROWSAT,            SOURCE_GETINTERFACE(pCObject, IRowsetLocate))
    ON_COMMAND_UI_ENABLED(IDM_IROWSETLOCATE_GETROWSBYBOOKMARK,        SOURCE_GETINTERFACE(pCObject, IRowsetLocate))
    ON_COMMAND_UI_ENABLED(IDM_IROWSETLOCATE_HASH,             SOURCE_GETINTERFACE(pCObject, IRowsetLocate))
    ON_COMMAND_UI_ENABLED(IDM_IROWSETBOOKMARK_POSITIONONBOOKMARK,     SOURCE_GETINTERFACE(pCObject, IRowsetBookmark))
    ON_COMMAND_UI_ENABLED(IDM_GETVISIBLEDATA,               SOURCE_GETINTERFACE(pCObject, IRowsetResynch))
    ON_COMMAND_UI_ENABLED(IDM_RESYNCHROWS,                  SOURCE_GETINTERFACE(pCObject, IRowsetResynch))
    ON_COMMAND_UI_ENABLED(IDM_GETLASTVISIBLEDATA,             SOURCE_GETINTERFACE(pCObject, IRowsetRefresh))
    ON_COMMAND_UI_ENABLED(IDM_REFRESHVISIBLEDATA,             SOURCE_GETINTERFACE(pCObject, IRowsetRefresh))
    ON_COMMAND_UI_ENABLED(IDM_IROWSETSCROLL_GETDATA,            SOURCE_GETINTERFACE(pCObject, IRowsetScroll))
    ON_COMMAND_UI_ENABLED(IDM_IROWSETSCROLL_GETAPPROXIMATEPOSITION,     SOURCE_GETINTERFACE(pCObject, IRowsetScroll))
    ON_COMMAND_UI_ENABLED(IDM_IROWSETSCROLL_GETROWSATRATIO,         FALSE)
    ON_COMMAND_UI_ENABLED(IDM_UNDO,                     SOURCE_GETINTERFACE(pCObject, IRowsetUpdate))
    ON_COMMAND_UI_ENABLED(IDM_UPDATE,                   SOURCE_GETINTERFACE(pCObject, IRowsetUpdate))
    ON_COMMAND_UI_ENABLED(IDM_GETPENDINGROWS,               SOURCE_GETINTERFACE(pCObject, IRowsetUpdate))
    ON_COMMAND_UI_ENABLED(IDM_GETROWSTATUS,                 SOURCE_GETINTERFACE(pCObject, IRowsetUpdate))
    ON_COMMAND_UI_ENABLED(IDM_GETORIGINALDATA,                SOURCE_GETINTERFACE(pCObject, IRowsetUpdate))
    //----------------------------
    ON_COMMAND_UI_ENABLED(IDM_GETROWFROMHROW,               SOURCE_GETINTERFACE(pCObject, IGetRow))
    ON_COMMAND_UI_ENABLED(IDM_GETURLFROMHROW,               SOURCE_GETINTERFACE(pCObject, IGetRow))
    //----------------------------
    ON_COMMAND_UI_ENABLED(IDM_CREATE_ROWPOSITION,             TRUE)
    ON_COMMAND_UI_ENABLED(IDM_IROWSET_CURSORENGINE,             FALSE)
    ON_COMMAND_UI_ENABLED(IDM_MSPERSIST_ROWSET_SAVE,            FALSE)
    ON_COMMAND_UI_ENABLED(IDM_MSPERSIST_ROWSET_LOAD,            FALSE)

    ///////////////////////////////////////////////////////////////////
    // Row
    //
    ///////////////////////////////////////////////////////////////////
    ON_COMMAND_UI_ENABLED(IDM_ROW_ADDREF,                 SOURCE_GETINTERFACE(pCObject, IUnknown))
    //----------------------------
    ON_COMMAND_UI_ENABLED(IDM_IROW_GETCOLUMNS,                SOURCE_GETINTERFACE(pCObject, IRow))
    ON_COMMAND_UI_ENABLED(IDM_IROW_GETSOURCEROWSET,             SOURCE_GETINTERFACE(pCObject, IRow))
    ON_COMMAND_UI_ENABLED(IDM_IROW_OPEN,                  SOURCE_GETINTERFACE(pCObject, IRow))
    ON_COMMAND_UI_ENABLED(IDM_IGETSESSION_GETSESSION,           SOURCE_GETINTERFACE(pCObject, IGetSession))
    //----------------------------
    ON_COMMAND_UI_ENABLED(IDM_ICOLUMNSINFO2_GETRESTRICTEDCOLUMNINFO,    FALSE)
    ON_COMMAND_UI_ENABLED(IDM_IROW_SETCOLUMNS,                SOURCE_GETINTERFACE(pCObject, IRowChange))
    ON_COMMAND_UI_ENABLED(IDM_IROW_ADDCOLUMNS,                FALSE)
    ON_COMMAND_UI_ENABLED(IDM_IROW_DELETECOLUMNS,             SOURCE_GETINTERFACE(pCObject, IRowSchemaChange))
    ON_COMMAND_UI_ENABLED(IDM_ISCOPEDOPERATIONS_OPENROWSET,         SOURCE_GETINTERFACE(pCObject, IScopedOperations))
    ON_COMMAND_UI_ENABLED(IDM_ISCOPEDOPERATIONS_DELETE,           SOURCE_GETINTERFACE(pCObject, IScopedOperations))
    ON_COMMAND_UI_ENABLED(IDM_ISCOPEDOPERATIONS_COPY,           SOURCE_GETINTERFACE(pCObject, IScopedOperations))
    ON_COMMAND_UI_ENABLED(IDM_ISCOPEDOPERATIONS_MOVE,           SOURCE_GETINTERFACE(pCObject, IScopedOperations))
    //----------------------------
    //----------------------------

    ///////////////////////////////////////////////////////////////////
    // Error Object
    //
    ///////////////////////////////////////////////////////////////////
    ON_COMMAND_UI_ENABLED(IDM_ERROR_ADDREF,                 SOURCE_GETINTERFACE(pCObject, IUnknown))
    //----------------------------
    ON_COMMAND_UI_ENABLED(IDM_ERRORINFO_GETDESCRIPTION,           SOURCE_GETINTERFACE(pCObject, IErrorInfo))
    ON_COMMAND_UI_ENABLED(IDM_ERRORINFO_GETGUID,              SOURCE_GETINTERFACE(pCObject, IErrorInfo))
    ON_COMMAND_UI_ENABLED(IDM_ERRORINFO_GETHELPCONTEXT,           SOURCE_GETINTERFACE(pCObject, IErrorInfo))
    ON_COMMAND_UI_ENABLED(IDM_ERRORINFO_GETHELPFILE,            SOURCE_GETINTERFACE(pCObject, IErrorInfo))
    ON_COMMAND_UI_ENABLED(IDM_ERRORINFO_GETSOURCE,              SOURCE_GETINTERFACE(pCObject, IErrorInfo))
    ON_COMMAND_UI_ENABLED(IDM_ERRORRECORDS_GETRECORDCOUNT,          SOURCE_GETINTERFACE(pCObject, IErrorRecords))
    ON_COMMAND_UI_ENABLED(IDM_ERRORRECORDS_GETCUSTOMERROROBJECT,      SOURCE_GETINTERFACE(pCObject, IErrorRecords))
    ON_COMMAND_UI_ENABLED(IDM_ERRORRECORDS_GETERRORINFO,          SOURCE_GETINTERFACE(pCObject, IErrorRecords))
    //----------------------------
    ON_COMMAND_UI_ENABLED(IDM_GETERRORINFO,                 TRUE)
    ON_COMMAND_UI_ENABLED(IDM_SETERRORINFO,                 TRUE)
    ON_COMMAND_UI_ENABLED(IDM_DISPLAYERRORINFO,               TRUE)
    //----------------------------

    ///////////////////////////////////////////////////////////////////
    // Custom Error Object
    //
    ///////////////////////////////////////////////////////////////////
    ON_COMMAND_UI_ENABLED(IDM_CUSTOMERROR_ADDREF,             SOURCE_GETINTERFACE(pCObject, IUnknown))
    //----------------------------
    ON_COMMAND_UI_ENABLED(IDM_SQLERRORINFO_GETSQLINFO,            SOURCE_GETINTERFACE(pCObject, ISQLErrorInfo))
    //----------------------------

    ///////////////////////////////////////////////////////////////////
    // Binder
    //
    ///////////////////////////////////////////////////////////////////
    ON_COMMAND_UI_ENABLED(IDM_BINDER_ADDREF,                SOURCE_GETINTERFACE(pCObject, IUnknown))
    //----------------------------
    ON_COMMAND_UI_ENABLED(IDM_IBINDRESOURCE_BIND,             SOURCE_GETINTERFACE(pCObject, IBindResource))
    ON_COMMAND_UI_ENABLED(IDM_ICREATEROW_CREATEROW,             SOURCE_GETINTERFACE(pCObject, ICreateRow))
    ON_COMMAND_UI_ENABLED(IDM_IDBBINDERPROPERTIES_RESET,          SOURCE_GETINTERFACE(pCObject, IDBBinderProperties))
    //----------------------------
    ON_COMMAND_UI_ENABLED(IDM_IREGISTERPROVIDER_SETURLMAPPING,        SOURCE_GETINTERFACE(pCObject, IRegisterProvider))
    ON_COMMAND_UI_ENABLED(IDM_IREGISTERPROVIDER_GETURLMAPPING,        SOURCE_GETINTERFACE(pCObject, IRegisterProvider))
    ON_COMMAND_UI_ENABLED(IDM_IREGISTERPROVIDER_UNREGISTERPROVIDER,     SOURCE_GETINTERFACE(pCObject, IRegisterProvider))
    //----------------------------

    ///////////////////////////////////////////////////////////////////
    // ConnectionPoint
    //
    ///////////////////////////////////////////////////////////////////
    ON_COMMAND_UI_ENABLED(IDM_CONNECTIONPOINT_ADDREF,           SOURCE_GETINTERFACE(pCObject, IUnknown))
    //----------------------------
    ON_COMMAND_UI_ENABLED(IDM_ICONNECTIONPOINT_GETCONNECTIONINTERFACE,    SOURCE_GETINTERFACE(pCObject, IConnectionPoint))
    ON_COMMAND_UI_ENABLED(IDM_ICONNECTIONPOINT_ADVISE,            SOURCE_GETINTERFACE(pCObject, IConnectionPoint))
    ON_COMMAND_UI_ENABLED(IDM_ICONNECTIONPOINT_UNADVISE,          SOURCE_GETINTERFACE(pCObject, IConnectionPoint))
    ON_COMMAND_UI_ENABLED(IDM_ICONNECTIONPOINT_ENUMCONNECTIONS,       FALSE)
    ON_COMMAND_UI_ENABLED(IDM_ICONNECTIONPOINT_GETCONNECTIONPOINTCONTAINER, FALSE)
    //----------------------------
    //----------------------------

    ///////////////////////////////////////////////////////////////////
    // Service Components
    //
    ///////////////////////////////////////////////////////////////////
    ON_COMMAND_UI_ENABLED(IDM_SERVICECOMP_ADDREF,                 SOURCE_GETINTERFACE(pCObject, IUnknown))
    //----------------------------
    ON_COMMAND_UI_ENABLED(IDM_IDATAINITIALIZE_CREATEDBINSTANCE,           SOURCE_GETINTERFACE(pCObject, IDataInitialize))
    ON_COMMAND_UI_ENABLED(IDM_IDATAINITIALIZE_CREATEDBINSTANCEEX,         SOURCE_GETINTERFACE(pCObject, IDataInitialize))
    ON_COMMAND_UI_ENABLED(IDM_IDATAINITIALIZE_LOADSTRINGFROMSTORAGE,        SOURCE_GETINTERFACE(pCObject, IDataInitialize))
    ON_COMMAND_UI_ENABLED(IDM_IDATAINITIALIZE_GETDATASOURCE,            SOURCE_GETINTERFACE(pCObject, IDataInitialize))
    ON_COMMAND_UI_ENABLED(IDM_IDATAINITIALIZE_GETINITIALIZATIONSTRING,        SOURCE_GETINTERFACE(pCObject, IDataInitialize))
    ON_COMMAND_UI_ENABLED(IDM_IDATAINITIALIZE_GETINITIALIZATIONSTRING_NOPASSWORD, SOURCE_GETINTERFACE(pCObject, IDataInitialize))
    ON_COMMAND_UI_ENABLED(IDM_IDATAINITIALIZE_WRITESTRINGTOSTORAGE,         SOURCE_GETINTERFACE(pCObject, IDataInitialize))
    ON_COMMAND_UI_ENABLED(IDM_CREATEFILEMONIKER,                  TRUE)
    //----------------------------
    ON_COMMAND_UI_ENABLED(IDM_POOLMNGR_ENUMPOOLS,                 FALSE)
    ON_COMMAND_UI_ENABLED(IDM_POOLMNGR_REFRESH,                   FALSE)
    //----------------------------

    ///////////////////////////////////////////////////////////////////
    // Data Links
    //
    ///////////////////////////////////////////////////////////////////
    ON_COMMAND_UI_ENABLED(IDM_DATALINKS_ADDREF,                   SOURCE_GETINTERFACE(pCObject, IUnknown))
    //----------------------------
    ON_COMMAND_UI_ENABLED(IDM_IDBPROMPTINITIALIZE_PROMPTDATASOURCE,         SOURCE_GETINTERFACE(pCObject, IDBPromptInitialize))
    ON_COMMAND_UI_ENABLED(IDM_IDBPROMPTINITIALIZE_PROMPTDATASOURCE_ADVANCED,    SOURCE_GETINTERFACE(pCObject, IDBPromptInitialize))
    ON_COMMAND_UI_ENABLED(IDM_IDBPROMPTINITIALIZE_PROMPTFILENAME,         SOURCE_GETINTERFACE(pCObject, IDBPromptInitialize))
    ON_COMMAND_UI_ENABLED(IDM_IDBPROMPTINITIALIZE_PROMPTFILENAME_ADVANCED,      SOURCE_GETINTERFACE(pCObject, IDBPromptInitialize))
    //----------------------------
    //----------------------------

    ////////////////////////////////////////////////////////////////
    // Dataset
    //
    ////////////////////////////////////////////////////////////////
    ON_COMMAND_UI_ENABLED(IDM_DATASET_ADDREF,               SOURCE_GETINTERFACE(pCObject, IUnknown))
    //----------------------------
    ON_COMMAND_UI_ENABLED(IDM_DATASET_GETAXISINFO,              SOURCE_GETINTERFACE(pCObject, IMDDataset))
      ON_COMMAND_UI_ENABLED(IDM_DATASET_GETAXISROWSET,            SOURCE_GETINTERFACE(pCObject, IMDDataset))
      ON_COMMAND_UI_ENABLED(IDM_DATASET_GETCELLDATA,              SOURCE_GETINTERFACE(pCObject, IMDDataset))
      ON_COMMAND_UI_ENABLED(IDM_DATASET_FREEAXISINFO,             SOURCE_GETINTERFACE(pCObject, IMDDataset))
      ON_COMMAND_UI_ENABLED(IDM_DATASET_GETSPECIFICATION,           SOURCE_GETINTERFACE(pCObject, IMDDataset))
    //----------------------------
    ON_COMMAND_UI_ENABLED(IDM_IMDFIND_FINDCELL,               FALSE && SOURCE_GETINTERFACE(pCObject, IMDFind))
      ON_COMMAND_UI_ENABLED(IDM_IMDFIND_FINDTUPEL,              FALSE && SOURCE_GETINTERFACE(pCObject, IMDDataset))
    //----------------------------
    ON_COMMAND_UI_ENABLED(IDM_IMDRANGEROWSET_GETRANGEROWSET,        FALSE && SOURCE_GETINTERFACE(pCObject, IMDRangeRowset))
    //----------------------------
    //----------------------------

    ////////////////////////////////////////////////////////////////
    // Enumerator
    //
    ////////////////////////////////////////////////////////////////
    ON_COMMAND_UI_ENABLED(IDM_ENUMERATOR_ADDREF,              SOURCE_GETINTERFACE(pCObject, IUnknown))
    //----------------------------
    ON_COMMAND_UI_ENABLED(IDM_ISOURCESROWSET_GETSOURCESROWSET,        SOURCE_GETINTERFACE(pCObject, ISourcesRowset))
    //----------------------------
    //----------------------------

    ////////////////////////////////////////////////////////////////
    // MultipleResults
    //
    ////////////////////////////////////////////////////////////////
    ON_COMMAND_UI_ENABLED(IDM_MULTIPLERESULTS_ADDREF,           SOURCE_GETINTERFACE(pCObject, IUnknown))
    //----------------------------
    ON_COMMAND_UI_ENABLED(IDM_IMULTIPLERESULTS_GETRESULT,         SOURCE_GETINTERFACE(pCObject, IMultipleResults))
    //----------------------------
    //----------------------------

    ////////////////////////////////////////////////////////////////
    // Stream
    //
    ////////////////////////////////////////////////////////////////
    ON_COMMAND_UI_ENABLED(IDM_STREAM_ADDREF,                SOURCE_GETINTERFACE(pCObject, IUnknown))
    //----------------------------
    ON_COMMAND_UI_ENABLED(IDM_ISEQSTREAM_READ,                SOURCE_GETINTERFACE(pCObject, ISequentialStream))
    ON_COMMAND_UI_ENABLED(IDM_ISEQSTREAM_WRITE,               SOURCE_GETINTERFACE(pCObject, ISequentialStream))
    ON_COMMAND_UI_ENABLED(IDM_ISTREAM_READ,                 SOURCE_GETINTERFACE(pCObject, IStream))
    ON_COMMAND_UI_ENABLED(IDM_ISTREAM_WRITE,                SOURCE_GETINTERFACE(pCObject, IStream))
    ON_COMMAND_UI_ENABLED(IDM_ISTREAM_SEEK,                 SOURCE_GETINTERFACE(pCObject, IStream))
    ON_COMMAND_UI_ENABLED(IDM_ISTREAM_CLONE,                SOURCE_GETINTERFACE(pCObject, IStream))
    ON_COMMAND_UI_ENABLED(IDM_ISTREAM_SETSIZE,                SOURCE_GETINTERFACE(pCObject, IStream) && FALSE)
    ON_COMMAND_UI_ENABLED(IDM_ISTREAM_COPYTO,               SOURCE_GETINTERFACE(pCObject, IStream) && FALSE)
    ON_COMMAND_UI_ENABLED(IDM_ISTREAM_COMMIT,               SOURCE_GETINTERFACE(pCObject, IStream) && FALSE)
    ON_COMMAND_UI_ENABLED(IDM_ISTREAM_REVERT,               SOURCE_GETINTERFACE(pCObject, IStream) && FALSE)
    ON_COMMAND_UI_ENABLED(IDM_ISTREAM_LOCKREGION,             SOURCE_GETINTERFACE(pCObject, IStream) && FALSE)
    ON_COMMAND_UI_ENABLED(IDM_ISTREAM_UNLOCKREGION,             SOURCE_GETINTERFACE(pCObject, IStream) && FALSE)
    ON_COMMAND_UI_ENABLED(IDM_ISTREAM_STAT,                 SOURCE_GETINTERFACE(pCObject, IStream) && FALSE)
    ON_COMMAND_UI_ENABLED(IDM_ILOCKBYTES_READAT,              SOURCE_GETINTERFACE(pCObject, ILockBytes))
    ON_COMMAND_UI_ENABLED(IDM_ILOCKBYTES_WRITE,               SOURCE_GETINTERFACE(pCObject, ILockBytes))
    ON_COMMAND_UI_ENABLED(IDM_ILOCKBYTES_STAT,                SOURCE_GETINTERFACE(pCObject, ILockBytes) && FALSE)
    ON_COMMAND_UI_ENABLED(IDM_ILOCKBYTES_FLUSH,               SOURCE_GETINTERFACE(pCObject, ILockBytes) && FALSE)
    ON_COMMAND_UI_ENABLED(IDM_ILOCKBYTES_SETSIZE,             SOURCE_GETINTERFACE(pCObject, ILockBytes) && FALSE)
    ON_COMMAND_UI_ENABLED(IDM_ILOCKBYTES_LOCKREGION,            SOURCE_GETINTERFACE(pCObject, ILockBytes) && FALSE)
    ON_COMMAND_UI_ENABLED(IDM_ILOCKBYTES_UNLOCKREGION,            SOURCE_GETINTERFACE(pCObject, ILockBytes) && FALSE)
    //----------------------------
    //----------------------------

    ////////////////////////////////////////////////////////////////
    // PoolInfo
    //
    ////////////////////////////////////////////////////////////////
    ON_COMMAND_UI_ENABLED(IDM_POOLINFO_ADDREF,                SOURCE_GETINTERFACE(pCObject, IUnknown))
    //----------------------------
    ON_COMMAND_UI_ENABLED(IDM_IPOOLINFO_REFRESH,              FALSE)
    ON_COMMAND_UI_ENABLED(IDM_IPOOLINFO_GETCOUNT,             FALSE)
    ON_COMMAND_UI_ENABLED(IDM_IPOOLINFO_GETPOOLID,              FALSE)
    ON_COMMAND_UI_ENABLED(IDM_IPOOLINFO_GETPROTOTYPE,           FALSE)
    ON_COMMAND_UI_ENABLED(IDM_IPOOLINFO_SETPOOLTIMEOUT,           FALSE)
    ON_COMMAND_UI_ENABLED(IDM_IPOOLINFO_GETPOOLTIMEOUT,           FALSE)
    ON_COMMAND_UI_ENABLED(IDM_IPOOLINFO_SETRETRYTIMEOUT,          FALSE)
    ON_COMMAND_UI_ENABLED(IDM_IPOOLINFO_GETRETRYTIMEOUT,          FALSE)
    //----------------------------
    //----------------------------

    ////////////////////////////////////////////////////////////////
    // RowPosition
    //
    ////////////////////////////////////////////////////////////////
    ON_COMMAND_UI_ENABLED(IDM_ROWPOS_ADDREF,                SOURCE_GETINTERFACE(pCObject, IUnknown))
    //----------------------------
    ON_COMMAND_UI_ENABLED(IDM_IROWPOS_INITIALIZE,             SOURCE_GETINTERFACE(pCObject, IRowPosition))
    ON_COMMAND_UI_ENABLED(IDM_IROWPOS_GETROWSET,              SOURCE_GETINTERFACE(pCObject, IRowPosition))
    ON_COMMAND_UI_ENABLED(IDM_IROWPOS_CLEARROWPOSITION,           SOURCE_GETINTERFACE(pCObject, IRowPosition))
    ON_COMMAND_UI_ENABLED(IDM_IROWPOS_SETROWPOSITION,           SOURCE_GETINTERFACE(pCObject, IRowPosition))
    ON_COMMAND_UI_ENABLED(IDM_IROWPOS_GETROWPOSITION,           SOURCE_GETINTERFACE(pCObject, IRowPosition))
    //----------------------------
    //----------------------------

    ///////////////////////////////////////////////////////////////////
    // Transaction
    //
    ///////////////////////////////////////////////////////////////////
    ON_COMMAND_UI_ENABLED(IDM_TRANSACTION_ADDREF,             SOURCE_GETINTERFACE(pCObject, IUnknown))
    //----------------------------
    ON_COMMAND_UI_ENABLED(IDM_ITRANSACTION_ABORT,             SOURCE_GETINTERFACE(pCObject, ITransaction))
    ON_COMMAND_UI_ENABLED(IDM_ITRANSACTION_COMMIT,              SOURCE_GETINTERFACE(pCObject, ITransaction))
    ON_COMMAND_UI_ENABLED(IDM_ITRANSACTION_GETTRANSACTIONINFO,        SOURCE_GETINTERFACE(pCObject, ITransaction))
    //----------------------------
    //----------------------------

    ///////////////////////////////////////////////////////////////////
    // TransactionOptions
    //
    ///////////////////////////////////////////////////////////////////
    ON_COMMAND_UI_ENABLED(IDM_TRANSACTIONOPTIONS_ADDREF,          SOURCE_GETINTERFACE(pCObject, IUnknown))
    //----------------------------
    ON_COMMAND_UI_ENABLED(IDM_ITRANSACTIONOPTIONS_GETOPTIONS,       SOURCE_GETINTERFACE(pCObject, ITransactionOptions))
    ON_COMMAND_UI_ENABLED(IDM_ITRANSACTIONOPTIONS_SETOPTIONS,       SOURCE_GETINTERFACE(pCObject, ITransactionOptions))
    //----------------------------
    //----------------------------

    ///////////////////////////////////////////////////////////////////
    // Tools Menu
    //
    ///////////////////////////////////////////////////////////////////
    ON_COMMAND_UI_ENABLED(IDM_OPTIONS,                    TRUE)
    ON_COMMAND_UI_ENABLED(IDM_TRACEWINDOW,                  TRUE)
    ON_COMMAND_UI_ENABLED(IDM_OBJECTSWINDOW,                TRUE)

    ///////////////////////////////////////////////////////////////////
    // Window Menu
    //
    ///////////////////////////////////////////////////////////////////
    ON_COMMAND_UI_ENABLED(IDM_CLOSEWINDOW,                  GetActiveWindow())

    ON_COMMAND_UI_ENABLED(IDM_TILEHORIZONTAL,               GetActiveWindow())
    ON_COMMAND_UI_ENABLED(IDM_TILEVERTICAL,                 GetActiveWindow())
    ON_COMMAND_UI_ENABLED(IDM_CASCADE,                    GetActiveWindow())
    ON_COMMAND_UI_ENABLED(IDM_ARRANGEICONS,                 GetActiveWindow())
    ON_COMMAND_UI_ENABLED(IDM_AUTOPOSITION,                 GetActiveWindow())
    ON_COMMAND_UI_ENABLED(IDM_CLOSEALL,                   GetActiveWindow())
    ON_COMMAND_UI_ENABLED(IDM_NEXTWINDOW,                 GetActiveWindow())
    ON_COMMAND_UI_ENABLED(IDM_PREVWINDOW,                 GetActiveWindow())

    //Help Menu
    ON_COMMAND_UI_ENABLED(IDM_ABOUT,                    TRUE)
  };

  return CMDIFrameLite::OnUpdateCommand(hMenu, nID, pdwFlags);
}

INT_PTR WINAPI CMainWindow::PromptDataSourceProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 4109 of file cmainwindow.cpp.

{
  static DWORD  dwPromptOptions = DBPROMPTOPTIONS_PROPERTYSHEET;  //Default
  static BOOL   fUseExistingDSO = FALSE;

  static ULONG  cTypeFilters  = 1;
  static DWORD  rgTypeFilters[20] = { DBSOURCETYPE_DATASOURCE };
  static WCHAR  wszProvFilter[MAX_QUERY_LEN] = { 0 };

  static CComboBoxGuid    s_CComboInterface;
  static BOOL fAggregation  = FALSE;    //Default
  static BOOL fOutput     = TRUE;     //Default

  switch(message)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;

      //Save the "this" pointer
      CMainWindow* pThis  = (CMainWindow*)SetThis(hWnd, (void*)lParam);
      CEnumerator* pCRootEnum =  pThis->m_pCRootEnumerator;
      INDEX iSel = 0;

      HWND  hWndOptions     = ::GetDlgItem(hWnd, IDL_OPTIONS);
      HWND  hWndTypeFilter    = ::GetDlgItem(hWnd, IDL_TYPEFILTER);
      HWND  hWndProvFilter    = ::GetDlgItem(hWnd, IDL_PROVIDERFILTER);

      //Interface List...
      s_CComboInterface.CreateIndirect(hWnd, IDC_INTERFACE);
      s_CComboInterface.Populate(g_cInterfaceMaps, g_rgInterfaceMaps);
      if(s_CComboInterface.RestoreSelection() == CB_ERR)
        s_CComboInterface.SetGuid(IID_IDBInitialize);

      //Populate the Options ListBox
      SendMessage(hWndOptions, LB_RESETCONTENT, 0, 0);
      for(ULONG i=0; i<g_cPromptOptions; i++)
      {
        iSel = (INDEX)wSendMessage(hWndOptions, LB_ADDSTRING, 0, g_rgPromptOptions[i].pwszName);
        SendMessage(hWndOptions,  LB_SETITEMDATA, iSel, (LPARAM)g_rgPromptOptions[i].lItem);

        //Reselect all previously selected items...
        SendMessage(hWndOptions, LB_SETSEL, (dwPromptOptions & g_rgPromptOptions[i].lItem) == (DWORD)g_rgPromptOptions[i].lItem, i);
      }

      //Populate the TypeFilter ListBox
      SendMessage(hWndTypeFilter, LB_RESETCONTENT, 0, 0);
      for(i=0; i<g_cSourceType; i++)
      {
        iSel = (INDEX)wSendMessage(hWndTypeFilter, LB_ADDSTRING, 0, g_rgSourceType[i].pwszName);
        SendMessage(hWndTypeFilter, LB_SETITEMDATA, iSel, (LPARAM)g_rgSourceType[i].lItem);

        //Reselect all previously selected items...
        for(ULONG iFilter=0; iFilter<cTypeFilters; iFilter++)
          SendMessage(hWndTypeFilter, LB_SETSEL, rgTypeFilters[iFilter] == (DWORD)g_rgSourceType[i].lItem, i);
      }

      //We may need to connect to the RootEnumerator, if not done already
      pCRootEnum->CreateEnumInfo(CLSID_OLEDB_ENUMERATOR);

      //Populate the Provider Filter ListBox
      SendMessage(hWndProvFilter, LB_RESETCONTENT, 0, 0);
      for(i=0; i<pCRootEnum->m_cEnumInfo; i++)
      {
        iSel = (INDEX)wSendMessage(hWndProvFilter, LB_ADDSTRING, 0, pCRootEnum->m_rgEnumInfo[i].wszName);
        SendMessage(hWndProvFilter, LB_SETITEMDATA, iSel, (LPARAM)&pCRootEnum->m_rgEnumInfo[i]);

        //Reselect all previously selected items...
        SendMessage(hWndProvFilter, LB_SETSEL, wcsstr(wszProvFilter, pCRootEnum->m_rgEnumInfo[i].wszName)!=NULL, i);
      }

      //Aggregation
            ::CheckDlgButton(hWnd, IDB_AGGREGATION,    BST2STATE(fAggregation));

      //Output (ppIUnknown)
            ::CheckDlgButton(hWnd, IDB_OUTPUT,     BST2STATE(fOutput));

      //Existing DSO
            ::CheckDlgButton(hWnd, IDB_EXISTING_DSO, BST2STATE(fUseExistingDSO));

      CenterDialog(hWnd);
      return TRUE;
    }

    case WM_COMMAND:
    {
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDB_AGGREGATION:
        {
          //Aggregation Combo Selection has changed...
          //If we are now using Aggregation, automatically change the requested
          //riid to IID_IUnknown, since its an error otherwise...
          if(::IsDlgButtonChecked(hWnd, IDB_AGGREGATION))
            s_CComboInterface.SetGuid(IID_IUnknown);
          return 0;
        }

        case IDOK:
        {
          CWaitCursor waitCursor;

          //Get the "this" pointer
          CMainWindow* pThis      = (CMainWindow*)GetThis(hWnd);
          CDataLinks* pCDataLinks   = SOURCE_GETOBJECT(pThis->m_pCSource, CDataLinks);
          ASSERT(pCDataLinks);

          HRESULT hr        = S_OK;
          HWND  hWndOptions   = ::GetDlgItem(hWnd, IDL_OPTIONS);
          HWND  hWndTypeFilter  = ::GetDlgItem(hWnd, IDL_TYPEFILTER);
          HWND  hWndProvFilter  = ::GetDlgItem(hWnd, IDL_PROVIDERFILTER);
          IUnknown* pIUnknown = NULL;

          //Obtain the Aggregation argument
          CAggregate* pCAggregate = NULL;
          fAggregation = ::IsDlgButtonChecked(hWnd, IDB_AGGREGATION);
          if(fAggregation)
            pCAggregate = new CAggregate();

          //Obtain the Output (ppIUnknown) argument
          fOutput = ::IsDlgButtonChecked(hWnd, IDB_OUTPUT);

          //Interface
          REFIID riid = s_CComboInterface.GetGuid();

          //Obtain all Options Selected Items...
          INDEX iSelCount = (INDEX)SendMessage(hWndOptions, LB_GETSELCOUNT, 0, 0);
          INDEX rgSelItems[MAX_NAME_LEN];
          SendMessage(hWndOptions, LB_GETSELITEMS, (WPARAM)MAX_NAME_LEN, (LPARAM)rgSelItems);
          dwPromptOptions = 0;
          for(LONG i=0; i<iSelCount; i++)
            dwPromptOptions |= SendMessage(hWndOptions, LB_GETITEMDATA, rgSelItems[i], 0);

          //Obtain all TypeFilter Options Selected Items...
          iSelCount = (INDEX)SendMessage(hWndTypeFilter, LB_GETSELCOUNT, 0, 0);
          SendMessage(hWndTypeFilter, LB_GETSELITEMS, (WPARAM)MAX_NAME_LEN, (LPARAM)rgSelItems);
          for(i=0; i<iSelCount; i++)
            rgTypeFilters[i] = (DWORD)SendMessage(hWndOptions, LB_GETITEMDATA, rgSelItems[i], 0);
          cTypeFilters = (ULONG)iSelCount;

          //Provider Filter
          iSelCount = (INDEX)SendMessage(hWndProvFilter, LB_GETSELCOUNT, 0, 0);
          SendMessage(hWndProvFilter, LB_GETSELITEMS, (WPARAM)MAX_NAME_LEN, (LPARAM)rgSelItems);
          memset(wszProvFilter, 0, sizeof(wszProvFilter));
          WCHAR* pwsz = wszProvFilter;
          for(i=0; i<iSelCount; i++)
          {
            ENUMINFO* pEnumInfo = (ENUMINFO*)SendMessage(hWndProvFilter, LB_GETITEMDATA, rgSelItems[i], 0);
            CLSID clsid;
            WCHAR* pwszProgID = NULL;

            //Protect overflowing the buffer...
            //NOTE: The Provider Filter requires a ProgID, not Provider Name.
            //So we need to convert the ParseName -> CLSID -> ProgID first...
            if(SUCCEEDED(CLSIDFromString(pEnumInfo->wszParseName, &clsid)))
            {
              if(SUCCEEDED(ProgIDFromCLSID(clsid, &pwszProgID)))
              {
                ULONG ulStrLen = wcslen(pwszProgID);
                if(pwsz + ulStrLen > wszProvFilter + sizeof(wszProvFilter))
                  break;

                wcscat(pwsz, pwszProgID);
                pwsz += ulStrLen + 1;
              }
            }
            SAFE_FREE(pwszProgID);
          }

          //Obtain the Active MDI Child
          CMDIChild* pCMDIChild = (CMDIChild*)pThis->FindWindow(L"MDICHILD");

          //Existing DataSource
          fUseExistingDSO = ::IsDlgButtonChecked(hWnd, IDB_EXISTING_DSO);
          if(fUseExistingDSO && pCMDIChild && fOutput)
          {
            //Release is called on input, for successful cases...
            //I don't want them to release my DataSource, so AddRef...
            pIUnknown = SOURCE_GETINTERFACE(pCMDIChild->GetObject(eCDataSource), IUnknown);
            SAFE_ADDREF(pIUnknown);
          }

          //IDBPromptInitialize::PromptDataSource
          //NOTE:  The release of the input/ouput datasource is a likely tricky
          // 1.  *ppIUnknown == NULL on input - Succeeded - output 1 reference
          // 2.  *ppIUnknown == NULL on input - Failed  - output NULL
          // 3.  *ppIUnknown != NULL on input - Succeeded - input is released, and output is QI'd. (in effect refcount has not changed)
          // 4.  *ppIUnknown != NULL on input - Failed  - input is untouched, output is NULL. (in effect refcount has not changed)
          //Although this seems a little odd, its entirly optimized for the consumer
          //All we have to do is AddRef the input and always release the output
          TESTC(hr = pCDataLinks->PromptDataSource(pCAggregate, hWnd, dwPromptOptions, cTypeFilters, rgTypeFilters, wszProvFilter[0] ? wszProvFilter : NULL, riid, fOutput ? &pIUnknown : NULL));

          //Handle the returned object...
          //NOTE: Can pontentially return other object types: (ie: CREATE_DETERMINE_TYPE)
          if(!pThis->HandleObjectType(pCDataLinks, pIUnknown, riid, eCDataSource, 0, NULL, CREATE_NEWWINDOW | CREATE_DETERMINE_TYPE | pThis->GetOptions()->m_dwCreateOpts))
            TESTC(hr = E_FAIL);

        CLEANUP:
          SAFE_RELEASE(pCAggregate);
          SAFE_RELEASE(pIUnknown);
          if(SUCCEEDED(hr))
            EndDialog(hWnd, TRUE);
          return 0;
        }

        case IDCANCEL:
        {
          EndDialog(hWnd, FALSE);
          return 0;
        }
      }
      break;
    }//WM_COMMAND
  }

  return FALSE;
}

INT_PTR WINAPI CMainWindow::PromptFileNameProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 4339 of file cmainwindow.cpp.

{
  static DWORD dwPromptOptions = DBPROMPTOPTIONS_PROPERTYSHEET; //Default

  switch(message)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;

      //Save the "this" pointer
      CMainWindow* pThis = (CMainWindow*)SetThis(hWnd, (void*)lParam);

      HWND  hWndOptions   = ::GetDlgItem(hWnd, IDL_OPTIONS);
      INDEX iSel = 0;

      //Directory
      //FileName

      //Populate the Options ListBox
      SendMessage(hWndOptions, LB_RESETCONTENT, 0, 0);
      for(ULONG i=0; i<g_cPromptOptions; i++)
      {
        iSel = (INDEX)wSendMessage(hWndOptions, LB_ADDSTRING, 0, g_rgPromptOptions[i].pwszName);
        SendMessage(hWndOptions,  LB_SETITEMDATA, iSel, (LPARAM)g_rgPromptOptions[i].lItem);

        //Reselect all previously selected items...
        SendMessage(hWndOptions, LB_SETSEL, (dwPromptOptions & g_rgPromptOptions[i].lItem) == (DWORD)g_rgPromptOptions[i].lItem, i);
      }

      CenterDialog(hWnd);
      return TRUE;
    }

    case WM_COMMAND:
    {
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDB_DIRECTORY:
        case IDB_FILENAME:
        {
          HWND  hWndEdit  = ::GetDlgItem(hWnd, IDE_FILENAME);
          WCHAR*  pwszTitle = NULL;
          WCHAR wszBuffer[MAX_NAME_LEN] = {0};
          DWORD dwFlags   = 0;

          if(GET_WM_COMMAND_ID(wParam, lParam) == IDB_DIRECTORY)
          {
            hWndEdit  = ::GetDlgItem(hWnd, IDE_DIRECTORY);
            pwszTitle = L"Directory Name";
            dwFlags   = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_SHAREAWARE;
          }
          else
          {
            hWndEdit  = ::GetDlgItem(hWnd, IDE_FILENAME);
            pwszTitle = L"File Name";
            dwFlags   = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_SHAREAWARE;
          }

          //Display Common Dialog to obtain DataSource...
          //This is for providers that take a filename/path for this property
          if(SUCCEEDED(BrowseOpenFileName(GetAppLite()->m_hInstance, hWnd, pwszTitle, wszBuffer, MAX_NAME_LEN, NULL, L"All Files (*.*)\0*.*\0\0", NULL, dwFlags)))
          {
            //Just update value
            wSendMessage(hWndEdit, WM_SETTEXT, 0, wszBuffer);
          }
          return 0;
        }

        case IDOK:
        {
          CWaitCursor waitCursor;

          //Get the "this" pointer
          CMainWindow*  pThis   = (CMainWindow*)GetThis(hWnd);
          CDataLinks*   pCDataLinks = SOURCE_GETOBJECT(pThis->m_pCSource, CDataLinks);
          ASSERT(pCDataLinks);

          HRESULT hr = S_OK;
          WCHAR* pwszSelectedFile = NULL;
          IUnknown* pIUnknown = NULL;

          HWND  hWndDirectory = ::GetDlgItem(hWnd, IDE_DIRECTORY);
          HWND  hWndFileName  = ::GetDlgItem(hWnd, IDE_FILENAME);
          HWND  hWndOptions   = ::GetDlgItem(hWnd, IDL_OPTIONS);

          //Directory
          WCHAR* pwszDirectory = wGetWindowText(hWndDirectory);

          //FileName
          WCHAR* pwszFileName = wGetWindowText(hWndFileName);

          //Obtain all Options Selected Items...
          INDEX iSelCount = (INDEX)SendMessage(hWndOptions, LB_GETSELCOUNT, 0, 0);
          ASSERT(iSelCount < 20);
          LONG rgSelItems[20];
          SendMessage(hWndOptions, LB_GETSELITEMS, (WPARAM)20, (LPARAM)rgSelItems);
          dwPromptOptions = 0;
          for(LONG i=0; i<iSelCount; i++)
            dwPromptOptions |= SendMessage(hWndOptions, LB_GETITEMDATA, rgSelItems[i], 0);

          //IDBPromptInitalize::PromptFileName
          TESTC(hr = pCDataLinks->PromptFileName(
                hWnd,               // hWndParent
                dwPromptOptions,          // dwPromptOptions
                      pwszDirectory,            // pwszInitialDirectory
                      pwszFileName,           // pwszInitialFile
                      &pwszSelectedFile         // pwszSelectedFile
                ));

          //Delegate, and Connect from the Selected File
          TESTC(hr = pThis->m_pCServiceComp->ConnectFromFile(pwszSelectedFile));

        CLEANUP:
          SAFE_FREE(pwszDirectory);
          SAFE_FREE(pwszFileName);
          SAFE_FREE(pwszSelectedFile);
          SAFE_RELEASE(pIUnknown);

          if(SUCCEEDED(hr))
          {
            EndDialog(hWnd, TRUE);
          }
          return 0;
        }

        case IDCANCEL:
        {
          EndDialog(hWnd, FALSE);
          return 0;
        }
      }
      break;
    }//WM_COMMAND
  }

  return FALSE;
}

STDMETHODIMP CMainWindow::QueryInterface | ( | REFIID | iid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 40 of file MainWnd.cpp.

{
    if (ppvObj == NULL)
    {
      return E_POINTER;
    }

    if (iid == IID_IUnknown)
    {
      *ppvObj = (IUnknown *) this;
    }
    else
    {
        *ppvObj = NULL;
        return E_NOINTERFACE;
    }

  AddRef();
    return S_OK;
}

ATOM CMainWindow::Register ( ) [static]

Definition at line 93 of file MainWnd.cpp.

{
    WNDCLASSEX wcex = { 0 };

    wcex.cbSize         = sizeof(wcex);
    wcex.style          = CS_HREDRAW | CS_VREDRAW;
    wcex.lpfnWndProc    = WindowProc;
    wcex.hInstance      = g_hInstance;
    wcex.hIcon          = LoadIcon(NULL, IDI_APPLICATION);
    wcex.hCursor        = LoadCursor(NULL, IDC_ARROW);
    wcex.hbrBackground  = (HBRUSH) (COLOR_APPWORKSPACE + 1);
    wcex.lpszMenuName   = MAKEINTRESOURCE(IDR_MENU);
    wcex.lpszClassName  = _T("MainWindow");

    return RegisterClassEx(&wcex);
}

INT_PTR WINAPI CMainWindow::RegisterProviderProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 3326 of file cmainwindow.cpp.

{
  switch(message)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;

      //Save the "this" pointer
      CMainWindow* pThis    = (CMainWindow*)SetThis(hWnd, (void*)lParam);
      CEnumerator* pCRootEnum   = pThis->m_pCRootEnumerator;

      INDEX iSel        = 0;
      HWND hWndURL      = ::GetDlgItem(hWnd, IDE_URL);
      HWND hWndProvider   = ::GetDlgItem(hWnd, IDC_PROVIDER);

      //Update the Window title, since this is called from either method of IRegisterProvider
      if(pThis->m_idSource == IDM_IREGISTERPROVIDER_GETURLMAPPING)
      {
        wSendMessage(hWnd, WM_SETTEXT, 0, L"IRegisterProvider::GetURLMapping");
      }
      else if(pThis->m_idSource == IDM_IREGISTERPROVIDER_UNREGISTERPROVIDER)
      {
        wSendMessage(hWnd, WM_SETTEXT, 0, L"IRegisterProvider::UnregisterProvider");
      }

      //Fill In URL default
      //TODO can we provide a better default?
      wSendMessage(hWndURL, WM_SETTEXT, 0, L"http://");

      //GetURLMapping, output is CLSID, not input...
      if(pThis->m_idSource == IDM_IREGISTERPROVIDER_GETURLMAPPING)
      {
                ::EnableWindow(hWndProvider, FALSE);
        SendMessage(hWndProvider, WM_SETTEXT, 0, (LPARAM)"");
      }
      else
      {
        //Do we need to connect to the root enumerator...
        pCRootEnum->CreateEnumInfo(CLSID_OLEDB_ENUMERATOR);

        //Fill In Provider drop down
        for(ULONG i=0; i<pCRootEnum->m_cEnumInfo; i++)
        {
          iSel = (INDEX)wSendMessage(hWndProvider, CB_ADDSTRING, 0, pCRootEnum->m_rgEnumInfo[i].wszName);
          SendMessage(hWndProvider, CB_SETITEMDATA, iSel, (LPARAM)&pCRootEnum->m_rgEnumInfo[i]);
        }
        //TODO can we provide a better default?
        SendMessage(hWndProvider, CB_SETCURSEL, 0, 0);
      }

      CenterDialog(hWnd);
      return TRUE;
    }

    case WM_COMMAND:
    {
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDOK:
        {
          CWaitCursor waitCursor;

          //Get the "this" pointer
          CMainWindow* pThis    = (CMainWindow*)GetThis(hWnd);

          HWND hWndURL      = ::GetDlgItem(hWnd, IDE_URL);
          HWND hWndProvider   = ::GetDlgItem(hWnd, IDC_PROVIDER);
          WCHAR wszProgID[MAX_NAME_LEN] = {0};
          WCHAR*  pwszURL = NULL;
          WCHAR*  pwszProgID = NULL;
          CLSID clsid = GUID_NULL;
          HRESULT hr = S_OK;

          //Currently this is only for Provider Binder callers...
          CBinder* pCBinder = SOURCE_GETOBJECT(pThis->m_pCSource, CBinder);
          ASSERT(pCBinder);

          //URL
          pwszURL = wGetWindowText(hWndURL);

          //Provider
          wSendMessage(hWndProvider, WM_GETTEXT, MAX_NAME_LEN, wszProgID);
          CLSIDFromProgID(wszProgID, &clsid);

          if(pThis->m_idSource == IDM_IREGISTERPROVIDER_SETURLMAPPING)
          {
            //IRegisterProvider::SetURLMapping
            XTEST(hr = pCBinder->m_pIRegisterProvider->SetURLMapping(pwszURL, 0, clsid));
            TESTC(TRACE_METHOD(hr, L"IRegisterProvider::SetURLMapping(\"%s\", 0x%08x, \"%s\")", pwszURL, 0, wszProgID));
          }
          else if(pThis->m_idSource == IDM_IREGISTERPROVIDER_GETURLMAPPING)
          {
            //IRegisterProvider::GetURLMapping
            XTEST(hr = pCBinder->m_pIRegisterProvider->GetURLMapping(pwszURL, 0, &clsid));
            pwszProgID = GetProgID(clsid);
            TESTC(TRACE_METHOD(hr, L"IRegisterProvider::GetURLMapping(\"%s\", 0x%08x, \"%s\")", pwszURL, 0, pwszProgID));
          }
          else
          {
            //IRegisterProvider::UnregisterProvider
            //NOTE:  NULL has special allowed meaning in unregister provider, so if the
            //edit box contains empty we will treat it as null...
            XTEST(hr = pCBinder->m_pIRegisterProvider->UnregisterProvider(pwszURL, 0, clsid));
            TESTC(TRACE_METHOD(hr, L"IRegisterProvider::UnregisterProvider(\"%s\", 0x%08x, \"%s\")", pwszURL, 0, wszProgID));
          }

        CLEANUP:
          SAFE_FREE(pwszProgID);
          SAFE_FREE(pwszURL);

          if(SUCCEEDED(hr))
            EndDialog(hWnd, TRUE);
          return 0;
        }

        case IDCANCEL:
        {
          EndDialog(hWnd, FALSE);
          return 0;
        }
      }
      break;
    }//WM_COMMAND
  }

  return FALSE;
}

BOOL CMainWindow::RemoveAllChildren ( ) [virtual]

Definition at line 1853 of file cmainwindow.cpp.

{
  CMDIChild* pCMDIChild = NULL;

  //hide MDI Client Windows to avoid repaints
    ::ShowWindow(m_hWndMDIClient, SW_HIDE);

  //First remove all MDI Child windows
  while(pCMDIChild = (CMDIChild*)FindWindow(L"MDICHILD"))
  {
    MDIDestroy(pCMDIChild->m_hWnd);
    SAFE_DELETE(pCMDIChild);
  }

    ::ShowWindow(m_hWndMDIClient, SW_SHOW);
  return TRUE;
}

BOOL CMainWindow::SaveSettings ( ) [virtual]

Definition at line 1790 of file cmainwindow.cpp.

{
  HKEY hOptionsKey = NULL;

  //Open the key to make things a little quicker and direct...
  TESTC_(CreateRegKey(HKEY_ROWSETVIEWER, wszOPTIONS_KEY, &hOptionsKey),S_OK);

  //Window Positions
  if(GetWindowPlacement())
    SetRegEntry(hOptionsKey, NULL, L"WinPosition",    &m_wndPlacement,  sizeof(m_wndPlacement));

CLEANUP:
  CloseRegKey(hOptionsKey);
  return TRUE;
}

CMainWindow::STDMETHOD_ | ( | ULONG | ,
 |  | Release |
 | ) |  |
CMainWindow::STDMETHOD_ | ( | ULONG | ,
 |  | AddRef |
 | ) |  |
INT_PTR WINAPI CMainWindow::StreamViewerProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 2477 of file cmainwindow.cpp.

{
  static CDialogLite      s_CDialog;
  static CRichEditLite    s_editBox;
  static CComboBoxLite    s_comboTypes;
  static CButtonLite      s_button;
  static CWebBrowser      s_webBrowser;

  static CRichEditLite    s_editOffset;
  static CRichEditLite    s_editCount;
  static LONG         s_lOffset   = 0;
  static LONG         s_cCount    = 1000;

  switch(message)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;

      //Save the "this" pointer
      CMainWindow* pThis  = (CMainWindow*)SetThis(hWnd, (void*)lParam);
      CStream* pCStream = SOURCE_GETOBJECT(pThis->m_pCSource, CStream);

      //Controls
      s_CDialog.CreateIndirect(hWnd);
      s_comboTypes.CreateIndirect(hWnd, IDC_BINDINGTYPE);
      s_button.CreateIndirect(hWnd, IDOK);

      s_editBox.CreateIndirect(hWnd, IDE_VALUE);
      s_editBox.SetWordWrap(TRUE);

      s_editOffset.CreateIndirect(hWnd, IDE_OFFSET);
      s_editOffset.EnableWindow();
      s_editCount.CreateIndirect(hWnd, IDE_COUNT);
      s_editCount.EnableWindow();

      //Setup the webbrowser
      s_webBrowser.CreateIndirect(s_editBox.m_hWnd);

      switch(pThis->m_idSource)
      {
        case IDM_ISEQSTREAM_READ:
          //Default text
//          s_CDialog.SetWindowText(L"ISequentialStream::Read");
//          s_button.SetWindowText(L"&Read");

          //Offsets are not used in ISequentialStream
          s_editOffset.EnableWindow(FALSE);
          break;

        case IDM_ISTREAM_READ:
          //Default text
          s_CDialog.SetWindowText(L"IStream::Read");
//          s_button.SetWindowText(L"&Read");
          break;

        case IDM_ISEQSTREAM_WRITE:
          s_CDialog.SetWindowText(L"ISequentialStream::Write");
          s_button.SetWindowText(L"&Write");

          //Offsets are not used in ISequentialStream
          s_editOffset.EnableWindow(FALSE);
          break;

        case IDM_ISTREAM_WRITE:
          s_CDialog.SetWindowText(L"ISequentialStream::Write");
          s_button.SetWindowText(L"&Write");
          break;

        default:
          ASSERT(!L"Unhandled Case");
          break;
      };

      //Supply Defaults to the lOffset and cRows
      wSendMessageFmt(s_editOffset.m_hWnd, WM_SETTEXT, 0, L"%ld", s_lOffset);
      wSendMessageFmt(s_editCount.m_hWnd, WM_SETTEXT, 0, L"%ld", s_cCount);

      //Viewer
            ::CheckDlgButton(hWnd, IDB_XML_EDITBOX,    TRUE);
            ::CheckDlgButton(hWnd, IDB_XML_BROWSER,    FALSE);
            ::CheckDlgButton(hWnd, IDB_XML_DOM,      FALSE);

      //Initialize the Type Dropdown
      for(ULONG i=0; i<g_cDBTypes; i++)
        s_comboTypes.Populate(g_cDBTypes, g_rgDBTypes);
      s_comboTypes.SetSelValue(pCStream->m_wType);

      CenterDialog(hWnd);
      return TRUE;
    }

    case WM_COMMAND:
    {
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      switch(GET_WM_COMMAND_CMD(wParam, lParam))
      {
        case CBN_SELCHANGE:
        {
          //Convert the Data to the new selected type...
          //TODO:
          break;
        }
      }

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDB_XML_EDITBOX:
        {
          //Get the "this" pointer
          CMainWindow* pThis  = (CMainWindow*)GetThis(hWnd);
          CStream* pCStream = SOURCE_GETOBJECT(pThis->m_pCSource, CStream);

          //Hide the Web Browser
          s_webBrowser.Show(OLEIVERB_HIDE);
          break;
        }

        case IDB_XML_BROWSER:
        {
          //Get the "this" pointer
          CMainWindow* pThis  = (CMainWindow*)GetThis(hWnd);
          CStream* pCStream = SOURCE_GETOBJECT(pThis->m_pCSource, CStream);

          if(pCStream->m_pIUnknown)
          {
            //TODO: I cannot get IE (Web Browser control) to load the stream directly
            //The best that I have found is to dump the stream to a file, and then
            WCHAR* pwszFileName = L"RowsetViewer_Temp.xml";
            WCHAR wszFullPath[MAX_PATH+1] = {0};
            BOOL  fUnicodeStream = -1;

            DBLENGTH cbRead = 0;
            DBLENGTH lOffset = 0;
            BYTE rgBytes[MAX_BLOCK_SIZE];
            BYTE* pBytes = rgBytes;

            //Save the stream of bytes to a file
            //Open file as "CreateAlways" so we don't create numerous temp files...
            CFileLite cFile;
            XTEST(cFile.Open(pwszFileName, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, CREATE_ALWAYS));

            //NOTE: The SQLXML Stream returned does not have the root node, only data.
            //So we have to output the Header/Root node ourseleves.  But we have to do it
            //after we know weither its a unicode stream or not, since we need to place
            //the BOM

            //Write out the header
            //NOTE: Our stream has to store the type of it, since the Stream returned from
            //the provider doesn't have the BOM mark included, even for unicode stream...
            if(pCStream->m_wType == DBTYPE_WSTR)
              cFile.SetUnicode();
            cFile.Write("<RowsetViewer>");

            //Write out the stream (in chunks)
            while(SUCCEEDED(pCStream->ReadBytes(IID_IUnknown, lOffset, sizeof(rgBytes), sizeof(rgBytes), rgBytes, &cbRead))
              && cbRead)
            {
              cFile.WriteBytes((ULONG)cbRead, pBytes, NULL);
              lOffset += cbRead;
            }

            //Write Footer
            cFile.Write("</RowsetViewer>");

            //Flush the file
            cFile.Close();

            //Now load the file - using the IE Browser
            //NOTE: IE requires a full path and fails with a relative path,
            //so formulate the full path of the current directory
            XTEST(CreateDefFileName(pwszFileName, wszFullPath, NUMELE(wszFullPath)));
            XTEST(s_webBrowser.Navigate(wszFullPath));
          }
          break;
        }

        case IDB_XML_DOM:
        {
          //Get the "this" pointer
          CMainWindow* pThis  = (CMainWindow*)GetThis(hWnd);
          CStream* pCStream = SOURCE_GETOBJECT(pThis->m_pCSource, CStream);

          //Hide the Web Browser
          s_webBrowser.Show(OLEIVERB_HIDE);
          if(pCStream->m_pIUnknown)
          {
            CXmlDOM   xmlDOM;
            CComPtr<IXMLDOMNode>    spXMLNode;
            CStorageBuffer        cStorageBuffer;
            HRESULT hr = S_OK;

            //Create the DOM
            XTEST(hr = xmlDOM.Create());

            //NOTE: We need to add the root node, since the stream returned from the
            //provider only contains the data and the DOM requires only 1 root element.
            //We can obtain the stream from the document, and manually build
            //the xml from pieces...
            DBLENGTH cbRead = 0;
            DBLENGTH lOffset = 0;
            BYTE rgBytes[MAX_BLOCK_SIZE];

            //Write the Header (not the null terminator)
            if(pCStream->m_wType == DBTYPE_WSTR)
            {
              //BOM
              XTEST(cStorageBuffer.Write(&UNICODE_BYTE_ORDER_MARK, sizeof(UNICODE_BYTE_ORDER_MARK), NULL));
              XTEST(cStorageBuffer.Write(L"<RowsetViewer>", sizeof(L"<RowsetViewer>")-sizeof(WCHAR), NULL));
            }
            else
            {
              XTEST(cStorageBuffer.Write("<RowsetViewer>", sizeof("<RowsetViewer>")-sizeof(CHAR), NULL));
            }

            //Dump the entire provider stream into the DOM (manually)
            //Write out the stream (in chunks)
            while(SUCCEEDED(pCStream->ReadBytes(IID_IUnknown, lOffset, sizeof(rgBytes), sizeof(rgBytes), rgBytes, &cbRead))
              && cbRead)
            {
              XTEST(cStorageBuffer.Write(rgBytes, (ULONG)cbRead, NULL));
              lOffset += cbRead;
            }

            //Write the Footer (including the null terminator)
            if(pCStream->m_wType == DBTYPE_WSTR)
            {
              XTEST(cStorageBuffer.Write(L"</RowsetViewer>", sizeof(L"</RowsetViewer>")-sizeof(WCHAR), NULL));
            }
            else
            {
              XTEST(cStorageBuffer.Write("</RowsetViewer>", sizeof("</RowsetViewer>")-sizeof(CHAR), NULL));
            }
            cStorageBuffer.Seek(0);

            //Load the XML Stream
            XTEST(hr = xmlDOM.LoadStream((IStream*)&cStorageBuffer));

            //Walk the tree...
            if(SUCCEEDED(hr))
            {
              XTEST(xmlDOM.m_spXMLDocument.QueryInterface(&spXMLNode));
              XTEST(xmlDOM.PrintNode(spXMLNode, s_editBox));
            }
          }
          break;
        }

        case IDOK:
        {
          CWaitCursor waitCursor;

          //Get the "this" pointer
          CMainWindow* pThis  = (CMainWindow*)GetThis(hWnd);
          CStream* pCStream = SOURCE_GETOBJECT(pThis->m_pCSource, CStream);
          BOOL fRead = TRUE;
          IID iid = IID_NULL;

          switch(pThis->m_idSource)
          {
            case IDM_ISEQSTREAM_READ:
              fRead = TRUE;
              iid = IID_ISequentialStream;
              break;

            case IDM_ISTREAM_READ:
              fRead = TRUE;
              iid = IID_IStream;
              break;

            case IDM_ISEQSTREAM_WRITE:
              fRead = FALSE;
              iid = IID_ISequentialStream;
              break;

            case IDM_ISTREAM_WRITE:
              fRead = FALSE;
              iid = IID_IStream;
              break;

            default:
              ASSERT(!L"Unhandled Case");
              break;
          };

          //Obtain Defaults to the lOffset and cRows
          GetEditBoxValue(s_editOffset.m_hWnd, &s_lOffset);
          GetEditBoxValue(s_editCount.m_hWnd, &s_cCount, LONG_MIN/*Min*/, MAX_COL_SIZE/*Max*/);

          //Viewer
          BOOL bEditBox = ::IsDlgButtonChecked(hWnd, IDB_XML_EDITBOX);

          //Obtain the selected type to convert the stream to...
          pCStream->m_wType = (DBTYPE)s_comboTypes.GetSelValue();

          //Do we need to read or write the data?
          if(fRead)
          {
            //Read the stream into a buffer to display...
            WCHAR wszBuffer[MAX_COL_SIZE] = {0};
            if(SUCCEEDED(pCStream->ReadString(iid, 0, s_cCount, MAX_COL_SIZE, wszBuffer)))
            {
              if(bEditBox)
              {
                //Display the new data at the end
                s_editBox.SetSel(LONG_MAX, LONG_MAX);

                //Plase the new data at the end (ie: read in chunks)
                s_editBox.ReplaceSel(wszBuffer, TRUE);
              }
            }
          }
          else
          {
            //Obtain the data entered
            WCHAR* pwszValue = NULL;
            if(bEditBox)
            {
              pwszValue = s_editBox.GetWindowText();
            }

            //ISequentialStream::Write
            if(SUCCEEDED(pCStream->WriteString(iid, 0, pwszValue ? wcslen(pwszValue)*sizeof(WCHAR) : 0, pwszValue)))
            {
            }

            SAFE_FREE(pwszValue);
          }

          return 0;
        }

        case IDCANCEL:
        {
          EndDialog(hWnd, FALSE);
          return 0;
        }
      }
      break;
    }//WM_COMMAND

    case WM_NOTIFY:
    {
      NM_UPDOWN* pUpDown = (NM_UPDOWN*)lParam;

      //lOffset
      if(pUpDown->hdr.idFrom == IDC_SPIN_OFFSET)
      {
        s_lOffset += pUpDown->iDelta;
        wSendMessageFmt(::GetDlgItem(hWnd, IDE_OFFSET), WM_SETTEXT, 0, L"%ld", s_lOffset);
      }

      //cRows
      if(pUpDown->hdr.idFrom == IDC_SPIN_COUNT)
      {
        s_cCount += pUpDown->iDelta;
        wSendMessageFmt(::GetDlgItem(hWnd, IDE_COUNT), WM_SETTEXT, 0, L"%ld", s_cCount);
      }

      break;
    }//WM_NOTIFY
  }

  return FALSE;
}

BOOL CMainWindow::UpdateControls ( ) [virtual]

Definition at line 1822 of file cmainwindow.cpp.

{
  //Obtain the Active MDI window
  CMDIChild*    pCMDIChild    = (CMDIChild*)GetActiveWindow(L"MDICHILD");
  CDataSource*  pCDataSource  = pCMDIChild ? (CDataSource*)pCMDIChild->GetObject(eCDataSource) : NULL;
  CSession*   pCSession   = pCMDIChild ? (CSession*)pCMDIChild->GetObject(eCSession) : NULL;
  CCommand*   pCCommand   = pCMDIChild ? (CCommand*)pCMDIChild->GetObject(eCCommand) : NULL;
  CRowset*    pCRowset    = pCMDIChild ? (CRowset*)pCMDIChild->GetObject(eCRowset) : NULL;

  //Update the ToolBar
  m_CToolBar.EnableButton(IDM_FULLCONNECT,            TRUE);
  m_CToolBar.EnableButton(IDM_FULLDISCONNECT,           pCMDIChild != NULL);
  m_CToolBar.EnableButton(IDM_IDBCREATESESSION_CREATESESSION,   pCDataSource  && pCDataSource->m_pIDBCreateSession);
  m_CToolBar.EnableButton(IDM_OPENROWSET,             pCSession && pCSession->m_pIOpenRowset);
  m_CToolBar.EnableButton(IDM_EXECUTE,              pCCommand   && pCCommand->m_pICommand);
  m_CToolBar.EnableButton(IDM_RESTARTPOSITION,          pCRowset    && pCRowset->m_pIRowset);
  m_CToolBar.EnableButton(IDM_REFRESH,              pCRowset    && pCRowset->m_pIRowset);
  m_CToolBar.EnableButton(IDM_GETSCHEMAROWSET,          pCSession   && pCSession->m_pIDBSchemaRowset);
  m_CToolBar.EnableButton(IDM_INSERTROW,              pCRowset    && pCRowset->m_pIRowsetChange);
  m_CToolBar.EnableButton(IDM_DELETEROWS,             pCRowset    && pCRowset->m_pIRowsetChange);
  m_CToolBar.EnableButton(IDM_SETDATA,              pCRowset    && pCRowset->m_pIRowsetChange);
  m_CToolBar.EnableButton(IDM_UPDATE,               pCRowset    && pCRowset->m_pIRowsetUpdate);
  m_CToolBar.EnableButton(IDM_UNDO,               pCRowset    && pCRowset->m_pIRowsetUpdate);
  return TRUE;
}

LRESULT CALLBACK CMainWindow::WindowProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static, private]

Definition at line 138 of file MainWnd.cpp.

{
    CMainWindow *that = (CMainWindow *) GetWindowLongPtr(hWnd, GWLP_USERDATA);

    switch (uMsg)
    {
        case WM_CREATE:
        {
            LPCREATESTRUCT pcs = (LPCREATESTRUCT) lParam;

            that = (CMainWindow *) pcs->lpCreateParams;

            // Create the MDI client window that will handle the MDI child windows

            CLIENTCREATESTRUCT ccs = { 0 };

            ccs.hWindowMenu  = GetSubMenu(GetMenu(hWnd), WINDOW_MENU_POSITION);
            ccs.idFirstChild = FIRST_MDI_CHILD;

            that->m_hMDIClient = CreateWindowEx(
                0,
                _T("MDICLIENT"),
                0,
                WS_CLIPCHILDREN | WS_CHILD | WS_VISIBLE,
                0,
                0,
                0,
                0,
                hWnd,
                NULL,
                g_hInstance,
                &ccs
            );

            if (that->m_hMDIClient == NULL)
            {
                return -1;
            }

            that->AddRef();

            SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR) that);

            break;
        }

        case WM_DESTROY:
        {
            SetWindowLongPtr(hWnd, GWLP_USERDATA, NULL);

            that->Release();

            PostQuitMessage(0);

            break;
        }

        case WM_SETCURSOR:
        {
            if (that->m_bDisplayWaitCursor)
            {
                SetCursor(LoadCursor(NULL, IDC_WAIT));

                return TRUE;
            }

            break;
        }

        case WM_INITMENU:
        {
            if (that->m_pEventCallback != NULL)
            {
                LONG nNumDevices = that->m_pEventCallback->GetNumDevices();

                UINT uEnable = nNumDevices > 0 ? MF_ENABLED : MF_GRAYED;

                EnableMenuItem((HMENU) wParam, ID_FILE_FROM_SCANNER_OR_CAMERA, uEnable);
            }

            break;
        }

        case WM_COMMAND:
        {
            switch (LOWORD(wParam))
            {
                case ID_FILE_FROM_SCANNER_OR_CAMERA:
                {
                    that->OnFromScannerOrCamera();
                    break;
                }

                case ID_FILE_EXIT:
                {
                    DestroyWindow(hWnd);
                    break;
                }

                case ID_WINDOW_CASCADE:
                {
                    SendMessage(that->m_hMDIClient, WM_MDICASCADE, 0, 0);
                    break;
                }

                case ID_WINDOW_TILE_HORIZONTALLY:
                {
                    SendMessage(that->m_hMDIClient, WM_MDITILE, MDITILE_HORIZONTAL, 0);
                    break;
                }

                case ID_WINDOW_TILE_VERTICALLY:
                {
                    SendMessage(that->m_hMDIClient, WM_MDITILE, MDITILE_VERTICAL, 0);
                    break;
                }

                case ID_WINDOW_ARRANGE_ICONS:
                {
                    SendMessage(that->m_hMDIClient, WM_MDIICONARRANGE, 0, 0);
                    break;
                }

                case ID_HELP_ABOUT:
                {
                    TCHAR szAppName[DEFAULT_STRING_SIZE] = _T("");

                  LoadString(g_hInstance, IDS_APP_NAME, szAppName, COUNTOF(szAppName));

                    ShellAbout(hWnd, szAppName, NULL, NULL);

                    break;
                }
            }

            break;
        }
    }

    return DefFrameProc(
        hWnd,
        that == NULL ? NULL : that->m_hMDIClient,
        uMsg,
        wParam,
        lParam
    );
}

Member Data Documentation

BOOL CMainWindow::m_bDisplayWaitCursor [private]

Definition at line 74 of file MainWnd.h.

LONG CMainWindow::m_cRef [private]

Definition at line 71 of file MainWnd.h.

CStatusBarLite CMainWindow::m_CStatusBar

Definition at line 225 of file cmainwindow.h.

CToolBarLite CMainWindow::m_CToolBar

Definition at line 226 of file cmainwindow.h.

HCURSOR CMainWindow::m_hCurSizeNS

Definition at line 237 of file cmainwindow.h.

HIMAGELIST CMainWindow::m_hImageList

Definition at line 233 of file cmainwindow.h.

HMODULE CMainWindow::m_hLibRichEdit10

Definition at line 239 of file cmainwindow.h.

HMODULE CMainWindow::m_hLibRichEdit20

Definition at line 238 of file cmainwindow.h.

HWND CMainWindow::m_hMDIClient [private]

Definition at line 72 of file MainWnd.h.

HIMAGELIST CMainWindow::m_hStateList

Definition at line 234 of file cmainwindow.h.

ULONG CMainWindow::m_idSource

Definition at line 246 of file cmainwindow.h.

CList<ITransaction*, ITransaction*> CMainWindow::m_listTransactions

Definition at line 242 of file cmainwindow.h.

LONG CMainWindow::m_nNumImages [private]

Definition at line 73 of file MainWnd.h.

CDataLinks* CMainWindow::m_pCDataLinks

Definition at line 221 of file cmainwindow.h.

CFullConnect* CMainWindow::m_pCFullConnect

Definition at line 216 of file cmainwindow.h.

CListener* CMainWindow::m_pCListener

Definition at line 222 of file cmainwindow.h.

CMDIObjects* CMainWindow::m_pCMDIObjects

Definition at line 230 of file cmainwindow.h.

CMDITrace* CMainWindow::m_pCMDITrace

Definition at line 229 of file cmainwindow.h.

COptionsSheet* CMainWindow::m_pCOptionsSheet

Definition at line 217 of file cmainwindow.h.

CBinder* CMainWindow::m_pCRootBinder

Definition at line 218 of file cmainwindow.h.

CEnumerator* CMainWindow::m_pCRootEnumerator

Definition at line 219 of file cmainwindow.h.

CServiceComp* CMainWindow::m_pCServiceComp

Definition at line 220 of file cmainwindow.h.

CBase* CMainWindow::m_pCSource

Definition at line 245 of file cmainwindow.h.

CComPtr<WiaWrap::CEventCallback> CMainWindow::m_pEventCallback [private]

Definition at line 76 of file MainWnd.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cmainwindow.h
  • Multimedia/wia/GetImage/MainWnd.h
  • Com/Fundamentals/ActiveDocument/DfV/mwclass.Cxx
  • Com/Fundamentals/TutSamp/AptClien/AptClien.Cpp
  • Com/Fundamentals/TutSamp/AptServe/AptServe.Cpp
  • Com/Fundamentals/TutSamp/ComUser/ComUser.Cpp
  • Com/Fundamentals/TutSamp/ConClien/ConClien.Cpp
  • Com/Fundamentals/TutSamp/DcdServe/DcdServe.Cpp
  • Com/Fundamentals/TutSamp/DComDraw/DComDraw.Cpp
  • Com/Fundamentals/TutSamp/DllClien/DllClien.Cpp
  • Com/Fundamentals/TutSamp/DllUser/DllUser.Cpp
  • Com/Fundamentals/TutSamp/ExeSkel/ExeSkel.Cpp
  • Com/Fundamentals/TutSamp/FreClien/FreClien.Cpp
  • Com/Fundamentals/TutSamp/LicClien/LicClien.Cpp
  • Com/Fundamentals/TutSamp/LocClien/LocClien.Cpp
  • Com/Fundamentals/TutSamp/LocServe/LocServe.Cpp
  • Com/Fundamentals/TutSamp/PerClien/PerClien.Cpp
  • Com/Fundamentals/TutSamp/RemClien/RemClien.Cpp
  • Com/Fundamentals/TutSamp/StoClien/StoClien.Cpp
  • Dataaccess/oledb/rowsetviewer/cmainwindow.cpp
  • Multimedia/wia/GetImage/MainWnd.cpp
Generated on Wed Nov 13 2024 16:56:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMallocSpy Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Protected Attributes | Private Attributes

CMallocSpy Class Reference

#include "CMallSpy.Hxx"

List of all members.

Public Member Functions

CMallocSpy (void)
CMallocSpy ()
CMallocSpy (void)
~CMallocSpy (void)
virtual | ~CMallocSpy ()
virtual | ~CMallocSpy (void)
virtual HRESULT | AddToList (void *pv)
virtual HRESULT | AddToList (void *pv)
virtual HRESULT | DumpLeaks ()
virtual HRESULT | DumpLeaks ()
virtual STDMETHODIMP | QueryInterface (REFIID riid, void **ppIUnknown)
STDMETHOD() | QueryInterface (REFIID riid, LPVOID *ppUnk)
virtual STDMETHODIMP | QueryInterface (REFIID riid, void **ppIUnknown)
virtual HRESULT | Register ()
virtual HRESULT | RemoveFromList (void *pv)
virtual HRESULT | RemoveFromList (void *pv)
virtual void | Reset ()
STDMETHOD_ (void *, PreFree)(void *pRequest
STDMETHOD_ (void, PreHeapMinimize)(void)
STDMETHOD_ (void, PostHeapMinimize)(void)
STDMETHOD_ (void, PostFree)(BOOL fSpyed)
STDMETHOD_ (ULONG, AddRef)(void)
STDMETHOD_ (SIZE_T, PreRealloc)(void *pRequest
STDMETHOD_ (ULONG, Release)(void)
STDMETHOD_ (void *, PostRealloc)(void *pActual
STDMETHOD_ (SIZE_T, PreAlloc)(SIZE_T cbRequest)
STDMETHOD_ (void *, PreGetSize)(void *pRequest
STDMETHOD_ (SIZE_T, PostGetSize)(SIZE_T cbActual
STDMETHOD_ (void *, PostAlloc)(void *pActual)
STDMETHOD_ (void *, PreDidAlloc)(void *pRequest
STDMETHOD_ (BOOL, PostDidAlloc)(void *pRequest
virtual | STDMETHODIMP_ (void *) PostAlloc(void *pActual)
virtual | STDMETHODIMP_ (SIZE_T) PreAlloc(SIZE_T cbRequest)
virtual | STDMETHODIMP_ (ULONG) Release()
virtual | STDMETHODIMP_ (ULONG) AddRef()
virtual | STDMETHODIMP_ (void *) PreDidAlloc(void *pRequest
virtual | STDMETHODIMP_ (void *) PostAlloc(void *pActual)
virtual | STDMETHODIMP_ (ULONG) PreAlloc(ULONG cbRequest)
virtual | STDMETHODIMP_ (void *) PreFree(void *pRequest
virtual | STDMETHODIMP_ (ULONG) AddRef()
virtual | STDMETHODIMP_ (void *) PostRealloc(void *pActual
virtual | STDMETHODIMP_ (void) PostFree(BOOL fSpyed)
virtual | STDMETHODIMP_ (void) PostHeapMinimize()
virtual | STDMETHODIMP_ (void) PreHeapMinimize()
virtual | STDMETHODIMP_ (void *) PreGetSize(void *pRequest
virtual | STDMETHODIMP_ (ULONG) PostGetSize(ULONG cbActual
virtual | STDMETHODIMP_ (SIZE_T) PreRealloc(void *pRequest
virtual | STDMETHODIMP_ (void *) PostRealloc(void *pActual
virtual | STDMETHODIMP_ (SIZE_T) PostGetSize(SIZE_T cbActual
virtual | STDMETHODIMP_ (ULONG) Release()
virtual | STDMETHODIMP_ (void) PreHeapMinimize()
virtual | STDMETHODIMP_ (void) PostHeapMinimize()
virtual | STDMETHODIMP_ (void *) PreDidAlloc(void *pRequest
virtual | STDMETHODIMP_ (ULONG) PreRealloc(void *pRequest
virtual | STDMETHODIMP_ (void) PostFree(BOOL fSpyed)
virtual | STDMETHODIMP_ (void *) PreGetSize(void *pRequest
virtual | STDMETHODIMP_ (BOOL) PostDidAlloc(void *pRequest
virtual | STDMETHODIMP_ (BOOL) PostDidAlloc(void *pRequest
virtual | STDMETHODIMP_ (void *) PreFree(void *pRequest
virtual HRESULT | Unregister ()

Public Attributes

SIZE_T | cbRequest
virtual SIZE_T | cbRequest
virtual ULONG | cbRequest
BOOL BOOL fActual
virtual BOOL BOOL | fActual
virtual SIZE_T void BOOL | fSpyed
virtual BOOL | fSpyed
SIZE_T void BOOL | fSpyed
BOOL fSpyed
virtual ULONG void BOOL | fSpyed
IMallocSpyVtbl FAR * | lpVtbl
ULONG m_cbRequested
virtual SIZE_T void ** | ppNewRequest
SIZE_T void ** | ppNewRequest
virtual ULONG void ** | ppNewRequest

Protected Attributes

CList< void *, void * > | CAllocList
ULONG m_cAllocations

Private Attributes

CList< void * > | CAllocList
SIZE_T | m_cbRequest
ULONG m_cbRequest
ULONG m_cRef

Detailed Description

Definition at line 29 of file CMallSpy.Hxx.

Constructor & Destructor Documentation

CMallocSpy::CMallocSpy ( void )

Definition at line 54 of file CMallSpy.Cxx.

{
    m_cRef = 0;
}

CMallocSpy::~CMallocSpy ( void )

Definition at line 75 of file CMallSpy.Cxx.

{
    // Nothing to do here
}

CMallocSpy::CMallocSpy ( )
virtual CMallocSpy::~CMallocSpy ( ) [virtual]
CMallocSpy::CMallocSpy ( void )
virtual CMallocSpy::~CMallocSpy ( void ) [virtual]

Member Function Documentation

HRESULT CMallocSpy::AddToList ( void * pv ) [virtual]

Definition at line 109 of file spy.cpp.

{
  ASSERT(pv);

  //NOTE:  We don't have to worry about access into our list in Multi-Threads as COM states:
  //"The call to the pre-method through the return from the corresponding post-method
  //is guaranteed to be thread-safe in multi-threaded operations."

  //Add this element to the list
  CAllocList.AddTail(pv);
  return S_OK;
}

virtual HRESULT CMallocSpy::AddToList ( void * pv ) [virtual]
HRESULT CMallocSpy::DumpLeaks ( ) [virtual]

Definition at line 183 of file spy.cpp.

{
  ULONG cTotalLeaks = 0;
  SIZE_T  cTotalBytes = 0;
  DWORD dwSelection = IDOK;

  //Display Leaks to the Output Window
  while(!CAllocList.IsEmpty())
  {
    //Obtain the pointer to the leaked memory
    void* pRequest = CAllocList.RemoveHead();
    ASSERT(pRequest);

    void* pActual = HEADER_OFFSET(pRequest);
    ASSERT(pActual);

    //Make sure that the head/tail signitures are intact
    if(HEAD_SIGNITURE(pActual) != HEADSIGN)
      InternalTraceFmt(L"TRACE - IMallocSpy HeadSigniture Corrupted! - 0x%p, ID=%08lu, %lu byte(s)\n", pRequest, BUFFER_ID(pActual), BUFFER_LENGTH(pActual));

    if(TAIL_SIGNITURE(pActual) != TAILSIGN)
      InternalTraceFmt(L"TRACE - IMallocSpy TailSigniture Corrupted! - 0x%p, ID=%08lu, %lu byte(s)\n", pRequest, BUFFER_ID(pActual), BUFFER_LENGTH(pActual));

    SIZE_T  ulSize    = BUFFER_LENGTH(pActual);
    ULONG ulID    = BUFFER_ID(pActual);
    WCHAR*  pwszFileName= BUFFER_FILENAME(pActual);
    ULONG ulLine    = BUFFER_LINENUMBER(pActual);

    //Display a message box for all leaks (until the user is tired of it...)
    if(dwSelection == IDOK)
    {
      dwSelection = wMessageBox(GetFocus(), MB_TASKMODAL | MB_ICONWARNING | MB_OKCANCEL | MB_DEFBUTTON1,
        L"IMallocSpy Leak",
          L"IMallocSpy Leak:\n"
          L"0x%p, ID=%08lu, %lu byte(s), File: %s, Line %d\n\n",
          pRequest, ulID, ulSize, pwszFileName, ulLine);
    }

    //Include FileName and Line Number of the leak...
    InternalTraceFmt(L"-- IMallocSpy Leak! - 0x%p,\tID=%08lu,\t%lu byte(s),\tFile: %s,\tLine %d" wWndEOL, pRequest, ulID, ulSize, pwszFileName, ulLine);

    cTotalLeaks++;
    cTotalBytes += ulSize;

    //Free the Leak
    //You really cant free the leak since the app could be potentially still
    //using it.  Or the DLL may still be in use or have attached threads...
    //SAFE_FREE(pActual);
  }

  if(cTotalLeaks)
    InternalTraceFmt(L"-- IMallocSpy Total Leaks: %lu = %lu byte(s)" wWndEOL, cTotalLeaks, cTotalBytes);
  return S_OK;
}

virtual HRESULT CMallocSpy::DumpLeaks ( ) [virtual]
HRESULT CMallocSpy::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppUnk
 | ) |  |

Definition at line 99 of file CMallSpy.Cxx.

{
    HRESULT hr = S_OK;

    if (IsEqualIID(riid, IID_IUnknown))
    {
        *ppUnk = (IUnknown *) this;
    }
    else if (IsEqualIID(riid, IID_IMallocSpy))
    {
        *ppUnk =  (IMalloc *) this;
    }
    else
    {
        *ppUnk = NULL;
        hr =  E_NOINTERFACE;
    }
    AddRef();
    return hr;
}

HRESULT CMallocSpy::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppIUnknown |
 | ) |  |  | [virtual]

Definition at line 242 of file spy.cpp.

{
  if(!ppIUnknown)
    return E_INVALIDARG;
  *ppIUnknown = NULL;

  //IID_IUnknown
    if(riid == IID_IUnknown)
    *ppIUnknown = this;
    //IDD_IMallocSpy
  else if(riid == IID_IMallocSpy)
         *ppIUnknown =  this;

  if(*ppIUnknown)
    {
        ((IUnknown*)*ppIUnknown)->AddRef();
        return S_OK;
  }

  return E_NOINTERFACE;
}

virtual STDMETHODIMP CMallocSpy::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppIUnknown |
 | ) |  |  | [virtual]
HRESULT CMallocSpy::Register ( ) [virtual]

Definition at line 150 of file spy.cpp.

{
  //NOTE:  This may fail, if unreigster failed to unload the previous one.
  //CO_E_OBJISREG There is already a registered spy.
  return CoRegisterMallocSpy(this); // Does an AddRef on Object
}

HRESULT CMallocSpy::RemoveFromList ( void * pv ) [virtual]

Definition at line 127 of file spy.cpp.

{
  ASSERT(pv);

  //NOTE:  We don't have to worry about access into our list in Multi-Threads as COM states:
  //"The call to the pre-method through the return from the corresponding post-method
  //is guaranteed to be thread-safe in multi-threaded operations."

  //Remove this element from the list
  POSITION pos = CAllocList.Find(pv);
  if(pos)
  {
    CAllocList.RemoveAt(pos);
    return S_OK;
  }

  return E_FAIL;
}

virtual HRESULT CMallocSpy::RemoveFromList ( void * pv ) [virtual]
void CMallocSpy::Reset ( void ) [virtual]

Definition at line 98 of file spy.cpp.

{
  //Reset the number of allocations
  m_cAllocations = 0;;
}

CMallocSpy::STDMETHOD_ | ( | ULONG | ,
 |  | AddRef |
 | ) |  |
CMallocSpy::STDMETHOD_ | ( | SIZE_T | ,
 |  | PreRealloc |
 | ) |  |
CMallocSpy::STDMETHOD_ | ( | SIZE_T | ,
 |  | PreAlloc |
 | ) |  |
CMallocSpy::STDMETHOD_ | ( | void * | ,
 |  | PostRealloc |
 | ) |  |
CMallocSpy::STDMETHOD_ | ( | void * | ,
 |  | PostAlloc |
 | ) |  |
CMallocSpy::STDMETHOD_ | ( | void * | ,
 |  | PreGetSize |
 | ) |  |
CMallocSpy::STDMETHOD_ | ( | SIZE_T | ,
 |  | PostGetSize |
 | ) |  |
CMallocSpy::STDMETHOD_ | ( | ULONG | ,
 |  | Release |
 | ) |  |
CMallocSpy::STDMETHOD_ | ( | void * | ,
 |  | PreFree |
 | ) |  |
CMallocSpy::STDMETHOD_ | ( | void * | ,
 |  | PreDidAlloc |
 | ) |  |
CMallocSpy::STDMETHOD_ | ( | BOOL | ,
 |  | PostDidAlloc |
 | ) |  |
CMallocSpy::STDMETHOD_ | ( | void | ,
 |  | PostFree |
 | ) |  |
CMallocSpy::STDMETHOD_ | ( | void | ,
 |  | PreHeapMinimize |
 | ) |  |
CMallocSpy::STDMETHOD_ | ( | void | ,
 |  | PostHeapMinimize |
 | ) |  |
virtual CMallocSpy::STDMETHODIMP_ ( void * ) [virtual]
virtual CMallocSpy::STDMETHODIMP_ ( SIZE_T ) [virtual]
virtual CMallocSpy::STDMETHODIMP_ ( BOOL ) [virtual]
virtual CMallocSpy::STDMETHODIMP_ ( void * ) [virtual]
virtual CMallocSpy::STDMETHODIMP_ ( void * ) [virtual]
virtual CMallocSpy::STDMETHODIMP_ ( SIZE_T ) [virtual]
virtual CMallocSpy::STDMETHODIMP_ ( ULONG ) [virtual]
virtual CMallocSpy::STDMETHODIMP_ ( ULONG ) [virtual]
virtual CMallocSpy::STDMETHODIMP_ ( ULONG ) [virtual]
virtual CMallocSpy::STDMETHODIMP_ ( ULONG ) [virtual]
virtual CMallocSpy::STDMETHODIMP_ ( void * ) [virtual]
virtual CMallocSpy::STDMETHODIMP_ ( void * ) [virtual]
virtual CMallocSpy::STDMETHODIMP_ ( ULONG ) [virtual]
virtual CMallocSpy::STDMETHODIMP_ ( void * ) [virtual]
virtual CMallocSpy::STDMETHODIMP_ ( void * ) [virtual]
virtual CMallocSpy::STDMETHODIMP_ ( void * ) [virtual]
virtual CMallocSpy::STDMETHODIMP_ ( void ) [virtual]
virtual CMallocSpy::STDMETHODIMP_ ( void ) [virtual]
virtual CMallocSpy::STDMETHODIMP_ ( void ) [virtual]
virtual CMallocSpy::STDMETHODIMP_ ( void * ) [virtual]
virtual CMallocSpy::STDMETHODIMP_ ( ULONG ) [virtual]
virtual CMallocSpy::STDMETHODIMP_ ( ULONG ) [virtual]
virtual CMallocSpy::STDMETHODIMP_ ( void ) [virtual]
virtual CMallocSpy::STDMETHODIMP_ ( BOOL ) [virtual]
virtual CMallocSpy::STDMETHODIMP_ ( void ) [virtual]
virtual CMallocSpy::STDMETHODIMP_ ( void ) [virtual]
virtual CMallocSpy::STDMETHODIMP_ ( SIZE_T ) [virtual]
virtual CMallocSpy::STDMETHODIMP_ ( void * ) [virtual]
HRESULT CMallocSpy::Unregister ( ) [virtual]

Definition at line 161 of file spy.cpp.

{
  //NOTE:  Unregister will fail if their are outstanding leaks as the docs indicate:

  //If the return code is E_ACCESSDENIED, there are still outstanding allocations that were
  //made while the spy was active. In this case, the registered spy cannot be revoked at this
  //time because it may have attached arbitrary headers and/or trailers to these allocations
  //that only the spy knows about. Only the spy's PreFree (or PreRealloc) method knows how to
  //account for these headers and trailers. Before returning E_ACCESSDENIED, CoRevokeMallocSpy
  //notes internally that a revoke is pending. When the outstanding allocations have been freed,
  //the revoke proceeds automatically, releasing the IMallocSpy object. Thus, it is necessary to
  //call CoRevokeMallocSpy only once for each call to CoRegisterMallocSpy, even if E_ACCESSDENIED
  //is returned.
  return CoRevokeMallocSpy(); //Does a Release on Object
}

Member Data Documentation

CList<void*, void*> CMallocSpy::CAllocList [protected]

Definition at line 88 of file spy.h.

CList<void*> CMallocSpy::CAllocList [private]

Definition at line 76 of file spy.h.

virtual SIZE_T CMallocSpy::cbRequest

Definition at line 67 of file spy.h.

virtual ULONG CMallocSpy::cbRequest

Definition at line 56 of file spy.h.

SIZE_T CMallocSpy::cbRequest

Definition at line 48 of file CMallSpy.Hxx.

BOOL BOOL CMallocSpy::fActual

Definition at line 56 of file CMallSpy.Hxx.

virtual BOOL BOOL CMallocSpy::fActual

Definition at line 76 of file spy.h.

virtual BOOL CMallocSpy::fSpyed

Definition at line 63 of file spy.h.

SIZE_T void BOOL CMallocSpy::fSpyed

Definition at line 48 of file CMallSpy.Hxx.

virtual ULONG void BOOL CMallocSpy::fSpyed

Definition at line 56 of file spy.h.

BOOL CMallocSpy::fSpyed

Definition at line 45 of file CMallSpy.Hxx.

virtual SIZE_T void BOOL CMallocSpy::fSpyed

Definition at line 67 of file spy.h.

IMallocSpyVtbl FAR* CMallocSpy::lpVtbl

Definition at line 38 of file malspy.c.

ULONG CMallocSpy::m_cAllocations [protected]

Definition at line 86 of file spy.h.

ULONG CMallocSpy::m_cbRequest [private]

Definition at line 74 of file spy.h.

SIZE_T CMallocSpy::m_cbRequest [private]

Definition at line 64 of file CMallSpy.Hxx.

ULONG CMallocSpy::m_cbRequested

Definition at line 40 of file malspy.c.

ULONG CMallocSpy::m_cRef [private]

Definition at line 63 of file CMallSpy.Hxx.

virtual SIZE_T void** CMallocSpy::ppNewRequest

Definition at line 67 of file spy.h.

virtual ULONG void** CMallocSpy::ppNewRequest

Definition at line 56 of file spy.h.

SIZE_T void** CMallocSpy::ppNewRequest

Definition at line 48 of file CMallSpy.Hxx.

The documentation for this class was generated from the following files:
  • Com/Fundamentals/CMallSpy/CMallSpy.Hxx
  • Com/Fundamentals/OleStd/malspy.c
  • Dataaccess/oledb/rowsetviewer/spy.h
  • Dataaccess/oledb/tablecopy/spy.h
  • Com/Fundamentals/CMallSpy/CMallSpy.Cxx
  • Dataaccess/oledb/rowsetviewer/spy.cpp
  • Dataaccess/oledb/tablecopy/spy.cpp
Generated on Wed Nov 13 2024 16:56:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMap< KEY, ARG_KEY, VALUE, ARG_VALUE > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Protected Attributes

CMap< KEY, ARG_KEY, VALUE, ARG_VALUE > Class Template Reference

#include "list.h"

List of all members.

Public Member Functions

CMap ()
virtual | ~CMap ()
int | GetCount ()
void | GetNextAssoc (POSITION &rNextPosition, KEY &rKey, VALUE &rValue)
POSITION GetStartPosition ()
BOOL IsEmpty ()
BOOL | Lookup (ARG_KEY key, VALUE &rValue)
void | RemoveAll ()
BOOL | RemoveKey (ARG_KEY key)
BOOL | SetAt (ARG_KEY key, ARG_VALUE newValue)

Protected Member Functions

CAssoc< KEY, VALUE > * | AssocFromPos (POSITION)
POSITION | GetPosition (ARG_KEY key)

Protected Attributes

CList< CAssoc< KEY, VALUE >
*, CAssoc< KEY, VALUE > * > 		m_listValues

Detailed Description

template<class KEY, class ARG_KEY, class VALUE, class ARG_VALUE>
class CMap< KEY, ARG_KEY, VALUE, ARG_VALUE >

Definition at line 582 of file list.h.

Constructor & Destructor Documentation

template<class KEY , class ARG_KEY , class VALUE , class ARG_VALUE >
CMap< KEY, ARG_KEY, VALUE, ARG_VALUE >::CMap ( )

Definition at line 621 of file list.h.

{
}

template<class KEY , class ARG_KEY , class VALUE , class ARG_VALUE >
CMap< KEY, ARG_KEY, VALUE, ARG_VALUE >::~CMap ( ) [virtual]

Definition at line 630 of file list.h.

{
    m_listValues.RemoveAll();
}

Member Function Documentation

template<class KEY , class ARG_KEY , class VALUE , class ARG_VALUE >
CAssoc< KEY, VALUE > * CMap< KEY, ARG_KEY, VALUE, ARG_VALUE >::AssocFromPos ( POSITION pos ) [protected]

Definition at line 663 of file list.h.

{
    if(!pos)
        return NULL;

    CNode<CAssoc<KEY, VALUE>*>* pNode = (CNode<CAssoc<KEY, VALUE>*>*)pos;
    return pNode->m_data;
}

template<class KEY , class ARG_KEY , class VALUE , class ARG_VALUE >
int CMap< KEY, ARG_KEY, VALUE, ARG_VALUE >::GetCount ( )

Definition at line 687 of file list.h.

{
    return m_listValues.GetCount();
}

template<class KEY , class ARG_KEY , class VALUE , class ARG_VALUE >
void CMap< KEY, ARG_KEY, VALUE, ARG_VALUE >::GetNextAssoc | ( | POSITION & | rNextPosition,
 |  | KEY & | rKey,
 |  | VALUE & | rValue
 | ) |  |

Definition at line 783 of file list.h.

{
    if(rNextPosition)
    {
        CAssoc<KEY, VALUE>* pCAssoc = AssocFromPos(rNextPosition);
        rKey = pCAssoc->m_key;
        rValue = pCAssoc->m_value;

        //Update the position to the next item, for iteration...
        m_listValues.GetNext(rNextPosition);
    }
}

template<class KEY , class ARG_KEY , class VALUE , class ARG_VALUE >
POSITION CMap< KEY, ARG_KEY, VALUE, ARG_VALUE >::GetPosition ( ARG_KEY key ) [protected]

Definition at line 641 of file list.h.

{
    //Find this "key" in the list...
    //NOTE:  This is an extremly slow process for a CMap class.
    //This is a linear search to just make the code simple and quick,
    //This really should be a hashtable lookup
    POSITION pos = m_listValues.GetHeadPosition();
    while(pos)
    {
        if(AssocFromPos(pos)->m_key == key)
            return pos;
        m_listValues.GetNext(pos);
    }

    return NULL;
}

template<class KEY , class ARG_KEY , class VALUE , class ARG_VALUE >
POSITION CMap< KEY, ARG_KEY, VALUE, ARG_VALUE >::GetStartPosition ( )

Definition at line 677 of file list.h.

{
    return m_listValues.GetHeadPosition();
}

template<class KEY , class ARG_KEY , class VALUE , class ARG_VALUE >
BOOL CMap< KEY, ARG_KEY, VALUE, ARG_VALUE >::IsEmpty ( void )

Definition at line 697 of file list.h.

{
    return m_listValues.IsEmpty();
}

template<class KEY , class ARG_KEY , class VALUE , class ARG_VALUE >
BOOL CMap< KEY, ARG_KEY, VALUE, ARG_VALUE >::Lookup | ( | ARG_KEY | key,
 |  | VALUE & | rValue
 | ) |  |

Definition at line 707 of file list.h.

{
    POSITION pos = GetPosition(key);
    if(!pos)
        return FALSE;

    rValue = AssocFromPos(pos)->m_value;
    return TRUE;
}

template<class KEY , class ARG_KEY , class VALUE , class ARG_VALUE >
void CMap< KEY, ARG_KEY, VALUE, ARG_VALUE >::RemoveAll ( )

Definition at line 722 of file list.h.

{
    m_listValues.RemoveAll();
}

template<class KEY , class ARG_KEY , class VALUE , class ARG_VALUE >
BOOL CMap< KEY, ARG_KEY, VALUE, ARG_VALUE >::RemoveKey ( ARG_KEY key )

Definition at line 733 of file list.h.

{
    //Find the key in the List...
    POSITION pos = GetPosition(key);
    if(pos == NULL)
        return FALSE;

    //Remove this Node...
    m_listValues.RemoveAt(pos);
    return TRUE;
}

template<class KEY , class ARG_KEY , class VALUE , class ARG_VALUE >
BOOL CMap< KEY, ARG_KEY, VALUE, ARG_VALUE >::SetAt | ( | ARG_KEY | key,
 |  | ARG_VALUE | newValue
 | ) |  |

Definition at line 752 of file list.h.

{
    //Try to find this key...
    POSITION pos = GetPosition(key);
    if(pos)
    {
        //Found already, just change the value...
        AssocFromPos(pos)->m_value = value;
    }
    else
    {
        //Not found, just need to add to the list...
        CAssoc<KEY, VALUE>* pCAssoc = new CAssoc<KEY, VALUE>;
        if(!pCAssoc)
            return FALSE;

        pCAssoc->m_key = key;
        pCAssoc->m_value = value;

        //Add it to the list...
        m_listValues.AddTail(pCAssoc);
    }

    return TRUE;
}

Member Data Documentation

template<class KEY , class ARG_KEY , class VALUE , class ARG_VALUE >
CList<CAssoc<KEY, VALUE>*, CAssoc<KEY, VALUE>*> CMap< KEY, ARG_KEY, VALUE, ARG_VALUE >::m_listValues [protected]

Definition at line 612 of file list.h.

The documentation for this class was generated from the following file:
  • Dataaccess/oledb/rowsetviewer/list.h
Generated on Wed Nov 13 2024 16:56:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMarkTextService Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes

CMarkTextService Class Reference

#include "mark.h"

List of all members.

Public Types

enum | { WM_DISPLAY_PROPERTY = WM_USER + 1 }

Public Member Functions

CMarkTextService ()
~CMarkTextService ()
void | _ClearCompositionDisplayAttributes (TfEditCookie ec)
ITfComposition * | _GetComposition ()
HRESULT | _HandleArrowKey (TfEditCookie ec, ITfContext *pContext, WPARAM wParam)
HRESULT | _HandleKeyDown (TfEditCookie ec, ITfContext *pContext, WPARAM wParam)
HRESULT | _HandleReturn (TfEditCookie ec, ITfContext *pContext)
BOOL _IsComposing ()
void | _SetCaseProperty (TfEditCookie ec, ITfContext *pContext)
void | _SetComposition (ITfComposition *pComposition)
BOOL | _SetCompositionDisplayAttributes (TfEditCookie ec)
void | _SetCustomProperty (TfEditCookie ec, ITfContext *pContext)
void | _TerminateComposition (TfEditCookie ec)
void | _TerminateCompositionInContext (ITfContext *pContext)
void | _ViewCaseProperty (TfEditCookie ec, ITfContext *pContext)
void | _ViewCustomProperty (TfEditCookie ec, ITfContext *pContext)
STDMETHODIMP | Activate (ITfThreadMgr *pThreadMgr, TfClientId tfClientId)
STDMETHODIMP | CreatePropertyStore (REFGUID guidProperty, ITfRange *pRange, ULONG cb, IStream *pStream, ITfPropertyStore **ppStore)
STDMETHODIMP | Deactivate ()
STDMETHODIMP | EnumDisplayAttributeInfo (IEnumTfDisplayAttributeInfo **ppEnum)
STDMETHODIMP | GetDisplayAttributeInfo (REFGUID guidInfo, ITfDisplayAttributeInfo **ppInfo)
STDMETHODIMP | IsStoreSerializable (REFGUID guidProperty, ITfRange *pRange, ITfPropertyStore *pPropertyStore, BOOL *pfSerializable)
STDMETHODIMP | OnChange (REFGUID rguidCompartment)
STDMETHODIMP | OnCleanupContext (TfEditCookie ecWrite, ITfContext *pContext)
STDMETHODIMP | OnCompositionTerminated (TfEditCookie ecWrite, ITfComposition *pComposition)
STDMETHODIMP | OnEndCleanupContext ()
STDMETHODIMP | OnEndEdit (ITfContext *pContext, TfEditCookie ecReadOnly, ITfEditRecord *pEditRecord)
STDMETHODIMP | OnInitDocumentMgr (ITfDocumentMgr *pDocMgr)
STDMETHODIMP | OnKeyDown (ITfContext *pContext, WPARAM wParam, LPARAM lParam, BOOL *pfEaten)
STDMETHODIMP | OnKeyUp (ITfContext *pContext, WPARAM wParam, LPARAM lParam, BOOL *pfEaten)
STDMETHODIMP | OnPopContext (ITfContext *pContext)
STDMETHODIMP | OnPreservedKey (ITfContext *pContext, REFGUID rguid, BOOL *pfEaten)
STDMETHODIMP | OnPushContext (ITfContext *pContext)
STDMETHODIMP | OnSetFocus (ITfDocumentMgr *pDocMgrFocus, ITfDocumentMgr *pDocMgrPrevFocus)
STDMETHODIMP | OnSetFocus (BOOL fForeground)
STDMETHODIMP | OnStartCleanupContext ()
STDMETHODIMP | OnTestKeyDown (ITfContext *pContext, WPARAM wParam, LPARAM lParam, BOOL *pfEaten)
STDMETHODIMP | OnTestKeyUp (ITfContext *pContext, WPARAM wParam, LPARAM lParam, BOOL *pfEaten)
STDMETHODIMP | OnUninitDocumentMgr (ITfDocumentMgr *pDocMgr)
STDMETHODIMP | QueryInterface (REFIID riid, void **ppvObj)
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) AddRef(void)

Static Public Member Functions

static void | _Menu_OnComposition (CMarkTextService *_this)
static void | _Menu_OnSetCaseProperty (CMarkTextService *_this)
static void | _Menu_OnSetCustomProperty (CMarkTextService *_this)
static void | _Menu_OnSetGlobalCompartment (CMarkTextService *_this)
static void | _Menu_OnViewCaseProperty (CMarkTextService *_this)
static void | _Menu_OnViewCustomProperty (CMarkTextService *_this)
static HRESULT | CreateInstance (IUnknown *pUnkOuter, REFIID riid, void **ppvObj)
static BOOL | RegisterCategories (BOOL fRegister)
static BOOL | RegisterProfiles ()
static BOOL | RegisterServer ()
static void | UnregisterProfiles ()
static void | UnregisterServer ()

Private Member Functions

BOOL _InitCleanupContextDurationSink ()
BOOL | _InitCleanupContextSink (ITfContext *pContext)
BOOL | _InitContextCompartment (ITfContext *pContext)
BOOL _InitDisplayAttributeGuidAtom ()
BOOL _InitGlobalCompartment ()
BOOL _InitKeystrokeSink ()
BOOL _InitLanguageBar ()
BOOL | _InitTextEditSink (ITfDocumentMgr *pDocMgr)
BOOL _InitThreadMgrSink ()
BOOL _InitWorkerWnd ()
void | _RequestPropertyEditSession (ULONG ulCallback)
void | _UninitCleanupContextDurationSink ()
void | _UninitCleanupContextSink (ITfContext *pContext)
void | _UninitCompartment (ITfContext *pContext)
void | _UninitGlobalCompartment ()
void | _UninitKeystrokeSink ()
void | _UninitLanguageBar ()
void | _UninitThreadMgrSink ()
void | _UninitWorkerWnd ()

Static Private Member Functions

static LRESULT CALLBACK | _WorkerWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)

Private Attributes

WCHAR | _achDisplayPropertyText [64]
WCHAR | _achDisplayText [64]
LONG | _cRef
DWORD _dwGlobalCompartmentEventSinkCookie
DWORD _dwTextEditSinkCookie
DWORD _dwThreadFocusSinkCookie
DWORD _dwThreadMgrEventSinkCookie
BOOL _fCleaningUp
TfGuidAtom | _gaDisplayAttribute
HWND | _hWorkerWnd
ITfComposition * | _pComposition
CLangBarItemButton * _pLangBarItem
ITfContext * | _pTextEditSinkContext
ITfThreadMgr * | _pThreadMgr
TfClientId | _tfClientId

Detailed Description

Definition at line 12 of file mark.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
WM_DISPLAY_PROPERTY

Definition at line 125 of file mark.h.

{ WM_DISPLAY_PROPERTY = WM_USER + 1 };

Constructor & Destructor Documentation

CMarkTextService::CMarkTextService ( )

Definition at line 46 of file mark.cpp.

{
    DllAddRef();

    _pThreadMgr = NULL;
    _tfClientId = TF_CLIENTID_NULL;

    _pComposition = NULL;

    _fCleaningUp = FALSE;

    _gaDisplayAttribute = TF_INVALID_GUIDATOM;

    _pLangBarItem = NULL;

    _dwThreadMgrEventSinkCookie = TF_INVALID_COOKIE;
    _dwThreadFocusSinkCookie = TF_INVALID_COOKIE;
    _dwTextEditSinkCookie = TF_INVALID_COOKIE;
    _dwGlobalCompartmentEventSinkCookie = TF_INVALID_COOKIE;

    _pTextEditSinkContext = NULL;

    _hWorkerWnd = NULL;

    _cRef = 1;
}

CMarkTextService::~CMarkTextService ( )

Definition at line 79 of file mark.cpp.

{
    DllRelease();
}

Member Function Documentation

void CMarkTextService::_ClearCompositionDisplayAttributes ( TfEditCookie ec )

Definition at line 242 of file compose.cpp.

{
    ITfRange *pRangeComposition;
    ITfContext *pContext;
    ITfProperty *pDisplayAttributeProperty;

    // we need a range and the context it lives in
    if (_pComposition->GetRange(&pRangeComposition) != S_OK)
        return;

    if (pRangeComposition->GetContext(&pContext) != S_OK)
    {
        pContext = NULL;
        goto Exit;
    }

    // get our the display attribute property
    if (pContext->GetProperty(GUID_PROP_ATTRIBUTE, &pDisplayAttributeProperty) != S_OK)
        goto Exit;

    // clear the value over the range
    pDisplayAttributeProperty->Clear(ec, pRangeComposition);

    pDisplayAttributeProperty->Release();

Exit:
    pRangeComposition->Release();
    SafeRelease(pContext);
}

ITfComposition* CMarkTextService::_GetComposition ( ) [inline]

Definition at line 103 of file mark.h.

    {
        return _pComposition;
    }

HRESULT CMarkTextService::_HandleArrowKey | ( | TfEditCookie | ec,
 |  | ITfContext * | pContext,
 |  | WPARAM | wParam
 | ) |  |

Definition at line 55 of file keys.cpp.

{
    ITfRange *pRangeComposition;
    LONG cch;
    BOOL fEqual;
    TF_SELECTION tfSelection;
    ULONG cFetched;

    // get the selection
    if (pContext->GetSelection(ec, TF_DEFAULT_SELECTION, 1, &tfSelection, &cFetched) != S_OK ||
        cFetched != 1)
    {
        // no selection?
        return S_OK; // eat the keystroke
    }

    // get the composition range
    if (_pComposition->GetRange(&pRangeComposition) != S_OK)
        goto Exit;

    // adjust the selection, we won't do anything fancy

    if (wParam == VK_LEFT)
    {
        if (tfSelection.range->IsEqualStart(ec, pRangeComposition, TF_ANCHOR_START, &fEqual) == S_OK &&
            !fEqual)
        {
            tfSelection.range->ShiftStart(ec, -1, &cch, NULL);
        }
        tfSelection.range->Collapse(ec, TF_ANCHOR_START);
    }
    else
    {
        // VK_RIGHT
        if (tfSelection.range->IsEqualEnd(ec, pRangeComposition, TF_ANCHOR_END, &fEqual) == S_OK &&
            !fEqual)
        {
            tfSelection.range->ShiftEnd(ec, +1, &cch, NULL);
        }
        tfSelection.range->Collapse(ec, TF_ANCHOR_END);
    }

    pContext->SetSelection(ec, 1, &tfSelection);

    pRangeComposition->Release();

Exit:
    tfSelection.range->Release();
    return S_OK; // eat the keystroke
}

HRESULT CMarkTextService::_HandleKeyDown | ( | TfEditCookie | ec,
 |  | ITfContext * | pContext,
 |  | WPARAM | wParam
 | ) |  |

Definition at line 114 of file keys.cpp.

{
    ITfRange *pRangeComposition;
    TF_SELECTION tfSelection;
    ULONG cFetched;
    HRESULT hr;
    WCHAR ch;
    BOOL fCovered;

    if (wParam < 'A' || wParam > 'Z')
        return S_OK; // just eat the key if it's not in a range we know how to handle

    hr = S_OK; // return S_FALSE to NOT eat the key

    // convert the wParam to a WCHAR
    if (GetKeyState(VK_SHIFT) & 0x8000)
    {
        // shift-key, leave it uppercase
        ch = (WCHAR)wParam;
    }
    else
    {
        // else make it lowercase
        ch = (WCHAR)(wParam | 32);
    }

    // first, test where a keystroke would go in the document if we did an insert
    if (pContext->GetSelection(ec, TF_DEFAULT_SELECTION, 1, &tfSelection, &cFetched) != S_OK || cFetched != 1)
        return S_FALSE;

    // is the insertion point covered by a composition?
    if (_pComposition->GetRange(&pRangeComposition) == S_OK)
    {
        fCovered = IsRangeCovered(ec, tfSelection.range, pRangeComposition);

        pRangeComposition->Release();

        if (!fCovered)
        {
            hr = S_FALSE; // don't eat the key, it's outside our composition
            goto Exit;
        }
    }

    // insert the text
    // we use SetText here instead of InsertTextAtSelection because we've already started a composition
    // we don't want to the app to adjust the insertion point inside our composition
    if (tfSelection.range->SetText(ec, 0, &ch, 1) != S_OK)
        goto Exit;

    // update the selection, we'll make it an insertion point just past
    // the inserted text.
    tfSelection.range->Collapse(ec, TF_ANCHOR_END);

    pContext->SetSelection(ec, 1, &tfSelection);

    // apply our dislay attribute property to the inserted text
    // we need to apply it to the entire composition, since the
    // display attribute property is static, not static compact
    _SetCompositionDisplayAttributes(ec);

Exit:
    tfSelection.range->Release();
    return hr;
}

HRESULT CMarkTextService::_HandleReturn | ( | TfEditCookie | ec,
 |  | ITfContext * | pContext
 | ) |  |

Definition at line 40 of file keys.cpp.

{
    // just terminate the composition
    _TerminateComposition(ec);
    return S_OK;
}

BOOL CMarkTextService::_InitCleanupContextDurationSink ( ) [private]

Definition at line 73 of file cleanup.cpp.

{
    return AdviseSingleSink(_tfClientId, _pThreadMgr, (ITfCleanupContextDurationSink *)this,
                            IID_ITfCleanupContextDurationSink);
}

BOOL CMarkTextService::_InitCleanupContextSink ( ITfContext * pContext ) [private]

Definition at line 96 of file cleanup.cpp.

{
    return AdviseSingleSink(_tfClientId, pContext, (ITfCleanupContextSink *)this,
                            IID_ITfCleanupContextSink);
}

BOOL CMarkTextService::_InitContextCompartment ( ITfContext * pContext ) [private]

Definition at line 20 of file compart.cpp.

{
    ITfCompartmentMgr *pCompartmentMgr;
    ITfCompartment *pCompartment;
    VARIANT varValue;
    HRESULT hr;

    // we want the mgr associated with pContext
    if (pContext->QueryInterface(IID_ITfCompartmentMgr, (void **)&pCompartmentMgr) != S_OK)
        return FALSE;

    hr = E_FAIL;

    if (pCompartmentMgr->GetCompartment(c_guidMarkContextCompartment, &pCompartment) != S_OK)
        goto Exit;

    // if we don't initialize the value, it will be VT_EMPTY
    // but let's initialize it to 0

    // NB: to keep things simple, we use a VT_I4
    // but you could use VT_UNKNOWN and store a pointer to anything
    varValue.vt = VT_I4;
    varValue.lVal = 0; // arbitrary value

    hr = pCompartment->SetValue(_tfClientId, &varValue);

    pCompartment->Release();

Exit:
    pCompartmentMgr->Release();

    return (hr == S_OK);
}

BOOL CMarkTextService::_InitDisplayAttributeGuidAtom ( ) [private]

Definition at line 325 of file compose.cpp.

{
    ITfCategoryMgr *pCategoryMgr;
    HRESULT hr;

    if (CoCreateInstance(CLSID_TF_CategoryMgr,
                         NULL,
                         CLSCTX_INPROC_SERVER,
                         IID_ITfCategoryMgr,
                         (void**)&pCategoryMgr) != S_OK)
    {
        return FALSE;
    }

    hr = pCategoryMgr->RegisterGUID(c_guidMarkDisplayAttribute, &_gaDisplayAttribute);

    pCategoryMgr->Release();

    return (hr == S_OK);
}

BOOL CMarkTextService::_InitGlobalCompartment ( ) [private]

Definition at line 137 of file compart.cpp.

{
    ITfCompartmentMgr *pCompartmentMgr;
    ITfCompartment *pCompartment;
    BOOL fRet;

    // we want the global mgr
    if (_pThreadMgr->GetGlobalCompartment(&pCompartmentMgr) != S_OK)
        return FALSE;

    fRet = FALSE;

    if (pCompartmentMgr->GetCompartment(c_guidMarkGlobalCompartment, &pCompartment) != S_OK)
        goto Exit;

    fRet = AdviseSink(pCompartment, (ITfCompartmentEventSink *)this,
                      IID_ITfCompartmentEventSink, &_dwGlobalCompartmentEventSinkCookie);

    pCompartment->Release();

    if (!fRet)
    {
        // don't try to unadvise a bogus cookie later
        _dwGlobalCompartmentEventSinkCookie = TF_INVALID_COOKIE;
    }

Exit:
    pCompartmentMgr->Release();
    return fRet;
}

BOOL CMarkTextService::_InitKeystrokeSink ( ) [private]

Definition at line 187 of file keys.cpp.

{
    ITfKeystrokeMgr *pKeystrokeMgr;
    HRESULT hr;

    if (_pThreadMgr->QueryInterface(IID_ITfKeystrokeMgr, (void **)&pKeystrokeMgr) != S_OK)
        return FALSE;

    hr = pKeystrokeMgr->AdviseKeyEventSink(_tfClientId, (ITfKeyEventSink *)this, TRUE);

    pKeystrokeMgr->Release();

    return (hr == S_OK);
}

BOOL CMarkTextService::_InitLanguageBar ( ) [private]

Definition at line 329 of file langbar.cpp.

{
    ITfLangBarItemMgr *pLangBarItemMgr;
    BOOL fRet;

    if (_pThreadMgr->QueryInterface(IID_ITfLangBarItemMgr, (void **)&pLangBarItemMgr) != S_OK)
        return FALSE;

    fRet = FALSE;

    if ((_pLangBarItem = new CLangBarItemButton(this)) == NULL)
        goto Exit;

    if (pLangBarItemMgr->AddItem(_pLangBarItem) != S_OK)
    {
        _pLangBarItem->Release();
        _pLangBarItem = NULL;
        goto Exit;
    }

    fRet = TRUE;

Exit:
    pLangBarItemMgr->Release();
    return fRet;
}

BOOL CMarkTextService::_InitTextEditSink ( ITfDocumentMgr * pDocMgr ) [private]

Definition at line 109 of file editsink.cpp.

{
    ITfSource *pSource;
    BOOL fRet;

    // clear out any previous sink first

    if (_dwTextEditSinkCookie != TF_INVALID_COOKIE)
    {
        if (_pTextEditSinkContext->QueryInterface(IID_ITfSource, (void **)&pSource) == S_OK)
        {
            pSource->UnadviseSink(_dwTextEditSinkCookie);
            pSource->Release();
        }

        _pTextEditSinkContext->Release();
        _pTextEditSinkContext = NULL;
        _dwTextEditSinkCookie = TF_INVALID_COOKIE;
    }

    if (pDocMgr == NULL)
        return TRUE; // caller just wanted to clear the previous sink

    // setup a new sink advised to the topmost context of the document

    if (pDocMgr->GetTop(&_pTextEditSinkContext) != S_OK)
        return FALSE;

    if (_pTextEditSinkContext == NULL)
        return TRUE; // empty document, no sink possible

    fRet = FALSE;

    if (_pTextEditSinkContext->QueryInterface(IID_ITfSource, (void **)&pSource) == S_OK)
    {
        if (pSource->AdviseSink(IID_ITfTextEditSink, (ITfTextEditSink *)this, &_dwTextEditSinkCookie) == S_OK)
        {
            fRet = TRUE;
        }
        else
        {
            _dwTextEditSinkCookie = TF_INVALID_COOKIE;
        }
        pSource->Release();
    }

    if (fRet == FALSE)
    {
        _pTextEditSinkContext->Release();
        _pTextEditSinkContext = NULL;
    }

    return fRet;
}

BOOL CMarkTextService::_InitThreadMgrSink ( ) [private]

Definition at line 93 of file tmgrsink.cpp.

{
    return AdviseSink(_pThreadMgr, (ITfThreadMgrEventSink *)this,
                      IID_ITfThreadMgrEventSink, &_dwThreadMgrEventSinkCookie);
}

BOOL CMarkTextService::_InitWorkerWnd ( ) [private]

Definition at line 401 of file property.cpp.

{
    WNDCLASS wc;

    memset(&wc, 0, sizeof(wc));
    wc.lpfnWndProc = _WorkerWndProc;
    wc.hInstance = g_hInst;
    wc.lpszClassName = c_szWorkerWndClass;

    if (RegisterClass(&wc) == 0)
        return FALSE;

    _hWorkerWnd = CreateWindow(c_szWorkerWndClass, TEXT("Mark Worker Wnd"),
                               0, 0, 0, 0, 0, NULL, NULL, g_hInst, this);

    return (_hWorkerWnd != NULL);
}

BOOL CMarkTextService::_IsComposing ( ) [inline]

Definition at line 99 of file mark.h.

    {
        return _pComposition != NULL;
    }

void CMarkTextService::_Menu_OnComposition ( CMarkTextService * _this ) [static]

Definition at line 83 of file compose.cpp.

{
    ITfDocumentMgr *pFocusDoc;
    ITfContext *pContext;
    CCompositionEditSession *pCompositionEditSession;
    HRESULT hr;

    // get the focus document
    if (_this->_pThreadMgr->GetFocus(&pFocusDoc) != S_OK)
        return;

    // we want the topmost context, since the main doc context could be
    // superceded by a modal tip context
    if (pFocusDoc->GetTop(&pContext) != S_OK)
    {
        pContext = NULL;
        goto Exit;
    }

    if (pCompositionEditSession = new CCompositionEditSession(pContext, _this))
    {
        // we need a document write lock
        // the CCompositionEditSession will do all the work when the
        // CCompositionEditSession::DoEditSession method is called by the context
        pContext->RequestEditSession(_this->_tfClientId, pCompositionEditSession, TF_ES_READWRITE | TF_ES_ASYNCDONTCARE, &hr);

        pCompositionEditSession->Release();
    }

Exit:
    SafeRelease(pContext);
    pFocusDoc->Release();
}

void CMarkTextService::_Menu_OnSetCaseProperty ( CMarkTextService * _this ) [static]

Definition at line 187 of file property.cpp.

{
    _this->_RequestPropertyEditSession(SET_CASE_PROPERTY);
}

void CMarkTextService::_Menu_OnSetCustomProperty ( CMarkTextService * _this ) [static]

Definition at line 494 of file property.cpp.

{
    _this->_RequestPropertyEditSession(SET_CUSTOM_PROPERTY);
}

void CMarkTextService::_Menu_OnSetGlobalCompartment ( CMarkTextService * _this ) [static]

Definition at line 87 of file compart.cpp.

{
    ITfCompartmentMgr *pCompartmentMgr;
    ITfCompartment *pCompartment;
    VARIANT varValue;

    // we want the global mgr
    if (_this->_pThreadMgr->GetGlobalCompartment(&pCompartmentMgr) != S_OK)
        return;

    if (pCompartmentMgr->GetCompartment(c_guidMarkGlobalCompartment, &pCompartment) != S_OK)
    {
        pCompartment = NULL;
        goto Exit;
    }

    // let's toggle the value
    // notice that global compartments are persisted, unlike all others
    if (FAILED(pCompartment->GetValue(&varValue))) // will return S_FALSE if varValue.vt == VT_EMPTY
        goto Exit;

    if (varValue.vt == VT_EMPTY)
    {
        // if we get here, the compartment has never been initialized
        varValue.vt = VT_I4;
        varValue.lVal = 0;
    }

    // toggle value
    varValue.lVal = ~varValue.lVal;

    pCompartment->SetValue(_this->_tfClientId, &varValue);

Exit:
    SafeRelease(pCompartment);
    pCompartmentMgr->Release();
}

void CMarkTextService::_Menu_OnViewCaseProperty ( CMarkTextService * _this ) [static]

Definition at line 286 of file property.cpp.

{
    _this->_RequestPropertyEditSession(VIEW_CASE_PROPERTY);
}

void CMarkTextService::_Menu_OnViewCustomProperty ( CMarkTextService * _this ) [static]

Definition at line 388 of file property.cpp.

{
    _this->_RequestPropertyEditSession(VIEW_CUSTOM_PROPERTY);
}

void CMarkTextService::_RequestPropertyEditSession ( ULONG ulCallback ) [private]

Definition at line 68 of file property.cpp.

{
    ITfDocumentMgr *pFocusDoc;
    ITfContext *pContext;
    CPropertyEditSession *pPropertyEditSession;
    HRESULT hr;

    // get the focus document
    if (_pThreadMgr->GetFocus(&pFocusDoc) != S_OK)
        return;

    if (pFocusDoc == NULL)
        return; // no focus

    // we want the topmost context, since the main doc context could be
    // superceded by a modal tip context
    if (pFocusDoc->GetTop(&pContext) != S_OK)
    {
        pContext = NULL;
        goto Exit;
    }

    if (pPropertyEditSession = new CPropertyEditSession(this, pContext, ulCallback))
    {
        // we need a document write lock
        // the CPropertyEditSession will do all the work when the
        // CPropertyEditSession::DoEditSession method is called by the context
        pContext->RequestEditSession(_tfClientId, pPropertyEditSession, TF_ES_READWRITE | TF_ES_ASYNCDONTCARE, &hr);

        pPropertyEditSession->Release();
    }

Exit:
    SafeRelease(pContext);
    pFocusDoc->Release();
}

void CMarkTextService::_SetCaseProperty | ( | TfEditCookie | ec,
 |  | ITfContext * | pContext
 | ) |  |

Definition at line 111 of file property.cpp.

{
    TF_SELECTION tfSelection;
    ITfProperty *pCaseProperty;
    ITfRange *pRangeChar;
    WCHAR ch;
    ULONG cchRead;
    ULONG cFetched;
    VARIANT varValue;

    // get the case property
    if (pContext->GetProperty(c_guidCaseProperty, &pCaseProperty) != S_OK)
        return;

    // get the selection
    if (pContext->GetSelection(ec, TF_DEFAULT_SELECTION, 1, &tfSelection, &cFetched) != S_OK ||
        cFetched != 1)
    {
        // no selection or something went wrong
        tfSelection.range = NULL;
        goto Exit;
    }

    // get a helper range ready for the loop
    if (tfSelection.range->Clone(&pRangeChar) != S_OK)
        goto Exit;

    // set the value char-by-char over the selection
    while (TRUE)
    {
        // read one char, the TF_TF_MOVESTART flag will advance the start anchor
        if (tfSelection.range->GetText(ec, TF_TF_MOVESTART, &ch, 1, &cchRead) != S_OK)
            break;

        // any more text to read?
        if (cchRead != 1)
            break;

        // make pRange cover just the one char we read
        if (pRangeChar->ShiftEndToRange(ec, tfSelection.range, TF_ANCHOR_START) != S_OK)
            break;

        // set the value
        varValue.vt = VT_I4;
        varValue.lVal = (ch >= 'A' && ch <= 'Z');

        if (pCaseProperty->SetValue(ec, pRangeChar, &varValue) != S_OK)
            break;

        // advance pRange for next iteration
        if (pRangeChar->Collapse(ec, TF_ANCHOR_END) != S_OK)
            break;
    }

    pRangeChar->Release();

Exit:
    SafeRelease(tfSelection.range);
    pCaseProperty->Release();
}

void CMarkTextService::_SetComposition ( ITfComposition * pComposition ) [inline]

Definition at line 107 of file mark.h.

    {
        _pComposition = pComposition;
    }

BOOL CMarkTextService::_SetCompositionDisplayAttributes ( TfEditCookie ec )

Definition at line 278 of file compose.cpp.

{
    ITfRange *pRangeComposition;
    ITfContext *pContext;
    ITfProperty *pDisplayAttributeProperty;
    VARIANT var;
    HRESULT hr;

    // we need a range and the context it lives in
    if (_pComposition->GetRange(&pRangeComposition) != S_OK)
        return FALSE;

    hr = E_FAIL;

    if (pRangeComposition->GetContext(&pContext) != S_OK)
    {
        pContext = NULL;
        goto Exit;
    }

    // get our the display attribute property
    if (pContext->GetProperty(GUID_PROP_ATTRIBUTE, &pDisplayAttributeProperty) != S_OK)
        goto Exit;

    // set the value over the range
    // the application will use this guid atom to lookup the acutal rendering information
    var.vt = VT_I4; // we're going to set a TfGuidAtom
    var.lVal = _gaDisplayAttribute; // our cached guid atom for c_guidMarkDisplayAttribute

    hr = pDisplayAttributeProperty->SetValue(ec, pRangeComposition, &var);

    pDisplayAttributeProperty->Release();

Exit:
    pRangeComposition->Release();
    SafeRelease(pContext);
    return (hr == S_OK);
}

void CMarkTextService::_SetCustomProperty | ( | TfEditCookie | ec,
 |  | ITfContext * | pContext
 | ) |  |

Definition at line 506 of file property.cpp.

{
    TF_SELECTION tfSelection;
    ITfProperty *pCustomProperty;
    CCustomPropertyStore *pCustomPropertyStore;
    ULONG cFetched;

    // get the case property
    if (pContext->GetProperty(c_guidCustomProperty, &pCustomProperty) != S_OK)
        return;

    // get the selection
    if (pContext->GetSelection(ec, TF_DEFAULT_SELECTION, 1, &tfSelection, &cFetched) != S_OK ||
        cFetched != 1)
    {
        // no selection or something went wrong
        tfSelection.range = NULL;
        goto Exit;
    }

    if ((pCustomPropertyStore = new CCustomPropertyStore) == NULL)
        goto Exit;

    pCustomProperty->SetValueStore(ec, tfSelection.range, pCustomPropertyStore);

    // TSF will hold a reference to pCustomPropertyStore is the SetValueStore succeeded
    // but we need to release ours
    pCustomPropertyStore->Release();

Exit:
    pCustomProperty->Release();
    SafeRelease(tfSelection.range);
}

void CMarkTextService::_TerminateComposition ( TfEditCookie ec ) [inline]

Definition at line 111 of file mark.h.

    {
        if (_pComposition != NULL)
        {
            _ClearCompositionDisplayAttributes(ec);
            _pComposition->EndComposition(ec);
            SafeReleaseClear(_pComposition);
        }
    }

void CMarkTextService::_TerminateCompositionInContext ( ITfContext * pContext )

Definition at line 61 of file compose.cpp.

{
    CTerminateCompositionEditSession *pEditSession;
    HRESULT hr;

    if (pEditSession = new CTerminateCompositionEditSession(this, pContext))
    {
        pContext->RequestEditSession(_tfClientId, pEditSession, TF_ES_ASYNCDONTCARE | TF_ES_READWRITE, &hr);
        pEditSession->Release();
    }
}

void CMarkTextService::_UninitCleanupContextDurationSink ( ) [private]

Definition at line 85 of file cleanup.cpp.

{
    UnadviseSingleSink(_tfClientId, _pThreadMgr, IID_ITfCleanupContextDurationSink);
}

void CMarkTextService::_UninitCleanupContextSink ( ITfContext * pContext ) [private]

Definition at line 108 of file cleanup.cpp.

{
    UnadviseSingleSink(_tfClientId, pContext, IID_ITfCleanupContextSink);
}

void CMarkTextService::_UninitCompartment ( ITfContext * pContext ) [private]

Definition at line 64 of file compart.cpp.

{
    ITfCompartmentMgr *pCompartmentMgr;

    // we want the mgr associated with pContext
    if (pContext->QueryInterface(IID_ITfCompartmentMgr, (void **)&pCompartmentMgr) != S_OK)
        return;

    pCompartmentMgr->ClearCompartment(_tfClientId, c_guidMarkContextCompartment);

    pCompartmentMgr->Release();
}

void CMarkTextService::_UninitGlobalCompartment ( ) [private]

Definition at line 180 of file compart.cpp.

{
    ITfCompartmentMgr *pCompartmentMgr;
    ITfCompartment *pCompartment;

    // we want the global mgr
    if (_pThreadMgr->GetGlobalCompartment(&pCompartmentMgr) != S_OK)
        return;

    // unadvise our event sink
    if (pCompartmentMgr->GetCompartment(c_guidMarkGlobalCompartment, &pCompartment) == S_OK)
    {
        UnadviseSink(pCompartment, &_dwGlobalCompartmentEventSinkCookie);
        pCompartment->Release();
    }

    // let the system free resources associated with the compartment on this
    // thread
    pCompartmentMgr->ClearCompartment(_tfClientId, c_guidMarkGlobalCompartment);

    pCompartmentMgr->Release();
}

void CMarkTextService::_UninitKeystrokeSink ( ) [private]

Definition at line 209 of file keys.cpp.

{
    ITfKeystrokeMgr *pKeystrokeMgr;

    if (_pThreadMgr->QueryInterface(IID_ITfKeystrokeMgr, (void **)&pKeystrokeMgr) != S_OK)
        return;

    pKeystrokeMgr->UnadviseKeyEventSink(_tfClientId);

    pKeystrokeMgr->Release();
}

void CMarkTextService::_UninitLanguageBar ( ) [private]

Definition at line 362 of file langbar.cpp.

{
    ITfLangBarItemMgr *pLangBarItemMgr;

    if (_pLangBarItem == NULL)
        return;

    if (_pThreadMgr->QueryInterface(IID_ITfLangBarItemMgr, (void **)&pLangBarItemMgr) == S_OK)
    {
        pLangBarItemMgr->RemoveItem(_pLangBarItem);
        pLangBarItemMgr->Release();
    }

    _pLangBarItem->Release();
    _pLangBarItem = NULL;
}

void CMarkTextService::_UninitThreadMgrSink ( ) [private]

Definition at line 106 of file tmgrsink.cpp.

{
    UnadviseSink(_pThreadMgr, &_dwThreadMgrEventSinkCookie);
}

void CMarkTextService::_UninitWorkerWnd ( ) [private]

Definition at line 426 of file property.cpp.

{
    if (_hWorkerWnd != NULL)
    {
        DestroyWindow(_hWorkerWnd);
        _hWorkerWnd = NULL;
    }
    UnregisterClass(c_szWorkerWndClass, g_hInst);
}

void CMarkTextService::_ViewCaseProperty | ( | TfEditCookie | ec,
 |  | ITfContext * | pContext
 | ) |  |

Definition at line 198 of file property.cpp.

{
    TF_SELECTION tfSelection;
    ITfProperty *pCaseProperty;
    ULONG cchRead;
    LONG cch;
    ULONG cFetched;
    ULONG i;
    VARIANT varValue;

    // get the case property
    if (pContext->GetProperty(c_guidCaseProperty, &pCaseProperty) != S_OK)
        return;

    // get the selection
    if (pContext->GetSelection(ec, TF_DEFAULT_SELECTION, 1, &tfSelection, &cFetched) != S_OK ||
        cFetched != 1)
    {
        // no selection or something went wrong
        tfSelection.range = NULL;
        goto Exit;
    }

    // grab the text
    if (tfSelection.range->GetText(ec, 0, _achDisplayText, ARRAYSIZE(_achDisplayText)-1, &cchRead) != S_OK)
        goto Exit;

    // prepare for the loop
    if (tfSelection.range->Collapse(ec, TF_ANCHOR_START) != S_OK)
        goto Exit;

    // get the property value char-by-char over the selection
    for (i=0; i < cchRead; i++)
    {
        // advance pRange for next iteration, cover the next char
        if (tfSelection.range->ShiftStartToRange(ec, tfSelection.range, TF_ANCHOR_END) != S_OK)
            break;
        if (tfSelection.range->ShiftEnd(ec, 1, &cch, NULL) != S_OK)
            break;
        if (cch != 1) // hit a region boundary?
            break;

        switch (pCaseProperty->GetValue(ec, tfSelection.range, &varValue))
        {
            case S_OK:
                // the property value has been set, use it
                // 'U' --> uppercase
                // 'L' --> lowercase
                _achDisplayPropertyText[i] = varValue.lVal ? 'U' : 'L';
                break;
            case S_FALSE:
                // no property value set, varValue.vt == VT_EMPTY
                // '?' --> no value
                _achDisplayPropertyText[i] = '?';
                break;
            default:
                // error
                // '!' --> error
                _achDisplayPropertyText[i] = '!';
                break;
        }
    }
    for (; i<cchRead; i++) // error case
    {
        _achDisplayPropertyText[i] = '!';
    }

    _achDisplayPropertyText[cchRead] = '\0';
    _achDisplayText[cchRead] = '\0';

    // we can't change the focus while holding a lock
    // so postpone the UI until we've released our lock
    PostMessage(_hWorkerWnd, CMarkTextService::WM_DISPLAY_PROPERTY, 0, 0);

Exit:
    SafeRelease(tfSelection.range);
    pCaseProperty->Release();
}

void CMarkTextService::_ViewCustomProperty | ( | TfEditCookie | ec,
 |  | ITfContext * | pContext
 | ) |  |

Definition at line 299 of file property.cpp.

{
    TF_SELECTION tfSelection;
    ITfProperty *pCustomProperty;
    ITfRange *pSelRange;
    ITfRange *pPropertySpanRange;
    ULONG cchRead;
    ULONG cFetched;
    LONG cch;
    VARIANT varValue;
    HRESULT hr;

    // get the case property
    if (pContext->GetProperty(c_guidCustomProperty, &pCustomProperty) != S_OK)
        return;

    // get the selection
    if (pContext->GetSelection(ec, TF_DEFAULT_SELECTION, 1, &tfSelection, &cFetched) != S_OK ||
        cFetched != 1)
    {
        // no selection or something went wrong
        pSelRange = NULL;
        goto Exit;
    }
    // free up tfSelection so we can re-use it below
    pSelRange = tfSelection.range;

    // the selection may not exactly match a span of text covered by the
    // custom property....so we'll return the value over the start anchor of
    // the selection.

    // we need to collapse the range because GetValue will return VT_EMPTY
    // if the query range is not completely covered by the property span
    if (pSelRange->Collapse(ec, TF_ANCHOR_START) != S_OK)
        goto Exit;
    // the query range must also cover at least one char
    if (pSelRange->ShiftEnd(ec, 1, &cch, NULL) != S_OK)
        goto Exit;

    hr = pCustomProperty->GetValue(ec, pSelRange, &varValue);

    switch (hr)
    {
        case S_OK:
            // there's a value at the selection start anchor
            // let's find out exactly what text is covered
            _achDisplayText[0] = '\0';
            if (pCustomProperty->FindRange(ec, pSelRange, &pPropertySpanRange, TF_ANCHOR_START) == S_OK)
            {
                if (pPropertySpanRange->GetText(ec, 0, _achDisplayText, ARRAYSIZE(_achDisplayText)-1, &cchRead) != S_OK)
                {
                    cchRead = 0;
                }
                _achDisplayText[cchRead] = '\0';
                // let's update the selection to give the user feedback
                tfSelection.range = pPropertySpanRange;
                pContext->SetSelection(ec, 1, &tfSelection);
                pPropertySpanRange->Release();
            }
            // write the value
            wsprintfW(_achDisplayPropertyText, L"%i", varValue.lVal);
            break;

        case S_FALSE:
            // the property has no value, varValue.vt == VT_EMPTY
            _achDisplayText[0] = '\0';
            SafeStringCopy(_achDisplayPropertyText, ARRAYSIZE(_achDisplayPropertyText), L"- No Value -");
            break;
        default:
            goto Exit; // error
    }

    // we can't change the focus while holding a lock
    // so postpone the UI until we've released our lock
    PostMessage(_hWorkerWnd, CMarkTextService::WM_DISPLAY_PROPERTY, 0, 0);

Exit:
    SafeRelease(pSelRange);
    pCustomProperty->Release();
}

LRESULT CALLBACK CMarkTextService::_WorkerWndProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static, private]

Definition at line 443 of file property.cpp.

{
    CMarkTextService *_this;
    int cch;
    char achText[128];

    switch (uMsg)
    {
        case WM_CREATE:
            // save the this pointer we originally passed into CreateWindow
            SetWindowLongPtr(hWnd, GWLP_USERDATA,
                             (LONG_PTR)((CREATESTRUCT *)lParam)->lpCreateParams);
            return 0;

        case WM_DISPLAY_PROPERTY:
            _this = (CMarkTextService *)GetWindowLongPtr(hWnd, GWLP_USERDATA);

            // bring up a message box with the contents of _achDisplayText

            // first, convert from unicode
            cch = WideCharToMultiByte(CP_ACP, 0, _this->_achDisplayText, wcslen(_this->_achDisplayText),
                                      achText, ARRAYSIZE(achText)-1, NULL, NULL);

            if (cch < ARRAYSIZE(achText) - 1)
            {
                achText[cch++] = '\n';
            }
            if (cch < ARRAYSIZE(achText) - 1)
            {
                cch += WideCharToMultiByte(CP_ACP, 0, _this->_achDisplayPropertyText, wcslen(_this->_achDisplayPropertyText),
                                           achText+cch, ARRAYSIZE(achText)-cch-1, NULL, NULL);
            }
            achText[cch] = '\0';

            // bring up the display
            MessageBoxA(NULL, achText, "Property View", MB_OK);

            return 0;
    }

    return DefWindowProc(hWnd, uMsg, wParam, lParam);
}

STDAPI CMarkTextService::Activate | ( | ITfThreadMgr * | pThreadMgr,
 |  | TfClientId | tfClientId
 | ) |  |

Definition at line 178 of file mark.cpp.

{
    _pThreadMgr = pThreadMgr;
    _pThreadMgr->AddRef();

    _tfClientId = tfClientId;

    if (!_InitLanguageBar())
        goto ExitError;

    if (!_InitThreadMgrSink())
        goto ExitError;

    if (!_InitDisplayAttributeGuidAtom())
        goto ExitError;

    if (!_InitCleanupContextDurationSink())
        goto ExitError;

    if (!_InitGlobalCompartment())
        goto ExitError;

    if (!_InitWorkerWnd())
        goto ExitError;

    if (!_InitKeystrokeSink())
        goto ExitError;

    return S_OK;

ExitError:
    Deactivate(); // cleanup any half-finished init
    return E_FAIL;
}

HRESULT CMarkTextService::CreateInstance | ( | IUnknown * | pUnkOuter,
 |  | REFIID | riid,
 |  | void ** | ppvObj |
 | ) |  |  | [static]

Definition at line 17 of file mark.cpp.

{
    CMarkTextService *pMark;
    HRESULT hr;

    if (ppvObj == NULL)
        return E_INVALIDARG;

    *ppvObj = NULL;

    if (NULL != pUnkOuter)
        return CLASS_E_NOAGGREGATION;

    if ((pMark = new CMarkTextService) == NULL)
        return E_OUTOFMEMORY;

    hr = pMark->QueryInterface(riid, ppvObj);

    pMark->Release(); // caller still holds ref if hr == S_OK

    return hr;
}

STDAPI CMarkTextService::CreatePropertyStore | ( | REFGUID | guidProperty,
 |  | ITfRange * | pRange,
 |  | ULONG | cb,
 |  | IStream * | pStream,
 |  | ITfPropertyStore ** | ppStore
 | ) |  |

Definition at line 253 of file pstore.cpp.

{
    CCustomPropertyStore *pStore;
    DWORD dwState;

    *ppStore = NULL;

    if (!IsEqualGUID(guidProperty, c_guidCustomProperty))
        return E_INVALIDARG;

    if (cb != sizeof(DWORD))
        return E_INVALIDARG;

    if ((pStore = new CCustomPropertyStore) == NULL)
        return E_OUTOFMEMORY;

    if (pStream->Read(&dwState, sizeof(DWORD), &cb) != S_OK || cb != sizeof(DWORD))
    {
        pStore->Release();
        return E_FAIL;
    }

    pStore->_SetState(dwState);
    *ppStore = pStore;

    return S_OK;
}

STDAPI CMarkTextService::Deactivate ( void )

Definition at line 219 of file mark.cpp.

{
    _UninitThreadMgrSink();
    _UninitLanguageBar();
    _UninitCleanupContextDurationSink();
    _UninitGlobalCompartment();
    _UninitWorkerWnd();
    _UninitKeystrokeSink();
    _InitTextEditSink(NULL);

    // we MUST release all refs to _pThreadMgr in Deactivate
    SafeReleaseClear(_pThreadMgr);

    _tfClientId = TF_CLIENTID_NULL;

    return S_OK;
}

STDAPI CMarkTextService::EnumDisplayAttributeInfo ( IEnumTfDisplayAttributeInfo ** ppEnum )

Definition at line 399 of file dap.cpp.

{
    CEnumDisplayAttributeInfo *pAttributeEnum;

    if (ppEnum == NULL)
        return E_INVALIDARG;

    *ppEnum = NULL;

    if ((pAttributeEnum = new CEnumDisplayAttributeInfo) == NULL)
        return E_OUTOFMEMORY;

    *ppEnum = pAttributeEnum;

    return S_OK;
}

STDAPI CMarkTextService::GetDisplayAttributeInfo | ( | REFGUID | guidInfo,
 |  | ITfDisplayAttributeInfo ** | ppInfo
 | ) |  |

Definition at line 422 of file dap.cpp.

{
    if (ppInfo == NULL)
        return E_INVALIDARG;

    *ppInfo = NULL;

    // unsupported GUID?
    if (!IsEqualGUID(guidInfo, c_guidMarkDisplayAttribute))
        return E_INVALIDARG;

    *ppInfo = &g_DisplayAttributeInfo;
    (*ppInfo)->AddRef();

    return S_OK;
}

STDAPI CMarkTextService::IsStoreSerializable | ( | REFGUID | guidProperty,
 |  | ITfRange * | pRange,
 |  | ITfPropertyStore * | pPropertyStore,
 |  | BOOL * | pfSerializable
 | ) |  |

Definition at line 239 of file pstore.cpp.

{
    // we don't have any complicated logic, we'll let all our custom property values be serialized
    *pfSerializable = IsEqualGUID(guidProperty, c_guidCustomProperty);
    return S_OK;
}

STDAPI CMarkTextService::OnChange ( REFGUID rguidCompartment )

Definition at line 211 of file compart.cpp.

{
    // nothing to do in this sample
    return S_OK;
}

STDAPI CMarkTextService::OnCleanupContext | ( | TfEditCookie | ecWrite,
 |  | ITfContext * | pContext
 | ) |  |

Definition at line 60 of file cleanup.cpp.

{
    // this sample has nothing to do here...a real text service wouldn't bother
    // to advise the sink in the first place if it took no action
    return S_OK;
}

STDAPI CMarkTextService::OnCompositionTerminated | ( | TfEditCookie | ecWrite,
 |  | ITfComposition * | pComposition
 | ) |  |

Definition at line 223 of file compose.cpp.

{
    // we already have the composition cached, so we can ignore pComposition...

    // all this service wants to do is clear the display property
    _ClearCompositionDisplayAttributes(ecWrite);

    // releae our cached composition
    SafeReleaseClear(_pComposition);

    return S_OK;
}

STDAPI CMarkTextService::OnEndCleanupContext ( )

Definition at line 34 of file cleanup.cpp.

{
    _fCleaningUp = FALSE;
    return S_OK;
}

STDAPI CMarkTextService::OnEndEdit | ( | ITfContext * | pContext,
 |  | TfEditCookie | ecReadOnly,
 |  | ITfEditRecord * | pEditRecord
 | ) |  |

Definition at line 17 of file editsink.cpp.

{
    ITfRange *pRangeComposition;
    IEnumTfRanges *pEnumRanges;
    ITfRange *pRange;
    ITfContext *pCompositionContext;
    TF_SELECTION tfSelection;
    BOOL fResult;
    BOOL fCancelComposition;
    ULONG cFetched;

    if (_pComposition == NULL)
        return S_OK;

    // are we responsible for the edit?
    if (pContext->InWriteSession(_tfClientId, &fResult) == S_OK && fResult)
        return S_OK;

    // is this the context our composition lives in?
    if (_pComposition->GetRange(&pRangeComposition) != S_OK)
        return S_OK;

    if (pRangeComposition->GetContext(&pCompositionContext) != S_OK)
        goto Exit;

    fResult = IsEqualUnknown(pCompositionContext, pContext);

    pCompositionContext->Release();

    if (!fResult)
        goto Exit; // different context

    fCancelComposition = FALSE;

    // we're composing in this context, cancel the composition if anything suspicious happened

    // did the selection move outside the composition?
    if (pEditRecord->GetSelectionStatus(&fResult) == S_OK && fResult)
    {
        if (pContext->GetSelection(ecReadOnly, TF_DEFAULT_SELECTION, 1, &tfSelection, &cFetched) == S_OK &&
            cFetched == 1)
        {
            if (_pComposition->GetRange(&pRangeComposition) == S_OK)
            {
                fResult = IsRangeCovered(ecReadOnly, tfSelection.range, pRangeComposition);

                pRangeComposition->Release();

                if (!fResult)
                {
                    fCancelComposition = TRUE;
                }
            }
            tfSelection.range->Release();
        }
    }

    if (fCancelComposition)
        goto CancelComposition;

    // did someone else edit the document text?
    if (pEditRecord->GetTextAndPropertyUpdates(TF_GTP_INCL_TEXT, NULL, 0, &pEnumRanges) == S_OK)
    {
        // is the enumerator empty?
        if (pEnumRanges->Next(1, &pRange, NULL) == S_OK)
        {
            pRange->Release();
            fCancelComposition = TRUE;
        }
        pEnumRanges->Release();
    }

    if (fCancelComposition)
    {
CancelComposition:
        // we need a write edit session to cancel the composition
        _TerminateCompositionInContext(pContext);
    }

Exit:
    pRangeComposition->Release();
    return S_OK;
}

STDAPI CMarkTextService::OnInitDocumentMgr ( ITfDocumentMgr * pDocMgr )

Definition at line 18 of file tmgrsink.cpp.

{
    return S_OK;
}

STDAPI CMarkTextService::OnKeyDown | ( | ITfContext * | pContext,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL * | pfEaten
 | ) |  |

Definition at line 258 of file keys.cpp.

{
    CKeystrokeEditSession *pEditSession;
    HRESULT hr;

    hr = E_FAIL;
    *pfEaten = FALSE;

    if (_pComposition != NULL) // only eat keys while composing
    {
        // we'll insert a char ourselves in place of this keystroke
        if ((pEditSession = new CKeystrokeEditSession(this, pContext, wParam)) == NULL)
            goto Exit;

        // we need a lock to do our work
        // nb: this method is one of the few places where it is legal to use
        // the TF_ES_SYNC flag
        if (pContext->RequestEditSession(_tfClientId, pEditSession, TF_ES_SYNC | TF_ES_READWRITE, &hr) != S_OK)
        {
            hr = E_FAIL;
        }

        pEditSession->Release();
    }

Exit:
    // if we made it all the way to the RequestEditSession, then hr is ultimately the
    // return code from CKeystrokeEditSession::DoEditSession.  Our DoEditSession method
    // return S_OK to signal that the keystroke should be eaten, S_FALSE otherwise.
    if (hr == S_OK)
    {
        *pfEaten = TRUE;
    }
    return S_OK;
}

STDAPI CMarkTextService::OnKeyUp | ( | ITfContext * | pContext,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL * | pfEaten
 | ) |  |

Definition at line 339 of file keys.cpp.

{
    *pfEaten = FALSE;
    return S_OK;
}

STDAPI CMarkTextService::OnPopContext ( ITfContext * pContext )

Definition at line 78 of file tmgrsink.cpp.

{
    _UninitCleanupContextSink(pContext);
    _UninitCompartment(pContext);

    return S_OK;
}

STDAPI CMarkTextService::OnPreservedKey | ( | ITfContext * | pContext,
 |  | REFGUID | rguid,
 |  | BOOL * | pfEaten
 | ) |  |

Definition at line 352 of file keys.cpp.

{
    *pfEaten = FALSE;
    return S_OK;
}

STDAPI CMarkTextService::OnPushContext ( ITfContext * pContext )

Definition at line 59 of file tmgrsink.cpp.

{
    // ignore new contexts that appear while were uninitializing
    if (!_fCleaningUp)
    {
        _InitCleanupContextSink(pContext);
        _InitContextCompartment(pContext);
    }

    return S_OK;
}

STDAPI CMarkTextService::OnSetFocus ( BOOL fForeground )

Definition at line 228 of file keys.cpp.

{
    return S_OK;
}

STDAPI CMarkTextService::OnSetFocus | ( | ITfDocumentMgr * | pDocMgrFocus,
 |  | ITfDocumentMgr * | pDocMgrPrevFocus
 | ) |  |

Definition at line 45 of file tmgrsink.cpp.

{
    // we'll track edit changes in the focus document, the only place we start compositions
    _InitTextEditSink(pDocMgrFocus);
    return S_OK;
}

STDAPI CMarkTextService::OnStartCleanupContext ( )

Definition at line 21 of file cleanup.cpp.

{
    _fCleaningUp = TRUE;
    return S_OK;
}

STDAPI CMarkTextService::OnTestKeyDown | ( | ITfContext * | pContext,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL * | pfEaten
 | ) |  |

Definition at line 240 of file keys.cpp.

{
    *pfEaten = (_pComposition != NULL);
    return S_OK;
}

STDAPI CMarkTextService::OnTestKeyUp | ( | ITfContext * | pContext,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL * | pfEaten
 | ) |  |

Definition at line 325 of file keys.cpp.

{
    *pfEaten = FALSE;
    return S_OK;
}

STDAPI CMarkTextService::OnUninitDocumentMgr ( ITfDocumentMgr * pDocMgr )

Definition at line 31 of file tmgrsink.cpp.

{
    return S_OK;
}

STDAPI CMarkTextService::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppvObj
 | ) |  |

Definition at line 90 of file mark.cpp.

{
    if (ppvObj == NULL)
        return E_INVALIDARG;

    *ppvObj = NULL;

    if (IsEqualIID(riid, IID_IUnknown) ||
        IsEqualIID(riid, IID_ITfTextInputProcessor))
    {
        *ppvObj = (ITfTextInputProcessor *)this;
    }
    else if (IsEqualIID(riid, IID_ITfDisplayAttributeProvider))
    {
        *ppvObj = (ITfDisplayAttributeProvider *)this;
    }
    else if (IsEqualIID(riid, IID_ITfCreatePropertyStore))
    {
        *ppvObj = (ITfCreatePropertyStore *)this;
    }
    else if (IsEqualIID(riid, IID_ITfThreadMgrEventSink))
    {
        *ppvObj = (ITfThreadMgrEventSink *)this;
    }
    else if (IsEqualIID(riid, IID_ITfTextEditSink))
    {
        *ppvObj = (ITfTextEditSink *)this;
    }
    else if (IsEqualIID(riid, IID_ITfCleanupContextSink))
    {
        *ppvObj = (ITfCleanupContextSink *)this;
    }
    else if (IsEqualIID(riid, IID_ITfCleanupContextDurationSink))
    {
        *ppvObj = (ITfCleanupContextDurationSink *)this;
    }
    else if (IsEqualIID(riid, IID_ITfCompartmentEventSink))
    {
        *ppvObj = (ITfCompartmentEventSink *)this;
    }

    if (*ppvObj)
    {
        AddRef();
        return S_OK;
    }

    return E_NOINTERFACE;
}

BOOL CMarkTextService::RegisterCategories ( BOOL fRegister ) [static]

Definition at line 104 of file register.cpp.

{
    ITfCategoryMgr *pCategoryMgr;
    int i;
    HRESULT hr;

    hr = CoCreateInstance(CLSID_TF_CategoryMgr, NULL, CLSCTX_INPROC_SERVER,
                          IID_ITfCategoryMgr, (void**)&pCategoryMgr);

    if (hr != S_OK)
        return FALSE;

    for (i=0; i<ARRAYSIZE(c_rgCategories); i++)
    {
        if (fRegister)
        {
            hr = pCategoryMgr->RegisterCategory(c_clsidMarkTextService,
                   *c_rgCategories[i].pguidCategory, *c_rgCategories[i].pguid);
        }
        else
        {
            hr = pCategoryMgr->UnregisterCategory(c_clsidMarkTextService,
                   *c_rgCategories[i].pguidCategory, *c_rgCategories[i].pguid);
        }

        if (hr != S_OK)
            break;
    }

    pCategoryMgr->Release();
    return (hr == S_OK);
}

BOOL CMarkTextService::RegisterProfiles ( ) [static]

Definition at line 38 of file register.cpp.

{
    ITfInputProcessorProfiles *pInputProcessProfiles;
    WCHAR achIconFile[MAX_PATH];
    char achFileNameA[MAX_PATH];
    DWORD cchA;
    int cchIconFile;
    HRESULT hr;

    hr = CoCreateInstance(CLSID_TF_InputProcessorProfiles, NULL, CLSCTX_INPROC_SERVER,
                          IID_ITfInputProcessorProfiles, (void**)&pInputProcessProfiles);

    if (hr != S_OK)
        return E_FAIL;

    hr = pInputProcessProfiles->Register(c_clsidMarkTextService);

    if (hr != S_OK)
        goto Exit;

    cchA = GetModuleFileNameA(g_hInst, achFileNameA, ARRAYSIZE(achFileNameA));

    cchIconFile = MultiByteToWideChar(CP_ACP, 0, achFileNameA, cchA, achIconFile, ARRAYSIZE(achIconFile)-1);
    achIconFile[cchIconFile] = '\0';

    hr = pInputProcessProfiles->AddLanguageProfile(c_clsidMarkTextService,
                                  MARK_LANGID,
                                  c_guidMarkProfile,
                                  MARK_DESC,
                                  wcslen(MARK_DESC),
                                  achIconFile,
                                  cchIconFile,
                                  MARK_ICON_INDEX);

Exit:
    pInputProcessProfiles->Release();
    return (hr == S_OK);
}

BOOL CMarkTextService::RegisterServer ( void ) [static]

Definition at line 213 of file register.cpp.

{
    DWORD dw;
    HKEY hKey;
    HKEY hSubKey;
    BOOL fRet;
    TCHAR achIMEKey[ARRAYSIZE(c_szInfoKeyPrefix) + CLSID_STRLEN];
    TCHAR achFileName[MAX_PATH];

    if (!CLSIDToStringA(c_clsidMarkTextService, achIMEKey + ARRAYSIZE(c_szInfoKeyPrefix) - 1))
        return FALSE;
    memcpy(achIMEKey, c_szInfoKeyPrefix, sizeof(c_szInfoKeyPrefix)-sizeof(TCHAR));

    if (fRet = RegCreateKeyEx(HKEY_CLASSES_ROOT, achIMEKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, &dw)
            == ERROR_SUCCESS)
    {
        fRet &= RegSetValueEx(hKey, NULL, 0, REG_SZ, (BYTE *)MARK_DESC_A, (lstrlen(MARK_DESC_A)+1)*sizeof(TCHAR))
            == ERROR_SUCCESS;

        if (fRet &= RegCreateKeyEx(hKey, c_szInProcSvr32, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hSubKey, &dw)
            == ERROR_SUCCESS)
        {
            dw = GetModuleFileNameA(g_hInst, achFileName, ARRAYSIZE(achFileName));

            fRet &= RegSetValueEx(hSubKey, NULL, 0, REG_SZ, (BYTE *)achFileName, (lstrlen(achFileName)+1)*sizeof(TCHAR)) == ERROR_SUCCESS;
            fRet &= RegSetValueEx(hSubKey, c_szModelName, 0, REG_SZ, (BYTE *)MARK_MODEL, (lstrlen(MARK_MODEL)+1)*sizeof(TCHAR)) == ERROR_SUCCESS;
            RegCloseKey(hSubKey);
        }
        RegCloseKey(hKey);
    }

    return fRet;
}

CMarkTextService::STDMETHODIMP_ ( ULONG )
CMarkTextService::STDMETHODIMP_ ( ULONG )
void CMarkTextService::UnregisterProfiles ( ) [static]

Definition at line 83 of file register.cpp.

{
    ITfInputProcessorProfiles *pInputProcessProfiles;
    HRESULT hr;

    hr = CoCreateInstance(CLSID_TF_InputProcessorProfiles, NULL, CLSCTX_INPROC_SERVER,
                          IID_ITfInputProcessorProfiles, (void**)&pInputProcessProfiles);

    if (hr != S_OK)
        return;

    pInputProcessProfiles->Unregister(c_clsidMarkTextService);
    pInputProcessProfiles->Release();
}

void CMarkTextService::UnregisterServer ( void ) [static]

Definition at line 253 of file register.cpp.

{
    TCHAR achIMEKey[ARRAYSIZE(c_szInfoKeyPrefix) + CLSID_STRLEN];

    if (!CLSIDToStringA(c_clsidMarkTextService, achIMEKey + ARRAYSIZE(c_szInfoKeyPrefix) - 1))
        return;
    memcpy(achIMEKey, c_szInfoKeyPrefix, sizeof(c_szInfoKeyPrefix)-sizeof(TCHAR));

    RecurseDeleteKey(HKEY_CLASSES_ROOT, achIMEKey);
}

Member Data Documentation

WCHAR CMarkTextService::_achDisplayPropertyText[64] [private]

Definition at line 184 of file mark.h.

WCHAR CMarkTextService::_achDisplayText[64] [private]

Definition at line 183 of file mark.h.

LONG CMarkTextService::_cRef [private]

Definition at line 186 of file mark.h.

DWORD CMarkTextService::_dwGlobalCompartmentEventSinkCookie [private]

Definition at line 177 of file mark.h.

DWORD CMarkTextService::_dwTextEditSinkCookie [private]

Definition at line 176 of file mark.h.

DWORD CMarkTextService::_dwThreadFocusSinkCookie [private]

Definition at line 175 of file mark.h.

DWORD CMarkTextService::_dwThreadMgrEventSinkCookie [private]

Definition at line 174 of file mark.h.

BOOL CMarkTextService::_fCleaningUp [private]

Definition at line 168 of file mark.h.

TfGuidAtom CMarkTextService::_gaDisplayAttribute [private]

Definition at line 170 of file mark.h.

HWND CMarkTextService::_hWorkerWnd [private]

Definition at line 181 of file mark.h.

ITfComposition* CMarkTextService::_pComposition [private]

Definition at line 166 of file mark.h.

CLangBarItemButton* CMarkTextService::_pLangBarItem [private]

Definition at line 172 of file mark.h.

ITfContext* CMarkTextService::_pTextEditSinkContext [private]

Definition at line 179 of file mark.h.

ITfThreadMgr* CMarkTextService::_pThreadMgr [private]

Definition at line 163 of file mark.h.

TfClientId CMarkTextService::_tfClientId [private]

Definition at line 164 of file mark.h.

The documentation for this class was generated from the following files:
  • WinUI/TSFmark/mark.h
  • WinUI/TSFmark/cleanup.cpp
  • WinUI/TSFmark/compart.cpp
  • WinUI/TSFmark/compose.cpp
  • WinUI/TSFmark/dap.cpp
  • WinUI/TSFmark/editsink.cpp
  • WinUI/TSFmark/keys.cpp
  • WinUI/TSFmark/langbar.cpp
  • WinUI/TSFmark/mark.cpp
  • WinUI/TSFmark/property.cpp
  • WinUI/TSFmark/pstore.cpp
  • WinUI/TSFmark/register.cpp
  • WinUI/TSFmark/tmgrsink.cpp
Generated on Wed Nov 13 2024 16:56:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMD_ARGS Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

CMD_ARGS Struct Reference

List of all members.

Public Attributes

DWORD dwAddress
DWORD dwBPType

Detailed Description

Definition at line 28 of file DbgCmd.c.

Member Data Documentation

DWORD CMD_ARGS::dwAddress

Definition at line 29 of file DbgCmd.c.

DWORD CMD_ARGS::dwBPType

Definition at line 30 of file DbgCmd.c.

The documentation for this struct was generated from the following file:
  • WinBase/Debug/BPSamp/DbgCmd.c
Generated on Wed Nov 13 2024 16:56:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMDIChild Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes

CMDIChild Class Reference

#include "cmdichild.h"

Inherits CMDIChildLite.

List of all members.

Public Member Functions

CMDIChild (CMainWindow *pCMainWindow)
virtual | ~CMDIChild ()
virtual BOOL | AutoPosition (BOOL fDefaultPosition=TRUE)
virtual HRESULT | ChangeSelectedRow (CBase *pCSource, UINT idSource)
virtual HRESULT | CreateEnumChild ()
virtual HRESULT | DeleteSelectedRows ()
virtual INT_PTR | DisplayDialog (UINT uID, HWND hWndParent, DLGPROC lpDialogFunc, CBase *pCObject, UINT idSource=0)
virtual HRESULT | GetChapteredChild (INDEX iSelectedCol, const DBBINDING *pBinding, REFIID riid=IID_IRowset)
virtual HRESULT | GetListViewValues (HWND hWndNames, HWND hWndValues, CDataAccess *pCDataAccess, CBindings &rBindings, void *pData)
virtual CBase * | GetObject (SOURCE eSource=eCUnknown, BOOL fAlways=FALSE)
virtual CBase ** | GetObjectAddress (SOURCE eSource=eCUnknown)
virtual COptionsSheet * | GetOptions ()
virtual HRESULT | HandleRowset (CBase *pCSource, IUnknown *pIUnknown, REFIID riid, DWORD dwFlags, REFGUID guidSource, WCHAR *pwszTableName=NULL, BOOL fSchemaRowset=FALSE)
virtual HRESULT | InsertNewRow ()
virtual BOOL | OnClose ()
virtual BOOL | OnCommand (UINT iID, HWND hWndCtrl)
virtual BOOL | OnCreate (LPCREATESTRUCT lpCreateStruct)
virtual BOOL | OnDestroy ()
virtual BOOL | OnInitialUpdate ()
virtual BOOL | OnMDIActivate (BOOL bActivate, HWND hWndActivate, HWND hWndDeactivate)
virtual BOOL | OnNotify (INT idCtrl, NMHDR *pNMHDR)
virtual BOOL | OnSetFocus (HWND hWndPrevFocus)
virtual BOOL | OnSize (WPARAM nType, REFPOINTS pts)
virtual BOOL | OnSizing (WPARAM nSide, REFPOINTS pts)
virtual BOOL | OnUpdateCommand (HMENU hMenu, UINT nID, DWORD *pdwFlags)
virtual void | SetConfig (WCHAR *pwszConfig, BOOL fCopy=TRUE)
virtual BOOL | SetupTransactionCombo (HWND hWnd)
virtual HRESULT | UndoChanges ()
virtual HRESULT | UpdateChanges ()
virtual BOOL | UpdateControls ()
virtual HRESULT | UpdateWndTitle ()

Static Public Member Functions

static INT_PTR WINAPI | AbortTransactionProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | AddColumnProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | AdminCreateDataSourceProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | CanConvertProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | ColumnChangeProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | CommandPersistProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | CommitTransactionProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | CreateAccessorProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | CreateIndexProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | CreateTableProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | DropColumnProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | DropConstraintProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | DropIndexProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | DropTableProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | ExecuteProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | FindNextRowProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | GetAxisInfoProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | GetAxisRowsetProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | GetBindingsProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | GetColInfoProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | GetColumnsRowsetProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | GetLiteralInfoProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | GetNextRowsProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | GetParameterInfoProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | GetReferencedRowsetProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | GetTransactionInfo (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | ISCO_DeleteProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | ISCO_Proc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | JoinTransactionProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | OpenRowsetProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | ProviderInfoProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | ReleaseTransaction (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | RowChangeProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | RowOpenProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | SetCommandTextProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | SetParameterInfoProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | SetTransactionOptionsProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | StartTransactionProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)

Public Attributes

CPropSets m_CDefPropSets
ULONG m_idSource
WPARAM | m_lastSizedEdge
CCommand * m_pCCommand
CDataAccess * m_pCDataAccess
CDataGrid * m_pCDataGrid
CDataSource * m_pCDataSource
CMainWindow * m_pCMainWindow
CMultipleResults * m_pCMultipleResults
CQueryBox * m_pCQueryBox
CSession * m_pCSession
CBase * m_pCSource
WCHAR * | m_pwszConfig

Static Public Attributes

static ULONG | m_iChildWindow = 0

Detailed Description

Definition at line 119 of file cmdichild.h.

Constructor & Destructor Documentation

CMDIChild::CMDIChild ( CMainWindow * pCMainWindow )

Definition at line 28 of file cmdichild.cpp.

{
  //Objects
  ASSERT(pCMainWindow);
  m_pCMainWindow = pCMainWindow;

  //Controls
  m_pCDataGrid      = new CDataGrid(this);
  m_pCQueryBox      = new CQueryBox(this);

  //Objects
  m_pCDataSource      = NULL;   //Deferred
  m_pCSession       = NULL;   //Deferred
  m_pCCommand       = NULL;   //Deferred
  m_pCMultipleResults   = NULL;   //Deferred
  m_pCDataAccess      = NULL;   //Deferred

  //Data
  m_lastSizedEdge = 0;
  m_iChildWindow++;
  m_pwszConfig  = NULL;

  //Only set these "Default" properties, if requested by the user
  if(GetOptions()->m_dwRowsetOpts & ROWSET_SETDEFAULTPROPS)
  {
    //DBPROP_CANHOLDROWS is required by the OLE DB Spec - Level-0 Conformance
    //Since it is also legal to set a ReadOnly property, just blindy set it...
    m_CDefPropSets.SetProperty(DBPROP_CANHOLDROWS, DBPROPSET_ROWSET, DBTYPE_BOOL, (void*)VARIANT_TRUE, DBPROPOPTIONS_REQUIRED);
  }
}

CMDIChild::~CMDIChild ( ) [virtual]

Definition at line 64 of file cmdichild.cpp.

{
  SAFE_RELEASE(m_pCDataAccess);
  SAFE_RELEASE(m_pCMultipleResults);
  SAFE_RELEASE(m_pCCommand);
  SAFE_RELEASE(m_pCSession);
  SAFE_RELEASE(m_pCDataSource);

  //Controls
  SAFE_DELETE(m_pCDataGrid);
  SAFE_DELETE(m_pCQueryBox);

  //Data
  m_iChildWindow--;
  SAFE_FREE(m_pwszConfig);
}

Member Function Documentation

INT_PTR WINAPI CMDIChild::AbortTransactionProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 5394 of file cmdichild.cpp.

{
  switch(message)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;

      //Save the "this" pointer
      CMDIChild*    pThis     = (CMDIChild*)SetThis(hWnd, (void*)lParam);
      HWND      hWndRetaining = ::GetDlgItem(hWnd, IDC_RETAINING);
      HWND      hWndAsynch    = ::GetDlgItem(hWnd, IDC_ASYNCH);

      //Need to fill in the RETAINING ComboBox
      INDEX iSel = (INDEX)SendMessage(hWndRetaining, CB_ADDSTRING,  0, (LPARAM)"TRUE");
      SendMessage(hWndRetaining, CB_SETITEMDATA, iSel, (LPARAM)TRUE);
      iSel = (INDEX)SendMessage(hWndRetaining, CB_ADDSTRING,  0, (LPARAM)"FALSE");
      SendMessage(hWndRetaining, CB_SETITEMDATA, iSel, (LPARAM)FALSE);
      //SetDefault - TRUE
      SendMessage(hWndRetaining, CB_SETCURSEL,  0, (LPARAM)0);

      //Need to fill in the ASYNCH ComboBox
      iSel = (INDEX)SendMessage(hWndAsynch, CB_ADDSTRING, 0, (LPARAM)"TRUE");
      SendMessage(hWndAsynch, CB_SETITEMDATA, iSel, (LPARAM)TRUE);
      iSel = (INDEX)SendMessage(hWndAsynch, CB_ADDSTRING, 0, (LPARAM)"FALSE");
      SendMessage(hWndAsynch, CB_SETITEMDATA, iSel, (LPARAM)FALSE);
      //SetDefault - FALSE
      SendMessage(hWndAsynch, CB_SETCURSEL, 1, 0);

      //Need to fill in the Txn ComboBox
      pThis->SetupTransactionCombo(::GetDlgItem(hWnd, IDC_TRANSACTION));

      CenterDialog(hWnd);
      return TRUE;
    }

    case WM_COMMAND:
    {
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDOK:
        {
          CWaitCursor waitCursor;

          //Get the "this" pointer
          CMDIChild*    pThis     = (CMDIChild*)GetThis(hWnd);

          ITransaction* pITransaction = NULL;
          HRESULT     hr        = S_OK;

          HWND      hWndRetaining = ::GetDlgItem(hWnd, IDC_RETAINING);
          HWND      hWndAsynch    = ::GetDlgItem(hWnd, IDC_ASYNCH);
          HWND      hWndTransaction = ::GetDlgItem(hWnd, IDC_TRANSACTION);

          //Just Need to Obtain selected RETAINING from Combo
          INDEX iSel = (INDEX)SendMessage(hWndRetaining, CB_GETCURSEL, 0, 0);
          BOOL fRetaining = (BOOL)SendMessage(hWndRetaining, CB_GETITEMDATA, iSel, 0);

          //Just Need to Obtain selected ASYNCH from Combo
          iSel = (INDEX)SendMessage(hWndAsynch, CB_GETCURSEL, 0, 0);
          BOOL fAsynch = (BOOL)SendMessage(hWndAsynch, CB_GETITEMDATA, iSel, 0);

          //get the ITransaction Pointer
          iSel = (INDEX)SendMessage(hWndTransaction, CB_GETCURSEL, 0, 0);
          if(iSel != CB_ERR)
            pITransaction = (ITransaction*)SendMessage(hWndTransaction, CB_GETITEMDATA, iSel, 0);

          //Obtain the Transaction interface
          if(!pITransaction)
            pITransaction = SOURCE_GETINTERFACE(pThis->m_pCSource, ITransaction);
          ASSERT(pITransaction);

          //Now Abort the Transaction
          XTEST(hr = pITransaction->Abort(NULL, fRetaining, fAsynch));
          TRACE_METHOD(hr, L"ITransaction::Abort(NULL, %s, %s)", fRetaining ? L"TRUE" : L"FALSE", fAsynch ? L"TRUE" : L"FALSE");

          if(SUCCEEDED(hr))
            EndDialog(hWnd, TRUE);
          return 0;
        }

        case IDCANCEL:
        {
          EndDialog(hWnd, FALSE);
          return 0;
        }
      }
      break;
    }//WM_COMMAND
  }
  return FALSE;
}

INT_PTR WINAPI CMDIChild::AddColumnProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 7324 of file cmdichild.cpp.

{
  static CComboBoxGuid  s_CComboInterface;
  static BOOL       fUseProps = TRUE; //Default to TRUE
  static WCHAR      wszBuffer[MAX_NAME_LEN+1];
  ULONG i;

  switch(message)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;

      //Save the "this" pointer
      CMDIChild* pThis = (CMDIChild*)SetThis(hWnd, (void*)lParam);
      CSession* pCSession = SOURCE_GETOBJECT(pThis->m_pCSource, CSession);
      INDEX iSel = 0;

      HWND hWndTableID  = ::GetDlgItem(hWnd, IDE_TABLEID);
      HWND hWndTypeName = ::GetDlgItem(hWnd, IDC_TYPENAME);
      HWND hWndDataType = ::GetDlgItem(hWnd, IDC_TYPE);
      HWND hWndSize   = ::GetDlgItem(hWnd, IDE_SIZE);
      HWND hWndPrecision  = ::GetDlgItem(hWnd, IDE_PRECISION);
      HWND hWndScale    = ::GetDlgItem(hWnd, IDE_SCALE);

      //Make sure we have the Provider Types rowset ahead of time
      pCSession->GetProviderTypes();

      //Fill In TableID as Default
      WCHAR* pwszTableName = pThis->m_pCQueryBox->GetSelectedText();
      wSendMessage(hWndTableID, WM_SETTEXT, 0, pwszTableName);

      //Fill In column size as Default
      wSendMessageFmt(hWndSize, WM_SETTEXT, 0, L"%d", 0);

      //Fill In column precision as Default
      wSendMessageFmt(hWndPrecision, WM_SETTEXT, 0, L"%d", 0);

      //Fill In column scale as Default
      wSendMessageFmt(hWndScale, WM_SETTEXT, 0, L"%d", 0);

      //Use Properties
            ::CheckDlgButton(hWnd, IDB_USEPROPERTIES,  BST2STATE(fUseProps));

      // Type Name list...
      for(i=0; i<pCSession->m_cProvTypes; i++)
      {
        //Type Name
        iSel = (INDEX)wSendMessage(hWndTypeName, CB_ADDSTRING,  0, pCSession->m_rgProvTypes[i].wszTypeName);
      }
      SendMessage(hWndTypeName, CB_SETCURSEL, 0, 0);

      // DBType list
      for(i=0; i<g_cDBTypes; i++)
      {
        //DBTypes
        iSel = (INDEX)wSendMessage(hWndDataType, CB_ADDSTRING,  0, g_rgDBTypes[i].pwszName);
      }
      SendMessage(hWndDataType, CB_SETCURSEL, 0, 0);

      for (i=0; i<g_cDBTypes; i++)
      {
        if (pCSession->m_rgProvTypes[0].wType == g_rgDBTypes[i].lItem)
        {
          SendMessage(hWndDataType, CB_SETCURSEL, i, 0);
          break;
        }
      }
      CenterDialog(hWnd);
      SAFE_FREE(pwszTableName);
      return TRUE;
    }

    case WM_COMMAND:
    {
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      //CBN_SELCHANGE
      switch(GET_WM_COMMAND_CMD(wParam, lParam))
      {
        //Selection change
        case CBN_SELCHANGE:
        {
          //See which combo box has changed
          switch(GET_WM_COMMAND_ID(wParam, lParam))
          {
            case IDC_TYPE:
            {
              CMDIChild   *pThis      = (CMDIChild*)GetThis(hWnd);
              CSession    *pCSession    = SOURCE_GETOBJECT(pThis->m_pCSource, CSession);
              HWND      hWndSize    = ::GetDlgItem(hWnd, IDE_SIZE);
              HWND      hWndPrecision = ::GetDlgItem(hWnd, IDE_PRECISION);
              HWND      hWndScale   = ::GetDlgItem(hWnd, IDE_SCALE);
              INDEX     iSelTypeName;
              HWND      hWndTypeName  = ::GetDlgItem(hWnd, IDC_TYPENAME);
              //Get the Selected Type
              CComboBoxLite comboTypes(hWnd, IDC_TYPE);
              comboTypes.GetSelText(wszBuffer, MAX_NAME_LEN);
              DBTYPE wType = GetDBType(wszBuffer);

              //Get Default Size,Prec,Scale for this type...
              DBLENGTH ulMaxSize = 0;
              BYTE  bPrecision, bScale;
              GetDBTypeMaxSize(wType, &ulMaxSize, &bPrecision, &bScale);

              //Set Size
              wSendMessageFmt(hWndSize,   WM_SETTEXT, 0, L"%lu", ulMaxSize!=0 ? ulMaxSize : 255);
              //Set Precision
              wSendMessageFmt(hWndPrecision,  WM_SETTEXT, 0, L"%d", bPrecision);
              //Set Scale
              wSendMessageFmt(hWndScale,    WM_SETTEXT, 0, L"%d", bScale);

              // determine a type on the DBTYPE
              for (i = 0; i < pCSession->m_cProvTypes; i++)
              {
                if (wType == pCSession->m_rgProvTypes[i].wType)
                  iSelTypeName = i;
              }
              SendMessage(hWndTypeName, CB_SETCURSEL, iSelTypeName, 0);

              return 0;
            }
            break;

            case IDC_TYPENAME:
            {
              CMDIChild*  pThis     = (CMDIChild*)GetThis(hWnd);
              CSession* pCSession   = SOURCE_GETOBJECT(pThis->m_pCSource, CSession);
              HWND    hWndTypeName  = ::GetDlgItem(hWnd, IDC_TYPENAME);
              HWND    hWndDataType  = ::GetDlgItem(hWnd, IDC_TYPE);
              HWND    hWndColSize   = ::GetDlgItem(hWnd, IDE_SIZE);
              HWND    hWndColPrec   = ::GetDlgItem(hWnd, IDE_PRECISION);
              HWND    hWndColScale  = ::GetDlgItem(hWnd, IDE_SCALE);
              INDEX   iSelTypeName  = (INDEX)SendMessage(hWndTypeName, CB_GETCURSEL, 0, 0);

              // retrieve the column type name and copy it to the COLUMN_TYPENAME field of the list view
              wSendMessage(hWndTypeName, CB_GETLBTEXT, (WPARAM)iSelTypeName, wszBuffer);
              if (iSelTypeName >= 0)
              {
                wSendMessage(hWndDataType, CB_SELECTSTRING, -1, GetDBTypeName(pCSession->m_rgProvTypes[iSelTypeName].wType));
                StringFormat(wszBuffer, NUMELE(wszBuffer), L"%lu", pCSession->m_rgProvTypes[iSelTypeName].ulColumnSize);
                wSendMessage(hWndColSize, WM_SETTEXT, 0, wszBuffer);
                if (IsNumericType(pCSession->m_rgProvTypes[iSelTypeName].wType))
                {
                  StringFormat(wszBuffer, NUMELE(wszBuffer), L"%lu", pCSession->m_rgProvTypes[iSelTypeName].ulColumnSize);
                  wSendMessage(hWndColPrec, WM_SETTEXT, 0, wszBuffer);
                }
                else
                {
                  SendMessage(hWndColPrec, WM_SETTEXT, 0, (LPARAM)"0");
                }
              }
            }
            break;

          }
          break;
        }

        return FALSE;
      }

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDB_SETPROPERTIES:
        {
          //Get the "this" pointer
          CMDIChild* pThis      = (CMDIChild*)GetThis(hWnd);
          CMainWindow* pCMainWindow = pThis->m_pCMainWindow;
          CDataSource* pCDataSource = SOURCE_GETPARENT(pThis->m_pCSource, CDataSource);

          CPropertiesDlg sCPropertiesDlg(pCMainWindow);
          sCPropertiesDlg.SetProperties(hWnd, &DBPROPSET_COLUMNALL, IID_IRowsetInfo, NULL, pCDataSource ? pCDataSource->m_pIDBProperties : NULL, &pThis->m_CDefPropSets);
          return 0;
        }

        case IDOK:
        {
          CWaitCursor waitCursor;

          //Get the "this" pointer
          CMDIChild*    pThis     = (CMDIChild*)GetThis(hWnd);
          CSession*   pCSession   = SOURCE_GETOBJECT(pThis->m_pCSource, CSession);

          HWND      hWndTableID   = ::GetDlgItem(hWnd, IDE_TABLEID);
          HWND      hWndColumnID  = ::GetDlgItem(hWnd, IDE_COLUMNID);
          HWND      hWndTypeName  = ::GetDlgItem(hWnd, IDC_TYPENAME);
          HWND      hWndSize    = ::GetDlgItem(hWnd, IDE_SIZE);
          HWND      hWndPrecision = ::GetDlgItem(hWnd, IDE_PRECISION);
          HWND      hWndScale   = ::GetDlgItem(hWnd, IDE_SCALE);
          WCHAR     wszTableDBID[MAX_QUERY_LEN+1];
          WCHAR     wszBuffer[MAX_NAME_LEN+1];
          HRESULT     hr        = S_OK;
          DBCOLUMNDESC  ColumnDesc;
          LONG      lValue;

          // initialize column desc stru
          memset(&ColumnDesc, 0, sizeof(DBCOLUMNDESC));

          // TableID
          DBID TableID;
          TableID.eKind = DBKIND_NAME;
          TableID.uName.pwszName = wGetWindowText(hWndTableID);
          DBIDToString(&TableID, wszTableDBID, MAX_QUERY_LEN);

          // ColumnID of ColumnDesc
          ColumnDesc.dbcid.eKind      = DBKIND_NAME;
          ColumnDesc.dbcid.uName.pwszName = wGetWindowText(hWndColumnID);

          // Column Size
          GetEditBoxValue(hWndSize, &lValue, 0, LONG_MAX, TRUE);
          ColumnDesc.ulColumnSize = lValue;

          // Column Precision
          GetEditBoxValue(hWndPrecision, &lValue, 0, 255, TRUE);
          ColumnDesc.bPrecision = (BYTE)lValue;

          // Column Scale
          GetEditBoxValue(hWndScale, &lValue, 0, 255, TRUE);
          ColumnDesc.bScale = (BYTE)lValue;

          //Use Properties
          fUseProps = ::IsDlgButtonChecked(hWnd, IDB_USEPROPERTIES);
          if(fUseProps)
          {
            ColumnDesc.cPropertySets = pThis->m_CDefPropSets.GetCount();
            ColumnDesc.rgPropertySets = pThis->m_CDefPropSets.GetPropSets();
          }

          // Type Name
          ColumnDesc.pwszTypeName = wGetWindowText(hWndTypeName);

          // DBType
          CComboBoxLite comboTypes(hWnd, IDC_TYPE);
          comboTypes.GetSelText(wszBuffer, MAX_NAME_LEN);
          ColumnDesc.wType = GetDBType(wszBuffer);

          // ITableDefinition::AddColumn
          XTEST(hr = pCSession->m_pITableDefinition->AddColumn(&TableID, &ColumnDesc, NULL));
          TESTC(TRACE_METHOD(hr, L"ITableDefinition::AddColumn(%s, 0x%p, NULL)", wszTableDBID, &ColumnDesc));
          if(SUCCEEDED(hr))
          {
            //Now just need to place this name in the EditBox
            //Inserted after the current "caret"
            pThis->m_pCQueryBox->ReplaceAll(TableID.uName.pwszName, FALSE/*bReplaceAll*/, TRUE/*fHighlight*/);
            EndDialog(hWnd, TRUE);
          }

          SAFE_FREE(TableID.uName.pwszName);
          SAFE_FREE(ColumnDesc.dbcid.uName.pwszName);
          SAFE_FREE(ColumnDesc.pwszTypeName);
          return 0;
        }

        case IDCANCEL:
        {
          EndDialog(hWnd, FALSE);
          return 0;
        }
      }
      break;
    }//WM_COMMAND
  }

CLEANUP:
  return FALSE;
} // CMDIChild::AddColumnProc

INT_PTR WINAPI CMDIChild::AdminCreateDataSourceProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 6733 of file cmdichild.cpp.

{
  static BOOL fUseProps = TRUE; //Default to TRUE

  static CPropSets      s_CAdminPropSets;
  static CComboBoxGuid    s_CComboInterface;
  static BOOL fAggregation  = FALSE;    //Default
  static BOOL fOutput     = TRUE;     //Default

  switch(message)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;

      //Save the "this" pointer
      CMDIChild* pThis = (CMDIChild*)SetThis(hWnd, (void*)lParam);

      //Use Properties
            ::CheckDlgButton(hWnd, IDB_USEPROPERTIES,  BST2STATE(fUseProps));
      //Reset our static properties...
      s_CAdminPropSets.RemoveAll();

      //Aggregation
            ::CheckDlgButton(hWnd, IDB_AGGREGATION,    BST2STATE(fAggregation));

      //Output (ppIUnknown)
            ::CheckDlgButton(hWnd, IDB_OUTPUT,     BST2STATE(fOutput));

      //Interface List...
      s_CComboInterface.CreateIndirect(hWnd, IDC_INTERFACE);
      s_CComboInterface.Populate(g_cInterfaceMaps, g_rgInterfaceMaps);
      if(s_CComboInterface.RestoreSelection() == CB_ERR)
        s_CComboInterface.SetGuid(IID_IOpenRowset);

      CenterDialog(hWnd);
      return TRUE;
    }

    case WM_COMMAND:
    {
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDB_SETPROPERTIES:
        {
          //Get the "this" pointer
          CMDIChild* pThis      = (CMDIChild*)GetThis(hWnd);
          CMainWindow* pCMainWindow = pThis->m_pCMainWindow;
          CDataSource* pCDataSource = SOURCE_GETOBJECT(pThis->m_pCSource, CDataSource);

          CPropertiesDlg sCPropertiesDlg(pCMainWindow);
          sCPropertiesDlg.SetProperties(hWnd, &DBPROPSET_DBINITALL, IID_IDBProperties, pCDataSource ? pCDataSource->m_pIDBProperties : NULL, pCDataSource ? pCDataSource->m_pIDBProperties : NULL, &s_CAdminPropSets);
          return 0;
        }

        case IDB_AGGREGATION:
        {
          //Aggregation Combo Selection has changed...
          //If we are now using Aggregation, automatically change the requested
          //riid to IID_IUnknown, since its an error otherwise...
          if(::IsDlgButtonChecked(hWnd, IDB_AGGREGATION))
            s_CComboInterface.SetGuid(IID_IUnknown);
          return 0;
        }

        case IDOK:
        {
          CWaitCursor waitCursor;

          //Get the "this" pointer
          CMDIChild* pThis      = (CMDIChild*)GetThis(hWnd);
          CDataSource* pCDataSource = SOURCE_GETOBJECT(pThis->m_pCSource, CDataSource);

          HRESULT hr = S_OK;

          ULONG cPropSets = 0;
          DBPROPSET* rgPropSets = NULL;
          IUnknown* pIUnknown = NULL;

          //Obtain the Aggregation argument
          CAggregate* pCAggregate = NULL;
          fAggregation = ::IsDlgButtonChecked(hWnd, IDB_AGGREGATION);
          if(fAggregation)
            pCAggregate = new CAggregate();

          //Obtain the Output (ppIUnknown) argument
          fOutput = ::IsDlgButtonChecked(hWnd, IDB_OUTPUT);

          //Interface
          REFIID riid = s_CComboInterface.GetGuid();

          //Use Properties
          fUseProps = ::IsDlgButtonChecked(hWnd, IDB_USEPROPERTIES);
          if(fUseProps)
          {
            cPropSets = s_CAdminPropSets.GetCount();
            rgPropSets = s_CAdminPropSets.GetPropSets();
          }

          //IDBDataSourceAdmin::CreateDataSource
          //NOTE: Our helper takes care of aggregation...
          hr = pCDataSource->AdminCreateDataSource(pCAggregate, cPropSets, rgPropSets, riid, fOutput ? &pIUnknown : NULL);

          //Display the Result
          if(SUCCEEDED(hr) && fOutput)
          {
            //Just pass in a guess for the object type and let our helper figure out what object it is...
            if(!pThis->m_pCMainWindow->HandleObjectType(pCDataSource, pIUnknown, riid, eCSession, 0, NULL, CREATE_NEWWINDOW_IFEXISTS))
              hr = E_FAIL;
          }

          //Release
          SAFE_RELEASE(pIUnknown);
          SAFE_RELEASE(pCAggregate);
          pThis->UpdateControls();

          if(SUCCEEDED(hr))
          {
            s_CAdminPropSets.RemoveAll();
            EndDialog(hWnd, TRUE);
            return 0;
          }
          return 0;
        }

        case IDCANCEL:
        {
          s_CAdminPropSets.RemoveAll();
          EndDialog(hWnd, FALSE);
          return 0;
        }
      }
      break;
    }//WM_COMMAND
  }

  return FALSE;
}

BOOL CMDIChild::AutoPosition ( BOOL fDefaultPosition = TRUE ) [virtual]

Reimplemented from CMDIChildLite.

Definition at line 128 of file cmdichild.cpp.

{
  if(fDefaultPosition || m_wndPlacement.length == 0)
  {
    //Default setting, upper right corner (3/4 of the client area)...
    SIZE sizeClient = GetClientSize(m_pCMainWindow->m_hWndMDIClient);
    return MoveWindow(m_hWnd, (INT)((float)sizeClient.cx * 0.25), 0, (INT)((float)sizeClient.cx * 0.75), (INT)((float)sizeClient.cy * 0.75), TRUE);
  }
  else
  {
    return SetWindowPlacement();
  }
}

INT_PTR WINAPI CMDIChild::CanConvertProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 6078 of file cmdichild.cpp.

{
  static DBTYPE wSavedFromType = 0;
  static DBTYPE wSavedToType = 0;

  static INDEX iSavedFromSel = 28;  //DBTYPE_WSTR
  static INDEX iSavedToSel = iSavedFromSel;

  //We have a problem with DBCONVERTFLAGS being orable, but _COLUMN == 0!
  //We will need to keep track of the 0 and non-0 flags,
  //inorder to restore the users previous selections correctly...
  static LONG fSelColumnFlag = TRUE;            //Default to COLUMN
  static LONG dwSavedConvFlags = DBCONVERTFLAGS_COLUMN; //Default to COLUMN

  switch(message)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;

      //Save the "this" pointer
      CMDIChild* pThis = (CMDIChild*)SetThis(hWnd, (void*)lParam);

      HWND hWndFromType = ::GetDlgItem(hWnd, IDC_FROMTYPE);
      HWND hWndToType   = ::GetDlgItem(hWnd, IDC_TOTYPE);
      HWND hWndConvFlags  = ::GetDlgItem(hWnd, IDL_CONVFLAGS);
      INDEX iSel = 0;

      const static WIDENAMEMAP rgConvertFlags[] =
      {
        VALUE_WCHAR(DBCONVERTFLAGS_COLUMN ),
        VALUE_WCHAR(DBCONVERTFLAGS_PARAMETER  ),
        VALUE_WCHAR(DBCONVERTFLAGS_ISLONG ),
        VALUE_WCHAR(DBCONVERTFLAGS_ISFIXEDLENGTH  ),
        VALUE_WCHAR(DBCONVERTFLAGS_FROMVARIANT  ),
      };

      //Need to fill in the From and To Type ComboBoxs
      for(ULONG i=0; i<g_cDBTypes; i++)
      {
        WCHAR* pwszName = g_rgDBTypes[i].pwszName;
        DBTYPE wType = (DBTYPE)g_rgDBTypes[i].lItem;

        //FromType
        iSel = (INDEX)wSendMessage(hWndFromType, CB_ADDSTRING,  0, pwszName);
        SendMessage(hWndFromType, CB_SETITEMDATA, iSel, (LPARAM)wType);
        //ToType
        iSel = (INDEX)wSendMessage(hWndToType, CB_ADDSTRING,  0, pwszName);
        SendMessage(hWndToType, CB_SETITEMDATA, iSel, (LPARAM)wType);
      }

      //Need to select Defaults
      SendMessage(hWndFromType, CB_SETCURSEL, iSavedFromSel, 0);
      SendMessage(hWndToType, CB_SETCURSEL, iSavedToSel, 0);

      //Need to also select Default Modifiers
            ::CheckDlgButton(hWnd, IDB_FROM_BYREF,   BST2STATE(wSavedFromType & DBTYPE_BYREF));
            ::CheckDlgButton(hWnd, IDB_FROM_ARRAY,   BST2STATE(wSavedFromType & DBTYPE_ARRAY));
            ::CheckDlgButton(hWnd, IDB_FROM_VECTOR,    BST2STATE(wSavedFromType & DBTYPE_VECTOR));
            ::CheckDlgButton(hWnd, IDB_TO_BYREF,   BST2STATE(wSavedToType & DBTYPE_BYREF));
            ::CheckDlgButton(hWnd, IDB_TO_ARRAY,   BST2STATE(wSavedToType & DBTYPE_ARRAY));
            ::CheckDlgButton(hWnd, IDB_TO_VECTOR,    BST2STATE(wSavedToType & DBTYPE_VECTOR));

      //Need to fill in the ConvertFlags (ListBox)
      SendMessage(hWndConvFlags, LB_RESETCONTENT, 0, 0);
      for(i=0; i<NUMELE(rgConvertFlags); i++)
      {
        INDEX iSel = (INDEX)wSendMessage(hWndConvFlags, LB_ADDSTRING, 0, rgConvertFlags[i].pwszName);
        SendMessage(hWndConvFlags,  LB_SETITEMDATA, iSel, (LPARAM)rgConvertFlags[i].lItem);

        //Select Saved ConvFlags
        if((dwSavedConvFlags & rgConvertFlags[i].lItem) || (fSelColumnFlag && rgConvertFlags[i].lItem == DBCONVERTFLAGS_COLUMN))
           SendMessage(hWndConvFlags, LB_SETSEL, TRUE, i);
      }

      CenterDialog(hWnd);
      return TRUE;
    }

    case WM_COMMAND:
    {
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDOK:
        {
          CWaitCursor waitCursor;

          //Get the "this" pointer
          CMDIChild* pThis      = (CMDIChild*)GetThis(hWnd);
          CDataAccess* pCDataAccess = NULL;
          HRESULT hr = S_OK;

          HWND hWndFromType = ::GetDlgItem(hWnd, IDC_FROMTYPE);
          HWND hWndToType   = ::GetDlgItem(hWnd, IDC_TOTYPE);
          HWND hWndConvFlags  = ::GetDlgItem(hWnd, IDL_CONVFLAGS);
          HWND hWndResult   = ::GetDlgItem(hWnd, IDT_RESULT);

          //Just Need to Obtain selected FromType from Combo
          iSavedFromSel = (INDEX)SendMessage(hWndFromType, CB_GETCURSEL, 0, 0);
          wSavedFromType = (DBTYPE)SendMessage(hWndFromType, CB_GETITEMDATA, iSavedFromSel, 0);

          //Need to obtain any type modifier for the FromType
          if(::IsDlgButtonChecked(hWnd, IDB_FROM_BYREF))
            wSavedFromType |= DBTYPE_BYREF;
          if(::IsDlgButtonChecked(hWnd, IDB_FROM_ARRAY))
            wSavedFromType |= DBTYPE_ARRAY;
          if(::IsDlgButtonChecked(hWnd, IDB_FROM_VECTOR))
            wSavedFromType |= DBTYPE_VECTOR;

          //Just Need to Obtain selected ToType from Combo
          iSavedToSel = (INDEX)SendMessage(hWndToType, CB_GETCURSEL, 0, 0);
          wSavedToType = (DBTYPE)SendMessage(hWndToType, CB_GETITEMDATA, iSavedToSel, 0);

          //Need to obtain any type modifier for the ToType
          if(::IsDlgButtonChecked(hWnd, IDB_TO_BYREF))
            wSavedToType |= DBTYPE_BYREF;
          if(::IsDlgButtonChecked(hWnd, IDB_TO_ARRAY))
            wSavedToType |= DBTYPE_ARRAY;
          if(::IsDlgButtonChecked(hWnd, IDB_TO_VECTOR))
            wSavedToType |= DBTYPE_VECTOR;

          //Obtain all Selected ConvertFlag items...
          INDEX iSelCount = (INDEX)SendMessage(hWndConvFlags, LB_GETSELCOUNT, 0, 0);
          ASSERT(iSelCount < 20);
          LONG rgSelItems[20];
          SendMessage(hWndConvFlags, LB_GETSELITEMS, (WPARAM)20, (LPARAM)rgSelItems);

          fSelColumnFlag = FALSE;
          dwSavedConvFlags = 0;
          for(LONG i=0; i<iSelCount; i++)
          {
            DWORD dwSelFlag = (DWORD)SendMessage(hWndConvFlags, LB_GETITEMDATA, rgSelItems[i], 0);
            if(dwSelFlag == DBCONVERTFLAGS_COLUMN)
              fSelColumnFlag = TRUE;
            dwSavedConvFlags |= dwSelFlag;
          }

          //Obtain the Correct IConvertType interface
          pCDataAccess = SOURCE_GETOBJECT(pThis->m_pCSource, CDataAccess);
          ASSERT(pCDataAccess);

          //Now Just call IConvertType::CanConvert
          ASSERT(pCDataAccess->m_pIConvertType);
          hr = pCDataAccess->m_pIConvertType->CanConvert(wSavedFromType, wSavedToType, dwSavedConvFlags);
          TRACE_METHOD(hr, L"IConvertType::CanConvert(%d=0x%08x, %d=0x%08x, 0x%08x)", wSavedFromType, wSavedFromType, wSavedToType, wSavedToType, dwSavedConvFlags);

          //Now display the results
          //We always want to display the result even on error...
          wSendMessageFmt(hWndResult, WM_SETTEXT, 0, L" %S", GetErrorName(hr));
          return 0;
        }

        case IDCANCEL:
        {
          EndDialog(hWnd, FALSE);
          return 0;
        }
      }
      break;
    }//WM_COMMAND
  }

  return FALSE;
}

HRESULT CMDIChild::ChangeSelectedRow | ( | CBase * | pCSource,
 |  | UINT | idSource |
 | ) |  |  | [virtual]

Definition at line 2236 of file cmdichild.cpp.

{
  //If this is a row object - theres only 1 row...
  if(SOURCE_GETOBJECT(pCSource, CRow))
  {
    m_pCDataGrid->m_iSelRow = 0;
  }
  else
  {
    //Otherwise find the Selected row
    m_pCDataGrid->m_iSelRow = m_pCDataGrid->GetSelectedRow(NULL, TRUE);
    if(m_pCDataGrid->m_iSelRow == LVM_ERR)
      return E_INVALIDARG;
  }

  //Create Dialog box, passing the "this" pointer
  //NOTE: m_pCSource and m_idSource are already setup...
  DisplayDialog(IDD_ROWCHANGE, m_hWnd, RowChangeProc, pCSource, idSource);
  return S_OK;
}

INT_PTR WINAPI CMDIChild::ColumnChangeProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 3046 of file cmdichild.cpp.

{
  static BOOL bBeginEdit = FALSE;
  static HACCESSOR hAccessor = NULL;
  static CListViewLite  s_listNames;
  static CListViewLite  s_listValue;

  switch(message)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;
      bBeginEdit = FALSE;
      WCHAR wszBuffer[MAX_COL_SIZE+1];
      DBLENGTH dbLength = 0;
      DBSTATUS dbStatus = 0;
      DBTYPE   wSubType = 0;

      //Save the "this" pointer
      CMDIChild* pThis  = (CMDIChild*)SetThis(hWnd, (void*)lParam);

      DWORD dwConvFlags = pThis->GetOptions()->m_dwConvFlags;
      INDEX i,iItemCount = 0;
      HRESULT hr = S_OK;

      //We need to bring up a 2 ListViews.
      //left - has column names,
      //right - is blank for entering data for the corrsponding column

      //Setup column headers
      s_listNames.CreateIndirect(hWnd, IDL_NAMES);
      s_listValue.CreateIndirect(hWnd, IDL_VALUES);

      //Use Extended ListView Styles!
      SendMessage(s_listNames.m_hWnd, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE , LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE);
      SendMessage(s_listValue.m_hWnd, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE , LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE);

      //Set image list to the ListView
      ListView_SetImageList(s_listValue.m_hWnd, ImageList_LoadImage(GetAppLite()->m_hInstance, MAKEINTRESOURCE(IDB_IMAGE), 16, 16, CLR_DEFAULT , IMAGE_BITMAP, LR_DEFAULTCOLOR), LVSIL_SMALL);
      ListView_SetImageList(s_listNames.m_hWnd, ImageList_LoadImage(GetAppLite()->m_hInstance, MAKEINTRESOURCE(IDB_IMAGE), 16, 16, CLR_DEFAULT , IMAGE_BITMAP, LR_DEFAULTCOLOR), LVSIL_SMALL);

      //Update Controls
            ::EnableWindow(::GetDlgItem(hWnd, IDB_CLEARALL), FALSE);

      //Determine the object type
      CRow* pCRow         = SOURCE_GETOBJECT(pThis->m_pCSource, CRow);
      CRowset* pCRowset     = SOURCE_GETOBJECT(pThis->m_pCSource, CRowset);
      CDataset* pCDataset     = SOURCE_GETOBJECT(pThis->m_pCSource, CDataset);
      CDataAccess* pCDataAccess = SOURCE_GETOBJECT(pThis->m_pCSource, CDataAccess);
      CDataGrid*  pCDataGrid    = pThis->m_pCDataGrid;

      //Update Title and Status
      switch(pThis->m_idSource)
      {
        case IDM_IROW_SETCOLUMNS:
          if(pCRow && pCRow->m_pIRowChange)
          {
            SendMessage(hWnd, WM_SETTEXT, 0, (LPARAM)"IRowChange::SetColumns");
            SendMessage(::GetDlgItem(hWnd, IDT_HELPMSG), WM_SETTEXT, 0, (LPARAM)"Modifies the row object columns");
            SendMessage(::GetDlgItem(hWnd, IDOK), WM_SETTEXT, 0, (LPARAM)"SetColumns");
          }
          break;

        case IDM_SETDATA:
          if(pCRowset && pCRowset->m_pIRowsetChange)
          {
            SendMessage(hWnd, WM_SETTEXT, 0, (LPARAM)"IRowsetChange::SetData");
            SendMessage(::GetDlgItem(hWnd, IDT_HELPMSG), WM_SETTEXT, 0, (LPARAM)"Modifies the row data in the Rowset");
            SendMessage(::GetDlgItem(hWnd, IDOK), WM_SETTEXT, 0, (LPARAM)"SetData");
          }
          break;
      };

      //Insert Column Headers
      s_listNames.InsertColumn(0, pCDataAccess->GetObjectType() == eCDataset ? L"  Cell Ordinal  " : L"  Row Handle  ");
      s_listNames.InsertColumn(1, L"Length");
      s_listNames.InsertColumn(2, L"Status");
      s_listNames.InsertColumn(3, L"Type");
      s_listNames.InsertColumn(4, L"SubType");

      const DBBINDING* pBinding   = &pCDataAccess->m_Bindings[pCDataGrid->m_iSelCol];
      const DBCOLUMNINFO* pColInfo  = pCDataAccess->m_ColumnInfo.GetOrdinal(pBinding->iOrdinal);
      void* pData           = pCDataAccess->m_pData;

      if(!pCRow)
      {
        //Create An Accessor binding only this column
        //Much quicker to get and set using only the column we need.
        hr = pCDataAccess->CreateAccessor(DBACCESSOR_ROWDATA, 1, pBinding, 0, &hAccessor);
        if(FAILED(hr))
          goto CLEANUP2;
      }

      //Column header is the ColumnName
      s_listValue.InsertColumn(0, GetColName(pColInfo), pCDataAccess->GetColumnImage(pColInfo));

      //Display Data in the ListView
      iItemCount = pCDataGrid->GetItemCount();
      for(i=0; i<iItemCount; i++)
      {
        //Get row handle for the selected row
        HROW hRow = pCDataGrid->GetItemParam(i);

        if(pCRow)
        {
          ULONG cColAccess = 1;
          DBCOLUMNACCESS* rgColAccess = &pCRow->m_rgColAccess[pCDataGrid->m_iSelCol];

          //GetColumn for this row object
          //Much quicker to get and set using only the column we need.
          hr = pCRow->GetColumns(cColAccess, rgColAccess);
        }
        else if(pCDataset)
        {
          //GetCellData
          //Note: the "hRow" stored in the listview is the index
          hr = pCDataset->GetCellData(hRow, hRow);
        }
        else if(pCRowset)
        {
          //GetData for this row from the rowset
          //Much quicker to get and set using only the column we need.
          hr = pCRowset->GetData(hRow, hAccessor, pData);
        }

        //Relax the errors here.  With Get*Data both DB_S/DB_E will return a bad
        //status for 1 or more columns.  Or DataGrid will just display the column
        //status if not S_OK.  So for these errors just display the data anyway...
        if(FAILED(hr) && hr!= DB_E_ERRORSOCCURRED)
          goto CLEANUP2;
        hr = S_OK;  //Otherwise dialog is not displayed

        //Get the Length, Status, Data for this Column
        pCDataAccess->GetColumnData(pBinding, pData, &dbStatus, &dbLength, &wSubType, wszBuffer, MAX_COL_SIZE, dwConvFlags, pColInfo->wType);

        //Insert the Data into the list (make an "easy" edit)
        s_listValue.InsertItem(i, 0, wszBuffer, (LPARAM)pColInfo->wType, pCDataAccess->GetColumnImage(pColInfo, dbStatus));

        //Display the hRow in the ListView
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"0x%p", hRow);
        s_listNames.InsertItem(i, 0, wszBuffer, 0, 0);

        //Insert the Length into the List
        if(LENGTH_IS_BOUND(*pBinding))
          StringFormat(wszBuffer, NUMELE(wszBuffer), L"%lu", dbLength);
        else
          StringCopy(wszBuffer, L"Not Bound", MAX_COL_SIZE);
        s_listNames.InsertItem(i, 1, wszBuffer);

        //Insert the Status into the List
        s_listNames.InsertItem(i, 2, STATUS_IS_BOUND(*pBinding) ? GetStatusName(dbStatus) : L"Not Bound");

        //Insert the Type into the List
        s_listNames.InsertItem(i, 3, GetDBTypeName(pColInfo->wType));

        //Insert the SubType into the List
        if(pBinding->wType == DBTYPE_VARIANT)
          s_listNames.InsertItem(i, 4, GetVariantTypeName(wSubType));
      }

      //Free any outofline data
      //TODO - need to free in the case of errors as well.  But have to be careful
      //since the pData may not have been setup yet, or other errors where its undefined...
      if(SUCCEEDED(hr))
        FreeBindingData(1, pBinding, pData);

      //AutoSize Columns
      for(i=0; i<=4; i++)
        s_listNames.SetColumnWidth(i, LVSCW_AUTOSIZE_USEHEADER);
      s_listValue.SetColumnWidth(0, LVSCW_AUTOSIZE_USEHEADER);

    CLEANUP2:
      CenterDialog(hWnd);
      if(FAILED(hr))
      {
        pCDataAccess->ReleaseAccessor(&hAccessor);
        EndDialog(hWnd, FALSE);
      }

      return TRUE;
    }

    case WM_COMMAND:
    {
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDM_DBSTATUS_S_OK:
        {
          //Insert the Status into the List
          INDEX iSelRow = s_listNames.GetNextItem(-1, LVNI_SELECTED);
          if(iSelRow == LVM_ERR)
            return 0;

          s_listNames.InsertItem(iSelRow, 2, L"DBSTATUS_S_OK");
          return 0;
        }

        case IDM_DBSTATUS_S_ISNULL:
        {
          //Insert the Status into the List
          INDEX iSelRow = s_listNames.GetNextItem(-1, LVNI_SELECTED);
          if(iSelRow == LVM_ERR)
            return 0;

          s_listNames.InsertItem(iSelRow, 2, L"DBSTATUS_S_ISNULL");
          return 0;
        }

        case IDM_DBSTATUS_S_DEFAULT:
        {
          //Insert the Status into the List
          INDEX iSelRow = s_listNames.GetNextItem(-1, LVNI_SELECTED);
          if(iSelRow == LVM_ERR)
            return 0;

          s_listNames.InsertItem(iSelRow, 2, L"DBSTATUS_S_DEFAULT");
          return 0;
        }

        case IDM_DBSTATUS_S_IGNORE:
        {
          //Insert the Status into the List
          INDEX iSelRow = s_listNames.GetNextItem(-1, LVNI_SELECTED);
          if(iSelRow == LVM_ERR)
            return 0;

          s_listNames.InsertItem(iSelRow, 2, L"DBSTATUS_S_IGNORE");
          return 0;
        }

        case IDM_DISPLAY_HEX:
        {
          WCHAR wszBuffer[MAX_COL_SIZE+1] = {0};

          //Find the Selected Row
          INDEX iSelRow = s_listValue.GetNextItem(-1, LVNI_SELECTED);
          if(iSelRow == LVM_ERR)
            return 0;

          //Get the Text from the Row
          s_listValue.GetItemText(iSelRow, 0, wszBuffer, MAX_COL_SIZE);

          //Convert using the Requested converions
          if(SUCCEEDED(PostProcessString(wszBuffer, MAX_COL_SIZE, CONV_HEX)))
          {
            //Insert the Data into the list (make an "easy" edit)
            s_listValue.SetItemText(iSelRow, 0, wszBuffer);
          }
          return 0;
        }

        case IDOK:
        {
          CWaitCursor waitCursor;
          WCHAR wszBuffer[MAX_COL_SIZE+1];

          //Get the "this" pointer
          CMDIChild* pThis  = (CMDIChild*)GetThis(hWnd);
          INDEX i,iItemCount = 0;
          HRESULT hr = S_OK;

          //Determine the object type
          CRow* pCRow         = SOURCE_GETOBJECT(pThis->m_pCSource, CRow);
          CRowset* pCRowset     = SOURCE_GETOBJECT(pThis->m_pCSource, CRowset);
          CDataAccess* pCDataAccess = SOURCE_GETOBJECT(pThis->m_pCSource, CDataAccess);
          CDataGrid*  pCDataGrid    = pThis->m_pCDataGrid;

          const DBBINDING* pBinding   = &pCDataAccess->m_Bindings[pCDataGrid->m_iSelCol];
          const DBCOLUMNINFO* pColInfo  = pCDataAccess->m_ColumnInfo.GetOrdinal(pBinding->iOrdinal);
          void* pData           = pCDataAccess->m_pData;

          //The ListView will produce IDOK if hitting return after entering
          //a value.  The easist way arround this is to just exit if
          //we haven't yet received the ENDEDIT message
          if(bBeginEdit)
            goto CLEANUP;

          if(!SOURCE_GETINTERFACE(pCRow, IRowChange) && !SOURCE_GETINTERFACE(pCRowset, IRowsetChange))
            goto CLEANUP;

          //This dialog is a little more complex since were allowing
          //the user to change an entire column so every row must be set
          //To make our lives a little easier, we will first Get the Data
          //for the row, and then Set only the affected column...
          iItemCount = s_listValue.GetItemCount();
          for(i=0; i<iItemCount; i++)
          {
            //Get row handle
            HROW hRow = pCDataGrid->GetItemParam(i);

            //Get the ColumnStatus
            s_listNames.GetItemText(i, 2, wszBuffer, MAX_COL_SIZE);
            DBSTATUS dbStatus = GetStatusValue(wszBuffer);

            //Set the ColumnData in our pData buffer
            s_listValue.GetItemText(i, 0, wszBuffer, MAX_COL_SIZE);
            TESTC(hr = pCDataAccess->SetColumnData(pBinding, pData, dbStatus, wcslen(wszBuffer), wszBuffer, CONV_NONE, pColInfo->wType));

            if(pCRow)
            {
              ULONG cColAccess = 1;
              DBCOLUMNACCESS* rgColAccess = &pCRow->m_rgColAccess[pCDataGrid->m_iSelCol];

              //Have to call SetColumns for extra columns
              XTEST(hr = pCRow->m_pIRowChange->SetColumns(cColAccess, rgColAccess));
              TRACE_METHOD(hr, L"IRowChange::SetColumns(%lu, 0x%p)", cColAccess, rgColAccess);

              //Display Data Errors...
              TESTC(hr = DisplayColAccessErrors(hr, cColAccess, rgColAccess));
            }
            else if(pCRowset)
            {
              //Now that we have setup the buffer, SetData into the rowset
              XTEST(hr = pCRowset->m_pIRowsetChange->SetData(hRow, hAccessor, pData));
              TRACE_METHOD(hr, L"IRowsetChange::SetData(0x%p, 0x%p, 0x%p)", hRow, hAccessor, pData);

              //Display Data Errors...
              TESTC(hr = DisplayBindingErrors(hr, 1, pBinding, pData));
            }

            //Need to indicate row was modified, use "changed" icon
            pCDataGrid->SetItemImage(pCDataGrid->m_iSelRow, 0, IMAGE_CHANGE);

            //Display the Data for this Row
            TESTC(hr = pCDataGrid->DisplayData(hRow, i, pCRow ? DBPROP_IRow : DBPROP_IRowset));
          }

          //Free outofline data
          //TODO - need to free in the case of errors as well.  But have to be careful
          //since the pData may not have been setup yet, or other errors where its undefined...
          FreeBindingData(1, pBinding, pData, TRUE/*fSetData*/);

        CLEANUP:
          if(SUCCEEDED(hr))
          {
            pCDataAccess->ReleaseAccessor(&hAccessor);
            EndDialog(hWnd, TRUE);
          }
          return 0;
        }

        case IDCANCEL:
        {
          CMDIChild* pThis = (CMDIChild*)GetThis(hWnd);
          CDataAccess* pCDataAccess = SOURCE_GETOBJECT(pThis->m_pCSource, CDataAccess);
          bBeginEdit = FALSE;

          pCDataAccess->ReleaseAccessor(&hAccessor);
          EndDialog(hWnd, FALSE);
          return 0;
        }
      }
      break;
    }//WM_COMMAND

    case WM_CONTEXTMENU:
    {
      HWND hWndSelected = (HWND)wParam;
      CMDIChild* pThis = (CMDIChild*)GetThis(hWnd);

      //Must have selected a row to change status
      INDEX iSel = s_listNames.GetNextItem(-1, LVNI_SELECTED);
      if(iSel == LVM_ERR)
        return FALSE;

      //IDL_NAMES
      if(hWndSelected == s_listNames.m_hWnd)
      {
        //Don't need to change the status if readonly
        if(SOURCE_GETINTERFACE(pThis->m_pCSource, IRowChange) && SOURCE_GETINTERFACE(pThis->m_pCSource, IRowsetChange))
          return FALSE;

        //Display Menu
        DisplayContextMenu(
                  hWnd,
                  IDM_CHANGESTATUS,
                  MAKEPOINTS(lParam),
                  hWnd
                  );
      }

      //IDL_VALUES
      if(hWndSelected == s_listValue.m_hWnd)
      {
        //Display Menu
        DisplayContextMenu(
                hWnd,
                IDM_CHANGEVALUE,
                MAKEPOINTS(lParam),
                hWnd
                );
      }
      return FALSE;
    }

    case WM_NOTIFY:
    {
      LV_DISPINFO* pDispInfo = (LV_DISPINFO*)lParam;
      NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)lParam;

      switch(pDispInfo->hdr.code)
      {
        //Since we have "TwoClickActive" on this will get sent
        //Whenever a row is clicked on twice!
        //This functionality used to be done with NM_DBCLK
        case LVN_ITEMACTIVATE:
        {
          //Save the SelectedRow so the new dialog box knows which row were concerned with...
          INDEX iSel = (INDEX)SendMessage(::GetDlgItem(hWnd, IDL_VALUES), LVM_GETNEXTITEM, (WPARAM)-1, (LPARAM)LVNI_SELECTED);
          if(iSel == LVM_ERR)
            return 0;

          //Need to Send LVM_EDITLABEL
          SendMessage(::GetDlgItem(hWnd, IDL_VALUES), LVM_EDITLABEL, iSel, 0);
          return FALSE;
        }

        case LVN_BEGINLABELEDIT:
          bBeginEdit = TRUE;
          return FALSE;//allow the user to change the value of the item.

        case LVN_ENDLABELEDIT:
        {
          CMDIChild* pThis = (CMDIChild*)GetThis(hWnd);
          bBeginEdit = FALSE;

          //Now update the ListView with the new value
          if(pDispInfo->item.pszText && (SOURCE_GETINTERFACE(pThis->m_pCSource, IRowChange) || SOURCE_GETINTERFACE(pThis->m_pCSource, IRowsetChange)))
          {
            WCHAR wszBuffer[MAX_NAME_LEN]={0};
            ConvertToWCHAR(pDispInfo->item.pszText, wszBuffer, MAX_NAME_LEN);
            s_listValue.SetItemText(pDispInfo->item.iItem, 0, wszBuffer);
          }

          return TRUE; //Allow the edited change
        }

        case LVN_ITEMCHANGED:
        {
          if(pNMListView->uNewState & LVNI_FOCUSED &&
            pNMListView->uNewState & LVNI_SELECTED)
          {
            if(wParam == IDL_VALUES)
            {
              SyncSibling(s_listNames.m_hWnd, s_listValue.m_hWnd);
                    return HANDLED_MSG;
            }

            if(wParam == IDL_NAMES)
            {
              SyncSibling(s_listValue.m_hWnd, s_listNames.m_hWnd);
                      return HANDLED_MSG;
            }
            return UNHANDLED_MSG; //No return Value
          }
        }
      }
    }//WM_NOTIFY
  }//switch(message);

  return FALSE;
}

INT_PTR WINAPI CMDIChild::CommandPersistProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 9136 of file cmdichild.cpp.

{
  DBCOMMANDPERSISTFLAG dwSavedFlags = DBCOMMANDPERSISTFLAG_DEFAULT;

  switch(message)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;

      //Save the "this" pointer
      CMDIChild* pThis = (CMDIChild*)SetThis(hWnd, (void*)lParam);
      CCommand* pCCommand = SOURCE_GETOBJECT(pThis->m_pCSource, CCommand);
      HWND hWndCommandID  = ::GetDlgItem(hWnd, IDE_COMMANDID);
      HWND hWndFlags = ::GetDlgItem(hWnd, IDL_FLAGS);
      DBID* pCommandID = NULL;
      HRESULT hr = S_OK;

      //Fill in the correct window title
      if(pThis->m_idSource == IDM_COMMANDPERSIST_DELETECOMMAND)
      {
        //Falgs not a paraemter for DeleteCommand
                ::EnableWindow(hWndFlags, FALSE);
        SendMessage(hWnd, WM_SETTEXT, 0, (LPARAM)"ICommandPersist::DeleteCommand");
      }
      else if(pThis->m_idSource == IDM_COMMANDPERSIST_LOADCOMMAND)
      {
        SendMessage(hWnd, WM_SETTEXT, 0, (LPARAM)"ICommandPersist::LoadCommand");
      }
      else
      {
        //Default title is SaveCommand
        ASSERT(pThis->m_idSource == IDM_COMMANDPERSIST_SAVECOMMAND);
      }

      //CommandID
      //Default to the current command
      ASSERT(pCCommand);
      hr = pCCommand->GetCurrentCommand(&pCommandID);
      if(SUCCEEDED(hr) && pCommandID)
      {
        //Fill In CommandID as Default
         if(pCommandID->eKind==DBKIND_NAME && pCommandID->uName.pwszName)
           wSendMessage(hWndCommandID, WM_SETTEXT, 0, pCommandID->uName.pwszName);
      }

      //dwFlags
      const static WIDENAMEMAP rgFlags[] =
      {
        VALUE_WCHAR(DBCOMMANDPERSISTFLAG_NOSAVE),
        VALUE_WCHAR(DBCOMMANDPERSISTFLAG_DEFAULT),
        VALUE_WCHAR(DBCOMMANDPERSISTFLAG_PERSISTVIEW),
        VALUE_WCHAR(DBCOMMANDPERSISTFLAG_PERSISTPROCEDURE),
      };

      //Populate the Flags ListBox
      SendMessage(hWndFlags, LB_RESETCONTENT, 0, 0);
      for(ULONG i=0; i<NUMELE(rgFlags); i++)
      {
        INDEX iSel = (INDEX)wSendMessage(hWndFlags, LB_ADDSTRING, 0, rgFlags[i].pwszName);
        SendMessage(hWndFlags,  LB_SETITEMDATA, iSel, (LPARAM)rgFlags[i].lItem);

        //Reselect all previously selected items...
        SendMessage(hWndFlags, LB_SETSEL, (dwSavedFlags & rgFlags[i].lItem) == (DBCOMMANDPERSISTFLAG)rgFlags[i].lItem, i);
      }

      CenterDialog(hWnd);
      DBIDFree(pCommandID);
      SAFE_FREE(pCommandID);
      return TRUE;
    }

    case WM_COMMAND:
    {
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDOK:
        {
          CWaitCursor waitCursor;

          //Get the "this" pointer
          CMDIChild* pThis  = (CMDIChild*)GetThis(hWnd);
          CCommand* pCCommand = SOURCE_GETOBJECT(pThis->m_pCSource, CCommand);
          HWND hWndCommandID  = ::GetDlgItem(hWnd, IDE_COMMANDID);
          HWND hWndFlags    = ::GetDlgItem(hWnd, IDL_FLAGS);
          HRESULT hr = S_OK;

          //Obtain the CommandID
          DBID CommandID;
          CommandID.eKind = DBKIND_NAME;
          CommandID.uName.pwszName = wGetWindowText(hWndCommandID);

          //Obtain all Selected Flags...
          INDEX iSelCount = (INDEX)SendMessage(hWndFlags, LB_GETSELCOUNT, 0, 0);
          ASSERT(iSelCount < 20);
          LONG rgSelItems[20];
          SendMessage(hWndFlags, LB_GETSELITEMS, (WPARAM)20, (LPARAM)rgSelItems);
          for(LONG i=0; i<iSelCount; i++)
          {
            DBCOMMANDPERSISTFLAG dwSelFlag = (DBCOMMANDPERSISTFLAG)SendMessage(hWndFlags, LB_GETITEMDATA, rgSelItems[i], 0);
            dwSavedFlags |= dwSelFlag;
          }

          if(pThis->m_idSource == IDM_COMMANDPERSIST_DELETECOMMAND)
          {
            //ICommandPersist::DeleteCommand
            XTEST(hr = pCCommand->m_pICommandPersist->DeleteCommand(&CommandID));
            TESTC(TRACE_METHOD(hr, L"ICommandPersist::DeleteCommand({\"%s\"})", CommandID.uName.pwszName));
          }
          else if(pThis->m_idSource == IDM_COMMANDPERSIST_LOADCOMMAND)
          {
            //ICommandPersist::LoadCommand
            XTEST(hr = pCCommand->m_pICommandPersist->LoadCommand(&CommandID, dwSavedFlags));
            TESTC(TRACE_METHOD(hr, L"ICommandPersist::LoadCommand({\"%s\"}, 0x%08x)", CommandID.uName.pwszName, dwSavedFlags));

            //The symmantics of LoadCommand replace the "underlying" command.
            //so there is no interface to "repopluate" the current command with, and
            //all currently held interfaces should still be valid...
          }
          else
          {
            //ICommandPersist::SaveCommand
            ASSERT(pThis->m_idSource == IDM_COMMANDPERSIST_SAVECOMMAND);
            XTEST(hr = pCCommand->m_pICommandPersist->SaveCommand(&CommandID, dwSavedFlags));
            TESTC(TRACE_METHOD(hr, L"ICommandPersist::SaveCommand({\"%s\"}, 0x%08x)", CommandID.uName.pwszName, dwSavedFlags));
          }

        CLEANUP:
          SAFE_FREE(CommandID.uName.pwszName);
          if(SUCCEEDED(hr))
            EndDialog(hWnd, TRUE);
          return 0;
        }

        case IDCANCEL:
        {
          EndDialog(hWnd, FALSE);
          return 0;
        }
      }
      break;
    }//WM_COMMAND
  }

  return FALSE;
}

INT_PTR WINAPI CMDIChild::CommitTransactionProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 5498 of file cmdichild.cpp.

{
  //Controls
  static CComboBoxLite  s_comboXACTTC;
  static CComboBoxLite  s_comboRetaining;
  static CComboBoxLite  s_comboTransaction;

  switch(message)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;

      //Save the "this" pointer
      CMDIChild*    pThis     = (CMDIChild*)SetThis(hWnd, (void*)lParam);

      //Controls
      s_comboXACTTC.CreateIndirect(hWnd, IDC_XACTTC);
      s_comboRetaining.CreateIndirect(hWnd, IDC_RETAINING);
      s_comboTransaction.CreateIndirect(hWnd, IDC_TRANSACTION);

      //Need to fill in the RETAINING ComboBox
      s_comboRetaining.AddString(L"TRUE",   TRUE);
      s_comboRetaining.AddString(L"FALSE",  FALSE);
      s_comboRetaining.SetSelValue(FALSE);

      //Need to fill in the XACTTC ComboBox - and set the defualt
      s_comboXACTTC.Populate(g_cXACTTC, g_rgXACTTC);
      s_comboXACTTC.AddString(L"0", 0);
      s_comboXACTTC.SetSelValue(XACTTC_SYNC_PHASETWO);

      //Need to fill in the Txn ComboBox
      pThis->SetupTransactionCombo(s_comboTransaction.m_hWnd);

      CenterDialog(hWnd);
      return TRUE;
    }

    case WM_COMMAND:
    {
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDOK:
        {
          CWaitCursor waitCursor;
          CMDIChild*    pThis     = (CMDIChild*)GetThis(hWnd);
          HRESULT     hr        = S_OK;

          //Obtain selected RETAINING from Combo
          BOOL fRetaining = (BOOL)s_comboRetaining.GetSelValue();

          //Obtain selected hWndXACTTC from Combo
          DWORD xacttc = (DWORD)s_comboXACTTC.GetSelValue();

          //get the ITransactionPointer
          ITransaction* pITransaction = (ITransaction*)s_comboTransaction.GetItemParam(s_comboTransaction.GetCurSel());

          //Obtain the Transaction interface
          if(!pITransaction || (LPARAM)pITransaction==CB_ERR)
            pITransaction = SOURCE_GETINTERFACE(pThis->m_pCSource, ITransaction);
          ASSERT(pITransaction);

          //Now Commit the Transaction
          XTEST(hr = pITransaction->Commit(fRetaining, xacttc, 0));
          TRACE_METHOD(hr, L"ITransaction::Commit(%s, %d, 0)", fRetaining ? L"TRUE" : L"FALSE", xacttc);

          if(SUCCEEDED(hr))
            EndDialog(hWnd, TRUE);
          return 0;
        }

        case IDCANCEL:
        {
          EndDialog(hWnd, FALSE);
          return 0;
        }
      }
      break;
    }//WM_COMMAND
  }
  return FALSE;
}

INT_PTR WINAPI CMDIChild::CreateAccessorProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 4437 of file cmdichild.cpp.

{
  //Bindings
  static DBCOUNTITEM  cBindings = 0;
  static DBBINDING* rgBindings  = NULL;
  static DBLENGTH   cbRowSize = 0;
  static BOOL     s_bClearAll = TRUE;

  switch(message)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;
      WCHAR wszBuffer[MAX_NAME_LEN+1];

      //Save the "this" pointer
      CMDIChild* pThis = (CMDIChild*)SetThis(hWnd, (void*)lParam);

      //Which object are we calling this from
      CDataAccess* pCDataAccess = SOURCE_GETOBJECT(pThis->m_pCSource, CDataAccess);
      ASSERT(pCDataAccess);

      HRESULT hr = S_OK;

      //Setup column headers
      HWND hWndValue  = ::GetDlgItem(hWnd, IDL_COLUMNS);
      s_bClearAll = TRUE;

      //Use Extended ListView Styles!
      SendMessage(hWndValue, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE | LVS_EX_CHECKBOXES, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE | LVS_EX_CHECKBOXES);

      //Set image list to the Window
      ListView_SetImageList(hWndValue, ImageList_LoadImage(GetAppLite()->m_hInstance, MAKEINTRESOURCE(IDB_IMAGE), 16, 16, CLR_DEFAULT , IMAGE_BITMAP, LR_DEFAULTCOLOR), LVSIL_SMALL);
      ListView_SetImageList(hWndValue, ImageList_LoadImage(GetAppLite()->m_hInstance, MAKEINTRESOURCE(IDB_STATE), 16, 16, CLR_DEFAULT , IMAGE_BITMAP, LR_DEFAULTCOLOR), LVSIL_STATE);

      //Setup Bindings
      pCDataAccess->GetColInfo();
      pCDataAccess->SetupBindings(BIND_ALLCOLS, &cBindings, &rgBindings, &cbRowSize);

      //We need to the ListView
      //Headers/Columns contain ColInfo information
      //Rows are per columns

      //ListView Columns
      LV_InsertColumn(hWndValue,    0,    L"ColName");
      LV_InsertColumn(hWndValue,    1,    L"Ordinal");
      LV_InsertColumn(hWndValue,    2,    L"obValue");
      LV_InsertColumn(hWndValue,    3,    L"obLength");
      LV_InsertColumn(hWndValue,    4,    L"obStatus");
      LV_InsertColumn(hWndValue,    5,    L"pTypeInfo");
      LV_InsertColumn(hWndValue,    6,    L"pObject");
      LV_InsertColumn(hWndValue,    7,    L"pBindExt");
      LV_InsertColumn(hWndValue,    8,    L"dwPart");
      LV_InsertColumn(hWndValue,    9,    L"dwMemOwner");
      LV_InsertColumn(hWndValue,    10,   L"eParamIO");
      LV_InsertColumn(hWndValue,    11,   L"cbMaxLen");
      LV_InsertColumn(hWndValue,    12,   L"dwFlags");
      LV_InsertColumn(hWndValue,    13,   L"wType");
      LV_InsertColumn(hWndValue,    14,   L"bPrecision");
      LV_InsertColumn(hWndValue,    15,   L"bScale");

      for(ULONG i=0; i<cBindings; i++)
      {
        ASSERT(rgBindings);
        const DBBINDING* pBinding = &rgBindings[i];
        const DBCOLUMNINFO* pColInfo = pCDataAccess->m_ColumnInfo.GetOrdinal(pBinding->iOrdinal);

        //Column Header
        LV_InsertItem(hWndValue, i, 0, GetColName(pColInfo), PARAM_NONE, pCDataAccess->GetColumnImage(pColInfo)==IMAGE_LOCK ? IMAGE_LOCK : IMAGE_NONE);

        //Ordinal (SubItem)
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"%ld", pBinding->iOrdinal);
        LV_InsertItem(hWndValue, i, 1, wszBuffer);

        //obValue (SubItem)
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"0x%p", pBinding->obValue);
        LV_InsertItem(hWndValue, i, 2, wszBuffer);

        //obLength (SubItem)
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"0x%p", pBinding->obLength);
        LV_InsertItem(hWndValue, i, 3, wszBuffer);

        //obStatus (SubItem)
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"0x%p", pBinding->obStatus);
        LV_InsertItem(hWndValue, i, 4, wszBuffer);

        //pTypeInfo (SubItem)
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"0x%p", pBinding->pTypeInfo);
        LV_InsertItem(hWndValue, i, 5, wszBuffer);

        //pObject (SubItem)
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"0x%p", pBinding->pObject);
        LV_InsertItem(hWndValue, i, 6, wszBuffer);

        //pBindExt (SubItem)
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"0x%p", pBinding->pBindExt);
        LV_InsertItem(hWndValue, i, 7, wszBuffer);

        //dwPart (SubItem)
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"0x%08x", pBinding->dwPart);
        LV_InsertItem(hWndValue, i, 8, wszBuffer);

        //dwMemOwner (SubItem)
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"0x%08x", pBinding->dwMemOwner);
        LV_InsertItem(hWndValue, i, 9, wszBuffer);

        //eParamIO (SubItem)
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"%d", pBinding->eParamIO);
        LV_InsertItem(hWndValue, i, 10, wszBuffer);

        //cbMaxLen (SubItem)
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"%lu", pBinding->cbMaxLen);
        LV_InsertItem(hWndValue, i, 11, wszBuffer);

        //dwFlags (SubItem)
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"0x%08x", pBinding->dwFlags);
        LV_InsertItem(hWndValue, i, 12, wszBuffer);

        //TYPE (subitem)
        LV_InsertItem(hWndValue, i, 13, GetDBTypeName(pBinding->wType));

        //Precision (SubItem)
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"%d", pBinding->bPrecision);
        LV_InsertItem(hWndValue, i, 14, wszBuffer);

        //Scale (SubItem)
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"%d", pBinding->bScale);
        LV_InsertItem(hWndValue, i, 15, wszBuffer);

        //Default to unchecked
        LV_SetItemState(hWndValue, i, 0,  INDEXTOSTATEIMAGEMASK(STATE_UNCHECKED),  LVIS_STATEIMAGEMASK);
      }

      //Go through and check the existing columns, that are in our current bindings
      for(i=0; i<pCDataAccess->m_Bindings.GetCount(); i++)
      {
        DBORDINAL iOrdinal = pCDataAccess->m_Bindings[i].iOrdinal;
        DBORDINAL iIndex = (iOrdinal && !pCDataAccess->m_ColumnInfo[0].iOrdinal==0) ? iOrdinal-1 : iOrdinal;
        LV_SetItemState(hWndValue, (INDEX)iIndex, 0,  INDEXTOSTATEIMAGEMASK(STATE_CHECKED),  LVIS_STATEIMAGEMASK);
      }

      //AutoSize columns (column headers);
      for(i=0; i<=15; i++)
        SendMessage(hWndValue, LVM_SETCOLUMNWIDTH, i, (LPARAM)LVSCW_AUTOSIZE_USEHEADER);

      CenterDialog(hWnd);

      if(FAILED(hr))
      {
        //Free Bindings
        FreeBindings(&cBindings, &rgBindings);
        EndDialog(hWnd, FALSE);
      }

      return TRUE;
    }

    case WM_COMMAND:
    {
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDOK:
        {
          CWaitCursor waitCursor;

          //Get the "this" pointer
          CMDIChild* pThis  = (CMDIChild*)GetThis(hWnd);

          //Which object are we calling this from
          CDataAccess* pCDataAccess = SOURCE_GETOBJECT(pThis->m_pCSource, CDataAccess);
          ASSERT(pCDataAccess);

          DBCOUNTITEM cSelBindings = 0;
          DBBINDING* rgSelBindings = NULL;
          HWND hWndValue  = ::GetDlgItem(hWnd, IDL_COLUMNS);
          HACCESSOR hAccessor = NULL;
          DBACCESSORFLAGS dwAccessorFlags = DBACCESSOR_ROWDATA;

          INDEX i=0;
          HRESULT hr = S_OK;

          //Now that the user has selected all the columns they wish to
          //have in the Accessor, we need to loop through all the
          //checked columns and add them to our list...
          INDEX cItems = (INDEX)SendMessage(hWndValue, LVM_GETITEMCOUNT, 0, 0);
          SAFE_ALLOC(rgSelBindings, DBBINDING, cItems);

          for(i=0; i<cItems; i++)
          {
            //Get the Image
            BOOL bChecked = LV_GetItemState(hWndValue, i, LVIS_STATEIMAGEMASK) & INDEXTOSTATEIMAGEMASK(STATE_CHECKED);

            //Only interested in checked items
            if(!bChecked)
              continue;

            ASSERT(cBindings);
            ASSERT(rgBindings);

            //Mark this Ordinal as checked
            CopyBinding(&rgSelBindings[cSelBindings], &rgBindings[i]);
            cSelBindings++;
          }

          //Now that we have the columns, Create the Accessor
          hr = pCDataAccess->CreateAccessor(dwAccessorFlags, cSelBindings, rgSelBindings, 0, &hAccessor);

          //Free Bindings
          FreeBindings(&cBindings, &rgBindings);

          if(SUCCEEDED(hr))
          {
            //Release Previous Accessor
            pCDataAccess->ReleaseAccessor(&pCDataAccess->m_hAccessor);

            //Use the new Bindings
            pCDataAccess->m_hAccessor = hAccessor;
            pCDataAccess->m_cbRowSize = cbRowSize;
            pCDataAccess->m_Bindings.Attach(cSelBindings, rgSelBindings);

            //The new bindings may not be the same size as our original
            //Or might not have existined original if AutiQI was off...
            SAFE_REALLOC(pCDataAccess->m_pData, BYTE, cbRowSize);

            //Now actually refetch the Data with the new Accessor
            if(SUCCEEDED(hr = pThis->m_pCDataGrid->RestartPosition()))
              hr = pThis->m_pCDataGrid->RefreshData();

            EndDialog(hWnd, TRUE);
            return 0;
          }

        CLEANUP:
          //Free Bindings
          FreeBindings(&cBindings, &rgBindings);
          FreeBindings(&cSelBindings, &rgSelBindings);
          return 0;
        }

        case IDCANCEL:
        {
          //Free Bindings
          FreeBindings(&cBindings, &rgBindings);
          EndDialog(hWnd, FALSE);
          return 0;
        }

        case IDB_CLEARALL:
        {
          HWND hWndValue  = ::GetDlgItem(hWnd, IDL_COLUMNS);

          //Now that the user has selected to select all columns
          //We need to loop through all the unchecked and check them...
          INDEX cItems = (INDEX)SendMessage(hWndValue, LVM_GETITEMCOUNT, 0, 0);
          for(INDEX i=0; i<cItems; i++)
          {
            //Check the property state
            LV_SetItemState(hWndValue, i, 0,  INDEXTOSTATEIMAGEMASK(s_bClearAll ? STATE_UNCHECKED : STATE_CHECKED),  LVIS_STATEIMAGEMASK);
          }

          //Clear All is a toggle...
          if(s_bClearAll)
          {
            s_bClearAll = FALSE;
                        ::SetWindowText(::GetDlgItem(hWnd, IDB_CLEARALL), "SelectAll");
          }
          else
          {
            s_bClearAll = TRUE;
                        ::SetWindowText(::GetDlgItem(hWnd, IDB_CLEARALL), "ClearAll");
          }
          return 0;
        }
      }
      break;
    }//WM_COMMAND

  }//switch message

  return FALSE;
}

HRESULT CMDIChild::CreateEnumChild ( ) [virtual]

Definition at line 2111 of file cmdichild.cpp.

{
  HRESULT hr = S_OK;
  INDEX iSelRow = 0;
  WCHAR wszBuffer[MAX_NAME_LEN+1];

  CRowset* pCRowset     = (CRowset*)GetObject(eCRowset);
  CEnumerator* pCEnumerator = SOURCE_GETPARENT(pCRowset, CEnumerator);
  if(pCRowset && pCEnumerator)
  {
    //If enumertor rowset, double-clicking on a row
    //brings up the ParseName object in another window
    ULONG iColumn = 1;  //Skip RowHandle column

    //Skip bookmark column...
    if(pCRowset->m_Bindings.GetCount() && pCRowset->m_Bindings[0].iOrdinal==0)
      iColumn = 2;

    //Obtain SelectedRow
    iSelRow = m_pCDataGrid->GetSelectedRow();
    ASSERT(iSelRow != LVM_ERR);

    //Obtain SourcesName and description from SelectedRow
    ENUMINFO EnumInfo;
    //SOURCES_NAME
    m_pCDataGrid->GetItemText(iSelRow, iColumn+0, EnumInfo.wszName, MAX_NAME_LEN);
    //SOURCES_PARSENAME
    m_pCDataGrid->GetItemText(iSelRow, iColumn+1, EnumInfo.wszParseName, MAX_NAME_LEN);
    //SOURCES_DESCRIPTION
    m_pCDataGrid->GetItemText(iSelRow, iColumn+2, EnumInfo.wszDescription, MAX_NAME_LEN);
    //SOURCES_TYPE
    m_pCDataGrid->GetItemText(iSelRow, iColumn+3, wszBuffer, MAX_NAME_LEN);
    EnumInfo.eType = (DBTYPE)wcstoul(wszBuffer, NULL, 10);
    //SOURCES_ISPARENT
    m_pCDataGrid->GetItemText(iSelRow, iColumn+4, wszBuffer, MAX_NAME_LEN);
    EnumInfo.fIsParent = StringCompare(wszBuffer, L"True") ? TRUE : FALSE;

    //Now Connect using the Connect Dialog
    ASSERT(m_pCMainWindow);
    ASSERT(m_pCMainWindow->m_pCFullConnect);
    m_pCMainWindow->m_pCFullConnect->Display(m_hWnd, pCEnumerator, &EnumInfo);
  }
  return hr;
}

INT_PTR WINAPI CMDIChild::CreateIndexProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 6883 of file cmdichild.cpp.

{
  //NOTE:  These are static variables, just to hold the PropertyInfo
  //Information temporarily.  There are messages that need this info which
  //gets setup on INITDIALOG.  On OK or CANCEL this info will be freed...
  static WCHAR    *pStringBuffer  = NULL;
  ULONG       i;
  LONG        iSel = 0;
  static WCHAR    wszBuffer[MAX_NAME_LEN+1];

  switch(message)
  {
    case WM_INITDIALOG:
    {
      //Save the "this" pointer
      CWaitCursor waitCursor;
      CMDIChild   *pThis      = (CMDIChild*)SetThis(hWnd, (void*)lParam);

      //Use Extended ListView Styles!
      HWND    hWndIndexColumnDesc = ::GetDlgItem(hWnd, IDL_INDEXCOLUMNDESC);
      HWND    hWndTableID     = ::GetDlgItem(hWnd, IDE_TABLEID);
      HWND    hWndOrder     = ::GetDlgItem(hWnd, IDC_ORDER);
      HWND    hWndColumnID    = ::GetDlgItem(hWnd, IDE_COLUMNID);
      RECT    rect;

      SendMessage(hWndIndexColumnDesc, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE);

      //Fill In TableID as Default
      WCHAR* pwszTableName = pThis->m_pCQueryBox->GetSelectedText();
      wSendMessage(hWndTableID, WM_SETTEXT, 0, pwszTableName);

      //ColumnHeaders for INDEXCOLUMNDESC report
      LV_InsertColumn(hWndIndexColumnDesc,   COLUMN_ID, L"Column ID", IMAGE_NONE);
      LV_InsertColumn(hWndIndexColumnDesc,   COLUMN_ORDER,L"Order", IMAGE_NONE);

      //AutoSize Columns
      GetWindowRect(hWndColumnID, (LPRECT)&rect);
      SendMessage(hWndIndexColumnDesc, LVM_SETCOLUMNWIDTH, (WPARAM)COLUMN_ID, (LPARAM)(rect.right-rect.left));
      GetWindowRect(hWndOrder, (LPRECT)&rect);
      SendMessage(hWndIndexColumnDesc, LVM_SETCOLUMNWIDTH, (WPARAM)COLUMN_ORDER, (LPARAM)(rect.right-rect.left));

      // Order list...
      SendMessage(hWndOrder, CB_ADDSTRING, 0, (LPARAM)"Ascendent");
      SendMessage(hWndOrder, CB_ADDSTRING, 0, (LPARAM)"Descendent");
      SendMessage(hWndOrder, CB_SETCURSEL, 0, 0); // ascendent

      //Placement of Dialog, want it just below the "Init" button...
      CenterDialog(hWnd);

      //Disable fields
            ::EnableWindow(::GetDlgItem(hWnd, IDE_COLUMNID), FALSE);
            ::EnableWindow(::GetDlgItem(hWnd, IDC_ORDER), FALSE);

      SAFE_FREE(pwszTableName)
      return TRUE;
    }

    case WM_COMMAND:
    {
      switch (GET_WM_COMMAND_CMD(wParam, lParam))
      {
        case EN_KILLFOCUS:
        {
          switch((int)LOWORD(wParam))
          {
            case IDE_COLUMNID:
            {
              HWND    hWndIndexColumnDesc = ::GetDlgItem(hWnd, IDL_INDEXCOLUMNDESC);
              HWND    hWndColumnID    = ::GetDlgItem(hWnd, IDE_COLUMNID);
              HWND    hWndColName     = ::GetDlgItem(hWnd, IDE_COLNAME);
              WCHAR   wszBuffer2[MAX_NAME_LEN+1];

              // get the selected item
              iSel = ListView_GetNextItem(hWndIndexColumnDesc, -1, LVNI_SELECTED);

              // retrieve the column type name and copy it to the COLUMN_TYPENAME field of the list view
              // and to Column Name static field
              wSendMessage(hWndColumnID, WM_GETTEXT, MAX_NAME_LEN, wszBuffer2);
              StringFormat(wszBuffer, NUMELE(wszBuffer), L"Current item %d (%s)", iSel, wszBuffer2);
              LV_SetItemText(hWndIndexColumnDesc, iSel, COLUMN_ID, wszBuffer2);
              wSendMessage(hWndColName, WM_SETTEXT, 0, wszBuffer);
              return 0;
            }
          }
          return 0;
        }
      }
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      //CBN_SELCHANGE
      switch(GET_WM_COMMAND_CMD(wParam, lParam))
      {
        case CBN_SELCHANGE:
        {
          switch(GET_WM_COMMAND_ID(wParam, lParam))
          {
            case IDC_ORDER:
            {
              HWND    hWndIndexColumnDesc = ::GetDlgItem(hWnd, IDL_INDEXCOLUMNDESC);
              HWND    hWndOrder     = ::GetDlgItem(hWnd, IDC_ORDER);
              INDEX   iSelOrder     = (INDEX)SendMessage(hWndOrder, CB_GETCURSEL, 0, 0);

              // get the selected item
              iSel = ListView_GetNextItem(hWndIndexColumnDesc, -1, LVNI_SELECTED);

              // retrieve the column type name and copy it to the COLUMN_TYPENAME field of the list view
              wSendMessage(hWndOrder, CB_GETLBTEXT, (WPARAM)iSelOrder, wszBuffer);
              LV_SetItemText(hWndIndexColumnDesc, iSel, COLUMN_ORDER, wszBuffer);
              return 0;
            }
          }
          return 0;
        }
      }

      //Regular command messages
      switch(GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDB_INDEXPROPERTIES:
        {
          //Get the "this" pointer
          CMDIChild *pThis      = (CMDIChild*)GetThis(hWnd);
          CMainWindow* pCMainWindow = pThis->m_pCMainWindow;
          CDataSource* pCDataSource = SOURCE_GETPARENT(pThis->m_pCSource, CDataSource);

          CPropertiesDlg sCPropertiesDlg(pCMainWindow);
          sCPropertiesDlg.SetProperties(hWnd, &DBPROPSET_INDEXALL, IID_IRowsetInfo, NULL, pCDataSource ? pCDataSource->m_pIDBProperties : NULL, &pThis->m_CDefPropSets);
          return 0;
        }

        case IDB_ADD:
        {
          HWND    hWndIndexColumnDesc = ::GetDlgItem(hWnd, IDL_INDEXCOLUMNDESC);
          ULONG   cItems        = ListView_GetItemCount(hWndIndexColumnDesc);

          // make the insertion
          StringFormat(wszBuffer, NUMELE(wszBuffer), L"Column%lu", cItems);
          LV_InsertItem(hWndIndexColumnDesc, cItems, COLUMN_ID, wszBuffer);

          // order
          LV_InsertItem(hWndIndexColumnDesc, cItems, COLUMN_ORDER, L"Ascendent");
          LV_SetItemState(hWndIndexColumnDesc, cItems, COLUMN_ID, LVIS_SELECTED, LVIS_SELECTED);
          return 0;
        }

        case IDB_DELETE:
        {
          HWND    hWndIndexColumnDesc = ::GetDlgItem(hWnd, IDL_INDEXCOLUMNDESC);
          INT     cItems        = ListView_GetItemCount(hWndIndexColumnDesc);

          // get the selected item
          iSel = ListView_GetNextItem(hWndIndexColumnDesc, -1, LVNI_SELECTED);

          if (iSel > -1)
          {
            ListView_DeleteItem(hWndIndexColumnDesc, iSel);
            SendMessage(::GetDlgItem(hWnd, IDE_COLNAME), WM_SETTEXT, 0, (LPARAM)"");
            LV_SetItemState(hWndIndexColumnDesc, iSel >= cItems-1 ? iSel-1: iSel,
              COLUMN_DBCID, LVIS_SELECTED, LVIS_SELECTED);
          }
          //Disable fields
                    ::EnableWindow(::GetDlgItem(hWnd, IDE_COLUMNID), FALSE);
                    ::EnableWindow(::GetDlgItem(hWnd, IDC_ORDER), FALSE);
          return 0;
        }

        case IDCANCEL:
        {
          //Cleanup any memory allocated
          SAFE_FREE(pStringBuffer);
          EndDialog(hWnd, FALSE);
          return 0;
        }

        case IDOK:
        {
          CWaitCursor waitCursor;

          //Get the "this" pointer
          CMDIChild     *pThis        = (CMDIChild*)GetThis(hWnd);
          CSession      *pCSession      = SOURCE_GETOBJECT(pThis->m_pCSource, CSession);

          HWND        hWndIndexColumnDesc = ::GetDlgItem(hWnd, IDL_INDEXCOLUMNDESC);
          HWND        hWndTableID     = ::GetDlgItem(hWnd, IDE_TABLEID);
          HWND        hWndIndexID     = ::GetDlgItem(hWnd, IDE_INDEXID);
          DBINDEXCOLUMNDESC *rgIndexColumnDesc  = NULL;
          ULONG       cIndexColumnDesc  = 0;
          DBID        TableID;
          WCHAR       wszTableDBID[MAX_QUERY_LEN+1];
          DBID        IndexID;
          WCHAR       wszIndexDBID[MAX_QUERY_LEN+1];
          DBPROPSET     *rgPropSet      = NULL;
          ULONG       cPropSet      = 0;
          HRESULT       hr;

          // alloc space for the column desc array
          cIndexColumnDesc = ListView_GetItemCount(hWndIndexColumnDesc);
          SAFE_ALLOC(rgIndexColumnDesc, DBINDEXCOLUMNDESC, cIndexColumnDesc);

          // get the column desc array
          for (i=0; i<cIndexColumnDesc; i++)
          {
            // initialize the whole structure
            memset(&rgIndexColumnDesc[i], 0, sizeof(DBINDEXCOLUMNDESC));

            // get column name
            LV_GetItemText(hWndIndexColumnDesc, i, COLUMN_ID, wszBuffer, MAX_NAME_LEN);
            SAFE_ALLOC(rgIndexColumnDesc[i].pColumnID, DBID, 1);
            rgIndexColumnDesc[i].pColumnID->eKind     = DBKIND_NAME;
            rgIndexColumnDesc[i].pColumnID->uName.pwszName  = wcsDuplicate(wszBuffer);

            // get column order
            LV_GetItemText(hWndIndexColumnDesc, i, COLUMN_ORDER, wszBuffer, MAX_NAME_LEN);
            if (StringCompare(wszBuffer, L"Descendent"))
              rgIndexColumnDesc[i].eIndexColOrder = DBINDEX_COL_ORDER_DESC;
            else
              rgIndexColumnDesc[i].eIndexColOrder = DBINDEX_COL_ORDER_ASC;
          }

          // get TableID
          TableID.eKind = DBKIND_NAME;
          TableID.uName.pwszName = wGetWindowText(hWndTableID);
          DBIDToString(&TableID, wszTableDBID, MAX_QUERY_LEN);

          // get IndexID
          IndexID.eKind     = DBKIND_NAME;
          IndexID.uName.pwszName  = wGetWindowText(hWndIndexID);
          DBIDToString(&IndexID, wszIndexDBID, MAX_QUERY_LEN);

          // check whether rowset/table properties are used
          if(::IsDlgButtonChecked(hWnd, IDB_USEPROPERTIES))
          {
            cPropSet  = pThis->m_CDefPropSets.GetCount();
            rgPropSet = pThis->m_CDefPropSets.GetPropSets();
          }

          XTEST(hr = pCSession->m_pIIndexDefinition->CreateIndex(&TableID, &IndexID, cIndexColumnDesc, rgIndexColumnDesc, cPropSet, rgPropSet, NULL));
          TESTC(TRACE_METHOD(hr, L"IIndexDefinition::CreateIndex(%s, %s, %lu, 0x%p, %d, 0x%p, NULL)", wszTableDBID, wszIndexDBID, cIndexColumnDesc, rgIndexColumnDesc, cPropSet, rgPropSet));

        CLEANUP:
          for (i=0; i<cIndexColumnDesc; i++)
          {
            if (DBKIND_NAME == rgIndexColumnDesc[i].pColumnID->eKind)
              SAFE_FREE(rgIndexColumnDesc[i].pColumnID->uName.pwszName);
          }

          if(SUCCEEDED(hr))
          {
            //Now just need to place this name in the EditBox
            //Inserted after the current "caret"
            pThis->m_pCQueryBox->ReplaceAll(TableID.uName.pwszName, FALSE/*bReplaceAll*/, TRUE/*fHighlight*/);
            EndDialog(hWnd, TRUE);
          }

          SAFE_FREE(rgIndexColumnDesc);
          SAFE_FREE(TableID.uName.pwszName);
          SAFE_FREE(IndexID.uName.pwszName);
          return 0;
        }
      }
      break;
    }//WM_COMMAND

    case WM_NOTIFY:
    {
      LV_DISPINFO* pDispInfo = (LV_DISPINFO*)lParam;

      //ListView
      switch(pDispInfo->hdr.code)
      {
        //Since we have "TwoClickActive" on this will get sent
        //Whenever a row is clicked on twice!
        //This functionality used to be done with NM_DBCLK
        case LVN_ITEMACTIVATE:
        {
          return FALSE;
        }

        case LVN_ITEMCHANGED:
        {
          HWND    hWndIndexColumnDesc = ::GetDlgItem(hWnd, IDL_INDEXCOLUMNDESC);
          HWND    hWndColumnID    = ::GetDlgItem(hWnd, IDE_COLUMNID);
          HWND    hWndOrder     = ::GetDlgItem(hWnd, IDC_ORDER);
          HWND    hWndColName     = ::GetDlgItem(hWnd, IDE_COLNAME);
          WCHAR   wszBuffer2[MAX_NAME_LEN+1];
          NMLISTVIEW  *pLV = (NMLISTVIEW*)lParam;
          INDEX   iOrder = 0;

          if (pLV->uChanged != LVIF_STATE)
            return 0;

          // get the selected item
          iSel = pLV->iItem;
          if (!(pLV->uNewState & LVIS_SELECTED))
          {
            if (!(pLV->uOldState & LVIS_SELECTED))
              return 0;
            // this is the previously selected item
            // retrieve the column name and copy it to the IDE_COLUMNID field
            wSendMessage(hWndColumnID, WM_GETTEXT, MAX_NAME_LEN, wszBuffer2);
            LV_SetItemText(hWndIndexColumnDesc, iSel, COLUMN_ID, wszBuffer2);
            StringFormat(wszBuffer, NUMELE(wszBuffer), L"Current item %lu (%s)", iSel, wszBuffer2);
            wSendMessage(hWndColName, WM_SETTEXT, 0, wszBuffer);

            // retrieve the column type and copy it to the IDC_ORDER field
            iOrder = (INDEX)SendMessage(hWndOrder, CB_GETCURSEL, 0, 0);
            wSendMessage(hWndOrder, CB_GETLBTEXT, iOrder, wszBuffer);
            LV_SetItemText(hWndIndexColumnDesc, iSel, COLUMN_ORDER, wszBuffer);
          }
          else
          {
            // retrieve the column name and copy it to the IDE_COLUMNID field
            LV_GetItemText(hWndIndexColumnDesc, iSel, COLUMN_ID, wszBuffer2, MAX_NAME_LEN);
            wSendMessage(hWndColumnID, WM_SETTEXT, 0, wszBuffer2);
            StringFormat(wszBuffer, NUMELE(wszBuffer), L"Current item %lu (%s)", iSel, wszBuffer2);
            wSendMessage(hWndColName, WM_SETTEXT, 0, wszBuffer);

            // retrieve the column type and copy it to the IDC_ORDER field
            LV_GetItemText(hWndIndexColumnDesc, iSel, COLUMN_ORDER, wszBuffer, MAX_NAME_LEN);
            SendMessage(hWndOrder, CB_SELECTSTRING, -1, (LPARAM)wszBuffer);
          }

          //Disable fields
                    ::EnableWindow(::GetDlgItem(hWnd, IDE_COLUMNID), TRUE);
                    ::EnableWindow(::GetDlgItem(hWnd, IDC_ORDER), TRUE);
          return FALSE;
        }

        case LVN_ITEMCHANGING:
        {
            return FALSE; //Allow the change
        }
      }
    }//WM_NOTIFY
  }//switch message

  return FALSE;
} //CMDIChild::CreateIndexProc

INT_PTR WINAPI CMDIChild::CreateTableProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 7604 of file cmdichild.cpp.

{
  static CComboBoxGuid  s_CComboInterface;
  static  WCHAR wszBuffer[MAX_NAME_LEN+1];
  static  BOOL fUseProps      = TRUE;
  static  BOOL fAggregation   = FALSE;      //Default
  static  BOOL fOutput      = TRUE;       //Default

  switch(message)
  {
    case WM_INITDIALOG:
    {
      //Save the "this" pointer
      CWaitCursor waitCursor;
      CMDIChild*    pThis     = (CMDIChild*)SetThis(hWnd, (void*)lParam);
      CSession*   pCSession   = SOURCE_GETOBJECT(pThis->m_pCSource, CSession);

      //Use Extended ListView Styles!
      HWND    hWndColumnDesc  = ::GetDlgItem(hWnd, IDL_COLUMNDESC);
      HWND    hWndTableID   = ::GetDlgItem(hWnd, IDE_TABLEID);
      HWND    hWndTypeName  = ::GetDlgItem(hWnd, IDC_TYPENAME);
      HWND    hWndDataType  = ::GetDlgItem(hWnd, IDC_DATATYPE);
      HWND    hWndColumnID  = ::GetDlgItem(hWnd, IDE_COLUMNID);
      HWND    hWndColSize   = ::GetDlgItem(hWnd, IDE_SIZE);
      HWND    hWndColPrec   = ::GetDlgItem(hWnd, IDE_PRECISION);
      HWND    hWndColScale  = ::GetDlgItem(hWnd, IDE_SCALE);
      RECT    rect;

      SendMessage(hWndColumnDesc, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE);

      //ColumnHeaders for COLUMNDESC report
      LV_InsertColumn(hWndColumnDesc,   COLUMN_DBCID,   L"Column DBCID",  IMAGE_NONE);
      LV_InsertColumn(hWndColumnDesc,   COLUMN_TYPENAME,  L"TypeName",    IMAGE_NONE);
      LV_InsertColumn(hWndColumnDesc,   COLUMN_DATATYPE,  L"DataType",    IMAGE_NONE);
      LV_InsertColumn(hWndColumnDesc,   COLUMN_SIZE,    L"Size",      IMAGE_NONE);
      LV_InsertColumn(hWndColumnDesc,   COLUMN_PREC,    L"Precision",   IMAGE_NONE);
      LV_InsertColumn(hWndColumnDesc,   COLUMN_SCALE,   L"Scale",     IMAGE_NONE);

      //AutoSize Columns
      GetWindowRect(hWndColumnID, (LPRECT)&rect);
      SendMessage(hWndColumnDesc, LVM_SETCOLUMNWIDTH, (WPARAM)COLUMN_DBCID, (LPARAM)(rect.right-rect.left));
      GetWindowRect(hWndTypeName, (LPRECT)&rect);
      SendMessage(hWndColumnDesc, LVM_SETCOLUMNWIDTH, (WPARAM)COLUMN_TYPENAME, (LPARAM)(rect.right-rect.left));
      GetWindowRect(hWndDataType, (LPRECT)&rect);
      SendMessage(hWndColumnDesc, LVM_SETCOLUMNWIDTH, (WPARAM)COLUMN_DATATYPE, (LPARAM)(rect.right-rect.left));
      GetWindowRect(hWndColSize, (LPRECT)&rect);
      SendMessage(hWndColumnDesc, LVM_SETCOLUMNWIDTH, (WPARAM)COLUMN_SIZE, (LPARAM)(rect.right-rect.left));
      GetWindowRect(hWndColPrec, (LPRECT)&rect);
      SendMessage(hWndColumnDesc, LVM_SETCOLUMNWIDTH, (WPARAM)COLUMN_PREC, (LPARAM)(rect.right-rect.left));
      GetWindowRect(hWndColScale, (LPRECT)&rect);
      SendMessage(hWndColumnDesc, LVM_SETCOLUMNWIDTH, (WPARAM)COLUMN_SCALE, (LPARAM)(rect.right-rect.left));

      //Make sure we have the Provider Types rowset ahead of time
      pCSession->GetProviderTypes();

      // Type Name list...
      for(ULONG i=0; i<pCSession->m_cProvTypes; i++)
      {
        //Type Name
        wSendMessage(hWndTypeName, CB_ADDSTRING, 0, pCSession->m_rgProvTypes[i].wszTypeName);
      }
      SendMessage(hWndTypeName, CB_SETCURSEL, 0, 0);

      // DBType list
      for(i=0; i<g_cDBTypes; i++)
      {
        //DBTypes
        wSendMessage(hWndDataType, CB_ADDSTRING,  0, g_rgDBTypes[i].pwszName);
      }
      for (i=0; i<g_cDBTypes; i++)
      {
        if (pCSession->m_rgProvTypes[0].wType == g_rgDBTypes[i].lItem)
        {
          SendMessage(hWndDataType, CB_SETCURSEL, i, 0);
          break;
        }
      }

      //Use Properties
            ::CheckDlgButton(hWnd, IDB_USEPROPERTIES,  BST2STATE(fUseProps));

      //Aggregation
            ::CheckDlgButton(hWnd, IDB_AGGREGATION,    BST2STATE(fAggregation));

      //Output (ppIUnknown)
            ::CheckDlgButton(hWnd, IDB_OUTPUT,     BST2STATE(fOutput));

      //Interface List...
      s_CComboInterface.CreateIndirect(hWnd, IDC_INTERFACE);
      s_CComboInterface.Populate(g_cInterfaceMaps, g_rgInterfaceMaps);
      if(s_CComboInterface.RestoreSelection() == CB_ERR)
        s_CComboInterface.SetGuid(IID_IRowset);

      pCSession->m_listCPropSets.RemoveAll();

      //Fill In TableID as Default
      WCHAR* pwszTableName = pThis->m_pCQueryBox->GetSelectedText();
      wSendMessage(hWndTableID, WM_SETTEXT, 0, pwszTableName);

      //Placement of Dialog, want it just below the "Init" button...
      CenterDialog(hWnd);

      //Disable fields
            ::EnableWindow(::GetDlgItem(hWnd, IDB_COLPROP),    FALSE);
            ::EnableWindow(::GetDlgItem(hWnd, IDE_COLUMNID), FALSE);
            ::EnableWindow(::GetDlgItem(hWnd, IDC_TYPENAME), FALSE);
            ::EnableWindow(::GetDlgItem(hWnd, IDC_DATATYPE), FALSE);
            ::EnableWindow(::GetDlgItem(hWnd, IDE_SIZE),   FALSE);
            ::EnableWindow(::GetDlgItem(hWnd, IDE_PRECISION),  FALSE);
            ::EnableWindow(::GetDlgItem(hWnd, IDE_SCALE),    FALSE);

      SendMessage(hWndTypeName, CB_SETCURSEL, 0, 0);
      SAFE_FREE(pwszTableName);
      return TRUE;
    }

    case WM_COMMAND:
    {
      switch (GET_WM_COMMAND_CMD(wParam, lParam))
      {
        case EN_KILLFOCUS:
        {
          switch((int)LOWORD(wParam))
          {
            case IDE_COLUMNID:
            {
              HWND    hWndColumnDesc  = ::GetDlgItem(hWnd, IDL_COLUMNDESC);
              HWND    hWndColumnID  = ::GetDlgItem(hWnd, IDE_COLUMNID);
              HWND    hWndColName   = ::GetDlgItem(hWnd, IDE_COLNAME);
              WCHAR   wszBuffer2[MAX_NAME_LEN+1];

              // get the selected item
              INDEX iSel = ListView_GetNextItem(hWndColumnDesc, -1, LVNI_SELECTED);

              // retrieve the column type name and copy it to the COLUMN_TYPENAME field of the list view
              // and to Column Name static field
              wSendMessage(hWndColumnID, WM_GETTEXT, MAX_NAME_LEN, wszBuffer2);
              StringFormat(wszBuffer, NUMELE(wszBuffer), L"Current item %lu (%s)", iSel, wszBuffer2);
              LV_SetItemText(hWndColumnDesc, iSel, COLUMN_DBCID, wszBuffer2);
              wSendMessage(hWndColName, WM_SETTEXT, 0, wszBuffer);
              break;
            }
            case IDE_SIZE:
            {
              HWND    hWndColumnDesc  = ::GetDlgItem(hWnd, IDL_COLUMNDESC);
              HWND    hWndColSize   = ::GetDlgItem(hWnd, IDE_SIZE);

              // get the selected item
              INDEX iSel = ListView_GetNextItem(hWndColumnDesc, -1, LVNI_SELECTED);

              // retrieve the column type name and copy it to the COLUMN_TYPENAME field of the list view
              // and to Column Name static field
              wSendMessage(hWndColSize, WM_GETTEXT, MAX_NAME_LEN, wszBuffer);
              LV_SetItemText(hWndColumnDesc, iSel, COLUMN_SIZE, wszBuffer);
              break;
            }
            case IDE_PRECISION:
            {
              HWND    hWndColumnDesc  = ::GetDlgItem(hWnd, IDL_COLUMNDESC);
              HWND    hWndColPrec   = ::GetDlgItem(hWnd, IDE_PRECISION);

              // get the selected item
              INDEX iSel = ListView_GetNextItem(hWndColumnDesc, -1, LVNI_SELECTED);

              // retrieve the column type name and copy it to the COLUMN_TYPENAME field of the list view
              // and to Column Name static field
              wSendMessage(hWndColPrec, WM_GETTEXT, MAX_NAME_LEN, wszBuffer);
              LV_SetItemText(hWndColumnDesc, iSel, COLUMN_PREC, wszBuffer);
              break;
            }
            case IDE_SCALE:
            {
              HWND    hWndColumnDesc  = ::GetDlgItem(hWnd, IDL_COLUMNDESC);
              HWND    hWndColScale  = ::GetDlgItem(hWnd, IDE_SCALE);

              // get the selected item
              INDEX iSel = ListView_GetNextItem(hWndColumnDesc, -1, LVNI_SELECTED);

              // retrieve the column type name and copy it to the COLUMN_TYPENAME field of the list view
              // and to Column Name static field
              wSendMessage(hWndColScale, WM_GETTEXT, MAX_NAME_LEN, wszBuffer);
              LV_SetItemText(hWndColumnDesc, iSel, COLUMN_SCALE, wszBuffer);
              break;
            }
          }
          return 0;
        }
      }
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      //CBN_SELCHANGE
      switch(GET_WM_COMMAND_CMD(wParam, lParam))
      {
        case CBN_SELCHANGE:
        {
          switch(GET_WM_COMMAND_ID(wParam, lParam))
          {
            case IDC_TYPENAME:
            {
              CMDIChild*  pThis     = (CMDIChild*)GetThis(hWnd);
              CSession* pCSession   = SOURCE_GETOBJECT(pThis->m_pCSource, CSession);
              HWND    hWndColumnDesc  = ::GetDlgItem(hWnd, IDL_COLUMNDESC);
              HWND    hWndTypeName  = ::GetDlgItem(hWnd, IDC_TYPENAME);
              HWND    hWndDataType  = ::GetDlgItem(hWnd, IDC_DATATYPE);
              HWND    hWndColSize   = ::GetDlgItem(hWnd, IDE_SIZE);
              HWND    hWndColPrec   = ::GetDlgItem(hWnd, IDE_PRECISION);
              HWND    hWndColScale  = ::GetDlgItem(hWnd, IDE_SCALE);
              INDEX   iSelTypeName  = (INDEX)SendMessage(hWndTypeName, CB_GETCURSEL, 0, 0);

              // get the selected item
              INDEX iSel = ListView_GetNextItem(hWndColumnDesc, -1, LVNI_SELECTED);

              // retrieve the column type name and copy it to the COLUMN_TYPENAME field of the list view
              wSendMessage(hWndTypeName, CB_GETLBTEXT, (WPARAM)iSelTypeName, wszBuffer);
              LV_SetItemText(hWndColumnDesc, iSel, COLUMN_TYPENAME, wszBuffer);
              if (iSelTypeName >= 0)
              {
                wSendMessage(hWndDataType, CB_SELECTSTRING, -1, GetDBTypeName(pCSession->m_rgProvTypes[iSelTypeName].wType));
                LV_SetItemText(hWndColumnDesc, iSel, COLUMN_DATATYPE, GetDBTypeName(pCSession->m_rgProvTypes[iSelTypeName].wType));
                StringFormat(wszBuffer, NUMELE(wszBuffer), L"%lu", pCSession->m_rgProvTypes[iSelTypeName].ulColumnSize);
                wSendMessage(hWndColSize, WM_SETTEXT, 0, wszBuffer);
                LV_SetItemText(hWndColumnDesc, iSel, COLUMN_SIZE, wszBuffer);
                if (IsNumericType(pCSession->m_rgProvTypes[iSelTypeName].wType))
                {
                  StringFormat(wszBuffer, NUMELE(wszBuffer), L"%lu", pCSession->m_rgProvTypes[iSelTypeName].ulColumnSize);
                  wSendMessage(hWndColPrec, WM_SETTEXT, 0, wszBuffer);
                  LV_SetItemText(hWndColumnDesc, iSel, COLUMN_PREC, wszBuffer);
                }
                else
                {
                  SendMessage(hWndColPrec, WM_SETTEXT, 0, (LPARAM)"0");
                  LV_SetItemText(hWndColumnDesc, iSel, COLUMN_PREC, wszBuffer);
                }
              }

              StringFormat(wszBuffer, NUMELE(wszBuffer), L"%d", pCSession->m_rgProvTypes[iSelTypeName].iMaxScale);
              wSendMessage(hWndColScale, WM_SETTEXT, 0, wszBuffer);
              LV_SetItemText(hWndColumnDesc, iSel, COLUMN_SCALE, wszBuffer);
            }
            break;

            case IDC_DATATYPE:
            {
              CMDIChild*  pThis     = (CMDIChild*)GetThis(hWnd);
              CSession* pCSession   = SOURCE_GETOBJECT(pThis->m_pCSource, CSession);
              HWND    hWndColumnDesc  = ::GetDlgItem(hWnd, IDL_COLUMNDESC);
              HWND    hWndTypeName  = ::GetDlgItem(hWnd, IDC_TYPENAME);
              HWND    hWndDataType  = ::GetDlgItem(hWnd, IDC_DATATYPE);
              HWND    hWndColSize   = ::GetDlgItem(hWnd, IDE_SIZE);
              HWND    hWndColPrec   = ::GetDlgItem(hWnd, IDE_PRECISION);
              HWND    hWndColScale  = ::GetDlgItem(hWnd, IDE_SCALE);
              INDEX   iSelDBType    = (INDEX)SendMessage(hWndDataType, CB_GETCURSEL, 0, 0);
              ULONG   i;
              INT     iSelTypeName  = 0;
              DBTYPE    wType;

              // get the selected item
              INDEX iSel = ListView_GetNextItem(hWndColumnDesc, -1, LVNI_SELECTED);

              // retrieve the column type name and copy it to the COLUMN_TYPENAME field of the list view
              wSendMessage(hWndDataType, CB_GETLBTEXT, (WPARAM)iSelDBType, wszBuffer);
              LV_SetItemText(hWndColumnDesc, iSel, COLUMN_DATATYPE, wszBuffer);

              // determine a type on the DBTYPE
              wType = (DBTYPE)g_rgDBTypes[iSelDBType].lItem;
              for (i = 0; i < pCSession->m_cProvTypes; i++)
              {
                if (wType == pCSession->m_rgProvTypes[i].wType)
                  iSelTypeName = i;
              }

              StringFormat(wszBuffer, NUMELE(wszBuffer), L"%lu", pCSession->m_rgProvTypes[iSelTypeName].ulColumnSize);
              SendMessage(hWndColSize, WM_SETTEXT, 0, (LPARAM)wszBuffer);
              LV_SetItemText(hWndColumnDesc, iSel, COLUMN_SIZE, wszBuffer);
              if(IsNumericType(wType))
              {
                StringFormat(wszBuffer, NUMELE(wszBuffer), L"%lu", pCSession->m_rgProvTypes[iSelTypeName].ulColumnSize);
                wSendMessage(hWndColPrec, WM_SETTEXT, 0, wszBuffer);
                LV_SetItemText(hWndColumnDesc, iSel, COLUMN_PREC, wszBuffer);
              }
              else
              {
                SendMessage(hWndColPrec, WM_SETTEXT, 0, (LPARAM)"0");
                LV_SetItemText(hWndColumnDesc, iSel, COLUMN_PREC, wszBuffer);
              }

              StringFormat(wszBuffer, NUMELE(wszBuffer), L"%d", pCSession->m_rgProvTypes[iSelTypeName].iMaxScale);
              wSendMessage(hWndColScale, WM_SETTEXT, 0, wszBuffer);
              LV_SetItemText(hWndColumnDesc, iSel, COLUMN_SCALE, wszBuffer);
              SendMessage(hWndTypeName, CB_SETCURSEL, iSelTypeName, 0);
              LV_SetItemText(hWndColumnDesc, iSel, COLUMN_TYPENAME, pCSession->m_rgProvTypes[iSelTypeName].wszTypeName);
            }
            break;
          }
          return 0;
        }
      }

      //Regular command messages
      switch(GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDB_ROWSETPROPERTIES:
        {
          //Get the "this" pointer
          CMDIChild *pThis      = (CMDIChild*)GetThis(hWnd);
          CMainWindow* pCMainWindow = pThis->m_pCMainWindow;
          CDataSource *pCDataSource = SOURCE_GETPARENT(pThis->m_pCSource, CDataSource);

          CPropertiesDlg sCPropertiesDlg(pCMainWindow);
          sCPropertiesDlg.SetProperties(hWnd, &DBPROPSET_ROWSETALL, IID_IRowsetInfo, NULL, pCDataSource ? pCDataSource->m_pIDBProperties : NULL, &pThis->m_CDefPropSets);
          return 0;
        }

        case IDB_COLPROP:
        {
          //Get the "this" pointer
          CMDIChild *pThis      = (CMDIChild*)GetThis(hWnd);
          CMainWindow* pCMainWindow = pThis->m_pCMainWindow;
          HWND    hWndColumnDesc  = ::GetDlgItem(hWnd, IDL_COLUMNDESC);

          CSession* pCSession   = SOURCE_GETOBJECT(pThis->m_pCSource, CSession);
          CDataSource* pCDataSource = SOURCE_GETPARENT(pCSession, CDataSource);

          // get the selected item
          ULONG iSel = ListView_GetNextItem(hWndColumnDesc, -1, LVNI_SELECTED);
          if ((LONG)iSel <0)
            return 0;

          POSITION pos  = pCSession->m_listCPropSets.FindIndex(iSel);
          CPropSets* pPropEl = pCSession->m_listCPropSets.GetAt(pos);

          CPropertiesDlg sCPropertiesDlg(pCMainWindow);
          sCPropertiesDlg.SetProperties(hWnd, &DBPROPSET_COLUMNALL, IID_IRowsetInfo, NULL, pCDataSource ? pCDataSource->m_pIDBProperties : NULL, pPropEl);
          return 0;
        }

        case IDB_ADD:
        {
          CMDIChild *pThis      = (CMDIChild*)GetThis(hWnd);
          HWND    hWndColumnDesc  = ::GetDlgItem(hWnd, IDL_COLUMNDESC);
          CSession* pCSession   = SOURCE_GETOBJECT(pThis->m_pCSource, CSession);
          ULONG   cItems      = ListView_GetItemCount(hWndColumnDesc);

          // make the insertion
          StringFormat(wszBuffer, NUMELE(wszBuffer), L"Column%lu", cItems);
          LV_InsertItem(hWndColumnDesc, cItems, COLUMN_DBCID, wszBuffer);

          // type name
          LV_InsertItem(hWndColumnDesc, cItems, COLUMN_TYPENAME, pCSession->m_rgProvTypes[0].wszTypeName);

          // data type
          for(ULONG i=0; i<g_cDBTypes; i++)
          {
            if (pCSession->m_rgProvTypes[0].wType == g_rgDBTypes[i].lItem)
              break;
          }
          LV_InsertItem(hWndColumnDesc, cItems, COLUMN_DATATYPE, g_rgDBTypes[i].pwszName);

          // Column Size, Precision and Scale
          StringFormat(wszBuffer, NUMELE(wszBuffer), L"%lu", pCSession->m_rgProvTypes[0].ulColumnSize);
          LV_InsertItem(hWndColumnDesc, cItems, COLUMN_SIZE, wszBuffer);
          LV_InsertItem(hWndColumnDesc, cItems, COLUMN_PREC, wszBuffer);
          if (IsNumericType(pCSession->m_rgProvTypes[0].wType))
            LV_InsertItem(hWndColumnDesc, cItems, COLUMN_PREC, wszBuffer);
          else
            LV_InsertItem(hWndColumnDesc, cItems, COLUMN_PREC, L"0");
          StringFormat(wszBuffer, NUMELE(wszBuffer), L"%d", pCSession->m_rgProvTypes[0].iMaxScale);
          LV_InsertItem(hWndColumnDesc, cItems, COLUMN_SCALE, wszBuffer);

          // get the selected item
          INDEX iSel = ListView_GetNextItem(hWndColumnDesc, -1, LVNI_SELECTED);
          if(iSel < 0)
          {
            LV_SetItemState(hWndColumnDesc, 0, COLUMN_DBCID, LVIS_SELECTED, LVIS_SELECTED);
          }

          // enable column properties
                    ::EnableWindow(::GetDlgItem(hWnd, IDB_COLPROP), TRUE);

          // set column properties
          pCSession->m_listCPropSets.AddTail(new CPropSets());
          return 0;
        }

        case IDB_DELETE:
        {
          CMDIChild *pThis      = (CMDIChild*)GetThis(hWnd);
          HWND    hWndColumnDesc  = ::GetDlgItem(hWnd, IDL_COLUMNDESC);
          CSession* pCSession   = SOURCE_GETOBJECT(pThis->m_pCSource, CSession);
          ULONG   cItems      = ListView_GetItemCount(hWndColumnDesc);

          // get the selected item
          ULONG iSel = ListView_GetNextItem(hWndColumnDesc, -1, LVNI_SELECTED);
          if(iSel != -1)
          {
            ListView_DeleteItem(hWndColumnDesc, iSel);
            SendMessage(::GetDlgItem(hWnd, IDE_COLNAME), WM_SETTEXT, 0, (LPARAM)"");

            // delete col props
            POSITION pos = pCSession->m_listCPropSets.FindIndex(iSel);
            CPropSets* pPropEl = pCSession->m_listCPropSets.RemoveAt(pos);
            pPropEl->RemoveAll();
          }

          if (cItems > 1)
          {
            LV_SetItemState(hWndColumnDesc, iSel == cItems-1 ? iSel-1: iSel, COLUMN_DBCID, LVIS_SELECTED, LVIS_SELECTED);
          }
          else
          {
            //Disable fields
                        ::EnableWindow(::GetDlgItem(hWnd, IDB_COLPROP), FALSE);
                        ::EnableWindow(::GetDlgItem(hWnd, IDE_COLUMNID), FALSE);
                        ::EnableWindow(::GetDlgItem(hWnd, IDC_TYPENAME), FALSE);
                        ::EnableWindow(::GetDlgItem(hWnd, IDC_DATATYPE), FALSE);
                        ::EnableWindow(::GetDlgItem(hWnd, IDE_SIZE), FALSE);
                        ::EnableWindow(::GetDlgItem(hWnd, IDE_PRECISION), FALSE);
                        ::EnableWindow(::GetDlgItem(hWnd, IDE_SCALE), FALSE);
          }
          return 0;
        }

        case IDB_AGGREGATION:
        {
          //Aggregation Combo Selection has changed...
          //If we are now using Aggregation, automatically change the requested
          //riid to IID_IUnknown, since its an error otherwise...
          if(::IsDlgButtonChecked(hWnd, IDB_AGGREGATION))
            s_CComboInterface.SetGuid(IID_IUnknown);
          return 0;
        }

        case IDCANCEL:
        {
          //Cleanup any memory allocated
          CMDIChild*    pThis     = (CMDIChild*)GetThis(hWnd);
          CSession*   pCSession   = SOURCE_GETOBJECT(pThis->m_pCSource, CSession);

          pCSession->m_listCPropSets.RemoveAll();
          EndDialog(hWnd, FALSE);
          return 0;
        }

        case IDOK:
        {
          CWaitCursor waitCursor;

          //Get the "this" pointer
          CMDIChild   *pThis      = (CMDIChild*)GetThis(hWnd);
          CSession*   pCSession   = SOURCE_GETOBJECT(pThis->m_pCSource, CSession);
          HWND      hWndColumnDesc  = ::GetDlgItem(hWnd, IDL_COLUMNDESC);
          HWND      hWndTableID   = ::GetDlgItem(hWnd, IDE_TABLEID);
          DBCOLUMNDESC  *rgColumnDesc = NULL;
          ULONG     cColumnDesc   = 0;
          IUnknown*   pIUnknown   = NULL;
          DBID      TableID;
          WCHAR     wszTableDBID[MAX_QUERY_LEN+1];
          WCHAR     wszTableName[MAX_NAME_LEN+1];
          DBPROPSET   *rgPropSet    = NULL;
          ULONG     i,cPropSet    = 0;
          HRESULT     hr;
          ULONG     ulValue;
          POSITION      pos;
          CPropSets   *pPropEl    = NULL;

          //Use Properties
          fUseProps = ::IsDlgButtonChecked(hWnd, IDB_USEPROPERTIES);

          //Obtain the Aggregation argument
          CAggregate* pCAggregate = NULL;
          fAggregation = ::IsDlgButtonChecked(hWnd, IDB_AGGREGATION);
          if(fAggregation)
            pCAggregate = new CAggregate();

          //Obtain the Output (ppIUnknown) argument
          fOutput = ::IsDlgButtonChecked(hWnd, IDB_OUTPUT);

          //Interface
          REFIID riid = s_CComboInterface.GetGuid();

          // alloc space for the column desc array
          cColumnDesc = ListView_GetItemCount(hWndColumnDesc);
          SAFE_ALLOC(rgColumnDesc, DBCOLUMNDESC, cColumnDesc);

          // get the column desc array
          for(i=0; i<cColumnDesc; i++)
          {
            // initialize the whole structure
            memset(&rgColumnDesc[i], 0, sizeof(DBCOLUMNDESC));

            // get column name
            LV_GetItemText(hWndColumnDesc, i, COLUMN_DBCID, wszBuffer, MAX_NAME_LEN);
            rgColumnDesc[i].dbcid.eKind       = DBKIND_NAME;
            rgColumnDesc[i].dbcid.uName.pwszName  = wcsDuplicate(wszBuffer);

            // get column type name
            LV_GetItemText(hWndColumnDesc, i, COLUMN_TYPENAME, wszBuffer, MAX_NAME_LEN);
            rgColumnDesc[i].pwszTypeName = wcsDuplicate(wszBuffer);

            // get column data type
            LV_GetItemText(hWndColumnDesc, i, COLUMN_DATATYPE, wszBuffer, MAX_NAME_LEN);
            rgColumnDesc[i].wType = GetDBType(wszBuffer);

            // get column size
            LV_GetItemText(hWndColumnDesc, i, COLUMN_SIZE, wszBuffer, MAX_NAME_LEN);
            rgColumnDesc[i].ulColumnSize = wcstoul(wszBuffer, NULL, 10);

            // get column precision
            LV_GetItemText(hWndColumnDesc, i, COLUMN_PREC, wszBuffer, MAX_NAME_LEN);
            ulValue = wcstoul(wszBuffer, NULL, 10);
            rgColumnDesc[i].bPrecision = (BYTE)ulValue;

            // get column size
            LV_GetItemText(hWndColumnDesc, i, COLUMN_SCALE, wszBuffer, MAX_NAME_LEN);
            ulValue = wcstoul(wszBuffer, NULL, 10);
            rgColumnDesc[i].bScale = (BYTE)ulValue;

            // get properties
            pos   = pCSession->m_listCPropSets.FindIndex(i);
            pPropEl = pCSession->m_listCPropSets.GetAt(pos);
            rgColumnDesc[i].cPropertySets = pPropEl->GetCount();
            rgColumnDesc[i].rgPropertySets  = pPropEl->GetPropSets();
          }

          // get TableID
          wSendMessage(hWndTableID, WM_GETTEXT, MAX_NAME_LEN, wszTableName);
          TableID.eKind = DBKIND_NAME;
          TableID.uName.pwszName = wszTableName;
          DBIDToString(&TableID, wszTableDBID, MAX_QUERY_LEN);

          // check whether rowset/table properties are used
          if(fUseProps)
          {
            cPropSet  = pThis->m_CDefPropSets.GetCount();
            rgPropSet = pThis->m_CDefPropSets.GetPropSets();
          }

          //ITableDefinition::CreateTable
          XTEST(hr = pCSession->m_pITableDefinition->CreateTable(pCAggregate, &TableID, cColumnDesc, rgColumnDesc, riid, cPropSet, rgPropSet, NULL, fOutput ? &pIUnknown : NULL));
          TESTC(TRACE_METHOD(hr, L"ITableDefinition::CreateTable(0x%p, %s, %lu, 0x%p, %s, %d, 0x%p, NULL, &0x%p)", pCAggregate, wszTableDBID, cColumnDesc, rgColumnDesc, GetInterfaceName(riid), cPropSet, rgPropSet, pIUnknown));

          if(fOutput)
          {
            //Handle Aggregation
            if(pCAggregate)
              pCAggregate->HandleAggregation(riid, &pIUnknown);

            //Display the Result
            //Just pass in a guess for the object type and let our helper figure out what object it is...
            //NOTE: Can pontentially return other object types: (ie: CREATE_DETERMINE_TYPE)
            if(!pThis->m_pCMainWindow->HandleObjectType(pCSession, pIUnknown, riid, eCRowset, 0, NULL, CREATE_NEWWINDOW_IFEXISTS | CREATE_DETERMINE_TYPE))
              TESTC(hr = E_FAIL);
          }

        CLEANUP:
          pThis->UpdateControls();
          for (i=0; i<cColumnDesc; i++)
          {
            SAFE_FREE(rgColumnDesc[i].pwszTypeName);
            if (DBKIND_NAME == rgColumnDesc[i].dbcid.eKind)
              SAFE_FREE(rgColumnDesc[i].dbcid.uName.pwszName);
          }
          SAFE_FREE(rgColumnDesc);
          SAFE_RELEASE(pIUnknown);
          SAFE_RELEASE(pCAggregate);

          if(SUCCEEDED(hr))
          {
            //Now just need to place this name in the EditBox
            //Inserted after the current "caret"
            pThis->m_pCQueryBox->ReplaceAll(wszTableName, FALSE/*bReplaceAll*/, TRUE/*fHighlight*/);

            pCSession->m_listCPropSets.RemoveAll(); //FreeColumnProperties();
            EndDialog(hWnd, TRUE);
            return 0;
          }
          return 0;
        }
      }
      break;
    }//WM_COMMAND

    case WM_NOTIFY:
    {
      LV_DISPINFO* pDispInfo = (LV_DISPINFO*)lParam;
      NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)lParam;

      //ListView
      switch(pDispInfo->hdr.code)
      {
        //Since we have "TwoClickActive" on this will get sent
        //Whenever a row is clicked on twice!
        //This functionality used to be done with NM_DBCLK
        case LVN_ITEMACTIVATE:
        {
          return FALSE;
        }

        case LVN_ITEMCHANGED:
        {
          HWND    hWndColumnDesc  = ::GetDlgItem(hWnd, IDL_COLUMNDESC);
          HWND    hWndColumnID  = ::GetDlgItem(hWnd, IDE_COLUMNID);
          HWND    hWndTypeName  = ::GetDlgItem(hWnd, IDC_TYPENAME);
          HWND    hWndDataType  = ::GetDlgItem(hWnd, IDC_DATATYPE);
          HWND    hWndColSize   = ::GetDlgItem(hWnd, IDE_SIZE);
          HWND    hWndColPrec   = ::GetDlgItem(hWnd, IDE_PRECISION);
          HWND    hWndColScale  = ::GetDlgItem(hWnd, IDE_SCALE);
          HWND    hWndColName   = ::GetDlgItem(hWnd, IDE_COLNAME);
          WCHAR   wszBuffer2[MAX_NAME_LEN+1];
          NMLISTVIEW  *pLV = (NMLISTVIEW*)lParam;

          if (pLV->uChanged != LVIF_STATE)
            return 0;

          // get the selected item
          INDEX iSel = pLV->iItem;
          if (!(pLV->uNewState & LVIS_SELECTED))
          {
            if (!(pLV->uOldState & LVIS_SELECTED))
              return 0;

            // this is the previously selected item
            // retrieve the column type name and copy it to the COLUMN_TYPENAME field of the list view
            // and to Column Name static field
            wSendMessage(hWndColumnID, WM_GETTEXT, MAX_NAME_LEN, wszBuffer2);
            StringFormat(wszBuffer, NUMELE(wszBuffer), L"Current item %lu (%s)", iSel, wszBuffer2);
            LV_SetItemText(hWndColumnDesc, iSel, COLUMN_DBCID, wszBuffer2);
            wSendMessage(hWndColName, WM_SETTEXT, 0, wszBuffer);

            // retrieve the column type name and copy it to the COLUMN_TYPENAME field of the list view
            // and to Column Name static field
            wSendMessage(hWndColSize, WM_GETTEXT, MAX_NAME_LEN, wszBuffer);
            LV_SetItemText(hWndColumnDesc, iSel, COLUMN_SIZE, wszBuffer);

            // retrieve the column type name and copy it to the COLUMN_TYPENAME field of the list view
            // and to Column Name static field
            wSendMessage(hWndColPrec, WM_GETTEXT, MAX_NAME_LEN, wszBuffer);
            LV_SetItemText(hWndColumnDesc, iSel, COLUMN_PREC, wszBuffer);

            // retrieve the column type name and copy it to the COLUMN_TYPENAME field of the list view
            // and to Column Name static field
            wSendMessage(hWndColScale, WM_GETTEXT, MAX_NAME_LEN, wszBuffer);
            LV_SetItemText(hWndColumnDesc, iSel, COLUMN_SCALE, wszBuffer);
          }
          else
          {
            // retrieve the column name and copy it to the IDE_COLUMNID field
            LV_GetItemText(hWndColumnDesc, iSel, COLUMN_DBCID, wszBuffer2, MAX_NAME_LEN);
            wSendMessage(hWndColumnID, WM_SETTEXT, 0, wszBuffer2);
            StringFormat(wszBuffer, NUMELE(wszBuffer), L"Current item %lu (%s)", iSel, wszBuffer2);
            wSendMessage(hWndColName, WM_SETTEXT, 0, wszBuffer);

            // retrieve the column type and copy it to the IDC_TYPENAME field
            LV_GetItemText(hWndColumnDesc, iSel, COLUMN_TYPENAME, wszBuffer, MAX_NAME_LEN);
            wSendMessage(hWndTypeName, CB_SELECTSTRING, -1, wszBuffer);

            // retrieve the column datatype and copy it to the IDC_DATATYPE field
            LV_GetItemText(hWndColumnDesc, iSel, COLUMN_DATATYPE, wszBuffer, MAX_NAME_LEN);
            wSendMessage(hWndDataType, CB_SELECTSTRING, -1, wszBuffer);

            // retrieve the column size and copy it to the IDE_SIZE field
            LV_GetItemText(hWndColumnDesc, iSel, COLUMN_SIZE, wszBuffer, MAX_NAME_LEN);
            wSendMessage(hWndColSize, WM_SETTEXT, 0, wszBuffer);

            // retrieve the column datatype and copy it to the IDE_PRECISION field
            LV_GetItemText(hWndColumnDesc, iSel, COLUMN_PREC, wszBuffer, MAX_NAME_LEN);
            wSendMessage(hWndColPrec, WM_SETTEXT, 0, wszBuffer);

            // retrieve the column datatype and copy it to the IDE_SCALE field
            LV_GetItemText(hWndColumnDesc, iSel, COLUMN_SCALE, wszBuffer, MAX_NAME_LEN);
            wSendMessage(hWndColScale, WM_SETTEXT, 0, wszBuffer);

            //Enable fields
                        ::EnableWindow(::GetDlgItem(hWnd, IDB_COLPROP), TRUE);
                        ::EnableWindow(::GetDlgItem(hWnd, IDE_COLUMNID), TRUE);
                        ::EnableWindow(::GetDlgItem(hWnd, IDC_TYPENAME), TRUE);
                        ::EnableWindow(::GetDlgItem(hWnd, IDC_DATATYPE), TRUE);
                        ::EnableWindow(::GetDlgItem(hWnd, IDE_SIZE),  TRUE);
                        ::EnableWindow(::GetDlgItem(hWnd, IDE_PRECISION),  TRUE);
                        ::EnableWindow(::GetDlgItem(hWnd, IDE_SCALE), TRUE);
          }
          return FALSE;
        }

        case LVN_ITEMCHANGING:
        {
            return FALSE; //Allow the change
        }
      }

    }//WM_NOTIFY
  }//switch message

  return FALSE;
} // CMDIChild::CreateTableProc

HRESULT CMDIChild::DeleteSelectedRows ( ) [virtual]

Definition at line 2162 of file cmdichild.cpp.

{
  //Delete the Selected row in the ListView...
  HRESULT hr = E_FAIL;
  INDEX cRows = 0;
  INDEX* rgItems = NULL;
  HROW* rghRows = NULL;
  DBROWSTATUS* rgRowStatus = NULL;
  LONG dwSelection = IDYES;
  CRowset*  pCRowset = (CRowset*)GetObject(eCRowset);

  //Is editing the Rowset allowed?
  if(!pCRowset || !pCRowset->m_pIRowsetChange)
    return E_FAIL;

  //Find the Selected Items in the ListView
  HCHAPTER hChapter = pCRowset->m_hChapter;
  LV_GetSelItems(m_pCDataGrid->m_hWnd, &cRows, &rgItems, (LPARAM**)&rghRows);
  SAFE_ALLOC(rgRowStatus, DBROWSTATUS, cRows);

  //Popup a MessageBox, Asking user if really wants to DeleteRow
  if(cRows)
  {
    dwSelection = wMessageBox(GetFocus(), MB_TASKMODAL | MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON1,
      L"IRowsetChange::DeleteRows", L"Do you wish to delete the selected row(s)?");
  }

  if(dwSelection == IDYES)
  {
    //DeleteRows from Rowset
    XTEST(hr = pCRowset->m_pIRowsetChange->DeleteRows(hChapter, cRows, rghRows, rgRowStatus));
    DisplayRowErrors(hr, cRows, rghRows, rgRowStatus);
    TESTC(TRACE_METHOD(hr, L"IRowsetChange::DeleteRows(0x%p, %lu, 0x%p, 0x%p)", hChapter, cRows, rghRows, rgRowStatus));

    //Loop over the deleted rows...
    for(INDEX i=0; i<cRows; i++)
    {
      //We are "lazy" about updating the ListView.  Since we are not
      //sure wither the provider compacts or not after deleted rows,
      //its easier and more correct to just display a "deleted" icon form
      //of the row, rather than guessing...

      //NOTE: We can go off the property DBPROP_REMOVEDELETED, but then we
      //need to adjust the "cursor" position we store, forward/backward fetch, etc.
      //Probably more useful and useable if its the same for all providers, rather
      //than have it just "disappear" on some providers and others it remains...

      //NOTE: Also this way allows you to call operations for deleted rows,
      //otherwise you can't since its removed from the view...
//      if(pCRowset->m_fRemoveDeleted)
//      {
//        //Remove the row from the listview - since the provider compacts
//        m_pCDataGrid->DeleteItem(rgItems[i]);
//      }
//      else
//      {
        //Need to indicate row was deleted, but not compacted, (use "deleted" icon)
        m_pCDataGrid->SetItemImage(rgItems[i], 0, IMAGE_DELETE);
//      }
    }
  }

CLEANUP:
  SAFE_FREE(rgRowStatus);
  SAFE_FREE(rgItems);
  SAFE_FREE(rghRows);
  return hr;
}

INT_PTR CMDIChild::DisplayDialog | ( | UINT | uID,
 |  | HWND | hWndParent,
 |  | DLGPROC | lpDialogFunc,
 |  | CBase * | pCObject,
 |  | UINT | idSource = 0 |
 | ) |  |  | [virtual]

Definition at line 239 of file cmdichild.cpp.

{
  m_idSource = idSource;
  m_pCSource = pCObject;
  return ::DisplayDialog(uID, hWndParent, lpDialogFunc, (LPARAM)this);
}

INT_PTR WINAPI CMDIChild::DropColumnProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 8310 of file cmdichild.cpp.

{
  switch(message)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;

      //Save the "this" pointer
      CMDIChild* pThis = (CMDIChild*)SetThis(hWnd, (void*)lParam);
      HWND hWndTableID  = ::GetDlgItem(hWnd, IDE_TABLEID);

      //Fill In TableID as Default
      WCHAR* pwszTableName = pThis->m_pCQueryBox->GetSelectedText();
      wSendMessage(hWndTableID, WM_SETTEXT, 0, pwszTableName);

      CenterDialog(hWnd);
      SAFE_FREE(pwszTableName);
      return TRUE;
    }

    case WM_COMMAND:
    {
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDOK:
        {
          CWaitCursor waitCursor;

          //Get the "this" pointer
          CMDIChild* pThis = (CMDIChild*)GetThis(hWnd);
          CSession* pCSession = SOURCE_GETOBJECT(pThis->m_pCSource, CSession);
          HWND hWndTableID  = ::GetDlgItem(hWnd, IDE_TABLEID);
          HWND hWndColumnID = ::GetDlgItem(hWnd, IDE_COLUMNID);
          WCHAR wszTableDBID[MAX_QUERY_LEN+1];
          WCHAR wszColumnDBID[MAX_QUERY_LEN+1];
          HRESULT hr = S_OK;

          //TableID
          DBID TableID;
          TableID.eKind = DBKIND_NAME;
          TableID.uName.pwszName = wGetWindowText(hWndTableID);
          DBIDToString(&TableID, wszTableDBID, MAX_QUERY_LEN);

          //ColumnID
          DBID ColumnID;
          ColumnID.eKind = DBKIND_NAME;
          ColumnID.uName.pwszName = wGetWindowText(hWndColumnID);
          DBIDToString(&ColumnID, wszColumnDBID, MAX_QUERY_LEN);

          //ITableDefinition::DropColumn
          XTEST(hr = pCSession->m_pITableDefinition->DropColumn(&TableID, &ColumnID));
          TESTC(TRACE_METHOD(hr, L"ITableDefinition::DropColumn(%s, %s)", wszTableDBID, wszColumnDBID));

          if(SUCCEEDED(hr))
          {
            EndDialog(hWnd, TRUE);
          }

          SAFE_FREE(TableID.uName.pwszName);
          SAFE_FREE(ColumnID.uName.pwszName);
          return 0;
        }

        case IDCANCEL:
        {
          EndDialog(hWnd, FALSE);
          return 0;
        }
      }
      break;
    }//WM_COMMAND
  }

CLEANUP:
  return FALSE;
} // CMDIChild::DropColumnProc

INT_PTR WINAPI CMDIChild::DropConstraintProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 8478 of file cmdichild.cpp.

{
  switch(message)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;

      //Save the "this" pointer
      CMDIChild* pThis = (CMDIChild*)SetThis(hWnd, (void*)lParam);
      HWND hWndTableID  = ::GetDlgItem(hWnd, IDE_TABLEID);

      //Fill In TableID as Default
      WCHAR* pwszTableName = pThis->m_pCQueryBox->GetSelectedText();
      wSendMessage(hWndTableID, WM_SETTEXT, 0, pwszTableName);

      CenterDialog(hWnd);
      SAFE_FREE(pwszTableName);
      return TRUE;
    }

    case WM_COMMAND:
    {
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDOK:
        {
          CWaitCursor waitCursor;

          //Get the "this" pointer
          CMDIChild *pThis = (CMDIChild*)GetThis(hWnd);
          CSession  *pCSession = SOURCE_GETOBJECT(pThis->m_pCSource, CSession);
          HWND    hWndTableID = ::GetDlgItem(hWnd, IDE_TABLEID);
          HWND    hWndConsID  = ::GetDlgItem(hWnd, IDE_CONSTRAINTID);
          WCHAR   wszTableDBID[MAX_QUERY_LEN+1];
          WCHAR   wszConsDBID[MAX_QUERY_LEN+1];
          HRESULT   hr = S_OK;

          //TableID
          DBID TableID;
          TableID.eKind = DBKIND_NAME;
          TableID.uName.pwszName = wGetWindowText(hWndTableID);
          DBIDToString(&TableID, wszTableDBID, MAX_QUERY_LEN);

          //ConstraintID
          DBID ConstraintID;
          ConstraintID.eKind = DBKIND_NAME;
          ConstraintID.uName.pwszName = wGetWindowText(hWndConsID);
          DBIDToString(&ConstraintID, wszConsDBID, MAX_QUERY_LEN);

          //ITableDefinitionWithConstraints::DropConstraint
          XTEST(hr = pCSession->m_pITableDefinitionWithConstraints->DropConstraint(&TableID, &ConstraintID));
          TESTC(TRACE_METHOD(hr, L"ITableDefinitionWithConstraints::DropConstraint(%s, %s)", wszTableDBID, wszConsDBID));

          if(SUCCEEDED(hr))
          {
            EndDialog(hWnd, TRUE);
          }

          SAFE_FREE(TableID.uName.pwszName);
          SAFE_FREE(ConstraintID.uName.pwszName);
          return 0;
        }

        case IDCANCEL:
        {
          EndDialog(hWnd, FALSE);
          return 0;
        }
      }
      break;
    }//WM_COMMAND
  }

CLEANUP:
  return FALSE;
} // CMDIChild::DropConstraintProc

INT_PTR WINAPI CMDIChild::DropIndexProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 7232 of file cmdichild.cpp.

{
  static CRichEditLite    s_editTableID;
  static CRichEditLite    s_editIndexID;

  switch(message)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;

      //Save the "this" pointer
      CMDIChild* pThis = (CMDIChild*)SetThis(hWnd, (void*)lParam);

      //Fill In TableID as Default
      s_editTableID.CreateIndirect(hWnd, IDE_TABLEID);
      WCHAR* pwszIndexName = pThis->m_pCQueryBox->GetSelectedText();
      s_editTableID.SetWindowText(pwszIndexName);

      //Fill In IndexID
      s_editIndexID.CreateIndirect(hWnd, IDE_INDEXID);

      CenterDialog(hWnd);
      SAFE_FREE(pwszIndexName);
      return TRUE;
    }

    case WM_COMMAND:
    {
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDOK:
        {
          CWaitCursor waitCursor;

          //Get the "this" pointer
          CMDIChild* pThis = (CMDIChild*)GetThis(hWnd);
          CSession* pCSession = SOURCE_GETOBJECT(pThis->m_pCSource, CSession);
          WCHAR wszTableDBID[MAX_NAME_LEN+1];
          WCHAR wszIndexDBID[MAX_NAME_LEN+1];
          HRESULT hr = S_OK;

          //TableID
          DBID TableID;
          TableID.eKind = DBKIND_NAME;
          TableID.uName.pwszName = s_editTableID.GetWindowText();
          DBID* pTableID = TableID.uName.pwszName ? &TableID : NULL;
          DBIDToString(pTableID, wszTableDBID, MAX_NAME_LEN);

          //IndexID
          DBID IndexID;
          IndexID.eKind = DBKIND_NAME;
          IndexID.uName.pwszName = s_editIndexID.GetWindowText();
          DBID* pIndexID = IndexID.uName.pwszName ? &IndexID : NULL;
          DBIDToString(pIndexID, wszIndexDBID, MAX_NAME_LEN);

          //IIndexDefinition::DropIndex
          XTEST(hr = pCSession->m_pIIndexDefinition->DropIndex(pTableID, pIndexID));
          TRACE_METHOD(hr, L"IIndexDefinition::DropIndex(%s, %s)", wszTableDBID, wszIndexDBID);

          if(SUCCEEDED(hr))
            EndDialog(hWnd, TRUE);

          SAFE_FREE(TableID.uName.pwszName);
          SAFE_FREE(IndexID.uName.pwszName);
          return 0;
        }

        case IDCANCEL:
        {
          EndDialog(hWnd, FALSE);
          return 0;
        }
      }
      break;
    }//WM_COMMAND
  }

  return FALSE;
}

INT_PTR WINAPI CMDIChild::DropTableProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 8399 of file cmdichild.cpp.

{
  switch(message)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;

      //Save the "this" pointer
      CMDIChild* pThis = (CMDIChild*)SetThis(hWnd, (void*)lParam);
      HWND hWndTableID  = ::GetDlgItem(hWnd, IDE_TABLEID);

      //Fill In TableID as Default
      WCHAR* pwszTableName = pThis->m_pCQueryBox->GetSelectedText();
      wSendMessage(hWndTableID, WM_SETTEXT, 0, pwszTableName);

      CenterDialog(hWnd);
      SAFE_FREE(pwszTableName);
      return TRUE;
    }

    case WM_COMMAND:
    {
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDOK:
        {
          CWaitCursor waitCursor;

          //Get the "this" pointer
          CMDIChild* pThis = (CMDIChild*)GetThis(hWnd);
          CSession* pCSession = SOURCE_GETOBJECT(pThis->m_pCSource, CSession);
          HWND hWndTableID  = ::GetDlgItem(hWnd, IDE_TABLEID);
          WCHAR wszTableDBID[MAX_QUERY_LEN+1];
          HRESULT hr = S_OK;

          //TableID
          DBID TableID;
          TableID.eKind = DBKIND_NAME;
          TableID.uName.pwszName = wGetWindowText(hWndTableID);
          DBIDToString(&TableID, wszTableDBID, MAX_QUERY_LEN);

          //ITableDefinition::DropTable
          XTEST(hr = pCSession->m_pITableDefinition->DropTable(&TableID));
          TRACE_METHOD(hr, L"ITableDefinition::DropTable(%s)", wszTableDBID);

          if(SUCCEEDED(hr))
          {
            EndDialog(hWnd, TRUE);
          }

          SAFE_FREE(TableID.uName.pwszName);
          return 0;
        }

        case IDCANCEL:
        {
          EndDialog(hWnd, FALSE);
          return 0;
        }
      }
      break;
    }//WM_COMMAND
  }

  return FALSE;
}

INT_PTR WINAPI CMDIChild::ExecuteProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 8937 of file cmdichild.cpp.

{
  static CComboBoxGuid  s_CComboInterface;
  static BOOL fSetCommandText   = TRUE;       //Default to TRUE
  static BOOL fSetCommandStream = FALSE;      //Default to FALSE
  static BOOL fUseParams      = FALSE;      //Default to FALSE
  static BOOL fAggregation    = FALSE;      //Default
  static BOOL fOutput       = TRUE;       //Default

  switch(message)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;

      //Save the "this" pointer
      CMDIChild* pThis      = (CMDIChild*)SetThis(hWnd, (void*)lParam);
      CDataSource* pCDataSource = SOURCE_GETPARENT(pThis->m_pCSource, CDataSource);

      //Fill In CommandText as Default
      HWND hWndCmdText  = ::GetDlgItem(hWnd, IDE_COMMANDTEXT);
      WCHAR* pwszQuery = pThis->m_pCQueryBox->GetSelectedText();
      wSendMessage(hWndCmdText, WM_SETTEXT, 0, pwszQuery);

      //Use Parameters
            ::CheckDlgButton(hWnd, IDB_USEPARAMS,    BST2STATE(fUseParams));
      //SetCommandText
            ::CheckDlgButton(hWnd, IDB_SETCOMMANDTEXT, BST2STATE(fSetCommandText));
      //SetCommandStream
            ::CheckDlgButton(hWnd, IDB_SETCOMMANDSTREAM,BST2STATE(fSetCommandStream));
      //None
            ::CheckDlgButton(hWnd, IDB_SETCOMMANDNONE, BST2STATE(!(fSetCommandText || fSetCommandStream)));

      //Aggregation
            ::CheckDlgButton(hWnd, IDB_AGGREGATION,    BST2STATE(fAggregation));

      //Output (ppIUnknown)
            ::CheckDlgButton(hWnd, IDB_OUTPUT,     BST2STATE(fOutput));

      //Interface List...
      s_CComboInterface.CreateIndirect(hWnd, IDC_INTERFACE);
      s_CComboInterface.Populate(g_cInterfaceMaps, g_rgInterfaceMaps);
      if(s_CComboInterface.RestoreSelection() == CB_ERR)
        s_CComboInterface.SetGuid(IID_IRowset);

      //Defaults (refiid) other than those last used...
      if(pCDataSource && BIT_SET(pCDataSource->m_lDataSourceType, DBPROPVAL_DST_MDP))
        s_CComboInterface.SetGuid(IID_IMDDataset);
      else if(s_CComboInterface.GetGuid() == IID_IMDDataset)
        s_CComboInterface.SetGuid(IID_IRowset);

      CenterDialog(hWnd);
      SAFE_FREE(pwszQuery);
      return TRUE;
    }

    case WM_COMMAND:
    {
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDB_SETPARAMS:
        {
          //Get the "this" pointer
          CMDIChild* pThis      = (CMDIChild*)GetThis(hWnd);

          //Display the Parameter Dialog
          CExecuteParamDlg paramDlg(pThis);
          if(IDOK == paramDlg.DoModal(hWnd))
          {
            //Since the user setup the params correctly they probably want to
            //now use these parameters with execute.  Check the "use params" box...
                        ::CheckDlgButton(hWnd, IDB_USEPARAMS, BST2STATE(TRUE));
          }
          return 0;
        }

        case IDB_SETPROPERTIES:
        {
          //Get the "this" pointer
          CMDIChild* pThis      = (CMDIChild*)GetThis(hWnd);
          CMainWindow* pCMainWindow = pThis->m_pCMainWindow;
          CCommand* pCCommand     = SOURCE_GETOBJECT(pThis->m_pCSource, CCommand);
          CDataSource* pCDataSource = SOURCE_GETPARENT(pCCommand, CDataSource);
          CRowset* pCRowset     = (CRowset*)pThis->GetObject(eCRowset);

          //We should release the Open Objects at this point (avoid DB_E_OPENOBJECT)
          if(pCCommand && pThis->GetOptions()->m_dwCommandOpts & COMMAND_RELEASE_OPENOBJECTS)
          {
            pCCommand->ReleaseChildren();
            pThis->UpdateControls();
          }

          //ICommandProperties::SetProperties
          CPropertiesDlg sCPropertiesDlg(pCMainWindow);
          sCPropertiesDlg.SetProperties(hWnd, &DBPROPSET_ROWSETALL, IID_ICommandProperties, pCCommand->m_pICommandProperties, pCDataSource ? pCDataSource->m_pIDBProperties : NULL);
          return 0;
        }

        case IDB_AGGREGATION:
        {
          //Aggregation Combo Selection has changed...
          //If we are now using Aggregation, automatically change the requested
          //riid to IID_IUnknown, since its an error otherwise...
          if(::IsDlgButtonChecked(hWnd, IDB_AGGREGATION))
            s_CComboInterface.SetGuid(IID_IUnknown);
          return 0;
        }

        case IDB_SETCOMMANDSTREAM:
        {
          //By default:  If the user chooses to use ICommandStream::SetCommandStream
          //they probably want a stream back as well, set this for them.  They can always
          //override this, byt changing it in the combo afterwards...
          if(::IsDlgButtonChecked(hWnd, IDB_SETCOMMANDSTREAM))
            s_CComboInterface.SetGuid(IID_ISequentialStream);
          return 0;
        }

        case IDOK:
        {
          CWaitCursor waitCursor;

          //Get the "this" pointer
          CMDIChild* pThis = (CMDIChild*)GetThis(hWnd);
          CCommand* pCCommand = SOURCE_GETOBJECT(pThis->m_pCSource, CCommand);

          HWND hWndCmdText  = ::GetDlgItem(hWnd, IDE_COMMANDTEXT);
          HRESULT hr = S_OK;
          IUnknown* pIUnknown = NULL;
          WCHAR* pwszCommandText = NULL;

          //Obtain the Aggregation argument
          CAggregate* pCAggregate = NULL;
          fAggregation = ::IsDlgButtonChecked(hWnd, IDB_AGGREGATION);
          if(fAggregation)
            pCAggregate = new CAggregate();

          //Obtain the Output (ppIUnknown) argument
          fOutput = ::IsDlgButtonChecked(hWnd, IDB_OUTPUT);

          //Interface
          IID iid     = s_CComboInterface.GetGuid();

          //Use Parameters
          fUseParams    = ::IsDlgButtonChecked(hWnd, IDB_USEPARAMS);

          //SetCommandText
          fSetCommandText = ::IsDlgButtonChecked(hWnd, IDB_SETCOMMANDTEXT);
          fSetCommandStream = ::IsDlgButtonChecked(hWnd, IDB_SETCOMMANDSTREAM);
          if(fSetCommandText || fSetCommandStream)
            pwszCommandText = wGetWindowText(hWndCmdText);

          //Execute the Command
          TESTC(hr = pCCommand->Execute(pCAggregate, pwszCommandText, iid, fUseParams, NULL, fOutput ? &pIUnknown : NULL, fSetCommandStream));

          //Process the Rowset
          TESTC(hr = pThis->HandleRowset(pCCommand, pIUnknown, iid, CREATE_NEWWINDOW_IFEXISTS, IID_ICommand, pwszCommandText));

        CLEANUP:
          if(SUCCEEDED(hr))
          {
            //Now just need to place this name in the EditBox
            //Inserted after the current "caret"
            if(fSetCommandText)
              pThis->m_pCQueryBox->ReplaceAll(pwszCommandText, FALSE/*bReplaceAll*/, TRUE/*fHighlight*/);
            EndDialog(hWnd, TRUE);
          }

          SAFE_RELEASE(pCAggregate);
          SAFE_RELEASE(pIUnknown);
          SAFE_FREE(pwszCommandText);
          pThis->UpdateControls();
          return 0;
        }

        case IDCANCEL:
        {
          EndDialog(hWnd, FALSE);
          return 0;
        }
      }
      break;
    }//WM_COMMAND
  }

  return FALSE;
}

INT_PTR WINAPI CMDIChild::FindNextRowProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 9768 of file cmdichild.cpp.

{
  static INDEX  iSavedCol   = 1;    //Default column
  static INDEX  iSavedOp    = 2;    //Default DBCOMPAREOPS_EQ
  static LONG   cSavedRows    = 1;    //Default to cRows=1
  static DWORD  dwCompareOps  = 0;    //Default to not CASESENSITIVE

  switch(message)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;

      //Save the "this" pointer
      CMDIChild* pThis = (CMDIChild*)SetThis(hWnd, (void*)lParam);
      CRowset* pCRowset = SOURCE_GETOBJECT(pThis->m_pCSource, CRowset);
      INDEX iSel = 0;

      HWND hWndColumn   = ::GetDlgItem(hWnd, IDC_COLUMN);
      HWND hWndCompareOp  = ::GetDlgItem(hWnd, IDC_COMPAREOP);
      HWND hWndcRows    = ::GetDlgItem(hWnd, IDE_COUNT);
      HWND hWndValue    = ::GetDlgItem(hWnd, IDE_VALUE);

      //Column List...
      for(ULONG i=0; i<pCRowset->m_Bindings.GetCount(); i++)
      {
        //Column Ordinal - Column Name
        DBORDINAL iOrdinal = pCRowset->m_Bindings[i].iOrdinal;
        const DBCOLUMNINFO* pColInfo = pCRowset->m_ColumnInfo.GetOrdinal(iOrdinal);
        iSel = (INDEX)wSendMessageFmt(hWndColumn, CB_ADDSTRING, 0, L"%2d - %s", iOrdinal, GetColName(pColInfo));
        SendMessage(hWndColumn, CB_SETITEMDATA, iSel, (LPARAM)i);
      }

      //Set Default...
      SendMessage(hWndColumn, CB_SETCURSEL, iSavedCol < (INDEX)pCRowset->m_Bindings.GetCount() && iSavedCol!=CB_ERR ? iSavedCol : 0, 0);

      const static WIDENAMEMAP rgCompareOps[] =
      {
        VALUE_WCHAR(DBCOMPAREOPS_LT),
        VALUE_WCHAR(DBCOMPAREOPS_LE),
        VALUE_WCHAR(DBCOMPAREOPS_EQ),
        VALUE_WCHAR(DBCOMPAREOPS_GE),
        VALUE_WCHAR(DBCOMPAREOPS_GT),
        VALUE_WCHAR(DBCOMPAREOPS_BEGINSWITH),
        VALUE_WCHAR(DBCOMPAREOPS_CONTAINS),
        VALUE_WCHAR(DBCOMPAREOPS_NE),
        VALUE_WCHAR(DBCOMPAREOPS_IGNORE),
        VALUE_WCHAR(DBCOMPAREOPS_NOTBEGINSWITH),
        VALUE_WCHAR(DBCOMPAREOPS_NOTCONTAINS),
      };

      //CompareOp List...
      for(i=0; i<NUMELE(rgCompareOps); i++)
      {
        iSel = (INDEX)wSendMessage(hWndCompareOp, CB_ADDSTRING, 0, rgCompareOps[i].pwszName);
        SendMessage(hWndCompareOp, CB_SETITEMDATA, iSel, (LPARAM)rgCompareOps[i].lItem);
      }

      //Set Default...
      iSavedOp = (INDEX)SendMessage(hWndCompareOp, CB_SETCURSEL, iSavedOp != CB_ERR ? iSavedOp : 0, 0);

      //dwModifiers
      //DBCOMPAREOPS_CASESENSITIVE
      //DBCOMPAREOPS_CASEINSENSITIVE
            ::CheckDlgButton(hWnd, IDB_CASESENSITIVE,    BST2STATE(dwCompareOps & DBCOMPAREOPS_CASESENSITIVE));
            ::CheckDlgButton(hWnd, IDB_CASEINSENSITIVE,    BST2STATE(dwCompareOps & DBCOMPAREOPS_CASEINSENSITIVE));

      //cRows
      wSendMessageFmt(hWndcRows, WM_SETTEXT, 0, L"%lu", cSavedRows);

      //Value
      SendMessage(hWndValue, WM_SETTEXT, 0, (LPARAM)"");

      CenterDialog(hWnd);
      return TRUE;
    }

    case WM_COMMAND:
    {
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDOK:
        {
          CWaitCursor waitCursor;

          //Get the "this" pointer
          CMDIChild* pThis = (CMDIChild*)GetThis(hWnd);
          CRowset* pCRowset = SOURCE_GETOBJECT(pThis->m_pCSource, CRowset);
          HRESULT hr = S_OK;

          HWND hWndColumn   = ::GetDlgItem(hWnd, IDC_COLUMN);
          HWND hWndCompareOp  = ::GetDlgItem(hWnd, IDC_COMPAREOP);
          HWND hWndcRows    = ::GetDlgItem(hWnd, IDE_COUNT);
          HWND hWndValue    = ::GetDlgItem(hWnd, IDE_VALUE);

          HACCESSOR hAccessor = NULL;

          //Bookmark
          DBBKMARK cbBookmark = 0;
          BYTE* pBookmark = NULL;

          HROW hRow = NULL;
          void* pData = pCRowset->m_pData;
          DBROWOFFSET lOffset = 0;
          DBCOUNTITEM cRowsObtained = 0;
          HROW* rghRows = NULL;
          HCHAPTER hChapter = pCRowset->m_hChapter;

          //Column
          iSavedCol = (INDEX)SendMessage(hWndColumn, CB_GETCURSEL, 0, 0);
          DBCOUNTITEM iBinding = SendMessage(hWndColumn, CB_GETITEMDATA, iSavedCol!=CB_ERR ? iSavedCol : 0, 0);
          const DBBINDING* pBinding   = &pCRowset->m_Bindings[iBinding];
          const DBCOLUMNINFO* pColInfo  = pCRowset->m_ColumnInfo.GetOrdinal(pBinding->iOrdinal);

          //CompareOp
          iSavedOp = (INDEX)SendMessage(hWndCompareOp, CB_GETCURSEL, 0, 0);
          dwCompareOps = (DBCOMPAREOP)SendMessage(hWndCompareOp, CB_GETITEMDATA, iSavedOp != CB_ERR ? iSavedOp : 0, 0);

          //dwModifiers
          if(::IsDlgButtonChecked(hWnd, IDB_CASESENSITIVE))
            dwCompareOps |= DBCOMPAREOPS_CASESENSITIVE;
          if(::IsDlgButtonChecked(hWnd, IDB_CASEINSENSITIVE))
            dwCompareOps |= DBCOMPAREOPS_CASEINSENSITIVE;

          //cRows
          GetEditBoxValue(hWndcRows, &cSavedRows);

          //Value
          WCHAR* pwszValue = wGetWindowText(hWndValue);

          //Create An Accessor binding only this column
          TESTC(hr = pCRowset->CreateAccessor(DBACCESSOR_ROWDATA, 1, pBinding, 0, &hAccessor));

          //Setup the pData buffer containg the users value
          TESTC(hr = pCRowset->SetColumnData(pBinding, pData, DBSTATUS_S_OK, pwszValue ? wcslen(pwszValue) : 0, pwszValue ? pwszValue : L"", CONV_NONE, pColInfo->wType));

          //Obtain the bookmark(s) for the selected row(s)...
          if(pThis->m_pCDataGrid->GetSelectedRow(&hRow, FALSE)!=LVM_ERR)
            hr = pCRowset->GetBookmark(hRow, &cbBookmark, (BYTE**)&pBookmark);

          //Release previously fetched rows, (if user requested)
          TESTC(hr = pThis->m_pCDataGrid->ReleaseHeldRows());

          //IRowsetFind::FindNextRow
          XTEST(hr = pCRowset->m_pIRowsetFind->FindNextRow(hChapter, hAccessor, pData, dwCompareOps, cbBookmark, pBookmark, lOffset, cSavedRows, &cRowsObtained, &rghRows));
          TESTC(TRACE_METHOD(hr, L"IRowsetFind::FindNextRow(0x%p, 0x%p, \"%s\", 0x%08x, %lu, 0x%p, %ld, %ld, &%lu, &0x%p)", hChapter, hAccessor, pwszValue, dwCompareOps, cbBookmark, pBookmark, lOffset, cSavedRows,  cRowsObtained, rghRows));

        CLEANUP:
          //TODO - need to free in the case of errors as well.  But have to be careful
          //since the pData may not have been setup yet, or other errors where its undefined...
          if(SUCCEEDED(hr))
            FreeBindingData(1, pBinding, pData, TRUE/*SetData*/);

          pCRowset->ReleaseAccessor(&hAccessor);
          SAFE_FREE(pBookmark);
          SAFE_FREE(rghRows);
          SAFE_FREE(pwszValue);

          if(SUCCEEDED(hr))
          {
            EndDialog(hWnd, TRUE);
            return 0;
          }
          return 0;
        }

        case IDCANCEL:
        {
          EndDialog(hWnd, FALSE);
          return 0;
        }
      }
      break;
    }//WM_COMMAND
  }

  return FALSE;
}

INT_PTR WINAPI CMDIChild::GetAxisInfoProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 3523 of file cmdichild.cpp.

{
  static BOOL bBeginEdit = FALSE;
  static CListViewLite  s_listAxisInfo;
  static CComboBoxLite  s_comboAxis;

  switch(message)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;
      bBeginEdit = FALSE;
      HRESULT hr = S_OK;

      //Save the "this" pointer
      CMDIChild* pThis = (CMDIChild*)SetThis(hWnd, (void*)lParam);
      CDataset* pCDataset = SOURCE_GETOBJECT(pThis->m_pCDataAccess, CDataset);
      DBCOUNTITEM cAxis;
      MDAXISINFO *rgAxisInfo;
      WCHAR wszBuffer[MAX_NAME_LEN];

      //Setup the ListView
      s_listAxisInfo.CreateIndirect(hWnd, IDL_AXISINFO);
      s_comboAxis.CreateIndirect(hWnd, IDCOMBO_AXIS);

      //Use Extended ListView Styles!
      SendMessage(s_listAxisInfo.m_hWnd, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE , LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE);

      //Insert Column Headers
      s_listAxisInfo.InsertColumn(0, L"Dimension Names");
      s_listAxisInfo.InsertColumn(1, L"Columns");

      // get the axis info from the dataset
      ASSERT(pCDataset);
      hr = pCDataset->GetAxisInfo(&cAxis, &rgAxisInfo);

      if (SUCCEEDED(hr) && cAxis != 0)
      {
        // fill in the axis selection combo
        for (ULONG iAxis=0; iAxis<cAxis-1; iAxis++)
        {
          switch (iAxis)
          {
            case 0:
              s_comboAxis.AddString(L"Columns");
              break;

            case 1:
              s_comboAxis.AddString(L"Rows");
              break;

            default:
              StringFormat(wszBuffer, NUMELE(wszBuffer), L"%lu", iAxis);
              s_comboAxis.AddString(wszBuffer);
              break;
          };
        }

        s_comboAxis.AddString(L"Slicer");
        s_comboAxis.SetCurSel(0);

        wSendMessageFmt(::GetDlgItem(hWnd, IDC_DIMENSIONS), WM_SETTEXT, 0, L"%lu", rgAxisInfo->cDimensions);
        wSendMessageFmt(::GetDlgItem(hWnd, IDC_COORDINATES), WM_SETTEXT, 0, L"%lu", rgAxisInfo->cCoordinates);

        //Display Dimension Names in LeftPane, and Column Count in right pane
        for(ULONG iDim=0; iDim<rgAxisInfo->cDimensions; iDim++)
        {
          s_listAxisInfo.InsertItem(iDim, 0, rgAxisInfo->rgpwszDimensionNames[iDim]);

          StringFormat(wszBuffer, NUMELE(wszBuffer), L"%lu", rgAxisInfo->rgcColumns[iDim]);
          s_listAxisInfo.InsertItem(iDim, 1, wszBuffer);
        }
      }

      //AutoSize Columns
      s_listAxisInfo.SetColumnWidth(0, LVSCW_AUTOSIZE_USEHEADER);
      s_listAxisInfo.SetColumnWidth(1, LVSCW_AUTOSIZE_USEHEADER);
      CenterDialog(hWnd);

      //Cleanup
      pCDataset->FreeAxisInfo(&cAxis, &rgAxisInfo);
      return TRUE;
    }

    case WM_COMMAND:
    {
      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDOK:
        {
          CWaitCursor waitCursor;

          //The ListView will produce IDOK if hitting return after
          //entering a value.  The easist way arround this is to just exit if
          //we haven't yet received the ENDEDIT message
          if(bBeginEdit)
            return FALSE;

          EndDialog(hWnd, TRUE);
          return 0;
        }

        case IDCANCEL:
        {
          EndDialog(hWnd, TRUE);
          return 0;
        }

        case IDCOMBO_AXIS:
        {
          switch(GET_WM_COMMAND_CMD(wParam, lParam))
          {
            //Selection change in axis combo box
            case CBN_SELCHANGE:
            {
              HRESULT hr = S_OK;
              DBCOUNTITEM cAxis;
              MDAXISINFO *rgAxisInfo;
              WCHAR wszBuffer[MAX_NAME_LEN];
              CMDIChild* pThis = (CMDIChild*)GetThis(hWnd);
              CDataset* pCDataset = SOURCE_GETOBJECT(pThis->m_pCDataAccess, CDataset);

              INDEX iAxis = s_comboAxis.GetCurSel();
              s_listAxisInfo.DeleteAllItems();

              // get the axis info from the dataset
              ASSERT(pCDataset);
              hr = pCDataset->GetAxisInfo(&cAxis, &rgAxisInfo);
              if (SUCCEEDED(hr) && cAxis >= (DBCOUNTITEM)iAxis)
              {
                wSendMessageFmt(::GetDlgItem(hWnd, IDC_DIMENSIONS), WM_SETTEXT, 0, L"%lu", rgAxisInfo[iAxis].cDimensions);
                wSendMessageFmt(::GetDlgItem(hWnd, IDC_COORDINATES), WM_SETTEXT, 0, L"%lu", rgAxisInfo[iAxis].cCoordinates);

                //Display Dimension Names in LeftPane, and Column Count in right pane
                for(ULONG iDim=0; iDim<rgAxisInfo[iAxis].cDimensions; iDim++)
                {
                  s_listAxisInfo.InsertItem(iDim, 0, rgAxisInfo[iAxis].rgpwszDimensionNames[iDim]);

                  StringFormat(wszBuffer, NUMELE(wszBuffer), L"%lu", rgAxisInfo[iAxis].rgcColumns[iDim]);
                  s_listAxisInfo.InsertItem(iDim, 1, wszBuffer);
                }
              }

              //Cleanup
              pCDataset->FreeAxisInfo(&cAxis, &rgAxisInfo);
              return 0;
            }
          }
        }
      }
      break;
    }//WM_COMMAND
  }//switch(message);
  return FALSE;
}

INT_PTR WINAPI CMDIChild::GetAxisRowsetProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 3684 of file cmdichild.cpp.

{
  static CComboBoxGuid    s_CComboInterface;
  static CComboBoxLite    s_comboAxis;

  static BOOL fUseProps   = TRUE;     //Default
  static BOOL fAggregation  = FALSE;    //Default
  static BOOL fOutput     = TRUE;     //Default

  switch(message)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;
      HRESULT hr = S_OK;

      //Save the "this" pointer
      CMDIChild* pThis = (CMDIChild*)SetThis(hWnd, (void*)lParam);
      CDataset* pCDataset = SOURCE_GETOBJECT(pThis->m_pCDataAccess, CDataset);
      DBCOUNTITEM cAxis;
      MDAXISINFO *rgAxisInfo;
      WCHAR wszBuffer[MAX_NAME_LEN];

      //Setup the Combo
      s_comboAxis.CreateIndirect(hWnd, IDCOMBO_AXIS);

      // get the axis info from the dataset
      ASSERT(pCDataset);
      hr = pCDataset->GetAxisInfo(&cAxis, &rgAxisInfo);

      if(SUCCEEDED(hr) && cAxis)
      {
        // fill in the axis selection combo
        for (ULONG iAxis=0; iAxis<cAxis-1; iAxis++)
        {
          switch (iAxis)
          {
            case 0:
              s_comboAxis.AddString(L"Columns");
              break;

            case 1:
              s_comboAxis.AddString(L"Rows");
              break;

            default:
              StringFormat(wszBuffer, NUMELE(wszBuffer), L"%lu", iAxis);
              s_comboAxis.AddString(wszBuffer);
              break;
          };
        }

        s_comboAxis.AddString(L"Slicer");
        s_comboAxis.SetCurSel(0);
      }

      //Use Properties
            ::CheckDlgButton(hWnd, IDB_USEPROPERTIES,  BST2STATE(fUseProps));

      //Aggregation
            ::CheckDlgButton(hWnd, IDB_AGGREGATION,    BST2STATE(fAggregation));

      //Output (ppIUnknown)
            ::CheckDlgButton(hWnd, IDB_OUTPUT,     BST2STATE(fOutput));

      //Interface List...
      s_CComboInterface.CreateIndirect(hWnd, IDC_INTERFACE);
      s_CComboInterface.Populate(g_cInterfaceMaps, g_rgInterfaceMaps);
      if(s_CComboInterface.RestoreSelection() == CB_ERR)
        s_CComboInterface.SetGuid(IID_IRowset);

      //Cleanup
      pCDataset->FreeAxisInfo(&cAxis, &rgAxisInfo);
      CenterDialog(hWnd);
      return TRUE;
    }

    case WM_COMMAND:
    {
      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDB_SETPROPERTIES:
        {
          //Get the "this" pointer
          CMDIChild* pThis      = (CMDIChild*)GetThis(hWnd);
          CMainWindow* pCMainWindow = pThis->m_pCMainWindow;
          CDataSource* pCDataSource = SOURCE_GETPARENT(pThis->m_pCSource, CDataSource);

          CPropertiesDlg sCPropertiesDlg(pCMainWindow);
          sCPropertiesDlg.SetProperties(hWnd, &DBPROPSET_ROWSETALL, IID_IRowsetInfo, NULL, pCDataSource ? pCDataSource->m_pIDBProperties : NULL, &pThis->m_CDefPropSets);
          return 0;
        }

        case IDB_AGGREGATION:
        {
          //Aggregation Combo Selection has changed...
          //If we are now using Aggregation, automatically change the requested
          //riid to IID_IUnknown, since its an error otherwise...
          if(::IsDlgButtonChecked(hWnd, IDB_AGGREGATION))
            s_CComboInterface.SetGuid(IID_IUnknown);
          return 0;
        }

        case IDOK:
        {
          CWaitCursor waitCursor;

          //Get the "this" pointer
          CMDIChild* pThis = (CMDIChild*)GetThis(hWnd);
          CDataset* pCDataset = SOURCE_GETOBJECT(pThis->m_pCDataAccess, CDataset);
          CComPtr<IUnknown> spUnknown;
          HRESULT hr = S_OK;

          ULONG cPropSets = 0;
          DBPROPSET* rgPropSets = NULL;

          //Obtain the Aggregation argument
          CAggregate* pCAggregate = NULL;
          fAggregation = ::IsDlgButtonChecked(hWnd, IDB_AGGREGATION);
          if(fAggregation)
            pCAggregate = new CAggregate();

          //Obtain the Output (ppIUnknown) argument
          fOutput = ::IsDlgButtonChecked(hWnd, IDB_OUTPUT);

          //Interface
          REFIID riid = s_CComboInterface.GetGuid();

          //Use Properties
          fUseProps = ::IsDlgButtonChecked(hWnd, IDB_USEPROPERTIES);
          if(fUseProps)
          {
            cPropSets = pThis->m_CDefPropSets.GetCount();
            rgPropSets = pThis->m_CDefPropSets.GetPropSets();
          }

          //Obtain the selected Axis
          ASSERT(pCDataset);
          DBCOUNTITEM iAxis = s_comboAxis.GetCurSel();

          //GetAxisRowset
          if(SUCCEEDED(hr = pCDataset->GetAxisRowset(pCAggregate, iAxis, riid, cPropSets, rgPropSets, fOutput ? &spUnknown : NULL)))
          {
            //Now that we have the rowset, display it...
            //NOTE: Can pontentially return other object types: (ie: CREATE_DETERMINE_TYPE)
            if(!pThis->m_pCMainWindow->HandleObjectType(pCDataset, spUnknown, riid, eCRowset, 0, NULL, CREATE_NEWWINDOW | CREATE_DETERMINE_TYPE))
              TESTC(hr = E_FAIL);
          }

        CLEANUP:
          SAFE_RELEASE(pCAggregate);
          if(SUCCEEDED(hr))
            EndDialog(hWnd, TRUE);
          return 0;
        }

        case IDCANCEL:
        {
          EndDialog(hWnd, TRUE);
          return 0;
        }
      }
      break;
    }//WM_COMMAND
  }//switch(message);
  return FALSE;
}

INT_PTR WINAPI CMDIChild::GetBindingsProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 4210 of file cmdichild.cpp.

{
  switch(message)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;
      WCHAR wszBuffer[MAX_NAME_LEN+1];

      //Save the "this" pointer
      CMDIChild* pThis = (CMDIChild*)SetThis(hWnd, (void*)lParam);
      HRESULT hr = S_OK;

      //Determine which object this is called from
      CDataAccess* pCDataAccess = SOURCE_GETOBJECT(pThis->m_pCSource, CDataAccess);
      ASSERT(pCDataAccess);

      ULONG i = 0;
      DBCOUNTITEM cBindings = 0;
      DBBINDING* rgBindings = NULL;
      DBACCESSORFLAGS dwAccessorFlags = 0;

      //Setup column headers
      HWND hWndName   = ::GetDlgItem(hWnd, IDL_NAMES);
      HWND hWndValue    = ::GetDlgItem(hWnd, IDL_VALUES);
      HWND hWndHelp   = ::GetDlgItem(hWnd, IDT_HELPMSG);

      //Set Window Titles
      SendMessage(hWnd,   WM_SETTEXT, 0, (LPARAM)"IAccessor::GetBindings");
      SendMessage(hWndHelp, WM_SETTEXT, 0, (LPARAM)"Displays the rgBindings from the Accessor");

      //Use Extended ListView Styles!
      SendMessage(hWndName, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE);
      SendMessage(hWndValue,  LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE);

      //Set image list to the Window
      ListView_SetImageList(hWndName, ImageList_LoadImage(GetAppLite()->m_hInstance, MAKEINTRESOURCE(IDB_IMAGE), 16, 16, CLR_DEFAULT , IMAGE_BITMAP, LR_DEFAULTCOLOR), LVSIL_SMALL);
      ListView_SetImageList(hWndValue, ImageList_LoadImage(GetAppLite()->m_hInstance, MAKEINTRESOURCE(IDB_IMAGE), 16, 16, CLR_DEFAULT , IMAGE_BITMAP, LR_DEFAULTCOLOR), LVSIL_SMALL);

      //Now IAccessor::GetBindings
      ASSERT(pCDataAccess->m_pIAccessor);
      XTEST(hr = pCDataAccess->m_pIAccessor->GetBindings(pCDataAccess->m_hAccessor, &dwAccessorFlags, &cBindings, &rgBindings));
      TESTC(TRACE_METHOD(hr, L"IAccessor::GetBindings(0x%p, &0x%08x, &%lu, &0x%p)", pCDataAccess->m_hAccessor, dwAccessorFlags, cBindings, rgBindings));

      //We need to the ListView
      //Headers/Columns contain ColInfo information
      //Rows are per columns

      //ListView Columns
      LV_InsertColumn(hWndName, 0,    L"ColName");
      LV_InsertItem(hWndName,   0,    0,  L"Ordinal");
      LV_InsertItem(hWndName,   1,    0,  L"obValue");
      LV_InsertItem(hWndName,   2,    0,  L"obLength");
      LV_InsertItem(hWndName,   3,    0,  L"obStatus");
      LV_InsertItem(hWndName,   4,    0,  L"pTypeInfo");
      LV_InsertItem(hWndName,   5,    0,  L"pObject");
      LV_InsertItem(hWndName,   6,    0,  L"pBindExt");
      LV_InsertItem(hWndName,   7,    0,  L"dwPart");
      LV_InsertItem(hWndName,   8,    0,  L"dwMemOwner");
      LV_InsertItem(hWndName,   9,    0,  L"eParamIO");
      LV_InsertItem(hWndName,   10,   0,  L"cbMaxLen");
      LV_InsertItem(hWndName,   11,   0,  L"dwFlags");
      LV_InsertItem(hWndName,   12,   0,  L"wType");
      LV_InsertItem(hWndName,   13,   0,  L"bPrecision");
      LV_InsertItem(hWndName,   14,   0,  L"bScale");

      //AutoSize column
      SendMessage(hWndName, LVM_SETCOLUMNWIDTH, 0,    (LPARAM)LVSCW_AUTOSIZE_USEHEADER);

      for(i=0; i<cBindings; i++)
      {
        ASSERT(rgBindings);
        const DBBINDING* pBinding = &rgBindings[i];
        const DBCOLUMNINFO* pColInfo = pCDataAccess->m_ColumnInfo.GetOrdinal(pBinding->iOrdinal);

        //Column Header
        LV_InsertColumn(hWndValue, i, GetColName(pColInfo), pCDataAccess->GetColumnImage(pColInfo)==IMAGE_LOCK ? IMAGE_LOCK : IMAGE_NONE);

        //Ordinal (SubItem)
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"%ld", pBinding->iOrdinal);
        LV_InsertItem(hWndValue, 0, i, wszBuffer);

        //obValue (SubItem)
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"0x%p", pBinding->obValue);
        LV_InsertItem(hWndValue, 1, i, wszBuffer);

        //obLength (SubItem)
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"0x%p", pBinding->obLength);
        LV_InsertItem(hWndValue, 2, i, wszBuffer);

        //obStatus (SubItem)
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"0x%p", pBinding->obStatus);
        LV_InsertItem(hWndValue, 3, i, wszBuffer);

        //pTypeInfo (SubItem)
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"0x%p", pBinding->pTypeInfo);
        LV_InsertItem(hWndValue, 4, i, wszBuffer);

        //pObject (SubItem)
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"0x%p", pBinding->pObject);
        LV_InsertItem(hWndValue, 5, i, wszBuffer);

        //pBindExt (SubItem)
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"0x%p", pBinding->pBindExt);
        LV_InsertItem(hWndValue, 6, i, wszBuffer);

        //dwPart (SubItem)
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"0x%08x", pBinding->dwPart);
        LV_InsertItem(hWndValue, 7, i, wszBuffer);

        //dwMemOwner (SubItem)
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"0x%08x", pBinding->dwMemOwner);
        LV_InsertItem(hWndValue, 8, i, wszBuffer);

        //eParamIO (SubItem)
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"%d", pBinding->eParamIO);
        LV_InsertItem(hWndValue, 9, i, wszBuffer);

        //cbMaxLen (SubItem)
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"%lu", pBinding->cbMaxLen);
        LV_InsertItem(hWndValue, 10, i, wszBuffer);

        //dwFlags (SubItem)
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"0x%08x", pBinding->dwFlags);
        LV_InsertItem(hWndValue, 11, i, wszBuffer);

        //TYPE (subitem)
        LV_InsertItem(hWndValue, 12, i, GetDBTypeName(pBinding->wType));

        //Precision (SubItem)
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"%d", pBinding->bPrecision);
        LV_InsertItem(hWndValue, 13, i, wszBuffer);

        //Scale (SubItem)
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"%d", pBinding->bScale);
        LV_InsertItem(hWndValue, 14, i, wszBuffer);
      }

      //AutoSize all columns
      for(i=0; i<cBindings; i++)
        SendMessage(hWndValue, LVM_SETCOLUMNWIDTH, (WPARAM)i,   (LPARAM)LVSCW_AUTOSIZE_USEHEADER);

    CLEANUP:
      CenterDialog(hWnd);
      FreeBindings(&cBindings, &rgBindings);
      if(FAILED(hr))
        EndDialog(hWnd, FALSE);
      return TRUE;
    }

    case WM_COMMAND:
    {
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDOK:
        {
          CWaitCursor waitCursor;

          EndDialog(hWnd, TRUE);
          return 0;
        }

        case IDCANCEL:
        {
          EndDialog(hWnd, FALSE);
          return 0;
        }
      }
      break;
    }//WM_COMMAND

    case WM_NOTIFY:
    {
      LV_DISPINFO* pDispInfo = (LV_DISPINFO*)lParam;
      NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)lParam;

      //ListView
      switch(pDispInfo->hdr.code)
      {
        //Since we have "TwoClickActive" on this will get sent
        //Whenever a row is clicked on twice!
        //This functionality used to be done with NM_DBCLK
        case LVN_ITEMACTIVATE:
          return 0;

        case LVN_ITEMCHANGED:
        {
          HWND hWndName   = ::GetDlgItem(hWnd, IDL_NAMES);
          HWND hWndValue  = ::GetDlgItem(hWnd, IDL_VALUES);

          if(pNMListView->uNewState & LVNI_FOCUSED &&
            pNMListView->uNewState & LVNI_SELECTED)
          {
            if(wParam == IDL_VALUES)
            {
              SyncSibling(hWndName, hWndValue);
                    return FALSE;
            }

            if(wParam == IDL_NAMES)
            {
              SyncSibling(hWndValue, hWndName);
                      return FALSE;
            }
            return UNHANDLED_MSG; //No return Value
          }
        }
      }

    }//WM_NOTIFY
  }//switch message

  return FALSE;
}

HRESULT CMDIChild::GetChapteredChild | ( | INDEX | iSelectedCol,
 |  | const DBBINDING * | pBinding,
 |  | REFIID | riid = IID_IRowset |
 | ) |  |  | [virtual]

Definition at line 9591 of file cmdichild.cpp.

{
  ASSERT(pBinding);
  IUnknown* pIUnknown = NULL;
  HRESULT hr = S_OK;
  CRowset*  pCRowset = (CRowset*)GetObject(eCRowset);
  HROW hRow = NULL;
  CBase* pCObject = NULL;
  INDEX iSelRow = 0;

  WCHAR wszChapter[POINTER_DISPLAYSIZE] = {0};
  HCHAPTER hChapter = NULL;

  if(pCRowset && pCRowset->m_pIRowsetInfo)
  {
    //IRowsetInfo::GetReferencedRowset
    XTEST(hr = pCRowset->m_pIRowsetInfo->GetReferencedRowset(pBinding->iOrdinal, riid, &pIUnknown));
    TESTC(TRACE_METHOD(hr, L"IRowsetInfo::GetReferencedRowset(%ld, %s, &0x%p)", pBinding->iOrdinal, GetInterfaceName(riid), pIUnknown));

    //Obtain the hChapter from the rowset for the selected row.  If a row is not selected this
    //would be to open the entire child rowset.  If the bookmark column is used it useally
    //means to return the current rowset - again.  Both cases theres no chapter specified...
    iSelRow = m_pCDataGrid->GetSelectedRow(&hRow, FALSE);
    if(iSelRow != LVM_ERR && pBinding->iOrdinal!=0)
    {
      if(hRow)
      {
        TESTC(hr = pCRowset->GetChapter(hRow, pBinding->iOrdinal, &hChapter));
        StringFormat(wszChapter, NUMELE(wszChapter), L"%p", hChapter);
      }
      else
      {
        //Get the Item from the 'insert' ListView
        m_pCDataGrid->GetItemText(iSelRow, iSelectedCol+1, wszChapter, NUMELE(wszChapter));
        hChapter = wcstoul(wszChapter, NULL, 16);
      }
    }

    //Create a new Rowset Window for the result...
    //But dont actually display the object, until we set the hChapter
    //NOTE: Can pontentially return other object types: (ie: CREATE_DETERMINE_TYPE)
    pCObject = m_pCMainWindow->HandleObjectType(pCRowset, pIUnknown, riid, eCRowset, 0, NULL, CREATE_NEWWINDOW | CREATE_NODISPLAY | CREATE_DETERMINE_TYPE);
    if(pCObject)
    {
      //Set the Chapter handle, before displaying rowset...
      CRowset* pCRowset = SOURCE_GETOBJECT(pCObject, CRowset);
      if(pCRowset)
      {
        pCRowset->m_hChapter = hChapter;
        pCRowset->SetObjectDesc(wszChapter);
      }
      pCObject->DisplayObject();
    }
    else
    {
      TESTC(hr = E_FAIL);
    }
  }

CLEANUP:
  TRACE_RELEASE(pIUnknown, L"Rowset");
  return hr;
}

INT_PTR WINAPI CMDIChild::GetColInfoProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 3857 of file cmdichild.cpp.

{
  switch(message)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;
      WCHAR wszBuffer[MAX_NAME_LEN+1];

      //Save the "this" pointer
      CMDIChild* pThis = (CMDIChild*)SetThis(hWnd, (void*)lParam);
      CDataAccess* pCDataAccess = NULL;
      HRESULT hr = S_OK;

      ULONG i=0;
      DBORDINAL cColumns = 0;
      DBCOLUMNINFO* rgColInfo = NULL;
      WCHAR* pStringBuffer = NULL;
      DBORDINAL cHiddenColumns = 0;
      CColumnInfo rColumnInfo;

      //Setup column headers
      //We have 2 listviews.
      // 1.  Left - ColInfo types...
      // 2.  Right - All ColInfo for all columns
      HWND hWndName = ::GetDlgItem(hWnd, IDL_NAMES);
      HWND hWndCol  = ::GetDlgItem(hWnd, IDL_VALUES);
      HWND hWndHelp = ::GetDlgItem(hWnd, IDT_HELPMSG);

      //Set Window Titles
      SendMessage(hWnd,   WM_SETTEXT, 0, (LPARAM)"IColumnsInfo::GetColumnInfo");
      SendMessage(hWndHelp, WM_SETTEXT, 0, (LPARAM)"Displays the (meta-data) Column Information");

      //Use Extended ListView Styles!
      SendMessage(hWndName, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE | LVS_EX_SUBITEMIMAGES, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE | LVS_EX_SUBITEMIMAGES);
      SendMessage(hWndCol, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE | LVS_EX_SUBITEMIMAGES, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE | LVS_EX_SUBITEMIMAGES);

      //Set image list to the Table Window
      ListView_SetImageList(hWndCol, ImageList_LoadImage(GetAppLite()->m_hInstance, MAKEINTRESOURCE(IDB_IMAGE), 16, 16, CLR_DEFAULT , IMAGE_BITMAP, LR_DEFAULTCOLOR), LVSIL_SMALL);
      ListView_SetImageList(hWndName, ImageList_LoadImage(GetAppLite()->m_hInstance, MAKEINTRESOURCE(IDB_IMAGE), 16, 16, CLR_DEFAULT , IMAGE_BITMAP, LR_DEFAULTCOLOR), LVSIL_SMALL);

      //Ensure this is a CDataAccess derived class...
      pCDataAccess = SOURCE_GETOBJECT(pThis->m_pCSource, CDataAccess);
      ASSERT(pCDataAccess);

      //Now Obtain ColumnsInfo
      TESTC(hr = pCDataAccess->GetColInfo(&cColumns, &rgColInfo, &pStringBuffer, &cHiddenColumns));
      rColumnInfo.Attach(cColumns, rgColInfo, pStringBuffer, cHiddenColumns);

      //We need to the ListView
      //Headers/Columns contain ColInfo information
      //Rows are per columns

      //ListView NAMES
      LV_InsertColumn(hWndName, 0,      L"ColName");
      LV_InsertItem(hWndName,   1,    0,  L"Ordinal");
      LV_InsertItem(hWndName,   2,    0,  L"Type");
      LV_InsertItem(hWndName,   3,    0,  L"ColumnSize");
      LV_InsertItem(hWndName,   4,    0,  L"Precision");
      LV_InsertItem(hWndName,   5,    0,  L"Scale");
      LV_InsertItem(hWndName,   6,    0,  L"TypeInfo");
      LV_InsertItem(hWndName,   7,    0,  L"ColumnID");
      LV_InsertItem(hWndName,   8,    0,  L"dwFlags");

      //Loop through the ColumnFlags
      for(i=0; i<g_cColFlagsMaps; i++)
        LV_InsertItem(hWndName,   9+i,  0,  g_rgColFlagsMaps[i].pwszName);

      //AutoSize column
      SendMessage(hWndName, LVM_SETCOLUMNWIDTH, 0,    (LPARAM)LVSCW_AUTOSIZE_USEHEADER);

      for(i=0; i<cColumns; i++)
      {
        ASSERT(rgColInfo);
        const DBCOLUMNINFO* pColInfo = &rColumnInfo[i];

        //Column Header
        LV_InsertColumn(hWndCol, i, GetColName(pColInfo), pCDataAccess->GetColumnImage(pColInfo)==IMAGE_LOCK ? IMAGE_LOCK : IMAGE_NONE);

        //Ordinal (SubItem)
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"%ld", pColInfo->iOrdinal);
        LV_InsertItem(hWndCol, 0, i, wszBuffer);

        //TYPE (subitem)
        LV_InsertItem(hWndCol, 1, i, GetDBTypeName(pColInfo->wType));

        //ColumnSize (SubItem)
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"%lu", pColInfo->ulColumnSize);
        LV_InsertItem(hWndCol, 2, i, wszBuffer);

        //Precision (SubItem)
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"%d", pColInfo->bPrecision);
        LV_InsertItem(hWndCol, 3, i, wszBuffer);

        //Scale (SubItem)
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"%d", pColInfo->bScale);
        LV_InsertItem(hWndCol, 4, i, wszBuffer);

        //TypeInfo (SubItem)
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"0x%p", pColInfo->pTypeInfo);
        LV_InsertItem(hWndCol, 5, i, wszBuffer);

        //ColumnID (SubItem)  DBID
        DBIDToString(&pColInfo->columnid, wszBuffer, MAX_NAME_LEN);
        LV_InsertItem(hWndCol, 6, i, wszBuffer);

        //dwFlags
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"0x%08x", pColInfo->dwFlags);
        LV_InsertItem(hWndCol, 7, i, wszBuffer);

        //FLAGS (SubItem)
        for(ULONG iFlag=0; iFlag<g_cColFlagsMaps; iFlag++)
          LV_InsertItem(hWndCol, 8+iFlag, i, NULL, PARAM_NONE, pColInfo->dwFlags & g_rgColFlagsMaps[iFlag].lItem  ? IMAGE_CHECKED : IMAGE_UNCHECKED);
      }

      //AutoSize all columns
      for(i=0; i<cColumns; i++)
        SendMessage(hWndCol, LVM_SETCOLUMNWIDTH, (WPARAM)i,   (LPARAM)LVSCW_AUTOSIZE_USEHEADER);

    CLEANUP:
      CenterDialog(hWnd);
      if(FAILED(hr))
        EndDialog(hWnd, FALSE);
      return TRUE;
    }

    case WM_COMMAND:
    {
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDOK:
        {
          CWaitCursor waitCursor;
          EndDialog(hWnd, TRUE);
          return 0;
        }

        case IDCANCEL:
        {
          EndDialog(hWnd, FALSE);
          return 0;
        }
      }
      break;
    }//WM_COMMAND

    case WM_NOTIFY:
    {
      LV_DISPINFO* pDispInfo = (LV_DISPINFO*)lParam;
      NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)lParam;

      //ListView
      switch(pDispInfo->hdr.code)
      {
        //Since we have "TwoClickActive" on this will get sent
        //Whenever a row is clicked on twice!
        //This functionality used to be done with NM_DBCLK
        case LVN_ITEMACTIVATE:
          return 0;

        case LVN_ITEMCHANGED:
        {
          HWND hWndName  = ::GetDlgItem(hWnd, IDL_NAMES);
          HWND hWndCol   = ::GetDlgItem(hWnd, IDL_VALUES);

          if(pNMListView->uNewState & LVNI_FOCUSED &&
            pNMListView->uNewState & LVNI_SELECTED)
          {
            if(wParam == IDL_VALUES)
            {
              SyncSibling(hWndName, hWndCol);
                    return FALSE;
            }

            if(wParam == IDL_NAMES)
            {
              SyncSibling(hWndCol, hWndName);
                      return FALSE;
            }
            return UNHANDLED_MSG; //No return Value
          }
        }
      }

    }//WM_NOTIFY
  }//switch message

  return FALSE;
}

INT_PTR WINAPI CMDIChild::GetColumnsRowsetProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 9434 of file cmdichild.cpp.

{
  static CComboBoxGuid  s_CComboInterface;
  static CPropSets    s_CPropSets;

  static BOOL fUseProps   = TRUE;   //Default
  static bool fOptColumns   = TRUE;   //Default
  static BOOL fAggregation  = FALSE;  //Default
  static BOOL fOutput     = TRUE;   //Default

  switch(message)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;

      //Save the "this" pointer
      CMDIChild* pThis = (CMDIChild*)SetThis(hWnd, (void*)lParam);

      //Use Optional Columns
            ::CheckDlgButton(hWnd, IDB_USEOPTCOLUMNS,  BST2STATE(fOptColumns));
      //Use Properties
            ::CheckDlgButton(hWnd, IDB_USEPROPERTIES,  BST2STATE(fUseProps));

      //Aggregation
            ::CheckDlgButton(hWnd, IDB_AGGREGATION,    BST2STATE(fAggregation));

      //Output (ppIUnknown)
            ::CheckDlgButton(hWnd, IDB_OUTPUT,     BST2STATE(fOutput));

      //Interface List...
      s_CComboInterface.CreateIndirect(hWnd, IDC_INTERFACE);
      s_CComboInterface.Populate(g_cInterfaceMaps, g_rgInterfaceMaps);
      if(s_CComboInterface.RestoreSelection() == CB_ERR)
        s_CComboInterface.SetGuid(IID_IRowset);

      //Only set these "Default" properties, if requested by the user
      if(pThis->GetOptions()->m_dwRowsetOpts & ROWSET_SETDEFAULTPROPS)
      {
        //DBPROP_CANHOLDROWS is required by the OLE DB Spec - Level-0 Conformance
        //Since it is also legal to set a ReadOnly property, just blindy set it...
        s_CPropSets.SetProperty(DBPROP_CANHOLDROWS, DBPROPSET_ROWSET, DBTYPE_BOOL, (void*)VARIANT_TRUE, DBPROPOPTIONS_REQUIRED);
      }

      CenterDialog(hWnd);
      return TRUE;
    }

    case WM_COMMAND:
    {
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDB_SETPROPERTIES:
        {
          //Get the "this" pointer
          CMDIChild* pThis      = (CMDIChild*)GetThis(hWnd);
          CMainWindow* pCMainWindow = pThis->m_pCMainWindow;
          CDataSource* pCDataSource = SOURCE_GETPARENT(pThis->m_pCSource, CDataSource);

          CPropertiesDlg sCPropertiesDlg(pCMainWindow);
          sCPropertiesDlg.SetProperties(hWnd, &DBPROPSET_ROWSETALL, IID_IRowsetInfo, NULL, pCDataSource ? pCDataSource->m_pIDBProperties : NULL, &s_CPropSets);
          return 0;
        }

        case IDB_AGGREGATION:
        {
          //Aggregation Combo Selection has changed...
          //If we are now using Aggregation, automatically change the requested
          //riid to IID_IUnknown, since its an error otherwise...
          if(::IsDlgButtonChecked(hWnd, IDB_AGGREGATION))
            s_CComboInterface.SetGuid(IID_IUnknown);
          return 0;
        }

        case IDOK:
        {
          CWaitCursor waitCursor;

          //Get the "this" pointer
          CMDIChild* pThis = (CMDIChild*)GetThis(hWnd);
          CDataAccess* pCDataAccess = SOURCE_GETOBJECT(pThis->m_pCSource, CDataAccess);

          HRESULT hr = S_OK;
          IUnknown* pIUnknown = NULL;

          ULONG cPropSets = 0;
          DBPROPSET* rgPropSets = NULL;

          //Obtain the Aggregation argument
          CAggregate* pCAggregate = NULL;
          fAggregation = ::IsDlgButtonChecked(hWnd, IDB_AGGREGATION);
          if(fAggregation)
            pCAggregate = new CAggregate();

          //Obtain the Output (ppIUnknown) argument
          fOutput = ::IsDlgButtonChecked(hWnd, IDB_OUTPUT);

          //Interface
          REFIID riid = s_CComboInterface.GetGuid();

          //Use Properties
          fUseProps = ::IsDlgButtonChecked(hWnd, IDB_USEPROPERTIES);
          if(fUseProps)
          {
            cPropSets = s_CPropSets.GetCount();
            rgPropSets = s_CPropSets.GetPropSets();
          }

          //Use Optional Columns
          fOptColumns = ::IsDlgButtonChecked(hWnd, IDB_USEOPTCOLUMNS) ? true : false;

          //IColumnsRowset::GetColumnsRowset
          hr = pCDataAccess->GetColumnsRowset(pCAggregate, fOptColumns, riid, cPropSets, rgPropSets, fOutput ? &pIUnknown : NULL);

          if(SUCCEEDED(hr))
          {
            //Process the Rowset
            hr = pThis->HandleRowset(pCDataAccess, pIUnknown, riid, CREATE_NEWWINDOW_IFEXISTS, IID_IColumnsRowset);
          }

          SAFE_RELEASE(pCAggregate);
          SAFE_RELEASE(pIUnknown);

          //Have to exit, even if failure.  The failure can happen at any
          //point, ie: during accessor creation.  So we end up with a
          //valid rowset, but not neccessaryliy something that supports
          //IColumnsRowset...
          if(SUCCEEDED(hr))
            EndDialog(hWnd, TRUE);
          return 0;
        }

        case IDCANCEL:
        {
          EndDialog(hWnd, FALSE);
          return 0;
        }
      }
      break;
    }//WM_COMMAND
  }

  return FALSE;
}

HRESULT CMDIChild::GetListViewValues | ( | HWND | hWndNames,
 |  | HWND | hWndValues,
 |  | CDataAccess * | pCDataAccess,
 |  | CBindings & | rBindings,
 |  | void * | pData |
 | ) |  |  | [virtual]

Definition at line 2388 of file cmdichild.cpp.

{
  ASSERT(hWndNames);
  ASSERT(hWndValues);
  ASSERT(pCDataAccess);
  HRESULT hr = S_OK;

  //Obtain the values from a specified ListView
  //And place them into our pData structure according to our bindings...
  //this method is mainly used for InsertRow and SetData operations...
  WCHAR   wszBuffer[MAX_COL_SIZE+1] = {0};
  DBSTATUS  dbStatus    = DBSTATUS_S_OK;
  DBTYPE    wBackendType  = DBTYPE_EMPTY;

  //Loop through all Columns
  for(ULONG i=0; i<rBindings.GetCount(); i++)
  {
    //Get the Status from the 'insert' ListView
    LV_GetItemText(hWndNames, i, 2, wszBuffer, MAX_COL_SIZE);
    dbStatus = GetStatusValue(wszBuffer);

    //Get the Backend Type (sotred as the item data of the value)
    wBackendType = (DBTYPE)LV_GetItemParam(hWndValues, i, 0);

    //Get the Item from the 'insert' ListView
    LV_GetItemText(hWndValues, i, 0, wszBuffer, MAX_COL_SIZE);

    //Get the Image and Param
    BOOL bChecked = LV_GetItemState(hWndNames, i, LVIS_STATEIMAGEMASK) & INDEXTOSTATEIMAGEMASK(STATE_CHECKED);
    if(bChecked)
    {
      //Set the ColumnData in our pData buffer
      TESTC(hr = pCDataAccess->SetColumnData(&rBindings[i], pData, dbStatus, wcslen(wszBuffer), wszBuffer, CONV_NONE, wBackendType));

      //Reset the Item in the ListView in case it got truncated
      LV_SetItemText(hWndValues, i, 0, wszBuffer);
    }
    else
    {
      //Mark this status as skipped (ignore)
      //This allows us to not have to realloc a smaller subset of selected
      //columns, and also allows us to be able to reuse the hAccessor
      if(STATUS_IS_BOUND(rBindings[i]))
        BINDING_STATUS(rBindings[i], pData) = DBSTATUS_S_IGNORE;
    }
  }

CLEANUP:
  return hr;
}

INT_PTR WINAPI CMDIChild::GetLiteralInfoProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 5175 of file cmdichild.cpp.

{
  switch(message)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;
      WCHAR wszBuffer[MAX_NAME_LEN+1];

      //Save the "this" pointer
      CMDIChild* pThis = (CMDIChild*)SetThis(hWnd, (void*)lParam);
      IDBInfo* pIDBInfo = SOURCE_GETINTERFACE(pThis->m_pCSource, IDBInfo);
      HRESULT hr = S_OK;

      ULONG i,cLiteralInfo = 0;
      DBLITERALINFO* rgLiteralInfo = NULL;
      WCHAR* pStringBuffer = NULL;

      //Setup column headers
      HWND hWndLiterals   = ::GetDlgItem(hWnd, IDL_VALUES);
      HWND hWndNames    = ::GetDlgItem(hWnd, IDL_NAMES);
      HWND hWndHelp   = ::GetDlgItem(hWnd, IDT_HELPMSG);

      //Set Window Titles
      SendMessage(hWnd,   WM_SETTEXT, 0, (LPARAM)"IDBInfo::GetLiteralInfo");
      SendMessage(hWndHelp, WM_SETTEXT, 0, (LPARAM)"Information about literals used in text DDL");

      const static WIDENAMEMAP rgLiterals[] =
      {
        VALUE_WCHAR(DBLITERAL_INVALID ),
        VALUE_WCHAR(DBLITERAL_BINARY_LITERAL  ),
        VALUE_WCHAR(DBLITERAL_CATALOG_NAME  ),
        VALUE_WCHAR(DBLITERAL_CATALOG_SEPARATOR ),
        VALUE_WCHAR(DBLITERAL_CHAR_LITERAL  ),
        VALUE_WCHAR(DBLITERAL_COLUMN_ALIAS  ),
        VALUE_WCHAR(DBLITERAL_COLUMN_NAME ),
        VALUE_WCHAR(DBLITERAL_CORRELATION_NAME  ),
        VALUE_WCHAR(DBLITERAL_CURSOR_NAME ),
        VALUE_WCHAR(DBLITERAL_ESCAPE_PERCENT_PREFIX ),
        VALUE_WCHAR(DBLITERAL_ESCAPE_PERCENT_SUFFIX  ),
        VALUE_WCHAR(DBLITERAL_ESCAPE_UNDERSCORE_PREFIX ),
        VALUE_WCHAR(DBLITERAL_ESCAPE_UNDERSCORE_SUFFIX ),
        VALUE_WCHAR(DBLITERAL_INDEX_NAME  ),
        VALUE_WCHAR(DBLITERAL_LIKE_PERCENT  ),
        VALUE_WCHAR(DBLITERAL_LIKE_UNDERSCORE ),
        VALUE_WCHAR(DBLITERAL_PROCEDURE_NAME  ),
        VALUE_WCHAR(DBLITERAL_QUOTE_PREFIX  ),
        VALUE_WCHAR(DBLITERAL_SCHEMA_NAME ),
        VALUE_WCHAR(DBLITERAL_TABLE_NAME  ),
        VALUE_WCHAR(DBLITERAL_TEXT_COMMAND  ),
        VALUE_WCHAR(DBLITERAL_USER_NAME ),
        VALUE_WCHAR(DBLITERAL_VIEW_NAME ),

        VALUE_WCHAR(DBLITERAL_CUBE_NAME ),
        VALUE_WCHAR(DBLITERAL_DIMENSION_NAME  ),
        VALUE_WCHAR(DBLITERAL_HIERARCHY_NAME  ),
        VALUE_WCHAR(DBLITERAL_LEVEL_NAME  ),
        VALUE_WCHAR(DBLITERAL_MEMBER_NAME ),
        VALUE_WCHAR(DBLITERAL_PROPERTY_NAME ),

        //2.0
        VALUE_WCHAR(DBLITERAL_SCHEMA_SEPARATOR  ),
        VALUE_WCHAR(DBLITERAL_QUOTE_SUFFIX  ),
      };

      //Use Extended ListView Styles!
      SendMessage(hWndLiterals, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE | LVS_EX_SUBITEMIMAGES, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE | LVS_EX_SUBITEMIMAGES);
      SendMessage(hWndNames,    LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE | LVS_EX_SUBITEMIMAGES, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE | LVS_EX_SUBITEMIMAGES);

      //Set image list to the Table Window
      ListView_SetImageList(hWndLiterals, ImageList_LoadImage(GetAppLite()->m_hInstance, MAKEINTRESOURCE(IDB_IMAGE), 16, 16, CLR_DEFAULT , IMAGE_BITMAP, LR_DEFAULTCOLOR), LVSIL_SMALL);
      ListView_SetImageList(hWndNames, ImageList_LoadImage(GetAppLite()->m_hInstance, MAKEINTRESOURCE(IDB_IMAGE), 16, 16, CLR_DEFAULT , IMAGE_BITMAP, LR_DEFAULTCOLOR), LVSIL_SMALL);

      //Obtain GetLiteralInfo (for all supported literals)
      ASSERT(pIDBInfo);
      XTEST(hr = pIDBInfo->GetLiteralInfo(0, NULL, &cLiteralInfo, &rgLiteralInfo, &pStringBuffer));
      TESTC(TRACE_METHOD(hr, L"IDBInfo::GetLiteralInfo(&%lu, &0x%p, &0x%p)", cLiteralInfo, rgLiteralInfo, pStringBuffer));

      //We need to the ListView
      //Headers/Columns contain ColInfo information
      //Rows are per columns

      //ListView NAMES
      LV_InsertColumn(hWndNames,  0,    L"DBLITERAL");
      LV_InsertItem(hWndNames,  0,    0,  L"LiteralValue");
      LV_InsertItem(hWndNames,  1,    0,  L"InvalidChars");
      LV_InsertItem(hWndNames,  2,    0,  L"InvalidStartingChars");
      LV_InsertItem(hWndNames,  3,    0,  L"Supported");
      LV_InsertItem(hWndNames,  4,    0,  L"MaxLen");

      //AutoSize column
      SendMessage(hWndNames, LVM_SETCOLUMNWIDTH, 0,   (LPARAM)LVSCW_AUTOSIZE_USEHEADER);

      for(i=0; i<cLiteralInfo; i++)
      {
        ASSERT(rgLiteralInfo);
        DBLITERALINFO* pLiteralInfo = &rgLiteralInfo[i];

        //Try to find the Actual "DBLITERAL" name...
        WCHAR* pwszLiteralName = NULL;
        for(LONG j=0; j<NUMELE(rgLiterals); j++)
        {
          if(pLiteralInfo->lt == (DBLITERAL)rgLiterals[j].lItem)
            pwszLiteralName = rgLiterals[j].pwszName;
        }

        //Column Header (DBLITERAL)
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"%d", pLiteralInfo->lt);
        LV_InsertColumn(hWndLiterals, i, pwszLiteralName ? pwszLiteralName : wszBuffer);

        //LiteralValue (SubItem)
        LV_InsertItem(hWndLiterals, 0, i, pLiteralInfo->pwszLiteralValue ? pLiteralInfo->pwszLiteralValue : NULL);

        //InvalidChars (subitem)
        LV_InsertItem(hWndLiterals, 1, i, pLiteralInfo->pwszInvalidChars ? pLiteralInfo->pwszInvalidChars : NULL);

        //InvalidChars (subitem)
        LV_InsertItem(hWndLiterals, 2, i, pLiteralInfo->pwszInvalidStartingChars ? pLiteralInfo->pwszInvalidStartingChars : NULL);

        //Supported (SubItem)
        LV_InsertItem(hWndLiterals, 3, i, NULL, PARAM_NONE, pLiteralInfo->fSupported ? IMAGE_CHECKED : IMAGE_UNCHECKED);

        //cbMaxLen (SubItem)
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"%d", pLiteralInfo->cchMaxLen);
        LV_InsertItem(hWndLiterals, 4, i, wszBuffer);
      }

      //AutoSize all columns
      for(i=0; i<cLiteralInfo; i++)
        SendMessage(hWndLiterals, LVM_SETCOLUMNWIDTH, (WPARAM)i,    (LPARAM)LVSCW_AUTOSIZE_USEHEADER);

    CLEANUP:
      CenterDialog(hWnd);
      SAFE_FREE(rgLiteralInfo);
      SAFE_FREE(pStringBuffer);
      if(FAILED(hr))
        EndDialog(hWnd, FALSE);
      return TRUE;
    }

    case WM_COMMAND:
    {
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDOK:
        {
          CWaitCursor waitCursor;

          EndDialog(hWnd, TRUE);
          return 0;
        }

        case IDCANCEL:
        {
          EndDialog(hWnd, FALSE);
          return 0;
        }
      }
      break;
    }//WM_COMMAND

    case WM_NOTIFY:
    {
      LV_DISPINFO* pDispInfo = (LV_DISPINFO*)lParam;
      NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)lParam;

      //ListView
      switch(pDispInfo->hdr.code)
      {
        //Since we have "TwoClickActive" on this will get sent
        //Whenever a row is clicked on twice!
        //This functionality used to be done with NM_DBCLK
        case LVN_ITEMACTIVATE:
          return 0;

        case LVN_ITEMCHANGED:
        {
          HWND hWndLiterals  = ::GetDlgItem(hWnd, IDL_VALUES);
          HWND hWndNames   = ::GetDlgItem(hWnd, IDL_NAMES);

          if(pNMListView->uNewState & LVNI_FOCUSED &&
            pNMListView->uNewState & LVNI_SELECTED)
          {
            if(wParam == IDL_VALUES)
            {
              SyncSibling(hWndNames, hWndLiterals);
                    return FALSE;
            }

            if(wParam == IDL_NAMES)
            {
              SyncSibling(hWndLiterals, hWndNames);
                      return FALSE;
            }
            return UNHANDLED_MSG; //No return Value
          }
        }
      }

    }//WM_NOTIFY
  }

  return FALSE;
}

INT_PTR WINAPI CMDIChild::GetNextRowsProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 4059 of file cmdichild.cpp.

{
  static LONG s_lOffset = 0;  //Default to lOffset==0
  static LONG s_cRows   = 1;  //Default to cRows==1

  switch(message)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;

      //Save the "this" pointer
      CMDIChild* pThis = (CMDIChild*)SetThis(hWnd, (void*)lParam);

      //Setup Window Handles
      HWND hWndOffset   = ::GetDlgItem(hWnd, IDE_OFFSET);
      HWND hWndcRows    = ::GetDlgItem(hWnd, IDE_COUNT);

      //SetWindowTitle (default is Rowset::GetNextRows)
      if(pThis->m_idSource == IDM_IROWSETLOCATE_GETROWSAT)
        SendMessage(hWnd, WM_SETTEXT, 0, (LPARAM)"IRowsetLocate::GetRowsAt");

      //Supply Defaults to the lOffset and cRows
      wSendMessageFmt(hWndOffset, WM_SETTEXT, 0, L"%ld", s_lOffset);
      wSendMessageFmt(hWndcRows, WM_SETTEXT, 0, L"%ld", s_cRows);

      CenterDialog(hWnd);
      return TRUE;
    }

    case WM_COMMAND:
    {
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDOK:
        {
          CWaitCursor waitCursor;

          //Get the "this" pointer
          CMDIChild* pThis      = (CMDIChild*)GetThis(hWnd);
          CRowset* pCRowset     = SOURCE_GETOBJECT(pThis->m_pCSource, CRowset);
          CDataGrid*  pCDataGrid    = pThis->m_pCDataGrid;
          HRESULT hr = S_OK;

          //Setup Window Handles
          HWND hWndOffset   = ::GetDlgItem(hWnd, IDE_OFFSET);
          HWND hWndcRows    = ::GetDlgItem(hWnd, IDE_COUNT);

          //Obtain Defaults to the lOffset and cRows
          GetEditBoxValue(hWndOffset, &s_lOffset);
          GetEditBoxValue(hWndcRows, &s_cRows);

          switch(pThis->m_idSource)
          {
            case IDM_GETNEXTROWS:
            {
              //Display the indicated rows
              TESTC(hr = pCDataGrid->GetNextRows(s_lOffset, s_cRows));
              break;
            }

            case IDM_IROWSETLOCATE_GETROWSAT:
            {
              INDEX  cSelItems = 0;
              INDEX* rgSelItems = 0;
              HROW* rghRowsSel = NULL;
              DBBKMARK cbBookmark = 0;
              BYTE* pBookmark = NULL;
              DBCOUNTITEM cRowsObtained = 0;
              HROW* rghRows = NULL;

              //Obtain all Selected Rows
              LV_GetSelItems(pCDataGrid->m_hWnd, &cSelItems, &rgSelItems, (LPARAM**)&rghRowsSel);

              //Obtain the bookmark for the first row selected...
              if(cSelItems)
                hr = pCRowset->GetBookmark(rghRowsSel[0], &cbBookmark, &pBookmark);

              //Release previously fetched rows, (if user requested)
              hr = pCDataGrid->ReleaseHeldRows();

              //IRowsetLocate::GetRowsAt
              XTEST(hr = pCRowset->m_pIRowsetLocate->GetRowsAt(pCRowset->m_hChapter, NULL, cbBookmark, pBookmark, s_lOffset, s_cRows, &cRowsObtained, &rghRows));
              TRACE_METHOD(hr, L"IRowsetLocate::GetRowsAt(0x%p, NULL, %lu, 0x%p, %ld, %ld, &%lu, &0x%p)", pCRowset->m_hChapter, cbBookmark, pBookmark, s_lOffset, s_cRows, cRowsObtained, rghRows);

              //Display the rows retrieved...
              //NOTE: GetRowsAt has a much simplier starting for than GetNextRows.  Its basically
              //the bookmark + offset = starting row.  Whereas GetNextRows also depends upon
              //what the last fetch direction was, forward or backward.
              pCDataGrid->DisplayRows(rgSelItems[0] + s_lOffset, s_cRows, cRowsObtained, rghRows, FALSE/*fAdjustFetchPosition*/);

              //Cleanup
              SAFE_FREE(rgSelItems);
              SAFE_FREE(rghRowsSel);
              SAFE_FREE(rghRows);
              SAFE_FREE(pBookmark);
              break;
            }
          };

        CLEANUP:
          if(SUCCEEDED(hr))
            EndDialog(hWnd, TRUE);
          return 0;
        }

        case IDCANCEL:
        {
          EndDialog(hWnd, FALSE);
          return 0;
        }
      }
      break;
    }//WM_COMMAND

    case WM_NOTIFY:
    {
      NM_UPDOWN* pUpDown = (NM_UPDOWN*)lParam;

      //lOffset
      if(pUpDown->hdr.idFrom == IDC_SPIN_OFFSET)
      {
        s_lOffset += pUpDown->iDelta;
        wSendMessageFmt(::GetDlgItem(hWnd, IDE_OFFSET), WM_SETTEXT, 0, L"%ld", s_lOffset);
      }

      //cRows
      if(pUpDown->hdr.idFrom == IDC_SPIN_COUNT)
      {
        s_cRows += pUpDown->iDelta;
        wSendMessageFmt(::GetDlgItem(hWnd, IDE_COUNT), WM_SETTEXT, 0, L"%ld", s_cRows);
      }

      break;
    }//WM_NOTIFY
  }//switch message

  return FALSE;
}

CBase * CMDIChild::GetObject | ( | SOURCE | eSource = eCUnknown,
 |  | BOOL | fAlways = FALSE |
 | ) |  |  | [virtual]

Definition at line 6611 of file cmdichild.cpp.

{
  //First try to obtain the last object...
  CBase** ppCBase = GetObjectAddress(eSource);
  if(ppCBase)
  {
    CBase* pCBase = *ppCBase;
    if(pCBase && (eSource==eCUnknown || pCBase->GetObjectType()==eSource || pCBase->GetBaseType() & eSource) && (fAlways || pCBase->m_pIUnknown))
      return pCBase;
  }

  return NULL;
}

CBase ** CMDIChild::GetObjectAddress ( SOURCE eSource = eCUnknown ) [virtual]

Definition at line 6630 of file cmdichild.cpp.

{
  CBase** ppCObject = NULL;

  switch(eSource)
  {
    case eCDataSource:
      ppCObject = (CBase**)&m_pCDataSource;
      break;

    case eCSession:
      ppCObject = (CBase**)&m_pCSession;
      break;

    case eCCommand:
      ppCObject = (CBase**)&m_pCCommand;
      break;

    case eCMultipleResults:
      ppCObject = (CBase**)&m_pCMultipleResults;
      break;

    case eCDataset:
    case eCRowset:
    case eCRow:
      //Only one of these objects is active at any one time
      //Since all of them actually use the "DataGrid" we can only have one per MDIChild
      ppCObject = (CBase**)&m_pCDataAccess;
      break;

    case eCUnknown:
      //Determine "Last" object type...
      if(m_pCDataAccess && m_pCDataAccess->m_pIUnknown)
        return (CBase**)&m_pCDataAccess;
      else if(m_pCMultipleResults && m_pCMultipleResults->m_pIUnknown)
        return (CBase**)&m_pCMultipleResults;
      else if(m_pCCommand && m_pCCommand->m_pIUnknown)
        return (CBase**)&m_pCCommand;
      else if(m_pCSession && m_pCSession->m_pIUnknown)
        return (CBase**)&m_pCSession;
      else if(m_pCDataSource && m_pCDataSource->m_pIUnknown)
        return (CBase**)&m_pCDataSource;
      break;

    default:
      break;
  };

  return ppCObject;
}

COptionsSheet * CMDIChild::GetOptions ( ) [virtual]

Definition at line 86 of file cmdichild.cpp.

{
  return m_pCMainWindow->GetOptions();
}

INT_PTR WINAPI CMDIChild::GetParameterInfoProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 4993 of file cmdichild.cpp.

{
  switch(message)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;
      WCHAR wszBuffer[MAX_NAME_LEN+1];

      //Save the "this" pointer
      CMDIChild* pThis  = (CMDIChild*)SetThis(hWnd, (void*)lParam);
      CCommand* pCCommand = SOURCE_GETOBJECT(pThis->m_pCSource, CCommand);
      HRESULT hr = S_OK;

      ULONG i = 0;
      DB_UPARAMS cParams = 0;
      DBPARAMINFO* rgParamInfo = NULL;
      WCHAR* pwszNamesBuffer = NULL;

      //Setup column headers
      HWND hWndName   = ::GetDlgItem(hWnd, IDL_NAMES);
      HWND hWndValue    = ::GetDlgItem(hWnd, IDL_VALUES);
      HWND hWndHelp   = ::GetDlgItem(hWnd, IDT_HELPMSG);

      //Set Window Titles
      SendMessage(hWnd,   WM_SETTEXT, 0, (LPARAM)"ICommandWithParameters::GetParameterInfo");
      SendMessage(hWndHelp, WM_SETTEXT, 0, (LPARAM)"ParameterInfo");

      //Use Extended ListView Styles!
      SendMessage(hWndName, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE);
      SendMessage(hWndValue,  LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE);

      //Set image list to the Window
      ListView_SetImageList(hWndValue, ImageList_LoadImage(GetAppLite()->m_hInstance, MAKEINTRESOURCE(IDB_IMAGE), 16, 16, CLR_DEFAULT , IMAGE_BITMAP, LR_DEFAULTCOLOR), LVSIL_SMALL);
      ListView_SetImageList(hWndName, ImageList_LoadImage(GetAppLite()->m_hInstance, MAKEINTRESOURCE(IDB_IMAGE), 16, 16, CLR_DEFAULT , IMAGE_BITMAP, LR_DEFAULTCOLOR), LVSIL_SMALL);

      //Now ICommandWithParameters::GetParameterInfo
      XTESTC(hr = pCCommand->GetParameterInfo(&cParams, &rgParamInfo, &pwszNamesBuffer));

      //We need to the ListView
      //Headers/Columns contain ColInfo information
      //Rows are per columns

      //ListView Columns
      LV_InsertColumn(hWndName, 0,    L"ParamName");
      LV_InsertItem(hWndName,   0,    0,  L"Ordinal");
      LV_InsertItem(hWndName,   1,    0,  L"dwFlags");
      LV_InsertItem(hWndName,   2,    0,  L"pTypeInfo");
      LV_InsertItem(hWndName,   3,    0,  L"wType");
      LV_InsertItem(hWndName,   4,    0,  L"ulParamSize");
      LV_InsertItem(hWndName,   5,    0,  L"bPrecision");
      LV_InsertItem(hWndName,   6,    0,  L"bScale");

      //AutoSize column
      SendMessage(hWndName, LVM_SETCOLUMNWIDTH, 0,    (LPARAM)LVSCW_AUTOSIZE_USEHEADER);

      for(i=0; i<cParams; i++)
      {
        ASSERT(rgParamInfo);
        DBPARAMINFO* pParamInfo = &rgParamInfo[i];

        //Column Header
        LV_InsertColumn(hWndValue, i, pParamInfo->pwszName, IMAGE_NONE);

        //Ordinal (SubItem)
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"%ld", pParamInfo->iOrdinal);
        LV_InsertItem(hWndValue, 0, i, wszBuffer);

        //dwFlags (SubItem)
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"0x%08x", pParamInfo->dwFlags);
        LV_InsertItem(hWndValue, 1, i, wszBuffer);

        //pTypeInfo (SubItem)
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"0x%p", pParamInfo->pTypeInfo);
        LV_InsertItem(hWndValue, 2, i, wszBuffer);

        //TYPE (subitem)
        LV_InsertItem(hWndValue, 3, i, GetDBTypeName(pParamInfo->wType));

        //ulParamSize (SubItem)
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"%lu", pParamInfo->ulParamSize);
        LV_InsertItem(hWndValue, 4, i, wszBuffer);

        //Precision (SubItem)
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"%d", pParamInfo->bPrecision);
        LV_InsertItem(hWndValue, 5, i, wszBuffer);

        //Scale (SubItem)
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"%d", pParamInfo->bScale);
        LV_InsertItem(hWndValue, 6, i, wszBuffer);
      }

      //AutoSize all columns
      for(i=0; i<cParams; i++)
        SendMessage(hWndValue, LVM_SETCOLUMNWIDTH, (WPARAM)i,   (LPARAM)LVSCW_AUTOSIZE_USEHEADER);

    CLEANUP:
      CenterDialog(hWnd);
      SAFE_FREE(rgParamInfo);
      SAFE_FREE(pwszNamesBuffer);
      if(FAILED(hr))
        EndDialog(hWnd, FALSE);
      return TRUE;
    }

    case WM_COMMAND:
    {
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDOK:
        {
          CWaitCursor waitCursor;

          EndDialog(hWnd, TRUE);
          return 0;
        }

        case IDCANCEL:
        {
          EndDialog(hWnd, FALSE);
          return 0;
        }
      }
      break;
    }//WM_COMMAND

    case WM_NOTIFY:
    {
      LV_DISPINFO* pDispInfo = (LV_DISPINFO*)lParam;
      NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)lParam;

      //ListView
      switch(pDispInfo->hdr.code)
      {
        //Since we have "TwoClickActive" on this will get sent
        //Whenever a row is clicked on twice!
        //This functionality used to be done with NM_DBCLK
        case LVN_ITEMACTIVATE:
          return 0;

        case LVN_ITEMCHANGED:
        {
          HWND hWndName   = ::GetDlgItem(hWnd, IDL_NAMES);
          HWND hWndValue  = ::GetDlgItem(hWnd, IDL_VALUES);

          if(pNMListView->uNewState & LVNI_FOCUSED &&
            pNMListView->uNewState & LVNI_SELECTED)
          {
            if(wParam == IDL_VALUES)
            {
              SyncSibling(hWndName, hWndValue);
                    return FALSE;
            }

            if(wParam == IDL_NAMES)
            {
              SyncSibling(hWndValue, hWndName);
                      return FALSE;
            }
            return UNHANDLED_MSG; //No return Value
          }
        }
      }

    }//WM_NOTIFY
  }//switch message

  return FALSE;
}

INT_PTR WINAPI CMDIChild::GetReferencedRowsetProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 9660 of file cmdichild.cpp.

{
  static CComboBoxGuid  s_CComboInterface;

  switch(message)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;

      //Save the "this" pointer
      CMDIChild* pThis = (CMDIChild*)SetThis(hWnd, (void*)lParam);
      CRowset* pCRowset = SOURCE_GETOBJECT(pThis->m_pCSource, CRowset);

      INDEX iSel = 0;
      HWND hWndColumn   = ::GetDlgItem(hWnd, IDC_COLUMN);

      //Column List...
      INDEX iSavedCol = CB_ERR;
      for(ULONG i=0; i<pCRowset->m_Bindings.GetCount(); i++)
      {
        //Column Ordinal - Column Name
        DBORDINAL iOrdinal = pCRowset->m_Bindings[i].iOrdinal;
        const DBCOLUMNINFO* pColInfo = pCRowset->m_ColumnInfo.GetOrdinal(iOrdinal);

        //SetDefault to first chaptered column...
        if(pColInfo->dwFlags & DBCOLUMNFLAGS_ISCHAPTER)
        {
          iSel = (INDEX)wSendMessageFmt(hWndColumn, CB_ADDSTRING, 0, L"%2d - %s <ISCHAPTER>", iOrdinal, GetColName(pColInfo));
          if(iSavedCol == CB_ERR)
            iSavedCol = iSel;
        }
        else
        {
          iSel = (INDEX)wSendMessageFmt(hWndColumn, CB_ADDSTRING, 0, L"%2d - %s", iOrdinal, GetColName(pColInfo));
        }

        //Save the iBinding in ther listview
        SendMessage(hWndColumn, CB_SETITEMDATA, iSel, (LPARAM)i);
      }

      //Set Default...
      SendMessage(hWndColumn, CB_SETCURSEL, iSavedCol < (INDEX)pCRowset->m_Bindings.GetCount() && iSavedCol!=CB_ERR ? iSavedCol : 0, 0);

      //Interface List...
      s_CComboInterface.CreateIndirect(hWnd, IDC_INTERFACE);
      s_CComboInterface.Populate(g_cInterfaceMaps, g_rgInterfaceMaps);
      if(s_CComboInterface.RestoreSelection() == CB_ERR)
        s_CComboInterface.SetGuid(IID_IRowset);

      CenterDialog(hWnd);
      return TRUE;
    }

    case WM_COMMAND:
    {
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDOK:
        {
          CWaitCursor waitCursor;

          //Get the "this" pointer
          CMDIChild* pThis = (CMDIChild*)GetThis(hWnd);
          CRowset* pCRowset = SOURCE_GETOBJECT(pThis->m_pCSource, CRowset);

          HWND hWndColumn   = ::GetDlgItem(hWnd, IDC_COLUMN);
          HRESULT hr = S_OK;

          //Column
          INDEX iSavedCol = (INDEX)SendMessage(hWndColumn, CB_GETCURSEL, 0, 0);
          DBCOUNTITEM iBinding = SendMessage(hWndColumn, CB_GETITEMDATA, iSavedCol!=CB_ERR ? iSavedCol : 0, 0);
          const DBBINDING* pBinding = &pCRowset->m_Bindings[iBinding];

          //Interface
          REFIID riid = s_CComboInterface.GetGuid();

          //Obtain the Child rowset..
          hr = pThis->GetChapteredChild(iSavedCol, pBinding, riid);
          if(SUCCEEDED(hr))
            EndDialog(hWnd, TRUE);
          return 0;
        }

        case IDCANCEL:
        {
          EndDialog(hWnd, FALSE);
          return 0;
        }
      }
      break;
    }//WM_COMMAND
  }

  return FALSE;
}

INT_PTR WINAPI CMDIChild::GetTransactionInfo | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 5592 of file cmdichild.cpp.

{
  switch(message)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;

      //Save the "this" pointer
      CMDIChild*    pThis       = (CMDIChild*)SetThis(hWnd, (void*)lParam);

      //Need to fill in the Txn ComboBox
      pThis->SetupTransactionCombo(::GetDlgItem(hWnd, IDC_TRANSACTION));

      CenterDialog(hWnd);
      return TRUE;
    }

    case WM_COMMAND:
    {
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDOK:
        {
          CWaitCursor waitCursor;

          //Get the "this" pointer
          CMDIChild*    pThis       = (CMDIChild*)GetThis(hWnd);

          HWND      hWndTransaction   = ::GetDlgItem(hWnd, IDC_TRANSACTION);
          ITransaction* pITransaction   = NULL;
          XACTTRANSINFO XactInfo      = {0};
          HRESULT     hr          = S_OK;

          //get the ITransactionPointer
          INDEX iSel = (INDEX)SendMessage(hWndTransaction, CB_GETCURSEL, 0, 0);
          if(iSel != CB_ERR)
            pITransaction = (ITransaction*)SendMessage(hWndTransaction, CB_GETITEMDATA, iSel, 0);

          //Obtain the Transaction interface
          if(!pITransaction)
            pITransaction = SOURCE_GETINTERFACE(pThis->m_pCSource, ITransaction);
          ASSERT(pITransaction);

          //ITransaction::GetTransactionInfo
          XTEST(hr = pITransaction->GetTransactionInfo(&XactInfo));
          TRACE_METHOD(hr, L"ITransaction::GetTransactionInfo(%s, %d, %s, %d, %d, %d)", /*XactInfo.uow,*/ GetMapName(XactInfo.isoLevel, g_cIsoLevels, g_rgIsoLevels), XactInfo.isoFlags, GetMapName(XactInfo.grfTCSupported, g_cXACTTC, g_rgXACTTC) , XactInfo.grfRMSupported, XactInfo.grfTCSupportedRetaining, XactInfo.grfRMSupportedRetaining);

          if(SUCCEEDED(hr))
            EndDialog(hWnd, TRUE);
          return 0;
        }

        case IDCANCEL:
        {
          EndDialog(hWnd, FALSE);
          return 0;
        }
      }
      break;
    }//WM_COMMAND
  }
  return FALSE;
}

HRESULT CMDIChild::HandleRowset | ( | CBase * | pCSource,
 |  | IUnknown * | pIUnknown,
 |  | REFIID | riid,
 |  | DWORD | dwFlags,
 |  | REFGUID | guidSource,
 |  | WCHAR * | pwszTableName = NULL,
 |  | BOOL | fSchemaRowset = FALSE |
 | ) |  |  | [virtual]

Definition at line 6686 of file cmdichild.cpp.

{
  HRESULT hr = S_OK;

  //Handle the Result
  //NOTE: Result can be NULL for non-row returning results...
  if(pIUnknown)
  {
    //Don't display the object
    dwFlags |= CREATE_NODISPLAY;

    //Now Create the object...
    //NOTE: Can pontentially return other object types: (ie: CREATE_DETERMINE_TYPE)
    CBase* pCObject = m_pCMainWindow->HandleObjectType(pCSource, pIUnknown, riid, eCRowset, 0, NULL, dwFlags | CREATE_DETERMINE_TYPE);
    if(pCObject)
    {
      //Record the source of the object...
      pCObject->m_guidSource = guidSource;
      CDataAccess* pCDataAccess = SOURCE_GETOBJECT(pCObject, CDataAccess);
      if(pCDataAccess)
      {
        pCDataAccess->m_bSchemaRowset = fSchemaRowset;

        //Save the passed in TableName...
        pCDataAccess->SetObjectDesc(pwszTableName);
      }

      //Now Display the object...
      pCObject->DisplayObject();
    }
    else
    {
      TESTC(hr = E_FAIL);
    }
  }

CLEANUP:
  UpdateControls();
  return hr;
}

HRESULT CMDIChild::InsertNewRow ( ) [virtual]

Definition at line 2262 of file cmdichild.cpp.

{
  //Insert a new row into the ListView...
  HRESULT hr = E_FAIL;
  CRowset*  pCRowset = (CRowset*)GetObject(eCRowset);

  //Find the Selected Item in the ListView
  m_pCDataGrid->m_iSelRow = m_pCDataGrid->GetSelectedRow(NULL, FALSE);

  //Is editing the Rowset allowed?
  if(!pCRowset || !pCRowset->m_pIRowsetChange)
    return E_FAIL;

  //Bring up the Insert Dialog box...
  DisplayDialog(IDD_ROWCHANGE, m_hWnd, RowChangeProc, pCRowset, IDM_INSERTROW);
  return hr;
}

INT_PTR WINAPI CMDIChild::ISCO_DeleteProc | ( | HWND | hWnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 8566 of file cmdichild.cpp.

{
  const static WIDENAMEMAP rgISODeleteFlags[] =
  {
    VALUE_WCHAR(DBDELETE_ASYNC),
    VALUE_WCHAR(DBDELETE_ATOMIC),
  };

  switch(message)
  {
    case WM_INITDIALOG:
    {
      //Save the "this" pointer
      CWaitCursor waitCursor;
      CMDIChild*    pThis   = (CMDIChild*)SetThis(hWnd, (void*)lParam);
      HWND      hWndFlags = ::GetDlgItem(hWnd, IDC_ISCO_FLAGS);

      for(ULONG i=0; i<NUMELE(rgISODeleteFlags); i++)
      {
        INDEX iSel = SendMessageW(hWndFlags, LB_ADDSTRING, 0, (LPARAM)rgISODeleteFlags[i].pwszName);
        SendMessageW(hWndFlags, LB_SETITEMDATA, iSel, rgISODeleteFlags[i].lItem);
      }

      //Placement of Dialog, want it just below the "Init" button...
      CenterDialog(hWnd);
      return TRUE;
    }

    case WM_COMMAND:
    {
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDB_ADD:
        {
          HWND    hWndEditURL   = ::GetDlgItem(hWnd, IDE_URL);
          HWND    hWndURLs    = ::GetDlgItem(hWnd, IDC_URLs);
          CHAR    szURL[MAX_NAME_LEN+1] = "";

          // get the text from the edit field
          SendMessageA(hWndEditURL, WM_GETTEXT, MAX_NAME_LEN, (LPARAM)szURL);
          if (szURL[0])
          {
            // and add it to the URL list box
            SendMessageA(hWndURLs, LB_ADDSTRING, 0, (LPARAM)szURL);
          }
          else
            MessageBox(GetFocus(), "There is no URL to ADD!", "WARNING", MB_OK);

          return 0;
        }

        case IDB_DELETE:
        {
          HWND    hWndURLs    = ::GetDlgItem(hWnd, IDC_URLs);

          INDEX iSel = (INDEX)SendMessage(hWndURLs, LB_GETCURSEL, 0, 0);
          if (LB_ERR != iSel)
            SendMessage(hWndURLs, LB_DELETESTRING, iSel, 0);

          return 0;
        }

        case IDCANCEL:
        {
          EndDialog(hWnd, FALSE);
          return 0;
        }

        case IDOK:
        {
          CWaitCursor waitCursor;

          //Get the "this" pointer
          CMDIChild *pThis          = (CMDIChild*)GetThis(hWnd);
          HWND    hWndURLs        = ::GetDlgItem(hWnd, IDC_URLs);
          HWND    hWndFlags       = ::GetDlgItem(hWnd, IDC_ISCO_FLAGS);
          DWORD   dwDeleteFlags     = 0;
          WCHAR   **rgpwszURLs      = NULL;
          WCHAR   wszBuffer[MAX_NAME_LEN+1]= {0};
          DBSTATUS  *rgdbStatus       = NULL;
          HRESULT   hr;

          //Obtain IScopedOperations
          IScopedOperations* pIScopedOperations = SOURCE_GETINTERFACE(pThis->m_pCSource, IScopedOperations);
          ASSERT(pIScopedOperations);

          INDEX nCount = (INDEX)SendMessage(hWndFlags, LB_GETCOUNT, 0, 0);
          for(INDEX iSel = 0; iSel < nCount; iSel++)
          {
            //Is this a selected Item?
            if(SendMessage(hWndFlags, LB_GETSEL, iSel, 0) > 0)
            {
              //We setup the listbox with the item data as the value for each selection
              dwDeleteFlags |= SendMessage(hWndFlags, LB_GETITEMDATA, iSel, 0);
            }
          }

          // get URL array
          nCount = (ULONG)SendMessage(hWndURLs, LB_GETCOUNT, 0, 0);
          if (nCount > 0)
          {
            SAFE_ALLOC(rgpwszURLs, WCHAR*, nCount);
            SAFE_ALLOC(rgdbStatus, DBSTATUS, nCount);
          }

          for(iSel=0; iSel<nCount; iSel++)
          {
            wSendMessage(hWndURLs, LB_GETTEXT, iSel, wszBuffer);
            rgpwszURLs[iSel] = wcsDuplicate(wszBuffer);
          }

          XTEST(hr = pIScopedOperations->Delete(nCount, (const WCHAR**)rgpwszURLs, dwDeleteFlags, rgdbStatus));
          TESTC(TRACE_METHOD(hr, L"IScopedOperations::Delete(%lu, 0x%p, 0x%08x, 0x%p)", nCount, rgpwszURLs, dwDeleteFlags, rgdbStatus));

        CLEANUP:
          pThis->UpdateControls();

          //Display Status errors...
          for(iSel=0; iSel<nCount; iSel++)
          {
            SAFE_FREE(rgpwszURLs[iSel]);

            if(rgdbStatus[iSel] != DBSTATUS_S_OK)
              wMessageBox(GetFocus(), MB_OK, wsz_ERROR, L"Status = %s \nrgpwszURL[%lu] = %s", GetStatusName(rgdbStatus[iSel]), iSel, rgpwszURLs[iSel]);
          }

          SAFE_FREE(rgpwszURLs);
          SAFE_FREE(rgdbStatus);

          if(SUCCEEDED(hr))
            EndDialog(hWnd, TRUE);
          return 0;
        }
      }
      break;
    }//WM_COMMAND

  }//switch message

  return FALSE;
} // CMDIChild::ISCO_DeleteProc

INT_PTR WINAPI CMDIChild::ISCO_Proc | ( | HWND | hWnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 8717 of file cmdichild.cpp.

{
  const static WIDENAMEMAP rgISOCopyFlags[] =
  {
    VALUE_WCHAR(DBCOPY_REPLACE_EXISTING),
    VALUE_WCHAR(DBCOPY_ASYNC),
    VALUE_WCHAR(DBCOPY_ALLOW_EMULATION),
    VALUE_WCHAR(DBCOPY_NON_RECURSIVE),
    VALUE_WCHAR(DBCOPY_ATOMIC),
  };

  const static WIDENAMEMAP rgISOMoveFlags[] =
  {
    VALUE_WCHAR(DBMOVE_REPLACE_EXISTING),
    VALUE_WCHAR(DBMOVE_ASYNC),
    VALUE_WCHAR(DBMOVE_DONT_UPDATE_LINKS),
    VALUE_WCHAR(DBMOVE_ALLOW_EMULATION),
    VALUE_WCHAR(DBMOVE_ATOMIC),
  };

  switch(message)
  {
    case WM_INITDIALOG:
    {
      //Save the "this" pointer
      CWaitCursor waitCursor;
      CMDIChild*    pThis   = (CMDIChild*)SetThis(hWnd, (void*)lParam);
      HWND      hWndFlags = ::GetDlgItem(hWnd, IDC_ISCO_FLAGS);
      HWND      hWndURLs  = ::GetDlgItem(hWnd, IDL_URLs);
      RECT    rect;

      //Populate the ListBox
      if(pThis->m_idSource == IDM_ISCOPEDOPERATIONS_MOVE)
      {
                ::SetWindowText(hWnd, "IScopedOperations::Move");
        for(ULONG i=0; i<NUMELE(rgISOMoveFlags); i++)
        {
          INDEX iSel = SendMessageW(hWndFlags, LB_ADDSTRING, 0, (LPARAM)rgISOMoveFlags[i].pwszName);
          SendMessageW(hWndFlags, LB_SETITEMDATA, iSel, rgISOMoveFlags[i].lItem);
        }
      }
      else
      {
                ::SetWindowText(hWnd, "IScopedOperations::Copy");
        for(ULONG i=0; i<NUMELE(rgISOCopyFlags); i++)
        {
          INDEX iSel = SendMessageW(hWndFlags, LB_ADDSTRING, 0, (LPARAM)rgISOCopyFlags[i].pwszName);
          SendMessageW(hWndFlags, LB_SETITEMDATA, iSel, rgISOCopyFlags[i].lItem);
        }
      }

      SendMessage(hWndURLs, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE);
      LV_InsertColumn(hWndURLs,   COLUMN_ISCO_SRCURL,   L"Source URL",    IMAGE_NONE);
      LV_InsertColumn(hWndURLs,   COLUMN_ISCO_DESTURL,  L"Destination URL", IMAGE_NONE);

      GetWindowRect(hWndURLs, (LPRECT)&rect);
      SendMessage(hWndURLs, LVM_SETCOLUMNWIDTH, (WPARAM)COLUMN_ISCO_SRCURL, (LPARAM)(rect.right-rect.left)/2);
      SendMessage(hWndURLs, LVM_SETCOLUMNWIDTH, (WPARAM)COLUMN_ISCO_DESTURL, (LPARAM)(rect.right-rect.left)/2);

      //Placement of Dialog, want it just below the "Init" button...
      CenterDialog(hWnd);
      return TRUE;
    }

    case WM_COMMAND:
    {
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDB_ADD:
        {
          HWND    hWndSrcURL    = ::GetDlgItem(hWnd, IDE_ISCO_SOURCE);
          HWND    hWndDestURL   = ::GetDlgItem(hWnd, IDE_ISCO_DESTINATION);
          HWND    hWndURLs    = ::GetDlgItem(hWnd, IDL_URLs);
          WCHAR   wszSrcURL[MAX_NAME_LEN+1] = L"";
          WCHAR   wszDestURL[MAX_NAME_LEN+1] = L"";
          ULONG   cItems      = ListView_GetItemCount(hWndURLs);

          // get the text from the edit field
          wSendMessage(hWndSrcURL, WM_GETTEXT, MAX_NAME_LEN, wszSrcURL);
          wSendMessage(hWndDestURL, WM_GETTEXT, MAX_NAME_LEN, wszDestURL);
          if(wszSrcURL[0] || wszDestURL[0])
          {
            // and add it to the URL list box
            // make the insertion
            LV_InsertItem(hWndURLs, cItems, COLUMN_ISCO_SRCURL,   wszSrcURL);
            LV_InsertItem(hWndURLs, cItems, COLUMN_ISCO_DESTURL,  wszDestURL);
          }
          else
          {
            wMessageBox(GetFocus(), MB_OK, wsz_ERROR, L"There is no source or destination URL to ADD!");
          }

          return 0;
        }

        case IDB_DELETE:
        {
          HWND    hWndURLs    = ::GetDlgItem(hWnd, IDL_URLs);
          INT     cItems;
          INT     iSel;

          // get the selected item
          iSel = ListView_GetNextItem(hWndURLs, -1, LVNI_SELECTED);

          cItems = ListView_GetItemCount(hWndURLs);
          if (iSel > -1)
            ListView_DeleteItem(hWndURLs, iSel);
          if (cItems > 1)
            LV_SetItemState(hWndURLs, iSel == cItems-1 ? iSel-1: iSel, COLUMN_ISCO_SRCURL, LVIS_SELECTED, LVIS_SELECTED);
          return 0;
        }

        case IDCANCEL:
        {
          EndDialog(hWnd, FALSE);
          return 0;
        }

        case IDOK:
        {
          CWaitCursor waitCursor;

          //Get the "this" pointer
          CMDIChild *pThis          = (CMDIChild*)GetThis(hWnd);
          HWND    hWndURLs        = ::GetDlgItem(hWnd, IDL_URLs);
          HWND    hWndFlags       = ::GetDlgItem(hWnd, IDC_ISCO_FLAGS);
          DWORD   dwFlags         = 0;
          WCHAR   **rgpwszSourceURLs    = NULL;
          WCHAR   **rgpwszDestURLs    = NULL;
          WCHAR   **rgpwszNewURLs     = NULL;
          OLECHAR   *pStringsBuffer     = NULL;
          DBSTATUS  *rgdbStatus       = NULL;

          WCHAR   wszBuffer[MAX_NAME_LEN+1]= {0};
          INDEX   cRows = 0;
          HRESULT   hr = S_OK;

          //Obtain IScopedOperations
          IScopedOperations* pIScopedOperations = SOURCE_GETINTERFACE(pThis->m_pCSource, IScopedOperations);
          ASSERT(pIScopedOperations);

          INDEX nCount = (INDEX)SendMessage(hWndFlags, LB_GETCOUNT, 0, 0);
          for(INDEX iSel = 0; iSel < nCount; iSel++)
          {
            //Is this a selected Item?
            if(SendMessage(hWndFlags, LB_GETSEL, iSel, 0) > 0)
            {
              //We setup the listbox with the item data as the value for each selection
              dwFlags |= SendMessage(hWndFlags, LB_GETITEMDATA, iSel, 0);
            }
          }

          // get URL array
          cRows = ListView_GetItemCount(hWndURLs);
          SAFE_ALLOC(rgpwszSourceURLs, WCHAR*, cRows);
          SAFE_ALLOC(rgpwszDestURLs, WCHAR*, cRows);
          SAFE_ALLOC(rgpwszNewURLs, WCHAR*, cRows);
          SAFE_ALLOC(rgdbStatus, DBSTATUS, cRows);

          // get the arrays of source and destination URLs
          for (iSel=0; iSel<cRows; iSel++)
          {
            // get source URL
            LV_GetItemText(hWndURLs, iSel, COLUMN_ISCO_SRCURL, wszBuffer, MAX_NAME_LEN);
            rgpwszSourceURLs[iSel] = wcsDuplicate(wszBuffer);

            // get destination URL
            LV_GetItemText(hWndURLs, iSel, COLUMN_ISCO_DESTURL, wszBuffer, MAX_NAME_LEN);
            rgpwszDestURLs[iSel] = wcsDuplicate(wszBuffer);
          }

          switch(pThis->m_idSource)
          {
            case IDM_ISCOPEDOPERATIONS_COPY:
              XTEST(hr = pIScopedOperations->Copy(cRows, (const WCHAR**)rgpwszSourceURLs, (const WCHAR**)rgpwszDestURLs, dwFlags, NULL, rgdbStatus, rgpwszNewURLs, &pStringsBuffer));
              TESTC(TRACE_METHOD(hr, L"IScopedOperations::Copy(%lu, 0x%p, 0x%p, 0x%08x, NULL, 0x%p, 0x%p, &0x%p)", cRows, rgpwszSourceURLs, rgpwszDestURLs, dwFlags, rgdbStatus, rgpwszNewURLs, pStringsBuffer));
              break;

            case IDM_ISCOPEDOPERATIONS_MOVE:
              XTEST(hr = pIScopedOperations->Move(cRows, (const WCHAR**)rgpwszSourceURLs, (const WCHAR**)rgpwszDestURLs, dwFlags, NULL, rgdbStatus, rgpwszNewURLs, &pStringsBuffer));
              TESTC(TRACE_METHOD(hr, L"IScopedOperations::Move(%lu, 0x%p, 0x%p, 0x%08x, NULL, 0x%p, 0x%p, &0x%p)", cRows, rgpwszSourceURLs, rgpwszDestURLs, dwFlags, rgdbStatus, rgpwszNewURLs, pStringsBuffer));
              break;
          };

        CLEANUP:
          pThis->UpdateControls();
          for(iSel = 0; iSel < cRows; iSel++)
          {
            SAFE_FREE(rgpwszSourceURLs[iSel]);
            SAFE_FREE(rgpwszDestURLs[iSel]);
          }
          SAFE_FREE(rgpwszSourceURLs);
          SAFE_FREE(rgpwszDestURLs);
          SAFE_FREE(rgdbStatus);
          SAFE_FREE(pStringsBuffer);
          if (S_OK == hr)
            EndDialog(hWnd, TRUE);
          return 0;
        }
      }
      break;
    }//WM_COMMAND

  }//switch message

  return FALSE;
} // CMDIChild::ISCO_Proc

INT_PTR WINAPI CMDIChild::JoinTransactionProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 5800 of file cmdichild.cpp.

{
  switch(message)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;

      //Save the "this" pointer
      CMDIChild*    pThis       = (CMDIChild*)SetThis(hWnd, (void*)lParam);
      HWND      hWndIsoLevel    = ::GetDlgItem(hWnd, IDC_ISOLEVEL);

      //Need to fill in the ISOLEVEL ComboBox
      for(ULONG i=0; i<g_cIsoLevels; i++)
      {
        INDEX iSel = (INDEX)wSendMessage(hWndIsoLevel, CB_ADDSTRING,  0, g_rgIsoLevels[i].pwszName);
        SendMessage(hWndIsoLevel, CB_SETITEMDATA, iSel, (LPARAM)g_rgIsoLevels[i].lItem);
      }
      //SetDefault - READUNCOMMITED
      SendMessage(hWndIsoLevel, CB_SETCURSEL, 2, (LPARAM)0);

      //Need to fill in the Txn ComboBox
      pThis->SetupTransactionCombo(::GetDlgItem(hWnd, IDC_TRANSACTION));

      CenterDialog(hWnd);
      return TRUE;
    }

    case WM_COMMAND:
    {
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDOK:
        {
          CWaitCursor waitCursor;

          //Get the "this" pointer
          CMDIChild*    pThis       = (CMDIChild*)GetThis(hWnd);

          WCHAR     wszBuffer[MAX_NAME_LEN+1] = {0};
          HWND      hWndIsoLevel    = ::GetDlgItem(hWnd, IDC_ISOLEVEL);
          HWND      hWndTransaction   = ::GetDlgItem(hWnd, IDC_TRANSACTION);
          ITransaction* pITransaction   = NULL;
          HRESULT     hr          = S_OK;

          //Just Need to Obtain selected ISOLEVEL from Combo
          INDEX iSel = (INDEX)SendMessage(hWndIsoLevel, CB_GETCURSEL, 0, 0);
          wSendMessage(hWndIsoLevel, WM_GETTEXT, MAX_NAME_LEN, wszBuffer);
          ISOLEVEL isoLevel = (ISOLEVEL)SendMessage(hWndIsoLevel, CB_GETITEMDATA, iSel, 0);

          //get the ITransactionPointer
          iSel = (INDEX)SendMessage(hWndTransaction, CB_GETCURSEL, 0, 0);
          if(iSel != CB_ERR)
            pITransaction = (ITransaction*)SendMessage(hWndTransaction, CB_GETITEMDATA, iSel, 0);

          ITransactionJoin* pITransactionJoin = SOURCE_GETINTERFACE(pThis->m_pCSource, ITransactionJoin);
          ASSERT(pITransactionJoin);

          //ITransactionJoin::JoinTransaction
          XTEST(hr = pITransactionJoin->JoinTransaction(pITransaction, isoLevel, NULL, NULL));
          TRACE_METHOD(hr, L"ITransactionJoin::JoinTransaction(0x%p, %s, 0, NULL)", pITransaction, wszBuffer);

          if(SUCCEEDED(hr))
            EndDialog(hWnd, TRUE);
          return 0;
        }

        case IDCANCEL:
        {
          EndDialog(hWnd, FALSE);
          return 0;
        }
      }
      break;
    }//WM_COMMAND
  }
  return FALSE;
}

BOOL CMDIChild::OnClose ( ) [virtual]

Reimplemented from CWndLite.

Definition at line 357 of file cmdichild.cpp.

{
  //Send Message to the MainWindow to Close
  //Mainly used so the MainWindow updates the ToolBar if there
  //Are no more child windows...
  SendMessage(m_pCMainWindow->GetWnd(), WM_COMMAND, GET_WM_COMMAND_MPS(IDM_CLOSEWINDOW, m_hWnd, 0));
  return TRUE;
}

BOOL CMDIChild::OnCommand | ( | UINT | iID,
 |  | HWND | hWndCtrl |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 441 of file cmdichild.cpp.

{
  //Get the "this" pointer
  CMainWindow*  pCMainWindow  = m_pCMainWindow;
  HWND      hWnd      = m_hWnd;
  HRESULT hr = S_OK;

  //Is there an active object...
  CBase*      pCObject      = m_pCMainWindow->m_pCMDIObjects->m_pCObjTree->GetSelectedObject();
  CDataAccess*  pCDataAccess    = SOURCE_GETOBJECT(pCObject, CDataAccess);
  CRowset*    pCRowset      = SOURCE_GETOBJECT(pCDataAccess, CRowset);
  CRow*     pCRow       = SOURCE_GETOBJECT(pCDataAccess, CRow);
  CDataset*   pCDataset     = SOURCE_GETOBJECT(pCDataAccess, CDataset);

  //Object Types
  CBinder*    pCBinder      = SOURCE_GETOBJECT(pCObject, CBinder);
  CCommand*   pCCommand     = m_pCCommand;
  CSession*   pCSession     = m_pCSession;
  CDataSource*  pCDataSource    = m_pCDataSource;
  HCHAPTER hChapter = pCRowset ? pCRowset->m_hChapter : NULL;

  //Setup the Source info
  m_idSource = iID;
  m_pCSource = pCObject;

  //Most of these commands are "delegates" from CMainWindow, when dealing
  //with the ToolBar or Menu for items dealing with MDI children...
  switch(iID)
  {
    case IDM_IDBINFO_GETLITERALINFO:
      if(SOURCE_GETINTERFACE(pCObject, IDBInfo))
        DisplayDialog(IDD_GETLISTVIEW, hWnd, GetLiteralInfoProc, pCObject, iID);
      return TRUE;

    case IDM_PROVIDERINFO:
      if(pCDataSource)
        DisplayDialog(IDD_PROVIDERINFO, hWnd, ProviderInfoProc, pCDataSource, iID);
      return TRUE;

    case IDM_BROWSE_TABLENAME:
      if(m_pCQueryBox->m_hWnd)
      {
        WCHAR wszBuffer[MAX_QUERY_LEN] = {0};

        //Display Common Dialog to obtain TableName...
        //This is for providers that use a file for TableName
        hr = BrowseOpenFileName(GetAppLite()->m_hInstance, hWnd, L"Browse for TableName", wszBuffer, MAX_QUERY_LEN, NULL, L"DataSource Files (.dsn;.kag;.sav)\0*.dsn;*.kag;*.sav;\0DataBase Files (.mdb;.db;.dbf)\0*.mdb;*.db;*.dbf;\0Program Files (.xls;.clb)\0*.xls;*.clb;\0Text Files (.txt;.csv)\0*.txt;*.csv\0All Files (*.*)\0*.*\0\0");
        if(SUCCEEDED(hr))
        {
          //Now just need to place this name in the EditBox
          //Inserted after the current "caret"
          m_pCQueryBox->ReplaceAll(wszBuffer);
        }
      }
      return TRUE;

    case IDM_IDBINFO_GETKEYWORDS:
      if(pCObject)
      {
        CWaitCursor waitCursor;
        WCHAR* pwszKeywords = NULL;
        IDBInfo* pIDBInfo = SOURCE_GETINTERFACE(pCObject, IDBInfo);

        //IDBInfo::GetKeywords
        if(pIDBInfo)
        {
          XTEST(hr = pIDBInfo->GetKeywords(&pwszKeywords));
          TRACE_METHOD(hr, L"IDBInfo::GetKeywords(&\"%s\")", pwszKeywords);
          SAFE_FREE(pwszKeywords);
        }
      }
      return TRUE;

    //Create a Session...
    case IDM_IDBCREATESESSION_CREATESESSION:
      if(pCDataSource)
      {
        CInterfaceDlg interfaceDlg(IDD_AGGREGATION, L"IDBCreateSession::CreateSession", IID_IOpenRowset);
        if(interfaceDlg.DoModal(hWnd) == IDOK)
        {
          CWaitCursor waitCursor;

          //Create a new session (in its own window)
          XTEST(hr = pCDataSource->CreateSession(interfaceDlg.GetAggregate(), interfaceDlg.GetSelInterface(), interfaceDlg.ppUnknown()));
          if(SUCCEEDED(hr))
            m_pCMainWindow->HandleObjectType(pCObject, interfaceDlg.pUnknown(), interfaceDlg.GetSelInterface(), eCSession, 0, NULL, CREATE_NEWWINDOW_IFEXISTS);
        }
      }
      return TRUE;

    //IDBDataSourceAdmin
    case IDM_IDATASOURCEADMIN_CREATEDATASOURCE:
      if(pCDataSource && pCDataSource->m_pIDBDataSourceAdmin)
        DisplayDialog(IDD_DATASOURCEADMIN_CREATEDATASOURCE, hWnd, AdminCreateDataSourceProc, pCDataSource, iID);
      return TRUE;

    case IDM_IDATASOURCEADMIN_DESTROYDATASOURCE:
      if(pCDataSource && pCDataSource->m_pIDBDataSourceAdmin)
      {
        CWaitCursor waitCursor;

        //IDBDataSourceAdmin::DestroyDataSource
        XTEST(hr = pCDataSource->m_pIDBDataSourceAdmin->DestroyDataSource());
        TRACE_METHOD(hr, L"IDBDataSourceAdmin::DestroyDataSource()");
      }
      return TRUE;

    case IDM_IDATASOURCEADMIN_GETCREATIONPROPERTIES:
      if(pCDataSource && pCDataSource->m_pIDBDataSourceAdmin)
      {
        CPropertiesDlg sCPropertiesDlg(pCMainWindow);
        sCPropertiesDlg.GetPropertyInfo(hWnd, &DBPROPSET_DBINITALL, IID_IDBDataSourceAdmin, NULL, pCDataSource->m_pIDBDataSourceAdmin);
      }
      return TRUE;

    case IDM_IDATASOURCEADMIN_MODIFYDATASOURCE:
      if(pCDataSource && pCDataSource->m_pIDBDataSourceAdmin)
      {
        CPropertiesDlg sCPropertiesDlg(pCMainWindow);
        sCPropertiesDlg.SetProperties(hWnd, &DBPROPSET_DBINITALL, IID_IDBDataSourceAdmin, pCDataSource->m_pIDBDataSourceAdmin, NULL, NULL, pCDataSource->m_pIDBDataSourceAdmin);
      }
      return TRUE;

    //IOpenRowset::OpenRowset
    case IDM_OPENROWSET:
      if(pCSession && pCSession->m_pIOpenRowset)
        DisplayDialog(IDD_OPENROWSET, hWnd, OpenRowsetProc, pCSession, iID);
      return TRUE;

    //IGetDataSource::GetDataSource
    case IDM_GETDATASOURCE:
      if(pCSession && pCSession->m_pIGetDataSource)
      {
        CInterfaceDlg interfaceDlg(IDD_INTERFACE, L"IGetDataSource::GetDataSource", IID_IDBInitialize);
        if(interfaceDlg.DoModal(hWnd) == IDOK)
        {
          CWaitCursor waitCursor;

          //IGetDataSource::GetDataSource
          if(SUCCEEDED(hr = pCSession->GetDataSource(interfaceDlg.GetSelInterface(), interfaceDlg.ppUnknown())))
            m_pCMainWindow->HandleObjectType(pCSession, interfaceDlg.pUnknown(), interfaceDlg.GetSelInterface(), eCDataSource, 0, NULL, CREATE_FINDWINDOW);
        }
      }
      return TRUE;

    //ICommand
    case IDM_EXECUTE:
        if(pCCommand && pCCommand->m_pICommand)
        DisplayDialog(IDD_EXECUTE, hWnd, ExecuteProc, pCCommand, iID);
      return TRUE;

    case IDM_COMMANDTEXT_EXECUTE:
        if(pCCommand && pCCommand->m_pICommandText)
        DisplayDialog(IDD_EXECUTE, hWnd, ExecuteProc, pCCommand, iID);
      return TRUE;

    case IDM_COMMAND_CANCEL:
      if(pCCommand && pCCommand->m_pICommand)
      {
        CWaitCursor waitCursor;

        //ICommand::Cancel
        XTEST(hr = pCCommand->m_pICommand->Cancel());
        TRACE_METHOD(hr, L"ICommand::Cancel()");
      }
      return TRUE;

    case IDM_COMMAND_GETDBSESSION:
      if(pCCommand && pCCommand->m_pICommand)
      {
        CInterfaceDlg interfaceDlg(IDD_INTERFACE, L"ICommand::GetDBSession", IID_IOpenRowset);
        if(interfaceDlg.DoModal(hWnd) == IDOK)
        {
          CWaitCursor waitCursor;

          //ICommand::GetDBSession
          CComPtr<IUnknown> spUnknown;
          XTEST(hr = pCCommand->m_pICommand->GetDBSession(interfaceDlg.GetSelInterface(), &spUnknown));
          TRACE_METHOD(hr, L"ICommand::GetDBSession(%s, &0x%p)", GetInterfaceName(interfaceDlg.GetSelInterface()), spUnknown);

          //Update the Session Object
          if(SUCCEEDED(hr))
            m_pCMainWindow->HandleObjectType(pCCommand, spUnknown, interfaceDlg.GetSelInterface(), eCSession, 0, NULL, CREATE_FINDWINDOW);
        }
      }
      return TRUE;

    ////////////////////////////////////////////////////////////////////////
    // IMDDataset
    //
    ////////////////////////////////////////////////////////////////////////
    case IDM_DATASET_GETAXISINFO:
        if(pCDataset && pCDataset->m_pIMDDataset)
        DisplayDialog(IDD_GETAXISINFO, hWnd, GetAxisInfoProc, pCDataset, iID);
      return TRUE;

    case IDM_DATASET_GETCELLDATA:
        if(pCDataset && pCDataset->m_pIMDDataset)
        {
        INDEX cRows = 0;
        INDEX* rgItems = NULL;
        HROW* rghRows = NULL;

        //Find all Selected Rows
        LV_GetSelItems(m_pCDataGrid->m_hWnd, &cRows, &rgItems, (LPARAM**)&rghRows);
        if(cRows == 0)
        {
          wMessageBox(GetFocus(), MB_TASKMODAL | MB_ICONHAND | MB_OK | MB_DEFBUTTON1,
            wsz_ERROR, L"Must first select a row...");
        }

        CWaitCursor waitCursor;

        //Display all rows...
        for(INDEX i=0; i<cRows; i++)
        {
          //Display the Data for this row...
          m_pCDataGrid->DisplayData(rghRows[i], rgItems[i], MDPROP_AXES, true/*fAlways*/);
        }
        SAFE_FREE(rgItems);
        SAFE_FREE(rghRows);
        }
        return TRUE;

      case IDM_DATASET_GETAXISROWSET:
        if(pCDataset && pCDataset->m_pIMDDataset)
        DisplayDialog(IDD_GETAXISROWSET, hWnd, GetAxisRowsetProc, pCDataset, iID);
      return TRUE;

    case IDM_DATASET_FREEAXISINFO:
        if(pCDataset && pCDataset->m_pIMDDataset)
        pCDataset->FreeAxisInfo(&pCDataset->m_cAxis, &pCDataset->m_rgAxisInfo);
      return TRUE;

    case IDM_DATASET_GETSPECIFICATION:
        if(pCDataset && pCDataset->m_pIMDDataset)
      {
        CInterfaceDlg interfaceDlg(IDD_INTERFACE, L"IMDDataset::GetSpecification", IID_ICommand);
        if(interfaceDlg.DoModal(hWnd) == IDOK)
        {
          CWaitCursor waitCursor;

          //IMDDataset::GetSpecification
          CComPtr<IUnknown> spUnknown;
          XTEST(hr = pCDataset->m_pIMDDataset->GetSpecification(interfaceDlg.GetSelInterface(), &spUnknown));
          TRACE_METHOD(hr, L"IMDDataset::GetSpecification(%s, &0x%p)", GetInterfaceName(interfaceDlg.GetSelInterface()), spUnknown);

          //What type of object, let our helper determine...
          //NOTE: Can pontentially return other object types: (ie: CREATE_DETERMINE_TYPE)
          if(SUCCEEDED(hr))
            m_pCMainWindow->HandleObjectType(pCDataset, spUnknown, interfaceDlg.GetSelInterface(), eCCommand, 0, NULL, CREATE_FINDWINDOW | CREATE_DETERMINE_TYPE);
        }
      }
      return TRUE;

    case IDM_IMULTIPLERESULTS_GETRESULT:
    {
      CMultipleResultsDlg multipleResultsDlg(this);
      multipleResultsDlg.DoModal(hWnd);
      return TRUE;
    }

    case IDM_ITRANSACTION_ABORT:
      if(SOURCE_GETINTERFACE(pCObject, ITransaction))
        DisplayDialog(IDD_TRANSACTION_ABORT, hWnd, AbortTransactionProc, pCObject, iID);
      return TRUE;

    case IDM_ITRANSACTION_COMMIT:
      if(SOURCE_GETINTERFACE(pCObject, ITransaction))
        DisplayDialog(IDD_TRANSACTION_COMMIT, hWnd, CommitTransactionProc, pCObject, iID);
      return TRUE;

    case IDM_ITRANSACTION_GETTRANSACTIONINFO:
      if(SOURCE_GETINTERFACE(pCObject, ITransaction))
        DisplayDialog(IDD_TRANSACTION_GETINFO, hWnd, GetTransactionInfo, pCObject, iID);
      return TRUE;

    case IDM_ITRANSACTIONLOCAL_STARTTRANSACTION:
      if(SOURCE_GETINTERFACE(pCObject, ITransactionLocal))
        DisplayDialog(IDD_TRANSACTION_START, hWnd, StartTransactionProc, pCObject, iID);
      return TRUE;

    case IDM_ITRANSACTIONLOCAL_GETOPTIONSOBJECT:
    {
      ITransactionLocal* pITransactionLocal = SOURCE_GETINTERFACE(pCObject, ITransactionLocal);
      if(pITransactionLocal)
      {
        CWaitCursor waitCursor;
        CComPtr<ITransactionOptions>  spTransactionOptions;

        //ITransactionLocal::GetOptionsObject
        XTEST(hr = pITransactionLocal->GetOptionsObject(&spTransactionOptions));
        TRACE_METHOD(hr, L"ITransactionLocal::GetOptionsObject(&0x%p)", spTransactionOptions);

        //Delegate
        if(SUCCEEDED(hr))
          m_pCMainWindow->HandleObjectType(pCObject, spTransactionOptions, IID_ITransactionOptions, eCTransactionOptions, 0, NULL, CREATE_NEWWINDOW_IFEXISTS);
      }
      return TRUE;
    }

    case IDM_ITRANSACTIONOBJECT_GETTRANSACTIONOBJECT:
    {
      ITransactionObject* pITransactionObject = SOURCE_GETINTERFACE(pCObject, ITransactionObject);
      if(pITransactionObject)
      {
        CWaitCursor waitCursor;
        CComPtr<ITransaction> spTransaction;

        //ITransactionObject::GetTransactionObject
        XTEST(hr = pITransactionObject->GetTransactionObject(1, &spTransaction));
        TRACE_METHOD(hr, L"ITransactionObject::GetTransactionObject(1, &0x%p)", spTransaction);

        //Delegate
        if(SUCCEEDED(hr))
          m_pCMainWindow->HandleObjectType(pCObject, spTransaction, IID_ITransaction, eCTransaction, 0, NULL, CREATE_NEWWINDOW_IFEXISTS);
      }
      return TRUE;
    }

    case IDM_ITRANSACTIONOPTIONS_GETOPTIONS:
    {
      ITransactionOptions* pITransactionOptions = SOURCE_GETINTERFACE(pCObject, ITransactionOptions);
      if(pITransactionOptions)
      {
        CWaitCursor waitCursor;
        XACTOPT XactOptions = {0};

        //ITransactionOptions::GetOptions
        XTEST(hr = pITransactionOptions->GetOptions(&XactOptions));
        TRACE_METHOD(hr, L"ITransactionOptions::GetOptions(%d, \"%s\")", XactOptions.ulTimeout, XactOptions.szDescription);
      }
      return TRUE;
    }

    case IDM_ITRANSACTIONOPTIONS_SETOPTIONS:
    {
      ITransactionOptions* pITransactionOptions = SOURCE_GETINTERFACE(pCObject, ITransactionOptions);
      if(pITransactionOptions)
        DisplayDialog(IDD_TRANSACTION_SETOPTIONS, hWnd, SetTransactionOptionsProc, pCObject, iID);
      return TRUE;
    }

    case IDM_ITRANSACTIONJOIN_RELEASETRANSACTION:
      DisplayDialog(IDD_TRANSACTION_RELEASE, hWnd, ReleaseTransaction, pCObject, iID);
      return TRUE;

    case IDM_ITRANSACTIONDISPENSOR_BEGINTRANSACTION:
      DisplayDialog(IDD_TRANSACTION_START, hWnd, StartTransactionProc, pCObject, iID);
      return TRUE;

    case IDM_ITRANSACTIONJOIN_GETOPTIONSOBJECT:
    {
      ITransactionJoin* pITransactionJoin = SOURCE_GETINTERFACE(pCObject, ITransactionJoin);
      if(pITransactionJoin)
      {
        CWaitCursor waitCursor;
        CComPtr<ITransactionOptions>  spTransactionOptions;

        //ITransactionJoin::GetOptionsObject
        XTEST(hr = pITransactionJoin->GetOptionsObject(&spTransactionOptions));
        TRACE_METHOD(hr, L"ITransactionJoin::GetOptionsObject(&0x%p)", spTransactionOptions);

        //Delegate
        if(SUCCEEDED(hr))
          m_pCMainWindow->HandleObjectType(pCObject, spTransactionOptions, IID_ITransactionOptions, eCTransactionOptions, 0, NULL, CREATE_NEWWINDOW_IFEXISTS);
      }
      return TRUE;
    }

      case IDM_ITRANSACTIONJOIN_JOINTRANSACTION:
    {
      ITransactionJoin* pITransactionJoin = SOURCE_GETINTERFACE(pCObject, ITransactionJoin);
      if(pITransactionJoin)
        DisplayDialog(IDD_TRANSACTION_JOIN, hWnd, JoinTransactionProc, pCObject, iID);
        return TRUE;
    }

    case IDM_ICOLUMNSINFO_GETCOLUMNINFO:
      if(pCDataAccess && pCDataAccess->m_pIColumnsInfo)
        DisplayDialog(IDD_GETLISTVIEW, hWnd, GetColInfoProc, pCDataAccess, iID);
      return TRUE;

    //ColumnsRowset
    case IDM_ICOLUMNSROWSET_GETCOLUMNSROWSET:
      if(SOURCE_GETINTERFACE(pCObject, IColumnsRowset))
        DisplayDialog(IDD_GETCOLUMNSROWSET, hWnd, GetColumnsRowsetProc, pCObject, iID);
      return TRUE;

    case IDM_DELETEROWS:
      if(pCRowset && pCRowset->m_pIRowsetChange)
      {
        CWaitCursor waitCursor;
        DeleteSelectedRows();
      }
      return TRUE;

    case IDM_SETDATA:
      if(pCRowset && pCRowset->m_pIRowsetChange)
        ChangeSelectedRow(pCRowset, IDM_SETDATA);
      return TRUE;

    case IDM_INSERTROW:
      if(pCRowset && pCRowset->m_pIRowsetChange)
        InsertNewRow();
      return TRUE;

    case IDM_CLEAREDITWINDOW:
      //Select all the Text and Cut it...
      //This method allows the text to be undone...
      m_pCQueryBox->SetSel(0, -1);
      m_pCQueryBox->Cut();
      return TRUE;

    case IDM_CUTEDITWINDOW:
      m_pCQueryBox->Cut();
      return TRUE;

    case IDM_COPYEDITWINDOW:
      m_pCQueryBox->Copy();
      return TRUE;

    case IDM_PASTEEDITWINDOW:
      m_pCQueryBox->Paste();
      return TRUE;

    case IDM_RESTARTPOSITION:
      if(pCRowset && pCRowset->m_pIRowset)
        m_pCDataGrid->RestartPosition();
      return TRUE;

    case IDM_GETNEXTROWS:
      if(pCRowset && pCRowset->m_pIRowset)
        DisplayDialog(IDD_GETNEXTROWS, hWnd, GetNextRowsProc, pCRowset, iID);
      return TRUE;

    case IDM_RELEASEROWS:
      if(pCRowset && pCRowset->m_pIRowset)
        m_pCDataGrid->ReleaseRows(LV_ALLSELITEMS, FALSE/*fOnlyValidRows*/);
      return TRUE;

    case IDM_ADDREFROWS:
      if(pCRowset && pCRowset->m_pIRowset)
        m_pCDataGrid->AddRefRows(LV_ALLSELITEMS);
      return TRUE;

    case IDM_RELEASEALLROWS:
      if(pCRowset && pCRowset->m_pIRowset)
        m_pCDataGrid->ReleaseRows(LV_ALLITEMS, FALSE/*fOnlyValidRows*/);
      return TRUE;

    case IDM_GETROWFROMHROW:
      if(pCRowset && pCRowset->m_pIGetRow)
      {
        //Obtain the First selected Row
        HROW hRow = NULL;
        if(m_pCDataGrid->GetSelectedRow(&hRow) == LVM_ERR)
          return TRUE;

        CComPtr<IUnknown> spUnknown;
        CInterfaceDlg interfaceDlg(IDD_AGGREGATION, L"IGetRow::GetRowFromHROW", IID_IRow);
        if(interfaceDlg.DoModal(hWnd) == IDOK)
        {
          CWaitCursor waitCursor;

          //IGetRow::GetRowFromHROW
          if(SUCCEEDED(pCRowset->GetRowFromHROW(NULL, hRow, interfaceDlg.GetSelInterface(), &spUnknown)))
          {
            //Create in new window
            CBase* pCObject = m_pCMainWindow->HandleObjectType(pCRowset, spUnknown, interfaceDlg.GetSelInterface(), eCRow, 0, NULL, CREATE_NEWWINDOW | CREATE_NODISPLAY);
            if(pCObject)
            {
              //Fill in which row handle this row was created from...
              //Just for display purposes...
              CRow* pCRow = SOURCE_GETOBJECT(pCObject, CRow);
              if(pCRow)
                pCRow->m_hSourceRow = hRow;

              pCObject->DisplayObject();
            }
          }
        }
      }
      return TRUE;

    case IDM_GETURLFROMHROW:
      if(pCRowset && pCRowset->m_pIGetRow)
      {
        CWaitCursor waitCursor;
        WCHAR* pwszURL = NULL;

        //Obtain the First selected Row
        HROW hRow = NULL;
        if(m_pCDataGrid->GetSelectedRow(&hRow) == LVM_ERR)
          return TRUE;

        //IGetRow::GetURLFromHROW
        XTEST(hr = pCRowset->m_pIGetRow->GetURLFromHROW(hRow, &pwszURL));
        TRACE_METHOD(hr, L"IGetRow::GetURLFromHROW(0x%p, \"%s\")", hRow, pwszURL);

        //Update our saved Binding...
        if(pCBinder)
        {
          SAFE_FREE(pCBinder->m_pwszURL);
          pCBinder->m_pwszURL = pwszURL;
        }
      }
      return TRUE;

    //IRow - methods
    case IDM_IROW_GETCOLUMNS:
      if(SOURCE_GETINTERFACE(pCObject, IRow))
      {
        CWaitCursor waitCursor;

        //Display the Data for this row...
        m_pCDataGrid->DisplayData(0, 1, DBPROP_IRow, true/*fAlways*/);
      }
      return TRUE;

    case IDM_IROW_GETSOURCEROWSET:
    {
      IRow* pIRow = SOURCE_GETINTERFACE(pCObject, IRow);
      if(pIRow)
      {
        CInterfaceDlg interfaceDlg(IDD_INTERFACE, L"IRow::GetSourceRowset", IID_IRowset);
        if(interfaceDlg.DoModal(hWnd) == IDOK)
        {
          CWaitCursor waitCursor;
          CComPtr<IUnknown> spUnknown;
          HROW hRow = NULL;

          //IRow::GetSourceRowset
          XTEST(hr = pIRow->GetSourceRowset(interfaceDlg.GetSelInterface(), &spUnknown, &hRow));
          TRACE_METHOD(hr, L"IRow::GetSourceRowset(%s, &0x%p, &0x%p)", GetInterfaceName(interfaceDlg.GetSelInterface()), spUnknown, hRow);

          //Update the Rowset Object
          //NOTE: We don't want to popup a new window if the parent rowset
          //is already active in its own window.  We will first try to find the
          //parent, otherwise activate a new window...
          if(SUCCEEDED(hr))
            m_pCMainWindow->HandleObjectType(pCObject, spUnknown, interfaceDlg.GetSelInterface(), eCRowset, 0, NULL, CREATE_FINDWINDOW | CREATE_RESTARTPOSITION);

          //Release the Row Handle...
          CRowset* pCRowset = SOURCE_GETPARENT(pCObject, CRowset);
          if(pCRowset)
            pCRowset->ReleaseRows(1, &hRow, NULL);
        }
      }
      return TRUE;
    }

    case IDM_IDBCREATECOMMAND_CREATECOMMAND:
      if(SOURCE_GETINTERFACE(pCObject, IDBCreateCommand))
      {
        CInterfaceDlg interfaceDlg(IDD_AGGREGATION, L"IDBCreateCommand::CreateCommand", IID_ICommandText);
        if(interfaceDlg.DoModal(hWnd) == IDOK)
        {
          CWaitCursor waitCursor;
          CSession* pCSession = SOURCE_GETOBJECT(pCObject, CSession);
          CRow* pCRow   = SOURCE_GETOBJECT(pCObject, CRow);
          ASSERT(pCSession || pCRow);

          //Create a new Command Object (with default properties)
          if(pCSession)
            hr = pCSession->CreateCommand(interfaceDlg.GetAggregate(), interfaceDlg.GetSelInterface(), interfaceDlg.ppUnknown());
          else
            hr = pCRow->CreateCommand(interfaceDlg.GetAggregate(), interfaceDlg.GetSelInterface(), interfaceDlg.ppUnknown());

          if(SUCCEEDED(hr))
            m_pCMainWindow->HandleObjectType(pCObject, interfaceDlg.pUnknown(), interfaceDlg.GetSelInterface(), eCCommand, 0, NULL, CREATE_NEWWINDOW_IFEXISTS);
        }
      }
      return TRUE;

      //IRowChange - methods
    case IDM_IROW_SETCOLUMNS:
      if(pCRow && pCRow->m_pIRowChange)
        ChangeSelectedRow(pCRow, IDM_IROW_SETCOLUMNS);
      return TRUE;

    //IRowSchemaChange - methods
    case IDM_IROW_DELETECOLUMNS:
      if(pCRow && pCRow->m_pIRowSchemaChange)
        ChangeSelectedRow(pCRow, IDM_IROW_DELETECOLUMNS);
      return TRUE;

    case IDM_IGETSESSION_GETSESSION:
    {
      IGetSession* pIGetSession = SOURCE_GETINTERFACE(pCObject, IGetSession);
      if(pIGetSession)
      {
        CInterfaceDlg interfaceDlg(IDD_INTERFACE, L"IGetSession::GetSession", IID_IOpenRowset);
        if(interfaceDlg.DoModal(hWnd) == IDOK)
        {
          CWaitCursor waitCursor;

          //IGetSession::GetSession
          CComPtr<IUnknown> spUnknown;
          XTEST(hr = pIGetSession->GetSession(interfaceDlg.GetSelInterface(), &spUnknown));
          TRACE_METHOD(hr, L"IGetSession::GetSession(%s, &0x%p)", GetInterfaceName(interfaceDlg.GetSelInterface()), spUnknown);

          //Update the Session
          if(SUCCEEDED(hr))
            m_pCMainWindow->HandleObjectType(pCObject, spUnknown, interfaceDlg.GetSelInterface(), eCSession, 0, NULL, CREATE_FINDWINDOW);
        }
      }
      return TRUE;
    }

    case IDM_IROW_OPEN:
      if(SOURCE_GETINTERFACE(pCObject, IRow))
        DisplayDialog(IDD_ROW_OPEN, hWnd, RowOpenProc, pCObject, iID);
      return TRUE;

    case IDM_ISCOPEDOPERATIONS_OPENROWSET:
      if(SOURCE_GETINTERFACE(pCObject, IScopedOperations))
        DisplayDialog(IDD_OPENROWSET, hWnd, OpenRowsetProc, pCObject, iID);
      return TRUE;

    case IDM_ISCOPEDOPERATIONS_DELETE:
      if(SOURCE_GETINTERFACE(pCObject, IScopedOperations))
        DisplayDialog(IDD_ISCO_DELETE, hWnd, ISCO_DeleteProc, pCObject, iID);
      return TRUE;

    case IDM_ISCOPEDOPERATIONS_COPY:
      if(SOURCE_GETINTERFACE(pCObject, IScopedOperations))
        DisplayDialog(IDD_ISCO_COPY, hWnd, ISCO_Proc, pCObject, iID);
      return TRUE;

    case IDM_ISCOPEDOPERATIONS_MOVE:
      if(SOURCE_GETINTERFACE(pCObject, IScopedOperations))
        DisplayDialog(IDD_ISCO_COPY, hWnd, ISCO_Proc, pCObject, iID);
      return TRUE;

    case IDM_SETCOMMANDTEXT:
      if(pCCommand && pCCommand->m_pICommandText)
        DisplayDialog(IDD_SETCOMMANDTEXT, hWnd, SetCommandTextProc, pCCommand, iID);
      return TRUE;

    case IDM_GETCOMMANDTEXT:
      if(pCCommand && pCCommand->m_pICommandText)
      {
        CWaitCursor waitCursor;

        GUID guidDialec = GUID_NULL;
        WCHAR wszBuffer[MAX_NAME_LEN+1] = {0};
        WCHAR* pwszDialect = NULL;
        WCHAR* pwszBuffer = NULL;

        XTEST(hr = pCCommand->m_pICommandText->GetCommandText(&guidDialec, &pwszBuffer));

        //Try to find a string respentation of the guidDialec
        if(!(pwszDialect = GetDialectName(guidDialec)))
        {
          pwszDialect = wszBuffer;
          StringFromGUID2(guidDialec, wszBuffer, MAX_NAME_LEN);
        }

        TRACE_METHOD(hr, L"ICommandText::GetCommandText(&%s, &\"%s\")", pwszDialect, pwszBuffer);
        SAFE_FREE(pwszBuffer);
      }
      return TRUE;

    case IDM_SETCOMMANDSTREAM:
      if(pCCommand && pCCommand->m_pICommandStream)
        DisplayDialog(IDD_SETCOMMANDSTREAM, hWnd, SetCommandTextProc, pCCommand, iID);
      return TRUE;

    case IDM_GETCOMMANDSTREAM:
      if(pCCommand && pCCommand->m_pICommandStream)
      {
        CWaitCursor waitCursor;

        GUID guidDialec = GUID_NULL;
        IID  iid = IID_NULL;
        CComPtr<IUnknown> spUnknown;
        WCHAR wszBuffer[MAX_NAME_LEN+1] = {0};
        WCHAR* pwszDialect = NULL;

        //ICommandStream::GetCommandStream
        XTEST(hr = pCCommand->m_pICommandStream->GetCommandStream(&iid, &guidDialec, (IUnknown**)&spUnknown));

        //Try to find a string respentation of the guidDialec
        if(!(pwszDialect = GetDialectName(guidDialec)))
        {
          pwszDialect = wszBuffer;
          StringFromGUID2(guidDialec, wszBuffer, MAX_NAME_LEN);
        }
        TRACE_METHOD(hr, L"ICommandStream::GetCommandStream(&%s, &%s, &0x%p)", GetInterfaceName(iid), pwszDialect, spUnknown);

        //Stand Alone Object (no window required)
        if(SUCCEEDED(hr))
        {
          CStream* pCStream = new CStream(m_pCMainWindow);
          pCStream->CreateObject(pCCommand, iid, spUnknown);
        }
      }
      return TRUE;

    case IDM_COMMANDPERSIST_GETCURRENTCOMMAND:
      if(pCCommand && pCCommand->m_pICommandPersist)
      {
        CWaitCursor waitCursor;
        DBID* pCommandID = NULL;

        //ICommandPersist::GetCurrentCommand
        XTEST(pCCommand->GetCurrentCommand(&pCommandID));

        DBIDFree(pCommandID);
        SAFE_FREE(pCommandID);
      }
      return TRUE;

    case IDM_COMMANDPERSIST_DELETECOMMAND:
    case IDM_COMMANDPERSIST_LOADCOMMAND:
    case IDM_COMMANDPERSIST_SAVECOMMAND:
      if(pCCommand && pCCommand->m_pICommandPersist)
        DisplayDialog(IDD_COMMANDPERSIST, hWnd, CommandPersistProc, pCCommand, iID);
      return TRUE;

    case IDM_COMMANDPREPARE:
      if(pCCommand && pCCommand->m_pICommandPrepare)
      {
        CWaitCursor waitCursor;

        //ICommand::Prepare
        XTEST(hr = pCCommand->Prepare(0));
      }
      return TRUE;

    case IDM_COMMANDUNPREPARE:
      if(pCCommand && pCCommand->m_pICommandPrepare)
      {
        CWaitCursor waitCursor;

        //ICommand::Unprepare
        XTEST(hr = pCCommand->m_pICommandPrepare->Unprepare());
        TRACE_METHOD(hr, L"ICommandPrepare::Unprepare()");
      }
      return TRUE;

    case IDM_GETSCHEMAS:
    case IDM_GETSCHEMAROWSET:
      if(pCSession && pCSession->m_pIDBSchemaRowset)
      {
        CSchemaDlg  schemaDlg(this);
        schemaDlg.Display();
      }
      return TRUE;

    case IDM_ISESSIONPROPERTIES_GETPROPERTIES:
      if(pCSession && pCSession->m_pISessionProperties)
      {
        CPropertiesDlg sCPropertiesDlg(pCMainWindow);
        sCPropertiesDlg.GetProperties(hWnd, &DBPROPSET_SESSIONALL, IID_ISessionProperties, pCSession->m_pISessionProperties, pCDataSource ? pCDataSource->m_pIDBProperties : NULL);
      }
      return TRUE;

    case IDM_COMMAND_GETPROPERTIES:
      if(pCCommand && pCCommand->m_pICommandProperties)
      {
        CPropertiesDlg sCPropertiesDlg(pCMainWindow);
        sCPropertiesDlg.GetProperties(hWnd, &DBPROPSET_ROWSETALL, IID_ICommandProperties, pCCommand->m_pICommandProperties, pCDataSource ? pCDataSource->m_pIDBProperties : NULL);
      }
      return TRUE;

    case IDM_IROWSET_GETPROPERTIES:
      if(pCRowset && pCRowset->m_pIRowsetInfo)
      {
        CPropertiesDlg sCPropertiesDlg(pCMainWindow);
        sCPropertiesDlg.GetProperties(hWnd, &DBPROPSET_ROWSETALL, IID_IRowsetInfo, pCRowset->m_pIRowsetInfo, pCDataSource ? pCDataSource->m_pIDBProperties : NULL);
      }
      return TRUE;

    //IRowsetInfo
    case IDM_GETSPECIFICATION:
      if(pCRowset && pCRowset->m_pIRowsetInfo)
      {
        CInterfaceDlg interfaceDlg(IDD_INTERFACE, L"IRowsetInfo::GetSpecification", IID_IOpenRowset);
        if(interfaceDlg.DoModal(hWnd) == IDOK)
        {
          CWaitCursor waitCursor;

          //IRowset::GetSpecification
          CComPtr<IUnknown> spUnknown;
          XTEST(hr = pCRowset->m_pIRowsetInfo->GetSpecification(interfaceDlg.GetSelInterface(), &spUnknown));
          TRACE_METHOD(hr, L"IRowset::GetSpecification(%s, &0x%p)", GetInterfaceName(interfaceDlg.GetSelInterface()), spUnknown);

          //What type of object, let our helper determine...
          //NOTE: Can pontentially return other object types: (ie: CREATE_DETERMINE_TYPE)
          if(SUCCEEDED(hr))
            m_pCMainWindow->HandleObjectType(pCRowset, spUnknown, interfaceDlg.GetSelInterface(), eCSession, 0, NULL, CREATE_FINDWINDOW | CREATE_DETERMINE_TYPE);
        }
      }
      return TRUE;

    case IDM_GETREFERENCEDROWSET:
      if(pCRowset && pCRowset->m_pIRowsetInfo)
        DisplayDialog(IDD_GETREFERENCEDROWSET, hWnd, GetReferencedRowsetProc, pCRowset, iID);
      return TRUE;

    case IDM_ISESSIONPROPERTIES_SETPROPERTIES:
      if(pCSession && pCSession->m_pISessionProperties)
      {
        pCDataSource = SOURCE_GETPARENT(pCSession, CDataSource);

        CPropertiesDlg sCPropertiesDlg(pCMainWindow);
        sCPropertiesDlg.SetProperties(hWnd, &DBPROPSET_SESSIONALL, IID_ISessionProperties, pCSession->m_pISessionProperties, pCDataSource ? pCDataSource->m_pIDBProperties : NULL);
      }
      return TRUE;

    case IDM_COMMAND_SETPROPERTIES:
      if(pCCommand && pCCommand->m_pICommandProperties)
      {
        pCDataSource = SOURCE_GETPARENT(pCCommand, CDataSource);

        CPropertiesDlg sCPropertiesDlg(pCMainWindow);
        sCPropertiesDlg.SetProperties(hWnd, &DBPROPSET_ROWSETALL, IID_ICommandProperties, pCCommand->m_pICommandProperties, pCDataSource ? pCDataSource->m_pIDBProperties : NULL);
      }
      return TRUE;

    case IDM_COMMAND_CLEARCOMMAND:
      if(pCCommand && pCSession && pCCommand->m_pIUnknown)
      {
        CWaitCursor waitCursor;
        CComPtr<ICommand> spCommand;

        //A little more difficult than ROWSET_CLEARPROPERTIES
        //Since any properties set on a command object are set,
        //the only way to remove them is to either try and set them
        //to the opposite value, or create a new command object...

        //Create a new command
        //And then re-create our object with the new command (with no properties)...
        pCSession->CreateCommand(NULL, IID_ICommand, (IUnknown**)&spCommand);
        pCCommand->CreateObject(pCSession, IID_ICommand, spCommand);
      }
      return TRUE;

    ///////////////////////////////////////////////////////////////////
    // IConvertType
    //
    ///////////////////////////////////////////////////////////////////
    case IDM_ICONVERTTYPE_CANCONVERT:
      if(pCDataAccess->m_pIConvertType)
        DisplayDialog(IDD_CANCONVERT, hWnd, CanConvertProc, pCDataAccess, iID);
      return TRUE;

    ///////////////////////////////////////////////////////////////////
    // IAccessor
    //
    ///////////////////////////////////////////////////////////////////
    case IDM_IACCESSOR_GETBINDINGS:
      if(pCDataAccess && pCDataAccess->m_pIAccessor)
        DisplayDialog(IDD_GETLISTVIEW, hWnd, GetBindingsProc, pCDataAccess, iID);
      return TRUE;

    case IDM_IACCESSOR_ADDREFACCESSOR:
      if(pCDataAccess && pCDataAccess->m_pIAccessor)
      {
        CWaitCursor waitCursor;

        //IAccessor::AddRefAccessor
        pCDataAccess->AddRefAccessor(pCDataAccess->m_hAccessor);
      }
      return TRUE;

    case IDM_IACCESSOR_CREATEACCESSOR:
      if(pCDataAccess && pCDataAccess->m_pIAccessor)
        DisplayDialog(IDD_CREATEACCESSOR, hWnd, CreateAccessorProc, pCDataAccess, iID);
      return TRUE;

    case IDM_IACCESSOR_RELEASEACCESSOR:
      if(pCDataAccess && pCDataAccess->m_pIAccessor)
        pCDataAccess->ReleaseAccessor(&pCDataAccess->m_hAccessor, TRUE/*fReleaseAlways*/);
      return TRUE;

    //ITableDefinition
    case IDM_TABLE_CREATETABLE:
      if(pCSession && pCSession->m_pITableDefinition)
        DisplayDialog(IDD_CREATETABLE, hWnd, CreateTableProc, pCSession, iID);
      return TRUE;

    case IDM_TABLE_ADDCOLUMN:
      if(pCSession && pCSession->m_pITableDefinition)
        DisplayDialog(IDD_ADDCOLUMN, hWnd, AddColumnProc, pCSession, iID);
      return TRUE;

    case IDM_TABLE_DROPCOLUMN:
      if(pCSession && pCSession->m_pITableDefinition)
        DisplayDialog(IDD_DROPCOLUMN, hWnd, DropColumnProc, pCSession, iID);
      return TRUE;

    case IDM_TABLE_DROPTABLE:
      if(pCSession && pCSession->m_pITableDefinition)
        DisplayDialog(IDD_DROPTABLE, hWnd, DropTableProc, pCSession, iID);
      return TRUE;

    //ITableDefinitionWithConstraints
    case IDM_TABLE_CREATETABLEWITHCONSTRAINTS:
//      if(pCSession && pCSession->m_pITableDefinitionWithConstraints)
//        DisplayDialog(IDD_CREATETABLE, hWnd, CreateTableProc, pCSession, iID);
      return TRUE;

    case IDM_TABLE_ADDCONSTRAINT:
      if(pCSession && pCSession->m_pITableDefinitionWithConstraints)
      {
        CWaitCursor waitCursor;
        DBORDINAL     cConsDesc = 1;
        DBCONSTRAINTDESC  ConsDesc;
        DBCONSTRAINTDESC* rgConsDesc = &ConsDesc;
        DBID        TableID;
        WCHAR       *pwszTableName = NULL;
        CConstraintDlg    ConsDlg(pCMainWindow);

        memset(&ConsDesc, 0, sizeof(DBCONSTRAINTDESC));

        if (S_OK == ConsDlg.SetConstraintAndTable(hWnd, &ConsDesc, &pwszTableName))
        {
          TableID.eKind = DBKIND_NAME;
          TableID.uName.pwszName = pwszTableName;
          XTEST(hr = pCSession->m_pITableDefinitionWithConstraints->AddConstraint(&TableID, &ConsDesc));

          TRACE_METHOD(hr, L"ITableDefinitionWithConstraints::AddConstraint(&%s, \"%p\")", pwszTableName, &ConsDesc);
        }
        SAFE_FREE(pwszTableName);
        FreeConstraintDesc(&cConsDesc, &rgConsDesc, FALSE);

      }
      return TRUE;

    case IDM_TABLE_DROPCONSTRAINT:
      if(pCSession && pCSession->m_pITableDefinitionWithConstraints)
        DisplayDialog(IDD_DROPCONSTRAINT, hWnd, DropConstraintProc, pCSession, iID);
      return TRUE;

    //IIndexDefinition
    case IDM_INDEX_CREATEINDEX:
      if(pCSession && pCSession->m_pIIndexDefinition)
        DisplayDialog(IDD_CREATEINDEX, hWnd, CreateIndexProc, pCSession, iID);
      return TRUE;

    case IDM_INDEX_DROPINDEX:
      if(pCSession && pCSession->m_pIIndexDefinition)
        DisplayDialog(IDD_DROPINDEX, hWnd, DropIndexProc, pCSession, iID);
      return TRUE;

    // IAlterIndex
    case IDM_INDEX_ALTERINDEX:
      if(pCSession && pCSession->m_pIAlterIndex)
      {
        CWaitCursor   waitCursor;
        CAlterIndexDlg  AlterIndexDlg(this);
        DBID      *pTableID   = NULL;
        DBID      *pIndexID   = NULL;
        DBID      *pNewIndexID  = NULL;
        BOOL      fUseIndexProps  = FALSE;
        ULONG     cPropSets   = 0;
        DBPROPSET*    rgPropSets    = NULL;

        // get index updates
        if (S_OK == AlterIndexDlg.AlterIndex(hWnd, &pTableID, &pIndexID, &pNewIndexID,
          &fUseIndexProps))
        {
          //alter the index
          if (fUseIndexProps)
          {
            cPropSets = AlterIndexDlg.m_CPropSets.GetCount();
            rgPropSets  = AlterIndexDlg.m_CPropSets.GetPropSets();
          }

          XTEST(hr = pCSession->m_pIAlterIndex->AlterIndex(pTableID, pIndexID,
            pNewIndexID, cPropSets, rgPropSets));

          TRACE_METHOD(hr, L"IAlterIndex::AlterIndex(&%p, &%p, &%p, %d, %p)",
            pTableID, pIndexID, pNewIndexID, cPropSets, rgPropSets);
        }

        DBIDFree(pTableID);
        SAFE_FREE(pTableID);
        DBIDFree(pIndexID);
        SAFE_FREE(pIndexID);
        DBIDFree(pNewIndexID);
        SAFE_FREE(pNewIndexID);
      }
      return TRUE;

    // IAlterTable
    case IDM_TABLE_ALTERTABLE:
      if(pCSession && pCSession->m_pIAlterTable)
      {
        CWaitCursor   waitCursor;
        CAlterTableDlg  AlterTableDlg(this);
        ULONG     cPropSets   = 0;
        DBPROPSET*    rgPropSets    = NULL;

        // get table updates
        if (S_OK == AlterTableDlg.AlterTable(hWnd))
        {
          //alter table
          if (AlterTableDlg.m_fUseTableProps)
          {
            cPropSets = AlterTableDlg.m_CPropSets.GetCount();
            rgPropSets  = AlterTableDlg.m_CPropSets.GetPropSets();
          }

          XTEST(hr = pCSession->m_pIAlterTable->AlterTable(
            AlterTableDlg.m_pTableID,
            AlterTableDlg.m_pNewTableID,
            cPropSets,
            rgPropSets));

          TRACE_METHOD(hr, L"IAlterTable::AlterTable(&%p, &%p, %d, %p)",
            AlterTableDlg.m_pTableID, AlterTableDlg.m_pNewTableID, cPropSets, rgPropSets);
        }
      }
      return TRUE;

    case IDM_TABLE_ALTERCOLUMN:
      if(pCSession && pCSession->m_pIAlterTable)
      {
        CWaitCursor   waitCursor;
        CAlterColumnDlg AlterColumnDlg(this);

        // get table updates
        if (S_OK == AlterColumnDlg.AlterColumn(hWnd))
        {
          //alter column
          XTEST(hr = pCSession->m_pIAlterTable->AlterColumn(
            AlterColumnDlg.m_pTableID,
            AlterColumnDlg.m_pColumnID,
            AlterColumnDlg.m_dwColFlags,
            &AlterColumnDlg.m_ColDesc));

          TRACE_METHOD(hr, L"IAlterTable::AlterColumn(&%p, &%p, %d, %p)",
            AlterColumnDlg.m_pTableID, AlterColumnDlg.m_pColumnID,
            AlterColumnDlg.m_dwColFlags, &AlterColumnDlg.m_ColDesc);
        }
      }
      return TRUE;

    //IRowsetIdentity
    case IDM_IROWSETINDENTITY_ISSAMEROW:
      if(pCRowset && pCRowset->m_pIRowsetIdentity)
      {
        CWaitCursor waitCursor;

        //Obtain the First selected Row
        INDEX iSelRow   = m_pCDataGrid->GetSelectedRow(NULL, FALSE);
        HROW hRow1      = m_pCDataGrid->GetItemParam(iSelRow);

        //Obtain the Second selected Row
        INDEX iSelRow2    = m_pCDataGrid->GetNextItem(iSelRow, LVNI_SELECTED);
        HROW hRow2      = m_pCDataGrid->GetItemParam(iSelRow2 != LVM_ERR ? iSelRow2 : iSelRow);

        //IRowsetIdentity::IsSameRow
        XTEST(hr = pCRowset->m_pIRowsetIdentity->IsSameRow(hRow1, hRow2));
        TRACE_METHOD(hr, L"IRowsetIdentity::IsSameRow(0x%p, 0x%p)", hRow1, hRow2);
      }
      return TRUE;

    //IRowsetScroll
    case IDM_IROWSETSCROLL_GETAPPROXIMATEPOSITION:
      if(pCRowset && pCRowset->m_pIRowsetScroll)
      {
        CWaitCursor waitCursor;
        DBBKMARK cbBookmark = 0;
        BYTE* pBookmark = NULL;
        DBCOUNTITEM ulPosition = 0;
        DBCOUNTITEM cRows = 0;
        HROW  hRow = NULL;

        //Obtain the bookmark for the selected row...
        if(m_pCDataGrid->GetSelectedRow(&hRow, FALSE)!=LVM_ERR)
          hr = pCRowset->GetBookmark(hRow, &cbBookmark, &pBookmark);

        //IRowsetScroll::GetApproximatePosition
        XTEST(hr = pCRowset->m_pIRowsetScroll->GetApproximatePosition(hChapter, cbBookmark, pBookmark, &ulPosition, &cRows));
        TRACE_METHOD(hr, L"IRowsetScroll::GetApproximatePosition(0x%p, %lu, 0x%p, &%lu, &%lu)", hChapter, cbBookmark, pBookmark, ulPosition, cRows);

        //Cleanup
        SAFE_FREE(pBookmark);
      }
      return TRUE;

    //IRowsetLocate
    case IDM_IROWSETLOCATE_COMPARE:
      if(pCRowset && pCRowset->m_pIRowsetLocate)
      {
        CWaitCursor waitCursor;

        HROW  rghRows[2] = {NULL, NULL};
        DBBKMARK rgcbBookmarks[2] = {0, 0};
        const BYTE* rgpBookmarks[2] = {NULL, NULL};
        DBCOMPARE dwComparison = 0;

        //Obtain the First selected Row
        INDEX iSelRow   = m_pCDataGrid->GetSelectedRow(NULL, FALSE);
        rghRows[0]      = m_pCDataGrid->GetItemParam(iSelRow);

        //Obtain the Second selected Row
        INDEX iSelRow2    = m_pCDataGrid->GetNextItem(iSelRow, LVNI_SELECTED);
        rghRows[1]      = m_pCDataGrid->GetItemParam(iSelRow2 != LVM_ERR ? iSelRow2 : iSelRow);

        //Obtain the bookmark(s) for the selected row(s)...
        if(iSelRow!=LVM_ERR)
        {
          hr = pCRowset->GetBookmark(rghRows[0], &rgcbBookmarks[0], (BYTE**)&rgpBookmarks[0]);
          hr = pCRowset->GetBookmark(rghRows[1], &rgcbBookmarks[1], (BYTE**)&rgpBookmarks[1]);
        }

        //IRowsetLocate::Compare
        XTEST(hr = pCRowset->m_pIRowsetLocate->Compare(hChapter, rgcbBookmarks[0], rgpBookmarks[0], rgcbBookmarks[1], rgpBookmarks[1], &dwComparison));
        TRACE_METHOD(hr, L"IRowsetLocate::Compare(0x%p, %lu, 0x%p, %lu, 0x%p, &%d)", hChapter, rgcbBookmarks[0], rgpBookmarks[0], rgcbBookmarks[1], rgpBookmarks[1], dwComparison);

        //Cleanup
        CoTaskMemFree((void*)rgpBookmarks[0]);
        CoTaskMemFree((void*)rgpBookmarks[1]);
      }
      return TRUE;

    case IDM_IROWSETLOCATE_HASH:
      if(pCRowset && pCRowset->m_pIRowsetLocate)
      {
        CWaitCursor waitCursor;

        INDEX cRows = 0;
        HROW* rghRows = NULL;
        DBBKMARK rgcbBookmarks[MAX_OPENROWS+1];
        const BYTE* rgpBookmarks[MAX_OPENROWS+1];
        DBHASHVALUE rgHashedValues[MAX_OPENROWS+1];
        DBROWSTATUS rgBookmarkStatus[MAX_OPENROWS+1];

        //Obtain all Selected Rows
        LV_GetSelItems(m_pCDataGrid->m_hWnd, &cRows, NULL, (LPARAM**)&rghRows);
        cRows = min(cRows, MAX_OPENROWS);

        //Obtain the bookmark(s) for the selected row(s)...
        for(INDEX i=0; i<cRows; i++)
        {
          hr = pCRowset->GetBookmark(rghRows[i], &rgcbBookmarks[i], (BYTE**)&rgpBookmarks[i]);
        }

        //IRowsetLocate::Hash
        XTEST(hr = pCRowset->m_pIRowsetLocate->Hash(hChapter, cRows, rgcbBookmarks, rgpBookmarks, rgHashedValues, rgBookmarkStatus));
        TRACE_METHOD(hr, L"IRowsetLocate::Hash(0x%p, %lu, 0x%p, 0x%p, 0x%p, 0x%p)", hChapter, cRows, rgcbBookmarks, rgpBookmarks, rgHashedValues, rgBookmarkStatus);

        //Cleanup
        SAFE_FREE(rghRows);
        for(i=0; i<cRows; i++)
          CoTaskMemFree((void*)rgpBookmarks[i]);
      }
      return TRUE;

    case IDM_IROWSETLOCATE_GETROWSBYBOOKMARK:
      if(pCRowset && pCRowset->m_pIRowsetLocate)
      {
        CWaitCursor waitCursor;

        INDEX cSelItems = 0;
        INDEX* rgSelItems = 0;
        HROW* rghRows = NULL;
        DBBKMARK rgcbBookmarks[MAX_OPENROWS+1];
        const BYTE* rgpBookmarks[MAX_OPENROWS+1];
        DBROWSTATUS rgRowStatus[MAX_OPENROWS+1];

        //Obtain all Selected Rows
        LV_GetSelItems(m_pCDataGrid->m_hWnd, &cSelItems, &rgSelItems, (LPARAM**)&rghRows);
        cSelItems = min(cSelItems, MAX_OPENROWS);

        //Obtain the bookmark(s) for the selected row(s)...
        for(INDEX i=0; i<cSelItems; i++)
          hr = pCRowset->GetBookmark(rghRows[i], &rgcbBookmarks[i], (BYTE**)&rgpBookmarks[i]);

        //Release previously fetched rows, (if user requested)
        hr = m_pCDataGrid->ReleaseHeldRows();

        //IRowsetLocate::GetRowsByBookmark
        XTEST(hr = pCRowset->m_pIRowsetLocate->GetRowsByBookmark(hChapter, cSelItems, rgcbBookmarks, rgpBookmarks, rghRows, rgRowStatus));
        TRACE_METHOD(hr, L"IRowsetLocate::GetRowsByBookmark(0x%p, %lu, 0x%p, 0x%p, 0x%p, 0x%p)", hChapter, cSelItems, rgcbBookmarks, rgpBookmarks, rghRows, rgRowStatus);

        //Display the data rows retrieved...
        for(i=0; i<cSelItems; i++)
        {
          //Some rows might have not been successfully retrived,
          //According to the spec, this is denoted with a NULL hRow
          if(rghRows[i])
            m_pCDataGrid->DisplayData(rghRows[i], rgSelItems[i]);
        }

        //Cleanup
        for(i=0; i<cSelItems; i++)
          CoTaskMemFree((void*)rgpBookmarks[i]);
        SAFE_FREE(rghRows);
        SAFE_FREE(rgSelItems);
      }
      return TRUE;

    case IDM_IROWSETBOOKMARK_POSITIONONBOOKMARK:
      if(pCRowset && pCRowset->m_pIRowsetBookmark)
      {
        CWaitCursor waitCursor;

        HROW  hRow = NULL;
        DBBKMARK cbBookmark = 0;
        const BYTE* pBookmark = NULL;

        //Obtain the first selected row...
        INDEX iSelRow = m_pCDataGrid->GetSelectedRow(&hRow, FALSE);
        if(iSelRow != LVM_ERR && hRow)
        {
          //Obtain the bookmark
          if(SUCCEEDED(hr = pCRowset->GetBookmark(hRow, &cbBookmark, (BYTE**)&pBookmark)))
          {
            //IRowsetBookmark::PositionOnBookmark
            XTEST(hr = pCRowset->m_pIRowsetBookmark->PositionOnBookmark(hChapter, cbBookmark, pBookmark));
            TRACE_METHOD(hr, L"IRowsetBookmark::PositionOnBookmark(0x%p, %lu, 0x%p)", hChapter, cbBookmark, pBookmark);

            //Move the NFP indicator...
            if(SUCCEEDED(hr))
            {
              //Display the new Fetch Position indicator...
              m_pCDataGrid->DisplayFetchPosition(iSelRow, TRUE/*fLastFetchForward*/);
            }
          }
        }

        //Cleanup
        SAFE_FREE(pBookmark);
      }
      return TRUE;

    case IDM_IROWSETLOCATE_GETROWSAT:
      if(pCRowset && pCRowset->m_pIRowsetLocate)
        DisplayDialog(IDD_GETNEXTROWS, hWnd, GetNextRowsProc, pCRowset, iID);
      return TRUE;

    //IRowsetFind
    case IDM_IROWSETFIND_FINDNEXTROW:
      if(pCRowset && pCRowset->m_pIRowsetFind)
        DisplayDialog(IDD_FINDNEXTROW, hWnd, FindNextRowProc, pCRowset, iID);
      return TRUE;

    //CommandWithParameters
    case IDM_MAPPARAMETERNAMES:
      return TRUE;

    case IDM_SETPARAMETERINFO:
      if(pCCommand && pCCommand->m_pICommandWithParameters)
        DisplayDialog(IDD_SETPARAMETERINFO, hWnd, SetParameterInfoProc, pCCommand, iID);
      return TRUE;

    case IDM_GETPARAMETERINFO:
      if(pCCommand && pCCommand->m_pICommandWithParameters)
        DisplayDialog(IDD_GETLISTVIEW, hWnd, GetParameterInfoProc, pCCommand, iID);
      return TRUE;

    case IDM_IPERSIST_GETCLASSID:
      if(pCDataSource && pCDataSource->m_pIPersist)
      {
        CLSID clsid;
        pCDataSource->GetClassID(&clsid);
      }
      return TRUE;

    case IDM_IPERSISTFILE_LOAD:
      if(pCDataSource && pCDataSource->m_pIPersistFile)
      {
        WCHAR wszBuffer[MAX_QUERY_LEN] = {0};

        //Display Common Dialog to obtain File To Load...
        hr = BrowseOpenFileName(GetAppLite()->m_hInstance, hWnd, L"IPersistFile::Load", wszBuffer, MAX_QUERY_LEN, NULL, L"DataSource Files (.dsn;.kag;.sav)\0*.dsn;*.kag;*.sav;\0DataBase Files (.mdb;.db;.dbf)\0*.mdb;*.db;*.dbf;\0Program Files (.xls;.clb)\0*.xls;*.clb;\0Text Files (.txt;.csv)\0*.txt;*.csv\0All Files (*.*)\0*.*\0\0");
        if(SUCCEEDED(hr))
        {
          CWaitCursor waitCursor;

          //IPersistFile::Load
          XTEST(hr = pCDataSource->m_pIPersistFile->Load(wszBuffer, STGM_READ));
          TRACE_METHOD(hr, L"IPersistFile::Load(\"%s\", STGM_READ)", wszBuffer);
        }
      }
      return TRUE;

    case IDM_IPERSISTFILE_SAVE:
      if(pCDataSource && pCDataSource->m_pIPersistFile)
      {
        WCHAR wszBuffer[MAX_QUERY_LEN] = {0};

        //Display Common Dialog to obtain File To Save...
        hr = BrowseSaveFileName(GetAppLite()->m_hInstance, hWnd, L"IPersistFile::Save", wszBuffer, MAX_QUERY_LEN, NULL, L"DataSource Files (.dsn;.kag;.sav)\0*.dsn;*.kag;*.sav;\0DataBase Files (.mdb;.db;.dbf)\0*.mdb;*.db;*.dbf;\0Program Files (.xls;.clb)\0*.xls;*.clb;\0Text Files (.txt;.csv)\0*.txt;*.csv\0All Files (*.*)\0*.*\0\0");
        if(SUCCEEDED(hr))
        {
          CWaitCursor waitCursor;

          //IPersistFile::Save
          XTEST(hr = pCDataSource->m_pIPersistFile->Save(wszBuffer, TRUE));
          TRACE_METHOD(hr, L"IPersistFile::Save(\"%s\", TRUE)", wszBuffer);
        }
      }
      return TRUE;

    case IDM_IPERSISTFILE_SAVECOMPLETED:
      if(pCDataSource && pCDataSource->m_pIPersistFile)
      {
        WCHAR wszBuffer[MAX_QUERY_LEN] = {0};

        //Display Common Dialog to obtain File To Save...
        hr = BrowseSaveFileName(GetAppLite()->m_hInstance, hWnd, L"IPersistFile::SaveCompleted", wszBuffer, MAX_QUERY_LEN, NULL, L"DataSource Files (.dsn;.kag;.sav)\0*.dsn;*.kag;*.sav;\0DataBase Files (.mdb;.db;.dbf)\0*.mdb;*.db;*.dbf;\0Program Files (.xls;.clb)\0*.xls;*.clb;\0Text Files (.txt;.csv)\0*.txt;*.csv\0All Files (*.*)\0*.*\0\0");
        if(SUCCEEDED(hr))
        {
          CWaitCursor waitCursor;

          //IPersistFile::Save
          XTEST(hr = pCDataSource->m_pIPersistFile->SaveCompleted(wszBuffer));
          TRACE_METHOD(hr, L"IPersistFile::SaveCompleted(\"%s\")", wszBuffer);
        }
      }
      return TRUE;

    case IDM_IPERSISTFILE_GETCURFILE:
      if(pCDataSource && pCDataSource->m_pIPersistFile)
      {
        CWaitCursor waitCursor;
        WCHAR* pwszFileName = NULL;

        //IPersistFile::GetCurFile
        XTEST(hr = pCDataSource->m_pIPersistFile->GetCurFile(&pwszFileName));
        TRACE_METHOD(hr, L"IPersistFile::GetCurFile(\"%s\")", pwszFileName);
      }
      return TRUE;

    case IDM_IPERSISTFILE_ISDIRTY:
      if(pCDataSource && pCDataSource->m_pIPersistFile)
      {
        CWaitCursor waitCursor;

        //IPersistFile::IsDirty
        XTEST(hr = pCDataSource->m_pIPersistFile->IsDirty());
        TRACE_METHOD(hr, L"IPersistFile::IsDirty()");
      }
      return TRUE;

    case IDM_GETDATA:
    case IDM_IROWSETLOCATE_GETDATA:
    case IDM_IROWSETSCROLL_GETDATA:
      if(pCRowset && pCRowset->m_pIRowset)
      {
        INDEX cRows = 0;
        INDEX* rgItems = NULL;
        HROW* rghRows = NULL;

        //Find all Selected Rows
        LV_GetSelItems(m_pCDataGrid->m_hWnd, &cRows, &rgItems, (LPARAM**)&rghRows);
        if(cRows == 0)
        {
          wMessageBox(GetFocus(), MB_TASKMODAL | MB_ICONHAND | MB_OK | MB_DEFBUTTON1,
            wsz_ERROR, L"Must first select a row...");
        }

        DBPROPID dwSourceID = DBPROP_IRowset;
        if(iID == IDM_IROWSETLOCATE_GETDATA)
          dwSourceID = DBPROP_IRowsetLocate;
        if(iID == IDM_IROWSETSCROLL_GETDATA)
          dwSourceID = DBPROP_IRowsetScroll;

        CWaitCursor waitCursor;

        //Display all rows...
        for(INDEX i=0; i<cRows; i++)
        {
          //Display the Data for this row...
          m_pCDataGrid->DisplayData(rghRows[i], rgItems[i], dwSourceID, true/*fAlways*/);
        }
        SAFE_FREE(rgItems);
        SAFE_FREE(rghRows);
      }
      return TRUE;

    case IDM_REFRESH:
      if(pCRowset && pCRowset->m_pIRowset)
      {
        CWaitCursor waitCursor;

        //Similar to GetData except for all rows
        if(SUCCEEDED(m_pCDataGrid->RestartPosition()))
          m_pCDataGrid->RefreshData();
      }
      return TRUE;

    case IDM_GETVISIBLEDATA:
      if(pCRowset && pCRowset->m_pIRowsetResynch)
      {
        INDEX cRows = 0;
        INDEX* rgItems = NULL;
        HROW* rghRows = NULL;

        //Find all Selected Rows
        LV_GetSelItems(m_pCDataGrid->m_hWnd, &cRows, &rgItems, (LPARAM**)&rghRows);
        if(cRows == 0)
        {
          wMessageBox(GetFocus(), MB_TASKMODAL | MB_ICONHAND | MB_OK | MB_DEFBUTTON1,
            wsz_ERROR, L"Must first select a row...");
        }

        CWaitCursor waitCursor;
        for(INDEX i=0; i<cRows; i++)
        {
          //Display the Data for this row...
          m_pCDataGrid->DisplayData(rghRows[i], rgItems[i], DBPROP_IRowsetResynch, true/*fAlways*/);
        }
        SAFE_FREE(rgItems);
        SAFE_FREE(rghRows);
      }
      return TRUE;

    case IDM_RESYNCHROWS:
      if(pCRowset && pCRowset->m_pIRowsetResynch)
      {
        CWaitCursor waitCursor;

        INDEX cRows = 0;
        HROW* rghRows = NULL;
        DBCOUNTITEM cRowsResynched = 0;
        HROW* rghRowsResynched = 0;
        DBROWSTATUS* rgRowStatus = NULL;
        INDEX* rgItems = NULL;

        //Get all selected Rows
        LV_GetSelItems(m_pCDataGrid->m_hWnd, &cRows, &rgItems, (LPARAM**)&rghRows);

        //IRowsetResynch::ResynchRows
        XTEST(hr = pCRowset->m_pIRowsetResynch->ResynchRows(cRows, rghRows, &cRowsResynched, &rghRowsResynched, &rgRowStatus));
        DisplayRowErrors(hr, cRowsResynched, rghRowsResynched, rgRowStatus);
        TRACE_METHOD(hr, L"IRowsetResynch::ResynchRows(%lu, 0x%p, &%lu, &0x%p, &0x%p)", cRows, rghRows, cRowsResynched, rghRowsResynched, rgRowStatus);

        //Now GetData for all SelectedRows (a nice helper)
        //We won't worry about updating the case for (0,NULL), its not worth
        //trying to match the rhgRows returned to the correct hRows.  Worse case
        //is the user has to call GetData for one or all rows...
        for(INDEX i=0; i<cRows; i++)
        {
          //Display the Data for this row...
          m_pCDataGrid->DisplayData(rghRows[i], rgItems[i]);
        }

        //Cleanup
        SAFE_FREE(rghRows);
        SAFE_FREE(rghRowsResynched);
        SAFE_FREE(rgRowStatus);
        SAFE_FREE(rgItems);
      }
      return TRUE;

    case IDM_GETLASTVISIBLEDATA:
      if(pCRowset && pCRowset->m_pIRowsetRefresh)
      {
        CWaitCursor waitCursor;

        INDEX cRows = 0;
        INDEX* rgItems = NULL;
        HROW* rghRows = NULL;

        //Find all Selected Rows
        LV_GetSelItems(m_pCDataGrid->m_hWnd, &cRows, &rgItems, (LPARAM**)&rghRows);
        if(cRows == 0)
        {
          wMessageBox(GetFocus(), MB_TASKMODAL | MB_ICONHAND | MB_OK | MB_DEFBUTTON1,
            wsz_ERROR, L"Must first select a row...");
        }

        for(INDEX i=0; i<cRows; i++)
        {
          //Display the Data for this row...
          m_pCDataGrid->DisplayData(rghRows[i], rgItems[i], DBPROP_IRowsetRefresh, true/*fAlways*/);
        }
        SAFE_FREE(rgItems);
        SAFE_FREE(rghRows);
      }
      return TRUE;

    case IDM_REFRESHVISIBLEDATA:
      if(pCRowset && pCRowset->m_pIRowsetRefresh)
      {
        CWaitCursor waitCursor;

        INDEX i,cRows = 0;
        HROW* rghRows = NULL;
        BOOL fOverWrite = FALSE;
        DBCOUNTITEM cRowsRefreshed = 0;
        HROW* rghRowsRefreshed = 0;
        DBROWSTATUS* rgRowStatus = NULL;
        INDEX* rgItems = NULL;

        //Get all selected Rows
        LV_GetSelItems(m_pCDataGrid->m_hWnd, &cRows, &rgItems, (LPARAM**)&rghRows);

        //IRowsetRefresh::RefreshVisibleData
        XTEST(hr = pCRowset->m_pIRowsetRefresh->RefreshVisibleData(hChapter, cRows, rghRows, fOverWrite, &cRowsRefreshed, &rghRowsRefreshed, &rgRowStatus));
        DisplayRowErrors(hr, cRowsRefreshed, rghRowsRefreshed, rgRowStatus);
        TRACE_METHOD(hr, L"IRowsetRefresh::RefreshVisibleData(0x%p, %lu, 0x%p, %d, &%lu, &0x%p, &0x%p)", hChapter, cRows, rghRows, fOverWrite, cRowsRefreshed, rghRowsRefreshed, rgRowStatus);

        //Now GetData for all SelectedRows (a nice helper)
        //We won't worry about updating the case for (0,NULL), its not worth
        //trying to match the rhgRows returned to the correct hRows.  Worse case
        //is the user has to call GetData for one or all rows...
        for(i=0; i<cRows; i++)
        {
          //Display the Data for this row...
          m_pCDataGrid->DisplayData(rghRows[i], rgItems[i]);
        }

        //Cleanup
        SAFE_FREE(rghRows);
        SAFE_FREE(rghRowsRefreshed);
        SAFE_FREE(rgRowStatus);
        SAFE_FREE(rgItems);
      }
      return TRUE;

    case IDM_GETORIGINALDATA:
      if(pCRowset && pCRowset->m_pIRowsetUpdate)
      {
        CWaitCursor waitCursor;

        INDEX cRows = 0;
        INDEX* rgItems = NULL;
        HROW* rghRows = NULL;

        //Find all Selected Rows
        LV_GetSelItems(m_pCDataGrid->m_hWnd, &cRows, &rgItems, (LPARAM**)&rghRows);
        if(cRows == 0)
        {
          wMessageBox(GetFocus(), MB_TASKMODAL | MB_ICONHAND | MB_OK | MB_DEFBUTTON1,
            wsz_ERROR, L"Must first select a row...");
        }

        for(INDEX i=0; i<cRows; i++)
        {
          //Display the Data for this row...
          m_pCDataGrid->DisplayData(rghRows[i], rgItems[i], DBPROP_IRowsetUpdate, true/*fAlways*/);
        }
        SAFE_FREE(rgItems);
        SAFE_FREE(rghRows);
      }
      return TRUE;

    case IDM_GETPENDINGROWS:
      if(pCRowset && pCRowset->m_pIRowsetUpdate)
      {
        CWaitCursor waitCursor;

        DBCOUNTITEM cPendingRows = 0;
        HROW* rgPendingRows = 0;
        DBPENDINGSTATUS* rgPendingStatus = NULL;

        //IRowsetUpdate::GetPendingStatus
        XTEST(hr = pCRowset->m_pIRowsetUpdate->GetPendingRows(hChapter, DBPENDINGSTATUS_NEW | DBPENDINGSTATUS_CHANGED | DBPENDINGSTATUS_DELETED, &cPendingRows, &rgPendingRows, &rgPendingStatus));
        TRACE_METHOD(hr, L"IRowsetUpdate::GetPendingRows(0x%p, DBPENDINGSTATUS_NEW | DBPENDINGSTATUS_CHANGED | DBPENDINGSTATUS_DELETED, &%lu, &0x%p, &0x%p)", hChapter, cPendingRows, rgPendingRows, rgPendingStatus);

        //Cleanup
        SAFE_FREE(rgPendingRows);
        SAFE_FREE(rgPendingStatus);
      }
      return TRUE;

    case IDM_GETROWSTATUS:
      if(pCRowset && pCRowset->m_pIRowsetUpdate)
      {
        CWaitCursor waitCursor;

        //Find the SelectedRow
        HROW hRow;
        if(m_pCDataGrid->GetSelectedRow(&hRow, FALSE) != LVM_ERR)
        {
          DBPENDINGSTATUS dwPendingStatus = 0;

          //IRowsetUpdate::GetRowStatus
          XTEST(hr = pCRowset->m_pIRowsetUpdate->GetRowStatus(hChapter, 1, &hRow, &dwPendingStatus));
          TRACE_METHOD(hr, L"IRowsetUpdate::GetRowStatus(0x%p, %lu, &0x%p, &0x%p)", hChapter, 1, hRow, dwPendingStatus);
        }
      }
      return TRUE;

    case IDM_UNDO:      //Cancel the chagnes that were made.
      if(pCRowset && pCRowset->m_pIRowsetUpdate)
      {
        CWaitCursor waitCursor;
        UndoChanges();
      }
      return TRUE;

    case IDM_UPDATE:      //Update the changes that were made.
      if(pCRowset && pCRowset->m_pIRowsetUpdate)
      {
        CWaitCursor waitCursor;
        UpdateChanges();
      }
      return TRUE;

    //IServiceProvider
    case IDM_ISERVICEPROVIDER:
      if(pCDataSource && pCDataSource->m_pIServiceProvider)
      {
        //Display the Generic interface list...
        CInterfaceDlg interfaceDlg(IDD_INTERFACE, L"IServiceProvider::QueryService", IID_ISpecifyPropertyPages);
        if(interfaceDlg.DoModal(hWnd) == IDOK)
        {
          CWaitCursor waitCursor;
          CComPtr<IUnknown> spUnknown;

          XTEST(hr = pCDataSource->m_pIServiceProvider->QueryService(OLEDB_SVC_DSLPropertyPages, interfaceDlg.GetSelInterface(), (void**)&spUnknown));
          TRACE_METHOD(hr, L"IServiceProvider::QueryService(OLEDB_SVC_DSLPropertyPages, %s, &0x%p)", GetInterfaceName(interfaceDlg.GetSelInterface()), spUnknown);
        }
      }
      return TRUE;

  };

  return FALSE;
}

BOOL CMDIChild::OnCreate ( LPCREATESTRUCT lpCreateStruct ) [virtual]

Definition at line 147 of file cmdichild.cpp.

{
  // create child windows
  // 1. ListView for rowset data
  // 2. EditBox for entering SQL Text
  // 3. ListBox for notifcations
  // 4. ScrollBar for scrolling through the rowset
  GetWindowPlacement();
  SIZE size = { m_wndPlacement.rcNormalPosition.right - m_wndPlacement.rcNormalPosition.left,
          m_wndPlacement.rcNormalPosition.bottom - m_wndPlacement.rcNormalPosition.top };

  //Create the SQL Query Box
  m_pCQueryBox->Create(m_hWnd, m_pCMainWindow->m_hLibRichEdit20 ? (IsUnicodeOS() ? L"RichEdit20W" : L"RichEdit20A") : L"RICHEDIT", NULL, IDC_EDITBOX,
    WS_TABSTOP | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_HSCROLL | WS_VSCROLL | ES_AUTOVSCROLL | ES_MULTILINE /* | ES_DISABLENOSCROLL | ES_SELECTIONBAR*/, 0,
    0, 0, size.cx, (INT)((float)size.cy * 0.25));
  m_pCQueryBox->OnCreate(NULL);
  m_pCQueryBox->SetWordWrap(TRUE);

  //By default the RichEdit controls have a HUGE text.  Instead of setting it
  //to a small size font which is difficult for some international lcids, we will
  //set it to the same font as the Tree control...
  m_pCQueryBox->SetFont(m_pCMainWindow->m_pCMDIObjects->m_pCObjTree->GetFont());

  //Create the DataGrid
  m_pCDataGrid->Create(m_hWnd, WC_LISTVIEWW, NULL, IDC_LISTVIEW,
    WS_TABSTOP | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | /*LVS_SINGLESEL |*/ LVS_AUTOARRANGE | LVS_REPORT | LVS_EDITLABELS | LVS_SHOWSELALWAYS, WS_EX_CLIENTEDGE,
    0, (INT)((float)size.cy * 0.25), size.cx - GetSystemMetrics(SM_CXVSCROLL), (INT)((float)size.cy * 0.75));
  m_pCDataGrid->EnableWindow(FALSE);

  //Use Extended ListView Styles!
  SendMessage(m_pCDataGrid->m_hWnd, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE | LVS_EX_SUBITEMIMAGES, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE | LVS_EX_SUBITEMIMAGES);
  ListView_SetImageList(m_pCDataGrid->m_hWnd, ImageList_LoadImage(GetAppLite()->m_hInstance, MAKEINTRESOURCE(IDB_IMAGE), 16, 16, CLR_DEFAULT , IMAGE_BITMAP, LR_DEFAULTCOLOR), LVSIL_SMALL);
  m_pCDataGrid->OnCreate(NULL);
  m_pCDataGrid->ClearAll(L"No Rowset");

  //Set Focus to the Query Box
  m_pCQueryBox->SetFocus();

  //Setup Splitter Windows...
  m_pCQueryBox->SetSplitter(NULL, m_pCDataGrid, NULL, NULL);
  m_pCDataGrid->SetSplitter(m_pCQueryBox, NULL, NULL, NULL);

  //Load Saved Window Positions
  if(m_iChildWindow == 1)
  {
    memset(&m_wndPlacement, 0, sizeof(m_wndPlacement));
    GetRegEntry(HKEY_ROWSETVIEWER, wszMDICHILD_KEY, L"WinPosition", &m_wndPlacement, sizeof(m_wndPlacement), NULL);

    //Window Position
    AutoPosition(m_wndPlacement.length == 0/*fDefaultPosition*/);
  }

  return TRUE;
}

BOOL CMDIChild::OnDestroy ( ) [virtual]

Reimplemented from CWndLite.

Definition at line 371 of file cmdichild.cpp.

{
  //Save the Query in the Query Box (before exiting)
  if(m_pCQueryBox && m_pwszConfig)
  {
    WCHAR* pwszQuery = m_pCQueryBox->GetWindowText();

    //Formulate the key
    static WCHAR wszKeyName[MAX_NAME_LEN];
    StringFormat(wszKeyName, NUMELE(wszKeyName), L"%s\\%s\\Command", wszCONFIG_KEY, m_pwszConfig);

    //Save the Query
    SetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"Query",  pwszQuery);
    SAFE_FREE(pwszQuery);
  }

  //Save Window Positions
  if(m_iChildWindow == 1)
  {
    //Window Positions
    if(GetWindowPlacement())
      SetRegEntry(HKEY_ROWSETVIEWER, wszMDICHILD_KEY, L"WinPosition", &m_wndPlacement,  sizeof(m_wndPlacement));
  }

  //Delegate
  return CMDIChildLite::OnDestroy();
}

BOOL CMDIChild::OnInitialUpdate ( ) [virtual]

Reimplemented from CWndLite.

Definition at line 207 of file cmdichild.cpp.

{
    //Update Window Title
  UpdateWndTitle();
  return TRUE;
}

BOOL CMDIChild::OnMDIActivate | ( | BOOL | bActivate,
 |  | HWND | hWndActivate,
 |  | HWND | hWndDeactivate |
 | ) |  |  | [virtual]

Reimplemented from CMDIChildLite.

Definition at line 404 of file cmdichild.cpp.

{
  //So see if this window is being activated or deactivated
  if(hWndActivate == m_hWnd)
  {
    CObjTree* pCObjTree = m_pCMainWindow->m_pCMDIObjects->m_pCObjTree;
    ASSERT(pCObjTree);

    //Select the Object in Tree that this Window corresponds to...
    //NOTE: If there is already an object selected that belongs to this
    //window, then there is no need to switch the objects
    CBase* pCObject = pCObjTree->GetSelectedObject();
    if(!pCObject || (pCObject->m_pCMDIChild != this))
      pCObjTree->SelectObject(GetObject());

    //Refresh all Controls
    UpdateControls();
  }

  return TRUE;
}

BOOL CMDIChild::OnNotify | ( | INT | idCtrl,
 |  | NMHDR * | pNMHDR |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 277 of file cmdichild.cpp.

{
  //CDataGrid
  if(m_pCDataGrid->OnNotify(idCtrl, pNMHDR))
    return TRUE;

  //CQueryBox
  if(m_pCQueryBox->OnNotify(idCtrl, pNMHDR))
    return TRUE;

  //Delegate
  return CMDIChildLite::OnNotify(idCtrl, pNMHDR);
}

BOOL CMDIChild::OnSetFocus ( HWND hWndPrevFocus ) [virtual]

Reimplemented from CWndLite.

Definition at line 430 of file cmdichild.cpp.

{
  m_pCQueryBox->SetFocus();
  return TRUE;
}

BOOL CMDIChild::OnSize | ( | WPARAM | nType,
 |  | REFPOINTS | pts |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 307 of file cmdichild.cpp.

{
  ASSERT(m_pCDataGrid->m_hWnd);
  ASSERT(m_pCQueryBox->m_hWnd);

  switch(nType)
  {
    case SIZE_RESTORED:
    case SIZE_MAXIMIZED:
    {
      if(pts.x && pts.y)
      {
        //Obtain window sizes...
        SIZE sizeEditBox  = GetWindowSize(m_pCQueryBox->m_hWnd);
        SIZE sizeListView = GetWindowSize(m_pCDataGrid->m_hWnd);

        //The MainWindow has been resized, we need to readjust all
        //Child controls, (ScrollBar, ListBox, ListView...)
        //Move Windows with respect to the new

        switch(m_lastSizedEdge)
        {
          //Top was moved, resize the Editbox
          case WMSZ_TOP:
          case WMSZ_TOPLEFT:
          case WMSZ_TOPRIGHT:
            sizeEditBox.cy = max(0, pts.y - sizeListView.cy);
            break;
        }

        MoveWindow(m_pCQueryBox->m_hWnd, 0, 0, pts.x, sizeEditBox.cy, TRUE);
        MoveWindow(m_pCDataGrid->m_hWnd, 0, sizeEditBox.cy, pts.x, pts.y-sizeEditBox.cy, TRUE);
        m_lastSizedEdge = 0;
      }

      //Call default procedure first,
      //to let MDI position the child & then move its children
      //We simply do this by returning false, to indicate we didn't handle it...
      return FALSE;
    }
  };

  return FALSE;
}

BOOL CMDIChild::OnSizing | ( | WPARAM | nSide,
 |  | REFPOINTS | pts |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 296 of file cmdichild.cpp.

{
  //Record which edge was touched...
  m_lastSizedEdge = nSide;
  return TRUE;
}

BOOL CMDIChild::OnUpdateCommand | ( | HMENU | hMenu,
 |  | UINT | nID,
 |  | DWORD * | pdwFlags |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 251 of file cmdichild.cpp.

{
  //Default
  switch(nID)
  {
    //Edit Window
    ON_COMMAND_UI_ENABLED(IDM_PASTEEDITWINDOW,        m_pCQueryBox->CanPaste())
    ON_COMMAND_UI_ENABLED(IDM_CLEAREDITWINDOW,        TRUE)

    //Cut/Copy is only enabled - if something is selected.
    ON_COMMAND_UI_ENABLED(IDM_COPYEDITWINDOW,       m_pCQueryBox->GetSel(NULL, NULL))
    ON_COMMAND_UI_ENABLED(IDM_CUTEDITWINDOW,        m_pCQueryBox->GetSel(NULL, NULL))

    //Menu Items that are always on
    ON_COMMAND_UI_ENABLED(IDM_PROVIDERINFO,         TRUE)
    ON_COMMAND_UI_ENABLED(IDM_BROWSE_TABLENAME,       TRUE)
  };

  return FALSE;
}

INT_PTR WINAPI CMDIChild::OpenRowsetProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 6254 of file cmdichild.cpp.

{
  static CComboBoxGuid    s_CComboInterface;
  static CRichEditLite    s_editTableID;
  static CRichEditLite    s_editIndexID;

  static BOOL fUseProps   = TRUE;     //Default
  static BOOL fAggregation  = FALSE;    //Default
  static BOOL fOutput     = TRUE;     //Default

  switch(message)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;

      //Save the "this" pointer
      CMDIChild* pThis = (CMDIChild*)SetThis(hWnd, (void*)lParam);

      //Window Title (Default is IOpenRowset::OpenRowset)
      if(pThis->m_idSource == IDM_ISCOPEDOPERATIONS_OPENROWSET)
                ::SetWindowText(hWnd, "IScopedOperations::OpenRowset");

      //Fill In TableID as Default
      s_editTableID.CreateIndirect(hWnd, IDE_TABLEID);
      WCHAR* pwszTableName = pThis->m_pCQueryBox->GetSelectedText();
      s_editTableID.SetWindowText(pwszTableName);

      //Fill in IndexID as default
      s_editIndexID.CreateIndirect(hWnd, IDE_INDEXID);

      //Use Properties
            ::CheckDlgButton(hWnd, IDB_USEPROPERTIES,  BST2STATE(fUseProps));

      //Aggregation
            ::CheckDlgButton(hWnd, IDB_AGGREGATION,    BST2STATE(fAggregation));

      //Output (ppIUnknown)
            ::CheckDlgButton(hWnd, IDB_OUTPUT,     BST2STATE(fOutput));

      //Interface List...
      s_CComboInterface.CreateIndirect(hWnd, IDC_INTERFACE);
      s_CComboInterface.Populate(g_cInterfaceMaps, g_rgInterfaceMaps);
      if(s_CComboInterface.RestoreSelection() == CB_ERR)
        s_CComboInterface.SetGuid(IID_IRowset);

      SAFE_FREE(pwszTableName);
      CenterDialog(hWnd);
      return TRUE;
    }

    case WM_COMMAND:
    {
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDB_SETPROPERTIES:
        {
          //Get the "this" pointer
          CMDIChild* pThis      = (CMDIChild*)GetThis(hWnd);
          CMainWindow* pCMainWindow = pThis->m_pCMainWindow;
          CDataSource* pCDataSource = SOURCE_GETPARENT(pThis->m_pCSource, CDataSource);

          CPropertiesDlg sCPropertiesDlg(pCMainWindow);
          sCPropertiesDlg.SetProperties(hWnd, &DBPROPSET_ROWSETALL, IID_IRowsetInfo, NULL, pCDataSource ? pCDataSource->m_pIDBProperties : NULL, &pThis->m_CDefPropSets);
          return 0;
        }

        case IDB_AGGREGATION:
        {
          //Aggregation Combo Selection has changed...
          //If we are now using Aggregation, automatically change the requested
          //riid to IID_IUnknown, since its an error otherwise...
          if(::IsDlgButtonChecked(hWnd, IDB_AGGREGATION))
            s_CComboInterface.SetGuid(IID_IUnknown);
          return 0;
        }

        case IDOK:
        {
          CWaitCursor waitCursor;

          //Get the "this" pointer
          CMDIChild* pThis = (CMDIChild*)GetThis(hWnd);
          CSession* pCSession = SOURCE_GETOBJECT(pThis->m_pCSource, CSession);
          CRow* pCRow     = SOURCE_GETOBJECT(pThis->m_pCSource, CRow);

          IUnknown* pIUnknown = NULL;
          HRESULT hr = S_OK;

          ULONG cPropSets = 0;
          DBPROPSET* rgPropSets = NULL;

          //Obtain the Aggregation argument
          CAggregate* pCAggregate = NULL;
          fAggregation = ::IsDlgButtonChecked(hWnd, IDB_AGGREGATION);
          if(fAggregation)
            pCAggregate = new CAggregate();

          //Obtain the Output (ppIUnknown) argument
          fOutput = ::IsDlgButtonChecked(hWnd, IDB_OUTPUT);

          //Interface
          REFIID riid = s_CComboInterface.GetGuid();

          //TableID
          CComWSTR cstrTableName;
          cstrTableName.Attach(s_editTableID.GetWindowText());

          DBID TableID;
          TableID.eKind = DBKIND_NAME;
          TableID.uName.pwszName = cstrTableName;
          DBID* pTableID = cstrTableName ? &TableID : NULL;

          //IndexID
          //NOTE: Most providers don't support IndexIDs and fail if a non-NULL pointer is
          //passed in, so unless the user specified something just use NULL...
          CComWSTR cstrIndexName;
          cstrIndexName.Attach(s_editIndexID.GetWindowText());

          DBID IndexID;
          IndexID.eKind = DBKIND_NAME;
          IndexID.uName.pwszName = cstrIndexName;
          DBID* pIndexID = cstrIndexName ? &IndexID : NULL;

          //Use Properties
          fUseProps = ::IsDlgButtonChecked(hWnd, IDB_USEPROPERTIES);
          if(fUseProps)
          {
            cPropSets = pThis->m_CDefPropSets.GetCount();
            rgPropSets = pThis->m_CDefPropSets.GetPropSets();
          }

          //OpenRowset
          ASSERT(pCSession || pCRow);
          if(pCSession)
            hr = pCSession->OpenRowset(pCAggregate, pTableID, pIndexID, riid, cPropSets, rgPropSets, fOutput ? &pIUnknown : NULL);
          else
            hr = pCRow->OpenRowset(pCAggregate, pTableID, pIndexID, riid, cPropSets, rgPropSets, fOutput ? &pIUnknown : NULL);

          if(SUCCEEDED(hr))
          {
            //Create an object description from the TableName (and index if used)
            //1.  TableName only    - "TableName"
            //2.  TableName and Index - "TableName.IndexName"
            //3.  IndexName only    - "IndexName"
            CComWSTR cstrDesc;
            cstrDesc.CopyFrom(cstrTableName);
            if(cstrIndexName)
            {
              if(cstrTableName)
                cstrDesc += L".";
              cstrDesc += cstrIndexName;
            }

            //Delegate to display the object
            hr = pThis->HandleRowset(pThis->m_pCSource, pIUnknown, riid, CREATE_NEWWINDOW_IFEXISTS, pCSession ? IID_IOpenRowset : IID_IScopedOperations, cstrDesc);
          }

          if(SUCCEEDED(hr))
          {
            //Now just need to place this name in the EditBox
            //Inserted after the current "caret"
            pThis->m_pCQueryBox->ReplaceAll(cstrTableName, FALSE/*bReplaceAll*/, TRUE/*fHighlight*/);
            EndDialog(hWnd, TRUE);
          }

          SAFE_RELEASE(pCAggregate);
          SAFE_RELEASE(pIUnknown);
          return 0;
        }

        case IDCANCEL:
        {
          EndDialog(hWnd, FALSE);
          return 0;
        }
      }
      break;
    }//WM_COMMAND
  }

  return FALSE;
}

INT_PTR WINAPI CMDIChild::ProviderInfoProc | ( | HWND | hWnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 9958 of file cmdichild.cpp.

{
  switch (message)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;

      CMDIChild* pThis = (CMDIChild*)SetThis(hWnd, (void*)lParam);
      CComBSTR cstrString;
      CComBSTR cstrString2;
      DWORD dwValue = 0;

      //Determine which object were on...
      IDBProperties* pIDBProperties = SOURCE_GETINTERFACE(pThis->m_pCSource, IDBProperties);
      if(pIDBProperties)
      {
        //DBPROP_PROVIDERFILENAME
        GetProperty(IID_IDBProperties, pIDBProperties, DBPROP_PROVIDERFILENAME,   DBPROPSET_DATASOURCEINFO, DBTYPE_BSTR, &cstrString);
        wSendMessage(::GetDlgItem(hWnd, IDT_PROVIDERFILENAME), WM_SETTEXT, 0, cstrString ? cstrString : L"");
        cstrString.Empty();

        //DBPROP_PROVIDERFRIENDLYNAME
        GetProperty(IID_IDBProperties, pIDBProperties, DBPROP_PROVIDERFRIENDLYNAME, DBPROPSET_DATASOURCEINFO, DBTYPE_BSTR, &cstrString);
        wSendMessage(::GetDlgItem(hWnd, IDT_PROVIDERDESC), WM_SETTEXT, 0, cstrString ? cstrString : L"");
        cstrString.Empty();

        //DBPROP_PROVIDERVER
        GetProperty(IID_IDBProperties, pIDBProperties, DBPROP_PROVIDERVER,  DBPROPSET_DATASOURCEINFO, DBTYPE_BSTR, &cstrString);
        //DBPROP_PROVIDEROLEDBVER
        GetProperty(IID_IDBProperties, pIDBProperties, DBPROP_PROVIDEROLEDBVER, DBPROPSET_DATASOURCEINFO, DBTYPE_BSTR, &cstrString2);
        wSendMessageFmt(::GetDlgItem(hWnd, IDT_PROVIDERVERSION), WM_SETTEXT, 0, L"Prov - %s   OLEDB - %s", cstrString ? cstrString : L"Unknown", cstrString2 ? cstrString2 : L"Unknown");
        cstrString.Empty();
        cstrString2.Empty();

        //DBMS / DBMSVER
        GetProperty(IID_IDBProperties, pIDBProperties, DBPROP_DBMSNAME, DBPROPSET_DATASOURCEINFO, DBTYPE_BSTR, &cstrString);
        GetProperty(IID_IDBProperties, pIDBProperties, DBPROP_DBMSVER,  DBPROPSET_DATASOURCEINFO, DBTYPE_BSTR, &cstrString2);
        wSendMessageFmt(::GetDlgItem(hWnd, IDT_DBMS), WM_SETTEXT, 0, L"%s %s", cstrString ? cstrString : L"", cstrString2 ? cstrString2 : L"");
        cstrString.Empty();
        cstrString2.Empty();

        //DATASOURCE
        GetProperty(IID_IDBProperties, pIDBProperties, DBPROP_DATASOURCENAME, DBPROPSET_DATASOURCEINFO, DBTYPE_BSTR, &cstrString);
        wSendMessage(::GetDlgItem(hWnd, IDT_DATASOURCE), WM_SETTEXT, 0, cstrString ? cstrString : L"");
        cstrString.Empty();

        //DBPROP_DATASOURCEREADONLY
        VARIANT_BOOL bReadOnly = VARIANT_FALSE;
        GetProperty(IID_IDBProperties, pIDBProperties, DBPROP_DATASOURCEREADONLY, DBPROPSET_DATASOURCEINFO, DBTYPE_BOOL, &bReadOnly);
        SendMessage(::GetDlgItem(hWnd, IDT_READONLY), WM_SETTEXT, 0, bReadOnly ? (LPARAM)"Read-Only" : (LPARAM)"Updatable");

        //DBPROP_CURRENTCATALOG
        GetProperty(IID_IDBProperties, pIDBProperties, DBPROP_CURRENTCATALOG,   DBPROPSET_DATASOURCE, DBTYPE_BSTR, &cstrString);
        wSendMessage(::GetDlgItem(hWnd, IDT_CATALOG), WM_SETTEXT, 0, cstrString);
        cstrString.Empty();

        //DBPROP_DSOTHREADMODEL
        GetProperty(IID_IDBProperties, pIDBProperties, DBPROP_DSOTHREADMODEL,   DBPROPSET_DATASOURCEINFO, DBTYPE_I4, &dwValue);
        SendMessage(::GetDlgItem(hWnd, IDT_THREADMODEL), WM_SETTEXT, 0, (LPARAM)(dwValue & DBPROPVAL_RT_FREETHREAD ? "FreeThreaded" : dwValue & DBPROPVAL_RT_APTMTTHREAD ? "ApartmentModel" : dwValue & DBPROPVAL_RT_SINGLETHREAD ? "SingleThreaded" : "Unknown"));
      }

      CenterDialog(hWnd);
      return TRUE;
    }

    case WM_COMMAND:
    {
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDOK:
        case IDCANCEL:
        {
          CWaitCursor waitCursor;
          EndDialog(hWnd, TRUE);
          return TRUE;
        }
      }
      break;
    }//WM_COMMAND
  }

  return FALSE;
}

INT_PTR WINAPI CMDIChild::ReleaseTransaction | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 5922 of file cmdichild.cpp.

{
  switch(message)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;

      //Save the "this" pointer
      CMDIChild*    pThis       = (CMDIChild*)SetThis(hWnd, (void*)lParam);

      //Need to fill in the Txn ComboBox
      pThis->SetupTransactionCombo(::GetDlgItem(hWnd, IDC_TRANSACTION));

      CenterDialog(hWnd);
      return TRUE;
    }

    case WM_COMMAND:
    {
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDOK:
        {
          CWaitCursor waitCursor;

          //Get the "this" pointer
          CMDIChild*    pThis       = (CMDIChild*)GetThis(hWnd);

          HWND      hWndTransaction   = ::GetDlgItem(hWnd, IDC_TRANSACTION);
          ITransaction* pITransaction   = NULL;

          //get the ITransactionPointer
          INDEX iSel = (INDEX)SendMessage(hWndTransaction, CB_GETCURSEL, 0, 0);
          if(iSel != CB_ERR)
            pITransaction = (ITransaction*)SendMessage(hWndTransaction, CB_GETITEMDATA, iSel, 0);

          if(pITransaction)
          {
            //Remove from list
            POSITION iPos = pThis->m_pCMainWindow->m_listTransactions.Find(pITransaction);
            pThis->m_pCMainWindow->m_listTransactions.RemoveAt(iPos);

            //ITransaction::Release
            TRACE_RELEASE(pITransaction, L"ITransaction");
          }

          EndDialog(hWnd, TRUE);
          return 0;
        }

        case IDCANCEL:
        {
          EndDialog(hWnd, FALSE);
          return 0;
        }
      }
      break;
    }//WM_COMMAND
  }
  return FALSE;
}

INT_PTR WINAPI CMDIChild::RowChangeProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 2444 of file cmdichild.cpp.

{
  static BOOL bBeginEdit  = FALSE;
  static BOOL s_bClearAll = TRUE;
  static CListViewLite  s_listNames;
  static CListViewLite  s_listValue;

  switch(message)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;
      bBeginEdit = FALSE;

      //Save the "this" pointer
      CMDIChild* pThis  = (CMDIChild*)SetThis(hWnd, (void*)lParam);

      DWORD dwConvFlags = pThis->GetOptions()->m_dwConvFlags;
      HRESULT hr = S_OK;

      WCHAR   wszBuffer[MAX_COL_SIZE+1];
      DBCOUNTITEM iBind = 0;
      DBLENGTH  dbLength = 0;
      DBSTATUS  dbStatus = DBSTATUS_S_OK;//DBSTATUS_S_ISNULL;
      DBTYPE    wSubType = 0;

      //We need to bring up a 2 ListViews.
      //left - has column names,
      //right - is blank for entering data for the corrsponding column

      //Setup column headers
      s_listNames.CreateIndirect(hWnd, IDL_NAMES);
      s_listValue.CreateIndirect(hWnd, IDL_VALUES);
      s_bClearAll = TRUE;

      //SubClass the ListViews.
      SynchSubProc(s_listNames.m_hWnd, WM_INITDIALOG, 0, (LPARAM)s_listValue.m_hWnd);
      SynchSubProc(s_listValue.m_hWnd, WM_INITDIALOG, 0, (LPARAM)s_listNames.m_hWnd);

      //Use Extended ListView Styles!
      SendMessage(s_listNames.m_hWnd, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE | LVS_EX_CHECKBOXES, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE | LVS_EX_CHECKBOXES);
      SendMessage(s_listValue.m_hWnd, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE);

      //Set image list to the ListView
      ListView_SetImageList(s_listNames.m_hWnd, ImageList_LoadImage(GetAppLite()->m_hInstance, MAKEINTRESOURCE(IDB_IMAGE), 16, 16, CLR_DEFAULT , IMAGE_BITMAP, LR_DEFAULTCOLOR), LVSIL_SMALL);
      ListView_SetImageList(s_listNames.m_hWnd, ImageList_LoadImage(GetAppLite()->m_hInstance, MAKEINTRESOURCE(IDB_STATE), 16, 16, CLR_DEFAULT , IMAGE_BITMAP, LR_DEFAULTCOLOR), LVSIL_STATE);
      ListView_SetImageList(s_listValue.m_hWnd, ImageList_LoadImage(GetAppLite()->m_hInstance, MAKEINTRESOURCE(IDB_IMAGE), 16, 16, CLR_DEFAULT , IMAGE_BITMAP, LR_DEFAULTCOLOR), LVSIL_SMALL);

      //Insert Column Headers
      s_listNames.InsertColumn(0, L"Column");
      s_listNames.InsertColumn(1, L"Length");
      s_listNames.InsertColumn(2, L"Status");
      s_listNames.InsertColumn(3, L"Type");
      s_listNames.InsertColumn(4, L"SubType");
      s_listValue.InsertColumn(0, L"Data");

      //Obtain the data for the selected row
      HROW hRow = NULL;

      //Determine the object type
      CRow* pCRow         = SOURCE_GETOBJECT(pThis->m_pCSource, CRow);
      CRowset* pCRowset     = SOURCE_GETOBJECT(pThis->m_pCSource, CRowset);
      CDataset* pCDataset     = SOURCE_GETOBJECT(pThis->m_pCSource, CDataset);
      CDataAccess* pCDataAccess = SOURCE_GETOBJECT(pThis->m_pCSource, CDataAccess);
      CDataGrid* pCDataGrid   = pThis->m_pCDataGrid;
      void* pData         = NULL;

      //Determine how to get the data...
      if(pCRow)
      {
        //Row Object (extra columns)
        hr = pCRow->GetColumns(pCRow->m_cColAccess, pCRow->m_rgColAccess);
        pData = pCDataAccess->m_pData;
      }
      else if(pCDataset)
      {
        //Dataset Object
        hr = pCDataset->GetCellData(pCDataGrid->m_iSelRow, pCDataGrid->m_iSelRow);
        pData = pCDataAccess->m_pData;
      }
      else if(pCRowset)
      {
        //Rowset
        //Obtain the selected row...
        if(pCDataGrid->m_iSelRow != LVM_ERR)
          hRow = pCDataGrid->GetItemParam(pCDataGrid->m_iSelRow);

        //NOTE:  If the user has released the row handle, and then called
        //insert row, selecting this row handle, since of erroring out we will just not
        //provide the default row of data to insert...
        if(hRow || pThis->m_idSource != IDM_INSERTROW)
        {
          hr = pCRowset->GetData(hRow);
          pData = pCDataAccess->m_pData;
        }
      }

      //Relax the errors here.  With Get*Data both DB_S/DB_E will return a bad
      //status for 1 or more columns.  Or DataGrid will just display the column
      //status if not S_OK.  So for these errors just display the data anyway...
      if(FAILED(hr) && hr!= DB_E_ERRORSOCCURRED)
        goto CLEANUP2;
      hr = S_OK;  //Otherwise dialog is not displayed

      //Display ColumnNames in LeftPane, and data in the right pane
      for(iBind=0; iBind<pCDataAccess->m_Bindings.GetCount(); iBind++)
      {
        //Get the Length, Status, Data for this Column
        const DBBINDING* pBinding   = &pCDataAccess->m_Bindings[iBind];
        const DBCOLUMNINFO* pColInfo  = pCDataAccess->m_ColumnInfo.GetOrdinal(pBinding->iOrdinal);
        wszBuffer[0] = wEOL;

        //Obtain the Data...
        if(pData)
          pCDataAccess->GetColumnData(pBinding, pData, &dbStatus, &dbLength, &wSubType, wszBuffer, MAX_COL_SIZE, dwConvFlags, pColInfo->wType);

        //Insert the Data into the list (make an "easy" edit)
        s_listValue.InsertItem(iBind, 0, wszBuffer, (LPARAM)pColInfo->wType, pCDataAccess->GetColumnImage(pColInfo, dbStatus));

        //Insert the ColumnName
        s_listNames.InsertItem(iBind, 0, GetColName(pColInfo));

        //Insert the Length into the List
        if(LENGTH_IS_BOUND(*pBinding))
          StringFormat(wszBuffer, NUMELE(wszBuffer), L"%lu", dbLength);
        else
          StringCopy(wszBuffer, L"Not Bound", MAX_COL_SIZE);
        s_listNames.InsertItem(iBind, 1, wszBuffer);

        //Insert the Status into the List
        s_listNames.InsertItem(iBind, 2, STATUS_IS_BOUND(*pBinding) ? GetStatusName(dbStatus) : L"Not Bound");

        //Insert the Type into the List
        s_listNames.InsertItem(iBind, 3, GetDBTypeName(pColInfo->wType));

        //Insert the SubType into the List
        if(wSubType || pColInfo->wType == VT_VARIANT)
          s_listNames.InsertItem(iBind, 4, GetVariantTypeName(wSubType));

        //Set Item State to Checked/Unchecked
        s_listNames.SetItemState(iBind, 0,  INDEXTOSTATEIMAGEMASK(pColInfo->dwFlags & (DBCOLUMNFLAGS_WRITE|DBCOLUMNFLAGS_WRITEUNKNOWN) ? STATE_CHECKED : STATE_UNCHECKED),  LVIS_STATEIMAGEMASK);
      }

      //Update Controls
            ::EnableWindow(::GetDlgItem(hWnd, IDB_CLEARALL), (pCRowset && pCRowset->m_pIRowsetChange) || (pCRow && pCRow->m_pIRowChange));

      //Update Title and Status
      switch(pThis->m_idSource)
      {
        case IDM_IROW_DELETECOLUMNS:
          if(pCRow && pCRow->m_pIRowSchemaChange)
          {
            SendMessage(hWnd, WM_SETTEXT, 0, (LPARAM)"IRowSchemaChange::DeleteColumns");
            SendMessage(::GetDlgItem(hWnd, IDT_HELPMSG), WM_SETTEXT, 0, (LPARAM)"Deletes the desired columns from the row object");
            SendMessage(::GetDlgItem(hWnd, IDOK), WM_SETTEXT, 0, (LPARAM)"Delete");
                        ::EnableWindow(::GetDlgItem(hWnd, IDB_CLEARALL), TRUE);
          }
          break;

        case IDM_IROW_SETCOLUMNS:
          if(pCRow && pCRow->m_pIRowChange)
          {
            SendMessage(hWnd, WM_SETTEXT, 0, (LPARAM)"IRowChange::SetColumns");
            SendMessage(::GetDlgItem(hWnd, IDT_HELPMSG), WM_SETTEXT, 0, (LPARAM)"Modifies the row object columns");
            SendMessage(::GetDlgItem(hWnd, IDOK), WM_SETTEXT, 0, (LPARAM)"SetColumns");
                        ::EnableWindow(::GetDlgItem(hWnd, IDB_CLEARALL), TRUE);
          }
          break;

        case IDM_INSERTROW:
          if(pCRowset && pCRowset->m_pIRowsetChange)
          {
            SendMessage(hWnd, WM_SETTEXT, 0, (LPARAM)"IRowsetChange::InsertRow");
            SendMessage(::GetDlgItem(hWnd, IDT_HELPMSG), WM_SETTEXT, 0, (LPARAM)"Inserts the desired row of data into the Rowset");
            SendMessage(::GetDlgItem(hWnd, IDOK), WM_SETTEXT, 0, (LPARAM)"InsertRow");
                        ::EnableWindow(::GetDlgItem(hWnd, IDB_CLEARALL), TRUE);
          }
          break;

        case IDM_SETDATA:
          if(pCRowset && pCRowset->m_pIRowsetChange)
          {
            SendMessage(hWnd, WM_SETTEXT, 0, (LPARAM)"IRowsetChange::SetData");
            SendMessage(::GetDlgItem(hWnd, IDT_HELPMSG), WM_SETTEXT, 0, (LPARAM)"Modifies the row data in the Rowset");
            SendMessage(::GetDlgItem(hWnd, IDOK), WM_SETTEXT, 0, (LPARAM)"SetData");
                        ::EnableWindow(::GetDlgItem(hWnd, IDB_CLEARALL), TRUE);
          }
          break;

        default:
          //NOTE: The Dialog is already setup with the default window text:
          //"Detailed Row Information"
                    ::EnableWindow(::GetDlgItem(hWnd, IDB_CLEARALL), FALSE);
          break;
      };

      //Free outofline data
      //TODO - need to free in the case of errors as well.  But have to be careful
      //since the pData may not have been setup yet, or other errors where its undefined...
      if(pData)
        pCDataAccess->m_Bindings.FreeData(pData);

    CLEANUP2:

      //AutoSize Columns
      for(iBind=0; iBind<=4; iBind++)
        s_listNames.SetColumnWidth(iBind, LVSCW_AUTOSIZE_USEHEADER);
      s_listValue.SetColumnWidth(0, LVSCW_AUTOSIZE_USEHEADER);
      CenterDialog(hWnd);

      if(FAILED(hr))
        EndDialog(hWnd, FALSE);
      return TRUE;
    }

    case WM_COMMAND:
    {
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
        break;

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDB_CLEARALL:
        {
          //Get the "this" pointer
          CWaitCursor waitCursor;

          //Now that the user has selected to clear all columns, we need to loop through
          //all the checked columns and just uncheck them...
          INDEX cItems = s_listNames.GetItemCount();
          for(INDEX i=0; i<cItems; i++)
          {
            //Check the property state
            s_listNames.SetItemState(i, 0,  INDEXTOSTATEIMAGEMASK(s_bClearAll ? STATE_UNCHECKED : STATE_CHECKED),  LVIS_STATEIMAGEMASK);
          }

          //Clear All is a toggle...
          if(s_bClearAll)
          {
            s_bClearAll = FALSE;
                        ::SetWindowText(::GetDlgItem(hWnd, IDB_CLEARALL), "SelectAll");
          }
          else
          {
            s_bClearAll = TRUE;
                        ::SetWindowText(::GetDlgItem(hWnd, IDB_CLEARALL), "ClearAll");
          }
          return 0;
        }

        case IDM_DBSTATUS_S_OK:
        {
          //Insert the Status into the List
          INDEX iSelRow = s_listNames.GetNextItem(-1, LVNI_SELECTED);
          if(iSelRow == LVM_ERR)
            return 0;

          s_listNames.InsertItem(iSelRow, 2, L"DBSTATUS_S_OK");
          return 0;
        }

        case IDM_DBSTATUS_S_ISNULL:
        {
          //Insert the Status into the List
          INDEX iSelRow = s_listNames.GetNextItem(-1, LVNI_SELECTED);
          if(iSelRow == LVM_ERR)
            return 0;

          s_listNames.InsertItem(iSelRow, 2, L"DBSTATUS_S_ISNULL");
          return 0;
        }

        case IDM_DBSTATUS_S_DEFAULT:
        {
          //Insert the Status into the List
          INDEX iSelRow = s_listNames.GetNextItem(-1, LVNI_SELECTED);
          if(iSelRow == LVM_ERR)
            return 0;

          s_listNames.InsertItem(iSelRow, 2, L"DBSTATUS_S_DEFAULT");
          return 0;
        }

        case IDM_DBSTATUS_S_IGNORE:
        {
          //Insert the Status into the List
          INDEX iSelRow = s_listNames.GetNextItem(-1, LVNI_SELECTED);
          if(iSelRow == LVM_ERR)
            return 0;

          s_listNames.InsertItem(iSelRow, 2, L"DBSTATUS_S_IGNORE");
          return 0;
        }

        case IDM_DISPLAY_HEX:
        {
          WCHAR wszBuffer[MAX_COL_SIZE+1]={0};

          //Find the Selected Row
          INDEX iSelRow = s_listValue.GetNextItem(-1, LVNI_SELECTED);
          if(iSelRow == LVM_ERR)
            return 0;

          //Get the Text from the Row
          s_listValue.GetItemText(iSelRow, 0, wszBuffer, MAX_COL_SIZE);

          //Convert using the Requested converions
          if(SUCCEEDED(PostProcessString(wszBuffer, MAX_COL_SIZE, CONV_HEX)))
          {
            //Insert the Data into the list (make an "easy" edit)
            s_listValue.SetItemText(iSelRow, 0, wszBuffer);
          }
          return 0;
        }

        case IDOK:
        {
          CWaitCursor waitCursor;

          //Get the "this" pointer
          CMDIChild* pThis  = (CMDIChild*)GetThis(hWnd);
          HRESULT hr = S_OK;

          ULONG i=0;
          HROW hRow = NULL;
          INDEX iSelItems = 0;

          ULONG cColumnIDs = 0;
          DBID* rgColumnIDs = NULL;
          DBSTATUS* rgStatus = NULL;

          //Determine the object type
          CRow* pCRow         = SOURCE_GETOBJECT(pThis->m_pCSource, CRow);
          CRowset* pCRowset     = SOURCE_GETOBJECT(pThis->m_pCSource, CRowset);
          CDataAccess* pCDataAccess = SOURCE_GETOBJECT(pThis->m_pCSource, CDataAccess);
          CDataGrid* pCDataGrid   = pThis->m_pCDataGrid;

          CBindings& rBindings    = pCDataAccess->m_Bindings;
          void* pData         = pCDataAccess->m_pData;

          //The ListView will produce IDOK if hitting return after entering
          //a value.  The easist way arround this is to just exit if
          //we haven't yet received the ENDEDIT message
          if(bBeginEdit || (!SOURCE_GETINTERFACE(pCRow, IRowChange) && !SOURCE_GETINTERFACE(pCRowset, IRowsetChange)))
            goto CLEANUP;

          //Create Accessor binding all selected columns...
          iSelItems = s_listNames.GetItemCount();
          ASSERT(iSelItems != LVM_ERR);

          if(pThis->m_idSource == IDM_IROW_DELETECOLUMNS)
          {
            SAFE_ALLOC(rgColumnIDs, DBID, iSelItems);
            SAFE_ALLOC(rgStatus, DBSTATUS, iSelItems);
          }

          //Obtain the ListView Values into our pData buffer
          //NOTE:  We do this before we filter the selected columns, since the dialog
          //contains all columns, and needs to be indexed in the same order,
          //without missing columns in the middle...
          TESTC(hr = pThis->GetListViewValues(s_listNames.m_hWnd, s_listValue.m_hWnd, pCDataAccess, rBindings, pData));

          //Loop through selected bindings
          for(i=0; i<rBindings.GetCount(); i++)
          {
            //Create compacted array of ColumnIDs for IRowSchemaChange::DeleteColumns
            if(pThis->m_idSource == IDM_IROW_DELETECOLUMNS)
            {
              //Get the Image and Param
              BOOL bChecked = s_listNames.GetItemState(i, LVIS_STATEIMAGEMASK) & INDEXTOSTATEIMAGEMASK(STATE_CHECKED);
              if(bChecked)
              {
                memcpy(&rgColumnIDs[cColumnIDs], &pCRow->m_rgColAccess[i].columnid, sizeof(DBID));
                rgStatus[cColumnIDs] = DBSTATUS_S_OK;
                cColumnIDs++;
              }
            }
          }

          switch(pThis->m_idSource)
          {
            case IDM_INSERTROW:
              if(pCRowset && pCRowset->m_pIRowsetChange)
              {
                HCHAPTER hChapter = pCRowset->m_hChapter;

                //Release previously fetched rows, (if user requested)
                hr = pCDataGrid->ReleaseHeldRows();

                //Now that we have setup the buffer, Insert the data into the rowset
                XTEST(hr = pCRowset->m_pIRowsetChange->InsertRow(hChapter, pCRowset->m_hAccessor, pData, &hRow));
                TRACE_METHOD(hr, L"IRowsetChange::InsertRow(0x%p, 0x%p, 0x%p, &0x%p)", hChapter, pCRowset->m_hAccessor, pData, hRow);

                //Display Data Errors
                TESTC(hr = DisplayBindingErrors(hr, rBindings.GetCount(), rBindings.GetElements(), pData));

                //Release the Retreived Row handle...
                //We could have just passed phRow = NULL, since we don't save the row handle,
                //but its nice for output/trace purposes so the user knows a handle
                //was received...

                //NOTE:  We don't insert the returned row handle into the ListView
                //since we are not sure where the row was inserted.  Inserting it blindly
                //at the end would appear as if the cursor positioning was oof with
                //GetNextRows if it was not truely inserted at the end.
                if(SUCCEEDED(hr))
                  pCRowset->ReleaseRows(1, &hRow);
              }
              break;

            case IDM_IROW_DELETECOLUMNS:
              if(pCRow && pCRow->m_pIRowSchemaChange)
              {
                //DeleteColumns
                XTEST(hr = pCRow->m_pIRowSchemaChange->DeleteColumns(cColumnIDs, rgColumnIDs, rgStatus));
                TRACE_METHOD(hr, L"IRowSchemaChange::DeleteColumns(%lu, 0x%p, 0x%p)", cColumnIDs, rgColumnIDs, rgStatus);

                //Display Data Errors
                TESTC(hr = DisplayColumnErrors(hr, cColumnIDs, rgColumnIDs, rgStatus));
              }
              break;

            case IDM_IROW_SETCOLUMNS:
              if(pCRow && pCRow->m_pIRowChange)
              {
                //Have to call SetColumns for extra columns
                XTEST(hr = pCRow->m_pIRowChange->SetColumns(pCRow->m_cColAccess, pCRow->m_rgColAccess));
                TRACE_METHOD(hr, L"IRowChange::SetColumns(%lu, 0x%p)", pCRow->m_cColAccess, pCRow->m_rgColAccess);

                //Display Data Errors
                TESTC(hr = DisplayColAccessErrors(hr, pCRow->m_cColAccess, pCRow->m_rgColAccess));
              }
              break;

            case IDM_SETDATA:
              if(pCRowset && pCRowset->m_pIRowsetChange)
              {
                //Need to obtain the Current hRow value (lParam)
                hRow = pCDataGrid->GetItemParam(pCDataGrid->m_iSelRow);

                //Now that we have setup the buffer, SetData into the rowset
                XTEST(hr = pCRowset->m_pIRowsetChange->SetData(hRow, pCRowset->m_hAccessor, pData));
                TRACE_METHOD(hr, L"IRowsetChange::SetData(0x%p, 0x%p, 0x%p)", hRow, pCRowset->m_hAccessor, pData);

                //Display Data Errors
                TESTC(hr = DisplayBindingErrors(hr, rBindings.GetCount(), rBindings.GetElements(), pData));
              }
              break;
          };

          //Its our responsiblity to free the allocated (outofline) data...
          //TODO - need to free in the case of errors as well.  But have to be careful
          //since the pData may not have been setup yet, or other errors where its undefined...
          TESTC(rBindings.FreeData(pData, TRUE/*fSetData*/));

          if(pThis->m_idSource != IDM_INSERTROW)
          {
            //Need to indicate row was modified, use "changed" icon
            pCDataGrid->SetItemImage(pCDataGrid->m_iSelRow, 0, IMAGE_CHANGE);

            //Display the Data for this Row
            TESTC(hr = pCDataGrid->DisplayData(hRow, pCDataGrid->m_iSelRow, pCRow ? DBPROP_IRow : DBPROP_IRowset));
          }

        CLEANUP:
          SAFE_FREE(rgColumnIDs);
          SAFE_FREE(rgStatus);

          if(SUCCEEDED(hr))
            EndDialog(hWnd, TRUE);
          return 0;
        }

        case IDCANCEL:
        {
          bBeginEdit = FALSE;
          EndDialog(hWnd, FALSE);
          return 0;
        }
      }
      break;
    }//WM_COMMAND

    case WM_CONTEXTMENU:
    {
      HWND hWndSelected = (HWND)wParam;
      CMDIChild* pThis = (CMDIChild*)GetThis(hWnd);

      //Must have selected a row to change status
      INDEX iSel = s_listNames.GetNextItem(-1, LVNI_SELECTED);
      if(iSel == LVM_ERR)
        return FALSE;

      //IDL_NAMES
      if(hWndSelected == s_listNames.m_hWnd)
      {
        //Don't need to change the status if readonly
        if(!SOURCE_GETINTERFACE(pThis->m_pCSource, IRowChange) && !SOURCE_GETINTERFACE(pThis->m_pCSource, IRowsetChange))
          return FALSE;

        //Display Menu
        DisplayContextMenu(
                hWnd,
                IDM_CHANGESTATUS,
                MAKEPOINTS(lParam),
                hWnd
                );
      }

      //IDL_VALUES
      if(hWndSelected == s_listValue.m_hWnd)
      {
        //Display Menu
        DisplayContextMenu(
                hWnd,
                IDM_CHANGEVALUE,
                MAKEPOINTS(lParam),
                hWnd
                );
      }
      return FALSE;
    }

    case WM_NOTIFY:
    {
      LV_DISPINFO* pDispInfo = (LV_DISPINFO*)lParam;
      NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)lParam;

      switch(pDispInfo->hdr.code)
      {
        //Since we have "TwoClickActive" on this will get sent
        //Whenever a row is clicked on twice!
        //This functionality used to be done with NM_DBCLK
        case LVN_ITEMACTIVATE:
        {
          //Obtain the SelectedRow
          INDEX iSel = (INDEX)SendMessage(::GetDlgItem(hWnd, IDL_VALUES), LVM_GETNEXTITEM, (WPARAM)-1, (LPARAM)LVNI_SELECTED);
          if(iSel == LVM_ERR)
            return 0;

          //Need to Send LVM_EDITLABEL
          SendMessage(::GetDlgItem(hWnd, IDL_VALUES), LVM_EDITLABEL, iSel, 0);
          return 0;
        }

        case LVN_BEGINLABELEDIT:
          bBeginEdit = TRUE;
          return FALSE;//allow the user to change the value of the item.

        case LVN_ENDLABELEDIT:
        {
          CMDIChild* pThis = (CMDIChild*)GetThis(hWnd);
          bBeginEdit = FALSE;

          //Now update the ListView with the new value
          //If IRowsetChange is supported...
          if(pDispInfo->item.pszText && (SOURCE_GETINTERFACE(pThis->m_pCSource, IRowChange) || SOURCE_GETINTERFACE(pThis->m_pCSource, IRowsetChange)))
          {
            WCHAR wszBuffer[MAX_NAME_LEN]={0};
            ConvertToWCHAR(pDispInfo->item.pszText, wszBuffer, MAX_NAME_LEN);
            s_listValue.SetItemText(pDispInfo->item.iItem, 0, wszBuffer);
          }

          return TRUE; //Allow the edited change
        }

        case LVN_ITEMCHANGED:
        {
          bBeginEdit = FALSE;

          if(pNMListView->uNewState & LVNI_FOCUSED &&
            pNMListView->uNewState & LVNI_SELECTED)
          {
            if(wParam == IDL_VALUES)
            {
              SyncSibling(s_listNames.m_hWnd, s_listValue.m_hWnd);
                    return HANDLED_MSG;
            }

            if(wParam == IDL_NAMES)
            {
              SyncSibling(s_listValue.m_hWnd, s_listNames.m_hWnd);
                      return HANDLED_MSG;
            }
            return UNHANDLED_MSG; //No return Value
          }
        }
      }
    }//WM_NOTIFY
  }//switch(message);

  return FALSE;
}

INT_PTR WINAPI CMDIChild::RowOpenProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 6449 of file cmdichild.cpp.

{
  static INDEX iSavedType = 5;  //DBGUID_STREAM
  static CComboBoxGuid    s_CComboInterface;
  static BOOL fAggregation  = FALSE;    //Default
  static BOOL fOutput     = TRUE;     //Default

  switch(message)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;

      //Save the "this" pointer
      CMDIChild* pThis  = (CMDIChild*)SetThis(hWnd, (void*)lParam);
      CRow* pCRow     = SOURCE_GETOBJECT(pThis->m_pCSource, CRow);

      INDEX iSel = 0;

      HWND hWndColumns  = ::GetDlgItem(hWnd, IDC_COLUMNS);
      HWND hWndObjectType = ::GetDlgItem(hWnd, IDC_OBJECTTYPE);

      //Fill In ColumnID drop down
      INDEX iDefColumn = -1;
      for(ULONG i=0; i<pCRow->m_ColumnInfo.GetCount(); i++)
      {
        iSel = (INDEX)wSendMessage(hWndColumns, CB_ADDSTRING, 0, GetColName(&pCRow->m_ColumnInfo[i]));
        SendMessage(hWndColumns, CB_SETITEMDATA, iSel, (LPARAM)&pCRow->m_ColumnInfo[i].columnid);

        //Default the selected column to the first BLOB, Stream, or IUnknown object
        if(iDefColumn==-1 && ((pCRow->m_ColumnInfo[i].wType == DBTYPE_IUNKNOWN) || (pCRow->m_ColumnInfo[i].dwFlags & (DBCOLUMNFLAGS_ISLONG | DBCOLUMNFLAGS_ISDEFAULTSTREAM))))
          iDefColumn = i;
      }

      //Now also add the special column guids, which may not be a part of the ColumnInfo
      for(i=0; i<g_cRowColMaps; i++)
      {
        iSel = (INDEX)wSendMessage(hWndColumns, CB_ADDSTRING, 0, g_rgRowColMaps[i].pwszName);
        SendMessage(hWndColumns, CB_SETITEMDATA, iSel, (LPARAM)g_rgRowColMaps[i].pDBID);
      }

      //Set the Default Selection
      if(iDefColumn == -1)
        iDefColumn = iSel;
      SendMessage(hWndColumns, CB_SETCURSEL, iDefColumn, 0);

      //Fill In ObjectType drop down
      for(i=0; i<g_cObjectTypeMaps; i++)
      {
        iSel = (INDEX)wSendMessage(hWndObjectType, CB_ADDSTRING, 0, g_rgObjectTypeMaps[i].pwszName);
        SendMessage(hWndObjectType, CB_SETITEMDATA, iSel, (LPARAM)&g_rgObjectTypeMaps[i]);
      }
      SendMessage(hWndObjectType, CB_SETCURSEL, iSavedType, 0);

      //Aggregation
            ::CheckDlgButton(hWnd, IDB_AGGREGATION,    BST2STATE(fAggregation));

      //Output (ppIUnknown)
            ::CheckDlgButton(hWnd, IDB_OUTPUT,     BST2STATE(fOutput));

      //Interface List...
      s_CComboInterface.CreateIndirect(hWnd, IDC_INTERFACE);
      s_CComboInterface.Populate(g_cInterfaceMaps, g_rgInterfaceMaps);
      if(s_CComboInterface.RestoreSelection() == CB_ERR)
        s_CComboInterface.SetGuid(IID_ISequentialStream);

      CenterDialog(hWnd);
      return TRUE;
    }

    case WM_COMMAND:
    {
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDB_AGGREGATION:
        {
          //Aggregation Combo Selection has changed...
          //If we are now using Aggregation, automatically change the requested
          //riid to IID_IUnknown, since its an error otherwise...
          if(::IsDlgButtonChecked(hWnd, IDB_AGGREGATION))
            s_CComboInterface.SetGuid(IID_IUnknown);
          return 0;
        }

        case IDOK:
        {
          CWaitCursor waitCursor;

          //Get the "this" pointer
          CMDIChild* pThis  = (CMDIChild*)GetThis(hWnd);
          CRow* pCRow     = SOURCE_GETOBJECT(pThis->m_pCSource, CRow);
          IUnknown* pIUnknown = NULL;
          DWORD dwCreateOpts = CREATE_NEWWINDOW;

          HWND hWndColumns  = ::GetDlgItem(hWnd, IDC_COLUMNS);
          HWND hWndObjectType = ::GetDlgItem(hWnd, IDC_OBJECTTYPE);
          HRESULT hr = S_OK;

          //ColumnID
          INDEX iSel = (INDEX)SendMessage(hWndColumns, CB_GETCURSEL, 0, 0);
          DBID* pColID = (DBID*)SendMessage(hWndColumns, CB_GETITEMDATA, iSel, 0);

          //ObjectType
          iSavedType = (INDEX)SendMessage(hWndObjectType, CB_GETCURSEL, 0, 0);
          WIDEGUIDMAP* pObjectMap = (WIDEGUIDMAP*)SendMessage(hWndObjectType, CB_GETITEMDATA, iSavedType, 0);
          GUID guidObjectType = *pObjectMap->pGuid;
          if(guidObjectType == GUID_NULL)
            dwCreateOpts |= CREATE_DETERMINE_TYPE;

          //Obtain the Aggregation argument
          CAggregate* pCAggregate = NULL;
          fAggregation = ::IsDlgButtonChecked(hWnd, IDB_AGGREGATION);
          if(fAggregation)
            pCAggregate = new CAggregate();

          //Obtain the Output (ppIUnknown) argument
          fOutput = ::IsDlgButtonChecked(hWnd, IDB_OUTPUT);

          //Interface
          REFIID riid = s_CComboInterface.GetGuid();

          //IRow::Open
          TESTC(hr = pCRow->Open(pCAggregate, pColID, guidObjectType, riid, fOutput ? &pIUnknown : NULL));

          //Handle the returned object type...
          //NOTE: We know the object returned, or eCUnknown is passed to determine it
          if(!pThis->m_pCMainWindow->HandleObjectType(pCRow, pIUnknown, riid, GuidToSourceType(guidObjectType), 0, NULL, dwCreateOpts))
            TESTC(hr = E_FAIL);

        CLEANUP:
          SAFE_RELEASE(pCAggregate);
          SAFE_RELEASE(pIUnknown);

          if(SUCCEEDED(hr))
            EndDialog(hWnd, TRUE);
          return 0;
        }

        case IDCANCEL:
        {
          EndDialog(hWnd, FALSE);
          return 0;
        }
      }
      break;
    }//WM_COMMAND
  }

  return FALSE;
}

INT_PTR WINAPI CMDIChild::SetCommandTextProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 9295 of file cmdichild.cpp.

{
  static BOOL fRelOpenObjects = TRUE; //Default
  static BOOL fUnicodeStream  = TRUE; //Default
  static CComboBoxGuid  s_CComboDialect;
  static CComboBoxGuid  s_CComboRefiid;

  switch(message)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;

      //Save the "this" pointer
      CMDIChild* pThis  = (CMDIChild*)SetThis(hWnd, (void*)lParam);
      CCommand* pCCommand = SOURCE_GETOBJECT(pThis->m_pCSource, CCommand);
      HWND hWndCmdText  = ::GetDlgItem(hWnd, IDE_COMMANDTEXT);

      //Fill-in Dialect Combo
      s_CComboDialect.CreateIndirect(hWnd, IDC_DIALECT);
      s_CComboDialect.Populate(g_cDialectMaps, g_rgDialectMaps);
      s_CComboDialect.SetGuid(pCCommand->m_guidDialect);

      //Fill-in REFIID Combo (ICommandStream)
      if(pThis->m_idSource == IDM_SETCOMMANDSTREAM)
      {
        s_CComboRefiid.CreateIndirect(hWnd, IDC_REFIID);
        s_CComboRefiid.Populate(g_cInterfaceMaps, g_rgInterfaceMaps);
        s_CComboRefiid.SetGuid(IID_ISequentialStream);
      }

      //Fill In CommandText as Default
      WCHAR* pwszQuery = pThis->m_pCQueryBox->GetSelectedText();
      wSendMessage(hWndCmdText, WM_SETTEXT, 0, pwszQuery);

      //Default Options
            ::CheckDlgButton(hWnd, IDB_UNICODE,        BST2STATE(fUnicodeStream));
            ::CheckDlgButton(hWnd, IDB_RELEASE_OPENOBJECTS,  BST2STATE(fRelOpenObjects));

      CenterDialog(hWnd);
      SAFE_FREE(pwszQuery);
      return TRUE;
    }

    case WM_COMMAND:
    {
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDOK:
        {
          CWaitCursor waitCursor;

          //Get the "this" pointer
          CMDIChild* pThis  = (CMDIChild*)GetThis(hWnd);
          CCommand* pCCommand = SOURCE_GETOBJECT(pThis->m_pCSource, CCommand);
          CRowset* pCRowset = (CRowset*)pThis->GetObject(eCRowset);
          WCHAR* pwszCommandText = NULL;

          HWND hWndCmdText  = ::GetDlgItem(hWnd, IDE_COMMANDTEXT);
          HRESULT hr = S_OK;

          //Options
          fUnicodeStream = ::IsDlgButtonChecked(hWnd, IDB_UNICODE);
          fRelOpenObjects = ::IsDlgButtonChecked(hWnd, IDB_RELEASE_OPENOBJECTS);
          if(pCCommand && fRelOpenObjects)
          {
            pCCommand->ReleaseChildren();
            pThis->UpdateControls();
          }

          //Get Guid Dialect
          //NOTE: Save it into a temporary in case this fails...
          GUID guidDialect = GUID_NULL;
          INDEX iSel = s_CComboDialect.GetCurSel();
          if(iSel != CB_ERR)
          {
            //Get ItemData which is the Guid Pointer
            guidDialect = s_CComboDialect.GetGuid();
          }
          else
          {
            //Convert Users String to a Guid
            WCHAR wszBuffer[MAX_NAME_LEN] = {0};
            s_CComboDialect.GetSelText(wszBuffer, MAX_NAME_LEN);
            XTESTC(hr = CLSIDFromString(wszBuffer, &guidDialect));
          }

          //ICommand::SetCommandText
          pwszCommandText = wGetWindowText(hWndCmdText);
          if(pThis->m_idSource == IDM_SETCOMMANDSTREAM)
          {
            REFIID riid = s_CComboRefiid.GetGuid();
            TESTC(hr = pCCommand->SetCommandStream(pwszCommandText,
                                riid,
                                &guidDialect,
                                fUnicodeStream));
          }
          else
          {
            TESTC(hr = pCCommand->SetCommandText(pwszCommandText, &guidDialect));
          }

        CLEANUP:
          if(SUCCEEDED(hr))
          {
            //Now just need to place this name in the EditBox
            //Inserted after the current "caret"
            pThis->m_pCQueryBox->ReplaceAll(pwszCommandText, FALSE/*bReplaceAll*/, TRUE/*fHighlight*/);
            EndDialog(hWnd, TRUE);
          }

          SAFE_FREE(pwszCommandText);
          return 0;
        }

        case IDCANCEL:
        {
          EndDialog(hWnd, FALSE);
          return 0;
        }
      }
      break;
    }//WM_COMMAND
  }

  return FALSE;
}

void CMDIChild::SetConfig | ( | WCHAR * | pwszConfig,
 |  | BOOL | fCopy = TRUE |
 | ) |  |  | [virtual]

Definition at line 96 of file cmdichild.cpp.

{
  SAFE_FREE(m_pwszConfig);

  //Optmization:  If the caller no longer needs the name,
  //no sense in reallocing, copying, freeing, freeing.  Just reference it...
  m_pwszConfig = fCopy ? wcsDuplicate(pwszConfig) : pwszConfig;

  //Obtain the last Saved Query in the Query Box
  if(m_pCQueryBox && m_pwszConfig)
  {
    WCHAR* pwszQuery = NULL;

    //Formulate the key
    static WCHAR wszKeyName[MAX_NAME_LEN];
    StringFormat(wszKeyName, NUMELE(wszKeyName), L"%s\\%s\\Command", wszCONFIG_KEY, m_pwszConfig);

    //Save the Query
    GetRegEntry(HKEY_ROWSETVIEWER, wszKeyName, L"Query", &pwszQuery);

    //Update the Query Box
    m_pCQueryBox->SetWindowText(pwszQuery);
    SAFE_FREE(pwszQuery);
  }
}

INT_PTR WINAPI CMDIChild::SetParameterInfoProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 4731 of file cmdichild.cpp.

{
  static DWORD  dwSavedFlags  = 0;
  static INDEX  iSavedName    = CB_ERR;
  static CComboBoxLite  s_CComboTypes;

  switch(message)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;

      //Save the "this" pointer
      CMDIChild* pThis  = (CMDIChild*)SetThis(hWnd, (void*)lParam);
      INDEX iSel = 0;
      HRESULT hr = S_OK;

      //Controls
      HWND hWndOrdinal  = ::GetDlgItem(hWnd, IDE_ORDINAL);
      HWND hWndParamName  = ::GetDlgItem(hWnd, IDC_NAME);
      HWND hWndFlags    = ::GetDlgItem(hWnd, IDL_FLAGS);

      //Set Ordinal
      SendMessage(hWndOrdinal, WM_SETTEXT, 0, (LPARAM)"1");

      //Set Parameter Name
      SendMessage(hWndParamName, CB_ADDSTRING, 0, (LPARAM)"<NULL>");
      iSel = (INDEX)SendMessage(hWndParamName, CB_ADDSTRING, 0, (LPARAM)"Parameter1");
      iSavedName = (INDEX)SendMessage(hWndParamName, CB_SETCURSEL, iSavedName!=CB_ERR ? iSavedName : iSel, 0);

      //Add support for indicating NULL
      s_CComboTypes.CreateIndirect(hWnd, IDC_TYPE);
      s_CComboTypes.AddString(L"<NULL>");

      //Fill in Combo with "Standard" Defined Type Names (defined in SetParameterInfo)
      //NOTE: We could just use the DBTYPE list (g_rgDBTypes), but that gives many
      //confusing types (DBTYPE_STR) which people are apt to use but are not standard
      //so currently no provider supports them.  So just list all those defined by the spec
      //and the combo box allows the user to enter other (not in the list)
      s_CComboTypes.AddString(L"DBTYPE_I1");
      s_CComboTypes.AddString(L"DBTYPE_I2");
      s_CComboTypes.AddString(L"DBTYPE_I4");
      s_CComboTypes.AddString(L"DBTYPE_I8");
      s_CComboTypes.AddString(L"DBTYPE_UI1");
      s_CComboTypes.AddString(L"DBTYPE_UI2");
      s_CComboTypes.AddString(L"DBTYPE_UI4");
      s_CComboTypes.AddString(L"DBTYPE_UI8");
      s_CComboTypes.AddString(L"DBTYPE_R4");
      s_CComboTypes.AddString(L"DBTYPE_R8");
      s_CComboTypes.AddString(L"DBTYPE_CY");
      s_CComboTypes.AddString(L"DBTYPE_DECIMAL");
      s_CComboTypes.AddString(L"DBTYPE_NUMERIC");
      s_CComboTypes.AddString(L"DBTYPE_BOOL");
      s_CComboTypes.AddString(L"DBTYPE_ERROR");
      s_CComboTypes.AddString(L"DBTYPE_UDT");
      s_CComboTypes.AddString(L"DBTYPE_VARIANT");
      s_CComboTypes.AddString(L"DBTYPE_IDISPATCH");
      s_CComboTypes.AddString(L"DBTYPE_IUNKNOWN");
      s_CComboTypes.AddString(L"DBTYPE_GUID");
      s_CComboTypes.AddString(L"DBTYPE_DATE");
      s_CComboTypes.AddString(L"DBTYPE_DBDATE");
      s_CComboTypes.AddString(L"DBTYPE_DBTIME");
      s_CComboTypes.AddString(L"DBTYPE_DBTIMESTAMP");
      s_CComboTypes.AddString(L"DBTYPE_BSTR");
      s_CComboTypes.AddString(L"DBTYPE_CHAR");
      iSel = s_CComboTypes.AddString(L"DBTYPE_VARCHAR");
      s_CComboTypes.AddString(L"DBTYPE_LONGVARCHAR");
      s_CComboTypes.AddString(L"DBTYPE_WCHAR");
      s_CComboTypes.AddString(L"DBTYPE_WVARCHAR");
      s_CComboTypes.AddString(L"DBTYPE_WLONGVARCHAR");
      s_CComboTypes.AddString(L"DBTYPE_BINARY");
      s_CComboTypes.AddString(L"DBTYPE_VARBINARY");
      s_CComboTypes.AddString(L"DBTYPE_LONGVARBINARY");
      s_CComboTypes.AddString(L"DBTYPE_FILENAME");
      s_CComboTypes.AddString(L"DBTYPE_VARNUMERIC");
      s_CComboTypes.AddString(L"DBTYPE_PROPVARIANT");

      //Set current Selection
      if(s_CComboTypes.RestoreSelection() == CB_ERR)
        s_CComboTypes.SetCurSel(iSel);

      const static WIDENAMEMAP g_rgParamFlags[] =
      {
        VALUE_WCHAR(DBPARAMFLAGS_ISINPUT),
        VALUE_WCHAR(DBPARAMFLAGS_ISOUTPUT),
        VALUE_WCHAR(DBPARAMFLAGS_ISSIGNED),
        VALUE_WCHAR(DBPARAMFLAGS_ISNULLABLE),
        VALUE_WCHAR(DBPARAMFLAGS_ISLONG),
        VALUE_WCHAR(DBPARAMFLAGS_SCALEISNEGATIVE),
      };

      //Populate the Flags ListBox
      SendMessage(hWndFlags, LB_RESETCONTENT, 0, 0);
      for(ULONG i=0; i<NUMELE(g_rgParamFlags); i++)
      {
        INDEX iSel = (INDEX)wSendMessage(hWndFlags, LB_ADDSTRING, 0, g_rgParamFlags[i].pwszName);
        SendMessage(hWndFlags,  LB_SETITEMDATA, iSel, (LPARAM)g_rgParamFlags[i].lItem);

        //Reselect all previously selected items...
        SendMessage(hWndFlags, LB_SETSEL, (dwSavedFlags & g_rgParamFlags[i].lItem) == (DWORD)g_rgParamFlags[i].lItem, i);
      }

      //Send a selection change to the ComboBox so it updates everything
      //Size, Precision, and Scale
      SendMessage(hWnd, WM_COMMAND, GET_WM_COMMAND_MPS(IDC_TYPE, hWnd, CBN_SELCHANGE));

      CenterDialog(hWnd);
      if(FAILED(hr))
        EndDialog(hWnd, FALSE);
      return TRUE;
    }

    case WM_COMMAND:
    {
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      //CBN_SELCHANGE
      switch(GET_WM_COMMAND_CMD(wParam, lParam))
      {
        //Selection change in a combo box occurred
        case CBN_SELCHANGE:
        {
          //See which combo box has changed
          switch(GET_WM_COMMAND_ID(wParam, lParam))
          {
            case IDC_TYPE:
            {
              WCHAR wszBuffer[MAX_NAME_LEN+1];
              HWND hWndSize   = ::GetDlgItem(hWnd, IDE_SIZE);
              HWND hWndPrecision  = ::GetDlgItem(hWnd, IDE_PRECISION);
              HWND hWndScale    = ::GetDlgItem(hWnd, IDE_SCALE);

              //Get the Selected Type
              s_CComboTypes.GetSelText(wszBuffer, MAX_NAME_LEN);
              DBTYPE wType = GetDBType(wszBuffer);
              s_CComboTypes.SaveSelection();

              //Get Default Size,Prec,Scale for this type...
              DBLENGTH ulMaxSize = 0;
              BYTE  bPrecision, bScale;
              GetDBTypeMaxSize(wType, &ulMaxSize, &bPrecision, &bScale);

              //Set Size
              wSendMessageFmt(hWndSize,   WM_SETTEXT, 0, L"%lu", ulMaxSize!=0 ? ulMaxSize : 255);
              //Set Precision
              wSendMessageFmt(hWndPrecision,  WM_SETTEXT, 0, L"%d", bPrecision);
              //Set Scale
              wSendMessageFmt(hWndScale,    WM_SETTEXT, 0, L"%d", bScale);
              return 0;
            }
          }
          break;
        }
      }

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDOK:
        {
          CWaitCursor waitCursor;

          //Get the "this" pointer
          CMDIChild* pThis  = (CMDIChild*)GetThis(hWnd);
          CCommand* pCCommand = SOURCE_GETOBJECT(pThis->m_pCSource, CCommand);
          WCHAR wszNameBuffer[MAX_NAME_LEN];
          WCHAR wszTypeBuffer[MAX_NAME_LEN];
          HRESULT hr = S_OK;

          //Controls
          HWND hWndOrdinal  = ::GetDlgItem(hWnd, IDE_ORDINAL);
          HWND hWndFlags    = ::GetDlgItem(hWnd, IDL_FLAGS);
          HWND hWndSize   = ::GetDlgItem(hWnd, IDE_SIZE);
          HWND hWndPrecision  = ::GetDlgItem(hWnd, IDE_PRECISION);
          HWND hWndScale    = ::GetDlgItem(hWnd, IDE_SCALE);

          LONG lValue = 0;
          ULONG cParams = 0;

          //Alloc Params
          cParams = 1;
          DB_UPARAMS ulParamOrdinal = 0;
          DBPARAMBINDINFO dbParamBindInfo;

          //Setup ParamBindInfo
          CComboBoxLite comboParamName(hWnd, IDC_NAME);
          iSavedName = comboParamName.GetSelText(wszNameBuffer, MAX_NAME_LEN);
          dbParamBindInfo.pwszName = iSavedName == 0 ? NULL : wszNameBuffer;

          GetEditBoxValue(hWndOrdinal,  &lValue, 0/*Min*/);
          ulParamOrdinal = lValue;

          GetEditBoxValue(hWndSize,   &lValue, 0/*Min*/);
          dbParamBindInfo.ulParamSize = lValue;

          GetEditBoxValue(hWndPrecision,  &lValue, 0, UCHAR_MAX);
          dbParamBindInfo.bPrecision = (BYTE)lValue;

          GetEditBoxValue(hWndScale,    &lValue, 0, UCHAR_MAX);
          dbParamBindInfo.bScale = (BYTE)lValue;

          //Get TypeName
          INDEX iSel = s_CComboTypes.GetSelText(wszTypeBuffer, MAX_NAME_LEN);
          dbParamBindInfo.pwszDataSourceType = iSel == 0 ? NULL : wszTypeBuffer;

          //Obtain all Flags Selected Items...
          INDEX iSelCount = (INDEX)SendMessage(hWndFlags, LB_GETSELCOUNT, 0, 0);
          ASSERT(iSelCount < 20);
          LONG rgSelItems[20];
          SendMessage(hWndFlags, LB_GETSELITEMS, (WPARAM)20, (LPARAM)rgSelItems);

          dwSavedFlags = 0;
          for(LONG i=0; i<iSelCount; i++)
            dwSavedFlags |= SendMessage(hWndFlags, LB_GETITEMDATA, rgSelItems[i], 0);
          dbParamBindInfo.dwFlags = dwSavedFlags;

          //SetParameterInfo
          ASSERT(pCCommand->m_pICommandWithParameters);
          XTEST(hr = pCCommand->m_pICommandWithParameters->SetParameterInfo(cParams, &ulParamOrdinal, &dbParamBindInfo));
          TESTC(TRACE_METHOD(hr, L"ICommandWithParameters::SetParameterInfo(%lu, &%ld, 0x%p)", cParams, ulParamOrdinal, &dbParamBindInfo));

        CLEANUP:
          return 0;
        }

        case IDCANCEL:
        {
          EndDialog(hWnd, FALSE);
          return 0;
        }

        case IDB_RESET:
        {
          //Get the "this" pointer
          CMDIChild* pThis  = (CMDIChild*)GetThis(hWnd);
          CCommand* pCCommand = SOURCE_GETOBJECT(pThis->m_pCSource, CCommand);
          HRESULT hr = S_OK;

          //SetParameterInfo
          ASSERT(pCCommand->m_pICommandWithParameters);
          XTEST(hr = pCCommand->m_pICommandWithParameters->SetParameterInfo(0, NULL, NULL));
          TRACE_METHOD(hr, L"ICommandWithParameters::SetParameterInfo(0, NULL, NULL)");
          return 0;
        }
      }
      break;
    }//WM_COMMAND

  }//switch message

  return FALSE;
}

INT_PTR WINAPI CMDIChild::SetTransactionOptionsProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 5996 of file cmdichild.cpp.

{
  switch(message)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;

      //Save the "this" pointer
      CMDIChild* pThis = (CMDIChild*)SetThis(hWnd, (void*)lParam);

      HWND hWndTimeout  = ::GetDlgItem(hWnd, IDE_TIMEOUT);
      HWND hWndDescription= ::GetDlgItem(hWnd, IDE_DESCRIPTION);

      //Defaults
      SendMessage(hWndTimeout, WM_SETTEXT, 0, (LPARAM)"0");
      SendMessage(hWndDescription, WM_SETTEXT, 0, (LPARAM)"");
      CenterDialog(hWnd);
      return TRUE;
    }

    case WM_COMMAND:
    {
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDOK:
        {
          CWaitCursor waitCursor;

          //Get the "this" pointer
          CMDIChild* pThis              = (CMDIChild*)GetThis(hWnd);
          CTransactionOptions* pCTransactionOptions = SOURCE_GETOBJECT(pThis->m_pCSource, CTransactionOptions);
          HRESULT hr = S_OK;

          HWND hWndTimeout  = ::GetDlgItem(hWnd, IDE_TIMEOUT);
          HWND hWndDescription= ::GetDlgItem(hWnd, IDE_DESCRIPTION);

          XACTOPT XactOptions;
          XactOptions.ulTimeout = 0;
          XactOptions.szDescription[0] = EOL;

          //Need to Obtain Entered Timeout Value
          if(!GetEditBoxValue(hWndTimeout, (LONG*)&XactOptions.ulTimeout, 0/*Min*/))
            return FALSE;

          //Need to Obtain Description
          SendMessage(hWndDescription, WM_GETTEXT, 40-1, (LPARAM)XactOptions.szDescription);

          //ITransactionOptions::SetOptions
          ASSERT(pCTransactionOptions->m_pITransactionOptions);
          XTEST(hr = pCTransactionOptions->m_pITransactionOptions->SetOptions(&XactOptions));
          TRACE_METHOD(hr, L"ITransactionOptions::SetOptions(%d, \"%S\")", XactOptions.ulTimeout, XactOptions.szDescription);

          if(SUCCEEDED(hr))
            EndDialog(hWnd, TRUE);
          return 0;
        }

        case IDCANCEL:
        {
          EndDialog(hWnd, FALSE);
          return 0;
        }
      }
      break;
    }//WM_COMMAND
  }

  return FALSE;
}

BOOL CMDIChild::SetupTransactionCombo ( HWND hWnd ) [virtual]

Definition at line 5891 of file cmdichild.cpp.

{
  INDEX iSel  = 0;
  ULONG cCount  = 0;
  WCHAR wszBuffer[MAX_NAME_LEN+1] = {0};

  //Need to fill in the Txn ComboBox
  POSITION pos = m_pCMainWindow->m_listTransactions.GetHeadPosition();
  while(pos)
  {
    ITransaction* pITransaction = m_pCMainWindow->m_listTransactions.GetNext(pos);
    StringFormat(wszBuffer, NUMELE(wszBuffer), L"%d - 0x%p", cCount++, pITransaction);

    iSel = (INDEX)wSendMessage(hWnd, CB_ADDSTRING,  0, wszBuffer);
    SendMessage(hWnd, CB_SETITEMDATA, iSel, (LPARAM)pITransaction);
  }

  //SetDefault - 1st txn
  SendMessage(hWnd, CB_SETCURSEL, 0, (LPARAM)0);

  //Enable or Diable the Combo...
    ::EnableWindow(hWnd, !m_pCMainWindow->m_listTransactions.IsEmpty());
  return TRUE;
}

INT_PTR WINAPI CMDIChild::StartTransactionProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 5669 of file cmdichild.cpp.

{
  switch(message)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;

      //Save the "this" pointer
      CMDIChild*    pThis     = (CMDIChild*)SetThis(hWnd, (void*)lParam);
      HWND      hWndIsoLevel  = ::GetDlgItem(hWnd, IDC_ISOLEVEL);

      //Title
      if(pThis->m_idSource == IDM_ITRANSACTIONDISPENSOR_BEGINTRANSACTION)
        SendMessage(hWnd, WM_SETTEXT, 0, (LPARAM)"TransactionDispensor::BeginTransaction");

      //Need to fill in the ISOLEVEL ComboBox
      for(ULONG i=0; i<g_cIsoLevels; i++)
      {
        INDEX iSel = (INDEX)wSendMessage(hWndIsoLevel, CB_ADDSTRING,  0, g_rgIsoLevels[i].pwszName);
        SendMessage(hWndIsoLevel, CB_SETITEMDATA, iSel, (LPARAM)g_rgIsoLevels[i].lItem);
      }

      //SetDefault - READUNCOMMITED
      SendMessage(hWndIsoLevel, CB_SETCURSEL, 2, (LPARAM)0);

      CenterDialog(hWnd);
      return TRUE;
    }

    case WM_COMMAND:
    {
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDOK:
        {
          CWaitCursor waitCursor;

          //Get the "this" pointer
          CMDIChild*    pThis     = (CMDIChild*)GetThis(hWnd);

          HWND      hWndIsoLevel  = ::GetDlgItem(hWnd, IDC_ISOLEVEL);
          WCHAR     wszBuffer[MAX_NAME_LEN+1] = {0};
          HRESULT     hr = S_OK;

          //Just Need to Obtain selected ISOLEVEL from Combo
          INDEX   iSel    = (INDEX)SendMessage(hWndIsoLevel, CB_GETCURSEL, 0, 0);
          wSendMessage(hWndIsoLevel, WM_GETTEXT, MAX_NAME_LEN, wszBuffer);
          ISOLEVEL  isoLevel  = (ISOLEVEL)SendMessage(hWndIsoLevel, CB_GETITEMDATA, iSel, 0);

          if(pThis->m_idSource != IDM_ITRANSACTIONDISPENSOR_BEGINTRANSACTION)
          {
            ULONG ulTransactionLevel = 0;
            ITransactionLocal* pITransactionLocal = SOURCE_GETINTERFACE(pThis->m_pCSource,  ITransactionLocal);
            ASSERT(pITransactionLocal);

            //ITransactionLocal::StartTransaction
            XTEST(hr = pITransactionLocal->StartTransaction(isoLevel, 0, NULL, &ulTransactionLevel));
            TRACE_METHOD(hr, L"ITransactionLocal::StartTransaction(%s, 0, NULL, &%d)", wszBuffer, ulTransactionLevel);
          }
          else
          {
#ifdef MTSTXN
            ITransaction*     pITransaction     = NULL;
            ITransactionDispenser*  pITransactionDispenser  = NULL;

            // Obtain the ITransactionDispenser Interface pointer
            // by calling DtcGetTransactionManager()
            XTEST(hr = DtcGetTransactionManager
                      (
                        NULL,               // LPTSTR  pszHost,
                        NULL,               // LPTSTR  pszTmName,
                        IID_ITransactionDispenser,      // /* in  */ REFIID rid,
                        0,                  // /* in  */ DWORD  dwReserved1,
                        0,                  // /* in  */ WORD wcbReserved2,
                        NULL,               // /* in  */ void FAR * pvReserved2,
                        (void**)&pITransactionDispenser   // /* out */ void** ppvObject
                      ));
            TRACE_METHOD(hr, L"DtcGetTransactionManager(NULL, NULL, IID_ITransactionDispenser, 0, 0, NULL, &0x%p)", pITransactionDispenser);

            //start a global transaction
            if(SUCCEEDED(hr))
            {
              XTEST(hr = pITransactionDispenser->BeginTransaction
                          (
                            NULL,             //  /* [in]  */ IUnknown __RPC_FAR *punkOuter,
                            isoLevel,           //  /* [in]  */ ISOLEVEL isoLevel,
                            0,                //  /* [in]  */ ULONG isoFlags,
                            NULL,             //  /* [in]  */ ITransactionOptions *pOptions
                            (ITransaction**)&pITransaction  //  /* [out] */ ITransaction **ppTransaction
                          ));
              TRACE_METHOD(hr, L"ITransactionDispenser::BeginTransaction(NULL, %s, 0, &0x%p)", wszBuffer, pITransaction);

              //Add this transaciton to the list
              if(SUCCEEDED(hr))
                pThis->m_pCMainWindow->m_listTransactions.AddTail(pITransaction);
            }

            SAFE_RELEASE(pITransactionDispenser);
#endif //MTSTXN
          }

          if(SUCCEEDED(hr))
            EndDialog(hWnd, TRUE);
          return 0;
        }

        case IDCANCEL:
        {
          EndDialog(hWnd, FALSE);
          return 0;
        }
      }
      break;
    }//WM_COMMAND
  }

  return FALSE;
}

HRESULT CMDIChild::UndoChanges ( ) [virtual]

Definition at line 2285 of file cmdichild.cpp.

{
  //Undo all pending changes, (if in buffered mode)...
  HRESULT hr = E_FAIL;
  CRowset*  pCRowset = (CRowset*)GetObject(eCRowset);

  INDEX i,cRows = 0;
  HROW* rghRows = NULL;
  DBCOUNTITEM cRowsUndone = 0;
  HROW* rghRowsUndone = NULL;
  INDEX* rgItems = NULL;
  DBROWSTATUS* rgRowStatus = NULL;

  if(pCRowset && pCRowset->m_pIRowsetUpdate)
  {
    HCHAPTER hChapter = pCRowset->m_hChapter;

    //Get all selected Rows
    LV_GetSelItems(m_pCDataGrid->m_hWnd, &cRows, &rgItems, (LPARAM**)&rghRows);

    //IRowsetUpdate::Undo
    XTEST(hr = pCRowset->m_pIRowsetUpdate->Undo(hChapter,cRows,rghRows,&cRowsUndone,&rghRowsUndone, &rgRowStatus));
    DisplayRowErrors(hr, cRowsUndone, rghRowsUndone, rgRowStatus);
    TESTC(TRACE_METHOD(hr, L"IRowsetUpdate::Undo(0x%p, %lu, 0x%p, &%lu, &0x%p, &0x%p)", hChapter, cRows, rghRows, cRowsUndone, rghRowsUndone, rgRowStatus));

    //Now GetData for all SelectedRows (a nice helper)
    //We won't worry about updating the case for (0,NULL), its not worth
    //trying to match the rhgRows returned to the correct hRows.  Worse case
    //is the user has to call GetData for one or all rows...
    for(i=0; i<cRows; i++)
    {
      //Need to indicate row was updated, use normal icon
      m_pCDataGrid->SetItemImage(rgItems[i], 0, IMAGE_NORMAL);

      //Display the Data...
      hr = m_pCDataGrid->DisplayData(rghRows[i], rgItems[i]);
    }
  }

CLEANUP:
  SAFE_FREE(rghRows);
  SAFE_FREE(rghRowsUndone);
  SAFE_FREE(rgRowStatus);
  SAFE_FREE(rgItems);
  return hr;
}

HRESULT CMDIChild::UpdateChanges ( ) [virtual]

Definition at line 2337 of file cmdichild.cpp.

{
  //Update all pending changes, (if in buffered mode)...
  HRESULT hr = E_FAIL;
  INDEX i,cRows = 0;
  HROW* rghRows = NULL;
  DBCOUNTITEM cRowsUpdated = 0;
  HROW* rghRowsUpdated = NULL;
  DBROWSTATUS* rgRowStatus = NULL;
  INDEX* rgItems = NULL;
  CRowset*  pCRowset = (CRowset*)GetObject(eCRowset);

  if(pCRowset && pCRowset->m_pIRowsetUpdate)
  {
    HCHAPTER hChapter = pCRowset->m_hChapter;

    //Get all selected Rows
    LV_GetSelItems(m_pCDataGrid->m_hWnd, &cRows, &rgItems, (LPARAM**)&rghRows);

    //IRowsetUpdate::Update
    XTEST(hr = pCRowset->m_pIRowsetUpdate->Update(hChapter,cRows,rghRows,&cRowsUpdated,&rghRowsUpdated,&rgRowStatus));
    DisplayRowErrors(hr, cRowsUpdated, rghRowsUpdated, rgRowStatus);
    TESTC(TRACE_METHOD(hr, L"IRowsetUpdate::Update(0x%p, %lu, 0x%p, &%lu, &0x%p, &0x%p)", hChapter, cRows, rghRows, cRowsUpdated, rghRowsUpdated, rgRowStatus));

    //Now GetData for all SelectedRows (a nice helper)
    //We won't worry about updating the case for (0,NULL), its not worth
    //trying to match the rhgRows returned to the correct hRows.  Worse case
    //is the user has to call GetData for one or all rows...
    for(i=0; i<cRows; i++)
    {
      //Need to indicate row was updated, use normal icon
      m_pCDataGrid->SetItemImage(rgItems[i], 0, IMAGE_NORMAL);

      //Display the Data...
      hr = m_pCDataGrid->DisplayData(rghRows[i], rgItems[i]);
    }
  }

CLEANUP:
  SAFE_FREE(rghRows);
  SAFE_FREE(rghRowsUpdated);
  SAFE_FREE(rgRowStatus);
  SAFE_FREE(rgItems);
  return hr;
}

BOOL CMDIChild::UpdateControls ( ) [virtual]

Definition at line 219 of file cmdichild.cpp.

{
  CDataAccess* pCDataAccess = m_pCDataAccess && m_pCDataAccess->m_pIUnknown ? m_pCDataAccess : NULL;

  //ToolBar Buttons
  m_pCMainWindow->UpdateControls();

  //Disable ListView window
  m_pCDataGrid->EnableWindow(pCDataAccess != NULL);

  //Update Window Title (in-case things have changed...)
  UpdateWndTitle();
  return TRUE;
}

HRESULT CMDIChild::UpdateWndTitle ( ) [virtual]

Definition at line 2078 of file cmdichild.cpp.

{
  //Default Info
  CBase* pCBase       = GetObject();
  CDataSource* pCDataSource = (CDataSource*)GetObject(eCDataSource);
  WCHAR* pwszProvider     = NULL;
  WCHAR* pwszDesc       = NULL;

  if(pCDataSource)
  {
    pwszProvider = pCDataSource->m_cstrProviderDesc &&  pCDataSource->m_cstrProviderDesc[0] ? pCDataSource->m_cstrProviderDesc : pCDataSource->m_cstrProviderName;
    pwszDesc   = pCDataSource->m_cstrDataSource && pCDataSource->m_cstrDataSource[0] ? pCDataSource->m_cstrDataSource : pCDataSource->m_cstrDBMS;
  }

  //Format text and output to window
  wSendMessageFmt(
        m_hWnd, WM_SETTEXT, 0, L"%s: %s %s%s%s",
        pCBase ? pCBase->GetObjectName() : L"Unknown",
        pwszProvider ? pwszProvider : L"",
        pwszDesc && pwszDesc[0] ? L"(" : L"",
        pwszDesc ? pwszDesc : L"",
        pwszDesc && pwszDesc[0] ? L")" : L""
        );

  return S_OK;
}

Member Data Documentation

CPropSets CMDIChild::m_CDefPropSets

Definition at line 254 of file cmdichild.h.

ULONG CMDIChild::m_iChildWindow = 0 [static]

Definition at line 250 of file cmdichild.h.

ULONG CMDIChild::m_idSource

Definition at line 258 of file cmdichild.h.

WPARAM CMDIChild::m_lastSizedEdge

Definition at line 249 of file cmdichild.h.

CCommand* CMDIChild::m_pCCommand

Definition at line 240 of file cmdichild.h.

CDataAccess* CMDIChild::m_pCDataAccess

Definition at line 242 of file cmdichild.h.

CDataGrid* CMDIChild::m_pCDataGrid

Definition at line 246 of file cmdichild.h.

CDataSource* CMDIChild::m_pCDataSource

Definition at line 238 of file cmdichild.h.

CMainWindow* CMDIChild::m_pCMainWindow

Definition at line 237 of file cmdichild.h.

CMultipleResults* CMDIChild::m_pCMultipleResults

Definition at line 241 of file cmdichild.h.

CQueryBox* CMDIChild::m_pCQueryBox

Definition at line 245 of file cmdichild.h.

CSession* CMDIChild::m_pCSession

Definition at line 239 of file cmdichild.h.

CBase* CMDIChild::m_pCSource

Definition at line 257 of file cmdichild.h.

WCHAR* CMDIChild::m_pwszConfig

Definition at line 251 of file cmdichild.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cmdichild.h
  • Dataaccess/oledb/rowsetviewer/cmdichild.cpp
Generated on Wed Nov 13 2024 16:56:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMDIChildLite Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions

CMDIChildLite Class Reference

#include "cdialoglite.h"

Inherits CWndLite.

Inherited by CMDIChild, CMDIObjects, and CMDITrace.

List of all members.

Public Member Functions

CMDIChildLite ()
virtual | ~CMDIChildLite ()
virtual BOOL | AutoPosition (BOOL fDefaultPosition=TRUE)
virtual BOOL | Create (HWND hWndParent, WCHAR *pwszClassName, WCHAR *pwszWindowName, UINT uID, HICON hIcon, DWORD dwStyle=WS_TABSTOP|WS_CHILD|WS_VISIBLE|WS_BORDER, DWORD dwExStyle=WS_EX_CLIENTEDGE, int x=CW_USEDEFAULT, int y=CW_USEDEFAULT, int cx=CW_USEDEFAULT, int cy=CW_USEDEFAULT)
virtual BOOL | HandleMessage (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
virtual BOOL | OnMDIActivate (BOOL bActivate, HWND hWndActivate, HWND hWndDeactivate)
virtual LRESULT | UnhandledMessage (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)

Static Public Member Functions

static LRESULT WINAPI | MDIWndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)

Detailed Description

Definition at line 221 of file cdialoglite.h.

Constructor & Destructor Documentation

CMDIChildLite::CMDIChildLite ( )

Definition at line 909 of file cdialoglite.cpp.

{
}

CMDIChildLite::~CMDIChildLite ( ) [virtual]

Definition at line 918 of file cdialoglite.cpp.

{
}

Member Function Documentation

BOOL CMDIChildLite::AutoPosition ( BOOL fDefaultPosition = TRUE ) [virtual]

Reimplemented in CMDIChild, CMDIObjects, and CMDITrace.

Definition at line 1051 of file cdialoglite.cpp.

{
  return FALSE;
}

BOOL CMDIChildLite::Create | ( | HWND | hWndParent,
 |  | WCHAR * | pwszClassName,
 |  | WCHAR * | pwszWindowName,
 |  | UINT | uID,
 |  | HICON | hIcon,
 |  | DWORD | dwStyle = WS_TABSTOP | WS_CHILD | WS_VISIBLE | WS_BORDER,
 |  | DWORD | dwExStyle = WS_EX_CLIENTEDGE,
 |  | int | x = CW_USEDEFAULT,
 |  | int | y = CW_USEDEFAULT,
 |  | int | cx = CW_USEDEFAULT,
 |  | int | cy = CW_USEDEFAULT |
 | ) |  |  | [virtual]

Definition at line 928 of file cdialoglite.cpp.

{
  ASSERT(IsDestroyed());
  m_hWndParent = hWndMDIClient;
  WNDCLASS wc;

  //Convert the Params
  CHAR szClassName[MAX_NAME_LEN] = {0};
  ConvertToMBCS(pwszClassName, szClassName, MAX_NAME_LEN);
  CHAR szWindowName[MAX_NAME_LEN] = {0};
  ConvertToMBCS(pwszWindowName, szWindowName, MAX_NAME_LEN);

  // Register MDI Window classes, if we haven't done so already...
  if(!GetClassInfo(GetAppLite()->m_hInstance, szClassName, &wc))
  {
    wc.style      = 0;
    wc.lpfnWndProc    = MDIWndProc;
    wc.cbClsExtra   = 0;
    wc.cbWndExtra   = DLGWINDOWEXTRA;
    wc.hInstance    = GetAppLite()->m_hInstance;
    wc.hIcon      = hIcon;
    wc.hCursor      = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground  = (HBRUSH)(COLOR_WINDOW+1);
    wc.lpszMenuName   = MAKEINTRESOURCE(uID);
    wc.lpszClassName  = szClassName;

    // register MDI Child Window Class
    if(!RegisterClass(&wc))
      return FALSE;
  }

  //Setup CreateStruct
  CREATESTRUCTW cs;
  cs.dwExStyle    = dwExStyle;
  cs.lpszClass    = pwszClassName;
  cs.lpszName     = pwszWindowName;
  cs.style      = dwStyle;
  cs.x        = x;
  cs.y        = y;
  cs.cx       = cx;
  cs.cy       = cy;
  cs.hwndParent   = m_hWndParent;
  cs.hMenu      = (HMENU)(ULONG_PTR)uID;
  cs.hInstance    = GetAppLite()->m_hInstance;
  cs.lpCreateParams = this;

  //Allow Modification of CreateParams...
  if(!PreCreateWindow(cs))
    return FALSE;

  //Setup MDICREATESTRUCT for real create
  MDICREATESTRUCTA mcs;
  mcs.szClass   = szClassName;
  mcs.szTitle   = szWindowName;
  mcs.hOwner    = cs.hInstance;
  mcs.x     = cs.x;
  mcs.y     = cs.y;
  mcs.cx      = cs.cx;
  mcs.cy      = cs.cy;
  mcs.style   = cs.style;
  mcs.lParam    = (LPARAM)this;

  //Copy the Class Name
  SAFE_FREE(m_pwszClassName);
  m_pwszClassName = wcsDuplicate(pwszClassName);

  //Create the window through the MDICLIENT window
  m_hWnd = (HWND)::SendMessage(hWndMDIClient, WM_MDICREATE, 0, (LPARAM)&mcs);

  //Assoicate this window with this class
  if(m_hWnd)
  {
    SetThis(m_hWnd, this);
    OnInitialUpdate();
  }

  return m_hWnd != NULL;
}

BOOL CMDIChildLite::HandleMessage | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 1024 of file cdialoglite.cpp.

{
  switch(msg)
  {
    case WM_MDIACTIVATE:
      return OnMDIActivate(lParam ? TRUE : FALSE, (HWND)lParam, (HWND)wParam);
  }

  //Otherwise delegate
  return CWndLite::HandleMessage(hWnd, msg, wParam, lParam);
}

LRESULT WINAPI CMDIChildLite::MDIWndProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 1071 of file cdialoglite.cpp.

{
  switch(msg)
  {
    case WM_CREATE:
        {
      //Save the Window Handle
      CREATESTRUCT* pCS = (CREATESTRUCT*)lParam;
      MDICREATESTRUCT* pMDICS = (MDICREATESTRUCT*)pCS->lpCreateParams;
      CMDIChildLite* pCMDIChildLite = (CMDIChildLite*)pMDICS->lParam;

      //Save the "this" pointer
      SetThis(hWnd, pCMDIChildLite);

      //NOTE:  Inside CMDIChildLite::Create it has to call SendMessage
      //with MDICREATE inorder to create the window.  The problem is that
      //the window handle is returned from the message, and user code
      //within OnCreate may need the window handle to setup controls...
      pCMDIChildLite->m_hWnd = hWnd;
      if(pCMDIChildLite->OnCreate(pCS))
        return 0;
      return -1;
    }
  };

  //Otherwise just pass on message to original control
  return WndProc(hWnd, msg, wParam, lParam);
}

BOOL CMDIChildLite::OnMDIActivate | ( | BOOL | bActivate,
 |  | HWND | hWndActivate,
 |  | HWND | hWndDeactivate |
 | ) |  |  | [virtual]

Reimplemented in CMDIChild, CMDIObjects, and CMDITrace.

Definition at line 1041 of file cdialoglite.cpp.

{
  return FALSE;
}

LRESULT CMDIChildLite::UnhandledMessage | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 1061 of file cdialoglite.cpp.

{
  return DefMDIChildProc(hWnd, msg, wParam, lParam);
}

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialoglite.h
  • Dataaccess/oledb/rowsetviewer/cdialoglite.cpp
Generated on Wed Nov 13 2024 16:56:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMDIFrameLite Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CMDIFrameLite Class Reference

#include "cdialoglite.h"

Inherits CFrameWndLite.

Inherited by CMainWindow.

List of all members.

Public Member Functions

CMDIFrameLite ()
virtual | ~CMDIFrameLite ()
virtual CMDIChildLite * | FindWindow (WCHAR *pwszClassName=NULL)
virtual CMDIChildLite * | GetActiveWindow (WCHAR *pwszClassName=NULL)
virtual BOOL | IsDestroyed ()
virtual void | MDIActivate (HWND hWnd)
virtual void | MDIDestroy (HWND hWnd)
virtual void | OnAutoPosition ()
virtual BOOL | OnCommand (UINT iID, HWND hWndCtrl)
virtual BOOL | OnCommandNotify (INT wNotifyCode, INT iID, HWND hWndCtrl)
virtual BOOL | OnCreate (CREATESTRUCT *pCREATESTRUCT)
virtual BOOL | OnCreateClient (CREATESTRUCT *pCREATESTRUCT)
virtual BOOL | OnDestroy ()
virtual BOOL | OnNotify (INT idCtrl, NMHDR *pNMHDR)
virtual BOOL | OnUpdateCommand (HMENU hMenu, UINT nID, DWORD *pdwFlags)
virtual BOOL | PreTranslateMessage (MSG *pmsg)
virtual LRESULT | UnhandledMessage (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)

Public Attributes

HWND | m_hWndMDIClient

Detailed Description

Definition at line 287 of file cdialoglite.h.

Constructor & Destructor Documentation

CMDIFrameLite::CMDIFrameLite ( )

Definition at line 1263 of file cdialoglite.cpp.

{
  m_hWndMDIClient = NULL;
}

CMDIFrameLite::~CMDIFrameLite ( ) [virtual]

Definition at line 1273 of file cdialoglite.cpp.

{
}

Member Function Documentation

CMDIChildLite * CMDIFrameLite::FindWindow ( WCHAR * pwszClassName = NULL ) [virtual]

Definition at line 1451 of file cdialoglite.cpp.

{
  ASSERT(pwszClassName);

  //Obtain the first Active Child Window...
  HWND hWndChild = GetWindow(m_hWndMDIClient, GW_CHILD);
  while(hWndChild)
  {
    CMDIChildLite* pCMDIChildLite = (CMDIChildLite*)GetThis(hWndChild);
    if(pCMDIChildLite)
    {
      //Return the first child of the specified type...
      if(StringCompare(pCMDIChildLite->m_pwszClassName, pwszClassName))
        return pCMDIChildLite;
    }

    //Get the Next Window
    hWndChild = GetWindow(hWndChild, GW_HWNDNEXT);
  }

  return NULL;
}

CMDIChildLite * CMDIFrameLite::GetActiveWindow ( WCHAR * pwszClassName = NULL ) [virtual]

Definition at line 1419 of file cdialoglite.cpp.

{
  ASSERT(m_hWndMDIClient);

  //Obtain the first Active Child Window...
  HWND hWndChild = GetWindow(m_hWndMDIClient, GW_CHILD);
  if(hWndChild)
  {
    //Return the first child of the specified type...
    CMDIChildLite* pCMDIChildLite = (CMDIChildLite*)GetThis(hWndChild);
    if(pCMDIChildLite)
    {
      if(pwszClassName)
      {
        if(StringCompare(pwszClassName, pCMDIChildLite->m_pwszClassName))
          return pCMDIChildLite;
      }
      else
      {
        return pCMDIChildLite;
      }
    }
  }

  return NULL;
}

virtual BOOL CMDIFrameLite::IsDestroyed ( ) [inline, virtual]

Reimplemented from CWndLite.

Definition at line 321 of file cdialoglite.h.

{ return !m_hWndMDIClient && CFrameWndLite::IsDestroyed();      }

virtual void CMDIFrameLite::MDIActivate ( HWND hWnd ) [inline, virtual]

Definition at line 313 of file cdialoglite.h.

{ SendMessage(m_hWndMDIClient, WM_MDIACTIVATE, (WPARAM)hWnd, 0);  }

virtual void CMDIFrameLite::MDIDestroy ( HWND hWnd ) [inline, virtual]

Definition at line 314 of file cdialoglite.h.

{ SendMessage(m_hWndMDIClient, WM_MDIDESTROY, (WPARAM)hWnd, 0);   }

void CMDIFrameLite::OnAutoPosition ( ) [virtual]

Definition at line 1479 of file cdialoglite.cpp.

{
  //Auto Position all children...
  HWND hWndChild = GetWindow(m_hWndMDIClient, GW_CHILD);
  while(hWndChild)
  {
    CMDIChildLite* pCMDIChildLite = (CMDIChildLite*)GetThis(hWndChild);
    if(pCMDIChildLite)
      pCMDIChildLite->AutoPosition();

    //Get the Next Window
    hWndChild = GetWindow(hWndChild, GW_HWNDNEXT);
  }
}

BOOL CMDIFrameLite::OnCommand | ( | UINT | iID,
 |  | HWND | hWndCtrl |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Reimplemented in CMainWindow.

Definition at line 1362 of file cdialoglite.cpp.

{
  CWndLite* pCWndLite = GetActiveWindow();
  if(pCWndLite)
    if(pCWndLite->OnCommand(iID, hWndCtrl))
      return TRUE;

  return FALSE;
}

BOOL CMDIFrameLite::OnCommandNotify | ( | INT | wNotifyCode,
 |  | INT | iID,
 |  | HWND | hWndCtrl |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 1347 of file cdialoglite.cpp.

{
  CWndLite* pCWndLite = GetActiveWindow();
  if(pCWndLite)
    if(pCWndLite->OnCommandNotify(wNotifyCode, iID, hWndCtrl))
      return TRUE;

  return FALSE;
}

BOOL CMDIFrameLite::OnCreate ( CREATESTRUCT * pCREATESTRUCT ) [virtual]

Reimplemented from CWndLite.

Definition at line 1293 of file cdialoglite.cpp.

{
  //Delegate
  if(CFrameWndLite::OnCreate(pCREATESTRUCT))
  {
    //Now Create the MDI Client...
    return OnCreateClient(pCREATESTRUCT);
  }

  return FALSE;
}

BOOL CMDIFrameLite::OnCreateClient ( CREATESTRUCT * pCREATESTRUCT ) [virtual]

Definition at line 1324 of file cdialoglite.cpp.

{
  DWORD dwStyle = WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | /*WS_VSCROLL | WS_HSCROLL |*/ WS_VISIBLE | CS_DBLCLKS;
  DWORD dwExStyle = WS_EX_CLIENTEDGE;

  //Now Setup MDI CreateStruct
  CLIENTCREATESTRUCT  ccs;
  ccs.hWindowMenu   = NULL;//GetSubMenu(GetMenu(m_hWnd), 9/*IDMENU_WINDOW*/);//TODO     //TODO
  ccs.idFirstChild  = IDC_MDICHILD;

  //Now we need to Create the MDI Client Window...
  m_hWndMDIClient = CreateWindowExA(dwExStyle, "MDICLIENT", NULL, dwStyle,
      CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
      m_hWnd, (HMENU)ID_MDICLIENT, GetAppLite()->m_hInstance, (LPSTR)&ccs);

  return m_hWndMDIClient != NULL;
}

BOOL CMDIFrameLite::OnDestroy ( ) [virtual]

Reimplemented from CFrameWndLite.

Reimplemented in CMainWindow.

Definition at line 1310 of file cdialoglite.cpp.

{
  //Remove window items...
  m_hWndMDIClient = NULL;

  //Delegate
  return CFrameWndLite::OnDestroy();
}

BOOL CMDIFrameLite::OnNotify | ( | INT | idCtrl,
 |  | NMHDR * | pNMHDR |
 | ) |  |  | [virtual]

Reimplemented from CFrameWndLite.

Definition at line 1392 of file cdialoglite.cpp.

{
  CWndLite* pCWndLite = GetActiveWindow();
  if(pCWndLite)
    if(pCWndLite->OnNotify(idCtrl, pNMHDR))
      return TRUE;

  //Delegate
  return CFrameWndLite::OnNotify(idCtrl, pNMHDR);
}

BOOL CMDIFrameLite::OnUpdateCommand | ( | HMENU | hMenu,
 |  | UINT | nID,
 |  | DWORD * | pdwFlags |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Reimplemented in CMainWindow.

Definition at line 1377 of file cdialoglite.cpp.

{
  CWndLite* pCWndLite = GetActiveWindow();
  if(pCWndLite)
    if(pCWndLite->OnUpdateCommand(hMenu, nID, pdwFlags))
      return TRUE;

  return FALSE;
}

BOOL CMDIFrameLite::PreTranslateMessage ( MSG * pmsg ) [virtual]

Reimplemented from CFrameWndLite.

Definition at line 1408 of file cdialoglite.cpp.

{
  //Check for MDI accelerators
  return m_hWndMDIClient && TranslateMDISysAccel(m_hWndMDIClient, pmsg);
}

LRESULT CMDIFrameLite::UnhandledMessage | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 1282 of file cdialoglite.cpp.

{
  //Need to pass unhandled messges to the MDI client...
  return DefFrameProc(hWnd, m_hWndMDIClient, msg, wParam, lParam);
}

Member Data Documentation

HWND CMDIFrameLite::m_hWndMDIClient

Definition at line 325 of file cdialoglite.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialoglite.h
  • Dataaccess/oledb/rowsetviewer/cdialoglite.cpp
Generated on Wed Nov 13 2024 16:56:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMDIObjects Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CMDIObjects Class Reference

#include "cobjtree.h"

Inherits CMDIChildLite.

List of all members.

Public Member Functions

CMDIObjects (CMainWindow *pCMainWindow)
virtual | ~CMDIObjects ()
virtual BOOL | AutoPosition (BOOL fDefaultPosition=TRUE)
virtual BOOL | OnClose ()
virtual BOOL | OnCommand (UINT iID, HWND hWndCtrl)
virtual BOOL | OnCreate (LPCREATESTRUCT lpCreateStruct)
virtual BOOL | OnDestroy ()
virtual BOOL | OnInitialUpdate ()
virtual BOOL | OnMDIActivate (BOOL bActivate, HWND hWndActivate, HWND hWndDeactivate)
virtual BOOL | OnNotify (INT idCtrl, NMHDR *pNMHDR)
virtual BOOL | OnSetFocus (HWND hWndPrevFocus)
virtual BOOL | OnSize (WPARAM nType, REFPOINTS pts)
virtual BOOL | OnUpdateCommand (HMENU hMenu, UINT nID, DWORD *pdwFlags)
virtual BOOL | PreCreateWindow (CREATESTRUCTW &cs)
virtual BOOL | UpdateControls ()

Public Attributes

CMainWindow * m_pCMainWindow
CObjTree * m_pCObjTree

Detailed Description

Definition at line 60 of file cobjtree.h.

Constructor & Destructor Documentation

CMDIObjects::CMDIObjects ( CMainWindow * pCMainWindow )

Definition at line 379 of file cobjtree.cpp.

{
  //Objects
  ASSERT(pCMainWindow);
  m_pCMainWindow = pCMainWindow;

  //Controls
  m_pCObjTree   = new CObjTree(pCMainWindow);
}

CMDIObjects::~CMDIObjects ( ) [virtual]

Definition at line 394 of file cobjtree.cpp.

{
  //Controls
  SAFE_DELETE(m_pCObjTree);
}

Member Function Documentation

BOOL CMDIObjects::AutoPosition ( BOOL fDefaultPosition = TRUE ) [virtual]

Reimplemented from CMDIChildLite.

Definition at line 427 of file cobjtree.cpp.

{
  if(fDefaultPosition || m_wndPlacement.length == 0)
  {
    //Default setting, left corner (1/4 of the client area)...
    SIZE sizeClient = GetClientSize(m_pCMainWindow->m_hWndMDIClient);
    return MoveWindow(m_hWnd, 0, 0, (INT)((float)sizeClient.cx * 0.25), sizeClient.cy, TRUE);
  }
  else
  {
    return SetWindowPlacement();
  }
}

BOOL CMDIObjects::OnClose ( ) [virtual]

Reimplemented from CWndLite.

Definition at line 481 of file cobjtree.cpp.

{
  //NOTE:  OnClose only gets hit for MDI Child Windows when the user actually
  //closes the window.  If the mainframe window is closed directly then OnClose is never fired...

  //Due to this, if the user has closed the window before exiting the app, then all we really
  //want to do is make the window not-visible, so if they bring the window up again it has all
  //the info saved.

  ShowWindow(SW_HIDE);

  //NOTE:  Don't delegate the call, since we don't want to "DestroyWindow"
  return TRUE;
}

BOOL CMDIObjects::OnCommand | ( | UINT | iID,
 |  | HWND | hWndCtrl |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 560 of file cobjtree.cpp.

{
  return m_pCObjTree->OnCommand(iID, hWndCtrl);
}

BOOL CMDIObjects::OnCreate ( LPCREATESTRUCT lpCreateStruct ) [virtual]

Definition at line 446 of file cobjtree.cpp.

{
  //Create Object Tree
  SIZE size = GetClientSize(m_hWnd);
  m_pCObjTree->Create(m_hWnd, WC_TREEVIEWW, NULL, ID_OBJECTTREE,
    WS_CHILD | WS_VISIBLE | WS_BORDER | WS_HSCROLL | WS_VSCROLL | WS_TABSTOP | /*TVS_EDITLABELS |*/ TVS_LINESATROOT | TVS_HASBUTTONS | TVS_HASLINES | TVS_SHOWSELALWAYS, WS_EX_CLIENTEDGE,
    0, 0, size.cx, size.cy);
  TreeView_SetImageList(m_pCObjTree->m_hWnd, ImageList_LoadImage(GetAppLite()->m_hInstance, MAKEINTRESOURCE(IDB_IMAGE), 16, 16, CLR_DEFAULT , IMAGE_BITMAP, LR_DEFAULTCOLOR), TVSIL_NORMAL);
  m_pCObjTree->OnCreate(NULL);

  //Window Position
  AutoPosition(m_wndPlacement.length == 0/*fDefaultPosition*/);
  return TRUE;
}

BOOL CMDIObjects::OnDestroy ( ) [virtual]

Reimplemented from CWndLite.

Definition at line 466 of file cobjtree.cpp.

{
  //Save Window Positions
  if(GetWindowPlacement())
    SetRegEntry(HKEY_ROWSETVIEWER, wszOBJECTS_KEY, L"WinPosition",  &m_wndPlacement,  sizeof(m_wndPlacement));

  //Delegate
  return CMDIChildLite::OnDestroy();
}

BOOL CMDIObjects::OnInitialUpdate ( ) [virtual]

Reimplemented from CWndLite.

Definition at line 501 of file cobjtree.cpp.

{
  return TRUE;
}

BOOL CMDIObjects::OnMDIActivate | ( | BOOL | bActivate,
 |  | HWND | hWndActivate,
 |  | HWND | hWndDeactivate |
 | ) |  |  | [virtual]

Reimplemented from CMDIChildLite.

Definition at line 511 of file cobjtree.cpp.

{
  //So see if this window is being activated or deactivated
  if(hWndActivate == m_hWnd)
  {
    //Refresh all Controls
    UpdateControls();
  }
  return TRUE;
}

BOOL CMDIObjects::OnNotify | ( | INT | idCtrl,
 |  | NMHDR * | pNMHDR |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 549 of file cobjtree.cpp.

{
  return m_pCObjTree->OnNotify(idCtrl, pNMHDR);
}

BOOL CMDIObjects::OnSetFocus ( HWND hWndPrevFocus ) [virtual]

Reimplemented from CWndLite.

Definition at line 601 of file cobjtree.cpp.

{
  m_pCObjTree->SetFocus();
  return TRUE;
}

BOOL CMDIObjects::OnSize | ( | WPARAM | nType,
 |  | REFPOINTS | pts |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 570 of file cobjtree.cpp.

{
  ASSERT(m_pCObjTree->m_hWnd);

  switch(nType)
  {
    case SIZE_RESTORED:
    case SIZE_MAXIMIZED:
    {
      if(pts.x && pts.y)
      {
        //Obtain window sizes...
        MoveWindow(m_pCObjTree->m_hWnd, 0, 0, pts.x, pts.y, TRUE);

        //Call default procedure first,
        //to let MDI position the child & then move its children
        //We simply do this by returning false, to indicate we didn't handle it...
        return FALSE;
      }
      break;
    }
  };

  return FALSE;
}

BOOL CMDIObjects::OnUpdateCommand | ( | HMENU | hMenu,
 |  | UINT | nID,
 |  | DWORD * | pdwFlags |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 539 of file cobjtree.cpp.

{
  return m_pCObjTree->OnUpdateCommand(hMenu, nID, pdwFlags);
}

BOOL CMDIObjects::PreCreateWindow ( CREATESTRUCTW & cs ) [virtual]

Reimplemented from CWndLite.

Definition at line 406 of file cobjtree.cpp.

{
  //Load Saved Window Positions
  memset(&m_wndPlacement, 0, sizeof(m_wndPlacement));
  GetRegEntry(HKEY_ROWSETVIEWER, wszOBJECTS_KEY, L"WinPosition",  &m_wndPlacement, sizeof(m_wndPlacement), NULL);

  //Window Hidden?
  if(m_wndPlacement.length)
  {
    if(m_wndPlacement.showCmd == SW_HIDE)
      cs.style &= ~WS_VISIBLE;
  }

  return TRUE;
}

BOOL CMDIObjects::UpdateControls ( ) [virtual]

Definition at line 527 of file cobjtree.cpp.

{
  //ToolBar Buttons
  m_pCMainWindow->UpdateControls();
  return TRUE;
}

Member Data Documentation

CMainWindow* CMDIObjects::m_pCMainWindow

Definition at line 89 of file cobjtree.h.

CObjTree* CMDIObjects::m_pCObjTree

Definition at line 90 of file cobjtree.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cobjtree.h
  • Dataaccess/oledb/rowsetviewer/cobjtree.cpp
Generated on Wed Nov 13 2024 16:56:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMDITrace Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CMDITrace Class Reference

#include "ctrace.h"

Inherits CMDIChildLite.

List of all members.

Public Member Functions

CMDITrace (CMainWindow *pCMainWindow)
virtual | ~CMDITrace ()
virtual BOOL | AutoPosition (BOOL fDefaultPosition=TRUE)
virtual BOOL | OnClose ()
virtual BOOL | OnCommand (UINT iID, HWND hWndCtrl)
virtual BOOL | OnCreate (LPCREATESTRUCT lpCreateStruct)
virtual BOOL | OnDestroy ()
virtual BOOL | OnInitialUpdate ()
virtual BOOL | OnMDIActivate (BOOL bActivate, HWND hWndActivate, HWND hWndDeactivate)
virtual BOOL | OnNotify (INT idCtrl, NMHDR *pNMHDR)
virtual BOOL | OnSetFocus (HWND hWndPrevFocus)
virtual BOOL | OnSize (WPARAM nType, REFPOINTS pts)
virtual BOOL | OnUpdateCommand (HMENU hMenu, UINT nID, DWORD *pdwFlags)
virtual BOOL | PreCreateWindow (CREATESTRUCTW &cs)
virtual BOOL | UpdateControls ()

Public Attributes

CMainWindow * m_pCMainWindow
CIntTrace * m_pCTrace

Detailed Description

Definition at line 84 of file ctrace.h.

Constructor & Destructor Documentation

CMDITrace::CMDITrace ( CMainWindow * pCMainWindow )

Definition at line 463 of file ctrace.cpp.

{
  //Objects
  ASSERT(pCMainWindow);
  m_pCMainWindow = pCMainWindow;

  //Controls
  m_pCTrace   = new CIntTrace(pCMainWindow);
}

CMDITrace::~CMDITrace ( ) [virtual]

Definition at line 478 of file ctrace.cpp.

{
  //Controls
  SAFE_DELETE(m_pCTrace);
}

Member Function Documentation

BOOL CMDITrace::AutoPosition ( BOOL fDefaultPosition = TRUE ) [virtual]

Reimplemented from CMDIChildLite.

Definition at line 510 of file ctrace.cpp.

{
  if(fDefaultPosition || m_wndPlacement.length == 0)
  {
    //Default setting, bottom right corner (1/4 of the client area)...
    SIZE sizeClient = GetClientSize(m_pCMainWindow->m_hWndMDIClient);
    return MoveWindow(m_hWnd, (INT)((float)sizeClient.cx * 0.25), (INT)((float)sizeClient.cy * 0.75), (INT)((float)sizeClient.cx * 0.75), (INT)((float)sizeClient.cy * 0.25), TRUE);
  }
  else
  {
    return SetWindowPlacement();
  }
}

BOOL CMDITrace::OnClose ( ) [virtual]

Reimplemented from CWndLite.

Definition at line 570 of file ctrace.cpp.

{
  //NOTE:  OnClose only gets hit for MDI Child Windows when the user actually
  //closes the window.  If the mainframe window is closed directly then OnClose is never fired...

  //Due to this, if the user has closed the window before exiting the app, then all we really
  //want to do is make the window not-visible, so if they bring the window up again it has all
  //the info saved.
  ShowWindow(SW_HIDE);

  //NOTE:  Don't delegate the call, since we don't want to "DestroyWindow"
  return TRUE;
}

BOOL CMDITrace::OnCommand | ( | UINT | iID,
 |  | HWND | hWndCtrl |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 649 of file ctrace.cpp.

{
  return m_pCTrace->OnCommand(iID, hWndCtrl);
}

BOOL CMDITrace::OnCreate ( LPCREATESTRUCT lpCreateStruct ) [virtual]

Definition at line 529 of file ctrace.cpp.

{
  //Create Trace Window
  //NOTE: The older richedit control (RichEd32.dll - 1.0 version) requires the cx,cy to be none-0
  //Otherwise the control will fail to be created.
  SIZE size = GetClientSize(m_hWnd);
  m_pCTrace->Create(m_hWnd, m_pCMainWindow->m_hLibRichEdit20 ? (IsUnicodeOS() ? L"RichEdit20W" : L"RichEdit20A") : L"RICHEDIT", NULL, ID_MDITRACE,
    WS_CHILD | WS_VISIBLE | WS_BORDER | WS_HSCROLL | WS_VSCROLL | WS_TABSTOP | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_DISABLENOSCROLL | ES_MULTILINE | ES_NOHIDESEL | ES_SELECTIONBAR | ES_READONLY, WS_EX_CLIENTEDGE,
    0, 0, size.cx, size.cy);
  m_pCTrace->OnCreate(NULL);

  //By default the RichEdit controls have a HUGE text.  Instead of setting it
  //to a small size font which is difficult for some international lcids, we will
  //set it to the same font as the Tree control...
  m_pCTrace->SetFont(m_pCMainWindow->m_pCMDIObjects->m_pCObjTree->GetFont());

  //Window Position
  AutoPosition(m_wndPlacement.length == 0/*fDefaultPosition*/);
  return TRUE;
}

BOOL CMDITrace::OnDestroy ( ) [virtual]

Reimplemented from CWndLite.

Definition at line 555 of file ctrace.cpp.

{
  //Save Window Positions
  if(GetWindowPlacement())
    SetRegEntry(HKEY_ROWSETVIEWER, wszTRACE_KEY, L"WinPosition",  &m_wndPlacement,  sizeof(m_wndPlacement));

  //Delegate
  return CMDIChildLite::OnDestroy();
}

BOOL CMDITrace::OnInitialUpdate ( ) [virtual]

Reimplemented from CWndLite.

Definition at line 589 of file ctrace.cpp.

{
  return TRUE;
}

BOOL CMDITrace::OnMDIActivate | ( | BOOL | bActivate,
 |  | HWND | hWndActivate,
 |  | HWND | hWndDeactivate |
 | ) |  |  | [virtual]

Reimplemented from CMDIChildLite.

Definition at line 599 of file ctrace.cpp.

{
  //So see if this window is being activated or deactivated
  if(hWndActivate == m_hWnd)
  {
    //Refresh all Controls
    UpdateControls();
  }
  return TRUE;
}

BOOL CMDITrace::OnNotify | ( | INT | idCtrl,
 |  | NMHDR * | pNMHDR |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 637 of file ctrace.cpp.

{
  //Delegate
  return m_pCTrace->OnNotify(idCtrl, pNMHDR);
}

BOOL CMDITrace::OnSetFocus ( HWND hWndPrevFocus ) [virtual]

Reimplemented from CWndLite.

Definition at line 690 of file ctrace.cpp.

{
  m_pCTrace->SetFocus();
  return TRUE;
}

BOOL CMDITrace::OnSize | ( | WPARAM | nType,
 |  | REFPOINTS | pts |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 659 of file ctrace.cpp.

{
  ASSERT(m_pCTrace->m_hWnd);

  switch(nType)
  {
    case SIZE_RESTORED:
    case SIZE_MAXIMIZED:
    {
      if(pts.x && pts.y)
      {
        //Obtain window sizes...
        MoveWindow(m_pCTrace->m_hWnd, 0, 0, pts.x, pts.y, TRUE);

        //Call default procedure first,
        //to let MDI position the child & then move its children
        //We simply do this by returning false, to indicate we didn't handle it...
        return FALSE;
      }
      break;
    }
  };

  return FALSE;
}

BOOL CMDITrace::OnUpdateCommand | ( | HMENU | hMenu,
 |  | UINT | nID,
 |  | DWORD * | pdwFlags |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 627 of file ctrace.cpp.

{
  return m_pCTrace->OnUpdateCommand(hMenu, nID, pdwFlags);
}

BOOL CMDITrace::PreCreateWindow ( CREATESTRUCTW & cs ) [virtual]

Reimplemented from CWndLite.

Definition at line 489 of file ctrace.cpp.

{
  //Load Saved Window Positions
  memset(&m_wndPlacement, 0, sizeof(m_wndPlacement));
  GetRegEntry(HKEY_ROWSETVIEWER, wszTRACE_KEY, L"WinPosition", &m_wndPlacement, sizeof(m_wndPlacement), NULL);

  //Window Hidden?
  if(m_wndPlacement.length)
  {
    if(m_wndPlacement.showCmd == SW_HIDE)
      cs.style &= ~WS_VISIBLE;
  }

  return TRUE;
}

BOOL CMDITrace::UpdateControls ( ) [virtual]

Definition at line 615 of file ctrace.cpp.

{
  //ToolBar Buttons
  m_pCMainWindow->UpdateControls();
  return TRUE;
}

Member Data Documentation

CMainWindow* CMDITrace::m_pCMainWindow

Definition at line 113 of file ctrace.h.

CIntTrace* CMDITrace::m_pCTrace

Definition at line 114 of file ctrace.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/ctrace.h
  • Dataaccess/oledb/rowsetviewer/ctrace.cpp
Generated on Wed Nov 13 2024 16:56:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMember Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CMember Class Reference

#include "session.h"

List of all members.

Public Member Functions

CMember (INmMember *)
CMember (AppletRecord *)
~CMember (void)
void | ClearInRosterFlag (void)
LPTSTR | GetName (void)
AppletUserID | GetUID (void)
BOOL | IsEmptyMember (void)
BOOL | IsEmptyUID (void)
BOOL | IsInRoster (void)
BOOL | IsSameMemberID (AppletNodeID nid)
BOOL | IsSameUID (AppletUserID uid)
void | SetInRosterFlag (void)
void | SetMember (AppletRecord *, BOOL fFirstTime=FALSE)
void | SetMember (INmMember *, BOOL fFirstTime=FALSE)

Private Member Functions

void | Initialize (void)

Private Attributes

AppletEntityID m_eidMember
BOOL m_fInRoster
AppletNodeID m_nidMember
LPTSTR m_pszMemberName
AppletUserID m_uidMember

Detailed Description

Definition at line 151 of file session.h.

Constructor & Destructor Documentation

CMember::CMember ( INmMember * pIMember )

Definition at line 1096 of file session.cpp.

{
    Initialize();
    SetMember(pIMember, TRUE);
}

CMember::CMember ( AppletRecord * pRecord )

Definition at line 1103 of file session.cpp.

{
    Initialize();
    SetMember(pRecord, TRUE);
}

CMember::~CMember ( void )

Definition at line 1110 of file session.cpp.

{
    ::UiRemoveMember(this);
    delete m_pszMemberName;
}

Member Function Documentation

void CMember::ClearInRosterFlag ( void ) [inline]

Definition at line 174 of file session.h.

{ m_fInRoster = FALSE; }

LPTSTR CMember::GetName ( void ) [inline]

Definition at line 168 of file session.h.

{ return m_pszMemberName; }

AppletUserID CMember::GetUID ( void ) [inline]

Definition at line 170 of file session.h.

{ return m_uidMember; }

void CMember::Initialize ( void ) [private]

Definition at line 1117 of file session.cpp.

{
    m_fInRoster = FALSE;
    m_pszMemberName = NULL;
    m_nidMember = 0;
    m_uidMember = 0;
    m_eidMember = 0;
}

BOOL CMember::IsEmptyMember ( void ) [inline]

Definition at line 166 of file session.h.

{ return (NULL == m_pszMemberName); }

BOOL CMember::IsEmptyUID ( void ) [inline]

Definition at line 163 of file session.h.

{ return (0 == m_uidMember); }

BOOL CMember::IsInRoster ( void ) [inline]

Definition at line 172 of file session.h.

{ return m_fInRoster; }

BOOL CMember::IsSameMemberID ( AppletNodeID nid ) [inline]

Definition at line 165 of file session.h.

{ return (nid == m_nidMember); }

BOOL CMember::IsSameUID ( AppletUserID uid ) [inline]

Definition at line 162 of file session.h.

{ return (uid == m_uidMember); }

void CMember::SetInRosterFlag ( void ) [inline]

Definition at line 173 of file session.h.

{ m_fInRoster = TRUE; }

void CMember::SetMember | ( | INmMember * | pIMember,
 |  | BOOL | fFirstTime = FALSE
 | ) |  |

Definition at line 1127 of file session.cpp.

{
    ASSERT(NULL != pIMember);
  if(NULL == pIMember)
  {
    return;
  }

    BSTR bstr = NULL;
    HRESULT hr = pIMember->GetName(&bstr);
    ASSERT(S_OK == hr);

    m_pszMemberName = ::PszFromBstr(bstr);
    ::SysFreeString(bstr);

    ULONG nMemberID = 0;
    hr = pIMember->GetID(&nMemberID);
    ASSERT(S_OK == hr);
    m_nidMember = (AppletNodeID) nMemberID;

    if (! fFirstTime)
    {
        ::UiAddMember(this);
    }
}

void CMember::SetMember | ( | AppletRecord * | pRecord,
 |  | BOOL | fFirstTime = FALSE
 | ) |  |

Definition at line 1154 of file session.cpp.

{
    if(NULL == pRecord)
  {
    return;
  }

  ASSERT(0 == m_uidMember);
    ASSERT(0 == m_eidMember);
    m_nidMember = pRecord->nNodeID;
    m_uidMember = pRecord->nAppletUserID;
    m_eidMember = pRecord->nEntityID;

    if (! fFirstTime)
    {
        ::UiAddMember(this);
    }
}

Member Data Documentation

AppletEntityID CMember::m_eidMember [private]

Definition at line 186 of file session.h.

BOOL CMember::m_fInRoster [private]

Definition at line 182 of file session.h.

AppletNodeID CMember::m_nidMember [private]

Definition at line 184 of file session.h.

LPTSTR CMember::m_pszMemberName [private]

Definition at line 183 of file session.h.

AppletUserID CMember::m_uidMember [private]

Definition at line 185 of file session.h.

The documentation for this class was generated from the following files:
  • Web/NetMeeting/NMChat2/session.h
  • Web/NetMeeting/NMChat2/session.cpp
Generated on Wed Nov 13 2024 16:56:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMemoryException Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CMemoryException Class Reference

List of all members.

Public Member Functions

void | Delete (void)
void | Delete (void)
void | Delete (void)

Detailed Description

Definition at line 34 of file PropList.cpp.

Member Function Documentation

void CMemoryException::Delete ( void ) [inline]

Definition at line 37 of file PropList.cpp.

{ }

void CMemoryException::Delete ( void ) [inline]

Definition at line 31 of file PropList.cpp.

{ }

void CMemoryException::Delete ( void ) [inline]

Definition at line 37 of file PropList.cpp.

{ }

The documentation for this class was generated from the following files:
  • WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/PropList.cpp
  • WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/PropList.cpp
  • WinBase/Cluster/Win2003/MyStorageResource/PropList.cpp
Generated on Wed Nov 13 2024 16:56:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMemoryMappedInputStream Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CMemoryMappedInputStream Class Reference

#include "InpStrm.Hxx"

List of all members.

Public Member Functions

CMemoryMappedInputStream ()
~CMemoryMappedInputStream ()
BOOL Eof ()
WCHAR | GetChar ()
void | Init (WCHAR *pwszFileName)
void | UnGetChar (WCHAR Wch)

Private Attributes

WCHAR | _awcTranslatedBuffer [TRANSLATED_CHAR_BUFFER_LENGTH]
ULONG _bytesReadFromMMBuffer
unsigned | _charsReadFromTranslatedBuffer
unsigned | _cwcTranslatedBuffer
BOOL _fUnGotChar
CMmStream _mmStream
CMmStreamConsecBuf _mmStreamBuf
ULONG _ulCodePage
WCHAR | _wch

Detailed Description

Definition at line 32 of file InpStrm.Hxx.

Constructor & Destructor Documentation

CMemoryMappedInputStream::CMemoryMappedInputStream ( )

Definition at line 27 of file InpStrm.Cxx.

    : _bytesReadFromMMBuffer(0),
      _charsReadFromTranslatedBuffer(0),
      _cwcTranslatedBuffer(0),
      _ulCodePage(LocaleToCodepage(GetSystemDefaultLCID())),
      _fUnGotChar(FALSE),
      _wch(0)
{
}

CMemoryMappedInputStream::~CMemoryMappedInputStream ( )

Definition at line 47 of file InpStrm.Cxx.

{
    if ( _mmStream.Ok() && _mmStreamBuf.Get() != 0 )
        _mmStream.Unmap( _mmStreamBuf );
}

Member Function Documentation

BOOL CMemoryMappedInputStream::Eof ( )

Definition at line 213 of file InpStrm.Cxx.

{
    if ( !_mmStream.Ok() )
        throw( CException( FILTER_E_ACCESS ) );

    if ( _fUnGotChar )
        return FALSE;

    if ( _charsReadFromTranslatedBuffer < _cwcTranslatedBuffer )
        return FALSE;

    if ( _bytesReadFromMMBuffer == _mmStreamBuf.Size() )
        return _mmStreamBuf.Eof();
    else
        return FALSE;
}

WCHAR CMemoryMappedInputStream::GetChar ( )

Definition at line 105 of file InpStrm.Cxx.

{
    if ( !_mmStream.Ok() || !_mmStreamBuf.Get() )
        throw( CException( FILTER_E_ACCESS ) );

    if ( _fUnGotChar )
    {
        _fUnGotChar = FALSE;
        return _wch;
    }

    if ( _charsReadFromTranslatedBuffer == _cwcTranslatedBuffer )
    {
        if ( _bytesReadFromMMBuffer == _mmStreamBuf.Size() )
        {
            if ( _mmStreamBuf.Eof() )
                return WEOF;

            //
            // Try to map in next chunk of file
            //
            _mmStreamBuf.Map( HTML_FILTER_CHUNK_SIZE );
            _bytesReadFromMMBuffer = 0;

            Win4Assert( _mmStreamBuf.Size() > _bytesReadFromMMBuffer );
        }

        ULONG cChUnread = _mmStreamBuf.Size() - _bytesReadFromMMBuffer;

        //
        // Since, the wide chars are precomposed, assume 1:1 translation mapping
        //
        ULONG cChIn = TRANSLATED_CHAR_BUFFER_LENGTH;
        if ( cChIn > cChUnread )
        {
            //
            // Not enough chars in input
            //
            cChIn = cChUnread;
        }

        ULONG cwcActual = 0;
        do
        {
            cwcActual = MultiByteToWideChar( _ulCodePage,
                                             MB_PRECOMPOSED,
                                             (char *) _mmStreamBuf.Get() + _bytesReadFromMMBuffer,
                                             cChIn,
                                             _awcTranslatedBuffer,
                                             TRANSLATED_CHAR_BUFFER_LENGTH );
            if ( cwcActual == 0 )
            {
                if ( GetLastError() == ERROR_INSUFFICIENT_BUFFER && cChIn >= 2 )
                    cChIn /= 2;
                else
                {
                    Win4Assert( !"CMemoryMappedInputStream::GetChar, cannot translate single char" );

                    throw( CException( GetLastError() ) );
                }
            }
        } while( cwcActual == 0 );

        Win4Assert( _bytesReadFromMMBuffer + cChIn <= _mmStreamBuf.Size() );
        Win4Assert( cwcActual <= TRANSLATED_CHAR_BUFFER_LENGTH );

        _bytesReadFromMMBuffer += cChIn;
        _charsReadFromTranslatedBuffer = 0;
        _cwcTranslatedBuffer = cwcActual;
    }

    return _awcTranslatedBuffer[_charsReadFromTranslatedBuffer++];
}

void CMemoryMappedInputStream::Init ( WCHAR * pwszFileName )

Definition at line 65 of file InpStrm.Cxx.

{
    Win4Assert( pwszFileName );

    _bytesReadFromMMBuffer = 0;

    if ( _mmStream.Ok() )
    {
        _mmStreamBuf.Rewind();
        _mmStream.Close();
    }

    _mmStream.Open( pwszFileName,
                    GENERIC_READ,
                    FILE_SHARE_READ,
                    OPEN_EXISTING );

    if ( _mmStream.Ok() )
    {
        _mmStreamBuf.Init( &_mmStream );
        if ( !_mmStream.isEmpty() )
            _mmStreamBuf.Map( HTML_FILTER_CHUNK_SIZE );
    }
    else
    {
        htmlDebugOut(( DEB_ERROR, "Throwing FILTER_E_ACCESS in CMemoryMappedInputStream::Init\n" ));
        throw( CException( FILTER_E_ACCESS ) );
    }
}

void CMemoryMappedInputStream::UnGetChar ( WCHAR Wch )

Definition at line 192 of file InpStrm.Cxx.

{
    //
    // We can unget only one char at a time
    //
    Win4Assert( !_fUnGotChar );

    _fUnGotChar = TRUE;
    _wch = wch;
}

Member Data Documentation

WCHAR CMemoryMappedInputStream::_awcTranslatedBuffer[TRANSLATED_CHAR_BUFFER_LENGTH] [private]

Definition at line 55 of file InpStrm.Hxx.

ULONG CMemoryMappedInputStream::_bytesReadFromMMBuffer [private]

Definition at line 45 of file InpStrm.Hxx.

unsigned CMemoryMappedInputStream::_charsReadFromTranslatedBuffer [private]

Definition at line 46 of file InpStrm.Hxx.

unsigned CMemoryMappedInputStream::_cwcTranslatedBuffer [private]

Definition at line 47 of file InpStrm.Hxx.

BOOL CMemoryMappedInputStream::_fUnGotChar [private]

Definition at line 49 of file InpStrm.Hxx.

CMmStream CMemoryMappedInputStream::_mmStream [private]

Definition at line 52 of file InpStrm.Hxx.

CMmStreamConsecBuf CMemoryMappedInputStream::_mmStreamBuf [private]

Definition at line 53 of file InpStrm.Hxx.

ULONG CMemoryMappedInputStream::_ulCodePage [private]

Definition at line 48 of file InpStrm.Hxx.

WCHAR CMemoryMappedInputStream::_wch [private]

Definition at line 50 of file InpStrm.Hxx.

The documentation for this class was generated from the following files:
  • WinBase/Indexing/IFilter/InpStrm.Hxx
  • WinBase/Indexing/IFilter/InpStrm.Cxx
Generated on Wed Nov 13 2024 16:56:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMessageDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions

CMessageDlg Class Reference

#include "MessageDlg.h"

List of all members.

Public Types

enum | { IDD = IDD_SEND_MESSAGE }

Public Member Functions

CMessageDlg (CWnd *pParent=NULL)

Public Attributes

CString m_message
CEdit | m_sendMessage
CEdit | m_serverName

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
virtual BOOL | OnInitDialog ()
afx_msg void | OnSendMessage ()

Detailed Description

Definition at line 15 of file MessageDlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 23 of file MessageDlg.h.

{ IDD = IDD_SEND_MESSAGE };

Constructor & Destructor Documentation

CMessageDlg::CMessageDlg ( CWnd * pParent = NULL )

Definition at line 23 of file MessageDlg.Cpp.

  : CDialog(CMessageDlg::IDD, pParent)
{
  //{{AFX_DATA_INIT(CMessageDlg)
  m_message = _T("");
  //}}AFX_DATA_INIT
}

Member Function Documentation

void CMessageDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 32 of file MessageDlg.Cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CMessageDlg)
  DDX_Control(pDX, IDC_SERVERNAME, m_serverName);
  DDX_Control(pDX, IDC_SEND_MESSAGE, m_sendMessage);
  DDX_Text(pDX, IDC_SEND_MESSAGE, m_message);
  //}}AFX_DATA_MAP
}

BOOL CMessageDlg::OnInitDialog ( void ) [protected, virtual]

Definition at line 77 of file MessageDlg.Cpp.

{
  CDialog::OnInitDialog();
  LPSTR serverName = g_pDoc->GetServerName();
  CString serverDisplay;
  serverDisplay = "Enter in message to send to ";
  if (*serverName == NULL)
    serverDisplay += "local server";
  else
    serverDisplay += serverName;
  m_serverName.SetWindowText(serverDisplay);

  return TRUE;  // return TRUE unless you set the focus to a control
                // EXCEPTION: OCX Property Pages should return FALSE
}

void CMessageDlg::OnSendMessage ( ) [protected]

Definition at line 52 of file MessageDlg.Cpp.

{
  LPSTR serverName = g_pDoc->GetServerName();
  HANDLE serverHandle =  WTSOpenServer(serverName);
  DWORD Response;
  int messageLength;
  m_sendMessage.GetWindowText(m_message);
  messageLength = m_message.GetLength();

  //int GetLine( int nIndex, LPTSTR lpszBuffer ) const;
  //int GetLineCount( ) const;

  if (WTSSendMessage(serverHandle, 0, "Test Message", sizeof("Test Message"),
      (char *) LPCTSTR(m_message), messageLength+1,
      MB_OKCANCEL, 5, &Response, 1))
    AfxMessageBox("Message was sent");
  else
    AfxMessageBox("Unable to send message");

  //CString temp
  //temp.Format("%d,

  WTSCloseServer(serverHandle);
}

Member Data Documentation

CString CMessageDlg::m_message

Definition at line 26 of file MessageDlg.h.

CEdit CMessageDlg::m_sendMessage

Definition at line 25 of file MessageDlg.h.

CEdit CMessageDlg::m_serverName

Definition at line 24 of file MessageDlg.h.

The documentation for this class was generated from the following files:
  • WinBase/WtsApi/WtsApi/MessageDlg.h
  • WinBase/WtsApi/WtsApi/MessageDlg.Cpp
Generated on Wed Nov 13 2024 16:56:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMetaTag Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CMetaTag Class Reference

#include "MetaTag.Hxx"

Inherits CHtmlElement.

List of all members.

Public Member Functions

CMetaTag (CHtmlIFilter &htmlIFilter, CSerialStream &serialStream, GUID ClsidMetaInfo)
virtual SCODE | GetChunk (STAT_CHUNK *pStat)
virtual SCODE | GetText (ULONG *pcwcOutput, WCHAR *awcBuffer)
virtual SCODE | GetValue (PROPVARIANT **ppPropValue)
virtual void | InitStatChunk (STAT_CHUNK *pStat)

Private Attributes

WCHAR | _awszPropSpec [MAX_PROPSPEC_STRING_LENGTH+1]
GUID | _clsidMetaInfo
unsigned | _cValueChars
MetaTagState _eState
WCHAR * | _pwcValueBuf

Detailed Description

Definition at line 31 of file MetaTag.Hxx.

Constructor & Destructor Documentation

CMetaTag::CMetaTag | ( | CHtmlIFilter & | htmlIFilter,
 |  | CSerialStream & | serialStream,
 |  | GUID | ClsidMetaInfo
 | ) |  |

Definition at line 31 of file MetaTag.Cxx.

    : CHtmlElement(htmlIFilter, serialStream),
      _clsidMetaInfo(clsidMetaInfo),
      _pwcValueBuf(0),
      _cValueChars(0),
      _eState(FilteringValue)
{
}

Member Function Documentation

SCODE CMetaTag::GetChunk ( STAT_CHUNK * pStat ) [virtual]

Implements CHtmlElement.

Definition at line 54 of file MetaTag.Cxx.

{
    SCODE sc = SwitchToNextHtmlElement( pStat );

    return sc;
}

SCODE CMetaTag::GetText | ( | ULONG * | pcwcOutput,
 |  | WCHAR * | awcBuffer |
 | ) |  |  | [virtual]

Implements CHtmlElement.

Definition at line 74 of file MetaTag.Cxx.

{
    return FILTER_E_NO_TEXT;
}

SCODE CMetaTag::GetValue ( PROPVARIANT ** ppPropValue ) [virtual]

Reimplemented from CHtmlElement.

Definition at line 90 of file MetaTag.Cxx.

{
    switch ( _eState )
    {
    case FilteringValue:
    {
        PROPVARIANT *pPropVar = (PROPVARIANT *) CoTaskMemAlloc( sizeof PROPVARIANT );
        if ( pPropVar == 0 )
            return E_OUTOFMEMORY;

        pPropVar->vt = VT_LPWSTR;
        pPropVar->pwszVal = (WCHAR *) CoTaskMemAlloc( ( _cValueChars + 1 ) * sizeof( WCHAR ) );
        if ( pPropVar->pwszVal == 0 )
        {
            CoTaskMemFree( (void *) pPropVar );
            return E_OUTOFMEMORY;
        }

        RtlCopyMemory( pPropVar->pwszVal, _pwcValueBuf, _cValueChars * sizeof(WCHAR) );
        pPropVar->pwszVal[_cValueChars] = 0;

        *ppPropValue = pPropVar;

        _eState = NoMoreValue;
        return S_OK;
    }

    case NoMoreValue:

        return FILTER_E_NO_MORE_VALUES;

    default:
        Win4Assert( !"CMetaTag::GetValue, unknown state" );
        return E_FAIL;
    }
}

void CMetaTag::InitStatChunk ( STAT_CHUNK * pStat ) [virtual]

Implements CHtmlElement.

Definition at line 138 of file MetaTag.Cxx.

{
    WCHAR *pwcName;
    unsigned cwcName;

    //
    // Read the names field
    //
    _scanner.ReadTagIntoBuffer();
    _scanner.ScanTagBuffer( L"name=\"", pwcName, cwcName );

    if ( cwcName == 0 )
    {
        //
        // Try to read http-equiv instead
        //
        _scanner.ScanTagBuffer( L"http-equiv=\"", pwcName, cwcName );
    }

    if ( cwcName == 0 )
    {
        //
        // Chunk of unknown type
        //
        _cValueChars = 0;
        pStat->attribute.psProperty.ulKind = PRSPEC_PROPID;
        pStat->attribute.psProperty.propid = 3;
    }
    else
    {
        _scanner.ScanTagBuffer( L"content=\"", _pwcValueBuf, _cValueChars );

        pStat->attribute.psProperty.ulKind = PRSPEC_LPWSTR;

        if ( cwcName > MAX_PROPSPEC_STRING_LENGTH )
            cwcName = MAX_PROPSPEC_STRING_LENGTH;     // Truncate to max length permitted

        RtlCopyMemory( _awszPropSpec, pwcName, cwcName * sizeof(WCHAR) );
        _awszPropSpec[cwcName] = 0;

        pStat->attribute.psProperty.lpwstr = _awszPropSpec;
    }

    _eState = FilteringValue;

    pStat->idChunk = _htmlIFilter.GetNextChunkId();
    pStat->flags = CHUNK_VALUE;
    pStat->locale = _htmlIFilter.GetLocale();
    pStat->attribute.guidPropSet = _clsidMetaInfo;
    pStat->breakType = CHUNK_EOS;
    pStat->idChunkSource = pStat->idChunk;
    pStat->cwcStartSource = 0;
    pStat->cwcLenSource = 0;
}

Member Data Documentation

WCHAR CMetaTag::_awszPropSpec[MAX_PROPSPEC_STRING_LENGTH+1] [private]

Definition at line 52 of file MetaTag.Hxx.

GUID CMetaTag::_clsidMetaInfo [private]

Definition at line 51 of file MetaTag.Hxx.

unsigned CMetaTag::_cValueChars [private]

Definition at line 49 of file MetaTag.Hxx.

MetaTagState CMetaTag::_eState [private]

Definition at line 47 of file MetaTag.Hxx.

WCHAR* CMetaTag::_pwcValueBuf [private]

Definition at line 48 of file MetaTag.Hxx.

The documentation for this class was generated from the following files:
  • WinBase/Indexing/IFilter/MetaTag.Hxx
  • WinBase/Indexing/IFilter/MetaTag.Cxx
Generated on Wed Nov 13 2024 16:56:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMethodPro Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CMethodPro Class Reference

#include "MethProv.h"

List of all members.

Public Member Functions

CMethodPro ()
~CMethodPro (void)
HRESULT STDMETHODCALLTYPE | CancelAsyncCall (IWbemObjectSink __RPC_FAR *pSink)
HRESULT STDMETHODCALLTYPE | CreateClassEnum (const BSTR Superclass, long lFlags, IWbemContext __RPC_FAR *pCtx, IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum)
HRESULT STDMETHODCALLTYPE | CreateClassEnumAsync (const BSTR Superclass, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemObjectSink __RPC_FAR *pResponseHandler)
HRESULT STDMETHODCALLTYPE | CreateInstanceEnum (const BSTR Class, long lFlags, IWbemContext __RPC_FAR *pCtx, IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum)
HRESULT STDMETHODCALLTYPE | CreateInstanceEnumAsync (const BSTR Class, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemObjectSink __RPC_FAR *pResponseHandler)
HRESULT STDMETHODCALLTYPE | DeleteClass (const BSTR Class, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult)
HRESULT STDMETHODCALLTYPE | DeleteClassAsync (const BSTR Class, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemObjectSink __RPC_FAR *pResponseHandler)
HRESULT STDMETHODCALLTYPE | DeleteInstance (const BSTR ObjectPath, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult)
HRESULT STDMETHODCALLTYPE | DeleteInstanceAsync (const BSTR ObjectPath, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemObjectSink __RPC_FAR *pResponseHandler)
HRESULT STDMETHODCALLTYPE | ExecMethod (const BSTR, const BSTR, long, IWbemContext *, IWbemClassObject *, IWbemClassObject **, IWbemCallResult **)
HRESULT STDMETHODCALLTYPE | ExecMethodAsync (const BSTR, const BSTR, long, IWbemContext *, IWbemClassObject *, IWbemObjectSink *)
HRESULT STDMETHODCALLTYPE | ExecNotificationQuery (const BSTR QueryLanguage, const BSTR Query, long lFlags, IWbemContext __RPC_FAR *pCtx, IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum)
HRESULT STDMETHODCALLTYPE | ExecNotificationQueryAsync (const BSTR QueryLanguage, const BSTR Query, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemObjectSink __RPC_FAR *pResponseHandler)
HRESULT STDMETHODCALLTYPE | ExecQuery (const BSTR QueryLanguage, const BSTR Query, long lFlags, IWbemContext __RPC_FAR *pCtx, IEnumWbemClassObject __RPC_FAR *__RPC_FAR *ppEnum)
HRESULT STDMETHODCALLTYPE | ExecQueryAsync (const BSTR QueryLanguage, const BSTR Query, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemObjectSink __RPC_FAR *pResponseHandler)
STDMETHOD() | GetIDsOfNames (THIS_ REFIID riid, OLECHAR FAR *FAR *rgszNames, UINT cNames, LCID lcid, DISPID FAR *rgdispid)
HRESULT STDMETHODCALLTYPE | GetObject (const BSTR ObjectPath, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemClassObject __RPC_FAR *__RPC_FAR *ppObject, IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult)
HRESULT STDMETHODCALLTYPE | GetObjectAsync (const BSTR ObjectPath, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemObjectSink __RPC_FAR *pResponseHandler)
STDMETHOD() | GetTypeInfo (THIS_ UINT itinfo, LCID lcid, ITypeInfo FAR *FAR *pptinfo)
STDMETHOD() | GetTypeInfoCount (THIS_ UINT FAR *pctinfo)
HRESULT STDMETHODCALLTYPE | Initialize (LPWSTR pszUser, LONG lFlags, LPWSTR pszNamespace, LPWSTR pszLocale, IWbemServices *pNamespace, IWbemContext *pCtx, IWbemProviderInitSink *pInitSink)
STDMETHOD() | Invoke (THIS_ DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS FAR *pdispparams, VARIANT FAR *pvarResult, EXCEPINFO FAR *pexcepinfo, UINT FAR *puArgErr)
HRESULT STDMETHODCALLTYPE | OpenNamespace (const BSTR Namespace, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemServices __RPC_FAR *__RPC_FAR *ppWorkingNamespace, IWbemCallResult __RPC_FAR *__RPC_FAR *ppResult)
HRESULT STDMETHODCALLTYPE | PutClass (IWbemClassObject __RPC_FAR *pObject, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult)
HRESULT STDMETHODCALLTYPE | PutClassAsync (IWbemClassObject __RPC_FAR *pObject, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemObjectSink __RPC_FAR *pResponseHandler)
HRESULT STDMETHODCALLTYPE | PutInstance (IWbemClassObject __RPC_FAR *pInst, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemCallResult __RPC_FAR *__RPC_FAR *ppCallResult)
HRESULT STDMETHODCALLTYPE | PutInstanceAsync (IWbemClassObject __RPC_FAR *pInst, long lFlags, IWbemContext __RPC_FAR *pCtx, IWbemObjectSink __RPC_FAR *pResponseHandler)
STDMETHODIMP | QueryInterface (REFIID, PPVOID)
HRESULT STDMETHODCALLTYPE | QueryObjectSink (long lFlags, IWbemObjectSink __RPC_FAR *__RPC_FAR *ppResponseHandler)
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP_ (ULONG) Release(void)

Protected Attributes

ULONG m_cRef
IWbemClassObject * | m_pOutClass
IWbemServices * | m_pWbemSvcs

Detailed Description

Definition at line 35 of file MethProv.h.

Constructor & Destructor Documentation

CMethodPro::CMethodPro ( )

Definition at line 39 of file MethProv.Cpp.

{
    InterlockedIncrement(&g_cObj);
    return;

}

CMethodPro::~CMethodPro ( void )

Definition at line 46 of file MethProv.Cpp.

{
    InterlockedDecrement(&g_cObj);
    return;
}

Member Function Documentation

HRESULT STDMETHODCALLTYPE CMethodPro::CancelAsyncCall ( IWbemObjectSink __RPC_FAR * pSink ) [inline]

Definition at line 100 of file MethProv.h.

                                                         {return WBEM_E_NOT_SUPPORTED;};

HRESULT STDMETHODCALLTYPE CMethodPro::CreateClassEnum | ( | const BSTR | Superclass,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IEnumWbemClassObject __RPC_FAR *__RPC_FAR * | ppEnum |
 | ) |  |  | [inline]

Definition at line 144 of file MethProv.h.

                                                                           {return WBEM_E_NOT_SUPPORTED;};

HRESULT STDMETHODCALLTYPE CMethodPro::CreateClassEnumAsync | ( | const BSTR | Superclass,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemObjectSink __RPC_FAR * | pResponseHandler |
 | ) |  |  | [inline]

Definition at line 150 of file MethProv.h.

                                                                    {return WBEM_E_NOT_SUPPORTED;};

HRESULT STDMETHODCALLTYPE CMethodPro::CreateInstanceEnum | ( | const BSTR | Class,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IEnumWbemClassObject __RPC_FAR *__RPC_FAR * | ppEnum |
 | ) |  |  | [inline]

Definition at line 180 of file MethProv.h.

                                                                           {return WBEM_E_NOT_SUPPORTED;};

HRESULT STDMETHODCALLTYPE CMethodPro::CreateInstanceEnumAsync | ( | const BSTR | Class,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemObjectSink __RPC_FAR * | pResponseHandler |
 | ) |  |  | [inline]

Definition at line 186 of file MethProv.h.

                                                                   {return WBEM_E_NOT_SUPPORTED;}

HRESULT STDMETHODCALLTYPE CMethodPro::DeleteClass | ( | const BSTR | Class,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemCallResult __RPC_FAR *__RPC_FAR * | ppCallResult |
 | ) |  |  | [inline]

Definition at line 132 of file MethProv.h.

                                                                                {return WBEM_E_NOT_SUPPORTED;};

HRESULT STDMETHODCALLTYPE CMethodPro::DeleteClassAsync | ( | const BSTR | Class,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemObjectSink __RPC_FAR * | pResponseHandler |
 | ) |  |  | [inline]

Definition at line 138 of file MethProv.h.

                                                                    {return WBEM_E_NOT_SUPPORTED;};

HRESULT STDMETHODCALLTYPE CMethodPro::DeleteInstance | ( | const BSTR | ObjectPath,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemCallResult __RPC_FAR *__RPC_FAR * | ppCallResult |
 | ) |  |  | [inline]

Definition at line 168 of file MethProv.h.

                                                                                {return WBEM_E_NOT_SUPPORTED;};

HRESULT STDMETHODCALLTYPE CMethodPro::DeleteInstanceAsync | ( | const BSTR | ObjectPath,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemObjectSink __RPC_FAR * | pResponseHandler |
 | ) |  |  | [inline]

Definition at line 174 of file MethProv.h.

                                                                    {return WBEM_E_NOT_SUPPORTED;};

HRESULT STDMETHODCALLTYPE CMethodPro::ExecMethod | ( | const | BSTR,
 |  | const | BSTR,
 |  | long | ,
 |  | IWbemContext * | ,
 |  | IWbemClassObject * | ,
 |  | IWbemClassObject ** | ,
 |  | IWbemCallResult ** |  |
 | ) |  |  | [inline]

Definition at line 222 of file MethProv.h.

                                                                     {return WBEM_E_NOT_SUPPORTED;}

STDMETHODIMP CMethodPro::ExecMethodAsync | ( | const BSTR | ObjectPath,
 |  | const BSTR | MethodName,
 |  | long | lFlags,
 |  | IWbemContext * | pCtx,
 |  | IWbemClassObject * | pInParams,
 |  | IWbemObjectSink * | pResultSink
 | ) |  |

Definition at line 149 of file MethProv.Cpp.

{
  // Do some minimal error checking.  This code only support the
    // method "Echo" as defined in the mof.  A routine could support
    // more than on method

    if(_wcsicmp(MethodName, L"Echo"))
        return WBEM_E_INVALID_PARAMETER;

    IWbemClassObject * pClass = NULL;
    IWbemClassObject * pOutClass = NULL;
    IWbemClassObject* pOutParams = NULL;

  // Impersonate the client: in this simple sample, no protected resources are accessed,
  // but the provider normally needs to perform any operations in the security context
  // of the client
  HRESULT hr = CoImpersonateClient () ;

  if ( FAILED ( hr ) )
  {
    pResultSink->SetStatus ( 0 , hr , NULL , NULL ) ;
    return hr ;
  }

  //  Check to see if call is at lower than RPC_C_IMP_LEVEL_IMPERSONATE level. If that's the case,
  //  the provider will not be able to impersonate the client to access the protected resources.

  DWORD t_CurrentImpersonationLevel = GetCurrentImpersonationLevel () ;
  if ( t_CurrentImpersonationLevel < RPC_C_IMP_LEVEL_IMPERSONATE )
  {
    //  Revert before we perform any operations
    CoRevertToSelf () ;

    hr = WBEM_E_ACCESS_DENIED;
    pResultSink->SetStatus ( 0 , hr , NULL , NULL ) ;
    return hr ;
  }

    // Allocate some BSTRs

    BSTR ClassName = SysAllocString(L"MethProvSamp");
  if (!ClassName)
  {
    CoRevertToSelf();
    pResultSink->SetStatus ( 0 , WBEM_E_OUT_OF_MEMORY , NULL , NULL ) ;
    return hr ;
  }

    BSTR InputArgName = SysAllocString(L"sInArg");
  if (!InputArgName)
  {
    SysFreeString(ClassName);
    CoRevertToSelf();
    pResultSink->SetStatus ( 0 , WBEM_E_OUT_OF_MEMORY , NULL , NULL ) ;
    return hr ;
  }

    BSTR OutputArgName = SysAllocString(L"sOutArg");
  if (!OutputArgName)
  {
    SysFreeString(ClassName);
    SysFreeString(InputArgName);
    CoRevertToSelf();
    pResultSink->SetStatus ( 0 , WBEM_E_OUT_OF_MEMORY , NULL , NULL ) ;
    return hr ;
  }
    BSTR retValName = SysAllocString(L"ReturnValue");
  if (!retValName)
  {
    SysFreeString(ClassName);
    SysFreeString(InputArgName);
    SysFreeString(OutputArgName);
    CoRevertToSelf();
    pResultSink->SetStatus ( 0 , WBEM_E_OUT_OF_MEMORY , NULL , NULL ) ;
    return hr ;
  }

    // Get the class object, this is hard coded and matches the class
    // in the MOF.  A more sophisticated example would parse the
    // ObjectPath to determine the class and possibly the instance.

    hr = m_pWbemSvcs->GetObject(ClassName, 0, pCtx, &pClass, NULL);
  if(hr != S_OK)
  {
     pResultSink->SetStatus(0,hr, NULL, NULL);
     return WBEM_S_NO_ERROR;
  }

    // This method returns values, and so create an instance of the
    // output argument class.

    hr = pClass->GetMethod(MethodName, 0, NULL, &pOutClass);
    pOutClass->SpawnInstance(0, &pOutParams);

    // Copy the input argument into the output object

    VARIANT var;
    VariantInit(&var);    // Get the input argument
    pInParams->Get(InputArgName, 0, &var, NULL, NULL);

    // put it into the output object

    pOutParams->Put(OutputArgName , 0, &var, 0);
    long lLen = (long)wcslen(var.bstrVal);    VariantClear(&var);    var.vt = VT_I4;
    var.lVal = lLen;    // special name for return value.
    pOutParams->Put(retValName , 0, &var, 0);

    // Send the output object back to the client via the sink. Then
    // release the pointers and free the strings.

    hr = pResultSink->Indicate(1, &pOutParams);
    pOutParams->Release();
    pOutClass->Release();
    pClass->Release();
    SysFreeString(ClassName);
    SysFreeString(InputArgName);
    SysFreeString(OutputArgName);
    SysFreeString(retValName);

    // all done now, set the status
    hr = pResultSink->SetStatus(0,WBEM_S_NO_ERROR,NULL,NULL);
    return WBEM_S_NO_ERROR;
}

HRESULT STDMETHODCALLTYPE CMethodPro::ExecNotificationQuery | ( | const BSTR | QueryLanguage,
 |  | const BSTR | Query,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IEnumWbemClassObject __RPC_FAR *__RPC_FAR * | ppEnum |
 | ) |  |  | [inline]

Definition at line 206 of file MethProv.h.

                                                                           {return WBEM_E_NOT_SUPPORTED;};

HRESULT STDMETHODCALLTYPE CMethodPro::ExecNotificationQueryAsync | ( | const BSTR | QueryLanguage,
 |  | const BSTR | Query,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemObjectSink __RPC_FAR * | pResponseHandler |
 | ) |  |  | [inline]

Definition at line 213 of file MethProv.h.

                                                                    {return WBEM_E_NOT_SUPPORTED;};

HRESULT STDMETHODCALLTYPE CMethodPro::ExecQuery | ( | const BSTR | QueryLanguage,
 |  | const BSTR | Query,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IEnumWbemClassObject __RPC_FAR *__RPC_FAR * | ppEnum |
 | ) |  |  | [inline]

Definition at line 192 of file MethProv.h.

                                                                           {return WBEM_E_NOT_SUPPORTED;};

HRESULT STDMETHODCALLTYPE CMethodPro::ExecQueryAsync | ( | const BSTR | QueryLanguage,
 |  | const BSTR | Query,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemObjectSink __RPC_FAR * | pResponseHandler |
 | ) |  |  | [inline]

Definition at line 199 of file MethProv.h.

                                                                    {return WBEM_E_NOT_SUPPORTED;};

STDMETHOD() CMethodPro::GetIDsOfNames | ( | THIS_ REFIID | riid,
 |  | OLECHAR FAR *FAR * | rgszNames,
 |  | UINT | cNames,
 |  | LCID | lcid,
 |  | DISPID FAR * | rgdispid |
 | ) |  |  | [inline]

Definition at line 59 of file MethProv.h.

                               {return WBEM_E_NOT_SUPPORTED;};

HRESULT STDMETHODCALLTYPE CMethodPro::GetObject | ( | const BSTR | ObjectPath,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemClassObject __RPC_FAR *__RPC_FAR * | ppObject,
 |  | IWbemCallResult __RPC_FAR *__RPC_FAR * | ppCallResult |
 | ) |  |  | [inline]

Definition at line 107 of file MethProv.h.

                                                                                {return WBEM_E_NOT_SUPPORTED;};

HRESULT STDMETHODCALLTYPE CMethodPro::GetObjectAsync | ( | const BSTR | ObjectPath,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemObjectSink __RPC_FAR * | pResponseHandler |
 | ) |  |  | [inline]

Definition at line 114 of file MethProv.h.

                                                                   {return WBEM_E_NOT_SUPPORTED;}

STDMETHOD() CMethodPro::GetTypeInfo | ( | THIS_ UINT | itinfo,
 |  | LCID | lcid,
 |  | ITypeInfo FAR *FAR * | pptinfo |
 | ) |  |  | [inline]

Definition at line 53 of file MethProv.h.

                                       {return WBEM_E_NOT_SUPPORTED;};

STDMETHOD() CMethodPro::GetTypeInfoCount ( THIS_ UINT FAR * pctinfo ) [inline]

Definition at line 51 of file MethProv.h.

{return WBEM_E_NOT_SUPPORTED;};

STDMETHODIMP CMethodPro::Initialize | ( | LPWSTR | pszUser,
 |  | LONG | lFlags,
 |  | LPWSTR | pszNamespace,
 |  | LPWSTR | pszLocale,
 |  | IWbemServices * | pNamespace,
 |  | IWbemContext * | pCtx,
 |  | IWbemProviderInitSink * | pInitSink
 | ) |  |

Definition at line 107 of file MethProv.Cpp.

{

    if(! pNamespace)
  {
      pInitSink->SetStatus(WBEM_E_FAILED , 0);
  }
  else
  {
    m_pWbemSvcs = pNamespace;
      m_pWbemSvcs->AddRef();
    pInitSink->SetStatus(WBEM_S_INITIALIZED, 0);
  }

    return WBEM_S_NO_ERROR;
}

STDMETHOD() CMethodPro::Invoke | ( | THIS_ DISPID | dispidMember,
 |  | REFIID | riid,
 |  | LCID | lcid,
 |  | WORD | wFlags,
 |  | DISPPARAMS FAR * | pdispparams,
 |  | VARIANT FAR * | pvarResult,
 |  | EXCEPINFO FAR * | pexcepinfo,
 |  | UINT FAR * | puArgErr |
 | ) |  |  | [inline]

Definition at line 67 of file MethProv.h.

                             {return WBEM_E_NOT_SUPPORTED;};

HRESULT STDMETHODCALLTYPE CMethodPro::OpenNamespace | ( | const BSTR | Namespace,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemServices __RPC_FAR *__RPC_FAR * | ppWorkingNamespace,
 |  | IWbemCallResult __RPC_FAR *__RPC_FAR * | ppResult |
 | ) |  |  | [inline]

Definition at line 93 of file MethProv.h.

                                                                                {return WBEM_E_NOT_SUPPORTED;};

HRESULT STDMETHODCALLTYPE CMethodPro::PutClass | ( | IWbemClassObject __RPC_FAR * | pObject,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemCallResult __RPC_FAR *__RPC_FAR * | ppCallResult |
 | ) |  |  | [inline]

Definition at line 120 of file MethProv.h.

                                                                                {return WBEM_E_NOT_SUPPORTED;};

HRESULT STDMETHODCALLTYPE CMethodPro::PutClassAsync | ( | IWbemClassObject __RPC_FAR * | pObject,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemObjectSink __RPC_FAR * | pResponseHandler |
 | ) |  |  | [inline]

Definition at line 126 of file MethProv.h.

                                                                    {return WBEM_E_NOT_SUPPORTED;};

HRESULT STDMETHODCALLTYPE CMethodPro::PutInstance | ( | IWbemClassObject __RPC_FAR * | pInst,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemCallResult __RPC_FAR *__RPC_FAR * | ppCallResult |
 | ) |  |  | [inline]

Definition at line 156 of file MethProv.h.

                                                                                {return WBEM_E_NOT_SUPPORTED;};

HRESULT STDMETHODCALLTYPE CMethodPro::PutInstanceAsync | ( | IWbemClassObject __RPC_FAR * | pInst,
 |  | long | lFlags,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemObjectSink __RPC_FAR * | pResponseHandler |
 | ) |  |  | [inline]

Definition at line 162 of file MethProv.h.

                                                                    {return WBEM_E_NOT_SUPPORTED;};

STDMETHODIMP CMethodPro::QueryInterface | ( | REFIID | riid,
 |  | PPVOID | ppv
 | ) |  |

Definition at line 62 of file MethProv.Cpp.

{
    *ppv=NULL;

    if (IID_IUnknown==riid || IID_IWbemServices == riid || IID_IWbemProviderInit==riid)
       if(riid== IID_IWbemServices){
          *ppv=(IWbemServices*)this;
       }

       if(IID_IUnknown==riid || riid== IID_IWbemProviderInit){
          *ppv=(IWbemProviderInit*)this;
       }

    if (NULL!=*ppv) {
        AddRef();
        return NOERROR;
        }
    else
        return E_NOINTERFACE;
}

HRESULT STDMETHODCALLTYPE CMethodPro::QueryObjectSink | ( | long | lFlags,
 |  | IWbemObjectSink __RPC_FAR *__RPC_FAR * | ppResponseHandler |
 | ) |  |  | [inline]

Definition at line 103 of file MethProv.h.

                                                                                {return WBEM_E_NOT_SUPPORTED;};

CMethodPro::STDMETHODIMP_ ( ULONG )
CMethodPro::STDMETHODIMP_ ( ULONG )

Member Data Documentation

ULONG CMethodPro::m_cRef [protected]

Definition at line 38 of file MethProv.h.

IWbemClassObject* CMethodPro::m_pOutClass [protected]

Definition at line 40 of file MethProv.h.

IWbemServices* CMethodPro::m_pWbemSvcs [protected]

Definition at line 39 of file MethProv.h.

The documentation for this class was generated from the following files:
  • SysMgmt/WMI/VC/MethProv/MethProv.h
  • SysMgmt/WMI/VC/MethProv/MethProv.Cpp
Generated on Wed Nov 13 2024 16:56:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMethodSub Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CMethodSub Class Reference

#include "Methodsub.h"

Inherits CSysLCESub.

List of all members.

Public Member Functions

CMethodSub (CComSpy *pSpy)
CMethodSub ()
HRESULT | GetClsidOfTypeLib2 (IID *piid, UUID *puuidClsid)
STDMETHODIMP | GetEventClass (LPGUID guid)
STDMETHODIMP | GetEventType (EventEnum *e)
STDMETHODIMP | GetInterface (IID *iid)
HRESULT | GetMethodName (REFIID riid, int iMeth, _TCHAR **ppszMethodName)
STDMETHOD() | OnMethodCall (COMSVCSEVENTINFO *pInfo, ULONG64 oid, REFCLSID cid, REFIID rid, ULONG iMeth)
STDMETHOD() | OnMethodException (COMSVCSEVENTINFO *pInfo, ULONG64 oid, REFCLSID cid, REFIID rid, ULONG iMeth)
STDMETHOD() | OnMethodReturn (COMSVCSEVENTINFO *pInfo, ULONG64 oid, REFCLSID cid, REFIID rid, ULONG iMeth, HRESULT hr)

Public Attributes

TimeMap m_map

Detailed Description

Definition at line 32 of file Methodsub.h.

Constructor & Destructor Documentation

CMethodSub::CMethodSub ( CComSpy * pSpy ) [inline]

Definition at line 39 of file Methodsub.h.

  {
    m_pSpy = pSpy;
  }

CMethodSub::CMethodSub ( ) [inline]

Definition at line 43 of file Methodsub.h.

  {
    m_pSpy = NULL;
  }

Member Function Documentation

HRESULT CMethodSub::GetClsidOfTypeLib2 | ( | IID * | piid,
 |  | UUID * | puuidClsid
 | ) |  |

Definition at line 180 of file Methodsub.Cpp.

{
  WCHAR   * pszBuffIID        = 0x0;
  HRESULT     hr            = S_OK;
  WCHAR     rgBufferIid [40];
  WCHAR     szBufferClsid[40];
  RPC_STATUS    RpcStatus;
  WCHAR     rgBufferKey [256];
  long      lRetVal;
  HKEY      hkey;
  long      lcbszClsidBuff      = 40 * sizeof(WCHAR) ;

  //-------------------------------------------------------------------------
  //Convert the iid to it's string form
  RpcStatus = UuidToString ( piid, &pszBuffIID);

  lstrcpyn(rgBufferIid, pszBuffIID, lstrlen(pszBuffIID));
  RpcStringFree (&pszBuffIID);

  //-------------------------------------------------------------------------
  //Create the Registry key to do the lookup with
  lstrcpyn (rgBufferKey, L"Interface\\{", sizeof("Interface\\{"));
  _tcsncat (rgBufferKey, rgBufferIid, _tcslen(rgBufferIid));
  _tcsncat (rgBufferKey, L"}\\TypeLib", sizeof(L"}\\TypeLib"));

  //UNDONE -- gaganc Perhaps should handle the \interface<iid1>\forward<iid2|
  //case also.

  //-------------------------------------------------------------------------
  //Open the appropriate registry key
  //HKEY_CLASSES_ROOT\Interface\{<...interface iid ...>}\Typelib

  lRetVal = RegOpenKey  (
                HKEY_CLASSES_ROOT,
                rgBufferKey,
                &hkey
              );

  if (lRetVal != ERROR_SUCCESS)
  {
    return E_FAIL;
  }

  //-------------------------------------------------------------------------
  //Obain the clsid from the open key
  lRetVal = RegQueryValueEx (
                  hkey,
                  NULL,
                  NULL,
                  NULL,
                  (unsigned char *)szBufferClsid,
                  (unsigned long *)&lcbszClsidBuff
                );

    if(lRetVal != ERROR_SUCCESS)
    {
        RegCloseKey(hkey) ;
        return E_FAIL ;
    }

  //-------------------------------------------------------------------------
  //Get rid of the braces in the begining and the end.

  //Remove the trailing brace
  szBufferClsid[37] = '\0';

  //convert the string form of the clsid to a binary form. Plus 1 will
  //remove the first brace.
  lRetVal = UuidFromString ((szBufferClsid + 1), puuidClsid);

    if(lRetVal != ERROR_SUCCESS)
    {
        RegCloseKey(hkey) ;
        return E_UNEXPECTED ;
    }

  //-------------------------------------------------------------------------
  //Prepare to return

  lRetVal = RegCloseKey (hkey);

  return hr;
} //end GetClsidOfTypeLib

STDMETHODIMP CMethodSub::GetEventClass ( LPGUID guid ) [inline, virtual]

Implements CSysLCESub.

Definition at line 57 of file Methodsub.h.

{*guid = CLSID_ComServiceEvents;return S_OK;}

STDMETHODIMP CMethodSub::GetEventType ( EventEnum * e ) [inline, virtual]

Implements CSysLCESub.

Definition at line 56 of file Methodsub.h.

{*e = Method;return S_OK;}

STDMETHODIMP CMethodSub::GetInterface ( IID * iid ) [inline, virtual]

Implements CSysLCESub.

Definition at line 58 of file Methodsub.h.

{*iid = IID_IComMethodEvents;return S_OK;}

HRESULT CMethodSub::GetMethodName | ( | REFIID | riid,
 |  | int | iMeth,
 |  | _TCHAR ** | ppszMethodName
 | ) |  |

Definition at line 282 of file Methodsub.Cpp.

{
  BOOL      fRet    = FALSE;
  HRESULT     hr;
  UUID      uuidClsid;
  LCID      lcid    = 0x0;
  ITypeLib  * pITypeLib = 0x0;
  ITypeInfo * pITypeInfo  = 0x0;
    FUNCDESC    *   pFuncDesc   = 0x0;
    _TCHAR      *   pszMethod   = 0x0;
    BSTR            bstrName ;
    UINT            lcNames     = 0 ;

    IID * piid = (IID *) &riid;

  //Obtain the clsid of the typelib for this interface
  hr = GetClsidOfTypeLib2 (piid, &uuidClsid);

  if (hr != S_OK) goto errExit ;

  //-------------------------------------------------------------------------
  //Obtain the ITypeLib interface on the typelib
  hr = LoadRegTypeLib (
              uuidClsid,    //CLSID
              1,        //Major version number
              0,        //Minor version number
              0,      //the locale id
              &pITypeLib
            );

  // if the default system lcid (0) doesn't work, we try
  // LCID 9 (standard english) and if that doesn't work, we failfast
  if(FAILED(hr))
  {
    hr = LoadRegTypeLib (uuidClsid, 1,0,9,&pITypeLib);
  }

    if(FAILED(hr)) goto errExit ;

  hr = pITypeLib->GetTypeInfoOfGuid (*piid, &pITypeInfo);

    if(FAILED(hr)) goto errExit ;

  hr = pITypeInfo->GetFuncDesc(iMeth, &pFuncDesc) ;

    if(FAILED(hr)) goto errExit ;

    hr = pITypeInfo->GetNames(pFuncDesc->memid, &bstrName, 1, &lcNames) ;

    if(FAILED(hr)) goto errExit ;

    pszMethod = new _TCHAR[lstrlen(bstrName)+1] ;

    if(! pszMethod)
    {
        hr = E_OUTOFMEMORY ;
        goto errExit ;
    }

    lstrcpyn(pszMethod, bstrName, lstrlen(bstrName)) ;

    SysFreeString(bstrName) ;

errExit:

    if (pFuncDesc)
  {
    pITypeInfo->ReleaseFuncDesc(pFuncDesc) ;
  }

  if (pITypeInfo)
  {
    pITypeInfo->Release();
  }

    if (pITypeLib)
    {
        pITypeLib->Release() ;
    }

    *ppszMethodName = pszMethod ;

    return hr ;
}

STDMETHODIMP CMethodSub::OnMethodCall | ( | COMSVCSEVENTINFO * | pInfo,
 |  | ULONG64 | oid,
 |  | REFCLSID | cid,
 |  | REFIID | rid,
 |  | ULONG | iMeth
 | ) |  |

Definition at line 28 of file Methodsub.Cpp.

{
  TimeStack * pStack = m_map[oid];
  if (!pStack)
  {
    pStack = new TimeStack;
    m_map[oid] = pStack;
  }
  _ASSERTE(pStack);
  pStack -> push_front(pInfo->perfCount);

  m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnMethodCall"), GuidToBstr(pInfo->guidApp));
  WCHAR id[32];
  //wsprintfW(id,L"0x%08X", oid);
  wsprintfW(id,L"0x%016X", oid);
  m_pSpy -> AddParamValueToList(L"ObjectID", id);

    CComBSTR sCid = GuidToBstr(guidCid);
    CComBSTR sIid = GuidToBstr(guidRid);

  m_pSpy -> AddParamValueToList(L"CLSID", sCid);
  m_pSpy -> AddParamValueToList(L"riid", sIid);

  TCHAR * pszGuidName = NULL;
  HRESULT hr;
  hr = GetMethodName(guidRid, iMeth, &pszGuidName) ;
    if(hr == S_OK)
  {
    m_pSpy -> AddParamValueToList(L"Method Name", pszGuidName);
  }
  else
  {
    pszGuidName = new _TCHAR[8] ;
    wsprintf(pszGuidName, _T("%X"), iMeth) ;
    m_pSpy -> AddParamValueToList(L"v-table index", pszGuidName);
  }
    IF_AUDIT_DO(OnMethodCall)(pInfo->perfCount,
                GuidToBstr(pInfo->guidApp),
                id,
                sCid,
                sIid,
                pszGuidName);

    delete pszGuidName ;
    pszGuidName = NULL ;
  return S_OK;
}

STDMETHODIMP CMethodSub::OnMethodException | ( | COMSVCSEVENTINFO * | pInfo,
 |  | ULONG64 | oid,
 |  | REFCLSID | cid,
 |  | REFIID | rid,
 |  | ULONG | iMeth
 | ) |  |

Definition at line 147 of file Methodsub.Cpp.

{
  m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnMethodException"), GuidToBstr(pInfo->guidApp));

  WCHAR id[32];
  wsprintfW(id,L"0x%016X", oid);
  m_pSpy -> AddParamValueToList(L"ObjectID", id);

    CComBSTR sCid = GuidToBstr(guidCid);
    CComBSTR sIid = GuidToBstr(guidRid);

  m_pSpy -> AddParamValueToList(L"CLSID", sCid);
  m_pSpy -> AddParamValueToList(L"riid", sIid);

  TCHAR      * pszGuidName   =   NULL ;
  HRESULT hr;
  hr = GetMethodName(guidRid, iMeth, &pszGuidName) ;
    if(hr != S_OK) { pszGuidName = new _TCHAR[64] ; lstrcpyn(pszGuidName, L"Unknown (no TypeLibrary)", sizeof("Unknown (no TypeLibrary)")) ; }
    m_pSpy -> AddParamValueToList(L"Method Name", pszGuidName);

    IF_AUDIT_DO(OnMethodException)(pInfo->perfCount,
                   GuidToBstr(pInfo->guidApp),
                   id,
                   sCid,
                   sIid,
                   pszGuidName);

    delete pszGuidName ;
    pszGuidName = NULL ;
  return S_OK;
}

STDMETHODIMP CMethodSub::OnMethodReturn | ( | COMSVCSEVENTINFO * | pInfo,
 |  | ULONG64 | oid,
 |  | REFCLSID | cid,
 |  | REFIID | rid,
 |  | ULONG | iMeth,
 |  | HRESULT | hr
 | ) |  |

Definition at line 78 of file Methodsub.Cpp.

{
  m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnMethodReturn"), GuidToBstr(pInfo->guidApp));
  WCHAR id[32];
  wsprintfW(id,L"0x%016X", oid);
  m_pSpy -> AddParamValueToList(L"ObjectID", id);

    CComBSTR sCid = GuidToBstr(guidCid);
    CComBSTR sIid = GuidToBstr(guidRid);

  m_pSpy -> AddParamValueToList(L"CLSID", sCid);
  m_pSpy -> AddParamValueToList(L"riid", sIid);

  TCHAR      * pszGuidName   =   NULL ;
  HRESULT hr;
  hr = GetMethodName(guidRid, iMeth, &pszGuidName) ;
    if(hr != S_OK)
  {
    pszGuidName = new _TCHAR[8] ;
    wsprintf(pszGuidName, _T("%X"), iMeth) ;
    m_pSpy -> AddParamValueToList(L"v-table index", pszGuidName);
  }
  else
  {
    m_pSpy -> AddParamValueToList(L"Method Name", pszGuidName);
  }

  WCHAR wcRet[16];
  wsprintfW(wcRet, L"0x%08X", hrRet);
    m_pSpy -> AddParamValueToList(L"Return Value", wcRet);

  TCHAR sTime[16];
  TimeStack * pStack = m_map[oid];
  LONGLONG oldTime  = pStack -> front();
  pStack -> pop_front();
  _ASSERTE(oldTime);

    DWORD timeDiff = (DWORD)((1000*(pInfo->perfCount-oldTime))/PerformanceFrequency);
  wsprintf(sTime, _T("%d"), timeDiff);

  m_pSpy -> AddParamValueToList(L"Call time (ms)", sTime);

  IF_AUDIT_DO(OnMethodReturn)(pInfo->perfCount,
                GuidToBstr(pInfo->guidApp),
                  id,
                  sCid,
                  sIid,
                  pszGuidName,
                  hrRet,
                  sTime);
  delete pszGuidName ;
    pszGuidName = NULL ;

  if (pStack -> empty())
  {
    delete pStack;
    m_map.erase(oid);
  }
  return S_OK;
}

Member Data Documentation

TimeMap CMethodSub::m_map

Definition at line 38 of file Methodsub.h.

The documentation for this class was generated from the following files:
  • Com/Administration/Spy/ComSpyCtl/Methodsub.h
  • Com/Administration/Spy/ComSpyCtl/Methodsub.Cpp
Generated on Wed Nov 13 2024 16:56:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMgdClusCfgInit Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CMgdClusCfgInit Class Reference

#include "CMgdClusCfgInit.h"

Inherited by CEnumStorageResource, CMgdResType, CPartitionInfo, CStorageResource, and CStorageResType.

List of all members.

Public Member Functions

CMgdClusCfgInit (void)
CMgdClusCfgInit (void)
virtual | ~CMgdClusCfgInit (void)
virtual | ~CMgdClusCfgInit (void)
IClusCfgCallback * | GetCallback (void)
IClusCfgCallback * | GetCallback (void)
BSTR | GetDisplayName (void)
BSTR | GetDisplayName (void)
BSTR | GetDllName (void)
BSTR | GetDllName (void)
LCID | GetLCID (void)
LCID | GetLCID (void)
BSTR | GetNodeName (void)
BSTR | GetNodeName (void)
BSTR | GetResTypeName (void)
BSTR | GetResTypeName (void)
STDMETHOD() | HrSendStatusReport (CLSID clsidTaskMajorIn, CLSID clsidTaskMinorIn, ULONG ulMinIn, ULONG ulMaxIn, ULONG ulCurrentIn, HRESULT hrStatusIn, UINT idsDescriptionIn, UINT idsReferenceIn...)
STDMETHOD() | HrSendStatusReport (CLSID clsidTaskMajorIn, CLSID clsidTaskMinorIn, ULONG ulMinIn, ULONG ulMaxIn, ULONG ulCurrentIn, HRESULT hrStatusIn, LPCWSTR pcszDescriptionIn, UINT idsReferenceIn...)
STDMETHOD() | HrSendStatusReport (CLSID clsidTaskMajorIn, CLSID clsidTaskMinorIn, ULONG ulMinIn, ULONG ulMaxIn, ULONG ulCurrentIn, HRESULT hrStatusIn, LPCWSTR pcszDescriptionIn, LPCWSTR pcszReferenceIn...)
STDMETHOD() | HrSendStatusReport (CLSID clsidTaskMajorIn, CLSID clsidTaskMinorIn, ULONG ulMinIn, ULONG ulMaxIn, ULONG ulCurrentIn, HRESULT hrStatusIn, LPCWSTR pcszDescriptionIn, LPCWSTR pcszReferenceIn...)
STDMETHOD() | HrSendStatusReport (CLSID clsidTaskMajorIn, CLSID clsidTaskMinorIn, ULONG ulMinIn, ULONG ulMaxIn, ULONG ulCurrentIn, HRESULT hrStatusIn, LPCWSTR pcszDescriptionIn, UINT idsReferenceIn...)
STDMETHOD() | HrSendStatusReport (CLSID clsidTaskMajorIn, CLSID clsidTaskMinorIn, ULONG ulMinIn, ULONG ulMaxIn, ULONG ulCurrentIn, HRESULT hrStatusIn, UINT idsDescriptionIn, UINT idsReferenceIn...)
STDMETHOD() | Initialize (IUnknown *punkCallbackIn, LCID lcidIn)
STDMETHOD() | Initialize (IUnknown *punkCallbackIn, LCID lcidIn)

Private Member Functions

CMgdClusCfgInit (const CMgdClusCfgInit &rSrcIn)
CMgdClusCfgInit (const CMgdClusCfgInit &rSrcIn)
const CMgdClusCfgInit & | operator= (const CMgdClusCfgInit &rSrcIn)
const CMgdClusCfgInit & | operator= (const CMgdClusCfgInit &rSrcIn)
STDMETHOD() | SendStatusReport (CLSID clsidTaskMajorIn, CLSID clsidTaskMinorIn, ULONG ulMinIn, ULONG ulMaxIn, ULONG ulCurrentIn, HRESULT hrStatusIn, LPCWSTR pcszDescriptionIn, LPCWSTR pcszReferenceIn)
STDMETHOD() | SendStatusReport (CLSID clsidTaskMajorIn, CLSID clsidTaskMinorIn, ULONG ulMinIn, ULONG ulMaxIn, ULONG ulCurrentIn, HRESULT hrStatusIn, LPCWSTR pcszDescriptionIn, LPCWSTR pcszReferenceIn)

Private Attributes

BSTR | m_bstrDisplayName
BSTR | m_bstrDllName
BSTR | m_bstrNodeName
BSTR | m_bstrResTypeName
LCID | m_lcid
IClusCfgCallback * | m_picccCallback

Detailed Description

Definition at line 41 of file CMgdClusCfgInit.h.

Constructor & Destructor Documentation

CMgdClusCfgInit::CMgdClusCfgInit ( void )

Definition at line 49 of file CMgdClusCfgInit.cpp.

{
    m_picccCallback = NULL;
    m_lcid = GetUserDefaultLCID();

    m_bstrNodeName = NULL;
    m_bstrDllName = NULL;
    m_bstrResTypeName = NULL;
    m_bstrDisplayName = NULL;

} //*** CMgdClusCfgInit::CMgdClusCfgInit

CMgdClusCfgInit::~CMgdClusCfgInit ( void ) [virtual]

Definition at line 79 of file CMgdClusCfgInit.cpp.

{
    if ( m_picccCallback != NULL )
    {
        m_picccCallback->Release();
        m_picccCallback = NULL;
    } // if: m_picccCallback was used

    SysFreeString( m_bstrNodeName );
    SysFreeString( m_bstrDllName );
    SysFreeString( m_bstrResTypeName );
    SysFreeString( m_bstrDisplayName );

} //*** CMgdClusCfgInit::~CMgdClusCfgInit

CMgdClusCfgInit::CMgdClusCfgInit ( const CMgdClusCfgInit & rSrcIn ) [private]
CMgdClusCfgInit::CMgdClusCfgInit ( void )
virtual CMgdClusCfgInit::~CMgdClusCfgInit ( void ) [virtual]
CMgdClusCfgInit::CMgdClusCfgInit ( const CMgdClusCfgInit & rSrcIn ) [private]

Member Function Documentation

IClusCfgCallback* CMgdClusCfgInit::GetCallback ( void ) [inline]

Definition at line 60 of file CMgdClusCfgInit.h.

{ return m_picccCallback; }

IClusCfgCallback* CMgdClusCfgInit::GetCallback ( void ) [inline]

Definition at line 57 of file CMgdClusCfgInit.h.

{ return m_picccCallback; }

BSTR CMgdClusCfgInit::GetDisplayName ( void ) [inline]

Definition at line 62 of file CMgdClusCfgInit.h.

{ return m_bstrDisplayName; }

BSTR CMgdClusCfgInit::GetDisplayName ( void ) [inline]

Definition at line 65 of file CMgdClusCfgInit.h.

{ return m_bstrDisplayName; }

BSTR CMgdClusCfgInit::GetDllName ( void ) [inline]

Definition at line 63 of file CMgdClusCfgInit.h.

{ return m_bstrDllName; }

BSTR CMgdClusCfgInit::GetDllName ( void ) [inline]

Definition at line 60 of file CMgdClusCfgInit.h.

{ return m_bstrDllName; }

LCID CMgdClusCfgInit::GetLCID ( void ) [inline]

Definition at line 61 of file CMgdClusCfgInit.h.

{ return m_lcid; }

LCID CMgdClusCfgInit::GetLCID ( void ) [inline]

Definition at line 58 of file CMgdClusCfgInit.h.

{ return m_lcid; }

BSTR CMgdClusCfgInit::GetNodeName ( void ) [inline]

Definition at line 59 of file CMgdClusCfgInit.h.

{ return m_bstrNodeName; }

BSTR CMgdClusCfgInit::GetNodeName ( void ) [inline]

Definition at line 62 of file CMgdClusCfgInit.h.

{ return m_bstrNodeName; }

BSTR CMgdClusCfgInit::GetResTypeName ( void ) [inline]

Definition at line 61 of file CMgdClusCfgInit.h.

{ return m_bstrResTypeName; }

BSTR CMgdClusCfgInit::GetResTypeName ( void ) [inline]

Definition at line 64 of file CMgdClusCfgInit.h.

{ return m_bstrResTypeName; }

STDMETHOD() CMgdClusCfgInit::HrSendStatusReport | ( | CLSID | clsidTaskMajorIn,
 |  | CLSID | clsidTaskMinorIn,
 |  | ULONG | ulMinIn,
 |  | ULONG | ulMaxIn,
 |  | ULONG | ulCurrentIn,
 |  | HRESULT | hrStatusIn,
 |  | LPCWSTR | pcszDescriptionIn,
 |  | UINT | idsReferenceIn...
 | ) |  |
STDMETHOD() CMgdClusCfgInit::HrSendStatusReport | ( | CLSID | clsidTaskMajorIn,
 |  | CLSID | clsidTaskMinorIn,
 |  | ULONG | ulMinIn,
 |  | ULONG | ulMaxIn,
 |  | ULONG | ulCurrentIn,
 |  | HRESULT | hrStatusIn,
 |  | LPCWSTR | pcszDescriptionIn,
 |  | LPCWSTR | pcszReferenceIn...
 | ) |  |
STDMETHOD() CMgdClusCfgInit::HrSendStatusReport | ( | CLSID | clsidTaskMajorIn,
 |  | CLSID | clsidTaskMinorIn,
 |  | ULONG | ulMinIn,
 |  | ULONG | ulMaxIn,
 |  | ULONG | ulCurrentIn,
 |  | HRESULT | hrStatusIn,
 |  | UINT | idsDescriptionIn,
 |  | UINT | idsReferenceIn...
 | ) |  |
STDMETHODIMP CMgdClusCfgInit::HrSendStatusReport | ( | CLSID | clsidTaskMajorIn,
 |  | CLSID | clsidTaskMinorIn,
 |  | ULONG | ulMinIn,
 |  | ULONG | ulMaxIn,
 |  | ULONG | ulCurrentIn,
 |  | HRESULT | hrStatusIn,
 |  | LPCWSTR | pcszDescriptionIn,
 |  | LPCWSTR | pcszReferenceIn...
 | ) |  |

Definition at line 430 of file CMgdClusCfgInit.cpp.

{
    HRESULT     hr = S_OK;
    BSTR        bstrDescription = NULL;
    va_list     valist = NULL;

    va_start( valist, pcszReferenceIn );
    hr = HrFormatStringWithVAListIntoBSTR( pcszDescriptionIn, &bstrDescription, valist );
    va_end( valist );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    hr = SendStatusReport(
              clsidTaskMajorIn
            , clsidTaskMinorIn
            , ulMinIn
            , ulMaxIn
            , ulCurrentIn
            , hrStatusIn
            , bstrDescription
            , pcszReferenceIn
            );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

Cleanup:

    SysFreeString( bstrDescription );

    return hr;

} //*** CMgdClusCfgInit::HrSendStatusReport

STDMETHODIMP CMgdClusCfgInit::HrSendStatusReport | ( | CLSID | clsidTaskMajorIn,
 |  | CLSID | clsidTaskMinorIn,
 |  | ULONG | ulMinIn,
 |  | ULONG | ulMaxIn,
 |  | ULONG | ulCurrentIn,
 |  | HRESULT | hrStatusIn,
 |  | UINT | idsDescriptionIn,
 |  | UINT | idsReferenceIn...
 | ) |  |

Definition at line 255 of file CMgdClusCfgInit.cpp.

{
    HRESULT     hr = S_OK;
    BSTR        bstrDescription = NULL;
    BSTR        bstrReference = NULL;
    va_list     valist = NULL;

    va_start( valist, idsReferenceIn );
    hr = HrFormatStringWithVAListIntoBSTR( _Module.m_hInstResource, idsDescriptionIn, &bstrDescription, valist );
    va_end( valist );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    if ( idsReferenceIn != 0 )
    {
        hr = HrLoadStringIntoBSTR( _Module.m_hInstResource, idsReferenceIn, &bstrReference );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:
    } // if: valid reference string

    hr = SendStatusReport(
              clsidTaskMajorIn
            , clsidTaskMinorIn
            , ulMinIn
            , ulMaxIn
            , ulCurrentIn
            , hrStatusIn
            , bstrDescription
            , bstrReference
            );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

Cleanup:

    SysFreeString( bstrDescription );
    SysFreeString( bstrReference );

    return hr;

} //*** CMgdClusCfgInit::HrSendStatusReport

STDMETHODIMP CMgdClusCfgInit::HrSendStatusReport | ( | CLSID | clsidTaskMajorIn,
 |  | CLSID | clsidTaskMinorIn,
 |  | ULONG | ulMinIn,
 |  | ULONG | ulMaxIn,
 |  | ULONG | ulCurrentIn,
 |  | HRESULT | hrStatusIn,
 |  | LPCWSTR | pcszDescriptionIn,
 |  | UINT | idsReferenceIn...
 | ) |  |

Definition at line 343 of file CMgdClusCfgInit.cpp.

{
    HRESULT     hr = S_OK;
    BSTR        bstrDescription = NULL;
    BSTR        bstrReference = NULL;
    va_list     valist = NULL;

    va_start( valist, idsReferenceIn );
    hr = HrFormatStringWithVAListIntoBSTR( pcszDescriptionIn, &bstrDescription, valist );
    va_end( valist );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    if ( idsReferenceIn != 0 )
    {
        hr = HrLoadStringIntoBSTR( _Module.m_hInstResource, idsReferenceIn, &bstrReference );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:
    } // if: valid reference string

    hr = SendStatusReport(
              clsidTaskMajorIn
            , clsidTaskMinorIn
            , ulMinIn
            , ulMaxIn
            , ulCurrentIn
            , hrStatusIn
            , bstrDescription
            , bstrReference
            );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

Cleanup:

    SysFreeString( bstrDescription );
    SysFreeString( bstrReference );

    return hr;

} //*** CMgdClusCfgInit::HrSendStatusReport

STDMETHODIMP CMgdClusCfgInit::Initialize | ( | IUnknown * | punkCallbackIn,
 |  | LCID | lcidIn
 | ) |  |

Reimplemented in CEnumStorageResource.

Definition at line 126 of file CMgdClusCfgInit.cpp.

{
    HRESULT hr = S_OK;
    WCHAR   szComputerName[ MAX_PATH ];
    DWORD   cchComputerName = MAX_PATH;
    DWORD   dwError = ERROR_SUCCESS;

    m_lcid = lcidIn;

    if ( punkCallbackIn == NULL )
    {
        hr = E_POINTER;
        goto Cleanup;
    } // if: Callback pointer is invalid (NULL)

    //
    // Save the callback interface pointer.
    //

    hr = punkCallbackIn->TypeSafeQI( IClusCfgCallback, &m_picccCallback );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if: TypeSafeQI failed

    //
    // Save the computer name for use by SendStatusReport.
    //

    if ( GetComputerNameEx( ComputerNamePhysicalDnsHostname, szComputerName, &cchComputerName ) == 0 )
    {
        dwError = GetLastError();
        hr = HRESULT_FROM_WIN32( dwError );

        HrSendStatusReport(
              TASKID_Major_Find_Devices
            , TASKID_Minor_ClipBookServer_Initialize
            , 1
            , 1
            , 1
            , hr
            , IDS_CLUSCFG_ERROR_GETCOMPUTERNAME_FAILED
            , 0
            );
        goto Cleanup;
    } // if: GetComputerName failed

    m_bstrNodeName = SysAllocString( szComputerName );
    if ( m_bstrNodeName == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if:

    //
    // Get the dll name.
    //

    m_bstrDllName = SysAllocString( RESTYPE_DLL_NAME );
    if ( m_bstrDllName == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if:

    //
    // Get the resource type name.
    //

    m_bstrResTypeName = SysAllocString( RESTYPE_NAME );
    if ( m_bstrResTypeName == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if:

    //
    // Load the resource type display name.
    //

    //
    // NOTE:    The resource type display name should be localized, but the resource type
    //          name should always remain the same.
    //

    hr = HrLoadStringIntoBSTR( _Module.m_hInstResource, IDS_RESTYPE_DISPLAYNAME, &m_bstrDisplayName );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

Cleanup:

    return hr;

} //*** CMgdClusCfgInit::Initialize

STDMETHOD() CMgdClusCfgInit::Initialize | ( | IUnknown * | punkCallbackIn,
 |  | LCID | lcidIn
 | ) |  |

Reimplemented in CEnumStorageResource.

const CMgdClusCfgInit& CMgdClusCfgInit::operator= ( const CMgdClusCfgInit & rSrcIn ) [private]
const CMgdClusCfgInit& CMgdClusCfgInit::operator= ( const CMgdClusCfgInit & rSrcIn ) [private]
STDMETHOD() CMgdClusCfgInit::SendStatusReport | ( | CLSID | clsidTaskMajorIn,
 |  | CLSID | clsidTaskMinorIn,
 |  | ULONG | ulMinIn,
 |  | ULONG | ulMaxIn,
 |  | ULONG | ulCurrentIn,
 |  | HRESULT | hrStatusIn,
 |  | LPCWSTR | pcszDescriptionIn,
 |  | LPCWSTR | pcszReferenceIn |
 | ) |  |  | [private]
STDMETHODIMP CMgdClusCfgInit::SendStatusReport | ( | CLSID | clsidTaskMajorIn,
 |  | CLSID | clsidTaskMinorIn,
 |  | ULONG | ulMinIn,
 |  | ULONG | ulMaxIn,
 |  | ULONG | ulCurrentIn,
 |  | HRESULT | hrStatusIn,
 |  | LPCWSTR | pcszDescriptionIn,
 |  | LPCWSTR | pcszReferenceIn |
 | ) |  |  | [private]

Definition at line 506 of file CMgdClusCfgInit.cpp.

{
    HRESULT     hr = S_OK;
    FILETIME    ftTime;

    assert( m_picccCallback != NULL );
    assert( m_bstrNodeName != NULL );

    GetSystemTimeAsFileTime( &ftTime );

    if ( m_picccCallback != NULL )
    {
        hr = m_picccCallback->SendStatusReport(
                  m_bstrNodeName
                , clsidTaskMajorIn
                , clsidTaskMinorIn
                , ulMinIn
                , ulMaxIn
                , ulCurrentIn
                , hrStatusIn
                , pcszDescriptionIn
                , &ftTime
                , pcszReferenceIn
                );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:
    } // if: m_picccCallback != NULL

Cleanup:

    return hr;

} //*** CMgdClusCfgInit::SendStatusReport

Member Data Documentation

BSTR CMgdClusCfgInit::m_bstrDisplayName [private]

Definition at line 146 of file CMgdClusCfgInit.h.

BSTR CMgdClusCfgInit::m_bstrDllName [private]

Definition at line 144 of file CMgdClusCfgInit.h.

BSTR CMgdClusCfgInit::m_bstrNodeName [private]

Definition at line 138 of file CMgdClusCfgInit.h.

BSTR CMgdClusCfgInit::m_bstrResTypeName [private]

Definition at line 145 of file CMgdClusCfgInit.h.

LCID CMgdClusCfgInit::m_lcid [private]

Reimplemented in CPartitionInfo.

Definition at line 136 of file CMgdClusCfgInit.h.

IClusCfgCallback * CMgdClusCfgInit::m_picccCallback [private]

Definition at line 137 of file CMgdClusCfgInit.h.

The documentation for this class was generated from the following files:
  • WinBase/Cluster/Win2003/ClipBookServer/ClipBook Server/CMgdClusCfgInit.h
  • WinBase/Cluster/Win2003/MyStorageResource/CMgdClusCfgInit.h
  • WinBase/Cluster/Win2003/ClipBookServer/ClipBook Server/CMgdClusCfgInit.cpp
  • WinBase/Cluster/Win2003/MyStorageResource/CMgdClusCfgInit.cpp
Generated on Wed Nov 13 2024 16:56:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMgdResType Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions

CMgdResType Class Reference

#include "CMgdResType.h"

Inherits CMgdClusCfgInit.

List of all members.

Public Member Functions

CMgdResType (void)
virtual | ~CMgdResType (void)
STDMETHOD() | CommitChanges (IUnknown *punkClusterInfoIn, IUnknown *punkResTypeServicesIn)
STDMETHOD() | GetTypeGUID (GUID *pguidGUIDOut)
STDMETHOD() | GetTypeName (BSTR *pbstrTypeNameOut)
STDMETHOD() | Notify (IUnknown *punkIn)

Private Member Functions

CMgdResType (const CMgdResType &rSrcIn)
const CMgdResType & | operator= (const CMgdResType &rSrcIn)

Detailed Description

Definition at line 40 of file CMgdResType.h.

Constructor & Destructor Documentation

CMgdResType::CMgdResType ( void ) [inline]

Definition at line 47 of file CMgdResType.h.

{}

virtual CMgdResType::~CMgdResType ( void ) [inline, virtual]

Definition at line 48 of file CMgdResType.h.

{}

CMgdResType::CMgdResType ( const CMgdResType & rSrcIn ) [private]

Member Function Documentation

STDMETHODIMP CMgdResType::CommitChanges | ( | IUnknown * | punkClusterInfoIn,
 |  | IUnknown * | punkResTypeServicesIn
 | ) |  |

Definition at line 86 of file CMgdResType.cpp.

{
    assert( punkClusterInfoIn != NULL );
    assert( punkResTypeServicesIn != NULL );

    HRESULT                         hr = S_OK;
    IClusCfgClusterInfo *           pccci = NULL;
    IClusCfgResourceTypeCreate *    pccrtc = NULL;
    ECommitMode                     ecm = cmUNKNOWN;

    hr = HrSendStatusReport(
          TASKID_Major_Configure_Resource_Types
        , TASKID_Minor_ClipBookServer_ResType_CommitChanges
        , 0
        , 6
        , 0
        , hr
        , IDS_CLUSCFG_INFO_CONFIGURING_RESTYPE
        , 0
        , GetDisplayName()
        );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    //
    // Validate arguments
    //

    if ( ( punkClusterInfoIn == NULL ) || ( punkResTypeServicesIn == NULL ) )
    {
        hr = E_POINTER;
        goto Cleanup;
    } // if: one of the arguments is NULL

    hr = HrSendStatusReport(
          TASKID_Major_Configure_Resource_Types
        , TASKID_Minor_ClipBookServer_ResType_CommitChanges
        , 0
        , 6
        , 1
        , hr
        , IDS_CLUSCFG_INFO_CONFIGURING_RESTYPE
        , 0
        , GetDisplayName()
        );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    //
    // Find out what event caused this call.
    //

    hr = punkClusterInfoIn->TypeSafeQI( IClusCfgClusterInfo, &pccci );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    hr = HrSendStatusReport(
          TASKID_Major_Configure_Resource_Types
        , TASKID_Minor_ClipBookServer_ResType_CommitChanges
        , 0
        , 6
        , 2
        , hr
        , IDS_CLUSCFG_INFO_CONFIGURING_RESTYPE
        , 0
        , GetDisplayName()
        );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    hr = pccci->GetCommitMode( &ecm );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if: we could not determine the commit mode

    hr = HrSendStatusReport(
          TASKID_Major_Configure_Resource_Types
        , TASKID_Minor_ClipBookServer_ResType_CommitChanges
        , 0
        , 6
        , 3
        , hr
        , IDS_CLUSCFG_INFO_CONFIGURING_RESTYPE
        , 0
        , GetDisplayName()
        );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    hr = S_OK;

    //
    //  Check if we are creating a cluster or adding nodes to an existing cluster.
    //

    if ( ( ecm == cmCREATE_CLUSTER ) || ( ecm == cmADD_NODE_TO_CLUSTER ) )
    {
        //
        //  We are either creating a cluster on this node or adding it to a
        //  cluster.  We need to register our resource type and the associated
        //  Cluadmin extension dll.
        //

        //
        // First, register our resource type.
        //

        hr = punkResTypeServicesIn->TypeSafeQI( IClusCfgResourceTypeCreate, &pccrtc );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:

        hr = pccrtc->Create(
                          GetResTypeName()
                        , GetDisplayName()
                        , GetDllName()
                        , CLUSTER_RESTYPE_DEFAULT_LOOKS_ALIVE
                        , CLUSTER_RESTYPE_DEFAULT_IS_ALIVE
                        );

        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:

        hr = HrSendStatusReport(
              TASKID_Major_Configure_Resource_Types
            , TASKID_Minor_ClipBookServer_ResType_CommitChanges
            , 0
            , 6
            , 4
            , hr
            , IDS_CLUSCFG_INFO_CONFIGURED_RESTYPE
            , 0
            , GetResTypeName()
            , GetDisplayName()
            , GetDllName()
            );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:

        hr = pccrtc->RegisterAdminExtensions(
                          GetDisplayName()
                        , 1
                        , &CLSID_CoClipBookServerEx
                        );

        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:

        hr = HrSendStatusReport(
              TASKID_Major_Configure_Resource_Types
            , TASKID_Minor_ClipBookServer_ResType_CommitChanges
            , 0
            , 6
            , 5
            , hr
            , IDS_CLUSCFG_INFO_CONFIGURING_RESTYPE
            , 0
            , GetDisplayName()
            );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:
    } // if: we are either forming or joining ( but not both )
    else
    {
        //
        // Check for invalid commit modes.
        //

        if ( ( ecm == cmUNKNOWN ) || ( ecm >= cmMAX ) )
        {
            hr = E_UNEXPECTED;
            goto Cleanup;
        } // if: invalid commit mode

        assert( ecm == cmCLEANUP_NODE_AFTER_EVICT );

        //
        // If we are here, then this node has been evicted.
        //

        //
        // TODO: Add code to cleanup your resource type after the
        // local node has been evicted from the cluster.
        //
        // If your resource has a different configuration when it's part of
        // cluster then this is where you return it to stand-alone server mode.
        //

        hr = S_OK;

    } // else: we are not forming nor joining

    //
    // Success.
    //

    HrSendStatusReport(
          TASKID_Major_Configure_Resource_Types
        , TASKID_Minor_ClipBookServer_ResType_CommitChanges
        , 0
        , 6
        , 6
        , hr
        , IDS_CLUSCFG_INFO_CONFIGURING_RESTYPE
        , 0
        , GetDisplayName()
        );

Cleanup:

    if ( pccci != NULL )
    {
        pccci->Release();
        pccci = NULL;
    } // if:

    if ( pccrtc != NULL )
    {
        pccrtc->Release();
        pccrtc = NULL;
    } // if:

    if ( FAILED( hr ) )
    {
        HrSendStatusReport(
              TASKID_Major_Configure_Resource_Types
            , TASKID_Minor_ClipBookServer_ResType_CommitChanges
            , 0
            , 6
            , 6
            , hr
            , IDS_CLUSCFG_ERROR_CONFIGURING_RESTYPE_FAILED
            , 0
            , GetDisplayName()
            );
    } // if: FAILED

    return hr;

} //*** CMgdResType::CommitChanges

STDMETHODIMP CMgdResType::GetTypeGUID ( GUID * pguidGUIDOut )

Definition at line 379 of file CMgdResType.cpp.

{
    assert( pguidGUIDOut != NULL );

    HRESULT hr = S_OK;

    if ( pguidGUIDOut == NULL )
    {
        hr = E_POINTER;
    } // if: the output pointer is NULL
    else
    {
        *pguidGUIDOut = RESTYPE_ClipBookServer;
    } // else: the output pointer is valid

    return hr;

} //*** CMgdResType::GetTypeGUID

STDMETHODIMP CMgdResType::GetTypeName ( BSTR * pbstrTypeNameOut )

Definition at line 432 of file CMgdResType.cpp.

{
    assert( pbstrTypeNameOut != NULL );

    HRESULT hr = S_OK;

    if ( pbstrTypeNameOut == NULL )
    {
        hr = E_POINTER;
        goto Cleanup;
    } // if: the output pointer is NULL

    *pbstrTypeNameOut = SysAllocString( GetResTypeName() );
    if ( *pbstrTypeNameOut == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if: memory for the resource type name could not be allocated

Cleanup:

    return hr;

} //*** CMgdResType::GetTypeName

HRESULT CMgdResType::Notify ( IUnknown * punkIn )

Definition at line 496 of file CMgdResType.cpp.

{
    HRESULT                         hr = S_OK;
    IClusCfgResourceTypeCreate *    piccrtc = NULL;
    const GUID *                    guidAdminEx = &CLSID_CoClipBookServerEx;
    ICatRegister *                  pcrCatReg = NULL;
    CATID                           rgCatId[ 1 ];

    hr = HrSendStatusReport(
                  TASKID_Major_Client_And_Server_Log
                , IID_NULL
                , 1
                , 1
                , 1
                , hr
                , L"Startup Notify called for resource type '%1!ws!'."
                , (LPCWSTR) NULL
                , GetResTypeName()
                );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    hr = punkIn->TypeSafeQI( IClusCfgResourceTypeCreate, &piccrtc );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    //
    // Create the resource type.
    //

    hr = piccrtc->Create(
                      GetResTypeName()
                    , GetDisplayName()
                    , GetDllName()
                    , 5 *  1000
                    , 60 * 1000
                    );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    hr = HrSendStatusReport(
                  TASKID_Major_Client_And_Server_Log
                , IID_NULL
                , 1
                , 1
                , 1
                , hr
                , L"Successfully created resource type '%1!ws!'."
                , (LPCWSTR) NULL
                , GetResTypeName()
                );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    //
    // Register the cluadmin extensions.
    //

    hr = piccrtc->RegisterAdminExtensions(
                      GetResTypeName()
                    , 1
                    , guidAdminEx
                    );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    hr = HrSendStatusReport(
                  TASKID_Major_Client_And_Server_Log
                , IID_NULL
                , 1
                , 1
                , 1
                , hr
                , L"Successfully registered Cluster Administrator extensions for resource type '%1!ws!'."
                , (LPCWSTR) NULL
                , GetResTypeName()
                );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    //
    // Unregister from StartupListener notifications.
    //

    hr = CoCreateInstance(
              CLSID_StdComponentCategoriesMgr
            , NULL
            , CLSCTX_INPROC_SERVER
            , __uuidof( pcrCatReg )
            , reinterpret_cast< void ** >( &pcrCatReg )
            );

    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if: CoCreate failed

    rgCatId[ 0 ] = CATID_ClusCfgStartupListeners;

    hr = pcrCatReg->UnRegisterClassImplCategories( CLSID_ClipBookServer, RTL_NUMBER_OF( rgCatId ), rgCatId );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if: deregister failed

    pcrCatReg->Release();
    pcrCatReg = NULL;

    hr = HrSendStatusReport(
                  TASKID_Major_Client_And_Server_Log
                , IID_NULL
                , 1
                , 1
                , 1
                , hr
                , L"Successfully unregistered the '%1!ws!' resource type from StartupListener notifications."
                , (LPCWSTR) NULL
                , GetResTypeName()
                );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

Cleanup:

    if ( piccrtc != NULL )
    {
        piccrtc->Release();
    } // if:

    if ( pcrCatReg != NULL )
    {
        pcrCatReg->Release();
    } // if:

    return hr;

} //*** CMgdResType::Notify

const CMgdResType& CMgdResType::operator= ( const CMgdResType & rSrcIn ) [private]
The documentation for this class was generated from the following files:
  • WinBase/Cluster/Win2003/ClipBookServer/ClipBook Server/CMgdResType.h
  • WinBase/Cluster/Win2003/ClipBookServer/ClipBook Server/CMgdResType.cpp
Generated on Wed Nov 13 2024 16:56:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMgrNotify Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CMgrNotify Class Reference

#include "CConf.h"

Inherits RefCount, CNotify, RefCount, CNotify, RefCount, CNotify, CRefCount, CNotify, RefCount, and CNotify.

List of all members.

Public Member Functions

CMgrNotify ()
CMgrNotify ()
CMgrNotify ()
CMgrNotify (Conf *)
CMgrNotify ()
~CMgrNotify ()
~CMgrNotify ()
virtual | ~CMgrNotify ()
~CMgrNotify ()
~CMgrNotify ()
ULONG STDMETHODCALLTYPE | AddRef (void)
ULONG STDMETHODCALLTYPE | AddRef (void)
ULONG STDMETHODCALLTYPE | AddRef (void)
ULONG STDMETHODCALLTYPE | AddRef (void)
ULONG STDMETHODCALLTYPE | AddRef (void)
HRESULT STDMETHODCALLTYPE | CallCreated (INmCall *pCall)
HRESULT STDMETHODCALLTYPE | CallCreated (INmCall *pCall)
HRESULT STDMETHODCALLTYPE | CallCreated (INmCall *pCall)
HRESULT STDMETHODCALLTYPE | CallCreated (INmCall *pCall)
HRESULT STDMETHODCALLTYPE | CallCreated (INmCall *pCall)
HRESULT STDMETHODCALLTYPE | ConferenceCreated (INmConference *pConference)
HRESULT STDMETHODCALLTYPE | ConferenceCreated (INmConference *pConference)
HRESULT STDMETHODCALLTYPE | ConferenceCreated (INmConference *pConference)
HRESULT STDMETHODCALLTYPE | ConferenceCreated (INmConference *pConference)
HRESULT STDMETHODCALLTYPE | ConferenceCreated (INmConference *pConference)
HRESULT STDMETHODCALLTYPE | Connect (IUnknown *pUnk)
HRESULT STDMETHODCALLTYPE | Connect (IUnknown *pUnk)
HRESULT STDMETHODCALLTYPE | Connect (IUnknown *pUnk)
HRESULT | Connect (IUnknown *pUnkOuter)
HRESULT STDMETHODCALLTYPE | Connect (IUnknown *pUnk)
HRESULT STDMETHODCALLTYPE | Disconnect (void)
HRESULT STDMETHODCALLTYPE | Disconnect (void)
HRESULT STDMETHODCALLTYPE | Disconnect (void)
HRESULT STDMETHODCALLTYPE | Disconnect (void)
HRESULT | Disconnect (void)
HRESULT STDMETHODCALLTYPE | NmUI (CONFN uNotify)
HRESULT STDMETHODCALLTYPE | NmUI (CONFN uNotify)
HRESULT STDMETHODCALLTYPE | NmUI (CONFN confn)
HRESULT STDMETHODCALLTYPE | NmUI (CONFN confn)
HRESULT STDMETHODCALLTYPE | NmUI (CONFN confn)
HRESULT STDMETHODCALLTYPE | QueryInterface (REFIID riid, PVOID *ppvObject)
HRESULT STDMETHODCALLTYPE | QueryInterface (REFIID riid, PVOID *ppvObj)
HRESULT STDMETHODCALLTYPE | QueryInterface (REFIID riid, PVOID *ppvObj)
HRESULT STDMETHODCALLTYPE | QueryInterface (REFIID riid, void **ppvObj)
HRESULT STDMETHODCALLTYPE | QueryInterface (REFIID riid, PVOID *ppvObj)
ULONG STDMETHODCALLTYPE | Release (void)
ULONG STDMETHODCALLTYPE | Release (void)
ULONG STDMETHODCALLTYPE | Release (void)
ULONG STDMETHODCALLTYPE | Release (void)
ULONG STDMETHODCALLTYPE | Release (void)

Private Member Functions

CMgrNotify ()

Private Attributes

Conf * m_pConf

Detailed Description

Definition at line 21 of file CConf.h.

Constructor & Destructor Documentation

CMgrNotify::CMgrNotify ( )

Definition at line 45 of file CConf.Cpp.

                       : RefCount(), CNotify()
{
}

CMgrNotify::~CMgrNotify ( )

Definition at line 55 of file CConf.Cpp.

{
}

CMgrNotify::CMgrNotify ( )
CMgrNotify::~CMgrNotify ( )
CMgrNotify::CMgrNotify ( )
CMgrNotify::~CMgrNotify ( )
CMgrNotify::CMgrNotify ( )
CMgrNotify::~CMgrNotify ( )
CMgrNotify::CMgrNotify ( ) [private]
CMgrNotify::CMgrNotify ( Conf * pConf )

Definition at line 1205 of file nmsession.cpp.

{
    m_pConf = pConf;
}

virtual CMgrNotify::~CMgrNotify ( ) [virtual]

Member Function Documentation

ULONG STDMETHODCALLTYPE CMgrNotify::AddRef ( void )

Definition at line 66 of file CConf.Cpp.

{
  return RefCount::AddRef();
}

ULONG STDMETHODCALLTYPE CMgrNotify::AddRef ( void )
ULONG STDMETHODCALLTYPE CMgrNotify::AddRef ( void )
ULONG STDMETHODCALLTYPE CMgrNotify::AddRef ( void )
ULONG STDMETHODCALLTYPE CMgrNotify::AddRef ( void )
HRESULT STDMETHODCALLTYPE CMgrNotify::CallCreated ( INmCall * pCall )
HRESULT STDMETHODCALLTYPE CMgrNotify::CallCreated ( INmCall * pCall )
HRESULT STDMETHODCALLTYPE CMgrNotify::CallCreated ( INmCall * pCall )
HRESULT STDMETHODCALLTYPE CMgrNotify::CallCreated ( INmCall * pCall )
HRESULT STDMETHODCALLTYPE CMgrNotify::CallCreated ( INmCall * pCall )

Definition at line 234 of file CConf.Cpp.

{
  return S_OK;
}

HRESULT STDMETHODCALLTYPE CMgrNotify::ConferenceCreated ( INmConference * pConference )
HRESULT STDMETHODCALLTYPE CMgrNotify::ConferenceCreated ( INmConference * pConference )
HRESULT STDMETHODCALLTYPE CMgrNotify::ConferenceCreated ( INmConference * pConference )
HRESULT STDMETHODCALLTYPE CMgrNotify::ConferenceCreated ( INmConference * pConference )

Definition at line 240 of file CConf.Cpp.

{
  if(NULL == pConference)
  {
    return E_POINTER;
  }

  HookConference(pConference);

  return S_OK;
}

HRESULT STDMETHODCALLTYPE CMgrNotify::ConferenceCreated ( INmConference * pConference )
HRESULT CMgrNotify::Connect ( IUnknown * pUnkOuter )
HRESULT STDMETHODCALLTYPE CMgrNotify::Connect ( IUnknown * pUnk )
HRESULT CMgrNotify::Connect ( IUnknown * pUnk )

Definition at line 212 of file CConf.Cpp.

{
  return CNotify::Connect(pUnk, IID_INmManagerNotify, (IUnknown *)this);
}

HRESULT STDMETHODCALLTYPE CMgrNotify::Connect ( IUnknown * pUnk )
HRESULT STDMETHODCALLTYPE CMgrNotify::Connect ( IUnknown * pUnk )
HRESULT CMgrNotify::Disconnect ( void )

Reimplemented from CNotify.

Definition at line 217 of file CConf.Cpp.

{
  return CNotify::Disconnect();
}

HRESULT STDMETHODCALLTYPE CMgrNotify::Disconnect ( void )

Reimplemented from CNotify.

HRESULT CMgrNotify::Disconnect ( void )

Reimplemented from CNotify.

HRESULT STDMETHODCALLTYPE CMgrNotify::Disconnect ( void )

Reimplemented from CNotify.

HRESULT STDMETHODCALLTYPE CMgrNotify::Disconnect ( void )

Reimplemented from CNotify.

HRESULT STDMETHODCALLTYPE CMgrNotify::NmUI ( CONFN confn )
HRESULT STDMETHODCALLTYPE CMgrNotify::NmUI ( CONFN confn )

Definition at line 229 of file CConf.Cpp.

{
  return S_OK;
}

HRESULT STDMETHODCALLTYPE CMgrNotify::NmUI ( CONFN confn )
HRESULT STDMETHODCALLTYPE CMgrNotify::NmUI ( CONFN uNotify )
HRESULT STDMETHODCALLTYPE CMgrNotify::NmUI ( CONFN uNotify )
HRESULT STDMETHODCALLTYPE CMgrNotify::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppvObj
 | ) |  |

Definition at line 101 of file conf.cpp.

{
    if(NULL == ppvObject)
  {
    return E_POINTER;
  }

  HRESULT hr = NO_ERROR;

    if (riid == IID_IUnknown)
    {
        *ppvObject = (IUnknown *)this;
    }
    else if (riid == IID_INmManagerNotify)
    {
        *ppvObject = (INmManagerNotify *)this;
    }
    else
    {
        hr = E_NOINTERFACE;
        *ppvObject = NULL;
    }

    if (S_OK == hr)
    {
        AddRef();
    }

    return hr;
}

HRESULT STDMETHODCALLTYPE CMgrNotify::QueryInterface | ( | REFIID | riid,
 |  | PVOID * | ppvObj
 | ) |  |
HRESULT STDMETHODCALLTYPE CMgrNotify::QueryInterface | ( | REFIID | riid,
 |  | PVOID * | ppvObj
 | ) |  |
HRESULT STDMETHODCALLTYPE CMgrNotify::QueryInterface | ( | REFIID | riid,
 |  | PVOID * | ppvObj
 | ) |  |

Definition at line 77 of file CConf.Cpp.

{
  if(NULL == ppvObject)
  {
    return E_POINTER;
  }

  HRESULT hr = NO_ERROR;

  if (riid == IID_IUnknown)
  {
    *ppvObject = (IUnknown *)this;
  }
  else if (riid == IID_INmManagerNotify)
  {
    *ppvObject = (INmManagerNotify *)this;
  }
  else
  {
    hr = E_NOINTERFACE;
    *ppvObject = NULL;
  }

  if (SUCCEEDED(hr))
  {
    AddRef();
  }

  return hr;
}

HRESULT STDMETHODCALLTYPE CMgrNotify::QueryInterface | ( | REFIID | riid,
 |  | PVOID * | ppvObject
 | ) |  |
ULONG STDMETHODCALLTYPE CMgrNotify::Release ( void )
ULONG STDMETHODCALLTYPE CMgrNotify::Release ( void )
ULONG STDMETHODCALLTYPE CMgrNotify::Release ( void )
ULONG STDMETHODCALLTYPE CMgrNotify::Release ( void )
ULONG STDMETHODCALLTYPE CMgrNotify::Release ( void )

Definition at line 72 of file CConf.Cpp.

{
  return RefCount::Release();
}

Member Data Documentation

Conf* CMgrNotify::m_pConf [private]

Definition at line 113 of file nmsession.h.

The documentation for this class was generated from the following files:
  • Web/NetMeeting/NMChat/CConf.h
  • Web/NetMeeting/PlugTransport/nmsession.h
  • Web/NetMeeting/NMChat2/conf.h
  • Web/NetMeeting/NMShare/CConf.h
  • Web/NetMeeting/NMUI/cMgr.h
  • Web/NetMeeting/NMChat/CConf.Cpp
  • Web/NetMeeting/NMChat2/conf.cpp
  • Web/NetMeeting/NMShare/CConf.Cpp
  • Web/NetMeeting/NMUI/cMgr.Cpp
  • Web/NetMeeting/PlugTransport/nmsession.cpp
Generated on Wed Nov 13 2024 16:56:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMMCControl Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Private Attributes

CMMCControl Class Reference

#include "mmccontrol.h"

List of all members.

Public Types

enum | { IDD = IDD_MMCCONTROL }

Public Member Functions

CMMCControl ()
~CMMCControl ()
STDMETHOD() | DoHelp ()
STDMETHOD() | InterfaceSupportsErrorInfo (REFIID riid)
STDMETHOD() | OnAmbientPropertyChange (DISPID dispid)
LRESULT | OnClickedAnimate (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
STDMETHOD() | StartAnimation ()
STDMETHOD() | StopAnimation ()

Private Attributes

BOOL m_bAnimating
UINT m_timerId

Detailed Description

Definition at line 30 of file mmccontrol.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 137 of file mmccontrol.h.

{ IDD = IDD_MMCCONTROL };

Constructor & Destructor Documentation

CMMCControl::CMMCControl ( ) [inline]

Definition at line 44 of file mmccontrol.h.

  {
        OutputDebugString(_TEXT("CMMCControl constructor\n"));

        m_bWindowOnly = TRUE;
        m_bAnimating = FALSE;
    CalcExtent(m_sizeExtent);
  }

CMMCControl::~CMMCControl ( ) [inline]

Definition at line 53 of file mmccontrol.h.

    {
        OutputDebugString(_TEXT("CMMCControl destructor\n"));
    }

Member Function Documentation

STDMETHODIMP CMMCControl::DoHelp ( )

Definition at line 53 of file mmccontrol.Cpp.

{
    MessageBox(_TEXT("DoHelp called"), _TEXT("Sample Animation control"), MB_OK);

  return S_OK;
}

STDMETHOD() CMMCControl::InterfaceSupportsErrorInfo ( REFIID riid ) [inline]

Definition at line 114 of file mmccontrol.h.

  {
    static const IID* arr[] =
    {
      &IID_IMMCControl,
    };
    for (int i=0; i<sizeof(arr)/sizeof(arr[0]); i++)
    {
            if (::InlineIsEqualGUID(*arr[i], riid))
        return S_OK;
    }
    return S_FALSE;
  }

STDMETHOD() CMMCControl::OnAmbientPropertyChange ( DISPID dispid ) [inline]

Definition at line 101 of file mmccontrol.h.

  {
    if (dispid == DISPID_AMBIENT_BACKCOLOR)
    {
      SetBackgroundColorFromAmbient();
      FireViewChange();
    }
    return IOleControlImpl<CMMCControl>::OnAmbientPropertyChange(dispid);
  }

LRESULT CMMCControl::OnClickedAnimate | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled |
 | ) |  |  | [inline]

Definition at line 138 of file mmccontrol.h.

  {
        m_bAnimating = !m_bAnimating;

        if (m_bAnimating)
            StartAnimation();
        else
            StopAnimation();

    return 0;
  }

STDMETHODIMP CMMCControl::StartAnimation ( )

Definition at line 29 of file mmccontrol.Cpp.

{
    m_bAnimating = TRUE;

    SetDlgItemText(IDC_ANIMATIONSTATE, _TEXT("Animation Running"));
    SetDlgItemText(IDC_ANIMATE, _TEXT("Stop"));

    OutputDebugString(_TEXT("CMMCControl_StartAnimation\n"));

  return S_OK;
}

STDMETHODIMP CMMCControl::StopAnimation ( )

Definition at line 41 of file mmccontrol.Cpp.

{
    m_bAnimating = FALSE;

    SetDlgItemText(IDC_ANIMATIONSTATE, _TEXT("Animation Stopped"));
    SetDlgItemText(IDC_ANIMATE, _TEXT("Start"));

    OutputDebugString(_TEXT("CMMCControl_StopAnimation\n"));

  return S_OK;
}

Member Data Documentation

BOOL CMMCControl::m_bAnimating [private]

Definition at line 151 of file mmccontrol.h.

UINT CMMCControl::m_timerId [private]

Definition at line 152 of file mmccontrol.h.

The documentation for this class was generated from the following files:
  • SysMgmt/MMC/ActiveX/atl/mmccontrol.h
  • SysMgmt/MMC/ActiveX/atl/mmccontrol.Cpp
Generated on Wed Nov 13 2024 16:56:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMmStream Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes | Friends

CMmStream Class Reference

#include "MMStrm.Hxx"

Inherits PMmStream.

List of all members.

Public Member Functions

CMmStream ()
CMmStream (WCHAR *wcsPath)
virtual | ~CMmStream ()
void | Close ()
void | Flush (CMmStreamBuf &sbuf, ULONG cb)
BOOL isEmpty ()
BOOL isWritable ()
void | Map (CMmStreamBuf &sbuf, ULONG cb=0, ULONG offLow=0, ULONG offHigh=0, BOOL fMapForWrite=FALSE)
void | MapAll (CMmStreamBuf &sbuf)
BOOL Ok ()
void | Open (const WCHAR *wcsPath, ULONG modeAccess, ULONG modeShare, ULONG modeCreate, ULONG modeAttribute=FILE_ATTRIBUTE_NORMAL)
void | OpenRorW (WCHAR *wcsPath)
void | SetSize (PStorage &storage, ULONG newSizeLow, ULONG newSizeHigh=0)
LONGLONG | Size () const
ULONG SizeHigh ()
ULONG SizeLow ()
void | Unmap (CMmStreamBuf &sbuf)

Protected Attributes

BOOL _fWrite
HANDLE _hFile
HANDLE _hMap
ULONG _sizeHigh
ULONG _sizeLow

Friends

class | CMmStreamBuf

Detailed Description

Definition at line 27 of file MMStrm.Hxx.

Constructor & Destructor Documentation

CMmStream::CMmStream ( )

Definition at line 44 of file MMStrm.Cxx.

        : _hFile(INVALID_HANDLE_VALUE),
          _hMap(0),
          _fWrite(FALSE),
          _sizeLow( 0 ),
          _sizeHigh( 0 )
{
}

CMmStream::CMmStream ( WCHAR * wcsPath )

Definition at line 29 of file MMStrm.Cxx.

    : _hMap(0),
      _sizeLow( 0 ),
      _sizeHigh( 0 )
{
    OpenRorW ( wcsPath );
}

CMmStream::~CMmStream ( ) [virtual]

Definition at line 62 of file MMStrm.Cxx.

{
    if (Ok())
    {
        if(_hMap )
        {
            CloseHandle(_hMap);
            _hMap = 0;
        }

        CloseHandle ( _hFile );
        _hFile = INVALID_HANDLE_VALUE;
    }
}

Member Function Documentation

void CMmStream::Close ( void ) [virtual]

Implements PMmStream.

Definition at line 474 of file MMStrm.Cxx.

{
    if (Ok())
    {
        if(_hMap )
        {
            if ( !CloseHandle(_hMap))
            {
                htmlDebugOut (( DEB_ERROR, "Closing file mapping failed\n" ));
                throw ( CException(HRESULT_FROM_WIN32(GetLastError())));
            }
            _hMap = 0;
        }
        if ( !CloseHandle ( _hFile ))
        {

            htmlDebugOut (( DEB_ERROR, "Closing file handle failed\n" ));
            throw ( CException(HRESULT_FROM_WIN32(GetLastError())));
        }
        _hFile = INVALID_HANDLE_VALUE;
    }
}

void CMmStream::Flush | ( | CMmStreamBuf & | sbuf,
 |  | ULONG | cb |
 | ) |  |  | [virtual]

Implements PMmStream.

Definition at line 671 of file MMStrm.Cxx.

{
    FlushViewOfFile ( sbuf.Get(), cb );
}

BOOL CMmStream::isEmpty ( ) [inline, virtual]

Implements PMmStream.

Definition at line 54 of file MMStrm.Hxx.

{ return _sizeHigh == 0 && _sizeLow == 0; }

BOOL CMmStream::isWritable ( ) [inline, virtual]

Implements PMmStream.

Definition at line 65 of file MMStrm.Hxx.

{ return _fWrite; }

void CMmStream::Map | ( | CMmStreamBuf & | sbuf,
 |  | ULONG | cb = 0,
 |  | ULONG | offLow = 0,
 |  | ULONG | offHigh = 0,
 |  | BOOL | fMapForWrite = FALSE |
 | ) |  |  | [virtual]

Implements PMmStream.

Definition at line 594 of file MMStrm.Cxx.

{
    Win4Assert ( _hMap != 0 );

    if ( !_fWrite )
    {
        //
        // Adjust size to be min( cb, sizeoffile - off )
        //

        LARGE_INTEGER size = { _sizeLow, _sizeHigh };
        LARGE_INTEGER off  = { offLow, offHigh };
        LARGE_INTEGER licb = { cb, 0 };
        LARGE_INTEGER diff;

        diff.QuadPart = size.QuadPart - off.QuadPart;

        if ( diff.QuadPart < licb.QuadPart )
        {
            cb = diff.LowPart;
            htmlDebugOut(( DEB_ITRACE,
                         "CMmStream::Map -- reducing map to 0x%x bytes\n",
                         cb ));
        }
    }

    void* buf = MapViewOfFile (
            _hMap,
            _fWrite? FILE_MAP_WRITE: FILE_MAP_READ,
            offHigh,
            offLow,
            cb );

    if ( 0 == buf )
    {
        htmlDebugOut(( DEB_ERROR,
                     "CMmStream::Map -- MapViewOfFile returned %d\n",
                     GetLastError() ));
        throw( CException( HRESULT_FROM_WIN32( GetLastError() ) ) );
    }

    sbuf.SetBuf( buf );
    sbuf.SetSize ( cb );
    sbuf.SetStream ( this );
}

void CMmStream::MapAll ( CMmStreamBuf & sbuf ) [virtual]

Implements PMmStream.

Definition at line 576 of file MMStrm.Cxx.

{
    Win4Assert ( SizeHigh() == 0 );
    Map ( sbuf, SizeLow(), 0, 0 );
}

BOOL CMmStream::Ok ( ) [inline, virtual]

Implements PMmStream.

Definition at line 36 of file MMStrm.Hxx.

{ return _hFile != INVALID_HANDLE_VALUE; }

void CMmStream::Open | ( | const WCHAR * | wcsPath,
 |  | ULONG | modeAccess,
 |  | ULONG | modeShare,
 |  | ULONG | modeCreate,
 |  | ULONG | modeAttribute = FILE_ATTRIBUTE_NORMAL
 | ) |  |

Definition at line 281 of file MMStrm.Cxx.

{
    _fWrite = FALSE;

    if ( GetOSVersion() == VER_PLATFORM_WIN32_NT )
    {
        _hFile = CreateFile( wcsPath,
                             modeAccess,
                             modeShare,
                             0, // security
                             modeCreate,
                             modeAttribute,
                             0 ); // template
    }
    else // win95
    {
        // Worst case - size of multibyte == size of Unicode
        int nLen = (int) ( wcslen( wcsPath ) * 2 );
        char *pszPath = new char[nLen];

        if ( pszPath == NULL )
        {
            _hFile = INVALID_HANDLE_VALUE;
        }
        else
        {
            if ( wcstombs( pszPath, wcsPath, nLen ) == -1 )
            {
                _hFile = INVALID_HANDLE_VALUE;
            }
            else
            {
                _hFile = CreateFileA( pszPath,
                                      modeAccess,
                                      modeShare,
                                      0, // security
                                      modeCreate,
                                      modeAttribute,
                                      0 ); // template
            }

            delete [] pszPath;
            pszPath = NULL;
        }
    }

    if ( !Ok() )
    {
        //
        // If applicable, delete a zomby and re-create it.
        //
        if ( IsCreateExisting( GetLastError(), modeAccess, modeCreate ) )
        {
            htmlDebugOut(( DEB_ERROR, "CreateNew on %ws - already exists\n",
                         wcsPath ));
            modeCreate &= ~CREATE_NEW;   // Turn off the Create new flag
            modeCreate |= CREATE_ALWAYS; // Enable the CREATE_ALWAYS flag.

            if ( GetOSVersion() == VER_PLATFORM_WIN32_NT )
            {
                _hFile = CreateFile( wcsPath,
                                     modeAccess,
                                     modeShare,
                                     0,          // security
                                     modeCreate,
                                     FILE_ATTRIBUTE_NORMAL,
                                     0 );        // template
            }
            else // win95
            {
                // Worst case - size of multibyte == size of Unicode
                int nLen = (int) wcslen( wcsPath );
                char *pszPath = new char[nLen];

                if ( pszPath == NULL )
                {
                    _hFile = INVALID_HANDLE_VALUE;
                }
                else
                {
                    if ( wcstombs( pszPath, wcsPath, nLen ) == -1 )
                    {
                        _hFile = INVALID_HANDLE_VALUE;
                    }
                    else
                    {
                        _hFile = CreateFileA( pszPath,
                                              modeAccess,
                                              modeShare,
                                              0,          // security
                                              modeCreate,
                                              FILE_ATTRIBUTE_NORMAL,
                                              0 );        // template
                    }
                    delete [] pszPath;
                    pszPath = NULL;
                }
            }
        }
    }

    if ( Ok() )
    {
        _sizeLow = GetFileSize ( _hFile, &_sizeHigh );

        if (_sizeLow == 0xffffffff && GetLastError() != NO_ERROR)
        {
            Close();
            htmlDebugOut (( DEB_ERROR, "Open stream %ws failed\n", wcsPath ));
            throw ( CException(HRESULT_FROM_WIN32(GetLastError())));
        }

        if ( modeAccess & GENERIC_WRITE )
        {
            _fWrite = TRUE;
            CommonPageRound(_sizeLow, _sizeHigh);
            // Handle the case of OFS zero size files
            if (_sizeLow == 0 && _sizeHigh == 0)
            {
                if ( SetFilePointer ( _hFile,
                                      COMMON_PAGE_SIZE,
                                      0,
                                      FILE_BEGIN ) == INVALID_SET_FILE_POINTER &&
                     GetLastError() != NO_ERROR )
                {
                    Close();
                    htmlDebugOut(( DEB_ERROR,
                                 "CMmStream::Open -- SetFilePointer returned %d\n",
                                 GetLastError() ));
                    throw ( CException(HRESULT_FROM_WIN32(GetLastError())));
                }

                if ( !SetEndOfFile( _hFile ) )
                {
                    Close();
                    htmlDebugOut(( DEB_ERROR,
                                 "CMmStream::Open -- SetEndOfFile returned %d\n",
                                 GetLastError() ));
                    throw ( CException(HRESULT_FROM_WIN32(GetLastError())));
                }
                _sizeLow = COMMON_PAGE_SIZE;
            }
        }

        if ( _sizeLow != 0 || _sizeHigh != 0 )
        {
            if ( GetOSVersion() == VER_PLATFORM_WIN32_NT )
            {
                _hMap = CreateFileMapping( _hFile,
                                           0, // security
                                           _fWrite ? PAGE_READWRITE : PAGE_READONLY,
                                           _sizeHigh,
                                           _sizeLow,
                                           0 ); // name
            }
            else // win95
            {
                _hMap = CreateFileMappingA( _hFile,
                                            0, // security
                                            _fWrite ? PAGE_READWRITE : PAGE_READONLY,
                                            _sizeHigh,
                                            _sizeLow,
                                            0 ); // name
            }

            if (_hMap == NULL)
            {
                Close();
                htmlDebugOut (( DEB_ERROR, "File mapping failed\n" ));
                throw ( CException(HRESULT_FROM_WIN32(GetLastError())));
            }
        }
    }
    else
    {
        htmlDebugOut (( DEB_ITRACE, "Open failed on MM Stream; GetLastError()=0x%x\n",
                      GetLastError() ));
    }
}

void CMmStream::OpenRorW ( WCHAR * wcsPath )

Definition at line 93 of file MMStrm.Cxx.

{
    // Try read write access (create if possible)

    if ( GetOSVersion() == VER_PLATFORM_WIN32_NT )
    {
        _hFile = CreateFile( wcsPath,
                             GENERIC_READ | GENERIC_WRITE,
                             FILE_SHARE_READ,
                             0, // security
                             OPEN_ALWAYS,
                             FILE_ATTRIBUTE_NORMAL,
                             0 ); // template
    }
    else // win95
    {
        // Worst case - size of multibyte == size of Unicode
        int nLen = (int) ( wcslen( wcsPath ) * 2 );
        char *pszPath = new char[nLen];

        if ( pszPath == NULL )
        {
            _hFile = INVALID_HANDLE_VALUE;
        }
        else
        {
            if ( wcstombs( pszPath, wcsPath, nLen ) == -1 )
            {
                _hFile = INVALID_HANDLE_VALUE;
            }
            else
            {
                _hFile = CreateFileA( pszPath,
                                      GENERIC_READ | GENERIC_WRITE,
                                      FILE_SHARE_READ,
                                      0, // security
                                      OPEN_ALWAYS,
                                      FILE_ATTRIBUTE_NORMAL,
                                      0 ); // template
            }
            delete [] pszPath;
            pszPath = NULL;
        }
    }

    if ( Ok() )
    {
        _fWrite = TRUE;
    }
    else
    {
        _fWrite = FALSE;
        // Try read only access

        if ( GetOSVersion() == VER_PLATFORM_WIN32_NT )
        {
            _hFile = CreateFile( wcsPath,
                                 GENERIC_READ,
                                 FILE_SHARE_READ | FILE_SHARE_WRITE,
                                 0, // security
                                 OPEN_EXISTING,
                                 FILE_ATTRIBUTE_NORMAL,
                                 0 ); // template
        }
        else // win95
        {
            // Worst case - size of multibyte == size of Unicode
            int nLen = (int) ( wcslen( wcsPath ) * 2 );
            char *pszPath = new char[nLen];

            if ( pszPath == NULL )
            {
                _hFile = INVALID_HANDLE_VALUE;
            }
            else
            {
                if ( wcstombs( pszPath, wcsPath, nLen ) == -1 )
                {
                    _hFile = INVALID_HANDLE_VALUE;
                }
                else
                {
                    _hFile = CreateFileA( pszPath,
                                          GENERIC_READ,
                                          FILE_SHARE_READ | FILE_SHARE_WRITE,
                                          0, // security
                                          OPEN_EXISTING,
                                          FILE_ATTRIBUTE_NORMAL,
                                          0 ); // template
                }
                delete [] pszPath;
                pszPath = NULL;
            }
        }
    }

    if (Ok())
    {
        _sizeLow = GetFileSize ( _hFile, &_sizeHigh );

        if (_sizeLow == 0xffffffff && GetLastError() != NO_ERROR)
        {
            Close();
            throw ( CException(HRESULT_FROM_WIN32(GetLastError())));
        }

        if (_fWrite )
        {
            CommonPageRound(_sizeLow, _sizeHigh);
        }

        if ( _sizeLow != 0 || _sizeHigh != 0 )
        {
            if ( GetOSVersion() == VER_PLATFORM_WIN32_NT )
            {
                _hMap = CreateFileMapping( _hFile,
                                           0, // security
                                           _fWrite ? PAGE_READWRITE : PAGE_READONLY,
                                           _sizeHigh,
                                           _sizeLow,
                                           0 ); // name
            }
            else // windows 95
            {
                _hMap = CreateFileMappingA( _hFile,
                                            0, // security
                                            _fWrite ? PAGE_READWRITE : PAGE_READONLY,
                                            _sizeHigh,
                                            _sizeLow,
                                            0 ); // name
            }

            if (_hMap == NULL)
            {
                Close();
                throw ( CException(HRESULT_FROM_WIN32(GetLastError())));
            }
        }
    }
}

void CMmStream::SetSize | ( | PStorage & | storage,
 |  | ULONG | newSizeLow,
 |  | ULONG | newSizeHigh = 0 |
 | ) |  |  | [virtual]

Implements PMmStream.

Definition at line 509 of file MMStrm.Cxx.

{
    if (_hMap != 0)
        CloseHandle(_hMap);

    LARGE_INTEGER sizeOld = { _sizeLow, _sizeHigh };
    LARGE_INTEGER sizeNew = { newSizeLow, newSizeHigh };

    if (sizeNew.QuadPart < sizeOld.QuadPart)
    {
        if ( SetFilePointer ( _hFile,
                              newSizeLow,
                              (long *)&newSizeHigh,
                              FILE_BEGIN ) == INVALID_SET_FILE_POINTER  &&
             GetLastError() != NO_ERROR )
        {
            htmlDebugOut(( DEB_ERROR,
                         "CMmStream::Close -- SetFilePointer returned %d\n",
                         GetLastError() ));
            throw ( CException(HRESULT_FROM_WIN32(GetLastError())));
        }

        if ( !SetEndOfFile( _hFile ) )
        {
            htmlDebugOut(( DEB_ERROR,
                         "CMmStream::Close -- SetEndOfFile returned %d\n",
                         GetLastError() ));
            throw ( CException(HRESULT_FROM_WIN32(GetLastError())));
        }

    }

    if ( GetOSVersion() == VER_PLATFORM_WIN32_NT )
    {
        _hMap = CreateFileMapping( _hFile,
                                   0, // security
                                   PAGE_READWRITE,
                                   newSizeHigh,
                                   newSizeLow,
                                   0 ); // name
    }
    else // win95
    {
        _hMap = CreateFileMappingA( _hFile,
                                    0, // security
                                    PAGE_READWRITE,
                                    newSizeHigh,
                                    newSizeLow,
                                    0 ); // name
    }

    if (_hMap == 0)
        throw ( CException(HRESULT_FROM_WIN32(GetLastError())));

    _sizeLow = newSizeLow;
    _sizeHigh = newSizeHigh;
}

LONGLONG CMmStream::Size ( ) const [inline, virtual]

Implements PMmStream.

Definition at line 60 of file MMStrm.Hxx.

    {
        return llfromuls( _sizeLow, _sizeHigh );
    }

ULONG CMmStream::SizeHigh ( ) [inline, virtual]

Implements PMmStream.

Definition at line 58 of file MMStrm.Hxx.

{ return _sizeHigh; }

ULONG CMmStream::SizeLow ( ) [inline, virtual]

Implements PMmStream.

Definition at line 56 of file MMStrm.Hxx.

{ return _sizeLow; }

void CMmStream::Unmap ( CMmStreamBuf & sbuf ) [virtual]

Implements PMmStream.

Definition at line 651 of file MMStrm.Cxx.

{
     if ( !UnmapViewOfFile(sbuf.Get()) )
     {
         htmlDebugOut(( DEB_ERROR, "UnmapViewOfFile returned %d\n",
                      GetLastError() ));
         throw( CException( HRESULT_FROM_WIN32( GetLastError() ) ) );
     }

     sbuf.SetBuf ( 0 );
}

Friends And Related Function Documentation

friend class CMmStreamBuf [friend]

Definition at line 29 of file MMStrm.Hxx.

Member Data Documentation

BOOL CMmStream::_fWrite [protected]

Definition at line 88 of file MMStrm.Hxx.

HANDLE CMmStream::_hFile [protected]

Definition at line 82 of file MMStrm.Hxx.

HANDLE CMmStream::_hMap [protected]

Definition at line 83 of file MMStrm.Hxx.

ULONG CMmStream::_sizeHigh [protected]

Definition at line 86 of file MMStrm.Hxx.

ULONG CMmStream::_sizeLow [protected]

Definition at line 85 of file MMStrm.Hxx.

The documentation for this class was generated from the following files:
  • WinBase/Indexing/IFilter/MMStrm.Hxx
  • WinBase/Indexing/IFilter/MMStrm.Cxx
Generated on Wed Nov 13 2024 16:56:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMmStreamBuf Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CMmStreamBuf Class Reference

#include "PMMStrm.Hxx"

Inherited by CMmStreamConsecBuf.

List of all members.

Public Member Functions

CMmStreamBuf ()
~CMmStreamBuf ()
void * | Get ()
void | SetBuf (void *buf)
void | SetSize (ULONG cb)
void | SetStream (PMmStream *pStream)
ULONG | Size () const

Private Attributes

BYTE * | _buf
ULONG _cb
PMmStream * _pStream

Detailed Description

Definition at line 169 of file PMMStrm.Hxx.

Constructor & Destructor Documentation

CMmStreamBuf::CMmStreamBuf ( ) [inline]

Definition at line 198 of file PMMStrm.Hxx.

                                  : _buf(0), _cb(0), _pStream(0)
{
}

CMmStreamBuf::~CMmStreamBuf ( )

Definition at line 18 of file MMbuf.Cxx.

{
    if (_buf && _pStream )
        _pStream->Unmap(*this);
}

Member Function Documentation

void* CMmStreamBuf::Get ( ) [inline]

Definition at line 178 of file PMMStrm.Hxx.

{ return (void *)_buf; }

void CMmStreamBuf::SetBuf ( void * buf ) [inline]

Definition at line 184 of file PMMStrm.Hxx.

{ _buf = (BYTE *) buf; }

void CMmStreamBuf::SetSize ( ULONG cb ) [inline]

Definition at line 182 of file PMMStrm.Hxx.

{ _cb = cb; }

void CMmStreamBuf::SetStream ( PMmStream * pStream ) [inline]

Definition at line 186 of file PMMStrm.Hxx.

{ _pStream = pStream; }

ULONG CMmStreamBuf::Size ( ) const [inline]

Definition at line 180 of file PMMStrm.Hxx.

{ return _cb; }

Member Data Documentation

BYTE* CMmStreamBuf::_buf [private]

Definition at line 191 of file PMMStrm.Hxx.

ULONG CMmStreamBuf::_cb [private]

Definition at line 193 of file PMMStrm.Hxx.

PMmStream* CMmStreamBuf::_pStream [private]

Definition at line 195 of file PMMStrm.Hxx.

The documentation for this class was generated from the following files:
  • WinBase/Indexing/IFilter/PMMStrm.Hxx
  • WinBase/Indexing/IFilter/MMbuf.Cxx
Generated on Wed Nov 13 2024 16:56:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMmStreamConsecBuf Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CMmStreamConsecBuf Class Reference

#include "MMScBuf.Hxx"

Inherits CMmStreamBuf.

List of all members.

Public Member Functions

CMmStreamConsecBuf ()
BOOL Eof ()
void | Init (PMmStream *pMmStream)
void | Map (ULONG cb)
void | Rewind ()

Private Attributes

LARGE_INTEGER | _liOffset
PMmStream * _pMmStream

Detailed Description

Definition at line 27 of file MMScBuf.Hxx.

Constructor & Destructor Documentation

CMmStreamConsecBuf::CMmStreamConsecBuf ( )

Definition at line 26 of file MMScBuf.Cxx.

: _pMmStream(0)
{
    LARGE_INTEGER liOffset = { 0, 0 };
    _liOffset = liOffset;
}

Member Function Documentation

BOOL CMmStreamConsecBuf::Eof ( )

Definition at line 118 of file MMScBuf.Cxx.

{
    Win4Assert( 0 != _pMmStream );
    return( ( (ULONG) _liOffset.HighPart == _pMmStream->SizeHigh() ) &&
            ( _liOffset.LowPart == _pMmStream->SizeLow() ) );
}

void CMmStreamConsecBuf::Init ( PMmStream * pMmStream )

Definition at line 80 of file MMScBuf.Cxx.

{
    _pMmStream = pMmStream;
    LARGE_INTEGER liOffset = { 0, 0 };
    _liOffset = liOffset;
}

void CMmStreamConsecBuf::Map ( ULONG cb )

Definition at line 43 of file MMScBuf.Cxx.

{
    Win4Assert( 0 != _pMmStream );

    if ( Get() != 0 )
        _pMmStream->Unmap( *this );

    LARGE_INTEGER liNewOffset;
    LARGE_INTEGER liStreamSize={_pMmStream->SizeLow(), _pMmStream->SizeHigh()};

     liNewOffset.QuadPart = cb + _liOffset.QuadPart;

    if ( liNewOffset.QuadPart > liStreamSize.QuadPart )
    {
        cb = (ULONG)(liStreamSize.QuadPart - _liOffset.QuadPart);
        liNewOffset = liStreamSize;
    }

    _pMmStream->Map( *this,
                     cb,
                     _liOffset.LowPart,
                     _liOffset.HighPart );

    _liOffset = liNewOffset;
}

void CMmStreamConsecBuf::Rewind ( )

Definition at line 95 of file MMScBuf.Cxx.

{

    Win4Assert( 0 != _pMmStream );

    if ( Get() != 0 )
        _pMmStream->Unmap( *this );

    _liOffset.LowPart = 0;
    _liOffset.HighPart = 0;
}

Member Data Documentation

LARGE_INTEGER CMmStreamConsecBuf::_liOffset [private]

Definition at line 44 of file MMScBuf.Hxx.

PMmStream* CMmStreamConsecBuf::_pMmStream [private]

Definition at line 43 of file MMScBuf.Hxx.

The documentation for this class was generated from the following files:
  • WinBase/Indexing/IFilter/MMScBuf.Hxx
  • WinBase/Indexing/IFilter/MMScBuf.Cxx
Generated on Wed Nov 13 2024 16:56:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CModel Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CModel Class Reference

#include "Grid.Hxx"

List of all members.

Public Member Functions

CModel (HINSTANCE hInst, HWND hwnd, UINT fuFormat=HEXADECIMAL, UINT fUsedPageOnly=USEDONLY)
~CModel ()
BOOL CanNextPage ()
BOOL CanNextSection ()
BOOL CanPrevPage ()
BOOL CanPrevSection ()
BOOL | ChooseFont (HWND hwnd)
BOOL | CreateFont (LOGFONT &lf)
HFONT | GetFont ()
void | GetFormat (UINT &fuFormat)
void | GetLineSize (SIZE *psize)
UINT GetMaxPage ()
UINT GetMaxSection ()
UINT GetPage ()
void | GetPageMode (UINT &fPageMode)
UINT | Hittest (POINT pt)
BOOL IsModelPageUsed (UINT nPage)
void | NextPage ()
void | NextSection ()
void | Paint (CCanvas &canvas, RECT rc)
void | PrevPage ()
void | PrevSection ()
void | SetCSet (CSet *pCset)
void | SetFormat (UINT fuFormat=HEXADECIMAL)
void | SetPage (UINT nPage)
void | SetPageMode (UINT fPageMode=USEDONLY)

Protected Attributes

UINT _fPageMode
CFontRange _fr
HINSTANCE | _hInst
UINT _iPage
UINT _macPage
CPageFormat _pf
CPage * _pPage

Detailed Description

Definition at line 267 of file Grid.Hxx.

Constructor & Destructor Documentation

CModel::CModel | ( | HINSTANCE | hInst,
 |  | HWND | hwnd,
 |  | UINT | fuFormat = HEXADECIMAL,
 |  | UINT | fUsedPageOnly = USEDONLY
 | ) |  |

Definition at line 698 of file Grid.Cxx.

                                                                        :
    _iPage(0),
#ifdef UNICODE
    _macPage(0x100),
#else
    _macPage(1),
#endif
    _pf(fuFormat),
    _hInst(hInst),
    _fPageMode(fPageMode)
{
    _pPage = new CPage(hInst, _pf, _iPage);
    _fr.SetFontRange(hwnd, _pf._fontChar);
}

CModel::~CModel ( )

Definition at line 713 of file Grid.Cxx.

{
    delete _pPage;
}

Member Function Documentation

BOOL CModel::CanNextPage ( ) [inline]

Definition at line 278 of file Grid.Hxx.

{ return _iPage + 1 < _macPage; };

BOOL CModel::CanNextSection ( ) [inline]

Definition at line 280 of file Grid.Hxx.

{ return _iPage +16 < _macPage; };

BOOL CModel::CanPrevPage ( ) [inline]

Definition at line 279 of file Grid.Hxx.

{ return _iPage;                };

BOOL CModel::CanPrevSection ( ) [inline]

Definition at line 281 of file Grid.Hxx.

{ return _iPage + 1 >= 16;      };

BOOL CModel::ChooseFont ( HWND hwnd )

Definition at line 794 of file Grid.Cxx.

{
    if(_pf._fontChar.Choose(hwnd))
    {
     _fr.SetFontRange(hwnd, _pf._fontChar);
         _pPage->SetFont(_pf._fontChar);
         return TRUE;
    }
    return FALSE;
}

BOOL CModel::CreateFont ( LOGFONT & lf )

Definition at line 784 of file Grid.Cxx.

{
    if(_pf._fontChar.Create(lf))
    {
         _pPage->SetFont(_pf._fontChar);
         return TRUE;
    }
    return FALSE;
}

HFONT CModel::GetFont ( )

Definition at line 779 of file Grid.Cxx.

{
    return _pf._fontChar;
}

void CModel::GetFormat ( UINT & fuFormat )

Definition at line 769 of file Grid.Cxx.

{
    fuFormat=_pf._fuFormat;
}

void CModel::GetLineSize ( SIZE * psize ) [inline]

Definition at line 290 of file Grid.Hxx.

                                        { psize->cx = 4*INCH2/5;
                                          psize->cy = INCH2;
                                        }

UINT CModel::GetMaxPage ( ) [inline]

Definition at line 284 of file Grid.Hxx.

{ return _macPage; };

UINT CModel::GetMaxSection ( ) [inline]

Definition at line 285 of file Grid.Hxx.

{ return _macPage / 16; };

UINT CModel::GetPage ( ) [inline]

Definition at line 282 of file Grid.Hxx.

{ return _iPage;                };

void CModel::GetPageMode ( UINT & fPageMode )

Definition at line 810 of file Grid.Cxx.

{
    fPageMode = _fPageMode;
}

UINT CModel::Hittest ( POINT pt )

Definition at line 805 of file Grid.Cxx.

{
    return _pPage->Hittest( pt);
}

BOOL CModel::IsModelPageUsed ( UINT nPage ) [inline]

Definition at line 303 of file Grid.Hxx.

{return _fr.IsPageUsed(nPage);}

void CModel::NextPage ( )

Definition at line 718 of file Grid.Cxx.

{

    if (_fPageMode == ALLPAGES)
        SetPage(_iPage+=(_iPage+1<_macPage? 1 : 0));
  else
      {
      int iNewPage = _iPage;
        while (!_fr.IsPageUsed(++iNewPage) && iNewPage < (int)_macPage);// scan until first found
    if (iNewPage < (int)_macPage)                // change only if under boundary
        SetPage(_iPage = (UINT)iNewPage);
    }
}

void CModel::NextSection ( )

Definition at line 745 of file Grid.Cxx.

{
  _iPage+=(_iPage+16<_macPage? 16 : 0);      // increment by 16 pages
    if (_fPageMode == ALLPAGES || _fr.IsPageUsed(_iPage)) // if in USEDONLY mode and
        SetPage(_iPage);               // the page is not used
  else
    NextPage();
}                          // we skip to the next

void CModel::Paint | ( | CCanvas & | canvas,
 |  | RECT | rc |
 | ) |  |  | [inline]

Definition at line 288 of file Grid.Hxx.

{_pPage->Paint(canvas, rc);};

void CModel::PrevPage ( )

Definition at line 732 of file Grid.Cxx.

{
    if (_fPageMode == ALLPAGES)
        SetPage(_iPage-=(_iPage? 1 : 0));
  else
      {
      int iNewPage = _iPage;
        while (!_fr.IsPageUsed(--iNewPage) && iNewPage >= 0); // scan until first found
    if (iNewPage >= 0)                                // change only if above boundary
        SetPage(_iPage = (UINT)iNewPage);
    }
}

void CModel::PrevSection ( )

Definition at line 754 of file Grid.Cxx.

{
    _iPage-=(_iPage >= 16 ? 16 : 0);
    if (_fPageMode == ALLPAGES || _fr.IsPageUsed(_iPage)) // if in USEDONLY mode and
        SetPage(_iPage);               // the page is not used
  else
    PrevPage();                  // we skip to the previous
}

void CModel::SetCSet ( CSet * pCset )

Definition at line 827 of file Grid.Cxx.

{
  vpCSet = pCSet;
}

void CModel::SetFormat ( UINT fuFormat = HEXADECIMAL )

Definition at line 774 of file Grid.Cxx.

{
    _pPage->SetFormat(fuFormat);
}

void CModel::SetPage ( UINT nPage )

Definition at line 763 of file Grid.Cxx.

{
    delete _pPage;
    _pPage = new CPage(_hInst, _pf, nPage);
}

void CModel::SetPageMode ( UINT fPageMode = USEDONLY )

Definition at line 815 of file Grid.Cxx.

{
    _fPageMode = fPageMode;
  if (fPageMode == USEDONLY && !_fr.IsPageUsed(_iPage))//if the current page is empty
      {
    UINT iCurrentPage = _iPage;
    NextPage();                 //we skip to next
    if (iCurrentPage == _iPage)         //if there is no next page
        PrevPage();               //we go to prev (has to be one)
    }
}

Member Data Documentation

UINT CModel::_fPageMode [protected]

Definition at line 311 of file Grid.Hxx.

CFontRange CModel::_fr [protected]

Definition at line 312 of file Grid.Hxx.

HINSTANCE CModel::_hInst [protected]

Definition at line 310 of file Grid.Hxx.

UINT CModel::_iPage [protected]

Definition at line 306 of file Grid.Hxx.

UINT CModel::_macPage [protected]

Definition at line 307 of file Grid.Hxx.

CPageFormat CModel::_pf [protected]

Definition at line 308 of file Grid.Hxx.

CPage* CModel::_pPage [protected]

Definition at line 309 of file Grid.Hxx.

The documentation for this class was generated from the following files:
  • Multimedia/Gdi/Fonts/GridFont/Grid.Hxx
  • Multimedia/Gdi/Fonts/GridFont/Grid.Cxx
Generated on Wed Nov 13 2024 16:56:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMonitor Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CMonitor Class Reference

#include "cmonitor.h"

List of all members.

Public Member Functions

CMonitor ()
~CMonitor ()
ULONG STDMETHODCALLTYPE | AddRef ()
HRESULT STDMETHODCALLTYPE | JobError (IBackgroundCopyJob *pJob, IBackgroundCopyError *pError)
HRESULT STDMETHODCALLTYPE | JobModification (IBackgroundCopyJob *pJob, DWORD dwReserved)
HRESULT STDMETHODCALLTYPE | JobTransferred (IBackgroundCopyJob *pJob)
HRESULT STDMETHODCALLTYPE | QueryInterface (REFIID riid, LPVOID *ppvObj)
ULONG STDMETHODCALLTYPE | Release ()

Private Member Functions

HRESULT | ProcessReply (IBackgroundCopyJob *pJob)

Private Attributes

LONG | m_lRefCount

Detailed Description

Definition at line 22 of file cmonitor.h.

Constructor & Destructor Documentation

CMonitor::CMonitor ( ) [inline]

Definition at line 27 of file cmonitor.h.

{ m_lRefCount = 0;};

CMonitor::~CMonitor ( ) [inline]

Definition at line 28 of file cmonitor.h.

{};

Member Function Documentation

ULONG CMonitor::AddRef ( void )

Definition at line 65 of file cmonitor.cpp.

{
    if (m_lRefCount == 0) // first time this function is called
    {
        g_hSafeToExitEvent = CreateEvent(
             NULL,   // default security attributes
             FALSE,  // auto-reset event object
             FALSE,  // initial state is nonsignaled
             NULL);  // unnamed object

        // in case of failure just act as we didn't create the event
        if (!g_hSafeToExitEvent)
        {
            g_hSafeToExitEvent = INVALID_HANDLE_VALUE;
        }
    }

    return InterlockedIncrement(&m_lRefCount);
}

HRESULT CMonitor::JobError | ( | IBackgroundCopyJob * | pJob,
 |  | IBackgroundCopyError * | pError
 | ) |  |

Definition at line 160 of file cmonitor.cpp.

{
    HRESULT hr;
    GUID    guid;
    HRESULT hrErrorId;
    WCHAR  *pwszErrorDescription   = NULL;
    WCHAR  *pwszContextDescription = NULL;
    BG_ERROR_CONTEXT Context;

    //
    // Collect information about the failed job
    //

    hr = pJob->GetId(&guid);
    if (FAILED(hr))
    {
        goto cleanup;
    }

    hr = pError->GetError(&Context, &hrErrorId);
    if (FAILED(hr))
    {
        goto cleanup;
    }

    hr = pError->GetErrorContextDescription(MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT), &pwszContextDescription);
    if (FAILED(hr))
    {
        goto cleanup;
    }

    hr = pError->GetErrorDescription(MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT), &pwszErrorDescription);
    if (FAILED(hr))
    {
        goto cleanup;
    }

    //
    // Cancel the job because the error is not recoverable
    //
    hr = pJob->Cancel();

    g_pDialog->AddStatusMessage(L"Notification received (BG_NOTIFY_JOB_ERROR). (Job ID %s)\r\n"
        L"   Error context: %s"
        L"   Error id: Ox%X\r\n"
        L"   Error description: %s"
        L"   This error is not recoverable and the job will be cancelled.",
        ConvertGuidToString(guid),
        pwszContextDescription,
        hrErrorId,
        pwszErrorDescription
    );
    g_pDialog->AddStatusMessage(L"END OF UPLOAD PROCESS -- FAILED");

cleanup:

    if (FAILED(hr))
    {
        DisplayErrorMessage(L"Notification received (BG_NOTIFY_JOB_ERROR), but the error description could not be retrieved and the job was not cancelled. Error id is 0x%X", hr);
    }

    // safe to call these if pointer is NULL
    CoTaskMemFree(pwszContextDescription);
    CoTaskMemFree(pwszErrorDescription);

    //If you do not return S_OK, BITS continues to call this callback.
    return S_OK;
}

HRESULT CMonitor::JobModification | ( | IBackgroundCopyJob * | pJob,
 |  | DWORD | dwReserved
 | ) |  |

Definition at line 230 of file cmonitor.cpp.

{
    HRESULT      hr;
    GUID         guid;
    BG_JOB_STATE State;
    WCHAR        *pwszErrorDescription   =    NULL;
    WCHAR        *pwszContextDescription =    NULL;
    HRESULT hrErrorId;
    BG_ERROR_CONTEXT Context;

    hr = pJob->GetState(&State);
    if (FAILED(hr))
    {
        DisplayErrorMessage(L"BITS Upload Sample was unable to get the BITS job state. ", hr);
        return S_OK;
    }

    if (State == BG_JOB_STATE_TRANSIENT_ERROR)
    {
        CSmartComPtr<IBackgroundCopyError> Error;

        hr = pJob->GetId(&guid);
        if (FAILED(hr))
        {
            goto cleanup;
        }

        hr = pJob->GetError(&Error);
        if (FAILED(hr))
        {
            goto cleanup;
        }

        hr = Error->GetError(&Context, &hrErrorId);
        if (FAILED(hr))
        {
            goto cleanup;
        }

        hr = Error->GetErrorContextDescription(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), &pwszContextDescription);
        if (FAILED(hr))
        {
            goto cleanup;
        }

        hr = Error->GetErrorDescription(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), &pwszErrorDescription);
        if (FAILED(hr))
        {
            goto cleanup;
        }

        g_pDialog->AddStatusMessage(L"Job entered a transient error state. (Job ID %s)\r\n"
            L"   Error context: %s"
            L"   Error id: 0x%X\r\n"
            L"   Error description: %s"
            L"   BITS will retry to upload the file.",
            ConvertGuidToString(guid),
            pwszContextDescription,
            hrErrorId,
            pwszErrorDescription
        );
    }

cleanup:

    // safe to call these if pointer is NULL
    CoTaskMemFree(pwszContextDescription);
    CoTaskMemFree(pwszErrorDescription);

    return S_OK;
}

HRESULT CMonitor::JobTransferred ( IBackgroundCopyJob * pJob )

Definition at line 108 of file cmonitor.cpp.

{
    HRESULT hr;
    GUID    guid;
    BG_JOB_TYPE JobType;

    hr = pJob->GetType(&JobType);
    if (FAILED(hr))
    {
        goto cleanup;
    }

    if (JobType == BG_JOB_TYPE_UPLOAD_REPLY)
    {
        hr = ProcessReply(pJob);
        if (FAILED(hr))
        {
            goto cleanup;
        }
    }

    hr = pJob->Complete();
    if (FAILED(hr))
    {
        // BITS probably was unable to rename one or more of the
        // temporary files. We won't do anything about this
        goto cleanup;
    }

    hr = pJob->GetId(&guid);
    if (FAILED(hr))
    {
        goto cleanup;
    }

    g_pDialog->AddStatusMessage(L"Notification received (BG_NOTIFY_JOB_TRANSFERRED). File was uploaded! (Job ID %s)", ConvertGuidToString(guid));
    g_pDialog->AddStatusMessage(L"END OF UPLOAD PROCESS");

cleanup:

    if (FAILED(hr))
    {
        DisplayErrorMessage(L"Notification received (BG_NOTIFY_JOB_TRANSFERRED), but an error occured. Error id is 0x%X", hr);
    }

    //If you do not return S_OK, BITS continues to call this callback.
    return S_OK;
}

HRESULT CMonitor::ProcessReply ( IBackgroundCopyJob * pJob ) [private]

Definition at line 306 of file cmonitor.cpp.

{
    HRESULT hr;
    CSmartComPtr<IBackgroundCopyJob2> Job2;
    BYTE  *pReply    = NULL;
    WCHAR *pTextData = NULL;
    UINT64 ReplySize;
    GUID   guid;

    //
    // Initialize our Job2 smart object. Note the use of the & operator
    //
    hr = pJob->QueryInterface(__uuidof(IBackgroundCopyJob2), (void**)&Job2);
    if (FAILED(hr))
    {
        goto cleanup;
    }

    hr = pJob->GetId(&guid);
    if (FAILED(hr))
    {
        goto cleanup;
    }

    hr = Job2->GetReplyData(&pReply, &ReplySize);
    if (hr == S_OK)
    {
        // check if we got the reply data.
        // As we are expecting to receive a Unicode file as a reply, check that at least
        // 2 bytes were received. 2 bytes is the size of the unicode prologue
        if (pReply && (ReplySize > 2))
        {
            // allocate a buffer to copy the data
            // we need to do this because we need to add a \0 at the end of the
            // data stream before we can treat it as a WCHAR string
            pTextData = reinterpret_cast<WCHAR *>(new BYTE[static_cast<size_t>(ReplySize)]);
            if (!pTextData)
            {
                hr = E_OUTOFMEMORY;
                goto cleanup;
            }

            // now here's something tricky: we want to add a \0 to the end of the string,
            // but we also want to skip 2 bytes at the beguinning of the string.
            // Note that overall we have enough space by allocating just ReplySize

            // initialize our buffer with zeros
            memset(pTextData, 0, static_cast<size_t>(ReplySize));

            // copy the relevant data to the buffer, skipping 2 bytes because of the Unicode prologue
            // note that pTextData is WCHAR* and pReply is BYTE*
            memcpy(pTextData, (pReply + 2), (static_cast<size_t>(ReplySize) - 2));

            g_pDialog->AddStatusMessage(L"The server sent the following data as a response to the uploaded file: (Job ID %s)\r\n"
                                        L"\r\n%s", ConvertGuidToString(guid), pTextData);

        }
        else
        {
            g_pDialog->AddStatusMessage(L"No reply data was received. (Job ID %s)", ConvertGuidToString(guid));
        }
    }

cleanup:

    if (pReply)
    {
        CoTaskMemFree(pReply);
        pReply = NULL;
    }

    if (pTextData)
    {
        delete [] reinterpret_cast<BYTE *>(pTextData);
        pTextData = NULL;
    }

    return hr;
}

HRESULT CMonitor::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 49 of file cmonitor.cpp.

{
    if (riid == __uuidof(IUnknown) || riid == __uuidof(IBackgroundCopyCallback))
    {
        *ppvObj = this;
    }
    else
    {
        *ppvObj = NULL;
        return E_NOINTERFACE;
    }

    AddRef();
    return NOERROR;
}

ULONG CMonitor::Release ( void )

Definition at line 85 of file cmonitor.cpp.

{
    ULONG ulCount = InterlockedDecrement(&m_lRefCount);

    if (ulCount == 0)
    {
        if (g_hSafeToExitEvent != INVALID_HANDLE_VALUE)
        {
            SetEvent(g_hSafeToExitEvent);
        }
    }

    return ulCount;
}

Member Data Documentation

LONG CMonitor::m_lRefCount [private]

Definition at line 24 of file cmonitor.h.

The documentation for this class was generated from the following files:
  • Web/bits/Upload/cmonitor.h
  • Web/bits/Upload/cmonitor.cpp
Generated on Wed Nov 13 2024 16:56:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMonitorServer Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CMonitorServer Class Reference

#include "MonitorServer.h"

List of all members.

Public Member Functions

CMonitorServer ()
HRESULT STDMETHODCALLTYPE | GetData (LONG __RPC_FAR *pData)
HRESULT STDMETHODCALLTYPE | GetPingResponder (IPingResponder __RPC_FAR *__RPC_FAR *ppPing)

Detailed Description

Definition at line 41 of file MonitorServer.h.

Constructor & Destructor Documentation

CMonitorServer::CMonitorServer ( ) [inline]

Definition at line 47 of file MonitorServer.h.

{ srand( (unsigned)time(NULL) );}

Member Function Documentation

HRESULT STDMETHODCALLTYPE CMonitorServer::GetData ( LONG __RPC_FAR * pData )
HRESULT STDMETHODCALLTYPE CMonitorServer::GetPingResponder ( IPingResponder __RPC_FAR *__RPC_FAR * ppPing )
The documentation for this class was generated from the following file:
  • Com/Fundamentals/DCom/TimeOuts/Server/MonitorServer.h
Generated on Wed Nov 13 2024 16:56:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMoveDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions

CMoveDlg Class Reference

#include "adscontainer.h"

List of all members.

Public Types

enum | { IDD = IDD_MOVE }

Public Member Functions

CMoveDlg (CWnd *pParent=NULL)
CString GetObjectPath ()

Public Attributes

CString m_sADsPath

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
afx_msg void | OnChangeADspath ()
virtual void | OnOK ()

Detailed Description

Definition at line 99 of file adscontainer.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 108 of file adscontainer.h.

{ IDD = IDD_MOVE };

Constructor & Destructor Documentation

CMoveDlg::CMoveDlg ( CWnd * pParent = NULL )

Definition at line 497 of file adscontainer.cpp.

  : CDialog(CMoveDlg::IDD, pParent)
{
  //{{AFX_DATA_INIT(CMoveDlg)
  m_sADsPath = _T("");
  //}}AFX_DATA_INIT
}

Member Function Documentation

void CMoveDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 506 of file adscontainer.cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CMoveDlg)
  DDX_Text(pDX, IDC_ADSPATH, m_sADsPath);
  //}}AFX_DATA_MAP
}

CString CMoveDlg::GetObjectPath ( ) [inline]

Definition at line 104 of file adscontainer.h.

{ return m_sADsPath; }

void CMoveDlg::OnChangeADspath ( ) [protected]

Definition at line 531 of file adscontainer.cpp.

{
  BOOL bEnabled;
  bEnabled = GetDlgItem(IDC_ADSPATH)->GetWindowTextLength() > 0 ? TRUE : FALSE;

  GetDlgItem(IDOK)->EnableWindow( bEnabled );

}

void CMoveDlg::OnOK ( ) [protected, virtual]

Definition at line 524 of file adscontainer.cpp.

{
  UpdateData(TRUE); //Retrieve
  CDialog::OnOK();
}

Member Data Documentation

CString CMoveDlg::m_sADsPath

Definition at line 109 of file adscontainer.h.

The documentation for this class was generated from the following files:
  • NetDS/ADSI/samples/General/ADQI/adscontainer.h
  • NetDS/ADSI/samples/General/ADQI/adscontainer.cpp
Generated on Wed Nov 13 2024 16:56:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMoveMoney Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CMoveMoney Class Reference

#include "mvmoney.h"

List of all members.

Public Member Functions

CMoveMoney ()
CMoveMoney ()
CMoveMoney ()
HRESULT | FinalConstruct ()
STDMETHOD() | InterfaceSupportsErrorInfo (REFIID riid)
STDMETHOD() | InterfaceSupportsErrorInfo (REFIID riid)
STDMETHOD() | InterfaceSupportsErrorInfo (REFIID riid)
STDMETHOD() | Perform (IN long lPrimeAccount, IN long lSecondAccount, IN long lAmount, IN long lTranType, OUT BSTR *pbstrResult)
STDMETHOD() | Perform (IN long lPrimeAccount, IN long lSecondAccount, IN long lAmount, IN long lTranType, OUT BSTR *pbstrResult)
STDMETHOD() | Perform (long lngAcnt1, long lngAcnt2, long lngAmount, long lngType, BSTR *pVal)
STDMETHODIMP | SetAccountClsctx (long clsctx)
STDMETHODIMP | UseComPlus ()

Private Attributes

BOOL m_bUseComPlus
DWORD m_clsctxAccount

Detailed Description

Definition at line 29 of file mvmoney.h.

Constructor & Destructor Documentation

CMoveMoney::CMoveMoney ( ) [inline]

Definition at line 43 of file mvmoney.h.

  {
    m_clsctxAccount = CLSCTX_ALL;
    m_bUseComPlus = FALSE;

  }

CMoveMoney::CMoveMoney ( ) [inline]

Definition at line 34 of file moveMoney.h.

{}

CMoveMoney::CMoveMoney ( ) [inline]

Definition at line 17 of file MoveMoney.h.

  {
  }

Member Function Documentation

HRESULT CMoveMoney::FinalConstruct ( ) [inline]

Definition at line 58 of file mvmoney.h.

{
  return S_OK;
}

STDMETHODIMP CMoveMoney::InterfaceSupportsErrorInfo ( REFIID riid )

Definition at line 38 of file mvmoney.Cpp.

{
  static const IID* arr[] =
  {
    &IID_IMoveMoney,
  };

  for (int i=0;i<sizeof(arr)/sizeof(arr[0]);i++)
  {
    // refer to guiddef.h
    if (::InlineIsEqualGUID(*arr[i],riid))
      return S_OK;
  }
  return S_FALSE;
}

STDMETHOD() CMoveMoney::InterfaceSupportsErrorInfo ( REFIID riid )
STDMETHOD() CMoveMoney::InterfaceSupportsErrorInfo ( REFIID riid )
STDMETHODIMP CMoveMoney::Perform | ( | IN long | lPrimeAccount,
 |  | IN long | lSecondAccount,
 |  | IN long | lAmount,
 |  | IN long | lTranType,
 |  | OUT BSTR * | pbstrResult
 | ) |  |

Definition at line 70 of file mvmoney.Cpp.

                                                            {

  if (!pbstrResult)
    return E_POINTER;

  HRESULT hr = S_OK;
  IObjectContext* pObjectContext = NULL;

  *pbstrResult = NULL;
  hr = CoGetObjectContext(IID_IObjectContext, (void**)&pObjectContext);
  if (!pObjectContext)
  {
    AtlReportError( CLSID_CMoveMoney, L"No Object Context", IID_IAccount, hr);
    return hr;
  }

/*---------------------------------------------------------------------------------------------
*
* This check in the original MoveMoney is kind of silly -- we merely delegate to the Accont
* object, which is going to make exactly the same check...
*
*
* hr = CheckAmount(pObjectContext, lAmount, pbstrResult);
* if (FAILED(hr))
* {
*   pObjectContext -> SetAbort();
*   SafeRelease(pObjectContext);
*   AtlReportError( CLSID_CMoveMoney, *pbstrResult, IID_IAccount, hr);
*   if (pbstrResult)
*     SysFreeString(*pbstrResult);
*   return hr;
* }
*-----------------------------------------------------------------------------------------*/

  IAccount* pObjAccount = NULL;

  IGetReceipt* pObjGetReceipt = NULL;

  if (m_bUseComPlus)
  {

    hr = CoCreateInstance(CLSID_CAccount, NULL, m_clsctxAccount, IID_IAccount, (void**)&pObjAccount);
  }
  else
  {
    // Create the account object using our context
    hr =  CoCreateInstance(CLSID_CAccount, NULL, CLSCTX_ALL, IID_IAccount, (void**)&pObjAccount);
  }

  if (FAILED(hr))
  {

    pObjectContext -> SetAbort();
    SafeRelease(pObjectContext);
    AtlReportError(CLSID_CMoveMoney, L"Unable to create account instance", IID_IAccount, hr);
    return hr;
  }

  // Call the post function based on the transaction type
  switch ( lTranType )
  {
    case (1): // debit
      hr =  pObjAccount->Post (lPrimeAccount, 0 - lAmount, pbstrResult) ;
      break;
    case (2): // credit
      hr = pObjAccount->Post (lPrimeAccount, lAmount, pbstrResult);
      break;
    case (3): // transfer
    {

      BSTR s1 = 0;
      BSTR s2 = 0;
      WCHAR szBuf [512];
      ZeroMemory(szBuf, 512 * sizeof(WCHAR));

      // Do the credit
      hr = pObjAccount->Post (lSecondAccount, lAmount, &s1);
      if (SUCCEEDED(hr))
      {
        // Then do the debit
        hr = pObjAccount->Post (lPrimeAccount, 0 - lAmount, &s2);
        if (SUCCEEDED(hr))
        {
          wsprintf(szBuf, L"%s;%s", s1, s2);
        }
        else
        {
          wsprintf(szBuf, L"Post to account %ld failed.  Error: %s", lPrimeAccount, s2);
        }
      }
      else
      {
        wsprintf(szBuf, L"Post to account %ld failed.  Error: %s", lSecondAccount, s1);

      }
      ::SysFreeString(s1);
      ::SysFreeString(s2);

      _ASSERTE(*szBuf);
      *pbstrResult = SysAllocString(szBuf);
      break;
    }
    default:
      *pbstrResult = SysAllocString(L"Invalid Transaction Type");
      hr = E_FAIL;
  }

  if (hr == S_OK) // all go up to here -- get a receipt
  {

    WCHAR szBuffer [512];
    // Get Receipt Number for the transaction
    hr = CoCreateInstance (CLSID_CGetReceipt, NULL, CLSCTX_ALL, IID_IGetReceipt, (void**)&pObjGetReceipt);
    if (pObjGetReceipt)
    {
      long lngReceiptNo;
      hr = pObjGetReceipt->GetNextReceipt(&lngReceiptNo);
      if (hr == S_OK)
      {

        // Tag receipt information onto return string
        wsprintf (szBuffer, _T("; Receipt No:  %li"), lngReceiptNo);
        BSTR bstrTemp = SysAllocString(szBuffer);
        TCHAR szBuffer2 [512];
        lstrcpyn(szBuffer2, *pbstrResult, lstrlen(*pbstrResult) );
        wcsncat(szBuffer2, bstrTemp, lstrlen(bstrTemp));
        ::SysFreeString (bstrTemp);
        ::SysFreeString (*pbstrResult);
        *pbstrResult = SysAllocString(szBuffer2);
      }

      pObjGetReceipt -> Release();
      pObjGetReceipt = NULL;
    }
    else
    {
      wsprintf(szBuffer, L"Failed to create the receipt object.  hr = %hX", hr);
      ::SysFreeString (*pbstrResult);
      *pbstrResult = SysAllocString(L"Invalid Transaction Type");
    }
  }

  if (FAILED(hr))
  {
    pObjectContext -> SetAbort();
    AtlReportError(CLSID_CMoveMoney, *pbstrResult, IID_IAccount, hr);
    ::SysFreeString(*pbstrResult);
    *pbstrResult = NULL;
  }
  else
  {
    // We are finished and happy
    pObjectContext->SetComplete();
  }

  // Release resources
  if (pObjAccount)
    pObjAccount->Release();

  if (pObjectContext)
    pObjectContext->Release();

  return hr;
}

STDMETHODIMP CMoveMoney::Perform | ( | long | lngAcnt1,
 |  | long | lngAcnt2,
 |  | long | lngAmount,
 |  | long | lngType,
 |  | BSTR * | pVal
 | ) |  |

Definition at line 18 of file MoveMoney.cpp.

{
  // Get the ObjectContext object

  TCHAR strErr[256];
  CComPtr<IObjectContext> pObjectContext = NULL;
  CComPtr<IAccount> pAccount;
  CComBSTR bstrResult, bstrRes1;

  HRESULT hr = GetObjectContext(&pObjectContext);

  if (FAILED(hr))
  {
    wsprintf(strErr, "GetObjectContext() failed!");

    goto ErrorHandler;
  }

  hr = pObjectContext->CreateInstance(CLSID_Account, IID_IAccount, (LPVOID*) &pAccount);

  if (FAILED(hr))
  {
    wsprintf(strErr, "Create Account Object failed!");

    goto ErrorHandler;
  }

  strErr[0]='\0';

  switch(lngType){

    case 1 :

      hr = pAccount->Post(lngAcnt1, 0-lngAmount, &bstrResult);

      if (FAILED(hr))
        goto ErrorHandler;

      *pVal = bstrResult.Copy();

      break;

    case 2 :

      hr = pAccount->Post(lngAcnt1, lngAmount, &bstrResult);

      if (FAILED(hr))
        goto ErrorHandler;

      *pVal = bstrResult.Copy();

      break;

    case 3 :

      hr = pAccount->Post(lngAcnt2, lngAmount, &bstrResult);

      if (FAILED(hr))
        goto ErrorHandler;

      hr = pAccount->Post(lngAcnt1, 0 - lngAmount, &bstrRes1);

      if (FAILED(hr))
        goto ErrorHandler;

      bstrResult.Append(bstrRes1);

      *pVal = bstrResult.Copy();

      break;

    default :

      wsprintf(strErr, "Invalid transaction type!");

      goto ErrorHandler;
  }

  pObjectContext->SetComplete();

  return S_OK;

ErrorHandler:

  Error(strErr, IID_IMoveMoney);

  if (pObjectContext)
    pObjectContext->SetAbort();

  return hr;
}

STDMETHOD() CMoveMoney::Perform | ( | IN long | lPrimeAccount,
 |  | IN long | lSecondAccount,
 |  | IN long | lAmount,
 |  | IN long | lTranType,
 |  | OUT BSTR * | pbstrResult
 | ) |  |
STDMETHODIMP CMoveMoney::SetAccountClsctx ( long clsctx ) [inline]

Definition at line 77 of file mvmoney.h.

  {
    m_clsctxAccount = clsctx;
    return S_OK;
  }

STDMETHODIMP CMoveMoney::UseComPlus ( ) [inline]

Definition at line 83 of file mvmoney.h.

  {
    m_bUseComPlus = TRUE;
    return S_OK;
  }

Member Data Documentation

BOOL CMoveMoney::m_bUseComPlus [private]

Definition at line 40 of file mvmoney.h.

DWORD CMoveMoney::m_clsctxAccount [private]

Definition at line 39 of file mvmoney.h.

The documentation for this class was generated from the following files:
  • Com/Services/Object_Pooling/OPBankSample/Account.VC/mvmoney.h
  • Com/Services/Transaction/SampleBank/VCAcct/moveMoney.h
  • Web/iis/Components/Cpp/MTXSample/MoveMoney.h
  • Com/Services/Object_Pooling/OPBankSample/Account.VC/mvmoney.Cpp
  • Com/Services/Transaction/SampleBank/VCAcct/moveMoney.Cpp
  • Web/iis/Components/Cpp/MTXSample/MoveMoney.cpp
Generated on Wed Nov 13 2024 16:56:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMSMQEventHandler Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CMSMQEventHandler Class Reference

#include "EvHandle.h"

List of all members.

Public Member Functions

CMSMQEventHandler ()
~CMSMQEventHandler ()
HRESULT | AdviseSource (IDispatch *pDispatch)
virtual void | Arrived (IDispatch *pdispQueue, long lCursor)
virtual void | ArrivedError (IDispatch *pdispQueue, long lErrorCode, long lCursor)
LPUNKNOWN | GetInterfaceHook (const void *piid)

Private Attributes

DWORD m_dwMyCookie
LPCONNECTIONPOINT | m_pMyCP

Detailed Description

Definition at line 16 of file EvHandle.h.

Constructor & Destructor Documentation

CMSMQEventHandler::CMSMQEventHandler ( )

Definition at line 35 of file EvHandle.Cpp.

{
  EnableAutomation();
  m_dwMyCookie = 0;
  m_pMyCP = NULL;
}

CMSMQEventHandler::~CMSMQEventHandler ( )

Definition at line 42 of file EvHandle.Cpp.

{
  if (m_pMyCP)  // If I'm currently connected to a connection point
  {
    m_pMyCP->Unadvise(m_dwMyCookie);  // Disconnect, giving it the identifier it gave me earlier,
    m_pMyCP->Release();         // and release it.
  };

}

Member Function Documentation

HRESULT CMSMQEventHandler::AdviseSource ( IDispatch * pDispatch )

Definition at line 109 of file EvHandle.Cpp.

{
  LPCONNECTIONPOINTCONTAINER  pCPCont = NULL;
  HRESULT           hr;

  hr = pDispatch->QueryInterface(IID_IConnectionPointContainer, (void**) &pCPCont);
  if (FAILED(hr))
    return hr;

  hr = pCPCont->FindConnectionPoint(__uuidof(_DMSMQEventEvents), &m_pMyCP);
  pCPCont->Release();
  if (FAILED(hr))
    return hr;

  return m_pMyCP->Advise(GetIDispatch(TRUE), &m_dwMyCookie);
};

void CMSMQEventHandler::Arrived | ( | IDispatch * | pdispQueue,
 |  | long | lCursor |
 | ) |  |  | [virtual]

Definition at line 74 of file EvHandle.Cpp.

{
  CImp_DrawDlg* pDlg = (CImp_DrawDlg*) AfxGetApp()->m_pMainWnd;
  pDlg->Arrived(pdispQueue, S_OK, lCursor);
}

void CMSMQEventHandler::ArrivedError | ( | IDispatch * | pdispQueue,
 |  | long | lErrorCode,
 |  | long | lCursor |
 | ) |  |  | [virtual]

Definition at line 80 of file EvHandle.Cpp.

{
  CImp_DrawDlg* pDlg = (CImp_DrawDlg*) AfxGetApp()->m_pMainWnd;
  pDlg->Arrived(pdispQueue, lErrorCode, lCursor);
}

LPUNKNOWN CMSMQEventHandler::GetInterfaceHook ( const void * piid )

Definition at line 152 of file EvHandle.Cpp.

{
  if (IsEqualIID(__uuidof(_DMSMQEventEvents), *(IID*)piid))
  {
    return GetIDispatch(FALSE);
  }
  else
  {
    return NULL;
  }
}

Member Data Documentation

DWORD CMSMQEventHandler::m_dwMyCookie [private]

Definition at line 37 of file EvHandle.h.

LPCONNECTIONPOINT CMSMQEventHandler::m_pMyCP [private]

Definition at line 38 of file EvHandle.h.

The documentation for this class was generated from the following files:
  • NetDS/MessageQueuing/Imp_Draw/EvHandle.h
  • NetDS/MessageQueuing/Imp_Draw/EvHandle.Cpp
Generated on Wed Nov 13 2024 16:56:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMSOmniProvCommand Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions

CMSOmniProvCommand Class Reference

#include "msomniprovrs.h"

List of all members.

Public Member Functions

HRESULT WINAPI | Execute (IUnknown *pUnkOuter, REFIID riid, DBPARAMS *pParams, LONG *pcRowsAffected, IUnknown **ppRowset)
HRESULT | FinalConstruct ()
void | FinalRelease ()

Static Public Member Functions

static ATLCOLUMNINFO * | GetColumnInfo (CMSOmniProvCommand *pv, ULONG *pcInfo)

Detailed Description

Definition at line 28 of file msomniprovrs.h.

Member Function Documentation

HRESULT CMSOmniProvCommand::Execute | ( | IUnknown * | pUnkOuter,
 |  | REFIID | riid,
 |  | DBPARAMS * | pParams,
 |  | LONG * | pcRowsAffected,
 |  | IUnknown ** | ppRowset
 | ) |  |

Definition at line 28 of file msomniprovrs.cpp.

{
  CMSOmniProvRowset* pRowset;
  return CreateRowset(pUnkOuter, riid, pParams, pcRowsAffected, ppRowset, pRowset);
}

HRESULT CMSOmniProvCommand::FinalConstruct ( ) [inline]

Definition at line 51 of file msomniprovrs.h.

  {
    HRESULT hr = CConvertHelper::FinalConstruct();
    if (FAILED (hr))
      return hr;
    hr = IAccessorImpl<CMSOmniProvCommand>::FinalConstruct();
    if (FAILED(hr))
      return hr;
    return CUtlProps<CMSOmniProvCommand>::FInit();
  }

void CMSOmniProvCommand::FinalRelease ( ) [inline]

Definition at line 61 of file msomniprovrs.h.

  {
    IAccessorImpl<CMSOmniProvCommand>::FinalRelease();
  }

ATLCOLUMNINFO * CMSOmniProvCommand::GetColumnInfo | ( | CMSOmniProvCommand * | pv,
 |  | ULONG * | pcInfo |
 | ) |  |  | [static]

Definition at line 37 of file msomniprovrs.cpp.

{
  return NULL;
}

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/omniprov/source/msomniprovrs.h
  • Dataaccess/oledb/omniprov/source/msomniprovrs.cpp
Generated on Wed Nov 13 2024 16:56:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMSOmniProvRowset Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes

CMSOmniProvRowset Class Reference

#include "msomniprovrs.h"

Inherits IRowsetChangeImpl< CMSOmniProvRowset, dummyStore >, and CProxyIRowsetNotify< CMSOmniProvRowset >.

List of all members.

Public Types

typedef CRowsetImpl
< CMSOmniProvRowset,
dummyStore, CMSOmniProvCommand,
CSimpleArray< dummyStore >
, CSimpleRow,
IRowsetScrollImpl
< CMSOmniProvRowset > > 		_OmniProvBaseClass

Public Member Functions

CMSOmniProvRowset ()
~CMSOmniProvRowset ()
void | AllocateProxyBuffers ()
BOOL | CheckTable (TCHAR *szTblName)
void | CreateColInfo ()
HRESULT | Execute (DBPARAMS *pParams, LONG *pcRowsAffected)
STDMETHOD() | GetData (HROW hRow, HACCESSOR hAccessor, void *pDstData)
HRESULT | GetDataSource (_bstr_t &m_bstrLoc)
STDMETHOD() | GetNextRows (HCHAPTER, LONG lRowsOffset, LONG cRows, ULONG *pcRowsObtained, HROW **prghRows)
ATLCOLUMNINFO * | GetSchemaInfo (ULONG *pNumCols)
STDMETHOD() | ReleaseRows (ULONG cRows, const HROW rghRows[], DBROWOPTIONS rgRowOptions[], ULONG rgRefCounts[], DBROWSTATUS rgRowStatus[])
void | SetSchemaInfo (ATLCOLUMNINFO *prgColInfo, int cCols)

Static Public Member Functions

static ATLCOLUMNINFO * | GetColumnInfo (CMSOmniProvRowset *pv, ULONG *pNumCols)

Public Attributes

int | m_cCols
CDBFile m_DBFile
ATLCOLUMNINFO * | m_prgColInfo

Detailed Description

Definition at line 105 of file msomniprovrs.h.

Member Typedef Documentation

typedef CRowsetImpl<CMSOmniProvRowset, dummyStore, CMSOmniProvCommand, CSimpleArray<dummyStore>, CSimpleRow, IRowsetScrollImpl<CMSOmniProvRowset> > CMSOmniProvRowset::_OmniProvBaseClass

Definition at line 112 of file msomniprovrs.h.

Constructor & Destructor Documentation

CMSOmniProvRowset::CMSOmniProvRowset ( ) [inline]

Definition at line 142 of file msomniprovrs.h.

  {
    m_prgColInfo = NULL;
  }

CMSOmniProvRowset::~CMSOmniProvRowset ( ) [inline]

Definition at line 148 of file msomniprovrs.h.

  {
    if(m_prgColInfo)
      delete m_prgColInfo;
  }

Member Function Documentation

void CMSOmniProvRowset::AllocateProxyBuffers ( )

Definition at line 190 of file msomniprovrs.cpp.

{
  CSimpleArray<CRow *> * pRows = &m_DBFile.m_Rows;
  int nSize = pRows->GetSize();
  for (int i = 0; i < nSize; i++)
  {
    (*pRows)[i]->AllocProxyBuffer(m_prgColInfo, m_cCols);
  }
}

BOOL CMSOmniProvRowset::CheckTable ( TCHAR * szTblName )

Definition at line 216 of file msomniprovrs.cpp.

{
  CMSOmniProvRowset* pT = (CMSOmniProvRowset*) this;
  if(szTblNm[0] == '[')
  {
    int iLenBuff = 0;
    iLenBuff = _tcslen(szTblNm);
    TCHAR *szTmpBuff= (TCHAR *) malloc(sizeof(TCHAR) *iLenBuff );
     _tcsncpy(szTmpBuff, szTblNm + 1,iLenBuff -2);
    szTmpBuff[sizeof(TCHAR) *(iLenBuff - 2)] = '\0';
    if (!_tcscmp(pT->m_DBFile.m_szTblNm, szTmpBuff))
    {
        free(szTmpBuff);
      return true;
    }
    else
        free(szTmpBuff);
  }
  if (!_tcscmp(pT->m_DBFile.m_szTblNm, szTblNm))
    return true;
  else
    return false;
}

void CMSOmniProvRowset::CreateColInfo ( )

Definition at line 138 of file msomniprovrs.cpp.

{
  // check if bookmarks are set
  bool bUseBookmarks = false;
  CComVariant varBookmarks;
  HRESULT hrLocal = GetPropValue(&DBPROPSET_ROWSET, DBPROP_BOOKMARKS, &varBookmarks);
  bUseBookmarks = (hrLocal == S_OK &&  varBookmarks.boolVal == VARIANT_TRUE);

  // get column info from the .INI file
  ULONG ulNumCols;
  ATLCOLUMNINFO * prgColInfo = m_DBFile.GetSchemaInfo(&ulNumCols);

  // Need to add bookmark column info?
  if (bUseBookmarks)
  {
    // create new set of column information which includes bookmarks
    ATLCOLUMNINFO * prgColInfoNew;
    prgColInfoNew = new ATLCOLUMNINFO[ulNumCols+1];

    // set bindings for the bookmark
    memset(&prgColInfoNew[0], 0, sizeof(ATLCOLUMNINFO));
    prgColInfoNew[0].cbOffset = 0;
    prgColInfoNew[0].iOrdinal = 0;
    prgColInfoNew[0].columnid.eKind = DBKIND_NAME;
    prgColInfoNew[0].columnid.uGuid.guid = GUID_NULL;
    prgColInfoNew[0].columnid.uName.pwszName = OLESTR("Bookmark");
    prgColInfoNew[0].pwszName = OLESTR("Bookmark");
    prgColInfoNew[0].wType = DBTYPE_I4;
    prgColInfoNew[0].ulColumnSize = 4;
    prgColInfoNew[0].dwFlags = DBCOLUMNFLAGS_ISBOOKMARK;

    // copy the old information into the new
    for (unsigned int i = 1; i <= ulNumCols; i++)
    {
      prgColInfoNew[i] = prgColInfo[i-1];
      prgColInfoNew[i].cbOffset +=4;  //adjust space for bookmark
    }

    ulNumCols++;
    prgColInfo = prgColInfoNew;
  }

  // store column info in the rowset object
  SetSchemaInfo(prgColInfo, ulNumCols);
  // 2.0
  // Release the temporary prgColInfo
  delete prgColInfo;
}

HRESULT CMSOmniProvRowset::Execute | ( | DBPARAMS * | pParams,
 |  | LONG * | pcRowsAffected
 | ) |  |

Definition at line 49 of file msomniprovrs.cpp.

{
  USES_CONVERSION;
  CMSOmniProvRowset* pT = (CMSOmniProvRowset*) this;
  CMSOmniProvRowset::ObjectLock cab((CMSOmniProvRowset*) this);
  HRESULT hr;

  _bstr_t m_bstrFileName;
  if ( FAILED(hr=pT->GetDataSource(m_bstrFileName)) )
    return hr;

  // Check the property value whether read/ updatabiliy property is set or not...
  _variant_t varUpd;
  GetPropValue(&DBPROPSET_ROWSET,DBPROP_UPDATABILITY, &varUpd);
  if ( 0 != varUpd.iVal )
  {
    // 1. a) Build the file's Schema m_prgColInfo from the '.sxt' file,
    //     b) Open the file '.txt', and
    //     c) Fill the m_DBFile.m_Rows structure
    // Open in exclusive mode
    if (!m_DBFile.Open((LPCTSTR) m_bstrFileName,true))
      return DB_E_NOTABLE;
    if (!m_DBFile.FillRowArray())
        return E_FAIL;
  }
  else // Open in non-exclusive mode
  {
    if (!m_DBFile.Open((LPCTSTR) m_bstrFileName,false))
      return DB_E_NOTABLE;
    if (!m_DBFile.FillRowArray())
        return E_FAIL;
  }

  // Validate Command
    // 2. PARSE the SQL Query here  (Only SELECT * FROM <Table_Name> is supported)
  TCHAR sep[] = " ";
  _bstr_t bstrSQL(pT->m_strCommandText);
  TCHAR * token = _tcstok((TCHAR*) bstrSQL, (TCHAR*) sep);

  if (!CheckTable((TCHAR*) token))
  {
    // The Rowset was created using the ICommand::Execute( )...
    // Only "SELECT * FROM Table_Name"  Queries are supported
    if(_tcscmp(_tcsupr(token),"SELECT") != 0)
    {
      ATLTRACE2(atlTraceDBProvider,0,(const TCHAR*) (_bstr_t("Query: '")+ bstrSQL + _bstr_t("' is not a valid Query\n")));
      return DB_E_ERRORSINCOMMAND;
    }
    ATLTRACE2(atlTraceDBProvider,0,(const TCHAR*) (_bstr_t("\tIt is a valid '")+_bstr_t(token) + _bstr_t("' Query\n")));

    TCHAR szTblNm[MAX_TABLE_NAME_SIZE];
    while (token != NULL)
    {
      _tcscpy(szTblNm,token);
      token= _tcstok(NULL,(TCHAR*) sep);
    }
    if (!CheckTable((TCHAR*) szTblNm))
      return DB_E_NOTABLE;
  }

  // Allocate proxy buffers based on the schema information
  // Each CRow contains proxy buffer that the data is trasnferred to in the native
  // format.  This information then needs to be copied out to the file in character format
  // on SetData() calls.

  CreateColInfo();

  AllocateProxyBuffers();

  if (pcRowsAffected != NULL)
    *pcRowsAffected = m_DBFile.m_Rows.GetSize();

  return S_OK;
}

ATLCOLUMNINFO * CMSOmniProvRowset::GetColumnInfo | ( | CMSOmniProvRowset * | pv,
 |  | ULONG * | pNumCols |
 | ) |  |  | [static]

Definition at line 127 of file msomniprovrs.cpp.

{
  ATLASSERT(pv!=NULL);
  ATLASSERT(pNumCols!=NULL);

  return pv->GetSchemaInfo(pNumCols);
}

STDMETHOD() CMSOmniProvRowset::GetData | ( | HROW | hRow,
 |  | HACCESSOR | hAccessor,
 |  | void * | pDstData |
 | ) |  |  | [inline]

Definition at line 170 of file msomniprovrs.h.

  {
    ATLTRACE2(atlTraceDBProvider, 0, "IRowsetImpl::GetData\n");
    if (pDstData == NULL)
      return E_INVALIDARG;
    HRESULT hr = S_OK;
    //CSimpleRow* pHRow = (CSimpleRow*)hRow;
    // 2.0
    CSimpleRow* pHRow = NULL;
    if (hRow == NULL || (pHRow = (m_rgRowHandles.Lookup(hRow)) ) == NULL)
      return DB_E_BADROWHANDLE;
    _BindType* pBinding;
    void* pSrcData;
    ULONG cCols;
    ATLCOLUMNINFO* pColInfo;
    ATLASSERT(pBinding != NULL);
    pBinding = m_rgBindings.Lookup((int)hAccessor);
    if (pBinding == NULL)
      return DB_E_BADACCESSORHANDLE;
    pColInfo = GetColumnInfo(this, &cCols);
    CRow *pDataRow = NULL;
    // When Client perform a GetData without performing a GetNextRows( )
    if(pHRow->m_iRowset >= m_DBFile.m_Rows.m_nSize)
      return DB_E_DELETEDROW;
    pDataRow = m_DBFile.m_Rows[pHRow->m_iRowset];
    // Fetch data in the proxy buffer if it hasn't already been fetched
    pDataRow->GetProxyData(pColInfo, cCols);
    // assign source buffer to the proxy buffer
    pSrcData = pDataRow->m_pbProxyData;
    for (ULONG iBind =0; iBind < pBinding->cBindings; iBind++)
    {
      DBBINDING* pBindCur = &(pBinding->pBindings[iBind]);
      for (ULONG iColInfo = 0;
         iColInfo < cCols && pBindCur->iOrdinal != pColInfo[iColInfo].iOrdinal;
         iColInfo++);
      if (iColInfo == cCols)
        return DB_E_BADORDINAL;
      ATLCOLUMNINFO* pColCur = &(pColInfo[iColInfo]);
      // Ordinal found at iColInfo
      BOOL bProvOwn = pBindCur->dwMemOwner == DBMEMOWNER_PROVIDEROWNED;
      bProvOwn;

      DBSTATUS dbStat = DBSTATUS_S_OK;
      // If the provider's field is NULL, we can optimize this situation,
      // set the fields to 0 and continue.
      if (dbStat == DBSTATUS_S_ISNULL)
      {
        if (pBindCur->dwPart & DBPART_STATUS)
          *((DBSTATUS*)((BYTE*)(pDstData) + pBindCur->obStatus)) = dbStat;

        if (pBindCur->dwPart & DBPART_LENGTH)
          *((ULONG*)((BYTE*)(pDstData) + pBindCur->obLength)) = 0;

        if (pBindCur->dwPart & DBPART_VALUE)
          *((BYTE*)(pDstData) + pBindCur->obValue) = NULL;
        continue;
      }
      ULONG cbDst = pBindCur->cbMaxLen;
      ULONG cbCol;
      BYTE* pSrcTemp;
      void *pvData = NULL;
      void * pvTmpData = NULL;

      if (bProvOwn && pColCur->wType == pBindCur->wType)
      {
        pSrcTemp = ((BYTE*)(pSrcData) + pColCur->cbOffset);
      }
      else
      {
        BYTE* pDstTemp = (BYTE*)pDstData + pBindCur->obValue;
        switch (pColCur->wType)
        {
        case DBTYPE_STR:
          cbCol = lstrlenA((LPSTR)(((BYTE*)pSrcData) + pColCur->cbOffset));
          break;
        case DBTYPE_WSTR:
        case DBTYPE_BSTR:
          cbCol = lstrlenW((LPWSTR)(((BYTE*)pSrcData) + pColCur->cbOffset)) * sizeof(WCHAR);
          break;
        // The char ptr case
        case DBTYPE_STR | DBTYPE_BYREF:
          pvData = (((BYTE*)pSrcData) + pColCur->cbOffset);
          cbCol =lstrlenA(*(char**)pvData);
          break;
        default:
          cbCol = pColCur->ulColumnSize;
          break;
        }
        if (pBindCur->dwPart & DBPART_VALUE)
        {
          hr = m_spConvert->DataConvert(pColCur->wType, pBindCur->wType,
                      cbCol, &cbDst, (BYTE*)(pSrcData) + pColCur->cbOffset,
                      pDstTemp, pBindCur->cbMaxLen, dbStat, &dbStat,
                      pBindCur->bPrecision, pBindCur->bScale,0);
        }
      }
      if (pBindCur->dwPart & DBPART_LENGTH)
        *((ULONG*)((BYTE*)(pDstData) + pBindCur->obLength)) = cbDst;
      if (pBindCur->dwPart & DBPART_STATUS)
        *((DBSTATUS*)((BYTE*)(pDstData) + pBindCur->obStatus)) = dbStat;
      if (FAILED(hr))
        return hr;
    }
    return hr;
  }

HRESULT CMSOmniProvRowset::GetDataSource ( _bstr_t & m_bstrLoc )

Definition at line 242 of file msomniprovrs.cpp.

{
  CMSOmniProvRowset* pT = (CMSOmniProvRowset*) this;
  CMSOmniProvRowset::ObjectLock cab((CMSOmniProvRowset*) this);
  CComPtr<IDBCreateCommand> spSession = NULL;
  CComPtr<IRowset> spRowset = NULL;

  HRESULT hr = pT->GetSite(IID_IDBCreateCommand, (void**) &spSession);
  if (SUCCEEDED(hr))  // The Rowset was created from an IOpenRowset::OpenRowset( )...
  {
      // Get to DBPROP_INIT_DATASOURCE property
      CComPtr<IDBCreateSession> spInit;
      CComPtr<IObjectWithSite> spCreator2 = NULL;

      if (FAILED(hr = spSession->QueryInterface(IID_IObjectWithSite,(void**) &spCreator2)))
      {
          ATLTRACE2(atlTraceDBProvider,0,"FATAL ERROR: Cannot get to the IObjectWithSite from ICommand...\n");
          return E_FAIL;
      }

      if (FAILED(hr = spCreator2->GetSite(IID_IDBCreateSession,(void**) &spInit)))
      {
          ATLTRACE2(atlTraceDBProvider,0,"FATAL ERROR: Cannot get to the IDBCreateSession from ICommand...\n");
          return E_FAIL;
      }
      // Initialize the property variables
      ULONG               cPropertyIDSets =1;
      DBPROPIDSET   rgPropertyIDSets[1];
      ULONG              cPropertySets;
      DBPROPSET *        prgPropertySets;
      DBPROPID  rgPropId[1];

      rgPropId[0] = DBPROP_INIT_DATASOURCE;
      rgPropertyIDSets[0].rgPropertyIDs = rgPropId;
      rgPropertyIDSets[0].cPropertyIDs = 1;
      rgPropertyIDSets[0].guidPropertySet = DBPROPSET_DBINIT;
      CComPtr<IDBProperties> spProperties = NULL;

      hr = spInit->QueryInterface(IID_IDBProperties,(void**) &spProperties);
      if(FAILED(hr))
      {
        ATLTRACE2(atlTraceDBProvider,0,"FATAL ERROR: Cannot get to the IDBCreateSession'ss IDBProperties...\n");
        return hr;
      }

      spProperties->GetProperties(cPropertyIDSets, rgPropertyIDSets,&cPropertySets, &prgPropertySets) ;
      m_bstrLoc = _bstr_t(prgPropertySets->rgProperties[0].vValue);
  }
  else // The Rowset was created from ICommand::Execute( )
  {
    CComPtr<ICommand> spCommand=NULL;
    hr = pT->GetSite(IID_ICommand,(void**) &spCommand);
    if(FAILED(hr))
    {
      ATLTRACE2(atlTraceDBProvider,0,"FATAL ERROR: Cannot get to the ICommand of the Rowset...\n");
      return E_FAIL;
    }

    CComPtr<IObjectWithSite> spCreator = NULL;
    if (FAILED(hr = spCommand->QueryInterface(IID_IObjectWithSite,(void**) &spCreator)))
    {
        ATLTRACE2(atlTraceDBProvider,0,"FATAL ERROR: Cannot get to the IObjectWithSite from ICommand...\n");
        return E_FAIL;
    }

    if (FAILED(hr = spCreator->GetSite(IID_IDBCreateCommand,(void**) &spSession)))
    {
        ATLTRACE2(atlTraceDBProvider,0,"FATAL ERROR: Cannot get to the IDBCreateSession from ICommand...\n");
        return E_FAIL;
    }

    CComPtr<IDBCreateSession> spInit;
    CComPtr<IObjectWithSite> spCreator2 = NULL;
    if (FAILED(hr = spSession->QueryInterface(IID_IObjectWithSite,(void**) &spCreator2)))
    {
        ATLTRACE2(atlTraceDBProvider,0,"FATAL ERROR: Cannot get to the IObjectWithSite from ICommand...\n");
        return E_FAIL;
    }
    if (FAILED(hr = spCreator2->GetSite(IID_IDBCreateSession,(void**) &spInit)))
    {
        ATLTRACE2(atlTraceDBProvider,0,"FATAL ERROR: Cannot get to the IDBCreateSession from ICommand...\n");
        return E_FAIL;
    }

    // Get to DBPROP_INIT_DATASOURCE
    ULONG               cPropertyIDSets =1;
    DBPROPIDSET   rgPropertyIDSets[1];
    ULONG              cPropertySets;
    DBPROPSET *        prgPropertySets;
    DBPROPID  rgPropId[1];

    rgPropId[0] = DBPROP_INIT_DATASOURCE;
    rgPropertyIDSets[0].rgPropertyIDs = rgPropId;
    rgPropertyIDSets[0].cPropertyIDs = 1;
    rgPropertyIDSets[0].guidPropertySet = DBPROPSET_DBINIT;

    CComPtr<IDBProperties> spProperties = NULL;
    hr = spInit->QueryInterface(IID_IDBProperties,(void**) &spProperties);
    if(FAILED(hr))
    {
      ATLTRACE2(atlTraceDBProvider,0,"FATAL ERROR: Cannot get to the IDBCreateSession'ss IDBProperties...\n");
      return hr;
    }

    spProperties->GetProperties(cPropertyIDSets, rgPropertyIDSets,&cPropertySets, &prgPropertySets) ;
    m_bstrLoc = _bstr_t(prgPropertySets->rgProperties[0].vValue);
  }
  return hr;
}

STDMETHOD() CMSOmniProvRowset::GetNextRows | ( | HCHAPTER | ,
 |  | LONG | lRowsOffset,
 |  | LONG | cRows,
 |  | ULONG * | pcRowsObtained,
 |  | HROW ** | prghRows |
 | ) |  |  | [inline]

Definition at line 299 of file msomniprovrs.h.

  {
    LONG lTmpRows = lRowsOffset;
    ATLTRACE2(atlTraceDBProvider, 0, "IRowsetImpl::GetNextRows\n");
    HRESULT hrEvent;
    CMSOmniProvRowset* pT = (CMSOmniProvRowset*) this;
    CMSOmniProvRowset::ObjectLock cab(pT);
      if(FAILED(hrEvent = Fire_OnRowsetChange(this, DBREASON_ROWSET_FETCHPOSITIONCHANGE, DBEVENTPHASE_OKTODO, TRUE)))
    {
      ATLTRACE2(atlTraceDBProvider, 0, "Failed to Fire DBREASON_ROWSET_FETCHPOSITIONCHANGE in DBEVENTPHASE_OKTODO phase\n");
      if(hrEvent==S_FALSE)
        return DB_E_CANCELED;
    }
    if(FAILED(Fire_OnRowsetChange(this, DBREASON_ROWSET_FETCHPOSITIONCHANGE, DBEVENTPHASE_ABOUTTODO, TRUE)))
      ATLTRACE2(atlTraceDBProvider, 0, "Failed to Fire DBREASON_ROWSET_FETCHPOSITIONCHANGE in DBEVENTPHASE_ABOUTTODO phase\n");
    if (pcRowsObtained != NULL)
      *pcRowsObtained = 0;
    if (prghRows == NULL || pcRowsObtained == NULL)\
    {
      if(FAILED(Fire_OnRowsetChange(this, DBREASON_ROWSET_FETCHPOSITIONCHANGE, DBEVENTPHASE_FAILEDTODO, TRUE)))
        ATLTRACE2(atlTraceDBProvider, 0, "Failed to Fire DBREASON_ROWSET_FETCHPOSITIONCHANGE in DBEVENTPHASE_FAILEDTODO phase\n");
      return E_INVALIDARG;
    }
    if (cRows == 0)
    {
      if(FAILED(Fire_OnRowsetChange(this, DBREASON_ROWSET_FETCHPOSITIONCHANGE, DBEVENTPHASE_SYNCHAFTER, TRUE)))
        ATLTRACE2(atlTraceDBProvider, 0, "Failed to Fire DBREASON_ROWSET_FETCHPOSITIONCHANGE in DBEVENTPHASE_SYNCHAFTER phase\n");
      if(FAILED(Fire_OnRowsetChange(this, DBREASON_ROWSET_FETCHPOSITIONCHANGE, DBEVENTPHASE_DIDEVENT, TRUE)))
        ATLTRACE2(atlTraceDBProvider, 0, "Failed to Fire DBREASON_ROWSET_FETCHPOSITIONCHANGE in DBEVENTPHASE_DIDEVENT phase\n");
      return S_OK;
    }
    HRESULT hr = S_OK;
    if (lRowsOffset < 0 && !m_bCanScrollBack)
    {
      if(FAILED(Fire_OnRowsetChange(this, DBREASON_ROWSET_FETCHPOSITIONCHANGE, DBEVENTPHASE_FAILEDTODO, TRUE)))
        ATLTRACE2(atlTraceDBProvider, 0, "Failed to Fire DBREASON_ROWSET_FETCHPOSITIONCHANGE in DBEVENTPHASE_FAILEDTODO phase\n");
      return DB_E_CANTSCROLLBACKWARDS;
    }
    if (cRows < 0  && !m_bCanFetchBack)
    {
      if(FAILED(Fire_OnRowsetChange(this, DBREASON_ROWSET_FETCHPOSITIONCHANGE, DBEVENTPHASE_FAILEDTODO, TRUE)))
        ATLTRACE2(atlTraceDBProvider, 0, "Failed to Fire DBREASON_ROWSET_FETCHPOSITIONCHANGE in DBEVENTPHASE_FAILEDTODO phase\n");
      return DB_E_CANTFETCHBACKWARDS;
    }
    // Calculate # of rows in set and the base fetch position.  If the rowset
    // is at its head position, then lRowOffset < 0 means moving from the BACK
    // of the rowset and not the front.
    LONG cRowsInSet = pT->m_DBFile.m_Rows.GetSize();
    if (((lRowsOffset == LONG_MIN) && (cRowsInSet != LONG_MIN))
      || (abs(lRowsOffset)) > cRowsInSet ||
      (abs(lRowsOffset) == cRowsInSet && lRowsOffset < 0 && cRows < 0) ||
      (abs(lRowsOffset) == cRowsInSet && lRowsOffset > 0 && cRows > 0))
    {
      if(FAILED(Fire_OnRowsetChange(this, DBREASON_ROWSET_FETCHPOSITIONCHANGE, DBEVENTPHASE_FAILEDTODO, TRUE)))
        ATLTRACE2(atlTraceDBProvider, 0, "Failed to Fire DBREASON_ROWSET_FETCHPOSITIONCHANGE in DBEVENTPHASE_FAILEDTODO phase\n");
      return DB_S_ENDOFROWSET;
    }

    // In the case where the user is moving backwards after moving forwards,
    // we do not wrap around to the end of the rowset.
    if ((m_iRowset == 0 && !m_bReset && cRows < 0) ||
      (((LONG)m_iRowset + lRowsOffset) > cRowsInSet) ||
      (m_iRowset == (DWORD)cRowsInSet && lRowsOffset >= 0 && cRows > 0))
    {
      if(FAILED(Fire_OnRowsetChange(this, DBREASON_ROWSET_FETCHPOSITIONCHANGE, DBEVENTPHASE_FAILEDTODO, TRUE)))
        ATLTRACE2(atlTraceDBProvider, 0, "Failed to Fire DBREASON_ROWSET_FETCHPOSITIONCHANGE in DBEVENTPHASE_FAILEDTODO phase\n");
      return DB_S_ENDOFROWSET;
    }

    // Note, if m_bReset, m_iRowset must be 0
    if (lRowsOffset < 0 && m_bReset)
    {
      ATLASSERT(m_iRowset == 0);
      m_iRowset = cRowsInSet;
    }

    int iStepSize = cRows >= 0 ? 1 : -1;

    // If cRows == LONG_MIN, we can't use ABS on it.  Therefore, we reset it
    // to a value just greater than cRowsInSet
    if (cRows == LONG_MIN && cRowsInSet != LONG_MIN)
      cRows = cRowsInSet + 2; // set the value to something we can deal with
    else
      cRows = abs(cRows);

    if (iStepSize < 0 && m_iRowset == 0 && m_bReset && lRowsOffset <= 0)
      m_iRowset = cRowsInSet;

    lRowsOffset += m_iRowset;

    *pcRowsObtained = 0;
    CAutoMemRelease<HROW, CComFree< HROW > > amr;
    if (*prghRows == NULL)
    {
      int cHandlesToAlloc = (cRows > cRowsInSet) ? cRowsInSet : cRows;
      if (iStepSize == 1 && (cRowsInSet - lRowsOffset) < cHandlesToAlloc)
        cHandlesToAlloc = cRowsInSet - lRowsOffset;
      if (iStepSize == -1 && lRowsOffset < cHandlesToAlloc)
        cHandlesToAlloc = lRowsOffset;
      *prghRows = (HROW*)CoTaskMemAlloc((cHandlesToAlloc) * sizeof(HROW*));
      amr.Attach(*prghRows);
    }
    if (*prghRows == NULL)
    {
      if(FAILED(Fire_OnRowsetChange(this, DBREASON_ROWSET_FETCHPOSITIONCHANGE, DBEVENTPHASE_FAILEDTODO, TRUE)))
        ATLTRACE2(atlTraceDBProvider, 0, "Failed to Fire DBREASON_ROWSET_FETCHPOSITIONCHANGE in DBEVENTPHASE_FAILEDTODO phase\n");
      return E_OUTOFMEMORY;
    }
    while ((lRowsOffset >= 0 && cRows != 0) &&
      ((lRowsOffset < cRowsInSet) || (lRowsOffset <= cRowsInSet && iStepSize < 0)))
    {
      // cRows > cRowsInSet && iStepSize < 0
      if (lRowsOffset == 0 && cRows > 0 && iStepSize < 0)
        break;

      // in the case where we have iStepSize < 0, move the row back
      // further because we want the previous row
      LONG lRow = lRowsOffset;
      if ((lRowsOffset == 0) && (lTmpRows == 0) && (iStepSize < 0))
        lRow = cRowsInSet;

      if (iStepSize < 0)
        lRow += iStepSize;

      hr = pT->CreateRow(lRow, *pcRowsObtained, *prghRows);
      if (FAILED(hr))
      {
        RefRows(*pcRowsObtained, *prghRows, NULL, NULL, FALSE);
        for (ULONG iRowDel = 0; iRowDel < *pcRowsObtained; iRowDel++)
          *prghRows[iRowDel] = NULL;
        *pcRowsObtained = 0;
        if(FAILED(Fire_OnRowsetChange(this, DBREASON_ROWSET_FETCHPOSITIONCHANGE, DBEVENTPHASE_FAILEDTODO, TRUE)))
          ATLTRACE2(atlTraceDBProvider, 0, "Failed to Fire DBREASON_ROWSET_FETCHPOSITIONCHANGE in DBEVENTPHASE_FAILEDTODO phase\n");
        return hr;
      }
      cRows--;
      lRowsOffset += iStepSize;
    }

    if ((lRowsOffset >= cRowsInSet && cRows) || (lRowsOffset < 0 && cRows)  ||
      (lRowsOffset == 0 && cRows > 0 && iStepSize < 0))
      hr = DB_S_ENDOFROWSET;
    m_iRowset = lRowsOffset;
    if (SUCCEEDED(hr))
      amr.Detach();
    if(FAILED(Fire_OnRowsetChange(this, DBREASON_ROWSET_FETCHPOSITIONCHANGE, DBEVENTPHASE_SYNCHAFTER, TRUE)))
      ATLTRACE2(atlTraceDBProvider, 0, "Failed to Fire DBREASON_ROWSET_FETCHPOSITIONCHANGE in DBEVENTPHASE_SYNCHAFTER phase\n");
    if(FAILED(Fire_OnRowsetChange(this, DBREASON_ROWSET_FETCHPOSITIONCHANGE, DBEVENTPHASE_DIDEVENT, TRUE)))
      ATLTRACE2(atlTraceDBProvider, 0, "Failed to Fire DBREASON_ROWSET_FETCHPOSITIONCHANGE in DBEVENTPHASE_DIDEVENT phase\n");
    if(FAILED(Fire_OnRowChange(this, cRows, *prghRows, DBREASON_ROW_ACTIVATE, DBEVENTPHASE_DIDEVENT, TRUE)))
      ATLTRACE2(atlTraceDBProvider, 0, "Failed to Fire DBREASON_ROW_ACTIVATE in DBEVENTPHASE_DIDEVENT phase\n");
    return hr;
  }

ATLCOLUMNINFO * CMSOmniProvRowset::GetSchemaInfo ( ULONG * pNumCols )

Definition at line 202 of file msomniprovrs.cpp.

{
  // Allocate the column information only once  as the functions we are returning the
  // data from don't free.
  *pNumCols = m_cCols;

  return m_prgColInfo;
}

STDMETHOD() CMSOmniProvRowset::ReleaseRows | ( | ULONG | cRows,
 |  | const HROW | rghRows[],
 |  | DBROWOPTIONS | rgRowOptions[],
 |  | ULONG | rgRefCounts[],
 |  | DBROWSTATUS | rgRowStatus[] |
 | ) |  |  | [inline]

Definition at line 280 of file msomniprovrs.h.

  {
    HRESULT hr = _OmniProvBaseClass::ReleaseRows(
              cRows,
               rghRows,
               rgRowOptions,
               rgRefCounts,
               rgRowStatus);
    if(FAILED(Fire_OnRowChange(this, cRows, rghRows, DBREASON_ROW_RELEASE, DBEVENTPHASE_DIDEVENT, TRUE)))
      ATLTRACE2(atlTraceDBProvider, 0, "Failed to Fire DBREASON_ROW_RELEASE in DBEVENTPHASE_DIDEVENT phase\n");
    return hr;
  }

void CMSOmniProvRowset::SetSchemaInfo | ( | ATLCOLUMNINFO * | prgColInfo,
 |  | int | cCols |
 | ) |  |  | [inline]

Definition at line 158 of file msomniprovrs.h.

  {
    m_cCols = cCols;
    m_prgColInfo = new ATLCOLUMNINFO[cCols];
    // Copy the information from the columninfo passed in. This is possible because
    // we know that there are no pointers in the structure.
    for (int i = 0; i < cCols; i++)
      m_prgColInfo[i] = prgColInfo[i];
  }

Member Data Documentation

int CMSOmniProvRowset::m_cCols

Definition at line 137 of file msomniprovrs.h.

CDBFile CMSOmniProvRowset::m_DBFile

Definition at line 138 of file msomniprovrs.h.

ATLCOLUMNINFO* CMSOmniProvRowset::m_prgColInfo

Definition at line 139 of file msomniprovrs.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/omniprov/source/msomniprovrs.h
  • Dataaccess/oledb/omniprov/source/msomniprovrs.cpp
Generated on Wed Nov 13 2024 16:56:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMSOmniProvSession Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CMSOmniProvSession Class Reference

#include "msomniprovsess.h"

List of all members.

Public Member Functions

CMSOmniProvSession ()
HRESULT | FinalConstruct ()
STDMETHOD() | OpenRowset (IUnknown *pUnk, DBID *pTID, DBID *pInID, REFIID riid, ULONG cSets, DBPROPSET rgSets[], IUnknown **ppRowset)

Detailed Description

Definition at line 24 of file msomniprovsess.h.

Constructor & Destructor Documentation

CMSOmniProvSession::CMSOmniProvSession ( ) [inline]

Definition at line 35 of file msomniprovsess.h.

  {
  }

Member Function Documentation

HRESULT CMSOmniProvSession::FinalConstruct ( ) [inline]

Definition at line 38 of file msomniprovsess.h.

  {
    return FInit();
  }

STDMETHOD() CMSOmniProvSession::OpenRowset | ( | IUnknown * | pUnk,
 |  | DBID * | pTID,
 |  | DBID * | pInID,
 |  | REFIID | riid,
 |  | ULONG | cSets,
 |  | DBPROPSET | rgSets[],
 |  | IUnknown ** | ppRowset |
 | ) |  |  | [inline]

Definition at line 43 of file msomniprovsess.h.

  {
    CMSOmniProvRowset* pRowset;
    return  CreateRowset(pUnk, pTID, pInID, riid, cSets, rgSets, ppRowset, pRowset);
  }

The documentation for this class was generated from the following file:
  • Dataaccess/oledb/omniprov/source/msomniprovsess.h
Generated on Wed Nov 13 2024 16:56:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMSOmniProvSessionColSchemaRowset Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CMSOmniProvSessionColSchemaRowset Class Reference

#include "msomniprovsess.h"

List of all members.

Public Member Functions

HRESULT | Execute (LONG *pcRowsAffected, ULONG, const VARIANT *)
DBSTATUS | GetDBStatus (CSimpleRow *, ATLCOLUMNINFO *pInfo)

Private Attributes

double | m_double
HCHAPTER | m_hchapter

Detailed Description

Definition at line 100 of file msomniprovsess.h.

Member Function Documentation

HRESULT CMSOmniProvSessionColSchemaRowset::Execute | ( | LONG * | pcRowsAffected,
 |  | ULONG | ,
 |  | const VARIANT * |  |
 | ) |  |  | [inline]

Definition at line 107 of file msomniprovsess.h.

  {
    USES_CONVERSION;
    // Currently Hardcoded later on get it from the CStorageClass - Catalog, Schema,Name,Type
    CCOLUMNSRow trData[4];   // 4 columns
    for(long l=0; l<4;l++)
    {
      lstrcpyW(trData[l].m_szTableCatalog, OLESTR("OmniProv Catalog"));
      lstrcpyW(trData[l].m_szTableSchema, OLESTR("OmniProv Schema"));
      lstrcpyW(trData[l].m_szTableName, OLESTR("OmniTable"));
      trData[l].m_ulOrdinalPosition = l+1;
      trData[l].m_bIsNullable = VARIANT_FALSE;
      trData[l].m_bColumnHasDefault = VARIANT_TRUE;
      trData[l].m_ulColumnFlags = DBCOLUMNFLAGS_WRITE;  // To write into the columnss
      // Currently all the data is static
      switch(l)
      {
      case 0:
        trData[l].m_nDataType = DBTYPE_STR;
        trData[l].m_ulCharMaxLength = 10;
        lstrcpyW(trData[l].m_szColumnName, OLESTR("CustomerID"));
        break;
      case 1:
        trData[l].m_nDataType = DBTYPE_STR;
        trData[l].m_ulCharMaxLength = 40;
        lstrcpyW(trData[l].m_szColumnName, OLESTR("CustomerName"));
        break;
      case 2:
        trData[l].m_nDataType = DBTYPE_STR;
        trData[l].m_ulCharMaxLength = 40;
        lstrcpyW(trData[l].m_szColumnName, OLESTR("ItemName "));
        break;
      case 3: // The Long
        trData[l].m_nDataType = DBTYPE_I4;
        trData[l].m_nNumericPrecision = 10;
        lstrcpyW(trData[l].m_szColumnName, OLESTR("Sale"));
      }
      m_rgRowData.Add(trData[l]);
    }
    *pcRowsAffected = l+1;
    return S_OK;
  }

DBSTATUS CMSOmniProvSessionColSchemaRowset::GetDBStatus | ( | CSimpleRow * | ,
 |  | ATLCOLUMNINFO * | pInfo |
 | ) |  |  | [inline]

Definition at line 149 of file msomniprovsess.h.

  {
    switch(pInfo->iOrdinal)
    {
    case 1:
    case 2:
    case 3:
    case 19:
    case 20:
    case 22:
    case 23:
    case 25:
    case 26:
      return DBSTATUS_S_ISNULL;
    default:
      return DBSTATUS_S_OK;
    }
  }

Member Data Documentation

double CMSOmniProvSessionColSchemaRowset::m_double [private]

Definition at line 103 of file msomniprovsess.h.

HCHAPTER CMSOmniProvSessionColSchemaRowset::m_hchapter [private]

Definition at line 104 of file msomniprovsess.h.

The documentation for this class was generated from the following file:
  • Dataaccess/oledb/omniprov/source/msomniprovsess.h
Generated on Wed Nov 13 2024 16:56:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMSOmniProvSessionPTSchemaRowset Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CMSOmniProvSessionPTSchemaRowset Class Reference

#include "msomniprovsess.h"

List of all members.

Public Member Functions

HRESULT Execute (LONG *pcRowsAffected, ULONG, const VARIANT *)

Detailed Description

Definition at line 170 of file msomniprovsess.h.

Member Function Documentation

HRESULT CMSOmniProvSessionPTSchemaRowset::Execute | ( | LONG * | pcRowsAffected,
 |  | ULONG | ,
 |  | const VARIANT * |  |
 | ) |  |  | [inline]

Definition at line 177 of file msomniprovsess.h.

  {
    USES_CONVERSION;
    CPROVIDER_TYPERow trData[2];

    // DBTYPE_STR
    lstrcpyW(trData[0].m_szName, OLESTR("DBTYPE_STR"));
    trData[0].m_nType = DBTYPE_STR;
    trData[0].m_bIsLong = VARIANT_FALSE;
    trData[0].m_bIsNullable = VARIANT_FALSE;
    trData[0].m_bCaseSensitive = VARIANT_TRUE;
    m_rgRowData.Add(trData[0]);

    // DBTYPE_I4
    lstrcpyW(trData[1].m_szName, OLESTR("DBTYPE_I4"));
    trData[1].m_nType = DBTYPE_I4;
    trData[1].m_bIsLong = VARIANT_TRUE;
    trData[1].m_bIsNullable = VARIANT_FALSE;
    m_rgRowData.Add(trData[1]);

    *pcRowsAffected = 2;
    return S_OK;
  }

The documentation for this class was generated from the following file:
  • Dataaccess/oledb/omniprov/source/msomniprovsess.h
Generated on Wed Nov 13 2024 16:56:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMSOmniProvSessionTRSchemaRowset Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CMSOmniProvSessionTRSchemaRowset Class Reference

#include "msomniprovsess.h"

List of all members.

Public Member Functions

HRESULT | Execute (LONG *pcRowsAffected, ULONG, const VARIANT *)
DBSTATUS | GetDBStatus (CSimpleRow *, ATLCOLUMNINFO *pInfo)

Detailed Description

Definition at line 72 of file msomniprovsess.h.

Member Function Documentation

HRESULT CMSOmniProvSessionTRSchemaRowset::Execute | ( | LONG * | pcRowsAffected,
 |  | ULONG | ,
 |  | const VARIANT * |  |
 | ) |  |  | [inline]

Definition at line 76 of file msomniprovsess.h.

  {
    USES_CONVERSION;
    // Currently Hardcoded later on get it from the CStorageClass - Catalog, Schema,Name,Type
    CTABLESRow trData;
    lstrcpyW(trData.m_szSchema, OLESTR("OmniProv Schema"));
    lstrcpyW(trData.m_szCatalog, OLESTR("OmniProv Catalog"));
    lstrcpynW(trData.m_szTable, OLESTR("OmniTable"), SIZEOF_MEMBER(CTABLESRow, m_szTable));
    lstrcpyW(trData.m_szType, OLESTR("TABLE"));
    if (!m_rgRowData.Add(trData))
      return E_OUTOFMEMORY;
    *pcRowsAffected = 1;
    return S_OK;
  }

DBSTATUS CMSOmniProvSessionTRSchemaRowset::GetDBStatus | ( | CSimpleRow * | ,
 |  | ATLCOLUMNINFO * | pInfo |
 | ) |  |  | [inline]

Definition at line 90 of file msomniprovsess.h.

  {
    if (pInfo->iOrdinal < 4)
      return DBSTATUS_S_OK;
    else
      return DBSTATUS_S_ISNULL;
  }

The documentation for this class was generated from the following file:
  • Dataaccess/oledb/omniprov/source/msomniprovsess.h
Generated on Wed Nov 13 2024 16:56:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMSOmniProvSource Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CMSOmniProvSource Class Reference

#include "msomniprovds.h"

List of all members.

Public Member Functions

HRESULT FinalConstruct ()

Detailed Description

Definition at line 13 of file msomniprovds.h.

Member Function Documentation

HRESULT CMSOmniProvSource::FinalConstruct ( ) [inline]

Definition at line 12 of file msomniprovds.h.

                                      :
  public CComObjectRootEx<CComSingleThreadModel>,
  public CComCoClass<CMSOmniProvSource, &CLSID_MSOmniProv>,

The documentation for this class was generated from the following file:
  • Dataaccess/oledb/omniprov/source/msomniprovds.h
Generated on Wed Nov 13 2024 16:56:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMultichanApp Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CMultichanApp Class Reference

#include "multichan.h"

Inherits CWinApp.

List of all members.

Public Member Functions

CMultichanApp ()
~CMultichanApp ()
virtual BOOL | InitInstance ()
afx_msg void | OnAppAbout ()

Detailed Description

Definition at line 26 of file multichan.h.

Constructor & Destructor Documentation

CMultichanApp::CMultichanApp ( )

Definition at line 32 of file multichan.cpp.

{
  // TODO: add construction code here,
  // Place all significant initialization in InitInstance
}

CMultichanApp::~CMultichanApp ( )

Definition at line 40 of file multichan.cpp.

{
    if( g_pdlgDest )
        delete g_pdlgDest;

  POSITION  pos   = g_listSources.GetHeadPosition();
  CDlgSrc * pdlgSrc = 0;

  for( ; pos; )
  {
    pdlgSrc = g_listSources.GetNext( pos );
    delete pdlgSrc;
    pdlgSrc = 0;
  }

  g_listSources.RemoveAll();

    ASSERT( g_listSources.IsEmpty() );
}

Member Function Documentation

BOOL CMultichanApp::InitInstance ( void ) [virtual]

Reimplemented from CWinApp.

Definition at line 68 of file multichan.cpp.

{
  // Standard initialization
  // If you are not using these features and wish to reduce the size
  //  of your final executable, you should remove from the following
  //  the specific initialization routines you do not need.

#ifdef _AFXDLL
  Enable3dControls();     // Call this when using MFC in a shared DLL
#else
  Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif

  // Change the registry key under which our settings are stored.
  // TODO: You should modify this string to be something appropriate
  // such as the name of your company or organization.
  SetRegistryKey(_T("Local AppWizard-Generated Applications"));

  // To create the main window, this code creates a new frame window
  // object and then sets it as the application's main window object.

  CMainFrame* pFrame = new CMainFrame;
  m_pMainWnd = pFrame;

  // create and load the frame with its resources
  pFrame->LoadFrame(IDR_MAINFRAME, WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, NULL, NULL);

    ASSERT(g_pChildView);
    g_pdlgDest = new CDlgDest(g_pChildView);
    g_pdlgDest->Create();

  // The one and only window has been initialized, so show and update it.
  pFrame->ShowWindow(SW_SHOW);
  pFrame->UpdateWindow();

  return TRUE;
}

void CMultichanApp::OnAppAbout ( )

Definition at line 110 of file multichan.cpp.

{
  CDialog* pdlg = new CDialog(MAKEINTRESOURCE(IDD_ABOUTBOX));

    pdlg->DoModal();
}

The documentation for this class was generated from the following files:
  • Multimedia/Audio/multichan/multichan.h
  • Multimedia/Audio/multichan/multichan.cpp
Generated on Wed Nov 13 2024 16:56:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMultipleResults Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CMultipleResults Class Reference

#include "cmultipleresults.h"

Inherits CBase.

List of all members.

Public Member Functions

CMultipleResults (CMainWindow *pCMainWindow, CMDIChild *pCMDIChild=NULL)
virtual | ~CMultipleResults ()
virtual HRESULT | AutoQI (DWORD dwCreateOpts)
virtual HRESULT | AutoRelease ()
virtual REFIID | GetDefaultInterface ()
virtual IUnknown ** | GetInterfaceAddress (REFIID riid)
virtual LONG | GetObjectImage ()
virtual UINT | GetObjectMenu ()
virtual WCHAR * | GetObjectName ()
virtual HRESULT | GetResult (CAggregate *pCAggregate, DB_LRESERVE lResultFlag, REFIID riid, DBROWCOUNT *pcRowsAffected, IUnknown **ppIUnknown)

Public Attributes

IMultipleResults * | m_pIMultipleResults

Detailed Description

Definition at line 25 of file cmultipleresults.h.

Constructor & Destructor Documentation

CMultipleResults::CMultipleResults | ( | CMainWindow * | pCMainWindow,
 |  | CMDIChild * | pCMDIChild = NULL
 | ) |  |

Definition at line 22 of file cmutipleresults.cpp.

  : CBase(eCMultipleResults, pCMainWindow, pCMDIChild)
{
  //MultipleResults
  m_pIMultipleResults       = NULL;//MultipleResults Interface
}

CMultipleResults::~CMultipleResults ( ) [virtual]

Definition at line 34 of file cmutipleresults.cpp.

{
  ReleaseObject(0);
}

Member Function Documentation

HRESULT CMultipleResults::AutoQI ( DWORD dwCreateOpts ) [virtual]

Implements CBase.

Definition at line 71 of file cmutipleresults.cpp.

{
  //Delegate First so we have base interfaces
  CBase::AutoQI(dwCreateOpts);

  //[MANDATORY]
  if(dwCreateOpts & CREATE_QI_MANDATORY)
  {
    OBTAIN_INTERFACE(IMultipleResults);
  }

  //Auto QI
  if(dwCreateOpts & CREATE_QI_OPTIONAL)
  {
  }

  return S_OK;
}

HRESULT CMultipleResults::AutoRelease ( ) [virtual]

Implements CBase.

Definition at line 57 of file cmutipleresults.cpp.

{
  //MultipleResults
  RELEASE_INTERFACE(IMultipleResults);

  //Delegate
  return CBase::AutoRelease();
}

virtual REFIID CMultipleResults::GetDefaultInterface ( ) [inline, virtual]

Implements CBase.

Definition at line 41 of file cmultipleresults.h.

{ return IID_IMultipleResults;    }

IUnknown ** CMultipleResults::GetInterfaceAddress ( REFIID riid ) [virtual]

Implements CBase.

Definition at line 44 of file cmutipleresults.cpp.

{
  HANDLE_GETINTERFACE(IMultipleResults);

  //Otherwise delegate
  return CBase::GetInterfaceAddress(riid);
}

virtual LONG CMultipleResults::GetObjectImage ( ) [inline, virtual]

Implements CBase.

Definition at line 40 of file cmultipleresults.h.

{ return IMAGE_MULTIPLE;      }

virtual UINT CMultipleResults::GetObjectMenu ( ) [inline, virtual]

Implements CBase.

Definition at line 39 of file cmultipleresults.h.

{ return IDM_MULTIPLERESULTSMENU; }

virtual WCHAR* CMultipleResults::GetObjectName ( ) [inline, virtual]

Implements CBase.

Definition at line 38 of file cmultipleresults.h.

{ return L"MultipleResults";    }

HRESULT CMultipleResults::GetResult | ( | CAggregate * | pCAggregate,
 |  | DB_LRESERVE | lResultFlag,
 |  | REFIID | riid,
 |  | DBROWCOUNT * | pcRowsAffected,
 |  | IUnknown ** | ppIUnknown |
 | ) |  |  | [virtual]

Definition at line 95 of file cmutipleresults.cpp.

{
  HRESULT hr = E_FAIL;

  //No-op
  if(m_pIMultipleResults == NULL)
    return E_FAIL;

  //IMultipleResults::GetResult...
  XTEST(hr = m_pIMultipleResults->GetResult(pCAggregate, lResultFlag, riid, pcRowsAffected, ppIUnknown));
  TESTC(TRACE_METHOD(hr, L"IMultipleResults::GetResult(0x%p, %d, %s, &%ld, &0x%p)", pCAggregate, lResultFlag, GetInterfaceName(riid), pcRowsAffected ? *pcRowsAffected : NULL, ppIUnknown ? *ppIUnknown : NULL));

  //Handle Aggregation
  if(pCAggregate)
    TESTC(hr = pCAggregate->HandleAggregation(riid, ppIUnknown));

CLEANUP:
  return hr;
}

Member Data Documentation

IMultipleResults* CMultipleResults::m_pIMultipleResults

Definition at line 48 of file cmultipleresults.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cmultipleresults.h
  • Dataaccess/oledb/rowsetviewer/cmutipleresults.cpp
Generated on Wed Nov 13 2024 16:56:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMultipleResultsDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CMultipleResultsDlg Class Reference

#include "cdialog.h"

Inherits CInterfaceDlg, and CRowsetViewerDlg.

List of all members.

Public Member Functions

CMultipleResultsDlg (CMDIChild *pCMDIChild)
virtual | ~CMultipleResultsDlg ()
virtual BOOL | OnInitDialog ()
virtual BOOL | OnOK ()

Protected Attributes

CComboBoxLite m_CComboReserved

Detailed Description

Definition at line 637 of file cdialog.h.

Constructor & Destructor Documentation

CMultipleResultsDlg::CMultipleResultsDlg ( CMDIChild * pCMDIChild )

Definition at line 5305 of file cdialog.cpp.

  : CInterfaceDlg(IDD_MULTIPLERESULTS, NULL, IID_IRowset), CRowsetViewerDlg(NULL, pCMDIChild)
{
  //Data
}

CMultipleResultsDlg::~CMultipleResultsDlg ( ) [virtual]

Definition at line 5316 of file cdialog.cpp.

{
}

Member Function Documentation

BOOL CMultipleResultsDlg::OnInitDialog ( ) [virtual]

Definition at line 5325 of file cdialog.cpp.

{
  CWaitCursor waitCursor;

  //Populate the lResultFlag Flag
  m_CComboReserved.CreateIndirect(m_hWnd, IDC_RESERVED);
  m_CComboReserved.Populate(g_cResultFlagMaps, g_rgResultFlagMaps);
  m_CComboReserved.SetSelValue(DBRESULTFLAG_DEFAULT);

  //Delegate
  return CInterfaceDlg::OnInitDialog();
}

BOOL CMultipleResultsDlg::OnOK ( ) [virtual]

Definition at line 5343 of file cdialog.cpp.

{
  CWaitCursor waitCursor;
  HRESULT hr = S_OK;

  //Obtain the MultipleResults object
  CMultipleResults* pCMultipleResults = SOURCE_GETOBJECT(m_pCMDIChild->m_pCSource, CMultipleResults);
  if(pCMultipleResults)
  {
    DBROWCOUNT  cRowsAffected = 0;

    //Obtain inherited items...
    CInterfaceDlg::OnUpdate();

    //lResultFlag Flag
    //Used to determine which object to obtain when riid is ambigous
    DB_LRESERVE lResultFlag = m_CComboReserved.GetSelValue();
    if(lResultFlag == CB_ERR)
      lResultFlag = DBRESULTFLAG_DEFAULT;

    //IMultipleResults::GetResult...
    //NOTE: Can pontentially return other object types: (ie: CREATE_DETERMINE_TYPE)
    if(SUCCEEDED(hr = pCMultipleResults->GetResult(GetAggregate(), lResultFlag, GetSelInterface(), &cRowsAffected, ppUnknown())))
      m_pCMainWindow->HandleObjectType(pCMultipleResults, pUnknown(), GetSelInterface(), eCRowset, 0, NULL, CREATE_NEWWINDOW_IFEXISTS | CREATE_DETERMINE_TYPE);
  }

//CLEANUP:
  if(SUCCEEDED(hr))
    CDialogLite::OnOK();
  return TRUE;
}

Member Data Documentation

CComboBoxLite CMultipleResultsDlg::m_CComboReserved [protected]

Definition at line 652 of file cdialog.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialog.h
  • Dataaccess/oledb/rowsetviewer/cdialog.cpp
Generated on Wed Nov 13 2024 16:56:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMultiRecoApp Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes

CMultiRecoApp Class Reference

#include "MultiReco.h"

Inherits IInkCollectorEventsImpl< CMultiRecoApp >, and IInkRecognitionEventsImpl< CMultiRecoApp >.

List of all members.

Public Types

enum {
mc_iSubmenuRecognizers = 1, mc_iInputWndId = 1, mc_iOutputWndId = 2, mc_iStatusWndId = 3,
mc_iNumRowsCols = 100, mc_iGuideColWidth = 80, mc_iGuideRowHeight = 80, mc_cxBoxMargin = 4,
mc_cyBoxMargin = 4, mc_iPenWidth = 5
}

Public Member Functions

CMultiRecoApp ()
bool | CreateChildWindows ()
bool | CreateRecoContext (IInkRecognizer *pIInkRecognizer)
void | CreateRecoGuides ()
bool | DoOpen (bool bNew)
bool | DoSave (bool bSaveAs, bool bAskUser)
bool | LoadFile (IInkDisp *pInkDisp)
HMENU | LoadMenu ()
LRESULT | OnClear (WORD, WORD, HWND, BOOL &)
LRESULT | OnClose (UINT, WPARAM, LPARAM, BOOL &bHandled)
LRESULT | OnCreate (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
LRESULT | OnDestroy (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
LRESULT | OnExit (WORD, WORD, HWND, BOOL &)
LRESULT | OnFileOpen (WORD, WORD wID, HWND, BOOL &)
LRESULT | OnFileSave (WORD, WORD wID, HWND, BOOL &)
LRESULT | OnNewStrokes (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
HRESULT | OnRecognition (BSTR bstrRecognizedString, VARIANT vCustomParam, InkRecognitionStatus RecognitionStatus)
LRESULT | OnSize (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
HRESULT | OnStroke (IInkCursor *pIInkCursor, IInkStrokeDisp *pIInkStroke, VARIANT_BOOL *pbCancel)
void | SaveStrokeCollection ()
void | StartNewStrokeCollection ()
void | UpdateFilename (WCHAR *pwsFile=NULL, WCHAR *pwsFileTitle=NULL)
void | UpdateLayout ()
void | UpdateStatusBar ()

Static Public Member Functions

static int | Run (int nCmdShow)

Public Attributes

CComBSTR | m_bstrCurRecoName
HWND | m_hwndStatusBar
WORD | m_iColor
UINT m_nCmdRecognizer
CComPtr< IInkCollector > | m_spIInkCollector
CComPtr< IInkCustomStrokes > | m_spIInkCustomStrokes
CComPtr< IInkDisp > | m_spIInkDisp
CComPtr< IInkRecognizerContext > | m_spIInkRecoContext
CComPtr< IInkRecognizers > | m_spIInkRecognizers
CComPtr< IInkRecognizerGuide > | m_spIInkRecoGuideBoxed
CComPtr< IInkRecognizerGuide > | m_spIInkRecoGuideLined
CComPtr< IInkStrokes > | m_spIInkStrokes
WCHAR | m_wchFile [MAX_PATH]
WCHAR | m_wchFileTitle [MAX_PATH]
CInkInputWnd m_wndInput
CRecoOutputWnd m_wndResults

Static Public Attributes

static const COLORREF | mc_crColors []

Detailed Description

Definition at line 26 of file MultiReco.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
mc_iSubmenuRecognizers
mc_iInputWndId
mc_iOutputWndId
mc_iStatusWndId
mc_iNumRowsCols
mc_iGuideColWidth
mc_iGuideRowHeight
mc_cxBoxMargin
mc_cyBoxMargin
mc_iPenWidth

Definition at line 33 of file MultiReco.h.

         {
        // 'Recognizer' submenu index
        mc_iSubmenuRecognizers = 1,
        // child windows IDs
        mc_iInputWndId = 1,
        mc_iOutputWndId = 2,
        mc_iStatusWndId = 3,
        // recognition guide box data
        mc_iNumRowsCols = 100,
        mc_iGuideColWidth = 80,
        mc_iGuideRowHeight = 80,
        mc_cxBoxMargin = 4,
        mc_cyBoxMargin = 4,
        // pen width
        mc_iPenWidth = 5
    };

Constructor & Destructor Documentation

CMultiRecoApp::CMultiRecoApp ( ) [inline]

Definition at line 85 of file MultiReco.h.

                    :
        m_hwndStatusBar(NULL),
        m_nCmdRecognizer(0),
        m_iColor(0)
    {
        m_wchFile[0] = m_wchFileTitle[0] = 0;
    }

Member Function Documentation

bool CMultiRecoApp::CreateChildWindows ( )

Definition at line 1389 of file MultiReco.cpp.

{
    // Create windows for input and output
    if ((m_wndResults.Create(m_hWnd, mc_iOutputWndId) == NULL)
        || (m_wndInput.Create(m_hWnd, CWindow::rcDefault, NULL,
                             WS_CHILD, WS_EX_CLIENTEDGE, (UINT)mc_iInputWndId) == NULL))
    {
        return false;
    }

    // Create a status bar (Ignore if it fails, the application can live without it).
    m_hwndStatusBar = ::CreateStatusWindow(
                        WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN|WS_CLIPSIBLINGS|SBARS_SIZEGRIP,
                        NULL, m_hWnd, (UINT)mc_iStatusWndId);

    if (NULL != m_hwndStatusBar)
    {
        // Set the status bar font
        ::SendMessage(m_hwndStatusBar,
                      WM_SETFONT,
                      (LPARAM)::GetStockObject(DEFAULT_GUI_FONT),
                      FALSE);
    }

    // Update the child windows' positions and sizes so that they cover
    // entire client area of the main window.
    UpdateLayout();

    return true;
}

bool CMultiRecoApp::CreateRecoContext ( IInkRecognizer * pIInkRecognizer )

Definition at line 1318 of file MultiReco.cpp.

{
    // Create a new recognition context
    CComPtr<IInkRecognizerContext> spNewContext;
    if (FAILED(pIInkRecognizer->CreateRecognizerContext(&spNewContext)))
        return false;

    // Replace the current context with the new one
    if (m_spIInkRecoContext != NULL)
    {
        // Close the connection to the recognition events source
        IInkRecognitionEventsImpl<CMultiRecoApp>::DispEventUnadvise(m_spIInkRecoContext);
    }
    m_spIInkRecoContext.Attach(spNewContext.Detach());

    // Establish a connection with the recognition context's event source
    if (FAILED(IInkRecognitionEventsImpl<CMultiRecoApp>::DispEventAdvise(m_spIInkRecoContext)))
    {
        MessageBoxW(L"Failed connect to the recognition context's event source.\n"
                    L"The input won't be recognized dynamically.",
                    gc_szAppName, MB_ICONERROR | MB_OK);
    }

    // Set the guide if it's supported by the recognizer and has been created
    int cRows = 0, cColumns = 0;
  InkRecognizerCapabilities dwCapabilities = IRC_DontCare;
  if (SUCCEEDED(pIInkRecognizer->get_Capabilities(&dwCapabilities)))
    {
        // Try the boxed guide
        if (((IRC_BoxedInput & dwCapabilities) == IRC_BoxedInput)
            && (m_spIInkRecoGuideBoxed != NULL))
        {
            HRESULT hr = m_spIInkRecoContext->putref_Guide(m_spIInkRecoGuideBoxed);
            if (SUCCEEDED(hr))
            {
                cRows = cColumns = mc_iNumRowsCols;
            }
        }
        // or the lined one
        else if (((IRC_LinedInput & dwCapabilities) == IRC_LinedInput)
            && (m_spIInkRecoGuideLined != NULL))
        {
            if (SUCCEEDED(m_spIInkRecoContext->putref_Guide(m_spIInkRecoGuideLined)))
            {
                cRows = mc_iNumRowsCols;
            }
        }
    }
    // Update the input window
    m_wndInput.SetRowsCols(cRows, cColumns);

    return true;
}

void CMultiRecoApp::CreateRecoGuides ( )

Definition at line 1144 of file MultiReco.cpp.

{
    CComPtr<IInkRenderer> spIInkRenderer;
    if ((m_spIInkCollector == NULL)
        || FAILED(m_spIInkCollector->get_Renderer(&spIInkRenderer)))
        return;

    HDC hdc = m_wndInput.GetDC();
    if (NULL == hdc)
        return;

    // Initialize the recognizer guide data structure
    _InkRecoGuide irg;
    irg.midline = -1;                   // not use midline
    irg.cRows = mc_iNumRowsCols;
    irg.cColumns = mc_iNumRowsCols;
    ::SetRect(&irg.rectWritingBox, 0, 0, mc_iGuideColWidth, mc_iGuideRowHeight);
    // Make the guide's DrawnBox a little smaller than the the actual area
    // in which a user is expected to draw the ink (WritingBox)
    irg.rectDrawnBox = irg.rectWritingBox;
    ::InflateRect(&irg.rectDrawnBox, -mc_cxBoxMargin, -mc_cyBoxMargin);

    // Set the m_wndInput's guide data with screen coordinates
    m_wndInput.SetGuide(irg);

    // Use IInkRenderer to transform the guide boxes
    // rectangles into ink space coordinates
    // - the guide's writing box
    if (   SUCCEEDED(spIInkRenderer->PixelToInkSpace((long)hdc,
                                                     &irg.rectWritingBox.left,
                                                     &irg.rectWritingBox.top))
        && SUCCEEDED(spIInkRenderer->PixelToInkSpace((long)hdc,
                                                     &irg.rectWritingBox.right,
                                                     &irg.rectWritingBox.bottom))
        // and the drawn box
        && SUCCEEDED(spIInkRenderer->PixelToInkSpace((long)hdc,
                                                     &irg.rectDrawnBox.left,
                                                     &irg.rectDrawnBox.top))
        && SUCCEEDED(spIInkRenderer->PixelToInkSpace((long)hdc,
                                                     &irg.rectDrawnBox.right,
                                                     &irg.rectDrawnBox.bottom))
        )
    {
        // Create the boxed guide
        if (SUCCEEDED(m_spIInkRecoGuideBoxed.CoCreateInstance(CLSID_InkRecognizerGuide)))
        {
            // Initialize it
            if (FAILED(m_spIInkRecoGuideBoxed->put_GuideData(irg)))
            {
                m_spIInkRecoGuideBoxed.Release();
            }
        }

        // Create the lined guide
        if (SUCCEEDED(m_spIInkRecoGuideLined.CoCreateInstance(CLSID_InkRecognizerGuide)))
        {
            // Initialize it
            irg.cColumns = 0;  // no columns, just rows
            if (FAILED(m_spIInkRecoGuideLined->put_GuideData(irg)))
            {
                m_spIInkRecoGuideLined.Release();
            }
        }
    }

    // Clean up
    ReleaseDC(hdc);
}

bool CMultiRecoApp::DoOpen ( bool bNew )

Definition at line 795 of file MultiReco.cpp.

{
    // Disable inking
    m_spIInkCollector->put_Enabled(VARIANT_FALSE);

    // Create a new ink object
    CComPtr<IInkDisp> spIInkDisp;
    if (FAILED(spIInkDisp.CoCreateInstance(CLSID_InkDisp)))
    {
        MessageBoxW(L"Unable to create an ink object.",
                    gc_szAppName, MB_ICONERROR | MB_OK);
        // Enable inking
        m_spIInkCollector->put_Enabled(VARIANT_TRUE);
        return false;
    }

    // Let user select an .isf file to open
    if (false == bNew)
    {
        if (false == LoadFile(spIInkDisp))
        {
            // Don't proceed if opening a file or reading from it failed
            // or if the user canceled the operation
            // Enable inking
            m_spIInkCollector->put_Enabled(VARIANT_TRUE);
            return false;
        }
    }
    else
    {
        // Reset the file name and update the window's title
        UpdateFilename();
    }

    // Replace the old Ink object with the new one
    m_spIInkDisp.Attach(spIInkDisp.Detach());   // Attach/Detach don't call AddRef/Release
    m_spIInkCollector->putref_Ink(m_spIInkDisp);

    // Release the current stroke collections
    m_spIInkStrokes.Release();
    m_spIInkCustomStrokes.Release();
    m_wndResults.ResetResults();

    // Obtain a pointer to the custom strokes collection of the new ink object
    long lCount = 0;
    if (SUCCEEDED(m_spIInkDisp->get_CustomStrokes(&m_spIInkCustomStrokes)))
    {
        m_spIInkCustomStrokes->get_Count(&lCount);
        for (CComVariant vItem(0); vItem.lVal < lCount; vItem.lVal++)
        {
            IInkStrokes* pIInkStrokes;
            if (SUCCEEDED(m_spIInkCustomStrokes->Item(vItem, &pIInkStrokes)))
            {
                // Get the color of the strokes or use GRAY if fail
                COLORREF clr = RGB(0x80,0x80,0x80);
                CComPtr<IInkStrokeDisp> spIInkStroke;
                CComPtr<IInkDrawingAttributes> spIDrawAttrs;
                if (SUCCEEDED(pIInkStrokes->Item(0, &spIInkStroke))
                    && SUCCEEDED(spIInkStroke->get_DrawingAttributes(&spIDrawAttrs)))
                {
                    spIDrawAttrs->get_Color((long*)&clr);
                }
                // Get the best result string
                CComBSTR bstrToString;
                if (SUCCEEDED(pIInkStrokes->ToString(&bstrToString)))
                {
                    // Add the string to the RichEdit control
                    m_wndResults.AddString(
                            clr,                // the strokes color
                            bstrToString        // the recognition result string
                            );
                }
                pIInkStrokes->Release();
            }
        }

    }

    // Create an empty new stroke collection and attach it to the recognition context
    m_iColor = WORD(lCount) % countof(mc_crColors);   // next color to use
    StartNewStrokeCollection();

    // Reset the Dirty flag
    m_spIInkDisp->put_Dirty(VARIANT_FALSE);

    // Update the input window
    m_wndInput.Invalidate();

    // Enable inking
    m_spIInkCollector->put_Enabled(VARIANT_TRUE);
    return true;
}

bool CMultiRecoApp::DoSave | ( | bool | bSaveAs,
 |  | bool | bAskUser
 | ) |  |

Definition at line 913 of file MultiReco.cpp.

{
    if (m_spIInkDisp == NULL)
        return true;

    // If there's been no changes since the last save,
    // and it's not a SaveAs command, do nothing and return true
    VARIANT_BOOL bDirty = VARIANT_TRUE;
    if ((false == bSaveAs)
        && SUCCEEDED(m_spIInkDisp->get_Dirty(&bDirty))
        && VARIANT_FALSE == bDirty)
    {
        return true;
    }

    if (true == bAskUser)
    {
        int iRet = MessageBoxW(L"The ink object has been changed.\n"
                               L"Do you want to save the changes?",
                               gc_szAppName, MB_ICONQUESTION | MB_YESNOCANCEL);
        if (IDCANCEL == iRet)
            return false;
        if (IDNO == iRet)
            return true;
    }

    WCHAR wchFile[MAX_PATH];
    WCHAR wchFileTitle[MAX_PATH];
    wchFile[0] = wchFileTitle[0] = 0;

    if (false == bSaveAs && 0 == m_wchFile[0])
        bSaveAs = true;

    // If the function is called from the ID_FILE_SAVEAS command handler,
    // or the file is new, display the "SaveAs" common dialog box
    // for the user to specify the file name
    if (true == bSaveAs)
    {
        // Initialize the OPENFILENAME members.
        OPENFILENAMEW ofn;
        memset(&ofn, 0, sizeof(ofn));
        ofn.lStructSize = sizeof(ofn);
        ofn.hwndOwner = m_hWnd;
        ofn.lpstrDefExt = L"isf";
        ofn.lpstrFilter = L"*.isf\0";
        ofn.lpstrFileTitle= wchFileTitle;
        ofn.nMaxFileTitle = countof(wchFileTitle);
        ofn.lpstrFile= wchFile;
        ofn.nMaxFile = countof(wchFile);
        ofn.Flags = OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY;

        // Display the dialog box
        if (::GetSaveFileNameW(&ofn) == 0)
            return false;   // canceled by the user
    }

    // Add the current stroke collection to the Ink's CustomStrokes and release it
    SaveStrokeCollection();

    // Save the ink object into a variant using the ISF format
    bool bOk = false;
    CComVariant vData;
    if (SUCCEEDED(m_spIInkDisp->Save(
                         IPF_InkSerializedFormat, // save as ISF
                         IPCM_Default,            // use default compression
                         &vData)                  // the output
                         ))
    {
        BYTE* pbData;
        if (SUCCEEDED(::SafeArrayAccessData(vData.parray, (void**)&pbData)))
        {
            // Create new or overwrite the existing file
            HANDLE hFile = ::CreateFileW(
                                bSaveAs ? wchFile : m_wchFile,
                                GENERIC_WRITE,
                                0,
                                NULL,
                                CREATE_ALWAYS,
                                0,
                                NULL);
            if (INVALID_HANDLE_VALUE != hFile)
            {
                // Write the data into the file
                ULONG ulWritten, ulSize = vData.parray->rgsabound[0].cElements;
                if (TRUE == ::WriteFile(hFile, pbData, ulSize, &ulWritten, NULL))
                {
                    bOk = true;
                    m_spIInkDisp->put_Dirty(VARIANT_FALSE);
                }
                else
                {
                    MessageBoxW(L"Error writing file!",
                                gc_szAppName, MB_ICONERROR | MB_OK);
                }
                ::CloseHandle(hFile);

                // Update the filename string
                if (true == bSaveAs)
                {
                    UpdateFilename(wchFile, wchFileTitle);
                }
            }
            else
            {
                MessageBoxW(L"Unable to create the file.",
                            gc_szAppName, MB_ICONERROR | MB_OK);
            }
            ::SafeArrayUnaccessData(vData.parray);
        }
    }

    return bOk;
}

bool CMultiRecoApp::LoadFile ( IInkDisp * pInkDisp )

Definition at line 1044 of file MultiReco.cpp.

{
    WCHAR wchFile[MAX_PATH];
    WCHAR wchFileTitle[MAX_PATH];
    wchFile[0] = wchFileTitle[0] = 0;

    // Initialize the OPENFILENAME members.
    OPENFILENAMEW ofn;
    memset(&ofn, 0, sizeof(ofn));
    ofn.lStructSize = sizeof(ofn);
    ofn.hwndOwner = m_hWnd;
    ofn.lpstrFilter = L"*.isf\0";
    ofn.lpstrFileTitle= wchFileTitle;
    ofn.nMaxFileTitle = countof(wchFileTitle);
    ofn.lpstrFile= wchFile;
    ofn.nMaxFile = countof(wchFile);
    ofn.Flags = OFN_OVERWRITEPROMPT | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;

    // Display the "Open File..." common dialog box
    if (::GetOpenFileNameW(&ofn) == 0)
    {
        return false;
    }

    // Open the file and populate the Ink object from it
    HANDLE hFile = ::CreateFileW(wchFile, GENERIC_READ, 0, NULL,
                                 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
    if (INVALID_HANDLE_VALUE == hFile)
    {
        MessageBoxW(L"Error opening the file!", gc_szAppName, MB_ICONERROR | MB_OK);
        return false;
    }

    // Load the file into a safearrray of bytes, then load the ink object from the array
    bool bOk = false;
    DWORD dwRead, dwSize;
    dwSize = ::GetFileSize(hFile, NULL);
    if (dwSize != DWORD(-1))
    {
        VARIANT vtData;
        VariantInit(&vtData);
        vtData.vt = VT_ARRAY | VT_UI1;
        vtData.parray = ::SafeArrayCreateVector(VT_UI1, 0, dwSize);
        if (vtData.parray)
        {
            BYTE *pbData;
            if (SUCCEEDED(::SafeArrayAccessData(vtData.parray, (void**)&pbData)))
            {
                if (TRUE == ::ReadFile(hFile, pbData, dwSize, &dwRead, NULL)
                    && SUCCEEDED(pIInkDisp->Load(vtData)))
                {
                    bOk = true;
                }
                ::SafeArrayUnaccessData(vtData.parray);
            }
            ::SafeArrayDestroy(vtData.parray);
        }

        if (false == bOk)
        {
            MessageBoxW(L"Error loading ink object from the file.",
                        gc_szAppName, MB_ICONERROR | MB_OK);
        }
    }
    else
    {
        MessageBoxW(L"Error reading data from the file.\nUnknown file format.",
                    gc_szAppName, MB_ICONERROR | MB_OK);
    }

    // Close the file
    ::CloseHandle(hFile);

    // Store the filenames and update the title
    if (true == bOk)
    {
        UpdateFilename(wchFile, wchFileTitle);
    }

    return bOk;
}

HMENU CMultiRecoApp::LoadMenu ( )

Definition at line 672 of file MultiReco.cpp.

{
    HRESULT hr = S_OK;

    // Create the enumerator for the installed recognizers
    hr = m_spIInkRecognizers.CoCreateInstance(CLSID_InkRecognizers);
    if (FAILED(hr))
        return NULL;

    // Get the number of the recognizers known to the system
    LONG lCount = 0;
    hr = m_spIInkRecognizers->get_Count(&lCount);
    if (0 == lCount)
    {
        ::MessageBoxW(NULL, L"There are no handwriting recognizers installed.\n"
             L"You need to have at least one in order to run this sample.\nExiting.",
             gc_szAppName, MB_ICONERROR | MB_OK);
        return NULL;
    }

    // Load the menu of the main window
    HMENU hMenu = ::LoadMenu(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MENU));
    if (NULL == hMenu)
        return NULL; // Not normal

    MENUITEMINFOW miinfo;
    miinfo.cbSize = sizeof(miinfo);
    miinfo.fMask = MIIM_ID | MIIM_STATE | MIIM_TYPE;
    miinfo.fType = MFT_STRING;

    // Get the submenu id for the recognizers menu.
    // This submenu will contain the list of installed recognizers
    HMENU hSubMenu = ::GetSubMenu(hMenu, mc_iSubmenuRecognizers);
    if (NULL == hSubMenu)
    {
        ::DestroyMenu(hMenu);
        return NULL; // Not normal
    }

    // Remove the placeholding separator
    ::DeleteMenu(hSubMenu, 0, MF_BYPOSITION);

    CComPtr<IInkRecognizer> spIInkRecognizer;

    // Make sure that the number of menu items won't exceed
    // the predefined range of the corresponding command ID's
    if (lCount > (ID_RECOGNIZER_LAST - ID_RECOGNIZER_FIRST + 1))
        lCount = ID_RECOGNIZER_LAST - ID_RECOGNIZER_FIRST + 1;

    miinfo.fState = 0;
    bool bAllFailed = true;
    for (LONG i = 0; i < lCount; i++)
    {
        if (FAILED(m_spIInkRecognizers->Item(i, &spIInkRecognizer)))
            continue;

        // Filter out non-language recognizers by checking for
        // the languages supported by the recognizer - there'll be
        // none if it's a gesture or object recognizer.
        CComVariant vLanguages;
        if (SUCCEEDED(spIInkRecognizer->get_Languages(&vLanguages)))
        {
            if ((VT_ARRAY == (VT_ARRAY & vLanguages.vt))            // it should be an array
                && (NULL != vLanguages.parray)
                && (0 < vLanguages.parray->rgsabound[0].cElements)) // with at least one element
            {
                // This is a language recognizer. Add its name to the menu.
                CComBSTR bstrName;
                if (SUCCEEDED(spIInkRecognizer->get_Name(&bstrName)))
                {
                    // The ID_RECOGNIZER_FIRST is defined in the resource.h file.
                    // It's the base id for the commands that fill this submenu
                    miinfo.wID = ID_RECOGNIZER_FIRST + i;
                    miinfo.dwTypeData = bstrName;
                    if ((::InsertMenuItemW(hSubMenu, (UINT)-1, TRUE, &miinfo) != 0)
                        && (true == bAllFailed))
                    {
                        bAllFailed = false;
                    }
                }
            }
        }
        spIInkRecognizer.Release();
    }

    if (bAllFailed)
    {
        ::MessageBoxW(
            NULL,
            L"Unable to find or load handwriting text recognizers.\n"
            L"You need to have at least one in order to run this sample.\nExiting.",
            gc_szAppName,
            MB_ICONERROR | MB_OK);

        ::DestroyMenu(hMenu);

        return NULL;
    }

    return hMenu;
}

LRESULT CMultiRecoApp::OnClear | ( | WORD | ,
 |  | WORD | ,
 |  | HWND | ,
 |  | BOOL & |
 | ) |  |

Definition at line 468 of file MultiReco.cpp.

{
    if (m_spIInkDisp == NULL)   // there is nothing to clear
        return 0;

    // Detach the current stroke collection from the recognition context and release it
    if (m_spIInkRecoContext != NULL)
        m_spIInkRecoContext->putref_Strokes(NULL);
    m_spIInkStrokes.Release();

    // Clear the custom strokes collection
    if (m_spIInkCustomStrokes != NULL)
        m_spIInkCustomStrokes->Clear();

    // Delete all strokes from the Ink object
    m_spIInkDisp->DeleteStrokes(NULL);  // Passing NULL as a stroke collection pointer
                                        // means asking to delete all strokes

    // Get a new stroke collection from the ink object

    CComVariant v;  // This varaint is used to pass an array of ID's of the strokes
                    // which to be included into the new collection.
    // Ask for an empty collection by passing an empty variant
    if (SUCCEEDED(m_spIInkDisp->CreateStrokes(v, &m_spIInkStrokes)))
    {
        // Attach it to the recognition context
        if (FAILED(m_spIInkRecoContext->putref_Strokes(m_spIInkStrokes)))
        {
            MessageBoxW(L"Unable to attach the stroke collection to "
                        L"the recognition context",
                        gc_szAppName, MB_ICONERROR | MB_OK);
        }
    }
    else
    {
        MessageBoxW(L"Error creating new stroke collection.",
                    gc_szAppName, MB_ICONERROR | MB_OK);
    }

    // Update the child windows
    m_wndInput.Invalidate();
    m_wndResults.ResetResults();    // resets the text and updates the window

    // Tell the results window that a new stroke collection
    // is started, and set the color for it.
    m_wndResults.AddString(
            mc_crColors[m_iColor],  // new current color
            NULL                    // recognition result string, none yet
            );

    return 0;
}

LRESULT CMultiRecoApp::OnClose | ( | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM | ,
 |  | BOOL & | bHandled |
 | ) |  |  | [inline]

Definition at line 169 of file MultiReco.h.

    {
        // Ask user to save the last changes
        // Don't close if the user canceled it (DoSave returned false)
        bHandled = !DoSave(/*bSaveAs = */false, /*bAskUser = */ true);
        return 0;
    }

LRESULT CMultiRecoApp::OnCreate | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 241 of file MultiReco.cpp.

{
    // Create child windows for ink input and recognition output,
    // listview controls for the lists of gestures, and a status bar
    if (false == CreateChildWindows())
        return -1;

    HRESULT hr;

    // Create an ink collector object.
    hr = m_spIInkCollector.CoCreateInstance(CLSID_InkCollector);
    if (FAILED(hr))
        return -1;

    // Establish a connection to the collector's event source.
    hr = IInkCollectorEventsImpl<CMultiRecoApp>::DispEventAdvise(m_spIInkCollector);
    // There is nothing interesting the application can do without events
    // from the ink collector
    if (FAILED(hr))
        return -1;

    // Enable ink input in the m_wndInput window
    hr = m_spIInkCollector->put_hWnd((long)m_wndInput.m_hWnd);
    if (FAILED(hr))
        return -1;
    hr = m_spIInkCollector->put_Enabled(VARIANT_TRUE);
    if (FAILED(hr))
        return -1;

    // Create recognition guide objects
    CreateRecoGuides();

    return 0;
}

LRESULT CMultiRecoApp::OnDestroy | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 297 of file MultiReco.cpp.

{
    // Disable ink input and release the InkCollector object
    if (m_spIInkCollector != NULL)
    {
        IInkCollectorEventsImpl<CMultiRecoApp>::DispEventUnadvise(m_spIInkCollector);
        m_spIInkCollector->put_Enabled(VARIANT_FALSE);
        m_spIInkCollector.Release();
    }

    // Detach the strokes collection from the recognition context
    // and stop listening to the recognition events
    if (m_spIInkRecoContext != NULL)
    {
        m_spIInkRecoContext->EndInkInput();
        IInkRecognitionEventsImpl<CMultiRecoApp>::DispEventUnadvise(m_spIInkRecoContext);
        m_spIInkRecoContext.Release();
    }

    // Release the other objects and collections
    m_spIInkRecoGuideLined.Release();
    m_spIInkRecoGuideBoxed.Release();
    m_spIInkStrokes.Release();
    m_spIInkRecognizers.Release();

    // Post a WM_QUIT message to the application's message queue
    ::PostQuitMessage(0);

    return 0;
}

LRESULT CMultiRecoApp::OnExit | ( | WORD | ,
 |  | WORD | ,
 |  | HWND | ,
 |  | BOOL & |  |
 | ) |  |  | [inline]

Definition at line 216 of file MultiReco.h.

    {
        ::SendMessage(m_hWnd, WM_CLOSE, 0, 0);
        return 0;
    }

LRESULT CMultiRecoApp::OnFileOpen | ( | WORD | ,
 |  | WORD | wID,
 |  | HWND | ,
 |  | BOOL & |  |
 | ) |  |  | [inline]

Definition at line 184 of file MultiReco.h.

    {
        if (true == DoSave(/*bSaveAs = */false, /*bAskUser = */ true))
        {
            DoOpen(/*bNew = */ID_FILE_NEW == wID);
        }
        return 0;
    }

LRESULT CMultiRecoApp::OnFileSave | ( | WORD | ,
 |  | WORD | wID,
 |  | HWND | ,
 |  | BOOL & |  |
 | ) |  |  | [inline]

Definition at line 198 of file MultiReco.h.

    {
      DoSave(/*bSaveAs = */ID_FILE_SAVEAS == wID, /*bAskUser = */ false);
        return 0;
    }

LRESULT CMultiRecoApp::OnNewStrokes | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 545 of file MultiReco.cpp.

{
    // Change cursor to the system's Hourglass
    HCURSOR hCursor = ::SetCursor(::LoadCursor(NULL, IDC_WAIT));

    // Save the current stroke collection if there is any
    if (m_spIInkRecoContext != NULL)
    {
        // Cancel the previous background recognition requests
        // which have not been processed yet
        m_spIInkRecoContext->StopBackgroundRecognition();

        // Let the context know that there'll be no more input
        // for the attached stroke collection
        m_spIInkRecoContext->EndInkInput();

        // Add the stroke collection to the Ink object's CustomStrokes collection
        SaveStrokeCollection();
    }

    // If a different recognizer was selected, create a new recognition context
    // Else, reuse the same recognition context
    if (wID != m_nCmdRecognizer)
    {
        // Get a pointer to the recognizer object from the recognizer collection
        CComPtr<IInkRecognizer> spIInkRecognizer;
        if ((m_spIInkRecognizers == NULL)
            || FAILED(m_spIInkRecognizers->Item(wID - ID_RECOGNIZER_FIRST,
                                                &spIInkRecognizer))
            || (false == CreateRecoContext(spIInkRecognizer)))
        {
            // restore the cursor
            ::SetCursor(hCursor);
            return 0;
        }

        // Update the status bar
        m_bstrCurRecoName.Empty();
        spIInkRecognizer->get_Name(&m_bstrCurRecoName);
        UpdateStatusBar();

        // Store the selected recognizer's command id
        m_nCmdRecognizer = wID;
    }

    // Create a new stroke collection
    StartNewStrokeCollection();

    // restore the cursor
    ::SetCursor(hCursor);

    return 0;
}

HRESULT CMultiRecoApp::OnRecognition | ( | BSTR | bstrRecognizedString,
 |  | VARIANT | vCustomParam,
 |  | InkRecognitionStatus | RecognitionStatus
 | ) |  |

Definition at line 432 of file MultiReco.cpp.

{
    if (m_wndResults.IsWindow())
    {
        // Update the output window with the new results
        m_wndResults.UpdateString(bstrRecognizedString);
    }

    if (NULL != bstrRecognizedString)
        ::SysFreeString(bstrRecognizedString);

    return S_OK;
}

LRESULT CMultiRecoApp::OnSize | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 348 of file MultiReco.cpp.

{
    if (wParam != SIZE_MINIMIZED)
    {
        UpdateLayout();
    }
    return 0;
}

HRESULT CMultiRecoApp::OnStroke | ( | IInkCursor * | pIInkCursor,
 |  | IInkStrokeDisp * | pIInkStroke,
 |  | VARIANT_BOOL * | pbCancel
 | ) |  |

Definition at line 383 of file MultiReco.cpp.

{
    if (m_spIInkStrokes == NULL)    // shouldn't happen
        return E_FAIL;

    if (NULL == pIInkStroke)
        return E_INVALIDARG;

    HRESULT hr;

    // Add the new stroke to the current collection
    hr = m_spIInkStrokes->Add(pIInkStroke);

    if (SUCCEEDED(hr))
    {
        // Cancel the previous background recognition requests
        // which have not been processed yet
        m_spIInkRecoContext->StopBackgroundRecognition();

        // Ask the context to update the recognition results with newly added strokes
        // When the results are ready, the recognition context will return them
        // via the corresponding event RecognitionWithAlternates
        CComVariant vCustomData;
        m_spIInkRecoContext->BackgroundRecognize(vCustomData);
    }
    return hr;
}

int CMultiRecoApp::Run ( int nCmdShow ) [static]

Definition at line 167 of file MultiReco.cpp.

{

    CMultiRecoApp theApp;

    // Load and update the menu before creating the main window.
    // Create menu items for the installed recognizers and for the
    // supported factoids.
    HMENU hMenu = theApp.LoadMenu();
    if (NULL == hMenu)
        return 0;

    int iRet;

    // Load the icon from the resource and associate it with the window class
    WNDCLASSEX& wc = CMultiRecoApp::GetWndClassInfo().m_wc;
    wc.hIcon = wc.hIconSm = ::LoadIcon(_Module.GetResourceInstance(),
                                       MAKEINTRESOURCE(IDR_APPICON));

    // Create the application's main window
    if (theApp.Create(NULL, CWindow::rcDefault, gc_szAppName,
                      WS_OVERLAPPEDWINDOW, 0, (UINT)hMenu) != NULL)
    {
        // Initialize the application object:
        // Create an ink object
        theApp.SendMessage(WM_COMMAND, ID_FILE_NEW);
        // Create a recognition context using the first recognizer in the list
        // and start new stroke collection
        theApp.SendMessage(WM_COMMAND, ID_RECOGNIZER_FIRST);

        // Show and update the main window
        theApp.ShowWindow(nCmdShow);
        theApp.UpdateWindow();

        // Run the boilerplate message loop
        MSG msg;
        while (::GetMessage(&msg, NULL, 0, 0) > 0)
        {
            ::TranslateMessage(&msg);
            ::DispatchMessage(&msg);
        }
        iRet = msg.wParam;
    }
    else
    {
        ::MessageBoxW(NULL, L"Error creating the window",
                     gc_szAppName, MB_ICONERROR | MB_OK);
        ::DestroyMenu(hMenu);
        iRet = 0;
    }

    return iRet;
}

void CMultiRecoApp::SaveStrokeCollection ( )

Definition at line 1229 of file MultiReco.cpp.

{
    if (m_spIInkStrokes == NULL)
        return;

    long lCount = 0;
    if (m_spIInkRecoContext != NULL)
    {
        if (SUCCEEDED(m_spIInkStrokes->get_Count(&lCount)) && 0 != lCount)
        {
            CComPtr<IInkRecognitionResult> spIInkRecoResult;
            InkRecognitionStatus RecognitionStatus;
            if (SUCCEEDED(m_spIInkRecoContext->Recognize(&RecognitionStatus, &spIInkRecoResult)) && (spIInkRecoResult != NULL))
            {
                if (SUCCEEDED(spIInkRecoResult->SetResultOnStrokes()))
                {
                    CComBSTR bstr;
                    spIInkRecoResult->get_TopString(&bstr);
                    m_wndResults.UpdateString(bstr);
                }
                else
                {
                    MessageBoxW(L"Unable to save recognition result "
                                L"in the stroke collection.",
                                gc_szAppName, MB_ICONERROR | MB_OK);
                }
            }
            else
            {
                MessageBoxW(L"Recognition has failed. No results will be "
                            L"stored in the stroke collection.",
                            gc_szAppName, MB_ICONERROR | MB_OK);
            }
        }
        // Detach the stroke collection from the old recognition context
        m_spIInkRecoContext->putref_Strokes(NULL);
    }

    // Now add it to the ink's custom strokes collection
    // Each item (stroke collection) of the custom strokes must be identified
    // by a unique string. Here we generate a GUID for this.
    if ((0 != lCount) && (m_spIInkCustomStrokes != NULL))
    {
        GUID guid;
        WCHAR szGuid[40]; // format: "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}"
        if (SUCCEEDED(::CoCreateGuid(&guid))
            && (::StringFromGUID2(guid, szGuid, countof(szGuid)) != 0))
        {
            CComBSTR bstrGuid(szGuid);
            if (FAILED(m_spIInkCustomStrokes->Add(bstrGuid, m_spIInkStrokes)))
            {
                MessageBoxW(L"Failed to add the strokes to the Ink object's "
                            L"custom stroke collection",
                            gc_szAppName, MB_ICONERROR | MB_OK);
            }
        }
        else
        {
            MessageBoxW(L"Failed to create a unique string id for the stroke collection",
                        gc_szAppName, MB_ICONERROR | MB_OK);
        }

        // Use another color for the next collection
        m_iColor++;
        if (m_iColor >= countof(mc_crColors))
        {
            m_iColor= 0;
        }
    }

    m_spIInkStrokes.Release();
}

void CMultiRecoApp::StartNewStrokeCollection ( )

Definition at line 619 of file MultiReco.cpp.

{
    if ((m_spIInkDisp == NULL) || (m_spIInkRecoContext == NULL))
        return;

    // Create a new empty stroke collection and attach it to the recognition context
    CComVariant vt(0);
    if (SUCCEEDED(m_spIInkDisp->CreateStrokes(vt, &m_spIInkStrokes)))
    {
        if (FAILED(m_spIInkRecoContext->putref_Strokes(m_spIInkStrokes)))
        {
            MessageBoxW(L"Failed to attach the stroke collection to "
                        L"the recognition context",
                        gc_szAppName, MB_ICONERROR | MB_OK);
        }

        // Change the color of the pen and text output
        CComPtr<IInkDrawingAttributes> spIInkDrawAttrs;
        if (SUCCEEDED(m_spIInkCollector->get_DefaultDrawingAttributes(&spIInkDrawAttrs)))
        {
            spIInkDrawAttrs->put_Color(mc_crColors[m_iColor]);
        }
        // Tell the output window that the new stroke collection is current now and
        // it's future recognition results should be shown in the RichEdit control
        // with a different color
        m_wndResults.AddString(
                mc_crColors[m_iColor],  // new current color
                NULL                    // recognition result string, none yet
                );
    }
    else
    {
        MessageBoxW(L"Error creating new stroke collection.",
                    gc_szAppName, MB_ICONERROR | MB_OK);
    }
}

void CMultiRecoApp::UpdateFilename | ( | WCHAR * | pwsFile = NULL,
 |  | WCHAR * | pwsFileTitle = NULL
 | ) |  |

Definition at line 1520 of file MultiReco.cpp.

{
    // The title that appears in the window's caption bar
    CComBSTR bstrTitle;

    if ((NULL != pwsFile) && (NULL != pwsFileTitle))
    {
        // Copy the strings
        int cbSize = countof(m_wchFile) - 1;
        wcsncpy(m_wchFile, pwsFile, cbSize);
        m_wchFile[cbSize] = 0;
        cbSize = countof(m_wchFileTitle) - 1;
        wcsncpy(m_wchFileTitle, pwsFileTitle, cbSize);
        m_wchFileTitle[cbSize] = 0;
        bstrTitle = m_wchFileTitle;
    }
    else
    {
        m_wchFile[0] = m_wchFileTitle[0] = 0;
        bstrTitle = L"New File";
    }

    // The application's title is combined from the application name and
    // the name of the currently open file
    bstrTitle += L" - ";
    bstrTitle += gc_szAppName;

    // Update the window's caption
    ::SetWindowTextW(m_hWnd, bstrTitle);
}

void CMultiRecoApp::UpdateLayout ( )

Definition at line 1436 of file MultiReco.cpp.

{
    RECT rect;
    GetClientRect(&rect);

    // update the size and position of the status bar
    if (::IsWindow(m_hwndStatusBar)
        && ((DWORD)::GetWindowLong(m_hwndStatusBar, GWL_STYLE) & WS_VISIBLE))
    {
        ::SendMessage(m_hwndStatusBar, WM_SIZE, 0, 0);
        RECT rectStatusBar;
        ::GetWindowRect(m_hwndStatusBar, &rectStatusBar);
        if (rect.bottom > rectStatusBar.bottom - rectStatusBar.top)
        {
            rect.bottom -= rectStatusBar.bottom - rectStatusBar.top;
        }
        else
        {
            rect.bottom = 0;
        }
    }

    // update the size and position of the output window
    if (m_wndResults.IsWindow())
    {
        int cyResultsWnd = 100;
        if (cyResultsWnd > rect.bottom)
        {
            cyResultsWnd = rect.bottom;
        }
        ::SetWindowPos(m_wndResults.m_hWnd, NULL,
                       rect.left, rect.bottom - cyResultsWnd,
                       rect.right - rect.left, cyResultsWnd - rect.top,
                       SWP_NOZORDER | SWP_NOACTIVATE | SWP_SHOWWINDOW);
        rect.bottom -= cyResultsWnd;
    }

    // update the size and position of the ink input window
    if (::IsWindow(m_wndInput.m_hWnd))
    {
        ::SetWindowPos(m_wndInput.m_hWnd, NULL,
                       rect.left, rect.top,
                       rect.right - rect.left, rect.bottom - rect.top,
                       SWP_NOZORDER | SWP_NOACTIVATE | SWP_SHOWWINDOW);
    }
}

void CMultiRecoApp::UpdateStatusBar ( )

Definition at line 1497 of file MultiReco.cpp.

{
    if (::IsWindow(m_hwndStatusBar))
    {
        ::SendMessage(m_hwndStatusBar, SB_SETTEXTW, NULL, (LPARAM)m_bstrCurRecoName.m_str);
    }
}

Member Data Documentation

CComBSTR CMultiRecoApp::m_bstrCurRecoName

Definition at line 70 of file MultiReco.h.

HWND CMultiRecoApp::m_hwndStatusBar

Definition at line 63 of file MultiReco.h.

WORD CMultiRecoApp::m_iColor

Definition at line 79 of file MultiReco.h.

UINT CMultiRecoApp::m_nCmdRecognizer

Definition at line 73 of file MultiReco.h.

CComPtr<IInkCollector> CMultiRecoApp::m_spIInkCollector

Definition at line 51 of file MultiReco.h.

CComPtr<IInkCustomStrokes> CMultiRecoApp::m_spIInkCustomStrokes

Definition at line 54 of file MultiReco.h.

CComPtr<IInkDisp> CMultiRecoApp::m_spIInkDisp

Definition at line 52 of file MultiReco.h.

CComPtr<IInkRecognizerContext> CMultiRecoApp::m_spIInkRecoContext

Definition at line 55 of file MultiReco.h.

CComPtr<IInkRecognizers> CMultiRecoApp::m_spIInkRecognizers

Definition at line 56 of file MultiReco.h.

CComPtr<IInkRecognizerGuide> CMultiRecoApp::m_spIInkRecoGuideBoxed

Definition at line 58 of file MultiReco.h.

CComPtr<IInkRecognizerGuide> CMultiRecoApp::m_spIInkRecoGuideLined

Definition at line 57 of file MultiReco.h.

CComPtr<IInkStrokes> CMultiRecoApp::m_spIInkStrokes

Definition at line 53 of file MultiReco.h.

WCHAR CMultiRecoApp::m_wchFile[MAX_PATH]

Definition at line 75 of file MultiReco.h.

WCHAR CMultiRecoApp::m_wchFileTitle[MAX_PATH]

Definition at line 76 of file MultiReco.h.

CInkInputWnd CMultiRecoApp::m_wndInput

Definition at line 61 of file MultiReco.h.

CRecoOutputWnd CMultiRecoApp::m_wndResults

Definition at line 62 of file MultiReco.h.

const COLORREF CMultiRecoApp::mc_crColors [static]
Initial value:
 {
     RGB( 0, 0, 0), RGB(0xA0,0,0), RGB(0,0xA0,0), RGB(0,0,0xA0),
     RGB(0xA0,0xA0,0), RGB(0xA0,0,0xA0), RGB(0,0xA0,0xA0), RGB(0xA0,0xA0,0xA0)
}

Definition at line 67 of file MultiReco.h.

The documentation for this class was generated from the following files:
  • TabletPC/MultiReco/MultiReco.h
  • TabletPC/MultiReco/MultiReco.cpp
Generated on Wed Nov 13 2024 16:56:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMultiValuedAttributeEditor Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CMultiValuedAttributeEditor Class Reference

#include "util.h"

List of all members.

Public Member Functions

CMultiValuedAttributeEditor (CStringList &strrefAttributeList)
CMultiValuedAttributeEditor (CStringList &strrefAttributeList)
~CMultiValuedAttributeEditor ()
~CMultiValuedAttributeEditor ()
BOOL | Initialize (UINT nEditBox, UINT nListBox, UINT nAddButton, UINT nDeleteButton, CWnd *pParentWnd)
BOOL | Initialize (UINT nEditBox, UINT nListBox, UINT nAddButton, UINT nDeleteButton, CWnd *pParentWnd)
void | OnAddValue ()
void | OnAddValue ()
void | OnDeleteValue ()
void | OnDeleteValue ()
void | OnEditChange ()
void | OnEditChange ()
void | OnValueSelChange ()
void | OnValueSelChange ()

Private Attributes

CAttributeValueAddButton m_AddButton
CAttributeValueDeleteButton m_DeleteButton
CStringList & | m_strrefAttributeList
CAttributeValueEditor m_ValueEditor
CMultiValuedListBox m_ValueList

Detailed Description

Definition at line 134 of file util.h.

Constructor & Destructor Documentation

CMultiValuedAttributeEditor::CMultiValuedAttributeEditor ( CStringList & strrefAttributeList )

Definition at line 120 of file util.cpp.

                                                                                :
  m_ValueEditor(this),
  m_ValueList(this),
  m_AddButton(this),
  m_DeleteButton(this),
  m_strrefAttributeList(strrefAttributeList)

{
}

CMultiValuedAttributeEditor::~CMultiValuedAttributeEditor ( ) [inline]

Definition at line 138 of file util.h.

{}

CMultiValuedAttributeEditor::CMultiValuedAttributeEditor ( CStringList & strrefAttributeList )
CMultiValuedAttributeEditor::~CMultiValuedAttributeEditor ( ) [inline]

Definition at line 118 of file util.h.

{}

Member Function Documentation

BOOL CMultiValuedAttributeEditor::Initialize | ( | UINT | nEditBox,
 |  | UINT | nListBox,
 |  | UINT | nAddButton,
 |  | UINT | nDeleteButton,
 |  | CWnd * | pParentWnd
 | ) |  |

Definition at line 130 of file util.cpp.

{
  BOOL bRes = TRUE;

  //
  // Subclass controls
  //
  bRes = m_ValueEditor.SubclassDlgItem(nEditBox, pParentWnd);
  ASSERT(bRes);
  if (!bRes) return FALSE;

  bRes = m_ValueList.SubclassDlgItem(nListBox, pParentWnd);
  ASSERT(bRes);
  if (!bRes) return FALSE;

  bRes = m_AddButton.SubclassDlgItem(nAddButton, pParentWnd);
  ASSERT(bRes);
  if (!bRes) return FALSE;

  bRes = m_DeleteButton.SubclassDlgItem(nDeleteButton, pParentWnd);
  ASSERT(bRes);
  if (!bRes) return FALSE;

  //
  // Add strings to list box
  //
  POSITION pos = m_strrefAttributeList.GetHeadPosition();
  while (pos != NULL)
  {
    CString szAddString = m_strrefAttributeList.GetNext(pos);
    m_ValueList.AddString(szAddString);
  }
  return bRes;
}

BOOL CMultiValuedAttributeEditor::Initialize | ( | UINT | nEditBox,
 |  | UINT | nListBox,
 |  | UINT | nAddButton,
 |  | UINT | nDeleteButton,
 |  | CWnd * | pParentWnd
 | ) |  |
void CMultiValuedAttributeEditor::OnAddValue ( )

Definition at line 189 of file util.cpp.

{
  CString szNewValue;

  //
  // Retrieve the new value and add it to the data list and list box
  //
  m_ValueEditor.GetWindowText(szNewValue);
  m_strrefAttributeList.AddTail(szNewValue);
  if (m_ValueList.AddString(szNewValue) != LB_ERR)
  {
    m_ValueEditor.SetWindowText(_T(""));
  }

  if (m_ValueList.GetCount() !=0)
  {
    m_DeleteButton.EnableWindow(TRUE);
  }
}

void CMultiValuedAttributeEditor::OnAddValue ( )
void CMultiValuedAttributeEditor::OnDeleteValue ( )

Definition at line 209 of file util.cpp.

{
  //
  // Remove the value from the list box and the data list
  //
  int nSelection = m_ValueList.GetCurSel();
  if (nSelection != LB_ERR)
  {
    m_ValueList.DeleteString(nSelection);

    POSITION pos = m_strrefAttributeList.FindIndex(nSelection);
    if (pos != NULL)
    {
      m_strrefAttributeList.RemoveAt(pos);
    }
  }
  if (m_ValueList.GetCount() == 0)
  {
    m_DeleteButton.EnableWindow(FALSE);
  }
}

void CMultiValuedAttributeEditor::OnDeleteValue ( )
void CMultiValuedAttributeEditor::OnEditChange ( )
void CMultiValuedAttributeEditor::OnEditChange ( )

Definition at line 169 of file util.cpp.

{
  CString szNewValue;

  //
  // Retrieve the new value and enable the add button if it's not empty
  //
  m_ValueEditor.GetWindowText(szNewValue);
  m_AddButton.EnableWindow(!szNewValue.IsEmpty());
}

void CMultiValuedAttributeEditor::OnValueSelChange ( )

Definition at line 180 of file util.cpp.

{
  //
  // Enable the delete button if a value is selected in the list box
  //
  int nSelection = m_ValueList.GetCurSel();
  m_DeleteButton.EnableWindow(nSelection != LB_ERR);
}

void CMultiValuedAttributeEditor::OnValueSelChange ( )

Member Data Documentation

CAttributeValueAddButton CMultiValuedAttributeEditor::m_AddButton [private]

Definition at line 162 of file util.h.

CAttributeValueDeleteButton CMultiValuedAttributeEditor::m_DeleteButton [private]

Definition at line 163 of file util.h.

CStringList & CMultiValuedAttributeEditor::m_strrefAttributeList [private]

Definition at line 155 of file util.h.

CAttributeValueEditor CMultiValuedAttributeEditor::m_ValueEditor [private]

Definition at line 160 of file util.h.

CMultiValuedListBox CMultiValuedAttributeEditor::m_ValueList [private]

Definition at line 161 of file util.h.

The documentation for this class was generated from the following files:
  • NetDS/ADSI/samples/DSUI/scpext/scpproppage/util.h
  • NetDS/ADSI/samples/DSUI/scpext/scpwizard/util.h
  • NetDS/ADSI/samples/DSUI/scpext/scpproppage/util.cpp
  • NetDS/ADSI/samples/DSUI/scpext/scpwizard/util.cpp
Generated on Wed Nov 13 2024 16:56:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMultiValuedListBox Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CMultiValuedListBox Class Reference

#include "util.h"

List of all members.

Public Member Functions

CMultiValuedListBox (CMultiValuedAttributeEditor *pEditor)
CMultiValuedListBox (CMultiValuedAttributeEditor *pEditor)
~CMultiValuedListBox ()
~CMultiValuedListBox ()
afx_msg BOOL | OnSelChange ()
afx_msg BOOL | OnSelChange ()

Protected Attributes

CMultiValuedAttributeEditor * m_pEditor

Detailed Description

Definition at line 50 of file util.h.

Constructor & Destructor Documentation

CMultiValuedListBox::CMultiValuedListBox ( CMultiValuedAttributeEditor * pEditor ) [inline]

Definition at line 53 of file util.h.

  {
    ASSERT(pEditor != NULL);
    m_pEditor = pEditor;
  }

CMultiValuedListBox::~CMultiValuedListBox ( ) [inline]

Definition at line 59 of file util.h.

{}

CMultiValuedListBox::CMultiValuedListBox ( CMultiValuedAttributeEditor * pEditor ) [inline]

Definition at line 54 of file util.h.

  {
    ASSERT(pEditor != NULL);
    m_pEditor = pEditor;
  }

CMultiValuedListBox::~CMultiValuedListBox ( ) [inline]

Definition at line 60 of file util.h.

{}

Member Function Documentation

BOOL CMultiValuedListBox::OnSelChange ( )

Definition at line 72 of file util.cpp.

{
  //
  // Let the editor handle the message
  //
  m_pEditor->OnValueSelChange();
  return FALSE;
}

afx_msg BOOL CMultiValuedListBox::OnSelChange ( )

Member Data Documentation

CMultiValuedAttributeEditor * CMultiValuedListBox::m_pEditor [protected]

Definition at line 64 of file util.h.

The documentation for this class was generated from the following files:
  • NetDS/ADSI/samples/DSUI/scpext/scpproppage/util.h
  • NetDS/ADSI/samples/DSUI/scpext/scpwizard/util.h
  • NetDS/ADSI/samples/DSUI/scpext/scpproppage/util.cpp
  • NetDS/ADSI/samples/DSUI/scpext/scpwizard/util.cpp
Generated on Wed Nov 13 2024 16:56:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMyCapabilities Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Private Attributes

CMyCapabilities Class Reference

#include "MyCapabilities.h"

List of all members.

Public Member Functions

STDMETHOD() | CanNodeBeClustered (void)
STDMETHOD() | Initialize (IUnknown *punkCallbackIn, LCID lcidIn)

Protected Member Functions

CMyCapabilities (void)
~CMyCapabilities (void)
HRESULT | HrGetApplicationCompatibilityInfo (BOOL *pfIsAppCompatible)

Private Attributes

LCID | m_lcid
IClusCfgCallback * | m_piccCallback

Detailed Description

Definition at line 46 of file MyCapabilities.h.

Constructor & Destructor Documentation

CMyCapabilities::CMyCapabilities ( void ) [protected]

Definition at line 49 of file MyCapabilities.cpp.

    : m_lcid( LOCALE_NEUTRAL )
    , m_piccCallback( NULL )
{
} //*** CMyCapabilities::CMyCapabilities

CMyCapabilities::~CMyCapabilities ( void ) [protected]

Definition at line 71 of file MyCapabilities.cpp.

{
    // Release the callback interface
    if ( m_piccCallback != NULL )
    {
        m_piccCallback->Release();
    } // if: the callback interface pointer is not NULL

} //*** CMyCapabilities::~CMyCapabilities

Member Function Documentation

STDMETHODIMP CMyCapabilities::CanNodeBeClustered ( void )

Definition at line 145 of file MyCapabilities.cpp.

{
    HRESULT hr = S_OK;
    HRESULT hrCompatibilityInfo = S_OK;
    BOOL    fIsAppCompatible = FALSE;

    //
    // Determine if application is compatible.
    //
    hrCompatibilityInfo = HrGetApplicationCompatibilityInfo( &fIsAppCompatible );
    if ( hrCompatibilityInfo == S_OK )
    {
        if ( fIsAppCompatible == FALSE )
        {
            //
            // The application is not compatible with clustering.
            // Display a warning message in the user interface
            // to alert the user to this condition.
            //
            hr = m_piccCallback->SendStatusReport(
                      NULL      // Sender's node name (filled in by server)
                    , TASKID_Major_Check_Cluster_Feasibility
                    , TASKID_Minor_MyApp_Compat_Info
                    , 0         // ulMinIn
                    , 1         // ulMaxIn
                    , 1         // ulCurrentIn
#if defined( ALLOW_FAIL )
                    , HRESULT_FROM_WIN32( ERROR_NODE_CANNOT_BE_CLUSTERED ) // generates an error (red "x")
#else
                    , S_FALSE   // S_FALSE generates only a warning in the wizard
#endif
                    , L"MyCapabilities message: My application is not compatible with the Cluster Service."
                    , NULL      // pftTimeIn (filled in by server)
                    , NULL      // pcszReferenceIn
                    );
            if ( FAILED( hr ) )
            {
                goto Cleanup;
            } // if:

#if defined( ALLOW_FAIL )
            hr = S_FALSE; // if ALLOW_FAIL is defined we return S_FALSE to error out.
            goto Cleanup;
#endif
        } // if: app is not compatible with clustering
    } // if: no error getting application compatibility info
    else
    {
        //
        // An error occurred getting application compatibility info.
        // Display an error message in the user interface to alert the
        // user to this condition.
        //

        hr = m_piccCallback->SendStatusReport(
                  NULL      // Sender's node name (filled in by server)
                , TASKID_Major_Check_Cluster_Feasibility
                , TASKID_Minor_MyApp_Compat_Info
                , 0         // ulMinIn
                , 1         // ulMaxIn
                , 1         // ulCurrentIn
                , hr
                , L"MyCapabilities message: Could not determine whether my application is compatible with the Cluster Service or not."
                , NULL      // pftTimeIn (filled in by server)
                , NULL      // pcszReferenceIn
                );

        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:

    } // else: error getting application compatibility info.

Cleanup:

    //
    //  If we only want to warn the user, we can re-set hr to S_OK to allow
    //  this node to be clustered anyway, regardless of whether or not this
    //  application is cluster-aware.
    //
#if ! defined( ALLOW_FAIL )
    hr = S_OK;
#endif

    return hr;

} //*** CMyCapabilities::CanNodeBeClustered

HRESULT CMyCapabilities::HrGetApplicationCompatibilityInfo ( BOOL * pfIsAppCompatible ) [protected]

Definition at line 99 of file MyCapabilities.cpp.

{
    assert( pfIsAppCompatible != NULL );

    //
    // TODO: Add decision logic here
    //
    *pfIsAppCompatible = FALSE;

    return S_OK;

} //*** CMyCapabilities::HrGetApplicationCompatibilityInfo

STDMETHODIMP CMyCapabilities::Initialize | ( | IUnknown * | punkCallbackIn,
 |  | LCID | lcidIn
 | ) |  |

Definition at line 267 of file MyCapabilities.cpp.

{
    HRESULT hr = S_OK;

    m_lcid = lcidIn;

    if ( m_piccCallback != NULL )
    {
        //
        // Release the callback interface
        //
        m_piccCallback->Release();
        m_piccCallback = NULL;
    } // if: the callback interface pointer is not NULL

    if ( punkCallbackIn != NULL )
    {
        //
        // Query for the IClusCfgCallback interface.
        //
        hr = punkCallbackIn->QueryInterface( __uuidof( IClusCfgCallback ), reinterpret_cast< void ** > ( &m_piccCallback ) );
    } // if: the callback punk is not NULL.
    else
    {
        hr = E_POINTER;
    } // else: the callback punk is NULL.

    return hr;

} //*** CMyCapabilities::Initialize

Member Data Documentation

LCID CMyCapabilities::m_lcid [private]

Definition at line 56 of file MyCapabilities.h.

IClusCfgCallback* CMyCapabilities::m_piccCallback [private]

Definition at line 61 of file MyCapabilities.h.

The documentation for this class was generated from the following files:
  • WinBase/Cluster/Win2003/MyCapabilities/MyCapabilities.h
  • WinBase/Cluster/Win2003/MyCapabilities/MyCapabilities.cpp
Generated on Wed Nov 13 2024 16:56:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMyEventProvider Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes

CMyEventProvider Class Reference

#include "EvProv.h"

List of all members.

Public Types

enum | { Pending, Running, PendingStop, Stopped }

Public Member Functions

CMyEventProvider ()
~CMyEventProvider ()
HRESULT STDMETHODCALLTYPE | AccessCheck (WBEM_CWSTR wszQueryLanguage, WBEM_CWSTR wszQuery, long lSidLength, const BYTE *pSid)
HRESULT STDMETHODCALLTYPE | Initialize (LPWSTR pszUser, LONG lFlags, LPWSTR pszNamespace, LPWSTR pszLocale, IWbemServices __RPC_FAR *pNamespace, IWbemContext __RPC_FAR *pCtx, IWbemProviderInitSink __RPC_FAR *pInitSink)
HRESULT STDMETHODCALLTYPE | ProvideEvents (IWbemObjectSink __RPC_FAR *pSink, long lFlags)
STDMETHODIMP | QueryInterface (REFIID, LPVOID *)
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP_ (ULONG) Release(void)

Private Member Functions

HRESULT | CheckAccess (SECURITY_DESCRIPTOR *a_SecurityDescriptor, DWORD a_Access, GENERIC_MAPPING *a_Mapping)
void | InstanceThread ()

Static Private Member Functions

static DWORD WINAPI | EventThread (LPVOID pArg)

Private Attributes

ULONG m_cRef
int | m_eStatus
HANDLE m_hThread
IWbemClassObject * | m_pEventClassDef
IWbemServices * | m_pNs
IWbemObjectSink * | m_pSink

Detailed Description

Definition at line 28 of file EvProv.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
Pending
Running
PendingStop
Stopped

Definition at line 47 of file EvProv.h.

{ Pending, Running, PendingStop, Stopped };

Constructor & Destructor Documentation

CMyEventProvider::CMyEventProvider ( )

Definition at line 46 of file EvProv.Cpp.

{
    m_pNs = 0;
    m_pSink = 0;
    m_cRef = 0;
    m_pEventClassDef = 0;
    m_eStatus = Pending;
    m_hThread = 0;
}

CMyEventProvider::~CMyEventProvider ( )

Definition at line 62 of file EvProv.Cpp.

{
    if (m_hThread)
        CloseHandle(m_hThread);

    if (m_pNs)
        m_pNs->Release();

    if (m_pSink)
        m_pSink->Release();

    if (m_pEventClassDef)
        m_pEventClassDef->Release();
}

Member Function Documentation

HRESULT CMyEventProvider::AccessCheck | ( | WBEM_CWSTR | wszQueryLanguage,
 |  | WBEM_CWSTR | wszQuery,
 |  | long | lSidLength,
 |  | const BYTE * | pSid
 | ) |  |

Definition at line 339 of file EvProv.Cpp.

{

  HRESULT hr = WBEM_S_NO_ERROR;

  //this is a temporary subscription, and therefore we have the thread token

  //Grant access for built-in admins, local system, local admins, local service and network service.
  PSECURITY_DESCRIPTOR secDescriptor = NULL;
  BOOL bRes = ConvertStringSecurityDescriptorToSecurityDescriptor //this function is only available on Windows 2000 and above
    ( "O:BAG:BAD:(A;;0x10000001;;;BA)(A;;0x10000001;;;SY)(A;;0x10000001;;;LA)(A;;0x10000001;;;SY)(A;;0x10000001;;;S-1-5-20)(A;;0x10000001;;;S-1-5-19)",
    SDDL_REVISION_1,
    (PSECURITY_DESCRIPTOR *) &secDescriptor,
    NULL);

  if (! bRes)
  {
    return WBEM_E_ACCESS_DENIED;
  }

  if (pSid == NULL)
  {

    hr = CoImpersonateClient () ;
    if ( FAILED ( hr ) )
    {
      LocalFree(secDescriptor);
      return WBEM_E_ACCESS_DENIED ;
    }

    // perform an access check.

    hr = CheckAccess((SECURITY_DESCRIPTOR *)secDescriptor,
              MASK_CLIENT_ACCESS_BIND,
              &s_ClientAccessMapping);

    LocalFree(secDescriptor);

    //  Revert before we perform any operations
    CoRevertToSelf () ;

    if (FAILED(hr))
      return WBEM_E_ACCESS_DENIED;
    else
      return WBEM_S_NO_ERROR;
  }
  else
  {
    //check against the SID passed to us. This op

    // Call GetSecurityDescriptorDacl() to obtain the DACL for secDescriptor.
    // Then, retrieve the access mask corresponding to permissions granted
    // by DACL to account denoted in pSid.  Please refer to Security SDK samples
    // and documentation for more details.

    LocalFree(secDescriptor);

        if(0) //pSID is not privileged enough to receive events from this proviuder
            return WBEM_E_ACCESS_DENIED;
    else
      return WBEM_S_NO_ERROR;

  }

  return WBEM_S_NO_ERROR;
}

HRESULT CMyEventProvider::CheckAccess | ( | SECURITY_DESCRIPTOR * | a_SecurityDescriptor,
 |  | DWORD | a_Access,
 |  | GENERIC_MAPPING * | a_Mapping |
 | ) |  |  | [private]

Definition at line 424 of file EvProv.Cpp.

{
  HRESULT t_Result = S_OK ;

  HANDLE t_Token = NULL ;

  BOOL t_Status = OpenThreadToken (

    GetCurrentThread () ,
    TOKEN_QUERY ,
    TRUE ,
    & t_Token
  ) ;

  DWORD t_LastError = GetLastError () ;
  if ( ! t_Status)
  {
    //the thread token should always be available

    if ( t_LastError ==E_ACCESSDENIED)
      return  WBEM_E_ACCESS_DENIED ;
    else
      return WBEM_E_FAILED ;

  }

  DWORD t_Access = 0 ;
  BOOL t_AccessStatus = FALSE ;
  PRIVILEGE_SET *t_PrivilegeSet = NULL ;
  DWORD t_PrivilegeSetSize = 0 ;

  MapGenericMask (

    & a_Access ,
    a_Mapping
  ) ;

  t_Status = ::AccessCheck (

    a_SecurityDescriptor ,
    t_Token,
    a_Access ,
    a_Mapping ,
    NULL ,
    & t_PrivilegeSetSize ,
    & t_Access ,
    & t_AccessStatus
  ) ;

  if (!t_Status || !t_AccessStatus )
  {
    DWORD t_LastError = GetLastError () ;
    if ( t_LastError == ERROR_INSUFFICIENT_BUFFER )
    {
      t_PrivilegeSet = ( PRIVILEGE_SET * ) new BYTE [ t_PrivilegeSetSize ] ;
      if ( t_PrivilegeSet )
      {
        t_Status = ::AccessCheck (
          a_SecurityDescriptor ,
          t_Token,
          a_Access ,
          a_Mapping ,
          t_PrivilegeSet ,
          & t_PrivilegeSetSize ,
          & t_Access ,
          & t_AccessStatus
        ) ;

        if ( !t_Status || !t_AccessStatus )
        {
          t_Result = WBEM_E_ACCESS_DENIED ;
        }

        delete [] ( BYTE * ) t_PrivilegeSet ;
      }
      else
      {
        t_Result = WBEM_E_OUT_OF_MEMORY ;
      }
    }
    else
    {
      t_Result = WBEM_E_ACCESS_DENIED;
    }

  }

  CloseHandle ( t_Token ) ;

  return t_Result ;
}

DWORD WINAPI CMyEventProvider::EventThread ( LPVOID pArg ) [static, private]

Definition at line 188 of file EvProv.Cpp.

{
    // Make transition to the per-instance method.
    // ===========================================

    ((CMyEventProvider *)pArg)->InstanceThread();
    return 0;
}

HRESULT CMyEventProvider::Initialize | ( | LPWSTR | pszUser,
 |  | LONG | lFlags,
 |  | LPWSTR | pszNamespace,
 |  | LPWSTR | pszLocale,
 |  | IWbemServices __RPC_FAR * | pNamespace,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemProviderInitSink __RPC_FAR * | pInitSink
 | ) |  |

Definition at line 281 of file EvProv.Cpp.

{
    // We don't care about most of the incoming parameters in this
    // simple sample.  However, we will save the namespace pointer
    // and get our event class definition.
    // ===========================================================
    if(! pNamespace)
  {
      pInitSink->SetStatus(WBEM_E_FAILED , 0);
      return WBEM_NO_ERROR;
  }

  m_pNs = pNamespace;
  m_pNs->AddRef();

    // Grab the class definition for the event.
    // ======================================

    IWbemClassObject *pObj = 0;

    HRESULT hRes = m_pNs->GetObject(
        CBSTR(EVENTCLASS),
        0,
        pCtx,
        &pObj,
        0
        );

    if (hRes != 0)
  {
      pInitSink->SetStatus(WBEM_E_FAILED , 0);
      return WBEM_NO_ERROR;
  }

    m_pEventClassDef = pObj;

    // Tell CIMOM that we're up and running.
    // =====================================

    pInitSink->SetStatus(WBEM_S_INITIALIZED,0);

    return WBEM_NO_ERROR;
}

void CMyEventProvider::InstanceThread ( ) [private]

Definition at line 204 of file EvProv.Cpp.

{
    int nIteration = 0;

    CoInitializeEx(NULL, COINIT_MULTITHREADED);

    m_eStatus = Running;

    while (m_eStatus == Running)
    {
        Sleep(2000);    // Provide an event every two seconds

        // Generate a new event object.
        // ============================

        IWbemClassObject *pEvt = 0;

        HRESULT hRes = m_pEventClassDef->SpawnInstance(0, &pEvt);
        if (hRes != 0)
            continue;   // Failed

        // Generate some values to put in the event.
        // =========================================

        wchar_t Buf[128];
    StringCbPrintfW(Buf, sizeof(Buf), L"Test Event <%d>", nIteration);

        CVARIANT vName(Buf);
        hRes = pEvt->Put(CBSTR(L"Name"), 0, vName, 0);
    if (FAILED(hRes))
        {
            // If here, delivery failed.  This could be due to an out of memory condition.
      // Do something to report it.
    }

        CVARIANT vCount((LONG) nIteration);
        hRes = pEvt->Put(CBSTR(L"Value"), 0, vCount, 0);
    if (FAILED(hRes))
        {
            // If here, delivery failed.  This could be due to an out of memory condition.
      // Do something to report it.
    }

        // Deliver the event to CIMOM.
        // ============================

        hRes = m_pSink->Indicate(1, &pEvt);

        if (FAILED(hRes))
        {
            // If here, delivery failed.  Do something to report it.
        }

        pEvt->Release();
        nIteration++;
    }

    // When we get to here, we are no longer interested in the
    // provider and Release() has long since returned.

    m_eStatus = Stopped;
    delete this;
}

HRESULT CMyEventProvider::ProvideEvents | ( | IWbemObjectSink __RPC_FAR * | pSink,
 |  | long | lFlags
 | ) |  |

Definition at line 142 of file EvProv.Cpp.

{
    // Copy the sink.
    // ==============

    m_pSink = pSink;
    m_pSink->AddRef();

    // Create the event thread.
    // ========================

    DWORD dwTID;

    m_hThread = CreateThread(
        0,
        0,
        CMyEventProvider::EventThread,
        this,
        0,
        &dwTID
        );

    // Wait for provider to be 'ready'.
    // ================================

    while (m_eStatus != Running)
        Sleep(100);

    return WBEM_NO_ERROR;
}

STDMETHODIMP CMyEventProvider::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 83 of file EvProv.Cpp.

{
    *ppv = 0;

    if (IID_IUnknown==riid || IID_IWbemEventProvider==riid)
    {
        *ppv = (IWbemEventProvider *) this;
        AddRef();
        return NOERROR;
    }

    if (IID_IWbemProviderInit==riid)
    {
        *ppv = (IWbemProviderInit *) this;
        AddRef();
        return NOERROR;
    }

    return E_NOINTERFACE;
}

CMyEventProvider::STDMETHODIMP_ ( ULONG )
CMyEventProvider::STDMETHODIMP_ ( ULONG )

Member Data Documentation

ULONG CMyEventProvider::m_cRef [private]

Definition at line 30 of file EvProv.h.

int CMyEventProvider::m_eStatus [private]

Definition at line 34 of file EvProv.h.

HANDLE CMyEventProvider::m_hThread [private]

Definition at line 35 of file EvProv.h.

IWbemClassObject* CMyEventProvider::m_pEventClassDef [private]

Definition at line 33 of file EvProv.h.

IWbemServices* CMyEventProvider::m_pNs [private]

Definition at line 31 of file EvProv.h.

IWbemObjectSink* CMyEventProvider::m_pSink [private]

Definition at line 32 of file EvProv.h.

The documentation for this class was generated from the following files:
  • SysMgmt/WMI/VC/EventProvider/EvProv.h
  • SysMgmt/WMI/VC/EventProvider/EvProv.Cpp
Generated on Wed Nov 13 2024 16:56:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMyEvictListener Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Private Attributes

CMyEvictListener Class Reference

#include "MyEvictListener.h"

List of all members.

Public Member Functions

STDMETHOD() | EvictNotify (LPCWSTR pcszNodeNameIn)
STDMETHOD() | Initialize (IUnknown *punkCallbackIn, LCID lcidIn)

Protected Member Functions

CMyEvictListener (void)
~CMyEvictListener (void)

Private Attributes

LCID | m_lcid
IClusCfgCallback * | m_piccCallback

Detailed Description

Definition at line 42 of file MyEvictListener.h.

Constructor & Destructor Documentation

CMyEvictListener::CMyEvictListener ( void ) [protected]

Definition at line 30 of file MyEvictListener.cpp.

    : m_lcid( LOCALE_NEUTRAL )
    , m_piccCallback( NULL )
{
} //*** CMyEvictListener::CMyEvictListener

CMyEvictListener::~CMyEvictListener ( void ) [protected]

Definition at line 52 of file MyEvictListener.cpp.

{
    // Release the callback interface
    if ( m_piccCallback != NULL )
    {
        m_piccCallback->Release();
    } // if: the callback interface pointer is not NULL

} //*** CMyEvictListener::~CMyEvictListener

Member Function Documentation

STDMETHODIMP CMyEvictListener::EvictNotify ( LPCWSTR pcszNodeNameIn )

Definition at line 92 of file MyEvictListener.cpp.

{
    //
    // TODO: Modify this code to perform your tasks.
    //

    HRESULT         hr = S_OK;
    WCHAR           szMessage[256];

    hr = StringCchPrintfW(
              szMessage
            , RTL_NUMBER_OF( szMessage )
            , L"MyEvictListener Message: Node '%ws' has been evicted from the cluster."
            , pcszNodeNameIn == NULL ? L"<null>" : pcszNodeNameIn
            );

    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if: StringCchPrintW failed

    if ( m_piccCallback != NULL )
    {
        //
        // Log a message to client and server log file informing that a node
        // has been evicted from the cluster.
        //
        hr = m_piccCallback->SendStatusReport(
                  NULL      // pcszNodeNameIn - Filled in by cluster config server.
                , TASKID_Major_Client_And_Server_Log
                , IID_NULL
                , 0         // ulMinIn
                , 1         // ulMaxIn
                , 1         // ulCurrentIn
                , hr
                , szMessage
                , NULL      // pftTimeIn - Filled in by cluster config server.
                , NULL      // bstrReferenceIn
                );

        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:
    } //if: the callback interface pointer is not NULL

 Cleanup:

    return hr;

} //*** CMyEvictListener::EvictNotify

STDMETHODIMP CMyEvictListener::Initialize | ( | IUnknown * | punkCallbackIn,
 |  | LCID | lcidIn
 | ) |  |

Definition at line 180 of file MyEvictListener.cpp.

{
    HRESULT hr = S_OK;

    m_lcid = lcidIn;

    if ( m_piccCallback != NULL )
    {
        //
        // Release the callback interface
        //
        m_piccCallback->Release();
        m_piccCallback = NULL;
    } // if: the callback interface pointer is not NULL

    if ( punkCallbackIn != NULL )
    {
        //
        // Query for the IClusCfgCallback interface.
        //
        hr = punkCallbackIn->QueryInterface( __uuidof( IClusCfgCallback ), reinterpret_cast< void ** > ( &m_piccCallback ) );
    } // if: the callback punk is not NULL.
    else
    {
        hr = E_POINTER;
    } // else: the callback punk is NULL.

    return hr;

} //*** CMyEvictListener::Initialize

Member Data Documentation

LCID CMyEvictListener::m_lcid [private]

Definition at line 52 of file MyEvictListener.h.

IClusCfgCallback* CMyEvictListener::m_piccCallback [private]

Definition at line 57 of file MyEvictListener.h.

The documentation for this class was generated from the following files:
  • WinBase/Cluster/Win2003/MyEvictListener/MyEvictListener.h
  • WinBase/Cluster/Win2003/MyEvictListener/MyEvictListener.cpp
Generated on Wed Nov 13 2024 16:56:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMyInkCollector Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CMyInkCollector Class Reference

#include "EventSink.h"

List of all members.

Public Member Functions

CMyInkCollector ()
~CMyInkCollector ()
HRESULT | Init (HWND hWnd)

Private Attributes

CMyInkEvents m_InkEvents
IInkCollector * | m_pInkCollector

Detailed Description

Definition at line 82 of file EventSink.h.

Constructor & Destructor Documentation

CMyInkCollector::CMyInkCollector ( ) [inline]

Definition at line 87 of file EventSink.h.

    {
        m_pInkCollector = NULL;
    }

CMyInkCollector::~CMyInkCollector ( ) [inline]

Definition at line 94 of file EventSink.h.

    {
        if (m_pInkCollector != NULL)
        {
            m_InkEvents.UnadviseInkCollector();
            m_pInkCollector->put_Enabled(VARIANT_FALSE);
            m_pInkCollector->Release();
        }
    }

Member Function Documentation

HRESULT CMyInkCollector::Init ( HWND hWnd ) [inline]

Definition at line 105 of file EventSink.h.

    {
        // Initialize event sink. This consists of setting
        //  up the free threaded marshaler.
        HRESULT hr = m_InkEvents.Init(hWnd);

        if (FAILED(hr))
        {
            return hr;
        }

        // Create the ink collector
        hr = CoCreateInstance(CLSID_InkCollector, NULL, CLSCTX_ALL,
            IID_IInkCollector, (void **) &m_pInkCollector);

        if (FAILED(hr))
        {
            return hr;
        }

        // Since this sample only handles the Stroke event, it is
        // not necessary to set the event interest (Stroke, CursorInRange,
        // CursorOutOfRange are the only event interests that are on by
        // default).  In order to handle an event that is not on by default,
        // it is necessary to set the event interest at this point.  The
        // following code illustrates how to listen for the NewPackets
        // event:
        //
        //hr = m_pInkCollector->SetEventInterest(ICEI_NewPackets, VARIANT_TRUE);
        //
        //if (FAILED(hr))
        //{
        //    return hr;
        //}

        // Set up connection between Ink Collector and our event sink
        hr = m_InkEvents.AdviseInkCollector(m_pInkCollector);

        if (FAILED(hr))
        {
            return hr;
        }

        // Attach Ink Collector to window
        hr = m_pInkCollector->put_hWnd((long) hWnd);

        if (FAILED(hr))
        {
            return hr;
        }

        // Allow Ink Collector to receive input.
        return m_pInkCollector->put_Enabled(VARIANT_TRUE);
    }

Member Data Documentation

CMyInkEvents CMyInkCollector::m_InkEvents [private]

Definition at line 165 of file EventSink.h.

IInkCollector* CMyInkCollector::m_pInkCollector [private]

Definition at line 163 of file EventSink.h.

The documentation for this class was generated from the following file:
  • TabletPC/EventSink/EventSink.h
Generated on Wed Nov 13 2024 16:56:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMyInkEvents Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CMyInkEvents Class Reference

#include "EventSink.h"

Inherits InkCollectorEvents.

List of all members.

Public Member Functions

CMyInkEvents ()
HRESULT | Init (HWND hWnd)
virtual void | Stroke (IInkCursor *Cursor, IInkStrokeDisp *Stroke, VARIANT_BOOL *Cancel)

Public Attributes

HWND | m_hWnd

Detailed Description

Definition at line 44 of file EventSink.h.

Constructor & Destructor Documentation

CMyInkEvents::CMyInkEvents ( ) [inline]

Definition at line 58 of file EventSink.h.

    {
        m_hWnd = NULL;
    }

Member Function Documentation

HRESULT CMyInkEvents::Init ( HWND hWnd ) [inline]

Definition at line 63 of file EventSink.h.

    {
        m_hWnd = hWnd;
        return InkCollectorEvents::Init();
    }

virtual void CMyInkEvents::Stroke | ( | IInkCursor * | Cursor,
 |  | IInkStrokeDisp * | Stroke,
 |  | VARIANT_BOOL * | Cancel |
 | ) |  |  | [inline, virtual]

Reimplemented from InkCollectorEvents.

Definition at line 49 of file EventSink.h.

    {
        // Demonstrate that we received the event notification.
        MessageBox(m_hWnd, TEXT("Stroke Event"), TEXT("Event Received"), MB_OK);
    }

Member Data Documentation

HWND CMyInkEvents::m_hWnd

Definition at line 70 of file EventSink.h.

The documentation for this class was generated from the following file:
  • TabletPC/EventSink/EventSink.h
Generated on Wed Nov 13 2024 16:56:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMyMemberSetChangeListener Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Private Attributes

CMyMemberSetChangeListener Class Reference

#include "MyMemberSetChangeListener.h"

List of all members.

Public Member Functions

STDMETHOD() | Initialize (IUnknown *punkCallbackIn, LCID lcidIn)
STDMETHOD() | Notify (IUnknown *punkIn)

Protected Member Functions

CMyMemberSetChangeListener (void)
~CMyMemberSetChangeListener (void)

Private Attributes

LCID | m_lcid
IClusCfgCallback * | m_piccCallback

Detailed Description

Definition at line 47 of file MyMemberSetChangeListener.h.

Constructor & Destructor Documentation

CMyMemberSetChangeListener::CMyMemberSetChangeListener ( void ) [protected]

Definition at line 30 of file MyMemberSetChangeListener.cpp.

    : m_lcid( LOCALE_NEUTRAL )
    , m_piccCallback( NULL )
{
} //*** CMyMemberSetChangeListener::CMyMemberSetChangeListener

CMyMemberSetChangeListener::~CMyMemberSetChangeListener ( void ) [protected]

Definition at line 52 of file MyMemberSetChangeListener.cpp.

{
    // Release the callback interface
    if ( m_piccCallback != NULL )
    {
        m_piccCallback->Release();
    } // if: the callback interface pointer is not NULL

} //*** CMyMemberSetChangeListener::~CMyMemberSetChangeListener

Member Function Documentation

STDMETHODIMP CMyMemberSetChangeListener::Initialize | ( | IUnknown * | punkCallbackIn,
 |  | LCID | lcidIn
 | ) |  |

Definition at line 171 of file MyMemberSetChangeListener.cpp.

{
    HRESULT hr = S_OK;

    m_lcid = lcidIn;

    if ( m_piccCallback != NULL )
    {
        //
        // Release the callback interface
        //
        m_piccCallback->Release();
        m_piccCallback = NULL;
    } // if: the callback interface pointer is not NULL

    if ( punkCallbackIn != NULL )
    {
        //
        // Query for the IClusCfgCallback interface.
        //
        hr = punkCallbackIn->QueryInterface( __uuidof( IClusCfgCallback ), reinterpret_cast< void ** > ( &m_piccCallback ) );
    } // if: the callback punk is not NULL.
    else
    {
        hr = E_POINTER;
    } // else: the callback punk is NULL.

    return hr;

} //*** CMyMemberSetChangeListener::Initialize

STDMETHODIMP CMyMemberSetChangeListener::Notify ( IUnknown * punkIn )

Definition at line 93 of file MyMemberSetChangeListener.cpp.

{
     //
    // TODO: Modify this code to perform your tasks.
    //

    HRESULT                 hr = S_OK;
    WCHAR                   szMessage[] = L"MyMemberSetChangeListener Message: There has been a member set change in this cluster.";

    UNREFERENCED_PARAMETER( punkIn );

    if ( m_piccCallback != NULL )
    {
        //
        // Log a message to client and server log file informing that there has
        // been a member set change in this cluster.
        //
        hr = m_piccCallback->SendStatusReport(
                  NULL      // pcszNodeNameIn - Filled in by cluster config server.
                , TASKID_Major_Configure_Resources
                , TASKID_Minor_MyMemberSetChange_Info
                , 0         // ulMinIn
                , 1         // ulMaxIn
                , 1         // ulCurrentIn
                , hr
                , szMessage
                , NULL      // pftTimeIn - Filled in by cluster config server.
                , NULL      // bstrReferenceIn
                );

        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:
    } //if: the callback interface pointer is not NULL

Cleanup:

    return hr;

} //*** CMyMemberSetChangeListener::Notify

Member Data Documentation

LCID CMyMemberSetChangeListener::m_lcid [private]

Definition at line 57 of file MyMemberSetChangeListener.h.

IClusCfgCallback* CMyMemberSetChangeListener::m_piccCallback [private]

Definition at line 62 of file MyMemberSetChangeListener.h.

The documentation for this class was generated from the following files:
  • WinBase/Cluster/Win2003/MyMemberSetChangeListener/MyMemberSetChangeListener.h
  • WinBase/Cluster/Win2003/MyMemberSetChangeListener/MyMemberSetChangeListener.cpp
Generated on Wed Nov 13 2024 16:56:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMySink Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CMySink Class Reference

List of all members.

Public Member Functions

CMySink ()
~CMySink ()
virtual HRESULT STDMETHODCALLTYPE | Indicate (long lObjectCount, IWbemClassObject __RPC_FAR *__RPC_FAR *ppObjArray)
STDMETHODIMP | QueryInterface (REFIID, LPVOID *)
virtual HRESULT STDMETHODCALLTYPE | SetStatus (long lFlags, HRESULT hResult, BSTR strParam, IWbemClassObject __RPC_FAR *pObjParam)
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) AddRef(void)

Private Attributes

UINT m_cRef

Detailed Description

Definition at line 30 of file Consumer.Cpp.

Constructor & Destructor Documentation

CMySink::CMySink ( ) [inline]

Definition at line 28 of file Consumer.Cpp.

: public IWbemObjectSink

CMySink::~CMySink ( ) [inline]

Definition at line 29 of file Consumer.Cpp.

: public IWbemObjectSink

Member Function Documentation

HRESULT CMySink::Indicate | ( | long | lObjectCount,
 |  | IWbemClassObject __RPC_FAR *__RPC_FAR * | ppObjArray |
 | ) |  |  | [virtual]

Definition at line 104 of file Consumer.Cpp.

{
    printf("Indicate called with %d object(s)\n", lObjectCount);

    // Get the info from the object.
    // =============================

    for (long i = 0; i < lObjectCount; i++)
    {
        IWbemClassObject *pObj = ppObjArray[i];

        // If here, we know the object is one of the kind we asked for.
        // ============================================================

        CVARIANT vName;
        HRESULT hr = pObj->Get(CBSTR(L"Name"), 0, &vName, 0, 0);
    if (FAILED(hr))
    {
      //could fail due to out of memory condition (CBSTR constructor failed
      //to allocate internal BSTR)
    }
        CVARIANT vValue;
        hr = pObj->Get(CBSTR(L"Value"), 0, &vValue, 0, 0);
    if (FAILED(hr))
    {
      //could fail due to out of memory condition (CBSTR constructor failed
      //to allocate internal BSTR)
    }

        printf("Event info %S %u\n", vName.GetStr(), vValue.GetLONG());
    }

    return WBEM_NO_ERROR;
}

STDMETHODIMP CMySink::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 63 of file Consumer.Cpp.

{
    *ppv = 0;

    if (IID_IUnknown==riid || IID_IWbemObjectSink == riid)
    {
        *ppv = (IWbemObjectSink *) this;
        AddRef();
        return NOERROR;
    }

    return E_NOINTERFACE;
}

HRESULT CMySink::SetStatus | ( | long | lFlags,
 |  | HRESULT | hResult,
 |  | BSTR | strParam,
 |  | IWbemClassObject __RPC_FAR * | pObjParam |
 | ) |  |  | [virtual]

Definition at line 147 of file Consumer.Cpp.

{
    // Not called during event delivery.

    return WBEM_NO_ERROR;
}

CMySink::STDMETHODIMP_ ( ULONG )
CMySink::STDMETHODIMP_ ( ULONG )

Member Data Documentation

UINT CMySink::m_cRef [private]

Definition at line 25 of file Consumer.Cpp.

The documentation for this class was generated from the following file:
  • SysMgmt/WMI/VC/TempConsumer/Consumer.Cpp
Generated on Wed Nov 13 2024 16:56:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMyStartupListener Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Private Attributes

CMyStartupListener Class Reference

#include "MyStartupListener.h"

List of all members.

Public Member Functions

STDMETHOD() | Initialize (IUnknown *punkCallbackIn, LCID lcidIn)
STDMETHOD() | Notify (IUnknown *punkIn)

Protected Member Functions

CMyStartupListener (void)
~CMyStartupListener (void)

Private Attributes

LCID | m_lcid
IClusCfgCallback * | m_piccCallback

Detailed Description

Definition at line 42 of file MyStartupListener.h.

Constructor & Destructor Documentation

CMyStartupListener::CMyStartupListener ( void ) [protected]

Definition at line 30 of file MyStartupListener.cpp.

    : m_lcid( LOCALE_NEUTRAL )
    , m_piccCallback( NULL )
{
} //*** CMyStartupListener::CMyStartupListener

CMyStartupListener::~CMyStartupListener ( void ) [protected]

Definition at line 52 of file MyStartupListener.cpp.

{
    // Release the callback interface
    if ( m_piccCallback != NULL )
    {
        m_piccCallback->Release();
    } // if: the callback interface pointer is not NULL

} //*** CMyStartupListener::~CMyStartupListener

Member Function Documentation

STDMETHODIMP CMyStartupListener::Initialize | ( | IUnknown * | punkCallbackIn,
 |  | LCID | lcidIn
 | ) |  |

Definition at line 171 of file MyStartupListener.cpp.

{
    HRESULT hr = S_OK;

    m_lcid = lcidIn;

    if ( m_piccCallback != NULL )
    {
        //
        // Release the callback interface
        //
        m_piccCallback->Release();
        m_piccCallback = NULL;
    } // if: the callback interface pointer is not NULL

    if ( punkCallbackIn != NULL )
    {
        //
        // Query for the IClusCfgCallback interface.
        //
        hr = punkCallbackIn->QueryInterface( __uuidof( IClusCfgCallback ), reinterpret_cast< void ** > ( &m_piccCallback ) );
    } // if: the callback punk is not NULL.
    else
    {
        hr = E_POINTER;
    } // else: the callback punk is NULL.

    return hr;

} //*** CMyStartupListener::Initialize

STDMETHODIMP CMyStartupListener::Notify ( IUnknown * punkIn )

Definition at line 93 of file MyStartupListener.cpp.

{
    //
    // TODO: Modify this code to perform your tasks.
    //

    HRESULT         hr = S_OK;
    WCHAR           szMessage[] = L"MyStartupListener Message: The Cluster Service has started successfully.";

    UNREFERENCED_PARAMETER( punkIn );

    if ( m_piccCallback != NULL )
    {
        //
        // Log a message to client and server log file informing that the
        // cluster service has started on this machine.
        //
        hr = m_piccCallback->SendStatusReport(
                  NULL      // pcszNodeNameIn - Filled in by cluster config server.
                , TASKID_Major_Client_And_Server_Log
                , IID_NULL
                , 0         // ulMinIn
                , 1         // ulMaxIn
                , 1         // ulCurrentIn
                , hr
                , szMessage
                , NULL      // pftTimeIn - Filled in by cluster config server.
                , NULL      // bstrReferenceIn
                );

        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:
    } //if: the callback interface pointer is not NULL

Cleanup:

   return hr;

} //*** CMyStartupListener::Notify

Member Data Documentation

LCID CMyStartupListener::m_lcid [private]

Definition at line 52 of file MyStartupListener.h.

IClusCfgCallback* CMyStartupListener::m_piccCallback [private]

Definition at line 57 of file MyStartupListener.h.

The documentation for this class was generated from the following files:
  • WinBase/Cluster/Win2003/MyStartupListener/MyStartupListener.h
  • WinBase/Cluster/Win2003/MyStartupListener/MyStartupListener.cpp
Generated on Wed Nov 13 2024 16:56:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMyUIExtApp Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CMyUIExtApp Class Reference

Inherits CWinApp, and CWinApp.

List of all members.

Public Member Functions

virtual int | ExitInstance ()
virtual int | ExitInstance ()
virtual BOOL | InitInstance ()
virtual BOOL | InitInstance ()

Detailed Description

Definition at line 41 of file SCPProppage.cpp.

Member Function Documentation

int CMyUIExtApp::ExitInstance ( void ) [virtual]

Reimplemented from CWinApp.

Definition at line 56 of file SCPProppage.cpp.

{
  _Module.Term();
  return CWinApp::ExitInstance();
}

virtual int CMyUIExtApp::ExitInstance ( ) [virtual]

Reimplemented from CWinApp.

virtual BOOL CMyUIExtApp::InitInstance ( ) [virtual]

Reimplemented from CWinApp.

BOOL CMyUIExtApp::InitInstance ( void ) [virtual]

Reimplemented from CWinApp.

Definition at line 50 of file SCPProppage.cpp.

{
  _Module.Init(ObjectMap, m_hInstance);
  return CWinApp::InitInstance();
}

The documentation for this class was generated from the following files:
  • NetDS/ADSI/samples/DSUI/scpext/scpproppage/SCPProppage.cpp
  • NetDS/ADSI/samples/DSUI/userext/userproppage/userproppage.cpp
Generated on Wed Nov 13 2024 16:56:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMyUIExtModule Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CMyUIExtModule Class Reference

#include "StdAfx.h"

List of all members.

Public Member Functions

HRESULT WINAPI | UpdateRegistryCLSID (const CLSID &clsid, BOOL bRegister)
HRESULT WINAPI | UpdateRegistryCLSID (const CLSID &clsid, BOOL bRegister)

Detailed Description

Definition at line 44 of file StdAfx.h.

Member Function Documentation

HRESULT WINAPI CMyUIExtModule::UpdateRegistryCLSID | ( | const CLSID & | clsid,
 |  | BOOL | bRegister
 | ) |  |

Definition at line 19 of file StdAfx.cpp.

{
  static const WCHAR szIPS32[] = _T("InprocServer32");
  static const WCHAR szCLSID[] = _T("CLSID");

  HRESULT hRes = S_OK;

  LPOLESTR lpOleStrCLSIDValue;
  ::StringFromCLSID(clsid, &lpOleStrCLSIDValue);

  CRegKey key;
  if (bRegister)
  {
    LONG lRes = key.Open(HKEY_CLASSES_ROOT, szCLSID);
    if (lRes == ERROR_SUCCESS)
    {
      lRes = key.Create(key, lpOleStrCLSIDValue);
      if (lRes == ERROR_SUCCESS)
      {
        WCHAR szModule[_MAX_PATH];
        ::GetModuleFileName(m_hInst, szModule, _MAX_PATH);
        key.SetKeyValue(szIPS32, szModule);
      }
    }
    if (lRes != ERROR_SUCCESS)
      hRes = HRESULT_FROM_WIN32(lRes);
  }
  else
  {
    key.Attach(HKEY_CLASSES_ROOT);
    if (key.Open(key, szCLSID) == ERROR_SUCCESS)
      key.RecurseDeleteKey(lpOleStrCLSIDValue);
  }
  ::CoTaskMemFree(lpOleStrCLSIDValue);
  return hRes;
}

HRESULT WINAPI CMyUIExtModule::UpdateRegistryCLSID | ( | const CLSID & | clsid,
 |  | BOOL | bRegister
 | ) |  |
The documentation for this class was generated from the following files:
  • NetDS/ADSI/samples/DSUI/scpext/scpproppage/StdAfx.h
  • NetDS/ADSI/samples/DSUI/userext/userproppage/stdafx.h
  • NetDS/ADSI/samples/DSUI/scpext/scpproppage/StdAfx.cpp
  • NetDS/ADSI/samples/DSUI/userext/userproppage/stdafx.cpp
Generated on Wed Nov 13 2024 16:56:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMyWizExtApp Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CMyWizExtApp Class Reference

Inherits CWinApp.

List of all members.

Public Member Functions

virtual int | ExitInstance ()
virtual BOOL | InitInstance ()

Detailed Description

Definition at line 41 of file userwizard.cpp.

Member Function Documentation

int CMyWizExtApp::ExitInstance ( void ) [virtual]

Reimplemented from CWinApp.

Definition at line 56 of file userwizard.cpp.

{
  _Module.Term();
  return CWinApp::ExitInstance();
}

BOOL CMyWizExtApp::InitInstance ( void ) [virtual]

Reimplemented from CWinApp.

Definition at line 50 of file userwizard.cpp.

{
  _Module.Init(ObjectMap, m_hInstance);
  return CWinApp::InitInstance();
}

The documentation for this class was generated from the following file:
  • NetDS/ADSI/samples/DSUI/userext/userwizard/userwizard.cpp
Generated on Wed Nov 13 2024 16:56:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CMyWizExtModule Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CMyWizExtModule Class Reference

#include "stdafx.h"

List of all members.

Public Member Functions

HRESULT WINAPI UpdateRegistryCLSID (const CLSID &clsid, BOOL bRegister)

Detailed Description

Definition at line 45 of file stdafx.h.

Member Function Documentation

HRESULT WINAPI CMyWizExtModule::UpdateRegistryCLSID | ( | const CLSID & | clsid,
 |  | BOOL | bRegister
 | ) |  |

Definition at line 19 of file stdafx.cpp.

{
  static const WCHAR szIPS32[] = _T("InprocServer32");
  static const WCHAR szCLSID[] = _T("CLSID");

  HRESULT hRes = S_OK;

  LPOLESTR lpOleStrCLSIDValue;
  ::StringFromCLSID(clsid, &lpOleStrCLSIDValue);

  CRegKey key;
  if (bRegister)
  {
    LONG lRes = key.Open(HKEY_CLASSES_ROOT, szCLSID);
    if (lRes == ERROR_SUCCESS)
    {
      lRes = key.Create(key, lpOleStrCLSIDValue);
      if (lRes == ERROR_SUCCESS)
      {
        WCHAR szModule[_MAX_PATH];
        ::GetModuleFileName(m_hInst, szModule, _MAX_PATH);
        key.SetKeyValue(szIPS32, szModule);
      }
    }
    if (lRes != ERROR_SUCCESS)
      hRes = HRESULT_FROM_WIN32(lRes);
  }
  else
  {
    key.Attach(HKEY_CLASSES_ROOT);
    if (key.Open(key, szCLSID) == ERROR_SUCCESS)
      key.RecurseDeleteKey(lpOleStrCLSIDValue);
  }
  ::CoTaskMemFree(lpOleStrCLSIDValue);
  return hRes;
}

The documentation for this class was generated from the following files:
  • NetDS/ADSI/samples/DSUI/userext/userwizard/stdafx.h
  • NetDS/ADSI/samples/DSUI/userext/userwizard/stdafx.cpp
Generated on Wed Nov 13 2024 16:56:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CNetInterfaceData Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Private Attributes

CNetInterfaceData Class Reference

#include "ExtObjData.h"

Inherits CObjData, and CObjData.

List of all members.

Public Member Functions

virtual HRESULT | AddContextMenuItems (IWCContextMenuCallback *piCallbackIn)
virtual HRESULT | AddContextMenuItems (IWCContextMenuCallback *piCallbackIn)
HNETINTERFACE | GetHNetInterface (void)
HNETINTERFACE | GetHNetInterface (void)
virtual HRESULT | InvokeCommand (ULONG nCommandIDIn)
virtual HRESULT | InvokeCommand (ULONG nCommandIDIn)

Protected Member Functions

virtual HRESULT | HrInitialize (IUnknown *piDataIn)
virtual HRESULT | HrInitialize (IUnknown *piDataIn)

Private Attributes

HNETINTERFACE | m_hNetInterface

Detailed Description

Definition at line 269 of file ExtObjData.h.

Member Function Documentation

HRESULT CNetInterfaceData::AddContextMenuItems ( IWCContextMenuCallback * piCallbackIn ) [virtual]

Reimplemented from CObjData.

Definition at line 1626 of file ExtObjData.cpp.

{
    HRESULT hr = S_OK;

    ASSERT( piCallbackIn != NULL );

    hr = AddContextMenuItem(
              piCallbackIn
            , IDS_NETINTERFACE_MENU_ITEM_1
            , IDS_NETINTERFACE_MENU_ITEM_1_DESC
            , NETINTERFACE_MENU_ID_1
            , MF_ENABLED
            );

    return hr;

} //*** CNetInterfaceData::AddContextMenuItems

virtual HRESULT CNetInterfaceData::AddContextMenuItems ( IWCContextMenuCallback * piCallbackIn ) [virtual]

Reimplemented from CObjData.

HNETINTERFACE CNetInterfaceData::GetHNetInterface ( void ) [inline]

Definition at line 283 of file ExtObjData.h.

{ return m_hNetInterface; };

HNETINTERFACE CNetInterfaceData::GetHNetInterface ( void ) [inline]

Definition at line 283 of file ExtObjData.h.

{ return m_hNetInterface; };

virtual HRESULT CNetInterfaceData::HrInitialize ( IUnknown * piDataIn ) [protected, virtual]

Reimplemented from CObjData.

HRESULT CNetInterfaceData::HrInitialize ( IUnknown * piDataIn ) [protected, virtual]

Reimplemented from CObjData.

Definition at line 1538 of file ExtObjData.cpp.

{
    HRESULT                         hr = S_OK;
    IGetClusterNetInterfaceInfo *   piNetInterfaceInfo = NULL;

    ASSERT( piDataIn != NULL );

    //
    // Initialize the base class.
    //

    hr = CObjData::HrInitialize( piDataIn );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if: error initializing the base class

    //
    // Initialize member variables to default values.
    //

    m_hNetInterface = NULL;

    //
    // Set the object type.
    //

    m_cot = CLUADMEX_OT_NETINTERFACE;

    //
    // Get an interface pointer to IGetClusterNetInterfaceInfo.
    //

    hr = piDataIn->QueryInterface( IID_IGetClusterNetInterfaceInfo, reinterpret_cast< LPVOID * >( &piNetInterfaceInfo ) );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if: error querying for interface

    //
    // Get a copy of the handle.  Don't free this handle - it's just a copy.
    //

    m_hNetInterface = piNetInterfaceInfo->GetNetInterfaceHandle( 0 );
    ASSERT( m_hNetInterface != NULL );
    if ( m_hNetInterface == NULL )
    {
        hr = E_HANDLE;
        goto Cleanup;
    } // if: error getting the netinterface handle

Cleanup:

    if ( piNetInterfaceInfo != NULL )
    {
        piNetInterfaceInfo->Release();
    } // if:

    return hr;

} //*** CNetInterfaceData::HrInitialize

virtual HRESULT CNetInterfaceData::InvokeCommand ( ULONG nCommandIDIn ) [virtual]

Reimplemented from CObjData.

HRESULT CNetInterfaceData::InvokeCommand ( ULONG nCommandIDIn ) [virtual]

Reimplemented from CObjData.

Definition at line 1666 of file ExtObjData.cpp.

{
    HRESULT hr = S_OK;

    switch ( nCommandIDIn )
    {
        case NETINTERFACE_MENU_ID_1:

            //
            //  TODO:  Implement your menu item here
            //

            hr = S_OK;
            break;

        default:
            hr = E_NOTIMPL;
            break;
    } // switch: nCommandIDIn

    return hr;

} //*** CNetInterfaceData::InvokeCommand

Member Data Documentation

HNETINTERFACE CNetInterfaceData::m_hNetInterface [private]

Definition at line 273 of file ExtObjData.h.

The documentation for this class was generated from the following files:
  • WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/ExtObjData.h
  • WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/ExtObjData.h
  • WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/ExtObjData.cpp
  • WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/ExtObjData.cpp
Generated on Wed Nov 13 2024 16:56:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CNetworkData Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Private Attributes

CNetworkData Class Reference

#include "ExtObjData.h"

Inherits CObjData, and CObjData.

List of all members.

Public Member Functions

virtual HRESULT | AddContextMenuItems (IWCContextMenuCallback *piCallbackIn)
virtual HRESULT | AddContextMenuItems (IWCContextMenuCallback *piCallbackIn)
HNETWORK | GetHNetwork (void)
HNETWORK | GetHNetwork (void)
virtual HRESULT | InvokeCommand (ULONG nCommandIDIn)
virtual HRESULT | InvokeCommand (ULONG nCommandIDIn)

Protected Member Functions

virtual HRESULT | HrInitialize (IUnknown *piDataIn)
virtual HRESULT | HrInitialize (IUnknown *piDataIn)

Private Attributes

HNETWORK | m_hNetwork

Detailed Description

Definition at line 247 of file ExtObjData.h.

Member Function Documentation

HRESULT CNetworkData::AddContextMenuItems ( IWCContextMenuCallback * piCallbackIn ) [virtual]

Reimplemented from CObjData.

Definition at line 1453 of file ExtObjData.cpp.

{
    HRESULT     hr = S_OK;

    ASSERT( piCallbackIn != NULL );

    hr = AddContextMenuItem(
              piCallbackIn
            , IDS_NETWORK_MENU_ITEM_1
            , IDS_NETWORK_MENU_ITEM_1_DESC
            , NETWORK_MENU_ID_1
            , MF_ENABLED
            );

    return hr;

} //*** CNetworkData::AddContextMenuItems

virtual HRESULT CNetworkData::AddContextMenuItems ( IWCContextMenuCallback * piCallbackIn ) [virtual]

Reimplemented from CObjData.

HNETWORK CNetworkData::GetHNetwork ( void ) [inline]

Definition at line 261 of file ExtObjData.h.

{ return m_hNetwork; };

HNETWORK CNetworkData::GetHNetwork ( void ) [inline]

Definition at line 261 of file ExtObjData.h.

{ return m_hNetwork; };

virtual HRESULT CNetworkData::HrInitialize ( IUnknown * piDataIn ) [protected, virtual]

Reimplemented from CObjData.

HRESULT CNetworkData::HrInitialize ( IUnknown * piDataIn ) [protected, virtual]

Reimplemented from CObjData.

Definition at line 1366 of file ExtObjData.cpp.

{
    HRESULT                     hr = S_OK;
    IGetClusterNetworkInfo *    piNetInfo = NULL;

    ASSERT( piDataIn != NULL );

    //
    // Initialize the base class.
    //

    hr = CObjData::HrInitialize( piDataIn );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if: error initializing the base class

    //
    // Initialize member variables to default values.
    //

    m_hNetwork = NULL;

    //
    // Set the object type.
    //

    m_cot = CLUADMEX_OT_NETWORK;

    //
    // Get an interface pointer to IGetClusterNetworkInfo.
    //

    hr = piDataIn->QueryInterface( IID_IGetClusterNetworkInfo, reinterpret_cast< LPVOID * >( &piNetInfo ) );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if: error querying for interface

    //
    // Get a copy of the handle.  Don't free this handle - it's just a copy.
    //

    m_hNetwork = piNetInfo->GetNetworkHandle( 0 );
    ASSERT( m_hNetwork != NULL );
    if ( m_hNetwork == NULL )
    {
        hr = E_HANDLE;
        goto Cleanup;
    } // if: error getting the network handle

Cleanup:

    if ( piNetInfo != NULL )
    {
        piNetInfo->Release();
    } // if:

    return hr;

} //*** CNetworkData::HrInitialize

virtual HRESULT CNetworkData::InvokeCommand ( ULONG nCommandIDIn ) [virtual]

Reimplemented from CObjData.

HRESULT CNetworkData::InvokeCommand ( ULONG nCommandIDIn ) [virtual]

Reimplemented from CObjData.

Definition at line 1493 of file ExtObjData.cpp.

{
    HRESULT hr = S_OK;

    switch ( nCommandIDIn )
    {
        case NETWORK_MENU_ID_1:

            //
            //  TODO:  Implement your menu item here
            //

            hr = S_OK;
            break;

        default:
            hr = E_NOTIMPL;
            break;
    } // switch: nCommandIDIn

    return hr;

} //*** CNetworkData::InvokeCommand

Member Data Documentation

HNETWORK CNetworkData::m_hNetwork [private]

Definition at line 251 of file ExtObjData.h.

The documentation for this class was generated from the following files:
  • WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/ExtObjData.h
  • WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/ExtObjData.h
  • WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/ExtObjData.cpp
  • WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/ExtObjData.cpp
Generated on Wed Nov 13 2024 16:56:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CNewsEvent Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CNewsEvent Class Reference

#include "newsevent.h"

List of all members.

Public Member Functions

CNewsEvent ()
CNewsEvent ()
STDMETHOD() | InterfaceSupportsErrorInfo (REFIID riid)
STDMETHOD() | LongQuote (BSTR Symbol, double BidPrice, double AskPrice, BSTR LastTradeTime, double LastTradePrice, double NetChange, double DailyHigh, double DailyLow, long AskSize, long BidSize, double OpenPrice, double ClosePrice, BSTR CloseDate)
STDMETHOD() | NewsFlash (DATE dtTimeStamp, BSTR Symbol, BSTR Headline, BSTR URL)
STDMETHOD() | ShortQuote (BSTR Symbol, double BidPrice, double AskPrice, DATE LastTradeTime, double LastTradePrice, double NetChange, double DailyHigh, double DailyLow)

Detailed Description

Definition at line 10 of file newsevent.h.

Constructor & Destructor Documentation

CNewsEvent::CNewsEvent ( ) [inline]

Definition at line 15 of file newsevent.h.

  {
  }

CNewsEvent::CNewsEvent ( ) [inline]

Definition at line 17 of file newsevent.h.

  {
  }

Member Function Documentation

STDMETHODIMP CNewsEvent::InterfaceSupportsErrorInfo ( REFIID riid )

Definition at line 9 of file newsevent.Cpp.

{
  static const IID* arr[] =
  {
    &__uuidof(INewsEvent)
  };
  for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++)
  {
    if (::InlineIsEqualGUID(*arr[i],riid))
      return S_OK;
  }
  return S_FALSE;
}

STDMETHODIMP CNewsEvent::LongQuote | ( | BSTR | Symbol,
 |  | double | BidPrice,
 |  | double | AskPrice,
 |  | BSTR | LastTradeTime,
 |  | double | LastTradePrice,
 |  | double | NetChange,
 |  | double | DailyHigh,
 |  | double | DailyLow,
 |  | long | AskSize,
 |  | long | BidSize,
 |  | double | OpenPrice,
 |  | double | ClosePrice,
 |  | BSTR | CloseDate
 | ) |  |

Definition at line 40 of file newsevent.Cpp.

{
  // TODO: Add your implementation code here

  return S_OK;
}

STDMETHODIMP CNewsEvent::NewsFlash | ( | DATE | dtTimeStamp,
 |  | BSTR | Symbol,
 |  | BSTR | Headline,
 |  | BSTR | URL
 | ) |  |

Definition at line 23 of file newsevent.Cpp.

{
  TCHAR* tzText=0;
  USES_CONVERSION;

  tzText = W2T(Headline);
  MessageBox(NULL,tzText,_T("Inside the Subscriber"),MB_OK);
  return S_OK;
}

STDMETHODIMP CNewsEvent::ShortQuote | ( | BSTR | Symbol,
 |  | double | BidPrice,
 |  | double | AskPrice,
 |  | DATE | LastTradeTime,
 |  | double | LastTradePrice,
 |  | double | NetChange,
 |  | double | DailyHigh,
 |  | double | DailyLow
 | ) |  |

Definition at line 33 of file newsevent.Cpp.

{
  // TODO: Add your implementation code here

  return S_OK;
}

The documentation for this class was generated from the following files:
  • Com/Services/Events/EventNews/NewsEventClass/newsevent.h
  • Com/Services/Events/EventNews/PersistATL/newsevent.h
  • Com/Services/Events/EventNews/PersistATL/newsevent.Cpp
Generated on Wed Nov 13 2024 16:56:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CNode< TYPE > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CNode< TYPE > Class Template Reference

#include "list.h"

List of all members.

Public Member Functions

CNode (CNode *pPrevNode, CNode *pNextNode)
CNode (TYPE val, CNode *pPrevNode, CNode *pNextNode)
CNode (TYPE val, CNode *pPrevNode, CNode *pNextNode)
virtual | ~CNode ()

Public Attributes

TYPE | m_data
CNode * m_pNext
CNode * m_pNextNode
CNode * m_pPrev
CNode * m_pPrevNode

Detailed Description

template<class TYPE>
class CNode< TYPE >

Definition at line 32 of file list.h.

Constructor & Destructor Documentation

template<class TYPE >
CNode< TYPE >::CNode | ( | CNode< TYPE > * | pPrevNode,
 |  | CNode< TYPE > * | pNextNode
 | ) |  |

Definition at line 50 of file list.h.

{
    //Constructor
    m_pPrev = pPrevNode;
    m_pNext = pNextNode;

    //NOTE:  The constructor doesn't have an element passed in for
    //data.  This is so we don't have a copy of the parameter and then
    //need to copy it for assignment...
}

template<class TYPE >
CNode< TYPE >::~CNode ( ) [virtual]

Definition at line 65 of file list.h.

{
    //Destructor
    m_pPrev = NULL;
    m_pNext = NULL;
}

template<class TYPE>
CNode< TYPE >::CNode | ( | TYPE | val,
 |  | CNode< TYPE > * | pPrevNode,
 |  | CNode< TYPE > * | pNextNode
 | ) |  |

Definition at line 47 of file list.h.

{
  //Constructor
  m_data = data;
  m_pPrevNode = pPrevNode;
  m_pNextNode = pNextNode;
}

template<class TYPE>
CNode< TYPE >::CNode | ( | TYPE | val,
 |  | CNode< TYPE > * | pPrevNode,
 |  | CNode< TYPE > * | pNextNode
 | ) |  |

Member Data Documentation

template<class TYPE>
TYPE CNode< TYPE >::m_data

Definition at line 40 of file list.h.

template<class TYPE>
CNode* CNode< TYPE >::m_pNext

Definition at line 41 of file list.h.

template<class TYPE>
CNode * CNode< TYPE >::m_pNextNode

Definition at line 38 of file list.h.

template<class TYPE>
CNode* CNode< TYPE >::m_pPrev

Definition at line 42 of file list.h.

template<class TYPE>
CNode * CNode< TYPE >::m_pPrevNode

Definition at line 39 of file list.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/list.h
  • Dataaccess/oledb/tablecopy/list.h
  • Dataaccess/osp/vc/cexlist.h
Generated on Wed Nov 13 2024 16:56:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CNodeData Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Private Attributes

CNodeData Class Reference

#include "ExtObjData.h"

Inherits CObjData, and CObjData.

List of all members.

Public Member Functions

virtual HRESULT | AddContextMenuItems (IWCContextMenuCallback *piCallbackIn)
virtual HRESULT | AddContextMenuItems (IWCContextMenuCallback *piCallbackIn)
HNODE | GetHNode (void)
HNODE | GetHNode (void)
virtual HRESULT | InvokeCommand (ULONG nCommandIDIn)
virtual HRESULT | InvokeCommand (ULONG nCommandIDIn)

Protected Member Functions

virtual HRESULT | HrInitialize (IUnknown *piDataIn)
virtual HRESULT | HrInitialize (IUnknown *piDataIn)

Private Attributes

HNODE | m_hNode

Detailed Description

Definition at line 159 of file ExtObjData.h.

Member Function Documentation

HRESULT CNodeData::AddContextMenuItems ( IWCContextMenuCallback * piCallbackIn ) [virtual]

Reimplemented from CObjData.

Definition at line 619 of file ExtObjData.cpp.

{
    HRESULT hr = S_OK;

    ASSERT( piCallbackIn != NULL );

    hr = AddContextMenuItem(
              piCallbackIn
            , IDS_NODE_MENU_ITEM_1
            , IDS_NODE_MENU_ITEM_1_DESC
            , NODE_MENU_ID_1
            , MF_ENABLED
            );

    return hr;

} //*** CNodeData::AddContextMenuItems

virtual HRESULT CNodeData::AddContextMenuItems ( IWCContextMenuCallback * piCallbackIn ) [virtual]

Reimplemented from CObjData.

HNODE CNodeData::GetHNode ( void ) [inline]

Definition at line 173 of file ExtObjData.h.

{ return m_hNode; };

HNODE CNodeData::GetHNode ( void ) [inline]

Definition at line 173 of file ExtObjData.h.

{ return m_hNode; };

virtual HRESULT CNodeData::HrInitialize ( IUnknown * piDataIn ) [protected, virtual]

Reimplemented from CObjData.

HRESULT CNodeData::HrInitialize ( IUnknown * piDataIn ) [protected, virtual]

Reimplemented from CObjData.

Definition at line 531 of file ExtObjData.cpp.

{
    HRESULT                 hr = S_OK;
    IGetClusterNodeInfo *   piNodeInfo = NULL;

    ASSERT( piDataIn != NULL );

    //
    // Initialize the base class.
    //

    hr = CObjData::HrInitialize( piDataIn );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if: error initializing the base class

    //
    // Initialize member variables to default values.
    //

    m_hNode = NULL;

    //
    // Set the object type.
    //

    m_cot = CLUADMEX_OT_NODE;

    //
    // Get an interface pointer to IGetClusterNodeInfo.
    //

    hr = piDataIn->QueryInterface( IID_IGetClusterNodeInfo, reinterpret_cast< LPVOID * >( &piNodeInfo ) );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if: error querying for interface

    //
    // Get a copy of the handle.  Don't free this handle - it's just a copy.
    //

    m_hNode = piNodeInfo->GetNodeHandle( 0 );
    ASSERT( m_hNode != NULL );
    if ( m_hNode == NULL )
    {
        hr = E_HANDLE;
        goto Cleanup;
    } // if: error getting the node handle

Cleanup:

    if ( piNodeInfo != NULL )
    {
        piNodeInfo->Release();
    } // if:

    return hr;

} //*** CNodeData::HrInitialize

virtual HRESULT CNodeData::InvokeCommand ( ULONG nCommandIDIn ) [virtual]

Reimplemented from CObjData.

HRESULT CNodeData::InvokeCommand ( ULONG nCommandIDIn ) [virtual]

Reimplemented from CObjData.

Definition at line 659 of file ExtObjData.cpp.

{
    HRESULT hr = S_OK;

    switch ( nCommandIDIn )
    {
        case NODE_MENU_ID_1:

            //
            //  TODO:  Implement your menu item here
            //

            hr = S_OK;
            break;

        default:
            hr = E_NOTIMPL;
            break;
    } // switch: nCommandIDIn

    return hr;

} //*** CNodeData::InvokeCommand

Member Data Documentation

HNODE CNodeData::m_hNode [private]

Definition at line 163 of file ExtObjData.h.

The documentation for this class was generated from the following files:
  • WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/ExtObjData.h
  • WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/ExtObjData.h
  • WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/ExtObjData.cpp
  • WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/ExtObjData.cpp
Generated on Wed Nov 13 2024 16:56:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CNotify Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CNotify Class Reference

#include "clUtil.h"

Inherited by CAppShareNotify, CAppShareNotify, CCallNotify, CCallNotify, CChannelNotify, CConfNotify, CConfNotify, CConfNotify, CConfNotify, CConfNotify, CDataNotify, CDataNotify, CFileTransferNotify, CFtNotify, CMgrNotify, CMgrNotify, CMgrNotify, CMgrNotify, and CMgrNotify.

List of all members.

Public Member Functions

CNotify (void)
CNotify (void)
CNotify (void)
CNotify (void)
CNotify (void)
CNotify (void)
~CNotify ()
~CNotify ()
~CNotify ()
~CNotify ()
~CNotify ()
~CNotify ()
HRESULT | Connect (IUnknown *pUnk, REFIID riid, IUnknown *pUnkN)
HRESULT | Connect (IUnknown *pUnk, REFIID riid, IUnknown *pUnkN)
HRESULT | Connect (IUnknown *pUnk, REFIID riid, IUnknown *pUnkN)
HRESULT | Connect (IUnknown *pUnk, REFIID riid, IUnknown *pUnkN)
HRESULT | Connect (IUnknown *pUnk, REFIID riid, IUnknown *pUnkN)
HRESULT | Connect (IUnknown *pUnk, REFIID riid, IUnknown *pUnkN)
HRESULT | Disconnect (void)
HRESULT | Disconnect (void)
HRESULT | Disconnect (void)
HRESULT | Disconnect (void)
HRESULT | Disconnect (void)
HRESULT | Disconnect (void)
IUnknown * | GetPunk ()
IUnknown * | GetPunk ()
IUnknown * | GetPunk ()
IUnknown * | GetPunk ()
IUnknown * | GetPunk ()
IUnknown * | GetPunk ()

Private Attributes

DWORD m_dwCookie
IConnectionPoint * | m_pcnp
IConnectionPointContainer * | m_pcnpcnt
IUnknown * | m_pUnk

Detailed Description

Definition at line 50 of file clUtil.h.

Constructor & Destructor Documentation

CNotify::CNotify ( void )

Definition at line 90 of file clUtil.Cpp.

                 :
  m_pcnpcnt(NULL),
    m_pcnp(NULL),
    m_dwCookie(0),
    m_pUnk(NULL)
{
}

CNotify::~CNotify ( )

Definition at line 105 of file clUtil.Cpp.

{
  Disconnect(); // Make sure we're disconnected
}

CNotify::CNotify ( void )
CNotify::~CNotify ( )
CNotify::CNotify ( void )
CNotify::~CNotify ( )
CNotify::CNotify ( void )
CNotify::~CNotify ( )
CNotify::CNotify ( void )
CNotify::~CNotify ( )
CNotify::CNotify ( void )
CNotify::~CNotify ( )

Member Function Documentation

HRESULT CNotify::Connect | ( | IUnknown * | pUnk,
 |  | REFIID | riid,
 |  | IUnknown * | pUnkN
 | ) |  |

Definition at line 117 of file clUtil.Cpp.

{
  HRESULT hr = NO_ERROR;

  if(NULL == pUnk || NULL == pUnkN)
  {
    return E_POINTER;
  }

  ASSERT(0 == m_dwCookie);

  if(m_dwCookie != 0)
  {
    return HRESULT_FROM_WIN32(ERROR_ALREADY_INITIALIZED);
  }

  // Get the connection container
  hr = pUnk->QueryInterface(IID_IConnectionPointContainer, (void **)&m_pcnpcnt);
  if (SUCCEEDED(hr))
  {
    // Find an appropriate connection point
    hr = m_pcnpcnt->FindConnectionPoint(riid, &m_pcnp);
    if (SUCCEEDED(hr))
    {
      ASSERT(NULL != m_pcnp);
      // Connect the sink object
      hr = m_pcnp->Advise((IUnknown *)pUnkN, &m_dwCookie);
    }
  }

  if (FAILED(hr))
  {
    m_dwCookie = 0;
  }
  else
  {
      m_pUnk = pUnk; // keep around for caller
    }

  return hr;
}

HRESULT CNotify::Connect | ( | IUnknown * | pUnk,
 |  | REFIID | riid,
 |  | IUnknown * | pUnkN
 | ) |  |
HRESULT CNotify::Connect | ( | IUnknown * | pUnk,
 |  | REFIID | riid,
 |  | IUnknown * | pUnkN
 | ) |  |
HRESULT CNotify::Connect | ( | IUnknown * | pUnk,
 |  | REFIID | riid,
 |  | IUnknown * | pUnkN
 | ) |  |
HRESULT CNotify::Connect | ( | IUnknown * | pUnk,
 |  | REFIID | riid,
 |  | IUnknown * | pUnkN
 | ) |  |
HRESULT CNotify::Connect | ( | IUnknown * | pUnk,
 |  | REFIID | riid,
 |  | IUnknown * | pUnkN
 | ) |  |
HRESULT CNotify::Disconnect ( void )

Reimplemented in CMgrNotify, CConfNotify, CDataNotify, CMgrNotify, CConfNotify, CFtNotify, CMgrNotify, CConfNotify, CAppShareNotify, CCallNotify, CChannelNotify, CConfNotify, CDataNotify, CFileTransferNotify, CMgrNotify, CAppShareNotify, CCallNotify, CConfNotify, and CMgrNotify.

Definition at line 166 of file clUtil.Cpp.

{
    if (0 != m_dwCookie)
    {
        // Disconnect the sink object
        m_pcnp->Unadvise(m_dwCookie);
        m_dwCookie = 0;

        m_pcnp->Release();
        m_pcnp = NULL;

        m_pcnpcnt->Release();
        m_pcnpcnt = NULL;

        m_pUnk = NULL;
    }

    return S_OK;
}

HRESULT CNotify::Disconnect ( void )

Reimplemented in CMgrNotify, CConfNotify, CDataNotify, CMgrNotify, CConfNotify, CFtNotify, CMgrNotify, CConfNotify, CAppShareNotify, CCallNotify, CChannelNotify, CConfNotify, CDataNotify, CFileTransferNotify, CMgrNotify, CAppShareNotify, CCallNotify, CConfNotify, and CMgrNotify.

HRESULT CNotify::Disconnect ( void )

Reimplemented in CMgrNotify, CConfNotify, CDataNotify, CMgrNotify, CConfNotify, CFtNotify, CMgrNotify, CConfNotify, CAppShareNotify, CCallNotify, CChannelNotify, CConfNotify, CDataNotify, CFileTransferNotify, CMgrNotify, CAppShareNotify, CCallNotify, CConfNotify, and CMgrNotify.

HRESULT CNotify::Disconnect ( void )

Reimplemented in CMgrNotify, CConfNotify, CDataNotify, CMgrNotify, CConfNotify, CFtNotify, CMgrNotify, CConfNotify, CAppShareNotify, CCallNotify, CChannelNotify, CConfNotify, CDataNotify, CFileTransferNotify, CMgrNotify, CAppShareNotify, CCallNotify, CConfNotify, and CMgrNotify.

HRESULT CNotify::Disconnect ( void )

Reimplemented in CMgrNotify, CConfNotify, CDataNotify, CMgrNotify, CConfNotify, CFtNotify, CMgrNotify, CConfNotify, CAppShareNotify, CCallNotify, CChannelNotify, CConfNotify, CDataNotify, CFileTransferNotify, CMgrNotify, CAppShareNotify, CCallNotify, CConfNotify, and CMgrNotify.

HRESULT CNotify::Disconnect ( void )

Reimplemented in CMgrNotify, CConfNotify, CDataNotify, CMgrNotify, CConfNotify, CFtNotify, CMgrNotify, CConfNotify, CAppShareNotify, CCallNotify, CChannelNotify, CConfNotify, CDataNotify, CFileTransferNotify, CMgrNotify, CAppShareNotify, CCallNotify, CConfNotify, and CMgrNotify.

IUnknown* CNotify::GetPunk ( ) [inline]

Definition at line 64 of file clUtil.h.

{return m_pUnk;}

IUnknown* CNotify::GetPunk ( ) [inline]

Definition at line 64 of file clUtil.h.

{return m_pUnk;}

IUnknown* CNotify::GetPunk ( ) [inline]

Definition at line 68 of file clUtil.h.

{return m_pUnk;}

IUnknown* CNotify::GetPunk ( ) [inline]

Definition at line 65 of file conf.h.

{return m_pUnk;}

IUnknown* CNotify::GetPunk ( ) [inline]

Definition at line 50 of file utils.h.

{return m_pUnk;}

IUnknown* CNotify::GetPunk ( ) [inline]

Definition at line 67 of file clUtil.h.

{return m_pUnk;}

Member Data Documentation

DWORD CNotify::m_dwCookie [private]

Definition at line 53 of file clUtil.h.

IConnectionPoint * CNotify::m_pcnp [private]

Definition at line 55 of file clUtil.h.

IConnectionPointContainer * CNotify::m_pcnpcnt [private]

Definition at line 56 of file clUtil.h.

IUnknown * CNotify::m_pUnk [private]

Definition at line 54 of file clUtil.h.

The documentation for this class was generated from the following files:
  • Web/NetMeeting/NMChat/clUtil.h
  • Web/NetMeeting/NMChat2/conf.h
  • Web/NetMeeting/NMFT/clUtil.h
  • Web/NetMeeting/NMShare/clUtil.h
  • Web/NetMeeting/NMUI/clUtil.h
  • Web/NetMeeting/PlugTransport/utils.h
  • Web/NetMeeting/NMChat/clUtil.Cpp
  • Web/NetMeeting/NMChat2/conf.cpp
  • Web/NetMeeting/NMFT/clUtil.Cpp
  • Web/NetMeeting/NMShare/clUtil.Cpp
  • Web/NetMeeting/NMUI/clUtil.Cpp
  • Web/NetMeeting/PlugTransport/utils.cpp
Generated on Wed Nov 13 2024 16:56:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CNullModem Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CNullModem Class Reference

#include "nullmdm.h"

List of all members.

Public Member Functions

CNullModem (void)
~CNullModem (void)
HANDLE | GetCommLink (void)
TPhysicalError | TPhysConnectRequest (LPTSTR pszComPort)
TPhysicalError | TPhysDisconnect (void)
TPhysicalError | TPhysInitialize (UINT transport_id)
TPhysicalError | TPhysTerminate (void)

Private Member Functions

DWORD | DoConnect (void)
void | DropCall (void)
void | SetBuffers (void)
void | SetComPortState (void)
void | SetConnectedPort (void)
void | SetTimeouts (void)
BOOL | WaitForConnection (void)

Private Attributes

COMMTIMEOUTS | m_DefaultTimeouts
DWORD m_dwEventMask
BOOL m_fCommPortInUse
BOOL m_fInitialized
HANDLE m_hevtOverlapped
LINE_INFO m_Line
UINT m_nConnectionID
UINT m_nTransportID
OVERLAPPED | m_Overlapped

Detailed Description

Definition at line 77 of file nullmdm.h.

Constructor & Destructor Documentation

CNullModem::CNullModem ( void )

Definition at line 178 of file nullmdm.cpp.

:
    m_fInitialized(FALSE),
    m_nTransportID(0),
    m_nConnectionID(0),
    m_hevtOverlapped(NULL),
    m_dwEventMask(0),
    m_fCommPortInUse(FALSE)
{
    ::ZeroMemory(&m_Line, sizeof(m_Line));
    ::ZeroMemory(&m_Overlapped, sizeof(m_Overlapped));
    ::ZeroMemory(&m_DefaultTimeouts, sizeof(m_DefaultTimeouts));

    m_hevtOverlapped = ::CreateEvent(NULL, TRUE, FALSE, NULL); // manual reset
    ASSERT(NULL != m_hevtOverlapped);

}

CNullModem::~CNullModem ( void )

Definition at line 208 of file nullmdm.cpp.

{
    if (m_fInitialized)
    {
        TPhysTerminate();
    }

    if (NULL != m_hevtOverlapped)
    {
        ::CloseHandle(m_hevtOverlapped);
    }
}

Member Function Documentation

DWORD CNullModem::DoConnect ( void ) [private]

Definition at line 685 of file nullmdm.cpp.

{
    ULONG    rc = 0;

    while (m_fCommPortInUse)
    {
        // Wait for connection to happen
        if (WaitForConnection())
        {
            SetBuffers();
            SetTimeouts();

            // Call T120 physicall request
            if (m_Line.fCaller)
            {
                // rc = g_lpfnPTPhysicalConnectRequest(0, // CALL_CONTROL_MANUAL
                //                        &m_Line.hCommLink, NULL, &m_Line.pstnHandle);
            }
            else
            {
                m_Line.connInfo.connectionID = m_nConnectionID;
                m_Line.connInfo.resultCode = TPHYS_SUCCESS;
            }

            if (rc != 0)
            {
                m_Line.connInfo.resultCode = TPHYS_RESULT_CONNECT_FAILED;

                DropCall();
            }
            else
            {
                m_Line.eCallState = CALL_STATE_CONNECTED;
                m_Line.connInfo.resultCode = TPHYS_SUCCESS;

                // This comm port doesn't need the thread anymore
                m_fCommPortInUse = FALSE;
            }
        }
        else
        {
            m_Line.connInfo.resultCode = TPHYS_RESULT_CONNECT_FAILED;

            // Something went wrong in the wait, get out of the loop
            break;
        }
    }

    return 0;
}

void CNullModem::DropCall ( void ) [private]

Definition at line 506 of file nullmdm.cpp.

{
    // close the device handle
    if (NULL != m_Line.hCommLink)
    {
        CALL_STATE eCallState = m_Line.eCallState;
        m_Line.eCallState = CALL_STATE_IDLE;

        // If this call is connected it is not using the comm thread
        if (eCallState != CALL_STATE_CONNECTED)
        {
            m_fCommPortInUse = FALSE;
        }

        // restore comm timeouts
        SetCommTimeouts(m_Line.hCommLink, &m_DefaultTimeouts);

        ::CloseHandle(m_Line.hCommLink);
        m_Line.hCommLink = NULL;
    }
}

HANDLE CNullModem::GetCommLink ( void ) [inline]

Definition at line 89 of file nullmdm.h.

{ return m_Line.hCommLink; }

void CNullModem::SetBuffers ( void ) [private]

Definition at line 748 of file nullmdm.cpp.

{
    BOOL fRet = ::SetupComm(m_Line.hCommLink, /* rx */ 10240, /* tx */ 1024);
    ASSERT(fRet);
}

void CNullModem::SetComPortState ( void ) [private]
void CNullModem::SetConnectedPort ( void ) [private]

Definition at line 541 of file nullmdm.cpp.

{
    DCB     dcb;

    ::ZeroMemory(&dcb, sizeof(dcb));
    dcb.DCBlength = sizeof(DCB);

    //  Set comm mask and state
    ::SetCommMask(m_Line.hCommLink, 0);    // RLSD changed state

    ::GetCommState(m_Line.hCommLink, &dcb);
    dcb.BaudRate = COMM_PORT_BAUD_RATE;
    dcb.StopBits = COMM_PORT_STOP_BITS;
    dcb.ByteSize = COMM_PORT_DATA_BITS;
    dcb.fBinary = 1;           // binary mode, no EOF check
    dcb.fParity = 0;           // enable parity checking
    dcb.fOutxDsrFlow = 0;      // DSR output flow control
    dcb.fDsrSensitivity = 0;   // DSR sensitivity
    dcb.fTXContinueOnXoff = 0; // XOFF continues Tx
    dcb.fOutX = 0;             // XON/XOFF out flow control
    dcb.fInX = 0;              // XON/XOFF in flow control
    dcb.fErrorChar = 0;        // enable error replacement
    dcb.fNull = 0;             // enable null stripping
    dcb.XonLim = 0;            // transmit XON threshold
    dcb.XoffLim = 0;           // transmit XOFF threshold
    dcb.Parity = 0;

    ::SetCommState(m_Line.hCommLink, &dcb);
}

void CNullModem::SetTimeouts ( void ) [private]

Definition at line 767 of file nullmdm.cpp.

{
    COMMTIMEOUTS    com_timeouts;
    ::ZeroMemory(&com_timeouts, sizeof(com_timeouts));
    com_timeouts.ReadIntervalTimeout = 100;   //10
    com_timeouts.ReadTotalTimeoutMultiplier = 0;
    com_timeouts.ReadTotalTimeoutConstant = 100;
    com_timeouts.WriteTotalTimeoutMultiplier = 0;
    com_timeouts.WriteTotalTimeoutConstant = 10000;
    BOOL fRet = ::SetCommTimeouts(m_Line.hCommLink, &com_timeouts);
    ASSERT(fRet);

}

TPhysicalError CNullModem::TPhysConnectRequest ( LPTSTR pszComPort )

Definition at line 298 of file nullmdm.cpp.

{
    TPhysicalError  rc          = TPHYS_SUCCESS;
    HANDLE          hCommLink   = INVALID_HANDLE_VALUE;
    DCB             dcb;
    DWORD           dwWritten   = 0;

    if (! m_fInitialized)
    {
        // NULL MODEM OOB not initialized
        return TPHYS_RESULT_NOT_INITIALIZED;
    }

    // Select a comm port for the call.
    if (CALL_STATE_IDLE == m_Line.eCallState || CALL_STATE_DROP == m_Line.eCallState)
    {
        // Also prime our local copy of the conninfo structure for use in callbacks
        m_Line.connInfo.resultCode   = 0;
        m_Line.connInfo.connectionID = m_nConnectionID;
    }
    else
    {
        // No comm port is available
        return TPHYS_RESULT_COMM_PORT_BUSY;
    }

    // Only alow one at at time
    if (m_fCommPortInUse)
    {
        // Waiting for a previous null mode connection
        rc = TPHYS_RESULT_WAITING_FOR_CONNECTION;
        goto bail;
    }
    m_fCommPortInUse = true;

    // Check the name of the comm port. Comm port names MUST start with 'com'.
    if (_tcsnicmp(TEXT("com"), pszComPort, 3) != 0)
    {
        rc = TPHYS_RESULT_INVALID_ADDRESS;
        goto bail;
    }

    // Open the comm port
    hCommLink = ::CreateFile(pszComPort,
                             GENERIC_READ | GENERIC_WRITE,
                             0,                    // exclusive access
                             NULL,                 // no security attrs
                             OPEN_EXISTING,
                             FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, // overlapped I/O
                             NULL );
    if (hCommLink == INVALID_HANDLE_VALUE)
    {
        // TPhysConnectRequest: CreateFile failed
        rc = TPHYS_RESULT_COMM_PORT_BUSY;
        goto bail;
    }

    m_Line.hCommLink = hCommLink;

    // remember the default timeouts
    ::GetCommTimeouts(hCommLink, &m_DefaultTimeouts);

    // Let the other side know that we are trying to connect
    if (! ::EscapeCommFunction(hCommLink, SETDTR))
    {
        // TPhysConnectRequest: Unable to Set DTR
    }

    ::ZeroMemory(&m_Overlapped, sizeof(m_Overlapped));
    m_Overlapped.hEvent = m_hevtOverlapped;
    m_dwEventMask = 0;

    ::ResetEvent(m_hevtOverlapped);

    if (! ::WriteFile(hCommLink, g_szNULLMStartString, sizeof(g_szNULLMStartString), &dwWritten, &m_Overlapped))
    {
        DWORD dwErr = ::GetLastError();
        if (ERROR_IO_PENDING != dwErr)
        {
            // TPhysConnectRequest: WriteFile failed
            ::ResetEvent(m_hevtOverlapped);
            rc = TPHYS_RESULT_COMM_PORT_BUSY;
            goto bail;
        }
        else
        {
            DWORD dwWait = ::WaitForSingleObject(m_hevtOverlapped, INFINITE);
            BOOL fRet = ::GetOverlappedResult(hCommLink, &m_Overlapped, &dwWritten, TRUE);
            ASSERT(fRet);
            ASSERT(dwWritten == sizeof(g_szNULLMStartString));
        }
    }
    else
    {
        ASSERT(dwWritten == sizeof(g_szNULLMStartString));
    }

    ::ResetEvent(m_hevtOverlapped);

    // Get the default dcb
    ::ZeroMemory(&dcb, sizeof(dcb));
    dcb.DCBlength = sizeof(DCB);

    ::GetCommState(hCommLink, &dcb);

    // Set our state so we can get notification in the comm port
    dcb.BaudRate = COMM_PORT_BAUD_RATE;
    dcb.StopBits = COMM_PORT_STOP_BITS;
    dcb.ByteSize = COMM_PORT_DATA_BITS;
    dcb.fBinary = 1;                        // binary mode, no EOF check
    dcb.fParity = 0;                        // enable parity checking
    dcb.fOutxCtsFlow = 1;                   // CTS output flow control
    dcb.fOutxDsrFlow = 0;                   // DSR output flow control
    dcb.fDtrControl = DTR_CONTROL_ENABLE;   // DTR flow control type
    dcb.fDsrSensitivity = 0;                // DSR sensitivity
    dcb.fTXContinueOnXoff = 0;              // XOFF continues Tx
    dcb.fOutX = 0;                          // XON/XOFF out flow control
    dcb.fInX = 0;                           // XON/XOFF in flow control
    dcb.fErrorChar = 0;                     // enable error replacement
    dcb.fNull = 0;                          // enable null stripping
    dcb.fRtsControl = RTS_CONTROL_HANDSHAKE;// RTS flow control
    dcb.XonLim = 0;                         // transmit XON threshold
    dcb.XoffLim = 0;                        // transmit XOFF threshold
    dcb.fErrorChar = 0;                     // enable error replacement
    dcb.fNull = 0;                          // enable null stripping
    dcb.fAbortOnError = 0;                  // abort reads/writes on error
    dcb.Parity = 0;

    ::SetCommState(hCommLink, &dcb);

    ::PurgeComm(hCommLink, PURGE_TXABORT | PURGE_RXABORT | PURGE_TXCLEAR | PURGE_RXCLEAR);

    m_Line.eCallState = CALL_STATE_MAKE;
    m_Line.hevtCall = m_hevtOverlapped;
    m_Line.pstnHandle = (PHYSICAL_HANDLE) hCommLink;
    m_Line.fCaller = TRUE;

    if (! ::SetCommMask(hCommLink,
                EV_RXCHAR |         // Any Character received
                EV_CTS |            // CTS changed state
                EV_DSR |            // DSR changed state
                EV_RLSD|            // RLSD changed state
                EV_RXFLAG))         // Certain character
    {
        // TPhysConnectRequest:  Unable to SetCommMask
    }

    ::ZeroMemory(&m_Overlapped, sizeof(m_Overlapped));
    m_Overlapped.hEvent = m_hevtOverlapped;
    m_dwEventMask = 0;

    ::ResetEvent(m_hevtOverlapped);

    if (! ::WaitCommEvent(hCommLink, &m_dwEventMask, &m_Overlapped))
    {
        DWORD dwErr = ::GetLastError();
        if (ERROR_IO_PENDING != dwErr)
        {
            // TPhysConnectRequest: WaitCommEvent failed
            m_fCommPortInUse = FALSE;
        }
    }

    DoConnect();

bail:

    return(rc);
}

TPhysicalError CNullModem::TPhysDisconnect ( void )

Definition at line 480 of file nullmdm.cpp.

{
    if (! m_fInitialized)
    {
        // Not initialized
        return(TPHYS_RESULT_NOT_INITIALIZED);
    }

    // close the com port
    DropCall();

    return(TPHYS_SUCCESS);
}

TPhysicalError CNullModem::TPhysInitialize ( UINT transport_id )

Definition at line 233 of file nullmdm.cpp.

{
    TPhysicalError rc = TPHYS_SUCCESS;

    //
    // If we have already been initialized then this is a reinit call from
    // the node controller so just do nothing.
    //
    if (! m_fInitialized)
    {
        //
        // zero out the SESSION INFO structure
        //
        ::ZeroMemory(&m_Line, sizeof(m_Line));

        //
        // Store control information
        //
        m_nTransportID  = nTransportID;
        m_fInitialized  = TRUE;
        m_nConnectionID = ++g_nConnID;

        ASSERT(TPHYS_SUCCESS == rc);
    }

    return rc;
}

TPhysicalError CNullModem::TPhysTerminate ( void )

Definition at line 273 of file nullmdm.cpp.

{
    if (! m_fInitialized)
    {
        return(TPHYS_RESULT_NOT_INITIALIZED);
    }

    m_nTransportID = 0;
    m_fInitialized = FALSE;

    return(TPHYS_SUCCESS);
}

BOOL CNullModem::WaitForConnection ( void ) [private]

Definition at line 583 of file nullmdm.cpp.

{
    BOOL fRet = FALSE;

    while (true)
    {
        DWORD dwWait = ::WaitForSingleObject(m_hevtOverlapped, COMM_PORT_TIMEOUT);

        ::ResetEvent(m_hevtOverlapped);

        if (dwWait == WAIT_ABANDONED || dwWait == WAIT_TIMEOUT || dwWait == WAIT_FAILED)
        {
            DropCall();
            m_fCommPortInUse = FALSE;
            // WaitForConnection: Unable to WaitCommEvent
            goto Failure;
        }

        ASSERT(m_hevtOverlapped == m_Line.hevtCall);
        if (CALL_STATE_MAKE != m_Line.eCallState && CALL_STATE_ANSWER != m_Line.eCallState)
        {
            // WaitForConnection: Got a bad event
            goto Failure;
        }

        switch (m_Line.eCallState)
        {
        case CALL_STATE_MAKE:
            {
                // The other side was connected and cleared DTR
                if (m_dwEventMask & (EV_RXCHAR))
                {
                    ::EscapeCommFunction(m_Line.hCommLink, CLRDTR);
                    ::EscapeCommFunction(m_Line.hCommLink, SETDTR);
                    SetConnectedPort();
                    m_Line.fCaller = FALSE;
                    goto Success;
                }

                // The other side just connected
                else
                if(m_dwEventMask & (EV_DSR | EV_RLSD | EV_CTS))
                {
                    // Change the state of this connection so we dont get here again
                    m_Line.eCallState = CALL_STATE_ANSWER;

                    // Wait sometime so the other side can transition to the wait state
                    ::Sleep(2000);

                    // Tell the other side we connected before
                    ::EscapeCommFunction(m_Line.hCommLink, SETBREAK);

                    ::ZeroMemory(&m_Overlapped, sizeof(m_Overlapped));
                    m_Overlapped.hEvent = m_Line.hevtCall;
                    m_dwEventMask = 0;

                    ::ResetEvent(m_Overlapped.hEvent);

                    if (! ::WaitCommEvent(m_Line.hCommLink, &m_dwEventMask, &m_Overlapped))
                    {
                        DWORD dwErr = ::GetLastError();
                        if (ERROR_IO_PENDING != dwErr)
                        {
                            // TPhysConnectRequest:  Unable to WaitCommEvent
                            DropCall();
                            goto Failure;
                        }
                    }
                }
            }
            break;

        case CALL_STATE_ANSWER:
            {
                ::EscapeCommFunction(m_Line.hCommLink, CLRBREAK);
                SetConnectedPort();
                goto Success;
            }
            break;
        }
    } // while

Success:

    fRet = TRUE;

Failure:

    return fRet;
}

Member Data Documentation

COMMTIMEOUTS CNullModem::m_DefaultTimeouts [private]

Definition at line 115 of file nullmdm.h.

DWORD CNullModem::m_dwEventMask [private]

Definition at line 111 of file nullmdm.h.

BOOL CNullModem::m_fCommPortInUse [private]

Definition at line 112 of file nullmdm.h.

BOOL CNullModem::m_fInitialized [private]

Definition at line 105 of file nullmdm.h.

HANDLE CNullModem::m_hevtOverlapped [private]

Definition at line 110 of file nullmdm.h.

LINE_INFO CNullModem::m_Line [private]

Definition at line 108 of file nullmdm.h.

UINT CNullModem::m_nConnectionID [private]

Definition at line 107 of file nullmdm.h.

UINT CNullModem::m_nTransportID [private]

Definition at line 106 of file nullmdm.h.

OVERLAPPED CNullModem::m_Overlapped [private]

Definition at line 113 of file nullmdm.h.

The documentation for this class was generated from the following files:
  • Web/NetMeeting/PlugTransport/nullmdm.h
  • Web/NetMeeting/PlugTransport/nullmdm.cpp
Generated on Wed Nov 13 2024 16:56:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CObjConstSub Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CObjConstSub Class Reference

#include "Objconstsub.h"

Inherits CSysLCESub.

List of all members.

Public Member Functions

CObjConstSub (CComSpy *pSpy)
CObjConstSub ()
STDMETHODIMP | GetEventClass (LPGUID guid)
STDMETHODIMP | GetEventType (EventEnum *e)
STDMETHODIMP | GetInterface (IID *iid)
STDMETHODIMP | OnObjectConstruct (COMSVCSEVENTINFO *pInfo, REFGUID guidClass, LPCOLESTR pszConstructString, ULONG64 ObjectID)

Detailed Description

Definition at line 30 of file Objconstsub.h.

Constructor & Destructor Documentation

CObjConstSub::CObjConstSub ( CComSpy * pSpy ) [inline]

Definition at line 35 of file Objconstsub.h.

  {
    m_pSpy = pSpy;
  }

CObjConstSub::CObjConstSub ( ) [inline]

Definition at line 40 of file Objconstsub.h.

  {
    m_pSpy = NULL;
  }

Member Function Documentation

STDMETHODIMP CObjConstSub::GetEventClass ( LPGUID guid ) [inline, virtual]

Implements CSysLCESub.

Definition at line 54 of file Objconstsub.h.

{*guid = CLSID_ComServiceEvents;return S_OK;}

STDMETHODIMP CObjConstSub::GetEventType ( EventEnum * e ) [inline, virtual]

Implements CSysLCESub.

Definition at line 53 of file Objconstsub.h.

{*e = ObjectConstruction;return S_OK;}

STDMETHODIMP CObjConstSub::GetInterface ( IID * iid ) [inline, virtual]

Implements CSysLCESub.

Definition at line 55 of file Objconstsub.h.

{*iid = IID_IComObjectConstructionEvents;return S_OK;}

STDMETHODIMP CObjConstSub::OnObjectConstruct | ( | COMSVCSEVENTINFO * | pInfo,
 |  | REFGUID | guidClass,
 |  | LPCOLESTR | pszConstructString,
 |  | ULONG64 | ObjectID |
 | ) |  |  | [inline]

Definition at line 57 of file Objconstsub.h.

  {

    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnObjConstPutObject"), GuidToBstr(pInfo->guidApp));
    m_pSpy -> AddParamValueToList(L"guidClass", GuidToBstr( guidClass ));
    m_pSpy -> AddParamValueToList(L"sConstructString", pszConstructString);

    WCHAR szObjectID[32];
    wsprintfW(szObjectID, L"0x%016X", ObjectID);
    m_pSpy -> AddParamValueToList(L"ObjectID", szObjectID);

    IF_AUDIT_DO(OnObjectConstruct)(pInfo->perfCount,GuidToBstr(pInfo->guidApp),
                    GuidToBstr( guidClass ),
                    pszConstructString,
                    szObjectID
                    );

    return S_OK;
  }

The documentation for this class was generated from the following file:
  • Com/Administration/Spy/ComSpyCtl/Objconstsub.h
Generated on Wed Nov 13 2024 16:56:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CObjData Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes

CObjData Class Reference

#include "ExtObjData.h"

Inherited by CClusterData, CClusterData, CGroupData, CGroupData, CNetInterfaceData, CNetInterfaceData, CNetworkData, CNetworkData, CNodeData, CNodeData, CResData, CResData, CResTypeData, and CResTypeData.

List of all members.

Public Member Functions

CObjData (void)
CObjData (void)
virtual | ~CObjData (void)
virtual | ~CObjData (void)
virtual HRESULT | AddContextMenuItems (IWCContextMenuCallback *piCallbackIn)
virtual HRESULT | AddContextMenuItems (IWCContextMenuCallback *piCallbackIn)
CLUADMEX_OBJECT_TYPE | Cot (void)
CLUADMEX_OBJECT_TYPE | Cot (void)
virtual HRESULT | GetPropertySheetPages (CRuntimeClass ***ppaPropSheetsOut)
virtual HRESULT | GetPropertySheetPages (CRuntimeClass ***ppaPropSheetsOut)
virtual HRESULT | GetWizardPages (CRuntimeClass ***ppaWizardPagesOut)
virtual HRESULT | GetWizardPages (CRuntimeClass ***ppaWizardPagesOut)
virtual HRESULT | InvokeCommand (ULONG nCommandIDIn)
virtual HRESULT | InvokeCommand (ULONG nCommandIDIn)
virtual CString | StrName (void)
virtual CString | StrName (void)

Static Public Member Functions

static HRESULT | S_HrCreateObject (IUnknown *piDataIn, CObjData **ppodOut)
static HRESULT | S_HrCreateObject (IUnknown *piDataIn, CObjData **ppodOut)

Protected Member Functions

virtual HRESULT | AddContextMenuItem (IWCContextMenuCallback *piCallbackIn, UINT nMenuItem, UINT nMenuItemDesc, UINT nBaseID, ULONG uFlags)
virtual HRESULT | AddContextMenuItem (IWCContextMenuCallback *piCallbackIn, UINT nMenuItem, UINT nMenuItemDesc, UINT nBaseID, ULONG uFlags)
virtual HRESULT | HrInitialize (IUnknown *piDataIn)
virtual HRESULT | HrInitialize (IUnknown *piDataIn)

Protected Attributes

CLUADMEX_OBJECT_TYPE | m_cot
CRuntimeClass ** | m_rgprtcPSPages
CRuntimeClass ** | m_rgprtcWizPages
CString m_strName

Detailed Description

Definition at line 47 of file ExtObjData.h.

Constructor & Destructor Documentation

CObjData::CObjData ( void ) [inline]

Definition at line 68 of file ExtObjData.h.

    {
        m_cot = CLUADMEX_OT_NONE;
        m_rgprtcPSPages = NULL;
        m_rgprtcWizPages = NULL;
    } // *** CObjData

virtual CObjData::~CObjData ( void ) [inline, virtual]

Definition at line 75 of file ExtObjData.h.

{}

CObjData::CObjData ( void ) [inline]

Definition at line 68 of file ExtObjData.h.

    {
        m_cot = CLUADMEX_OT_NONE;
        m_rgprtcPSPages = NULL;
        m_rgprtcWizPages = NULL;
    } // *** CObjData

virtual CObjData::~CObjData ( void ) [inline, virtual]

Definition at line 75 of file ExtObjData.h.

{}

Member Function Documentation

HRESULT CObjData::AddContextMenuItem | ( | IWCContextMenuCallback * | piCallbackIn,
 |  | UINT | nMenuItem,
 |  | UINT | nMenuItemDesc,
 |  | UINT | nBaseID,
 |  | ULONG | uFlags |
 | ) |  |  | [protected, virtual]

Definition at line 175 of file ExtObjData.cpp.

{
    HRESULT hr = S_OK;
    CString strMenuItem;
    CString strStatusBarText;
    LPWSTR  pwszMenuItem = NULL;
    LPWSTR  pwszStatusBarText = NULL;

    ASSERT( piCallbackIn != NULL );

    //
    //  Get strings.
    //

    strMenuItem.LoadString( nMenuItem );
    strStatusBarText.LoadString( nMenuItemDesc );
    pwszMenuItem = strMenuItem.GetBuffer( 1 );
    pwszStatusBarText = strStatusBarText.GetBuffer( 1 );

    //
    //  Add item to the context menu.
    //

    hr = piCallbackIn->AddExtensionMenuItem(
                              pwszMenuItem            // lpszName
                            , pwszStatusBarText       // lpszStatusBarText
                            , nBaseID                 // lCommandID
                            , 0                       // lSubCommandID - reserved, must be 0
                            , uFlags                  // uFlags
                            );

    //
    //  Release strings.
    //

    strMenuItem.ReleaseBuffer();
    strStatusBarText.ReleaseBuffer();

    return hr;

} //*** CObjData::AddContextMenuItem

virtual HRESULT CObjData::AddContextMenuItem | ( | IWCContextMenuCallback * | piCallbackIn,
 |  | UINT | nMenuItem,
 |  | UINT | nMenuItemDesc,
 |  | UINT | nBaseID,
 |  | ULONG | uFlags |
 | ) |  |  | [protected, virtual]
virtual HRESULT CObjData::AddContextMenuItems ( IWCContextMenuCallback * piCallbackIn ) [inline, virtual]

Reimplemented in CClusterData, CNodeData, CGroupData, CResData, CResTypeData, CNetworkData, CNetInterfaceData, CClusterData, CNodeData, CGroupData, CResData, CResTypeData, CNetworkData, and CNetInterfaceData.

Definition at line 84 of file ExtObjData.h.

    {
        UNREFERENCED_PARAMETER( piCallbackIn );
        return E_NOTIMPL;
    } // *** AddContextMenuItems

virtual HRESULT CObjData::AddContextMenuItems ( IWCContextMenuCallback * piCallbackIn ) [inline, virtual]

Reimplemented in CClusterData, CNodeData, CGroupData, CResData, CResTypeData, CNetworkData, CNetInterfaceData, CClusterData, CNodeData, CGroupData, CResData, CResTypeData, CNetworkData, and CNetInterfaceData.

Definition at line 84 of file ExtObjData.h.

    {
        UNREFERENCED_PARAMETER( piCallbackIn );
        return E_NOTIMPL;
    } // *** AddContextMenuItems

CLUADMEX_OBJECT_TYPE CObjData::Cot ( void ) [inline]

Definition at line 126 of file ExtObjData.h.

    {
        return m_cot;
    } // *** Cot

CLUADMEX_OBJECT_TYPE CObjData::Cot ( void ) [inline]

Definition at line 126 of file ExtObjData.h.

    {
        return m_cot;
    } // *** Cot

virtual HRESULT CObjData::GetPropertySheetPages ( CRuntimeClass *** ppaPropSheetsOut ) [inline, virtual]

Reimplemented in CResData, and CResData.

Definition at line 102 of file ExtObjData.h.

    {
        UNREFERENCED_PARAMETER( ppaPropSheetsOut );
        return E_NOTIMPL;
    } // *** GetPropertySheetPages

virtual HRESULT CObjData::GetPropertySheetPages ( CRuntimeClass *** ppaPropSheetsOut ) [inline, virtual]

Reimplemented in CResData, and CResData.

Definition at line 102 of file ExtObjData.h.

    {
        UNREFERENCED_PARAMETER( ppaPropSheetsOut );
        return E_NOTIMPL;
    } // *** GetPropertySheetPages

virtual HRESULT CObjData::GetWizardPages ( CRuntimeClass *** ppaWizardPagesOut ) [inline, virtual]

Reimplemented in CResData, and CResData.

Definition at line 111 of file ExtObjData.h.

    {
        UNREFERENCED_PARAMETER( ppaWizardPagesOut );
        return E_NOTIMPL;
    } // *** GetWizardPages

virtual HRESULT CObjData::GetWizardPages ( CRuntimeClass *** ppaWizardPagesOut ) [inline, virtual]

Reimplemented in CResData, and CResData.

Definition at line 111 of file ExtObjData.h.

    {
        UNREFERENCED_PARAMETER( ppaWizardPagesOut );
        return E_NOTIMPL;
    } // *** GetWizardPages

virtual HRESULT CObjData::HrInitialize ( IUnknown * piDataIn ) [protected, virtual]

Reimplemented in CClusterData, CNodeData, CGroupData, CResData, CResTypeData, CNetworkData, CNetInterfaceData, CClusterData, CNodeData, CGroupData, CResData, CResTypeData, CNetworkData, and CNetInterfaceData.

HRESULT CObjData::HrInitialize ( IUnknown * piDataIn ) [protected, virtual]

Reimplemented in CClusterData, CNodeData, CGroupData, CResData, CResTypeData, CNetworkData, CNetInterfaceData, CClusterData, CNodeData, CGroupData, CResData, CResTypeData, CNetworkData, and CNetInterfaceData.

Definition at line 240 of file ExtObjData.cpp.

{
    HRESULT                 hr = S_OK;
    BSTR                    bstrName = NULL;
    LONG                    cchName = 0;
    IGetClusterObjectInfo * piObjInfo = NULL;

    ASSERT( piDataIn != NULL );

    //
    // Get an interface pointer to IGetClusterObjectInfo.
    //

    hr = piDataIn->QueryInterface( IID_IGetClusterObjectInfo, reinterpret_cast< LPVOID * >( &piObjInfo ) );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if: error querying for interface

    //
    // Allocate a buffer for the object name.
    //

    hr = piObjInfo->GetObjectName( 0, NULL, &cchName );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if: error getting the name length

    bstrName = SysAllocStringLen( NULL, cchName );
    if ( bstrName == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if: error allocating a string

    //
    // Retrieve the object name.
    //

    hr = piObjInfo->GetObjectName( 0, bstrName, &cchName );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if: error getting the name

    //
    // The CString assignment operator makes a copy.
    //

    m_strName = bstrName;

Cleanup:

    SysFreeString( bstrName );

    if ( piObjInfo != NULL )
    {
        piObjInfo->Release();
    } // if:

    return hr;

} //*** CObjData::HrInitialize

virtual HRESULT CObjData::InvokeCommand ( ULONG nCommandIDIn ) [inline, virtual]

Reimplemented in CClusterData, CNodeData, CGroupData, CResData, CResTypeData, CNetworkData, CNetInterfaceData, CClusterData, CNodeData, CGroupData, CResData, CResTypeData, CNetworkData, and CNetInterfaceData.

Definition at line 93 of file ExtObjData.h.

    {
        UNREFERENCED_PARAMETER( nCommandIDIn);
        return E_NOTIMPL;
    } // *** InvokeCommand

virtual HRESULT CObjData::InvokeCommand ( ULONG nCommandIDIn ) [inline, virtual]

Reimplemented in CClusterData, CNodeData, CGroupData, CResData, CResTypeData, CNetworkData, CNetInterfaceData, CClusterData, CNodeData, CGroupData, CResData, CResTypeData, CNetworkData, and CNetInterfaceData.

Definition at line 93 of file ExtObjData.h.

    {
        UNREFERENCED_PARAMETER( nCommandIDIn);
        return E_NOTIMPL;
    } // *** InvokeCommand

HRESULT CObjData::S_HrCreateObject | ( | IUnknown * | piDataIn,
 |  | CObjData ** | ppodOut |
 | ) |  |  | [static]

Definition at line 84 of file ExtObjData.cpp.

{
    HRESULT                 hr = S_OK;
    CObjData *              podData = NULL;
    CLUADMEX_OBJECT_TYPE    cot;
    IGetClusterObjectInfo * piObjInfo = NULL;

    ASSERT( piDataIn != NULL );
    ASSERT( ppodOut != NULL );

    hr = piDataIn->QueryInterface( IID_IGetClusterObjectInfo, reinterpret_cast< LPVOID * >( &piObjInfo ) );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if: error querying for interface

    cot = piObjInfo->GetObjectType( 0 );
    piObjInfo->Release();
    piObjInfo = NULL;

    switch ( cot )
    {
        case CLUADMEX_OT_RESOURCE:
            podData = new CResData();
            break;

        case CLUADMEX_OT_RESOURCETYPE:
            podData = new CResTypeData();
            break;

        default:
            hr = E_NOTIMPL;
            goto Cleanup;
            break;
    } // switch: object type

    if ( podData == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if: error allocating the object

    hr = podData->HrInitialize( piDataIn );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if: error initializing the object

    *ppodOut = podData;
    podData = NULL;         // We gave away ownership.

Cleanup:

    if ( piObjInfo != NULL )
    {
        piObjInfo->Release();
    } // if:

    delete podData;

    return hr;

} //*** CObjData::S_HrCreateObject

static HRESULT CObjData::S_HrCreateObject | ( | IUnknown * | piDataIn,
 |  | CObjData ** | ppodOut |
 | ) |  |  | [static]
virtual CString CObjData::StrName ( void ) [inline, virtual]

Definition at line 120 of file ExtObjData.h.

    {
        return m_strName;
    } // *** StrName

virtual CString CObjData::StrName ( void ) [inline, virtual]

Definition at line 120 of file ExtObjData.h.

    {
        return m_strName;
    } // *** StrName

Member Data Documentation

CLUADMEX_OBJECT_TYPE CObjData::m_cot [protected]

Definition at line 50 of file ExtObjData.h.

CRuntimeClass ** CObjData::m_rgprtcPSPages [protected]

Definition at line 52 of file ExtObjData.h.

CRuntimeClass ** CObjData::m_rgprtcWizPages [protected]

Definition at line 53 of file ExtObjData.h.

CString CObjData::m_strName [protected]

Definition at line 51 of file ExtObjData.h.

The documentation for this class was generated from the following files:
  • WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/ExtObjData.h
  • WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/ExtObjData.h
  • WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/ExtObjData.cpp
  • WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/ExtObjData.cpp
Generated on Wed Nov 13 2024 16:56:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CObject Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CObject Class Reference

Inherits com::ms::com::IUnknown, and com::ms::com::IUnknown.

List of all members.

Public Member Functions

CObject ()
CObject ()

Private Member Functions

STDMETHODIMP | QueryInterface (REFIID iid, void **ppv)
STDMETHODIMP | QueryInterface (REFIID iid, void **ppv)
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) Release(void)

Private Attributes

ULONG mcRef

Detailed Description

Definition at line 106 of file OleImp.Cpp.

Constructor & Destructor Documentation

CObject::CObject ( ) [inline]

Definition at line 118 of file OleImp.Cpp.

{ mcRef = 1; }

CObject::CObject ( ) [inline]

Definition at line 97 of file OleApt.Cpp.

{ mcRef = 1; }

Member Function Documentation

STDMETHODIMP CObject::QueryInterface | ( | REFIID | iid,
 |  | void ** | ppv |
 | ) |  |  | [private]

Definition at line 776 of file OleImp.Cpp.

{
    *ppv = NULL;

    if (iid == IID_IUnknown)
        {
        *ppv = (IUnknown *)this;
        }
    if (*ppv != NULL)
        {
        AddRef();
        return S_OK;
        }
    return E_NOINTERFACE;
}  // CObject::QueryInterface

STDMETHODIMP CObject::QueryInterface | ( | REFIID | iid,
 |  | void ** | ppv |
 | ) |  |  | [private]
CObject::STDMETHODIMP_ ( ULONG ) [inline, private]

Definition at line 89 of file OleApt.Cpp.

{ return mcRef++; }

CObject::STDMETHODIMP_ ( ULONG ) [inline, private]

Definition at line 110 of file OleImp.Cpp.

{ return mcRef++; }

CObject::STDMETHODIMP_ ( ULONG ) [private]
CObject::STDMETHODIMP_ ( ULONG ) [private]

Member Data Documentation

ULONG CObject::mcRef [private]

Definition at line 114 of file OleImp.Cpp.

The documentation for this class was generated from the following files:
  • Com/Fundamentals/DCom/OleImp/OleImp.Cpp
  • Com/Fundamentals/OleApt/OleApt.Cpp
Generated on Wed Nov 13 2024 16:56:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CObjPool2Sub Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CObjPool2Sub Class Reference

#include "ObjPool2sub.h"

Inherits CSysLCESub.

List of all members.

Public Member Functions

CObjPool2Sub (CComSpy *pSpy)
CObjPool2Sub ()
STDMETHODIMP | GetEventClass (LPGUID guid)
STDMETHODIMP | GetEventType (EventEnum *e)
STDMETHODIMP | GetInterface (IID *iid)
STDMETHODIMP | OnObjPoolCreateDecision (COMSVCSEVENTINFO *pInfo, DWORD dwThreadsWaiting, DWORD dwAvail, DWORD dwCreated, DWORD dwMin, DWORD dwMax)
STDMETHODIMP | OnObjPoolCreateObject (COMSVCSEVENTINFO *pInfo, REFGUID guidClass, DWORD dwObjsCreated, ULONG64 ObjectID)
STDMETHODIMP | OnObjPoolCreatePool (COMSVCSEVENTINFO *pInfo, REFGUID guidClass, DWORD dwMin, DWORD dwMax, DWORD dwTimeout)
STDMETHODIMP | OnObjPoolDestroyObject (COMSVCSEVENTINFO *pInfo, REFGUID guidClass, DWORD dwObjsCreated, ULONG64 ObjectID)
STDMETHODIMP | OnObjPoolTimeout (COMSVCSEVENTINFO *pInfo, REFGUID guidActivity, REFGUID guidClass, DWORD dwTimeout)

Detailed Description

Definition at line 30 of file ObjPool2sub.h.

Constructor & Destructor Documentation

CObjPool2Sub::CObjPool2Sub ( CComSpy * pSpy ) [inline]

Definition at line 35 of file ObjPool2sub.h.

  {
    m_pSpy = pSpy;
  }

CObjPool2Sub::CObjPool2Sub ( ) [inline]

Definition at line 40 of file ObjPool2sub.h.

  {
    m_pSpy = NULL;
  }

Member Function Documentation

STDMETHODIMP CObjPool2Sub::GetEventClass ( LPGUID guid ) [inline, virtual]

Implements CSysLCESub.

Definition at line 54 of file ObjPool2sub.h.

{*guid = CLSID_ComServiceEvents;return S_OK;}

STDMETHODIMP CObjPool2Sub::GetEventType ( EventEnum * e ) [inline, virtual]

Implements CSysLCESub.

Definition at line 53 of file ObjPool2sub.h.

{*e = ObjectPool2;return S_OK;}

STDMETHODIMP CObjPool2Sub::GetInterface ( IID * iid ) [inline, virtual]

Implements CSysLCESub.

Definition at line 55 of file ObjPool2sub.h.

{*iid = IID_IComObjectPoolEvents2;return S_OK;}

STDMETHODIMP CObjPool2Sub::OnObjPoolCreateDecision | ( | COMSVCSEVENTINFO * | pInfo,
 |  | DWORD | dwThreadsWaiting,
 |  | DWORD | dwAvail,
 |  | DWORD | dwCreated,
 |  | DWORD | dwMin,
 |  | DWORD | dwMax |
 | ) |  |  | [inline]

Definition at line 107 of file ObjPool2sub.h.

  {
    WCHAR p1[16];
    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnObjPoolCreateDecision"), GuidToBstr(pInfo->guidApp));
    wsprintfW(p1,  L"%lu", dwThreadsWaiting);
    m_pSpy -> AddParamValueToList(L"dwThreadsWaiting", p1);
    wsprintfW(p1,  L"%lu", dwAvail);
    m_pSpy -> AddParamValueToList(L"dwAvail", p1);
    wsprintfW(p1,  L"%lu", dwCreated);
    m_pSpy -> AddParamValueToList(L"dwCreated", p1);
    wsprintfW(p1,  L"%lu", dwMin);
    m_pSpy -> AddParamValueToList(L"dwMin", p1);
    wsprintfW(p1,  L"%lu", dwMax);
    m_pSpy -> AddParamValueToList(L"dwMax", p1);

    IF_AUDIT_DO(OnObjPoolCreateDecision)(pInfo->perfCount, GuidToBstr(pInfo->guidApp),
                    dwThreadsWaiting,
                    dwAvail,
                    dwCreated,
                    dwMin,
                    dwMax);
    return S_OK;
  }

STDMETHODIMP CObjPool2Sub::OnObjPoolCreateObject | ( | COMSVCSEVENTINFO * | pInfo,
 |  | REFGUID | guidClass,
 |  | DWORD | dwObjsCreated,
 |  | ULONG64 | ObjectID |
 | ) |  |  | [inline]

Definition at line 57 of file ObjPool2sub.h.

  {

    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnObjPoolCreateObject"), GuidToBstr(pInfo->guidApp));
    m_pSpy -> AddParamValueToList(L"guidClass", GuidToBstr( guidClass ));

    WCHAR p1[16];
    wsprintfW(p1, L"%lu", dwObjsCreated);
    m_pSpy -> AddParamValueToList(L"dwObjsCreated", p1);

    WCHAR szObjectID[32];
    wsprintfW(szObjectID, L"0x%08X", ObjectID);
    m_pSpy -> AddParamValueToList(L"ObjectID", szObjectID);

    IF_AUDIT_DO(OnObjPoolCreateObject)(pInfo->perfCount, GuidToBstr(pInfo->guidApp),
                    GuidToBstr( guidClass ),
                    dwObjsCreated,
                    szObjectID);
    return S_OK;
  }

STDMETHODIMP CObjPool2Sub::OnObjPoolCreatePool | ( | COMSVCSEVENTINFO * | pInfo,
 |  | REFGUID | guidClass,
 |  | DWORD | dwMin,
 |  | DWORD | dwMax,
 |  | DWORD | dwTimeout |
 | ) |  |  | [inline]

Definition at line 157 of file ObjPool2sub.h.

  {
    WCHAR p1[16];
    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnObjPoolCreatePool"), GuidToBstr(pInfo->guidApp));
    m_pSpy -> AddParamValueToList(L"guidClass", GuidToBstr( guidClass ));
    wsprintfW(p1,  L"0x%08X", dwMin);
    m_pSpy -> AddParamValueToList(L"dwMin", p1);
    wsprintfW(p1,  L"0x%08X", dwMax);
    m_pSpy -> AddParamValueToList(L"dwMax", p1);
    wsprintfW(p1,L"0x%08X", dwTimeout);
    m_pSpy -> AddParamValueToList(L"dwTimeout", p1);

    IF_AUDIT_DO(OnObjPoolCreatePool)(pInfo->perfCount, GuidToBstr(pInfo->guidApp),
                    GuidToBstr( guidClass ),
                    dwMin,
                    dwMax,
                    dwTimeout);

    return S_OK;
  }

STDMETHODIMP CObjPool2Sub::OnObjPoolDestroyObject | ( | COMSVCSEVENTINFO * | pInfo,
 |  | REFGUID | guidClass,
 |  | DWORD | dwObjsCreated,
 |  | ULONG64 | ObjectID |
 | ) |  |  | [inline]

Definition at line 82 of file ObjPool2sub.h.

  {

    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnObjPoolDestroyObject"), GuidToBstr(pInfo->guidApp));
    m_pSpy -> AddParamValueToList(L"guidClass", GuidToBstr( guidClass ));

    WCHAR p1[16];
    wsprintfW(p1, L"%lu", dwObjsCreated);
    m_pSpy -> AddParamValueToList(L"dwObjsCreated", p1);

    WCHAR szObjectID[32];
    wsprintfW(szObjectID, L"0x%08X", ObjectID);
    m_pSpy -> AddParamValueToList(L"ObjectID", szObjectID);

    IF_AUDIT_DO(OnObjPoolDestroyObject)(pInfo->perfCount, GuidToBstr(pInfo->guidApp),
                    GuidToBstr( guidClass ),
                    dwObjsCreated,
                    szObjectID);

    return S_OK;
  }

STDMETHODIMP CObjPool2Sub::OnObjPoolTimeout | ( | COMSVCSEVENTINFO * | pInfo,
 |  | REFGUID | guidActivity,
 |  | REFGUID | guidClass,
 |  | DWORD | dwTimeout |
 | ) |  |  | [inline]

Definition at line 137 of file ObjPool2sub.h.

  {
    WCHAR p1[16];
    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnObjPoolGetFromTx"), GuidToBstr(pInfo->guidApp));
    m_pSpy -> AddParamValueToList(L"guidActivity", GuidToBstr( guidActivity ));
    m_pSpy -> AddParamValueToList(L"guidClass", GuidToBstr( guidClass ));
    wsprintfW(p1,L"0x%08X", dwTimeout);
    m_pSpy -> AddParamValueToList(L"dwTimeout", p1);

    IF_AUDIT_DO(OnObjPoolTimeout)(pInfo->perfCount, GuidToBstr(pInfo->guidApp),
                    GuidToBstr( guidActivity ),
                    GuidToBstr( guidClass ),
                    dwTimeout);

    return S_OK;
  }

The documentation for this class was generated from the following file:
  • Com/Administration/Spy/ComSpyCtl/ObjPool2sub.h
Generated on Wed Nov 13 2024 16:56:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CObjPoolSub Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CObjPoolSub Class Reference

#include "ObjPoolsub.h"

Inherits CSysLCESub.

List of all members.

Public Member Functions

CObjPoolSub (CComSpy *pSpy)
CObjPoolSub ()
STDMETHODIMP | GetEventClass (LPGUID guid)
STDMETHODIMP | GetEventType (EventEnum *e)
STDMETHODIMP | GetInterface (IID *iid)
STDMETHODIMP | OnObjPoolGetFromTx (COMSVCSEVENTINFO *pInfo, REFGUID guidActivity, REFGUID guidClass, REFGUID guidTx, ULONG64 ObjectID)
STDMETHODIMP | OnObjPoolGetObject (COMSVCSEVENTINFO *pInfo, REFGUID guidActivity, REFGUID guidClass, DWORD dwAvailable, ULONG64 ObjectID)
STDMETHODIMP | OnObjPoolPutObject (COMSVCSEVENTINFO *pInfo, REFGUID guidClass, int nReason, DWORD dwAvailable, ULONG64 ObjectID)
STDMETHODIMP | OnObjPoolRecycleToTx (COMSVCSEVENTINFO *pInfo, REFGUID guidActivity, REFGUID guidClass, REFGUID guidTx, ULONG64 ObjectID)

Detailed Description

Definition at line 30 of file ObjPoolsub.h.

Constructor & Destructor Documentation

CObjPoolSub::CObjPoolSub ( CComSpy * pSpy ) [inline]

Definition at line 35 of file ObjPoolsub.h.

  {
    m_pSpy = pSpy;
  }

CObjPoolSub::CObjPoolSub ( ) [inline]

Definition at line 40 of file ObjPoolsub.h.

  {
    m_pSpy = NULL;
  }

Member Function Documentation

STDMETHODIMP CObjPoolSub::GetEventClass ( LPGUID guid ) [inline, virtual]

Implements CSysLCESub.

Definition at line 55 of file ObjPoolsub.h.

{*guid = CLSID_ComServiceEvents;return S_OK;}

STDMETHODIMP CObjPoolSub::GetEventType ( EventEnum * e ) [inline, virtual]

Implements CSysLCESub.

Definition at line 54 of file ObjPoolsub.h.

{*e = ObjectPool;return S_OK;}

STDMETHODIMP CObjPoolSub::GetInterface ( IID * iid ) [inline, virtual]

Implements CSysLCESub.

Definition at line 56 of file ObjPoolsub.h.

{*iid = IID_IComObjectPoolEvents;return S_OK;}

STDMETHODIMP CObjPoolSub::OnObjPoolGetFromTx | ( | COMSVCSEVENTINFO * | pInfo,
 |  | REFGUID | guidActivity,
 |  | REFGUID | guidClass,
 |  | REFGUID | guidTx,
 |  | ULONG64 | ObjectID |
 | ) |  |  | [inline]

Definition at line 141 of file ObjPoolsub.h.

  {

    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnObjPoolGetFromTx"), GuidToBstr(pInfo->guidApp));
    m_pSpy -> AddParamValueToList(L"guidActivity", GuidToBstr( guidActivity ));
    m_pSpy -> AddParamValueToList(L"guidClass", GuidToBstr( guidClass ));
    m_pSpy -> AddParamValueToList(L"guidTx", GuidToBstr( guidTx ));

    WCHAR szObjectID[32];
    wsprintfW(szObjectID, L"0x%016X", ObjectID);
    m_pSpy -> AddParamValueToList(L"ObjectID", szObjectID);

    IF_AUDIT_DO(OnObjPoolGetFromTx)(pInfo->perfCount, GuidToBstr(pInfo->guidApp),
                    GuidToBstr( guidActivity ),
                    GuidToBstr( guidClass ),
                    GuidToBstr( guidTx ),
                    szObjectID);

    return S_OK;
  }

STDMETHODIMP CObjPoolSub::OnObjPoolGetObject | ( | COMSVCSEVENTINFO * | pInfo,
 |  | REFGUID | guidActivity,
 |  | REFGUID | guidClass,
 |  | DWORD | dwAvailable,
 |  | ULONG64 | ObjectID |
 | ) |  |  | [inline]

Definition at line 88 of file ObjPoolsub.h.

  {
    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnObjPoolGetObject"), GuidToBstr(pInfo->guidApp));

    m_pSpy -> AddParamValueToList(L"guidActivity", GuidToBstr( guidActivity ));
    m_pSpy -> AddParamValueToList(L"guidClass", GuidToBstr( guidClass ));

    WCHAR p1[16];
    wsprintfW(p1, L"%d", dwAvailable);
    m_pSpy -> AddParamValueToList(L"dwAvailable", p1);

    WCHAR szObjectID[32];
    wsprintfW(szObjectID, L"0x%016X", ObjectID);
    m_pSpy -> AddParamValueToList(L"ObjectID", szObjectID);

    IF_AUDIT_DO(OnObjPoolGetObject)(pInfo->perfCount, GuidToBstr(pInfo->guidApp),
                    GuidToBstr( guidActivity ),
                    GuidToBstr( guidClass ),
                    dwAvailable,
                    szObjectID);

    return S_OK;
  }

STDMETHODIMP CObjPoolSub::OnObjPoolPutObject | ( | COMSVCSEVENTINFO * | pInfo,
 |  | REFGUID | guidClass,
 |  | int | nReason,
 |  | DWORD | dwAvailable,
 |  | ULONG64 | ObjectID |
 | ) |  |  | [inline]

Definition at line 58 of file ObjPoolsub.h.

  {
    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnObjPoolPutObject"), GuidToBstr(pInfo->guidApp));

    m_pSpy -> AddParamValueToList(L"guidClass", GuidToBstr( guidClass ));

    WCHAR p1[16];
    wsprintfW(p1, L"0x%08X", nReason);
    m_pSpy -> AddParamValueToList(L"nReason", p1);

    wsprintfW(p1, L"%lu", dwAvailable);
    m_pSpy -> AddParamValueToList(L"dwAvailable", p1);

    WCHAR szObjectID[32];
    wsprintfW(szObjectID, L"0x%016X", ObjectID);
    m_pSpy -> AddParamValueToList(L"ObjectID", szObjectID);

    IF_AUDIT_DO(OnObjPoolPutObject)(pInfo->perfCount, GuidToBstr(pInfo->guidApp),
                    GuidToBstr( guidClass ),
                    nReason,
                    dwAvailable,
                    szObjectID);
    return S_OK;
  }

STDMETHODIMP CObjPoolSub::OnObjPoolRecycleToTx | ( | COMSVCSEVENTINFO * | pInfo,
 |  | REFGUID | guidActivity,
 |  | REFGUID | guidClass,
 |  | REFGUID | guidTx,
 |  | ULONG64 | ObjectID |
 | ) |  |  | [inline]

Definition at line 116 of file ObjPoolsub.h.

  {
    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnObjPoolRecycleToTx"), GuidToBstr(pInfo->guidApp));

    m_pSpy -> AddParamValueToList(L"guidActivity", GuidToBstr( guidActivity ));
    m_pSpy -> AddParamValueToList(L"guidClass", GuidToBstr( guidClass ));
    m_pSpy -> AddParamValueToList(L"guidTx", GuidToBstr( guidTx ));

    WCHAR szObjectID[32];
    wsprintfW(szObjectID, L"0x%016X", ObjectID);
    m_pSpy -> AddParamValueToList(L"ObjectID", szObjectID);

    IF_AUDIT_DO(OnObjPoolRecycleToTx)(pInfo->perfCount, GuidToBstr(pInfo->guidApp),
                    GuidToBstr( guidActivity ),
                    GuidToBstr( guidClass ),
                    GuidToBstr( guidTx ),
                    szObjectID);

    return S_OK;
  }

The documentation for this class was generated from the following file:
  • Com/Administration/Spy/ComSpyCtl/ObjPoolsub.h
Generated on Wed Nov 13 2024 16:56:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CObjSecurity Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CObjSecurity Class Reference

List of all members.

Public Member Functions

CObjSecurity ()
virtual | ~CObjSecurity ()
STDMETHOD() | GetAccessRights (const GUID *pguidObjectType, DWORD dwFlags, PSI_ACCESS *ppAccess, ULONG *pcAccesses, ULONG *piDefaultAccess)
STDMETHOD() | GetInheritTypes (PSI_INHERIT_TYPE *ppInheritTypes, ULONG *pcInheritTypes)
STDMETHOD() | GetObjectInformation (PSI_OBJECT_INFO pObjectInfo)
STDMETHOD() | GetSecurity (SECURITY_INFORMATION si, PSECURITY_DESCRIPTOR *ppSD, BOOL fDefault)
STDMETHOD() | Initialize (DWORD dwFlags, PSECURITY_DESCRIPTOR *ppSD, WORD wClient, LPCWSTR pszServer, BOOL fContainer)
STDMETHOD() | MapGeneric (const GUID *pguidObjectType, UCHAR *pAceFlags, ACCESS_MASK *pmask)
STDMETHOD() | PropertySheetPageCallback (HWND hwnd, UINT uMsg, SI_PAGE_TYPE uPage)
STDMETHOD() | QueryInterface (REFIID, LPVOID *)
STDMETHOD() | SetSecurity (SECURITY_INFORMATION si, PSECURITY_DESCRIPTOR pSD)
STDMETHOD_ (ULONG, Release)()
STDMETHOD_ (ULONG, AddRef)()

Protected Attributes

ULONG m_cRef
DWORD m_dwSIFlags
PSECURITY_DESCRIPTOR * | m_ppSD
LPWSTR | m_pszObjectName
LPWSTR | m_pszServerName
WORD | m_wClient

Detailed Description

Definition at line 96 of file Privobji.Cpp.

Constructor & Destructor Documentation

CObjSecurity::CObjSecurity ( ) [inline]

Definition at line 107 of file Privobji.Cpp.

: m_cRef(1) {}

CObjSecurity::~CObjSecurity ( ) [virtual]

Definition at line 181 of file Privobji.Cpp.

{
    LocalFreeString(&m_pszServerName);
    LocalFreeString(&m_pszObjectName);

}

Member Function Documentation

STDMETHODIMP CObjSecurity::GetAccessRights | ( | const GUID * | pguidObjectType,
 |  | DWORD | dwFlags,
 |  | PSI_ACCESS * | ppAccess,
 |  | ULONG * | pcAccesses,
 |  | ULONG * | piDefaultAccess
 | ) |  |

Definition at line 329 of file Privobji.Cpp.

{
    *ppAccesses = g_siObjAccesses;
    *pcAccesses = sizeof(g_siObjAccesses)/sizeof(g_siObjAccesses[0]);
    *piDefaultAccess = g_iObjDefAccess;

    return S_OK;
}

STDMETHODIMP CObjSecurity::GetInheritTypes | ( | PSI_INHERIT_TYPE * | ppInheritTypes,
 |  | ULONG * | pcInheritTypes
 | ) |  |

Definition at line 353 of file Privobji.Cpp.

{
    *ppInheritTypes = g_siObjInheritTypes;
    *pcInheritTypes = sizeof(g_siObjInheritTypes)/sizeof(g_siObjInheritTypes[0]);

    return S_OK;
}

STDMETHODIMP CObjSecurity::GetObjectInformation ( PSI_OBJECT_INFO pObjectInfo )

Definition at line 266 of file Privobji.Cpp.

{
    pObjectInfo->dwFlags = m_dwSIFlags;
    pObjectInfo->hInstance = g_hInstance;
    pObjectInfo->pszServerName = m_pszServerName;
    pObjectInfo->pszObjectName = m_pszObjectName;

    return S_OK;
}

STDMETHODIMP CObjSecurity::GetSecurity | ( | SECURITY_INFORMATION | si,
 |  | PSECURITY_DESCRIPTOR * | ppSD,
 |  | BOOL | fDefault
 | ) |  |

Definition at line 277 of file Privobji.Cpp.

{
    DWORD dwLength = 0;
    DWORD dwErr = 0;

    *ppSD = NULL;

    if (fDefault)
        return E_NOTIMPL;

    //
    // Assume that required privileges have already been enabled
    //
    GetPrivateObjectSecurity(*m_ppSD, si, NULL, 0, &dwLength);
    if (dwLength)
    {
        *ppSD = LocalAlloc(LPTR, dwLength);
        if (*ppSD &&
            !GetPrivateObjectSecurity(*m_ppSD, si, *ppSD, dwLength, &dwLength))
        {
            dwErr = GetLastError();
            LocalFree(*ppSD);
            *ppSD = NULL;
        }
    }
    else
        dwErr = GetLastError();

    return HRESULT_FROM_WIN32(dwErr);
}

STDMETHODIMP CObjSecurity::Initialize | ( | DWORD | dwFlags,
 |  | PSECURITY_DESCRIPTOR * | ppSD,
 |  | WORD | wClient,
 |  | LPCWSTR | pszServer,
 |  | BOOL | fContainer
 | ) |  |

Definition at line 190 of file Privobji.Cpp.

{
    HRESULT hr;

    m_dwSIFlags = dwFlags;
    if(fContainer)
        m_dwSIFlags |= SI_CONTAINER;
    m_ppSD = ppSD;
    m_wClient = wClient;

    hr = LocalAllocString(&m_pszServerName, pszServer);

    if(SUCCEEDED(hr))
    {
        if(fContainer)
            hr = LocalAllocString(&m_pszObjectName,L"Container");
        else
            hr = LocalAllocString(&m_pszObjectName,L"Object");
    }

    return hr;
}

STDMETHODIMP CObjSecurity::MapGeneric | ( | const GUID * | pguidObjectType,
 |  | UCHAR * | pAceFlags,
 |  | ACCESS_MASK * | pmask
 | ) |  |

Definition at line 343 of file Privobji.Cpp.

{
    MapGenericMask(pmask, &ObjMap);

    return S_OK;
}

STDMETHODIMP CObjSecurity::PropertySheetPageCallback | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | SI_PAGE_TYPE | uPage
 | ) |  |

Definition at line 363 of file Privobji.Cpp.

{
    return S_OK;
}

STDMETHOD() CObjSecurity::QueryInterface | ( | REFIID | ,
 |  | LPVOID * |
 | ) |  |
STDMETHODIMP CObjSecurity::SetSecurity | ( | SECURITY_INFORMATION | si,
 |  | PSECURITY_DESCRIPTOR | pSD
 | ) |  |

Definition at line 312 of file Privobji.Cpp.

{
    DWORD dwErr = 0;

    //
    // Assume that required privileges have already been enabled
    //
    if (!SetPrivateObjectSecurity(si, pSD, m_ppSD, &ObjMap, GetClientToken(m_wClient)))
        dwErr = GetLastError();

    return HRESULT_FROM_WIN32(dwErr);
}

CObjSecurity::STDMETHOD_ | ( | ULONG | ,
 |  | AddRef |
 | ) |  |
CObjSecurity::STDMETHOD_ | ( | ULONG | ,
 |  | Release |
 | ) |  |

Member Data Documentation

ULONG CObjSecurity::m_cRef [protected]

Definition at line 99 of file Privobji.Cpp.

DWORD CObjSecurity::m_dwSIFlags [protected]

Definition at line 100 of file Privobji.Cpp.

PSECURITY_DESCRIPTOR* CObjSecurity::m_ppSD [protected]

Definition at line 101 of file Privobji.Cpp.

LPWSTR CObjSecurity::m_pszObjectName [protected]

Definition at line 104 of file Privobji.Cpp.

LPWSTR CObjSecurity::m_pszServerName [protected]

Definition at line 103 of file Privobji.Cpp.

WORD CObjSecurity::m_wClient [protected]

Definition at line 102 of file Privobji.Cpp.

The documentation for this class was generated from the following file:
  • Security/Authorization/SecurObj/Privobji.Cpp
Generated on Wed Nov 13 2024 16:56:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CObjSub Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CObjSub Class Reference

#include "Objsub.h"

Inherits CSysLCESub.

List of all members.

Public Member Functions

CObjSub (CComSpy *pSpy)
CObjSub ()
STDMETHODIMP | GetEventClass (LPGUID guid)
STDMETHODIMP | GetEventType (EventEnum *e)
STDMETHODIMP | GetInterface (IID *iid)
STDMETHODIMP | OnDisableCommit (COMSVCSEVENTINFO *pInfo, ULONG64 ContextID)
STDMETHODIMP | OnEnableCommit (COMSVCSEVENTINFO *pInfo, ULONG64 ContextID)
STDMETHODIMP | OnObjectActivate (COMSVCSEVENTINFO *pInfo, ULONG64 CtxtID, ULONG64 ObjectID)
STDMETHODIMP | OnObjectDeactivate (COMSVCSEVENTINFO *pInfo, ULONG64 CtxtID, ULONG64 ObjectID)
STDMETHODIMP | OnSetAbort (COMSVCSEVENTINFO *pInfo, ULONG64 ContextID)
STDMETHODIMP | OnSetComplete (COMSVCSEVENTINFO *pInfo, ULONG64 ContextID)

Detailed Description

Definition at line 30 of file Objsub.h.

Constructor & Destructor Documentation

CObjSub::CObjSub ( CComSpy * pSpy ) [inline]

Definition at line 35 of file Objsub.h.

  {
    m_pSpy = pSpy;
  }

CObjSub::CObjSub ( ) [inline]

Definition at line 40 of file Objsub.h.

  {
    m_pSpy = NULL;
  }

Member Function Documentation

STDMETHODIMP CObjSub::GetEventClass ( LPGUID guid ) [inline, virtual]

Implements CSysLCESub.

Definition at line 55 of file Objsub.h.

{*guid = CLSID_ComServiceEvents;return S_OK;}

STDMETHODIMP CObjSub::GetEventType ( EventEnum * e ) [inline, virtual]

Implements CSysLCESub.

Definition at line 54 of file Objsub.h.

{*e = Object;return S_OK;}

STDMETHODIMP CObjSub::GetInterface ( IID * iid ) [inline, virtual]

Implements CSysLCESub.

Definition at line 56 of file Objsub.h.

{*iid = IID_IComObjectEvents;return S_OK;}

STDMETHODIMP CObjSub::OnDisableCommit | ( | COMSVCSEVENTINFO * | pInfo,
 |  | ULONG64 | ContextID |
 | ) |  |  | [inline]

Definition at line 58 of file Objsub.h.

  {
    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnDisableCommit"), GuidToBstr(pInfo->guidApp));

    WCHAR szCtxtID[32];
    wsprintfW(szCtxtID,  L"0x%016X", ContextID);
    m_pSpy -> AddParamValueToList(L"ContextID", szCtxtID);

    IF_AUDIT_DO(OnSetComplete)(pInfo->perfCount, GuidToBstr(pInfo->guidApp), szCtxtID);
    return S_OK;
  }

STDMETHODIMP CObjSub::OnEnableCommit | ( | COMSVCSEVENTINFO * | pInfo,
 |  | ULONG64 | ContextID |
 | ) |  |  | [inline]

Definition at line 70 of file Objsub.h.

  {
    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnEnableCommit"), GuidToBstr(pInfo->guidApp));

    WCHAR szCtxtID[32];
    wsprintfW(szCtxtID,  L"0x%016X", ContextID);
    m_pSpy -> AddParamValueToList(L"ContextID", szCtxtID);

    IF_AUDIT_DO(OnSetComplete)(pInfo->perfCount, GuidToBstr(pInfo->guidApp), szCtxtID);
    return S_OK;
  }

STDMETHODIMP CObjSub::OnObjectActivate | ( | COMSVCSEVENTINFO * | pInfo,
 |  | ULONG64 | CtxtID,
 |  | ULONG64 | ObjectID |
 | ) |  |  | [inline]

Definition at line 121 of file Objsub.h.

  {
    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnObjectActivate"), GuidToBstr(pInfo->guidApp));

    WCHAR szCtxtID[32], szObjID[32];

    wsprintfW(szCtxtID,L"0x%016X", CtxtID);
    m_pSpy -> AddParamValueToList(L"CtxtID", szCtxtID);
    wsprintfW(szObjID,L"0x%016X", ObjectID);
    m_pSpy -> AddParamValueToList(L"ObjectID", szObjID);

    IF_AUDIT_DO(OnObjectActivate)(pInfo->perfCount,GuidToBstr(pInfo->guidApp), szCtxtID, szObjID);
    return S_OK;
  }

STDMETHODIMP CObjSub::OnObjectDeactivate | ( | COMSVCSEVENTINFO * | pInfo,
 |  | ULONG64 | CtxtID,
 |  | ULONG64 | ObjectID |
 | ) |  |  | [inline]

Definition at line 106 of file Objsub.h.

  {
    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnObjectDeactivate"), GuidToBstr(pInfo->guidApp));

    WCHAR szCtxtID[32], szObjID[32];

    wsprintfW(szCtxtID,L"0x%016X", CtxtID);
    m_pSpy -> AddParamValueToList(L"CtxtID", szCtxtID);
    wsprintfW(szObjID,L"0x%016X", ObjectID);
    m_pSpy -> AddParamValueToList(L"ObjectID", szObjID);

    IF_AUDIT_DO(OnObjectActivate)(pInfo->perfCount,GuidToBstr(pInfo->guidApp), szCtxtID, szObjID);
    return S_OK;
  }

STDMETHODIMP CObjSub::OnSetAbort | ( | COMSVCSEVENTINFO * | pInfo,
 |  | ULONG64 | ContextID |
 | ) |  |  | [inline]

Definition at line 94 of file Objsub.h.

  {
    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnSetAbort"), GuidToBstr(pInfo->guidApp));

    WCHAR szCtxtID[32];
    wsprintfW(szCtxtID,  L"0x%016X", ContextID);
    m_pSpy -> AddParamValueToList(L"ContextID", szCtxtID);

    IF_AUDIT_DO(OnSetComplete)(pInfo->perfCount, GuidToBstr(pInfo->guidApp), szCtxtID);
    return S_OK;
  }

STDMETHODIMP CObjSub::OnSetComplete | ( | COMSVCSEVENTINFO * | pInfo,
 |  | ULONG64 | ContextID |
 | ) |  |  | [inline]

Definition at line 82 of file Objsub.h.

  {
    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnSetComplete"), GuidToBstr(pInfo->guidApp));

    WCHAR szCtxtID[32];
    wsprintfW(szCtxtID,  L"0x%016X", ContextID);
    m_pSpy -> AddParamValueToList(L"ContextID", szCtxtID);

    IF_AUDIT_DO(OnSetComplete)(pInfo->perfCount, GuidToBstr(pInfo->guidApp), szCtxtID);
    return S_OK;
  }

The documentation for this class was generated from the following file:
  • Com/Administration/Spy/ComSpyCtl/Objsub.h
Generated on Wed Nov 13 2024 16:56:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CObjTree Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CObjTree Class Reference

#include "cobjtree.h"

Inherits CTreeViewLite.

List of all members.

Public Member Functions

CObjTree (CMainWindow *pCMainWindow)
virtual | ~CObjTree ()
virtual BOOL | AddObject (CBase *pCSource, CBase *pCBase)
virtual BOOL | GarbageCollectNode (HTREEITEM hTreeItem)
virtual CBase * | GetSelectedObject ()
virtual BOOL | OnCommand (UINT iID, HWND hWndCtrl)
virtual BOOL | OnContextMenu (HWND hWnd, REFPOINTS pts)
virtual BOOL | OnDblclk (WPARAM fwKeys, REFPOINTS pts)
virtual BOOL | OnKeyDown (WPARAM nVirtKey, LPARAM lKeyData)
virtual BOOL | OnRButtonDown (WPARAM fwKeys, REFPOINTS pts)
virtual BOOL | OnUpdateCommand (HMENU hMenu, UINT nID, DWORD *pdwFlags)
virtual BOOL | RemoveNode (HTREEITEM hTreeItem)
virtual BOOL | RemoveObject (CBase *pCBase)
virtual BOOL | SelectObject (CBase *pCBase)

Public Attributes

CMainWindow * m_pCMainWindow

Detailed Description

Definition at line 25 of file cobjtree.h.

Constructor & Destructor Documentation

CObjTree::CObjTree ( CMainWindow * pCMainWindow )

Definition at line 24 of file cobjtree.cpp.

{
  //Data
  ASSERT(pCMainWindow);
  m_pCMainWindow = pCMainWindow;
}

CObjTree::~CObjTree ( ) [virtual]

Definition at line 36 of file cobjtree.cpp.

{
}

Member Function Documentation

BOOL CObjTree::AddObject | ( | CBase * | pCSource,
 |  | CBase * | pCBase |
 | ) |  |  | [virtual]

Definition at line 193 of file cobjtree.cpp.

{
  if(pCBase)
  {
    WCHAR* pwszDesc = pCBase->GetObjectDesc();
    WCHAR* pwszName = pCBase->GetObjectName();

    //Obtain the icon/image for the object
    INT iImage = pCBase->GetObjectImage();
    if(pCBase->m_pIAggregate)
      iImage = IMAGE_INTERFACE;

    if(pwszDesc)
    {
      static WCHAR wszBuffer[MAX_NAME_LEN] = {0};
      if(pCBase->m_dwCLSCTX == CLSCTX_INPROC_SERVER)
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"%s (%s)", pwszName, pwszDesc);
      else
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"%s%s (%s)", L"Remote ", pwszName, pwszDesc);
      pwszName = wszBuffer;
    }

    //Insert the Item (if not already)
    if(pCBase->m_hTreeItem == NULL)
    {
      pCBase->m_hTreeItem = InsertItem(pCSource ? pCSource->m_hTreeItem : NULL, NULL, pwszName, (INT_PTR)pCBase, iImage, iImage);
    }
    else
    {
      //Otherwise it probably just needs to have the item updated...
      SetItemText(pCBase->m_hTreeItem, pwszName);
      SetItemParam(pCBase->m_hTreeItem, (INT_PTR)pCBase);
      SetItemImage(pCBase->m_hTreeItem, iImage, iImage);
    }

    SelectObject(pCBase);
  }
  return TRUE;
}

BOOL CObjTree::GarbageCollectNode ( HTREEITEM hTreeItem ) [virtual]

Definition at line 267 of file cobjtree.cpp.

{
  //No-op
  if(!m_hWnd || !hTreeItem)
    return TRUE;

  HTREEITEM hHighestItem = NULL;

  //Try to find the "highest" un-used parent node.
  while(hTreeItem)
  {
    //As soon as one of the nodes has a (non-empty) object, its no longer "un-used"
    CBase* pCBase = (CBase*)GetItemParam(hTreeItem);
    if(pCBase && pCBase->m_pIUnknown)
      break;

    hHighestItem = hTreeItem;
    hTreeItem = GetParentItem(hTreeItem);
  }

  //Have we found "un-used" parents, that can be garbage-collected
  if(hHighestItem)
  {
    //Garbage Collect the usued nodes...
    return RemoveNode(hHighestItem);
  }

  return FALSE;
}

CBase * CObjTree::GetSelectedObject ( ) [virtual]

Definition at line 368 of file cobjtree.cpp.

{
  //Obtain the selected item
  return (CBase*)GetItemParam(GetSelectedItem());
}

BOOL CObjTree::OnCommand | ( | UINT | iID,
 |  | HWND | hWndCtrl |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 124 of file cobjtree.cpp.

{
  //Is this command meant for the Child Window?
  CBase* pCBase = GetSelectedObject();
  if(pCBase && pCBase->m_pCMDIChild)
    if(pCBase->m_pCMDIChild->OnCommand(iID, hWndCtrl))
      return TRUE;

  return FALSE;
}

BOOL CObjTree::OnContextMenu | ( | HWND | hWnd,
 |  | REFPOINTS | pts |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 82 of file cobjtree.cpp.

{
  CBase* pCBase = GetSelectedObject();
  if(pCBase)
  {
    UINT nIDMenu = pCBase->GetObjectMenu();

    if(nIDMenu)
    {
      DisplayContextMenu(
              hWnd,
              nIDMenu,
              pts,
              m_pCMainWindow->GetWnd()
              );
    }
  }

  return  TRUE;
}

BOOL CObjTree::OnDblclk | ( | WPARAM | fwKeys,
 |  | REFPOINTS | pts |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 140 of file cobjtree.cpp.

{
  UINT uFlags = 0;
  HTREEITEM hItem = HitTest(pts, &uFlags);
  if(hItem)
  {
    CBase* pCBase = (CBase*)GetItemParam(hItem);
    if(pCBase)
    {
      //If there is a child assoicated with this object, then let it perform what it should
      //do on a double click operation (which by default activates the  child window)
      pCBase->OnDefOperation();
      return TRUE;
    }
  }

  return FALSE;
}

BOOL CObjTree::OnKeyDown | ( | WPARAM | nVirtKey,
 |  | LPARAM | lKeyData |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 164 of file cobjtree.cpp.

{
  switch(nVirtKey)
  {
    case VK_RETURN:
    {
      CBase* pCBase = GetSelectedObject();
      if(pCBase)
      {
        //NOTE: Not all objects in the tree will have an assiocate child Window
        if(pCBase->m_pCMDIChild)
        {
          //Activate the MDIChild window assoicated with this object
          m_pCMainWindow->MDIActivate(pCBase->m_pCMDIChild->m_hWnd);
        }
        return TRUE;
      }
      break;
    }
  };

  return FALSE;
}

BOOL CObjTree::OnRButtonDown | ( | WPARAM | fwKeys,
 |  | REFPOINTS | pts |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 45 of file cobjtree.cpp.

{
  //NOTE: The right mouse button doesn't automatically activate the MDI window...
  m_pCMainWindow->MDIActivate(m_hWndParent);

  //NOTE: The right mouse doesn't automatically select the tree item
  //so we have to find where the mouse clicked and determine the inteneded item...
  HTREEITEM hItem = HitTest(pts, NULL);
  if(hItem)
    SelectItem(hItem);

  //Display the Context Menu (for this object)
  CBase* pCBase = (CBase*)GetItemParam(hItem);
  if(pCBase)
  {
    UINT nIDMenu = pCBase->GetObjectMenu();
    if(nIDMenu)
    {
      //xPos, yPos are Relative to the Client Area...
      DisplayContextMenu(
                m_hWnd,
                nIDMenu,
                pts,
                m_pCMainWindow->GetWnd(),
                TRUE
                );

    }
  }

  return TRUE;
}

BOOL CObjTree::OnUpdateCommand | ( | HMENU | hMenu,
 |  | UINT | nID,
 |  | DWORD * | pdwFlags |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 108 of file cobjtree.cpp.

{
  //Is this command meant for the Child Window?
  CBase* pCBase = GetSelectedObject();
  if(pCBase && pCBase->m_pCMDIChild)
    if(pCBase->m_pCMDIChild->OnUpdateCommand(hMenu, nID, pdwFlags))
      return TRUE;

  return FALSE;
}

BOOL CObjTree::RemoveNode ( HTREEITEM hTreeItem ) [virtual]

Definition at line 302 of file cobjtree.cpp.

{
  //No-op
  if(!m_hWnd || !hTreeItem)
    return TRUE;

  BOOL bSafeToRemove = TRUE;
  CBase* pCBase = (CBase*)GetItemParam(hTreeItem);
  CMDIChild* pCMDIChild = pCBase ? pCBase->m_pCMDIChild : NULL;

  //First, make sure this node is safe to remove...
  if(pCBase && pCBase->m_pIUnknown)
    bSafeToRemove = FALSE;

  //If it is before deleting it from the tree, we need to make there are no child nodes
  //that depend upon it
  if(bSafeToRemove)
  {
    HTREEITEM hChildItem = GetChildItem(hTreeItem);
    while(hChildItem)
    {
      //NOTE: Before deleting this node of the tree, obtain the next sibling (if there is one...)
      //Since we can't do this after the node has been deleted!
      HTREEITEM hNextSibling = GetNextItem(hChildItem);

      //Recurse
      if(!RemoveNode(hChildItem))
      {
        bSafeToRemove = FALSE;
        break;
      }

      //Go to the next sibling...
      hChildItem = hNextSibling;
    }
  }

  if(bSafeToRemove)
  {
    //Completely safe to delete this node (and all children)
    DeleteItem(hTreeItem);
    if(pCBase)
      pCBase->m_hTreeItem = NULL;
  }

  return bSafeToRemove;
}

BOOL CObjTree::RemoveObject ( CBase * pCBase ) [virtual]

Definition at line 238 of file cobjtree.cpp.

{
  //No-op
  if(!m_hWnd || !pCBase || !pCBase->m_hTreeItem)
    return TRUE;

  //Make a copy, since RemoveNode will null the objects members...
  HTREEITEM hParentItem = GetParentItem(pCBase->m_hTreeItem);

  //First try and remove this node (and possibly any children)
  if(RemoveNode(pCBase->m_hTreeItem))
  {
    pCBase->m_hTreeItem = NULL;

    //If we were able to remove this node, then maybe we should
    //try and "garbage-collect" any parent nodes now that this is gone...
    if(hParentItem)
      GarbageCollectNode(hParentItem);
    return TRUE;
  }

  return FALSE;
}

BOOL CObjTree::SelectObject ( CBase * pCBase ) [virtual]

Definition at line 355 of file cobjtree.cpp.

{
  if(pCBase && pCBase->m_hTreeItem)
    SelectItem(pCBase->m_hTreeItem);

  return TRUE;
}

Member Data Documentation

CMainWindow* CObjTree::m_pCMainWindow

Definition at line 51 of file cobjtree.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cobjtree.h
  • Dataaccess/oledb/rowsetviewer/cobjtree.cpp
Generated on Wed Nov 13 2024 16:56:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: COBLIST Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Protected Attributes

COBLIST Class Reference

#include "clUtil.h"

List of all members.

Public Member Functions

COBLIST ()
COBLIST ()
COBLIST ()
COBLIST ()
virtual | ~COBLIST ()
virtual | ~COBLIST ()
virtual | ~COBLIST ()
virtual | ~COBLIST ()
POSITION | AddTail (void *pItem)
POSITION | AddTail (void *pItem)
POSITION | AddTail (void *pItem)
POSITION | AddTail (void *pItem)
void | EmptyList ()
void | EmptyList ()
void | EmptyList ()
void | EmptyList ()
void * | GetFromPosition (POSITION rPos)
void * | GetFromPosition (POSITION rPos)
void * | GetFromPosition (POSITION rPos)
void * | GetFromPosition (POSITION rPos)
void * | GetHead ()
void * | GetHead ()
void * | GetHead ()
void * | GetHead ()
POSITION GetHeadPosition ()
POSITION GetHeadPosition ()
POSITION GetHeadPosition ()
POSITION GetHeadPosition ()
int | GetItemCount ()
int | GetItemCount ()
int | GetItemCount ()
void * | GetNext (POSITION &rPos)
void * | GetNext (POSITION &rPos)
void * | GetNext (POSITION &rPos)
void * | GetNext (POSITION &rPos)
POSITION | GetPosition (void *pItem)
POSITION | GetPosition (void *pItem)
POSITION | GetPosition (void *pItem)
POSITION | GetPosition (void *pItem)
void * | GetTail ()
void * | GetTail ()
void * | GetTail ()
void * | GetTail ()
POSITION GetTailPosition ()
POSITION GetTailPosition ()
POSITION GetTailPosition ()
POSITION GetTailPosition ()
BOOL IsEmpty ()
BOOL IsEmpty ()
BOOL IsEmpty ()
BOOL IsEmpty ()
POSITION | Lookup (void *pComparator)
POSITION | Lookup (void *pComparator)
POSITION | Lookup (void *pComparator)
POSITION | Lookup (void *pComparator)
virtual void * | RemoveAt (POSITION rPos)
virtual void * | RemoveAt (POSITION rPos)
virtual void * | RemoveAt (POSITION rPos)
virtual void * | RemoveAt (POSITION rPos)
void * | RemoveHead ()
void * | RemoveHead ()
void * | RemoveHead ()
void * | RemoveHead ()
void * | RemoveTail ()
void * | RemoveTail ()
void * | RemoveTail ()
void * | RemoveTail ()
void * | SafeGetFromPosition (POSITION rPos)
void * | SafeGetFromPosition (POSITION rPos)
void * | SafeGetFromPosition (POSITION rPos)
void * | SafeGetFromPosition (POSITION rPos)

Protected Member Functions

virtual BOOL | Compare (void *pItemToCompare, void *pComparator)
virtual BOOL | Compare (void *pItemToCompare, void *pComparator)
virtual BOOL | Compare (void *pItemToCompare, void *pComparator)
virtual BOOL | Compare (void *pItemToCompare, void *pComparator)

Protected Attributes

int | m_cItem
POSITION m_pHead
POSITION m_pTail

Detailed Description

Definition at line 82 of file clUtil.h.

Constructor & Destructor Documentation

COBLIST::COBLIST ( ) [inline]

Definition at line 91 of file clUtil.h.

: m_pHead(NULL), m_pTail(NULL), m_cItem(0) { }

COBLIST::~COBLIST ( ) [virtual]

Definition at line 200 of file clUtil.Cpp.

{
    ASSERT(IsEmpty());
}

COBLIST::COBLIST ( ) [inline]

Definition at line 94 of file clUtil.h.

: m_pHead(NULL), m_pTail(NULL), m_cItem(0) { }

virtual COBLIST::~COBLIST ( ) [virtual]
COBLIST::COBLIST ( ) [inline]

Definition at line 95 of file clUtil.h.

: m_pHead(NULL), m_pTail(NULL), m_cItem(0) { }

virtual COBLIST::~COBLIST ( ) [virtual]
COBLIST::COBLIST ( ) [inline]

Definition at line 90 of file clUtil.h.

: m_pHead(NULL), m_pTail(NULL) { };

virtual COBLIST::~COBLIST ( ) [virtual]

Member Function Documentation

POSITION COBLIST::AddTail ( void * pItem )
POSITION COBLIST::AddTail ( void * pItem )
POSITION COBLIST::AddTail ( void * pItem )
POSITION COBLIST::AddTail ( void * pItem )
virtual BOOL COBLIST::Compare | ( | void * | pItemToCompare,
 |  | void * | pComparator |
 | ) |  |  | [inline, protected, virtual]

Definition at line 92 of file clUtil.h.

                       { return(pItemToCompare == pComparator); }

virtual BOOL COBLIST::Compare | ( | void * | pItemToCompare,
 |  | void * | pComparator |
 | ) |  |  | [inline, protected, virtual]

Definition at line 91 of file clUtil.h.

                       { return(pItemToCompare == pComparator); }

virtual BOOL COBLIST::Compare | ( | void * | pItemToCompare,
 |  | void * | pComparator |
 | ) |  |  | [inline, protected, virtual]

Definition at line 88 of file clUtil.h.

                       { return(pItemToCompare == pComparator); }

virtual BOOL COBLIST::Compare | ( | void * | pItemToCompare,
 |  | void * | pComparator |
 | ) |  |  | [inline, protected, virtual]

Definition at line 87 of file clUtil.h.

                       { return(pItemToCompare == pComparator); };

void COBLIST::EmptyList ( )
void COBLIST::EmptyList ( )
void COBLIST::EmptyList ( )

Definition at line 361 of file clUtil.Cpp.

{
    while (!IsEmpty())
  {
        RemoveAt(GetHeadPosition());
    }
}

void COBLIST::EmptyList ( )
void* COBLIST::GetFromPosition ( POSITION rPos ) [inline]

Definition at line 113 of file clUtil.h.

{return (NULL == rPos) ? NULL : (rPos->pItem);};

void* COBLIST::GetFromPosition ( POSITION rPos ) [inline]

Definition at line 119 of file clUtil.h.

{return(rPos->pItem);}

void* COBLIST::GetFromPosition ( POSITION rPos ) [inline]

Definition at line 116 of file clUtil.h.

{return(rPos->pItem);}

void* COBLIST::GetFromPosition ( POSITION rPos ) [inline]

Definition at line 120 of file clUtil.h.

{return(rPos->pItem);}

void* COBLIST::GetHead ( ) [inline]

Definition at line 110 of file clUtil.h.

{ return GetFromPosition(GetHeadPosition());};

void* COBLIST::GetHead ( ) [inline]

Definition at line 116 of file clUtil.h.

{ return GetFromPosition(GetHeadPosition());}

void* COBLIST::GetHead ( ) [inline]

Definition at line 112 of file clUtil.h.

{ return GetFromPosition(GetHeadPosition());}

void* COBLIST::GetHead ( ) [inline]

Definition at line 115 of file clUtil.h.

{ return GetFromPosition(GetHeadPosition());}

POSITION COBLIST::GetHeadPosition ( ) [inline]

Definition at line 101 of file clUtil.h.

{ return (m_pHead); }

POSITION COBLIST::GetHeadPosition ( ) [inline]

Definition at line 105 of file clUtil.h.

{ return (m_pHead); }

POSITION COBLIST::GetHeadPosition ( ) [inline]

Definition at line 104 of file clUtil.h.

{ return (m_pHead); }

POSITION COBLIST::GetHeadPosition ( ) [inline]

Definition at line 101 of file clUtil.h.

{ return (m_pHead); };

int COBLIST::GetItemCount ( ) [inline]

Definition at line 108 of file clUtil.h.

{ return (m_cItem); }

int COBLIST::GetItemCount ( ) [inline]

Definition at line 104 of file clUtil.h.

{ return (m_cItem); }

int COBLIST::GetItemCount ( ) [inline]

Definition at line 107 of file clUtil.h.

{ return (m_cItem); }

void* COBLIST::GetNext ( POSITION & rPos )
VOID * COBLIST::GetNext ( POSITION & rPos )

Definition at line 239 of file clUtil.Cpp.

{
  ASSERT(rPos);

  if(NULL == rPos)
  {
    return NULL;
  }

  VOID* pReturn = rPos->pItem;
  rPos = rPos->pNext;

  return pReturn;
}

void* COBLIST::GetNext ( POSITION & rPos )
void* COBLIST::GetNext ( POSITION & rPos )
POSITION COBLIST::GetPosition ( void * pItem )
POSITION COBLIST::GetPosition ( void * pItem )
POSITION COBLIST::GetPosition ( void * pItem )

Definition at line 412 of file clUtil.Cpp.

{
    POSITION    Position = m_pHead;

    while (Position)
  {
        if (Position->pItem == _pItem)
    {
            break;
        }
    GetNext(Position);
    }
    return Position;
}

POSITION COBLIST::GetPosition ( void * pItem )
VOID * COBLIST::GetTail ( ) [inline]

Definition at line 113 of file clUtil.h.

{ return m_pTail->pItem;}

void* COBLIST::GetTail ( ) [inline]

Definition at line 117 of file clUtil.h.

{ return m_pTail->pItem;}

void* COBLIST::GetTail ( )
void* COBLIST::GetTail ( ) [inline]

Definition at line 116 of file clUtil.h.

{ return m_pTail->pItem;}

POSITION COBLIST::GetTailPosition ( ) [inline]

Definition at line 102 of file clUtil.h.

{ return (m_pTail); };

POSITION COBLIST::GetTailPosition ( ) [inline]

Definition at line 102 of file clUtil.h.

{ return (m_pTail); }

POSITION COBLIST::GetTailPosition ( ) [inline]

Definition at line 106 of file clUtil.h.

{ return (m_pTail); }

POSITION COBLIST::GetTailPosition ( ) [inline]

Definition at line 105 of file clUtil.h.

{ return (m_pTail); }

BOOL COBLIST::IsEmpty ( void ) [inline]

Definition at line 103 of file clUtil.h.

{ return (!m_pHead); }

BOOL COBLIST::IsEmpty ( void ) [inline]

Definition at line 106 of file clUtil.h.

{ return (!m_pHead); }

BOOL COBLIST::IsEmpty ( void ) [inline]

Definition at line 103 of file clUtil.h.

{ return (!m_pHead); };

BOOL COBLIST::IsEmpty ( void ) [inline]

Definition at line 107 of file clUtil.h.

{ return (!m_pHead); }

POSITION COBLIST::Lookup ( void * pComparator )
POSITION COBLIST::Lookup ( void * pComparator )

Definition at line 434 of file clUtil.Cpp.

{
    POSITION    Position = m_pHead;

    while (Position)
  {
        if (Compare(Position->pItem, pComparator))
    {
            break;
        }
    GetNext(Position);
    }
    return Position;
}

POSITION COBLIST::Lookup ( void * pComparator )
POSITION COBLIST::Lookup ( void * pComparator )
VOID * COBLIST::RemoveAt ( POSITION rPos ) [virtual]

Definition at line 261 of file clUtil.Cpp.

{
  if(NULL == Pos)
  {
    return NULL;
  }

  VOID* pReturn = NULL;

  if (m_pHead)
  {
    if (m_pHead == Pos)
    {
      // Removing the first element in the list

      m_pHead = Pos->pNext;
      pReturn = Pos->pItem;
      delete Pos;
      m_cItem--;
      ASSERT(0 <= m_cItem);

      if (NULL == m_pHead)
      {
        // Removing the only element!
        m_pTail = NULL;
      }
    }
    else
    {
      POSITION pCur = m_pHead;

      while (pCur && pCur->pNext)
      {
        if (pCur->pNext == Pos)
        {
          // Removing

          pCur->pNext = Pos->pNext;
          if (m_pTail == Pos)
          {
            m_pTail = pCur;
          }
          pReturn = Pos->pItem;
          delete Pos;

          m_cItem--;
          ASSERT(0 <= m_cItem);
        }

        pCur = pCur->pNext;
      }
    }
  }

  return pReturn;
}

virtual void* COBLIST::RemoveAt ( POSITION rPos ) [virtual]
virtual void* COBLIST::RemoveAt ( POSITION rPos ) [virtual]
virtual void* COBLIST::RemoveAt ( POSITION rPos ) [virtual]
void* COBLIST::RemoveHead ( ) [inline]

Definition at line 117 of file clUtil.h.

{ return RemoveAt(m_pHead); }

void* COBLIST::RemoveHead ( ) [inline]

Definition at line 118 of file clUtil.h.

{ return RemoveAt(m_pHead); }

void* COBLIST::RemoveHead ( ) [inline]

Definition at line 114 of file clUtil.h.

{ return RemoveAt(m_pHead); }

void* COBLIST::RemoveHead ( ) [inline]

Definition at line 111 of file clUtil.h.

{ return RemoveAt(m_pHead); };

void* COBLIST::RemoveTail ( ) [inline]

Definition at line 115 of file clUtil.h.

{ return RemoveAt(m_pTail); }

void* COBLIST::RemoveTail ( ) [inline]

Definition at line 119 of file clUtil.h.

{ return RemoveAt(m_pTail); }

void* COBLIST::RemoveTail ( ) [inline]

Definition at line 112 of file clUtil.h.

{ return RemoveAt(m_pTail); };

void* COBLIST::RemoveTail ( ) [inline]

Definition at line 118 of file clUtil.h.

{ return RemoveAt(m_pTail); }

void* COBLIST::SafeGetFromPosition ( POSITION rPos )
void* COBLIST::SafeGetFromPosition ( POSITION rPos )
void* COBLIST::SafeGetFromPosition ( POSITION rPos )
void * COBLIST::SafeGetFromPosition ( POSITION rPos )

Definition at line 456 of file clUtil.Cpp.

{
  // Safe way to validate that an entry is still in the list,
  // which ensures bugs that would reference deleted memory,
  // reference a NULL pointer instead
  // (e.g. an event handler fires late/twice).
  // Note that versioning on entries would provide an additional
  // safeguard against re-use of a position.
  // Walk list to find entry.

  POSITION PosWork = m_pHead;

  while (PosWork)
  {
    if (PosWork == Pos)
    {
      return Pos->pItem;
    }
    GetNext(PosWork);
  }
  return NULL;
}

Member Data Documentation

int COBLIST::m_cItem [protected]

Definition at line 87 of file clUtil.h.

POSITION COBLIST::m_pHead [protected]

Definition at line 85 of file clUtil.h.

POSITION COBLIST::m_pTail [protected]

Definition at line 86 of file clUtil.h.

The documentation for this class was generated from the following files:
  • Web/NetMeeting/NMChat/clUtil.h
  • Web/NetMeeting/NMFT/clUtil.h
  • Web/NetMeeting/NMShare/clUtil.h
  • Web/NetMeeting/NMUI/clUtil.h
  • Web/NetMeeting/NMChat/clUtil.Cpp
  • Web/NetMeeting/NMFT/clUtil.Cpp
  • Web/NetMeeting/NMShare/clUtil.Cpp
  • Web/NetMeeting/NMUI/clUtil.Cpp
Generated on Wed Nov 13 2024 16:56:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: COBNODE Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

COBNODE Struct Reference

#include "clUtil.h"

List of all members.

Public Attributes

void * pItem
POSITION pNext

Detailed Description

Definition at line 76 of file clUtil.h.

Member Data Documentation

void * COBNODE::pItem

Definition at line 79 of file clUtil.h.

POSITION COBNODE::pNext

Definition at line 78 of file clUtil.h.

The documentation for this struct was generated from the following files:
  • Web/NetMeeting/NMChat/clUtil.h
  • Web/NetMeeting/NMFT/clUtil.h
  • Web/NetMeeting/NMShare/clUtil.h
  • Web/NetMeeting/NMUI/clUtil.h
Generated on Wed Nov 13 2024 16:56:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CODBCData Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes

CODBCData Class Reference

#include "odbcdata.h"

Inherits CPooledData.

Inherited by CProxy.

List of all members.

Protected Member Functions

CODBCData ()
~CODBCData ()
virtual HRESULT | BindResultMetaData (FieldMetaData **ppMetaData, short *pCount)
virtual void | CloseCurrentStatement ()
virtual void STDMETHODCALLTYPE | DeactivateData (void)
virtual HRESULT | ExecuteSQL (LPCWSTR wszSQL, long *pResult=NULL)
virtual HRESULT | FetchData ()
STDMETHOD() | ManualConstructData (BSTR strConstruct)
virtual HRESULT | NextResultsetData (long *pResult)

Protected Attributes

CString m_wszConnection

Private Member Functions

HRESULT | Enlist (IObjectContext *pObjectContext, const CLSID &clsid, const IID &iid)
HRESULT | GetConnection (BSTR sDsn, BOOL bUseObjectPool)
void | GetODBCError (char *szError)

Private Attributes

HDBC | m_hdbc
HENV | m_henv
HSTMT | m_hstmt

Detailed Description

Definition at line 53 of file odbcdata.h.

Constructor & Destructor Documentation

CODBCData::CODBCData ( ) [inline, protected]

Definition at line 69 of file odbcdata.h.

  {
    m_henv = 0;
    m_hdbc = 0;
    m_hstmt= 0;
  }

CODBCData::~CODBCData ( ) [inline, protected]

Definition at line 76 of file odbcdata.h.

  {
    if (m_hstmt)
      SQLFreeStmt(m_hstmt, SQL_DROP);
    if (m_hdbc)
    {
      SQLDisconnect(m_hdbc);
      SQLFreeConnect(m_hdbc);
    }
    if (m_henv)
      SQLFreeEnv(m_henv);

    m_hstmt = 0;
    m_henv = 0;
    m_hdbc = 0;
  }

Member Function Documentation

HRESULT CODBCData::BindResultMetaData | ( | FieldMetaData ** | ppMetaData,
 |  | short * | pCount |
 | ) |  |  | [protected, virtual]

Definition at line 9 of file odbcdata.Cpp.

{
  short nCol;
  HRESULT hr = S_OK;
  RETCODE rc = 0;
  short nsChars = 0;
  WCHAR wszFieldName[FIELDNAME_MAXSIZE];

  rc = SQLNumResultCols(m_hstmt, pCount);

  PROCESS_SQL_ERROR(rc);

  if (*ppMetaData == NULL)
  {
    *ppMetaData = new FieldMetaData[(*pCount) + 1];
  }

  for (nCol = 1; nCol <= *pCount; nCol++)
  {
    short nIndex = nCol-1;

    FieldMetaData *pMeta = &(*ppMetaData)[nIndex];

    rc = SQLDescribeColW(m_hstmt, (short)nCol, wszFieldName, (short)FIELDNAME_MAXSIZE - 1, &nsChars, (short*)&pMeta->sqldatatype, &pMeta->nDataLen, &pMeta->nScale, &pMeta->nNullable);
    PROCESS_SQL_ERROR(rc);

    pMeta->wszName.AssignCopy(nsChars, wszFieldName);

    pMeta->vt = VT_EMPTY;
    pMeta->bNull = false;

    switch(pMeta->sqldatatype)
    {
    case SQL_TINYINT:
      pMeta->nDataLen = sizeof(long);
      pMeta->vt = VT_UI1;
      pMeta->sqltype = SQL_C_SLONG;
      break;
    case SQL_SMALLINT:
      pMeta->nDataLen = sizeof(long);
      pMeta->vt = VT_I2;
      pMeta->sqltype = SQL_C_SLONG;
      break;
    case SQL_NUMERIC:
    case SQL_INTEGER:
      pMeta->nDataLen = sizeof(long);
      pMeta->vt = VT_I4;
      pMeta->sqltype = SQL_C_SLONG;
      break;
    case SQL_TYPE_DATE:
    case SQL_TYPE_TIME:
    case SQL_TYPE_TIMESTAMP:
    case 11: // datetime?
      pMeta->nDataLen = MAX_FIELD_DATA_SIZE - 1;
      pMeta->vt = VT_DATE;
      pMeta->sqltype = SQL_C_WCHAR;
      break;
    case SQL_BIT:
      pMeta->nDataLen = sizeof(bool);
      pMeta->vt = VT_BOOL;
      pMeta->sqltype = SQL_C_SLONG;
      break;
    case SQL_DECIMAL:
      pMeta->nDataLen = MAX_FIELD_DATA_SIZE - 1;
      if (pMeta->nScale == 4)
        pMeta->vt = VT_CY;
      else
        pMeta->vt = VT_DECIMAL;
      pMeta->sqltype = SQL_C_WCHAR;
      break;
    case SQL_VARCHAR:
    case SQL_CHAR:
    case SQL_LONGVARCHAR:
    case SQL_WCHAR:
    case SQL_WVARCHAR:
    case SQL_WLONGVARCHAR:
    default:
      pMeta->nDataLen = MAX_FIELD_DATA_SIZE - 1;
      pMeta->vt = VT_BSTR;
      pMeta->sqltype = SQL_C_WCHAR;
      break;
    }

    rc = SQLBindCol(m_hstmt, (short)nCol, pMeta->sqltype, (void*)pMeta->pData, MAX_FIELD_DATA_SIZE - 1, &pMeta->nDataBindLen);
    PROCESS_SQL_ERROR(rc);
  }
  return hr;
}

void CODBCData::CloseCurrentStatement ( ) [protected, virtual]

Definition at line 242 of file odbcdata.Cpp.

{
  SQLCloseCursor(m_hstmt);
  SQLFreeStmt(m_hstmt, SQL_UNBIND);
  SQLFreeStmt(m_hstmt, SQL_CLOSE);
}

virtual void STDMETHODCALLTYPE CODBCData::DeactivateData ( void ) [inline, protected, virtual]

Implements CPooledData.

Definition at line 119 of file odbcdata.h.

  {
    m_spObjectContext.Release();
    return;
  }

HRESULT CODBCData::Enlist | ( | IObjectContext * | pObjectContext,
 |  | const CLSID & | clsid,
 |  | const IID & | iid |
 | ) |  |  | [private, virtual]

Implements CPooledData.

Definition at line 154 of file odbcdata.Cpp.

{
  HRESULT hr = E_FAIL;
  _ASSERTE(pObjectContext);

  IObjectContextInfo  * pObjTx = NULL;
  hr = pObjectContext->QueryInterface(IID_IObjectContextInfo, (void **)&pObjTx);
  if (pObjTx)
  {
    ITransaction * pTx = NULL;
    hr = pObjTx->GetTransaction ((IUnknown **)&pTx);
    RETCODE rc;
    if (pTx)
    {
      rc = SQLSetConnectAttr(m_hdbc,SQL_ATTR_ENLIST_IN_DTC, pTx, 0);
      if (SQL_FAILED(rc))
      {
        char szError[1024];

        ATLTRACE ("Enlist failed: %#x\n", rc);

        GetODBCError(szError);
        hr = AtlReportError(clsid, szError, iid, E_FAIL);
      }
      else
      {
        hr = S_OK;
      }
      pTx->Release();
    }
    pObjTx->Release();
  }
  return hr;
}

HRESULT CODBCData::ExecuteSQL | ( | LPCWSTR | wszSQL,
 |  | long * | pResult = NULL |
 | ) |  |  | [protected, virtual]

Definition at line 197 of file odbcdata.Cpp.

{
  RETCODE rc = 0;
  HRESULT hr = S_OK;
  long nResult = -1;
  long nData = -1;
  long nDataLen = sizeof(long);
  long nDataBindLen = sizeof(long);
  SQLSMALLINT sqltype = SQL_C_SLONG;

  SETCOMPLETE;

  rc = SQLExecDirectW(m_hstmt, (LPWSTR)wszSQL, SQL_NTS);

  PROCESS_SQL_ERROR(rc);

  // Only ask for results if we have been asked for results.
  if (pResult != NULL)
  {
    rc = SQLRowCount(m_hstmt, &nResult);

    PROCESS_SQL_ERROR(rc);

  // This may fail (so don't check return value) if there is no data to return
    rc = SQLFetch(m_hstmt);

  //  PROCESS_SQL_ERROR(rc);

    if (!SQL_FAILED(rc))
    {
      rc = SQLGetData(m_hstmt, (SQLUSMALLINT)1, sqltype, (void*)&nData, nDataLen, &nDataBindLen);
    //  PROCESS_SQL_ERROR(rc);
    }

    if (nData != -1)
    {
      nResult = nData;
    }

    *pResult = nResult;
  }

  return hr;
}

virtual HRESULT CODBCData::FetchData ( ) [inline, protected, virtual]

Definition at line 107 of file odbcdata.h.

  {
    HRESULT hr = S_OK;
    RETCODE rc;

    rc = SQLFetch(m_hstmt);

    PROCESS_SQL_ERROR(rc);

    return hr;
  }

HRESULT CODBCData::GetConnection | ( | BSTR | sDsn,
 |  | BOOL | bUseObjectPool |
 | ) |  |  | [private]

Definition at line 98 of file odbcdata.Cpp.

{
  RETCODE rc;
  HRESULT hr= S_OK;

  // We're object pooling, so we don't need connection pooling
  if (bUseObjectPool)
  {
    rc = SQLSetEnvAttr(NULL, SQL_ATTR_CONNECTION_POOLING, (void*)SQL_CP_OFF, SQL_IS_INTEGER);
    ASSERT_SQL_SUCCESS(rc);
  }
  else
  {
    rc = SQLSetEnvAttr(SQL_NULL_HENV, SQL_ATTR_CONNECTION_POOLING, (void*)SQL_CP_ONE_PER_DRIVER, SQL_IS_INTEGER);
    ASSERT_SQL_SUCCESS(rc);
  }

  rc = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HENV, &m_henv);
  ASSERT_SQL_SUCCESS(rc);

  rc = SQLSetEnvAttr(m_henv, SQL_ATTR_ODBC_VERSION, (SQLPOINTER) SQL_OV_ODBC3, SQL_IS_INTEGER);
  ASSERT_SQL_SUCCESS(rc);

  rc = SQLSetEnvAttr(m_henv, SQL_ATTR_CP_MATCH, (SQLPOINTER) SQL_CP_RELAXED_MATCH, SQL_IS_INTEGER);
  ASSERT_SQL_SUCCESS(rc);

  rc = SQLAllocHandle(SQL_HANDLE_DBC, m_henv, &m_hdbc);

  if (SQL_FAILED(rc))
    return E_FAIL;

  rc = SQLSetConnectAttr(m_hdbc, SQL_ATTR_ODBC_CURSORS, NULL, SQL_CUR_USE_ODBC);

  if (SQL_FAILED(rc))
    return E_FAIL;
  WCHAR szConn[1024];
  WORD nSize = 1023;
  m_wszConnection.AssignCopy(SysStringLen(sDsn), sDsn);

  rc = SQLDriverConnectW(m_hdbc, NULL, (SQLWCHAR*)(LPCWSTR)m_wszConnection, SQL_NTS, (SQLWCHAR *)szConn, 1023, (short *)&nSize, (UWORD)SQL_DRIVER_NOPROMPT);
  if (SQL_FAILED(rc))
  {
    SQLFreeEnv(m_henv);
    return E_FAIL;
  }
  rc = SQLAllocStmt(m_hdbc, &m_hstmt); // generic stmt
  if (SQL_FAILED(rc))
  {
    SQLFreeConnect(m_hdbc);
    SQLFreeEnv(m_henv);

    return E_FAIL;
  }
  return S_OK;
}

void CODBCData::GetODBCError ( char * szError ) [private]

Definition at line 189 of file odbcdata.Cpp.

{
  char szSqlState[64];
  SDWORD NativeError;
  SWORD cbErrorMsg;
  SQLError(m_henv, m_hdbc, m_hstmt, (SQLCHAR*)szSqlState, &NativeError, (SQLCHAR*)szError, 1023, &cbErrorMsg);
}

STDMETHOD() CODBCData::ManualConstructData ( BSTR strConstruct ) [inline, protected]

Definition at line 93 of file odbcdata.h.

  {
    HRESULT hr = GetConnection(strConstruct, m_bObjectPooled);
    if (FAILED(hr))
    {
      LPCSTR szError = "Could not connect to the database.";
      return AtlReportError(CLSID_Proxy, szError, IID_IDataProxy, hr);
    }
    m_bConstructed = TRUE;
    return S_OK;
  }

HRESULT CODBCData::NextResultsetData ( long * pResult ) [protected, virtual]

Definition at line 249 of file odbcdata.Cpp.

{
  RETCODE rc = 0;
  HRESULT hr = S_OK;

  rc = SQLMoreResults(m_hstmt);

  if (pResult != NULL)
  {
    rc = SQLRowCount(m_hstmt, pResult);

    PROCESS_SQL_ERROR(rc);
  }
  return hr;
}

Member Data Documentation

HDBC CODBCData::m_hdbc [private]

Definition at line 58 of file odbcdata.h.

HENV CODBCData::m_henv [private]

Definition at line 57 of file odbcdata.h.

HSTMT CODBCData::m_hstmt [private]

Definition at line 59 of file odbcdata.h.

CString CODBCData::m_wszConnection [protected]

Definition at line 67 of file odbcdata.h.

The documentation for this class was generated from the following files:
  • Com/Tools/EntityProxy/DataServices/odbcdata.h
  • Com/Tools/EntityProxy/DataServices/odbcdata.Cpp
Generated on Wed Nov 13 2024 16:56:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: COfficeDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions

COfficeDlg Class Reference

#include "officedlg.h"

List of all members.

Public Types

enum | { IDD = IDD_OFFICEEQUIP }

Public Member Functions

COfficeDlg (CWnd *pParent=NULL)

Public Attributes

CString m_item
CString m_SKU

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)

Detailed Description

Definition at line 31 of file officedlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 39 of file officedlg.h.

{ IDD = IDD_OFFICEEQUIP };

Constructor & Destructor Documentation

COfficeDlg::COfficeDlg ( CWnd * pParent = NULL )

Definition at line 29 of file officedlg.cpp.

  : CDialog(COfficeDlg::IDD, pParent)
{
  //{{AFX_DATA_INIT(COfficeDlg)
  m_item = _T("");
  m_SKU = _T("");
  //}}AFX_DATA_INIT
}

Member Function Documentation

void COfficeDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 39 of file officedlg.cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(COfficeDlg)
  DDX_Text(pDX, IDC_ITEM, m_item);
  DDX_Text(pDX, IDC_SKU, m_SKU);
  //}}AFX_DATA_MAP
}

Member Data Documentation

CString COfficeDlg::m_item

Definition at line 40 of file officedlg.h.

CString COfficeDlg::m_SKU

Definition at line 41 of file officedlg.h.

The documentation for this class was generated from the following files:
  • SysMgmt/WMI/VC/AdvClient/officedlg.h
  • SysMgmt/WMI/VC/AdvClient/officedlg.cpp
Generated on Wed Nov 13 2024 16:56:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: COL Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

COL Struct Reference

List of all members.

Public Attributes

UINT dwWidth
LPTSTR lpsz

Detailed Description

Definition at line 73 of file ui.cpp.

Member Data Documentation

UINT COL::dwWidth

Definition at line 75 of file ui.cpp.

LPTSTR COL::lpsz

Definition at line 76 of file ui.cpp.

The documentation for this struct was generated from the following file:
  • Web/NetMeeting/NMChat2/ui.cpp
Generated on Wed Nov 13 2024 16:56:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: COLDESC Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

COLDESC Struct Reference

#include "table.h"

List of all members.

Public Attributes

BYTE | bPrecision
BYTE | bScale
DBCOLUMNFLAGS | dwFlags
BOOL fIsAutoInc
BOOL fIsNullable
BOOL fIsPrimaryKey
ULONG iOrdinal
ULONG ulColumnSize
ULONG ulCreateParams
WCHAR | wszColName [MAX_NAME_LEN]
WCHAR | wszTypeName [MAX_NAME_LEN]
DBTYPE | wType

Detailed Description

Definition at line 87 of file table.h.

Member Data Documentation

BYTE COLDESC::bPrecision

Definition at line 95 of file table.h.

BYTE COLDESC::bScale

Definition at line 96 of file table.h.

DBCOLUMNFLAGS COLDESC::dwFlags

Definition at line 92 of file table.h.

BOOL COLDESC::fIsAutoInc

Definition at line 102 of file table.h.

BOOL COLDESC::fIsNullable

Definition at line 101 of file table.h.

BOOL COLDESC::fIsPrimaryKey

Definition at line 105 of file table.h.

ULONG COLDESC::iOrdinal

Definition at line 91 of file table.h.

ULONG COLDESC::ulColumnSize

Definition at line 93 of file table.h.

ULONG COLDESC::ulCreateParams

Definition at line 100 of file table.h.

WCHAR COLDESC::wszColName[MAX_NAME_LEN]

Definition at line 90 of file table.h.

WCHAR COLDESC::wszTypeName[MAX_NAME_LEN]

Definition at line 99 of file table.h.

DBTYPE COLDESC::wType

Definition at line 94 of file table.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/oledb/tablecopy/table.h
Generated on Wed Nov 13 2024 16:56:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: COleClient Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

COleClient Class Reference

#include "cdialoglite.h"

Inherits CWndLite.

Inherited by CWebBrowser.

List of all members.

Public Member Functions

COleClient (HWND hWndParent=NULL, UINT nID=0)
virtual | ~COleClient ()
STDMETHOD() | CanInPlaceActivate (void)
STDMETHOD() | ContextSensitiveHelp (BOOL fEnterMode)
STDMETHOD() | DeactivateAndUndo (void)
STDMETHOD() | DiscardUndoState (void)
STDMETHOD() | GetContainer (IOleContainer **ppContainer)
STDMETHOD() | GetIDsOfNames (REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgdispid)
STDMETHOD() | GetMoniker (DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk)
STDMETHOD() | GetTypeInfo (UINT itinfo, LCID lcid, ITypeInfo **pptinfo)
STDMETHOD() | GetTypeInfoCount (UINT *pctinfo)
STDMETHOD() | GetWindow (HWND *phwnd)
STDMETHOD() | GetWindowContext (IOleInPlaceFrame **ppFrame, IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect, LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
STDMETHODIMP | Invoke (DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pvarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
STDMETHOD() | OnInPlaceActivate (void)
STDMETHOD() | OnInPlaceDeactivate (void)
STDMETHOD() | OnPosRectChange (LPCRECT lprcPosRect)
STDMETHOD() | OnShowWindow (BOOL fShow)
STDMETHOD() | OnUIActivate (void)
STDMETHOD() | OnUIDeactivate (BOOL fUndoable)
STDMETHOD() | QueryInterface (REFIID riid, void **ppvObject)
STDMETHOD() | RequestNewObjectLayout (void)
STDMETHOD() | SaveObject (void)
STDMETHOD() | Scroll (SIZE scrollExtant)
STDMETHOD() | ShowObject (void)
STDMETHOD_ (ULONG, Release)()
STDMETHOD_ (ULONG, AddRef)()

Protected Attributes

ULONG m_cRef

Detailed Description

Definition at line 1239 of file cdialoglite.h.

Constructor & Destructor Documentation

COleClient::COleClient | ( | HWND | hWndParent = NULL,
 |  | UINT | nID = 0 |
 | ) |  |  | [inline]

Definition at line 1248 of file cdialoglite.h.

    : CWndLite(hWndParent, nID)
  {
    m_cRef = 0;
  }

virtual COleClient::~COleClient ( ) [inline, virtual]

Definition at line 1253 of file cdialoglite.h.

  {
  }

Member Function Documentation

STDMETHOD() COleClient::CanInPlaceActivate ( void ) [inline]

Definition at line 1356 of file cdialoglite.h.

  {
     return S_OK;
  }

STDMETHOD() COleClient::ContextSensitiveHelp ( BOOL fEnterMode ) [inline]

Definition at line 1350 of file cdialoglite.h.

  {
      return S_OK;
  }

STDMETHOD() COleClient::DeactivateAndUndo ( void ) [inline]

Definition at line 1400 of file cdialoglite.h.

  {
      return S_OK;
  }

STDMETHOD() COleClient::DiscardUndoState ( void ) [inline]

Definition at line 1395 of file cdialoglite.h.

  {
      return S_OK;
  }

STDMETHOD() COleClient::GetContainer ( IOleContainer ** ppContainer ) [inline]

Definition at line 1323 of file cdialoglite.h.

  {
    ATLTRACENOTIMPL(_T("IOleClientSite::GetContainer"));
  }

STDMETHOD() COleClient::GetIDsOfNames | ( | REFIID | riid,
 |  | LPOLESTR * | rgszNames,
 |  | UINT | cNames,
 |  | LCID | lcid,
 |  | DISPID * | rgdispid |
 | ) |  |  | [inline]

Definition at line 1298 of file cdialoglite.h.

  {
    return E_NOTIMPL;
  }

STDMETHOD() COleClient::GetMoniker | ( | DWORD | dwAssign,
 |  | DWORD | dwWhichMoniker,
 |  | IMoniker ** | ppmk |
 | ) |  |  | [inline]

Definition at line 1318 of file cdialoglite.h.

  {
    ATLTRACENOTIMPL(_T("IOleClientSite::GetMoniker"));
  }

STDMETHOD() COleClient::GetTypeInfo | ( | UINT | itinfo,
 |  | LCID | lcid,
 |  | ITypeInfo ** | pptinfo |
 | ) |  |  | [inline]

Definition at line 1294 of file cdialoglite.h.

  {
    return E_NOTIMPL;
  }

STDMETHOD() COleClient::GetTypeInfoCount ( UINT * pctinfo ) [inline]

Definition at line 1290 of file cdialoglite.h.

  {
    return E_NOTIMPL;
  }

STDMETHOD() COleClient::GetWindow ( HWND * phwnd ) [inline]

Definition at line 1344 of file cdialoglite.h.

  {
     *phwnd = m_hWnd;
      return S_OK;
  }

STDMETHOD() COleClient::GetWindowContext | ( | IOleInPlaceFrame ** | ppFrame,
 |  | IOleInPlaceUIWindow ** | ppDoc,
 |  | LPRECT | lprcPosRect,
 |  | LPRECT | lprcClipRect,
 |  | LPOLEINPLACEFRAMEINFO | lpFrameInfo |
 | ) |  |  | [inline]

Definition at line 1371 of file cdialoglite.h.

  {
    GetClientRect(m_hWnd, lprcPosRect);
    GetClientRect(m_hWnd, lprcClipRect);
    return S_OK;
  }

STDMETHODIMP COleClient::Invoke | ( | DISPID | dispidMember,
 |  | REFIID | riid,
 |  | LCID | lcid,
 |  | WORD | wFlags,
 |  | DISPPARAMS * | pDispParams,
 |  | VARIANT * | pvarResult,
 |  | EXCEPINFO * | pExcepInfo,
 |  | UINT * | puArgErr |
 | ) |  |  | [inline]

Reimplemented in CWebBrowser.

Definition at line 1304 of file cdialoglite.h.

  {
    return E_NOTIMPL;
  }

STDMETHOD() COleClient::OnInPlaceActivate ( void ) [inline]

Definition at line 1361 of file cdialoglite.h.

  {
    return S_OK;
  }

STDMETHOD() COleClient::OnInPlaceDeactivate ( void ) [inline]

Definition at line 1390 of file cdialoglite.h.

  {
    return S_OK;
  }

STDMETHOD() COleClient::OnPosRectChange ( LPCRECT lprcPosRect ) [inline]

Definition at line 1405 of file cdialoglite.h.

  {
      return S_OK;
  }

STDMETHOD() COleClient::OnShowWindow ( BOOL fShow ) [inline]

Definition at line 1333 of file cdialoglite.h.

  {
      return S_OK;
  }

STDMETHOD() COleClient::OnUIActivate ( void ) [inline]

Definition at line 1366 of file cdialoglite.h.

  {
      return S_OK;
  }

STDMETHOD() COleClient::OnUIDeactivate ( BOOL fUndoable ) [inline]

Definition at line 1385 of file cdialoglite.h.

  {
      return S_OK;
  }

STDMETHOD() COleClient::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppvObject |
 | ) |  |  | [inline]

Definition at line 1258 of file cdialoglite.h.

  {
    *ppvObject = NULL;
     if(riid == IID_IUnknown)
       *ppvObject = (IOleClientSite*)this;
     else if(riid == IID_IDispatch)
       *ppvObject = (IDispatch*)this;
     else if(riid == IID_IOleClientSite)
       *ppvObject = (IOleClientSite*)this;
     else if(riid == IID_IOleInPlaceSite)
       *ppvObject = (IOleInPlaceSite*)this;
     else if(riid == IID_IOleWindow)
       *ppvObject = (IOleWindow*)this;
     else if(riid == DIID_DWebBrowserEvents2)
       *ppvObject = (IDispatch*)this;
    else
       return E_NOINTERFACE;

     return S_OK;
  }

STDMETHOD() COleClient::RequestNewObjectLayout ( void ) [inline]

Definition at line 1338 of file cdialoglite.h.

  {
      return S_OK;
  }

STDMETHOD() COleClient::SaveObject ( void ) [inline]

Definition at line 1313 of file cdialoglite.h.

  {
      return S_OK;
  }

STDMETHOD() COleClient::Scroll ( SIZE scrollExtant ) [inline]

Definition at line 1380 of file cdialoglite.h.

  {
      return S_OK;
  }

STDMETHOD() COleClient::ShowObject ( void ) [inline]

Definition at line 1328 of file cdialoglite.h.

  {
      return S_OK;
  }

COleClient::STDMETHOD_ | ( | ULONG | ,
 |  | Release |  |
 | ) |  |  | [inline]

Definition at line 1284 of file cdialoglite.h.

  {
    return --m_cRef;
  }

COleClient::STDMETHOD_ | ( | ULONG | ,
 |  | AddRef |  |
 | ) |  |  | [inline]

Definition at line 1279 of file cdialoglite.h.

  {
    return ++m_cRef;
  }

Member Data Documentation

ULONG COleClient::m_cRef [protected]

Definition at line 1414 of file cdialoglite.h.

The documentation for this class was generated from the following file:
  • Dataaccess/oledb/rowsetviewer/cdialoglite.h
Generated on Wed Nov 13 2024 16:56:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: COLEDBComponent Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

COLEDBComponent Class Reference

#include "oledbcomponent.h"

List of all members.

Public Member Functions

COLEDBComponent ()
STDMETHOD() | Activate ()
STDMETHOD() | SimpleQuery (BSTR *returnval)
STDMETHOD_ (BOOL, CanBePooled)()
STDMETHOD_ (void, Deactivate)()

Public Attributes

CComPtr< IObjectContext > | m_spObjectContext

Detailed Description

Definition at line 35 of file oledbcomponent.h.

Constructor & Destructor Documentation

COLEDBComponent::COLEDBComponent ( ) [inline]

Definition at line 44 of file oledbcomponent.h.

  {
  }

Member Function Documentation

HRESULT COLEDBComponent::Activate ( void )

Definition at line 47 of file oledbcomponent.Cpp.

{
  HRESULT hr = CoGetObjectContext(IID_IObjectContext, (void**)&m_spObjectContext);
  if (SUCCEEDED(hr))
    return S_OK;
  return hr;
}

STDMETHODIMP COLEDBComponent::SimpleQuery ( BSTR * returnval )

Definition at line 66 of file oledbcomponent.Cpp.

{

  IDBInitialize*    pIDBInitialize    = NULL;
   IMultipleResults*  pIMultipleResults = NULL;
   IDBCreateSession* pIDBCreateSession  = NULL;
   IDBCreateCommand* pIDBCreateCommand  = NULL;
   ICommandText*     pICommandText    = NULL;
   ICommand*         pICommand      = NULL;
   IAccessor*     pIAccessor      = NULL;
   IRowset*       pIRowset      = NULL;

  LPCOLESTR         wSQLString
    = OLESTR("select au_fname from authors where au_lname = 'White'");
   LONG              cRowsAffected;
   HRESULT           retcode;
   ULONG          cRowsObtained;
   HROW         hRow;
   HROW*          pRows = &hRow;
   HACCESSOR      hAccessor;
   DBBINDSTATUS   DBBindStatus;
   DBBINDING      DBBindings =
      {1, 0, 0, 0, NULL, NULL, NULL, DBPART_VALUE,
      DBMEMOWNER_CLIENTOWNED, DBPARAMIO_NOTPARAM, 20,
      0, 129, 255, 255};
  char          RowValue[20];

//  Helper        myHelper;

  CoInitialize(NULL);

  if(FAILED(CoCreateInstance(CLSID_MSDASQL, NULL, CLSCTX_INPROC_SERVER,
        IID_IDBInitialize, (void**)&pIDBInitialize)))
        goto error;

   if(FAILED(SetInitProps(pIDBInitialize)))
        goto error;

  if(FAILED(pIDBInitialize->Initialize()))
    goto error;

  if(FAILED(pIDBInitialize->QueryInterface(IID_IDBCreateSession, (void**) &pIDBCreateSession)))
      goto error;

   if(FAILED(pIDBCreateSession->CreateSession(NULL, IID_IDBCreateCommand,
       (IUnknown**) &pIDBCreateCommand)))
    goto error;

   if(FAILED(pIDBCreateCommand->CreateCommand(NULL, IID_ICommand,
       (IUnknown**) &pICommand)))
    goto error;

   if(FAILED(retcode=pICommand->QueryInterface(IID_ICommandText,
    (void**) &pICommandText)))
    goto error;

   //if(FAILED(pICommandText->SetCommandText(DBGUID_DBSQL, wSQLString))))
   if(FAILED(pICommandText->SetCommandText(DBGUID_DEFAULT, OLESTR("select au_fname from authors where au_lname = 'White'"))))
    goto error;

  if(FAILED(pICommand->Execute(NULL, IID_IMultipleResults, NULL,
    &cRowsAffected,(IUnknown**) &pIMultipleResults)))
    goto error;

  if(FAILED(pIMultipleResults->GetResult(NULL, 0, IID_IRowset,
    &cRowsAffected,(IUnknown**) &pIRowset)))
    goto error;

   if(FAILED(pIRowset->QueryInterface(IID_IAccessor,
    (void**) &pIAccessor)))
    goto error;

   if(FAILED(pIAccessor->CreateAccessor(DBACCESSOR_ROWDATA, 1,
    &DBBindings,0,&hAccessor,&DBBindStatus)))
    goto error;

  if(DBBINDSTATUS_OK != DBBindStatus)
    goto error;

   if(FAILED(pIRowset->GetNextRows(0,0,1,&cRowsObtained,&pRows )))
    goto error;

  if(cRowsObtained == 0)
        goto error;

   if(FAILED(pIRowset->GetData(hRow, hAccessor, RowValue)))
    goto error;

  OLECHAR svalue[20];
   if(0 == MultiByteToWideChar(CP_ACP, 0, (const char *)RowValue,
    20, svalue, 20))
    goto error;
  *returnval = SysAllocString(svalue);

  if (m_spObjectContext)
    m_spObjectContext->SetComplete();

  retcode = S_OK;

  goto cleanup;

error:
  if (m_spObjectContext)
    m_spObjectContext->SetAbort();
  retcode = E_FAIL;
  goto cleanup;

cleanup:
  if(pIDBCreateSession)
      pIDBCreateSession->Release();

   if(pIDBCreateCommand)
    pIDBCreateCommand->Release();

  if(pICommand)
      pICommand->Release();

   if(pICommandText)
    pICommandText->Release();

  if(pIRowset)
  {
    pIRowset->ReleaseRows(cRowsObtained, &hRow, NULL, NULL, NULL);
    pIRowset->Release();
  }

  if(pIAccessor)
  {
    pIAccessor->ReleaseAccessor(hAccessor, NULL);
    pIAccessor->Release();
  }

  if(pIMultipleResults)
    pIMultipleResults->Release();

  if(pIDBInitialize)
  {
    pIDBInitialize->Uninitialize();
    pIDBInitialize->Release();
  }

    CoUninitialize();

    return retcode;
}

COLEDBComponent::STDMETHOD_ | ( | void | ,
 |  | Deactivate |
 | ) |  |
COLEDBComponent::STDMETHOD_ | ( | BOOL | ,
 |  | CanBePooled |
 | ) |  |

Member Data Documentation

CComPtr<IObjectContext> COLEDBComponent::m_spObjectContext

Definition at line 62 of file oledbcomponent.h.

The documentation for this class was generated from the following files:
  • Com/Services/Transaction/DataAccess/DataAcOleDB/oledbcomponent.h
  • Com/Services/Transaction/DataAccess/DataAcOleDB/oledbcomponent.Cpp
Generated on Wed Nov 13 2024 16:56:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: COleDocument Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes | Friends

COleDocument Class Reference

#include "OLEDoc.h"

List of all members.

Public Member Functions

COleDocument ()
~COleDocument ()
BOOL CreateFile (LPTSTR)
BOOL | CreateFile (HWND)
STDMETHODIMP | CreateView (IOleInPlaceSite *, IStream *, DWORD, IOleDocumentView **)
STDMETHODIMP | EnumViews (IEnumOleDocumentViews **, IOleDocumentView **)
STDMETHODIMP | GetDocMiscStatus (DWORD *)
STDMETHODIMP | QueryInterface (REFIID, LPVOID *)
BOOL | RegisterServer (void)
STDMETHODIMP_ (DWORD) Release()
STDMETHODIMP_ (DWORD) AddRef()

Private Member Functions

STDMETHODIMP | DeactivateInPlace ()
STDMETHODIMP | DeactivateUI ()
STDMETHODIMP | GetWindow (HWND *)

Private Attributes

COLORREF | m_Color
DWORD m_dwRegister
BOOL m_fCreated
BOOL m_fDirty
BOOL m_fNoScribbleMode
DWORD m_ObjRefCount
CDataObject * m_pDataObject
LPOLEADVISEHOLDER | m_pOleAdviseHolder
LPOLECLIENTSITE | m_pOleClientSite
COleDocumentView * m_pOleDocView
COleInPlaceActiveObject * m_pOleInPlaceActiveObject
COleInPlaceObject * m_pOleInPlaceObject
COleObject * m_pOleObject
CPersistFile * m_pPersistFile
CPersistStorage * m_pPersistStorage

Friends

class | CDataObject
class | COleDocumentView
class | COleInPlaceActiveObject
class | COleInPlaceObject
class | COleObject
BOOL CALLBACK | ColorHookProc (HWND, UINT, WPARAM, LPARAM)
class | CPersistStorage

Detailed Description

Definition at line 45 of file OLEDoc.h.

Constructor & Destructor Documentation

COleDocument::COleDocument ( )

Definition at line 46 of file OLEDoc.Cpp.

{
  OutputDebugString(TEXT("COleDocument's constructor\n"));

  m_ObjRefCount = 0;

  m_fDirty = FALSE;
  m_fNoScribbleMode = FALSE;
  m_pOleAdviseHolder = NULL;
  m_pOleClientSite = NULL;
  m_dwRegister = 0;
  m_pOleDocView = NULL;
  m_Color = DEFAULT_COLOR;
  m_fCreated = FALSE;

  m_pOleObject = new COleObject(this);

  m_pDataObject = new CDataObject(this);

  m_pOleInPlaceObject = new COleInPlaceObject(this);

  m_pOleInPlaceActiveObject = new COleInPlaceActiveObject(this);

  m_pPersistStorage = new CPersistStorage(this);

  m_pPersistFile = new CPersistFile(this, m_pPersistStorage);

  m_pOleDocView = new COleDocumentView(this);

  g_DllRefCount++;
}

COleDocument::~COleDocument ( )

Definition at line 84 of file OLEDoc.Cpp.

{
  OutputDebugString(TEXT("COleDocument's destructor\n"));

  if(m_pOleAdviseHolder)
    m_pOleAdviseHolder->Release();

  if(m_pOleClientSite)
    m_pOleClientSite->Release();

  delete m_pOleDocView;

  delete m_pPersistFile;

  delete m_pPersistStorage;

  delete m_pOleInPlaceActiveObject;

  delete m_pOleInPlaceObject;

  delete m_pDataObject;

  delete m_pOleObject;

  g_DllRefCount--;

  PostQuitMessage(0);
}

Member Function Documentation

BOOL COleDocument::CreateFile ( HWND hwndParent )

Definition at line 704 of file OLEDoc.Cpp.

  {
    OutputDebugString("COleDocument::CreateFile(HWND)\n");

    OPENFILENAME   ofn;
    TCHAR          szFilter[MAX_PATH];
    TCHAR          szFile[MAX_PATH] = TEXT("");
    LPTSTR         pTemp;

    //build the filter string
    pTemp = szFilter;
    lstrcpy(pTemp, DOC_NAME);
    pTemp += lstrlen(pTemp) + 1;
    lstrcpy(pTemp, TEXT("*"));
    lstrcat(pTemp, FILE_EXT);
    pTemp += lstrlen(pTemp) + 1;
    *pTemp = 0;

    ZeroMemory(&ofn, sizeof(ofn));
    ofn.lStructSize         = sizeof(ofn);
    ofn.hwndOwner           = hwndParent;
    ofn.hInstance           = g_hInst;
    ofn.lpstrFilter         = szFilter;
    ofn.lpstrCustomFilter   = NULL;
    ofn.nMaxCustFilter      = 0;
    ofn.nFilterIndex        = 1;
    ofn.lpstrFile           = szFile;
    ofn.nMaxFile            = ARRAYSIZE(szFile);
    ofn.lpstrFileTitle      = NULL;
    ofn.nMaxFileTitle       = 0;
    ofn.lpstrInitialDir     = NULL;
    ofn.lpstrTitle          = NULL;
    ofn.lpTemplateName      = MAKEINTRESOURCE(IDD_COLOR_DIALOG);
    ofn.lpfnHook            = (LPOFNHOOKPROC)ColorHookProc;
    ofn.lCustData           = (DWORD)this;
    ofn.Flags               = OFN_EXPLORER |
      OFN_OVERWRITEPROMPT |
      OFN_HIDEREADONLY |
      OFN_ENABLEHOOK |
      OFN_ENABLETEMPLATE |
      0;

    if(GetSaveFileName(&ofn))
    {
      //if the extension isn't attached, attach it
      pTemp = szFile + lstrlen(szFile) - 4;
      if(lstrcmpi(pTemp, FILE_EXT))
      {
        lstrncat(szFile, FILE_EXT, sizeof(szFile)/sizeof(TCHAR) -
          lstrlen(szFile));
      }

      return CreateFile(szFile);
    }

    return FALSE;
  }

BOOL COleDocument::CreateFile ( LPTSTR pszFile )

Definition at line 769 of file OLEDoc.Cpp.

  {
    OutputDebugString("COleDocument::CreateFile(LPTSTR)\n");

    WCHAR szwFile[MAX_PATH];

#ifdef UNICODE
    lstrcpyn(szwFile, pszFile, sizeof(szwFile)/sizeof(TCHAR));
#else
    MultiByteToWideChar( CP_ACP,
      MB_PRECOMPOSED,
      pszFile,
      -1,
      szwFile,
      ARRAYSIZE(szwFile));
#endif

    m_pPersistFile->Save(szwFile, FALSE);

    return TRUE;
  }

STDMETHODIMP COleDocument::CreateView | ( | IOleInPlaceSite * | pInPlaceSite,
 |  | IStream * | pStream,
 |  | DWORD | dwReserved,
 |  | IOleDocumentView ** | ppOleDocumentView
 | ) |  |

Definition at line 265 of file OLEDoc.Cpp.

{
  UNREFERENCED_PARAMETER(dwReserved);
  OutputDebugString(TEXT("COleDocument::CreateView\n"));

  HRESULT  hr = E_FAIL;

  //NULL the view pointer
  *ppOleDocumentView = NULL;

  //we only support one view, so fail if the view already exists
  if(!m_fCreated)
  {
    //AddRef since we are giving away the pointer
    m_pOleDocView->AddRef();

    // if we were given a site, set this as the site for the view we just created
    if(pInPlaceSite)
    {
      m_pOleDocView->SetInPlaceSite(pInPlaceSite);
    }

    // if given a stream to initialize from, initialize our view state
    if(pStream)
    {
      m_pOleDocView->ApplyViewState(pStream);
    }

    *ppOleDocumentView = m_pOleDocView;

    m_fCreated = TRUE;

    hr = S_OK;
  }

  return hr;
}

STDMETHODIMP COleDocument::DeactivateInPlace ( ) [private]

Definition at line 384 of file OLEDoc.Cpp.

{
  OutputDebugString(TEXT("COleDocument::DeactivateInPlace\n"));

  if(m_pOleDocView)
    return m_pOleDocView->DeactivateInPlace();

  return E_FAIL;
}

STDMETHODIMP COleDocument::DeactivateUI ( ) [private]

Definition at line 368 of file OLEDoc.Cpp.

{
  OutputDebugString(TEXT("COleInPlaceObject::DeactivateUI\n"));

  if(m_pOleDocView)
    return m_pOleDocView->DeactivateUI();

  return E_FAIL;
}

STDMETHODIMP COleDocument::EnumViews | ( | IEnumOleDocumentViews ** | ppEnum,
 |  | IOleDocumentView ** | ppView
 | ) |  |

Definition at line 330 of file OLEDoc.Cpp.

{
  OutputDebugString(TEXT("COleDocument::EnumViews\n"));

  *ppEnum = NULL;
  *ppView = NULL;

  return E_NOTIMPL;
}

STDMETHODIMP COleDocument::GetDocMiscStatus ( DWORD * pdwStatus )

Definition at line 312 of file OLEDoc.Cpp.

{
  OutputDebugString(TEXT("COleDocument::GetDocMiscStatus\n"));

  if(!pdwStatus)
    return E_INVALIDARG;

  *pdwStatus = 0;

  return S_OK;
}

STDMETHODIMP COleDocument::GetWindow ( HWND * phwnd ) [private]

Definition at line 347 of file OLEDoc.Cpp.

{
  OutputDebugString(TEXT("COleDocument::GetWindow\n"));

  if(!phwnd)
    return E_INVALIDARG;

  *phwnd = NULL;

  if(m_pOleDocView)
    *phwnd = m_pOleDocView->m_hwndView;

  return S_OK;
}

STDMETHODIMP COleDocument::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppReturn
 | ) |  |

Definition at line 124 of file OLEDoc.Cpp.

{
  OutputDebugString(TEXT("COleDocument::QueryInterface - "));

  HRESULT  hr = E_NOINTERFACE;
  *ppReturn = NULL;

  if(riid == IID_IUnknown)
  {
    *ppReturn = this;
    OutputDebugString(TEXT("IUnknown requested - "));
  }
  else if (riid == IID_IOleDocument)
  {
    *ppReturn = this;
    OutputDebugString(TEXT("IOleDocument requested - "));
  }
  else if (riid == IID_IOleDocumentView)
  {
    *ppReturn = m_pOleDocView;
    OutputDebugString(TEXT("IOleDocumentView requested - "));
  }
  else if (riid == IID_IOleObject)
  {
    *ppReturn = m_pOleObject;
    OutputDebugString(TEXT("IOleObject requested - "));
  }
  else if (riid == IID_IDataObject)
  {
    *ppReturn = m_pDataObject;
    OutputDebugString(TEXT("IDataObject requested - "));
  }
  else if (riid == IID_IOleInPlaceObject)
  {
    *ppReturn = m_pOleInPlaceObject;
    OutputDebugString(TEXT("IOleInPlaceObject requested - "));
  }
  else if (riid == IID_IOleInPlaceActiveObject)
  {
    *ppReturn = m_pOleInPlaceActiveObject;
    OutputDebugString(TEXT("IOleInPlaceActiveObject requested - "));
  }
  else if((riid == IID_IPersistStorage) || (riid == IID_IPersist))
  {
    *ppReturn = m_pPersistStorage;
    OutputDebugString(TEXT("IPersistStorage requested - "));
  }
  else if(riid == IID_IPersistFile)
  {
    *ppReturn = m_pPersistFile;
    OutputDebugString(TEXT("IPersistFile requested - "));
  }

  if (*ppReturn)
  {
    OutputDebugString(TEXT("Interface Found\n"));
    ((LPUNKNOWN)*ppReturn)->AddRef();
    hr = S_OK;
  }
  else
  {
    OutputDebugString(TEXT("No Interface - "));

    LPWSTR   pwsz;
    TCHAR    szString[MAX_PATH] = TEXT("");

    StringFromIID(riid, &pwsz);

    if(pwsz)
    {
#ifdef UNICODE
      lstrcpyn(szString, pwsz, sizeof(szString)/sizeof(TCHAR));
#else
      WideCharToMultiByte( CP_ACP,
        0,
        pwsz,
        -1,
        szString,
        ARRAYSIZE(szString),
        NULL,
        NULL);
#endif
      OutputDebugString(szString);
      OutputDebugString(TEXT("\n"));

      //free the string
      LPMALLOC pMalloc;
      CoGetMalloc(1, &pMalloc);
      pMalloc->Free(pwsz);
      pMalloc->Release();
    }
  }

  return hr;
}

BOOL COleDocument::RegisterServer ( void )

Definition at line 406 of file OLEDoc.Cpp.

{
  OutputDebugString("COleDocument::RegisterServer\n");

  int      i;
  HKEY     hKey;
  LRESULT  lResult;
  DWORD    dwDisp;
  TCHAR    szSubKey[MAX_PATH];
  TCHAR    szCLSID[MAX_PATH];
  TCHAR    szApp[MAX_PATH];
  LPWSTR   pwsz;
  CLSID    clsid;

  //get this app's CLSID in string form
  m_pPersistStorage->GetClassID(&clsid);
  StringFromIID(clsid, &pwsz);

  if(pwsz)
  {
#ifdef UNICODE
    lstrcpyn(szCLSID, pwsz, sizeof(szCLSID)/sizeof(TCHAR));
#else
    WideCharToMultiByte( CP_ACP,
      0,
      pwsz,
      -1,
      szCLSID,
      ARRAYSIZE(szCLSID),
      NULL,
      NULL);
#endif

    //free the string
    LPMALLOC pMalloc;
    CoGetMalloc(1, &pMalloc);
    pMalloc->Free(pwsz);
    pMalloc->Release();
  }

  DWORD dwRes;
  PSID pEveryoneSID = NULL, pAdminSID = NULL;
  PACL pACL = NULL;
  PSECURITY_DESCRIPTOR pSD = NULL;
  EXPLICIT_ACCESS ea[2];
  SID_IDENTIFIER_AUTHORITY SIDAuthWorld = SECURITY_WORLD_SID_AUTHORITY;
  SID_IDENTIFIER_AUTHORITY SIDAuthNT = SECURITY_NT_AUTHORITY;
  SECURITY_ATTRIBUTES sa;

  // Create a well-known SID for the Everyone group.
  if(! AllocateAndInitializeSid( &SIDAuthWorld, 1,
    SECURITY_WORLD_RID,
    0, 0, 0, 0, 0, 0, 0,
    &pEveryoneSID) ) {
      return FALSE;
  }

  // Initialize an EXPLICIT_ACCESS structure for an ACE.
  // The ACE will allow Everyone read access to the key.

  ZeroMemory(&ea, 2 * sizeof(EXPLICIT_ACCESS));
  ea[0].grfAccessPermissions = KEY_READ;
  ea[0].grfAccessMode = SET_ACCESS;
  ea[0].grfInheritance= NO_INHERITANCE;
  ea[0].Trustee.TrusteeForm = TRUSTEE_IS_SID;
  ea[0].Trustee.TrusteeType = TRUSTEE_IS_WELL_KNOWN_GROUP;
  ea[0].Trustee.ptstrName  = (LPTSTR) pEveryoneSID;

  // Create a SID for the BUILTIN\Administrators group.

  if(! AllocateAndInitializeSid( &SIDAuthNT, 2,
    SECURITY_BUILTIN_DOMAIN_RID,
    DOMAIN_ALIAS_RID_ADMINS,
    0, 0, 0, 0, 0, 0,
    &pAdminSID) ) {
    goto Cleanup;
  }

  // Initialize an EXPLICIT_ACCESS structure for an ACE.
  // The ACE will allow the Administrators group full access to the key.

  ea[1].grfAccessPermissions = KEY_ALL_ACCESS;
  ea[1].grfAccessMode = SET_ACCESS;
  ea[1].grfInheritance= NO_INHERITANCE;
  ea[1].Trustee.TrusteeForm = TRUSTEE_IS_SID;
  ea[1].Trustee.TrusteeType = TRUSTEE_IS_GROUP;
  ea[1].Trustee.ptstrName  = (LPTSTR) pAdminSID;

  // Create a new ACL that contains the new ACEs.

  dwRes = SetEntriesInAcl(2, ea, NULL, &pACL);
  if (ERROR_SUCCESS != dwRes) {
    goto Cleanup;
  }

  // Initialize a security descriptor.

  pSD = (PSECURITY_DESCRIPTOR) LocalAlloc(LPTR,
    SECURITY_DESCRIPTOR_MIN_LENGTH);
  if (pSD == NULL) {
    goto Cleanup;
  }

  if (!InitializeSecurityDescriptor(pSD, SECURITY_DESCRIPTOR_REVISION)) {
    goto Cleanup;
  }

  // Add the ACL to the security descriptor.

  if (!SetSecurityDescriptorDacl(pSD,
    TRUE,     // fDaclPresent flag
    pACL,
    FALSE))   // not a default DACL
  {
    goto Cleanup;
  }

  // Initialize a security attributes structure.

  sa.nLength = sizeof (SECURITY_ATTRIBUTES);
  sa.lpSecurityDescriptor = pSD;
  sa.bInheritHandle = FALSE;

  //get this app's path and file name
  GetModuleFileName(NULL, szApp, ARRAYSIZE(szApp));

  //register the file extension entries
  {
    DOREGSTRUCT FileEntries[] = { HKEY_CLASSES_ROOT,   TEXT("%s"),                         PROG_ID,
      0,                   TEXT(""),                           TEXT("")};

    for(i = 0; FileEntries[i].hRootKey; i++)
    {
      //create the sub key string - for this case, insert the file extension
      wsprintf(szSubKey, FileEntries[i].szSubKey, FILE_EXT);

      lResult = RegCreateKeyEx(  FileEntries[i].hRootKey,
        szSubKey,
        0,
        NULL,
        REG_OPTION_NON_VOLATILE,
        KEY_WRITE,
        &sa,
        &hKey,
        &dwDisp);

      if(NOERROR == lResult)
      {
        lResult = RegSetValueEx(   hKey,
          NULL,
          0,
          REG_SZ,
          (LPBYTE)FileEntries[i].szValue,
          lstrlen(FileEntries[i].szValue) + 1);

        RegCloseKey(hKey);
      }
      else
        return FALSE;
    }
  }

  {
    DOREGSTRUCT ProgEntries[] = { HKEY_CLASSES_ROOT,   TEXT("%s"),                         DOC_NAME,
      HKEY_CLASSES_ROOT,   TEXT("%s\\CLSID"),                  TEXT("%s"),
      HKEY_CLASSES_ROOT,   TEXT("%s\\DocObject"),        TEXT(""),
      0,                   TEXT(""),                           TEXT("")};

    //register the ProgID entries
    for(i = 0; ProgEntries[i].hRootKey; i++)
    {
      //create the sub key string - for this case, insert the ProgID
      wsprintf(szSubKey, ProgEntries[i].szSubKey, PROG_ID);

      lResult = RegCreateKeyEx(  ProgEntries[i].hRootKey,
        szSubKey,
        0,
        NULL,
        REG_OPTION_NON_VOLATILE,
        KEY_WRITE,
        &sa,
        &hKey,
        &dwDisp);

      if(NOERROR == lResult)
      {
        TCHAR szValue[MAX_PATH];

        //if necessary, create the value string
        wsprintf(szValue, ProgEntries[i].szValue, szCLSID);

        lResult = RegSetValueEx(   hKey,
          NULL,
          0,
          REG_SZ,
          (LPBYTE)szValue,
          lstrlen(szValue) + 1);

        RegCloseKey(hKey);
      }
      else
        return FALSE;
    }
  }

  {
    DOREGSTRUCT ClsidEntries[] = {HKEY_CLASSES_ROOT,   TEXT("CLSID\\%s"),                  DOC_NAME,
      HKEY_CLASSES_ROOT,   TEXT("CLSID\\%s\\LocalServer32"),   TEXT("%s"),
      HKEY_CLASSES_ROOT,   TEXT("CLSID\\%s\\InprocHandler32"), TEXT("ole32.dll"),
      HKEY_CLASSES_ROOT,   TEXT("CLSID\\%s\\DefaultIcon"),     TEXT("%s,0"),
      HKEY_CLASSES_ROOT,   TEXT("CLSID\\%s\\DocObject"),     TEXT("0"),
      HKEY_CLASSES_ROOT,   TEXT("CLSID\\%s\\ProgID"),      PROG_ID,
      0,                   TEXT(""),                           TEXT("")};

    //register the CLSID entries
    for(i = 0; ClsidEntries[i].hRootKey; i++)
    {
      //create the sub key string - for this case, insert the file extension
      wsprintf(szSubKey, ClsidEntries[i].szSubKey, szCLSID);

      lResult = RegCreateKeyEx(  ClsidEntries[i].hRootKey,
        szSubKey,
        0,
        NULL,
        REG_OPTION_NON_VOLATILE,
        KEY_WRITE,
        &sa,
        &hKey,
        &dwDisp);

      if(NOERROR == lResult)
      {
        TCHAR szValue[MAX_PATH];

        //if necessary, create the value string
        wsprintf(szValue, ClsidEntries[i].szValue, szApp);

        lResult = RegSetValueEx(   hKey,
          NULL,
          0,
          REG_SZ,
          (LPBYTE)szValue,
          lstrlen(szValue) + 1);

        RegCloseKey(hKey);
      }
      else
        return FALSE;
    }
  }
Cleanup:

  if (pEveryoneSID)
    FreeSid(pEveryoneSID);
  if (pAdminSID)
    FreeSid(pAdminSID);
  if (pACL)
    LocalFree(pACL);
  if (pSD)
    LocalFree(pSD);

  //register the component as insertable and a document object
  ICatRegister   *pcr;
  HRESULT        hr = S_OK ;

  CoInitialize(NULL);

  hr = CoCreateInstance(  CLSID_StdComponentCategoriesMgr,
    NULL,
    CLSCTX_INPROC_SERVER,
    IID_ICatRegister,
    (LPVOID*)&pcr);

  if(SUCCEEDED(hr))
  {
    CATID rgcatid[2];

    rgcatid[0] = CATID_Insertable;
    rgcatid[1] = CATID_DocObject;

    hr = pcr->RegisterClassImplCategories(clsid, 2, rgcatid);

    pcr->Release();
  }

  CoUninitialize();

  return SUCCEEDED(hr);
}

COleDocument::STDMETHODIMP_ ( DWORD )
COleDocument::STDMETHODIMP_ ( DWORD )

Friends And Related Function Documentation

friend class CDataObject [friend]

Definition at line 49 of file OLEDoc.h.

friend class COleDocumentView [friend]

Definition at line 47 of file OLEDoc.h.

friend class COleInPlaceActiveObject [friend]

Definition at line 51 of file OLEDoc.h.

friend class COleInPlaceObject [friend]

Definition at line 50 of file OLEDoc.h.

friend class COleObject [friend]

Definition at line 48 of file OLEDoc.h.

BOOL CALLBACK ColorHookProc | ( | HWND | hWnd,
 |  | UINT | uMessage,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [friend]

Definition at line 228 of file DoServer.Cpp.

{
  UNREFERENCED_PARAMETER(lParam);
  UNREFERENCED_PARAMETER(wParam);
  static COleDocument  *pOleDoc;
  static UINT          uSaveOK;

  switch(uMessage)
  {
  case WM_INITDIALOG:
    {
      UINT  uSelect;

      pOleDoc = (COleDocument*)((LPOPENFILENAME)(lParam))->lCustData;

      uSaveOK = RegisterWindowMessage(FILEOKSTRING);

      switch(pOleDoc->m_Color)
      {
      default:
      case RED_COLOR:
        uSelect = IDC_RED;
        break;

      case GREEN_COLOR:
        uSelect = IDC_GREEN;
        break;

      case BLUE_COLOR:
        uSelect = IDC_BLUE;
        break;
      }

      CheckRadioButton(hWnd, IDC_RED, IDC_BLUE, uSelect);
    }
    break;

  case WM_DESTROY:
    break;

  default:
    if(uMessage == uSaveOK)
    {
      //Save button pressed
      if(IsDlgButtonChecked(hWnd, IDC_GREEN))
            {
        pOleDoc->m_Color = GREEN_COLOR;
            }
      else if(IsDlgButtonChecked(hWnd, IDC_BLUE))
            {
        pOleDoc->m_Color = BLUE_COLOR;
            }
      else
            {
        pOleDoc->m_Color = RED_COLOR;
            }
    }

    break;
  }

  return FALSE;
}

friend class CPersistStorage [friend]

Definition at line 52 of file OLEDoc.h.

Member Data Documentation

COLORREF COleDocument::m_Color [private]

Definition at line 55 of file OLEDoc.h.

DWORD COleDocument::m_dwRegister [private]

Definition at line 56 of file OLEDoc.h.

BOOL COleDocument::m_fCreated [private]

Definition at line 62 of file OLEDoc.h.

BOOL COleDocument::m_fDirty [private]

Definition at line 59 of file OLEDoc.h.

BOOL COleDocument::m_fNoScribbleMode [private]

Definition at line 60 of file OLEDoc.h.

DWORD COleDocument::m_ObjRefCount [private]

Definition at line 58 of file OLEDoc.h.

CDataObject* COleDocument::m_pDataObject [private]

Definition at line 66 of file OLEDoc.h.

LPOLEADVISEHOLDER COleDocument::m_pOleAdviseHolder [private]

Definition at line 61 of file OLEDoc.h.

LPOLECLIENTSITE COleDocument::m_pOleClientSite [private]

Definition at line 57 of file OLEDoc.h.

COleDocumentView* COleDocument::m_pOleDocView [private]

Definition at line 64 of file OLEDoc.h.

COleInPlaceActiveObject* COleDocument::m_pOleInPlaceActiveObject [private]

Definition at line 68 of file OLEDoc.h.

COleInPlaceObject* COleDocument::m_pOleInPlaceObject [private]

Definition at line 67 of file OLEDoc.h.

COleObject* COleDocument::m_pOleObject [private]

Definition at line 65 of file OLEDoc.h.

CPersistFile* COleDocument::m_pPersistFile [private]

Definition at line 70 of file OLEDoc.h.

CPersistStorage* COleDocument::m_pPersistStorage [private]

Definition at line 69 of file OLEDoc.h.

The documentation for this class was generated from the following files:
  • Com/Fundamentals/ActiveDocument/DoServer/OLEDoc.h
  • Com/Fundamentals/ActiveDocument/DoServer/OLEDoc.Cpp
Generated on Wed Nov 13 2024 16:56:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: COleDocumentView Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Friends

COleDocumentView Class Reference

#include "OLEDocVw.h"

List of all members.

Public Member Functions

COleDocumentView (COleDocument *)
~COleDocumentView ()
STDMETHODIMP | ApplyViewState (IStream *)
STDMETHODIMP | Clone (IOleInPlaceSite *, IOleDocumentView **)
STDMETHODIMP | CloseView (DWORD)
STDMETHODIMP | GetDocument (IUnknown **)
STDMETHODIMP | GetInPlaceSite (IOleInPlaceSite **)
STDMETHODIMP | GetRect (LPRECT)
STDMETHODIMP | Open (void)
STDMETHODIMP | QueryInterface (REFIID, LPVOID *)
STDMETHODIMP | SaveViewState (IStream *)
STDMETHODIMP | SetInPlaceSite (IOleInPlaceSite *)
STDMETHODIMP | SetRect (LPRECT)
STDMETHODIMP | SetRectComplex (LPRECT, LPRECT, LPRECT, LPRECT)
STDMETHODIMP | Show (BOOL)
STDMETHODIMP_ (DWORD) Release()
STDMETHODIMP_ (DWORD) AddRef()
STDMETHODIMP | UIActivate (BOOL)

Private Member Functions

STDMETHODIMP | ActivateInPlace ()
STDMETHODIMP | ActivateUI ()
STDMETHODIMP | CreateViewWindow ()
STDMETHODIMP | DeactivateInPlace ()
STDMETHODIMP | DeactivateUI ()
BOOL | MergeMenus (void)
LRESULT | OnCommand (UINT, UINT, HWND)
LRESULT | OnCreate (void)
LRESULT | OnPaint (void)
BOOL | RemoveMenus (void)
BOOL | UpdateMenu (HMENU)

Static Private Member Functions

static LRESULT CALLBACK | ViewWndProc (HWND, UINT, WPARAM, LPARAM)

Private Attributes

BOOL m_fInPlaceActive
OLEINPLACEFRAMEINFO | m_FrameInfo
BOOL m_fUIActive
HOLEMENU | m_hOleMenu
HMENU | m_hSharedMenu
HWND | m_hwndView
OLEMENUGROUPWIDTHS | m_mgw
LPOLEINPLACEFRAME | m_pInPlaceFrame
LPOLEINPLACESITE | m_pInPlaceSite
LPOLEINPLACEUIWINDOW | m_pInPlaceUIWindow
COleDocument * m_pOleDoc
RECT | m_Rect

Friends

class | COleDocument
class | COleInPlaceActiveObject

Detailed Description

Definition at line 41 of file OLEDocVw.h.

Constructor & Destructor Documentation

COleDocumentView::COleDocumentView ( COleDocument * pOleDoc )

Definition at line 39 of file OLEDocVw.Cpp.

{
  OutputDebugString(TEXT("COleDocumentView's constructor\n"));

  m_fInPlaceActive = FALSE;
  m_fUIActive = FALSE;
  m_hOleMenu = NULL;
  m_hSharedMenu = NULL;
  m_hwndView = NULL;
  m_pInPlaceFrame = NULL;
  m_pInPlaceSite = NULL;
  m_pInPlaceUIWindow = NULL;

  m_pOleDoc = pOleDoc;

  CreateViewWindow();
}

COleDocumentView::~COleDocumentView ( )

Definition at line 63 of file OLEDocVw.Cpp.

{
  OutputDebugString(TEXT("COleDocumentView's destructor\n"));

  if(m_pInPlaceFrame)
    m_pInPlaceFrame->Release();

  if(m_pInPlaceUIWindow)
    m_pInPlaceUIWindow->Release();

  if(m_pInPlaceSite)
    m_pInPlaceSite->Release();
}

Member Function Documentation

STDMETHODIMP COleDocumentView::ActivateInPlace ( ) [private]

Definition at line 489 of file OLEDocVw.Cpp.

{
  OutputDebugString(TEXT("COleDocumentView::ActivateInPlace\n"));

  m_fInPlaceActive = TRUE;

  if(m_pInPlaceSite)
  {
    // tell the site we are in-place activating
    m_pInPlaceSite->OnInPlaceActivate();

    HWND  hwndParent;
    m_pInPlaceSite->GetWindow(&hwndParent);
    SetParent(m_hwndView, hwndParent);

    //show the view
    Show(TRUE);
  }

  return S_OK;
}

STDMETHODIMP COleDocumentView::ActivateUI ( ) [private]

Definition at line 344 of file OLEDocVw.Cpp.

{
  OutputDebugString(TEXT("COleDocumentView::ActivateUI\n"));

  //set the active object
  //either one of these could be good
  if(m_pInPlaceFrame)
  {
    m_pInPlaceFrame->SetActiveObject(m_pOleDoc->m_pOleInPlaceActiveObject, NULL);
  }

  if(m_pInPlaceUIWindow)
  {
    m_pInPlaceUIWindow->SetActiveObject(m_pOleDoc->m_pOleInPlaceActiveObject, NULL);
  }

  if(m_pInPlaceSite)
  {
    m_fUIActive = TRUE;

    ActivateInPlace();

    m_pInPlaceSite->OnUIActivate();

    MergeMenus();

    SetFocus(m_hwndView);
  }

  return S_OK;
}

STDMETHODIMP COleDocumentView::ApplyViewState ( IStream * pStream )

Definition at line 459 of file OLEDocVw.Cpp.

{
  UNREFERENCED_PARAMETER(pStream);
  OutputDebugString(TEXT("COleDocumentView::ApplyViewState\n"));

  return E_NOTIMPL;
}

STDMETHODIMP COleDocumentView::Clone | ( | IOleInPlaceSite * | pIPSite,
 |  | IOleDocumentView ** | ppView
 | ) |  |

Definition at line 473 of file OLEDocVw.Cpp.

{
  UNREFERENCED_PARAMETER(pIPSite);
  OutputDebugString(TEXT("COleDocumentView::Clone\n"));

  *ppView = NULL;

  return E_NOTIMPL;
}

STDMETHODIMP COleDocumentView::CloseView ( DWORD dwReserved )

Definition at line 429 of file OLEDocVw.Cpp.

{
  UNREFERENCED_PARAMETER(dwReserved);
  OutputDebugString(TEXT("COleDocumentView::CloseView\n"));

  SetInPlaceSite(NULL);

  return S_OK;
}

STDMETHODIMP COleDocumentView::CreateViewWindow ( ) [private]

Definition at line 544 of file OLEDocVw.Cpp.

{
  OutputDebugString(TEXT("COleDocumentView::CreateViewWindow\n"));

  WNDCLASS wc;

  //if our window class has not been registered, then do so
  if(!GetClassInfo(g_hInst, VIEW_CLASS_NAME, &wc))
  {
    ZeroMemory(&wc, sizeof(wc));
    wc.style          = CS_HREDRAW | CS_VREDRAW;
    wc.lpfnWndProc    = (WNDPROC)ViewWndProc;
    wc.cbClsExtra     = 0;
    wc.cbWndExtra     = 0;
    wc.hInstance      = g_hInst;
    wc.hIcon          = NULL;
    wc.hCursor        = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground  = (HBRUSH)(COLOR_WINDOW + 1);
    wc.lpszMenuName   = NULL;
    wc.lpszClassName  = VIEW_CLASS_NAME;

    if(!RegisterClass(&wc))
      return E_FAIL;
  }

  m_hwndView = CreateWindowEx(  WS_EX_CLIENTEDGE,
    VIEW_CLASS_NAME,
    NULL,
    WS_CHILD | WS_CLIPSIBLINGS,
    0,
    0,
    0,
    0,
    GetDesktopWindow(),
    NULL,
    g_hInst,
    (LPVOID)this);

  if(!m_hwndView)
  {
    return E_FAIL;
  }

  return S_OK;
}

STDMETHODIMP COleDocumentView::DeactivateInPlace ( ) [private]

Definition at line 517 of file OLEDocVw.Cpp.

{
  OutputDebugString(TEXT("COleDocumentView::InPlaceDeactivate\n"));

  //UI deactivate, if necessary and hide the view window
  Show(FALSE);

  m_fInPlaceActive = FALSE;

  if(m_pInPlaceSite)
  {
    // tell the site we are in-place deactivating
    m_pInPlaceSite->OnInPlaceDeactivate();
  }

  //set the parent to NULL
  SetParent(m_hwndView, GetDesktopWindow());

  return S_OK;
}

STDMETHODIMP COleDocumentView::DeactivateUI ( ) [private]

Definition at line 382 of file OLEDocVw.Cpp.

{
  OutputDebugString(TEXT("COleDocumentView::DeactivateUI\n"));

  m_fUIActive = FALSE;

  RemoveMenus();

  //remove the active object
  //either one of these could be good
  if(m_pInPlaceFrame)
  {
    m_pInPlaceFrame->SetActiveObject(NULL, NULL);
  }

  if(m_pInPlaceUIWindow)
  {
    m_pInPlaceUIWindow->SetActiveObject(NULL, NULL);
  }

  if(m_pInPlaceSite)
  {
    m_pInPlaceSite->OnUIDeactivate(FALSE);
  }

  return S_OK;
}

STDMETHODIMP COleDocumentView::GetDocument ( IUnknown ** ppUnk )

Definition at line 211 of file OLEDocVw.Cpp.

{
  OutputDebugString(TEXT("COleDocumentView::GetDocument\n"));

  *ppUnk = m_pOleDoc;

  if(*ppUnk)
    (*ppUnk)->AddRef();

  return S_OK;
}

STDMETHODIMP COleDocumentView::GetInPlaceSite ( IOleInPlaceSite ** ppInPlaceSite )

Definition at line 188 of file OLEDocVw.Cpp.

{
  OutputDebugString(TEXT("COleDocumentView::GetInPlaceSite\n"));

  HRESULT  hr = E_FAIL;

  *ppInPlaceSite = m_pInPlaceSite;

  if(*ppInPlaceSite)
  {
    (*ppInPlaceSite)->AddRef();
    hr = S_OK;
  }

  return hr;
}

STDMETHODIMP COleDocumentView::GetRect ( LPRECT pRect )

Definition at line 253 of file OLEDocVw.Cpp.

{
  OutputDebugString(TEXT("COleDocumentView::GetRect\n"));

  if(!pRect)
    return E_INVALIDARG;

  *pRect = m_Rect;

  return S_OK;
}

BOOL COleDocumentView::MergeMenus ( void ) [private]

Definition at line 709 of file OLEDocVw.Cpp.

{
  if(!m_hSharedMenu)
  {
    //  Create the menu resource
    m_hSharedMenu = CreateMenu();

    ZeroMemory(&m_mgw, sizeof(m_mgw));

    // have the contaner insert its menus
    if(SUCCEEDED(m_pInPlaceFrame->InsertMenus(m_hSharedMenu, &m_mgw)))
    {
      int   nFirstGroup = (int) m_mgw.width[0];
      HMENU hMenu,
        hSubMenu;
      TCHAR szText[MAX_PATH];

      hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_COLOR_MENU));
      hSubMenu = GetSubMenu(hMenu, 0);

      //get the menu item's text
      GetMenuString(hMenu, 0, szText, ARRAYSIZE(szText), MF_BYPOSITION);

      // insert the server menus
      InsertMenu( m_hSharedMenu,
        nFirstGroup,
        MF_BYPOSITION | MF_POPUP,
        (UINT_PTR)hSubMenu,
        szText);

      //update the OLEMENUGROUPWIDTHS structure
      m_mgw.width[1] += 1;
      m_mgw.width[3] += 0;
      m_mgw.width[5] += 0;
    }
    else
    {
      // Destroy the menu resource
      DestroyMenu(m_hSharedMenu);
      m_hSharedMenu = NULL;
    }
  }

  if(!m_hOleMenu)
  {
    // tell OLE to create the menu descriptor
    m_hOleMenu = OleCreateMenuDescriptor(m_hSharedMenu, &m_mgw);
  }

  m_pInPlaceFrame->SetMenu(m_hSharedMenu, m_hOleMenu, m_hwndView);

  return TRUE;
}

LRESULT COleDocumentView::OnCommand | ( | UINT | uID,
 |  | UINT | uCmd,
 |  | HWND | hwndCmd |
 | ) |  |  | [private]

Definition at line 646 of file OLEDocVw.Cpp.

{
  UNREFERENCED_PARAMETER(uCmd);
  UNREFERENCED_PARAMETER(hwndCmd);
  switch(uID)
  {
  case IDM_RED:
    m_pOleDoc->m_Color = RED_COLOR;
    InvalidateRect(m_hwndView, NULL, TRUE);
    UpdateWindow(m_hwndView);
    m_pOleDoc->m_fDirty = TRUE;
    break;

  case IDM_GREEN:
    m_pOleDoc->m_Color = GREEN_COLOR;
    InvalidateRect(m_hwndView, NULL, TRUE);
    UpdateWindow(m_hwndView);
    m_pOleDoc->m_fDirty = TRUE;
    break;

  case IDM_BLUE:
    m_pOleDoc->m_Color = BLUE_COLOR;
    InvalidateRect(m_hwndView, NULL, TRUE);
    UpdateWindow(m_hwndView);
    m_pOleDoc->m_fDirty = TRUE;
    break;

  }

  return 0;
}

LRESULT COleDocumentView::OnCreate ( void ) [private]

Definition at line 635 of file OLEDocVw.Cpp.

{
  return 0;
}

LRESULT COleDocumentView::OnPaint ( void ) [private]

Definition at line 684 of file OLEDocVw.Cpp.

{
  PAINTSTRUCT ps;

  BeginPaint(m_hwndView, &ps);

  RECT  rc;
  HBRUSH hBrush = CreateSolidBrush(m_pOleDoc->m_Color);
  GetClientRect(m_hwndView, &rc);

  FillRect(ps.hdc, &rc, hBrush);

  DeleteObject(hBrush);

  EndPaint(m_hwndView, &ps);

  return 0;
}

STDMETHODIMP COleDocumentView::Open ( void )

Definition at line 416 of file OLEDocVw.Cpp.

{
  OutputDebugString(TEXT("COleDocumentView::Open\n"));

  return S_OK;
}

STDMETHODIMP COleDocumentView::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppReturn
 | ) |  |

Definition at line 88 of file OLEDocVw.Cpp.

{
  OutputDebugString(TEXT("COleDocumentView::QueryInterface\n"));

  return m_pOleDoc->QueryInterface(riid, ppReturn);
}

BOOL COleDocumentView::RemoveMenus ( void ) [private]

Definition at line 769 of file OLEDocVw.Cpp.

{
  if(m_hSharedMenu)
  {
    int   nFirstGroup = (int) m_mgw.width[0];

    m_pInPlaceFrame->SetMenu(NULL, NULL, NULL);

    // remove the menus that we added
    RemoveMenu(m_hSharedMenu, nFirstGroup, MF_BYPOSITION);

    // have the container remove its menus
    m_pInPlaceFrame->RemoveMenus(m_hSharedMenu);

    // Destroy the menu resource
    DestroyMenu(m_hSharedMenu);

    m_hSharedMenu = NULL;
  }

  if(m_hOleMenu)
  {
    // destroy the menu descriptor
    OleDestroyMenuDescriptor(m_hOleMenu);

    m_hOleMenu = NULL;
  }

  return TRUE;
}

STDMETHODIMP COleDocumentView::SaveViewState ( IStream * pStream )

Definition at line 445 of file OLEDocVw.Cpp.

{
  UNREFERENCED_PARAMETER(pStream);
  OutputDebugString(TEXT("COleDocumentView::SaveViewState\n"));

  return E_NOTIMPL;
}

STDMETHODIMP COleDocumentView::SetInPlaceSite ( IOleInPlaceSite * pNewSite )

Definition at line 129 of file OLEDocVw.Cpp.

{
  OutputDebugString(TEXT("COleDocumentView::SetInPlaceSite\n"));

  //clean up previous site if it exists
  if(m_pInPlaceSite)
  {
    if(m_fUIActive)
    {
      DeactivateUI();
    }

    if(m_fInPlaceActive)
    {
      DeactivateInPlace();
    }

    if(m_pInPlaceFrame)
    {
      m_pInPlaceFrame->Release();
      m_pInPlaceFrame = NULL;
    }

    if(m_pInPlaceUIWindow)
    {
      m_pInPlaceUIWindow->Release();
      m_pInPlaceUIWindow = NULL;
    }

    m_pInPlaceSite->Release();
    m_pInPlaceSite = NULL;
  }

  m_pInPlaceSite = pNewSite;

  if(m_pInPlaceSite)
  {
    m_pInPlaceSite->AddRef();

    RECT  rcClip;

    m_FrameInfo.cb = sizeof(m_FrameInfo);

    m_pInPlaceSite->GetWindowContext(   &m_pInPlaceFrame,
      &m_pInPlaceUIWindow,
      &m_Rect,
      &rcClip,
      &m_FrameInfo);
  }

  return S_OK;
}

STDMETHODIMP COleDocumentView::SetRect ( LPRECT pRect )

Definition at line 229 of file OLEDocVw.Cpp.

{
  OutputDebugString(TEXT("COleDocumentView::SetRect - "));

  if(!pRect)
    return E_INVALIDARG;

  m_Rect = *pRect;

  TCHAR szText[MAX_PATH];
  wsprintf(szText, TEXT("%d, %d, %d, %d\n"), m_Rect.left, m_Rect.top, m_Rect.right, m_Rect.bottom);
  OutputDebugString(szText);

  MoveWindow(m_hwndView, m_Rect.left, m_Rect.top, m_Rect.right, m_Rect.bottom, TRUE);

  return S_OK;
}

STDMETHODIMP COleDocumentView::SetRectComplex | ( | LPRECT | prcView,
 |  | LPRECT | prcHScroll,
 |  | LPRECT | prcVScroll,
 |  | LPRECT | prcSizeBox
 | ) |  |

Definition at line 271 of file OLEDocVw.Cpp.

{
  UNREFERENCED_PARAMETER(prcSizeBox);
  UNREFERENCED_PARAMETER(prcVScroll);
  UNREFERENCED_PARAMETER(prcHScroll);
  UNREFERENCED_PARAMETER(prcView);

  OutputDebugString(TEXT("COleDocumentView::SetRectComplex\n"));

  return E_NOTIMPL;
}

STDMETHODIMP COleDocumentView::Show ( BOOL bShow )

Definition at line 292 of file OLEDocVw.Cpp.

{
  OutputDebugString(TEXT("COleDocumentView::Show\n"));

  if(bShow)
  {
    //if the object is not in-place active, make it that way
    if(!m_fInPlaceActive)
      ActivateInPlace();

    //show the window
    BringWindowToTop(m_hwndView);
    ShowWindow(m_hwndView, SW_SHOW);
    UpdateWindow(m_hwndView);
  }
  else
  {
    //if the object is UI active, make remove that state
    if(m_fUIActive)
      DeactivateUI();

    //hide the window
    ShowWindow(m_hwndView, SW_HIDE);
  }

  return S_OK;
}

COleDocumentView::STDMETHODIMP_ ( DWORD )
COleDocumentView::STDMETHODIMP_ ( DWORD )
STDMETHODIMP COleDocumentView::UIActivate ( BOOL bActivate )

Definition at line 326 of file OLEDocVw.Cpp.

{
  OutputDebugString(TEXT("COleDocumentView::UIActivate\n"));

  if(bActivate)
  {
    return ActivateUI();
  }

  return DeactivateUI();
}

BOOL COleDocumentView::UpdateMenu ( HMENU hMenu ) [private]

Definition at line 806 of file OLEDocVw.Cpp.

{
  UINT  uCheck;

  switch(m_pOleDoc->m_Color)
  {
  case RED_COLOR:
    uCheck = IDM_RED;
    break;

  case GREEN_COLOR:
    uCheck = IDM_GREEN;
    break;

  case BLUE_COLOR:
    uCheck = IDM_BLUE;
    break;

  default:
    uCheck = 0;
    break;
  }

  return CheckMenuRadioItem( hMenu,
    IDM_RED,
    IDM_BLUE,
    uCheck,
    MF_BYCOMMAND);
}

LRESULT CALLBACK COleDocumentView::ViewWndProc | ( | HWND | hWnd,
 |  | UINT | uMessage,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static, private]

Definition at line 596 of file OLEDocVw.Cpp.

{
  COleDocumentView  *pThis = (COleDocumentView*)GetWindowLongPtr(hWnd, GWLP_USERDATA);

  switch (uMessage)
  {
  case WM_NCCREATE:
    {
      LPCREATESTRUCT lpcs = (LPCREATESTRUCT)lParam;
      pThis = (COleDocumentView*)(lpcs->lpCreateParams);
      SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)pThis);
    }
    break;

  case WM_CREATE:
    return pThis->OnCreate();

  case WM_COMMAND:
    return pThis->OnCommand(   GET_WM_COMMAND_ID(wParam, lParam),
      GET_WM_COMMAND_CMD(wParam, lParam),
      GET_WM_COMMAND_HWND(wParam, lParam));

  case WM_PAINT:
    return pThis->OnPaint();

  case WM_INITMENUPOPUP:
    return pThis->UpdateMenu((HMENU)wParam);

  }

  return DefWindowProc(hWnd, uMessage, wParam, lParam);
}

Friends And Related Function Documentation

friend class COleDocument [friend]

Definition at line 43 of file OLEDocVw.h.

friend class COleInPlaceActiveObject [friend]

Definition at line 44 of file OLEDocVw.h.

Member Data Documentation

BOOL COleDocumentView::m_fInPlaceActive [private]

Definition at line 47 of file OLEDocVw.h.

OLEINPLACEFRAMEINFO COleDocumentView::m_FrameInfo [private]

Definition at line 54 of file OLEDocVw.h.

BOOL COleDocumentView::m_fUIActive [private]

Definition at line 58 of file OLEDocVw.h.

HOLEMENU COleDocumentView::m_hOleMenu [private]

Definition at line 56 of file OLEDocVw.h.

HMENU COleDocumentView::m_hSharedMenu [private]

Definition at line 55 of file OLEDocVw.h.

HWND COleDocumentView::m_hwndView [private]

Definition at line 51 of file OLEDocVw.h.

OLEMENUGROUPWIDTHS COleDocumentView::m_mgw [private]

Definition at line 57 of file OLEDocVw.h.

LPOLEINPLACEFRAME COleDocumentView::m_pInPlaceFrame [private]

Definition at line 52 of file OLEDocVw.h.

LPOLEINPLACESITE COleDocumentView::m_pInPlaceSite [private]

Definition at line 50 of file OLEDocVw.h.

LPOLEINPLACEUIWINDOW COleDocumentView::m_pInPlaceUIWindow [private]

Definition at line 53 of file OLEDocVw.h.

COleDocument* COleDocumentView::m_pOleDoc [private]

Definition at line 49 of file OLEDocVw.h.

RECT COleDocumentView::m_Rect [private]

Definition at line 48 of file OLEDocVw.h.

The documentation for this class was generated from the following files:
  • Com/Fundamentals/ActiveDocument/DoServer/OLEDocVw.h
  • Com/Fundamentals/ActiveDocument/DoServer/OLEDocVw.Cpp
Generated on Wed Nov 13 2024 16:56:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: COleInPlaceActiveObject Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

COleInPlaceActiveObject Class Reference

#include "oipaObj.h"

List of all members.

Public Member Functions

COleInPlaceActiveObject (COleDocument *)
~COleInPlaceActiveObject ()
STDMETHODIMP | ContextSensitiveHelp (BOOL)
STDMETHODIMP | EnableModeless (BOOL)
STDMETHODIMP | GetWindow (HWND *)
STDMETHODIMP | OnDocWindowActivate (BOOL)
STDMETHODIMP | OnFrameWindowActivate (BOOL)
STDMETHODIMP | QueryInterface (REFIID, LPVOID *)
STDMETHODIMP | ResizeBorder (LPCRECT, LPOLEINPLACEUIWINDOW, BOOL)
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP | TranslateAccelerator (LPMSG)

Private Attributes

BOOL m_fEnableModeless
COleDocument * m_pOleDoc

Detailed Description

Definition at line 43 of file oipaObj.h.

Constructor & Destructor Documentation

COleInPlaceActiveObject::COleInPlaceActiveObject ( COleDocument * pOleDoc )

Definition at line 38 of file oipaObj.Cpp.

{
  OutputDebugString(TEXT("COleInPlaceActiveObject's constructor\n"));

  m_pOleDoc = pOleDoc;

  m_fEnableModeless = FALSE;
}

COleInPlaceActiveObject::~COleInPlaceActiveObject ( )

Definition at line 53 of file oipaObj.Cpp.

{
  OutputDebugString(TEXT("COleInPlaceActiveObject's destructor\n"));
}

Member Function Documentation

STDMETHODIMP COleInPlaceActiveObject::ContextSensitiveHelp ( BOOL fEnterMode )

Definition at line 152 of file oipaObj.Cpp.

{
  UNREFERENCED_PARAMETER(fEnterMode);
  OutputDebugString(TEXT("COleInPlaceActiveObject::ContextSensitiveHelp\n"));

  return E_NOTIMPL;
}

STDMETHODIMP COleInPlaceActiveObject::EnableModeless ( BOOL fEnable )

Definition at line 199 of file oipaObj.Cpp.

{
  OutputDebugString(TEXT("COleInPlaceActiveObject::EnableModeless\n"));

  m_fEnableModeless = fEnable;

  return S_OK;
}

STDMETHODIMP COleInPlaceActiveObject::GetWindow ( HWND * phwnd )

Definition at line 139 of file oipaObj.Cpp.

{
  OutputDebugString(TEXT("COleInPlaceActiveObject::GetWindow\n"));

  return m_pOleDoc->GetWindow(phwnd);
}

STDMETHODIMP COleInPlaceActiveObject::OnDocWindowActivate ( BOOL fActivate )

Definition at line 103 of file oipaObj.Cpp.

{
  OutputDebugString(TEXT("COleInPlaceActiveObject::OnDocWindowActivate\n"));

  //If we are getting activated, merge our menus.
  if(fActivate)
  {
    if(m_pOleDoc->m_pOleDocView)
    {
      m_pOleDoc->m_pOleDocView->MergeMenus();
    }
  }

  return S_OK;
}

STDMETHODIMP COleInPlaceActiveObject::OnFrameWindowActivate ( BOOL fActivate )

Definition at line 125 of file oipaObj.Cpp.

{
  UNREFERENCED_PARAMETER(fActivate);
  OutputDebugString(TEXT("COleInPlaceActiveObject::OnFrameWindowActivate\n"));

  return S_OK;
}

STDMETHODIMP COleInPlaceActiveObject::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppReturn
 | ) |  |

Definition at line 64 of file oipaObj.Cpp.

{
  OutputDebugString(TEXT("COleInPlaceActiveObject::QueryInterface\n"));

  return m_pOleDoc->QueryInterface(riid, ppReturn);
}

STDMETHODIMP COleInPlaceActiveObject::ResizeBorder | ( | LPCRECT | lprectBorder,
 |  | LPOLEINPLACEUIWINDOW | lpUIWindow,
 |  | BOOL | fFrameWindow
 | ) |  |

Definition at line 181 of file oipaObj.Cpp.

{
  UNREFERENCED_PARAMETER(lprectBorder);
  UNREFERENCED_PARAMETER(lpUIWindow);
  UNREFERENCED_PARAMETER(fFrameWindow);
  OutputDebugString(TEXT("COleInPlaceActiveObject::ResizeBorder\n"));

  return S_OK;
}

COleInPlaceActiveObject::STDMETHODIMP_ ( ULONG )
COleInPlaceActiveObject::STDMETHODIMP_ ( ULONG )
STDMETHODIMP COleInPlaceActiveObject::TranslateAccelerator ( LPMSG lpmsg )

Definition at line 166 of file oipaObj.Cpp.

{
  UNREFERENCED_PARAMETER(lpmsg);
  OutputDebugString(TEXT("COleInPlaceActiveObject::TranslateAccelerator\n"));

  // no accelerator table, return FALSE
  return S_FALSE;
}

Member Data Documentation

BOOL COleInPlaceActiveObject::m_fEnableModeless [private]

Definition at line 47 of file oipaObj.h.

COleDocument* COleInPlaceActiveObject::m_pOleDoc [private]

Definition at line 46 of file oipaObj.h.

The documentation for this class was generated from the following files:
  • Com/Fundamentals/ActiveDocument/DoServer/oipaObj.h
  • Com/Fundamentals/ActiveDocument/DoServer/oipaObj.Cpp
  • Com/Fundamentals/SimpSvr/ioipao.Cpp
  • Com/Fundamentals/SimpSvr/ioipao.h
Generated on Wed Nov 13 2024 16:57:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: COleInPlaceObject Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

COleInPlaceObject Class Reference

#include "oipObj.h"

List of all members.

Public Member Functions

COleInPlaceObject (COleDocument *)
~COleInPlaceObject ()
STDMETHODIMP | ContextSensitiveHelp (BOOL)
STDMETHODIMP | GetWindow (HWND *)
STDMETHODIMP | InPlaceDeactivate ()
STDMETHODIMP | QueryInterface (REFIID, LPVOID *)
STDMETHODIMP | ReactivateAndUndo ()
STDMETHODIMP | SetObjectRects (LPCRECT, LPCRECT)
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP | UIDeactivate ()

Private Attributes

COleDocument * m_pOleDoc

Detailed Description

Definition at line 43 of file oipObj.h.

Constructor & Destructor Documentation

COleInPlaceObject::COleInPlaceObject ( COleDocument * pOleDoc )

Definition at line 42 of file oipObj.Cpp.

{
  OutputDebugString(TEXT("COleInPlaceObject's constructor\n"));

  m_pOleDoc = pOleDoc;
}

COleInPlaceObject::~COleInPlaceObject ( )

Definition at line 55 of file oipObj.Cpp.

{
  OutputDebugString(TEXT("COleInPlaceObject's destructor\n"));
}

Member Function Documentation

STDMETHODIMP COleInPlaceObject::ContextSensitiveHelp ( BOOL fEnterMode )

Definition at line 159 of file oipObj.Cpp.

{
  UNREFERENCED_PARAMETER(fEnterMode);
  OutputDebugString(TEXT("COleInPlaceObject::ContextSensitiveHelp\n"));

  return E_NOTIMPL;
}

STDMETHODIMP COleInPlaceObject::GetWindow ( HWND * phwnd )

Definition at line 146 of file oipObj.Cpp.

{
  OutputDebugString(TEXT("COleInPlaceObject::GetWindow\n"));

  return m_pOleDoc->GetWindow(phwnd);
}

STDMETHODIMP COleInPlaceObject::InPlaceDeactivate ( )

Definition at line 105 of file oipObj.Cpp.

{
  OutputDebugString(TEXT("COleInPlaceObject::InPlaceDeactivate\n"));

  return m_pOleDoc->DeactivateInPlace();
}

STDMETHODIMP COleInPlaceObject::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppReturn
 | ) |  |

Definition at line 66 of file oipObj.Cpp.

{
  OutputDebugString(TEXT("COleInPlaceObject::QueryInterface\n"));

  return m_pOleDoc->QueryInterface(riid, ppReturn);
}

STDMETHODIMP COleInPlaceObject::ReactivateAndUndo ( )

Definition at line 173 of file oipObj.Cpp.

{
  OutputDebugString(TEXT("COleInPlaceObject::ReactivateAndUndo\n"));

  return INPLACE_E_NOTUNDOABLE;
}

STDMETHODIMP COleInPlaceObject::SetObjectRects | ( | LPCRECT | lprcPosRect,
 |  | LPCRECT | lprcClipRect
 | ) |  |

Definition at line 131 of file oipObj.Cpp.

{
  UNREFERENCED_PARAMETER(lprcPosRect);
  UNREFERENCED_PARAMETER(lprcClipRect);
  OutputDebugString(TEXT("COleInPlaceObject::SetObjectRects\n"));

  return S_OK;
}

COleInPlaceObject::STDMETHODIMP_ ( ULONG )
COleInPlaceObject::STDMETHODIMP_ ( ULONG )
STDMETHODIMP COleInPlaceObject::UIDeactivate ( )

Definition at line 118 of file oipObj.Cpp.

{
  OutputDebugString(TEXT("COleInPlaceObject::UIDeactivate\n"));

  return m_pOleDoc->DeactivateUI();
}

Member Data Documentation

COleDocument* COleInPlaceObject::m_pOleDoc [private]

Definition at line 46 of file oipObj.h.

The documentation for this class was generated from the following files:
  • Com/Fundamentals/ActiveDocument/DoServer/oipObj.h
  • Com/Fundamentals/ActiveDocument/DoServer/oipObj.Cpp
  • Com/Fundamentals/SimpSvr/ioipo.Cpp
  • Com/Fundamentals/SimpSvr/ioipo.h
Generated on Wed Nov 13 2024 16:57:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: COleObject Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

COleObject Class Reference

#include "OLEObj.h"

List of all members.

Public Member Functions

COleObject (COleDocument *pOleDoc)
~COleObject ()
STDMETHODIMP | Advise (LPADVISESINK, LPDWORD)
STDMETHODIMP | Close (DWORD)
STDMETHODIMP | DoVerb (LONG, LPMSG, LPOLECLIENTSITE, LONG, HWND, LPCRECT)
STDMETHODIMP | EnumAdvise (LPENUMSTATDATA *)
STDMETHODIMP | EnumVerbs (LPENUMOLEVERB *)
STDMETHODIMP | GetClientSite (LPOLECLIENTSITE *)
STDMETHODIMP | GetClipboardData (DWORD, LPDATAOBJECT *)
STDMETHODIMP | GetExtent (DWORD, LPSIZEL)
STDMETHODIMP | GetMiscStatus (DWORD, LPDWORD)
STDMETHODIMP | GetMoniker (DWORD, DWORD, LPMONIKER *)
STDMETHODIMP | GetUserClassID (CLSID *)
STDMETHODIMP | GetUserType (DWORD, LPOLESTR *)
STDMETHODIMP | InitFromData (LPDATAOBJECT, BOOL, DWORD)
STDMETHODIMP | IsUpToDate ()
STDMETHODIMP | QueryInterface (REFIID, LPVOID *)
STDMETHODIMP | SetClientSite (LPOLECLIENTSITE)
STDMETHODIMP | SetColorScheme (LPLOGPALETTE)
STDMETHODIMP | SetExtent (DWORD, LPSIZEL)
STDMETHODIMP | SetHostNames (LPCOLESTR, LPCOLESTR)
STDMETHODIMP | SetMoniker (DWORD, LPMONIKER)
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP | Unadvise (DWORD)
STDMETHODIMP | Update ()

Private Attributes

BOOL m_fOpen
COleDocument * m_pOleDoc

Detailed Description

Definition at line 43 of file OLEObj.h.

Constructor & Destructor Documentation

COleObject::COleObject ( COleDocument * pOleDoc )

Definition at line 38 of file OLEObj.Cpp.

{
  OutputDebugString(TEXT("COleObject's constructor\n"));

  m_pOleDoc = pOleDoc;

  m_fOpen = FALSE;
}

COleObject::~COleObject ( )

Definition at line 53 of file OLEObj.Cpp.

{
  OutputDebugString(TEXT("COleObject's destructor\n"));
}

Member Function Documentation

STDMETHODIMP COleObject::Advise | ( | LPADVISESINK | pAdvSink,
 |  | LPDWORD | pdwConnection
 | ) |  |

Definition at line 190 of file OLEObj.Cpp.

{
  OutputDebugString(TEXT("COleObject::Advise\n"));

  // if we haven't made an OleAdviseHolder yet, make one.
  if(!m_pOleDoc->m_pOleAdviseHolder)
    CreateOleAdviseHolder(&m_pOleDoc->m_pOleAdviseHolder);

  // pass this call onto the OleAdviseHolder.
  return m_pOleDoc->m_pOleAdviseHolder->Advise(pAdvSink, pdwConnection);
}

STDMETHODIMP COleObject::Close ( DWORD dwSaveOption )

Definition at line 280 of file OLEObj.Cpp.

{
  OutputDebugString(TEXT("COleObject::Close\n"));

  switch(dwSaveOption)
  {
  case OLECLOSE_SAVEIFDIRTY:
    if(m_pOleDoc->m_fDirty)
    {
      m_pOleDoc->m_pPersistStorage->Save(NULL, TRUE);
    }
    break;

  case OLECLOSE_NOSAVE:
    break;

  case OLECLOSE_PROMPTSAVE:
    break;
  }

  //close the view
  m_pOleDoc->m_pOleDocView->CloseView(0);

  return S_OK;
}

STDMETHODIMP COleObject::DoVerb | ( | LONG | iVerb,
 |  | LPMSG | lpmsg,
 |  | LPOLECLIENTSITE | pActiveSite,
 |  | LONG | lindex,
 |  | HWND | hwndParent,
 |  | LPCRECT | lprcPosRect
 | ) |  |

Definition at line 103 of file OLEObj.Cpp.

{
  UNREFERENCED_PARAMETER(lpmsg);
  UNREFERENCED_PARAMETER(lindex);
  UNREFERENCED_PARAMETER(hwndParent);
  UNREFERENCED_PARAMETER(lprcPosRect);
  OutputDebugString(TEXT("COleObject::DoVerb\n"));

  HRESULT  hr = E_FAIL;

  switch (iVerb)
  {
  case OLEIVERB_SHOW:
  case OLEIVERB_PRIMARY:
  case OLEIVERB_UIACTIVATE:
    {
      //try to get the IOleDocumentSite pointer
      LPOLEDOCUMENTSITE pOleDocSite;
      hr = pActiveSite->QueryInterface(IID_IOleDocumentSite, (LPVOID*)&pOleDocSite);
      if(SUCCEEDED(hr))
      {
        //passing NULL to this will cause the site to call our CreateView method
        hr = pOleDocSite->ActivateMe(NULL);
      }
    }
    break;

  default:
    break;
  }

  return hr;
}

STDMETHODIMP COleObject::EnumAdvise ( LPENUMSTATDATA * ppenumAdvise )

Definition at line 459 of file OLEObj.Cpp.

{
  OutputDebugString(TEXT("COleObject::EnumAdvise\n"));

  *ppenumAdvise = NULL;

  // pass on to the OLE Advise holder.
  return m_pOleDoc->m_pOleAdviseHolder->EnumAdvise(ppenumAdvise);
}

STDMETHODIMP COleObject::EnumVerbs ( LPENUMOLEVERB * ppenumOleVerb )

Definition at line 312 of file OLEObj.Cpp.

{
  UNREFERENCED_PARAMETER(ppenumOleVerb);
  OutputDebugString(TEXT("COleObject::EnumVerbs\n"));

  return OLE_S_USEREG;
}

STDMETHODIMP COleObject::GetClientSite ( LPOLECLIENTSITE * ppClientSite )

Definition at line 148 of file OLEObj.Cpp.

{
  OutputDebugString(TEXT("COleObject::GetClientSite\n"));

  *ppClientSite = m_pOleDoc->m_pOleClientSite;

  return S_OK;
}

STDMETHODIMP COleObject::GetClipboardData | ( | DWORD | dwReserved,
 |  | LPDATAOBJECT * | ppDataObject
 | ) |  |

Definition at line 401 of file OLEObj.Cpp.

{
  UNREFERENCED_PARAMETER(dwReserved);
  OutputDebugString(TEXT("COleObject::GetClipboardData\n"));

  *ppDataObject = NULL;

  return E_NOTIMPL;
}

STDMETHODIMP COleObject::GetExtent | ( | DWORD | dwDrawAspect,
 |  | LPSIZEL | lpsizel
 | ) |  |

Definition at line 237 of file OLEObj.Cpp.

{
  UNREFERENCED_PARAMETER(dwDrawAspect);
  UNREFERENCED_PARAMETER(lpsizel);
  OutputDebugString(TEXT("COleObject::GetExtent\n"));

  return E_NOTIMPL;
}

STDMETHODIMP COleObject::GetMiscStatus | ( | DWORD | ,
 |  | LPDWORD |
 | ) |  |
STDMETHODIMP COleObject::GetMoniker | ( | DWORD | dwAssign,
 |  | DWORD | dwWhichMoniker,
 |  | LPMONIKER * | ppmk
 | ) |  |

Definition at line 364 of file OLEObj.Cpp.

{
  UNREFERENCED_PARAMETER(dwAssign);
  UNREFERENCED_PARAMETER(dwWhichMoniker);
  OutputDebugString(TEXT("COleObject::GetMoniker\n"));

  *ppmk = NULL;

  return m_pOleDoc->m_pOleClientSite->GetMoniker(OLEGETMONIKER_ONLYIFTHERE, OLEWHICHMK_OBJFULL, ppmk);
}

STDMETHODIMP COleObject::GetUserClassID ( CLSID * pClsid )

Definition at line 431 of file OLEObj.Cpp.

{
  OutputDebugString(TEXT("COleObject::GetUserClassID\n"));

  return m_pOleDoc->m_pPersistStorage->GetClassID(pClsid);
}

STDMETHODIMP COleObject::GetUserType | ( | DWORD | dwFormOfType,
 |  | LPOLESTR * | pszUserType
 | ) |  |

Definition at line 444 of file OLEObj.Cpp.

{
  UNREFERENCED_PARAMETER(dwFormOfType);
  UNREFERENCED_PARAMETER(pszUserType);
  OutputDebugString(TEXT("COleObject::GetUserType\n"));

  return OLE_S_USEREG;
}

STDMETHODIMP COleObject::InitFromData | ( | LPDATAOBJECT | pDataObject,
 |  | BOOL | fCreation,
 |  | DWORD | dwReserved
 | ) |  |

Definition at line 383 of file OLEObj.Cpp.

{
  UNREFERENCED_PARAMETER(pDataObject);
  UNREFERENCED_PARAMETER(fCreation);
  UNREFERENCED_PARAMETER(dwReserved);
  OutputDebugString(TEXT("COleObject::InitFromData\n"));

  return E_NOTIMPL;
}

STDMETHODIMP COleObject::IsUpToDate ( )

Definition at line 418 of file OLEObj.Cpp.

{
  OutputDebugString(TEXT("COleObject::IsUpToDate\n"));

  return S_OK;
}

STDMETHODIMP COleObject::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppReturn
 | ) |  |

Definition at line 64 of file OLEObj.Cpp.

{
  OutputDebugString(TEXT("COleObject::QueryInterface\n"));

  return m_pOleDoc->QueryInterface(riid, ppReturn);
}

STDMETHODIMP COleObject::SetClientSite ( LPOLECLIENTSITE pClientSite )

Definition at line 163 of file OLEObj.Cpp.

{
  OutputDebugString(TEXT("COleObject::SetClientSite\n"));

  // if we already have a client site, release it.
  if(m_pOleDoc->m_pOleClientSite)
  {
    m_pOleDoc->m_pOleClientSite->Release();
    m_pOleDoc->m_pOleClientSite = NULL;
  }

  // store copy of the client site.
  m_pOleDoc->m_pOleClientSite = pClientSite;

  // AddRef it so it doesn't go away.
  if(m_pOleDoc->m_pOleClientSite)
    m_pOleDoc->m_pOleClientSite->AddRef();

  return S_OK;
}

STDMETHODIMP COleObject::SetColorScheme ( LPLOGPALETTE lpLogpal )

Definition at line 491 of file OLEObj.Cpp.

{
  UNREFERENCED_PARAMETER(lpLogpal);
  OutputDebugString(TEXT("COleObject::SetColorScheme\n"));

  return S_OK;
}

STDMETHODIMP COleObject::SetExtent | ( | DWORD | dwDrawAspect,
 |  | LPSIZEL | lpsizel
 | ) |  |

Definition at line 252 of file OLEObj.Cpp.

{
  UNREFERENCED_PARAMETER(dwDrawAspect);
  UNREFERENCED_PARAMETER(lpsizel);
  OutputDebugString(TEXT("COleObject::SetExtent\n"));

  return E_NOTIMPL;
}

STDMETHODIMP COleObject::SetHostNames | ( | LPCOLESTR | szContainerApp,
 |  | LPCOLESTR | szContainerObj
 | ) |  |

Definition at line 222 of file OLEObj.Cpp.

{
  UNREFERENCED_PARAMETER(szContainerApp);
  UNREFERENCED_PARAMETER(szContainerObj);
  OutputDebugString(TEXT("COleObject::SetHostNames\n"));

  return S_OK;
}

STDMETHODIMP COleObject::SetMoniker | ( | DWORD | dwWhichMoniker,
 |  | LPMONIKER | pMoniker
 | ) |  |

Definition at line 326 of file OLEObj.Cpp.

{
  UNREFERENCED_PARAMETER(dwWhichMoniker);
  UNREFERENCED_PARAMETER(pMoniker);
  OutputDebugString(TEXT("COleObject::SetMoniker\n"));

  LPMONIKER pTempMoniker;

  if(!m_pOleDoc->m_pOleClientSite)
    return E_FAIL;

  if(NOERROR != m_pOleDoc->m_pOleClientSite->GetMoniker(OLEGETMONIKER_ONLYIFTHERE, OLEWHICHMK_OBJFULL, &pTempMoniker))
    return E_FAIL;

  if(m_pOleDoc->m_pOleAdviseHolder)
    m_pOleDoc->m_pOleAdviseHolder->SendOnRename(pTempMoniker);

  LPRUNNINGOBJECTTABLE pRot;

  if(NOERROR == GetRunningObjectTable(0, &pRot))
  {
    if(m_pOleDoc->m_dwRegister)
      pRot->Revoke(m_pOleDoc->m_dwRegister);

    pRot->Register(0, m_pOleDoc, pTempMoniker, &m_pOleDoc->m_dwRegister);

    pRot->Release();
  }

  return S_OK;
}

COleObject::STDMETHODIMP_ ( ULONG )
COleObject::STDMETHODIMP_ ( ULONG )
STDMETHODIMP COleObject::Unadvise ( DWORD dwConnection )

Definition at line 208 of file OLEObj.Cpp.

{
  OutputDebugString(TEXT("COleObject::Unadvise\n"));

  // pass on to OleAdviseHolder.
  return m_pOleDoc->m_pOleAdviseHolder->Unadvise(dwConnection);
}

STDMETHODIMP COleObject::Update ( )

Definition at line 267 of file OLEObj.Cpp.

{
  OutputDebugString(TEXT("COleObject::Update\n"));

  return S_OK;
}

Member Data Documentation

BOOL COleObject::m_fOpen [private]

Definition at line 47 of file OLEObj.h.

COleDocument* COleObject::m_pOleDoc [private]

Definition at line 46 of file OLEObj.h.

The documentation for this class was generated from the following files:
  • Com/Fundamentals/ActiveDocument/DoServer/OLEObj.h
  • Com/Fundamentals/ActiveDocument/DoServer/OLEObj.Cpp
  • Com/Fundamentals/SimpSvr/ioo.Cpp
  • Com/Fundamentals/SimpSvr/ioo.h
Generated on Wed Nov 13 2024 16:57:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: COLORPICKSTATE Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

COLORPICKSTATE Struct Reference

List of all members.

Public Attributes

BOOL fDone
HWND | hwndOwner
int | iResult
int | iSel

Detailed Description

Definition at line 101 of file fakemenu.c.

Member Data Documentation

BOOL COLORPICKSTATE::fDone

Definition at line 103 of file fakemenu.c.

HWND COLORPICKSTATE::hwndOwner

Definition at line 106 of file fakemenu.c.

int COLORPICKSTATE::iResult

Definition at line 105 of file fakemenu.c.

int COLORPICKSTATE::iSel

Definition at line 104 of file fakemenu.c.

The documentation for this struct was generated from the following file:
  • WinUI/Shell/Fakemenu/fakemenu.c
Generated on Wed Nov 13 2024 16:57:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ColProps Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

ColProps Struct Reference

#include "table.h"

List of all members.

Public Attributes

int nchars
Props props

Detailed Description

Definition at line 222 of file table.h.

Member Data Documentation

int ColProps::nchars

Definition at line 223 of file table.h.

Props ColProps::props

Definition at line 224 of file table.h.

The documentation for this struct was generated from the following file:
  • Begin/sdkdiff/table.h
Generated on Wed Nov 13 2024 16:57:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ColPropsList Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

ColPropsList Struct Reference

#include "table.h"

List of all members.

Public Attributes

DWORD_PTR | id
int | ncols
lpColProps plist
int | startcol

Detailed Description

Definition at line 229 of file table.h.

Member Data Documentation

DWORD_PTR ColPropsList::id

Definition at line 230 of file table.h.

int ColPropsList::ncols

Definition at line 232 of file table.h.

lpColProps ColPropsList::plist

Definition at line 233 of file table.h.

int ColPropsList::startcol

Definition at line 231 of file table.h.

The documentation for this struct was generated from the following file:
  • Begin/sdkdiff/table.h
Generated on Wed Nov 13 2024 16:57:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: COLUMNDATA Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

COLUMNDATA Struct Reference

#include "sampclnt.h"

List of all members.

Public Attributes

BYTE bData [1]
DWORD dwLength
DWORD dwStatus

Detailed Description

Definition at line 80 of file sampclnt.h.

Member Data Documentation

BYTE COLUMNDATA::bData[1]

Definition at line 84 of file sampclnt.h.

DWORD COLUMNDATA::dwLength

Definition at line 82 of file sampclnt.h.

DWORD COLUMNDATA::dwStatus

Definition at line 83 of file sampclnt.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/oledb/sampclnt/sampclnt.h
Generated on Wed Nov 13 2024 16:57:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: comadmin::COMAdminAccessChecksLevelOptions Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • comadmin
  • comadmin::COMAdminAccessChecksLevelOptions
Static Public Attributes

comadmin::COMAdminAccessChecksLevelOptions Interface Reference

List of all members.

Static Public Attributes

static final int | COMAdminAccessChecksApplicationComponentLevel = 1
static final int | COMAdminAccessChecksApplicationLevel = 0

Detailed Description

Definition at line 20 of file COMAdminAccessChecksLevelOptions.java.

Member Data Documentation

final int comadmin::COMAdminAccessChecksLevelOptions::COMAdminAccessChecksApplicationComponentLevel = 1 [static]

Definition at line 23 of file COMAdminAccessChecksLevelOptions.java.

final int comadmin::COMAdminAccessChecksLevelOptions::COMAdminAccessChecksApplicationLevel = 0 [static]

Definition at line 22 of file COMAdminAccessChecksLevelOptions.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminAccessChecksLevelOptions.java
Generated on Wed Nov 13 2024 16:58:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: comadmin::COMAdminActivationOptions Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • comadmin
  • comadmin::COMAdminActivationOptions
Static Public Attributes

comadmin::COMAdminActivationOptions Interface Reference

List of all members.

Static Public Attributes

static final int | COMAdminActivationInproc = 0
static final int | COMAdminActivationLocal = 1

Detailed Description

Definition at line 20 of file COMAdminActivationOptions.java.

Member Data Documentation

final int comadmin::COMAdminActivationOptions::COMAdminActivationInproc = 0 [static]

Definition at line 22 of file COMAdminActivationOptions.java.

final int comadmin::COMAdminActivationOptions::COMAdminActivationLocal = 1 [static]

Definition at line 23 of file COMAdminActivationOptions.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminActivationOptions.java
Generated on Wed Nov 13 2024 16:58:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: comadmin::COMAdminApplicationExportOptions Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • comadmin
  • comadmin::COMAdminApplicationExportOptions
Static Public Attributes

comadmin::COMAdminApplicationExportOptions Interface Reference

List of all members.

Static Public Attributes

static final int | COMAdminExportApplicationProxy = 2
static final int | COMAdminExportForceOverwriteOfFiles = 4
static final int | COMAdminExportNoUsers = 0
static final int | COMAdminExportUsers = 1

Detailed Description

Definition at line 20 of file COMAdminApplicationExportOptions.java.

Member Data Documentation

final int comadmin::COMAdminApplicationExportOptions::COMAdminExportApplicationProxy = 2 [static]

Definition at line 24 of file COMAdminApplicationExportOptions.java.

final int comadmin::COMAdminApplicationExportOptions::COMAdminExportForceOverwriteOfFiles = 4 [static]

Definition at line 25 of file COMAdminApplicationExportOptions.java.

final int comadmin::COMAdminApplicationExportOptions::COMAdminExportNoUsers = 0 [static]

Definition at line 22 of file COMAdminApplicationExportOptions.java.

final int comadmin::COMAdminApplicationExportOptions::COMAdminExportUsers = 1 [static]

Definition at line 23 of file COMAdminApplicationExportOptions.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminApplicationExportOptions.java
Generated on Wed Nov 13 2024 16:58:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: comadmin::COMAdminApplicationInstallOptions Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • comadmin
  • comadmin::COMAdminApplicationInstallOptions
Static Public Attributes

comadmin::COMAdminApplicationInstallOptions Interface Reference

List of all members.

Static Public Attributes

static final int | COMAdminInstallForceOverwriteOfFiles = 2
static final int | COMAdminInstallNoUsers = 0
static final int | COMAdminInstallUsers = 1

Detailed Description

Definition at line 20 of file COMAdminApplicationInstallOptions.java.

Member Data Documentation

final int comadmin::COMAdminApplicationInstallOptions::COMAdminInstallForceOverwriteOfFiles = 2 [static]

Definition at line 24 of file COMAdminApplicationInstallOptions.java.

final int comadmin::COMAdminApplicationInstallOptions::COMAdminInstallNoUsers = 0 [static]

Definition at line 22 of file COMAdminApplicationInstallOptions.java.

final int comadmin::COMAdminApplicationInstallOptions::COMAdminInstallUsers = 1 [static]

Definition at line 23 of file COMAdminApplicationInstallOptions.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminApplicationInstallOptions.java
Generated on Wed Nov 13 2024 16:58:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: comadmin::COMAdminAuthenticationCapabilitiesOptions Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • comadmin
  • comadmin::COMAdminAuthenticationCapabilitiesOptions
Static Public Attributes

comadmin::COMAdminAuthenticationCapabilitiesOptions Interface Reference

List of all members.

Static Public Attributes

static final int | COMAdminAuthenticationCapabilitiesDynamicCloaking = 64
static final int | COMAdminAuthenticationCapabilitiesNone = 0
static final int | COMAdminAuthenticationCapabilitiesSecureReference = 2
static final int | COMAdminAuthenticationCapabilitiesStaticCloaking = 32

Detailed Description

Definition at line 20 of file COMAdminAuthenticationCapabilitiesOptions.java.

Member Data Documentation

final int comadmin::COMAdminAuthenticationCapabilitiesOptions::COMAdminAuthenticationCapabilitiesDynamicCloaking = 64 [static]

Definition at line 24 of file COMAdminAuthenticationCapabilitiesOptions.java.

final int comadmin::COMAdminAuthenticationCapabilitiesOptions::COMAdminAuthenticationCapabilitiesNone = 0 [static]

Definition at line 22 of file COMAdminAuthenticationCapabilitiesOptions.java.

final int comadmin::COMAdminAuthenticationCapabilitiesOptions::COMAdminAuthenticationCapabilitiesSecureReference = 2 [static]

Definition at line 25 of file COMAdminAuthenticationCapabilitiesOptions.java.

final int comadmin::COMAdminAuthenticationCapabilitiesOptions::COMAdminAuthenticationCapabilitiesStaticCloaking = 32 [static]

Definition at line 23 of file COMAdminAuthenticationCapabilitiesOptions.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminAuthenticationCapabilitiesOptions.java
Generated on Wed Nov 13 2024 16:58:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: comadmin::COMAdminAuthenticationLevelOptions Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • comadmin
  • comadmin::COMAdminAuthenticationLevelOptions
Static Public Attributes

comadmin::COMAdminAuthenticationLevelOptions Interface Reference

List of all members.

Static Public Attributes

static final int | COMAdminAuthenticationCall = 3
static final int | COMAdminAuthenticationConnect = 2
static final int | COMAdminAuthenticationDefault = 0
static final int | COMAdminAuthenticationIntegrity = 5
static final int | COMAdminAuthenticationNone = 1
static final int | COMAdminAuthenticationPacket = 4
static final int | COMAdminAuthenticationPrivacy = 6

Detailed Description

Definition at line 20 of file COMAdminAuthenticationLevelOptions.java.

Member Data Documentation

final int comadmin::COMAdminAuthenticationLevelOptions::COMAdminAuthenticationCall = 3 [static]

Definition at line 25 of file COMAdminAuthenticationLevelOptions.java.

final int comadmin::COMAdminAuthenticationLevelOptions::COMAdminAuthenticationConnect = 2 [static]

Definition at line 24 of file COMAdminAuthenticationLevelOptions.java.

final int comadmin::COMAdminAuthenticationLevelOptions::COMAdminAuthenticationDefault = 0 [static]

Definition at line 22 of file COMAdminAuthenticationLevelOptions.java.

final int comadmin::COMAdminAuthenticationLevelOptions::COMAdminAuthenticationIntegrity = 5 [static]

Definition at line 27 of file COMAdminAuthenticationLevelOptions.java.

final int comadmin::COMAdminAuthenticationLevelOptions::COMAdminAuthenticationNone = 1 [static]

Definition at line 23 of file COMAdminAuthenticationLevelOptions.java.

final int comadmin::COMAdminAuthenticationLevelOptions::COMAdminAuthenticationPacket = 4 [static]

Definition at line 26 of file COMAdminAuthenticationLevelOptions.java.

final int comadmin::COMAdminAuthenticationLevelOptions::COMAdminAuthenticationPrivacy = 6 [static]

Definition at line 28 of file COMAdminAuthenticationLevelOptions.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminAuthenticationLevelOptions.java
Generated on Wed Nov 13 2024 16:58:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: comadmin::COMAdminCatalog Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • comadmin
  • comadmin::COMAdminCatalog
Public Member Functions | Static Public Attributes

comadmin::COMAdminCatalog Class Reference

.class(classid=F618C514-DFB8-11D1-A2CF-00805FC79235,DynamicCasts) .interface(iid=DD662187-DFC2-11D1-A2CF-00805FC79235, thread=AUTO, type=DUAL)

Inherits com::ms::com::IUnknown, and comadmin::ICOMAdminCatalog.

List of all members.

Public Member Functions

native void | BackupREGDB (String bstrBackupFilePath)
native Object | Connect (String bstrConnectString)
native void | ExportApplication (String bstrApplIdOrName, String bstrApplicationFile, int lOptions)
native Object | GetCollection (String bstrCollName)
native Object | GetCollectionByQuery (String bstrCollName, com.ms.com.SafeArray aQuery)
native void | GetEventClassesForIID (String bstrIID, com.ms.com.SafeArray varCLSIDS, com.ms.com.SafeArray varProgIDs, com.ms.com.SafeArray varDescriptions)
native int | getMajorVersion ()
native int | getMinorVersion ()
native void | GetMultipleComponentsInfo (String bstrApplIdOrName, com.ms.com.SafeArray varFileNames, com.ms.com.SafeArray varCLSIDS, com.ms.com.SafeArray varClassNames, com.ms.com.SafeArray varFileFlags, com.ms.com.SafeArray varComponentFlags)
native void | ImportComponent (String bstrApplIdOrName, String bstrCLSIDOrProgId)
native void | InstallApplication (String bstrApplicationFile, String bstrDestinationDirectory, int lOptions, String bstrUserId, String bstrPassword, String bstrRSN)
native void | InstallComponent (String bstrApplIdOrName, String bstrDLL, String bstrTLB, String bstrPSDLL)
native void | InstallEventClass (String bstrApplIdOrName, String bstrDLL, String bstrTLB, String bstrPSDLL)
native void | InstallMultipleComponents (String bstrApplIdOrName, com.ms.com.SafeArray varFileNames, com.ms.com.SafeArray varCLSIDS)
native void | InstallMultipleEventClasses (String bstrApplIdOrName, com.ms.com.SafeArray varFileNames, com.ms.com.SafeArray varCLSIDS)
native void | QueryApplicationFile (String bstrApplicationFile, String[] bstrApplicationName, String[] bstrApplicationDescription, boolean[] bHasUsers, boolean[] bIsProxy, com.ms.com.SafeArray varFileNames)
native void | RefreshComponents ()
native void | RefreshRouter ()
native void | Reserved1 ()
native void | Reserved2 ()
native void | RestoreREGDB (String bstrBackupFilePath)
native int | ServiceCheck (int lService)
native void | ShutdownApplication (String bstrApplIdOrName)
native void | StartApplication (String bstrApplIdOrName)
native void | StartRouter ()
native void | StopRouter ()

Static Public Attributes

static final com.ms.com._Guid | clsid = new com.ms.com._Guid((int)0xf618c514, (short)0xdfb8, (short)0x11d1, (byte)0xa2, (byte)0xcf, (byte)0x0, (byte)0x80, (byte)0x5f, (byte)0xc7, (byte)0x92, (byte)0x35)
static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0xdd662187, (short)0xdfc2, (short)0x11d1, (byte)0xa2, (byte)0xcf, (byte)0x0, (byte)0x80, (byte)0x5f, (byte)0xc7, (byte)0x92, (byte)0x35)

Detailed Description

Definition at line 20 of file COMAdminCatalog.java.

Member Function Documentation

native void comadmin::COMAdminCatalog::BackupREGDB ( String bstrBackupFilePath )

.method(vtoffset=22, dispid=19, type=METHOD, name="BackupREGDB", addFlagsVtable=4) .parameters([in,type=STRING] bstrBackupFilePath)

Implements comadmin::ICOMAdminCatalog.

native Object comadmin::COMAdminCatalog::Connect ( String bstrConnectString )

.method(vtoffset=5, dispid=2, type=METHOD, name="Connect", addFlagsVtable=4) .parameters([in,type=STRING] bstrConnectString, [iid=00020400-0000-0000-C000-000000000046,thread=AUTO,type=DISPATCH] return)

Implements comadmin::ICOMAdminCatalog.

native void comadmin::COMAdminCatalog::ExportApplication | ( | String | bstrApplIdOrName,
 |  | String | bstrApplicationFile,
 |  | int | lOptions
 | ) |  |

.method(vtoffset=12, dispid=9, type=METHOD, name="ExportApplication", addFlagsVtable=4) .parameters([in,type=STRING] bstrApplIdOrName, [in,type=STRING] bstrApplicationFile, [in,type=I4] lOptions)

Implements comadmin::ICOMAdminCatalog.

native Object comadmin::COMAdminCatalog::GetCollection ( String bstrCollName )

.method(vtoffset=4, dispid=1, type=METHOD, name="GetCollection", addFlagsVtable=4) .parameters([in,type=STRING] bstrCollName, [iid=00020400-0000-0000-C000-000000000046,thread=AUTO,type=DISPATCH] return)

Implements comadmin::ICOMAdminCatalog.

native Object comadmin::COMAdminCatalog::GetCollectionByQuery | ( | String | bstrCollName,
 |  | com.ms.com.SafeArray | aQuery
 | ) |  |

.method(vtoffset=8, dispid=5, type=METHOD, name="GetCollectionByQuery", addFlagsVtable=4) .parameters([in,type=STRING] bstrCollName, [in,vt=16396,type=SAFEARRAY] aQuery, [iid=00020400-0000-0000-C000-000000000046,thread=AUTO,type=DISPATCH] return)

Implements comadmin::ICOMAdminCatalog.

native void comadmin::COMAdminCatalog::GetEventClassesForIID | ( | String | bstrIID,
 |  | com.ms.com.SafeArray | varCLSIDS,
 |  | com.ms.com.SafeArray | varProgIDs,
 |  | com.ms.com.SafeArray | varDescriptions
 | ) |  |

.method(vtoffset=29, dispid=26, type=METHOD, name="GetEventClassesForIID", addFlagsVtable=4) .parameters([in,type=STRING] bstrIID, [out,vt=16396,type=SAFEARRAY] varCLSIDS, [out,vt=16396,type=SAFEARRAY] varProgIDs, [out,vt=16396,type=SAFEARRAY] varDescriptions)

Implements comadmin::ICOMAdminCatalog.

native int comadmin::COMAdminCatalog::getMajorVersion ( )

.method(vtoffset=6, dispid=3, type=PROPGET, name="MajorVersion", addFlagsVtable=4) .parameters([type=I4] return)

Implements comadmin::ICOMAdminCatalog.

native int comadmin::COMAdminCatalog::getMinorVersion ( )

.method(vtoffset=7, dispid=4, type=PROPGET, name="MinorVersion", addFlagsVtable=4) .parameters([type=I4] return)

Implements comadmin::ICOMAdminCatalog.

native void comadmin::COMAdminCatalog::GetMultipleComponentsInfo | ( | String | bstrApplIdOrName,
 |  | com.ms.com.SafeArray | varFileNames,
 |  | com.ms.com.SafeArray | varCLSIDS,
 |  | com.ms.com.SafeArray | varClassNames,
 |  | com.ms.com.SafeArray | varFileFlags,
 |  | com.ms.com.SafeArray | varComponentFlags
 | ) |  |

.method(vtoffset=20, dispid=17, type=METHOD, name="GetMultipleComponentsInfo", addFlagsVtable=4) .parameters([in,type=STRING] bstrApplIdOrName, [in,vt=16396,type=SAFEARRAY] varFileNames, [out,vt=16396,type=SAFEARRAY] varCLSIDS, [out,vt=16396,type=SAFEARRAY] varClassNames, [out,vt=16396,type=SAFEARRAY] varFileFlags, [out,vt=16396,type=SAFEARRAY] varComponentFlags)

Implements comadmin::ICOMAdminCatalog.

native void comadmin::COMAdminCatalog::ImportComponent | ( | String | bstrApplIdOrName,
 |  | String | bstrCLSIDOrProgId
 | ) |  |

.method(vtoffset=9, dispid=6, type=METHOD, name="ImportComponent", addFlagsVtable=4) .parameters([in,type=STRING] bstrApplIdOrName, [in,type=STRING] bstrCLSIDOrProgId)

Implements comadmin::ICOMAdminCatalog.

native void comadmin::COMAdminCatalog::InstallApplication | ( | String | bstrApplicationFile,
 |  | String | bstrDestinationDirectory,
 |  | int | lOptions,
 |  | String | bstrUserId,
 |  | String | bstrPassword,
 |  | String | bstrRSN
 | ) |  |

.method(vtoffset=13, dispid=10, type=METHOD, name="InstallApplication", addFlagsVtable=4) .parameters([in,type=STRING] bstrApplicationFile, [in,type=STRING] bstrDestinationDirectory, [in,type=I4] lOptions, [in,type=STRING] bstrUserId, [in,type=STRING] bstrPassword, [in,type=STRING] bstrRSN)

Implements comadmin::ICOMAdminCatalog.

native void comadmin::COMAdminCatalog::InstallComponent | ( | String | bstrApplIdOrName,
 |  | String | bstrDLL,
 |  | String | bstrTLB,
 |  | String | bstrPSDLL
 | ) |  |

.method(vtoffset=10, dispid=7, type=METHOD, name="InstallComponent", addFlagsVtable=4) .parameters([in,type=STRING] bstrApplIdOrName, [in,type=STRING] bstrDLL, [in,type=STRING] bstrTLB, [in,type=STRING] bstrPSDLL)

Implements comadmin::ICOMAdminCatalog.

native void comadmin::COMAdminCatalog::InstallEventClass | ( | String | bstrApplIdOrName,
 |  | String | bstrDLL,
 |  | String | bstrTLB,
 |  | String | bstrPSDLL
 | ) |  |

.method(vtoffset=28, dispid=25, type=METHOD, name="InstallEventClass", addFlagsVtable=4) .parameters([in,type=STRING] bstrApplIdOrName, [in,type=STRING] bstrDLL, [in,type=STRING] bstrTLB, [in,type=STRING] bstrPSDLL)

Implements comadmin::ICOMAdminCatalog.

native void comadmin::COMAdminCatalog::InstallMultipleComponents | ( | String | bstrApplIdOrName,
 |  | com.ms.com.SafeArray | varFileNames,
 |  | com.ms.com.SafeArray | varCLSIDS
 | ) |  |

.method(vtoffset=19, dispid=16, type=METHOD, name="InstallMultipleComponents", addFlagsVtable=4) .parameters([in,type=STRING] bstrApplIdOrName, [in,vt=16396,type=SAFEARRAY] varFileNames, [in,vt=16396,type=SAFEARRAY] varCLSIDS)

Implements comadmin::ICOMAdminCatalog.

native void comadmin::COMAdminCatalog::InstallMultipleEventClasses | ( | String | bstrApplIdOrName,
 |  | com.ms.com.SafeArray | varFileNames,
 |  | com.ms.com.SafeArray | varCLSIDS
 | ) |  |

.method(vtoffset=27, dispid=24, type=METHOD, name="InstallMultipleEventClasses", addFlagsVtable=4) .parameters([in,type=STRING] bstrApplIdOrName, [in,vt=16396,type=SAFEARRAY] varFileNames, [in,vt=16396,type=SAFEARRAY] varCLSIDS)

Implements comadmin::ICOMAdminCatalog.

native void comadmin::COMAdminCatalog::QueryApplicationFile | ( | String | bstrApplicationFile,
 |  | String[] | bstrApplicationName,
 |  | String[] | bstrApplicationDescription,
 |  | boolean[] | bHasUsers,
 |  | boolean[] | bIsProxy,
 |  | com.ms.com.SafeArray | varFileNames
 | ) |  |

.method(vtoffset=24, dispid=21, type=METHOD, name="QueryApplicationFile", addFlagsVtable=4) .parameters([in,type=STRING] bstrApplicationFile, [out,size=1,elementType=STRING,type=ARRAY] bstrApplicationName, [out,size=1,elementType=STRING,type=ARRAY] bstrApplicationDescription, [out,size=1,elementType=BOOLEAN,type=ARRAY] bHasUsers, [out,size=1,elementType=BOOLEAN,type=ARRAY] bIsProxy, [out,vt=16396,type=SAFEARRAY] varFileNames)

Implements comadmin::ICOMAdminCatalog.

native void comadmin::COMAdminCatalog::RefreshComponents ( )

.method(vtoffset=21, dispid=18, type=METHOD, name="RefreshComponents", addFlagsVtable=4) .parameters()

Implements comadmin::ICOMAdminCatalog.

native void comadmin::COMAdminCatalog::RefreshRouter ( )

.method(vtoffset=15, dispid=12, type=METHOD, name="RefreshRouter", addFlagsVtable=4) .parameters()

Implements comadmin::ICOMAdminCatalog.

native void comadmin::COMAdminCatalog::Reserved1 ( )

.method(vtoffset=17, dispid=14, type=METHOD, name="Reserved1", addFlagsVtable=4) .parameters()

Implements comadmin::ICOMAdminCatalog.

native void comadmin::COMAdminCatalog::Reserved2 ( )

.method(vtoffset=18, dispid=15, type=METHOD, name="Reserved2", addFlagsVtable=4) .parameters()

Implements comadmin::ICOMAdminCatalog.

native void comadmin::COMAdminCatalog::RestoreREGDB ( String bstrBackupFilePath )

.method(vtoffset=23, dispid=20, type=METHOD, name="RestoreREGDB", addFlagsVtable=4) .parameters([in,type=STRING] bstrBackupFilePath)

Implements comadmin::ICOMAdminCatalog.

native int comadmin::COMAdminCatalog::ServiceCheck ( int lService )

.method(vtoffset=26, dispid=23, type=METHOD, name="ServiceCheck", addFlagsVtable=4) .parameters([in,type=I4] lService, [type=I4] return)

Implements comadmin::ICOMAdminCatalog.

native void comadmin::COMAdminCatalog::ShutdownApplication ( String bstrApplIdOrName )

.method(vtoffset=11, dispid=8, type=METHOD, name="ShutdownApplication", addFlagsVtable=4) .parameters([in,type=STRING] bstrApplIdOrName)

Implements comadmin::ICOMAdminCatalog.

native void comadmin::COMAdminCatalog::StartApplication ( String bstrApplIdOrName )

.method(vtoffset=25, dispid=22, type=METHOD, name="StartApplication", addFlagsVtable=4) .parameters([in,type=STRING] bstrApplIdOrName)

Implements comadmin::ICOMAdminCatalog.

native void comadmin::COMAdminCatalog::StartRouter ( )

.method(vtoffset=16, dispid=13, type=METHOD, name="StartRouter", addFlagsVtable=4) .parameters()

Implements comadmin::ICOMAdminCatalog.

native void comadmin::COMAdminCatalog::StopRouter ( )

.method(vtoffset=14, dispid=11, type=METHOD, name="StopRouter", addFlagsVtable=4) .parameters()

Implements comadmin::ICOMAdminCatalog.

Member Data Documentation

final com.ms.com._Guid comadmin::COMAdminCatalog::clsid = new com.ms.com._Guid((int)0xf618c514, (short)0xdfb8, (short)0x11d1, (byte)0xa2, (byte)0xcf, (byte)0x0, (byte)0x80, (byte)0x5f, (byte)0xc7, (byte)0x92, (byte)0x35) [static]

Definition at line 129 of file COMAdminCatalog.java.

final com.ms.com._Guid comadmin::COMAdminCatalog::iid = new com.ms.com._Guid((int)0xdd662187, (short)0xdfc2, (short)0x11d1, (byte)0xa2, (byte)0xcf, (byte)0x0, (byte)0x80, (byte)0x5f, (byte)0xc7, (byte)0x92, (byte)0x35) [static]

Implements comadmin::ICOMAdminCatalog.

Definition at line 127 of file COMAdminCatalog.java.

The documentation for this class was generated from the following file:
  • Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminCatalog.java
Generated on Wed Nov 13 2024 16:58:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: comadmin::COMAdminCatalogCollection Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • comadmin
  • comadmin::COMAdminCatalogCollection
Public Member Functions | Static Public Attributes

comadmin::COMAdminCatalogCollection Class Reference

.class(classid=F618C516-DFB8-11D1-A2CF-00805FC79235,DynamicCasts) .interface(iid=6EB22872-8A19-11D0-81B6-00A0C9231C29, thread=AUTO, type=DUAL)

Inherits com::ms::com::IUnknown, and comadmin::ICatalogCollection.

List of all members.

Public Member Functions

native Object | Add ()
native IUnknown | get_NewEnum ()
native boolean | getAddEnabled ()
native Object | GetCollection (String bstrCollName, Variant varObjectKey)
native int | getCount ()
native int | getDataStoreMajorVersion ()
native int | getDataStoreMinorVersion ()
native Object | getItem (int lIndex)
native Variant | getName ()
native boolean | getRemoveEnabled ()
native Object | GetUtilInterface ()
native void | Populate ()
native void | PopulateByKey (com.ms.com.SafeArray aKeys)
native void | PopulateByQuery (String bstrQueryString, int lQueryType)
native void | Remove (int lIndex)
native int | SaveChanges ()

Static Public Attributes

static final com.ms.com._Guid | clsid = new com.ms.com._Guid((int)0xf618c516, (short)0xdfb8, (short)0x11d1, (byte)0xa2, (byte)0xcf, (byte)0x0, (byte)0x80, (byte)0x5f, (byte)0xc7, (byte)0x92, (byte)0x35)
static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x6eb22872, (short)0x8a19, (short)0x11d0, (byte)0x81, (byte)0xb6, (byte)0x0, (byte)0xa0, (byte)0xc9, (byte)0x23, (byte)0x1c, (byte)0x29)

Detailed Description

Definition at line 20 of file COMAdminCatalogCollection.java.

Member Function Documentation

native Object comadmin::COMAdminCatalogCollection::Add ( )

.method(vtoffset=8, dispid=1610743812, type=METHOD, name="Add", addFlagsVtable=4) .parameters([iid=00020400-0000-0000-C000-000000000046,thread=AUTO,type=DISPATCH] return)

Implements comadmin::ICatalogCollection.

native IUnknown comadmin::COMAdminCatalogCollection::get_NewEnum ( )

.method(vtoffset=4, dispid=4294967292, type=PROPGET, name="_NewEnum", addFlagsVtable=4) .parameters([iid=00000000-0000-0000-C000-000000000046,thread=AUTO,type=OBJECT] return)

Implements comadmin::ICatalogCollection.

native boolean comadmin::COMAdminCatalogCollection::getAddEnabled ( )

.method(vtoffset=13, dispid=7, type=PROPGET, name="AddEnabled", addFlagsVtable=4) .parameters([type=BOOLEAN] return)

Implements comadmin::ICatalogCollection.

native Object comadmin::COMAdminCatalogCollection::GetCollection | ( | String | bstrCollName,
 |  | Variant | varObjectKey
 | ) |  |

.method(vtoffset=11, dispid=4, type=METHOD, name="GetCollection", addFlagsVtable=4) .parameters([in,type=STRING] bstrCollName, [in,type=VARIANT] varObjectKey, [iid=00020400-0000-0000-C000-000000000046,thread=AUTO,type=DISPATCH] return)

Implements comadmin::ICatalogCollection.

native int comadmin::COMAdminCatalogCollection::getCount ( )

.method(vtoffset=6, dispid=1610743810, type=PROPGET, name="Count", addFlagsVtable=4) .parameters([type=I4] return)

Implements comadmin::ICatalogCollection.

native int comadmin::COMAdminCatalogCollection::getDataStoreMajorVersion ( )

.method(vtoffset=16, dispid=10, type=PROPGET, name="DataStoreMajorVersion", addFlagsVtable=4) .parameters([type=I4] return)

Implements comadmin::ICatalogCollection.

native int comadmin::COMAdminCatalogCollection::getDataStoreMinorVersion ( )

.method(vtoffset=17, dispid=11, type=PROPGET, name="DataStoreMinorVersion", addFlagsVtable=4) .parameters([type=I4] return)

Implements comadmin::ICatalogCollection.

native Object comadmin::COMAdminCatalogCollection::getItem ( int lIndex )

.method(vtoffset=5, dispid=1, type=PROPGET, name="Item", addFlagsVtable=4) .parameters([in,type=I4] lIndex, [iid=00020400-0000-0000-C000-000000000046,thread=AUTO,type=DISPATCH] return)

Implements comadmin::ICatalogCollection.

native Variant comadmin::COMAdminCatalogCollection::getName ( )

.method(vtoffset=12, dispid=6, type=PROPGET, name="Name", addFlagsVtable=4) .parameters([type=VARIANT] return)

Implements comadmin::ICatalogCollection.

native boolean comadmin::COMAdminCatalogCollection::getRemoveEnabled ( )

.method(vtoffset=14, dispid=8, type=PROPGET, name="RemoveEnabled", addFlagsVtable=4) .parameters([type=BOOLEAN] return)

Implements comadmin::ICatalogCollection.

native Object comadmin::COMAdminCatalogCollection::GetUtilInterface ( )

.method(vtoffset=15, dispid=9, type=METHOD, name="GetUtilInterface", addFlagsVtable=4) .parameters([iid=00020400-0000-0000-C000-000000000046,thread=AUTO,type=DISPATCH] return)

Implements comadmin::ICatalogCollection.

native void comadmin::COMAdminCatalogCollection::Populate ( )

.method(vtoffset=9, dispid=2, type=METHOD, name="Populate", addFlagsVtable=4) .parameters()

Implements comadmin::ICatalogCollection.

native void comadmin::COMAdminCatalogCollection::PopulateByKey ( com.ms.com.SafeArray aKeys )

.method(vtoffset=18, dispid=12, type=METHOD, name="PopulateByKey", addFlagsVtable=4) .parameters([in,vt=12,type=SAFEARRAY] aKeys)

Implements comadmin::ICatalogCollection.

native void comadmin::COMAdminCatalogCollection::PopulateByQuery | ( | String | bstrQueryString,
 |  | int | lQueryType
 | ) |  |

.method(vtoffset=19, dispid=13, type=METHOD, name="PopulateByQuery", addFlagsVtable=4) .parameters([in,type=STRING] bstrQueryString, [in,type=I4] lQueryType)

Implements comadmin::ICatalogCollection.

native void comadmin::COMAdminCatalogCollection::Remove ( int lIndex )

.method(vtoffset=7, dispid=1610743811, type=METHOD, name="Remove", addFlagsVtable=4) .parameters([in,type=I4] lIndex)

Implements comadmin::ICatalogCollection.

native int comadmin::COMAdminCatalogCollection::SaveChanges ( )

.method(vtoffset=10, dispid=3, type=METHOD, name="SaveChanges", addFlagsVtable=4) .parameters([type=I4] return)

Implements comadmin::ICatalogCollection.

Member Data Documentation

final com.ms.com._Guid comadmin::COMAdminCatalogCollection::clsid = new com.ms.com._Guid((int)0xf618c516, (short)0xdfb8, (short)0x11d1, (byte)0xa2, (byte)0xcf, (byte)0x0, (byte)0x80, (byte)0x5f, (byte)0xc7, (byte)0x92, (byte)0x35) [static]

Definition at line 89 of file COMAdminCatalogCollection.java.

final com.ms.com._Guid comadmin::COMAdminCatalogCollection::iid = new com.ms.com._Guid((int)0x6eb22872, (short)0x8a19, (short)0x11d0, (byte)0x81, (byte)0xb6, (byte)0x0, (byte)0xa0, (byte)0xc9, (byte)0x23, (byte)0x1c, (byte)0x29) [static]

Implements comadmin::ICatalogCollection.

Definition at line 87 of file COMAdminCatalogCollection.java.

The documentation for this class was generated from the following file:
  • Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminCatalogCollection.java
Generated on Wed Nov 13 2024 16:58:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: comadmin::COMAdminCatalogObject Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • comadmin
  • comadmin::COMAdminCatalogObject
Public Member Functions | Static Public Attributes

comadmin::COMAdminCatalogObject Class Reference

.class(classid=F618C515-DFB8-11D1-A2CF-00805FC79235,DynamicCasts) .interface(iid=6EB22871-8A19-11D0-81B6-00A0C9231C29, thread=AUTO, type=DUAL)

Inherits com::ms::com::IUnknown, and comadmin::ICatalogObject.

List of all members.

Public Member Functions

native Variant | getKey ()
native Variant | getName ()
native boolean | getValid ()
native Variant | getValue (String bstrPropName)
native boolean | IsPropertyReadOnly (String bstrPropName)
native boolean | IsPropertyWriteOnly (String bstrPropName)
native void | setValue (String bstrPropName, Variant retval)

Static Public Attributes

static final com.ms.com._Guid | clsid = new com.ms.com._Guid((int)0xf618c515, (short)0xdfb8, (short)0x11d1, (byte)0xa2, (byte)0xcf, (byte)0x0, (byte)0x80, (byte)0x5f, (byte)0xc7, (byte)0x92, (byte)0x35)
static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x6eb22871, (short)0x8a19, (short)0x11d0, (byte)0x81, (byte)0xb6, (byte)0x0, (byte)0xa0, (byte)0xc9, (byte)0x23, (byte)0x1c, (byte)0x29)

Detailed Description

Definition at line 20 of file COMAdminCatalogObject.java.

Member Function Documentation

native Variant comadmin::COMAdminCatalogObject::getKey ( )

.method(vtoffset=6, dispid=2, type=PROPGET, name="Key", addFlagsVtable=4) .parameters([type=VARIANT] return)

Implements comadmin::ICatalogObject.

native Variant comadmin::COMAdminCatalogObject::getName ( )

.method(vtoffset=7, dispid=3, type=PROPGET, name="Name", addFlagsVtable=4) .parameters([type=VARIANT] return)

Implements comadmin::ICatalogObject.

native boolean comadmin::COMAdminCatalogObject::getValid ( )

.method(vtoffset=9, dispid=5, type=PROPGET, name="Valid", addFlagsVtable=4) .parameters([type=BOOLEAN] return)

Implements comadmin::ICatalogObject.

native Variant comadmin::COMAdminCatalogObject::getValue ( String bstrPropName )

.method(vtoffset=4, dispid=1, type=PROPGET, name="Value", addFlagsVtable=4) .parameters([in,type=STRING] bstrPropName, [type=VARIANT] return)

Implements comadmin::ICatalogObject.

native boolean comadmin::COMAdminCatalogObject::IsPropertyReadOnly ( String bstrPropName )

.method(vtoffset=8, dispid=4, type=METHOD, name="IsPropertyReadOnly", addFlagsVtable=4) .parameters([in,type=STRING] bstrPropName, [type=BOOLEAN] return)

Implements comadmin::ICatalogObject.

native boolean comadmin::COMAdminCatalogObject::IsPropertyWriteOnly ( String bstrPropName )

.method(vtoffset=10, dispid=6, type=METHOD, name="IsPropertyWriteOnly", addFlagsVtable=4) .parameters([in,type=STRING] bstrPropName, [type=BOOLEAN] return)

Implements comadmin::ICatalogObject.

native void comadmin::COMAdminCatalogObject::setValue | ( | String | bstrPropName,
 |  | Variant | retval
 | ) |  |

.method(vtoffset=5, dispid=1, type=PROPPUT, name="Value", addFlagsVtable=4) .parameters([in,type=STRING] bstrPropName, [in,type=VARIANT] retval)

Implements comadmin::ICatalogObject.

Member Data Documentation

final com.ms.com._Guid comadmin::COMAdminCatalogObject::clsid = new com.ms.com._Guid((int)0xf618c515, (short)0xdfb8, (short)0x11d1, (byte)0xa2, (byte)0xcf, (byte)0x0, (byte)0x80, (byte)0x5f, (byte)0xc7, (byte)0x92, (byte)0x35) [static]

Definition at line 53 of file COMAdminCatalogObject.java.

final com.ms.com._Guid comadmin::COMAdminCatalogObject::iid = new com.ms.com._Guid((int)0x6eb22871, (short)0x8a19, (short)0x11d0, (byte)0x81, (byte)0xb6, (byte)0x0, (byte)0xa0, (byte)0xc9, (byte)0x23, (byte)0x1c, (byte)0x29) [static]

Implements comadmin::ICatalogObject.

Definition at line 51 of file COMAdminCatalogObject.java.

The documentation for this class was generated from the following file:
  • Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminCatalogObject.java
Generated on Wed Nov 13 2024 16:58:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: comadmin::COMAdminComponentFlags Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • comadmin
  • comadmin::COMAdminComponentFlags
Static Public Attributes

comadmin::COMAdminComponentFlags Interface Reference

List of all members.

Static Public Attributes

static final int | COMAdminCompFlagAlreadyInstalled = 16
static final int | COMAdminCompFlagCOMPlusPropertiesFound = 2
static final int | COMAdminCompFlagInterfacesFound = 8
static final int | COMAdminCompFlagNotInApplication = 32
static final int | COMAdminCompFlagProxyFound = 4
static final int | COMAdminCompFlagTypeInfoFound = 1

Detailed Description

Definition at line 20 of file COMAdminComponentFlags.java.

Member Data Documentation

final int comadmin::COMAdminComponentFlags::COMAdminCompFlagAlreadyInstalled = 16 [static]

Definition at line 26 of file COMAdminComponentFlags.java.

final int comadmin::COMAdminComponentFlags::COMAdminCompFlagCOMPlusPropertiesFound = 2 [static]

Definition at line 23 of file COMAdminComponentFlags.java.

final int comadmin::COMAdminComponentFlags::COMAdminCompFlagInterfacesFound = 8 [static]

Definition at line 25 of file COMAdminComponentFlags.java.

final int comadmin::COMAdminComponentFlags::COMAdminCompFlagNotInApplication = 32 [static]

Definition at line 27 of file COMAdminComponentFlags.java.

final int comadmin::COMAdminComponentFlags::COMAdminCompFlagProxyFound = 4 [static]

Definition at line 24 of file COMAdminComponentFlags.java.

final int comadmin::COMAdminComponentFlags::COMAdminCompFlagTypeInfoFound = 1 [static]

Definition at line 22 of file COMAdminComponentFlags.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminComponentFlags.java
Generated on Wed Nov 13 2024 16:58:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: comadmin::COMAdminErrorCodes Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • comadmin
  • comadmin::COMAdminErrorCodes
Static Public Attributes

comadmin::COMAdminErrorCodes Interface Reference

List of all members.

Static Public Attributes

static final int | COMAdminErrAlreadyInstalled = -2146368508
static final int | COMAdminErrAppDirNotFound = -2146368481
static final int | COMAdminErrAppFileReadFail = -2146368504
static final int | COMAdminErrAppFileVersion = -2146368503
static final int | COMAdminErrAppFileWriteFail = -2146368505
static final int | COMAdminErrApplicationExists = -2146368501
static final int | COMAdminErrApplidMatchesClsid = -2146368442
static final int | COMAdminErrAuthenticationLevel = -2146368493
static final int | COMAdminErrBadPath = -2146368502
static final int | COMAdminErrBadRegistryLibID = -2146368482
static final int | COMAdminErrBadRegistryProgID = -2146368494
static final int | COMAdminErrCanNotExportAppProxy = -2146368438
static final int | COMAdminErrCanNotExportSystemApp = -2146368436
static final int | COMAdminErrCanNotStartApp = -2146368437
static final int | COMAdminErrCanNotSubscribeToComponent = -2146368435
static final int | COMAdminErrCantCopyFile = -2146368499
static final int | COMAdminErrCLSIDOrIIDMismatch = -2146368488
static final int | COMAdminErrCompFileBadTLB = -2146368472
static final int | COMAdminErrCompFileClassNotAvail = -2146368473
static final int | COMAdminErrCompFileDoesNotExist = -2146368476
static final int | COMAdminErrCompFileGetClassObj = -2146368474
static final int | COMAdminErrCompFileLoadDLLFail = -2146368475
static final int | COMAdminErrCompFileNoRegistrar = -2146368460
static final int | COMAdminErrCompFileNotInstallable = -2146368471
static final int | COMAdminErrCompMoveBadDest = -2146368466
static final int | COMAdminErrCompMoveLocked = -2146368467
static final int | COMAdminErrCoReqCompInstalled = -2146368459
static final int | COMAdminErrDllLoadFailed = -2146368483
static final int | COMAdminErrDllRegisterServer = -2146368486
static final int | COMAdminErrInvalidUserids = -2146368496
static final int | COMAdminErrKeyMissing = -2146368509
static final int | COMAdminErrNoRegistryCLSID = -2146368495
static final int | COMAdminErrNoServerShare = -2146368485
static final int | COMAdminErrNotChangeable = -2146368470
static final int | COMAdminErrNotDeletable = -2146368469
static final int | COMAdminErrNotInRegistry = -2146368450
static final int | COMAdminErrNoUser = -2146368497
static final int | COMAdminErrObjectDoesNotExist = -2146367479
static final int | COMAdminErrObjectErrors = -2146368511
static final int | COMAdminErrObjectExists = -2146368456
static final int | COMAdminErrObjectInvalid = -2146368510
static final int | COMAdminErrObjectNotPoolable = -2146368449
static final int | COMAdminErrObjectParentMissing = -2146367480
static final int | COMAdminErrPropertyOverflow = -2146368452
static final int | COMAdminErrPropertySaveFailed = -2146368457
static final int | COMAdminErrQueuingServiceNotAvailable = -2146367998
static final int | COMAdminErrRegFileCorrupt = -2146368453
static final int | COMAdminErrRegisterTLB = -2146368464
static final int | COMAdminErrRegistrarFailed = -2146368477
static final int | COMAdminErrRemoteInterface = -2146368487
static final int | COMAdminErrRequiresDifferentPlatform = -2146368439
static final int | COMAdminErrRoleDoesNotExist = -2146368441
static final int | COMAdminErrRoleExists = -2146368500
static final int | COMAdminErrServiceNotInstalled = -2146368458
static final int | COMAdminErrSession = -2146368468
static final int | COMAdminErrStartAppNeedsComponents = -2146368440
static final int | COMAdminErrSystemApp = -2146368461
static final int | COMAdminErrUserPasswdNotValid = -2146368492

Detailed Description

Definition at line 20 of file COMAdminErrorCodes.java.

Member Data Documentation

final int comadmin::COMAdminErrorCodes::COMAdminErrAlreadyInstalled = -2146368508 [static]

Definition at line 25 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrAppDirNotFound = -2146368481 [static]

Definition at line 45 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrAppFileReadFail = -2146368504 [static]

Definition at line 27 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrAppFileVersion = -2146368503 [static]

Definition at line 28 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrAppFileWriteFail = -2146368505 [static]

Definition at line 26 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrApplicationExists = -2146368501 [static]

Definition at line 30 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrApplidMatchesClsid = -2146368442 [static]

Definition at line 69 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrAuthenticationLevel = -2146368493 [static]

Definition at line 37 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrBadPath = -2146368502 [static]

Definition at line 29 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrBadRegistryLibID = -2146368482 [static]

Definition at line 44 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrBadRegistryProgID = -2146368494 [static]

Definition at line 36 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrCanNotExportAppProxy = -2146368438 [static]

Definition at line 76 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrCanNotExportSystemApp = -2146368436 [static]

Definition at line 78 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrCanNotStartApp = -2146368437 [static]

Definition at line 77 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrCanNotSubscribeToComponent = -2146368435 [static]

Definition at line 79 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrCantCopyFile = -2146368499 [static]

Definition at line 32 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrCLSIDOrIIDMismatch = -2146368488 [static]

Definition at line 39 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrCompFileBadTLB = -2146368472 [static]

Definition at line 51 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrCompFileClassNotAvail = -2146368473 [static]

Definition at line 50 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrCompFileDoesNotExist = -2146368476 [static]

Definition at line 47 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrCompFileGetClassObj = -2146368474 [static]

Definition at line 49 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrCompFileLoadDLLFail = -2146368475 [static]

Definition at line 48 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrCompFileNoRegistrar = -2146368460 [static]

Definition at line 60 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrCompFileNotInstallable = -2146368471 [static]

Definition at line 52 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrCompMoveBadDest = -2146368466 [static]

Definition at line 57 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrCompMoveLocked = -2146368467 [static]

Definition at line 56 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrCoReqCompInstalled = -2146368459 [static]

Definition at line 61 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrDllLoadFailed = -2146368483 [static]

Definition at line 43 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrDllRegisterServer = -2146368486 [static]

Definition at line 41 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrInvalidUserids = -2146368496 [static]

Definition at line 34 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrKeyMissing = -2146368509 [static]

Definition at line 24 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrNoRegistryCLSID = -2146368495 [static]

Definition at line 35 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrNoServerShare = -2146368485 [static]

Definition at line 42 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrNotChangeable = -2146368470 [static]

Definition at line 53 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrNotDeletable = -2146368469 [static]

Definition at line 54 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrNotInRegistry = -2146368450 [static]

Definition at line 67 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrNoUser = -2146368497 [static]

Definition at line 33 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrObjectDoesNotExist = -2146367479 [static]

Definition at line 75 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrObjectErrors = -2146368511 [static]

Definition at line 22 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrObjectExists = -2146368456 [static]

Definition at line 64 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrObjectInvalid = -2146368510 [static]

Definition at line 23 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrObjectNotPoolable = -2146368449 [static]

Definition at line 68 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrObjectParentMissing = -2146367480 [static]

Definition at line 74 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrPropertyOverflow = -2146368452 [static]

Definition at line 66 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrPropertySaveFailed = -2146368457 [static]

Definition at line 63 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrQueuingServiceNotAvailable = -2146367998 [static]

Definition at line 73 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrRegFileCorrupt = -2146368453 [static]

Definition at line 65 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrRegisterTLB = -2146368464 [static]

Definition at line 58 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrRegistrarFailed = -2146368477 [static]

Definition at line 46 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrRemoteInterface = -2146368487 [static]

Definition at line 40 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrRequiresDifferentPlatform = -2146368439 [static]

Definition at line 72 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrRoleDoesNotExist = -2146368441 [static]

Definition at line 70 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrRoleExists = -2146368500 [static]

Definition at line 31 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrServiceNotInstalled = -2146368458 [static]

Definition at line 62 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrSession = -2146368468 [static]

Definition at line 55 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrStartAppNeedsComponents = -2146368440 [static]

Definition at line 71 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrSystemApp = -2146368461 [static]

Definition at line 59 of file COMAdminErrorCodes.java.

final int comadmin::COMAdminErrorCodes::COMAdminErrUserPasswdNotValid = -2146368492 [static]

Definition at line 38 of file COMAdminErrorCodes.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminErrorCodes.java
Generated on Wed Nov 13 2024 16:58:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: comadmin::COMAdminFileFlags Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • comadmin
  • comadmin::COMAdminFileFlags
Static Public Attributes

comadmin::COMAdminFileFlags Interface Reference

List of all members.

Static Public Attributes

static final int | COMAdminFileFlagAlreadyInstalled = 512
static final int | COMAdminFileFlagBadTLB = 1024
static final int | COMAdminFileFlagClassNotAvailable = 4096
static final int | COMAdminFileFlagCOM = 2
static final int | COMAdminFileFlagContainsComp = 8
static final int | COMAdminFileFlagContainsPS = 4
static final int | COMAdminFileFlagContainsTLB = 16
static final int | COMAdminFileFlagDLLRegsvrFailed = 32768
static final int | COMAdminFileFlagDoesNotExist = 256
static final int | COMAdminFileFlagError = 262144
static final int | COMAdminFileFlagGetClassObjFailed = 2048
static final int | COMAdminFileFlagLoadable = 1
static final int | COMAdminFileFlagNoRegistrar = 16384
static final int | COMAdminFileFlagRegistrar = 8192
static final int | COMAdminFileFlagRegistrarFailed = 131072
static final int | COMAdminFileFlagRegTLBFailed = 65536
static final int | COMAdminFileFlagSelfReg = 32
static final int | COMAdminFileFlagSelfUnReg = 64
static final int | COMAdminFileFlagUnloadableDLL = 128

Detailed Description

Definition at line 20 of file COMAdminFileFlags.java.

Member Data Documentation

final int comadmin::COMAdminFileFlags::COMAdminFileFlagAlreadyInstalled = 512 [static]

Definition at line 31 of file COMAdminFileFlags.java.

final int comadmin::COMAdminFileFlags::COMAdminFileFlagBadTLB = 1024 [static]

Definition at line 32 of file COMAdminFileFlags.java.

final int comadmin::COMAdminFileFlags::COMAdminFileFlagClassNotAvailable = 4096 [static]

Definition at line 34 of file COMAdminFileFlags.java.

final int comadmin::COMAdminFileFlags::COMAdminFileFlagCOM = 2 [static]

Definition at line 23 of file COMAdminFileFlags.java.

final int comadmin::COMAdminFileFlags::COMAdminFileFlagContainsComp = 8 [static]

Definition at line 25 of file COMAdminFileFlags.java.

final int comadmin::COMAdminFileFlags::COMAdminFileFlagContainsPS = 4 [static]

Definition at line 24 of file COMAdminFileFlags.java.

final int comadmin::COMAdminFileFlags::COMAdminFileFlagContainsTLB = 16 [static]

Definition at line 26 of file COMAdminFileFlags.java.

final int comadmin::COMAdminFileFlags::COMAdminFileFlagDLLRegsvrFailed = 32768 [static]

Definition at line 37 of file COMAdminFileFlags.java.

final int comadmin::COMAdminFileFlags::COMAdminFileFlagDoesNotExist = 256 [static]

Definition at line 30 of file COMAdminFileFlags.java.

final int comadmin::COMAdminFileFlags::COMAdminFileFlagError = 262144 [static]

Definition at line 40 of file COMAdminFileFlags.java.

final int comadmin::COMAdminFileFlags::COMAdminFileFlagGetClassObjFailed = 2048 [static]

Definition at line 33 of file COMAdminFileFlags.java.

final int comadmin::COMAdminFileFlags::COMAdminFileFlagLoadable = 1 [static]

Definition at line 22 of file COMAdminFileFlags.java.

final int comadmin::COMAdminFileFlags::COMAdminFileFlagNoRegistrar = 16384 [static]

Definition at line 36 of file COMAdminFileFlags.java.

final int comadmin::COMAdminFileFlags::COMAdminFileFlagRegistrar = 8192 [static]

Definition at line 35 of file COMAdminFileFlags.java.

final int comadmin::COMAdminFileFlags::COMAdminFileFlagRegistrarFailed = 131072 [static]

Definition at line 39 of file COMAdminFileFlags.java.

final int comadmin::COMAdminFileFlags::COMAdminFileFlagRegTLBFailed = 65536 [static]

Definition at line 38 of file COMAdminFileFlags.java.

final int comadmin::COMAdminFileFlags::COMAdminFileFlagSelfReg = 32 [static]

Definition at line 27 of file COMAdminFileFlags.java.

final int comadmin::COMAdminFileFlags::COMAdminFileFlagSelfUnReg = 64 [static]

Definition at line 28 of file COMAdminFileFlags.java.

final int comadmin::COMAdminFileFlags::COMAdminFileFlagUnloadableDLL = 128 [static]

Definition at line 29 of file COMAdminFileFlags.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminFileFlags.java
Generated on Wed Nov 13 2024 16:58:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: comadmin::COMAdminImpersonationLevelOptions Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • comadmin
  • comadmin::COMAdminImpersonationLevelOptions
Static Public Attributes

comadmin::COMAdminImpersonationLevelOptions Interface Reference

List of all members.

Static Public Attributes

static final int | COMAdminImpersonationAnonymous = 1
static final int | COMAdminImpersonationDelegate = 4
static final int | COMAdminImpersonationIdentify = 2
static final int | COMAdminImpersonationImpersonate = 3

Detailed Description

Definition at line 20 of file COMAdminImpersonationLevelOptions.java.

Member Data Documentation

final int comadmin::COMAdminImpersonationLevelOptions::COMAdminImpersonationAnonymous = 1 [static]

Definition at line 22 of file COMAdminImpersonationLevelOptions.java.

final int comadmin::COMAdminImpersonationLevelOptions::COMAdminImpersonationDelegate = 4 [static]

Definition at line 25 of file COMAdminImpersonationLevelOptions.java.

final int comadmin::COMAdminImpersonationLevelOptions::COMAdminImpersonationIdentify = 2 [static]

Definition at line 23 of file COMAdminImpersonationLevelOptions.java.

final int comadmin::COMAdminImpersonationLevelOptions::COMAdminImpersonationImpersonate = 3 [static]

Definition at line 24 of file COMAdminImpersonationLevelOptions.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminImpersonationLevelOptions.java
Generated on Wed Nov 13 2024 16:58:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: comadmin::COMAdminOS Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • comadmin
  • comadmin::COMAdminOS
Static Public Attributes

comadmin::COMAdminOS Interface Reference

List of all members.

Static Public Attributes

static final int | COMAdminOSWindows3_1 = 1
static final int | COMAdminOSWindows9x = 2
static final int | COMAdminOSWindowsNT = 3
static final int | COMAdminOSWindowsNTEnterprise = 4

Detailed Description

Definition at line 20 of file COMAdminOS.java.

Member Data Documentation

final int comadmin::COMAdminOS::COMAdminOSWindows3_1 = 1 [static]

Definition at line 22 of file COMAdminOS.java.

final int comadmin::COMAdminOS::COMAdminOSWindows9x = 2 [static]

Definition at line 23 of file COMAdminOS.java.

final int comadmin::COMAdminOS::COMAdminOSWindowsNT = 3 [static]

Definition at line 24 of file COMAdminOS.java.

final int comadmin::COMAdminOS::COMAdminOSWindowsNTEnterprise = 4 [static]

Definition at line 25 of file COMAdminOS.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminOS.java
Generated on Wed Nov 13 2024 16:58:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: comadmin::COMAdminServiceOptions Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • comadmin
  • comadmin::COMAdminServiceOptions
Static Public Attributes

comadmin::COMAdminServiceOptions Interface Reference

List of all members.

Static Public Attributes

static final int COMAdminServiceLoadBalanceRouter = 1

Detailed Description

Definition at line 20 of file COMAdminServiceOptions.java.

Member Data Documentation

final int comadmin::COMAdminServiceOptions::COMAdminServiceLoadBalanceRouter = 1 [static]

Definition at line 22 of file COMAdminServiceOptions.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminServiceOptions.java
Generated on Wed Nov 13 2024 16:58:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: comadmin::COMAdminServiceStatusOptions Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • comadmin
  • comadmin::COMAdminServiceStatusOptions
Static Public Attributes

comadmin::COMAdminServiceStatusOptions Interface Reference

List of all members.

Static Public Attributes

static final int | COMAdminServiceContinuePending = 4
static final int | COMAdminServicePaused = 6
static final int | COMAdminServicePausePending = 5
static final int | COMAdminServiceRunning = 3
static final int | COMAdminServiceStartPending = 1
static final int | COMAdminServiceStopped = 0
static final int | COMAdminServiceStopPending = 2
static final int | COMAdminServiceUnknownState = 7

Detailed Description

Definition at line 20 of file COMAdminServiceStatusOptions.java.

Member Data Documentation

final int comadmin::COMAdminServiceStatusOptions::COMAdminServiceContinuePending = 4 [static]

Definition at line 26 of file COMAdminServiceStatusOptions.java.

final int comadmin::COMAdminServiceStatusOptions::COMAdminServicePaused = 6 [static]

Definition at line 28 of file COMAdminServiceStatusOptions.java.

final int comadmin::COMAdminServiceStatusOptions::COMAdminServicePausePending = 5 [static]

Definition at line 27 of file COMAdminServiceStatusOptions.java.

final int comadmin::COMAdminServiceStatusOptions::COMAdminServiceRunning = 3 [static]

Definition at line 25 of file COMAdminServiceStatusOptions.java.

final int comadmin::COMAdminServiceStatusOptions::COMAdminServiceStartPending = 1 [static]

Definition at line 23 of file COMAdminServiceStatusOptions.java.

final int comadmin::COMAdminServiceStatusOptions::COMAdminServiceStopped = 0 [static]

Definition at line 22 of file COMAdminServiceStatusOptions.java.

final int comadmin::COMAdminServiceStatusOptions::COMAdminServiceStopPending = 2 [static]

Definition at line 24 of file COMAdminServiceStatusOptions.java.

final int comadmin::COMAdminServiceStatusOptions::COMAdminServiceUnknownState = 7 [static]

Definition at line 29 of file COMAdminServiceStatusOptions.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminServiceStatusOptions.java
Generated on Wed Nov 13 2024 16:58:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: comadmin::COMAdminSynchronizationOptions Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • comadmin
  • comadmin::COMAdminSynchronizationOptions
Static Public Attributes

comadmin::COMAdminSynchronizationOptions Interface Reference

List of all members.

Static Public Attributes

static final int | COMAdminSynchronizationIgnored = 0
static final int | COMAdminSynchronizationNone = 1
static final int | COMAdminSynchronizationRequired = 3
static final int | COMAdminSynchronizationRequiresNew = 4
static final int | COMAdminSynchronizationSupported = 2

Detailed Description

Definition at line 20 of file COMAdminSynchronizationOptions.java.

Member Data Documentation

final int comadmin::COMAdminSynchronizationOptions::COMAdminSynchronizationIgnored = 0 [static]

Definition at line 22 of file COMAdminSynchronizationOptions.java.

final int comadmin::COMAdminSynchronizationOptions::COMAdminSynchronizationNone = 1 [static]

Definition at line 23 of file COMAdminSynchronizationOptions.java.

final int comadmin::COMAdminSynchronizationOptions::COMAdminSynchronizationRequired = 3 [static]

Definition at line 25 of file COMAdminSynchronizationOptions.java.

final int comadmin::COMAdminSynchronizationOptions::COMAdminSynchronizationRequiresNew = 4 [static]

Definition at line 26 of file COMAdminSynchronizationOptions.java.

final int comadmin::COMAdminSynchronizationOptions::COMAdminSynchronizationSupported = 2 [static]

Definition at line 24 of file COMAdminSynchronizationOptions.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminSynchronizationOptions.java
Generated on Wed Nov 13 2024 16:58:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: comadmin::COMAdminThreadingModels Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • comadmin
  • comadmin::COMAdminThreadingModels
Static Public Attributes

comadmin::COMAdminThreadingModels Interface Reference

List of all members.

Static Public Attributes

static final int | COMAdminThreadingModelApartment = 0
static final int | COMAdminThreadingModelBoth = 3
static final int | COMAdminThreadingModelFree = 1
static final int | COMAdminThreadingModelMain = 2
static final int | COMAdminThreadingModelNeutral = 4
static final int | COMAdminThreadingModelNotSpecified = 5

Detailed Description

Definition at line 20 of file COMAdminThreadingModels.java.

Member Data Documentation

final int comadmin::COMAdminThreadingModels::COMAdminThreadingModelApartment = 0 [static]

Definition at line 22 of file COMAdminThreadingModels.java.

final int comadmin::COMAdminThreadingModels::COMAdminThreadingModelBoth = 3 [static]

Definition at line 25 of file COMAdminThreadingModels.java.

final int comadmin::COMAdminThreadingModels::COMAdminThreadingModelFree = 1 [static]

Definition at line 23 of file COMAdminThreadingModels.java.

final int comadmin::COMAdminThreadingModels::COMAdminThreadingModelMain = 2 [static]

Definition at line 24 of file COMAdminThreadingModels.java.

final int comadmin::COMAdminThreadingModels::COMAdminThreadingModelNeutral = 4 [static]

Definition at line 26 of file COMAdminThreadingModels.java.

final int comadmin::COMAdminThreadingModels::COMAdminThreadingModelNotSpecified = 5 [static]

Definition at line 27 of file COMAdminThreadingModels.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminThreadingModels.java
Generated on Wed Nov 13 2024 16:58:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: comadmin::COMAdminTransactionOptions Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • comadmin
  • comadmin::COMAdminTransactionOptions
Static Public Attributes

comadmin::COMAdminTransactionOptions Interface Reference

List of all members.

Static Public Attributes

static final int | COMAdminTransactionIgnored = 0
static final int | COMAdminTransactionNone = 1
static final int | COMAdminTransactionRequired = 3
static final int | COMAdminTransactionRequiresNew = 4
static final int | COMAdminTransactionSupported = 2

Detailed Description

Definition at line 20 of file COMAdminTransactionOptions.java.

Member Data Documentation

final int comadmin::COMAdminTransactionOptions::COMAdminTransactionIgnored = 0 [static]

Definition at line 22 of file COMAdminTransactionOptions.java.

final int comadmin::COMAdminTransactionOptions::COMAdminTransactionNone = 1 [static]

Definition at line 23 of file COMAdminTransactionOptions.java.

final int comadmin::COMAdminTransactionOptions::COMAdminTransactionRequired = 3 [static]

Definition at line 25 of file COMAdminTransactionOptions.java.

final int comadmin::COMAdminTransactionOptions::COMAdminTransactionRequiresNew = 4 [static]

Definition at line 26 of file COMAdminTransactionOptions.java.

final int comadmin::COMAdminTransactionOptions::COMAdminTransactionSupported = 2 [static]

Definition at line 24 of file COMAdminTransactionOptions.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminTransactionOptions.java
Generated on Wed Nov 13 2024 16:58:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: comadmin::ICatalogCollection Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • comadmin
  • comadmin::ICatalogCollection
Public Member Functions | Static Public Attributes

comadmin::ICatalogCollection Interface Reference

.interface(iid=6EB22872-8A19-11D0-81B6-00A0C9231C29, thread=AUTO, type=DUAL)

Inherits com::ms::com::IUnknown.

Inherited by comadmin::COMAdminCatalogCollection.

List of all members.

Public Member Functions

Object | Add ()
IUnknown | get_NewEnum ()
boolean | getAddEnabled ()
Object | GetCollection (String bstrCollName, Variant varObjectKey)
int | getCount ()
int | getDataStoreMajorVersion ()
int | getDataStoreMinorVersion ()
Object | getItem (int lIndex)
Variant | getName ()
boolean | getRemoveEnabled ()
Object | GetUtilInterface ()
void | Populate ()
void | PopulateByKey (com.ms.com.SafeArray aKeys)
void | PopulateByQuery (String bstrQueryString, int lQueryType)
void | Remove (int lIndex)
int | SaveChanges ()

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x6eb22872, (short)0x8a19, (short)0x11d0, (byte)0x81, (byte)0xb6, (byte)0x0, (byte)0xa0, (byte)0xc9, (byte)0x23, (byte)0x1c, (byte)0x29)

Detailed Description

Definition at line 20 of file ICatalogCollection.java.

Member Function Documentation

Object comadmin::ICatalogCollection::Add ( )

.method(vtoffset=8, dispid=1610743812, type=METHOD, name="Add", addFlagsVtable=4) .parameters([iid=00020400-0000-0000-C000-000000000046,thread=AUTO,type=DISPATCH] return)

Implemented in comadmin::COMAdminCatalogCollection.

IUnknown comadmin::ICatalogCollection::get_NewEnum ( )

.method(vtoffset=4, dispid=4294967292, type=PROPGET, name="_NewEnum", addFlagsVtable=4) .parameters([iid=00000000-0000-0000-C000-000000000046,thread=AUTO,type=OBJECT] return)

Implemented in comadmin::COMAdminCatalogCollection.

boolean comadmin::ICatalogCollection::getAddEnabled ( )

.method(vtoffset=13, dispid=7, type=PROPGET, name="AddEnabled", addFlagsVtable=4) .parameters([type=BOOLEAN] return)

Implemented in comadmin::COMAdminCatalogCollection.

Object comadmin::ICatalogCollection::GetCollection | ( | String | bstrCollName,
 |  | Variant | varObjectKey
 | ) |  |

.method(vtoffset=11, dispid=4, type=METHOD, name="GetCollection", addFlagsVtable=4) .parameters([in,type=STRING] bstrCollName, [in,type=VARIANT] varObjectKey, [iid=00020400-0000-0000-C000-000000000046,thread=AUTO,type=DISPATCH] return)

Implemented in comadmin::COMAdminCatalogCollection.

int comadmin::ICatalogCollection::getCount ( )

.method(vtoffset=6, dispid=1610743810, type=PROPGET, name="Count", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in comadmin::COMAdminCatalogCollection.

int comadmin::ICatalogCollection::getDataStoreMajorVersion ( )

.method(vtoffset=16, dispid=10, type=PROPGET, name="DataStoreMajorVersion", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in comadmin::COMAdminCatalogCollection.

int comadmin::ICatalogCollection::getDataStoreMinorVersion ( )

.method(vtoffset=17, dispid=11, type=PROPGET, name="DataStoreMinorVersion", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in comadmin::COMAdminCatalogCollection.

Object comadmin::ICatalogCollection::getItem ( int lIndex )

.method(vtoffset=5, dispid=1, type=PROPGET, name="Item", addFlagsVtable=4) .parameters([in,type=I4] lIndex, [iid=00020400-0000-0000-C000-000000000046,thread=AUTO,type=DISPATCH] return)

Implemented in comadmin::COMAdminCatalogCollection.

Variant comadmin::ICatalogCollection::getName ( )

.method(vtoffset=12, dispid=6, type=PROPGET, name="Name", addFlagsVtable=4) .parameters([type=VARIANT] return)

Implemented in comadmin::COMAdminCatalogCollection.

boolean comadmin::ICatalogCollection::getRemoveEnabled ( )

.method(vtoffset=14, dispid=8, type=PROPGET, name="RemoveEnabled", addFlagsVtable=4) .parameters([type=BOOLEAN] return)

Implemented in comadmin::COMAdminCatalogCollection.

Object comadmin::ICatalogCollection::GetUtilInterface ( )

.method(vtoffset=15, dispid=9, type=METHOD, name="GetUtilInterface", addFlagsVtable=4) .parameters([iid=00020400-0000-0000-C000-000000000046,thread=AUTO,type=DISPATCH] return)

Implemented in comadmin::COMAdminCatalogCollection.

void comadmin::ICatalogCollection::Populate ( )

.method(vtoffset=9, dispid=2, type=METHOD, name="Populate", addFlagsVtable=4) .parameters()

Implemented in comadmin::COMAdminCatalogCollection.

void comadmin::ICatalogCollection::PopulateByKey ( com.ms.com.SafeArray aKeys )

.method(vtoffset=18, dispid=12, type=METHOD, name="PopulateByKey", addFlagsVtable=4) .parameters([in,vt=12,type=SAFEARRAY] aKeys)

Implemented in comadmin::COMAdminCatalogCollection.

void comadmin::ICatalogCollection::PopulateByQuery | ( | String | bstrQueryString,
 |  | int | lQueryType
 | ) |  |

.method(vtoffset=19, dispid=13, type=METHOD, name="PopulateByQuery", addFlagsVtable=4) .parameters([in,type=STRING] bstrQueryString, [in,type=I4] lQueryType)

Implemented in comadmin::COMAdminCatalogCollection.

void comadmin::ICatalogCollection::Remove ( int lIndex )

.method(vtoffset=7, dispid=1610743811, type=METHOD, name="Remove", addFlagsVtable=4) .parameters([in,type=I4] lIndex)

Implemented in comadmin::COMAdminCatalogCollection.

int comadmin::ICatalogCollection::SaveChanges ( )

.method(vtoffset=10, dispid=3, type=METHOD, name="SaveChanges", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in comadmin::COMAdminCatalogCollection.

Member Data Documentation

final com.ms.com._Guid comadmin::ICatalogCollection::iid = new com.ms.com._Guid((int)0x6eb22872, (short)0x8a19, (short)0x11d0, (byte)0x81, (byte)0xb6, (byte)0x0, (byte)0xa0, (byte)0xc9, (byte)0x23, (byte)0x1c, (byte)0x29) [static]

Implemented in comadmin::COMAdminCatalogCollection.

Definition at line 87 of file ICatalogCollection.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Events/EventNewsJAVA/ComAdmin/ICatalogCollection.java
Generated on Wed Nov 13 2024 16:58:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: comadmin::ICatalogObject Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • comadmin
  • comadmin::ICatalogObject
Public Member Functions | Static Public Attributes

comadmin::ICatalogObject Interface Reference

.interface(iid=6EB22871-8A19-11D0-81B6-00A0C9231C29, thread=AUTO, type=DUAL)

Inherits com::ms::com::IUnknown.

Inherited by comadmin::COMAdminCatalogObject.

List of all members.

Public Member Functions

Variant | getKey ()
Variant | getName ()
boolean | getValid ()
Variant | getValue (String bstrPropName)
boolean | IsPropertyReadOnly (String bstrPropName)
boolean | IsPropertyWriteOnly (String bstrPropName)
void | setValue (String bstrPropName, Variant retval)

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x6eb22871, (short)0x8a19, (short)0x11d0, (byte)0x81, (byte)0xb6, (byte)0x0, (byte)0xa0, (byte)0xc9, (byte)0x23, (byte)0x1c, (byte)0x29)

Detailed Description

Definition at line 20 of file ICatalogObject.java.

Member Function Documentation

Variant comadmin::ICatalogObject::getKey ( )

.method(vtoffset=6, dispid=2, type=PROPGET, name="Key", addFlagsVtable=4) .parameters([type=VARIANT] return)

Implemented in comadmin::COMAdminCatalogObject.

Variant comadmin::ICatalogObject::getName ( )

.method(vtoffset=7, dispid=3, type=PROPGET, name="Name", addFlagsVtable=4) .parameters([type=VARIANT] return)

Implemented in comadmin::COMAdminCatalogObject.

boolean comadmin::ICatalogObject::getValid ( )

.method(vtoffset=9, dispid=5, type=PROPGET, name="Valid", addFlagsVtable=4) .parameters([type=BOOLEAN] return)

Implemented in comadmin::COMAdminCatalogObject.

Variant comadmin::ICatalogObject::getValue ( String bstrPropName )

.method(vtoffset=4, dispid=1, type=PROPGET, name="Value", addFlagsVtable=4) .parameters([in,type=STRING] bstrPropName, [type=VARIANT] return)

Implemented in comadmin::COMAdminCatalogObject.

boolean comadmin::ICatalogObject::IsPropertyReadOnly ( String bstrPropName )

.method(vtoffset=8, dispid=4, type=METHOD, name="IsPropertyReadOnly", addFlagsVtable=4) .parameters([in,type=STRING] bstrPropName, [type=BOOLEAN] return)

Implemented in comadmin::COMAdminCatalogObject.

boolean comadmin::ICatalogObject::IsPropertyWriteOnly ( String bstrPropName )

.method(vtoffset=10, dispid=6, type=METHOD, name="IsPropertyWriteOnly", addFlagsVtable=4) .parameters([in,type=STRING] bstrPropName, [type=BOOLEAN] return)

Implemented in comadmin::COMAdminCatalogObject.

void comadmin::ICatalogObject::setValue | ( | String | bstrPropName,
 |  | Variant | retval
 | ) |  |

.method(vtoffset=5, dispid=1, type=PROPPUT, name="Value", addFlagsVtable=4) .parameters([in,type=STRING] bstrPropName, [in,type=VARIANT] retval)

Implemented in comadmin::COMAdminCatalogObject.

Member Data Documentation

final com.ms.com._Guid comadmin::ICatalogObject::iid = new com.ms.com._Guid((int)0x6eb22871, (short)0x8a19, (short)0x11d0, (byte)0x81, (byte)0xb6, (byte)0x0, (byte)0xa0, (byte)0xc9, (byte)0x23, (byte)0x1c, (byte)0x29) [static]

Implemented in comadmin::COMAdminCatalogObject.

Definition at line 51 of file ICatalogObject.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Events/EventNewsJAVA/ComAdmin/ICatalogObject.java
Generated on Wed Nov 13 2024 16:58:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: comadmin::ICOMAdminCatalog Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • comadmin
  • comadmin::ICOMAdminCatalog
Public Member Functions | Static Public Attributes

comadmin::ICOMAdminCatalog Interface Reference

.interface(iid=DD662187-DFC2-11D1-A2CF-00805FC79235, thread=AUTO, type=DUAL)

Inherits com::ms::com::IUnknown.

Inherited by comadmin::COMAdminCatalog.

List of all members.

Public Member Functions

void | BackupREGDB (String bstrBackupFilePath)
Object | Connect (String bstrConnectString)
void | ExportApplication (String bstrApplIdOrName, String bstrApplicationFile, int lOptions)
Object | GetCollection (String bstrCollName)
Object | GetCollectionByQuery (String bstrCollName, com.ms.com.SafeArray aQuery)
void | GetEventClassesForIID (String bstrIID, com.ms.com.SafeArray varCLSIDS, com.ms.com.SafeArray varProgIDs, com.ms.com.SafeArray varDescriptions)
int | getMajorVersion ()
int | getMinorVersion ()
void | GetMultipleComponentsInfo (String bstrApplIdOrName, com.ms.com.SafeArray varFileNames, com.ms.com.SafeArray varCLSIDS, com.ms.com.SafeArray varClassNames, com.ms.com.SafeArray varFileFlags, com.ms.com.SafeArray varComponentFlags)
void | ImportComponent (String bstrApplIdOrName, String bstrCLSIDOrProgId)
void | InstallApplication (String bstrApplicationFile, String bstrDestinationDirectory, int lOptions, String bstrUserId, String bstrPassword, String bstrRSN)
void | InstallComponent (String bstrApplIdOrName, String bstrDLL, String bstrTLB, String bstrPSDLL)
void | InstallEventClass (String bstrApplIdOrName, String bstrDLL, String bstrTLB, String bstrPSDLL)
void | InstallMultipleComponents (String bstrApplIdOrName, com.ms.com.SafeArray varFileNames, com.ms.com.SafeArray varCLSIDS)
void | InstallMultipleEventClasses (String bstrApplIdOrName, com.ms.com.SafeArray varFileNames, com.ms.com.SafeArray varCLSIDS)
void | QueryApplicationFile (String bstrApplicationFile, String[] bstrApplicationName, String[] bstrApplicationDescription, boolean[] bHasUsers, boolean[] bIsProxy, com.ms.com.SafeArray varFileNames)
void | RefreshComponents ()
void | RefreshRouter ()
void | Reserved1 ()
void | Reserved2 ()
void | RestoreREGDB (String bstrBackupFilePath)
int | ServiceCheck (int lService)
void | ShutdownApplication (String bstrApplIdOrName)
void | StartApplication (String bstrApplIdOrName)
void | StartRouter ()
void | StopRouter ()

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0xdd662187, (short)0xdfc2, (short)0x11d1, (byte)0xa2, (byte)0xcf, (byte)0x0, (byte)0x80, (byte)0x5f, (byte)0xc7, (byte)0x92, (byte)0x35)

Detailed Description

Definition at line 20 of file ICOMAdminCatalog.java.

Member Function Documentation

void comadmin::ICOMAdminCatalog::BackupREGDB ( String bstrBackupFilePath )

.method(vtoffset=22, dispid=19, type=METHOD, name="BackupREGDB", addFlagsVtable=4) .parameters([in,type=STRING] bstrBackupFilePath)

Implemented in comadmin::COMAdminCatalog.

Object comadmin::ICOMAdminCatalog::Connect ( String bstrConnectString )

.method(vtoffset=5, dispid=2, type=METHOD, name="Connect", addFlagsVtable=4) .parameters([in,type=STRING] bstrConnectString, [iid=00020400-0000-0000-C000-000000000046,thread=AUTO,type=DISPATCH] return)

Implemented in comadmin::COMAdminCatalog.

void comadmin::ICOMAdminCatalog::ExportApplication | ( | String | bstrApplIdOrName,
 |  | String | bstrApplicationFile,
 |  | int | lOptions
 | ) |  |

.method(vtoffset=12, dispid=9, type=METHOD, name="ExportApplication", addFlagsVtable=4) .parameters([in,type=STRING] bstrApplIdOrName, [in,type=STRING] bstrApplicationFile, [in,type=I4] lOptions)

Implemented in comadmin::COMAdminCatalog.

Object comadmin::ICOMAdminCatalog::GetCollection ( String bstrCollName )

.method(vtoffset=4, dispid=1, type=METHOD, name="GetCollection", addFlagsVtable=4) .parameters([in,type=STRING] bstrCollName, [iid=00020400-0000-0000-C000-000000000046,thread=AUTO,type=DISPATCH] return)

Implemented in comadmin::COMAdminCatalog.

Object comadmin::ICOMAdminCatalog::GetCollectionByQuery | ( | String | bstrCollName,
 |  | com.ms.com.SafeArray | aQuery
 | ) |  |

.method(vtoffset=8, dispid=5, type=METHOD, name="GetCollectionByQuery", addFlagsVtable=4) .parameters([in,type=STRING] bstrCollName, [in,vt=16396,type=SAFEARRAY] aQuery, [iid=00020400-0000-0000-C000-000000000046,thread=AUTO,type=DISPATCH] return)

Implemented in comadmin::COMAdminCatalog.

void comadmin::ICOMAdminCatalog::GetEventClassesForIID | ( | String | bstrIID,
 |  | com.ms.com.SafeArray | varCLSIDS,
 |  | com.ms.com.SafeArray | varProgIDs,
 |  | com.ms.com.SafeArray | varDescriptions
 | ) |  |

.method(vtoffset=29, dispid=26, type=METHOD, name="GetEventClassesForIID", addFlagsVtable=4) .parameters([in,type=STRING] bstrIID, [out,vt=16396,type=SAFEARRAY] varCLSIDS, [out,vt=16396,type=SAFEARRAY] varProgIDs, [out,vt=16396,type=SAFEARRAY] varDescriptions)

Implemented in comadmin::COMAdminCatalog.

int comadmin::ICOMAdminCatalog::getMajorVersion ( )

.method(vtoffset=6, dispid=3, type=PROPGET, name="MajorVersion", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in comadmin::COMAdminCatalog.

int comadmin::ICOMAdminCatalog::getMinorVersion ( )

.method(vtoffset=7, dispid=4, type=PROPGET, name="MinorVersion", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in comadmin::COMAdminCatalog.

void comadmin::ICOMAdminCatalog::GetMultipleComponentsInfo | ( | String | bstrApplIdOrName,
 |  | com.ms.com.SafeArray | varFileNames,
 |  | com.ms.com.SafeArray | varCLSIDS,
 |  | com.ms.com.SafeArray | varClassNames,
 |  | com.ms.com.SafeArray | varFileFlags,
 |  | com.ms.com.SafeArray | varComponentFlags
 | ) |  |

.method(vtoffset=20, dispid=17, type=METHOD, name="GetMultipleComponentsInfo", addFlagsVtable=4) .parameters([in,type=STRING] bstrApplIdOrName, [in,vt=16396,type=SAFEARRAY] varFileNames, [out,vt=16396,type=SAFEARRAY] varCLSIDS, [out,vt=16396,type=SAFEARRAY] varClassNames, [out,vt=16396,type=SAFEARRAY] varFileFlags, [out,vt=16396,type=SAFEARRAY] varComponentFlags)

Implemented in comadmin::COMAdminCatalog.

void comadmin::ICOMAdminCatalog::ImportComponent | ( | String | bstrApplIdOrName,
 |  | String | bstrCLSIDOrProgId
 | ) |  |

.method(vtoffset=9, dispid=6, type=METHOD, name="ImportComponent", addFlagsVtable=4) .parameters([in,type=STRING] bstrApplIdOrName, [in,type=STRING] bstrCLSIDOrProgId)

Implemented in comadmin::COMAdminCatalog.

void comadmin::ICOMAdminCatalog::InstallApplication | ( | String | bstrApplicationFile,
 |  | String | bstrDestinationDirectory,
 |  | int | lOptions,
 |  | String | bstrUserId,
 |  | String | bstrPassword,
 |  | String | bstrRSN
 | ) |  |

.method(vtoffset=13, dispid=10, type=METHOD, name="InstallApplication", addFlagsVtable=4) .parameters([in,type=STRING] bstrApplicationFile, [in,type=STRING] bstrDestinationDirectory, [in,type=I4] lOptions, [in,type=STRING] bstrUserId, [in,type=STRING] bstrPassword, [in,type=STRING] bstrRSN)

Implemented in comadmin::COMAdminCatalog.

void comadmin::ICOMAdminCatalog::InstallComponent | ( | String | bstrApplIdOrName,
 |  | String | bstrDLL,
 |  | String | bstrTLB,
 |  | String | bstrPSDLL
 | ) |  |

.method(vtoffset=10, dispid=7, type=METHOD, name="InstallComponent", addFlagsVtable=4) .parameters([in,type=STRING] bstrApplIdOrName, [in,type=STRING] bstrDLL, [in,type=STRING] bstrTLB, [in,type=STRING] bstrPSDLL)

Implemented in comadmin::COMAdminCatalog.

void comadmin::ICOMAdminCatalog::InstallEventClass | ( | String | bstrApplIdOrName,
 |  | String | bstrDLL,
 |  | String | bstrTLB,
 |  | String | bstrPSDLL
 | ) |  |

.method(vtoffset=28, dispid=25, type=METHOD, name="InstallEventClass", addFlagsVtable=4) .parameters([in,type=STRING] bstrApplIdOrName, [in,type=STRING] bstrDLL, [in,type=STRING] bstrTLB, [in,type=STRING] bstrPSDLL)

Implemented in comadmin::COMAdminCatalog.

void comadmin::ICOMAdminCatalog::InstallMultipleComponents | ( | String | bstrApplIdOrName,
 |  | com.ms.com.SafeArray | varFileNames,
 |  | com.ms.com.SafeArray | varCLSIDS
 | ) |  |

.method(vtoffset=19, dispid=16, type=METHOD, name="InstallMultipleComponents", addFlagsVtable=4) .parameters([in,type=STRING] bstrApplIdOrName, [in,vt=16396,type=SAFEARRAY] varFileNames, [in,vt=16396,type=SAFEARRAY] varCLSIDS)

Implemented in comadmin::COMAdminCatalog.

void comadmin::ICOMAdminCatalog::InstallMultipleEventClasses | ( | String | bstrApplIdOrName,
 |  | com.ms.com.SafeArray | varFileNames,
 |  | com.ms.com.SafeArray | varCLSIDS
 | ) |  |

.method(vtoffset=27, dispid=24, type=METHOD, name="InstallMultipleEventClasses", addFlagsVtable=4) .parameters([in,type=STRING] bstrApplIdOrName, [in,vt=16396,type=SAFEARRAY] varFileNames, [in,vt=16396,type=SAFEARRAY] varCLSIDS)

Implemented in comadmin::COMAdminCatalog.

void comadmin::ICOMAdminCatalog::QueryApplicationFile | ( | String | bstrApplicationFile,
 |  | String[] | bstrApplicationName,
 |  | String[] | bstrApplicationDescription,
 |  | boolean[] | bHasUsers,
 |  | boolean[] | bIsProxy,
 |  | com.ms.com.SafeArray | varFileNames
 | ) |  |

.method(vtoffset=24, dispid=21, type=METHOD, name="QueryApplicationFile", addFlagsVtable=4) .parameters([in,type=STRING] bstrApplicationFile, [out,size=1,elementType=STRING,type=ARRAY] bstrApplicationName, [out,size=1,elementType=STRING,type=ARRAY] bstrApplicationDescription, [out,size=1,elementType=BOOLEAN,type=ARRAY] bHasUsers, [out,size=1,elementType=BOOLEAN,type=ARRAY] bIsProxy, [out,vt=16396,type=SAFEARRAY] varFileNames)

Implemented in comadmin::COMAdminCatalog.

void comadmin::ICOMAdminCatalog::RefreshComponents ( )

.method(vtoffset=21, dispid=18, type=METHOD, name="RefreshComponents", addFlagsVtable=4) .parameters()

Implemented in comadmin::COMAdminCatalog.

void comadmin::ICOMAdminCatalog::RefreshRouter ( )

.method(vtoffset=15, dispid=12, type=METHOD, name="RefreshRouter", addFlagsVtable=4) .parameters()

Implemented in comadmin::COMAdminCatalog.

void comadmin::ICOMAdminCatalog::Reserved1 ( )

.method(vtoffset=17, dispid=14, type=METHOD, name="Reserved1", addFlagsVtable=4) .parameters()

Implemented in comadmin::COMAdminCatalog.

void comadmin::ICOMAdminCatalog::Reserved2 ( )

.method(vtoffset=18, dispid=15, type=METHOD, name="Reserved2", addFlagsVtable=4) .parameters()

Implemented in comadmin::COMAdminCatalog.

void comadmin::ICOMAdminCatalog::RestoreREGDB ( String bstrBackupFilePath )

.method(vtoffset=23, dispid=20, type=METHOD, name="RestoreREGDB", addFlagsVtable=4) .parameters([in,type=STRING] bstrBackupFilePath)

Implemented in comadmin::COMAdminCatalog.

int comadmin::ICOMAdminCatalog::ServiceCheck ( int lService )

.method(vtoffset=26, dispid=23, type=METHOD, name="ServiceCheck", addFlagsVtable=4) .parameters([in,type=I4] lService, [type=I4] return)

Implemented in comadmin::COMAdminCatalog.

void comadmin::ICOMAdminCatalog::ShutdownApplication ( String bstrApplIdOrName )

.method(vtoffset=11, dispid=8, type=METHOD, name="ShutdownApplication", addFlagsVtable=4) .parameters([in,type=STRING] bstrApplIdOrName)

Implemented in comadmin::COMAdminCatalog.

void comadmin::ICOMAdminCatalog::StartApplication ( String bstrApplIdOrName )

.method(vtoffset=25, dispid=22, type=METHOD, name="StartApplication", addFlagsVtable=4) .parameters([in,type=STRING] bstrApplIdOrName)

Implemented in comadmin::COMAdminCatalog.

void comadmin::ICOMAdminCatalog::StartRouter ( )

.method(vtoffset=16, dispid=13, type=METHOD, name="StartRouter", addFlagsVtable=4) .parameters()

Implemented in comadmin::COMAdminCatalog.

void comadmin::ICOMAdminCatalog::StopRouter ( )

.method(vtoffset=14, dispid=11, type=METHOD, name="StopRouter", addFlagsVtable=4) .parameters()

Implemented in comadmin::COMAdminCatalog.

Member Data Documentation

final com.ms.com._Guid comadmin::ICOMAdminCatalog::iid = new com.ms.com._Guid((int)0xdd662187, (short)0xdfc2, (short)0x11d1, (byte)0xa2, (byte)0xcf, (byte)0x0, (byte)0x80, (byte)0x5f, (byte)0xc7, (byte)0x92, (byte)0x35) [static]

Implemented in comadmin::COMAdminCatalog.

Definition at line 127 of file ICOMAdminCatalog.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Events/EventNewsJAVA/ComAdmin/ICOMAdminCatalog.java
Generated on Wed Nov 13 2024 16:58:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: compitem Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

compitem Struct Reference

List of all members.

Public Attributes

BOOL bDiscard
BOOL bMarked
char | delims [64]
FILEDATA left
LPSTR result
FILEDATA right
LIST secs_composite
LIST secs_left
LIST secs_right
int | state
LPSTR tag

Detailed Description

Definition at line 54 of file compitem.cpp.

Member Data Documentation

BOOL compitem::bDiscard

Definition at line 64 of file compitem.cpp.

BOOL compitem::bMarked

Definition at line 68 of file compitem.cpp.

char compitem::delims[64]

Definition at line 69 of file compitem.cpp.

FILEDATA compitem::left

Definition at line 56 of file compitem.cpp.

LPSTR compitem::result

Definition at line 66 of file compitem.cpp.

FILEDATA compitem::right

Definition at line 57 of file compitem.cpp.

LIST compitem::secs_composite

Definition at line 59 of file compitem.cpp.

LIST compitem::secs_left

Definition at line 60 of file compitem.cpp.

LIST compitem::secs_right

Definition at line 61 of file compitem.cpp.

int compitem::state

Definition at line 63 of file compitem.cpp.

LPSTR compitem::tag

Definition at line 65 of file compitem.cpp.

The documentation for this struct was generated from the following file:
  • Begin/sdkdiff/compitem.cpp
Generated on Wed Nov 13 2024 16:57:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: complist Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

complist Struct Reference

List of all members.

Public Attributes

LIST items
DIRLIST left
DIRLIST right

Detailed Description

Definition at line 53 of file complist.cpp.

Member Data Documentation

LIST complist::items

Definition at line 56 of file complist.cpp.

DIRLIST complist::left

Definition at line 54 of file complist.cpp.

DIRLIST complist::right

Definition at line 55 of file complist.cpp.

The documentation for this struct was generated from the following file:
  • Begin/sdkdiff/complist.cpp
Generated on Wed Nov 13 2024 16:57:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: COMPlus Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

COMPlus Class Reference

This class is designed to be packaged with a COM DLL output format. More...

List of all members.

Public Member Functions

void | Activate ()
boolean | CanBePooled ()
void | Deactivate ()
void | Method1 ()
void | Method1 ()

Detailed Description

The class has no standard entry points, other than the constructor. Public methods will be exposed as methods on the default COM interface. .register ( clsid=GUID1%, typelib=GUID2% )

Definition at line 7 of file COMPlus.java.

Member Function Documentation

void COMPlus::Activate ( void ) [inline]

Definition at line 37 of file op.java.

  {
  }

boolean COMPlus::CanBePooled ( void ) [inline]

Definition at line 45 of file op.java.

  {
    return true;
  }

void COMPlus::Deactivate ( void ) [inline]

Definition at line 41 of file op.java.

  {
  }

void COMPlus::Method1 ( ) [inline]

Definition at line 14 of file COMPlus.java.

  {
    boolean bSuccess = false;
    try {
      // TODO: Add your method code here.  If successful, set bSuccess
        // to true
      bSuccess = true;
      return;
    }

    // Most methods in COM+ objects should call setComplete if successful,
    // or setAbort if not. This causes this object to be deactivated and
    // lose state after the return of this function.  See the COM+
    // documentation for more information.
    finally {
      if (bSuccess)
        Context.setComplete();
      else
        Context.setAbort();
    }
  }

void COMPlus::Method1 ( ) [inline]

Definition at line 14 of file op.java.

  {
    boolean bSuccess = false;
    try {
      // TODO: Add your method code here.  If successful, set bSuccess
        // to true
      bSuccess = true;
      return;
    }

    // Most methods in COM+ objects should call setComplete if successful,
    // or setAbort if not. This causes this object to be deactivated and
    // lose state after the return of this function.  See the COM+
    // documentation for more information.
    finally {
      if (bSuccess)
        Context.setComplete();
      else
        Context.setAbort();
    }
  }

The documentation for this class was generated from the following files:
  • Com/Tools/COMPlusWizard/VJ/COMPlus.java
  • Com/Tools/COMPlusWizard/VJ/op.java
Generated on Wed Nov 13 2024 16:57:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: COMSPYAUDITLib::ComSpyAudit Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • COMSPYAUDITLib
  • COMSPYAUDITLib::ComSpyAudit

COMSPYAUDITLib::ComSpyAudit Class Reference

import "comspyaudit.idl";

Detailed Description

Definition at line 658 of file comspyaudit.idl.

The documentation for this class was generated from the following file:
  • Com/Administration/Spy/idl/comspyaudit.idl
Generated on Wed Nov 13 2024 16:58:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: COMSPYCTLLib::ComSpy Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • COMSPYCTLLib
  • COMSPYCTLLib::ComSpy

COMSPYCTLLib::ComSpy Class Reference

import "comspyctl.idl";

Detailed Description

Definition at line 119 of file comspyctl.idl.

The documentation for this class was generated from the following file:
  • Com/Administration/Spy/idl/comspyctl.idl
Generated on Wed Nov 13 2024 16:58:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: COMSPYCTLLib::ComSpyPropPage Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • COMSPYCTLLib
  • COMSPYCTLLib::ComSpyPropPage

COMSPYCTLLib::ComSpyPropPage Class Reference

import "comspyctl.idl";

Detailed Description

Definition at line 129 of file comspyctl.idl.

The documentation for this class was generated from the following file:
  • Com/Administration/Spy/idl/comspyctl.idl
Generated on Wed Nov 13 2024 16:58:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Conf Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

Conf Class Reference

#include "nmsession.h"

List of all members.

Public Member Functions

Conf (HWND)
virtual | ~Conf ()
HRESULT | AcceptCall ()
HRESULT | Call (CPluggableTransport *pPlugTrans)
HRESULT | CallAccepted ()
HRESULT | CallCreated (INmCall *pCall)
HRESULT | CallRejected ()
HRESULT | ConferenceCreated (INmConference *)
INmManager * | GetNmManager ()
HRESULT | HangUp ()
BOOL InCall ()
HRESULT | Initialize (void)
HRESULT | RejectCall ()
HRESULT | RemoteHungup ()
HRESULT | Uninitialize (void)

Private Attributes

BOOL m_bInCall
HWND | m_hWnd
CCallNotify * m_pCallNotify
CConfNotify * m_pConfNotify
INmCall * | m_pINmCall
INmConference * | m_pINmConf
INmManager * | m_pINmMgr
CMgrNotify * m_pMgrNotify

Detailed Description

Definition at line 137 of file nmsession.h.

Constructor & Destructor Documentation

Conf::Conf ( HWND hWnd )

Definition at line 45 of file nmsession.cpp.

{
    m_pMgrNotify    = NULL;
    m_pCallNotify   = NULL;
    m_pConfNotify   = NULL;

    m_pINmMgr       = NULL;
    m_pINmConf      = NULL;
    m_pINmCall      = NULL;
    m_bInCall       = FALSE;

    // Get the handler to the application window
    m_hWnd = hWnd;
}

Conf::~Conf ( ) [virtual]

Definition at line 73 of file nmsession.cpp.

{
    // Assert that everything has been tidied up - i.e. Uninitialize was called
    //
    ASSERT(m_pMgrNotify == NULL);
    ASSERT(m_pCallNotify == NULL);
    ASSERT(m_pConfNotify == NULL);
    ASSERT(m_pINmMgr == NULL);
    ASSERT(m_pINmConf == NULL);
    ASSERT(m_pINmCall == NULL);

}

Member Function Documentation

HRESULT Conf::AcceptCall ( )

Definition at line 381 of file nmsession.cpp.

{
    if (m_pINmCall == NULL)
    {
        return HRESULT_FROM_WIN32(ERROR_NOT_READY);
    }

    return m_pINmCall->Accept();
}

HRESULT Conf::Call ( CPluggableTransport * pPlugTrans )

Definition at line 205 of file nmsession.cpp.

{
    HRESULT hr          = S_OK;
    BSTR    bstrName    = NULL;

    if (NULL == pPlugTrans)
        return E_FAIL;

    if (NULL == m_pINmMgr)
        return E_FAIL;

    if (FALSE == pPlugTrans->InConnection())
        return E_FAIL;

    // get the BSTR form of the connection ID
    bstrName = LPSTR2BSTR(pPlugTrans->GetConnectionID());
    if (NULL == bstrName)
        return E_OUTOFMEMORY;

    // make the call
    hr = m_pINmMgr->CreateCall(&m_pINmCall, NM_CALL_DEFAULT, NM_ADDR_T120_TRANSPORT, bstrName, NULL);
    if (FAILED(hr))
    {
        // Call object sometimes needs to be released.
        if (NULL != m_pINmCall)
        {
            m_pCallNotify->Disconnect();
            m_pINmCall->Release();
            m_pINmCall = NULL;
        }
    }

    SysFreeString(bstrName);
    return S_OK;
}

HRESULT Conf::CallAccepted ( )

Definition at line 479 of file nmsession.cpp.

{
    HRESULT hr = S_OK;

    // Release INmCall, and let send window message that a user has connected
    if (NULL != m_pINmCall)
    {
        m_pINmCall->Release();
        m_pINmCall=NULL;
    }

    if (m_pCallNotify != NULL)
    {
        hr = m_pCallNotify->Disconnect();
        if (FAILED(hr))
        {
            MessageBox(NULL,TEXT("m_pCallNotify->Disconnect failed."),TEXT("Error"),MB_OK);
        }
    }

    m_bInCall = true;

    return S_OK;
}

HRESULT Conf::CallCreated ( INmCall * pCall )

Definition at line 331 of file nmsession.cpp.

{
    HRESULT hr  = S_OK;

    if (NULL == pCall)
    {
        return E_POINTER;
    }

    ASSERT(m_pINmCall == NULL);
    if (m_pINmCall != NULL)
    {
        MessageBox(NULL,TEXT("m_pINmCall is not NULL, and we have a new call!"),TEXT("Error"),MB_OK);
        m_pINmCall->Release();
    }

    m_pINmCall = pCall;
    m_pINmCall->AddRef();

    if (NULL != m_pCallNotify)
    {
        hr = m_pCallNotify->Connect(pCall);
        if (FAILED(hr))
        {
            MessageBox(NULL,TEXT("m_pCallNotify->Connect failed."),TEXT("Error"),MB_OK);
            return hr;
        }
    }

    m_bInCall = true;

    // update the UI
    if (m_hWnd)
        SendMessage(m_hWnd,WM_CONNECTING,0,0);

    return S_OK;
}

HRESULT Conf::CallRejected ( )

Definition at line 517 of file nmsession.cpp.

{
    HRESULT hr = S_OK;
    // Release INmCall, INmConf, disconnect CallNotify and ConfNotify
    // sink objects, and send message to main window that the user has
    // disconnected.
    if (NULL != m_pINmCall)
    {
        if (NULL != m_pCallNotify)
        {
            hr = m_pCallNotify->Disconnect();
            if (FAILED(hr))
            {
                MessageBox(NULL,TEXT("m_pCallNotify->Disconnect failed."),TEXT("Error"),MB_OK);
            }
        }

        m_pINmCall->Release();
        m_pINmCall=NULL;
    }

    if (NULL != m_pINmConf)
    {
        m_pINmConf->Release();
        m_pINmConf=NULL;
    }

    if (NULL != m_pConfNotify)
    {
        hr = m_pConfNotify->Disconnect();
        if (FAILED(hr))
        {
            MessageBox(NULL,TEXT("m_pConfNotify->Disconnect failed."),TEXT("Error"),MB_OK);
        }
    }

    m_bInCall = false;

    if (m_hWnd)
        SendMessage(m_hWnd,WM_DISCONNECTED,0,0);

    return S_OK;
}

HRESULT Conf::ConferenceCreated ( INmConference * pINmConf )

Definition at line 426 of file nmsession.cpp.

{
    HRESULT hr = S_OK;

    if (pINmConf == NULL)
    {
        return E_POINTER;
    }

    ASSERT(m_pINmConf == NULL);
    if (m_pINmConf != NULL)
    {
        MessageBox(NULL,TEXT("m_pINmConf is not NULL, and we have a new conf!"),TEXT("Error"),MB_OK);
        m_pINmConf->Release();
    }

    //Add Conference notification sink to handle channels.
    m_pINmConf = pINmConf;
    m_pINmConf->AddRef();

    if (m_pConfNotify != NULL)
    {
        hr = m_pConfNotify->Connect(pINmConf);
        if (FAILED(hr))
        {
            MessageBox(NULL,TEXT("m_pConfNotify->Connect failed."),TEXT("Error"),MB_OK);
            return hr;
        }
    }

    m_bInCall = true;

    if (m_hWnd)
    {
        SendMessage(m_hWnd,WM_CONNECTED,0,0);
    }

    return S_OK;
}

INmManager * Conf::GetNmManager ( )

Definition at line 636 of file nmsession.cpp.

{
    return m_pINmMgr;
}

HRESULT Conf::HangUp ( )

Definition at line 253 of file nmsession.cpp.

{
    HRESULT hr = S_OK;

    // if call hungup before Call accepted or rejected, release INmCall and
    // disconnect CallNotify sink
    if (NULL != m_pINmCall)
    {
        hr = m_pINmCall->Cancel();
        if (FAILED(hr))
        {
            MessageBox(NULL,TEXT("m_pINmCall->Cancel failed."),TEXT("Error"),MB_OK);
        }

        if (NULL != m_pCallNotify)
        {
            hr = m_pCallNotify->Disconnect();
            if (FAILED(hr))
            {
                MessageBox(NULL,TEXT("m_pCallNotify->Disconnect failed."),TEXT("Error"),MB_OK);
            }
        }

        m_pINmCall->Release();
        m_pINmCall=NULL;
    }
    else
    {
        if (NULL != m_pINmConf)
        {
            hr = m_pINmConf->Leave();
            if (FAILED(hr))
            {
                MessageBox(NULL,TEXT("m_pINmConf->Leave failed."),TEXT("Error"),MB_OK);
            }
        }
    }

    // Release INmConf and disconnect the ConfNotify sink
    if (NULL != m_pINmConf)
    {
        if (NULL != m_pConfNotify)
        {
            hr = m_pConfNotify->Disconnect();
            if (FAILED(hr))
            {
                MessageBox(NULL,TEXT("m_pConfNotify->Disconnect failed."),TEXT("Error"),MB_OK);
            }
        }

        m_pINmConf->Release();
        m_pINmConf=NULL;
    }

    m_bInCall = false;

    // update the UI
    if (m_hWnd)
    {
        SendMessage(m_hWnd,WM_DISCONNECTED,0,0);
    }

    return hr;
}

BOOL Conf::InCall ( )

Definition at line 618 of file nmsession.cpp.

{
    return m_bInCall;
}

HRESULT Conf::Initialize ( void )

Definition at line 99 of file nmsession.cpp.

{
    HRESULT hr          = S_OK;
    ULONG   uOptions    = NM_INIT_CONTROL;                  // Don't display the NetMeeting UI
    ULONG   uCaps       = NMCH_DATA | NMCH_FT | NMCH_SHARE; // data only conference

    // Create Sink Objects.
    // During construction, AddRef occurs
    m_pMgrNotify = new CMgrNotify(this);
    if (m_pMgrNotify == NULL)
    {
        return E_OUTOFMEMORY;
    }

    m_pCallNotify = new CCallNotify(this);
    if (m_pCallNotify == NULL)
    {
        return E_OUTOFMEMORY;
    }

    m_pConfNotify = new CConfNotify(this);
    if (m_pConfNotify == NULL)
    {
        return E_OUTOFMEMORY;
    }

    hr = CoCreateInstance(CLSID_NmManager,NULL,CLSCTX_INPROC_SERVER,IID_INmManager,(VOID **)&m_pINmMgr);
    if (FAILED(hr))
    {
        return hr;
    }

    hr = m_pMgrNotify->Connect(m_pINmMgr);
    if (FAILED(hr))
    {
        return hr;
    }

    hr = m_pINmMgr->Initialize(&uOptions,&uCaps);
    if (FAILED(hr))
    {
        return hr;
    }

    return hr;
}

HRESULT Conf::RejectCall ( )

Definition at line 403 of file nmsession.cpp.

{
    if (m_pINmCall == NULL)
    {
        return HRESULT_FROM_WIN32(ERROR_NOT_READY);
    }

    return m_pINmCall->Reject();
}

HRESULT Conf::RemoteHungup ( )

Definition at line 575 of file nmsession.cpp.

{
    HRESULT hr = S_OK;

    // Release INmConf, disconnect ConfNotify sink object, and send message to
    // main window that the remote node has disconnected.
    if (NULL != m_pINmConf)
    {
        m_pINmConf->Release();
        m_pINmConf = NULL;
    }

    if (NULL != m_pConfNotify)
    {
        hr = m_pConfNotify->Disconnect();
        if (FAILED(hr))
        {
            MessageBox(NULL,TEXT("m_pConfNotify->Disconnect failed."),TEXT("Error"),MB_OK);
        }
    }

    m_bInCall = false;

    if (m_hWnd)
    {
        SendMessage(m_hWnd,WM_DISCONNECTED,0,0);
    }

    return S_OK;
}

HRESULT Conf::Uninitialize ( void )

Definition at line 161 of file nmsession.cpp.

{
    if (NULL != m_pMgrNotify)
        m_pMgrNotify->Disconnect();

    if (NULL != m_pINmMgr)
    {
        m_pINmMgr->Release();
        m_pINmMgr = NULL;
    }

    if (m_pMgrNotify != NULL)
    {
        m_pMgrNotify->Release();
        m_pMgrNotify = NULL;
    }

    if (m_pCallNotify != NULL)
    {
        m_pCallNotify->Release();
        m_pCallNotify = NULL;
    }

    if (m_pConfNotify != NULL)
    {
        m_pConfNotify->Release();
        m_pConfNotify = NULL;
    }

    return S_OK;
}

Member Data Documentation

BOOL Conf::m_bInCall [private]

Definition at line 147 of file nmsession.h.

HWND Conf::m_hWnd [private]

Definition at line 146 of file nmsession.h.

CCallNotify* Conf::m_pCallNotify [private]

Definition at line 141 of file nmsession.h.

CConfNotify* Conf::m_pConfNotify [private]

Definition at line 142 of file nmsession.h.

INmCall* Conf::m_pINmCall [private]

Definition at line 145 of file nmsession.h.

INmConference* Conf::m_pINmConf [private]

Definition at line 143 of file nmsession.h.

INmManager* Conf::m_pINmMgr [private]

Definition at line 144 of file nmsession.h.

CMgrNotify* Conf::m_pMgrNotify [private]

Definition at line 140 of file nmsession.h.

The documentation for this class was generated from the following files:
  • Web/NetMeeting/PlugTransport/nmsession.h
  • Web/NetMeeting/PlugTransport/nmsession.cpp
Generated on Wed Nov 13 2024 16:57:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CONotify Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CONotify Class Reference

#include "Notify.h"

List of all members.

Public Member Functions

CONotify ()
CONotify ()
STDMETHOD() | LineItem (long lItemId, long lQuantity, ShipStatus shipStatus)
STDMETHOD() | LineItem (long lItemId, long lQuantity, ShipStatus shipStatus)
STDMETHOD() | Process (long lFlags)
STDMETHOD() | Process (long lFlags)
STDMETHOD() | put_CustomerId (long lCustomerId)
STDMETHOD() | put_CustomerId (long lCustomerId)
STDMETHOD() | put_OrderId (long lOrderId)
STDMETHOD() | put_OrderId (long lOrderId)

Private Attributes

long | m_lCustomerId
long | m_lOrderId
std::vector< long > | m_veclItemId
std::vector< long > | m_veclQuantity
std::vector< ShipStatus > | m_vecShipStatus

Detailed Description

Definition at line 36 of file Notify.h.

Constructor & Destructor Documentation

CONotify::CONotify ( ) [inline]

Definition at line 42 of file Notify.h.

             : m_lCustomerId(0), m_lOrderId(0)  // ctor
  {
  }

CONotify::CONotify ( ) [inline]

Definition at line 35 of file Notify.h.

             : m_lCustomerId(0), m_lOrderId(0)  // ctor
  {
  }

Member Function Documentation

STDMETHODIMP CONotify::LineItem | ( | long | lItemId,
 |  | long | lQuantity,
 |  | ShipStatus | shipStatus
 | ) |  |

Definition at line 74 of file Notify.Cpp.

{
  _ASSERTE(shipStatus >= ssShipped && shipStatus <= ssUnrecognizedItem);

  m_veclItemId.push_back(lItemId);
  m_veclQuantity.push_back(lQuantity);
  m_vecShipStatus.push_back(shipStatus);
  return S_OK;
}

STDMETHOD() CONotify::LineItem | ( | long | lItemId,
 |  | long | lQuantity,
 |  | ShipStatus | shipStatus
 | ) |  |
STDMETHODIMP CONotify::Process ( long lFlags )

Definition at line 93 of file Notify.Cpp.

{
  HRESULT hr = S_OK;

  _RPT1(_CRT_WARN, "QCSamp1 %d Notify\n", m_lOrderId);

  if (lFlags & processFlagWriteDB)
  {
    CComPtr<ADOConnection> pADOConnection;

    hr = CoCreateInstance(  CLSID_CADOConnection, NULL, CLSCTX_INPROC_SERVER,
                IID_IADOConnection, (void **) &pADOConnection);
    if (SUCCEEDED(hr))
    {
      // Constants for Data Source Names, userid, password are in DataSourceName.h

      hr = pADOConnection->Open(  _bstr_t(pszOrderDSN), _bstr_t(pszUserId),
                    _bstr_t(pszPassword), adOpenUnspecified);

      TCHAR szSQLStmt[512];

      // The elements in this array correspond to the ShipStatus enumeration
      LPCTSTR const apszShipStatus[] =
      {
        _T("Not yet processed"),
        _T("Shipped"),
        _T("Back Ordered"),
        _T("Not Stocked"),
        _T("Unrecognized Item ID")
      };

      LPCTSTR const pszPrototypeSQLStmt =
        _T("update QCSampleOrder set ship_status = \'%s\' ")
        _T(" where order_id = %ld ")
        _T("   and cust_id  = %ld ")
        _T("   and line_no  = %ld ")
        _T("   and item_id  = %ld ")
        _T("   and quantity = %ld ");

      for (int ix = 0; ix < m_veclItemId.size() && SUCCEEDED(hr); ix++)
      {
        wsprintf( szSQLStmt,
              pszPrototypeSQLStmt,
              apszShipStatus[m_vecShipStatus[ix]],
              m_lOrderId,
              m_lCustomerId,
              ix,
              m_veclItemId[ix],
              m_veclQuantity[ix]);

        hr = pADOConnection->Execute(_bstr_t(szSQLStmt), NULL, adCmdText, NULL);
      }
    }
  }
  // Invoke SetComplete or SetAbort depending on our success

  CComPtr<IObjectContext> pIObjectContext;

  if (SUCCEEDED(CoGetObjectContext(IID_IObjectContext, (void**)&pIObjectContext)))
  {
    if (SUCCEEDED(hr))  pIObjectContext->SetComplete();
    else        pIObjectContext->SetAbort();
  }

  return hr;
}

STDMETHOD() CONotify::Process ( long lFlags )
STDMETHODIMP CONotify::put_CustomerId ( long lCustomerId )

Definition at line 44 of file Notify.Cpp.

{
  m_lCustomerId = lCustomerId;
  return S_OK;
}

STDMETHOD() CONotify::put_CustomerId ( long lCustomerId )
STDMETHODIMP CONotify::put_OrderId ( long lOrderId )

Definition at line 58 of file Notify.Cpp.

{
  m_lOrderId = lOrderId;
  return S_OK;
}

STDMETHOD() CONotify::put_OrderId ( long lOrderId )

Member Data Documentation

long CONotify::m_lCustomerId [private]

Definition at line 61 of file Notify.h.

long CONotify::m_lOrderId [private]

Definition at line 62 of file Notify.h.

std::vector< long > CONotify::m_veclItemId [private]

Definition at line 63 of file Notify.h.

std::vector< long > CONotify::m_veclQuantity [private]

Definition at line 64 of file Notify.h.

std::vector< ShipStatus > CONotify::m_vecShipStatus [private]

Definition at line 65 of file Notify.h.

The documentation for this class was generated from the following files:
  • Com/Services/Queued_Components/QCSamp1/QCNotify/Notify.h
  • Com/Services/Queued_Components/QCSamp2/QCNotify/Notify.h
  • Com/Services/Queued_Components/QCSamp1/QCNotify/Notify.Cpp
  • Com/Services/Queued_Components/QCSamp2/QCNotify/Notify.Cpp
Generated on Wed Nov 13 2024 16:57:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CONST_DWORD_REP Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

CONST_DWORD_REP Struct Reference

#include "stdafx.h"

List of all members.

Public Attributes

DWORD dwConstant
LPCSTR pstrRep

Detailed Description

Definition at line 50 of file stdafx.h.

Member Data Documentation

DWORD CONST_DWORD_REP::dwConstant

Definition at line 52 of file stdafx.h.

LPCSTR CONST_DWORD_REP::pstrRep

Definition at line 53 of file stdafx.h.

The documentation for this struct was generated from the following file:
  • Multimedia/Audio/multichan/stdafx.h
Generated on Wed Nov 13 2024 16:57:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CONST_GUID_REP Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

CONST_GUID_REP Struct Reference

#include "stdafx.h"

List of all members.

Public Attributes

const GUID * | pguidConstant
LPCSTR | pstrRep

Detailed Description

Definition at line 43 of file stdafx.h.

Member Data Documentation

const GUID* CONST_GUID_REP::pguidConstant

Definition at line 45 of file stdafx.h.

LPCSTR CONST_GUID_REP::pstrRep

Definition at line 46 of file stdafx.h.

The documentation for this struct was generated from the following file:
  • Multimedia/Audio/multichan/stdafx.h
Generated on Wed Nov 13 2024 16:57:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CONST_WORD_REP Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

CONST_WORD_REP Struct Reference

#include "stdafx.h"

List of all members.

Public Attributes

LPCSTR | szRep
WORD | wTag

Detailed Description

Definition at line 57 of file stdafx.h.

Member Data Documentation

LPCSTR CONST_WORD_REP::szRep

Definition at line 60 of file stdafx.h.

WORD CONST_WORD_REP::wTag

Definition at line 59 of file stdafx.h.

The documentation for this struct was generated from the following file:
  • Multimedia/Audio/multichan/stdafx.h
Generated on Wed Nov 13 2024 16:57:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ContextNameHint Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

ContextNameHint Struct Reference

#include "ContextPlugin.h"

List of all members.

Public Attributes

long | lContextHint
LPCWSTR | wstrContextName

Detailed Description

Definition at line 17 of file ContextPlugin.h.

Member Data Documentation

long ContextNameHint::lContextHint

Definition at line 20 of file ContextPlugin.h.

LPCWSTR ContextNameHint::wstrContextName

Definition at line 19 of file ContextPlugin.h.

The documentation for this struct was generated from the following file:
  • Multimedia/WindowsMediaServices9/EventNotification/ContextPlugin.h
Generated on Wed Nov 13 2024 16:57:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CONTEXTSAMPLEPROPPAGELib::ContextSamplePropPage Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • CONTEXTSAMPLEPROPPAGELib
  • CONTEXTSAMPLEPROPPAGELib::ContextSamplePropPage

CONTEXTSAMPLEPROPPAGELib::ContextSamplePropPage Class Reference

import "ContextSamplePropPage.idl";

Detailed Description

Definition at line 50 of file ContextSamplePropPage.idl.

The documentation for this class was generated from the following file:
  • Multimedia/WindowsMediaServices9/EventNotification/ContextSamplePropPage/ContextSamplePropPage.idl
Generated on Wed Nov 13 2024 16:58:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: COpenQueueDialog Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions

COpenQueueDialog Class Reference

#include "OpenQDlg.h"

List of all members.

Public Types

enum | { IDD = IDD_OPEN_QUEUE_DIALOG }

Public Member Functions

COpenQueueDialog (CArray< ARRAYQ *, ARRAYQ * > *, CWnd *pParent=NULL)
DWORD GetAccess ()
void | GetFormatName (TCHAR szFormatName[BUFFERSIZE])
void | GetPathName (TCHAR szPathName[BUFFERSIZE])

Public Attributes

CComboBox | m_FormatNameCB
int | m_iAccessRight
CComboBox | m_PathNameCB
CArray< ARRAYQ *, ARRAYQ * > * | m_pStrArray
CString m_szFormatName
CString m_szPathName

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
afx_msg void | OnEditupdateFormatnameCombo2 ()
afx_msg void | OnEditupdatePathnameCombo ()
virtual BOOL | OnInitDialog ()
afx_msg void | OnSelchangeFormatnameCombo2 ()
afx_msg void | OnSelchangePathnameCombo ()

Detailed Description

Definition at line 22 of file OpenQDlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 30 of file OpenQDlg.h.

{ IDD = IDD_OPEN_QUEUE_DIALOG };

Constructor & Destructor Documentation

COpenQueueDialog::COpenQueueDialog | ( | CArray< ARRAYQ *, ARRAYQ * > * | pStrArray,
 |  | CWnd * | pParent = NULL
 | ) |  |

Definition at line 32 of file OpenQDlg.Cpp.

  : CDialog(COpenQueueDialog::IDD, pParent)
{
  m_pStrArray = pStrArray;

  //{{AFX_DATA_INIT(COpenQueueDialog)
  m_szPathName = _T("");
  m_szFormatName = _T("");
  m_iAccessRight = 0;
  //}}AFX_DATA_INIT
}

Member Function Documentation

void COpenQueueDialog::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 45 of file OpenQDlg.Cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(COpenQueueDialog)
  DDX_Control(pDX, IDC_FORMATNAME_COMBO2, m_FormatNameCB);
  DDX_Control(pDX, IDC_PATHNAME_COMBO, m_PathNameCB);
  DDX_CBString(pDX, IDC_PATHNAME_COMBO, m_szPathName);
  DDV_MaxChars(pDX, m_szPathName, 128);
  DDX_CBString(pDX, IDC_FORMATNAME_COMBO2, m_szFormatName);
  DDV_MaxChars(pDX, m_szFormatName, 4000);
  DDX_Radio(pDX, IDC_RADIO1, m_iAccessRight);
  //}}AFX_DATA_MAP
}

DWORD COpenQueueDialog::GetAccess ( ) [inline]

Definition at line 77 of file OpenQDlg.h.

  {
    switch (m_iAccessRight)
    {
      case 0:
        return MQ_SEND_ACCESS;
        break;
      case 1:
        return MQ_RECEIVE_ACCESS;
        break;
      case 2:
        return MQ_PEEK_ACCESS;
        break;
      default:
        return 0;
        break;
    }
  }

void COpenQueueDialog::GetFormatName ( TCHAR szFormatName[BUFFERSIZE] )
void COpenQueueDialog::GetPathName ( TCHAR szPathName[BUFFERSIZE] ) [inline]

Definition at line 68 of file OpenQDlg.h.

  {
    ASSERT(szPathName != NULL);

    _tcsncpy (szPathName, m_szPathName, BUFFERSIZE-1);
    szPathName[BUFFERSIZE-1] = '\0';

  }

void COpenQueueDialog::OnEditupdateFormatnameCombo2 ( ) [protected]

Definition at line 114 of file OpenQDlg.Cpp.

{
  m_PathNameCB.SetCurSel(OPENQDLG_CLEAR_COMBOBOX);
}

void COpenQueueDialog::OnEditupdatePathnameCombo ( ) [protected]

Definition at line 121 of file OpenQDlg.Cpp.

{
  m_FormatNameCB.SetCurSel(OPENQDLG_CLEAR_COMBOBOX);
}

BOOL COpenQueueDialog::OnInitDialog ( ) [protected, virtual]

Definition at line 72 of file OpenQDlg.Cpp.

{
  CDialog::OnInitDialog();

  // TODO: Add extra initialization here

  int i;
  for  (i=0 ; i<m_pStrArray->GetSize() ; i++)
  {
    VERIFY (m_PathNameCB.AddString((*m_pStrArray)[i]->szPathName) != CB_ERR);
    VERIFY (m_FormatNameCB.AddString((*m_pStrArray)[i]->szFormatName) != CB_ERR);

  }

    if (m_PathNameCB.GetCount() > 0) m_PathNameCB.SetCurSel(0);
    if (m_FormatNameCB.GetCount() > 0) m_FormatNameCB.SetCurSel(0);

    return TRUE;  // return TRUE unless you set the focus to a control
                // EXCEPTION: OCX Property Pages should return FALSE
}

void COpenQueueDialog::OnSelchangeFormatnameCombo2 ( ) [protected]

Definition at line 108 of file OpenQDlg.Cpp.

{
  m_PathNameCB.SetCurSel(m_FormatNameCB.GetCurSel());
}

void COpenQueueDialog::OnSelchangePathnameCombo ( ) [protected]

Definition at line 103 of file OpenQDlg.Cpp.

{
  m_FormatNameCB.SetCurSel(m_PathNameCB.GetCurSel());
}

Member Data Documentation

CComboBox COpenQueueDialog::m_FormatNameCB

Definition at line 31 of file OpenQDlg.h.

int COpenQueueDialog::m_iAccessRight

Definition at line 35 of file OpenQDlg.h.

CComboBox COpenQueueDialog::m_PathNameCB

Definition at line 32 of file OpenQDlg.h.

CArray<ARRAYQ*, ARRAYQ*>* COpenQueueDialog::m_pStrArray

Definition at line 39 of file OpenQDlg.h.

CString COpenQueueDialog::m_szFormatName

Definition at line 34 of file OpenQDlg.h.

CString COpenQueueDialog::m_szPathName

Definition at line 33 of file OpenQDlg.h.

The documentation for this class was generated from the following files:
  • NetDS/MessageQueuing/MqApiTst/OpenQDlg.h
  • NetDS/MessageQueuing/MqApiTst/OpenQDlg.Cpp
Generated on Wed Nov 13 2024 16:57:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: COptionsAccessor Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

COptionsAccessor Class Reference

#include "coptions.h"

Inherits CPropPageLite.

List of all members.

Public Member Functions

COptionsAccessor ()
virtual BOOL | OnApply ()
virtual BOOL | OnInitDialog ()

Protected Attributes

CComboBoxLite m_comboBindingTypes

Detailed Description

Definition at line 129 of file coptions.h.

Constructor & Destructor Documentation

COptionsAccessor::COptionsAccessor ( )

Definition at line 322 of file coptions.cpp.

  : CPropPageLite(IDD_OPTIONS_ACCESSOR, "Accessor")
{
}

Member Function Documentation

BOOL COptionsAccessor::OnApply ( ) [virtual]

Reimplemented from CPropPageLite.

Definition at line 394 of file coptions.cpp.

{
  //PropertySheet (BackPointer)
  COptionsSheet* pCOptionsSheet = (COptionsSheet*)GetParent();

  //BindingType
  DBTYPE wBindingType = (DBTYPE)m_comboBindingTypes.GetItemParam(m_comboBindingTypes.GetCurSel());
  if(wBindingType == CB_ERR)
    wBindingType = DBTYPE_WSTR;

  //MODIFIERS (BYREF, ARRAY, VECTOR)
  if(IsDlgButtonChecked(IDB_TO_BYREF))
    wBindingType |= DBTYPE_BYREF;
  if(IsDlgButtonChecked(IDB_TO_ARRAY))
    wBindingType |= DBTYPE_ARRAY;
  if(IsDlgButtonChecked(IDB_TO_VECTOR))
    wBindingType |= DBTYPE_VECTOR;
  pCOptionsSheet->SetBindingType(wBindingType);

  //DBPART
  pCOptionsSheet->m_dwAccessorOpts &= ~(ACCESSOR_BIND_VALUE | ACCESSOR_BIND_LENGTH | ACCESSOR_BIND_STATUS);
  if(IsDlgButtonChecked(IDB_BIND_VALUE))
    pCOptionsSheet->m_dwAccessorOpts |= ACCESSOR_BIND_VALUE;
  if(IsDlgButtonChecked(IDB_BIND_LENGTH))
    pCOptionsSheet->m_dwAccessorOpts |= ACCESSOR_BIND_LENGTH;
  if(IsDlgButtonChecked(IDB_BIND_STATUS))
    pCOptionsSheet->m_dwAccessorOpts |= ACCESSOR_BIND_STATUS;

  //DBMEMOWNER
  ENABLE_BIT(pCOptionsSheet->m_dwAccessorOpts, ACCESSOR_OWNED_PROVIDER, IsDlgButtonChecked(IDB_OWNED_PROVIDER));

  //MaxLength
  if(!GetEditBoxValue(GetDlgItem(IDE_MAXLENGTH), (LONG*)&pCOptionsSheet->m_dwMaxLength, 0/*Min*/))
  {
    pCOptionsSheet->m_dwMaxLength = MAX_COL_SIZE;
    return FALSE;
  }

  //BLOB Binding Type
  ENABLE_BIT(pCOptionsSheet->m_dwAccessorOpts, ACCESSOR_BLOB_ISEQSTREAM,  IsDlgButtonChecked(IDB_BLOB_ISEQSTREAM));
  ENABLE_BIT(pCOptionsSheet->m_dwAccessorOpts, ACCESSOR_BLOB_ILOCKBYTES,  IsDlgButtonChecked(IDB_BLOB_ILOCKBYTES));
  ENABLE_BIT(pCOptionsSheet->m_dwAccessorOpts, ACCESSOR_BLOB_ISTORAGE,  IsDlgButtonChecked(IDB_BLOB_ISTORAGE));
  ENABLE_BIT(pCOptionsSheet->m_dwAccessorOpts, ACCESSOR_BLOB_ISTREAM,   IsDlgButtonChecked(IDB_BLOB_ISTREAM));

  //Bookmark Column
  ENABLE_BIT(pCOptionsSheet->m_dwAccessorOpts, ACCESSOR_BIND_BOOKMARK,  IsDlgButtonChecked(IDB_BIND_BOOKMARK));

  //delegate
  return CPropPageLite::OnApply();
}

BOOL COptionsAccessor::OnInitDialog ( ) [virtual]

Reimplemented from CDialogLite.

Definition at line 332 of file coptions.cpp.

{
  CWaitCursor waitCursor;

  //PropertySheet (BackPointer)
  COptionsSheet* pCOptionsSheet = (COptionsSheet*)GetParent();

  //Populate Binding Type Combo
  m_comboBindingTypes.CreateIndirect(m_hWnd, IDC_BINDINGTYPE);

  //Add the Native Binding Type
  m_comboBindingTypes.AddString(L"Native Type", DBTYPE_UDT);

  //Add all the others
  for(ULONG i=0; i<g_cDBTypes; i++)
    m_comboBindingTypes.AddString(g_rgDBTypes[i].pwszName, g_rgDBTypes[i].lItem);

  //Select the Default Type...
  DBTYPE wBindingType = pCOptionsSheet->GetBindingType();
  DBTYPE wBaseType = wBindingType & ~(DBTYPE_BYREF | DBTYPE_ARRAY | DBTYPE_VECTOR | DBTYPE_RESERVED);
  m_comboBindingTypes.SetSelValue(wBaseType);

  //MODIFIERS (BYREF, ARRAY, VECTOR)
  CheckDlgButton(IDB_TO_BYREF,  BST2STATE(wBindingType & DBTYPE_BYREF));
  CheckDlgButton(IDB_TO_ARRAY,  BST2STATE(wBindingType & DBTYPE_ARRAY));
  CheckDlgButton(IDB_TO_VECTOR, BST2STATE(wBindingType & DBTYPE_VECTOR));

  //DBPART
  CheckDlgButton(IDB_BIND_VALUE,  BST2STATE(pCOptionsSheet->m_dwAccessorOpts & ACCESSOR_BIND_VALUE));
  CheckDlgButton(IDB_BIND_LENGTH, BST2STATE(pCOptionsSheet->m_dwAccessorOpts & ACCESSOR_BIND_LENGTH));
  CheckDlgButton(IDB_BIND_STATUS, BST2STATE(pCOptionsSheet->m_dwAccessorOpts & ACCESSOR_BIND_STATUS));

  //DBMEMOWNER
  CheckDlgButton(IDB_OWNED_PROVIDER,  BST2STATE(pCOptionsSheet->m_dwAccessorOpts & ACCESSOR_OWNED_PROVIDER));

  //MaxLength
  wSendMessageFmt(GetDlgItem(IDE_MAXLENGTH), WM_SETTEXT, 0, L"%lu", pCOptionsSheet->m_dwMaxLength);

  //BLOB Binding Type
  if(pCOptionsSheet->m_dwAccessorOpts & ACCESSOR_BLOB_ISEQSTREAM)
    CheckDlgButton(IDB_BLOB_ISEQSTREAM, BST_CHECKED);
  else if(pCOptionsSheet->m_dwAccessorOpts & ACCESSOR_BLOB_ILOCKBYTES)
    CheckDlgButton(IDB_BLOB_ILOCKBYTES, BST_CHECKED);
  else if(pCOptionsSheet->m_dwAccessorOpts & ACCESSOR_BLOB_ISTORAGE)
    CheckDlgButton(IDB_BLOB_ISTORAGE, BST_CHECKED);
  else if(pCOptionsSheet->m_dwAccessorOpts & ACCESSOR_BLOB_ISTREAM)
    CheckDlgButton(IDB_BLOB_ISTREAM, BST_CHECKED);
  else
    CheckDlgButton(IDB_BLOB_INLINE, BST_CHECKED);

  //Bookmark Column
  CheckDlgButton(IDB_BIND_BOOKMARK, BST2STATE(pCOptionsSheet->m_dwAccessorOpts & ACCESSOR_BIND_BOOKMARK));

  //Delegate
  return CPropPageLite::OnInitDialog();
}

Member Data Documentation

CComboBoxLite COptionsAccessor::m_comboBindingTypes [protected]

Definition at line 140 of file coptions.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/coptions.h
  • Dataaccess/oledb/rowsetviewer/coptions.cpp
Generated on Wed Nov 13 2024 16:57:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: COptionsCommand Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

COptionsCommand Class Reference

#include "coptions.h"

Inherits CPropPageLite.

List of all members.

Public Member Functions

COptionsCommand ()
virtual BOOL | OnApply ()
virtual BOOL | OnInitDialog ()

Detailed Description

Definition at line 114 of file coptions.h.

Constructor & Destructor Documentation

COptionsCommand::COptionsCommand ( )

Definition at line 269 of file coptions.cpp.

  : CPropPageLite(IDD_OPTIONS_COMMAND, "Command")
{
}

Member Function Documentation

BOOL COptionsCommand::OnApply ( ) [virtual]

Reimplemented from CPropPageLite.

Definition at line 301 of file coptions.cpp.

{
  //PropertySheet (BackPointer)
  COptionsSheet* pCOptionsSheet = (COptionsSheet*)GetParent();

  //Display RowsAffected
  ENABLE_BIT(pCOptionsSheet->m_dwCommandOpts, COMMAND_ROWSAFFECTED, IsDlgButtonChecked(IDB_DISPLAY_ROWSAFFECTED));

  //Display ReleaseRowset
  ENABLE_BIT(pCOptionsSheet->m_dwCommandOpts, COMMAND_RELEASE_OPENOBJECTS, IsDlgButtonChecked(IDB_RELEASE_OPENOBJECTS));

  //delegate
  return CPropPageLite::OnApply();
}

BOOL COptionsCommand::OnInitDialog ( ) [virtual]

Reimplemented from CDialogLite.

Definition at line 279 of file coptions.cpp.

{
  CWaitCursor waitCursor;

  //PropertySheet (BackPointer)
  COptionsSheet* pCOptionsSheet = (COptionsSheet*)GetParent();

  //Display RowAffected
  CheckDlgButton(IDB_DISPLAY_ROWSAFFECTED,  BST2STATE(pCOptionsSheet->m_dwCommandOpts & COMMAND_ROWSAFFECTED));

  //Display ReleaseRowset
  CheckDlgButton(IDB_RELEASE_OPENOBJECTS,   BST2STATE(pCOptionsSheet->m_dwCommandOpts & COMMAND_RELEASE_OPENOBJECTS));

  //Delegate
  return CPropPageLite::OnInitDialog();
}

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/coptions.h
  • Dataaccess/oledb/rowsetviewer/coptions.cpp
Generated on Wed Nov 13 2024 16:57:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: COptionsDataSource Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

COptionsDataSource Class Reference

#include "coptions.h"

Inherits CPropPageLite.

List of all members.

Public Member Functions

COptionsDataSource ()
virtual BOOL | OnApply ()
virtual BOOL | OnCommand (UINT iID, HWND hWndCtrl)
virtual BOOL | OnInitDialog ()

Detailed Description

Definition at line 97 of file coptions.h.

Constructor & Destructor Documentation

COptionsDataSource::COptionsDataSource ( )

Definition at line 163 of file coptions.cpp.

  : CPropPageLite(IDD_FULLCONNECT_OPTIONS, "DataSource")
{
}

Member Function Documentation

BOOL COptionsDataSource::OnApply ( ) [virtual]

Reimplemented from CPropPageLite.

Definition at line 210 of file coptions.cpp.

{
  //PropertySheet (BackPointer)
  COptionsSheet* pCOptionsSheet = (COptionsSheet*)GetParent();

  //Obtain CLSCTX
  pCOptionsSheet->m_dwCLSCTX = 0;
  if(IsDlgButtonChecked(IDB_INPROC_SERVER))
    pCOptionsSheet->m_dwCLSCTX |= CLSCTX_INPROC_SERVER;
  if(IsDlgButtonChecked(IDB_LOCAL_SERVER))
    pCOptionsSheet->m_dwCLSCTX |= CLSCTX_LOCAL_SERVER;
  if(IsDlgButtonChecked(IDB_REMOTE_SERVER))
    pCOptionsSheet->m_dwCLSCTX |= CLSCTX_REMOTE_SERVER;
  if(IsDlgButtonChecked(IDB_INPROC_HANDLER))
    pCOptionsSheet->m_dwCLSCTX |= CLSCTX_INPROC_HANDLER;

  //Obtain RemoteServer
  wSendMessage(GetDlgItem(IDE_REMOTESERVER), WM_GETTEXT, MAX_NAME_LEN, pCOptionsSheet->m_wszRemoteServer);

  //Obtain Connection Options
  pCOptionsSheet->m_dwCreateOpts = 0;
  if(IsDlgButtonChecked(IDB_INIT_INITIALIZE))
    pCOptionsSheet->m_dwCreateOpts |= CREATE_INITIALIZE;
  if(IsDlgButtonChecked(IDB_INIT_SETPROPERTIES))
    pCOptionsSheet->m_dwCreateOpts |= CREATE_SETPROPERTIES;

  //AutoQI
  ENABLE_BIT(pCOptionsSheet->m_dwCreateOpts,  CREATE_QI_MANDATORY,  IsDlgButtonChecked(IDB_QI_MANDATORY));
  ENABLE_BIT(pCOptionsSheet->m_dwCreateOpts,  CREATE_QI_OPTIONAL,   IsDlgButtonChecked(IDB_QI_OPTIONAL));

  //Obtain Other Options
  if(IsDlgButtonChecked(IDB_USESERVICECOMP))
    pCOptionsSheet->m_dwCreateOpts |= CREATE_USESERVICECOMP;

  //delegate
  return CPropPageLite::OnApply();
}

BOOL COptionsDataSource::OnCommand | ( | UINT | iID,
 |  | HWND | hWndCtrl |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 254 of file coptions.cpp.

{
  switch(iID)
  {
    ON_COMMAND(IDB_REMOTE_SERVER, ::EnableWindow(GetDlgItem(IDE_REMOTESERVER), IsDlgButtonChecked(IDB_REMOTE_SERVER)))
  };

  return FALSE;
}

BOOL COptionsDataSource::OnInitDialog ( ) [virtual]

Reimplemented from CDialogLite.

Definition at line 173 of file coptions.cpp.

{
  CWaitCursor waitCursor;

  //PropertySheet (BackPointer)
  COptionsSheet* pCOptionsSheet = (COptionsSheet*)GetParent();

  //Set CLSCTX to previous saved values
  CheckDlgButton(IDB_INPROC_SERVER,   BST2STATE(pCOptionsSheet->m_dwCLSCTX & CLSCTX_INPROC_SERVER));
  CheckDlgButton(IDB_LOCAL_SERVER,    BST2STATE(pCOptionsSheet->m_dwCLSCTX & CLSCTX_LOCAL_SERVER));
  CheckDlgButton(IDB_REMOTE_SERVER,   BST2STATE(pCOptionsSheet->m_dwCLSCTX & CLSCTX_REMOTE_SERVER));
  CheckDlgButton(IDB_INPROC_HANDLER,    BST2STATE(pCOptionsSheet->m_dwCLSCTX & CLSCTX_INPROC_HANDLER));

  //Currently there is no way to pass RemoteServer in GetDataSource methods...
  wSendMessage(GetDlgItem(IDE_REMOTESERVER), WM_SETTEXT, 0, pCOptionsSheet->m_wszRemoteServer);
    ::EnableWindow(GetDlgItem(IDE_REMOTESERVER), pCOptionsSheet->m_dwCLSCTX & CLSCTX_REMOTE_SERVER);

  //Set Connection Options to previous saved values
  CheckDlgButton(IDB_INIT_INITIALIZE,   BST2STATE(pCOptionsSheet->m_dwCreateOpts & CREATE_INITIALIZE));
  CheckDlgButton(IDB_INIT_SETPROPERTIES,  BST2STATE(pCOptionsSheet->m_dwCreateOpts & CREATE_SETPROPERTIES));

  //AutoQI
  CheckDlgButton(IDB_QI_MANDATORY,    BST2STATE(pCOptionsSheet->m_dwCreateOpts & CREATE_QI_MANDATORY));
  CheckDlgButton(IDB_QI_OPTIONAL,     BST2STATE(pCOptionsSheet->m_dwCreateOpts & CREATE_QI_OPTIONAL));

  //Set Other Options
  CheckDlgButton(IDB_USESERVICECOMP,    BST2STATE(pCOptionsSheet->m_dwCreateOpts & CREATE_USESERVICECOMP));

  //Delegate
  return CPropPageLite::OnInitDialog();
}

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/coptions.h
  • Dataaccess/oledb/rowsetviewer/coptions.cpp
Generated on Wed Nov 13 2024 16:57:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: COptionsError Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

COptionsError Class Reference

#include "coptions.h"

Inherits CPropPageLite.

List of all members.

Public Member Functions

COptionsError ()
virtual BOOL | OnApply ()
virtual BOOL | OnCommand (UINT iID, HWND hWndCtrl)
virtual BOOL | OnInitDialog ()

Detailed Description

Definition at line 180 of file coptions.h.

Constructor & Destructor Documentation

COptionsError::COptionsError ( )

Definition at line 630 of file coptions.cpp.

  : CPropPageLite(IDD_OPTIONS_ERRORS, "Errors")
{
}

Member Function Documentation

BOOL COptionsError::OnApply ( ) [virtual]

Reimplemented from CPropPageLite.

Definition at line 685 of file coptions.cpp.

{
  //ErrorInfo
  SetErrorPosting(EP_ERRORINFO_ALWAYS,  IsDlgButtonChecked(IDB_ERRORINFO_ALWAYS));
  SetErrorPosting(EP_ERRORINFO_FAILURE, IsDlgButtonChecked(IDB_ERRORINFO_FAILURE));
  SetErrorPosting(EP_ERRORINFO_NEVER,   IsDlgButtonChecked(IDB_ERRORINFO_NEVER));

  //HRESULTs
  SetErrorPosting(EP_HRESULT_ALWAYS,    IsDlgButtonChecked(IDB_HRESULT_ALWAYS));
  SetErrorPosting(EP_HRESULT_NOERRORINFO, IsDlgButtonChecked(IDB_HRESULT_NOERRORINFO));
  SetErrorPosting(EP_HRESULT_FAILURE,   IsDlgButtonChecked(IDB_HRESULT_FAILURE));
  SetErrorPosting(EP_HRESULT_NEVER,   IsDlgButtonChecked(IDB_HRESULT_NEVER));

  //IMallocSpy
  SetErrorPosting(EP_IMALLOC_SPY,     IsDlgButtonChecked(IDB_IMALLOC_SPY));
  SetErrorPosting(EP_IMALLOC_ALLOCS,    IsDlgButtonChecked(IDB_IMALLOC_ALLOCS));

  //Do we need to turn on spying. (if not done already)
  if(GetErrorPosting(EP_IMALLOC_SPY))
  {
    CWinApp* pCWinApp = (CWinApp*)GetAppLite();
    if(pCWinApp && !pCWinApp->m_pCMallocSpy)
    {
      pCWinApp->m_pCMallocSpy = new CMallocSpy;
      if(pCWinApp->m_pCMallocSpy)
        pCWinApp->m_pCMallocSpy->Register();
    }
  }

  //BreakID
  g_dwBreakID = 0;
  if(IsDlgButtonChecked(IDB_BREAKID))
  {
    //Obtain the BreakID value from the EditBox
    if(!GetEditBoxValue(GetDlgItem(IDE_BREAKID), (LONG*)&g_dwBreakID, 0/*Min*/))
      return FALSE;
  }

  //RefCounts
  SetErrorPosting(EP_REFCOUNT_FAILURE,  IsDlgButtonChecked(IDB_REFCOUNT_FAILURE));

  //delegate
  return CPropPageLite::OnApply();
}

BOOL COptionsError::OnCommand | ( | UINT | iID,
 |  | HWND | hWndCtrl |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 736 of file coptions.cpp.

{
  switch(iID)
  {
    case IDB_IMALLOC_SPY:
    {
      BOOL bChecked = IsDlgButtonChecked(IDB_IMALLOC_SPY);
            ::EnableWindow(GetDlgItem(IDB_IMALLOC_ALLOCS), bChecked);
            ::EnableWindow(GetDlgItem(IDB_BREAKID),      bChecked);
            ::EnableWindow(GetDlgItem(IDE_BREAKID),      bChecked);
      return TRUE;
    }

    ON_COMMAND(IDB_BREAKID,     ::EnableWindow(GetDlgItem(IDE_BREAKID),     IsDlgButtonChecked(IDB_BREAKID)))
  };

  return FALSE;
}

BOOL COptionsError::OnInitDialog ( ) [virtual]

Reimplemented from CDialogLite.

Definition at line 640 of file coptions.cpp.

{
  CWaitCursor waitCursor;

  //ErrorInfo
  if(GetErrorPosting(EP_ERRORINFO_ALWAYS))
    CheckDlgButton(IDB_ERRORINFO_ALWAYS,    BST_CHECKED);
  if(GetErrorPosting(EP_ERRORINFO_FAILURE))
    CheckDlgButton(IDB_ERRORINFO_FAILURE,   BST_CHECKED);
  if(GetErrorPosting(EP_ERRORINFO_NEVER))
    CheckDlgButton(IDB_ERRORINFO_NEVER,     BST_CHECKED);

  //HRESULTs
  if(GetErrorPosting(EP_HRESULT_ALWAYS))
    CheckDlgButton(IDB_HRESULT_ALWAYS,      BST_CHECKED);
  if(GetErrorPosting(EP_HRESULT_NOERRORINFO))
    CheckDlgButton(IDB_HRESULT_NOERRORINFO,   BST_CHECKED);
  if(GetErrorPosting(EP_HRESULT_FAILURE))
    CheckDlgButton(IDB_HRESULT_FAILURE,     BST_CHECKED);
  if(GetErrorPosting(EP_HRESULT_NEVER))
    CheckDlgButton(IDB_HRESULT_NEVER,     BST_CHECKED);

  //IMallocSpy
  CheckDlgButton(IDB_IMALLOC_SPY,         BST2STATE(GetErrorPosting(EP_IMALLOC_SPY)));
  CheckDlgButton(IDB_IMALLOC_ALLOCS,        BST2STATE(GetErrorPosting(EP_IMALLOC_ALLOCS)));
    ::EnableWindow(GetDlgItem(IDB_IMALLOC_ALLOCS), GetErrorPosting(EP_IMALLOC_SPY));
    ::EnableWindow(GetDlgItem(IDB_BREAKID),      GetErrorPosting(EP_IMALLOC_SPY));

  //BreakID
  CheckDlgButton(IDB_BREAKID,           BST2STATE(g_dwBreakID));
  wSendMessageFmt(GetDlgItem(IDE_BREAKID), WM_SETTEXT, 0, L"%d", g_dwBreakID);
    ::EnableWindow(GetDlgItem(IDE_BREAKID), GetErrorPosting(EP_IMALLOC_SPY) && g_dwBreakID);

  //RefCounts
  CheckDlgButton(IDB_REFCOUNT_FAILURE,      BST2STATE(GetErrorPosting(EP_REFCOUNT_FAILURE)));

  //Delegate
  return CPropPageLite::OnInitDialog();
}

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/coptions.h
  • Dataaccess/oledb/rowsetviewer/coptions.cpp
Generated on Wed Nov 13 2024 16:57:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: COptionsNotify Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

COptionsNotify Class Reference

#include "coptions.h"

Inherits CPropPageLite.

List of all members.

Public Member Functions

COptionsNotify ()
virtual BOOL | OnApply ()
virtual BOOL | OnInitDialog ()

Detailed Description

Definition at line 165 of file coptions.h.

Constructor & Destructor Documentation

COptionsNotify::COptionsNotify ( )

Definition at line 556 of file coptions.cpp.

  : CPropPageLite(IDD_OPTIONS_NOTIFICATIONS, "Notify")
{
}

Member Function Documentation

BOOL COptionsNotify::OnApply ( ) [virtual]

Reimplemented from CPropPageLite.

Definition at line 599 of file coptions.cpp.

{
  //PropertySheet (BackPointer)
  COptionsSheet* pCOptionsSheet = (COptionsSheet*)GetParent();

  //Display
  ENABLE_BIT(pCOptionsSheet->m_dwNotifyOpts, NOTIFY_OLEDB,        IsDlgButtonChecked(IDB_DISPLAY_OLEDB));
  ENABLE_BIT(pCOptionsSheet->m_dwNotifyOpts, NOTIFY_PROMPTVETO,     IsDlgButtonChecked(IDB_DISPLAY_PROMPTVETO));

  //IUnknown
  ENABLE_BIT(pCOptionsSheet->m_dwNotifyOpts, NOTIFY_ADDREF,       IsDlgButtonChecked(IDB_DISPLAY_ADDREF));
  ENABLE_BIT(pCOptionsSheet->m_dwNotifyOpts, NOTIFY_RELEASE,        IsDlgButtonChecked(IDB_DISPLAY_RELEASE));
  ENABLE_BIT(pCOptionsSheet->m_dwNotifyOpts, NOTIFY_QI,         IsDlgButtonChecked(IDB_DISPLAY_QI));

  //Trace Provider
  ENABLE_BIT(pCOptionsSheet->m_dwNotifyOpts, NOTIFY_TRACEPROVIDER,    IsDlgButtonChecked(IDB_USE_TRACEPROVIDER));

  //Notiifcations
  ENABLE_BIT(pCOptionsSheet->m_dwNotifyOpts, NOTIFY_IDBASYNCHNOTIFY,    IsDlgButtonChecked(IDB_DISPLAY_IDBASYNCHNOTIFY));
  ENABLE_BIT(pCOptionsSheet->m_dwNotifyOpts, NOTIFY_IROWSETNOTIFY,    IsDlgButtonChecked(IDB_DISPLAY_IROWSETNOTIFY));
  ENABLE_BIT(pCOptionsSheet->m_dwNotifyOpts, NOTIFY_IROWPOSITIONCHANGE, IsDlgButtonChecked(IDB_DISPLAY_IROWPOSITIONCHANGE));

  //delegate
  return CPropPageLite::OnApply();
}

BOOL COptionsNotify::OnInitDialog ( ) [virtual]

Reimplemented from CDialogLite.

Definition at line 566 of file coptions.cpp.

{
  CWaitCursor waitCursor;

  //PropertySheet (BackPointer)
  COptionsSheet* pCOptionsSheet = (COptionsSheet*)GetParent();

  //Display
  CheckDlgButton(IDB_DISPLAY_OLEDB,       BST2STATE(pCOptionsSheet->m_dwNotifyOpts & NOTIFY_OLEDB));
  CheckDlgButton(IDB_DISPLAY_PROMPTVETO,      BST2STATE(pCOptionsSheet->m_dwNotifyOpts & NOTIFY_PROMPTVETO));

  //IUnknown
  CheckDlgButton(IDB_DISPLAY_ADDREF,        BST2STATE(pCOptionsSheet->m_dwNotifyOpts & NOTIFY_ADDREF));
  CheckDlgButton(IDB_DISPLAY_RELEASE,       BST2STATE(pCOptionsSheet->m_dwNotifyOpts & NOTIFY_RELEASE));
  CheckDlgButton(IDB_DISPLAY_QI,          BST2STATE(pCOptionsSheet->m_dwNotifyOpts & NOTIFY_QI));

  //Trace Provider
  CheckDlgButton(IDB_USE_TRACEPROVIDER,     BST2STATE(pCOptionsSheet->m_dwNotifyOpts & NOTIFY_TRACEPROVIDER));

  //Notifications
  CheckDlgButton(IDB_DISPLAY_IDBASYNCHNOTIFY,   BST2STATE(pCOptionsSheet->m_dwNotifyOpts & NOTIFY_IDBASYNCHNOTIFY));
  CheckDlgButton(IDB_DISPLAY_IROWSETNOTIFY,   BST2STATE(pCOptionsSheet->m_dwNotifyOpts & NOTIFY_IROWSETNOTIFY));
  CheckDlgButton(IDB_DISPLAY_IROWPOSITIONCHANGE,  BST2STATE(pCOptionsSheet->m_dwNotifyOpts & NOTIFY_IROWPOSITIONCHANGE));

  //Delegate
  return CPropPageLite::OnInitDialog();
}

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/coptions.h
  • Dataaccess/oledb/rowsetviewer/coptions.cpp
Generated on Wed Nov 13 2024 16:57:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: COptionsRowset Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

COptionsRowset Class Reference

#include "coptions.h"

Inherits CPropPageLite.

List of all members.

Public Member Functions

COptionsRowset ()
virtual BOOL | OnApply ()
virtual BOOL | OnCommand (UINT iID, HWND hWndCtrl)
virtual BOOL | OnInitDialog ()

Detailed Description

Definition at line 148 of file coptions.h.

Constructor & Destructor Documentation

COptionsRowset::COptionsRowset ( )

Definition at line 449 of file coptions.cpp.

  : CPropPageLite(IDD_OPTIONS_ROWSET, "Rowset")
{
}

Member Function Documentation

BOOL COptionsRowset::OnApply ( ) [virtual]

Reimplemented from CPropPageLite.

Definition at line 498 of file coptions.cpp.

{
  //PropertySheet (BackPointer)
  COptionsSheet* pCOptionsSheet = (COptionsSheet*)GetParent();

  //Hexidecimal
  ENABLE_BIT(pCOptionsSheet->m_dwConvFlags, CONV_HEX,       IsDlgButtonChecked(IDB_DISPLAY_HEXADECIMAL));
  //Use MSDADC Only
  ENABLE_BIT(pCOptionsSheet->m_dwConvFlags, CONV_MSDADC_ONLY,   IsDlgButtonChecked(IDB_MSDADC_ONLY));

  //DefaultProps
  ENABLE_BIT(pCOptionsSheet->m_dwRowsetOpts,  ROWSET_SETDEFAULTPROPS, IsDlgButtonChecked(IDB_SETDEFAULTPROPS));

  //RowsToFetch
  ENABLE_BIT(pCOptionsSheet->m_dwRowsetOpts,  ROWSET_ROWSTOFETCH,   IsDlgButtonChecked(IDB_ROWSTOFETCH));
  if(pCOptionsSheet->m_dwRowsetOpts & ROWSET_ROWSTOFETCH)
  {
    if(!GetEditBoxValue(GetDlgItem(IDE_ROWSTOFETCH), (LONG*)&pCOptionsSheet->m_cRowsToFetch, 0/*Min*/))
    {
      pCOptionsSheet->m_cRowsToFetch = 0;
      return FALSE;
    }
  }

  //FetchData
  ENABLE_BIT(pCOptionsSheet->m_dwRowsetOpts,  ROWSET_NODATA,      !IsDlgButtonChecked(IDB_FETCHDATA));

  //HiddenColumns
  ENABLE_BIT(pCOptionsSheet->m_dwRowsetOpts,  ROWSET_HIDDENCOLUMNS, IsDlgButtonChecked(IDB_HIDDENCOLUMNS));

  //Always ReleaseRows
  ENABLE_BIT(pCOptionsSheet->m_dwRowsetOpts,  ROWSET_ALWAYSRELEASEROWS, IsDlgButtonChecked(IDB_ALWAYSRELEASEROWS));

  //delegate
  return CPropPageLite::OnApply();
}

BOOL COptionsRowset::OnCommand | ( | UINT | iID,
 |  | HWND | hWndCtrl |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 540 of file coptions.cpp.

{
  switch(iID)
  {
    ON_COMMAND(IDB_ROWSTOFETCH,   ::EnableWindow(GetDlgItem(IDE_ROWSTOFETCH), IsDlgButtonChecked(IDB_ROWSTOFETCH)))
    ON_COMMAND(IDB_DEFAULTFETCH,  ::EnableWindow(GetDlgItem(IDE_ROWSTOFETCH), IsDlgButtonChecked(IDB_ROWSTOFETCH)))
  };

  return FALSE;
}

BOOL COptionsRowset::OnInitDialog ( ) [virtual]

Reimplemented from CDialogLite.

Definition at line 459 of file coptions.cpp.

{
  CWaitCursor waitCursor;

  //PropertySheet (BackPointer)
  COptionsSheet* pCOptionsSheet = (COptionsSheet*)GetParent();

  //Hexidecimal
  CheckDlgButton(IDB_DISPLAY_HEXADECIMAL,   BST2STATE(pCOptionsSheet->m_dwConvFlags & CONV_HEX));
  //Use MSDADC Only
  CheckDlgButton(IDB_MSDADC_ONLY,       BST2STATE(pCOptionsSheet->m_dwConvFlags & CONV_MSDADC_ONLY));

  //DefaultProps
  CheckDlgButton(IDB_SETDEFAULTPROPS,     BST2STATE(pCOptionsSheet->m_dwRowsetOpts & ROWSET_SETDEFAULTPROPS));

  //RowsToFetch
  CheckDlgButton(IDB_ROWSTOFETCH,       BST2STATE(pCOptionsSheet->m_dwRowsetOpts & ROWSET_ROWSTOFETCH));
  CheckDlgButton(IDB_DEFAULTFETCH,      BST2STATE(!(pCOptionsSheet->m_dwRowsetOpts & ROWSET_ROWSTOFETCH)));
  wSendMessageFmt(GetDlgItem(IDE_ROWSTOFETCH), WM_SETTEXT, 0, L"%lu", pCOptionsSheet->m_cRowsToFetch);
    ::EnableWindow(GetDlgItem(IDE_ROWSTOFETCH), pCOptionsSheet->m_dwRowsetOpts & ROWSET_ROWSTOFETCH);

  //FetchData
  CheckDlgButton(IDB_FETCHDATA,       BST2STATE(!(pCOptionsSheet->m_dwRowsetOpts & ROWSET_NODATA)));

  //Hidden Columns
  CheckDlgButton(IDB_HIDDENCOLUMNS,     BST2STATE(pCOptionsSheet->m_dwRowsetOpts & ROWSET_HIDDENCOLUMNS));

  //Always ReleaseRows
  CheckDlgButton(IDB_ALWAYSRELEASEROWS,   BST2STATE(pCOptionsSheet->m_dwRowsetOpts & ROWSET_ALWAYSRELEASEROWS));

  //Delegate
  return CPropPageLite::OnInitDialog();
}

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/coptions.h
  • Dataaccess/oledb/rowsetviewer/coptions.cpp
Generated on Wed Nov 13 2024 16:57:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: COptionsSheet Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Protected Attributes

COptionsSheet Class Reference

#include "coptions.h"

Inherits CPropSheetLite.

List of all members.

Public Member Functions

COptionsSheet ()
DBTYPE | GetBindingType (DBTYPE wNativeType=DBTYPE_UDT)
BOOL LoadOptions ()
BOOL SaveOptions ()
void | SetBindingType (DBTYPE wType)

Public Attributes

COptionsAccessor m_CAccessor
COptionsCommand m_CCommand
COptionsDataSource m_CDataSource
COptionsError m_CError
COptionsNotify m_CNotify
COptionsRowset m_CRowset
ULONG m_cRowsToFetch
DWORD m_dwAccessorOpts
DWORD m_dwCLSCTX
DWORD m_dwCommandOpts
DWORD m_dwConvFlags
DWORD m_dwCreateOpts
DWORD m_dwMaxLength
DWORD m_dwNotifyOpts
DWORD m_dwRowsetOpts
WCHAR | m_wszRemoteServer [MAX_NAME_LEN+1]

Protected Attributes

DBTYPE | m_wBindingType

Detailed Description

Definition at line 197 of file coptions.h.

Constructor & Destructor Documentation

COptionsSheet::COptionsSheet ( )

Definition at line 24 of file coptions.cpp.

  : CPropSheetLite("Options")
{
  AddPage(&m_CDataSource);
  AddPage(&m_CCommand);
  AddPage(&m_CAccessor);
  AddPage(&m_CRowset);
  AddPage(&m_CNotify);
  AddPage(&m_CError);

  //DataSource
  m_dwCLSCTX        = CLSCTX_INPROC_SERVER;
  m_wszRemoteServer[0]  = EOL;
  m_dwCreateOpts      = CREATE_INITIALIZE | CREATE_SETPROPERTIES;

  //Command
  m_dwCommandOpts     = COMMAND_ROWSAFFECTED | COMMAND_RELEASE_OPENOBJECTS;

  //Accessor
  m_wBindingType      = DBTYPE_WSTR;
  m_dwMaxLength     = MAX_COL_SIZE;
  m_dwAccessorOpts    = ACCESSOR_BIND_VALUE | ACCESSOR_BIND_LENGTH | ACCESSOR_BIND_STATUS;

  //Rowset
  m_dwConvFlags     = CONV_ALPHABOOL;
  m_dwRowsetOpts      = ROWSET_SETDEFAULTPROPS;
  m_cRowsToFetch      = 0;

  //Notify
  m_dwNotifyOpts      = NOTIFY_OLEDB | NOTIFY_IDBASYNCHNOTIFY | NOTIFY_IROWSETNOTIFY | NOTIFY_IROWPOSITIONCHANGE | NOTIFY_IPOOLNOTIFY;

  //Errors

  //Load Options from the Registry
  LoadOptions();
}

Member Function Documentation

DBTYPE COptionsSheet::GetBindingType ( DBTYPE wNativeType = DBTYPE_UDT )

Definition at line 148 of file coptions.cpp.

{
  //Native Binding
  if((m_wBindingType & ~(DBTYPE_BYREF | DBTYPE_ARRAY | DBTYPE_VECTOR)) == DBTYPE_UDT)
    return wNativeType | (m_wBindingType - DBTYPE_UDT);

  //Otherwise use the type selected
  return m_wBindingType;
}

BOOL COptionsSheet::LoadOptions ( )

Definition at line 66 of file coptions.cpp.

{
  //DataSource
  GetRegEntry(HKEY_ROWSETVIEWER, wszOPTIONS_KEY, L"CLSCTX",       &m_dwCLSCTX);
  GetRegEntry(HKEY_ROWSETVIEWER, wszOPTIONS_KEY, L"RemoteServer",     m_wszRemoteServer, MAX_NAME_LEN);
  GetRegEntry(HKEY_ROWSETVIEWER, wszOPTIONS_KEY, L"ConnectOpts",      &m_dwCreateOpts);

  //NOTE: Since these bits we added later, the default is 0.  Instead of having negative logic
  //all over the place (NO_QI_OPTIONAL), we just store and obtain the bits in reverse
  ENABLE_BIT(m_dwCreateOpts, CREATE_QI_MANDATORY, !(m_dwCreateOpts & CREATE_QI_MANDATORY));
  ENABLE_BIT(m_dwCreateOpts, CREATE_QI_OPTIONAL,  !(m_dwCreateOpts & CREATE_QI_OPTIONAL));

  //Command
  GetRegEntry(HKEY_ROWSETVIEWER, wszOPTIONS_KEY, L"CommandOpts",      &m_dwCommandOpts);

  //Accessor
  DWORD dwType = m_wBindingType;
  GetRegEntry(HKEY_ROWSETVIEWER, wszOPTIONS_KEY, L"BindingType",      &dwType);
  m_wBindingType = (DBTYPE)dwType;

  GetRegEntry(HKEY_ROWSETVIEWER, wszOPTIONS_KEY, L"MaxLength",      &m_dwMaxLength);
  GetRegEntry(HKEY_ROWSETVIEWER, wszOPTIONS_KEY, L"AccessorOpts",     &m_dwAccessorOpts);

  //Rowset
  GetRegEntry(HKEY_ROWSETVIEWER, wszOPTIONS_KEY, L"ConvFlags",      &m_dwConvFlags);
  GetRegEntry(HKEY_ROWSETVIEWER, wszOPTIONS_KEY, L"RowsetOpts",     &m_dwRowsetOpts);
  GetRegEntry(HKEY_ROWSETVIEWER, wszOPTIONS_KEY, L"RowsToFetch",      &m_cRowsToFetch);

  //Notifications
  GetRegEntry(HKEY_ROWSETVIEWER, wszOPTIONS_KEY, L"NotifyOpts",     &m_dwNotifyOpts);

  //Errors
  GetRegEntry(HKEY_ROWSETVIEWER, wszOPTIONS_KEY, L"ErrorPostingFlags",  &g_dwErrorPost);
  GetRegEntry(HKEY_ROWSETVIEWER, wszOPTIONS_KEY, L"BreakID",        &g_dwBreakID);
  return TRUE;
}

BOOL COptionsSheet::SaveOptions ( )

Definition at line 108 of file coptions.cpp.

{
  //DataSource
  SetRegEntry(HKEY_ROWSETVIEWER, wszOPTIONS_KEY, L"CLSCTX",       m_dwCLSCTX);
  SetRegEntry(HKEY_ROWSETVIEWER, wszOPTIONS_KEY, L"RemoteServer",     m_wszRemoteServer);

  //NOTE: Since these bits we added later, the default is 0.  Instead of having negative logic
  //all over the place (NO_QI_OPTIONAL), we just store and obtain the bits in reverse
  DWORD dwCreateOpts = m_dwCreateOpts;
  ENABLE_BIT(dwCreateOpts, CREATE_QI_MANDATORY, !(dwCreateOpts & CREATE_QI_MANDATORY));
  ENABLE_BIT(dwCreateOpts, CREATE_QI_OPTIONAL,  !(dwCreateOpts & CREATE_QI_OPTIONAL));
  SetRegEntry(HKEY_ROWSETVIEWER, wszOPTIONS_KEY, L"ConnectOpts",      dwCreateOpts);

  //Command
  SetRegEntry(HKEY_ROWSETVIEWER, wszOPTIONS_KEY, L"CommandOpts",      m_dwCommandOpts);

  //Accessor
  SetRegEntry(HKEY_ROWSETVIEWER, wszOPTIONS_KEY, L"BindingType",      m_wBindingType);
  SetRegEntry(HKEY_ROWSETVIEWER, wszOPTIONS_KEY, L"MaxLength",      m_dwMaxLength);
  SetRegEntry(HKEY_ROWSETVIEWER, wszOPTIONS_KEY, L"AccessorOpts",     m_dwAccessorOpts);

  //Rowset
  SetRegEntry(HKEY_ROWSETVIEWER, wszOPTIONS_KEY, L"ConvFlags",      m_dwConvFlags);
  SetRegEntry(HKEY_ROWSETVIEWER, wszOPTIONS_KEY, L"RowsetOpts",     m_dwRowsetOpts);
  SetRegEntry(HKEY_ROWSETVIEWER, wszOPTIONS_KEY, L"RowsToFetch",      m_cRowsToFetch);

  //Notifications
  SetRegEntry(HKEY_ROWSETVIEWER, wszOPTIONS_KEY, L"NotifyOpts",     m_dwNotifyOpts);

  //Errors
  SetRegEntry(HKEY_ROWSETVIEWER, wszOPTIONS_KEY, L"ErrorPostingFlags",  g_dwErrorPost);
  SetRegEntry(HKEY_ROWSETVIEWER, wszOPTIONS_KEY, L"BreakID",        g_dwBreakID);
  return TRUE;
}

void COptionsSheet::SetBindingType ( DBTYPE wType ) [inline]

Definition at line 209 of file coptions.h.

{ m_wBindingType = wType; }

Member Data Documentation

COptionsAccessor COptionsSheet::m_CAccessor

Definition at line 215 of file coptions.h.

COptionsCommand COptionsSheet::m_CCommand

Definition at line 214 of file coptions.h.

COptionsDataSource COptionsSheet::m_CDataSource

Definition at line 213 of file coptions.h.

COptionsError COptionsSheet::m_CError

Definition at line 218 of file coptions.h.

COptionsNotify COptionsSheet::m_CNotify

Definition at line 217 of file coptions.h.

COptionsRowset COptionsSheet::m_CRowset

Definition at line 216 of file coptions.h.

ULONG COptionsSheet::m_cRowsToFetch

Definition at line 235 of file coptions.h.

DWORD COptionsSheet::m_dwAccessorOpts

Definition at line 230 of file coptions.h.

DWORD COptionsSheet::m_dwCLSCTX

Definition at line 221 of file coptions.h.

DWORD COptionsSheet::m_dwCommandOpts

Definition at line 226 of file coptions.h.

DWORD COptionsSheet::m_dwConvFlags

Definition at line 233 of file coptions.h.

DWORD COptionsSheet::m_dwCreateOpts

Definition at line 223 of file coptions.h.

DWORD COptionsSheet::m_dwMaxLength

Definition at line 229 of file coptions.h.

DWORD COptionsSheet::m_dwNotifyOpts

Definition at line 238 of file coptions.h.

DWORD COptionsSheet::m_dwRowsetOpts

Definition at line 234 of file coptions.h.

DBTYPE COptionsSheet::m_wBindingType [protected]

Definition at line 242 of file coptions.h.

WCHAR COptionsSheet::m_wszRemoteServer[MAX_NAME_LEN+1]

Definition at line 222 of file coptions.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/coptions.h
  • Dataaccess/oledb/rowsetviewer/coptions.cpp
Generated on Wed Nov 13 2024 16:57:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: COrder Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

COrder Class Reference

#include "Order.h"

List of all members.

Public Member Functions

COrder ()
COrder ()
STDMETHOD() | LineItem (long lItemId, long lQuantity)
STDMETHOD() | LineItem (long lItemId, long lQuantity)
STDMETHOD() | Process (long lFlags)
STDMETHOD() | Process (long lFlags)
STDMETHOD() | put_CustomerId (long lCustomerId)
STDMETHOD() | put_CustomerId (long lCustomerId)
STDMETHOD() | put_OrderId (long lOrderId)
STDMETHOD() | put_OrderId (long lOrderId)

Private Member Functions

HRESULT | InvokeShip (long lFlags)
HRESULT | InvokeShip (long lFlags)
HRESULT | InvokeShipIDispatch (IUnknown *punk, long lFlags)
HRESULT | InvokeShipIDispatch (IUnknown *punk, long lFlags)
HRESULT | InvokeShipVtable (IUnknown *punk, long lFlags)
HRESULT | InvokeShipVtable (IUnknown *punk, long lFlags)
HRESULT | WriteOrderDB ()
HRESULT | WriteOrderDB ()

Private Attributes

long | m_lCustomerId
long | m_lOrderId
std::vector< long > | m_veclItemId
std::vector< long > | m_veclQuantity

Detailed Description

Definition at line 37 of file Order.h.

Constructor & Destructor Documentation

COrder::COrder ( ) [inline]

Definition at line 43 of file Order.h.

           : m_lCustomerId(0), m_lOrderId(0)
  {
  }

COrder::COrder ( ) [inline]

Definition at line 36 of file Order.h.

           : m_lCustomerId(0), m_lOrderId(0)
  {
  }

Member Function Documentation

HRESULT COrder::InvokeShip ( long lFlags ) [private]

Definition at line 126 of file Order.Cpp.

{
  LPWSTR pwszDisplayName;

  if (lFlags & processFlagQueuedComponents)
    pwszDisplayName = L"queue:/new:QCShip.Ship";
  else
    pwszDisplayName = L"new:QCShip.Ship";

  CComPtr<IUnknown> punkShip;

  HRESULT hr = CoGetObject(pwszDisplayName, 0, IID_IUnknown, (void **) &punkShip);
  if (SUCCEEDED(hr))
  {
    if (lFlags & processFlagLateBound)
      hr = InvokeShipIDispatch(punkShip, lFlags);
    else
      hr = InvokeShipVtable(punkShip, lFlags);
  }
  return hr;
}

HRESULT COrder::InvokeShip ( long lFlags ) [private]
HRESULT COrder::InvokeShipIDispatch | ( | IUnknown * | punk,
 |  | long | lFlags |
 | ) |  |  | [private]

Definition at line 159 of file Order.Cpp.

{
  HRESULT hr = S_OK;

  CComQIPtr<IDispatch, &IID_IDispatch> pIDispatch(punkShip);

  if (!pIDispatch) hr = E_NOINTERFACE;

  // Set CustomerId property

  if (SUCCEEDED(hr))
  {
    const int nNames = 1;   // number of names

    OLECHAR * rgszNames[nNames] = { OLESTR("CustomerId") };
    DISPID    dispId[nNames];

    hr = pIDispatch->GetIDsOfNames( IID_NULL, rgszNames, nNames,
                    LOCALE_SYSTEM_DEFAULT, dispId);
    if (SUCCEEDED(hr))
    {
      CComVariant varData(m_lCustomerId);
      DISPID    dispidPut = DISPID_PROPERTYPUT;
      DISPPARAMS  dispparams = {&varData, &dispidPut, 1, 1};

      hr = pIDispatch->Invoke(dispId[0], IID_NULL, LOCALE_USER_DEFAULT,
                  DISPATCH_PROPERTYPUT, &dispparams, NULL, NULL, NULL);
    }
  }

  // Set OrderId property

  if (SUCCEEDED(hr))
  {
    const int nNames = 1;

    OLECHAR * rgszNames[nNames] = { OLESTR("OrderId") };
    DISPID    dispId[nNames];

    hr = pIDispatch->GetIDsOfNames( IID_NULL, rgszNames, nNames,
                    LOCALE_SYSTEM_DEFAULT, dispId);
    if (SUCCEEDED(hr))
    {
      CComVariant varData(m_lOrderId);
      DISPID    dispidPut = DISPID_PROPERTYPUT;
      DISPPARAMS  dispparams = {&varData, &dispidPut, 1, 1};

      hr = pIDispatch->Invoke(dispId[0], IID_NULL, LOCALE_USER_DEFAULT,
                  DISPATCH_PROPERTYPUT, &dispparams, NULL, NULL, NULL);
    }
  }

  // Call LineItem method once for each line item

  if (SUCCEEDED(hr))
  {
    const int nNames = 3;     // number of names to look up

    OLECHAR * rgszNames[nNames] = { OLESTR("LineItem"),   // method name
                      OLESTR("lItemId"),    // parm name
                      OLESTR("lQuantity") };  // parm name
    DISPID    dispId[nNames];

    hr = pIDispatch->GetIDsOfNames( IID_NULL, rgszNames, nNames,
                    LOCALE_SYSTEM_DEFAULT, dispId);

    for (int ix = 0; ix < m_veclItemId.size() && SUCCEEDED(hr); ix++)
    {
      const int nArgs = nNames - 1;   // number of arguments

      CComVariant varData[nArgs];     // number of arguments
      varData[0] = m_veclItemId[ix];
      varData[1] = m_veclQuantity[ix];

      DISPPARAMS dispparams = {varData, &dispId[1], nArgs, nArgs};

      hr = pIDispatch->Invoke(dispId[0], IID_NULL, LOCALE_USER_DEFAULT,
                  DISPATCH_METHOD, &dispparams, NULL, NULL, NULL);
    }
  }

  // Call Process method

  if (SUCCEEDED(hr))
  {
    const int nNames = 2;     // number of names to look up

    OLECHAR * rgszNames[nNames] = { OLESTR("Process"),    // method name
                      OLESTR("lFlags") };   // parm name
    DISPID    dispId[nNames];

    hr = pIDispatch->GetIDsOfNames( IID_NULL, rgszNames, nNames,
                    LOCALE_SYSTEM_DEFAULT, dispId);
    if (SUCCEEDED(hr))
    {
      const int nArgs = nNames - 1; // number of arguments

      CComVariant varData[nArgs];   // just the parameters
      varData[0] = lFlags;

      DISPPARAMS  dispparams = {varData, &dispId[1], nArgs, 0};

      hr = pIDispatch->Invoke(dispId[0], IID_NULL, LOCALE_USER_DEFAULT,
                  DISPATCH_METHOD, &dispparams, NULL, NULL, NULL);
    }
  }
  return hr;
}

HRESULT COrder::InvokeShipIDispatch | ( | IUnknown * | punk,
 |  | long | lFlags |
 | ) |  |  | [private]
HRESULT COrder::InvokeShipVtable | ( | IUnknown * | punk,
 |  | long | lFlags |
 | ) |  |  | [private]

Definition at line 279 of file Order.Cpp.

{
  HRESULT hr = S_OK;

  CComQIPtr<IShip, &IID_IShip> pShip(punkShip);

  if (!pShip) hr = E_NOINTERFACE;

  if (SUCCEEDED(hr)) hr = pShip->put_CustomerId(m_lCustomerId);

  if (SUCCEEDED(hr)) hr = pShip->put_OrderId(m_lOrderId);

  for (int ix = 0; ix < m_veclItemId.size() && SUCCEEDED(hr); ix++)
  {
    hr = pShip->LineItem(m_veclItemId[ix], m_veclQuantity[ix]);
  }

  if (SUCCEEDED(hr)) hr = pShip->Process(lFlags);

  return hr;
}

HRESULT COrder::InvokeShipVtable | ( | IUnknown * | punk,
 |  | long | lFlags |
 | ) |  |  | [private]
STDMETHOD() COrder::LineItem | ( | long | lItemId,
 |  | long | lQuantity
 | ) |  |
STDMETHODIMP COrder::LineItem | ( | long | lItemId,
 |  | long | lQuantity
 | ) |  |

Definition at line 74 of file Order.Cpp.

{
  m_veclItemId.push_back(lItemId);
  m_veclQuantity.push_back(lQuantity);
  return S_OK;
}

STDMETHODIMP COrder::Process ( long lFlags )

Definition at line 91 of file Order.Cpp.

{
  HRESULT hr = S_OK;

  _RPT1(_CRT_WARN, "QCSamp1 %d Order\n", m_lOrderId);

  if (lFlags & processFlagWriteDB) hr = WriteOrderDB();

  if (SUCCEEDED(hr)) hr = InvokeShip(lFlags);

  // Invoke SetComplete or SetAbort depending on our success

  // We may be able to replace this with an "autodone" attribute

  CComPtr<IObjectContext> pIObjectContext;

  if (SUCCEEDED(CoGetObjectContext(IID_IObjectContext, (void**)&pIObjectContext)))
  {
    if (SUCCEEDED(hr))  pIObjectContext->SetComplete();
    else        pIObjectContext->SetAbort();
  }

  return hr;
}

STDMETHOD() COrder::Process ( long lFlags )
STDMETHODIMP COrder::put_CustomerId ( long lCustomerId )

Definition at line 45 of file Order.Cpp.

{
  m_lCustomerId = lCustomerId;
  return S_OK;
}

STDMETHOD() COrder::put_CustomerId ( long lCustomerId )
STDMETHODIMP COrder::put_OrderId ( long lOrderId )

Definition at line 59 of file Order.Cpp.

{
  m_lOrderId = lOrderId;
  return S_OK;
}

STDMETHOD() COrder::put_OrderId ( long lOrderId )
HRESULT COrder::WriteOrderDB ( ) [private]

Definition at line 311 of file Order.Cpp.

{
  CComPtr<ADOConnection> pADOConnection;

  HRESULT hr = CoCreateInstance(  CLSID_CADOConnection, NULL, CLSCTX_INPROC_SERVER,
                  IID_IADOConnection, (void **) &pADOConnection);
  if (SUCCEEDED(hr))
  {
    // Connect to the database.  name constants are in DataSourceNames.h

    hr = pADOConnection->Open(  _bstr_t(pszOrderDSN), _bstr_t(pszUserId),
                  _bstr_t(pszPassword), adOpenUnspecified);

    // Write one row per line item
    for (int ix = 0; ix < m_veclItemId.size() && SUCCEEDED(hr); ix++)
    {
      TCHAR szSQLStmt[512];

      LPCTSTR const pszPrototypeInsertStmt =
          _T("insert into QCSampleOrder ")
          _T("  (order_id, cust_id, line_no, item_id, quantity) ")
          _T("  values(%ld, %ld, %ld, %ld, %ld)");

      wsprintf( szSQLStmt,
            pszPrototypeInsertStmt,
            m_lOrderId,
            m_lCustomerId,
            ix,
            m_veclItemId[ix],
            m_veclQuantity[ix]);

      hr = pADOConnection->Execute(_bstr_t(szSQLStmt), NULL, adCmdText, NULL);
      // hr tested in for loop
    }
  }
  return hr;
}

HRESULT COrder::WriteOrderDB ( ) [private]

Member Data Documentation

long COrder::m_lCustomerId [private]

Definition at line 62 of file Order.h.

long COrder::m_lOrderId [private]

Definition at line 63 of file Order.h.

std::vector< long > COrder::m_veclItemId [private]

Definition at line 64 of file Order.h.

std::vector< long > COrder::m_veclQuantity [private]

Definition at line 65 of file Order.h.

The documentation for this class was generated from the following files:
  • Com/Services/Queued_Components/QCSamp1/QCOrder/Order.h
  • Com/Services/Queued_Components/QCSamp2/QCOrder/Order.h
  • Com/Services/Queued_Components/QCSamp1/QCOrder/Order.Cpp
  • Com/Services/Queued_Components/QCSamp2/QCOrder/Order.Cpp
Generated on Wed Nov 13 2024 16:57:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: COShip Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

COShip Class Reference

#include "Ship.h"

List of all members.

Public Member Functions

COShip ()
STDMETHOD() | LineItem (long lItemId, long lQuantity)
STDMETHOD() | Process (long lFlags)
STDMETHOD() | put_CustomerId (long lCustomerId)
STDMETHOD() | put_OrderId (long lOrderId)

Private Member Functions

HRESULT | InvokeNotifyIDispatch (IUnknown *punk, long lFlags)
HRESULT | InvokeNotifyVtable (IUnknown *punk, long lFlags)
HRESULT | NotifyRequestor (long lFlags)
ShipStatus RandomShipStatus ()
HRESULT | WriteShipDB ()

Private Attributes

long | m_lCustomerId
long | m_lOrderId
std::vector< long > | m_veclItemId
std::vector< long > | m_veclQuantity
std::vector< ShipStatus > | m_vecShipStatus

Detailed Description

Definition at line 39 of file Ship.h.

Constructor & Destructor Documentation

COShip::COShip ( ) [inline]

Definition at line 45 of file Ship.h.

           : m_lCustomerId(0), m_lOrderId(0)
  {
  }

Member Function Documentation

HRESULT COShip::InvokeNotifyIDispatch | ( | IUnknown * | punk,
 |  | long | lFlags |
 | ) |  |  | [private]

Definition at line 208 of file Ship.Cpp.

{
  HRESULT hr = S_OK;

  CComQIPtr<IDispatch, &IID_IDispatch> pIDispatch(punkNotify);

  if (!pIDispatch) hr = E_NOINTERFACE;

  // Set CustomerId property

  if (SUCCEEDED(hr))
  {
    const int nNames = 1;

    OLECHAR * rgszNames[nNames] = { OLESTR("CustomerId") };
    DISPID    dispId[nNames];

    hr = pIDispatch->GetIDsOfNames( IID_NULL, rgszNames, nNames,
                    LOCALE_SYSTEM_DEFAULT, dispId);
    if (SUCCEEDED(hr))
    {
      CComVariant varData(m_lCustomerId);
      DISPID    dispidPut = DISPID_PROPERTYPUT;
      DISPPARAMS  dispparams = {&varData, &dispidPut, 1, 1};

      hr = pIDispatch->Invoke(dispId[0], IID_NULL, LOCALE_USER_DEFAULT,
                  DISPATCH_PROPERTYPUT, &dispparams, NULL, NULL, NULL);
    }
  }

  // Set OrderId property

  if (SUCCEEDED(hr))
  {
    const int nNames = 1;

    OLECHAR * rgszNames[nNames] = { OLESTR("OrderId") };
    DISPID    dispId[nNames];

    hr = pIDispatch->GetIDsOfNames( IID_NULL, rgszNames, nNames,
                    LOCALE_SYSTEM_DEFAULT, dispId);
    if (SUCCEEDED(hr))
    {
      CComVariant varData(m_lOrderId);
      DISPID    dispidPut = DISPID_PROPERTYPUT;
      DISPPARAMS  dispparams = {&varData, &dispidPut, 1, 1};

      hr = pIDispatch->Invoke(dispId[0], IID_NULL, LOCALE_USER_DEFAULT,
                  DISPATCH_PROPERTYPUT, &dispparams, NULL, NULL, NULL);
    }
  }

  // Call LineItem method once for each line item

  if (SUCCEEDED(hr))
  {
    const int nNames = 4;

    OLECHAR * rgszNames[nNames] = { OLESTR("LineItem"),   // method name
                      OLESTR("lItemId"),    // parm name
                      OLESTR("lQuantity"),
                      OLESTR("shipStatus") }; // parm name
    DISPID    dispId[nNames];

    hr = pIDispatch->GetIDsOfNames( IID_NULL, rgszNames, nNames,
                    LOCALE_SYSTEM_DEFAULT, dispId);

    for (int ix = 0; ix < m_veclItemId.size() && SUCCEEDED(hr); ix++)
    {
      const int nArgs = nNames - 1;

      CComVariant varData[nArgs];   // 2 Arguments
      varData[0] = m_veclItemId[ix];
      varData[1] = m_veclQuantity[ix];
      varData[2] = m_vecShipStatus[ix];

      DISPPARAMS dispparams = {varData, &dispId[1], nArgs, nArgs};

      hr = pIDispatch->Invoke(dispId[0], IID_NULL, LOCALE_USER_DEFAULT,
                  DISPATCH_METHOD, &dispparams, NULL, NULL, NULL);
    }
  }

  // Call Process method

  if (SUCCEEDED(hr))
  {
    const int nNames = 2;

    OLECHAR * rgszNames[nNames] = { OLESTR("Process"),    // method name
                      OLESTR("lFlags") };   // parm name
    DISPID    dispId[nNames];

    hr = pIDispatch->GetIDsOfNames( IID_NULL, rgszNames, nNames,
                    LOCALE_SYSTEM_DEFAULT, dispId);
    if (SUCCEEDED(hr))
    {
      const int nArgs = nNames - 1;

      CComVariant varData[nArgs]; // just the parameters
      varData[0] = lFlags;

      DISPPARAMS  dispparams = {varData, &dispId[1], nArgs, 0};

      hr = pIDispatch->Invoke(dispId[0], IID_NULL, LOCALE_USER_DEFAULT,
                  DISPATCH_METHOD, &dispparams, NULL, NULL, NULL);
    }
  }
  return hr;
}

HRESULT COShip::InvokeNotifyVtable | ( | IUnknown * | punk,
 |  | long | lFlags |
 | ) |  |  | [private]

Definition at line 329 of file Ship.Cpp.

{
  HRESULT hr = S_OK;

  CComQIPtr<INotify, &IID_INotify> pNotify(punkNotify);

  if (!pNotify) hr = E_NOINTERFACE;

  if (SUCCEEDED(hr)) hr = pNotify->put_CustomerId(m_lCustomerId);

  if (SUCCEEDED(hr)) hr = pNotify->put_OrderId(m_lOrderId);

  for (int ix = 0; ix < m_veclItemId.size() && SUCCEEDED(hr); ix++)
  {
    hr = pNotify->LineItem(m_veclItemId[ix], m_veclQuantity[ix], m_vecShipStatus[ix]);
  }

  if (SUCCEEDED(hr)) hr = pNotify->Process(lFlags);

  return hr;
}

STDMETHODIMP COShip::LineItem | ( | long | lItemId,
 |  | long | lQuantity
 | ) |  |

Definition at line 73 of file Ship.Cpp.

{
  m_veclItemId.push_back(lItemId);
  m_veclQuantity.push_back(lQuantity);
  m_vecShipStatus.push_back(RandomShipStatus());  // assign shipping status
  return S_OK;
}

HRESULT COShip::NotifyRequestor ( long lFlags ) [private]

Definition at line 175 of file Ship.Cpp.

{
  LPWSTR pszDisplayName;

  if (lFlags & processFlagQueuedComponents)
    pszDisplayName = L"queue:/new:QCNotify.Notify";
  else
    pszDisplayName = L"new:QCNotify.Notify";

  CComPtr<IUnknown> punkNotify;

  HRESULT hr = CoGetObject(pszDisplayName, NULL, IID_IUnknown, (void **) &punkNotify);
  if (SUCCEEDED(hr))
  {
    if (lFlags & processFlagLateBound)
      hr = InvokeNotifyIDispatch(punkNotify, lFlags);
    else
      hr = InvokeNotifyVtable(punkNotify, lFlags);
  }
  return hr;
}

STDMETHODIMP COShip::Process ( long lFlags )

Definition at line 91 of file Ship.Cpp.

{
  HRESULT hr = S_OK;

  _RPT1(_CRT_WARN, "QCSamp1 %d Ship\n", m_lOrderId);

  if (lFlags & processFlagWriteDB) hr = WriteShipDB();

  if (SUCCEEDED(hr)) hr = NotifyRequestor(lFlags);

  // Invoke SetComplete or SetAbort depending on our success

  CComPtr<IObjectContext> pIObjectContext;

  if (SUCCEEDED(CoGetObjectContext(IID_IObjectContext, (void**)&pIObjectContext)))
  {
    if (SUCCEEDED(hr))  pIObjectContext->SetComplete();
    else        pIObjectContext->SetAbort();
  }

  return hr;
}

STDMETHODIMP COShip::put_CustomerId ( long lCustomerId )

Definition at line 44 of file Ship.Cpp.

{
  m_lCustomerId = lCustomerId;
  return S_OK;
}

STDMETHODIMP COShip::put_OrderId ( long lOrderId )

Definition at line 58 of file Ship.Cpp.

{
  m_lOrderId = lOrderId;
  return S_OK;
}

ShipStatus COShip::RandomShipStatus ( ) [private]

Definition at line 363 of file Ship.Cpp.

{
  const int iRandom = rand() % 100;

  if (iRandom < 80) return ssShipped;   // 80% are shipped
  if (iRandom < 93) return ssBackOrdered; // 13% are back ordered
  if (iRandom < 97) return ssNotStocked;  //  4% are not stocked
            return ssUnrecognizedItem;  //  3% have an invalid item number
}

HRESULT COShip::WriteShipDB ( ) [private]

Definition at line 124 of file Ship.Cpp.

{
  CComPtr<ADOConnection> pADOConnection;

  HRESULT hr = CoCreateInstance(  CLSID_CADOConnection, NULL, CLSCTX_INPROC_SERVER,
                  IID_IADOConnection, (void **) &pADOConnection);
  if (SUCCEEDED(hr))
  {
    // Connect to the Shipping Database. Names in DataSourceNames.h

    hr = pADOConnection->Open(  _bstr_t(pszShipDSN), _bstr_t(pszUserId),
                  _bstr_t(pszPassword), adOpenUnspecified);

    // Write one row per line item

    for (int ix = 0; ix < m_veclItemId.size() && SUCCEEDED(hr); ix++)
    {
      TCHAR szSQLStmt[1024];  // SQL statement buffer

      LPCTSTR pszPrototypeInsertStmt =
        _T("insert into QCSampleShip ")
        _T(" (order_id, cust_id, line_no, ")
        _T("  item_id, quantity, ship_status_enum) ")
        _T("values(%ld, %ld, %ld, %ld, %ld, %ld)");

      wsprintf( szSQLStmt,
            pszPrototypeInsertStmt,
            m_lOrderId,
            m_lCustomerId,
            ix,
            m_veclItemId[ix],
            m_veclQuantity[ix],
            m_vecShipStatus[ix]);

      hr = pADOConnection->Execute(_bstr_t(szSQLStmt), NULL, adCmdText, NULL);
    }
  }

  return hr;
}

Member Data Documentation

long COShip::m_lCustomerId [private]

Definition at line 64 of file Ship.h.

long COShip::m_lOrderId [private]

Definition at line 65 of file Ship.h.

std::vector<long> COShip::m_veclItemId [private]

Definition at line 66 of file Ship.h.

std::vector<long> COShip::m_veclQuantity [private]

Definition at line 67 of file Ship.h.

std::vector<ShipStatus> COShip::m_vecShipStatus [private]

Definition at line 68 of file Ship.h.

The documentation for this class was generated from the following files:
  • Com/Services/Queued_Components/QCSamp1/QCShip/Ship.h
  • Com/Services/Queued_Components/QCSamp1/QCShip/Ship.Cpp
Generated on Wed Nov 13 2024 16:57:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: COShip2 Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

COShip2 Class Reference

#include "Ship2.h"

List of all members.

Public Member Functions

COShip2 ()
STDMETHOD() | LineItem (long lItemId, long lQuantity)
STDMETHOD() | Process (long lFlags, IUnknown *punk)
STDMETHOD() | put_CustomerId (long lCustomerId)
STDMETHOD() | put_OrderId (long lOrderId)

Private Member Functions

HRESULT | InvokeNotifyIDispatch (IUnknown *punk, long lFlags)
HRESULT | InvokeNotifyVtable (IUnknown *punk, long lFlags)
HRESULT | NotifyRequestor (long lFlags, IUnknown *punkNotify)
ShipStatus RandomShipStatus ()
HRESULT | WriteShipDB ()

Private Attributes

long | m_lCustomerId
long | m_lOrderId
std::vector< long > | m_veclItemId
std::vector< long > | m_veclQuantity
std::vector< ShipStatus > | m_vecShipStatus

Detailed Description

Definition at line 32 of file Ship2.h.

Constructor & Destructor Documentation

COShip2::COShip2 ( ) [inline]

Definition at line 38 of file Ship2.h.

            : m_lCustomerId(0), m_lOrderId(0)
  {
  }

Member Function Documentation

HRESULT COShip2::InvokeNotifyIDispatch | ( | IUnknown * | punk,
 |  | long | lFlags |
 | ) |  |  | [private]

Definition at line 190 of file Ship2.Cpp.

{
  HRESULT hr = S_OK;

  MessageBox(NULL, "Inside InvokeNotifyIDispatch!", "Arghh!", MB_OK);
  CComQIPtr<IDispatch, &IID_IDispatch> pIDispatch(punkNotify);

  if (!pIDispatch) hr = E_NOINTERFACE;

  // Set CustomerId property

  if (SUCCEEDED(hr))
  {
    const int nNames = 1;

    OLECHAR * rgszNames[nNames] = { OLESTR("CustomerId") };
    DISPID    dispId[nNames];

    hr = pIDispatch->GetIDsOfNames( IID_NULL, rgszNames, nNames,
                    LOCALE_SYSTEM_DEFAULT, dispId);
    if (SUCCEEDED(hr))
    {
      CComVariant varData(m_lCustomerId);
      DISPID    dispidPut = DISPID_PROPERTYPUT;
      DISPPARAMS  dispparams = {&varData, &dispidPut, 1, 1};

      hr = pIDispatch->Invoke(dispId[0], IID_NULL, LOCALE_USER_DEFAULT,
                  DISPATCH_PROPERTYPUT, &dispparams, NULL, NULL, NULL);
    }
  }

  // Set OrderId property

  if (SUCCEEDED(hr))
  {
    const int nNames = 1;

    OLECHAR * rgszNames[nNames] = { OLESTR("OrderId") };
    DISPID    dispId[nNames];

    hr = pIDispatch->GetIDsOfNames( IID_NULL, rgszNames, nNames,
                    LOCALE_SYSTEM_DEFAULT, dispId);
    if (SUCCEEDED(hr))
    {
      CComVariant varData(m_lOrderId);
      DISPID    dispidPut = DISPID_PROPERTYPUT;
      DISPPARAMS  dispparams = {&varData, &dispidPut, 1, 1};

      hr = pIDispatch->Invoke(dispId[0], IID_NULL, LOCALE_USER_DEFAULT,
                  DISPATCH_PROPERTYPUT, &dispparams, NULL, NULL, NULL);
    }
  }

  // Call LineItem method once for each line item

  if (SUCCEEDED(hr))
  {
    const int nNames = 4;

    OLECHAR * rgszNames[nNames] = { OLESTR("LineItem"),   // method name
                      OLESTR("lItemId"),    // parm name
                      OLESTR("lQuantity"),
                      OLESTR("shipStatus") }; // parm name
    DISPID    dispId[nNames];

    hr = pIDispatch->GetIDsOfNames( IID_NULL, rgszNames, nNames,
                    LOCALE_SYSTEM_DEFAULT, dispId);

    for (int ix = 0; ix < m_veclItemId.size() && SUCCEEDED(hr); ix++)
    {
      const int nArgs = nNames - 1;

      CComVariant varData[nArgs];   // 2 Arguments
      varData[0] = m_veclItemId[ix];
      varData[1] = m_veclQuantity[ix];
      varData[2] = m_vecShipStatus[ix];

      DISPPARAMS dispparams = {varData, &dispId[1], nArgs, nArgs};

      hr = pIDispatch->Invoke(dispId[0], IID_NULL, LOCALE_USER_DEFAULT,
                  DISPATCH_METHOD, &dispparams, NULL, NULL, NULL);
    }
  }

  // Call Process method

  if (SUCCEEDED(hr))
  {
    const int nNames = 2;

    OLECHAR * rgszNames[nNames] = { OLESTR("Process"),    // method name
                      OLESTR("lFlags") };   // parm name
    DISPID    dispId[nNames];

    hr = pIDispatch->GetIDsOfNames( IID_NULL, rgszNames, nNames,
                    LOCALE_SYSTEM_DEFAULT, dispId);
    if (SUCCEEDED(hr))
    {
      const int nArgs = nNames - 1;

      CComVariant varData[nArgs]; // just the parameters
      varData[0] = lFlags;

      DISPPARAMS  dispparams = {varData, &dispId[1], nArgs, 0};

      hr = pIDispatch->Invoke(dispId[0], IID_NULL, LOCALE_USER_DEFAULT,
                  DISPATCH_METHOD, &dispparams, NULL, NULL, NULL);
    }
  }
  return hr;
}

HRESULT COShip2::InvokeNotifyVtable | ( | IUnknown * | punk,
 |  | long | lFlags |
 | ) |  |  | [private]

Definition at line 312 of file Ship2.Cpp.

{
  HRESULT hr = S_OK;

  CComQIPtr<INotify, &IID_INotify> pNotify(punkNotify);

  if (!pNotify) hr = E_NOINTERFACE;

  if (SUCCEEDED(hr)) hr = pNotify->put_CustomerId(m_lCustomerId);

  if (SUCCEEDED(hr)) hr = pNotify->put_OrderId(m_lOrderId);

  for (int ix = 0; ix < m_veclItemId.size() && SUCCEEDED(hr); ix++)
  {
    hr = pNotify->LineItem(m_veclItemId[ix], m_veclQuantity[ix], m_vecShipStatus[ix]);
  }

  if (SUCCEEDED(hr)) hr = pNotify->Process(lFlags);

  return hr;
}

STDMETHODIMP COShip2::LineItem | ( | long | lItemId,
 |  | long | lQuantity
 | ) |  |

Definition at line 66 of file Ship2.Cpp.

{
  m_veclItemId.push_back(lItemId);
  m_veclQuantity.push_back(lQuantity);
  m_vecShipStatus.push_back(RandomShipStatus());  // assign shipping status
  return S_OK;
}

HRESULT COShip2::NotifyRequestor | ( | long | lFlags,
 |  | IUnknown * | punkNotify |
 | ) |  |  | [private]

Definition at line 168 of file Ship2.Cpp.

{
  HRESULT hr = S_OK;

  if (lFlags & processFlagLateBound)
    hr = InvokeNotifyIDispatch(punkNotify, lFlags);
  else
    hr = InvokeNotifyVtable(punkNotify, lFlags);
  return hr;
}

STDMETHODIMP COShip2::Process | ( | long | lFlags,
 |  | IUnknown * | punk
 | ) |  |

Definition at line 84 of file Ship2.Cpp.

{
  HRESULT hr = S_OK;

  _RPT1(_CRT_WARN, "QCSamp2 %d Ship2\n", m_lOrderId);

  if (lFlags & processFlagWriteDB) hr = WriteShipDB();

  if (SUCCEEDED(hr)) hr = NotifyRequestor(lFlags, punk);

  // Invoke SetComplete or SetAbort depending on our success

  CComPtr<IObjectContext> pIObjectContext;

  if (SUCCEEDED(CoGetObjectContext(IID_IObjectContext, (void**)&pIObjectContext)))
  {
    if (SUCCEEDED(hr))  pIObjectContext->SetComplete();
    else        pIObjectContext->SetAbort();
  }

  return hr;
}

STDMETHODIMP COShip2::put_CustomerId ( long lCustomerId )

Definition at line 37 of file Ship2.Cpp.

{
  m_lCustomerId = lCustomerId;
  return S_OK;
}

STDMETHODIMP COShip2::put_OrderId ( long lOrderId )

Definition at line 51 of file Ship2.Cpp.

{
  m_lOrderId = lOrderId;
  return S_OK;
}

ShipStatus COShip2::RandomShipStatus ( ) [private]

Definition at line 346 of file Ship2.Cpp.

{
  const int iRandom = rand() % 100;

  if (iRandom < 80) return ssShipped;   // 80% are shipped
  if (iRandom < 93) return ssBackOrdered; // 13% are back ordered
  if (iRandom < 97) return ssNotStocked;  //  4% are not stocked
            return ssUnrecognizedItem;  //  3% have an invalid item number
}

HRESULT COShip2::WriteShipDB ( ) [private]

Definition at line 117 of file Ship2.Cpp.

{
  CComPtr<ADOConnection> pADOConnection;

  HRESULT hr = CoCreateInstance(  CLSID_CADOConnection, NULL, CLSCTX_INPROC_SERVER,
                  IID_IADOConnection, (void **) &pADOConnection);
  if (SUCCEEDED(hr))
  {
    // Connect to the Shipping Database. Names in DataSourceNames.h

    hr = pADOConnection->Open(  _bstr_t(pszShipDSN), _bstr_t(pszUserId),
                  _bstr_t(pszPassword), adOpenUnspecified);

    // Write one row per line item

    for (int ix = 0; ix < m_veclItemId.size() && SUCCEEDED(hr); ix++)
    {
      TCHAR szSQLStmt[1024];  // SQL statement buffer

      LPCTSTR pszPrototypeInsertStmt =
        _T("insert into QCSampleShip ")
        _T(" (order_id, cust_id, line_no, ")
        _T("  item_id, quantity, ship_status_enum) ")
        _T("values(%ld, %ld, %ld, %ld, %ld, %ld)");

      wsprintf( szSQLStmt,
            pszPrototypeInsertStmt,
            m_lOrderId,
            m_lCustomerId,
            ix,
            m_veclItemId[ix],
            m_veclQuantity[ix],
            m_vecShipStatus[ix]);

      hr = pADOConnection->Execute(_bstr_t(szSQLStmt), NULL, adCmdText, NULL);
    }
  }

  return hr;
}

Member Data Documentation

long COShip2::m_lCustomerId [private]

Definition at line 57 of file Ship2.h.

long COShip2::m_lOrderId [private]

Definition at line 58 of file Ship2.h.

std::vector<long> COShip2::m_veclItemId [private]

Definition at line 59 of file Ship2.h.

std::vector<long> COShip2::m_veclQuantity [private]

Definition at line 60 of file Ship2.h.

std::vector<ShipStatus> COShip2::m_vecShipStatus [private]

Definition at line 61 of file Ship2.h.

The documentation for this class was generated from the following files:
  • Com/Services/Queued_Components/QCSamp2/QCShip2/Ship2.h
  • Com/Services/Queued_Components/QCSamp2/QCShip2/Ship2.Cpp
Generated on Wed Nov 13 2024 16:57:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Counter Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

Counter Struct Reference

#include "Resources.h"

List of all members.

Public Attributes

LONG | Bound
LONG | Value

Detailed Description

Definition at line 12 of file Resources.h.

Member Data Documentation

LONG Counter::Bound

Definition at line 14 of file Resources.h.

LONG Counter::Value

Definition at line 13 of file Resources.h.

The documentation for this struct was generated from the following files:
  • NetDS/RPC/FileRep/FileRepAsyncPipe/Resources.h
  • NetDS/RPC/FileRep/filerepmultiuser/resources.h
Generated on Wed Nov 13 2024 16:57:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPack Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CPack Class Reference

#include "cpack.h"

List of all members.

Public Member Functions

CPack ()
~CPack ()
LPCWSTR | GetFileName ()
HRESULT | PackText (LPCWSTR wszText)
HRESULT | Upload (LPCWSTR wszJobName, LPCWSTR wszRemoteFile, BOOL fRequireUploadReply)

Private Member Functions

HRESULT | BuildRemoteUrl (IN LPCWSTR wszUploadDir, IN LPCWSTR wszTempFile, OUT WCHAR *wszRemoteUrl, DWORD cbRemoteUrl)
void | CloseTempFile ()
HRESULT | OpenTempFile ()
HRESULT | WriteWCharAsUTF8 (LPCWSTR wszText)
HRESULT | WriteWCharAsUTF8 (LPCWSTR wszText, DWORD cCharsToWrite)
HRESULT | WriteXMLString (LPCWSTR wszText)

Private Attributes

HANDLE m_hFile
WCHAR * | m_pwszFilename
WCHAR | m_wszTempFile [MAX_PATH+1]

Detailed Description

Definition at line 22 of file cpack.h.

Constructor & Destructor Documentation

CPack::CPack ( )

Definition at line 47 of file cpack.cpp.

{
    m_hFile = INVALID_HANDLE_VALUE;
    memset(m_wszTempFile, 0, sizeof(m_wszTempFile));
    m_pwszFilename = NULL;
}

CPack::~CPack ( )

Definition at line 54 of file cpack.cpp.

{
    if (m_hFile != INVALID_HANDLE_VALUE)
    {
        CloseHandle(m_hFile);
    }
}

Member Function Documentation

HRESULT CPack::BuildRemoteUrl | ( | IN LPCWSTR | wszUploadDir,
 |  | IN LPCWSTR | wszTempFile,
 |  | OUT WCHAR * | wszRemoteUrl,
 |  | DWORD | cbRemoteUrl |
 | ) |  |  | [private]

Definition at line 256 of file cpack.cpp.

{
    HRESULT hr;
    DWORD   cchRemoteUrl = (cbRemoteUrl/sizeof(WCHAR)) - 1; // this count shouldn't contain the NULL caracter
    WCHAR   wszXmlExt[]  = L".xml";
    WCHAR  *pStart       = NULL;
    WCHAR  *pEnd         = NULL;

    _ASSERT(wszRemoteUrl != NULL);
    _ASSERT((cbRemoteUrl == (INTERNET_MAX_URL_LENGTH*sizeof(WCHAR))));

    // clear the buffer
    memset(wszRemoteUrl, 0, cbRemoteUrl);

    // use the same filename as the temp file, and use the URL for the upload virtual directory
    // that was given by the user
    hr = UrlCombineW(wszUploadDir, m_pwszFilename, wszRemoteUrl, &cchRemoteUrl, URL_ESCAPE_UNSAFE);
    if (FAILED(hr))
    {
        goto cleanup;
    }

    // now change the extension
    pStart = wcsrchr(wszRemoteUrl, L'.');
    pEnd   = wszRemoteUrl + (cbRemoteUrl/sizeof(WCHAR)) - 1; // place the end at the last possible place for the \0.

    // make sure we have space to write our extension
    if (pStart && (static_cast<size_t>((pEnd - pStart)) >= wcslen(wszXmlExt)))
    {
        hr = StringCchCopyW(pStart, (pEnd - pStart), wszXmlExt);
        if (FAILED(hr))
        {
            goto cleanup;
        }
    }
    else
    {
        // should never happen
        hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
    }

cleanup:

    return hr;
}

void CPack::CloseTempFile ( ) [private]

Definition at line 362 of file cpack.cpp.

{
    if (m_hFile != INVALID_HANDLE_VALUE)
    {
        CloseHandle(m_hFile);
        m_hFile = INVALID_HANDLE_VALUE;
    }
}

LPCWSTR CPack::GetFileName ( )

Definition at line 245 of file cpack.cpp.

{
    return m_wszTempFile;
}

HRESULT CPack::OpenTempFile ( ) [private]

Definition at line 303 of file cpack.cpp.

{
    HRESULT hr = S_OK;
    WCHAR   wszTempDir[MAX_PATH+1] = {0};
    DWORD   dwLen = 0;

    dwLen = GetTempPathW(MAX_PATH, wszTempDir);
    if (dwLen == 0)
    {
        hr = HRESULT_FROM_WIN32(GetLastError());
        goto cleanup;
    }

    if (dwLen > MAX_PATH)
    {
        hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
        goto cleanup;
    }

    if (!GetTempFileName(
        wszTempDir,           // dir. for temp. files
        L"upl",               // temp. file name prefix
        0,                    // create unique name
        m_wszTempFile))       // buffer for name
    {
        hr = HRESULT_FROM_WIN32(GetLastError());
        goto cleanup;
    }

    // Get The filename part
    m_pwszFilename = wcsrchr(m_wszTempFile, L'\\');
    if (!m_pwszFilename)
    {
        hr = HRESULT_FROM_WIN32(ERROR_INVALID_NAME);
        goto cleanup;
    }
    m_pwszFilename++;

    m_hFile = CreateFile(
        m_wszTempFile,                // file name
        GENERIC_READ | GENERIC_WRITE, // open for read/write
        0,                            // do not share
        NULL,                         // no security
        CREATE_ALWAYS,                // overwrite existing file
        FILE_ATTRIBUTE_NORMAL,        // normal file
        NULL);                        // no attr. template

    if (m_hFile == INVALID_HANDLE_VALUE)
    {
        hr = HRESULT_FROM_WIN32(GetLastError());
    }

cleanup:

    return hr;
}

HRESULT CPack::PackText ( LPCWSTR wszText )

Definition at line 197 of file cpack.cpp.

{
    HRESULT hr = S_OK;
    WCHAR wszXMLTemplateStart[] = L""
        L"<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n"
        L"<uploadsample>\r\n"
        L"  <text>";
    WCHAR wszXMLTemplateEnd[] = L""
        L"</text>\r\n"
        L"</uploadsample>\r\n";

    hr = OpenTempFile();
    if (FAILED(hr))
    {
        goto cleanup;
    }

    hr = WriteWCharAsUTF8(wszXMLTemplateStart);
    if (FAILED(hr))
    {
        goto cleanup;
    }

    // we don't need to write anything if we weren't given any text
    if (wcslen(wszText) > 0)
    {
        hr = WriteXMLString(wszText);
        if (FAILED(hr))
        {
            goto cleanup;
        }
    }

    hr = WriteWCharAsUTF8(wszXMLTemplateEnd);
    if (FAILED(hr))
    {
        goto cleanup;
    }

    g_pDialog->AddStatusMessage(L"Packed edit box text in the temporary file %s", m_wszTempFile);

cleanup:

    CloseTempFile();

    return hr;
}

HRESULT CPack::Upload | ( | LPCWSTR | wszJobName,
 |  | LPCWSTR | wszRemoteFile,
 |  | BOOL | fRequireUploadReply
 | ) |  |

Definition at line 67 of file cpack.cpp.

{
    GUID         guid;
    BG_JOB_TYPE  jobtype;
    HRESULT      hr;
    CSmartComPtr<IBackgroundCopyJob> Job;
    WCHAR        wszRemoteUrl[INTERNET_MAX_URL_LENGTH] = {0};

    //
    // Prepare the remote URL name
    // No attempt is made to check the URL that was given by the user
    //
    hr = BuildRemoteUrl(wszUploadDir, m_pwszFilename, wszRemoteUrl, sizeof(wszRemoteUrl));
    if (FAILED(hr))
    {
        DisplayErrorMessage(L"Failed to build the remote URL for the upload job. \n"
                            L"Please verify that the URL given for the upload virtual directory is valid.", hr);
        goto cleanup;
    }

    //
    // Set the BITS job type -- we are only interested in upload job types
    //
    if (fRequestReply)
    {
        jobtype = BG_JOB_TYPE_UPLOAD_REPLY;
    }
    else
    {
        jobtype = BG_JOB_TYPE_UPLOAD;
    }

    //
    // Create an empty job with the BITS job manager
    // Note that even if the job name is not unique, we have a unique identifier (the returned guid value)
    //
    hr = g_JobManager->CreateJob(wszJobName, jobtype, &guid, &Job);
    if (FAILED(hr))
    {
        // handle the most common reason for the failure of this call
        if (hr == E_NOTIMPL)
        {
            DisplayErrorMessage(L"This application is not able to create a upload job with BITS.\n"
                                L"It is likely that the reason for that is that BITS 1.5 runtime binaries \n"
                                L"are not present in the system. Please see the file readme.htm installed \n"
                                L"with this SDK sample for instructions on how to install BITS 1.5.", hr);
        }
        else
        {
            DisplayErrorMessage(L"Failed to create the BITS upload job.", hr);
        }

        goto cleanup;
    }

    g_pDialog->AddStatusMessage(L"Created a new BITS upload job. Job ID is %s.", ConvertGuidToString(guid));

    //
    // Add a file to the job. This is the file that will be uploaded.
    //
    hr = Job->AddFile(wszRemoteUrl, m_wszTempFile);
    if (FAILED(hr))
    {
        DisplayErrorMessage(L"Failed to add file to the BITS upload job.", hr);
        goto cleanup;
    }

    g_pDialog->AddStatusMessage(L"Added a file to the job. (Job ID %s)", ConvertGuidToString(guid));

    //
    // Set the no-progress timeout value to be 60 seconds. The default, if we don't set it, is 14 days.
    // We want to set this to a small value so that transient errors will fall back to errors quickly.
    //
    // The idea here is that we are using this app to test and experiment with the BITS API in a
    // controlled environment, so it is reasonable to assume that the server and network are readily
    // accessible, and if not, we want to be notified of the problem quickly. We could have also
    // set NoProgressTimeout to zero.
    //
    // In a real app, it is better to leverage BITS' ability to retry jobs that are in transient error,
    // because sporadic network connectivity problems are indeed common, specially for file transfers
    // across the Internet. For this to happen, the job timeout has to be greater than 2 min, otherwise
    // BITS will not attempt retries.
    //
    hr = Job->SetNoProgressTimeout(60);
    if (FAILED(hr))
    {
        DisplayErrorMessage(L"Failed to set the timeout value for transient errors.", hr);
        goto cleanup;
    }

    //
    // Kick off the job!!
    //
    hr = Job->Resume();
    if (FAILED(hr))
    {
        DisplayErrorMessage(L"Failed to resume the BITS upload job.", hr);
        goto cleanup;
    }

    g_pDialog->AddStatusMessage(L"Upload job activated. (Job ID %s)", ConvertGuidToString(guid));

    //
    // Make sure we receive notifications for the status of the job,
    // so we can call Job->Complete() and have the job effectively uploaded
    //
    hr = Job->SetNotifyInterface(&g_NotificationReceiver);
    if (FAILED(hr))
    {
        DisplayErrorMessage(L"Failed to set a notification callback.", hr);
        goto cleanup;
    }

    //
    // Well, ideally we just want to wait for JOB_TRANSFERRED, but errors
    // might happen so we want to act upon those as well
    //
    hr = Job->SetNotifyFlags(BG_NOTIFY_JOB_TRANSFERRED | BG_NOTIFY_JOB_ERROR | BG_NOTIFY_JOB_MODIFICATION);
    if (FAILED(hr))
    {
        DisplayErrorMessage(L"Failed to set a notification callback.", hr);
        goto cleanup;
    }

cleanup:

    return hr;
}

HRESULT CPack::WriteWCharAsUTF8 ( LPCWSTR wszText ) [private]

Definition at line 419 of file cpack.cpp.

{
    return WriteWCharAsUTF8(wszText, static_cast<DWORD>(wcslen(wszText)));
}

HRESULT CPack::WriteWCharAsUTF8 | ( | LPCWSTR | wszText,
 |  | DWORD | cCharsToWrite |
 | ) |  |  | [private]

Definition at line 371 of file cpack.cpp.

{
    HRESULT hr              = S_OK;
    CHAR    *szBuf          = NULL;
    INT     cchBuf          = 0;
    INT     cchWritten      = 0;
    DWORD   cbWrittenToFile = 0;

    _ASSERT(wszText != NULL);
    _ASSERT(cCharsToWrite > 0 && cCharsToWrite <= MAX_BUFFER_SIZE);

    cchBuf  = (cCharsToWrite + 1) * 3;    // UTF-8 can convert one WCHAR into 3 bytes

    szBuf = new CHAR[cchBuf];
    if (!szBuf)
    {
        hr = E_OUTOFMEMORY;
        goto cleanup;
    }

    cchWritten = WideCharToMultiByte(CP_UTF8, 0, wszText, cCharsToWrite, szBuf, cchBuf, NULL, NULL);
    if (cchWritten == 0)   // function failed
    {
        hr = HRESULT_FROM_WIN32(GetLastError());
        goto cleanup;
    }

    // null-terminate the string
    szBuf[cchWritten] = 0;

    // write the string
    if (!WriteFile(m_hFile, szBuf, (cchWritten * sizeof(CHAR)), &cbWrittenToFile, NULL))
    {
        hr = HRESULT_FROM_WIN32(GetLastError());
        goto cleanup;
    }

cleanup:

    if (szBuf)
    {
        delete [] szBuf;
        szBuf = NULL;
    }

    return hr;
}

HRESULT CPack::WriteXMLString ( LPCWSTR wszText ) [private]

Definition at line 424 of file cpack.cpp.

{
    WCHAR *pwszRemainder = NULL;
    WCHAR *pchSpecial    = NULL;
    WCHAR *pchEnd        = NULL;
    HRESULT hr = S_OK;

    _ASSERT(wszText != NULL);
    INT   cchText        = static_cast<INT>(wcslen(wszText));

    _ASSERT(cchText > 0 && cchText <= MAX_BUFFER_SIZE);

    pwszRemainder = const_cast<WCHAR *>(wszText);
    pchSpecial    = wcsstr(wszText, L"<>&'\"");
    pchEnd        = (const_cast<WCHAR *>(wszText) + cchText);

    while (pchSpecial)
    {
        if (pchSpecial > pwszRemainder)
        {
            hr = WriteWCharAsUTF8(pwszRemainder, static_cast<DWORD>((pchSpecial - pwszRemainder)));
            if (FAILED(hr))
            {
                goto cleanup;
            }
        }

        switch (*pchSpecial)
        {
            case L'<':   WriteWCharAsUTF8(L"&lt;");      break;
            case L'>':   WriteWCharAsUTF8(L"&gt;");      break;
            case L'&':   WriteWCharAsUTF8(L"&amp;");     break;
            case L'\'':  WriteWCharAsUTF8(L"&apos;");    break;
            case L'"':   WriteWCharAsUTF8(L"&quot;");    break;

            default:
                // should never get here
                _ASSERT(0);
        }

        pwszRemainder = pchSpecial + 1;
        pchSpecial = wcsstr(pwszRemainder, L"<>&'\"");
    }

    if (pwszRemainder < pchEnd)
    {
        hr = WriteWCharAsUTF8(pwszRemainder, static_cast<DWORD>((pchEnd - pwszRemainder)));
        if (FAILED(hr))
        {
            goto cleanup;
        }
    }

cleanup:

    return hr;
}

Member Data Documentation

HANDLE CPack::m_hFile [private]

Definition at line 26 of file cpack.h.

WCHAR* CPack::m_pwszFilename [private]

Definition at line 25 of file cpack.h.

WCHAR CPack::m_wszTempFile[MAX_PATH+1] [private]

Definition at line 24 of file cpack.h.

The documentation for this class was generated from the following files:
  • Web/bits/Upload/cpack.h
  • Web/bits/Upload/cpack.cpp
Generated on Wed Nov 13 2024 16:57:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPage Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Protected Attributes

CPage Class Reference

#include "Grid.Hxx"

List of all members.

Public Member Functions

CPage (HINSTANCE hInst, CPageFormat &pf, UINT nPage=0)
~CPage ()
UINT | Hittest (POINT pt)
void | Paint (CCanvas &canvas, RECT rc)
void | SetFont (HFONT hfont)
void | SetFormat (UINT fuFormat=HEXADECIMAL)

Protected Member Functions

UINT InitPage (UINT nPage)

Protected Attributes

CBlockFrame * | _apBlock [4]
POINT | _aptBlock [4]
UINT _cBlock
HINSTANCE | _hInst
CCodeGrid _PageHeadL
CCodeGrid _PageHeadR
CCodeGrid _PageNums
CPageFormat & _pf

Detailed Description

Definition at line 220 of file Grid.Hxx.

Constructor & Destructor Documentation

CPage::CPage | ( | HINSTANCE | hInst,
 |  | CPageFormat & | pf,
 |  | UINT | nPage = 0
 | ) |  |

Definition at line 560 of file Grid.Cxx.

                                                         :
    _cBlock(0),
    _pf(pf),
    _hInst(hInst),
    _PageHeadL (1, 1, pf._size,nPage*256      ),
    _PageHeadR (1, 1, pf._size,(nPage+1)*256-1),
    _PageNums  (1, 1, pf._size,nPage+1        )
                                // page numbers are 1 based on output
{
    // Set up page elementss

    _PageHeadL.SetFont(pf._fontLabel);
    _PageHeadR.SetFont(pf._fontLabel);
    _PageNums.SetFont(pf._fontPageNum);

    InitPage( nPage);
    SetFormat(_pf._fuFormat);
}

CPage::~CPage ( )

Definition at line 579 of file Grid.Cxx.

{
    while( _cBlock )
    {
        delete _apBlock[--_cBlock];
    }
}

Member Function Documentation

UINT CPage::Hittest ( POINT pt )

Definition at line 621 of file Grid.Cxx.

{
    UINT uHit = 0xFFFF;

    for( UINT i = 0; i < _cBlock && uHit ==0xFFFF ; ++i )
    {
        uHit = _apBlock[i]->Hittest(_aptBlock[i], ptTest);
    }
    return uHit;
}

UINT CPage::InitPage ( UINT nPage ) [protected]

Definition at line 634 of file Grid.Cxx.

{
    UINT iEnd = 0;
    TCHAR szBlockHeader[40];
    UINT i;
    POINT ptBlock=_pf._pt;

    // Set up blocks

    for( i=0; i < sizeof(aBlockWidth)/sizeof(UINT); i++ )
    {
        if( nPage*16 < (iEnd+=aBlockWidth[i]) )
        {
            break;
        }
    }
    UINT iStart = max(nPage*16, iEnd-aBlockWidth[i]);

    do
    {
        LoadString(_hInst, i, szBlockHeader, 40);
        _apBlock[_cBlock]= new CBlockFrame(
                  min( aBlockWidth[i],      // grid width in columns
                       (nPage+1)*16-iStart),// (but at most to end of page)
                  16,                       // cRow always 16
                  ptBlock,                  // grid origin
                  iStart*16,                // first char offset
                  szBlockHeader,            // header string
                  _pf);                     // common formatting

        _aptBlock[_cBlock] = ptBlock;
        _cBlock++;

        ptBlock.x+=_pf._size.cx*aBlockWidth[i];
        iStart=iEnd;
    }
    while(
            (i++ < sizeof(aBlockWidth)/sizeof(UINT))
                &&
            ((nPage+1)*16 >= (iEnd+=aBlockWidth[i]))
                &&
            (_cBlock < 4)
         );

    return _cBlock;
}

void CPage::Paint | ( | CCanvas & | canvas,
 |  | RECT | rc
 | ) |  |

Definition at line 606 of file Grid.Cxx.

{
    for( UINT i = 0; i < _cBlock; ++i )
    {
        _apBlock[i]->Paint(canvas, rc, _aptBlock[i]);
    }

    if( _pf._fuFormat & PAGEELEMS )
    {
        _PageHeadL.Paint(canvas, rc, _pf._ptPE[0]);
        _PageHeadR.Paint(canvas, rc, _pf._ptPE[1]);
        _PageNums.Paint (canvas, rc, _pf._ptPE[2]);
    }
}

void CPage::SetFont ( HFONT hfont )

Definition at line 683 of file Grid.Cxx.

{
    for( UINT i = 0; i < _cBlock ; ++i )
    {
        _apBlock[i]->SetFont(hfont);
    }
}

void CPage::SetFormat ( UINT fuFormat = HEXADECIMAL )

Definition at line 589 of file Grid.Cxx.

{
    // set it
    _pf.SetFormat(fuFormat);

    // apply it
    for( UINT i = 0; i < _cBlock ; ++i )
    {
        _apBlock[i]->SetFormat(fuFormat&MASKROOT);
    }

    _PageHeadL.SetFormat(HEXADECIMAL, 4);
    _PageHeadR.SetFormat(HEXADECIMAL, 4);
    _PageNums.SetFormat(DECIMAL);
}

Member Data Documentation

CBlockFrame* CPage::_apBlock[4] [protected]

Definition at line 237 of file Grid.Hxx.

POINT CPage::_aptBlock[4] [protected]

Definition at line 238 of file Grid.Hxx.

UINT CPage::_cBlock [protected]

Definition at line 236 of file Grid.Hxx.

HINSTANCE CPage::_hInst [protected]

Definition at line 233 of file Grid.Hxx.

CCodeGrid CPage::_PageHeadL [protected]

Definition at line 241 of file Grid.Hxx.

CCodeGrid CPage::_PageHeadR [protected]

Definition at line 240 of file Grid.Hxx.

CCodeGrid CPage::_PageNums [protected]

Definition at line 242 of file Grid.Hxx.

CPageFormat& CPage::_pf [protected]

Definition at line 234 of file Grid.Hxx.

The documentation for this class was generated from the following files:
  • Multimedia/Gdi/Fonts/GridFont/Grid.Hxx
  • Multimedia/Gdi/Fonts/GridFont/Grid.Cxx
Generated on Wed Nov 13 2024 16:57:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPageFormat Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CPageFormat Class Reference

#include "Grid.Hxx"

Inherits CFrameFormat.

List of all members.

Public Member Functions

CPageFormat (UINT fuFormat)
void | SetFormat (UINT fuFormat=HEXADECIMAL)

Public Attributes

CFont _fontPageNum
UINT _fuFormat
POINT | _pt
POINT | _ptPE [3]

Detailed Description

Definition at line 167 of file Grid.Hxx.

Constructor & Destructor Documentation

CPageFormat::CPageFormat ( UINT fuFormat )

Definition at line 520 of file Grid.Cxx.

                                      :
    _fontPageNum (TEXT("Times New Roman"), -10, FALSE)
{
    _size.cx =  4*INCH2/5;
    _size.cy =  INCH2;

    SetFormat(fuFormat);
}

Member Function Documentation

void CPageFormat::SetFormat ( UINT fuFormat = HEXADECIMAL )

Definition at line 529 of file Grid.Cxx.

{
    _fuFormat = fuFormat;

    if( fuFormat & PAGEPRINT )
    {
        _pt.x=     INCH2+(INCH2*7)/10;
        _pt.y=     INCH1+(INCH1*7)/10;
    }
    else
    {
        _pt.x=     INCH2;
        _pt.y=     INCH1;
    }

    // locations of headers / footers
    _ptPE[0].x = _pt.x-_size.cx;
    _ptPE[0].y = _size.cy/2;
    _ptPE[1].x = _pt.x+_size.cx*16;
    _ptPE[1].y = _size.cy/2;
    _ptPE[2].x = _pt.x+(_size.cx*15)/2;
    _ptPE[2].y = _pt.y+(_size.cy*33)/2;
}

Member Data Documentation

CFont CPageFormat::_fontPageNum

Definition at line 173 of file Grid.Hxx.

UINT CPageFormat::_fuFormat

Reimplemented from CBlockFormat.

Definition at line 174 of file Grid.Hxx.

POINT CPageFormat::_pt

Definition at line 176 of file Grid.Hxx.

POINT CPageFormat::_ptPE[3]

Definition at line 175 of file Grid.Hxx.

The documentation for this class was generated from the following files:
  • Multimedia/Gdi/Fonts/GridFont/Grid.Hxx
  • Multimedia/Gdi/Fonts/GridFont/Grid.Cxx
Generated on Wed Nov 13 2024 16:57:02 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPaintCanvas Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CPaintCanvas Class Reference

#include "Canvas.Hxx"

Inherits CCanvas.

List of all members.

Public Member Functions

CPaintCanvas (HWND hwnd)
~CPaintCanvas ()
RECT | GetRect ()

Protected Attributes

HWND | _hwnd
PAINTSTRUCT | _paint

Detailed Description

Definition at line 145 of file Canvas.Hxx.

Constructor & Destructor Documentation

CPaintCanvas::CPaintCanvas ( HWND hwnd ) [inline]

Definition at line 148 of file Canvas.Hxx.

                              : _hwnd(hwnd)
    {
        BeginPaint ( _hwnd, &_paint );
        Init ( _paint.hdc );
    }

CPaintCanvas::~CPaintCanvas ( ) [inline]

Definition at line 154 of file Canvas.Hxx.

    {
        EndPaint(_hwnd, &_paint );
    }

Member Function Documentation

RECT CPaintCanvas::GetRect ( ) [inline]

Definition at line 159 of file Canvas.Hxx.

{ return _paint.rcPaint; };

Member Data Documentation

HWND CPaintCanvas::_hwnd [protected]

Definition at line 163 of file Canvas.Hxx.

PAINTSTRUCT CPaintCanvas::_paint [protected]

Definition at line 159 of file Canvas.Hxx.

The documentation for this class was generated from the following file:
  • Multimedia/Gdi/Fonts/GridFont/Canvas.Hxx
Generated on Wed Nov 13 2024 16:57:02 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CParameters Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CParameters Class Reference

#include "ccommand.h"

List of all members.

Public Member Functions

CParameters ()
~CParameters ()
HRESULT | Attach (DB_UPARAMS cParamSets, HACCESSOR hAccessor, DBLENGTH cbRowSize)
CBindings & GetBindings ()
void * | GetData (DB_UPARAMS iParamSet)
DBPARAMS & | GetParams ()
DBLENGTH | GetRowSize ()
void | RemoveAll ()

Protected Attributes

CBindings m_Bindings
DBLENGTH | m_cbRowSize
DBPARAMS | m_Params

Detailed Description

Definition at line 29 of file ccommand.h.

Constructor & Destructor Documentation

CParameters::CParameters ( ) [inline]

Definition at line 33 of file ccommand.h.

  {
    memset(&m_Params, 0, sizeof(DBPARAMS));
    m_cbRowSize = 0;
  }

CParameters::~CParameters ( ) [inline]

Definition at line 38 of file ccommand.h.

  {
    RemoveAll();
  }

Member Function Documentation

HRESULT CParameters::Attach | ( | DB_UPARAMS | cParamSets,
 |  | HACCESSOR | hAccessor,
 |  | DBLENGTH | cbRowSize |
 | ) |  |  | [inline]

Definition at line 54 of file ccommand.h.

  {
    HRESULT hr = S_OK;
    ASSERT(hAccessor != DB_NULL_HACCESSOR);

    m_Params.cParamSets = cParamSets;
    m_Params.hAccessor    = hAccessor;
    m_cbRowSize       = cbRowSize;

    //Also allocate memory
    SAFE_ALLOC(m_Params.pData, BYTE, cbRowSize * cParamSets);

  CLEANUP:
    return hr;
  }

CBindings& CParameters::GetBindings ( ) [inline]

Definition at line 84 of file ccommand.h.

{ return m_Bindings;        }

void* CParameters::GetData ( DB_UPARAMS iParamSet ) [inline]

Definition at line 70 of file ccommand.h.

  {
    ASSERT(iParamSet < m_Params.cParamSets);

    //Simple case
    if(m_Params.cParamSets == 1)
      return m_Params.pData;

    //Otherwise
    ASSERT(m_cbRowSize);
    return (BYTE*)m_Params.pData + (m_cbRowSize*iParamSet);
  }

DBPARAMS& CParameters::GetParams ( ) [inline]

Definition at line 85 of file ccommand.h.

{ return m_Params;          }

DBLENGTH CParameters::GetRowSize ( ) [inline]

Definition at line 83 of file ccommand.h.

{ return m_cbRowSize;       }

void CParameters::RemoveAll ( ) [inline]

Definition at line 43 of file ccommand.h.

  {
    //Release everything else...
    m_Params.cParamSets = 0;
    SAFE_FREE(m_Params.pData);
    m_cbRowSize = 0;

    //Bindings
    m_Bindings.RemoveAll();
  }

Member Data Documentation

CBindings CParameters::m_Bindings [protected]

Definition at line 91 of file ccommand.h.

DBLENGTH CParameters::m_cbRowSize [protected]

Definition at line 89 of file ccommand.h.

DBPARAMS CParameters::m_Params [protected]

Definition at line 90 of file ccommand.h.

The documentation for this class was generated from the following file:
  • Dataaccess/oledb/rowsetviewer/ccommand.h
Generated on Wed Nov 13 2024 16:57:02 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPartitionInfo Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CPartitionInfo Class Reference

#include "CPartitionInfo.h"

Inherits IWMIServices, IWMIObject, IPartitionProperties, and CMgdClusCfgInit.

List of all members.

Public Member Functions

CPartitionInfo (void)
virtual | ~CPartitionInfo (void)
END_COM_MAP ()
STDMETHOD() | GetDescription (BSTR *pbstrDescriptionOut)
STDMETHOD() | GetDriveLetterMappings (SDriveLetterMapping *pdlmDriveLetterUsageOut)
STDMETHOD() | GetName (BSTR *pbstrNameOut)
STDMETHOD() | GetSize (ULONG *pcMegaBytes)
STDMETHOD() | GetUID (BSTR *pbstrUIDOut)
STDMETHOD() | HrGetFriendlyName (BSTR *pbstrNameOut)
STDMETHOD() | HrIsNTFS (void)
STDMETHOD() | HrIsThisLogicalDisk (WCHAR cLogicalDisk)
STDMETHOD() | HrSetDeviceID (BSTR bstrDeviceIDIn)
STDMETHOD() | SetDescription (LPCWSTR bstrDescriptionIn)
STDMETHOD() | SetDriveLetterMappings (SDriveLetterMapping dlmDriveLetterMappingIn)
STDMETHOD() | SetName (LPCWSTR bstrNameIn)
STDMETHOD() | SetWbemObject (IWbemClassObject *pPartitionIn, BOOL *pfRetainObjectOut)
STDMETHOD() | SetWbemServices (IWbemServices *pIWbemServicesIn)

Private Member Functions

CPartitionInfo (const CPartitionInfo &nodeSrc)
HRESULT | HrAddLogicalDiskToArray (IWbemClassObject *pDiskIn)
HRESULT | HrGetLogicalDisks (IWbemClassObject *pPartitionIn)
HRESULT | HrLogLogicalDiskInfo (IWbemClassObject *pLogicalDiskIn, BSTR bstrDeviceIDIn)
const CPartitionInfo & | operator= (const CPartitionInfo &nodeSrc)

Private Attributes

BSTR | m_bstrDescription
BSTR | m_bstrDiskDeviceID
BSTR | m_bstrName
BSTR | m_bstrUID
LONG | m_cRef
ULONG m_idxNextLogicalDisk
LCID | m_lcid
IWbemServices * | m_pIWbemServices
IUnknown *(* | m_prgLogicalDisks )[]
ULONG m_ulPartitionSize

Detailed Description

Definition at line 50 of file CPartitionInfo.h.

Constructor & Destructor Documentation

CPartitionInfo::CPartitionInfo ( const CPartitionInfo & nodeSrc ) [private]
CPartitionInfo::CPartitionInfo ( void )

Definition at line 49 of file CPartitionInfo.cpp.

    : m_cRef( 1 )
{
    m_pIWbemServices = NULL;
    m_bstrName = NULL;
    m_bstrDescription = NULL;
    m_bstrUID = NULL;
    m_prgLogicalDisks = NULL;
    m_idxNextLogicalDisk = 0;
    m_ulPartitionSize = 0;
    m_bstrDiskDeviceID = NULL;

} //*** CPartitionInfo::CPartitionInfo

CPartitionInfo::~CPartitionInfo ( void ) [virtual]

Definition at line 83 of file CPartitionInfo.cpp.

{
    ULONG   idx;

    SysFreeString( m_bstrName );
    SysFreeString( m_bstrDescription );
    SysFreeString( m_bstrUID );
    SysFreeString( m_bstrDiskDeviceID );

    for ( idx = 0; idx < m_idxNextLogicalDisk; idx++ )
    {
        ((*m_prgLogicalDisks)[ idx ])->Release();
    } // for:

    HeapFree( GetProcessHeap(), 0, m_prgLogicalDisks );

    if ( m_pIWbemServices != NULL )
    {
        m_pIWbemServices->Release();
    } // if:

} //*** CPartitionInfo::~CPartitionInfo

Member Function Documentation

CPartitionInfo::END_COM_MAP ( )
STDMETHODIMP CPartitionInfo::GetDescription ( BSTR * pbstrDescriptionOut )

Definition at line 512 of file CPartitionInfo.cpp.

{
    HRESULT hr = S_OK;

    if ( pbstrDescriptionOut == NULL )
    {
        hr = E_POINTER;
        STATUS_REPORT_REF(
                  TASKID_Major_Find_Devices
                , TASKID_Minor_PartitionInfo_GetDescription_Pointer
                , IDS_ERROR_NULL_POINTER
                , IDS_ERROR_NULL_POINTER_REF
                , hr
                );
        goto Cleanup;
    } // if:

    if ( m_bstrDescription == NULL )
    {
        hr = S_FALSE;
        goto Cleanup;
    } // if:

    *pbstrDescriptionOut = SysAllocString( m_bstrDescription );
    if (*pbstrDescriptionOut == NULL )
    {
        hr = E_OUTOFMEMORY;
        STATUS_REPORT_REF(
                  TASKID_Major_Find_Devices
                , TASKID_Minor_PartitionInfo_GetDescription_Memory
                , IDS_ERROR_OUTOFMEMORY
                , IDS_ERROR_OUTOFMEMORY_REF
                , hr
                );
    } // if:

Cleanup:

    return hr;

} //*** CPartitionInfo::GetDescription

STDMETHODIMP CPartitionInfo::GetDriveLetterMappings ( SDriveLetterMapping * pdlmDriveLetterUsageOut )

Definition at line 630 of file CPartitionInfo.cpp.

{
    HRESULT             hr = S_FALSE;
    IWbemClassObject *  pLogicalDisk = NULL;
    VARIANT             var;
    ULONG               idx;
    int                 idxDrive;

    VariantInit( & var );

    if ( pdlmDriveLetterMappingOut == NULL )
    {
        hr = E_POINTER;
        STATUS_REPORT_REF(
                  TASKID_Major_Find_Devices
                , TASKID_Minor_GetDriveLetterMappings_Partition
                , IDS_ERROR_NULL_POINTER
                , IDS_ERROR_NULL_POINTER_REF
                , hr
                );
        goto Cleanup;
    } // if:

    for ( idx = 0; idx < m_idxNextLogicalDisk; idx++ )
    {
        hr = ((*m_prgLogicalDisks)[ idx ])->TypeSafeQI( IWbemClassObject, &pLogicalDisk );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:

        VariantClear( &var );

        hr = HrGetWMIProperty( pLogicalDisk, L"Name", VT_BSTR, &var );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:

        CharUpper( var.bstrVal );

        idxDrive = var.bstrVal[ 0 ] - 'A';

        VariantClear( &var );

        hr = HrGetWMIProperty( pLogicalDisk, L"DriveType", VT_I4, &var );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:

        pdlmDriveLetterMappingOut->dluDrives[ idxDrive ] = (EDriveLetterUsage) var.iVal;

        pLogicalDisk->Release();
        pLogicalDisk = NULL;
    } // for:

Cleanup:

    VariantClear( &var );

    if ( pLogicalDisk != NULL )
    {
        pLogicalDisk->Release();
    } // if:

    return hr;

} //*** CPartitionInfo::GetDriveLetterMappings

STDMETHODIMP CPartitionInfo::GetName ( BSTR * pbstrNameOut )

Definition at line 402 of file CPartitionInfo.cpp.

{
    HRESULT hr = S_OK;

    if ( pbstrNameOut == NULL )
    {
        hr = E_POINTER;
        STATUS_REPORT_REF(
                  TASKID_Major_Find_Devices
                , TASKID_Minor_PartitionInfo_GetName_Pointer
                , IDS_ERROR_NULL_POINTER
                , IDS_ERROR_NULL_POINTER_REF
                , hr
                );
        goto Cleanup;
    } // if:

    //
    //  If we don't have a name then simply return S_FALSE to
    //  indicate that we have no data.
    //

    if ( m_bstrName == NULL )
    {
        hr = S_FALSE;
        goto Cleanup;
    } // if:

    *pbstrNameOut = SysAllocString( m_bstrName );
    if (*pbstrNameOut == NULL )
    {
        hr = E_OUTOFMEMORY;
        STATUS_REPORT_REF(
                  TASKID_Major_Find_Devices
                , TASKID_Minor_GetName_Memory
                , IDS_ERROR_OUTOFMEMORY
                , IDS_ERROR_OUTOFMEMORY_REF
                , hr
                );
    } // if:

Cleanup:

    return hr;

} //*** CPartitionInfo::GetName

STDMETHODIMP CPartitionInfo::GetSize ( ULONG * pcMegaBytes )

Definition at line 763 of file CPartitionInfo.cpp.

{
    HRESULT hr = S_OK;

    if ( pcMegaBytes == NULL )
    {
        hr = E_POINTER;
        STATUS_REPORT_REF(
                  TASKID_Major_Find_Devices
                , TASKID_Minor_GetSize
                , IDS_ERROR_NULL_POINTER
                , IDS_ERROR_NULL_POINTER_REF
                , hr
                );
        goto Cleanup;
    } // if:

    *pcMegaBytes = m_ulPartitionSize;

Cleanup:

    return hr;

} //*** CPartitionInfo::GetSize

STDMETHODIMP CPartitionInfo::GetUID ( BSTR * pbstrUIDOut )

Definition at line 326 of file CPartitionInfo.cpp.

{
    HRESULT hr = S_OK;

    if ( pbstrUIDOut == NULL )
    {
        hr = E_POINTER;
        STATUS_REPORT_REF(
                  TASKID_Major_Find_Devices
                , TASKID_Minor_PartitionInfo_GetUID_Pointer
                , IDS_ERROR_NULL_POINTER
                , IDS_ERROR_NULL_POINTER_REF
                , hr
                );
        goto Cleanup;
    } // if:

    //
    //  If we don't have a UID then simply return S_FALSE to
    //  indicate that we have no data.
    //

    if ( m_bstrUID == NULL )
    {
        hr = S_FALSE;
        goto Cleanup;
    } // if:

    *pbstrUIDOut = SysAllocString( m_bstrUID );
    if ( *pbstrUIDOut == NULL )
    {
        hr = E_OUTOFMEMORY;
        STATUS_REPORT_REF(
                  TASKID_Major_Find_Devices
                , TASKID_Minor_PartitionInfo_GetUID_Memory
                , IDS_ERROR_OUTOFMEMORY
                , IDS_ERROR_OUTOFMEMORY_REF
                , hr
                );
    } // if:

Cleanup:

    return hr;

} //*** CPartitionInfo::GetUID

HRESULT CPartitionInfo::HrAddLogicalDiskToArray ( IWbemClassObject * pDiskIn ) [private]

Definition at line 1209 of file CPartitionInfo.cpp.

{
    HRESULT     hr = S_OK;
    IUnknown *  punk;
    IUnknown *  ((*prgpunks)[]) = NULL;

    prgpunks = (IUnknown *((*)[])) HEAPREALLOC( m_prgLogicalDisks, sizeof( IUnknown * ) * ( m_idxNextLogicalDisk + 1 ), HEAP_ZERO_MEMORY );
    if ( prgpunks == NULL )
    {
        hr = E_OUTOFMEMORY;
        STATUS_REPORT_REF(
                  TASKID_Major_Find_Devices
                , TASKID_Minor_HrAddLogicalDiskToArray
                , IDS_ERROR_OUTOFMEMORY
                , IDS_ERROR_OUTOFMEMORY_REF
                , hr
                );
        goto Cleanup;
    } // else:

    m_prgLogicalDisks = prgpunks;

    hr = pLogicalDiskIn->TypeSafeQI( IUnknown, &punk );
    if ( SUCCEEDED( hr ) )
    {
        (*m_prgLogicalDisks)[ m_idxNextLogicalDisk++ ] = punk;
    } // if:

Cleanup:

    return hr;

} //*** CPartitionInfo::HrAddLogicalDiskToArray

STDMETHODIMP CPartitionInfo::HrGetFriendlyName ( BSTR * pbstrNameOut )

Definition at line 1015 of file CPartitionInfo.cpp.

{
    HRESULT             hr = S_FALSE;
    DWORD               idx;
    IWbemClassObject *  piwco = NULL;
    WCHAR *             pwsz = NULL;
    WCHAR *             pwszTmp = NULL;
    DWORD               cch = 0;
    VARIANT             var;

    VariantInit( &var );

    if ( m_idxNextLogicalDisk == 0 )
    {
        goto Cleanup;
    } // if:

    if ( pbstrNameOut == NULL )
    {
        hr = E_POINTER;
        STATUS_REPORT_REF(
                  TASKID_Major_Find_Devices
                , TASKID_Minor_GetFriendlyName
                , IDS_ERROR_NULL_POINTER
                , IDS_ERROR_NULL_POINTER_REF
                , hr
                );
        goto Cleanup;
    } // if:

    for ( idx = 0; idx < m_idxNextLogicalDisk; idx++ )
    {
        hr = ((*m_prgLogicalDisks)[ idx ])->TypeSafeQI( IWbemClassObject, &piwco );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:

        hr = HrGetWMIProperty( piwco, L"DeviceID", VT_BSTR, &var );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:

        cch += ( UINT ) wcslen( var.bstrVal ) + 2;                      // a space and the '\0'

        pwszTmp = (WCHAR *) HEAPREALLOC( pwsz, sizeof( WCHAR ) * cch, HEAP_ZERO_MEMORY );
        if ( pwszTmp == NULL  )
        {
            goto OutOfMemory;
        } // if:

        pwsz = pwszTmp;
        pwszTmp = NULL;

        hr = StringCchCatW( pwsz, cch, L" " );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:

        hr = StringCchCatW( pwsz, cch, var.bstrVal );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:

        VariantClear( &var );

        piwco->Release();
        piwco = NULL;
    } // for:

    *pbstrNameOut = SysAllocString( pwsz );
    if ( *pbstrNameOut == NULL )
    {
        goto OutOfMemory;
    } // if:

    goto Cleanup;

OutOfMemory:

    hr = E_OUTOFMEMORY;
    STATUS_REPORT_REF(
              TASKID_Major_Find_Devices
            , TASKID_Minor_HrGetFriendlyName
            , IDS_ERROR_OUTOFMEMORY
            , IDS_ERROR_OUTOFMEMORY_REF
            , hr
            );

Cleanup:

    VariantClear( &var );

    if ( piwco != NULL )
    {
        piwco->Release();
    } // if:

    if ( pwsz != NULL )
    {
        HeapFree( GetProcessHeap(), 0, pwsz );
    } // if:

    if ( pwszTmp != NULL )
    {
        HeapFree( GetProcessHeap(), 0, pwszTmp );
    } // if:

    return hr;

} //*** CPartitionInfo::HrGetFriendlyName

HRESULT CPartitionInfo::HrGetLogicalDisks ( IWbemClassObject * pPartitionIn ) [private]

Definition at line 1274 of file CPartitionInfo.cpp.

{
    HRESULT                 hr;
    VARIANT                 var;
    WCHAR                   szBuf[ 256 ];
    IEnumWbemClassObject *  pLogicalDisks = NULL;
    IWbemClassObject *      pLogicalDisk = NULL;
    ULONG                   ulReturned;
    BSTR                    bstrQuery = NULL;
    BSTR                    bstrWQL = NULL;

    VariantInit( &var );

    bstrWQL = SysAllocString( L"WQL" );
    if ( bstrWQL == NULL )
    {
        hr = E_OUTOFMEMORY;
        STATUS_REPORT_REF(
                  TASKID_Major_Find_Devices
                , TASKID_Minor_HrGetLogicalDisks
                , IDS_ERROR_OUTOFMEMORY
                , IDS_ERROR_OUTOFMEMORY_REF
                , hr
                );
        goto Cleanup;
    } // if:

    //
    //  Need to enum the logical disk(s) of this partition to determine if it is booted
    //  bootable.
    //
    hr = HrGetWMIProperty( pPartitionIn, L"DeviceID", VT_BSTR, &var );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    hr = StringCchPrintfW(
                      szBuf
                    , RTL_NUMBER_OF( szBuf )
                    , L"Associators of {Win32_DiskPartition.DeviceID='%ws'} where AssocClass=Win32_LogicalDiskToPartition"
                    , var.bstrVal
                    );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    bstrQuery = SysAllocString( szBuf );
    if ( bstrQuery == NULL )
    {
        hr = E_OUTOFMEMORY;
        STATUS_REPORT_REF(
                  TASKID_Major_Find_Devices
                , TASKID_Minor_HrGetLogicalDisks
                , IDS_ERROR_OUTOFMEMORY
                , IDS_ERROR_OUTOFMEMORY_REF
                , hr
                );
        goto Cleanup;
    } // if:

    hr = m_pIWbemServices->ExecQuery( bstrWQL, bstrQuery, WBEM_FLAG_FORWARD_ONLY, NULL, &pLogicalDisks );
    if ( FAILED( hr ) )
    {
        STATUS_REPORT_REF(
              TASKID_Major_Find_Devices
            , TASKID_Minor_WMI_Logical_Disks_Qry_Failed
            , IDS_ERROR_WMI_DISKS_QRY_FAILED
            , IDS_ERROR_WMI_DISKS_QRY_FAILED_REF
            , hr
            );
        goto Cleanup;
    } // if:

    for ( ; ; )
    {
        hr = pLogicalDisks->Next( WBEM_INFINITE, 1, &pLogicalDisk, &ulReturned );
        if ( ( hr == S_OK ) && ( ulReturned == 1 ) )
        {
            HrLogLogicalDiskInfo( pLogicalDisk, var.bstrVal );
            hr = HrAddLogicalDiskToArray( pLogicalDisk );
            if ( FAILED( hr ) )
            {
                goto Cleanup;
            } // if:

            pLogicalDisk->Release();
            pLogicalDisk = NULL;
        } // if:
        else if ( ( hr == S_FALSE ) && ( ulReturned == 0 ) )
        {
            hr = S_OK;
            break;
        } // else if:
        else
        {
            STATUS_REPORT_STRING_REF(
                      TASKID_Major_Find_Devices
                    , TASKID_Minor_HrGetLogicalDisks_Next
                    , IDS_ERROR_WQL_QRY_NEXT_FAILED
                    , bstrQuery
                    , IDS_ERROR_WQL_QRY_NEXT_FAILED_REF
                    , hr
                    );
            goto Cleanup;
        } // else:
    } // for:

Cleanup:

    VariantClear( &var );

    SysFreeString( bstrQuery );
    SysFreeString( bstrWQL );

    if ( pLogicalDisk != NULL )
    {
        pLogicalDisk->Release();
    } // if:

    if ( pLogicalDisks != NULL )
    {
        pLogicalDisks->Release();
    } // if:

    return hr;

} //*** CPartitionInfo::HrGetLogicalDisks

STDMETHODIMP CPartitionInfo::HrIsNTFS ( void )

Definition at line 913 of file CPartitionInfo.cpp.

{
    HRESULT             hr = S_FALSE;
    VARIANT             var;
    ULONG               idx;
    IWbemClassObject *  piwco = NULL;

    VariantInit( &var );

    for ( idx = 0; idx < m_idxNextLogicalDisk; idx++ )
    {
        hr = ((*m_prgLogicalDisks)[ idx ])->TypeSafeQI( IWbemClassObject, &piwco );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:

        VariantClear( &var );

        hr = HrGetWMIProperty( piwco, L"FileSystem", VT_BSTR, &var );
        if ( ( hr == E_PROPTYPEMISMATCH ) && ( var.vt == VT_NULL ) )
        {
            VariantClear( &var );

            hr = S_FALSE;
            HrGetWMIProperty( piwco, L"DeviceID", VT_BSTR, &var );
            STATUS_REPORT_STRING_REF(
                      TASKID_Major_Find_Devices
                    , TASKID_Minor_Disk_No_File_System
                    , IDS_ERROR_DISK_NO_FILE_SYSTEM
                    , var.bstrVal
                    , IDS_ERROR_DISK_NO_FILE_SYSTEM_REF
                    , hr
                    );
            break;
        } // if:
        else if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // else if:

        if ( NIStringCompareW( var.bstrVal, SysStringLen( var.bstrVal ), L"NTFS", RTL_NUMBER_OF( L"NTFS" ) ) != 0 )
        {
            VariantClear( &var );

            hr = S_FALSE;
            HrGetWMIProperty( piwco, L"DeviceID", VT_BSTR, &var );
            STATUS_REPORT_STRING_REF(
                      TASKID_Major_Find_Devices
                    , TASKID_Minor_Disk_Not_NTFS
                    , IDS_WARN_DISK_NOT_NTFS
                    , var.bstrVal
                    , IDS_WARN_DISK_NOT_NTFS_REF
                    , hr
                    );
            break;
        } // if:

        piwco->Release();
        piwco = NULL;
    } // for:

Cleanup:

    VariantClear( &var );

    if ( piwco != NULL )
    {
        piwco->Release();
    } // if:

    return hr;

} //*** CPartitionInfo::HrIsNTFS

STDMETHODIMP CPartitionInfo::HrIsThisLogicalDisk ( WCHAR cLogicalDisk )

Definition at line 824 of file CPartitionInfo.cpp.

{
    HRESULT             hr = S_FALSE;
    DWORD               idx;
    IWbemClassObject *  piwco = NULL;
    VARIANT             var;
    bool                fFoundIt = false;

    VariantInit( &var );

    if ( m_idxNextLogicalDisk == 0 )
    {
        goto Cleanup;
    } // if:

    for ( idx = 0; idx < m_idxNextLogicalDisk; idx++ )
    {
        hr = ((*m_prgLogicalDisks)[ idx ])->TypeSafeQI( IWbemClassObject, &piwco );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:

        hr = HrGetWMIProperty( piwco, L"DeviceID", VT_BSTR, &var );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:

        if ( cLogicalDiskIn == var.bstrVal[ 0 ] )
        {
            fFoundIt = true;
            break;
        } // if:

        VariantClear( &var );

        piwco->Release();
        piwco = NULL;
    } // for:

    if ( !fFoundIt )
    {
        hr = S_FALSE;
    } // if:

Cleanup:

    VariantClear( &var );

    if ( piwco != NULL )
    {
        piwco->Release();
    } // if:

    return hr;

} //*** CPartitionInfo::HrIsThisLogicalDisk

HRESULT CPartitionInfo::HrLogLogicalDiskInfo | ( | IWbemClassObject * | pLogicalDiskIn,
 |  | BSTR | bstrDeviceIDIn |
 | ) |  |  | [private]

Definition at line 1433 of file CPartitionInfo.cpp.

{
    assert( m_bstrDiskDeviceID != NULL );
    assert( pLogicalDiskIn != NULL );
    assert( bstrDeviceIDIn != NULL );

    HRESULT hr = S_OK;
    VARIANT var;

    VariantInit( &var );

    if ( ( pLogicalDiskIn == NULL ) || ( bstrDeviceIDIn == NULL ) )
    {
        hr = E_INVALIDARG;
        goto Cleanup;
    } // if:

    hr = HrGetWMIProperty( pLogicalDiskIn, L"Name", VT_BSTR, &var );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    LOG_STATUS_REPORT_STRING4(
                  L"Found %1!ws! resource \"%2!ws!\" with partition \"%3!ws!\" which has the logical disk \"%3!ws!\"."
                , GetResTypeName()
                , m_bstrDiskDeviceID
                , bstrDeviceIDIn
                , var.bstrVal
                , hr
                );

Cleanup:

    VariantClear( &var );

    return hr;

} //*** CPartitionInfo::HrLogLogicalDiskInfo

HRESULT CPartitionInfo::HrSetDeviceID ( BSTR bstrDeviceIDIn )

Definition at line 1158 of file CPartitionInfo.cpp.

{
    HRESULT hr = S_OK;

    if ( bstrDeviceIDIn != NULL )
    {
        m_bstrDiskDeviceID = SysAllocString( bstrDeviceIDIn );
        if ( m_bstrDiskDeviceID == NULL )
        {
            hr = E_OUTOFMEMORY;
        } // if:
    } // if:

    return hr;

} //*** CPartitionInfo::HrSetDeviceID

const CPartitionInfo& CPartitionInfo::operator= ( const CPartitionInfo & nodeSrc ) [private]
STDMETHODIMP CPartitionInfo::SetDescription ( LPCWSTR bstrDescriptionIn )

Definition at line 582 of file CPartitionInfo.cpp.

{
    HRESULT hr;

    if ( pcszDescriptionIn == NULL )
    {
        hr = E_INVALIDARG;
    } // if:
    else
    {
        hr = E_NOTIMPL;
    } // else:

    return hr;

} //*** CPartitionInfo::SetDescription

STDMETHODIMP CPartitionInfo::SetDriveLetterMappings ( SDriveLetterMapping dlmDriveLetterMappingIn )

Definition at line 725 of file CPartitionInfo.cpp.

{
    HRESULT hr = E_NOTIMPL;

    UNREFERENCED_PARAMETER( dlmDriveLetterMappingIn );

    return hr;

} //*** CPartitionInfo::SetDriveLetterMappings

STDMETHODIMP CPartitionInfo::SetName ( LPCWSTR bstrNameIn )

Definition at line 474 of file CPartitionInfo.cpp.

{
    HRESULT hr = E_NOTIMPL;

    UNREFERENCED_PARAMETER( pcszNameIn );

    return hr;

} //*** CPartitionInfo::SetName

HRESULT CPartitionInfo::SetWbemObject | ( | IWbemClassObject * | pPartitionIn,
 |  | BOOL * | pfRetainObjectOut
 | ) |  |

Definition at line 199 of file CPartitionInfo.cpp.

{
    assert( pPartitionIn != NULL );
    assert( pfRetainObjectOut != NULL );

    HRESULT     hr = S_OK;
    VARIANT     var;
    ULONGLONG   ull = 0;
    int         cch = 0;

    VariantInit( &var );

    hr = HrGetWMIProperty( pPartitionIn, L"Description", VT_BSTR, &var );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    m_bstrDescription = SysAllocString( var.bstrVal );
    if ( m_bstrDescription == NULL )
    {
        goto OutOfMemory;
    } // if:

    VariantClear( &var );

    hr = HrGetWMIProperty( pPartitionIn, L"DeviceID", VT_BSTR, &var );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    m_bstrUID = SysAllocString( var.bstrVal );
    if ( m_bstrUID == NULL )
    {
        goto OutOfMemory;
    } // if:

    VariantClear( &var );

    hr = HrGetWMIProperty( pPartitionIn, L"Name", VT_BSTR, &var );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    m_bstrName = SysAllocString( var.bstrVal );
    if ( m_bstrName == NULL )
    {
        goto OutOfMemory;
    } // if:

    VariantClear( &var );

    hr = HrGetWMIProperty( pPartitionIn, L"Size", VT_BSTR, &var );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    cch = swscanf( var.bstrVal, L"%I64u", &ull );
    assert( cch > 0 );

    m_ulPartitionSize = (ULONG) ( ull / ( 1024 * 1024 ) );

    hr = HrGetLogicalDisks( pPartitionIn );

    *pfRetainObjectOut = true;

    goto Cleanup;

OutOfMemory:

    hr = E_OUTOFMEMORY;
    STATUS_REPORT_REF(
              TASKID_Major_Find_Devices
            , TASKID_Minor_SetWbemObject_Partition
            , IDS_ERROR_OUTOFMEMORY
            , IDS_ERROR_OUTOFMEMORY_REF
            , hr
            );

Cleanup:

    VariantClear( &var );

    return hr;

} //*** CPartitionInfo::SetWbemObject

STDMETHODIMP CPartitionInfo::SetWbemServices ( IWbemServices * pIWbemServicesIn )

Definition at line 137 of file CPartitionInfo.cpp.

{
    HRESULT hr = S_OK;

    if ( pIWbemServicesIn == NULL )
    {
        hr = E_POINTER;
        STATUS_REPORT_REF(
                  TASKID_Major_Find_Devices
                , TASKID_Minor_SetWbemServices_Partition
                , IDS_ERROR_NULL_POINTER
                , IDS_ERROR_NULL_POINTER_REF
                , hr
                );
        goto Cleanup;
    } // if:

    m_pIWbemServices = pIWbemServicesIn;
    m_pIWbemServices->AddRef();

Cleanup:

    return hr;

} //*** CPartitionInfo::SetWbemServices

Member Data Documentation

BSTR CPartitionInfo::m_bstrDescription [private]

Definition at line 86 of file CPartitionInfo.h.

BSTR CPartitionInfo::m_bstrDiskDeviceID [private]

Definition at line 90 of file CPartitionInfo.h.

BSTR CPartitionInfo::m_bstrName [private]

Definition at line 84 of file CPartitionInfo.h.

BSTR CPartitionInfo::m_bstrUID [private]

Definition at line 85 of file CPartitionInfo.h.

LONG CPartitionInfo::m_cRef [private]

Definition at line 81 of file CPartitionInfo.h.

ULONG CPartitionInfo::m_idxNextLogicalDisk [private]

Definition at line 88 of file CPartitionInfo.h.

LCID CPartitionInfo::m_lcid [private]

Reimplemented from CMgdClusCfgInit.

Definition at line 82 of file CPartitionInfo.h.

IWbemServices* CPartitionInfo::m_pIWbemServices [private]

Definition at line 83 of file CPartitionInfo.h.

IUnknown*(* CPartitionInfo::m_prgLogicalDisks)[] [private]

Definition at line 87 of file CPartitionInfo.h.

ULONG CPartitionInfo::m_ulPartitionSize [private]

Definition at line 89 of file CPartitionInfo.h.

The documentation for this class was generated from the following files:
  • WinBase/Cluster/Win2003/MyStorageResource/CPartitionInfo.h
  • WinBase/Cluster/Win2003/MyStorageResource/CPartitionInfo.cpp
Generated on Wed Nov 13 2024 16:57:02 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPeoplePoweredVehicle Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Types | Private Attributes | Static Private Attributes

CPeoplePoweredVehicle Class Reference

#include "people.h"

Inherits CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, and CDelegationBase.

List of all members.

Public Member Functions

CPeoplePoweredVehicle (CComponentData *pComponentData=NULL)
CPeoplePoweredVehicle ()
CPeoplePoweredVehicle ()
CPeoplePoweredVehicle (CComponentData *pComponentData=NULL)
CPeoplePoweredVehicle ()
CPeoplePoweredVehicle ()
CPeoplePoweredVehicle ()
CPeoplePoweredVehicle ()
CPeoplePoweredVehicle ()
CPeoplePoweredVehicle ()
CPeoplePoweredVehicle ()
CPeoplePoweredVehicle ()
CPeoplePoweredVehicle ()
virtual | ~CPeoplePoweredVehicle ()
virtual | ~CPeoplePoweredVehicle ()
virtual | ~CPeoplePoweredVehicle ()
virtual | ~CPeoplePoweredVehicle ()
virtual | ~CPeoplePoweredVehicle ()
virtual | ~CPeoplePoweredVehicle ()
virtual | ~CPeoplePoweredVehicle ()
virtual | ~CPeoplePoweredVehicle ()
virtual | ~CPeoplePoweredVehicle ()
virtual | ~CPeoplePoweredVehicle ()
virtual | ~CPeoplePoweredVehicle ()
virtual | ~CPeoplePoweredVehicle ()
virtual | ~CPeoplePoweredVehicle ()
virtual HRESULT | Expand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual HSCOPEITEM | GetParentScopeItem ()
virtual HRESULT | OnExpand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
virtual HRESULT | OnExpand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
virtual HRESULT | OnExpand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
virtual HRESULT | OnExpand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
virtual HRESULT | OnExpand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
virtual HRESULT | OnExpand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
virtual HRESULT | OnExpand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
virtual HRESULT | OnExpand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
virtual HRESULT | OnExpand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
virtual HRESULT | OnExpand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
virtual HRESULT | OnExpand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
virtual HRESULT | OnExpand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
virtual void | SetScopeItemValue (HSCOPEITEM hscopeitem)

Private Types

enum | { IDM_NEW_PEOPLE = 1 }
enum | { NUMBER_OF_CHILDREN = 4 }
enum | { IDM_NEW_PEOPLE = 1 }
enum | { NUMBER_OF_CHILDREN = 4 }
enum | { IDM_NEW_PEOPLE = 1 }
enum | { NUMBER_OF_CHILDREN = 4 }
enum | { IDM_NEW_PEOPLE = 1 }
enum | { NUMBER_OF_CHILDREN = 4 }
enum | { IDM_NEW_PEOPLE = 1 }
enum | { NUMBER_OF_CHILDREN = 4 }
enum | { IDM_NEW_PEOPLE = 1 }
enum | { NUMBER_OF_CHILDREN = 4 }
enum | { IDM_NEW_PEOPLE = 1 }
enum | { NUMBER_OF_CHILDREN = 4 }
enum | { IDM_NEW_PEOPLE = 1 }
enum | { NUMBER_OF_CHILDREN = 4 }
enum | { IDM_NEW_PEOPLE = 1 }
enum | { NUMBER_OF_CHILDREN = 4 }
enum | { IDM_NEW_PEOPLE = 1 }
enum | { NUMBER_OF_CHILDREN = 4 }
enum | { IDM_NEW_PEOPLE = 1 }
enum | { NUMBER_OF_CHILDREN = 4 }
enum | { IDM_NEW_PEOPLE = 1 }
enum | { NUMBER_OF_CHILDREN = 4 }
enum | { IDM_NEW_PEOPLE = 1 }
enum | { NUMBER_OF_CHILDREN = 4 }

Private Attributes

CPerson * | children [NUMBER_OF_CHILDREN]
CDelegationBase * | children [3]
HSCOPEITEM | m_hParentHScopeItem

Static Private Attributes

static const GUID | thisGuid = { 0x2974380d, 0x4c4b, 0x11d2, { 0x89, 0xd8, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28 } }

Detailed Description

Definition at line 55 of file people.h.

Member Enumeration Documentation

anonymous enum [private]
Enumerator:
IDM_NEW_PEOPLE

Definition at line 67 of file people.h.

{ IDM_NEW_PEOPLE = 1 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 74 of file people.h.

{ NUMBER_OF_CHILDREN = 4 };

anonymous enum [private]
Enumerator:
IDM_NEW_PEOPLE

Definition at line 148 of file people.h.

{ IDM_NEW_PEOPLE = 1 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 153 of file people.h.

{ NUMBER_OF_CHILDREN = 3 };

anonymous enum [private]
Enumerator:
IDM_NEW_PEOPLE

Definition at line 163 of file people.h.

{ IDM_NEW_PEOPLE = 1 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 170 of file people.h.

{ NUMBER_OF_CHILDREN = 3 };

anonymous enum [private]
Enumerator:
IDM_NEW_PEOPLE

Definition at line 156 of file people.h.

{ IDM_NEW_PEOPLE = 1 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 161 of file people.h.

{ NUMBER_OF_CHILDREN = 3 };

anonymous enum [private]
Enumerator:
IDM_NEW_PEOPLE

Definition at line 148 of file people.h.

{ IDM_NEW_PEOPLE = 1 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 153 of file people.h.

{ NUMBER_OF_CHILDREN = 3 };

anonymous enum [private]
Enumerator:
IDM_NEW_PEOPLE

Definition at line 148 of file people.h.

{ IDM_NEW_PEOPLE = 1 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 153 of file people.h.

{ NUMBER_OF_CHILDREN = 3 };

anonymous enum [private]
Enumerator:
IDM_NEW_PEOPLE

Definition at line 156 of file people.h.

{ IDM_NEW_PEOPLE = 1 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 161 of file people.h.

{ NUMBER_OF_CHILDREN = 3 };

anonymous enum [private]
Enumerator:
IDM_NEW_PEOPLE

Definition at line 156 of file people.h.

{ IDM_NEW_PEOPLE = 1 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 161 of file people.h.

{ NUMBER_OF_CHILDREN = 3 };

anonymous enum [private]
Enumerator:
IDM_NEW_PEOPLE

Definition at line 148 of file people.h.

{ IDM_NEW_PEOPLE = 1 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 153 of file people.h.

{ NUMBER_OF_CHILDREN = 3 };

anonymous enum [private]
Enumerator:
IDM_NEW_PEOPLE

Definition at line 148 of file people.h.

{ IDM_NEW_PEOPLE = 1 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 153 of file people.h.

{ NUMBER_OF_CHILDREN = 3 };

anonymous enum [private]
Enumerator:
IDM_NEW_PEOPLE

Definition at line 182 of file people.h.

{ IDM_NEW_PEOPLE = 1 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 187 of file people.h.

{ NUMBER_OF_CHILDREN = 3 };

anonymous enum [private]
Enumerator:
IDM_NEW_PEOPLE

Definition at line 148 of file people.h.

{ IDM_NEW_PEOPLE = 1 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 153 of file people.h.

{ NUMBER_OF_CHILDREN = 3 };

anonymous enum [private]
Enumerator:
IDM_NEW_PEOPLE

Definition at line 225 of file people.h.

{ IDM_NEW_PEOPLE = 1 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 230 of file people.h.

{ NUMBER_OF_CHILDREN = 3 };

Constructor & Destructor Documentation

CPeoplePoweredVehicle::CPeoplePoweredVehicle ( CComponentData * pComponentData = NULL )

Definition at line 34 of file people.Cpp.

{
    m_pComponentData = pComponentData;

    for (int n = 0; n < NUMBER_OF_CHILDREN; n++) {
        children[n] = new CPerson(n, pComponentData);
        children[n]->Initialize(_T("Fred"), 6, 2, 115, n % 2 == 0 ? TRUE : FALSE);
    }
}

CPeoplePoweredVehicle::~CPeoplePoweredVehicle ( ) [virtual]

Definition at line 44 of file people.Cpp.

{
    for (int n = 0; n < NUMBER_OF_CHILDREN; n++)
        if (children[n]) {
            delete children[n];
        }
}

CPeoplePoweredVehicle::CPeoplePoweredVehicle ( )

Definition at line 39 of file people.Cpp.

{
    children[0] = new CBicycleFolder;
    children[1] = new CSkateboardFolder;
    children[2] = new CIceSkateFolder;
}

virtual CPeoplePoweredVehicle::~CPeoplePoweredVehicle ( ) [virtual]
CPeoplePoweredVehicle::CPeoplePoweredVehicle ( )
virtual CPeoplePoweredVehicle::~CPeoplePoweredVehicle ( ) [virtual]
CPeoplePoweredVehicle::CPeoplePoweredVehicle ( )
virtual CPeoplePoweredVehicle::~CPeoplePoweredVehicle ( ) [virtual]
CPeoplePoweredVehicle::CPeoplePoweredVehicle ( )
virtual CPeoplePoweredVehicle::~CPeoplePoweredVehicle ( ) [virtual]
CPeoplePoweredVehicle::CPeoplePoweredVehicle ( )
virtual CPeoplePoweredVehicle::~CPeoplePoweredVehicle ( ) [virtual]
CPeoplePoweredVehicle::CPeoplePoweredVehicle ( )
virtual CPeoplePoweredVehicle::~CPeoplePoweredVehicle ( ) [virtual]
CPeoplePoweredVehicle::CPeoplePoweredVehicle ( )
virtual CPeoplePoweredVehicle::~CPeoplePoweredVehicle ( ) [virtual]
CPeoplePoweredVehicle::CPeoplePoweredVehicle ( )
virtual CPeoplePoweredVehicle::~CPeoplePoweredVehicle ( ) [virtual]
CPeoplePoweredVehicle::CPeoplePoweredVehicle ( )
virtual CPeoplePoweredVehicle::~CPeoplePoweredVehicle ( ) [virtual]
CPeoplePoweredVehicle::CPeoplePoweredVehicle ( )
virtual CPeoplePoweredVehicle::~CPeoplePoweredVehicle ( ) [virtual]
CPeoplePoweredVehicle::CPeoplePoweredVehicle ( CComponentData * pComponentData = NULL )
virtual CPeoplePoweredVehicle::~CPeoplePoweredVehicle ( ) [virtual]
CPeoplePoweredVehicle::CPeoplePoweredVehicle ( )
virtual CPeoplePoweredVehicle::~CPeoplePoweredVehicle ( ) [virtual]

Member Function Documentation

HRESULT CPeoplePoweredVehicle::Expand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 52 of file people.Cpp.

{
    SCOPEDATAITEM sdi;

    if (!bExpanded) {
        // create the child nodes, then expand them
        for (int n = 0; n < NUMBER_OF_CHILDREN; n++) {
            ZeroMemory(&sdi, sizeof(SCOPEDATAITEM) );
            sdi.mask = SDI_STR       |   // Displayname is valid
                SDI_PARAM     |   // lParam is valid
                SDI_IMAGE     |   // nImage is valid
                SDI_OPENIMAGE |   // nOpenImage is valid
                SDI_PARENT    |
                SDI_CHILDREN;

            sdi.relativeID  = (HSCOPEITEM)parent;
            sdi.nImage      = children[n]->GetBitmapIndex();
            sdi.nOpenImage  = children[n]->GetBitmapIndex();
            sdi.displayname = MMC_CALLBACK;
            sdi.lParam      = (LPARAM)children[n];       // The cookie
            sdi.cChildren   = 0;

            HRESULT hr = pConsoleNameSpace->InsertItem( &sdi );

            _ASSERT( SUCCEEDED(hr) );
        }
    }

    return S_OK;
}

virtual const int CPeoplePoweredVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 62 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CPeoplePoweredVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 151 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CPeoplePoweredVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 151 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CPeoplePoweredVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 143 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CPeoplePoweredVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 155 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CPeoplePoweredVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 143 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CPeoplePoweredVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 143 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CPeoplePoweredVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 177 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CPeoplePoweredVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 143 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CPeoplePoweredVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 143 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CPeoplePoweredVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 143 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CPeoplePoweredVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 220 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CPeoplePoweredVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 151 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const _TCHAR* CPeoplePoweredVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 141 of file people.h.

{ return _T("People-powered Vehicles"); }

virtual const _TCHAR* CPeoplePoweredVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 153 of file people.h.

{ return _T("People-powered Vehicles"); }

virtual const _TCHAR* CPeoplePoweredVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 141 of file people.h.

{ return _T("People-powered Vehicles"); }

virtual const _TCHAR* CPeoplePoweredVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 141 of file people.h.

{ return _T("People-powered Vehicles"); }

virtual const _TCHAR* CPeoplePoweredVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 141 of file people.h.

{ return _T("People-powered Vehicles"); }

virtual const _TCHAR* CPeoplePoweredVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 175 of file people.h.

{ return _T("People-powered Vehicles"); }

virtual const _TCHAR* CPeoplePoweredVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 141 of file people.h.

{ return _T("People-powered Vehicles"); }

virtual const _TCHAR* CPeoplePoweredVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 141 of file people.h.

{ return _T("People-powered Vehicles"); }

virtual const _TCHAR* CPeoplePoweredVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 218 of file people.h.

{ return _T("People-powered Vehicles"); }

virtual const _TCHAR* CPeoplePoweredVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 149 of file people.h.

{ return _T("People-powered Vehicles"); }

virtual const _TCHAR* CPeoplePoweredVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 60 of file people.h.

{ return _T("People-powered Vehicles"); }

virtual const _TCHAR* CPeoplePoweredVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 149 of file people.h.

{ return _T("People-powered Vehicles"); }

virtual const _TCHAR* CPeoplePoweredVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 149 of file people.h.

{ return _T("People-powered Vehicles"); }

virtual const GUID& CPeoplePoweredVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 142 of file people.h.

{ return thisGuid; }

virtual const GUID& CPeoplePoweredVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 150 of file people.h.

{ return thisGuid; }

virtual const GUID& CPeoplePoweredVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 150 of file people.h.

{ return thisGuid; }

virtual const GUID& CPeoplePoweredVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 219 of file people.h.

{ return thisGuid; }

virtual const GUID& CPeoplePoweredVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 142 of file people.h.

{ return thisGuid; }

virtual const GUID& CPeoplePoweredVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 61 of file people.h.

{ return thisGuid; }

virtual const GUID& CPeoplePoweredVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 142 of file people.h.

{ return thisGuid; }

virtual const GUID& CPeoplePoweredVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 142 of file people.h.

{ return thisGuid; }

virtual const GUID& CPeoplePoweredVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 154 of file people.h.

{ return thisGuid; }

virtual const GUID& CPeoplePoweredVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 142 of file people.h.

{ return thisGuid; }

virtual const GUID& CPeoplePoweredVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 142 of file people.h.

{ return thisGuid; }

virtual const GUID& CPeoplePoweredVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 176 of file people.h.

{ return thisGuid; }

virtual const GUID& CPeoplePoweredVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 150 of file people.h.

{ return thisGuid; }

virtual HSCOPEITEM CPeoplePoweredVehicle::GetParentScopeItem ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 160 of file people.h.

{ return m_hParentHScopeItem; }

virtual HRESULT CPeoplePoweredVehicle::OnExpand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CPeoplePoweredVehicle::OnExpand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CPeoplePoweredVehicle::OnExpand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CPeoplePoweredVehicle::OnExpand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CPeoplePoweredVehicle::OnExpand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CPeoplePoweredVehicle::OnExpand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CPeoplePoweredVehicle::OnExpand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CPeoplePoweredVehicle::OnExpand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CPeoplePoweredVehicle::OnExpand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CPeoplePoweredVehicle::OnExpand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CPeoplePoweredVehicle::OnExpand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

HRESULT CPeoplePoweredVehicle::OnExpand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 52 of file people.Cpp.

{
    SCOPEDATAITEM sdi;

    if (!bExpanded) {
        // create the child nodes, then expand them
        for (int n = 0; n < NUMBER_OF_CHILDREN; n++) {
            ZeroMemory(&sdi, sizeof(SCOPEDATAITEM) );
            sdi.mask = SDI_STR       |   // Displayname is valid
                SDI_PARAM     |   // lParam is valid
                SDI_IMAGE     |   // nImage is valid
                SDI_OPENIMAGE |   // nOpenImage is valid
                SDI_PARENT    |   // relativeID is valid
                SDI_CHILDREN;     // cChildren is valid

            sdi.relativeID  = (HSCOPEITEM)parent;
            sdi.nImage      = children[n]->GetBitmapIndex();
            sdi.nOpenImage  = INDEX_OPENFOLDER;
            sdi.displayname = MMC_CALLBACK;
            sdi.lParam      = (LPARAM)children[n];       // The cookie
            sdi.cChildren   = 0;

            HRESULT hr = pConsoleNameSpace->InsertItem( &sdi );

            _ASSERT( SUCCEEDED(hr) );
        }
    }

    return S_OK;
}

virtual void CPeoplePoweredVehicle::SetScopeItemValue ( HSCOPEITEM hscopeitem ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 159 of file people.h.

{ m_hParentHScopeItem = hscopeitem; }

Member Data Documentation

CDelegationBase * CPeoplePoweredVehicle::children [private]

Definition at line 75 of file people.h.

CDelegationBase* CPeoplePoweredVehicle::children[3] [private]

Definition at line 154 of file people.h.

HSCOPEITEM CPeoplePoweredVehicle::m_hParentHScopeItem [private]

Definition at line 168 of file people.h.

static const GUID CPeoplePoweredVehicle::thisGuid = { 0x2974380d, 0x4c4b, 0x11d2, { 0x89, 0xd8, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28 } } [static, private]

Reimplemented from CDelegationBase.

Definition at line 70 of file people.h.

The documentation for this class was generated from the following files:
  • SysMgmt/MMC/ActiveX/people.h
  • SysMgmt/MMC/CMenu/people.h
  • SysMgmt/MMC/Complete/people.h
  • SysMgmt/MMC/CutCopy/people.h
  • SysMgmt/MMC/Extens/people.h
  • SysMgmt/MMC/Menubtn/people.h
  • SysMgmt/MMC/Multisel/people.h
  • SysMgmt/MMC/Nodes/people.h
  • SysMgmt/MMC/Openserv/people.h
  • SysMgmt/MMC/Proppage/people.h
  • SysMgmt/MMC/Taskpads/people.h
  • SysMgmt/MMC/Toolbar/people.h
  • SysMgmt/MMC/WMI/people.h
  • SysMgmt/MMC/ActiveX/people.Cpp
  • SysMgmt/MMC/CMenu/people.Cpp
  • SysMgmt/MMC/Complete/people.Cpp
  • SysMgmt/MMC/CutCopy/people.Cpp
  • SysMgmt/MMC/Extens/people.Cpp
  • SysMgmt/MMC/Menubtn/people.Cpp
  • SysMgmt/MMC/Multisel/people.Cpp
  • SysMgmt/MMC/Nodes/people.Cpp
  • SysMgmt/MMC/Openserv/people.Cpp
  • SysMgmt/MMC/Proppage/people.Cpp
  • SysMgmt/MMC/Taskpads/people.Cpp
  • SysMgmt/MMC/Toolbar/people.Cpp
  • SysMgmt/MMC/WMI/people.Cpp
Generated on Wed Nov 13 2024 16:57:02 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPermEventsApp Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CPermEventsApp Class Reference

#include "PermEvents.h"

Inherits CWinApp.

List of all members.

Public Member Functions

CPermEventsApp ()
int | ExitInstance ()
virtual BOOL | InitInstance ()

Private Member Functions

void | RegisterServer (void)
void | UnregisterServer (void)

Private Attributes

DWORD m_clsReg
CProviderFactory * m_factory

Detailed Description

Definition at line 33 of file PermEvents.h.

Constructor & Destructor Documentation

CPermEventsApp::CPermEventsApp ( )

Definition at line 41 of file PermEvents.Cpp.

{
  // TODO: add construction code here,
  // Place all significant initialization in InitInstance
  m_clsReg = 0;
}

Member Function Documentation

int CPermEventsApp::ExitInstance ( void ) [virtual]

Reimplemented from CWinApp.

Definition at line 169 of file PermEvents.Cpp.

{
  if(m_clsReg)
  {
    HRESULT hres = CoRevokeClassObject(m_clsReg);

    CoUninitialize();
  }

  return CWinApp::ExitInstance();
}

BOOL CPermEventsApp::InitInstance ( void ) [virtual]

Reimplemented from CWinApp.

Definition at line 60 of file PermEvents.Cpp.

{
  HRESULT hRes;
  BOOL regEmpty = FALSE; // did a self-unregister happen?

  // OLE initialization. This is 'lighter' than OleInitialize()
  //  which also setups DnD, etc.
  if(SUCCEEDED(CoInitialize(NULL)))
  {

    //  NOTE:
    //  When using asynchronous WMI API's remotely in an environment where the "Local System" account
    //  has no network identity (such as non-Kerberos domains), the authentication level of
    //  RPC_C_AUTHN_LEVEL_NONE is needed. However, lowering the authentication level to
    //  RPC_C_AUTHN_LEVEL_NONE makes your application less secure. It is wise to
    //  use semi-synchronous API's for accessing WMI data and events instead of the asynchronous ones.

    hRes = CoInitializeSecurity( NULL, -1, NULL, NULL,
                      RPC_C_AUTHN_LEVEL_PKT_PRIVACY,
                      RPC_C_IMP_LEVEL_IMPERSONATE,
                      NULL,
                      EOAC_SECURE_REFS, //change to EOAC_NONE if you change dwAuthnLevel to RPC_C_AUTHN_LEVEL_NONE
                      NULL );
    if (FAILED(hRes))
    {
      AfxMessageBox(_T("CoInitializeSecurity Failed"));
      return FALSE;
    }
  }
  else // didnt CoInitialize()
  {
    AfxMessageBox(_T("CoInitialize Failed"));
    return FALSE;
  } // endif OleInitialize()

  // NOTE: To advertise that we can self-register, put 'OLESelfRegister'
  // in the version resource.

  // see if this is a self-Unregister call.
  TCHAR temp[128];
  TCHAR seps[] = _T(" ");
  TCHAR *token = NULL;

  StringCbCopy(temp, sizeof(temp), (LPCTSTR)m_lpCmdLine);
  token = _tcstok( temp, seps );
  while( token != NULL )
  {
    /* While there are tokens in "string" */
    if(_tcsicmp(token, _T("/UNREGSERVER")) == 0)
    {
      UnregisterServer();
      return FALSE;   // no use doing any more.
    }
    /* Get next token: */
    token = _tcstok( NULL, seps );
  }

  // if we got here, the unregister didn't return out and we should
  // make sure we're registered now.
  RegisterServer();

  // creating the dlg earlier than usual so the class factory
  //  can pass m_outputList.
  CPermEventsDlg dlg;

  m_factory = new CProviderFactory(&(dlg.m_outputList));
  if (m_factory == NULL)
  {
    TRACE(_T("Out of memory\n"));
    return FALSE;
  }

  if((hRes = CoRegisterClassObject(CLSID_WBEMSampleConsumer,
              (IUnknown *)m_factory,
              CLSCTX_LOCAL_SERVER | CLSCTX_REMOTE_SERVER,
              REGCLS_MULTIPLEUSE,
              &m_clsReg)) == S_OK)
  {
    TRACE(_T("registered\n"));
  }
  else
  {
    TRACE(_T("not registered\n"));
  }

#ifdef _AFXDLL
  Enable3dControls();     // Call this when using MFC in a shared DLL
#else
  Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif

  m_pMainWnd = &dlg;
  INT_PTR nResponse = dlg.DoModal();
  if (nResponse == IDOK)
  {
    // TODO: Place code here to handle when the dialog is
    //  dismissed with OK
  }
  else if (nResponse == IDCANCEL)
  {
    // TODO: Place code here to handle when the dialog is
    //  dismissed with Cancel
  }

  // Since the dialog has been closed, return FALSE so that we exit the
  //  application, rather than start the application's message pump.
  return FALSE;
}

void CPermEventsApp::RegisterServer ( void ) [private]

Definition at line 198 of file PermEvents.Cpp.

{
  HKEY hKey1, hKey2;

  TCHAR       wcConsID[] = _T("{1E069401-087E-11d1-AD85-00AA00B8E05A}");
    TCHAR       wcCLSID[] = _T("CLSID\\{1E069401-087E-11d1-AD85-00AA00B8E05A}");
    TCHAR       wcAppID[] = _T("AppID\\{1E069401-087E-11d1-AD85-00AA00B8E05A}");
    TCHAR      wcModule[MAX_PATH + 1];  // this will hold the exe's path.
  TCHAR ConsumerTextForm[] = _T("WMI Sample Permanent Consumer Object");

  // this will allow the server to display its windows on the active desktop instead
  // of the hidden desktop where services run.
  TCHAR Interactive[] = _T("Interactive User");

  memset(&wcModule, NULL, sizeof(wcModule));
  GetModuleFileName(NULL, wcModule,  sizeof(wcModule)/sizeof(TCHAR) - 1);

  //Set the "default" text under CLSID
  //==========================
  RegCreateKeyEx( HKEY_CLASSES_ROOT, wcCLSID, 0, NULL,
                    REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL,
                    &hKey1, NULL );
  RegSetValueEx(hKey1, NULL, 0, REG_SZ,
          (LPBYTE)ConsumerTextForm,
          TCHAR_LEN_IN_BYTES(ConsumerTextForm));

  // create the LocalServer32 key so the server can be found.
  RegCreateKeyEx( hKey1, _T("LocalServer32"), 0, NULL,
                    REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL,
                    &hKey2, NULL );
  RegSetValueEx(hKey2, NULL, 0, REG_SZ, (LPBYTE)wcModule, TCHAR_LEN_IN_BYTES(wcModule));
  RegSetValueEx(hKey1, _T("AppID"), 0, REG_SZ, (LPBYTE)wcConsID, TCHAR_LEN_IN_BYTES(wcConsID));

  RegCloseKey(hKey2);
  RegCloseKey(hKey1);

  // now do the AppID keys.
  RegCreateKeyEx( HKEY_CLASSES_ROOT, wcAppID, 0, NULL,
                    REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL,
                    &hKey1, NULL );
  RegSetValueEx(hKey1, NULL, 0, REG_SZ,
          (LPBYTE)ConsumerTextForm,
          TCHAR_LEN_IN_BYTES(ConsumerTextForm));

  // this makes the local server run on the active desktop (the one you're seeing)
  // instead of the hidden desktop that services run on (which doesn't have UI)
  RegSetValueEx(hKey1, _T("RunAs"), 0, REG_SZ, (LPBYTE)Interactive, TCHAR_LEN_IN_BYTES(Interactive));
  RegCloseKey(hKey1);
}

void CPermEventsApp::UnregisterServer ( void ) [private]

Definition at line 258 of file PermEvents.Cpp.

{

  TCHAR       wcConsID[] = _T("{1E069401-087E-11d1-AD85-00AA00B8E05A}");
    TCHAR       wcCLSID[] = _T("CLSID\\{1E069401-087E-11d1-AD85-00AA00B8E05A}");
    TCHAR       wcAppID[] = _T("AppID\\{1E069401-087E-11d1-AD85-00AA00B8E05A}");
    HKEY hKey1;
  DWORD dwRet;

  // delete the keys under CLSID\[guid]
    dwRet = RegOpenKeyEx(HKEY_CLASSES_ROOT, wcCLSID, 0, KEY_WRITE, &hKey1);
    if(dwRet == NOERROR)
    {
        RegDeleteKey(hKey1, _T("LocalServer32"));
        RegCloseKey(hKey1);
    }

  // delete CLSID\[guid] <default>
    dwRet = RegOpenKeyEx(HKEY_CLASSES_ROOT, _T("CLSID"), 0, KEY_WRITE, &hKey1);
    if(dwRet == NOERROR)
    {
        RegDeleteKey(hKey1,wcConsID);
        RegCloseKey(hKey1);
    }

  // delete AppID\[guid] <default>
    dwRet = RegOpenKeyEx(HKEY_CLASSES_ROOT, _T("AppID"), 0, KEY_WRITE, &hKey1);
    if(dwRet == NOERROR)
    {
        RegDeleteKey(hKey1, wcConsID);
        RegCloseKey(hKey1);
    }
}

Member Data Documentation

DWORD CPermEventsApp::m_clsReg [private]

Definition at line 56 of file PermEvents.h.

CProviderFactory* CPermEventsApp::m_factory [private]

Definition at line 57 of file PermEvents.h.

The documentation for this class was generated from the following files:
  • SysMgmt/WMI/VC/EventConsumer/PermEvents.h
  • SysMgmt/WMI/VC/EventConsumer/PermEvents.Cpp
Generated on Wed Nov 13 2024 16:57:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPermEventsDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes

CPermEventsDlg Class Reference

#include "PermEventsdlg.h"

List of all members.

Public Types

enum | { IDD = IDD_PERMEVENTS_DIALOG }

Public Member Functions

CPermEventsDlg (CWnd *pParent=NULL)

Public Attributes

CListBox | m_outputList

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
virtual BOOL | OnInitDialog ()
afx_msg void | OnPaint ()
afx_msg HCURSOR | OnQueryDragIcon ()
afx_msg void | OnSysCommand (UINT nID, LPARAM lParam)

Protected Attributes

HICON | m_hIcon

Detailed Description

Definition at line 24 of file PermEventsdlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 32 of file PermEventsdlg.h.

{ IDD = IDD_PERMEVENTS_DIALOG };

Constructor & Destructor Documentation

CPermEventsDlg::CPermEventsDlg ( CWnd * pParent = NULL )

Definition at line 72 of file PermEventsdlg.Cpp.

  : CDialog(CPermEventsDlg::IDD, pParent)
{
  //{{AFX_DATA_INIT(CPermEventsDlg)
    // NOTE: the ClassWizard will add member initialization here
  //}}AFX_DATA_INIT
  // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
  m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

Member Function Documentation

void CPermEventsDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 82 of file PermEventsdlg.Cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CPermEventsDlg)
  DDX_Control(pDX, IDC_OUTPUTLIST, m_outputList);
  //}}AFX_DATA_MAP
}

BOOL CPermEventsDlg::OnInitDialog ( ) [protected, virtual]

Definition at line 101 of file PermEventsdlg.Cpp.

{
  CDialog::OnInitDialog();

  // Add "About..." menu item to system menu.

  // IDM_ABOUTBOX must be in the system command range.
  ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
  ASSERT(IDM_ABOUTBOX < 0xF000);

  CMenu* pSysMenu = GetSystemMenu(FALSE);
  if (pSysMenu != NULL)
  {
    CString strAboutMenu;
    strAboutMenu.LoadString(IDS_ABOUTBOX);
    if (!strAboutMenu.IsEmpty())
    {
      pSysMenu->AppendMenu(MF_SEPARATOR);
      pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
    }
  }

  // Set the icon for this dialog.  The framework does this automatically
  //  when the application's main window is not a dialog
  SetIcon(m_hIcon, TRUE);     // Set big icon
  SetIcon(m_hIcon, FALSE);    // Set small icon

  // TODO: Add extra initialization here

  return TRUE;  // return TRUE  unless you set the focus to a control
}

void CPermEventsDlg::OnPaint ( void ) [protected]

Definition at line 150 of file PermEventsdlg.Cpp.

{
  if (IsIconic())
  {
    CPaintDC dc(this); // device context for painting

    SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

    // Center icon in client rectangle
    int cxIcon = GetSystemMetrics(SM_CXICON);
    int cyIcon = GetSystemMetrics(SM_CYICON);
    CRect rect;
    GetClientRect(&rect);
    int x = (rect.Width() - cxIcon + 1) / 2;
    int y = (rect.Height() - cyIcon + 1) / 2;

    // Draw the icon
    dc.DrawIcon(x, y, m_hIcon);
  }
  else
  {
    CDialog::OnPaint();
  }
}

HCURSOR CPermEventsDlg::OnQueryDragIcon ( ) [protected]

Definition at line 177 of file PermEventsdlg.Cpp.

{
  return (HCURSOR) m_hIcon;
}

void CPermEventsDlg::OnSysCommand | ( | UINT | nID,
 |  | LPARAM | lParam |
 | ) |  |  | [protected]

Definition at line 133 of file PermEventsdlg.Cpp.

{
  if ((nID & 0xFFF0) == IDM_ABOUTBOX)
  {
    CAboutDlg dlgAbout;
    dlgAbout.DoModal();
  }
  else
  {
    CDialog::OnSysCommand(nID, lParam);
  }
}

Member Data Documentation

HICON CPermEventsDlg::m_hIcon [protected]

Definition at line 44 of file PermEventsdlg.h.

CListBox CPermEventsDlg::m_outputList

Definition at line 33 of file PermEventsdlg.h.

The documentation for this class was generated from the following files:
  • SysMgmt/WMI/VC/EventConsumer/PermEventsdlg.h
  • SysMgmt/WMI/VC/EventConsumer/PermEventsdlg.Cpp
Generated on Wed Nov 13 2024 16:57:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPersistFile Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CPersistFile Class Reference

#include "perfile.h"

List of all members.

Public Member Functions

CPersistFile (COleDocument *, CPersistStorage *)
~CPersistFile ()
STDMETHODIMP | GetClassID (LPCLSID)
STDMETHODIMP | GetCurFile (LPOLESTR *)
STDMETHODIMP | IsDirty (void)
STDMETHODIMP | Load (LPCOLESTR, DWORD)
STDMETHODIMP | QueryInterface (REFIID, LPVOID *)
STDMETHODIMP | Save (LPCOLESTR, BOOL)
STDMETHODIMP | SaveCompleted (LPCOLESTR)
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()

Private Attributes

COleDocument * m_pOleDoc
CPersistStorage * m_pPersistStorage
LPSTORAGE | m_pStorage
LPOLESTR m_pwszFile

Detailed Description

Definition at line 44 of file perfile.h.

Constructor & Destructor Documentation

CPersistFile::CPersistFile | ( | COleDocument * | pOleDoc,
 |  | CPersistStorage * | pPersistStorage
 | ) |  |

Definition at line 38 of file perfile.Cpp.

{
  OutputDebugString(TEXT("CPersistFile's constructor\n"));

  m_pOleDoc = pOleDoc;

  m_pPersistStorage = pPersistStorage;

  m_pStorage = NULL;

  m_pwszFile = new OLECHAR[MAX_PATH];
}

CPersistFile::~CPersistFile ( )

Definition at line 57 of file perfile.Cpp.

{
  OutputDebugString(TEXT("CPersistFile's destructor\n"));

  if(m_pStorage)
    m_pStorage->Release();

  delete m_pwszFile;
}

Member Function Documentation

STDMETHODIMP CPersistFile::GetClassID ( LPCLSID pClassID )

Definition at line 112 of file perfile.Cpp.

{
  OutputDebugString(TEXT("CPersistFile::GetClassID\n"));

  return m_pPersistStorage->GetClassID(pClassID);
}

STDMETHODIMP CPersistFile::GetCurFile ( LPOLESTR * ppwszOut )

Definition at line 260 of file perfile.Cpp.

{
  OutputDebugString(TEXT("CPersistFile::GetCurFile\n"));

  HRESULT  hr = E_FAIL;

  *ppwszOut = NULL;

  LPMALLOC pMalloc;
  CoGetMalloc(1, &pMalloc);
  if(pMalloc)
  {
    if(*m_pwszFile)
    {
      *ppwszOut = (LPOLESTR)pMalloc->Alloc(lstrlenW(m_pwszFile) + sizeof(OLECHAR));
      if(*ppwszOut)
      {
        lstrcpynW(*ppwszOut, m_pwszFile, (lstrlenW(m_pwszFile) + sizeof(OLECHAR))/
          sizeof(OLECHAR));
        hr = S_OK;
      }
    }
    else
    {
      *ppwszOut = (LPOLESTR)pMalloc->Alloc(lstrlenW(DEFAULT_PROMPT) + sizeof(OLECHAR));
      if(*ppwszOut)
      {
        lstrcpynW(*ppwszOut, DEFAULT_PROMPT, (lstrlenW(DEFAULT_PROMPT) + sizeof(OLECHAR))/
          sizeof(OLECHAR));
        hr = S_FALSE;
      }
    }

    pMalloc->Release();
  }

  return hr;
}

STDMETHODIMP CPersistFile::IsDirty ( void )

Definition at line 247 of file perfile.Cpp.

{
  OutputDebugString(TEXT("CPersistFile::IsDirty\n"));

  return m_pPersistStorage->IsDirty();
}

STDMETHODIMP CPersistFile::Load | ( | LPCOLESTR | pwszFile,
 |  | DWORD | dwMode
 | ) |  |

Definition at line 200 of file perfile.Cpp.

{
  OutputDebugString(TEXT("CPersistFile::Load\n"));

  HRESULT     hr;

  if(!pwszFile)
    return E_INVALIDARG;

  //close any existing storage we might have
  if(m_pStorage)
  {
    m_pPersistStorage->ReleaseStreamsAndStorage();
    m_pStorage->Release();
    m_pStorage = NULL;
    *m_pwszFile = 0;
  }

  //open the file as storage and load it
  hr = StgOpenStorage(    pwszFile,
    NULL,
    dwMode | STGM_READWRITE | STGM_DIRECT | STGM_SHARE_EXCLUSIVE,
    NULL,
    0,
    &m_pStorage);

  if(m_pStorage)
  {
    hr = m_pPersistStorage->Load(m_pStorage);
  }
  else
  {
    hr = E_FAIL;
  }

  if(SUCCEEDED(hr))
    lstrcpynW(m_pwszFile, pwszFile, MAX_PATH);

  return hr;
}

STDMETHODIMP CPersistFile::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppReturn
 | ) |  |

Definition at line 73 of file perfile.Cpp.

{
  OutputDebugString(TEXT("CPersistFile::QueryInterface\n"));

  return m_pOleDoc->QueryInterface(riid, ppReturn);
}

STDMETHODIMP CPersistFile::Save | ( | LPCOLESTR | pwszFile,
 |  | BOOL | fRemember
 | ) |  |

Definition at line 125 of file perfile.Cpp.

{
  OutputDebugString(TEXT("CPersistFile::Save\n"));

  if(!pwszFile)
    return E_INVALIDARG;

  HRESULT     hr = E_FAIL;  // Assume failure

                /*
                Only create a new storage if we don't already have a storage or the file name
                has changed.
  */
  if(!m_pStorage || (0 != lstrcmpiW(pwszFile, m_pwszFile)))
  {
    //if we have a storage, release it
    if(m_pStorage)
    {
      m_pPersistStorage->ReleaseStreamsAndStorage();
      m_pStorage->Release();
      m_pStorage = NULL;
      *m_pwszFile = 0;
    }

    //open the file as storage
    hr = StgCreateDocfile(  pwszFile,
      STGM_READWRITE | STGM_DIRECT | STGM_SHARE_EXCLUSIVE | STGM_CREATE,
      0,
      &m_pStorage);

  }

  if(m_pStorage)
  {
    hr = m_pPersistStorage->Save(m_pStorage, FALSE);
  }

  if(fRemember)
  {
    lstrcpynW(m_pwszFile, pwszFile, MAX_PATH);
  }
  else
  {
    m_pPersistStorage->ReleaseStreamsAndStorage();
    m_pStorage->Release();
    m_pStorage = NULL;
    *m_pwszFile = 0;
  }

  return hr;
}

STDMETHODIMP CPersistFile::SaveCompleted ( LPCOLESTR pwszFile )

Definition at line 186 of file perfile.Cpp.

{
  UNREFERENCED_PARAMETER(pwszFile);
  OutputDebugString(TEXT("CPersistFile::SaveCompleted\n"));

  return m_pPersistStorage->SaveCompleted(NULL);
}

CPersistFile::STDMETHODIMP_ ( ULONG )
CPersistFile::STDMETHODIMP_ ( ULONG )

Member Data Documentation

COleDocument* CPersistFile::m_pOleDoc [private]

Definition at line 48 of file perfile.h.

CPersistStorage* CPersistFile::m_pPersistStorage [private]

Definition at line 49 of file perfile.h.

LPSTORAGE CPersistFile::m_pStorage [private]

Definition at line 47 of file perfile.h.

LPOLESTR CPersistFile::m_pwszFile [private]

Definition at line 50 of file perfile.h.

The documentation for this class was generated from the following files:
  • Com/Fundamentals/ActiveDocument/DoServer/perfile.h
  • Com/Fundamentals/ActiveDocument/DoServer/perfile.Cpp
Generated on Wed Nov 13 2024 16:57:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPersistStorage Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes | Friends

CPersistStorage Class Reference

#include "perstor.h"

List of all members.

Public Member Functions

CPersistStorage (COleDocument *)
~CPersistStorage ()
STDMETHODIMP | GetClassID (LPCLSID)
STDMETHODIMP | HandsOffStorage ()
STDMETHODIMP | InitNew (LPSTORAGE)
STDMETHODIMP | IsDirty ()
STDMETHODIMP | Load (LPSTORAGE)
STDMETHODIMP | QueryInterface (REFIID, LPVOID *)
STDMETHODIMP | Save (LPSTORAGE, BOOL)
STDMETHODIMP | SaveCompleted (LPSTORAGE)
STDMETHODIMP_ (DWORD) Release()
STDMETHODIMP_ (DWORD) AddRef()

Private Member Functions

void | CreateStreams (LPSTORAGE)
void | CreateStreams (LPSTORAGE, LPSTREAM *)
void | OpenStreams (LPSTORAGE)
void | ReleaseStreamsAndStorage ()

Private Attributes

BOOL m_fSameAsLoad
LPSTREAM | m_pColorStream
COleDocument * m_pOleDoc
LPSTORAGE | m_pStorage

Friends

class | CPersistFile

Detailed Description

Definition at line 43 of file perstor.h.

Constructor & Destructor Documentation

CPersistStorage::CPersistStorage ( COleDocument * pOleDoc )

Definition at line 38 of file perstor.Cpp.

{
  OutputDebugString(TEXT("CPersistStorage's constructor\n"));

  m_pOleDoc = pOleDoc;

  m_pStorage = NULL;
  m_pColorStream = NULL;
  m_fSameAsLoad = FALSE;
}

CPersistStorage::~CPersistStorage ( )

Definition at line 55 of file perstor.Cpp.

{
  OutputDebugString(TEXT("CPersistStorage's destructor\n"));
}

Member Function Documentation

void CPersistStorage::CreateStreams ( LPSTORAGE pStg ) [private]

Definition at line 308 of file perstor.Cpp.

{
  if(m_pColorStream)
    m_pColorStream->Release();

  // create a stream to save the color
  pStg->CreateStream(  OLESTR("Color"),
    STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE,
    0,
    0,
    &m_pColorStream);

}

void CPersistStorage::CreateStreams | ( | LPSTORAGE | pStg,
 |  | LPSTREAM * | ppNewColorStream |
 | ) |  |  | [private]

Definition at line 328 of file perstor.Cpp.

{
  LPSTREAM pTempColorStream;

  //save the member streams
  pTempColorStream = m_pColorStream;

  //initialize the streams
  m_pColorStream = *ppNewColorStream = NULL;

  //create the streams
  CreateStreams(pStg);

  //copy the new streams
  *ppNewColorStream = m_pColorStream;

  //restore the member streams
  m_pColorStream = pTempColorStream;
}

STDMETHODIMP CPersistStorage::GetClassID ( LPCLSID pClassID )

Definition at line 129 of file perstor.Cpp.

{
  OutputDebugString(TEXT("CPersistStorage::GetClassID\n"));

  *pClassID = CLSID_SimpleDocObject;

  return S_OK;
}

STDMETHODIMP CPersistStorage::HandsOffStorage ( )

Definition at line 293 of file perstor.Cpp.

{
  OutputDebugString(TEXT("CPersistStorage::HandsOffStorage\n"));

  ReleaseStreamsAndStorage();

  return S_OK;
}

STDMETHODIMP CPersistStorage::InitNew ( LPSTORAGE pStg )

Definition at line 105 of file perstor.Cpp.

{
  OutputDebugString(TEXT("CPersistStorage::InitNew\n"));

  // release any streams and storages that may be open
  ReleaseStreamsAndStorage();

  m_pStorage = pStg;

  // AddRef the new Storage
  if (m_pStorage)
    m_pStorage->AddRef();

  CreateStreams(m_pStorage);

  return S_OK;
}

STDMETHODIMP CPersistStorage::IsDirty ( void )

Definition at line 280 of file perstor.Cpp.

{
  OutputDebugString(TEXT("CPersistStorage::IsDirty\n"));

  return (m_pOleDoc->m_fDirty ? S_OK : S_FALSE);
}

STDMETHODIMP CPersistStorage::Load ( LPSTORAGE pStg )

Definition at line 242 of file perstor.Cpp.

{
  OutputDebugString(TEXT("CPersistStorage::Load\n"));

  // remember the storage
  if(m_pStorage)
  {
    m_pStorage->Release();
    m_pStorage = NULL;
  }

  m_pStorage = pStg;

  m_pStorage->AddRef();

  //read our class ID from the storage
  CLSID clsidStg;
  ReadClassStg(m_pStorage, &clsidStg);

  OpenStreams(m_pStorage);

  // read the color
  if(FAILED(m_pColorStream->Read(&m_pOleDoc->m_Color, sizeof(m_pOleDoc->m_Color), NULL)))
  {
    m_pOleDoc->m_Color = DEFAULT_COLOR;
  }

  m_pOleDoc->m_fDirty = FALSE;

  return S_OK;
}

void CPersistStorage::OpenStreams ( LPSTORAGE pStg ) [private]

Definition at line 355 of file perstor.Cpp.

{
  if(m_pColorStream)
    m_pColorStream->Release();

  // open the color stream
  pStg->OpenStream( OLESTR("Color"),
    0,
    STGM_READWRITE | STGM_SHARE_EXCLUSIVE,
    0,
    &m_pColorStream);

}

STDMETHODIMP CPersistStorage::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppReturn
 | ) |  |

Definition at line 66 of file perstor.Cpp.

{
  OutputDebugString(TEXT("CPersistStorage::QueryInterface\n"));

  return m_pOleDoc->QueryInterface(riid, ppReturn);
}

void CPersistStorage::ReleaseStreamsAndStorage ( ) [private]

Definition at line 375 of file perstor.Cpp.

{
  if(m_pColorStream)
  {
    m_pColorStream->Release();
    m_pColorStream = NULL;
  }

  if(m_pStorage)
  {
    m_pStorage->Release();
    m_pStorage = NULL;
  }
}

STDMETHODIMP CPersistStorage::Save | ( | LPSTORAGE | pStg,
 |  | BOOL | fSameAsLoad
 | ) |  |

Definition at line 144 of file perstor.Cpp.

{
  OutputDebugString(TEXT("CPersistStorage::Save\n"));

  m_pOleDoc->m_fNoScribbleMode = TRUE;

  // save the data
  LPSTREAM pTempColor;

  if(!fSameAsLoad)
  {
    if(!pStg)
      return E_FAIL;

    CreateStreams(pStg, &pTempColor);
  }
  else
  {
    pStg = m_pStorage;

    if(!pStg)
      return E_FAIL;

    pTempColor = m_pColorStream;
    pTempColor->AddRef();
  }

  //write our class ID into the storage
  CLSID clsid;
  GetClassID(&clsid);
  WriteClassStg(pStg, clsid);

  ULARGE_INTEGER uli;

  uli.LowPart = 0;
  uli.HighPart = 0;

  pTempColor->SetSize(uli);

  LARGE_INTEGER li;

  li.LowPart = 0;
  li.HighPart = 0;

  pTempColor->Seek(li, STREAM_SEEK_SET, NULL);

  // write the color to the stream
  pTempColor->Write(&m_pOleDoc->m_Color, sizeof(m_pOleDoc->m_Color), NULL);

  pTempColor->Release();

  m_fSameAsLoad = fSameAsLoad;

  m_pOleDoc->m_fDirty = FALSE;

  return S_OK;
}

STDMETHODIMP CPersistStorage::SaveCompleted ( LPSTORAGE pStgNew )

Definition at line 208 of file perstor.Cpp.

{
  OutputDebugString(TEXT("CPersistStorage::SaveCompleted\n"));

  if(pStgNew)
  {
    ReleaseStreamsAndStorage();
    m_pStorage = pStgNew;
    m_pStorage->AddRef();
    OpenStreams(pStgNew);
  }

  if(pStgNew || m_fSameAsLoad)
  {
    if(m_pOleDoc->m_fNoScribbleMode)
    {
      if(m_pOleDoc->m_pOleAdviseHolder)
        m_pOleDoc->m_pOleAdviseHolder->SendOnSave();
    }

    m_fSameAsLoad = FALSE;
  }

  m_pOleDoc->m_fNoScribbleMode = FALSE;

  return S_OK;
}

CPersistStorage::STDMETHODIMP_ ( DWORD )
CPersistStorage::STDMETHODIMP_ ( DWORD )

Friends And Related Function Documentation

friend class CPersistFile [friend]

Definition at line 45 of file perstor.h.

Member Data Documentation

BOOL CPersistStorage::m_fSameAsLoad [private]

Definition at line 51 of file perstor.h.

LPSTREAM CPersistStorage::m_pColorStream [private]

Definition at line 50 of file perstor.h.

COleDocument* CPersistStorage::m_pOleDoc [private]

Definition at line 48 of file perstor.h.

LPSTORAGE CPersistStorage::m_pStorage [private]

Definition at line 49 of file perstor.h.

The documentation for this class was generated from the following files:
  • Com/Fundamentals/ActiveDocument/DoServer/perstor.h
  • Com/Fundamentals/ActiveDocument/DoServer/perstor.Cpp
  • Com/Fundamentals/SimpSvr/ips.Cpp
  • Com/Fundamentals/SimpSvr/ips.h
Generated on Wed Nov 13 2024 16:57:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPerson Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes | Static Private Attributes

CPerson Class Reference

#include "people.h"

Inherits CDelegationBase.

List of all members.

Public Member Functions

CPerson (int id, CComponentData *pComponentData=NULL)
virtual | ~CPerson ()
virtual const int | GetBitmapIndex ()
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const GUID & | getNodeType ()
virtual HRESULT | GetResultViewType (LPOLESTR *ppViewType, long *pViewOptions)
void | Initialize (_TCHAR *szName, LONG lSpeed, LONG lHeight, LONG lWeight, BOOL fAnimating)
virtual HRESULT | ShowContextHelp (IConsole *pConsole, IDisplayHelp *m_ipDisplayHelp, LPOLESTR helpFile)

Private Attributes

BOOL fAnimating
LONG | lHeight
LONG | lSpeed
LONG | lWeight
int | m_id
IUnknown * | m_pUnknown
_TCHAR * | szName

Static Private Attributes

static const GUID | thisGuid = { 0xd41ef043, 0x8bc5, 0x11d2, { 0x8a, 0xb, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28 } }

Detailed Description

Definition at line 26 of file people.h.

Constructor & Destructor Documentation

CPerson::CPerson | ( | int | id,
 |  | CComponentData * | pComponentData = NULL
 | ) |  |

Definition at line 88 of file people.Cpp.

: m_id(id)
{
    m_pComponentData = pComponentData;

    m_pUnknown = NULL;
    szName     = NULL;
    lSpeed     = 0;
    lHeight    = 0;
    lWeight    = 0;
    fAnimating = FALSE;
}

CPerson::~CPerson ( ) [virtual]

Definition at line 101 of file people.Cpp.

{
    if (szName)
        delete [] szName;

    if (m_pUnknown)
        m_pUnknown->Release();
}

Member Function Documentation

virtual const int CPerson::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 34 of file people.h.

{ return INDEX_PEOPLEICON; }

const _TCHAR * CPerson::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

Definition at line 131 of file people.Cpp.

{
    static _TCHAR buf[128];

    switch (nCol) {
    case 0:
        _tcscpy(buf, szName ? szName : _T(""));
        break;

    case 1:
        _stprintf(buf, _T("%ld m/s"), lSpeed);
        break;

    case 2:
        _stprintf(buf, _T("%ld meters"), lHeight);
        break;

    case 3:
        _stprintf(buf, _T("%ld kilos"), lWeight);
        break;
    }
    return buf;
}

virtual const GUID& CPerson::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 33 of file people.h.

{ return thisGuid; }

HRESULT CPerson::GetResultViewType | ( | LPOLESTR * | ppViewType,
 |  | long * | pViewOptions |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 155 of file people.Cpp.

{
    // for vb component
    // LPOLESTR lpOleStr;
    // HRESULT hr = StringFromCLSID(CLSID_VBComponent, &lpOleStr);
    // *ppViewType = lpOleStr;

    // for atl component
    LPOLESTR lpOleStr = L"{9A12FB62-C754-11D2-952C-00C04FB92EC2}";
    *ppViewType = static_cast<LPOLESTR>(CoTaskMemAlloc((wcslen(lpOleStr) + 1) * sizeof(WCHAR)));
    wcscpy(*ppViewType, lpOleStr);

    if (m_id % 2) {
        // create new control
        *pViewOptions = MMC_VIEW_OPTIONS_CREATENEW;
    } else {
        // share control
        *pViewOptions = MMC_VIEW_OPTIONS_NONE;
    }

    return S_OK;
}

void CPerson::Initialize | ( | _TCHAR * | szName,
 |  | LONG | lSpeed,
 |  | LONG | lHeight,
 |  | LONG | lWeight,
 |  | BOOL | fAnimating
 | ) |  |

Definition at line 110 of file people.Cpp.

{
    if (szName) {
        this->szName = new _TCHAR[_tcslen(szName) + 20];
        _tcscpy(this->szName, szName);
        _tcscat(this->szName, _T(" "));

        if (m_id % 2)
            _tcscat(this->szName, _T("(new control)"));
        else
            _tcscat(this->szName, _T("(share control)"));
    }

    this->lSpeed = lSpeed;
    this->lHeight = lHeight;
    this->lWeight = lWeight;
    this->fAnimating = fAnimating;

    return;
}

HRESULT CPerson::ShowContextHelp | ( | IConsole * | pConsole,
 |  | IDisplayHelp * | m_ipDisplayHelp,
 |  | LPOLESTR | helpFile |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 178 of file people.Cpp.

{
    HRESULT hr = S_OK;

    IUnknown *pUnk = NULL;
    if (SUCCEEDED(hr = pConsole->QueryResultView(&pUnk))) {
        IDispatch *pDispatch = NULL;

        if (SUCCEEDED(hr = pUnk->QueryInterface(IID_IDispatch, (void **)&pDispatch))) {
            DISPID dispID;
            DISPPARAMS dispparamsNoArgs = {NULL, NULL, 0, 0};
            EXCEPINFO exInfo;
            OLECHAR *pszName = L"DoHelp";
            UINT uErr;

            hr = pDispatch->GetIDsOfNames(IID_NULL, &pszName, 1, LOCALE_SYSTEM_DEFAULT, &dispID);

            if (SUCCEEDED(hr)) {
                hr = pDispatch->Invoke(
                    dispID,
                    IID_NULL,
                    LOCALE_USER_DEFAULT,
                    DISPATCH_METHOD,
                    &dispparamsNoArgs, NULL, &exInfo, &uErr);
            }

            pDispatch->Release();
        }

        pUnk->Release();
    }

    _ASSERT(SUCCEEDED(hr));

    return hr;
}

Member Data Documentation

BOOL CPerson::fAnimating [private]

Definition at line 50 of file people.h.

LONG CPerson::lHeight [private]

Definition at line 48 of file people.h.

LONG CPerson::lSpeed [private]

Definition at line 47 of file people.h.

LONG CPerson::lWeight [private]

Definition at line 49 of file people.h.

int CPerson::m_id [private]

Definition at line 52 of file people.h.

IUnknown* CPerson::m_pUnknown [private]

Definition at line 45 of file people.h.

_TCHAR* CPerson::szName [private]

Definition at line 46 of file people.h.

const GUID CPerson::thisGuid = { 0xd41ef043, 0x8bc5, 0x11d2, { 0x8a, 0xb, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28 } } [static, private]

Reimplemented from CDelegationBase.

Definition at line 44 of file people.h.

The documentation for this class was generated from the following files:
  • SysMgmt/MMC/ActiveX/people.h
  • SysMgmt/MMC/ActiveX/people.Cpp
Generated on Wed Nov 13 2024 16:57:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPidlMgr Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CPidlMgr Class Reference

#include "PidlMgr.h"

List of all members.

Public Member Functions

CPidlMgr ()
~CPidlMgr ()
LPITEMIDLIST | Concatenate (LPCITEMIDLIST, LPCITEMIDLIST)
LPITEMIDLIST | Copy (LPCITEMIDLIST)
LPITEMIDLIST | CopySingleItem (LPCITEMIDLIST)
LPITEMIDLIST | CreateFolderPidl (LPCTSTR)
LPITEMIDLIST | CreateItemPidl (LPCTSTR, LPCTSTR)
VOID | Delete (LPITEMIDLIST)
int | GetData (LPCITEMIDLIST, LPTSTR, DWORD)
LPITEMIDLIST | GetLastItem (LPCITEMIDLIST)
int | GetName (LPCITEMIDLIST, LPTSTR, DWORD)
LPITEMIDLIST | GetNextItem (LPCITEMIDLIST)
int | GetRelativeName (LPCITEMIDLIST, LPTSTR, DWORD)
UINT | GetSize (LPCITEMIDLIST)
BOOL | IsFolder (LPCITEMIDLIST)
int | SetData (LPCITEMIDLIST, LPCTSTR)

Private Member Functions

LPITEMIDLIST | Create (VOID)
LPPIDLDATA | GetDataPointer (LPCITEMIDLIST)

Private Attributes

LPMALLOC | m_pMalloc

Detailed Description

Definition at line 49 of file PidlMgr.h.

Constructor & Destructor Documentation

CPidlMgr::CPidlMgr ( )

Definition at line 33 of file PidlMgr.Cpp.

{
g_DllRefCount++;

//get the shell's IMalloc pointer
//we'll keep this until we get destroyed
if(FAILED(SHGetMalloc(&m_pMalloc)))
   {
   delete this;
   }
}

CPidlMgr::~CPidlMgr ( )

Definition at line 51 of file PidlMgr.Cpp.

{
if(m_pMalloc)
   m_pMalloc->Release();

g_DllRefCount--;
}

Member Function Documentation

LPITEMIDLIST CPidlMgr::Concatenate | ( | LPCITEMIDLIST | pidl1,
 |  | LPCITEMIDLIST | pidl2
 | ) |  |

Definition at line 254 of file PidlMgr.Cpp.

{
LPITEMIDLIST   pidlNew;
UINT           cb1 = 0,
               cb2 = 0;

//are both of these NULL?
if(!pidl1 && !pidl2)
   return NULL;

//if pidl1 is NULL, just return a copy of pidl2
if(!pidl1)
   {
   pidlNew = Copy(pidl2);

   return pidlNew;
   }

//if pidl2 is NULL, just return a copy of pidl1
if(!pidl2)
   {
   pidlNew = Copy(pidl1);

   return pidlNew;
   }

cb1 = GetSize(pidl1) - sizeof(ITEMIDLIST);

cb2 = GetSize(pidl2);

//create the new PIDL
pidlNew = (LPITEMIDLIST)m_pMalloc->Alloc(cb1 + cb2);

if(pidlNew)
   {
   //copy the first PIDL
   CopyMemory(pidlNew, pidl1, cb1);

   //copy the second PIDL
   CopyMemory(((LPBYTE)pidlNew) + cb1, pidl2, cb2);
   }

return pidlNew;
}

LPITEMIDLIST CPidlMgr::Copy ( LPCITEMIDLIST pidlSource )

Definition at line 185 of file PidlMgr.Cpp.

{
LPITEMIDLIST pidlTarget = NULL;
UINT cbSource = 0;

if(NULL == pidlSource)
   return NULL;

// Allocate the new pidl
cbSource = GetSize(pidlSource);
pidlTarget = (LPITEMIDLIST)m_pMalloc->Alloc(cbSource);
if(!pidlTarget)
   return NULL;

// Copy the source to the target
CopyMemory(pidlTarget, pidlSource, cbSource);

return pidlTarget;
}

LPITEMIDLIST CPidlMgr::CopySingleItem ( LPCITEMIDLIST pidlSource )

Definition at line 211 of file PidlMgr.Cpp.

{
LPITEMIDLIST pidlTarget = NULL;
UINT cbSource = 0;

if(NULL == pidlSource)
   return NULL;

// Allocate the new pidl
cbSource = pidlSource->mkid.cb;
pidlTarget = (LPITEMIDLIST)m_pMalloc->Alloc(cbSource + sizeof(ITEMIDLIST));
if(!pidlTarget)
   return NULL;

// Copy the source to the target
ZeroMemory(pidlTarget, cbSource + sizeof(ITEMIDLIST));
CopyMemory(pidlTarget, pidlSource, cbSource);

return pidlTarget;
}

LPITEMIDLIST CPidlMgr::Create ( VOID ) [private]

Definition at line 67 of file PidlMgr.Cpp.

{
LPITEMIDLIST   pidlOut;
USHORT         uSize;

pidlOut = NULL;

/*
Calculate the size. This consists of the ITEMIDLIST plus the size of our
private PIDL structure.
*/
uSize = sizeof(ITEMIDLIST) + sizeof(PIDLDATA);

/*
Allocate the memory, adding an additional ITEMIDLIST for the NULL terminating
ID List.
*/
pidlOut = (LPITEMIDLIST)m_pMalloc->Alloc(uSize + sizeof(ITEMIDLIST));

if(pidlOut)
   {
   LPITEMIDLIST   pidlTemp = pidlOut;

   //set the size of this item
   pidlTemp->mkid.cb = uSize;

   //set the NULL terminator to 0
   pidlTemp = GetNextItem(pidlTemp);
   pidlTemp->mkid.cb = 0;
   pidlTemp->mkid.abID[0] = 0;
   }

return pidlOut;
}

LPITEMIDLIST CPidlMgr::CreateFolderPidl ( LPCTSTR pszName )

Definition at line 307 of file PidlMgr.Cpp.

{
LPITEMIDLIST   pidl = Create();
LPPIDLDATA     pData = GetDataPointer(pidl);

if(pData)
   {
   pData->fFolder = TRUE;

   LocalToWideChar(pData->wszName, pszName, MAX_NAME);

   pData->wszData[0] = 0;
   }

return pidl;
}

LPITEMIDLIST CPidlMgr::CreateItemPidl | ( | LPCTSTR | pszName,
 |  | LPCTSTR | pszData
 | ) |  |

Definition at line 332 of file PidlMgr.Cpp.

{
LPITEMIDLIST   pidl = Create();
LPPIDLDATA     pData = GetDataPointer(pidl);

if(pData)
   {
   pData->fFolder = FALSE;

   LocalToWideChar(pData->wszName, pszName, MAX_NAME);

   LocalToWideChar(pData->wszData, pszData, MAX_DATA);
   }

return pidl;
}

VOID CPidlMgr::Delete ( LPITEMIDLIST pidl )

Definition at line 110 of file PidlMgr.Cpp.

{
m_pMalloc->Free(pidl);
}

int CPidlMgr::GetData | ( | LPCITEMIDLIST | pidl,
 |  | LPTSTR | pszText,
 |  | DWORD | dwSize
 | ) |  |

Definition at line 419 of file PidlMgr.Cpp.

{
if(!IsBadWritePtr(pszText, dwSize))
   {
   *pszText = 0;

   LPPIDLDATA  pData = GetDataPointer(pidl);

   if(pData)
      {
      WideCharToLocal(pszText, pData->wszData, dwSize);
      return lstrlen(pszText);
      }
   }

return 0;
}

LPPIDLDATA CPidlMgr::GetDataPointer ( LPCITEMIDLIST pidl ) [inline, private]

Definition at line 238 of file PidlMgr.Cpp.

{
if(!pidl)
   return NULL;

return (LPPIDLDATA)(pidl->mkid.abID);
}

LPITEMIDLIST CPidlMgr::GetLastItem ( LPCITEMIDLIST pidl )

Definition at line 165 of file PidlMgr.Cpp.

{
LPITEMIDLIST   pidlLast = NULL;

//get the PIDL of the last item in the list
while(pidl && pidl->mkid.cb)
   {
   pidlLast = (LPITEMIDLIST)pidl;
   pidl = GetNextItem(pidl);
   }

return pidlLast;
}

int CPidlMgr::GetName | ( | LPCITEMIDLIST | pidl,
 |  | LPTSTR | pszText,
 |  | DWORD | dwSize
 | ) |  |

Definition at line 358 of file PidlMgr.Cpp.

{
if(!IsBadWritePtr(pszText, dwSize))
   {
   *pszText = 0;

   LPPIDLDATA  pData = GetDataPointer(pidl);

   if(pData)
      {
      WideCharToLocal(pszText, pData->wszName, dwSize);
      return lstrlen(pszText);
      }
   }

return 0;
}

LPITEMIDLIST CPidlMgr::GetNextItem ( LPCITEMIDLIST pidl )

Definition at line 121 of file PidlMgr.Cpp.

{
if(pidl)
   {
   return (LPITEMIDLIST)(LPBYTE)(((LPBYTE)pidl) + pidl->mkid.cb);
   }
else
   return NULL;
}

int CPidlMgr::GetRelativeName | ( | LPCITEMIDLIST | pidl,
 |  | LPTSTR | pszText,
 |  | DWORD | dwSize
 | ) |  |

Definition at line 384 of file PidlMgr.Cpp.

{
if(!IsBadWritePtr(pszText, dwSize))
   {
   LPITEMIDLIST   pidlTemp;
   *pszText = 0;

   //walk the list, getting the name for each item
   pidlTemp = (LPITEMIDLIST)pidl;
   while(pidlTemp && pidlTemp->mkid.cb)
      {
      LPTSTR   pszCurrent = pszText + lstrlen(pszText);
      dwSize -= GetName(pidlTemp, pszCurrent, dwSize);
      pidlTemp = GetNextItem(pidlTemp);

      //don't add a backslash to the last item
      if(pidlTemp && pidlTemp->mkid.cb)
         {
         SmartAppendBackslash(pszCurrent, dwSize - (pszCurrent - pszText));
         }
      }
   return lstrlen(pszText);
   }

return 0;
}

UINT CPidlMgr::GetSize ( LPCITEMIDLIST pidl )

Definition at line 137 of file PidlMgr.Cpp.

{
UINT cbTotal = 0;
LPITEMIDLIST pidlTemp = (LPITEMIDLIST)pidl;

if(pidlTemp)
   {
   while(pidlTemp->mkid.cb)
      {
      cbTotal += pidlTemp->mkid.cb;
      pidlTemp = GetNextItem(pidlTemp);
      }

   //add the size of the NULL terminating ITEMIDLIST
   cbTotal += sizeof(ITEMIDLIST);
   }

return cbTotal;
}

BOOL CPidlMgr::IsFolder ( LPCITEMIDLIST pidl )

Definition at line 445 of file PidlMgr.Cpp.

{
LPPIDLDATA  pData = GetDataPointer(pidl);

if(pData)
   {
   return pData->fFolder;
   }

return FALSE;
}

int CPidlMgr::SetData | ( | LPCITEMIDLIST | pidl,
 |  | LPCTSTR | pszData
 | ) |  |

Definition at line 463 of file PidlMgr.Cpp.

{
LPPIDLDATA  pData = GetDataPointer(pidl);

if(pData)
   {
   LocalToWideChar(pData->wszData, pszData, MAX_DATA);

   return lstrlenW(pData->wszData);
   }

return 0;
}

Member Data Documentation

LPMALLOC CPidlMgr::m_pMalloc [private]

Definition at line 72 of file PidlMgr.h.

The documentation for this class was generated from the following files:
  • WinUI/Shell/SampView/PidlMgr.h
  • WinUI/Shell/SampView/PidlMgr.Cpp
Generated on Wed Nov 13 2024 16:57:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPingResponder Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CPingResponder Class Reference

#include "PingResponder.h"

List of all members.

Public Member Functions

CPingResponder ()
STDMETHOD() Ping ()

Detailed Description

Definition at line 34 of file PingResponder.h.

Constructor & Destructor Documentation

CPingResponder::CPingResponder ( ) [inline]

Definition at line 40 of file PingResponder.h.

  {
  }

Member Function Documentation

HRESULT STDMETHODCALLTYPE CPingResponder::Ping ( )

Definition at line 140 of file PingResp.Cpp.

                                              {
  return S_OK;
}

The documentation for this class was generated from the following files:
  • Com/Fundamentals/DCom/TimeOuts/PingResp/PingResponder.h
  • Com/Fundamentals/DCom/TimeOuts/PingResp/PingResp.Cpp
Generated on Wed Nov 13 2024 16:57:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPlane Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Types | Private Attributes | Static Private Attributes

CPlane Class Reference

#include "sky.h"

Inherits CDelegationBase.

List of all members.

Public Member Functions

CPlane (_TCHAR *szName, int id, LONG lWeight, LONG lHeight, LONG lPayload)
virtual | ~CPlane ()
virtual const int | GetBitmapIndex ()
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const GUID & | getNodeType ()
virtual HRESULT | OnAddMenuItems (IContextMenuCallback *pContextMenuCallback, long *pInsertionsAllowed)
virtual HRESULT | OnMenuCommand (IConsole *pConsole, long lCommandID)

Private Types

enum | { RUNNING, PAUSED, STOPPED }
enum | { IDM_START_SKY = 100, IDM_PAUSE_SKY, IDM_STOP_SKY }

Private Attributes

enum CPlane:: { ... } | iStatus
LONG | lHeight
LONG | lPayload
LONG | lWeight
int | nId
_TCHAR * | szName

Static Private Attributes

static const GUID | thisGuid = { 0x2af5ebcf, 0x6adc, 0x11d3, {0x91, 0x55, 0x0, 0xc0, 0x4f, 0x65, 0xb3, 0xf9} }

Detailed Description

Definition at line 26 of file sky.h.

Member Enumeration Documentation

anonymous enum [private]
Enumerator:
RUNNING
PAUSED
STOPPED

Definition at line 50 of file sky.h.

{RUNNING, PAUSED, STOPPED} iStatus;

anonymous enum [private]
Enumerator:
IDM_START_SKY
IDM_PAUSE_SKY
IDM_STOP_SKY

Definition at line 51 of file sky.h.

{ IDM_START_SKY = 100, IDM_PAUSE_SKY, IDM_STOP_SKY };

Constructor & Destructor Documentation

CPlane::CPlane | ( | _TCHAR * | szName,
 |  | int | id,
 |  | LONG | lWeight,
 |  | LONG | lHeight,
 |  | LONG | lPayload
 | ) |  |

Definition at line 155 of file sky.Cpp.

: szName(NULL), lWeight(0), lHeight(0), lPayload(0), iStatus(STOPPED)
{
    if (szName) {
        this->szName = new _TCHAR[(_tcslen(szName) + 1) * sizeof(_TCHAR)];
        _tcscpy(this->szName, szName);
    }

    this->nId = id;
    this->lWeight = lWeight;
    this->lHeight = lHeight;
    this->lPayload = lPayload;
}

CPlane::~CPlane ( ) [virtual]

Definition at line 169 of file sky.Cpp.

{
    if (szName)
        delete [] szName;
}

Member Function Documentation

virtual const int CPlane::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 34 of file sky.h.

{ return INDEX_SKYICON; }

const _TCHAR * CPlane::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

Definition at line 175 of file sky.Cpp.

{
    static _TCHAR buf[128];

    switch (nCol) {
    case 0:
        _stprintf(buf, _T("%s (#%d)"), szName ? szName : _T(""), nId);
        break;

    case 1:
        _stprintf(buf, _T("%ld metric tons"), lWeight);
        break;

    case 2:
        _stprintf(buf, _T("%ld meters"), lHeight);
        break;

    case 3:
        _stprintf(buf, _T("%ld kilos"), lPayload);
        break;

    case 4:
        _stprintf(buf, _T("%s"),
            iStatus == RUNNING ? _T("running") :
        iStatus == PAUSED ? _T("paused") :
        iStatus == STOPPED ? _T("stopped") : _T("unknown"));
        break;

    }

    return buf;
}

virtual const GUID& CPlane::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 33 of file sky.h.

{ return thisGuid; }

HRESULT CPlane::OnAddMenuItems | ( | IContextMenuCallback * | pContextMenuCallback,
 |  | long * | pInsertionsAllowed |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 208 of file sky.Cpp.

{
    HRESULT hr = S_OK;
    CONTEXTMENUITEM menuItemsTask[] =
    {
        {
            L"Start vehicle", L"Start the extension plane",
                IDM_START_SKY, CCM_INSERTIONPOINTID_PRIMARY_TASK  , 0, CCM_SPECIAL_DEFAULT_ITEM
        },
        {
            L"Pause vehicle", L"Pause the extension plane",
                IDM_PAUSE_SKY, CCM_INSERTIONPOINTID_PRIMARY_TASK, 0, 0
        },
        {
            L"Stop vehicle", L"Stop the extension plane",
                IDM_STOP_SKY, CCM_INSERTIONPOINTID_PRIMARY_TASK, 0, 0
        },
        { NULL, NULL, 0, 0, 0 }
    };

    // Loop through and add each of the menu items
    if (*pInsertionsAllowed & CCM_INSERTIONALLOWED_TASK)
    {
        for (LPCONTEXTMENUITEM m = menuItemsTask; m->strName; m++)
        {
            hr = pContextMenuCallback->AddItem(m);

            if (FAILED(hr))
                break;
        }
    }

    return hr;
}

HRESULT CPlane::OnMenuCommand | ( | IConsole * | pConsole,
 |  | long | lCommandID |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 243 of file sky.Cpp.

{
    _TCHAR szVehicle[128];

    switch (lCommandID) {
    case IDM_START_SKY:
        iStatus = RUNNING;
        break;

    case IDM_PAUSE_SKY:
        iStatus = PAUSED;
        break;

    case IDM_STOP_SKY:
        iStatus = STOPPED;
        break;
    }

    _stprintf(szVehicle, _T("%s has been %s"), GetDisplayName(0),
        (long)iStatus == RUNNING ? _T("started") :
    (long)iStatus == PAUSED ? _T("paused") :
    (long)iStatus == STOPPED ? _T("stopped") : _T("!!!unknown command!!!"));

    MAKE_WIDEPTR_FROMTSTR(ptrname, szVehicle);
    int ret = 0;
    pConsole->MessageBox(ptrname,
        L"Vehicle command", MB_OK | MB_ICONINFORMATION, &ret);

    return S_OK;
}

Member Data Documentation

enum { ... } CPlane::iStatus [private]
LONG CPlane::lHeight [private]

Definition at line 47 of file sky.h.

LONG CPlane::lPayload [private]

Definition at line 48 of file sky.h.

LONG CPlane::lWeight [private]

Definition at line 46 of file sky.h.

int CPlane::nId [private]

Definition at line 49 of file sky.h.

_TCHAR* CPlane::szName [private]

Definition at line 45 of file sky.h.

const GUID CPlane::thisGuid = { 0x2af5ebcf, 0x6adc, 0x11d3, {0x91, 0x55, 0x0, 0xc0, 0x4f, 0x65, 0xb3, 0xf9} } [static, private]

Reimplemented from CDelegationBase.

Definition at line 43 of file sky.h.

The documentation for this class was generated from the following files:
  • SysMgmt/MMC/Nameext/sky.h
  • SysMgmt/MMC/Nameext/sky.Cpp
Generated on Wed Nov 13 2024 16:57:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPlex Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Public Attributes

CPlex Struct Reference

#include "heap.h"

List of all members.

Public Member Functions

void * | data ()
void * | data ()
void * | data ()
void * | data ()
void * | data ()
void * | data ()
void * | data ()
void | FreeDataChain ()
void | FreeDataChain ()
void | FreeDataChain ()
void | FreeDataChain ()
void | FreeDataChain ()
void | FreeDataChain ()
void | FreeDataChain ()

Static Public Member Functions

static CPlex *PASCAL | Create (CPlex *&head, UINT nMax, UINT cbElement)
static CPlex *PASCAL | Create (CPlex *&head, UINT nMax, UINT cbElement)
static CPlex *PASCAL | Create (CPlex *&head, UINT nMax, UINT cbElement)
static CPlex *PASCAL | Create (CPlex *&head, UINT nMax, UINT cbElement)
static CPlex *PASCAL | Create (CPlex *&head, UINT nMax, UINT cbElement)
static CPlex *PASCAL | Create (CPlex *&head, UINT nMax, UINT cbElement)
static CPlex *PASCAL | Create (CPlex *&head, UINT nMax, UINT cbElement)

Public Attributes

DWORD | dwReserved [1]
CPlex * pNext

Detailed Description

Definition at line 6 of file heap.h.

Member Function Documentation

CPlex *PASCAL CPlex::Create | ( | CPlex *& | head,
 |  | UINT | nMax,
 |  | UINT | cbElement |
 | ) |  |  | [static]

Definition at line 57 of file heap.Cpp.

{
  CPlex* p = (CPlex*) new BYTE[sizeof(CPlex) + nMax * cbElement];
      // may throw exception
  p->pNext = pHead;
  pHead = p;  // change head (adds in reverse order for simplicity)
  return p;
}

static CPlex* PASCAL CPlex::Create | ( | CPlex *& | head,
 |  | UINT | nMax,
 |  | UINT | cbElement |
 | ) |  |  | [static]
static CPlex* PASCAL CPlex::Create | ( | CPlex *& | head,
 |  | UINT | nMax,
 |  | UINT | cbElement |
 | ) |  |  | [static]
static CPlex* PASCAL CPlex::Create | ( | CPlex *& | head,
 |  | UINT | nMax,
 |  | UINT | cbElement |
 | ) |  |  | [static]
static CPlex* PASCAL CPlex::Create | ( | CPlex *& | head,
 |  | UINT | nMax,
 |  | UINT | cbElement |
 | ) |  |  | [static]
static CPlex* PASCAL CPlex::Create | ( | CPlex *& | head,
 |  | UINT | nMax,
 |  | UINT | cbElement |
 | ) |  |  | [static]
static CPlex* PASCAL CPlex::Create | ( | CPlex *& | head,
 |  | UINT | nMax,
 |  | UINT | cbElement |
 | ) |  |  | [static]
void* CPlex::data ( ) [inline]

Definition at line 47 of file llistimpl.h.

{ return this+1; }

void* CPlex::data ( ) [inline]

Definition at line 47 of file llistimpl.h.

{ return this+1; }

void* CPlex::data ( ) [inline]

Definition at line 47 of file llistimpl.h.

{ return this+1; }

void* CPlex::data ( ) [inline]

Definition at line 47 of file llistimpl.h.

{ return this+1; }

void* CPlex::data ( ) [inline]

Definition at line 12 of file heap.h.

{ return this+1; }

void* CPlex::data ( ) [inline]

Definition at line 46 of file llistimpl.h.

{ return this+1; }

void* CPlex::data ( ) [inline]

Definition at line 47 of file llistimpl.h.

{ return this+1; }

void CPlex::FreeDataChain ( )
void CPlex::FreeDataChain ( )
void CPlex::FreeDataChain ( )
void CPlex::FreeDataChain ( )
void CPlex::FreeDataChain ( )
void CPlex::FreeDataChain ( )

Definition at line 66 of file heap.Cpp.

{
  CPlex* p = this;
  while (p != NULL)
  {
    BYTE* bytes = (BYTE*) p;
    CPlex* pNext = p->pNext;
    delete[] bytes;
    p = pNext;
  }
}

void CPlex::FreeDataChain ( )

Member Data Documentation

DWORD CPlex::dwReserved

Definition at line 9 of file heap.h.

CPlex * CPlex::pNext

Definition at line 8 of file heap.h.

The documentation for this struct was generated from the following files:
  • Com/Tools/EntityProxy/DataServices/heap.h
  • SysMgmt/MMC/mmc2.0/contextmenu/llistimpl.h
  • SysMgmt/MMC/mmc2.0/dragdrop/llistimpl.h
  • SysMgmt/MMC/mmc2.0/help/llistimpl.h
  • SysMgmt/MMC/mmc2.0/multisel/llistimpl.h
  • SysMgmt/MMC/mmc2.0/proppage/llistimpl.h
  • SysMgmt/MMC/mmc2.0/viewex/llistimpl.h
  • Com/Tools/EntityProxy/DataServices/heap.Cpp
  • SysMgmt/MMC/mmc2.0/contextmenu/llistimpl.cpp
  • SysMgmt/MMC/mmc2.0/dragdrop/llistimpl.cpp
  • SysMgmt/MMC/mmc2.0/help/llistimpl.cpp
  • SysMgmt/MMC/mmc2.0/multisel/llistimpl.cpp
  • SysMgmt/MMC/mmc2.0/proppage/llistimpl.cpp
  • SysMgmt/MMC/mmc2.0/viewex/llistimpl.cpp
Generated on Wed Nov 13 2024 16:57:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPlgFilter Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes | Friends

CPlgFilter Class Reference

#include "plgtermfilter.h"

List of all members.

Public Member Functions

CPlgFilter ()
~CPlgFilter ()
CBasePin * | GetPin (int nIndex)
virtual DECLARE_IUNKNOWN int | GetPinCount ()
STDMETHOD() | Initialize ()
HRESULT | InitializePrivate (ITPlgPrivEventSink *pSink)
STDMETHODIMP | Pause (void)
STDMETHODIMP | Run (REFERENCE_TIME tStart)
STDMETHODIMP | Stop (void)

Private Member Functions

HRESULT | CreatePin ()

Private Attributes

LPWAVEFORMATEX | m_lpWaveFormatEx
CPlgPin * m_pInputPin
ITPlgPrivEventSink * | m_pPlgEventSink

Friends

class | CPlgPin

Detailed Description

Definition at line 29 of file plgtermfilter.h.

Constructor & Destructor Documentation

CPlgFilter::CPlgFilter ( )

Definition at line 26 of file plgtermfilter.cpp.

    : CBaseFilter(_T("PlgFilter"), NULL, (CCritSec *) this, CLSID_PlgSampleFilter),
    m_pInputPin(NULL),
    m_lpWaveFormatEx(NULL),
    m_pPlgEventSink(NULL)
{
    LOG((MSP_TRACE, "CPlgFilter::CPlgFilter - enter"));
}

CPlgFilter::~CPlgFilter ( )

Definition at line 38 of file plgtermfilter.cpp.

{
    LOG((MSP_TRACE, "CPlgFilter::~CPlgFilter - enter"));

    //
    // Delete the input pin
    //
    if(m_pInputPin)
    {
        delete m_pInputPin;
    }

    m_pPlgEventSink = NULL;

    //
    // Delete the WAVEFORMATEX
    //
    if(m_lpWaveFormatEx)
    {
        CoTaskMemFree(m_lpWaveFormatEx);
    }

    LOG((MSP_TRACE, "CPlgFilter::~CPlgFilter - exit"));

}

Member Function Documentation

HRESULT CPlgFilter::CreatePin ( ) [private]

Definition at line 104 of file plgtermfilter.cpp.

{
    LOG((MSP_TRACE, "CPlgFilter::CreatePin - enter"));
    USES_CONVERSION;

    CAutoLock lock(this);

    HRESULT hr = S_OK;

    //
    // Already created?
    //

    if (m_pInputPin)
    {
        LOG((MSP_TRACE, "CPlgFilter::CreatePin - exit, the pin already created"));
        return S_OK;
    }

    //
    // Create the pin named using CLSID
    //

    LPOLESTR lpolestrPinName = NULL;
    hr = StringFromCLSID(CLSID_PlgSamplePin, &lpolestrPinName);
    if (FAILED(hr))
    {
        LOG((MSP_ERROR, "StringFromCLSID 0x%08x", hr));
        return hr;
    }

    //
    //create pin
    //
    m_pInputPin = new CPlgPin( this, &hr, OLE2W(lpolestrPinName));

    //
    //clean up
    //
    ::CoTaskMemFree(lpolestrPinName);

    //
    // Cannot allocate?
    //

    if (m_pInputPin == NULL)
    {
        LOG((MSP_TRACE, "CPlgFilter::CreatePin - cannot create CPlgPin; returning E_OUTOFMEMORY"));
        return E_OUTOFMEMORY;
    }

    //
    // Other things went wrong?
    //

    if ( FAILED(hr) )
    {
        delete m_pInputPin;
        m_pInputPin = NULL;
    }

    LOG((MSP_TRACE, "CPlgFilter::CreatePin - exit 0x%08x", hr));
    return hr;
}

CBasePin * CPlgFilter::GetPin ( int nIndex )

Definition at line 82 of file plgtermfilter.cpp.

{
    LOG((MSP_TRACE, "CPlgFilter::GetPin - enter"));

    //
    //check the index
    //

    HRESULT hr = (0 == nPinIndex)?S_OK:E_FAIL;

    LOG((MSP_TRACE, "CPlgFilter::GetPin - exit 0x%08x", hr));

    return (hr == S_OK)? m_pInputPin : NULL;

}

int CPlgFilter::GetPinCount ( ) [virtual]

Definition at line 68 of file plgtermfilter.cpp.

{
    LOG((MSP_TRACE, "CPlgFilter::GetPinCount - enter"));

    LOG((MSP_TRACE, "CPlgFilter::GetPinCount - exit"));
    return 1;
}

HRESULT CPlgFilter::Initialize ( void )

Definition at line 268 of file plgtermfilter.cpp.

{

    LOG((MSP_TRACE, "CPlgFilter::Initialize - enter"));

    HRESULT hr = CreatePin();

    LOG((MSP_TRACE, "CPlgFilter::Initialize - exit 0x%08x\n", hr));

    return hr;

}

HRESULT CPlgFilter::InitializePrivate ( ITPlgPrivEventSink * pSink )

Definition at line 282 of file plgtermfilter.cpp.

{
  m_pPlgEventSink = pSink;
  return S_OK;
}

HRESULT CPlgFilter::Pause ( void )

Definition at line 204 of file plgtermfilter.cpp.

{
    LOG((MSP_TRACE, "CPlgFilter::Pause - enter"));

    CAutoLock lock(this);

    //
    // Check we can PAUSE given our current state
    //

    if (m_State == State_Running)
    {
    }

    //
    // tell the pin to go active or inactive and change state
    //
    HRESULT hr = CBaseFilter::Pause();

    LOG((MSP_TRACE, "CPlgFilter::Pause - exit 0x%08x\n", hr));
    return hr;
}

STDMETHODIMP CPlgFilter::Run ( REFERENCE_TIME tStart )
HRESULT CPlgFilter::Stop ( void )

Definition at line 234 of file plgtermfilter.cpp.

{
    LOG((MSP_TRACE, "CPlgFilter::Stop - enter"));

    CAutoLock lock(this);

    HRESULT hr = E_FAIL;

    if (m_State != State_Stopped)
    {

        // Pause the device if we were running
        if (m_State == State_Running)
        {
            hr = Pause();
            if (FAILED(hr))
            {
                LOG((MSP_TRACE, "CPlgFilter::Stop - exit 0x%08x\n", hr));
                return hr;
            }
        }

        // Base class changes state and tells pin to go to inactive
        // the pin Inactive method will decommit our allocator which
        // we need to do before closing the device

        hr = CBaseFilter::Stop();
    }

    LOG((MSP_TRACE, "CPlgFilter::Stop - exit 0x%08x\n", hr));
    return hr;
}

Friends And Related Function Documentation

friend class CPlgPin [friend]

Definition at line 74 of file plgtermfilter.h.

Member Data Documentation

LPWAVEFORMATEX CPlgFilter::m_lpWaveFormatEx [private]

Definition at line 70 of file plgtermfilter.h.

CPlgPin* CPlgFilter::m_pInputPin [private]

Definition at line 67 of file plgtermfilter.h.

ITPlgPrivEventSink* CPlgFilter::m_pPlgEventSink [private]

Definition at line 72 of file plgtermfilter.h.

The documentation for this class was generated from the following files:
  • NetDS/Tapi/Tapi3/Cpp/pluggable/plgtermfilter.h
  • NetDS/Tapi/Tapi3/Cpp/pluggable/plgtermfilter.cpp
Generated on Wed Nov 13 2024 16:57:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPlgPin Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes

CPlgPin Class Reference

#include "plgtermpin.h"

List of all members.

Public Member Functions

CPlgPin (CPlgFilter *pFilter, HRESULT *phr, LPCWSTR pPinName)
virtual | ~CPlgPin ()
HRESULT | Active (void)
HRESULT | CheckMediaType (const CMediaType *pmt)
HRESULT | GetMediaType (CMediaType *pmt)
HRESULT | Inactive (void)
STDMETHODIMP | Receive (IMediaSample *pSample)
HRESULT | SetMediaType (const CMediaType *pmt)

Public Attributes

DECLARE_IUNKNOWN

Private Member Functions

HRESULT | InitMediaType ()

Private Attributes

WAVEFORMATEX | m_wfxFormat

Detailed Description

Definition at line 27 of file plgtermpin.h.

Constructor & Destructor Documentation

CPlgPin::CPlgPin | ( | CPlgFilter * | pFilter,
 |  | HRESULT * | phr,
 |  | LPCWSTR | pPinName
 | ) |  |

Definition at line 23 of file plgtermpin.cpp.

        : CBaseInputPin(_T("CPlgPin"), pFilter, pFilter, phr, pPinName)
{
    LOG((MSP_TRACE, "CPlgPin::CPlgPin"));
}

CPlgPin::~CPlgPin ( ) [virtual]

Definition at line 32 of file plgtermpin.cpp.

{
    LOG((MSP_TRACE, "CPlgPin::~CPlgPin"));
}

Member Function Documentation

HRESULT CPlgPin::Active ( void )

Definition at line 181 of file plgtermpin.cpp.

{
    LOG((MSP_TRACE, "CPlgPin::Active - enter"));

    if(NULL == m_pFilter)
    {
        return E_UNEXPECTED;
    }

    CAutoLock lock((CPlgFilter*)m_pFilter);

    HRESULT hr = CBasePin::Active();

  if(((CPlgFilter*)m_pFilter)->m_pPlgEventSink != NULL)
  {
    ((CPlgFilter*)m_pFilter)->m_pPlgEventSink->FireEvent(1);
  }

    LOG((MSP_TRACE, "CPlgPin::Active - exit 0x%08x", hr));
    return hr;
}

HRESULT CPlgPin::CheckMediaType ( const CMediaType * pmt )

Definition at line 47 of file plgtermpin.cpp.

{
    LOG((MSP_TRACE, "CPlgPin::CheckMediaType - enter"));

    //
    // Validates parameters
    //

    if( IsBadReadPtr(pmt, sizeof(CMediaType)) )
    {
        LOG((MSP_ERROR, "CPlgPin::CheckMediaType - "
            "invalid pointer, return E_POINTER"));
        return E_POINTER;
    }

    if ( !pmt->IsValid() )
    {

        LOG((MSP_ERROR,
            "CPlgPin::CheckMediaType - media type invalid. "
            "E_INVALIDARG"));

        return VFW_E_INVALIDMEDIATYPE;
    }

    CAutoLock lock((CPlgFilter*)m_pFilter);

    //
    // reject non-Audio type
    //

    if (pmt->majortype  != MEDIATYPE_Audio ||
        pmt->formattype != FORMAT_WaveFormatEx)
    {
        LOG((MSP_ERROR, "CPlgPin::CheckMediaType - "
            "non-Audio type, return VFW_E_INVALIDMEDIATYPE"));
        return VFW_E_INVALIDMEDIATYPE;
    }

    LOG((MSP_TRACE, "CPlgPin::CheckMediaType - succeeded"));
    return S_OK;
}

HRESULT CPlgPin::GetMediaType ( CMediaType * pmt )
HRESULT CPlgPin::Inactive ( void )

Definition at line 210 of file plgtermpin.cpp.

{
    LOG((MSP_TRACE, "CPlgPin::Inactive - enter"));

    if(NULL == m_pFilter)
    {
        return E_UNEXPECTED;
    }

    CAutoLock lock((CPlgFilter*)m_pFilter);

    HRESULT hr = CBasePin::Inactive();

    if(((CPlgFilter*)m_pFilter)->m_pPlgEventSink != NULL)
    {
        ((CPlgFilter*)m_pFilter)->m_pPlgEventSink->FireEvent(0);
    }

    LOG((MSP_TRACE, "CPlgPin::Inactive - exit 0x%08x", hr));
    return hr;
}

HRESULT CPlgPin::InitMediaType ( void ) [private]

Definition at line 295 of file plgtermpin.cpp.

{
    LOG((MSP_TRACE, "CPlgPin::InitMediaType - enter"));

    CPlgFilter* pFilter = (CPlgFilter*)m_pFilter;

    if(NULL == m_pFilter)
    {
        return E_UNEXPECTED;
    }

    //
    // Is already initialized ?
    //
    if(pFilter->m_lpWaveFormatEx != NULL)
    {
        LOG((MSP_TRACE, "CTGPin::InitMediaType - succeeded,"
            "WAVEFORMATEX already initialize"));
        return S_OK;
    }

    //
    // Create a new WAVEFORMATEX
    //

    pFilter->m_lpWaveFormatEx = (LPWAVEFORMATEX) CoTaskMemAlloc(sizeof(WAVEFORMATEX));
    if (!pFilter->m_lpWaveFormatEx)
    {
        LOG((MSP_ERROR, "CTGPin::InitMediaType - "
            "cannot allocate WAVEFORMATEX, return E_OUTOFMEMORY"));
        return E_OUTOFMEMORY;
    }

    // reset the memory
    ZeroMemory(pFilter->m_lpWaveFormatEx, sizeof (WAVEFORMATEX));

    // sets the fields
    pFilter->m_lpWaveFormatEx->wFormatTag      = WAVE_FORMAT_PCM;
    pFilter->m_lpWaveFormatEx->wBitsPerSample  = 16;
    pFilter->m_lpWaveFormatEx->nChannels       = 1;
    pFilter->m_lpWaveFormatEx->nSamplesPerSec  = 8000;
    pFilter->m_lpWaveFormatEx->nBlockAlign     = 1 * ((16 + 7)/8);
    pFilter->m_lpWaveFormatEx->nAvgBytesPerSec = 8000 *
                                               pFilter->m_lpWaveFormatEx->nBlockAlign;
    pFilter->m_lpWaveFormatEx->cbSize          = 0;

    LOG((MSP_TRACE, "CPlgPin::InitMediaType exit - S_OK"));
    return S_OK;
}

STDMETHODIMP CPlgPin::Receive ( IMediaSample * pSample )
HRESULT CPlgPin::SetMediaType ( const CMediaType * pmt )

Member Data Documentation

CPlgPin::DECLARE_IUNKNOWN

Definition at line 41 of file plgtermpin.h.

WAVEFORMATEX CPlgPin::m_wfxFormat [private]

Definition at line 63 of file plgtermpin.h.

The documentation for this class was generated from the following files:
  • NetDS/Tapi/Tapi3/Cpp/pluggable/plgtermpin.h
  • NetDS/Tapi/Tapi3/Cpp/pluggable/plgtermpin.cpp
Generated on Wed Nov 13 2024 16:57:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPlgTermSample Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CPlgTermSample Class Reference

#include "plgterm.h"

List of all members.

Public Member Functions

CPlgTermSample ()
virtual | ~CPlgTermSample ()
virtual HRESULT | AddFiltersToGraph ()
virtual HRESULT | FinalConstruct (void)
STDMETHOD() | FireEvent (long lEventCode)
STDMETHOD() | GetInterfaceSafetyOptions (REFIID riid, DWORD *pdwSupportedOptions, DWORD *pdwEnabledOptions)
virtual DWORD | GetSupportedMediaTypes ()
virtual HRESULT STDMETHODCALLTYPE | InitializeDynamic (IN IID iidTerminalClass, IN DWORD dwMediaType, IN TERMINAL_DIRECTION Direction, IN MSP_HANDLE htAddress)
STDMETHOD() | RegisterSink (IN ITPluggableTerminalEventSink *pSink)
STDMETHOD() | SetInterfaceSafetyOptions (REFIID riid, DWORD dwOptionSetMask, DWORD dwEnabledOptions)
STDMETHOD() | UnregisterSink ()

Private Member Functions

HRESULT | CreateFilter ()
HRESULT | FindPin ()
HRESULT | SetTerminalInfo ()

Private Attributes

BOOL m_bKnownSafeContext
ITPluggableTerminalEventSink * | m_pEventSink
IUnknown * | m_pFTM

Detailed Description

Definition at line 17 of file plgterm.h.

Constructor & Destructor Documentation

CPlgTermSample::CPlgTermSample ( )

Definition at line 16 of file plgterm.cpp.

  :m_pEventSink(NULL),
  m_bKnownSafeContext(FALSE)
{

  LOG((MSP_TRACE, "CPlgTermSample::CPlgTermSample enter"));

}

CPlgTermSample::~CPlgTermSample ( ) [virtual]

Definition at line 29 of file plgterm.cpp.

{
  LOG((MSP_TRACE, "CPlgTermSample::~CPlgTermSample enter"));

    //
    // if we have an event sink, release it
    //
    if( NULL != m_pEventSink )
    {
    LOG((MSP_TRACE, "CPlgTermSample::~CPlgTermSample release sink"));
        m_pEventSink->Release();
        m_pEventSink = NULL;
    }

    //
  // Release free thread marshaler
  //
    if( m_pFTM )
    {
        m_pFTM->Release();
        m_pFTM = NULL;
    }

  LOG((MSP_TRACE, "CPlgTermSample::~CPlgTermSample exit"));
}

Member Function Documentation

HRESULT CPlgTermSample::AddFiltersToGraph ( ) [virtual]

Definition at line 353 of file plgterm.cpp.

{
    LOG((MSP_TRACE, "CPlgTermSample::AddFiltersToGraph enter "));

    USES_CONVERSION;

    //
    // Validates m_pGraph
    //

    if ( m_pGraph == NULL)
    {
        LOG((MSP_ERROR, "CPlgTermSample::AddFiltersToGraph - "
        "we have no graph - returning 0x%08x", E_UNEXPECTED));
        return E_UNEXPECTED;
    }

    //
    // Validates m_pIFilter
    //

    if ( m_pIFilter == NULL)
    {
        LOG((MSP_ERROR, "CPlgTermSample::AddFiltersToGraph - "
        "we have no filter - returning 0x%08x", E_UNEXPECTED));
        return E_UNEXPECTED;
    }

    CLock lock(m_CritSec);

    //
    // AddFilter returns VFW_S_DUPLICATE_NAME if name is duplicate; still succeeds
    //

    HRESULT hr = m_pGraph->AddFilter(m_pIFilter, T2CW(m_szName));

    if ( FAILED(hr) )
    {
        LOG((MSP_ERROR, "CPlgTermSample::AddFiltersToGraph - "
        "can not add filter "));

    }

    LOG((MSP_TRACE, "CPlgTermSample::AddFiltersToGraph - exit %08x", hr));
    return hr;
}

HRESULT CPlgTermSample::CreateFilter ( ) [private]

Definition at line 444 of file plgterm.cpp.

{
    LOG((MSP_TRACE, "CPlgTermSample::CreateFilter - enter"));

    // Create the filter
    CPlgFilter* pFilter = new CPlgFilter();

    if( NULL == pFilter )
    {
        LOG((MSP_ERROR, "CPlgTermSample::CreateFilter - "
                "create filter failed - returning 0x%08x", E_OUTOFMEMORY));
        return E_OUTOFMEMORY;
    }

    // COM Rule
    pFilter->AddRef();

  //
  // Get the pin
  //

  HRESULT hr = pFilter->Initialize( );
    if( FAILED(hr) )
    {
        LOG((MSP_ERROR, "CPlgTermSample::CreateFilter - "
                "Initialize private failed - returning 0x%08x", hr));
    pFilter->Release();
        return hr;
    }

    //
    // Get the IBaseFilter interface
    //

    hr = pFilter->QueryInterface(
        IID_IBaseFilter,
        (void**)&m_pIFilter
        );

    if( FAILED(hr) )
    {
        LOG((MSP_ERROR, "CPlgTermSample::CreateFilter - "
            "QI for IBaseFilter failed"));
    }
    else
    {
        pFilter->InitializePrivate(this);
    }

    pFilter->Release();

    LOG((MSP_TRACE, "CPlgTermSample::CreateFilter - exit 0x%08x", hr));
    return hr;
}

HRESULT CPlgTermSample::FinalConstruct ( void ) [virtual]

Definition at line 658 of file plgterm.cpp.

{
    LOG((MSP_TRACE, "CPlgTermSample::FinalConstruct - enter"));

    HRESULT hr = CoCreateFreeThreadedMarshaler( GetControllingUnknown(),
                                                & m_pFTM );

    if ( FAILED(hr) )
    {
        LOG((MSP_ERROR, "CFPTerminal::FinalConstruct - "
            "create FTM returned 0x%08x; exit", hr));

        return hr;
    }

    LOG((MSP_TRACE, "CPlgTermSample::FinalConstruct - exit S_OK"));

    return S_OK;

}

HRESULT CPlgTermSample::FindPin ( ) [private]

Definition at line 506 of file plgterm.cpp.

{
    LOG((MSP_TRACE, "CPlgTermSample::FindPin - enter"));

    //
    // Validates the filter object (smart pointer)
    //

    if (m_pIFilter == NULL)
    {
        LOG((MSP_ERROR, "CPlgTermSample::FindPin - "
        "filter object is NULL - returning 0x%08x", E_UNEXPECTED));
        return E_UNEXPECTED;
    }

    //
    // Make sure the IPin object is not initialized
    //

    if (m_pIPin != NULL)
    {
        LOG((MSP_ERROR, "CPlgTermSample::FindPin - "
        "already got a pin - returning 0x%08x", E_UNEXPECTED));
        return E_UNEXPECTED;
    }

    HRESULT hr;
    IEnumPins* pIEnumPins;
    ULONG cFetched;

    //
    // Get the pins collection
    //

    if (FAILED(hr = m_pIFilter->EnumPins(&pIEnumPins)))
    {
        LOG((MSP_ERROR, "CPlgTermSample::FindPin - "
        "cannot enum pins - returning 0x%08x", hr));
        return hr;
    }

    //
    // Get the out pin of the Pluggable Filter
    //

    if (S_OK != (hr = pIEnumPins->Next(1, &m_pIPin, &cFetched)))
    {
        LOG((MSP_ERROR, "CPlgTermSample::FindPin - "
        "cannot get a pin - returning 0x%08x", hr));

        hr = (hr == S_FALSE) ? E_FAIL : hr;
    }

    LOG((MSP_TRACE, "CPlgTermSample::FindPin - exit 0x%08x", hr));
    return S_OK;
}

HRESULT CPlgTermSample::FireEvent ( long lEventCode )

Definition at line 60 of file plgterm.cpp.

{
  LOG((MSP_TRACE, "CPlgTermSample::FireEvent enter"));
  //
    // we need a sink before we can fire an event
    //

    CLock lock(m_CritSec);

    if (NULL == m_pEventSink)
    {
        LOG((MSP_ERROR, "CPlgTermSample::FireEvent no Sink - exit E_FAIL"));
        return E_FAIL;
    }

    //
    // initilize the structure
    //

    MSP_EVENT_INFO mspEventInfo;

    mspEventInfo.dwSize = sizeof(MSP_EVENT_INFO);
    mspEventInfo.Event = ME_PRIVATE_EVENT;
    mspEventInfo.hCall = NULL;

    mspEventInfo.MSP_PRIVATE_EVENT_INFO.lEventCode = lEventCode;

    //
    // put the pointer to our IDispatch interface in the structure
    //

    HRESULT hr = _InternalQueryInterface(IID_IDispatch,
                                         reinterpret_cast<void**>(&(mspEventInfo.MSP_PRIVATE_EVENT_INFO.pEvent)));

    if (FAILED(hr))
    {
        LOG((MSP_ERROR, "CPlgTermSample::FireEvent failed to get IDispatch interface - exit hr=0x%08", hr));
        return hr;
    }

    //
    // pass event to the msp
    //

    hr = m_pEventSink->FireEvent(&mspEventInfo);

    if (FAILED(hr))
    {

        //
        // release all interfaces that we are holding.
        // fire event failed so no one else will release them for us.
        //
        mspEventInfo.MSP_PRIVATE_EVENT_INFO.pEvent->Release();
        mspEventInfo.MSP_PRIVATE_EVENT_INFO.pEvent=NULL;

        LOG((MSP_ERROR, "CPlgTermSample::FireEvent on sink failed - exit hr=0x%08", hr));

        return hr;
    }

    //
    // event fired
    //

    LOG((MSP_TRACE, "CPlgTermSample::FireEvent exit S_OK"));

    return hr;
}

HRESULT CPlgTermSample::GetInterfaceSafetyOptions | ( | REFIID | riid,
 |  | DWORD * | pdwSupportedOptions,
 |  | DWORD * | pdwEnabledOptions
 | ) |  |

Definition at line 623 of file plgterm.cpp.

{

    CLock lock(m_CritSec);

    //
    // check if we are running in safe context
    //

    if (!m_bKnownSafeContext)
    {

        //
        // we have not been initialized properly... someone evil is trying to
        // use this terminal. NO!
        //

        return E_FAIL;
    }

    //
    // we are known to safe, so simply delegate request to the base class
    //

    return CMSPObjectSafetyImpl::GetInterfaceSafetyOptions(riid,
                                                           pdwSupportedOptions,
                                                           pdwEnabledOptions);
}

DWORD CPlgTermSample::GetSupportedMediaTypes ( ) [virtual]

Definition at line 331 of file plgterm.cpp.

{

    LOG((MSP_TRACE, "CPlgTermSample::GetSupportedMediaTypes enter "));

    CLock lock(m_CritSec);

    DWORD dwMediaType = TAPIMEDIATYPE_AUDIO; //we set this in registry

    LOG((MSP_TRACE, "CPlgTermSample::GetSupportedMediaTypes exit - S_OK "));

    return dwMediaType;
}

HRESULT STDMETHODCALLTYPE CPlgTermSample::InitializeDynamic | ( | IN IID | iidTerminalClass,
 |  | IN DWORD | dwMediaType,
 |  | IN TERMINAL_DIRECTION | Direction,
 |  | IN MSP_HANDLE | htAddress |
 | ) |  |  | [virtual]

Definition at line 220 of file plgterm.cpp.

{

    LOG((MSP_TRACE, "CPlgTermSample::InitializeDynamic enter"));

    //
    // make sure the direction is correct - we register it with this direction
    //

    if (TD_RENDER != Direction)
    {
        LOG((MSP_ERROR, "CPlgTermSample::InitializeDynamic"
        " - bad direction [%d] requested. returning 0x%08x",
        Direction, E_INVALIDARG));

        return E_INVALIDARG;
    }

    //
    // make sure the mediatype is correct - TAPIMEDIATYPE_AUDIO - is how we set it in registry
    //

    if ( TAPIMEDIATYPE_AUDIO != dwMediaType)
    {

        LOG((MSP_ERROR, "CPlgTermSample::InitializeDynamic"
        " - bad media type [%d] requested. returning 0x%08x",
        dwMediaType, E_INVALIDARG));

        return E_INVALIDARG;
    }

    CLock lock(m_CritSec);

    //
    // Call the base class method
    //
    LOG((MSP_TRACE, "CPlgTermSample::InitializeDynamic - CBaseTerminal::Initialize with"
                "dwMediaType = 0x%08x, Direction = 0x%08x", dwMediaType, Direction));

    HRESULT hr;
    hr = CBaseTerminal::Initialize(iidTerminalClass,
                                   dwMediaType,
                                   Direction,
                                   htAddress);

    if ( FAILED(hr) )
    {
        LOG((MSP_ERROR, "CPlgTermSample::InitializeDynamic - "
                "base class method failed - 0x%08x", hr));
        return hr;
    }

    //
    // Set the terminal info
    //

    hr = SetTerminalInfo();
    if( FAILED(hr) )
    {
        LOG((MSP_ERROR, "CPlgTermSample::InitializeDynamic - "
                "SetTerminalInfo failed - 0x%08x", hr));

        return hr;
    }

    //
    // Create the filter
    //

    hr = CreateFilter();

    if( FAILED(hr) )
    {
        LOG((MSP_ERROR, "CPlgTermSample::InitializeDynamic - "
        "CreateFilter failed - 0x%08x", hr));
        return hr;
    }

    //
    // Get and sets the pin
    //

    hr = FindPin();

    if( FAILED(hr) )
    {
        LOG((MSP_ERROR, "CPlgTermSample::InitializeDynamic - "
            "FindPin failed - 0x%08x", hr));
    }

    m_bKnownSafeContext = TRUE;

  LOG((MSP_TRACE, "CPlgTermSample::InitializeDynamic exit - 0x%08x", hr));
    return hr;

}

HRESULT CPlgTermSample::RegisterSink ( IN ITPluggableTerminalEventSink * pSink )

Definition at line 139 of file plgterm.cpp.

{
  LOG((MSP_TRACE, "CPlgTermSample::RegisterSink enter"));

    //
    // Critical section
    //

    CLock lock(m_CritSec);

    //
    // Validates argument
    //

    if( IsBadReadPtr( pSink, sizeof(ITPluggableTerminalEventSink)) )
    {
        LOG((MSP_ERROR, "CPlgTermSample::RegisterSink - "
      "ITPluggableTerminalEventSink invalid pointer - exit 0x%08x", E_POINTER));
        return E_POINTER;
    }

    //
    // Release the old event sink
    //

    if( NULL != m_pEventSink )
    {
        LOG((MSP_TRACE, "CPlgTermSample::RegisterSink - releasing sink [%p]",m_pEventSink));
        m_pEventSink->Release();
        m_pEventSink = NULL;
    }

    //
    // Set the new event sink
    //

  LOG((MSP_TRACE, "CPlgTermSample::RegisterSink - keeping new sink [%p]",pSink));

    m_pEventSink = pSink;
    m_pEventSink->AddRef();

    LOG((MSP_TRACE, "CPlgTermSample::RegisterSink exit - S_OK"));

    return S_OK;
}

HRESULT CPlgTermSample::SetInterfaceSafetyOptions | ( | REFIID | riid,
 |  | DWORD | dwOptionSetMask,
 |  | DWORD | dwEnabledOptions
 | ) |  |

Definition at line 577 of file plgterm.cpp.

{

    CLock lock(m_CritSec);

    //
    // check if we are running in safe context
    //

    if (!m_bKnownSafeContext)
    {

        //
        // we have not been initialized properly... someone evil is trying to
        // use this terminal. NO!
        //

        return E_FAIL;
    }

    //
    // we are known to safe, so simply delegate request to the base class
    //

    return CMSPObjectSafetyImpl::SetInterfaceSafetyOptions(riid,
                                                           dwOptionSetMask,
                                                           dwEnabledOptions);
}

HRESULT CPlgTermSample::SetTerminalInfo ( ) [private]

Definition at line 405 of file plgterm.cpp.

{
    LOG((MSP_TRACE, "CPlgTermSample::SetTerminalInfo - enter"));

  //
    // set terminals's name for ITTerminal::get_Name
    //

    size_t nStringMaxSize = sizeof(m_szName)/sizeof(TCHAR);

    _tcsncpy(m_szName, SZTERMNAME, min(_tcslen(SZTERMNAME), nStringMaxSize));

    //
    // in case string copy did not append with a zero, do it by hand
    //

    m_szName[min(_tcslen(SZTERMNAME), nStringMaxSize - 1)] = 0;

    //
    // set other properties
    //

    m_TerminalType = TT_DYNAMIC;

    m_TerminalState = TS_NOTINUSE;

    LOG((MSP_TRACE, "CPlgTermSample::SetTerminalInfo - exit S_OK"));

    return S_OK;
}

HRESULT CPlgTermSample::UnregisterSink ( )

Definition at line 190 of file plgterm.cpp.

{
    LOG((MSP_TRACE, "CPlgTermSample::UnregisterSink enter"));
    //
    // Critical section
    //

    CLock lock(m_CritSec);

    //
    // Release the old event sink
    //

    if( m_pEventSink )
    {
        LOG((MSP_TRACE, "CPlgTermSample::RegisterSink - releasing sink [%p]",m_pEventSink));
        m_pEventSink->Release();
        m_pEventSink = NULL;
    }

    LOG((MSP_TRACE, "CPlgTermSample::UnregisterSink - exit S_OK"));
    return S_OK;
}

Member Data Documentation

BOOL CPlgTermSample::m_bKnownSafeContext [private]

Definition at line 151 of file plgterm.h.

ITPluggableTerminalEventSink* CPlgTermSample::m_pEventSink [private]

Definition at line 135 of file plgterm.h.

IUnknown* CPlgTermSample::m_pFTM [private]

Definition at line 141 of file plgterm.h.

The documentation for this class was generated from the following files:
  • NetDS/Tapi/Tapi3/Cpp/pluggable/plgterm.h
  • NetDS/Tapi/Tapi3/Cpp/pluggable/plgterm.cpp
Generated on Wed Nov 13 2024 16:57:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPluggableTransport Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Private Attributes

CPluggableTransport Class Reference

#include "plugxprt.h"

List of all members.

Public Member Functions

CPluggableTransport (void)
~CPluggableTransport (void)
HRESULT | AcceptConnection (HWND hWnd)
HRESULT | AcceptConnection (LPTSTR pszComPort)
HRESULT | CloseConnection (PLUGXPRT_FRAMING eFraming)
HRESULT | CreateConnection ()
HRESULT | CreateConnection (LPTSTR pszComPort)
HRESULT | DisableWinsock ()
HRESULT | EnableWinsock ()
HANDLE GetCloseEventHandle ()
LPSTR GetConnectionID ()
HANDLE GetReadEventHandle ()
HANDLE GetWriteEventHandle ()
BOOL InConnection ()
HRESULT | Initialize (INmManager *pINmManager)
HRESULT | Uninitialize ()

Public Attributes

CPSTN * m_pPSTN
CX224 * m_pX224

Private Attributes

BOOL m_bInConnection
HANDLE m_hEvtClose
HANDLE m_hEvtRead
HANDLE m_hEvtWrite
IPluggableTransport * m_pIPlugTrans
char | m_szConnID [CONNIDMAXLENGTH]

Detailed Description

Definition at line 22 of file plugxprt.h.

Constructor & Destructor Documentation

CPluggableTransport::CPluggableTransport ( void )

Definition at line 44 of file plugxprt.cpp.

{
    m_pIPlugTrans   = NULL;
    m_bInConnection = false;
    m_pX224         = NULL;
    m_pPSTN         = NULL;
    m_hEvtRead      = NULL;
    m_hEvtWrite     = NULL;
    m_hEvtClose     = NULL;
    m_szConnID[0]   = '\0';
}

CPluggableTransport::~CPluggableTransport ( void )

Definition at line 68 of file plugxprt.cpp.

{}

Member Function Documentation

HRESULT CPluggableTransport::AcceptConnection ( HWND hWnd )

Definition at line 332 of file plugxprt.cpp.

{
    PLUGXPRT_PARAMETERS Params;
    HRESULT             hr          = S_OK;
    HANDLE              hCommLink   = NULL;
    BSTR                bstrConnID  = NULL;
    BOOL                fRet        = FALSE;

    if (NULL == m_pX224)
        return E_FAIL;

    if (NULL == m_pIPlugTrans)
        return E_FAIL;

    if (FAILED(m_pX224->CreateAcceptSocket(hWnd)))
        return E_FAIL;

    if (m_pX224->GetSocket() == INVALID_SOCKET)
        return E_FAIL;

    fRet = ::DuplicateHandle(::GetCurrentProcess(), (HANDLE) m_pX224->GetSocket(),
                     ::GetCurrentProcess(), &hCommLink,
                     0, FALSE, DUPLICATE_SAME_ACCESS);
    if (!fRet)
        return E_FAIL;

    ::ZeroMemory(&Params, sizeof(Params));
    Params.cbStructSize = sizeof(Params);

    hr = m_pIPlugTrans->CreateConnection(
            &bstrConnID,
            PLUGXPRT_CALLEE, // callee
            GetCurrentProcessId(),
            (HCOMMDEV) hCommLink,
            (HEVENT) m_hEvtRead,
            (HEVENT) m_hEvtWrite,
            (HEVENT) m_hEvtClose,
            FRAMING_X224,
            &Params);

    if (SUCCEEDED(hr))
    {
        BSTR2LPSTR(bstrConnID, m_szConnID);
        m_bInConnection = true;
    }

    ::SysFreeString(bstrConnID);
    bstrConnID = NULL;

    return hr;
}

HRESULT CPluggableTransport::AcceptConnection ( LPTSTR pszComPort )

Definition at line 396 of file plugxprt.cpp.

{
    HANDLE hCommLink = NULL;
    HRESULT hr = S_OK;
    PLUGXPRT_PARAMETERS PluggableParams;
    BSTR bstrConnID = NULL;
    BOOL fRet = FALSE;

    if (NULL == m_pPSTN)
        return E_FAIL;

    if (NULL == m_pIPlugTrans)
        return E_FAIL;

    ZeroMemory(&PluggableParams, sizeof(PluggableParams));
    PluggableParams.cbStructSize = sizeof(PluggableParams);
    PluggableParams.dwFlags = PSTN_PARAM__CALL_CONTROL |
                                PSTN_PARAM__READ_FILE_BUFFER_SIZE |
                                PSTN_PARAM__PHYSICAL_LAYER_SEND_BUFFER_SIZE |
                                PSTN_PARAM__PHSYICAL_LAYER_RECV_BUFFER_SIZE |
                                PSTN_PARAM__MAX_T200_TIMEOUT_COUNT_IN_Q922 |
                                PSTN_PARAM__T203_TIMEOUT_IN_Q922;
    PluggableParams.eCallControl = PLUGXPRT_PSTN_CALL_CONTROL_MANUAL;
    PluggableParams.cbReadFileBufferSize = 10240; // 10K
    PluggableParams.cbPhysicalLayerSendBufferSize = 1024; // 1K
    PluggableParams.cbPhysicalLayerReceiveBufferSize = 10240; // 10K
    PluggableParams.cMaximumT200TimeoutsInQ922 = 200;
    PluggableParams.nT203TimeoutInQ922 = 6000;

    // open the com port and get a handle to it
    hr = m_pPSTN->CreateComPort(1, pszComPort);
    if (FAILED(hr))
        return E_FAIL;

    if (!m_pPSTN->GetCommLink())
        return E_FAIL;

    fRet = DuplicateHandle(GetCurrentProcess(), m_pPSTN->GetCommLink(),
                          GetCurrentProcess(), &hCommLink,
                          0, FALSE, DUPLICATE_SAME_ACCESS);
    if (!fRet)
        return E_FAIL;

    hr = m_pIPlugTrans->CreateConnection(
                &bstrConnID,
                PLUGXPRT_CALLEE, // caller
                GetCurrentProcessId(),
                (HCOMMDEV) hCommLink,
                (HEVENT) m_hEvtRead,
                (HEVENT) m_hEvtWrite,
                (HEVENT) m_hEvtClose,
                FRAMING_LEGACY_PSTN,
                &PluggableParams);

    if (SUCCEEDED(hr))
    {
        BSTR2LPSTR(bstrConnID, m_szConnID);
        m_bInConnection = true;
    }

    ::SysFreeString(bstrConnID);
    bstrConnID = NULL;

    return hr;
}

HRESULT CPluggableTransport::CloseConnection ( PLUGXPRT_FRAMING eFraming )

Definition at line 474 of file plugxprt.cpp.

{
    HRESULT hr = S_OK;
    BSTR bstrConnID = NULL;

    bstrConnID = LPSTR2BSTR(m_szConnID);

    if (NULL == m_pIPlugTrans)
        return E_FAIL;

    if (m_szConnID[0] != '\0')
    {
        hr = m_pIPlugTrans->CloseConnection(bstrConnID);
        m_szConnID[0] = '\0';
    }

    if ((eFraming == FRAMING_X224) && (NULL != m_pX224))
    {
        m_pX224->CloseSocket();
    }

    if ((eFraming == FRAMING_LEGACY_PSTN) && (NULL != m_pPSTN))
    {
        m_pPSTN->CloseComPort();
    }

    if (SUCCEEDED(hr))
        m_bInConnection = false;

    ::SysFreeString(bstrConnID);
    bstrConnID = NULL;

    return hr;
}

HRESULT CPluggableTransport::CreateConnection ( LPTSTR pszComPort )

Definition at line 256 of file plugxprt.cpp.

{
    HANDLE hCommLink = NULL;
    HRESULT hr = S_OK;
    PLUGXPRT_PARAMETERS PluggableParams;
    BSTR bstrConnID = NULL;
    BOOL fRet = FALSE;

    if (NULL == m_pPSTN)
        return E_FAIL;

    if (NULL == m_pIPlugTrans)
        return E_FAIL;

    ZeroMemory(&PluggableParams, sizeof(PluggableParams));
    PluggableParams.cbStructSize = sizeof(PluggableParams);
    PluggableParams.dwFlags = PSTN_PARAM__CALL_CONTROL |
                                PSTN_PARAM__READ_FILE_BUFFER_SIZE |
                                PSTN_PARAM__PHYSICAL_LAYER_SEND_BUFFER_SIZE |
                                PSTN_PARAM__PHSYICAL_LAYER_RECV_BUFFER_SIZE |
                                PSTN_PARAM__MAX_T200_TIMEOUT_COUNT_IN_Q922 |
                                PSTN_PARAM__T203_TIMEOUT_IN_Q922;
    PluggableParams.eCallControl = PLUGXPRT_PSTN_CALL_CONTROL_MANUAL;
    PluggableParams.cbReadFileBufferSize = 10240; // 10K
    PluggableParams.cbPhysicalLayerSendBufferSize = 1024; // 1K
    PluggableParams.cbPhysicalLayerReceiveBufferSize = 10240; // 10K
    PluggableParams.cMaximumT200TimeoutsInQ922 = 200;
    PluggableParams.nT203TimeoutInQ922 = 6000;

    // open the com port and get a handle to it
    if (FAILED(m_pPSTN->CreateComPort(1, pszComPort)))
        return E_FAIL;

    if (!m_pPSTN->GetCommLink())
        return E_FAIL;

    fRet = DuplicateHandle(GetCurrentProcess(), m_pPSTN->GetCommLink(),
                          GetCurrentProcess(), &hCommLink,
                          0, FALSE, DUPLICATE_SAME_ACCESS);
    if (!fRet)
        return E_FAIL;

    hr = m_pIPlugTrans->CreateConnection(
                &bstrConnID,
                PLUGXPRT_CALLER, // caller
                GetCurrentProcessId(),
                (HCOMMDEV) hCommLink,
                (HEVENT) m_hEvtRead,
                (HEVENT) m_hEvtWrite,
                (HEVENT) m_hEvtClose,
                FRAMING_LEGACY_PSTN,
                &PluggableParams);
    if (SUCCEEDED(hr))
    {
        BSTR2LPSTR(bstrConnID, m_szConnID);
        m_bInConnection = true;
    }

    ::SysFreeString(bstrConnID);
    bstrConnID = NULL;

    return hr;
}

HRESULT CPluggableTransport::CreateConnection ( )

Definition at line 203 of file plugxprt.cpp.

{
    HANDLE hCommLink = NULL;
    HRESULT hr = S_OK;

    if (!m_pX224)
        return E_FAIL;

    if (m_pX224->GetSocket() == INVALID_SOCKET)
        return E_FAIL;

    BOOL fRet = DuplicateHandle(GetCurrentProcess(), (HANDLE) m_pX224->GetSocket(),
                          GetCurrentProcess(), &hCommLink,
                          0, FALSE, DUPLICATE_SAME_ACCESS);

    BSTR bstrConnID = NULL;
    PLUGXPRT_PARAMETERS Params;

    ::ZeroMemory(&Params, sizeof(Params));
    Params.cbStructSize = sizeof(Params);

    hr = m_pIPlugTrans->CreateConnection(
                &bstrConnID,
                PLUGXPRT_CALLER, // caller
                GetCurrentProcessId(),
                (HCOMMDEV) hCommLink,
                (HEVENT) m_hEvtRead,
                (HEVENT) m_hEvtWrite,
                (HEVENT) m_hEvtClose,
                FRAMING_X224,
                &Params);

    if (SUCCEEDED(hr))
    {
        BSTR2LPSTR(bstrConnID, m_szConnID);
        m_bInConnection = true;
    }

    return hr;
}

HRESULT CPluggableTransport::DisableWinsock ( )

Definition at line 543 of file plugxprt.cpp.

{
    HRESULT hr = E_FAIL;

    if (m_pIPlugTrans)
        hr = m_pIPlugTrans->DisableWinsock();

    return hr;
}

HRESULT CPluggableTransport::EnableWinsock ( )

Definition at line 521 of file plugxprt.cpp.

{
    HRESULT hr = E_FAIL;

    if (m_pIPlugTrans)
        hr = m_pIPlugTrans->EnableWinsock();

    return hr;
}

HANDLE CPluggableTransport::GetCloseEventHandle ( )

Definition at line 616 of file plugxprt.cpp.

{
    return m_hEvtClose;
}

LPSTR CPluggableTransport::GetConnectionID ( )

Definition at line 565 of file plugxprt.cpp.

{
    return m_szConnID;
}

HANDLE CPluggableTransport::GetReadEventHandle ( )

Definition at line 582 of file plugxprt.cpp.

{
    return m_hEvtRead;
}

HANDLE CPluggableTransport::GetWriteEventHandle ( )

Definition at line 599 of file plugxprt.cpp.

{
    return m_hEvtWrite;
}

BOOL CPluggableTransport::InConnection ( )

Definition at line 186 of file plugxprt.cpp.

{
    return m_bInConnection;
}

HRESULT CPluggableTransport::Initialize ( INmManager * pINmManager )

Definition at line 83 of file plugxprt.cpp.

{
    if (pINmManager)
        if (FAILED(pINmManager->QueryInterface(IID_IPluggableTransport, (PVOID *) &m_pIPlugTrans)))
            return E_FAIL;

    m_pX224 = new CX224();
    if (m_pX224 == NULL)
    {
        return E_OUTOFMEMORY;
    }

    m_pPSTN = new CPSTN();
    if (m_pPSTN == NULL)
    {
        return E_OUTOFMEMORY;
    }

    m_hEvtRead = ::CreateEvent(NULL, FALSE, FALSE, NULL);
    if (m_hEvtRead == NULL)
    {
        return HRESULT_FROM_WIN32(GetLastError());
    }

    m_hEvtWrite = ::CreateEvent(NULL, FALSE, FALSE, NULL);
    if (m_hEvtWrite == NULL)
    {
        return HRESULT_FROM_WIN32(GetLastError());
    }

    m_hEvtClose = ::CreateEvent(NULL, FALSE, FALSE, NULL);
    if (m_hEvtClose == NULL)
    {
        return HRESULT_FROM_WIN32(GetLastError());
    }

    return S_OK;
}

HRESULT CPluggableTransport::Uninitialize ( void )

Definition at line 135 of file plugxprt.cpp.

{

    if (m_pX224)
    {
        m_pX224->CloseSocket();
        m_pX224->CloseListenSocket();
        delete m_pX224;
    }

    if (m_pPSTN)
    {
        m_pPSTN->CloseComPort();
        delete m_pPSTN;
    }

    if (m_pIPlugTrans)
    {
        m_pIPlugTrans->Release();
    }

    if (NULL != m_hEvtRead)
    {
        ::CloseHandle(m_hEvtRead);
    }

    if (NULL != m_hEvtWrite)
    {
        ::CloseHandle(m_hEvtWrite);
    }

    if (NULL != m_hEvtClose)
    {
        ::CloseHandle(m_hEvtClose);
    }

    return S_OK;
}

Member Data Documentation

BOOL CPluggableTransport::m_bInConnection [private]

Definition at line 26 of file plugxprt.h.

HANDLE CPluggableTransport::m_hEvtClose [private]

Definition at line 29 of file plugxprt.h.

HANDLE CPluggableTransport::m_hEvtRead [private]

Definition at line 27 of file plugxprt.h.

HANDLE CPluggableTransport::m_hEvtWrite [private]

Definition at line 28 of file plugxprt.h.

IPluggableTransport* CPluggableTransport::m_pIPlugTrans [private]

Definition at line 25 of file plugxprt.h.

CPSTN* CPluggableTransport::m_pPSTN

Definition at line 34 of file plugxprt.h.

CX224* CPluggableTransport::m_pX224

Definition at line 33 of file plugxprt.h.

char CPluggableTransport::m_szConnID[CONNIDMAXLENGTH] [private]

Definition at line 30 of file plugxprt.h.

The documentation for this class was generated from the following files:
  • Web/NetMeeting/PlugTransport/plugxprt.h
  • Web/NetMeeting/PlugTransport/plugxprt.cpp
Generated on Wed Nov 13 2024 16:57:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPoint Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Classes | Public Member Functions | Public Attributes | Private Attributes

CPoint Class Reference

#include "Canvas.Hxx"

Inherits IMyPersistStreamImpl< CPoint >.

List of all members.

Classes

struct | POINT

Public Member Functions

CPoint ()
CPoint (COORD X, COORD Y)
CPoint ()
CPoint (POINT pt)
STDMETHOD() | get_x (long *pVal)
STDMETHOD() | get_y (long *pVal)
STDMETHOD() | IMyPersistStreamImpl_GetSizeMax (ULARGE_INTEGER FAR *pcbSize)
STDMETHOD() | IMyPersistStreamImpl_Load (LPSTREAM pStm)
STDMETHOD() | IMyPersistStreamImpl_Save (LPSTREAM pStm, BOOL fClearDirty)
CPoint | operator* (int c)
CPoint | operator+ (CPoint &pt)
CPoint | operator- (CPoint &pt)
CPoint | operator/ (int c)
STDMETHOD() | put_x (long newVal)
STDMETHOD() | put_y (long newVal)

Public Attributes

BOOL m_bRequiresSave

Private Attributes

POINT m_Point

Detailed Description

Definition at line 21 of file Canvas.Hxx.

Constructor & Destructor Documentation

CPoint::CPoint ( ) [inline]

Definition at line 24 of file Canvas.Hxx.

{x=0; y=0;  };

CPoint::CPoint | ( | COORD | X,
 |  | COORD | Y |
 | ) |  |  | [inline]

Definition at line 25 of file Canvas.Hxx.

{x = X; y = Y;     };

CPoint::CPoint ( POINT pt ) [inline]

Definition at line 26 of file Canvas.Hxx.

{x = pt.x; y=pt.y; };

CPoint::CPoint ( ) [inline]

Definition at line 40 of file Point.h.

  {
  }

Member Function Documentation

STDMETHODIMP CPoint::get_x ( long * pVal )

Definition at line 69 of file Point.Cpp.

{
  *pVal = m_Point.x;
  return S_OK;
}

STDMETHODIMP CPoint::get_y ( long * pVal )

Definition at line 81 of file Point.Cpp.

{
  *pVal = m_Point.y;
  return S_OK;
}

STDMETHODIMP CPoint::IMyPersistStreamImpl_GetSizeMax ( ULARGE_INTEGER FAR * pcbSize )

Definition at line 61 of file Point.Cpp.

{
  pcbSize->LowPart = (DWORD)(sizeof(POINT));
  pcbSize->HighPart = 0L;
  return NOERROR;
}

STDMETHODIMP CPoint::IMyPersistStreamImpl_Load ( LPSTREAM pStm )

Definition at line 20 of file Point.Cpp.

{
    ULONG           cb;
    HRESULT         hr;

    if (NULL==pIStream)
        return ResultFromScode(E_POINTER);
    //
    // Read an object from the stream.
    //
    hr=pIStream->Read(&m_Point, sizeof(POINT), &cb);
    if (FAILED(hr))
        return hr;
    if (sizeof(POINT) != cb)
        return E_FAIL;

  return NOERROR;
}

STDMETHODIMP CPoint::IMyPersistStreamImpl_Save | ( | LPSTREAM | pStm,
 |  | BOOL | fClearDirty
 | ) |  |

Definition at line 41 of file Point.Cpp.

{
    ULONG           cb;
    HRESULT         hr;

    if (NULL==pIStream)
        return ResultFromScode(E_POINTER);

    //
    // Write the object into the stream.
    //
    hr=pIStream->Write(&m_Point, (ULONG)sizeof(POINT), &cb);

    if (FAILED(hr) || sizeof(POINT)!=cb)
       return ResultFromScode(STG_E_WRITEFAULT);

  return NOERROR;
}

CPoint CPoint::operator* ( int c ) [inline]

Definition at line 30 of file Canvas.Hxx.

{ return CPoint(x*c, y*c); };

CPoint CPoint::operator+ ( CPoint & pt ) [inline]

Definition at line 28 of file Canvas.Hxx.

{ return CPoint(x+pt.x, y+pt.y); };

CPoint CPoint::operator- ( CPoint & pt ) [inline]

Definition at line 29 of file Canvas.Hxx.

{ return CPoint(x-pt.x, y-pt.y); };

CPoint CPoint::operator/ ( int c ) [inline]

Definition at line 31 of file Canvas.Hxx.

{ return CPoint(x/c, y/c); };

STDMETHODIMP CPoint::put_x ( long newVal )

Definition at line 75 of file Point.Cpp.

{
  m_Point.x = newVal;
  return S_OK;
}

STDMETHODIMP CPoint::put_y ( long newVal )

Definition at line 87 of file Point.Cpp.

{
  m_Point.y = newVal;
  return S_OK;
}

Member Data Documentation

BOOL CPoint::m_bRequiresSave

Definition at line 55 of file Point.h.

POINT CPoint::m_Point [private]

Definition at line 37 of file Point.h.

The documentation for this class was generated from the following files:
  • Multimedia/Gdi/Fonts/GridFont/Canvas.Hxx
  • NetDS/MessageQueuing/MQPers/GraphObj/Point.h
  • NetDS/MessageQueuing/MQPers/GraphObj/Point.Cpp
Generated on Wed Nov 13 2024 16:57:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPoint::POINT Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • CPoint
  • CPoint::POINT
Public Attributes

CPoint::POINT Struct Reference

List of all members.

Public Attributes

long | x
long | y

Detailed Description

Definition at line 33 of file Point.h.

Member Data Documentation

long CPoint::POINT::x

Definition at line 34 of file Point.h.

long CPoint::POINT::y

Definition at line 34 of file Point.h.

The documentation for this struct was generated from the following file:
  • NetDS/MessageQueuing/MQPers/GraphObj/Point.h
Generated on Wed Nov 13 2024 16:57:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPooledData Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Protected Member Functions | Protected Attributes

CPooledData Class Reference

#include "pooleddata.h"

Inherited by CODBCData.

List of all members.

Protected Member Functions

CPooledData ()
~CPooledData ()
STDMETHOD() | ActivateData (IObjectContext *pObjectContext)
virtual BOOL STDMETHODCALLTYPE | CanConnectionBePooled (void)
STDMETHODIMP | ConstructData (IDispatch *pUnk)
virtual void STDMETHODCALLTYPE | DeactivateData (void)=0
virtual HRESULT | Enlist (IObjectContext *pObjectContext, const CLSID &clsid, const IID &iid)=0
STDMETHOD() | ManualConstruct (BSTR ConstructString)=0
virtual HRESULT | QueryEnlist (const CLSID &clsid, const IID &iid)

Protected Attributes

BOOL m_bConstructed
BOOL m_bObjectPooled
BOOL m_bShouldEnlist
CComPtr< IObjectContext > | m_spObjectContext
GUID | m_txuow

Detailed Description

Definition at line 20 of file pooleddata.h.

Constructor & Destructor Documentation

CPooledData::CPooledData ( ) [inline, protected]

Definition at line 31 of file pooleddata.h.

  {
    m_bConstructed = FALSE;
    m_bShouldEnlist = FALSE;
    m_txuow = GUID_NULL;
    m_bObjectPooled = FALSE;
  }

CPooledData::~CPooledData ( ) [inline, protected]

Definition at line 39 of file pooleddata.h.

  {
  }

Member Function Documentation

STDMETHOD() CPooledData::ActivateData ( IObjectContext * pObjectContext ) [inline, protected]

Definition at line 43 of file pooleddata.h.

  {
    //  should only do this when we are being activated in different
    //  tx units of work
    m_bShouldEnlist = FALSE;

    if (!m_bObjectPooled)
      return S_OK;

    HRESULT hr = S_OK;
    GUID txUOW = GUID_NULL;
    IObjectContextInfo  * pObjTx = NULL;
    hr = pObjectContext->QueryInterface(IID_IObjectContextInfo, (void **)&pObjTx);
    if (pObjTx)
    {
      pObjTx -> GetTransactionId (&txUOW);
      pObjTx -> Release();
    }

    if (txUOW != m_txuow)
    {
      m_bShouldEnlist = TRUE;
      m_txuow = txUOW;
    }
    return hr;
  }

virtual BOOL STDMETHODCALLTYPE CPooledData::CanConnectionBePooled ( void ) [inline, protected, virtual]

Definition at line 88 of file pooleddata.h.

  {
    return m_bObjectPooled;
  }

STDMETHODIMP CPooledData::ConstructData ( IDispatch * pUnk ) [inline, protected]

Definition at line 70 of file pooleddata.h.

  {
    if (!pUnk)
      return E_UNEXPECTED;
    HRESULT hr = E_FAIL;
    IObjectConstructString * pString = NULL;
    hr = pUnk -> QueryInterface(IID_IObjectConstructString, (void **)&pString);
    if (pString)
    {
      CComBSTR s;
      pString -> get_ConstructString(&s);
      m_bObjectPooled = TRUE;
      hr = ManualConstruct(s);
      pString -> Release();
    }
    return hr;
  }

virtual void STDMETHODCALLTYPE CPooledData::DeactivateData ( void ) [protected, pure virtual]

Implemented in CODBCData.

virtual HRESULT CPooledData::Enlist | ( | IObjectContext * | pObjectContext,
 |  | const CLSID & | clsid,
 |  | const IID & | iid |
 | ) |  |  | [protected, pure virtual]

Implemented in CODBCData.

STDMETHOD() CPooledData::ManualConstruct ( BSTR ConstructString ) [protected, pure virtual]

Implemented in CProxy.

virtual HRESULT CPooledData::QueryEnlist | ( | const CLSID & | clsid,
 |  | const IID & | iid |
 | ) |  |  | [inline, protected, virtual]

Definition at line 93 of file pooleddata.h.

  {
    HRESULT hr = S_OK;

    if (m_bShouldEnlist)
    {
      hr = Enlist(m_spObjectContext, clsid, iid);
      if (FAILED(hr))
      {
        SETABORT;
        hr = AtlReportError(clsid, (LPCSTR)"Failed to enlist in transaction", iid, hr);
      }
    }
    return hr;
  }

Member Data Documentation

BOOL CPooledData::m_bConstructed [protected]

Definition at line 28 of file pooleddata.h.

BOOL CPooledData::m_bObjectPooled [protected]

Definition at line 27 of file pooleddata.h.

BOOL CPooledData::m_bShouldEnlist [protected]

Definition at line 29 of file pooleddata.h.

CComPtr<IObjectContext> CPooledData::m_spObjectContext [protected]

Definition at line 24 of file pooleddata.h.

GUID CPooledData::m_txuow [protected]

Definition at line 26 of file pooleddata.h.

The documentation for this class was generated from the following file:
  • Com/Tools/EntityProxy/DataServices/pooleddata.h
Generated on Wed Nov 13 2024 16:57:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPower Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CPower Class Reference

#include "Power.h"

List of all members.

Public Member Functions

CPower ()
DECLARE_REGISTRY (CPower, _T("IISSample.C++ATLPower.1"), _T("IISSample.C++ATLPower"), IDS_POWER_DESC, THREADFLAGS_BOTH) STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid)
HRESULT | FinalCountruct ()
void | FinalRelease ()
STDMETHOD() | get_myPowerProperty (BSTR *pbstrOutValue)
STDMETHOD() | get_myProperty (BSTR *pbstrOutValue)
STDMETHOD() | myMethod (BSTR bstrIn, BSTR *pbstrOut)
STDMETHOD() | myPowerMethod ()
STDMETHOD() | put_myProperty (BSTR bstrInValue)

Private Attributes

CComBSTR | m_bstrMyProperty
CComPtr< IUnknown > | m_pUnkMarshaler

Detailed Description

Definition at line 15 of file Power.h.

Constructor & Destructor Documentation

CPower::CPower ( )

Definition at line 26 of file Power.Cpp.

    : m_bstrMyProperty(OLESTR("C++ ATL Power Component"))
{}

Member Function Documentation

CPower::DECLARE_REGISTRY | ( | CPower | ,
 |  | _T("IISSample.C++ATLPower.1") | ,
 |  | _T("IISSample.C++ATLPower") | ,
 |  | IDS_POWER_DESC | ,
 |  | THREADFLAGS_BOTH |
 | ) |  |
HRESULT CPower::FinalCountruct ( ) [inline]

Definition at line 41 of file Power.h.

  {
    return CoCreateFreeThreadedMarshaler(
      GetControllingUnknown(), &m_pUnkMarshaler.p );
  }

void CPower::FinalRelease ( ) [inline]

Definition at line 46 of file Power.h.

  {
    m_pUnkMarshaler.Release();
  }

STDMETHODIMP CPower::get_myPowerProperty ( BSTR * pbstrOutValue )

Definition at line 78 of file Power.Cpp.

{
  // the Context class is an easy way to use IIS 4's new way
  // of getting instrinic objects.  The new method may seem
  // more complex, but it is more powerful since obects no
  // longer have to be page/session level to get access
  // to them.
  CContext cxt;
  if ( FAILED( cxt.Init( CContext::get_Request ) ) )
  {
    return E_FAIL;
  }

  // Do we have somewhere valid to store the return value?
  if (pbstrOutValue == NULL)
    return E_POINTER;

  // Initialize the return value
  *pbstrOutValue = NULL;

  // Get the ServerVariables Collection
  CComPtr<IRequestDictionary> piServerVariables;
  HRESULT hr = cxt.Request()->get_ServerVariables(&piServerVariables);

    if (FAILED(hr))
        return hr;

    // Get the SCRIPT_NAME item from the ServerVariables collection
    CComVariant vtIn(OLESTR("SCRIPT_NAME")), vtOut;
    hr = piServerVariables->get_Item(vtIn, &vtOut);

    if (FAILED(hr))
        return hr;

    // Get the SCRIPT_NAME item from the ServerVariables collection
    // vtOut Contains an IDispatch Pointer.  To fetch the value
    // for SCRIPT_NAME, you must get the Default Value for the
    // Object stored in vtOut using VariantChangeType.
    hr = VariantChangeType(&vtOut, &vtOut, 0, VT_BSTR);

    // Copy and return SCRIPT_NAME
    if (SUCCEEDED(hr))
        *pbstrOutValue = ::SysAllocString(V_BSTR(&vtOut));

    return hr;
}

STDMETHODIMP CPower::get_myProperty ( BSTR * pbstrOutValue )

Definition at line 31 of file Power.Cpp.

{
    if (pbstrOutValue == NULL)
        return E_POINTER;

    // Get Value from Property
    *pbstrOutValue = m_bstrMyProperty.Copy();

    return S_OK;
}

STDMETHODIMP CPower::myMethod | ( | BSTR | bstrIn,
 |  | BSTR * | pbstrOut
 | ) |  |

Definition at line 54 of file Power.Cpp.

{
    if (bstrIn == NULL || pbstrOut == NULL)
        return E_POINTER;

    // Create a temporary CComBSTR
    CComBSTR bstrTemp(bstrIn);

    if (!bstrTemp)
        return E_OUTOFMEMORY;

    // Make string uppercase
    wcsupr(bstrTemp);

    // Return m_str member of bstrTemp
    *pbstrOut = bstrTemp.Detach();

    return S_OK;
}

STDMETHODIMP CPower::myPowerMethod ( )

Definition at line 126 of file Power.Cpp.

{
  CContext cxt;
  if ( FAILED( cxt.Init( CContext::get_Request | CContext::get_Response ) ) )
  {
    return E_FAIL;
  }

    // Get the ServerVariables Collection
    CComPtr<IRequestDictionary> piServerVariables;
    HRESULT hr = cxt.Request()->get_ServerVariables(&piServerVariables);

    if (FAILED(hr))
        return hr;

    // Get the HTTP_USER_AGENT item from the ServerVariables collection
    CComVariant vtIn(OLESTR("HTTP_USER_AGENT")), vtOut;
    hr = piServerVariables->get_Item(vtIn, &vtOut);

    if (FAILED(hr))
        return hr;

    // vtOut Contains an IDispatch Pointer.  To fetch the value
    // for HTTP_USER_AGENT, you must get the Default Value for the
    // Object stored in vtOut using VariantChangeType.
    hr = VariantChangeType(&vtOut, &vtOut, 0, VT_BSTR);

    if (SUCCEEDED(hr))
    {
        // Look for "MSIE" in HTTP_USER_AGENT string
        if (wcsstr(vtOut.bstrVal, L"MSIE") != NULL)
            cxt.Response()->Write(CComVariant(
                OLESTR("You are using a very powerful browser.")));
        else
            cxt.Response()->Write(CComVariant(
                OLESTR("Try Internet Explorer today!")));
    }

    return hr;
}

STDMETHODIMP CPower::put_myProperty ( BSTR bstrInValue )

Definition at line 43 of file Power.Cpp.

{
    if (bstrInValue == NULL)
        return E_POINTER;

    m_bstrMyProperty = bstrInValue;

    return S_OK;
}

Member Data Documentation

CComBSTR CPower::m_bstrMyProperty [private]

Definition at line 61 of file Power.h.

CComPtr<IUnknown> CPower::m_pUnkMarshaler [private]

Definition at line 60 of file Power.h.

The documentation for this class was generated from the following files:
  • Web/iis/Components/Cpp/Intermediate/Power.h
  • Web/iis/Components/Cpp/Intermediate/Power.Cpp
Generated on Wed Nov 13 2024 16:57:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPrintAux Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Private Attributes | Friends

CPrintAux Class Reference

#include "View.Hxx"

List of all members.

Private Attributes

BOOL _bUserAbort
HWND | _hDlgPrint

Friends

BOOL CALLBACK | AbortProc (HDC hdcPrn, short nCode)
class | CPrintRequest
BOOL CALLBACK | PrintDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)

Detailed Description

Definition at line 129 of file View.Hxx.

Friends And Related Function Documentation

BOOL CALLBACK AbortProc | ( | HDC | hdcPrn,
 |  | short | nCode |
 | ) |  |  | [friend]

Definition at line 517 of file APP.Cxx.

{
    MSG   msg ;

    while (!PrGlobal._bUserAbort && PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
    {
        if (!PrGlobal._hDlgPrint
                ||
            !IsDialogMessage (PrGlobal._hDlgPrint, &msg))
        {
            TranslateMessage (&msg) ;
            DispatchMessage (&msg) ;
        }
    }
    return !PrGlobal._bUserAbort ;
}

friend class CPrintRequest [friend]

Definition at line 131 of file View.Hxx.

BOOL CALLBACK PrintDlgProc | ( | HWND | hwnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [friend]

Definition at line 496 of file APP.Cxx.

{
    switch (message)
    {
        case WM_INITDIALOG:
             SetWindowText (hwndDlg, (TCHAR *)lParam) ;
             EnableMenuItem (GetSystemMenu (hwndDlg, FALSE), SC_CLOSE, MF_GRAYED) ;
             return TRUE ;

        case WM_COMMAND:
             PrGlobal._bUserAbort = TRUE ;
             EnableWindow (GetParent (hwndDlg), TRUE) ;
             DestroyWindow (hwndDlg) ;
             PrGlobal._hDlgPrint = 0 ;
             return TRUE ;
    }
    return FALSE ;
}

Member Data Documentation

BOOL CPrintAux::_bUserAbort [private]

Definition at line 136 of file View.Hxx.

HWND CPrintAux::_hDlgPrint [private]

Definition at line 137 of file View.Hxx.

The documentation for this class was generated from the following file:
  • Multimedia/Gdi/Fonts/GridFont/View.Hxx
Generated on Wed Nov 13 2024 16:57:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPrintCanvas Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CPrintCanvas Class Reference

#include "View.Hxx"

Inherits CCanvas.

List of all members.

Public Member Functions

CPrintCanvas (CPrintRequest &pr)
~CPrintCanvas ()

Detailed Description

Definition at line 106 of file View.Hxx.

Constructor & Destructor Documentation

CPrintCanvas::CPrintCanvas ( CPrintRequest & pr ) [inline]

Definition at line 109 of file View.Hxx.

        {
            Init(pr._hdc);
            pr._hdc = 0;
        }

CPrintCanvas::~CPrintCanvas ( ) [inline]

Definition at line 114 of file View.Hxx.

        {
            DeleteDC(_hdc);
        }

The documentation for this class was generated from the following file:
  • Multimedia/Gdi/Fonts/GridFont/View.Hxx
Generated on Wed Nov 13 2024 16:57:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPrintRequest Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes | Friends

CPrintRequest Class Reference

#include "View.Hxx"

List of all members.

Public Member Functions

CPrintRequest (HWND hwnd, UINT minPage=1, UINT maxPage=1)
~CPrintRequest ()
BOOL Cancelled ()
BOOL Error ()
UINT | Print (HINSTANCE hInst, CCanvas &canvas, CModel *pModel)

Protected Attributes

HDC | _hdc
HANDLE _hDevNames
HWND | _hwnd
UINT _nFromPage
UINT _nToPage
CModel * _pModel
CView * _pView
UINT _status

Friends

class | CPrintCanvas

Detailed Description

Definition at line 81 of file View.Hxx.

Constructor & Destructor Documentation

CPrintRequest::CPrintRequest | ( | HWND | hwnd,
 |  | UINT | minPage = 1,
 |  | UINT | maxPage = 1
 | ) |  |

Definition at line 247 of file View.Cxx.

                                                                     :
        _hwnd(hwnd),
        _hdc(0),
        _hDevNames(0)
{
    PRINTDLG pd;

    pd.lStructSize= sizeof(PRINTDLG);
    pd.hwndOwner=NULL;
    pd.hDevMode=NULL;
    pd.hDevNames=NULL;
    pd.hDC;
    pd.nFromPage = 0xFFFF; // cause initial blank field
    pd.nToPage   = 0xFFFF; // in dialog
    pd.nMinPage= (WORD)nMinPage;
    pd.nMaxPage= (WORD)nMaxPage;
    pd.nCopies=1;
    pd.hInstance=NULL;
    pd.lCustData=0L;
    pd.lpfnPrintHook=NULL;
    pd.lpfnSetupHook=NULL;
    pd.lpPrintTemplateName=NULL;
    pd.lpSetupTemplateName=NULL;
    pd.hPrintTemplate=NULL;
    pd.hSetupTemplate=NULL;

    pd.Flags = PD_RETURNDEFAULT;

    if( PrintDlg(&pd) )
    {
        pd.Flags = PD_SELECTION | PD_HIDEPRINTTOFILE | PD_RETURNDC;
        if( PrintDlg( &pd ) )
        {
             if(pd.Flags & PD_PAGENUMS)
             {
                 _nFromPage = pd.nFromPage;
                 _nToPage = pd.nToPage;
             }
             else if (pd.Flags & PD_SELECTION )
             {
                 _nFromPage = _nToPage = 0xFFFF;
             }
             else   // all non empty pages
             {
                 _nFromPage = nMinPage;
                 _nToPage = nMaxPage;
             }
             _hdc = pd.hDC;
             _hDevNames = pd.hDevNames;

             if( pd.hDevMode )
             {
                GlobalFree (pd.hDevMode);
             }
             _status = PREQ_SUCCESS;
             return;
        }
        else
        {
            _status = PREQ_ERROR;
            return;
        }
    }

    _status = PREQ_CANCEL;
}

CPrintRequest::~CPrintRequest ( )

Definition at line 314 of file View.Cxx.

{
    if( _hDevNames )
    {
        GlobalFree( _hDevNames );
    }

    if( _hdc )
    {
        DeleteDC(_hdc );
    }
}

Member Function Documentation

BOOL CPrintRequest::Cancelled ( ) [inline]

Definition at line 89 of file View.Hxx.

{ return _status == PREQ_CANCEL; };

BOOL CPrintRequest::Error ( ) [inline]

Definition at line 90 of file View.Hxx.

{ return _status != PREQ_SUCCESS; };

UINT CPrintRequest::Print | ( | HINSTANCE | hInst,
 |  | CCanvas & | canvas,
 |  | CModel * | pModel
 | ) |  |

Definition at line 327 of file View.Cxx.

{

     // needs to become app & font name....
     static TCHAR szMessage [] = TEXT("Grid: Printing") ;

     TCHAR szCaption[30];

     BOOL       fError = PREQ_SUCCESS ;
     ABORTPROC  lpfnAbortProc;
     DLGPROC    lpfnPrintDlgProc ;
     short      cxPage, cyPage ;

     cxPage = (short)GetDeviceCaps (canvas, HORZRES) ;
     cyPage = (short)GetDeviceCaps (canvas, VERTRES) ;

     // disable user input to main window
     EnableWindow (_hwnd, FALSE) ;

     lpfnPrintDlgProc = (DLGPROC) MakeProcInstance ((FARPROC) PrintDlgProc, hInst) ;

     LoadString(hInst, IDS_MSGCAPTION, szCaption, 30);
     PrGlobal._bUserAbort = FALSE ;
     PrGlobal._hDlgPrint =
                CreateDialogParam (hInst, TEXT("PrintDlgBox"), _hwnd,
                                lpfnPrintDlgProc, (LPARAM) szCaption) ;

     lpfnAbortProc = (ABORTPROC) MakeProcInstance ((FARPROC) AbortProc, hInst) ;

     SetAbortProc(canvas, lpfnAbortProc);

     DOCINFO docinfo;
     docinfo.cbSize = sizeof(DOCINFO);
     docinfo.lpszDocName = szMessage;
     docinfo.lpszOutput = NULL;

     if (Escape (canvas, STARTDOC, sizeof szMessage - 1, (LPCSTR)szMessage, NULL) > 0)
     //if (StartDoc(canvas, &docinfo) > 0)
     {
          UINT fuFormat;
          pModel->GetFormat(fuFormat);
          pModel->SetFormat(fuFormat | PAGEPRINT|PAGEELEMS);
          UINT iSavePage = pModel->GetPage();

          // create printer view to
          CView  View(cxPage, cyPage);

          if( _nToPage == 0xFFFF || _nFromPage == 0xFFFF )
          {
                _nToPage =   pModel->GetPage()+1;
                _nFromPage = pModel->GetPage()+1;
          }

          for( ; _nFromPage <= _nToPage && ! fError; _nFromPage++ )
          {
             if (pModel->IsModelPageUsed(_nFromPage-1))
             {
                if( StartPage(canvas) < 0 )
                    {
                        fError = PREQ_ERRSTARTPAGE ;
                        break;
                    }
                pModel->SetPage(_nFromPage-1);  // <- pages are 0 based in Model
                RECT rc;
                rc.left = rc.top = 0;
                rc.right= cxPage;
                rc.bottom = cyPage;
                View.Paint (canvas, pModel, rc) ;

                if ( EndPage(canvas) < 0)
                    {
                        fError = PREQ_ERRENDPAGE ;
                    }
        }
          }
          if( !fError )
          {
               EndDoc(canvas);
          }
          // restore screen format
          pModel->SetPage(iSavePage);
          pModel->SetFormat(fuFormat);
     }
     else
     {
          fError = PREQ_ERRSTARTDOC ;
     }

     if (!PrGlobal._bUserAbort)
     {
          EnableWindow (_hwnd, TRUE) ;
          DestroyWindow (PrGlobal._hDlgPrint) ;
     }

     FreeProcInstance ((FARPROC)lpfnPrintDlgProc) ;
     FreeProcInstance ((FARPROC)lpfnAbortProc) ;

     if( PrGlobal._bUserAbort )
     {
        fError |= PREQ_USERABORT;
     }

     return fError ;
}

Friends And Related Function Documentation

friend class CPrintCanvas [friend]

Definition at line 83 of file View.Hxx.

Member Data Documentation

HDC CPrintRequest::_hdc [protected]

Definition at line 90 of file View.Hxx.

HANDLE CPrintRequest::_hDevNames [protected]

Definition at line 98 of file View.Hxx.

HWND CPrintRequest::_hwnd [protected]

Definition at line 94 of file View.Hxx.

UINT CPrintRequest::_nFromPage [protected]

Definition at line 95 of file View.Hxx.

UINT CPrintRequest::_nToPage [protected]

Definition at line 96 of file View.Hxx.

CModel* CPrintRequest::_pModel [protected]

Definition at line 99 of file View.Hxx.

CView* CPrintRequest::_pView [protected]

Definition at line 100 of file View.Hxx.

UINT CPrintRequest::_status [protected]

Definition at line 97 of file View.Hxx.

The documentation for this class was generated from the following files:
  • Multimedia/Gdi/Fonts/GridFont/View.Hxx
  • Multimedia/Gdi/Fonts/GridFont/View.Cxx
Generated on Wed Nov 13 2024 16:57:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPrintSDIApp Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CPrintSDIApp Class Reference

#include "PrintSdi.h"

Inherits CWinApp.

List of all members.

Public Member Functions

CPrintSDIApp ()
virtual BOOL | InitInstance ()
afx_msg void | OnAppAbout ()

Detailed Description

Definition at line 22 of file PrintSdi.h.

Constructor & Destructor Documentation

CPrintSDIApp::CPrintSDIApp ( )

Definition at line 36 of file PrintSdi.Cpp.

{
  // TODO: add construction code here,
  // Place all significant initialization in InitInstance
}

Member Function Documentation

BOOL CPrintSDIApp::InitInstance ( void ) [virtual]

Reimplemented from CWinApp.

Definition at line 50 of file PrintSdi.Cpp.

{
  AfxEnableControlContainer();

  // Standard initialization
  // If you are not using these features and wish to reduce the size
  //  of your final executable, you should remove from the following
  //  the specific initialization routines you do not need.

#ifdef _AFXDLL
  Enable3dControls();     // Call this when using MFC in a shared DLL
#else
  Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif

  // Change the registry key under which our settings are stored.
  // You should modify this string to be something appropriate
  // such as the name of your company or organization.
  SetRegistryKey(_T("Local AppWizard-Generated Applications"));

  LoadStdProfileSettings();  // Load standard INI file options (including MRU)

  // Register the application's document templates.  Document templates
  //  serve as the connection between documents, frame windows and views.

  CSingleDocTemplate* pDocTemplate = NULL;
  pDocTemplate = new CSingleDocTemplate(
    IDR_MAINFRAME,
    RUNTIME_CLASS(CPrintSDIDoc),
    RUNTIME_CLASS(CMainFrame),       // main SDI frame window
    RUNTIME_CLASS(CPrintSDIView));
  if (pDocTemplate == NULL)
    return FALSE;
  AddDocTemplate(pDocTemplate);

  // Enable DDE Execute open
  EnableShellOpen();
  RegisterShellFileTypes(TRUE);

  // Parse command line for standard shell commands, DDE, file open
  CCommandLineInfo cmdInfo;
  ParseCommandLine(cmdInfo);

  // Dispatch commands specified on the command line
  if (!ProcessShellCommand(cmdInfo))
    return FALSE;

  // The one and only window has been initialized, so show and update it.
  m_pMainWnd->ShowWindow(SW_SHOW);
  m_pMainWnd->UpdateWindow();

  // Enable drag/drop open
  //m_pMainWnd->DragAcceptFiles();

  return TRUE;
}

void CPrintSDIApp::OnAppAbout ( )

Definition at line 154 of file PrintSdi.Cpp.

{
  CAboutDlg aboutDlg;
  aboutDlg.DoModal();
}

The documentation for this class was generated from the following files:
  • NetDS/fax/PrintSdi/PrintSdi.h
  • NetDS/fax/PrintSdi/PrintSdi.Cpp
Generated on Wed Nov 13 2024 16:57:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPrintSDIDoc Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Protected Member Functions

CPrintSDIDoc Class Reference

#include "PrintSdiDoc.h"

List of all members.

Public Member Functions

virtual | ~CPrintSDIDoc ()
virtual BOOL | OnNewDocument ()
virtual void | Serialize (CArchive &ar)

Public Attributes

int | m_polytype
CString m_szText

Protected Member Functions

CPrintSDIDoc ()

Detailed Description

Definition at line 13 of file PrintSdiDoc.h.

Constructor & Destructor Documentation

CPrintSDIDoc::CPrintSDIDoc ( ) [protected]

Definition at line 31 of file SdiDoc.Cpp.

{
  m_szText.Empty();
  m_polytype = 0;

}

CPrintSDIDoc::~CPrintSDIDoc ( ) [virtual]

Definition at line 38 of file SdiDoc.Cpp.

{
}

Member Function Documentation

BOOL CPrintSDIDoc::OnNewDocument ( ) [virtual]

Definition at line 42 of file SdiDoc.Cpp.

{
  if (!CDocument::OnNewDocument())
    return FALSE;

  NewDocDlg newdlg;
  newdlg.DoModal();
  m_szText = newdlg.m_szText;

  m_polytype = newdlg.m_polytype;

  return TRUE;
}

void CPrintSDIDoc::Serialize ( CArchive & ar ) [virtual]

Definition at line 61 of file SdiDoc.Cpp.

{
  if (ar.IsStoring())
  {
    ar << m_szText;
        ar << m_polytype;
  }
  else
  {
    try {
      ar >> m_szText;
      ar >> m_polytype;
    }
  catch( CMemoryException* ) {
    // Handle out-of-memory exception. Reset
      m_szText = _T("");
      m_polytype = -1;
    }
  }
}

Member Data Documentation

int CPrintSDIDoc::m_polytype

Definition at line 35 of file PrintSdiDoc.h.

CString CPrintSDIDoc::m_szText

Definition at line 36 of file PrintSdiDoc.h.

The documentation for this class was generated from the following files:
  • NetDS/fax/PrintSdi/PrintSdiDoc.h
  • NetDS/fax/PrintSdi/SdiDoc.Cpp
Generated on Wed Nov 13 2024 16:57:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPrintSDIView Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions

CPrintSDIView Class Reference

#include "PrintSdiView.h"

Inherits CView.

List of all members.

Public Member Functions

virtual | ~CPrintSDIView ()
CPrintSDIDoc * GetDocument ()
virtual void | OnDraw (CDC *pDC)
virtual BOOL | PreCreateWindow (CREATESTRUCT &cs)

Protected Member Functions

CPrintSDIView ()
virtual void | OnBeginPrinting (CDC *pDC, CPrintInfo *pInfo)
virtual void | OnEndPrinting (CDC *pDC, CPrintInfo *pInfo)
afx_msg void | OnFileFax ()
virtual BOOL | OnPreparePrinting (CPrintInfo *pInfo)

Detailed Description

Definition at line 12 of file PrintSdiView.h.

Constructor & Destructor Documentation

CPrintSDIView::CPrintSDIView ( ) [protected]

Definition at line 36 of file PrintSdiVw.Cpp.

{
  // TODO: add construction code here

}

CPrintSDIView::~CPrintSDIView ( ) [virtual]

Definition at line 42 of file PrintSdiVw.Cpp.

{
}

Member Function Documentation

CPrintSDIDoc * CPrintSDIView::GetDocument ( ) [inline]

Definition at line 56 of file PrintSdiView.h.

   { return (CPrintSDIDoc*)m_pDocument; }

void CPrintSDIView::OnBeginPrinting | ( | CDC * | pDC,
 |  | CPrintInfo * | pInfo |
 | ) |  |  | [protected, virtual]

Definition at line 114 of file PrintSdiVw.Cpp.

{
  // TODO: add extra initialization before printing
}

void CPrintSDIView::OnDraw ( CDC * pDC ) [virtual]

Definition at line 57 of file PrintSdiVw.Cpp.

{
  CPrintSDIDoc* pDoc = GetDocument();
  ASSERT_VALID(pDoc);

  CRect rect;
  GetClientRect(rect);

  pDC->SetTextAlign(TA_BASELINE | TA_CENTER);
  pDC->SetTextColor(::GetSysColor(COLOR_WINDOWTEXT));
  pDC->SetBkMode(TRANSPARENT);
  pDC->TextOut(rect.right/2, 3*rect.bottom/4,pDoc->m_szText);

  CRect rect2( (rect.right-rect.left)/4 ,
         (rect.top),
         3*(rect.right-rect.left)/4,
         (rect.bottom)/2);

  POINT pnt = {rect2.right/2,rect2.top};
  switch (pDoc->m_polytype) {
  case 0:
    //circle
    pDC->Arc(rect2,pnt,pnt);
    break;
  case 1:
    //sqare
    pDC->MoveTo(rect2.left,rect2.top);
    pDC->LineTo(rect2.right,rect2.top);
    pDC->LineTo(rect2.right,rect2.bottom);
    pDC->LineTo(rect2.left,rect2.bottom);
    pDC->LineTo(rect2.left,rect2.top);
    break;
  case 2:
    //triangle
    pDC->MoveTo(rect.right/2,rect2.top);
    pDC->LineTo(rect2.left,rect2.bottom);
    pDC->LineTo(rect2.right,rect2.bottom);
    pDC->LineTo(rect.right/2,rect2.top);
    break;
  default:
    pDC->Arc(rect2,pnt,pnt);
  }

  CString dbg;
  dbg.Format(TEXT("%d %d %d %d\n"),rect2.left, rect2.top, rect2.right, rect2.bottom);
  OutputDebugString(dbg);
}

void CPrintSDIView::OnEndPrinting | ( | CDC * | pDC,
 |  | CPrintInfo * | pInfo |
 | ) |  |  | [protected, virtual]

Definition at line 119 of file PrintSdiVw.Cpp.

{
  // TODO: add cleanup after printing
}

void CPrintSDIView::OnFileFax ( ) [protected]

Definition at line 148 of file PrintSdiVw.Cpp.

{
  FaxDlg dlg;
  dlg.DoModal();

  FAX_CONTEXT_INFO FaxContextInfo;
    FAX_PRINT_INFO FaxPrintInfo = {0};
  DWORD JobId;

  FaxContextInfo.SizeOfStruct = sizeof(FAX_CONTEXT_INFO);

  FaxPrintInfo.SizeOfStruct = sizeof(FAX_PRINT_INFO);
    FaxPrintInfo.RecipientNumber = dlg.m_FaxNumber.GetBuffer(MAX_PATH);
  FaxPrintInfo.RecipientName   = dlg.m_RecipientName.GetBuffer(MAX_PATH);

  // use the default FAX printer
  if (!FaxStartPrintJob(NULL,&FaxPrintInfo,&JobId,&FaxContextInfo) ) {
    CString dbg;
    dbg.Format(_T("FaxStartPrintJob failed, ec = %d\n"),GetLastError() );
    AfxMessageBox(dbg);
    return;
  }

  // print the document
  CDC dc;
  dc.Attach(FaxContextInfo.hDC);
  OnDraw(&dc);

  dc.EndDoc();

}

BOOL CPrintSDIView::OnPreparePrinting ( CPrintInfo * pInfo ) [protected, virtual]

Definition at line 108 of file PrintSdiVw.Cpp.

{
  // default preparation
  return DoPreparePrinting(pInfo);
}

BOOL CPrintSDIView::PreCreateWindow ( CREATESTRUCT & cs ) [virtual]

Definition at line 46 of file PrintSdiVw.Cpp.

{
  // TODO: Modify the Window class or styles here by modifying
  //  the CREATESTRUCT cs

  return CView::PreCreateWindow(cs);
}

The documentation for this class was generated from the following files:
  • NetDS/fax/PrintSdi/PrintSdiView.h
  • NetDS/fax/PrintSdi/PrintSdiVw.Cpp
Generated on Wed Nov 13 2024 16:57:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CProcessDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Private Attributes

CProcessDlg Class Reference

#include "ProcessDlg.h"

List of all members.

Public Types

enum | { IDD = IDD_PROCESS }

Public Member Functions

CProcessDlg (CWnd *pParent=NULL)

Public Attributes

CListBox | m_processList
CEdit | m_serverName
PWTS_PROCESS_INFO | pProcessInfo

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
virtual void | OnCancel ()
virtual BOOL | OnInitDialog ()
afx_msg void | OnRefresh ()
afx_msg void | OnTerminateProcess ()
afx_msg void | Refresh ()

Private Attributes

DWORD count
HANDLE serverHandle
LPSTR serverName

Detailed Description

Definition at line 18 of file ProcessDlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 27 of file ProcessDlg.h.

{ IDD = IDD_PROCESS };

Constructor & Destructor Documentation

CProcessDlg::CProcessDlg ( CWnd * pParent = NULL )

Definition at line 23 of file ProcessDlg.Cpp.

  : CDialog(CProcessDlg::IDD, pParent)
{
  //{{AFX_DATA_INIT(CProcessDlg)
    // NOTE: the ClassWizard will add member initialization here
  //}}AFX_DATA_INIT
}

Member Function Documentation

void CProcessDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 32 of file ProcessDlg.Cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CProcessDlg)
  DDX_Control(pDX, IDC_SERVER_NAME, m_serverName);
  DDX_Control(pDX, IDC_PROCESS, m_processList);
  //}}AFX_DATA_MAP
}

void CProcessDlg::OnCancel ( ) [protected, virtual]

Definition at line 122 of file ProcessDlg.Cpp.

{
  WTSCloseServer(serverHandle);
  WTSFreeMemory(pProcessInfo);
  CDialog::OnCancel();
}

BOOL CProcessDlg::OnInitDialog ( void ) [protected, virtual]

Definition at line 80 of file ProcessDlg.Cpp.

{
  CDialog::OnInitDialog();
  serverName = g_pDoc->GetServerName();
  serverHandle = WTSOpenServer(serverName);
  if (!WTSEnumerateProcesses(serverHandle,0,1,&pProcessInfo,&count))
    AfxMessageBox("Unable to enumerate processes");
  PWTS_PROCESS_INFO pProcess = pProcessInfo;

  CString serverDisplay;
  serverDisplay = "List of processes on ";
  if (*serverName == NULL)
    serverDisplay += "local server";
  else
    serverDisplay += serverName;
  m_serverName.SetWindowText(serverDisplay);

  for (DWORD i=0; i < count; i++)
  {
    m_processList.AddString(pProcess->pProcessName);
    pProcess++;
  }
  m_processList.SetCurSel(0);

  return TRUE;
}

void CProcessDlg::OnRefresh ( ) [protected]

Definition at line 129 of file ProcessDlg.Cpp.

{
  Refresh();
}

void CProcessDlg::OnTerminateProcess ( ) [protected]

Definition at line 54 of file ProcessDlg.Cpp.

{
  DWORD        ProcessId;
  LPSTR serverName = g_pDoc->GetServerName();
  HANDLE serverHandle = WTSOpenServer(serverName);
  CString tempName;
  int    temp;
  PWTS_PROCESS_INFO pProcess = pProcessInfo;

  temp = m_processList.GetCurSel();
  m_processList.GetText(temp, tempName);

  for (DWORD i=0; i < count; i++)
  {
    if (tempName == (pProcess->pProcessName))
    {
      ProcessId = pProcess->ProcessId;
      if (!WTSTerminateProcess(serverHandle,ProcessId,0x0))
        AfxMessageBox("Unable to terminate process");
      i = count;
    }
    pProcess++;
  }
  Refresh();
}

void CProcessDlg::Refresh ( ) [protected]

Definition at line 108 of file ProcessDlg.Cpp.

{
  m_processList.ResetContent();
  BOOL result = WTSEnumerateProcesses(serverHandle,0,1,&pProcessInfo,&count);
  PWTS_PROCESS_INFO pProcess = pProcessInfo;

  for (DWORD i=0; i < count; i++)
  {
    m_processList.AddString(pProcess->pProcessName);
    pProcess++;
  }
  m_processList.SetCurSel(0);
}

Member Data Documentation

DWORD CProcessDlg::count [private]

Definition at line 53 of file ProcessDlg.h.

CListBox CProcessDlg::m_processList

Definition at line 29 of file ProcessDlg.h.

CEdit CProcessDlg::m_serverName

Definition at line 28 of file ProcessDlg.h.

PWTS_PROCESS_INFO CProcessDlg::pProcessInfo

Definition at line 22 of file ProcessDlg.h.

HANDLE CProcessDlg::serverHandle [private]

Definition at line 54 of file ProcessDlg.h.

LPSTR CProcessDlg::serverName [private]

Definition at line 55 of file ProcessDlg.h.

The documentation for this class was generated from the following files:
  • WinBase/WtsApi/WtsApi/ProcessDlg.h
  • WinBase/WtsApi/WtsApi/ProcessDlg.Cpp
Generated on Wed Nov 13 2024 16:57:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CProgress Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Public Attributes

CProgress Class Reference

#include "progress.h"

Inherits CDialogBase.

List of all members.

Public Member Functions

CProgress (HWND hWnd, HINSTANCE hInst)
virtual | ~CProgress ()
virtual BOOL | Cancel ()
virtual ULONG | Destroy ()
virtual ULONG | Display ()
virtual BOOL | SetHeading (WCHAR *pwszText)
virtual BOOL | SetText (WCHAR *pwszText)
virtual BOOL | Update (WCHAR *pwszText)

Static Public Member Functions

static BOOL WINAPI | DlgProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)

Public Attributes

BOOL m_fCancel

Detailed Description

Definition at line 26 of file progress.h.

Constructor & Destructor Documentation

CProgress::CProgress | ( | HWND | hWnd,
 |  | HINSTANCE | hInst
 | ) |  |

Definition at line 24 of file progress.cpp.

  : CDialogBase(hWnd, hInst)
{
}

CProgress::~CProgress ( ) [virtual]

Definition at line 33 of file progress.cpp.

{
  Destroy();
}

Member Function Documentation

BOOL CProgress::Cancel ( void ) [virtual]

Definition at line 144 of file progress.cpp.

{
  MSG   msg;

  //Must have an existing window to cancel
  if(m_hWnd==NULL)
    return FALSE;

  while(PeekMessage(&msg, m_hWnd, 0, 0, PM_REMOVE))
  {
    if(!IsDialogMessage(m_hWnd, &msg))
    {
      TranslateMessage(&msg);
      DispatchMessage(&msg);
    }
  }

  return m_fCancel;
}

ULONG CProgress::Destroy ( ) [virtual]

Reimplemented from CDialogBase.

Definition at line 103 of file progress.cpp.

{
  if(m_hWnd)
  {
    DestroyWindow(m_hWnd);
    m_hWnd = NULL;
  }
  return TRUE;
}

ULONG CProgress::Display ( ) [virtual]

Implements CDialogBase.

Definition at line 89 of file progress.cpp.

{
  m_fCancel = FALSE;

  //Create a ModeLess Dialog Box
  m_hWnd = CreateDialogParam(m_hInst, MAKEINTRESOURCE(IDD_PROGRESS), NULL, DlgProc, (LPARAM)this);
  return TRUE;
}

BOOL WINAPI CProgress::DlgProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 43 of file progress.cpp.

{
  switch(msg)
  {
    case WM_INITDIALOG:
    {
      //Save the this pointer, since this is a static method
      Busy();
      CProgress* pThis = (CProgress*)lParam;
      SetWindowLong(hWnd, GWL_USERDATA, (LONG)pThis);

      //On INIT we know we have a valid hWnd to store
      pThis->m_hWnd = hWnd;

      CenterDialog(hWnd);
      return TRUE;
    }
    break;

    case WM_COMMAND:
    {
      // All buttons are handled the same way
      //Restore instance pointer, since this is a static function
      CProgress* pThis = (CProgress*)GetWindowLong(hWnd, GWL_USERDATA);

      switch(GET_WM_COMMAND_ID(wParam, lParam))
      {
                case IDCANCEL:
          Busy();
          pThis->m_fCancel = TRUE;
                  return TRUE;
      }
      return FALSE;
    }
    break;

    default:
      return FALSE;
  }
}

BOOL CProgress::SetHeading ( WCHAR * pwszText ) [virtual]

Definition at line 118 of file progress.cpp.

{
  ASSERT(pwszText);

  wSetDlgItemText(m_hWnd, IDT_STATUS, pwszText);
  return TRUE;
}

BOOL CProgress::SetText ( WCHAR * pwszText ) [virtual]

Definition at line 131 of file progress.cpp.

{
  ASSERT(pwszText);

  wSetDlgItemText(m_hWnd, IDT_STAT_INFO, pwszText);
  return TRUE;
}

BOOL CProgress::Update ( WCHAR * pwszText ) [virtual]

Definition at line 169 of file progress.cpp.

{
  ASSERT(pwszText);

  //Update the progress text
  SetText(pwszText);

  // Now check for a cancel from the user, by checking
  // the messages from the user
  if(Cancel())
  {
    if(IDYES == wMessageBox(m_hWnd, MB_TASKMODAL | MB_ICONEXCLAMATION | MB_YESNO, wsz_CANCEL, wsz_CANCEL_OP))
    {
      //Indicate the users wishes to stop
      return FALSE;
    }
    else
    {
      m_fCancel = FALSE;
    }
  }

  //Indicate the user wishes to continue
  return TRUE;
}

Member Data Documentation

BOOL CProgress::m_fCancel

Definition at line 46 of file progress.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/tablecopy/progress.h
  • Dataaccess/oledb/tablecopy/progress.cpp
Generated on Wed Nov 13 2024 16:57:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CProperties Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CProperties Class Reference

#include "property.h"

Inherits TPropBase< DBPROP >.

List of all members.

Public Member Functions

CProperties (DBPROPSET *pPropSet=NULL)
virtual | ~CProperties ()
virtual void | Attach (DBPROPSET *pPropSet)
virtual void | Detach (DBPROPSET *pPropSet)
virtual DBPROP * | FindProperty (DBPROPID dwPropertyID, const DBID &colid)
virtual void | RemoveAll ()
virtual HRESULT | SetProperty (DBPROPID dwPropertyID, DBTYPE wType, void *pv, DBPROPOPTIONS dwOptions=DBPROPOPTIONS_REQUIRED, const DBID &colid=DB_NULLID)

Detailed Description

Definition at line 52 of file property.h.

Constructor & Destructor Documentation

CProperties::CProperties ( DBPROPSET * pPropSet = NULL )

Definition at line 63 of file property.cpp.

{
  Attach(pPropSet);
}

CProperties::~CProperties ( ) [virtual]

Definition at line 72 of file property.cpp.

{
}

Member Function Documentation

void CProperties::Attach ( DBPROPSET * pPropSet ) [virtual]

Definition at line 81 of file property.cpp.

{
  //Delegate
  if(pPropSet)
    CVector<DBPROP>::Attach(pPropSet->cProperties, pPropSet->rgProperties);
}

void CProperties::Detach ( DBPROPSET * pPropSet ) [virtual]

Definition at line 92 of file property.cpp.

{
  //Delegate
  CVector<DBPROP>::Detach(&pPropSet->cProperties, &pPropSet->rgProperties);
}

DBPROP * CProperties::FindProperty | ( | DBPROPID | dwPropertyID,
 |  | const DBID & | colid |
 | ) |  |  | [virtual]

Implements TPropBase< DBPROP >.

Definition at line 118 of file property.cpp.

{
  //Loop over the array of properties in this set
  for(ULONG iProp=0; iProp<m_cElements; iProp++)
  {
    DBPROP* pProp = &m_rgElements[iProp];
    if(pProp->dwPropertyID == dwPropertyID && DBIDEqual(&pProp->colid, &colid))
      return pProp;
  }

  return NULL;
}

void CProperties::RemoveAll ( ) [virtual]

Reimplemented from CVector< DBPROP >.

Definition at line 103 of file property.cpp.

{
  //We need to walk and free out-of-line data...
  for(ULONG iProp=0; iProp<m_cElements; iProp++)
    VariantClearFast(&m_rgElements[iProp].vValue);

  //Delegate
  CVector<DBPROP>::RemoveAll();
}

HRESULT CProperties::SetProperty | ( | DBPROPID | dwPropertyID,
 |  | DBTYPE | wType,
 |  | void * | pv,
 |  | DBPROPOPTIONS | dwOptions = DBPROPOPTIONS_REQUIRED,
 |  | const DBID & | colid = DB_NULLID |
 | ) |  |  | [virtual]

Definition at line 136 of file property.cpp.

{
  HRESULT hr = S_OK;

  //Add this property (if it doesn't already exist)
  DBPROP* pProp = AddProperty(dwPropertyID, colid);
  if(!pProp)
    TESTC(hr = E_OUTOFMEMORY);

  //Free any previous value
  VariantClearFast(&pProp->vValue);
  DBIDFree(&pProp->colid);

  //Setup the new property
  pProp->dwPropertyID = dwPropertyID;
  pProp->dwOptions    = dwOptions;
  pProp->dwStatus     = DBPROPSTATUS_OK;

  //Copy the colid
  DBIDCopy(&pProp->colid, &colid);

  //Copy the Value
  pProp->vValue.vt    = wType;
  switch(wType)
  {
    case DBTYPE_BOOL:
      V_BOOL(&pProp->vValue)    = (VARIANT_BOOL)pv;
      break;

    case DBTYPE_I2:
      V_I2(&pProp->vValue)    = (SHORT)(ULONG_PTR)(pv);
      break;

    case DBTYPE_I4:
      V_I4(&pProp->vValue)    = (LONG)(ULONG_PTR)(pv);
      break;

#ifdef _WIN64
    case DBTYPE_I8:
//TODO64: V_I8(&pProp->vValue)    = (LONG_PTR)pv;
      pProp->vValue.ullVal    = (LONG_PTR)pv;
      break;
#endif //_WIN64

    case DBTYPE_WSTR:
    case DBTYPE_BSTR:
      V_BSTR(&pProp->vValue)    = SysAllocString((BSTR)pv);
      break;

    case DBTYPE_VARIANT:
      XTEST(VariantCopyFast(&pProp->vValue, (VARIANT*)pv));
      break;

    default:
      ASSERT(FALSE); //Unhandled property type
      TESTC(hr = E_INVALIDARG);
      break;
  }

CLEANUP:
  return hr;
}

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/property.h
  • Dataaccess/oledb/rowsetviewer/property.cpp
Generated on Wed Nov 13 2024 16:57:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPropertiesBase Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CPropertiesBase Class Reference

#include "cbase.h"

Inherits CAsynchBase.

Inherited by CDataSource, and CEnumerator.

List of all members.

Public Member Functions

CPropertiesBase (SOURCE eObjectType, CMainWindow *pCMainWindow, CMDIChild *pCMDIChild=NULL)
virtual | ~CPropertiesBase ()
virtual HRESULT | AutoQI (DWORD dwCreateOpts)
virtual HRESULT | AutoRelease ()
virtual IUnknown ** | GetInterfaceAddress (REFIID riid)
virtual HRESULT | SetProperties (ULONG cPropSets, DBPROPSET *rgPropSets)

Public Attributes

IDBProperties * | m_pIDBProperties

Detailed Description

Definition at line 343 of file cbase.h.

Constructor & Destructor Documentation

CPropertiesBase::CPropertiesBase | ( | SOURCE | eObjectType,
 |  | CMainWindow * | pCMainWindow,
 |  | CMDIChild * | pCMDIChild = NULL
 | ) |  |

Definition at line 1157 of file cbase.cpp.

  : CAsynchBase(eObjectType, pCMainWindow, pCMDIChild)
{
  //eBaseClass
  m_eBaseClass = BASE_CLASS(m_eBaseClass | eCPropertiesBase);

  //OLE DB Interfaces
  m_pIDBProperties      = NULL;   //OLE DB interface
}

CPropertiesBase::~CPropertiesBase ( ) [virtual]

Definition at line 1172 of file cbase.cpp.

{
}

Member Function Documentation

HRESULT CPropertiesBase::AutoQI ( DWORD dwCreateOpts ) [virtual]

Reimplemented from CAsynchBase.

Reimplemented in CDataSource, and CEnumerator.

Definition at line 1208 of file cbase.cpp.

{
  //Delegate First so we have IConnectionPointContainer
  CAsynchBase::AutoQI(dwCreateOpts);

  //[MANDATORY]
  if(dwCreateOpts & CREATE_QI_MANDATORY)
  {
    OBTAIN_INTERFACE(IDBProperties);

    //NOTE: Since this class inherits from CAsynchBase which already has an IDBInitialize
    //pointer we will just use that, but the problem is that in the object its an optional
    //interface, and under the DSO its a required interface.  So we just do a QI again
    //if the pointer has not already been retrived...
    OBTAIN_INTERFACE(IDBInitialize);
  }

  //AutoQI
  if(dwCreateOpts & CREATE_QI_OPTIONAL)
  {
    //[OPTIONAL]
  }

  return S_OK;
}

HRESULT CPropertiesBase::AutoRelease ( ) [virtual]

Reimplemented from CAsynchBase.

Reimplemented in CDataSource, and CEnumerator.

Definition at line 1194 of file cbase.cpp.

{
  //OLE DB interfaces
  RELEASE_INTERFACE(IDBProperties);

  //Delegate
  return CAsynchBase::AutoRelease();
}

IUnknown ** CPropertiesBase::GetInterfaceAddress ( REFIID riid ) [virtual]

Reimplemented from CAsynchBase.

Reimplemented in CDataSource, and CEnumerator.

Definition at line 1181 of file cbase.cpp.

{
  HANDLE_GETINTERFACE(IDBProperties);

  //Otherwise delegate
  return CAsynchBase::GetInterfaceAddress(riid);
}

HRESULT CPropertiesBase::SetProperties | ( | ULONG | cPropSets,
 |  | DBPROPSET * | rgPropSets |
 | ) |  |  | [virtual]

Definition at line 1239 of file cbase.cpp.

{
  HRESULT hr = S_OK;

  if(m_pIDBProperties && cPropSets)
  {
    //SetProperties
    XTEST_(hr = m_pIDBProperties->SetProperties(cPropSets, rgPropSets),S_OK);
    TRACE_METHOD(hr, L"IDBProperties::SetProperties(%d, 0x%p)", cPropSets, rgPropSets);

    //Display any property errors...
    TESTC(hr = DisplayPropErrors(hr, cPropSets, rgPropSets));
  }

CLEANUP:
  return hr;
}

Member Data Documentation

IDBProperties* CPropertiesBase::m_pIDBProperties

Reimplemented in CDataSource.

Definition at line 360 of file cbase.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cbase.h
  • Dataaccess/oledb/rowsetviewer/cbase.cpp
Generated on Wed Nov 13 2024 16:57:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPropertiesDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes

CPropertiesDlg Class Reference

#include "cdialog.h"

Inherits CDialogLite, and CRowsetViewerDlg.

List of all members.

Public Types

enum | METHOD_TYPE { METHOD_SETPROPERTIES, METHOD_GETPROPERTIES, METHOD_GETPROPERTYINFO }

Public Member Functions

CPropertiesDlg (CMainWindow *pCMainWindow)
virtual | ~CPropertiesDlg ()
HRESULT | DisplayProperties (ULONG cPropertyIDSets, DBPROPIDSET *rgPropertyIDSets)
HRESULT | DisplayProperty (INDEX iItem, DBPROP *pProp, DBPROPINFO *pPropInfo, REFGUID guidPropertySet, LPARAM lParam=0)
HRESULT | GetProperties (HWND hWndParent, const GUID *pGuidPropertySet, REFIID riidProp, IUnknown *pIUnkProperties, IDBProperties *pIDBPropertyInfo, CPropSets *pCPropSets=NULL, IDBDataSourceAdmin *pIDBDataSourceAdmin=NULL)
HRESULT | GetProperties (ULONG cPropertyIDSets, DBPROPIDSET *rgPropertyIDSets, ULONG *pcPropSets, DBPROPSET **prgPropSets)
HRESULT | GetPropertyInfo (HWND hWndParent, const GUID *pGuidPropertySet, REFIID riidProp, IDBProperties *pIDBPropertyInfo, IDBDataSourceAdmin *pIDBDataSourceAdmin=NULL)
HRESULT | GetPropertyInfo (ULONG cPropertyIDSets, DBPROPIDSET *rgPropertyIDSets, ULONG *pcPropInfoSets, DBPROPINFOSET **prgPropInfoSets, WCHAR **ppStringBuffer)
DBPROPINFO * | GetSelPropInfo (INDEX iSelRow, DBPROPINFOSET **ppPropInfoSet=NULL)
virtual void | OnAddDefinedProperties ()
virtual BOOL | OnCancel ()
virtual void | OnClearAll ()
virtual BOOL | OnCommand (UINT iID, HWND hWndCtrl)
virtual BOOL | OnCommandNotify (INT wNotifyCode, INT iID, HWND hWndCtrl)
virtual BOOL | OnInitDialog ()
virtual BOOL | OnNotify (INT idCtrl, NMHDR *pNMHDR)
virtual BOOL | OnOK ()
virtual BOOL | OnPropOptionsChange ()
virtual BOOL | OnPropSetChange ()
virtual BOOL | OnPropTypeChange ()
virtual BOOL | OnPropValueChange ()
virtual BOOL | OnSelChange (INT iID, HWND hWndCtrl)
HRESULT | SetProperties (HWND hWndParent, const GUID *pGuidPropertySet, REFIID riidProp, IUnknown *pIUnkProperties, IDBProperties *pIDBPropertyInfo, CPropSets *pCPropSets=NULL, IDBDataSourceAdmin *pIDBDataSourceAdmin=NULL)
HRESULT | SetProperties (ULONG cPropSets, DBPROPSET *rgPropSets)

Public Attributes

BOOL m_bClearAll
CComboBoxLite m_comboOptions
CComboBoxLite m_comboPropSet
CComboBoxLite m_comboType
CComboBoxLite m_comboValue
ULONG m_cPropInfoSets
CEditBoxLite m_editDesc
METHOD_TYPE m_eMethodType
IID m_iidProp
CListViewLite m_listviewProps
CPropSets * m_pCPropSets
const GUID * | m_pGuidPropertySet
IDBDataSourceAdmin * | m_pIDBDataSourceAdmin
IDBProperties * | m_pIDBPropertyInfo
IUnknown * | m_pIUnkProperties
WCHAR * | m_pStringBuffer
DBPROPINFOSET * | m_rgPropInfoSets

Detailed Description

Definition at line 231 of file cdialog.h.

Member Enumeration Documentation

enum CPropertiesDlg::METHOD_TYPE
Enumerator:
METHOD_SETPROPERTIES
METHOD_GETPROPERTIES
METHOD_GETPROPERTYINFO

Definition at line 298 of file cdialog.h.

  {
    METHOD_SETPROPERTIES,
    METHOD_GETPROPERTIES,
    METHOD_GETPROPERTYINFO
  };

Constructor & Destructor Documentation

CPropertiesDlg::CPropertiesDlg ( CMainWindow * pCMainWindow )

Definition at line 2551 of file cdialog.cpp.

  : CDialogLite(IDD_SETPROPERTIES), CRowsetViewerDlg(pCMainWindow)
{
  m_pIUnkProperties   = NULL;
  m_pIDBPropertyInfo    = NULL;
  m_pIDBDataSourceAdmin = NULL;

  m_pCPropSets      = NULL;

  //Save State
  m_cPropInfoSets     = 0;
  m_rgPropInfoSets    = NULL;
  m_pStringBuffer     = NULL;
  m_bClearAll       = TRUE;
}

CPropertiesDlg::~CPropertiesDlg ( ) [virtual]

Definition at line 2572 of file cdialog.cpp.

{
}

Member Function Documentation

HRESULT CPropertiesDlg::DisplayProperties | ( | ULONG | cPropertyIDSets,
 |  | DBPROPIDSET * | rgPropertyIDSets
 | ) |  |

Definition at line 3041 of file cdialog.cpp.

{
  HRESULT hr = S_OK;
  WCHAR wszBuffer[MAX_NAME_LEN+1];
  ULONG iPropSet,iProp,iItems = 0;

  //Now remove any previous items
  m_listviewProps.DeleteAllItems();

  //Free Previous Properties...
  FreeProperties(&m_cPropInfoSets, &m_rgPropInfoSets);
  SAFE_FREE(m_pStringBuffer);

  //GetPropertyInfo
  //Both GetProperties and SetProperites needs this info as well, not just GetPropertyInfo.
  //Since they need to know the description and readwrite flags...
  hr = GetPropertyInfo(cPropertyIDSets, rgPropertyIDSets, &m_cPropInfoSets, &m_rgPropInfoSets, &m_pStringBuffer);

  //Do any specific post processing before displaying
  switch(m_eMethodType)
  {
    case METHOD_GETPROPERTYINFO:
    {
      //We just display the info returned from GetPropertyInfo...
      break;
    }

    case METHOD_SETPROPERTIES:
    {
      ULONG cPropSets = 0;
      DBPROPSET* rgPropSets = NULL;

      //For the SetProperties dialog, we want to display all the properties
      //obtained from GetPropertyInfo and provide the current values of the properties
      //obtained from GetProperties.  This allows the user access to set all available properties
      //and have the current value so they know what it is before setting it...
      hr = GetProperties(0, NULL, &cPropSets, &rgPropSets);

      //Now combine both sets...
      if(SUCCEEDED(hr) && cPropSets && rgPropSets)
        TESTC(hr = CombineProperties(&m_cPropInfoSets, &m_rgPropInfoSets, cPropSets, rgPropSets, TRUE/*bFreeAddedPropSet*/));
      break;
    }

    case METHOD_GETPROPERTIES:
    {
      //Save off the PropertyInfo
      ULONG cPropInfoSets       = m_cPropInfoSets;
      DBPROPINFOSET* rgPropInfoSets = m_rgPropInfoSets;
      m_cPropInfoSets = 0;
      m_rgPropInfoSets = NULL;

      ULONG cPropSets = 0;
      DBPROPSET* rgPropSets = NULL;

      //GetProperties
      hr = GetProperties(cPropertyIDSets, rgPropertyIDSets, &cPropSets, &rgPropSets);

      //Now combine both sets...
      if(SUCCEEDED(hr) && cPropSets && rgPropSets)
      {
        //NOTE: We don't want to just combine the properties returned from GetProperties
        //to those returned from GetPropertyInfo, since we should only show those properties
        //returned from GetProperties not a combination of both.  But we do want the
        //flags and descriptions found in the Info so handle that seperatly...

        //Dump our cPropSet into PropInfo sets, so we can have one routine to
        //dump all properties illregardless of source, and can add the propinfo flags, etc...
        TESTC(hr = CombineProperties(&m_cPropInfoSets, &m_rgPropInfoSets, cPropSets, rgPropSets, TRUE/*bFreeAddedPropSet*/));

        //Add the Prop Flags and Descriptions from GetPropertyInfo
        for(iPropSet=0; iPropSet<m_cPropInfoSets; iPropSet++)
        {
          DBPROPINFOSET* pPropInfoSet = &m_rgPropInfoSets[iPropSet];
          for(iProp=0; iProp<pPropInfoSet->cPropertyInfos; iProp++)
          {
            DBPROPINFO* pPropInfo = &pPropInfoSet->rgPropertyInfos[iProp];
            DBPROPINFO* pFoundProp= FindProperty(pPropInfo->dwPropertyID, pPropInfoSet->guidPropertySet, cPropInfoSets, rgPropInfoSets);
            if(pFoundProp)
            {
              pPropInfo->pwszDescription  = pFoundProp->pwszDescription;
              pPropInfo->dwFlags      |=pFoundProp->dwFlags;
            }
          }
        }
      }

      //Free the previous property info
      FreeProperties(&cPropInfoSets, &rgPropInfoSets);
      break;
    }
  };

  //Add any defined properties (if requested)
  if(IsDlgButtonChecked(IDB_ADDDEFINEDPROPS))
  {
    if(cPropertyIDSets==0 || (rgPropertyIDSets && rgPropertyIDSets[0].cPropertyIDs==0))
    {
      //NOTE: We redo this first, by obtaining the static ones first, and then adding the
      //properties from above.  This way all defined properties are nicely ordered,
      //as opposed to what some providers return for an ordering...
      ULONG cPropInfoSets       = m_cPropInfoSets;
      DBPROPINFOSET* rgPropInfoSets = m_rgPropInfoSets;
      m_cPropInfoSets = 0;
      m_rgPropInfoSets = NULL;

      //First obtain all the OLE DB Defined Properties for this set.
      //NOTE: We ask for FALSE - return allocated arrays instead of static arrays...
      TESTC(hr = GetAllocedPropInfo(cPropertyIDSets, rgPropertyIDSets, &m_cPropInfoSets, &m_rgPropInfoSets));

      //Combine any properties returned from above
      TESTC(hr = CombineProperties(&m_cPropInfoSets, &m_rgPropInfoSets, cPropInfoSets, rgPropInfoSets, TRUE/*bFreeAddedPropSet*/));
    }
  }

  //Now Display all the properties
  iItems = 0;
  for(iPropSet=0; iPropSet<m_cPropInfoSets; iPropSet++)
  {
    DBPROPINFOSET* pPropInfoSet = &m_rgPropInfoSets[iPropSet];

    //We need to display this PropertySet
    WCHAR* pwszName = GetPropSetName(pPropInfoSet->guidPropertySet);
    if(pwszName == NULL)
    {
      StringFromGUID2(pPropInfoSet->guidPropertySet, wszBuffer, MAX_NAME_LEN);
      pwszName = wszBuffer;
    }
    m_listviewProps.InsertItem(iItems, PROP_NAME, pwszName, PARAM_NONE, IMAGE_NORMAL);
    m_listviewProps.SetItemState(iItems, 0,  INDEXTOSTATEIMAGEMASK(STATE_NORMAL),  LVIS_STATEIMAGEMASK);
    iItems++;

    //Now display all properties in the set
    for(iProp=0; iProp<pPropInfoSet->cPropertyInfos; iProp++)
    {
      DBPROPINFO* pPropInfo = &pPropInfoSet->rgPropertyInfos[iProp];

      //Try to find this Property in the PropSet
      DBPROP* pFoundProp = m_pCPropSets ? m_pCPropSets->FindProperty(pPropInfo->dwPropertyID, pPropInfoSet->guidPropertySet, DB_NULLID) : NULL;

      //To make our lives easier we will store the [iPropSet,iProp] index into the
      //PropInfoSet or every property into the lParam element of the list view
      //This way whatever message were one we have the neccessary propinfo...
      LPARAM lParam = MAKELONG(iPropSet,iProp);

      //Supply Default Type and Values if there is currently none
      if(pFoundProp)
      {
        pPropInfo->vtType = V_VT(&pFoundProp->vValue);
        XTEST(VariantCopyFast(&pPropInfo->vValues, &pFoundProp->vValue));
      }

      //Delegate to Display this property
      TESTC(hr = DisplayProperty(iItems, pFoundProp, pPropInfo, pPropInfoSet->guidPropertySet, lParam));

      //Set Item State to Checked/Unchecked
      m_listviewProps.SetItemState(iItems, 0,  INDEXTOSTATEIMAGEMASK((pFoundProp && m_pCPropSets) ? STATE_CHECKED : STATE_UNCHECKED),  LVIS_STATEIMAGEMASK);
      iItems++;
    }

    //Now display a space between sets...
    m_listviewProps.InsertItem(iItems, 0, L"", PARAM_NONE, IMAGE_NORMAL);
    m_listviewProps.SetItemState(iItems, 0,  INDEXTOSTATEIMAGEMASK(STATE_NORMAL),  LVIS_STATEIMAGEMASK);
    iItems++;
  }

CLEANUP:
  return hr;
}

HRESULT CPropertiesDlg::DisplayProperty | ( | INDEX | iItem,
 |  | DBPROP * | pProp,
 |  | DBPROPINFO * | pPropInfo,
 |  | REFGUID | guidPropertySet,
 |  | LPARAM | lParam = 0
 | ) |  |

Definition at line 2914 of file cdialog.cpp.

{
  //Display this property in the listview
  static WCHAR wszBuffer[MAX_NAME_LEN+1] = {0};
  ASSERT(pPropInfo);

  //Determine which icon to display
  INT iImage = IMAGE_QUESTION;  //Default - unknown flags

  //READ|WRITE
  if(BIT_SET(pPropInfo->dwFlags, DBPROPFLAGS_READ|DBPROPFLAGS_WRITE))
  {
    //Read-Write  - (very common)
    iImage = IMAGE_NORMAL;
  }
  //READ
  else if(BIT_SET(pPropInfo->dwFlags, DBPROPFLAGS_READ))
  {
    //Read-Only   - (very common)
    iImage = IMAGE_LOCK;
  }
  //WRITE
  else if(BIT_SET(pPropInfo->dwFlags, DBPROPFLAGS_WRITE))
  {
    //Write-Only  - (not common, able to set but not retrieve values)
    iImage = IMAGE_DELETE;
  }

  //PROP_NAME (Indent from PropertySet)
  //Also store the wType as the lParam
  WCHAR* pwszName = GetPropertyName(pPropInfo->dwPropertyID, guidPropertySet);
  if(pwszName)
    StringFormat(wszBuffer, NUMELE(wszBuffer), L"     %s", pwszName);
  else
    StringFormat(wszBuffer, NUMELE(wszBuffer), L"     0x%x", pPropInfo->dwPropertyID);
  m_listviewProps.InsertItem(iItem, PROP_NAME, wszBuffer, lParam, iImage);

  //PROP_TYPE
  m_listviewProps.InsertItem(iItem, PROP_TYPE, GetVariantTypeName(pPropInfo->vtType));

  //PROP_VALUE
  VARIANT* pVariant = pProp ? &pProp->vValue : &pPropInfo->vValues;
  if(pVariant->vt == VT_EMPTY)
  {
    //Provide a default value?
    if(m_eMethodType == METHOD_SETPROPERTIES)
    {
      V_VT(pVariant) = pPropInfo->vtType;
      switch(V_VT(pVariant))
      {
        case VT_EMPTY:
        case VT_NULL:
          break;

        case VT_BOOL:
          V_BOOL(pVariant) = VARIANT_TRUE;
          break;

        case VT_I4:
          V_I4(pVariant) = 0;
          break;

        case VT_I2:
          V_I2(pVariant) = 0;
          break;

        case VT_BSTR:
          V_BSTR(pVariant) = NULL;
          break;

        default:
          V_VT(pVariant) = VT_EMPTY;
          break;
      };
    }
  }

  //PROP_VALUE
  VariantToString(pVariant, wszBuffer, MAX_NAME_LEN, CONV_VARBOOL);
  m_listviewProps.InsertItem(iItem, PROP_VALUE, wszBuffer);

  //PROP_FLAGS
  if(m_eMethodType == METHOD_GETPROPERTYINFO)
  {
    //PROP_FALGS
    StringFormat(wszBuffer, NUMELE(wszBuffer), L"0x%08x", pPropInfo->dwFlags);
    m_listviewProps.InsertItem(iItem, PROP_FLAGS, wszBuffer);
  }
  else
  {
    if(pProp)
    {
      if(pProp->dwOptions == DBPROPOPTIONS_OPTIONAL)
        m_listviewProps.InsertItem(iItem, PROP_FLAGS, L"OPTIONAL");
      else if(pProp->dwOptions == DBPROPOPTIONS_REQUIRED)
        m_listviewProps.InsertItem(iItem, PROP_FLAGS, L"REQUIRED");
      else
      {
        StringFormat(wszBuffer, NUMELE(wszBuffer), L"0x%08x", pProp->dwOptions);
        m_listviewProps.InsertItem(iItem, PROP_FLAGS, wszBuffer);
      }
    }
    else
    {
      m_listviewProps.InsertItem(iItem, PROP_FLAGS, pPropInfo->dwFlags & DBPROPFLAGS_REQUIRED ? L"REQUIRED" : L"OPTIONAL");
    }
  }

  //PROP_DESC
  m_listviewProps.InsertItem(iItem, PROP_DESC, pPropInfo->pwszDescription);

  if(pProp && m_eMethodType != METHOD_GETPROPERTYINFO)
  {
    //PROP_COLID
    DBIDToString(pProp ? &pProp->colid : NULL, wszBuffer, MAX_NAME_LEN);
    m_listviewProps.InsertItem(iItem, PROP_COLID, wszBuffer);
  }

  return S_OK;
}

HRESULT CPropertiesDlg::GetProperties | ( | HWND | hWndParent,
 |  | const GUID * | pGuidPropertySet,
 |  | REFIID | riidProp,
 |  | IUnknown * | pIUnkProperties,
 |  | IDBProperties * | pIDBPropertyInfo,
 |  | CPropSets * | pCPropSets = NULL,
 |  | IDBDataSourceAdmin * | pIDBDataSourceAdmin = NULL
 | ) |  |

Definition at line 2611 of file cdialog.cpp.

{
  ASSERT(pIUnkProperties);

  //Setup variable for StaticProcs to use...
  m_iidProp       = riidProp;
  m_pGuidPropertySet    = pGuidPropertySet;

  m_pIUnkProperties   = pIUnkProperties;
  m_pIDBPropertyInfo    = pIDBPropertyInfo;
  m_pIDBDataSourceAdmin = pIDBDataSourceAdmin;

  m_pCPropSets      = pCPropSets;
  m_eMethodType     = METHOD_GETPROPERTIES;

  //Now Display the dialog
  if(DoModal(hWndParent) == IDOK)
    return S_OK;

  return DB_E_CANCELED;
}

HRESULT CPropertiesDlg::GetProperties | ( | ULONG | cPropertyIDSets,
 |  | DBPROPIDSET * | rgPropertyIDSets,
 |  | ULONG * | pcPropSets,
 |  | DBPROPSET ** | prgPropSets
 | ) |  |

Definition at line 3262 of file cdialog.cpp.

{
  HRESULT hr = S_OK;
  ASSERT(pcPropSets);
  ASSERT(prgPropSets);

  if(m_pIUnkProperties)
  {
    if(m_iidProp == IID_IDBProperties)
    {
      //IDBProperties::GetProperties
      XTEST(hr = ((IDBProperties*)m_pIUnkProperties)->GetProperties(cPropertyIDSets, rgPropertyIDSets, pcPropSets, prgPropSets));
      TRACE_METHOD(hr, L"IDBProperties::GetProperties(%d, 0x%p, &%d, &0x%p)", cPropertyIDSets, rgPropertyIDSets, *pcPropSets, *prgPropSets);
    }
    else if(m_iidProp == IID_ISessionProperties)
    {
      //ISessionProperties::GetProperties
      XTEST(hr = ((ISessionProperties*)m_pIUnkProperties)->GetProperties(cPropertyIDSets, rgPropertyIDSets, pcPropSets, prgPropSets));
      TRACE_METHOD(hr, L"ISessionProperties::GetProperties(%d, 0x%p, &%d, &0x%p)", cPropertyIDSets, rgPropertyIDSets, *pcPropSets, *prgPropSets);
    }
    else if(m_iidProp == IID_ICommandProperties)
    {
      //ICommandProperties::GetProperties
      XTEST(hr = ((ICommandProperties*)m_pIUnkProperties)->GetProperties(cPropertyIDSets, rgPropertyIDSets, pcPropSets, prgPropSets));
      TRACE_METHOD(hr, L"ICommandProperties::GetProperties(%d, 0x%p, &%d, &0x%p)", cPropertyIDSets, rgPropertyIDSets, *pcPropSets, *prgPropSets);
    }
    else if(m_iidProp == IID_IRowsetInfo)
    {
      //IRowsetInfo::GetProperties
      XTEST(hr = ((IRowsetInfo*)m_pIUnkProperties)->GetProperties(cPropertyIDSets, rgPropertyIDSets, pcPropSets, prgPropSets));
      TRACE_METHOD(hr, L"IRowsetInfo::GetProperties(%d, 0x%p, &%d, &0x%p)", cPropertyIDSets, rgPropertyIDSets, *pcPropSets, *prgPropSets);
    }

    //Display Any Property Errors...
    hr = DisplayPropErrors(hr, *pcPropSets, *prgPropSets);
  }

  return hr;
}

HRESULT CPropertiesDlg::GetPropertyInfo | ( | HWND | hWndParent,
 |  | const GUID * | pGuidPropertySet,
 |  | REFIID | riidProp,
 |  | IDBProperties * | pIDBPropertyInfo,
 |  | IDBDataSourceAdmin * | pIDBDataSourceAdmin = NULL
 | ) |  |

Definition at line 2638 of file cdialog.cpp.

{
  ASSERT(pIDBPropertyInfo || pIDBDataSourceAdmin);

  //Setup variable for StaticProcs to use...
  m_iidProp       = riidProp;
  m_pGuidPropertySet    = pGuidPropertySet;

  m_pIUnkProperties   = NULL;
  m_pIDBPropertyInfo    = pIDBPropertyInfo;
  m_pIDBDataSourceAdmin = pIDBDataSourceAdmin;

  m_pCPropSets      = NULL;
  m_eMethodType     = METHOD_GETPROPERTYINFO;

  //Now Display the dialog
  if(DoModal(hWndParent) == IDOK)
    return S_OK;

  return DB_E_CANCELED;
}

HRESULT CPropertiesDlg::GetPropertyInfo | ( | ULONG | cPropertyIDSets,
 |  | DBPROPIDSET * | rgPropertyIDSets,
 |  | ULONG * | pcPropInfoSets,
 |  | DBPROPINFOSET ** | prgPropInfoSets,
 |  | WCHAR ** | ppStringBuffer
 | ) |  |

Definition at line 3307 of file cdialog.cpp.

{
  HRESULT hr = S_OK;
  ASSERT(pcPropInfoSets);
  ASSERT(prgPropInfoSets);
  ASSERT(ppStringBuffer);

  if(m_pIDBPropertyInfo || m_pIDBDataSourceAdmin)
  {
    //Normally GetPropertyInfo supplies all the Property Information,
    //But OLE DB does have a couple of other interfaces that supply prop info
    if(m_pIDBPropertyInfo)
    {
      //IDBProperties::GetPropertyInfo
      //NOTE: GetPropertyInfo may fail since the provider may not support this PropertySet.
      //Just continue since we allow the user to set the OLE DB Defined Properties
      XTEST(hr = m_pIDBPropertyInfo->GetPropertyInfo(cPropertyIDSets, rgPropertyIDSets, pcPropInfoSets, prgPropInfoSets, ppStringBuffer));
      TRACE_METHOD(hr, L"IDBProperties::GetPropertyInfo(%d, 0x%p, &%d, &0x%p, &0x%p)", cPropertyIDSets, rgPropertyIDSets, *pcPropInfoSets, *prgPropInfoSets, *ppStringBuffer);
    }
    else
    {
      //IDBDataSourceAdmin::GetCreationProperties
      //NOTE: GetCreationProperties may fail since the provider may not support this PropertySet.
      //Just continue since we allow the user to set the OLE DB Defined Properties
      XTEST(hr = m_pIDBDataSourceAdmin->GetCreationProperties(cPropertyIDSets, rgPropertyIDSets, pcPropInfoSets, prgPropInfoSets, ppStringBuffer));
      TRACE_METHOD(hr, L"IDBDataSourceAdmin::GetCreationProperties(%d, 0x%p, &%d, &0x%p, &0x%p)", cPropertyIDSets, rgPropertyIDSets, *pcPropInfoSets, *prgPropInfoSets, *ppStringBuffer);
    }

    //Display Any Property Errors...
    hr = DisplayPropErrors(hr, *pcPropInfoSets, *prgPropInfoSets);
  }

  return hr;
}

DBPROPINFO * CPropertiesDlg::GetSelPropInfo | ( | INDEX | iSelRow,
 |  | DBPROPINFOSET ** | ppPropInfoSet = NULL
 | ) |  |

Definition at line 3347 of file cdialog.cpp.

{
  if(iSelRow == LVM_ERR)
    return NULL;

  //Obtain PropInfo element
  //This value is stored as the lParam of the ListView row
  LPARAM lParam = m_listviewProps.GetItemParam(iSelRow);
  if(lParam == LVM_ERR || lParam == PARAM_NONE)
    return NULL;

  ULONG iPropInfoSet = LOWORD(lParam);
  ULONG iPropInfo = HIWORD(lParam);

  //Verify results...
  if(iPropInfoSet >= m_cPropInfoSets || m_rgPropInfoSets==NULL || iPropInfo >= m_rgPropInfoSets[iPropInfoSet].cPropertyInfos || m_rgPropInfoSets[iPropInfoSet].rgPropertyInfos==NULL)
    return NULL;

  //Does the user want the Set as well...
  if(ppPropInfoSet)
    *ppPropInfoSet = &m_rgPropInfoSets[iPropInfoSet];

  //Otherwise we have a valid propset and property...
  return &m_rgPropInfoSets[iPropInfoSet].rgPropertyInfos[iPropInfo];
}

void CPropertiesDlg::OnAddDefinedProperties ( ) [virtual]

Definition at line 3753 of file cdialog.cpp.

{
  OnPropSetChange();
}

BOOL CPropertiesDlg::OnCancel ( ) [virtual]

Definition at line 2899 of file cdialog.cpp.

{
  //Cleanup any memory allocated
  FreeProperties(&m_cPropInfoSets, &m_rgPropInfoSets);
  SAFE_FREE(m_pStringBuffer);

  //Delegate
  return CDialogLite::OnCancel();
}

void CPropertiesDlg::OnClearAll ( ) [virtual]

Definition at line 3540 of file cdialog.cpp.

{
  CWaitCursor waitCursor;

  //Send a selection change message to the Value Combo
  OnPropValueChange();

  //Now that the user has selected to clear all properties
  //We need to loop through all the checked
  //properties and just uncheck them...
  INDEX cItems = m_listviewProps.GetItemCount();
  for(LONG i=0; i<cItems; i++)
  {
    //Get the Image and Param
    //Only interested in actual items, (not headers or spaces)
    LPARAM lParam = m_listviewProps.GetItemParam(i);
    if(lParam == PARAM_NONE)
      continue;

    //Set the state
    m_listviewProps.SetItemState(i, 0,  INDEXTOSTATEIMAGEMASK(m_bClearAll ? STATE_UNCHECKED : STATE_CHECKED),  LVIS_STATEIMAGEMASK);
  }

  //Clear All is a toggle...
  if(m_bClearAll)
  {
    m_bClearAll = FALSE;
        ::SetWindowText(GetDlgItem(IDB_CLEARALL), "SelectAll");
  }
  else
  {
    m_bClearAll = TRUE;
        ::SetWindowText(GetDlgItem(IDB_CLEARALL), "ClearAll");
  }
}

BOOL CPropertiesDlg::OnCommand | ( | UINT | iID,
 |  | HWND | hWndCtrl |
 | ) |  |  | [virtual]

Definition at line 3582 of file cdialog.cpp.

{
  switch(iID)
  {
    ON_COMMAND(IDB_ADDDEFINEDPROPS,     OnAddDefinedProperties())
    ON_COMMAND(IDB_CLEARALL,        OnClearAll())
  };

  return FALSE;
}

BOOL CPropertiesDlg::OnCommandNotify | ( | INT | wNotifyCode,
 |  | INT | iID,
 |  | HWND | hWndCtrl |
 | ) |  |  | [virtual]

Definition at line 3494 of file cdialog.cpp.

{
  switch(wNotifyCode)
  {
    case CBN_SELCHANGE:
    {
      if(OnSelChange(iID, hWndCtrl))
        return TRUE;
      break;
    }
  };

  //Otherwise Delegate
  return CDialogLite::OnCommandNotify(wNotifyCode, iID, hWndCtrl);
}

BOOL CPropertiesDlg::OnInitDialog ( ) [virtual]

Definition at line 2665 of file cdialog.cpp.

{
  CWaitCursor waitCursor;

  //Setup Controls
  m_listviewProps.CreateIndirect(m_hWnd, IDL_PROPERTY);
  m_comboPropSet.CreateIndirect(m_hWnd, IDC_PROPSET);

  //Header (change controls)
  m_comboOptions.CreateIndirect(m_hWnd, IDC_PROPEDIT_OPTIONS);
  m_comboType.CreateIndirect(m_hWnd, IDC_PROPEDIT_TYPE);
  m_comboValue.CreateIndirect(m_hWnd, IDC_PROPEDIT_VALUE);
  m_editDesc.CreateIndirect(m_hWnd, IDE_PROPEDIT_NAME);

  //Use Extended ListView Controls...
  SendMessage(m_listviewProps.m_hWnd, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE | LVS_EX_CHECKBOXES, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE | LVS_EX_CHECKBOXES);

  //ColumnHeaders
  m_listviewProps.InsertColumn(PROP_NAME,   L"Property");
  m_listviewProps.InsertColumn(PROP_TYPE,   L"Type");
  m_listviewProps.InsertColumn(PROP_VALUE,  L"Value");
  m_listviewProps.InsertColumn(PROP_FLAGS,  m_eMethodType == METHOD_GETPROPERTYINFO ? L"Flags" : L"Options");
  m_listviewProps.InsertColumn(PROP_DESC,   L"Description");
  if(m_eMethodType != METHOD_GETPROPERTYINFO)
  {
    m_listviewProps.InsertColumn(PROP_COLID,  L"ColID");
  }

  //Set image list to the ListView
  ListView_SetImageList(m_listviewProps.m_hWnd, ImageList_LoadImage(GetAppLite()->m_hInstance, MAKEINTRESOURCE(IDB_IMAGE), 16, 16, CLR_DEFAULT , IMAGE_BITMAP, LR_DEFAULTCOLOR), LVSIL_SMALL);
  ListView_SetImageList(m_listviewProps.m_hWnd, ImageList_LoadImage(GetAppLite()->m_hInstance, MAKEINTRESOURCE(IDB_STATE), 16, 16, CLR_DEFAULT , IMAGE_BITMAP, LR_DEFAULTCOLOR), LVSIL_STATE);

  //Default PropertySet
  IID iidProp = m_iidProp;

  //Now adjust display and find required PropSet
  if(iidProp == IID_IDBProperties)
  {
    if(m_eMethodType == METHOD_SETPROPERTIES)
      SetWindowText(L"IDBProperties::SetProperties");
    else if(m_eMethodType == METHOD_GETPROPERTIES)
      SetWindowText(L"IDBProperties::GetProperties");
    else
      SetWindowText(L"IDBProperties::GetPropertyInfo");
  }
  else if(iidProp == IID_IDBDataSourceAdmin)
  {
    if(m_eMethodType == METHOD_SETPROPERTIES)
      SetWindowText(L"IDBDataSourceAdmin::ModifyDataSource");
    else
      SetWindowText(L"IDBDataSourceAdmin::GetCreationProperties");
  }
  else if(iidProp == IID_ISessionProperties)
  {
    if(m_eMethodType == METHOD_SETPROPERTIES)
      SetWindowText(L"ISessionProperties::SetProperties");
    else
      SetWindowText(L"ISessionProperties::GetProperties");
  }
  else if(iidProp == IID_ICommandProperties)
  {
    if(m_eMethodType == METHOD_SETPROPERTIES)
      SetWindowText(L"ICommandProperties::SetProperties");
    else
      SetWindowText(L"ICommandProperties::GetProperties");
  }
  else if(iidProp == IID_IRowsetInfo)
  {
    if(m_eMethodType == METHOD_SETPROPERTIES)
      SetWindowText(L"Set Properties for rgPropSet params");
    else
      SetWindowText(L"IRowsetInfo::GetProperties");
  }
  else
  {
    ASSERT(!"Unhandled Property Type!");
  }

  //Fill in the PROPSET Combo
  for(ULONG i=0; i<g_cPropSetMaps; i++)
  {
    INDEX iSel = m_comboPropSet.AddString(g_rgPropSetMaps[i].pwszName, i);
    if(m_eMethodType == METHOD_SETPROPERTIES)
      if(m_pGuidPropertySet && *m_pGuidPropertySet == *(g_rgPropSetMaps[i].pGuid))
        m_comboPropSet.SetCurSel(iSel);
  }

  //Add DBPROPSET All (0, NULL)...
  INDEX iSel = m_comboPropSet.AddString(L"All Properties", CB_ERR);

  //Default Selection
  iSel = m_comboPropSet.GetCurSel();
  m_comboPropSet.SetCurSel(iSel==CB_ERR || (ULONG)iSel>g_cPropSetMaps ? g_cPropSetMaps : iSel);

  //Fill in Types Combo
  m_comboType.Populate(g_cVariantTypes, g_rgVariantTypes);

  //Fill in Options Combo
  m_comboOptions.AddString(L"REQUIRED");  // == 0
  m_comboOptions.AddString(L"OPTIONAL");  // == 1

  //Include OLE DB Defined Properties
  CheckDlgButton(IDB_ADDDEFINEDPROPS,   FALSE/*Default*/);
  m_bClearAll = TRUE;

  //Display properties for just this set...
  const ULONG cPropertyIDSets = 1;
  DBPROPIDSET rgPropertyIDSets[cPropertyIDSets];
  if(m_pGuidPropertySet)
  {
    rgPropertyIDSets[0].cPropertyIDs = 0;
    rgPropertyIDSets[0].rgPropertyIDs = NULL;
    rgPropertyIDSets[0].guidPropertySet = *m_pGuidPropertySet;
  }

  //Do we limit the initial property set?
  BOOL fInitialPropSet = m_eMethodType == METHOD_SETPROPERTIES && m_pGuidPropertySet;

  //Display the Properties (again - this  time all of them)
  TESTC(DisplayProperties(fInitialPropSet ? cPropertyIDSets : 0, rgPropertyIDSets));

CLEANUP:
  //AutoSize Columns
  m_listviewProps.SetColumnWidth(PROP_NAME, LVSCW_AUTOSIZE_USEHEADER);
  m_listviewProps.SetColumnWidth(PROP_TYPE, LVSCW_AUTOSIZE_USEHEADER);
  m_listviewProps.SetColumnWidth(PROP_VALUE,  LVSCW_AUTOSIZE_USEHEADER);
  m_listviewProps.SetColumnWidth(PROP_FLAGS,  LVSCW_AUTOSIZE_USEHEADER);
  m_listviewProps.SetColumnWidth(PROP_DESC, LVSCW_AUTOSIZE_USEHEADER);
  if(m_eMethodType != METHOD_GETPROPERTYINFO)
  {
    m_listviewProps.SetColumnWidth(PROP_COLID,  LVSCW_AUTOSIZE_USEHEADER);
  }

  //Disable Combos
  m_editDesc.EnableWindow(FALSE);
  m_comboOptions.EnableWindow(FALSE);
  m_comboType.EnableWindow(FALSE);
  m_comboValue.EnableWindow(FALSE);

  //Delegate
  return CDialogLite::OnInitDialog();
}

BOOL CPropertiesDlg::OnNotify | ( | INT | idCtrl,
 |  | NMHDR * | pNMHDR |
 | ) |  |  | [virtual]

Definition at line 3597 of file cdialog.cpp.

{
  NM_LISTVIEW* pListView = (NM_LISTVIEW*)pNMHDR;

  //ListView
  switch(pListView->hdr.code)
  {
    case LVN_ITEMCHANGED:
    {
      //Check boxes
      if(pListView->uNewState & LVIS_STATEIMAGEMASK)
      {
        //Get the Current Param
        LPARAM lParam = m_listviewProps.GetItemParam(pListView->iItem);

        //All lParam are PARAM_NONE for headers and non properties...
        //We don't want to change icons for those...
        if(lParam == PARAM_NONE &&
          (pListView->uNewState & INDEXTOSTATEIMAGEMASK(STATE_CHECKED) || pListView->uNewState & INDEXTOSTATEIMAGEMASK(STATE_UNCHECKED)))
        {
          m_listviewProps.SetItemState(pListView->iItem, pListView->iSubItem,  INDEXTOSTATEIMAGEMASK(STATE_NORMAL),  LVIS_STATEIMAGEMASK);
          return TRUE;
        }
      }
      return FALSE;
    }

    case LVN_ITEMACTIVATE:
    {
      //We only allow changes for SetProperties
      if(m_eMethodType != METHOD_SETPROPERTIES)
        return FALSE;

      //Obtain PropInfo element
      INDEX iSelRow = pListView->iItem;
      DBPROPINFO* pPropInfo = GetSelPropInfo(iSelRow);
      if(pPropInfo)
      {
        //TODO: Item and sub item appear to be correct.
        //Should use inplace editing in the listview, rather than seperate headers...

        //Which column was selected?
        switch(pListView->iSubItem)
        {
          case PROP_NAME:
          case PROP_DESC:
            //These items are not settable...
            break;

          case PROP_TYPE:
          {
/*            //Obtain the rect of the selected item.
            RECT rect = { LVIR_BOUNDS, pListView->iSubItem, 0, 0};
            SendMessage(m_listviewProps.m_hWnd, LVM_GETSUBITEMRECT, pListView->iItem, (LPARAM)&rect);

            //Bring up a ComboBox
            //NOTE: The "Height" of the combo indicates the "dropdown" height of the combo...
            static CComboBoxLite comboTypes;
            comboTypes.Create(m_listviewProps.m_hWnd, L"COMBOBOX", NULL, IDC_TYPE,
              CBS_DROPDOWNLIST | CBS_AUTOHSCROLL |
                WS_TABSTOP | WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL,
              0,
              rect.left, rect.top, rect.right-rect.left, (rect.bottom-rect.top)*15);
            comboTypes.SetFont(m_pCMainWindow->m_pCMDIObjects->m_pCObjTree->GetFont());

            //Fill in the Type Combo
            comboTypes.Populate(g_cVariantTypes, g_rgVariantTypes);
            comboTypes.OnCreate(NULL);
*/            break;
          }

          case PROP_VALUE:
            break;
          case PROP_FLAGS:
            break;

          case PROP_COLID:
            //TODO:
            break;

          default:
        //    ASSERT(L"Unhandled Column?");
            break;
        };
      }

      return TRUE;
    }

    case LVN_ITEMCHANGING:
    {
      //We Selected a "new" item
      if(pListView->uNewState & LVNI_FOCUSED &&
        pListView->uNewState & LVNI_SELECTED)
      {
        //Send a selection change message to the Value Combo
        if(m_eMethodType == METHOD_SETPROPERTIES)
          OnPropValueChange();

        //Clear Previous info
        m_editDesc.SetWindowText(L"");
        m_comboValue.ResetContent();

        //Obtain PropInfo element
        INDEX iSelRow = pListView->iItem;
        DBPROPINFO* pPropInfo = GetSelPropInfo(iSelRow);
        if(pPropInfo)
        {
          //Insert Name (Description)
          WCHAR wszBuffer[MAX_NAME_LEN+1] = {0};
          m_listviewProps.GetItemText(iSelRow, PROP_DESC, wszBuffer, MAX_NAME_LEN);
          m_editDesc.SetWindowText(wszBuffer);

          //Set Current Type Selection
          m_comboType.SetSelValue(pPropInfo->vtType);

          //InsertValue
          if(pPropInfo->vtType == DBTYPE_BOOL)
          {
            m_comboValue.AddString(L"VARIANT_TRUE");
            m_comboValue.AddString(L"VARIANT_FALSE");
          }

          wszBuffer[0] = EOL;
          m_listviewProps.GetItemText(iSelRow, PROP_VALUE, wszBuffer, MAX_NAME_LEN);
          INDEX iIndex = m_comboValue.SetSelText(wszBuffer, TRUE/*fAddItem*/);

          //Now select the item
          m_comboValue.SetCurSel(iIndex);

          //InsertOptions
//          m_comboOptions.SetItemParam(0, iSelRow);
          m_comboOptions.SetSelText(pPropInfo->dwFlags & DBPROPFLAGS_REQUIRED ? L"REQUIRED" : L"OPTIONAL");
        }

        //Keep track of which row the data belongs to...
        m_comboOptions.SetItemParam(0, iSelRow);

        //Enable Combos
        m_editDesc.EnableWindow(pPropInfo && m_eMethodType == METHOD_SETPROPERTIES);
        m_comboType.EnableWindow(pPropInfo && m_eMethodType == METHOD_SETPROPERTIES);
        m_comboValue.EnableWindow(pPropInfo && m_eMethodType == METHOD_SETPROPERTIES);
        m_comboOptions.EnableWindow(pPropInfo && m_eMethodType == METHOD_SETPROPERTIES);
        return FALSE; //Allow the change
      }
    }
  }

  return FALSE;
}

BOOL CPropertiesDlg::OnOK ( ) [virtual]

Definition at line 2814 of file cdialog.cpp.

{
  CWaitCursor waitCursor;
  HRESULT hr = S_OK;

  //Send a selection change message to the Value Combo
  if(m_eMethodType == METHOD_SETPROPERTIES)
    OnPropValueChange();
  CPropSets sCPropSets;
  CPropIDSets sCPropIDSets;

  //Now that the user has selected all the properties
  //they wish to have set, we need to loop through all the checked
  //properties and add them to our list...
  INDEX cItems = m_listviewProps.GetItemCount();
  for(LONG i=0; i<cItems; i++)
  {
    //Only interested in checked items
    BOOL bChecked = m_listviewProps.GetItemState(i, LVIS_STATEIMAGEMASK) & INDEXTOSTATEIMAGEMASK(STATE_CHECKED);
    if(!bChecked)
      continue;

    //Only interested in actual items, (not headers or spaces)
    DBPROPINFOSET* pPropInfoSet = NULL;
    DBPROPINFO* pPropInfo = GetSelPropInfo(i, &pPropInfoSet);
    if(!pPropInfo || !pPropInfoSet)
      continue;

    if(m_eMethodType == METHOD_SETPROPERTIES)
    {
      //Now we have a real checked item so add it to our propset
      sCPropSets.SetProperty(pPropInfo->dwPropertyID, pPropInfoSet->guidPropertySet, DBTYPE_VARIANT, &pPropInfo->vValues, pPropInfo->dwFlags & DBPROPFLAGS_REQUIRED ? DBPROPOPTIONS_REQUIRED : DBPROPOPTIONS_OPTIONAL);
    }
    else
    {
      //Add the PropertyID
      sCPropIDSets.SetProperty(pPropInfo->dwPropertyID, pPropInfoSet->guidPropertySet);
    }
  }

  if(m_eMethodType == METHOD_SETPROPERTIES)
  {
    //Either just save the properties back in the propset provided
    if(m_pCPropSets)
    {
      m_pCPropSets->Attach(sCPropSets);
    }
    //Or actually set the properties...
    else
    {
      //Now actually set the Properties
      TESTC(hr = SetProperties(sCPropSets.GetCount(), sCPropSets.GetPropSets()));
    }
  }
  else
  {
    //Don't end the Dialog, (if the user has selected properties)
    //just recall GetProperties with those selected properties.  A good way to test
    //a provider on a sub set of properties, rather than always calling with (0, NULL)
    if(sCPropIDSets.GetCount())
    {
      TESTC(hr = DisplayProperties(sCPropIDSets.GetCount(), sCPropIDSets.GetPropSets()));
      return FALSE;
    }
  }

CLEANUP:
  //Don't end the  Dialog on Error...
  if(FAILED(hr))
    return FALSE;

  //Free Saved State...
  FreeProperties(&m_cPropInfoSets, &m_rgPropInfoSets);
  SAFE_FREE(m_pStringBuffer);

  //Delegate
  return CDialogLite::OnOK();
}

BOOL CPropertiesDlg::OnPropOptionsChange ( ) [virtual]

Definition at line 3378 of file cdialog.cpp.

{
  //Obtain the selected propery
  INDEX iSelRow = m_comboOptions.GetItemParam(0);
  DBPROPINFO* pPropInfo = GetSelPropInfo(iSelRow);
  if(pPropInfo)
  {
    //Get the new selection
    //TODO64: DBPROPFLAGS is not extended for 64bit?
    ENABLE_BIT(pPropInfo->dwFlags, DBPROPFLAGS_REQUIRED, m_comboOptions.GetCurSel()==DBPROPOPTIONS_REQUIRED);

    //Display the new selection
    m_listviewProps.SetItemText(iSelRow, PROP_FLAGS, pPropInfo->dwFlags & DBPROPFLAGS_REQUIRED ? L"REQUIRED" : L"OPTIONAL");

    //Automatically check this property, since the user
    //changed the Options they probably want to set it...
    m_listviewProps.SetItemState(iSelRow, 0,  INDEXTOSTATEIMAGEMASK(STATE_CHECKED),  LVIS_STATEIMAGEMASK);
  }

  return TRUE;
}

BOOL CPropertiesDlg::OnPropSetChange ( ) [virtual]

Definition at line 3763 of file cdialog.cpp.

{
  CWaitCursor waitCursor;

  //Get new selection
  INDEX iIndex = m_comboPropSet.GetItemParam(m_comboPropSet.GetCurSel());

  GUID guidPropertySet = IID_NULL;
  if(iIndex != CB_ERR && iIndex<(INDEX)g_cPropSetMaps)
    guidPropertySet = *(g_rgPropSetMaps[iIndex].pGuid);

  //Display properties for just this set...
  const ULONG cPropertyIDSets = 1;
  DBPROPIDSET rgPropertyIDSets[cPropertyIDSets];
  rgPropertyIDSets[0].cPropertyIDs = 0;
  rgPropertyIDSets[0].rgPropertyIDs = NULL;
  rgPropertyIDSets[0].guidPropertySet = guidPropertySet;

  //Display the SetProperties (again - this  time all of them)
  DisplayProperties(iIndex==CB_ERR ? 0 : cPropertyIDSets, rgPropertyIDSets);

  //Disable Combos
  m_editDesc.EnableWindow(FALSE);
  m_comboOptions.EnableWindow(FALSE);
  m_comboType.EnableWindow(FALSE);
  m_comboValue.EnableWindow(FALSE);
  return TRUE;
}

BOOL CPropertiesDlg::OnPropTypeChange ( ) [virtual]

Definition at line 3405 of file cdialog.cpp.

{
  //Obtain the selected propery
  INDEX iSelRow = m_comboOptions.GetItemParam(0);
  DBPROPINFO* pPropInfo = GetSelPropInfo(iSelRow);
  if(pPropInfo)
  {

    //Get new selection
    INDEX iSel = m_comboType.GetCurSel();
    pPropInfo->vtType = (DBTYPE)m_comboType.GetItemParam(iSel);
    m_listviewProps.SetItemText(iSelRow, PROP_TYPE, GetVariantTypeName(pPropInfo->vtType));

    switch(pPropInfo->vtType)
    {
      case VT_BOOL:
        m_comboValue.SetSelText(L"VARIANT_FALSE", TRUE/*fAddItem*/);
        m_comboValue.SetSelText(L"VARIANT_TRUE", TRUE/*fAddItem*/);
        break;

      case VT_EMPTY:
      case VT_NULL:
        m_comboValue.ResetContent();
        m_comboValue.SetSelText(L"", TRUE/*fAddItem*/);
        break;
    };

    //Send a selection change message to the Value Combo
    OnPropValueChange();

    //Automatically check this property, since the user
    //changed the Type they probably want to set it...
    m_listviewProps.SetItemState(iSelRow, 0,  INDEXTOSTATEIMAGEMASK(STATE_CHECKED),  LVIS_STATEIMAGEMASK);
  }

  return TRUE;
}

BOOL CPropertiesDlg::OnPropValueChange ( ) [virtual]

Definition at line 3448 of file cdialog.cpp.

{
  //Obtain the selected propery
  INDEX iSelRow = m_comboOptions.GetItemParam(0);
  DBPROPINFO* pPropInfo = GetSelPropInfo(iSelRow);
  if(pPropInfo)
  {
    WCHAR wszBuffer[MAX_NAME_LEN+1] = {0};
    WCHAR wszPrevValue[MAX_NAME_LEN+1] = {0};

    //Get new selection
    m_comboValue.GetSelText(wszBuffer, MAX_NAME_LEN);

    //Verify Value
    XTEST(VariantClearFast(&pPropInfo->vValues));
    if(FAILED(StringToVariant(wszBuffer, (DBTYPE)pPropInfo->vtType, &pPropInfo->vValues)))
    {
      wMessageBox(GetFocus(), MB_TASKMODAL | MB_ICONERROR | MB_OK | MB_DEFBUTTON1,
        wsz_ERROR, L"Unable to create Variant for type=%s, value=\"%s\"", GetVariantTypeName(pPropInfo->vtType), wszBuffer);
      m_comboValue.SetFocus();
      return TRUE; //Don't Allow the Change
    }

    //NOTE: We convert again here, in case the user entered
    //some "alias" name for the value.  IE: True and we actually allow this
    //but display in the view as VARIANT_TRUE...
    VariantToString(&pPropInfo->vValues, wszBuffer, MAX_NAME_LEN, CONV_VARBOOL);

    //Automatically check this property, since the user
    //changed the Value they probably want to set it...
    //NOTE: We only do it if the value has changed...
    m_listviewProps.GetItemText(iSelRow, PROP_VALUE, wszPrevValue, MAX_NAME_LEN);
    if(!StringCompare(wszBuffer, wszPrevValue))
    {
      m_listviewProps.SetItemState(iSelRow, 0,  INDEXTOSTATEIMAGEMASK(STATE_CHECKED),  LVIS_STATEIMAGEMASK);
      m_listviewProps.SetItemText(iSelRow, PROP_VALUE, wszBuffer);
    }
  }

  return TRUE;
}

BOOL CPropertiesDlg::OnSelChange | ( | INT | iID,
 |  | HWND | hWndCtrl |
 | ) |  |  | [virtual]

Definition at line 3515 of file cdialog.cpp.

{
  switch(iID)
  {
    case IDC_PROPEDIT_VALUE:
      return OnPropValueChange();

    case IDC_PROPEDIT_TYPE:
      return OnPropTypeChange();

    case IDC_PROPEDIT_OPTIONS:
      return OnPropOptionsChange();

    case IDC_PROPSET:
      return OnPropSetChange();
  };

  return FALSE;
}

HRESULT CPropertiesDlg::SetProperties | ( | ULONG | cPropSets,
 |  | DBPROPSET * | rgPropSets
 | ) |  |

Definition at line 3216 of file cdialog.cpp.

{
  HRESULT hr = S_OK;

  if(m_pIUnkProperties)
  {
    IID iidProp = m_iidProp;

    //Now actually set the Properties
    if(iidProp == IID_IDBProperties)
    {
      XTEST_(hr = ((IDBProperties*)m_pIUnkProperties)->SetProperties(cPropSets, rgPropSets),S_OK);
      TRACE_METHOD(hr, L"IDBProperties::SetProperties(%d, 0x%p)", cPropSets, rgPropSets);
    }
    else if(iidProp == IID_IDBDataSourceAdmin)
    {
      XTEST_(hr = ((IDBDataSourceAdmin*)m_pIUnkProperties)->ModifyDataSource(cPropSets, rgPropSets),S_OK);
      TRACE_METHOD(hr, L"IDBDataSourceAdmin::ModifyDataSource(%d, 0x%p)", cPropSets, rgPropSets);
    }
    else if(iidProp == IID_ISessionProperties)
    {
      XTEST_(hr = ((ISessionProperties*)m_pIUnkProperties)->SetProperties(cPropSets, rgPropSets),S_OK);
      TRACE_METHOD(hr, L"ISessionProperties::SetProperties(%d, 0x%p)", cPropSets, rgPropSets);
    }
    else if(iidProp == IID_ICommandProperties)
    {
      XTEST_(hr = ((ICommandProperties*)m_pIUnkProperties)->SetProperties(cPropSets, rgPropSets),S_OK);
      TRACE_METHOD(hr, L"ICommandProperties::SetProperties(%d, 0x%p)", cPropSets, rgPropSets);
    }
    else
    {
      ASSERT(!"Unhandled Property Source");
    }

    //Display Any Property Errors...
    hr = DisplayPropErrors(hr, cPropSets, rgPropSets);
  }

  return hr;
}

HRESULT CPropertiesDlg::SetProperties | ( | HWND | hWndParent,
 |  | const GUID * | pGuidPropertySet,
 |  | REFIID | riidProp,
 |  | IUnknown * | pIUnkProperties,
 |  | IDBProperties * | pIDBPropertyInfo,
 |  | CPropSets * | pCPropSets = NULL,
 |  | IDBDataSourceAdmin * | pIDBDataSourceAdmin = NULL
 | ) |  |

Definition at line 2581 of file cdialog.cpp.

{
//  NOTE: We can have valid causes where there is not properties interface passed in.
//  When OpenRowset is called there is no method to obtain current property values, other than the
//  passed in pcPropSets, which also may be empty is no properties are set...
//  ASSERT(pIUnkProperties);

  //Setup variable for StaticProcs to use...
  m_iidProp       = riidProp;
  m_pGuidPropertySet    = pGuidPropertySet;

  m_pIUnkProperties   = pIUnkProperties;
  m_pIDBPropertyInfo    = pIDBPropertyInfo;
  m_pIDBDataSourceAdmin = pIDBDataSourceAdmin;

  m_pCPropSets      = pCPropSets;
  m_eMethodType     = METHOD_SETPROPERTIES;

  //Now Display the dialog
  if(DoModal(hWndParent) == IDOK)
    return S_OK;

  return DB_E_CANCELED;
}

Member Data Documentation

BOOL CPropertiesDlg::m_bClearAll

Definition at line 295 of file cdialog.h.

CComboBoxLite CPropertiesDlg::m_comboOptions

Definition at line 286 of file cdialog.h.

CComboBoxLite CPropertiesDlg::m_comboPropSet

Definition at line 285 of file cdialog.h.

CComboBoxLite CPropertiesDlg::m_comboType

Definition at line 287 of file cdialog.h.

CComboBoxLite CPropertiesDlg::m_comboValue

Definition at line 288 of file cdialog.h.

ULONG CPropertiesDlg::m_cPropInfoSets

Definition at line 292 of file cdialog.h.

CEditBoxLite CPropertiesDlg::m_editDesc

Definition at line 289 of file cdialog.h.

METHOD_TYPE CPropertiesDlg::m_eMethodType

Definition at line 305 of file cdialog.h.

IID CPropertiesDlg::m_iidProp

Definition at line 274 of file cdialog.h.

CListViewLite CPropertiesDlg::m_listviewProps

Definition at line 284 of file cdialog.h.

CPropSets* CPropertiesDlg::m_pCPropSets

Definition at line 281 of file cdialog.h.

const GUID* CPropertiesDlg::m_pGuidPropertySet

Definition at line 275 of file cdialog.h.

IDBDataSourceAdmin* CPropertiesDlg::m_pIDBDataSourceAdmin

Definition at line 279 of file cdialog.h.

IDBProperties* CPropertiesDlg::m_pIDBPropertyInfo

Definition at line 278 of file cdialog.h.

IUnknown* CPropertiesDlg::m_pIUnkProperties

Definition at line 277 of file cdialog.h.

WCHAR* CPropertiesDlg::m_pStringBuffer

Definition at line 294 of file cdialog.h.

DBPROPINFOSET* CPropertiesDlg::m_rgPropInfoSets

Definition at line 293 of file cdialog.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialog.h
  • Dataaccess/oledb/rowsetviewer/cdialog.cpp
Generated on Wed Nov 13 2024 16:57:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPropertyEditSession Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CPropertyEditSession Class Reference

Inherits CEditSessionBase.

List of all members.

Public Member Functions

CPropertyEditSession (CMarkTextService *pMark, ITfContext *pContext, ULONG ulCallback)
~CPropertyEditSession ()
STDMETHODIMP DoEditSession (TfEditCookie ec)

Private Attributes

CMarkTextService * _pMark
ULONG _ulCallback

Detailed Description

Definition at line 20 of file property.cpp.

Constructor & Destructor Documentation

CPropertyEditSession::CPropertyEditSession | ( | CMarkTextService * | pMark,
 |  | ITfContext * | pContext,
 |  | ULONG | ulCallback |
 | ) |  |  | [inline]

Definition at line 23 of file property.cpp.

                                                                                : CEditSessionBase(pContext)
    {
        _pMark = pMark;
        _pMark->AddRef();
        _ulCallback = ulCallback;
    }

CPropertyEditSession::~CPropertyEditSession ( ) [inline]

Definition at line 29 of file property.cpp.

    {
        _pMark->Release();
    }

Member Function Documentation

STDMETHODIMP CPropertyEditSession::DoEditSession ( TfEditCookie ec ) [inline, virtual]

Implements CEditSessionBase.

Definition at line 35 of file property.cpp.

    {
        switch (_ulCallback)
        {
            case VIEW_CASE_PROPERTY:
                _pMark->_ViewCaseProperty(ec, _pContext);
                break;
            case SET_CASE_PROPERTY:
                _pMark->_SetCaseProperty(ec, _pContext);
                break;
            case VIEW_CUSTOM_PROPERTY:
                _pMark->_ViewCustomProperty(ec, _pContext);
                break;
            case SET_CUSTOM_PROPERTY:
                _pMark->_SetCustomProperty(ec, _pContext);
                break;
        }
        return S_OK;
    }

Member Data Documentation

CMarkTextService* CPropertyEditSession::_pMark [private]

Definition at line 56 of file property.cpp.

ULONG CPropertyEditSession::_ulCallback [private]

Definition at line 57 of file property.cpp.

The documentation for this class was generated from the following file:
  • WinUI/TSFmark/property.cpp
Generated on Wed Nov 13 2024 16:57:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPropertyIDs Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CPropertyIDs Class Reference

#include "property.h"

Inherits TPropBase< DBPROPID >.

List of all members.

Public Member Functions

CPropertyIDs (DBPROPIDSET *pPropSet=NULL)
virtual | ~CPropertyIDs ()
virtual void | Attach (DBPROPIDSET *pPropSet)
virtual void | Detach (DBPROPIDSET *pPropSet)
virtual DBPROPID * | FindProperty (DBPROPID dwPropertyID, const DBID &colid)
virtual HRESULT | SetProperty (DBPROPID dwPropertyID)

Detailed Description

Definition at line 107 of file property.h.

Constructor & Destructor Documentation

CPropertyIDs::CPropertyIDs ( DBPROPIDSET * pPropSet = NULL )

Definition at line 281 of file property.cpp.

{
  Attach(pPropSet);
}

CPropertyIDs::~CPropertyIDs ( ) [virtual]

Definition at line 290 of file property.cpp.

{
}

Member Function Documentation

void CPropertyIDs::Attach ( DBPROPIDSET * pPropSet ) [virtual]

Definition at line 299 of file property.cpp.

{
  //Delegate
  if(pPropSet)
    CVector<DBPROPID>::Attach(pPropSet->cPropertyIDs, pPropSet->rgPropertyIDs);
}

void CPropertyIDs::Detach ( DBPROPIDSET * pPropSet ) [virtual]

Definition at line 311 of file property.cpp.

{
  //Delegate
  CVector<DBPROPID>::Detach(&pPropSet->cPropertyIDs, &pPropSet->rgPropertyIDs);
}

DBPROPID * CPropertyIDs::FindProperty | ( | DBPROPID | dwPropertyID,
 |  | const DBID & | colid |
 | ) |  |  | [virtual]

Implements TPropBase< DBPROPID >.

Definition at line 322 of file property.cpp.

{
  //Loop over the array of properties in this set
  for(ULONG iProp=0; iProp<m_cElements; iProp++)
  {
    DBPROPID* pPropID = &m_rgElements[iProp];
    if(*pPropID == dwPropertyID)
      return pPropID;
  }

  return NULL;
}

HRESULT CPropertyIDs::SetProperty ( DBPROPID dwPropertyID ) [virtual]

Definition at line 340 of file property.cpp.

{
  HRESULT hr = S_OK;

  //Add this property (if it doesn't already exist)
  DBPROPID* pPropID = AddProperty(dwPropertyID, DB_NULLID);
  if(!pPropID)
    TESTC(hr = E_OUTOFMEMORY);

  //Setup the value
  *pPropID = dwPropertyID;

CLEANUP:
  return hr;
}

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/property.h
  • Dataaccess/oledb/rowsetviewer/property.cpp
Generated on Wed Nov 13 2024 16:57:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPropertyInfos Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CPropertyInfos Class Reference

#include "property.h"

Inherits TPropBase< DBPROPINFO >.

List of all members.

Public Member Functions

CPropertyInfos (DBPROPINFOSET *pPropInfoSet=NULL)
virtual | ~CPropertyInfos ()
virtual void | Attach (DBPROPINFOSET *pPropSet)
virtual void | Detach (DBPROPINFOSET *pPropSet)
virtual DBPROPINFO * | FindProperty (DBPROPID dwPropertyID, const DBID &colid)
virtual void | RemoveAll ()

Detailed Description

Definition at line 80 of file property.h.

Constructor & Destructor Documentation

CPropertyInfos::CPropertyInfos ( DBPROPINFOSET * pPropInfoSet = NULL )

Definition at line 205 of file property.cpp.

{
  Attach(pPropSet);
}

CPropertyInfos::~CPropertyInfos ( ) [virtual]

Definition at line 214 of file property.cpp.

{
}

Member Function Documentation

void CPropertyInfos::Attach ( DBPROPINFOSET * pPropSet ) [virtual]

Definition at line 223 of file property.cpp.

{
  //Delegate
  if(pPropSet)
    CVector<DBPROPINFO>::Attach(pPropSet->cPropertyInfos, pPropSet->rgPropertyInfos);
}

void CPropertyInfos::Detach ( DBPROPINFOSET * pPropSet ) [virtual]

Definition at line 235 of file property.cpp.

{
  //Delegate
  CVector<DBPROPINFO>::Detach(&pPropSet->cPropertyInfos, &pPropSet->rgPropertyInfos);
}

DBPROPINFO * CPropertyInfos::FindProperty | ( | DBPROPID | dwPropertyID,
 |  | const DBID & | colid |
 | ) |  |  | [virtual]

Implements TPropBase< DBPROPINFO >.

Definition at line 261 of file property.cpp.

{
  //Loop over the array of properties in this set
  for(ULONG iPropInfo=0; iPropInfo<m_cElements; iPropInfo++)
  {
    DBPROPINFO* pPropInfo = &m_rgElements[iPropInfo];
    if(pPropInfo->dwPropertyID == dwPropertyID)
      return pPropInfo;
  }

  return NULL;
}

void CPropertyInfos::RemoveAll ( ) [virtual]

Reimplemented from CVector< DBPROPINFO >.

Definition at line 246 of file property.cpp.

{
  //We need to walk and free out-of-line data...
  for(ULONG iProp=0; iProp<m_cElements; iProp++)
    VariantClearFast(&m_rgElements[iProp].vValues);

  //Delegate
  CVector<DBPROPINFO>::RemoveAll();
}

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/property.h
  • Dataaccess/oledb/rowsetviewer/property.cpp
Generated on Wed Nov 13 2024 16:57:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPropertyPage Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes

CPropertyPage Class Reference

#include "datasrc.h"

Inherited by CBasePropertyPage, CBasePropertyPage, CDSLAdvancedPage, CDSLConnectionPage, CExtPageUser, CProppageUserUI, CSCPPageBindingInfo, CSCPPageGeneral, CSCPPageKeywords, CSCPUIBindingInfo, CSCPUIGeneral, and CSCPUIKeywords.

List of all members.

Public Member Functions

CPropertyPage (REFCLSID clsid, INT iDialogID)
virtual | ~CPropertyPage ()
STDMETHODIMP | Activate (HWND hWndParent, LPCRECT pRect, BOOL bModal)
STDMETHODIMP | Apply ()
STDMETHODIMP | Deactivate ()
STDMETHODIMP | GetClassID (CLSID __RPC_FAR *pClassID)
virtual STDMETHODIMP | GetPageInfo (PROPPAGEINFO __RPC_FAR *pPageInfo)
virtual BOOL | HandleMessage (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
STDMETHODIMP | Help (LPCOLESTR pszHelpDir)
STDMETHODIMP | InitNew (void)
STDMETHODIMP | IsPageDirty ()
STDMETHODIMP | Load (IPropertyBag __RPC_FAR *pPropBag, IErrorLog __RPC_FAR *pErrorLog)
STDMETHODIMP | Move (LPCRECT pRect)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | Save (IPropertyBag __RPC_FAR *pPropBag, BOOL fClearDirty, BOOL fSaveAllProperties)
STDMETHODIMP | SetObjects (ULONG cObjects, IUnknown __RPC_FAR *__RPC_FAR *ppUnk)
STDMETHODIMP | SetPageSite (IPropertyPageSite *pPageSite)
STDMETHODIMP | Show (UINT nCmdShow)
STDMETHODIMP | TranslateAccelerator (MSG *pMsg)

Static Public Member Functions

static INT_PTR WINAPI | DialogProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)

Public Attributes

DEFINE_ADDREF_RELEASE

Protected Attributes

CLSID m_clsid
ULONG m_cRef
HWND | m_hWnd
INT | m_iDialogID
IPropertyPageSite * | m_pIPropertyPageSite

Detailed Description

Definition at line 326 of file datasrc.h.

Constructor & Destructor Documentation

CPropertyPage::CPropertyPage | ( | REFCLSID | clsid,
 |  | INT | iDialogID
 | ) |  |

Definition at line 350 of file datasrc.cpp.

{
  m_cRef    = 0;
  m_clsid   = clsid;
  m_iDialogID = iDialogID;
  m_hWnd    = NULL;

  m_pIPropertyPageSite = NULL;
}

CPropertyPage::~CPropertyPage ( ) [virtual]

Definition at line 364 of file datasrc.cpp.

{
  SAFE_RELEASE(m_pIPropertyPageSite);
}

Member Function Documentation

STDMETHODIMP CPropertyPage::Activate | ( | HWND | hWndParent,
 |  | LPCRECT | pRect,
 |  | BOOL | bModal
 | ) |  |

Definition at line 418 of file datasrc.cpp.

{
  //Create a modeless dialog...
  m_hWnd = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(m_iDialogID), hWndParent, DialogProc, (LPARAM)this);
  if(m_hWnd)
  {
    return Move(pRect);
  }

  return E_FAIL;
}

STDMETHODIMP CPropertyPage::Apply ( void )

Definition at line 483 of file datasrc.cpp.

{
  return S_OK;
}

STDMETHODIMP CPropertyPage::Deactivate ( void )

Definition at line 439 of file datasrc.cpp.

{
  if(m_hWnd)
  {
    DestroyWindow(m_hWnd);
    m_hWnd = NULL;
  }

  return S_OK;
}

INT_PTR CALLBACK CPropertyPage::DialogProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 516 of file datasrc.cpp.

{
  switch(message)
  {
    case WM_INITDIALOG:
    {
      //Save the "this" pointer
      SetWindowLongPtr(hWnd, GWLP_USERDATA, lParam);
      return 0;
    }

    case WM_COMMAND:
    {
      //Get the "this" pointer
      CPropertyPage* pThis = (CPropertyPage*)GetWindowLongPtr(hWnd, GWLP_USERDATA);
      return pThis->HandleMessage(hWnd, message, wParam, lParam);
    }
  }

  return 0;
}

STDMETHODIMP CPropertyPage::GetClassID ( CLSID __RPC_FAR * pClassID ) [inline]

Definition at line 403 of file datasrc.h.

    {
      if(!pClassID)
        return E_INVALIDARG;

      *pClassID = m_clsid;
      return S_OK;
    }

virtual STDMETHODIMP CPropertyPage::GetPageInfo ( PROPPAGEINFO __RPC_FAR * pPageInfo ) [inline, virtual]

Definition at line 353 of file datasrc.h.

    {
      ASSERT(pPageInfo);
      ASSERT(pPageInfo->cb == sizeof(PROPPAGEINFO));
      memset(pPageInfo, 0, sizeof(PROPPAGEINFO));
      return S_OK;
    }

BOOL CPropertyPage::HandleMessage | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [virtual]

Reimplemented in CDSLConnectionPage, and CDSLAdvancedPage.

Definition at line 542 of file datasrc.cpp.

{
  return FALSE;
}

STDMETHODIMP CPropertyPage::Help ( LPCOLESTR pszHelpDir ) [inline]

Definition at line 374 of file datasrc.h.

    {
      return E_NOTIMPL;
    }

STDMETHODIMP CPropertyPage::InitNew ( void ) [inline]

Definition at line 383 of file datasrc.h.

    {
      return E_NOTIMPL;
    }

STDMETHODIMP CPropertyPage::IsPageDirty ( )

Definition at line 471 of file datasrc.cpp.

{
  //Out page is always dirty since we don't want to go through the overhead of
  //determining if the user used any of the controls on the page, S_OK = Dirty...
  return S_OK;
}

STDMETHODIMP CPropertyPage::Load | ( | IPropertyBag __RPC_FAR * | pPropBag,
 |  | IErrorLog __RPC_FAR * | pErrorLog |
 | ) |  |  | [inline]

Reimplemented in CDSLConnectionPage.

Definition at line 388 of file datasrc.h.

    {
      return S_OK;
    }

STDMETHODIMP CPropertyPage::Move ( LPCRECT pRect )

Definition at line 504 of file datasrc.cpp.

{
  ASSERT(pRect);
  MoveWindow(m_hWnd, pRect->left, pRect->top, pRect->right - pRect->left,  pRect->bottom - pRect->top, TRUE);
  return S_OK;
}

STDMETHODIMP CPropertyPage::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 373 of file datasrc.cpp.

{
  if(!ppv)
    return E_INVALIDARG;

  if(riid == IID_IUnknown)
    *ppv = (IUnknown*)(IPropertyPage*)this;
  else if(riid == IID_IPropertyPage)
    *ppv = (IPropertyPage*)this;
  else if(riid == IID_IPersistPropertyBag)
    *ppv = (IPersistPropertyBag*)this;
  else
  {
    *ppv = NULL;
    return E_NOINTERFACE;
  }

  SAFE_ADDREF(*ppv);
  return S_OK;
}

STDMETHODIMP CPropertyPage::Save | ( | IPropertyBag __RPC_FAR * | pPropBag,
 |  | BOOL | fClearDirty,
 |  | BOOL | fSaveAllProperties |
 | ) |  |  | [inline]

Reimplemented in CDSLConnectionPage.

Definition at line 395 of file datasrc.h.

    {
      return E_NOTIMPL;
    }

STDMETHODIMP CPropertyPage::SetObjects | ( | ULONG | cObjects,
 |  | IUnknown __RPC_FAR *__RPC_FAR * | ppUnk |
 | ) |  |  | [inline]

Definition at line 362 of file datasrc.h.

    {
      return E_NOTIMPL;
    }

STDMETHODIMP CPropertyPage::SetPageSite ( IPropertyPageSite * pPageSite )

Definition at line 398 of file datasrc.cpp.

{
  //SetPageSite can call with NULL to indicate to release interface.
  if(!pPageSite)
  {
    SAFE_RELEASE(m_pIPropertyPageSite);
    return S_OK;
  }

  //Otherwise...
  ASSERT(m_pIPropertyPageSite == NULL);
  return pPageSite->QueryInterface(IID_IPropertyPageSite, (void**)&m_pIPropertyPageSite);
}

STDMETHODIMP CPropertyPage::Show ( UINT nCmdShow )

Definition at line 493 of file datasrc.cpp.

{
  ShowWindow(m_hWnd, nCmdShow);
  return S_OK;
}

STDMETHODIMP CPropertyPage::TranslateAccelerator ( MSG * pMsg )

Definition at line 455 of file datasrc.cpp.

{
  ASSERT(pMsg);

  if((pMsg->message < WM_KEYFIRST || pMsg->message > WM_KEYLAST) &&
    (pMsg->message < WM_MOUSEFIRST || pMsg->message > WM_MOUSELAST))
    return S_FALSE;

  return IsDialogMessage(m_hWnd, pMsg) ? S_OK : S_FALSE;
}

Member Data Documentation

CPropertyPage::DEFINE_ADDREF_RELEASE

Definition at line 345 of file datasrc.h.

CLSID CPropertyPage::m_clsid [protected]

Definition at line 330 of file datasrc.h.

ULONG CPropertyPage::m_cRef [protected]

Definition at line 329 of file datasrc.h.

HWND CPropertyPage::m_hWnd [protected]

Definition at line 332 of file datasrc.h.

INT CPropertyPage::m_iDialogID [protected]

Definition at line 331 of file datasrc.h.

IPropertyPageSite* CPropertyPage::m_pIPropertyPageSite [protected]

Definition at line 334 of file datasrc.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/sampprov/datasrc.h
  • Dataaccess/oledb/sampprov/datasrc.cpp
Generated on Wed Nov 13 2024 16:57:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPropertyTag Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Protected Attributes

CPropertyTag Class Reference

#include "PropTag.Hxx"

Inherits CHtmlElement.

Inherited by CTitleTag.

List of all members.

Public Member Functions

CPropertyTag (CHtmlIFilter &htmlIFilter, CSerialStream &serialStream, CFullPropSpec &propSpec, HtmlTokenType eTokType)
~CPropertyTag ()
virtual SCODE | GetChunk (STAT_CHUNK *pStat)
virtual SCODE | GetText (ULONG *pcwcOutput, WCHAR *awcBuffer)
virtual void | InitStatChunk (STAT_CHUNK *pStat)

Protected Member Functions

void | ConcatenateProperty (WCHAR *awcPropSuffix, unsigned uLen)

Protected Attributes

unsigned | _cPropChars
unsigned | _cPropCharsFiltered
PropTagState _eState
HtmlTokenType _eTokType
CFullPropSpec _propSpec
WCHAR * | _pwcPropBuf
unsigned | _uLenPropBuf
ULONG _ulIdContentChunk

Detailed Description

Definition at line 39 of file PropTag.Hxx.

Constructor & Destructor Documentation

CPropertyTag::CPropertyTag | ( | CHtmlIFilter & | htmlIFilter,
 |  | CSerialStream & | serialStream,
 |  | CFullPropSpec & | propSpec,
 |  | HtmlTokenType | eTokType
 | ) |  |

Definition at line 33 of file PropTag.Cxx.

    : CHtmlElement(htmlIFilter, serialStream),
      _eState(NoMoreProperty),
      _ulIdContentChunk(0),
      _pwcPropBuf(0),
      _uLenPropBuf(0),
      _cPropChars(0),
      _cPropCharsFiltered(0),
      _propSpec(propSpec),
      _eTokType(eTokType)
{
}

CPropertyTag::~CPropertyTag ( )

Definition at line 59 of file PropTag.Cxx.

{
    delete[] _pwcPropBuf;
}

Member Function Documentation

void CPropertyTag::ConcatenateProperty | ( | WCHAR * | awcPropSuffix,
 |  | unsigned | uLen |
 | ) |  |  | [protected]

Definition at line 338 of file PropTag.Cxx.

{
    //
    // Need to grow Property buffer ?
    //
    if ( _cPropChars + uLen > _uLenPropBuf )
    {
        WCHAR *pwcNewPropBuf = newk(mtNewX, NULL) WCHAR[_cPropChars + uLen + PROP_BUFFER_SLOP];
        RtlCopyMemory( pwcNewPropBuf, _pwcPropBuf, _cPropChars * sizeof(WCHAR) );

        delete[] _pwcPropBuf;
        _uLenPropBuf = _cPropChars + uLen + PROP_BUFFER_SLOP;

        _pwcPropBuf = pwcNewPropBuf;
    }

    RtlCopyMemory( _pwcPropBuf + _cPropChars, awcPropSuffix, uLen * sizeof(WCHAR) );
    _cPropChars += uLen;
}

SCODE CPropertyTag::GetChunk ( STAT_CHUNK * pStat ) [virtual]

Implements CHtmlElement.

Reimplemented in CTitleTag.

Definition at line 77 of file PropTag.Cxx.

{
    switch ( _eState )
    {
    case FilteringContent:
    case FilteringProperty:
    case FilteringPropertyButContentNotFiltered:
    {
        SCODE sc = SkipRemainingTextAndGotoNextChunk( pStat );

        return sc;
    }

    case NoMoreContent:
        _eState = FilteringProperty;

        pStat->idChunk = _htmlIFilter.GetNextChunkId();
        pStat->locale = _htmlIFilter.GetLocale();
        pStat->cwcStartSource = 0;
        pStat->cwcLenSource = 0;
        pStat->flags = CHUNK_TEXT;
        pStat->attribute.guidPropSet = _propSpec.GetPropSet();

        Win4Assert( _propSpec.IsPropertyPropid() );

        pStat->attribute.psProperty.ulKind = PRSPEC_PROPID;
        pStat->attribute.psProperty.propid = _propSpec.GetPropertyPropid();
        pStat->idChunkSource = _ulIdContentChunk;
        pStat->breakType = CHUNK_EOS;

        break;

    case NoMoreProperty:
    {
        //
        // Skip over the end property tag
        //
        _scanner.EatTag();

        SCODE sc = SwitchToNextHtmlElement( pStat );

        return sc;
    }

    default:
        Win4Assert( !"Unknown _eState in CPropertyTag::GetChunk" );
        htmlDebugOut(( DEB_ERROR, "CPropertyTag::GetChunk, unkown property tag state: %d\n", _eState ));
    }

    return S_OK;
}

SCODE CPropertyTag::GetText | ( | ULONG * | pcwcOutput,
 |  | WCHAR * | awcBuffer |
 | ) |  |  | [virtual]

Implements CHtmlElement.

Reimplemented in CTitleTag.

Definition at line 142 of file PropTag.Cxx.

{
    switch ( _eState )
    {
    case NoMoreContent:
    case NoMoreProperty:
         return FILTER_E_NO_MORE_TEXT;

    case FilteringContent:
    case FilteringPropertyButContentNotFiltered:
    {
        ULONG cCharsRead = 0;
        while ( cCharsRead < *pcwcOutput )
        {
            ULONG cCharsScanned;
            ULONG cCharsNeeded = *pcwcOutput - cCharsRead;
            CToken token;
            _scanner.GetBlockOfChars( cCharsNeeded,
                                      awcBuffer + cCharsRead,
                                      cCharsScanned,
                                      token );

            cCharsRead += cCharsScanned;
            if ( cCharsScanned == cCharsNeeded )
            {
                //
                // We've read the #chars requested by user
                //
                break;
            }

            HtmlTokenType eTokType = token.GetTokenType();
            if ( eTokType == EofToken || eTokType == _eTokType )
            {
                //
                // End of file or end property tag
                //
                if ( _eState == FilteringContent )
                    _eState = NoMoreContent;
                else
                    _eState = NoMoreProperty;

                break;
            }
            else if ( eTokType == BreakToken )
            {
                //
                // Insert a newline char
                //
                Win4Assert( cCharsRead < *pcwcOutput );
                awcBuffer[cCharsRead++] = L'\n';
                _scanner.EatTag();
            }
            else
            {
                //
                // Uninteresting tag, so skip over tag and continue processing
                //
                _scanner.EatTag();
            }
        }

        //
        // Keep a copy of property in our internal buffer
        //
        if ( cCharsRead > 0 )
            ConcatenateProperty( awcBuffer, cCharsRead );

        *pcwcOutput = cCharsRead;

        if ( _eState == NoMoreContent || _eState == NoMoreProperty )
            return FILTER_S_LAST_TEXT;
        else
            return S_OK;

        break;
    }

    case FilteringProperty:
    {
        ULONG cCharsRemaining = _cPropChars - _cPropCharsFiltered;

        if ( cCharsRemaining == 0 )
        {
            _eState = NoMoreProperty;
            return FILTER_E_NO_MORE_TEXT;
        }

        if ( *pcwcOutput < cCharsRemaining )
        {
            RtlCopyMemory( awcBuffer,
                           _pwcPropBuf + _cPropCharsFiltered,
                           *pcwcOutput * sizeof(WCHAR) );
            _cPropCharsFiltered += *pcwcOutput;

            return S_OK;
        }
        else
        {
            RtlCopyMemory( awcBuffer,
                           _pwcPropBuf + _cPropCharsFiltered,
                           cCharsRemaining * sizeof(WCHAR) );
            _cPropCharsFiltered += cCharsRemaining;
            *pcwcOutput = cCharsRemaining;
            _eState = NoMoreProperty;

            return FILTER_S_LAST_TEXT;
        }

        break;
    }

    default:
        Win4Assert( !"Unknown value of _eState" );
        htmlDebugOut(( DEB_ERROR,
                       "CPropertyTag::GetText, unknown value of _eState: %d\n",
                       _eState ));
        return S_OK;
    }
}

void CPropertyTag::InitStatChunk ( STAT_CHUNK * pStat ) [virtual]

Implements CHtmlElement.

Definition at line 276 of file PropTag.Cxx.

{
    //
    // Skip over the rest of property tag
    //
    _scanner.EatTag();

    _cPropChars = 0;
    _cPropCharsFiltered = 0;

    pStat->idChunk = _htmlIFilter.GetNextChunkId();
    pStat->flags = CHUNK_TEXT;
    pStat->breakType = CHUNK_EOS;
    pStat->locale = _htmlIFilter.GetLocale();
    pStat->cwcStartSource = 0;
    pStat->cwcLenSource = 0;

    if ( _htmlIFilter.FFilterContent() )
    {
        //
        // Store the idChunk so that it can be retrieved later to set the value of
        // idChunkSource when initializing the pseudo-property
        //
        _ulIdContentChunk = pStat->idChunk;
        pStat->attribute.guidPropSet = CLSID_Storage;
        pStat->attribute.psProperty.ulKind = PRSPEC_PROPID;
        pStat->attribute.psProperty.propid = PID_STG_CONTENTS;
        pStat->idChunkSource = pStat->idChunk;

        _eState = FilteringContent;
    }
    else
    {
        //
        // We've been asked to filter only the pseudo-property, so skip content filtering
        //
        _ulIdContentChunk = 0;
        pStat->attribute.guidPropSet = _propSpec.GetPropSet();

        Win4Assert( _propSpec.IsPropertyPropid() );

        pStat->attribute.psProperty.ulKind = PRSPEC_PROPID;
        pStat->attribute.psProperty.propid = _propSpec.GetPropertyPropid();
        pStat->idChunkSource = 0;

        _eState = FilteringPropertyButContentNotFiltered;
    }
 }

Member Data Documentation

unsigned CPropertyTag::_cPropChars [protected]

Definition at line 61 of file PropTag.Hxx.

unsigned CPropertyTag::_cPropCharsFiltered [protected]

Definition at line 62 of file PropTag.Hxx.

PropTagState CPropertyTag::_eState [protected]

Definition at line 57 of file PropTag.Hxx.

HtmlTokenType CPropertyTag::_eTokType [protected]

Definition at line 64 of file PropTag.Hxx.

CFullPropSpec CPropertyTag::_propSpec [protected]

Definition at line 63 of file PropTag.Hxx.

WCHAR* CPropertyTag::_pwcPropBuf [protected]

Definition at line 59 of file PropTag.Hxx.

unsigned CPropertyTag::_uLenPropBuf [protected]

Definition at line 60 of file PropTag.Hxx.

ULONG CPropertyTag::_ulIdContentChunk [protected]

Definition at line 58 of file PropTag.Hxx.

The documentation for this class was generated from the following files:
  • WinBase/Indexing/IFilter/PropTag.Hxx
  • WinBase/Indexing/IFilter/PropTag.Cxx
Generated on Wed Nov 13 2024 16:57:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPropIDSets Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CPropIDSets Class Reference

#include "property.h"

Inherits TPropSetBase< DBPROPIDSET, CPropertyIDs >.

List of all members.

Public Member Functions

CPropIDSets (ULONG cPropIDSets=0, DBPROPIDSET *rgPropIDSets=NULL)
virtual | ~CPropIDSets ()
virtual DBPROPID * | FindProperty (DBPROPID dwPropertyID, REFGUID guidPropertySet)
virtual HRESULT | SetProperty (DBPROPID dwPropertyID, REFGUID guidPropertySet)

Detailed Description

Definition at line 203 of file property.h.

Constructor & Destructor Documentation

CPropIDSets::CPropIDSets | ( | ULONG | cPropIDSets = 0,
 |  | DBPROPIDSET * | rgPropIDSets = NULL
 | ) |  |

Definition at line 540 of file property.cpp.

  : TPropSetBase<DBPROPIDSET, CPropertyIDs>(cPropIDSets, rgPropIDSets)
{
}

CPropIDSets::~CPropIDSets ( ) [virtual]

Definition at line 549 of file property.cpp.

{
}

Member Function Documentation

DBPROPID * CPropIDSets::FindProperty | ( | DBPROPID | dwPropertyID,
 |  | REFGUID | guidPropertySet |
 | ) |  |  | [virtual]

Definition at line 578 of file property.cpp.

{
  //Find the property set...
  DBPROPIDSET* pPropSet = FindPropSet(guidPropertySet);
  if(pPropSet)
  {
    CPropertyIDs sCProperties(pPropSet);
    DBPROPID* pProp = sCProperties.FindProperty(dwPropertyID, DB_NULLID);
    sCProperties.Detach(pPropSet);

    return pProp;
  }

  return NULL;
}

HRESULT CPropIDSets::SetProperty | ( | DBPROPID | dwPropertyID,
 |  | REFGUID | guidPropertySet |
 | ) |  |  | [virtual]

Definition at line 558 of file property.cpp.

{
  //Add this property set (if doesn't already exist)
  DBPROPIDSET* pPropSet = AddPropSet(guidPropertySet);
  if(!pPropSet)
    return E_OUTOFMEMORY;

  //Delegate
  CPropertyIDs sCProperties(pPropSet);
  HRESULT hr = sCProperties.SetProperty(dwPropertyID);
  sCProperties.Detach(pPropSet);

  return hr;
}

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/property.h
  • Dataaccess/oledb/rowsetviewer/property.cpp
Generated on Wed Nov 13 2024 16:57:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPropInfoSets Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CPropInfoSets Class Reference

#include "property.h"

Inherits TPropSetBase< DBPROPINFOSET, CPropertyInfos >.

List of all members.

Public Member Functions

CPropInfoSets (ULONG cPropInfoSets=0, DBPROPINFOSET *rgPropInfoSets=NULL)
virtual | ~CPropInfoSets ()
virtual DBPROPINFO * | FindProperty (DBPROPID dwPropertyID, REFGUID guidPropertySet)

Detailed Description

Definition at line 183 of file property.h.

Constructor & Destructor Documentation

CPropInfoSets::CPropInfoSets | ( | ULONG | cPropInfoSets = 0,
 |  | DBPROPINFOSET * | rgPropInfoSets = NULL
 | ) |  |

Definition at line 500 of file property.cpp.

: TPropSetBase<DBPROPINFOSET, CPropertyInfos>(cPropInfoSets, rgPropInfoSets)
{
}

CPropInfoSets::~CPropInfoSets ( ) [virtual]

Definition at line 509 of file property.cpp.

{
}

Member Function Documentation

DBPROPINFO * CPropInfoSets::FindProperty | ( | DBPROPID | dwPropertyID,
 |  | REFGUID | guidPropertySet |
 | ) |  |  | [virtual]

Definition at line 518 of file property.cpp.

{
  //Find the property set...
  DBPROPINFOSET* pPropSet = FindPropSet(guidPropertySet);
  if(pPropSet)
  {
    CPropertyInfos sCProperties(pPropSet);
    DBPROPINFO* pProp = sCProperties.FindProperty(dwPropertyID, DB_NULLID);
    sCProperties.Detach(pPropSet);

    return pProp;
  }

  return NULL;
}

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/property.h
  • Dataaccess/oledb/rowsetviewer/property.cpp
Generated on Wed Nov 13 2024 16:57:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPropPageLite Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Public Attributes

CPropPageLite Class Reference

#include "cdialoglite.h"

Inherits CDialogLite.

Inherited by CFullConnectOptions, CFullConnectProperties, CFullConnectProvider, CFullConnectSecurity, COptionsAccessor, COptionsCommand, COptionsDataSource, COptionsError, COptionsNotify, and COptionsRowset.

List of all members.

Public Member Functions

CPropPageLite (UINT uIDD, TCHAR *ptszTitle=NULL)
virtual | ~CPropPageLite ()
virtual CPropSheetLite * | GetParent ()
virtual BOOL | HandleMessage (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
virtual BOOL | OnApply ()
virtual BOOL | OnCancel ()
virtual BOOL | OnKillActive ()
virtual BOOL | OnOK ()
virtual BOOL | OnReset ()
virtual BOOL | OnSetActive ()
virtual void | SetParent (CPropSheetLite *pCPropSheetLite)

Static Public Member Functions

static INT_PTR WINAPI | PropPageProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)

Public Attributes

CPropSheetLite * m_pCPropSheet
PROPSHEETPAGE | m_psPage

Detailed Description

Definition at line 943 of file cdialoglite.h.

Constructor & Destructor Documentation

CPropPageLite::CPropPageLite | ( | UINT | uIDD,
 |  | TCHAR * | ptszTitle = NULL
 | ) |  |

Definition at line 3888 of file cdialoglite.cpp.

  : CDialogLite(uIDD)
{
  memset(&m_psPage, 0, sizeof(PROPSHEETPAGE));

    //PROPSHEETPAGE
  m_psPage.dwSize     = sizeof(PROPSHEETPAGE);
    m_psPage.dwFlags    = PSP_USETITLE;
    m_psPage.hInstance    = GetAppLite()->m_hInstance;
    m_psPage.pszTemplate  = MAKEINTRESOURCE(uIDD);
    m_psPage.pszIcon    = NULL;
    m_psPage.pfnDlgProc   = PropPageProc;
    m_psPage.pszTitle   = ptszTitle;
    m_psPage.lParam     = (INT_PTR)this;

  //Parent Property Sheet
  m_pCPropSheet     = NULL;
}

CPropPageLite::~CPropPageLite ( ) [virtual]

Definition at line 3912 of file cdialoglite.cpp.

{
}

Member Function Documentation

virtual CPropSheetLite* CPropPageLite::GetParent ( ) [inline, virtual]

Definition at line 956 of file cdialoglite.h.

{ return m_pCPropSheet; }

BOOL CPropPageLite::HandleMessage | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [virtual]

Reimplemented from CDialogLite.

Definition at line 3994 of file cdialoglite.cpp.

{
  switch(msg)
  {
    case WM_NOTIFY:
    {
      switch (((NMHDR*)lParam)->code)
        {
        case PSN_SETACTIVE:
        {
          if(!OnSetActive())
          {
            SetWindowLongPtr(hWnd, DWLP_MSGRESULT, PSNRET_INVALID_NOCHANGEPAGE);
            return TRUE;
          }

          return FALSE;
        }

        case PSN_KILLACTIVE:
        {
          if(!OnKillActive())
          {
            SetWindowLongPtr(hWnd, DWLP_MSGRESULT, PSNRET_INVALID_NOCHANGEPAGE);
            return TRUE;
          }

          return FALSE;
        }

        case PSN_APPLY: //OK
        {
          if(!OnApply())
          {
            SetWindowLongPtr(hWnd, DWLP_MSGRESULT, PSNRET_INVALID_NOCHANGEPAGE);
            return TRUE;
          }

          return FALSE;
        }

        case PSN_RESET: //CANCEL
          OnReset();
          return FALSE;
      }
    }
  };

  //Pass the message onto the Dialog
  return CDialogLite::HandleMessage(hWnd, msg, wParam, lParam);
}

BOOL CPropPageLite::OnApply ( ) [virtual]

Reimplemented in CFullConnectProvider, COptionsDataSource, COptionsCommand, COptionsAccessor, COptionsRowset, COptionsNotify, and COptionsError.

Definition at line 3933 of file cdialoglite.cpp.

{
  return TRUE;
}

BOOL CPropPageLite::OnCancel ( ) [virtual]

Reimplemented from CDialogLite.

Definition at line 3963 of file cdialoglite.cpp.

{
  return TRUE;
}

BOOL CPropPageLite::OnKillActive ( ) [virtual]

Reimplemented in CFullConnectProvider, CFullConnectProperties, CFullConnectSecurity, and CFullConnectOptions.

Definition at line 3984 of file cdialoglite.cpp.

{
  return TRUE;
}

BOOL CPropPageLite::OnOK ( ) [virtual]

Reimplemented from CDialogLite.

Definition at line 3943 of file cdialoglite.cpp.

{
  return TRUE;
}

BOOL CPropPageLite::OnReset ( ) [virtual]

Definition at line 3953 of file cdialoglite.cpp.

{
  return TRUE;
}

BOOL CPropPageLite::OnSetActive ( ) [virtual]

Reimplemented in CFullConnectProvider, CFullConnectProperties, CFullConnectSecurity, and CFullConnectOptions.

Definition at line 3974 of file cdialoglite.cpp.

{
  return TRUE;
}

INT_PTR WINAPI CPropPageLite::PropPageProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 4053 of file cdialoglite.cpp.

{
  CPropPageLite* pCPropPageLite = (CPropPageLite*)GetThis(hWnd);

  switch(msg)
  {
    case WM_INITDIALOG:
    {
      //Save the Window Handle
      PROPSHEETPAGE*ps = (PROPSHEETPAGE*)lParam;
      CPropPageLite* pCPropPageLite = (CPropPageLite*)ps->lParam;
      pCPropPageLite->m_hWnd = hWnd;

      //Save the "this" pointer
      SetThis(hWnd, pCPropPageLite);
      return pCPropPageLite->OnInitDialog();
    }
  };

  if(pCPropPageLite)
    return pCPropPageLite->HandleMessage(hWnd, msg, wParam, lParam);

  return FALSE;
}

void CPropPageLite::SetParent ( CPropSheetLite * pCPropSheetLite ) [virtual]

Definition at line 3922 of file cdialoglite.cpp.

{
  ASSERT(pCPropSheetLite);
  m_pCPropSheet = pCPropSheetLite;
}

Member Data Documentation

CPropSheetLite* CPropPageLite::m_pCPropSheet

Definition at line 972 of file cdialoglite.h.

PROPSHEETPAGE CPropPageLite::m_psPage

Definition at line 969 of file cdialoglite.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialoglite.h
  • Dataaccess/oledb/rowsetviewer/cdialoglite.cpp
Generated on Wed Nov 13 2024 16:57:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CProppageUser Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CProppageUser Class Reference

#include "proppageuser.h"

List of all members.

Public Member Functions

CProppageUser ()
~CProppageUser ()
STDMETHOD() | AddPages (LPFNADDPROPSHEETPAGE pAddPageProc, LPARAM lParam)
DECLARE_REGISTRY_CLSID ()
STDMETHOD() | Initialize (LPCITEMIDLIST pIDFolder, LPDATAOBJECT pDataObject, HKEY hKeyID)
STDMETHOD() | ReplacePage (UINT uPageID, LPFNADDPROPSHEETPAGE lpfnReplaceWith, LPARAM lParam)

Private Attributes

CComPtr< IDataObject > | m_spDataObj

Detailed Description

Definition at line 18 of file proppageuser.h.

Constructor & Destructor Documentation

CProppageUser::CProppageUser ( ) [inline]

Definition at line 25 of file proppageuser.h.

  {
    TRACE(L"CProppageUser::CProppageUser()\n");
  }

CProppageUser::~CProppageUser ( ) [inline]

Definition at line 30 of file proppageuser.h.

  {
    TRACE(L"CProppageUser::~CProppageUser()\n");
  }

Member Function Documentation

STDMETHODIMP CProppageUser::AddPages | ( | LPFNADDPROPSHEETPAGE | pAddPageProc,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 36 of file proppageuser.cpp.

{
  AFX_MANAGE_STATE(AfxGetStaticModuleState());
  TRACE(L"CProppageUser::AddPages()\n");

  // Unpack the data pointer and create the property page.
  // Register clipboard format
  CLIPFORMAT cfDsObjectNames = (CLIPFORMAT)RegisterClipboardFormat(CFSTR_DSOBJECTNAMES);
  ASSERT(cfDsObjectNames != 0);

  FORMATETC fmte = { cfDsObjectNames, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL};
  STGMEDIUM objMedium;

  HRESULT hr = m_spDataObj->GetData(&fmte, &objMedium);
  if (FAILED(hr))
  {
    AfxMessageBox(_T("Failed to retrieve data from medium."));
    return hr;
  }

  LPDSOBJECTNAMES pDsObjectNames;
  pDsObjectNames = (LPDSOBJECTNAMES)objMedium.hGlobal;
  if (pDsObjectNames->cItems < 1)
  {
    return ERROR_INVALID_DATA;
  }

  PWSTR pszObjADsPath = (PWSTR)BYTE_OFFSET(pDsObjectNames, pDsObjectNames->aObjects[0].offsetName);
  PWSTR pszClass = (PWSTR)BYTE_OFFSET(pDsObjectNames, pDsObjectNames->aObjects[0].offsetClass);
  TRACE(_T("Object path: %s, class: %s\n"), pszObjADsPath, pszClass);

  // Create/contact the notification object.
  HWND hNotifyObj;

  hr = ADsPropCreateNotifyObj(m_spDataObj, pszObjADsPath, &hNotifyObj);

  if (FAILED(hr))
  {
    return hr;
  }

  CProppageUserUI* pProppageUI = new CProppageUserUI(hNotifyObj);

  pProppageUI->Init(pszObjADsPath, pszClass);

  ((PROPSHEETPAGE*)&pProppageUI->m_psp)->lParam = (LPARAM)pProppageUI;
  if (!(*pAddPageProc)(CreatePropertySheetPage((PROPSHEETPAGE*)&pProppageUI->m_psp), (LPARAM)lParam))
  {
    delete pProppageUI;
    return E_FAIL;
  }
  return S_OK;
}

CProppageUser::DECLARE_REGISTRY_CLSID ( )
STDMETHODIMP CProppageUser::Initialize | ( | LPCITEMIDLIST | pIDFolder,
 |  | LPDATAOBJECT | pDataObject,
 |  | HKEY | hKeyID
 | ) |  |

Definition at line 18 of file proppageuser.cpp.

{
  TRACE(L"CProppageUser::Initialize()\n");
  if (pDataObject != NULL)
  {
    // Store the IDataObject in a smart pointer.
    m_spDataObj = pDataObject;
  }
  else
  {
    return E_INVALIDARG;
  }
  return S_OK;
}

STDMETHODIMP CProppageUser::ReplacePage | ( | UINT | uPageID,
 |  | LPFNADDPROPSHEETPAGE | lpfnReplaceWith,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 90 of file proppageuser.cpp.

{
  //
  // This method is not used.
  //
  return E_NOTIMPL;
}

Member Data Documentation

CComPtr<IDataObject> CProppageUser::m_spDataObj [private]

Definition at line 53 of file proppageuser.h.

The documentation for this class was generated from the following files:
  • NetDS/ADSI/samples/DSUI/userext/userproppage/proppageuser.h
  • NetDS/ADSI/samples/DSUI/userext/userproppage/proppageuser.cpp
Generated on Wed Nov 13 2024 16:57:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CProppageUserUI Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CProppageUserUI Class Reference

#include "proppageuserui.h"

Inherits CPropertyPage.

List of all members.

Public Member Functions

CProppageUserUI (HWND hNotifyObj)
~CProppageUserUI ()
HRESULT | Init (PWSTR pszPath, PWSTR pszClass)
virtual BOOL | OnApply ()
afx_msg void | OnChangePicture ()
afx_msg void | OnClearPicture ()
virtual void | OnDestroy ()
afx_msg void | OnEmployeeIDChange ()
virtual BOOL | OnInitDialog ()

Private Member Functions

CButton * | GetChangePictureButton ()
CButton * | GetClearPictureButton ()
CEdit * | GetIDEdit ()
CEdit * | GetPathEdit ()
CStatic * | GetPicture ()
void | SetUIData ()
void | SetUIEmployeeID ()
void | SetUIPhoto ()
HRESULT | WriteEmployeeID ()

Private Attributes

HWND | m_hNotifyObj
PADS_ATTR_INFO | m_pWritableAttrs
CComPtr< IDirectoryObject > | m_spDsObj
CString m_szClass
CString m_szPath
CThumbNailPhotoHolder m_thumbNailPhotoHolder

Detailed Description

Definition at line 22 of file proppageuserui.h.

Constructor & Destructor Documentation

CProppageUserUI::CProppageUserUI ( HWND hNotifyObj ) [inline]

Definition at line 25 of file proppageuserui.h.

    : CPropertyPage(IDD_USER_PAGE_EXT),
      m_hNotifyObj(hNotifyObj)
  {
  }

CProppageUserUI::~CProppageUserUI ( ) [inline]

Definition at line 31 of file proppageuserui.h.

  {
  }

Member Function Documentation

CButton* CProppageUserUI::GetChangePictureButton ( ) [inline, private]

Definition at line 55 of file proppageuserui.h.

{ return (CButton*)GetDlgItem(IDC_BUTTON_CHANGE_PICTURE); }

CButton* CProppageUserUI::GetClearPictureButton ( ) [inline, private]

Definition at line 56 of file proppageuserui.h.

{ return (CButton*)GetDlgItem(IDC_BUTTON_CLEAR_PICTURE); }

CEdit* CProppageUserUI::GetIDEdit ( ) [inline, private]

Definition at line 58 of file proppageuserui.h.

{ return (CEdit*)GetDlgItem(IDC_EDIT_EMPLOYEE_ID); }

CEdit* CProppageUserUI::GetPathEdit ( ) [inline, private]

Definition at line 57 of file proppageuserui.h.

{ return (CEdit*)GetDlgItem(IDC_EDIT_PICTURE_PATH); }

CStatic* CProppageUserUI::GetPicture ( ) [inline, private]

Definition at line 59 of file proppageuserui.h.

{ return (CStatic*)GetDlgItem(IDC_PICTURE_DISPLAY); }

HRESULT CProppageUserUI::Init | ( | PWSTR | pszPath,
 |  | PWSTR | pszClass
 | ) |  |

Definition at line 53 of file proppageuserui.cpp.

{
  //
  // Store local versions of the path and class
  //
  m_szPath = pszPath;
  m_szClass = pszClass;

  //
  // Get the property page initialization parameters from the notify window
  //
  ADSPROPINITPARAMS InitParams = {0};
  InitParams.dwSize = sizeof(ADSPROPINITPARAMS);
  if (!ADsPropGetInitInfo(m_hNotifyObj, &InitParams))
  {
    return E_FAIL;
  }

  if (FAILED(InitParams.hr))
  {
    return InitParams.hr;
  }

  //
  // Store local versions of the IDirectoryObject interface pointer
  // and the writable attributes
  //
  m_spDsObj = InitParams.pDsObj;
  m_pWritableAttrs = InitParams.pWritableAttrs;

  return S_OK;
}

BOOL CProppageUserUI::OnApply ( ) [virtual]

Definition at line 200 of file proppageuserui.cpp.

{
  ASSERT(m_spDsObj != NULL);

  //
  // update the two attributes
  //
  HRESULT hr = m_thumbNailPhotoHolder.Write(m_spDsObj);

  hr = WriteEmployeeID();
  if (FAILED(hr))
  {
    CString szMsg;
    szMsg.Format(_T("Failed to write Employee ID, with hr = 0x%x\n"), hr);
    AfxMessageBox(szMsg);
    return FALSE;
  }

  // Signal the change notification. Note that the notify-apply
  // message must be sent even if the page is not dirty so that
  // the notify ref-counting will properly decrement.
  ::SendMessage(m_hNotifyObj, WM_ADSPROP_NOTIFY_APPLY, TRUE, 0);

  return TRUE;
}

void CProppageUserUI::OnChangePicture ( )

Definition at line 115 of file proppageuserui.cpp.

{
  if (m_thumbNailPhotoHolder.Change(m_hWnd))
  {
    //
    // Enable the Apply button
    //
    SetModified(TRUE);
  }
}

void CProppageUserUI::OnClearPicture ( )

Definition at line 126 of file proppageuserui.cpp.

{
  if(m_thumbNailPhotoHolder.Clear())
  {
    //
    // Enable the Apply button
    //
    SetModified(TRUE);
  }
}

void CProppageUserUI::OnDestroy ( ) [virtual]

Definition at line 228 of file proppageuserui.cpp.

{
  if (::IsWindow(m_hNotifyObj))
  {
    ::SendMessage(m_hNotifyObj, WM_ADSPROP_NOTIFY_EXIT, 0, 0);
  }
  CPropertyPage::OnDestroy();
  delete this;
}

void CProppageUserUI::OnEmployeeIDChange ( )

Definition at line 192 of file proppageuserui.cpp.

{
  //
  // Enable the apply button, it's dirty
  //
  SetModified(TRUE);
}

BOOL CProppageUserUI::OnInitDialog ( ) [virtual]

Definition at line 33 of file proppageuserui.cpp.

{
  //
  // Verify that this page is only coming up for users
  //
  ASSERT(m_szClass == _T("user"));

  BOOL bRes = CPropertyPage::OnInitDialog();

  m_thumbNailPhotoHolder.Initialize(GetPathEdit()->m_hWnd, GetPicture()->m_hWnd);

  //
  // Display data in UI
  //
  SetUIData();
  return bRes;
}

void CProppageUserUI::SetUIData ( ) [private]

Definition at line 86 of file proppageuserui.cpp.

{
  //
  // Prime the controls with the data from the object
  //
  SetUIEmployeeID();
  SetUIPhoto();
}

void CProppageUserUI::SetUIEmployeeID ( ) [private]

Definition at line 139 of file proppageuserui.cpp.

{
  LPWSTR lpszAttrArray[] = { _T("employeeID") };
  PADS_ATTR_INFO pAttrInfo;
  DWORD dwReturned = 0;

  //
  // Get the employee ID
  //
  HRESULT hr = m_spDsObj->GetObjectAttributes(lpszAttrArray, 1, &pAttrInfo, &dwReturned);
  if (FAILED(hr))
  {
    CString szMsg;
    szMsg.Format(_T("Failed to read Employee ID attribute, with hr = 0x%x\n"), hr);
    AfxMessageBox(szMsg);
    return;
  }

  //
  // Retrieve the employee ID from the attribute
  // information and set it in the edit box
  //
  if (dwReturned == 1)
  {
    ASSERT(pAttrInfo != NULL);

    LPCWSTR lpszText = NULL;
    if (pAttrInfo->dwNumValues > 0)
    {
      lpszText = pAttrInfo->pADsValues->CaseIgnoreString;
    }

    //
    // write data to the edit control
    GetIDEdit()->SetWindowText(lpszText);

    //
    // Free the attribute memory
    //
    FreeADsMem(pAttrInfo);
  }

  //
  // Disable the ID edit box if user does not have write permissions on the attribute
  //
  if (!ADsPropCheckIfWritable(_T("employeeID"), m_pWritableAttrs))
  {
    GetIDEdit()->EnableWindow(FALSE);
  }

}

void CProppageUserUI::SetUIPhoto ( ) [private]

Definition at line 95 of file proppageuserui.cpp.

{
  //
  // Get the thumbnailPhoto information from the object
  //
  m_thumbNailPhotoHolder.Read(m_spDsObj);

  //
  // Disable the Change/Clear buttons if the user does not
  // have write permissions for the thumbnailPhoto attribute
  //
  if (!ADsPropCheckIfWritable(_T("thumbnailPhoto"), m_pWritableAttrs))
  {
    GetChangePictureButton()->EnableWindow(FALSE);
    GetClearPictureButton()->EnableWindow(FALSE);
  }

}

HRESULT CProppageUserUI::WriteEmployeeID ( ) [private]

Definition at line 240 of file proppageuserui.cpp.

{
  ADS_ATTR_INFO attrInfo[1];
  PWSTR rgpwzAttrNames[] = {_T("employeeID") };
  ADSVALUE Value[1];

  //
  // Set the update/clear value
  //

  CString szEmployeeID;
  GetIDEdit()->GetWindowText(szEmployeeID);
  BOOL bUpdate = !szEmployeeID.IsEmpty();

  attrInfo[0].dwADsType = ADSTYPE_CASE_IGNORE_STRING;
  attrInfo[0].pszAttrName = rgpwzAttrNames[0];

  Value[0].dwType = ADSTYPE_CASE_IGNORE_STRING;
  Value[0].CaseIgnoreString  = bUpdate ? (LPWSTR)(LPCWSTR)szEmployeeID : NULL;

  attrInfo[0].pADsValues = &Value[0];
  attrInfo[0].dwNumValues = 1;
  attrInfo[0].dwControlCode = bUpdate ? ADS_ATTR_UPDATE : ADS_ATTR_CLEAR;

  //
  // Write the changes to the object
  //
  DWORD dwModified = 0;
  return m_spDsObj->SetObjectAttributes(attrInfo, 1, &dwModified);
}

Member Data Documentation

HWND CProppageUserUI::m_hNotifyObj [private]

Definition at line 62 of file proppageuserui.h.

PADS_ATTR_INFO CProppageUserUI::m_pWritableAttrs [private]

Definition at line 69 of file proppageuserui.h.

CComPtr<IDirectoryObject> CProppageUserUI::m_spDsObj [private]

Definition at line 68 of file proppageuserui.h.

CString CProppageUserUI::m_szClass [private]

Definition at line 64 of file proppageuserui.h.

CString CProppageUserUI::m_szPath [private]

Definition at line 63 of file proppageuserui.h.

CThumbNailPhotoHolder CProppageUserUI::m_thumbNailPhotoHolder [private]

Definition at line 66 of file proppageuserui.h.

The documentation for this class was generated from the following files:
  • NetDS/ADSI/samples/DSUI/userext/userproppage/proppageuserui.h
  • NetDS/ADSI/samples/DSUI/userext/userproppage/proppageuserui.cpp
Generated on Wed Nov 13 2024 16:57:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPropPro Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CPropPro Class Reference

#include "Sample.h"

List of all members.

Public Member Functions

CPropPro ()
~CPropPro (void)
virtual HRESULT STDMETHODCALLTYPE | GetProperty (long lFlags, const BSTR Locale, const BSTR ClassMapping, const BSTR InstMapping, const BSTR PropMapping, VARIANT *pvValue)
virtual HRESULT STDMETHODCALLTYPE | PutProperty (long lFlags, const BSTR Locale, const BSTR ClassMapping, const BSTR InstMapping, const BSTR PropMapping, const VARIANT __RPC_FAR *pvValue)
STDMETHODIMP | QueryInterface (REFIID, PPVOID)
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP_ (ULONG) Release(void)

Protected Attributes

ULONG m_cRef

Detailed Description

Definition at line 31 of file Sample.h.

Constructor & Destructor Documentation

CPropPro::CPropPro ( )

Definition at line 138 of file PropProv.Cpp.

{
    m_cRef=0;
    InterlockedIncrement(&g_cObj);
    return;
}

CPropPro::~CPropPro ( void )

Definition at line 145 of file PropProv.Cpp.

{
    InterlockedDecrement(&g_cObj);
    return;
}

Member Function Documentation

STDMETHODIMP CPropPro::GetProperty | ( | long | lFlags,
 |  | const BSTR | Locale,
 |  | const BSTR | ClassMapping,
 |  | const BSTR | InstMapping,
 |  | const BSTR | PropMapping,
 |  | VARIANT * | pvValue |
 | ) |  |  | [virtual]

Definition at line 231 of file PropProv.Cpp.

{

    SCODE sc = WBEM_S_NO_ERROR;

  //Impersonate the client
  sc = CoImpersonateClient () ;

  if ( FAILED ( sc ) )
  {
    return sc ;
  }

  //  Check to see if call is at lower than RPC_C_IMP_LEVEL_IMPERSONATE level. If that's the case,
  //  the provider will not be able to impersonate the client to access the protected resources.

  DWORD t_CurrentImpersonationLevel = GetCurrentImpersonationLevel () ;
  if ( t_CurrentImpersonationLevel < RPC_C_IMP_LEVEL_IMPERSONATE )
  {
    //  Revert before we perform any operations
    CoRevertToSelf () ;
    return WBEM_E_ACCESS_DENIED ;
  }

    // Depending on the InstMapping, return either a hard coded integer or
    // a string.  These mapping strings could be used in a more sophisticated
    // manner!

  if (pvValue == NULL)
  {
    return WBEM_E_INVALID_PARAMETER;
  }

    if(!_wcsicmp(PropMapping, L"GiveMeANumber!"))
    {
        pvValue->vt = VT_I4;
        pvValue->lVal = 27;
    }
    else
    {
        pvValue->vt = VT_BSTR;
        pvValue->bstrVal = SysAllocString(L"Hello World");
        if(pvValue->bstrVal == NULL)
            sc = WBEM_E_OUT_OF_MEMORY;
    }
    return sc;
}

virtual HRESULT STDMETHODCALLTYPE CPropPro::PutProperty | ( | long | lFlags,
 |  | const BSTR | Locale,
 |  | const BSTR | ClassMapping,
 |  | const BSTR | InstMapping,
 |  | const BSTR | PropMapping,
 |  | const VARIANT __RPC_FAR * | pvValue |
 | ) |  |  | [virtual]
STDMETHODIMP CPropPro::QueryInterface | ( | REFIID | riid,
 |  | PPVOID | ppv
 | ) |  |

Definition at line 159 of file PropProv.Cpp.

{
    *ppv=NULL;

    // This provider only support IUnknown and IWbemPropertyProvider.

    if (IID_IUnknown==riid || IID_IWbemPropertyProvider == riid)
        *ppv=this;

    if (NULL!=*ppv)
    {
        ((LPUNKNOWN)*ppv)->AddRef();
        return NOERROR;
    }

    return E_NOINTERFACE;
 }

CPropPro::STDMETHODIMP_ ( ULONG )
CPropPro::STDMETHODIMP_ ( ULONG )

Member Data Documentation

ULONG CPropPro::m_cRef [protected]

Definition at line 34 of file Sample.h.

The documentation for this class was generated from the following files:
  • SysMgmt/WMI/VC/PropProv/Sample.h
  • SysMgmt/WMI/VC/PropProv/PropProv.Cpp
Generated on Wed Nov 13 2024 16:57:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPropSets Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CPropSets Class Reference

#include "property.h"

Inherits TPropSetBase< DBPROPSET, CProperties >.

List of all members.

Public Member Functions

CPropSets (ULONG cPropSets=0, DBPROPSET *rgPropSets=NULL)
virtual | ~CPropSets ()
virtual DBPROP * | FindProperty (DBPROPID dwPropertyID, REFGUID guidPropertySet, const DBID &colid)
virtual HRESULT | SetProperty (DBPROPID dwPropertyID, REFGUID guidPropertySet, DBTYPE wType, void *pv, DBPROPOPTIONS dwOptions=DBPROPOPTIONS_REQUIRED, const DBID &colid=DB_NULLID)

Detailed Description

Definition at line 162 of file property.h.

Constructor & Destructor Documentation

CPropSets::CPropSets | ( | ULONG | cPropSets = 0,
 |  | DBPROPSET * | rgPropSets = NULL
 | ) |  |

Definition at line 439 of file property.cpp.

  : TPropSetBase<DBPROPSET, CProperties>(cPropSets, rgPropSets)
{
}

CPropSets::~CPropSets ( ) [virtual]

Definition at line 448 of file property.cpp.

{
}

Member Function Documentation

DBPROP * CPropSets::FindProperty | ( | DBPROPID | dwPropertyID,
 |  | REFGUID | guidPropertySet,
 |  | const DBID & | colid |
 | ) |  |  | [virtual]

Definition at line 477 of file property.cpp.

{
  //Find the property set...
  DBPROPSET* pPropSet = FindPropSet(guidPropertySet);
  if(pPropSet)
  {
    CProperties sCProperties(pPropSet);
    DBPROP* pProp = sCProperties.FindProperty(dwPropertyID, colid);
    sCProperties.Detach(pPropSet);

    return pProp;
  }

  return NULL;
}

HRESULT CPropSets::SetProperty | ( | DBPROPID | dwPropertyID,
 |  | REFGUID | guidPropertySet,
 |  | DBTYPE | wType,
 |  | void * | pv,
 |  | DBPROPOPTIONS | dwOptions = DBPROPOPTIONS_REQUIRED,
 |  | const DBID & | colid = DB_NULLID |
 | ) |  |  | [virtual]

Definition at line 457 of file property.cpp.

{
  //Add this property set (if doesn't already exist)
  DBPROPSET* pPropSet = AddPropSet(guidPropertySet);
  if(!pPropSet)
    return E_OUTOFMEMORY;

  //Delegate
  CProperties sCProperties(pPropSet);
  HRESULT hr = sCProperties.SetProperty(dwPropertyID, wType, pv, dwOptions, colid);
  sCProperties.Detach(pPropSet);

  return hr;
}

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/property.h
  • Dataaccess/oledb/rowsetviewer/property.cpp
Generated on Wed Nov 13 2024 16:57:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPropSheetExtension Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes

CPropSheetExtension Class Reference

#include "ppgeext.h"

List of all members.

Public Member Functions

CPropSheetExtension ()
~CPropSheetExtension ()
virtual HRESULT STDMETHODCALLTYPE | CreatePropertyPages (LPPROPERTYSHEETCALLBACK lpProvider, LONG_PTR handle, LPDATAOBJECT lpIDataObject)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
virtual HRESULT STDMETHODCALLTYPE | QueryPagesFor (LPDATAOBJECT lpDataObject)
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()

Private Member Functions

HRESULT | ExtractData (IDataObject *piDataObject, CLIPFORMAT cfClipFormat, BYTE *pbData, DWORD cbData)
HRESULT | ExtractObjectTypeGUID (IDataObject *piDataObject, GUID *pguidObjectType)
HRESULT | ExtractSnapInCLSID (IDataObject *piDataObject, CLSID *pclsidSnapin)
HRESULT | ExtractString (IDataObject *piDataObject, CLIPFORMAT cfClipFormat, _TCHAR *pstr, DWORD cchMaxLength)

Static Private Member Functions

static BOOL CALLBACK | DialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)

Private Attributes

ULONG m_cref
LONG_PTR | m_ppHandle

Static Private Attributes

static UINT | s_cfDisplayName = RegisterClipboardFormat(_T_CCF_DISPLAY_NAME)
static UINT | s_cfNodeType = RegisterClipboardFormat(_T_CCF_NODETYPE)
static UINT | s_cfSnapInCLSID = RegisterClipboardFormat(_T_CCF_SNAPIN_CLASSID)

Detailed Description

Definition at line 25 of file ppgeext.h.

Constructor & Destructor Documentation

CPropSheetExtension::CPropSheetExtension ( )

Definition at line 37 of file ppgeext.Cpp.

                                         : m_cref(0)
{
    OBJECT_CREATED
}

CPropSheetExtension::~CPropSheetExtension ( )

Definition at line 42 of file ppgeext.Cpp.

{
    OBJECT_DESTROYED
}

Member Function Documentation

HRESULT CPropSheetExtension::CreatePropertyPages | ( | LPPROPERTYSHEETCALLBACK | lpProvider,
 |  | LONG_PTR | handle,
 |  | LPDATAOBJECT | lpIDataObject |
 | ) |  |  | [virtual]

Definition at line 132 of file ppgeext.Cpp.

{
    PROPSHEETPAGE psp;
    HPROPSHEETPAGE hPage = NULL;

    // we don't cache this handle like in a primary snap-in
    // the handle value here is always 0
    // m_ppHandle = handle;

    psp.dwSize = sizeof(PROPSHEETPAGE);
    psp.dwFlags = PSP_DEFAULT | PSP_USETITLE | PSP_USEICONID;
    psp.hInstance = g_hinst;
    psp.pszTemplate = MAKEINTRESOURCE(IDD_PROPPAGE_LARGE);
    psp.pfnDlgProc = DialogProc;
    psp.lParam = reinterpret_cast<LPARAM>(this);
    psp.pszTitle = MAKEINTRESOURCE(IDS_PST_ROCKET_EXT);
    psp.pszIcon = MAKEINTRESOURCE(IDI_PSI_ROCKET);

    hPage = CreatePropertySheetPage(&psp);
    _ASSERT(hPage);

    HRESULT hr = lpProvider->AddPage(hPage);
    return hr;
}

BOOL CALLBACK CPropSheetExtension::DialogProc | ( | HWND | hwndDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static, private]

Definition at line 89 of file ppgeext.Cpp.

{
    static CPropSheetExtension *pThis = NULL;

    switch (uMsg) {
    case WM_INITDIALOG:
        pThis = reinterpret_cast<CPropSheetExtension *>(reinterpret_cast<PROPSHEETPAGE *>(lParam)->lParam);

        break;

    case WM_COMMAND:
        if (HIWORD(wParam) == EN_CHANGE ||
            HIWORD(wParam) == CBN_SELCHANGE)
            SendMessage(GetParent(hwndDlg), PSM_CHANGED, (WPARAM)hwndDlg, 0);
        break;

    case WM_DESTROY:
        // we don't free the notify handle for property sheets
        // MMCFreeNotifyHandle(pThis->m_ppHandle);
        break;

    case WM_NOTIFY:
        switch (((NMHDR *) lParam)->code) {
        case PSN_APPLY:
            // don't notify the primary snap-in that Apply
            // has been hit...
            // MMCPropertyChangeNotify(pThis->m_ppHandle, (long)pThis);
            return PSNRET_NOERROR;
        }
        break;
    }

    return DefWindowProc(hwndDlg, uMsg, wParam, lParam);
}

HRESULT CPropSheetExtension::ExtractData | ( | IDataObject * | piDataObject,
 |  | CLIPFORMAT | cfClipFormat,
 |  | BYTE * | pbData,
 |  | DWORD | cbData |
 | ) |  |  | [inline, private]

Definition at line 71 of file ppgeext.h.

    {
        HRESULT hr = S_OK;

        FORMATETC formatetc = {cfClipFormat, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL};
        STGMEDIUM stgmedium = {TYMED_HGLOBAL, NULL};

        stgmedium.hGlobal = ::GlobalAlloc(GPTR, cbData);
        do // false loop
        {
            if (NULL == stgmedium.hGlobal)
            {
                hr = E_OUTOFMEMORY;
                break;
            }
            hr = piDataObject->GetDataHere( &formatetc, &stgmedium );
            if ( FAILED(hr) )
            {
                break;
            }

            BYTE* pbNewData = reinterpret_cast<BYTE*>(stgmedium.hGlobal);
            if (NULL == pbNewData)
            {
                hr = E_UNEXPECTED;
                break;
            }
            ::memcpy( pbData, pbNewData, cbData );
        } while (FALSE); // false loop

        if (NULL != stgmedium.hGlobal)
        {
            ::GlobalFree(stgmedium.hGlobal);
        }
        return hr;
    } // ExtractData()

HRESULT CPropSheetExtension::ExtractObjectTypeGUID | ( | IDataObject * | piDataObject,
 |  | GUID * | pguidObjectType |
 | ) |  |  | [inline, private]

Definition at line 124 of file ppgeext.h.

    {
        return ExtractData( piDataObject, s_cfNodeType, (PBYTE)pguidObjectType, sizeof(GUID) );
    }

HRESULT CPropSheetExtension::ExtractSnapInCLSID | ( | IDataObject * | piDataObject,
 |  | CLSID * | pclsidSnapin |
 | ) |  |  | [inline, private]

Definition at line 119 of file ppgeext.h.

    {
        return ExtractData( piDataObject, s_cfSnapInCLSID, (PBYTE)pclsidSnapin, sizeof(CLSID) );
    }

HRESULT CPropSheetExtension::ExtractString | ( | IDataObject * | piDataObject,
 |  | CLIPFORMAT | cfClipFormat,
 |  | _TCHAR * | pstr,
 |  | DWORD | cchMaxLength |
 | ) |  |  | [inline, private]

Definition at line 111 of file ppgeext.h.

    {
        return ExtractData( piDataObject, cfClipFormat, (PBYTE)pstr, cchMaxLength );
    }

STDMETHODIMP CPropSheetExtension::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 51 of file ppgeext.Cpp.

{
    if (!ppv)
        return E_FAIL;

    *ppv = NULL;

    if (IsEqualIID(riid, IID_IUnknown))
        *ppv = static_cast<IExtendPropertySheet *>(this);
    else if (IsEqualIID(riid, IID_IExtendPropertySheet))
        *ppv = static_cast<IExtendPropertySheet *>(this);

    if (*ppv)
    {
        reinterpret_cast<IUnknown *>(*ppv)->AddRef();
        return S_OK;
    }

    return E_NOINTERFACE;
}

HRESULT CPropSheetExtension::QueryPagesFor ( LPDATAOBJECT lpDataObject ) [virtual]

Definition at line 160 of file ppgeext.Cpp.

{
    return S_OK;
}

CPropSheetExtension::STDMETHODIMP_ ( ULONG )
CPropSheetExtension::STDMETHODIMP_ ( ULONG )

Member Data Documentation

ULONG CPropSheetExtension::m_cref [private]

Definition at line 29 of file ppgeext.h.

LONG_PTR CPropSheetExtension::m_ppHandle [private]

Definition at line 59 of file ppgeext.h.

UINT CPropSheetExtension::s_cfDisplayName = RegisterClipboardFormat(_T_CCF_DISPLAY_NAME) [static, private]

Definition at line 32 of file ppgeext.h.

UINT CPropSheetExtension::s_cfNodeType = RegisterClipboardFormat(_T_CCF_NODETYPE) [static, private]

Definition at line 34 of file ppgeext.h.

UINT CPropSheetExtension::s_cfSnapInCLSID = RegisterClipboardFormat(_T_CCF_SNAPIN_CLASSID) [static, private]

Definition at line 33 of file ppgeext.h.

The documentation for this class was generated from the following files:
  • SysMgmt/MMC/Ppgeext/ppgeext.h
  • SysMgmt/MMC/Ppgeext/ppgeext.Cpp
Generated on Wed Nov 13 2024 16:57:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPropSheetHost Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes

CPropSheetHost Class Reference

#include "PropSheetHost.h"

List of all members.

Public Member Functions

CPropSheetHost (HINSTANCE hInstance, HWND hwndParent=NULL)
~CPropSheetHost ()
STDMETHODIMP | DAdvise (FORMATETC *, DWORD, IAdviseSink *, LPDWORD)
STDMETHODIMP | DUnadvise (DWORD dwConnection)
STDMETHODIMP | EnumDAdvise (IEnumSTATDATA **ppEnumAdvise)
STDMETHODIMP | EnumFormatEtc (DWORD, IEnumFORMATETC **)
STDMETHODIMP | GetCanonicalFormatEtc (LPFORMATETC, LPFORMATETC)
STDMETHODIMP | GetData (FORMATETC *, STGMEDIUM *)
STDMETHODIMP | GetDataHere (FORMATETC *, STGMEDIUM *)
STDMETHODIMP | QueryGetData (FORMATETC *)
STDMETHODIMP | QueryInterface (REFIID, LPVOID FAR *)
void | Run ()
STDMETHODIMP | SetData (LPFORMATETC, LPSTGMEDIUM, BOOL)
HRESULT | SetObject (IADs *pads)
HRESULT | SetObject (LPCWSTR pwszADsPath)
STDMETHODIMP_ (DWORD) Release()
STDMETHODIMP_ (DWORD) AddRef()

Private Member Functions

HRESULT | _AddPagesForObject (IADs *padsObject)
HWND | _CreateHiddenWindow ()
void | _CreatePropertySheet ()
void | _CreateSecondaryPropertySheet (DSA_SEC_PAGE_INFO *pDSASecPageInfo)
HRESULT | _ExtractSecPageInfo (WPARAM wParam, PDSA_SEC_PAGE_INFO *ppSecPageInfo)
HRESULT | _GetDSDispSpecOption (FORMATETC *pFormatEtc, STGMEDIUM *pStgMedium)
HRESULT | _GetDSObjectNames (FORMATETC *pFormatEtc, STGMEDIUM *pStgMedium)
HRESULT | _GetDSPropSheetConfig (FORMATETC *pFormatEtc, STGMEDIUM *pStgMedium)

Static Private Member Functions

static BOOL CALLBACK | _AddPagesCallback (HPROPSHEETPAGE hPage, LPARAM lParam)
static LRESULT CALLBACK | _HiddenWindowProc (HWND, UINT, WPARAM, LPARAM)

Private Attributes

ATOM | m_cfDSDispSpecOptions
ATOM | m_cfDSObjectNames
ATOM | m_cfDSPropSheetConfig
HINSTANCE | m_hInst
HWND | m_hwndHidden
HWND | m_hwndParent
DWORD m_ObjRefCount
LPWSTR | m_pwszPrefix
CSimpleArray< HPROPSHEETPAGE > | m_rgPageHandles
CComPtr< IADs > | m_spADObject
LPTSTR m_szHiddenWindowClass

Detailed Description

Definition at line 98 of file PropSheetHost.h.

Constructor & Destructor Documentation

CPropSheetHost::CPropSheetHost | ( | HINSTANCE | hInstance,
 |  | HWND | hwndParent = NULL
 | ) |  |

Definition at line 30 of file PropSheetHost.cpp.

{
    m_hInst = hInstance;
    m_hwndParent = hwndParent;
    m_hwndHidden = NULL;
    m_ObjRefCount = 0;

    m_cfDSPropSheetConfig = RegisterClipboardFormat(CFSTR_DS_PROPSHEETCONFIG);
    m_cfDSObjectNames = RegisterClipboardFormat(CFSTR_DSOBJECTNAMES);
    m_cfDSDispSpecOptions = RegisterClipboardFormat(CFSTR_DSDISPLAYSPECOPTIONS);

    m_szHiddenWindowClass = TEXT("CPropSheetHostHiddenWindowClass");

#if 1
    m_pwszPrefix = PROP_SHEET_PREFIX_ADMIN;
#else
    m_pwszPrefix = PROP_SHEET_PREFIX_SHELL;
#endif
}

CPropSheetHost::~CPropSheetHost ( )

Definition at line 57 of file PropSheetHost.cpp.

{
}

Member Function Documentation

BOOL CALLBACK CPropSheetHost::_AddPagesCallback | ( | HPROPSHEETPAGE | hPage,
 |  | LPARAM | lParam |
 | ) |  |  | [static, private]

Definition at line 376 of file PropSheetHost.cpp.

{
    CPropSheetHost *pThis = (CPropSheetHost*)lParam;

    pThis->m_rgPageHandles.Add(hPage);

    return TRUE;
}

HRESULT CPropSheetHost::_AddPagesForObject ( IADs * padsObject ) [private]

Definition at line 258 of file PropSheetHost.cpp.

{
    HRESULT hr;

    // Get a copy of our IDataObject.
    CComPtr<IDataObject> spDataObject;
    hr = this->QueryInterface(IID_IDataObject, (LPVOID*)&spDataObject);
    if(FAILED(hr))
    {
        return hr;
    }

    // Create the DS property pages object.
    CComPtr<IShellExtInit> spExtInit;
    hr = spExtInit.CoCreateInstance(CLSID_DsPropertyPages);
    if(FAILED(hr))
    {
        return hr;
    }

    // Initialize the  DS property pages object.
    hr = spExtInit->Initialize(NULL, spDataObject, NULL);
    if(FAILED(hr))
    {
        return hr;
    }

    CComPtr<IShellPropSheetExt> spPropSheet;
    hr = spExtInit->QueryInterface(IID_IShellPropSheetExt, (LPVOID*)&spPropSheet);
    if(FAILED(hr))
    {
        return hr;
    }

    hr = spPropSheet->AddPages(_AddPagesCallback, (LPARAM)this);
    if(FAILED(hr))
    {
        return hr;
    }

    return hr;
}

HWND CPropSheetHost::_CreateHiddenWindow ( ) [private]

Definition at line 128 of file PropSheetHost.cpp.

{
    WNDCLASS  wc;

    if(!GetClassInfo(m_hInst, m_szHiddenWindowClass, &wc))
    {
        ZeroMemory(&wc, sizeof(wc));

        wc.style          = CS_HREDRAW | CS_VREDRAW;
        wc.lpfnWndProc    = (WNDPROC)_HiddenWindowProc;
        wc.cbClsExtra     = 0;
        wc.cbWndExtra     = sizeof(CPropSheetHost*);
        wc.hInstance      = m_hInst;
        wc.hCursor        = LoadCursor(NULL, IDC_ARROW);
        wc.hbrBackground  = (HBRUSH)(COLOR_WINDOW + 1);
        wc.lpszClassName  = m_szHiddenWindowClass;

        if(!RegisterClass(&wc))
        {
            return NULL;
        }
    }

    m_hwndHidden = CreateWindowEx(  0,
                                    m_szHiddenWindowClass,
                                    NULL,
                                    WS_OVERLAPPED |
                                        0,
                                    CW_USEDEFAULT,
                                    CW_USEDEFAULT,
                                    CW_USEDEFAULT,
                                    CW_USEDEFAULT,
                                    NULL,
                                    NULL,
                                    m_hInst,
                                    (LPVOID)this);

    return m_hwndHidden;
}

void CPropSheetHost::_CreatePropertySheet ( ) [private]

Definition at line 307 of file PropSheetHost.cpp.

{
    if(!m_spADObject.p)
    {
        return;
    }

    HRESULT hr;

    hr = _AddPagesForObject(m_spADObject);
    if(FAILED(hr))
    {
        return;
    }

    /*
    The property page handle array should have been filled in _AddPagesForObject
    when AddPages was called.
    */
    if(m_rgPageHandles.GetSize() == 0)
    {
        return;
    }

    // Create the caption for the property sheet.
    CComBSTR sbstrTemp;
    hr = m_spADObject->get_Name(&sbstrTemp);
    if(S_OK == hr)
    {
        sbstrTemp += " ";
    }
    else
    {
        sbstrTemp = "";
    }
    sbstrTemp += m_pwszPrefix;
    sbstrTemp += " Properties";

    // Initialize the property sheet.
    PROPSHEETHEADER psh;

    ZeroMemory(&psh, sizeof(psh));

    USES_CONVERSION;

    // Fill out the PROPSHEETHEADER structure.
    psh.dwSize           = sizeof(PROPSHEETHEADER);
    psh.dwFlags          = PSH_DEFAULT;
    psh.hwndParent       = m_hwndParent;
    psh.hInstance        = NULL;
    psh.pszIcon          = NULL;
    psh.pszCaption       = W2T(sbstrTemp);
    psh.nPages           = (UINT)m_rgPageHandles.GetSize();
    psh.phpage           = m_rgPageHandles.GetData();
    psh.pfnCallback      = NULL;

    // Display the property sheet.
    PropertySheet(&psh);

    // Remove all page handles from the array.
    m_rgPageHandles.RemoveAll();
}

void CPropSheetHost::_CreateSecondaryPropertySheet ( DSA_SEC_PAGE_INFO * pDSASecPageInfo ) [private]

Definition at line 454 of file PropSheetHost.cpp.

{
    LPDSOBJECT pdsObject = &pDSASecPageInfo->dsObjectNames.aObjects[0];

    LPWSTR pwszTitle = (LPWSTR)((LPBYTE)pDSASecPageInfo + pDSASecPageInfo->offsetTitle);
    LPWSTR pwszClass = (LPWSTR)((LPBYTE)pdsObject + pdsObject->offsetClass);

    // Create a new property sheet host object.
    CPropSheetHost *pSecondarySheet = new CPropSheetHost(m_hInst, pDSASecPageInfo->hwndParentSheet);
    if(!pSecondarySheet)
    {
        return;
    }

    // Hold a reference count for the CPropSheetHost object.
    pSecondarySheet->AddRef();

    // Build the ADsPath of the object to create the property sheet for.
    LPWSTR pwszName = (LPWSTR)((LPBYTE)pdsObject + pdsObject->offsetName);
    CComBSTR sbstrTemp = "LDAP://";
    sbstrTemp += pwszName;
    pSecondarySheet->SetObject(sbstrTemp);

    pSecondarySheet->Run();

    /*
    Release the CPropSheetHost object. Other components may still hold a
    reference to the object, so this cannot just be deleted here. Let the object
    delete itself when all references are released.
    */
    pSecondarySheet->Release();
}

HRESULT CPropSheetHost::_ExtractSecPageInfo | ( | WPARAM | wParam,
 |  | PDSA_SEC_PAGE_INFO * | ppSecPageInfo |
 | ) |  |  | [private]

Definition at line 391 of file PropSheetHost.cpp.

{
    if(!wParam || !ppSecPageInfo)
    {
        return E_INVALIDARG;
    }

    OSVERSIONINFO osvi;

    osvi.dwOSVersionInfoSize = sizeof(osvi);
    if(GetVersionEx(&osvi))
    {
        // This functionality isn't supported prior to Windows 2000.
        if((osvi.dwPlatformId != VER_PLATFORM_WIN32_NT) || (osvi.dwMajorVersion < 5))
        {
            return E_UNEXPECTED;
        }

        /*
        Special case for Windows 2000. Need to insert an HWND member at the front
        of the DSA_SEC_PAGE_INFO structure.
        */
        if((5 == osvi.dwMajorVersion) && (0 == osvi.dwMinorVersion))
        {
            SIZE_T sizeOldSize = LocalSize((HLOCAL)wParam);
            DWORD dwOffset = sizeof(HWND);

            *ppSecPageInfo = (PDSA_SEC_PAGE_INFO)LocalAlloc(GPTR, sizeOldSize + sizeof(HWND));
            if(!*ppSecPageInfo)
            {
                return E_OUTOFMEMORY;
            }

            LPBYTE pDest = (LPBYTE)*ppSecPageInfo;
            LPBYTE pSource = (LPBYTE)wParam;

            // Copy the original memory to the new block.
            CopyMemory(pDest + dwOffset, pSource, sizeOldSize);

            // Need to update the title offset.
            (*ppSecPageInfo)->offsetTitle += dwOffset;

            // Free the old memory.
            LocalFree((HLOCAL)wParam);
        }
        else
        {
            // Just return the original memory.
            *ppSecPageInfo = (PDSA_SEC_PAGE_INFO)wParam;
        }

        return S_OK;
    }

    return E_FAIL;
}

HRESULT CPropSheetHost::_GetDSDispSpecOption | ( | FORMATETC * | pFormatEtc,
 |  | STGMEDIUM * | pStgMedium |
 | ) |  |  | [private]

Definition at line 251 of file DataObj.cpp.

{
    if((m_cfDSDispSpecOptions != pFormatEtc->cfFormat) ||
        !(pFormatEtc->tymed & TYMED_HGLOBAL))
    {
        return DV_E_FORMATETC;
    }

    HRESULT hr = E_OUTOFMEMORY;
    LPWSTR pwszPrefix = m_pwszPrefix;
    DWORD dwPrefixOffset;

    // Size of the DSDISPLAYSPECOPTIONS structure.
    DWORD dwBytes = sizeof(DSDISPLAYSPECOPTIONS);

    // Store the offset to the prefix.
    dwPrefixOffset = dwBytes;

    // Length of the prefix Unicode string, including the null terminator.
    dwBytes += (lstrlenW(pwszPrefix) + 1) * sizeof(WCHAR);

    pStgMedium->pUnkForRelease = NULL;
    pStgMedium->tymed = TYMED_HGLOBAL;
    pStgMedium->hGlobal = GlobalAlloc(GPTR, dwBytes);
    if(pStgMedium->hGlobal)
    {
        DSDISPLAYSPECOPTIONS *pDispSpecOptions = (DSDISPLAYSPECOPTIONS*)GlobalLock(pStgMedium->hGlobal);
        if(pDispSpecOptions)
        {
            LPWSTR pwszTemp;

            pDispSpecOptions->dwSize = sizeof(DSDISPLAYSPECOPTIONS);
            pDispSpecOptions->dwFlags = 0;
            pDispSpecOptions->offsetAttribPrefix = dwPrefixOffset;
            pDispSpecOptions->offsetUserName = 0;
            pDispSpecOptions->offsetPassword = 0;
            pDispSpecOptions->offsetServer = 0;
            pDispSpecOptions->offsetServerConfigPath = 0;

            // Copy the prefix string.
            pwszTemp = (LPWSTR)((LPBYTE)pDispSpecOptions + dwPrefixOffset);
            lstrcpyW(pwszTemp, pwszPrefix);

            GlobalUnlock(pStgMedium->hGlobal);

            hr = S_OK;
        }
    }

    return hr;
}

HRESULT CPropSheetHost::_GetDSObjectNames | ( | FORMATETC * | pFormatEtc,
 |  | STGMEDIUM * | pStgMedium |
 | ) |  |  | [private]

Definition at line 312 of file DataObj.cpp.

{
    if((m_cfDSObjectNames != pFormatEtc->cfFormat) ||
        !(pFormatEtc->tymed & TYMED_HGLOBAL))
    {
        return DV_E_FORMATETC;
    }

    HRESULT hr;
    CComBSTR sbstrADsPath;

    hr = m_spADObject->get_ADsPath(&sbstrADsPath);
    if(FAILED(hr))
    {
        return hr;
    }

    CComBSTR sbstrClass;
    hr = m_spADObject->get_Class(&sbstrClass);
    if(FAILED(hr))
    {
        return hr;
    }

    hr = E_OUTOFMEMORY;

    // Size of the DSOBJECTNAMES structure.
    DWORD dwBytes = sizeof(DSOBJECTNAMES);

    // Store the offset to the name.
    DWORD dwNameOffset = dwBytes;

    // Length of the ADsPath Unicode string, including the null terminator.
    dwBytes += (sbstrADsPath.Length() + 1) * sizeof(WCHAR);

    // Store the offset to the class.
    DWORD dwClassOffset = dwBytes;

    // Length of the class Unicode string, including the null terminator.
    dwBytes += (sbstrClass.Length() + 1) * sizeof(WCHAR);

    pStgMedium->pUnkForRelease = NULL;
    pStgMedium->tymed = TYMED_HGLOBAL;
    pStgMedium->hGlobal = GlobalAlloc(GPTR, dwBytes);
    if(pStgMedium->hGlobal)
    {
        DSOBJECTNAMES *pObjectNames = (DSOBJECTNAMES*)GlobalLock(pStgMedium->hGlobal);
        if(pObjectNames)
        {
            LPWSTR pwszTemp;

            pObjectNames->clsidNamespace = GUID_NULL;
            pObjectNames->cItems = 1;
            pObjectNames->aObjects[0].dwFlags = 0;
            pObjectNames->aObjects[0].dwProviderFlags = DSPROVIDER_ADVANCED;
            pObjectNames->aObjects[0].offsetName = dwNameOffset;
            pObjectNames->aObjects[0].offsetClass = dwClassOffset;

            // Copy the ADsPath string.
            pwszTemp = (LPWSTR)((LPBYTE)pObjectNames + dwNameOffset);
            lstrcpyW(pwszTemp, sbstrADsPath);

            // Copy the class string.
            pwszTemp = (LPWSTR)((LPBYTE)pObjectNames + dwClassOffset);
            lstrcpyW(pwszTemp, sbstrClass);

            GlobalUnlock(pStgMedium->hGlobal);

            hr = S_OK;
        }
    }

    return hr;
}

HRESULT CPropSheetHost::_GetDSPropSheetConfig | ( | FORMATETC * | pFormatEtc,
 |  | STGMEDIUM * | pStgMedium |
 | ) |  |  | [private]

Definition at line 396 of file DataObj.cpp.

{
    if((m_cfDSPropSheetConfig != pFormatEtc->cfFormat) ||
        !(pFormatEtc->tymed & TYMED_HGLOBAL))
    {
        return DV_E_FORMATETC;
    }

    HRESULT hr = E_OUTOFMEMORY;

    pStgMedium->pUnkForRelease = NULL;
    pStgMedium->tymed = TYMED_HGLOBAL;
    pStgMedium->hGlobal = GlobalAlloc(GPTR, sizeof(PROPSHEETCFG));
    if(pStgMedium->hGlobal)
    {
        PROPSHEETCFG *pPropSheetCfg = (PROPSHEETCFG*)GlobalLock(pStgMedium->hGlobal);
        if(pPropSheetCfg)
        {
            // hwndParentSheet recevies the handle of the window to receive WM_ADSPROP_NOTIFY_CHANGE messages.
            pPropSheetCfg->hwndParentSheet = m_hwndHidden;

            // hwndParentSheet receives the handle of the window that will receive WM_DSA_SHEET_CREATE_NOTIFY and WM_DSA_SHEET_CLOSE_NOTIFY messages.
            pPropSheetCfg->hwndHidden = m_hwndHidden;

            // lNotifyHandle is not used.
            pPropSheetCfg->lNotifyHandle = 0;

            /*
            wParamSheetClose is an identifier that is passed as the wparam in
            the WM_DSA_SHEET_CLOSE_NOTIFY message. If this member is zero, the
            WM_DSA_SHEET_CLOSE_NOTIFY is not posted.
            */
            pPropSheetCfg->wParamSheetClose = PROP_SHEET_HOST_ID;

            GlobalUnlock(pStgMedium->hGlobal);

            hr = S_OK;
        }
    }

    return hr;
}

LRESULT CALLBACK CPropSheetHost::_HiddenWindowProc | ( | HWND | hWnd,
 |  | UINT | uMessage,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static, private]

Definition at line 174 of file PropSheetHost.cpp.

{
    CPropSheetHost *pThis = (CPropSheetHost*)((LONG_PTR)GetWindowLongPtr(hWnd, VIEW_POINTER_OFFSET));

    switch (uMessage)
    {
    case WM_NCCREATE:
        {
            LPCREATESTRUCT lpcs = (LPCREATESTRUCT)lParam;
            pThis = (CPropSheetHost*)(lpcs->lpCreateParams);
            ::SetWindowLongPtr(hWnd, VIEW_POINTER_OFFSET, (LONG)(LONG_PTR)pThis);
        }
        break;

    case WM_CREATE:
        break;

    case WM_DESTROY:
        break;

    case WM_ADSPROP_NOTIFY_CHANGE:
        OutputDebugString(TEXT("WM_ADSPROP_NOTIFY_CHANGE\n"));
        break;

    case WM_DSA_SHEET_CREATE_NOTIFY:
        {
            PDSA_SEC_PAGE_INFO pSecPageInfo;

            // Extract the secondary sheet information from the wParam.
            if(S_OK == pThis->_ExtractSecPageInfo(wParam, &pSecPageInfo))
            {
                // Create a secondary property sheet.
                pThis->_CreateSecondaryPropertySheet(pSecPageInfo);
            }
            else
            {
                // Even if the extraction failed, the wParam needs to be freed.
                pSecPageInfo = (PDSA_SEC_PAGE_INFO)wParam;
            }

            /*
            The receiver of the  message must free the DSA_SEC_PAGE_INFO
            structure when it is no longer needed.
            */
            LocalFree(pSecPageInfo);
        }
        return 0;

    case WM_DSA_SHEET_CLOSE_NOTIFY:
        if(PROP_SHEET_HOST_ID == wParam)
        {
            OutputDebugString(TEXT("PROP_SHEET_HOST_ID\n"));
        }
        return 0;

    default:
        break;
    }

    return DefWindowProc(hWnd, uMessage, wParam, lParam);
}

STDMETHODIMP CPropSheetHost::DAdvise | ( | FORMATETC * | ,
 |  | DWORD | ,
 |  | IAdviseSink * | ,
 |  | LPDWORD |
 | ) |  |
STDMETHODIMP CPropSheetHost::DUnadvise ( DWORD dwConnection )

Definition at line 227 of file DataObj.cpp.

{
    return E_NOTIMPL;
}

STDMETHODIMP CPropSheetHost::EnumDAdvise ( IEnumSTATDATA ** ppEnumAdvise )

Definition at line 238 of file DataObj.cpp.

{
    return E_NOTIMPL;
}

STDMETHODIMP CPropSheetHost::EnumFormatEtc | ( | DWORD | dwDirection,
 |  | IEnumFORMATETC ** | ppEFE
 | ) |  |

Definition at line 188 of file DataObj.cpp.

{
    return E_NOTIMPL;
}

STDMETHODIMP CPropSheetHost::GetCanonicalFormatEtc | ( | LPFORMATETC | pFEIn,
 |  | LPFORMATETC | pFEOut
 | ) |  |

Definition at line 176 of file DataObj.cpp.

{
    return E_NOTIMPL;
}

STDMETHODIMP CPropSheetHost::GetData | ( | FORMATETC * | pFormatEtc,
 |  | STGMEDIUM * | pStgMedium
 | ) |  |

Definition at line 101 of file DataObj.cpp.

{
    if(!pFormatEtc || ! pStgMedium)
    {
        return E_INVALIDARG;
    }

    HRESULT hr = DV_E_FORMATETC;

    if(m_cfDSDispSpecOptions == pFormatEtc->cfFormat)
    {
        hr = _GetDSDispSpecOption(pFormatEtc, pStgMedium);
    }
    else if(m_cfDSObjectNames == pFormatEtc->cfFormat)
    {
        hr = _GetDSObjectNames(pFormatEtc, pStgMedium);
    }
    else if(m_cfDSPropSheetConfig == pFormatEtc->cfFormat)
    {
        hr = _GetDSPropSheetConfig(pFormatEtc, pStgMedium);
    }

    return hr;
}

STDMETHODIMP CPropSheetHost::GetDataHere | ( | FORMATETC * | pFormatEtc,
 |  | STGMEDIUM * | pStgMedium
 | ) |  |

Definition at line 136 of file DataObj.cpp.

{
    return E_NOTIMPL;
}

STDMETHODIMP CPropSheetHost::QueryGetData ( FORMATETC * pFormatEtc )

Definition at line 152 of file DataObj.cpp.

{
    if(this->m_cfDSDispSpecOptions == pFormatEtc->cfFormat)
    {
        return S_OK;
    }
    else if(this->m_cfDSObjectNames == pFormatEtc->cfFormat)
    {
        return S_OK;
    }
    else if(this->m_cfDSPropSheetConfig == pFormatEtc->cfFormat)
    {
        return S_OK;
    }

    return DV_E_FORMATETC;
}

STDMETHODIMP CPropSheetHost::QueryInterface | ( | REFIID | ,
 |  | LPVOID FAR * |
 | ) |  |
void CPropSheetHost::Run ( )

Definition at line 98 of file PropSheetHost.cpp.

{
    if(!m_spADObject.p)
    {
        return;
    }

    // Create the hidden window.
    m_hwndHidden = _CreateHiddenWindow();
    if(!m_hwndHidden)
    {
        return;
    }

    /*
    Display the proeprty sheet. This is a modal call and will not return
    until the property sheet is dimissed.
    */
    _CreatePropertySheet();

    // Destroy the hidden window.
    DestroyWindow(m_hwndHidden);
}

STDMETHODIMP CPropSheetHost::SetData | ( | LPFORMATETC | pFormatEtc,
 |  | LPSTGMEDIUM | pStgMedium,
 |  | BOOL | fRelease
 | ) |  |

Definition at line 200 of file DataObj.cpp.

{
    return E_NOTIMPL;
}

HRESULT CPropSheetHost::SetObject ( LPCWSTR pwszADsPath )

Definition at line 67 of file PropSheetHost.cpp.

{
    CComPtr<IADs> spADsTemp;
    HRESULT hr = ADsGetObject(pwszADsPath, IID_IADs, (LPVOID*)&spADsTemp);
    if(FAILED(hr))
    {
        return hr;
    }

    return SetObject(spADsTemp);
}

HRESULT CPropSheetHost::SetObject ( IADs * pads )

Definition at line 85 of file PropSheetHost.cpp.

{
    HRESULT hr = pads->QueryInterface(IID_IADs, (LPVOID*)&m_spADObject);

    return hr;
}

CPropSheetHost::STDMETHODIMP_ ( DWORD )
CPropSheetHost::STDMETHODIMP_ ( DWORD )

Member Data Documentation

ATOM CPropSheetHost::m_cfDSDispSpecOptions [private]

Definition at line 107 of file PropSheetHost.h.

ATOM CPropSheetHost::m_cfDSObjectNames [private]

Definition at line 106 of file PropSheetHost.h.

ATOM CPropSheetHost::m_cfDSPropSheetConfig [private]

Definition at line 105 of file PropSheetHost.h.

HINSTANCE CPropSheetHost::m_hInst [private]

Definition at line 110 of file PropSheetHost.h.

HWND CPropSheetHost::m_hwndHidden [private]

Definition at line 102 of file PropSheetHost.h.

HWND CPropSheetHost::m_hwndParent [private]

Definition at line 101 of file PropSheetHost.h.

DWORD CPropSheetHost::m_ObjRefCount [private]

Definition at line 103 of file PropSheetHost.h.

LPWSTR CPropSheetHost::m_pwszPrefix [private]

Definition at line 111 of file PropSheetHost.h.

CSimpleArray<HPROPSHEETPAGE> CPropSheetHost::m_rgPageHandles [private]

Definition at line 108 of file PropSheetHost.h.

CComPtr<IADs> CPropSheetHost::m_spADObject [private]

Definition at line 104 of file PropSheetHost.h.

LPTSTR CPropSheetHost::m_szHiddenWindowClass [private]

Definition at line 109 of file PropSheetHost.h.

The documentation for this class was generated from the following files:
  • NetDS/ActiveDirectory/PropSheetHost/PropSheetHost.h
  • NetDS/ActiveDirectory/PropSheetHost/DataObj.cpp
  • NetDS/ActiveDirectory/PropSheetHost/PropSheetHost.cpp
Generated on Wed Nov 13 2024 16:57:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPropSheetLite Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CPropSheetLite Class Reference

#include "cdialoglite.h"

Inherits CWndLite.

Inherited by CFullConnect, and COptionsSheet.

List of all members.

Public Member Functions

CPropSheetLite (TCHAR *ptszTitle=NULL, HICON hIcon=NULL)
virtual | ~CPropSheetLite ()
virtual void | AddPage (CPropPageLite *pCPropPageLite)
virtual LRESULT | DoModal (HWND hWndParent, INT nStartPage=0)

Public Attributes

PROPSHEETHEADER | m_psHeader

Detailed Description

Definition at line 980 of file cdialoglite.h.

Constructor & Destructor Documentation

CPropSheetLite::CPropSheetLite | ( | TCHAR * | ptszTitle = NULL,
 |  | HICON | hIcon = NULL
 | ) |  |

Definition at line 4084 of file cdialoglite.cpp.

{
  memset(&m_psHeader, 0, sizeof(PROPSHEETPAGE));

    //PROPSHEETHEADER
    m_psHeader.dwSize     = sizeof(PROPSHEETHEADER);
    m_psHeader.dwFlags      = PSH_USEHICON | PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW;
    m_psHeader.hwndParent   = NULL;
    m_psHeader.hInstance    = GetAppLite()->m_hInstance;
  m_psHeader.hIcon      = hIcon;
    m_psHeader.pszCaption   = ptszTitle;
    m_psHeader.nPages     = 0;
    m_psHeader.nStartPage   = 0;
    m_psHeader.ppsp       = NULL;
}

CPropSheetLite::~CPropSheetLite ( ) [virtual]

Definition at line 4105 of file cdialoglite.cpp.

{
  SAFE_FREE(m_psHeader.ppsp);
}

Member Function Documentation

void CPropSheetLite::AddPage ( CPropPageLite * pCPropPageLite ) [virtual]

Definition at line 4116 of file cdialoglite.cpp.

{
  ASSERT(pCPropPageLite);
  HRESULT hr = S_OK;

  //Set the Pages parent (this sheet)
  pCPropPageLite->SetParent(this);

  //Enlarge the array
  SAFE_REALLOC(m_psHeader.ppsp, PROPSHEETPAGE, m_psHeader.nPages+1);

  //Copy into our array
  memcpy((void*)&m_psHeader.ppsp[m_psHeader.nPages], &pCPropPageLite->m_psPage, sizeof(PROPSHEETPAGE));
  m_psHeader.nPages++;

CLEANUP:
  ;
}

LRESULT CPropSheetLite::DoModal | ( | HWND | hWndParent,
 |  | INT | nStartPage = 0 |
 | ) |  |  | [virtual]

Definition at line 4140 of file cdialoglite.cpp.

{
  //Display the Property Sheet
    m_psHeader.hwndParent = hWndParent;
  m_psHeader.nStartPage = nStartPage;
    return PropertySheet(&m_psHeader);
}

Member Data Documentation

PROPSHEETHEADER CPropSheetLite::m_psHeader

Definition at line 992 of file cdialoglite.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialoglite.h
  • Dataaccess/oledb/rowsetviewer/cdialoglite.cpp
Generated on Wed Nov 13 2024 16:57:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CProvFactory Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CProvFactory Class Reference

#include "Sample.h"

List of all members.

Public Member Functions

CProvFactory (void)
CProvFactory (void)
CProvFactory (void)
CProvFactory (void)
~CProvFactory (void)
~CProvFactory (void)
~CProvFactory (void)
~CProvFactory (void)
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, PPVOID)
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, PPVOID)
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, PPVOID)
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, PPVOID)
STDMETHODIMP | LockServer (BOOL)
STDMETHODIMP | LockServer (BOOL)
STDMETHODIMP | LockServer (BOOL)
STDMETHODIMP | LockServer (BOOL)
STDMETHODIMP | QueryInterface (REFIID, PPVOID)
STDMETHODIMP | QueryInterface (REFIID, PPVOID)
STDMETHODIMP | QueryInterface (REFIID, PPVOID)
STDMETHODIMP | QueryInterface (REFIID, PPVOID)
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) AddRef(void)

Protected Attributes

ULONG m_cRef

Detailed Description

Definition at line 200 of file Sample.h.

Constructor & Destructor Documentation

CProvFactory::CProvFactory ( void )

Definition at line 35 of file ClassFac.Cpp.

{
    m_cRef=0L;
    return;
}

CProvFactory::~CProvFactory ( void )

Definition at line 41 of file ClassFac.Cpp.

{
    return;
}

CProvFactory::CProvFactory ( void )
CProvFactory::~CProvFactory ( void )
CProvFactory::CProvFactory ( void )
CProvFactory::~CProvFactory ( void )
CProvFactory::CProvFactory ( void )
CProvFactory::~CProvFactory ( void )

Member Function Documentation

STDMETHODIMP CProvFactory::CreateInstance | ( | LPUNKNOWN | pUnkOuter,
 |  | REFIID | riid,
 |  | PPVOID | ppvObj
 | ) |  |

Definition at line 107 of file ClassFac.Cpp.

{
    CClassPro *   pObj;
    HRESULT hr;

    *ppvObj=NULL;

    // This object doesnt support aggregation.

    if (NULL!=pUnkOuter)
        return CLASS_E_NOAGGREGATION;

    // Create the locator object.

    pObj=new CClassPro();
    if (NULL==pObj)
        return E_OUTOFMEMORY;

    hr=pObj->QueryInterface(riid, ppvObj);

    //Kill the object if initial creation or Init failed.

    if (FAILED(hr))
        delete pObj;
    return hr;
}

STDMETHODIMP CProvFactory::CreateInstance | ( | LPUNKNOWN | ,
 |  | REFIID | ,
 |  | PPVOID |
 | ) |  |
STDMETHODIMP CProvFactory::CreateInstance | ( | LPUNKNOWN | ,
 |  | REFIID | ,
 |  | PPVOID |
 | ) |  |
STDMETHODIMP CProvFactory::CreateInstance | ( | LPUNKNOWN | ,
 |  | REFIID | ,
 |  | PPVOID |
 | ) |  |
STDMETHODIMP CProvFactory::LockServer ( BOOL fLock )

Definition at line 153 of file ClassFac.Cpp.

{
    if (fLock)
        InterlockedIncrement(&g_cLock);
    else
        InterlockedDecrement(&g_cLock);
    return NOERROR;
}

STDMETHODIMP CProvFactory::LockServer ( BOOL )
STDMETHODIMP CProvFactory::LockServer ( BOOL )
STDMETHODIMP CProvFactory::LockServer ( BOOL )
STDMETHODIMP CProvFactory::QueryInterface | ( | REFIID | ,
 |  | PPVOID |
 | ) |  |
STDMETHODIMP CProvFactory::QueryInterface | ( | REFIID | riid,
 |  | PPVOID | ppv
 | ) |  |

Definition at line 57 of file ClassFac.Cpp.

{
    *ppv=NULL;

    if (IID_IUnknown==riid || IID_IClassFactory==riid)
        *ppv=this;

    if (NULL!=*ppv)
        {
        ((LPUNKNOWN)*ppv)->AddRef();
        return NOERROR;
        }

    return E_NOINTERFACE;
}

STDMETHODIMP CProvFactory::QueryInterface | ( | REFIID | ,
 |  | PPVOID |
 | ) |  |
STDMETHODIMP CProvFactory::QueryInterface | ( | REFIID | ,
 |  | PPVOID |
 | ) |  |
CProvFactory::STDMETHODIMP_ ( ULONG )
CProvFactory::STDMETHODIMP_ ( ULONG )
CProvFactory::STDMETHODIMP_ ( ULONG )
CProvFactory::STDMETHODIMP_ ( ULONG )
CProvFactory::STDMETHODIMP_ ( ULONG )
CProvFactory::STDMETHODIMP_ ( ULONG )
CProvFactory::STDMETHODIMP_ ( ULONG )
CProvFactory::STDMETHODIMP_ ( ULONG )

Member Data Documentation

ULONG CProvFactory::m_cRef [protected]

Definition at line 203 of file Sample.h.

The documentation for this class was generated from the following files:
  • SysMgmt/WMI/VC/ClassProv/Sample.h
  • SysMgmt/WMI/VC/InstProv/Sample.h
  • SysMgmt/WMI/VC/MethProv/MethProv.h
  • SysMgmt/WMI/VC/PropProv/Sample.h
  • SysMgmt/WMI/VC/ClassProv/ClassFac.Cpp
  • SysMgmt/WMI/VC/InstProv/ClassFac.Cpp
  • SysMgmt/WMI/VC/MethProv/ClassFac.Cpp
  • SysMgmt/WMI/VC/PropProv/ClassFac.Cpp
Generated on Wed Nov 13 2024 16:57:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CProvider Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CProvider Class Reference

#include "Provider.h"

List of all members.

Public Member Functions

CProvider (CListBox *pOutputList)
CProvider (CListBox *pOutputList)
~CProvider ()
~CProvider ()
STDMETHOD() | FindConsumer (IWbemClassObject *pLogicalConsumer, IWbemUnboundObjectSink **ppConsumer)
STDMETHOD() | FindConsumer (IWbemClassObject *pLogicalConsumer, IWbemUnboundObjectSink **ppConsumer)
STDMETHOD() | Initialize (LPWSTR pszUser, LONG lFlags, LPWSTR pszNamespace, LPWSTR pszLocale, IWbemServices __RPC_FAR *pNamespace, IWbemContext __RPC_FAR *pCtx, IWbemProviderInitSink __RPC_FAR *pInitSink)
STDMETHODIMP | QueryInterface (REFIID, LPVOID *)
STDMETHODIMP | QueryInterface (REFIID, LPVOID *)
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP_ (ULONG) Release(void)

Private Attributes

DWORD m_cRef
CListBox * | m_pOutputList

Detailed Description

Definition at line 17 of file Provider.h.

Constructor & Destructor Documentation

CProvider::CProvider ( CListBox * pOutputList )

Definition at line 19 of file Provider.Cpp.

{
  m_cRef = 0L;
  m_pOutputList = pOutputList;
}

CProvider::~CProvider ( )

Definition at line 25 of file Provider.Cpp.

{
}

CProvider::CProvider ( CListBox * pOutputList )
CProvider::~CProvider ( )

Member Function Documentation

STDMETHODIMP CProvider::FindConsumer | ( | IWbemClassObject * | pLogicalConsumer,
 |  | IWbemUnboundObjectSink ** | ppConsumer
 | ) |  |

Definition at line 60 of file Provider.Cpp.

{
  // create the logical consumer.
  CConsumer* pSink = new CConsumer(m_pOutputList);
  if (pSink == NULL)
    return E_OUTOFMEMORY;

  // return it's "sink" interface.
  return pSink->QueryInterface(IID_IWbemUnboundObjectSink,
                                        (void**)ppConsumer);
}

STDMETHOD() CProvider::FindConsumer | ( | IWbemClassObject * | pLogicalConsumer,
 |  | IWbemUnboundObjectSink ** | ppConsumer
 | ) |  |
STDMETHODIMP CProvider::Initialize | ( | LPWSTR | pszUser,
 |  | LONG | lFlags,
 |  | LPWSTR | pszNamespace,
 |  | LPWSTR | pszLocale,
 |  | IWbemServices __RPC_FAR * | pNamespace,
 |  | IWbemContext __RPC_FAR * | pCtx,
 |  | IWbemProviderInitSink __RPC_FAR * | pInitSink
 | ) |  |

Definition at line 59 of file Provider.Cpp.

{

    // Tell CIMOM that we are initialized
    pInitSink->SetStatus(WBEM_S_INITIALIZED, 0);
    return WBEM_S_NO_ERROR;
}

STDMETHODIMP CProvider::QueryInterface | ( | REFIID | ,
 |  | LPVOID * |
 | ) |  |
STDMETHODIMP CProvider::QueryInterface | ( | REFIID | ,
 |  | LPVOID * |
 | ) |  |
CProvider::STDMETHODIMP_ ( ULONG )
CProvider::STDMETHODIMP_ ( ULONG )
CProvider::STDMETHODIMP_ ( ULONG )
CProvider::STDMETHODIMP_ ( ULONG )

Member Data Documentation

DWORD CProvider::m_cRef [private]

Definition at line 36 of file Provider.h.

CListBox * CProvider::m_pOutputList [private]

Definition at line 37 of file Provider.h.

The documentation for this class was generated from the following files:
  • SysMgmt/WMI/VC/CmdLineConsumer/Provider.h
  • SysMgmt/WMI/VC/EventConsumer/Provider.h
  • SysMgmt/WMI/VC/CmdLineConsumer/Provider.Cpp
  • SysMgmt/WMI/VC/EventConsumer/Provider.Cpp
Generated on Wed Nov 13 2024 16:57:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CProvider_IWbemEventConsumerProvider Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CProvider_IWbemEventConsumerProvider Class Reference

#include "Events.h"

List of all members.

Public Member Functions

CProvider_IWbemEventConsumerProvider ()
~CProvider_IWbemEventConsumerProvider ()
HRESULT STDMETHODCALLTYPE | FindConsumer (IWbemClassObject *a_LogicalConsumer, IWbemUnboundObjectSink **a_Consumer)
HRESULT STDMETHODCALLTYPE | Initialize (LPWSTR a_User, LONG a_Flags, LPWSTR a_Namespace, LPWSTR a_Locale, IWbemServices *a_Core, IWbemContext *a_Context, IWbemProviderInitSink *a_Sink)
STDMETHODIMP | QueryInterface (REFIID, LPVOID FAR *)
HRESULT STDMETHODCALLTYPE | Shutdown (LONG a_Flags, ULONG a_MaxMilliSeconds, IWbemContext *a_Context)
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()

Private Attributes

IWbemServices * | m_CoreService
BSTR | m_Locale
BSTR | m_Namespace
LONG | m_ReferenceCount
BSTR | m_User

Detailed Description

Definition at line 32 of file Events.h.

Constructor & Destructor Documentation

CProvider_IWbemEventConsumerProvider::CProvider_IWbemEventConsumerProvider ( )

Definition at line 34 of file Events.cpp.

                                                                             :

  m_ReferenceCount ( 0 ) ,
  m_User ( NULL ) ,
  m_Locale ( NULL ) ,
  m_Namespace ( NULL ) ,
  m_CoreService ( NULL )
{
  InterlockedIncrement ( & Provider_Globals :: s_ObjectsInProgress ) ;
}

CProvider_IWbemEventConsumerProvider::~CProvider_IWbemEventConsumerProvider ( )

Definition at line 56 of file Events.cpp.

{
  if ( m_User )
  {
    SysFreeString ( m_User ) ;
  }

  if ( m_Locale )
  {
    SysFreeString ( m_Locale ) ;
  }

  if ( m_Namespace )
  {
    SysFreeString ( m_Namespace ) ;
  }

  if ( m_CoreService )
  {
    m_CoreService->Release () ;
  }

  InterlockedDecrement ( & Provider_Globals :: s_ObjectsInProgress ) ;
}

Member Function Documentation

HRESULT CProvider_IWbemEventConsumerProvider::FindConsumer | ( | IWbemClassObject * | a_LogicalConsumer,
 |  | IWbemUnboundObjectSink ** | a_Consumer
 | ) |  |

Definition at line 206 of file Events.cpp.

{
  HRESULT t_Result = S_OK ;

  if ( a_Consumer )
  {
/*
 *  Cleanup the outgoing parameter
 */

    *a_Consumer = NULL ;

    CProvider_IWbemUnboundObjectSink *t_Sink = new CProvider_IWbemUnboundObjectSink ;
    if ( t_Sink )
    {
/*
 *  AddRef for outgoing parameter ;
 */

      t_Sink->AddRef () ;

      *a_Consumer = t_Sink ;
    }
    else
    {
      t_Result = WBEM_E_OUT_OF_MEMORY ;
    }
  }
  else
  {
    t_Result = WBEM_E_INVALID_PARAMETER ;
  }

  return t_Result ;
}

HRESULT CProvider_IWbemEventConsumerProvider::Initialize | ( | LPWSTR | a_User,
 |  | LONG | a_Flags,
 |  | LPWSTR | a_Namespace,
 |  | LPWSTR | a_Locale,
 |  | IWbemServices * | a_Core,
 |  | IWbemContext * | a_Context,
 |  | IWbemProviderInitSink * | a_Sink
 | ) |  |

Definition at line 259 of file Events.cpp.

{
  HRESULT t_Result = S_OK ;

  if ( a_CoreService )
  {
/*
 *  Interface we can call back to retrieve WMI related information, class definitions, etc.
 */
    m_CoreService = a_CoreService ;
    m_CoreService->AddRef () ;
  }
  else
  {
    t_Result = WBEM_E_INVALID_PARAMETER ;
  }

  if ( SUCCEEDED ( t_Result ) )
  {
    if ( a_User )
    {
      m_User = SysAllocString ( a_User ) ;
      if ( m_User == NULL )
      {
        t_Result = WBEM_E_OUT_OF_MEMORY ;
      }
    }
  }

  if ( SUCCEEDED ( t_Result ) )
  {
    if ( a_Locale )
    {
      m_Locale = SysAllocString ( a_Locale ) ;
      if ( m_Locale == NULL )
      {
        t_Result = WBEM_E_OUT_OF_MEMORY ;
      }
    }
  }

  if ( SUCCEEDED ( t_Result ) )
  {
    if ( a_Namespace )
    {
      m_Namespace = SysAllocString ( a_Namespace ) ;
      if ( m_Namespace == NULL )
      {
        t_Result = WBEM_E_OUT_OF_MEMORY ;
      }
    }
  }

/*
 *  Indicate to WMI status of call.
 */

  a_Sink->SetStatus ( t_Result , 0 ) ;

/*
 *  returning failing means that WMI need not check status specified in SetStatus call.
 */

  return t_Result ;
}

STDMETHODIMP CProvider_IWbemEventConsumerProvider::QueryInterface | ( | REFIID | a_Riid,
 |  | LPVOID FAR * | a_Void
 | ) |  |

Definition at line 135 of file Events.cpp.

{
/*
 *  Just clean up out parameter first.
 */

  *a_Void = NULL ;

  if ( a_Riid == IID_IUnknown )
  {
    *a_Void = ( LPVOID ) this ;
  }
  else if ( a_Riid == IID_IWbemEventConsumerProvider )
  {
/*
 *  Make sure we support event consumer interface IWbemEventConsumerProvider
 */

    *a_Void = ( LPVOID ) ( IWbemEventConsumerProvider * ) this ;
  }
  else if ( a_Riid == IID_IWbemProviderInit )
  {
/*
 *  We support optional interface IWbemProviderInit
 */

    *a_Void = ( LPVOID ) ( IWbemProviderInit * ) this ;
  }
  else if ( a_Riid == IID_IWbemShutdown )
  {
/*
 *  We support optional interface IWbemShutdown
 */

    *a_Void = ( LPVOID ) ( IWbemShutdown * ) this ;
  }

/*
 *  Retain a reference on outgoing parameter.
 */

  if ( *a_Void )
  {
    ( ( LPUNKNOWN ) *a_Void )->AddRef () ;

    return ResultFromScode ( S_OK ) ;
  }
  else
  {
    return ResultFromScode ( E_NOINTERFACE ) ;
  }
}

HRESULT CProvider_IWbemEventConsumerProvider::Shutdown | ( | LONG | a_Flags,
 |  | ULONG | a_MaxMilliSeconds,
 |  | IWbemContext * | a_Context
 | ) |  |

Definition at line 347 of file Events.cpp.

{
  HRESULT t_Result = S_OK ;

  return t_Result ;
}

CProvider_IWbemEventConsumerProvider::STDMETHODIMP_ ( ULONG )
CProvider_IWbemEventConsumerProvider::STDMETHODIMP_ ( ULONG )

Member Data Documentation

IWbemServices* CProvider_IWbemEventConsumerProvider::m_CoreService [private]

Definition at line 46 of file Events.h.

BSTR CProvider_IWbemEventConsumerProvider::m_Locale [private]

Definition at line 51 of file Events.h.

BSTR CProvider_IWbemEventConsumerProvider::m_Namespace [private]

Definition at line 50 of file Events.h.

LONG CProvider_IWbemEventConsumerProvider::m_ReferenceCount [private]

Definition at line 42 of file Events.h.

BSTR CProvider_IWbemEventConsumerProvider::m_User [private]

Definition at line 52 of file Events.h.

The documentation for this class was generated from the following files:
  • SysMgmt/WMI/VC/decoupled/Event_Consumer/Include/Events.h
  • SysMgmt/WMI/VC/decoupled/Event_Consumer/Events.cpp
Generated on Wed Nov 13 2024 16:57:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CProvider_IWbemEventProvider Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Private Member Functions | Private Attributes

CProvider_IWbemEventProvider Class Reference

#include "Events.h"

List of all members.

Public Member Functions

CProvider_IWbemEventProvider ()
~CProvider_IWbemEventProvider ()
HRESULT STDMETHODCALLTYPE | Initialize (LPWSTR a_User, LONG a_Flags, LPWSTR a_Namespace, LPWSTR a_Locale, IWbemServices *a_Core, IWbemContext *a_Context, IWbemProviderInitSink *a_Sink)
HRESULT STDMETHODCALLTYPE | ProvideEvents (IWbemObjectSink *a_Sink, LONG a_Flags)
STDMETHODIMP | QueryInterface (REFIID, LPVOID FAR *)
HRESULT STDMETHODCALLTYPE | Shutdown (LONG a_Flags, ULONG a_MaxMilliSeconds, IWbemContext *a_Context)
STDMETHODIMP_ (ULONG) InternalRelease()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) InternalAddRef()
STDMETHODIMP_ (ULONG) AddRef()

Static Private Member Functions

static DWORD | ThreadExecutionFunction (void *a_Context)

Private Attributes

IWbemServices * | m_CoreService
CRITICAL_SECTION | m_CriticalSection
IWbemClassObject * | m_EventObject
IWbemObjectSink * | m_EventSink
LONG | m_InternalReferenceCount
BSTR | m_Locale
BSTR | m_Namespace
LONG | m_ReferenceCount
HANDLE m_ThreadHandle
HANDLE m_ThreadTerminate
BSTR | m_User

Detailed Description

Definition at line 29 of file Events.h.

Constructor & Destructor Documentation

CProvider_IWbemEventProvider::CProvider_IWbemEventProvider ( )

Definition at line 33 of file Events.cpp.

                                                              :

  m_ReferenceCount ( 0 ) ,
  m_InternalReferenceCount ( 0 ) ,
  m_User ( NULL ) ,
  m_Locale ( NULL ) ,
  m_Namespace ( NULL ) ,
  m_CoreService ( NULL ) ,
  m_EventObject ( NULL ) ,
  m_EventSink ( NULL ) ,
  m_ThreadHandle ( NULL )
{
  InitializeCriticalSection ( & m_CriticalSection ) ;

  InterlockedIncrement ( & Provider_Globals :: s_ObjectsInProgress ) ;
}

CProvider_IWbemEventProvider::~CProvider_IWbemEventProvider ( )

Definition at line 60 of file Events.cpp.

{
  DeleteCriticalSection ( & m_CriticalSection ) ;

  if ( m_EventObject )
  {
    m_EventObject->Release () ;
  }

  if ( m_EventSink )
  {
    m_EventSink->Release () ;
  }

  if ( m_User )
  {
    SysFreeString ( m_User ) ;
  }

  if ( m_Locale )
  {
    SysFreeString ( m_Locale ) ;
  }

  if ( m_Namespace )
  {
    SysFreeString ( m_Namespace ) ;
  }

  if ( m_CoreService )
  {
    m_CoreService->Release () ;
  }

  InterlockedDecrement ( & Provider_Globals :: s_ObjectsInProgress ) ;
}

Member Function Documentation

HRESULT CProvider_IWbemEventProvider::Initialize | ( | LPWSTR | a_User,
 |  | LONG | a_Flags,
 |  | LPWSTR | a_Namespace,
 |  | LPWSTR | a_Locale,
 |  | IWbemServices * | a_Core,
 |  | IWbemContext * | a_Context,
 |  | IWbemProviderInitSink * | a_Sink
 | ) |  |

Definition at line 244 of file Events.cpp.

{
  HRESULT t_Result = S_OK ;

  if ( a_CoreService )
  {
    m_CoreService = a_CoreService ;
    m_CoreService->AddRef () ;
  }
  else
  {
    t_Result = WBEM_E_INVALID_PARAMETER ;
  }

  if ( SUCCEEDED ( t_Result ) )
  {
    if ( a_User )
    {
      m_User = SysAllocString ( a_User ) ;
      if ( m_User == NULL )
      {
        t_Result = WBEM_E_OUT_OF_MEMORY ;
      }
    }
  }

  if ( SUCCEEDED ( t_Result ) )
  {
    if ( a_Locale )
    {
      m_Locale = SysAllocString ( a_Locale ) ;
      if ( m_Locale == NULL )
      {
        t_Result = WBEM_E_OUT_OF_MEMORY ;
      }
    }
  }

  if ( SUCCEEDED ( t_Result ) )
  {
    if ( a_Namespace )
    {
      m_Namespace = SysAllocString ( a_Namespace ) ;
      if ( m_Namespace == NULL )
      {
        t_Result = WBEM_E_OUT_OF_MEMORY ;
      }
    }
  }

  if ( SUCCEEDED ( t_Result ) )
  {
    BSTR t_Class = SysAllocString ( L"SampleEvent" ) ;
    if ( t_Class )
    {
      t_Result = m_CoreService->GetObject (

        t_Class ,
        0 ,
        a_Context ,
        & m_EventObject ,
        NULL
      ) ;

      if ( SUCCEEDED ( t_Result ) )
      {
      }

      SysFreeString ( t_Class ) ;
    }
    else
    {
      t_Result = WBEM_E_OUT_OF_MEMORY ;
    }
  }

  m_ThreadTerminate = CreateEvent ( NULL , FALSE , FALSE , NULL ) ;
  if ( m_ThreadTerminate == NULL )
  {
    t_Result = WBEM_E_OUT_OF_MEMORY ;
  }

  a_Sink->SetStatus ( t_Result , 0 ) ;

  return t_Result ;
}

HRESULT CProvider_IWbemEventProvider::ProvideEvents | ( | IWbemObjectSink * | a_Sink,
 |  | LONG | a_Flags
 | ) |  |

Definition at line 467 of file Events.cpp.

{
  HRESULT t_Result = S_OK ;

  m_EventSink = a_Sink ;
  m_EventSink->AddRef () ;

  InternalAddRef () ;

  DWORD t_ThreadId = 0 ;
  m_ThreadHandle = CreateThread (

    NULL ,
    0 ,
    ( LPTHREAD_START_ROUTINE ) ThreadExecutionFunction ,
    this ,
    0 ,
    & t_ThreadId
  ) ;

  if ( m_ThreadHandle == NULL )
  {
    InternalRelease () ;
  }

  return t_Result ;
}

STDMETHODIMP CProvider_IWbemEventProvider::QueryInterface | ( | REFIID | a_Riid,
 |  | LPVOID FAR * | a_Void
 | ) |  |

Definition at line 197 of file Events.cpp.

{
  *a_Void = NULL ;

  if ( a_Riid == IID_IUnknown )
  {
    *a_Void = ( LPVOID ) this ;
  }
  else if ( a_Riid == IID_IWbemEventProvider )
  {
    *a_Void = ( LPVOID ) ( IWbemEventProvider * ) this ;
  }
  else if ( a_Riid == IID_IWbemProviderInit )
  {
    *a_Void = ( LPVOID ) ( IWbemProviderInit * ) this ;
  }
  else if ( a_Riid == IID_IWbemShutdown )
  {
    *a_Void = ( LPVOID ) ( IWbemShutdown * ) this ;
  }

  if ( *a_Void )
  {
    ( ( LPUNKNOWN ) *a_Void )->AddRef () ;

    return ResultFromScode ( S_OK ) ;
  }
  else
  {
    return ResultFromScode ( E_NOINTERFACE ) ;
  }
}

HRESULT CProvider_IWbemEventProvider::Shutdown | ( | LONG | a_Flags,
 |  | ULONG | a_MaxMilliSeconds,
 |  | IWbemContext * | a_Context
 | ) |  |

Definition at line 350 of file Events.cpp.

{
  HRESULT t_Result = S_OK ;

  return t_Result ;
}

CProvider_IWbemEventProvider::STDMETHODIMP_ ( ULONG )
CProvider_IWbemEventProvider::STDMETHODIMP_ ( ULONG )
CProvider_IWbemEventProvider::STDMETHODIMP_ ( ULONG )
CProvider_IWbemEventProvider::STDMETHODIMP_ ( ULONG )
DWORD CProvider_IWbemEventProvider::ThreadExecutionFunction ( void * a_Context ) [static, private]

Definition at line 372 of file Events.cpp.

{
  HRESULT t_Result = S_OK ;

  CProvider_IWbemEventProvider *t_This = ( CProvider_IWbemEventProvider * ) a_Context ;
  if ( t_This )
  {
    t_Result = CoInitializeEx (

      0,
      COINIT_MULTITHREADED
    ) ;

    if ( SUCCEEDED ( t_Result ) )
    {
      IWbemClassObject *t_Instance = NULL ;
      t_Result = t_This->m_EventObject->SpawnInstance ( 0 , & t_Instance ) ;
      if ( SUCCEEDED ( t_Result ) )
      {
        VARIANT t_Variant ;
        VariantInit ( & t_Variant ) ;

        t_Variant.vt = VT_BSTR ;
        t_Variant.bstrVal = SysAllocString ( L"Steve" ) ;

        if (t_Variant.bstrVal)
        {
          t_Result = t_Instance->Put (

            L"Name" ,
            0 ,
            & t_Variant ,
            CIM_EMPTY
          ) ;
        }
        else
        {
          t_Result = WBEM_E_OUT_OF_MEMORY;
        }

        VariantClear ( & t_Variant ) ;

        if ( SUCCEEDED ( t_Result ) )
        {
          BOOL t_Continue = TRUE ;
          while ( t_Continue )
          {
            DWORD t_Status = WaitForSingleObject ( t_This->m_ThreadTerminate , 1000 ) ;
            switch ( t_Status )
            {
              case WAIT_TIMEOUT:
              {
                t_This->m_EventSink->Indicate ( 1 , & t_Instance ) ;
              }
              break ;

              case WAIT_OBJECT_0:
              {
                t_Continue = FALSE ;
              }
              break ;

              default:
              {
                t_Continue = FALSE ;
              }
              break ;
            }
          }
        }

        t_Instance->Release () ;
      }
    }

    t_This->InternalRelease () ;
  }
  else
  {
    t_Result = WBEM_E_INVALID_PARAMETER ;
  }

  return t_Result ;
}

Member Data Documentation

IWbemServices* CProvider_IWbemEventProvider::m_CoreService [private]

Definition at line 40 of file Events.h.

CRITICAL_SECTION CProvider_IWbemEventProvider::m_CriticalSection [private]

Definition at line 38 of file Events.h.

IWbemClassObject* CProvider_IWbemEventProvider::m_EventObject [private]

Definition at line 41 of file Events.h.

IWbemObjectSink* CProvider_IWbemEventProvider::m_EventSink [private]

Definition at line 42 of file Events.h.

LONG CProvider_IWbemEventProvider::m_InternalReferenceCount [private]

Definition at line 36 of file Events.h.

BSTR CProvider_IWbemEventProvider::m_Locale [private]

Definition at line 48 of file Events.h.

BSTR CProvider_IWbemEventProvider::m_Namespace [private]

Definition at line 47 of file Events.h.

LONG CProvider_IWbemEventProvider::m_ReferenceCount [private]

Definition at line 35 of file Events.h.

HANDLE CProvider_IWbemEventProvider::m_ThreadHandle [private]

Definition at line 45 of file Events.h.

HANDLE CProvider_IWbemEventProvider::m_ThreadTerminate [private]

Definition at line 44 of file Events.h.

BSTR CProvider_IWbemEventProvider::m_User [private]

Definition at line 49 of file Events.h.

The documentation for this class was generated from the following files:
  • SysMgmt/WMI/VC/decoupled/Event_Provider/Include/Events.h
  • SysMgmt/WMI/VC/decoupled/Event_Provider/Events.cpp
Generated on Wed Nov 13 2024 16:57:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CProvider_IWbemServices Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CProvider_IWbemServices Class Reference

#include "Service.h"

List of all members.

Public Member Functions

CProvider_IWbemServices ()
~CProvider_IWbemServices ()
HRESULT STDMETHODCALLTYPE | CancelAsyncCall (IWbemObjectSink *a_Sink)
HRESULT STDMETHODCALLTYPE | CreateClassEnum (const BSTR a_Superclass, long a_Flags, IWbemContext *a_Context, IEnumWbemClassObject **a_Enum)
HRESULT STDMETHODCALLTYPE | CreateClassEnumAsync (const BSTR a_Superclass, long a_Flags, IWbemContext *a_Context, IWbemObjectSink *a_Sink)
HRESULT STDMETHODCALLTYPE | CreateInstanceEnum (const BSTR a_Class, long a_Flags, IWbemContext *a_Context, IEnumWbemClassObject **a_Enum)
HRESULT STDMETHODCALLTYPE | CreateInstanceEnumAsync (const BSTR a_Class, long a_Flags, IWbemContext *a_Context, IWbemObjectSink *a_Sink)
HRESULT STDMETHODCALLTYPE | DeleteClass (const BSTR a_Class, long a_Flags, IWbemContext *a_Context, IWbemCallResult **a_CallResult)
HRESULT STDMETHODCALLTYPE | DeleteClassAsync (const BSTR a_Class, long a_Flags, IWbemContext *a_Context, IWbemObjectSink *a_Sink)
HRESULT STDMETHODCALLTYPE | DeleteInstance (const BSTR a_ObjectPath, long a_Flags, IWbemContext *a_Context, IWbemCallResult **a_CallResult)
HRESULT STDMETHODCALLTYPE | DeleteInstanceAsync (const BSTR a_ObjectPath, long a_Flags, IWbemContext *a_Context, IWbemObjectSink *a_Sink)
HRESULT STDMETHODCALLTYPE | ExecMethod (const BSTR a_ObjectPath, const BSTR a_MethodName, long a_Flags, IWbemContext *a_Context, IWbemClassObject *a_InParams, IWbemClassObject **a_OutParams, IWbemCallResult **a_CallResult)
HRESULT STDMETHODCALLTYPE | ExecMethodAsync (const BSTR a_ObjectPath, const BSTR a_MethodName, long a_Flags, IWbemContext *a_Context, IWbemClassObject *a_InParams, IWbemObjectSink *a_Sink)
HRESULT STDMETHODCALLTYPE | ExecNotificationQuery (const BSTR a_QueryLanguage, const BSTR a_Query, long a_Flags, IWbemContext *a_Context, IEnumWbemClassObject **a_Enum)
HRESULT STDMETHODCALLTYPE | ExecNotificationQueryAsync (const BSTR a_QueryLanguage, const BSTR a_Query, long a_Flags, IWbemContext *a_Context, IWbemObjectSink *a_Sink)
HRESULT STDMETHODCALLTYPE | ExecQuery (const BSTR a_QueryLanguage, const BSTR a_Query, long a_Flags, IWbemContext *a_Context, IEnumWbemClassObject **a_Enum)
HRESULT STDMETHODCALLTYPE | ExecQueryAsync (const BSTR a_QueryLanguage, const BSTR a_Query, long a_Flags, IWbemContext *a_Context, IWbemObjectSink *a_Sink)
HRESULT STDMETHODCALLTYPE | GetObject (const BSTR a_ObjectPath, long a_Flags, IWbemContext *a_Context, IWbemClassObject **ppObject, IWbemCallResult **a_CallResult)
HRESULT STDMETHODCALLTYPE | GetObjectAsync (const BSTR a_ObjectPath, long a_Flags, IWbemContext *a_Context, IWbemObjectSink *a_Sink)
HRESULT STDMETHODCALLTYPE | GetProperty (long a_Flags, const BSTR a_Locale, const BSTR a_ClassMapping, const BSTR a_InstanceMapping, const BSTR a_PropertyMapping, VARIANT *a_Value)
HRESULT STDMETHODCALLTYPE | Initialize (LPWSTR a_User, LONG a_Flags, LPWSTR a_Namespace, LPWSTR a_Locale, IWbemServices *a_Core, IWbemContext *a_Context, IWbemProviderInitSink *a_Sink)
HRESULT STDMETHODCALLTYPE | OpenNamespace (const BSTR a_Namespace, long a_Flags, IWbemContext *a_Context, IWbemServices **a_Service, IWbemCallResult **a_CallResult)
HRESULT STDMETHODCALLTYPE | PutClass (IWbemClassObject *a_Object, long a_Flags, IWbemContext *a_Context, IWbemCallResult **a_CallResult)
HRESULT STDMETHODCALLTYPE | PutClassAsync (IWbemClassObject *a_Object, long a_Flags, IWbemContext *a_Context, IWbemObjectSink *a_Sink)
HRESULT STDMETHODCALLTYPE | PutInstance (IWbemClassObject *a_Instance, long a_Flags, IWbemContext *a_Context, IWbemCallResult **a_CallResult)
HRESULT STDMETHODCALLTYPE | PutInstanceAsync (IWbemClassObject *a_Instance, long a_Flags, IWbemContext *a_Context, IWbemObjectSink *a_Sink)
HRESULT STDMETHODCALLTYPE | PutProperty (long a_Flags, const BSTR a_Locale, const BSTR a_ClassMapping, const BSTR a_InstanceMapping, const BSTR a_PropertyMapping, const VARIANT *a_Value)
STDMETHODIMP | QueryInterface (REFIID, LPVOID FAR *)
HRESULT STDMETHODCALLTYPE | QueryObjectSink (long a_Flags, IWbemObjectSink **a_Sink)
HRESULT STDMETHODCALLTYPE | Shutdown (LONG a_Flags, ULONG a_MaxMilliSeconds, IWbemContext *a_Context)
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()

Private Member Functions

HRESULT | CreateInstanceEnumAsync_Contacts (IWbemClassObject *a_ClassObject, long a_Flags, IWbemContext __RPC_FAR *a_Context, IWbemObjectSink FAR *a_Sink)
HRESULT | CreateInstanceEnumAsync_Process (IWbemClassObject *a_ClassObject, long a_Flags, IWbemContext *a_Context, IWbemObjectSink *a_Sink)

Private Attributes

BSTR | m_ComputerName
IWbemClassObject * | m_ContactInfo_Object
IWbemServices * | m_CoreService
CRITICAL_SECTION | m_CriticalSection
BSTR | m_Locale
BSTR | m_Namespace
BSTR | m_OperatingSystemVersion
LONG | m_ReferenceCount
BSTR | m_User
IWbemClassObject * | m_Win32_ProcessEx_Object

Detailed Description

Definition at line 55 of file Service.h.

Constructor & Destructor Documentation

CProvider_IWbemServices::CProvider_IWbemServices ( )

Definition at line 572 of file Service.cpp.

                                                    :

  m_ReferenceCount ( 0 ) ,
  m_User ( NULL ) ,
  m_Locale ( NULL ) ,
  m_Namespace ( NULL ) ,
  m_CoreService ( NULL ) ,
  m_ComputerName  ( NULL ) ,
  m_OperatingSystemVersion ( NULL ) ,
  m_Win32_ProcessEx_Object ( NULL ),
  m_ContactInfo_Object (NULL)
{
  InitializeCriticalSection ( & m_CriticalSection ) ;

  InterlockedIncrement ( & Provider_Globals :: s_ObjectsInProgress ) ;
}

CProvider_IWbemServices::~CProvider_IWbemServices ( )

Definition at line 600 of file Service.cpp.

{
  DeleteCriticalSection ( & m_CriticalSection ) ;

  if ( m_User )
  {
    SysFreeString ( m_User ) ;
  }

  if ( m_Locale )
  {
    SysFreeString ( m_Locale ) ;
  }

  if ( m_Namespace )
  {
    SysFreeString ( m_Namespace ) ;
  }

  if ( m_CoreService )
  {
    m_CoreService->Release () ;
  }

  if ( m_Win32_ProcessEx_Object )
  {
    m_Win32_ProcessEx_Object->Release () ;
  }

  if ( m_ContactInfo_Object )
  {
    m_ContactInfo_Object->Release () ;
  }

  if ( m_ComputerName )
  {
    SysFreeString ( m_ComputerName ) ;
  }

  if ( m_OperatingSystemVersion )
  {
    SysFreeString ( m_OperatingSystemVersion ) ;
  }

  InterlockedDecrement ( & Provider_Globals :: s_ObjectsInProgress ) ;
}

Member Function Documentation

HRESULT CProvider_IWbemServices::CancelAsyncCall ( IWbemObjectSink * a_Sink )

Definition at line 759 of file Service.cpp.

{
  HRESULT t_Result = WBEM_E_NOT_AVAILABLE ;
  return t_Result ;
}

HRESULT STDMETHODCALLTYPE CProvider_IWbemServices::CreateClassEnum | ( | const BSTR | a_Superclass,
 |  | long | a_Flags,
 |  | IWbemContext * | a_Context,
 |  | IEnumWbemClassObject ** | a_Enum |
 | ) |  |  | [inline]

Definition at line 181 of file Service.h.

  {
    return WBEM_E_NOT_AVAILABLE ;
  }

SCODE CProvider_IWbemServices::CreateClassEnumAsync | ( | const BSTR | a_Superclass,
 |  | long | a_Flags,
 |  | IWbemContext * | a_Context,
 |  | IWbemObjectSink * | a_Sink
 | ) |  |

Definition at line 847 of file Service.cpp.

{
  return WBEM_E_NOT_FOUND ;
}

HRESULT STDMETHODCALLTYPE CProvider_IWbemServices::CreateInstanceEnum | ( | const BSTR | a_Class,
 |  | long | a_Flags,
 |  | IWbemContext * | a_Context,
 |  | IEnumWbemClassObject ** | a_Enum |
 | ) |  |  | [inline]

Definition at line 214 of file Service.h.

  {
    return WBEM_E_NOT_AVAILABLE ;
  }

HRESULT CProvider_IWbemServices::CreateInstanceEnumAsync | ( | const BSTR | a_Class,
 |  | long | a_Flags,
 |  | IWbemContext * | a_Context,
 |  | IWbemObjectSink * | a_Sink
 | ) |  |

Definition at line 923 of file Service.cpp.

{
  //Impersonate the client
  HRESULT hr = S_OK ;

  if ( _wcsicmp ( a_Class , L"ContactInfo" ) == 0 )
  {
    //Grant access for built-in admins, local system, local admins, local service and network service.
    PSECURITY_DESCRIPTOR secDescriptor = NULL;
    BOOL bRes = ConvertStringSecurityDescriptorToSecurityDescriptor //this function is only available on Windows 2000 and above
      ( L"O:BAG:BAD:(A;;0x10000001;;;BA)(A;;0x10000001;;;SY)(A;;0x10000001;;;LA)(A;;0x10000001;;;SY)(A;;0x10000001;;;S-1-5-20)(A;;0x10000001;;;S-1-5-19)",
      SDDL_REVISION_1,
      (PSECURITY_DESCRIPTOR *) &secDescriptor,
      NULL);

    if (! bRes)
    {
      hr = WBEM_E_ACCESS_DENIED;
      a_Sink->SetStatus ( 0 , hr , NULL , NULL ) ;
      return hr ;
    }

    hr = CoImpersonateClient () ;
    if ( FAILED ( hr ) )
    {
      LocalFree(secDescriptor);

      a_Sink->SetStatus ( 0 , hr , NULL , NULL ) ;
      return hr ;
    }

    // perform an access check.

    hr = CheckAccess((SECURITY_DESCRIPTOR *)secDescriptor,
              MASK_CLIENT_ACCESS_BIND,
              &s_ClientAccessMapping);

    LocalFree(secDescriptor);

    //  Revert before we perform any operations
    CoRevertToSelf () ;

    if (FAILED(hr))
    {
      hr = WBEM_E_ACCESS_DENIED;
      a_Sink->SetStatus ( 0 , hr , NULL , NULL ) ;
      return hr ;
    }

    //Enumerate the instances.
    hr = CreateInstanceEnumAsync_Contacts (

      m_ContactInfo_Object ,
      a_Flags ,
      a_Context ,
      a_Sink
    ) ;

  }
  else if ( _wcsicmp ( a_Class , L"Win32_ProcessEx" ) == 0 )
  {
    hr = CoImpersonateClient () ;
    if ( FAILED ( hr ) )
    {
      a_Sink->SetStatus ( 0 , hr , NULL , NULL ) ;
      return hr ;
    }

    //  Check to see if call is at the RPC_C_IMP_LEVEL_IDENTIFY level. If that's the case,
    //  the provider will not be able to impersonate the client to access the protected Win32_ProcessEx resources.
    //  However, the provider can decide perform an access check to see if the client is sufficiently privileged.
    //
    //  Please keep in mind that if in the MOF file __Win32Provider instabce sets the HostingModel
    //  to Decoupled:Com (the default), the original client impersonation level will be lowered to
    //  RPC_C_IMP_LEVEL_IDENTIFY before calling into provider. To allow original client
    //  impersonation level through to provider, set the HostingModel to
    //  Decoupled:Com:FoldIdentity(FALSE}.
    //  See comments in the MOF file for more info.

    DWORD t_CurrentImpersonationLevel = GetCurrentImpersonationLevel () ;
    if ( t_CurrentImpersonationLevel < RPC_C_IMP_LEVEL_IMPERSONATE )
    {
      //  Revert before we perform any operations
      CoRevertToSelf () ;

      hr = WBEM_E_ACCESS_DENIED;
      a_Sink->SetStatus ( 0 , hr , NULL , NULL ) ;
      return hr ;
    }

    //Enumerate the instances.
    hr = CreateInstanceEnumAsync_Process (

      m_Win32_ProcessEx_Object ,
      a_Flags ,
      a_Context ,
      a_Sink
    ) ;

    CoRevertToSelf () ;
  }
  else
  {
    hr = WBEM_E_INVALID_CLASS ;
  }

/*
 *  Inform WMI of status of call.
 */

  a_Sink->SetStatus ( 0 , hr , NULL , NULL ) ;

  return hr ;
}

HRESULT CProvider_IWbemServices::CreateInstanceEnumAsync_Contacts | ( | IWbemClassObject * | a_ClassObject,
 |  | long | a_Flags,
 |  | IWbemContext __RPC_FAR * | a_Context,
 |  | IWbemObjectSink FAR * | a_Sink |
 | ) |  |  | [private]

Definition at line 1484 of file Service.cpp.

{
  HRESULT t_Result = S_OK ;

/*
 *  Count the instances
 */

  ULONG t_Count = 0 ;

  Object_Property *t_Property = g_Contact_Properties ;
  while ( SUCCEEDED ( t_Result ) && t_Property )
  {
    BOOL t_Loop = TRUE ;
    while ( t_Loop )
    {
      switch ( t_Property->m_State )
      {
        case 0:
        {
          t_Property ++ ;
        }
        break ;

        case 1:
        {
          t_Loop = FALSE ;
          t_Property ++ ;
          t_Count ++ ;
        }
        break ;

        case 2:
        {
          t_Loop = FALSE ;
          t_Property = NULL ;
        } ;

        default:
        {
        }
        break ;
      }
    }
  }

  if ( t_Count )
  {

/*
 *  Create the array of instances
 */

    ULONG t_Index = 0 ;

    IWbemClassObject **t_ObjectArray = new IWbemClassObject * [ t_Count ] ;
    if ( t_ObjectArray )
    {
      for ( ULONG t_ObjectIndex = 0 ; t_ObjectIndex < t_Count ; t_ObjectIndex ++ )
      {
        t_ObjectArray [ t_ObjectIndex ] = NULL ;
      }

      t_Result = a_ClassObject->SpawnInstance (

        0 ,
        & t_ObjectArray [ t_Index ]
      ) ;

      Object_Property *t_Property = g_Contact_Properties ;
      while ( SUCCEEDED ( t_Result ) && t_Property )
      {
        BOOL t_Loop = TRUE ;
        while ( t_Loop )
        {
          switch ( t_Property->m_State )
          {
            case 0:
            {
/*
 *  Set property value for the current instance
 */

              SetProperty ( t_ObjectArray [ t_Index ] , *t_Property ) ;
              t_Property ++ ;
            }
            break ;

            case 1:
            {
/*
 *  Create a new instance
 */
              t_Loop = FALSE ;

              t_Index ++ ;

              if ( t_Index < t_Count )
              {
                t_Result = a_ClassObject->SpawnInstance (

                  0 ,
                  & t_ObjectArray [ t_Index ]
                ) ;
              }

              t_Property ++ ;
            }
            break ;

            case 2:
            {
/*
 * Break from loop when we've reached the end of the data
 */
              t_Loop = FALSE ;
              t_Property = NULL ;
            } ;

            default:
            {
            }
            break ;
          }
        }
      }

/*
 *  Send the instances to WMI.
 */
      if ( SUCCEEDED ( t_Result ) )
      {
        t_Result = a_Sink->Indicate ( t_Count , t_ObjectArray ) ;
      }

/*
 *  Discard
 */

      for ( t_Index = 0 ; t_Index < t_Count ; t_Index ++ )
      {
        if ( t_ObjectArray [ t_Index ] )
        {
          t_ObjectArray [ t_Index ]->Release () ;
        }
      }

      delete [] t_ObjectArray ;
    }
  }

  return t_Result ;
}

HRESULT CProvider_IWbemServices::CreateInstanceEnumAsync_Process | ( | IWbemClassObject * | a_ClassObject,
 |  | long | a_Flags,
 |  | IWbemContext * | a_Context,
 |  | IWbemObjectSink * | a_Sink |
 | ) |  |  | [private]
HRESULT STDMETHODCALLTYPE CProvider_IWbemServices::DeleteClass | ( | const BSTR | a_Class,
 |  | long | a_Flags,
 |  | IWbemContext * | a_Context,
 |  | IWbemCallResult ** | a_CallResult |
 | ) |  |  | [inline]

Definition at line 170 of file Service.h.

  {
    return WBEM_E_NOT_AVAILABLE ;
  }

HRESULT CProvider_IWbemServices::DeleteClassAsync | ( | const BSTR | a_Class,
 |  | long | a_Flags,
 |  | IWbemContext * | a_Context,
 |  | IWbemObjectSink * | a_Sink
 | ) |  |

Definition at line 824 of file Service.cpp.

{
   return WBEM_E_NOT_AVAILABLE ;
}

HRESULT STDMETHODCALLTYPE CProvider_IWbemServices::DeleteInstance | ( | const BSTR | a_ObjectPath,
 |  | long | a_Flags,
 |  | IWbemContext * | a_Context,
 |  | IWbemCallResult ** | a_CallResult |
 | ) |  |  | [inline]

Definition at line 203 of file Service.h.

  {
    return WBEM_E_NOT_AVAILABLE ;
  }

HRESULT CProvider_IWbemServices::DeleteInstanceAsync | ( | const BSTR | a_ObjectPath,
 |  | long | a_Flags,
 |  | IWbemContext * | a_Context,
 |  | IWbemObjectSink * | a_Sink
 | ) |  |

Definition at line 892 of file Service.cpp.

{
  HRESULT t_Result = WBEM_E_NOT_AVAILABLE ;
  return t_Result ;
}

HRESULT STDMETHODCALLTYPE CProvider_IWbemServices::ExecMethod | ( | const BSTR | a_ObjectPath,
 |  | const BSTR | a_MethodName,
 |  | long | a_Flags,
 |  | IWbemContext * | a_Context,
 |  | IWbemClassObject * | a_InParams,
 |  | IWbemClassObject ** | a_OutParams,
 |  | IWbemCallResult ** | a_CallResult |
 | ) |  |  | [inline]

Definition at line 262 of file Service.h.

  {
    return WBEM_E_NOT_AVAILABLE ;
  }

HRESULT CProvider_IWbemServices::ExecMethodAsync | ( | const BSTR | a_ObjectPath,
 |  | const BSTR | a_MethodName,
 |  | long | a_Flags,
 |  | IWbemContext * | a_Context,
 |  | IWbemClassObject * | a_InParams,
 |  | IWbemObjectSink * | a_Sink
 | ) |  |

Definition at line 1086 of file Service.cpp.

{
  HRESULT t_Result = WBEM_E_NOT_AVAILABLE ;
  return t_Result ;
}

HRESULT STDMETHODCALLTYPE CProvider_IWbemServices::ExecNotificationQuery | ( | const BSTR | a_QueryLanguage,
 |  | const BSTR | a_Query,
 |  | long | a_Flags,
 |  | IWbemContext * | a_Context,
 |  | IEnumWbemClassObject ** | a_Enum |
 | ) |  |  | [inline]

Definition at line 238 of file Service.h.

  {
    return WBEM_E_NOT_AVAILABLE ;
  }

HRESULT STDMETHODCALLTYPE CProvider_IWbemServices::ExecNotificationQueryAsync | ( | const BSTR | a_QueryLanguage,
 |  | const BSTR | a_Query,
 |  | long | a_Flags,
 |  | IWbemContext * | a_Context,
 |  | IWbemObjectSink * | a_Sink |
 | ) |  |  | [inline]

Definition at line 250 of file Service.h.

  {
    return WBEM_E_NOT_AVAILABLE ;
  }

HRESULT STDMETHODCALLTYPE CProvider_IWbemServices::ExecQuery | ( | const BSTR | a_QueryLanguage,
 |  | const BSTR | a_Query,
 |  | long | a_Flags,
 |  | IWbemContext * | a_Context,
 |  | IEnumWbemClassObject ** | a_Enum |
 | ) |  |  | [inline]

Definition at line 225 of file Service.h.

  {
    return WBEM_E_NOT_AVAILABLE ;
  }

HRESULT CProvider_IWbemServices::ExecQueryAsync | ( | const BSTR | a_QueryLanguage,
 |  | const BSTR | a_Query,
 |  | long | a_Flags,
 |  | IWbemContext * | a_Context,
 |  | IWbemObjectSink * | a_Sink
 | ) |  |

Definition at line 1060 of file Service.cpp.

{

  return WBEM_E_NOT_AVAILABLE ;

}

HRESULT STDMETHODCALLTYPE CProvider_IWbemServices::GetObject | ( | const BSTR | a_ObjectPath,
 |  | long | a_Flags,
 |  | IWbemContext * | a_Context,
 |  | IWbemClassObject ** | ppObject,
 |  | IWbemCallResult ** | a_CallResult |
 | ) |  |  | [inline]

Definition at line 147 of file Service.h.

  {
    return WBEM_E_NOT_AVAILABLE ;
  }

HRESULT CProvider_IWbemServices::GetObjectAsync | ( | const BSTR | a_ObjectPath,
 |  | long | a_Flags,
 |  | IWbemContext * | a_Context,
 |  | IWbemObjectSink * | a_Sink
 | ) |  |

Definition at line 779 of file Service.cpp.

{
  HRESULT t_Result = WBEM_E_NOT_FOUND ;
  return t_Result ;
}

HRESULT CProvider_IWbemServices::GetProperty | ( | long | a_Flags,
 |  | const BSTR | a_Locale,
 |  | const BSTR | a_ClassMapping,
 |  | const BSTR | a_InstanceMapping,
 |  | const BSTR | a_PropertyMapping,
 |  | VARIANT * | a_Value
 | ) |  |

Definition at line 1111 of file Service.cpp.

{
  if ( _wcsicmp ( a_PropertyMapping , L"ExtraProperty1" ) == 0 )
  {
  }
  else
  {
    if ( _wcsicmp ( a_PropertyMapping , L"ExtraProperty2" ) == 0 )
    {
    }
    else
    {
    }
  }

  return S_OK ;
}

HRESULT CProvider_IWbemServices::Initialize | ( | LPWSTR | a_User,
 |  | LONG | a_Flags,
 |  | LPWSTR | a_Namespace,
 |  | LPWSTR | a_Locale,
 |  | IWbemServices * | a_Core,
 |  | IWbemContext * | a_Context,
 |  | IWbemProviderInitSink * | a_Sink
 | ) |  |

Definition at line 1187 of file Service.cpp.

{
  HRESULT t_Result = S_OK ;

      if ( m_User )

      {

            SysFreeString ( m_User ) ;

            m_User = NULL ;

      }

      if ( m_Locale )

      {

            SysFreeString ( m_Locale ) ;

            m_Locale = NULL ;

      }

      if ( m_Namespace )

      {

            SysFreeString ( m_Namespace ) ;

            m_Namespace  = NULL ;

      }

      if ( m_CoreService )

      {

            m_CoreService->Release () ;

            m_CoreService = NULL ;

      }

      if ( m_Win32_ProcessEx_Object )

      {

            m_Win32_ProcessEx_Object->Release () ;

            m_Win32_ProcessEx_Object = NULL ;

      }

    if ( m_ContactInfo_Object )

      {

            m_Win32_ProcessEx_Object->Release () ;

            m_Win32_ProcessEx_Object = NULL ;

      }

      if ( m_ComputerName )

      {

            SysFreeString ( m_ComputerName ) ;

            m_ComputerName = NULL ;

      }

      if ( m_OperatingSystemVersion )

      {

            SysFreeString ( m_OperatingSystemVersion ) ;

            m_OperatingSystemVersion = NULL ;

      }

/*
 *  Impersonate and check impersonation level.
 */

  t_Result = CoImpersonateClient () ;
  if ( SUCCEEDED ( t_Result ) )
  {
    if ( GetCurrentImpersonationLevel () == RPC_C_IMP_LEVEL_IDENTIFY )
    {
      CoRevertToSelf () ;
    }
  }

  if ( a_CoreService )
  {
    m_CoreService = a_CoreService ;
    m_CoreService->AddRef () ;
  }
  else
  {
    t_Result = WBEM_E_INVALID_PARAMETER ;
  }

  if ( SUCCEEDED ( t_Result ) )
  {
    if ( a_User )
    {
      m_User = SysAllocString ( a_User ) ;
      if ( m_User == NULL )
      {
        t_Result = WBEM_E_OUT_OF_MEMORY ;
      }
    }
  }

  if ( SUCCEEDED ( t_Result ) )
  {
    if ( a_Locale )
    {
      m_Locale = SysAllocString ( a_Locale ) ;
      if ( m_Locale == NULL )
      {
        t_Result = WBEM_E_OUT_OF_MEMORY ;
      }
    }
  }

  if ( SUCCEEDED ( t_Result ) )
  {
    if ( a_Namespace )
    {
      m_Namespace = SysAllocString ( a_Namespace ) ;
      if ( m_Namespace == NULL )
      {
        t_Result = WBEM_E_OUT_OF_MEMORY ;
      }
    }
  }

  BSTR t_Class;

  if ( SUCCEEDED ( t_Result ) )
  {
    t_Class = SysAllocString ( L"Win32_ProcessEx" ) ;
    if ( !t_Class )
    {
      t_Result = WBEM_E_OUT_OF_MEMORY ;
    }
    else
    {
      t_Result = m_CoreService->GetObject (

        t_Class ,
        0 ,
        a_Context ,
        & m_Win32_ProcessEx_Object ,
        NULL
      ) ;

      SysFreeString ( t_Class ) ;
    }
  }

  if ( SUCCEEDED ( t_Result ) )
  {

    t_Class = SysAllocString( L"ContactInfo" );
    if ( !t_Class )
    {
      t_Result = WBEM_E_OUT_OF_MEMORY ;
    }
    else
    {
      t_Result = m_CoreService->GetObject (

        t_Class ,
        0 ,
        a_Context ,
        & m_ContactInfo_Object ,
        NULL
      ) ;

      SysFreeString ( t_Class ) ;
    }

  }

  if ( SUCCEEDED ( t_Result ) )
  {
    m_ComputerName = SysAllocStringLen ( NULL , MAX_COMPUTERNAME_LENGTH + 1 ) ;
    if ( m_ComputerName )
    {
      DWORD t_Length = MAX_COMPUTERNAME_LENGTH + 1 ;
      if (! GetComputerName ( m_ComputerName , & t_Length ))
      {
        t_Result = WBEM_E_FAILED ;
      }

    }
    else
    {
      t_Result = WBEM_E_OUT_OF_MEMORY ;
    }
  }

  if ( SUCCEEDED ( t_Result ) )
  {
    OSVERSIONINFO t_VersionInfo ;
    t_VersionInfo.dwOSVersionInfoSize = sizeof ( OSVERSIONINFO ) ;
    if ( GetVersionEx ( & t_VersionInfo ) )
    {
      m_OperatingSystemVersion  = SysAllocStringLen ( NULL , _MAX_PATH ) ;
      if ( m_OperatingSystemVersion )
      {
        StringCbPrintfW(m_OperatingSystemVersion, SysStringByteLen(m_OperatingSystemVersion),
          L"%d.%d.%hu", t_VersionInfo.dwMajorVersion , t_VersionInfo.dwMinorVersion , LOWORD ( t_VersionInfo.dwBuildNumber ) ) ;
      }
      else
      {
        t_Result = WBEM_E_OUT_OF_MEMORY ;
      }
    }
    else
    {
      t_Result = WBEM_E_FAILED ;
    }
  }

  CoRevertToSelf () ;

  a_Sink->SetStatus ( t_Result , 0 ) ;

  return t_Result ;
}

HRESULT STDMETHODCALLTYPE CProvider_IWbemServices::OpenNamespace | ( | const BSTR | a_Namespace,
 |  | long | a_Flags,
 |  | IWbemContext * | a_Context,
 |  | IWbemServices ** | a_Service,
 |  | IWbemCallResult ** | a_CallResult |
 | ) |  |  | [inline]

Definition at line 126 of file Service.h.

  {
    return WBEM_E_NOT_AVAILABLE ;
  }

HRESULT STDMETHODCALLTYPE CProvider_IWbemServices::PutClass | ( | IWbemClassObject * | a_Object,
 |  | long | a_Flags,
 |  | IWbemContext * | a_Context,
 |  | IWbemCallResult ** | a_CallResult |
 | ) |  |  | [inline]

Definition at line 159 of file Service.h.

  {
    return WBEM_E_NOT_AVAILABLE ;
  }

HRESULT STDMETHODCALLTYPE CProvider_IWbemServices::PutClassAsync | ( | IWbemClassObject * | a_Object,
 |  | long | a_Flags,
 |  | IWbemContext * | a_Context,
 |  | IWbemObjectSink * | a_Sink
 | ) |  |
HRESULT STDMETHODCALLTYPE CProvider_IWbemServices::PutInstance | ( | IWbemClassObject * | a_Instance,
 |  | long | a_Flags,
 |  | IWbemContext * | a_Context,
 |  | IWbemCallResult ** | a_CallResult |
 | ) |  |  | [inline]

Definition at line 192 of file Service.h.

  {
    return WBEM_E_NOT_AVAILABLE ;
  }

HRESULT CProvider_IWbemServices::PutInstanceAsync | ( | IWbemClassObject * | a_Instance,
 |  | long | a_Flags,
 |  | IWbemContext * | a_Context,
 |  | IWbemObjectSink * | a_Sink
 | ) |  |

Definition at line 869 of file Service.cpp.

{
  HRESULT t_Result = WBEM_E_NOT_AVAILABLE ;
  return t_Result ;
}

HRESULT CProvider_IWbemServices::PutProperty | ( | long | a_Flags,
 |  | const BSTR | a_Locale,
 |  | const BSTR | a_ClassMapping,
 |  | const BSTR | a_InstanceMapping,
 |  | const BSTR | a_PropertyMapping,
 |  | const VARIANT * | a_Value
 | ) |  |

Definition at line 1148 of file Service.cpp.

{
  if ( _wcsicmp ( a_PropertyMapping , L"ExtraProperty1" ) == 0 )
  {
  }
  else
  {
    if ( _wcsicmp ( a_PropertyMapping , L"ExtraProperty2" ) == 0 )
    {
    }
    else
    {
    }
  }

  return S_OK ;
}

STDMETHODIMP CProvider_IWbemServices::QueryInterface | ( | REFIID | a_Riid,
 |  | LPVOID FAR * | a_Void
 | ) |  |

Definition at line 699 of file Service.cpp.

{
/*
 *  Just clean up out parameter first.
 */

  *a_Void = NULL ;

  if ( a_Riid == IID_IUnknown )
  {
    *a_Void = ( LPVOID ) this ;
  }
  else if ( a_Riid == IID_IWbemServices )
  {
/*
 *  Make sure we support event consumer interface IWbemServices
 */

    *a_Void = ( LPVOID ) ( IWbemServices * ) this ;
  }
  else if ( a_Riid == IID_IWbemPropertyProvider )
  {
    *a_Void = ( LPVOID ) ( IWbemPropertyProvider * ) this ;
  }
  else if ( a_Riid == IID_IWbemProviderInit )
  {
    *a_Void = ( LPVOID ) ( IWbemProviderInit * ) this ;
  }
  else if ( a_Riid == IID_IWbemShutdown )
  {
    *a_Void = ( LPVOID ) ( IWbemShutdown * ) this ;
  }

  if ( *a_Void )
  {
    ( ( LPUNKNOWN ) *a_Void )->AddRef () ;

    return ResultFromScode ( S_OK ) ;
  }
  else
  {
    return ResultFromScode ( E_NOINTERFACE ) ;
  }
}

HRESULT STDMETHODCALLTYPE CProvider_IWbemServices::QueryObjectSink | ( | long | a_Flags,
 |  | IWbemObjectSink ** | a_Sink |
 | ) |  |  | [inline]

Definition at line 138 of file Service.h.

  {
    return WBEM_E_NOT_AVAILABLE ;
  }

HRESULT CProvider_IWbemServices::Shutdown | ( | LONG | a_Flags,
 |  | ULONG | a_MaxMilliSeconds,
 |  | IWbemContext * | a_Context
 | ) |  |

Definition at line 1461 of file Service.cpp.

{
  HRESULT t_Result = S_OK ;
  return t_Result ;
}

CProvider_IWbemServices::STDMETHODIMP_ ( ULONG )
CProvider_IWbemServices::STDMETHODIMP_ ( ULONG )

Member Data Documentation

BSTR CProvider_IWbemServices::m_ComputerName [private]

Definition at line 82 of file Service.h.

IWbemClassObject* CProvider_IWbemServices::m_ContactInfo_Object [private]

Definition at line 88 of file Service.h.

IWbemServices* CProvider_IWbemServices::m_CoreService [private]

Definition at line 72 of file Service.h.

CRITICAL_SECTION CProvider_IWbemServices::m_CriticalSection [private]

Definition at line 68 of file Service.h.

BSTR CProvider_IWbemServices::m_Locale [private]

Definition at line 77 of file Service.h.

BSTR CProvider_IWbemServices::m_Namespace [private]

Definition at line 76 of file Service.h.

BSTR CProvider_IWbemServices::m_OperatingSystemVersion [private]

Definition at line 83 of file Service.h.

LONG CProvider_IWbemServices::m_ReferenceCount [private]

Definition at line 66 of file Service.h.

BSTR CProvider_IWbemServices::m_User [private]

Definition at line 78 of file Service.h.

IWbemClassObject* CProvider_IWbemServices::m_Win32_ProcessEx_Object [private]

Definition at line 87 of file Service.h.

The documentation for this class was generated from the following files:
  • SysMgmt/WMI/VC/decoupled/Instance_Provider/Include/Service.h
  • SysMgmt/WMI/VC/decoupled/Instance_Provider/Service.cpp
Generated on Wed Nov 13 2024 16:57:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CProvider_IWbemUnboundObjectSink Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CProvider_IWbemUnboundObjectSink Class Reference

#include "Events.h"

List of all members.

Public Member Functions

CProvider_IWbemUnboundObjectSink ()
~CProvider_IWbemUnboundObjectSink ()
HRESULT STDMETHODCALLTYPE | IndicateToConsumer (IWbemClassObject *a_LogicalConsumer, long a_ObjectCount, IWbemClassObject **a_Objects)
STDMETHODIMP | QueryInterface (REFIID, LPVOID FAR *)
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()

Private Attributes

LONG | m_ReferenceCount

Detailed Description

Definition at line 114 of file Events.h.

Constructor & Destructor Documentation

CProvider_IWbemUnboundObjectSink::CProvider_IWbemUnboundObjectSink ( )

Definition at line 370 of file Events.cpp.

                                                                     :

  m_ReferenceCount ( 0 )
{
  InterlockedIncrement ( & Provider_Globals :: s_ObjectsInProgress ) ;
}

CProvider_IWbemUnboundObjectSink::~CProvider_IWbemUnboundObjectSink ( )

Definition at line 388 of file Events.cpp.

{
  InterlockedDecrement ( & Provider_Globals :: s_ObjectsInProgress ) ;
}

Member Function Documentation

HRESULT CProvider_IWbemUnboundObjectSink::IndicateToConsumer | ( | IWbemClassObject * | a_LogicalConsumer,
 |  | long | a_ObjectCount,
 |  | IWbemClassObject ** | a_Objects
 | ) |  |

Definition at line 498 of file Events.cpp.

{
  HRESULT t_Result = S_OK ;

  MessageBeep ( MB_ICONEXCLAMATION ) ;

  return t_Result ;
}

STDMETHODIMP CProvider_IWbemUnboundObjectSink::QueryInterface | ( | REFIID | a_Riid,
 |  | LPVOID FAR * | a_Void
 | ) |  |

Definition at line 445 of file Events.cpp.

{
/*
 *  Just clean up out parameter first.
 */

  *a_Void = NULL ;

  if ( a_Riid == IID_IUnknown )
  {
    *a_Void = ( LPVOID ) this ;
  }
  else if ( a_Riid == IID_IWbemUnboundObjectSink )
  {
/*
 *  Make sure we support event consumer interface IWbemUnboundObjectSink
 */

    *a_Void = ( LPVOID ) ( IWbemUnboundObjectSink * ) this ;
  }

/*
 *  Retain a reference on outgoing parameter.
 */

  if ( *a_Void )
  {
    ( ( LPUNKNOWN ) *a_Void )->AddRef () ;

    return ResultFromScode ( S_OK ) ;
  }
  else
  {
    return ResultFromScode ( E_NOINTERFACE ) ;
  }
}

CProvider_IWbemUnboundObjectSink::STDMETHODIMP_ ( ULONG )
CProvider_IWbemUnboundObjectSink::STDMETHODIMP_ ( ULONG )

Member Data Documentation

LONG CProvider_IWbemUnboundObjectSink::m_ReferenceCount [private]

Definition at line 122 of file Events.h.

The documentation for this class was generated from the following files:
  • SysMgmt/WMI/VC/decoupled/Event_Consumer/Include/Events.h
  • SysMgmt/WMI/VC/decoupled/Event_Consumer/Events.cpp
Generated on Wed Nov 13 2024 16:57:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CProviderFactory Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Private Attributes

CProviderFactory Class Reference

#include "Factory.h"

List of all members.

Public Member Functions

CProviderFactory (CListBox *pOutputList)
CProviderFactory (CListBox *pOutputList)
virtual | ~CProviderFactory ()
virtual | ~CProviderFactory ()
STDMETHODIMP | QueryInterface (REFIID, LPVOID *)
STDMETHODIMP | QueryInterface (REFIID, LPVOID *)
STDMETHOD_ (SCODE, CreateInstance)(IUnknown *pUnkOuter
STDMETHOD_ (SCODE, LockServer)(BOOL fLock)
STDMETHOD_ (SCODE, LockServer)(BOOL fLock)
STDMETHOD_ (SCODE, CreateInstance)(IUnknown *pUnkOuter
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) AddRef(void)

Public Attributes

REFIID void ** | ppvObject
REFIID | riid

Private Attributes

LONG | m_cRef
CListBox * | m_pOutputList

Detailed Description

Definition at line 16 of file Factory.h.

Constructor & Destructor Documentation

CProviderFactory::CProviderFactory ( CListBox * pOutputList )

Definition at line 21 of file Factory.Cpp.

{
  m_cRef = 0L;
  m_pOutputList = pOutputList;
}

CProviderFactory::~CProviderFactory ( ) [virtual]

Definition at line 27 of file Factory.Cpp.

{
}

CProviderFactory::CProviderFactory ( CListBox * pOutputList )
virtual CProviderFactory::~CProviderFactory ( ) [virtual]

Member Function Documentation

STDMETHODIMP CProviderFactory::QueryInterface | ( | REFIID | ,
 |  | LPVOID * |
 | ) |  |
STDMETHODIMP CProviderFactory::QueryInterface | ( | REFIID | ,
 |  | LPVOID * |
 | ) |  |
CProviderFactory::STDMETHOD_ | ( | SCODE | ,
 |  | CreateInstance |
 | ) |  |
CProviderFactory::STDMETHOD_ | ( | SCODE | ,
 |  | CreateInstance |
 | ) |  |
CProviderFactory::STDMETHOD_ | ( | SCODE | ,
 |  | LockServer |
 | ) |  |
CProviderFactory::STDMETHOD_ | ( | SCODE | ,
 |  | LockServer |
 | ) |  |
CProviderFactory::STDMETHODIMP_ ( ULONG )
CProviderFactory::STDMETHODIMP_ ( ULONG )
CProviderFactory::STDMETHODIMP_ ( ULONG )
CProviderFactory::STDMETHODIMP_ ( ULONG )

Member Data Documentation

LONG CProviderFactory::m_cRef [private]

Definition at line 35 of file Factory.h.

CListBox * CProviderFactory::m_pOutputList [private]

Definition at line 36 of file Factory.h.

REFIID void ** CProviderFactory::ppvObject

Definition at line 29 of file Factory.h.

REFIID CProviderFactory::riid

Definition at line 29 of file Factory.h.

The documentation for this class was generated from the following files:
  • SysMgmt/WMI/VC/CmdLineConsumer/Factory.h
  • SysMgmt/WMI/VC/EventConsumer/Factory.h
  • SysMgmt/WMI/VC/CmdLineConsumer/Factory.Cpp
  • SysMgmt/WMI/VC/EventConsumer/Factory.Cpp
Generated on Wed Nov 13 2024 16:57:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CProxy Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes

CProxy Class Reference

#include "proxy.h"

Inherits CODBCData.

List of all members.

Public Member Functions

CProxy ()
~CProxy ()
virtual HRESULT STDMETHODCALLTYPE | Activate (void)
virtual BOOL STDMETHODCALLTYPE | CanBePooled (void)
void | ClearArray ()
STDMETHODIMP | Construct (IDispatch *pUnk)
virtual void STDMETHODCALLTYPE | Deactivate (void)
STDMETHOD() | EntityDelete (IEntityData *Entity, long *Result)
STDMETHOD() | EntityInsert (IEntityData *Entity, long *Result)
STDMETHOD() | EntityLoad (BSTR ReadStoredProc, BSTR UpdateStoredProc, BSTR DeleteStoredProc, BSTR InsertStoredProc, BSTR KeyField, VARIANT KeyValue, long *Result, IEntityData **ppEntity)
STDMETHOD() | EntityLookup (BSTR SQLString, long *Result, BSTR ReadStoredProc, BSTR UpdateStoredProc, BSTR DeleteStoredProc, BSTR InsertStoredProc, BSTR KeyField, IEntityData **ppEntity)
STDMETHOD() | EntityQuery (BSTR SQLString, long *Result, BSTR ReadStoredProc, BSTR UpdateStoredProc, BSTR DeleteStoredProc, BSTR InsertStoredProc, BSTR KeyField, IResultset **ppResults)
STDMETHOD() | EntityRead (IEntityData *pEntity, long *Results)
STDMETHOD() | EntityUpdate (IEntityData *pEntity, long *Result)
STDMETHOD() | Execute (BSTR SQLString, long *Result)
HRESULT | FinalConstruct ()
void | FinalRelease ()
STDMETHOD() | InterfaceSupportsErrorInfo (REFIID riid)
STDMETHOD() | LookupFree ()
STDMETHOD() | ManualConstruct (BSTR ConstructString)
STDMETHOD() | NextEntity (IEntityData **ppEntity)
STDMETHOD() | NextLookup (long *Result, IEntityData **ppEntity)
STDMETHOD() | NextResultset (long *Result, IResultset **Results)
STDMETHOD() | RSQuery (BSTR QueryText, VARIANT *Result, _Recordset **Recordset)
STDMETHOD() | RSQueryRW (BSTR QueryText, VARIANT *Result, _Recordset **rs)
STDMETHOD() | RSUpdate (_Recordset *rs)

Public Attributes

FieldMetaData * m_MetaData
short | m_nCount
long | m_nRows
CComPtr< IUnknown > | m_pUnkMarshaler
_ConnectionPtr | m_spConnection

Private Member Functions

HRESULT | BindStaticEntity (FieldMetaData *MetaData, short nCount, CStaticEntity *spEntity)
HRESULT | CollectResultRows (IResultset **ppResults)
HRESULT | InternalBindLookup (CStaticEntity *spEntity)
HRESULT | InternalLookup (BSTR SQLString, long *Result, BSTR ReadStoredProc, BSTR UpdateStoredProc, BSTR DeleteStoredProc, BSTR InsertStoredProc, BSTR KeyField)
HRESULT | InternalNextEntity (CStaticEntity *spEntity)
HRESULT | PopulateStaticEntity (FieldMetaData *MetaData, IEntityData *pEntity)

Private Attributes

CString m_wszDeleteStoredProc
CString m_wszInsertStoredProc
CString m_wszKeyField
CString m_wszReadStoredProc
CString m_wszUpdateStoredProc
CFastVariant vtNull

Detailed Description

Definition at line 11 of file proxy.h.

Constructor & Destructor Documentation

CProxy::CProxy ( ) [inline]

Definition at line 22 of file proxy.h.

  {
    m_nCount = -1;
    vtNull.vt = VT_NULL;
    m_nRows = 0;
    m_MetaData = NULL;
  }

CProxy::~CProxy ( ) [inline]

Definition at line 30 of file proxy.h.

  {
    ClearArray();
  }

Member Function Documentation

HRESULT CProxy::Activate ( void ) [virtual]

Definition at line 29 of file proxy.Cpp.

{
  HRESULT hr = GetObjectContext(&m_spObjectContext);
  ActivateData(m_spObjectContext.p);
  return hr;
}

HRESULT CProxy::BindStaticEntity | ( | FieldMetaData * | MetaData,
 |  | short | nCount,
 |  | CStaticEntity * | spEntity |
 | ) |  |  | [private]

Definition at line 272 of file proxy.Cpp.

{
  HRESULT hr = S_OK;
  RETCODE rc = 0;
  int nCol;

  hr = FetchData();

  if (SUCCEEDED(hr))
  {
    spEntity->Initialize(nCount);

    for (nCol = 1; nCol <= nCount; nCol++)
    {
      long nIndex = nCol-1;
      FieldMetaData *pMeta = &pMetaData[nIndex];

      if (pMeta->nDataBindLen <= 0)
      {
        *(long*)pMeta->pData = 0;
        if (pMeta->nNullable > 0)
        {
          pMeta->bNull = true;
        }
      }
      else
      {
        pMeta->bNull = false;
      }

      if (pMeta->nDataLen > 0)
      {
        if (pMeta->bNull == true)
        {
          hr = spEntity->InternalInsert(nCol, pMeta->wszName, &vtNull, pMeta->vt);
        }
        else if (pMeta->vt == VT_BSTR)
        {
          hr = spEntity->InternalInsert(nCol, pMeta->wszName, (WCHAR*)pMeta->pData);
        }
        else if (pMeta->vt == VT_I2)// || vt == VT_I4 || vt == VT_UI1)
        {
          hr = spEntity->InternalInsert(nCol, pMeta->wszName, &_variant_t(*(short*)pMeta->pData), pMeta->vt);
        }
        else if (pMeta->vt == VT_I4)// || vt == VT_I4 || vt == VT_UI1)
        {
          hr = spEntity->InternalInsert(nCol, pMeta->wszName, (long*)pMeta->pData);
        }
        else if (pMeta->vt == VT_UI1)// || vt == VT_I4 || vt == VT_UI1)
        {
          hr = spEntity->InternalInsert(nCol, pMeta->wszName, &_variant_t(*(BYTE*)pMeta->pData), pMeta->vt);
        }
        else if (pMeta->vt == VT_DATE)
        {
          WCHAR* pStr = wcsstr(pMeta->pData, L".");
          pStr[0] = L'\0';
          CFastVariant varval(pMeta->pData);
          if (SUCCEEDED(varval.ChangeType(VT_DATE)))
          {
            hr = spEntity->InternalInsert(nCol, pMeta->wszName, &varval, pMeta->vt);
          }
        }
        else if (pMeta->vt == VT_DECIMAL)
        {
          CFastVariant varval((WCHAR*)pMeta->pData);
          if (SUCCEEDED(varval.ChangeType(VT_DECIMAL)))
          {
            hr = spEntity->InternalInsert(nCol, pMeta->wszName, &varval, pMeta->vt);
          }
        }
        else if (pMeta->vt == VT_CY)
        {
          CFastVariant varval((WCHAR*)pMeta->pData);
          if (SUCCEEDED(varval.ChangeType(VT_CY)))
          {
            hr = spEntity->InternalInsert(nCol, pMeta->wszName, &varval, pMeta->vt);
          }
        }
        else if (pMeta->vt == VT_BOOL)
        {
          hr = spEntity->InternalInsert(nCol, pMeta->wszName, &_variant_t(*(bool*)pMeta->pData), pMeta->vt);
        }
        else if (pMeta->vt == VT_NULL)
        {
          hr = spEntity->InternalInsert(nCol, pMeta->wszName, &vtNull, pMeta->vt);
        }
        else
        {
          hr = spEntity->InternalInsert(nCol, pMeta->wszName, (WCHAR*)pMeta->pData);
        }
      }
      if (FAILED(hr))
        return AtlReportError(CLSID_Proxy, (LPCSTR)"Failed to bind entity data", IID_IDataProxy, hr);
    }
  }
  return hr;
}

BOOL CProxy::CanBePooled ( void ) [virtual]

Definition at line 36 of file proxy.Cpp.

{
  return CanConnectionBePooled();
}

void CProxy::ClearArray ( ) [inline]

Definition at line 35 of file proxy.h.

  {
    if (m_MetaData != NULL)
    {
      delete [] m_MetaData;
      m_MetaData = NULL;
    }
  }

HRESULT CProxy::CollectResultRows ( IResultset ** ppResults ) [private]

Definition at line 217 of file proxy.Cpp.

{
  HRESULT hr = S_OK;
  CDynamicResultset* spResults = NULL;
  CStaticEntity* spEntity = NULL;
  long nEntity = 0;

  spResults = new CDynamicResultset;
  spResults->Initialise(m_nRows);

  spEntity = spResults->GetEntity(nEntity);

  hr = InternalBindLookup(spEntity);

  if (SUCCEEDED(hr))
  {
    spResults->m_wszReadStoredProc = m_wszReadStoredProc;
    spResults->m_wszUpdateStoredProc = m_wszUpdateStoredProc;
    spResults->m_wszDeleteStoredProc = m_wszDeleteStoredProc;
    spResults->m_wszInsertStoredProc = m_wszInsertStoredProc;
    spResults->m_wszKeyField = m_wszKeyField;

    if (SUCCEEDED(hr) && spEntity != NULL)
    {
      do
      {
        spEntity->put_EditMode(colEditNone);
        nEntity += 1;
        spEntity = spResults->GetEntity(nEntity);
      } while ((nEntity < (ENTITY_BANKS * ENTITY_PER_BANK) - 1) && SUCCEEDED(InternalNextEntity(spEntity)));
      spResults->DeleteEntity(nEntity);
      spResults->SetCount(nEntity);
    }
    else if (FAILED(hr))
    {
      spResults->DeleteEntity(0);
      spResults->SetCount(0);
    }
  }
  else
  {
    spResults->DeleteEntity(0);
    spResults->SetCount(0);
  }
  hr = spResults->QueryInterface(IID_IResultset, (void**)ppResults);
  if (FAILED(hr))
  {
    delete spResults;
    *ppResults = NULL;
  }
  ClearArray();

  return hr;
}

STDMETHODIMP CProxy::Construct ( IDispatch * pUnk )

Definition at line 46 of file proxy.Cpp.

{
  return ConstructData(pUnk);
}

void CProxy::Deactivate ( void ) [virtual]

Definition at line 41 of file proxy.Cpp.

{
  DeactivateData();
}

STDMETHODIMP CProxy::EntityDelete | ( | IEntityData * | Entity,
 |  | long * | Result
 | ) |  |

Definition at line 76 of file proxy.Cpp.

{
  HRESULT hr = S_OK;
  long nResult;
  CComBSTR bstrCommand;

  hr = pEntity->get_DeleteCommand(&bstrCommand);

  if (SUCCEEDED(hr))
    hr = Execute(bstrCommand, &nResult);

  if (SUCCEEDED(hr))
  {
    hr = pEntity->put_EditMode(colEditDeleted);
    *Result = nResult;
  }
  return hr;
}

STDMETHODIMP CProxy::EntityInsert | ( | IEntityData * | Entity,
 |  | long * | Result
 | ) |  |

Definition at line 95 of file proxy.Cpp.

{
  HRESULT hr = S_OK;
  long nResult;
  CComBSTR bstrCommand;

  hr = pEntity->get_InsertCommand(&bstrCommand);

  if (SUCCEEDED(hr))
    hr = Execute(bstrCommand, &nResult);

  if (SUCCEEDED(hr))
  {
    hr = pEntity->put_EditMode(colEditNone);
    *Result = nResult;
  }
  return hr;
}

STDMETHODIMP CProxy::EntityLoad | ( | BSTR | ReadStoredProc,
 |  | BSTR | UpdateStoredProc,
 |  | BSTR | DeleteStoredProc,
 |  | BSTR | InsertStoredProc,
 |  | BSTR | KeyField,
 |  | VARIANT | KeyValue,
 |  | long * | Result,
 |  | IEntityData ** | ppEntity
 | ) |  |

Definition at line 459 of file proxy.Cpp.

{
  HRESULT hr = S_OK;
  long nRowsAffected;
  short nsCount = 0;
  WCHAR wszSQL[MAX_FIELD_DATA_SIZE];
  CStaticEntity *spEntity = NULL;
  FieldMetaData* pMetaData = NULL;

  CloseCurrentStatement();
  hr = QueryEnlist(CLSID_Proxy, IID_IDataProxy);
  if (SUCCEEDED(hr))
  {
    SETCOMPLETE;

    BuildExecCommand(wszSQL, ReadStoredProc, KeyField, &KeyValue);

    hr = ExecuteSQL(wszSQL);

    if (SUCCEEDED(hr))
    {
      spEntity = new CStaticEntity;

      hr = BindResultMetaData(&pMetaData, &nsCount);
      if (SUCCEEDED(hr))
      {
        hr = BindStaticEntity(pMetaData, nsCount, spEntity);

        if (SUCCEEDED(hr))
        {
          spEntity->put_ReadStoredProcedure(ReadStoredProc);
          spEntity->put_UpdateStoredProcedure(UpdateStoredProc);
          spEntity->put_DeleteStoredProcedure(DeleteStoredProc);
          spEntity->put_InsertStoredProcedure(InsertStoredProc);
          spEntity->put_KeyField(KeyField);

          nRowsAffected = 1;
          hr = spEntity->put_EditMode(colEditNone);
          if (SUCCEEDED(hr))
            hr = spEntity->QueryInterface(IID_IEntityData, (void**)ppEntity);
          *Result = nRowsAffected;
        }
      }
      if (FAILED(hr))
      {
        delete spEntity;
        *ppEntity = NULL;
      }
    }
    delete [] pMetaData;
  }
  return hr;
}

STDMETHODIMP CProxy::EntityLookup | ( | BSTR | SQLString,
 |  | long * | Result,
 |  | BSTR | ReadStoredProc,
 |  | BSTR | UpdateStoredProc,
 |  | BSTR | DeleteStoredProc,
 |  | BSTR | InsertStoredProc,
 |  | BSTR | KeyField,
 |  | IEntityData ** | ppEntity
 | ) |  |

Definition at line 513 of file proxy.Cpp.

{
  HRESULT hr = S_OK;
  CStaticEntity *spEntity = new CStaticEntity;

  CloseCurrentStatement();

  hr = InternalLookup(SQLString, Result, ReadStoredProc, UpdateStoredProc, DeleteStoredProc, InsertStoredProc, KeyField);
  if (SUCCEEDED(hr))
  {
    hr = InternalBindLookup(spEntity);

    if (SUCCEEDED(hr) && m_nCount > 0)
    {
      spEntity->m_wszReadStoredProc = m_wszReadStoredProc;
      spEntity->m_wszUpdateStoredProc = m_wszUpdateStoredProc;
      spEntity->m_wszDeleteStoredProc = m_wszDeleteStoredProc;
      spEntity->m_wszInsertStoredProc = m_wszInsertStoredProc;
      spEntity->m_wszKeyField = m_wszKeyField;
      hr = spEntity->put_EditMode(colEditNone);
      if (SUCCEEDED(hr))
        hr = spEntity->QueryInterface(IID_IEntityData, (void**)ppEntity);
    }
  }
  if (FAILED(hr) || m_nCount <= 0)
  {
    delete spEntity;
    *ppEntity = NULL;
  }
  return hr;
}

STDMETHODIMP CProxy::EntityQuery | ( | BSTR | SQLString,
 |  | long * | Result,
 |  | BSTR | ReadStoredProc,
 |  | BSTR | UpdateStoredProc,
 |  | BSTR | DeleteStoredProc,
 |  | BSTR | InsertStoredProc,
 |  | BSTR | KeyField,
 |  | IResultset ** | ppResults
 | ) |  |

Definition at line 201 of file proxy.Cpp.

{
  HRESULT hr = S_OK;

  CloseCurrentStatement();

  hr = InternalLookup(SQLString, Result, ReadStoredProc, UpdateStoredProc, DeleteStoredProc, InsertStoredProc, KeyField);

  if (SUCCEEDED(hr))
  {
    hr = CollectResultRows(ppResults);
  }

  return hr;
}

STDMETHODIMP CProxy::EntityRead | ( | IEntityData * | pEntity,
 |  | long * | Results
 | ) |  |

Definition at line 160 of file proxy.Cpp.

{
  HRESULT hr = S_OK;
  long nRowsAffected = 0;
  short nsCount = 0;

  if (pEntity == NULL)
  {
    return E_INVALIDARG;
  }

  if (SUCCEEDED(hr))
  {
    HRESULT hr = E_FAIL;
    CComPtr<IEntityData> spEntity(pEntity);
    CComBSTR bstr;
    FieldMetaData *pMetaData = NULL;

    CloseCurrentStatement();
    hr = QueryEnlist(CLSID_Proxy, IID_IDataProxy);
    if (SUCCEEDED(hr))
    {
      spEntity->get_ReadCommand(&bstr);

      hr = ExecuteSQL(bstr);
      if (SUCCEEDED(hr))
      {
        hr = BindResultMetaData(&pMetaData, &nsCount);
        if (SUCCEEDED(hr))
        {
          hr = PopulateStaticEntity(pMetaData, spEntity);
          if (SUCCEEDED(hr))
            hr = spEntity->put_EditMode(colEditNone);
        }
        delete [] pMetaData;
      }
    }
  }
  return hr;
}

STDMETHODIMP CProxy::EntityUpdate | ( | IEntityData * | pEntity,
 |  | long * | Result
 | ) |  |

Definition at line 114 of file proxy.Cpp.

{
  HRESULT hr = S_OK;
  long nResult;
  CComBSTR bstrCommand;
  ColEditModeEnum mode = colEditNone;

  hr = pEntity->get_EditMode(&mode);

  if (SUCCEEDED(hr))
  {
    if (mode == colEditDelete)
    {
      hr = pEntity->get_DeleteCommand(&bstrCommand);
      if (SUCCEEDED(hr))
        hr = pEntity->put_EditMode(colEditDeleted);
    }
    else if (mode == colEditAdd)
    {
      hr = pEntity->get_InsertCommand(&bstrCommand);
      if (SUCCEEDED(hr) && bstrCommand.m_str != NULL)
      {
        hr = pEntity->put_EditMode(colEditNone);
      }
      else
      {
        hr = pEntity->get_UpdateCommand(&bstrCommand);
        if (SUCCEEDED(hr))
          hr = pEntity->put_EditMode(colEditNone);
      }
    }
    else
    {
      hr = pEntity->get_UpdateCommand(&bstrCommand);
      if (SUCCEEDED(hr))
        hr = pEntity->put_EditMode(colEditNone);
    }

    hr = Execute(bstrCommand, &nResult);
    if (SUCCEEDED(hr))
      *Result = nResult;
  }

  return hr;
}

STDMETHODIMP CProxy::Execute | ( | BSTR | SQLString,
 |  | long * | Result
 | ) |  |

Definition at line 51 of file proxy.Cpp.

{
  HRESULT hr = S_OK;
  WCHAR wszSQL[MAX_FIELD_DATA_SIZE];

  CloseCurrentStatement();
  hr = QueryEnlist(CLSID_Proxy, IID_IDataProxy);

  if (SUCCEEDED(hr))
  {
    WCSNCPY(wszSQL, SQLString, SysStringLen(SQLString));
    hr = ExecuteSQL(wszSQL, pResult);
  }
  return hr;
}

HRESULT CProxy::FinalConstruct ( ) [inline]

Definition at line 60 of file proxy.h.

  {
    return CoCreateFreeThreadedMarshaler(
      GetControllingUnknown(), &m_pUnkMarshaler.p);
  }

void CProxy::FinalRelease ( ) [inline]

Definition at line 66 of file proxy.h.

  {
    m_pUnkMarshaler.Release();
  }

STDMETHODIMP CProxy::InterfaceSupportsErrorInfo ( REFIID riid )

Definition at line 15 of file proxy.Cpp.

{
  static const IID* arr[] =
  {
    &IID_IDataProxy
  };
  for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++)
  {
    if (::InlineIsEqualGUID(*arr[i],riid))
      return S_OK;
  }
  return S_FALSE;
}

HRESULT CProxy::InternalBindLookup ( CStaticEntity * spEntity ) [private]

Definition at line 592 of file proxy.Cpp.

{
  HRESULT hr = S_OK;

  hr = BindResultMetaData(&m_MetaData, &m_nCount);
  if (m_nCount > 0)
  {
    hr = BindStaticEntity(m_MetaData, m_nCount, spEntity);
  }
  return hr;
}

HRESULT CProxy::InternalLookup | ( | BSTR | SQLString,
 |  | long * | Result,
 |  | BSTR | ReadStoredProc,
 |  | BSTR | UpdateStoredProc,
 |  | BSTR | DeleteStoredProc,
 |  | BSTR | InsertStoredProc,
 |  | BSTR | KeyField |
 | ) |  |  | [private]

Definition at line 545 of file proxy.Cpp.

{
  HRESULT hr = S_OK;
  WCHAR wszSQL[MAX_FIELD_DATA_SIZE];

  hr = QueryEnlist(CLSID_Proxy, IID_IDataProxy);

  if (SUCCEEDED(hr))
  {
    SETCOMPLETE;

    if (ReadStoredProc != NULL)
      m_wszReadStoredProc.AssignCopy(SysStringLen(ReadStoredProc), ReadStoredProc);
    else
      m_wszReadStoredProc.Empty();

    if (UpdateStoredProc != NULL)
      m_wszUpdateStoredProc.AssignCopy(SysStringLen(UpdateStoredProc), UpdateStoredProc);
    else
      m_wszUpdateStoredProc.Empty();

    if (DeleteStoredProc != NULL)
      m_wszDeleteStoredProc.AssignCopy(SysStringLen(DeleteStoredProc), DeleteStoredProc);
    else
      m_wszDeleteStoredProc.Empty();

    if (InsertStoredProc != NULL)
      m_wszInsertStoredProc.AssignCopy(SysStringLen(InsertStoredProc), InsertStoredProc);
    else
      m_wszInsertStoredProc.Empty();

    if (KeyField != NULL)
      m_wszKeyField.AssignCopy(SysStringLen(KeyField), KeyField);
    else
      m_wszKeyField.Empty();

    WCSNCPY(wszSQL, SQLString, SysStringLen(SQLString));

    hr = ExecuteSQL(wszSQL);
    if (SUCCEEDED(hr))
    {
      *Result = 1;
    }
  }
  return hr;
}

HRESULT CProxy::InternalNextEntity ( CStaticEntity * spEntity ) [private]

Definition at line 604 of file proxy.Cpp.

{
  HRESULT hr = S_OK;

  hr = BindStaticEntity(m_MetaData, m_nCount, spEntity);

  return hr;
}

STDMETHODIMP CProxy::LookupFree ( )

Definition at line 637 of file proxy.Cpp.

{
  CloseCurrentStatement();
  m_nCount = -1;
  return S_OK;
}

STDMETHODIMP CProxy::ManualConstruct ( BSTR ConstructString ) [virtual]

Implements CPooledData.

Definition at line 67 of file proxy.Cpp.

{
  HRESULT hr = E_FAIL;

  hr = ManualConstructData(ConstructString);

  return hr;
}

STDMETHODIMP CProxy::NextEntity ( IEntityData ** ppEntity )

Definition at line 613 of file proxy.Cpp.

{
  HRESULT hr = S_OK;
  CStaticEntity *spEntity = new CStaticEntity;
  hr = InternalNextEntity(spEntity);
  if (SUCCEEDED(hr))
  {
    spEntity->m_wszReadStoredProc = m_wszReadStoredProc;
    spEntity->m_wszUpdateStoredProc = m_wszUpdateStoredProc;
    spEntity->m_wszDeleteStoredProc = m_wszDeleteStoredProc;
    spEntity->m_wszInsertStoredProc = m_wszInsertStoredProc;
    spEntity->m_wszKeyField = m_wszKeyField;
    hr = spEntity->put_EditMode(colEditNone);
    if (SUCCEEDED(hr))
      hr = spEntity->QueryInterface(IID_IEntityData, (void**)ppEntity);
  }
  else
  {
    delete spEntity;
    *ppEntity = NULL;
  }
  return hr;
}

STDMETHODIMP CProxy::NextLookup | ( | long * | Result,
 |  | IEntityData ** | ppEntity
 | ) |  |

Definition at line 661 of file proxy.Cpp.

{
  HRESULT hr = S_OK;
  CStaticEntity *spEntity = new CStaticEntity;

  hr = NextResultsetData(pResult);

  if (SUCCEEDED(hr))
  {
    hr = InternalBindLookup(spEntity);

    if (SUCCEEDED(hr))
    {
      spEntity->m_wszReadStoredProc = m_wszReadStoredProc;
      spEntity->m_wszUpdateStoredProc = m_wszUpdateStoredProc;
      spEntity->m_wszDeleteStoredProc = m_wszDeleteStoredProc;
      spEntity->m_wszInsertStoredProc = m_wszInsertStoredProc;
      spEntity->m_wszKeyField = m_wszKeyField;
      hr = spEntity->put_EditMode(colEditNone);
      if (SUCCEEDED(hr))
        hr = spEntity->QueryInterface(IID_IEntityData, (void**)ppEntity);
    }
  }
  if (FAILED(hr))
  {
    delete spEntity;
    *ppEntity = NULL;
    return AtlReportError(CLSID_Proxy, (LPCSTR)"Failed to bind entity data", IID_IDataProxy, hr);
  }
  return hr;
}

STDMETHODIMP CProxy::NextResultset | ( | long * | Result,
 |  | IResultset ** | Results
 | ) |  |

Definition at line 644 of file proxy.Cpp.

{
  HRESULT hr = S_OK;

  hr = NextResultsetData(pResult);

  if (SUCCEEDED(hr))
  {
    hr = CollectResultRows(ppResults);
  }

  if (FAILED(hr))
    return AtlReportError(CLSID_Proxy, (LPCSTR)"Failed to retrieve data", IID_IDataProxy, hr);
  else
    return hr;
}

HRESULT CProxy::PopulateStaticEntity | ( | FieldMetaData * | MetaData,
 |  | IEntityData * | pEntity |
 | ) |  |  | [private]

Definition at line 370 of file proxy.Cpp.

{
  HRESULT hr = S_OK;
  RETCODE rc = 0;
  int nCol;
  long nCount = 0;

  hr = FetchData();

  if (SUCCEEDED(hr))
  {
    pEntity->Count(&nCount);

    for (nCol = 1; nCol <= nCount; nCol++)
    {
      long nIndex = nCol-1;
      FieldMetaData *pMeta = &pMetaData[nIndex];

      if (pMeta->nDataBindLen <= 0)
      {
        *(long*)pMeta->pData = 0;
        if (pMeta->nNullable > 0)
          pMeta->vt = VT_NULL;
      }

      if (pMeta->nDataLen > 0)
      {
        if (pMeta->vt == VT_BSTR)
        {
          hr = pEntity->put_Field(&_variant_t(pMeta->wszName), &_variant_t((WCHAR*)pMeta->pData));
        }
        else if (pMeta->vt == VT_I2)// || vt == VT_I4 || vt == VT_UI1)
        {
          hr = pEntity->put_Field(&_variant_t(pMeta->wszName), &_variant_t(*(short*)pMeta->pData));
        }
        else if (pMeta->vt == VT_I4)// || vt == VT_I4 || vt == VT_UI1)
        {
          hr = pEntity->put_Field(&_variant_t(pMeta->wszName), &_variant_t(*(long*)pMeta->pData));
        }
        else if (pMeta->vt == VT_UI1)// || vt == VT_I4 || vt == VT_UI1)
        {
          hr = pEntity->put_Field(&_variant_t(pMeta->wszName), &_variant_t(*(BYTE*)pMeta->pData));
        }
        else if (pMeta->vt == VT_DATE)
        {
          WCHAR* pStr = wcsstr(pMeta->pData, L".");
          pStr[0] = L'\0';
          CFastVariant varval(pMeta->pData);
          if (SUCCEEDED(varval.ChangeType(VT_DATE)))
          {
            hr = pEntity->put_Field(&_variant_t(pMeta->wszName), &varval);
          }
        }
        else if (pMeta->vt == VT_DECIMAL)
        {
          CFastVariant varval((WCHAR*)pMeta->pData);
          if (SUCCEEDED(varval.ChangeType(VT_DECIMAL)))
          {
            hr = pEntity->put_Field(&_variant_t(pMeta->wszName), &varval);
          }
        }
        else if (pMeta->vt == VT_CY)
        {
          CFastVariant varval((WCHAR*)pMeta->pData);
          if (SUCCEEDED(varval.ChangeType(VT_CY)))
          {
            hr = pEntity->put_Field(&_variant_t(pMeta->wszName), &varval);
          }
        }
        else if (pMeta->vt == VT_BOOL)
        {
          hr = pEntity->put_Field(&_variant_t(pMeta->wszName), &_variant_t(*(bool*)pMeta->pData));
        }
        else if (pMeta->vt == VT_NULL)
        {
          hr = pEntity->put_Field(&_variant_t(pMeta->wszName), &vtNull);
        }
        else
        {
          hr = pEntity->put_Field(&_variant_t(pMeta->wszName), &_variant_t((WCHAR*)pMeta->pData));
        }
      }
    }
    if (FAILED(hr))
      hr = AtlReportError(CLSID_Proxy, (LPCSTR)"Failed to populate entity", IID_IDataProxy, hr);
  }
  return hr;
}

STDMETHODIMP CProxy::RSQuery | ( | BSTR | QueryText,
 |  | VARIANT * | Result,
 |  | _Recordset ** | Recordset
 | ) |  |

Definition at line 14 of file proxy_except.Cpp.

{
  HRESULT hr = S_OK;

  if (m_spObjectContext.p != NULL)
    m_spObjectContext->SetComplete();

  try
  {
    _CommandPtr spCommand(__uuidof(Command));
    _RecordsetPtr spRecordset(__uuidof(Recordset));

    if ((_Connection*)m_spConnection == NULL)
    {
      m_spConnection.CreateInstance(__uuidof(Connection));
      m_spConnection->Open(_bstr_t(m_wszConnection), "", "", -1);
    }

    spCommand->PutActiveConnection((_Connection*)m_spConnection);
    spCommand->CommandText = QueryText;
    spCommand->CommandType = adCmdText;
    spCommand->Parameters->Append(spCommand->CreateParameter("RETURN_VALUE", adInteger, adParamReturnValue, sizeof(int)));

    spRecordset->CursorLocation = adUseClient;
    spRecordset->Open((_Command*)spCommand, &vtMissing, adOpenForwardOnly, adLockReadOnly, -1);
    spCommand->PutRefActiveConnection(NULL);

    try
    {
      if (spRecordset->Fields->Count > 0)
      {
        spRecordset->PutRefActiveConnection(NULL);
        *rs = spRecordset.Detach();
      }
    }
    catch (_com_error e)
    {
    }

    if (spCommand->Parameters->Count > 0)
      *Result = spCommand->Parameters->Item["RETURN_VALUE"]->Value;
    else
      *Result = _variant_t(1L);
  }
  catch (_com_error e)
  {
    *Result = _variant_t(-1L);
    if (m_spObjectContext.p != NULL)
      m_spObjectContext->SetAbort();

    hr = AtlReportError(CLSID_Proxy, (LPCSTR)e.Description(), IID_IDataProxy, e.Error());
  }
  return hr;
}

STDMETHODIMP CProxy::RSQueryRW | ( | BSTR | QueryText,
 |  | VARIANT * | Result,
 |  | _Recordset ** | rs
 | ) |  |

Definition at line 69 of file proxy_except.Cpp.

{
  HRESULT hr = S_OK;

  if (m_spObjectContext.p != NULL)
    m_spObjectContext->SetComplete();

  try
  {
    _CommandPtr spCommand(__uuidof(Command));
    _RecordsetPtr spRecordset(__uuidof(Recordset));

    if ((_Connection*)m_spConnection == NULL)
    {
      m_spConnection.CreateInstance(__uuidof(Connection));
      m_spConnection->Open(_bstr_t(m_wszConnection), "", "", -1);
    }

    spCommand->PutActiveConnection((_Connection*)m_spConnection);
    spCommand->CommandText = QueryText;
    spCommand->CommandType = adCmdText;
    spCommand->Parameters->Append(spCommand->CreateParameter("RETURN_VALUE", adInteger, adParamReturnValue, sizeof(int)));

    spRecordset->CursorLocation = adUseClient;
    spRecordset->Open((_Command*)spCommand, &vtMissing,  adOpenStatic,  adLockBatchOptimistic, -1);

    spCommand->PutRefActiveConnection(NULL);
    try
    {
      if (spRecordset->Fields->Count > 0)
      {
        spRecordset->PutRefActiveConnection(NULL);
        *rs = spRecordset.Detach();
      }
    }
    catch (_com_error e)
    {
    }

    if (spCommand->Parameters->Count > 0)
      *Result = spCommand->Parameters->Item["RETURN_VALUE"]->Value;
    else
      *Result = _variant_t(1L);
  }
  catch (_com_error e)
  {
    *Result = _variant_t(-1L);

    if (m_spObjectContext.p != NULL)
      m_spObjectContext->SetAbort();

    hr = AtlReportError(CLSID_Proxy, (LPCSTR)e.Description(), IID_IDataProxy, e.Error());
  }
  return hr;
}

STDMETHODIMP CProxy::RSUpdate ( _Recordset * rs )

Definition at line 125 of file proxy_except.Cpp.

{
  HRESULT hr = S_OK;

  if (m_spObjectContext.p != NULL)
    m_spObjectContext->SetComplete();

  try
  {
    if ((_Connection*)m_spConnection == NULL)
    {
      m_spConnection.CreateInstance(__uuidof(Connection));
      m_spConnection->Open(_bstr_t(m_wszConnection), "", "", -1);
    }

    _RecordsetPtr spRecordset(__uuidof(Recordset));
    spRecordset->PutActiveConnection((_Connection*)m_spConnection);
    spRecordset->PutRefSource(rs);
    spRecordset->put_CursorLocation(adUseClient);
    spRecordset->Open(&vtMissing, &vtMissing,adOpenStatic,adLockBatchOptimistic,-1);
    spRecordset->UpdateBatch(adAffectAll);
    spRecordset->putref_ActiveConnection(NULL);
  }
  catch(_com_error e)
  {
    if (m_spObjectContext.p != NULL)
      m_spObjectContext->SetAbort();

    hr = AtlReportError(CLSID_Proxy, (LPCSTR)e.Description(), IID_IDataProxy, e.Error());
  }
  return hr;
}

Member Data Documentation

FieldMetaData* CProxy::m_MetaData

Definition at line 104 of file proxy.h.

short CProxy::m_nCount

Definition at line 105 of file proxy.h.

long CProxy::m_nRows

Definition at line 106 of file proxy.h.

CComPtr<IUnknown> CProxy::m_pUnkMarshaler

Definition at line 71 of file proxy.h.

_ConnectionPtr CProxy::m_spConnection

Definition at line 86 of file proxy.h.

CString CProxy::m_wszDeleteStoredProc [private]

Definition at line 120 of file proxy.h.

CString CProxy::m_wszInsertStoredProc [private]

Definition at line 121 of file proxy.h.

CString CProxy::m_wszKeyField [private]

Definition at line 122 of file proxy.h.

CString CProxy::m_wszReadStoredProc [private]

Definition at line 118 of file proxy.h.

CString CProxy::m_wszUpdateStoredProc [private]

Definition at line 119 of file proxy.h.

CFastVariant CProxy::vtNull [private]

Definition at line 116 of file proxy.h.

The documentation for this class was generated from the following files:
  • Com/Tools/EntityProxy/DataServices/proxy.h
  • Com/Tools/EntityProxy/DataServices/proxy.Cpp
  • Com/Tools/EntityProxy/DataServices/proxy_except.Cpp
Generated on Wed Nov 13 2024 16:57:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CProxyIRowsetNotify< T > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CProxyIRowsetNotify< T > Class Template Reference

#include "rncp.h"

Inherits IConnectionPointImpl< T,&IID_IRowsetNotify, CComDynamicUnkArray >.

List of all members.

Public Member Functions

HRESULT | Fire_OnFieldChange (IRowset *pRowset, HROW hRow, ULONG cColumns, ULONG *rgColumns, ULONG eReason, ULONG ePhase, LONG fCantDeny)
HRESULT | Fire_OnRowChange (IRowset *pRowset, ULONG cRows, const HROW *rghRows, ULONG eReason, ULONG ePhase, LONG fCantDeny)
HRESULT | Fire_OnRowsetChange (IRowset *pRowset, ULONG eReason, ULONG ePhase, LONG fCantDeny)
HRESULT | Fire_RemoteOnFieldChange (IRowset *pRowset, HROW hRow, ULONG cColumns, ULONG *rgColumns, ULONG eReason, ULONG ePhase, LONG fCantDeny, IErrorInfo **ppErrorInfoRem)
HRESULT | Fire_RemoteOnRowChange (IRowset *pRowset, ULONG cRows, const HROW *rghRows, ULONG eReason, ULONG ePhase, LONG fCantDeny, IErrorInfo **ppErrorInfoRem)
HRESULT | Fire_RemoteOnRowsetChange (IRowset *pRowset, ULONG eReason, ULONG ePhase, LONG fCantDeny, IErrorInfo **ppErrorInfoRem)

Detailed Description

template<class T>
class CProxyIRowsetNotify< T >

Definition at line 7 of file rncp.h.

Member Function Documentation

template<class T>
HRESULT CProxyIRowsetNotify< T >::Fire_OnFieldChange | ( | IRowset * | pRowset,
 |  | HROW | hRow,
 |  | ULONG | cColumns,
 |  | ULONG * | rgColumns,
 |  | ULONG | eReason,
 |  | ULONG | ePhase,
 |  | LONG | fCantDeny |
 | ) |  |  | [inline]

Definition at line 10 of file rncp.h.

  {
    HRESULT ret = S_OK;
    T* pT = static_cast<T*>(this);
    int nConnectionIndex;
    int nConnections = m_vec.GetSize();

    for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
    {
      pT->Lock();
      CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
      pT->Unlock();
      IRowsetNotify* pIRowsetNotify = reinterpret_cast<IRowsetNotify*>(sp.p);
      if (pIRowsetNotify != NULL)
        ret = pIRowsetNotify->OnFieldChange(pRowset, hRow, cColumns, rgColumns, eReason, ePhase, fCantDeny);
    } return ret;

  }

template<class T>
HRESULT CProxyIRowsetNotify< T >::Fire_OnRowChange | ( | IRowset * | pRowset,
 |  | ULONG | cRows,
 |  | const HROW * | rghRows,
 |  | ULONG | eReason,
 |  | ULONG | ePhase,
 |  | LONG | fCantDeny |
 | ) |  |  | [inline]

Definition at line 46 of file rncp.h.

  {
    HRESULT ret = S_OK;
    T* pT = static_cast<T*>(this);
    int nConnectionIndex;
    int nConnections = m_vec.GetSize();

    for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
    {
      pT->Lock();
      CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
      pT->Unlock();
      IRowsetNotify* pIRowsetNotify = reinterpret_cast<IRowsetNotify*>(sp.p);
      if (pIRowsetNotify != NULL)
        ret = pIRowsetNotify->OnRowChange(pRowset, cRows, rghRows, eReason, ePhase, fCantDeny);
    } return ret;

  }

template<class T>
HRESULT CProxyIRowsetNotify< T >::Fire_OnRowsetChange | ( | IRowset * | pRowset,
 |  | ULONG | eReason,
 |  | ULONG | ePhase,
 |  | LONG | fCantDeny |
 | ) |  |  | [inline]

Definition at line 82 of file rncp.h.

  {
    HRESULT ret = S_OK;
    T* pT = static_cast<T*>(this);
    int nConnectionIndex;
    int nConnections = m_vec.GetSize();

    for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
    {
      pT->Lock();
      CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
      pT->Unlock();
      IRowsetNotify* pIRowsetNotify = reinterpret_cast<IRowsetNotify*>(sp.p);
      if (pIRowsetNotify != NULL)
        ret = pIRowsetNotify->OnRowsetChange(pRowset, eReason, ePhase, fCantDeny);
    } return ret;

  }

template<class T>
HRESULT CProxyIRowsetNotify< T >::Fire_RemoteOnFieldChange | ( | IRowset * | pRowset,
 |  | HROW | hRow,
 |  | ULONG | cColumns,
 |  | ULONG * | rgColumns,
 |  | ULONG | eReason,
 |  | ULONG | ePhase,
 |  | LONG | fCantDeny,
 |  | IErrorInfo ** | ppErrorInfoRem |
 | ) |  |  | [inline]

Definition at line 28 of file rncp.h.

  {
    HRESULT ret = S_OK;
    T* pT = static_cast<T*>(this);
    int nConnectionIndex;
    int nConnections = m_vec.GetSize();

    for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
    {
      pT->Lock();
      CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
      pT->Unlock();
      IRowsetNotify* pIRowsetNotify = reinterpret_cast<IRowsetNotify*>(sp.p);
      if (pIRowsetNotify != NULL)
        ret = pIRowsetNotify->RemoteOnFieldChange(pRowset, hRow, cColumns, rgColumns, eReason, ePhase, fCantDeny, ppErrorInfoRem);
    } return ret;

  }

template<class T>
HRESULT CProxyIRowsetNotify< T >::Fire_RemoteOnRowChange | ( | IRowset * | pRowset,
 |  | ULONG | cRows,
 |  | const HROW * | rghRows,
 |  | ULONG | eReason,
 |  | ULONG | ePhase,
 |  | LONG | fCantDeny,
 |  | IErrorInfo ** | ppErrorInfoRem |
 | ) |  |  | [inline]

Definition at line 64 of file rncp.h.

  {
    HRESULT ret = S_OK;
    T* pT = static_cast<T*>(this);
    int nConnectionIndex;
    int nConnections = m_vec.GetSize();

    for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
    {
      pT->Lock();
      CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
      pT->Unlock();
      IRowsetNotify* pIRowsetNotify = reinterpret_cast<IRowsetNotify*>(sp.p);
      if (pIRowsetNotify != NULL)
        ret = pIRowsetNotify->RemoteOnRowChange(pRowset, cRows, rghRows, eReason, ePhase, fCantDeny, ppErrorInfoRem);
    } return ret;

  }

template<class T>
HRESULT CProxyIRowsetNotify< T >::Fire_RemoteOnRowsetChange | ( | IRowset * | pRowset,
 |  | ULONG | eReason,
 |  | ULONG | ePhase,
 |  | LONG | fCantDeny,
 |  | IErrorInfo ** | ppErrorInfoRem |
 | ) |  |  | [inline]

Definition at line 100 of file rncp.h.

  {
    HRESULT ret = S_OK;
    T* pT = static_cast<T*>(this);
    int nConnectionIndex;
    int nConnections = m_vec.GetSize();

    for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
    {
      pT->Lock();
      CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
      pT->Unlock();
      IRowsetNotify* pIRowsetNotify = reinterpret_cast<IRowsetNotify*>(sp.p);
      if (pIRowsetNotify != NULL)
        ret = pIRowsetNotify->RemoteOnRowsetChange(pRowset, eReason, ePhase, fCantDeny, ppErrorInfoRem);
    } return ret;

  }

The documentation for this class was generated from the following file:
  • Dataaccess/oledb/omniprov/source/rncp.h
Generated on Wed Nov 13 2024 16:57:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CProxyPlugin Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Classes | Public Member Functions | Private Member Functions | Private Attributes

CProxyPlugin Class Reference

#include "proxypluginimpl.h"

List of all members.

Classes

class | COpState

Public Member Functions

CProxyPlugin ()
virtual | ~CProxyPlugin ()
HRESULT STDMETHODCALLTYPE | AddCacheItem (BSTR bstrOriginUrl, BSTR bstrPrestuffUrl, long lExpiration, long lBandwidth, long lRemoteEventFlags, IWMSCacheProxyCallback *pCallback, VARIANT varContext)
HRESULT STDMETHODCALLTYPE | CreateCacheItemCollection (IWMSCacheItemCollection **ppCacheItemCollection)
HRESULT STDMETHODCALLTYPE | DisablePlugin ()
HRESULT STDMETHODCALLTYPE | EnablePlugin (long *pdwFlags, long *pdwHeartbeatPeriod)
HRESULT STDMETHODCALLTYPE | FindCacheItem (BSTR pszOriginUrl, IWMSCacheItemDescriptor **ppCacheItemDescriptor)
HRESULT STDMETHODCALLTYPE | GetCustomAdminInterface (IDispatch **ppValue)
HRESULT STDMETHODCALLTYPE | InitializePlugin (IWMSContext *pServerContext, IWMSNamedValues *pNamedValues, IWMSClassObject *pClassFactory)
HRESULT STDMETHODCALLTYPE | OnCacheClientClose (HRESULT resultHr, IWMSContext *pUserContext, IWMSContext *pPresentationContext)
HRESULT STDMETHODCALLTYPE | OnCancelDownloadContent (long lHr, VARIANT varContext)
HRESULT STDMETHODCALLTYPE | OnCompareContentInformation (long lHr, WMS_CACHE_VERSION_COMPARE_RESPONSE CompareResponse, IWMSContext *pNewContentInfo, VARIANT varContext)
HRESULT STDMETHODCALLTYPE | OnDownloadContentFinished (long lHr, SAFEARRAY *psaArchiveContexts, VARIANT varContext)
HRESULT STDMETHODCALLTYPE | OnDownloadContentProgress (long lHr, WMS_RECORD_PROGRESS_OPCODE opCode, IWMSContext *pArchiveContext, VARIANT varContext)
HRESULT STDMETHODCALLTYPE | OnGetContentInformation (long lHr, IWMSContext *pContentInfo, VARIANT varContext)
HRESULT STDMETHODCALLTYPE | OnHeartbeat ()
HRESULT STDMETHODCALLTYPE | QueryCache (BSTR bstrOriginUrl, IWMSContext *pUserContext, IWMSCommandContext *pCommandContext, IWMSContext *pPresentationContext, long QueryType, IWMSCacheProxyCallback *pCallback, VARIANT varContext)
HRESULT STDMETHODCALLTYPE | QueryCacheMissPolicy (BSTR bstrOriginUrl, IWMSContext *pUserContext, IWMSCommandContext *pCommandContext, IWMSContext *pPresentationContext, IUnknown *pCachePluginContext, long QueryType, IWMSCacheProxyCallback *pCallback, VARIANT varContext)
HRESULT STDMETHODCALLTYPE | QuerySpaceForCacheItem (long lContentSizeLow, long lContentSizeHigh, VARIANT_BOOL *pvarfSpaceAvail)
HRESULT STDMETHODCALLTYPE | RemoveAllCacheItems (IWMSCacheProxyCallback *pCallback, VARIANT varContext)
HRESULT STDMETHODCALLTYPE | RemoveCacheItem (BSTR bstrOriginUrl, IWMSCacheProxyCallback *pCallback, VARIANT varContext)
HRESULT STDMETHODCALLTYPE | ShutdownPlugin ()

Private Member Functions

BOOL | ParseUrl (BSTR bstrUrl, BSTR *pbstrProtocol, BSTR *pbstrHost, BSTR *pbstrPath, WORD *pwPort)

Private Attributes

IWMSCacheProxyServer * | m_pICacheProxyServer

Detailed Description

Definition at line 29 of file proxypluginimpl.h.

Constructor & Destructor Documentation

CProxyPlugin::CProxyPlugin ( )

Definition at line 33 of file proxypluginimpl.cpp.

{
    m_pICacheProxyServer = NULL;
}

CProxyPlugin::~CProxyPlugin ( ) [virtual]

Definition at line 45 of file proxypluginimpl.cpp.

{
}

Member Function Documentation

HRESULT STDMETHODCALLTYPE CProxyPlugin::AddCacheItem | ( | BSTR | bstrOriginUrl,
 |  | BSTR | bstrPrestuffUrl,
 |  | long | lExpiration,
 |  | long | lBandwidth,
 |  | long | lRemoteEventFlags,
 |  | IWMSCacheProxyCallback * | pCallback,
 |  | VARIANT | varContext |
 | ) |  |  | [inline]

Definition at line 89 of file proxypluginimpl.h.

    {
        return( E_NOTIMPL );
    }

HRESULT STDMETHODCALLTYPE CProxyPlugin::CreateCacheItemCollection ( IWMSCacheItemCollection ** ppCacheItemCollection ) [inline]

Definition at line 116 of file proxypluginimpl.h.

    {
        return( E_NOTIMPL );
    }

HRESULT STDMETHODCALLTYPE CProxyPlugin::DisablePlugin ( )

Definition at line 119 of file proxypluginimpl.cpp.

{
    return( S_OK );
}

HRESULT STDMETHODCALLTYPE CProxyPlugin::EnablePlugin | ( | long * | pdwFlags,
 |  | long * | pdwHeartbeatPeriod
 | ) |  |

Definition at line 98 of file proxypluginimpl.cpp.

{
    if( ( NULL == pdwFlags ) || ( NULL == pdwHeartbeatPeriod ) )
    {
        return( E_INVALIDARG );
    }

    *pdwFlags = 0;
    *pdwHeartbeatPeriod = 0;

    return( S_OK );
}

HRESULT STDMETHODCALLTYPE CProxyPlugin::FindCacheItem | ( | BSTR | pszOriginUrl,
 |  | IWMSCacheItemDescriptor ** | ppCacheItemDescriptor |
 | ) |  |  | [inline]

Definition at line 109 of file proxypluginimpl.h.

    {
        return( E_NOTIMPL );
    }

HRESULT STDMETHODCALLTYPE CProxyPlugin::GetCustomAdminInterface ( IDispatch ** ppValue )

Definition at line 151 of file proxypluginimpl.cpp.

{
    if( NULL == ppValue )
    {
        return( E_INVALIDARG );
    }

    *ppValue = NULL;
    return( S_OK );
}

HRESULT STDMETHODCALLTYPE CProxyPlugin::InitializePlugin | ( | IWMSContext * | pServerContext,
 |  | IWMSNamedValues * | pNamedValues,
 |  | IWMSClassObject * | pClassFactory
 | ) |  |

Definition at line 57 of file proxypluginimpl.cpp.

{
    HRESULT hr = S_OK;

    if( NULL == pNamedValues )
    {
        return ( E_INVALIDARG );
    }

    // A pointer to the IWMSCacheProxyServer is located in the server context
    // passed into the plugin when it is initialized.  The plugin will need to
    // query for this value and store it.

    hr = pServerContext->GetAndQueryIUnknownValue(
                                    WMS_SERVER_CACHE_MANAGER,
                                    WMS_SERVER_CACHE_MANAGER_ID,
                                    IID_IWMSCacheProxyServer,
                                    ( IUnknown ** ) &m_pICacheProxyServer,
                                    0 );
    if( ( FAILED( hr ) ) || ( NULL == m_pICacheProxyServer ) )
    {
        hr = FAILED( hr ) ? hr : E_FAIL;
        goto abort;
    }

abort:
    return( hr );
}

HRESULT STDMETHODCALLTYPE CProxyPlugin::OnCacheClientClose | ( | HRESULT | resultHr,
 |  | IWMSContext * | pUserContext,
 |  | IWMSContext * | pPresentationContext
 | ) |  |

Definition at line 656 of file proxypluginimpl.cpp.

{
    return( S_OK );
} // OnCacheClientClose

HRESULT STDMETHODCALLTYPE CProxyPlugin::OnCancelDownloadContent | ( | long | lHr,
 |  | VARIANT | varContext |
 | ) |  |  | [inline]

Definition at line 162 of file proxypluginimpl.h.

    {
        return( E_NOTIMPL );
    }

HRESULT STDMETHODCALLTYPE CProxyPlugin::OnCompareContentInformation | ( | long | lHr,
 |  | WMS_CACHE_VERSION_COMPARE_RESPONSE | CompareResponse,
 |  | IWMSContext * | pNewContentInfo,
 |  | VARIANT | varContext |
 | ) |  |  | [inline]

Definition at line 136 of file proxypluginimpl.h.

    {
        return( E_NOTIMPL );
    }

HRESULT STDMETHODCALLTYPE CProxyPlugin::OnDownloadContentFinished | ( | long | lHr,
 |  | SAFEARRAY * | psaArchiveContexts,
 |  | VARIANT | varContext |
 | ) |  |  | [inline]

Definition at line 154 of file proxypluginimpl.h.

    {
        return( E_NOTIMPL );
    }

HRESULT STDMETHODCALLTYPE CProxyPlugin::OnDownloadContentProgress | ( | long | lHr,
 |  | WMS_RECORD_PROGRESS_OPCODE | opCode,
 |  | IWMSContext * | pArchiveContext,
 |  | VARIANT | varContext |
 | ) |  |  | [inline]

Definition at line 145 of file proxypluginimpl.h.

    {
        return( E_NOTIMPL );
    }

HRESULT STDMETHODCALLTYPE CProxyPlugin::OnGetContentInformation | ( | long | lHr,
 |  | IWMSContext * | pContentInfo,
 |  | VARIANT | varContext
 | ) |  |

Definition at line 334 of file proxypluginimpl.cpp.

{
    HRESULT returnHr = (HRESULT) lHr;
    HRESULT hr = S_OK;
    COpState *pOpState = NULL;
    WMS_CACHE_QUERY_MISS_RESPONSE CacheMissPolicy = WMS_CACHE_QUERY_MISS_SKIP;
    IWMSDataContainerVersion *pContentVersion = NULL;
    CComBSTR bstrUrl;
    BOOL fDownload = FALSE;
    long lContentType = 0;
    DWORD dwCacheFlags;
    WCHAR szPort[ 20 ];

    if( ( VT_UNKNOWN != V_VT( &varContext ) ) ||
        ( NULL == V_UNKNOWN( &varContext ) ) )
    {
        return( E_INVALIDARG );
    }

    pOpState = ( COpState *) V_UNKNOWN( &varContext );

    if( FAILED( returnHr ) )
    {
        if( NS_E_CONNECTION_FAILURE == returnHr )
        {
            // Do protocol rollover
            pOpState->m_dwProtocolIndex++;

            if( NULL == g_ProxyProtocols[ pOpState->m_dwProtocolIndex ] )
            {
                // we have tried all the protocols and failed
                hr = E_NOINTERFACE;
                goto abort;
            }

            bstrUrl = g_ProxyProtocols[ pOpState->m_dwProtocolIndex ];
            bstrUrl.Append( L"://" );
            bstrUrl.Append( pOpState->m_bstrHost );

            // if we we are using the same protocol requested by the client, then we should
            // also use the port specified by the client (if one was specified)
            if( ( 0 != pOpState->m_wPort ) &&
                ( 0 == _wcsicmp( g_ProxyProtocols[ pOpState->m_dwProtocolIndex ], pOpState->m_bstrProtocol ) ) )
            {
                bstrUrl.Append( L":" );
                bstrUrl.Append( _itow( pOpState->m_wPort, szPort, 10 ) );
            }

            bstrUrl.Append( L"/" );
            bstrUrl.Append( pOpState->m_bstrPath );

            hr = m_pICacheProxyServer->GetContentInformation(
                                            bstrUrl,
                                            pOpState->m_pPresentationContext,
                                            this,
                                            NULL,
                                            (IWMSCacheProxyServerCallback *) this,
                                            varContext
                                            );
            if( FAILED( hr ) )
            {
                goto abort;
            }

            return( S_OK );
        }
        else if( E_ACCESSDENIED == returnHr )
        {
            // the origin server requires authentication to provide information about this content.
            // since we don't have the credentials, we can either proxy this stream on-demand (in
            // which case the player will be prompted for the credentials) or simply fail this request.
            // let's opt for proxying the stream.
            CacheMissPolicy = WMS_CACHE_QUERY_MISS_PLAY_ON_DEMAND;
        }
        else
        {
            hr = returnHr;
            goto abort;
        }
    }
    else
    {
        hr = pContentInfo->GetLongValue( WMS_CACHE_CONTENT_INFORMATION_CONTENT_TYPE,
                                         WMS_CACHE_CONTENT_INFORMATION_CONTENT_TYPE_ID,
                                         (long *) &lContentType,
                                         0 );
        if( FAILED( hr ) )
        {
            goto abort;
        }

        if( WMS_CACHE_CONTENT_TYPE_BROADCAST & lContentType )
        {
            hr = pContentInfo->GetAndQueryIUnknownValue( WMS_CACHE_CONTENT_INFORMATION_DATA_CONTAINER_VERSION,
                                                         WMS_CACHE_CONTENT_INFORMATION_DATA_CONTAINER_VERSION_ID,
                                                         IID_IWMSDataContainerVersion,
                                                         (IUnknown **) &pContentVersion,
                                                         0 );
            if( ( FAILED( hr ) ) || ( NULL == pContentVersion ) )
            {
                hr = FAILED( hr ) ? hr : E_UNEXPECTED;
                goto abort;
            }

            hr = pContentVersion->GetCacheFlags( (long *) &dwCacheFlags );
            if( FAILED( hr ) )
            {
                goto abort;
            }

            if( dwCacheFlags & WMS_DATA_CONTAINER_VERSION_ALLOW_STREAM_SPLITTING )
            {
                CacheMissPolicy = WMS_CACHE_QUERY_MISS_PLAY_BROADCAST;
            }
            else
            {
                CacheMissPolicy = WMS_CACHE_QUERY_MISS_PLAY_ON_DEMAND;
            }
        }
        else  // It is an on-demand publishing point
        {
            CacheMissPolicy = WMS_CACHE_QUERY_MISS_PLAY_ON_DEMAND;
        }
    }

    hr = S_OK;

    bstrUrl = g_ProxyProtocols[ pOpState->m_dwProtocolIndex ];
    bstrUrl.Append( L"://" );
    bstrUrl.Append( pOpState->m_bstrHost );

    // if we we are using the same protocol requested by the client, then we should
    // also use the port specified by the client (if one was specified)
    if( ( 0 != pOpState->m_wPort ) &&
        ( 0 == _wcsicmp( g_ProxyProtocols[ pOpState->m_dwProtocolIndex ], pOpState->m_bstrProtocol ) ) )
    {
        bstrUrl.Append( L":" );
        bstrUrl.Append( _itow( pOpState->m_wPort, szPort, 10 ) );
    }

    bstrUrl.Append( L"/" );
    bstrUrl.Append( pOpState->m_bstrPath );

abort:
    hr = pOpState->m_pCacheProxyCallback->OnQueryCacheMissPolicy( hr,
                                                                  CacheMissPolicy,
                                                                  bstrUrl,
                                                                  NULL,
                                                                  pContentInfo,
                                                                  pOpState->m_varContext );
    if( FAILED( hr ) )
    {
        hr = S_OK;
    }

    if( NULL != pOpState )
    {
        pOpState->Release();
    }

    if( NULL != pContentVersion )
    {
        pContentVersion->Release();
    }

    return( S_OK );
}

HRESULT STDMETHODCALLTYPE CProxyPlugin::OnHeartbeat ( )

Definition at line 170 of file proxypluginimpl.cpp.

{
    return( S_OK );
}

BOOL CProxyPlugin::ParseUrl | ( | BSTR | bstrUrl,
 |  | BSTR * | pbstrProtocol,
 |  | BSTR * | pbstrHost,
 |  | BSTR * | pbstrPath,
 |  | WORD * | pwPort |
 | ) |  |  | [private]

Definition at line 513 of file proxypluginimpl.cpp.

{
    LPWSTR pszSchemeless;
    LPWSTR pszProtocol = L"";
    LPWSTR pszHost = L"";
    LPWSTR pszPath = L"";
    LPWSTR pszUrlCopy = NULL;
    LPWSTR pszHostEnd = NULL;;
    LPWSTR psz = NULL;;
    BOOL fRet = TRUE;

    if( ( NULL == bstrUrl ) ||
        ( NULL == pbstrProtocol ) ||
        ( NULL == pbstrHost ) ||
        ( NULL == pbstrPath ) ||
        ( NULL == pwPort ) )
    {
        return( FALSE );
    }

    *pbstrProtocol = NULL;
    *pbstrHost = NULL;
    *pbstrPath = NULL;

    pszUrlCopy = new WCHAR[ wcslen( bstrUrl ) + 1 ];
    if( NULL == pszUrlCopy )
    {
        fRet = FALSE;
        goto done;
    }

    wcscpy( pszUrlCopy, bstrUrl );

    // skip the protocol
    pszSchemeless = wcsstr( pszUrlCopy, L"://" );
    if( NULL != pszSchemeless )
    {
        pszProtocol = pszUrlCopy;
        *pszSchemeless = L'\0'; // null terminate the protocol name
        pszSchemeless += 3;
    }
    else
    {
        pszSchemeless = pszUrlCopy;

        // Remove any leading '/'.
        while ( L'/' == *pszSchemeless )
        {
            pszSchemeless++;
        }
    }

    pszHost = pszSchemeless;

    // find the beginning of the path
    psz = wcschr( pszSchemeless, L'/' );
    if( NULL != psz )
    {
        *psz = L'\0'; // null terminate the host name
        pszPath = psz + 1;
        pszHostEnd = psz;
    }
    else
    {
        // there is no path, only the host name
        pszHostEnd = pszSchemeless + wcslen( pszSchemeless );
    }

    // see if a port number was specified at the end of the host name
    for( psz = pszHostEnd; psz > pszUrlCopy; psz-- )
    {
        if( L':' == *psz )
        {
            *psz = L'\0'; // null terminate the host name
            *pwPort = ( WORD ) _wtoi( psz + 1 );
            break;
        }
    }

    *pbstrProtocol = SysAllocString( pszProtocol );
    if( NULL == *pbstrProtocol )
    {
        fRet = FALSE;
        goto done;
    }

    *pbstrHost = SysAllocString( pszHost );
    if( NULL == *pbstrHost )
    {
        fRet = FALSE;
        goto done;
    }

    *pbstrPath = SysAllocString( pszPath );
    if( NULL == *pbstrPath )
    {
        fRet = FALSE;
        goto done;
    }

done:

    if( NULL != pszUrlCopy )
    {
        delete [] pszUrlCopy;
    }

    if( !fRet )
    {
        if( NULL != *pbstrProtocol )
        {
            SysFreeString( *pbstrProtocol );
        }

        if( NULL != *pbstrHost )
        {
            SysFreeString( *pbstrHost );
        }

        if( NULL != *pbstrPath )
        {
            SysFreeString( *pbstrPath );
        }
    }

    return( fRet );
}

HRESULT STDMETHODCALLTYPE CProxyPlugin::QueryCache | ( | BSTR | bstrOriginUrl,
 |  | IWMSContext * | pUserContext,
 |  | IWMSCommandContext * | pCommandContext,
 |  | IWMSContext * | pPresentationContext,
 |  | long | QueryType,
 |  | IWMSCacheProxyCallback * | pCallback,
 |  | VARIANT | varContext
 | ) |  |

Definition at line 182 of file proxypluginimpl.cpp.

{
    HRESULT hr = S_OK;
    COpState *pOpState = NULL;
    LPWSTR pszHostName = NULL;

    if( ( NULL == bstrOriginUrl) ||
        ( NULL == pCommandContext ) ||
        ( NULL == pPresentationContext ) ||
        ( NULL == pCallback ) )
    {
        return( E_INVALIDARG );
    }

    // Since this plugin just supports proxy, we always return (in the callback)
    // WMS_CACHE_QUERY_MISS.  If this plugin were also to do caching, this is
    // where the cache database would be queried.  If a hit is made, then the
    // expiration of the cache entry will be checked, and if it expired a
    // freshness check would need to be done.  A freshness check is done
    // through CompareContentInformation, an async call.  Rather than waiting
    // for the response, the plugin should return from this method and
    // call the callback (OnQueryCache) in OnCompareContentInformation.
    //
    // If OnCompareContentInformation reports the cached entry is up-to-date,
    // a hit could be reported.  Otherwise a miss will need to be reported,
    // and the plugin will need to wait till QueryCacheMissPolicy.

    hr = pCallback->OnQueryCache( hr,
                                  WMS_CACHE_QUERY_MISS,
                                  NULL,
                                  NULL,
                                  NULL,
                                  varContext );

    return( S_OK );
}

HRESULT STDMETHODCALLTYPE CProxyPlugin::QueryCacheMissPolicy | ( | BSTR | bstrOriginUrl,
 |  | IWMSContext * | pUserContext,
 |  | IWMSCommandContext * | pCommandContext,
 |  | IWMSContext * | pPresentationContext,
 |  | IUnknown * | pCachePluginContext,
 |  | long | QueryType,
 |  | IWMSCacheProxyCallback * | pCallback,
 |  | VARIANT | varContext
 | ) |  |

Definition at line 233 of file proxypluginimpl.cpp.

{
    VARIANT varContext2;
    COpState *pOpState = NULL;
    HRESULT hr = S_OK;
    BOOL fRet;

    if( ( NULL == bstrOriginUrl) ||
        ( NULL == pCommandContext ) ||
        ( NULL == pPresentationContext ) ||
        ( NULL == pCallback ) )
    {
        return( E_INVALIDARG );
    }

    if( QueryType & WMS_CACHE_QUERY_REVERSE_PROXY )
    {
        hr = pCallback->OnQueryCacheMissPolicy( S_OK,
                                                WMS_CACHE_QUERY_MISS_SKIP,
                                                NULL,
                                                NULL,
                                                NULL,
                                                varContext );
        return( hr );
    }

    if( ( QueryType & WMS_CACHE_QUERY_CACHE_EVENT ) ||
        ( QueryType & WMS_CACHE_QUERY_GET_CONTENT_INFO ) )
    {
        hr = pCallback->OnQueryCacheMissPolicy( S_OK,
                                                WMS_CACHE_QUERY_MISS_FORWARD_REQUEST,
                                                NULL,
                                                NULL,
                                                NULL,
                                                varContext );
        return( hr );
    }

    pOpState = new COpState;
    if( NULL == pOpState )
    {
        return( E_OUTOFMEMORY );
    }

    pOpState->m_Op = COpState::OP_QUERY_CACHE_MISS_POLICY;
    pOpState->m_bstrOriginUrl = bstrOriginUrl;
    pOpState->m_pPresentationContext = pPresentationContext;
    pOpState->m_pCacheProxyCallback = pCallback;
    pOpState->m_varContext = varContext;

    pOpState->m_pPresentationContext->AddRef();
    pOpState->m_pCacheProxyCallback->AddRef();

    if( NULL == pOpState->m_bstrOriginUrl.m_str )
    {
        pOpState->Release();
        return( E_OUTOFMEMORY );
    }

    fRet = ParseUrl( bstrOriginUrl,
                     &pOpState->m_bstrProtocol,
                     &pOpState->m_bstrHost,
                     &pOpState->m_bstrPath,
                     &pOpState->m_wPort );

    if( !fRet )
    {
        pOpState->Release();
        return( E_FAIL );
    }

    // Initiate protocol rollover by calling OnGetContentInformation with an
    // appropriate HRESULT

    VariantInit( &varContext2 );
    V_VT( &varContext2 ) = VT_UNKNOWN;
    V_UNKNOWN( &varContext2 ) = (IUnknown *) pOpState;

    pOpState->m_dwProtocolIndex = -1;

    OnGetContentInformation( NS_E_CONNECTION_FAILURE, NULL, varContext2 );

    return( S_OK );
}

HRESULT STDMETHODCALLTYPE CProxyPlugin::QuerySpaceForCacheItem | ( | long | lContentSizeLow,
 |  | long | lContentSizeHigh,
 |  | VARIANT_BOOL * | pvarfSpaceAvail |
 | ) |  |  | [inline]

Definition at line 101 of file proxypluginimpl.h.

    {
        return( E_NOTIMPL );
    }

HRESULT STDMETHODCALLTYPE CProxyPlugin::RemoveAllCacheItems | ( | IWMSCacheProxyCallback * | pCallback,
 |  | VARIANT | varContext |
 | ) |  |  | [inline]

Definition at line 82 of file proxypluginimpl.h.

    {
        return( E_NOTIMPL );
    }

HRESULT STDMETHODCALLTYPE CProxyPlugin::RemoveCacheItem | ( | BSTR | bstrOriginUrl,
 |  | IWMSCacheProxyCallback * | pCallback,
 |  | VARIANT | varContext |
 | ) |  |  | [inline]

Definition at line 74 of file proxypluginimpl.h.

    {
        return( E_NOTIMPL );
    }

HRESULT STDMETHODCALLTYPE CProxyPlugin::ShutdownPlugin ( )

Definition at line 132 of file proxypluginimpl.cpp.

{
    if( NULL != m_pICacheProxyServer )
    {
        m_pICacheProxyServer->Release();
        m_pICacheProxyServer = NULL;
    }

    return( S_OK );
}

Member Data Documentation

IWMSCacheProxyServer* CProxyPlugin::m_pICacheProxyServer [private]

Definition at line 279 of file proxypluginimpl.h.

The documentation for this class was generated from the following files:
  • Multimedia/WindowsMediaServices9/CacheProxy/cplusplus/proxypluginimpl.h
  • Multimedia/WindowsMediaServices9/CacheProxy/cplusplus/proxypluginimpl.cpp
Generated on Wed Nov 13 2024 16:57:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CProxyPlugin::COpState Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • CProxyPlugin
  • CProxyPlugin::COpState
Public Types | Public Member Functions | Public Attributes | Private Attributes

CProxyPlugin::COpState Class Reference

Inherits com::ms::com::IUnknown.

List of all members.

Public Types

enum | OpTypes { OP_QUERY_CACHE, OP_QUERY_CACHE_MISS_POLICY }

Public Member Functions

COpState ()
~COpState ()
STDMETHOD() | QueryInterface (REFIID riid, void **ppvObject)
STDMETHOD_ (ULONG, AddRef)()
STDMETHOD_ (ULONG, Release)()

Public Attributes

CComBSTR | m_bstrHost
CComBSTR | m_bstrOriginUrl
CComBSTR | m_bstrPath
CComBSTR | m_bstrProtocol
DWORD m_dwProtocolIndex
OpTypes m_Op
IWMSCacheProxyCallback * | m_pCacheProxyCallback
IWMSContext * | m_pPresentationContext
CComVariant | m_varContext
WORD | m_wPort

Private Attributes

LONG | m_cRef

Detailed Description

Definition at line 189 of file proxypluginimpl.h.

Member Enumeration Documentation

enum CProxyPlugin::COpState::OpTypes
Enumerator:
OP_QUERY_CACHE
OP_QUERY_CACHE_MISS_POLICY

Definition at line 192 of file proxypluginimpl.h.

        {
            OP_QUERY_CACHE,
            OP_QUERY_CACHE_MISS_POLICY
        };

Constructor & Destructor Documentation

CProxyPlugin::COpState::COpState ( ) [inline]

Definition at line 209 of file proxypluginimpl.h.

        {
            m_cRef = 1;
            m_pPresentationContext = NULL;
            m_pCacheProxyCallback = NULL;
            m_wPort = 0;
        }

CProxyPlugin::COpState::~COpState ( ) [inline]

Definition at line 217 of file proxypluginimpl.h.

        {
            if( NULL != m_pPresentationContext )
            {
                m_pPresentationContext->Release();
            }

            if( NULL != m_pCacheProxyCallback )
            {
                m_pCacheProxyCallback->Release();
            }
        }

Member Function Documentation

STDMETHOD() CProxyPlugin::COpState::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppvObject |
 | ) |  |  | [inline]

Definition at line 249 of file proxypluginimpl.h.

        {
            if( NULL == ppvObject )
            {
                return( E_POINTER );
            }

            *ppvObject = NULL;

            if( IID_IUnknown == riid )
            {
                AddRef();
                *ppvObject = ( IUnknown *) this;
                return( S_OK );
            }

            return( E_NOINTERFACE );
        }

CProxyPlugin::COpState::STDMETHOD_ | ( | ULONG | ,
 |  | AddRef |  |
 | ) |  |  | [inline]

Definition at line 230 of file proxypluginimpl.h.

        {
            ULONG cRef = InterlockedIncrement( &m_cRef );

            return( cRef );
        }

CProxyPlugin::COpState::STDMETHOD_ | ( | ULONG | ,
 |  | Release |  |
 | ) |  |  | [inline]

Definition at line 237 of file proxypluginimpl.h.

        {
            ULONG cRef = InterlockedDecrement( &m_cRef );
            if( 0 == cRef )
            {
                delete this;
                return( 0 );
            }

            return( cRef );
        }

Member Data Documentation

CComBSTR CProxyPlugin::COpState::m_bstrHost

Definition at line 201 of file proxypluginimpl.h.

CComBSTR CProxyPlugin::COpState::m_bstrOriginUrl

Definition at line 199 of file proxypluginimpl.h.

CComBSTR CProxyPlugin::COpState::m_bstrPath

Definition at line 202 of file proxypluginimpl.h.

CComBSTR CProxyPlugin::COpState::m_bstrProtocol

Definition at line 200 of file proxypluginimpl.h.

LONG CProxyPlugin::COpState::m_cRef [private]

Definition at line 269 of file proxypluginimpl.h.

DWORD CProxyPlugin::COpState::m_dwProtocolIndex

Definition at line 206 of file proxypluginimpl.h.

OpTypes CProxyPlugin::COpState::m_Op

Definition at line 198 of file proxypluginimpl.h.

IWMSCacheProxyCallback* CProxyPlugin::COpState::m_pCacheProxyCallback

Definition at line 204 of file proxypluginimpl.h.

IWMSContext* CProxyPlugin::COpState::m_pPresentationContext

Definition at line 203 of file proxypluginimpl.h.

CComVariant CProxyPlugin::COpState::m_varContext

Definition at line 205 of file proxypluginimpl.h.

WORD CProxyPlugin::COpState::m_wPort

Definition at line 207 of file proxypluginimpl.h.

The documentation for this class was generated from the following file:
  • Multimedia/WindowsMediaServices9/CacheProxy/cplusplus/proxypluginimpl.h
Generated on Wed Nov 13 2024 16:57:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPSTN Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CPSTN Class Reference

#include "nullmdm.h"

List of all members.

Public Member Functions

CPSTN (void)
~CPSTN (void)
HRESULT | CloseComPort ()
HRESULT | CreateComPort (UINT nTransportID, LPTSTR pszComPort)
HANDLE | GetCommLink (void)

Private Attributes

CNullModem * m_pNullModem
TCHAR | m_szComPortName [COMPORTNAMEMAXLENGTH]

Detailed Description

Definition at line 118 of file nullmdm.h.

Constructor & Destructor Documentation

CPSTN::CPSTN ( void )

Definition at line 44 of file nullmdm.cpp.

{
   m_pNullModem = NULL;
   m_szComPortName[0] = '\0';
}

CPSTN::~CPSTN ( void )

Definition at line 62 of file nullmdm.cpp.

{}

Member Function Documentation

HRESULT CPSTN::CloseComPort ( )

Definition at line 116 of file nullmdm.cpp.

{
    if (NULL != m_pNullModem)
    {
        TPhysicalError rc;
        HRESULT hr = S_OK;

        rc = m_pNullModem->TPhysDisconnect();
        if (TPHYS_SUCCESS != rc)
            hr = E_FAIL;

        rc = m_pNullModem->TPhysTerminate();
        if (TPHYS_SUCCESS != rc)
            hr = E_FAIL;

        delete m_pNullModem;
        m_pNullModem = NULL;

        return hr;
    }
    // Port already closed or never opened
    return S_FALSE;
}

HRESULT CPSTN::CreateComPort | ( | UINT | nTransportID,
 |  | LPTSTR | pszComPort
 | ) |  |

Definition at line 77 of file nullmdm.cpp.

{
    TPhysicalError rc;

    m_pNullModem = new CNullModem();
    if (NULL == m_pNullModem)
    {
        return E_OUTOFMEMORY;
    }

    lstrcpyn(m_szComPortName, pszComPort, COMPORTNAMEMAXLENGTH);

    rc = m_pNullModem->TPhysInitialize(nTransportID);
    if (TPHYS_SUCCESS != rc)
    {
        return E_FAIL;
    }

    rc = m_pNullModem->TPhysConnectRequest(m_szComPortName);
    if (TPHYS_SUCCESS != rc)
    {
        return E_FAIL;
    }

    return S_OK;
}

HANDLE CPSTN::GetCommLink ( void )

Definition at line 152 of file nullmdm.cpp.

{
    if (m_pNullModem)
        return m_pNullModem->GetCommLink();

    return NULL;
}

Member Data Documentation

CNullModem* CPSTN::m_pNullModem [private]

Definition at line 128 of file nullmdm.h.

TCHAR CPSTN::m_szComPortName[COMPORTNAMEMAXLENGTH] [private]

Definition at line 129 of file nullmdm.h.

The documentation for this class was generated from the following files:
  • Web/NetMeeting/PlugTransport/nullmdm.h
  • Web/NetMeeting/PlugTransport/nullmdm.cpp
Generated on Wed Nov 13 2024 16:57:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CPTLauncher Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CPTLauncher Class Reference

#include "PTLauncher.h"

List of all members.

Public Member Functions

CPTLauncher ()
STDMETHOD() LaunchPT ()

Detailed Description

Definition at line 16 of file PTLauncher.h.

Constructor & Destructor Documentation

CPTLauncher::CPTLauncher ( ) [inline]

Definition at line 33 of file PTLauncher.h.

  {
  }

Member Function Documentation

STDMETHODIMP CPTLauncher::LaunchPT ( )

Definition at line 18 of file PTLauncher.cpp.

{
  CComPtr<IOleContainer> spContainer;
  CComPtr<IServiceProvider> spSP;
  CComPtr<IWebBrowser2> spWB;
  CComPtr<IDispatch> spDisp;
  CComPtr<IHTMLDocument2> spDoc;
  CComPtr<IOleCommandTarget> spCT;
  CComVariant vPTPath = "res://BrochureMachine.dll/PT.htm";

  m_spClientSite->GetContainer(&spContainer);
  spContainer->QueryInterface(IID_IServiceProvider, (void**)&spSP);
  spSP->QueryService(SID_SWebBrowserApp, IID_IWebBrowser, (void**)&spWB);
  spWB->get_Document(&spDisp);
  spDisp->QueryInterface(IID_IHTMLDocument2, (void**)&spDoc);
  spDoc->QueryInterface(IID_IOleCommandTarget, (void**)&spCT);
  spCT->Exec(&CGID_MSHTML, IDM_PRINTPREVIEW, NULL, &vPTPath, NULL);

  return S_OK;
}

The documentation for this class was generated from the following files:
  • Web/Browser/BrochureMachine/PTLauncher.h
  • Web/Browser/BrochureMachine/PTLauncher.cpp
Generated on Wed Nov 13 2024 16:57:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CQCSub Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CQCSub Class Reference

#include "qcsub.h"

Inherits CSysLCESub.

List of all members.

Public Member Functions

CQCSub (CComSpy *pSpy)
CQCSub ()
STDMETHODIMP | GetEventClass (LPGUID guid)
STDMETHODIMP | GetEventType (EventEnum *e)
STDMETHODIMP | GetInterface (IID *iid)
STDMETHODIMP | OnQCMoveToDeadQueue (COMSVCSEVENTINFO *pInfo, REFGUID guidMsgId, REFGUID guidWorkFlowId)
STDMETHODIMP | OnQCMoveToReTryQueue (COMSVCSEVENTINFO *pInfo, REFGUID guidMsgId, REFGUID guidWorkFlowId, ULONG RetryIndex)
STDMETHODIMP | OnQCPlayback (COMSVCSEVENTINFO *pInfo, ULONG64 objid, REFGUID guidMsgId, REFGUID guidWorkFlowId, HRESULT msmqhr)
STDMETHODIMP | OnQCQueueOpen (COMSVCSEVENTINFO *pInfo, WCHAR szQueue[60], ULONG64 QueueID, HRESULT msmqhr)
STDMETHODIMP | OnQCReceive (COMSVCSEVENTINFO *pInfo, ULONG64 QueueID, REFGUID guidMsgId, REFGUID guidWorkFlowId, HRESULT msmqhr)
STDMETHODIMP | OnQCReceiveFail (COMSVCSEVENTINFO *pInfo, ULONG64 QueueID, HRESULT msmqhr)
STDMETHODIMP | OnQCRecord (COMSVCSEVENTINFO *pInfo, ULONG64 objid, WCHAR szQueue[60], REFGUID guidMsgId, REFGUID guidWorkFlowId, HRESULT msmqhr)

Detailed Description

Definition at line 30 of file qcsub.h.

Constructor & Destructor Documentation

CQCSub::CQCSub ( CComSpy * pSpy ) [inline]

Definition at line 35 of file qcsub.h.

  {
    m_pSpy = pSpy;
  }

CQCSub::CQCSub ( ) [inline]

Definition at line 40 of file qcsub.h.

  {
    m_pSpy = NULL;
  }

Member Function Documentation

STDMETHODIMP CQCSub::GetEventClass ( LPGUID guid ) [inline, virtual]

Implements CSysLCESub.

Definition at line 54 of file qcsub.h.

{*guid = CLSID_ComServiceEvents;return S_OK;}

STDMETHODIMP CQCSub::GetEventType ( EventEnum * e ) [inline, virtual]

Implements CSysLCESub.

Definition at line 53 of file qcsub.h.

{*e = QC;return S_OK;}

STDMETHODIMP CQCSub::GetInterface ( IID * iid ) [inline, virtual]

Implements CSysLCESub.

Definition at line 55 of file qcsub.h.

{*iid = IID_IComQCEvents;return S_OK;}

STDMETHODIMP CQCSub::OnQCMoveToDeadQueue | ( | COMSVCSEVENTINFO * | pInfo,
 |  | REFGUID | guidMsgId,
 |  | REFGUID | guidWorkFlowId |
 | ) |  |  | [inline]

Definition at line 198 of file qcsub.h.

  {
    CComBSTR sGuidMsgId = GuidToBstr(guidMsgId);
    CComBSTR sGuidWorkFlowId = GuidToBstr(guidWorkFlowId);
    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnQCMoveToDeadQueue"), GuidToBstr(pInfo->guidApp));
    m_pSpy -> AddParamValueToList(L"MsgId", sGuidMsgId);
    m_pSpy -> AddParamValueToList(L"WorkflowId", sGuidWorkFlowId);

    IF_AUDIT_DO(OnQCMoveToDeadQueue)(pInfo->perfCount, GuidToBstr(pInfo->guidApp),
                    sGuidMsgId,
                    sGuidWorkFlowId);

    return S_OK;
  }

STDMETHODIMP CQCSub::OnQCMoveToReTryQueue | ( | COMSVCSEVENTINFO * | pInfo,
 |  | REFGUID | guidMsgId,
 |  | REFGUID | guidWorkFlowId,
 |  | ULONG | RetryIndex |
 | ) |  |  | [inline]

Definition at line 173 of file qcsub.h.

  {
    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnQCMoveToReTryQueue"), GuidToBstr(pInfo->guidApp));

    CComBSTR sGuidMsgId = GuidToBstr(guidMsgId);
    CComBSTR sGuidWorkFlowId = GuidToBstr(guidWorkFlowId);

    m_pSpy -> AddParamValueToList(L"MsgId", sGuidMsgId);
    m_pSpy -> AddParamValueToList(L"WorkflowId", sGuidWorkFlowId);

    WCHAR p1[16];
    wsprintfW(p1, L"0x%08X", RetryIndex);
    m_pSpy -> AddParamValueToList(L"ReTry Index", p1);

    IF_AUDIT_DO(OnQCMoveToReTryQueue)(pInfo->perfCount, GuidToBstr(pInfo->guidApp),
                  sGuidMsgId,
                  sGuidWorkFlowId,
                  RetryIndex);

    return S_OK;
  }

STDMETHODIMP CQCSub::OnQCPlayback | ( | COMSVCSEVENTINFO * | pInfo,
 |  | ULONG64 | objid,
 |  | REFGUID | guidMsgId,
 |  | REFGUID | guidWorkFlowId,
 |  | HRESULT | msmqhr |
 | ) |  |  | [inline]

Definition at line 217 of file qcsub.h.

  {

    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnQCPlayback"), GuidToBstr(pInfo->guidApp));

    CComBSTR sGuidMsgId = GuidToBstr(guidMsgId);
    CComBSTR sGuidWorkFlowId = GuidToBstr(guidWorkFlowId);

    WCHAR szObjectID[32];
    wsprintfW(szObjectID, L"0x%016X", objid);
    m_pSpy -> AddParamValueToList(L"ObjectID", szObjectID);

    m_pSpy -> AddParamValueToList(L"MsgId", sGuidMsgId);
    m_pSpy -> AddParamValueToList(L"WorkflowId", sGuidWorkFlowId);

    WCHAR p1[16];
    wsprintfW(p1, L"0x%08X", msmqhr);
    m_pSpy -> AddParamValueToList(L"MSMQ HR", p1);

    IF_AUDIT_DO(OnQCPlayback)(pInfo->perfCount, GuidToBstr(pInfo->guidApp),
                    szObjectID,
                    sGuidMsgId,
                    sGuidWorkFlowId,
                    msmqhr);

    return S_OK;
  }

STDMETHODIMP CQCSub::OnQCQueueOpen | ( | COMSVCSEVENTINFO * | pInfo,
 |  | WCHAR | szQueue[60],
 |  | ULONG64 | QueueID,
 |  | HRESULT | msmqhr |
 | ) |  |  | [inline]

Definition at line 94 of file qcsub.h.

  {

    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnQCQueueOpen"), GuidToBstr(pInfo->guidApp));
    m_pSpy -> AddParamValueToList(L"Queue", szQueue);

    WCHAR szQueueID[32];
    wsprintfW(szQueueID, L"0x%016X", QueueID);
    m_pSpy -> AddParamValueToList(L"QueueID", szQueueID);

    WCHAR p1[16];
    wsprintfW(p1, L"0x%08X", msmqhr);
    m_pSpy -> AddParamValueToList(L"MSMQ HR", p1);

    IF_AUDIT_DO(OnQCQueueOpen)(pInfo->perfCount, GuidToBstr(pInfo->guidApp),
                  szQueue,
                  szQueueID,
                  msmqhr);

    return S_OK;
  }

STDMETHODIMP CQCSub::OnQCReceive | ( | COMSVCSEVENTINFO * | pInfo,
 |  | ULONG64 | QueueID,
 |  | REFGUID | guidMsgId,
 |  | REFGUID | guidWorkFlowId,
 |  | HRESULT | msmqhr |
 | ) |  |  | [inline]

Definition at line 119 of file qcsub.h.

  {
    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnQCReceive"), GuidToBstr(pInfo->guidApp));

    CComBSTR sGuidMsgId = GuidToBstr(guidMsgId);
    CComBSTR sGuidWorkFlowId = GuidToBstr(guidWorkFlowId);

    WCHAR szQueueID[32];
    wsprintfW(szQueueID, L"0x%016X", QueueID);
    m_pSpy -> AddParamValueToList(L"QueueID", szQueueID);

    m_pSpy -> AddParamValueToList(L"MsgId", sGuidMsgId);
    m_pSpy -> AddParamValueToList(L"WorkflowId", sGuidWorkFlowId);

    WCHAR p1[16];
    wsprintfW(p1, L"0x%08X", msmqhr);
    m_pSpy -> AddParamValueToList(L"MSMQ HR", p1);

    IF_AUDIT_DO(OnQCReceive)(pInfo->perfCount, GuidToBstr(pInfo->guidApp),
                  szQueueID,
                  sGuidMsgId,
                  sGuidWorkFlowId,
                  msmqhr);
    return S_OK;
  }

STDMETHODIMP CQCSub::OnQCReceiveFail | ( | COMSVCSEVENTINFO * | pInfo,
 |  | ULONG64 | QueueID,
 |  | HRESULT | msmqhr |
 | ) |  |  | [inline]

Definition at line 152 of file qcsub.h.

  {

    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnQCReceiveFail"), GuidToBstr(pInfo->guidApp));

    WCHAR szQueueID[32];
    wsprintfW(szQueueID, L"0x%016X", QueueID);
    m_pSpy -> AddParamValueToList(L"QueueID", szQueueID);

    WCHAR p1[16];
    wsprintfW(p1, L"0x%08X", msmqhr);
    m_pSpy -> AddParamValueToList(L"MSMQ HR", p1);

    IF_AUDIT_DO(OnQCReceiveFail)(pInfo->perfCount, GuidToBstr(pInfo->guidApp),
                  szQueueID,
                  msmqhr);
    return S_OK;
  }

STDMETHODIMP CQCSub::OnQCRecord | ( | COMSVCSEVENTINFO * | pInfo,
 |  | ULONG64 | objid,
 |  | WCHAR | szQueue[60],
 |  | REFGUID | guidMsgId,
 |  | REFGUID | guidWorkFlowId,
 |  | HRESULT | msmqhr |
 | ) |  |  | [inline]

Definition at line 58 of file qcsub.h.

  {
    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnQCRecord"), GuidToBstr(pInfo->guidApp));

    CComBSTR sGuidMsgId = GuidToBstr(guidMsgId);
    CComBSTR sGuidWorkFlowId = GuidToBstr(guidWorkFlowId);

    WCHAR szObjectID[32];
    wsprintfW(szObjectID, L"0x%016X", objid);
    m_pSpy -> AddParamValueToList(L"ObjectID", szObjectID);

    m_pSpy -> AddParamValueToList(L"Queue", szQueue);
    m_pSpy -> AddParamValueToList(L"MsgId", sGuidMsgId);
    m_pSpy -> AddParamValueToList(L"WorkflowId", sGuidWorkFlowId);

    WCHAR szHr[16];
    wsprintfW(szHr, L"0x%08X", msmqhr);
    m_pSpy -> AddParamValueToList(L"MSMQ HR", szHr);

    IF_AUDIT_DO(OnQCRecord)(pInfo->perfCount, GuidToBstr(pInfo->guidApp),
                szObjectID,
                szQueue,
                sGuidMsgId,
                sGuidWorkFlowId,
                msmqhr);

    return S_OK;
  }

The documentation for this class was generated from the following file:
  • Com/Administration/Spy/ComSpyCtl/qcsub.h
Generated on Wed Nov 13 2024 16:57:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CQueryBox Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CQueryBox Class Reference

#include "cmdichild.h"

Inherits CRichEditLite.

List of all members.

Public Member Functions

CQueryBox (CMDIChild *pCMDIChild)
virtual | ~CQueryBox ()
virtual BOOL | OnContextMenu (HWND hWnd, REFPOINTS pts)
virtual BOOL | OnKeyDown (WPARAM nVirtKey, LPARAM lKeyData)
virtual BOOL | OnRButtonDown (WPARAM fwKeys, REFPOINTS pts)

Public Attributes

CMDIChild * m_pCMDIChild

Detailed Description

Definition at line 39 of file cmdichild.h.

Constructor & Destructor Documentation

CQueryBox::CQueryBox ( CMDIChild * pCMDIChild )

Definition at line 10057 of file cmdichild.cpp.

{
  ASSERT(pCMDIChild);
  m_pCMDIChild = pCMDIChild;
}

CQueryBox::~CQueryBox ( ) [virtual]

Definition at line 10068 of file cmdichild.cpp.

{
}

Member Function Documentation

BOOL CQueryBox::OnContextMenu | ( | HWND | hWnd,
 |  | REFPOINTS | pts |
 | ) |  |  | [virtual]

Definition at line 10097 of file cmdichild.cpp.

{
  DisplayContextMenu(
            hWnd,
            IDM_EDITMENU,
            pts,
            m_pCMDIChild->m_hWnd
            );
  return  TRUE;
}

BOOL CQueryBox::OnKeyDown | ( | WPARAM | nVirtKey,
 |  | LPARAM | lKeyData |
 | ) |  |  | [virtual]

Definition at line 10113 of file cmdichild.cpp.

{
  switch(nVirtKey)
  {
    case VK_TAB:
    {
      MSG msg;
      m_pCMDIChild->m_pCDataGrid->SetFocus();
      PeekMessage(&msg, NULL, 0, 0, PM_REMOVE);
      return TRUE;
    }
  };

  return FALSE;
}

BOOL CQueryBox::OnRButtonDown | ( | WPARAM | fwKeys,
 |  | REFPOINTS | pts |
 | ) |  |  | [virtual]

Definition at line 10077 of file cmdichild.cpp.

{
  //NOTE: The right mouse button doesn't automatically activate the MDI window...
  m_pCMDIChild->m_pCMainWindow->MDIActivate(m_hWndParent);

  //xPos, yPos are Relative to the Client Area...
  DisplayContextMenu(
            m_hWnd,
            IDM_EDITMENU,
            pts,
            m_pCMDIChild->m_hWnd,
            TRUE
            );
  return TRUE;
}

Member Data Documentation

CMDIChild* CQueryBox::m_pCMDIChild

Definition at line 53 of file cmdichild.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cmdichild.h
  • Dataaccess/oledb/rowsetviewer/cmdichild.cpp
Generated on Wed Nov 13 2024 16:57:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CQueryDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Private Attributes

CQueryDlg Class Reference

#include "QueryDlg.h"

List of all members.

Public Types

enum | { IDD = IDD_QUERY_SESSION }

Public Member Functions

CQueryDlg (CWnd *pParent=NULL)

Public Attributes

DWORD BytesReturned
CEdit | m_displayInfo
CListBox | m_querySession
CEdit | m_serverName
CString m_sessionInfo
LPTSTR pSessionInfo

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
virtual void | OnCancel ()
afx_msg void | OnDblclkQuerySession ()
virtual BOOL | OnInitDialog ()
afx_msg void | OnQuery ()

Private Attributes

HANDLE serverHandle
LPSTR serverName

Detailed Description

Definition at line 25 of file QueryDlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 35 of file QueryDlg.h.

{ IDD = IDD_QUERY_SESSION };

Constructor & Destructor Documentation

CQueryDlg::CQueryDlg ( CWnd * pParent = NULL )

Definition at line 51 of file QueryDlg.Cpp.

  : CDialog(CQueryDlg::IDD, pParent)
{
}

Member Function Documentation

void CQueryDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 57 of file QueryDlg.Cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CQueryDlg)
  DDX_Control(pDX, IDC_SESSION_INFO, m_displayInfo);
  DDX_Control(pDX, IDC_SERVERNAME, m_serverName);
  DDX_Control(pDX, IDC_QUERY_SESSION, m_querySession);
  DDX_Text(pDX, IDC_SESSION_INFO, m_sessionInfo);
  //}}AFX_DATA_MAP
}

void CQueryDlg::OnCancel ( ) [protected, virtual]

Definition at line 307 of file QueryDlg.Cpp.

{
    WTSFreeMemory(pSessionInfo);
  CDialog::OnCancel();
}

void CQueryDlg::OnDblclkQuerySession ( ) [protected]

Definition at line 314 of file QueryDlg.Cpp.

{
  OnQuery();
}

BOOL CQueryDlg::OnInitDialog ( void ) [protected, virtual]

Definition at line 79 of file QueryDlg.Cpp.

{
  CDialog::OnInitDialog();
  LPSTR serverName = g_pDoc->GetServerName();

  CString serverDisplay;
  serverDisplay = "Query types for ";
  //if (*serverName == NULL)
  if (serverName == NULL)
    serverDisplay += "local server";
  else
    serverDisplay += serverName;
  m_serverName.SetWindowText(serverDisplay);

  for (int i=0; i < MAXQUERYITEMS; i++)
    m_querySession.InsertString(i, QueryItems[i].QueryName);
  m_querySession.SetCurSel(0);
  return TRUE;
}

void CQueryDlg::OnQuery ( ) [protected]

Definition at line 99 of file QueryDlg.Cpp.

{
  LPSTR serverName = g_pDoc->GetServerName();
  HANDLE serverHandle = WTSOpenServer(serverName);
  DWORD sessionID = g_pDoc->GetSessionID();
  BytesReturned = 0;
  int nIndex = m_querySession.GetCurSel();
  if (!WTSQuerySessionInformation(serverHandle, sessionID,
    QueryItems[nIndex].InfoClass, &pSessionInfo, &BytesReturned))
     AfxMessageBox("Query failed!");
  else
  {

    switch ( QueryItems[nIndex].InfoClass ) {
#ifdef ICA_STUFF_INCLUDED
        case WTSVersion:
    {
      LPOSVERSIONINFO pVerInfo = (LPOSVERSIONINFO) pSessionInfo;
      m_sessionInfo.Format("Version: major %u \r\n minor %u \r\n build %u \r\n CSD Version: %s",
                      pVerInfo->dwMajorVersion, pVerInfo->dwMinorVersion,
                      pVerInfo->dwBuildNumber, pVerInfo->szCSDVersion);
    }
      break;
#endif
        case WTSInitialProgram:
      m_sessionInfo.Format("Initial Program:\r\n ");
      //m_sessionInfo = "Initial Program: ";
      m_sessionInfo += pSessionInfo;
      break;

        case WTSWorkingDirectory:
      m_sessionInfo.Format("Working Directory:\r\n ");
      m_sessionInfo += pSessionInfo;
            break;

        case WTSOEMId:
            m_sessionInfo = "OEM ID: ";
      m_sessionInfo += pSessionInfo;
            break;

        case WTSSessionId:
      m_sessionInfo.Format(TEXT("Session ID: %u"), *(DWORD *) pSessionInfo);
            break;

        case WTSUserName:
            m_sessionInfo = "UserName: ";
      m_sessionInfo += pSessionInfo;
            break;

        case WTSWinStationName:
            m_sessionInfo = "WinStation Name: ";
      m_sessionInfo += pSessionInfo;
      break;

        case WTSDomainName:
            m_sessionInfo = "Domain Name: ";
      m_sessionInfo += pSessionInfo;
            break;

        case WTSConnectState:
      {CString connectState[10];
      connectState[0] = "Active";
      connectState[1] = "Connected";
      connectState[2] = "ConnectQuery";
      connectState[3] = "Shadow";
      connectState[4] = "Disconnected";
      connectState[5] = "Idle";
      connectState[6] = "Listen";
      connectState[7] = "Reset";
      connectState[8] = "Down";
      connectState[9] = "Init";
      m_sessionInfo.Format("Connection State: %s", connectState[(*(DWORD *) pSessionInfo)]);
      }
      break;

        case WTSClientBuildNumber :
      m_sessionInfo.Format("Client Build Number: %d",(*(WORD*) pSessionInfo));
            break;

        case WTSClientName :
            m_sessionInfo = "Client Name: ";
      m_sessionInfo += pSessionInfo;
            break;

        case WTSClientDirectory :
      m_sessionInfo.Format("Client Directory:\r\n %s", pSessionInfo);
            break;

        case WTSClientProductId :
      m_sessionInfo.Format("Client Product ID: %u",(*(WORD*) pSessionInfo));
      break;

    case WTSClientAddress:
    {
      BYTE * pByte;
      PWTS_CLIENT_ADDRESS pClientAddress = (PWTS_CLIENT_ADDRESS) pSessionInfo;
            m_sessionInfo.Format( TEXT("ClientAddress: (%u) "),
                      pClientAddress->AddressFamily );

      CString tempString;
      switch ( pClientAddress->AddressFamily ) {
                case 0 :
                    tempString.Format( TEXT("%s"), pClientAddress->Address );
                    m_sessionInfo += tempString;
          break;
                case 2 :
                    pByte = &pClientAddress->Address[2];
                    tempString.Format( TEXT("%u.%u.%u.%u"),
                              pByte[0], pByte[1], pByte[2], pByte[3] );
          m_sessionInfo += tempString;
                    break;
                case 6 :
                    pByte = pClientAddress->Address;
                    for ( int i=0; i<4; i++ ) {
                        tempString.Format( TEXT("%02x"), pByte[i] );
            m_sessionInfo += tempString;
          }
          m_sessionInfo += ":";
                    for ( i=4; i<10; i++ ){
                        tempString.Format( TEXT("%02x"), pByte[i] );
            m_sessionInfo += tempString;
          }
                    break;
            }

    }
      break;

    case WTSClientDisplay:
    { PWTS_CLIENT_DISPLAY SessionInfo = (PWTS_CLIENT_DISPLAY) pSessionInfo;
      m_sessionInfo.Format("Client Display:\r\n  Resolution: %d X %d\r\n  Color Depth %d",
        SessionInfo->HorizontalResolution,
        SessionInfo->VerticalResolution,
        SessionInfo->ColorDepth);
    }
      break;

#ifdef ICA_STUFF_INCLUDED
    case WTSClientCache:

    { PWTS_CLIENT_CACHE SessionInfo = (PWTS_CLIENT_CACHE) pSessionInfo;
      m_sessionInfo.Format("Client Cache:\r\n  Tiny Cache %d\r\n  Low Memory Cache %d\r\n  XMS Cache %d\r\n  Disk Cache %d\r\n  Cache Size Dim %d\r\n  Bitmap Min Dim %d\r\n  Signature Level Dim %d\r\n  File System Overhead %d",
        SessionInfo->CacheTiny,
        SessionInfo->CacheLowMem,
        SessionInfo->CacheDisk,
        SessionInfo->DimCacheSize,
        SessionInfo->DimBitmapMin,
        SessionInfo->DimSignatureLevel,
        SessionInfo->DimFilesysOverhead);
    }
      break;

    case WTSClientDrives:
    {
      PWTS_CLIENT_DRIVES pClientDrives = (PWTS_CLIENT_DRIVES) pSessionInfo;
            CString tempString;
      CString driveType[10];
      driveType[0] = "Removeable";
      driveType[1] = "Fixed";
      driveType[2] = "Remote";
      driveType[3] = "CD-Rom";
      driveType[4] = "Ram Disk";
      driveType[5] = "AutoConnect";
      driveType[6] = "Unknown";

      m_sessionInfo.Format( TEXT("WTSClientDrives: fAuto %u, count %u \r\n"),
                      pClientDrives->fAutoClientDrives,
                      pClientDrives->Count );

      for ( DWORD i=0; i < pClientDrives->Count; i++ ) {
                switch (pClientDrives->Drives[i].Flags)
        {
          case  1: nIndex = 0; break;
          case  2: nIndex = 1; break;
          case  4: nIndex = 2; break;
          case  8: nIndex = 3; break;
          case 10: nIndex = 4; break;
          case 20: nIndex = 5; break;
          default: nIndex = 6;
        }
        tempString.Format( TEXT(" %c:%s \r\n"),
          pClientDrives->Drives[i].DriveLetter,
          driveType[nIndex]);
        m_sessionInfo += tempString;
      }
    }
      break;

    case WTSICABufferLength:
      m_sessionInfo.Format("ICA Buffer Length: %u", (*(DWORD *) pSessionInfo));
      break;

    case WTSLicenseEnabler:
      m_sessionInfo.Format("License Enabler: %x", (*(DWORD *) pSessionInfo));
      break;
#endif

    case WTSApplicationName:
            m_sessionInfo.Format("ApplicationName: %s", pSessionInfo );
            break;
    }

    SetDlgItemText(IDC_SESSION_INFO, m_sessionInfo);
    WTSFreeMemory( pSessionInfo );
  }

}

Member Data Documentation

DWORD CQueryDlg::BytesReturned

Definition at line 29 of file QueryDlg.h.

CEdit CQueryDlg::m_displayInfo

Definition at line 36 of file QueryDlg.h.

CListBox CQueryDlg::m_querySession

Definition at line 38 of file QueryDlg.h.

CEdit CQueryDlg::m_serverName

Definition at line 37 of file QueryDlg.h.

CString CQueryDlg::m_sessionInfo

Definition at line 39 of file QueryDlg.h.

LPTSTR CQueryDlg::pSessionInfo

Definition at line 30 of file QueryDlg.h.

HANDLE CQueryDlg::serverHandle [private]

Definition at line 63 of file QueryDlg.h.

LPSTR CQueryDlg::serverName [private]

Definition at line 62 of file QueryDlg.h.

The documentation for this class was generated from the following files:
  • WinBase/WtsApi/WtsApi/QueryDlg.h
  • WinBase/WtsApi/WtsApi/QueryDlg.Cpp
Generated on Wed Nov 13 2024 16:57:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CQuickStringWrap Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CQuickStringWrap Class Reference

List of all members.

Public Member Functions

CQuickStringWrap ()
~CQuickStringWrap ()
operator LPCWSTR () const
BOOL | Set (LPCWSTR szIn, DWORD dwLen)

Private Attributes

LPWSTR | _szAlloc

Detailed Description

Definition at line 17 of file WinHttpPostSample.cpp.

Constructor & Destructor Documentation

CQuickStringWrap::CQuickStringWrap ( ) [inline]

Definition at line 22 of file WinHttpPostSample.cpp.

    {
        _szAlloc = NULL;
    }

CQuickStringWrap::~CQuickStringWrap ( ) [inline]

Definition at line 27 of file WinHttpPostSample.cpp.

    {
        if (_szAlloc != NULL)
            delete [] _szAlloc;
    }

Member Function Documentation

CQuickStringWrap::operator LPCWSTR ( ) const [inline]

Definition at line 33 of file WinHttpPostSample.cpp.

{ return _szAlloc;}

BOOL CQuickStringWrap::Set | ( | LPCWSTR | szIn,
 |  | DWORD | dwLen |
 | ) |  |  | [inline]

Definition at line 35 of file WinHttpPostSample.cpp.

    {
        LPWSTR szNew;

        szNew = new WCHAR[dwLen+1];

        if (szNew == NULL)
        {
            SetLastError( ERROR_OUTOFMEMORY);
            return FALSE;
        }

        memcpy(szNew, szIn, dwLen*sizeof(WCHAR));
        szNew[dwLen] = L'\0';

        if (_szAlloc != NULL)
            delete [] _szAlloc;

        _szAlloc = szNew;

        return TRUE;
    }

Member Data Documentation

LPWSTR CQuickStringWrap::_szAlloc [private]

Definition at line 19 of file WinHttpPostSample.cpp.

The documentation for this class was generated from the following file:
  • Web/winhttp/WinHttpPostSample/WinHttpPostSample.cpp
Generated on Wed Nov 13 2024 16:57:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CRDOComponent Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CRDOComponent Class Reference

#include "rdocomponent.h"

List of all members.

Public Member Functions

CRDOComponent ()
STDMETHOD() | Activate ()
STDMETHOD() | SimpleQuery (VARIANT *returnval)
STDMETHOD_ (BOOL, CanBePooled)()
STDMETHOD_ (void, Deactivate)()

Public Attributes

CComPtr< IObjectContext > | m_spObjectContext

Detailed Description

Definition at line 31 of file rdocomponent.h.

Constructor & Destructor Documentation

CRDOComponent::CRDOComponent ( ) [inline]

Definition at line 38 of file rdocomponent.h.

  {
  }

Member Function Documentation

HRESULT CRDOComponent::Activate ( void )

Definition at line 29 of file rdocomponent.Cpp.

{
  HRESULT hr = CoGetObjectContext(IID_IObjectContext, (void**)&m_spObjectContext);
  if (SUCCEEDED(hr))
    return S_OK;
  return hr;
}

STDMETHODIMP CRDOComponent::SimpleQuery ( VARIANT * returnval )

Definition at line 48 of file rdocomponent.Cpp.

{

  _rdoEnginePtr rdoEngine1;
  _rdoConnectionPtr rdoCon;
  _rdoResultsetPtr rdoRs;
  _variant_t InVar;

   _bstr_t Source("select au_fname from authors where au_lname = 'White'");
   //NOTE: Secure database installations should never have a blank password
   // Trusted security is recommended for production systems - this avoids
   // having to store the password in the code
   _bstr_t Connect("DSN=pubs;Uid=sa;Pwd=;Database=pubs");

  HRESULT hr = rdoEngine1.CreateInstance(__uuidof(rdoEngine));
   if (FAILED(hr)) return hr;

  try
  {
    rdoEngine1->rdoEnvironments->GetItem(0L)->CursorDriver = rdUseNone;
    rdoCon =rdoEngine1->rdoEnvironments->GetItem(0L)->OpenConnection("",
      (long)rdDriverNoPrompt, 0L, Connect);

    rdoRs = rdoCon->OpenResultset(Source);
    InVar = rdoRs->rdoColumns->GetItem("au_fname")->Value;

    VariantClear(returnval);
    VariantCopy(returnval, &(InVar.Detach()));

    rdoRs->Close();
    rdoRs=NULL;
    rdoCon->Close();
    rdoCon = NULL;
    rdoEngine1 = NULL;
  }

  catch(_com_error z)
  {
    if(rdoRs)
    {
      rdoRs->Close();
      rdoRs = NULL;
    }
    if(rdoCon)
    {
      rdoCon->Close();
      rdoCon = NULL;
    }
    if(rdoEngine1)
      rdoEngine1 = NULL;

    if(m_spObjectContext)
      m_spObjectContext->SetAbort();
    return z.Error();
  }

  if (m_spObjectContext)
    m_spObjectContext->SetComplete();
  return S_OK;
}

CRDOComponent::STDMETHOD_ | ( | void | ,
 |  | Deactivate |
 | ) |  |
CRDOComponent::STDMETHOD_ | ( | BOOL | ,
 |  | CanBePooled |
 | ) |  |

Member Data Documentation

CComPtr<IObjectContext> CRDOComponent::m_spObjectContext

Definition at line 57 of file rdocomponent.h.

The documentation for this class was generated from the following files:
  • Com/Services/Transaction/DataAccess/DataAcRDO/rdocomponent.h
  • Com/Services/Transaction/DataAccess/DataAcRDO/rdocomponent.Cpp
Generated on Wed Nov 13 2024 16:57:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CREATEDATA Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

CREATEDATA Struct Reference

#include "bankdlg.h"

List of all members.

Public Attributes

BOOL bChatty
BOOL bDone
BOOL bStop
HWND | hWndResults
HWND | hWndStopButton
int | nRows
int | nTotalRows

Detailed Description

Definition at line 89 of file bankdlg.h.

Member Data Documentation

BOOL CREATEDATA::bChatty

Definition at line 98 of file bankdlg.h.

BOOL CREATEDATA::bDone

Definition at line 96 of file bankdlg.h.

BOOL CREATEDATA::bStop

Definition at line 95 of file bankdlg.h.

HWND CREATEDATA::hWndResults

Definition at line 93 of file bankdlg.h.

HWND CREATEDATA::hWndStopButton

Definition at line 94 of file bankdlg.h.

int CREATEDATA::nRows

Definition at line 92 of file bankdlg.h.

int CREATEDATA::nTotalRows

Definition at line 97 of file bankdlg.h.

The documentation for this struct was generated from the following file:
  • Com/Services/Object_Pooling/OPBankSample/OPBank/bankdlg.h
Generated on Wed Nov 13 2024 16:57:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CREATEGIZMOA Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

CREATEGIZMOA Struct Reference

#include "GizmoBar.h"

List of all members.

Public Attributes

UINT dx
UINT dy
HBITMAP | hBmp
HWND | hWndParent
UINT iGizmo
UINT iImage
UINT iType
LPSTR pszText
UINT uID
UINT uState

Detailed Description

Definition at line 126 of file GizmoBar.h.

Member Data Documentation

UINT CREATEGIZMOA::dx

Definition at line 132 of file GizmoBar.h.

UINT CREATEGIZMOA::dy

Definition at line 133 of file GizmoBar.h.

HBITMAP CREATEGIZMOA::hBmp

Definition at line 135 of file GizmoBar.h.

HWND CREATEGIZMOA::hWndParent

Definition at line 128 of file GizmoBar.h.

UINT CREATEGIZMOA::iGizmo

Definition at line 130 of file GizmoBar.h.

UINT CREATEGIZMOA::iImage

Definition at line 136 of file GizmoBar.h.

UINT CREATEGIZMOA::iType

Definition at line 129 of file GizmoBar.h.

LPSTR CREATEGIZMOA::pszText

Definition at line 134 of file GizmoBar.h.

UINT CREATEGIZMOA::uID

Definition at line 131 of file GizmoBar.h.

UINT CREATEGIZMOA::uState

Definition at line 137 of file GizmoBar.h.

The documentation for this struct was generated from the following file:
  • Com/Fundamentals/Include/GizmoBar.h
Generated on Wed Nov 13 2024 16:57:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CREATEGIZMOW Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

CREATEGIZMOW Struct Reference

#include "GizmoBar.h"

List of all members.

Public Attributes

UINT dx
UINT dy
HBITMAP | hBmp
HWND | hWndParent
UINT iGizmo
UINT iImage
UINT iType
LPWSTR | pszText
UINT uID
UINT uState

Detailed Description

Definition at line 139 of file GizmoBar.h.

Member Data Documentation

UINT CREATEGIZMOW::dx

Definition at line 145 of file GizmoBar.h.

UINT CREATEGIZMOW::dy

Definition at line 146 of file GizmoBar.h.

HBITMAP CREATEGIZMOW::hBmp

Definition at line 148 of file GizmoBar.h.

HWND CREATEGIZMOW::hWndParent

Definition at line 141 of file GizmoBar.h.

UINT CREATEGIZMOW::iGizmo

Definition at line 143 of file GizmoBar.h.

UINT CREATEGIZMOW::iImage

Definition at line 149 of file GizmoBar.h.

UINT CREATEGIZMOW::iType

Definition at line 142 of file GizmoBar.h.

LPWSTR CREATEGIZMOW::pszText

Definition at line 147 of file GizmoBar.h.

UINT CREATEGIZMOW::uID

Definition at line 144 of file GizmoBar.h.

UINT CREATEGIZMOW::uState

Definition at line 150 of file GizmoBar.h.

The documentation for this struct was generated from the following file:
  • Com/Fundamentals/Include/GizmoBar.h
Generated on Wed Nov 13 2024 16:57:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CReceiveMessageDialog Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions

CReceiveMessageDialog Class Reference

#include "RecvMDlg.h"

List of all members.

Public Types

enum | { IDD = IDD_RECEIVE_MESSAGE_DIALOG }

Public Member Functions

CReceiveMessageDialog (CArray< ARRAYQ *, ARRAYQ * > *, CWnd *pParent=NULL)
DWORD GetBodySize ()
void | GetPathName (TCHAR szPathName[BUFFERSIZE])
DWORD GetTimeout ()

Public Attributes

DWORD m_dwBodySize
int | m_iTimeout
CComboBox | m_PathNameCB
CArray< ARRAYQ *, ARRAYQ * > * | m_pStrArray
CString m_szPathName

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
virtual BOOL | OnInitDialog ()

Detailed Description

Definition at line 19 of file RecvMDlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 27 of file RecvMDlg.h.

{ IDD = IDD_RECEIVE_MESSAGE_DIALOG };

Constructor & Destructor Documentation

CReceiveMessageDialog::CReceiveMessageDialog | ( | CArray< ARRAYQ *, ARRAYQ * > * | pStrArray,
 |  | CWnd * | pParent = NULL
 | ) |  |

Definition at line 31 of file RecvMDlg.Cpp.

   : CDialog(CReceiveMessageDialog::IDD, pParent)
{
   m_pStrArray = pStrArray;

   //{{AFX_DATA_INIT(CReceiveMessageDialog)
   m_szPathName = _T("");
   m_iTimeout = 20000;
  m_dwBodySize = BUFFERSIZE;
  //}}AFX_DATA_INIT
}

Member Function Documentation

void CReceiveMessageDialog::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 44 of file RecvMDlg.Cpp.

{
   CDialog::DoDataExchange(pDX);
   //{{AFX_DATA_MAP(CReceiveMessageDialog)
   DDX_Control(pDX, IDC_COMBO, m_PathNameCB);
   DDX_CBString(pDX, IDC_COMBO, m_szPathName);
  DDV_MaxChars(pDX, m_szPathName, 4000);
   DDX_Text(pDX, IDC_TIMEOUT, m_iTimeout);
  DDX_Text(pDX, IDC_EDT_BODY_SIZE, m_dwBodySize);
  DDV_MinMaxDWord(pDX, m_dwBodySize, 1, 100000000);
  //}}AFX_DATA_MAP
}

DWORD CReceiveMessageDialog::GetBodySize ( ) [inline]

Definition at line 73 of file RecvMDlg.h.

  {
      if (m_dwBodySize == 0)
      {
         m_dwBodySize = BUFFERSIZE ;
      }
    return (m_dwBodySize) ;
  }

void CReceiveMessageDialog::GetPathName ( TCHAR szPathName[BUFFERSIZE] ) [inline]

Definition at line 55 of file RecvMDlg.h.

  {
    ASSERT(szPathName != NULL);

    _tcsncpy (szPathName, m_szPathName, BUFFERSIZE-1);
    szPathName[BUFFERSIZE-1] = '\0';

  }

DWORD CReceiveMessageDialog::GetTimeout ( ) [inline]

Definition at line 64 of file RecvMDlg.h.

  {
      if (m_iTimeout < 0)
      {
         m_iTimeout = INFINITE;
      }
    return (m_iTimeout);
  }

BOOL CReceiveMessageDialog::OnInitDialog ( ) [protected, virtual]

Definition at line 66 of file RecvMDlg.Cpp.

{
   CDialog::OnInitDialog();

   // TODO: Add extra initialization here

   int i;

   for  (i=0 ; i<m_pStrArray->GetSize() ; i++)
   {
      if (((*m_pStrArray)[i]->dwAccess & MQ_RECEIVE_ACCESS) != FALSE)
      {
     if ((*m_pStrArray)[i]->bFormatNameOnly)
     {
      VERIFY (m_PathNameCB.AddString((*m_pStrArray)[i]->szFormatName) != CB_ERR);
     }
     else
     {
      VERIFY (m_PathNameCB.AddString((*m_pStrArray)[i]->szPathName) != CB_ERR);
     }
      }
   }

    if (m_PathNameCB.GetCount() > 0) m_PathNameCB.SetCurSel(0);

    return TRUE;  // return TRUE unless you set the focus to a control
                 // EXCEPTION: OCX Property Pages should return FALSE
}

Member Data Documentation

DWORD CReceiveMessageDialog::m_dwBodySize

Definition at line 31 of file RecvMDlg.h.

int CReceiveMessageDialog::m_iTimeout

Definition at line 30 of file RecvMDlg.h.

CComboBox CReceiveMessageDialog::m_PathNameCB

Definition at line 28 of file RecvMDlg.h.

CArray<ARRAYQ*, ARRAYQ*>* CReceiveMessageDialog::m_pStrArray

Definition at line 35 of file RecvMDlg.h.

CString CReceiveMessageDialog::m_szPathName

Definition at line 29 of file RecvMDlg.h.

The documentation for this class was generated from the following files:
  • NetDS/MessageQueuing/MqApiTst/RecvMDlg.h
  • NetDS/MessageQueuing/MqApiTst/RecvMDlg.Cpp
Generated on Wed Nov 13 2024 16:57:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CReceiveWaitDialog Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Protected Member Functions

CReceiveWaitDialog Class Reference

#include "RecWDlg.h"

List of all members.

Public Types

enum | { IDD = IDD_WAIT_DIALOG }

Public Member Functions

CReceiveWaitDialog (CWnd *pParent=NULL)
void | CenterWindow ()

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)

Detailed Description

Definition at line 19 of file RecWDlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 28 of file RecWDlg.h.

{ IDD = IDD_WAIT_DIALOG };

Constructor & Destructor Documentation

CReceiveWaitDialog::CReceiveWaitDialog ( CWnd * pParent = NULL )

Definition at line 31 of file RecWDlg.Cpp.

  : CDialog(CReceiveWaitDialog::IDD, pParent)
{
  //{{AFX_DATA_INIT(CReceiveWaitDialog)
    // NOTE: the ClassWizard will add member initialization here
  //}}AFX_DATA_INIT
}

Member Function Documentation

void CReceiveWaitDialog::CenterWindow ( )

Definition at line 59 of file RecWDlg.Cpp.

{
    CWnd * pParent = GetParent();
    RECT parentRect;
    RECT childRect;

    pParent->GetWindowRect(&parentRect);
    int dxP = parentRect.right-parentRect.left;
    int dyP = parentRect.bottom - parentRect.top;

    GetWindowRect(&childRect);
    int dxC = childRect.right-childRect.left;
    int dyC = childRect.bottom - childRect.top;

    childRect.left = dxP/2-dxC/2;
    childRect.right = childRect.left+dxC;

    childRect.top = dyP/2-dyC/2;
    childRect.bottom = childRect.top+dyC;

    MoveWindow(&childRect);
};

void CReceiveWaitDialog::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 40 of file RecWDlg.Cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CReceiveWaitDialog)
    // NOTE: the ClassWizard will add DDX and DDV calls here
  //}}AFX_DATA_MAP
}

The documentation for this class was generated from the following files:
  • NetDS/MessageQueuing/MqApiTst/RecWDlg.h
  • NetDS/MessageQueuing/MqApiTst/RecWDlg.Cpp
Generated on Wed Nov 13 2024 16:57:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CRecoOutputWnd Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes

CRecoOutputWnd Class Reference

#include "ChildWnds.h"

List of all members.

Public Types

enum | { mc_iNumResults = 5, mc_iMarginX = 10, mc_iMarginY = 10, mc_iFontHeight = 20 }

Public Member Functions

CRecoOutputWnd ()
CRecoOutputWnd ()
~CRecoOutputWnd ()
~CRecoOutputWnd ()
void | AddString (COLORREF clr, BSTR bstr)
HWND | Create (HWND hwndParent, UINT nID)
int | GetBestHeight ()
LRESULT | OnPaint (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
void | ResetResults ()
void | ResetResults ()
void | SetGestureName (UINT nGesture)
bool | UpdateFont (LANGID wLangId)
void | UpdateString (BSTR bstr)

Public Attributes

bool | m_bNewGesture
CComBSTR | m_bstrResults [mc_iNumResults]
HFONT | m_hFont
HMODULE | m_hRichEdit
int | m_iFontName
int | m_iSelStart
UINT m_nGesture

Detailed Description

Definition at line 83 of file ChildWnds.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
mc_iNumResults
mc_iMarginX
mc_iMarginY
mc_iFontHeight

Definition at line 91 of file ChildWnds.h.

         {
        mc_iNumResults = 5,   // the maximum number of result strings
        mc_iMarginX = 10,   // left offset for text output
        mc_iMarginY = 10,     // top offset for text output
        mc_iFontHeight = 20   // height of the fonts for text output
    };

Constructor & Destructor Documentation

CRecoOutputWnd::CRecoOutputWnd ( )

Definition at line 241 of file ChildWnds.cpp.

        : m_hFont(NULL), m_iFontName(-1), m_nGesture(0), m_bNewGesture(false)
{
    UpdateFont(::GetUserDefaultLangID());
}

CRecoOutputWnd::~CRecoOutputWnd ( )

Definition at line 254 of file ChildWnds.cpp.

{
    if (NULL != m_hFont)
    {
        ::DeleteObject(m_hFont);
    }
}

CRecoOutputWnd::CRecoOutputWnd ( )
CRecoOutputWnd::~CRecoOutputWnd ( )

Member Function Documentation

void CRecoOutputWnd::AddString | ( | COLORREF | clr,
 |  | BSTR | bstr
 | ) |  |

Definition at line 344 of file ChildWnds.cpp.

{
    // Set the string start position to the end of the text
    m_iSelStart = ::SendMessage(m_hWnd, WM_GETTEXTLENGTH, 0, 0);

    // If the string is not first, add a delimiting space character first
    if (0 != m_iSelStart)
    {
        ::SendMessageW(m_hWnd, EM_REPLACESEL, FALSE, (LPARAM)L" ");
        m_iSelStart++;
    }

    // Set the string format
    CHARFORMAT2W cf;
    cf.cbSize = sizeof(cf);
    cf.dwMask = CFM_COLOR;
    cf.crTextColor = clr;
    cf.dwEffects = 0;
    ::SendMessageW(m_hWnd, EM_SETSEL, m_iSelStart, -1);
    ::SendMessageW(m_hWnd, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);

    // Add the string to the text
    if (NULL != bstr)
    {
        ::SendMessageW(m_hWnd, EM_REPLACESEL, FALSE, (LPARAM)bstr);
    }
}

HWND CRecoOutputWnd::Create | ( | HWND | hwndParent,
 |  | UINT | nID
 | ) |  |

Definition at line 278 of file ChildWnds.cpp.

{
    if (NULL == m_hWnd)
    {
        m_hRichEdit = ::LoadLibraryW(L"Riched20.dll");
        if (NULL != m_hRichEdit)
        {
            // Create a richedit control
            HWND hwndREdit = ::CreateWindowW(RICHEDIT_CLASSW,
                                             NULL,
                                             WS_VISIBLE | WS_CHILD | WS_BORDER
                                             | ES_SUNKEN | ES_MULTILINE | ES_READONLY,
                                             0, 0, 1, 1,
                                             hwndParent,
                                             (HMENU)nID,
                                             _Module.GetModuleInstance(),
                                             NULL
                                             );
            // Subclass it and attach to this CRecoOutputWnd object
            if (NULL != hwndREdit)
            {
                SubclassWindow(hwndREdit);
            }
        }
    }
    return m_hWnd;
}

int CRecoOutputWnd::GetBestHeight ( )

Definition at line 386 of file ChildWnds.cpp.

{
    return (mc_iMarginX * 2 + mc_iFontHeight * (mc_iNumResults + 1));
}

LRESULT CRecoOutputWnd::OnPaint | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 280 of file ChildWnds.cpp.

{
    RECT rc;
    if (FALSE == GetUpdateRect(&rc))
        return 0;   // there's no update region, so no painting is needed

    PAINTSTRUCT ps;
    HDC hdc = BeginPaint(&ps);
    if (hdc == NULL)
        return 0;

    GetClientRect(&rc);

    // Paint the background
    ::FillRect(hdc, &rc, (HBRUSH)::GetStockObject(WHITE_BRUSH));

    // Use blue color to draw the latest results, and gray for the old ones
    COLORREF clrGesture, clrText;
    if (true == m_bNewGesture)
    {
        clrGesture = CLR_BLUE;
        clrText = CLR_GRAY;
    }
    else
    {
        clrGesture = CLR_GRAY;
        clrText = CLR_BLUE;
    }

    COLORREF clrOld = ::SetTextColor(hdc, clrGesture);

    // Output the name of the last gesture
    if (0 != m_nGesture)
    {
        TCHAR buffer[100];
        if (::LoadString(_Module.GetResourceInstance(),
                         m_nGesture, buffer, sizeof(buffer)) != 0)
        {
            ::TextOut(hdc, mc_iMarginX, mc_iMarginY, buffer, _tcslen(buffer));
        }
    }

    // Output the handwriting recognition results
    HGDIOBJ hOldFont;
    if (NULL != m_hFont)
    {
        hOldFont = ::SelectObject(hdc, m_hFont);
    }
    ::SetTextColor(hdc, clrText);
    for (int i = 0; i < mc_iNumResults; i++)
    {
        int iLength = m_bstrResults[i].Length();
        if (iLength)
        {
            ::TextOutW(hdc, mc_iMarginX, mc_iMarginY + (i + 1) * mc_iFontHeight,
                       m_bstrResults[i], iLength);
        }
    }

    // Restore the dc
    ::SetTextColor(hdc, clrOld);
    if (NULL != m_hFont)
    {
        ::SelectObject(hdc, hOldFont);
    }

    EndPaint(&ps);
    return 0;
}

void CRecoOutputWnd::ResetResults ( )
void CRecoOutputWnd::ResetResults ( )

Definition at line 366 of file ChildWnds.cpp.

{
    m_bNewGesture = false;
    m_nGesture = 0;
    for (int i = 0; i < mc_iNumResults; i++)
        m_bstrResults[i].Empty();
}

void CRecoOutputWnd::SetGestureName ( UINT nGesture )

Definition at line 477 of file ChildWnds.cpp.

{
    m_nGesture = nGesture;
    m_bNewGesture = true;
}

bool CRecoOutputWnd::UpdateFont ( LANGID wLangId )

Definition at line 407 of file ChildWnds.cpp.

{
    static LPCTSTR pszFontNames[] = { TEXT("MS Shell Dlg"), TEXT("MS Mincho"),
                                      TEXT("Mingliu"), TEXT("Gullim") };
    bool bOk = true;
    int i;
    DWORD dwCharSet;
    // Select a font by the primary language id (the lower byte)
    switch(wLangId & 0xFF)
    {
        default:
            i = 0;
            dwCharSet = DEFAULT_CHARSET;
            break;

        case LANG_JAPANESE:
            i = 1;
            dwCharSet = SHIFTJIS_CHARSET;
            break;

        case LANG_CHINESE:
            i = 2;
            dwCharSet = CHINESEBIG5_CHARSET;
            break;

        case LANG_KOREAN:
            i = 3;
            dwCharSet = JOHAB_CHARSET;
            break;
    }
    if (i != m_iFontName)
    {
        HFONT hFont = ::CreateFont(mc_iFontHeight, 0, 0, 0, 0, 0, 0, 0,
                                   dwCharSet,
                                   0, 0, 0, 0,
                                   pszFontNames[i] // typeface name
                                   );
        if (NULL != hFont)
        {
            if (NULL != m_hFont)
                ::DeleteObject(m_hFont);
            m_hFont = hFont;
            m_iFontName = i;
        }
        else
        {
            bOk = false;
        }
    }

    return bOk;
}

void CRecoOutputWnd::UpdateString ( BSTR bstr )

Definition at line 388 of file ChildWnds.cpp.

{
    // To update the string, select it in the RichEdit control ...
    ::SendMessageW(m_hWnd, EM_SETSEL, m_iSelStart, -1);
    // ... and replace the selected text
    ::SendMessageW(m_hWnd, EM_REPLACESEL, FALSE, (LPARAM)bstr);
    // The new text will inherit the format settings
}

Member Data Documentation

bool CRecoOutputWnd::m_bNewGesture

Definition at line 105 of file ChildWnds.h.

CComBSTR CRecoOutputWnd::m_bstrResults[mc_iNumResults]

Definition at line 99 of file ChildWnds.h.

HFONT CRecoOutputWnd::m_hFont

Definition at line 102 of file ChildWnds.h.

HMODULE CRecoOutputWnd::m_hRichEdit

Definition at line 100 of file ChildWnds.h.

int CRecoOutputWnd::m_iFontName

Definition at line 103 of file ChildWnds.h.

int CRecoOutputWnd::m_iSelStart

Definition at line 101 of file ChildWnds.h.

UINT CRecoOutputWnd::m_nGesture

Definition at line 104 of file ChildWnds.h.

The documentation for this class was generated from the following files:
  • TabletPC/AdvReco/ChildWnds.h
  • TabletPC/MultiReco/ChildWnds.h
  • TabletPC/AdvReco/ChildWnds.cpp
  • TabletPC/MultiReco/ChildWnds.cpp
Generated on Wed Nov 13 2024 16:57:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CRefClient Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Private Attributes

CRefClient Class Reference

#include "RefClint.h"

List of all members.

Public Member Functions

CRefClient ()
virtual | ~CRefClient ()
HRESULT | AddEnum ()
HRESULT | AddObjects ()
HRESULT | Initialize (IWbemServices *pNameSpace)
HRESULT | Refresh ()
HRESULT | RemoveEnum ()
HRESULT | RemoveObjects ()
HRESULT | ShowEnumeratorData ()
HRESULT | ShowObjectData ()

Protected Member Functions

HRESULT | SetHandles ()

Private Attributes

CRefresherMember< IWbemHiPerfEnum > | m_Enum
CRefresherMember
< IWbemObjectAccess > 		m_Instances [clNumInstances]
IWbemConfigureRefresher * | m_pConfig
IWbemServices * | m_pNameSpace
IWbemRefresher * | m_pRefresher

Detailed Description

Definition at line 90 of file RefClint.h.

Constructor & Destructor Documentation

CRefClient::CRefClient ( )

Definition at line 62 of file RefClint.Cpp.

                       :
  m_pNameSpace(NULL), m_pRefresher(NULL), m_pConfig(NULL)
{
}

CRefClient::~CRefClient ( ) [virtual]

Definition at line 67 of file RefClint.Cpp.

{
  // Release the COM interfaces (if refresher members have not been manually
  // removed, the refresher destructor should do so automatically)
  // =======================================================================

  if (NULL != m_pNameSpace)
    m_pNameSpace->Release();

  if (NULL != m_pRefresher)
    m_pRefresher->Release();

  if (NULL != m_pConfig)
    m_pConfig->Release();
}

Member Function Documentation

HRESULT CRefClient::AddEnum ( )

Definition at line 382 of file RefClint.Cpp.

{
  HRESULT hRes = WBEM_NO_ERROR;

  IWbemHiPerfEnum*  pEnum = NULL;
  long lID;

// Add an enumerator to the refresher
// ==================================

  hRes = m_pConfig->AddEnum( m_pNameSpace, cwcsObjectPath, 0, NULL, &pEnum, &lID );

  if ( FAILED(hRes))
  {
    printf( "AddEnum() failed, 0x%x\n", hRes );
  }

  if (pEnum)
  {
    m_Enum.Set(pEnum, lID);
    // Set does it's own AddRef

    pEnum->Release();
  }

  return hRes;
}

HRESULT CRefClient::AddObjects ( )

Definition at line 234 of file RefClint.Cpp.

{
  HRESULT hRes = WBEM_NO_ERROR;

  long  lIndex = 0;
  WCHAR wcsObjName[MAX_PATH + 50];

// Loop through all instances of Win32_BasicHiPerf and add them to the refresher
// =============================================================================

  for ( lIndex = 0; lIndex < clNumInstances; lIndex++ )
  {
    IWbemClassObject* pObj = NULL;
    IWbemObjectAccess*  pAccess = NULL;
    long lID;

    // Set the object path (e.g. Win32_BasicHiPerf=1)
    // ==============================================

    StringCbPrintfW(wcsObjName, sizeof(wcsObjName), L"%s=%i", cwcsObjectPath, lIndex );

    // Add the object
    // ==============

    hRes = m_pConfig->AddObjectByPath( m_pNameSpace, wcsObjName, 0, NULL, &pObj, &lID );

    if ( FAILED( hRes ) )
    {
      printf( "AddObjectByPath() failed, 0x%x\n", hRes );
      return hRes;
    }

    // Save the IWbemObjectAccess interface
    // ====================================

    hRes = pObj->QueryInterface( IID_IWbemObjectAccess, (void**) &pAccess );

    pObj->Release();

    m_Instances[lIndex].Set(pAccess, lID);

    // Set does it's own AddRef()
    // ==========================

    pAccess->Release();
  }

  return hRes;
}

HRESULT CRefClient::Initialize ( IWbemServices * pNameSpace )

Definition at line 176 of file RefClint.Cpp.

{
  HRESULT hRes = WBEM_NO_ERROR;

  // Copy the namespace pointer
  // ==========================

  if ( NULL == pNameSpace )
    return WBEM_E_INVALID_PARAMETER;

  //Cleanup: in case this method nas been called more than once
  if (m_pNameSpace != NULL)
    m_pNameSpace->Release();
  if (m_pRefresher != NULL)
    m_pRefresher->Release();
  if (m_pConfig != NULL)
    m_pConfig->Release();

  m_pNameSpace = pNameSpace;
  m_pNameSpace->AddRef();

  // Create the refresher and refresher manager
  // ==========================================

  hRes = CoCreateInstance( CLSID_WbemRefresher,
               NULL,
               CLSCTX_INPROC_SERVER,
               IID_IWbemRefresher,
               (void**) &m_pRefresher );
  if ( FAILED( hRes ) )
    return hRes;

  hRes = m_pRefresher->QueryInterface( IID_IWbemConfigureRefresher,
                     (void**) &m_pConfig );
  if ( FAILED( hRes ) )
  {
    m_pRefresher->Release();
    return hRes;
  }

  // Set the access handles
  // ======================

  hRes = SetHandles();

  return hRes;
}

HRESULT CRefClient::Refresh ( )

Definition at line 534 of file RefClint.Cpp.

{
  return m_pRefresher->Refresh( 0L );
}

HRESULT CRefClient::RemoveEnum ( )

Definition at line 422 of file RefClint.Cpp.

{
  HRESULT hRes = WBEM_NO_ERROR;
  // Remove the enumerator
  // =====================
  if ( m_pConfig)
  {
    hRes = m_pConfig->Remove( m_Enum.GetID(), 0L );
  }
  m_Enum.Reset();

  return hRes;
}

HRESULT CRefClient::RemoveObjects ( )

Definition at line 294 of file RefClint.Cpp.

{
  HRESULT hRes = WBEM_NO_ERROR;

  long lInstance = 0;

  // Remove the instances
  // ====================

  if (m_pConfig)
  {
    for ( lInstance = 0; lInstance < clNumInstances; lInstance++ )
    {
      m_pConfig->Remove( m_Instances[lInstance].GetID(), 0L );
      m_Instances[lInstance].Reset();
    }
  }

  return hRes;
}

HRESULT CRefClient::SetHandles ( ) [protected]

Definition at line 89 of file RefClint.Cpp.

{
  HRESULT hRes = WBEM_NO_ERROR;
  IWbemClassObject* pObj = NULL;
  IWbemObjectAccess*  pAccess = NULL;
  long lIndex;

// Get an IWbemObjectAccess interface to one of the sample objects
// ===============================================================
  // Create a sample object
  // ======================
  BSTR strObj = SysAllocString( cwcsObjectPath );
  if (strObj == NULL)
  {
    hRes = E_OUTOFMEMORY;
    goto cleanup;
  }

  hRes = m_pNameSpace->GetObject( strObj, 0, NULL, &pObj, NULL );

  SysFreeString( strObj );

  if ( FAILED( hRes ) )
    goto cleanup;

  // Get the alternate interface
  // ===========================

  hRes = pObj->QueryInterface( IID_IWbemObjectAccess, ( LPVOID* )&pAccess );

  if ( FAILED( hRes ) )
    goto cleanup;

// Set the access handles for all of the counter properties
// ========================================================

  for ( lIndex = Ctr1; lIndex < NumCtrs; lIndex++ )
  {
    long lHandle;

    hRes = pAccess->GetPropertyHandle( g_aCounters[lIndex].m_wcsName, NULL, &lHandle );

    if ( FAILED( hRes ) )
      goto cleanup;

    g_aCounters[lIndex].m_lHandle = lHandle;
  }
// Cleanup the object pointers
// ===========================

cleanup:
  if ( NULL != pObj )
  {
    pObj->Release();
    pObj = NULL;
  }

  if ( NULL != pAccess )
  {
    pAccess->Release();
    pAccess = NULL;
  }

  if ( FAILED( hRes ) )
  {
    printf( "SetHandles() failed, 0x%x\n", hRes );
  }

  return hRes;
}

HRESULT CRefClient::ShowEnumeratorData ( )

Definition at line 446 of file RefClint.Cpp.

{
  HRESULT hRes = WBEM_NO_ERROR;

  DWORD dwNumReturned = clNumInstances;
  DWORD dwNumObjects = 0;

  IWbemObjectAccess** apEnumAccess = NULL;

  IWbemHiPerfEnum*  pEnum = m_Enum.GetMember();
  if (pEnum == NULL)
  {
        return WBEM_E_FAILED;
  }
// Fetch the instances from the enumerator
// =======================================

  // Try to get the instances from the enumerator
  // ============================================

  hRes = pEnum->GetObjects( 0L, dwNumObjects, apEnumAccess, &dwNumReturned );

  // Is the buffer too small?
  // ========================

  if ( WBEM_E_BUFFER_TOO_SMALL == hRes )
  {
    // Increase the buffer size
    // ========================

    delete [] apEnumAccess;

    apEnumAccess = new IWbemObjectAccess*[dwNumReturned];
    dwNumObjects = dwNumReturned;
    memset( apEnumAccess, 0, sizeof( apEnumAccess ));

    if ( NULL != apEnumAccess )
    {
      hRes = pEnum->GetObjects( 0L, dwNumObjects, apEnumAccess, &dwNumReturned );
    }
    else
    {
      hRes = WBEM_E_OUT_OF_MEMORY;
    }

  }

  // Print the result
  // ================

  if ( SUCCEEDED( hRes ) )
  {
    printf( "\tThe enumerator returned %i instances\n", dwNumReturned );
  }
  else
  {
    printf( "ShowEnumeratorData failed, 0x%x\n", hRes );
  }

  // Release the objects from the enumerator's object array
  // ======================================================

  for ( DWORD nCtr = 0; nCtr < dwNumReturned; nCtr++ )
  {
    if (NULL != apEnumAccess[nCtr])
    {
      apEnumAccess[nCtr]->Release();
      apEnumAccess[nCtr] = NULL;
    }
  }

  if ( NULL != apEnumAccess )
    delete [] apEnumAccess;

  pEnum->Release();

  return hRes;
}

HRESULT CRefClient::ShowObjectData ( )

Definition at line 324 of file RefClint.Cpp.

{
  HRESULT hRes = WBEM_NO_ERROR;

  long lInstance;
  long lCounter;

// Cycle through all of the instances and print all the counter data
// =================================================================

  // Instance loop
  // =============

  for (lInstance = 0; lInstance < clNumInstances; lInstance++)
  {
    printf("  Instance %i:\n", lInstance);

    // Counter loop
    // ============

    for (lCounter = Ctr1; lCounter < NumCtrs; lCounter++)
    {
      DWORD dwVal;
      IWbemObjectAccess* pAccess = m_Instances[lInstance].GetMember();

      // Read the counter property value using the high performance IWbemObjectAccess->ReadDWORD().
      // NOTE: Remember to never to this while a refresh is in process!
      // ==========================================================================================

      hRes = pAccess->ReadDWORD( g_aCounters[lCounter].m_lHandle, &dwVal);
      if (FAILED(hRes))
      {
        pAccess->Release();

        printf("ShowInstanceData() failed, 0x%x", hRes);
        return hRes;
      }

      printf("    %i ", dwVal);

      pAccess->Release();
    }

    printf("\n");
  }

  return hRes;
}

Member Data Documentation

CRefresherMember<IWbemHiPerfEnum> CRefClient::m_Enum [private]

Definition at line 96 of file RefClint.h.

CRefresherMember<IWbemObjectAccess> CRefClient::m_Instances[clNumInstances] [private]

Definition at line 97 of file RefClint.h.

IWbemConfigureRefresher* CRefClient::m_pConfig [private]

Definition at line 94 of file RefClint.h.

IWbemServices* CRefClient::m_pNameSpace [private]

Definition at line 92 of file RefClint.h.

IWbemRefresher* CRefClient::m_pRefresher [private]

Definition at line 93 of file RefClint.h.

The documentation for this class was generated from the following files:
  • SysMgmt/WMI/VC/HiPerfClient/RefClint.h
  • SysMgmt/WMI/VC/HiPerfClient/RefClint.Cpp
Generated on Wed Nov 13 2024 16:57:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CRefCount Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CRefCount Class Reference

#include "conf.h"

Inherited by CApplet, CAppletSession, CConfNotify, and CMgrNotify.

List of all members.

Public Member Functions

CRefCount ()
virtual | ~CRefCount ()
ULONG STDMETHODCALLTYPE | AddRef (void)
ULONG STDMETHODCALLTYPE | Release (void)

Private Attributes

LONG | m_cRef

Detailed Description

Definition at line 24 of file conf.h.

Constructor & Destructor Documentation

CRefCount::CRefCount ( void )

Definition at line 617 of file conf.cpp.

{
    m_cRef = 1;
}

CRefCount::~CRefCount ( void ) [virtual]

Definition at line 629 of file conf.cpp.

{
}

Member Function Documentation

ULONG STDMETHODCALLTYPE CRefCount::AddRef ( void )

Reimplemented in CApplet, and CAppletSession.

Definition at line 641 of file conf.cpp.

{
   ASSERT(m_cRef >= 0);

   ::InterlockedIncrement(&m_cRef);

   return (ULONG) m_cRef;
}

ULONG STDMETHODCALLTYPE CRefCount::Release ( void )

Reimplemented in CApplet, and CAppletSession.

Definition at line 652 of file conf.cpp.

{
    if (0 == ::InterlockedDecrement(&m_cRef))
    {
        delete this;
        return 0;
    }

    ASSERT(m_cRef > 0);
    return (ULONG) m_cRef;
}

Member Data Documentation

LONG CRefCount::m_cRef [private]

Definition at line 39 of file conf.h.

The documentation for this class was generated from the following files:
  • Web/NetMeeting/NMChat2/conf.h
  • Web/NetMeeting/NMChat2/conf.cpp
Generated on Wed Nov 13 2024 16:57:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CRefresher Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CRefresher Class Reference

#include "BasicHiPerf.h"

List of all members.

Public Member Functions

CRefresher (CHiPerfProvider *pProvider, CSampleDataSource *pDS)
virtual | ~CRefresher ()
DWORD | AddEnum (IWbemHiPerfEnum *pHiPerfEnum, long *plId)
DWORD | AddObject (IWbemObjectAccess *pObj, IWbemObjectAccess **ppReturnObj, long *plId)
DWORD | Initialize (IWbemClassObject *pSampleClass)
STDMETHODIMP | QueryInterface (REFIID riid, void **ppv)
STDMETHODIMP | Refresh (long lFlags)
DWORD | RemoveEnum (long lId)
DWORD | RemoveObject (long lId)
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()

Private Attributes

IWbemHiPerfEnum * | m_apEnumerator [MAX_ENUMERATORS]
IWbemObjectAccess * | m_apInstances [NUM_INSTANCES]
CCacheMapEl * | m_apInstMap [MAX_INSTANCES]
long | m_lRef
CSampleDataSource * m_pDS
CHiPerfProvider * m_pProvider

Detailed Description

Definition at line 337 of file BasicHiPerf.h.

Constructor & Destructor Documentation

CRefresher::CRefresher | ( | CHiPerfProvider * | pProvider,
 |  | CSampleDataSource * | pDS
 | ) |  |

Definition at line 957 of file BasicHiPerf.Cpp.

                                                                         : m_lRef(0), m_pDS(pDS)
//////////////////////////////////////////////////////////////////////
//
//  Constructor
//
//////////////////////////////////////////////////////////////////////
//ok
{
  int nIndex = 0;

  // Retain a copy of the provider
  // =============================

  m_pProvider = pProvider;
  if (m_pProvider)
    m_pProvider->AddRef();

  // Initialize the instance map
  // ===========================

  for (nIndex = 0; nIndex < MAX_INSTANCES; nIndex++)
    m_apInstMap[nIndex] = NULL;

  // Initialize the instance cache
  // =============================

  for (nIndex = 0; nIndex < NUM_INSTANCES; nIndex++)
    m_apInstances[nIndex] = NULL;

  // Initialize the enumerator cache
  // ===============================

  for (nIndex = 0; nIndex < MAX_ENUMERATORS; nIndex++)
    m_apEnumerator[nIndex] = NULL;

  // Increment the global COM object counter
  // =======================================

  InterlockedIncrement(&g_lObjects);
}

CRefresher::~CRefresher ( ) [virtual]

Definition at line 998 of file BasicHiPerf.Cpp.

{
  int nIndex = 0;

  // Delete the instance cache
  // =========================

  for (nIndex = 0; nIndex < MAX_INSTANCES; nIndex++)
  {
    if (NULL != m_apInstMap[nIndex])
      delete m_apInstMap[nIndex];
  }

    // Release the cached IWbemObjectAccess instances
  // ==============================================

    for (nIndex = 0; nIndex < NUM_INSTANCES; nIndex++)
    {
        if (NULL != m_apInstances[nIndex])
            m_apInstances[nIndex]->Release();
    }

  // Release all of the enumerators
  // ==============================

  for (nIndex = 0; nIndex < MAX_ENUMERATORS; nIndex++)
  {
    if (NULL != m_apEnumerator[nIndex])
      m_apEnumerator[nIndex]->Release();
  }

  // Release the provider
  // ====================

  if (m_pProvider)
    m_pProvider->Release();

  // Decrement the global COM object counter
  // =======================================

  InterlockedDecrement(&g_lObjects);
}

Member Function Documentation

DWORD CRefresher::AddEnum | ( | IWbemHiPerfEnum * | pHiPerfEnum,
 |  | long * | plId
 | ) |  |

Definition at line 1244 of file BasicHiPerf.Cpp.

              :
//    pHiPerfEnum - the enumerator
//    plID    - the ID
//
//////////////////////////////////////////////////////////////////////
//ok
{
  DWORD dwRes = WBEM_E_FAILED;

  if (NULL == pHiPerfEnum)
        return WBEM_E_INVALID_PARAMETER;

  // Cycle through the enumerator array, and look for an empty slot
  // ==============================================================

  for (int nIndex = 0; nIndex < MAX_ENUMERATORS; nIndex++)
  {
    if (NULL == m_apEnumerator[nIndex])
    {
      // Add all the objects at once into the enumerator
      // ===============================================

      long alIDs[NUM_INSTANCES];

      for ( int nInst = 0; nInst < NUM_INSTANCES; nInst++ )
        alIDs[nInst] = nInst;

      dwRes = pHiPerfEnum->AddObjects( 0L, NUM_INSTANCES, alIDs, m_apInstances );
      if (FAILED(dwRes))
        return dwRes;

      // Add the enumerator to the refresher (released by the refresher's destructor)
      // ============================================================================

      m_apEnumerator[nIndex] = pHiPerfEnum;
      pHiPerfEnum->AddRef();

      *plId = nIndex;

      dwRes = WBEM_NO_ERROR;
      break;
    }
  }
  return dwRes;
}

DWORD CRefresher::AddObject | ( | IWbemObjectAccess * | pObj,
 |  | IWbemObjectAccess ** | ppReturnObj,
 |  | long * | plId
 | ) |  |

Definition at line 1119 of file BasicHiPerf.Cpp.

                                                               :object
//  relationships are maintained by m_apInstMap.
//
//  Parameters:
//    pObj    - the object to add
//    lID     - the ID
//
//////////////////////////////////////////////////////////////////////
//ok
{
  DWORD dwRes = WBEM_NO_ERROR;

  DWORD dwID  = 0;
  int   nIndex  = 0;
  bool  bDone = false;

  if (NULL == pObj)
        return WBEM_E_INVALID_PARAMETER;

  // Grab the instance ID
  // ====================

  WCHAR wszName[20];
  long lNumBytes = 0;
  dwRes = pObj->ReadPropertyValue(g_hID, sizeof(wszName), &lNumBytes, (byte *)wszName);
  if (FAILED(dwRes))
    return dwRes;
  dwID = _wtoi(wszName);

  // Search the map array for an empty spot
  // ======================================

  for (nIndex = 0; (nIndex < MAX_INSTANCES) && !bDone; nIndex++)
  {
    if (NULL == m_apInstMap[nIndex])
    {
      // Create a new cache element
      // ==========================

      CCacheMapEl* pEl = new CCacheMapEl(dwID);
      if (pEl == NULL)
        return WBEM_E_OUT_OF_MEMORY;

      // Set the return parameters
      // =========================

      *plId = pEl->GetUID();
      *ppReturnObj = m_apInstances[dwID];
      (*ppReturnObj)->AddRef();

      // Set the cache element
      // =====================

      m_apInstMap[nIndex] = pEl;

      bDone = true;
    }
  }

  // If array was full, report an error
  // ==================================

  if (!bDone)
    dwRes = WBEM_E_OUT_OF_MEMORY;

  return dwRes;
}

DWORD CRefresher::Initialize ( IWbemClassObject * pSampleClass )

Definition at line 1047 of file BasicHiPerf.Cpp.

              :
//    pSampleClass  - A template of the WMI object from which we
//              will create our instances
//
//////////////////////////////////////////////////////////////////////
//ok
{
  DWORD dwRes = WBEM_NO_ERROR;

  int nIndex = 0;

    // Precreate and initialize 5 instances of our sample class, and store
  // them in the m_apInstances array as IWbemObjectAccess pointers
  // =====================================================================

    for (DWORD dwIndex = 0; dwIndex < NUM_INSTANCES; dwIndex++)
    {
    IWbemClassObject* pClone = NULL;
    IWbemObjectAccess*  pAccess = NULL;

    // Create the instance
    // ===================

    dwRes = pSampleClass->SpawnInstance(0, &pClone);
    if (FAILED(dwRes))
      return dwRes;

    // Get the IWbemObjectAccess interface
    // ===================================

        dwRes = pClone->QueryInterface(IID_IWbemObjectAccess, (LPVOID *)&pAccess);
        pClone->Release();

    if (FAILED(dwRes))
      return dwRes;

    // Set the ID
    // ==========

    WCHAR wszName[20];
    StringCbPrintfW(wszName, sizeof(wszName), L"%i", dwIndex);
    dwRes = pAccess->WritePropertyValue(g_hID, (long)(wcslen(wszName)+1)*sizeof(WCHAR), (byte *)wszName);
    if (FAILED(dwRes))
    {
      pAccess->Release();
      return dwRes;
    }

    // Initialize the counters
    // =======================

    dwRes = m_pDS->UpdateInstance(pAccess);
    if (FAILED(dwRes))
    {
      pAccess->Release();
      return dwRes;
    }

    // Add to the instance array (refcount == 1)
    // =========================================

        m_apInstances[dwIndex] = pAccess;
    }

  return WBEM_NO_ERROR;
}

STDMETHODIMP CRefresher::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppv
 | ) |  |

Definition at line 1339 of file BasicHiPerf.Cpp.

{
    if (riid == IID_IUnknown)
        *ppv = (LPVOID)(IUnknown*)this;
  else if (riid == IID_IWbemRefresher)
    *ppv = (LPVOID)(IWbemRefresher*)this;
    else return E_NOINTERFACE;

    ((IUnknown*)*ppv)->AddRef();
    return S_OK;
}

STDMETHODIMP CRefresher::Refresh ( long lFlags )

Definition at line 1383 of file BasicHiPerf.Cpp.

              :
//    lFlags  - not used
//
//////////////////////////////////////////////////////////////////////
//ok
{

  HRESULT hRes = WBEM_NO_ERROR;

  //Impersonate the client
  hRes = CoImpersonateClient () ;
  if ( FAILED ( hRes ) && hRes != RPC_E_CALL_COMPLETE)
  {
    return hRes ;
  }

  //  Check to see if call is at lower than RPC_C_IMP_LEVEL_IMPERSONATE level. If that's the case,
  //  the provider will not be able to impersonate the client to access the protected resources.

  DWORD t_CurrentImpersonationLevel = GetCurrentImpersonationLevel () ;
  if ( t_CurrentImpersonationLevel < RPC_C_IMP_LEVEL_IMPERSONATE )
  {
    //  Revert before we perform any operations
    CoRevertToSelf () ;

    hRes = WBEM_E_ACCESS_DENIED;
    return hRes ;
  }

  IWbemObjectAccess* pObj;
  DWORD dwVal = 0;
  long  hCtr = 0;

  // A simple loop that iterates through all instances that have been
  // added to the refresher, and updates their counter values
  // ================================================================

  for (int nInst = 0; nInst < NUM_INSTANCES; nInst++)
  {
    pObj = m_apInstances[nInst];
    if (NULL != pObj)
    {
      hRes = m_pDS->UpdateInstance(pObj);
      if (FAILED(hRes))
        break;
    }
  }

  return hRes;
}

DWORD CRefresher::RemoveEnum ( long lId )

Definition at line 1307 of file BasicHiPerf.Cpp.

              :
//    plID    - the ID
//
//////////////////////////////////////////////////////////////////////
//ok
{
  // Verify the element
  // ==================

  if (NULL != m_apEnumerator[lId])
  {
    // And remove the enumerator
    // =========================

    m_apEnumerator[lId]->Release();
    m_apEnumerator[lId] = NULL;

    return WBEM_NO_ERROR;
  }
  return WBEM_E_FAILED;
}

DWORD CRefresher::RemoveObject ( long lId )

Definition at line 1196 of file BasicHiPerf.Cpp.

              :
//    plID    - the unique ID
//
//////////////////////////////////////////////////////////////////////
//ok
{
  DWORD dwRes = WBEM_E_NOT_FOUND;

  int   nIndex = 0;
  bool  bDone = false;

  // Loop through the map array looking of the ID
  // ============================================

  for (nIndex = 0; (nIndex < MAX_INSTANCES) && !bDone; nIndex++)
  {
    CCacheMapEl* pEl = m_apInstMap[nIndex];

    if (NULL != pEl)
    {
      if (pEl->GetUID() == lId)
      {
        // Found!  So remove map element
        // =============================

        delete pEl;
        m_apInstMap[nIndex] = NULL;

        dwRes = WBEM_NO_ERROR;

        break;
      }
    }
  }

  return dwRes;
}

CRefresher::STDMETHODIMP_ ( ULONG )
CRefresher::STDMETHODIMP_ ( ULONG )

Member Data Documentation

IWbemHiPerfEnum* CRefresher::m_apEnumerator[MAX_ENUMERATORS] [private]

Definition at line 352 of file BasicHiPerf.h.

IWbemObjectAccess* CRefresher::m_apInstances[NUM_INSTANCES] [private]

Definition at line 358 of file BasicHiPerf.h.

CCacheMapEl* CRefresher::m_apInstMap[MAX_INSTANCES] [private]

Definition at line 357 of file BasicHiPerf.h.

long CRefresher::m_lRef [private]

Definition at line 342 of file BasicHiPerf.h.

CSampleDataSource* CRefresher::m_pDS [private]

Definition at line 347 of file BasicHiPerf.h.

CHiPerfProvider* CRefresher::m_pProvider [private]

Definition at line 363 of file BasicHiPerf.h.

The documentation for this class was generated from the following files:
  • SysMgmt/WMI/VC/HiPerfProvider/BasicHiPerf.h
  • SysMgmt/WMI/VC/HiPerfProvider/BasicHiPerf.Cpp
Generated on Wed Nov 13 2024 16:57:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CRefresherMember< T > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CRefresherMember< T > Class Template Reference

#include "RefClint.h"

List of all members.

Public Member Functions

CRefresherMember ()
virtual | ~CRefresherMember ()
long | GetID ()
T * | GetMember ()
void | Reset ()
void | Set (T *pMember, long lID)

Private Attributes

long | m_lID
T * | m_pMember

Detailed Description

template<class T>
class CRefresherMember< T >

Definition at line 37 of file RefClint.h.

Constructor & Destructor Documentation

template<class T>
CRefresherMember< T >::CRefresherMember ( ) [inline]

Definition at line 43 of file RefClint.h.

: m_pMember( NULL ), m_lID( 0 ) {}

template<class T>
virtual CRefresherMember< T >::~CRefresherMember ( ) [inline, virtual]

Definition at line 44 of file RefClint.h.

{ if ( NULL != m_pMember) m_pMember->Release(); }

Member Function Documentation

template<class T>
long CRefresherMember< T >::GetID ( ) [inline]

Definition at line 50 of file RefClint.h.

{ return m_lID; }

template<class T >
T * CRefresherMember< T >::GetMember ( ) [inline]

Definition at line 72 of file RefClint.h.

{
  if ( NULL != m_pMember )
    m_pMember->AddRef();

  return m_pMember;
}

template<class T >
void CRefresherMember< T >::Reset ( void ) [inline]

Definition at line 63 of file RefClint.h.

{
  if (NULL != m_pMember)
    m_pMember->Release();

  m_pMember = NULL;
  m_lID = 0;
}

template<class T>
void CRefresherMember< T >::Set | ( | T * | pMember,
 |  | long | lID |
 | ) |  |  | [inline]

Definition at line 53 of file RefClint.h.

{
  if ( NULL != pMember )
    pMember->AddRef();
  if ( NULL != m_pMember)
    m_pMember->Release();
  m_pMember = pMember;
  m_lID = lID;
}

Member Data Documentation

template<class T>
long CRefresherMember< T >::m_lID [private]

Definition at line 40 of file RefClint.h.

template<class T>
T* CRefresherMember< T >::m_pMember [private]

Definition at line 39 of file RefClint.h.

The documentation for this class was generated from the following file:
  • SysMgmt/WMI/VC/HiPerfClient/RefClint.h
Generated on Wed Nov 13 2024 16:57:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CRegAccess Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CRegAccess Class Reference

#include "RegAcc32.Hxx"

List of all members.

Public Member Functions

CRegAccess (HKEY keyRelative, WCHAR const *pwcsRegPath)
~CRegAccess ()
BOOL | Get (WCHAR const *pwcsValue, WCHAR *wcsVal, unsigned cc)

Private Attributes

HKEY _hKey
WCHAR * | _wcsPath
WCHAR | _wcsPathBuf [100]

Detailed Description

Definition at line 28 of file RegAcc32.Hxx.

Constructor & Destructor Documentation

CRegAccess::CRegAccess | ( | HKEY | keyRelative,
 |  | WCHAR const * | pwcsRegPath
 | ) |  |

Definition at line 31 of file RegAcc32.Cxx.

        : _hKey( (HKEY) (SIZE_T) -1 ),
          _wcsPath( 0 )
{
    if ( GetOSVersion() == VER_PLATFORM_WIN32_NT )
    {
        RegOpenKeyW( keyRelative, pwcsRegPath, &_hKey );
    }
    else // win95
    {
        int nPathLen = (int) ( wcslen( pwcsRegPath ) * 2 );  // some multibyte chars are 2 bytes long

        char * pszPath = new char [nPathLen];

        if ( NULL != pszPath )
        {
            wcstombs( pszPath, pwcsRegPath, nPathLen );

            RegOpenKeyA( keyRelative, pszPath, &_hKey );
        }

        delete [] pszPath;
    }
}

CRegAccess::~CRegAccess ( )

Definition at line 64 of file RegAcc32.Cxx.

{
    RegCloseKey( _hKey );
    delete [] _wcsPath;
}

Member Function Documentation

BOOL CRegAccess::Get | ( | WCHAR const * | pwcsValue,
 |  | WCHAR * | wcsVal,
 |  | unsigned | cc
 | ) |  |

Definition at line 84 of file RegAcc32.Cxx.

{
    if ( _hKey == (HKEY) (SIZE_T) -1 )
        return FALSE;

    DWORD dwType;
    DWORD cb = cc * sizeof(WCHAR);
    wcsVal[0] = 0;

    BOOL fOk;

    if ( GetOSVersion() == VER_PLATFORM_WIN32_NT )
    {
        fOk = ( ERROR_SUCCESS == RegQueryValueExW( _hKey,
                                                  pwcsKey,
                                                  0,
                                                  &dwType,
                                                  (BYTE *)wcsVal,
                                                  &cb ) ) &&
              ( wcsVal[0] != 0 );
    }
    else // win95
    {
        // Worst case - size of multibyte == size of Unicode
        int nKeyLen = (int) ( wcslen( pwcsKey ) * 2 );

        char * pszKey = new char [nKeyLen];

        if ( NULL != pszKey )
        {
            char * pszVal = new char [cc*2];

            if ( NULL != pszVal )
            {
                wcstombs( pszKey, pwcsKey, nKeyLen );

                fOk = (ERROR_SUCCESS == RegQueryValueExA( _hKey,
                                                          pszKey,
                                                          0,
                                                          &dwType,
                                                         (BYTE *)pszVal,
                                                         &cb ) );

                mbstowcs( wcsVal, pszVal, cb );     // cb since it will convert fewer when it hits terminator

                delete [] pszVal;
            }
            else
            {
                fOk = FALSE;
            }

            delete [] pszKey;
        }
        else
        {
            fOk = FALSE;
        }
    }

    return fOk;
}

Member Data Documentation

HKEY CRegAccess::_hKey [private]

Definition at line 40 of file RegAcc32.Hxx.

WCHAR* CRegAccess::_wcsPath [private]

Definition at line 42 of file RegAcc32.Hxx.

WCHAR CRegAccess::_wcsPathBuf[100] [private]

Definition at line 41 of file RegAcc32.Hxx.

The documentation for this class was generated from the following files:
  • WinBase/Indexing/IFilter/RegAcc32.Hxx
  • WinBase/Indexing/IFilter/RegAcc32.Cxx
Generated on Wed Nov 13 2024 16:57:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CReindeer Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Private Member Functions | Static Private Member Functions

CReindeer Class Reference

#include "FrameworkProv.h"

List of all members.

Public Member Functions

CReindeer (LPCWSTR chsClassName, LPCWSTR lpszNameSpace)
virtual | ~CReindeer ()

Protected Member Functions

virtual HRESULT | DeleteInstance (const CInstance &Instance, long lFlags=0L)
virtual HRESULT | EnumerateInstances (MethodContext *pMethodContext, long lFlags=0L)
virtual HRESULT | ExecMethod (const CInstance &Instance, const BSTR bstrMethodName, CInstance *pInParams, CInstance *pOutParams, long lFlags=0L)
virtual HRESULT | ExecQuery (MethodContext *pMethodContext, CFrameworkQuery &Query, long lFlags=0L)
virtual HRESULT | GetObject (CInstance *pInstance, long lFlags=0L)
HRESULT | LoadPropertyValues (CInstance *pInstance, DWORD dwIndex, DWORD dwRequiredProperties)
virtual HRESULT | PutInstance (const CInstance &Instance, long lFlags=0L)

Private Member Functions

HRESULT | EnumerationCallback (CInstance *pReindeer, MethodContext *pMethodContext, VOID *pTotWeight)
BOOL | IsInList (const CHStringArray &asArray, LPCWSTR pszString)

Static Private Member Functions

static HRESULT WINAPI | StaticEnumerationCallback (Provider *pThat, CInstance *pInstance, MethodContext *pContext, void *pUserData)

Detailed Description

Definition at line 25 of file FrameworkProv.h.

Constructor & Destructor Documentation

CReindeer::CReindeer | ( | LPCWSTR | chsClassName,
 |  | LPCWSTR | lpszNameSpace
 | ) |  |

Definition at line 71 of file FrameworkProv.Cpp.

                                                                :
    Provider(lpwszName, lpwszNameSpace)
{
}

CReindeer::~CReindeer ( ) [virtual]

Definition at line 89 of file FrameworkProv.Cpp.

{
}

Member Function Documentation

HRESULT CReindeer::DeleteInstance | ( | const CInstance & | Instance,
 |  | long | lFlags = 0L |
 | ) |  |  | [protected, virtual]

Definition at line 454 of file FrameworkProv.Cpp.

{
    HRESULT hresult = WBEM_E_NOT_FOUND;

    // get the key value so we can tell which reindeer we're operating on
    CHString name;
    Instance.GetCHString(pName, name);

    // see if we can find the deer we want,
    // note that we won't delete one that's already been deleted
    for (int i = 0; i < Deers::NDeers; i++)
    {
        if (0 == name.CompareNoCase(ohDeers[i].m_name))
        {
            if (!ohDeers[i].m_deleted)
            {
                // we found it - mark as deleted
                ohDeers[i].m_deleted = true;
                hresult = WBEM_S_NO_ERROR;
                break;
            }
            else
            {
                // Ok, this is a bit of a stretch, but I want to be able
                // to show how to report errors using an error object.

                // This code is entered if the same reindeer is deleted
                // twice in a row.  If this deletion is done in wbemtest,
                // a dialog with a 'More Info' button will be displayed.
                // Clicking this button will show the object we are
                // populating here.
                CHString sRelPath;

                Instance.GetCHString(L"__RelPath", sRelPath);
                CInstance *pErrorInstance = NULL;

                // First, get a status object
                CWbemProviderGlue::GetInstanceByPath(pErrorClass, &pErrorInstance);

                // Now, populate it
                pErrorInstance->SetWCHARSplat(L"Operation", L"DeleteInstance");
                pErrorInstance->SetCHString(L"ParameterInfo", sRelPath);
                pErrorInstance->SetWCHARSplat(L"ProviderName", PROVIDER_NAME_REINDEERPROV);
                pErrorInstance->SetDWORD(L"StatusCode", WBEM_E_NOT_FOUND);
                pErrorInstance->SetCHString(L"ReindeerName", name);

                pErrorInstance->SetWCHARSplat(L"Description",
                    L"Attempt to delete reindeer that has already been deleted");

                // Get the actual IWbemClassObject pointer
                IWbemClassObject *pObj = pErrorInstance->GetClassObjectInterface();

                // Note that no Release() is required for this
                MethodContext *pMethodContext = Instance.GetMethodContext();

                // Set the status object
                pMethodContext->SetStatusObject(pObj);

                // Cleanup
                pObj->Release();
                pErrorInstance->Release();

                break;
            }
        }
    }

    return hresult;
}

HRESULT CReindeer::EnumerateInstances | ( | MethodContext * | pMethodContext,
 |  | long | lFlags = 0L |
 | ) |  |  | [protected, virtual]

Definition at line 119 of file FrameworkProv.Cpp.

{
    HRESULT hRes = WBEM_S_NO_ERROR;

    // create an instance for each reindeer
    for (int i = 0; (i < Deers::NDeers) && (SUCCEEDED(hRes)); i++)
    {
        // we don't want to return deleted deer
        if (!ohDeers[i].m_deleted)
        {
            // Note that CreateNewInstance may throw, but will never return NULL.
            CInstance *pInstance = CreateNewInstance(pMethodContext);

            pInstance->SetCHString(pName, CHString(ohDeers[i].m_name));
            if (SUCCEEDED(LoadPropertyValues(pInstance, i, BIT_ALL_PROPERTIES)))
            {
                hRes = pInstance->Commit();
            }

            pInstance->Release();
        }
    }

    return hRes ;
}

HRESULT CReindeer::EnumerationCallback | ( | CInstance * | pReindeer,
 |  | MethodContext * | pMethodContext,
 |  | VOID * | pTotWeight |
 | ) |  |  | [private]

Definition at line 842 of file FrameworkProv.Cpp.

{
    DWORD dwWeight;
    LPDWORD pdwTotWeight = (LPDWORD)pTotWeight;

    if (pReindeer->GetDWORD(pWeight, dwWeight))
    {
        *pdwTotWeight += dwWeight;
    }

    return WBEM_S_NO_ERROR;
}

HRESULT CReindeer::ExecMethod | ( | const CInstance & | Instance,
 |  | const BSTR | bstrMethodName,
 |  | CInstance * | pInParams,
 |  | CInstance * | pOutParams,
 |  | long | lFlags = 0L |
 | ) |  |  | [protected, virtual]

Definition at line 547 of file FrameworkProv.Cpp.

{
    // Note that there are two status codes involved here.  The hresult,
    // which is the return code for the function, indicates whether the method
    // was successfully invoked.  Then there is the hStatusCode which is used
    // to indicate whether the function did what it was asked to do.

    // hStatusCode will end up being the uint32 return code, and can be seen in the
    // 'Edit Out Parameters' box in wbemtest after executing this method.

    HRESULT hresult = WBEM_E_PROVIDER_NOT_CAPABLE;
    HRESULT hStatusCode = WBEM_E_NOT_FOUND;

    // Make sure we recognize the method they are requesting
    if (_wcsicmp(bstrMethodName, L"Undelete") == 0)
    {
        // The method we implement here is declared as:

      //  [Implemented, static, Description(
      //  "The Undelete method will set the Deleted flag for the specified"
        //    "reindeer back to false.  Returns WBEM_S_NO_ERROR if succeeded,
        //    WBEM_E_NOT_FOUND if the Reindeer is not in the list, or WBEM_S_FALSE
        //    if the reindeer was not already marked as deleted.")]
        // uint32 Undelete([In] string ReindeerName) ;

        hresult = WBEM_S_NO_ERROR;

        // get the key value so we can tell which reindeer we're operating on
        CHString name;
        pInParams->GetCHString(L"ReindeerName", name);

        // see if we can find the deer we want,
        for (int i = 0; i < Deers::NDeers; i++)
        {
            if (0 == name.CompareNoCase(ohDeers[i].m_name))
            {
                if (!ohDeers[i].m_deleted)
                {
                    // It wasn't deleted.  Set the appropriate code
                    hStatusCode = WBEM_S_FALSE;
                    break;
                }
                else
                {
                    // It was deleted, so undelete it, and set the
                    // error code.
                    ohDeers[i].m_deleted = false;
                    hStatusCode = WBEM_S_NO_ERROR;
                }
            }
        }

        // put the result code back in the structure.
        pOutParams->SetDWORD(L"ReturnValue", hStatusCode);
    }
    else if (_wcsicmp(bstrMethodName, L"Rename") == 0)
    {
        // The method we implement here is declared as:

        //        [Implemented, Description(
        //        "The Rename method will change the name of the reindeer it is run"
        //        "against.")]
        //    uint32 Rename([In] string NewReindeerName) ;

        hresult = WBEM_S_NO_ERROR;

        // get the key value so we can tell which reindeer we're operating on
        CHString sNewName, sCurName;
        Instance.GetCHString(L"name", sCurName);  // Old name

        if (!pInParams->IsNull(L"NewReindeerName"))
        {
            pInParams->GetCHString(L"NewReindeerName", sNewName); // New name
        }

        // No name was specified or a blank name was specified.
        if (!sNewName.IsEmpty())
        {
            // see if we can find the deer we want,
            for (int i = 0; i < Deers::NDeers; i++)
            {
                if (0 == sCurName.CompareNoCase(ohDeers[i].m_name))
                {
                    if (!ohDeers[i].m_deleted)
                    {
                        ohDeers[i].m_name = sNewName.AllocSysString();
            if (ohDeers[i].m_name == NULL)
              hStatusCode = WBEM_E_OUT_OF_MEMORY;
            else
                            hStatusCode = WBEM_S_NO_ERROR;
                        break;
                    }
                }
            }
        }
        else
        {
            hStatusCode = WBEM_E_INVALID_PARAMETER;
        }

        // put the result code back in the structure.
        pOutParams->SetDWORD(L"ReturnValue", hStatusCode);
    }

    // Shows how to use the GetInstancesByQuery method.  The error reporting is a little light,
    // but I didn't want obscure the GetInstancesByQuery function with a whole bunch of other
    // stuff.
    else if (_wcsicmp(bstrMethodName, L"CalcWeight") == 0)
    {
        // The method we implement here is declared as:

        //        [Implemented, static, Description(
        //        "The CalcWeight method will compute the total weight of all "
        //        "the reindeer.  It will return the total weight, or 0xffffffff "
        //        "on error.")]
        //    uint32 CalcWeight() ;

        TRefPointerCollection<CInstance>    ReindeerList;

        // Get a method context pointer off the CInstance
        MethodContext *pMethodContext = Instance.GetMethodContext();

        // Run the query.  While I'm not using a WHERE clause here, I certainly could.  Note
        // that the ReindeerList is a collection of CInstances.  As such, it can get VERY large
        // depending on the number of instances, and the size of the instances.  If you are
        // going to be hitting a big class, consider the GetInstancesByQueryAsynch function
        // instead.
        if (SUCCEEDED(hresult = CWbemProviderGlue::GetInstancesByQuery(L"SELECT Weight FROM Reindeer",
                                            &ReindeerList,
                                            pMethodContext,
                                            L"root\\default")))
        {
            REFPTRCOLLECTION_POSITION   pos;

            // Initialize the enum
            if ( ReindeerList.BeginEnum( pos ) )
            {

                // Set some vars
                CInstance *pReindeer;
                DWORD dwWeight, dwTotWeight = 0;

                // Walk the enum.  Note the pReindeer must be released when
                // we are done with it.
                while (pReindeer = ReindeerList.GetNext(pos))
                {
                    if (pReindeer->GetDWORD(pWeight, dwWeight))
                    {
                        dwTotWeight += dwWeight;
                    }

                    pReindeer->Release();
                }

                ReindeerList.EndEnum();

                // Set the out parameter, and we're done
                pOutParams->SetDWORD(L"ReturnValue", dwTotWeight);
            }
            else
            {
                pOutParams->SetDWORD(L"ReturnValue", 0xffffffff);
            }
        }
        else
        {
            pOutParams->SetDWORD(L"ReturnValue", 0xffffffff);
        }
    }
    else if (_wcsicmp(bstrMethodName, L"CalcWeightNonRed") == 0)
    {
        //        [Implemented, static, Description(
        //        "The CalcWeightNonRed method will compute the total weight of all "
        //        "the reindeer that don't have a red nose.  It will return the total "
        //        "weight, or 0xffffffff on error.")]
        //    uint32 CalcWeightNonRed() ;

        // This time we're going to use the Asynch version of GetInstancesByQuery.
        // See EnumerationCallback for discussion.

        // Get a method context pointer off the CInstance
        MethodContext *pMethodContext = Instance.GetMethodContext();

        DWORD dwTotWeight = 0;

        hresult = CWbemProviderGlue::GetInstancesByQueryAsynch(
                                        L"Select Weight FROM Reindeer WHERE RedNose = FALSE",
                                        this,
                                        StaticEnumerationCallback,
                                        L"Root\\Default",
                                        pMethodContext,
                                        &dwTotWeight);

        if (SUCCEEDED(hresult))
        {
            pOutParams->SetDWORD(L"ReturnValue", dwTotWeight);
        }
        else
        {
            pOutParams->SetDWORD(L"ReturnValue", 0xffffffff);
        }
    }

    return hresult;
}

HRESULT CReindeer::ExecQuery | ( | MethodContext * | pMethodContext,
 |  | CFrameworkQuery & | Query,
 |  | long | lFlags = 0L |
 | ) |  |  | [protected, virtual]

Definition at line 233 of file FrameworkProv.Cpp.

{

// While this class is too small to really benefit from query processing, this method is
// being instrumented to show how it could be done.  There are two different ways query processing
// can be used to improve performance.
//
// Method 1 - Look at the fields that are being requested, and only return data for those fields.  This
//            can be a very big win for some classes if some properties are very expensive to retrieve.
//            In our own LogicalDisk class, populating just the DeviceID field is very cheap.  However,
//            populating the FreeSpace property requires that we spin up the disk.  For floppy, cd, and
//            network drives, that is very expensive.
//
// Method 2 - Look at the where clause and only return the requested records.  Obviously, this also has
//            the potential to be a big win.  For example, if the query is of the form 'Select Name,
//            Size from CIM_Datafile where where drive="a:"', clearly this can be resolved much faster
//            then doing the default behavior when no ExecQuery routine is specified (enumerating all
//            directories on all drives and let Winmgmt pick out the matching entries).

//            On the other hand, just because a WHERE clause in included doesn't mean that the query can
//            be processed any faster.  Consider a query of the form "Select * from CIM_Datafile where
//            ReadOnly = TRUE".  By the time we have called FindFirstFile and examined the structure, the
//            most expensive parts of the processing is already done.  How about a query of the form
//            'Select * from CIM_Datafile where Drive="a:" or ReadOnly = TRUE'?  Again, to satisfy this
//            query, we're going to have to walk all the instances on all the drives anyway since there
//            is no way to specify to the Win32 API's that you only want ReadOnly files.  Since Winmgmt
//            already has a bunch of code to process instances against queries, there's no reason to add
//            that complexity to our provider UNLESS we are getting a big performance win.  If we send
//            back a few too many instances, winmgmt will trim them out.

//            For most classes, there are a few (sometimes only 1) properties that it makes sense to
//            try to optimize on (CIM_Datafile actually does a bunch, but many other classes that process
//            queries only do 1-2).

//            So, there is a method that can be run against the CFrameworkQuery object where you pass it
//            the name of a property, and it will tell you all the values they requested.  For example,
//            if the query is of the form 'Select * from Reindeer where name = "Dasher" or
//            name = "Dancer" or name = "pickle"', GetValuesForProp(L"Name") would send back an array
//            that contains {"Dasher", "Dancer", "pickle"}.  Or if the query was of the form 'Select *
//            from CIM_Datafile where Drive = "a:" AND ReadOnly = TRUE' (note that this query, unlike
//            the one in the paragraph above, uses AND), then GetValuesForProp(L"Drive") would
//            return {"a:"}.  Given this array, you can quickly return just the few instances they
//            requested.  If there are additional clauses on the query that you didn't process, (like
//            the Drive AND ReadOnly example above), don't worry.  Winmgmt will discard the instances
//            that don't match.

// In your provider, you can use either, neither, or both of these methods.  In the code below,
// both methods are illustrated.

   DWORD dwRequiredProperties = 0;
   CHStringArray asNames;
   HRESULT hRes = WBEM_S_NO_ERROR;

   // Part of Method 2
   Query.GetValuesForProp(pName, asNames);

   BOOL bGetAllInstances = asNames.GetSize() == 0;

   // Used by Method 1
   if (Query.IsPropertyRequired(pWeight))
       dwRequiredProperties |= BIT_WEIGHT;

   if (Query.IsPropertyRequired(pRedNose))
       dwRequiredProperties |= BIT_REDNOSE;

    // walk through all the reindeer
   for (int i = 0; (i < Deers::NDeers) && (SUCCEEDED(hRes)); i++)
   {
       // we don't want to return deleted deer
       if (!ohDeers[i].m_deleted)
       {
           // Method 2 - Check to see if the query CAN be processed by 'name', if so,
           // only return those names.
           if (bGetAllInstances || IsInList(asNames, ohDeers[i].m_name))
           {
               // Note that CreateNewInstance may throw, but will never return NULL.
               CInstance *pInstance = CreateNewInstance(pMethodContext);

               // Always set the key property
               pInstance->SetCHString(pName, CHString(ohDeers[i].m_name));

               if (SUCCEEDED(LoadPropertyValues(pInstance, i, dwRequiredProperties)))
               {
                   hRes = pInstance->Commit();
               }

               pInstance->Release();
           }
       }
   }

   return hRes;
}

HRESULT CReindeer::GetObject | ( | CInstance * | pInstance,
 |  | long | lFlags = 0L |
 | ) |  |  | [protected, virtual]

Definition at line 166 of file FrameworkProv.Cpp.

{
    // TO DO: The GetObject function is used to search for an instance of this
    //        class on the machine based on the key properties.   Unlike
    //        EnumerateInstances which finds all instances on the machine, GetObject
    //        uses the key properties to find the matching single instance and
    //        returns that instance.
    //
    //        Use the CInstance Get functions (for example, call
    //        GetCHString(L"Name", sTemp)) against pInstance to see the key values
    //        the client requested.
    HRESULT hr = WBEM_E_NOT_FOUND;

    // name is the key, we retrieve the name
    CHString name;
    pInstance->GetCHString(pName, name);

    // search the array for a Reindeer with the name we're given
    // (make sure he hasn't been deleted!)
    for (int i = 0; i < Deers::NDeers; i++)
    {
        if (0 == name.CompareNoCase(CHString(ohDeers[i].m_name)) && !ohDeers[i].m_deleted)
        {
            // we found the one they're look for - fill in the data

            hr = LoadPropertyValues(pInstance, i, BIT_ALL_PROPERTIES);
            break;
        }
    }

    return hr ;
}

BOOL CReindeer::IsInList | ( | const CHStringArray & | asArray,
 |  | LPCWSTR | pszString |
 | ) |  |  | [private]

Definition at line 758 of file FrameworkProv.Cpp.

{
    DWORD dwSize = asArray.GetSize();

    for (DWORD x=0; x < dwSize; x++)
    {
        if (asArray[x].CompareNoCase(pszString) == 0)
        {
            return TRUE;
        }
    }

    return FALSE;
}

HRESULT CReindeer::LoadPropertyValues | ( | CInstance * | pInstance,
 |  | DWORD | dwIndex,
 |  | DWORD | dwRequiredProperties |
 | ) |  |  | [protected]

Definition at line 349 of file FrameworkProv.Cpp.

{
   if (dwRequiredProperties & BIT_WEIGHT)
       pInstance->SetDWORD(pWeight,  ohDeers[dwIndex].m_weight);

   if (dwRequiredProperties & BIT_REDNOSE)
       pInstance->Setbool(pRedNose,  ohDeers[dwIndex].m_redNose);

   return WBEM_S_NO_ERROR;
}

HRESULT CReindeer::PutInstance | ( | const CInstance & | Instance,
 |  | long | lFlags = 0L |
 | ) |  |  | [protected, virtual]

Definition at line 387 of file FrameworkProv.Cpp.

{
    HRESULT hresult = WBEM_E_INVALID_PARAMETER;

    // we do not create reindeer here.
    if (lFlags & WBEM_FLAG_CREATE_ONLY)
        hresult = WBEM_E_UNSUPPORTED_PARAMETER;
    else
    {
        // get the key value so we can tell which reindeer we're operating on
        CHString name;
        Instance.GetCHString(pName, name);
        for (int i = 0; i < Deers::NDeers; i++)
        {
            if (0 == name.CompareNoCase(CHString(ohDeers[i].m_name)) && !ohDeers[i].m_deleted)
            {
                // we found one, we can change the red nose and/or the weight properties
                DWORD weight;
                bool  redNoze;

                if (Instance.GetDWORD(pWeight,  weight))
                    ohDeers[i].m_weight = weight;

                if (Instance.Getbool(pRedNose, redNoze))
                    ohDeers[i].m_redNose = redNoze;

                hresult = WBEM_S_NO_ERROR;
                break;
            }
        }

        if (FAILED(hresult))
        {
            // If they said they wanted to update, but it wasn't there
            if (lFlags & WBEM_FLAG_UPDATE_ONLY)
            {
                hresult = WBEM_E_NOT_FOUND;
            }
        }
    }

    return hresult;
}

HRESULT WINAPI CReindeer::StaticEnumerationCallback | ( | Provider * | pThat,
 |  | CInstance * | pInstance,
 |  | MethodContext * | pContext,
 |  | void * | pUserData |
 | ) |  |  | [static, private]

Definition at line 788 of file FrameworkProv.Cpp.

{
    CReindeer* pThis;
    HRESULT hr;

  pThis = static_cast<CReindeer *>(pThat);

  if (pThis)
    hr = pThis->EnumerationCallback(pInstance, pContext, pUserData);
    else
        hr = WBEM_E_FAILED;

    return hr;
}

The documentation for this class was generated from the following files:
  • SysMgmt/WMI/VC/FrameworkProv/FrameworkProv.h
  • SysMgmt/WMI/VC/FrameworkProv/FrameworkProv.Cpp
Generated on Wed Nov 13 2024 16:57:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CRenameDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes

CRenameDlg Class Reference

#include "adscontainer.h"

List of all members.

Public Types

enum | { IDD = IDD_RENAME }

Public Member Functions

CRenameDlg (CString sOldName, CWnd *pParent=NULL)
CString GetName ()

Public Attributes

CString m_sName

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
virtual BOOL | OnInitDialog ()
virtual void | OnOK ()

Protected Attributes

CString m_sNewName
CString m_sOldName

Detailed Description

Definition at line 64 of file adscontainer.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 73 of file adscontainer.h.

{ IDD = IDD_RENAME };

Constructor & Destructor Documentation

CRenameDlg::CRenameDlg | ( | CString | sOldName,
 |  | CWnd * | pParent = NULL
 | ) |  |

Definition at line 441 of file adscontainer.cpp.

  : CDialog(CRenameDlg::IDD, pParent)
{
  //{{AFX_DATA_INIT(CRenameDlg)
  m_sName = _T("");
  //}}AFX_DATA_INIT

  m_sOldName = _T("Rename '");
  m_sOldName += sOldName;
  m_sOldName += _T("'");
  m_sNewName = _T("");

}

Member Function Documentation

void CRenameDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 456 of file adscontainer.cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CRenameDlg)
  DDX_Text(pDX, IDC_NAME, m_sName);
  //}}AFX_DATA_MAP
}

CString CRenameDlg::GetName ( ) [inline]

Definition at line 69 of file adscontainer.h.

{ return m_sNewName; }

BOOL CRenameDlg::OnInitDialog ( ) [protected, virtual]

Definition at line 482 of file adscontainer.cpp.

{
  CDialog::OnInitDialog();

  SetWindowText( m_sOldName );
  return TRUE;  // return TRUE unless you set the focus to a control
                // EXCEPTION: OCX Property Pages should return FALSE
}

void CRenameDlg::OnOK ( ) [protected, virtual]

Definition at line 473 of file adscontainer.cpp.

{
  UpdateData(TRUE);
  m_sNewName = m_sName;
  CDialog::OnOK();
}

Member Data Documentation

CString CRenameDlg::m_sName

Definition at line 74 of file adscontainer.h.

CString CRenameDlg::m_sNewName [protected]

Definition at line 87 of file adscontainer.h.

CString CRenameDlg::m_sOldName [protected]

Definition at line 88 of file adscontainer.h.

The documentation for this class was generated from the following files:
  • NetDS/ADSI/samples/General/ADQI/adscontainer.h
  • NetDS/ADSI/samples/General/ADQI/adscontainer.cpp
Generated on Wed Nov 13 2024 16:57:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CRequestInstance Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CRequestInstance Class Reference

#include "policy.h"

List of all members.

Public Member Functions

CRequestInstance ()
~CRequestInstance ()
CCertPolicySample * GetPolicy ()
BSTRC GetTemplateName ()
BSTRC GetTemplateObjId ()
HRESULT | Initialize (IN CCertPolicySample *pPolicy, IN ICertServerPolicy *pServer, OUT BOOL *pfEnableEnrolleeExtensions)
BOOL IsCARequest ()
HRESULT | SetTemplateName (IN ICertServerPolicy *pServer, IN OPTIONAL WCHAR const *pwszTemplateName, IN OPTIONAL WCHAR const *pwszTemplateObjId)

Private Member Functions

VOID | _Cleanup ()
HRESULT | _SetFlagsProperty (IN ICertServerPolicy *pServer, IN WCHAR const *pwszPropName, IN DWORD dwFlags)
BOOL | _TemplateNamesMatch (IN WCHAR const *pwszTemplateName1, IN WCHAR const *pwszTemplateName2, OUT BOOL *pfTemplateMissing)

Private Attributes

DWORD m_dwTemplateMajorVersion
DWORD m_dwTemplateMinorVersion
BOOL m_fCA
CCertPolicySample * m_pPolicy
BSTR | m_strTemplateName
BSTR | m_strTemplateObjId

Detailed Description

Definition at line 348 of file policy.h.

Constructor & Destructor Documentation

CRequestInstance::CRequestInstance ( ) [inline]

Definition at line 352 of file policy.h.

    {
        m_strTemplateName = NULL;
  m_strTemplateObjId = NULL;
  m_pPolicy = NULL;

    }

CRequestInstance::~CRequestInstance ( )

Definition at line 39 of file request.cpp.

{
    _Cleanup();
}

Member Function Documentation

VOID CRequestInstance::_Cleanup ( ) [private]

Definition at line 46 of file request.cpp.

{
    if (NULL != m_strTemplateName)
    {
        SysFreeString(m_strTemplateName);
        m_strTemplateName = NULL;
    }
    if (NULL != m_strTemplateObjId)
    {
        SysFreeString(m_strTemplateObjId);
        m_strTemplateObjId = NULL;
    }
}

HRESULT CRequestInstance::_SetFlagsProperty | ( | IN ICertServerPolicy * | pServer,
 |  | IN WCHAR const * | pwszPropName,
 |  | IN DWORD | dwFlags |
 | ) |  |  | [private]
BOOL CRequestInstance::_TemplateNamesMatch | ( | IN WCHAR const * | pwszTemplateName1,
 |  | IN WCHAR const * | pwszTemplateName2,
 |  | OUT BOOL * | pfTemplateMissing |
 | ) |  |  | [private]

Definition at line 358 of file request.cpp.

{
    HRESULT hr1;
    HRESULT hr2;
    BOOL fMatch = TRUE;

    *pfTemplateMissing = FALSE;

    if (0 == celstrcmpiL(pwszTemplateName1, pwszTemplateName2))
    {
  goto done;  // identical names
    }

    {
  hr1 = ceVerifyObjId(pwszTemplateName1);
  hr2 = ceVerifyObjId(pwszTemplateName2);
  if ((S_OK == hr1) ^ (S_OK == hr2))
  {
      goto done;
  }
    }
    fMatch = FALSE;

done:
    return(fMatch);
}

CCertPolicySample* CRequestInstance::GetPolicy ( ) [inline]

Definition at line 378 of file policy.h.

{ return(m_pPolicy); }

BSTRC CRequestInstance::GetTemplateName ( ) [inline]

Definition at line 372 of file policy.h.

{ return(m_strTemplateName); }

BSTRC CRequestInstance::GetTemplateObjId ( ) [inline]

Definition at line 373 of file policy.h.

{ return(m_strTemplateObjId); }

HRESULT CRequestInstance::Initialize | ( | IN CCertPolicySample * | pPolicy,
 |  | IN ICertServerPolicy * | pServer,
 |  | OUT BOOL * | pfEnableEnrolleeExtensions
 | ) |  |

Definition at line 76 of file request.cpp.

{
    HRESULT hr;
    HRESULT hrTemplate = S_OK;
    CERT_TEMPLATE_EXT *pTemplate = NULL;
    CERT_NAME_VALUE *pName = NULL;
    BSTR strTemplateObjId = NULL; // from V2 template extension
    BSTR strTemplateName = NULL;  // from V1 template extension
    BSTR strTemplateRA = NULL;    // from request attributes
    WCHAR const *pwszTemplateName;
    WCHAR const *pwszTemplateObjId;
    WCHAR const *pwszV1TemplateClass;
    VARIANT varValue;
    DWORD cbType;
    DWORD i;
    BOOL fConflict;
    BOOL f;
    BOOL fTemplateMissing;
    BOOL fRAObjId = FALSE;

    VariantInit(&varValue);
    *pfEnableEnrolleeExtensions = TRUE
        ;

    m_pPolicy = pPolicy;
    m_fCA = FALSE;

    // Retrieve the template ObjId from the V2 cert template info extension

    m_dwTemplateMajorVersion = 0;
    m_dwTemplateMinorVersion = 0;
    hr = polGetCertificateExtension(
          pServer,
          TEXT(szOID_CERTIFICATE_TEMPLATE),
          PROPTYPE_BINARY,
          &varValue);
    _PrintIfErrorStr2(
    hr,
    "Policy:polGetCertificateExtension",
    TEXT(szOID_CERTIFICATE_TEMPLATE),
    CERTSRV_E_PROPERTY_EMPTY);
    if (S_OK == hr)
    {
        // There was a cert type indicator.
        // varValue points to an encoded string

        if (VT_BSTR != varValue.vt)
  {
      hr = E_INVALIDARG;
      _JumpError(hr, error, "Policy:varValue.vt");
  }
        if (!ceDecodeObject(
        X509_ASN_ENCODING,
        X509_CERTIFICATE_TEMPLATE,
        (BYTE *) varValue.bstrVal,
        SysStringByteLen(varValue.bstrVal),
        FALSE,
        (VOID **) &pTemplate,
        &cbType))
        {
            hr = ceHLastError();
      _JumpError(hr, error, "Policy:ceDecodeObject");
        }
  if (!ceConvertSzToBstr(&strTemplateObjId, pTemplate->pszObjId, -1))
  {
            hr = E_OUTOFMEMORY;
      _JumpError(hr, error, "Policy:ceConvertSzToBstr");
        }
  m_dwTemplateMajorVersion = pTemplate->dwMajorVersion;
  m_dwTemplateMinorVersion = pTemplate->dwMinorVersion;
  DBGPRINT((
      fDebug,
      pTemplate->fMinorVersion?
    "Extension Template Info: %ws V%u.%u\n" :
    "Extension Template Info: %ws V%u%\n",
      strTemplateObjId,
      m_dwTemplateMajorVersion,
      m_dwTemplateMinorVersion));
    }
    VariantClear(&varValue);

    // Retrieve template Name from the V1 cert template name extension

    hr = polGetCertificateExtension(
          pServer,
          TEXT(szOID_ENROLL_CERTTYPE_EXTENSION),
          PROPTYPE_BINARY,
          &varValue);
    _PrintIfErrorStr2(
    hr,
    "Policy:polGetCertificateExtension",
    TEXT(szOID_ENROLL_CERTTYPE_EXTENSION),
    CERTSRV_E_PROPERTY_EMPTY);
    if (S_OK == hr)
    {
        // There was a cert type indicator.
        // varValue points to an encoded string

        if (VT_BSTR != varValue.vt)
  {
      hr = E_INVALIDARG;
      _JumpError(hr, error, "Policy:varValue.vt");
  }
        if (!ceDecodeObject(
        X509_ASN_ENCODING,
        X509_UNICODE_ANY_STRING,
        (BYTE *) varValue.bstrVal,
        SysStringByteLen(varValue.bstrVal),
        FALSE,
        (VOID **) &pName,
        &cbType))
        {
            hr = ceHLastError();
      _JumpError(hr, error, "Policy:ceDecodeObject");
        }
        strTemplateName = SysAllocString((WCHAR *) pName->Value.pbData);
        if (NULL == strTemplateName)
        {
            hr = E_OUTOFMEMORY;
      _JumpError(hr, error, "Policy:SysAllocString");
        }
  DBGPRINT((fDebug, "Extension Template: %ws\n", strTemplateName));
    }

    fConflict = FALSE;
    fTemplateMissing = FALSE;

    // Retrieve the template from the request attributes

    hr = polGetRequestAttribute(pServer, wszPROPCERTTEMPLATE, &strTemplateRA);
    if (S_OK != hr)
    {
  _PrintErrorStr2(
        hr,
        "Policy:polGetRequestAttribute",
        wszPROPCERTTEMPLATE,
        CERTSRV_E_PROPERTY_EMPTY);
  hr = S_OK;

    }
    else
    {
  DBGPRINT((fDebug, "Attribute Template: %ws\n", strTemplateRA));
  if (NULL != strTemplateObjId &&
      !_TemplateNamesMatch(strTemplateObjId, strTemplateRA, &f))
  {
      fConflict = TRUE;
      if (f)
      {
    fTemplateMissing = TRUE;
      }
  }
  if (NULL != strTemplateName &&
      !_TemplateNamesMatch(strTemplateName, strTemplateRA, &f))
  {
      fConflict = TRUE;
      if (f)
      {
    fTemplateMissing = TRUE;
      }
  }
  hr = ceVerifyObjId(strTemplateRA);
  fRAObjId = S_OK == hr;
    }

    if (NULL != strTemplateObjId &&
  NULL != strTemplateName &&
  !_TemplateNamesMatch(strTemplateObjId, strTemplateName, &f))
    {
  fConflict = TRUE;
  if (f)
  {
      fTemplateMissing = TRUE;
  }
    }

    if (fConflict)
    {
  hrTemplate = CERTSRV_E_TEMPLATE_CONFLICT;
  if (NULL != strTemplateObjId)
  {
      _PrintErrorStr(
      hrTemplate,
      "Policy:Extension Template ObjId",
      strTemplateObjId);
  }
  if (NULL != strTemplateName)
  {
      _PrintErrorStr(
      hrTemplate,
      "Policy:Extension Template Name",
      strTemplateName);
  }
  if (NULL != strTemplateRA)
  {
      _PrintErrorStr(
      hrTemplate,
      "Policy:Attribute Template",
      strTemplateRA);
  }
    }

    pwszTemplateName = strTemplateName;
    pwszTemplateObjId = strTemplateObjId;
    if (fRAObjId)
    {
  if (NULL == pwszTemplateObjId)
  {
      pwszTemplateObjId = strTemplateRA;
  }
    }
    else
    {
  if (NULL == pwszTemplateName)
  {
      pwszTemplateName = strTemplateRA;
  }
    }

    {
  if (NULL != pwszTemplateName)
  {
      for (i = 0; i < ARRAYSIZE(s_apwszCATypes); i++)
      {
    if (0 == celstrcmpiL(s_apwszCATypes[i], pwszTemplateName))
    {
        m_fCA = TRUE;
        break;
    }
      }
  }
    }
    hr = SetTemplateName(pServer, pwszTemplateName, pwszTemplateObjId);
    _JumpIfError(hr, error, "Policy:SetTemplateName");

    pwszV1TemplateClass = pwszTemplateName;

    hr = pPolicy->AddV1TemplateNameExtension(pServer, pwszV1TemplateClass);
    _JumpIfError(hr, error, "AddTemplateNameExtension");

error:
    if (S_OK != hrTemplate)
    {
  hr = hrTemplate;  // override secondary errors

    }
    VariantClear(&varValue);

    if (NULL != pName)
    {
        LocalFree(pName);
    }
    if (NULL != pTemplate)
    {
        LocalFree(pTemplate);
    }
    if (NULL != strTemplateObjId)
    {
        SysFreeString(strTemplateObjId);
    }
    if (NULL != strTemplateName)
    {
        SysFreeString(strTemplateName);
    }
    if (NULL != strTemplateRA)
    {
        SysFreeString(strTemplateRA);
    }
    return(hr);
}

BOOL CRequestInstance::IsCARequest ( ) [inline]

Definition at line 376 of file policy.h.

{ return(m_fCA); }

HRESULT CRequestInstance::SetTemplateName | ( | IN ICertServerPolicy * | pServer,
 |  | IN OPTIONAL WCHAR const * | pwszTemplateName,
 |  | IN OPTIONAL WCHAR const * | pwszTemplateObjId
 | ) |  |

Definition at line 396 of file request.cpp.

{
    HRESULT hr;
    BSTR strProp = NULL;
    BSTR strTemplateName = NULL;

    if (NULL != pwszTemplateName)
    {
  m_strTemplateName = SysAllocString(pwszTemplateName);
  if (NULL == m_strTemplateName)
  {
      hr = E_OUTOFMEMORY;
      _JumpError(hr, error, "Policy:SysAllocString");
  }
  strTemplateName = m_strTemplateName;
    }

    if (NULL != pwszTemplateObjId)
    {
  m_strTemplateObjId = SysAllocString(pwszTemplateObjId);
  if (NULL == m_strTemplateObjId)
  {
      hr = E_OUTOFMEMORY;
      _JumpError(hr, error, "Policy:SysAllocString");
  }
  strTemplateName = m_strTemplateObjId;
    }

    if (NULL != strTemplateName)
    {
  VARIANT var;

  strProp = SysAllocString(wszPROPCERTIFICATETEMPLATE);
  if (NULL == strProp)
  {
      hr = E_OUTOFMEMORY;
      _JumpError(hr, error, "Policy:SysAllocString");
  }

  var.vt = VT_BSTR;
  var.bstrVal = strTemplateName;

  hr = pServer->SetCertificateProperty(strProp, PROPTYPE_STRING, &var);
  _JumpIfError(hr, error, "Policy:SetCertificateProperty");
    }
    hr = S_OK;

error:
    if (NULL != strProp)
    {
  SysFreeString(strProp);
    }
    return(hr);
}

Member Data Documentation

DWORD CRequestInstance::m_dwTemplateMajorVersion [private]

Definition at line 397 of file policy.h.

DWORD CRequestInstance::m_dwTemplateMinorVersion [private]

Definition at line 398 of file policy.h.

BOOL CRequestInstance::m_fCA [private]

Definition at line 399 of file policy.h.

CCertPolicySample* CRequestInstance::m_pPolicy [private]

Definition at line 394 of file policy.h.

BSTR CRequestInstance::m_strTemplateName [private]

Definition at line 395 of file policy.h.

BSTR CRequestInstance::m_strTemplateObjId [private]

Definition at line 396 of file policy.h.

The documentation for this class was generated from the following files:
  • Security/CertServices/Policy/C++/Windows.Net/policy.h
  • Security/CertServices/Policy/C++/Windows.Net/request.cpp
Generated on Wed Nov 13 2024 16:57:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CResData Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Private Attributes

CResData Class Reference

#include "ExtObjData.h"

Inherits CObjData, and CObjData.

List of all members.

Public Member Functions

virtual HRESULT | AddContextMenuItems (IWCContextMenuCallback *piCallbackIn)
virtual HRESULT | AddContextMenuItems (IWCContextMenuCallback *piCallbackIn)
HRESOURCE | GetHResource (void)
HRESOURCE | GetHResource (void)
virtual HRESULT | GetPropertySheetPages (CRuntimeClass ***ppaPropSheetsOut)
virtual HRESULT | GetPropertySheetPages (CRuntimeClass ***ppaPropSheetsOut)
virtual HRESULT | GetWizardPages (CRuntimeClass ***ppaWizardPagesOut)
virtual HRESULT | GetWizardPages (CRuntimeClass ***ppaWizardPagesOut)
virtual HRESULT | InvokeCommand (ULONG nCommandIDIn)
virtual HRESULT | InvokeCommand (ULONG nCommandIDIn)

Protected Member Functions

virtual HRESULT | HrInitialize (IUnknown *piDataIn)
virtual HRESULT | HrInitialize (IUnknown *piDataIn)

Private Attributes

BOOL m_fSupportedType
HRESOURCE | m_hResource
CString m_strResTypeName

Detailed Description

Definition at line 203 of file ExtObjData.h.

Member Function Documentation

HRESULT CResData::AddContextMenuItems ( IWCContextMenuCallback * piCallbackIn ) [virtual]

Reimplemented from CObjData.

Definition at line 1030 of file ExtObjData.cpp.

{
    HRESULT hr = S_OK;

    UNREFERENCED_PARAMETER( piCallbackIn );

    //
    // TODO: Uncomment the following code to add context menus
    //       to ClipBookServer resources.
    //
    /*

    ASSERT( piCallbackIn != NULL );

    hr = AddContextMenuItem(
              piCallbackIn
            , IDS_RESOURCE_MENU_ITEM_1
            , IDS_RESOURCE_MENU_ITEM_1_DESC
            , RESOURCE_MENU_ID_1
            , MF_ENABLED
            );
    */

    return hr;

} //*** CResData::AddContextMenuItems

virtual HRESULT CResData::AddContextMenuItems ( IWCContextMenuCallback * piCallbackIn ) [virtual]

Reimplemented from CObjData.

HRESOURCE CResData::GetHResource ( void ) [inline]

Definition at line 220 of file ExtObjData.h.

{ return m_hResource; };

HRESOURCE CResData::GetHResource ( void ) [inline]

Definition at line 220 of file ExtObjData.h.

{ return m_hResource; };

HRESULT CResData::GetPropertySheetPages ( CRuntimeClass *** ppaPropSheetsOut ) [virtual]

Reimplemented from CObjData.

Definition at line 1125 of file ExtObjData.cpp.

{
    HRESULT hr = E_NOTIMPL;

    ASSERT( ppaPropSheetsOut != NULL );

    //
    // This class only extends ClipBook Server resources.
    //

    if ( m_fSupportedType == FALSE )
    {
        goto Cleanup;
    } // if:

    if ( m_rgprtcPSPages != NULL )
    {
        hr = S_OK;
        *ppaPropSheetsOut = m_rgprtcPSPages;
    } // if:

Cleanup:

    return hr;

} //*** CResData::GetPropertySheetPages

virtual HRESULT CResData::GetPropertySheetPages ( CRuntimeClass *** ppaPropSheetsOut ) [virtual]

Reimplemented from CObjData.

HRESULT CResData::GetWizardPages ( CRuntimeClass *** ppaWizardPagesOut ) [virtual]

Reimplemented from CObjData.

Definition at line 1170 of file ExtObjData.cpp.

{
    HRESULT hr = E_NOTIMPL;

    ASSERT( ppaWizardPagesOut != NULL );

    //
    // This class only extends ClipBook Server resources.
    //

    if ( m_fSupportedType == FALSE )
    {
        goto Cleanup;
    } // if:

    if ( m_rgprtcWizPages != NULL )
    {
        hr = S_OK;
        *ppaWizardPagesOut = m_rgprtcWizPages;
    } // if:

Cleanup:

    return hr;

} //*** CResData::GetWizardPages

virtual HRESULT CResData::GetWizardPages ( CRuntimeClass *** ppaWizardPagesOut ) [virtual]

Reimplemented from CObjData.

HRESULT CResData::HrInitialize ( IUnknown * piDataIn ) [protected, virtual]

Reimplemented from CObjData.

Definition at line 884 of file ExtObjData.cpp.

{
    HRESULT                     hr = S_OK;
    IGetClusterResourceInfo *   piResInfo = NULL;
    LONG                        cchTypeName = 0;
    BSTR                        bstrTypeName = NULL;
    LPCWSTR                     pwszResTypes = g_wszResourceTypeNames;

    ASSERT( piDataIn != NULL );

    //
    // Initialize the base class.
    //

    hr = CObjData::HrInitialize( piDataIn );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if: error initializing the base class

    //
    // Initialize member variables to default values.
    //

    m_hResource = NULL;
    m_fSupportedType = FALSE;

    //
    // Set the object type.
    //

    m_cot = CLUADMEX_OT_RESOURCE;

    //
    // Set the pointers to our resource property sheet and wizard pages.
    //

    m_rgprtcPSPages = g_rgprtcResPSPages;
    m_rgprtcWizPages = g_rgprtcResPSPages;

    //
    // Get an interface pointer to IGetClusterResourceInfo.
    //

    hr = piDataIn->QueryInterface( IID_IGetClusterResourceInfo, reinterpret_cast< LPVOID * >( &piResInfo ) );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if: error querying for interface

    //
    // Get a copy of the handle.  Don't free this handle, it's just a copy.
    //

    m_hResource = piResInfo->GetResourceHandle( 0 );
    ASSERT( m_hResource != NULL );
    if ( m_hResource == NULL )
    {
        hr = E_HANDLE;
        goto Cleanup;
    } // if: error querying for interface

    //
    // Allocate a buffer for and retrieve the resource type name.
    //

    hr = piResInfo->GetResourceTypeName( 0, NULL, &cchTypeName );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    bstrTypeName = SysAllocStringLen( NULL, cchTypeName );
    if ( bstrTypeName == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if:

    hr = piResInfo->GetResourceTypeName( 0, bstrTypeName, &cchTypeName );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    //
    // The CString assignment operator makes a copy.
    //

    m_strResTypeName = bstrTypeName;

    //
    // Determine whether this is a supported type.
    //

    m_fSupportedType = FALSE;
    while ( *pwszResTypes != L'\0' )
    {
        if ( m_strResTypeName.CompareNoCase( pwszResTypes ) == 0 )
        {
            m_fSupportedType = TRUE;
            break;
        } // if:

        pwszResTypes += lstrlenW( pwszResTypes ) + 1;
    }  // while:  more resource types

Cleanup:

    if ( piResInfo != NULL )
    {
        piResInfo->Release();
    } // if:

    SysFreeString( bstrTypeName );

    return hr;

} //*** CResData::HrInitialize

virtual HRESULT CResData::HrInitialize ( IUnknown * piDataIn ) [protected, virtual]

Reimplemented from CObjData.

HRESULT CResData::InvokeCommand ( ULONG nCommandIDIn ) [virtual]

Reimplemented from CObjData.

Definition at line 1079 of file ExtObjData.cpp.

{
    HRESULT hr = S_OK;

    switch ( nCommandIDIn )
    {
        case RESOURCE_MENU_ID_1:

            //
            //  TODO:  Implement your menu item here
            //

            hr = S_OK;
            break;

        case ALL_RESOURCES_MENU_ID_1:
            hr = S_OK;
            break;

        default:
            hr = E_NOTIMPL;
            break;
    } // switch: nCommandIDIn

    return hr;

} //*** CResData::InvokeCommand

virtual HRESULT CResData::InvokeCommand ( ULONG nCommandIDIn ) [virtual]

Reimplemented from CObjData.

Member Data Documentation

BOOL CResData::m_fSupportedType [private]

Definition at line 209 of file ExtObjData.h.

HRESOURCE CResData::m_hResource [private]

Definition at line 207 of file ExtObjData.h.

CString CResData::m_strResTypeName [private]

Definition at line 208 of file ExtObjData.h.

The documentation for this class was generated from the following files:
  • WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/ExtObjData.h
  • WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/ExtObjData.h
  • WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/ExtObjData.cpp
  • WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/ExtObjData.cpp
Generated on Wed Nov 13 2024 16:57:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CResourceSub Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CResourceSub Class Reference

#include "Resourcesub.h"

Inherits CSysLCESub.

List of all members.

Public Member Functions

CResourceSub (CComSpy *pSpy)
CResourceSub ()
STDMETHODIMP | GetEventClass (LPGUID guid)
STDMETHODIMP | GetEventType (EventEnum *e)
STDMETHODIMP | GetInterface (IID *iid)
STDMETHOD() | OnResourceAllocate (COMSVCSEVENTINFO *pInfo, ULONG64 ObjectID, LPCOLESTR pszType, ULONG64 resId, BOOL enlisted, DWORD NumRated, DWORD Rating)
STDMETHOD() | OnResourceCreate (COMSVCSEVENTINFO *pInfo, ULONG64 ObjectID, LPCOLESTR pszType, ULONG64 resId, BOOL enlisted)
STDMETHOD() | OnResourceDestroy (COMSVCSEVENTINFO *pInfo, ULONG64 ObjectID, HRESULT hr, LPCOLESTR pszType, ULONG64 resId)
STDMETHOD() | OnResourceRecycle (COMSVCSEVENTINFO *pInfo, ULONG64 ObjectID, LPCOLESTR pszType, ULONG64 resId)
STDMETHOD() | OnResourceTrack (COMSVCSEVENTINFO *pInfo, ULONG64 ObjectID, LPCOLESTR pszType, ULONG64 resId, BOOL enlisted)

Detailed Description

Definition at line 30 of file Resourcesub.h.

Constructor & Destructor Documentation

CResourceSub::CResourceSub ( CComSpy * pSpy ) [inline]

Definition at line 36 of file Resourcesub.h.

  {
    m_pSpy = pSpy;
  }

CResourceSub::CResourceSub ( ) [inline]

Definition at line 40 of file Resourcesub.h.

  {
    m_pSpy = NULL;
  }

Member Function Documentation

STDMETHODIMP CResourceSub::GetEventClass ( LPGUID guid ) [inline, virtual]

Implements CSysLCESub.

Definition at line 54 of file Resourcesub.h.

{*guid = CLSID_ComServiceEvents;return S_OK;}

STDMETHODIMP CResourceSub::GetEventType ( EventEnum * e ) [inline, virtual]

Implements CSysLCESub.

Definition at line 53 of file Resourcesub.h.

{*e = Resource;return S_OK;}

STDMETHODIMP CResourceSub::GetInterface ( IID * iid ) [inline, virtual]

Implements CSysLCESub.

Definition at line 55 of file Resourcesub.h.

{*iid = IID_IComResourceEvents;return S_OK;}

STDMETHODIMP CResourceSub::OnResourceAllocate | ( | COMSVCSEVENTINFO * | pInfo,
 |  | ULONG64 | ObjectID,
 |  | LPCOLESTR | pszType,
 |  | ULONG64 | resId,
 |  | BOOL | enlisted,
 |  | DWORD | NumRated,
 |  | DWORD | Rating
 | ) |  |

Definition at line 60 of file Resourcesub.Cpp.

{

  m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnResourceAllocate"),GuidToBstr(pInfo->guidApp));
  m_pSpy -> AddParamValueToList(L"Type", pszType);

  WCHAR szObjectID[32];
  wsprintfW(szObjectID, L"0x%016X", ObjectID);
  m_pSpy -> AddParamValueToList(L"ObjectID", szObjectID);

  WCHAR szResID[32];
  wsprintfW(szResID, L"0x%016X", resId);
  m_pSpy -> AddParamValueToList(L"ResourceID", szResID);

  WCHAR szEnlisted[10];
  if (enlisted)
    wsprintfW(szEnlisted, L"TRUE");
  else
    wsprintfW(szEnlisted, L"FALSE");
  m_pSpy -> AddParamValueToList(L"Enlisted", szEnlisted);

  WCHAR szNumRated[16];
  wsprintfW(szNumRated, L"0x%08X", NumRated);
  m_pSpy -> AddParamValueToList(L"NumRated", szNumRated);

  WCHAR szRating[16];
  wsprintfW(szRating, L"0x%08X", Rating);
  m_pSpy -> AddParamValueToList(L"Rating", szRating);

  IF_AUDIT_DO(OnResourceAllocate)(pInfo->perfCount,GuidToBstr(pInfo->guidApp), szObjectID, pszType, szResID,enlisted,szNumRated,szRating);
  return S_OK;
}

STDMETHODIMP CResourceSub::OnResourceCreate | ( | COMSVCSEVENTINFO * | pInfo,
 |  | ULONG64 | ObjectID,
 |  | LPCOLESTR | pszType,
 |  | ULONG64 | resId,
 |  | BOOL | enlisted
 | ) |  |

Definition at line 29 of file Resourcesub.Cpp.

{
  m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnResourceCreate"), GuidToBstr(pInfo->guidApp));
  m_pSpy -> AddParamValueToList(L"Type", pszType);

  WCHAR szObjectID[32];
  wsprintfW(szObjectID, L"0x%016X", ObjectID);
  m_pSpy -> AddParamValueToList(L"ObjectID", szObjectID);

  WCHAR szResID[32];
  wsprintfW(szResID, L"0x%016X", resId);
  m_pSpy -> AddParamValueToList(L"ResourceID", szResID);

  WCHAR szEnlisted[10];
  if (enlisted)
    wsprintfW(szEnlisted, L"TRUE");
  else
    wsprintfW(szEnlisted, L"FALSE");
  m_pSpy -> AddParamValueToList(L"Enlisted", szEnlisted);

  IF_AUDIT_DO(OnResourceCreate)(pInfo->perfCount,GuidToBstr(pInfo->guidApp), szObjectID, pszType, szResID,enlisted);

  return S_OK;
}

STDMETHODIMP CResourceSub::OnResourceDestroy | ( | COMSVCSEVENTINFO * | pInfo,
 |  | ULONG64 | ObjectID,
 |  | HRESULT | hr,
 |  | LPCOLESTR | pszType,
 |  | ULONG64 | resId
 | ) |  |

Definition at line 123 of file Resourcesub.Cpp.

{
  m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnResourceDestroy"),GuidToBstr(pInfo->guidApp));

  m_pSpy -> AddParamValueToList(L"Type", pszType);

  WCHAR szObjectID[32];
  wsprintfW(szObjectID, L"0x%016X", ObjectID);
  m_pSpy -> AddParamValueToList(L"ObjectID", szObjectID);

  WCHAR szResID[32];
  wsprintfW(szResID, L"0x%016X", resId);
  m_pSpy -> AddParamValueToList(L"ResourceID", szResID);

  WCHAR szHResult[16];
  wsprintfW(szHResult, L"0x%08X", hr);
  m_pSpy -> AddParamValueToList(L"Destroy HR", szHResult);

  IF_AUDIT_DO(OnResourceDestroy)(pInfo->perfCount, GuidToBstr(pInfo->guidApp), szObjectID, hr,pszType, szResID);
  return S_OK;
}

STDMETHODIMP CResourceSub::OnResourceRecycle | ( | COMSVCSEVENTINFO * | pInfo,
 |  | ULONG64 | ObjectID,
 |  | LPCOLESTR | pszType,
 |  | ULONG64 | resId
 | ) |  |

Definition at line 101 of file Resourcesub.Cpp.

{
  m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnResourceRecycle"),GuidToBstr(pInfo->guidApp));
  m_pSpy -> AddParamValueToList(L"Type", pszType);

  WCHAR szObjectID[32];
  wsprintfW(szObjectID, L"0x%016X", ObjectID);
  m_pSpy -> AddParamValueToList(L"ObjectID", szObjectID);

  WCHAR szResID[32];
  wsprintfW(szResID, L"0x%016X", resId);
  m_pSpy -> AddParamValueToList(L"ResourceID", szResID);

  IF_AUDIT_DO(OnResourceRecycle)(pInfo->perfCount,GuidToBstr(pInfo->guidApp), szObjectID, pszType, szResID);
  return S_OK;
}

STDMETHODIMP CResourceSub::OnResourceTrack | ( | COMSVCSEVENTINFO * | pInfo,
 |  | ULONG64 | ObjectID,
 |  | LPCOLESTR | pszType,
 |  | ULONG64 | resId,
 |  | BOOL | enlisted
 | ) |  |

Definition at line 150 of file Resourcesub.Cpp.

{
  m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnResourceTrack"), GuidToBstr(pInfo->guidApp));

  m_pSpy -> AddParamValueToList(L"Type", pszType);

  WCHAR szObjectID[32];
  wsprintfW(szObjectID, L"0x%016X", ObjectID);
  m_pSpy -> AddParamValueToList(L"ObjectID", szObjectID);

  WCHAR szResID[32];
  wsprintfW(szResID, L"0x%016X", resId);
  m_pSpy -> AddParamValueToList(L"ResourceID", szResID);

  WCHAR szEnlisted[10];
  if (enlisted)
    wsprintfW(szEnlisted, L"TRUE");
  else
    wsprintfW(szEnlisted, L"FALSE");
  m_pSpy -> AddParamValueToList(L"Enlisted", szEnlisted);

  IF_AUDIT_DO(OnResourceTrack)(pInfo->perfCount,GuidToBstr(pInfo->guidApp), szObjectID, pszType, szResID,enlisted);

  return S_OK;
}

The documentation for this class was generated from the following files:
  • Com/Administration/Spy/ComSpyCtl/Resourcesub.h
  • Com/Administration/Spy/ComSpyCtl/Resourcesub.Cpp
Generated on Wed Nov 13 2024 16:57:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CResString Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CResString Class Reference

List of all members.

Public Member Functions

CResString ()
CResString (UINT strIDS)
WCHAR const * | Get () const
BOOL | Load (UINT strIDS)

Private Attributes

WCHAR | _awc [200]

Detailed Description

Definition at line 124 of file QSample.Cxx.

Constructor & Destructor Documentation

CResString::CResString ( ) [inline]

Definition at line 127 of file QSample.Cxx.

{ _awc[ 0 ] = 0; }

CResString::CResString ( UINT strIDS ) [inline]

Definition at line 128 of file QSample.Cxx.

{ Load( strIDS ); }

Member Function Documentation

WCHAR const* CResString::Get ( ) const [inline]

Definition at line 129 of file QSample.Cxx.

{ return _awc; }

BOOL CResString::Load ( UINT strIDS ) [inline]

Definition at line 131 of file QSample.Cxx.

    {
        _awc[ 0 ] = 0;
        LoadString( 0, strIDS, _awc, sizeof _awc / sizeof WCHAR );
        return ( 0 != _awc[ 0 ] );
    }

Member Data Documentation

WCHAR CResString::_awc[200] [private]

Definition at line 139 of file QSample.Cxx.

The documentation for this class was generated from the following file:
  • WinBase/Indexing/Simple/QSample.Cxx
Generated on Wed Nov 13 2024 16:57:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CResTypeData Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Private Attributes

CResTypeData Class Reference

#include "ExtObjData.h"

Inherits CObjData, and CObjData.

List of all members.

Public Member Functions

virtual HRESULT | AddContextMenuItems (IWCContextMenuCallback *piCallbackIn)
virtual HRESULT | AddContextMenuItems (IWCContextMenuCallback *piCallbackIn)
virtual HRESULT | InvokeCommand (ULONG nCommandIDIn)
virtual HRESULT | InvokeCommand (ULONG nCommandIDIn)

Protected Member Functions

virtual HRESULT | HrInitialize (IUnknown *piDataIn)
virtual HRESULT | HrInitialize (IUnknown *piDataIn)

Private Attributes

BOOL m_fSupportedType

Detailed Description

Definition at line 228 of file ExtObjData.h.

Member Function Documentation

HRESULT CResTypeData::AddContextMenuItems ( IWCContextMenuCallback * piCallbackIn ) [virtual]

Reimplemented from CObjData.

Definition at line 1285 of file ExtObjData.cpp.

{
    HRESULT hr = S_OK;

    UNREFERENCED_PARAMETER( piCallbackIn );

    return hr;

} //*** CResTypeData::AddContextMenuItems

virtual HRESULT CResTypeData::AddContextMenuItems ( IWCContextMenuCallback * piCallbackIn ) [virtual]

Reimplemented from CObjData.

HRESULT CResTypeData::HrInitialize ( IUnknown * piDataIn ) [protected, virtual]

Reimplemented from CObjData.

Definition at line 1218 of file ExtObjData.cpp.

{
    HRESULT hr = S_OK;
    LPCWSTR pwszResTypes = g_wszResourceTypeNames;

    ASSERT( piDataIn != NULL );

    //
    // Initialize the base class.
    //

    hr = CObjData::HrInitialize( piDataIn );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if: error initializing the base class

    //
    // Set the object type.
    //

    m_cot = CLUADMEX_OT_RESOURCETYPE;

    m_fSupportedType = FALSE;
    while ( *pwszResTypes != L'\0' )
    {
        if ( StrName().CompareNoCase( pwszResTypes ) == 0 )
        {
            m_fSupportedType = TRUE;
            break;
        } // if:

        pwszResTypes += lstrlenW( pwszResTypes ) + 1;
    }  // while:  more resource types

Cleanup:

    return hr;

} //*** CResTypeData::HrInitialize

virtual HRESULT CResTypeData::HrInitialize ( IUnknown * piDataIn ) [protected, virtual]

Reimplemented from CObjData.

HRESULT CResTypeData::InvokeCommand ( ULONG nCommandIDIn ) [virtual]

Reimplemented from CObjData.

Definition at line 1317 of file ExtObjData.cpp.

{
    HRESULT hr = S_OK;

    switch ( nCommandIDIn )
    {
        case RESTYPE_MENU_ID_1:

            //
            //  TODO:  Implement your menu item here
            //

            hr = S_OK;
            break;

        case ALL_RESTYPES_MENU_ID_1:
            hr = S_OK;
            break;

        default:
            hr = E_NOTIMPL;
            break;
    } // switch: nCommandIDIn

    return hr;

} //*** CResTypeData::InvokeCommand

virtual HRESULT CResTypeData::InvokeCommand ( ULONG nCommandIDIn ) [virtual]

Reimplemented from CObjData.

Member Data Documentation

BOOL CResTypeData::m_fSupportedType [private]

Definition at line 232 of file ExtObjData.h.

The documentation for this class was generated from the following files:
  • WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/ExtObjData.h
  • WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/ExtObjData.h
  • WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/ExtObjData.cpp
  • WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/ExtObjData.cpp
Generated on Wed Nov 13 2024 16:57:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CResultset Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CResultset Class Reference

#include "resultset.h"

List of all members.

Public Member Functions

CResultset ()
~CResultset ()
STDMETHOD() | _NewEnum (IUnknown **ppunk)
void | Clear (bool bDelete)
STDMETHOD() | Count (long *pi4)
void | DeleteEntity (long nIndex)
STDMETHOD() | DisconnectObject (DWORD dwReserved)
STDMETHOD() | get_Record (long nIndex, IEntityData **pVal)
STDMETHOD() | GetClassID (GUID *pClassID)
CStaticEntity * | GetEntity (long nIndex)
STDMETHOD() | GetMarshalSizeMax (REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlFlags, ULONG *pSize)
STDMETHOD() | GetSizeMax (_ULARGE_INTEGER *pCbSize)
STDMETHOD() | GetUnmarshalClass (REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlFlags, CLSID *pCid)
HRESULT | Initialise (long nRows)
STDMETHOD() | InitNew ()
STDMETHOD() | InterfaceSupportsErrorInfo (REFIID riid)
STDMETHOD() | IsDirty ()
STDMETHOD() | Load (IStream *pStm)
STDMETHOD() | MarshalInterface (IStream *pStm, REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlFlags)
STDMETHOD() | ReleaseMarshalData (IStream *pStm)
STDMETHOD() | Save (IStream *pStm, int fClearDirty)
void | SetCount (long nCount)
STDMETHOD() | UnmarshalInterface (IStream *pStm, REFIID riid, void **ppv)

Public Attributes

long | m_nAlloc
long | m_nCount
CStaticEntity * | m_pEntity [ENTITY_BANKS *ENTITY_PER_BANK]
CFastVariant * m_pVar
CString m_wszDeleteStoredProc
CString m_wszInsertStoredProc
CString m_wszKeyField
CString m_wszReadStoredProc
CString m_wszUpdateStoredProc

Detailed Description

Definition at line 10 of file resultset.h.

Constructor & Destructor Documentation

CResultset::CResultset ( ) [inline]

Definition at line 39 of file resultset.h.

  {
    m_pVar = NULL;
    m_nCount = 0;
    m_nAlloc = 0;
    Clear(false);
  }

CResultset::~CResultset ( ) [inline]

Definition at line 47 of file resultset.h.

  {
    Clear(true);
  }

Member Function Documentation

STDMETHODIMP CResultset::_NewEnum ( IUnknown ** ppunk )

Definition at line 33 of file resultset.Cpp.

{
  HRESULT hr;
  IUnknown *pThisUnk;

  if (pVal == NULL)
    return E_POINTER;
  *pVal = NULL;

  if (m_pVar == NULL)
  {
    m_pVar = new CFastVariant[m_nCount];
  }

  for (int n = 0; n < m_nCount; n++)
  {
    IEntityData *pEntity;

    get_Record(n + 1, &pEntity);

    m_pVar[n] = pEntity;
  }

  typedef CComObject<CComEnum<IEnumVARIANT, &IID_IEnumVARIANT, VARIANT, _Copy<VARIANT> > > enumvar;
  enumvar* pEnumVar = new enumvar;
  _ASSERTE(pEnumVar);

  hr = QueryInterface(IID_IUnknown, (void**)&pThisUnk);

  if (SUCCEEDED(hr))
  {
    hr = pEnumVar->Init(&m_pVar[0], &m_pVar[m_nCount], pThisUnk, AtlFlagNoCopy);
  }
  if (SUCCEEDED(hr))
  {
    hr = pEnumVar->QueryInterface(IID_IEnumVARIANT, (void**)pVal);
    pThisUnk->Release();
  }
  if (FAILED(hr))
    delete pEnumVar;
  return hr;
}

void CResultset::Clear ( bool bDelete ) [inline]

Definition at line 21 of file resultset.h.

  {

    if (bDelete && m_pVar != NULL)
    {
      delete [] m_pVar;
    }

    for (int n = 0; n < m_nCount; n++)
    {
      m_pEntity[n]->Release();
    }

    m_pVar = NULL;
    m_nCount = 0;
    m_nAlloc = 0;
  }

STDMETHODIMP CResultset::Count ( long * pi4 )

Definition at line 24 of file resultset.Cpp.

{
  HRESULT hr = S_OK;

  *pCount = m_nCount;

  return hr;
}

void CResultset::DeleteEntity ( long nIndex )

Definition at line 157 of file resultset.Cpp.

{
  if (nIndex >= 0 && nIndex < m_nCount)
  {
    m_pEntity[nIndex]->Release();
//    delete m_pEntity[nIndex];
  }
}

STDMETHOD() CResultset::DisconnectObject ( DWORD dwReserved ) [inline]

Definition at line 109 of file resultset.h.

  {
    // Proxy and Object are not connected -- nothing to do
    return E_NOTIMPL;
  }

STDMETHODIMP CResultset::get_Record | ( | long | nIndex,
 |  | IEntityData ** | pVal
 | ) |  |

Definition at line 76 of file resultset.Cpp.

{
  HRESULT hr = S_OK;
  if (nIndex < 1)
  {
    hr = DISP_E_BADINDEX;
  }
  else
  {
    CStaticEntity *spEntity = GetEntity(nIndex - 1);

    if (spEntity->m_wszReadStoredProc == L"")
      spEntity->m_wszReadStoredProc = m_wszReadStoredProc;

    if (spEntity->m_wszUpdateStoredProc == L"")
      spEntity->m_wszUpdateStoredProc = m_wszUpdateStoredProc;

    if (spEntity->m_wszDeleteStoredProc == L"")
      spEntity->m_wszDeleteStoredProc = m_wszDeleteStoredProc;

    if (spEntity->m_wszInsertStoredProc == L"")
      spEntity->m_wszInsertStoredProc = m_wszInsertStoredProc;

    if (spEntity->m_wszKeyField == L"")
      spEntity->m_wszKeyField = m_wszKeyField;

    hr = spEntity->QueryInterface(IID_IEntityData, (void**)ppEntity);
  }
  return hr;
}

STDMETHOD() CResultset::GetClassID ( GUID * pClassID ) [inline]

Definition at line 118 of file resultset.h.

  {
    if (pClassID == NULL)
      return E_POINTER;

    *pClassID = GetObjectCLSID();

    return S_OK;
  }

CStaticEntity * CResultset::GetEntity ( long nIndex )

Definition at line 128 of file resultset.Cpp.

{
  CStaticEntity *pEntity = NULL;
  if (nIndex >= 0)
  {
    if (nIndex >= m_nCount)
    {
      m_nCount = nIndex + 1;
      m_pEntity[nIndex] = new CStaticEntity;
      m_pEntity[nIndex]->AddRef();
    }
    pEntity = m_pEntity[nIndex];
  }
  return pEntity;
}

STDMETHOD() CResultset::GetMarshalSizeMax | ( | REFIID | riid,
 |  | void * | pv,
 |  | DWORD | dwDestContext,
 |  | void * | pvDestContext,
 |  | DWORD | mshlFlags,
 |  | ULONG * | pSize |
 | ) |  |  | [inline]

Definition at line 73 of file resultset.h.

  {
    _ULARGE_INTEGER ul;
    HRESULT hr;

    ul.LowPart = 0;
    ul.HighPart = 0;
    hr = GetSizeMax(&ul);

    if (SUCCEEDED(hr))
      *pSize = ul.LowPart;

    return hr;
  }

STDMETHOD() CResultset::GetSizeMax ( _ULARGE_INTEGER * pCbSize ) [inline]

Definition at line 212 of file resultset.h.

  {
    if (pCbSize == NULL)
      return E_POINTER;

    HRESULT hr = S_OK;
    unsigned long nSize = 0;
    unsigned long nMarshalSize = 0;

    nSize += sizeof((long)COLLECTION_VERSION); // version
    nSize += sizeof(m_nCount); // count
    nSize += sizeof(m_nAlloc); // count

    CFastVariant update((LPCWSTR)m_wszUpdateStoredProc);
    CFastVariant read((LPCWSTR)m_wszReadStoredProc);
    CFastVariant insert((LPCWSTR)m_wszInsertStoredProc);
    CFastVariant deletesp((LPCWSTR)m_wszDeleteStoredProc);
    CFastVariant key((LPCWSTR)m_wszKeyField);

    nSize += GetVariantSize(update);
    nSize += GetVariantSize(insert);
    nSize += GetVariantSize(deletesp);
    nSize += GetVariantSize(read);
    nSize += GetVariantSize(key);

    for (int n = 0; (n < m_nCount && SUCCEEDED(hr)); n++)
    {
      CStaticEntity * spEntity = GetEntity(n);
      nSize += spEntity->GetPersistSize((bool)(n==0));
    }
    pCbSize->LowPart = nSize;
    return hr;
  }

STDMETHOD() CResultset::GetUnmarshalClass | ( | REFIID | riid,
 |  | void * | pv,
 |  | DWORD | dwDestContext,
 |  | void * | pvDestContext,
 |  | DWORD | mshlFlags,
 |  | CLSID * | pCid |
 | ) |  |  | [inline]

Definition at line 67 of file resultset.h.

  {
    *pCid = GetObjectCLSID();
    return S_OK;
  }

HRESULT CResultset::Initialise ( long nRows )

Definition at line 144 of file resultset.Cpp.

{
  m_nCount = 0;

  if (m_pVar != NULL)
  {
    delete [] m_pVar;
    m_pVar = NULL;
  }

  return S_OK;
}

STDMETHOD() CResultset::InitNew ( ) [inline]

Definition at line 246 of file resultset.h.

  {
    Clear(true);

    return S_OK;
  }

STDMETHODIMP CResultset::InterfaceSupportsErrorInfo ( REFIID riid )

Definition at line 10 of file resultset.Cpp.

{
  static const IID* arr[] =
  {
    &IID_IResultset
  };
  for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++)
  {
    if (::InlineIsEqualGUID(*arr[i],riid))
      return S_OK;
  }
  return S_FALSE;
}

STDMETHOD() CResultset::IsDirty ( void ) [inline]

Definition at line 128 of file resultset.h.

  {
    HRESULT hr = S_OK;

    return hr;
  }

STDMETHOD() CResultset::Load ( IStream * pStm ) [inline]

Definition at line 135 of file resultset.h.

  {
    long nSize = 0, nVer = 0, nCount;
    HRESULT hr = S_OK;
    CStaticEntity * spFirstEntity;

    *pStm >> (long)nVer; // version

    if (nVer < COLLECTION_VERSION)
      return STG_E_OLDFORMAT;

    *pStm >> nCount; // count
    *pStm >> m_nAlloc; // count

    *pStm >> m_wszUpdateStoredProc;
    *pStm >> m_wszReadStoredProc;
    *pStm >> m_wszDeleteStoredProc;
    *pStm >> m_wszInsertStoredProc;
    *pStm >> m_wszKeyField;

    if (nCount > 0)
      spFirstEntity = GetEntity(0);

    for (int n = 0; n < nCount && SUCCEEDED(hr); n++)
    {
      CStaticEntity * spEntity = GetEntity(n);
      hr = spEntity->LoadFromStream(pStm, (bool)(n==0));

      // Since we only copy one set of metadata for the whole resultset
      // copy that one set into each entity.
      if (n > 0)
      {
        long nFields, nField;

        hr = spFirstEntity->Count(&nFields);

        if (SUCCEEDED(hr))
        {
          for (nField = 0; nField < nFields; nField++)
          {
            spEntity->m_keyMap.m_aKey[nField] = spFirstEntity->m_keyMap.m_aKey[nField];
          }
          spEntity->m_wszUpdateStoredProc = m_wszUpdateStoredProc;
          spEntity->m_wszReadStoredProc = m_wszReadStoredProc;
          spEntity->m_wszDeleteStoredProc = m_wszDeleteStoredProc;
          spEntity->m_wszInsertStoredProc = m_wszInsertStoredProc;
          spEntity->m_wszKeyField = m_wszKeyField;
        }
      }
    }

    return hr;
  }

STDMETHOD() CResultset::MarshalInterface | ( | IStream * | pStm,
 |  | REFIID | riid,
 |  | void * | pv,
 |  | DWORD | dwDestContext,
 |  | void * | pvDestContext,
 |  | DWORD | mshlFlags |
 | ) |  |  | [inline]

Definition at line 88 of file resultset.h.

  {
    return Save(pStm, FALSE);
  }

STDMETHOD() CResultset::ReleaseMarshalData ( IStream * pStm ) [inline]

Definition at line 104 of file resultset.h.

  {
    return E_NOTIMPL;
  }

STDMETHOD() CResultset::Save | ( | IStream * | pStm,
 |  | int | fClearDirty |
 | ) |  |  | [inline]

Definition at line 189 of file resultset.h.

  {
    long nSize = 0;
    HRESULT hr = S_OK;

    *pStm << (long)COLLECTION_VERSION; // version
    *pStm << m_nCount; // count
    *pStm << m_nAlloc; // count

    *pStm << (LPCWSTR)m_wszUpdateStoredProc;
    *pStm << (LPCWSTR)m_wszReadStoredProc;
    *pStm << (LPCWSTR)m_wszDeleteStoredProc;
    *pStm << (LPCWSTR)m_wszInsertStoredProc;
    *pStm << (LPCWSTR)m_wszKeyField;

    for (int n = 0; (n < m_nCount && SUCCEEDED(hr)); n++)
    {
      CStaticEntity * spEntity = GetEntity(n);
      hr = spEntity->SaveToStream(pStm, FALSE, (bool)(n==0));
    }
    return hr;
  }

void CResultset::SetCount ( long nCount )

Definition at line 166 of file resultset.Cpp.

{
  m_nCount = nCount;
}

STDMETHOD() CResultset::UnmarshalInterface | ( | IStream * | pStm,
 |  | REFIID | riid,
 |  | void ** | ppv |
 | ) |  |  | [inline]

Definition at line 93 of file resultset.h.

  {
    HRESULT hr = Load(pStm);

    if (SUCCEEDED(hr))
    {
      hr = QueryInterface(riid, ppv);
    }
    return hr;
  }

Member Data Documentation

long CResultset::m_nAlloc

Definition at line 258 of file resultset.h.

long CResultset::m_nCount

Definition at line 257 of file resultset.h.

CStaticEntity* CResultset::m_pEntity[ENTITY_BANKS *ENTITY_PER_BANK]

Definition at line 255 of file resultset.h.

CFastVariant* CResultset::m_pVar

Definition at line 256 of file resultset.h.

CString CResultset::m_wszDeleteStoredProc

Definition at line 262 of file resultset.h.

CString CResultset::m_wszInsertStoredProc

Definition at line 263 of file resultset.h.

CString CResultset::m_wszKeyField

Definition at line 264 of file resultset.h.

CString CResultset::m_wszReadStoredProc

Definition at line 260 of file resultset.h.

CString CResultset::m_wszUpdateStoredProc

Definition at line 261 of file resultset.h.

The documentation for this class was generated from the following files:
  • Com/Tools/EntityProxy/DataServices/resultset.h
  • Com/Tools/EntityProxy/DataServices/resultset.Cpp
Generated on Wed Nov 13 2024 16:57:11 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CRichEditLite Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CRichEditLite Class Reference

#include "cdialoglite.h"

Inherits CEditBoxLite, and CConsole.

Inherited by CInitStringBox, CIntTrace, and CQueryBox.

List of all members.

Public Member Functions

CRichEditLite (HWND hWndParent=NULL, UINT nID=0)
virtual | ~CRichEditLite ()
virtual void | Append (LPCWSTR pwszString, bool bCanUndo=TRUE, DWORD dwMask=0, DWORD dwColor=0)
virtual BOOL | FindNext (DWORD dwFindFlags, WCHAR *pwszText)
virtual INDEX | FindText (DWORD dwFindFlags, FINDTEXTEXW *pFINDTEXT)
virtual BOOL | GetSel (INDEX *piMin, INDEX *piMax)
virtual BOOL | GetSel (CHARRANGE *pcr)
WCHAR * | GetSelectedText (BOOL fEntireLine=TRUE)
INDEX | LineFromChar (INDEX nIndex)
virtual BOOL | OnCreate (CREATESTRUCT *pCREATESTRUCT)
virtual BOOL | OnLink (INT idCtrl, ENLINK *pEnLink)
virtual BOOL | OnNotify (INT idCtrl, NMHDR *pNMHDR)
virtual void | ReplaceSel (LPCWSTR pwszString, bool bCanUndo)
virtual void | ReplaceSel (LPCWSTR pwszString, bool bCanUndo, DWORD dwMask, DWORD dwColor)
BOOL | SetCharFormat (DWORD dwMask, CHARFORMATW &charFormatW)
virtual void | SetColor (COLORREF refColor)
virtual void | SetColorAttrib (COLORA attColor, BOOL fEnable=TRUE)
LRESULT | SetDefaultFont ()
BOOL | SetEffects (DWORD dwMask, DWORD dwEffects, COLORREF crTextColor)
virtual void | SetSel (INDEX iMin, INDEX iMax)
virtual BOOL | SetWordWrap (BOOL fWordWrap)
virtual HRESULT | Write (LPCWSTR pwszText)

Detailed Description

Definition at line 550 of file cdialoglite.h.

Constructor & Destructor Documentation

CRichEditLite::CRichEditLite | ( | HWND | hWndParent = NULL,
 |  | UINT | nID = 0
 | ) |  |

Definition at line 2557 of file cdialoglite.cpp.

  : CEditBoxLite(hWndParent, nID)
{
}

CRichEditLite::~CRichEditLite ( ) [virtual]

Definition at line 2567 of file cdialoglite.cpp.

{
}

Member Function Documentation

void CRichEditLite::Append | ( | LPCWSTR | pwszString,
 |  | bool | bCanUndo = TRUE,
 |  | DWORD | dwMask = 0,
 |  | DWORD | dwColor = 0 |
 | ) |  |  | [virtual]

Definition at line 2709 of file cdialoglite.cpp.

{
  //Move the position to the end
  SetSel(LONG_MAX, LONG_MAX);

  //Delegate
  ReplaceSel(pwszString, bCanUndo, dwMask, dwColor);
}

BOOL CRichEditLite::FindNext | ( | DWORD | dwFindFlags,
 |  | WCHAR * | pwszText |
 | ) |  |  | [virtual]

Definition at line 2880 of file cdialoglite.cpp.

{
  //Obtain the Current Position of the 'caret'
  CHARRANGE chrg;
  GetSel(&chrg);
  BOOL fForward = (dwFindFlags & FR_DOWN);

  //This now is the "next" or "previous" positions to search from...
  //NOTE: We have to use "Min" on backward searching otherwise it will continue to find
  //the selected word over and over...
  chrg.cpMin  = fForward ? chrg.cpMax : chrg.cpMin;
  chrg.cpMax  = fForward ? LONG_MAX : 0;

  FINDTEXTEXW findTextEx;
  findTextEx.chrg     = chrg;
  findTextEx.lpstrText  = pwszText;

  //First search from the point specified to the bottom (if forward)
  INDEX iPos = FindText(dwFindFlags, &findTextEx);
  if(iPos == -1)
  {
    //If not found, then switch to start from the begining (if forward) to the org starting point.
    findTextEx.chrg.cpMin  = fForward ? 0 : LONG_MAX;
    findTextEx.chrg.cpMax  = chrg.cpMax;

    //Search
    iPos = FindText(dwFindFlags, &findTextEx);
  }

  if(iPos != -1)
  {
    //Found a match, Select it...
    SetSel(findTextEx.chrgText.cpMin, findTextEx.chrgText.cpMax);
    return TRUE;
  }

  //Otherwise, not found
  return FALSE;
}

INDEX CRichEditLite::FindText | ( | DWORD | dwFindFlags,
 |  | FINDTEXTEXW * | pFINDTEXT |
 | ) |  |  | [virtual]

Definition at line 2846 of file cdialoglite.cpp.

{
  INDEX lPos = -1;

  if(IsUnicodeOS())
  {
    //EM_FINDTEXT
    lPos = SendMessageW(m_hWnd, EM_FINDTEXTEXW, dwFindFlags, (LPARAM)pFindTextW);
  }
  else
  {
    CHAR szBuffer[MAX_NAME_LEN];
    ConvertToMBCS(pFindTextW->lpstrText, szBuffer, MAX_NAME_LEN);

    //Input Args
    FINDTEXTEXA FindTextA;
    FindTextA.chrg      = pFindTextW->chrg;
    FindTextA.lpstrText   = szBuffer;

    //EM_FINDTEXT
    lPos = SendMessageA(m_hWnd, EM_FINDTEXTEX, dwFindFlags, (LPARAM)&FindTextA);

    //Output Params
    pFindTextW->chrgText  = FindTextA.chrgText;
  }

  return lPos;
}

virtual BOOL CRichEditLite::GetSel ( CHARRANGE * pcr ) [inline, virtual]

Definition at line 604 of file cdialoglite.h.

{ ASSERT(pcr); SendMessageA(m_hWnd, EM_EXGETSEL, 0, (LPARAM)pcr); return pcr->cpMin != pcr->cpMax;  }

virtual BOOL CRichEditLite::GetSel | ( | INDEX * | piMin,
 |  | INDEX * | piMax |
 | ) |  |  | [inline, virtual]

Definition at line 603 of file cdialoglite.h.

{ CHARRANGE cr; BOOL bReturn = GetSel(&cr); if(piMin) *piMin = cr.cpMin;  if(piMax) *piMax = cr.cpMax; return bReturn;    }

WCHAR * CRichEditLite::GetSelectedText ( BOOL fEntireLine = TRUE )

Definition at line 2723 of file cdialoglite.cpp.

{
  INDEX cpMin = 0;
  INDEX cpMax = 0;
  WCHAR* pwsz = NULL;
  HRESULT hr = S_OK;

  //Obtain the EditBox text (rules below).
  //  1.  First try to obtain whatever text is highlighted (even multiline highlight)
  //  2.  Or if nothing is highlighted take the entire line of the cursor

  //Obtain the Selected Text Start and End Positions
  GetSel(&cpMin, &cpMax);

  //If there is no selected Text
  //Just get the entire line, as if it were highlighted...
  if(cpMin == cpMax)
  {
    //Obtain the first character of the selected line...
    INDEX iCharIndex = LineIndex(-1);
    INDEX iLineLength = LineLength(cpMin);

    if(fEntireLine)
    {
      cpMin = (LONG)iCharIndex;
      cpMax = (LONG)(iCharIndex + iLineLength);
    }

    //Obtain the current word, if nothing is selected...
    if(cpMin == cpMax)
    {
      //TODO
/*      //Find the begining of the whole word that the cursor is over...
      while(cpMin > iCharIndex)
      {
        if(!iswalnum(pwsz[cpMin - iCharIndex - 1]))
          break;
        cpMin--;
      }

      //Find the ending of the whole word that the cursor is over...
      while(cpMax < (iCharIndex + iLineLength))
      {
        if(!iswalnum(pwsz[cpMax - iCharIndex]))
          break;
        cpMax++;
      }
*/    }

    //Highlight the text we used...
    SetSel(cpMin, cpMax);
  }

  //Now that we have a selection...
  ASSERT(cpMax>=cpMin && cpMax>=0 && cpMin>=0);

  //Simple, just obtain the selected text...
  INDEX iMaxChars = (cpMax-cpMin+1)+1;

  //Allocate a buffer large enough to hold all the text...
  //NOTE:  We pass in the length to wSendMessage so it knows the conversion length...
  SAFE_ALLOC(pwsz, WCHAR, iMaxChars);
  wSendMessage(m_hWnd, EM_GETSELTEXT, iMaxChars, pwsz);

CLEANUP:
  return pwsz;
}

INDEX CRichEditLite::LineFromChar ( INDEX nIndex ) [inline]

Definition at line 607 of file cdialoglite.h.

{ return (INDEX)SendMessage(m_hWnd, EM_EXLINEFROMCHAR, 0, nIndex);      }

BOOL CRichEditLite::OnCreate ( CREATESTRUCT * pCREATESTRUCT ) [virtual]

Definition at line 2576 of file cdialoglite.cpp.

{
  //URL detection
  SendMessage(m_hWnd, EM_AUTOURLDETECT, TRUE, 0);
  SendMessage(m_hWnd, EM_SETEVENTMASK, 0, ENM_LINK);

  //Delegate
  return CEditBoxLite::OnCreate(pCREATESTRUCT);
}

BOOL CRichEditLite::OnLink | ( | INT | idCtrl,
 |  | ENLINK * | pEnLink |
 | ) |  |  | [virtual]

Definition at line 2646 of file cdialoglite.cpp.

{
  //Default Implementation of OnLink, of actually executing the link...
  if(pEnLink)
  {
    switch(pEnLink->msg)
    {
      case WM_LBUTTONDOWN:
      {
        //Obtain the link text.
        if(pEnLink->chrg.cpMax - pEnLink->chrg.cpMin <= MAX_QUERY_LEN)
        {
          CWaitCursor waitCursor;
          if(IsUnicodeOS())
          {
            WCHAR wszLink[MAX_QUERY_LEN] = {0};
            GetTextRange(pEnLink->chrg, wszLink);

            //ShellExecute returns a value greater than 32 is successful (nice design!)
            //NOTE: ShellExecute returns a HINSTANCE, (for backard compatibility), but really this is a LONG
            return (LONG_PTR)ShellExecuteW(m_hWnd, L"open", wszLink, NULL, NULL, SW_SHOWNORMAL) > 32;
          }
          else
          {
            CHAR szLink[MAX_QUERY_LEN] = {0};
            GetTextRange(pEnLink->chrg, szLink);

            //ShellExecute returns a value greater than 32 is successful (nice design!)
            //NOTE: ShellExecute returns a HINSTANCE, (for backard compatibility), but really this is a LONG
            return (LONG_PTR)ShellExecuteA(m_hWnd, "open", szLink, NULL, NULL, SW_SHOWNORMAL) > 32;
          }
        }
      }
    };
  }

  return FALSE;
}

BOOL CRichEditLite::OnNotify | ( | INT | idCtrl,
 |  | NMHDR * | pNMHDR |
 | ) |  |  | [virtual]

Definition at line 2630 of file cdialoglite.cpp.

{
  switch(pNMHDR->code)
  {
    ON_COMMAND(EN_LINK, OnLink(idCtrl, (ENLINK*)pNMHDR));
  };

  //Delegate
  return CEditBoxLite::OnNotify(idCtrl, pNMHDR);
}

virtual void CRichEditLite::ReplaceSel | ( | LPCWSTR | pwszString,
 |  | bool | bCanUndo |
 | ) |  |  | [inline, virtual]

Definition at line 612 of file cdialoglite.h.

{ wSendMessage(m_hWnd, EM_REPLACESEL, (WPARAM)bCanUndo, (WCHAR*)pwszString);  }

void CRichEditLite::ReplaceSel | ( | LPCWSTR | pwszString,
 |  | bool | bCanUndo,
 |  | DWORD | dwMask,
 |  | DWORD | dwColor |
 | ) |  |  | [virtual]

Definition at line 2690 of file cdialoglite.cpp.

{
  //Change to bold and/or color
  if(dwMask)
    SetEffects(dwMask, dwMask & CFM_BOLD ? CFE_BOLD : 0, dwColor);

  //Delegate
  ReplaceSel(pwszString, bCanUndo);

  //Change back
  if(dwMask)
    SetEffects(dwMask, CFE_AUTOCOLOR, 0);
}

BOOL CRichEditLite::SetCharFormat | ( | DWORD | dwMask,
 |  | CHARFORMATW & | charFormatW
 | ) |  |

Definition at line 2813 of file cdialoglite.cpp.

{
  //Unfortunatly the RichEdit20W requires a CHARFORMATW structure (size) to be passed in
  //and will ignore the CHARFORMATA size, and the same is true for RichEdit20A with CHARFORMATA.
  //This is a unique structure in that this is not a pointer to a string szFaceName, but the
  //string buffer is a part of the structure, making cbSize different.  Even though we don't
  //have the maks indicating the face name is valid, it still does validation and will ignore
  //any mismatched size with the use of the control...

  if(IsUnicodeOS())
  {
    return (BOOL)SendMessageW(m_hWnd, EM_SETCHARFORMAT, dwMask, (LPARAM)&charFormatW);
  }
  else
  {
    //Convert the CHARFORMATW to CHARFORMATA
    CHARFORMATA charFormatA;
    memcpy(&charFormatA, &charFormatW, sizeof(CHARFORMATA));
    charFormatA.cbSize = sizeof(CHARFORMATA);

    //Convert the Unicode inline string to MBCS
    ConvertToMBCS(charFormatW.szFaceName, charFormatA.szFaceName, LF_FACESIZE);
    return (BOOL)SendMessageA(m_hWnd, EM_SETCHARFORMAT, dwMask, (LPARAM)&charFormatA);
  }
}

virtual void CRichEditLite::SetColor ( COLORREF refColor ) [inline, virtual]

Reimplemented from CConsole.

Definition at line 571 of file cdialoglite.h.

  {
    if(refColor == RGB_NONE)
    {
      //Restore color
      SetEffects(CFM_COLOR, CFE_AUTOCOLOR, 0);
    }
    else
    {
      //Change color
      SetEffects(CFM_COLOR, 0, refColor);
    }
  }

virtual void CRichEditLite::SetColorAttrib | ( | COLORA | attColor,
 |  | BOOL | fEnable = TRUE |
 | ) |  |  | [inline, virtual]

Reimplemented from CConsole.

Definition at line 584 of file cdialoglite.h.

  {
    if(attColor == CA_NORMAL)
    {
      //Restore (all) Attributes
      //NOTE: Just simply using ULONG_MAX as the mask causes problems since
      //other things (ie: charset, etc) are also affected...
      SetEffects(CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_STRIKEOUT | CFM_PROTECTED | CFM_LINK, 0, 0);
    }
    else
    {
      //Change Attributes
      SetEffects(attColor, fEnable ? attColor : ~attColor, 0);
    }
  }

LRESULT CRichEditLite::SetDefaultFont ( )

Definition at line 2604 of file cdialoglite.cpp.

{
  //Default Font
  //If you wise not to replace the font with this default, then just
  //set cbSize = 0 before calling ::Create.
  CHARFORMATW charFormat;
  memset(&charFormat, 0, sizeof(CHARFORMATW));
  charFormat.cbSize   = sizeof(CHARFORMATW);
  charFormat.dwMask   = CFM_SIZE | CFM_COLOR | CFM_FACE | CFM_OFFSET | CFM_CHARSET | CFM_LINK | CFM_PROTECTED | CFM_STRIKEOUT | CFM_UNDERLINE | CFM_ITALIC | CFM_BOLD;
  charFormat.dwEffects  = CFE_AUTOCOLOR;
  charFormat.yHeight    = 0x60;
  StringCopy(charFormat.szFaceName, L"MS Sans Serif", LF_FACESIZE);

  //By default the font for RichEdit controls is HUGE!  By default we will replace
  //the font with the default for Edit Controls which is Sans-Serif size 8...
  if(charFormat.cbSize)
    return SetCharFormat(SCF_ALL, charFormat);

  return 0;
}

BOOL CRichEditLite::SetEffects | ( | DWORD | dwMask,
 |  | DWORD | dwEffects,
 |  | COLORREF | crTextColor
 | ) |  |

Definition at line 2798 of file cdialoglite.cpp.

{
  CHARFORMATW charFormat;
  charFormat.cbSize   = sizeof(CHARFORMATW);
  charFormat.dwMask   = dwMask;
  charFormat.dwEffects  = dwEffects;
  charFormat.crTextColor  = crTextColor;
  return SetCharFormat(SCF_SELECTION, charFormat);
}

virtual void CRichEditLite::SetSel | ( | INDEX | iMin,
 |  | INDEX | iMax |
 | ) |  |  | [inline, virtual]

Definition at line 602 of file cdialoglite.h.

{ CHARRANGE cr = { (LONG)iMin, (LONG)iMax }; SendMessage(m_hWnd, EM_EXSETSEL, 0, (LPARAM)&cr);  }

BOOL CRichEditLite::SetWordWrap ( BOOL fWordWrap ) [virtual]

Definition at line 2591 of file cdialoglite.cpp.

{
  //WordWrap
  // 0 - Wrap to window
  // 1 - Do not wrap lines
  return (BOOL)SendMessage(m_hWnd, EM_SETTARGETDEVICE, (WPARAM)NULL, fWordWrap ? 0 : 1);
}

virtual HRESULT CRichEditLite::Write ( LPCWSTR pwszText ) [inline, virtual]

Implements CConsole.

Definition at line 566 of file cdialoglite.h.

  {
    Append(pwszText);
    return S_OK;
  }

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialoglite.h
  • Dataaccess/oledb/rowsetviewer/cdialoglite.cpp
Generated on Wed Nov 13 2024 16:57:11 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CRocket Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Types | Static Private Member Functions | Private Attributes | Static Private Attributes

CRocket Class Reference

#include "space.h"

Inherits CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, and CDelegationBase.

List of all members.

Public Member Functions

CRocket (CComponentData *pComponentData=NULL)
CRocket (CSpaceStation *pSpaceStation, _TCHAR *szName, int id, LONG lWeight, LONG lHeight, LONG lPayload)
CRocket (_TCHAR *szName, int id, LONG lWeight, LONG lHeight, LONG lPayload)
CRocket (_TCHAR *szName, int id, LONG lWeight, LONG lHeight, LONG lPayload)
CRocket (_TCHAR *szName, int id, LONG lWeight, LONG lHeight, LONG lPayload)
CRocket (_TCHAR *szName, int id, LONG lWeight, LONG lHeight, LONG lPayload)
CRocket ()
CRocket ()
CRocket (_TCHAR *szName, int id, LONG lWeight, LONG lHeight, LONG lPayload)
CRocket (CComponentData *pComponentData=NULL)
CRocket (_TCHAR *szName, int id, LONG lWeight, LONG lHeight, LONG lPayload, CSpaceVehicle *pParent)
CRocket (CSpaceStation *pSpaceStation, _TCHAR *szName, int id, LONG lWeight, LONG lHeight, LONG lPayload)
CRocket (_TCHAR *szName, int id, LONG lWeight, LONG lHeight, LONG lPayload)
virtual | ~CRocket ()
virtual | ~CRocket ()
virtual | ~CRocket ()
virtual | ~CRocket ()
virtual | ~CRocket ()
virtual | ~CRocket ()
virtual | ~CRocket ()
virtual | ~CRocket ()
virtual | ~CRocket ()
virtual | ~CRocket ()
virtual | ~CRocket ()
virtual | ~CRocket ()
virtual | ~CRocket ()
virtual HRESULT | CreatePropertyPages (IPropertySheetCallback *lpProvider, LONG_PTR handle)
virtual HRESULT | CreatePropertyPages (IPropertySheetCallback *lpProvider, LONG_PTR handle)
virtual HRESULT | CreatePropertyPages (IPropertySheetCallback *lpProvider, LONG_PTR handle)
virtual HRESULT | CreatePropertyPages (IPropertySheetCallback *lpProvider, LONG_PTR handle)
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
BOOL getDeletedStatus ()
BOOL getDeletedStatus ()
BOOL getDeletedStatus ()
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
int | GetId ()
virtual HMENU | GetMenu (int nMenuId)
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
CSpaceStation * GetParent ()
virtual HRESULT | GetWatermarks (HBITMAP *lphWatermark, HBITMAP *lphHeader, HPALETTE *lphPalette, BOOL *bStretch)
virtual HRESULT | GetWatermarks (HBITMAP *lphWatermark, HBITMAP *lphHeader, HPALETTE *lphPalette, BOOL *bStretch)
virtual HRESULT | GetWatermarks (HBITMAP *lphWatermark, HBITMAP *lphHeader, HPALETTE *lphPalette, BOOL *bStretch)
virtual HRESULT | GetWatermarks (HBITMAP *lphWatermark, HBITMAP *lphHeader, HPALETTE *lphPalette, BOOL *bStretch)
virtual HRESULT | HasPropertySheets ()
virtual HRESULT | HasPropertySheets ()
virtual HRESULT | HasPropertySheets ()
virtual HRESULT | HasPropertySheets ()
void | Initialize (_TCHAR *szName, LONG lWeight, LONG lHeight, LONG lPayload)
void | Initialize (_TCHAR *szName, LONG lWeight, LONG lHeight, LONG lPayload)
void | Initialize (_TCHAR *szName, LONG lWeight, LONG lHeight, LONG lPayload)
void | Initialize (_TCHAR *szName, LONG lWeight, LONG lHeight, LONG lPayload)
virtual HRESULT | OnAddMenuItems (IContextMenuCallback *pContextMenuCallback, long *pInsertionsAllowed)
virtual HRESULT | OnButtonClicked (CComponent *pComponent)
virtual HRESULT | OnDelete (IConsole *pConsole)
virtual HRESULT | OnDelete (IConsole *pConsole)
virtual HRESULT | OnDelete (IConsole *pConsoleComp)
virtual HRESULT | OnMenuButtonCommand (IConsole *pConsole, int nMenuId, long lCommandID)
virtual HRESULT | OnMenuCommand (IConsole *pConsole, long lCommandID)
virtual HRESULT | OnPropertyChange (IConsole *pConsole)
virtual HRESULT | OnPropertyChange (IConsole *pConsole, CComponent *pComponent)
virtual HRESULT | OnPropertyChange (IConsole *pConsole)
virtual HRESULT | OnRefresh (IConsole *pConsole)
virtual HRESULT | OnRefresh (IConsole *pConsole)
virtual HRESULT | OnRefresh (IConsole *pConsole)
virtual HRESULT | OnRename (LPOLESTR pszNewName)
virtual HRESULT | OnRename (LPOLESTR pszNewName)
virtual HRESULT | OnRename (LPOLESTR pszNewName)
virtual HRESULT | OnRename (LPOLESTR pszNewName)
virtual HRESULT | OnRename (LPOLESTR pszNewName)
virtual HRESULT | OnRename (LPOLESTR pszNewName)
virtual HRESULT | OnRename (LPOLESTR pszNewName)
virtual HRESULT | OnRename (LPOLESTR pszNewName)
virtual HRESULT | OnRename (LPOLESTR pszNewName)
virtual HRESULT | OnSelect (IConsole *pConsole, BOOL bScope, BOOL bSelect)
virtual HRESULT | OnSelect (IConsole *pConsole, BOOL bScope, BOOL bSelect)
virtual HRESULT | OnSelect (IConsole *pConsole, BOOL bScope, BOOL bSelect)
virtual HRESULT | OnSelect (IConsole *pConsole, BOOL bScope, BOOL bSelect)
virtual HRESULT | OnSelect (IConsole *pConsole, BOOL bScope, BOOL bSelect)
virtual HRESULT | OnSelect (CComponent *pComponent, BOOL bScope, BOOL bSelect)
virtual HRESULT | OnSelect (CComponent *pComponent, IConsole *pConsole, BOOL bScope, BOOL bSelect)
virtual HRESULT | OnSelect (IConsole *pConsole, BOOL bScope, BOOL bSelect)
virtual HRESULT | OnSelect (IConsole *pConsole, BOOL bScope, BOOL bSelect)
virtual HRESULT | OnSelect (IConsole *pConsole, BOOL bScope, BOOL bSelect)
virtual HRESULT | OnSetMenuButton (IConsole *pConsole, MENUBUTTONDATA *pmbd)
virtual HRESULT | OnSetToolbar (CComponent *pComponent, IControlbar *pControlbar, IToolbar *pToolbar, BOOL bScope, BOOL bSelect)
virtual HRESULT | OnSetToolbar (IControlbar *pControlbar, IToolbar *pToolbar, BOOL bScope, BOOL bSelect)
virtual HRESULT | OnToolbarCommand (CComponent *pComponent, IConsole *pConsole, MMC_CONSOLE_VERB verb)
virtual HRESULT | OnToolbarCommand (IConsole *pConsole, MMC_CONSOLE_VERB verb, IDataObject *pDataObject)
virtual HRESULT | OnUpdateItem (IConsole *pConsole, long item, ITEM_TYPE itemtype)
virtual HRESULT | OnUpdateItem (IConsole *pConsole, long item, ITEM_TYPE itemtype)
virtual HRESULT | OnUpdateItem (IConsole *pConsole, long item, ITEM_TYPE itemtype)
void | setDeletedStatus (BOOL status)
void | setDeletedStatus (BOOL status)
virtual HRESULT | SetMenuState (IControlbar *pControlbar, IMenuButton *pMenuButton, BOOL bScope, BOOL bSelect)

Private Types

enum | { RUNNING, PAUSED, STOPPED }
enum | { RUNNING, PAUSED, STOPPED }
enum | { IDM_START_SPACE = 100, IDM_PAUSE_SPACE, IDM_STOP_SPACE }
enum | { RUNNING, PAUSED, STOPPED }
enum | { RUNNING, PAUSED, STOPPED }
enum | { RUNNING, PAUSED, STOPPED }
enum | { RUNNING, PAUSED, STOPPED }
enum ROCKET_STATUS {
RUNNING, PAUSED, STOPPED, RUNNING,
PAUSED, STOPPED, RUNNING, PAUSED,
STOPPED, RUNNING, PAUSED, STOPPED,
RUNNING, PAUSED, STOPPED, RUNNING,
PAUSED, STOPPED, RUNNING, PAUSED,
STOPPED
}
enum ROCKET_STATUS {
RUNNING, PAUSED, STOPPED, RUNNING,
PAUSED, STOPPED, RUNNING, PAUSED,
STOPPED, RUNNING, PAUSED, STOPPED,
RUNNING, PAUSED, STOPPED, RUNNING,
PAUSED, STOPPED, RUNNING, PAUSED,
STOPPED
}
enum ROCKET_STATUS {
RUNNING, PAUSED, STOPPED, RUNNING,
PAUSED, STOPPED, RUNNING, PAUSED,
STOPPED, RUNNING, PAUSED, STOPPED,
RUNNING, PAUSED, STOPPED, RUNNING,
PAUSED, STOPPED, RUNNING, PAUSED,
STOPPED
}
enum ROCKET_STATUS {
RUNNING, PAUSED, STOPPED, RUNNING,
PAUSED, STOPPED, RUNNING, PAUSED,
STOPPED, RUNNING, PAUSED, STOPPED,
RUNNING, PAUSED, STOPPED, RUNNING,
PAUSED, STOPPED, RUNNING, PAUSED,
STOPPED
}
enum ROCKET_STATUS {
RUNNING, PAUSED, STOPPED, RUNNING,
PAUSED, STOPPED, RUNNING, PAUSED,
STOPPED, RUNNING, PAUSED, STOPPED,
RUNNING, PAUSED, STOPPED, RUNNING,
PAUSED, STOPPED, RUNNING, PAUSED,
STOPPED
}
enum ROCKET_STATUS {
RUNNING, PAUSED, STOPPED, RUNNING,
PAUSED, STOPPED, RUNNING, PAUSED,
STOPPED, RUNNING, PAUSED, STOPPED,
RUNNING, PAUSED, STOPPED, RUNNING,
PAUSED, STOPPED, RUNNING, PAUSED,
STOPPED
}
enum ROCKET_STATUS {
RUNNING, PAUSED, STOPPED, RUNNING,
PAUSED, STOPPED, RUNNING, PAUSED,
STOPPED, RUNNING, PAUSED, STOPPED,
RUNNING, PAUSED, STOPPED, RUNNING,
PAUSED, STOPPED, RUNNING, PAUSED,
STOPPED
}

Static Private Member Functions

static BOOL CALLBACK | DialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
static BOOL CALLBACK | DialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
static BOOL CALLBACK | DialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
static BOOL CALLBACK | DialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)

Private Attributes

friend | CSpaceStation
BOOL isDeleted
enum CRocket:: { ... } | iStatus
enum CRocket:: { ... } | iStatus
enum CRocket:: { ... } | iStatus
enum CRocket:: { ... } | iStatus
enum CRocket::ROCKET_STATUS | iStatus
enum CRocket:: { ... } | iStatus
enum CRocket:: { ... } | iStatus
LONG | lHeight
LONG | lPayload
LONG | lWeight
CSpaceVehicle * m_pParent
LONG_PTR | m_ppHandle
CSpaceStation * m_pSpaceStation
int | nId
_TCHAR * | szName

Static Private Attributes

static const GUID | thisGuid = { 0x29743811, 0x4c4b, 0x11d2, { 0x89, 0xd8, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28 } }

Detailed Description

Definition at line 26 of file space.h.

Member Enumeration Documentation

anonymous enum [private]
Enumerator:
RUNNING
PAUSED
STOPPED

Definition at line 46 of file space.h.

{RUNNING, PAUSED, STOPPED} iStatus;

anonymous enum [private]
Enumerator:
RUNNING
PAUSED
STOPPED

Definition at line 51 of file space.h.

{RUNNING, PAUSED, STOPPED} iStatus;

anonymous enum [private]
Enumerator:
IDM_START_SPACE
IDM_PAUSE_SPACE
IDM_STOP_SPACE

Definition at line 52 of file space.h.

{ IDM_START_SPACE = 100, IDM_PAUSE_SPACE, IDM_STOP_SPACE };

anonymous enum [private]
Enumerator:
RUNNING
PAUSED
STOPPED

Definition at line 48 of file space.h.

{RUNNING, PAUSED, STOPPED} iStatus;

anonymous enum [private]
Enumerator:
RUNNING
PAUSED
STOPPED

Definition at line 54 of file space.h.

{RUNNING, PAUSED, STOPPED} iStatus;

anonymous enum [private]
Enumerator:
RUNNING
PAUSED
STOPPED

Definition at line 48 of file space.h.

{RUNNING, PAUSED, STOPPED} iStatus;

anonymous enum [private]
Enumerator:
RUNNING
PAUSED
STOPPED

Definition at line 53 of file space.h.

{RUNNING, PAUSED, STOPPED} iStatus;

enum CRocket::ROCKET_STATUS [private]
Enumerator:
RUNNING
PAUSED
STOPPED
RUNNING
PAUSED
STOPPED
RUNNING
PAUSED
STOPPED
RUNNING
PAUSED
STOPPED
RUNNING
PAUSED
STOPPED
RUNNING
PAUSED
STOPPED
RUNNING
PAUSED
STOPPED

Definition at line 64 of file space.h.

{RUNNING, PAUSED, STOPPED} iStatus;

enum CRocket::ROCKET_STATUS [private]
Enumerator:
RUNNING
PAUSED
STOPPED
RUNNING
PAUSED
STOPPED
RUNNING
PAUSED
STOPPED
RUNNING
PAUSED
STOPPED
RUNNING
PAUSED
STOPPED
RUNNING
PAUSED
STOPPED
RUNNING
PAUSED
STOPPED

Definition at line 55 of file space.h.

{RUNNING, PAUSED, STOPPED} iStatus;

enum CRocket::ROCKET_STATUS [private]
Enumerator:
RUNNING
PAUSED
STOPPED
RUNNING
PAUSED
STOPPED
RUNNING
PAUSED
STOPPED
RUNNING
PAUSED
STOPPED
RUNNING
PAUSED
STOPPED
RUNNING
PAUSED
STOPPED
RUNNING
PAUSED
STOPPED

Definition at line 57 of file space.h.

{RUNNING, PAUSED, STOPPED} iStatus;

enum CRocket::ROCKET_STATUS [private]
Enumerator:
RUNNING
PAUSED
STOPPED
RUNNING
PAUSED
STOPPED
RUNNING
PAUSED
STOPPED
RUNNING
PAUSED
STOPPED
RUNNING
PAUSED
STOPPED
RUNNING
PAUSED
STOPPED
RUNNING
PAUSED
STOPPED

Definition at line 61 of file space.h.

{RUNNING, PAUSED, STOPPED} iStatus;

enum CRocket::ROCKET_STATUS [private]
Enumerator:
RUNNING
PAUSED
STOPPED
RUNNING
PAUSED
STOPPED
RUNNING
PAUSED
STOPPED
RUNNING
PAUSED
STOPPED
RUNNING
PAUSED
STOPPED
RUNNING
PAUSED
STOPPED
RUNNING
PAUSED
STOPPED

Definition at line 70 of file space.h.

{RUNNING, PAUSED, STOPPED} iStatus;

enum CRocket::ROCKET_STATUS [private]
Enumerator:
RUNNING
PAUSED
STOPPED
RUNNING
PAUSED
STOPPED
RUNNING
PAUSED
STOPPED
RUNNING
PAUSED
STOPPED
RUNNING
PAUSED
STOPPED
RUNNING
PAUSED
STOPPED
RUNNING
PAUSED
STOPPED

Definition at line 48 of file space.h.

{RUNNING, PAUSED, STOPPED} iStatus;

enum CRocket::ROCKET_STATUS [private]
Enumerator:
RUNNING
PAUSED
STOPPED
RUNNING
PAUSED
STOPPED
RUNNING
PAUSED
STOPPED
RUNNING
PAUSED
STOPPED
RUNNING
PAUSED
STOPPED
RUNNING
PAUSED
STOPPED
RUNNING
PAUSED
STOPPED

Definition at line 57 of file space.h.

{RUNNING, PAUSED, STOPPED} iStatus;

Constructor & Destructor Documentation

CRocket::CRocket ( CComponentData * pComponentData = NULL )

Definition at line 113 of file space.Cpp.

: szName(NULL), lWeight(0), lHeight(0), lPayload(0), iStatus(STOPPED)
{
    m_pComponentData = pComponentData;
}

CRocket::~CRocket ( ) [virtual]

Definition at line 119 of file space.Cpp.

{
    if (szName)
        delete [] szName;
}

CRocket::CRocket ( )

Definition at line 152 of file space.Cpp.

: szName(NULL), lWeight(0), lHeight(0), lPayload(0), iStatus(STOPPED)
{
}

virtual CRocket::~CRocket ( ) [virtual]
CRocket::CRocket | ( | _TCHAR * | szName,
 |  | int | id,
 |  | LONG | lWeight,
 |  | LONG | lHeight,
 |  | LONG | lPayload,
 |  | CSpaceVehicle * | pParent
 | ) |  |

Definition at line 185 of file space.Cpp.

: szName(NULL), lWeight(0), lHeight(0), lPayload(0), iStatus(STOPPED), m_pParent(pParent)
{
    if (szName) {
        this->szName = new _TCHAR[(_tcslen(szName) + 1) * sizeof(_TCHAR)];
        _tcscpy(this->szName, szName);
    }

    this->nId = id;
    this->lWeight = lWeight;
    this->lHeight = lHeight;
    this->lPayload = lPayload;

    m_ppHandle = 0;

    isDeleted = FALSE;
}

virtual CRocket::~CRocket ( ) [virtual]
CRocket::CRocket | ( | CSpaceStation * | pSpaceStation,
 |  | _TCHAR * | szName,
 |  | int | id,
 |  | LONG | lWeight,
 |  | LONG | lHeight,
 |  | LONG | lPayload
 | ) |  |

Definition at line 390 of file space.Cpp.

: m_pSpaceStation(pSpaceStation), szName(NULL), lWeight(0), lHeight(0), lPayload(0), iStatus(STOPPED)
{
    if (szName) {
        this->szName = new _TCHAR[(_tcslen(szName) + 1) * sizeof(_TCHAR)];
        _tcscpy(this->szName, szName);
    }

    this->nId = id;
    this->lWeight = lWeight;
    this->lHeight = lHeight;
    this->lPayload = lPayload;

        isDeleted = FALSE;
}

virtual CRocket::~CRocket ( ) [virtual]
CRocket::CRocket | ( | _TCHAR * | szName,
 |  | int | id,
 |  | LONG | lWeight,
 |  | LONG | lHeight,
 |  | LONG | lPayload
 | ) |  |

Definition at line 112 of file space.Cpp.

: szName(NULL), lWeight(0), lHeight(0), lPayload(0), iStatus(STOPPED)
{
    if (szName) {
        this->szName = new _TCHAR[(_tcslen(szName) + 1) * sizeof(_TCHAR)];
        _tcscpy(this->szName, szName);
    }

    this->nId = id;
    this->lWeight = lWeight;
    this->lHeight = lHeight;
    this->lPayload = lPayload;
}

virtual CRocket::~CRocket ( ) [virtual]
CRocket::CRocket ( )
virtual CRocket::~CRocket ( ) [virtual]
CRocket::CRocket | ( | CSpaceStation * | pSpaceStation,
 |  | _TCHAR * | szName,
 |  | int | id,
 |  | LONG | lWeight,
 |  | LONG | lHeight,
 |  | LONG | lPayload
 | ) |  |
virtual CRocket::~CRocket ( ) [virtual]
CRocket::CRocket | ( | _TCHAR * | szName,
 |  | int | id,
 |  | LONG | lWeight,
 |  | LONG | lHeight,
 |  | LONG | lPayload
 | ) |  |
virtual CRocket::~CRocket ( ) [virtual]
CRocket::CRocket | ( | _TCHAR * | szName,
 |  | int | id,
 |  | LONG | lWeight,
 |  | LONG | lHeight,
 |  | LONG | lPayload
 | ) |  |
virtual CRocket::~CRocket ( ) [virtual]
CRocket::CRocket | ( | _TCHAR * | szName,
 |  | int | id,
 |  | LONG | lWeight,
 |  | LONG | lHeight,
 |  | LONG | lPayload
 | ) |  |
virtual CRocket::~CRocket ( ) [virtual]
CRocket::CRocket | ( | _TCHAR * | szName,
 |  | int | id,
 |  | LONG | lWeight,
 |  | LONG | lHeight,
 |  | LONG | lPayload
 | ) |  |
virtual CRocket::~CRocket ( ) [virtual]
CRocket::CRocket ( CComponentData * pComponentData = NULL )
virtual CRocket::~CRocket ( ) [virtual]
CRocket::CRocket | ( | _TCHAR * | szName,
 |  | int | id,
 |  | LONG | lWeight,
 |  | LONG | lHeight,
 |  | LONG | lPayload
 | ) |  |
virtual CRocket::~CRocket ( ) [virtual]

Member Function Documentation

HRESULT CRocket::CreatePropertyPages | ( | IPropertySheetCallback * | lpProvider,
 |  | LONG_PTR | handle |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 435 of file space.Cpp.

{
    PROPSHEETPAGE psp;
    HPROPSHEETPAGE hPage = NULL;

    // cache this handle so we can call MMCPropertyChangeNotify
    m_ppHandle = handle;

    // create the property page for this node.
    // NOTE: if your node has multiple pages, put the following
    // in a loop and create multiple pages calling
    // lpProvider->AddPage() for each page.
    psp.dwSize = sizeof(PROPSHEETPAGE);
    psp.dwFlags = PSP_DEFAULT | PSP_USETITLE | PSP_USEICONID;
    psp.hInstance = g_hinst;
    psp.pszTemplate = MAKEINTRESOURCE(IDD_PROPPAGE_LARGE);
    psp.pfnDlgProc = DialogProc;
    psp.lParam = reinterpret_cast<LPARAM>(this);
    psp.pszTitle = MAKEINTRESOURCE(IDS_PST_ROCKET);
    psp.pszIcon = MAKEINTRESOURCE(IDI_PSI_ROCKET);

    hPage = CreatePropertySheetPage(&psp);
    _ASSERT(hPage);

    return lpProvider->AddPage(hPage);
}

virtual HRESULT CRocket::CreatePropertyPages | ( | IPropertySheetCallback * | lpProvider,
 |  | LONG_PTR | handle |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CRocket::CreatePropertyPages | ( | IPropertySheetCallback * | lpProvider,
 |  | LONG_PTR | handle |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CRocket::CreatePropertyPages | ( | IPropertySheetCallback * | lpProvider,
 |  | LONG_PTR | handle |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

static BOOL CALLBACK CRocket::DialogProc | ( | HWND | hwndDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static, private]
static BOOL CALLBACK CRocket::DialogProc | ( | HWND | hwndDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static, private]
BOOL CALLBACK CRocket::DialogProc | ( | HWND | hwndDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static, private]

Definition at line 352 of file space.Cpp.

{
    static CRocket *pRocket = NULL;

    switch (uMsg) {
    case WM_INITDIALOG:
        // catch the "this" pointer so we can actually operate on the object
        pRocket = reinterpret_cast<CRocket *>(reinterpret_cast<PROPSHEETPAGE *>(lParam)->lParam);

        SetDlgItemText(hwndDlg, IDC_ROCKET_NAME, pRocket->szName);
        SetDlgItemInt(hwndDlg, IDC_ROCKET_HEIGHT, pRocket->lHeight, FALSE);
        SetDlgItemInt(hwndDlg, IDC_ROCKET_WEIGHT, pRocket->lWeight, FALSE);
        SetDlgItemInt(hwndDlg, IDC_ROCKET_PAYLOAD, pRocket->lPayload, FALSE);

        _ASSERT( CB_ERR != SendDlgItemMessage(hwndDlg, IDC_ROCKET_STATUS, CB_INSERTSTRING, 0, (LPARAM)_T("Running")) );
        _ASSERT( CB_ERR != SendDlgItemMessage(hwndDlg, IDC_ROCKET_STATUS, CB_INSERTSTRING, 1, (LPARAM)_T("Paused")) );
        _ASSERT( CB_ERR != SendDlgItemMessage(hwndDlg, IDC_ROCKET_STATUS, CB_INSERTSTRING, 2, (LPARAM)_T("Stopped")) );

        SendDlgItemMessage(hwndDlg, IDC_ROCKET_STATUS, CB_SETCURSEL, (WPARAM)pRocket->iStatus, 0);

        break;

    case WM_COMMAND:
        // turn the Apply button on
        if (HIWORD(wParam) == EN_CHANGE ||
            HIWORD(wParam) == CBN_SELCHANGE)
            SendMessage(GetParent(hwndDlg), PSM_CHANGED, (WPARAM)hwndDlg, 0);
        break;

    case WM_DESTROY:
        // tell MMC that we're done with the property sheet (we got this
        // handle in CreatePropertyPages
        MMCFreeNotifyHandle(pRocket->m_ppHandle);
        break;

    case WM_NOTIFY:
        switch (((NMHDR *) lParam)->code) {
        case PSN_APPLY:
            // update the information
            if (pRocket->szName) {
                delete [] pRocket->szName;
                pRocket->szName = NULL;
            }

            {
                int n = SendDlgItemMessage(hwndDlg, IDC_ROCKET_NAME, WM_GETTEXTLENGTH, 0, 0);
                if (n != 0) {
                    pRocket->szName = new _TCHAR[n + 1];
                    GetDlgItemText(hwndDlg, IDC_ROCKET_NAME, pRocket->szName, n + 1);
                }
            }
            pRocket->lHeight = GetDlgItemInt(hwndDlg, IDC_ROCKET_HEIGHT, NULL, FALSE);
            pRocket->lWeight = GetDlgItemInt(hwndDlg, IDC_ROCKET_WEIGHT, NULL, FALSE);
            pRocket->lPayload = GetDlgItemInt(hwndDlg, IDC_ROCKET_PAYLOAD, NULL, FALSE);

            pRocket->iStatus = (ROCKET_STATUS)SendDlgItemMessage(hwndDlg, IDC_ROCKET_STATUS, CB_GETCURSEL, 0, 0);

            // ask MMC to send us a message (on the main thread) so
            // we know the Apply button was clicked.
            HRESULT hr = MMCPropertyChangeNotify(pRocket->m_ppHandle, (long)pRocket);

            _ASSERT(SUCCEEDED(hr));

            return PSNRET_NOERROR;
        }
        break;
    }

    return DefWindowProc(hwndDlg, uMsg, wParam, lParam);
}

static BOOL CALLBACK CRocket::DialogProc | ( | HWND | hwndDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static, private]
virtual const int CRocket::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 32 of file space.h.

{ return INDEX_SPACEICON; }

virtual const int CRocket::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 32 of file space.h.

{ return INDEX_SPACEICON; }

virtual const int CRocket::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 34 of file space.h.

{ return INDEX_SPACEICON; }

virtual const int CRocket::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 32 of file space.h.

{ return INDEX_SPACEICON; }

virtual const int CRocket::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 32 of file space.h.

{ return INDEX_SPACEICON; }

virtual const int CRocket::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 34 of file space.h.

{ return INDEX_SPACEICON; }

virtual const int CRocket::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 32 of file space.h.

{ return INDEX_SPACEICON; }

virtual const int CRocket::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 34 of file space.h.

{ return INDEX_SPACEICON; }

virtual const int CRocket::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 32 of file space.h.

{ return INDEX_SPACEICON; }

virtual const int CRocket::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 37 of file space.h.

{ return INDEX_SPACEICON; }

virtual const int CRocket::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 36 of file space.h.

{ return INDEX_SPACEICON; }

virtual const int CRocket::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 34 of file space.h.

{ return INDEX_SPACEICON; }

virtual const int CRocket::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 36 of file space.h.

{ return INDEX_SPACEICON; }

BOOL CRocket::getDeletedStatus ( ) [inline]

Definition at line 37 of file space.h.

{ return isDeleted; }

BOOL CRocket::getDeletedStatus ( ) [inline]

Definition at line 38 of file space.h.

{ return isDeleted; }

BOOL CRocket::getDeletedStatus ( ) [inline]

Definition at line 37 of file space.h.

{ return isDeleted; }

virtual const _TCHAR* CRocket::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

virtual const _TCHAR* CRocket::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

virtual const _TCHAR* CRocket::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

virtual const _TCHAR* CRocket::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

virtual const _TCHAR* CRocket::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

virtual const _TCHAR* CRocket::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

virtual const _TCHAR* CRocket::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

virtual const _TCHAR* CRocket::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

virtual const _TCHAR* CRocket::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

virtual const _TCHAR* CRocket::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

virtual const _TCHAR* CRocket::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

const _TCHAR * CRocket::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

Definition at line 137 of file space.Cpp.

{
    const size_t cchBuffer = 128;
    static _TCHAR buf[cchBuffer];

    // StringCchPrintf and StringCchCopy always null-terminate the destination string.
    // However the string may be a truncation of the ideal result (indicated by  return value other than S_OK).

    switch (nCol) {
    case 0:
        StringCchCopy(buf, cchBuffer, szName ? szName : _T(""));
        break;

    case 1:
        StringCchPrintf(buf, cchBuffer, _T("%ld metric tons"), lWeight);
        break;

    case 2:
        StringCchPrintf(buf, cchBuffer, _T("%ld meters"), lHeight);
        break;

    case 3:
        StringCchPrintf(buf, cchBuffer, _T("%ld kilos"), lPayload);
        break;

    case 4:
        StringCchPrintf(buf, cchBuffer, _T("%s"),
            iStatus == RUNNING ? _T("running") :
        iStatus == PAUSED ? _T("paused") :
        iStatus == STOPPED ? _T("stopped") : _T("unknown"));
        break;

    }

    return buf;
}

virtual const _TCHAR* CRocket::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

int CRocket::GetId ( ) [inline]

Definition at line 41 of file space.h.

{ return nId; }

HMENU CRocket::GetMenu ( int nMenuId ) [virtual]

Definition at line 172 of file space.Cpp.

{
    HMENU hResMenu = LoadMenu(g_hinst, MAKEINTRESOURCE(nMenuId));
    HMENU hMenu = GetSubMenu(hResMenu,0);

    if (IDR_STATE_MENU == nMenuId) {
        switch (iStatus)
        {
        case RUNNING:
            EnableMenuItem(hMenu, ID_COMMAND_START, MF_BYCOMMAND | MF_GRAYED);
            EnableMenuItem(hMenu, ID_COMMAND_PAUSE, MF_BYCOMMAND | MF_ENABLED);
            EnableMenuItem(hMenu, ID_COMMAND_STOP, MF_BYCOMMAND | MF_ENABLED);
            break;

        case PAUSED:
            EnableMenuItem(hMenu, ID_COMMAND_START, MF_BYCOMMAND | MF_ENABLED);
            EnableMenuItem(hMenu, ID_COMMAND_PAUSE, MF_BYCOMMAND | MF_GRAYED);
            EnableMenuItem(hMenu, ID_COMMAND_STOP, MF_BYCOMMAND | MF_ENABLED);
            break;

        case STOPPED:
            EnableMenuItem(hMenu, ID_COMMAND_START, MF_BYCOMMAND | MF_ENABLED);
            EnableMenuItem(hMenu, ID_COMMAND_START, MF_BYCOMMAND | MF_ENABLED);
            EnableMenuItem(hMenu, ID_COMMAND_STOP, MF_BYCOMMAND | MF_GRAYED);
            break;
        }
    } else {
        // some other menu, set state accordingly
    }

    return hMenu;
}

virtual const GUID& CRocket::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 31 of file space.h.

{ return thisGuid; }

virtual const GUID& CRocket::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 31 of file space.h.

{ return thisGuid; }

virtual const GUID& CRocket::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 31 of file space.h.

{ return thisGuid; }

virtual const GUID& CRocket::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 31 of file space.h.

{ return thisGuid; }

virtual const GUID& CRocket::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 33 of file space.h.

{ return thisGuid; }

virtual const GUID& CRocket::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 31 of file space.h.

{ return thisGuid; }

virtual const GUID& CRocket::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 33 of file space.h.

{ return thisGuid; }

virtual const GUID& CRocket::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 33 of file space.h.

{ return thisGuid; }

virtual const GUID& CRocket::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 36 of file space.h.

{ return thisGuid; }

virtual const GUID& CRocket::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 35 of file space.h.

{ return thisGuid; }

virtual const GUID& CRocket::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 33 of file space.h.

{ return thisGuid; }

virtual const GUID& CRocket::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 35 of file space.h.

{ return thisGuid; }

virtual const GUID& CRocket::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 31 of file space.h.

{ return thisGuid; }

CSpaceStation* CRocket::GetParent ( ) [inline]

Definition at line 40 of file space.h.

{ return  m_pSpaceStation; }

virtual HRESULT CRocket::GetWatermarks | ( | HBITMAP * | lphWatermark,
 |  | HBITMAP * | lphHeader,
 |  | HPALETTE * | lphPalette,
 |  | BOOL * | bStretch |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

HRESULT CRocket::GetWatermarks | ( | HBITMAP * | lphWatermark,
 |  | HBITMAP * | lphHeader,
 |  | HPALETTE * | lphPalette,
 |  | BOOL * | bStretch |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 463 of file space.Cpp.

{
    return S_FALSE;
}

virtual HRESULT CRocket::GetWatermarks | ( | HBITMAP * | lphWatermark,
 |  | HBITMAP * | lphHeader,
 |  | HPALETTE * | lphPalette,
 |  | BOOL * | bStretch |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CRocket::GetWatermarks | ( | HBITMAP * | lphWatermark,
 |  | HBITMAP * | lphHeader,
 |  | HPALETTE * | lphPalette,
 |  | BOOL * | bStretch |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CRocket::HasPropertySheets ( ) [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CRocket::HasPropertySheets ( ) [virtual]

Reimplemented from CDelegationBase.

HRESULT CRocket::HasPropertySheets ( ) [virtual]

Reimplemented from CDelegationBase.

Definition at line 429 of file space.Cpp.

{
    // say "yes" when MMC asks if we have pages
    return S_OK;
}

virtual HRESULT CRocket::HasPropertySheets ( ) [virtual]

Reimplemented from CDelegationBase.

void CRocket::Initialize | ( | _TCHAR * | szName,
 |  | LONG | lWeight,
 |  | LONG | lHeight,
 |  | LONG | lPayload
 | ) |  |

Definition at line 125 of file space.Cpp.

{
    if (szName) {
        this->szName = new _TCHAR[_tcslen(szName) + 1];
        _tcscpy(this->szName, szName);
    }

    this->lWeight = lWeight;
    this->lHeight = lHeight;
    this->lPayload = lPayload;
}

void CRocket::Initialize | ( | _TCHAR * | szName,
 |  | LONG | lWeight,
 |  | LONG | lHeight,
 |  | LONG | lPayload
 | ) |  |
void CRocket::Initialize | ( | _TCHAR * | szName,
 |  | LONG | lWeight,
 |  | LONG | lHeight,
 |  | LONG | lPayload
 | ) |  |
void CRocket::Initialize | ( | _TCHAR * | szName,
 |  | LONG | lWeight,
 |  | LONG | lHeight,
 |  | LONG | lPayload
 | ) |  |
HRESULT CRocket::OnAddMenuItems | ( | IContextMenuCallback * | pContextMenuCallback,
 |  | long * | pInsertionsAllowed |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 212 of file space.Cpp.

{
    HRESULT hr = S_OK;
    CONTEXTMENUITEM menuItemsTask[] =
    {
        {
            L"Start vehicle", L"Start the space vehicle",
                IDM_START_SPACE, CCM_INSERTIONPOINTID_PRIMARY_TASK, 0, CCM_SPECIAL_DEFAULT_ITEM
        },
        {
            L"Pause vehicle", L"Pause the space vehicle",
                IDM_PAUSE_SPACE, CCM_INSERTIONPOINTID_PRIMARY_TASK, 0, 0
        },
        {
            L"Stop vehicle", L"Stop the space vehicle",
                IDM_STOP_SPACE, CCM_INSERTIONPOINTID_PRIMARY_TASK, 0, 0
        },
        { NULL, NULL, 0, 0, 0 }
    };

    // Loop through and add each of the menu items
    if (*pInsertionsAllowed & CCM_INSERTIONALLOWED_TASK)
    {
        for (LPCONTEXTMENUITEM m = menuItemsTask; m->strName; m++)
        {
            hr = pContextMenuCallback->AddItem(m);

            if (FAILED(hr))
                break;
        }
    }

    return hr;
}

HRESULT CRocket::OnButtonClicked ( CComponent * pComponent ) [virtual]

Reimplemented from CDelegationBase.

Definition at line 212 of file space.Cpp.

{
    switch (iStatus)
    {
    case RUNNING:
        pComponent->getToolbar()->SetButtonState(ID_BUTTONSTART, BUTTONPRESSED, TRUE);
        pComponent->getToolbar()->SetButtonState(ID_BUTTONSTART, ENABLED, FALSE);
        pComponent->getToolbar()->SetButtonState(ID_BUTTONPAUSE, BUTTONPRESSED, FALSE);
        pComponent->getToolbar()->SetButtonState(ID_BUTTONPAUSE, ENABLED, TRUE);
        pComponent->getToolbar()->SetButtonState(ID_BUTTONSTOP, BUTTONPRESSED, FALSE);
        pComponent->getToolbar()->SetButtonState(ID_BUTTONSTOP, ENABLED, TRUE);
        break;

    case PAUSED:
        pComponent->getToolbar()->SetButtonState(ID_BUTTONSTART, BUTTONPRESSED, FALSE);
        pComponent->getToolbar()->SetButtonState(ID_BUTTONSTART, ENABLED, TRUE);
        pComponent->getToolbar()->SetButtonState(ID_BUTTONPAUSE, BUTTONPRESSED, TRUE);
        pComponent->getToolbar()->SetButtonState(ID_BUTTONPAUSE, ENABLED, FALSE);
        pComponent->getToolbar()->SetButtonState(ID_BUTTONSTOP, BUTTONPRESSED, FALSE);
        pComponent->getToolbar()->SetButtonState(ID_BUTTONSTOP, ENABLED, TRUE);
        break;

    case STOPPED:
        pComponent->getToolbar()->SetButtonState(ID_BUTTONSTART, BUTTONPRESSED, FALSE);
        pComponent->getToolbar()->SetButtonState(ID_BUTTONSTART, ENABLED, TRUE);
        pComponent->getToolbar()->SetButtonState(ID_BUTTONPAUSE, BUTTONPRESSED, FALSE);
        pComponent->getToolbar()->SetButtonState(ID_BUTTONPAUSE, ENABLED, TRUE);
        pComponent->getToolbar()->SetButtonState(ID_BUTTONSTOP, BUTTONPRESSED, TRUE);
        pComponent->getToolbar()->SetButtonState(ID_BUTTONSTOP, ENABLED, FALSE);
        break;
    }

    return S_OK;
}

virtual HRESULT CRocket::OnDelete ( IConsole * pConsole ) [virtual]

Reimplemented from CDelegationBase.

HRESULT CRocket::OnDelete ( IConsole * pConsoleComp ) [virtual]

Reimplemented from CDelegationBase.

Definition at line 585 of file space.Cpp.

{
    HRESULT hr;

    //Delete the item
    IResultData *pResultData = NULL;

    hr = pConsoleComp->QueryInterface(IID_IResultData, (void **)&pResultData);
    _ASSERT( SUCCEEDED(hr) );

    HRESULTITEM myhresultitem;

    //lparam == this. See CSpaceVehicle::OnShow
    hr = pResultData->FindItemByLParam( (LPARAM)this, &myhresultitem );
    if ( FAILED(hr) )
    {
        // Failed : Reason may be that current view does not have this item.
        // So exit gracefully.
        hr = S_FALSE;
    } else

    {
        hr = pResultData->DeleteItem( myhresultitem, 0 );
        _ASSERT( SUCCEEDED(hr) );
    }

    pResultData->Release();

    //Now set isDeleted member so that the parent doesn't try to
    //to insert it again in CSpaceVehicle::OnShow. Admittedly, a hack...
    isDeleted = TRUE;

    return hr;
}

virtual HRESULT CRocket::OnDelete ( IConsole * pConsole ) [virtual]

Reimplemented from CDelegationBase.

HRESULT CRocket::OnMenuButtonCommand | ( | IConsole * | pConsole,
 |  | int | nMenuId,
 |  | long | lCommandID |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 250 of file space.Cpp.

{
    const size_t cchBuffer = 128;
    _TCHAR szVehicle[cchBuffer];

    // StringCchPrintf and StringCchCopy always null-terminate the destination string.
    // However the string may be a truncation of the ideal result (indicated by  return value other than S_OK).

    if (IDR_STATE_MENU == nMenuId) {
        switch (lCommandID) {
        case ID_COMMAND_START:
            iStatus = RUNNING;
            break;

        case ID_COMMAND_PAUSE:
            iStatus = PAUSED;
            break;

        case ID_COMMAND_STOP:
            iStatus = STOPPED;
            break;
        }

        StringCchPrintf(szVehicle, cchBuffer, _T("Vehicle %s has been %s"), szName,
            (long)iStatus == RUNNING ? _T("started") :
        (long)iStatus == PAUSED ? _T("paused") :
        (long)iStatus == STOPPED ? _T("stopped") : _T("!!!unknown command!!!"));

        int ret = 0;
        MAKE_WIDEPTR_FROMTSTR(pszVehicle, szVehicle);
        pConsole->MessageBox(pszVehicle,
            L"Vehicle command", MB_OK | MB_ICONINFORMATION, &ret);

        }

        return S_OK;
}

HRESULT CRocket::OnMenuCommand | ( | IConsole * | pConsole,
 |  | long | lCommandID |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 247 of file space.Cpp.

{
    const size_t cchBuffer = 128;
    _TCHAR szVehicle[cchBuffer];

    // StringCchPrintf and StringCchCopy always null-terminate the destination string.
    // However the string may be a truncation of the ideal result (indicated by  return value other than S_OK).

    switch (lCommandID) {
    case IDM_START_SPACE:
        iStatus = RUNNING;
        break;

    case IDM_PAUSE_SPACE:
        iStatus = PAUSED;
        break;

    case IDM_STOP_SPACE:
        iStatus = STOPPED;
        break;
    }

    StringCchPrintf(szVehicle, cchBuffer, _T("%s has been %s"), szName,
        (long)iStatus == RUNNING ? _T("started") :
    (long)iStatus == PAUSED ? _T("paused") :
    (long)iStatus == STOPPED ? _T("stopped") : _T("!!!unknown command!!!"));

    MAKE_WIDEPTR_FROMTSTR(ptrname, szVehicle);
    int ret = 0;
    pConsole->MessageBox(ptrname,
        L"Vehicle command", MB_OK | MB_ICONINFORMATION, &ret);

    return S_OK;
  }

virtual HRESULT CRocket::OnPropertyChange ( IConsole * pConsole ) [virtual]

Reimplemented from CDelegationBase.

HRESULT CRocket::OnPropertyChange | ( | IConsole * | pConsole,
 |  | CComponent * | pComponent |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 268 of file space.Cpp.

{

    HRESULT hr = S_FALSE;

    //Call IConsole::UpdateAllViews to redraw the item
    //in all views. We need a data object because of the
    //way UpdateAllViews is implemented, and because
    //MMCN_PROPERTY_CHANGE doesn't give us one

    LPDATAOBJECT pDataObject;
    hr = pComponent->QueryDataObject((MMC_COOKIE)this, CCT_RESULT, &pDataObject );
    _ASSERT( S_OK == hr);

    hr = pConsole->UpdateAllViews(pDataObject, nId, UPDATE_RESULTITEM);
    _ASSERT( S_OK == hr);

    pDataObject->Release();

    return hr;
}

HRESULT CRocket::OnPropertyChange ( IConsole * pConsole ) [virtual]

Reimplemented from CDelegationBase.

Definition at line 190 of file space.Cpp.

{

    //redraw the item
    IResultData *pResultData = NULL;

  HRESULT hr;

  hr = pConsole->QueryInterface(IID_IResultData, (void **)&pResultData);
  _ASSERT( SUCCEEDED(hr) );

  HRESULTITEM myhresultitem;

  //lparam == this. See CSpaceVehicle::OnShow
  hr = pResultData->FindItemByLParam( (LPARAM)this, &myhresultitem );
  _ASSERT( SUCCEEDED(hr) );

  hr = pResultData->UpdateItem( myhresultitem );
  _ASSERT( SUCCEEDED(hr) );

    pResultData->Release();

  return S_OK;
}

virtual HRESULT CRocket::OnRefresh ( IConsole * pConsole ) [virtual]

Reimplemented from CDelegationBase.

HRESULT CRocket::OnRefresh ( IConsole * pConsole ) [virtual]

Reimplemented from CDelegationBase.

Definition at line 569 of file space.Cpp.

{
    //Call IConsole::UpdateAllViews to redraw all views
    //owned by the parent scope item

    IDataObject *dummy = NULL;

    HRESULT hr;

    hr = pConsole->UpdateAllViews(dummy, m_pParent->GetParentScopeItem(), UPDATE_SCOPEITEM);
    _ASSERT( S_OK == hr);

    return hr;
}

virtual HRESULT CRocket::OnRefresh ( IConsole * pConsole ) [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CRocket::OnRename ( LPOLESTR pszNewName ) [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CRocket::OnRename ( LPOLESTR pszNewName ) [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CRocket::OnRename ( LPOLESTR pszNewName ) [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CRocket::OnRename ( LPOLESTR pszNewName ) [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CRocket::OnRename ( LPOLESTR pszNewName ) [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CRocket::OnRename ( LPOLESTR pszNewName ) [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CRocket::OnRename ( LPOLESTR pszNewName ) [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CRocket::OnRename ( LPOLESTR pszNewName ) [virtual]

Reimplemented from CDelegationBase.

HRESULT CRocket::OnRename ( LPOLESTR pszNewName ) [virtual]

Reimplemented from CDelegationBase.

Definition at line 246 of file space.Cpp.

{

    HRESULT hr = S_FALSE;

    if (szName)
    {
        delete [] szName;
        szName = NULL;
    }

    MAKE_TSTRPTR_FROMWIDE(ptrname, pszNewName);
    szName = new _TCHAR[(_tcslen(ptrname) + 1) * sizeof(_TCHAR)];
    _tcscpy(szName, ptrname);

    return hr;
}

virtual HRESULT CRocket::OnSelect | ( | IConsole * | pConsole,
 |  | BOOL | bScope,
 |  | BOOL | bSelect |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CRocket::OnSelect | ( | IConsole * | pConsole,
 |  | BOOL | bScope,
 |  | BOOL | bSelect |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CRocket::OnSelect | ( | IConsole * | pConsole,
 |  | BOOL | bScope,
 |  | BOOL | bSelect |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

HRESULT CRocket::OnSelect | ( | CComponent * | pComponent,
 |  | BOOL | bScope,
 |  | BOOL | bSelect |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 175 of file space.Cpp.

{
    if (bSelect) {
        switch (iStatus)
        {
        case RUNNING:
            pComponent->getToolbar()->SetButtonState(ID_BUTTONSTART, BUTTONPRESSED, TRUE);
            pComponent->getToolbar()->SetButtonState(ID_BUTTONSTART, ENABLED, FALSE);
            pComponent->getToolbar()->SetButtonState(ID_BUTTONPAUSE, BUTTONPRESSED, FALSE);
            pComponent->getToolbar()->SetButtonState(ID_BUTTONPAUSE, ENABLED, TRUE);
            pComponent->getToolbar()->SetButtonState(ID_BUTTONSTOP, BUTTONPRESSED, FALSE);
            pComponent->getToolbar()->SetButtonState(ID_BUTTONSTOP, ENABLED, TRUE);
            break;

        case PAUSED:
            pComponent->getToolbar()->SetButtonState(ID_BUTTONSTART, BUTTONPRESSED, FALSE);
            pComponent->getToolbar()->SetButtonState(ID_BUTTONSTART, ENABLED, TRUE);
            pComponent->getToolbar()->SetButtonState(ID_BUTTONPAUSE, BUTTONPRESSED, TRUE);
            pComponent->getToolbar()->SetButtonState(ID_BUTTONPAUSE, ENABLED, FALSE);
            pComponent->getToolbar()->SetButtonState(ID_BUTTONSTOP, BUTTONPRESSED, FALSE);
            pComponent->getToolbar()->SetButtonState(ID_BUTTONSTOP, ENABLED, TRUE);
            break;

        case STOPPED:
            pComponent->getToolbar()->SetButtonState(ID_BUTTONSTART, BUTTONPRESSED, FALSE);
            pComponent->getToolbar()->SetButtonState(ID_BUTTONSTART, ENABLED, TRUE);
            pComponent->getToolbar()->SetButtonState(ID_BUTTONPAUSE, BUTTONPRESSED, FALSE);
            pComponent->getToolbar()->SetButtonState(ID_BUTTONPAUSE, ENABLED, TRUE);
            pComponent->getToolbar()->SetButtonState(ID_BUTTONSTOP, BUTTONPRESSED, TRUE);
            pComponent->getToolbar()->SetButtonState(ID_BUTTONSTOP, ENABLED, FALSE);
            break;
        }
    }

    return S_OK;
}

HRESULT CRocket::OnSelect | ( | IConsole * | pConsole,
 |  | BOOL | bScope,
 |  | BOOL | bSelect |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 450 of file space.Cpp.

{
    IConsoleVerb *pConsoleVerb;

    HRESULT hr = pConsole->QueryConsoleVerb(&pConsoleVerb);
    _ASSERT(SUCCEEDED(hr));

    hr = pConsoleVerb->SetVerbState(MMC_VERB_RENAME, ENABLED, TRUE);
    hr = pConsoleVerb->SetVerbState(MMC_VERB_CUT, ENABLED, TRUE);
    hr = pConsoleVerb->SetVerbState(MMC_VERB_COPY, ENABLED, TRUE);
    hr = pConsoleVerb->SetVerbState(MMC_VERB_DELETE, ENABLED, TRUE);

    pConsoleVerb->Release();

    return S_OK;
}

virtual HRESULT CRocket::OnSelect | ( | IConsole * | pConsole,
 |  | BOOL | bScope,
 |  | BOOL | bSelect |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CRocket::OnSelect | ( | IConsole * | pConsole,
 |  | BOOL | bScope,
 |  | BOOL | bSelect |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CRocket::OnSelect | ( | IConsole * | pConsole,
 |  | BOOL | bScope,
 |  | BOOL | bSelect |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

HRESULT CRocket::OnSelect | ( | CComponent * | pComponent,
 |  | IConsole * | pConsole,
 |  | BOOL | bScope,
 |  | BOOL | bSelect |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 290 of file space.Cpp.

{

    // enable rename, refresh, and delete verbs
    IConsoleVerb *pConsoleVerb;

    HRESULT hr = pConsole->QueryConsoleVerb(&pConsoleVerb);
    _ASSERT(SUCCEEDED(hr));

    hr = pConsoleVerb->SetVerbState(MMC_VERB_RENAME, ENABLED, TRUE);
    hr = pConsoleVerb->SetVerbState(MMC_VERB_REFRESH, ENABLED, TRUE);
    hr = pConsoleVerb->SetVerbState(MMC_VERB_DELETE, ENABLED, TRUE);

    // can't get to properties (via the standard methods) unless
    // we tell MMC to display the Properties menu item and
    // toolbar button, this will give the user a visual cue that
    // there's "something" to do
    hr = pConsoleVerb->SetVerbState(MMC_VERB_PROPERTIES, ENABLED, TRUE);

    //also set MMC_VERB_PROPERTIES as the default verb
    hr = pConsoleVerb->SetDefaultVerb(MMC_VERB_PROPERTIES);

    pConsoleVerb->Release();

        // now set toolbar button states
    if (bSelect) {
        switch (iStatus)
        {
        case RUNNING:
            pComponent->getToolbar()->SetButtonState(ID_BUTTONSTART, BUTTONPRESSED, TRUE);
            pComponent->getToolbar()->SetButtonState(ID_BUTTONSTART, ENABLED, FALSE);
            pComponent->getToolbar()->SetButtonState(ID_BUTTONPAUSE, BUTTONPRESSED, FALSE);
            pComponent->getToolbar()->SetButtonState(ID_BUTTONPAUSE, ENABLED, TRUE);
            pComponent->getToolbar()->SetButtonState(ID_BUTTONSTOP, BUTTONPRESSED, FALSE);
            pComponent->getToolbar()->SetButtonState(ID_BUTTONSTOP, ENABLED, TRUE);
            break;

        case PAUSED:
            pComponent->getToolbar()->SetButtonState(ID_BUTTONSTART, BUTTONPRESSED, FALSE);
            pComponent->getToolbar()->SetButtonState(ID_BUTTONSTART, ENABLED, TRUE);
            pComponent->getToolbar()->SetButtonState(ID_BUTTONPAUSE, BUTTONPRESSED, TRUE);
            pComponent->getToolbar()->SetButtonState(ID_BUTTONPAUSE, ENABLED, FALSE);
            pComponent->getToolbar()->SetButtonState(ID_BUTTONSTOP, BUTTONPRESSED, FALSE);
            pComponent->getToolbar()->SetButtonState(ID_BUTTONSTOP, ENABLED, TRUE);
            break;

        case STOPPED:
            pComponent->getToolbar()->SetButtonState(ID_BUTTONSTART, BUTTONPRESSED, FALSE);
            pComponent->getToolbar()->SetButtonState(ID_BUTTONSTART, ENABLED, TRUE);
            pComponent->getToolbar()->SetButtonState(ID_BUTTONPAUSE, BUTTONPRESSED, FALSE);
            pComponent->getToolbar()->SetButtonState(ID_BUTTONPAUSE, ENABLED, TRUE);
            pComponent->getToolbar()->SetButtonState(ID_BUTTONSTOP, BUTTONPRESSED, TRUE);
            pComponent->getToolbar()->SetButtonState(ID_BUTTONSTOP, ENABLED, FALSE);
            break;
        }
    }

    return S_OK;
}

virtual HRESULT CRocket::OnSelect | ( | IConsole * | pConsole,
 |  | BOOL | bScope,
 |  | BOOL | bSelect |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

HRESULT CRocket::OnSetMenuButton | ( | IConsole * | pConsole,
 |  | MENUBUTTONDATA * | pmbd |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 226 of file space.Cpp.

{
    HMENU hMenu = GetMenu(pmbd->idCommand);
    HRESULT hr = S_FALSE;
    HWND  hWnd;

    if (hMenu) {
        hr = pConsole->GetMainWindow(&hWnd);

        if (SUCCEEDED(hr)) {
            LONG ret = TrackPopupMenuEx(hMenu, TPM_NONOTIFY | TPM_RETURNCMD,
                pmbd->x, pmbd->y, hWnd, NULL);

            if (ret != 0) { // !cancelled
                hr = OnMenuButtonCommand(pConsole, pmbd->idCommand, ret);
            }
        }

        DestroyMenu(hMenu);
    }

    return hr;
}

HRESULT CRocket::OnSetToolbar | ( | IControlbar * | pControlbar,
 |  | IToolbar * | pToolbar,
 |  | BOOL | bScope,
 |  | BOOL | bSelect |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 472 of file space.Cpp.

{
    HRESULT hr = S_OK;

    if (bSelect) {
        // Always make sure the menuButton is attached
        hr = pControlbar->Attach(TOOLBAR, pToolbar);
    } else {
        // Always make sure the toolbar is detached
        hr = pControlbar->Detach(pToolbar);
    }

    return hr;
}

HRESULT CRocket::OnSetToolbar | ( | CComponent * | pComponent,
 |  | IControlbar * | pControlbar,
 |  | IToolbar * | pToolbar,
 |  | BOOL | bScope,
 |  | BOOL | bSelect |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 247 of file space.Cpp.

{
    HRESULT hr = S_OK;

    if (bSelect) {
        // Always make sure the menuButton is attached
        hr = pControlbar->Attach(TOOLBAR, pToolbar);
        hr = OnSelect(pComponent, bScope, bSelect);
    } else {
        // Always make sure the toolbar is detached
        hr = pControlbar->Detach(pToolbar);
    }

    return hr;
}

HRESULT CRocket::OnToolbarCommand | ( | CComponent * | pComponent,
 |  | IConsole * | pConsole,
 |  | MMC_CONSOLE_VERB | verb |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 263 of file space.Cpp.

{
    const size_t cchBuffer = 128;
    _TCHAR szVehicle[cchBuffer];

    // StringCchPrintf and StringCchCopy always null-terminate the destination string.
    // However the string may be a truncation of the ideal result (indicated by  return value other than S_OK).

    switch (verb)
    {
    case ID_BUTTONSTART:
            iStatus = RUNNING;
        break;

    case ID_BUTTONPAUSE:
        iStatus = PAUSED;
        break;

    case ID_BUTTONSTOP:
        iStatus = STOPPED;
        break;
    }

    StringCchPrintf(szVehicle, cchBuffer, _T("Vehicle %s has been %s"), szName,
        (long)verb == ID_BUTTONSTART ? _T("started") :
    (long)verb == ID_BUTTONPAUSE ? _T("paused") :
    (long)verb == ID_BUTTONSTOP ? _T("stopped") : _T("!!!unknown command!!!"));

    int ret = 0;
    MAKE_WIDEPTR_FROMTSTR_ALLOC(wszVehicle, szVehicle);
    pConsole->MessageBox(wszVehicle,
        L"Vehicle command", MB_OK | MB_ICONINFORMATION, &ret);

    OnButtonClicked(pComponent);
    return S_OK;
}

HRESULT CRocket::OnToolbarCommand | ( | IConsole * | pConsole,
 |  | MMC_CONSOLE_VERB | verb,
 |  | IDataObject * | pDataObject |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 487 of file space.Cpp.

{
    const size_t cchBuffer = 128;
    _TCHAR szVehicle[cchBuffer];

    static _TCHAR buf[cchBuffer];

    // StringCchPrintf and StringCchCopy always null-terminate the destination string.
    // However the string may be a truncation of the ideal result (indicated by  return value other than S_OK).

    StringCchPrintf(buf, cchBuffer, _T("%s (#%d)"), szName ? szName : _T(""), nId);

    switch (verb)
    {
    case ID_BUTTONSTART:
        iStatus = RUNNING;
        break;

    case ID_BUTTONPAUSE:
        iStatus = PAUSED;
        break;

    case ID_BUTTONSTOP:
        iStatus = STOPPED;
        break;
    }

    StringCchPrintf(szVehicle, cchBuffer, _T("%s has been %s"), buf,
        (long)verb == ID_BUTTONSTART ? _T("started") :
    (long)verb == ID_BUTTONPAUSE ? _T("paused") :
    (long)verb == ID_BUTTONSTOP ? _T("stopped") : _T("!!!unknown command!!!"));

    int ret = 0;
    MAKE_WIDEPTR_FROMTSTR_ALLOC(wszVehicle, szVehicle);
    pConsole->MessageBox(wszVehicle,
        L"Vehicle command", MB_OK | MB_ICONINFORMATION, &ret);

    // Now call IConsole::UpdateAllViews to redraw the item in all views
    HRESULT hr;
    hr = pConsole->UpdateAllViews(pDataObject, nId, UPDATE_RESULTITEM);
    _ASSERT( S_OK == hr);

    return S_OK;
}

virtual HRESULT CRocket::OnUpdateItem | ( | IConsole * | pConsole,
 |  | long | item,
 |  | ITEM_TYPE | itemtype |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

HRESULT CRocket::OnUpdateItem | ( | IConsole * | pConsole,
 |  | long | item,
 |  | ITEM_TYPE | itemtype |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 533 of file space.Cpp.

{
    HRESULT hr = S_FALSE;

    _ASSERT(NULL != this || isDeleted || RESULT == itemtype);

    //redraw the item
    IResultData *pResultData = NULL;

    hr = pConsole->QueryInterface(IID_IResultData, (void **)&pResultData);
    _ASSERT( SUCCEEDED(hr) );

    HRESULTITEM myhresultitem;
    _ASSERT(NULL != &myhresultitem);

    //lparam == this. See CSpaceStation::OnShow
    hr = pResultData->FindItemByLParam( (LPARAM)this, &myhresultitem );

    if ( FAILED(hr) )
    {
        // Failed : Reason may be that current view does not have this item.
        // So exit gracefully.
        hr = S_FALSE;
    } else

    {
        hr = pResultData->UpdateItem( myhresultitem );
        _ASSERT( SUCCEEDED(hr) );
    }

    pResultData->Release();

    return hr;
}

virtual HRESULT CRocket::OnUpdateItem | ( | IConsole * | pConsole,
 |  | long | item,
 |  | ITEM_TYPE | itemtype |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

void CRocket::setDeletedStatus ( BOOL status ) [inline]

Definition at line 38 of file space.h.

{ isDeleted = status; }

void CRocket::setDeletedStatus ( BOOL status ) [inline]

Definition at line 38 of file space.h.

{ isDeleted = status; }

HRESULT CRocket::SetMenuState | ( | IControlbar * | pControlbar,
 |  | IMenuButton * | pMenuButton,
 |  | BOOL | bScope,
 |  | BOOL | bSelect |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 205 of file space.Cpp.

{
    HRESULT hr = S_OK;

    if (bSelect) {
        // Always make sure the menuButton is attached
        hr = pControlbar->Attach(MENUBUTTON, pMenuButton);

        hr = pMenuButton->SetButtonState(IDR_STATE_MENU, HIDDEN, FALSE);
        hr = pMenuButton->SetButtonState(IDR_STATE_MENU, ENABLED, TRUE);
    } else if (!bSelect) {
        hr = pMenuButton->SetButtonState(IDR_STATE_MENU, ENABLED, FALSE);
        hr = pMenuButton->SetButtonState(IDR_STATE_MENU, HIDDEN, TRUE);
    }

    return hr;
}

Member Data Documentation

CSpaceStation [private]

Definition at line 58 of file space.h.

BOOL CRocket::isDeleted [private]

Definition at line 83 of file space.h.

enum CRocket::ROCKET_STATUS CRocket::iStatus [private]
enum { ... } CRocket::iStatus [private]
enum { ... } CRocket::iStatus [private]
enum { ... } CRocket::iStatus [private]
enum CRocket::ROCKET_STATUS CRocket::iStatus [private]
enum { ... } CRocket::iStatus [private]
enum { ... } CRocket::iStatus [private]
LONG CRocket::lHeight [private]

Definition at line 44 of file space.h.

LONG CRocket::lPayload [private]

Definition at line 45 of file space.h.

LONG CRocket::lWeight [private]

Definition at line 43 of file space.h.

CSpaceVehicle* CRocket::m_pParent [private]

Definition at line 81 of file space.h.

LONG_PTR CRocket::m_ppHandle [private]

Definition at line 72 of file space.h.

CSpaceStation * CRocket::m_pSpaceStation [private]

Definition at line 59 of file space.h.

int CRocket::nId [private]

Definition at line 69 of file space.h.

_TCHAR * CRocket::szName [private]

Definition at line 42 of file space.h.

static const GUID CRocket::thisGuid = { 0x29743811, 0x4c4b, 0x11d2, { 0x89, 0xd8, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28 } } [static, private]

Reimplemented from CDelegationBase.

Definition at line 40 of file space.h.

The documentation for this class was generated from the following files:
  • SysMgmt/MMC/ActiveX/space.h
  • SysMgmt/MMC/CMenu/space.h
  • SysMgmt/MMC/Complete/space.h
  • SysMgmt/MMC/CutCopy/space.h
  • SysMgmt/MMC/Extens/space.h
  • SysMgmt/MMC/Menubtn/space.h
  • SysMgmt/MMC/Multisel/space.h
  • SysMgmt/MMC/Nodes/space.h
  • SysMgmt/MMC/Openserv/space.h
  • SysMgmt/MMC/Proppage/space.h
  • SysMgmt/MMC/Taskpads/space.h
  • SysMgmt/MMC/Toolbar/space.h
  • SysMgmt/MMC/WMI/space.h
  • SysMgmt/MMC/ActiveX/space.Cpp
  • SysMgmt/MMC/CMenu/space.Cpp
  • SysMgmt/MMC/Complete/space.Cpp
  • SysMgmt/MMC/CutCopy/space.Cpp
  • SysMgmt/MMC/Extens/space.Cpp
  • SysMgmt/MMC/Menubtn/space.Cpp
  • SysMgmt/MMC/Multisel/space.Cpp
  • SysMgmt/MMC/Nodes/space.Cpp
  • SysMgmt/MMC/Openserv/space.Cpp
  • SysMgmt/MMC/Proppage/space.Cpp
  • SysMgmt/MMC/Taskpads/space.Cpp
  • SysMgmt/MMC/Toolbar/space.Cpp
  • SysMgmt/MMC/WMI/space.Cpp
Generated on Wed Nov 13 2024 16:57:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CRow Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Protected Attributes | Friends

CRow Class Reference

#include "crow.h"

Inherits CBaseObj, and CDataAccess.

List of all members.

Public Member Functions

CRow ()
CRow (CMainWindow *pCMainWindow, CMDIChild *pCMDIChild=NULL)
CRow (LPUNKNOWN)
virtual | ~CRow ()
virtual | ~CRow (void)
void | AddEOL ()
void | AdjustStartLocationForEOL ()
void | AllocProxyBuffer (ATLCOLUMNINFO *prgColInfo, int cNumCols)
virtual HRESULT | AutoQI (DWORD dwCreateOpts)
virtual HRESULT | AutoRelease ()
virtual HRESULT | Bind (CAggregate *pCAggregate, WCHAR *pwszURL, DBBINDURLFLAG dwBindFlags, REFGUID rguidObjectType, REFIID riid, IUnknown **ppIUnknown)
int | CalculateRowData (ATLCOLUMNINFO *prgColInfo, ULONG cNumCols, bool bAddEOL=false)
int | CalculateRowDataToDelete (ATLCOLUMNINFO *prgColInfo, ULONG cNumCols, bool bAddEOL=false)
virtual HRESULT | CreateCommand (CAggregate *pCAggregate, REFIID riid, IUnknown **ppIUnknown)
int | CreateDefaultRow (ATLCOLUMNINFO *prgColInfo, ULONG cNumCols, bool bAddEOL=false)
virtual HRESULT | DisplayObject ()
int | FetchColumnString (char *pszColData, char *&pPos)
BOOL FInit (CRowset *)
BOOL | FInit (CDBSession *, CFileIO *, DBCOUNTITEM)
BOOL | GetColumnOrdinal (CFileIO *, DBID *, DBORDINAL *)
virtual HRESULT | GetColumns (ULONG cColAccess, DBCOLUMNACCESS *rgColAccess)
virtual REFIID | GetDefaultInterface ()
DBORDINAL | GetExtraColCount ()
DBCOLUMNINFO * | GetExtraColumnInfo ()
CFileIO * GetFileObj ()
virtual IUnknown ** | GetInterfaceAddress (REFIID riid)
virtual WCHAR * | GetObjectDesc ()
virtual LONG | GetObjectImage ()
virtual UINT | GetObjectMenu ()
virtual WCHAR * | GetObjectName ()
void | GetProxyData (ATLCOLUMNINFO *pColInfo, ULONG cCols)
ROWBUFF * GetRowBuff ()
bool | HasEOL (BYTE *pbEOF)
virtual HRESULT | Open (CAggregate *pCAggregate, DBID *pColumnID, REFGUID rguidObjectType, REFIID riid, IUnknown **ppIUnknown)
virtual HRESULT | OpenRowset (CAggregate *pCAggregate, DBID *pTableID, DBID *pIndexID, REFIID riid, ULONG cPropSets, DBPROPSET *rgPropSets, IUnknown **ppIUnknown)
STDMETHODIMP | QueryInterface (REFIID, LPVOID *)
STDMETHODIMP | SetRowHandle (HROW)
virtual HRESULT | SetupColAccess (BINDCOLS eBindCols=BIND_ALLCOLS)
STDMETHODIMP_ (DBREFCOUNT) Release(void)
STDMETHODIMP_ (DBREFCOUNT) AddRef(void)
void | StoreInProxy (unsigned int iCol, char *szColumnString, ATLCOLUMNINFO *pColInfo)
int | Update (ATLCOLUMNINFO *prgColInfo, ULONG cCols)

Public Attributes

long | m_bmk
bool | m_bRetrieved
int | m_cbRowSize
ULONG m_cColAccess
HROW | m_hSourceRow
BYTE * | m_pbProxyData
char * | m_pbStartLoc
IBindResource * | m_pIBindResource
IColumnsInfo2 * | m_pIColumnsInfo2
ICreateRow * | m_pICreateRow
IDBCreateCommand * | m_pIDBCreateCommand
IGetSession * | m_pIGetSession
IRow * | m_pIRow
IRowChange * | m_pIRowChange
IRowSchemaChange * | m_pIRowSchemaChange
IScopedOperations * | m_pIScopedOperations
DBCOLUMNACCESS * | m_rgColAccess

Protected Attributes

DBLENGTH | m_cbRowSize
DBORDINAL | m_cExtraCols
DBREFCOUNT | m_cRef
HROW | m_hRow
CFileIO * m_pFileio
PIMPICOLUMNSINFO m_pIColumnsInfo
PIMPICONVERTTYPE m_pIConvertType
PIMPIGETSESSION m_pIGetSession
PIMPIROW m_pIRow
PIMPIROWCHANGE m_pIRowChange
CBaseObj * m_pParentObj
BYTE * | m_pRowBuff
DBCOLUMNINFO | m_rgExtracolinfo [EXTRA_COLUMNS]

Friends

class | CImpIColumnsInfo
class | CImpIConvertType
class | CImpIGetSession
class | CImpIRow
class | CImpIRowChange
class | CStream

Detailed Description

Definition at line 28 of file crow.h.

Constructor & Destructor Documentation

CRow::CRow ( ) [inline]

Definition at line 38 of file crow.h.

  {
    m_pbStartLoc = NULL;
    m_bmk = 0;
    m_cbRowSize = 0;
    m_pbProxyData = NULL;
//    m_pbUpdateProxy = NULL;
    m_bRetrieved = false;
  }

CRow::CRow | ( | CMainWindow * | pCMainWindow,
 |  | CMDIChild * | pCMDIChild = NULL
 | ) |  |

Definition at line 22 of file crow.cpp.

  : CDataAccess(eCRow, pCMainWindow, pCMDIChild)
{
  //Row
  m_pIRow             = NULL;//Row Interface
  m_pIGetSession          = NULL;//Row Interface

  m_pIColumnsInfo2        = NULL;//Row Interface
  m_pICreateRow         = NULL;//Row Interface
  m_pIDBCreateCommand       = NULL;//Row Interface
  m_pIRowChange         = NULL;//Row Interface
  m_pIRowSchemaChange       = NULL;//Row Interface
  m_pIBindResource        = NULL;//Row Interface
  m_pIScopedOperations      = NULL;//Row Interface

  //ColAccess
  m_cColAccess  = 0;
  m_rgColAccess   = NULL;

  //Listeners

  //Data
  m_hSourceRow  = NULL;
}

CRow::~CRow ( void ) [virtual]

Definition at line 52 of file crow.cpp.

{
  ReleaseObject(0);
}

CRow::CRow ( LPUNKNOWN pUnkOuter )

Definition at line 25 of file row.cpp.

  : CBaseObj( BOT_ROW )
{
  //  Initialize simple member vars
    m_cRef          = 0L;
  m_pUnkOuter   = pUnkOuter ? pUnkOuter : this;
  m_pFileio   = NULL;
  m_cbRowSize   = 0;
  m_pRowBuff    = NULL;

  m_pParentObj  = NULL;

  m_pIRow       = NULL;
  m_pIColumnsInfo   = NULL;
  m_pIConvertType   = NULL;
  m_pIGetSession    = NULL;
  m_pIRowChange   = NULL;

  // Fill in information about the ROW object's default stream
  // This is the only extra column that Sample Provider support
  m_rgExtracolinfo[DEFAULT_STREAM].wType      = DBTYPE_IUNKNOWN;
  m_rgExtracolinfo[DEFAULT_STREAM].ulColumnSize = sizeof(IUnknown *);
  m_rgExtracolinfo[DEFAULT_STREAM].pwszName   = NULL;
  m_rgExtracolinfo[DEFAULT_STREAM].pTypeInfo    = NULL;
  m_rgExtracolinfo[DEFAULT_STREAM].iOrdinal   = 0;
  m_rgExtracolinfo[DEFAULT_STREAM].dwFlags    = DBCOLUMNFLAGS_ISDEFAULTSTREAM;
  m_rgExtracolinfo[DEFAULT_STREAM].bPrecision   = ~0;
  m_rgExtracolinfo[DEFAULT_STREAM].bScale     = ~0;
  memcpy(&m_rgExtracolinfo[DEFAULT_STREAM].columnid, &DBROWCOL_DEFAULTSTREAM,
      sizeof(DBID));

  m_cExtraCols    = EXTRA_COLUMNS;

  //Associated Row Handle
  m_hRow        = DB_NULL_HROW;

  // Increment global object count.
    OBJECT_CONSTRUCTED();
}

virtual CRow::~CRow ( void ) [virtual]

Member Function Documentation

void CRow::AddEOL ( )

Definition at line 293 of file crow.cpp.

{
  //assumes the space has already been allocated to do this
  char * pbEOR = m_pbStartLoc + m_cbRowSize;
    *pbEOR++ = '\r';
  *pbEOR = '\n';

}

void CRow::AdjustStartLocationForEOL ( ) [inline]

Definition at line 59 of file crow.h.

{ m_pbStartLoc +=2; }  // previous line had EOL added

void CRow::AllocProxyBuffer | ( | ATLCOLUMNINFO * | prgColInfo,
 |  | int | cNumCols
 | ) |  |

Definition at line 7 of file crow.cpp.

{
  ULONG ulSize = 0;

  for (int i = 0; i < cNumCols; i++)
  {
    switch(prgColInfo[i].wType)
      {
      case DBTYPE_I4:
        ulSize += 4;
        break;
      case DBTYPE_STR:
        ulSize += prgColInfo[i].ulColumnSize;
        break;
  #ifdef _DEBUG
      default:
      // the types in the column info structures should always be correct but
      // this is just a precaution
        _ASSERTE(0);
        return;
  #endif
      }
  }
  m_pbProxyData = new BYTE[ulSize];
  memset(m_pbProxyData,0,ulSize);
}

HRESULT CRow::AutoQI ( DWORD dwCreateOpts ) [virtual]

Reimplemented from CDataAccess.

Definition at line 109 of file crow.cpp.

{
  //Delegate First so we have base interfaces
  CDataAccess::AutoQI(dwCreateOpts);

  //[MANDATORY] Obtain [mandatory] interfaces
  if(dwCreateOpts & CREATE_QI_MANDATORY)
  {
    OBTAIN_INTERFACE(IRow);
    OBTAIN_INTERFACE(IGetSession);
  }

  //Auto QI
  if(dwCreateOpts & CREATE_QI_OPTIONAL)
  {
    OBTAIN_INTERFACE(IColumnsInfo2);
    OBTAIN_INTERFACE(ICreateRow);
    OBTAIN_INTERFACE(IDBCreateCommand);
    OBTAIN_INTERFACE(IRowChange);
    OBTAIN_INTERFACE(IRowSchemaChange);
    OBTAIN_INTERFACE(IBindResource);
    OBTAIN_INTERFACE(IScopedOperations);
  }

  return S_OK;
}

HRESULT CRow::AutoRelease ( ) [virtual]

Reimplemented from CDataAccess.

Definition at line 83 of file crow.cpp.

{
  m_cColAccess = 0;
  SAFE_FREE(m_rgColAccess);

  //Rowset
  RELEASE_INTERFACE(IRow);
  RELEASE_INTERFACE(IGetSession);

  RELEASE_INTERFACE(IColumnsInfo2);
  RELEASE_INTERFACE(ICreateRow);
  RELEASE_INTERFACE(IDBCreateCommand);
  RELEASE_INTERFACE(IRowChange);
  RELEASE_INTERFACE(IRowSchemaChange);
  RELEASE_INTERFACE(IBindResource);
  RELEASE_INTERFACE(IScopedOperations);

  //Delegate
  return CDataAccess::AutoRelease();
}

HRESULT CRow::Bind | ( | CAggregate * | pCAggregate,
 |  | WCHAR * | pwszURL,
 |  | DBBINDURLFLAG | dwBindFlags,
 |  | REFGUID | rguidObjectType,
 |  | REFIID | riid,
 |  | IUnknown ** | ppIUnknown |
 | ) |  |  | [virtual]

Definition at line 493 of file crow.cpp.

{
  HRESULT hr = S_OK;
  DBBINDSTATUS dwBindStatus = 0;

  if(m_pIBindResource == NULL)
    return E_FAIL;

  //Open
  XTEST(hr = m_pIBindResource->Bind(pCAggregate, pwszURL, dwBindFlags, rguidObjectType,  riid, NULL, NULL, &dwBindStatus, ppIUnknown));
  TESTC(TRACE_METHOD(hr, L"IBindResource::Bind(0x%p, \"%s\", 0x%08x, %s, %s, NULL, NULL, &0x%p, &0x%p)", pCAggregate, pwszURL, dwBindFlags, GetObjectTypeName(rguidObjectType), GetInterfaceName(riid), &dwBindStatus, ppIUnknown ? *ppIUnknown : NULL));

  //Handle Aggregation
  if(pCAggregate)
    TESTC(hr = pCAggregate->HandleAggregation(riid, ppIUnknown));

CLEANUP:
  return hr;
} //CRow::Bind

int CRow::CalculateRowData | ( | ATLCOLUMNINFO * | prgColInfo,
 |  | ULONG | cNumCols,
 |  | bool | bAddEOL = false
 | ) |  |

Definition at line 114 of file crow.cpp.

{
  ULONG nBytesNeeded = 0;

  for (ULONG i = 0; i < cNumCols; i++)
  {

    void * pvBuffer = m_pbProxyData + prgColInfo[i].cbOffset;

    switch(prgColInfo[i].wType)
    {
    case DBTYPE_I4:
      if (!(prgColInfo[i].dwFlags & DBCOLUMNFLAGS_ISBOOKMARK))
      {
        //convert to string
        char szTemp[MAX_COLUMNSIZE];
        _itoa(*((long*)pvBuffer), szTemp, 10);
        nBytesNeeded += _tcslen(szTemp);
      }
      else
        continue;

      break;
    case DBTYPE_STR:
      nBytesNeeded += _tcslen((char*)pvBuffer);
      if(_tcslen((char*)pvBuffer)> prgColInfo[i].ulColumnSize)
        return -1;
      break;
#ifdef _DEBUG
    default:
    // the types in the column info structures should always be correct but
      // this is just a precaution
      _ASSERTE(0);
      return -1;
#endif

    }

    nBytesNeeded++; // add one byte for the comma
  }

  nBytesNeeded--; // subtract the count which was added for the comma

  if (bAddEOL)
    nBytesNeeded += 2;

  return (int)(nBytesNeeded - m_cbRowSize) < 0 ? 0 : (int)(nBytesNeeded - m_cbRowSize);
}

int CRow::CalculateRowDataToDelete | ( | ATLCOLUMNINFO * | prgColInfo,
 |  | ULONG | cNumCols,
 |  | bool | bAddEOL = false
 | ) |  |

Definition at line 164 of file crow.cpp.

{
  ULONG nBytesNeeded = 0;

  for (ULONG i = 0; i < cNumCols; i++)
  {

    void * pvBuffer = m_pbProxyData + prgColInfo[i].cbOffset;

    switch(prgColInfo[i].wType)
    {
    case DBTYPE_I4:
      if (!(prgColInfo[i].dwFlags & DBCOLUMNFLAGS_ISBOOKMARK))
      {
        //convert to string
        char szTemp[MAX_COLUMNSIZE];
        _itoa(*((long*)pvBuffer), szTemp, 10);
        nBytesNeeded += _tcslen(szTemp);
      }
      else
        continue;

      break;
    case DBTYPE_STR:
      nBytesNeeded += _tcslen((char*)pvBuffer);
      if(_tcslen((char*)pvBuffer)> prgColInfo[i].ulColumnSize)
        return -1;
      break;
#ifdef _DEBUG
    default:
    // the types in the column info structures should always be correct but
      // this is just a precaution
      _ASSERTE(0);
      return -1;
#endif

    }

    nBytesNeeded++; // add one byte for the comma
  }

  nBytesNeeded--; // subtract the count which was added for the comma

  if (bAddEOL)
    nBytesNeeded += 2;

  return (int)(m_cbRowSize - nBytesNeeded);
}

HRESULT CRow::CreateCommand | ( | CAggregate * | pCAggregate,
 |  | REFIID | riid,
 |  | IUnknown ** | ppIUnknown |
 | ) |  |  | [virtual]

Definition at line 202 of file crow.cpp.

{
  HRESULT       hr = S_OK;

  //Obtain the IDBCreateCommand Interface
  IDBCreateCommand* pIDBCreateCommand = SOURCE_GETINTERFACE(this, IDBCreateCommand);
  if(pIDBCreateCommand)
  {
    //CreateCommand
    XTEST(hr = pIDBCreateCommand->CreateCommand(pCAggregate, riid, ppIUnknown));
    TESTC(TRACE_METHOD(hr, L"IDBCreateCommand::CreateCommand(0x%p, %s, &0x%p)", pCAggregate, GetInterfaceName(riid), ppIUnknown ? *ppIUnknown : NULL));

    //Handle Aggregation
    if(pCAggregate)
      TESTC(hr = pCAggregate->HandleAggregation(riid, ppIUnknown));
  }

CLEANUP:
  return hr;
}

int CRow::CreateDefaultRow | ( | ATLCOLUMNINFO * | prgColInfo,
 |  | ULONG | cNumCols,
 |  | bool | bAddEOL = false
 | ) |  |

Definition at line 303 of file crow.cpp.

{
  USES_CONVERSION;
  short nBytesNeeded = 0;
  for (ULONG i = 0; i < cNumCols; i++)
  {

    void * pvBuffer = m_pbProxyData + prgColInfo[i].cbOffset;

    switch(prgColInfo[i].wType)
    {
    case DBTYPE_I4:
      if (!(prgColInfo[i].dwFlags & DBCOLUMNFLAGS_ISBOOKMARK))
      {
        //Store default '0' in the Proxy Buffer
        StoreInProxy(i, "0", prgColInfo);
        nBytesNeeded ++;
      }
      else  // Do not store if it is a bookmark
        continue;
      break;
    case DBTYPE_STR:
      // Store the name of the field

      if (_tcslen(OLE2A(prgColInfo[i].pwszName)) > 0  && _tcslen(OLE2A(prgColInfo[i].pwszName)) < prgColInfo[i].ulColumnSize)
      {
        StoreInProxy(i, OLE2A(prgColInfo[i].pwszName), prgColInfo);
        nBytesNeeded += _tcslen(OLE2A(prgColInfo[i].pwszName));
      }
      else
      {
        // Store a '?'
        StoreInProxy(i,"?", prgColInfo);
        nBytesNeeded ++;
      }
      break;
#ifdef _DEBUG
    default:
    // the types in the column info structures should always be correct but
      // this is just a precaution
      _ASSERTE(0);
      return -1;
#endif

    }

    nBytesNeeded++; // add one byte for the comma
  }
  nBytesNeeded--; // subtract the count which was added for the comma
  if (bAddEOL)
    nBytesNeeded += 2;
  return (int)(nBytesNeeded - m_cbRowSize) < 0 ? 0 : (int)(nBytesNeeded - m_cbRowSize);
}

HRESULT CRow::DisplayObject ( ) [virtual]

Reimplemented from CBase.

Definition at line 142 of file crow.cpp.

{
  HRESULT hr = S_OK;
  BINDCOLS eBindCols = (GetOptions()->m_dwAccessorOpts & ACCESSOR_BIND_BOOKMARK ? BIND_ALLCOLS : BIND_ALLCOLSEXPECTBOOKMARK);

  if(m_pCMDIChild)
  {
    //First Clear the existing Window...
    m_pCMDIChild->m_pCDataGrid->m_fLastFetchForward = FALSE;
    m_pCMDIChild->m_pCDataGrid->m_lCurPos = 0;
    TESTC(hr = m_pCMDIChild->m_pCDataGrid->ClearAll());
  }

  //Setup ColumnAccess Structures, (based off the ColumnInfo)
  TESTC(hr = SetupColAccess(eBindCols));

  if(m_pCMDIChild)
  {
    //Refresh the Columns and Rows
    TESTC(hr = m_pCMDIChild->m_pCDataGrid->RefreshData());
  }

  //Delegate
  TESTC(hr = CDataAccess::DisplayObject());

CLEANUP:
  if(m_pCMDIChild)
    m_pCMDIChild->UpdateControls();
  return hr;
}

int CRow::FetchColumnString | ( | char * | pszColData,
 |  | char *& | pPos
 | ) |  |

Definition at line 67 of file crow.cpp.

{
  // TODO: need to parse out white space before and after  column data

  if (pPos > m_pbStartLoc + m_cbRowSize - 1)
    return BAD_RECORD_FORMAT;
  while ((pPos <= (m_pbStartLoc + m_cbRowSize - 1)) && *pPos != ',')
  {
    *pszColData++ = *pPos;
    pPos++;
  }
  if (*pPos == ',')
    pPos++;

  *pszColData = '\0';
  return 0;
}

BOOL CRow::FInit ( CRowset * pParentObj )

Definition at line 116 of file row.cpp.

{
  assert(pParentObj);
  assert(pParentObj->m_pFileio);
    assert(m_pUnkOuter);

  m_pParentObj = pParentObj;
  m_pParentObj->GetOuterUnknown()->AddRef();

    // Allocate contained interface objects
  m_pIRow           = new CImpIRow( this, m_pUnkOuter );
    m_pIColumnsInfo             = new CImpIColumnsInfo( this, m_pUnkOuter );
  m_pIConvertType       = new CImpIConvertType( this, m_pUnkOuter );
  m_pIGetSession        = new CImpIGetSession( this, m_pUnkOuter );
    m_pIRowChange       = new CImpIRowChange( this, m_pUnkOuter );

  m_cbRowSize = pParentObj->m_cbRowSize;

    // if all interfaces were created, return success
    return (BOOL) (m_pIRow && m_pIColumnsInfo && m_pIConvertType &&
                   m_pIGetSession && m_pIRowChange);
}

BOOL CRow::FInit | ( | CDBSession * | pParentObj,
 |  | CFileIO * | pFileIO,
 |  | DBCOUNTITEM | ulRowNum
 | ) |  |

Definition at line 151 of file row.cpp.

{
  DBORDINAL   cCols;
  COLUMNDATA *  pColumn = NULL;

  assert(pFileIO);
    assert(m_pUnkOuter);

  m_pParentObj = pParentObj;
  m_pParentObj->GetOuterUnknown()->AddRef();

  m_pFileio = pFileIO;

    // Allocate contained interface objects
  m_pIRow           = new CImpIRow( this, m_pUnkOuter );
    m_pIColumnsInfo             = new CImpIColumnsInfo( this, m_pUnkOuter );
  m_pIConvertType       = new CImpIConvertType( this, m_pUnkOuter );
  m_pIGetSession        = new CImpIGetSession( this, m_pUnkOuter );
    m_pIRowChange       = new CImpIRowChange( this, m_pUnkOuter );

  m_cbRowSize = m_pFileio->GetRowSize();
  m_pRowBuff = new BYTE [ ROUND_UP( m_pFileio->GetRowSize() + sizeof(ROWBUFF), COLUMN_ALIGNVAL ) ];
  memset(m_pRowBuff, 0, ROUND_UP( m_pFileio->GetRowSize() + sizeof(ROWBUFF), COLUMN_ALIGNVAL ) );

  // Set up the row buff bindings
  for (cCols=1; cCols <= m_pFileio->GetColumnCnt(); cCols++)
  {
    pColumn = m_pFileio->GetColumnData(cCols, (ROWBUFF *)m_pRowBuff);
    if (FAILED(m_pFileio->SetColumnBind(cCols, pColumn)))
      return FALSE;
  }

  // Actually fetch the data
    if( S_OK != m_pFileio->Fetch( ulRowNum ) )
        return FALSE;

  ((ROWBUFF *)m_pRowBuff)->ulRefCount = 1;
  ((ROWBUFF *)m_pRowBuff)->pbBmk = (void *)ulRowNum;

    // if all interfaces were created, return success
    return (BOOL) (m_pIRow && m_pIColumnsInfo && m_pIConvertType &&
                   m_pIGetSession && m_pIRowChange && m_pFileio &&
           m_pRowBuff);
}

BOOL CRow::GetColumnOrdinal | ( | CFileIO * | pFileio,
 |  | DBID * | pColumnID,
 |  | DBORDINAL * | pcCol
 | ) |  |

Definition at line 376 of file row.cpp.

{
  if( (pColumnID->eKind == DBKIND_GUID_PROPID) &&
    (pColumnID->uGuid.guid == GUID_NULL)     &&
    (pColumnID->uName.ulPropid >= 1)          &&
        (pColumnID->uName.ulPropid <= pFileio->GetColumnCnt()) )
    {
        if( pcCol )
      *pcCol = pColumnID->uName.ulPropid;
    return TRUE;
    }
    else
        return FALSE;
}

HRESULT CRow::GetColumns | ( | ULONG | cColAccess,
 |  | DBCOLUMNACCESS * | rgColAccess |
 | ) |  |  | [virtual]

Definition at line 442 of file crow.cpp.

{
  HRESULT hr = S_OK;

  if(m_pIRow == NULL)
    return E_FAIL;

  //GetColumns
  XTEST(hr = m_pIRow->GetColumns(cColAccess, rgColAccess));
  TESTC(TRACE_METHOD(hr, L"IRow::GetColumns(%lu, 0x%p)", cColAccess, rgColAccess));

CLEANUP:
  return hr;
}

virtual REFIID CRow::GetDefaultInterface ( ) [inline, virtual]

Implements CBase.

Definition at line 42 of file crow.h.

{ return IID_IRow;      }

DBORDINAL CRow::GetExtraColCount ( ) [inline]

Definition at line 110 of file row.h.

{ return m_cExtraCols; };

DBCOLUMNINFO* CRow::GetExtraColumnInfo ( ) [inline]

Definition at line 112 of file row.h.

{ return m_rgExtracolinfo; };

CFileIO * CRow::GetFileObj ( )

Definition at line 359 of file row.cpp.

{
  if( BOT_ROWSET == m_pParentObj->GetBaseObjectType() )
    return ((CRowset *)m_pParentObj)->m_pFileio;
  else
  {
    assert( BOT_SESSION == m_pParentObj->GetBaseObjectType() );
    return m_pFileio;
  }
}

IUnknown ** CRow::GetInterfaceAddress ( REFIID riid ) [virtual]

Reimplemented from CDataAccess.

Definition at line 62 of file crow.cpp.

{
  HANDLE_GETINTERFACE(IRow);
  HANDLE_GETINTERFACE(IGetSession);
  HANDLE_GETINTERFACE(IColumnsInfo2);
  HANDLE_GETINTERFACE(ICreateRow);
  HANDLE_GETINTERFACE(IDBCreateCommand);
  HANDLE_GETINTERFACE(IRowChange);
  HANDLE_GETINTERFACE(IRowSchemaChange);
  HANDLE_GETINTERFACE(IBindResource);
  HANDLE_GETINTERFACE(IScopedOperations);

  //Otherwise delegate
  return CDataAccess::GetInterfaceAddress(riid);
}

WCHAR * CRow::GetObjectDesc ( ) [virtual]

Reimplemented from CBase.

Definition at line 179 of file crow.cpp.

{
  HRESULT hr = S_OK;

  if(!m_strObjectDesc && m_hSourceRow)
  {
    WCHAR* pwszValue = NULL;

    //0x00000000 = 1 Byte = 2 Asci Chars + "0x" + NULL Terminator
    SAFE_ALLOC(pwszValue, WCHAR, POINTER_DISPLAYSIZE);
    StringFormat(pwszValue, POINTER_DISPLAYSIZE, L"0x%p", (HANDLE)m_hSourceRow);
    m_strObjectDesc.Attach(pwszValue);
  }

CLEANUP:
  return m_strObjectDesc;
}

virtual LONG CRow::GetObjectImage ( ) [inline, virtual]

Implements CBase.

Definition at line 41 of file crow.h.

{ return IMAGE_FORM;    }

virtual UINT CRow::GetObjectMenu ( ) [inline, virtual]

Implements CBase.

Definition at line 40 of file crow.h.

{ return IDM_ROWMENU;   }

virtual WCHAR* CRow::GetObjectName ( ) [inline, virtual]

Implements CBase.

Definition at line 39 of file crow.h.

{ return L"Row";      }

void CRow::GetProxyData | ( | ATLCOLUMNINFO * | pColInfo,
 |  | ULONG | cCols
 | ) |  |

Definition at line 36 of file crow.cpp.

{
//  if (m_bRetrieved)
//    return;  // already have the data for the row

  char * pPos = m_pbStartLoc;
  char szColumnString[MAX_COLUMNSIZE];

  // pPos will be incremented as data is fetched and can be passed into
  // subsequent calls

  //TODO: optimize by passing in the proxybuffer  into FetchColumnString for string fields
  for (unsigned int i = 0; i < cCols; i++)
  {
//    if (!(pColInfo[i].dwFlags &= DBCOLUMNFLAGS_ISBOOKMARK))
    if (!(pColInfo[i].dwFlags & DBCOLUMNFLAGS_ISBOOKMARK))
    {
      int nResult = FetchColumnString(szColumnString, pPos);
      if (nResult == BAD_RECORD_FORMAT)
        return;  // TODO: handle bad file info
      StoreInProxy(i, szColumnString, pColInfo);
    }
    else
      StoreInProxy(i, NULL, pColInfo);

  }

  m_bRetrieved = true;
}

ROWBUFF * CRow::GetRowBuff ( )

Definition at line 343 of file row.cpp.

{
  if( BOT_ROWSET == m_pParentObj->GetBaseObjectType() )
    return ((CRowset *)m_pParentObj)->GetRowBuff( m_hRow, TRUE );
  else
  {
    assert( BOT_SESSION == m_pParentObj->GetBaseObjectType() );
    return (ROWBUFF *)m_pRowBuff;
  }
}

bool CRow::HasEOL ( BYTE * pbEOF )

Definition at line 284 of file crow.cpp.

{
  char * pbEOR = m_pbStartLoc + m_cbRowSize;
  if (pbEOR <= (char *)pbEOF && pbEOR[0] == '\r' && pbEOR[1] == '\n')
    return true;
  else
    return false;
}

HRESULT CRow::Open | ( | CAggregate * | pCAggregate,
 |  | DBID * | pColumnID,
 |  | REFGUID | rguidObjectType,
 |  | REFIID | riid,
 |  | IUnknown ** | ppIUnknown |
 | ) |  |  | [virtual]

Definition at line 463 of file crow.cpp.

{
  HRESULT hr = S_OK;

  if(m_pIRow == NULL)
    return E_FAIL;

  //Convert the DBID to a string for display...
  WCHAR wszBuffer[MAX_QUERY_LEN+1] = {0};
  DBIDToString(pColumnID, wszBuffer, MAX_QUERY_LEN);

  //Open
  XTEST(hr = m_pIRow->Open(pCAggregate, pColumnID, rguidObjectType, 0, riid, ppIUnknown));
  TESTC(TRACE_METHOD(hr, L"IRow::Open(0x%p, %s, %s, 0, %s, &0x%p)", pCAggregate, wszBuffer, GetObjectTypeName(rguidObjectType), GetInterfaceName(riid), ppIUnknown ? *ppIUnknown : NULL));

  //Handle Aggregation
  if(pCAggregate)
    TESTC(hr = pCAggregate->HandleAggregation(riid, ppIUnknown));

CLEANUP:
  return hr;
}

HRESULT CRow::OpenRowset | ( | CAggregate * | pCAggregate,
 |  | DBID * | pTableID,
 |  | DBID * | pIndexID,
 |  | REFIID | riid,
 |  | ULONG | cPropSets,
 |  | DBPROPSET * | rgPropSets,
 |  | IUnknown ** | ppIUnknown |
 | ) |  |  | [virtual]

Definition at line 228 of file crow.cpp.

{
  HRESULT       hr = E_FAIL;      // HRESULT

  if(!m_pIScopedOperations)
    return E_FAIL;

  WCHAR wszTableName[MAX_QUERY_LEN+1];
  WCHAR wszIndexName[MAX_QUERY_LEN+1];

  // From IOpenRowset, get a rowset object
  DBIDToString(pTableID, wszTableName, MAX_QUERY_LEN);
  DBIDToString(pIndexID, wszIndexName, MAX_QUERY_LEN);

  XTEST_(hr = m_pIScopedOperations->OpenRowset(
              pCAggregate,    // pUnkOuter
              pTableID,     // pTableID
              pIndexID,     // pIndexID
              riid,       // refiid
              cPropSets,      // cProperties
              rgPropSets,     // rgProperties
              ppIUnknown),S_OK);  // IRowset pointer
  TRACE_METHOD(hr, L"IScopedOperations::OpenRowset(0x%p, %s, %s, %s, %d, 0x%p, &0x%p)", pCAggregate, wszTableName, wszIndexName, GetInterfaceName(riid), cPropSets, rgPropSets, ppIUnknown ? *ppIUnknown : NULL);

  //Display Errors (if occurred)
  TESTC(hr = DisplayPropErrors(hr, cPropSets, rgPropSets));

  //Handle Aggregation
  if(pCAggregate)
    TESTC(hr = pCAggregate->HandleAggregation(riid, ppIUnknown));

CLEANUP:
  return hr;
}

STDMETHODIMP CRow::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 216 of file row.cpp.

{
  if( NULL == ppv )
    return E_INVALIDARG;

  //  Place NULL in *ppv in case of failure
  *ppv = NULL;

    //  This is the non-delegating IUnknown implementation
  if( riid == IID_IUnknown )
    *ppv = (LPVOID) this;
  else if( riid == IID_IRow )
    *ppv = (LPVOID) m_pIRow;
  else if( riid == IID_IColumnsInfo )
    *ppv = (LPVOID) m_pIColumnsInfo;
  else if( riid == IID_IConvertType )
    *ppv = (LPVOID) m_pIConvertType;
  else if( riid == IID_IGetSession )
    *ppv = m_pIGetSession;
  else if( riid == IID_IRowChange )
    *ppv = m_pIRowChange;

    //  If we're going to return an interface, AddRef it first
    if( *ppv )
  {
        ((LPUNKNOWN) *ppv)->AddRef();
        return ResultFromScode( S_OK );
  }
    else
        return ResultFromScode( E_NOINTERFACE );
}

STDMETHODIMP CRow::SetRowHandle ( HROW hRow )

Definition at line 299 of file row.cpp.

{
  IRowset *   pIRowset  = NULL;
  HRESULT     hr      = DB_E_NOSOURCEOBJECT;
  DBROWSTATUS   dwRowStatus = DBROWSTATUS_S_OK;

  //Obtain the parent rowset...
  if( m_pParentObj )
  {
    hr = m_pParentObj->QueryInterface(IID_IRowset, (void**)&pIRowset);

    if( pIRowset )
    {
      //AddRef the row,
      //To be able to hang onto the row, and determine if its invalid or not...
      if(FAILED(hr = pIRowset->AddRefRows(1, &hRow, NULL, &dwRowStatus)))
      {
        switch(dwRowStatus)
        {
          case DBROWSTATUS_E_DELETED:
            hr = DB_E_DELETEDROW;
            break;

          default:
            hr = DB_E_BADROWHANDLE;
            break;
        };
      }

      //We made it this far, store the row...
      if( SUCCEEDED(hr) )
        m_hRow = hRow;
      pIRowset->Release();
    }
  }

  return hr;
}

HRESULT CRow::SetupColAccess ( BINDCOLS eBindCols = BIND_ALLCOLS ) [virtual]

Definition at line 268 of file crow.cpp.

{
  HRESULT hr = S_OK;
  DBLENGTH dwOffset = 0;
  ULONG i;

  //Only capable of the Following Converions (for Display)
  DWORD  dwMaxLength    = GetOptions()->m_dwMaxLength;
  DWORD  dwAccessorOpts = GetOptions()->m_dwAccessorOpts;

  if(m_pIColumnsInfo == NULL)
    return E_FAIL;

  //GetColumnInfo
  GetColInfo();

  //Alloc the space to hold the ColumnAccess structs
  ULONG cBindings = 0;
  DBBINDING* rgBindings = NULL;
  SAFE_ALLOC(m_rgColAccess, DBCOLUMNACCESS, m_ColumnInfo.GetCount());
  SAFE_ALLOC(rgBindings, DBBINDING, m_ColumnInfo.GetCount());

  //Figure out how big to make the buffer...
  for(i=0; i<m_ColumnInfo.GetCount(); i++)
  {
    //Offset
    m_rgColAccess[i].cbMaxLen = GetMaxDisplaySize(GetOptions()->GetBindingType(m_ColumnInfo[i].wType), m_ColumnInfo[i].wType, m_ColumnInfo[i].ulColumnSize, dwMaxLength);
    dwOffset = ROUNDUP( dwOffset + m_rgColAccess[i].cbMaxLen );
  }

  //Size for pData
  SAFE_REALLOC(m_pData, BYTE, dwOffset);

  dwOffset = 0;
  m_cColAccess = 0;
  cBindings = 0;
  for(i=0; i<m_ColumnInfo.GetCount(); i++)
  {
    DBCOLUMNINFO* pColInfo  = &m_ColumnInfo[i];
    DBCOLUMNACCESS* pColAccess  = &m_rgColAccess[m_cColAccess];
    DBBINDING*    pBinding  = &rgBindings[cBindings];

    //Setup the Bindings
    pColAccess->columnid    = pColInfo->columnid;
    pColAccess->bPrecision    = pColInfo->bPrecision;
    pColAccess->bScale      = pColInfo->bScale;
    pColAccess->wType     = GetOptions()->GetBindingType(pColInfo->wType);
    pColAccess->cbDataLen   = 0;

    //NOTE: This is setup above in the Previous for loop...
    pColAccess->cbMaxLen    = m_rgColAccess[i].cbMaxLen;

    //BLOB or IUnknown Bindings
    if(pColAccess->wType == DBTYPE_IUNKNOWN || pColInfo->wType == DBTYPE_IUNKNOWN ||
      (pColInfo->dwFlags & DBCOLUMNFLAGS_ISLONG && (dwAccessorOpts & (ACCESSOR_BLOB_ISEQSTREAM|ACCESSOR_BLOB_ILOCKBYTES|ACCESSOR_BLOB_ISTORAGE|ACCESSOR_BLOB_ISTREAM))))
    {
      pColAccess->wType   = DBTYPE_IUNKNOWN;
      pColAccess->cbMaxLen  = sizeof(IUnknown*);
    }

    //If the consumer requested not to bind the Value in Options, then set pData = NULL
    //This is how the 2.5 spec says to indicate VALUE is not bound (since their is no dwPart).
    pColAccess->pData     = NULL;
    if(dwAccessorOpts & ACCESSOR_BIND_VALUE)
      pColAccess->pData   = (BYTE*)m_pData + dwOffset;

    //Initialize the Status to an error, so we don't end up freeing outofline
    //data we haven't retreived yet...
    pColAccess->dwStatus    = DBSTATUS_E_UNAVAILABLE;

    //Special Handling for other non-OLE DB defined convertable types to WSTR
    //NOTE: The spec requires all supported types to be converted to
    //WSTR, but this only applies where the OLE DB conversion is defined.
    //Some are not defined so we need to bind nativly.
    switch(pColInfo->wType)
    {
      case DBTYPE_IUNKNOWN:
      case DBTYPE_IDISPATCH:
        pColAccess->wType   = pColInfo->wType;
        pColAccess->cbMaxLen  = sizeof(IUnknown*);
        break;

      case DBTYPE_HCHAPTER:
        pColAccess->wType   = pColInfo->wType;
        pColAccess->cbMaxLen  = sizeof(HCHAPTER);
        break;

      default:
        //DBTYPE_VECTOR
        if(pColInfo->wType  & DBTYPE_VECTOR)
        {
          pColAccess->wType = pColInfo->wType;
          pColAccess->cbMaxLen= sizeof(DBVECTOR);
        }

        //DBTYPE_ARRAY
        if(pColInfo->wType  & DBTYPE_ARRAY)
        {
          pColAccess->wType = pColInfo->wType;
          pColAccess->cbMaxLen= sizeof(SAFEARRAY*);
        }
        break;
    };

    //Offset
    dwOffset += pColAccess->cbMaxLen;
    dwOffset = ROUNDUP( dwOffset );

    //Build a real simple binding on top of this ColumnAccess struct.
    //The reason is all of our data manipulations routines deal with binding structs, so instead
    //have having numerous code lines, we will just map this to a binding struct...
    pBinding->iOrdinal    = pColInfo->iOrdinal;
    pBinding->obStatus    = (DBBYTEOFFSET)((BYTE*)&pColAccess->dwStatus - (BYTE*)m_pData);
    pBinding->obLength    = (DBBYTEOFFSET)((BYTE*)&pColAccess->cbDataLen - (BYTE*)m_pData);
    pBinding->obValue   = (DBBYTEOFFSET)((BYTE*)pColAccess->pData - (BYTE*)m_pData);

    pBinding->pTypeInfo   = NULL;
    pBinding->pObject   = NULL;
    pBinding->pBindExt    = NULL;

    pBinding->dwPart    = DBPART_LENGTH|DBPART_STATUS;
    if(pColAccess->pData)
      pBinding->dwPart  |= DBPART_VALUE;

    pBinding->dwMemOwner  = (dwAccessorOpts & ACCESSOR_OWNED_PROVIDER) ? DBMEMOWNER_PROVIDEROWNED : DBMEMOWNER_CLIENTOWNED;
    pBinding->eParamIO    = DBPARAMIO_NOTPARAM;

    pBinding->cbMaxLen    = pColAccess->cbMaxLen;
    pBinding->dwFlags   = 0;
    pBinding->wType     = pColAccess->wType;

    pBinding->bPrecision  = pColAccess->bPrecision;
    pBinding->bScale    = pColAccess->bScale;

    //Do we real want this column?
    switch(eBindCols)
    {
      case BIND_ALLCOLS:
        m_cColAccess++;
        cBindings++;
        break;

      case BIND_ALLCOLSEXPECTBOOKMARK:
        if(pColInfo->iOrdinal != 0)
        {
          m_cColAccess++;
          cBindings++;
        }
        break;

      case BIND_UPDATEABLECOLS:
        if(pColInfo->dwFlags & DBCOLUMNFLAGS_WRITE || pColInfo->dwFlags & DBCOLUMNFLAGS_WRITEUNKNOWN)
        {
          m_cColAccess++;
          cBindings++;
        }
        break;

      default:
        ASSERT(!"Unhandled Type!");
        break;
    }
  }

CLEANUP:
  m_Bindings.Attach(cBindings, rgBindings);
  return hr;
}

CRow::STDMETHODIMP_ ( DBREFCOUNT )
CRow::STDMETHODIMP_ ( DBREFCOUNT )
void CRow::StoreInProxy | ( | unsigned int | iCol,
 |  | char * | szColumnString,
 |  | ATLCOLUMNINFO * | pColInfo
 | ) |  |

Definition at line 85 of file crow.cpp.

{
  // TODO: Probably need to do something here with bookmarks
  // pColInfo is ordered by ordinal so we can do a simple array look-up
  // currently only supports DBTYPE_I4
  void * pvBuffer = m_pbProxyData + pColInfo[iCol].cbOffset;

  switch(pColInfo[iCol].wType)
  {
    case DBTYPE_I4:
      if (pColInfo[iCol].dwFlags & DBCOLUMNFLAGS_ISBOOKMARK)
        *((long *)pvBuffer) = m_bmk;
      else
        *((long *)pvBuffer) = atoi(szColumnString);
      break;
    case DBTYPE_STR:
      _tcscpy((char*) pvBuffer, szColumnString);
      break;
#ifdef _DEBUG
    default:
      // Should never get here if we have all of the types supported and we
      // validate the types at the time of reading the schema
      _ASSERTE(0);
      break;
#endif
  }
}

int CRow::Update | ( | ATLCOLUMNINFO * | prgColInfo,
 |  | ULONG | cCols
 | ) |  |

Definition at line 214 of file crow.cpp.

{
  // CDBFile will update the row size
  BYTE * pbCurrentPos = (BYTE *)m_pbStartLoc;

  int n;
  char* pszTemp;

  // copy data from proxy to the file
  for (ULONG i = 0; i < cCols; i++)
  {
    void * pvBuffer = m_pbProxyData + prgColInfo[i].cbOffset;
    switch(prgColInfo[i].wType)
    {
        case DBTYPE_I4:
          if (prgColInfo[i].dwFlags & DBCOLUMNFLAGS_ISBOOKMARK)
            continue;
          else
          {
            //convert to string
            char szTemp[MAX_COLUMNSIZE];
            _itoa(*((long*)pvBuffer), szTemp, 10);
            //copy from buffer to file
            for (int n = 0; szTemp[n] != '\0'; n++)
              *pbCurrentPos++ = szTemp[n];
          }

          break;

        case DBTYPE_STR:
          pszTemp = (char *)pvBuffer;
          for (n = 0; *pszTemp != '\0'; n++)
              *pbCurrentPos++ = *pszTemp++;
          break;
      #ifdef _DEBUG
        default:
        // the types in the column info structures should always be correct but
        // this is just a precaution
          _ASSERTE(0);
          return 0;
      #endif
    }

    if (i != cCols -1) // not the last column
      *pbCurrentPos++ = ',';

  }

/*  // fill remainder of bytes with spaces
  // This can occur because we don't allocate a new row if the updated row will be
  // smaller
  if ((pbCurrentPos  - (BYTE *)m_pbStartLoc) < m_cbRowSize)
  {
    int n = m_cbRowSize - (pbCurrentPos - (BYTE *)m_pbStartLoc);
    for (;n != 0; n--)
      *pbCurrentPos++= ' ';

  }*/

  m_cbRowSize = (ULONG) (pbCurrentPos - (BYTE *)m_pbStartLoc);

  // add seperator
//  *pbCurrentPos++ = '\r';
//  *pbCurrentPos = '\n';

  return 0;
}

Friends And Related Function Documentation

friend class CImpIColumnsInfo [friend]

Definition at line 51 of file row.h.

friend class CImpIConvertType [friend]

Definition at line 52 of file row.h.

friend class CImpIGetSession [friend]

Definition at line 53 of file row.h.

friend class CImpIRow [friend]

Definition at line 50 of file row.h.

friend class CImpIRowChange [friend]

Definition at line 54 of file row.h.

friend class CStream [friend]

Definition at line 58 of file row.h.

Member Data Documentation

long CRow::m_bmk

Definition at line 32 of file crow.h.

bool CRow::m_bRetrieved

Definition at line 36 of file crow.h.

DBLENGTH CRow::m_cbRowSize [protected]

Reimplemented from CDataAccess.

Definition at line 68 of file row.h.

int CRow::m_cbRowSize

Reimplemented from CDataAccess.

Definition at line 33 of file crow.h.

ULONG CRow::m_cColAccess

Definition at line 71 of file crow.h.

DBORDINAL CRow::m_cExtraCols [protected]

Definition at line 72 of file row.h.

DBREFCOUNT CRow::m_cRef [protected]

Reimplemented from CBase.

Definition at line 79 of file row.h.

HROW CRow::m_hRow [protected]

Definition at line 64 of file row.h.

HROW CRow::m_hSourceRow

Definition at line 75 of file crow.h.

BYTE* CRow::m_pbProxyData

Definition at line 34 of file crow.h.

char* CRow::m_pbStartLoc

Definition at line 31 of file crow.h.

CFileIO* CRow::m_pFileio [protected]

Definition at line 66 of file row.h.

IBindResource* CRow::m_pIBindResource

Definition at line 67 of file crow.h.

PIMPICOLUMNSINFO CRow::m_pIColumnsInfo [protected]

Reimplemented from CDataAccess.

Definition at line 83 of file row.h.

IColumnsInfo2* CRow::m_pIColumnsInfo2

Definition at line 62 of file crow.h.

PIMPICONVERTTYPE CRow::m_pIConvertType [protected]

Reimplemented from CDataAccess.

Definition at line 85 of file row.h.

ICreateRow* CRow::m_pICreateRow

Definition at line 63 of file crow.h.

IDBCreateCommand* CRow::m_pIDBCreateCommand

Definition at line 64 of file crow.h.

PIMPIGETSESSION CRow::m_pIGetSession [protected]

Definition at line 87 of file row.h.

IGetSession* CRow::m_pIGetSession

Definition at line 59 of file crow.h.

PIMPIROW CRow::m_pIRow [protected]

Definition at line 81 of file row.h.

IRow* CRow::m_pIRow

Definition at line 58 of file crow.h.

PIMPIROWCHANGE CRow::m_pIRowChange [protected]

Definition at line 89 of file row.h.

IRowChange* CRow::m_pIRowChange

Definition at line 65 of file crow.h.

IRowSchemaChange* CRow::m_pIRowSchemaChange

Definition at line 66 of file crow.h.

IScopedOperations* CRow::m_pIScopedOperations

Definition at line 68 of file crow.h.

CBaseObj* CRow::m_pParentObj [protected]

Definition at line 62 of file row.h.

BYTE* CRow::m_pRowBuff [protected]

Definition at line 70 of file row.h.

DBCOLUMNACCESS* CRow::m_rgColAccess

Definition at line 72 of file crow.h.

DBCOLUMNINFO CRow::m_rgExtracolinfo[EXTRA_COLUMNS] [protected]

Definition at line 74 of file row.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/omniprov/source/crow.h
  • Dataaccess/oledb/rowsetviewer/crow.h
  • Dataaccess/oledb/sampprov/row.h
  • Dataaccess/oledb/omniprov/source/crow.cpp
  • Dataaccess/oledb/rowsetviewer/crow.cpp
  • Dataaccess/oledb/sampprov/row.cpp
Generated on Wed Nov 13 2024 16:57:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CRowPosition Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CRowPosition Class Reference

#include "crowposition.h"

Inherits CContainerBase.

List of all members.

Public Member Functions

CRowPosition (CMainWindow *pCMainWindow, CMDIChild *pCMDIChild=NULL)
virtual | ~CRowPosition ()
virtual HRESULT | AutoQI (DWORD dwCreateOpts)
virtual HRESULT | AutoRelease ()
virtual REFIID | GetDefaultInterface ()
virtual IUnknown ** | GetInterfaceAddress (REFIID riid)
virtual LONG | GetObjectImage ()
virtual UINT | GetObjectMenu ()
virtual WCHAR * | GetObjectName ()
virtual HRESULT | GetRowset (REFIID riid, IUnknown **ppIUnknown)
virtual HRESULT | Initialize (IUnknown *pIUnkRowset)

Public Attributes

DWORD m_dwCookieRowPos
IRowPosition * | m_pIRowPosition

Detailed Description

Definition at line 25 of file crowposition.h.

Constructor & Destructor Documentation

CRowPosition::CRowPosition | ( | CMainWindow * | pCMainWindow,
 |  | CMDIChild * | pCMDIChild = NULL
 | ) |  |

Definition at line 22 of file crowposition.cpp.

  : CContainerBase(eCRowPosition, pCMainWindow, pCMDIChild)
{
  //RowPosition
  m_pIRowPosition         = NULL;//RowPosition Interface

  //Extra Interfaces
  m_dwCookieRowPos        = 0;
}

CRowPosition::~CRowPosition ( ) [virtual]

Definition at line 37 of file crowposition.cpp.

{
  ReleaseObject(0);
}

Member Function Documentation

HRESULT CRowPosition::AutoQI ( DWORD dwCreateOpts ) [virtual]

Reimplemented from CContainerBase.

Definition at line 77 of file crowposition.cpp.

{
  //Delegate First so we have IConnectionPointContainer
  CContainerBase::AutoQI(dwCreateOpts);

  //[MANDATORY] Obtain [mandatory] interfaces
  if(dwCreateOpts & CREATE_QI_MANDATORY)
  {
    OBTAIN_INTERFACE(IRowPosition);
  }

  //AutoQI
  if(dwCreateOpts & CREATE_QI_OPTIONAL)
  {
  }

  //Advise Listeners
  AdviseListener(IID_IRowPositionChange, &m_dwCookieRowPos);
  return S_OK;
}

HRESULT CRowPosition::AutoRelease ( ) [virtual]

Reimplemented from CContainerBase.

Definition at line 59 of file crowposition.cpp.

{
  //RowPosition
  RELEASE_INTERFACE(IRowPosition);

  //Don't Unadvise the Listeners until the Rowset goes away.
  //We want to receive and Display the ROWSET_RELEASE notifications
  UnadviseListener(IID_IRowPositionChange, &m_dwCookieRowPos);

  //Delegate
  return CContainerBase::AutoRelease();
}

virtual REFIID CRowPosition::GetDefaultInterface ( ) [inline, virtual]

Implements CBase.

Definition at line 41 of file crowposition.h.

{ return IID_IRowPosition;    }

IUnknown ** CRowPosition::GetInterfaceAddress ( REFIID riid ) [virtual]

Reimplemented from CContainerBase.

Definition at line 47 of file crowposition.cpp.

{
  HANDLE_GETINTERFACE(IRowPosition);

  //Otherwise delegate
  return CContainerBase::GetInterfaceAddress(riid);
}

virtual LONG CRowPosition::GetObjectImage ( ) [inline, virtual]

Implements CBase.

Definition at line 40 of file crowposition.h.

{ return IMAGE_ARROW_DOWN;    }

virtual UINT CRowPosition::GetObjectMenu ( ) [inline, virtual]

Implements CBase.

Definition at line 39 of file crowposition.h.

{ return IDM_ROWPOSITIONMENU; }

virtual WCHAR* CRowPosition::GetObjectName ( ) [inline, virtual]

Implements CBase.

Definition at line 38 of file crowposition.h.

{ return L"RowPosition";    }

HRESULT CRowPosition::GetRowset | ( | REFIID | riid,
 |  | IUnknown ** | ppIUnknown |
 | ) |  |  | [virtual]

Definition at line 120 of file crowposition.cpp.

{
  HRESULT hr = S_OK;

  if(m_pIRowPosition)
  {
    //IRowPosition::GetRowset
    XTEST(hr = m_pIRowPosition->GetRowset(riid, ppIUnknown));
    TESTC(TRACE_METHOD(hr, L"IRowPosition::GetRowset(%s, &0x%p)", GetInterfaceName(riid), ppIUnknown ? *ppIUnknown : NULL));
  }

CLEANUP:
  return hr;
}

HRESULT CRowPosition::Initialize ( IUnknown * pIUnkRowset ) [virtual]

Definition at line 103 of file crowposition.cpp.

{
  HRESULT hr = S_OK;

  //Initialize
  XTEST(hr = m_pIRowPosition->Initialize(pIUnkRowset));
  TESTC(TRACE_METHOD(hr, L"IRowPosition::Initialize(0x%p)", pIUnkRowset));

CLEANUP:
  return hr;
}

Member Data Documentation

DWORD CRowPosition::m_dwCookieRowPos

Definition at line 52 of file crowposition.h.

IRowPosition* CRowPosition::m_pIRowPosition

Definition at line 49 of file crowposition.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/crowposition.h
  • Dataaccess/oledb/rowsetviewer/crowposition.cpp
Generated on Wed Nov 13 2024 16:57:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CRowset Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Protected Attributes | Private Member Functions | Friends

CRowset Class Reference

#include "crowset.h"

Inherits CBaseObj, and CDataAccess.

List of all members.

Public Member Functions

CRowset (CMainWindow *pCMainWindow, CMDIChild *pCMDIChild=NULL)
CRowset (LPUNKNOWN)
virtual | ~CRowset ()
~CRowset (void)
virtual HRESULT | AddRefRows (DBROWCOUNT cRows, HROW *rghRows, ULONG *rgRefCounts=NULL)
virtual HRESULT | AutoQI (DWORD dwCreateOpts)
virtual HRESULT | AutoRelease ()
virtual HRESULT | DisplayObject ()
BOOL | FInit (CFileIO *, CBaseObj *, WCHAR *pwszFileName, WCHAR *pwszDataSource)
virtual HRESULT | GetBookmark (HROW hRow, DBBKMARK *pcbBookmark, BYTE **ppBookmark)
virtual HRESULT | GetChapter (HROW hRow, DBORDINAL iOrdinal, HCHAPTER *phChapter)
PCUTILPROP GetCUtilProp ()
virtual HRESULT | GetData (HROW hRow, HACCESSOR hAccessor=NULL, void *pData=NULL, DBPROPID dwSourceID=DBPROP_IRowset)
virtual REFIID | GetDefaultInterface ()
CFileIO * GetFileObj ()
virtual IUnknown ** | GetInterfaceAddress (REFIID riid)
virtual HRESULT | GetNextRows (DBROWOFFSET lOffset, DBROWCOUNT cRows, DBCOUNTITEM *pcRowsObtained, HROW **prghRows)
virtual WCHAR * | GetObjectDesc ()
virtual LONG | GetObjectImage ()
virtual UINT | GetObjectMenu ()
virtual WCHAR * | GetObjectName ()
virtual HRESULT | GetRowFromHROW (CAggregate *pCAggregate, HROW hRow, REFIID riid, IUnknown **ppIUnknown)
STDMETHODIMP | QueryInterface (REFIID, LPVOID *)
virtual HRESULT | ReleaseRows (DBROWCOUNT cRows, HROW *rghRows, ULONG *rgRefCounts=NULL)
virtual HRESULT | RestartPosition ()
STDMETHODIMP_ (DBREFCOUNT) Release(void)
STDMETHODIMP_ (DBREFCOUNT) AddRef(void)
virtual HRESULT | ValidateRow (HROW hRow, ULONG ulRefCount=1)

Public Attributes

DWORD m_dwCookieRowsetNotify
BOOL m_fRemoveDeleted
HCHAPTER | m_hChapter
PCCOMMAND m_pCreator
IChapteredRowset * | m_pIChapteredRowset
IGetRow * | m_pIGetRow
IRowset * | m_pIRowset
IRowsetBookmark * | m_pIRowsetBookmark
IRowsetChange * m_pIRowsetChange
IRowsetFind * | m_pIRowsetFind
IRowsetIdentity * | m_pIRowsetIdentity
IRowsetIndex * | m_pIRowsetIndex
IRowsetInfo * | m_pIRowsetInfo
IRowsetLocate * | m_pIRowsetLocate
IRowsetRefresh * | m_pIRowsetRefresh
IRowsetResynch * | m_pIRowsetResynch
IRowsetScroll * | m_pIRowsetScroll
IRowsetUpdate * | m_pIRowsetUpdate
IRowsetView * | m_pIRowsetView

Protected Attributes

DBLENGTH | m_cbRowSize
ULONG m_cbTotalRowSize
DBORDINAL | m_cCols
DBREFCOUNT | m_cRef
DBCOUNTITEM | m_cRows
UDWORD m_dwStatus
DBCOUNTITEM | m_irowFilePos
DBCOUNTITEM | m_irowLastFilePos
ULONG m_irowMin
LPEXTBUFFER m_pextbufferAccessor
CFileIO * m_pFileio
PIMPIACCESSOR m_pIAccessor
PLSTSLOT m_pIBuffer
PIMPICOLUMNSINFO m_pIColumnsInfo
PIMPICONVERTTYPE m_pIConvertType
PIMPIGETROW m_pIGetRow
PIMPIROWSET m_pIRowset
PIMPIROWSETCHANGE m_pIRowsetChange
PIMPIROWSETIDENTITY m_pIRowsetIdentity
PIMPIROWSETINFO m_pIRowsetInfo
BYTE * | m_pLastBindBase
CBaseObj * m_pParentObj
LPBITARRAY m_prowbitsIBuffer
PCUTILPROP m_pUtilProp
BYTE * | m_rgbRowData
DBREFCOUNT | m_ulRowRefCount
WCHAR | m_wszDataSourcePath [MAX_PATH]
WCHAR | m_wszFilePath [MAX_PATH]

Private Member Functions

HRESULT | CreateHelperFunctions (void)
ROWBUFF * | GetRowBuff (DBCOUNTITEM iRow, BOOL fDataLocation=FALSE)
HRESULT | Rebind (BYTE *pBase)
BOOL SupportIRowsetChange ()

Friends

class | CImpIAccessor
class | CImpIColumnsInfo
class | CImpIConvertType
class | CImpIGetRow
class | CImpIGetSession
class | CImpIRow
class | CImpIRowChange
class | CImpIRowset
class | CImpIRowsetChange
class | CImpIRowsetIdentity
class | CImpIRowsetInfo
class | CRow

Detailed Description

Definition at line 246 of file crowset.h.

Constructor & Destructor Documentation

CRowset::CRowset | ( | CMainWindow * | pCMainWindow,
 |  | CMDIChild * | pCMDIChild = NULL
 | ) |  |

Definition at line 856 of file crowset.cpp.

  : CDataAccess(eCRowset, pCMainWindow, pCMDIChild)
{
  //Rowset
//  m_pIAccessor          = NULL;//DataAccess Base Class
//  m_pIColumnsInfo         = NULL;//DataAccess Base Class
//  m_pIConvertType         = NULL;//DataAccess Base Class
  m_pIRowset            = NULL;//Rowset Interface
  m_pIRowsetInfo          = NULL;//Rowset Interface
  m_pIRowsetChange        = NULL;//Rowset Interface
  m_pIRowsetIdentity        = NULL;//Rowset Interface
  m_pIRowsetLocate        = NULL;//Rowset Interface
  m_pIRowsetFind          = NULL;//Rowset Interface
  m_pIRowsetView          = NULL;//Rowset Interface
  m_pIChapteredRowset       = NULL;//Rowset Interface
  m_pIRowsetResynch       = NULL;//Rowset Interface
  m_pIRowsetRefresh       = NULL;//Rowset Interface
  m_pIRowsetIndex         = NULL;//Rowset Interface
  m_pIRowsetScroll        = NULL;//Rowset Interface
  m_pIRowsetUpdate        = NULL;//Rowset Interface
  m_pIGetRow            = NULL;//Rowset Interface

  //TODO: Not currently doc'd?
  m_pIRowsetBookmark        = NULL;//Rowset Interface

  //Extra Interfaces
  m_dwCookieRowsetNotify      = 0;

  //Chapters
  m_hChapter            = DB_NULL_HCHAPTER;

  //Properties
  m_fRemoveDeleted        = FALSE;
}

CRowset::~CRowset ( void ) [virtual]

Definition at line 896 of file crowset.cpp.

{
  ReleaseObject(0);
}

CRowset::CRowset ( LPUNKNOWN pUnkOuter )

Definition at line 29 of file rowset.cpp.

  : CBaseObj( BOT_ROWSET )
{

    //  Initialize simple member vars
    m_cRef          = 0L;
  m_pUnkOuter   = pUnkOuter ? pUnkOuter : this;

    // Intialize buffered row count + pointers to allocated memory
    m_pFileio           = NULL;
    m_cRows             = 0;
    m_irowFilePos       = 0;
    m_irowLastFilePos   = 0;
    m_cbTotalRowSize    = 0;
    m_cbRowSize         = 0;
    m_irowMin           = 0;
    m_ulRowRefCount     = 0;
    m_pextbufferAccessor= NULL;
    m_pIBuffer          = NULL;
    m_prowbitsIBuffer   = NULL;
    m_pLastBindBase     = NULL;
    m_rgbRowData        = NULL;
    m_dwStatus          = 0;
    m_pUtilProp         = NULL;
  m_pCreator      = NULL;

  m_wszFilePath[0]    = L'\0';
  m_wszDataSourcePath[0]  = L'\0';

    //  Initially, NULL all contained interfaces
    m_pIAccessor                    = NULL;
    m_pIColumnsInfo                 = NULL;
  m_pIConvertType         = NULL;
    m_pIRowset                      = NULL;
    m_pIRowsetChange                = NULL;
    m_pIRowsetIdentity              = NULL;
    m_pIRowsetInfo                  = NULL;
  m_pIGetRow            = NULL;

    // Increment global object count.
    OBJECT_CONSTRUCTED();

    return;
}

CRowset::~CRowset ( void )

Member Function Documentation

HRESULT CRowset::AddRefRows | ( | DBROWCOUNT | cRows,
 |  | HROW * | rghRows,
 |  | ULONG * | rgRefCounts = NULL |
 | ) |  |  | [virtual]

Definition at line 1372 of file crowset.cpp.

{
  HRESULT hr = E_FAIL;

  //Alloc Array for Status
  DBROWSTATUS* rgRowStatus = NULL;
  SAFE_ALLOC(rgRowStatus, DBROWSTATUS, cRows);

  if(m_pIRowset)
  {
    //AddRefRows
    XTEST(hr = m_pIRowset->AddRefRows(cRows, rghRows, rgRefCounts, rgRowStatus));
    DisplayRowErrors(hr, cRows, rghRows, rgRowStatus);
    TESTC(TRACE_METHOD(hr, L"IRowset::AddRefRows(%lu, 0x%p, 0x%p, 0x%p)", cRows, rghRows, rgRefCounts, rgRowStatus));
  }

CLEANUP:
  SAFE_FREE(rgRowStatus);
  return hr;
}

HRESULT CRowset::AutoQI ( DWORD dwCreateOpts ) [virtual]

Reimplemented from CDataAccess.

Definition at line 933 of file crowset.cpp.

{
  //Delegate First, so we have IConnectionPointContainer
  CDataAccess::AutoQI(dwCreateOpts);

  //[MANDATORY] Obtain [mandatory] interfaces
  if(dwCreateOpts & CREATE_QI_MANDATORY)
  {
    OBTAIN_INTERFACE(IRowset);
    OBTAIN_INTERFACE(IRowsetInfo);
  }

  //Auto QI
  if(dwCreateOpts & CREATE_QI_OPTIONAL)
  {
    //Obtain [optional] interfaces
    OBTAIN_INTERFACE(IRowsetChange);
    OBTAIN_INTERFACE(IRowsetIdentity);
    OBTAIN_INTERFACE(IRowsetLocate);
    OBTAIN_INTERFACE(IRowsetFind);
    OBTAIN_INTERFACE(IRowsetView);
    OBTAIN_INTERFACE(IChapteredRowset);
    OBTAIN_INTERFACE(IRowsetResynch);
    OBTAIN_INTERFACE(IRowsetRefresh);
    OBTAIN_INTERFACE(IRowsetIndex);
    OBTAIN_INTERFACE(IRowsetScroll);
    OBTAIN_INTERFACE(IRowsetUpdate);
    OBTAIN_INTERFACE(IRowsetBookmark);
    OBTAIN_INTERFACE(IGetRow);
  }

  //Listeners
  AdviseListener(IID_IRowsetNotify, &m_dwCookieRowsetNotify);
  return S_OK;
}

HRESULT CRowset::AutoRelease ( ) [virtual]

Reimplemented from CDataAccess.

Definition at line 974 of file crowset.cpp.

{
  //Data

  //Rowset
  RELEASE_INTERFACE(IRowset);
  RELEASE_INTERFACE(IRowsetInfo);
  RELEASE_INTERFACE(IRowsetChange);
  RELEASE_INTERFACE(IRowsetIdentity);
  RELEASE_INTERFACE(IRowsetLocate);
  RELEASE_INTERFACE(IRowsetFind);
  RELEASE_INTERFACE(IRowsetView);
  RELEASE_INTERFACE(IChapteredRowset);
  RELEASE_INTERFACE(IRowsetResynch);
  RELEASE_INTERFACE(IRowsetRefresh);
  RELEASE_INTERFACE(IRowsetIndex);
  RELEASE_INTERFACE(IRowsetScroll);
  RELEASE_INTERFACE(IRowsetUpdate);
  RELEASE_INTERFACE(IRowsetBookmark);
  RELEASE_INTERFACE(IGetRow);

  //Don't Unadvise the Listeners until the Rowset goes away.
  //We want to receive and Display the ROWSET_RELEASE notifications
//  UnadviseListener(IID_IRowsetNotify,   &m_dwCookieRowsetNotify);

  //Delegate
  return CDataAccess::AutoRelease();
}

HRESULT CRowset::CreateHelperFunctions ( void ) [private]

Definition at line 335 of file rowset.cpp.

{
    //----------------------
    // Create helper objects
    //----------------------

    // Bit array to track presence/absense of rows.
    m_prowbitsIBuffer = new CBitArray;
    if( !m_prowbitsIBuffer || FAILED(m_prowbitsIBuffer->FInit(MAX_BITS, g_dwPageSize)))
        return ResultFromScode( E_FAIL );

    // List of free slots.
    // This manages the allocation of sets of contiguous rows.
    if (FAILED( InitializeSlotList( MAX_TOTAL_ROWBUFF_SIZE / (ULONG)m_cbRowSize,
                         (ULONG) m_cbRowSize, g_dwPageSize, m_prowbitsIBuffer,
                         &m_pIBuffer, &m_rgbRowData )))
        return ResultFromScode( E_FAIL );

    // Locate some free slots.
    // Should be at very beginning.
    // This tells us which row we will bind to: m_irowMin.
    if (FAILED( GetNextSlots( m_pIBuffer, 1, &m_irowMin )))
        return ResultFromScode( E_FAIL );

    ReleaseSlots( m_pIBuffer, m_irowMin, 1 );

    return ResultFromScode( S_OK );
}

HRESULT CRowset::DisplayObject ( ) [virtual]

Reimplemented from CBase.

Definition at line 1008 of file crowset.cpp.

{
  HRESULT hr = S_OK;

  BINDCOLS eBindCols = (GetOptions()->m_dwAccessorOpts & ACCESSOR_BIND_BOOKMARK ? BIND_ALLCOLS : BIND_ALLCOLSEXPECTBOOKMARK);
  if(m_pCMDIChild)
  {
    //Reset Cursor
    m_pCMDIChild->m_pCDataGrid->m_fLastFetchForward = FALSE;
    m_pCMDIChild->m_pCDataGrid->m_lCurPos = 0;

    //First Clear the existing Window...
    TESTC(hr = m_pCMDIChild->m_pCDataGrid->ClearAll());
  }

  //Obtain Properties
//  if(FAILED(GetProperty(IID_IRowsetInfo, m_pIRowsetInfo, DBPROP_REMOVEDELETED, DBPROPSET_ROWSET, DBTYPE_BOOL, &m_fRemoveDeleted)))
//    m_fRemoveDeleted = FALSE;

  //Create ColumnInfo
  TESTC(hr = GetColInfo());

  //Create Accessors and Setup bindings
  TESTC(hr = CreateAccessors(eBindCols));

  if(m_pCMDIChild)
  {
    //Refresh the Columns and Rows
    TESTC(hr = m_pCMDIChild->m_pCDataGrid->RefreshData());
  }

  //Display the object...
  TESTC(hr = CDataAccess::DisplayObject());

CLEANUP:
  if(m_pCMDIChild)
    m_pCMDIChild->UpdateControls();
  return hr;
}

BOOL CRowset::FInit | ( | CFileIO * | pCFileio,
 |  | CBaseObj * | pParentBaseObj,
 |  | WCHAR * | pwszFileName,
 |  | WCHAR * | pwszDataSource
 | ) |  |

Definition at line 150 of file rowset.cpp.

{
  // Asserts
  assert(pCFileio);
  assert(pParentBaseObj);
    assert(m_pUnkOuter);
    assert(pParentBaseObj);

    LPUNKNOWN pIUnknown = m_pUnkOuter;
    m_pFileio = pCFileio;

  m_pParentObj = pParentBaseObj;
  m_pParentObj->GetOuterUnknown()->AddRef();

    //--------------------
    // Get FileInfo
    //--------------------
    // Find # of columns in the result set.
    m_cCols = m_pFileio->GetColumnCnt();
    if( m_cCols <= 0 )
        return FALSE;

  m_cbRowSize = m_pFileio->GetRowSize();

    if (FAILED( CreateHelperFunctions()))
        return FALSE;

    m_cbTotalRowSize = m_pIBuffer->cbSlot;

    //--------------------
    // Perform binding
    //--------------------
    // Bind result set columns to the first row of the internal buffer.
    // For each column bind it's data as well as length. Leave space for
    // derived status info.
    // Note that we could defer binding, but this way we can check for
    // bad errors before we begin.
    // We may need to bind again if going back and forth
    // with GetNextRows.
    assert(m_rgbRowData);
    if (FAILED( Rebind((BYTE *) GetRowBuff( m_irowMin, TRUE ))))
        return FALSE;

    // allocate utility object that manages our properties
    m_pUtilProp = new CUtilProp();
  if (!m_pUtilProp)
    return FALSE;

    // Allocate contained interface objects
    // Note that our approach is simple - we always create *all* of the Rowset interfaces
    // If our properties were read\write (i.e., could be set), we would need to
    // consult properties to known which interfaces to create.
    // Also, none of our interfaces conflict. If any did conflict, then we could
    // not just blindly create them all.
    m_pIColumnsInfo             = new CImpIColumnsInfo( this, pIUnknown );
  m_pIConvertType       = new CImpIConvertType(this, pIUnknown);
    m_pIRowset                  = new CImpIRowset( this, pIUnknown );
    m_pIRowsetIdentity          = new CImpIRowsetIdentity( this, pIUnknown );
    m_pIRowsetInfo              = new CImpIRowsetInfo( this, pIUnknown );
  m_pIAccessor                = new CImpIAccessor( this, pIUnknown );
  m_pIGetRow          = new CImpIGetRow( this, pIUnknown );

  if (!m_pFileio->IsReadOnly())
    m_pIRowsetChange    = new CImpIRowsetChange( this, pIUnknown );

  if (m_pIAccessor && FAILED(m_pIAccessor->FInit(TRUE)))
    return FALSE;

  wcsncpy(m_wszFilePath, pwszFilePath, MAX_PATH);
  wcsncpy(m_wszDataSourcePath, pwszDataSource, MAX_PATH);

    // if all interfaces were created, return success
    return (BOOL) (m_pIAccessor && m_pIColumnsInfo && m_pIConvertType &&
                   m_pIRowset && m_pIRowsetIdentity && m_pIRowsetInfo &&
           ((m_pFileio->IsReadOnly() && !m_pIRowsetChange) ||
            (!m_pFileio->IsReadOnly() && m_pIRowsetChange)) &&
          m_pIGetRow);
}

HRESULT CRowset::GetBookmark | ( | HROW | hRow,
 |  | DBBKMARK * | pcbBookmark,
 |  | BYTE ** | ppBookmark |
 | ) |  |  | [virtual]

Definition at line 1195 of file crowset.cpp.

{
  ASSERT(pcbBookmark);
  ASSERT(ppBookmark);
  HRESULT hr = S_OK;
  *pcbBookmark = 0;
  *ppBookmark = NULL;

  DBSTATUS dbStatus = 0;
  BYTE* pData = NULL;

  //Make sure we have a bookmark...
  if(!m_ColumnInfo.GetCount() || !m_ColumnInfo.GetElements() || m_ColumnInfo[0].iOrdinal!=0)
    return E_FAIL;

  //Obtain the maximum bookmark size...
  DBLENGTH ulMaxBmkSize = ROUNDUP(GetMaxDisplaySize(DBTYPE_BYTES, m_ColumnInfo[0].wType, m_ColumnInfo[0].ulColumnSize, MAX_COL_SIZE));

  //Deferred Accessor Creation
  if(m_hBmkAccessor==NULL)
  {
    //Static bindings
    //Design the bindigs so the value is first and status length last.  This way we can return
    //the bookmark memory, the rest of the code can access the bookmark directly, and we can free
    //all the memory as well starting with the bookmark address...
    const DBCOUNTITEM cBindings = 1;
    DBBINDING rgBindings[cBindings] =
      {
        0,
        0,                  //VALUE
        ulMaxBmkSize,           //LENGTH
        ulMaxBmkSize + sizeof(DBLENGTH),  //STATUS
        NULL,
        NULL,
        NULL,
        DBPART_VALUE|DBPART_LENGTH|DBPART_STATUS,
        DBMEMOWNER_CLIENTOWNED,
        DBPARAMIO_NOTPARAM,
        ulMaxBmkSize + sizeof(DBLENGTH) + sizeof(DBSTATUS),
        0,
        DBTYPE_BYTES,
        0,
        0,
      };

    //Now create the accessor...
    TESTC(hr = CreateAccessor(DBACCESSOR_ROWDATA, cBindings, rgBindings, 0, &m_hBmkAccessor));
  }

  //Allocate enough space for the bookmark, (including status and length of course)
  SAFE_ALLOC(pData, BYTE, ulMaxBmkSize + sizeof(DBLENGTH) + sizeof(DBSTATUS));

  //GetData to obtain Bookmark value (delegate)
  TESTC(hr = GetData(hRow, m_hBmkAccessor, pData));

  //Length

  dbStatus = *(DBSTATUS*)(pData + ulMaxBmkSize + sizeof(DBLENGTH));
  if(dbStatus == DBSTATUS_S_OK)
  {
    *pcbBookmark = *(ULONG*)(pData + ulMaxBmkSize); //LENGTH
    *ppBookmark = pData;              //VALUE
  }

CLEANUP:
  return hr;
}

HRESULT CRowset::GetChapter | ( | HROW | hRow,
 |  | DBORDINAL | iOrdinal,
 |  | HCHAPTER * | phChapter |
 | ) |  |  | [virtual]

Definition at line 1268 of file crowset.cpp.

{
  ASSERT(hRow);
  ASSERT(phChapter);
  HRESULT hr = S_OK;
  HACCESSOR hAccessor = NULL;

  //Initialize in case of ISNULL data...
  *phChapter = NULL;

  //Bind only the Chapter column...
  const static DBCOUNTITEM cBindings = 1;
  DBBINDING rgBindings[cBindings] =
  {
      iOrdinal,
      0,  //pData = phChapter + 0 offset = phChapter
      0,
      0,
      NULL,
      NULL,
      NULL,
      DBPART_VALUE,
      DBMEMOWNER_CLIENTOWNED,
      DBPARAMIO_NOTPARAM,
      sizeof(HCHAPTER),
      0,
      DBTYPE_HCHAPTER,
      0,
      0,
  };

  //Create the Accessor...
  TESTC(hr = CreateAccessor(DBACCESSOR_ROWDATA, cBindings, rgBindings, 0, &hAccessor));

  //GetData to obtain Bookmark value (delegate)
  TESTC(hr = GetData(hRow, hAccessor, phChapter));

CLEANUP:
  ReleaseAccessor(&hAccessor);
  return hr;
}

PCUTILPROP CRowset::GetCUtilProp ( ) [inline]

Definition at line 153 of file rowset.h.

{ return m_pUtilProp; };

HRESULT CRowset::GetData | ( | HROW | hRow,
 |  | HACCESSOR | hAccessor = NULL,
 |  | void * | pData = NULL,
 |  | DBPROPID | dwSourceID = DBPROP_IRowset |
 | ) |  |  | [virtual]

Definition at line 1106 of file crowset.cpp.

{
  //Since GetData is the only OLE DB method that is allowed to crash
  //if given invalid argumenets (for effiecientcy - provider speicific
  //weither it validates arguments), we should check the params and at the
  //very least warn the user...
  HRESULT hr = E_FAIL;

  //Defaults
  if(hAccessor == NULL)
    hAccessor = m_hAccessor;
  if(pData == NULL)
    pData = m_pData;

  //Check Arguments...
  TESTC(hr = ValidateRow(hRow));
  TESTC(hr = ValidateAccessor(hAccessor));

  //GetData
  switch(dwSourceID)
  {
    //IRowset::GetData
    case DBPROP_IRowset:
      if(m_pIRowset)
      {
        XTEST(hr = m_pIRowset->GetData(hRow, hAccessor, pData));
        TESTC(TRACE_METHOD(hr, L"IRowset::GetData(0x%p, 0x%p, 0x%p)", hRow, hAccessor, pData));
      }
      break;

    //IRowsetLocate::GetData
    case DBPROP_IRowsetLocate:
      if(m_pIRowsetLocate)
      {
        XTEST(hr = m_pIRowsetLocate->GetData(hRow, hAccessor, pData));
        TESTC(TRACE_METHOD(hr, L"IRowsetLocate::GetData(0x%p, 0x%p, 0x%p)", hRow, hAccessor, pData));
      }
      break;

    //IRowsetScroll::GetData
    case DBPROP_IRowsetScroll:
      if(m_pIRowsetScroll)
      {
        XTEST(hr = m_pIRowsetScroll->GetData(hRow, hAccessor, pData));
        TESTC(TRACE_METHOD(hr, L"IRowsetScroll::GetData(0x%p, 0x%p, 0x%p)", hRow, hAccessor, pData));
      }
      break;

    //IRowsetUpdate::GetOriginalData
    case DBPROP_IRowsetUpdate:
      if(m_pIRowsetUpdate)
      {
        XTEST(hr = m_pIRowsetUpdate->GetOriginalData(hRow, hAccessor, pData));
        TESTC(TRACE_METHOD(hr, L"IRowsetUpdate::GetOriginalData(0x%p, 0x%p, 0x%p)", hRow, hAccessor, pData));
      }
      break;

    //IRowsetResynch::GetVisibleData
    case DBPROP_IRowsetResynch:
      if(m_pIRowsetResynch)
      {
        XTEST(hr = m_pIRowsetResynch->GetVisibleData(hRow, hAccessor, pData));
        TESTC(TRACE_METHOD(hr, L"IRowsetResynch::GetVisibleData(0x%p, 0x%p, 0x%p)", hRow, hAccessor, pData));
      }
      break;

    //IRowsetRefresh::GetLastVisibleData
    case DBPROP_IRowsetRefresh:
      if(m_pIRowsetRefresh)
      {
        XTEST(hr = m_pIRowsetRefresh->GetLastVisibleData(hRow, hAccessor, pData));
        TESTC(TRACE_METHOD(hr, L"IRowsetRefresh::GetLastVisibleData(0x%p, 0x%p, 0x%p)", hRow, hAccessor, pData));
      }
      break;

    default:
      ASSERT(!"Unhandled Source!");
      break;
  };

CLEANUP:
  return hr;
}

virtual REFIID CRowset::GetDefaultInterface ( ) [inline, virtual]

Implements CBase.

Definition at line 262 of file crowset.h.

{ return IID_IRowset;               }

CFileIO* CRowset::GetFileObj ( ) [inline]

Definition at line 155 of file rowset.h.

{ return m_pFileio; };

IUnknown ** CRowset::GetInterfaceAddress ( REFIID riid ) [virtual]

Reimplemented from CDataAccess.

Definition at line 906 of file crowset.cpp.

{
  HANDLE_GETINTERFACE(IRowset);
  HANDLE_GETINTERFACE(IRowsetInfo);
  HANDLE_GETINTERFACE(IRowsetChange);
  HANDLE_GETINTERFACE(IRowsetIdentity);
  HANDLE_GETINTERFACE(IRowsetLocate);
  HANDLE_GETINTERFACE(IRowsetFind);
  HANDLE_GETINTERFACE(IRowsetView);
  HANDLE_GETINTERFACE(IChapteredRowset);
  HANDLE_GETINTERFACE(IRowsetResynch);
  HANDLE_GETINTERFACE(IRowsetRefresh);
  HANDLE_GETINTERFACE(IRowsetIndex);
  HANDLE_GETINTERFACE(IRowsetScroll);
  HANDLE_GETINTERFACE(IRowsetUpdate);
  HANDLE_GETINTERFACE(IRowsetBookmark);
  HANDLE_GETINTERFACE(IGetRow);

  //Otherwise delegate
  return CDataAccess::GetInterfaceAddress(riid);
}

HRESULT CRowset::GetNextRows | ( | DBROWOFFSET | lOffset,
 |  | DBROWCOUNT | cRows,
 |  | DBCOUNTITEM * | pcRowsObtained,
 |  | HROW ** | prghRows |
 | ) |  |  | [virtual]

Definition at line 1335 of file crowset.cpp.

{
  HRESULT hr = E_FAIL;

  DBCOUNTITEM cRowsObtained = 0;
  HROW* rghRows = NULL;
  if(prghRows)
    rghRows = *prghRows;

  if(m_pIRowset)
  {
    //GetNextRows
    XTEST(hr = m_pIRowset->GetNextRows(
      m_hChapter,         // hChapter
      lOffset,          // lOffset
      cRows,            // cRows
      &cRowsObtained,       // cRowsObtained
      &rghRows));         // rghRows
    TESTC(TRACE_METHOD(hr, L"IRowset::GetNextRows(0x%p, %ld, %ld, &%lu, &0x%p)", m_hChapter, lOffset, cRows, cRowsObtained, rghRows));
  }

CLEANUP:
  if(pcRowsObtained)
    *pcRowsObtained = cRowsObtained;

  if(prghRows)
    *prghRows = rghRows;
  else
    SAFE_FREE(rghRows);
  return hr;
}

WCHAR * CRowset::GetObjectDesc ( ) [virtual]

Reimplemented from CBase.

Definition at line 1053 of file crowset.cpp.

{
  if(!m_strObjectDesc && m_guidSource != GUID_NULL)
  {
    //Schema Rowset
    if(m_bSchemaRowset)
    {
      //Lookup the "Friendly Name" of the Schema Rowset...
      m_strObjectDesc.CopyFrom(GetSchemaName(m_guidSource));
    }
    else if(m_guidSource == IID_IColumnsRowset)
    {
      //What interface created this...
      m_strObjectDesc.CopyFrom(GetInterfaceName(m_guidSource));
    }
  }

  return m_strObjectDesc;
}

virtual LONG CRowset::GetObjectImage ( ) [inline, virtual]

Implements CBase.

Definition at line 261 of file crowset.h.

{ return m_hChapter ? IMAGE_CHAPTER : IMAGE_TABLE;  }

virtual UINT CRowset::GetObjectMenu ( ) [inline, virtual]

Implements CBase.

Definition at line 260 of file crowset.h.

{ return IDM_ROWSETMENU;              }

virtual WCHAR* CRowset::GetObjectName ( ) [inline, virtual]

Implements CBase.

Definition at line 259 of file crowset.h.

{ return m_hChapter ? L"Chapter" : L"Rowset";   }

ROWBUFF * CRowset::GetRowBuff | ( | DBCOUNTITEM | iRow,
 |  | BOOL | fDataLocation = FALSE |
 | ) |  |  | [private]

Definition at line 422 of file rowset.cpp.

{
    // This assumes iRow is valid...
    // How can we calculate maximum row?
    // Should we return NULL if it's out of range?
    assert( m_rgbRowData );
    assert( m_cbRowSize );
    assert( iRow > 0 );

  // Get the LSTSlot address or the Data offset (We need to make sure this structure is properly aligned)
  if ( fDataLocation )
    return (ROWBUFF *) ROUND_UP ((m_rgbRowData + m_cbTotalRowSize*iRow), COLUMN_ALIGNVAL);
  else
    return (ROWBUFF *) ROUND_UP ((m_rgbRowData + m_cbRowSize + (m_cbTotalRowSize*(iRow-1))), COLUMN_ALIGNVAL);
}

HRESULT CRowset::GetRowFromHROW | ( | CAggregate * | pCAggregate,
 |  | HROW | hRow,
 |  | REFIID | riid,
 |  | IUnknown ** | ppIUnknown |
 | ) |  |  | [virtual]

Definition at line 1426 of file crowset.cpp.

{
  HRESULT hr = E_FAIL;

  if(m_pIGetRow)
  {
    //IGetRow::GetRowFromHROW
    XTEST(hr = m_pIGetRow->GetRowFromHROW(pCAggregate, hRow, riid, ppIUnknown));
    TESTC(TRACE_METHOD(hr, L"IGetRow::GetRowFromHROW(0x%p, 0x%p, %s, &0x%p)", pCAggregate, hRow, GetInterfaceName(riid), ppIUnknown ? *ppIUnknown : NULL));

    //Handle Aggregation
    if(pCAggregate)
      TESTC(hr = pCAggregate->HandleAggregation(riid, ppIUnknown));
  }

CLEANUP:
  return hr;
}

STDMETHODIMP CRowset::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 247 of file rowset.cpp.

{
    if (NULL == ppv)
        return ResultFromScode( E_INVALIDARG );

    //  Place NULL in *ppv in case of failure
    *ppv = NULL;

    //  This is the non-delegating IUnknown implementation
    if (riid == IID_IUnknown)
        *ppv = (LPVOID) this;
    else if (riid == IID_IAccessor)
        *ppv = (LPVOID) m_pIAccessor;
    else if (riid == IID_IColumnsInfo)
        *ppv = (LPVOID) m_pIColumnsInfo;
    else if (riid == IID_IConvertType)
        *ppv = (LPVOID) m_pIConvertType;
    else if (riid == IID_IRowset)
        *ppv = (LPVOID) m_pIRowset;
    else if (riid == IID_IRowsetChange && SupportIRowsetChange() )
        *ppv = (LPVOID) m_pIRowsetChange;
    else if (riid == IID_IRowsetIdentity)
        *ppv = (LPVOID) m_pIRowsetIdentity;
    else if (riid == IID_IRowsetInfo)
        *ppv = (LPVOID) m_pIRowsetInfo;
  else if (riid == IID_IGetRow)
    *ppv = (LPVOID) m_pIGetRow;

    //  If we're going to return an interface, AddRef it first
    if (*ppv)
        {
        ((LPUNKNOWN) *ppv)->AddRef();
        return ResultFromScode( S_OK );
        }
    else
        return ResultFromScode( E_NOINTERFACE );
}

HRESULT CRowset::Rebind ( BYTE * pBase ) [private]

Definition at line 377 of file rowset.cpp.

{
    COLUMNDATA  *pColumn;

    // Bind result set columns.
    // Use established types and sizes and offsets.
    // Bind to internal row buffer, area beginning with 'pRowBuff'.
    //
    // For each column, bind it's data as well as length.
    // Offsets point to start of COLUMNDATA structure.

    assert( pBase );

    // Optimize by not doing it over again.
    if( pBase != m_pLastBindBase )
  {
        m_pLastBindBase = 0;

        for (DBORDINAL cCols=1; cCols <= m_cCols; cCols++)
    {
      pColumn = m_pFileio->GetColumnData(cCols, (ROWBUFF *)pBase);

      if( FAILED( m_pFileio->SetColumnBind(cCols, pColumn)) )
                return( E_FAIL );
    }

        // Remember in case we bind to same place again.
        m_pLastBindBase = pBase;
  }

    return( S_OK );
}

HRESULT CRowset::ReleaseRows | ( | DBROWCOUNT | cRows,
 |  | HROW * | rghRows,
 |  | ULONG * | rgRefCounts = NULL |
 | ) |  |  | [virtual]

Definition at line 1398 of file crowset.cpp.

{
  HRESULT hr = E_FAIL;
  DBROWSTATUS* rgRowStatus = NULL;

  if(m_pIRowset)
  {
    //Alloc Array for Status
    SAFE_ALLOC(rgRowStatus, DBROWSTATUS, cRows);

    //ReleaseRows
    XTEST(hr = m_pIRowset->ReleaseRows(cRows, rghRows, NULL, rgRefCounts, rgRowStatus));
    DisplayRowErrors(hr, cRows, rghRows, rgRowStatus);
    TESTC(TRACE_METHOD(hr, L"IRowset::ReleaseRows(%lu, 0x%p, NULL, 0x%p, 0x%p)", cRows, rghRows, rgRefCounts, rgRowStatus));
  }

CLEANUP:
  SAFE_FREE(rgRowStatus);
  return hr;
}

HRESULT CRowset::RestartPosition ( ) [virtual]

Definition at line 1315 of file crowset.cpp.

{
  HRESULT hr = E_FAIL;

  //IRowset::RestartPosition
  if(m_pIRowset)
  {
    XTEST(hr = m_pIRowset->RestartPosition(m_hChapter));
    TESTC(TRACE_METHOD(hr, L"IRowset::RestartPosition(0x%p)", m_hChapter));
  }

CLEANUP:
  return hr;
}

CRowset::STDMETHODIMP_ ( DBREFCOUNT )
CRowset::STDMETHODIMP_ ( DBREFCOUNT )
BOOL CRowset::SupportIRowsetChange ( ) [private]

Definition at line 493 of file rowset.cpp.

{
  BOOL    fIRowsetChange = FALSE;
  ULONG   cPropSets      = 0;
  DBPROPSET * rgPropSets     = NULL;
  DBPROPID  rgPropId[1];
  DBPROPIDSET rgPropertySets[1];

    // Get the value of the DBPROP_CANHOLDROWS property
  rgPropertySets[0].guidPropertySet = DBPROPSET_ROWSET;
  rgPropertySets[0].rgPropertyIDs   = rgPropId;
  rgPropertySets[0].cPropertyIDs    = 1;
  rgPropId[0]                       = DBPROP_IRowsetChange;

  // Get the IRowsetChange Property from m_pUtilProp
  GetCUtilProp()->GetProperties(PROPSET_ROWSET, 1, rgPropertySets,
                      &cPropSets, &rgPropSets);

  // Get the Prompt value
  if( V_BOOL(&rgPropSets->rgProperties->vValue) == VARIANT_TRUE )
    fIRowsetChange = TRUE;

  // release properties
  FreeProperties(&cPropSets, &rgPropSets);

  return fIRowsetChange;
}

HRESULT CRowset::ValidateRow | ( | HROW | hRow,
 |  | ULONG | ulRefCount = 1 |
 | ) |  |  | [virtual]

Definition at line 1078 of file crowset.cpp.

{
  //Warn user about NULL Rowhandles...
  if(hRow == DB_NULL_HROW || ulRefCount == 0)
  {
    if(IDNO == wMessageBox
      (
        GetFocus(),
        MB_TASKMODAL | MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON1,
        wsz_ERROR,
        L"hRow == 0x%p\n"
        L"%s\n\n"
        L"This may crash your Provider...\n"
        L"Do you wish to continue anyway?",
        hRow,
        hRow == DB_NULL_HROW ? L"Invalid Row Handle" : L"Released Row Handle"
        )
      )
      return E_FAIL;
  }

  return S_OK;
}

Friends And Related Function Documentation

friend class CImpIAccessor [friend]

Definition at line 60 of file rowset.h.

friend class CImpIColumnsInfo [friend]

Definition at line 57 of file rowset.h.

friend class CImpIConvertType [friend]

Definition at line 63 of file rowset.h.

friend class CImpIGetRow [friend]

Definition at line 64 of file rowset.h.

friend class CImpIGetSession [friend]

Definition at line 70 of file rowset.h.

friend class CImpIRow [friend]

Definition at line 69 of file rowset.h.

friend class CImpIRowChange [friend]

Definition at line 71 of file rowset.h.

friend class CImpIRowset [friend]

Definition at line 58 of file rowset.h.

friend class CImpIRowsetChange [friend]

Definition at line 59 of file rowset.h.

friend class CImpIRowsetIdentity [friend]

Definition at line 61 of file rowset.h.

friend class CImpIRowsetInfo [friend]

Definition at line 62 of file rowset.h.

friend class CRow [friend]

Definition at line 68 of file rowset.h.

Member Data Documentation

DBLENGTH CRowset::m_cbRowSize [protected]

Reimplemented from CDataAccess.

Definition at line 95 of file rowset.h.

ULONG CRowset::m_cbTotalRowSize [protected]

Definition at line 97 of file rowset.h.

DBORDINAL CRowset::m_cCols [protected]

Definition at line 87 of file rowset.h.

DBREFCOUNT CRowset::m_cRef [protected]

Reimplemented from CBase.

Definition at line 126 of file rowset.h.

DBCOUNTITEM CRowset::m_cRows [protected]

Definition at line 103 of file rowset.h.

DWORD CRowset::m_dwCookieRowsetNotify

Definition at line 302 of file crowset.h.

UDWORD CRowset::m_dwStatus [protected]

Definition at line 109 of file rowset.h.

BOOL CRowset::m_fRemoveDeleted

Definition at line 308 of file crowset.h.

HCHAPTER CRowset::m_hChapter

Definition at line 305 of file crowset.h.

DBCOUNTITEM CRowset::m_irowFilePos [protected]

Definition at line 105 of file rowset.h.

DBCOUNTITEM CRowset::m_irowLastFilePos [protected]

Definition at line 107 of file rowset.h.

ULONG CRowset::m_irowMin [protected]

Definition at line 101 of file rowset.h.

PCCOMMAND CRowset::m_pCreator

Definition at line 166 of file rowset.h.

LPEXTBUFFER CRowset::m_pextbufferAccessor [protected]

Definition at line 89 of file rowset.h.

CFileIO* CRowset::m_pFileio [protected]

Definition at line 85 of file rowset.h.

PIMPIACCESSOR CRowset::m_pIAccessor [protected]

Reimplemented from CDataAccess.

Definition at line 134 of file rowset.h.

PLSTSLOT CRowset::m_pIBuffer [protected]

Definition at line 91 of file rowset.h.

IChapteredRowset* CRowset::m_pIChapteredRowset

Definition at line 292 of file crowset.h.

PIMPICOLUMNSINFO CRowset::m_pIColumnsInfo [protected]

Reimplemented from CDataAccess.

Definition at line 128 of file rowset.h.

PIMPICONVERTTYPE CRowset::m_pIConvertType [protected]

Reimplemented from CDataAccess.

Definition at line 140 of file rowset.h.

IGetRow* CRowset::m_pIGetRow

Definition at line 299 of file crowset.h.

PIMPIGETROW CRowset::m_pIGetRow [protected]

Definition at line 142 of file rowset.h.

IRowset* CRowset::m_pIRowset

Definition at line 283 of file crowset.h.

PIMPIROWSET CRowset::m_pIRowset [protected]

Definition at line 130 of file rowset.h.

IRowsetBookmark* CRowset::m_pIRowsetBookmark

Definition at line 298 of file crowset.h.

PIMPIROWSETCHANGE CRowset::m_pIRowsetChange [protected]

Definition at line 132 of file rowset.h.

IRowsetChange* CRowset::m_pIRowsetChange

Definition at line 287 of file crowset.h.

IRowsetFind* CRowset::m_pIRowsetFind

Definition at line 290 of file crowset.h.

IRowsetIdentity* CRowset::m_pIRowsetIdentity

Definition at line 288 of file crowset.h.

PIMPIROWSETIDENTITY CRowset::m_pIRowsetIdentity [protected]

Definition at line 136 of file rowset.h.

IRowsetIndex* CRowset::m_pIRowsetIndex

Definition at line 295 of file crowset.h.

IRowsetInfo* CRowset::m_pIRowsetInfo

Definition at line 284 of file crowset.h.

PIMPIROWSETINFO CRowset::m_pIRowsetInfo [protected]

Definition at line 138 of file rowset.h.

IRowsetLocate* CRowset::m_pIRowsetLocate

Definition at line 289 of file crowset.h.

IRowsetRefresh* CRowset::m_pIRowsetRefresh

Definition at line 294 of file crowset.h.

IRowsetResynch* CRowset::m_pIRowsetResynch

Definition at line 293 of file crowset.h.

IRowsetScroll* CRowset::m_pIRowsetScroll

Definition at line 296 of file crowset.h.

IRowsetUpdate* CRowset::m_pIRowsetUpdate

Definition at line 297 of file crowset.h.

IRowsetView* CRowset::m_pIRowsetView

Definition at line 291 of file crowset.h.

BYTE* CRowset::m_pLastBindBase [protected]

Definition at line 111 of file rowset.h.

CBaseObj* CRowset::m_pParentObj [protected]

Definition at line 115 of file rowset.h.

LPBITARRAY CRowset::m_prowbitsIBuffer [protected]

Definition at line 93 of file rowset.h.

PCUTILPROP CRowset::m_pUtilProp [protected]

Definition at line 117 of file rowset.h.

BYTE* CRowset::m_rgbRowData [protected]

Definition at line 99 of file rowset.h.

DBREFCOUNT CRowset::m_ulRowRefCount [protected]

Definition at line 113 of file rowset.h.

WCHAR CRowset::m_wszDataSourcePath[MAX_PATH] [protected]

Definition at line 121 of file rowset.h.

WCHAR CRowset::m_wszFilePath[MAX_PATH] [protected]

Definition at line 119 of file rowset.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/crowset.h
  • Dataaccess/oledb/sampprov/rowset.h
  • Dataaccess/oledb/rowsetviewer/crowset.cpp
  • Dataaccess/oledb/sampprov/rowset.cpp
Generated on Wed Nov 13 2024 16:57:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CRowsetViewerDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CRowsetViewerDlg Class Reference

#include "cdialog.h"

Inherited by CAlterColumnDlg, CAlterIndexDlg, CAlterTableDlg, CConstraintDlg, CExecuteParamDlg, CFullConnect, CMultipleResultsDlg, CPropertiesDlg, and CSchemaDlg.

List of all members.

Public Member Functions

CRowsetViewerDlg (CMainWindow *pCMainWindow, CMDIChild *pCMDIChild=NULL)
virtual COptionsSheet * GetOptions ()

Public Attributes

CMainWindow * m_pCMainWindow
CMDIChild * m_pCMDIChild

Detailed Description

Definition at line 211 of file cdialog.h.

Constructor & Destructor Documentation

CRowsetViewerDlg::CRowsetViewerDlg | ( | CMainWindow * | pCMainWindow,
 |  | CMDIChild * | pCMDIChild = NULL
 | ) |  |

Definition at line 392 of file cdialog.cpp.

{
  ASSERT(pCMainWindow || pCMDIChild);
  m_pCMDIChild  = pCMDIChild;
  m_pCMainWindow  = pCMDIChild ? pCMDIChild->m_pCMainWindow : pCMainWindow;
}

Member Function Documentation

COptionsSheet * CRowsetViewerDlg::GetOptions ( ) [virtual]

Definition at line 404 of file cdialog.cpp.

{
  return m_pCMainWindow->GetOptions();
}

Member Data Documentation

CMainWindow* CRowsetViewerDlg::m_pCMainWindow

Definition at line 222 of file cdialog.h.

CMDIChild* CRowsetViewerDlg::m_pCMDIChild

Definition at line 223 of file cdialog.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialog.h
  • Dataaccess/oledb/rowsetviewer/cdialog.cpp
Generated on Wed Nov 13 2024 16:57:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CRTCAVSession Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends

CRTCAVSession Class Reference

#include "rtcav.h"

Inherits CRTCSession.

List of all members.

Public Member Functions

CRTCAVSession ()
~CRTCAVSession ()

Static Public Member Functions

static HRESULT | RegisterClass ()
static LRESULT CALLBACK | WindowProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)

Protected Member Functions

virtual HRESULT | DeliverClient (RTC_CLIENT_EVENT_TYPE enEventType)
virtual HRESULT | DeliverIntensity (RTC_AUDIO_DEVICE enDevice, long lLevel)
virtual HRESULT | DeliverMedia (long lMediaType, RTC_MEDIA_EVENT_TYPE enType, RTC_MEDIA_EVENT_REASON enReason)
HRESULT | DoMute (RTC_AUDIO_DEVICE enDevice)
HRESULT | DoVolume (RTC_AUDIO_DEVICE enDevice, long lVolume)
LRESULT | OnCommand (UINT uMsg, WPARAM wParam, LPARAM lParam)
virtual LRESULT | OnCreate (UINT uMsg, WPARAM wParam, LPARAM lParam)
virtual LRESULT | OnDestroy (UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT | OnHScroll (UINT uMsg, WPARAM wParam, LPARAM lParam)
virtual LRESULT | OnSize (UINT uMsg, WPARAM wParam, LPARAM lParam)
HRESULT | ShowAudio ()
HRESULT | ShowVideo (RTC_VIDEO_DEVICE enDevice, BOOL fShow)

Protected Attributes

BOOL m_fShowPrev
BOOL m_fShowRecv
HWND | m_hMicLevel
HWND | m_hMicMute
HWND | m_hMicText
HWND | m_hMicVol
HWND | m_hSpkLevel
HWND | m_hSpkMute
HWND | m_hSpkText
HWND | m_hSpkVol
long | m_lPrevHeight
long | m_lPrevWidth
long | m_lRecvHeight
long | m_lRecvWidth

Static Protected Attributes

static HWND | m_hPrevVideoParent = NULL
static HWND | m_hRecvVideoParent = NULL
static CRTCAVSession * | m_Singleton = NULL

Friends

class | CRTCWin

Detailed Description

Definition at line 8 of file rtcav.h.

Constructor & Destructor Documentation

CRTCAVSession::CRTCAVSession ( )

Definition at line 15 of file rtcav.cpp.

                             : CRTCSession()
{
    m_Singleton = this;

    m_fShowRecv = FALSE;
    m_fShowPrev = FALSE;
    m_lRecvWidth = 0;
    m_lRecvHeight = 0;
    m_lPrevWidth = 0;
    m_lPrevHeight = 0;

    m_hMicText = NULL;
    m_hSpkText = NULL;
    m_hMicLevel = NULL;
    m_hSpkLevel = NULL;
    m_hMicVol = NULL;
    m_hSpkVol = NULL;
    m_hMicMute = NULL;
    m_hSpkMute = NULL;
}

CRTCAVSession::~CRTCAVSession ( )

Definition at line 41 of file rtcav.cpp.

{
    m_Singleton = NULL;
}

Member Function Documentation

HRESULT CRTCAVSession::DeliverClient ( RTC_CLIENT_EVENT_TYPE enEventType ) [protected, virtual]

Reimplemented from CRTCSession.

Definition at line 1052 of file rtcav.cpp.

{
    switch(enEventType)
    {
    case RTCCET_VOLUME_CHANGE:
        // On volume change refresh the audio controls
        // so volume controls can be updated
        ShowAudio();
        break;

    case RTCCET_DEVICE_CHANGE:
        // On device change refresh the audio and video
        // controls as available devices may have changed
        ShowAudio();
        ShowVideo(RTCVD_PREVIEW, m_fShowPrev);
        ShowVideo(RTCVD_RECEIVE, m_fShowRecv);
        break;
    }

    return S_OK;
}

HRESULT CRTCAVSession::DeliverIntensity | ( | RTC_AUDIO_DEVICE | enDevice,
 |  | long | lLevel |
 | ) |  |  | [protected, virtual]

Reimplemented from CRTCSession.

Definition at line 1029 of file rtcav.cpp.

{
    switch(enDevice)
    {
    case RTCAD_SPEAKER:
        // Set the position of the speaker progress bar
        SendMessage(m_hSpkLevel, PBM_SETPOS, (WPARAM)lLevel, 0);
        break;

    case RTCAD_MICROPHONE:
        // Set the position of the microphone progress bar
        SendMessage(m_hMicLevel, PBM_SETPOS, (WPARAM)lLevel, 0);
        break;
    }

    return S_OK;
}

HRESULT CRTCAVSession::DeliverMedia | ( | long | lMediaType,
 |  | RTC_MEDIA_EVENT_TYPE | enType,
 |  | RTC_MEDIA_EVENT_REASON | enReason |
 | ) |  |  | [protected, virtual]

Reimplemented from CRTCSession.

Definition at line 975 of file rtcav.cpp.

{
    RTC_VIDEO_DEVICE enVideo;
    BOOL fShow;
    HRESULT hr;

    // Which media type changed?
    switch (lMediaType)
    {
    case RTCMT_VIDEO_SEND:
        enVideo = RTCVD_PREVIEW;
        break;

    case RTCMT_VIDEO_RECEIVE:
        enVideo = RTCVD_RECEIVE;
        break;

    default:
        return S_OK;
    }

    // Did the media start or stop?
    switch (enType)
    {
    case RTCMET_STARTED:
        fShow = TRUE;
        break;

    case RTCMET_STOPPED:
    case RTCMET_FAILED:
        fShow = FALSE;
        break;

    default:
        return S_OK;
    }

    // Show or hide the video as appropriate
    hr = ShowVideo(enVideo, fShow);

    if (FAILED(hr))
    {
        // ShowVideo failed
        return hr;
    }

    return S_OK;
}

HRESULT CRTCAVSession::DoMute ( RTC_AUDIO_DEVICE enDevice ) [protected]

Definition at line 153 of file rtcav.cpp.

{
    IRTCClient * pClient = NULL;
    BOOL fMute = FALSE;
    HWND hWnd = NULL;
    HRESULT hr;

    hr = m_pSession->get_Client(&pClient);

    if (FAILED(hr))
    {
        // get_Client failed
        return hr;
    }

    if (enDevice == RTCAD_SPEAKER)
    {
        hWnd = m_hSpkMute;
    }
    else
    {
        hWnd = m_hMicMute;
    }

    // Get current check state
    fMute = (SendMessage(hWnd, BM_GETCHECK, 0, 0) == BST_CHECKED);

    // Toggle the check state
    fMute = !fMute;

    // Set the current check state
    SendMessage(hWnd, BM_SETCHECK, (WPARAM)(fMute ? BST_CHECKED : BST_UNCHECKED), 0);

    // Set the mute
    hr = pClient->put_AudioMuted(enDevice, fMute ? VARIANT_TRUE : VARIANT_FALSE);

    if (FAILED(hr))
    {
        // put_AudioMute failed
        SAFE_RELEASE(pClient);
        return hr;
    }

    SAFE_RELEASE(pClient);

    return S_OK;
}

HRESULT CRTCAVSession::DoVolume | ( | RTC_AUDIO_DEVICE | enDevice,
 |  | long | lVolume |
 | ) |  |  | [protected]

Definition at line 206 of file rtcav.cpp.

{
    IRTCClient * pClient = NULL;
    HRESULT hr;

    hr = m_pSession->get_Client(&pClient);

    if (FAILED(hr))
    {
        // get_Client failed
        return hr;
    }

    // Set the volume
    hr = pClient->put_Volume(enDevice, lVolume);

    if (FAILED(hr))
    {
        // put_Volume failed
        SAFE_RELEASE(pClient);
        return hr;
    }

    SAFE_RELEASE(pClient);

    return S_OK;
}

LRESULT CRTCAVSession::OnCommand | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected]

Definition at line 925 of file rtcav.cpp.

{
    switch(LOWORD(wParam))
    {
    case ID_FILE_EXIT:
        PostMessage(m_hWnd, WM_CLOSE, 0, 0);
        break;

    case IDC_MIC_MUTE:
        DoMute(RTCAD_MICROPHONE);
        break;

    case IDC_SPK_MUTE:
        DoMute(RTCAD_SPEAKER);
        break;
    }

    return 0;
}

LRESULT CRTCAVSession::OnCreate | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]

Reimplemented from CRTCSession.

Definition at line 476 of file rtcav.cpp.

{
    // Call the base class
    CRTCSession::OnCreate(uMsg, wParam, lParam);

    if (m_hRecvVideoParent == NULL)
    {
        // Create the receive video parent window
        m_hRecvVideoParent = CreateWindowExW(
            WS_EX_CLIENTEDGE,
            L"STATIC",
            NULL,
            WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
            0, 0,
            0, 0,
            m_hWnd,
            NULL,
            GetModuleHandle(NULL),
            NULL);

        if ( !m_hRecvVideoParent )
        {
            // CreateWindowExW failed
            return -1;
        }
    }
    else
    {
        // Take ownership of the receive video parent window
        if (!SetParent(m_hRecvVideoParent, m_hWnd))
        {
            // SetParent failed
            return -1;
        }
    }

    if (m_hPrevVideoParent == NULL)
    {
        // Create the preview video parent window
        m_hPrevVideoParent = CreateWindowExW(
            WS_EX_CLIENTEDGE,
            L"STATIC",
            NULL,
            WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
            0, 0,
            0, 0,
            m_hWnd,
            NULL,
            GetModuleHandle(NULL),
            NULL);

        if ( !m_hPrevVideoParent )
        {
            // CreateWindowExW failed
            return -1;
        }
    }
    else
    {
        // Take ownership of the preview video parent window
        if (!SetParent(m_hPrevVideoParent, m_hWnd))
        {
            // SetParent failed
            return -1;
        }
    }

    // Create the microphone text window
    m_hMicText = CreateWindowExW(
        0,
        L"STATIC",
        L"Microphone",
        WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
        0, 0,
        0, 0,
        m_hWnd,
        NULL,
        GetModuleHandle(NULL),
        NULL);

    if ( !m_hMicText )
    {
        // CreateWindowExW failed
        return -1;
    }

    // Create the speaker text window
    m_hSpkText = CreateWindowExW(
        0,
        L"STATIC",
        L"Speaker",
        WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS,
        0, 0,
        0, 0,
        m_hWnd,
        NULL,
        GetModuleHandle(NULL),
        NULL);

    if ( !m_hSpkText )
    {
        // CreateWindowExW failed
        return -1;
    }

    // Create the microphone level window
    m_hMicLevel = CreateWindowExW(
        WS_EX_CLIENTEDGE,
        PROGRESS_CLASS,
        NULL,
        WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS,
        0, 0,
        0, 0,
        m_hWnd,
        NULL,
        GetModuleHandle(NULL),
        NULL);

    if ( !m_hMicLevel )
    {
        // CreateWindowExW failed
        return -1;
    }

    // Create the speaker level window
    m_hSpkLevel = CreateWindowExW(
        WS_EX_CLIENTEDGE,
        PROGRESS_CLASS,
        NULL,
        WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS,
        0, 0,
        0, 0,
        m_hWnd,
        NULL,
        GetModuleHandle(NULL),
        NULL);

    if ( !m_hSpkLevel )
    {
        // CreateWindowExW failed
        return -1;
    }

    // Create the microphone volume window
    m_hMicVol = CreateWindowExW(
        0,
        TRACKBAR_CLASS,
        NULL,
        WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS,
        0, 0,
        0, 0,
        m_hWnd,
        (HMENU)IDC_MIC_VOL,
        GetModuleHandle(NULL),
        NULL);

    if ( !m_hMicVol )
    {
        // CreateWindowExW failed
        return -1;
    }

    SendMessage(m_hMicVol, TBM_SETRANGEMAX, (WPARAM)FALSE, (LPARAM)0xFFFF);

    // Create the speaker volume window
    m_hSpkVol = CreateWindowExW(
        0,
        TRACKBAR_CLASS,
        NULL,
        WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS,
        0, 0,
        0, 0,
        m_hWnd,
        (HMENU)IDC_SPK_VOL,
        GetModuleHandle(NULL),
        NULL);

    if ( !m_hSpkVol )
    {
        // CreateWindowExW failed
        return -1;
    }

    SendMessage(m_hSpkVol, TBM_SETRANGEMAX, (WPARAM)FALSE, (LPARAM)0xFFFF);

    // Create the microphone mute window
    m_hMicMute = CreateWindowExW(
        0,
        L"BUTTON",
        L"Mute",
        WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | BS_CHECKBOX,
        0, 0,
        0, 0,
        m_hWnd,
        (HMENU)IDC_MIC_MUTE,
        GetModuleHandle(NULL),
        NULL);

    if ( !m_hMicMute )
    {
        // CreateWindowExW failed
        return -1;
    }

    // Create the speaker mute window
    m_hSpkMute = CreateWindowExW(
        0,
        L"BUTTON",
        L"Mute",
        WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | BS_CHECKBOX,
        0, 0,
        0, 0,
        m_hWnd,
        (HMENU)IDC_SPK_MUTE,
        GetModuleHandle(NULL),
        NULL);

    if ( !m_hSpkMute )
    {
        // CreateWindowExW failed
        return -1;
    }

    return 0;
}

LRESULT CRTCAVSession::OnDestroy | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]

Reimplemented from CRTCSession.

Definition at line 707 of file rtcav.cpp.

{
    // Orphan the receive video parent window
    ShowWindow(m_hRecvVideoParent, SW_HIDE);
    SetParent(m_hRecvVideoParent, NULL);

    // Orphan the preview video parent window
    ShowWindow(m_hPrevVideoParent, SW_HIDE);
    SetParent(m_hPrevVideoParent, NULL);

    // Call the base class
    CRTCSession::OnDestroy(uMsg, wParam, lParam);

    return 0;
}

LRESULT CRTCAVSession::OnHScroll | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected]

Definition at line 950 of file rtcav.cpp.

{
    if ((LOWORD(wParam) == SB_THUMBPOSITION) ||
        (LOWORD(wParam) == SB_THUMBTRACK))
    {
        if ((HWND)lParam == m_hSpkVol)
        {
            // Speaker volume adjusted
            DoVolume(RTCAD_SPEAKER, HIWORD(wParam));
        }
        else if ((HWND)lParam == m_hMicVol)
        {
            // Microphone volume adjusted
            DoVolume(RTCAD_MICROPHONE, HIWORD(wParam));
        }
    }

    return 0;
}

LRESULT CRTCAVSession::OnSize | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]

Reimplemented from CRTCSession.

Definition at line 728 of file rtcav.cpp.

{
    // Call the base class
    CRTCSession::OnSize(uMsg, wParam, lParam);

    RECT rcWnd, rcStatusBar;
    const int SIZE_EDGE = 5;
    const int TEXT_HEIGHT = 16;
    const int LEVEL_HEIGHT = 10;
    const int VOL_HEIGHT = 20;

    GetClientRect(m_hWnd, &rcWnd);
    GetClientRect(m_hStatusBar, &rcStatusBar);

    // Calculate video window size
    float fAspectRatio = (float)QCIF_CY_SIZE/(float)QCIF_CX_SIZE;
    m_lRecvWidth = rcWnd.right - rcWnd.left - 2*SIZE_EDGE;
    m_lRecvHeight = fAspectRatio * m_lRecvWidth;
    m_lPrevWidth = QQCIF_CX_SIZE;
    m_lPrevHeight = QQCIF_CY_SIZE;

    // Resize the receive video parent window
    RECT rcRecvVid;

    rcRecvVid.left = rcWnd.left + SIZE_EDGE;
    rcRecvVid.right = rcWnd.left + m_lRecvWidth + SIZE_EDGE;
    rcRecvVid.top = rcWnd.top + SIZE_EDGE;
    rcRecvVid.bottom = rcWnd.top + m_lRecvHeight + SIZE_EDGE;

    MoveWindow(
        m_hRecvVideoParent,
        rcRecvVid.left,
        rcRecvVid.top,
        m_lRecvWidth,
        m_lRecvHeight,
        TRUE);

    // Resize the preview video parent window
    RECT rcPrevVid;

    rcPrevVid.left = rcRecvVid.right - m_lPrevWidth;
    rcPrevVid.right = rcRecvVid.right;
    rcPrevVid.top = rcRecvVid.bottom - m_lPrevHeight;
    rcPrevVid.bottom = rcRecvVid.bottom;

    MoveWindow(
        m_hPrevVideoParent,
        rcPrevVid.left,
        rcPrevVid.top,
        m_lPrevWidth,
        m_lPrevHeight,
        TRUE);

    // Update video windows
    ShowVideo(RTCVD_RECEIVE, m_fShowRecv);
    ShowVideo(RTCVD_PREVIEW, m_fShowPrev);

    // Resize the speaker text window
    RECT rcSpkText;

    rcSpkText.left = rcRecvVid.left;
    rcSpkText.right = rcRecvVid.left + m_lRecvWidth/2 - SIZE_EDGE;
    rcSpkText.top = rcRecvVid.bottom + SIZE_EDGE;
    rcSpkText.bottom = rcSpkText.top + TEXT_HEIGHT;

    MoveWindow(
        m_hSpkText,
        rcSpkText.left,
        rcSpkText.top,
        (rcSpkText.right - rcSpkText.left),
        (rcSpkText.bottom - rcSpkText.top),
        TRUE);

    // Resize the microphone text window
    RECT rcMicText;

    rcMicText.left = rcRecvVid.right - m_lRecvWidth/2 + SIZE_EDGE;
    rcMicText.right = rcRecvVid.right;
    rcMicText.top = rcRecvVid.bottom + SIZE_EDGE;
    rcMicText.bottom = rcMicText.top + TEXT_HEIGHT;

    MoveWindow(
        m_hMicText,
        rcMicText.left,
        rcMicText.top,
        (rcMicText.right - rcMicText.left),
        (rcMicText.bottom - rcMicText.top),
        TRUE);

    // Resize the speaker level window
    RECT rcSpkLevel;

    rcSpkLevel.left = rcSpkText.left;
    rcSpkLevel.right = rcSpkText.right;
    rcSpkLevel.top = rcSpkText.bottom + SIZE_EDGE;
    rcSpkLevel.bottom = rcSpkLevel.top + LEVEL_HEIGHT;

    MoveWindow(
        m_hSpkLevel,
        rcSpkLevel.left,
        rcSpkLevel.top,
        (rcSpkLevel.right - rcSpkLevel.left),
        (rcSpkLevel.bottom - rcSpkLevel.top),
        TRUE);

    // Resize the microphone level window
    RECT rcMicLevel;

    rcMicLevel.left = rcMicText.left;
    rcMicLevel.right = rcMicText.right;
    rcMicLevel.top = rcMicText.bottom + SIZE_EDGE;
    rcMicLevel.bottom = rcMicLevel.top + LEVEL_HEIGHT;

    MoveWindow(
        m_hMicLevel,
        rcMicLevel.left,
        rcMicLevel.top,
        (rcMicLevel.right - rcMicLevel.left),
        (rcMicLevel.bottom - rcMicLevel.top),
        TRUE);

    // Resize the speaker volume window
    RECT rcSpkVol;

    rcSpkVol.left = rcSpkLevel.left;
    rcSpkVol.right = rcSpkLevel.right;
    rcSpkVol.top = rcSpkLevel.bottom + SIZE_EDGE;
    rcSpkVol.bottom = rcSpkVol.top + VOL_HEIGHT;

    MoveWindow(
        m_hSpkVol,
        rcSpkVol.left,
        rcSpkVol.top,
        (rcSpkVol.right - rcSpkVol.left),
        (rcSpkVol.bottom - rcSpkVol.top),
        TRUE);

    // Resize the microphone volume window
    RECT rcMicVol;

    rcMicVol.left = rcMicLevel.left;
    rcMicVol.right = rcMicLevel.right;
    rcMicVol.top = rcMicLevel.bottom + SIZE_EDGE;
    rcMicVol.bottom = rcMicVol.top + VOL_HEIGHT;

    MoveWindow(
        m_hMicVol,
        rcMicVol.left,
        rcMicVol.top,
        (rcMicVol.right - rcMicVol.left),
        (rcMicVol.bottom - rcMicVol.top),
        TRUE);

    // Resize the speaker mute window
    RECT rcSpkMute;

    rcSpkMute.left = rcSpkVol.left;
    rcSpkMute.right = rcSpkVol.right;
    rcSpkMute.top = rcSpkVol.bottom + SIZE_EDGE;
    rcSpkMute.bottom = rcSpkMute.top + TEXT_HEIGHT;

    MoveWindow(
        m_hSpkMute,
        rcSpkMute.left,
        rcSpkMute.top,
        (rcSpkMute.right - rcSpkMute.left),
        (rcSpkMute.bottom - rcSpkMute.top),
        TRUE);

    // Resize the microphone mute window
    RECT rcMicMute;

    rcMicMute.left = rcMicVol.left;
    rcMicMute.right = rcMicVol.right;
    rcMicMute.top = rcMicVol.bottom + SIZE_EDGE;
    rcMicMute.bottom = rcMicMute.top + TEXT_HEIGHT;

    MoveWindow(
        m_hMicMute,
        rcMicMute.left,
        rcMicMute.top,
        (rcMicMute.right - rcMicMute.left),
        (rcMicMute.bottom - rcMicMute.top),
        TRUE);

    // Update the audio windows
    ShowAudio();

    return 0;
}

HRESULT CRTCAVSession::RegisterClass ( ) [static]

Definition at line 51 of file rtcav.cpp.

{
    // Register the window class
    WNDCLASS wc;
    ATOM atom;

    ZeroMemory(&wc, sizeof(WNDCLASS));

    wc.style         = CS_HREDRAW | CS_VREDRAW;
    wc.lpfnWndProc   = (WNDPROC)CRTCAVSession::WindowProc;
    wc.hInstance     = GetModuleHandle(NULL);
    wc.hIcon         = NULL;
    wc.hCursor       =
        LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground =
        GetSysColorBrush(COLOR_3DFACE);
    wc.lpszMenuName  = MAKEINTRESOURCE(IDR_MENU_AV);
    wc.lpszClassName = AV_CLASS;

    atom = ::RegisterClass( &wc );

    if ( !atom )
    {
        // RegisterClass failed
        return E_FAIL;
    }

    return S_OK;
}

HRESULT CRTCAVSession::ShowAudio ( ) [protected]

Definition at line 239 of file rtcav.cpp.

{
    IRTCClient * pClient = NULL;
    VARIANT_BOOL fMute = FALSE;
    long lVolume = 0;
    long lMediaCaps = 0;
    HRESULT hr;

    hr = m_pSession->get_Client(&pClient);

    if (FAILED(hr))
    {
        // get_Client failed
        return hr;
    }

    // Get the media capabilities
    hr = pClient->get_MediaCapabilities(&lMediaCaps);

    if (FAILED(hr))
    {
        // get_MediaCapabilities failed
        SAFE_RELEASE(pClient);
        return hr;
    }

    if (lMediaCaps & RTCMT_AUDIO_RECEIVE)
    {
        // Enable the speaker windows
        EnableWindow(m_hSpkText, TRUE);
        EnableWindow(m_hSpkLevel, TRUE);
        EnableWindow(m_hSpkVol, TRUE);
        EnableWindow(m_hSpkMute, TRUE);

        // Show the speaker mute state
        hr = pClient->get_AudioMuted(RTCAD_SPEAKER, &fMute);

        if (FAILED(hr))
        {
            // get_AudioMuted failed
            SAFE_RELEASE(pClient);
            return hr;
        }

        SendMessage(m_hSpkMute, BM_SETCHECK, fMute ? BST_CHECKED : BST_UNCHECKED, 0);

        // Show the speaker volume
        hr = pClient->get_Volume(RTCAD_SPEAKER, &lVolume);

        if (FAILED(hr))
        {
            // get_Volume failed
            SAFE_RELEASE(pClient);
            return hr;
        }

        SendMessage(m_hSpkVol, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)lVolume);
    }
    else
    {
        // Disable the speaker windows
        EnableWindow(m_hSpkText, FALSE);
        EnableWindow(m_hSpkLevel, FALSE);
        EnableWindow(m_hSpkVol, FALSE);
        EnableWindow(m_hSpkMute, FALSE);
    }

    if (lMediaCaps & RTCMT_AUDIO_SEND)
    {
        // Enable the microphone windows
        EnableWindow(m_hMicText, TRUE);
        EnableWindow(m_hMicLevel, TRUE);
        EnableWindow(m_hMicVol, TRUE);
        EnableWindow(m_hMicMute, TRUE);

        // Show the microphone mute state
        hr = pClient->get_AudioMuted(RTCAD_MICROPHONE, &fMute);

        if (FAILED(hr))
        {
            // get_AudioMuted failed
            SAFE_RELEASE(pClient);
            return hr;
        }

        SendMessage(m_hMicMute, BM_SETCHECK, fMute ? BST_CHECKED : BST_UNCHECKED, 0);

        // Show the microphone volume
        hr = pClient->get_Volume(RTCAD_MICROPHONE, &lVolume);

        if (FAILED(hr))
        {
            // get_Volume failed
            SAFE_RELEASE(pClient);
            return hr;
        }

        SendMessage(m_hMicVol, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)lVolume);
    }
    else
    {
        // Disable the microphone windows
        EnableWindow(m_hMicText, FALSE);
        EnableWindow(m_hMicLevel, FALSE);
        EnableWindow(m_hMicVol, FALSE);
        EnableWindow(m_hMicMute, FALSE);
    }

    SAFE_RELEASE(pClient);

    return S_OK;
}

HRESULT CRTCAVSession::ShowVideo | ( | RTC_VIDEO_DEVICE | enDevice,
 |  | BOOL | fShow |
 | ) |  |  | [protected]

Definition at line 357 of file rtcav.cpp.

{
    IVideoWindow * pVid = NULL;
    IRTCClient * pClient = NULL;
    long lMediaCaps = 0;
    HWND hWnd = NULL;
    HRESULT hr;

    hr = m_pSession->get_Client(&pClient);

    if (FAILED(hr))
    {
        // get_Client failed
        return hr;
    }

    // Get the media capabilities
    hr = pClient->get_MediaCapabilities(&lMediaCaps);

    if (FAILED(hr))
    {
        // get_MediaCapabilities failed
        SAFE_RELEASE(pClient);
        return hr;
    }

    hr = pClient->get_IVideoWindow(
        enDevice, &pVid);

    SAFE_RELEASE(pClient);

    if (FAILED(hr))
    {
        // get_IVideoWindow failed
        return hr;
    }

    if (enDevice == RTCVD_PREVIEW)
    {
        // Determine whether to show the preview video
        fShow = fShow && (lMediaCaps & RTCMT_VIDEO_SEND);
        m_fShowPrev = fShow;
        hWnd = m_hPrevVideoParent;

        // Show or hide the preview video preview parent window
        ShowWindow(m_hPrevVideoParent, fShow ? SW_SHOW : SW_HIDE);

        // Set window region for receive video parent window
        HRGN hRegion;

        if (fShow)
        {
            // Set the receive video region to make room for the preview
            // video picture-in-picture
            POINT rgPoints[6] =
                    { 0, 0,
                      0, m_lRecvHeight,
                      m_lRecvWidth - m_lPrevWidth, m_lRecvHeight,
                      m_lRecvWidth - m_lPrevWidth, m_lRecvHeight - m_lPrevHeight,
                      m_lRecvWidth, m_lRecvHeight - m_lPrevHeight,
                      m_lRecvWidth, 0
                    };

            hRegion = CreatePolygonRgn(rgPoints, 6, ALTERNATE);
        }
        else
        {
            // Set the receive video region to be rectangular
            hRegion = CreateRectRgn(0, 0, m_lRecvWidth, m_lRecvHeight);
        }

        SetWindowRgn(m_hRecvVideoParent, hRegion, TRUE);
    }
    else
    {
        // Determine whether to show the receive video
        fShow = fShow && (lMediaCaps & RTCMT_VIDEO_RECEIVE);
        m_fShowRecv = fShow;
        hWnd = m_hRecvVideoParent;

        // Always show the video receive parent window
        ShowWindow(m_hRecvVideoParent, SW_SHOW);
    }

    if ( fShow == TRUE )
    {
        // Set the video window style
        pVid->put_WindowStyle( WS_CHILD |
                               WS_CLIPCHILDREN |
                               WS_CLIPSIBLINGS );

        // Set the parent window for the video window
        pVid->put_Owner( (OAHWND)hWnd );

        RECT rc;
        GetClientRect(hWnd, &rc );

        // Position the video window
        pVid->SetWindowPosition(
            rc.left,
            rc.top,
            rc.right,
            rc.bottom
            );

        // Make the video window visible
        pVid->put_Visible(-1);
    }

    SAFE_RELEASE(pVid);

    return S_OK;
}

LRESULT CALLBACK CRTCAVSession::WindowProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 86 of file rtcav.cpp.

{
    CRTCAVSession * me = NULL;
    LRESULT  lr = 0;

    if ( uMsg == WM_CREATE )
    {
        // Create an instance of the class
        me = new CRTCAVSession;
        me->m_hWnd = hWnd;

        // Store the class instance pointer in the
        // window's user data for later retrieval
        SetWindowLong(hWnd, GWL_USERDATA, (LONG)me);

        lr = me->OnCreate(uMsg, wParam, lParam);
    }
    else
    {
        // Retrieve the class instance pointer from the
        // window's user data
        me = (CRTCAVSession *)GetWindowLong(hWnd, GWL_USERDATA);

        switch( uMsg )
        {
        case WM_DESTROY:
            lr = me->OnDestroy(uMsg, wParam, lParam);

            // Delete the object instance
            delete me;

            break;

        case WM_CLOSE:
            lr = me->OnClose(uMsg, wParam, lParam);
            break;

        case WM_SIZE:
            lr = me->OnSize(uMsg, wParam, lParam);
            break;

        case WM_COMMAND:
            lr = me->OnCommand(uMsg, wParam, lParam);
            break;

        case WM_HSCROLL:
            lr = me->OnHScroll(uMsg, wParam, lParam);
            break;

        default:
            lr = DefWindowProc( hWnd, uMsg, wParam, lParam );
        }
    }

    return lr;
}

Friends And Related Function Documentation

friend class CRTCWin [friend]

Reimplemented from CRTCSession.

Definition at line 27 of file rtcav.h.

Member Data Documentation

BOOL CRTCAVSession::m_fShowPrev [protected]

Definition at line 37 of file rtcav.h.

BOOL CRTCAVSession::m_fShowRecv [protected]

Definition at line 36 of file rtcav.h.

HWND CRTCAVSession::m_hMicLevel [protected]

Definition at line 45 of file rtcav.h.

HWND CRTCAVSession::m_hMicMute [protected]

Definition at line 49 of file rtcav.h.

HWND CRTCAVSession::m_hMicText [protected]

Definition at line 43 of file rtcav.h.

HWND CRTCAVSession::m_hMicVol [protected]

Definition at line 47 of file rtcav.h.

HWND CRTCAVSession::m_hPrevVideoParent = NULL [static, protected]

Definition at line 34 of file rtcav.h.

HWND CRTCAVSession::m_hRecvVideoParent = NULL [static, protected]

Definition at line 33 of file rtcav.h.

HWND CRTCAVSession::m_hSpkLevel [protected]

Definition at line 46 of file rtcav.h.

HWND CRTCAVSession::m_hSpkMute [protected]

Definition at line 50 of file rtcav.h.

HWND CRTCAVSession::m_hSpkText [protected]

Definition at line 44 of file rtcav.h.

HWND CRTCAVSession::m_hSpkVol [protected]

Definition at line 48 of file rtcav.h.

long CRTCAVSession::m_lPrevHeight [protected]

Definition at line 41 of file rtcav.h.

long CRTCAVSession::m_lPrevWidth [protected]

Definition at line 40 of file rtcav.h.

long CRTCAVSession::m_lRecvHeight [protected]

Definition at line 39 of file rtcav.h.

long CRTCAVSession::m_lRecvWidth [protected]

Definition at line 38 of file rtcav.h.

CRTCAVSession * CRTCAVSession::m_Singleton = NULL [static, protected]

Definition at line 31 of file rtcav.h.

The documentation for this class was generated from the following files:
  • NetDS/rtc/Client/CPP/rtcsample/rtcav.h
  • NetDS/rtc/Client/CPP/rtcsample/rtcav.cpp
Generated on Wed Nov 13 2024 16:57:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CRTCEvents Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CRTCEvents Class Reference

#include "rtcevents.h"

List of all members.

Public Member Functions

CRTCEvents ()
ULONG STDMETHODCALLTYPE | AddRef ()
HRESULT | Advise (IRTCClient *pClient, HWND hWnd)
HRESULT STDMETHODCALLTYPE | Event (RTC_EVENT enEvent, IDispatch *pDisp)
HRESULT STDMETHODCALLTYPE | QueryInterface (REFIID iid, void **ppvObject)
ULONG STDMETHODCALLTYPE | Release ()
HRESULT | Unadvise (IRTCClient *pClient)

Private Attributes

DWORD m_dwCookie
DWORD m_dwRefCount
HWND | m_hWnd

Detailed Description

Definition at line 8 of file rtcevents.h.

Constructor & Destructor Documentation

CRTCEvents::CRTCEvents ( ) [inline]

Definition at line 17 of file rtcevents.h.

                 : m_dwRefCount(0),
                   m_dwCookie(0),
                   m_hWnd(NULL)
    {}

Member Function Documentation

ULONG STDMETHODCALLTYPE CRTCEvents::AddRef ( void ) [inline]

Definition at line 51 of file rtcevents.h.

    {
        m_dwRefCount++;
        return m_dwRefCount;
    }

HRESULT CRTCEvents::Advise | ( | IRTCClient * | pClient,
 |  | HWND | hWnd |
 | ) |  |  | [inline]

Definition at line 79 of file rtcevents.h.

    {
      IConnectionPointContainer * pCPC = NULL;
      IConnectionPoint * pCP = NULL;
        HRESULT hr;

        // Find the connection point container
      hr = pClient->QueryInterface(IID_IConnectionPointContainer, (void**)&pCPC);

      if (SUCCEEDED(hr))
        {
            // Find the connection point
        hr = pCPC->FindConnectionPoint(IID_IRTCEventNotification, &pCP);

            SAFE_RELEASE(pCPC);

            if (SUCCEEDED(hr))
            {
                // Advise the connection
            hr = pCP->Advise(this, &m_dwCookie);

                SAFE_RELEASE(pCP);
            }
        }

        // Store the window handle of the application so we
        // can post messages to it when events are fired
        m_hWnd = hWnd;

      return hr;
    }

HRESULT STDMETHODCALLTYPE CRTCEvents::Event | ( | RTC_EVENT | enEvent,
 |  | IDispatch * | pDisp |
 | ) |  |  | [inline]

Definition at line 152 of file rtcevents.h.

    {
        // We will post a message containing the event to the
        // application window.

        // Add a reference to the event so we can hold onto it while
        // the event is in the message queue.
        pDisp->AddRef();

        // Post the message
        PostMessage( m_hWnd, WM_RTC_EVENT, (WPARAM)enEvent, (LPARAM)pDisp );

        return S_OK;
    }

HRESULT STDMETHODCALLTYPE CRTCEvents::QueryInterface | ( | REFIID | iid,
 |  | void ** | ppvObject |
 | ) |  |  | [inline]

Definition at line 27 of file rtcevents.h.

    {
        if (iid == IID_IRTCEventNotification)
        {
            *ppvObject = (void *)this;
            AddRef();
            return S_OK;
        }

        if (iid == IID_IUnknown)
        {
            *ppvObject = (void *)this;
            AddRef();
            return S_OK;
        }

        return E_NOINTERFACE;
    }

ULONG STDMETHODCALLTYPE CRTCEvents::Release ( void ) [inline]

Definition at line 62 of file rtcevents.h.

    {
        m_dwRefCount--;

        if ( 0 == m_dwRefCount)
        {
            delete this;
        }

        return 1;
    }

HRESULT CRTCEvents::Unadvise ( IRTCClient * pClient ) [inline]

Definition at line 116 of file rtcevents.h.

    {
      IConnectionPointContainer * pCPC = NULL;
      IConnectionPoint * pCP = NULL;
        HRESULT hr;

        if (m_dwCookie)
        {
            // Find the connection point container
          hr = pClient->QueryInterface(IID_IConnectionPointContainer, (void**)&pCPC);

          if (SUCCEEDED(hr))
            {
                // Find the connection point
            hr = pCPC->FindConnectionPoint(IID_IRTCEventNotification, &pCP);

                SAFE_RELEASE(pCPC);

                if (SUCCEEDED(hr))
                {
                    // Unadvise this connection
                hr = pCP->Unadvise(m_dwCookie);

                    SAFE_RELEASE(pCP);
                }
            }
        }

      return hr;
    }

Member Data Documentation

DWORD CRTCEvents::m_dwCookie [private]

Definition at line 13 of file rtcevents.h.

DWORD CRTCEvents::m_dwRefCount [private]

Definition at line 12 of file rtcevents.h.

HWND CRTCEvents::m_hWnd [private]

Definition at line 14 of file rtcevents.h.

The documentation for this class was generated from the following file:
  • NetDS/rtc/Client/CPP/rtcsample/rtcevents.h
Generated on Wed Nov 13 2024 16:57:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CRTCIMSession Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes

CRTCIMSession Class Reference

#include "rtcim.h"

Inherits CRTCSession.

List of all members.

Public Member Functions

CRTCIMSession ()
~CRTCIMSession ()

Static Public Member Functions

static LRESULT CALLBACK | EditSubclassProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
static HRESULT | RegisterClass ()
static LRESULT CALLBACK | WindowProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)

Protected Member Functions

virtual HRESULT | DeliverMessage (IRTCParticipant *pParticipant, BSTR bstrContentType, BSTR bstrMessage)
virtual HRESULT | DeliverUserStatus (IRTCParticipant *pParticipant, RTC_MESSAGING_USER_STATUS enStatus)
HRESULT | DoDisplayMessage (PWSTR szUser, PWSTR szMessage)
HRESULT | DoDisplayTyping (PWSTR szUser, BOOL fTyping)
HRESULT | DoSendMessage ()
HRESULT | DoSendTyping ()
LRESULT | OnCommand (UINT uMsg, WPARAM wParam, LPARAM lParam)
virtual LRESULT | OnCreate (UINT uMsg, WPARAM wParam, LPARAM lParam)
virtual LRESULT | OnDestroy (UINT uMsg, WPARAM wParam, LPARAM lParam)
virtual LRESULT | OnSize (UINT uMsg, WPARAM wParam, LPARAM lParam)

Protected Attributes

BOOL m_fTyping
HWND | m_hDisplay
HWND | m_hEdit
HWND | m_hSend
WNDPROC | m_wpOrigEditProc

Detailed Description

Definition at line 8 of file rtcim.h.

Constructor & Destructor Documentation

CRTCIMSession::CRTCIMSession ( )

Definition at line 25 of file rtcim.cpp.

                             : CRTCSession()
{
    m_hDisplay = NULL;
    m_hEdit = NULL;
    m_hSend = NULL;
    m_fTyping = FALSE;
    m_wpOrigEditProc = NULL;
}

CRTCIMSession::~CRTCIMSession ( )

Definition at line 39 of file rtcim.cpp.

{
}

Member Function Documentation

HRESULT CRTCIMSession::DeliverMessage | ( | IRTCParticipant * | pParticipant,
 |  | BSTR | bstrContentType,
 |  | BSTR | bstrMessage |
 | ) |  |  | [protected, virtual]

Reimplemented from CRTCSession.

Definition at line 564 of file rtcim.cpp.

{
    HRESULT hr;
    BSTR bstrURI = NULL;

    // Get the URI of the incoming user
    hr = pParticipant->get_UserURI(&bstrURI);

    if (FAILED(hr))
    {
        // get_UserURI failed
        return hr;
    }

    // Display the incoming message
    hr = DoDisplayMessage(bstrURI, bstrMessage);

    if (FAILED(hr))
    {
        // DoDisplayMessage failed
        return hr;
    }

    // Set the incoming user's typing status to idle
    hr = DoDisplayTyping(bstrURI, RTCMUS_IDLE);

    if (FAILED(hr))
    {
        // DoDisplayTyping failed
        return hr;
    }

    return S_OK;
}

HRESULT CRTCIMSession::DeliverUserStatus | ( | IRTCParticipant * | pParticipant,
 |  | RTC_MESSAGING_USER_STATUS | enStatus |
 | ) |  |  | [protected, virtual]

Reimplemented from CRTCSession.

Definition at line 604 of file rtcim.cpp.

{
    HRESULT hr;
    BSTR bstrURI = NULL;

    // Get the URI of the incoming user
    hr = pParticipant->get_UserURI(&bstrURI);

    if (FAILED(hr))
    {
        // get_UserURI failed
        return hr;
    }

    // Display the typing status of the incoming user
    hr = DoDisplayTyping(bstrURI, (enStatus == RTCMUS_TYPING));

    if (FAILED(hr))
    {
        // DoDisplayTyping failed
        return hr;
    }

    return S_OK;
}

HRESULT CRTCIMSession::DoDisplayMessage | ( | PWSTR | szUser,
 |  | PWSTR | szMessage |
 | ) |  |  | [protected]

Definition at line 251 of file rtcim.cpp.

{
    // Select the end of the text in the edit control
    SendMessage(m_hDisplay, EM_SETSEL, -1, -1);

    // Set format for the user text
    CHARFORMAT cf;
    PARAFORMAT pf;

    cf.cbSize = sizeof(CHARFORMAT);
    cf.dwMask = CFM_COLOR;
    cf.dwEffects = 0;
    cf.crTextColor = RGB(0,128,128);

    SendMessage(m_hDisplay, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);

    pf.cbSize = sizeof(PARAFORMAT);
    pf.dwMask = PFM_STARTINDENT;
    pf.dxStartIndent = 50;

    SendMessage(m_hDisplay, EM_SETPARAFORMAT, 0, (LPARAM)&pf);

    // Paste the user text in the edit control
    SendMessageW(m_hDisplay, EM_REPLACESEL, (WPARAM)FALSE, (LPARAM)szUser);
    SendMessageW(m_hDisplay, EM_REPLACESEL, (WPARAM)FALSE, (LPARAM)L" says:\n");

    // Set format for the message text
    cf.cbSize = sizeof(CHARFORMAT);
    cf.dwMask = CFM_COLOR;
    cf.dwEffects = CFE_AUTOCOLOR;
    cf.crTextColor = 0;

    SendMessage(m_hDisplay, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);

    pf.cbSize = sizeof(PARAFORMAT);
    pf.dwMask = PFM_STARTINDENT;
    pf.dxStartIndent = 200;

    SendMessage(m_hDisplay, EM_SETPARAFORMAT, 0, (LPARAM)&pf);

    // Paste the message text in the edit control
    SendMessageW(m_hDisplay, EM_REPLACESEL, (WPARAM)FALSE, (LPARAM)szMessage);

    // Paste a new line in the edit control
    SendMessageW(m_hDisplay, EM_REPLACESEL, (WPARAM)FALSE, (LPARAM)L"\n");

    // Scroll to the bottom of the edit control
    SendMessage(m_hDisplay, WM_VSCROLL, SB_BOTTOM, 0);

    return S_OK;
}

HRESULT CRTCIMSession::DoDisplayTyping | ( | PWSTR | szUser,
 |  | BOOL | fTyping |
 | ) |  |  | [protected]

Definition at line 340 of file rtcim.cpp.

{
    if (fTyping)
    {
        // Display typing status in the status bar.
        WCHAR szTyping[MAX_STRING];
        _snwprintf(szTyping, MAX_STRING, L"%s is typing.", szUser);
        szTyping[MAX_STRING-1] = L'\0';

        SetStatusText(szTyping);
    }
    else
    {
        // User is not longer typing. Display the session
        // state in the status bar.
        DeliverSessionState(m_enState);
    }

    return S_OK;
}

HRESULT CRTCIMSession::DoSendMessage ( ) [protected]

Definition at line 182 of file rtcim.cpp.

{
    LONG cch;
    BSTR bstrMessage = NULL;
    HRESULT hr;

    // Determine the length of the outgoing message
    // in the edit box
    cch = SendMessageW(m_hEdit, WM_GETTEXTLENGTH, 0, 0);

    if (cch > 0)
    {
        // Allocate a buffer for the outgoing message
        bstrMessage = SysAllocStringLen(NULL, cch);

        if (bstrMessage == NULL)
        {
            // SysAllocStringLen failed
            return E_OUTOFMEMORY;
        }

        // Get the outgoing message from the edit box
        if (cch != SendMessageW(m_hEdit, WM_GETTEXT, cch+1, (LPARAM)bstrMessage))
        {
            // SendMessageW failed
            SAFE_FREE_STRING(bstrMessage);
            return E_FAIL;
        }

        // Get the local user URI
        BSTR bstrURI = NULL;

        hr = m_pWin->GetUserURI(&bstrURI);

        if (FAILED(hr))
        {
            // GetUserURI failed
            SAFE_FREE_STRING(bstrMessage);
            return hr;
        }

        // Display the outgoing message
        DoDisplayMessage(bstrURI, bstrMessage);

        SAFE_FREE_STRING(bstrURI);

        // Clear the edit box
        SetWindowText(m_hEdit, L"");

        // Send the outgoing message
        hr = m_pSession->SendMessage(NULL, bstrMessage, 0);

        SAFE_FREE_STRING(bstrMessage);

        if (FAILED(hr))
        {
            // SendMessage failed
            return hr;
        }
    }

    return S_OK;
}

HRESULT CRTCIMSession::DoSendTyping ( ) [protected]

Definition at line 308 of file rtcim.cpp.

{
    BOOL fTyping;
    HRESULT hr;

    // Is the edit box empty?
    fTyping = (SendMessage(m_hEdit, WM_GETTEXTLENGTH, 0, 0) > 0);

    if (m_fTyping != fTyping)
    {
        // Typing status has changed
        m_fTyping = fTyping;

        hr = m_pSession->SendMessageStatus(
            m_fTyping ? RTCMUS_TYPING : RTCMUS_IDLE,
            0);

        if (FAILED(hr))
        {
            // SendMessageStatus failed
            return hr;
        }
    }

    return S_OK;
}

LRESULT CALLBACK CRTCIMSession::EditSubclassProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 146 of file rtcim.cpp.

{
    CRTCIMSession * me = NULL;
    me = (CRTCIMSession *)GetWindowLong(hWnd, GWL_USERDATA);

    if ( uMsg == WM_KEYDOWN )
    {
        // Intercept the return key from the edit box
        // and press the send button
        if ( (wParam == VK_RETURN) &&
             !(GetKeyState(VK_CONTROL) & 0x8000))
        {
            SendMessage(me->m_hWnd, WM_COMMAND,
                MAKEWPARAM(IDC_IM_SEND, BN_CLICKED),
                (LPARAM)me->m_hSend);

            return 0;
        }
    }

    // Call the original edit window procedure
    return CallWindowProc(
        me->m_wpOrigEditProc,
        hWnd, uMsg, wParam, lParam);
}

LRESULT CRTCIMSession::OnCommand | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected]

Definition at line 531 of file rtcim.cpp.

{
    if (HIWORD(wParam) == EN_CHANGE)
    {
        switch(LOWORD(wParam))
        {
        case IDC_IM_EDIT:
            DoSendTyping();
            break;
        }
    }
    else
    {
        switch(LOWORD(wParam))
        {
        case ID_FILE_EXIT:
            PostMessage(m_hWnd, WM_CLOSE, 0, 0);
            break;

        case IDC_IM_SEND:
            DoSendMessage();
            break;
        }
    }

    return 0;
}

LRESULT CRTCIMSession::OnCreate | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]

Reimplemented from CRTCSession.

Definition at line 366 of file rtcim.cpp.

{
    // Call the base class
    CRTCSession::OnCreate(uMsg, wParam, lParam);

    // Create the display control
    m_hDisplay = CreateWindowEx(
        WS_EX_CLIENTEDGE,
        RICHEDIT_CLASS,
        NULL,
        WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_VSCROLL |
        ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY,
        0, 0,
        0, 0,
        m_hWnd,
        (HMENU)IDC_IM_DISPLAY,
        GetModuleHandle(NULL),
        NULL);

    if ( !m_hDisplay )
    {
        // CreateWindowEx failed
        return -1;
    }

    SendMessage(m_hDisplay, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cfDefault);

    // Create the edit control
    m_hEdit = CreateWindowEx(
        WS_EX_CLIENTEDGE,
        RICHEDIT_CLASS,
        NULL,
        WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_VSCROLL |
        ES_MULTILINE | ES_AUTOVSCROLL,
        0, 0,
        0, 0,
        m_hWnd,
        (HMENU)IDC_IM_EDIT,
        GetModuleHandle(NULL),
        NULL);

    if ( !m_hEdit )
    {
        // CreateWindowEx failed
        return -1;
    }

    SendMessage(m_hEdit, EM_SETEVENTMASK, 0, ENM_CHANGE);
    SendMessage(m_hEdit, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cfDefault);

    // Subclass the edit window
    m_wpOrigEditProc = (WNDPROC)SetWindowLong(m_hEdit,
        GWL_WNDPROC, (LONG)CRTCIMSession::EditSubclassProc);
    SetWindowLong(m_hEdit, GWL_USERDATA, (LONG)this);

    // Create the send button
    m_hSend = CreateWindowExW(
        0,
        L"BUTTON",
        L"Send",
        WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | BS_PUSHBUTTON,
        0, 0,
        0, 0,
        m_hWnd,
        (HMENU)IDC_IM_SEND,
        GetModuleHandle(NULL),
        NULL);

    if ( !m_hSend )
    {
        // CreateWindowExW failed
        return -1;
    }

    // Set focus to the edit window
    SetFocus(m_hEdit);

    return 0;
}

LRESULT CRTCIMSession::OnDestroy | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]

Reimplemented from CRTCSession.

Definition at line 451 of file rtcim.cpp.

{
    // Call the base class
    CRTCSession::OnDestroy(uMsg, wParam, lParam);

    // Unsubclass the edit window
    SetWindowLong(m_hEdit, GWL_WNDPROC, (LONG)m_wpOrigEditProc);

    return 0;
}

LRESULT CRTCIMSession::OnSize | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]

Reimplemented from CRTCSession.

Definition at line 467 of file rtcim.cpp.

{
    // Call the base class
    CRTCSession::OnSize(uMsg, wParam, lParam);

    RECT rcWnd, rcStatusBar, rcDisplay, rcEdit, rcSend;
    const int SIZE_EDGE = 5;
    const int SIZE_BUTTON = 60;

    GetClientRect(m_hWnd, &rcWnd);
    GetClientRect(m_hStatusBar, &rcStatusBar);

    // Resize the send button
    rcSend.bottom = rcWnd.bottom -
        (rcStatusBar.bottom - rcStatusBar.top) -
        SIZE_EDGE;
    rcSend.top = rcSend.bottom - SIZE_BUTTON;
    rcSend.right = rcWnd.right - SIZE_EDGE;
    rcSend.left = rcSend.right - SIZE_BUTTON;

    MoveWindow(
        m_hSend,
        rcSend.left,
        rcSend.top,
        (rcSend.right - rcSend.left),
        (rcSend.bottom - rcSend.top),
        TRUE);

    // Resize the edit control
    rcEdit.bottom = rcSend.bottom;
    rcEdit.top = rcSend.top;
    rcEdit.right = rcSend.left - SIZE_EDGE;
    rcEdit.left = rcWnd.left + SIZE_EDGE;

    MoveWindow(
        m_hEdit,
        rcEdit.left,
        rcEdit.top,
        (rcEdit.right - rcEdit.left),
        (rcEdit.bottom - rcEdit.top),
        TRUE);

    // Resize the display control
    rcDisplay.bottom = rcEdit.top - SIZE_EDGE;
    rcDisplay.top = rcWnd.top + SIZE_EDGE;
    rcDisplay.right = rcWnd.right - SIZE_EDGE;
    rcDisplay.left = rcWnd.left + SIZE_EDGE;

    MoveWindow(
        m_hDisplay,
        rcDisplay.left,
        rcDisplay.top,
        (rcDisplay.right - rcDisplay.left),
        (rcDisplay.bottom - rcDisplay.top),
        TRUE);

    return 0;
}

HRESULT CRTCIMSession::RegisterClass ( ) [static]

Definition at line 48 of file rtcim.cpp.

{
    // Register the window class
    WNDCLASS wc;
    ATOM atom;

    ZeroMemory(&wc, sizeof(WNDCLASS));

    wc.style         = CS_HREDRAW | CS_VREDRAW;
    wc.lpfnWndProc   = (WNDPROC)CRTCIMSession::WindowProc;
    wc.hInstance     = GetModuleHandle(NULL);
    wc.hIcon         = NULL;
    wc.hCursor       =
        LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground =
        GetSysColorBrush(COLOR_3DFACE);
    wc.lpszMenuName  = MAKEINTRESOURCE(IDR_MENU_IM);
    wc.lpszClassName = IM_CLASS;

    atom = ::RegisterClass( &wc );

    if ( !atom )
    {
        // RegisterClass failed
        return E_FAIL;
    }

    return S_OK;
}

LRESULT CALLBACK CRTCIMSession::WindowProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 83 of file rtcim.cpp.

{
    CRTCIMSession * me = NULL;
    LRESULT  lr = 0;

    if ( uMsg == WM_CREATE )
    {
        // Create an instance of the class
        me = new CRTCIMSession;
        me->m_hWnd = hWnd;

        // Store the class instance pointer in the
        // window's user data for later retrieval
        SetWindowLong(hWnd, GWL_USERDATA, (LONG)me);

        lr = me->OnCreate(uMsg, wParam, lParam);
    }
    else
    {
        // Retrieve the class instance pointer from the
        // window's user data
        me = (CRTCIMSession *)GetWindowLong(hWnd, GWL_USERDATA);

        switch( uMsg )
        {
        case WM_DESTROY:
            lr = me->OnDestroy(uMsg, wParam, lParam);

            // Delete the object instance
            delete me;

            break;

        case WM_CLOSE:
            lr = me->OnClose(uMsg, wParam, lParam);
            break;

        case WM_SIZE:
            lr = me->OnSize(uMsg, wParam, lParam);
            break;

        case WM_COMMAND:
            lr = me->OnCommand(uMsg, wParam, lParam);
            break;

        default:
            lr = DefWindowProc( hWnd, uMsg, wParam, lParam );
        }
    }

    return lr;
}

Member Data Documentation

BOOL CRTCIMSession::m_fTyping [protected]

Definition at line 38 of file rtcim.h.

HWND CRTCIMSession::m_hDisplay [protected]

Definition at line 35 of file rtcim.h.

HWND CRTCIMSession::m_hEdit [protected]

Definition at line 36 of file rtcim.h.

HWND CRTCIMSession::m_hSend [protected]

Definition at line 37 of file rtcim.h.

WNDPROC CRTCIMSession::m_wpOrigEditProc [protected]

Definition at line 39 of file rtcim.h.

The documentation for this class was generated from the following files:
  • NetDS/rtc/Client/CPP/rtcsample/rtcim.h
  • NetDS/rtc/Client/CPP/rtcsample/rtcim.cpp
Generated on Wed Nov 13 2024 16:57:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CRTCIncomingApp Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CRTCIncomingApp Class Reference

#include "RTCIncoming.h"

Inherits CWinApp.

List of all members.

Public Member Functions

CRTCIncomingApp ()
virtual BOOL InitInstance ()

Detailed Description

Definition at line 38 of file RTCIncoming.h.

Constructor & Destructor Documentation

CRTCIncomingApp::CRTCIncomingApp ( )

Definition at line 49 of file RTCIncoming.cpp.

{
  // No Initialization Code Required.
}

Member Function Documentation

BOOL CRTCIncomingApp::InitInstance ( void ) [virtual]

Reimplemented from CWinApp.

Definition at line 72 of file RTCIncoming.cpp.

{
  AfxEnableControlContainer();

#ifdef _AFXDLL
  Enable3dControls();     // Call this when using MFC in a shared DLL
#else
  Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif

  CRTCIncomingDlg dlg;
  m_pMainWnd = &dlg;

  //
  // Starting the Main RTCIncoming Dialog Box
  // no response processing
  //
  int nResponse = dlg.DoModal();

  return FALSE;
}

The documentation for this class was generated from the following files:
  • NetDS/rtc/Client/CPP/RTCIncoming/RTCIncoming.h
  • NetDS/rtc/Client/CPP/RTCIncoming/RTCIncoming.cpp
Generated on Wed Nov 13 2024 16:57:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CRTCIncomingDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes

CRTCIncomingDlg Class Reference

#include "RTCIncomingDlg.h"

List of all members.

Public Types

enum | { IDD = IDD_RTCINCOMING_DIALOG }

Public Member Functions

CRTCIncomingDlg (CWnd *pParent=NULL)

Public Attributes

CButton | m_btnAnswer
CButton | m_btnDisconnect
CButton | m_chkAutoAnswer
CEdit | m_ctrlEditStatus

Protected Types

typedef enum
CRTCIncomingDlg::tagSESSION_OPERATION 		SESSION_OPERATION
enum | tagSESSION_OPERATION { STO_ANSWER, STO_TERMINATE }

Protected Member Functions

ULONG STDMETHODCALLTYPE | AddRef (void)
HRESULT | AddToMediaCapabilities (LONG lMedia, VARIANT_BOOL fPersist)
virtual void | DoDataExchange (CDataExchange *pDX)
HRESULT STDMETHODCALLTYPE | Event (RTC_EVENT RTCEvent, IDispatch *pEvent)
HRESULT | InitializeRTCApp ()
afx_msg void | OnAnswer ()
afx_msg void | OnCheckauto ()
afx_msg void | OnClose ()
afx_msg void | OnDisconnect ()
virtual BOOL | OnInitDialog ()
afx_msg void | OnPaint ()
afx_msg HCURSOR | OnQueryDragIcon ()
afx_msg void | OnSysCommand (UINT nID, LPARAM lParam)
HRESULT STDMETHODCALLTYPE | QueryInterface (REFIID iid, void **ppvObject)
ULONG STDMETHODCALLTYPE | Release (void)
HRESULT | ReleaseStateMachine ()
HRESULT | RTCClientEvent (IDispatch *pIDispatch)
HRESULT | RTCMediaEvent (IDispatch *pIDispatch)
HRESULT | RTCSessionStateEvent (IDispatch *pIDispatch)
HRESULT | SetAutoAnswerMode (VARIANT_BOOL bMode)
HRESULT | ShutdownRTCApp ()
void | StateAnswerIDC (VARIANT_BOOL fEnable)
HRESULT | StateCoCreateClient ()
void | StateDisconnectIDC (VARIANT_BOOL fEnable)
HRESULT | StateInitClient ()
HRESULT | StateListenMode (RTC_LISTEN_MODE lMode)
HRESULT | StateQueryActiveMedia (LONG *plActiveMedia)
HRESULT | StateSessionControl (SESSION_OPERATION soType)
HRESULT | StateSinkEvent (LONG lEventMask)
HRESULT | StateUnSinkEvent ()
virtual LRESULT | WindowProc (UINT message, WPARAM wParam, LPARAM lParam)

Protected Attributes

VARIANT_BOOL | m_bAutoAnswer
DWORD m_dwEventCookie
LONG | m_dwRefCount
HICON | m_hIcon
IVideoWindow * | m_pIPrevVideo
IVideoWindow * | m_pIRecvVideo
IRTCClient * | m_pIRTCClient
IRTCSession * | m_pIRTCSession

Detailed Description

Definition at line 57 of file RTCIncomingDlg.h.

Member Typedef Documentation

typedef enum CRTCIncomingDlg::tagSESSION_OPERATION CRTCIncomingDlg::SESSION_OPERATION [protected]

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 71 of file RTCIncomingDlg.h.

{ IDD = IDD_RTCINCOMING_DIALOG };

enum CRTCIncomingDlg::tagSESSION_OPERATION [protected]
Enumerator:
STO_ANSWER
STO_TERMINATE

Definition at line 129 of file RTCIncomingDlg.h.

  {

    STO_ANSWER,
    STO_TERMINATE

  } SESSION_OPERATION;

Constructor & Destructor Documentation

CRTCIncomingDlg::CRTCIncomingDlg ( CWnd * pParent = NULL )

Definition at line 134 of file RTCIncomingDlg.cpp.

  : CDialog(CRTCIncomingDlg::IDD, pParent)
{
  //{{AFX_DATA_INIT(CRTCIncomingDlg)

    m_pIRTCClient    = NULL;
  m_pIRTCSession   = NULL;
  m_dwEventCookie  = 0;
  m_pIRecvVideo    = NULL;
  m_pIPrevVideo    = NULL;
  m_bAutoAnswer    = VARIANT_FALSE;

  //}}AFX_DATA_INIT
  // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
  m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

Member Function Documentation

ULONG CRTCIncomingDlg::AddRef ( void ) [protected]

Definition at line 1340 of file RTCIncomingDlg.cpp.

{

  ULONG ulrefCount = InterlockedIncrement(&m_dwRefCount);
  return ulrefCount;
}

HRESULT CRTCIncomingDlg::AddToMediaCapabilities | ( | LONG | lMedia,
 |  | VARIANT_BOOL | fPersist |
 | ) |  |  | [protected]

Definition at line 1234 of file RTCIncomingDlg.cpp.

{

  HRESULT hr = S_OK;
  LONG    lGetMedia = 0;
  LONG    lSetMedia = 0;

  _ASSERTE(NULL != m_pIRTCClient);

  //
  // Get the Current Media Capabilities
  // and then add the media mask to the current media
  //

  hr = m_pIRTCClient->get_MediaCapabilities(&lGetMedia);

  if (FAILED(hr))
  {
    LOGMSGERROR(_T("IRTCClient::get_MediaCapabilities() Failed 0x%x"), hr);
    return hr;
  }
  else
  {
    //
    // Add New Media Capability to Current Media Mask
    //

    lSetMedia = lGetMedia | lMedia;

    hr = m_pIRTCClient->SetPreferredMediaTypes(lSetMedia, fPersist);

    if (FAILED(hr))
    {
      LOGMSGERROR(_T("IRTCClient::SetPreferredMediaTypes Failed 0x%x"), hr);
      return hr;
    }

  }

  return hr;
}

void CRTCIncomingDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 166 of file RTCIncomingDlg.cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CRTCIncomingDlg)
  DDX_Control(pDX, IDC_CHECKAUTO, m_chkAutoAnswer);
  DDX_Control(pDX, IDC_STATUS, m_ctrlEditStatus);
  DDX_Control(pDX, IDC_DISCONNECT, m_btnDisconnect);
  DDX_Control(pDX, IDC_ANSWER, m_btnAnswer);
  //}}AFX_DATA_MAP
}

HRESULT STDMETHODCALLTYPE CRTCIncomingDlg::Event | ( | RTC_EVENT | RTCEvent,
 |  | IDispatch * | pEvent |
 | ) |  |  | [protected]

Definition at line 1393 of file RTCIncomingDlg.cpp.

{
  HRESULT hr  = S_OK;

  if (NULL != pEvent)
  {
    switch (RTCEvent)
    {

      case RTCE_CLIENT                    :
      hr =  RTCClientEvent(pEvent);
        break;
      case RTCE_SESSION_STATE_CHANGE      :
        hr =  RTCSessionStateEvent(pEvent);
        break;
      case RTCE_MEDIA                     :
        hr =    RTCMediaEvent(pEvent);
        break;
        default:  break;
    }
  }

    return hr;
}

HRESULT CRTCIncomingDlg::InitializeRTCApp ( ) [protected]

Definition at line 387 of file RTCIncomingDlg.cpp.

{

  HRESULT hr = S_OK;

  //
  // CoCreating CLSID_RTCClient object and getting
  // the IRTCClient Interface
  //

  hr = StateCoCreateClient();

  if (FAILED(hr))
  {
    return hr;
  }

  //
  // Initializing the Client
  //

  hr = StateInitClient();

  if (FAILED(hr))
  {
    return hr;
  }

  // Setting the Event Call Back Connection Point for
  // the Source sink

  hr = StateSinkEvent(0);

  if (FAILED(hr))
  {
    return hr;
  }

  //
  // Setting the Listen mode to receive incoming calls
  // event notifications. RTCLM_BOTH flag causes the
  // application to open and listen on a dynamic and a
  // registered port 5060 for any incoming SIP messages.
  //

  hr = StateListenMode( RTCLM_BOTH );

  if (FAILED(hr))
  {
    return hr;
  }

  return hr;
}

void CRTCIncomingDlg::OnAnswer ( ) [protected]

Definition at line 562 of file RTCIncomingDlg.cpp.

{

  HRESULT hr = S_OK;

  hr = StateSessionControl(STO_ANSWER);

  if (FAILED(hr))
  {
    LOGMSGERROR(_T("StateSessionControl(ANSWER): Failed 0x%x"), hr);
  }
  else
  {
    StateDisconnectIDC(VARIANT_TRUE);
  }
}

void CRTCIncomingDlg::OnCheckauto ( ) [protected]

Definition at line 625 of file RTCIncomingDlg.cpp.

{
  if ( 1  == m_chkAutoAnswer.GetCheck())
  {
    SetAutoAnswerMode(VARIANT_TRUE);
  }
  else
  {
    SetAutoAnswerMode(VARIANT_FALSE);
  }
}

void CRTCIncomingDlg::OnClose ( ) [protected]

Definition at line 646 of file RTCIncomingDlg.cpp.

{

  HRESULT   hr = S_OK;

  _ASSERTE(NULL != m_pIRTCClient);

  //
  // Need to call PrepareForShutdown Before shutdown
  //

  hr = m_pIRTCClient->PrepareForShutdown();
  if (FAILED(hr))
  {
     LOGMSGERROR(_T("IRTCClient::PrepareForShutdown Failed 0x%x"), hr);
     m_pIRTCClient->Shutdown();
     return;
  }

  ShowWindow( SW_HIDE );
}

void CRTCIncomingDlg::OnDisconnect ( ) [protected]

Definition at line 593 of file RTCIncomingDlg.cpp.

{

  HRESULT  hr   = S_OK;
  hr = StateSessionControl(STO_TERMINATE);

  if (FAILED(hr))
  {
    LOGMSGERROR(_T("StateSessionControl(TERMINATE): Failed 0x%x"), hr);

  }

  //
  // Disable Disconnect Button and Enable Answer
  //

  StateDisconnectIDC(VARIANT_FALSE);
  StateAnswerIDC(VARIANT_FALSE);
}

BOOL CRTCIncomingDlg::OnInitDialog ( ) [protected, virtual]

Definition at line 205 of file RTCIncomingDlg.cpp.

{
  CDialog::OnInitDialog();

  //
  // Add "About..." menu item to system menu.
  // IDM_ABOUTBOX must be in the system command range
  //

  ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
  ASSERT(IDM_ABOUTBOX < 0xF000);

  CMenu* pSysMenu = GetSystemMenu(FALSE);
  if (pSysMenu != NULL)
  {
    CString strAboutMenu;
    strAboutMenu.LoadString(IDS_ABOUTBOX);
    if (!strAboutMenu.IsEmpty())
    {
      pSysMenu->AppendMenu(MF_SEPARATOR);
      pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
    }
  }

  //
  // Set the icon for this dialog.  The framework does this automatically
  //  when the application's main window is not a dialog
  //

  SetIcon(m_hIcon, TRUE);     // Set big icon
  SetIcon(m_hIcon, FALSE);    // Set small icon

  //
  // Initalize the COM Threading Model
  //

  ::CoInitializeEx(NULL,COINIT_APARTMENTTHREADED);

  //
  // UI Disable Call Control Buttons
  //
  //

  StateAnswerIDC(VARIANT_FALSE);
  StateDisconnectIDC(VARIANT_FALSE);

  //
  // Initialize RTC App to get ready for
  // Incoming Call listen mode
  //

  HRESULT hr = InitializeRTCApp();

  if (FAILED(hr))
  {
    LOGMSGERROR(_T("InitializeRTCApp() Failed: 0x%x"), hr);
    return FALSE;
  }

  // return TRUE  unless you set the focus to a control
  return TRUE;

}

void CRTCIncomingDlg::OnPaint ( void ) [protected]

Definition at line 319 of file RTCIncomingDlg.cpp.

{
  if (IsIconic())
  {
    CPaintDC dc(this); // device context for painting

    SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

    // Center icon in client rectangle
    int cxIcon = GetSystemMetrics(SM_CXICON);
    int cyIcon = GetSystemMetrics(SM_CYICON);
    CRect rect;
    GetClientRect(&rect);
    int x = (rect.Width() - cxIcon + 1) / 2;
    int y = (rect.Height() - cyIcon + 1) / 2;

    // Draw the icon
    dc.DrawIcon(x, y, m_hIcon);
  }
  else
  {
    CDialog::OnPaint();
  }
}

HCURSOR CRTCIncomingDlg::OnQueryDragIcon ( ) [protected]

Definition at line 357 of file RTCIncomingDlg.cpp.

{
  return (HCURSOR) m_hIcon;
}

void CRTCIncomingDlg::OnSysCommand | ( | UINT | nID,
 |  | LPARAM | lParam |
 | ) |  |  | [protected]

Definition at line 289 of file RTCIncomingDlg.cpp.

{
  if ((nID & 0xFFF0) == IDM_ABOUTBOX)
  {
    CAboutDlg dlgAbout;
    dlgAbout.DoModal();
  }
  else
  {
    CDialog::OnSysCommand(nID, lParam);
  }
}

HRESULT CRTCIncomingDlg::QueryInterface | ( | REFIID | iid,
 |  | void ** | ppvObject |
 | ) |  |  | [protected]

Definition at line 1297 of file RTCIncomingDlg.cpp.

{
  if(iid == IID_IRTCEventNotification)
  {

    *ppvObject = static_cast<IRTCEventNotification *> (this);
    AddRef();
    return S_OK;
  }

  if(iid == IID_IUnknown)
  {

    *ppvObject = static_cast<IUnknown *> (this);
    AddRef();
    return S_OK;
  }

  else
  {
     *ppvObject = NULL;
     return E_NOINTERFACE;
  }

  return S_OK;
}

ULONG CRTCIncomingDlg::Release ( void ) [protected]

Definition at line 1362 of file RTCIncomingDlg.cpp.

{

  ULONG ulrefCount = InterlockedDecrement(&m_dwRefCount);

  if(0 == ulrefCount)
  {
    delete this;
  }

  return ulrefCount;
}

HRESULT CRTCIncomingDlg::ReleaseStateMachine ( ) [protected]

Definition at line 1188 of file RTCIncomingDlg.cpp.

{

  ULONG ulRef         = 0;
  BOOL  fRet          = FALSE;

  if ( NULL != m_pIRecvVideo )
  {

    ulRef = m_pIRecvVideo->Release();
    m_pIRecvVideo = NULL;

  }

  if ( NULL != m_pIPrevVideo )
  {

    ulRef = m_pIPrevVideo->Release();
    m_pIPrevVideo = NULL;

  }

  if ( NULL != m_pIRTCSession )
  {

    ulRef = m_pIRTCSession->Release();
    m_pIRTCSession = NULL;
  }

  return S_OK;
}

HRESULT CRTCIncomingDlg::RTCClientEvent ( IDispatch * pIDispatch ) [protected]

Definition at line 1441 of file RTCIncomingDlg.cpp.

{
  HRESULT               hr            = S_OK;
  IRTCClientEvent      *pIClientEvent = NULL;
  RTC_CLIENT_EVENT_TYPE EventType;

  hr = pIDispatch->QueryInterface(IID_IRTCClientEvent,
                  reinterpret_cast<void**> (&pIClientEvent)
                  );

  if (FAILED(hr))
  {
    LOGMSGERROR(_T("IDispatch::QueryInterface(IRTCClientEvent) Failed 0x%x"),
      hr);
    return hr;
  }

  //
  // Getting the Session Interface
  //

  hr = pIClientEvent->get_EventType(&EventType);

  if (FAILED(hr))
  {
    LOGMSGERROR(_T("IRTCClientEvent::get_EventType Failed 0x%x"), hr);

    pIClientEvent->Release();
    pIClientEvent = NULL;
    return hr;
  }

  if (RTCCET_ASYNC_CLEANUP_DONE  == EventType)
  {
    //
    // When the WndProc gets this message we can
    // destroy the window
    //

    DBLOGGER(_T("Final Exit ... ASYNC_CLEANUP_DONE\n"));

    SendMessage(WM_RTCCORE_EVENT, (WPARAM) EventType, (LPARAM) NULL);
  }

  if (NULL != pIClientEvent)
  {
    pIClientEvent->Release();
    pIClientEvent = NULL;

  }
  return hr;
}

HRESULT CRTCIncomingDlg::RTCMediaEvent ( IDispatch * pIDispatch ) [protected]

Definition at line 1668 of file RTCIncomingDlg.cpp.

{
  HRESULT hr                          = S_OK;
  IRTCMediaEvent        *pIMediaEvent = NULL;
  LONG                   lMediaType   = 0;
  HWND                   hwdVideoRecv , hwdVideoSend;
  RTC_MEDIA_EVENT_TYPE   EventType;

  hr = pIDispatch->QueryInterface(IID_IRTCMediaEvent,
                  reinterpret_cast<void**> (&pIMediaEvent)
                  );

  if (FAILED(hr))
  {

    LOGMSGERROR(_T("IDispatch::QueryInterface(IRTCMediaEvent) Failed 0x%x"), hr);
    return hr;
  }

  pIMediaEvent->get_MediaType(&lMediaType);
  pIMediaEvent->get_EventType(&EventType);

  if ( (lMediaType == RTCMT_VIDEO_RECEIVE) && (EventType == RTCMET_STARTED) )
  {

       RECT    rectPos;

       hr = m_pIRTCClient->get_IVideoWindow(  RTCVD_RECEIVE , &m_pIRecvVideo);

      if (SUCCEEDED(hr))
      {
        CString cstrText;

        hr = m_pIRecvVideo->put_WindowStyle(WS_CHILD | WS_CLIPSIBLINGS);

        if(FAILED(hr))
        {
          LOGMSGERROR(_T("IVideoWindow::put_WindowStyle() Failed 0x%x"), hr);

          pIMediaEvent->Release();
          pIMediaEvent = NULL;

          return hr;
        }

        hr = m_pIRecvVideo->put_Owner((OAHWND) m_hWnd);

        if(FAILED(hr))
        {

          LOGMSGERROR(_T("IVideoWindow::put_Owner() Failed 0x%x"), hr);

          pIMediaEvent->Release();
          pIMediaEvent = NULL;

          return hr;
        }

        GetDlgItem( IDC_VRECV, &hwdVideoRecv );

        ::GetClientRect(hwdVideoRecv, &rectPos);

            hr = m_pIRecvVideo->SetWindowPosition(
          rectPos.left   + RECVVID_LEFT,
        rectPos.top    + RECVVID_TOP,
        rectPos.right  - RECVVID_RIGHT,
        rectPos.bottom - RECVVID_BOTTOM
        );

        if(FAILED(hr))
        {
          LOGMSGERROR(_T("IVideoWindow::SetWindowPosition() Failed 0x%x"), hr);

          pIMediaEvent->Release();
          pIMediaEvent = NULL;

          return hr;
        }

        hr = m_pIRecvVideo->put_Visible(TRUE);

        if (FAILED(hr))
        {
          LOGMSGERROR(_T("IVideoWindow::put_Visible Failed 0x%x"), hr);

          pIMediaEvent->Release();
          pIMediaEvent = NULL;

          return hr;
        }

      }

  }

  else if ( ( lMediaType == RTCMT_VIDEO_RECEIVE) && (EventType == RTCMET_STOPPED))
  {

    //
    // we must put_Visible false and set the owner
    // as null See DShow IVideoWindow SDK
    // NOTE: should not close window without releasing video
    // or not removing handler ownership from video window.
    //

    m_pIRecvVideo->put_Visible(FALSE);
    m_pIRecvVideo->put_Owner(NULL);

    m_pIRecvVideo->Release();
    m_pIRecvVideo = NULL;

  }

  else if ( (lMediaType == RTCMT_VIDEO_SEND) &&  (EventType == RTCMET_STARTED))
  {

       RECT    rectPos;

       hr = m_pIRTCClient->get_IVideoWindow(  RTCVD_PREVIEW , &m_pIPrevVideo);

      if (SUCCEEDED(hr))
      {
        CString cstrText;

        hr = m_pIPrevVideo->put_WindowStyle(WS_CHILD | WS_CLIPSIBLINGS);

        if(FAILED(hr))
        {
          LOGMSGERROR(_T("IVideoWindow::put_WindowStyle() Failed 0x%x"), hr);

          pIMediaEvent->Release();
          pIMediaEvent = NULL;

          return hr;
        }

        hr = m_pIPrevVideo->put_Owner((OAHWND) m_hWnd);

        if(FAILED(hr))
        {

          LOGMSGERROR(_T("IVideoWindow::put_Owner() Failed 0x%x"), hr);

          pIMediaEvent->Release();
          pIMediaEvent = NULL;
          return hr;
        }

        GetDlgItem( IDC_VSEND , &hwdVideoSend );

        ::GetClientRect(hwdVideoSend, &rectPos);

            hr = m_pIPrevVideo->SetWindowPosition(
            rectPos.left + PREVVID_LEFT,
        rectPos.top  + PREVVID_TOP,
        rectPos.right - PREVVID_RIGHT,
        rectPos.bottom - PREVVID_BOTTOM);

        if(FAILED(hr))
        {
          LOGMSGERROR(_T("IVideoWindow::SetWindowPosition() Failed 0x%x"), hr);

          pIMediaEvent->Release();
          pIMediaEvent = NULL;
          return hr;
        }

        hr = m_pIPrevVideo->put_Visible(TRUE);

        if (FAILED(hr))
        {
          LOGMSGERROR(_T("IVideoWindow::put_Visible Failed 0x%x"), hr);

          pIMediaEvent->Release();
          pIMediaEvent = NULL;
          return hr;
        }

      }

  }

  else if ( ( lMediaType == RTCMT_VIDEO_SEND) &&
     (EventType == RTCMET_STOPPED))
  {

    //
    // we must put_Visible false and set the owner
    // as null See DShow IVideoWindow SDK
    // NOTE: should not close window without releasing video
    // or not removing handler ownership from video window.
    //

    m_pIPrevVideo->put_Visible(FALSE);
    m_pIPrevVideo->put_Owner(NULL);

    m_pIPrevVideo->Release();
    m_pIPrevVideo = NULL;

  }

  if (NULL != pIMediaEvent)
  {

    pIMediaEvent->Release();
    pIMediaEvent = NULL;

  }

  return hr;

}

HRESULT CRTCIncomingDlg::RTCSessionStateEvent ( IDispatch * pIDispatch ) [protected]

Definition at line 1508 of file RTCIncomingDlg.cpp.

{
  HRESULT hr                                  = S_OK;
  IRTCSessionStateChangeEvent *pISessionState = NULL;
  RTC_SESSION_STATE SessionState;

  hr = pIDispatch->QueryInterface(IID_IRTCSessionStateChangeEvent,
                  reinterpret_cast<void**> (&pISessionState)
                  );

  if (FAILED(hr))
  {

    LOGMSGERROR(_T("IDispatch::QueryInterface(IRTCSessionStateChangeEvent) Failed 0x%x"),
      hr);
    return hr;
  }

  //
  // Getting the Session Interface
  //

  hr = pISessionState->get_State(&SessionState);

  if (FAILED(hr))
  {
    LOGMSGERROR(_T("IRTCSessionStateChangeEvent::get_State Failed 0x%x"), hr);

    pISessionState->Release();
    pISessionState = NULL;
    return hr;
  }

  //
  // Determine the Session State to Perform automatic
  // operation or set the state in the Status Edit Box
  // if the session pointer is not null then we currently
  // have a session going on.
  //

  switch(SessionState)
  {
  case RTCSS_IDLE: break;
  case RTCSS_INCOMING:
  {

    if ( m_pIRTCSession != NULL)
    {
      pISessionState->Release();
      pISessionState = NULL;
      return S_OK;
    }

    m_ctrlEditStatus.SetWindowText(_T("Incoming Call..."));
    hr = pISessionState->get_Session(&m_pIRTCSession);

    if (FAILED(hr))
    {
      LOGMSGERROR(_T("IRTCSessionStateChangeEvent::get_Session Failed 0x%x"), hr);
      pISessionState->Release();
      pISessionState = NULL;
      return hr;
    }

    //
    // Answer Automatically if on Auto Answer mode
    //

    if (m_bAutoAnswer == VARIANT_TRUE)
    {

      if(SUCCEEDED(hr = StateSessionControl(STO_ANSWER)))
      {
        StateDisconnectIDC(VARIANT_TRUE);
      }
    }
    else
    {
       StateAnswerIDC(VARIANT_TRUE);
    }

    break;
  }
  case RTCSS_ANSWERING:
    m_ctrlEditStatus.SetWindowText(_T("Answering ..."));
    break;
  case RTCSS_INPROGRESS:
    m_ctrlEditStatus.SetWindowText(_T("In Progress ..."));
    break;
  case RTCSS_CONNECTED :
    m_ctrlEditStatus.SetWindowText(_T("Connected ..."));
    break;
  case RTCSS_DISCONNECTED:
    {
      //
      // Release the Session object if the Session
      // was terminated
      //

      StateDisconnectIDC(VARIANT_FALSE);
      StateAnswerIDC(VARIANT_FALSE);
      m_ctrlEditStatus.SetWindowText(_T("Disconnected ..."));
      m_ctrlEditStatus.SetWindowText(_T("Listening ..."));

      m_pIRTCSession->Release();
      m_pIRTCSession = NULL;

      break;
    }
  default :
    {

      pISessionState->Release();
      pISessionState = NULL;
      return E_UNEXPECTED;

    }

  }

  if (NULL != pISessionState)
  {
    pISessionState->Release();
    pISessionState = NULL;

  }

  return hr;
}

HRESULT CRTCIncomingDlg::SetAutoAnswerMode ( VARIANT_BOOL bMode ) [protected]

Definition at line 712 of file RTCIncomingDlg.cpp.

{
  m_bAutoAnswer = bMode;
  return S_OK;
}

HRESULT CRTCIncomingDlg::ShutdownRTCApp ( ) [protected]

Definition at line 453 of file RTCIncomingDlg.cpp.

{

  HRESULT hr  = S_OK;

    _ASSERTE(NULL != m_pIRTCClient);

    StateUnSinkEvent();

    hr = m_pIRTCClient->Shutdown();

   if (FAILED(hr))
   {
      LOGMSGERROR(_T("IRTCClient::Shutdown() Failed 0x%x"), hr);
   }

   ReleaseStateMachine();

   CoUninitialize();
   DestroyWindow();

  return S_OK;
}

void CRTCIncomingDlg::StateAnswerIDC ( VARIANT_BOOL fEnable ) [protected]

Definition at line 497 of file RTCIncomingDlg.cpp.

{
   if (VARIANT_TRUE == fEnable)
   {

      m_btnAnswer.ModifyStyle( WS_DISABLED , 0 , 0);
    RedrawWindow();

   }
   else
   {
      m_btnAnswer.ModifyStyle( 0 ,  WS_DISABLED, 0);
    RedrawWindow();
   }
}

HRESULT CRTCIncomingDlg::StateCoCreateClient ( ) [protected]

Definition at line 734 of file RTCIncomingDlg.cpp.

{

  HRESULT hr = S_OK;

  _ASSERTE(NULL != this);

  hr = CoCreateInstance(CLSID_RTCClient,
              NULL,
              CLSCTX_INPROC_SERVER,
              IID_IRTCClient,
              reinterpret_cast<void **> (&m_pIRTCClient)
              );

  if (FAILED(hr))
  {
    LOGMSGERROR(_T("CoCreateInstance(CLSID_RTCClient) : Failed 0x%x"), hr);
    return hr;
  }

  return hr;

}

void CRTCIncomingDlg::StateDisconnectIDC ( VARIANT_BOOL fEnable ) [protected]

Definition at line 527 of file RTCIncomingDlg.cpp.

{

   if (VARIANT_TRUE == fEnable)
   {

      m_btnDisconnect.ModifyStyle( WS_DISABLED , 0 , 0);
    RedrawWindow();
   }
   else
   {
      m_btnDisconnect.ModifyStyle( 0 ,  WS_DISABLED, 0);
    RedrawWindow();
   }
}

HRESULT CRTCIncomingDlg::StateInitClient ( ) [protected]

Definition at line 773 of file RTCIncomingDlg.cpp.

{

  HRESULT hr = S_OK;

  _ASSERTE(NULL != this);
  _ASSERTE(NULL != m_pIRTCClient);

  hr = m_pIRTCClient->Initialize();

  if (FAILED(hr))
  {

    LOGMSGERROR(_T("IRTCClient::Initialize : Failed 0x%x"),
      hr);
    return hr;
  }

  return hr;
}

HRESULT CRTCIncomingDlg::StateListenMode ( RTC_LISTEN_MODE lMode ) [protected]

Definition at line 877 of file RTCIncomingDlg.cpp.

{

  HRESULT hr = S_OK;

  _ASSERTE(NULL != this);
  _ASSERTE(NULL != m_pIRTCClient);

  //
  // Setting the Listen mode to receive incoming calls
  // event notifications. Depending upon the flag the
  // application will open and listen on a dynamic and/or a
  // registered port 5060 for any incoming SIP messages.
  //

  hr = m_pIRTCClient->put_ListenForIncomingSessions(lMode);

  if (FAILED(hr))
  {

    LOGMSGERROR(_T("IRTCClient::put_ListenForIncomingSessions Failed 0x%x"),
      hr);
    return hr;
  }
  else
  {
    m_ctrlEditStatus.SetWindowText(_T("Listening ..."));
  }

  return hr;
}

HRESULT CRTCIncomingDlg::StateQueryActiveMedia ( LONG * plActiveMedia ) [protected]

Definition at line 925 of file RTCIncomingDlg.cpp.

{
  HRESULT hr = S_OK;

  _ASSERTE(NULL != this);
  _ASSERTE(NULL != m_pIRTCClient);

  LONG   lActive   = 0;
  BSTR   bstrMedia = NULL;

  hr = m_pIRTCClient->get_ActiveMedia(&lActive);

  if (FAILED(hr))
  {
    LOGMSGERROR(_T("IRTCClient::get_ActiveMedia() Failed 0x%x"), hr);
    return hr;
  }

  *plActiveMedia = lActive;

  FREE_BSTR_IF(bstrMedia);

  return hr;
}

HRESULT CRTCIncomingDlg::StateSessionControl ( SESSION_OPERATION soType ) [protected]

Definition at line 810 of file RTCIncomingDlg.cpp.

{

  HRESULT hr = S_OK;

  _ASSERTE(NULL != this);
  _ASSERTE(NULL != m_pIRTCSession);

  switch(soType)
  {

  case STO_ANSWER:
    {

      hr = m_pIRTCSession->Answer();

      if ( FAILED(hr) )
      {

        LOGMSGERROR(_T("IRTCSession::Answer() Failed 0x%x"), hr);

        return hr;
      }

      //
      // Enable the Disconnect Button
      //

      StateDisconnectIDC(VARIANT_TRUE);

      break;
    }
  case STO_TERMINATE:
    {

      hr = m_pIRTCSession->Terminate( RTCTR_NORMAL );

      if ( FAILED(hr) )
      {
        LOGMSGERROR(_T("IRTCSession:::Terminate() Failed 0x%x"), hr);
      }

      break;
    }
  default:
    return E_NOTIMPL;

  }

  return hr;
}

HRESULT CRTCIncomingDlg::StateSinkEvent ( LONG lEventMask ) [protected]

Definition at line 966 of file RTCIncomingDlg.cpp.

{

  HRESULT                   hr          = S_OK;
  IUnknown                  *pUnknown   = NULL;
  IConnectionPointContainer *pCPC       = NULL;
  IConnectionPoint          *pCP        = NULL;

  _ASSERTE(NULL != this);
  _ASSERTE(NULL != m_pIRTCClient);

  //
  // For this Application we need to only
  // set the following Event Masks
  //

  lEventMask = RTCEF_CLIENT                     |
         RTCEF_SESSION_STATE_CHANGE       |
         RTCEF_MEDIA;

  //
  // Set the Event filter to the Client
  //

  hr = m_pIRTCClient->put_EventFilter(lEventMask);

  if (FAILED(hr))
  {

    LOGMSGERROR(_T("IRTCClient::put_EventFilter Failed 0x%x"),
      hr);

    return hr;
  }

  hr = QueryInterface(IID_IUnknown,
                reinterpret_cast<void**> (&pUnknown)
             );

  if (FAILED(hr))
  {
    LOGMSGERROR(_T("QueryInterface(IUnknown) Failed 0x%x"), hr);

    return hr;
  }

  //
  // Getting the ConnectionPointContainer
  // from IRTCEventNotification Interface
  //

  hr = m_pIRTCClient->QueryInterface(IID_IConnectionPointContainer,
                   reinterpret_cast<void**> (&pCPC)
                   );

  if (FAILED(hr))
  {

    LOGMSGERROR(_T("IRTCClient::QueryInterface(IConnectionPointContainer) Failed 0x%x"),
      hr);
    return hr;
  }

  //
  // Get the Connection Point
  //

  hr = pCPC->FindConnectionPoint( IID_IRTCEventNotification,
                  &pCP );

  if (FAILED(hr))
  {
    LOGMSGERROR(_T("IConnectionPointContainer::FindConnectionPoint() Failed 0x%x"),
      hr);

    pCPC->Release();
    return hr;
  }

  //
  // Advise and store cookie for UnAdvise later
  //

  hr = pCP->Advise( pUnknown, &m_dwEventCookie );

  if (FAILED(hr))
  {

    LOGMSGERROR(_T("IConnectionPoint::Advise() Failed 0x%x"), hr);

    pCPC->Release();
    pCP->Release();
    return hr;
  }

  pCP->Release();
  pCPC->Release();
  pUnknown->Release();

  return hr;
}

HRESULT CRTCIncomingDlg::StateUnSinkEvent ( ) [protected]

Definition at line 1088 of file RTCIncomingDlg.cpp.

{

  HRESULT            hr       = S_OK;
  IUnknown                  *pUnknown   = NULL;
  IConnectionPointContainer *pCPC       = NULL;
  IConnectionPoint          *pCP        = NULL;

  //
  // Get IUnknown From IRTCEventNotifcation derived
  // implementation (this class)
  //

  hr = QueryInterface(IID_IUnknown,
              reinterpret_cast<void**> (&pUnknown)
             );

  if (FAILED(hr))
  {
    LOGMSGERROR(_T("QueryInterface(IUnknown) Failed 0x%x"), hr);
    return hr;
  }

  //
  // Get the Connectionpoint container
  //

  hr = m_pIRTCClient->QueryInterface(IID_IConnectionPointContainer,
                   reinterpret_cast<void**> (&pCPC)
                   );

  if (FAILED(hr))
  {
    LOGMSGERROR(_T("IRTCClient::QueryInterface(IConnectionPointContainer) Failed 0x%x"), hr);

    return hr;
  }

  //
  // Find the Connection Point
  //

  hr = pCPC->FindConnectionPoint( IID_IRTCEventNotification,
                  &pCP );

  if (FAILED(hr))
  {

    LOGMSGERROR(_T("IConnectionPointContainer::FindConnectionPoint Failed 0x%x"),
      hr);

    pCPC->Release();
    return hr;
  }

  //
  // Call Advise and save cookie for unadvise
  //

  hr = pCP->Unadvise( m_dwEventCookie );

  if (FAILED(hr))
  {

    LOGMSGERROR(_T("IConnectionPoint::Unadvise() Failed 0x%x"),
      hr);

    pCPC->Release();
    pCP->Release();
    return hr;
  }

  pCP->Release();
  pCPC->Release();
  pUnknown->Release();

  return hr;
}

LRESULT CRTCIncomingDlg::WindowProc | ( | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]

Definition at line 679 of file RTCIncomingDlg.cpp.

{

  HRESULT    hr   = S_OK;

  switch(message)
  {
    case WM_RTCCORE_EVENT:
    {
      ShutdownRTCApp();
      break;
    }
  default : return CDialog::WindowProc(message, wParam, lParam);

  }

  return CDialog::WindowProc(message, wParam, lParam);
}

Member Data Documentation

VARIANT_BOOL CRTCIncomingDlg::m_bAutoAnswer [protected]

Definition at line 194 of file RTCIncomingDlg.h.

CButton CRTCIncomingDlg::m_btnAnswer

Definition at line 75 of file RTCIncomingDlg.h.

CButton CRTCIncomingDlg::m_btnDisconnect

Definition at line 74 of file RTCIncomingDlg.h.

CButton CRTCIncomingDlg::m_chkAutoAnswer

Definition at line 72 of file RTCIncomingDlg.h.

CEdit CRTCIncomingDlg::m_ctrlEditStatus

Definition at line 73 of file RTCIncomingDlg.h.

DWORD CRTCIncomingDlg::m_dwEventCookie [protected]

Definition at line 185 of file RTCIncomingDlg.h.

LONG CRTCIncomingDlg::m_dwRefCount [protected]

Definition at line 200 of file RTCIncomingDlg.h.

HICON CRTCIncomingDlg::m_hIcon [protected]

Definition at line 165 of file RTCIncomingDlg.h.

IVideoWindow* CRTCIncomingDlg::m_pIPrevVideo [protected]

Definition at line 193 of file RTCIncomingDlg.h.

IVideoWindow* CRTCIncomingDlg::m_pIRecvVideo [protected]

Definition at line 192 of file RTCIncomingDlg.h.

IRTCClient* CRTCIncomingDlg::m_pIRTCClient [protected]

Definition at line 173 of file RTCIncomingDlg.h.

IRTCSession* CRTCIncomingDlg::m_pIRTCSession [protected]

Definition at line 179 of file RTCIncomingDlg.h.

The documentation for this class was generated from the following files:
  • NetDS/rtc/Client/CPP/RTCIncoming/RTCIncomingDlg.h
  • NetDS/rtc/Client/CPP/RTCIncoming/RTCIncomingDlg.cpp
Generated on Wed Nov 13 2024 16:57:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CRTCOutgoingApp Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CRTCOutgoingApp Class Reference

#include "RTCOutgoing.h"

Inherits CWinApp.

List of all members.

Public Member Functions

CRTCOutgoingApp ()
virtual BOOL InitInstance ()

Detailed Description

Definition at line 36 of file RTCOutgoing.h.

Constructor & Destructor Documentation

CRTCOutgoingApp::CRTCOutgoingApp ( )

Definition at line 50 of file RTCOutgoing.cpp.

{
  //
  // No initialization required
  //
}

Member Function Documentation

BOOL CRTCOutgoingApp::InitInstance ( void ) [virtual]

Reimplemented from CWinApp.

Definition at line 78 of file RTCOutgoing.cpp.

{
  AfxEnableControlContainer();

#ifdef _AFXDLL
  Enable3dControls();     // Call this when using MFC in a shared DLL
#else
  Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif

  CRTCOutgoingDlg dlg;
  m_pMainWnd = &dlg;

  //
  // we do not handle the response from
  // the dialog  RTCIncomingDlg
  //

  int nResponse = dlg.DoModal();

  return FALSE;
}

The documentation for this class was generated from the following files:
  • NetDS/rtc/Client/CPP/RTCOutgoing/RTCOutgoing.h
  • NetDS/rtc/Client/CPP/RTCOutgoing/RTCOutgoing.cpp
Generated on Wed Nov 13 2024 16:57:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CRTCOutgoingDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes

CRTCOutgoingDlg Class Reference

#include "RTCOutgoingDlg.h"

List of all members.

Public Types

enum | { IDD = IDD_RTCOUTGOING_DIALOG }

Public Member Functions

CRTCOutgoingDlg (CWnd *pParent=NULL)

Public Attributes

CButton | m_btnAddParty
CButton | m_btnAppSharing
CButton | m_btnConnect
CButton | m_btnDisconnect
CButton | m_btnPcPc
CButton | m_btnPcPh
CButton | m_btnPhPh
CButton | m_btnRemoveParty
CButton | m_btnTune
CEdit | m_ctrlEditStatus
CEdit | m_editDURI
CEdit | m_editLURI
CListBox | m_lbParties

Protected Types

typedef enum
CRTCOutgoingDlg::tagSESSION_OPERATION 		SESSION_OPERATION
enum | tagSESSION_OPERATION { STO_CREATE, STO_ADDPARTY, STO_REMOVEPARTY, STO_TERMINATE }

Protected Member Functions

ULONG STDMETHODCALLTYPE | AddRef (void)
HRESULT | AddToMediaCapabilities (LONG lMedia, VARIANT_BOOL fPersist)
void | AddToParticipantList (BSTR bstrParty)
virtual void | DoDataExchange (CDataExchange *pDX)
HRESULT STDMETHODCALLTYPE | Event (RTC_EVENT RTCEvent, IDispatch *pEvent)
void | InitialControlsState ()
HRESULT | InitializeRTCApp ()
afx_msg void | OnAddparty ()
afx_msg void | OnAppsharing ()
afx_msg void | OnClose ()
afx_msg void | OnConnect ()
afx_msg void | OnDblclkPartylist ()
afx_msg void | OnDisconnect ()
virtual BOOL | OnInitDialog ()
afx_msg void | OnPaint ()
afx_msg void | OnPcpcradio ()
afx_msg void | OnPcphradio ()
afx_msg void | OnPhphradio ()
afx_msg HCURSOR | OnQueryDragIcon ()
afx_msg void | OnRemoveparty ()
afx_msg void | OnSelchangePartylist ()
afx_msg void | OnSysCommand (UINT nID, LPARAM lParam)
afx_msg void | OnTune ()
HRESULT STDMETHODCALLTYPE | QueryInterface (REFIID iid, void **ppvObject)
ULONG STDMETHODCALLTYPE | Release (void)
HRESULT | ReleaseStateMachine ()
HRESULT | RemoveFromMediaCapabilities (LONG lMedia, VARIANT_BOOL fPersist)
HRESULT | RTCClientEvent (IDispatch *pIDispatch)
HRESULT | RTCMediaEvent (IDispatch *pIDispatch)
HRESULT | RTCSessionStateEvent (IDispatch *pIDispatch)
HRESULT | ShutdownRTCApp ()
void | StateAddPartyIDC (VARIANT_BOOL fEnable)
void | StateAddPartyIDCVisible (VARIANT_BOOL fVisible)
void | StateAppSharingIDC (VARIANT_BOOL fEnable)
HRESULT | StateCoCreateClient ()
void | StateConnectIDC (VARIANT_BOOL fEnable)
void | StateConnectIDCVisible (VARIANT_BOOL fVisible)
void | StateDisconnectIDC (VARIANT_BOOL fEnable)
void | StateDUriIDC (VARIANT_BOOL fEnable)
HRESULT | StateInitClient ()
HRESULT | StateListenMode (RTC_LISTEN_MODE lMode)
void | StateLUriIDC (VARIANT_BOOL fEnable)
void | StatePartyListIDC (VARIANT_BOOL fEnable)
HRESULT | StateQueryActiveMedia (LONG *plActiveMedia)
void | StateRemovePartyIDC (VARIANT_BOOL fEnable)
HRESULT | StateSessionControl (SESSION_OPERATION soType)
HRESULT | StateSinkEvent (LONG lEventMask)
HRESULT | StateStartT120 (RTC_T120_APPLET tType)
HRESULT | StateStartTunning ()
void | StateTuneIDC (VARIANT_BOOL fEnable)
HRESULT | StateUnSinkEvent ()
virtual LRESULT | WindowProc (UINT message, WPARAM wParam, LPARAM lParam)

Protected Attributes

DWORD m_dwEventCookie
LONG | m_dwRefCount
HICON | m_hIcon
IVideoWindow * | m_pIPrevVideo
IVideoWindow * | m_pIRecvVideo
IRTCClient * | m_pIRTCClient
IRTCParticipant * | m_pIRTCParty
IRTCSession * | m_pIRTCSession
RTC_SESSION_TYPE | m_SessionType

Detailed Description

Definition at line 50 of file RTCOutgoingDlg.h.

Member Typedef Documentation

typedef enum CRTCOutgoingDlg::tagSESSION_OPERATION CRTCOutgoingDlg::SESSION_OPERATION [protected]

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 60 of file RTCOutgoingDlg.h.

{ IDD = IDD_RTCOUTGOING_DIALOG };

enum CRTCOutgoingDlg::tagSESSION_OPERATION [protected]
Enumerator:
STO_CREATE
STO_ADDPARTY
STO_REMOVEPARTY
STO_TERMINATE

Definition at line 143 of file RTCOutgoingDlg.h.

  {

    STO_CREATE,
    STO_ADDPARTY,
    STO_REMOVEPARTY,
    STO_TERMINATE

  } SESSION_OPERATION;

Constructor & Destructor Documentation

CRTCOutgoingDlg::CRTCOutgoingDlg ( CWnd * pParent = NULL )

Definition at line 133 of file RTCOutgoingDlg.cpp.

  : CDialog(CRTCOutgoingDlg::IDD, pParent)
{
  //{{AFX_DATA_INIT(CRTCOutgoingDlg)

  m_pIRTCClient    = NULL;
  m_pIRTCSession   = NULL;
  m_pIRecvVideo    = NULL;
  m_pIPrevVideo    = NULL;
  m_pIRTCParty     = NULL;
  m_SessionType    = RTCST_PC_TO_PC;

  //}}AFX_DATA_INIT
  // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
  m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

Member Function Documentation

ULONG CRTCOutgoingDlg::AddRef ( void ) [protected]

Definition at line 2282 of file RTCOutgoingDlg.cpp.

{

  ULONG ulrefCount = InterlockedIncrement(&m_dwRefCount);
  return ulrefCount;
}

HRESULT CRTCOutgoingDlg::AddToMediaCapabilities | ( | LONG | lMedia,
 |  | VARIANT_BOOL | fPersist |
 | ) |  |  | [protected]

Definition at line 2029 of file RTCOutgoingDlg.cpp.

{

  HRESULT hr = S_OK;
  LONG    lGetMedia = 0;
  LONG    lSetMedia = 0;

  _ASSERTE(NULL != m_pIRTCClient);

  hr = m_pIRTCClient->get_MediaCapabilities(&lGetMedia);

  if (FAILED(hr))
  {
    LOGMSGERROR(_T("IRTCClient::get_MediaCapabilities() Failed 0x%x"), hr);
    return hr;
  }
  else
  {

    lSetMedia = lGetMedia | lMedia;

    hr = m_pIRTCClient->SetPreferredMediaTypes(lSetMedia, fPersist);

    if (FAILED(hr))
    {
      LOGMSGERROR(_T("IRTCClient::SetPreferredMediaTypes Failed 0x%x"), hr);
      return hr;
    }

  }

  return hr;
}

void CRTCOutgoingDlg::AddToParticipantList ( BSTR bstrParty ) [protected]

Definition at line 748 of file RTCOutgoingDlg.cpp.

{
  _ASSERTE( bstrParty != NULL);

  m_lbParties.AddString(bstrParty);
  StatePartyListIDC(VARIANT_TRUE);
}

void CRTCOutgoingDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 162 of file RTCOutgoingDlg.cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CRTCOutgoingDlg)
  DDX_Control(pDX, IDC_STATUS, m_ctrlEditStatus);
  DDX_Control(pDX, IDC_LURI, m_editLURI);
  DDX_Control(pDX, IDC_DURI, m_editDURI);
  DDX_Control(pDX, IDC_PARTYLIST, m_lbParties);
  DDX_Control(pDX, IDC_PCPHRADIO, m_btnPcPh);
  DDX_Control(pDX, IDC_PHPHRADIO, m_btnPhPh);
  DDX_Control(pDX, IDC_PCPCRADIO, m_btnPcPc);
  DDX_Control(pDX, IDC_TUNE, m_btnTune);
  DDX_Control(pDX, IDC_REMOVEPARTY, m_btnRemoveParty);
  DDX_Control(pDX, IDC_APPSHARING, m_btnAppSharing);
  DDX_Control(pDX, IDC_ADDPARTY, m_btnAddParty);
  DDX_Control(pDX, IDC_DISCONNECT, m_btnDisconnect);
  DDX_Control(pDX, IDC_CONNECT, m_btnConnect);
  //}}AFX_DATA_MAP
}

HRESULT STDMETHODCALLTYPE CRTCOutgoingDlg::Event | ( | RTC_EVENT | RTCEvent,
 |  | IDispatch * | pEvent |
 | ) |  |  | [protected]

Definition at line 2335 of file RTCOutgoingDlg.cpp.

{

  HRESULT hr  = S_OK;

  if (NULL != pEvent)
  {

    switch (RTCEvent)
    {

       case RTCE_CLIENT                    :
      hr =  RTCClientEvent(pEvent);
      break;
      case RTCE_SESSION_STATE_CHANGE      :
      hr =  RTCSessionStateEvent(pEvent);
      break;
      case RTCE_MEDIA                     :
      hr =    RTCMediaEvent(pEvent);
      break;
      default:  break;
    }

  }

    return hr;
}

void CRTCOutgoingDlg::InitialControlsState ( ) [protected]

Definition at line 380 of file RTCOutgoingDlg.cpp.

{

  HRESULT   hr  = S_OK;
  //
  // Disable Buttons that should not be functional
  //

  StateDisconnectIDC(VARIANT_FALSE);
  StateAddPartyIDC(VARIANT_FALSE);
  StateRemovePartyIDC(VARIANT_FALSE);
  StateLUriIDC(VARIANT_FALSE);
  StatePartyListIDC(VARIANT_FALSE);

  StateConnectIDCVisible(VARIANT_TRUE);
  StateAddPartyIDCVisible(VARIANT_FALSE);

  m_btnPcPh.SetCheck(0);
  m_btnPhPh.SetCheck(0);

  RedrawWindow();

  m_btnPcPc.SetCheck(1);

  RedrawWindow();

}

HRESULT CRTCOutgoingDlg::InitializeRTCApp ( ) [protected]

Definition at line 1259 of file RTCOutgoingDlg.cpp.

{

  HRESULT    hr   = S_OK;

  //
  // CoCreating CLSID_RTCClient object and getting
  // the IRTCClient Interface
  //

  hr = StateCoCreateClient();

  if (FAILED(hr))
  {
    return hr;
  }

  //
  // Initializing the Client
  //

  hr = StateInitClient();

  if (FAILED(hr))
  {
    return hr;
  }

  // Setting the Event Call Back Connection Point for
  // the Source sink

  hr = StateSinkEvent(0);

  if (FAILED(hr))
  {
    return hr;
  }

  //
  // Setting the Listen mode to
  // receive incoming calls event notifications
  //

  hr = StateListenMode( RTCLM_BOTH );

  if (FAILED(hr))
  {
    return hr;
  }

  return hr;
}

void CRTCOutgoingDlg::OnAddparty ( ) [protected]

Definition at line 1019 of file RTCOutgoingDlg.cpp.

{

  StateSessionControl(STO_ADDPARTY);

}

void CRTCOutgoingDlg::OnAppsharing ( ) [protected]

Definition at line 980 of file RTCOutgoingDlg.cpp.

{
  StateStartT120(RTCTA_APPSHARING);
}

void CRTCOutgoingDlg::OnClose ( ) [protected]

Definition at line 906 of file RTCOutgoingDlg.cpp.

{
  HRESULT   hr = S_OK;

  _ASSERTE(NULL != m_pIRTCClient);

  //
  // Need to call PrepareForShutdown Before shutdown
  //

  hr = m_pIRTCClient->PrepareForShutdown();
  if (FAILED(hr))
  {
     LOGMSGERROR(_T("IRTCClient::PrepareForShutdown Failed 0x%x"), hr);
     m_pIRTCClient->Shutdown();
     return;
  }

  ShowWindow( SW_HIDE );
}

void CRTCOutgoingDlg::OnConnect ( ) [protected]

Definition at line 941 of file RTCOutgoingDlg.cpp.

{
  StateSessionControl(STO_CREATE);
}

void CRTCOutgoingDlg::OnDblclkPartylist ( ) [protected]

Definition at line 1151 of file RTCOutgoingDlg.cpp.

{
  HRESULT               hr            = S_OK;
  IRTCEnumParticipants *pIEnumParties = NULL;
  IRTCParticipant      *pIParty       = NULL;
  CString               cstrURI;
  BSTR                  bstrURI = NULL, bstrParty = NULL;

  INT lIndex = m_lbParties.GetCurSel();
  m_lbParties.GetText( lIndex, cstrURI);

  bstrURI = cstrURI.AllocSysString();

  DBLOGGER(_T("Selected  %s\n"), bstrURI);

  //
  // Enumerate the Participants and find the correct one
  //

  hr = m_pIRTCSession->EnumerateParticipants(&pIEnumParties);

  if (FAILED(hr))
  {
      LOGMSGERROR(_T("IRTCSession::EnumerateParticipants Failed 0x%x"), hr);
    FREE_BSTR_IF(bstrURI);
    return;

  }

  while (S_OK == (hr = pIEnumParties->Next(1, &pIParty, NULL)))
  {
    //
    // Note: This application doesnt process the tel: URI
    // or sip: string in the name so this would fail to find
    // the address.

    hr = pIParty->get_UserURI(&bstrParty);

    if (0 == _tcscmp(bstrParty ,  bstrURI))
    {
       break;
    }
    else
    {
      pIParty->Release();
        pIParty = NULL;

    }

  }

  FREE_BSTR_IF(bstrURI);

  //
  // Pop Up a Message Box with this Information
  //

  if (NULL != pIParty)
  {

     VARIANT_BOOL          fRemove       = VARIANT_FALSE;
     RTC_PARTICIPANT_STATE PartyState;

     pIParty->get_Removable(&fRemove);
     pIParty->get_State(&PartyState);

     LOGMSG(_T("Participant URI:%s\nParticipant State:%d\nParticipant Removable:%s"),
       bstrParty, PartyState, ( (fRemove == VARIANT_TRUE) ? _T("Yes") :_T("No") ) );

     pIParty->Release();
     pIParty = NULL;

  }
  else
  {
    LOGMSGERROR(_T("Failed to Find Selected Participant"), hr);
  }

  FREE_BSTR_IF(bstrParty);

}

void CRTCOutgoingDlg::OnDisconnect ( ) [protected]

Definition at line 960 of file RTCOutgoingDlg.cpp.

{
  StateSessionControl(STO_TERMINATE);
  StateConnectIDC(VARIANT_TRUE);
}

BOOL CRTCOutgoingDlg::OnInitDialog ( ) [protected, virtual]

Definition at line 224 of file RTCOutgoingDlg.cpp.

{
  CDialog::OnInitDialog();

  //
  //About Menu is Added to the Dialogbox
  //

  ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
  ASSERT(IDM_ABOUTBOX < 0xF000);

  CMenu* pSysMenu = GetSystemMenu(FALSE);
  if (pSysMenu != NULL)
  {
    CString strAboutMenu;
    strAboutMenu.LoadString(IDS_ABOUTBOX);
    if (!strAboutMenu.IsEmpty())
    {
      pSysMenu->AppendMenu(MF_SEPARATOR);
      pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
    }
  }

  //
  // Icon Settings
  //

  SetIcon(m_hIcon, TRUE);
  SetIcon(m_hIcon, FALSE);

  ::CoInitializeEx(NULL,COINIT_APARTMENTTHREADED);

  m_ctrlEditStatus.SetWindowText(_T("Initializing ..."));

  HRESULT hr = InitializeRTCApp();

  if (FAILED(hr))
  {

    LOGMSGERROR(_T("InitializeRTCApp() Failed: 0x%x"), hr);

    return FALSE;

  }

  //
  // Set the Initial States of the Control
  //

  InitialControlsState();

  return TRUE;
}

void CRTCOutgoingDlg::OnPaint ( void ) [protected]

Definition at line 320 of file RTCOutgoingDlg.cpp.

{
  if (IsIconic())
  {
    CPaintDC dc(this); // device context for painting

    SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

    // Center icon in client rectangle
    int cxIcon = GetSystemMetrics(SM_CXICON);
    int cyIcon = GetSystemMetrics(SM_CYICON);
    CRect rect;
    GetClientRect(&rect);
    int x = (rect.Width() - cxIcon + 1) / 2;
    int y = (rect.Height() - cyIcon + 1) / 2;

    // Draw the icon
    dc.DrawIcon(x, y, m_hIcon);
  }
  else
  {
    CDialog::OnPaint();
  }
}

void CRTCOutgoingDlg::OnPcpcradio ( ) [protected]

Definition at line 771 of file RTCOutgoingDlg.cpp.

{
  HRESULT    hr   = S_OK;

  if (1 == m_btnPcPc.GetCheck())
  {
       m_btnPcPc.SetCheck(1);
     m_btnPcPh.SetCheck(0);
     m_btnPhPh.SetCheck(0);

     StateAppSharingIDC(VARIANT_TRUE);
     StateLUriIDC(VARIANT_FALSE);

     m_SessionType =   RTCST_PC_TO_PC;

     m_editDURI.SetWindowText(_T(""));
     m_editLURI.SetWindowText(_T(""));

  }
}

void CRTCOutgoingDlg::OnPcphradio ( ) [protected]

Definition at line 807 of file RTCOutgoingDlg.cpp.

{

  HRESULT   hr = S_OK;
  if (1 == m_btnPcPh.GetCheck())
  {
       m_btnPcPc.SetCheck(0);
     m_btnPcPh.SetCheck(1);
     m_btnPhPh.SetCheck(0);

     StateAppSharingIDC(VARIANT_FALSE);
     StateLUriIDC(VARIANT_FALSE);

     m_SessionType =  RTCST_PC_TO_PHONE ;

     m_editDURI.SetWindowText(_T(""));
     m_editLURI.SetWindowText(_T(""));

    }
}

void CRTCOutgoingDlg::OnPhphradio ( ) [protected]

Definition at line 842 of file RTCOutgoingDlg.cpp.

{
  HRESULT     hr = S_OK;
  if (1 == m_btnPhPh.GetCheck())
  {
       m_btnPcPc.SetCheck(0);
     m_btnPcPh.SetCheck(0);
     m_btnPhPh.SetCheck(1);

     StateAppSharingIDC(VARIANT_FALSE);
     StateLUriIDC(VARIANT_TRUE);

     m_SessionType = RTCST_PHONE_TO_PHONE;

     m_editDURI.SetWindowText(_T(""));
     m_editLURI.SetWindowText(_T(""));

  }
}

HCURSOR CRTCOutgoingDlg::OnQueryDragIcon ( ) [protected]

Definition at line 357 of file RTCOutgoingDlg.cpp.

{
  return (HCURSOR) m_hIcon;
}

void CRTCOutgoingDlg::OnRemoveparty ( ) [protected]

Definition at line 1041 of file RTCOutgoingDlg.cpp.

{
  StateSessionControl(STO_REMOVEPARTY);
}

void CRTCOutgoingDlg::OnSelchangePartylist ( ) [protected]

Definition at line 1060 of file RTCOutgoingDlg.cpp.

{

  HRESULT               hr            = S_OK;
  IRTCEnumParticipants *pIEnumParties = NULL;
  IRTCParticipant      *pIParty       = NULL;
  CString               cstrURI;
  BSTR                  bstrURI = NULL, bstrParty = NULL;
  VARIANT_BOOL          fRemove       = VARIANT_FALSE;

  INT lIndex = m_lbParties.GetCurSel();
  m_lbParties.GetText( lIndex, cstrURI);

  bstrURI = cstrURI.AllocSysString();

  DBLOGGER(_T("Selected  %s\n"), bstrURI);

  hr = m_pIRTCSession->EnumerateParticipants(&pIEnumParties);

  if (FAILED(hr))
  {
      LOGMSGERROR(_T("IRTCSession::EnumerateParticipants Failed 0x%x"), hr);
    FREE_BSTR_IF(bstrURI);
    return;

  }

  while (S_OK == (hr = pIEnumParties->Next(1, &pIParty, NULL)))
  {

    hr = pIParty->get_UserURI(&bstrParty);

    if (0 == _tcscmp(bstrParty ,  bstrURI))
    {
       break;
    }
    else
    {
      pIParty->Release();
        pIParty = NULL;

    }

    FREE_BSTR_IF(bstrParty);
  }

  FREE_BSTR_IF(bstrURI);

  if (NULL != pIParty)
  {
     hr = pIParty->get_Removable(&fRemove);

     if (FAILED(hr))
     {
     LOGMSGERROR(_T("IRTCSession::RemoveParticipant Failed 0x%x"), hr);
     return;
     }
     else
     {
       if (VARIANT_TRUE == fRemove)
       {
         StateRemovePartyIDC(VARIANT_TRUE);
       }

     }

     pIParty->Release();
     pIParty = NULL;

  }
  else
  {
    LOGMSGERROR(_T("Failed to Find Selected Participant"), hr);
  }
}

void CRTCOutgoingDlg::OnSysCommand | ( | UINT | nID,
 |  | LPARAM | lParam |
 | ) |  |  | [protected]

Definition at line 293 of file RTCOutgoingDlg.cpp.

{
  if ((nID & 0xFFF0) == IDM_ABOUTBOX)
  {
    CAboutDlg dlgAbout;
    dlgAbout.DoModal();
  }
  else
  {
    CDialog::OnSysCommand(nID, lParam);
  }
}

void CRTCOutgoingDlg::OnTune ( ) [protected]

Definition at line 1000 of file RTCOutgoingDlg.cpp.

{
  StateStartTunning();
}

HRESULT CRTCOutgoingDlg::QueryInterface | ( | REFIID | iid,
 |  | void ** | ppvObject |
 | ) |  |  | [protected]

Definition at line 2234 of file RTCOutgoingDlg.cpp.

{
  if(iid == IID_IRTCEventNotification)
  {

    *ppvObject = static_cast<IRTCEventNotification *> (this);
    AddRef();
    return S_OK;
  }

  if(iid == IID_IUnknown)
  {

    *ppvObject = static_cast<IUnknown *> (this);
    AddRef();
    return S_OK;
  }

  else
  {
     *ppvObject = NULL;
     return E_NOINTERFACE;
  }

  return S_OK;
}

ULONG CRTCOutgoingDlg::Release ( void ) [protected]

Definition at line 2304 of file RTCOutgoingDlg.cpp.

{

  ULONG ulrefCount = InterlockedDecrement(&m_dwRefCount);

  if(0 == ulrefCount)
  {
    delete this;
  }

  return ulrefCount;
}

HRESULT CRTCOutgoingDlg::ReleaseStateMachine ( ) [protected]

Definition at line 1979 of file RTCOutgoingDlg.cpp.

{

  ULONG ulRef         = 0;
  BOOL  fRet          = FALSE;

  if ( NULL != m_pIRecvVideo )
  {

    ulRef = m_pIRecvVideo->Release();
    m_pIRecvVideo  = NULL;
  }

  if ( NULL != m_pIPrevVideo )
  {
    ulRef = m_pIPrevVideo->Release();
    m_pIRecvVideo = NULL;

  }

  if ( NULL != m_pIRTCSession )
  {
    ulRef = m_pIRTCSession->Release();
    m_pIRTCSession = NULL;
  }

  if ( NULL != m_pIRTCParty)
  {
    ulRef = m_pIRTCParty->Release();
    m_pIRTCParty = NULL;
  }

  return S_OK;

}

HRESULT CRTCOutgoingDlg::RemoveFromMediaCapabilities | ( | LONG | lMedia,
 |  | VARIANT_BOOL | fPersist |
 | ) |  |  | [protected]

Definition at line 2080 of file RTCOutgoingDlg.cpp.

{
  HRESULT hr = S_OK;
  LONG    lGetMedia = 0;
  LONG    lSetMedia = 0;

  _ASSERTE(NULL != m_pIRTCClient);

  hr = m_pIRTCClient->get_MediaCapabilities(&lGetMedia);

  if (FAILED(hr))
  {
    LOGMSGERROR(_T("IRTCClient::get_MediaCapabilities() Failed 0x%x"), hr);
    return hr;
  }
  else
  {
    //
    // are the media bits set
    //

    if ( (lGetMedia & lMedia) == lMedia )
    {

      lSetMedia = lGetMedia & (~lMedia);

      hr = m_pIRTCClient->SetPreferredMediaTypes(lSetMedia, fPersist);

      if (FAILED(hr))
      {
        LOGMSGERROR(_T("IRTCClient::SetPreferredMediaTypes(%d) Failed 0x%x"),
          lSetMedia, hr);
        return hr;
      }

    }
  }

  return hr;
}

HRESULT CRTCOutgoingDlg::RTCClientEvent ( IDispatch * pIDispatch ) [protected]

Definition at line 2387 of file RTCOutgoingDlg.cpp.

{
  HRESULT               hr            = S_OK;
  IRTCClientEvent      *pIClientEvent = NULL;
  RTC_CLIENT_EVENT_TYPE EventType;

  hr = pIDispatch->QueryInterface(IID_IRTCClientEvent,
                  reinterpret_cast<void**> (&pIClientEvent)
                  );

  if (FAILED(hr))
  {
    LOGMSGERROR(_T("IDispatch::QueryInterface(IRTCClientEvent) Failed 0x%x"),
      hr);
    return hr;
  }

  //
  // Getting the Session Interface
  //

  hr = pIClientEvent->get_EventType(&EventType);

  if (FAILED(hr))
  {
    LOGMSGERROR(_T("IRTCClientEvent::get_EventType Failed 0x%x"), hr);

    pIClientEvent->Release();
    pIClientEvent = NULL;
    return hr;
  }

  if (RTCCET_ASYNC_CLEANUP_DONE  == EventType)
  {
    //
    // When the WndProc gets this message we can
    // destroy the window
    //

    DBLOGGER(_T("Final Exit ... ASYNC_CLEANUP_DONE\n"));

    SendMessage(WM_RTCCORE_EVENT, (WPARAM) EventType, (LPARAM) NULL);
  }

  if (NULL != pIClientEvent)
  {
    pIClientEvent->Release();
    pIClientEvent = NULL;

  }
  return hr;
}

HRESULT CRTCOutgoingDlg::RTCMediaEvent ( IDispatch * pIDispatch ) [protected]

Definition at line 2615 of file RTCOutgoingDlg.cpp.

{
  HRESULT hr                          = S_OK;
  IRTCMediaEvent        *pIMediaEvent = NULL;
  LONG                   lMediaType   = 0;
  HWND                   hwdVideoRecv , hwdVideoSend;
  RTC_MEDIA_EVENT_TYPE   EventType;

  hr = pIDispatch->QueryInterface(IID_IRTCMediaEvent,
                  reinterpret_cast<void**> (&pIMediaEvent)
                  );

  if (FAILED(hr))
  {

    LOGMSGERROR(_T("IDispatch::QueryInterface(IRTCMediaEvent) Failed 0x%x"), hr);
    return hr;
  }

  pIMediaEvent->get_MediaType(&lMediaType);
  pIMediaEvent->get_EventType(&EventType);

  if ( (lMediaType == RTCMT_VIDEO_RECEIVE) && (EventType == RTCMET_STARTED) )
  {

       RECT    rectPos;

       hr = m_pIRTCClient->get_IVideoWindow(  RTCVD_RECEIVE , &m_pIRecvVideo);

      if (SUCCEEDED(hr))
      {
        CString cstrText;

        hr = m_pIRecvVideo->put_WindowStyle(WS_CHILD | WS_CLIPSIBLINGS);

        if(FAILED(hr))
        {
          LOGMSGERROR(_T("IVideoWindow::put_WindowStyle() Failed 0x%x"), hr);

          pIMediaEvent->Release();
          pIMediaEvent = NULL;

          return hr;
        }

        hr = m_pIRecvVideo->put_Owner((OAHWND) m_hWnd);

        if(FAILED(hr))
        {

          LOGMSGERROR(_T("IVideoWindow::put_Owner() Failed 0x%x"), hr);

          pIMediaEvent->Release();
          pIMediaEvent = NULL;

          return hr;
        }

        GetDlgItem( IDC_VRECVS, &hwdVideoRecv );

        ::GetClientRect(hwdVideoRecv, &rectPos);

            hr = m_pIRecvVideo->SetWindowPosition(
          rectPos.left   + RECVVID_LEFT,
        rectPos.top    + RECVVID_TOP,
        rectPos.right  - RECVVID_RIGHT,
        rectPos.bottom - RECVVID_BOTTOM
        );

        if(FAILED(hr))
        {
          LOGMSGERROR(_T("IVideoWindow::SetWindowPosition() Failed 0x%x"), hr);

          pIMediaEvent->Release();
          pIMediaEvent = NULL;

          return hr;
        }

        hr = m_pIRecvVideo->put_Visible(TRUE);

        if (FAILED(hr))
        {
          LOGMSGERROR(_T("IVideoWindow::put_Visible Failed 0x%x"), hr);

          pIMediaEvent->Release();
          pIMediaEvent = NULL;

          return hr;
        }

      }

  }

  else if ( ( lMediaType == RTCMT_VIDEO_RECEIVE) && (EventType == RTCMET_STOPPED))
  {

    //
    // we must put_Visible false and set the owner
    // as null See DShow IVideoWindow SDK
    // NOTE: should not close window without releasing video
    // or not removing handler ownership from video window.
    //

    m_pIRecvVideo->put_Visible(FALSE);
    m_pIRecvVideo->put_Owner(NULL);

    m_pIRecvVideo->Release();
    m_pIRecvVideo = NULL;

  }

  else if ( (lMediaType == RTCMT_VIDEO_SEND) &&  (EventType == RTCMET_STARTED))
  {

       RECT    rectPos;

       hr = m_pIRTCClient->get_IVideoWindow(  RTCVD_PREVIEW , &m_pIPrevVideo);

      if (SUCCEEDED(hr))
      {
        CString cstrText;

        hr = m_pIPrevVideo->put_WindowStyle(WS_CHILD | WS_CLIPSIBLINGS);

        if(FAILED(hr))
        {
          LOGMSGERROR(_T("IVideoWindow::put_WindowStyle() Failed 0x%x"), hr);

          pIMediaEvent->Release();
          pIMediaEvent = NULL;

          return hr;
        }

        hr = m_pIPrevVideo->put_Owner((OAHWND) m_hWnd);

        if(FAILED(hr))
        {

          LOGMSGERROR(_T("IVideoWindow::put_Owner() Failed 0x%x"), hr);

          pIMediaEvent->Release();
          pIMediaEvent = NULL;
          return hr;
        }

        GetDlgItem( IDC_VSENDS , &hwdVideoSend );

        ::GetClientRect(hwdVideoSend, &rectPos);

            hr = m_pIPrevVideo->SetWindowPosition(
            rectPos.left + PREVVID_LEFT,
        rectPos.top  + PREVVID_TOP,
        rectPos.right - PREVVID_RIGHT,
        rectPos.bottom - PREVVID_BOTTOM);

        if(FAILED(hr))
        {
          LOGMSGERROR(_T("IVideoWindow::SetWindowPosition() Failed 0x%x"), hr);

          pIMediaEvent->Release();
          pIMediaEvent = NULL;
          return hr;
        }

        hr = m_pIPrevVideo->put_Visible(TRUE);

        if (FAILED(hr))
        {
          LOGMSGERROR(_T("IVideoWindow::put_Visible Failed 0x%x"), hr);

          pIMediaEvent->Release();
          pIMediaEvent = NULL;
          return hr;
        }

      }

  }

  else if ( ( lMediaType == RTCMT_VIDEO_SEND) &&
     (EventType == RTCMET_STOPPED))
  {

    //
    // we must put_Visible false and set the owner
    // as null See DShow IVideoWindow SDK
    // NOTE: should not close window without releasing video
    // or not removing handler ownership from video window.
    //

    m_pIPrevVideo->put_Visible(FALSE);
    m_pIPrevVideo->put_Owner(NULL);

    m_pIPrevVideo->Release();
    m_pIPrevVideo = NULL;

  }

  if (NULL != pIMediaEvent)
  {

    pIMediaEvent->Release();
    pIMediaEvent = NULL;

  }

  return hr;
}

HRESULT CRTCOutgoingDlg::RTCSessionStateEvent ( IDispatch * pIDispatch ) [protected]

Definition at line 2455 of file RTCOutgoingDlg.cpp.

{
  HRESULT hr                                  = S_OK;
  IRTCSessionStateChangeEvent *pISessionState = NULL;
  RTC_SESSION_STATE SessionState;

  hr = pIDispatch->QueryInterface(IID_IRTCSessionStateChangeEvent,
                  reinterpret_cast<void**> (&pISessionState)
                  );

  if (FAILED(hr))
  {

    LOGMSGERROR(_T("IDispatch::QueryInterface(IRTCSessionStateChangeEvent) Failed 0x%x"),
      hr);
    return hr;
  }

  hr = pISessionState->get_State(&SessionState);

  if (FAILED(hr))
  {
    LOGMSGERROR(_T("IRTCSessionStateChangeEvent::get_State Failed 0x%x"), hr);

    pISessionState->Release();
    pISessionState = NULL;
    return hr;
  }

  switch(SessionState)
  {
  case RTCSS_IDLE: break;
  case RTCSS_INCOMING:
  {
    m_ctrlEditStatus.SetWindowText(_T("Incoming Call..."));
    break;
  }
  case RTCSS_ANSWERING:
    m_ctrlEditStatus.SetWindowText(_T("Answering ..."));
    break;
  case RTCSS_INPROGRESS:
    m_ctrlEditStatus.SetWindowText(_T("In Progress ..."));
    break;
  case RTCSS_CONNECTED :
    {
      VARIANT_BOOL  fCanAdd  = VARIANT_FALSE;

      StateConnectIDC(VARIANT_FALSE);
      StateDisconnectIDC(VARIANT_TRUE);
      m_ctrlEditStatus.SetWindowText(_T("Connected ..."));

      //
      // Check if you can add participants to the session
      // enable the add participant button
      //
      hr = m_pIRTCSession->get_CanAddParticipants(&fCanAdd);

      if (FAILED(hr))
      {
        LOGMSGERROR(_T("IRTCSessionStateChangeEvent::get_State Failed 0x%x"), hr);
        return hr;
      }
      else if (VARIANT_TRUE == fCanAdd)
      {
        StateAddPartyIDC(VARIANT_TRUE);

        StateConnectIDCVisible(VARIANT_FALSE);
        StateAddPartyIDCVisible(VARIANT_TRUE);

        m_editDURI.SetWindowText(_T(""));
      }
      break;
    }
  case RTCSS_DISCONNECTED:
    {

      //
      // Disabling call-control related UI
      //

      StateDisconnectIDC(VARIANT_FALSE);
      StateConnectIDC(VARIANT_TRUE);
      StateConnectIDCVisible(VARIANT_TRUE);
      StatePartyListIDC(VARIANT_FALSE);
      StateTuneIDC(VARIANT_TRUE);

      StateAddPartyIDC(VARIANT_FALSE);
      StateRemovePartyIDC(VARIANT_FALSE);

      StateAddPartyIDCVisible(VARIANT_FALSE);

      //
      // Removing All Participants from the listbox
      //

      for (INT lIndex = 0; lIndex < m_lbParties.GetCount(); lIndex++)
      {
        m_lbParties.DeleteString(lIndex);
      }

      m_ctrlEditStatus.SetWindowText(_T("Disconnected ..."));
      m_ctrlEditStatus.SetWindowText(_T("Ready ..."));

      //
      // Releasing the Session Interface
      //

      m_pIRTCSession->Release();
      m_pIRTCSession = NULL;

      break;
    }
  default :
    {
      pISessionState->Release();
      pISessionState = NULL;
      return E_UNEXPECTED;
    }

  }

  if (NULL != pISessionState)
  {

    pISessionState->Release();
    pISessionState = NULL;

  }

  return hr;
}

HRESULT CRTCOutgoingDlg::ShutdownRTCApp ( ) [protected]

Definition at line 1327 of file RTCOutgoingDlg.cpp.

{

  HRESULT hr  = S_OK;

    _ASSERTE(NULL != m_pIRTCClient);

    StateUnSinkEvent();

    hr = m_pIRTCClient->Shutdown();

   if (FAILED(hr))
   {
      LOGMSGERROR(_T("IRTCClient::Shutdown() Failed 0x%x"), hr);
   }

   ReleaseStateMachine();

   CoUninitialize();
   DestroyWindow();

   return S_OK;

}

void CRTCOutgoingDlg::StateAddPartyIDC ( VARIANT_BOOL fEnable ) [protected]

Definition at line 510 of file RTCOutgoingDlg.cpp.

{

  if (VARIANT_TRUE == fEnable)
  {
    m_btnAddParty.ModifyStyle( WS_DISABLED , 0 , 0);
    RedrawWindow();
  }
  else
  {
    m_btnAddParty.ModifyStyle( 0 , WS_DISABLED , 0);
    RedrawWindow();
  }

}

void CRTCOutgoingDlg::StateAddPartyIDCVisible ( VARIANT_BOOL fVisible ) [protected]

Definition at line 541 of file RTCOutgoingDlg.cpp.

{
  if (VARIANT_TRUE == fVisible)
  {
    m_btnAddParty.ModifyStyle( 0 , WS_VISIBLE  , 0);
    RedrawWindow();

  }
  else
  {
    m_btnAddParty.ModifyStyle( WS_VISIBLE , 0 , 0);
    RedrawWindow();
  }
}

void CRTCOutgoingDlg::StateAppSharingIDC ( VARIANT_BOOL fEnable ) [protected]

Definition at line 629 of file RTCOutgoingDlg.cpp.

{

  if (VARIANT_TRUE == fEnable)
  {
    m_btnAppSharing.ModifyStyle( WS_DISABLED , 0 , 0);
    RedrawWindow();

  }
  else
  {
    m_btnAppSharing.ModifyStyle( 0 , WS_DISABLED , 0);
    RedrawWindow();
  }

}

HRESULT CRTCOutgoingDlg::StateCoCreateClient ( ) [protected]

Definition at line 1370 of file RTCOutgoingDlg.cpp.

{

  HRESULT hr = S_OK;

  _ASSERTE(NULL != this);

  hr = CoCreateInstance(CLSID_RTCClient,
              NULL,
              CLSCTX_INPROC_SERVER,
              IID_IRTCClient,
              reinterpret_cast<void **> (&m_pIRTCClient)
              );

  if (FAILED(hr))
  {
    LOGMSGERROR(_T("CoCreateInstance(CLSID_RTCClient) : Failed 0x%x"), hr);
    return hr;
  }

  return hr;

}

void CRTCOutgoingDlg::StateConnectIDC ( VARIANT_BOOL fEnable ) [protected]

Definition at line 421 of file RTCOutgoingDlg.cpp.

{
  if (VARIANT_TRUE == fEnable)
  {
    m_btnConnect.ModifyStyle( WS_DISABLED , 0 , 0);
    RedrawWindow();

  }
  else
  {
    m_btnConnect.ModifyStyle( 0 , WS_DISABLED , 0);
    RedrawWindow();
  }
}

void CRTCOutgoingDlg::StateConnectIDCVisible ( VARIANT_BOOL fVisible ) [protected]

Definition at line 450 of file RTCOutgoingDlg.cpp.

{
  if (VARIANT_TRUE == fVisible)
  {
    m_btnConnect.ModifyStyle(  0 , WS_VISIBLE , 0);
    RedrawWindow();

  }
  else
  {
    m_btnConnect.ModifyStyle( WS_VISIBLE , 0 , 0);
    RedrawWindow();
  }
}

void CRTCOutgoingDlg::StateDisconnectIDC ( VARIANT_BOOL fEnable ) [protected]

Definition at line 478 of file RTCOutgoingDlg.cpp.

{

  if (VARIANT_TRUE == fEnable)
  {
    m_btnDisconnect.ModifyStyle( WS_DISABLED , 0 , 0);
    RedrawWindow();

  }
  else
  {
    m_btnDisconnect.ModifyStyle(0,  WS_DISABLED  , 0);
    RedrawWindow();
  }

}

void CRTCOutgoingDlg::StateDUriIDC ( VARIANT_BOOL fEnable ) [protected]

Definition at line 660 of file RTCOutgoingDlg.cpp.

{
  if (VARIANT_TRUE == fEnable)
  {
    m_editDURI.ModifyStyle( WS_DISABLED , 0 , 0);
    RedrawWindow();

  }
  else
  {
    m_editDURI.ModifyStyle( 0 , WS_DISABLED , 0);
    RedrawWindow();
  }
}

HRESULT CRTCOutgoingDlg::StateInitClient ( ) [protected]

Definition at line 1409 of file RTCOutgoingDlg.cpp.

{

  HRESULT hr = S_OK;

  _ASSERTE(NULL != this);

  hr = m_pIRTCClient->Initialize();

  if (FAILED(hr))
  {

    LOGMSGERROR(_T("IRTCClient::Initialize : Failed 0x%x"),
      hr);
    return hr;
  }

  return hr;
}

HRESULT CRTCOutgoingDlg::StateListenMode ( RTC_LISTEN_MODE lMode ) [protected]

Definition at line 1699 of file RTCOutgoingDlg.cpp.

{

  HRESULT hr = S_OK;

  _ASSERTE(NULL != this);
  _ASSERTE(NULL != m_pIRTCClient);

  hr = m_pIRTCClient->put_ListenForIncomingSessions(lMode);

  if (FAILED(hr))
  {

    LOGMSGERROR(_T("IRTCClient::put_ListenForIncomingSessions Failed 0x%x"),
      hr);
    return hr;
  }
  else
  {
    m_ctrlEditStatus.SetWindowText(_T("Ready ..."));
  }

  return hr;
}

void CRTCOutgoingDlg::StateLUriIDC ( VARIANT_BOOL fEnable ) [protected]

Definition at line 689 of file RTCOutgoingDlg.cpp.

{

  if (VARIANT_TRUE == fEnable)
  {
    m_editLURI.ModifyStyle( WS_DISABLED , 0 , 0);
    RedrawWindow();

  }
  else
  {
    m_editLURI.ModifyStyle( 0 , WS_DISABLED , 0);
    RedrawWindow();
  }

}

void CRTCOutgoingDlg::StatePartyListIDC ( VARIANT_BOOL fEnable ) [protected]

Definition at line 720 of file RTCOutgoingDlg.cpp.

{
  if (VARIANT_TRUE == fEnable)
  {
    m_lbParties.ModifyStyle( WS_DISABLED , 0 , 0);
    RedrawWindow();
  }
  else
  {
    m_lbParties.ModifyStyle( 0 , WS_DISABLED , 0);
    RedrawWindow();
  }

}

HRESULT CRTCOutgoingDlg::StateQueryActiveMedia ( LONG * plActiveMedia ) [protected]

Definition at line 1740 of file RTCOutgoingDlg.cpp.

{
  HRESULT hr = S_OK;

  _ASSERTE(NULL != this);
  _ASSERTE(NULL != m_pIRTCClient);

  LONG   lActive   = 0;
  BSTR   bstrMedia = NULL;

  hr = m_pIRTCClient->get_ActiveMedia(&lActive);

  if (FAILED(hr))
  {
    LOGMSGERROR(_T("IRTCClient::get_ActiveMedia() Failed 0x%x"), hr);
    return hr;
  }

  *plActiveMedia = lActive;

  FREE_BSTR_IF(bstrMedia);

  return hr;
}

void CRTCOutgoingDlg::StateRemovePartyIDC ( VARIANT_BOOL fEnable ) [protected]

Definition at line 569 of file RTCOutgoingDlg.cpp.

{

  if (VARIANT_TRUE == fEnable)
  {
    m_btnRemoveParty.ModifyStyle( WS_DISABLED , 0 , 0);
    RedrawWindow();
  }
  else
  {
    m_btnRemoveParty.ModifyStyle( 0 , WS_DISABLED , 0);
    RedrawWindow();
  }
}

HRESULT CRTCOutgoingDlg::StateSessionControl ( SESSION_OPERATION soType ) [protected]

Definition at line 1448 of file RTCOutgoingDlg.cpp.

{

  HRESULT hr = S_OK;
  BSTR    bstrLocalURI  = NULL;
  BSTR    bstrURI       = NULL;

  _ASSERTE(NULL != this);

  switch(soType)
  {

  case STO_CREATE:
    {

      //
      // Disable the Tunning Wizard upon session creation
      //

      StateTuneIDC(VARIANT_FALSE);

      if (m_SessionType == RTCST_PHONE_TO_PHONE)
      {

        //
        // A valid profile object is required to make Phone to Phone call,
        // It is upto the reader to setup the infrastructure and create a
        // proper profile based on their local settings. This code has been
        // provided as an example. It will fail with proper error code.
        //

        //
        // Phone URI must be a Tel URI in
        // canonical format eg: +12223334444
        //

        CString cstrLocalURI;
        m_editLURI.GetWindowText(cstrLocalURI);

        if (TRUE  == cstrLocalURI.IsEmpty())
        {
          LOGMSGERROR(_T("Set the Local URI for Phone to Phone Sessions"));
          return E_INVALIDARG;
        }
        else
        {
          bstrLocalURI = cstrLocalURI.AllocSysString();
          _ASSERTE(NULL != bstrLocalURI);
        }
      }

      hr = m_pIRTCClient->CreateSession( m_SessionType,
                         bstrLocalURI,
                         NULL,
                         0,
                         &m_pIRTCSession);

      FREE_BSTR_IF(bstrLocalURI);

      if ( FAILED(hr) )
      {

        LOGMSGERROR(_T("IRTCSession::CreateSession() Failed 0x%x"), hr);
        return hr;
      }

      CString cstrURI;

      m_editDURI.GetWindowText(cstrURI);

      if (TRUE == cstrURI.IsEmpty())
      {
        LOGMSGERROR(_T("Set the Destination URI"), hr);
        return hr;
      }
      else
      {

        bstrURI   = cstrURI.AllocSysString();

        _ASSERTE(NULL != bstrURI);

        hr = m_pIRTCSession->AddParticipant(bstrURI,
                          bstrURI,
                          &m_pIRTCParty);

        if ( FAILED(hr) )
        {

          LOGMSGERROR(_T("IRTCSession::AddParticipant() Failed 0x%x"), hr);
          return hr;
        }
        else
        {
          AddToParticipantList(bstrURI);
        }

        FREE_BSTR_IF(bstrURI);
      }

      break;
    }
  case STO_ADDPARTY:
    {

      CString cstrURI;

      m_editDURI.GetWindowText(cstrURI);

      if (TRUE == cstrURI.IsEmpty())
      {
        LOGMSGERROR(_T("Set the Party URI"), hr);
        return hr;
      }
      else
      {
        bstrURI   = cstrURI.AllocSysString();

        _ASSERTE(NULL != bstrURI);

        if (NULL != m_pIRTCParty)
        {
          m_pIRTCParty->Release();
          m_pIRTCParty = NULL;
        }

        hr = m_pIRTCSession->AddParticipant(bstrURI,
                          bstrURI,
                          &m_pIRTCParty);

        if ( FAILED(hr) )
        {

          LOGMSGERROR(_T("IRTCSession::AddParticipant() Failed 0x%x"), hr);
          return hr;
        }
        else
        {
          AddToParticipantList(bstrURI);
        }

        m_editDURI.SetWindowText(_T(""));
        FREE_BSTR_IF(bstrURI);
      }
      break;
    }
  case STO_REMOVEPARTY:
    {
      IRTCEnumParticipants *pIEnumParties = NULL;
      IRTCParticipant      *pIParty       = NULL;
      CString               cstrURI;
      BSTR                  bstrURI = NULL, bstrParty = NULL;

      INT lIndex = m_lbParties.GetCurSel();
      m_lbParties.GetText( lIndex, cstrURI);

      bstrURI = cstrURI.AllocSysString();

      DBLOGGER(_T("Removing %s\n"), bstrURI);

      hr = m_pIRTCSession->EnumerateParticipants(&pIEnumParties);

      if (FAILED(hr))
      {
          LOGMSGERROR(_T("IRTCSession::EnumerateParticipants Failed 0x%x"), hr);
        FREE_BSTR_IF(bstrURI);
        return hr;
      }

      while (S_OK == (hr = pIEnumParties->Next(1, &pIParty, NULL)))
      {

        hr = pIParty->get_UserURI(&bstrParty);

        if (0 == _tcscmp(bstrParty ,  bstrURI))
        {
          break;
        }
        else
        {
          pIParty->Release();
          pIParty = NULL;

        }

        FREE_BSTR_IF(bstrParty);
      }

      FREE_BSTR_IF(bstrURI);

      if (NULL != pIParty)
      {
        hr = m_pIRTCSession->RemoveParticipant(pIParty);

        if (FAILED(hr))
        {
           LOGMSGERROR(_T("IRTCSession::RemoveParticipant Failed 0x%x"), hr);
           return hr;
        }
        else
        {
          m_lbParties.DeleteString(lIndex);
        }

        pIParty->Release();
        pIParty = NULL;
      }
      else
      {
        LOGMSGERROR(_T("Failed to Find Selected Participant"), hr);

      }

      break;
    }
  case STO_TERMINATE:
    {

      hr = m_pIRTCSession->Terminate( RTCTR_NORMAL );

      if ( FAILED(hr) )
      {
        LOGMSGERROR(_T("IRTCSession:::Terminate() Failed 0x%x"), hr);
      }

      break;
    }
  default:
    return E_NOTIMPL;

  }

  return hr;
}

HRESULT CRTCOutgoingDlg::StateSinkEvent ( LONG lEventMask ) [protected]

Definition at line 1781 of file RTCOutgoingDlg.cpp.

{

  HRESULT                   hr          = S_OK;
  IUnknown                  *pUnknown   = NULL;
  IConnectionPointContainer *pCPC       = NULL;
  IConnectionPoint          *pCP        = NULL;

  _ASSERTE(NULL != this);

  //
  // Right now I will actually override this.
  //

  lEventMask = RTCEF_CLIENT                     |
         RTCEF_SESSION_STATE_CHANGE       |
         RTCEF_MEDIA;

  hr = m_pIRTCClient->put_EventFilter(lEventMask);

  if (FAILED(hr))
  {

    LOGMSGERROR(_T("IRTCClient::put_EventFilter Failed 0x%x"),
      hr);

    return hr;
  }

  if (FAILED(hr))
  {

    LOGMSGERROR(_T("InitializeSink() Failed 0x%x"), hr);
    return hr;
  }

  hr = QueryInterface(IID_IUnknown,
                reinterpret_cast<void**> (&pUnknown)
             );

  if (FAILED(hr))
  {
    LOGMSGERROR(_T("QueryInterface(IUnknown) Failed 0x%x"), hr);
    return hr;
  }

  hr = m_pIRTCClient->QueryInterface(IID_IConnectionPointContainer,
                   reinterpret_cast<void**> (&pCPC)
                   );

  if (FAILED(hr))
  {

    LOGMSGERROR(_T("IRTCClient::QueryInterface(IConnectionPointContainer) Failed 0x%x"),
      hr);

    return hr;
  }

  hr = pCPC->FindConnectionPoint( IID_IRTCEventNotification,
                  &pCP );

  if (FAILED(hr))
  {
    LOGMSGERROR(_T("IConnectionPointContainer::FindConnectionPoint() Failed 0x%x"),
      hr);

    pCPC->Release();
    return hr;
  }

  hr = pCP->Advise( pUnknown, &m_dwEventCookie );

  if (FAILED(hr))
  {

    LOGMSGERROR(_T("IConnectionPoint::Advise() Failed 0x%x"), hr);

    pCPC->Release();
    pCP->Release();
    return hr;
  }

  pCP->Release();
  pCPC->Release();
  pUnknown->Release();

  return hr;
}

HRESULT CRTCOutgoingDlg::StateStartT120 ( RTC_T120_APPLET tType ) [protected]

Definition at line 2137 of file RTCOutgoingDlg.cpp.

{
  HRESULT hr = S_OK;

  _ASSERTE(NULL != m_pIRTCClient);

  hr = m_pIRTCClient->StartT120Applet(tType);

  if (FAILED(hr))
  {
    LOGMSGERROR(_T("IRTCClient::StartT120Applet Failed 0x%x"), hr);
    return hr;
  }

  //
  // We dont have the Media Capability by Default
  // so if we are in connected state we add the stream
  //

  if (m_pIRTCSession != NULL)
  {
    RTC_SESSION_STATE SessionState;

    hr = m_pIRTCSession->get_State(&SessionState);

    if (FAILED(hr))
    {
      LOGMSGERROR(_T("IRTCSession::get_State Failed 0x%x"), hr);
      return hr;
    }

    if (RTCSS_CONNECTED  == SessionState)
    {

      hr = m_pIRTCSession->AddStream(RTCMT_T120_SENDRECV, 200);

      if (FAILED(hr))
      {

        LOGMSGERROR(_T("IRTCSession::AddStream(T120) Failed 0x%x"), hr);
        return hr;
      }
    }

  }

  return hr;
}

HRESULT CRTCOutgoingDlg::StateStartTunning ( ) [protected]

Definition at line 2199 of file RTCOutgoingDlg.cpp.

{
  HRESULT hr = S_OK;

  _ASSERTE(NULL != m_pIRTCClient);

  //
  // Send Parent Window
  //

  hr = m_pIRTCClient->InvokeTuningWizard( (OAHWND) m_hWnd);

  if (FAILED(hr))
  {
    LOGMSGERROR(_T("IRTCClient::InvokeTuningWizard Failed 0x%x"), hr);
    return hr;
  }

  return hr;

}

void CRTCOutgoingDlg::StateTuneIDC ( VARIANT_BOOL fEnable ) [protected]

Definition at line 599 of file RTCOutgoingDlg.cpp.

{

  if (VARIANT_TRUE == fEnable)
  {
    m_btnTune.ModifyStyle( WS_DISABLED , 0 , 0);
    RedrawWindow();

  }
  else
  {
    m_btnTune.ModifyStyle( 0 , WS_DISABLED , 0);
    RedrawWindow();
  }
}

HRESULT CRTCOutgoingDlg::StateUnSinkEvent ( ) [protected]

Definition at line 1895 of file RTCOutgoingDlg.cpp.

{

  HRESULT            hr       = S_OK;
  IUnknown                  *pUnknown   = NULL;
  IConnectionPointContainer *pCPC       = NULL;
  IConnectionPoint          *pCP        = NULL;

  hr = QueryInterface(IID_IUnknown,
              reinterpret_cast<void**> (&pUnknown)
             );

  if (FAILED(hr))
  {
    LOGMSGERROR(_T("QueryInterface(IUnknown) Failed 0x%x"), hr);
    return hr;
  }

  hr = m_pIRTCClient->QueryInterface(IID_IConnectionPointContainer,
                   reinterpret_cast<void**> (&pCPC)
                   );

  if (FAILED(hr))
  {
    LOGMSGERROR(_T("IRTCClient::QueryInterface(IConnectionPointContainer) Failed 0x%x"), hr);

    return hr;
  }

  hr = pCPC->FindConnectionPoint( IID_IRTCEventNotification,
                  &pCP );

  if (FAILED(hr))
  {

    LOGMSGERROR(_T("IConnectionPointContainer::FindConnectionPoint Failed 0x%x"),
      hr);

    pCPC->Release();
    return hr;
  }

  hr = pCP->Unadvise( m_dwEventCookie );

  if (FAILED(hr))
  {

    LOGMSGERROR(_T("IConnectionPoint::Unadvise() Failed 0x%x"),
      hr);

    pCPC->Release();
    pCP->Release();
    return hr;
  }

  pCP->Release();
  pCPC->Release();
  pUnknown->Release();

  return hr;
}

LRESULT CRTCOutgoingDlg::WindowProc | ( | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]

Definition at line 878 of file RTCOutgoingDlg.cpp.

{
  HRESULT    hr   = S_OK;

  switch(message)
  {
    case WM_RTCCORE_EVENT:
    {
      ShutdownRTCApp();
      break;
    }
  default : return CDialog::WindowProc(message, wParam, lParam);

  }

  return CDialog::WindowProc(message, wParam, lParam);
}

Member Data Documentation

CButton CRTCOutgoingDlg::m_btnAddParty

Definition at line 71 of file RTCOutgoingDlg.h.

CButton CRTCOutgoingDlg::m_btnAppSharing

Definition at line 70 of file RTCOutgoingDlg.h.

CButton CRTCOutgoingDlg::m_btnConnect

Definition at line 73 of file RTCOutgoingDlg.h.

CButton CRTCOutgoingDlg::m_btnDisconnect

Definition at line 72 of file RTCOutgoingDlg.h.

CButton CRTCOutgoingDlg::m_btnPcPc

Definition at line 67 of file RTCOutgoingDlg.h.

CButton CRTCOutgoingDlg::m_btnPcPh

Definition at line 65 of file RTCOutgoingDlg.h.

CButton CRTCOutgoingDlg::m_btnPhPh

Definition at line 66 of file RTCOutgoingDlg.h.

CButton CRTCOutgoingDlg::m_btnRemoveParty

Definition at line 69 of file RTCOutgoingDlg.h.

CButton CRTCOutgoingDlg::m_btnTune

Definition at line 68 of file RTCOutgoingDlg.h.

CEdit CRTCOutgoingDlg::m_ctrlEditStatus

Definition at line 61 of file RTCOutgoingDlg.h.

DWORD CRTCOutgoingDlg::m_dwEventCookie [protected]

Definition at line 201 of file RTCOutgoingDlg.h.

LONG CRTCOutgoingDlg::m_dwRefCount [protected]

Definition at line 215 of file RTCOutgoingDlg.h.

CEdit CRTCOutgoingDlg::m_editDURI

Definition at line 63 of file RTCOutgoingDlg.h.

CEdit CRTCOutgoingDlg::m_editLURI

Definition at line 62 of file RTCOutgoingDlg.h.

HICON CRTCOutgoingDlg::m_hIcon [protected]

Definition at line 183 of file RTCOutgoingDlg.h.

CListBox CRTCOutgoingDlg::m_lbParties

Definition at line 64 of file RTCOutgoingDlg.h.

IVideoWindow* CRTCOutgoingDlg::m_pIPrevVideo [protected]

Definition at line 208 of file RTCOutgoingDlg.h.

IVideoWindow* CRTCOutgoingDlg::m_pIRecvVideo [protected]

Definition at line 207 of file RTCOutgoingDlg.h.

IRTCClient* CRTCOutgoingDlg::m_pIRTCClient [protected]

Definition at line 189 of file RTCOutgoingDlg.h.

IRTCParticipant* CRTCOutgoingDlg::m_pIRTCParty [protected]

Definition at line 214 of file RTCOutgoingDlg.h.

IRTCSession* CRTCOutgoingDlg::m_pIRTCSession [protected]

Definition at line 195 of file RTCOutgoingDlg.h.

RTC_SESSION_TYPE CRTCOutgoingDlg::m_SessionType [protected]

Definition at line 221 of file RTCOutgoingDlg.h.

The documentation for this class was generated from the following files:
  • NetDS/rtc/Client/CPP/RTCOutgoing/RTCOutgoingDlg.h
  • NetDS/rtc/Client/CPP/RTCOutgoing/RTCOutgoingDlg.cpp
Generated on Wed Nov 13 2024 16:57:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CRTCSession Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Protected Attributes | Friends

CRTCSession Class Reference

#include "rtcsession.h"

Inherited by CRTCAVSession, and CRTCIMSession.

List of all members.

Public Member Functions

CRTCSession ()
~CRTCSession ()

Protected Member Functions

virtual HRESULT | DeliverClient (RTC_CLIENT_EVENT_TYPE enEventType)
virtual HRESULT | DeliverIntensity (RTC_AUDIO_DEVICE enDevice, long lLevel)
virtual HRESULT | DeliverMedia (long lMediaType, RTC_MEDIA_EVENT_TYPE enType, RTC_MEDIA_EVENT_REASON enReason)
virtual HRESULT | DeliverMessage (IRTCParticipant *pParticipant, BSTR bstrContentType, BSTR bstrMessage)
virtual HRESULT | DeliverParticipantState (IRTCParticipant *pParticipant, RTC_PARTICIPANT_STATE enState)
virtual HRESULT | DeliverSessionState (RTC_SESSION_STATE enState)
virtual HRESULT | DeliverUserStatus (IRTCParticipant *pParticipant, RTC_MESSAGING_USER_STATUS enStatus)
virtual LRESULT | OnClose (UINT uMsg, WPARAM wParam, LPARAM lParam)
virtual LRESULT | OnCreate (UINT uMsg, WPARAM wParam, LPARAM lParam)
virtual LRESULT | OnDestroy (UINT uMsg, WPARAM wParam, LPARAM lParam)
virtual LRESULT | OnSize (UINT uMsg, WPARAM wParam, LPARAM lParam)
void | SetStatusText (PWSTR szText)
void | ShowMessageBox (PWSTR szText)

Protected Attributes

RTC_SESSION_STATE | m_enState
HWND | m_hStatusBar
HWND | m_hWnd
IRTCSession * | m_pSession
CRTCWin * m_pWin

Friends

class | CRTCWin

Detailed Description

Definition at line 8 of file rtcsession.h.

Constructor & Destructor Documentation

CRTCSession::CRTCSession ( )

Definition at line 11 of file rtcsession.cpp.

{
    m_hWnd = NULL;
    m_pSession = NULL;
    m_pWin = NULL;
    m_enState = RTCSS_IDLE;
}

CRTCSession::~CRTCSession ( )

Definition at line 24 of file rtcsession.cpp.

{
}

Member Function Documentation

HRESULT CRTCSession::DeliverClient ( RTC_CLIENT_EVENT_TYPE enEventType ) [protected, virtual]

Reimplemented in CRTCAVSession.

Definition at line 217 of file rtcsession.cpp.

{
    return S_OK;
}

HRESULT CRTCSession::DeliverIntensity | ( | RTC_AUDIO_DEVICE | enDevice,
 |  | long | lLevel |
 | ) |  |  | [protected, virtual]

Reimplemented in CRTCAVSession.

Definition at line 207 of file rtcsession.cpp.

{
    return S_OK;
}

HRESULT CRTCSession::DeliverMedia | ( | long | lMediaType,
 |  | RTC_MEDIA_EVENT_TYPE | enType,
 |  | RTC_MEDIA_EVENT_REASON | enReason |
 | ) |  |  | [protected, virtual]

Reimplemented in CRTCAVSession.

Definition at line 197 of file rtcsession.cpp.

{
    return S_OK;
}

HRESULT CRTCSession::DeliverMessage | ( | IRTCParticipant * | pParticipant,
 |  | BSTR | bstrContentType,
 |  | BSTR | bstrMessage |
 | ) |  |  | [protected, virtual]

Reimplemented in CRTCIMSession.

Definition at line 177 of file rtcsession.cpp.

{
    return S_OK;
}

HRESULT CRTCSession::DeliverParticipantState | ( | IRTCParticipant * | pParticipant,
 |  | RTC_PARTICIPANT_STATE | enState |
 | ) |  |  | [protected, virtual]

Definition at line 167 of file rtcsession.cpp.

{
    return S_OK;
}

HRESULT CRTCSession::DeliverSessionState ( RTC_SESSION_STATE enState ) [protected, virtual]

Definition at line 127 of file rtcsession.cpp.

{
    m_enState = enState;

    // Display the session state in the status bar
    switch(m_enState)
    {
    case RTCSS_IDLE:
        SetStatusText(L"Idle");
        break;

    case RTCSS_INCOMING:
        SetStatusText(L"Incoming");
        break;

    case RTCSS_ANSWERING:
        SetStatusText(L"Answering");
        break;

    case RTCSS_INPROGRESS:
        SetStatusText(L"Inprogress");
        break;

    case RTCSS_CONNECTED:
        SetStatusText(L"Connected");
        break;

    case RTCSS_DISCONNECTED:
        SetStatusText(L"Disconnected");
        break;
    }

    return S_OK;
}

HRESULT CRTCSession::DeliverUserStatus | ( | IRTCParticipant * | pParticipant,
 |  | RTC_MESSAGING_USER_STATUS | enStatus |
 | ) |  |  | [protected, virtual]

Reimplemented in CRTCIMSession.

Definition at line 187 of file rtcsession.cpp.

{
    return S_OK;
}

LRESULT CRTCSession::OnClose | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]

Definition at line 102 of file rtcsession.cpp.

{
    DestroyWindow(m_hWnd);

    return 0;
}

LRESULT CRTCSession::OnCreate | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]

Reimplemented in CRTCAVSession, and CRTCIMSession.

Definition at line 54 of file rtcsession.cpp.

{
    // Create the status bar
    m_hStatusBar = CreateStatusWindow(
        WS_CHILD | WS_VISIBLE,
        NULL,
        m_hWnd,
        IDC_STATUSBAR
        );

    if ( !m_hStatusBar )
    {
        // CreateStatusWindow failed
        return -1;
    }

    return 0;
}

LRESULT CRTCSession::OnDestroy | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]

Reimplemented in CRTCAVSession, and CRTCIMSession.

Definition at line 78 of file rtcsession.cpp.

{
    if (m_pSession)
    {
        // Terminate and release the session
        m_pSession->Terminate(RTCTR_NORMAL);

        SAFE_RELEASE(m_pSession);
    }

    if (m_pWin)
    {
        // Remove the session from the session list
        m_pWin->RemoveSession(this);
    }

    return 0;
}

LRESULT CRTCSession::OnSize | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [protected, virtual]

Reimplemented in CRTCAVSession, and CRTCIMSession.

Definition at line 114 of file rtcsession.cpp.

{
    // Resize the status bar
    SendMessage(m_hStatusBar, uMsg, wParam, lParam);

    return 0;
}

void CRTCSession::SetStatusText ( PWSTR szText ) [protected]

Definition at line 43 of file rtcsession.cpp.

{
    SetWindowTextW(m_hStatusBar, szText);
    InvalidateRect(m_hStatusBar, NULL, FALSE);
}

void CRTCSession::ShowMessageBox ( PWSTR szText ) [protected]

Definition at line 33 of file rtcsession.cpp.

{
    MessageBoxW(m_hWnd, szText, APP_TITLE, MB_OK);
}

Friends And Related Function Documentation

friend class CRTCWin [friend]

Reimplemented in CRTCAVSession.

Definition at line 16 of file rtcsession.h.

Member Data Documentation

RTC_SESSION_STATE CRTCSession::m_enState [protected]

Definition at line 23 of file rtcsession.h.

HWND CRTCSession::m_hStatusBar [protected]

Definition at line 19 of file rtcsession.h.

HWND CRTCSession::m_hWnd [protected]

Definition at line 18 of file rtcsession.h.

IRTCSession* CRTCSession::m_pSession [protected]

Definition at line 21 of file rtcsession.h.

CRTCWin* CRTCSession::m_pWin [protected]

Definition at line 22 of file rtcsession.h.

The documentation for this class was generated from the following files:
  • NetDS/rtc/Client/CPP/rtcsample/rtcsession.h
  • NetDS/rtc/Client/CPP/rtcsample/rtcsession.cpp
Generated on Wed Nov 13 2024 16:57:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CRTCWin Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes

CRTCWin Class Reference

#include "rtcwin.h"

List of all members.

Public Member Functions

CRTCWin ()
~CRTCWin ()
HRESULT | GetUserURI (BSTR *pbstrURI)
HRESULT | RemoveSession (CRTCSession *pSessWindow)

Static Public Member Functions

static HRESULT | RegisterClass ()
static LRESULT CALLBACK | WindowProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)

Private Member Functions

HRESULT | AddSession (IRTCSession *pSession, RTC_SESSION_TYPE enType)
HRESULT | CleanupSessions ()
HRESULT | ClearBuddyList ()
HRESULT | DoAddBuddy (BSTR bstrURI, BSTR bstrName)
HRESULT | DoAuth (BSTR bstrURI, BSTR bstrAccount, BSTR bstrPassword)
HRESULT | DoCall (RTC_SESSION_TYPE enType, BSTR bstrURI)
HRESULT | DoEnablePresence (BOOL fEnable)
HRESULT | DoGenerateProvisioning (BSTR bstrURI, BSTR bstrServer, BSTR bstrTransport, BSTR *pbstrXML)
HRESULT | DoLogOff ()
HRESULT | DoLogOn (BSTR bstrURI, BSTR bstrServer, BSTR bstrTransport)
HRESULT | DoRemoveBuddy (IRTCBuddy *pBuddy)
HRESULT | DoSetPresence (RTC_PRESENCE_STATUS enStatus)
HRESULT | DoTuningWizard ()
HRESULT | FindSession (IRTCSession *pSession, CRTCSession **ppSessWindow)
LRESULT | OnClose (UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT | OnCommand (UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT | OnCreate (UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT | OnDestroy (UINT uMsg, WPARAM wParam, LPARAM lParam)
HRESULT | OnLoggedOff ()
HRESULT | OnLoggedOn ()
HRESULT | OnLoggingOff ()
HRESULT | OnLoggingOn ()
LRESULT | OnNotify (UINT uMsg, WPARAM wParam, LPARAM lParam)
void | OnRTCBuddyEvent (IRTCBuddyEvent *pEvent)
void | OnRTCClientEvent (IRTCClientEvent *pEvent)
LRESULT | OnRTCEvent (UINT uMsg, WPARAM wParam, LPARAM lParam)
void | OnRTCIntensityEvent (IRTCIntensityEvent *pEvent)
void | OnRTCMediaEvent (IRTCMediaEvent *pEvent)
void | OnRTCMessagingEvent (IRTCMessagingEvent *pEvent)
void | OnRTCParticipantStateChangeEvent (IRTCParticipantStateChangeEvent *pEvent)
void | OnRTCRegistrationStateChangeEvent (IRTCRegistrationStateChangeEvent *pEvent)
void | OnRTCSessionStateChangeEvent (IRTCSessionStateChangeEvent *pEvent)
void | OnRTCWatcherEvent (IRTCWatcherEvent *pEvent)
LRESULT | OnSize (UINT uMsg, WPARAM wParam, LPARAM lParam)
void | SetStatusText (PWSTR szText)
void | ShowMessageBox (PWSTR szText)
HRESULT | UpdateBuddyList (IRTCBuddy *pBuddy)

Private Attributes

RTC_REGISTRATION_STATE | m_enState
BOOL m_fPresenceEnabled
HWND | m_hBuddyList
HWND | m_hStatusBar
HWND | m_hWnd
IRTCClient * | m_pClient
CRTCEvents * m_pEvents
IRTCProfile * | m_pProfile
std::vector< CRTCSession * > | m_SessionList

Detailed Description

Definition at line 15 of file rtcwin.h.

Constructor & Destructor Documentation

CRTCWin::CRTCWin ( )

Definition at line 11 of file rtcwin.cpp.

{
    m_hWnd = NULL;
    m_hStatusBar = NULL;
    m_hBuddyList = NULL;
    m_pClient = NULL;
    m_pProfile = NULL;
    m_pEvents = NULL;
    m_enState = RTCRS_NOT_REGISTERED;
    m_fPresenceEnabled = FALSE;
}

CRTCWin::~CRTCWin ( )

Definition at line 28 of file rtcwin.cpp.

{
}

Member Function Documentation

HRESULT CRTCWin::AddSession | ( | IRTCSession * | pSession,
 |  | RTC_SESSION_TYPE | enType |
 | ) |  |  | [private]

Definition at line 72 of file rtcwin.cpp.

{
    // Is this an audio/video session?
    BOOL fAVSession = (enType != RTCST_IM);

    // Create the session window
    HWND hWnd;

    hWnd = CreateWindowExW(
                0,
                (fAVSession) ? AV_CLASS : IM_CLASS,
                (fAVSession) ? AV_TITLE : IM_TITLE,
                WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
                CW_USEDEFAULT, CW_USEDEFAULT,
                (fAVSession) ? AV_WIDTH : IM_WIDTH,
                (fAVSession) ? AV_HEIGHT : IM_HEIGHT,
                NULL,
                NULL,
                GetModuleHandle(NULL),
                NULL);

    if ( !hWnd )
    {
        // CreateWindowExW failed
        return E_FAIL;
    }

    // Initialize the window
    CRTCSession * pSessWindow =
        (CRTCSession *)GetWindowLong(hWnd, GWL_USERDATA);

    pSessWindow->m_pSession = pSession;
    pSessWindow->m_pSession->AddRef();
    pSessWindow->m_pWin = this;

    // Make the main window visible
    ShowWindow( hWnd, SW_SHOW );
    UpdateWindow( hWnd );

    // Add window to the list
    m_SessionList.push_back(pSessWindow);

    return S_OK;
}

HRESULT CRTCWin::CleanupSessions ( ) [private]

Definition at line 178 of file rtcwin.cpp.

{
    std::vector<CRTCSession *>::iterator it;

    if (!m_SessionList.empty())
    {
        for(it=m_SessionList.begin();
            it < m_SessionList.end();
            it++)
        {
            PostMessage((*it)->m_hWnd, WM_CLOSE, 0, 0);
        }
    }

    return S_OK;
}

HRESULT CRTCWin::ClearBuddyList ( ) [private]

Definition at line 400 of file rtcwin.cpp.

{
    LVITEM lvi;
    ZeroMemory(&lvi, sizeof(LVITEM));

    lvi.mask = LVIF_PARAM;

    // Iterate through the list and remove each item
    while (ListView_GetItem(m_hBuddyList, &lvi))
    {
        IRTCBuddy * pBuddy = (IRTCBuddy *)(lvi.lParam);

        // Release the buddy reference
        SAFE_RELEASE(pBuddy);

        ListView_DeleteItem(m_hBuddyList, 0);
    }

    return S_OK;
}

HRESULT CRTCWin::DoAddBuddy | ( | BSTR | bstrURI,
 |  | BSTR | bstrName |
 | ) |  |  | [private]

Definition at line 895 of file rtcwin.cpp.

{
    HRESULT hr;

    // Get the RTC client presence interface
    IRTCClientPresence * pPresence = NULL;

    hr = m_pClient->QueryInterface(
            IID_IRTCClientPresence,
            (void **)&pPresence);

    if (FAILED(hr))
    {
        // QueryInterface failed
        return hr;
    }

    // Add the buddy
    IRTCBuddy * pBuddy = NULL;

    hr = pPresence->AddBuddy(
            bstrURI,
            bstrName,
            NULL,
            VARIANT_TRUE,
            NULL,
            0,
            &pBuddy);

    SAFE_RELEASE(pPresence);

    if (FAILED(hr))
    {
        // Addbuddy failed
        SAFE_RELEASE(pBuddy);
        return hr;
    }

    // Update the buddy list entry
    UpdateBuddyList(pBuddy);
    SAFE_RELEASE(pBuddy);

    return S_OK;
}

HRESULT CRTCWin::DoAuth | ( | BSTR | bstrURI,
 |  | BSTR | bstrAccount,
 |  | BSTR | bstrPassword |
 | ) |  |  | [private]

Definition at line 726 of file rtcwin.cpp.

{
    HRESULT hr;

    // Update the credentials in the profile
    hr = m_pProfile->SetCredentials(bstrURI, bstrAccount, bstrPassword);

    if (FAILED(hr))
    {
        // SetCredentials failed
        return hr;
    }

    // Get the RTC client provisioning interface
    IRTCClientProvisioning * pProv = NULL;

    hr = m_pClient->QueryInterface(
            IID_IRTCClientProvisioning,
            (void **)&pProv);

    if (FAILED(hr))
    {
        // QueryInterface failed
        return hr;
    }

    // Re-enable the RTC profile object
    hr = pProv->EnableProfile(m_pProfile, RTCRF_REGISTER_ALL);

    SAFE_RELEASE(pProv);

    if (FAILED(hr))
    {
        // EnableProfile failed
        return hr;
    }

    // Re-enable presence
    hr = DoEnablePresence(TRUE);

    if (FAILED(hr))
    {
        // DoEnablePresence failed
        return hr;
    }

    return S_OK;
}

HRESULT CRTCWin::DoCall | ( | RTC_SESSION_TYPE | enType,
 |  | BSTR | bstrURI |
 | ) |  |  | [private]

Definition at line 981 of file rtcwin.cpp.

{
    HRESULT hr;

    if (enType != RTCST_IM)
    {
        // Is there already an AV session? We can only
        // allow one at a time
        if (CRTCAVSession::m_Singleton != NULL)
        {
            ShowMessageBox(L"An audio/video call is in progress!");

            return S_FALSE;
        }
    }

    // Create the session
    IRTCSession * pSession = NULL;

    hr = m_pClient->CreateSession(
        enType,
        NULL,
        NULL,
        0,
        &pSession
        );

    if (FAILED(hr))
    {
        // CreateSession failed
        return hr;
    }

    // Add the participant to the session
    hr = pSession->AddParticipant(
        bstrURI,
        NULL,
        NULL
        );

    if (FAILED(hr))
    {
        // AddParticipant failed
        SAFE_RELEASE(pSession);
        return hr;
    }

    // Add the session to the session list
    // This will create the session window
    hr = AddSession(pSession, enType);

    SAFE_RELEASE(pSession);

    if (FAILED(hr))
    {
        // AddSession failed
        return hr;
    }

    return S_OK;
}

HRESULT CRTCWin::DoEnablePresence ( BOOL fEnable ) [private]

Definition at line 780 of file rtcwin.cpp.

{
    IRTCClientPresence * pPresence = NULL;
    HRESULT hr;

    // Cleanup the buddy list
    ClearBuddyList();

    // Get the RTC client presence interface
    hr = m_pClient->QueryInterface(
            IID_IRTCClientPresence,
            (void **)&pPresence);

    if (FAILED(hr))
    {
        // QueryInterface failed
        return hr;
    }

    // Get the location of the presence storage
    VARIANT varStorage;
    VariantInit(&varStorage);
    varStorage.vt = VT_BSTR;
    varStorage.bstrVal = SysAllocString(L"presence.xml");

    // If we are disabling presence, save the latest
    // copy of the presence data
    if (!fEnable && m_fPresenceEnabled)
    {
        hr = pPresence->Export(varStorage);

        if (FAILED(hr))
        {
            // Export failed
            SAFE_RELEASE(pPresence);
            VariantClear(&varStorage);
            return hr;
        }
    }

    // Enable presence
    hr = pPresence->EnablePresence(
        fEnable ? VARIANT_TRUE : VARIANT_FALSE, varStorage);

    VariantClear(&varStorage);

    if (FAILED(hr))
    {
        // EnablePresence failed
        SAFE_RELEASE(pPresence);
        return hr;
    }

    // Set the enabled flag
    m_fPresenceEnabled = fEnable;

    // If we are disabling presence, cleanup the
    // presence data
    if (!fEnable)
    {
        // Cleanup buddies
        IRTCEnumBuddies * pEnumBuddy = NULL;
        IRTCBuddy * pBuddy = NULL;

        hr = pPresence->EnumerateBuddies(&pEnumBuddy);

        if (FAILED(hr))
        {
            // Enumerate buddies failed
            SAFE_RELEASE(pPresence);
            return hr;
        }

        while (pEnumBuddy->Next(1, &pBuddy, NULL) == S_OK)
        {
            pPresence->RemoveBuddy(pBuddy);

            SAFE_RELEASE(pBuddy);
        }

        SAFE_RELEASE(pEnumBuddy);

        // Cleanup watchers
        IRTCEnumWatchers * pEnumWatcher = NULL;
        IRTCWatcher * pWatcher = NULL;

        hr = pPresence->EnumerateWatchers(&pEnumWatcher);

        if (FAILED(hr))
        {
            // Enumerate watchers failed
            SAFE_RELEASE(pPresence);
            return hr;
        }

        while (pEnumWatcher->Next(1, &pWatcher, NULL) == S_OK)
        {
            pPresence->RemoveWatcher(pWatcher);

            SAFE_RELEASE(pWatcher);
        }

        SAFE_RELEASE(pEnumWatcher);
    }

    SAFE_RELEASE(pPresence);

    return S_OK;
}

HRESULT CRTCWin::DoGenerateProvisioning | ( | BSTR | bstrURI,
 |  | BSTR | bstrServer,
 |  | BSTR | bstrTransport,
 |  | BSTR * | pbstrXML |
 | ) |  |  | [private]

Definition at line 664 of file rtcwin.cpp.

{
    WCHAR szXML[MAX_XML_STRING];
    WCHAR szRealm[MAX_STRING];

    // Allow basic authentication if the protocol is TLS
    BOOL fBasicAuth = !_wcsicmp(bstrTransport, L"TLS");

    // Use the domain of the user uri as the realm
    WCHAR *ch = wcschr(bstrURI, L'@');

    if (ch == NULL)
    {
        // User URI has no domain, use empty string
        wcsncpy(szRealm, L"", MAX_STRING);
        szRealm[MAX_STRING-1] = L'\0';
    }
    else
    {
        // Found the domain, copy the string
        ch++;
        wcsncpy(szRealm, ch, MAX_STRING);
        szRealm[MAX_STRING-1] = L'\0';
    }

    // Generate the XML provisioning document
    _snwprintf(
        szXML,
        MAX_XML_STRING,
        L"<provision key=\"RTC Sample\" name=\"RTC Sample\">"
        L"<user uri=\"%s\" account=\"\" password=\"\" realm=\"%s\" />"
        L"<sipsrv addr=\"%s\" protocol=\"%s\" %s role=\"proxy\">"
        L"<session party=\"first\" type=\"pc2pc\" />"
        L"<session party=\"first\" type=\"pc2ph\" />"
        L"<session party=\"first\" type=\"im\" />"
        L"</sipsrv>"
        L"<sipsrv addr=\"%s\" protocol=\"%s\" %s role=\"registrar\" />"
        L"</provision>",
        bstrURI, szRealm,
        bstrServer, bstrTransport, fBasicAuth ? L"auth=\"basic\"" : L"",
        bstrServer, bstrTransport, fBasicAuth ? L"auth=\"basic\"" : L""
        );

    szXML[MAX_XML_STRING-1] = L'\0';

    *pbstrXML = SysAllocString(szXML);

    if (!(*pbstrXML))
    {
        // Out of memory
        return E_OUTOFMEMORY;
    }

    return S_OK;
}

HRESULT CRTCWin::DoLogOff ( ) [private]

Definition at line 590 of file rtcwin.cpp.

{
    HRESULT hr;

    if (!m_pProfile)
    {
        // Already logged off
        return S_OK;
    }

    // Get the RTC client provisioning interface
    IRTCClientProvisioning * pProv = NULL;

    hr = m_pClient->QueryInterface(
            IID_IRTCClientProvisioning,
            (void **)&pProv);

    if (FAILED(hr))
    {
        // QueryInterface failed
        return hr;
    }

    // Disable the profile
    pProv->DisableProfile(m_pProfile);

    SAFE_RELEASE(m_pProfile);
    SAFE_RELEASE(pProv);

    return S_OK;
}

HRESULT CRTCWin::DoLogOn | ( | BSTR | bstrURI,
 |  | BSTR | bstrServer,
 |  | BSTR | bstrTransport |
 | ) |  |  | [private]

Definition at line 426 of file rtcwin.cpp.

{
    HRESULT hr;

    if (m_pProfile)
    {
        // Already logged on
        ShowMessageBox(L"Already logged on!");

        return S_FALSE;
    }

    // Build an XML provisioning document
    BSTR bstrXML = NULL;

    hr = DoGenerateProvisioning(
        bstrURI, bstrServer, bstrTransport, &bstrXML);

    if (FAILED(hr))
    {
        // DoGenerateProvisioning failed
        ShowMessageBox(L"Logon failed!");

        return hr;
    }

    // Get the RTC client provisioning interface
    IRTCClientProvisioning * pProv = NULL;

    hr = m_pClient->QueryInterface(
            IID_IRTCClientProvisioning,
            (void **)&pProv);

    if (FAILED(hr))
    {
        // QueryInterface failed
        ShowMessageBox(L"Logon failed!");

        return hr;
    }

    // Create a RTC profile object from the XML
    // provisioning document
    hr = pProv->CreateProfile(bstrXML, &m_pProfile);

    SAFE_FREE_STRING(bstrXML);

    if (FAILED(hr))
    {
        // CreateProfile failed
        ShowMessageBox(L"Logon failed!");

        SAFE_RELEASE(pProv);
        return hr;
    }

    // Enable the RTC profile object
    hr = pProv->EnableProfile(m_pProfile, RTCRF_REGISTER_ALL);

    SAFE_RELEASE(pProv);

    if (FAILED(hr))
    {
        // EnableProfile failed
        SAFE_RELEASE(m_pProfile);

        ShowMessageBox(L"Logon failed!");
        return hr;
    }

    // Enable presence
    // It is best to enable presence immediately after enabling the
    // profile so that incoming watchers will not be lost.
    hr = DoEnablePresence(TRUE);

    if (FAILED(hr))
    {
        // DoEnablePresence failed
        DoLogOff();

        ShowMessageBox(L"Logon failed!");
        return hr;
    }

    return S_OK;
}

HRESULT CRTCWin::DoRemoveBuddy ( IRTCBuddy * pBuddy ) [private]

Definition at line 945 of file rtcwin.cpp.

{
    HRESULT hr;

    // Get the RTC client presence interface
    IRTCClientPresence * pPresence = NULL;

    hr = m_pClient->QueryInterface(
            IID_IRTCClientPresence,
            (void **)&pPresence);

    if (FAILED(hr))
    {
        // QueryInterface failed
        return hr;
    }

    // Remove the buddy
    hr = pPresence->RemoveBuddy(pBuddy);

    SAFE_RELEASE(pPresence);

    if (FAILED(hr))
    {
        // RemoveBuddy failed
        return hr;
    }

    return S_OK;
}

HRESULT CRTCWin::DoSetPresence ( RTC_PRESENCE_STATUS enStatus ) [private]

Definition at line 1078 of file rtcwin.cpp.

{
    HRESULT hr;
    UINT id = 0;

    // Check the appropriate menu item
    switch(enStatus)
    {
    case RTCXS_PRESENCE_OFFLINE:
        id = ID_FILE_PRESENCESTATUS_OFFLINE;
        break;

    case RTCXS_PRESENCE_ONLINE:
        id = ID_FILE_PRESENCESTATUS_ONLINE;
        break;

    case RTCXS_PRESENCE_AWAY:
        id = ID_FILE_PRESENCESTATUS_AWAY;
        break;

    case RTCXS_PRESENCE_IDLE:
        id = ID_FILE_PRESENCESTATUS_IDLE;
        break;

    case RTCXS_PRESENCE_BUSY:
        id = ID_FILE_PRESENCESTATUS_BUSY;
        break;

    case RTCXS_PRESENCE_BE_RIGHT_BACK:
        id = ID_FILE_PRESENCESTATUS_BERIGHTBACK;
        break;

    case RTCXS_PRESENCE_ON_THE_PHONE:
        id = ID_FILE_PRESENCESTATUS_ONTHEPHONE;
        break;

    case RTCXS_PRESENCE_OUT_TO_LUNCH:
        id = ID_FILE_PRESENCESTATUS_OUTTOLUNCH;
        break;
    }

    CheckMenuRadioItem(
        GetMenu(m_hWnd),   // handle to menu
        ID_FILE_PRESENCESTATUS_OFFLINE,  // identifier or position of first item
        ID_FILE_PRESENCESTATUS_OUTTOLUNCH,   // identifier or position of last item
        id,  // identifier or position of menu item
        MF_BYCOMMAND    // function options
        );

    // Get the RTC client presence interface
    IRTCClientPresence * pPresence = NULL;

    hr = m_pClient->QueryInterface(
            IID_IRTCClientPresence,
            (void **)&pPresence);

    if (FAILED(hr))
    {
        // QueryInterface failed
        return hr;
    }

    // Set the local presence status
    hr = pPresence->SetLocalPresenceInfo(enStatus, NULL);

    SAFE_RELEASE(pPresence);

    if (FAILED(hr))
    {
        // SetLocalPresenceInfo failed
        return hr;
    }

    return S_OK;
}

HRESULT CRTCWin::DoTuningWizard ( ) [private]

Definition at line 1048 of file rtcwin.cpp.

{
    HRESULT hr;

    // Is there already an AV session? We can only
    // allow one at a time
    if (CRTCAVSession::m_Singleton != NULL)
    {
        ShowMessageBox(L"An audio/video call is in progress!");

        return S_FALSE;
    }

    // Show the tuning wizard
    hr = m_pClient->InvokeTuningWizard((OAHWND)m_hWnd);

    if (FAILED(hr))
    {
        // InvokeTuningWizard failed
        return hr;
    }

    return S_OK;
}

HRESULT CRTCWin::FindSession | ( | IRTCSession * | pSession,
 |  | CRTCSession ** | ppSessWindow |
 | ) |  |  | [private]

Definition at line 150 of file rtcwin.cpp.

{
    std::vector<CRTCSession *>::iterator it;

    if (!m_SessionList.empty())
    {
        for(it=m_SessionList.begin();
            it < m_SessionList.end();
            it++)
        {
            if ((*it)->m_pSession == pSession)
            {
                *ppSessWindow = (*it);
                return S_OK;
            }
        }
    }

    *ppSessWindow = NULL;
    return E_FAIL;
}

HRESULT CRTCWin::GetUserURI ( BSTR * pbstrURI )

Definition at line 221 of file rtcwin.cpp.

{
    HRESULT hr;

    if (m_pProfile != NULL)
    {
        // Get the user URI from the profile
        hr = m_pProfile->get_UserURI(pbstrURI);

        if (FAILED(hr))
        {
            // get_UserURI failed
            return hr;
        }
    }
    else
    {
        // Get the user URI from the client
        hr = m_pClient->get_LocalUserURI(pbstrURI);

        if (FAILED(hr))
        {
            // get_LocalUserURI failed
            return hr;
        }
    }

    return S_OK;
}

LRESULT CRTCWin::OnClose | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private]

Definition at line 1391 of file rtcwin.cpp.

{
    HRESULT hr = S_OK;

    // Cleanup the existing session windows
    CleanupSessions();

    if (m_pClient)
    {
        // Prepare the RTC client object for shutdown
        hr = m_pClient->PrepareForShutdown();
    }

    if (!m_pClient || FAILED(hr))
    {
        // The RTC client object either doesn't exist, or
        // failed to prepare for shutdown. Destroy the
        // window now
        DestroyWindow(m_hWnd);
    }
    else
    {
        // The RTC client object is preparing to shutdown.
        // We should wait for the RTCCET_ASYNC_CLEANUP_DONE
        // event before we shutdown the RTC client. For now
        // just hide the window
        ShowWindow(m_hWnd, SW_HIDE);
    }

    return 0;
}

LRESULT CRTCWin::OnCommand | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private]

Definition at line 1468 of file rtcwin.cpp.

{
    HRESULT hr;

    switch(LOWORD(wParam))
    {
    case ID_FILE_LOGON:
        {
            BSTR bstrURI = NULL;
            BSTR bstrServer = NULL;
            BSTR bstrTransport = NULL;

            hr = ShowLogonDialog(
                m_hWnd, &bstrURI, &bstrServer, &bstrTransport);

            if (FAILED(hr))
            {
                // ShowLogonDialog failed
                break;
            }

            DoLogOn(bstrURI, bstrServer, bstrTransport);

            SAFE_FREE_STRING(bstrURI);
            SAFE_FREE_STRING(bstrServer);
            SAFE_FREE_STRING(bstrTransport);
        }
        break;

    case ID_FILE_LOGOFF:
        DoLogOff();
        break;

    case ID_FILE_EXIT:
        PostMessage(m_hWnd, WM_CLOSE, 0, 0);
        break;

    case ID_ACTION_ADDBUDDY:
        {
            BSTR bstrURI = NULL;
            BSTR bstrName = NULL;

            // Show the add buddy dialog
            hr = ShowAddressDialog(m_hWnd, L"Add Buddy", TRUE, &bstrURI, &bstrName);

            if (FAILED(hr))
            {
                // ShowAddressDialog failed
                break;
            }

            // Add the buddy
            DoAddBuddy(bstrURI, bstrName);

            SAFE_FREE_STRING(bstrURI);
            SAFE_FREE_STRING(bstrName);
        }
        break;

    case ID_ACTION_CALL:
        {
            BSTR bstrURI = NULL;

            // Show the call dialog
            hr = ShowAddressDialog(m_hWnd, L"Call To", FALSE, &bstrURI, NULL);

            if (FAILED(hr))
            {
                // ShowAddressDialog failed
                break;
            }

            // Call the user
            DoCall(RTCST_PC_TO_PC, bstrURI);

            SAFE_FREE_STRING(bstrURI);
        }
        break;

    case ID_ACTION_MESSAGE:
        {
            BSTR bstrURI = NULL;

            // Show the call dialog
            hr = ShowAddressDialog(m_hWnd, L"Message To", FALSE, &bstrURI, NULL);

            if (FAILED(hr))
            {
                // ShowAddressDialog failed
                break;
            }

            // Send a message to the user
            DoCall(RTCST_IM, bstrURI);

            SAFE_FREE_STRING(bstrURI);
        }
        break;

    case ID_TOOLS_TUNINGWIZARD:
        DoTuningWizard();
        break;

    case ID_FILE_PRESENCESTATUS_OFFLINE:
        DoSetPresence(RTCXS_PRESENCE_OFFLINE);
        break;

    case ID_FILE_PRESENCESTATUS_ONLINE:
        DoSetPresence(RTCXS_PRESENCE_ONLINE);
        break;

    case ID_FILE_PRESENCESTATUS_AWAY:
        DoSetPresence(RTCXS_PRESENCE_AWAY);
        break;

    case ID_FILE_PRESENCESTATUS_IDLE:
        DoSetPresence(RTCXS_PRESENCE_IDLE);
        break;

    case ID_FILE_PRESENCESTATUS_BUSY:
        DoSetPresence(RTCXS_PRESENCE_BUSY);
        break;

    case ID_FILE_PRESENCESTATUS_BERIGHTBACK:
        DoSetPresence(RTCXS_PRESENCE_BE_RIGHT_BACK);
        break;

    case ID_FILE_PRESENCESTATUS_ONTHEPHONE:
        DoSetPresence(RTCXS_PRESENCE_ON_THE_PHONE);
        break;

    case ID_FILE_PRESENCESTATUS_OUTTOLUNCH:
        DoSetPresence(RTCXS_PRESENCE_OUT_TO_LUNCH);
        break;
    }

    return 0;
}

LRESULT CRTCWin::OnCreate | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private]

Definition at line 1232 of file rtcwin.cpp.

{
    // Create the status bar
    m_hStatusBar = CreateStatusWindow(
        WS_CHILD | WS_VISIBLE,
        NULL,
        m_hWnd,
        IDC_STATUSBAR
        );

    if ( !m_hStatusBar )
    {
        // CreateStatusWindow failed
        return -1;
    }

    // Create the buddy list
    m_hBuddyList = CreateWindowExW(
        WS_EX_CLIENTEDGE,
        L"SysListView32",
        NULL,
        WS_CHILD | WS_VISIBLE |
        LVS_SINGLESEL | LVS_SORTASCENDING |
        LVS_AUTOARRANGE | LVS_SMALLICON,
        0, 0,
        0, 0,
        m_hWnd,
        (HMENU)IDC_BUDDYLIST,
        GetModuleHandle(NULL),
        NULL);

    if ( !m_hBuddyList )
    {
        // CreateWindowExW failed
        return -1;
    }

    // Create the RTC client
    HRESULT hr;

    hr = CoCreateInstance(
        CLSID_RTCClient,
        NULL,
        CLSCTX_INPROC_SERVER,
        IID_IRTCClient,
        (LPVOID *)&m_pClient
        );

    if (FAILED(hr))
    {
        // CoCreateInstance failed
        return -1;
    }

    // Initialize the RTC client
    hr = m_pClient->Initialize();

    if (FAILED(hr))
    {
        // Initialize failed
        SAFE_RELEASE(m_pClient);
        return -1;
    }

    // Set the event filter for the RTC client
    hr = m_pClient->put_EventFilter(
                 RTCEF_REGISTRATION_STATE_CHANGE |
                 RTCEF_SESSION_STATE_CHANGE |
                 RTCEF_PARTICIPANT_STATE_CHANGE |
                 RTCEF_MESSAGING |
                 RTCEF_MEDIA |
                 RTCEF_INTENSITY |
                 RTCEF_CLIENT |
                 RTCEF_BUDDY |
                 RTCEF_WATCHER
                 );

    if ( FAILED(hr) )
    {
        // put_EventFilter failed
        SAFE_RELEASE(m_pClient);
        return -1;
    }

    // Set the listen mode for RTC client
    // RTCLM_BOTH opens the standard SIP port 5060, as well as
    // a dynamic port.
    hr = m_pClient->put_ListenForIncomingSessions(RTCLM_BOTH);

    if ( FAILED(hr) )
    {
        // put_ListenMode failed
        SAFE_RELEASE(m_pClient);
        return -1;
    }

    // Create the event sink object
    m_pEvents = new CRTCEvents;

    if (!m_pEvents)
    {
        // Out of memory
        SAFE_RELEASE(m_pClient);
        return -1;
    }

    // Advise for events from the RTC client
    hr = m_pEvents->Advise( m_pClient, m_hWnd );

    if ( FAILED(hr) )
    {
        // Advise failed
        SAFE_RELEASE(m_pClient);
        return -1;
    }

    // Initialize presence status
    DoSetPresence(RTCXS_PRESENCE_ONLINE);

    // Show the logon dialog
    PostMessage(m_hWnd, WM_COMMAND, MAKEWPARAM(ID_FILE_LOGON, 0), 0);

    return 0;
}

LRESULT CRTCWin::OnDestroy | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private]

Definition at line 1362 of file rtcwin.cpp.

{
    // Release the RTC profile
    SAFE_RELEASE(m_pProfile);

    if (m_pClient)
    {
        if (m_pEvents)
        {
            // Unadvise for events from the RTC client
            m_pEvents->Unadvise(m_pClient);
            m_pEvents = NULL;
        }

        // Shutdown the RTC client
        m_pClient->Shutdown();

        // Release the RTC client
        SAFE_RELEASE(m_pClient);
    }

    return 0;
}

HRESULT CRTCWin::OnLoggedOff ( ) [private]

Definition at line 644 of file rtcwin.cpp.

{
    // Disable presence
    DoEnablePresence(FALSE);

    // Enable/disable menu items
    HMENU hMenu = GetMenu(m_hWnd);

    EnableMenuItem(hMenu, ID_FILE_LOGON, MF_ENABLED);
    EnableMenuItem(hMenu, ID_FILE_LOGOFF, MF_GRAYED);
    EnableMenuItem(hMenu, ID_ACTION_ADDBUDDY, MF_GRAYED);

    return S_OK;
}

HRESULT CRTCWin::OnLoggedOn ( ) [private]

Definition at line 534 of file rtcwin.cpp.

{
    HRESULT hr;

    // Get the RTC client presence interface
    IRTCClientPresence * pPresence = NULL;

    hr = m_pClient->QueryInterface(
            IID_IRTCClientPresence,
            (void **)&pPresence);

    if (FAILED(hr))
    {
        // QueryInterface failed
        return hr;
    }

    // Enumerate buddies and populate list
    IRTCEnumBuddies * pEnum = NULL;
    IRTCBuddy * pBuddy = NULL;

    hr = pPresence->EnumerateBuddies(&pEnum);

    SAFE_RELEASE(pPresence);

    if (FAILED(hr))
    {
        // Enumerate buddies failed
        return hr;
    }

    while (pEnum->Next(1, &pBuddy, NULL) == S_OK)
    {
        // Update the buddy list entry
        UpdateBuddyList(pBuddy);

        SAFE_RELEASE(pBuddy);
    }

    SAFE_RELEASE(pEnum);

    // Enable/disable menu items
    HMENU hMenu = GetMenu(m_hWnd);

    EnableMenuItem(hMenu, ID_FILE_LOGON, MF_GRAYED);
    EnableMenuItem(hMenu, ID_FILE_LOGOFF, MF_ENABLED);
    EnableMenuItem(hMenu, ID_ACTION_ADDBUDDY, MF_ENABLED);

    return S_OK;
}

HRESULT CRTCWin::OnLoggingOff ( ) [private]

Definition at line 627 of file rtcwin.cpp.

{
    // Enable/disable menu items
    HMENU hMenu = GetMenu(m_hWnd);

    EnableMenuItem(hMenu, ID_FILE_LOGON, MF_GRAYED);
    EnableMenuItem(hMenu, ID_FILE_LOGOFF, MF_GRAYED);
    EnableMenuItem(hMenu, ID_ACTION_ADDBUDDY, MF_GRAYED);

    return S_OK;
}

HRESULT CRTCWin::OnLoggingOn ( ) [private]

Definition at line 518 of file rtcwin.cpp.

{
    // Enable/disable menu items
    HMENU hMenu = GetMenu(m_hWnd);

    EnableMenuItem(hMenu, ID_FILE_LOGON, MF_GRAYED);
    EnableMenuItem(hMenu, ID_FILE_LOGOFF, MF_ENABLED);

    return S_OK;
}

LRESULT CRTCWin::OnNotify | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private]

Definition at line 1612 of file rtcwin.cpp.

{
    int idCtrl = (int)wParam;
    LPNMHDR pnmh = (LPNMHDR)lParam;
    HRESULT hr;

    if ( (pnmh->code == NM_CLICK) ||
         (pnmh->code == NM_RCLICK) )
    {
        if ( idCtrl == IDC_BUDDYLIST )
        {
            // The user clicked on the buddy list
            LVHITTESTINFO lvht;
            ZeroMemory(&lvht, sizeof(LVHITTESTINFO));

            POINT pt;
            GetCursorPos(&pt);

            lvht.pt = pt;
            MapWindowPoints(NULL, pnmh->hwndFrom, &lvht.pt, 1 );

            int iRes = ListView_HitTest(pnmh->hwndFrom, &lvht);

            if (iRes == -1)
            {
                // ListView_HitTest failed
                return 0;
            }

            if (lvht.flags & LVHT_ONITEM)
            {
                // The user clicked on a buddy
                LVITEM lvi;
                ZeroMemory(&lvi, sizeof(LVITEM));

                lvi.mask = LVIF_PARAM;
                lvi.iItem = iRes;

                // Get the buddy item
                if (!ListView_GetItem(m_hBuddyList, &lvi))
                {
                    // ListView_GetItem failed;
                    return 0;
                }

                IRTCBuddy * pBuddy = (IRTCBuddy *)(lvi.lParam);
                BSTR bstrURI = NULL;

                // Get the buddy URI
                hr = pBuddy->get_PresentityURI(&bstrURI);

                if (FAILED(hr))
                {
                    // get_UserURI failed
                    return 0;
                }

                // Show the buddy menu
                HMENU hMenuRes = LoadMenu(
                    GetModuleHandle(NULL),
                    MAKEINTRESOURCE(IDR_MENU_BUDDY));

                HMENU hMenu = GetSubMenu(hMenuRes, 0);

                UINT uID = TrackPopupMenu(hMenu,
                    TPM_LEFTALIGN | TPM_RIGHTBUTTON |
                    TPM_NONOTIFY | TPM_RETURNCMD,
                    pt.x, pt.y, 0, m_hWnd, NULL);

                switch (uID)
                {
                case ID_BUDDY_CALL:
                    // Call the buddy
                    DoCall(RTCST_PC_TO_PC, bstrURI);
                    break;

                case ID_BUDDY_MESSAGE:
                    // Send a message to the buddy
                    DoCall(RTCST_IM, bstrURI);
                    break;

                case ID_BUDDY_REMOVE:
                    // Remove the buddy
                    DoRemoveBuddy(pBuddy);

                    // Release the buddy reference
                    SAFE_RELEASE(pBuddy);

                    // Delete the buddy from the list
                    ListView_DeleteItem(m_hBuddyList, iRes);
                    break;
                }

                SAFE_FREE_STRING(bstrURI);
            }
        }
    }

    return 0;
}

void CRTCWin::OnRTCBuddyEvent ( IRTCBuddyEvent * pEvent ) [private]

Definition at line 2507 of file rtcwin.cpp.

{
    HRESULT hr;

    // Get the buddy object
    IRTCBuddy * pBuddy = NULL;

    hr = pEvent->get_Buddy(&pBuddy);

    if (FAILED(hr))
    {
        // get_Buddy failed
        return;
    }

    // Update the buddy list entry
    hr = UpdateBuddyList(pBuddy);

    SAFE_RELEASE(pBuddy);

    if (FAILED(hr))
    {
        // UpdateBuddyState failed
        return;
    }
}

void CRTCWin::OnRTCClientEvent ( IRTCClientEvent * pEvent ) [private]

Definition at line 2469 of file rtcwin.cpp.

{
    HRESULT hr;

    // Get the client event tyoe
    RTC_CLIENT_EVENT_TYPE enEventType;

    hr = pEvent->get_EventType(&enEventType);

    if (FAILED(hr))
    {
        // get_EventType failed
        return;
    }

    if ( enEventType == RTCCET_ASYNC_CLEANUP_DONE )
    {
        // The RTC client has finished preparing for
        // shutdown. Destroy the window now.
        DestroyWindow(m_hWnd);
    }
    else
    {
        if (CRTCAVSession::m_Singleton != NULL)
        {
            // Deliver the client state to the session window
            (CRTCAVSession::m_Singleton)->DeliverClient(enEventType);
        }
    }
}

LRESULT CRTCWin::OnRTCEvent | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private]

Definition at line 1718 of file rtcwin.cpp.

{
    IDispatch * pDisp = (IDispatch *)lParam;
    RTC_EVENT enEvent = (RTC_EVENT)wParam;
    HRESULT hr;

    // Based on the RTC_EVENT type, query for the
    // appropriate event interface and call a helper
    // method to handle the event
    switch ( wParam )
    {
        case RTCE_REGISTRATION_STATE_CHANGE:
            {
                IRTCRegistrationStateChangeEvent * pEvent = NULL;

                hr = pDisp->QueryInterface( IID_IRTCRegistrationStateChangeEvent,
                                            (void **)&pEvent );

                if (SUCCEEDED(hr))
                {
                    OnRTCRegistrationStateChangeEvent(pEvent);
                    SAFE_RELEASE(pEvent);
                }
            }
            break;

        case RTCE_SESSION_STATE_CHANGE:
            {
                IRTCSessionStateChangeEvent * pEvent = NULL;

                hr = pDisp->QueryInterface( IID_IRTCSessionStateChangeEvent,
                                            (void **)&pEvent );

                if (SUCCEEDED(hr))
                {
                    OnRTCSessionStateChangeEvent(pEvent);
                    SAFE_RELEASE(pEvent);
                }
            }
            break;

        case RTCE_PARTICIPANT_STATE_CHANGE:
            {
                IRTCParticipantStateChangeEvent * pEvent = NULL;

                hr = pDisp->QueryInterface( IID_IRTCParticipantStateChangeEvent,
                                            (void **)&pEvent );

                if (SUCCEEDED(hr))
                {
                    OnRTCParticipantStateChangeEvent(pEvent);
                    SAFE_RELEASE(pEvent);
                }
            }
            break;

        case RTCE_MESSAGING:
            {
                IRTCMessagingEvent * pEvent = NULL;

                hr = pDisp->QueryInterface( IID_IRTCMessagingEvent,
                                            (void **)&pEvent );

                if (SUCCEEDED(hr))
                {
                    OnRTCMessagingEvent(pEvent);
                    SAFE_RELEASE(pEvent);
                }
            }
            break;

        case RTCE_MEDIA:
            {
                IRTCMediaEvent * pEvent = NULL;

                hr = pDisp->QueryInterface( IID_IRTCMediaEvent,
                                            (void **)&pEvent );

                if (SUCCEEDED(hr))
                {
                    OnRTCMediaEvent(pEvent);
                    SAFE_RELEASE(pEvent);
                }
            }
            break;

        case RTCE_INTENSITY:
            {
                IRTCIntensityEvent * pEvent = NULL;

                hr = pDisp->QueryInterface( IID_IRTCIntensityEvent,
                                            (void **)&pEvent );

                if (SUCCEEDED(hr))
                {
                    OnRTCIntensityEvent(pEvent);
                    SAFE_RELEASE(pEvent);
                }
            }
            break;

        case RTCE_CLIENT:
            {
                IRTCClientEvent * pEvent = NULL;

                hr = pDisp->QueryInterface( IID_IRTCClientEvent,
                                            (void **)&pEvent );

                if (SUCCEEDED(hr))
                {
                    OnRTCClientEvent(pEvent);
                    SAFE_RELEASE(pEvent);
                }
            }
            break;

        case RTCE_BUDDY:
            {
                IRTCBuddyEvent * pEvent = NULL;

                hr = pDisp->QueryInterface( IID_IRTCBuddyEvent,
                                            (void **)&pEvent );

                if (SUCCEEDED(hr))
                {
                    OnRTCBuddyEvent(pEvent);
                    SAFE_RELEASE(pEvent);
                }
            }
            break;

        case RTCE_WATCHER:
            {
                IRTCWatcherEvent * pEvent = NULL;

                hr = pDisp->QueryInterface( IID_IRTCWatcherEvent,
                                            (void **)&pEvent );

                if (SUCCEEDED(hr))
                {
                    OnRTCWatcherEvent(pEvent);
                    SAFE_RELEASE(pEvent);
                }
            }
            break;
    }

    // Release the event
    SAFE_RELEASE(pDisp);

    return 0;
}

void CRTCWin::OnRTCIntensityEvent ( IRTCIntensityEvent * pEvent ) [private]

Definition at line 2407 of file rtcwin.cpp.

{
    RTC_AUDIO_DEVICE enDevice;
    long lLevel, lMin, lMax;
    HRESULT hr;

    hr = pEvent->get_Direction(&enDevice);

    if (FAILED(hr))
    {
        // get_Direction failed
        return;
    }

    hr = pEvent->get_Level(&lLevel);

    if (FAILED(hr))
    {
        // get_Level failed
        return;
    }

    hr = pEvent->get_Min(&lMin);

    if (FAILED(hr))
    {
        // get_Min failed
        return;
    }

    hr = pEvent->get_Max(&lMax);

    if (FAILED(hr))
    {
        // get_Max failed
        return;
    }

    // Normalize level to between zero and 100
    if ((lMax - lMin) == 0)
    {
        lLevel = 0;
    }
    else
    {
        lLevel = (lLevel - lMin) * 100 / (lMax - lMin);
    }

    if (CRTCAVSession::m_Singleton != NULL)
    {
        // Deliver the intensity state to the session window
        (CRTCAVSession::m_Singleton)->DeliverIntensity(enDevice, lLevel);
    }
}

void CRTCWin::OnRTCMediaEvent ( IRTCMediaEvent * pEvent ) [private]

Definition at line 2362 of file rtcwin.cpp.

{
    long lMediaType;
    RTC_MEDIA_EVENT_TYPE enType;
    RTC_MEDIA_EVENT_REASON enReason;
    HRESULT hr;

    hr = pEvent->get_MediaType(&lMediaType);

    if (FAILED(hr))
    {
        // get_MediaType failed
        return;
    }

    hr = pEvent->get_EventType(&enType);

    if (FAILED(hr))
    {
        // get_EventType failed
        return;
    }

    hr = pEvent->get_EventReason(&enReason);

    if (FAILED(hr))
    {
        // get_EventReason failed
        return;
    }

    if (CRTCAVSession::m_Singleton != NULL)
    {
        // Deliver the media state to the session window
        (CRTCAVSession::m_Singleton)->DeliverMedia(lMediaType, enType, enReason);
    }
}

void CRTCWin::OnRTCMessagingEvent ( IRTCMessagingEvent * pEvent ) [private]

Definition at line 2266 of file rtcwin.cpp.

{
    IRTCSession * pSession = NULL;
    CRTCSession * pSessWindow = NULL;
    IRTCParticipant * pParticipant = NULL;
    RTC_MESSAGING_EVENT_TYPE enType;
    RTC_MESSAGING_USER_STATUS enStatus;
    BSTR bstrContentType = NULL;
    BSTR bstrMessage = NULL;
    HRESULT hr;

    hr = pEvent->get_Session(&pSession);

    if (FAILED(hr))
    {
        // get_Session failed
        return;
    }

    hr = FindSession(pSession, &pSessWindow);

    SAFE_RELEASE(pSession);

    if (FAILED(hr))
    {
        // FindSession failed
        return;
    }

    hr = pEvent->get_EventType(&enType);

    if (FAILED(hr))
    {
        // get_EventType failed
        return;
    }

    hr = pEvent->get_Participant(&pParticipant);

    if (FAILED(hr))
    {
        // get_Participant failed
        return;
    }

    if (enType == RTCMSET_MESSAGE)
    {
        hr = pEvent->get_MessageHeader(&bstrContentType);

        if (FAILED(hr))
        {
            // get_MessageHeader failed
            SAFE_RELEASE(pParticipant);
            return;
        }

        hr = pEvent->get_Message(&bstrMessage);

        if (FAILED(hr))
        {
            // get_Message failed
            SAFE_RELEASE(pParticipant);
            SAFE_FREE_STRING(bstrContentType);
            return;
        }

        // Deliver the message to the session window
        pSessWindow->DeliverMessage(pParticipant, bstrContentType, bstrMessage);

        SAFE_FREE_STRING(bstrContentType);
        SAFE_FREE_STRING(bstrMessage);
    }
    else if (enType == RTCMSET_STATUS)
    {
        hr = pEvent->get_UserStatus(&enStatus);

        if (FAILED(hr))
        {
            // get_UserStatus failed
            return;
        }

        // Deliver the user status to the session window
        pSessWindow->DeliverUserStatus(pParticipant, enStatus);
    }

    SAFE_RELEASE(pParticipant);
}

void CRTCWin::OnRTCParticipantStateChangeEvent ( IRTCParticipantStateChangeEvent * pEvent ) [private]

Definition at line 2207 of file rtcwin.cpp.

{
    IRTCSession * pSession = NULL;
    CRTCSession * pSessWindow = NULL;
    IRTCParticipant * pParticipant = NULL;
    RTC_PARTICIPANT_STATE enState;
    HRESULT hr;

    hr = pEvent->get_Participant(&pParticipant);

    if (FAILED(hr))
    {
        // get_Participant failed
        return;
    }

    hr = pParticipant->get_Session(&pSession);

    if (FAILED(hr))
    {
        // get_Session failed
        SAFE_RELEASE(pParticipant);
        return;
    }

    hr = FindSession(pSession, &pSessWindow);

    SAFE_RELEASE(pSession);

    if (FAILED(hr))
    {
        // FindSession failed
        SAFE_RELEASE(pParticipant);
        return;
    }

    // Get the participant state
    hr = pEvent->get_State(&enState);

    if (FAILED(hr))
    {
        // get_State failed
        SAFE_RELEASE(pParticipant);
        return;
    }

    // Deliver the participant state to the session window
    pSessWindow->DeliverParticipantState(pParticipant, enState);

    SAFE_RELEASE(pParticipant);
}

void CRTCWin::OnRTCRegistrationStateChangeEvent ( IRTCRegistrationStateChangeEvent * pEvent ) [private]

Definition at line 1876 of file rtcwin.cpp.

{
    HRESULT hr;

    // Get the registration state
    RTC_REGISTRATION_STATE enState;
    long lStatusCode;

    hr = pEvent->get_State(&enState);

    if (FAILED(hr))
    {
        // get_State failed
        return;
    }

    // Get the status code
    hr = pEvent->get_StatusCode(&lStatusCode);

    if (FAILED(hr))
    {
        // get_StatusCode failed
        return;
    }

    switch(enState)
    {
    case RTCRS_UNREGISTERING:
        // Logoff in progress
        SetStatusText(L"Logging off");

        OnLoggingOff();
        break;

    case RTCRS_NOT_REGISTERED:
        // Logged off
        SetStatusText(L"Logged off");

        OnLoggedOff();
        break;

    case RTCRS_REGISTERING:
        // Logon in progress
        SetStatusText(L"Logging on");

        OnLoggingOn();
        break;

    case RTCRS_REGISTERED:
        // Logged on
        SetStatusText(L"Logged on");

        OnLoggedOn();
        break;

    case RTCRS_REJECTED:
    case RTCRS_ERROR:
        {
            // Logon failed. Most likely the server could no be found,
            // or the user needs to authenticate.
            SetStatusText(L"Logged off");

            HRESULT hr = lStatusCode;

            // Check if we need to authenticate
            if ((hr == RTC_E_STATUS_CLIENT_UNAUTHORIZED) ||
                (hr == RTC_E_STATUS_CLIENT_PROXY_AUTHENTICATION_REQUIRED))
            {
                BSTR bstrOldURI = NULL;
                BSTR bstrURI = NULL;
                BSTR bstrAccount = NULL;
                BSTR bstrPassword = NULL;

                // Get the old user URI
                hr = GetUserURI(&bstrOldURI);

                if (FAILED(hr))
                {
                    // GetUserURI failed
                    break;
                }

                // Display the authentication dialog
                hr = ShowAuthDialog(m_hWnd, bstrOldURI,
                    &bstrURI, &bstrAccount, &bstrPassword);

                SAFE_FREE_STRING(bstrOldURI);

                if (FAILED(hr))
                {
                    // ShowAuthDialog failed
                    break;
                }

                // Do the authentication
                hr = DoAuth(bstrURI, bstrAccount, bstrPassword);

                SAFE_FREE_STRING(bstrURI);
                SAFE_FREE_STRING(bstrAccount);
                SAFE_FREE_STRING(bstrPassword);
            }

            if (FAILED(hr))
            {
                DoLogOff();
                OnLoggedOff();

                // If we were logging on the show error
                if (m_enState == RTCRS_REGISTERING)
                {
                    ShowMessageBox(L"Logon failed!");
                }
            }
        }
        break;

    case RTCRS_LOGGED_OFF:
        // The user logged on at another client
        // The user is logged off from this client
        SetStatusText(L"Logged off");

        DoLogOff();
        OnLoggedOff();
        break;

    case RTCRS_LOCAL_PA_LOGGED_OFF:
        // The user logged on at another client
        // The user's presence state is no longer sent from this client

        SetStatusText(L"Logged on (Presence disabled)");
        break;

    case RTCRS_REMOTE_PA_LOGGED_OFF:
        // The user logged off on another client that was sending his
        // presence state. We can ignore this.
        break;
    }

    m_enState = enState;
}

void CRTCWin::OnRTCSessionStateChangeEvent ( IRTCSessionStateChangeEvent * pEvent ) [private]

Definition at line 2024 of file rtcwin.cpp.

{
    IRTCSession * pSession = NULL;
    CRTCSession * pSessWindow = NULL;
    RTC_SESSION_STATE enState;
    HRESULT hr;

    hr = pEvent->get_State(&enState);

    if (FAILED(hr))
    {
        // get_State failed
        return;
    }

    hr = pEvent->get_Session(&pSession);

    if (FAILED(hr))
    {
        // get_Session failed
        return;
    }

    // Is this session in our session list?
    hr = FindSession(pSession, &pSessWindow);

    if (FAILED(hr))
    {
        // FindSession failed
        if (enState == RTCSS_INCOMING)
        {
            // This is a new session
            RTC_SESSION_TYPE enType;

            hr = pSession->get_Type(&enType);

            if (FAILED(hr))
            {
                // get_Type failed
                SAFE_RELEASE(pSession);
                return;
            }

            if (enType == RTCST_IM)
            {
                // This is an IM call
                m_pClient->PlayRing(RTCRT_MESSAGE, VARIANT_TRUE);
            }
            else
            {
                // This is an AV call
                if (CRTCAVSession::m_Singleton != NULL)
                {
                    // If another AV call is in progress, then
                    // we are already busy.
                    pSession->Terminate(RTCTR_BUSY);

                    SAFE_RELEASE(pSession);
                    return;
                }

                // Get the participant object
                IRTCEnumParticipants * pEnum = NULL;
                IRTCParticipant * pParticipant = NULL;

                hr = pSession->EnumerateParticipants(&pEnum);

                if (FAILED(hr))
                {
                    // EnumerateParticipants failed
                    SAFE_RELEASE(pSession);
                    return;
                }

                hr = pEnum->Next(1, &pParticipant, NULL);

                SAFE_RELEASE(pEnum);

                if (hr != S_OK)
                {
                    // Next failed
                    SAFE_RELEASE(pSession);
                    return;
                }

                // Get the participant URI
                BSTR bstrURI = NULL;

                hr = pParticipant->get_UserURI(&bstrURI);

                if (FAILED(hr))
                {
                    // get_UserURI failed
                    SAFE_RELEASE(pSession);
                    SAFE_RELEASE(pParticipant);
                    return;
                }

                // Get the participant name
                BSTR bstrName = NULL;

                hr = pParticipant->get_Name(&bstrName);

                SAFE_RELEASE(pParticipant);

                if (FAILED(hr))
                {
                    // get_PresentityURI failed
                    SAFE_FREE_STRING(bstrURI);
                    SAFE_RELEASE(pSession);
                    return;
                }

                // Ring the bell
                m_pClient->PlayRing(RTCRT_PHONE, VARIANT_TRUE);

                // Show the session dialog
                BOOL fAccept;

                hr = ShowSessionDialog(m_hWnd, bstrName, bstrURI, &fAccept);

                SAFE_FREE_STRING(bstrURI);
                SAFE_FREE_STRING(bstrName);

                if (FAILED(hr))
                {
                    // ShowSessionDialog failed
                    SAFE_RELEASE(pSession);
                    return;
                }

                if (fAccept)
                {
                    // Accept the session
                    hr = pSession->Answer();

                    if (FAILED(hr))
                    {
                        // Answer failed
                        SAFE_RELEASE(pSession);
                        return;
                    }
                }
                else
                {
                    // Reject the session
                    pSession->Terminate(RTCTR_REJECT);

                    SAFE_RELEASE(pSession);
                    return;
                }
            }

            // Add the session to the session list
            // This will create the session window
            hr = AddSession(pSession, enType);

            if (FAILED(hr))
            {
                // AddSession failed
                SAFE_RELEASE(pSession);
                return;
            }
        }

        SAFE_RELEASE(pSession);

        return;
    }

    SAFE_RELEASE(pSession);

    // Deliver the session state to the session window
    pSessWindow->DeliverSessionState(enState);
}

void CRTCWin::OnRTCWatcherEvent ( IRTCWatcherEvent * pEvent ) [private]

Definition at line 2541 of file rtcwin.cpp.

{
    HRESULT hr;

    // Get the watcher object
    IRTCWatcher * pWatcher = NULL;

    hr = pEvent->get_Watcher(&pWatcher);

    if (FAILED(hr))
    {
        // get_Watcher failed
        return;
    }

    // Get the watcher URI
    BSTR bstrURI = NULL;

    hr = pWatcher->get_PresentityURI(&bstrURI);

    if (FAILED(hr))
    {
        // get_PresentityURI failed
        SAFE_RELEASE(pWatcher);
        return;
    }

    // Get the watcher name
    BSTR bstrName = NULL;

    hr = pWatcher->get_Name(&bstrName);

    if (FAILED(hr))
    {
        // get_PresentityURI failed
        SAFE_FREE_STRING(bstrURI);
        SAFE_RELEASE(pWatcher);
        return;
    }

    // Show the incoming watcher dialog
    BOOL fAllow, fAddBuddy;

    hr = ShowWatcherDialog(m_hWnd, bstrName, bstrURI, &fAllow, &fAddBuddy);

    if (FAILED(hr))
    {
        // ShowWatcherDialog failed
        SAFE_FREE_STRING(bstrURI);
        SAFE_FREE_STRING(bstrName);
        SAFE_RELEASE(pWatcher);
        return;
    }

    // Set the watcher to be allowed or blocked
    hr = pWatcher->put_State(fAllow ? RTCWS_ALLOWED : RTCWS_BLOCKED);

    SAFE_RELEASE(pWatcher);

    if (FAILED(hr))
    {
        // put_State failed
        SAFE_FREE_STRING(bstrURI);
        SAFE_FREE_STRING(bstrName);
        return;
    }

    // Shall we add the user as a buddy?
    if (fAddBuddy)
    {
        hr = DoAddBuddy(bstrURI, bstrName);

        if (FAILED(hr))
        {
            // DoAddBuddy failed
            SAFE_FREE_STRING(bstrURI);
            SAFE_FREE_STRING(bstrName);
            return;
        }
    }

    SAFE_FREE_STRING(bstrURI);
    SAFE_FREE_STRING(bstrName);
}

LRESULT CRTCWin::OnSize | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private]

Definition at line 1428 of file rtcwin.cpp.

{
    RECT rcWnd, rcStatusBar, rcBuddyList;

    const int SIZE_EDGE = 5;

    GetClientRect(m_hWnd, &rcWnd);

    // Resize the status bar
    SendMessage(m_hStatusBar, uMsg, wParam, lParam);

    GetClientRect(m_hStatusBar, &rcStatusBar);

    // Resize the buddy list
    rcBuddyList.bottom = rcWnd.bottom -
        (rcStatusBar.bottom - rcStatusBar.top) -
        SIZE_EDGE;
    rcBuddyList.top = rcWnd.top + SIZE_EDGE;
    rcBuddyList.right = rcWnd.right - SIZE_EDGE;
    rcBuddyList.left = rcWnd.left + SIZE_EDGE;

    MoveWindow(
        m_hBuddyList,
        rcBuddyList.left,
        rcBuddyList.top,
        (rcBuddyList.right - rcBuddyList.left),
        (rcBuddyList.bottom - rcBuddyList.top),
        TRUE);

    SendMessage(m_hBuddyList, LVM_SETCOLUMNWIDTH,
        (WPARAM)0, MAKELPARAM(rcBuddyList.right - rcBuddyList.left,0));

    return 0;
}

HRESULT CRTCWin::RegisterClass ( ) [static]

Definition at line 37 of file rtcwin.cpp.

{
    // Register the window class
    WNDCLASS wc;
    ATOM atom;

    ZeroMemory(&wc, sizeof(WNDCLASS));

    wc.style         = CS_HREDRAW | CS_VREDRAW;
    wc.lpfnWndProc   = (WNDPROC)CRTCWin::WindowProc;
    wc.hInstance     = GetModuleHandle(NULL);
    wc.hIcon         = NULL;
    wc.hCursor       =
        LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground =
        GetSysColorBrush(COLOR_3DFACE);
    wc.lpszMenuName  = MAKEINTRESOURCE(IDR_MENU_APP);
    wc.lpszClassName = APP_CLASS;

    atom = ::RegisterClass( &wc );

    if ( !atom )
    {
        // RegisterClass failed
        return E_FAIL;
    }

    return S_OK;
}

HRESULT CRTCWin::RemoveSession ( CRTCSession * pSessWindow )

Definition at line 122 of file rtcwin.cpp.

{
    std::vector<CRTCSession *>::iterator it;

    if (!m_SessionList.empty())
    {
        // Find the window
        for(it=m_SessionList.begin();
            it < m_SessionList.end();
            it++)
        {
            if (*it == pSessWindow)
            {
                // Remove the window
                m_SessionList.erase(it);
                break;
            }
        }
    }

    return S_OK;
}

void CRTCWin::SetStatusText ( PWSTR szText ) [private]

Definition at line 210 of file rtcwin.cpp.

{
    SetWindowTextW(m_hStatusBar, szText);
    InvalidateRect(m_hStatusBar, NULL, FALSE);
}

void CRTCWin::ShowMessageBox ( PWSTR szText ) [private]

Definition at line 200 of file rtcwin.cpp.

{
    MessageBoxW(m_hWnd, szText, APP_TITLE, MB_OK);
}

HRESULT CRTCWin::UpdateBuddyList ( IRTCBuddy * pBuddy ) [private]

Definition at line 256 of file rtcwin.cpp.

{
    HRESULT hr;

    // Get the buddy status
    RTC_PRESENCE_STATUS enStatus;

    hr = pBuddy->get_Status(&enStatus);

    if (FAILED(hr))
    {
        // get_Status failed
        return hr;
    }

    // Get the buddy name
    BSTR bstrName = NULL;

    hr = pBuddy->get_Name(&bstrName);

    if (SUCCEEDED(hr) && !wcscmp(bstrName, L""))
    {
        // Treat an emptry string as a failure
        SAFE_FREE_STRING(bstrName);
        hr = E_FAIL;
    }

    if (FAILED(hr))
    {
        // get_Name failed, get the URI instead
        hr = pBuddy->get_PresentityURI(&bstrName);

        if (SUCCEEDED(hr) && !wcscmp(bstrName, L""))
        {
            // Treat an emptry string as a failure
            SAFE_FREE_STRING(bstrName);
            hr = E_FAIL;
        }

        if (FAILED(hr))
        {
            // get_PresentityURI failed
            return hr;
        }
    }

    // Build a string for the listbox
    WCHAR szBuddy[MAX_STRING];

    switch(enStatus)
    {
    case RTCXS_PRESENCE_OFFLINE:
        _snwprintf(szBuddy, MAX_STRING, L"%ws (Offline)", bstrName);
        break;
    case RTCXS_PRESENCE_ONLINE:
        _snwprintf(szBuddy, MAX_STRING, L"%ws (Online)", bstrName);
        break;
    case RTCXS_PRESENCE_AWAY:
        _snwprintf(szBuddy, MAX_STRING, L"%ws (Away)", bstrName);
        break;
    case RTCXS_PRESENCE_IDLE:
        _snwprintf(szBuddy, MAX_STRING, L"%ws (Idle)", bstrName);
        break;
    case RTCXS_PRESENCE_BUSY:
        _snwprintf(szBuddy, MAX_STRING, L"%ws (Busy)", bstrName);
        break;
    case RTCXS_PRESENCE_BE_RIGHT_BACK:
        _snwprintf(szBuddy, MAX_STRING, L"%ws (Be right back)", bstrName);
        break;
    case RTCXS_PRESENCE_ON_THE_PHONE:
        _snwprintf(szBuddy, MAX_STRING, L"%ws (On the phone)", bstrName);
        break;
    case RTCXS_PRESENCE_OUT_TO_LUNCH:
        _snwprintf(szBuddy, MAX_STRING, L"%ws (Out to lunch)", bstrName);
        break;
    default:
        _snwprintf(szBuddy, MAX_STRING, L"%ws", bstrName);
        break;
    }

    szBuddy[MAX_STRING-1] = L'\0';

    SAFE_FREE_STRING(bstrName);

    // Is the buddy in the list?
    LVFINDINFO lvfi;
    ZeroMemory(&lvfi, sizeof(LVFINDINFO));

    lvfi.flags = LVFI_PARAM;
    lvfi.lParam = (LPARAM)pBuddy;

    int iRes = ListView_FindItem(m_hBuddyList, -1, &lvfi);

    if (iRes == -1)
    {
        // Buddy is not in the list
        // Add the buddy to the list
        LVITEM lvi;
        ZeroMemory(&lvi, sizeof(LVITEM));

        lvi.mask = LVIF_TEXT | LVIF_PARAM;
        lvi.pszText = szBuddy;
        lvi.lParam = (LPARAM)pBuddy;

        iRes = ListView_InsertItem(m_hBuddyList, &lvi);

        if (iRes == -1)
        {
            // ListView_InsertItem failed
            return E_FAIL;
        }

        // An RTC buddy reference will be kept by the list
        // Add the reference here
        pBuddy->AddRef();
    }
    else
    {
        // Buddy is in the list
        // Update the list entry
        LVITEM lvi;
        ZeroMemory(&lvi, sizeof(LVITEM));

        lvi.mask = LVIF_TEXT;
        lvi.pszText = szBuddy;
        lvi.iItem = iRes;

        iRes = ListView_SetItem(m_hBuddyList, &lvi);

        if (iRes == -1)
        {
            // ListView_SetItem failed
            return E_FAIL;
        }
    }

    return S_OK;
}

LRESULT CALLBACK CRTCWin::WindowProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 1159 of file rtcwin.cpp.

{
    CRTCWin * me = NULL;
    LRESULT  lr = 0;

    if ( uMsg == WM_CREATE )
    {
        // Create an instance of the class
        me = new CRTCWin;
        me->m_hWnd = hWnd;

        // Store the class instance pointer in the
        // window's user data for later retrieval
        SetWindowLong(hWnd, GWL_USERDATA, (LONG)me);

        lr = me->OnCreate(uMsg, wParam, lParam);
    }
    else
    {
        // Retrieve the class instance pointer from the
        // window's user data
        me = (CRTCWin *)GetWindowLong(hWnd, GWL_USERDATA);

        switch( uMsg )
        {
        case WM_DESTROY:
            lr = me->OnDestroy(uMsg, wParam, lParam);

            // Delete the object instance
            delete me;

            // Quit the application
            PostQuitMessage(0);
            break;

        case WM_CLOSE:
            lr = me->OnClose(uMsg, wParam, lParam);
            break;

        case WM_SIZE:
            lr = me->OnSize(uMsg, wParam, lParam);
            break;

        case WM_COMMAND:
            lr = me->OnCommand(uMsg, wParam, lParam);
            break;

        case WM_NOTIFY:
            lr = me->OnNotify(uMsg, wParam, lParam);
            break;

        case WM_RTC_EVENT:
            lr = me->OnRTCEvent(uMsg, wParam, lParam);
            break;

        default:
            lr = DefWindowProc( hWnd, uMsg, wParam, lParam );
        }
    }

    return lr;
}

Member Data Documentation

RTC_REGISTRATION_STATE CRTCWin::m_enState [private]

Definition at line 49 of file rtcwin.h.

BOOL CRTCWin::m_fPresenceEnabled [private]

Definition at line 50 of file rtcwin.h.

HWND CRTCWin::m_hBuddyList [private]

Definition at line 44 of file rtcwin.h.

HWND CRTCWin::m_hStatusBar [private]

Definition at line 43 of file rtcwin.h.

HWND CRTCWin::m_hWnd [private]

Definition at line 42 of file rtcwin.h.

IRTCClient* CRTCWin::m_pClient [private]

Definition at line 46 of file rtcwin.h.

CRTCEvents* CRTCWin::m_pEvents [private]

Definition at line 48 of file rtcwin.h.

IRTCProfile* CRTCWin::m_pProfile [private]

Definition at line 47 of file rtcwin.h.

std::vector<CRTCSession *> CRTCWin::m_SessionList [private]

Definition at line 52 of file rtcwin.h.

The documentation for this class was generated from the following files:
  • NetDS/rtc/Client/CPP/rtcsample/rtcwin.h
  • NetDS/rtc/Client/CPP/rtcsample/rtcwin.cpp
Generated on Wed Nov 13 2024 16:57:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CS1Dialog Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Public Attributes

CS1Dialog Class Reference

#include "wizard.h"

Inherits CDialogBase.

List of all members.

Public Member Functions

CS1Dialog (HWND hWnd, HINSTANCE hInst, CTableCopy *pTableCopy)
virtual | ~CS1Dialog ()
virtual BOOL | ChangeTableName (LONG iIndex)
virtual BOOL | CreateTableNode (TREEINFO *rgTreeInfo, ULONG ulNameOffset, LONG iParam=0, LONG iImage=0, LONG iSelectedImage=0)
virtual ULONG | Display ()
virtual BOOL | GetTableColInfo (HWND hWndCol)
virtual BOOL | InitControls ()
virtual BOOL | RefreshControls ()
virtual BOOL | ResetColInfo (HWND hWndCol)
virtual BOOL | ResetTableList (HWND hWndTable, HWND hWndCol)

Static Public Member Functions

static BOOL WINAPI | DlgProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)

Public Attributes

ULONG m_cTables
BOOL m_fEditing
CTableCopy * m_pCTableCopy
TABLEINFO * m_rgTableInfo

Detailed Description

Definition at line 78 of file wizard.h.

Constructor & Destructor Documentation

CS1Dialog::CS1Dialog | ( | HWND | hWnd,
 |  | HINSTANCE | hInst,
 |  | CTableCopy * | pTableCopy
 | ) |  |

Definition at line 62 of file step1.cpp.

  : CDialogBase(hWnd, hInst)
{
  ASSERT(pCTableCopy);
  m_pCTableCopy = pCTableCopy;
  m_fEditing = FALSE;

  m_cTables = 0;
  m_rgTableInfo = NULL;
}

CS1Dialog::~CS1Dialog ( ) [virtual]

Definition at line 78 of file step1.cpp.

{
  SAFE_FREE(m_rgTableInfo);
}

Member Function Documentation

BOOL CS1Dialog::ChangeTableName ( LONG iIndex ) [virtual]

Definition at line 975 of file step1.cpp.

{
  CTable* pCFromTable = m_pCTableCopy->m_pCFromTable;
  CTable* pCToTable = m_pCTableCopy->m_pCToTable;

  //Index must fall with the m_rgTableInfo array range
  //Otherwise we have selected a "tree-folder" and need to free the column list
  if(iIndex < 0 || iIndex >= (LONG)m_cTables)
  {
    //Resest TableName
    memset(&pCFromTable->m_TableInfo, 0, sizeof(TABLEINFO));

    //Reset current Window Column ListView
    SendMessage(GetDlgItem(m_hWnd, IDL_COLUMNS), LVM_DELETEALLITEMS, (WPARAM)0, (LPARAM)0L);
    return FALSE;
  }

  //Only change the TableName if not equal to "Enter - <TableTerm>"
  if(wcsstr(m_rgTableInfo[iIndex].wszTableName, L"Enter - "))
    return FALSE;

  //TableInfo
  memcpy(&pCFromTable->m_TableInfo, &m_rgTableInfo[iIndex], sizeof(TABLEINFO));

  //QualifiedTableName syntax
  // #1.  TableName
  // #2.  Owner.TableName (always a ".")
  // #3.  Catalog[CatalogSeperator]TableName
  // #4.  Catalog[CatalogSeperator]Owner.TableName
  if(pCFromTable->m_TableInfo.wszSchemaName[0])
    swprintf(pCFromTable->m_wszQualTableName, L"%s.%s", pCFromTable->m_TableInfo.wszSchemaName, pCFromTable->m_TableInfo.wszTableName);
  else
    wcscpy(pCFromTable->m_wszQualTableName, pCFromTable->m_TableInfo.wszTableName);

  //Free the current columns list, since the new
  //table will have diffent columns
  pCFromTable->m_cColumns = 0;
  SAFE_FREE(pCFromTable->m_rgColDesc);

  //Reset the column list, since we have a new table
  ResetColInfo(GetDlgItem(m_hWnd, IDL_COLUMNS));

  //Reset the index list, since we have a new table
  pCFromTable->m_cIndexes = 0;
  SAFE_FREE(pCFromTable->m_rgIndexInfo);

  //Reset the "To" table, since we have a new table
  memset(&pCToTable->m_TableInfo, 0, sizeof(TABLEINFO));
  return TRUE;
}

BOOL CS1Dialog::CreateTableNode | ( | TREEINFO * | rgTreeInfo,
 |  | ULONG | ulNameOffset,
 |  | LONG | iParam = 0,
 |  | LONG | iImage = 0,
 |  | LONG | iSelectedImage = 0 |
 | ) |  |  | [virtual]

Definition at line 567 of file step1.cpp.

{
  //ulNameOffset is the offset into TABELEINFO indicating
  //Catalog / Schema / Type name were interested in comparing
  ASSERT(ulNameOffset == offsetof(TABLEINFO, wszCatalogName)
    || ulNameOffset == offsetof(TABLEINFO, wszSchemaName)
    || ulNameOffset == offsetof(TABLEINFO, wszType));

  //Create the specified node in the tree.
  //Basically this is a fairly complex function that builds the nodes to the
  //TreeView control, listing Catalog/Schema/TableType/TableName heieracrcy.

  //This is an extremly simple algortym that loops over the specified column
  //(Catalog/Schema/Type) and adds only unique names as a node to the TreeView.
  //It then updates "rgTreeInfo" hParents and hItems accordingly.

  CHAR szBuffer[MAX_NAME_LEN];

  //Loop over all Tables
  ULONG cFoundInfo = 0;
  for(ULONG i=0; i<m_cTables; i++)
  {
    BOOL bFound = FALSE;
    WCHAR* pwszName = (WCHAR*)((BYTE*)&m_rgTableInfo[i] + ulNameOffset);

    //Try to find Type value in the FoundList
    for(ULONG j=0; j<cFoundInfo; j++)
    {
      ULONG ulFoundIndex = rgTreeInfo[j].ulIndex;
      WCHAR* pwszFoundName = (WCHAR*)((BYTE*)&m_rgTableInfo[ulFoundIndex] + ulNameOffset);

      if(wcscmp(pwszName, pwszFoundName)==0
        && rgTreeInfo[i].hParent == rgTreeInfo[ulFoundIndex].hParent)
      {
        bFound = TRUE;
        rgTreeInfo[i].hItem = rgTreeInfo[ulFoundIndex].hItem;
        break;
      }
    }

    if(!bFound && pwszName[0])
    {
      //Add it to the list
      rgTreeInfo[cFoundInfo].ulIndex = i;
      cFoundInfo++;

      //Add it to the TreeView
      ConvertToMBCS(pwszName, szBuffer, MAX_NAME_LEN);
      rgTreeInfo[i].hItem = TV_InsertItem(GetDlgItem(m_hWnd, IDL_TABLES), rgTreeInfo[i].hParent, TVI_SORT, szBuffer, iParam, iImage, iSelectedImage);
    }
  }

  //Update Parents
  for(i=0; i<m_cTables; i++)
    rgTreeInfo[i].hParent = rgTreeInfo[i].hItem;

  return TRUE;
}

ULONG CS1Dialog::Display ( ) [virtual]

Implements CDialogBase.

Definition at line 88 of file step1.cpp.

{
  //Create a Modal dialog box
  return DialogBoxParam(m_hInst, MAKEINTRESOURCE(IDD_FROM_INFO), NULL, DlgProc, (LPARAM)this);
}

BOOL WINAPI CS1Dialog::DlgProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 99 of file step1.cpp.

{
  static WCHAR  wszBuffer[MAX_NAME_LEN+1];

  switch(msg)
  {
    case WM_INITDIALOG:
    {
      Busy();
      CS1Dialog* pThis = (CS1Dialog*)lParam;
      SetWindowLong(hWnd, GWL_USERDATA, (LONG)pThis);

      //On INIT we know we have a valid hWnd to store
      CenterDialog(hWnd);
      pThis->m_hWnd = hWnd;
      CTable* pCFromTable = pThis->m_pCTableCopy->m_pCFromTable;

      //Init all controls to the default values
      pThis->InitControls();

      // If there is a source to look at, Display the table list
      if(pCFromTable->IsConnected())
        pThis->ResetTableList(GetDlgItem(hWnd, IDL_TABLES), GetDlgItem(hWnd, IDL_COLUMNS));

      pThis->RefreshControls();
      pThis->m_pCTableCopy->m_pCWizard->DestroyPrevStep(WIZ_STEP1);
      return HANDLED_MSG;
    }//case WM_INITDIALOG

    case WM_COMMAND:
    {
      //Obtain the "this" pointer
      CS1Dialog *pThis = (CS1Dialog*)GetWindowLong(hWnd, GWL_USERDATA);

      CTable    *pCFromTable    = pThis->m_pCTableCopy->m_pCFromTable;
      CTable    *pCToTable      = pThis->m_pCTableCopy->m_pCToTable;
      CDataSource *pCToDataSource   = pCToTable->m_pCDataSource;
      CDataSource *pCFromDataSource = pCFromTable->m_pCDataSource;

      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      //LBN_SELCHANGE ListBox Selection change
      if(GET_WM_COMMAND_CMD(wParam, lParam) == LBN_SELCHANGE
        && IDC_PROVIDER_NAME == GET_WM_COMMAND_ID(wParam, lParam))
      {
        Busy();
/*
        //Get new selection
        LONG iSel = 0;
        if((iSel = SendMessage(GetDlgItem(pThis->m_hWnd, IDC_PROVIDER_NAME), CB_GETCURSEL, 0, 0L)) != CB_ERR)
        {
          //Since we have the CBS_SORT turned on, the order in the Combo Box does
          //not match our array, so we pass the array index (lParam) as the item data
          LONG lParam = SendMessage(GetDlgItem(pThis->m_hWnd, IDC_PROVIDER_NAME), CB_GETITEMDATA, iSel, 0L);
          if((lParam < (LONG)pCFromDataSource->m_cProviderInfo) && (wcscmp(pCFromDataSource->m_rgProviderInfo[lParam].wszName, pCFromDataSource->m_pwszProviderName)!=0))
          {
            //Clear Table/Column List Views
            SendMessage(GetDlgItem(hWnd, IDL_TABLES), TVM_DELETEITEM, (WPARAM)0, (LPARAM)TVI_ROOT);
            SendMessage(GetDlgItem(hWnd, IDL_COLUMNS), LVM_DELETEALLITEMS, (WPARAM)0, (LPARAM)0);

            //Clear Table info
            memset(&pCFromTable->m_TableInfo, 0, sizeof(TABLEINFO));
            pCFromTable->m_wszQualTableName[0] = EOL;

            //Disconnect from the DataSource and Update controls
            pCFromTable->m_pCDataSource->Disconnect();
            pThis->RefreshControls();
          }
        }
        else
        {
          //The user must have typed in a Provider Name directly
          //This may not map to a provider in the list, so assume the name is a ProgID/CLSID
          LONG lParam = wSendMessage(GetDlgItem(pThis->m_hWnd, IDC_PROVIDER_NAME), CB_GETLBTEXT, 0, wszBuffer);
        }
        return HANDLED_MSG;
*/
      }
      if(pThis->m_fEditing)
      {
        //There is a bug in the TreeView control for editing here is KB article
        //Article ID: Q130691 BUG: ESC/ENTER Keys Don't Work When Editing Labels in TreeView
        //So one way to work around this is to just have a flag (m_fEditing)
        //to indicate we were in editing mode.
        SendDlgItemMessage(hWnd, IDL_TABLES, TVM_ENDEDITLABELNOW, (WPARAM) (wParam==IDCANCEL ? TRUE : FALSE), (LPARAM)0);
        return HANDLED_MSG;
      }

      // Now check for regular command ids
      switch(GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDB_FROM_CONNECT:
        {
          //on connect get whatever is now listed in the drop down
          LONG iSel = 0;
          if((iSel = SendMessage(GetDlgItem(pThis->m_hWnd, IDC_PROVIDER_NAME), CB_GETCURSEL, 0, 0L)) != CB_ERR)
          {
            //Since we have the CBS_SORT turned on, the order in the Combo Box does
            //not match our array, so we pass the array index (lParam) as the item data
            LONG lParam = SendMessage(GetDlgItem(pThis->m_hWnd, IDC_PROVIDER_NAME), CB_GETITEMDATA, iSel, 0L);
            pCFromTable->m_pCDataSource->m_pwszProviderName = pCFromDataSource->m_rgProviderInfo[lParam].wszName;
            if((lParam < (LONG)pCFromDataSource->m_cProviderInfo) && (wcscmp(pCFromDataSource->m_rgProviderInfo[lParam].wszName, pCFromDataSource->m_pwszProviderName)!=0))
            {
              //Clear Table/Column List Views
              SendMessage(GetDlgItem(hWnd, IDL_TABLES), TVM_DELETEITEM, (WPARAM)0, (LPARAM)TVI_ROOT);
              SendMessage(GetDlgItem(hWnd, IDL_COLUMNS), LVM_DELETEALLITEMS, (WPARAM)0, (LPARAM)0);

              //Clear Table info
              memset(&pCFromTable->m_TableInfo, 0, sizeof(TABLEINFO));
              pCFromTable->m_wszQualTableName[0] = EOL;

              //Disconnect from the DataSource and Update controls
              pCFromTable->m_pCDataSource->Disconnect();
            }
          }
          else
          {
            //The user must have typed in a Provider Name directly
            //This may not map to a provider in the list, so assume the name is a ProgID/CLSID
            wSendMessage(GetDlgItem(pThis->m_hWnd, IDC_PROVIDER_NAME), WM_GETTEXT, MAX_NAME_LEN, wszBuffer);
            pCFromTable->m_pCDataSource->m_pwszProviderName = wszBuffer;
          }

          //Try to connect to the DataSource
          Busy();
          if(pCFromTable->Connect(hWnd))
          {
            Busy();
            //Clear Table info
            memset(&pCFromTable->m_TableInfo, 0, sizeof(TABLEINFO));
            pCFromTable->m_wszQualTableName[0] = EOL;

            //ResetTableList
            pThis->ResetTableList(GetDlgItem(hWnd, IDL_TABLES), GetDlgItem(hWnd, IDL_COLUMNS));
          }

          pThis->RefreshControls();
          return HANDLED_MSG;
        }//case IDB_FROM_CONNECT

                case IDOK:
          Busy();
          pThis->GetTableColInfo(GetDlgItem(hWnd, IDL_COLUMNS));
          pThis->m_pCTableCopy->m_pCWizard->DisplayStep(WIZ_STEP2);
          return HANDLED_MSG;

        case IDCANCEL:
          Busy();
          EndDialog(hWnd, GET_WM_COMMAND_ID(wParam, lParam));
          return HANDLED_MSG;
      }//switch GET_WM_COMMAND_ID

      return UNHANDLED_MSG;
    }//case WM_COMMAND

    // Now look for WM_NOTIFY messages
    case WM_NOTIFY:
    {
      if(wParam == IDL_COLUMNS)
      {
        //Obtain the "this" pointer
        CS1Dialog* pThis = (CS1Dialog*)GetWindowLong(hWnd, GWL_USERDATA);
        NM_LISTVIEW* pListView = (NM_LISTVIEW*)lParam;

        switch(pListView->hdr.code)
        {
          case LVN_ITEMCHANGED:
          {
            //Refresh Controls, ("Next" button)
            pThis->RefreshControls();
            return UNHANDLED_MSG;
          }
        }
        return UNHANDLED_MSG;
      }

      if(wParam == IDL_TABLES)
      {
        //Obtain the "this" pointer
        CS1Dialog* pThis = (CS1Dialog*)GetWindowLong(hWnd, GWL_USERDATA);
        CTable* pCFromTable = pThis->m_pCTableCopy->m_pCFromTable;
        NM_TREEVIEW* pTreeView = (NM_TREEVIEW*)lParam;

        switch(pTreeView->hdr.code)
        {
          case TVN_BEGINLABELEDIT:
          {
            //Idicate we have started to edit
            pThis->m_fEditing = TRUE;
            return FALSE; //Allow the edited change
          }

          case TVN_ENDLABELEDIT:
          {
            Busy();
            pThis->m_fEditing = FALSE;
            TV_DISPINFO* pDispInfo = (TV_DISPINFO*)lParam;

            //If Schemas are available - don't allow the change
            if(pCFromTable->m_pCDataSource->m_pIDBSchemaRowset)
              return FALSE;

            //Just need to obtain the new tablename...
            if(pDispInfo->item.pszText)
            {
              //Now update the window TableName myself
              TV_ITEM tvItem = { TVIF_TEXT | TVIF_STATE, pDispInfo->item.hItem, TVIS_SELECTED, TVIS_SELECTED, pDispInfo->item.pszText, 0, 0, 0, 0, 0};
              SendDlgItemMessage(hWnd, IDL_TABLES, TVM_SETITEM, (WPARAM)0, (LPARAM)&tvItem);

              //Change the TableName (if different)
              memset(&pThis->m_rgTableInfo[0], 0, sizeof(TABLEINFO));
              ConvertToWCHAR(pDispInfo->item.pszText, pThis->m_rgTableInfo[0].wszTableName, MAX_NAME_LEN);
              pThis->ChangeTableName(0);
            }

            //Refresh Controls ("Next" button);
            pThis->RefreshControls();
            return TRUE; //Allow the edited change
          }

          case TVN_SELCHANGED:
          {
            //There is a problem with the SELCHANGED notification
            //It can be sent when either a item is selected or
            //DELETED, since when an item deleted the selection moves
            //to a different selection.
            if((pTreeView->itemNew.state == TVIS_SELECTED && pTreeView->action)
              || (pTreeView->itemNew.state & TVIS_SELECTED && pTreeView->itemNew.state != TVIS_SELECTED))
            {
              Busy();
              //We assume it sends us the Param of the item
              ASSERT(pTreeView->itemNew.mask & TVIF_PARAM);

              //Change the TableName (if different)
              pThis->ChangeTableName(pTreeView->itemNew.lParam);
            }

            //Refresh Controls ("Next" button);
            pThis->RefreshControls();
            return UNHANDLED_MSG;
          }
        }
        return UNHANDLED_MSG;
      }//IDL_TABLES
      return UNHANDLED_MSG;
    }//WM_NOTIFY
  }//msg

  return UNHANDLED_MSG;
}

BOOL CS1Dialog::GetTableColInfo ( HWND hWndCol ) [virtual]

Definition at line 541 of file step1.cpp.

{
  CTable* pCFromTable = m_pCTableCopy->m_pCFromTable;

  // Get the count of selected items
  LONG cSelColumns = SendMessage(hWndCol, LVM_GETSELECTEDCOUNT, (WPARAM)0, (LPARAM)0);
  LONG iIndex = -1;

  //Loop over all the selected columns in the list
  pCFromTable->m_cColumns = cSelColumns;
  for(LONG i=0; i<cSelColumns; i++)
  {
    iIndex = SendMessage(hWndCol, LVM_GETNEXTITEM, (WPARAM)iIndex, (LPARAM)LVNI_SELECTED);

    //"compact" the m_rgColDesc array to only the selected items
    if(iIndex != LVM_ERR)
      memmove(&pCFromTable->m_rgColDesc[i], &pCFromTable->m_rgColDesc[iIndex], sizeof(COLDESC));
  }
  return TRUE;
}

BOOL CS1Dialog::InitControls ( ) [virtual]

Definition at line 360 of file step1.cpp.

{
  HWND    hWndTable   = GetDlgItem(m_hWnd, IDL_TABLES);
  HWND    hWndCol     = GetDlgItem(m_hWnd, IDL_COLUMNS);
  HWND    hWndProv    = GetDlgItem(m_hWnd, IDC_PROVIDER_NAME);
  CDataSource *pCDataSource = m_pCTableCopy->m_pCFromTable->m_pCDataSource;
  HRESULT   hr;

  //Create the Table ImageList
  HIMAGELIST hTableImageList = ImageList_Create(16, 16, ILC_MASK, 1, 0 );

  //IDI_CATALOG - normal catalog icon
  HICON hIcon = LoadIcon(m_hInst, MAKEINTRESOURCE(IDI_CATALOG));
  ImageList_AddIcon(hTableImageList, hIcon);
  //IDI_SCHEMA - normal schema icon
  hIcon = LoadIcon(m_hInst, MAKEINTRESOURCE(IDI_SCHEMA));
  ImageList_AddIcon(hTableImageList, hIcon);
  //IDI_TYPE - normal type icon
  hIcon = LoadIcon(m_hInst, MAKEINTRESOURCE(IDI_TYPE));
  ImageList_AddIcon(hTableImageList, hIcon);
  //IDI_TABLE - normal table icon
  hIcon = LoadIcon(m_hInst, MAKEINTRESOURCE(IDI_TABLE));
  ImageList_AddIcon(hTableImageList, hIcon);
  //IDI_SYSTABLE - normal system table icon
  hIcon = LoadIcon(m_hInst, MAKEINTRESOURCE(IDI_SYSTABLE));
  ImageList_AddIcon(hTableImageList, hIcon);
  //IDI_VIEW - normal view icon
  hIcon = LoadIcon(m_hInst, MAKEINTRESOURCE(IDI_VIEW));
  ImageList_AddIcon(hTableImageList, hIcon);
  //IDI_SYNONYM - normal synonym icon
  hIcon = LoadIcon(m_hInst, MAKEINTRESOURCE(IDI_SYNONYM));
  ImageList_AddIcon(hTableImageList, hIcon);

  //Set image list to the Table Window
  TreeView_SetImageList(hWndTable, hTableImageList, TVSIL_NORMAL);

  //Create the Col ImageList
  HIMAGELIST hColImageList = ImageList_Create(16, 16, ILC_MASK, 1, 0 );

  //IDI_COLUMN - normal column icon
  hIcon = LoadIcon(m_hInst, MAKEINTRESOURCE(IDI_COLUMN));
  ImageList_AddIcon(hColImageList, hIcon);
  //IDI_COLUMNREAD - read-only column icon
  hIcon = LoadIcon(m_hInst, MAKEINTRESOURCE(IDI_COLUMNREAD));
  ImageList_AddIcon(hColImageList, hIcon);
  //IDI_COLUMNLONG - long column icon
  hIcon = LoadIcon(m_hInst, MAKEINTRESOURCE(IDI_COLUMNLONG));
  ImageList_AddIcon(hColImageList, hIcon);

  //Set image list to the Table Window
  ListView_SetImageList(hWndCol, hColImageList, LVSIL_SMALL);

  //ListView COLUMNS
  LV_InsertColumn(hWndCol,  COL_COLNAME,    "ColName");
  LV_InsertColumn(hWndCol,  COL_COLTYPE,    "Type");
  LV_InsertColumn(hWndCol,  COL_COLSIZE,    "Size");
  LV_InsertColumn(hWndCol,  COL_COLORDINAL,   "Ordinal");
  LV_InsertColumn(hWndCol,  COL_COLPREC,    "Precision");
  LV_InsertColumn(hWndCol,  COL_COLSCALE,   "Scale");
  LV_InsertColumn(hWndCol,  COL_COLISFIXED,   "ISFIXED");
  LV_InsertColumn(hWndCol,  COL_COLISLONG,    "ISLONG");
  LV_InsertColumn(hWndCol,  COL_COLISNULLABLE,  "ISNULLABLE");
  LV_InsertColumn(hWndCol,  COL_COLWRITE,   "WRITE");
  LV_InsertColumn(hWndCol,  COL_COLISROWID,   "ISROWID");
  LV_InsertColumn(hWndCol,  COL_COLISROWVER,  "ISROWVER");

  //AutoSize all columns
  for(ULONG i=0; i<=COL_COLISROWVER; i++)
    SendMessage(hWndCol, LVM_SETCOLUMNWIDTH, (WPARAM)i,   (LPARAM)LVSCW_AUTOSIZE_USEHEADER);

  //Use Extended ListView Styles!
  SendMessage(hWndCol, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE | LVS_EX_SUBITEMIMAGES, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE | LVS_EX_SUBITEMIMAGES);

  //Initialize the Provider List (if not done so already)
  if(pCDataSource->m_rgProviderInfo == NULL)
  {
    hr =  pCDataSource->GetProviders();
  }

  WCHAR wszBuffer[MAX_NAME_LEN*2];

  //Fill out the provider name combo box.
  for(i=0; i<pCDataSource->m_cProviderInfo; i++)
  {
    //Add the name to the list
    //Since we have the CBS_SORT turned on, the order in the Combo Box does
    //not match our array, so we pass the array index (lParam) as the item data
    swprintf(wszBuffer, wsz_PROVIDER_INFO_, pCDataSource->m_rgProviderInfo[i].wszName);
    LONG iIndex = wSendMessage(hWndProv, CB_ADDSTRING, (WPARAM)0, wszBuffer);
    SendMessage(hWndProv, CB_SETITEMDATA, (WPARAM)iIndex, (LPARAM)i);
  }

  //By default, it selects MSDASQL
  if(pCDataSource->m_pwszProviderName == NULL)
  {
    pCDataSource->m_pwszProviderName = L"MSDASQL";
  }

  //Try and select the previous selected Provider
  if(CB_ERR == wSendMessage(hWndProv, CB_SELECTSTRING, 0, pCDataSource->m_pwszProviderName))
  {
    //If not found, just select the first one
    SendMessage(hWndProv, CB_SETCURSEL, 0, 0);
  }

  //Indicate were not in the middle of an TreeView editing command
  m_fEditing = FALSE;

  // Enable Connect button only if there are providers installed.
  EnableWindow(GetDlgItem(m_hWnd, IDB_FROM_CONNECT), SendMessage(hWndProv, CB_GETCURSEL, 0, 0L) != CB_ERR);
  return TRUE;
}

BOOL CS1Dialog::RefreshControls ( ) [virtual]

Definition at line 478 of file step1.cpp.

{
  CTable* pCFromTable = m_pCTableCopy->m_pCFromTable;
  CDataSource* pCDataSource = pCFromTable->m_pCDataSource;

  // Must have a connection to edit other controls
  BOOL fConnected = pCFromTable->IsConnected();
  ULONG cSelColumns = SendDlgItemMessage(m_hWnd, IDL_COLUMNS, LVM_GETSELECTEDCOUNT, 0, 0);

  //Enable dialog items, only if connected
  EnableWindow(GetDlgItem(m_hWnd, IDL_TABLES),    fConnected);
  EnableWindow(GetDlgItem(m_hWnd, IDL_COLUMNS),   fConnected);
  EnableWindow(GetDlgItem(m_hWnd, IDT_FROMTABLEHELP), fConnected);

  //Enable OK/Next if there is a table and at least 1 column selected
  EnableWindow(GetDlgItem(m_hWnd, IDOK),  fConnected && cSelColumns);

  //Store the selected ProviderName and ProviderDesc
  LONG iSel = 0;
  if((iSel = SendMessage(GetDlgItem(m_hWnd, IDC_PROVIDER_NAME), CB_GETCURSEL, 0, 0L)) != CB_ERR)
  {
    //Since we have the CBS_SORT turned on, the order in the Combo Box does
    //not match our array, so we pass the array index (lParam) as the item data
    LONG lParam = SendMessage(GetDlgItem(m_hWnd, IDC_PROVIDER_NAME), CB_GETITEMDATA, iSel, 0L);
    ASSERT(lParam < (LONG)pCDataSource->m_cProviderInfo);
    pCDataSource->m_pwszProviderName = pCDataSource->m_rgProviderInfo[lParam].wszName;
    pCDataSource->m_pwszProviderParseName = pCDataSource->m_rgProviderInfo[lParam].wszParseName;
  }

  // Show user the connection string
  if(fConnected)
  {
    //CONNECT_STRING
    wSetDlgItemText(m_hWnd, IDT_CONNECT, wsz_CONNECT_STRING_,
      pCDataSource->m_pwszProviderName,
      pCDataSource->m_pwszDataSource,
      pCDataSource->m_pwszDBMS,
      pCDataSource->m_pwszDBMSVer,
      pCDataSource->m_pwszProviderFileName,
      pCDataSource->m_pwszProviderVer);

    //TABLEHELPMSG
    //Display the Qualified TableName
    if(pCFromTable->m_TableInfo.wszTableName[0])
      wSetDlgItemText(m_hWnd, IDT_FROMTABLEHELP, wsz_FROMQUALTABLE_, pCFromTable->m_wszQualTableName, cSelColumns);
    else
      wSetDlgItemText(m_hWnd, IDT_FROMTABLEHELP, wsz_FROMTABLEHELP_, pCDataSource->m_pwszTableTerm);
  }
  else
  {
    //NO CONNECT_STRING
    wSetDlgItemText(m_hWnd, IDT_CONNECT, wsz_NOT_CONNECTED);
  }

  return TRUE;
}

BOOL CS1Dialog::ResetColInfo ( HWND hWndCol ) [virtual]

Definition at line 877 of file step1.cpp.

{
  HRESULT hr;
  CHAR  szBuffer[MAX_NAME_LEN];
  ULONG i;
  LONG    lFoundColumn;

  CTable* pCFromTable = m_pCTableCopy->m_pCFromTable;
  IOpenRowset* pIOpenRowset = pCFromTable->m_pCDataSource->m_pIOpenRowset;

  //Save the currently selected columns
  ULONG cSelColumns = pCFromTable->m_cColumns;
  COLDESC* rgSelColDesc = pCFromTable->m_rgColDesc;

  //Reset current Window Column ListView
  SendMessage(hWndCol, LVM_DELETEALLITEMS, (WPARAM)0, (LPARAM)0L);

  // Get a list of columns based on the selected table
  pCFromTable->m_cColumns = 0;
  pCFromTable->m_rgColDesc = NULL;
  QTESTC(hr = pCFromTable->GetColInfo(IDR_PARAM_SETS));

  //Loop through all columns and update window
  for(i=0; i<pCFromTable->m_cColumns; i++)
  {
    COLDESC* pColDesc = &pCFromTable->m_rgColDesc[i];

    //COLNAME (item)
    ConvertToMBCS(pColDesc->wszColName, szBuffer, MAX_NAME_LEN);
    LV_InsertItem(hWndCol, i, COL_COLNAME, szBuffer, 0, pColDesc->dwFlags & (DBCOLUMNFLAGS_WRITE | DBCOLUMNFLAGS_WRITEUNKNOWN) ? ((pColDesc->dwFlags & DBCOLUMNFLAGS_ISLONG) ? ICON_LONG : ICON_COLUMN) : ICON_READONLY);

    //COLTYPE (subitem)
    ConvertToMBCS(GetDBTypeName(pColDesc->wType), szBuffer, MAX_NAME_LEN);
    LV_InsertItem(hWndCol, i, COL_COLTYPE, szBuffer);

    //Ordinal (SubItem)
    sprintf(szBuffer, "%d", pColDesc->iOrdinal);
    LV_InsertItem(hWndCol, i, COL_COLORDINAL, szBuffer);

    //ColumnSize (SubItem)
    sprintf(szBuffer, "%d", pColDesc->ulColumnSize);
    LV_InsertItem(hWndCol, i, COL_COLSIZE, szBuffer);

    //Precision (SubItem)
    sprintf(szBuffer, "%d", pColDesc->bPrecision);
    LV_InsertItem(hWndCol, i, COL_COLPREC, szBuffer);

    //Scale (SubItem)
    sprintf(szBuffer, "%d", pColDesc->bScale);
    LV_InsertItem(hWndCol, i, COL_COLSCALE, szBuffer);

    //FLAGS (SubItem)
    LV_InsertItem(hWndCol, i, COL_COLISFIXED, pColDesc->dwFlags & DBCOLUMNFLAGS_ISFIXEDLENGTH ? "TRUE" : "FALSE");
    LV_InsertItem(hWndCol, i, COL_COLISLONG, pColDesc->dwFlags & DBCOLUMNFLAGS_ISLONG ? "TRUE" : "FALSE");
    LV_InsertItem(hWndCol, i, COL_COLISNULLABLE, pColDesc->dwFlags & DBCOLUMNFLAGS_ISNULLABLE ? "TRUE" : "FALSE");
    LV_InsertItem(hWndCol, i, COL_COLWRITE, pColDesc->dwFlags & (DBCOLUMNFLAGS_WRITE | DBCOLUMNFLAGS_WRITEUNKNOWN) ? "TRUE" : "FALSE");
    LV_InsertItem(hWndCol, i, COL_COLISROWID, pColDesc->dwFlags & DBCOLUMNFLAGS_ISROWID ? "TRUE" : "FALSE");
    LV_InsertItem(hWndCol, i, COL_COLISROWVER, pColDesc->dwFlags & DBCOLUMNFLAGS_ISROWVER ? "TRUE" : "FALSE");

  }

  // If there is an existing columns list (only on Back or error), then
  // the user already has a list so use it.
  lFoundColumn = -1;
  for(i=0; i<cSelColumns; i++)
  {
    //Find the Column Name in the Window List
    ConvertToMBCS(rgSelColDesc[i].wszColName, szBuffer, MAX_NAME_LEN);
    lFoundColumn = LV_FindItem(hWndCol, szBuffer, lFoundColumn);

    //Select the Column Name if found in the list, and bring into view
    if(lFoundColumn != LVM_ERR)
    {
      LV_SetItemState(hWndCol, lFoundColumn, COL_COLNAME, LVIS_SELECTED, LVIS_SELECTED);

      //Ensure that the first item is Visible
      if(i==0)
        SendMessage(hWndCol, LVM_ENSUREVISIBLE, (WPARAM)lFoundColumn, (LPARAM)FALSE);
    }
  }

  //Otherwise, just select all as default
  if(cSelColumns == 0)
  {
    for(i=0; i<pCFromTable->m_cColumns; i++)
      LV_SetItemState(hWndCol, i, COL_COLNAME, LVIS_SELECTED, LVIS_SELECTED);
  }

CLEANUP:
  SAFE_FREE(rgSelColDesc);
  return hr==S_OK;
}

BOOL CS1Dialog::ResetTableList | ( | HWND | hWndTable,
 |  | HWND | hWndCol |
 | ) |  |  | [virtual]

Definition at line 630 of file step1.cpp.

{
  HRESULT hr;
  CHAR      szBuffer[MAX_NAME_LEN];

  IRowset* pIRowset = NULL;
  IAccessor* pIAccessor = NULL;

  //get the data
  HROW* rghRows = NULL;
  ULONG i,cRowsObtained = 0;
  BOOL    bFound = FALSE;

  HACCESSOR hAccessor = DB_NULL_HACCESSOR;
  TREEINFO* rgTreeInfo = NULL;

  //Use the passed in Session interface
  CTable* pCFromTable = m_pCTableCopy->m_pCFromTable;
  CDataSource* pCFromDataSource = pCFromTable->m_pCDataSource;
  IOpenRowset* pIOpenRowset = pCFromTable->m_pCDataSource->m_pIOpenRowset;
  IDBSchemaRowset* pIDBSchemaRowset = pCFromTable->m_pCDataSource->m_pIDBSchemaRowset;

  //Delete all previous items
  SendMessage(hWndTable, TVM_DELETEITEM, (WPARAM)0, (LPARAM)TVI_ROOT);
  SendMessage(hWndCol, LVM_DELETEALLITEMS, (WPARAM)0, (LPARAM)0);

  // Bind the user and table name for the list
  const static ULONG cBindings = 4;
  const static DBBINDING rgBindings[cBindings] =
  {
    //TABLE_CATALOG
    1,
    offsetof(TABLEINFO, wszCatalogName),  // offset of value in consumers buffer
    0,                  // offset of length
    0,                  // offset of status
    NULL,               // reserved
    NULL,               // for ole object
    NULL,               // reserved
    DBPART_VALUE,           // specifies Value is bound only
    DBMEMOWNER_CLIENTOWNED,       // memory is client owned
    DBPARAMIO_NOTPARAM,         //
    MAX_NAME_LEN,           // size in bytes of the value part in the consumers buffer
    0,                  // reserved
    DBTYPE_WSTR,            // data type indicator
    0,                  // precision
    0,                  // scale

    //TABLE_SCHEMA
    2,
    offsetof(TABLEINFO, wszSchemaName), // offset of value in consumers buffer
    0,                  // offset of length
    0,                  // offset of status
    NULL,               // reserved
    NULL,               // for ole object
    NULL,               // reserved
    DBPART_VALUE,           // specifies Value is bound only
    DBMEMOWNER_CLIENTOWNED,       // memory is client owned
    DBPARAMIO_NOTPARAM,         //
    MAX_NAME_LEN,           // size in bytes of the value part in the consumers buffer
    0,                  // reserved
    DBTYPE_WSTR,            // data type indicator
    0,                  // precision
    0,                  // scale

    //TABLE_NAME
    3,                  // ordinal
    offsetof(TABLEINFO, wszTableName),    // offset of value in consumers buffer
    0,                  // offset of length in consumers buffer
    0,                  // offset of status in consumers buffer
    NULL,               // reserved
    NULL,               // for ole object
    NULL,               // reserved
    DBPART_VALUE,           // specifies Value only
    DBMEMOWNER_CLIENTOWNED,       // memory is client owned
    DBPARAMIO_NOTPARAM,         // input param
    MAX_NAME_LEN,           // size in bytes of the value part in the consumers buffer
    0,                  // reserved
    DBTYPE_WSTR,            // data type indicator
    0,                  // precision
    0,                  // scale

    //TABLE_TYPE
    4,                  // ordinal
    offsetof(TABLEINFO, wszType), // offset of value in consumers buffer
    0,                  // offset of length in consumers buffer
    0,                  // offset of status in consumers buffer
    NULL,               // reserved
    NULL,               // for ole object
    NULL,               // reserved
    DBPART_VALUE,           // specifies Value only
    DBMEMOWNER_CLIENTOWNED,       // memory is client owned
    DBPARAMIO_NOTPARAM,         // input param
    MAX_NAME_LEN,           // size in bytes of the value part in the consumers buffer
    0,                  // reserved
    DBTYPE_WSTR,            // data type indicator
    0,                  // precision
    0,                  // scale
    };

  //Reset TableInfo
  m_cTables = 0;
  SAFE_FREE(m_rgTableInfo);

  //Provider doesn't have to support IDBSchemaRowset
  if(pIDBSchemaRowset)
  {
    //GetRowset
    //DBSCHEMA_TABLES is required a SCHEMA (if IDBSchemaRowset is supported)
    XTESTC(hr = pIDBSchemaRowset->GetRowset(NULL, DBSCHEMA_TABLES, 0, NULL, IID_IRowset, 0, NULL,(IUnknown **)&pIRowset));

    //Create the Accessor
    XTESTC(hr = pIRowset->QueryInterface(IID_IAccessor, (void **)&pIAccessor));
    XTESTC(hr = pIAccessor->CreateAccessor(DBACCESSOR_ROWDATA, cBindings, rgBindings, 0, &hAccessor, NULL));

    //Grab all the rows
    while(TRUE)
    {
      XTESTC(hr = pIRowset->GetNextRows(NULL, 0, MAX_BLOCK_SIZE, &cRowsObtained, &rghRows));

      //ENDOFROWSET
      if(cRowsObtained==0)
        break;

      //Realloc Table struct for Table
      SAFE_REALLOC(m_rgTableInfo, TABLEINFO, m_cTables + cRowsObtained);
      memset(&m_rgTableInfo[m_cTables], 0, cRowsObtained*sizeof(TABLEINFO));

      //Loop over the rows retrived
      for(i=0; i<cRowsObtained; i++)
      {
        //Get the Data
        XTESTC(hr = pIRowset->GetData(rghRows[i], hAccessor, &m_rgTableInfo[m_cTables]));
        m_cTables++;
      }

      //Release the rows obtained
      XTESTC(hr = pIRowset->ReleaseRows(cRowsObtained, rghRows, NULL, NULL, NULL));
      SAFE_FREE(rghRows);
    }
  }

  //Provider doesn't have to support IDBSchemaRowset
  if(pIDBSchemaRowset == NULL)
  {
    m_cTables = 1;
    SAFE_ALLOC(m_rgTableInfo, TABLEINFO, 1);
    memset(m_rgTableInfo, 0, sizeof(TABLEINFO));

    if(pCFromTable->m_TableInfo.wszTableName[0])
    {
      //Just Display the TableName in the EditBox
      wcscpy(m_rgTableInfo[0].wszTableName, pCFromTable->m_TableInfo.wszTableName);
    }
    else
    {
      //Just Display "Enter - <TableTerm>"
      wcscpy(m_rgTableInfo[0].wszTableName, L"Enter - ");
      wcscat(m_rgTableInfo[0].wszTableName, pCFromDataSource->m_pwszTableTerm);
    }
  }

  //Create rgTreeInfo array
  SAFE_ALLOC(rgTreeInfo, TREEINFO, m_cTables);
  memset(rgTreeInfo, 0, m_cTables*sizeof(TREEINFO));

  //Create Tree Nodes for the TreeView control
  CreateTableNode(rgTreeInfo, offsetof(TABLEINFO, wszCatalogName), -1, ICON_CATALOG, ICON_CATALOG);
  CreateTableNode(rgTreeInfo, offsetof(TABLEINFO, wszSchemaName),  -1, ICON_SCHEMA, ICON_SCHEMA);
  CreateTableNode(rgTreeInfo, offsetof(TABLEINFO, wszType),    -1, ICON_TYPE, ICON_TYPE);

  //Now display all the tables
  for(i=0; i<m_cTables; i++)
  {
    //Add it to the TreeView
    ConvertToMBCS(m_rgTableInfo[i].wszTableName, szBuffer, MAX_NAME_LEN);

    if(wcscmp(m_rgTableInfo[i].wszType, L"TABLE")==0)
      rgTreeInfo[i].hItem = TV_InsertItem(hWndTable, rgTreeInfo[i].hParent, TVI_SORT, szBuffer, (LONG)i, ICON_TABLE, ICON_TABLE);
    else if(wcscmp(m_rgTableInfo[i].wszType, L"VIEW")==0)
      rgTreeInfo[i].hItem = TV_InsertItem(hWndTable, rgTreeInfo[i].hParent, TVI_SORT, szBuffer, (LONG)i, ICON_VIEW, ICON_VIEW);
    else if(wcscmp(m_rgTableInfo[i].wszType, L"SYSTEM TABLE")==0)
      rgTreeInfo[i].hItem = TV_InsertItem(hWndTable, rgTreeInfo[i].hParent, TVI_SORT, szBuffer, (LONG)i, ICON_SYSTABLE, ICON_SYSTABLE);
    else
      rgTreeInfo[i].hItem = TV_InsertItem(hWndTable, rgTreeInfo[i].hParent, TVI_SORT, szBuffer, (LONG)i, ICON_SYNONYM, ICON_SYNONYM);
  }

  // If there was a previous selection, select it again on Back
  bFound = FALSE;
    if(pCFromTable->m_TableInfo.wszTableName[0])
  {
    //Find the previously selected TableName
    //With TreeView controls there is no "Find" method as in ListView controls!
    //So we have to simulate our own find, by seraching for the TableName
    for(i=0; i<m_cTables; i++)
    {
      if(memcmp(&m_rgTableInfo[i], &pCFromTable->m_TableInfo, sizeof(TABLEINFO))==0)
      {
        bFound = TRUE;
        //Select Table in the TreeView control
        SendMessage(hWndTable, TVM_SELECTITEM, (WPARAM)TVGN_CARET, (LPARAM)rgTreeInfo[i].hItem);
        ResetColInfo(GetDlgItem(m_hWnd, IDL_COLUMNS));
        break;
      }
    }
  }

  if(!bFound)
  {
    //Reset TableInfo
    memset(&pCFromTable->m_TableInfo, 0, sizeof(TABLEINFO));

    //Otheriwse if there was no previous selection, default to auto expand
    //the "TABLE" type, or the first type in the tree
    bFound = FALSE;
    for(i=0; i<m_cTables; i++)
    {
      if(wcscmp(m_rgTableInfo[i].wszType, L"TABLE")==0)
      {
        bFound = TRUE;
        SendMessage(hWndTable, TVM_ENSUREVISIBLE, (WPARAM)0, (LPARAM)rgTreeInfo[i].hItem);
        break;
      }
    }

    if(!bFound && m_cTables)
      SendMessage(hWndTable, TVM_ENSUREVISIBLE, (WPARAM)0, (LPARAM)rgTreeInfo[0].hItem);
  }

CLEANUP:
  if(hAccessor && pIAccessor)
    XTEST(pIAccessor->ReleaseAccessor(hAccessor,NULL));

  SAFE_RELEASE(pIRowset);
  SAFE_RELEASE(pIAccessor);

  SAFE_FREE(rgTreeInfo);
  SAFE_FREE(rghRows);
  return hr==S_OK;
}

Member Data Documentation

ULONG CS1Dialog::m_cTables

Definition at line 104 of file wizard.h.

BOOL CS1Dialog::m_fEditing

Definition at line 102 of file wizard.h.

CTableCopy* CS1Dialog::m_pCTableCopy

Definition at line 101 of file wizard.h.

TABLEINFO* CS1Dialog::m_rgTableInfo

Definition at line 105 of file wizard.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/tablecopy/wizard.h
  • Dataaccess/oledb/tablecopy/step1.cpp
Generated on Wed Nov 13 2024 16:57:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CS2Dialog Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Public Attributes

CS2Dialog Class Reference

#include "wizard.h"

Inherits CDialogBase.

List of all members.

Public Member Functions

CS2Dialog (HWND hWnd, HINSTANCE hInst, CTableCopy *pTableCopy)
virtual | ~CS2Dialog ()
virtual ULONG | Display ()
virtual BOOL | GetPrimaryKeys ()
virtual BOOL | InitControls ()
virtual BOOL | RecordSelectedIndexes (HWND hWnd)
virtual BOOL | RefreshControls ()
virtual BOOL | ResetIndexList (HWND hWnd)

Static Public Member Functions

static BOOL WINAPI | DlgProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)

Public Attributes

CTableCopy * m_pCTableCopy

Detailed Description

Definition at line 113 of file wizard.h.

Constructor & Destructor Documentation

CS2Dialog::CS2Dialog | ( | HWND | hWnd,
 |  | HINSTANCE | hInst,
 |  | CTableCopy * | pTableCopy
 | ) |  |

Definition at line 50 of file step2.cpp.

  : CDialogBase(hWnd, hInst)
{
  ASSERT(pCTableCopy);
  m_pCTableCopy = pCTableCopy;
}

CS2Dialog::~CS2Dialog ( ) [virtual]

Definition at line 62 of file step2.cpp.

{
}

Member Function Documentation

ULONG CS2Dialog::Display ( ) [virtual]

Implements CDialogBase.

Definition at line 71 of file step2.cpp.

{
  //Create a modal dialog box
  return DialogBoxParam(m_hInst, MAKEINTRESOURCE(IDD_INDEX_INFO), NULL, DlgProc, (LPARAM)this);
}

BOOL WINAPI CS2Dialog::DlgProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 82 of file step2.cpp.

{
  switch(msg)
  {
    case WM_INITDIALOG:
    {
      Busy();
      //Store the "this" pointer, since this is a static method
      CS2Dialog* pThis = (CS2Dialog*)lParam;
      SetWindowLong(hWnd, GWL_USERDATA, (LONG)pThis);
      CTableCopy* pCTableCopy = pThis->m_pCTableCopy;
      CWizard* pCWizard = pCTableCopy->m_pCWizard;

      LONG iPrevStep = pCWizard->m_iPrevStep;

      //On INIT we know we have a valid hWnd to store
      CenterDialog(hWnd);
      pThis->m_hWnd = hWnd;

      pThis->InitControls();
      pThis->RefreshControls();

      pThis->ResetIndexList(GetDlgItem(hWnd, IDL_INDEXES));
      pCWizard->DestroyPrevStep(WIZ_STEP2);

      //No since in even displaying this Dialog if there
      //are no indexes...
      if(pCTableCopy->m_pCFromTable->m_cIndexes == 0)
        pCWizard->DisplayStep(iPrevStep==WIZ_STEP1 ? WIZ_STEP3 : WIZ_STEP1);

      return HANDLED_MSG;
    }

    case WM_COMMAND:
    {
      //Obtain the "this" pointer
      CS2Dialog* pThis = (CS2Dialog*)GetWindowLong(hWnd, GWL_USERDATA);

      // All buttons are handled the same way
      switch(GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDOK:
                case IDB_PREV:
          //Record all selected indexes
          Busy();
          pThis->RecordSelectedIndexes(GetDlgItem(hWnd, IDL_INDEXES));
          pThis->m_pCTableCopy->m_pCWizard->DisplayStep((GET_WM_COMMAND_ID(wParam, lParam) == IDOK) ? WIZ_STEP3 : WIZ_STEP1);
                  return HANDLED_MSG;

        case IDCANCEL:
          //Record all selected indexes
          Busy();
          EndDialog(hWnd, GET_WM_COMMAND_ID(wParam, lParam));
                  return HANDLED_MSG;
      }
    }
  }

  return UNHANDLED_MSG;
}

BOOL CS2Dialog::GetPrimaryKeys ( ) [virtual]

Definition at line 614 of file step2.cpp.

{
  HRESULT hr;

  HROW* rghRows = NULL;
  ULONG cRowsObtained = 0;
  IRowset* pIRowset = NULL;

  IAccessor* pIAccessor = NULL;
  HACCESSOR hAccessor = DB_NULL_HACCESSOR;

  PRIMARYKEY PrimaryKey;

  //Use the passed in Session interface
  CTable* pCFromTable = m_pCTableCopy->m_pCFromTable;
  IOpenRowset* pIOpenRowset = pCFromTable->m_pCDataSource->m_pIOpenRowset;
  IDBSchemaRowset* pIDBSchemaRowset = pCFromTable->m_pCDataSource->m_pIDBSchemaRowset;

  //Provider doesn't have to support IDBSchemaRowset
  if(pIDBSchemaRowset == NULL)
    return TRUE;

  // Bind the user and table name for the list
  const static ULONG cBindings = 1;
  const static DBBINDING rgBindings[cBindings] =
    {
      4,
      offsetof(PRIMARYKEY, wszColName),
      0,
      0,
      NULL,
      NULL,
      NULL,
      DBPART_VALUE,
      DBMEMOWNER_CLIENTOWNED,
      DBPARAMIO_NOTPARAM,
      MAX_NAME_LEN,
      0,
      DBTYPE_WSTR,
      0,
      0,
    };

  //set up the restrictions
  const ULONG cRestrictions = 3;
  VARIANT  rgRestrictions[cRestrictions];

  //set up the restrictions
  InitVariants(cRestrictions, rgRestrictions);
  SetRestriction(&rgRestrictions[0], pCFromTable->m_pCDataSource->m_pwszCatalog);
  SetRestriction(&rgRestrictions[1], pCFromTable->m_TableInfo.wszSchemaName);
  SetRestriction(&rgRestrictions[2], pCFromTable->m_TableInfo.wszTableName);

  //GetRowset
  //DBSCHEMA_PRIMARY_KEYS may not be supported by the driver.
  //If an error occurs, just don't display PrimaryKey info
  QTESTC(hr = pIDBSchemaRowset->GetRowset(NULL, DBSCHEMA_PRIMARY_KEYS, cRestrictions, rgRestrictions,
                    IID_IRowset, 0, NULL, (IUnknown **)&pIRowset));

  XTESTC(hr = pIRowset->QueryInterface(IID_IAccessor, (void **)&pIAccessor));

  //Create Accessor for IndexInfo
  XTESTC(hr = pIAccessor->CreateAccessor(DBACCESSOR_ROWDATA, cBindings, rgBindings, 0, &hAccessor, NULL));

  while(TRUE)
  {
    XTESTC(hr = pIRowset->GetNextRows(NULL, 0, MAX_BLOCK_SIZE, &cRowsObtained, &rghRows));

    //ENDOFROWSET
    if(cRowsObtained==0)
      break;

    for(ULONG i=0; i<cRowsObtained; i++)
    {
      //Reset the PrimaryKey
      memset(&PrimaryKey, 0, sizeof(PRIMARYKEY));

      //Get the Data
      XTESTC(hr = pIRowset->GetData(rghRows[i], hAccessor, (void*)&PrimaryKey));

      //Need to find the corresponding column in IndexInfo and
      //mark it as a primary key column
      for(ULONG iIndex=0; iIndex<pCFromTable->m_cIndexes; iIndex++)
        if(wcscmp(PrimaryKey.wszColName, pCFromTable->m_rgIndexInfo[iIndex].wszColName)==0)
          pCFromTable->m_rgIndexInfo[iIndex].fIsPrimaryKey = TRUE;

      //Need to find the corresponding column in m_rgColDesc and mark it as a primary key column
      for(i=0; i<pCFromTable->m_cColumns; i++)
        if(wcscmp(PrimaryKey.wszColName, pCFromTable->m_rgColDesc[i].wszColName)==0)
          pCFromTable->m_rgColDesc[i].fIsPrimaryKey = TRUE;
    }

    //Release all the rows
    XTESTC(hr = pIRowset->ReleaseRows(cRowsObtained, rghRows, NULL, NULL, NULL));
    SAFE_FREE(rghRows);
  }

CLEANUP:
  //Free Resriticions
  FreeVariants(cRestrictions, rgRestrictions);

  if(hAccessor && pIAccessor)
    XTEST(pIAccessor->ReleaseAccessor(hAccessor,NULL));

  SAFE_RELEASE(pIRowset);
  SAFE_RELEASE(pIAccessor);
  SAFE_FREE(rghRows);
  return hr==S_OK;
}

BOOL CS2Dialog::InitControls ( ) [virtual]

Definition at line 148 of file step2.cpp.

{
  HWND hWndIndexes = GetDlgItem(m_hWnd, IDL_INDEXES);

  //Create the Index ImageList
  HIMAGELIST hIndexImageList = ImageList_Create(16, 16, ILC_MASK, 1, 0 );

  //IDI_INDEX - normal index icon
  HICON hIcon = LoadIcon(m_hInst, MAKEINTRESOURCE(IDI_INDEX));
  ImageList_AddIcon(hIndexImageList, hIcon);
  //IDI_PRIMARYKEY - primary key index icon
  hIcon = LoadIcon(m_hInst, MAKEINTRESOURCE(IDI_PRIMARYKEY));
  ImageList_AddIcon(hIndexImageList, hIcon);

  //Set image list to the Table Window
  ListView_SetImageList(hWndIndexes, hIndexImageList, LVSIL_SMALL);

  //ListView COLUMNS
  LV_InsertColumn(hWndIndexes,  COL_INDEXNAME,    "Index");
  LV_InsertColumn(hWndIndexes,  COL_INDEXCOLNAME, "ColName");
  LV_InsertColumn(hWndIndexes,  COL_UNIQUE,     "Unique");
  LV_InsertColumn(hWndIndexes,  COL_PRIMARYKEY,   "PrimaryKey");
  LV_InsertColumn(hWndIndexes,  COL_COLLATION,    "Collation");
  LV_InsertColumn(hWndIndexes,  COL_AUTOUPDATE,   "AutoUpdate");
  LV_InsertColumn(hWndIndexes,  COL_NULLS,      "Nulls");

  //AutoSize all columns
  for(ULONG i=0; i<=COL_NULLS; i++)
    SendMessage(hWndIndexes, LVM_SETCOLUMNWIDTH, (WPARAM)i,   (LPARAM)LVSCW_AUTOSIZE_USEHEADER);

  //Use Extended ListView Styles!
  SendMessage(hWndIndexes, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE | LVS_EX_SUBITEMIMAGES, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE | LVS_EX_SUBITEMIMAGES);
  return TRUE;
}

BOOL CS2Dialog::RecordSelectedIndexes ( HWND hWnd ) [virtual]

Definition at line 730 of file step2.cpp.

{
  CTable* pCTable = m_pCTableCopy->m_pCFromTable;
  LONG i;

  // Get the count of selected items
  LONG cSelIndexes = SendMessage(hWnd, LVM_GETSELECTEDCOUNT, (WPARAM)0, (LPARAM)0);
  LONG iIndex = -1;

  //Loop over all the indexes
  pCTable->m_cIndexes = cSelIndexes;
  for(i=0; i<cSelIndexes; i++)
  {
    iIndex = SendMessage(hWnd, LVM_GETNEXTITEM, (WPARAM)iIndex, (LPARAM)LVNI_SELECTED);

    //"compact" the m_rgColDesc array to only the selected items
    if(iIndex != LVM_ERR)
      memmove(&pCTable->m_rgIndexInfo[i], &pCTable->m_rgIndexInfo[iIndex], sizeof(INDEXINFO));
  }

  return TRUE;
}

BOOL CS2Dialog::RefreshControls ( ) [virtual]

Definition at line 187 of file step2.cpp.

{
  BOOL fSchemas = m_pCTableCopy->m_pCFromTable->m_pCDataSource->m_pIDBSchemaRowset != NULL;

  //Display IndexWindow if there are on Schemas
  EnableWindow(GetDlgItem(m_hWnd, IDT_INDEXMSG),  fSchemas);
  EnableWindow(GetDlgItem(m_hWnd, IDL_INDEXES), fSchemas);
  return TRUE;
}

BOOL CS2Dialog::ResetIndexList ( HWND hWnd ) [virtual]

Definition at line 202 of file step2.cpp.

{
  HRESULT hr;
  CHAR  szBuffer[MAX_NAME_LEN*2];

  HROW* rghRows = NULL;
  ULONG i,cRowsObtained = 0;
  IRowset* pIRowset = NULL;

  IAccessor* pIAccessor = NULL;
  HACCESSOR hAccessor = DB_NULL_HACCESSOR;

  //Use the passed in Session interface
  CTable* pCFromTable = m_pCTableCopy->m_pCFromTable;
  IOpenRowset* pIOpenRowset = pCFromTable->m_pCDataSource->m_pIOpenRowset;
  IDBSchemaRowset* pIDBSchemaRowset = pCFromTable->m_pCDataSource->m_pIDBSchemaRowset;

  //Provider doesn't have to support IDBSchemaRowset
  if(pIDBSchemaRowset == NULL)
  {
    return TRUE;
  }

  //Save the currently selected indexes
  ULONG cSelIndexes = pCFromTable->m_cIndexes;
  INDEXINFO* rgSelIndexInfo = pCFromTable->m_rgIndexInfo;

  //Reset the current IndexInfo
  pCFromTable->m_cIndexes = 0;
  pCFromTable->m_rgIndexInfo = NULL;

  // Now make the call
  SendMessage(hWnd, LVM_DELETEALLITEMS, (WPARAM)0, (LPARAM)0);

  // Bind the user and table name for the list
  const static ULONG cBindings = 13;
  const static DBBINDING rgBindings[cBindings] =
    {
      //INDEX_NAME
      6,
      offsetof(INDEXINFO, wszIndexName),
      0,
      0,
      NULL,
      NULL,
      NULL,
      DBPART_VALUE,
      DBMEMOWNER_CLIENTOWNED,
      DBPARAMIO_NOTPARAM,
      MAX_NAME_LEN,
      0,
      DBTYPE_WSTR,
      0,
      0,

      //UNIQUE
      8,
      offsetof(INDEXINFO, fUnique),
      0,
      0,
      NULL,
      NULL,
      NULL,
      DBPART_VALUE,
      DBMEMOWNER_CLIENTOWNED,
      DBPARAMIO_NOTPARAM,
      sizeof(VARIANT_BOOL),
      0,
      DBTYPE_BOOL,
      0,
      0,

      //CLUSTERED
      9,
      offsetof(INDEXINFO, fClustered),
      0,
      0,
      NULL,
      NULL,
      NULL,
      DBPART_VALUE,
      DBMEMOWNER_CLIENTOWNED,
      DBPARAMIO_NOTPARAM,
      sizeof(VARIANT_BOOL),
      0,
      DBTYPE_BOOL,
      0,
      0,

      //TYPE
      10,
      offsetof(INDEXINFO, wType),
      0,
      0,
      NULL,
      NULL,
      NULL,
      DBPART_VALUE,
      DBMEMOWNER_CLIENTOWNED,
      DBPARAMIO_NOTPARAM,
      sizeof(DBTYPE),
      0,
      DBTYPE_UI2,
      0,
      0,

      //FILL_FACTOR
      11,
      offsetof(INDEXINFO, dwFillFactor),
      0,
      0,
      NULL,
      NULL,
      NULL,
      DBPART_VALUE,
      DBMEMOWNER_CLIENTOWNED,
      DBPARAMIO_NOTPARAM,
      sizeof(LONG),
      0,
      DBTYPE_I4,
      0,
      0,

      //INITIAL_SIZE
      12,
      offsetof(INDEXINFO, dwInitialSize),
      0,
      0,
      NULL,
      NULL,
      NULL,
      DBPART_VALUE,
      DBMEMOWNER_CLIENTOWNED,
      DBPARAMIO_NOTPARAM,
      sizeof(LONG),
      0,
      DBTYPE_I4,
      0,
      0,

      //NULLS
      13,
      offsetof(INDEXINFO, dwNulls),
      0,
      0,
      NULL,
      NULL,
      NULL,
      DBPART_VALUE,
      DBMEMOWNER_CLIENTOWNED,
      DBPARAMIO_NOTPARAM,
      sizeof(LONG),
      0,
      DBTYPE_I4,
      0,
      0,

      //SORT_BOOKMARKS
      14,
      offsetof(INDEXINFO, fSortBookmarks),
      0,
      0,
      NULL,
      NULL,
      NULL,
      DBPART_VALUE,
      DBMEMOWNER_CLIENTOWNED,
      DBPARAMIO_NOTPARAM,
      sizeof(VARIANT_BOOL),
      0,
      DBTYPE_BOOL,
      0,
      0,

      //AUTO_UPDATE
      15,
      offsetof(INDEXINFO, fAutoUpdate),
      0,
      0,
      NULL,
      NULL,
      NULL,
      DBPART_VALUE,
      DBMEMOWNER_CLIENTOWNED,
      DBPARAMIO_NOTPARAM,
      sizeof(VARIANT_BOOL),
      0,
      DBTYPE_BOOL,
      0,
      0,

      //NULL_COLLATION
      16,
      offsetof(INDEXINFO, dwNullCollation),
      0,
      0,
      NULL,
      NULL,
      NULL,
      DBPART_VALUE,
      DBMEMOWNER_CLIENTOWNED,
      DBPARAMIO_NOTPARAM,
      sizeof(LONG),
      0,
      DBTYPE_I4,
      0,
      0,

      //ORDINAL_POSITION
      17,
      offsetof(INDEXINFO, iOrdinal),
      0,
      0,
      NULL,
      NULL,
      NULL,
      DBPART_VALUE,
      DBMEMOWNER_CLIENTOWNED,
      DBPARAMIO_NOTPARAM,
      sizeof(ULONG),
      0,
      DBTYPE_UI4,
      0,
      0,

      //COLUMN_NAME
      18,
      offsetof(INDEXINFO, wszColName),
      0,
      0,
      NULL,
      NULL,
      NULL,
      DBPART_VALUE,
      DBMEMOWNER_CLIENTOWNED,
      DBPARAMIO_NOTPARAM,
      MAX_NAME_LEN,
      0,
      DBTYPE_WSTR,
      0,
      0,

      //COLLATION
      21,
      offsetof(INDEXINFO, dwCollation),
      0,
      0,
      NULL,
      NULL,
      NULL,
      DBPART_VALUE,
      DBMEMOWNER_CLIENTOWNED,
      DBPARAMIO_NOTPARAM,
      sizeof(DWORD),
      0,
      DBTYPE_I4,
      0,
      0,
    };

  //set up the restrictions
  const ULONG cRestrictions = 5;
  VARIANT  rgRestrictions[cRestrictions];

  //set up the restrictions
  InitVariants(cRestrictions, rgRestrictions);
  SetRestriction(&rgRestrictions[0], pCFromTable->m_pCDataSource->m_pwszCatalog);
  SetRestriction(&rgRestrictions[1], pCFromTable->m_TableInfo.wszSchemaName);
  SetRestriction(&rgRestrictions[4], pCFromTable->m_TableInfo.wszTableName);

  //GetRowset
  //DBSCHEMA_INDEXES may not be supported by the driver.
  //If an error occurs, just don't display IndexInfo
  QTESTC(hr = pIDBSchemaRowset->GetRowset(NULL, DBSCHEMA_INDEXES, cRestrictions, rgRestrictions,
                    IID_IRowset, 0, NULL, (IUnknown **)&pIRowset));

  XTESTC(hr = pIRowset->QueryInterface(IID_IAccessor, (void **)&pIAccessor));

  //Create Accessor for IndexInfo
  XTESTC(hr = pIAccessor->CreateAccessor(DBACCESSOR_ROWDATA, cBindings, rgBindings, 0, &hAccessor, NULL));

  while(TRUE)
  {
    XTESTC(hr = pIRowset->GetNextRows(NULL, 0, MAX_BLOCK_SIZE, &cRowsObtained, &rghRows));

    //ENDOFROWSET
    if(cRowsObtained==0)
      break;

    //Realloc Table struct for Indexes
    SAFE_REALLOC(pCFromTable->m_rgIndexInfo, INDEXINFO, pCFromTable->m_cIndexes + cRowsObtained);
    memset(&pCFromTable->m_rgIndexInfo[pCFromTable->m_cIndexes], 0, cRowsObtained*sizeof(INDEXINFO));

    //Loop over rows obtained
    for(ULONG i=0; i<cRowsObtained; i++)
    {
      INDEXINFO* pIndexInfo = &pCFromTable->m_rgIndexInfo[pCFromTable->m_cIndexes];

      //Get the Data
      XTESTC(hr = pIRowset->GetData(rghRows[i], hAccessor, (void*)pIndexInfo));

      //If this is an index the ordinal will be 1 based
      if(pIndexInfo->iOrdinal==0)
        continue;

      //Only list the index if the column was selected to be copied
      for(ULONG iCol=0; iCol<pCFromTable->m_cColumns; iCol++)
      {
        if(wcscmp(pCFromTable->m_rgColDesc[iCol].wszColName, pIndexInfo->wszColName)==0)
        {
          //Now that we have an actual index...
          pCFromTable->m_cIndexes++;
          break;
        }
      }

    }

    //Release all the rows
    XTESTC(hr = pIRowset->ReleaseRows(cRowsObtained, rghRows, NULL, NULL, NULL));
    SAFE_FREE(rghRows);
  }

  //GetPrimaryKey info
  //Since DBSCHEMA_INDEXES doesn't have to return PrimaryKey info correctly (NULL)
  //we will call DBSCHEMA_PRIMARYKEYS before displaying IndexInfo to make sure
  //which columns are really PrimaryKeys.
  GetPrimaryKeys();

  //Now list all indexes to the Index ListView window
  for(i=0; i<pCFromTable->m_cIndexes; i++)
  {
    INDEXINFO* pIndexInfo = &pCFromTable->m_rgIndexInfo[i];

    //INDEXNAME (item)
    ConvertToMBCS(pIndexInfo->wszIndexName, szBuffer, MAX_NAME_LEN);
    LV_InsertItem(hWnd, i, COL_INDEXNAME, szBuffer, 0, pIndexInfo->fIsPrimaryKey ? INDEXTYPE_PRIMARYKEY : INDEXTYPE_INDEX);

    //INDEXCOLNAME (subitem)
    ConvertToMBCS(pIndexInfo->wszColName, szBuffer, MAX_NAME_LEN);
    LV_InsertItem(hWnd, i, COL_INDEXCOLNAME, szBuffer);

    //FLAGS (subitem)
    LV_InsertItem(hWnd, i, COL_UNIQUE, pIndexInfo->fUnique ? "TRUE" : "FALSE");
    LV_InsertItem(hWnd, i, COL_PRIMARYKEY, pIndexInfo->fIsPrimaryKey ? "TRUE" : "FALSE");
    LV_InsertItem(hWnd, i, COL_AUTOUPDATE, pIndexInfo->fAutoUpdate ? "TRUE" : "FALSE");
    LV_InsertItem(hWnd, i, COL_COLLATION, (pIndexInfo->dwCollation == DB_COLLATION_ASC) ? "ASC" : (pIndexInfo->dwCollation == DB_COLLATION_DESC) ? "DESC" : "NULL");
    LV_InsertItem(hWnd, i, COL_NULLS, (pIndexInfo->dwNulls == DBPROPVAL_IN_DISALLOWNULL) ? "DISALLOWNULL" : (pIndexInfo->dwNulls == DBPROPVAL_IN_IGNORENULL) ? "IGNORENULL" : "IGNOREANYNULL");
  }

  // If there was a previous selection, select it again on Back
  if(rgSelIndexInfo)
  {
    LONG lFoundIndex = -1;
    for(i=0; i<cSelIndexes; i++)
    {
      //Find the "index" of the existing index
      ConvertToMBCS(rgSelIndexInfo[i].wszIndexName, szBuffer, MAX_NAME_LEN);
      lFoundIndex = LV_FindItem(hWnd, szBuffer, lFoundIndex);

        //If there was a selection, select it now
        if(lFoundIndex != LVM_ERR)
      {
        LV_SetItemState(hWnd, lFoundIndex, COL_INDEXNAME, LVIS_SELECTED, LVIS_SELECTED);

        //Ensure that the first item is visible
        if(i==0)
          SendMessage(hWnd, LVM_ENSUREVISIBLE, (WPARAM)lFoundIndex, (LPARAM)FALSE);
      }
    }

  }
  //Otherwise select all as default
  else
  {
    for(i=0; i<pCFromTable->m_cIndexes; i++)
      LV_SetItemState(hWnd, i, COL_INDEXNAME, LVIS_SELECTED, LVIS_SELECTED);
  }

  //Only enable the ListBox/Title if there are indexes
  EnableWindow(GetDlgItem(m_hWnd, IDT_INDEXMSG),  pCFromTable->m_cIndexes);
  EnableWindow(hWnd,  pCFromTable->m_cIndexes);

    //AutoSize Index/ColName
  if(pCFromTable->m_cIndexes)
  {
    SendMessage(hWnd, LVM_SETCOLUMNWIDTH, (WPARAM)COL_INDEXNAME, (LPARAM)LVSCW_AUTOSIZE);
    SendMessage(hWnd, LVM_SETCOLUMNWIDTH, (WPARAM)COL_INDEXCOLNAME, (LPARAM)LVSCW_AUTOSIZE);
  }

CLEANUP:
  //Free Resriticions
  FreeVariants(cRestrictions, rgRestrictions);

  if(hAccessor && pIAccessor)
    XTEST(pIAccessor->ReleaseAccessor(hAccessor,NULL));

  SAFE_RELEASE(pIRowset);
  SAFE_RELEASE(pIAccessor);
  SAFE_FREE(rghRows);
  SAFE_FREE(rgSelIndexInfo);
  return hr==S_OK;
}

Member Data Documentation

CTableCopy* CS2Dialog::m_pCTableCopy

Definition at line 134 of file wizard.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/tablecopy/wizard.h
  • Dataaccess/oledb/tablecopy/step2.cpp
Generated on Wed Nov 13 2024 16:57:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CS3Dialog Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Public Attributes

CS3Dialog Class Reference

#include "wizard.h"

Inherits CDialogBase.

List of all members.

Public Member Functions

CS3Dialog (HWND hWnd, HINSTANCE hInst, CTableCopy *pTableCopy)
virtual | ~CS3Dialog ()
virtual BOOL | Connect (CDataSource *pCDataSource=NULL)
virtual ULONG | Display ()
virtual BOOL | EnableTable ()
virtual BOOL | InitControls ()
virtual BOOL | RefreshControls ()

Static Public Member Functions

static BOOL WINAPI | DlgProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)

Public Attributes

CTableCopy * m_pCTableCopy

Detailed Description

Definition at line 143 of file wizard.h.

Constructor & Destructor Documentation

CS3Dialog::CS3Dialog | ( | HWND | hWnd,
 |  | HINSTANCE | hInst,
 |  | CTableCopy * | pTableCopy
 | ) |  |

Definition at line 27 of file step3.cpp.

  : CDialogBase(hWnd, hInst)
{
  ASSERT(pCTableCopy);
  m_pCTableCopy = pCTableCopy;
}

CS3Dialog::~CS3Dialog ( ) [virtual]

Definition at line 39 of file step3.cpp.

{
}

Member Function Documentation

BOOL CS3Dialog::Connect ( CDataSource * pCDataSource = NULL ) [virtual]

Definition at line 365 of file step3.cpp.

{
  CDataSource *pCToDataSource   = m_pCTableCopy->m_pCToTable->m_pCDataSource;
  CDataSource *pCFromDataSource = m_pCTableCopy->m_pCFromTable->m_pCDataSource;
  BOOL    fReturn       = FALSE;

  //Connect to the DataSource
  HRESULT hr = m_pCTableCopy->m_pCToTable->Connect(m_hWnd, pCDataSource);

  //If Connected
  if SUCCEEDED(hr)
  {
    // Verify we can use this data source
    // Just give a warning to the user, since the DataSource may actually
    // be updatable, but it is returning the wrong property value.
    if(pCToDataSource->m_fReadOnly)
    {
      wMessageBox(m_hWnd, MB_TASKMODAL | MB_ICONEXCLAMATION | MB_OK,  wsz_WARNING,
          wsz_READONLY_DATASOURCE_, pCToDataSource->m_pwszDataSource);
    }

    //See if this is a similar DSN than the Source
    //If DSN's are not similar, then we need to translate
    m_pCTableCopy->m_fTranslate = !pCToDataSource->IsSimilar(pCFromDataSource);
    fReturn = TRUE;
  }

  return TRUE;
}

ULONG CS3Dialog::Display ( ) [virtual]

Implements CDialogBase.

Definition at line 48 of file step3.cpp.

{
  //Create a modal dialog box
  return DialogBoxParam(m_hInst, MAKEINTRESOURCE(IDD_TO_INFO), NULL, DlgProc, (LPARAM)this);
}

BOOL WINAPI CS3Dialog::DlgProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 59 of file step3.cpp.

{
  static WCHAR  wszBuffer[MAX_NAME_LEN+1];

  switch(msg)
  {
    case WM_INITDIALOG:
    {
      Busy();
      //Store the "this" pointer, since this is a static method
      CS3Dialog* pThis = (CS3Dialog*)lParam;
      SetWindowLong(hWnd, GWL_USERDATA, (LONG)pThis);

      //On INIT we know we have a valid hWnd to store
      CenterDialog(hWnd);
      pThis->m_hWnd = hWnd;

      //Init all controls to the default values
      pThis->InitControls();

      //Limit the length of User Entered TableName
      SendDlgItemMessage(hWnd, IDE_TO_TABLE, EM_LIMITTEXT, (WPARAM)MAX_NAME_LEN-1, 0L);

      pThis->RefreshControls();
      pThis->m_pCTableCopy->m_pCWizard->DestroyPrevStep(WIZ_STEP3);
      return HANDLED_MSG;
    }

    case WM_COMMAND:
    {
      //Obtain the "this" pointer
      CS3Dialog* pThis = (CS3Dialog*)GetWindowLong(hWnd, GWL_USERDATA);

      CTable    *pCFromTable    = pThis->m_pCTableCopy->m_pCFromTable;
      CTable    *pCToTable      = pThis->m_pCTableCopy->m_pCToTable;
      CDataSource *pCToDataSource   = pCToTable->m_pCDataSource;
      CDataSource *pCFromDataSource = pCFromTable->m_pCDataSource;

      // All buttons are handled the same way
      switch(GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDB_TO_CONNECT:
        {
          //kill implicit connection
          pCToDataSource->Disconnect();

          //on connect get whatever is now listed in the drop down
          LONG iSel = 0;
          if((iSel = SendMessage(GetDlgItem(pThis->m_hWnd, IDC_PROVIDER_NAME), CB_GETCURSEL, 0, 0L)) != CB_ERR)
          {
            //Since we have the CBS_SORT turned on, the order in the Combo Box does
            //not match our array, so we pass the array index (lParam) as the item data
            LONG lParam = SendMessage(GetDlgItem(pThis->m_hWnd, IDC_PROVIDER_NAME), CB_GETITEMDATA, iSel, 0L);
            pCFromTable->m_pCDataSource->m_pwszProviderName = pCFromDataSource->m_rgProviderInfo[lParam].wszName;
/*            if((lParam < (LONG)pCToDataSource->m_cProviderInfo) && (wcscmp(pCFromDataSource->m_rgProviderInfo[lParam].wszName, pCFromDataSource->m_pwszProviderName)!=0))
            {
              //Clear Table/Column List Views
              SendMessage(GetDlgItem(hWnd, IDL_TABLES), TVM_DELETEITEM, (WPARAM)0, (LPARAM)TVI_ROOT);
              SendMessage(GetDlgItem(hWnd, IDL_COLUMNS), LVM_DELETEALLITEMS, (WPARAM)0, (LPARAM)0);

              //Clear Table info
              memset(&pCToTable->m_TableInfo, 0, sizeof(TABLEINFO));
              pCToTable->m_wszQualTableName[0] = EOL;

              //Disconnect from the DataSource and Update controls
              pCToTable->m_pCDataSource->Disconnect();
            }
*/          }
          else
          {
            //The user must have typed in a Provider Name directly
            //This may not map to a provider in the list, so assume the name is a ProgID/CLSID
            wSendMessage(GetDlgItem(pThis->m_hWnd, IDC_PROVIDER_NAME), WM_GETTEXT, MAX_NAME_LEN, wszBuffer);
            pCToTable->m_pCDataSource->m_pwszProviderName = wszBuffer;
          }
          Busy();
          if(pThis->Connect())
          {
            Busy();
            pThis->RefreshControls();
            SetFocus(GetDlgItem(hWnd, IDE_TO_TABLE));
            SendMessage(GetDlgItem(hWnd, IDE_TO_TABLE), EM_SETSEL, 0, -1); //Highlight TableName
          }
          return HANDLED_MSG;
        }

                case IDOK:
        {
          //Get the TableName
          Busy();
          wSendMessage(GetDlgItem(hWnd, IDE_TO_TABLE), WM_GETTEXT, MAX_NAME_LEN-1, pCToTable->m_TableInfo.wszTableName);

          //If the TableNames are the same (ignoring case) and the
          //DataSource is the same then the copy is worthless (a no-op)
          if(_wcsicmp(pCToTable->m_TableInfo.wszTableName, pCFromTable->m_TableInfo.wszTableName)==0 &&
            pCToDataSource->IsEqual(pCFromDataSource))
          {
            //Need to enter a different table name from the source
            wMessageBox(hWnd, MB_TASKMODAL | MB_ICONEXCLAMATION | MB_OK,
              wsz_ERROR, wsz_SAME_TABLE_NAME, pCToDataSource->m_pwszTableTerm);
            SetFocus(GetDlgItem(hWnd, IDE_TO_TABLE));
            SendMessage(GetDlgItem(hWnd, IDE_TO_TABLE), EM_SETSEL, 0, -1); //Highlight TableName
            return HANDLED_MSG;
          }

          wcscpy(pCToTable->m_wszQualTableName, pCToTable->m_TableInfo.wszTableName);
          pThis->m_pCTableCopy->m_pCWizard->DisplayStep(WIZ_STEP4);
          return HANDLED_MSG;
        }

                case IDB_PREV:
          //Get the TableName
          Busy();
          wSendMessage(GetDlgItem(hWnd, IDE_TO_TABLE), WM_GETTEXT, MAX_NAME_LEN-1, pCToTable->m_TableInfo.wszTableName);
          wcscpy(pCToTable->m_wszQualTableName,pCToTable->m_TableInfo.wszTableName);
          pThis->m_pCTableCopy->m_pCWizard->DisplayStep(WIZ_STEP2);
                  return HANDLED_MSG;

        case IDCANCEL:
          Busy();
                  EndDialog(hWnd, GET_WM_COMMAND_ID(wParam, lParam));
                  return HANDLED_MSG;
      }

      // Now look for notification messages
      switch(GET_WM_COMMAND_CMD(wParam, lParam))
      {
        case LBN_SELCHANGE:
        {
/*          //A Provider Change requires a refresh
          if(IDC_PROVIDER_NAME == GET_WM_COMMAND_ID(wParam, lParam))
          {
            //Get new selection
            Busy();
            LONG iSel = 0;
            if((iSel = SendMessage(GetDlgItem(pThis->m_hWnd, IDC_PROVIDER_NAME), CB_GETCURSEL, 0, 0L)) != CB_ERR)
            {
              //Since we have the CBS_SORT turned on, the order in the Combo Box does
              //not match our array, so we pass the array index (lParam) as the item data
              LONG lParam = SendMessage(GetDlgItem(pThis->m_hWnd, IDC_PROVIDER_NAME), CB_GETITEMDATA, iSel, 0L);
              if((lParam < (LONG)pCToDataSource->m_cProviderInfo) && (wcscmp(pCToDataSource->m_rgProviderInfo[lParam].wszName, pCToDataSource->m_pwszProviderName)!=0))
              {
                pCToDataSource->Disconnect();
              }
            }
          }

          pThis->RefreshControls();
*/        }

        case EN_CHANGE:
        {
          pThis->EnableTable();
          return HANDLED_MSG;
        }
      }
    }
  }

  return UNHANDLED_MSG;
}

BOOL CS3Dialog::EnableTable ( ) [virtual]

Definition at line 400 of file step3.cpp.

{
  BOOL fConnected = m_pCTableCopy->m_pCToTable->IsConnected();

  EnableWindow(GetDlgItem(m_hWnd, IDOK),
      fConnected && SendDlgItemMessage(m_hWnd, IDE_TO_TABLE, WM_GETTEXTLENGTH, 0, 0L));

  return TRUE;
}

BOOL CS3Dialog::InitControls ( ) [virtual]

Definition at line 228 of file step3.cpp.

{
  //Initialize the Provider List (if not done so already)
  CDataSource* pCDataSource = m_pCTableCopy->m_pCToTable->m_pCDataSource;
  CDataSource* pCFromDataSource = m_pCTableCopy->m_pCFromTable->m_pCDataSource;

  if(pCDataSource->m_rgProviderInfo == NULL)
    pCDataSource->GetProviders();

  WCHAR wszBuffer[MAX_NAME_LEN*2];
  HWND hWndProv = GetDlgItem(m_hWnd, IDC_PROVIDER_NAME);

  //Fill out the provider name combo box.
  for(ULONG i=0; i<pCDataSource->m_cProviderInfo; i++)
  {
    //Add the name to the list
    //Since we have the CBS_SORT turned on, the order in the Combo Box does
    //not match our array, so we pass the array index (lParam) as the item data
    swprintf(wszBuffer, wsz_PROVIDER_INFO_, pCDataSource->m_rgProviderInfo[i].wszName);
    LONG iIndex = wSendMessage(hWndProv, CB_ADDSTRING, (WPARAM)0, wszBuffer);
    SendMessage(hWndProv, CB_SETITEMDATA, (WPARAM)iIndex, (LPARAM)i);
  }

  //By default, it selects the same provider chossen in Step1
  if(pCDataSource->m_pwszProviderName == NULL)
    pCDataSource->m_pwszProviderName = pCFromDataSource->m_pwszProviderName;

  //Try and select the previous selected Provider
  if(CB_ERR == wSendMessage(hWndProv, CB_SELECTSTRING, 0, pCDataSource->m_pwszProviderName))
  {
    //If not found, just select the first one
    SendMessage(hWndProv, CB_SETCURSEL, 0, 0);
  }

  //By default, try and Connect to the same DataSource as in Step1
  //if using the same provider as in Step1
  if(!m_pCTableCopy->m_pCToTable->IsConnected() && wcscmp(pCDataSource->m_pwszProviderName, pCFromDataSource->m_pwszProviderName)==0)
  {
    //The Provider must support more than 1 active session as well to do
    //this functionality by default...
    if(pCFromDataSource->m_ulActiveSessions==0 || pCFromDataSource->m_ulActiveSessions>=2)
      Connect(pCFromDataSource);
  }

  // Enable Connect button only if there are providers installed.
  EnableWindow(GetDlgItem(m_hWnd, IDB_FROM_CONNECT), SendMessage(hWndProv, CB_GETCURSEL, 0, 0L) != CB_ERR);

  // Set the "Source" info
  //CONNECT_STRING
  wSetDlgItemText(m_hWnd, IDT_FROM_CONNECT, wsz_CONNECT_STRING_,
    pCFromDataSource->m_pwszProviderName,
    pCFromDataSource->m_pwszDataSource,
    pCFromDataSource->m_pwszDBMS,
    pCFromDataSource->m_pwszDBMSVer,
    pCFromDataSource->m_pwszProviderFileName,
    pCFromDataSource->m_pwszProviderVer);

  //TABLE
  wSetDlgItemText(m_hWnd, IDE_FROM_TABLE, m_pCTableCopy->m_pCFromTable->m_wszQualTableName);
  return TRUE;
}

BOOL CS3Dialog::RefreshControls ( ) [virtual]

Definition at line 295 of file step3.cpp.

{
  BOOL    fConnected;

  CTable* pCToTable = m_pCTableCopy->m_pCToTable;
  CTable* pCFromTable = m_pCTableCopy->m_pCFromTable;
  CDataSource* pCDataSource = pCToTable->m_pCDataSource;

  // Must have a connection to edit other controls
  fConnected = pCToTable->IsConnected();

  //Enable certain dialog controls, only if connected
  EnableWindow(GetDlgItem(m_hWnd, IDE_TO_TABLE),    fConnected);
  EnableWindow(GetDlgItem(m_hWnd, IDT_TARGET),    fConnected);
  EnableWindow(GetDlgItem(m_hWnd, IDT_TOTABLEHELP), fConnected);

  //Store the selected ProviderName and ProviderDesc
  LONG iSel = 0;
  if((iSel = SendMessage(GetDlgItem(m_hWnd, IDC_PROVIDER_NAME), CB_GETCURSEL, 0, 0L)) != CB_ERR)
  {
    //Since we have the CBS_SORT turned on, the order in the Combo Box does
    //not match our array, so we pass the array index (lParam) as the item data
    LONG lParam = SendMessage(GetDlgItem(m_hWnd, IDC_PROVIDER_NAME), CB_GETITEMDATA, iSel, 0L);
    ASSERT(lParam < (LONG)pCDataSource->m_cProviderInfo);
    pCDataSource->m_pwszProviderName = pCDataSource->m_rgProviderInfo[lParam].wszName;
    pCDataSource->m_pwszProviderParseName = pCDataSource->m_rgProviderInfo[lParam].wszParseName;
  }

  // Show user the connection string, and enable Next that requires connection
  if(fConnected)
  {
    //CONNECTSTATUS
    SetDlgItemText(m_hWnd, IDT_CONNECTSTATUS, "");

    //CONNECT_STRING
    wSetDlgItemText(m_hWnd, IDT_TO_CONNECT, wsz_CONNECT_STRING_,
      pCDataSource->m_pwszProviderName,
      pCDataSource->m_pwszDataSource,
      pCDataSource->m_pwszDBMS,
      pCDataSource->m_pwszDBMSVer,
      pCDataSource->m_pwszProviderFileName,
      pCDataSource->m_pwszProviderVer);

    //TABLEHELPMSG
    wSetDlgItemText(m_hWnd, IDT_TOTABLEHELP, wsz_TOTABLEHELP_,
      pCDataSource->m_pwszTableTerm);
  }
  else
  {
    //CONNECTSTATUS
    wSetDlgItemText(m_hWnd, IDT_CONNECTSTATUS, wsz_NOT_CONNECTED);

    //CONNECT_STRING
    wSetDlgItemText(m_hWnd, IDT_TO_CONNECT, L"");
  }

  // If there is already a Table from previous selections, just use that one
  wSetDlgItemText(m_hWnd, IDE_TO_TABLE, pCToTable->m_TableInfo.wszTableName[0] ? pCToTable->m_TableInfo.wszTableName : pCFromTable->m_TableInfo.wszTableName);

  // Determine if there is enough information to move on
  return EnableTable();
}

Member Data Documentation

CTableCopy* CS3Dialog::m_pCTableCopy

Definition at line 162 of file wizard.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/tablecopy/wizard.h
  • Dataaccess/oledb/tablecopy/step3.cpp
Generated on Wed Nov 13 2024 16:57:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CS4Dialog Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Public Attributes

CS4Dialog Class Reference

#include "wizard.h"

Inherits CDialogBase.

List of all members.

Public Member Functions

CS4Dialog (HWND hWnd, HINSTANCE hInst, CTableCopy *pTableCopy)
virtual | ~CS4Dialog ()
virtual ULONG | Display ()
virtual BOOL | InitControls ()
virtual BOOL | RefreshControls ()

Static Public Member Functions

static BOOL WINAPI | DlgProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)

Public Attributes

CTableCopy * m_pCTableCopy

Detailed Description

Definition at line 170 of file wizard.h.

Constructor & Destructor Documentation

CS4Dialog::CS4Dialog | ( | HWND | hWnd,
 |  | HINSTANCE | hInst,
 |  | CTableCopy * | pTableCopy
 | ) |  |

Definition at line 56 of file step4.cpp.

  : CDialogBase(hWnd, hInst)
{
  ASSERT(pCTableCopy);
  m_pCTableCopy = pCTableCopy;
}

CS4Dialog::~CS4Dialog ( ) [virtual]

Definition at line 68 of file step4.cpp.

{
}

Member Function Documentation

ULONG CS4Dialog::Display ( ) [virtual]

Implements CDialogBase.

Definition at line 77 of file step4.cpp.

{
  return DialogBoxParam(m_hInst, MAKEINTRESOURCE(IDD_OPTIONS), NULL, DlgProc, (LPARAM)this);
}

BOOL WINAPI CS4Dialog::DlgProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 87 of file step4.cpp.

{
  switch(msg)
  {
    case WM_INITDIALOG:
    {
      Busy();
      //Store the "this" pointer, since this is a static method
      CS4Dialog* pThis = (CS4Dialog*)lParam;
      SetWindowLong(hWnd, GWL_USERDATA, (LONG)pThis);

      //On INIT we know we have a valid hWnd to store
      pThis->m_hWnd = hWnd;

      pThis->InitControls();
      CenterDialog(hWnd);
      pThis->m_pCTableCopy->m_pCWizard->DestroyPrevStep(WIZ_STEP4);
      return HANDLED_MSG;
    }

    case WM_COMMAND:
    {
      //Obtain the "this" pointer
      CS4Dialog* pThis = (CS4Dialog*)GetWindowLong(hWnd, GWL_USERDATA);

      // All buttons are handled the same way
      switch(GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDX_COPY_TABLE:
        case IDX_COPY_INDEXES:
        case IDX_SHOW_SQL:

        case IDR_ALL_ROWS:
        case IDR_ROW_COUNT:
        case IDR_PARAM_SETS:
        case IDR_INSERTROW_IMMEDIATE:
        case IDR_INSERTROW_BUFFERED:
        case IDR_BLOB_SIZE:
        case IDR_ISEQ_STREAM:
          Busy();
          pThis->RefreshControls();
          return HANDLED_MSG;

        case IDOK:
          Busy();
          if(!pThis->RefreshControls())
            return HANDLED_MSG;

          pThis->m_pCTableCopy->m_pCWizard->DisplayStep(WIZ_TYPES);
                  return HANDLED_MSG;

        case IDB_PREV:
          Busy();
          if(!pThis->RefreshControls())
            return HANDLED_MSG;

          pThis->m_pCTableCopy->m_pCWizard->DisplayStep(WIZ_STEP3);
                  return HANDLED_MSG;

        case IDCANCEL:
          Busy();
                  EndDialog(hWnd, GET_WM_COMMAND_ID(wParam, lParam));
                  return HANDLED_MSG;
      }
    }
  }

  return UNHANDLED_MSG;
}

BOOL CS4Dialog::InitControls ( ) [virtual]

Definition at line 163 of file step4.cpp.

{
  CDataSource* pCToDataSource = m_pCTableCopy->m_pCToTable->m_pCDataSource;

  //IDX_COPY_TABLE (default-checked)
  EnableWindow(GetDlgItem(m_hWnd, IDX_COPY_TABLE), pCToDataSource->m_pICommandText || pCToDataSource->m_pITableDefinition);
  CheckDlgButton(m_hWnd, IDX_COPY_TABLE, m_pCTableCopy->m_fCopyTables);
  wSetDlgItemText(m_hWnd, IDX_COPY_TABLE, pCToDataSource->m_pwszTableTerm);

  //IDX_COPY_INDEXES (default-checked)
  EnableWindow(GetDlgItem(m_hWnd, IDX_COPY_INDEXES), pCToDataSource->m_pICommandText || pCToDataSource->m_pIIndexDefinition);
  CheckDlgButton(m_hWnd, IDX_COPY_INDEXES, m_pCTableCopy->m_fCopyIndexes);

  //IDX_COPY_PRIMARYKEYS (default-checked)
  EnableWindow(GetDlgItem(m_hWnd, IDX_COPY_PRIMARYKEYS), pCToDataSource->m_fPrimaryKeysSupported);
  CheckDlgButton(m_hWnd, IDX_COPY_PRIMARYKEYS, m_pCTableCopy->m_fCopyPrimaryKeys);

  //IDX_SHOW_SQL (checked)
  EnableWindow(GetDlgItem(m_hWnd, IDX_SHOW_SQL), pCToDataSource->m_pICommandText != NULL);
  CheckDlgButton(m_hWnd, IDX_SHOW_SQL, m_pCTableCopy->m_fShowQuery);

  //IDR_ALL_ROWS (default)
  //IDR_MAX_ROWS
  CheckRadioButton(m_hWnd, IDR_ALL_ROWS, IDR_ROW_COUNT, m_pCTableCopy->m_dwRowOpt);
  wSetDlgItemText(m_hWnd, IDE_ROW_COUNT, L"%lu", m_pCTableCopy->m_ulMaxRows);

  //IDR_PARAM_SETS (default)
  //If multiple param sets are not supported by this driver, select only 1 set
  if(!pCToDataSource->m_fMultipleParamSets)
    m_pCTableCopy->m_ulParamSets = 1;
  if (pCToDataSource->m_pICommandText == NULL)
  {
    m_pCTableCopy->m_dwInsertOpt = IDR_INSERTROW_IMMEDIATE;
    EnableWindow(GetDlgItem(m_hWnd, IDR_PARAM_SETS), FALSE);
  }
  CheckRadioButton(m_hWnd, IDR_PARAM_SETS, IDR_INSERTROW_BUFFERED, m_pCTableCopy->m_dwInsertOpt);
  wSetDlgItemText(m_hWnd, IDE_PARAM_SETS, L"%lu", m_pCTableCopy->m_ulParamSets);

  //Enable IDR_INSERTROW_IMMEDIATE radio button if supported by the provider
  EnableWindow(GetDlgItem(m_hWnd, IDR_INSERTROW_IMMEDIATE), pCToDataSource->m_fIRowsetChange);

  //Enable IDR_INSERTROW_BUFFERED radio button if supported by the provider
  EnableWindow(GetDlgItem(m_hWnd, IDR_INSERTROW_BUFFERED), pCToDataSource->m_fIRowsetUpdate);

  //IDR_BLOB_SIZE (default)
  //IDR_ISEQ_STREAM
  EnableWindow(GetDlgItem(m_hWnd, IDR_ISEQ_STREAM), pCToDataSource->m_dwStorageObjects & DBPROPVAL_SS_ISEQUENTIALSTREAM);
  CheckRadioButton(m_hWnd, IDR_BLOB_SIZE, IDR_ISEQ_STREAM, m_pCTableCopy->m_dwBlobOpt);
  wSetDlgItemText(m_hWnd, IDE_BLOB_SIZE, L"%lu", m_pCTableCopy->m_ulBlobSize);

  //Limit the TextLength of the Edit Controls to 10 chars
  SendDlgItemMessage(m_hWnd, IDE_ROW_COUNT, EM_LIMITTEXT, (WPARAM)10, 0L);
  SendDlgItemMessage(m_hWnd, IDE_PARAM_SETS, EM_LIMITTEXT, (WPARAM)10, 0L);
  SendDlgItemMessage(m_hWnd, IDE_BLOB_SIZE, EM_LIMITTEXT, (WPARAM)10, 0L);

  //Only allow "NEXT" button if Some form of INSERT is supported
  EnableWindow(GetDlgItem(m_hWnd, IDOK), pCToDataSource->m_pICommandText || pCToDataSource->m_pITableDefinition);

  // Refresh the controls
  RefreshControls();
  return TRUE;
}

BOOL CS4Dialog::RefreshControls ( ) [virtual]

Definition at line 232 of file step4.cpp.

{
  // IDE_ROW_COUNT Get the Copy options first so we can check the row count if given.
  if(IsDlgButtonChecked(m_hWnd, IDR_ROW_COUNT))
  {
    m_pCTableCopy->m_dwRowOpt = IDR_ROW_COUNT;
    EnableWindow(GetDlgItem(m_hWnd, IDE_ROW_COUNT), TRUE);
  }
  else
  {
    m_pCTableCopy->m_dwRowOpt = IDR_ALL_ROWS;
    EnableWindow(GetDlgItem(m_hWnd, IDE_ROW_COUNT), FALSE);
  }

  //Verify IDE_ROW_COUNT has legal value
  if(!GetEditBoxValue(GetDlgItem(m_hWnd, IDE_ROW_COUNT), 1, LONG_MAX, &m_pCTableCopy->m_ulMaxRows))
    return FALSE;

  //IDE_PARAM_SETS Get the Insert ParamSets options
  if(IsDlgButtonChecked(m_hWnd, IDR_PARAM_SETS))
  {
    m_pCTableCopy->m_dwInsertOpt = IDR_PARAM_SETS;
    EnableWindow(GetDlgItem(m_hWnd, IDE_PARAM_SETS), m_pCTableCopy->m_pCToTable->m_pCDataSource->m_fMultipleParamSets);
  }
  else if(IsDlgButtonChecked(m_hWnd, IDR_INSERTROW_IMMEDIATE))
  {
    //IDR_INSERTROW_IMMEDIATE
    m_pCTableCopy->m_dwInsertOpt = IDR_INSERTROW_IMMEDIATE;
    EnableWindow(GetDlgItem(m_hWnd, IDE_PARAM_SETS), FALSE);
  }
  else
  {
    //IDR_INSERTROW_IMMEDIATE
    m_pCTableCopy->m_dwInsertOpt = IDR_INSERTROW_BUFFERED;
    EnableWindow(GetDlgItem(m_hWnd, IDE_PARAM_SETS), FALSE);
  }

  //Verify IDE_PARAM_SETS has legal value
  if(!GetEditBoxValue(GetDlgItem(m_hWnd, IDE_PARAM_SETS), 1, LONG_MAX, &m_pCTableCopy->m_ulParamSets))
    return FALSE;

  //IDE_BLOB_SIZE Get the Insert ParamSets options
  if(IsDlgButtonChecked(m_hWnd, IDR_BLOB_SIZE))
  {
    m_pCTableCopy->m_dwBlobOpt = IDR_BLOB_SIZE;
    EnableWindow(GetDlgItem(m_hWnd, IDE_BLOB_SIZE), TRUE);
  }
  else
  {
    m_pCTableCopy->m_dwBlobOpt = IDR_ISEQ_STREAM;
    EnableWindow(GetDlgItem(m_hWnd, IDE_BLOB_SIZE), FALSE);
  }

  //Verify IDE_BLOB_SIZE has legal value
  if(!GetEditBoxValue(GetDlgItem(m_hWnd, IDE_BLOB_SIZE), 1, MAX_COL_SIZE, &m_pCTableCopy->m_ulBlobSize))
    return FALSE;

  // Get Create options
  m_pCTableCopy->m_fCopyTables = IsDlgButtonChecked(m_hWnd, IDX_COPY_TABLE);
  m_pCTableCopy->m_fCopyIndexes = IsDlgButtonChecked(m_hWnd, IDX_COPY_INDEXES);
  m_pCTableCopy->m_fCopyPrimaryKeys = IsDlgButtonChecked(m_hWnd, IDX_COPY_PRIMARYKEYS);

  // Set other Options
  m_pCTableCopy->m_fShowQuery = IsDlgButtonChecked(m_hWnd, IDX_SHOW_SQL);
  return TRUE;
}

Member Data Documentation

CTableCopy* CS4Dialog::m_pCTableCopy

Definition at line 186 of file wizard.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/tablecopy/wizard.h
  • Dataaccess/oledb/tablecopy/step4.cpp
Generated on Wed Nov 13 2024 16:57:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSAFEARRAY Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CSAFEARRAY Class Reference

List of all members.

Public Member Functions

CSAFEARRAY (VARTYPE v, int nSize)
CSAFEARRAY (VARTYPE v, int nSize)
CSAFEARRAY (SAFEARRAY *pSrc)
CSAFEARRAY (SAFEARRAY *pSrc)
~CSAFEARRAY ()
~CSAFEARRAY ()
HRESULT | Access (void **pData)
HRESULT | Access (void **pData)
HRESULT | Get (long nLocation, LPVOID pData)
HRESULT | Get (long nLocation, LPVOID pData)
long | GetNumElements ()
long | GetNumElements ()
operator SAFEARRAY * ()
operator SAFEARRAY * ()
HRESULT | Put (long nLocation, LPVOID pData)
HRESULT | Put (long nLocation, LPVOID pData)
HRESULT | Unaccess ()
HRESULT | Unaccess ()
void | Unbind ()
void | Unbind ()

Private Attributes

SAFEARRAY * | p

Detailed Description

Definition at line 93 of file OaHelp.Inl.

Constructor & Destructor Documentation

CSAFEARRAY::CSAFEARRAY | ( | VARTYPE | v,
 |  | int | nSize |
 | ) |  |  | [inline]

Definition at line 97 of file OaHelp.Inl.

    {
        SAFEARRAYBOUND rgsabound[1];
      rgsabound[0].lLbound = 0;
      rgsabound[0].cElements = nSize;
        p = SafeArrayCreate(v, 1, rgsabound);
    }

CSAFEARRAY::~CSAFEARRAY ( ) [inline]

Definition at line 105 of file OaHelp.Inl.

{ if (p) SafeArrayDestroy(p); }

CSAFEARRAY::CSAFEARRAY ( SAFEARRAY * pSrc ) [inline]

Definition at line 106 of file OaHelp.Inl.

{ p = pSrc; }

CSAFEARRAY::CSAFEARRAY | ( | VARTYPE | v,
 |  | int | nSize |
 | ) |  |  | [inline]

Definition at line 95 of file OaHelp.Inl.

    {
        SAFEARRAYBOUND rgsabound[1];
      rgsabound[0].lLbound = 0;
      rgsabound[0].cElements = nSize;
        p = SafeArrayCreate(v, 1, rgsabound);
    }

CSAFEARRAY::~CSAFEARRAY ( ) [inline]

Definition at line 103 of file OaHelp.Inl.

{ if (p) SafeArrayDestroy(p); }

CSAFEARRAY::CSAFEARRAY ( SAFEARRAY * pSrc ) [inline]

Definition at line 104 of file OaHelp.Inl.

{ p = pSrc; }

Member Function Documentation

HRESULT CSAFEARRAY::Access ( void ** pData ) [inline]

Definition at line 116 of file OaHelp.Inl.

{ return SafeArrayAccessData(p, pData); }

HRESULT CSAFEARRAY::Access ( void ** pData ) [inline]

Definition at line 114 of file OaHelp.Inl.

{ return SafeArrayAccessData(p, pData); }

HRESULT CSAFEARRAY::Get | ( | long | nLocation,
 |  | LPVOID | pData |
 | ) |  |  | [inline]

Definition at line 110 of file OaHelp.Inl.

                                              {
        return SafeArrayGetElement(p, &nLocation, pData);
    }

HRESULT CSAFEARRAY::Get | ( | long | nLocation,
 |  | LPVOID | pData |
 | ) |  |  | [inline]

Definition at line 112 of file OaHelp.Inl.

                                              {
        return SafeArrayGetElement(p, &nLocation, pData);
    }

long CSAFEARRAY::GetNumElements ( ) [inline]

Definition at line 118 of file OaHelp.Inl.

{ long upper; SafeArrayGetUBound(p, 1, &upper); return upper + 1; }

long CSAFEARRAY::GetNumElements ( ) [inline]

Definition at line 120 of file OaHelp.Inl.

{ long upper; SafeArrayGetUBound(p, 1, &upper); return upper + 1; }

CSAFEARRAY::operator SAFEARRAY * ( ) [inline]

Definition at line 119 of file OaHelp.Inl.

{ return p; }

CSAFEARRAY::operator SAFEARRAY * ( ) [inline]

Definition at line 117 of file OaHelp.Inl.

{ return p; }

HRESULT CSAFEARRAY::Put | ( | long | nLocation,
 |  | LPVOID | pData |
 | ) |  |  | [inline]

Definition at line 106 of file OaHelp.Inl.

                                              {
        return SafeArrayPutElement(p, &nLocation, pData);
    }

HRESULT CSAFEARRAY::Put | ( | long | nLocation,
 |  | LPVOID | pData |
 | ) |  |  | [inline]

Definition at line 108 of file OaHelp.Inl.

                                              {
        return SafeArrayPutElement(p, &nLocation, pData);
    }

HRESULT CSAFEARRAY::Unaccess ( ) [inline]

Definition at line 115 of file OaHelp.Inl.

{ return SafeArrayUnaccessData(p); }

HRESULT CSAFEARRAY::Unaccess ( ) [inline]

Definition at line 117 of file OaHelp.Inl.

{ return SafeArrayUnaccessData(p); }

void CSAFEARRAY::Unbind ( ) [inline]

Definition at line 120 of file OaHelp.Inl.

{ p = 0; }

void CSAFEARRAY::Unbind ( ) [inline]

Definition at line 122 of file OaHelp.Inl.

{ p = 0; }

Member Data Documentation

SAFEARRAY * CSAFEARRAY::p [private]

Definition at line 95 of file OaHelp.Inl.

The documentation for this class was generated from the following files:
  • SysMgmt/WMI/VC/EventProvider/OaHelp.Inl
  • SysMgmt/WMI/VC/TempConsumer/OaHelp.Inl
Generated on Wed Nov 13 2024 16:57:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSafeRefCount Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CSafeRefCount Class Reference

#include "Stablize.h"

Inherited by CSimpleApp, CSimpleApp, CSimpleDoc, CSimpleDoc, CSimpleSite, CSimpSvrApp, and CSimpSvrDoc.

List of all members.

Public Member Functions

CSafeRefCount ()
virtual ~CSafeRefCount ()
ULONG DecrementNestCount ()
ULONG IncrementNestCount ()
ULONG SafeAddRef ()
ULONG SafeRelease ()

Private Attributes

ULONG m_cNest
ULONG m_cRefs
BOOL m_fInDelete

Detailed Description

Definition at line 39 of file Stablize.h.

Constructor & Destructor Documentation

CSafeRefCount::CSafeRefCount ( )

Definition at line 35 of file Stablize.Cxx.

{
        m_cRefs = 0;
        m_cNest = 0;
        m_fInDelete = FALSE;
}

CSafeRefCount::~CSafeRefCount ( ) [virtual]

Definition at line 52 of file Stablize.Cxx.

{
        assert(m_cRefs == 0 && m_cNest == 0 && m_fInDelete == TRUE);
}

Member Function Documentation

ULONG CSafeRefCount::DecrementNestCount ( )

Definition at line 180 of file Stablize.Cxx.

{
        ULONG   cNest;

        if( m_cNest > 0 )
        {
                cNest = --m_cNest;

                if( m_cRefs == 0 && m_cNest == 0 && m_fInDelete == FALSE )
                {
                        m_fInDelete = TRUE;
                        delete this;
                }
        }
        else
        {
                // somebody forget to increment the nest count!!
                assert(NULL == "Unbalanced nest count!!");
                cNest = 0;
        }
        return cNest;
}

ULONG CSafeRefCount::IncrementNestCount ( )

Definition at line 149 of file Stablize.Cxx.

{
        m_cNest++;
        return m_cNest;
}

ULONG CSafeRefCount::SafeAddRef ( )

Definition at line 71 of file Stablize.Cxx.

{
        m_cRefs++;
        return m_cRefs;
}

ULONG CSafeRefCount::SafeRelease ( )

Definition at line 97 of file Stablize.Cxx.

{
        ULONG   cRefs;

        if( m_cRefs > 0 )
        {
                cRefs = --m_cRefs;

                if( m_cRefs == 0 && m_cNest == 0 && m_fInDelete == FALSE )
                {
                        m_fInDelete = TRUE;
                        delete this;
                }
        }
        else
        {
                // somebody is releasing a non-addrefed pointer!!
                assert(NULL == "Release called on a non-addref'ed pointer!\n");
                cRefs = 0;
        }
        return cRefs;
}

Member Data Documentation

ULONG CSafeRefCount::m_cNest [private]

Definition at line 52 of file Stablize.h.

ULONG CSafeRefCount::m_cRefs [private]

Definition at line 51 of file Stablize.h.

BOOL CSafeRefCount::m_fInDelete [private]

Definition at line 53 of file Stablize.h.

The documentation for this class was generated from the following files:
  • Com/Fundamentals/Include/Stablize.h
  • Com/Fundamentals/Common/Stablize.Cxx
Generated on Wed Nov 13 2024 16:57:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSampleDataContainer Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Types | Protected Attributes

CSampleDataContainer Class Reference

#include "sdksamplestoragesystem.h"

List of all members.

Public Member Functions

CSampleDataContainer ()
virtual | ~CSampleDataContainer ()
virtual HRESULT STDMETHODCALLTYPE | DoDataContainerExtendedCommand (LPWSTR szCommandName, IWMSCommandContext *pCommand, DWORD dwCallFlags, IWMSDataContainerCallback __RPC_FAR *pCallback, QWORD qwContext)
virtual HRESULT STDMETHODCALLTYPE | FinishParsingPacketlist (IWMSPacketList *pPacketList)
virtual HRESULT STDMETHODCALLTYPE | GetContainerFormat (GUID __RPC_FAR *pFormat)
virtual HRESULT STDMETHODCALLTYPE | GetDataSourcePlugin (IWMSDataSourcePlugin __RPC_FAR *__RPC_FAR *ppDataSource)
virtual HRESULT STDMETHODCALLTYPE | GetInfo (DWORD dwInfoValueId, IWMSDataContainerCallback __RPC_FAR *pCallback, QWORD qwContext)
virtual HRESULT STDMETHODCALLTYPE | GetTransferParameters (QWORD qwDesiredOffset, DWORD dwDesiredMinSize, DWORD dwDesiredMaxSize, QWORD *pqwOffset, DWORD *pdwSize, DWORD *pdwBufferAlignment)
HRESULT | Initialize (IWMSContext *pUserContext, LPWSTR pszContainerName, DWORD dwFlags, IWMSBufferAllocator __RPC_FAR *pBufferAllocator, CSDKSampleStorageSystem *pOwnerContainer, IWMSDataSourcePluginCallback __RPC_FAR *pCallback, QWORD qwContext)
void | OnIoCompletion (DWORD dwError, DWORD dwIoType, QWORD qwOffset, DWORD cbTransferred, BYTE *pbBuffer, IWMSDataContainerCallback __RPC_FAR *pCallback, QWORD qwContext)
STDMETHOD() | QueryInterface (REFIID riid, void **ppvObject)
virtual HRESULT STDMETHODCALLTYPE | Read (BYTE __RPC_FAR *pbBuffer, QWORD qwOffset, DWORD dwMaxDataSize, DWORD dwFlags, IWMSDataContainerCallback __RPC_FAR *pCallback, QWORD qwContext)
HRESULT | Shutdown ()
STDMETHOD_ (ULONG, AddRef)()
STDMETHOD_ (ULONG, Release)()
virtual HRESULT STDMETHODCALLTYPE | Write (BYTE __RPC_FAR *pbBuffer, DWORD dwDataSize, QWORD qwWritePosition, IWMSDataContainerCallback __RPC_FAR *pCallback, QWORD qwContext)

Protected Types

enum | { IO_READ, IO_WRITE }

Protected Attributes

LONG | m_cRef
CRITICAL_SECTION | m_CriticalSection
DWORD m_dwAlignment
DWORD m_dwAlignmentLog2
HANDLE m_hFile
CSDKSampleStorageSystem * m_pOwnerStorageSystem
CHAR * | m_pszPathName
QWORD | m_qwFileSize

Detailed Description

Definition at line 39 of file sdksamplestoragesystem.h.

Member Enumeration Documentation

anonymous enum [protected]
Enumerator:
IO_READ
IO_WRITE

Definition at line 118 of file sdksamplestoragesystem.h.

{ IO_READ, IO_WRITE };

Constructor & Destructor Documentation

CSampleDataContainer::CSampleDataContainer ( )

Definition at line 704 of file sdksamplestoragesystem.cpp.

{
    m_cRef = 1;
    m_pszPathName = NULL;
    m_hFile = INVALID_HANDLE_VALUE;
    m_pOwnerStorageSystem = NULL;
    InitializeCriticalSection( &m_CriticalSection );
} // End of CSampleDataContainer.

CSampleDataContainer::~CSampleDataContainer ( ) [virtual]

Definition at line 721 of file sdksamplestoragesystem.cpp.

{
    Shutdown();
    DeleteCriticalSection( &m_CriticalSection );
} // End of ~CSampleDataContainer.

Member Function Documentation

virtual HRESULT STDMETHODCALLTYPE CSampleDataContainer::DoDataContainerExtendedCommand | ( | LPWSTR | szCommandName,
 |  | IWMSCommandContext * | pCommand,
 |  | DWORD | dwCallFlags,
 |  | IWMSDataContainerCallback __RPC_FAR * | pCallback,
 |  | QWORD | qwContext |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CSampleDataContainer::FinishParsingPacketlist ( IWMSPacketList * pPacketList ) [virtual]

Definition at line 1511 of file sdksamplestoragesystem.cpp.

{
    HRESULT hr = S_OK;

    if ( NULL == pPacketList )
    {
        return( E_INVALIDARG );
    }

    return( S_OK );
} // FinishParsingPacketlist

virtual HRESULT STDMETHODCALLTYPE CSampleDataContainer::GetContainerFormat ( GUID __RPC_FAR * pFormat ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CSampleDataContainer::GetDataSourcePlugin ( IWMSDataSourcePlugin __RPC_FAR *__RPC_FAR * ppDataSource ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CSampleDataContainer::GetInfo | ( | DWORD | dwInfoValueId,
 |  | IWMSDataContainerCallback __RPC_FAR * | pCallback,
 |  | QWORD | qwContext |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CSampleDataContainer::GetTransferParameters | ( | QWORD | qwDesiredOffset,
 |  | DWORD | dwDesiredMinSize,
 |  | DWORD | dwDesiredMaxSize,
 |  | QWORD * | pqwOffset,
 |  | DWORD * | pdwSize,
 |  | DWORD * | pdwBufferAlignment |
 | ) |  |  | [virtual]

Definition at line 1110 of file sdksamplestoragesystem.cpp.

{
    HRESULT hr = S_OK;

    if( ( NULL == pqwOffset )
        || ( NULL == pdwSize ) )
    {
        return( E_POINTER );
    }

    if( ( dwDesiredMaxSize != 0 ) && ( dwDesiredMinSize != 0 ) && ( dwDesiredMaxSize < dwDesiredMinSize ) )
    {
        return( E_INVALIDARG );
    }

    if( ( qwDesiredOffset == ~0 ) && ( dwDesiredMinSize == 0 ) )
    {
        return( E_INVALIDARG );
    }

    EnterCriticalSection( &m_CriticalSection );

    if( pdwBufferAlignment != NULL )
    {
        *pdwBufferAlignment = m_dwAlignment;
    }

    if( dwDesiredMinSize != 0 )
    {
        // Round the offset down to the nearest sector boundary.
        *pqwOffset = ( qwDesiredOffset >> m_dwAlignmentLog2 ) << m_dwAlignmentLog2;

        // We may have backed the offset up to the nearest sector.
        // Make sure we will still read all of the desired bytes.
        *pdwSize = dwDesiredMinSize + (DWORD) ( qwDesiredOffset - *pqwOffset );
        *pdwSize = ( ( *pdwSize + m_dwAlignment - 1 ) >> m_dwAlignmentLog2 ) << m_dwAlignmentLog2;

        if( dwDesiredMaxSize != 0 )
        {
            if( dwDesiredMaxSize > *pdwSize )
            {
                DWORD dwTmp = ( dwDesiredMaxSize >> m_dwAlignmentLog2 ) << m_dwAlignmentLog2;
                *pdwSize = dwTmp;
            }
            else
            {
                *pdwSize = 0;
                hr = E_FAIL;
                goto abort;
            }
        }
    }
    else if( dwDesiredMaxSize != 0 ) // and dwDesiredMinSize == 0
    {
        *pdwSize = ( dwDesiredMaxSize >> m_dwAlignmentLog2 ) << m_dwAlignmentLog2;
        if( qwDesiredOffset >= *pdwSize )
        {
            *pqwOffset = qwDesiredOffset - dwDesiredMaxSize;
            *pqwOffset = ( ( *pqwOffset + m_dwAlignment - 1 ) >> m_dwAlignmentLog2 ) << m_dwAlignmentLog2;

            if( *pqwOffset > qwDesiredOffset )
            {
                *pdwSize = 0;
                hr = E_FAIL;
                goto abort;
            }
        }
        else
        {
            // we could make pdwSize smaller now if necessary, so that we don't read
            // too much information
            *pqwOffset = 0;
            *pdwSize = ( ( (DWORD) qwDesiredOffset + m_dwAlignment - 1 ) >> m_dwAlignmentLog2 ) << m_dwAlignmentLog2;
        }
    }
    else
    {
        *pdwSize = 0;
        *pqwOffset = ( ( qwDesiredOffset + m_dwAlignment - 1 ) >> m_dwAlignmentLog2 ) << m_dwAlignmentLog2;
    }

abort:
    LeaveCriticalSection( &m_CriticalSection );

    return( hr );
}

HRESULT CSampleDataContainer::Initialize | ( | IWMSContext * | pUserContext,
 |  | LPWSTR | pszContainerName,
 |  | DWORD | dwFlags,
 |  | IWMSBufferAllocator __RPC_FAR * | pBufferAllocator,
 |  | CSDKSampleStorageSystem * | pOwnerContainer,
 |  | IWMSDataSourcePluginCallback __RPC_FAR * | pCallback,
 |  | QWORD | qwContext
 | ) |  |
void CSampleDataContainer::OnIoCompletion | ( | DWORD | dwError,
 |  | DWORD | dwIoType,
 |  | QWORD | qwOffset,
 |  | DWORD | cbTransferred,
 |  | BYTE * | pbBuffer,
 |  | IWMSDataContainerCallback __RPC_FAR * | pCallback,
 |  | QWORD | qwContext
 | ) |  |
STDMETHODIMP CSampleDataContainer::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppvObject
 | ) |  |

Definition at line 972 of file sdksamplestoragesystem.cpp.

{
    if ( IID_IWMSDataContainer == riid )
    {
        *ppvObject = ( IWMSDataContainer * ) this;
        AddRef();
        return( S_OK );
    }
    else if ( IID_IUnknown == riid )
    {
        *ppvObject = ( IUnknown * ) this;
        AddRef();
        return( S_OK );
    }

    *ppvObject = NULL;
    return( E_NOINTERFACE );
} // End of QueryInterface.

virtual HRESULT STDMETHODCALLTYPE CSampleDataContainer::Read | ( | BYTE __RPC_FAR * | pbBuffer,
 |  | QWORD | qwOffset,
 |  | DWORD | dwMaxDataSize,
 |  | DWORD | dwFlags,
 |  | IWMSDataContainerCallback __RPC_FAR * | pCallback,
 |  | QWORD | qwContext |
 | ) |  |  | [virtual]
HRESULT CSampleDataContainer::Shutdown ( )

Definition at line 900 of file sdksamplestoragesystem.cpp.

{
    HRESULT hr = S_OK;
    BOOL fSuccess;

    EnterCriticalSection( &m_CriticalSection );

    if ( NULL != m_pszPathName )
    {
        delete m_pszPathName;
        m_pszPathName = NULL;
    }

    if ( INVALID_HANDLE_VALUE != m_hFile )
    {
        fSuccess = CloseHandle( m_hFile );
        if ( !fSuccess )
        {
            DWORD nErr = GetLastError();
        }

        m_hFile = INVALID_HANDLE_VALUE;
    }

    if( NULL != m_pOwnerStorageSystem )
    {
        m_pOwnerStorageSystem->Release();
        m_pOwnerStorageSystem = NULL;
    }

    LeaveCriticalSection( &m_CriticalSection );
    return( hr );
} // End of Shutdown.

CSampleDataContainer::STDMETHOD_ | ( | ULONG | ,
 |  | Release |
 | ) |  |
CSampleDataContainer::STDMETHOD_ | ( | ULONG | ,
 |  | AddRef |
 | ) |  |
virtual HRESULT STDMETHODCALLTYPE CSampleDataContainer::Write | ( | BYTE __RPC_FAR * | pbBuffer,
 |  | DWORD | dwDataSize,
 |  | QWORD | qwWritePosition,
 |  | IWMSDataContainerCallback __RPC_FAR * | pCallback,
 |  | QWORD | qwContext |
 | ) |  |  | [virtual]

Member Data Documentation

LONG CSampleDataContainer::m_cRef [protected]

Definition at line 119 of file sdksamplestoragesystem.h.

CRITICAL_SECTION CSampleDataContainer::m_CriticalSection [protected]

Definition at line 126 of file sdksamplestoragesystem.h.

DWORD CSampleDataContainer::m_dwAlignment [protected]

Definition at line 125 of file sdksamplestoragesystem.h.

DWORD CSampleDataContainer::m_dwAlignmentLog2 [protected]

Definition at line 124 of file sdksamplestoragesystem.h.

HANDLE CSampleDataContainer::m_hFile [protected]

Definition at line 122 of file sdksamplestoragesystem.h.

CSDKSampleStorageSystem* CSampleDataContainer::m_pOwnerStorageSystem [protected]

Definition at line 120 of file sdksamplestoragesystem.h.

CHAR* CSampleDataContainer::m_pszPathName [protected]

Definition at line 121 of file sdksamplestoragesystem.h.

QWORD CSampleDataContainer::m_qwFileSize [protected]

Definition at line 123 of file sdksamplestoragesystem.h.

The documentation for this class was generated from the following files:
  • Multimedia/WindowsMediaServices9/DataSource/sdksamplestoragesystem.h
  • Multimedia/WindowsMediaServices9/DataSource/sdksamplestoragesystem.cpp
Generated on Wed Nov 13 2024 16:57:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSampleDataSource Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes

CSampleDataSource Class Reference

#include "BasicHiPerf.h"

List of all members.

Public Member Functions

CSampleDataSource ()
virtual | ~CSampleDataSource ()
DWORD | Initialize (IWbemClassObject *pSampleClass)
DWORD | UpdateInstance (IWbemObjectAccess *pObj)

Private Member Functions

DWORD | SetHandles (IWbemClassObject *pSampleClass)
DWORD Simulate ()

Static Private Member Functions

static unsigned __stdcall | ThreadEntry (void *pArgs)

Private Attributes

CSampleInstance | m_aInstance [NUM_INSTANCES]
long | m_alHandle [NumCtrs]
HANDLE m_hQuit
HANDLE m_hThread

Detailed Description

Definition at line 191 of file BasicHiPerf.h.

Constructor & Destructor Documentation

CSampleDataSource::CSampleDataSource ( )

Definition at line 1457 of file BasicHiPerf.Cpp.

                                     : m_hThread(NULL)
//////////////////////////////////////////////////////////////////////
//
//  Constructor
//
//////////////////////////////////////////////////////////////////////
//ok
{
  m_hQuit = CreateEvent( NULL, TRUE, FALSE, NULL );
}

CSampleDataSource::~CSampleDataSource ( ) [virtual]

Definition at line 1468 of file BasicHiPerf.Cpp.

{
  if (NULL != m_hThread)
  {
    // Signal the thread to terminate
    // ==============================

    SetEvent( m_hQuit );

    DWORD dwRet = WaitForSingleObject( m_hThread, 60000 );

    switch ( dwRet )
    {
    case WAIT_OBJECT_0:
      {
      }break;
    case WAIT_TIMEOUT:
      {
        // Something is wrong - handle appropriately
      }break;
    }

    m_hThread = NULL;
  }
}

Member Function Documentation

DWORD CSampleDataSource::Initialize ( IWbemClassObject * pSampleClass )

Definition at line 1500 of file BasicHiPerf.Cpp.

              :
//    pSampleClass  - a template of the class for which
//              handles are required
//
//////////////////////////////////////////////////////////////
//ok
{
  DWORD dwRes = WBEM_E_FAILED;
  unsigned uThread = 0;

  // Set the handles for the object (valid for all instances)
  // ========================================================

  dwRes = SetHandles(pSampleClass);
  if (FAILED(dwRes))
    return dwRes;

  // Create the simulation thread
  // ============================

  m_hThread = (PVOID)_beginthreadex(NULL, 0, CSampleDataSource::ThreadEntry, this, 0, &uThread);

  if (0 == m_hThread)
    return WBEM_E_FAILED;

  return WBEM_NO_ERROR;
}

DWORD CSampleDataSource::SetHandles ( IWbemClassObject * pSampleClass ) [private]

Definition at line 1537 of file BasicHiPerf.Cpp.

              :
//    pSampleClass  - a template of the class for which
//              handles are required
//
//////////////////////////////////////////////////////////////
//ok
{
  DWORD dwRes = WBEM_NO_ERROR;

  IWbemObjectAccess *pAccess = NULL;
    BSTR strPropName  = NULL;

    if (NULL == pSampleClass)
        return WBEM_E_FAILED;

  // Get the IWbemAccess interface to the class
  // ==========================================

  dwRes = pSampleClass->QueryInterface(IID_IWbemObjectAccess, (LPVOID *)&pAccess);

  if (FAILED(dwRes))
    return dwRes;

  // Get the counter properties access handles
  // =========================================

  for (int i = ctr1; i < NumCtrs; i++)
  {
    strPropName = SysAllocString(g_aCounterProps[i].m_tcsPropertyName);
    if (!strPropName)
    {
      pAccess->Release();
      return WBEM_E_OUT_OF_MEMORY;
    }

    dwRes = pAccess->GetPropertyHandle(strPropName, 0, &m_alHandle[i]);

    SysFreeString(strPropName);

    if (FAILED(dwRes))
    {
      pAccess->Release();
      return dwRes;
    }
  }

  pAccess->Release();

  return WBEM_NO_ERROR;
}

DWORD CSampleDataSource::Simulate ( ) [private]

Definition at line 1657 of file BasicHiPerf.Cpp.

{
  CSampleInstance* pCurrInst = NULL;
  DWORD dwVal = 0;

  // Loop until the thread is killed
  // ===============================

  while ( WaitForSingleObject( m_hQuit, 0 ) == WAIT_TIMEOUT )
  {
    // Loop through the instances
    // ==========================

    for (int nInst = 0; nInst < NUM_INSTANCES; nInst++)
    {
      // Get the current instance and lock it
      // ====================================

      pCurrInst = &(m_aInstance[nInst]);

      pCurrInst->Lock(true);

      // Update all of the counters
      // ==========================

      for (int nCtr = ctr1; nCtr < NumCtrs; nCtr++)
      {
        dwVal = GetTickCount() / (nCtr + 1);
        pCurrInst->SetCounter(nCtr, dwVal);
      }

      pCurrInst->Lock(false);
    }

    // Wait a while
    // ============

    Sleep(100);
  }

  return WBEM_NO_ERROR;
}

unsigned CSampleDataSource::ThreadEntry ( void * pArgs ) [static, private]

Definition at line 1709 of file BasicHiPerf.Cpp.

              :
//    pArgs - contains the this pointer of the calling
//          object
//
//////////////////////////////////////////////////////////////
//ok
{
  CSampleDataSource* pThis = (CSampleDataSource*)pArgs;

  pThis->Simulate();

  return 0;
}

DWORD CSampleDataSource::UpdateInstance ( IWbemObjectAccess * pObj )

Definition at line 1602 of file BasicHiPerf.Cpp.

              :
//    pAccess   - the object to be updated
//
//////////////////////////////////////////////////////////////
//ok
{
  DWORD dwRes = WBEM_E_FAILED;

  DWORD dwID = 0;

  // Get the ID of the object
  // ========================

  WCHAR wszName[20];
  long lNumBytes = 0;
  dwRes = pAccess->ReadPropertyValue(g_hID, sizeof(wszName), &lNumBytes, (byte *)wszName);
  if (FAILED(dwRes))
    return dwRes;
  dwID = _wtoi(wszName);

  // Get the counter data
  // ====================

  CSampleInstance* pInst = &(m_aInstance[dwID]);

  // And set the counter properties
  // ==============================

  pInst->Lock(true);

  for (int nProp = ctr1; nProp < NumCtrs; nProp++)
  {
    DWORD dwVal = 0;
    dwRes = pInst->GetCounter(nProp, &dwVal);
    if (FAILED(dwRes))
      break;
    dwRes = pAccess->WriteDWORD(m_alHandle[nProp], dwVal);
    if (FAILED(dwRes))
      break;
  }

  pInst->Lock(false);

  return dwRes;
}

Member Data Documentation

CSampleInstance CSampleDataSource::m_aInstance[NUM_INSTANCES] [private]

Definition at line 199 of file BasicHiPerf.h.

long CSampleDataSource::m_alHandle[NumCtrs] [private]

Definition at line 195 of file BasicHiPerf.h.

HANDLE CSampleDataSource::m_hQuit [private]

Definition at line 207 of file BasicHiPerf.h.

HANDLE CSampleDataSource::m_hThread [private]

Definition at line 203 of file BasicHiPerf.h.

The documentation for this class was generated from the following files:
  • SysMgmt/WMI/VC/HiPerfProvider/BasicHiPerf.h
  • SysMgmt/WMI/VC/HiPerfProvider/BasicHiPerf.Cpp
Generated on Wed Nov 13 2024 16:57:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSampleDirectory Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CSampleDirectory Class Reference

#include "sdksamplestoragesystem.h"

List of all members.

Public Member Functions

CSampleDirectory ()
virtual | ~CSampleDirectory ()
virtual HRESULT STDMETHODCALLTYPE | GetChildInfo (DWORD dwIndex, WMSDirectoryEntryInfo *pInfo)
virtual HRESULT STDMETHODCALLTYPE | GetDataSourcePlugin (IWMSDataSourcePlugin **ppDataSource)
virtual HRESULT STDMETHODCALLTYPE | GetName (LPOLESTR *pstrValue)
HRESULT | Initialize (IWMSContext *pUserContext, LPWSTR pszContainerName, CSDKSampleStorageSystem *pOwnerStorageSystem, IWMSDataSourcePluginCallback *pCallback, QWORD qwContext)
STDMETHOD() | QueryInterface (REFIID riid, void **ppvObject)
HRESULT | Shutdown ()
STDMETHOD_ (ULONG, Release)()
STDMETHOD_ (ULONG, AddRef)()

Protected Attributes

LONG | m_cRef
CRITICAL_SECTION | m_CriticalSection
DWORD m_dwItemNum
DWORD m_dwPathNameLength
CSampleDirectoryInfo * m_pChildren
CSDKSampleStorageSystem * m_pOwnerStorageSystem
WCHAR * | m_pPathName
CSampleDirectoryInfo * m_pRecentChild
WCHAR * | m_pSearchDirName

Detailed Description

Definition at line 274 of file sdksamplestoragesystem.h.

Constructor & Destructor Documentation

CSampleDirectory::CSampleDirectory ( )

Definition at line 1534 of file sdksamplestoragesystem.cpp.

{
    m_cRef = 1;
    m_pOwnerStorageSystem = NULL;
    InitializeCriticalSection( &m_CriticalSection );
    m_pPathName = NULL;
    m_dwPathNameLength = 0;
    m_pSearchDirName = NULL;
    m_pChildren = NULL;
    m_pRecentChild = NULL;
    m_dwItemNum = 0;
} //End of CSampleDirectory

CSampleDirectory::~CSampleDirectory ( ) [virtual]

Definition at line 1547 of file sdksamplestoragesystem.cpp.

{
    Shutdown();
    DeleteCriticalSection( &m_CriticalSection );
} // End of ~CSampleDirectory

Member Function Documentation

HRESULT STDMETHODCALLTYPE CSampleDirectory::GetChildInfo | ( | DWORD | dwIndex,
 |  | WMSDirectoryEntryInfo * | pInfo |
 | ) |  |  | [virtual]

Definition at line 2035 of file sdksamplestoragesystem.cpp.

{
    HRESULT hr = S_OK;
    DWORD dwUrlLength = 0;

    if( NULL == pInfo )
    {
        return( E_INVALIDARG );
    }

    EnterCriticalSection( &m_CriticalSection );

    // We cannot go backwards. If the client asked for a previous
    // directory entry, then reset the state to the beginning and
    // then go forward to the desired position.
    if( ( dwIndex < m_dwItemNum ) || ( NULL == m_pRecentChild ) )
    {
        m_dwItemNum = 1;
        m_pRecentChild = m_pChildren;
    } // resetting the count.

    // Advance to the desired position in the directory.
    while ( ( m_dwItemNum < dwIndex ) && ( NULL != m_pRecentChild ) )
    {
        m_pRecentChild = m_pRecentChild->m_pNext;
        m_dwItemNum++;
    } // advancing to the desired position.

    if( NULL == m_pRecentChild )
    {
        // This means we hit the end of the directory, which is
        // not an error. Signify S_FALSE for the end of the enumeration.
        hr = S_FALSE;
        goto abort;
    }

    dwUrlLength = wcslen( m_pRecentChild->m_pszwName );
    pInfo->pstrName = ( LPOLESTR ) CoTaskMemAlloc( sizeof(OLECHAR) * ( dwUrlLength + 1 ) );
    if( NULL == pInfo->pstrName )
    {
        hr = E_OUTOFMEMORY;
        goto abort;
    }

    pInfo->pstrName[dwUrlLength] = L'\0';

    wcsncpy( pInfo->pstrName, m_pRecentChild->m_pszwName, dwUrlLength );

    if( L'\0' != pInfo->pstrName[dwUrlLength] )
    {
        hr = HRESULT_FROM_WIN32( ERROR_INSUFFICIENT_BUFFER );
        goto abort;
    }

    pInfo->dwFlags = m_pRecentChild->m_dwFlags;
    pInfo->qwSize = m_pRecentChild->m_qwSize;

abort:
    LeaveCriticalSection( &m_CriticalSection );

    return( hr );
} // End of GetChildInfo

HRESULT STDMETHODCALLTYPE CSampleDirectory::GetDataSourcePlugin ( IWMSDataSourcePlugin ** ppDataSource ) [virtual]

Definition at line 1953 of file sdksamplestoragesystem.cpp.

{
    HRESULT hr = S_OK;

    if( NULL == ppDataSource )
    {
        return( E_INVALIDARG );
    }

    EnterCriticalSection( &m_CriticalSection );

    if( NULL == m_pOwnerStorageSystem )
    {
        goto abort;
    }

    *ppDataSource = m_pOwnerStorageSystem;
    m_pOwnerStorageSystem->AddRef();

abort:
    LeaveCriticalSection( &m_CriticalSection );

    return( hr );
} // End of GetDataSourcePlugin

HRESULT STDMETHODCALLTYPE CSampleDirectory::GetName ( LPOLESTR * pstrValue ) [virtual]

Definition at line 1986 of file sdksamplestoragesystem.cpp.

{
    HRESULT hr = S_OK;

    if( NULL == pstrValue )
    {
        return( E_INVALIDARG );
    }

    EnterCriticalSection( &m_CriticalSection );

    *pstrValue = new WCHAR[ m_dwPathNameLength + 1 ];
    if( NULL == *pstrValue )
    {
        hr = E_OUTOFMEMORY;
        goto abort;
    }

    if( NULL != m_pPathName )
    {
        *pstrValue[m_dwPathNameLength] = L'\0';

        wcsncpy( *pstrValue, m_pPathName, m_dwPathNameLength );

        if( L'\0' != *pstrValue[m_dwPathNameLength] )
        {
            hr = HRESULT_FROM_WIN32( ERROR_INSUFFICIENT_BUFFER );
            goto abort;
        }
    }
    else
    {
        ( *pstrValue )[ 0 ] = L'\0';
    }

abort:
    LeaveCriticalSection( &m_CriticalSection );

    return( hr );
} // End of GetName

HRESULT CSampleDirectory::Initialize | ( | IWMSContext * | pUserContext,
 |  | LPWSTR | pszContainerName,
 |  | CSDKSampleStorageSystem * | pOwnerStorageSystem,
 |  | IWMSDataSourcePluginCallback * | pCallback,
 |  | QWORD | qwContext
 | ) |  |

Definition at line 1559 of file sdksamplestoragesystem.cpp.

{
    HRESULT hr = S_OK;
    WCHAR *pszNtfsPathname = NULL;
    size_t sFileName = 0;
    DWORD dwFileAttributes = 0;
    DWORD dwIndex = 0;
    HANDLE hFileEnum = INVALID_HANDLE_VALUE;
    BOOL fSuccess = FALSE;
    WIN32_FIND_DATA FileInfo;
    CSampleDirectoryInfo *pDirInfo = NULL;
    DWORD dwUrlLength = 0;
    DWORD dwFileNameLength = 0;
    DWORD dwFileNameStartPosition =0;
    WCHAR cLastCharInPath = L'\0';

    EnterCriticalSection( &m_CriticalSection );

    //
    // Check arguments
    //

    if( ( NULL == pszContainerName )||
        ( NULL == pCallback ) ||
        ( NULL == pOwnerStorageSystem ) )
    {
        hr = E_INVALIDARG;
        goto abort;
    }

    if( 0 != _wcsnicmp( pszContainerName, URL_SCHEME, URL_SCHEME_LENGTH ) )
    {
        // The container name doesn't start with the expected scheme
        hr = E_INVALIDARG;
        goto abort;
    }

    m_pOwnerStorageSystem = pOwnerStorageSystem;
    pOwnerStorageSystem->AddRef();

    m_dwItemNum = 0;

    //
    // Copy the full path
    //

    m_dwPathNameLength = wcslen( pszContainerName );
    m_pPathName = new WCHAR[ m_dwPathNameLength + 1 ];
    if( NULL == m_pPathName )
    {
        hr = E_OUTOFMEMORY;
        goto abort;
    }

    m_pPathName[m_dwPathNameLength] = L'\0';

    wcsncpy( m_pPathName, pszContainerName, m_dwPathNameLength );

    if( L'\0' != m_pPathName[m_dwPathNameLength] )
    {
        hr = HRESULT_FROM_WIN32( ERROR_INSUFFICIENT_BUFFER );
        goto abort;
    }

    //
    // Make an auxiliary copy of the path, without the scheme
    //

    pszNtfsPathname = pszContainerName + URL_SCHEME_LENGTH;
    sFileName = wcslen( pszNtfsPathname );
    m_pSearchDirName = new WCHAR[ sFileName + DIR_MASK_LENGTH + 1 ];
    if( NULL == m_pSearchDirName )
    {
        hr = E_OUTOFMEMORY;
        goto abort;
    }

    m_pSearchDirName[sFileName] = L'\0';

    wcsncpy( m_pSearchDirName, pszNtfsPathname, sFileName );

    if( L'\0' != m_pSearchDirName[sFileName] )
    {
        hr = HRESULT_FROM_WIN32( ERROR_INSUFFICIENT_BUFFER );
        goto abort;
    }

    //
    // Remove any trailing '\' or '/' from the working path
    //

    if( 0 < sFileName )
    {
        cLastCharInPath = m_pSearchDirName[sFileName - 1];

        if( ( L'\\' == cLastCharInPath )
            || ( L'/' == cLastCharInPath ) )
        {
            --sFileName;
            m_pSearchDirName[sFileName] = L'\0';
        }
    }

    //
    // Check if it's really a directory
    //

    dwFileAttributes = GetFileAttributes( m_pSearchDirName );
    if( -1 == dwFileAttributes )
    {
        // Unable to get the FileAttributes
        hr = HRESULT_FROM_WIN32( GetLastError() );
        goto abort;
    }
    else if( !( FILE_ATTRIBUTE_DIRECTORY & dwFileAttributes ) )
    {
        // This "file" is not a directory
        hr = HRESULT_FROM_WIN32( ERROR_DIRECTORY );
        goto abort;
    }

    //
    // Append a '\*' mask to the working path and walk through the directory
    //

    m_pSearchDirName[ sFileName + DIR_MASK_LENGTH ] = L'\0';

    wcsncpy( &m_pSearchDirName[sFileName], DIR_MASK, DIR_MASK_LENGTH );

    if( L'\0' != m_pSearchDirName[ sFileName + DIR_MASK_LENGTH ] )
    {
        hr = HRESULT_FROM_WIN32( ERROR_INSUFFICIENT_BUFFER );
        goto abort;
    }

    hFileEnum = FindFirstFileW( m_pSearchDirName, &FileInfo );
    if( INVALID_HANDLE_VALUE == hFileEnum )
    {
        hr = HRESULT_FROM_WIN32( GetLastError() );
        if( HRESULT_FROM_WIN32( ERROR_FILE_NOT_FOUND ) == hr )
        {
            // This means we hit the end of the directory, which is
            // not an error.  Signify S_FALSE for the end of the
            // enumeration.
            hr = S_FALSE;
            goto abort;
        }
        goto abort;
    }

    fSuccess = TRUE;

    // Advance to the desired position in the directory.
    dwIndex = 0;
    while ( TRUE )
    {
        if( !fSuccess )
        {
            hr = HRESULT_FROM_WIN32( GetLastError() );
            if( HRESULT_FROM_WIN32( ERROR_NO_MORE_FILES ) != hr  )
            {
                goto abort;
            }

            // This means we hit the end of the directory, which is
            // not an error.
            hr = S_OK;
            break;
        }

        if( ( '\0' == FileInfo.cFileName[0] )
            || ( ( '.' == FileInfo.cFileName[0] ) && ('\0' == FileInfo.cFileName[1] ) )
            || ( ( '.' == FileInfo.cFileName[0] ) && ( '.' == FileInfo.cFileName[1] ) && ( '\0' == FileInfo.cFileName[2] ) )
            || ( FileInfo.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN ) )

        {
            // if the item is empty or '.' or '..' or hidden file then skip it
            // and grab the next file and start the loop again
            fSuccess = FindNextFileW( hFileEnum, &FileInfo );
            continue;
        }

        pDirInfo = new CSampleDirectoryInfo;
        if( NULL == pDirInfo )
        {
            hr = E_OUTOFMEMORY;
            goto abort;
        }

        //
        // Compose the item's URL
        //

        dwFileNameLength = wcslen( FileInfo.cFileName );
        dwUrlLength = m_dwPathNameLength + dwFileNameLength + 1;   // 1 for the '\' separator

        pDirInfo->m_pszwName = ( LPOLESTR ) CoTaskMemAlloc( sizeof( OLECHAR ) * ( dwUrlLength + 1 ) );
        if( NULL == pDirInfo->m_pszwName )
        {
            hr = E_OUTOFMEMORY;
            goto abort;
        }

        pDirInfo->m_pszwName[m_dwPathNameLength] = L'\0';

        wcsncpy( pDirInfo->m_pszwName, m_pPathName, m_dwPathNameLength );

        if( L'\0' != pDirInfo->m_pszwName[m_dwPathNameLength] )
        {
            hr = HRESULT_FROM_WIN32( ERROR_INSUFFICIENT_BUFFER );
            goto abort;
        }

        dwFileNameStartPosition = m_dwPathNameLength;
        cLastCharInPath = m_pPathName[m_dwPathNameLength-1];
        if( ( L'\\' != cLastCharInPath ) && ( L'/' != cLastCharInPath ) )
        {
            ( pDirInfo->m_pszwName )[m_dwPathNameLength] = L'\\';
            ( pDirInfo->m_pszwName )[m_dwPathNameLength + 1] = L'\0';
            dwFileNameStartPosition++;
        }

        pDirInfo->m_pszwName[ dwFileNameStartPosition + dwFileNameLength ] = L'\0';

        wcsncpy( &pDirInfo->m_pszwName[dwFileNameStartPosition], FileInfo.cFileName, dwFileNameLength );

        if( L'\0' != pDirInfo->m_pszwName[ dwFileNameStartPosition + dwFileNameLength ] )
        {
            hr = HRESULT_FROM_WIN32( ERROR_INSUFFICIENT_BUFFER );
            goto abort;
        }

        //
        // Set the item's flags
        //

        pDirInfo->m_dwFlags = 0;
        if( FileInfo.dwFileAttributes  & FILE_ATTRIBUTE_DIRECTORY )
        {
            pDirInfo->m_dwFlags |= WMS_DIRECTORY_ENTRY_IS_DIRECTORY;
        }
        pDirInfo->m_qwSize = MAKEQWORD( FileInfo.nFileSizeLow, FileInfo.nFileSizeHigh );

        //
        // Insert item's info in list
        //

        pDirInfo->m_pNext = m_pChildren;
        m_pChildren = pDirInfo;
        pDirInfo = NULL;

        dwIndex++;

        fSuccess = FindNextFileW( hFileEnum, &FileInfo );
    } // Enumerate every file in the directory.

    m_dwItemNum = 1;
    m_pRecentChild = m_pChildren;

abort:
    LeaveCriticalSection ( &m_CriticalSection );

    if( NULL != pDirInfo )
    {
        delete pDirInfo;
    }

    if( INVALID_HANDLE_VALUE != hFileEnum )
    {
        fSuccess = FindClose( hFileEnum );
        hFileEnum = INVALID_HANDLE_VALUE;
    }

    if( NULL != pCallback )
    {
        // The HRESULT returned by the callback should be ignored.
        pCallback->OnOpenDirectory( hr, this, qwContext );
        hr = S_OK; // any error is passed to the callback
    }

    // Any error is passed to the callback.
    return( S_OK );
} // End of Initialize

STDMETHODIMP CSampleDirectory::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppvObject
 | ) |  |

Definition at line 1927 of file sdksamplestoragesystem.cpp.

{
    if ( IID_IWMSDirectory == riid )
    {
        *ppvObject = ( IWMSDirectory * ) this;
        AddRef();
        return( S_OK );
    }
    else if ( IID_IUnknown == riid )
    {
        *ppvObject = ( IUnknown * ) this;
        AddRef();
        return( S_OK );
    }

    *ppvObject = NULL;
    return( E_NOINTERFACE );
} // End of QueryInterface.

HRESULT CSampleDirectory::Shutdown ( )

Definition at line 1855 of file sdksamplestoragesystem.cpp.

{
    CSampleDirectoryInfo *pChild = NULL;

    if( NULL != m_pOwnerStorageSystem )
    {
        m_pOwnerStorageSystem->Release();
        m_pOwnerStorageSystem = NULL;
    }

    if( NULL != m_pPathName )
    {
        delete [] m_pPathName;
        m_pPathName = NULL;
    }

    if( NULL != m_pSearchDirName )
    {
        delete [] m_pSearchDirName;
        m_pSearchDirName = NULL;
    }

    // delete children
    while( NULL != m_pChildren )
    {
        pChild = m_pChildren;
        m_pChildren = m_pChildren->m_pNext;
        delete pChild;
    }

    return( S_OK );
} // End of Shutdown

CSampleDirectory::STDMETHOD_ | ( | ULONG | ,
 |  | AddRef |
 | ) |  |
CSampleDirectory::STDMETHOD_ | ( | ULONG | ,
 |  | Release |
 | ) |  |

Member Data Documentation

LONG CSampleDirectory::m_cRef [protected]

Definition at line 308 of file sdksamplestoragesystem.h.

CRITICAL_SECTION CSampleDirectory::m_CriticalSection [protected]

Definition at line 310 of file sdksamplestoragesystem.h.

DWORD CSampleDirectory::m_dwItemNum [protected]

Definition at line 317 of file sdksamplestoragesystem.h.

DWORD CSampleDirectory::m_dwPathNameLength [protected]

Definition at line 313 of file sdksamplestoragesystem.h.

CSampleDirectoryInfo* CSampleDirectory::m_pChildren [protected]

Definition at line 315 of file sdksamplestoragesystem.h.

CSDKSampleStorageSystem* CSampleDirectory::m_pOwnerStorageSystem [protected]

Definition at line 309 of file sdksamplestoragesystem.h.

WCHAR* CSampleDirectory::m_pPathName [protected]

Definition at line 312 of file sdksamplestoragesystem.h.

CSampleDirectoryInfo* CSampleDirectory::m_pRecentChild [protected]

Definition at line 316 of file sdksamplestoragesystem.h.

WCHAR* CSampleDirectory::m_pSearchDirName [protected]

Definition at line 314 of file sdksamplestoragesystem.h.

The documentation for this class was generated from the following files:
  • Multimedia/WindowsMediaServices9/DataSource/sdksamplestoragesystem.h
  • Multimedia/WindowsMediaServices9/DataSource/sdksamplestoragesystem.cpp
Generated on Wed Nov 13 2024 16:57:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSampleDirectoryInfo Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes | Friends

CSampleDirectoryInfo Class Reference

#include "sdksamplestoragesystem.h"

List of all members.

Public Member Functions

CSampleDirectoryInfo ()
virtual | ~CSampleDirectoryInfo ()

Private Attributes

DWORD m_dwFlags
CSampleDirectoryInfo * m_pNext
LPOLESTR m_pszwName
QWORD | m_qwSize

Friends

class | CSampleDirectory

Detailed Description

Definition at line 241 of file sdksamplestoragesystem.h.

Constructor & Destructor Documentation

CSampleDirectoryInfo::CSampleDirectoryInfo ( ) [inline]

Definition at line 245 of file sdksamplestoragesystem.h.

    {
        m_pszwName = NULL;
        m_dwFlags = 0;
        m_qwSize = 0;
        m_pNext = NULL;
    }

virtual CSampleDirectoryInfo::~CSampleDirectoryInfo ( ) [inline, virtual]

Definition at line 254 of file sdksamplestoragesystem.h.

    {
        if( NULL != m_pszwName )
        {
            CoTaskMemFree( m_pszwName );
            m_pszwName = NULL;
        }
    }

Friends And Related Function Documentation

friend class CSampleDirectory [friend]

Definition at line 264 of file sdksamplestoragesystem.h.

Member Data Documentation

DWORD CSampleDirectoryInfo::m_dwFlags [private]

Definition at line 267 of file sdksamplestoragesystem.h.

CSampleDirectoryInfo* CSampleDirectoryInfo::m_pNext [private]

Definition at line 269 of file sdksamplestoragesystem.h.

LPOLESTR CSampleDirectoryInfo::m_pszwName [private]

Definition at line 266 of file sdksamplestoragesystem.h.

QWORD CSampleDirectoryInfo::m_qwSize [private]

Definition at line 268 of file sdksamplestoragesystem.h.

The documentation for this class was generated from the following file:
  • Multimedia/WindowsMediaServices9/DataSource/sdksamplestoragesystem.h
Generated on Wed Nov 13 2024 16:57:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSampleInstance Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CSampleInstance Class Reference

#include "BasicHiPerf.h"

List of all members.

Public Member Functions

CSampleInstance ()
CSampleInstance (const CSampleInstance &aInst)
~CSampleInstance ()
DWORD | GetCounter (long lCtr, DWORD *pdwVal)
DWORD | Lock (bool bLock)
DWORD | SetCounter (long lCtr, DWORD dwVal)

Private Attributes

CRITICAL_SECTION | CS
DWORD | m_aCounter [NumCtrs]

Detailed Description

Definition at line 160 of file BasicHiPerf.h.

Constructor & Destructor Documentation

CSampleInstance::CSampleInstance ( )

Definition at line 1736 of file BasicHiPerf.Cpp.

{
  InitializeCriticalSection(&CS);
}

CSampleInstance::CSampleInstance ( const CSampleInstance & aInst )

Definition at line 1747 of file BasicHiPerf.Cpp.

{
  InitializeCriticalSection(&CS);

  for (int i = ctr1; i < NumCtrs; i++)
    m_aCounter[i] = aInst.m_aCounter[i];
}

CSampleInstance::~CSampleInstance ( )

Definition at line 1761 of file BasicHiPerf.Cpp.

{
  DeleteCriticalSection(&CS);
}

Member Function Documentation

DWORD CSampleInstance::GetCounter | ( | long | lCtr,
 |  | DWORD * | pdwVal
 | ) |  |

Definition at line 1820 of file BasicHiPerf.Cpp.

              :
//    lCtrIndex - the index of the counter
//    dwVal   - the return parameter for the value
//
//////////////////////////////////////////////////////////////
//ok
{
  DWORD dwRes = WBEM_E_FAILED;

  // Verify counter index
  // ====================

  if ((lCtrIndex >= 0) && (lCtrIndex < NumCtrs))
  {
    // Set return values
    // =================

    *pdwVal = m_aCounter[lCtrIndex];
    dwRes = WBEM_NO_ERROR;
  }

  return dwRes;
}

DWORD CSampleInstance::Lock ( bool bLock )

Definition at line 1772 of file BasicHiPerf.Cpp.

              :
//    bLock - true = lock; false = unlock
//
//////////////////////////////////////////////////////////////
//ok
{
  if (bLock)
    EnterCriticalSection(&CS);
  else
    LeaveCriticalSection(&CS);

  return WBEM_NO_ERROR;
}

DWORD CSampleInstance::SetCounter | ( | long | lCtr,
 |  | DWORD | dwVal
 | ) |  |

Definition at line 1791 of file BasicHiPerf.Cpp.

              :
//    lCtrIndex - the index of the counter
//    dwVal   - the value of the counter
//
//////////////////////////////////////////////////////////////
//ok
{
  DWORD dwRes = WBEM_E_FAILED;

  // Verify counter index
  // ====================

  if ((lCtrIndex >= 0) && (lCtrIndex < NumCtrs))
  {
    // Update the counter value
    // ========================
    m_aCounter[lCtrIndex] = dwVal;

    dwRes = WBEM_NO_ERROR;
  }

  return dwRes;
}

Member Data Documentation

CRITICAL_SECTION CSampleInstance::CS [private]

Definition at line 168 of file BasicHiPerf.h.

DWORD CSampleInstance::m_aCounter[NumCtrs] [private]

Definition at line 164 of file BasicHiPerf.h.

The documentation for this class was generated from the following files:
  • SysMgmt/WMI/VC/HiPerfProvider/BasicHiPerf.h
  • SysMgmt/WMI/VC/HiPerfProvider/BasicHiPerf.Cpp
Generated on Wed Nov 13 2024 16:57:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSampleMSP Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions

CSampleMSP Class Reference

#include "SampAddr.h"

List of all members.

Public Member Functions

CSampleMSP ()
virtual | ~CSampleMSP ()
STDMETHOD() | CreateMSPCall (IN MSP_HANDLE htCall, IN DWORD dwReserved, IN DWORD dwMediaType, IN IUnknown *pOuterUnknown, OUT IUnknown **ppMSPCall)
virtual ULONG | MSPAddressAddRef (void)
virtual ULONG | MSPAddressRelease (void)
STDMETHOD() | ShutdownMSPCall (IN IUnknown *pMSPCall)

Protected Member Functions

DWORD | GetCallMediaTypes (void)

Detailed Description

Definition at line 26 of file SampAddr.h.

Constructor & Destructor Documentation

CSampleMSP::CSampleMSP ( )

Definition at line 21 of file SampAddr.Cpp.

{
    LOG((MSP_TRACE, "CSampleMSP::CSampleMSP entered."));
    LOG((MSP_TRACE, "CSampleMSP::CSampleMSP exited."));
}

CSampleMSP::~CSampleMSP ( ) [virtual]

Definition at line 31 of file SampAddr.Cpp.

{
    LOG((MSP_TRACE, "CSampleMSP::~CSampleMSP entered."));
    LOG((MSP_TRACE, "CSampleMSP::~CSampleMSP exited."));
}

Member Function Documentation

STDMETHODIMP CSampleMSP::CreateMSPCall | ( | IN MSP_HANDLE | htCall,
 |  | IN DWORD | dwReserved,
 |  | IN DWORD | dwMediaType,
 |  | IN IUnknown * | pOuterUnknown,
 |  | OUT IUnknown ** | ppMSPCall
 | ) |  |

Definition at line 55 of file SampAddr.Cpp.

{
    LOG((MSP_TRACE, "CSampleMSP::CreateMSPCall - enter"));

    CSampleMSPCall * pCSampleMSPCall;

    HRESULT hr = CreateMSPCallHelper<CSampleMSPCall>(this,
                                                   htCall,
                                                   dwReserved,
                                                   dwMediaType,
                                                   pOuterUnknown,
                                                   ppMSPCall,
                                                   &pCSampleMSPCall);

    //
    // pCSampleMSPCall is not addrefed; no need to release.
    //

    if ( FAILED(hr) )
    {
        LOG((MSP_ERROR, "CSampleMSP::CreateMSPCall - template helper returned"
            "0x%08x", hr));

        return hr;
    }

    LOG((MSP_TRACE, "CSampleMSP::CreateMSPCall - exit S_OK"));

    return S_OK;
}

DWORD CSampleMSP::GetCallMediaTypes ( void ) [protected]

Definition at line 131 of file SampAddr.Cpp.

{
    return (DWORD) TAPIMEDIATYPE_AUDIO;
}

ULONG CSampleMSP::MSPAddressAddRef ( void ) [virtual]

Definition at line 41 of file SampAddr.Cpp.

{
    return MSPAddRefHelper(this);
}

ULONG CSampleMSP::MSPAddressRelease ( void ) [virtual]

Definition at line 46 of file SampAddr.Cpp.

{
    return MSPReleaseHelper(this);
}

STDMETHODIMP CSampleMSP::ShutdownMSPCall ( IN IUnknown * pMSPCall )

Definition at line 96 of file SampAddr.Cpp.

{
    LOG((MSP_TRACE, "CSampleMSP::ShutdownMSPCall - enter"));

    CSampleMSPCall * pCSampleMSPCall;

    HRESULT hr = ShutdownMSPCallHelper<CSampleMSPCall>(pMSPCall,
                                                     &pCSampleMSPCall);

    //
    // pCSampleMSPCall is not addrefed; no need to release.
    //

    if ( FAILED(hr) )
    {
        LOG((MSP_ERROR, "CSampleMSP::ShutdownMSPCall - template helper returned"
            "0x%08x", hr));

        return hr;
    }

    LOG((MSP_TRACE, "CSampleMSP::ShutdownMSPCall - exit S_OK"));

    return S_OK;
}

The documentation for this class was generated from the following files:
  • NetDS/Tapi/Tapi3/Cpp/Msp/SampleMSP/SampAddr.h
  • NetDS/Tapi/Tapi3/Cpp/Msp/SampleMSP/SampAddr.Cpp
Generated on Wed Nov 13 2024 16:57:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSampleMSPCall Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CSampleMSPCall Class Reference

#include "SampCall.h"

List of all members.

Public Member Functions

CSampleMSPCall ()
virtual | ~CSampleMSPCall ()
STDMETHOD() | CreateStream (IN DWORD dwMediaType, IN TERMINAL_DIRECTION Direction, IN OUT ITStream **ppStream)
virtual HRESULT | CreateStreamObject (IN DWORD dwMediaType, IN TERMINAL_DIRECTION Direction, IN IMediaEvent *pGraph, IN ITStream **ppStream)
virtual HRESULT | Init (IN CMSPAddress *pMSPAddress, IN MSP_HANDLE htCall, IN DWORD dwReserved, IN DWORD dwMediaType)
virtual ULONG | MSPCallAddRef (void)
virtual ULONG | MSPCallRelease (void)
virtual HRESULT | ReceiveTSPCallData (IN PBYTE pBuffer, IN DWORD dwSize)
STDMETHOD() | RemoveStream (IN ITStream *pStream)

Protected Attributes

CSampleMSPStream * m_pCaptureStream
CSampleMSPStream * m_pRenderStream

Detailed Description

Definition at line 27 of file SampCall.h.

Constructor & Destructor Documentation

CSampleMSPCall::CSampleMSPCall ( )

Definition at line 21 of file SampCall.Cpp.

                               : CMSPCallMultiGraph()
{
    LOG((MSP_TRACE, "CSampleMSPCall::CSampleMSPCall entered."));
    LOG((MSP_TRACE, "CSampleMSPCall::CSampleMSPCall exited."));
}

CSampleMSPCall::~CSampleMSPCall ( ) [virtual]

Definition at line 31 of file SampCall.Cpp.

{
    LOG((MSP_TRACE, "CSampleMSPCall::~CSampleMSPCall entered."));
    LOG((MSP_TRACE, "CSampleMSPCall::~CSampleMSPCall exited."));
}

Member Function Documentation

STDMETHODIMP CSampleMSPCall::CreateStream | ( | IN DWORD | dwMediaType,
 |  | IN TERMINAL_DIRECTION | Direction,
 |  | IN OUT ITStream ** | ppStream
 | ) |  |

Definition at line 166 of file SampCall.Cpp.

{
    LOG((MSP_TRACE, "CSampleMSPCall::CreateStream entered."));
    LOG((MSP_TRACE, "CSampleMSPCall::CreateStream - "
        "we have a fixed set of streams - exit TAPI_E_MAXSTREAMS"));

    return TAPI_E_MAXSTREAMS;
}

HRESULT CSampleMSPCall::CreateStreamObject | ( | IN DWORD | dwMediaType,
 |  | IN TERMINAL_DIRECTION | Direction,
 |  | IN IMediaEvent * | pGraph,
 |  | IN ITStream ** | ppStream |
 | ) |  |  | [virtual]

Definition at line 205 of file SampCall.Cpp.

{
    LOG((MSP_TRACE, "CSampleMSPCall::CreateStreamObject - enter"));

    HRESULT hr;
    CMSPComObject<CSampleMSPStream> * pStream;

    hr = CMSPComObject<CSampleMSPStream>::CreateInstance( &pStream );

    if ( FAILED(hr) )
    {
        LOG((MSP_ERROR, "CSampleMSPCall::CreateStreamObject - "
            "can't create stream object - 0x%08x", hr));

        return hr;
    }

    hr = pStream->_InternalQueryInterface( IID_ITStream,
                                           (void **) ppStream );

    if ( FAILED(hr) )
    {
        LOG((MSP_ERROR, "CSampleMSPCall::CreateStreamObject - "
            "can't get ITStream interface - 0x%08x", hr));

        delete pStream;
        return hr;
    }

    hr = pStream->Init( (MSP_HANDLE) m_pMSPAddress,
                       this,
                       pGraph,
                       dwMediaType,
                       Direction);

    if ( FAILED(hr) )
    {
        LOG((MSP_ERROR, "CSampleMSPCall::CreateStreamObject - "
            "can't Init stream object - 0x%08x", hr));

        (*ppStream)->Release();
        return hr;
    }

    LOG((MSP_TRACE, "CSampleMSPCall::CreateStreamObject - exit S_OK"));
    return S_OK;
}

HRESULT CSampleMSPCall::Init | ( | IN CMSPAddress * | pMSPAddress,
 |  | IN MSP_HANDLE | htCall,
 |  | IN DWORD | dwReserved,
 |  | IN DWORD | dwMediaType |
 | ) |  |  | [virtual]

Definition at line 54 of file SampCall.Cpp.

{
    // No need to acquire locks on this call because it is called only
    // once when the object is created. No other calls can be made on
    // this object at this point.

    LOG((MSP_TRACE, "CSampleMSPCall::Init - enter"));

    //
    // First do the base class method. We are adding to the functionality,
    // not replacing it.
    //

    HRESULT hr;

    hr = CMSPCallMultiGraph::Init(pMSPAddress,
                                   htCall,
                                   dwReserved,
                                   dwMediaType);

    if (FAILED(hr))
    {
        LOG((MSP_ERROR, "CSampleMSPCall::Init - "
            "base class method failed: %x", hr));

        return hr;
    }

    //
    // Our calls always come with two streams. Create them now. Use the base class
    // methods, as our overriden methods (exposed to the user) purposely fail in order
    // to keep the user from creating or removing streams themselves.
    // These methods return a pointer to the ITStream. They get saved in our list of
    // ITStreams, and we also save them here as CSampleMSPStream pointers.
    //

    ITStream * pStream;

    //
    // Create the capture stream.
    //

    hr = InternalCreateStream (dwMediaType,
                               TD_CAPTURE,
                               &pStream);

    if (FAILED(hr))
    {
        LOG((MSP_ERROR, "CSampleMSPCall::Init - "
            "couldn't create capture stream: %x", hr));

        return hr;
    }

    m_pCaptureStream = dynamic_cast<CSampleMSPStream *> (pStream);

    if ( m_pCaptureStream == NULL )
    {
        LOG((MSP_ERROR, "CSampleMSPCall::Init - "
            "couldn't dynamic_cast capture stream - exit E_FAIL"));

        return E_FAIL;
    }

    pStream->Release();

    //
    // Create the render stream.
    //

    hr = InternalCreateStream (dwMediaType,
                               TD_RENDER,
                               &pStream);

    if (FAILED(hr))
    {
        LOG((MSP_ERROR, "CSampleMSPCall::Init - "
            "couldn't create capture stream: %x", hr));

        return hr;
    }

    m_pRenderStream = dynamic_cast<CSampleMSPStream *> (pStream);

    if ( m_pRenderStream == NULL )
    {
        LOG((MSP_ERROR, "CSampleMSPCall::Init - "
            "couldn't dynamic_cast render stream - exit E_FAIL"));

        return E_FAIL;
    }

    pStream->Release();

    LOG((MSP_TRACE, "CSampleMSPCall::Init - exit S_OK"));

    return S_OK;
}

ULONG CSampleMSPCall::MSPCallAddRef ( void ) [virtual]

Definition at line 37 of file SampCall.Cpp.

{
    return MSPAddRefHelper(this);
}

ULONG CSampleMSPCall::MSPCallRelease ( void ) [virtual]

Definition at line 42 of file SampCall.Cpp.

{
    return MSPReleaseHelper(this);
}

HRESULT CSampleMSPCall::ReceiveTSPCallData | ( | IN PBYTE | pBuffer,
 |  | IN DWORD | dwSize |
 | ) |  |  | [virtual]

Definition at line 296 of file SampCall.Cpp.

{
    LOG((MSP_TRACE, "CSampleMSPCall::ReceiveTSPCallData - enter"));

    //
    // Check that the buffer is as big as advertised.
    //

    if ( IsBadWritePtr(pBuffer, sizeof(BYTE) * dwSize) )
    {
        LOG((MSP_ERROR, "CSampleMSPCall::ReceiveTSPCallData - "
            "bad buffer - exit E_POINTER"));

        return E_POINTER;
    }

    //
    // Check if we have a command DWORD.
    //

    if ( dwSize < sizeof(DWORD) )
    {
        LOG((MSP_ERROR, "CSampleMSPCall::ReceiveTSPCallData - "
            "need a DWORD for command - exit E_INVALIDARG"));

        return E_INVALIDARG;
    }

    //
    // We are going to access the streams lists -- grab the lock
    //

    CLock lock(m_lock);

    _ASSERTE( m_Streams.GetSize() == 2 );

    HRESULT hr;

    //
    // Based on the command, take action:
    //

    switch ( ((DWORD *) pBuffer) [0] )
    {
    case 0: // configure the transports
        {
            //
            // In a real MSP, this sort of command would have meaningful
            // arguments that are passed to the streams. For our
            // purposes, let's just define this to have two DWORD
            // arguments and print what they are when we receive
            // the command.
            //

            if ( dwSize < 3 * sizeof(DWORD) )
            {
                LOG((MSP_ERROR, "CSampleMSPCall::ReceiveTSPCallData - "
                    "need 3 DWORDs for Config Transports command - "
                    "exit E_INVALIDARG"));

                return E_INVALIDARG;
            }
            LOG((MSP_INFO, "CSampleMSPCall::ReceiveTSPCallData - "
                "configuring transport - dword args %d, %d",
                ((DWORD *) pBuffer) [1],
                ((DWORD *) pBuffer) [2]));

            //
            // Use our saved class pointers to access the private method,
            // and also to conveniently differentiate between render and
            // capture. Note that the capture stream is the one with a
            // capture terminal, and the render stream is the one with the
            // render terminal, so the arguments would have to be matched
            // here based on the data from the buffer (if there were any).
            //

            hr = m_pCaptureStream->ConfigureTransport ( );

            if ( FAILED(hr) )
            {
                LOG((MSP_ERROR, "CSampleMSPCall::ReceiveTSPCallData - "
                    "capture stream ConfigureTransport failed 0x%08x - "
                    "firing CALL_STREAM_FAIL", hr));

                m_pCaptureStream->FireEvent(CALL_STREAM_FAIL, hr, CALL_CAUSE_UNKNOWN);
            }

            hr = m_pRenderStream ->ConfigureTransport( );

            if ( FAILED(hr) )
            {
                LOG((MSP_ERROR, "CSampleMSPCall::ReceiveTSPCallData - "
                    "render stream ConfigureTransport failed 0x%08x - "
                    "firing CALL_STREAM_FAIL", hr));

                m_pRenderStream->FireEvent(CALL_STREAM_FAIL, hr, CALL_CAUSE_UNKNOWN);
            }

        }
        break;

    case 1: // start streaming
        {
            hr = m_pCaptureStream ->StartStream();
            hr = m_pRenderStream  ->StartStream();
        }
        break;

    case 2: // stop streaming
        {
            hr = m_pCaptureStream ->StopStream();
            hr = m_pRenderStream  ->StopStream();
        }
        break;

    default:
        LOG((MSP_ERROR, "CSampleMSPCall::ReceiveTSPCallData - "
            "invalid command - exit E_INVALIDARG"));

        return E_INVALIDARG;

    }

    LOG((MSP_TRACE, "CSampleMSPCall::ReceiveTSPCallData - exit S_OK"));
    return S_OK;
}

STDMETHODIMP CSampleMSPCall::RemoveStream ( IN ITStream * pStream )

Definition at line 187 of file SampCall.Cpp.

{
    LOG((MSP_TRACE, "CSampleMSPCall::RemoveStream entered."));
    LOG((MSP_TRACE, "CSampleMSPCall::RemoveStream - "
        "we have a fixed set of streams - exit TAPI_E_NOTSUPPORTED"));

    return TAPI_E_NOTSUPPORTED;
}

Member Data Documentation

CSampleMSPStream* CSampleMSPCall::m_pCaptureStream [protected]

Definition at line 93 of file SampCall.h.

CSampleMSPStream* CSampleMSPCall::m_pRenderStream [protected]

Definition at line 92 of file SampCall.h.

The documentation for this class was generated from the following files:
  • NetDS/Tapi/Tapi3/Cpp/Msp/SampleMSP/SampCall.h
  • NetDS/Tapi/Tapi3/Cpp/Msp/SampleMSP/SampCall.Cpp
Generated on Wed Nov 13 2024 16:57:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSampleMSPStream Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes | Private Member Functions

CSampleMSPStream Class Reference

#include "SampStrm.h"

List of all members.

Public Member Functions

CSampleMSPStream ()
virtual | ~CSampleMSPStream ()
virtual HRESULT | ConfigureTransport (void)
virtual void | FinalRelease ()
virtual HRESULT | FireEvent (IN MSP_CALL_EVENT type, IN HRESULT hrError, IN MSP_CALL_EVENT_CAUSE cause)
STDMETHOD() | get_Name (OUT BSTR *ppName)
STDMETHOD() | PauseStream ()
virtual HRESULT | ProcessGraphEvent (IN long lEventCode, IN long lParam1, IN long lParam2)
STDMETHOD() | SelectTerminal (IN ITTerminal *pTerminal)
STDMETHOD() | StartStream ()
STDMETHOD() | StopStream ()
STDMETHOD() | UnselectTerminal (IN ITTerminal *pTerminal)

Protected Attributes

FILTER_STATE m_ActualGraphState
FILTER_STATE m_DesiredGraphState
BOOL m_fTerminalConnected
BOOL m_fTransportConfigured

Private Member Functions

HRESULT | ConnectTerminal (ITTerminal *pTerminal)
HRESULT | ConnectToTerminalPin (IPin *pTerminalPin)

Detailed Description

Definition at line 26 of file SampStrm.h.

Constructor & Destructor Documentation

CSampleMSPStream::CSampleMSPStream ( )

Definition at line 21 of file SampStrm.Cpp.

                                   : CMSPStream()
{
    LOG((MSP_TRACE, "CSampleMSPStream::CSampleMSPStream entered."));

    m_fTransportConfigured = FALSE;
    m_fTerminalConnected   = FALSE;
    m_DesiredGraphState    = State_Stopped;
    m_ActualGraphState     = State_Stopped;

    //
    // INSERT HERE: initialize other data members
    //

    LOG((MSP_TRACE, "CSampleMSPStream::CSampleMSPStream exited."));
}

CSampleMSPStream::~CSampleMSPStream ( ) [virtual]

Definition at line 41 of file SampStrm.Cpp.

{
    LOG((MSP_TRACE, "CSampleMSPStream::~CSampleMSPStream entered."));
    LOG((MSP_TRACE, "CSampleMSPStream::~CSampleMSPStream exited."));
}

Member Function Documentation

HRESULT CSampleMSPStream::ConfigureTransport ( void ) [virtual]

Definition at line 657 of file SampStrm.Cpp.

{
    LOG((MSP_TRACE, "CSampleMSPStream::ConfigureTransport - enter"));

    CLock lock(m_lock);

    //
    // INSERT HERE:
    // * create the transport filter(s)
    // * configure the transport filter(s) based on passe-in info
    // * add filters to our graph
    // * if some transport filters always need to be connected together
    //   (irrespective of what terminals are used, etc.) then they can be
    //   connected now).
    //

    m_fTransportConfigured = TRUE;

    LOG((MSP_TRACE, "CSampleMSPStream::ConfigureTransport - exit S_OK"));

    return S_OK;
}

HRESULT CSampleMSPStream::ConnectTerminal ( ITTerminal * pTerminal ) [private]

Definition at line 687 of file SampStrm.Cpp.

{
    LOG((MSP_TRACE, "CSampleMSPStream::ConnectTerminal - enter"));

    //
    // Find out the terminal's internal state.
    //

    TERMINAL_STATE state;
    HRESULT hr;

    hr = pTerminal->get_State( &state );

    if ( FAILED(hr) )
    {
        LOG((MSP_ERROR, "CSampleMSPStream::ConnectTerminal - "
            "get_State on terminal failed - exit 0x%08x", hr));

        return hr;
    }

    //
    // If we've already connected the terminal on this stream, then
    // there is nothing for us to do. Just assert that the terminal
    // also thinks it's connected.
    //

    if ( m_fTerminalConnected )
    {
        _ASSERTE( state == TS_INUSE );

        LOG((MSP_ERROR, "CSampleMSPStream::ConnectTerminal - "
            "terminal already connected on this stream - exit S_OK"));

        return S_OK;
    }

    //
    // Otherwise we need to connect the terminal on this call. If the
    // terminal is already connected on another call, we must fail. Note
    // that since we are making several calls on the terminal here, the
    // terminal could become connected on another call while we are
    // in the process of doing this. If this happens, the we will just fail
    // later.
    //

    if ( state == TS_INUSE )
    {
        LOG((MSP_ERROR, "CSampleMSPStream::ConnectTerminal - "
            "terminal in use - exit TAPI_E_TERMINALINUSE"));

        return TAPI_E_TERMINALINUSE;
    }

    //
    // Get the ITTerminalControl interface.
    //

    ITTerminalControl * pTerminalControl;

    hr = m_Terminals[0]->QueryInterface(IID_ITTerminalControl,
                                        (void **) &pTerminalControl);

    if ( FAILED(hr) )
    {
        LOG((MSP_ERROR, "CSampleMSPStream::ConnectTerminal - "
            "QI for ITTerminalControl failed - exit 0x%08x", hr));

        return hr;
    }

    //
    // Find out how many pins the terminal has. If not one then bail as
    // we have no idea what to do with multiple-pin terminals (we don't
    // expose any such terminals from this MSP).
    //

    DWORD dwNumPinsAvailable;

    hr = pTerminalControl->ConnectTerminal(m_pIGraphBuilder,
                                           0,
                                           &dwNumPinsAvailable,
                                           NULL);

    if ( FAILED(hr) )
    {
        LOG((MSP_ERROR, "CSampleMSPStream::ConnectTerminal - "
            "query for number of terminal pins failed - exit 0x%08x", hr));

        pTerminalControl->Release();

        return hr;
    }

    if ( 1 != dwNumPinsAvailable )
    {
        LOG((MSP_ERROR, "CSampleMSPStream::ConnectTerminal - "
            "unsupported number of terminal pins - exit E_FAIL"));

        pTerminalControl->Release();

        return E_FAIL;
    }

    //
    // Actually connect the terminal.
    //

    IPin * pTerminalPin;

    hr = pTerminalControl->ConnectTerminal(m_pIGraphBuilder,
                                           0,
                                           &dwNumPinsAvailable,
                                           &pTerminalPin);

    if ( FAILED(hr) )
    {
        pTerminalControl->Release();

        LOG((MSP_ERROR, "CSampleMSPStream::ConnectTerminal - "
            "ConnectTerminal on terminal failed - exit 0x%08x", hr));

        return hr;
    }

    //
    // Make the connection between our filters and the terminal's pin.
    //

    hr = ConnectToTerminalPin(pTerminalPin);

    pTerminalPin->Release();

    if ( FAILED(hr) )
    {
        pTerminalControl->DisconnectTerminal(m_pIGraphBuilder, 0);

        pTerminalControl->Release();

        LOG((MSP_ERROR, "CSampleMSPStream::ConnectTerminal - "
            "ConnectToTerminalPin failed - exit 0x%08x", hr));

        return hr;
    }

    //
    // Now we are actually connected. Update our state and perform postconnection
    // (ignore postconnection error code).
    //

    m_fTerminalConnected  = TRUE;

    pTerminalControl->CompleteConnectTerminal();

    pTerminalControl->Release();

    LOG((MSP_TRACE, "CSampleMSPStream::ConnectTerminal - exit S_OK"));

    return S_OK;
}

HRESULT CSampleMSPStream::ConnectToTerminalPin ( IPin * pTerminalPin ) [private]

Definition at line 852 of file SampStrm.Cpp.

{
    LOG((MSP_TRACE, "CSampleMSPStream::ConnectToTerminalPin - enter"));

    //
    // INSERT HERE: Code to connect the terminal's pin to some pin on some
    // transport filter belonging to the stream. See the documentation on
    // DirectShow in the Windows SDK for help.
    //

    LOG((MSP_TRACE, "CSampleMSPStream::ConnectToTerminalPin - exit S_OK"));

    return S_OK;
}

void CSampleMSPStream::FinalRelease ( ) [virtual]

Definition at line 51 of file SampStrm.Cpp.

{
    LOG((MSP_TRACE, "CSampleMSPStream::FinalRelease entered."));

    //
    // At this point we should have no terminals selected, since
    // Shutdown is supposed to be called before we are destructed.
    //

    _ASSERTE( 0 == m_Terminals.GetSize() );

    if ( m_fTransportConfigured )
    {
        //
        // INSERT HERE: Remove our transport filters from the graph and
        // release them.
        //
    }

    //
    // Call the base class method to clean up everything else.
    //

    CMSPStream::FinalRelease();

    LOG((MSP_TRACE, "CSampleMSPStream::FinalRelease exited."));
}

HRESULT CSampleMSPStream::FireEvent | ( | IN MSP_CALL_EVENT | type,
 |  | IN HRESULT | hrError,
 |  | IN MSP_CALL_EVENT_CAUSE | cause |
 | ) |  |  | [virtual]

Definition at line 938 of file SampStrm.Cpp.

{
    LOG((MSP_EVENT, "CSampleMSPStream::FireEvent - enter"));

    //
    // Create the event structure.
    //

    //
    // Note:
    //
    // MSPEVENTITEMs are allocated with AllocateEventItem and freed with
    // FreeEventItem
    //
    // AllocateEventItem takes an optional argument that specifies how many
    // extra bytes need to be allocated in addition to the size of MSPEVENTITEM
    //

    MSPEVENTITEM * pEventItem = AllocateEventItem();

    if (pEventItem == NULL)
    {
        LOG((MSP_ERROR, "CSampleMSPStream::FireEvent - "
            "can't create MSPEVENTITEM structure - exit E_OUTOFMEMORY"));

        return E_OUTOFMEMORY;
    }

    //
    // Fill in the necessary fields for the event structure.
    //

    pEventItem->MSPEventInfo.dwSize = sizeof(MSP_EVENT_INFO);
    pEventItem->MSPEventInfo.Event  = ME_CALL_EVENT;

    ITTerminal * pTerminal = NULL;

    if ( 0 != m_Terminals.GetSize() )
    {
        _ASSERTE( 1 == m_Terminals.GetSize() );
        pTerminal = m_Terminals[0];
        pTerminal->AddRef();
    }

    ITStream * pStream = (ITStream *) this;
    pStream->AddRef();

    pEventItem->MSPEventInfo.MSP_CALL_EVENT_INFO.Type      = type;
    pEventItem->MSPEventInfo.MSP_CALL_EVENT_INFO.Cause     = cause;
    pEventItem->MSPEventInfo.MSP_CALL_EVENT_INFO.pStream   = pStream;
    pEventItem->MSPEventInfo.MSP_CALL_EVENT_INFO.pTerminal = pTerminal;
    pEventItem->MSPEventInfo.MSP_CALL_EVENT_INFO.hrError   = hrError;

#ifdef MSPLOG
    //
    // Spew some debug output to indicate what this is.
    //

    char * pszType;
    DWORD dwLevel;

    switch (type)
    {
    case CALL_NEW_STREAM:
        pszType = "CALL_NEW_STREAM (unexpected)";
        dwLevel = MSP_ERROR;
        break;

    case CALL_STREAM_FAIL:
        pszType = "CALL_STREAM_FAIL";
        dwLevel = MSP_INFO;
        break;

    case CALL_TERMINAL_FAIL:
        pszType = "CALL_TERMINAL_FAIL";
        dwLevel = MSP_INFO;
        break;

    case CALL_STREAM_NOT_USED:
        pszType = "CALL_STREAM_NOT_USED (unexpected)";
        dwLevel = MSP_ERROR;
        break;

    case CALL_STREAM_ACTIVE:
        pszType = "CALL_STREAM_ACTIVE";
        dwLevel = MSP_INFO;
        break;

    case CALL_STREAM_INACTIVE:
        pszType = "CALL_STREAM_INACTIVE";
        dwLevel = MSP_INFO;
        break;

    default:
        pszType = "UNKNOWN EVENT TYPE";
        dwLevel = MSP_ERROR;
        break;
    }

    LOG((dwLevel, "CSampleMSPStream::FireEvent - "
                  "EVENT DUMP: type      = %s", pszType));
    LOG((dwLevel, "CSampleMSPStream::FireEvent - "
                  "EVENT DUMP: pStream   = %p", pStream));
    LOG((dwLevel, "CSampleMSPStream::FireEvent - "
                  "EVENT DUMP: pTerminal = %p", pTerminal));
    LOG((dwLevel, "CSampleMSPStream::FireEvent - "
                  "EVENT DUMP: hrError   = %08x", hrError));

#endif // ifdef MSPLOG

    //
    // Send the event to the app.
    //

    HRESULT hr = m_pMSPCall->HandleStreamEvent(pEventItem);

    if (FAILED(hr))
    {
        LOG((MSP_ERROR, "CSampleMSPStream::FireEvent - "
            "HandleStreamEvent failed - returning 0x%08x", hr));

        pStream->Release();
        pTerminal->Release();

        //
        // Note:
        //
        // MSPEVENTITEMs are allocated with AllocateEventItem and freed with
        // FreeEventItem
        //

        FreeEventItem(pEventItem);
        pEventItem = NULL;

        return hr;
    }

    LOG((MSP_EVENT, "CSampleMSPStream::FireEvent - exit S_OK"));

    return S_OK;
}

STDMETHODIMP CSampleMSPStream::get_Name ( OUT BSTR * ppName )

Definition at line 83 of file SampStrm.Cpp.

{
    LOG((MSP_TRACE, "CSampleMSPStream::get_Name - enter"));

    //
    // Check argument.
    //

    if ( IsBadWritePtr(ppName, sizeof(BSTR) ) )
    {
        LOG((MSP_TRACE, "CSampleMSPStream::get_Name - "
            "bad return pointer - returning E_POINTER"));

        return E_POINTER;
    }

    //
    // Decide what string to return based on which stream this is.
    //

    ULONG ulID;

    if ( m_Direction == TD_CAPTURE )
    {
        ulID = IDS_CAPTURE_STREAM;
    }
    else
    {
        ulID = IDS_RENDER_STREAM;
    }

    //
    // Get the string from the string table.
    //

    const int   ciAllocSize = 2048;
    WCHAR       wszName[ciAllocSize];

    int iReturn = LoadString( _Module.GetModuleInstance(),
                              ulID,
                              wszName,
                              ciAllocSize - 1 );

    if ( iReturn == 0 )
    {
        _ASSERTE( FALSE );

        *ppName = NULL;

        LOG((MSP_ERROR, "CSampleMSPStream::get_Name - "
            "LoadString failed - returning E_UNEXPECTED"));

        return E_UNEXPECTED;
    }

    //
    // Convert to a BSTR and return the BSTR.
    //

    *ppName = SysAllocString(wszName);

    if ( *ppName == NULL )
    {
        LOG((MSP_ERROR, "CSampleMSPStream::get_Name - "
            "SysAllocString failed - returning E_OUTOFMEMORY"));

        return E_OUTOFMEMORY;
    }

    LOG((MSP_TRACE, "CSampleMSPStream::get_Name - exit S_OK"));

    return S_OK;
}

STDMETHODIMP CSampleMSPStream::PauseStream ( void )

Definition at line 462 of file SampStrm.Cpp.

{
    LOG((MSP_TRACE, "CSampleMSPStream::PauseStream - enter"));

    CLock lock(m_lock);

    m_DesiredGraphState = State_Paused;

    //
    // Can't pause the stream if our transport filters are not configured.
    //

    if ( ! m_fTransportConfigured )
    {
        LOG((MSP_WARN, "CSampleMSPStream::PauseStream - "
            "transport not configured so nothing to do yet - exit S_OK"));

        return S_OK;
    }

    //
    // Can't pause the stream if no terminal has been selected.
    //

    if ( 0 == m_Terminals.GetSize() )
    {
        LOG((MSP_WARN, "CSampleMSPStream::PauseStream - "
            "no Terminal so nothing to do yet - exit S_OK"));

        return S_OK;
    }

    //
    // Connect the terminal. This does nothing if this call already
    // connected the terminal and fails if another call has the
    // terminal connected.
    //

    HRESULT hr;

    hr = ConnectTerminal(m_Terminals[0]);

    if ( FAILED(hr) )
    {
        FireEvent(CALL_TERMINAL_FAIL, hr, CALL_CAUSE_CONNECT_FAIL);
        FireEvent(CALL_STREAM_FAIL, hr, CALL_CAUSE_CONNECT_FAIL);

        LOG((MSP_ERROR, "CSampleMSPStream::StartStream - "
            "our ConnectTerminal failed - exit 0x%08x", hr));

        return hr;
    }

    //
    // Pause the stream via the base class method.
    //

    hr = CMSPStream::PauseStream();

    if ( FAILED(hr) )
    {
        //
        // Failed to pause -- tell the app.
        //

        FireEvent(CALL_STREAM_FAIL, hr, CALL_CAUSE_UNKNOWN);

        LOG((MSP_ERROR, "CSampleMSPStream::PauseStream - "
            "Pause failed - exit 0x%08x", hr));

        return hr;
    }

    //
    // Fire event if this just made us inactive.
    //

    if ( m_ActualGraphState == State_Running )
    {
        HRESULT hr2 = FireEvent(CALL_STREAM_INACTIVE, hr, CALL_CAUSE_LOCAL_REQUEST);

        if ( FAILED(hr2) )
        {
            m_ActualGraphState = State_Paused;

            LOG((MSP_ERROR, "CSampleMSPStream::PauseStream - "
                "FireEvent failed - exit 0x%08x", hr2));

            return hr2;
        }
    }

    m_ActualGraphState = State_Paused;

    LOG((MSP_TRACE, "CSampleMSPStream::PauseStream - exit S_OK"));

    return S_OK;
}

HRESULT CSampleMSPStream::ProcessGraphEvent | ( | IN long | lEventCode,
 |  | IN long | lParam1,
 |  | IN long | lParam2 |
 | ) |  |  | [virtual]

Definition at line 879 of file SampStrm.Cpp.

{
    LOG((MSP_EVENT, "CSampleMSPStream::ProcessGraphEvent - enter"));

    HRESULT        hr = S_OK;

    switch (lEventCode)
    {
    case EC_COMPLETE:

        hr = FireEvent(CALL_STREAM_INACTIVE, (HRESULT) lParam1, CALL_CAUSE_UNKNOWN);
        break;

    case EC_USERABORT:

        hr = FireEvent(CALL_STREAM_INACTIVE, S_OK, CALL_CAUSE_UNKNOWN);
        break;

    case EC_ERRORABORT:
    case EC_STREAM_ERROR_STOPPED:
    case EC_STREAM_ERROR_STILLPLAYING:
    case EC_ERROR_STILLPLAYING:

        hr = FireEvent(CALL_STREAM_FAIL, (HRESULT) lParam1, CALL_CAUSE_UNKNOWN);
        break;

    default:

        LOG((MSP_EVENT, "CSampleMSPStream::ProcessGraphEvent - "
            "ignoring event code %d", lEventCode));
        break;
    }

    if ( FAILED(hr) )
    {
        LOG((MSP_ERROR, "CSampleMSPStream::ProcessGraphEvent - "
            "FireEvent failed - exit 0x%08x", hr));

        return hr;
    }

    LOG((MSP_EVENT, "CSampleMSPStream::ProcessGraphEvent - exit S_OK"));

    return S_OK;
}

STDMETHODIMP CSampleMSPStream::SelectTerminal ( IN ITTerminal * pTerminal )

Definition at line 166 of file SampStrm.Cpp.

{
    LOG((MSP_TRACE, "CSampleMSPStream::SelectTerminal - enter"));

    //
    // We are going to access the terminal list -- grab the lock
    //

    CLock lock(m_lock);

    //
    // Reject if we already have a terminal selected.
    //

    if ( 0 != m_Terminals.GetSize() )
    {
        LOG((MSP_ERROR, "CSampleMSPStream::SelectTerminal - "
            "exit TAPI_E_MAXTERMINALS"));

        return TAPI_E_MAXTERMINALS;
    }

    //
    // Use base class method to add it to our list of terminals.
    //

    HRESULT hr = CMSPStream::SelectTerminal(pTerminal);

    if ( FAILED(hr) )
    {
        LOG((MSP_ERROR, "CSampleMSPStream::SelectTerminal - "
            "base class method failed - exit 0x%08x", hr));

        return hr;
    }

    //
    // Re-pause or re-start the stream if needed.
    //

    if ( m_DesiredGraphState == State_Paused )
    {
        hr = PauseStream();
    }
    else if ( m_DesiredGraphState == State_Running )
    {
        hr = StartStream();
    }
    else
    {
        _ASSERTE( m_DesiredGraphState == State_Stopped );

        hr = S_OK;
    }

    if ( FAILED(hr) )
    {
        LOG((MSP_TRACE, "CSampleMSPStream::SelectTerminal - "
            "can't regain old graph state - unselecting terminal - "
            "exit 0x%08x", hr));

    //
    // Unselect it to undo all of the above.
    //

      UnselectTerminal(pTerminal);

        return hr;
    }

    LOG((MSP_TRACE, "CSampleMSPStream::SelectTerminal - exit S_OK"));

    return S_OK;
}

STDMETHODIMP CSampleMSPStream::StartStream ( void )

Definition at line 361 of file SampStrm.Cpp.

{
    LOG((MSP_TRACE, "CSampleMSPStream::StartStream - enter"));

    CLock lock(m_lock);

    m_DesiredGraphState = State_Running;

    //
    // Can't start the stream if our transport filters are not configured.
    //

    if ( ! m_fTransportConfigured )
    {
        LOG((MSP_WARN, "CSampleMSPStream::PauseStream - "
            "transport not configured so nothing to do yet - exit S_OK"));

        return S_OK;
    }

    //
    // Can't start the stream if no terminal has been selected.
    //

    if ( 0 == m_Terminals.GetSize() )
    {
        LOG((MSP_WARN, "CSampleMSPStream::StartStream - "
            "no Terminal so nothing to do yet - exit S_OK"));

        return S_OK;
    }

    //
    // Connect the terminal. This does nothing if this call already
    // connected the terminal and fails if another call has the
    // terminal connected.
    //

    HRESULT hr;

    hr = ConnectTerminal(m_Terminals[0]);

    if ( FAILED(hr) )
    {
        FireEvent(CALL_TERMINAL_FAIL, hr, CALL_CAUSE_CONNECT_FAIL);
        FireEvent(CALL_STREAM_FAIL, hr, CALL_CAUSE_CONNECT_FAIL);

        LOG((MSP_ERROR, "CSampleMSPStream::StartStream - "
            "our ConnectTerminal failed - exit 0x%08x", hr));

        return hr;
    }

    //
    // Run the stream via the base class method.
    //

    hr = CMSPStream::StartStream();

    if ( FAILED(hr) )
    {
        //
        // Failed to run -- tell the app.
        //

        FireEvent(CALL_STREAM_FAIL, hr, CALL_CAUSE_UNKNOWN);

        LOG((MSP_ERROR, "CSampleMSPStream::StartStream - "
            "Run failed - exit 0x%08x", hr));

        return hr;
    }

    //
    // Fire event if this just made us active.
    //

    if ( m_ActualGraphState != State_Running )
    {
        m_ActualGraphState = State_Running;

        HRESULT hr2 = FireEvent(CALL_STREAM_ACTIVE, hr, CALL_CAUSE_LOCAL_REQUEST);

        if ( FAILED(hr2) )
        {
            LOG((MSP_ERROR, "CSampleMSPStream::StartStream - "
                "FireEvent failed - exit 0x%08x", hr2));

            return hr2;
        }
    }

    LOG((MSP_TRACE, "CSampleMSPStream::StartStream - exit S_OK"));

    return S_OK;
}

STDMETHODIMP CSampleMSPStream::StopStream ( void )

Definition at line 565 of file SampStrm.Cpp.

{
    LOG((MSP_TRACE, "CSampleMSPStream::StopStream - enter"));

    CLock lock(m_lock);

    m_DesiredGraphState = State_Stopped;

    //
    // Nothing to do if our transport is not configured.
    //

    if ( ! m_fTransportConfigured )
    {
        LOG((MSP_WARN, "CSampleMSPStream::StopStream - "
            "transport not configured - exit S_OK"));

        return S_OK;
    }

    //
    // Nothing to do if no terminal has been selected.
    //

    if ( 0 == m_Terminals.GetSize() )
    {
        LOG((MSP_WARN, "CSampleMSPStream::StopStream - "
            "no Terminal - exit S_OK"));

        return S_OK;
    }

    //
    // Stop the stream via the base class method.
    //

    HRESULT hr;

    hr = CMSPStream::StopStream();

    if ( FAILED(hr) )
    {
        //
        // Failed to stop -- tell the app.
        //

        FireEvent(CALL_STREAM_FAIL, hr, CALL_CAUSE_UNKNOWN);

        m_DesiredGraphState = m_ActualGraphState;

        LOG((MSP_ERROR, "CSampleMSPStream::StopStream - "
            "Stop failed - exit 0x%08x", hr));

        return hr;
    }

    //
    // Fire event if this just made us inactive.
    //

    if ( m_ActualGraphState == State_Running )
    {
        HRESULT hr2 = FireEvent(CALL_STREAM_INACTIVE, hr, CALL_CAUSE_LOCAL_REQUEST);

        if ( FAILED(hr2) )
        {
            m_ActualGraphState = State_Stopped;

            LOG((MSP_ERROR, "CSampleMSPStream::StopStream - "
                "FireEvent failed - exit 0x%08x", hr2));

            return hr2;
        }
    }

    m_ActualGraphState = State_Stopped;

    LOG((MSP_TRACE, "CSampleMSPStream::StopStream - exit S_OK"));

    return S_OK;
}

STDMETHODIMP CSampleMSPStream::UnselectTerminal ( IN ITTerminal * pTerminal )

Definition at line 247 of file SampStrm.Cpp.

{
    LOG((MSP_TRACE, "CSampleMSPStream::UnselectTerminal - enter"));

    CLock lock(m_lock);

    //
    // Use base class method to remove terminal from our list of terminals.
    //
    // Note: the failure cases are messy here. In this sample implementation
    // we choose to return an error code but release our reference to the
    // terminal when disconnection fails. This is typically better than
    // keeping our reference to the terminal, which would cause us to leak
    // the terminal whenever disconnection fails.
    //

    HRESULT hr = CMSPStream::UnselectTerminal(pTerminal);

    if (FAILED(hr))
    {
        LOG((MSP_ERROR, "CSampleMSPStream::UnselectTerminal - "
            "base class method failed - exit 0x%08x", hr));

        return hr;
    }

    //
    // Stop the graph and disconnect the terminal if this call had it
    // connected. (We need a stopped graph to disconnect properly, and
    // couldn't have started the graph if the terminal isn't connected.)
    //

    if ( m_fTerminalConnected )
    {
        //
        // At this point we need to make sure the stream is stopped.
        // We can't use our own StopStream method because it
        // (1) changes the desired graph state to Stopped and
        // (2) does nothing if no terminal has been selected (which it now
        //     thinks is the case)
        //

        _ASSERTE( m_fTransportConfigured );

        //
        // Stop the stream via the base class method.
        //

        hr = CMSPStream::StopStream();

        m_ActualGraphState = State_Stopped;

        if ( FAILED(hr) )
        {
            LOG((MSP_ERROR, "CSampleMSPStream::UnselectTerminal - "
                "Stop failed - 0x%08x", hr));

            // don't return hr -- we really want to continue and
            // disconnect if we can!
        }

        //
        // Get the ITTerminalControl interface.
        //

        ITTerminalControl * pTerminalControl;

        hr = pTerminal->QueryInterface(IID_ITTerminalControl,
                                       (void **) &pTerminalControl);

        if ( FAILED(hr) )
        {
            LOG((MSP_ERROR, "CSampleMSPStream::UnselectTerminal - "
                "QI for ITTerminalControl failed - exit 0x%08x", hr));

            return hr;
        }

        //
        // Disconnect the terminal.
        //

        hr = pTerminalControl->DisconnectTerminal(m_pIGraphBuilder, 0);

        pTerminalControl->Release();

        m_fTerminalConnected = FALSE;

        if ( FAILED(hr) )
        {
            LOG((MSP_ERROR, "CSampleMSPStream::UnselectTerminal - "
                "DisconnectTerminal failed - exit 0x%08x", hr));

            return hr;
        }

        //
        // INSERT HERE: Additional disconnection may be needed, for example
        // for transport fitlers or transform filters that need to be
        // used for some terminals but not for others.
        //
    }

    LOG((MSP_TRACE, "CSampleMSPStream::UnselectTerminal - exit S_OK"));

    return S_OK;
}

Member Data Documentation

FILTER_STATE CSampleMSPStream::m_ActualGraphState [protected]

Definition at line 118 of file SampStrm.h.

FILTER_STATE CSampleMSPStream::m_DesiredGraphState [protected]

Definition at line 117 of file SampStrm.h.

BOOL CSampleMSPStream::m_fTerminalConnected [protected]

Definition at line 116 of file SampStrm.h.

BOOL CSampleMSPStream::m_fTransportConfigured [protected]

Definition at line 115 of file SampStrm.h.

The documentation for this class was generated from the following files:
  • NetDS/Tapi/Tapi3/Cpp/Msp/SampleMSP/SampStrm.h
  • NetDS/Tapi/Tapi3/Cpp/Msp/SampleMSP/SampStrm.Cpp
Generated on Wed Nov 13 2024 16:57:17 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSamplePipe Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CSamplePipe Class Reference

#include "pipe.hxx"

List of all members.

Public Member Functions

CSamplePipe ()
~CSamplePipe ()
STDMETHODIMP | Pull (long *buf, ULONG cRequest, ULONG *pcReturned)
STDMETHODIMP | Push (long *buf, ULONG cSent)
STDMETHODIMP | QueryInterface (REFIID iid, void **ppv)
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP_ (ULONG) Release(void)

Protected Attributes

LONG | m_cRef
DWORD m_dwInPipeSent
DWORD m_dwOutPipeRcvd
ULONG m_nPullSeq
ULONG m_nPushSeq
LONG * | m_pBuffer

Detailed Description

Definition at line 24 of file pipe.hxx.

Constructor & Destructor Documentation

CSamplePipe::CSamplePipe ( )

Definition at line 100 of file pipe.cxx.

                         :
   m_cRef(1), m_nPushSeq(0), m_nPullSeq(0),
   m_pBuffer(NULL),
   m_dwOutPipeRcvd(0), m_dwInPipeSent(0)
{
};

CSamplePipe::~CSamplePipe ( )

Definition at line 107 of file pipe.cxx.

{
   delete m_pBuffer;
};

Member Function Documentation

STDMETHODIMP CSamplePipe::Pull | ( | long * | buf,
 |  | ULONG | cRequest,
 |  | ULONG * | pcReturned
 | ) |  |

Definition at line 150 of file pipe.cxx.

{
   HRESULT     hr=S_OK;
   DWORD       dwElementsAvailable = BUF_SIZE; // Should really be a member variable
   ULONG        lElements;

   //cout << "Pull being called on the pipe" << endl;

   *pcReturned = 0;

   // Adjust the number of elements we actually return
   lElements = dwElementsAvailable - m_dwInPipeSent;
   if( lElements < 0 )
       lElements = 0;

   if( lElements > cRequest )
       lElements = cRequest;

   // Fill the buffer
   hr = PopulateBuffer(buf, (DWORD) lElements, m_dwInPipeSent);
   if( FAILED(hr) )
   {
        //cout << "Populate buffer failed" << endl;
  return hr;
   }

   // Set elements count
   *pcReturned = (DWORD) lElements;
   m_dwInPipeSent += lElements;

   //cout << "cRequested = " << cRequest << " and Returned = " << lElements
   //   << endl << endl ;

   if ( 0 == lElements)
   {
      m_dwInPipeSent = 0;
      //cout << "!WARNING! The pipe is drained .. Returning 0 count.."
      //    << " Pull sequence #" << m_nPullSeq << " is over" << endl << endl;
      m_nPullSeq++;
   }

   return S_OK;
}

STDMETHODIMP CSamplePipe::Push | ( | long * | buf,
 |  | ULONG | cSent
 | ) |  |

Definition at line 195 of file pipe.cxx.

{
   HRESULT hr=S_OK;

   //cout << "Push being called on the pipe" << endl;
   //cout << "cSent = " << cSent << " and Received before this = " << m_dwOutPipeRcvd
   //     << endl << endl;

   hr = DrainBuffer(buf, cSent, m_dwOutPipeRcvd);
   if( FAILED(hr) )
   {
       //cout << "Unable to push the data received to the buffer !!" << endl;
       return hr;
   }

   if ( 0 == cSent )
   {
       m_dwOutPipeRcvd = 0;
       //cout << "!WARNING! 0 count received at the push side.."
       //     << " Push sequence #" << m_nPushSeq << " is over."
       //     << endl << endl;
       m_nPushSeq++;
   }
   else
   {
       // Inc count for number of elems received.
       m_dwOutPipeRcvd += cSent;
   }

   return hr;
}

STDMETHODIMP CSamplePipe::QueryInterface | ( | REFIID | iid,
 |  | void ** | ppv
 | ) |  |

Definition at line 112 of file pipe.cxx.

{

    *ppv = NULL;

    if (IsEqualIID(IID_IPipeLong, riid))
    {
        *ppv = static_cast<IPipeLong *>(this);
    }
    else if (IsEqualIID(IID_IUnknown, riid))
    {
        *ppv = static_cast<IPipeLong *>(this);
    }
    else
    {
      return E_NOINTERFACE;
    }

   reinterpret_cast<IUnknown*>(*ppv)->AddRef();
   return S_OK;
};

CSamplePipe::STDMETHODIMP_ ( ULONG )
CSamplePipe::STDMETHODIMP_ ( ULONG )

Member Data Documentation

LONG CSamplePipe::m_cRef [protected]

Definition at line 27 of file pipe.hxx.

DWORD CSamplePipe::m_dwInPipeSent [protected]

Definition at line 31 of file pipe.hxx.

DWORD CSamplePipe::m_dwOutPipeRcvd [protected]

Definition at line 30 of file pipe.hxx.

ULONG CSamplePipe::m_nPullSeq [protected]

Definition at line 28 of file pipe.hxx.

ULONG CSamplePipe::m_nPushSeq [protected]

Definition at line 28 of file pipe.hxx.

LONG* CSamplePipe::m_pBuffer [protected]

Definition at line 29 of file pipe.hxx.

The documentation for this class was generated from the following files:
  • Com/Fundamentals/Pipes/Include/pipe.hxx
  • Com/Fundamentals/Pipes/Include/pipe.cxx
Generated on Wed Nov 13 2024 16:57:17 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSampleStemmer Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CSampleStemmer Class Reference

#include "lrsample.HXX"

List of all members.

Public Member Functions

CSampleStemmer ()
~CSampleStemmer ()
ULONG STDMETHODCALLTYPE | AddRef ()
HRESULT STDMETHODCALLTYPE | GenerateWordForms (WCHAR const *pwcInBuf, ULONG cwc, IWordFormSink *pWordFormSink)
HRESULT STDMETHODCALLTYPE | GetLicenseToUse (const WCHAR **ppwcsLicense)
HRESULT STDMETHODCALLTYPE | Init (ULONG ulMaxTokenSize, BOOL *pfLicense)
HRESULT STDMETHODCALLTYPE | QueryInterface (REFIID riid, void **ppvObject)
ULONG STDMETHODCALLTYPE | Release ()

Private Attributes

long | _cRefs

Detailed Description

Definition at line 208 of file lrsample.HXX.

Constructor & Destructor Documentation

CSampleStemmer::CSampleStemmer ( ) [inline]

Definition at line 272 of file lrsample.HXX.

                     : _cRefs( 1 )
    {
        InterlockedIncrement( &g_cInstances );
    }

CSampleStemmer::~CSampleStemmer ( ) [inline]

Definition at line 277 of file lrsample.HXX.

    {
        InterlockedDecrement( &g_cInstances );
    }

Member Function Documentation

ULONG STDMETHODCALLTYPE CSampleStemmer::AddRef ( void ) [inline]

Definition at line 232 of file lrsample.HXX.

    {
        return InterlockedIncrement( &_cRefs );
    }

HRESULT STDMETHODCALLTYPE CSampleStemmer::GenerateWordForms | ( | WCHAR const * | pwcInBuf,
 |  | ULONG | cwc,
 |  | IWordFormSink * | pWordFormSink
 | ) |  |

Definition at line 529 of file lrsample.CXX.

{
    // Validate the arguments

    if ( ( 0 == pwcInBuf ) || ( 0 == pWordFormSink ) )
        return E_INVALIDARG;

    HRESULT hr = S_OK;

    // Look up the word in the simple list of stem forms

    SStemForm const * pStemForm = (SStemForm *) bsearch( pwcInBuf,
                                                         aStemForms,
                                                         cStemForms,
                                                         sizeof SStemForm,
                                                         StemCompare );

    if ( 0 != pStemForm )
    {
        // Found it, now iterate all the forms

        ULONG iList = pStemForm->iList;
        ULONG iForm = 0;

        while ( 0 != aStems[ iList ][ iForm ] )
        {
            WCHAR const * pwc = aStems[ iList ][ iForm ];

            // Don't emit the original word yet

            if ( 0 != wcscmp( pwc, pwcInBuf ) )
            {
                hr = pWordFormSink->PutAltWord( pwc,
                                                (ULONG) wcslen( pwc ) );
                if ( FAILED( hr ) )
                    return hr;
            }

            iForm++;
        }
    }

    // Emit the original word

    return pWordFormSink->PutWord( pwcInBuf, cwc );
} //StemWord

HRESULT STDMETHODCALLTYPE CSampleStemmer::GetLicenseToUse ( const WCHAR ** ppwcsLicense ) [inline]

Definition at line 258 of file lrsample.HXX.

    {
        if ( 0 == ppwcsLicense )
            return E_INVALIDARG;

        *ppwcsLicense = L"Copyright Microsoft, 1991-2001";
        return S_OK;
    }

HRESULT STDMETHODCALLTYPE CSampleStemmer::Init | ( | ULONG | ulMaxTokenSize,
 |  | BOOL * | pfLicense |
 | ) |  |  | [inline]

Definition at line 247 of file lrsample.HXX.

    {
        if ( 0 == pfLicense )
            return E_INVALIDARG;

        *pfLicense = TRUE;
        return S_OK;
    }

HRESULT STDMETHODCALLTYPE CSampleStemmer::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppvObject |
 | ) |  |  | [inline]

Definition at line 212 of file lrsample.HXX.

    {
        if ( 0 == ppvObject )
            return E_INVALIDARG;

        if ( IID_IStemmer == riid )
            *ppvObject = (IUnknown *)(IStemmer *) this;
        else if ( IID_IUnknown == riid )
            *ppvObject = (IUnknown *) this;
        else
        {
            *ppvObject = 0;
            return E_NOINTERFACE;
        }

        AddRef();
        return S_OK;
    }

ULONG STDMETHODCALLTYPE CSampleStemmer::Release ( void ) [inline]

Definition at line 237 of file lrsample.HXX.

    {
        unsigned long c = InterlockedDecrement( &_cRefs );

        if ( 0 == c )
            delete this;

        return c;
    }

Member Data Documentation

long CSampleStemmer::_cRefs [private]

Definition at line 284 of file lrsample.HXX.

The documentation for this class was generated from the following files:
  • WinBase/Indexing/lrsample/lrsample.HXX
  • WinBase/Indexing/lrsample/lrsample.CXX
Generated on Wed Nov 13 2024 16:57:17 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSampleWordBreaker Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Types | Private Member Functions | Private Attributes

CSampleWordBreaker Class Reference

#include "lrsample.HXX"

List of all members.

Public Member Functions

CSampleWordBreaker ()
ULONG STDMETHODCALLTYPE | AddRef ()
HRESULT STDMETHODCALLTYPE | BreakText (TEXT_SOURCE *pTextSource, IWordSink *pWordSink, IPhraseSink *pPhraseSink)
HRESULT STDMETHODCALLTYPE | ComposePhrase (WCHAR const *pwcNoun, ULONG cwcNoun, WCHAR const *pwcModifier, ULONG cwcModifier, ULONG ulAttachmentType, WCHAR *pwcPhrase, ULONG *pcwcPhrase)
HRESULT STDMETHODCALLTYPE | GetLicenseToUse (const WCHAR **ppwcsLicense)
HRESULT STDMETHODCALLTYPE | Init (BOOL fQuery, ULONG cwcMaxToken, BOOL *pfLicense)
HRESULT STDMETHODCALLTYPE | QueryInterface (REFIID riid, void **ppvObject)
ULONG STDMETHODCALLTYPE | Release ()

Private Types

enum | _EBufSize { cwcAtATime = 500 }

Private Member Functions

~CSampleWordBreaker ()
HRESULT | Tokenize (TEXT_SOURCE *pTextSource, ULONG cwc, IWordSink *pWordSink, ULONG &cwcProcd)

Private Attributes

long | _cRefs
ULONG _cwcMaxToken

Detailed Description

Definition at line 86 of file lrsample.HXX.

Member Enumeration Documentation

enum CSampleWordBreaker::_EBufSize [private]
Enumerator:
cwcAtATime

Definition at line 181 of file lrsample.HXX.

    {
        cwcAtATime = 500
    };

Constructor & Destructor Documentation

CSampleWordBreaker::CSampleWordBreaker ( ) [inline]

Definition at line 163 of file lrsample.HXX.

                         :
        _cRefs( 1 )
    {
        InterlockedIncrement( &g_cInstances );
    }

CSampleWordBreaker::~CSampleWordBreaker ( ) [inline, private]

Definition at line 176 of file lrsample.HXX.

    {
        InterlockedDecrement( &g_cInstances );
    }

Member Function Documentation

ULONG STDMETHODCALLTYPE CSampleWordBreaker::AddRef ( void ) [inline]

Definition at line 110 of file lrsample.HXX.

    {
        return InterlockedIncrement( &_cRefs );
    }

HRESULT STDMETHODCALLTYPE CSampleWordBreaker::BreakText | ( | TEXT_SOURCE * | pTextSource,
 |  | IWordSink * | pWordSink,
 |  | IPhraseSink * | pPhraseSink
 | ) |  |

Definition at line 443 of file lrsample.CXX.

{
    // Validate arguments

    if ( 0 == pTextSource )
        return E_INVALIDARG;

    if ( ( 0 == pWordSink ) || ( pTextSource->iCur == pTextSource->iEnd ) )
        return S_OK;

    if ( pTextSource->iCur > pTextSource->iEnd )
        return E_INVALIDARG;

    ULONG cwcProcessed;   // # chars actually processed by Tokenize()
    HRESULT hr = S_OK;

    // Pull text from the text source and tokenize it

    do
    {
        BOOL fFirstTime = TRUE;

        while ( pTextSource->iCur < pTextSource->iEnd )
        {
            ULONG cwc = pTextSource->iEnd - pTextSource->iCur;

            // Process in buckets of cwcAtATime only

            if ( cwc >= CSampleWordBreaker::cwcAtATime )
                cwc = CSampleWordBreaker::cwcAtATime;
            else if ( !fFirstTime )
                break;

            hr = Tokenize( pTextSource, cwc, pWordSink, cwcProcessed );
            if ( FAILED( hr ) )
                return hr;

            pTextSource->iCur += cwcProcessed;
            fFirstTime = FALSE;
        }

        hr = pTextSource->pfnFillTextBuffer( pTextSource );
    } while ( SUCCEEDED( hr ) );

    //
    // If anything failed except for running out of text, report the error.
    // Otherwise, for cases like out of memory, files will not get retried or
    // reported as failures properly.
    //

    if ( ( FAILED( hr ) ) &&
         ( FILTER_E_NO_MORE_VALUES != hr ) &&
         ( FILTER_E_NO_TEXT != hr ) &&
         ( FILTER_E_NO_VALUES != hr ) &&
         ( FILTER_E_NO_MORE_TEXT != hr ) &&
         ( FILTER_E_END_OF_CHUNKS != hr ) &&
         ( FILTER_E_EMBEDDING_UNAVAILABLE != hr ) &&
         ( WBREAK_E_END_OF_TEXT != hr ) )
        return hr;

    ULONG cwc = pTextSource->iEnd - pTextSource->iCur;

    if ( 0 == cwc )
        return S_OK;

    return Tokenize( pTextSource, cwc, pWordSink, cwcProcessed );
} //BreakText

HRESULT STDMETHODCALLTYPE CSampleWordBreaker::ComposePhrase | ( | WCHAR const * | pwcNoun,
 |  | ULONG | cwcNoun,
 |  | WCHAR const * | pwcModifier,
 |  | ULONG | cwcModifier,
 |  | ULONG | ulAttachmentType,
 |  | WCHAR * | pwcPhrase,
 |  | ULONG * | pcwcPhrase |
 | ) |  |  | [inline]

Definition at line 143 of file lrsample.HXX.

    {
        return E_NOTIMPL;
    }

HRESULT STDMETHODCALLTYPE CSampleWordBreaker::GetLicenseToUse ( const WCHAR ** ppwcsLicense ) [inline]

Definition at line 154 of file lrsample.HXX.

    {
        if ( 0 == ppwcsLicense )
            return E_INVALIDARG;

        *ppwcsLicense = L"Copyright Microsoft, 1991-2001";
        return S_OK;
    }

HRESULT STDMETHODCALLTYPE CSampleWordBreaker::Init | ( | BOOL | fQuery,
 |  | ULONG | cwcMaxToken,
 |  | BOOL * | pfLicense |
 | ) |  |  | [inline]

Definition at line 125 of file lrsample.HXX.

    {
        if ( 0 == pfLicense )
            return E_INVALIDARG;

        _cwcMaxToken = cwcMaxToken;

        *pfLicense = FALSE;

        return S_OK;
    }

HRESULT STDMETHODCALLTYPE CSampleWordBreaker::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppvObject |
 | ) |  |  | [inline]

Definition at line 90 of file lrsample.HXX.

    {
        if ( 0 == ppvObject )
            return E_INVALIDARG;

        if ( IID_IWordBreaker == riid )
            *ppvObject = (IUnknown *)(IWordBreaker *) this;
        else if ( IID_IUnknown == riid )
            *ppvObject = (IUnknown *) this;
        else
        {
            *ppvObject = 0;
            return E_NOINTERFACE;
        }

        AddRef();
        return S_OK;
    }

ULONG STDMETHODCALLTYPE CSampleWordBreaker::Release ( void ) [inline]

Definition at line 115 of file lrsample.HXX.

    {
        unsigned long c = InterlockedDecrement( &_cRefs );

        if ( 0 == c )
            delete this;

        return c;
    }

HRESULT CSampleWordBreaker::Tokenize | ( | TEXT_SOURCE * | pTextSource,
 |  | ULONG | cwc,
 |  | IWordSink * | pWordSink,
 |  | ULONG & | cwcProcd |
 | ) |  |  | [private]

Definition at line 259 of file lrsample.CXX.

{
    // Leave space for one (unused) lookahead

    WORD aInfo1[ CSampleWordBreaker::cwcAtATime + 1 ];
    WORD aInfo3[ CSampleWordBreaker::cwcAtATime + 1 ];

    // Initialize this so we can go 1 beyond in IsWordChar()

    aInfo3 [ CSampleWordBreaker::cwcAtATime ] = C3_NONSPACING;

    // Get a pointer to the text we'll be working on

    const WCHAR * pwcChunk = &pTextSource->awcBuffer[ pTextSource->iCur ];

    HRESULT hr = ScanChunk( pwcChunk, cwc, aInfo1, aInfo3 );
    if ( FAILED( hr ) )
        return hr;

    BOOL fWordHasZWS = FALSE; // Does the current word have a 0-width-space?
    ULONG cwcZWS = 0;         // Length of word minus embedded 0-width-spaces

    //
    // iBeginWord is the offset into aInfoX of the beginning character of
    // a word.  iCur is the first unprocessed character.
    // They are indexes into the current block (_pwcChunk).
    //

    ULONG iBeginWord = 0;
    ULONG iCur = 0;

    // Temp buffer for a word having zero-width space

    WCHAR awcBufZWS[ CSampleWordBreaker::cwcAtATime ];

    // Send words from the current block to word sink

    while ( iCur < cwc )
    {
        // Skip whitespace, punctuation, etc.

        for (; iCur < cwc; iCur++)
            if ( IsWordChar( pwcChunk, iCur, aInfo1, aInfo3 ) )
                break;

        // iCur points to a word char or is equal to cwc

        iBeginWord = iCur;
        if ( iCur < cwc )
            iCur++; // we knew it pointed at word character

        //
        // Find word break. Filter may output Unicode zero-width-space, which
        // should be ignored by the wordbreaker.
        //

        fWordHasZWS = FALSE;
        for ( ; iCur < cwc; iCur++ )
        {
            if ( !IsWordChar( pwcChunk, iCur, aInfo1, aInfo3 ) )
            {
                if ( ZERO_WIDTH_SPACE == pwcChunk[iCur] )
                    fWordHasZWS = TRUE;
                else
                    break;
            }
        }

        if ( fWordHasZWS )
        {
            // Copy word into awcBufZWS after stripping zero-width-spaces

            cwcZWS = 0;
            for ( ULONG i = iBeginWord; i < iCur; i++ )
            {
                if ( ZERO_WIDTH_SPACE != pwcChunk[i] )
                    awcBufZWS[cwcZWS++] = pwcChunk[i];
            }
        }

        // iCur points to a non-word char or is equal to cwc

        if ( iCur < cwc )
        {
            // store the word and its source position

            if ( fWordHasZWS )
                hr = pWordSink->PutWord( cwcZWS,
                                         awcBufZWS,    // stripped word
                                         iCur - iBeginWord,
                                         pTextSource->iCur + iBeginWord );
            else
                hr = pWordSink->PutWord( iCur - iBeginWord,
                                         pwcChunk + iBeginWord, // the word
                                         iCur - iBeginWord,
                                         pTextSource->iCur + iBeginWord );

            if ( FAILED( hr ) )
                return hr;

            iCur++; // we knew it pointed at non-word char
            iBeginWord = iCur; // in case we exit the loop now
        }
    } // next word

    // End of words in chunk.
    // iCur == cwc
    // iBeginWord points at beginning of word or == cwc

    if ( 0 == iBeginWord )
    {
        // A single word fills from beginning of this chunk
        // to the end. This is either a very long word or
        // a short word in a leftover buffer.

        // store the word and its source position

        if ( fWordHasZWS )
            hr = pWordSink->PutWord( cwcZWS,
                                     awcBufZWS,          // stripped word
                                     iCur,
                                     pTextSource->iCur ); // its source pos.
        else
            hr = pWordSink->PutWord( iCur,
                                     pwcChunk,           // the word
                                     iCur,
                                     pTextSource->iCur ); // its source pos.

        if ( FAILED( hr ) )
            return hr;

        // Position it to not add the word twice.

        iBeginWord = iCur;
    }

    //
    // If this is the last chunk from text source, then process the
    // last fragment.
    //

    if ( ( cwc < CSampleWordBreaker::cwcAtATime ) && ( iBeginWord != iCur ) )
    {
        // store the word and its source position

        if ( fWordHasZWS )
            hr = pWordSink->PutWord( cwcZWS,
                                     awcBufZWS,    // stripped word
                                     iCur - iBeginWord,
                                     pTextSource->iCur + iBeginWord );
        else
            hr = pWordSink->PutWord( iCur - iBeginWord,
                                     pwcChunk + iBeginWord,  // the word
                                     iCur - iBeginWord,
                                     pTextSource->iCur + iBeginWord );

        if ( FAILED( hr ) )
            return hr;

        iBeginWord = iCur;
    }

    cwcProcessed = iBeginWord;
    return S_OK;
} //Tokenize

Member Data Documentation

long CSampleWordBreaker::_cRefs [private]

Definition at line 186 of file lrsample.HXX.

ULONG CSampleWordBreaker::_cwcMaxToken [private]

Definition at line 190 of file lrsample.HXX.

The documentation for this class was generated from the following files:
  • WinBase/Indexing/lrsample/lrsample.HXX
  • WinBase/Indexing/lrsample/lrsample.CXX
Generated on Wed Nov 13 2024 16:57:17 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSchemaDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Public Attributes

CSchemaDlg Class Reference

#include "cdialog.h"

Inherits CWndLite, and CRowsetViewerDlg.

List of all members.

Public Member Functions

CSchemaDlg (CMDIChild *pCMDIChild)
virtual | ~CSchemaDlg ()
virtual HRESULT | ChangeRestrictions ()
virtual INT_PTR | Display ()
virtual HRESULT | DisplayTree ()
virtual HRESULT | GetSelectedRestrictions ()
virtual HRESULT | GetSelectedSchema (SCHEMAINFO **ppSchemaInfo, ULONG *pdwRestrictions=NULL)
virtual HRESULT | InitSchemaCombo (BOOL fShowSupported)
virtual HRESULT | InitSchemas (HWND hWnd)
virtual HRESULT | InitTreeView (HWND hWnd)
virtual HRESULT | RefreshTreeControls ()

Static Public Member Functions

static INT_PTR WINAPI | SchemaRowsetProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static INT_PTR WINAPI | SchemaTreeProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)

Public Attributes

CComboBoxLite m_comboSchema
CPropSets m_CPropSets
ULONG m_cRestrictions
ULONG m_cSchemas
BOOL m_fActive
BOOL m_fEditing
BOOL m_fShowSupported
BOOL m_fUseProperties
BOOL m_fUseRestrictions
HWND | m_hWndSchemas
HWND | m_hWndTreeView
HWND | m_hWndTreeWnd
INDEX m_iOldSchemaIndex
INDEX m_iSchemaIndex
CRowset * m_pCTreeRowset
CWndLite | m_rgResName [MAX_RESTRICTIONS]
VARIANT | m_rgRestrictions [MAX_RESTRICTIONS]
ULONG * m_rgRestrictionSupport
CComboBoxLite | m_rgResType [MAX_RESTRICTIONS]
CComboBoxString | m_rgResValue [MAX_RESTRICTIONS]
GUID * | m_rgSchemas
SCHEMAINFO m_SchemaInfo

Detailed Description

Definition at line 568 of file cdialog.h.

Constructor & Destructor Documentation

CSchemaDlg::CSchemaDlg ( CMDIChild * pCMDIChild )

Definition at line 3820 of file cdialog.cpp.

  : CRowsetViewerDlg(NULL, pCMDIChild)
{
  //Data
  m_hWndSchemas = NULL;
  m_hWndTreeWnd = NULL;
  m_hWndTreeView = NULL;

  //Saved Dialog Values
  m_fEditing = FALSE;
  m_fActive = TRUE;

  m_cSchemas = 0;
  m_rgSchemas = NULL;
  m_rgRestrictionSupport = NULL;

  //Rowset - This is for the SchemaTree sheet, it uses its own rowset
  //so it doesn't mess up the users rowset, just to display a tree...
  m_pCTreeRowset    = NULL;

  m_iSchemaIndex    = LVM_ERR;
  m_iOldSchemaIndex = LVM_ERR;

  m_cRestrictions   = 0;
  m_fUseRestrictions  = TRUE;
  m_fUseProperties  = TRUE; //Default
  m_fShowSupported  = TRUE;

  //Only set these "Default" properties, if requested by the user
  if(GetOptions()->m_dwRowsetOpts & ROWSET_SETDEFAULTPROPS)
  {
    //DBPROP_CANHOLDROWS is required by the OLE DB Spec - Level-0 Conformance
    //Since it is also legal to set a ReadOnly property, just blindy set it...
    m_CPropSets.SetProperty(DBPROP_CANHOLDROWS, DBPROPSET_ROWSET, DBTYPE_BOOL, (void*)VARIANT_TRUE, DBPROPOPTIONS_REQUIRED);
  }
}

CSchemaDlg::~CSchemaDlg ( ) [virtual]

Definition at line 3862 of file cdialog.cpp.

{
  m_hWnd = NULL;
  SAFE_RELEASE(m_pCTreeRowset);

  SAFE_FREE(m_rgSchemas);
  SAFE_FREE(m_rgRestrictionSupport);

  //Free Restrictions
  FreeData(DBTYPE_VARIANT, m_cRestrictions, m_rgRestrictions);
}

Member Function Documentation

HRESULT CSchemaDlg::ChangeRestrictions ( ) [virtual]

Definition at line 4116 of file cdialog.cpp.

{
  ULONG i=0;
  HRESULT hr = S_OK;
  SCHEMAINFO* pSchemaInfo = NULL;
  DWORD dwRestrictions = 0;

  //Get the Selected Schema
  TESTC(hr = GetSelectedSchema(&pSchemaInfo, &dwRestrictions));

  //Display RESTRICTION Info
  for(i=0; i<MAX_RESTRICTIONS; i++)
  {
    //Display Restriction Name
    if(i < pSchemaInfo->cRestrictions)
    {
      m_rgResName[i].SetWindowText(pSchemaInfo->rgResInfo[i].pwszName ? pSchemaInfo->rgResInfo[i].pwszName : L"Unknown");
      m_rgResType[i].SetSelValue(pSchemaInfo->rgResInfo[i].wType);
    }
    else
    {
      m_rgResName[i].SetWindowText(L"");
      m_rgResType[i].SetSelValue(DBTYPE_BSTR);
    }

    //Default Value
    m_rgResName[i].EnableWindow(dwRestrictions & (0x00000001 << i));
    m_rgResValue[i].SetWindowText(L"");
  }

CLEANUP:
  return hr;
}

INT_PTR CSchemaDlg::Display ( ) [virtual]

Definition at line 3880 of file cdialog.cpp.

{
  //Now Display the dialog
  PROPSHEETPAGE psp[2];
  PROPSHEETHEADER psh;

  //Header
  psh.dwSize      = sizeof(PROPSHEETHEADER);
  psh.dwFlags     = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW;
  psh.hwndParent    = m_pCMDIChild->m_hWnd;
  psh.hInstance   = GetAppLite()->m_hInstance;
  psh.pszIcon     = NULL;
  psh.pszCaption    = "IDBSchemaRowset";
  psh.nPages      = NUMELE(psp);
  psh.nStartPage    = 0;
  psh.ppsp      = (LPCPROPSHEETPAGE) &psp;

  //Provider
  psp[0].dwSize   = sizeof(PROPSHEETPAGE);
  psp[0].dwFlags    = PSP_USETITLE;
  psp[0].hInstance  = GetAppLite()->m_hInstance;
  psp[0].pszTemplate  = MAKEINTRESOURCE(IDD_SCHEMAROWSET);
  psp[0].pszIcon    = NULL;
  psp[0].pfnDlgProc = SchemaRowsetProc;
  psp[0].pszTitle   = "Schemas";
  psp[0].lParam   = (LPARAM)this;

  //Properties
  psp[1].dwSize   = sizeof(PROPSHEETPAGE);
  psp[1].dwFlags    = PSP_USETITLE;
  psp[1].hInstance  = GetAppLite()->m_hInstance;
  psp[1].pszTemplate  = MAKEINTRESOURCE(IDD_SCHEMATREEVIEW);
  psp[1].pszIcon    = NULL;
  psp[1].pfnDlgProc = SchemaTreeProc;
  psp[1].pszTitle   = "TreeView";
  psp[1].lParam   = (LPARAM)this;

  //Display the Property Sheets
  return PropertySheet(&psh);
}

HRESULT CSchemaDlg::DisplayTree ( ) [virtual]

Create Accessors and Setup bindings, (don't bind bookmark)

Definition at line 4702 of file cdialog.cpp.

{
  CWaitCursor waitCursor;
  HRESULT hr = E_FAIL;
  WCHAR wszBuffer[MAX_COL_SIZE];

  DBCOUNTITEM iCol,cRowsObtained = 0;
  HROW  rghRows[MAX_BLOCK_SIZE];
  HROW*  phRow = rghRows;

  DBORDINAL cColOrds = 0;
  DBORDINAL* rgColOrds = NULL;

  DBORDINAL iOrdinal, iColumn;
  HTREEITEM hFoundItem, hParent;

  //Setup Properties
  ULONG cPropSets = 0;
  DBPROPSET* rgPropSets = NULL;
  SCHEMAINFO* pSchemaInfo = NULL;
  CComPtr<IRowset> spRowset;
  CSession* pCSession = (CSession*)m_pCMDIChild->GetObject(eCSession);

  if(m_fUseProperties)
  {
    cPropSets = m_CPropSets.GetCount();
    rgPropSets = m_CPropSets.GetPropSets();
  }

  //Get the Selected Schema
  TESTC(hr = GetSelectedSchema(&pSchemaInfo));

  //Create the SchemaRowset
  TESTC(hr = pCSession->GetSchemaRowset(NULL, *pSchemaInfo->pguidSchema, m_cRestrictions, m_rgRestrictions, IID_IRowset, cPropSets, rgPropSets, (IUnknown**)&spRowset));

  //(either from Command, IOpenRowset, or Schema's
  if(m_pCTreeRowset == NULL)
    m_pCTreeRowset = new CRowset(NULL, m_pCMDIChild);
  TESTC(hr = m_pCTreeRowset->CreateObject(pCSession, IID_IRowset, spRowset));

  //Record that the source is a SchemaRowset...
  if(pSchemaInfo->pguidSchema)
  {
    m_pCTreeRowset->m_guidSource  = *pSchemaInfo->pguidSchema;
    m_pCTreeRowset->m_bSchemaRowset = TRUE;
  }

  //Clear TreeView object
  SendMessage(m_hWndTreeView, TVM_DELETEITEM, 0, (LPARAM)TVI_ROOT);

  //Create ColumnInfo
  TESTC(hr = m_pCTreeRowset->GetColInfo());

  ///Create Accessors and Setup bindings, (don't bind bookmark)
  TESTC(hr = m_pCTreeRowset->CreateAccessors(BIND_ALLCOLSEXPECTBOOKMARK));

  //All columns that are restrictions are done first, this creates the tree
  //nodes.  Then all remaining columns are just elements under the last node.
  //We need to setup this array of ordinals to use to indicate the ordering...
  SAFE_ALLOC(rgColOrds, DBORDINAL, m_pCTreeRowset->m_ColumnInfo.GetCount());

  //Add all restriction columns first
  cColOrds = pSchemaInfo->cRestrictions;
  for(iCol=0; iCol<cColOrds; iCol++)
  {
    ASSERT(pSchemaInfo->rgResInfo[iCol].iNode < m_pCTreeRowset->m_ColumnInfo.GetCount());
    rgColOrds[iCol] = pSchemaInfo->rgResInfo[iCol].iNode;
  }

  //Add all remaining columns, (that are not already in the list...)
  iColumn = cColOrds;
  for(iCol=0; iCol<m_pCTreeRowset->m_Bindings.GetCount(); iCol++)
  {
    BOOL bFound = FALSE;
    iOrdinal = m_pCTreeRowset->m_Bindings[iCol].iOrdinal;
    for(DBCOUNTITEM j=0; j<cColOrds && !bFound; j++)
    {
      if(iOrdinal == rgColOrds[j])
        bFound = TRUE;
    }

    //Add it to the list, if it doesn't already exist...
    if(!bFound)
    {
      rgColOrds[iColumn] = iOrdinal;
      iColumn++;
    }
  }

  //Grab all the rows
  while(TRUE)
  {
    //Obtain the rows in blocks...
    //NOTE: We are using a "static" array passed in for GetNextRows.  This is a major performance
    //gain that is allowed by the spec, so the provider doesn't have to allocate the array
    //or guess how large, and since we are reusing it it in a loop it has signicant gains...
    TESTC(hr = m_pCTreeRowset->GetNextRows(0, MAX_BLOCK_SIZE, &cRowsObtained, &phRow));

    //NOTE: We cant just use (HROW**)&rghRows, since the compiler always "assumes" &array = array!
    //Which is not what we want, you actually have to use a temp for the currect address.  This
    //assert is to make sure the provider doesn't allocate an array when the user is
    //passing in a user allocated array for performance...
    ASSERT(phRow == rghRows);

    //ENDOFROWSET
    if(cRowsObtained==0)
      break;

    //Loop through all rows obtained...
    for(ULONG iRow=0; iRow<cRowsObtained; iRow++)
    {
      //Get the Data
      TESTC(hr = m_pCTreeRowset->GetData(rghRows[iRow]));

      //Loop through all the restrictions first
      //We will create nodes based upon the sort order of the restrictions.
      //Any column that is not in the sort oder will just be an item under a node
      hParent = NULL;
      for(ULONG i=0; i<cColOrds; i++)
      {
        //Get the Data for this Column
        const DBBINDING* pBinding = m_pCTreeRowset->m_Bindings.GetOrdinal(rgColOrds[i]);
        const DBCOLUMNINFO* pColInfo = m_pCTreeRowset->m_ColumnInfo.GetOrdinal(rgColOrds[i]);
        m_pCTreeRowset->GetColumnData(pBinding, m_pCTreeRowset->m_pData, NULL, NULL, NULL, wszBuffer, MAX_COL_SIZE, GetOptions()->m_dwConvFlags | CONV_TYPENAME, pColInfo->wType);

        //Insert it into the TreeView
        if(wszBuffer[0])
        {
          //Make sure it doesn't already exist...
          hFoundItem = TV_FindItem(m_hWndTreeView, hParent, wszBuffer);
          if(hFoundItem)
          {
            hParent = hFoundItem;
          }
          else
          {
            //Insert the Item (using node Icon - 0)
            hParent = TV_InsertItem(m_hWndTreeView, hParent, TVI_LAST, wszBuffer, rgColOrds[i], IMAGE_FORM, IMAGE_FORM);
          }
        }
      }

      //Now go through the regular non-node items and just
      //add the the latest parent
      for(iCol=cColOrds; iCol<m_pCTreeRowset->m_Bindings.GetCount(); iCol++)
      {
        const DBBINDING* pBinding = m_pCTreeRowset->m_Bindings.GetOrdinal(rgColOrds[iCol]);
        const DBCOLUMNINFO* pColInfo = m_pCTreeRowset->m_ColumnInfo.GetOrdinal(rgColOrds[iCol]);

        //Get the Data for this Column
        m_pCTreeRowset->GetColumnData(pBinding, m_pCTreeRowset->m_pData, NULL, NULL, NULL, wszBuffer, MAX_COL_SIZE, GetOptions()->m_dwConvFlags | CONV_TYPENAME, pColInfo->wType);

        //Insert it into the TreeView
        if(wszBuffer[0])
        {
          //Display the Item (using item icon - 1)
          TV_InsertItem(m_hWndTreeView, hParent, TVI_LAST, wszBuffer, rgColOrds[iCol], IMAGE_NORMAL, IMAGE_NORMAL);
        }
      }

      //Free the out-of-line data
      m_pCTreeRowset->m_Bindings.FreeData(m_pCTreeRowset->m_pData);
    }

    //Release the rows obtained
    TESTC(hr = m_pCTreeRowset->ReleaseRows(cRowsObtained, rghRows));
  }

  //We now have displayed this tree
  m_iOldSchemaIndex = m_iSchemaIndex;

CLEANUP:
  SAFE_FREE(rgColOrds);
  RefreshTreeControls();
  return hr;
}

HRESULT CSchemaDlg::GetSelectedRestrictions ( ) [virtual]

Definition at line 4155 of file cdialog.cpp.

{
  HRESULT hr = S_OK;
  SCHEMAINFO* pSchemaInfo = NULL;
  WCHAR* pwszValue = NULL;

  //Obtain the Currently selected Schema
  TESTC(hr = GetSelectedSchema(&pSchemaInfo));

  //Properties
  m_fUseProperties  = ::IsDlgButtonChecked(m_hWndSchemas, IDB_USEPROPERTIES);
  m_fShowSupported  = ::IsDlgButtonChecked(m_hWndSchemas, IDB_SHOWSUPPORTED);

  //Free Previous Restrictions
  FreeData(DBTYPE_VARIANT, m_cRestrictions, m_rgRestrictions);
  m_cRestrictions = 0;

  //Obtain Selected Restrictions
  m_fUseRestrictions = ::IsDlgButtonChecked(m_hWndSchemas, IDB_USERESTRICTIONS);
  if(m_fUseRestrictions)
  {
    m_cRestrictions = 0;

    //Initialize Restrictions
    for(ULONG i=0; i<MAX_RESTRICTIONS; i++)
      VariantInitFast(&m_rgRestrictions[i]);

    //Get the Restriction info
    for(i=0; i<MAX_RESTRICTIONS; i++)
    {
      DBTYPE wType = (DBTYPE)m_rgResType[i].GetItemParam(m_rgResType[i].GetCurSel());

      //If Not VT_EMPTY we need to setup the restriction Variant
      if(wType != VT_EMPTY)
      {
        //If user specified, or a "special" selection in the drop down
        //NOTE: Since all the types are defaulted to the actual type of the restriction
        //to make it easier for consumers to not have to remember the correct type.
        //We have to come up with a different way for the user to indicate to use this
        //resctriction.  Currently if the edit box is left blank, we assume the user
        //is not interesed in the restriction and its not bound.  If the user truely
        //wants NULL or Empty String, those options are available in the combo drop down...

        pwszValue = m_rgResValue[i].GetSelText();
        if(pwszValue || m_rgResValue[i].GetCurSel()!=CB_ERR)
        {
          XTESTC(hr = StringToVariant(pwszValue, wType, &m_rgRestrictions[i]));

          //Record we are using this restrictions
          m_cRestrictions = i+1;
          SAFE_FREE(pwszValue);
        }
      }
    }
  }

CLEANUP:
  SAFE_FREE(pwszValue);
  return hr;
}

HRESULT CSchemaDlg::GetSelectedSchema | ( | SCHEMAINFO ** | ppSchemaInfo,
 |  | ULONG * | pdwRestrictions = NULL |
 | ) |  |  | [virtual]

Definition at line 4034 of file cdialog.cpp.

{
  ASSERT(ppSchemaInfo);
  SCHEMAINFO* pSchemaInfo = NULL;

  if(pdwRestrictions)
    *pdwRestrictions = 0;

  //User has selected a different Schema
  //We need to update our restriction list...

  //Get Selected Schema
  m_iSchemaIndex = m_comboSchema.GetCurSel();
  if(m_iSchemaIndex != CB_ERR)
    pSchemaInfo = (SCHEMAINFO*)m_comboSchema.GetItemParam(m_iSchemaIndex);

  //Provider Specific Schemas have the Item Data as the index rather than a pointer
  if(pSchemaInfo>=0 && pSchemaInfo<(SCHEMAINFO*)(ULONG_PTR)m_cSchemas)
  {
    m_iSchemaIndex = (INDEX)pSchemaInfo;
    pSchemaInfo = NULL;
  }

  if(pSchemaInfo)
  {
    //Need to find the corresponding restrictions...
    if(pdwRestrictions)
    {
      m_iSchemaIndex = CB_ERR;
      for(ULONG i=0; i<m_cSchemas; i++)
      {
        if(*pSchemaInfo->pguidSchema == m_rgSchemas[i])
        {
          m_iSchemaIndex = i;
          *pdwRestrictions = m_rgRestrictionSupport[m_iSchemaIndex];
          break;
        }
      }
    }
  }
  //This is a little more difficult, since there must be a provider
  //specific schema, so we need to build up the info...
  else
  {
    //Clear our old SchemaInfo temp storage
    memset(&m_SchemaInfo, 0, sizeof(SCHEMAINFO));

    if(m_iSchemaIndex>=0 && (ULONG)m_iSchemaIndex<m_cSchemas)
    {
      //Figure our how many restrictions are supported
      //This is required since E_INVALIDARG will be produced if
      //cRestrictions > than the number of max restricitons defined for this Guid
      for(ULONG i=0; i<MAX_RESTRICTIONS; i++)
      {
        if(m_rgRestrictionSupport[m_iSchemaIndex] & (0x00000001 << i))
          m_SchemaInfo.cRestrictions = i+1;
        m_SchemaInfo.rgResInfo[i].iNode = i+1;
        m_SchemaInfo.rgResInfo[i].wType = DBTYPE_BSTR;  //Default
      }

      //dwRestrictions
      if(pdwRestrictions)
        *pdwRestrictions = m_rgRestrictionSupport[m_iSchemaIndex];

      //pGuid
      m_SchemaInfo.pguidSchema = &m_rgSchemas[m_iSchemaIndex];
    }

    //Return a pointer to our class temp SchemaInfo
    pSchemaInfo = &m_SchemaInfo;
  }

  *ppSchemaInfo = pSchemaInfo;
  return S_OK;
}

HRESULT CSchemaDlg::InitSchemaCombo ( BOOL fShowSupported ) [virtual]

Definition at line 3981 of file cdialog.cpp.

{
  WCHAR wszBuffer[MAX_NAME_LEN+1];
  const SCHEMAINFO* pSchemaInfo = NULL;

  //Delete all the current items...
  m_comboSchema.ResetContent();

  //Display the complete list of Schemas (if requested)
  if(!fShowSupported)
  {
    for(ULONG i=0; i<NUMELE(g_rgSchemaInfo); i++)
    {
      pSchemaInfo = &g_rgSchemaInfo[i];

      //Now Add it to the ComboBox dialog...
      m_comboSchema.AddString(pSchemaInfo->pwszSchemaName, (LPARAM)pSchemaInfo);
    }
  }

  //Loop over returned Schemas
  for(ULONG i=0; i<m_cSchemas; i++)
  {
    //Find this Schema in our List so we know the "text" name of it...
    pSchemaInfo = NULL;
    for(ULONG j=0; j<NUMELE(g_rgSchemaInfo); j++)
    {
      if(m_rgSchemas[i] == *g_rgSchemaInfo[j].pguidSchema)
      {
        pSchemaInfo = &g_rgSchemaInfo[j];
        break;
      }
    }

    //There may be a provider specific SchemaGuid,
    //so just display the Guid value and not a name
    if(pSchemaInfo == NULL)
      StringFromGUID2(m_rgSchemas[i], wszBuffer, MAX_NAME_LEN);

    //Now Add it to the ComboBox dialog...
    //Only add if were only showing supported, or its not in the known list...
    if(fShowSupported || pSchemaInfo==NULL)
      m_comboSchema.AddString(pSchemaInfo ? pSchemaInfo->pwszSchemaName : wszBuffer, pSchemaInfo ? (LPARAM)pSchemaInfo : (LPARAM)i);
  }

  return S_OK;
}

HRESULT CSchemaDlg::InitSchemas ( HWND hWnd ) [virtual]

Definition at line 3926 of file cdialog.cpp.

{
  HRESULT hr = S_OK;
  m_hWndSchemas = hWnd;
  INDEX i,iSel = 0;

  //Default Check UseRestrictions and UseProperties
    ::CheckDlgButton(hWnd, IDB_USEPROPERTIES,    BST2STATE(m_fUseProperties));
    ::CheckDlgButton(hWnd, IDB_USERESTRICTIONS,    BST2STATE(m_fUseRestrictions));
    ::CheckDlgButton(hWnd, IDB_SHOWSUPPORTED,    BST2STATE(m_fShowSupported));

  //Obtain Supported Schemas
  CSession* pCSession = (CSession*)m_pCMDIChild->GetObject(eCSession);

  //Free any previously obtain schemainfo
  SAFE_FREE(m_rgSchemas);
  SAFE_FREE(m_rgRestrictionSupport);

  //Obtain Supported Schemas
  ASSERT(pCSession && pCSession->m_pIDBSchemaRowset);
  XTEST(hr = pCSession->m_pIDBSchemaRowset->GetSchemas(&m_cSchemas, &m_rgSchemas, &m_rgRestrictionSupport));
  TESTC(TRACE_METHOD(hr, L"IDBSchemaRowset::GetSchemas(&%d, &0x%p, &0x%p)", m_cSchemas, m_rgSchemas, m_rgRestrictionSupport));

  //Fill in Schema Combo
  m_comboSchema.CreateIndirect(m_hWndSchemas, IDC_SCHEMAS);
  InitSchemaCombo(m_fShowSupported);

  //Fill in Controls
  for(i=0; i<MAX_RESTRICTIONS; i++)
  {
    //Name
    m_rgResName[i].CreateIndirect(m_hWndSchemas, RES_NAME[i]);

    //Type
    m_rgResType[i].CreateIndirect(m_hWndSchemas, RES_TYPE[i]);
    m_rgResType[i].Populate(g_cVariantTypes, g_rgVariantTypes);

    //Value
    m_rgResValue[i].CreateIndirect(m_hWndSchemas, RES_VALUE[i]);
  }

  //Try to find DBSCHEMA_TABLES by default (or our saved index)
  if(m_iSchemaIndex == LVM_ERR)
    m_iSchemaIndex = m_comboSchema.FindStringExact(L"DBSCHEMA_TABLES");
  m_iSchemaIndex = m_comboSchema.SetCurSel(m_iSchemaIndex==CB_ERR ? 0 : m_iSchemaIndex);

CLEANUP:
  return hr;
}

HRESULT CSchemaDlg::InitTreeView ( HWND hWnd ) [virtual]

Definition at line 4429 of file cdialog.cpp.

{
  HRESULT hr = S_OK;
  m_hWndTreeWnd = hWnd;

  //Saved Defaults
  m_fEditing = FALSE;
  m_iOldSchemaIndex = LVM_ERR;
  m_hWndTreeView = ::GetDlgItem(hWnd, IDC_TREEVIEW);

  //Set image list to the Table Window
  HIMAGELIST hTableImageList = ImageList_LoadImage(GetAppLite()->m_hInstance, MAKEINTRESOURCE(IDB_IMAGE), 16, 16, CLR_DEFAULT , IMAGE_BITMAP, LR_DEFAULTCOLOR);
  TreeView_SetImageList(m_hWndTreeView, hTableImageList, TVSIL_NORMAL);
  return hr;
}

HRESULT CSchemaDlg::RefreshTreeControls ( ) [virtual]

Definition at line 4657 of file cdialog.cpp.

{
  HWND hWndColName = ::GetDlgItem(m_hWndTreeWnd, IDT_COLUMNNAME);

  if(m_iSchemaIndex != m_iOldSchemaIndex)
  {
        ::EnableWindow(m_hWndTreeView, FALSE);
        ::EnableWindow(hWndColName, FALSE);
        ::EnableWindow(::GetDlgItem(m_hWndTreeWnd, IDM_COPYTEXT), FALSE);
        ::EnableWindow(::GetDlgItem(m_hWndTreeWnd, IDM_OPENROWSET), FALSE);
  }
  else
  {
        ::EnableWindow(m_hWndTreeView, TRUE);
        ::EnableWindow(hWndColName, TRUE);

    //Get the Selected TreeItem
    HTREEITEM hItem = (HTREEITEM)SendMessage(m_hWndTreeView, TVM_GETNEXTITEM, (WPARAM)TVGN_CARET, (LPARAM)TVI_ROOT);

    //Update the ColName header...
    ASSERT(m_pCTreeRowset);

    DBORDINAL iOrdinal = TV_GetItemParam(m_hWndTreeView, hItem);
    if(hItem && iOrdinal != LVM_ERR && iOrdinal<m_pCTreeRowset->m_ColumnInfo.GetCount())
    {
      wSendMessage(hWndColName, WM_SETTEXT, 0, GetColName(m_pCTreeRowset->m_ColumnInfo.GetOrdinal(iOrdinal)));
            ::EnableWindow(::GetDlgItem(m_hWndTreeWnd, IDM_COPYTEXT), TRUE);
            ::EnableWindow(::GetDlgItem(m_hWndTreeWnd, IDM_OPENROWSET), TRUE);
    }
    else
    {
      SendMessage(hWndColName, WM_SETTEXT, 0, (LPARAM)"");
            ::EnableWindow(::GetDlgItem(m_hWndTreeWnd, IDM_COPYTEXT), FALSE);
            ::EnableWindow(::GetDlgItem(m_hWndTreeWnd, IDM_OPENROWSET), FALSE);
    }
  }

  return S_OK;
}

INT_PTR WINAPI CSchemaDlg::SchemaRowsetProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 4221 of file cdialog.cpp.

{
  static PROPSHEETPAGE* ps = NULL;
  static BOOL fAggregation  = FALSE;    //Default
  static BOOL fOutput     = TRUE;     //Default

  switch(message)
  {
    case WM_INITDIALOG:
    {
      //Save the "this" pointer
      CWaitCursor waitCursor;
      ps = (PROPSHEETPAGE*)lParam;
      CSchemaDlg* pThis = (CSchemaDlg*)SetThis(hWnd, (void*)ps->lParam);

      //Aggregation
            ::CheckDlgButton(hWnd, IDB_AGGREGATION,    BST2STATE(fAggregation));

      //Output (ppIUnknown)
            ::CheckDlgButton(hWnd, IDB_OUTPUT,     BST2STATE(fOutput));

      //Schemas
      pThis->InitSchemas(hWnd);
      pThis->ChangeRestrictions();
      return TRUE;
    }

    case WM_COMMAND:
    {
      //CBN_SELCHANGE ListBox Selection change
      switch(GET_WM_COMMAND_CMD(wParam, lParam))
      {
        //Selection change in a list box occurred
        case CBN_SELCHANGE:
        {
          //See which combo box has changed
          switch(GET_WM_COMMAND_ID(wParam, lParam))
          {
            case IDC_SCHEMAS:
            {
              //Get the "this" pointer
              CSchemaDlg* pThis = (CSchemaDlg*)GetThis(hWnd);

              //Get Selected Schema
              pThis->ChangeRestrictions();
              return 0;
            }
          }
          break;
        }

        //Selection change in a list box occurred
        case CBN_DROPDOWN:
        {
          //See which combo box has changed
          switch(GET_WM_COMMAND_ID(wParam, lParam))
          {
            case IDC_SCHEMAS:
            {
              //Get the "this" pointer
              CSchemaDlg* pThis = (CSchemaDlg*)GetThis(hWnd);

              //Update button state
              BOOL fShowSupported = ::IsDlgButtonChecked(hWnd, IDB_SHOWSUPPORTED);

              //Get Selected Schema
              //Only need to do this if (ShowSupported) has changed...
              if(fShowSupported != pThis->m_fShowSupported)
              {
                pThis->m_fShowSupported = fShowSupported;
                pThis->InitSchemaCombo(fShowSupported);
              }
              return 0;
            }
          }
          break;
        }

        return FALSE;
      }

      switch (GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDB_SETPROPERTIES:
        {
          //Get the "this" pointer
          CSchemaDlg* pThis = (CSchemaDlg*)GetThis(hWnd);
          CMDIChild* pCMDIChild = pThis->m_pCMDIChild;
          CMainWindow* pCMainWindow = pCMDIChild->m_pCMainWindow;

          CSession* pCSession     = (CSession*)pCMDIChild->GetObject(eCSession);
          CDataSource* pCDataSource = SOURCE_GETPARENT(pCSession, CDataSource);

          //SetProperties
          CPropertiesDlg sCPropertiesDlg(pCMainWindow);
          sCPropertiesDlg.SetProperties(hWnd, &DBPROPSET_ROWSETALL, IID_IRowsetInfo, NULL, pCDataSource ? pCDataSource->m_pIDBProperties : NULL, &pThis->m_CPropSets);
          return 0;
        }
      }
      break;

    }//WM_COMMAND

    case WM_NOTIFY:
    {
      switch (((NMHDR*)lParam)->code)
        {
        case PSN_SETACTIVE:
        {
          //Get the "this" pointer
          CSchemaDlg* pThis = (CSchemaDlg*)GetThis(hWnd);
          pThis->m_fActive = TRUE;
          return 0;
        }

        case PSN_KILLACTIVE://Switch
        {
          //Get the "this" pointer
          CSchemaDlg* pThis = (CSchemaDlg*)GetThis(hWnd);
          if(FAILED(pThis->GetSelectedRestrictions()))
          {
            SetWindowLongPtr(hWnd, DWLP_MSGRESULT, PSNRET_INVALID_NOCHANGEPAGE);
            return TRUE;
          }
          return 0;
        }

        case PSN_APPLY:
        {
          CWaitCursor waitCursor;

          //Get the "this" pointer
          CSchemaDlg* pThis = (CSchemaDlg*)GetThis(hWnd);
          CMDIChild* pCMDIChild = pThis->m_pCMDIChild;

          CSession* pCSession     = (CSession*)pCMDIChild->GetObject(eCSession);
          CAggregate* pCAggregate   = NULL;
          CComPtr<IUnknown> spUnknown;
          HRESULT hr = S_OK;

          if(pThis->m_fEditing)
          {
            //There is a bug in the TreeView control for editing here is KB article
            //Article ID: Q130691 BUG: ESC/ENTER Keys Don't Work When Editing Labels in TreeView
            //So one way to work around this is to just have a flag (m_fEditing)
            //to indicate we were in editing mode.
            SendMessage(pThis->m_hWndTreeView, TVM_ENDEDITLABELNOW, (WPARAM) (wParam==IDCANCEL ? TRUE : FALSE), (LPARAM)0);
            SetWindowLongPtr(hWnd, DWLP_MSGRESULT, PSNRET_INVALID_NOCHANGEPAGE);
            return TRUE;
          }

          if(pThis->m_fActive)
          {
            //Setup Properties
            ULONG cPropSets = 0;
            DBPROPSET* rgPropSets = NULL;

            if(pThis->m_fUseProperties)
            {
              cPropSets = pThis->m_CPropSets.GetCount();
              rgPropSets = pThis->m_CPropSets.GetPropSets();
            }

            //Obtain the Aggregation argument
            fAggregation = ::IsDlgButtonChecked(hWnd, IDB_AGGREGATION);
            if(fAggregation)
              pCAggregate = new CAggregate();

            //Obtain the Output (ppIUnknown) argument
            fOutput = ::IsDlgButtonChecked(hWnd, IDB_OUTPUT);

            //Get the selected Schema...
            SCHEMAINFO* pSchemaInfo = NULL;
            TESTC(hr = pThis->GetSelectedSchema(&pSchemaInfo));

            //Create the Schema Rowset
            TESTC(hr = pCSession->GetSchemaRowset(pCAggregate, *pSchemaInfo->pguidSchema, pThis->m_cRestrictions, pThis->m_rgRestrictions, IID_IUnknown, cPropSets, rgPropSets, fOutput ? &spUnknown : NULL));

            //Process the Rowset
            TESTC(hr = pCMDIChild->HandleRowset(pCSession, spUnknown, IID_IUnknown, CREATE_NEWWINDOW_IFEXISTS, *pSchemaInfo->pguidSchema, NULL, TRUE/*bSchemaRowset*/));
          }

        CLEANUP:
          SAFE_RELEASE(pCAggregate);
          if(FAILED(hr))
          {
            SetWindowLongPtr(hWnd, DWLP_MSGRESULT, PSNRET_INVALID_NOCHANGEPAGE);
            return TRUE;
          }
          return 0;
        }

        case PSN_RESET:   //CANCEL
          return 0;

      }
      }//WM_NOTIFY

  }//switch(message);

  return FALSE;
}

INT_PTR WINAPI CSchemaDlg::SchemaTreeProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 4450 of file cdialog.cpp.

{
  static PROPSHEETPAGE* ps = NULL;

  switch(message)
  {
    case WM_INITDIALOG:
    {
      CWaitCursor waitCursor;

      //Save the "this" pointer
      ps = (PROPSHEETPAGE*)lParam;
      CSchemaDlg* pThis = (CSchemaDlg*)SetThis(hWnd, (void*)ps->lParam);

      //Initialize the TreeView Page
      pThis->InitTreeView(hWnd);
      return TRUE;
    }

    case WM_COMMAND:
    {
      //Filter out any Control Notification codes
      if(GET_WM_COMMAND_CMD(wParam, lParam) > 1)
      {
        return UNHANDLED_MSG;
      }

      //Regular command messages
      switch(GET_WM_COMMAND_ID(wParam, lParam))
      {
        case IDM_OPENROWSET:
        {
          //Get the "this" pointer
          CSchemaDlg* pThis = (CSchemaDlg*)GetThis(hWnd);

          //Send a IDM_COPYTEXT to copy the text to the edit box
          SendMessage(hWnd, WM_COMMAND, GET_WM_COMMAND_MPS(IDM_COPYTEXT, hWnd, 0));

          //Delete to our OpenRowset dialog box...
          pThis->m_pCMDIChild->m_pCSource = pThis->m_pCMDIChild->GetObject(eCSession);
          pThis->m_pCMDIChild->m_idSource = IDM_OPENROWSET;
          DisplayDialog(IDD_OPENROWSET, hWnd, pThis->m_pCMDIChild->OpenRowsetProc, (LPARAM)pThis->m_pCMDIChild);
          return 0;
        }

        case IDM_COPYTEXT:
        {
          //Get the "this" pointer
          CSchemaDlg* pThis = (CSchemaDlg*)GetThis(hWnd);
          WCHAR wszBuffer[MAX_NAME_LEN+1];

          //Get the Selected Item
          HTREEITEM hItem = (HTREEITEM)SendMessage(pThis->m_hWndTreeView, TVM_GETNEXTITEM, (WPARAM)TVGN_CARET, (LPARAM)TVI_ROOT);

          if(TV_GetItemText(pThis->m_hWndTreeView, hItem, wszBuffer, MAX_NAME_LEN))
          {
            //Now just need to place this name in the EditBox
            //Inserted after the current "caret"
            pThis->m_pCMDIChild->m_pCQueryBox->ReplaceAll(wszBuffer, FALSE/*bReplaceAll*/, TRUE/*fHighlight*/);
          }
          return 0;
        }

        case IDB_DISPLAYTREE:
        {
          //Get the "this" pointer
          CSchemaDlg* pThis = (CSchemaDlg*)GetThis(hWnd);

          //Make sure we do a regeneration of the tree
          pThis->DisplayTree();
          return 0;
        }
      }

      return FALSE;
    }

    // Update status bar to reflect menu selection
    case WM_MENUSELECT:
    {
      //Get the "this" pointer
      CSchemaDlg* pThis = (CSchemaDlg*)GetThis(hWnd);
      pThis->m_pCMDIChild->m_pCMainWindow->OnMenuSelect(LOWORD(wParam));
      return 0;
    }

    case WM_CONTEXTMENU:
    {
      CSchemaDlg* pThis = (CSchemaDlg*)GetThis(hWnd);

      //Only display the Context menu, if there is a selected item
      HTREEITEM hItem = (HTREEITEM)SendMessage(pThis->m_hWndTreeView, TVM_GETNEXTITEM, (WPARAM)TVGN_CARET, (LPARAM)TVI_ROOT);

      if(hItem)
      {
        DisplayContextMenu(
                hWnd,
                IDM_TREESCHEMA,
                MAKEPOINTS(lParam),
                hWnd
                );
      }
      return FALSE;
    }

    case WM_NOTIFY:
    {
      switch (((NMHDR*)lParam)->code)
        {
        case TVN_BEGINLABELEDIT:
        {
          //Get the "this" pointer
          CSchemaDlg* pThis = (CSchemaDlg*)GetThis(hWnd);

          //Idicate we have started to edit
          pThis->m_fEditing = TRUE;
          return FALSE; //Allow the edited change
        }

        case TVN_ENDLABELEDIT:
        {
          //Get the "this" pointer
          CSchemaDlg* pThis = (CSchemaDlg*)GetThis(hWnd);
          pThis->m_fEditing = FALSE;
          return TRUE; //Allow the edited change
        }

        case TVN_SELCHANGED:
        {
          //There is a problem with the SELCHANGED notification
          //It can be sent when either a item is selected or
          //DELETED, since when an item deleted the selection moves
          //to a different selection.
          NM_TREEVIEW* pTreeView = (NM_TREEVIEW*)lParam;
          if(pTreeView->itemNew.state & TVIS_SELECTED && pTreeView->action)
          {
            //Get the "this" pointer
            CSchemaDlg* pThis = (CSchemaDlg*)GetThis(hWnd);
            pThis->RefreshTreeControls();
          }
          return 0;
        }

        case TTN_GETDISPINFO:
        {
          //Get the "this" pointer
          CSchemaDlg* pThis = (CSchemaDlg*)GetThis(hWnd);
          return 0;
        }

        case PSN_SETACTIVE:
        {
          //Get the "this" pointer
          CSchemaDlg* pThis = (CSchemaDlg*)GetThis(hWnd);

          //Need to display the specified SchemaRowset
          pThis->RefreshTreeControls();
          pThis->m_fActive = FALSE;
          return 0;
        }

        case PSN_KILLACTIVE://Switch
          return 0;

        case PSN_APPLY:
        {
          CWaitCursor waitCursor;

          //Get the "this" pointer
          CSchemaDlg* pThis = (CSchemaDlg*)GetThis(hWnd);
          if(pThis->m_fEditing)
          {
            //There is a bug in the TreeView control for editing here is KB article
            //Article ID: Q130691 BUG: ESC/ENTER Keys Don't Work When Editing Labels in TreeView
            //So one way to work around this is to just have a flag (m_fEditing)
            //to indicate we were in editing mode.
            SendMessage(pThis->m_hWndTreeView, TVM_ENDEDITLABELNOW, (WPARAM) (wParam==IDCANCEL ? TRUE : FALSE), (LPARAM)0);
            SetWindowLongPtr(hWnd, DWLP_MSGRESULT, PSNRET_INVALID_NOCHANGEPAGE);
            return TRUE;
          }

          SAFE_RELEASE(pThis->m_pCTreeRowset);
          return 0;
        }

        case PSN_RESET:   //CANCEL
        {
          //Get the "this" pointer
          CSchemaDlg* pThis = (CSchemaDlg*)GetThis(hWnd);
          SAFE_RELEASE(pThis->m_pCTreeRowset);
          return 0;
        }

      }
      }//WM_NOTIFY

  }//switch(message);

  return FALSE;
}

Member Data Documentation

CComboBoxLite CSchemaDlg::m_comboSchema

Definition at line 626 of file cdialog.h.

CPropSets CSchemaDlg::m_CPropSets

Definition at line 618 of file cdialog.h.

ULONG CSchemaDlg::m_cRestrictions

Definition at line 610 of file cdialog.h.

ULONG CSchemaDlg::m_cSchemas

Definition at line 601 of file cdialog.h.

BOOL CSchemaDlg::m_fActive

Definition at line 599 of file cdialog.h.

BOOL CSchemaDlg::m_fEditing

Definition at line 598 of file cdialog.h.

BOOL CSchemaDlg::m_fShowSupported

Definition at line 615 of file cdialog.h.

BOOL CSchemaDlg::m_fUseProperties

Definition at line 614 of file cdialog.h.

BOOL CSchemaDlg::m_fUseRestrictions

Definition at line 613 of file cdialog.h.

HWND CSchemaDlg::m_hWndSchemas

Definition at line 593 of file cdialog.h.

HWND CSchemaDlg::m_hWndTreeView

Definition at line 595 of file cdialog.h.

HWND CSchemaDlg::m_hWndTreeWnd

Definition at line 594 of file cdialog.h.

INDEX CSchemaDlg::m_iOldSchemaIndex

Definition at line 607 of file cdialog.h.

INDEX CSchemaDlg::m_iSchemaIndex

Definition at line 606 of file cdialog.h.

CRowset* CSchemaDlg::m_pCTreeRowset

Definition at line 608 of file cdialog.h.

CWndLite CSchemaDlg::m_rgResName[MAX_RESTRICTIONS]

Definition at line 621 of file cdialog.h.

VARIANT CSchemaDlg::m_rgRestrictions[MAX_RESTRICTIONS]

Definition at line 611 of file cdialog.h.

ULONG* CSchemaDlg::m_rgRestrictionSupport

Definition at line 603 of file cdialog.h.

CComboBoxLite CSchemaDlg::m_rgResType[MAX_RESTRICTIONS]

Definition at line 622 of file cdialog.h.

CComboBoxString CSchemaDlg::m_rgResValue[MAX_RESTRICTIONS]

Definition at line 623 of file cdialog.h.

GUID* CSchemaDlg::m_rgSchemas

Definition at line 602 of file cdialog.h.

SCHEMAINFO CSchemaDlg::m_SchemaInfo

Definition at line 605 of file cdialog.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialog.h
  • Dataaccess/oledb/rowsetviewer/cdialog.cpp
Generated on Wed Nov 13 2024 16:57:17 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSCP Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CSCP Class Reference

#include "SCP.h"

List of all members.

Public Member Functions

CSCP ()
~CSCP ()
STDMETHOD() | AddPages (LPFNADDPROPSHEETPAGE pAddPageProc, LPARAM lParam)
DECLARE_REGISTRY_CLSID ()
STDMETHOD() | Initialize (LPCITEMIDLIST pIDFolder, LPDATAOBJECT pDataObject, HKEY hKeyID)
STDMETHOD() | ReplacePage (UINT uPageID, LPFNADDPROPSHEETPAGE lpfnReplaceWith, LPARAM lParam)

Private Attributes

CSCPUIBindingInfo * m_pProppageUIBindingInfo
CSCPUIGeneral * m_pProppageUIGeneral
CSCPUIKeywords * m_pProppageUIKeywords
CComPtr< IDataObject > | m_spDataObj

Detailed Description

Definition at line 18 of file SCP.h.

Constructor & Destructor Documentation

CSCP::CSCP ( ) [inline]

Definition at line 25 of file SCP.h.

  {
    m_pProppageUIGeneral      = NULL;
    m_pProppageUIBindingInfo  = NULL;
    m_pProppageUIKeywords     = NULL;
  }

CSCP::~CSCP ( ) [inline]

Definition at line 32 of file SCP.h.

  {
  }

Member Function Documentation

STDMETHODIMP CSCP::AddPages | ( | LPFNADDPROPSHEETPAGE | pAddPageProc,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 39 of file SCP.cpp.

{
  AFX_MANAGE_STATE(AfxGetStaticModuleState());

  //
  // Unpack the data pointer and create the property page.
  // Register clipboard format
  //
  CLIPFORMAT cfDsObjectNames = (CLIPFORMAT)RegisterClipboardFormat(CFSTR_DSOBJECTNAMES);
  ASSERT(cfDsObjectNames != 0);

  FORMATETC fmte = { cfDsObjectNames, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL};
  STGMEDIUM objMedium;

  HRESULT hr = m_spDataObj->GetData(&fmte, &objMedium);
  if (FAILED(hr))
  {
    AfxMessageBox(_T("Failed to retrieve data from medium."));
    return hr;
  }

  LPDSOBJECTNAMES pDsObjectNames;
  pDsObjectNames = (LPDSOBJECTNAMES)objMedium.hGlobal;
  if (pDsObjectNames->cItems < 1)
  {
    return ERROR_INVALID_DATA;
  }

  PWSTR pszObjADsPath = (PWSTR)BYTE_OFFSET(pDsObjectNames, pDsObjectNames->aObjects[0].offsetName);
  PWSTR pszClass = (PWSTR)BYTE_OFFSET(pDsObjectNames, pDsObjectNames->aObjects[0].offsetClass);
  TRACE(_T("Object path: %s, class: %s\n"), pszObjADsPath, pszClass);

  //
  // Create/contact the notification object.
  //
  HWND hNotifyObj;

  hr = ADsPropCreateNotifyObj(m_spDataObj, pszObjADsPath, &hNotifyObj);

  if (FAILED(hr))
  {
    return hr;
  }

  //
  // Create and initialize the general page
  //
  m_pProppageUIGeneral = new CSCPUIGeneral(hNotifyObj);
  m_pProppageUIGeneral->Init(pszObjADsPath, pszClass);

  //
  // Add the general page to the sheet
  //
  ((PROPSHEETPAGE*)&m_pProppageUIGeneral->m_psp)->lParam = (LPARAM)m_pProppageUIGeneral;
  if (!(*pAddPageProc)(CreatePropertySheetPage((PROPSHEETPAGE*)&m_pProppageUIGeneral->m_psp), (LPARAM)lParam))
  {
    return E_FAIL;
  }

  //
  // Create and initialize the binding information page
  //
  m_pProppageUIBindingInfo = new CSCPUIBindingInfo(hNotifyObj);
  m_pProppageUIBindingInfo->Init(pszObjADsPath, pszClass);

  //
  // Add the binding information page to the sheet
  //
  ((PROPSHEETPAGE*)&m_pProppageUIBindingInfo->m_psp)->lParam = (LPARAM)m_pProppageUIBindingInfo;
  if (!(*pAddPageProc)(CreatePropertySheetPage((PROPSHEETPAGE*)&m_pProppageUIBindingInfo->m_psp), (LPARAM)lParam))
  {
    return E_FAIL;
  }

  //
  // Create and initialize the keywords page
  //
  m_pProppageUIKeywords = new CSCPUIKeywords(hNotifyObj);
  m_pProppageUIKeywords->Init(pszObjADsPath, pszClass);

  //
  // Add the keywords page to the sheet
  //
  ((PROPSHEETPAGE*)&m_pProppageUIKeywords->m_psp)->lParam = (LPARAM)m_pProppageUIKeywords;
  if (!(*pAddPageProc)(CreatePropertySheetPage((PROPSHEETPAGE*)&m_pProppageUIKeywords->m_psp), (LPARAM)lParam))
  {
    return E_FAIL;
  }

  return S_OK;
}

CSCP::DECLARE_REGISTRY_CLSID ( )
STDMETHODIMP CSCP::Initialize | ( | LPCITEMIDLIST | pIDFolder,
 |  | LPDATAOBJECT | pDataObject,
 |  | HKEY | hKeyID
 | ) |  |

Definition at line 20 of file SCP.cpp.

{
  if (pDataObject != NULL)
  {
    //
    // Store the IDataObject in a smart pointer.
    //
    m_spDataObj = pDataObject;
  }
  else
  {
    return E_INVALIDARG;
  }
  return S_OK;
}

STDMETHODIMP CSCP::ReplacePage | ( | UINT | uPageID,
 |  | LPFNADDPROPSHEETPAGE | lpfnReplaceWith,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 131 of file SCP.cpp.

{
  //
  // This method is not used.  It should only be called if the pages are an extension for the Control Panel.
  //
  return E_FAIL;
}

Member Data Documentation

CSCPUIBindingInfo* CSCP::m_pProppageUIBindingInfo [private]

Definition at line 59 of file SCP.h.

CSCPUIGeneral* CSCP::m_pProppageUIGeneral [private]

Definition at line 58 of file SCP.h.

CSCPUIKeywords* CSCP::m_pProppageUIKeywords [private]

Definition at line 60 of file SCP.h.

CComPtr<IDataObject> CSCP::m_spDataObj [private]

Definition at line 62 of file SCP.h.

The documentation for this class was generated from the following files:
  • NetDS/ADSI/samples/DSUI/scpext/scpproppage/SCP.h
  • NetDS/ADSI/samples/DSUI/scpext/scpproppage/SCP.cpp
Generated on Wed Nov 13 2024 16:57:17 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSCPCMenuApp Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CSCPCMenuApp Class Reference

Inherits CWinApp.

List of all members.

Public Member Functions

virtual int | ExitInstance ()
virtual BOOL | InitInstance ()

Detailed Description

Definition at line 37 of file SCPCMenu.cpp.

Member Function Documentation

int CSCPCMenuApp::ExitInstance ( void ) [virtual]

Reimplemented from CWinApp.

Definition at line 52 of file SCPCMenu.cpp.

{
  _Module.Term();
  return CWinApp::ExitInstance();
}

BOOL CSCPCMenuApp::InitInstance ( void ) [virtual]

Reimplemented from CWinApp.

Definition at line 46 of file SCPCMenu.cpp.

{
  _Module.Init(ObjectMap, m_hInstance);
  return CWinApp::InitInstance();
}

The documentation for this class was generated from the following file:
  • NetDS/ADSI/samples/DSUI/scpext/scpcmenu/SCPCMenu.cpp
Generated on Wed Nov 13 2024 16:57:17 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSCPCMenuDialog Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CSCPCMenuDialog Class Reference

#include "scpcmenuui.h"

List of all members.

Public Member Functions

CSCPCMenuDialog (IDataObject *pDataObj)
~CSCPCMenuDialog ()
virtual BOOL | OnInitDialog ()
void | RetrieveData ()
void | SetUIData ()

Private Attributes

CLIPFORMAT | m_cfDsDisplaySpecOptions
CLIPFORMAT | m_cfDsObjectNames
CComPtr< IDataObject > | m_spDataObj
CString m_szADsPath
CString m_szClass
CString m_szPrefix
CString m_szServer
CString m_szServerConfigPath
CString m_szUsername

Detailed Description

Definition at line 16 of file scpcmenuui.h.

Constructor & Destructor Documentation

CSCPCMenuDialog::CSCPCMenuDialog ( IDataObject * pDataObj ) [inline]

Definition at line 19 of file scpcmenuui.h.

                                         : CDialog(IDD_SCP_MENU_DIALOG)
  {
    m_spDataObj   = pDataObj;
    m_szPrefix    = _T("");
    m_szUsername  = _T("");
    m_szServer    = _T("");
    m_szServerConfigPath = _T("");
    m_szADsPath   = _T("");
    m_szClass     = _T("");
  }

CSCPCMenuDialog::~CSCPCMenuDialog ( ) [inline]

Definition at line 30 of file scpcmenuui.h.

{}

Member Function Documentation

BOOL CSCPCMenuDialog::OnInitDialog ( ) [virtual]

Definition at line 19 of file scpcmenuui.cpp.

{
  //
  // Register the clipboard formats for retrieving info from the DS object
  //
  m_cfDsDisplaySpecOptions  = RegisterClipboardFormat(CFSTR_DS_DISPLAY_SPEC_OPTIONS);
  m_cfDsObjectNames         = RegisterClipboardFormat(CFSTR_DSOBJECTNAMES);

  RetrieveData();
  SetUIData();
  return TRUE;
}

void CSCPCMenuDialog::RetrieveData ( )

Definition at line 32 of file scpcmenuui.cpp.

{
  //
  // Get display info using CFSTR_DS_DISPLAY_SPEC_OPTIONS
  //
  PDSDISPLAYSPECOPTIONS pDsSpecOptions = NULL;

  //
  // Need to get CFSTR_Ds_DISPLAY_SPEC_OPTIONS as HGLOBAL
  //
  STGMEDIUM stgmedium = { TYMED_HGLOBAL, NULL, NULL };

  //
  // Initialize formatetc for CFSTR_DS_DISPLAY_SPEC_OPTIONS format.
  //
  FORMATETC formatetc = { m_cfDsDisplaySpecOptions, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };

  //
  // Get the global memory block containing the display option
  // info for the selected object
  //
  HRESULT hr = m_spDataObj->GetData(&formatetc, &stgmedium);
  if (FAILED(hr))
  {
    return;
  }

  //
  // Assign pointer to DSDISPLAYSPECOPTIONS structure
  //
  pDsSpecOptions = (PDSDISPLAYSPECOPTIONS)GlobalLock(stgmedium.hGlobal);
  if (pDsSpecOptions != NULL)
  {
    m_szPrefix    = (PWSTR)BYTE_OFFSET(pDsSpecOptions, pDsSpecOptions->offsetAttribPrefix);
    m_szUsername  = (PWSTR)BYTE_OFFSET(pDsSpecOptions, pDsSpecOptions->offsetUserName);
    m_szServer    = (PWSTR)BYTE_OFFSET(pDsSpecOptions, pDsSpecOptions->offsetServer);
    m_szServerConfigPath = (PWSTR)BYTE_OFFSET(pDsSpecOptions, pDsSpecOptions->offsetServerConfigPath);
  }

  //
  // Clean up
  //
  GlobalUnlock(stgmedium.hGlobal);
  ReleaseStgMedium(&stgmedium);

  //
  // Get display info using CFSTR_DSOBJECTNAMES
  //
  FORMATETC fmte = { m_cfDsObjectNames, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL};
  STGMEDIUM objMedium;

  hr = m_spDataObj->GetData(&fmte, &objMedium);
  if (FAILED(hr))
  {
    AfxMessageBox(_T("Failed to retrieve data from medium."));
    return;
  }

  LPDSOBJECTNAMES pDsObjectNames;
  pDsObjectNames = (LPDSOBJECTNAMES)objMedium.hGlobal;
  if (pDsObjectNames->cItems < 1)
  {
    return;
  }

  m_szADsPath = (PWSTR)BYTE_OFFSET(pDsObjectNames, pDsObjectNames->aObjects[0].offsetName);
  m_szClass = (PWSTR)BYTE_OFFSET(pDsObjectNames, pDsObjectNames->aObjects[0].offsetClass);
}

void CSCPCMenuDialog::SetUIData ( )

Definition at line 102 of file scpcmenuui.cpp.

{
  GetDlgItem(IDC_PREFIX_EDIT)->SetWindowText(m_szPrefix);
  GetDlgItem(IDC_USER_EDIT)->SetWindowText(m_szUsername);
  GetDlgItem(IDC_SERVER_EDIT)->SetWindowText(m_szServer);
  GetDlgItem(IDC_SERVER_CONFIG_PATH_EDIT)->SetWindowText(m_szServerConfigPath);
  GetDlgItem(IDC_PATH_EDIT)->SetWindowText(m_szADsPath);
  GetDlgItem(IDC_CLASS_EDIT)->SetWindowText(m_szClass);
}

Member Data Documentation

CLIPFORMAT CSCPCMenuDialog::m_cfDsDisplaySpecOptions [private]

Definition at line 40 of file scpcmenuui.h.

CLIPFORMAT CSCPCMenuDialog::m_cfDsObjectNames [private]

Definition at line 41 of file scpcmenuui.h.

CComPtr<IDataObject> CSCPCMenuDialog::m_spDataObj [private]

Definition at line 39 of file scpcmenuui.h.

CString CSCPCMenuDialog::m_szADsPath [private]

Definition at line 47 of file scpcmenuui.h.

CString CSCPCMenuDialog::m_szClass [private]

Definition at line 48 of file scpcmenuui.h.

CString CSCPCMenuDialog::m_szPrefix [private]

Definition at line 43 of file scpcmenuui.h.

CString CSCPCMenuDialog::m_szServer [private]

Definition at line 45 of file scpcmenuui.h.

CString CSCPCMenuDialog::m_szServerConfigPath [private]

Definition at line 46 of file scpcmenuui.h.

CString CSCPCMenuDialog::m_szUsername [private]

Definition at line 44 of file scpcmenuui.h.

The documentation for this class was generated from the following files:
  • NetDS/ADSI/samples/DSUI/scpext/scpcmenu/scpcmenuui.h
  • NetDS/ADSI/samples/DSUI/scpext/scpcmenu/scpcmenuui.cpp
Generated on Wed Nov 13 2024 16:57:17 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSCPContextMenuModule Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CSCPContextMenuModule Class Reference

#include "StdAfx.h"

List of all members.

Public Member Functions

HRESULT WINAPI UpdateRegistryCLSID (const CLSID &clsid, BOOL bRegister)

Detailed Description

Definition at line 54 of file StdAfx.h.

Member Function Documentation

HRESULT WINAPI CSCPContextMenuModule::UpdateRegistryCLSID | ( | const CLSID & | clsid,
 |  | BOOL | bRegister
 | ) |  |

Definition at line 20 of file StdAfx.cpp.

{
  static const WCHAR szIPS32[] = _T("InprocServer32");
  static const WCHAR szCLSID[] = _T("CLSID");

  HRESULT hRes = S_OK;

  LPOLESTR lpOleStrCLSIDValue;
  ::StringFromCLSID(clsid, &lpOleStrCLSIDValue);

  CRegKey key;
  if (bRegister)
  {
    LONG lRes = key.Open(HKEY_CLASSES_ROOT, szCLSID);
    if (lRes == ERROR_SUCCESS)
    {
      lRes = key.Create(key, lpOleStrCLSIDValue);
      if (lRes == ERROR_SUCCESS)
      {
        WCHAR szModule[_MAX_PATH];
        ::GetModuleFileName(m_hInst, szModule, _MAX_PATH);
        key.SetKeyValue(szIPS32, szModule);
      }
    }
    if (lRes != ERROR_SUCCESS)
      hRes = HRESULT_FROM_WIN32(lRes);
  }
  else
  {
    key.Attach(HKEY_CLASSES_ROOT);
    if (key.Open(key, szCLSID) == ERROR_SUCCESS)
      key.RecurseDeleteKey(lpOleStrCLSIDValue);
  }
  ::CoTaskMemFree(lpOleStrCLSIDValue);
  return hRes;
}

The documentation for this class was generated from the following files:
  • NetDS/ADSI/samples/DSUI/scpext/scpcmenu/StdAfx.h
  • NetDS/ADSI/samples/DSUI/scpext/scpcmenu/StdAfx.cpp
Generated on Wed Nov 13 2024 16:57:17 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSCPPageBindingInfo Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Private Attributes

CSCPPageBindingInfo Class Reference

#include "SCPPageUI.h"

Inherits CPropertyPage.

List of all members.

Public Types

enum | { IDD = IDD_SCP_PAGE_BINDING_INFO }

Public Member Functions

CSCPPageBindingInfo (CSCPWiz *pWizExt)
virtual | ~CSCPPageBindingInfo ()
void | GetSummaryInfo (CString &szSummary)
afx_msg void | OnButtonClick ()
virtual BOOL | OnInitDialog ()
virtual BOOL | OnKillActive ()
virtual BOOL | OnSetActive ()
void | SetWizardButtons ()

Private Attributes

CMultiValuedAttributeEditor * m_pAttributeEditor
CSCPWiz * m_pWizExt
CStringList | m_szValueList

Detailed Description

Definition at line 64 of file SCPPageUI.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 75 of file SCPPageUI.h.

{ IDD = IDD_SCP_PAGE_BINDING_INFO};

Constructor & Destructor Documentation

CSCPPageBindingInfo::CSCPPageBindingInfo ( CSCPWiz * pWizExt )

Definition at line 205 of file SCPPageUI.cpp.

  : CPropertyPage(IDD_SCP_PAGE_BINDING_INFO)
{
  m_pWizExt = pWizExt;
  m_pAttributeEditor = NULL;
}

virtual CSCPPageBindingInfo::~CSCPPageBindingInfo ( ) [inline, virtual]

Definition at line 69 of file SCPPageUI.h.

  {
    if (m_pAttributeEditor != NULL)
      delete m_pAttributeEditor;
  }

Member Function Documentation

void CSCPPageBindingInfo::GetSummaryInfo ( CString & szSummary )

Definition at line 288 of file SCPPageUI.cpp.

{
  szSummary = _T("Binding Info:\n");
  POSITION pos = m_szValueList.GetHeadPosition();
  while (pos != NULL)
  {
    CString szValue = m_szValueList.GetNext(pos);
    szSummary += _T("\t") + szValue + _T("\n");
  }
}

void CSCPPageBindingInfo::OnButtonClick ( )

Definition at line 272 of file SCPPageUI.cpp.

{
  SetWizardButtons();
}

BOOL CSCPPageBindingInfo::OnInitDialog ( ) [virtual]

Definition at line 213 of file SCPPageUI.cpp.

{
  BOOL bResult = CPropertyPage::OnInitDialog();

  //
  // Set the name of the container
  //
  SetDlgItemText(IDC_EDIT_CONTAINER, m_pWizExt->GetContainerCanonicalName());

  //
  // Set the class icon
  //
  ((CStatic*)GetDlgItem(IDC_STATIC_ICON))->SetIcon(m_pWizExt->GetClassIcon());

  // Disable the Next wizard button until all the controls are filled with valid data.
  HRESULT hr = m_pWizExt->GetIDsAdminNewObj()->SetButtons(1, FALSE);
  if (FAILED(hr))
  {
    // Give error message if the buttons don't get set
    CString szErrorMessage;
    szErrorMessage.Format(_T("SetButtons(1, FALSE) failed with %x"), hr);
    AfxMessageBox(szErrorMessage);
  }

  m_pAttributeEditor = new CMultiValuedAttributeEditor(m_szValueList);
  m_pAttributeEditor->Initialize(IDC_KEYWORD_EDIT,
                                  IDC_KEYWORD_LIST,
                                  IDC_ADD_BUTTON,
                                  IDC_DELETE_BUTTON,
                                  this);

  return bResult;
}

BOOL CSCPPageBindingInfo::OnKillActive ( ) [virtual]

Definition at line 247 of file SCPPageUI.cpp.

{
  BOOL bRet = TRUE;
  HRESULT hr = S_OK;

  // Write changes to temporary object
  ASSERT(m_pWizExt != NULL);
  if (m_pWizExt != NULL && m_pWizExt->GetObj() != NULL)
  {
    hr = SetStringListAttribute(m_pWizExt->GetObj(), L"serviceBindingInformation", m_szValueList);
    if (FAILED(hr))
    {
      AfxMessageBox(_T("Failed to set binding information in temporary object."));
      bRet = FALSE;
    }
  }
  return bRet;
}

BOOL CSCPPageBindingInfo::OnSetActive ( ) [virtual]

Definition at line 266 of file SCPPageUI.cpp.

{
  SetWizardButtons();
  return TRUE;
}

void CSCPPageBindingInfo::SetWizardButtons ( )

Definition at line 277 of file SCPPageUI.cpp.

{
  ASSERT(m_pWizExt != NULL);

  //
  // Enable the next button if the user has supplied at least one value
  //
  BOOL bValid = (m_szValueList.GetCount() > 0) ? TRUE : FALSE;
  HRESULT hr = m_pWizExt->GetIDsAdminNewObj()->SetButtons(1, bValid);
}

Member Data Documentation

CMultiValuedAttributeEditor* CSCPPageBindingInfo::m_pAttributeEditor [private]

Definition at line 94 of file SCPPageUI.h.

CSCPWiz* CSCPPageBindingInfo::m_pWizExt [private]

Definition at line 90 of file SCPPageUI.h.

CStringList CSCPPageBindingInfo::m_szValueList [private]

Definition at line 92 of file SCPPageUI.h.

The documentation for this class was generated from the following files:
  • NetDS/ADSI/samples/DSUI/scpext/scpwizard/SCPPageUI.h
  • NetDS/ADSI/samples/DSUI/scpext/scpwizard/SCPPageUI.cpp
Generated on Wed Nov 13 2024 16:57:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSCPPageGeneral Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Private Attributes

CSCPPageGeneral Class Reference

#include "SCPPageUI.h"

Inherits CPropertyPage.

List of all members.

Public Types

enum | { IDD = IDD_SCP_PAGE_GENERAL }

Public Member Functions

CSCPPageGeneral (CSCPWiz *pWizExt)
virtual | ~CSCPPageGeneral ()
void | GetSummaryInfo (CString &szSummary)
afx_msg void | OnDNSNameChange ()
afx_msg void | OnDNSNameTypeChange ()
virtual BOOL | OnInitDialog ()
virtual BOOL | OnKillActive ()
afx_msg void | OnNameChange ()
afx_msg void | OnServiceClassChange ()
virtual BOOL | OnSetActive ()
void | SetWizardButtons ()

Private Attributes

BOOL m_bNeedCreate
CSCPWiz * m_pWizExt
CString m_szName
CString m_szServiceClassName
CString m_szServiceDNSName
CString m_szServiceDNSNameType

Detailed Description

Definition at line 19 of file SCPPageUI.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 36 of file SCPPageUI.h.

{ IDD = IDD_SCP_PAGE_GENERAL};

Constructor & Destructor Documentation

CSCPPageGeneral::CSCPPageGeneral ( CSCPWiz * pWizExt ) [inline]

Definition at line 22 of file SCPPageUI.h.

    : CPropertyPage(IDD_SCP_PAGE_GENERAL)
  {
    m_pWizExt = pWizExt;
    m_szName  = _T("");
    m_szServiceClassName  = _T("");
    m_szServiceDNSName    = _T("");
    m_bNeedCreate = TRUE;
  }

virtual CSCPPageGeneral::~CSCPPageGeneral ( ) [inline, virtual]

Definition at line 32 of file SCPPageUI.h.

  {
  }

Member Function Documentation

void CSCPPageGeneral::GetSummaryInfo ( CString & szSummary )

Definition at line 180 of file SCPPageUI.cpp.

{
  szSummary =   _T("Name:\t") + m_szName + _T("\n");
  szSummary +=  _T("Service DNS Name:\t") + m_szServiceDNSName + _T("\n");
  szSummary +=  _T("Service DNS Name Type:\t") + m_szServiceDNSNameType + _T("\n");
  szSummary +=  _T("Service Class Name:\t") + m_szServiceClassName + _T("\n");

  CString szDescription;
  GetDlgItem(IDC_DESCRIPTION_EDIT)->GetWindowText(szDescription);
  if (!szDescription.IsEmpty())
  {
    szSummary += _T("Description:\t") + szDescription + _T("\n");
  }
}

void CSCPPageGeneral::OnDNSNameChange ( )

Definition at line 49 of file SCPPageUI.cpp.

{
  GetDlgItem(IDC_DNS_NAME_EDIT)->GetWindowText(m_szServiceDNSName);
  SetWizardButtons();
}

void CSCPPageGeneral::OnDNSNameTypeChange ( )

Definition at line 55 of file SCPPageUI.cpp.

{
  GetDlgItem(IDC_DNS_NAME_TYPE_EDIT)->GetWindowText(m_szServiceDNSNameType);
  SetWizardButtons();
}

BOOL CSCPPageGeneral::OnInitDialog ( ) [virtual]

Definition at line 23 of file SCPPageUI.cpp.

{
  BOOL bResult = CPropertyPage::OnInitDialog();

  //
  // Set the name of the container
  //
  SetDlgItemText(IDC_EDIT_CONTAINER, m_pWizExt->GetContainerCanonicalName());

  //
  // Set the class icon
  //
  ((CStatic*)GetDlgItem(IDC_STATIC_ICON))->SetIcon(m_pWizExt->GetClassIcon());

  // Disable the Next wizard button until all the controls are filled with valid data.
  HRESULT hr = m_pWizExt->GetIDsAdminNewObj()->SetButtons(0, FALSE);
  if (FAILED(hr))
  {
    // Give error message if the buttons don't get set
    CString szErrorMessage;
    szErrorMessage.Format(_T("SetButtons(0, FALSE) failed with %x"), hr);
    AfxMessageBox(szErrorMessage);
  }
  return bResult;
}

BOOL CSCPPageGeneral::OnKillActive ( ) [virtual]

Definition at line 77 of file SCPPageUI.cpp.

{
  HRESULT hr = S_OK;
  BOOL bRet = TRUE;

  // Write changes to temporary object
  ASSERT(m_pWizExt != NULL);
  CComPtr<IDsAdminNewObjPrimarySite> spPrimarySite;
  spPrimarySite = m_pWizExt->GetIDsAdminNewObjPrimarySite();
  ASSERT(spPrimarySite != NULL);

  if (spPrimarySite != NULL)
  {
    CString szName;
    GetDlgItem(IDC_NAME_EDIT)->GetWindowText(szName);
    if (!szName.IsEmpty() && m_bNeedCreate)
    {
      hr = spPrimarySite->CreateNew(szName);
      if (FAILED(hr))
      {
        AfxMessageBox(_T("Failed to create temporary object."));
        bRet = FALSE;
      }
      else
      {
        m_bNeedCreate = FALSE;
      }
    }
  }

  if (m_pWizExt->GetObj() != NULL && bRet)
  {
    CString szDescription;
    GetDlgItem(IDC_DESCRIPTION_EDIT)->GetWindowText(szDescription);
    if (!szDescription.IsEmpty())
    {
      hr = SetStringAttribute(m_pWizExt->GetObj(), L"adminDescription", szDescription);
      if (FAILED(hr))
      {
        AfxMessageBox(_T("Failed to set the description."));
        bRet = FALSE;
      }
    }
    if (bRet)
    {
      hr = SetStringAttribute(m_pWizExt->GetObj(), L"serviceClassName", m_szServiceClassName);
      if (FAILED(hr))
      {
        AfxMessageBox(_T("Failed to set the service class name."));
        bRet = FALSE;
      }
    }

    if (bRet)
    {
      hr = SetStringAttribute(m_pWizExt->GetObj(), L"serviceDNSName", m_szServiceDNSName);
      if (FAILED(hr))
      {
        AfxMessageBox(_T("Failed to set the service DNS name."));
        bRet = FALSE;
      }
    }

    if (bRet)
    {
      hr = SetStringAttribute(m_pWizExt->GetObj(), L"serviceDNSNameType", m_szServiceDNSNameType);
      if (FAILED(hr))
      {
        AfxMessageBox(_T("Failed to set the service DNS name type."));
        bRet = FALSE;
      }
    }

  }

  return bRet;
}

void CSCPPageGeneral::OnNameChange ( )

Definition at line 67 of file SCPPageUI.cpp.

{
  GetDlgItem(IDC_NAME_EDIT)->GetWindowText(m_szName);
  if (m_pWizExt->GetObj() != NULL)
  {
    m_bNeedCreate = TRUE;
  }
  SetWizardButtons();
}

void CSCPPageGeneral::OnServiceClassChange ( )

Definition at line 61 of file SCPPageUI.cpp.

{
  GetDlgItem(IDC_SERVICE_CLASS_EDIT)->GetWindowText(m_szServiceClassName);
  SetWizardButtons();
}

BOOL CSCPPageGeneral::OnSetActive ( ) [virtual]

Definition at line 155 of file SCPPageUI.cpp.

{
  SetWizardButtons();
  return TRUE;
}

void CSCPPageGeneral::SetWizardButtons ( )

Definition at line 161 of file SCPPageUI.cpp.

{
  ASSERT(m_pWizExt != NULL);

  //
  // Enable the next button if the user has supplied a name, dns name,
  // class name, and dns name type
  //
  BOOL bValid = FALSE;
  if (!m_szName.IsEmpty() &&
      !m_szServiceDNSName.IsEmpty() &&
      !m_szServiceClassName.IsEmpty() &&
      !m_szServiceDNSNameType.IsEmpty())
  {
    bValid = TRUE;
  }
  HRESULT hr = m_pWizExt->GetIDsAdminNewObj()->SetButtons(0, bValid);
}

Member Data Documentation

BOOL CSCPPageGeneral::m_bNeedCreate [private]

Definition at line 59 of file SCPPageUI.h.

CSCPWiz* CSCPPageGeneral::m_pWizExt [private]

Definition at line 61 of file SCPPageUI.h.

CString CSCPPageGeneral::m_szName [private]

Definition at line 54 of file SCPPageUI.h.

CString CSCPPageGeneral::m_szServiceClassName [private]

Definition at line 55 of file SCPPageUI.h.

CString CSCPPageGeneral::m_szServiceDNSName [private]

Definition at line 56 of file SCPPageUI.h.

CString CSCPPageGeneral::m_szServiceDNSNameType [private]

Definition at line 57 of file SCPPageUI.h.

The documentation for this class was generated from the following files:
  • NetDS/ADSI/samples/DSUI/scpext/scpwizard/SCPPageUI.h
  • NetDS/ADSI/samples/DSUI/scpext/scpwizard/SCPPageUI.cpp
Generated on Wed Nov 13 2024 16:57:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSCPPageKeywords Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Private Attributes

CSCPPageKeywords Class Reference

#include "SCPPageUI.h"

Inherits CPropertyPage.

List of all members.

Public Types

enum | { IDD = IDD_SCP_PAGE_KEYWORDS }

Public Member Functions

CSCPPageKeywords (CSCPWiz *pWizExt)
virtual | ~CSCPPageKeywords ()
void | GetSummaryInfo (CString &szSummary)
virtual BOOL | OnInitDialog ()
virtual BOOL | OnKillActive ()
virtual BOOL | OnSetActive ()
void | SetWizardButtons ()

Private Attributes

CMultiValuedAttributeEditor * m_pAttributeEditor
CSCPWiz * m_pWizExt
CStringList | m_szValueList

Detailed Description

Definition at line 98 of file SCPPageUI.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 109 of file SCPPageUI.h.

{ IDD = IDD_SCP_PAGE_KEYWORDS};

Constructor & Destructor Documentation

CSCPPageKeywords::CSCPPageKeywords ( CSCPWiz * pWizExt )

Definition at line 307 of file SCPPageUI.cpp.

  : CPropertyPage(IDD_SCP_PAGE_KEYWORDS)
{
  m_pWizExt = pWizExt;
  m_pAttributeEditor = NULL;
}

virtual CSCPPageKeywords::~CSCPPageKeywords ( ) [inline, virtual]

Definition at line 103 of file SCPPageUI.h.

  {
    if (m_pAttributeEditor != NULL)
      delete m_pAttributeEditor;
  }

Member Function Documentation

void CSCPPageKeywords::GetSummaryInfo ( CString & szSummary )

Definition at line 389 of file SCPPageUI.cpp.

{
  szSummary = _T("Keywords:\n");
  POSITION pos = m_szValueList.GetHeadPosition();
  while (pos != NULL)
  {
    CString szValue = m_szValueList.GetNext(pos);
    szSummary += _T("\t") + szValue + _T("\n");
  }
}

BOOL CSCPPageKeywords::OnInitDialog ( ) [virtual]

Definition at line 314 of file SCPPageUI.cpp.

{
  BOOL bResult = CPropertyPage::OnInitDialog();

  //
  // Set the name of the container
  //
  SetDlgItemText(IDC_EDIT_CONTAINER, m_pWizExt->GetContainerCanonicalName());

  //
  // Set the class icon
  //
  ((CStatic*)GetDlgItem(IDC_STATIC_ICON))->SetIcon(m_pWizExt->GetClassIcon());

  // Disable the Next wizard button until all the controls are filled with valid data.
  HRESULT hr = m_pWizExt->GetIDsAdminNewObj()->SetButtons(2, FALSE);
  if (FAILED(hr))
  {
    // Give error message if the buttons don't get set
    CString szErrorMessage;
    szErrorMessage.Format(_T("SetButtons(2, FALSE) failed with %x"), hr);
    AfxMessageBox(szErrorMessage);
  }

  m_pAttributeEditor = new CMultiValuedAttributeEditor(m_szValueList);
  m_pAttributeEditor->Initialize(IDC_KEYWORD_EDIT,
                                  IDC_KEYWORD_LIST,
                                  IDC_ADD_BUTTON,
                                  IDC_DELETE_BUTTON,
                                  this);

  return bResult;
}

BOOL CSCPPageKeywords::OnKillActive ( ) [virtual]

Definition at line 350 of file SCPPageUI.cpp.

{
  BOOL bRet = TRUE;
  HRESULT hr = S_OK;

  // Write changes to temporary object
  ASSERT(m_pWizExt != NULL);
  if (m_pWizExt != NULL && m_pWizExt->GetObj() != NULL)
  {
    if (m_szValueList.GetCount() > 0)
    {
      hr = SetStringListAttribute(m_pWizExt->GetObj(), L"keywords", m_szValueList);
      if (FAILED(hr))
      {
        AfxMessageBox(_T("Failed to set keywords in temporary object."));
        bRet = FALSE;
      }
    }
  }
  return bRet;
}

BOOL CSCPPageKeywords::OnSetActive ( ) [virtual]

Definition at line 372 of file SCPPageUI.cpp.

{
  SetWizardButtons();
  return TRUE;
}

void CSCPPageKeywords::SetWizardButtons ( )

Definition at line 378 of file SCPPageUI.cpp.

{
  ASSERT(m_pWizExt != NULL);

  //
  // Enable the next button if the user has supplied at least on value
  //
  BOOL bValid = TRUE;
  HRESULT hr = m_pWizExt->GetIDsAdminNewObj()->SetButtons(2, bValid);
}

Member Data Documentation

CMultiValuedAttributeEditor* CSCPPageKeywords::m_pAttributeEditor [private]

Definition at line 125 of file SCPPageUI.h.

CSCPWiz* CSCPPageKeywords::m_pWizExt [private]

Definition at line 122 of file SCPPageUI.h.

CStringList CSCPPageKeywords::m_szValueList [private]

Definition at line 124 of file SCPPageUI.h.

The documentation for this class was generated from the following files:
  • NetDS/ADSI/samples/DSUI/scpext/scpwizard/SCPPageUI.h
  • NetDS/ADSI/samples/DSUI/scpext/scpwizard/SCPPageUI.cpp
Generated on Wed Nov 13 2024 16:57:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSCPUIBindingInfo Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CSCPUIBindingInfo Class Reference

#include "SCPUI.h"

Inherits CPropertyPage.

List of all members.

Public Member Functions

CSCPUIBindingInfo ()
CSCPUIBindingInfo (HWND hNotifyObj)
~CSCPUIBindingInfo ()
virtual HRESULT | Init (PWSTR pszPath, PWSTR pszClass)
virtual BOOL | OnApply ()
virtual void | OnDestroy ()
virtual BOOL | OnInitDialog ()
afx_msg void | OnPropertyChange ()
virtual void | SetUIData ()

Private Attributes

BOOL m_bDirty
HWND | m_hNotifyObj
CMultiValuedAttributeEditor * m_pAttributeEditor
PADS_ATTR_INFO | m_pWritableAttrs
CComPtr< IDirectoryObject > | m_spDsObj
CString m_szClass
CString m_szPath
CStringList | m_szValueList

Detailed Description

Definition at line 75 of file SCPUI.h.

Constructor & Destructor Documentation

CSCPUIBindingInfo::CSCPUIBindingInfo ( ) [inline]

Definition at line 79 of file SCPUI.h.

{}

CSCPUIBindingInfo::CSCPUIBindingInfo ( HWND hNotifyObj ) [inline]

Definition at line 80 of file SCPUI.h.

    : CPropertyPage(IDD_SCP_BINDING_INFO_PAGE),
      m_hNotifyObj(hNotifyObj)
  {
    m_bDirty = FALSE;
    m_pAttributeEditor = NULL;
  }

CSCPUIBindingInfo::~CSCPUIBindingInfo ( ) [inline]

Definition at line 88 of file SCPUI.h.

  {
    if (m_pAttributeEditor != NULL)
      delete m_pAttributeEditor;
  }

Member Function Documentation

HRESULT CSCPUIBindingInfo::Init | ( | PWSTR | pszPath,
 |  | PWSTR | pszClass |
 | ) |  |  | [virtual]

Definition at line 329 of file SCPUI.cpp.

{
  //
  // Store local versions of the path and class
  //
  m_szPath = pszPath;
  m_szClass = pszClass;

  //
  // Get the property page initialization parameters from the notify window
  //
  ADSPROPINITPARAMS InitParams = {0};
  InitParams.dwSize = sizeof(ADSPROPINITPARAMS);
  if (!ADsPropGetInitInfo(m_hNotifyObj, &InitParams))
  {
    return E_FAIL;
  }

  if (FAILED(InitParams.hr))
  {
    return InitParams.hr;
  }

  //
  // Store local versions of the IDirectoryObject interface pointer
  // and the writable attributes
  //
  m_spDsObj = InitParams.pDsObj;
  m_pWritableAttrs = InitParams.pWritableAttrs;

  return S_OK;
}

BOOL CSCPUIBindingInfo::OnApply ( ) [virtual]

Definition at line 405 of file SCPUI.cpp.

{
  if (!m_bDirty)
  {
    //
    // Signal the change notification. Note that the notify-apply
    // message must be sent even if the page is not dirty so that
    // the notify ref-counting will properly decrement.
    //
    ::SendMessage(m_hNotifyObj, WM_ADSPROP_NOTIFY_APPLY, TRUE, 0);

    return TRUE;
  }

  ASSERT(m_spDsObj != NULL);

  HRESULT hr = S_OK;
  ADS_ATTR_INFO attrInfo[1];
  PWSTR rgpwzAttrNames[] = { _T("serviceBindingInformation") };
  ADSVALUE* pValue = new ADSVALUE[m_szValueList.GetCount()];
  ASSERT(pValue != NULL);
  if (pValue == NULL)
    return FALSE;

  //
  // Set the update values for adminDescription
  //
  attrInfo[0].dwADsType = ADSTYPE_CASE_IGNORE_STRING;
  attrInfo[0].pszAttrName = rgpwzAttrNames[0];

  POSITION pos = m_szValueList.GetHeadPosition();
  for (int idx = 0; idx < m_szValueList.GetCount(); idx++)
  {
    CString szValue = m_szValueList.GetNext(pos);
    pValue[idx].dwType = ADSTYPE_CASE_IGNORE_STRING;
    pValue[idx].CaseIgnoreString = (LPWSTR)(LPCWSTR)szValue;

    if (pos == NULL)
    {
      break;
    }
  }

  attrInfo[0].pADsValues = pValue;
  attrInfo[0].dwNumValues = m_szValueList.GetCount();
  attrInfo[0].dwControlCode = ADS_ATTR_UPDATE;

  //
  // Update the data in Active Directory
  //
  DWORD dwReturned = 0;
  hr = m_spDsObj->SetObjectAttributes(attrInfo, 1, &dwReturned);
  if (FAILED(hr))
  {
    delete[] pValue;
    AfxMessageBox(_T("Failed to set values for object."));
    return FALSE;
  }
  //
  // Free the memory used to set the values
  //
  delete[] pValue;

  if (dwReturned < 1)
  {
    AfxMessageBox(_T("Failed to set values for object."));
    return FALSE;
  }
  //
  // Signal the change notification. Note that the notify-apply
  // message must be sent even if the page is not dirty so that
  // the notify ref-counting will properly decrement.
  //
  ::SendMessage(m_hNotifyObj, WM_ADSPROP_NOTIFY_APPLY, TRUE, 0);

  return TRUE;
}

void CSCPUIBindingInfo::OnDestroy ( ) [virtual]

Definition at line 493 of file SCPUI.cpp.

{
  CPropertyPage::OnDestroy();

  //
  // Tell the notification object to shut down
  //
  ::SendMessage(m_hNotifyObj, WM_ADSPROP_NOTIFY_EXIT, 0, 0);

  delete this;
}

BOOL CSCPUIBindingInfo::OnInitDialog ( ) [virtual]

Definition at line 297 of file SCPUI.cpp.

{
  BOOL bRes = CPropertyPage::OnInitDialog();

  //
  // Verify that this page is only coming up for users
  //
  ASSERT(m_szClass == _T("serviceConnectionPoint"));

  //
  // Display data in UI
  //
  SetUIData();

  //
  // Create and initialize the multi-valued attribute editor
  //
  m_pAttributeEditor = new CMultiValuedAttributeEditor(m_szValueList);
  m_pAttributeEditor->Initialize(IDC_KEYWORD_EDIT,
                                  IDC_KEYWORD_LIST,
                                  IDC_ADD_BUTTON,
                                  IDC_DELETE_BUTTON,
                                  this);

  //
  // The page may have been marked dirty due to the SetWindowText() in SetUIData(),
  // so clear the dirty flag.
  //
  m_bDirty = FALSE;
  return bRes;
}

void CSCPUIBindingInfo::OnPropertyChange ( )

Definition at line 483 of file SCPUI.cpp.

{
  m_bDirty = TRUE;

  //
  // Enable the apply button
  //
  SetModified(TRUE);
}

void CSCPUIBindingInfo::SetUIData ( ) [virtual]

Definition at line 362 of file SCPUI.cpp.

{
  //
  // Prime the controls with the data from the object
  //
  LPWSTR ppszAttrNames[] = { _T("serviceBindingInformation") };
  PADS_ATTR_INFO pAttrInfo = NULL;
  DWORD dwReturned = 0;

  //
  // Retrieve the data from Active Directory
  //
  HRESULT hr = m_spDsObj->GetObjectAttributes(ppszAttrNames, 1, &pAttrInfo, &dwReturned);
  if (FAILED(hr))
  {
    AfxMessageBox(_T("Failed to retrieve data for this object."));
    return;
  }

  if (dwReturned < 1)
  {
    AfxMessageBox(_T("Failed to retrieve data for this object."));
    return;
  }

  ASSERT(pAttrInfo != NULL);

  //
  // Store the data locally
  //
  for (DWORD idx = 0; idx < dwReturned; idx++)
  {
    for (UINT nCount = 0; nCount < pAttrInfo->dwNumValues; nCount++)
    {
      m_szValueList.AddTail(pAttrInfo->pADsValues[nCount].CaseIgnoreString);
    }
  }

  //
  // Free the memory allocated by GetObjectAttributes()
  FreeADsMem(pAttrInfo);
}

Member Data Documentation

BOOL CSCPUIBindingInfo::m_bDirty [private]

Definition at line 116 of file SCPUI.h.

HWND CSCPUIBindingInfo::m_hNotifyObj [private]

Definition at line 110 of file SCPUI.h.

CMultiValuedAttributeEditor* CSCPUIBindingInfo::m_pAttributeEditor [private]

Definition at line 119 of file SCPUI.h.

PADS_ATTR_INFO CSCPUIBindingInfo::m_pWritableAttrs [private]

Definition at line 114 of file SCPUI.h.

CComPtr<IDirectoryObject> CSCPUIBindingInfo::m_spDsObj [private]

Definition at line 113 of file SCPUI.h.

CString CSCPUIBindingInfo::m_szClass [private]

Definition at line 112 of file SCPUI.h.

CString CSCPUIBindingInfo::m_szPath [private]

Definition at line 111 of file SCPUI.h.

CStringList CSCPUIBindingInfo::m_szValueList [private]

Definition at line 118 of file SCPUI.h.

The documentation for this class was generated from the following files:
  • NetDS/ADSI/samples/DSUI/scpext/scpproppage/SCPUI.h
  • NetDS/ADSI/samples/DSUI/scpext/scpproppage/SCPUI.cpp
Generated on Wed Nov 13 2024 16:57:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSCPUIGeneral Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CSCPUIGeneral Class Reference

#include "SCPUI.h"

Inherits CPropertyPage.

List of all members.

Public Member Functions

CSCPUIGeneral ()
CSCPUIGeneral (HWND hNotifyObj)
~CSCPUIGeneral ()
virtual void | GetUIData ()
virtual HRESULT | Init (PWSTR pszPath, PWSTR pszClass)
virtual BOOL | OnApply ()
virtual void | OnDestroy ()
virtual BOOL | OnInitDialog ()
afx_msg void | OnPropertyChange ()
virtual void | SetUIData ()

Private Attributes

BOOL m_bDirty
HWND | m_hNotifyObj
PADS_ATTR_INFO | m_pWritableAttrs
CComPtr< IDirectoryObject > | m_spDsObj
CString m_szBindingInfo
CString m_szClass
CString m_szDescription
CString m_szPath
CString m_szServiceClassName
CString m_szServiceDNSName
CString m_szServiceDNSNameType

Detailed Description

Definition at line 20 of file SCPUI.h.

Constructor & Destructor Documentation

CSCPUIGeneral::CSCPUIGeneral ( ) [inline]

Definition at line 24 of file SCPUI.h.

{}

CSCPUIGeneral::CSCPUIGeneral ( HWND hNotifyObj ) [inline]

Definition at line 25 of file SCPUI.h.

    : CPropertyPage(IDD_SCP_GENERAL_PAGE),
      m_hNotifyObj(hNotifyObj)
  {
    m_bDirty = FALSE;
    m_szServiceDNSName    = _T("");
    m_szServiceDNSNameType= _T("");
    m_szBindingInfo       = _T("");
    m_szDescription       = _T("");
    m_szServiceClassName  = _T("");
  }

CSCPUIGeneral::~CSCPUIGeneral ( ) [inline]

Definition at line 37 of file SCPUI.h.

  {
  }

Member Function Documentation

void CSCPUIGeneral::GetUIData ( ) [virtual]

Definition at line 143 of file SCPUI.cpp.

{
  //
  // Retrieve the data from the controls
  //
  GetDlgItem(IDC_DESCRIPTION_EDIT)->GetWindowText(m_szDescription);
  GetDlgItem(IDC_DNS_NAME_EDIT)->GetWindowText(m_szServiceDNSName);
  GetDlgItem(IDC_SERVICE_CLASS_EDIT)->GetWindowText(m_szServiceClassName);
  GetDlgItem(IDC_DNS_NAME_TYPE_EDIT)->GetWindowText(m_szServiceDNSNameType);
}

HRESULT CSCPUIGeneral::Init | ( | PWSTR | pszPath,
 |  | PWSTR | pszClass |
 | ) |  |  | [virtual]

Definition at line 52 of file SCPUI.cpp.

{
  //
  // Store local versions of the path and class
  //
  m_szPath = pszPath;
  m_szClass = pszClass;

  //
  // Get the property page initialization parameters from the notify window
  //
  ADSPROPINITPARAMS InitParams = {0};
  InitParams.dwSize = sizeof(ADSPROPINITPARAMS);
  if (!ADsPropGetInitInfo(m_hNotifyObj, &InitParams))
  {
    return E_FAIL;
  }

  if (FAILED(InitParams.hr))
  {
    return InitParams.hr;
  }

  //
  // Store local versions of the IDirectoryObject interface pointer
  // and the writable attributes
  //
  m_spDsObj = InitParams.pDsObj;
  m_pWritableAttrs = InitParams.pWritableAttrs;

  return S_OK;
}

BOOL CSCPUIGeneral::OnApply ( ) [virtual]

Definition at line 154 of file SCPUI.cpp.

{
  if (!m_bDirty)
  {
    //
    // Signal the change notification. Note that the notify-apply
    // message must be sent even if the page is not dirty so that
    // the notify ref-counting will properly decrement.
    //
    ::SendMessage(m_hNotifyObj, WM_ADSPROP_NOTIFY_APPLY, TRUE, 0);

    return TRUE;
  }

  ASSERT(m_spDsObj != NULL);

  //
  // Retrieve the data from the UI
  //
  GetUIData();

  HRESULT hr = S_OK;
  ADS_ATTR_INFO attrInfo[4];
  PWSTR rgpwzAttrNames[] = { _T("adminDescription"),
                             _T("serviceDNSName"),
                             _T("serviceDNSNameType"),
                             _T("serviceClassName") };
  ADSVALUE Value[4];

  //
  // Set the update values for adminDescription
  //
  attrInfo[0].dwADsType = ADSTYPE_OCTET_STRING;
  attrInfo[0].pszAttrName = rgpwzAttrNames[0];

  Value[0].dwType = ADSTYPE_CASE_IGNORE_STRING;
  Value[0].CaseIgnoreString = (LPWSTR)(LPCWSTR)m_szDescription;

  attrInfo[0].pADsValues = &Value[0];
  attrInfo[0].dwNumValues = 1;
  attrInfo[0].dwControlCode = ADS_ATTR_UPDATE;

  //
  // Set the update values for serviceDNSName
  //
  attrInfo[1].dwADsType = ADSTYPE_CASE_IGNORE_STRING;
  attrInfo[1].pszAttrName = rgpwzAttrNames[1];

  Value[1].dwType = ADSTYPE_CASE_IGNORE_STRING;
  Value[1].CaseIgnoreString  = (LPWSTR)(LPCWSTR)m_szServiceDNSName;

  attrInfo[1].pADsValues = &Value[1];
  attrInfo[1].dwNumValues = 1;
  attrInfo[1].dwControlCode = ADS_ATTR_UPDATE;

  //
  // Set the update values for serviceDNSNameType
  //
  attrInfo[2].dwADsType = ADSTYPE_CASE_IGNORE_STRING;
  attrInfo[2].pszAttrName = rgpwzAttrNames[2];

  Value[2].dwType = ADSTYPE_CASE_IGNORE_STRING;
  Value[2].CaseIgnoreString  = (LPWSTR)(LPCWSTR)m_szServiceDNSNameType;

  attrInfo[2].pADsValues = &Value[2];
  attrInfo[2].dwNumValues = 1;
  attrInfo[2].dwControlCode = ADS_ATTR_UPDATE;

  //
  // Set the update values for serviceClassName
  //
  attrInfo[3].dwADsType = ADSTYPE_CASE_IGNORE_STRING;
  attrInfo[3].pszAttrName = rgpwzAttrNames[3];

  Value[3].dwType = ADSTYPE_CASE_IGNORE_STRING;
  Value[3].CaseIgnoreString = (LPWSTR)(LPCWSTR)m_szServiceClassName;

  attrInfo[3].pADsValues = &Value[3];
  attrInfo[3].dwNumValues = 1;
  attrInfo[3].dwControlCode = ADS_ATTR_UPDATE;

  //
  // Set the new values in Active Directory
  //
  DWORD dwReturned = 0;
  hr = m_spDsObj->SetObjectAttributes(attrInfo, 4, &dwReturned);
  if (FAILED(hr))
  {
    AfxMessageBox(_T("Failed to set values for object."));
    return FALSE;
  }

  if (dwReturned < 4)
  {
    AfxMessageBox(_T("Failed to set values for object."));
    return FALSE;
  }

  //
  // Signal the change notification. Note that the notify-apply
  // message must be sent even if the page is not dirty so that
  // the notify ref-counting will properly decrement.
  //
  ::SendMessage(m_hNotifyObj, WM_ADSPROP_NOTIFY_APPLY, TRUE, 0);

  return TRUE;
}

void CSCPUIGeneral::OnDestroy ( ) [virtual]

Definition at line 272 of file SCPUI.cpp.

{
  CPropertyPage::OnDestroy();

  //
  // Tell the notification object to shut down
  //
  ::SendMessage(m_hNotifyObj, WM_ADSPROP_NOTIFY_EXIT, 0, 0);

  delete this;
}

BOOL CSCPUIGeneral::OnInitDialog ( ) [virtual]

Definition at line 30 of file SCPUI.cpp.

{
  BOOL bRes = CPropertyPage::OnInitDialog();

  //
  // Verify that this page is only coming up for users
  //
  ASSERT(m_szClass == _T("serviceConnectionPoint"));

  //
  // Display data in UI
  //
  SetUIData();

  //
  // The page may have become dirty due to the SetWindowText() in SetUIData(),
  // so clear the dirty flag.
  //
  m_bDirty = FALSE;
  return bRes;
}

void CSCPUIGeneral::OnPropertyChange ( )

Definition at line 262 of file SCPUI.cpp.

{
  m_bDirty = TRUE;

  //
  // Enable the apply button
  //
  SetModified(TRUE);
}

void CSCPUIGeneral::SetUIData ( ) [virtual]

Definition at line 85 of file SCPUI.cpp.

{
  //
  // Prime the controls with the data from the object
  //
  LPWSTR ppszAttrNames[] = { _T("adminDescription"),
                             _T("serviceDnsName"),
                             _T("serviceDnsNameType"),
                             _T("serviceClassName") };
  PADS_ATTR_INFO pAttrInfo = NULL;
  DWORD dwReturned = 0;

  //
  // Retrieve the data
  //
  HRESULT hr = m_spDsObj->GetObjectAttributes(ppszAttrNames, 4, &pAttrInfo, &dwReturned);
  if (FAILED(hr))
  {
    AfxMessageBox(_T("Failed to retrieve data for this object."));
    return;
  }

  //
  // Put the data in the appropriate control
  //
  for (DWORD idx = 0; idx < dwReturned; idx++)
  {
    ASSERT(pAttrInfo != NULL);
    if (_wcsicmp(pAttrInfo[idx].pszAttrName, L"adminDescription") == 0)
    {
      m_szDescription = pAttrInfo[idx].pADsValues->CaseIgnoreString;
      GetDlgItem(IDC_DESCRIPTION_EDIT)->SetWindowText(m_szDescription);
    }
    else if (_wcsicmp(pAttrInfo[idx].pszAttrName, L"serviceDnsName") == 0)
    {
      m_szServiceDNSName = pAttrInfo[idx].pADsValues->CaseIgnoreString;
      GetDlgItem(IDC_DNS_NAME_EDIT)->SetWindowText(m_szServiceDNSName);
    }
    else if (_wcsicmp(pAttrInfo[idx].pszAttrName, L"serviceDnsNameType") == 0)
    {
      m_szServiceDNSNameType = pAttrInfo[idx].pADsValues->CaseIgnoreString;
      GetDlgItem(IDC_DNS_NAME_TYPE_EDIT)->SetWindowText(m_szServiceDNSNameType);
    }
    else if (_wcsicmp(pAttrInfo[idx].pszAttrName, L"serviceClassName") == 0)
    {
      m_szServiceClassName = pAttrInfo[idx].pADsValues->CaseIgnoreString;
      GetDlgItem(IDC_SERVICE_CLASS_EDIT)->SetWindowText(m_szServiceClassName);
    }
  }

  //
  // Free the memory allocated by GetObjectAttributes()
  //
  FreeADsMem(pAttrInfo);
}

Member Data Documentation

BOOL CSCPUIGeneral::m_bDirty [private]

Definition at line 64 of file SCPUI.h.

HWND CSCPUIGeneral::m_hNotifyObj [private]

Definition at line 58 of file SCPUI.h.

PADS_ATTR_INFO CSCPUIGeneral::m_pWritableAttrs [private]

Definition at line 62 of file SCPUI.h.

CComPtr<IDirectoryObject> CSCPUIGeneral::m_spDsObj [private]

Definition at line 61 of file SCPUI.h.

CString CSCPUIGeneral::m_szBindingInfo [private]

Definition at line 67 of file SCPUI.h.

CString CSCPUIGeneral::m_szClass [private]

Definition at line 60 of file SCPUI.h.

CString CSCPUIGeneral::m_szDescription [private]

Definition at line 68 of file SCPUI.h.

CString CSCPUIGeneral::m_szPath [private]

Definition at line 59 of file SCPUI.h.

CString CSCPUIGeneral::m_szServiceClassName [private]

Definition at line 69 of file SCPUI.h.

CString CSCPUIGeneral::m_szServiceDNSName [private]

Definition at line 65 of file SCPUI.h.

CString CSCPUIGeneral::m_szServiceDNSNameType [private]

Definition at line 66 of file SCPUI.h.

The documentation for this class was generated from the following files:
  • NetDS/ADSI/samples/DSUI/scpext/scpproppage/SCPUI.h
  • NetDS/ADSI/samples/DSUI/scpext/scpproppage/SCPUI.cpp
Generated on Wed Nov 13 2024 16:57:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSCPUIKeywords Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CSCPUIKeywords Class Reference

#include "SCPUI.h"

Inherits CPropertyPage.

List of all members.

Public Member Functions

CSCPUIKeywords ()
CSCPUIKeywords (HWND hNotifyObj)
~CSCPUIKeywords ()
virtual HRESULT | Init (PWSTR pszPath, PWSTR pszClass)
virtual BOOL | OnApply ()
virtual void | OnDestroy ()
virtual BOOL | OnInitDialog ()
afx_msg void | OnPropertyChange ()
virtual void | SetUIData ()

Private Attributes

BOOL m_bDirty
HWND | m_hNotifyObj
CMultiValuedAttributeEditor * m_pAttributeEditor
PADS_ATTR_INFO | m_pWritableAttrs
CComPtr< IDirectoryObject > | m_spDsObj
CString m_szClass
CString m_szPath
CStringList | m_szValueList

Detailed Description

Definition at line 125 of file SCPUI.h.

Constructor & Destructor Documentation

CSCPUIKeywords::CSCPUIKeywords ( ) [inline]

Definition at line 129 of file SCPUI.h.

{}

CSCPUIKeywords::CSCPUIKeywords ( HWND hNotifyObj ) [inline]

Definition at line 130 of file SCPUI.h.

    : CPropertyPage(IDD_SCP_KEYWORDS_PAGE),
      m_hNotifyObj(hNotifyObj)
  {
    m_bDirty = FALSE;
    m_pAttributeEditor = NULL;
  }

CSCPUIKeywords::~CSCPUIKeywords ( ) [inline]

Definition at line 138 of file SCPUI.h.

  {
    if (m_pAttributeEditor != NULL)
      delete m_pAttributeEditor;
  }

Member Function Documentation

HRESULT CSCPUIKeywords::Init | ( | PWSTR | pszPath,
 |  | PWSTR | pszClass |
 | ) |  |  | [virtual]

Definition at line 550 of file SCPUI.cpp.

{
  //
  // Store local versions of the path and class
  //
  m_szPath = pszPath;
  m_szClass = pszClass;

  //
  // Get the property page initialization parameters from the notify window
  //
  ADSPROPINITPARAMS InitParams = {0};
  InitParams.dwSize = sizeof(ADSPROPINITPARAMS);
  if (!ADsPropGetInitInfo(m_hNotifyObj, &InitParams))
  {
    return E_FAIL;
  }

  if (FAILED(InitParams.hr))
  {
    return InitParams.hr;
  }

  //
  // Store local versions of the IDirectoryObject interface pointer
  // and the writable attributes
  //
  m_spDsObj = InitParams.pDsObj;
  m_pWritableAttrs = InitParams.pWritableAttrs;

  return S_OK;
}

BOOL CSCPUIKeywords::OnApply ( ) [virtual]

Definition at line 627 of file SCPUI.cpp.

{
  if (!m_bDirty)
  {
    //
    // Signal the change notification. Note that the notify-apply
    // message must be sent even if the page is not dirty so that
    // the notify ref-counting will properly decrement.
    //
    ::SendMessage(m_hNotifyObj, WM_ADSPROP_NOTIFY_APPLY, TRUE, 0);

    return TRUE;
  }

  ASSERT(m_spDsObj != NULL);

  HRESULT hr = S_OK;
  ADS_ATTR_INFO attrInfo[1];
  PWSTR rgpwzAttrNames[] = { _T("keywords") };
  ADSVALUE* pValue = new ADSVALUE[m_szValueList.GetCount()];
  ASSERT(pValue != NULL);
  if (pValue == NULL)
    return FALSE;

  //
  // Set the update values for adminDescription
  //
  attrInfo[0].dwADsType = ADSTYPE_CASE_IGNORE_STRING;
  attrInfo[0].pszAttrName = rgpwzAttrNames[0];

  POSITION pos = m_szValueList.GetHeadPosition();
  for (int idx = 0; idx < m_szValueList.GetCount(); idx++)
  {
    CString szValue = m_szValueList.GetNext(pos);
    pValue[idx].dwType = ADSTYPE_CASE_IGNORE_STRING;
    pValue[idx].CaseIgnoreString = (LPWSTR)(LPCWSTR)szValue;

    if (pos == NULL)
    {
      break;
    }
  }

  attrInfo[0].pADsValues = pValue;
  attrInfo[0].dwNumValues = m_szValueList.GetCount();
  attrInfo[0].dwControlCode = ADS_ATTR_UPDATE;

  //
  // Update the data in Active Directory
  //
  DWORD dwReturned = 0;
  hr = m_spDsObj->SetObjectAttributes(attrInfo, 1, &dwReturned);
  if (FAILED(hr))
  {
    delete[] pValue;
    AfxMessageBox(_T("Failed to set values for object."));
    return FALSE;
  }
  //
  // Free the memory used for SetObjectAttributes()
  //
  delete[] pValue;

  if (dwReturned < 1)
  {
    AfxMessageBox(_T("Failed to set values for object."));
    return FALSE;
  }

  //
  // Signal the change notification. Note that the notify-apply
  // message must be sent even if the page is not dirty so that
  // the notify ref-counting will properly decrement.
  //
  ::SendMessage(m_hNotifyObj, WM_ADSPROP_NOTIFY_APPLY, TRUE, 0);

  return TRUE;
}

void CSCPUIKeywords::OnDestroy ( ) [virtual]

Definition at line 717 of file SCPUI.cpp.

{
  CPropertyPage::OnDestroy();

  //
  // Tell the notification object to shut down
  //
  ::SendMessage(m_hNotifyObj, WM_ADSPROP_NOTIFY_EXIT, 0, 0);

  delete this;
}

BOOL CSCPUIKeywords::OnInitDialog ( ) [virtual]

Definition at line 518 of file SCPUI.cpp.

{
  BOOL bRes = CPropertyPage::OnInitDialog();

  //
  // Verify that this page is only coming up for users
  //
  ASSERT(m_szClass == _T("serviceConnectionPoint"));

  //
  // Display data in UI
  //
  SetUIData();

  //
  // Create and initialize the multi-valued attribute editor
  //
  m_pAttributeEditor = new CMultiValuedAttributeEditor(m_szValueList);
  m_pAttributeEditor->Initialize(IDC_KEYWORD_EDIT,
                                  IDC_KEYWORD_LIST,
                                  IDC_ADD_BUTTON,
                                  IDC_DELETE_BUTTON,
                                  this);

  //
  // The page may have been marked dirty due to the SetWindowText() in SetUIData(),
  // so clear the dirty flag.
  //
  m_bDirty = FALSE;
  return bRes;
}

void CSCPUIKeywords::OnPropertyChange ( )

Definition at line 707 of file SCPUI.cpp.

{
  m_bDirty = TRUE;

  //
  // Enable the apply button
  //
  SetModified(TRUE);
}

void CSCPUIKeywords::SetUIData ( ) [virtual]

Definition at line 583 of file SCPUI.cpp.

{
  //
  // Prime the controls with the data from the object
  //
  LPWSTR ppszAttrNames[] = {  _T("keywords") };
  PADS_ATTR_INFO pAttrInfo = NULL;
  DWORD dwReturned = 0;

  //
  // Retrieve the data from Active Directory
  //
  HRESULT hr = m_spDsObj->GetObjectAttributes(ppszAttrNames, 1, &pAttrInfo, &dwReturned);
  if (FAILED(hr))
  {
    AfxMessageBox(_T("Failed to retrieve data for this object."));
    return;
  }

  if (dwReturned < 1)
  {
    AfxMessageBox(_T("Failed to retrieve data for this object."));
    return;
  }

  ASSERT(pAttrInfo != NULL);

  //
  // Store the data locally
  //
  for (DWORD idx = 0; idx < dwReturned; idx++)
  {
    for (UINT nCount = 0; nCount < pAttrInfo->dwNumValues; nCount++)
    {
      m_szValueList.AddTail(pAttrInfo->pADsValues[nCount].CaseIgnoreString);
    }
  }

  //
  // Free the memory allocated by GetObjectAttributes()
  //
  FreeADsMem(pAttrInfo);
}

Member Data Documentation

BOOL CSCPUIKeywords::m_bDirty [private]

Definition at line 166 of file SCPUI.h.

HWND CSCPUIKeywords::m_hNotifyObj [private]

Definition at line 160 of file SCPUI.h.

CMultiValuedAttributeEditor* CSCPUIKeywords::m_pAttributeEditor [private]

Definition at line 169 of file SCPUI.h.

PADS_ATTR_INFO CSCPUIKeywords::m_pWritableAttrs [private]

Definition at line 164 of file SCPUI.h.

CComPtr<IDirectoryObject> CSCPUIKeywords::m_spDsObj [private]

Definition at line 163 of file SCPUI.h.

CString CSCPUIKeywords::m_szClass [private]

Definition at line 162 of file SCPUI.h.

CString CSCPUIKeywords::m_szPath [private]

Definition at line 161 of file SCPUI.h.

CStringList CSCPUIKeywords::m_szValueList [private]

Definition at line 168 of file SCPUI.h.

The documentation for this class was generated from the following files:
  • NetDS/ADSI/samples/DSUI/scpext/scpproppage/SCPUI.h
  • NetDS/ADSI/samples/DSUI/scpext/scpproppage/SCPUI.cpp
Generated on Wed Nov 13 2024 16:57:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSCPWiz Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes | Private Attributes

CSCPWiz Class Reference

#include "SCPWiz.h"

List of all members.

Public Member Functions

CSCPWiz ()
~CSCPWiz ()
STDMETHOD() | AddPages (LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam)
DECLARE_REGISTRY_CLSID ()
HICON | GetClassIcon ()
LPCWSTR | GetClassName ()
IADsContainer * | GetContainer ()
LPCWSTR | GetContainerCanonicalName ()
IADs * | GetCopySourceObj ()
void | GetDefaultSummary (CString &s)
IDsAdminNewObj * | GetIDsAdminNewObj ()
IDsAdminNewObjPrimarySite * | GetIDsAdminNewObjPrimarySite ()
IADs * | GetObj ()
STDMETHOD() | GetSummaryInfo (BSTR *pBstrText)
LPCWSTR | GetTitle ()
STDMETHOD() | Initialize (IADsContainer *pADsContainerObj, IADs *pADsCopySource, LPCWSTR lpszClassName, IDsAdminNewObj *pDsAdminNewObj, LPDSA_NEWOBJ_DISPINFO pDispInfo)
STDMETHOD() | OnError (HWND hWnd, HRESULT hr, ULONG uContext)
void | SetObj (IADs *pADsObj)
STDMETHOD() | SetObject (IADs *pADsObj)
STDMETHOD() | WriteData (HWND hWnd, ULONG uContext)
HRESULT | WriteDataHelper ()

Protected Attributes

HICON | m_hObjClassIcon
CSCPPageGeneral * m_pWizPage1
CSCPPageBindingInfo * m_pWizPage2
CSCPPageKeywords * m_pWizPage3
CString m_szClassName
CString m_szContCanonicalName
CString m_szTitle

Private Attributes

CComPtr< IADsContainer > | m_spADsContainerObj
CComPtr< IADs > | m_spADsCopySourceObj
CComPtr< IADs > | m_spADsObj
CComPtr< IDsAdminNewObj > | m_spDsAdminNewObj
CComPtr
< IDsAdminNewObjPrimarySite > 		m_spDsAdminNewObjPrimarySite

Detailed Description

Definition at line 29 of file SCPWiz.h.

Constructor & Destructor Documentation

CSCPWiz::CSCPWiz ( ) [inline]

Definition at line 35 of file SCPWiz.h.

  {
    m_hObjClassIcon = NULL;
    m_pWizPage1 = NULL;
    m_pWizPage2 = NULL;
    m_pWizPage3 = NULL;
  }

CSCPWiz::~CSCPWiz ( ) [inline]

Definition at line 43 of file SCPWiz.h.

  {
    if (m_pWizPage1 != NULL)
      delete m_pWizPage1;

    if (m_pWizPage2 != NULL)
      delete m_pWizPage2;

    if (m_pWizPage3 != NULL)
      delete m_pWizPage3;
  }

Member Function Documentation

HRESULT CSCPWiz::AddPages | ( | LPFNADDPROPSHEETPAGE | lpfnAddPage,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 80 of file SCPWiz.cpp.

{
  //
  // Add the pages for the wizard extension in the order they are to appear.
  //
  AFX_MANAGE_STATE(AfxGetStaticModuleState());
  m_pWizPage1 = new CSCPPageGeneral(this);
  (*lpfnAddPage)(CreatePropertySheetPage((PROPSHEETPAGE*)(&m_pWizPage1->m_psp)), lParam);

  m_pWizPage2 = new CSCPPageBindingInfo(this);
  (*lpfnAddPage)(CreatePropertySheetPage((PROPSHEETPAGE*)(&m_pWizPage2->m_psp)), lParam);

  m_pWizPage3 = new CSCPPageKeywords(this);
  (*lpfnAddPage)(CreatePropertySheetPage((PROPSHEETPAGE*)(&m_pWizPage3->m_psp)), lParam);

  return S_OK;
}

CSCPWiz::DECLARE_REGISTRY_CLSID ( )
HICON CSCPWiz::GetClassIcon ( ) [inline]

Definition at line 97 of file SCPWiz.h.

{ return m_hObjClassIcon;}

LPCWSTR CSCPWiz::GetClassName ( ) [inline]

Definition at line 95 of file SCPWiz.h.

{ return m_szClassName;}

IADsContainer* CSCPWiz::GetContainer ( ) [inline]

Definition at line 89 of file SCPWiz.h.

{ return m_spADsContainerObj;}

LPCWSTR CSCPWiz::GetContainerCanonicalName ( ) [inline]

Definition at line 96 of file SCPWiz.h.

{ return m_szContCanonicalName;}

IADs* CSCPWiz::GetCopySourceObj ( ) [inline]

Definition at line 93 of file SCPWiz.h.

{ return m_spADsCopySourceObj;}

void CSCPWiz::GetDefaultSummary ( CString & s )
IDsAdminNewObj* CSCPWiz::GetIDsAdminNewObj ( ) [inline]

Definition at line 90 of file SCPWiz.h.

{ return m_spDsAdminNewObj;}

IDsAdminNewObjPrimarySite* CSCPWiz::GetIDsAdminNewObjPrimarySite ( ) [inline]

Definition at line 91 of file SCPWiz.h.

{ return m_spDsAdminNewObjPrimarySite; }

IADs* CSCPWiz::GetObj ( ) [inline]

Definition at line 87 of file SCPWiz.h.

{ return m_spADsObj;}

HRESULT CSCPWiz::GetSummaryInfo ( BSTR * pBstrText )

Definition at line 157 of file SCPWiz.cpp.

{
  //
  // Verify valid arguments
  //
  if (pBstrText == NULL)
  {
    return E_INVALIDARG;
  }

  //
  // Format the summary string which will be displayed on the finish page of the wizard.
  //
  CString strSummary, szPage1, szPage2, szPage3;
  m_pWizPage1->GetSummaryInfo(szPage1);
  m_pWizPage2->GetSummaryInfo(szPage2);
  m_pWizPage3->GetSummaryInfo(szPage3);

  strSummary = szPage1 + szPage2 + szPage3;

  //
  // Copy to BSTR
  //
  *pBstrText = ::SysAllocString(strSummary);
  return S_OK;
}

LPCWSTR CSCPWiz::GetTitle ( ) [inline]

Definition at line 98 of file SCPWiz.h.

{ return m_szTitle;}

HRESULT CSCPWiz::Initialize | ( | IADsContainer * | pADsContainerObj,
 |  | IADs * | pADsCopySource,
 |  | LPCWSTR | lpszClassName,
 |  | IDsAdminNewObj * | pDsAdminNewObj,
 |  | LPDSA_NEWOBJ_DISPINFO | pDispInfo
 | ) |  |

Definition at line 20 of file SCPWiz.cpp.

{
  HRESULT hr = S_OK;
  //
  // Debug Traces
  //
  TRACE(_T("IDsAdminNewObjExt::Initialize()\n"));
  TRACE(_T("\tpADsContainerObj = %p\n"), pADsContainerObj);
  TRACE(_T("\tlpszClassName = <%s>\n"), lpszClassName);
  TRACE(_T("\tpDsAdminNewObj = %p\n"), pDsAdminNewObj);
  TRACE(_T("\tpDispInfo = %p\n"), pDispInfo);

  //
  // make sure we have valid parameters
  //
  if ( (pADsContainerObj == NULL) || (pDsAdminNewObj == NULL) || (lpszClassName == NULL) )
  {
    hr = E_INVALIDARG;
  }

  if ( (pDispInfo == NULL) || (pDispInfo->dwSize != sizeof(DSA_NEWOBJ_DISPINFO)) )
  {
    hr = E_INVALIDARG;
  }

  //
  // save the parameters passed
  //
  m_spDsAdminNewObj     = pDsAdminNewObj;
  m_spADsCopySourceObj  = pADsCopySource;
  m_spADsContainerObj   = pADsContainerObj;
  m_szClassName         = lpszClassName;

  hr = m_spDsAdminNewObj->QueryInterface(IID_IDsAdminNewObjPrimarySite,
                                                 (PVOID*)&m_spDsAdminNewObjPrimarySite);
  if (FAILED(hr))
  {
    m_spDsAdminNewObjPrimarySite = NULL;
  }

  //
  // save data from the DSA_NEWOBJ_DISPINFO struct
  //
  TRACE(_T("\tpDispInfo->dwSize = %d\n"), pDispInfo->dwSize);
  TRACE(_T("\tpDispInfo->hObjClassIcon  = 0x%x\n"), pDispInfo->hObjClassIcon);
  TRACE(_T("\tpDispInfo->lpszWizTitle = <%s>\n"), pDispInfo->lpszWizTitle);
  TRACE(_T("\tpDispInfo->lpszContDisplayName = <%s>\n"), pDispInfo->lpszContDisplayName);

  m_hObjClassIcon = pDispInfo->hObjClassIcon;
  m_szTitle = pDispInfo->lpszWizTitle;
  m_szContCanonicalName = pDispInfo->lpszContDisplayName;

  return hr;
}

HRESULT CSCPWiz::OnError | ( | HWND | hWnd,
 |  | HRESULT | hr,
 |  | ULONG | uContext
 | ) |  |

Definition at line 184 of file SCPWiz.cpp.

{
  AFX_MANAGE_STATE(AfxGetStaticModuleState());

  CString szMessage;

  if (uContext == DSA_NEWOBJ_CTX_COMMIT)
  {
    //
    // The extension gets notified if the SetInfo() or an attempt to cleanup
    // a temporary object failed.
    //
    szMessage.Format(_T("SetInfo() failed: hr = 0x%x"), hr);
    AfxMessageBox(szMessage);
  }
  else if (uContext == DSA_NEWOBJ_CTX_PRECOMMIT)
  {
    //
    // Pre-commit failure is rare.  If it does occur handle the error here.
    //
  }
  else if (uContext == DSA_NEWOBJ_CTX_POSTCOMMIT)
  {
    //
    // Post-commit failure is rare.  If it does occur handle the error here.
    //
  }
  else if (uContext == DSA_NEWOBJ_CTX_CLEANUP)
  {
    //
    // For some reason (e.g. network failure or not enough privileges) DS Admin
    // could not remove the ill constructed (but committed) object after a
    // failure to write on post commit.  If appropriate, the extension can
    // handle the error message.
    //

    //
    // NOTE : this is not a primary extension so we will leave it up to DS Admin
    //        to handle this error message.
    //
    return E_FAIL;
  }

  //
  // Returning success means that DS Admin will not put up its own generic
  // error message.
  //
  return S_OK;
}

void CSCPWiz::SetObj ( IADs * pADsObj ) [inline]

Definition at line 88 of file SCPWiz.h.

{ m_spADsObj = pADsObj;}

HRESULT CSCPWiz::SetObject ( IADs * pADsObj )

Definition at line 98 of file SCPWiz.cpp.

{
  //
  // Hang on to the object passed in
  // the smart pointer will handle the ref count
  //
  m_spADsObj = pADsObj;
  return S_OK;
}

HRESULT CSCPWiz::WriteData | ( | HWND | hWnd,
 |  | ULONG | uContext
 | ) |  |

Definition at line 108 of file SCPWiz.cpp.

{
  HRESULT hr = E_INVALIDARG;
  //
  // NOTICE: when the property page has received the kill focus
  // notification, it has already written the data, so we do not
  // need to do anything on a precommit notification.
  //
  if (uContext == DSA_NEWOBJ_CTX_PRECOMMIT)
  {
    hr = S_OK;
  }

  //
  // This extension does not write anything during the post commit phase
  // so we can just return.
  //
  if (uContext == DSA_NEWOBJ_CTX_POSTCOMMIT)
  {
    hr = S_OK;
  }

  //
  // We have to handle the case when the creation failed, the object
  // got destroyed, a new temporary object was created, and it has to
  // be initialized again.
  //
  if (uContext == DSA_NEWOBJ_CTX_CLEANUP)
  {
    //
    // Call the helper function to do a precommit write.
    //
    hr = WriteDataHelper();
  }

  return hr;
}

HRESULT CSCPWiz::WriteDataHelper ( )

Definition at line 146 of file SCPWiz.cpp.

{
  //
  // Write the data from the page to the temporary object given to the extension
  // by SetObject()
  //

  return S_OK;
}

Member Data Documentation

HICON CSCPWiz::m_hObjClassIcon [protected]

Definition at line 138 of file SCPWiz.h.

CSCPPageGeneral* CSCPWiz::m_pWizPage1 [protected]

Definition at line 143 of file SCPWiz.h.

CSCPPageBindingInfo* CSCPWiz::m_pWizPage2 [protected]

Definition at line 144 of file SCPWiz.h.

CSCPPageKeywords* CSCPWiz::m_pWizPage3 [protected]

Definition at line 145 of file SCPWiz.h.

CComPtr<IADsContainer> CSCPWiz::m_spADsContainerObj [private]

Definition at line 105 of file SCPWiz.h.

CComPtr<IADs> CSCPWiz::m_spADsCopySourceObj [private]

Definition at line 115 of file SCPWiz.h.

CComPtr<IADs> CSCPWiz::m_spADsObj [private]

Definition at line 110 of file SCPWiz.h.

CComPtr<IDsAdminNewObj> CSCPWiz::m_spDsAdminNewObj [private]

Definition at line 120 of file SCPWiz.h.

CComPtr<IDsAdminNewObjPrimarySite> CSCPWiz::m_spDsAdminNewObjPrimarySite [private]

Definition at line 125 of file SCPWiz.h.

CString CSCPWiz::m_szClassName [protected]

Definition at line 131 of file SCPWiz.h.

CString CSCPWiz::m_szContCanonicalName [protected]

Definition at line 137 of file SCPWiz.h.

CString CSCPWiz::m_szTitle [protected]

Definition at line 136 of file SCPWiz.h.

The documentation for this class was generated from the following files:
  • NetDS/ADSI/samples/DSUI/scpext/scpwizard/SCPWiz.h
  • NetDS/ADSI/samples/DSUI/scpext/scpwizard/SCPWiz.cpp
Generated on Wed Nov 13 2024 16:57:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSCPWizApp Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CSCPWizApp Class Reference

Inherits CWinApp.

List of all members.

Public Member Functions

virtual int | ExitInstance ()
virtual BOOL | InitInstance ()

Detailed Description

Definition at line 41 of file SCPWizard.cpp.

Member Function Documentation

int CSCPWizApp::ExitInstance ( void ) [virtual]

Reimplemented from CWinApp.

Definition at line 56 of file SCPWizard.cpp.

{
  _Module.Term();
  return CWinApp::ExitInstance();
}

BOOL CSCPWizApp::InitInstance ( void ) [virtual]

Reimplemented from CWinApp.

Definition at line 50 of file SCPWizard.cpp.

{
  _Module.Init(ObjectMap, m_hInstance);
  return CWinApp::InitInstance();
}

The documentation for this class was generated from the following file:
  • NetDS/ADSI/samples/DSUI/scpext/scpwizard/SCPWizard.cpp
Generated on Wed Nov 13 2024 16:57:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSCPWizModule Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CSCPWizModule Class Reference

#include "StdAfx.h"

List of all members.

Public Member Functions

HRESULT WINAPI UpdateRegistryCLSID (const CLSID &clsid, BOOL bRegister)

Detailed Description

Definition at line 44 of file StdAfx.h.

Member Function Documentation

HRESULT WINAPI CSCPWizModule::UpdateRegistryCLSID | ( | const CLSID & | clsid,
 |  | BOOL | bRegister
 | ) |  |

Definition at line 19 of file StdAfx.cpp.

{
  static const WCHAR szIPS32[] = _T("InprocServer32");
  static const WCHAR szCLSID[] = _T("CLSID");

  HRESULT hRes = S_OK;

  LPOLESTR lpOleStrCLSIDValue;
  ::StringFromCLSID(clsid, &lpOleStrCLSIDValue);

  CRegKey key;
  if (bRegister)
  {
    LONG lRes = key.Open(HKEY_CLASSES_ROOT, szCLSID);
    if (lRes == ERROR_SUCCESS)
    {
      lRes = key.Create(key, lpOleStrCLSIDValue);
      if (lRes == ERROR_SUCCESS)
      {
        WCHAR szModule[_MAX_PATH];
        ::GetModuleFileName(m_hInst, szModule, _MAX_PATH);
        key.SetKeyValue(szIPS32, szModule);
      }
    }
    if (lRes != ERROR_SUCCESS)
      hRes = HRESULT_FROM_WIN32(lRes);
  }
  else
  {
    key.Attach(HKEY_CLASSES_ROOT);
    if (key.Open(key, szCLSID) == ERROR_SUCCESS)
      key.RecurseDeleteKey(lpOleStrCLSIDValue);
  }
  ::CoTaskMemFree(lpOleStrCLSIDValue);
  return hRes;
}

The documentation for this class was generated from the following files:
  • NetDS/ADSI/samples/DSUI/scpext/scpwizard/StdAfx.h
  • NetDS/ADSI/samples/DSUI/scpext/scpwizard/StdAfx.cpp
Generated on Wed Nov 13 2024 16:57:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CScreenCanvas Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CScreenCanvas Class Reference

#include "Canvas.Hxx"

Inherits CCanvas.

List of all members.

Public Member Functions

CScreenCanvas (HWND hwnd)
~CScreenCanvas ()

Protected Attributes

HWND _hwnd

Detailed Description

Definition at line 124 of file Canvas.Hxx.

Constructor & Destructor Documentation

CScreenCanvas::CScreenCanvas ( HWND hwnd ) [inline]

Definition at line 127 of file Canvas.Hxx.

                               : _hwnd(hwnd)
    {
        Init (GetDC ( hwnd ));
    }

CScreenCanvas::~CScreenCanvas ( ) [inline]

Definition at line 132 of file Canvas.Hxx.

    {
        ReleaseDC ( _hwnd, _hdc );
    }

Member Data Documentation

HWND CScreenCanvas::_hwnd [protected]

Definition at line 139 of file Canvas.Hxx.

The documentation for this class was generated from the following file:
  • Multimedia/Gdi/Fonts/GridFont/Canvas.Hxx
Generated on Wed Nov 13 2024 16:57:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CScriptTag Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CScriptTag Class Reference

#include "ScripTag.Hxx"

Inherits CHtmlElement.

List of all members.

Public Member Functions

CScriptTag (CHtmlIFilter &htmlIFilter, CSerialStream &serialStream, GUID ClsidScriptInfo)
virtual SCODE | GetChunk (STAT_CHUNK *pStat)
virtual SCODE | GetText (ULONG *pcwcOutput, WCHAR *awcBuffer)
virtual SCODE | GetValue (PROPVARIANT **ppPropValue)
virtual void | InitStatChunk (STAT_CHUNK *pStat)

Private Attributes

WCHAR | _awszPropSpec [MAX_PROPSPEC_STRING_LENGTH+1]
GUID | _clsidScriptInfo
PropTagState _eState

Detailed Description

Definition at line 26 of file ScripTag.Hxx.

Constructor & Destructor Documentation

CScriptTag::CScriptTag | ( | CHtmlIFilter & | htmlIFilter,
 |  | CSerialStream & | serialStream,
 |  | GUID | ClsidScriptInfo
 | ) |  |

Definition at line 31 of file ScripTag.Cxx.

    : CHtmlElement(htmlIFilter, serialStream),
      _clsidScriptInfo(clsidScriptInfo),
      _eState(NoMoreContent)
{
    _awszPropSpec[0] = 0;
}

Member Function Documentation

SCODE CScriptTag::GetChunk ( STAT_CHUNK * pStat ) [virtual]

Implements CHtmlElement.

Definition at line 53 of file ScripTag.Cxx.

{
    switch ( _eState )
    {

    case  FilteringContent:
    {
        SCODE sc = SkipRemainingTextAndGotoNextChunk( pStat );

        return sc;
    }

    case NoMoreContent:
    {
            SCODE sc = SwitchToNextHtmlElement( pStat );

            return sc;
    }

    default:
        Win4Assert( !"Unknown _eState in CScriptTag::GetChunk" );
        htmlDebugOut(( DEB_ERROR, "CScriptTag::GetChunk, unkown tag state: %d\n", _eState ));

        return S_OK;
    }
}

SCODE CScriptTag::GetText | ( | ULONG * | pcwcOutput,
 |  | WCHAR * | awcBuffer |
 | ) |  |  | [virtual]

Implements CHtmlElement.

Definition at line 93 of file ScripTag.Cxx.

{
    switch( _eState )
    {
    case NoMoreContent:
        return FILTER_E_NO_MORE_TEXT;

    case FilteringContent:
    {
        ULONG cCharsRead = 0;
        while ( cCharsRead < *pcwcOutput )
        {
            ULONG cCharsScanned;
            ULONG cCharsNeeded = *pcwcOutput - cCharsRead;
            CToken token;
            _scanner.GetBlockOfChars( cCharsNeeded,
                                      awcBuffer + cCharsRead,
                                      cCharsScanned,
                                      token );

            cCharsRead += cCharsScanned;
            if ( cCharsScanned == cCharsNeeded )
            {
                //
                // We've read the #chars requested by user
                //
                break;
            }

            HtmlTokenType eTokType = token.GetTokenType();
            if ( eTokType == EofToken || eTokType == ScriptToken )
            {
                //
                // End of file or end script tag
                //
                _eState = NoMoreContent;

                break;
            }
            else if ( eTokType == BreakToken )
            {
                //
                // Insert a newline char
                //
                Win4Assert( cCharsRead < *pcwcOutput );
                awcBuffer[cCharsRead++] = L'\n';
                _scanner.EatTag();
            }
            else if ( eTokType == CommentToken )
            {
                //
                // Scripts are often enclosed in comments for backward
                // compatibilty, so do nothing
                //
            }
            else
            {
                //
                // Uninteresting tag, so skip over tag and continue processing
                //
                _scanner.EatTag();
            }
        }

        *pcwcOutput = cCharsRead;

        if ( _eState == NoMoreContent )
            return FILTER_S_LAST_TEXT;
        else
            return S_OK;

        break;
    }

    default:
        Win4Assert( !"Unknown value of _eState" );
        htmlDebugOut(( DEB_ERROR,
                       "CScriptTag::GetText, unknown value of _eState: %d\n",
                       _eState ));
        return S_OK;
    }
}

SCODE CScriptTag::GetValue ( PROPVARIANT ** ppPropValue ) [virtual]

Reimplemented from CHtmlElement.

Definition at line 187 of file ScripTag.Cxx.

{
    return FILTER_E_NO_VALUES;
}

void CScriptTag::InitStatChunk ( STAT_CHUNK * pStat ) [virtual]

Implements CHtmlElement.

Definition at line 203 of file ScripTag.Cxx.

{
    WCHAR *pwcLang;
    unsigned cwcLang;

    //
    // Read the Language field
    //
    _scanner.ReadTagIntoBuffer();
    _scanner.ScanTagBuffer( L"language=\"", pwcLang, cwcLang );

    if ( cwcLang == 0 )
    {
        //
        // Use whatever was specified in an earlier script tag, if none, the default is
        // Javascript
        //
        if ( _awszPropSpec[0] == 0 )
            RtlCopyMemory( _awszPropSpec, L"javascript", (wcslen(L"javascript") + 1) * sizeof( WCHAR) );
    }
    else
    {
        if ( cwcLang > MAX_PROPSPEC_STRING_LENGTH )
            cwcLang = MAX_PROPSPEC_STRING_LENGTH;     // Truncate to max length permitted

        RtlCopyMemory( _awszPropSpec, pwcLang, cwcLang * sizeof(WCHAR) );
        _awszPropSpec[cwcLang] = 0;
    }

    _eState = FilteringContent;

    pStat->attribute.guidPropSet = _clsidScriptInfo;
    pStat->attribute.psProperty.ulKind = PRSPEC_LPWSTR;
    pStat->attribute.psProperty.lpwstr = _awszPropSpec;

    pStat->idChunk = _htmlIFilter.GetNextChunkId();
    pStat->flags = CHUNK_TEXT;
    pStat->locale = _htmlIFilter.GetLocale();
    pStat->breakType = CHUNK_EOS;
    pStat->idChunkSource = pStat->idChunk;
    pStat->cwcStartSource = 0;
    pStat->cwcLenSource = 0;
}

Member Data Documentation

WCHAR CScriptTag::_awszPropSpec[MAX_PROPSPEC_STRING_LENGTH+1] [private]

Definition at line 44 of file ScripTag.Hxx.

GUID CScriptTag::_clsidScriptInfo [private]

Definition at line 43 of file ScripTag.Hxx.

PropTagState CScriptTag::_eState [private]

Definition at line 42 of file ScripTag.Hxx.

The documentation for this class was generated from the following files:
  • WinBase/Indexing/IFilter/ScripTag.Hxx
  • WinBase/Indexing/IFilter/ScripTag.Cxx
Generated on Wed Nov 13 2024 16:57:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CScrollableView Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CScrollableView Class Reference

#include "View.Hxx"

Inherits CView.

List of all members.

Public Member Functions

CScrollableView (int cx, int cy)
void | GetScale (UINT &iScale)
void | SetHScrollPos (HWND hwnd, WPARAM wParam, LPARAM lParam, CModel *pModel)
void | SetScale (UINT iScale)
void | SetVScrollPos (HWND hwnd, WPARAM wParam, LPARAM lParam, CModel *pModel)

Protected Attributes

int | _nHScrollPos
int | _nVScrollPos

Detailed Description

Definition at line 43 of file View.Hxx.

Constructor & Destructor Documentation

CScrollableView::CScrollableView | ( | int | cx,
 |  | int | cy |
 | ) |  |  | [inline]

Definition at line 46 of file View.Hxx.

:CView(cx,cy){};

Member Function Documentation

void CScrollableView::GetScale ( UINT & iScale ) [inline]

Definition at line 59 of file View.Hxx.

{
        iScale=_iScale;
};

void CScrollableView::SetHScrollPos | ( | HWND | hwnd,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | CModel * | pModel
 | ) |  |

Definition at line 123 of file View.Cxx.

{
    CScreenCanvas canvas(hwnd);
    int nScrollPos = GetScrollPos( hwnd, SB_HORZ );
    canvas.Scale(_iScale);

    SIZE size;
    pModel->GetLineSize(&size);

    // scroll position relative to page dimension
    switch (wParam)
    {
    case SB_LINEUP:
         nScrollPos -= 2 * size.cx;
         break;
    case SB_LINEDOWN:
         nScrollPos += 2 * size.cx;
         break;

    case SB_PAGEUP:
         nScrollPos -= _ptClient.x; // size of Window in log coord
         break;

    case SB_PAGEDOWN:
         nScrollPos += _ptClient.x;
         break;

    case SB_THUMBPOSITION:
         nScrollPos = LOWORD(lParam);
         break;

    default:
         break;
    }

    nScrollPos = max( 0, min (nScrollPos, PAGEWIDTH));

    POINT pt;
    pt.x =  GetScrollPos( hwnd, SB_HORZ ) - nScrollPos;
    if( pt.x )
    {
        SetScrollPos(hwnd, SB_HORZ, nScrollPos, TRUE );

        pt.y = 0;
        canvas.LPtoDP(&pt);

        pt.x -= MulDiv( _ptClient.x, pt.x, PAGEWIDTH);
        ScrollWindow(hwnd, pt.x, pt.y, NULL, NULL );
    }
    _ptScroll.x = nScrollPos;
}

void CScrollableView::SetScale ( UINT iScale ) [inline]

Definition at line 64 of file View.Hxx.

{
        _iScale=iScale;
};

void CScrollableView::SetVScrollPos | ( | HWND | hwnd,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | CModel * | pModel
 | ) |  |

Definition at line 176 of file View.Cxx.

{
    CScreenCanvas canvas(hwnd);
    int nScrollPos = GetScrollPos( hwnd, SB_VERT );
    canvas.Scale(_iScale);

    SIZE size;
    pModel->GetLineSize(&size);

    // scroll position relative to page dimension
    switch (wParam)
    {
    case SB_LINEUP:
         nScrollPos -= 2 * size.cy;
         break;
    case SB_LINEDOWN:
         nScrollPos += 2 * size.cy;
         break;

    case SB_PAGEUP:
         nScrollPos -= _ptClient.y; // size of Window in log coord
         break;

    case SB_PAGEDOWN:
         nScrollPos += _ptClient.y;
         break;

    case SB_THUMBPOSITION:
         nScrollPos = LOWORD(lParam);
         break;

    default:
         break;
    }

    nScrollPos = max( 0, min (nScrollPos, PAGEHEIGHT));

    POINT pt;
    pt.y =  GetScrollPos( hwnd, SB_VERT ) - nScrollPos;
    if( pt.y )
    {
        SetScrollPos(hwnd, SB_VERT, nScrollPos, TRUE );

        pt.x = 0;
        canvas.LPtoDP(&pt);

        pt.y -= MulDiv( _ptClient.y, pt.y, PAGEHEIGHT);
        ScrollWindow(hwnd, pt.x, pt.y, NULL, NULL );
    }
    _ptScroll.y = nScrollPos;
}

Member Data Documentation

int CScrollableView::_nHScrollPos [protected]

Definition at line 54 of file View.Hxx.

int CScrollableView::_nVScrollPos [protected]

Definition at line 55 of file View.Hxx.

The documentation for this class was generated from the following files:
  • Multimedia/Gdi/Fonts/GridFont/View.Hxx
  • Multimedia/Gdi/Fonts/GridFont/View.Cxx
Generated on Wed Nov 13 2024 16:57:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CScrollBarLite Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CScrollBarLite Class Reference

#include "cdialoglite.h"

Inherits CSplitterLite.

List of all members.

Public Member Functions

CScrollBarLite ()
virtual | ~CScrollBarLite ()
virtual BOOL | GetScrollInfo (INT *piPos, INT *piRangeSize, INT *piPageSize)
virtual INT | GetScrollPos ()
virtual BOOL | GetScrollRange (int *pnMin, int *pnMax)
virtual INT | SetScroll (int nPos, BOOL bRedraw=TRUE)
virtual INT | SetScrollInfo (INT iPos, INT iRangeSize, INT iPageSize, BOOL fRedraw=TRUE)
virtual INT | SetScrollPos (int nPos, BOOL bRedraw=TRUE)
virtual BOOL | SetScrollRange (int nMin, int nMax, BOOL bRedraw=TRUE)

Detailed Description

Definition at line 634 of file cdialoglite.h.

Constructor & Destructor Documentation

CScrollBarLite::CScrollBarLite ( )

Definition at line 2072 of file cdialoglite.cpp.

{
}

CScrollBarLite::~CScrollBarLite ( ) [virtual]

Definition at line 2081 of file cdialoglite.cpp.

{
}

Member Function Documentation

BOOL CScrollBarLite::GetScrollInfo | ( | INT * | piPos,
 |  | INT * | piRangeSize,
 |  | INT * | piPageSize |
 | ) |  |  | [virtual]

Definition at line 2128 of file cdialoglite.cpp.

{
  INT iPos = 0;
  INT iRangeSize = 0;
  INT iPageSize = 0;

  SCROLLINFO ScrollInfo = { sizeof(SCROLLINFO), SIF_ALL, 0, iRangeSize, iPageSize, iPos, 0};

  //SetScrollInfo
  BOOL bResult = ::GetScrollInfo(m_hWnd, SB_CTL, &ScrollInfo);

  //Fill in arguments
  if(piPos)
    *piPos = iPos;
  if(piRangeSize)
    *piRangeSize = iRangeSize;
  if(piPageSize)
    *piPageSize = iPageSize;

  return bResult;
}

virtual INT CScrollBarLite::GetScrollPos ( ) [inline, virtual]

Definition at line 645 of file cdialoglite.h.

{ return ::GetScrollPos(m_hWnd, SB_CTL);            }

virtual BOOL CScrollBarLite::GetScrollRange | ( | int * | pnMin,
 |  | int * | pnMax |
 | ) |  |  | [inline, virtual]

Definition at line 648 of file cdialoglite.h.

{ return ::GetScrollRange(m_hWnd, SB_CTL, pnMin, pnMax);    }

virtual INT CScrollBarLite::SetScroll | ( | int | nPos,
 |  | BOOL | bRedraw = TRUE |
 | ) |  |  | [virtual]
INT CScrollBarLite::SetScrollInfo | ( | INT | iPos,
 |  | INT | iRangeSize,
 |  | INT | iPageSize,
 |  | BOOL | fRedraw = TRUE |
 | ) |  |  | [virtual]

Definition at line 2115 of file cdialoglite.cpp.

{
  SCROLLINFO ScrollInfo = { sizeof(SCROLLINFO), SIF_ALL, 0, iRangeSize, iPageSize, iPos, 0};

  //SetScrollInfo
  return ::SetScrollInfo(m_hWnd, SB_CTL, &ScrollInfo, fRedraw);
}

virtual INT CScrollBarLite::SetScrollPos | ( | int | nPos,
 |  | BOOL | bRedraw = TRUE |
 | ) |  |  | [inline, virtual]

Definition at line 644 of file cdialoglite.h.

{ return ::SetScrollPos(m_hWnd, SB_CTL, nPos, bRedraw);     }

virtual BOOL CScrollBarLite::SetScrollRange | ( | int | nMin,
 |  | int | nMax,
 |  | BOOL | bRedraw = TRUE |
 | ) |  |  | [inline, virtual]

Definition at line 647 of file cdialoglite.h.

{ return ::SetScrollRange(m_hWnd, SB_CTL, nMin, nMax, bRedraw); }

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialoglite.h
  • Dataaccess/oledb/rowsetviewer/cdialoglite.cpp
Generated on Wed Nov 13 2024 16:57:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSDKSamplePlaylistParser Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CSDKSamplePlaylistParser Class Reference

#include "SDKSamplePlaylistParser.h"

List of all members.

Public Member Functions

CSDKSamplePlaylistParser ()
virtual | ~CSDKSamplePlaylistParser ()
HRESULT | Initialize (IWMSCommandContext *pCommandContext, IWMSContext *pUserContext, IWMSContext *pPresentationContext, IWMSContext *pServerContext, IWMSNamedValues *pNamedValues, DWORD dwFlags, IWMSClassObject *pClassFactory)
virtual HRESULT STDMETHODCALLTYPE | ReadPlaylist (INSSBuffer __RPC_FAR *pBuffer, IXMLDOMDocument __RPC_FAR *pPlayList, IWMSPlaylistParserCallback __RPC_FAR *pCallback, QWORD qwContext)
virtual HRESULT STDMETHODCALLTYPE | ReadPlaylistFromDirectory (IWMSDirectory __RPC_FAR *pDirectory, LPWSTR pszwFilePattern, IXMLDOMDocument __RPC_FAR *pPlaylist, IWMSPlaylistParserCallback __RPC_FAR *pCallback, QWORD qwContext)
HRESULT | Shutdown ()
virtual HRESULT STDMETHODCALLTYPE | WritePlaylist (IXMLDOMDocument __RPC_FAR *pPlayList, IWMSPlaylistParserCallback __RPC_FAR *pCallback, QWORD qwContext)

Protected Attributes

CComPtr< IWMSClassObject > | m_spClassFactory
CComPtr< IWMSCommandContext > | m_spCommandContext
CComPtr< IWMSNamedValues > | m_spNamedValues
CComPtr< IWMSContext > | m_spPresentationContext
CComPtr< IWMSContext > | m_spServerContext
CComPtr< IWMSContext > | m_spUserContext

Detailed Description

Definition at line 24 of file SDKSamplePlaylistParser.h.

Constructor & Destructor Documentation

CSDKSamplePlaylistParser::CSDKSamplePlaylistParser ( )

Definition at line 227 of file SDKSamplePlaylistParser.cpp.

{
} // CSDKSamplePlaylistParser.

CSDKSamplePlaylistParser::~CSDKSamplePlaylistParser ( ) [virtual]

Definition at line 238 of file SDKSamplePlaylistParser.cpp.

{
} // ~CSDKSamplePlaylistParser.

Member Function Documentation

HRESULT CSDKSamplePlaylistParser::Initialize | ( | IWMSCommandContext * | pCommandContext,
 |  | IWMSContext * | pUserContext,
 |  | IWMSContext * | pPresentationContext,
 |  | IWMSContext * | pServerContext,
 |  | IWMSNamedValues * | pNamedValues,
 |  | DWORD | dwFlags,
 |  | IWMSClassObject * | pClassFactory
 | ) |  |

Definition at line 250 of file SDKSamplePlaylistParser.cpp.

{
    //
    // We don't really use any of these parameters later on.
    // We are merely illustrating how you would hold a reference to it
    // using smart pointers if you did need to use it later on.
    //

    m_spCommandContext = pCommandContext;
    m_spUserContext = pUserContext;
    m_spPresentationContext = pPresentationContext;
    m_spServerContext = pServerContext;
    m_spNamedValues = pNamedValues;
    m_spClassFactory = pClassFactory;

    return( S_OK );
} // Initialize.

virtual HRESULT STDMETHODCALLTYPE CSDKSamplePlaylistParser::ReadPlaylist | ( | INSSBuffer __RPC_FAR * | pBuffer,
 |  | IXMLDOMDocument __RPC_FAR * | pPlayList,
 |  | IWMSPlaylistParserCallback __RPC_FAR * | pCallback,
 |  | QWORD | qwContext |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CSDKSamplePlaylistParser::ReadPlaylistFromDirectory | ( | IWMSDirectory __RPC_FAR * | pDirectory,
 |  | LPWSTR | pszwFilePattern,
 |  | IXMLDOMDocument __RPC_FAR * | pPlaylist,
 |  | IWMSPlaylistParserCallback __RPC_FAR * | pCallback,
 |  | QWORD | qwContext |
 | ) |  |  | [virtual]

Definition at line 669 of file SDKSamplePlaylistParser.cpp.

{
    return( E_NOTIMPL );
} // ReadPlaylistFromDirectory.

HRESULT CSDKSamplePlaylistParser::Shutdown ( )

Definition at line 287 of file SDKSamplePlaylistParser.cpp.

{
    m_spCommandContext.Release();
    m_spUserContext.Release();
    m_spPresentationContext.Release();
    m_spServerContext.Release();
    m_spNamedValues.Release();
    m_spClassFactory.Release();

    return( S_OK );
} // Shutdown.

virtual HRESULT STDMETHODCALLTYPE CSDKSamplePlaylistParser::WritePlaylist | ( | IXMLDOMDocument __RPC_FAR * | pPlayList,
 |  | IWMSPlaylistParserCallback __RPC_FAR * | pCallback,
 |  | QWORD | qwContext |
 | ) |  |  | [virtual]

Member Data Documentation

CComPtr<IWMSClassObject> CSDKSamplePlaylistParser::m_spClassFactory [protected]

Definition at line 75 of file SDKSamplePlaylistParser.h.

CComPtr<IWMSCommandContext> CSDKSamplePlaylistParser::m_spCommandContext [protected]

Definition at line 70 of file SDKSamplePlaylistParser.h.

CComPtr<IWMSNamedValues> CSDKSamplePlaylistParser::m_spNamedValues [protected]

Definition at line 74 of file SDKSamplePlaylistParser.h.

CComPtr<IWMSContext> CSDKSamplePlaylistParser::m_spPresentationContext [protected]

Definition at line 72 of file SDKSamplePlaylistParser.h.

CComPtr<IWMSContext> CSDKSamplePlaylistParser::m_spServerContext [protected]

Definition at line 73 of file SDKSamplePlaylistParser.h.

CComPtr<IWMSContext> CSDKSamplePlaylistParser::m_spUserContext [protected]

Definition at line 71 of file SDKSamplePlaylistParser.h.

The documentation for this class was generated from the following files:
  • Multimedia/WindowsMediaServices9/Playlist/SDKSamplePlaylistParser.h
  • Multimedia/WindowsMediaServices9/Playlist/SDKSamplePlaylistParser.cpp
Generated on Wed Nov 13 2024 16:57:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSDKSamplePlaylistParserPlugin Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CSDKSamplePlaylistParserPlugin Class Reference

#include "SDKSamplePlaylistParser.h"

List of all members.

Public Member Functions

CSDKSamplePlaylistParserPlugin ()
~CSDKSamplePlaylistParserPlugin ()
virtual HRESULT STDMETHODCALLTYPE | CreatePlaylistParser (IWMSCommandContext *pCommandContext, IWMSContext *pUser, IWMSContext *pPresentation, DWORD dwFlags, IWMSClassObject *pFactory, IWMSBufferAllocator *pBufferAllocator, IWMSPlaylistParserPluginCallback *pCallback, QWORD qwContext)
STDMETHOD() | DisablePlugin ()
STDMETHOD() | EnablePlugin (long *pdwFlags, long *pdwHeartbeatPeriod)
virtual HRESULT STDMETHODCALLTYPE | GetCustomAdminInterface (IDispatch **ppValue)
virtual HRESULT STDMETHODCALLTYPE | InitializePlugin (IWMSContext *pServerContext, IWMSNamedValues *pNamedValues, IWMSClassObject *pClassFactory)
virtual HRESULT STDMETHODCALLTYPE | OnHeartbeat ()
STDMETHOD() | ShutdownPlugin ()

Protected Attributes

CComPtr< IWMSClassObject > | m_spClassFactory
CComPtr< IWMSNamedValues > | m_spNamedValues
CComPtr< IWMSContext > | m_spServerContext

Detailed Description

Definition at line 86 of file SDKSamplePlaylistParser.h.

Constructor & Destructor Documentation

CSDKSamplePlaylistParserPlugin::CSDKSamplePlaylistParserPlugin ( )

Definition at line 22 of file SDKSamplePlaylistParser.cpp.

{
} // CSDKSamplePlaylistParserPlugin.

CSDKSamplePlaylistParserPlugin::~CSDKSamplePlaylistParserPlugin ( )

Definition at line 33 of file SDKSamplePlaylistParser.cpp.

{
} // ~CSDKSamplePlaylistParserPlugin.

Member Function Documentation

HRESULT STDMETHODCALLTYPE CSDKSamplePlaylistParserPlugin::CreatePlaylistParser | ( | IWMSCommandContext * | pCommandContext,
 |  | IWMSContext * | pUser,
 |  | IWMSContext * | pPresentation,
 |  | DWORD | dwFlags,
 |  | IWMSClassObject * | pFactory,
 |  | IWMSBufferAllocator * | pBufferAllocator,
 |  | IWMSPlaylistParserPluginCallback * | pCallback,
 |  | QWORD | qwContext |
 | ) |  |  | [virtual]

Definition at line 164 of file SDKSamplePlaylistParser.cpp.

{
    HRESULT hr = S_OK;

    CComPtr<CComSDKSamplePlaylistParser> spParser;

    if ( NULL == pCallback )
    {
        return( E_INVALIDARG );
    }

    spParser = new CComSDKSamplePlaylistParser;
    if ( spParser == NULL )
    {
        return( E_OUTOFMEMORY );
    }

    hr = spParser->Initialize(
                    pCommandContext,
                    pUserContext,
                    pPresentationContext,
                    m_spServerContext,
                    m_spNamedValues,
                    dwFlags,
                    pFactory
                    );
    if ( FAILED( hr ) )
    {
        // When we return a failed HRESULT, we should not make the callback
        return( hr );
    }

    pCallback->OnCreatePlaylistParser( hr, spParser, qwContext );

    // We called the callback, so we MUST return S_OK here.
    return( S_OK );
} // CreatePlaylistParser.

STDMETHODIMP CSDKSamplePlaylistParserPlugin::DisablePlugin ( )

Definition at line 133 of file SDKSamplePlaylistParser.cpp.

{
    return ( S_OK );
}

STDMETHODIMP CSDKSamplePlaylistParserPlugin::EnablePlugin | ( | long * | pdwFlags,
 |  | long * | pdwHeartbeatPeriod
 | ) |  |

Definition at line 112 of file SDKSamplePlaylistParser.cpp.

{
    if ( ( NULL == pdwFlags ) || ( NULL == pdwHeartbeatPeriod ) )
    {
        return ( E_POINTER );
    }

    *pdwFlags = 0;
    // We don't need to get OnHeartbeat() called.
    *pdwHeartbeatPeriod = 0;

    return ( S_OK );
}

HRESULT STDMETHODCALLTYPE CSDKSamplePlaylistParserPlugin::GetCustomAdminInterface ( IDispatch ** ppValue ) [virtual]

Definition at line 73 of file SDKSamplePlaylistParser.cpp.

{
    if ( NULL == ppValue )
    {
        return( E_INVALIDARG );
    }

    *ppValue = NULL;

    //
    // Since we have no configuration paramters to edit,
    // we expose no administration interface.
    //
    return( S_OK );
}

HRESULT STDMETHODCALLTYPE CSDKSamplePlaylistParserPlugin::InitializePlugin | ( | IWMSContext * | pServerContext,
 |  | IWMSNamedValues * | pNamedValues,
 |  | IWMSClassObject * | pClassFactory |
 | ) |  |  | [virtual]

Definition at line 46 of file SDKSamplePlaylistParser.cpp.

{
    //
    // We don't really use any of these parameters later on.
    // We are merely illustrating how you would hold a reference to it
    // using smart pointers if you did need to use it later on.
    //

    m_spServerContext = pServerContext;
    m_spNamedValues = pNamedValues;
    m_spClassFactory = pClassFactory;

    return( S_OK );
} // InitializePlugin.

HRESULT STDMETHODCALLTYPE CSDKSamplePlaylistParserPlugin::OnHeartbeat ( ) [virtual]

Definition at line 99 of file SDKSamplePlaylistParser.cpp.

{
    return( S_OK );
} // OnHeartbeat.

HRESULT STDMETHODCALLTYPE CSDKSamplePlaylistParserPlugin::ShutdownPlugin ( )

Definition at line 147 of file SDKSamplePlaylistParser.cpp.

{
    m_spNamedValues.Release();
    m_spServerContext.Release();
    m_spClassFactory.Release();
    return( S_OK );
} // ShutdownPlugin.

Member Data Documentation

CComPtr<IWMSClassObject> CSDKSamplePlaylistParserPlugin::m_spClassFactory [protected]

Definition at line 137 of file SDKSamplePlaylistParser.h.

CComPtr<IWMSNamedValues> CSDKSamplePlaylistParserPlugin::m_spNamedValues [protected]

Definition at line 135 of file SDKSamplePlaylistParser.h.

CComPtr<IWMSContext> CSDKSamplePlaylistParserPlugin::m_spServerContext [protected]

Definition at line 136 of file SDKSamplePlaylistParser.h.

The documentation for this class was generated from the following files:
  • Multimedia/WindowsMediaServices9/Playlist/SDKSamplePlaylistParser.h
  • Multimedia/WindowsMediaServices9/Playlist/SDKSamplePlaylistParser.cpp
Generated on Wed Nov 13 2024 16:57:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSDKSampleStorageSystem Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CSDKSampleStorageSystem Class Reference

#include "sdksamplestoragesystem.h"

List of all members.

Public Member Functions

CSDKSampleStorageSystem ()
virtual | ~CSDKSampleStorageSystem ()
virtual HRESULT STDMETHODCALLTYPE | CreateDataSourceDirectory (IWMSCommandContext *pCommandContext, LPWSTR pszContainerName, DWORD dwFlags, IWMSDataSourcePluginCallback *pCallback, QWORD qwContext)
virtual HRESULT STDMETHODCALLTYPE | DeleteDataContainer (LPWSTR pszContainerName, DWORD dwFlags, IWMSDataSourcePluginCallback __RPC_FAR *pCallback, QWORD qwContext)
virtual HRESULT STDMETHODCALLTYPE | DeleteDirectory (LPWSTR pszContainerName, DWORD dwFlags, IWMSDataSourcePluginCallback *pCallback, QWORD qwContext)
STDMETHOD() | DisablePlugin ()
STDMETHOD() | EnablePlugin (long *pdwFlags, long *pdwHeartbeatPeriod)
virtual HRESULT STDMETHODCALLTYPE | GetCustomAdminInterface (IDispatch **ppValue)
virtual HRESULT STDMETHODCALLTYPE | GetDataContainerVersion (IWMSCommandContext __RPC_FAR *pCommandContext, IWMSContext __RPC_FAR *pUserContext, IWMSContext __RPC_FAR *pPresContext, LPWSTR pszContainerName, DWORD dwFlags, IWMSDataSourcePluginCallback __RPC_FAR *pCallback, QWORD qwContext)
virtual HRESULT STDMETHODCALLTYPE | GetDataSourceAttributes (DWORD __RPC_FAR *pdwFlags)
virtual HRESULT STDMETHODCALLTYPE | GetRootDirectories (LPWSTR __RPC_FAR *pstrRootDirectoryList, DWORD dwMaxRoots, IWMSDataSourcePluginCallback __RPC_FAR *pCallback, QWORD qwContext)
virtual HRESULT STDMETHODCALLTYPE | InitializePlugin (IWMSContext __RPC_FAR *pServerContext, IWMSNamedValues *pNamedValues, IWMSClassObject __RPC_FAR *pClassFactory)
virtual HRESULT STDMETHODCALLTYPE | OnHeartbeat ()
virtual HRESULT STDMETHODCALLTYPE | OpenDataContainer (IWMSCommandContext *pCommandContext, IWMSContext *pUserContext, IWMSContext *pPresentationContext, LPWSTR pszContainerName, DWORD dwFlags, IWMSBufferAllocator __RPC_FAR *pBufferAllocator, IWMSDataSourcePluginCallback __RPC_FAR *pCallback, QWORD qwContext)
virtual HRESULT STDMETHODCALLTYPE | OpenDirectory (IWMSCommandContext *pCommandContext, IWMSContext *pUserContext, IWMSContext *pPresentationContext, LPWSTR pszContainerName, DWORD dwFlags, IWMSBufferAllocator *pBufferAllocator, IWMSDataSourcePluginCallback *pCallback, QWORD qwContext)
virtual HRESULT STDMETHODCALLTYPE | ShutdownPlugin ()

Protected Attributes

DWORD m_dwPageSize
IWMSClassObject * | m_pClassFactory
IWMSNamedValues * | m_pNamedValues
IWMSContext * | m_pServerContext

Detailed Description

Definition at line 136 of file sdksamplestoragesystem.h.

Constructor & Destructor Documentation

CSDKSampleStorageSystem::CSDKSampleStorageSystem ( )

Definition at line 22 of file sdksamplestoragesystem.cpp.

{
    m_pServerContext = NULL;
    m_pClassFactory = NULL;
} // End of CSDKSampleStorageSystem.

CSDKSampleStorageSystem::~CSDKSampleStorageSystem ( ) [virtual]

Definition at line 29 of file sdksamplestoragesystem.cpp.

{
    if ( m_pServerContext )
    {
        m_pServerContext->Release();
        m_pServerContext = NULL;
    }
    if ( m_pClassFactory )
    {
        m_pClassFactory->Release();
        m_pClassFactory = NULL;
    }
}

Member Function Documentation

HRESULT STDMETHODCALLTYPE CSDKSampleStorageSystem::CreateDataSourceDirectory | ( | IWMSCommandContext * | pCommandContext,
 |  | LPWSTR | pszContainerName,
 |  | DWORD | dwFlags,
 |  | IWMSDataSourcePluginCallback * | pCallback,
 |  | QWORD | qwContext |
 | ) |  |  | [virtual]

Definition at line 521 of file sdksamplestoragesystem.cpp.

{
    return( E_NOTIMPL );
}

virtual HRESULT STDMETHODCALLTYPE CSDKSampleStorageSystem::DeleteDataContainer | ( | LPWSTR | pszContainerName,
 |  | DWORD | dwFlags,
 |  | IWMSDataSourcePluginCallback __RPC_FAR * | pCallback,
 |  | QWORD | qwContext |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CSDKSampleStorageSystem::DeleteDirectory | ( | LPWSTR | pszContainerName,
 |  | DWORD | dwFlags,
 |  | IWMSDataSourcePluginCallback * | pCallback,
 |  | QWORD | qwContext |
 | ) |  |  | [virtual]

Definition at line 537 of file sdksamplestoragesystem.cpp.

{
    return( E_NOTIMPL );
}

STDMETHODIMP CSDKSampleStorageSystem::DisablePlugin ( )

Definition at line 680 of file sdksamplestoragesystem.cpp.

{
    return ( S_OK );
}

STDMETHODIMP CSDKSampleStorageSystem::EnablePlugin | ( | long * | pdwFlags,
 |  | long * | pdwHeartbeatPeriod
 | ) |  |

Definition at line 627 of file sdksamplestoragesystem.cpp.

{
    if ( NULL == pdwFlags || NULL == pdwHeartbeatPeriod )
    {
        return ( E_POINTER );
    }

    *pdwFlags = 0;
    *pdwHeartbeatPeriod = 0;

    return ( S_OK );
}

HRESULT STDMETHODCALLTYPE CSDKSampleStorageSystem::GetCustomAdminInterface ( IDispatch ** ppValue ) [virtual]

Definition at line 648 of file sdksamplestoragesystem.cpp.

{
    if ( NULL == ppValue )
    {
        return( E_INVALIDARG );
    }

    *ppValue = NULL;

    return( S_OK );
}

virtual HRESULT STDMETHODCALLTYPE CSDKSampleStorageSystem::GetDataContainerVersion | ( | IWMSCommandContext __RPC_FAR * | pCommandContext,
 |  | IWMSContext __RPC_FAR * | pUserContext,
 |  | IWMSContext __RPC_FAR * | pPresContext,
 |  | LPWSTR | pszContainerName,
 |  | DWORD | dwFlags,
 |  | IWMSDataSourcePluginCallback __RPC_FAR * | pCallback,
 |  | QWORD | qwContext |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CSDKSampleStorageSystem::GetDataSourceAttributes ( DWORD __RPC_FAR * pdwFlags ) [virtual]
virtual HRESULT STDMETHODCALLTYPE CSDKSampleStorageSystem::GetRootDirectories | ( | LPWSTR __RPC_FAR * | pstrRootDirectoryList,
 |  | DWORD | dwMaxRoots,
 |  | IWMSDataSourcePluginCallback __RPC_FAR * | pCallback,
 |  | QWORD | qwContext |
 | ) |  |  | [virtual]
virtual HRESULT STDMETHODCALLTYPE CSDKSampleStorageSystem::InitializePlugin | ( | IWMSContext __RPC_FAR * | pServerContext,
 |  | IWMSNamedValues * | pNamedValues,
 |  | IWMSClassObject __RPC_FAR * | pClassFactory |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CSDKSampleStorageSystem::OnHeartbeat ( ) [virtual]

Definition at line 668 of file sdksamplestoragesystem.cpp.

{
    return( S_OK );
} // End of OnHeartbeat.

virtual HRESULT STDMETHODCALLTYPE CSDKSampleStorageSystem::OpenDataContainer | ( | IWMSCommandContext * | pCommandContext,
 |  | IWMSContext * | pUserContext,
 |  | IWMSContext * | pPresentationContext,
 |  | LPWSTR | pszContainerName,
 |  | DWORD | dwFlags,
 |  | IWMSBufferAllocator __RPC_FAR * | pBufferAllocator,
 |  | IWMSDataSourcePluginCallback __RPC_FAR * | pCallback,
 |  | QWORD | qwContext |
 | ) |  |  | [virtual]
HRESULT STDMETHODCALLTYPE CSDKSampleStorageSystem::OpenDirectory | ( | IWMSCommandContext * | pCommandContext,
 |  | IWMSContext * | pUserContext,
 |  | IWMSContext * | pPresentationContext,
 |  | LPWSTR | pszContainerName,
 |  | DWORD | dwFlags,
 |  | IWMSBufferAllocator * | pBufferAllocator,
 |  | IWMSDataSourcePluginCallback * | pCallback,
 |  | QWORD | qwContext |
 | ) |  |  | [virtual]

Definition at line 116 of file sdksamplestoragesystem.cpp.

{
    HRESULT hr = S_OK;
    CSampleDirectory *pDirectory = NULL;

    if( ( NULL == pszContainerName )
        || ( NULL == pCallback ) )
    {
        hr = E_INVALIDARG;
        goto abort;
    }

    pDirectory = new CSampleDirectory;
    if( NULL == pDirectory )
    {
        hr = E_OUTOFMEMORY;
        goto abort;
    }

    hr = pDirectory->Initialize(
                            pUserContext,
                            pszContainerName,
                            this,
                            pCallback,
                            qwContext
                            );
    if( FAILED( hr ) )
    {
        goto abort;
    }

abort:
    if( NULL != pDirectory )
    {
        pDirectory->Release();
        pDirectory = NULL;
    }

    return( hr );
} // OpenDirectory

HRESULT STDMETHODCALLTYPE CSDKSampleStorageSystem::ShutdownPlugin ( ) [virtual]

Definition at line 597 of file sdksamplestoragesystem.cpp.

{
    if( NULL != m_pServerContext )
    {
        m_pServerContext->Release();
        m_pServerContext = NULL;
    }

    if( NULL != m_pNamedValues )
    {
        m_pNamedValues->Release();
        m_pNamedValues = NULL;
    }

    if( NULL != m_pClassFactory )
    {
        m_pClassFactory->Release();
        m_pClassFactory = NULL;
    }

    return( S_OK );
} // End Of ShutdownPlugin

Member Data Documentation

DWORD CSDKSampleStorageSystem::m_dwPageSize [protected]

Definition at line 236 of file sdksamplestoragesystem.h.

IWMSClassObject* CSDKSampleStorageSystem::m_pClassFactory [protected]

Definition at line 235 of file sdksamplestoragesystem.h.

IWMSNamedValues* CSDKSampleStorageSystem::m_pNamedValues [protected]

Definition at line 234 of file sdksamplestoragesystem.h.

IWMSContext* CSDKSampleStorageSystem::m_pServerContext [protected]

Definition at line 233 of file sdksamplestoragesystem.h.

The documentation for this class was generated from the following files:
  • Multimedia/WindowsMediaServices9/DataSource/sdksamplestoragesystem.h
  • Multimedia/WindowsMediaServices9/DataSource/sdksamplestoragesystem.cpp
Generated on Wed Nov 13 2024 16:57:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSecureObject Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes

CSecureObject Class Reference

List of all members.

Public Member Functions

CSecureObject ()
~CSecureObject ()

Public Attributes

COLORREF | m_crColor
BOOL m_fDenyPutColor
BOOL m_fDenyPutUserName
WCHAR | m_rgchUserName [20]

Private Member Functions

STDMETHODIMP | GetColor (COLORREF *pcr)
STDMETHODIMP | GetUserName (WCHAR szUserName[20])
STDMETHODIMP | PutColor (COLORREF cr)
STDMETHODIMP | PutUserName (WCHAR szUserName[20])
STDMETHODIMP | QueryInterface (REFIID iid, void **ppv)
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) AddRef(void)

Private Attributes

LONG | m_cRef

Detailed Description

Definition at line 99 of file secSvr.Cpp.

Constructor & Destructor Documentation

CSecureObject::CSecureObject ( )

Definition at line 253 of file secSvr.Cpp.

{
    static int s_ID = 0;

    // initialize the object's state
    m_cRef = 1;
    m_crColor = 0;
    m_fDenyPutColor = FALSE;
    lstrcpyW(m_rgchUserName, L"Default");
    m_fDenyPutUserName = FALSE;

    if (!s_fServer)
  {
  TCHAR   rgchName[20];
  HWND    hwnd;
  INT_PTR iPos;

  // insert the object into the server UI. put our this-pointer into the item
  // data field of the entry so that we can remove the entry in our destructor
  wsprintf(rgchName, TEXT("Object %d"), s_ID++);
  hwnd = GetDlgItem(s_hwndDlg, IDC_OBJECTS);
  iPos = SendMessage(hwnd, CB_ADDSTRING, 0, (LPARAM)rgchName);
  SendMessage(hwnd, CB_SETITEMDATA, iPos, (LPARAM)this);
  }
    else
  {
  EnterCriticalSection(&s_csDone);
  s_cInstances++;
  LeaveCriticalSection(&s_csDone);
  }
}  // CSecureObject::CSecureObject

CSecureObject::~CSecureObject ( )

Definition at line 285 of file secSvr.Cpp.

{
    if (!s_fServer)
  {
  HWND    hwnd;
  INT_PTR i, iSel, iMac;

  // remove the reference to us from the server UI. our this-pointer is in
  // the item-data field of the entry -- find it.
  hwnd = GetDlgItem(s_hwndDlg, IDC_OBJECTS);
  iSel = SendMessage(hwnd, CB_GETCURSEL, 0, 0);
  iMac = SendMessage(hwnd, CB_GETCOUNT, 0, 0);
  for (i=0; i<iMac; i++)
      {
      if ((LRESULT)this == SendMessage(hwnd, CB_GETITEMDATA, i, 0))
    {
    SendMessage(hwnd, CB_DELETESTRING, i, 0);

    // if the item being deleted is the current selection,
    // change the selection
    if (i == iSel)
        {
        SendMessage(hwnd, CB_SETCURSEL, 0, 0);
        PostMessage(s_hwndDlg, WM_COMMAND, MAKELONG(IDC_OBJECTS, CBN_SELCHANGE),
      (LPARAM)hwnd);
        }
    break;
    }
      }
  }
    else
  {
  EnterCriticalSection(&s_csDone);
  if (!--s_cInstances && !s_fService) /* could perform other shutdown management here */
      {
      s_fDone = TRUE;
      SetEvent(s_hevtDone);
      }
  LeaveCriticalSection(&s_csDone);
  }
}  // CSecureObject::~CSecureObject

Member Function Documentation

STDMETHODIMP CSecureObject::GetColor ( COLORREF * pcr ) [private]

Definition at line 348 of file secSvr.Cpp.

{
    *pcr = m_crColor;
    return S_OK;
}  // CSecureObject::GetColor

STDMETHODIMP CSecureObject::GetUserName ( WCHAR szUserName[20] ) [private]

Definition at line 378 of file secSvr.Cpp.

{
    lstrcpynW(szUserName, m_rgchUserName, 20);
    return S_OK;
}  // CSecureObject::GetUserName

STDMETHODIMP CSecureObject::PutColor ( COLORREF cr ) [private]

Definition at line 358 of file secSvr.Cpp.

{
    // a naive security check under control of the local-server's UI
    if (m_fDenyPutColor == TRUE)
  return E_ACCESSDENIED;

    m_crColor = cr;

    // update the UI to reflect a valid PutColor occurred
    if (!s_fServer)
  PostMessage(s_hwndDlg, WM_COMMAND, MAKELONG(IDC_OBJECTS,CBN_SELCHANGE),
      (LPARAM)GetDlgItem(s_hwndDlg, IDC_OBJECTS));

    return S_OK;
}  // CSecureObject::PutColor

STDMETHODIMP CSecureObject::PutUserName ( WCHAR szUserName[20] ) [private]

Definition at line 388 of file secSvr.Cpp.

{
    // a naive security check under control of the local-server's UI
    if (m_fDenyPutUserName == TRUE)
  return E_ACCESSDENIED;

    lstrcpynW(m_rgchUserName, szUserName, 20);

    // update the UI to reflect a valid PutUserName occurred
    if (!s_fServer)
  PostMessage(s_hwndDlg, WM_COMMAND, MAKELONG(IDC_OBJECTS,CBN_SELCHANGE),
      (LPARAM)GetDlgItem(s_hwndDlg, IDC_OBJECTS));

    return S_OK;
}  // CSecureObject::PutUserName

STDMETHODIMP CSecureObject::QueryInterface | ( | REFIID | iid,
 |  | void ** | ppv |
 | ) |  |  | [private]

Definition at line 332 of file secSvr.Cpp.

{
    if (iid == IID_IMyProperties || iid == IID_IUnknown)
  {
  *ppv = (IMyProperties *)this;
  AddRef();
  return S_OK;
  }
    *ppv = NULL;
    return E_NOINTERFACE;
}  // CSecureObject::QueryInterface

CSecureObject::STDMETHODIMP_ ( ULONG ) [inline, private]

Definition at line 104 of file secSvr.Cpp.

{ if (InterlockedDecrement(&m_cRef) == 0) { delete this; return 0; } return 1; }

CSecureObject::STDMETHODIMP_ ( ULONG ) [inline, private]

Definition at line 103 of file secSvr.Cpp.

{ return InterlockedIncrement(&m_cRef); }

Member Data Documentation

COLORREF CSecureObject::m_crColor

Definition at line 115 of file secSvr.Cpp.

LONG CSecureObject::m_cRef [private]

Definition at line 113 of file secSvr.Cpp.

BOOL CSecureObject::m_fDenyPutColor

Definition at line 116 of file secSvr.Cpp.

BOOL CSecureObject::m_fDenyPutUserName

Definition at line 118 of file secSvr.Cpp.

WCHAR CSecureObject::m_rgchUserName[20]

Definition at line 117 of file secSvr.Cpp.

The documentation for this class was generated from the following file:
  • Com/Fundamentals/DCom/Secure/secSvr.Cpp
Generated on Wed Nov 13 2024 16:57:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSecuritySub Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CSecuritySub Class Reference

#include "securitysub.h"

Inherits CSysLCESub.

List of all members.

Public Member Functions

CSecuritySub ()
CSecuritySub (CComSpy *pSpy)
BOOL | GetDomainSlashUser (PSID Sid, WCHAR *DomainSlashUser)
STDMETHODIMP | GetEventClass (LPGUID guid)
STDMETHODIMP | GetEventType (EventEnum *e)
STDMETHODIMP | GetInterface (IID *iid)
STDMETHODIMP | OnAuthenticate (COMSVCSEVENTINFO *pInfo, REFGUID guidActivity, ULONG64 ObjectID, REFGUID guidIID, ULONG iMeth, ULONG cbByteOrig, BYTE *pSidOriginalUser, ULONG cbByteCur, BYTE *pSidCurrentUser, BOOL bCurrentUserInpersonatingInProc)
STDMETHODIMP | OnAuthenticateFail (COMSVCSEVENTINFO *pInfo, REFGUID guidActivity, ULONG64 ObjectID, REFGUID guidIID, ULONG iMeth, ULONG cbByteOrig, BYTE *pSidOriginalUser, ULONG cbByteCur, BYTE *pSidCurrentUser, BOOL bCurrentUserInpersonatingInProc)

Detailed Description

Definition at line 33 of file securitysub.h.

Constructor & Destructor Documentation

CSecuritySub::CSecuritySub ( ) [inline]

Definition at line 38 of file securitysub.h.

  {
    m_pSpy = NULL;
  }

CSecuritySub::CSecuritySub ( CComSpy * pSpy ) [inline]

Definition at line 42 of file securitysub.h.

  {
    m_pSpy = pSpy;
  }

Member Function Documentation

BOOL CSecuritySub::GetDomainSlashUser | ( | PSID | Sid,
 |  | WCHAR * | DomainSlashUser |
 | ) |  |  | [inline]

Definition at line 183 of file securitysub.h.

  {
    WCHAR Name[USERNAMELEN + 1];
    DWORD cbName = USERNAMELEN;
    DWORD cbReferencedDomainName = USERNAMELEN;
    SID_NAME_USE eUse;
    WCHAR* p;
    ZeroMemory(Name, cbName);
    if (!LookupAccountSid(NULL, Sid, Name, &cbName, DomainSlashUser, &cbReferencedDomainName, &eUse))
      return FALSE;

    // concat domain\user
    p = DomainSlashUser + wcslen(DomainSlashUser);
    *p++ = '\\';
    wcsncpy(p, Name, wcslen(Name));
    return TRUE;
  }

STDMETHODIMP CSecuritySub::GetEventClass ( LPGUID guid ) [inline, virtual]

Implements CSysLCESub.

Definition at line 56 of file securitysub.h.

{*guid = CLSID_ComServiceEvents;return S_OK;}

STDMETHODIMP CSecuritySub::GetEventType ( EventEnum * e ) [inline, virtual]

Implements CSysLCESub.

Definition at line 55 of file securitysub.h.

{*e = Security;return S_OK;}

STDMETHODIMP CSecuritySub::GetInterface ( IID * iid ) [inline, virtual]

Implements CSysLCESub.

Definition at line 57 of file securitysub.h.

{*iid = IID_IComSecurityEvents;return S_OK;}

STDMETHODIMP CSecuritySub::OnAuthenticate | ( | COMSVCSEVENTINFO * | pInfo,
 |  | REFGUID | guidActivity,
 |  | ULONG64 | ObjectID,
 |  | REFGUID | guidIID,
 |  | ULONG | iMeth,
 |  | ULONG | cbByteOrig,
 |  | BYTE * | pSidOriginalUser,
 |  | ULONG | cbByteCur,
 |  | BYTE * | pSidCurrentUser,
 |  | BOOL | bCurrentUserInpersonatingInProc |
 | ) |  |  | [inline]

Definition at line 59 of file securitysub.h.

  {

    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnAuthenticate"), GuidToBstr(pInfo->guidApp));
    CComBSTR sGuidActivity = GuidToBstr(guidActivity);
    m_pSpy -> AddParamValueToList(L"guidActivity", sGuidActivity);

    WCHAR sObjId[32];
    wsprintfW(sObjId,L"0x%016X", ObjectID);
    m_pSpy -> AddParamValueToList(L"ObjectID", sObjId);

    CComBSTR sGuidIID = GuidToBstr(guidIID);
    m_pSpy -> AddParamValueToList(L"guidIID", sGuidIID);

    WCHAR sMethod[16];
    wsprintfW(sMethod,L"0x%08X", iMeth);
    m_pSpy -> AddParamValueToList(L"iMeth", sMethod);

    WCHAR sOriginalUser[256];
    ZeroMemory(sOriginalUser, 256*sizeof(WCHAR));

    if (GetDomainSlashUser(pSidOriginalUser, sOriginalUser))
      m_pSpy -> AddParamValueToList(L"Original User", sOriginalUser);
    else
      m_pSpy -> AddParamValueToList(L"Original User", L"<Error converting SID>");

    WCHAR sDirectUser[256];
    ZeroMemory(sDirectUser, 256*sizeof(WCHAR));

    if (GetDomainSlashUser(pSidCurrentUser, sDirectUser))
      m_pSpy -> AddParamValueToList(L"Direct User", sDirectUser);
    else
      m_pSpy -> AddParamValueToList(L"Direct User", L"<Error converting SID>");

    m_pSpy -> AddParamValueToList(L"Direct User Inpersonating InProc", bCurrentUserInpersonatingInProc ? L"Yes" : L"No");

    IF_AUDIT_DO(OnAuthenticate)(pInfo->perfCount,
                  GuidToBstr(pInfo->guidApp),
                  sGuidActivity,
                  sObjId,
                  sGuidIID,
                  sMethod,
                  sOriginalUser,
                  sDirectUser,
                  bCurrentUserInpersonatingInProc);

    return S_OK;
  }

STDMETHODIMP CSecuritySub::OnAuthenticateFail | ( | COMSVCSEVENTINFO * | pInfo,
 |  | REFGUID | guidActivity,
 |  | ULONG64 | ObjectID,
 |  | REFGUID | guidIID,
 |  | ULONG | iMeth,
 |  | ULONG | cbByteOrig,
 |  | BYTE * | pSidOriginalUser,
 |  | ULONG | cbByteCur,
 |  | BYTE * | pSidCurrentUser,
 |  | BOOL | bCurrentUserInpersonatingInProc |
 | ) |  |  | [inline]

Definition at line 121 of file securitysub.h.

  {

    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnAuthenticateFail"), GuidToBstr(pInfo->guidApp));
    CComBSTR sGuidActivity = GuidToBstr(guidActivity);
    m_pSpy -> AddParamValueToList(L"guidActivity", sGuidActivity);

    WCHAR sObjId[32];
    wsprintfW(sObjId,L"0x%016X", ObjectID);
    m_pSpy -> AddParamValueToList(L"ObjectID", sObjId);

    CComBSTR sGuidIID = GuidToBstr(guidIID);
    m_pSpy -> AddParamValueToList(L"guidIID", sGuidIID);

    WCHAR sMethod[16];
    wsprintfW(sMethod,L"0x%08X", iMeth);
    m_pSpy -> AddParamValueToList(L"iMeth", sMethod);

    WCHAR sOriginalUser[256];
    ZeroMemory(sOriginalUser, 256*sizeof(WCHAR));

    if (GetDomainSlashUser(pSidOriginalUser, sOriginalUser))
      m_pSpy -> AddParamValueToList(L"Original User", sOriginalUser);
    else
      m_pSpy -> AddParamValueToList(L"Original User", L"<Error converting SID>");

    WCHAR sDirectUser[256];
    ZeroMemory(sDirectUser, 256*sizeof(WCHAR));

    if (GetDomainSlashUser(pSidCurrentUser, sDirectUser))
      m_pSpy -> AddParamValueToList(L"Direct User", sDirectUser);
    else
      m_pSpy -> AddParamValueToList(L"Direct User", L"<Error converting SID>");

    m_pSpy -> AddParamValueToList(L"Direct User Inpersonating InProc", bCurrentUserInpersonatingInProc ? L"Yes" : L"No");

    IF_AUDIT_DO(OnAuthenticateFail)(pInfo->perfCount,
                  GuidToBstr(pInfo->guidApp),
                  sGuidActivity,
                  sObjId, // objectID
                  sGuidIID, //interface ID
                  sMethod, //
                  sOriginalUser,
                  sDirectUser,
                  bCurrentUserInpersonatingInProc);

    return S_OK;
  }

The documentation for this class was generated from the following file:
  • Com/Administration/Spy/ComSpyCtl/securitysub.h
Generated on Wed Nov 13 2024 16:57:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSelectEventsDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Private Member Functions | Private Attributes

CSelectEventsDlg Class Reference

#include "selectEventsDlg.h"

List of all members.

Public Types

enum | { IDD = IDD_CONFIGUREEVENTSDLG }

Public Member Functions

CSelectEventsDlg (MapStringToAppInfo *spMap, CAppInfo *pSysAppInfo, CComSpy *pSpyObj)
LRESULT | AppsListHandler (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
bool | GetCatalogApps ()
bool | GetRunningApps ()
LRESULT | LVEventItemChanged (int idCtrl, LPNMHDR pnmh, BOOL &bHandled)
LRESULT | LVSystemEventItemChanged (int idCtrl, LPNMHDR pnmh, BOOL &bHandled)
void | MarkAllAppsForDelete (bool bDeleteUnused)
LRESULT | OnDestroyDlg (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
LRESULT | OnInitDialog (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
LRESULT | OnOK (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnSelectAllApps (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
void | PopulateEventList ()
void | PopulateSysEventList ()
bool | SelectAllApps (bool bSelectAll)
bool | SelectApplication (int nItem)
void | ShowSelectedEvents (CAppInfo *pInfo)
void | ShowSelectedSystemEvents ()

Private Member Functions

CSelectEventsDlg ()

Private Attributes

MapStringToAppInfo * m_map
CComSpy * m_pSpyObj
CAppInfo * m_pSysAppInfo

Detailed Description

Definition at line 29 of file selectEventsDlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 52 of file selectEventsDlg.h.

{ IDD = IDD_CONFIGUREEVENTSDLG };

Constructor & Destructor Documentation

CSelectEventsDlg::CSelectEventsDlg ( ) [private]
CSelectEventsDlg::CSelectEventsDlg | ( | MapStringToAppInfo * | spMap,
 |  | CAppInfo * | pSysAppInfo,
 |  | CComSpy * | pSpyObj
 | ) |  |

Definition at line 100 of file selectEventsDlg.Cpp.

{
  m_map = spMap;
  m_pSysAppInfo = pSysAppInfo;
  m_pSpyObj = pSpyObj;
}

Member Function Documentation

LRESULT CSelectEventsDlg::AppsListHandler | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 529 of file selectEventsDlg.Cpp.

{
  bool bResult;
  int nIndex;
  HCURSOR hOldCursor;
  switch(wNotifyCode)
  {
  case LBN_SELCHANGE:
    hOldCursor = ::SetCursor(LoadCursor(NULL, IDC_WAIT));
    nIndex = SendDlgItemMessage(IDC_LIST_APPS, LB_GETCURSEL, 0, (LPARAM)0);
    bResult = SelectApplication(nIndex); // See below...
    ::SetCursor(hOldCursor);
    break;
  default:
    break;
  };
  bHandled = TRUE;
  return 0;
}

bool CSelectEventsDlg::GetCatalogApps ( )

Definition at line 273 of file selectEventsDlg.Cpp.

{
  USES_CONVERSION;

  HRESULT hr = E_FAIL;
  ICOMAdminCatalog* pCOMAdminCatalog = NULL;
  IDispatch* pDisp;
  ICatalogCollection* pCatalogCollection = NULL;
  ICatalogObject* pCatalog = NULL;
  CComBSTR bstrApplications("Applications");

  hr = CoCreateInstance(CLSID_COMAdminCatalog, NULL, CLSCTX_ALL,
                         IID_ICOMAdminCatalog, (void **)&pCOMAdminCatalog);
  if (hr || (!pCOMAdminCatalog))
  {
    _ASSERTE(0);
    return false;
  }

  hr = pCOMAdminCatalog->GetCollection(bstrApplications, &pDisp);
  if (hr || (!pDisp))
  {
    _ASSERTE(0);
    return false;
  }
  SafeRelease(pCOMAdminCatalog);

  hr = pDisp->QueryInterface(IID_ICatalogCollection,
                 (void **)&pCatalogCollection);
  if (hr || (!pCatalogCollection))
  {
    _ASSERTE(0);
    return false;
  }
  SafeRelease(pDisp);

  // Populate the Catalog collection.  The collection is empty
  //  until this is called.
  hr = pCatalogCollection->Populate();
  if (hr)
  {
    _ASSERTE(0);
    return false;
  }

  // Now we can iterate through the Catalog apps.
  long lApplications;
  int dIndex;
  pCatalogCollection->get_Count(&lApplications);
  for (int i = 0; i < lApplications; i++)
  {
    pDisp = NULL;
    pCatalog = NULL;

    // Get the next Catalog in the collection.
    pCatalogCollection->get_Item(i, &pDisp);
    if (pDisp) pDisp->QueryInterface(IID_ICatalogObject,
                     (void **)&pCatalog);

    // Get the Application name into a _bstr_t from the Catalog
    // object for easier conversion.
    _variant_t vName;
    if (pCatalog) pCatalog->get_Name(&vName);
    _bstr_t sName = vName;
    LPSTR p = (char*)sName;
    _variant_t vKey;
    if (pCatalog) pCatalog->get_Key(&vKey);
    _bstr_t sKey = vKey;

    // Now get the pointer to the CAppInfo for this one.
    CAppInfo * pInfo = NULL;
    pInfo = (*m_map)[p];
    if (!pInfo)
    {
      pInfo = new CAppInfo((TCHAR*)sName, m_pSpyObj, (TCHAR*)sKey);
      _ASSERTE(pInfo);
      (*m_map)[p] = pInfo;
    };

    // Ensure we don't delete this app during Garbage Collection.
    pInfo->SetDeleteFlag(false);

    // Add the item to the List Box.
    dIndex = SendDlgItemMessage(IDC_LIST_APPS, LB_ADDSTRING,
                  0, (LPARAM)(TCHAR*)sName);
    SafeRelease(pDisp);
    SafeRelease(pCatalog);
  };
  SafeRelease(pCatalogCollection);

  return true;
};

bool CSelectEventsDlg::GetRunningApps ( )

Definition at line 386 of file selectEventsDlg.Cpp.

{
  USES_CONVERSION;

  long lApplications;
  int dIndex;
  HRESULT hr = E_FAIL;
  IMtsGrp * pMtsGrp = NULL;
  IUnknown * pUnk = NULL;
  IMtsEvents * pEvents = NULL;

  hr = CoCreateInstance (CLSID_MtsGrp, NULL, CLSCTX_ALL, IID_IMtsGrp, (void **)&pMtsGrp);
  if (!pMtsGrp)
  {
    return false;
  }

  pMtsGrp->get_Count(&lApplications);

  // For each running Application, get the name and stuff it in LB.
  for (int i=0; i < lApplications; i++)
  {
    pMtsGrp->Item(i, &pUnk);
    pEvents = NULL;

    if (pUnk) pUnk->QueryInterface(IID_IMtsEvents, (void **)&pEvents);
    _ASSERTE(pEvents);

    // Get the Application name into a _bstr_t for easier conversion.
    CComBSTR sName;
    CAppInfo * pInfo = NULL;
    long lPID;
    if (pEvents) pEvents->get_PackageName(&sName);
    if (pEvents) pEvents->GetProcessID(&lPID);
    _bstr_t bstrApplicationName((BSTR)sName);

    // Now get the pointer to the CAppInfo for this one.
    TCHAR szExtendedName[255];
    wsprintf( szExtendedName, _T(" [PID=%d (0x%08X)]"), lPID, lPID);
    bstrApplicationName += szExtendedName;
    LPSTR p = (char*)bstrApplicationName;
    pInfo = (*m_map)[p];
    if (!pInfo)
    {
      pInfo = new CAppInfo((TCHAR*)bstrApplicationName, m_pSpyObj, lPID);
      _ASSERTE(pInfo);
      (*m_map)[p] = pInfo;
    };

    // Ensure we don't delete this app during Garbage Collection.
    pInfo->SetDeleteFlag(false);

    // Add the AppName (with PID info) to the Apps ListBox.
    dIndex = SendDlgItemMessage(IDC_LIST_APPS, LB_ADDSTRING, 0,
                       (LPARAM)((TCHAR*)bstrApplicationName));

    SafeRelease(pEvents);
    SafeRelease(pUnk);
  }

  SafeRelease(pMtsGrp);

  return true;
};

LRESULT CSelectEventsDlg::LVEventItemChanged | ( | int | idCtrl,
 |  | LPNMHDR | pnmh,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 629 of file selectEventsDlg.Cpp.

{
  NM_LISTVIEW* pnmList = (NM_LISTVIEW*)pnmh;
  LVITEM lvItem;
  BOOL bResult;
  TCHAR sz[MAX_APPNAME_SIZE];

  UINT nItemNumber = pnmList->iItem;
  UINT nCurrentState = pnmList->uNewState;
  UINT nOldState = pnmList->uOldState;

  lvItem.iItem = nItemNumber;
  lvItem.iSubItem = 0;
  lvItem.mask = LVIF_PARAM;
  memset(&sz[0], NULL, MAX_APPNAME_SIZE * sizeof(TCHAR));

  // If we toggled check box state, do this.
  if (((nCurrentState & 8192) && (nOldState & 4096)) ||
     ((nOldState & 8192) && (nCurrentState & 4096)))
  {
    EventEnum nEvent;
    bResult = ListView_GetItem(GetDlgItem(IDC_LISTVIEWEVENTS), &lvItem);
    _ASSERTE(bResult);
    nEvent = (EventEnum)lvItem.lParam;

    // Get App Name.  If Checkbox enabled, then use the AllApps string.
    if (IsDlgButtonChecked(IDC_CHECK_ALLAPPS) == 0)
    {
      int nAppIndex = SendDlgItemMessage(IDC_LIST_APPS, LB_GETCURSEL, 0, (LPARAM)0);
      SendDlgItemMessage(IDC_LIST_APPS, LB_GETTEXT, nAppIndex, (LPARAM)sz);
    }
    else
      _tcsncpy(sz, (TCHAR*)g_bstrAllApps, _tcslen(g_bstrAllApps));

    CAppInfo * pInfo = NULL;
    _bstr_t bstrApplicationName(sz);
    LPSTR p = (char*)bstrApplicationName;
    pInfo = (*m_map)[p];
    _ASSERTE(pInfo);

    // If we have checked a previously unchecked box, do this:
    if ((nCurrentState & 8192) && (nOldState & 4096))
    {
      // Install this event handler.
      if (!pInfo->IsSubscribed(nEvent))
      {
        HCURSOR hOldCursor = ::SetCursor(LoadCursor(NULL, IDC_WAIT));
        bResult = pInfo->AddSubscription(nEvent);
        ::SetCursor(hOldCursor);
      };
    }
    else if ((nOldState & 8192) && (nCurrentState & 4096))
    {
      // Remove this event handler.
      if (pInfo->IsSubscribed(nEvent))
      {
        HCURSOR hOldCursor = ::SetCursor(LoadCursor(NULL, IDC_WAIT));
        bResult = pInfo->RemoveSubscription(nEvent);
        ::SetCursor(hOldCursor);
      };
    }
  };

  return 0;
};

LRESULT CSelectEventsDlg::LVSystemEventItemChanged | ( | int | idCtrl,
 |  | LPNMHDR | pnmh,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 702 of file selectEventsDlg.Cpp.

{
  NM_LISTVIEW* pnmList = (NM_LISTVIEW*)pnmh;
  LVITEM lvItem;
  BOOL bResult;
  TCHAR sz[MAX_APPNAME_SIZE];

  UINT nItemNumber = pnmList->iItem;
  UINT nCurrentState = pnmList->uNewState;
  UINT nOldState = pnmList->uOldState;

  lvItem.iItem = nItemNumber;
  lvItem.iSubItem = 0;
  lvItem.mask = LVIF_PARAM;
  memset(&sz[0], NULL, MAX_APPNAME_SIZE * sizeof(TCHAR));

  // If we toggled check box state, do this.
  if (((nCurrentState & 8192) && (nOldState & 4096)) ||
     ((nOldState & 8192) && (nCurrentState & 4096)))
  {
    EventEnum nEvent;
    bResult = ListView_GetItem(GetDlgItem(IDC_LISTVIEWSYSEVENTS), &lvItem);
    _ASSERTE(bResult);
    nEvent = (EventEnum)lvItem.lParam;

    // If we have checked a previously unchecked box, do this:
    if ((nCurrentState & 8192) && (nOldState & 4096))
    {
      // Install this event handler.
      if (!m_pSysAppInfo->IsSubscribed(nEvent))
      {
        HCURSOR hOldCursor = ::SetCursor(LoadCursor(NULL, IDC_WAIT));
        bResult = m_pSysAppInfo->AddSubscription(nEvent);
        ::SetCursor(hOldCursor);
      };
    }
    else if ((nOldState & 8192) && (nCurrentState & 4096))
    {
      // Remove this event handler.
      if (m_pSysAppInfo->IsSubscribed(nEvent))
      {
        HCURSOR hOldCursor = ::SetCursor(LoadCursor(NULL, IDC_WAIT));
        bResult = m_pSysAppInfo->RemoveSubscription(nEvent);
        ::SetCursor(hOldCursor);
      };
    }
  };

  return 0;
};

void CSelectEventsDlg::MarkAllAppsForDelete ( bool bDeleteUnused )

Definition at line 220 of file selectEventsDlg.Cpp.

{
  MapStringToAppInfo::iterator item;
  CAppInfo * pInfo = NULL;

  item = m_map->begin();
  while (item != m_map->end())
  {
    pInfo = (*item).second;
    _ASSERTE(pInfo);

    // If Delete Unsued flag is set, we purge.
    if (bDeleteUnused)
    {
      if (pInfo->IsReadyForDelete())
      {
        delete pInfo;
        item = m_map->erase(item);
      }
      else
      {
        item++;
      }
    }
    else // We just set everything to delete.
    {
      pInfo->SetDeleteFlag(true);
      item++;
    };
  };
//for (item = m_map->begin(); item != m_map->end(); ++item)
}

LRESULT CSelectEventsDlg::OnDestroyDlg | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 202 of file selectEventsDlg.Cpp.

{
  bHandled = FALSE;
  return 0;
}

LRESULT CSelectEventsDlg::OnInitDialog | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 124 of file selectEventsDlg.Cpp.

{
  // Set the window to have Check Box support.
  ListView_SetExtendedListViewStyle(GetDlgItem(IDC_LISTVIEWEVENTS), LVS_EX_CHECKBOXES);

  ListView_SetExtendedListViewStyle(GetDlgItem(IDC_LISTVIEWSYSEVENTS), LVS_EX_CHECKBOXES);

  // Mark all Apps as ready for deletion until proven otherwise.
  MarkAllAppsForDelete(false);

  // Now populate the current Catalog applications.
  GetCatalogApps();

  // Now populate the current Running applications.
  GetRunningApps();

  // Populate the list of possible App events.
  PopulateEventList();

  //Populate the list of possible system events.
  PopulateSysEventList();

  // Now create the AllApps CAppInfo.
  CAppInfo* pInfo = (*m_map)[(char*)g_bstrAllApps];
  if (!pInfo)
  {
    pInfo = new CAppInfo((TCHAR*)g_bstrAllApps, m_pSpyObj);
    (*m_map)[(char*)g_bstrAllApps] = pInfo;
  }
  else
    pInfo->SetDeleteFlag(false);

  // Do garbage collection on the apps that are no longer valid.
  MarkAllAppsForDelete(true);

  // Select the first Application in the listbox.
  SendDlgItemMessage(IDC_LIST_APPS, LB_SETCURSEL, 0);

  // If they are using any event in the special AllApps object, then display
  // the check box and disable the ListBox.
  if (pInfo->IsSubscribedToAny())
  {
    CheckDlgButton(IDC_CHECK_ALLAPPS, 1);
    SelectAllApps(true);
  }
  else
    SelectApplication(0);

  ShowSelectedSystemEvents();

  return 1;
}

LRESULT CSelectEventsDlg::OnOK | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 187 of file selectEventsDlg.Cpp.

{
  EndDialog(wID);
  return 0;
}

LRESULT CSelectEventsDlg::OnSelectAllApps | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 558 of file selectEventsDlg.Cpp.

{
  UINT nChecked = IsDlgButtonChecked(IDC_CHECK_ALLAPPS);
  bool bResult = SelectAllApps(nChecked ? true : false);
  return 0;
};

void CSelectEventsDlg::PopulateEventList ( )

Definition at line 461 of file selectEventsDlg.Cpp.

{
  LVITEM lvItem;
  int nIndex;
  int i;
  HWND  hEvents = GetDlgItem(IDC_LISTVIEWEVENTS);

  lvItem.state = 0;
  lvItem.iItem = 0;
  lvItem.stateMask = 0;
  lvItem.mask = LVIF_TEXT | LVIF_PARAM;
  lvItem.iSubItem = 0;

  // fill the Possible Events list
  for (i = 0; i < sizeof(EventInfo)/sizeof(EventInfo[0]); i++)
  {
    lvItem.pszText = EventInfo[i].sDisplayName;
    lvItem.lParam = (long)EventInfo[i].eEvent;
    lvItem.mask = LVIF_TEXT | LVIF_PARAM;
    nIndex = ListView_InsertItem(hEvents, &lvItem);
  }
}

void CSelectEventsDlg::PopulateSysEventList ( )

Definition at line 494 of file selectEventsDlg.Cpp.

{

  LVITEM lvItem;
  int nIndex;
  int i;

  HWND  hSysEvents = GetDlgItem(IDC_LISTVIEWSYSEVENTS);

  lvItem.state = 0;
  lvItem.iItem = 0;
  lvItem.stateMask = 0;
  lvItem.mask = LVIF_TEXT | LVIF_PARAM;
  lvItem.iSubItem = 0;

  //fill the possilbe System Events list
  for (i = 0; i < sizeof(SystemEventInfo)/sizeof(SystemEventInfo[0]); i++)
  {
    lvItem.pszText = SystemEventInfo[i].sDisplayName;
    lvItem.lParam = (long)SystemEventInfo[i].eEvent;
    lvItem.mask = LVIF_TEXT | LVIF_PARAM;
    nIndex = ListView_InsertItem(hSysEvents, &lvItem);
  }

}

bool CSelectEventsDlg::SelectAllApps ( bool bSelectAll )

Definition at line 580 of file selectEventsDlg.Cpp.

{
  CAppInfo* pAllAppsInfo = (*m_map)[(char*)g_bstrAllApps];

  // Modify the cursor.
  HCURSOR hOldCursor = ::SetCursor(LoadCursor(NULL, IDC_WAIT));

  // Now remove all events for every app.
  MapStringToAppInfo::iterator item;
  CAppInfo* pAppInfo;
  for (item = m_map->begin(); item != m_map->end(); ++item)
  {
    pAppInfo = (*item).second;
    if ((pAppInfo) && (pAppInfo != pAllAppsInfo))
      pAppInfo->RemoveAllSubscriptions();
  };

  if (!bSelectAll)
  {
    ::EnableWindow(GetDlgItem(IDC_LIST_APPS), TRUE);
    int nItem = SendDlgItemMessage(IDC_LIST_APPS, LB_GETCURSEL, 0, 0);
    // Since we are unselecting AllApps, we need to remove its subscriptions
    pAllAppsInfo->RemoveAllSubscriptions();
    bool bResult = SelectApplication(nItem);
  }
  else
  {
    ::EnableWindow(GetDlgItem(IDC_LIST_APPS), FALSE);
    SetDlgItemText(IDC_STATIC_CURRENTAPP, (TCHAR*)g_bstrAllApps);
  };

  // Re-fresh the event list for this CAppInfo
  ShowSelectedEvents((*m_map)[(char*)g_bstrAllApps]);

  // Update the static text for the application type.
  SetDlgItemText(IDC_STATIC_TYPE, (TCHAR*)g_bstrAppType_Application);

  ::SetCursor(hOldCursor);
  return true;
};

bool CSelectEventsDlg::SelectApplication ( int nItem )

Definition at line 833 of file selectEventsDlg.Cpp.

{
  USES_CONVERSION;
  TCHAR sz[MAX_APPNAME_SIZE];
  memset(&sz[0], NULL, MAX_APPNAME_SIZE * sizeof(TCHAR));
  SendDlgItemMessage(IDC_LIST_APPS, LB_GETTEXT, nItem, (LPARAM)sz);
  SetDlgItemText(IDC_STATIC_CURRENTAPP, sz);

  // If this is a Process, use the special name.
  int nAppIndex = SendDlgItemMessage(IDC_LIST_APPS, LB_GETCURSEL, 0, (LPARAM)0);
  SendDlgItemMessage(IDC_LIST_APPS, LB_GETTEXT, nAppIndex, (LPARAM)sz);

  // Now get the pointer to the CAppInfo for this one.
  CAppInfo* pInfo = (*m_map)[T2A(sz)];
  _ASSERTE(pInfo);
  if (pInfo->GetFilterType() == ProcessID)
    SetDlgItemText(IDC_STATIC_TYPE, (TCHAR*)g_bstrAppType_Process);
  else
    SetDlgItemText(IDC_STATIC_TYPE, (TCHAR*)g_bstrAppType_Application);

  // Re-fresh the event list for this CAppInfo
  ShowSelectedEvents(pInfo);

  return true;
};

void CSelectEventsDlg::ShowSelectedEvents ( CAppInfo * pInfo )

Definition at line 761 of file selectEventsDlg.Cpp.

{
  _ASSERTE(pInfo);
  LVITEM lvItem;
  BOOL bResult;
  bool bIsChecked;
  EventEnum nEvent;

  lvItem.iSubItem = 0;
  lvItem.mask = LVIF_PARAM; // Get the the EventEnum value from lParam.

  for (int i = 0; i < sizeof(EventInfo)/sizeof(EventInfo[0]); i++)
  {
    // First, get the EventEnum for this item.
    lvItem.iItem = i;
    bResult = ListView_GetItem(GetDlgItem(IDC_LISTVIEWEVENTS), &lvItem);
    _ASSERTE(bResult);
    nEvent = (EventEnum)lvItem.lParam;

    // Now determine whether or not it should be checked.
    bIsChecked = pInfo->IsSubscribed(nEvent);

    // Next, update the ListView accordingly.
    ListView_SetCheckState(GetDlgItem(IDC_LISTVIEWEVENTS), i, bIsChecked);
  };
};

void CSelectEventsDlg::ShowSelectedSystemEvents ( )

Definition at line 795 of file selectEventsDlg.Cpp.

{
  _ASSERTE(m_pSysAppInfo);
  LVITEM lvItem;
  BOOL bResult;
  bool bIsChecked;
  EventEnum nEvent;

  lvItem.iSubItem = 0;
  lvItem.mask = LVIF_PARAM; // Get the the EventEnum value from lParam.

  for (int i = 0; i < sizeof(SystemEventInfo)/sizeof(SystemEventInfo[0]); i++)
  {
    // First, get the EventEnum for this item.
    lvItem.iItem = i;
    bResult = ListView_GetItem(GetDlgItem(IDC_LISTVIEWSYSEVENTS), &lvItem);
    _ASSERTE(bResult);
    nEvent = (EventEnum)lvItem.lParam;

    // Now determine whether or not it should be checked.
    bIsChecked = m_pSysAppInfo->IsSubscribed(nEvent);

    // Next, update the ListView accordingly.
    ListView_SetCheckState(GetDlgItem(IDC_LISTVIEWSYSEVENTS), i, bIsChecked);
  };
};

Member Data Documentation

MapStringToAppInfo* CSelectEventsDlg::m_map [private]

Definition at line 32 of file selectEventsDlg.h.

CComSpy* CSelectEventsDlg::m_pSpyObj [private]

Definition at line 34 of file selectEventsDlg.h.

CAppInfo* CSelectEventsDlg::m_pSysAppInfo [private]

Definition at line 33 of file selectEventsDlg.h.

The documentation for this class was generated from the following files:
  • Com/Administration/Spy/ComSpyCtl/selectEventsDlg.h
  • Com/Administration/Spy/ComSpyCtl/selectEventsDlg.Cpp
Generated on Wed Nov 13 2024 16:57:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSendMessageDialog Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions

CSendMessageDialog Class Reference

#include "SendMDlg.h"

List of all members.

Public Types

enum | { IDD = IDD_SEND_MESSAGE_DIALOG }

Public Member Functions

CSendMessageDialog (CArray< ARRAYQ *, ARRAYQ * > *, CWnd *pParent=NULL)
unsigned char | GetAcknowledge ()
void | GetAdminPathName (TCHAR szAdminPathName[BUFFERSIZE])
unsigned char | GetAuthenticated ()
unsigned char | GetDeadLetter ()
unsigned char | GetDelivery ()
unsigned char | GetEncrypted ()
unsigned char | GetJournal ()
void | GetMessageBody (TCHAR *pszMessageBodyBuffer)
void | GetMessageLabel (TCHAR szMessageLabelBuffer[BUFFERSIZE])
void | GetPathName (TCHAR szPathName[BUFFERSIZE])
unsigned char | GetPriority ()
DWORD GetTimeToBeReceived ()
DWORD GetTimeToReachQueue ()

Public Attributes

CComboBox | m_AdminPathNameCB
BOOL m_Authenticated
BYTE | m_bPriority
BOOL m_DeadLetter
long | m_dwTimeToBeReceived
long | m_dwTimeToReachQueue
BOOL m_Encrypted
int | m_iAck
int | m_iDelivery
BOOL m_Journal
CComboBox | m_PathNameCB
CArray< ARRAYQ *, ARRAYQ * > * | m_pStrArray
CString m_strBody
CString m_strLabel
CString m_szAdminPathName
CString m_szPathName

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
virtual BOOL | OnInitDialog ()
virtual void | OnOK ()
afx_msg void | OnSelchangeTargetCombo ()

Detailed Description

Definition at line 20 of file SendMDlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 28 of file SendMDlg.h.

{ IDD = IDD_SEND_MESSAGE_DIALOG };

Constructor & Destructor Documentation

CSendMessageDialog::CSendMessageDialog | ( | CArray< ARRAYQ *, ARRAYQ * > * | pStrArray,
 |  | CWnd * | pParent = NULL
 | ) |  |

Definition at line 33 of file SendMDlg.Cpp.

  : CDialog(CSendMessageDialog::IDD, pParent)
{
  m_pStrArray = pStrArray;

  //{{AFX_DATA_INIT(CSendMessageDialog)
  m_strBody = szLastMessageBody;
  m_strLabel = szLastMessageLabel;
  m_bPriority = (MQ_MAX_PRIORITY - MQ_MIN_PRIORITY)/2;
  m_iAck = MQMSG_ACKNOWLEDGMENT_NONE;
  m_iDelivery = MQMSG_DELIVERY_EXPRESS;
  m_szPathName = _T("");
  m_szAdminPathName = _T("");
  m_Journal = FALSE;
  m_DeadLetter = FALSE;
  m_Authenticated = FALSE;
  m_Encrypted = FALSE;
  m_dwTimeToReachQueue = (DWORD)DEFAULT_M_TIMETOREACHQUEUE;
  m_dwTimeToBeReceived = (DWORD)DEFAULT_M_TIMETOBERECEIVED;
  //}}AFX_DATA_INIT
}

Member Function Documentation

void CSendMessageDialog::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 56 of file SendMDlg.Cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CSendMessageDialog)
  DDX_Control(pDX, IDC_ADMIN_COMBO, m_AdminPathNameCB);
  DDX_Control(pDX, IDC_TARGET_COMBO, m_PathNameCB);
  DDX_Text(pDX, IDC_BODY, m_strBody);
  DDV_MaxChars(pDX, m_strBody, 128);
  DDX_Text(pDX, IDC_LABEL, m_strLabel);
  DDV_MaxChars(pDX, m_strLabel, 128);
  DDX_Text(pDX, IDC_MESSAGE_PRIORITY, m_bPriority);
  DDV_MinMaxByte(pDX, m_bPriority, MQ_MIN_PRIORITY, MQ_MAX_PRIORITY);
  DDX_Radio(pDX, IDC_ACK_NONE_RADIO, m_iAck);
  DDX_Radio(pDX, IDC_DELIVERY_EXPRESS_RADIO, m_iDelivery);
  DDX_CBString(pDX, IDC_TARGET_COMBO, m_szPathName);
  DDV_MaxChars(pDX, m_szPathName, 4000);
  DDX_CBString(pDX, IDC_ADMIN_COMBO, m_szAdminPathName);
  DDV_MaxChars(pDX, m_szAdminPathName, 4000);
  DDX_Check(pDX, IDC_JOURNAL, m_Journal);
  DDX_Check(pDX, IDC_DEAD_LETTER, m_DeadLetter);
  DDX_Check(pDX, IDC_AUTHENTICATED, m_Authenticated);
  DDX_Check(pDX, IDC_ENCRYPTED, m_Encrypted);
  DDX_Text(pDX, IDC_TIME_TO_REACH_QUEUE, m_dwTimeToReachQueue);
  DDX_Text(pDX, IDC_TIME_TO_BE_RECEIVED, m_dwTimeToBeReceived);
  //}}AFX_DATA_MAP
}

unsigned char CSendMessageDialog::GetAcknowledge ( ) [inline]

Definition at line 117 of file SendMDlg.h.

  {
    switch (m_iAck)
    {
    case 1 : return MQMSG_ACKNOWLEDGMENT_FULL_REACH_QUEUE;
    case 2 : return MQMSG_ACKNOWLEDGMENT_FULL_RECEIVE;
    case 3 : return MQMSG_ACKNOWLEDGMENT_NACK_REACH_QUEUE;
    case 4 : return MQMSG_ACKNOWLEDGMENT_NACK_RECEIVE;
    default: return MQMSG_ACKNOWLEDGMENT_NONE;
    }
  }

void CSendMessageDialog::GetAdminPathName ( TCHAR szAdminPathName[BUFFERSIZE] ) [inline]

Definition at line 78 of file SendMDlg.h.

  {
    ASSERT(szAdminPathName != NULL);

    _tcsncpy (szAdminPathName, m_szAdminPathName, BUFFERSIZE-1);
    szAdminPathName[BUFFERSIZE-1] = '\0';

  }

unsigned char CSendMessageDialog::GetAuthenticated ( ) [inline]

Definition at line 102 of file SendMDlg.h.

  {
    return (m_Authenticated);
  }

unsigned char CSendMessageDialog::GetDeadLetter ( ) [inline]

Definition at line 97 of file SendMDlg.h.

  {
    return (m_DeadLetter);
  }

unsigned char CSendMessageDialog::GetDelivery ( ) [inline]

Definition at line 87 of file SendMDlg.h.

  {
    return (m_iDelivery);
  }

unsigned char CSendMessageDialog::GetEncrypted ( ) [inline]

Definition at line 107 of file SendMDlg.h.

  {
    return (m_Encrypted);
  }

unsigned char CSendMessageDialog::GetJournal ( ) [inline]

Definition at line 92 of file SendMDlg.h.

  {
    return (m_Journal);
  }

void CSendMessageDialog::GetMessageBody ( TCHAR * pszMessageBodyBuffer ) [inline]

Definition at line 129 of file SendMDlg.h.

  {
    ASSERT(pszMessageBodyBuffer != NULL);

    _tcsncpy (pszMessageBodyBuffer, m_strBody, BUFFERSIZE-1);
    pszMessageBodyBuffer[BUFFERSIZE-1] = '\0';

  }

void CSendMessageDialog::GetMessageLabel ( TCHAR szMessageLabelBuffer[BUFFERSIZE] ) [inline]

Definition at line 138 of file SendMDlg.h.

  {
    ASSERT(szMessageLabelBuffer != NULL);

    _tcsncpy (szMessageLabelBuffer, m_strLabel, BUFFERSIZE-1);
    szMessageLabelBuffer[BUFFERSIZE-1] = '\0';

  }

void CSendMessageDialog::GetPathName ( TCHAR szPathName[BUFFERSIZE] ) [inline]

Definition at line 68 of file SendMDlg.h.

  {
    ASSERT(szPathName != NULL);

    _tcsncpy (szPathName, m_szPathName, BUFFERSIZE-1);
    szPathName[BUFFERSIZE-1] = '\0';

  }

unsigned char CSendMessageDialog::GetPriority ( ) [inline]

Definition at line 112 of file SendMDlg.h.

  {
    return (m_bPriority);
  }

DWORD CSendMessageDialog::GetTimeToBeReceived ( ) [inline]

Definition at line 152 of file SendMDlg.h.

  {
    return (m_dwTimeToBeReceived);
  }

DWORD CSendMessageDialog::GetTimeToReachQueue ( ) [inline]

Definition at line 147 of file SendMDlg.h.

  {
    return (m_dwTimeToReachQueue);
  }

BOOL CSendMessageDialog::OnInitDialog ( ) [protected, virtual]

Definition at line 93 of file SendMDlg.Cpp.

{
  CDialog::OnInitDialog();

  int i;

  // TODO: Add extra initialization here
  for  (i=0 ; i<m_pStrArray->GetSize() ; i++)
  {
    if (((*m_pStrArray)[i]->dwAccess & MQ_SEND_ACCESS) != FALSE)
    {
      if ((*m_pStrArray)[i]->bFormatNameOnly)
      {
        VERIFY (m_PathNameCB.AddString((*m_pStrArray)[i]->szFormatName) != CB_ERR);
      }
      else
      {
        VERIFY (m_PathNameCB.AddString((*m_pStrArray)[i]->szPathName) != CB_ERR);
      }
    }
    if ((*m_pStrArray)[i]->bFormatNameOnly)
    {
      CString str = (*m_pStrArray)[i]->szFormatName;
      str=str.Left(sizeof(MULTICAST)/sizeof(TCHAR)-1);
      if (str.Left(sizeof(MULTICAST)/sizeof(TCHAR)-1).CompareNoCase(MULTICAST) != 0)
      {
        VERIFY (m_AdminPathNameCB.AddString((*m_pStrArray)[i]->szFormatName) != CB_ERR);
      }
    }
    else
    {
      VERIFY (m_AdminPathNameCB.AddString((*m_pStrArray)[i]->szPathName) != CB_ERR);
    }
  }

    //
    // Set the first PathName as default selection.
    //
    if (m_PathNameCB.GetCount() > 0) m_PathNameCB.SetCurSel(0);
    if (m_AdminPathNameCB.GetCount() > 0) m_AdminPathNameCB.SetCurSel(0);

    return TRUE;  // return TRUE unless you set the focus to a control
                // EXCEPTION: OCX Property Pages should return FALSE
}

void CSendMessageDialog::OnOK ( ) [protected, virtual]

Definition at line 139 of file SendMDlg.Cpp.

{

  UpdateData(TRUE);
  if ((m_szAdminPathName == _T("")) && (m_iAck != 0))
  {
    AfxMessageBox(_T("The chosen acknowledgement requires Admin queue. Please enter a path for the admin queue."));
    return;
  }

  CDialog::OnOK();
}

void CSendMessageDialog::OnSelchangeTargetCombo ( ) [protected]

Definition at line 152 of file SendMDlg.Cpp.

{
  UpdateData(TRUE);
  int a=m_PathNameCB.GetCurSel();
  CString str=(*m_pStrArray)[m_PathNameCB.GetCurSel()]->szFormatName;
  if (str.Left(10).CompareNoCase(_T("MULTICAST=")) == 0)
  {
    m_AdminPathNameCB.SetCurSel(-1);
  }
}

Member Data Documentation

CComboBox CSendMessageDialog::m_AdminPathNameCB

Definition at line 29 of file SendMDlg.h.

BOOL CSendMessageDialog::m_Authenticated

Definition at line 40 of file SendMDlg.h.

BYTE CSendMessageDialog::m_bPriority

Definition at line 33 of file SendMDlg.h.

BOOL CSendMessageDialog::m_DeadLetter

Definition at line 39 of file SendMDlg.h.

long CSendMessageDialog::m_dwTimeToBeReceived

Definition at line 43 of file SendMDlg.h.

long CSendMessageDialog::m_dwTimeToReachQueue

Definition at line 42 of file SendMDlg.h.

BOOL CSendMessageDialog::m_Encrypted

Definition at line 41 of file SendMDlg.h.

int CSendMessageDialog::m_iAck

Definition at line 34 of file SendMDlg.h.

int CSendMessageDialog::m_iDelivery

Definition at line 35 of file SendMDlg.h.

BOOL CSendMessageDialog::m_Journal

Definition at line 38 of file SendMDlg.h.

CComboBox CSendMessageDialog::m_PathNameCB

Definition at line 30 of file SendMDlg.h.

CArray<ARRAYQ*, ARRAYQ*>* CSendMessageDialog::m_pStrArray

Definition at line 47 of file SendMDlg.h.

CString CSendMessageDialog::m_strBody

Definition at line 31 of file SendMDlg.h.

CString CSendMessageDialog::m_strLabel

Definition at line 32 of file SendMDlg.h.

CString CSendMessageDialog::m_szAdminPathName

Definition at line 37 of file SendMDlg.h.

CString CSendMessageDialog::m_szPathName

Definition at line 36 of file SendMDlg.h.

The documentation for this class was generated from the following files:
  • NetDS/MessageQueuing/MqApiTst/SendMDlg.h
  • NetDS/MessageQueuing/MqApiTst/SendMDlg.Cpp
Generated on Wed Nov 13 2024 16:57:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSerialStream Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes

CSerialStream Class Reference

#include "SerStrm.Hxx"

List of all members.

Public Member Functions

CSerialStream ()
BOOL Eof ()
WCHAR | GetChar ()
void | Init (WCHAR *pwszFileName)
void | UnGetChar (WCHAR wch)

Private Member Functions

BOOL | IsUnicodeNumber (WCHAR *pwcInputBuf, unsigned uLen, WCHAR &wch)

Private Attributes

WCHAR | _awcReadAheadBuf [MAX_SPECIAL_CHAR_LENGTH]
unsigned | _cCharsReadAhead
BOOL _fUnGotChar
CMemoryMappedInputStream _mmInputStream
WCHAR * | _pCurChar
WCHAR | _wch

Static Private Attributes

static CSpecialCharHashTable | _specialCharHash

Detailed Description

Definition at line 30 of file SerStrm.Hxx.

Constructor & Destructor Documentation

CSerialStream::CSerialStream ( )

Definition at line 71 of file SerStrm.Cxx.

    : _wch(0),
      _fUnGotChar(FALSE),
      _cCharsReadAhead(0),
      _pCurChar(_awcReadAheadBuf)
{
}

Member Function Documentation

BOOL CSerialStream::Eof ( )

Definition at line 241 of file SerStrm.Cxx.

{
    if ( _fUnGotChar )
        return FALSE;

    if ( _pCurChar < _awcReadAheadBuf + _cCharsReadAhead )
        return FALSE;

    return _mmInputStream.Eof();
}

WCHAR CSerialStream::GetChar ( )

Definition at line 109 of file SerStrm.Cxx.

{
    //
    // Was a char pushed back into input ?
    //
    if ( _fUnGotChar )
    {
        _fUnGotChar = FALSE;
        return _wch;
    }

    //
    // Are there any chars in our read-ahead buffer ?
    //
    WCHAR wch;
    if ( _pCurChar < _awcReadAheadBuf + _cCharsReadAhead )
    {
        wch = *_pCurChar;
        _pCurChar++;

        return wch;
    }

    if ( _mmInputStream.Eof() )
        return WEOF;

    //
    // Read from input stream
    //
    wch = _mmInputStream.GetChar();
    if ( wch == 0xa || wch == 0xd )         // Replace newlines with spaces
        wch = L' ';

    if ( wch == L'&' )
    {
        //
        // Read in the special char until ';' or '&', or EOF, or until _awcReadAhead buffer is full
        //
        _awcReadAheadBuf[0] = wch;
        for ( unsigned i=1; i<MAX_SPECIAL_CHAR_LENGTH; i++)
        {
            if ( _mmInputStream.Eof() )
                break;

            wch = _mmInputStream.GetChar();
            if ( wch == 0xa || wch == 0xd )         // Replace newlines with spaces
                wch = L' ';

            _awcReadAheadBuf[i] = wch;
            if ( wch == L';' || wch == L'&' )
                break;
        }

        if ( wch == L';' )
        {
            if ( _awcReadAheadBuf[1] == L'#' && IsUnicodeNumber( &_awcReadAheadBuf[2], i-2, wch ) )
            {
                //
                // Return converted Unicode number, e.g. for &#160, return 160
                //
                return wch;
            }
            else if ( _specialCharHash.Lookup( &_awcReadAheadBuf[1], i-1, wch ) )
            {
                //
                // Corresponding Unicode char found
                //
                return wch;
            }
            else
            {
                _cCharsReadAhead = i+1;
                _pCurChar = &_awcReadAheadBuf[1];

                return L'&';
            }
        }
        else if ( wch == L'&' )
        {
            //
            // For example, &acu&aacute; . So keep &acu in the read ahead buffer,
            // but push the second '&' back into the input stream, so that &aacute;
            // can be recognized as a special char during a subsequent call to GetChar()
            //
            _mmInputStream.UnGetChar( L'&' );
            _cCharsReadAhead = i;
            _pCurChar = &_awcReadAheadBuf[1];

            return L'&';
        }
        else
        {
            _cCharsReadAhead = i;
            _pCurChar = &_awcReadAheadBuf[1];

            return L'&';
        }
    }
    else
        return wch;
}

void CSerialStream::Init ( WCHAR * pwszFileName )

Definition at line 91 of file SerStrm.Cxx.

{
    _mmInputStream.Init( pwszFileName );
}

BOOL CSerialStream::IsUnicodeNumber | ( | WCHAR * | pwcInputBuf,
 |  | unsigned | uLen,
 |  | WCHAR & | wch |
 | ) |  |  | [private]

Definition at line 269 of file SerStrm.Cxx.

{
    wch = 0;
    for ( unsigned i=0; i<uLen; i++ )
    {
        //
        // Check that the result will be less than max Unicode value, namely 0xffff
        //
        if ( iswdigit( pwcInputBuf[i] )
             && wch < (0xffff - (pwcInputBuf[i]-L'0'))/10 )
        {
            wch = 10 * wch + pwcInputBuf[i] - L'0';
        }
        else
            return FALSE;
    }

    if ( wch >= 0x80 && wch <= 0x9f )
    {
        //
        // Chars in the control code region are mapped by the browser to valid chars
        //

        wch = aControlCodeMap[wch-0x80];
    }

    return ( wch > 0 );
}

void CSerialStream::UnGetChar ( WCHAR wch )

Definition at line 222 of file SerStrm.Cxx.

{
    //
    // We can unget only one char at a time
    //
    Win4Assert( ! _fUnGotChar );

    _fUnGotChar = TRUE;
    _wch = wch;
}

Member Data Documentation

WCHAR CSerialStream::_awcReadAheadBuf[MAX_SPECIAL_CHAR_LENGTH] [private]

Definition at line 48 of file SerStrm.Hxx.

unsigned CSerialStream::_cCharsReadAhead [private]

Definition at line 49 of file SerStrm.Hxx.

BOOL CSerialStream::_fUnGotChar [private]

Definition at line 47 of file SerStrm.Hxx.

CMemoryMappedInputStream CSerialStream::_mmInputStream [private]

Definition at line 52 of file SerStrm.Hxx.

WCHAR* CSerialStream::_pCurChar [private]

Definition at line 50 of file SerStrm.Hxx.

CSpecialCharHashTable CSerialStream::_specialCharHash [static, private]

Definition at line 53 of file SerStrm.Hxx.

WCHAR CSerialStream::_wch [private]

Definition at line 46 of file SerStrm.Hxx.

The documentation for this class was generated from the following files:
  • WinBase/Indexing/IFilter/SerStrm.Hxx
  • WinBase/Indexing/IFilter/SerStrm.Cxx
Generated on Wed Nov 13 2024 16:57:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CServer Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Static Public Member Functions | Private Member Functions

CServer Class Reference

#include "DCOMServer.h"

Inherits CUnknown, and ITest.

List of all members.

Static Public Member Functions

static HRESULT _stdcall | CreateInstance (IUnknown *pUnknownOuter, CUnknown **ppNewComponent)
static CLSID | GetCLSID ()
static LPOLESTR | GetProgID ()

Private Member Functions

CServer (IUnknown *pUnknownOuter)
~CServer ()
virtual void __stdcall | FinalRelease ()
virtual HRESULT __stdcall | Init (const CFactoryData *pData)
virtual DECLARE_IUNKNOWN
HRESULT __stdcall 		NondelegatingQueryInterface (const IID &iid, void **ppv)
HRESULT __stdcall | Test1 (BSTR bstr)
HRESULT __stdcall | Test2 (BSTR bstrIn, BSTR *lpbstrOut)

Detailed Description

Definition at line 34 of file DCOMServer.h.

Constructor & Destructor Documentation

CServer::CServer ( IUnknown * pUnknownOuter ) [private]

Definition at line 33 of file DCOMServer.cpp.

                                       :
  CUnknown(pUnknownOuter, "CServer")
{
  DEBUGTRACE(_T("In CServer ctor"));
}

CServer::~CServer ( void ) [private]

Definition at line 42 of file DCOMServer.cpp.

{
  DEBUGTRACE(_T("In CServer dtor"));
}

Member Function Documentation

HRESULT CServer::CreateInstance | ( | IUnknown * | pUnknownOuter,
 |  | CUnknown ** | ppNewComponent |
 | ) |  |  | [static]

Definition at line 91 of file DCOMServer.cpp.

{
  *ppNewComponent = new CServer(pUnknownOuter) ;
  DEBUGTRACE(_T("In CServer::CreateInstance\n")) ;
  return S_OK ;
}

void __stdcall CServer::FinalRelease ( ) [private, virtual]

Definition at line 48 of file DCOMServer.cpp.

{
#if !defined(_DLL_SERVER_)
  if (CoReleaseServerProcess() == 0) // Last reference to server time to cleanup and exit
#if defined(_APARTMENT_)
    PostQuitMessage(0);
#else // Free Threaded
    SetEvent(g_CloseEvent);
#endif // _APARTMENT_
#endif // _DLL_SERVER_
  return;
}

static CLSID CServer::GetCLSID ( ) [inline, static]

Definition at line 93 of file DCOMServer.h.

{return g_clsid;}

static LPOLESTR CServer::GetProgID ( ) [inline, static]

Definition at line 92 of file DCOMServer.h.

{return g_progID;}

HRESULT __stdcall CServer::Init ( const CFactoryData * pData ) [private, virtual]

Definition at line 111 of file DCOMServer.cpp.

{
#if defined(_EVENTSINK_)
  CConnectionPointContainer::Init(g_EventIDs);
#endif

#if !defined(_DLL_SERVER_)
  CoAddRefServerProcess();
#endif // _DLL_SERVER_
  return S_OK ;
}

HRESULT __stdcall CServer::NondelegatingQueryInterface | ( | const IID & | iid,
 |  | void ** | ppv |
 | ) |  |  | [private, virtual]

Definition at line 63 of file DCOMServer.cpp.

{
  CHECKPOINTER(ppv);
#if defined(_ASYNC_COM_)
  if (iid == IID_ICallFactory)
  {
    return FinishQI(static_cast<LPCALLFACTORY>(this), iid, ppv);
  }
#endif //_ASYNC_COM_
  if (iid == IID_ITest)
  {
    return FinishQI(static_cast<LPTEST>(this), iid, ppv);
  }
#if defined(_EVENTSINK_)
  else if (iid == IID_IConnectionPointContainer)
  {
    return FinishQI(static_cast<LPCONNECTIONPOINTCONTAINER>(this), iid, ppv) ;
  }
#endif
  return CUnknown::NondelegatingQueryInterface(iid, ppv);
}

HRESULT __stdcall CServer::Test1 ( BSTR bstr ) [private]

Implements ITest.

Definition at line 164 of file DCOMServer.cpp.

{
  DEBUGTRACE(_T("In CServer::Test1:  string is = %S"), bstr);
  printf("In CServer::Test1:  string is = %S\n", bstr);
  printf("Send asynchronous signal to client\n");
#if defined(_EVENTSINK_)
  HRESULT hr = CConnectionPointContainer::GetConnectionPoint(IID_AppEvents)->SignalEvent();
  _ASSERT(SUCCEEDED(hr));
#endif
  printf("Leaving CServer::Test1\n");
  return SysReAllocString(&bstr, L"Good bye") != 0 ? S_OK : E_OUTOFMEMORY ;
}

HRESULT __stdcall CServer::Test2 | ( | BSTR | bstrIn,
 |  | BSTR * | lpbstrOut |
 | ) |  |  | [private]

Implements ITest.

Definition at line 179 of file DCOMServer.cpp.

{
  DEBUGTRACE(_T("In CServer::Test2:  string is = %S"), bstrIn);
  CHECKPOINTER(lpbstrOut);
  if (bstrIn)
    printf("In CServer::Test2:  string is = %S\n", bstrIn);
  *lpbstrOut = SysAllocString(L"Synchronous: Good bye");
  return S_OK;
}

The documentation for this class was generated from the following files:
  • Com/async/server/DCOMServer.h
  • Com/async/server/DCOMServer.cpp
  • Com/Fundamentals/TutSamp/AptServe/Server.Cpp
  • Com/Fundamentals/TutSamp/ConServe/Server.Cpp
  • Com/Fundamentals/TutSamp/DcdServe/Server.Cpp
  • Com/Fundamentals/TutSamp/DllServe/Server.Cpp
  • Com/Fundamentals/TutSamp/FreServe/Server.Cpp
  • Com/Fundamentals/TutSamp/LicServe/Server.Cpp
  • Com/Fundamentals/TutSamp/LocServe/Server.Cpp
  • Com/Fundamentals/TutSamp/PerDraw/Server.Cpp
  • Com/Fundamentals/TutSamp/PerServe/Server.Cpp
  • Com/Fundamentals/TutSamp/PerText/Server.Cpp
  • Com/Fundamentals/TutSamp/StoServe/Server.Cpp
Generated on Wed Nov 13 2024 16:57:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CServerDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions

CServerDlg Class Reference

#include "ServerDlg.h"

List of all members.

Public Types

enum | { IDD = IDD_SERVERDLG }

Public Member Functions

CServerDlg (CWnd *pParent=NULL)

Public Attributes

DWORD count
BOOL domainFlag
CEdit | m_domainName
CComboBox | m_serverList2
PWTS_SERVER_INFO | pServerInfo
CString serverName

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
afx_msg void | OnChangeDomainName ()
afx_msg void | OnDropdownServerList2 ()
virtual BOOL | OnInitDialog ()
virtual void | OnOK ()

Detailed Description

Definition at line 18 of file ServerDlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 32 of file ServerDlg.h.

{ IDD = IDD_SERVERDLG };

Constructor & Destructor Documentation

CServerDlg::CServerDlg ( CWnd * pParent = NULL )

Definition at line 24 of file ServerDlg.Cpp.

  : CDialog(CServerDlg::IDD, pParent)
{
  //{{AFX_DATA_INIT(CServerDlg)
  //}}AFX_DATA_INIT
}

Member Function Documentation

void CServerDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 32 of file ServerDlg.Cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CServerDlg)
  DDX_Control(pDX, IDC_SERVER_LIST2, m_serverList2);
  DDX_Control(pDX, IDC_DOMAIN_NAME, m_domainName);
  //}}AFX_DATA_MAP
}

void CServerDlg::OnChangeDomainName ( ) [protected]

Definition at line 105 of file ServerDlg.Cpp.

{
  domainFlag = FALSE;
}

void CServerDlg::OnDropdownServerList2 ( ) [protected]

Definition at line 75 of file ServerDlg.Cpp.

{
  CString dname;
  m_domainName.GetWindowText(dname);

  if (dname == "")
    AfxMessageBox("Please enter a domain name.");
  else
    {
  if (domainFlag == FALSE) {
    m_serverList2.ResetContent();
    if (!WTSEnumerateServers((TCHAR *)LPCTSTR (dname),
      0, 1, &pServerInfo, &count))
    AfxMessageBox("Unable to enumerate servers");
    PWTS_SERVER_INFO pServer = pServerInfo;
    for (DWORD i=0; i < count; i++)
    {
      m_serverList2.AddString(pServer->pServerName);
      pServer++;
    }
    domainFlag = TRUE;
  }
    /*m_serverList2.AddString("purple");
    m_serverList2.AddString("blue");
    m_serverList2.AddString("red");
    m_serverList2.AddString("orange");
    m_serverList2.AddString("yellow");*/
  }
}

BOOL CServerDlg::OnInitDialog ( void ) [protected, virtual]

Definition at line 53 of file ServerDlg.Cpp.

{
  CDialog::OnInitDialog();
  m_domainName.SetWindowText("TEST");
  domainFlag = FALSE;
  return TRUE;
}

void CServerDlg::OnOK ( ) [protected, virtual]

Definition at line 61 of file ServerDlg.Cpp.

{
  //int nIndex = m_serverList2.GetCurSel();
  //if (nIndex != LB_ERR)
  //  m_serverList2.GetLBText(nIndex, serverName);

  WTSFreeMemory(&pServerInfo);
  m_serverList2.GetWindowText( serverName);
  //AfxMessageBox(serverName);
  g_pDoc->SetServerName( (TCHAR *) LPCTSTR(serverName));

  CDialog::OnOK();
}

Member Data Documentation

DWORD CServerDlg::count

Definition at line 24 of file ServerDlg.h.

BOOL CServerDlg::domainFlag

Definition at line 22 of file ServerDlg.h.

CEdit CServerDlg::m_domainName

Definition at line 34 of file ServerDlg.h.

CComboBox CServerDlg::m_serverList2

Definition at line 33 of file ServerDlg.h.

PWTS_SERVER_INFO CServerDlg::pServerInfo

Definition at line 25 of file ServerDlg.h.

CString CServerDlg::serverName

Definition at line 23 of file ServerDlg.h.

The documentation for this class was generated from the following files:
  • WinBase/WtsApi/WtsApi/ServerDlg.h
  • WinBase/WtsApi/WtsApi/ServerDlg.Cpp
Generated on Wed Nov 13 2024 16:57:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CServiceCallback Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Private Attributes

CServiceCallback Class Reference

#include "genericucpdlg.h"

List of all members.

Public Member Functions

CServiceCallback ()
~CServiceCallback ()
STDMETHOD() | ServiceInstanceDied (IUPnPService *pus)
void | SetDialogPointer (CGenericUCPDlg *pDialog)
STDMETHOD() | StateVariableChanged (IUPnPService *pus, LPCWSTR pcwszStateVarName, VARIANT varValue)

Static Public Member Functions

static CServiceCallback * | Create ()

Private Attributes

CGenericUCPDlg * m_pGenericUCPDlg

Detailed Description

Definition at line 52 of file genericucpdlg.h.

Constructor & Destructor Documentation

CServiceCallback::CServiceCallback ( ) [inline]

Definition at line 60 of file genericucpdlg.h.

{};

CServiceCallback::~CServiceCallback ( ) [inline]

Definition at line 61 of file genericucpdlg.h.

{};

Member Function Documentation

CServiceCallback * CServiceCallback::Create ( void ) [static]

Definition at line 1965 of file GenericUCPDlg.cpp.

{
    CComObject<CServiceCallback> * pCallback = NULL;
    pCallback->CreateInstance(&pCallback);
    pCallback->GetUnknown()->AddRef();
    return pCallback;
}

HRESULT CServiceCallback::ServiceInstanceDied ( IUPnPService * pus )

Definition at line 2055 of file GenericUCPDlg.cpp.

{
  HRESULT hr=S_OK;
  TCHAR tszMessage[DATA_BUFSIZE];
  TRACE(_T("Service instance died\n"));

  BSTR bstrServiceId = NULL;
  hr = pus->get_Id(&bstrServiceId);
  if(SUCCEEDED(hr)){
    _sntprintf(tszMessage, DATA_BUFSIZE-1, _T("Service %S died"),bstrServiceId);
    m_pGenericUCPDlg->m_EventText.SetWindowText(tszMessage);
    SysFreeString(bstrServiceId);
  }
  else{
    PrintErrorText(hr);
    m_pGenericUCPDlg->m_StatusText.SetWindowText(_T("Error: ServiceId failed"));
  }
  return hr;
}

void CServiceCallback::SetDialogPointer ( CGenericUCPDlg * pDialog )

Definition at line 1988 of file GenericUCPDlg.cpp.

                                                              {
  m_pGenericUCPDlg=pDialog;
}

HRESULT CServiceCallback::StateVariableChanged | ( | IUPnPService * | pus,
 |  | LPCWSTR | pcwszStateVarName,
 |  | VARIANT | varValue
 | ) |  |

Definition at line 2008 of file GenericUCPDlg.cpp.

{
  HRESULT hr = S_OK;
  TCHAR tszMessage[DATA_BUFSIZE];
  TRACE(_T("State Variable Changed\n"));

  BSTR bstrServiceId = NULL;
  hr = pus->get_Id(&bstrServiceId);
  if(SUCCEEDED(hr)){
    TCHAR tszServiceId[DATA_BUFSIZE];
    _sntprintf(tszServiceId, DATA_BUFSIZE-1, _T("%S"), bstrServiceId);
    SysFreeString(bstrServiceId);
    hr=VariantChangeType(&varValue, &varValue, VARIANT_ALPHABOOL, VT_BSTR);
    if(SUCCEEDED(hr)){
      _sntprintf(tszMessage, DATA_BUFSIZE-1,_T("State variable %S changed to %S in %S"),pcwszStateVarName, varValue.bstrVal, bstrServiceId);
      Sleep(350);
      m_pGenericUCPDlg->m_EventText.SetWindowText(tszMessage);
    }
    else{
      PrintErrorText(hr);
    }
  }
  else{
    PrintErrorText(hr);
    m_pGenericUCPDlg->m_StatusText.SetWindowText(_T("Error: ServiceId failed"));
  }
  return hr;
}

Member Data Documentation

CGenericUCPDlg* CServiceCallback::m_pGenericUCPDlg [private]

Definition at line 57 of file genericucpdlg.h.

The documentation for this class was generated from the following files:
  • NetDS/upnp/GenericUCP/CPP/genericucpdlg.h
  • NetDS/upnp/GenericUCP/CPP/GenericUCPDlg.cpp
Generated on Wed Nov 13 2024 16:57:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CServiceComp Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CServiceComp Class Reference

#include "cdatalinks.h"

Inherits CBase.

List of all members.

Public Member Functions

CServiceComp (CMainWindow *pCMainWindow)
virtual | ~CServiceComp ()
virtual HRESULT | AutoQI (DWORD dwCreateOpts)
virtual HRESULT | AutoRelease ()
virtual HRESULT | ConnectFromFile (WCHAR *pwszInitString)
virtual HRESULT | Create (CBase *pCSource, DWORD dwCSLCTX=CLSCTX_INPROC_SERVER, WCHAR *pwszRemoteServer=NULL)
virtual HRESULT | CreateDBInstance (REFCLSID clsid, CAggregate *pCAggregate, DWORD dwCLSCTX, REFIID riid, IUnknown **ppIUnknown)
virtual HRESULT | GetDataSource (CAggregate *pCAggregate, DWORD dwCLSCTX, WCHAR *pwszInitString, REFIID riid, IUnknown **ppIUnknown)
virtual REFIID | GetDefaultInterface ()
virtual HRESULT | GetInitString (IUnknown *pIUnknown, boolean fIncludePassword, WCHAR **ppwszInitString)
virtual IUnknown ** | GetInterfaceAddress (REFIID riid)
virtual LONG | GetObjectImage ()
virtual UINT | GetObjectMenu ()
virtual WCHAR * | GetObjectName ()
virtual HRESULT | LoadInitString (WCHAR *pwszFileName, WCHAR **pwszInitString=NULL)
virtual void | OnDefOperation ()
virtual HRESULT | SaveInitString (WCHAR *pwszFileName, WCHAR *pwszInitString, DWORD dwCreateOpts=CREATE_ALWAYS)

Public Attributes

IDataInitialize * | m_pIDataInitialize
WCHAR * | m_pwszInitString

Detailed Description

Definition at line 27 of file cdatalinks.h.

Constructor & Destructor Documentation

CServiceComp::CServiceComp ( CMainWindow * pCMainWindow )

Definition at line 22 of file cdatalinks.cpp.

  : CBase(eCServiceComp, pCMainWindow, NULL)
{
  //OLE DB Interfaces
  m_pIDataInitialize      = NULL;   //DataLink interface

  //Data
  m_pwszInitString      = NULL;
  GetRegEnumValue(HKEY_ROWSETVIEWER, wszRECENTINITSTRING_KEY, 0,  &m_pwszInitString);
}

CServiceComp::~CServiceComp ( ) [virtual]

Definition at line 38 of file cdatalinks.cpp.

{
  ReleaseObject(0);

  //ServiceComponents
  DelRegEntry(HKEY_ROWSETVIEWER, wszRECENTINITSTRING_KEY);
  SetRegEntry(HKEY_ROWSETVIEWER, wszRECENTINITSTRING_KEY, m_pwszInitString, L"");

  SAFE_FREE(m_pwszInitString);
}

Member Function Documentation

HRESULT CServiceComp::AutoQI ( DWORD dwCreateOpts ) [virtual]

Implements CBase.

Definition at line 82 of file cdatalinks.cpp.

{
  //Delegate First so we have base interfaces
  CBase::AutoQI(dwCreateOpts);

  //[MANDATORY]
  if(dwCreateOpts & CREATE_QI_MANDATORY)
  {
    OBTAIN_INTERFACE(IDataInitialize);

  }

  //[OPTIONAL]
  if(dwCreateOpts & CREATE_QI_OPTIONAL)
  {
  }

  return S_OK;
}

HRESULT CServiceComp::AutoRelease ( ) [virtual]

Implements CBase.

Definition at line 67 of file cdatalinks.cpp.

{
  //OLE DB Interfaces
  RELEASE_INTERFACE(IDataInitialize);

  //Delegate
  return CBase::AutoRelease();
}

HRESULT CServiceComp::ConnectFromFile ( WCHAR * pwszInitString ) [virtual]

Definition at line 273 of file cdatalinks.cpp.

{
  HRESULT hr = S_OK;
  WCHAR* pwszInitString = NULL;
  CComPtr<IUnknown> spUnknown;

  //No-op
  if(pwszSelectedFile == NULL)
    return E_FAIL;

  //Load the saved InitString from the SelectedFile
  TESTC(hr = LoadInitString(pwszSelectedFile, &pwszInitString));

  //Delegate - Now that we have the InitString
  TESTC(hr = GetDataSource(NULL, GetOptions()->m_dwCLSCTX, pwszInitString, IID_IUnknown, &spUnknown));

  //Update the Saved Files (now that successfuly connected)
  m_pCMainWindow->m_pCFullConnect->AddRecentFile(pwszSelectedFile);

  //Handle the returned object...
  //NOTE: Can pontentially return other object types: (ie: CREATE_DETERMINE_TYPE)
  if(!m_pCMainWindow->HandleObjectType(this, spUnknown, IID_IUnknown, eCDataSource, 0, NULL, CREATE_NEWWINDOW | CREATE_DETERMINE_TYPE | GetOptions()->m_dwCreateOpts))
    TESTC(hr = E_FAIL);

CLEANUP:
  SAFE_FREE(pwszInitString);
  return hr;
}

HRESULT CServiceComp::Create | ( | CBase * | pCSource,
 |  | DWORD | dwCSLCTX = CLSCTX_INPROC_SERVER,
 |  | WCHAR * | pwszRemoteServer = NULL |
 | ) |  |  | [virtual]

Definition at line 107 of file cdatalinks.cpp.

{
  HRESULT   hr = S_OK;
  CComPtr<IUnknown> spUnknown;

  //CLSID_MSDAINITIALIZE
  XTESTC(hr = m_pCMainWindow->m_pCRootEnumerator->CreateInstance(NULL, CLSID_MSDAINITIALIZE, dwCSLCTX, IID_IUnknown, &spUnknown, pwszRemoteServer));

  //Delegate
  TESTC(hr = CBase::CreateObject(pCSource, IID_IUnknown, spUnknown));

CLEANUP:
  return hr;
}

HRESULT CServiceComp::CreateDBInstance | ( | REFCLSID | clsid,
 |  | CAggregate * | pCAggregate,
 |  | DWORD | dwCLSCTX,
 |  | REFIID | riid,
 |  | IUnknown ** | ppIUnknown |
 | ) |  |  | [virtual]

Definition at line 139 of file cdatalinks.cpp.

{
  HRESULT hr      = E_FAIL;

  //CLSID to String (just for display purposes...)
  WCHAR* pwszProgID = GetProgID(clsid);

  //Defferred Creation
  if(!m_pIUnknown)
    TESTC(hr = Create(NULL));

  if(m_pIDataInitialize)
  {
    //Now Obtain Instance of Provider (with Service Components)
    XTEST(hr = m_pIDataInitialize->CreateDBInstance(clsid, pCAggregate, dwCLSCTX, L"pwszReserved", riid, ppIUnknown));
    TESTC(TRACE_METHOD(hr, L"IDataInitialize::CreateDBInstance(%s, 0x%p, 0x%08x, \"pwszReserved\", %s, &0x%p)", pwszProgID, pCAggregate, dwCLSCTX, GetInterfaceName(riid), ppIUnknown ? *ppIUnknown : NULL));

    //Handle Aggregation
    if(pCAggregate)
      TESTC(hr = pCAggregate->HandleAggregation(riid, ppIUnknown));
  }

CLEANUP:
  SAFE_FREE(pwszProgID);
  return hr;
}

HRESULT CServiceComp::GetDataSource | ( | CAggregate * | pCAggregate,
 |  | DWORD | dwCLSCTX,
 |  | WCHAR * | pwszInitString,
 |  | REFIID | riid,
 |  | IUnknown ** | ppIUnknown |
 | ) |  |  | [virtual]

Definition at line 171 of file cdatalinks.cpp.

{
  HRESULT hr      = E_FAIL;

  //Defferred Creation
  if(!m_pIUnknown)
    TESTC(hr = Create(NULL));

  if(m_pIDataInitialize)
  {
    //GetDataSource based upoon the InitString
    XTEST(hr = m_pIDataInitialize->GetDataSource(pCAggregate, dwCLSCTX, pwszInitString, riid, ppIUnknown));
    TESTC(TRACE_METHOD(hr, L"IDataInitialize::GetDataSource(0x%p, 0x%08x, \"%s\", %s, &0x%p)", pCAggregate, GetOptions()->m_dwCLSCTX, pwszInitString, GetInterfaceName(riid), ppIUnknown ? *ppIUnknown : NULL));

    //Handle Aggregation
    if(pCAggregate)
      TESTC(hr = pCAggregate->HandleAggregation(riid, ppIUnknown));
  }

CLEANUP:
  return hr;
}

virtual REFIID CServiceComp::GetDefaultInterface ( ) [inline, virtual]

Implements CBase.

Definition at line 43 of file cdatalinks.h.

{ return IID_IDataInitialize; }

HRESULT CServiceComp::GetInitString | ( | IUnknown * | pIUnknown,
 |  | boolean | fIncludePassword,
 |  | WCHAR ** | ppwszInitString |
 | ) |  |  | [virtual]

Definition at line 199 of file cdatalinks.cpp.

{
  HRESULT hr        = E_FAIL;

  //Defferred Creation
  if(!m_pIUnknown)
    TESTC(hr = Create(NULL));

  if(m_pIDataInitialize)
  {
    //GetInitializationString
    XTEST(hr = m_pIDataInitialize->GetInitializationString(pIUnknown, fIncludePassword, ppwszInitString));
    TESTC(TRACE_METHOD(hr, L"IDataInitialize::GetInitializationString(0x%p, %s, &\"%s\")", pIUnknown, fIncludePassword ? L"True" : L"False", ppwszInitString ? *ppwszInitString : NULL));
  }

CLEANUP:
  return hr;
}

IUnknown ** CServiceComp::GetInterfaceAddress ( REFIID riid ) [virtual]

Implements CBase.

Definition at line 54 of file cdatalinks.cpp.

{
  HANDLE_GETINTERFACE(IDataInitialize);

  //Otherwise delegate
  return CBase::GetInterfaceAddress(riid);
}

virtual LONG CServiceComp::GetObjectImage ( ) [inline, virtual]

Implements CBase.

Definition at line 42 of file cdatalinks.h.

{ return IMAGE_SERVICECOMP;   }

virtual UINT CServiceComp::GetObjectMenu ( ) [inline, virtual]

Implements CBase.

Definition at line 41 of file cdatalinks.h.

{ return IDM_SERVICECOMPMENU; }

virtual WCHAR* CServiceComp::GetObjectName ( ) [inline, virtual]

Implements CBase.

Definition at line 40 of file cdatalinks.h.

{ return L"Service Components"; }

HRESULT CServiceComp::LoadInitString | ( | WCHAR * | pwszFileName,
 |  | WCHAR ** | pwszInitString = NULL |
 | ) |  |  | [virtual]

Definition at line 248 of file cdatalinks.cpp.

{
  HRESULT hr        = E_FAIL;

  //Defferred Creation
  if(!m_pIUnknown)
    TESTC(hr = Create(NULL));

  if(m_pIDataInitialize)
  {
    //LoadStringFromStorage
    XTEST(hr = m_pIDataInitialize->LoadStringFromStorage(pwszFileName, ppwszInitString));
    TESTC(TRACE_METHOD(hr, L"IDataInitialize::LoadStringFromStorage(\"%s\", &\"%s\")", pwszFileName, ppwszInitString ? *ppwszInitString : NULL));
  }

CLEANUP:
  return hr;
}

void CServiceComp::OnDefOperation ( ) [virtual]

Reimplemented from CBase.

Definition at line 127 of file cdatalinks.cpp.

{
  //Need to bring up the GetDataSource Dialog
  if(m_pIDataInitialize)
    m_pCMainWindow->DisplayDialog(IDD_DATAINIT_GETDATASOURCE, GetFocus(), CMainWindow::GetDataSourceProc, this);
}

HRESULT CServiceComp::SaveInitString | ( | WCHAR * | pwszFileName,
 |  | WCHAR * | pwszInitString,
 |  | DWORD | dwCreateOpts = CREATE_ALWAYS |
 | ) |  |  | [virtual]

Definition at line 224 of file cdatalinks.cpp.

{
  HRESULT hr      = E_FAIL;

  //Defferred Creation
  if(!m_pIUnknown)
    TESTC(hr = Create(NULL));

  if(m_pIDataInitialize)
  {
    //WriteStringToStorage
    XTEST(hr = m_pIDataInitialize->WriteStringToStorage(pwszFileName, pwszInitString, dwCreateOpts));
    TESTC(TRACE_METHOD(hr, L"IDataInitialize::WriteStringToStorage(\"%s\", \"%s\", 0x%08x)", pwszFileName, pwszInitString, dwCreateOpts));
  }

CLEANUP:
  return hr;
}

Member Data Documentation

IDataInitialize* CServiceComp::m_pIDataInitialize

Definition at line 65 of file cdatalinks.h.

WCHAR* CServiceComp::m_pwszInitString

Definition at line 61 of file cdatalinks.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdatalinks.h
  • Dataaccess/oledb/rowsetviewer/cdatalinks.cpp
Generated on Wed Nov 13 2024 16:57:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSession Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CSession Class Reference

#include "csession.h"

Inherits CAsynchBase.

List of all members.

Public Member Functions

CSession (CMainWindow *pCMainWindow, CMDIChild *pCMDIChild=NULL)
virtual | ~CSession ()
virtual HRESULT | AutoQI (DWORD dwCreateOpts)
virtual HRESULT | AutoRelease ()
virtual HRESULT | CreateCommand (CAggregate *pCAggregate, REFIID riid, IUnknown **ppIUnknown)
virtual HRESULT | GetDataSource (REFIID riid, IUnknown **ppIUnknown)
virtual REFIID | GetDefaultInterface ()
virtual IUnknown ** | GetInterfaceAddress (REFIID riid)
virtual LONG | GetObjectImage ()
virtual UINT | GetObjectMenu ()
virtual WCHAR * | GetObjectName ()
virtual HRESULT | GetProviderTypes ()
virtual HRESULT | GetSchemaRowset (CAggregate *pCAggregate, REFGUID guidSchema, ULONG cRestrictions, VARIANT *rgRestrictions, REFIID riid, ULONG cPropSets, DBPROPSET *rgPropSets, IUnknown **ppIUnknown)
virtual HRESULT | OpenRowset (CAggregate *pCAggregate, DBID *pTableID, DBID *pIndexID, REFIID riid, ULONG cPropSets, DBPROPSET *rgPropSets, IUnknown **ppIUnknown)

Public Attributes

ULONG m_cProvTypes
CList< CPropSets *, CPropSets * > m_listCPropSets
IAlterIndex * | m_pIAlterIndex
IAlterTable * | m_pIAlterTable
IBindResource * | m_pIBindResource
ICreateRow * | m_pICreateRow
IDBCreateCommand * | m_pIDBCreateCommand
IDBSchemaRowset * | m_pIDBSchemaRowset
IGetDataSource * | m_pIGetDataSource
IIndexDefinition * | m_pIIndexDefinition
IOpenRowset * | m_pIOpenRowset
ISessionProperties * | m_pISessionProperties
ITableDefinition * | m_pITableDefinition
ITableDefinitionWithConstraints * | m_pITableDefinitionWithConstraints
ITransaction * | m_pITransaction
ITransactionJoin * | m_pITransactionJoin
ITransactionLocal * | m_pITransactionLocal
ITransactionObject * | m_pITransactionObject
PROVTYPEINFO * m_rgProvTypes

Detailed Description

Definition at line 39 of file csession.h.

Constructor & Destructor Documentation

CSession::CSession | ( | CMainWindow * | pCMainWindow,
 |  | CMDIChild * | pCMDIChild = NULL
 | ) |  |

Definition at line 22 of file csession.cpp.

  : CAsynchBase(eCSession, pCMainWindow, pCMDIChild)
{
  //OLE DB Interfaces
  m_pIGetDataSource   = NULL;   //Session interface
  m_pIOpenRowset      = NULL;   //Session interface
  m_pISessionProperties = NULL;   //Session interface
  m_pIDBCreateCommand   = NULL;   //Session interface
  m_pIDBSchemaRowset    = NULL;   //Session interface
  m_pIIndexDefinition   = NULL;   //Session interface
  m_pIAlterIndex      = NULL;   //Session interface
  m_pIAlterTable      = NULL;   //Session interface
  m_pITableDefinition   = NULL;   //Session interface
  m_pITableDefinitionWithConstraints  = NULL;   //Session interface

  m_pITransaction     = NULL;   //Session interface
  m_pITransactionLocal  = NULL;   //Session interface
  m_pITransactionJoin   = NULL;   //Session interface
  m_pITransactionObject = NULL;   //Session interface

  m_pIBindResource    = NULL;   //Session interface
  m_pICreateRow     = NULL;   //Session interface

  m_cProvTypes      = 0;  // for native type names
  m_rgProvTypes     = NULL;
}

CSession::~CSession ( ) [virtual]

Definition at line 54 of file csession.cpp.

{
  ReleaseObject(0);

  //Objects
  m_listCPropSets.RemoveAll();
}

Member Function Documentation

HRESULT CSession::AutoQI ( DWORD dwCreateOpts ) [virtual]

Reimplemented from CAsynchBase.

Definition at line 125 of file csession.cpp.

{
  //Delegate First so we have base interfaces
  CAsynchBase::AutoQI(dwCreateOpts);

  //[MANDATORY]
  if(dwCreateOpts & CREATE_QI_MANDATORY)
  {
    OBTAIN_INTERFACE(IOpenRowset);
    OBTAIN_INTERFACE(IGetDataSource);
    OBTAIN_INTERFACE(ISessionProperties);
  }

  //AutoQI
  if(dwCreateOpts & CREATE_QI_OPTIONAL)
  {
    //[OPTIONAL]
    OBTAIN_INTERFACE(IDBCreateCommand);
    OBTAIN_INTERFACE(IDBSchemaRowset);
    OBTAIN_INTERFACE(IIndexDefinition);
    OBTAIN_INTERFACE(IAlterIndex);
    OBTAIN_INTERFACE(IAlterTable);
    OBTAIN_INTERFACE(ITableDefinition);
    OBTAIN_INTERFACE(ITableDefinitionWithConstraints);
    OBTAIN_INTERFACE(ITransaction);
    OBTAIN_INTERFACE(ITransactionLocal);
    OBTAIN_INTERFACE(ITransactionObject);
    OBTAIN_INTERFACE(ITransactionJoin);

    OBTAIN_INTERFACE(IBindResource);
    OBTAIN_INTERFACE(ICreateRow);
  }

  return S_OK;
}

HRESULT CSession::AutoRelease ( ) [virtual]

Reimplemented from CAsynchBase.

Definition at line 95 of file csession.cpp.

{
  //Session
  RELEASE_INTERFACE(IGetDataSource);
  RELEASE_INTERFACE(IOpenRowset);
  RELEASE_INTERFACE(ISessionProperties);
  RELEASE_INTERFACE(IDBCreateCommand);
  RELEASE_INTERFACE(IDBSchemaRowset);
  RELEASE_INTERFACE(IIndexDefinition);
  RELEASE_INTERFACE(IAlterIndex);
  RELEASE_INTERFACE(IAlterTable);
  RELEASE_INTERFACE(ITableDefinition);
  RELEASE_INTERFACE(ITableDefinitionWithConstraints);
  RELEASE_INTERFACE(ITransaction);
  RELEASE_INTERFACE(ITransactionLocal);
  RELEASE_INTERFACE(ITransactionObject);
  RELEASE_INTERFACE(ITransactionJoin);

  RELEASE_INTERFACE(IBindResource);
  RELEASE_INTERFACE(ICreateRow);

  //Delegate
  return CAsynchBase::AutoRelease();
}

HRESULT CSession::CreateCommand | ( | CAggregate * | pCAggregate,
 |  | REFIID | riid,
 |  | IUnknown ** | ppIUnknown |
 | ) |  |  | [virtual]

Definition at line 166 of file csession.cpp.

{
  HRESULT       hr = S_OK;

  //Obtain the IDBCreateCommand Interface
  IDBCreateCommand* pIDBCreateCommand = SOURCE_GETINTERFACE(this, IDBCreateCommand);
  if(pIDBCreateCommand)
  {
    //CreateCommand
    XTEST(hr = pIDBCreateCommand->CreateCommand(pCAggregate, riid, ppIUnknown));
    TESTC(TRACE_METHOD(hr, L"IDBCreateCommand::CreateCommand(0x%p, %s, &0x%p)", pCAggregate, GetInterfaceName(riid), ppIUnknown ? *ppIUnknown : NULL));

    //Handle Aggregation
    if(pCAggregate)
      TESTC(hr = pCAggregate->HandleAggregation(riid, ppIUnknown));
  }

CLEANUP:
  return hr;
}

HRESULT CSession::GetDataSource | ( | REFIID | riid,
 |  | IUnknown ** | ppIUnknown |
 | ) |  |  | [virtual]

Definition at line 192 of file csession.cpp.

{
  HRESULT   hr = S_OK;

  //This interface is required to continue...
  if(m_pIGetDataSource)
  {
    //IGetDataSource::GetDataSource
    XTEST(hr = m_pIGetDataSource->GetDataSource(riid, ppIUnknown));
    TESTC(TRACE_METHOD(hr, L"IGetDataSource::GetDataSource(%s, &0x%p)", GetInterfaceName(riid), ppIUnknown ? *ppIUnknown : NULL));
  }

CLEANUP:
  return hr;
}

virtual REFIID CSession::GetDefaultInterface ( ) [inline, virtual]

Implements CBase.

Definition at line 55 of file csession.h.

{ return IID_IOpenRowset; }

IUnknown ** CSession::GetInterfaceAddress ( REFIID riid ) [virtual]

Reimplemented from CAsynchBase.

Definition at line 67 of file csession.cpp.

{
  HANDLE_GETINTERFACE(IGetDataSource);
  HANDLE_GETINTERFACE(IOpenRowset);
  HANDLE_GETINTERFACE(ISessionProperties);
  HANDLE_GETINTERFACE(IDBCreateCommand);
  HANDLE_GETINTERFACE(IDBSchemaRowset);
  HANDLE_GETINTERFACE(IIndexDefinition);
  HANDLE_GETINTERFACE(IAlterIndex);
  HANDLE_GETINTERFACE(IAlterTable);
  HANDLE_GETINTERFACE(ITableDefinition);
  HANDLE_GETINTERFACE(ITableDefinitionWithConstraints);
  HANDLE_GETINTERFACE(ITransaction);
  HANDLE_GETINTERFACE(ITransactionLocal);
  HANDLE_GETINTERFACE(ITransactionJoin);
  HANDLE_GETINTERFACE(ITransactionObject);
  HANDLE_GETINTERFACE(IBindResource);
  HANDLE_GETINTERFACE(ICreateRow);

  //Otherwise delegate
  return CAsynchBase::GetInterfaceAddress(riid);
}

virtual LONG CSession::GetObjectImage ( ) [inline, virtual]

Implements CBase.

Definition at line 54 of file csession.h.

{ return IMAGE_SESSION;   }

virtual UINT CSession::GetObjectMenu ( ) [inline, virtual]

Implements CBase.

Definition at line 53 of file csession.h.

{ return IDM_SESSIONMENU; }

virtual WCHAR* CSession::GetObjectName ( ) [inline, virtual]

Implements CBase.

Definition at line 52 of file csession.h.

{ return L"Session";    }

HRESULT CSession::GetProviderTypes ( ) [virtual]

Definition at line 300 of file csession.cpp.

{
  HRESULT     hr  = S_OK;

  HROW rghRows[MAX_BLOCK_SIZE];
  HROW* phRows = rghRows;
  DBCOUNTITEM cRowsObtained = 0;
  CComPtr<IUnknown> spUnknown;
  CRowset cRowset(m_pCMainWindow);
  HACCESSOR hAccessor = DB_NULL_HACCESSOR;

  //Setup the Bindings
  const static DBCOUNTITEM cBindings = 4;
  const static DBBINDING rgBindings[cBindings] =
    {
      1,
      offsetof(PROVTYPEINFO, wszTypeName),
      0,
      0,
      NULL,
      NULL,
      NULL,
      DBPART_VALUE,
      DBMEMOWNER_CLIENTOWNED,
      DBPARAMIO_NOTPARAM,
      MAX_NAME_LEN,
      0,
      DBTYPE_WSTR,
      0,
      0,

      2,
      offsetof(PROVTYPEINFO, wType),
      0,
      0,
      NULL,
      NULL,
      NULL,
      DBPART_VALUE,
      DBMEMOWNER_CLIENTOWNED,
      DBPARAMIO_NOTPARAM,
      sizeof(DBTYPE),
      0,
      DBTYPE_UI2,
      0,
      0,

      3,
      offsetof(PROVTYPEINFO, ulColumnSize),
      0,
      0,
      NULL,
      NULL,
      NULL,
      DBPART_VALUE,
      DBMEMOWNER_CLIENTOWNED,
      DBPARAMIO_NOTPARAM,
      sizeof(DBLENGTH), //TODO64: So is this schema going to be updated to allow for more than 4gig size?
      0,
      DBTYPE_UI4,     //TODO64: Sure would be nice to have defined type that toggels for the OS?
      0,
      0,

      15,
      offsetof(PROVTYPEINFO, iMaxScale),
      0,
      0,
      NULL,
      NULL,
      NULL,
      DBPART_VALUE,
      DBMEMOWNER_CLIENTOWNED,
      DBPARAMIO_NOTPARAM,
      sizeof(SHORT),
      0,
      DBTYPE_I2,
      0,
      0,
    };

  //IDBSchemaRowset is optional
  //Only need to obtain this info once, so if already done, just exit
  if(m_pIDBSchemaRowset == NULL || m_cProvTypes != 0)
    goto CLEANUP;

  //PROVIDER_TYPES Rowset (is required if Schemas are supported)
  TESTC(hr = GetSchemaRowset(NULL, DBSCHEMA_PROVIDER_TYPES, 0, NULL, IID_IUnknown, 0, NULL, &spUnknown));
  TESTC(hr = cRowset.CreateObject(this, IID_IUnknown, spUnknown));

  //IAccessor::CreateAccessor
  TESTC(hr = cRowset.CreateAccessor(DBACCESSOR_ROWDATA, cBindings, (DBBINDING*)rgBindings, 0, &hAccessor));

  //Loop through the entire returned rowset
  while(TRUE)
  {
    TESTC(hr = cRowset.GetNextRows(0, MAX_BLOCK_SIZE, &cRowsObtained, &phRows));

    //ENDOFROWSET
    if(cRowsObtained==0)
      break;

    //Alloc room for ProviderInfo (in chunks)
    SAFE_REALLOC(m_rgProvTypes, PROVTYPEINFO, m_cProvTypes + cRowsObtained);
    memset(&m_rgProvTypes[m_cProvTypes], 0, sizeof(PROVTYPEINFO) * (size_t)cRowsObtained);

    //Loop over rows obtained and get ProviderInfo
    for(ULONG i=0; i<cRowsObtained; i++)
    {
      //Get the Data
      TESTC(hr = cRowset.GetData(rghRows[i], hAccessor, (void*)&m_rgProvTypes[m_cProvTypes]));
      m_cProvTypes++;
    }

    //Release all the rows
    TESTC(hr = cRowset.ReleaseRows(cRowsObtained, rghRows));
  }

CLEANUP:
  cRowset.ReleaseAccessor(&hAccessor);
  return hr;
}

HRESULT CSession::GetSchemaRowset | ( | CAggregate * | pCAggregate,
 |  | REFGUID | guidSchema,
 |  | ULONG | cRestrictions,
 |  | VARIANT * | rgRestrictions,
 |  | REFIID | riid,
 |  | ULONG | cPropSets,
 |  | DBPROPSET * | rgPropSets,
 |  | IUnknown ** | ppIUnknown |
 | ) |  |  | [virtual]

Definition at line 254 of file csession.cpp.

{
  HRESULT hr = S_OK;
  if(!m_pIDBSchemaRowset)
    return E_FAIL;

  //Schema Rowset
  WCHAR wszBuffer[MAX_NAME_LEN+1];
  WCHAR* pwszSchemaName = GetSchemaName(guidSchema);

  //Try to find the String Resprentation of the guidSchema
  if(pwszSchemaName == NULL)
  {
    StringFromGUID2(guidSchema, wszBuffer, MAX_NAME_LEN);
    pwszSchemaName = wszBuffer;
  }

  //GetSchema Rowset
  XTEST_(hr = m_pIDBSchemaRowset->GetRowset(
          pCAggregate,    // punkOuter
          guidSchema,     // schema IID
          cRestrictions,    // # of restrictions
          rgRestrictions,   // array of restrictions
          riid,       // rowset interface
          cPropSets,      // # of properties
          rgPropSets,     // properties
          ppIUnknown),S_OK);  // rowset pointer

  TRACE_METHOD(hr, L"IDBSchemaRowset::GetRowset(0x%p, %s, %d, 0x%p, %s, %d, 0x%p, &0x%p)", pCAggregate, pwszSchemaName, cRestrictions, rgRestrictions, GetInterfaceName(riid), cPropSets, rgPropSets, ppIUnknown ? *ppIUnknown : NULL);

  //Display Errors (if occurred)
  TESTC(hr = DisplayPropErrors(hr, cPropSets, rgPropSets));

  //Handle Aggregation
  if(pCAggregate)
    TESTC(hr = pCAggregate->HandleAggregation(riid, ppIUnknown));

CLEANUP:
  return hr;
}

HRESULT CSession::OpenRowset | ( | CAggregate * | pCAggregate,
 |  | DBID * | pTableID,
 |  | DBID * | pIndexID,
 |  | REFIID | riid,
 |  | ULONG | cPropSets,
 |  | DBPROPSET * | rgPropSets,
 |  | IUnknown ** | ppIUnknown |
 | ) |  |  | [virtual]

Definition at line 214 of file csession.cpp.

{
  HRESULT       hr = E_FAIL;      // HRESULT

  if(!m_pIOpenRowset)
    return E_FAIL;

  WCHAR wszTableName[MAX_QUERY_LEN+1];
  WCHAR wszIndexName[MAX_QUERY_LEN+1];

  // From IOpenRowset, get a rowset object
  DBIDToString(pTableID, wszTableName, MAX_QUERY_LEN);
  DBIDToString(pIndexID, wszIndexName, MAX_QUERY_LEN);

  XTEST_(hr = m_pIOpenRowset->OpenRowset(
              pCAggregate,    // pUnkOuter
              pTableID,     // pTableID
              pIndexID,     // pIndexID
              riid,       // refiid
              cPropSets,      // cProperties
              rgPropSets,     // rgProperties
              ppIUnknown),S_OK);  // IRowset pointer
  TRACE_METHOD(hr, L"IOpenRowset::OpenRowset(0x%p, %s, %s, %s, %d, 0x%p, &0x%p)", pCAggregate, wszTableName, wszIndexName, GetInterfaceName(riid), cPropSets, rgPropSets, ppIUnknown ? *ppIUnknown : NULL);

  //Display Errors (if occurred)
  TESTC(hr = DisplayPropErrors(hr, cPropSets, rgPropSets));

  //Handle Aggregation
  if(pCAggregate)
    TESTC(hr = pCAggregate->HandleAggregation(riid, ppIUnknown));

CLEANUP:
  return hr;
}

Member Data Documentation

ULONG CSession::m_cProvTypes

Definition at line 88 of file csession.h.

CList<CPropSets*,CPropSets*> CSession::m_listCPropSets

Definition at line 90 of file csession.h.

IAlterIndex* CSession::m_pIAlterIndex

Definition at line 74 of file csession.h.

IAlterTable* CSession::m_pIAlterTable

Definition at line 75 of file csession.h.

IBindResource* CSession::m_pIBindResource

Definition at line 84 of file csession.h.

ICreateRow* CSession::m_pICreateRow

Definition at line 85 of file csession.h.

IDBCreateCommand* CSession::m_pIDBCreateCommand

Definition at line 71 of file csession.h.

IDBSchemaRowset* CSession::m_pIDBSchemaRowset

Definition at line 72 of file csession.h.

IGetDataSource* CSession::m_pIGetDataSource

Definition at line 66 of file csession.h.

IIndexDefinition* CSession::m_pIIndexDefinition

Definition at line 73 of file csession.h.

IOpenRowset* CSession::m_pIOpenRowset

Definition at line 67 of file csession.h.

ISessionProperties* CSession::m_pISessionProperties

Definition at line 68 of file csession.h.

ITableDefinition* CSession::m_pITableDefinition

Definition at line 76 of file csession.h.

ITableDefinitionWithConstraints* CSession::m_pITableDefinitionWithConstraints

Definition at line 77 of file csession.h.

ITransaction* CSession::m_pITransaction

Definition at line 79 of file csession.h.

ITransactionJoin* CSession::m_pITransactionJoin

Definition at line 81 of file csession.h.

ITransactionLocal* CSession::m_pITransactionLocal

Definition at line 80 of file csession.h.

ITransactionObject* CSession::m_pITransactionObject

Definition at line 82 of file csession.h.

PROVTYPEINFO* CSession::m_rgProvTypes

Definition at line 89 of file csession.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/csession.h
  • Dataaccess/oledb/rowsetviewer/csession.cpp
Generated on Wed Nov 13 2024 16:57:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSessionDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes

CSessionDlg Class Reference

#include "SessionDlg.h"

List of all members.

Public Types

enum | { IDD = IDD_SESSION }

Public Member Functions

CSessionDlg (CWnd *pParent=NULL)
void | Refresh ()

Public Attributes

CEdit | m_serverName
CListCtrl | m_sessionList
PWTS_SESSION_INFO | pSessionInfo

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
virtual void | OnCancel ()
afx_msg void | OnDisconnectSession ()
virtual BOOL | OnInitDialog ()
afx_msg void | OnLogoffSession ()
afx_msg void | OnQuerySession ()
afx_msg void | OnRefresh ()
afx_msg void | OnSetsession ()
afx_msg void | OnVirtualChannel ()
void | SetSessionID ()

Private Member Functions

void | GetSessionID ()

Private Attributes

CString | connectState [10]
DWORD count
HANDLE serverHandle
LPSTR serverName
DWORD sessionID
CString WinStationName

Detailed Description

Definition at line 18 of file SessionDlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 28 of file SessionDlg.h.

{ IDD = IDD_SESSION };

Constructor & Destructor Documentation

CSessionDlg::CSessionDlg ( CWnd * pParent = NULL )

Definition at line 34 of file SessionDlg.Cpp.

  : CDialog(CSessionDlg::IDD, pParent)
{
  //{{AFX_DATA_INIT(CSessionDlg)
  //}}AFX_DATA_INIT
}

Member Function Documentation

void CSessionDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 41 of file SessionDlg.Cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CSessionDlg)
  DDX_Control(pDX, IDC_LIST_SESSION, m_sessionList);
  DDX_Control(pDX, IDC_SERVER_NAME, m_serverName);
  //}}AFX_DATA_MAP
}

void CSessionDlg::GetSessionID ( ) [private]

Definition at line 300 of file SessionDlg.Cpp.

{
  PWTS_SESSION_INFO pSession = pSessionInfo;
  UINT state;
  for (DWORD i=0; i < count; i++)
  {
    state = m_sessionList.GetItemState(i, LVIS_SELECTED);
    if (state == LVIS_SELECTED)
      sessionID = pSession->SessionId;
    pSession++;
  }
}

void CSessionDlg::OnCancel ( ) [protected, virtual]

Definition at line 274 of file SessionDlg.Cpp.

{
  WTSFreeMemory(pSessionInfo);
  WTSCloseServer(serverHandle);
  CDialog::OnCancel();
}

void CSessionDlg::OnDisconnectSession ( ) [protected]

Definition at line 64 of file SessionDlg.Cpp.

{
  GetSessionID();
  if (!WTSDisconnectSession(serverHandle,sessionID,0x0))
    AfxMessageBox("Unable to disconnect session");
  else
    Refresh();
}

BOOL CSessionDlg::OnInitDialog ( void ) [protected, virtual]

Definition at line 89 of file SessionDlg.Cpp.

{
  CDialog::OnInitDialog();

  serverName = g_pDoc->GetServerName();
  serverHandle = WTSOpenServer(serverName);

  CString serverDisplay;
  serverDisplay = "List of sessions on ";
  if (*serverName == NULL)
    serverDisplay += "local server";
  else
    serverDisplay += serverName;
  m_serverName.SetWindowText(serverDisplay);

  LV_COLUMN lvColumn;
  lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
  lvColumn.fmt = LVCFMT_LEFT;
  lvColumn.cx = 120;
  lvColumn.iSubItem = 0;
  lvColumn.pszText = "WinStation";
  m_sessionList.InsertColumn(0, &lvColumn);
  lvColumn.iSubItem = 1;
  lvColumn.pszText = "Session ID";
  m_sessionList.InsertColumn(1, &lvColumn);
  lvColumn.iSubItem = 2;
  lvColumn.pszText = "Connection Status";
  m_sessionList.InsertColumn(2, &lvColumn);

  connectState[0] = "Active";
  connectState[1] = "Connected";
  connectState[2] = "ConnectQuery";
  connectState[3] = "Shadow";
  connectState[4] = "Disconnected";
  connectState[5] = "Idle";
  connectState[6] = "Listen";
  connectState[7] = "Reset";
  connectState[8] = "Down";
  connectState[9] = "Init";

  Refresh();
  return TRUE;
}

void CSessionDlg::OnLogoffSession ( ) [protected]

Definition at line 73 of file SessionDlg.Cpp.

{
  GetSessionID();
  if (!WTSLogoffSession(serverHandle,sessionID,0x0))
    AfxMessageBox("Unable to logoff session");
  else
    Refresh();
}

void CSessionDlg::OnQuerySession ( ) [protected]

Definition at line 82 of file SessionDlg.Cpp.

{
  SetSessionID();
  CQueryDlg dialog;
  dialog.DoModal();
}

void CSessionDlg::OnRefresh ( ) [protected]

Definition at line 269 of file SessionDlg.Cpp.

{
  Refresh();
}

afx_msg void CSessionDlg::OnSetsession ( ) [protected]
void CSessionDlg::OnVirtualChannel ( ) [protected]

Definition at line 171 of file SessionDlg.Cpp.

{
  HANDLE VCHandle;
  //int i, j, k;
  int i;
  //PVOID DataBuf;
  ULONG BytesReturned = 0;
  //int Words;
  //PULONG pw;

  serverName = g_pDoc->GetServerName();
  serverHandle = WTSOpenServer(serverName);

  GetSessionID();

  AfxMessageBox("Starting Virtual Channel Test");
  CString virtualMessage, data1, data2;
    for (i=0; VCName[i]; i++)
  {
    virtualMessage.Format("String length of %s is %d\r\n",VCName[i],strlen(VCName[i]));
        AfxMessageBox(virtualMessage);

    if (VCHandle = WTSVirtualChannelOpen(serverHandle, sessionID, VCName[i]))
    {

#ifdef ICA_STUFF_INCLUDED
        if (WTSVirtualChannelQuery(VCHandle,
                                      WTSVirtualClientData,
                                      &DataBuf,
                                      &BytesReturned))
    {
      int Words;
      PULONG pw;
      PVOID DataBuf;
      int j, k;

      virtualMessage.Format("WTSVirtualChannelQuery(WTSVirtualClientData) Passed Bytes Returned: %d\r\n",
                          BytesReturned);
      AfxMessageBox(virtualMessage);

          Words = (BytesReturned + sizeof(ULONG) - 1) / sizeof(ULONG);

      virtualMessage = "";
      for (j=0,pw=(PULONG)DataBuf;j<Words;) {
               data1.Format("%04x: ",j*4);
               for(k=0;((k < 4) && (j<Words));j++,k++,pw++) {
                    data2.Format("%08x  ",*pw);
          data1 += data2;
               }
         virtualMessage += data1;
         virtualMessage += "\r\n";
          }
      AfxMessageBox(virtualMessage);
          WTSFreeMemory(DataBuf);
        }
    else {
                virtualMessage.Format("*** WTSVirtualChannelQuery(WTSVirtualClientData) failed - error: %d\r\n",
                       GetLastError());
        AfxMessageBox(virtualMessage);
    }
#endif

        if (WTSVirtualChannelPurgeInput(VCHandle)) {
            virtualMessage.Format("WTSVirtualChannelPurgeInput Passed\r\n");
      AfxMessageBox(virtualMessage);
        } else {
            virtualMessage.Format("*** WTSVirtualChannelPurgeInput failed - error: %d\r\n",
                GetLastError());
      AfxMessageBox(virtualMessage);
        }

            if (WTSVirtualChannelPurgeOutput(VCHandle)) {
                virtualMessage.Format("WTSVirtualChannelPurgeOutput Passed\r\n" );
        AfxMessageBox(virtualMessage);
            } else {
                virtualMessage.Format("*** WTSVirtualChannelPurgeOutput failed - error: %d\r\n",
                       GetLastError() );
        AfxMessageBox(virtualMessage);
            }

            if (WTSVirtualChannelClose(VCHandle)) {
                virtualMessage.Format("Open/Close channel %s Passed\r\n", VCName[i]);
        AfxMessageBox(virtualMessage);
            } else {
                virtualMessage.Format("*** Close channel %s failed - error: %d\r\n",
                   VCName[i], GetLastError());
          AfxMessageBox(virtualMessage);
            }
        } else {
            virtualMessage.Format("*** Open channel %s failed - error: %d\r\n",
                     VCName[i], GetLastError());
      AfxMessageBox(virtualMessage);
    }
    }
    virtualMessage.Format("Ending Virtual Channel Test\r\n" );
  AfxMessageBox(virtualMessage);
}

void CSessionDlg::Refresh ( )

Definition at line 134 of file SessionDlg.Cpp.

{
  if (!m_sessionList.DeleteAllItems())
    AfxMessageBox("Error unable to delete items");

  if (!WTSEnumerateSessions(serverHandle,0,1,&pSessionInfo,&count))
    AfxMessageBox("Unable to enumerate sessions");
  PWTS_SESSION_INFO pSession = pSessionInfo;

  CString temp;
  LV_ITEM lvItem;
  lvItem.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE;
  lvItem.state = 0;
  lvItem.stateMask = 0;
  lvItem.iImage = 0;

  CString tempString;

  for (DWORD i=0; i < count; i++)
  {
    lvItem.iItem = i;
    lvItem.iSubItem = 0;
    if (*pSession->pWinStationName == NULL)
      lvItem.pszText = "<No Name>";
    else
      lvItem.pszText = pSession->pWinStationName;

    m_sessionList.InsertItem(&lvItem);
    tempString.Format("%d", pSession->SessionId);
    m_sessionList.SetItemText(i, 1, tempString);
    tempString = connectState[pSession->State];
      m_sessionList.SetItemText(i, 2, tempString);
    temp = m_sessionList.GetItemText(i,0);
    pSession++;
  }
}

void CSessionDlg::SetSessionID ( ) [protected]

Definition at line 281 of file SessionDlg.Cpp.

{
  PWTS_SESSION_INFO pSession = pSessionInfo;
  CString tempName;
  UINT state;
  for (DWORD i=0; i < count; i++)
  {
    state = m_sessionList.GetItemState(i, LVIS_SELECTED);
    if (state == LVIS_SELECTED)
    {
      sessionID = pSession->SessionId;
      i = count;
    }
    pSession++;
  }
  g_pDoc->SetSessionID(sessionID);
}

Member Data Documentation

CString CSessionDlg::connectState[10] [private]

Definition at line 59 of file SessionDlg.h.

DWORD CSessionDlg::count [private]

Definition at line 63 of file SessionDlg.h.

CEdit CSessionDlg::m_serverName

Definition at line 30 of file SessionDlg.h.

CListCtrl CSessionDlg::m_sessionList

Definition at line 29 of file SessionDlg.h.

PWTS_SESSION_INFO CSessionDlg::pSessionInfo

Definition at line 23 of file SessionDlg.h.

HANDLE CSessionDlg::serverHandle [private]

Definition at line 61 of file SessionDlg.h.

LPSTR CSessionDlg::serverName [private]

Definition at line 62 of file SessionDlg.h.

DWORD CSessionDlg::sessionID [private]

Definition at line 64 of file SessionDlg.h.

CString CSessionDlg::WinStationName [private]

Definition at line 60 of file SessionDlg.h.

The documentation for this class was generated from the following files:
  • WinBase/WtsApi/WtsApi/SessionDlg.h
  • WinBase/WtsApi/WtsApi/SessionDlg.Cpp
Generated on Wed Nov 13 2024 16:57:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSet Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CSet Class Reference

#include "Cset.Hxx"

Inherited by CCTypeSet, and CFontSet.

List of all members.

Public Member Functions

virtual BOOL In (WORD iChar)=0

Detailed Description

Definition at line 35 of file Cset.Hxx.

Member Function Documentation

virtual BOOL CSet::In ( WORD iChar ) [pure virtual]

Implemented in CCTypeSet.

The documentation for this class was generated from the following file:
  • Multimedia/Gdi/Fonts/GridFont/Cset.Hxx
Generated on Wed Nov 13 2024 16:57:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSettings Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes | Friends

CSettings Class Reference

#include "Settings.h"

Inherits CLockHandler.

List of all members.

Public Member Functions

CSettings ()
~CSettings ()
BOOL | CopyHandlerSyncInfo (REFSYNCMGRITEMID ItemID, LPHANDLERITEMSETTINGS pHandlerSyncItem)
STDMETHODIMP | EnumSyncMgrItems (ISyncMgrEnumItems **ppenumOffineItems)
BOOL | ReleaseItemLock (CSyncMgrHandler *pLockHandler, REFSYNCMGRITEMID ItemID)
BOOL | ReleaseItemLock (CSyncMgrHandler *pLockHandler, REFSYNCMGRITEMID ItemID, FILETIME *pfUpdateTime)
BOOL | RequestItemLock (CSyncMgrHandler *pLockHandler, REFSYNCMGRITEMID ItemID)
STDMETHODIMP | ShowProperties (HWND hWndParent, REFSYNCMGRITEMID ItemID)
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()

Private Member Functions

int | Alert (HWND hWnd, LPCTSTR lpText)
int | ConfigDlgAddListViewItem (HWND hWndList, SYNCMGRITEM syncMgrItem, int iItem, int iIconIndex)
BOOL | ConfigDlgDeleteListViewItem (HWND hWndList, int iItem)
BOOL | DeleteItemSettings (LPSAMPLEITEMSETTINGS pSampleItemSettings)
LPSAMPLEITEMSETTINGS | FindItemSettings (REFSYNCMGRITEMID ItemID)
LPSAMPLEITEMSETTINGS | ItemConfigDlgGetItemSettings (ITEMCONFIGSETTINGSLPARAM *pItemConfigDlglParam)
void | OnConfigDlgAdd (HWND hWnd, CONFIGSETTINGSLPARAM *pConfigSettingslParam)
void | OnConfigDlgCommand (HWND hWnd, CONFIGSETTINGSLPARAM *pConfigSettingslParam, UINT uMessage, WPARAM wParam, LPARAM lParam)
void | OnConfigDlgDestroy (HWND hWnd, CONFIGSETTINGSLPARAM *pConfigSettingslParam, UINT uMessage, WPARAM wParam, LPARAM lParam)
void | OnConfigDlgEdit (HWND hWnd, CONFIGSETTINGSLPARAM *pConfigSettingslParam, SYNCMGRITEMID ItemID, int iSelection)
void | OnConfigDlgInit (HWND hWnd, CONFIGSETTINGSLPARAM *pConfigSettingslParam, UINT uMessage, WPARAM wParam, LPARAM lParam)
void | OnConfigDlgNotify (HWND hWnd, CONFIGSETTINGSLPARAM *pConfigSettingslParam, UINT uMessage, WPARAM wParam, LPARAM lParam)
void | OnConfigDlgRemove (HWND hWnd, CONFIGSETTINGSLPARAM *pConfigSettingslParam, SYNCMGRITEMID ItemID, int iSelection)
BOOL | OnItemConfigDlgApply (HWND hWnd, ITEMCONFIGSETTINGSLPARAM *pItemConfigDlglParam, UINT uMessage, WPARAM wParam, LPARAM lParam)
void | OnItemConfigDlgCommand (HWND hWnd, ITEMCONFIGSETTINGSLPARAM *pItemConfigDlglParam, UINT uMessage, WPARAM wParam, LPARAM lParam)
void | OnItemConfigDlgDestroy (HWND hWnd, ITEMCONFIGSETTINGSLPARAM *pItemConfigDlglParam, UINT uMessage, WPARAM wParam, LPARAM lParam)
void | OnItemConfigDlgInit (HWND hWnd, ITEMCONFIGSETTINGSLPARAM *pItemConfigDlglParam, UINT uMessage, WPARAM wParam, LPARAM lParam)
void | OnItemConfigDlgNotify (HWND hWnd, ITEMCONFIGSETTINGSLPARAM *pItemConfigDlglParam, UINT uMessage, WPARAM wParam, LPARAM lParam)
STDMETHODIMP | ReadSettings (BOOL fForce)
BOOL | ReleaseItemLockX (CSyncMgrHandler *pLockHandler, REFSYNCMGRITEMID ItemID, BOOL fUpdateft, FILETIME *pfUpdateTime)
STDMETHODIMP | ShowItemProperties (HWND hWndParent, BOOL fNew, LPSAMPLEITEMSETTINGS pItemSettings, SYNCMGRITEMID ItemID)
BOOL | WriteItemSettings (LPSAMPLEITEMSETTINGS pSampleItemSettings)

Private Attributes

LONG | m_cRefs
LPGENERICITEMLIST m_pHandlerItems

Friends

BOOL CALLBACK | ConfigureDlgProc (HWND hDlg, UINT uMessage, WPARAM wParam, LPARAM lParam)
BOOL CALLBACK | ItemConfigDlgProc (HWND hDlg, UINT uMessage, WPARAM wParam, LPARAM lParam)

Detailed Description

Definition at line 88 of file Settings.h.

Constructor & Destructor Documentation

CSettings::CSettings ( )

Definition at line 33 of file Settings.Cpp.

{

    m_cRefs = 1;
    m_pHandlerItems = NULL;
}

CSettings::~CSettings ( )

Definition at line 54 of file Settings.Cpp.

{
    Assert(0 == m_cRefs);

    if (m_pHandlerItems)
    {
    LPGENERICITEMLIST pHandlerItems = m_pHandlerItems;

        m_pHandlerItems = NULL;
        Release_ItemList(pHandlerItems);
    }

}

Member Function Documentation

int CSettings::Alert | ( | HWND | hWnd,
 |  | LPCTSTR | lpText |
 | ) |  |  | [private]

Definition at line 765 of file Settings.Cpp.

{
    return ::MessageBox(hWnd,lpText,TEXT("Sample Handler"),MB_OK | MB_ICONERROR);
}

int CSettings::ConfigDlgAddListViewItem | ( | HWND | hWndList,
 |  | SYNCMGRITEM | syncMgrItem,
 |  | int | iItem,
 |  | int | iIconIndex |
 | ) |  |  | [private]

Definition at line 786 of file Settings.Cpp.

{
LV_ITEM lvItem;
CONFIGITEMLISTVIEWLPARAM *pConfigItemListViewlParam;
int iResult = -1;

    lvItem.mask = LVIF_TEXT | LVIF_PARAM;
    lvItem.iItem = iItem;
    lvItem.iSubItem = 0;

    #ifdef _UNICODE
        lvItem.pszText = syncMgrItem.wszItemName;
    #else
        char TextBuf[MAX_PATH];

        *TextBuf = NULL;
        WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK, syncMgrItem.wszItemName,
                            -1, TextBuf,MAX_PATH, NULL, NULL);

        lvItem.pszText = TextBuf;

    #endif // _UNICODE

    if (iIconIndex >= 0)
    {
        lvItem.mask |= LVIF_IMAGE;
        lvItem.iImage = iIconIndex;
    }

    // need to store somethin in lParam so can get Item from it.
    pConfigItemListViewlParam = (CONFIGITEMLISTVIEWLPARAM *) ALLOC(sizeof(CONFIGITEMLISTVIEWLPARAM));

    if (pConfigItemListViewlParam)
    {

        pConfigItemListViewlParam->ItemID = syncMgrItem.ItemID;
    lvItem.lParam = (LPARAM) pConfigItemListViewlParam;

    //add the item to the list
    iResult = ListView_InsertItem(hWndList, &lvItem);

        if (-1 == iResult)
        {
            FREE(pConfigItemListViewlParam);
        }

    }

    return iResult;
}

BOOL CSettings::ConfigDlgDeleteListViewItem | ( | HWND | hWndList,
 |  | int | iItem |
 | ) |  |  | [private]

Definition at line 930 of file Settings.Cpp.

{
LV_ITEM lvItem;
CONFIGITEMLISTVIEWLPARAM *pConfigItemListViewlParam;
BOOL fResult = FALSE;

    lvItem.mask = LVIF_PARAM;
    lvItem.iItem = iItem;

    if (ListView_GetItem(hWndList, &lvItem))
    {

        pConfigItemListViewlParam = (CONFIGITEMLISTVIEWLPARAM *) lvItem.lParam;

        if (ListView_DeleteItem(hWndList,iItem))
        {
            fResult = TRUE;

            if (pConfigItemListViewlParam)
            {
                FREE(pConfigItemListViewlParam);
            }
        }
    }

    return fResult;
}

BOOL CSettings::CopyHandlerSyncInfo | ( | REFSYNCMGRITEMID | ItemID,
 |  | LPHANDLERITEMSETTINGS | pHandlerSyncItem
 | ) |  |

Definition at line 398 of file Settings.Cpp.

{
LPSAMPLEITEMSETTINGS pItemSettings;
BOOL fReturn = FALSE;
CLock clock(this);

    clock.Enter();

    pItemSettings = FindItemSettings(ItemID);

    Assert(pHandlerSyncItem);

    if (pItemSettings && pHandlerSyncItem)
    {

        pHandlerSyncItem->ItemID = ItemID;
        pHandlerSyncItem->ft = pItemSettings->syncmgrItem.ftLastUpdate;
        pHandlerSyncItem->fRecursive = pItemSettings->fRecursive;

        lstrcpyn(pHandlerSyncItem->dir1,pItemSettings->dir1,
            sizeof(pHandlerSyncItem->dir1)/sizeof(TCHAR));
        lstrcpyn(pHandlerSyncItem->dir2,pItemSettings->dir2,
            sizeof(pHandlerSyncItem->dir2)/sizeof(TCHAR));

#ifndef _UNICODE
        WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK,
                            pItemSettings->syncmgrItem.wszItemName,
                            -1, pHandlerSyncItem->szItemName,
                            sizeof(pHandlerSyncItem->szItemName)/sizeof(TCHAR), NULL, NULL);

#else
        lstrcpyn(pHandlerSyncItem->szItemName,
            pItemSettings->syncmgrItem.wszItemName,
            sizeof(pHandlerSyncItem->szItemName));
#endif // _UNICODE

        fReturn = TRUE;
    }

    clock.Leave();
    return fReturn;
}

BOOL CSettings::DeleteItemSettings ( LPSAMPLEITEMSETTINGS pSampleItemSettings ) [private]

Definition at line 570 of file Settings.Cpp.

{
    ASSERT_LOCKHELD(this);

    Reg_DeleteItemIdForHandlerItem(CLSID_SyncMgrHandler,
                        pSampleItemSettings->syncmgrItem.ItemID);

    return TRUE;
}

STDMETHODIMP CSettings::EnumSyncMgrItems ( ISyncMgrEnumItems ** ppenumOffineItems )

Definition at line 134 of file Settings.Cpp.

{
CLock clock(this);

    clock.Enter();

    ReadSettings(FALSE /* fForce */); // make sure settings have been read in

    *ppenumOffineItems = NULL;

    if (m_pHandlerItems)
    {
    LPGENERICITEMLIST pDupList;

        // snapshot itemlist for enum so don't have to
        // worry about changes.
        pDupList = DuplicateItemList(m_pHandlerItems);
        if (pDupList)
        {
        *ppenumOffineItems = new  CEnumSyncMgrItems(pDupList,0);
            Release_ItemList(pDupList);
        }

    }

    clock.Leave();

    return *ppenumOffineItems ? NOERROR: E_OUTOFMEMORY;
}

LPSAMPLEITEMSETTINGS CSettings::FindItemSettings ( REFSYNCMGRITEMID ItemID ) [private]

Definition at line 599 of file Settings.Cpp.

{
LPSAMPLEITEMSETTINGS pItemSettings = NULL;

    ASSERT_LOCKHELD(this);

    ReadSettings(FALSE /* fForce */); // make sure settings are read in.a

    if (m_pHandlerItems)
    {

        pItemSettings = (LPSAMPLEITEMSETTINGS) m_pHandlerItems->pFirstGenericItem;

        while (pItemSettings)
        {
            Assert(sizeof(SAMPLEITEMSETTINGS) == pItemSettings->genericItem.cbSize);

            if (ItemID == pItemSettings->syncmgrItem.ItemID)
            {
                break;
            }

            pItemSettings = (LPSAMPLEITEMSETTINGS) pItemSettings->genericItem.pNextGenericItem;
        }

    }

    AssertSz(pItemSettings,"Item not Found");

    return pItemSettings;
}

LPSAMPLEITEMSETTINGS CSettings::ItemConfigDlgGetItemSettings ( ITEMCONFIGSETTINGSLPARAM * pItemConfigDlglParam ) [private]

Definition at line 1413 of file Settings.Cpp.

{
LPSAMPLEITEMSETTINGS pSampleItem = NULL;

    ASSERT_LOCKHELD(this);

    if (pItemConfigDlglParam->fNewItem)
    {
        pSampleItem = pItemConfigDlglParam->pItemSettings;
    }
    else
    {
        pSampleItem = FindItemSettings(pItemConfigDlglParam->ItemID);
    }

    return pSampleItem;
}

void CSettings::OnConfigDlgAdd | ( | HWND | hWnd,
 |  | CONFIGSETTINGSLPARAM * | pConfigSettingslParam |
 | ) |  |  | [private]

Definition at line 1086 of file Settings.Cpp.

{
LPSAMPLEITEMSETTINGS pSettings = (LPSAMPLEITEMSETTINGS) CreateNewListItem(sizeof(SAMPLEITEMSETTINGS));

    if (pSettings)
    {
    HRESULT hr;
    SYNCMGRITEMID offType;

        // generate an ID for the item.
        CoCreateGuid(&offType);
        pSettings->syncmgrItem.ItemID = offType;
        pSettings->syncmgrItem.cbSize = sizeof(SYNCMGRITEM);
        pSettings->syncmgrItem.dwItemState = SYNCMGRITEMSTATE_CHECKED;

        pSettings->syncmgrItem.hIcon =
                    LoadIcon(g_hmodThisDll,MAKEINTRESOURCE(IDI_SAMPLEHANDLERICON));

        pSettings->syncmgrItem.dwFlags =
                            SYNCMGRITEM_HASPROPERTIES | SYNCMGRITEM_LASTUPDATETIME;

        // if wanted to setup default fields for item dialog on first create
        // do it here.

        hr = ShowItemProperties(hWnd,TRUE /* fNew */, pSettings,GUID_NULL);

        // if user hits okay/apply while in ShowItems
        // the item has been added to now add it to the global list

        if ( (S_OK == hr) &&
            AddItemToList(m_pHandlerItems,(LPGENERICITEM) pSettings))
        {
        HWND hWndList;
        HICON hIcon;
        int iIconIndex = -1;
        HIMAGELIST himage;

            hWndList = GetDlgItem(hWnd,IDC_CONFIGDIALOG_ITEMLIST);

            if (hWndList)
            {

                himage = ListView_GetImageList(hWndList,LVSIL_SMALL);

            hIcon = LoadIcon(g_hmodThisDll,MAKEINTRESOURCE(IDI_SAMPLEHANDLERITEMICON));
                if (hIcon && himage)
                {
                    iIconIndex = ImageList_AddIcon(himage,hIcon);
                }

                // add new item to the UI.
                ConfigDlgAddListViewItem(hWndList,pSettings->syncmgrItem,0,iIconIndex);
            }

            // need to reenum when return from showProperties if item was added.
            pConfigSettingslParam->hr = S_SYNCMGR_ENUMITEMS;

        }
        else
        {
            FREE(pSettings);
        }
    }
}

void CSettings::OnConfigDlgCommand | ( | HWND | hWnd,
 |  | CONFIGSETTINGSLPARAM * | pConfigSettingslParam,
 |  | UINT | uMessage,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private]

Definition at line 1275 of file Settings.Cpp.

{
WORD wNotifyCode =  HIWORD(wParam);
WORD wID =  LOWORD(wParam);
HWND hwndCtl =  (HWND)lParam;
HWND hwndListView = GetDlgItem(hWnd,IDC_CONFIGDIALOG_ITEMLIST);

    if (BN_CLICKED == wNotifyCode) // all just respond to clicked
    {
        switch (wID)
        {
        case IDC_CONFIGDIALOG_REMOVE:
        case IDC_CONFIGDIALOG_EDIT:
        {
        int iSelection;
        LV_ITEM lvItem;
        CONFIGITEMLISTVIEWLPARAM *pConfigItemListViewlParam;
        SYNCMGRITEMID ItemID;

            if (!hwndListView || (-1 == (iSelection = ListView_GetSelectionMark(hwndListView))))
            {
                return;
            }

            // grab itemid out of the lParam.
        lvItem.mask = LVIF_PARAM;
        lvItem.iItem = iSelection;

        if (FALSE == ListView_GetItem(hwndListView, &lvItem) )
            {
                return;
            }

        pConfigItemListViewlParam = (CONFIGITEMLISTVIEWLPARAM *) lvItem.lParam;

            if (NULL == pConfigItemListViewlParam)
            {
                return;
            }

            ItemID = pConfigItemListViewlParam->ItemID;

            switch (wID)
            {
            case IDC_CONFIGDIALOG_REMOVE:
                OnConfigDlgRemove(hWnd,pConfigSettingslParam,ItemID,iSelection);
                break;
        case  IDC_CONFIGDIALOG_EDIT:
                OnConfigDlgEdit(hWnd,pConfigSettingslParam,ItemID,iSelection);
                break;
            default:
                break;
            }

            break;
        }
    case  IDC_CONFIGDIALOG_ADD:
            OnConfigDlgAdd(hWnd,pConfigSettingslParam);
            break;
        default:
            break;
        }
    }
}

void CSettings::OnConfigDlgDestroy | ( | HWND | hWnd,
 |  | CONFIGSETTINGSLPARAM * | pConfigSettingslParam,
 |  | UINT | uMessage,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private]

Definition at line 972 of file Settings.Cpp.

{
HWND hwndListView = GetDlgItem(hWnd,IDC_CONFIGDIALOG_ITEMLIST);
int iItemCount;
int iItem;

    if (!hwndListView)
    {
        return;
    }

    iItemCount = ListView_GetItemCount(hwndListView);

    for(iItem = 0; iItem < iItemCount; iItem++)
    {
        ConfigDlgDeleteListViewItem(hwndListView,0); // delete list view items to cleanup lParam
    }
}

void CSettings::OnConfigDlgEdit | ( | HWND | hWnd,
 |  | CONFIGSETTINGSLPARAM * | pConfigSettingslParam,
 |  | SYNCMGRITEMID | ItemID,
 |  | int | iSelection |
 | ) |  |  | [private]

Definition at line 1214 of file Settings.Cpp.

{

    if (S_OK == ShowItemProperties(hWnd,FALSE /* fNew */,NULL,ItemID))
    {
    HWND hwndListView =  GetDlgItem(hWnd,IDC_CONFIGDIALOG_ITEMLIST);
    LPSAMPLEITEMSETTINGS pSettings;
    CLock clock(this);

        clock.Enter();

        // update the listview to the new display name.
        // get settings again in case list changed.
        if (hwndListView &&
            (pSettings =  FindItemSettings(ItemID)))
        {
        TCHAR *pDisplayName;

        #if _UNICODE
                pDisplayName = pSettings->syncmgrItem.wszItemName;
        #else
            char TextBuf[MAX_PATH];

            *TextBuf = NULL;
            WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK,
                                pSettings->syncmgrItem.wszItemName,
                                -1, TextBuf,MAX_PATH, NULL, NULL);

            pDisplayName = TextBuf;

        #endif // _UNICODE

            ListView_SetItemText(hwndListView,iSelection,0,pDisplayName);

        }

        // if user change anything re-enum on return to ShowProperties
        // in case the display name was changed.

        clock.Leave();

        pConfigSettingslParam->hr = S_SYNCMGR_ENUMITEMS;
    }
}

void CSettings::OnConfigDlgInit | ( | HWND | hWnd,
 |  | CONFIGSETTINGSLPARAM * | pConfigSettingslParam,
 |  | UINT | uMessage,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private]

Definition at line 853 of file Settings.Cpp.

{
HWND hwndList = GetDlgItem(hWnd,IDC_CONFIGDIALOG_ITEMLIST);

    if (hwndList)
    {
    int iItem = 0;
    LV_COLUMN columnInfo;
    HIMAGELIST himage;
    int iIconIndex = -1;
    ISyncMgrEnumItems *pEnumItems;

        ListView_SetExtendedListViewStyle(hwndList, LVS_EX_FULLROWSELECT);

    // Insert the Proper columns
    columnInfo.mask = LVCF_FMT  | LVCF_TEXT  | LVCF_WIDTH  | LVCF_SUBITEM;
    columnInfo.fmt = LVCFMT_LEFT;
    columnInfo.cx = CalcListViewWidth(hwndList,300);
    columnInfo .pszText = TEXT("Items");
    columnInfo.iSubItem = 0;
    ListView_InsertColumn(hwndList,0,&columnInfo);

    // create an imagelist
        himage = ImageList_Create( GetSystemMetrics(SM_CXSMICON),
                         GetSystemMetrics(SM_CYSMICON),ILC_COLOR | ILC_MASK,5,20);
    if (himage)
    {
       ListView_SetImageList(hwndList,himage,LVSIL_SMALL);
    }

    HICON hIcon = LoadIcon(g_hmodThisDll,MAKEINTRESOURCE(IDI_SAMPLEHANDLERITEMICON));
        if (hIcon)
        {
            iIconIndex = ImageList_AddIcon(himage,hIcon);
        }

        // loop though item enumerator adding the info.
        if (NOERROR == EnumSyncMgrItems(&pEnumItems))
        {
        SYNCMGRITEM syncMgrItem;
        ULONG fetched;

            while (NOERROR == pEnumItems->Next(1,&syncMgrItem,&fetched))
            {

                if (-1 != ConfigDlgAddListViewItem(hwndList,syncMgrItem,iItem,iIconIndex))
                {
                    iItem++;
                }

            }

            pEnumItems->Release();
        }

    }

}

void CSettings::OnConfigDlgNotify | ( | HWND | hWnd,
 |  | CONFIGSETTINGSLPARAM * | pConfigSettingslParam,
 |  | UINT | uMessage,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private]

Definition at line 1007 of file Settings.Cpp.

{
LPNMHDR pnmhdr = (LPNMHDR)lParam;
INT_PTR iCtrlId = wParam;

    // enable/disable edit and remove button based on listview selection.
    if (IDC_CONFIGDIALOG_ITEMLIST == iCtrlId)
    {
    LPNMLISTVIEW pnmv = (LPNMLISTVIEW) pnmhdr;

        switch (pnmhdr->code)
        {
            case LVN_ITEMCHANGED:
        {
        if (  (pnmv->uChanged == LVIF_STATE)  &&
              ((pnmv->uNewState ^ pnmv->uOldState) & LVIS_SELECTED))
        {
                BOOL fEnable = FALSE;

                    if (pnmv->uNewState & LVIS_SELECTED)
                    {
                        fEnable = TRUE;
                    }

                    EnableWindow(GetDlgItem(hWnd,IDC_CONFIGDIALOG_REMOVE),fEnable);
                    EnableWindow(GetDlgItem(hWnd,IDC_CONFIGDIALOG_EDIT),fEnable);
        }
                break;
        }
            case NM_DBLCLK:
        {
            LV_ITEM lvItem;
            CONFIGITEMLISTVIEWLPARAM *pConfigItemListViewlParam;
            SYNCMGRITEMID ItemID;

               // grab itemid out of the lParam.
            lvItem.mask = LVIF_PARAM;
            lvItem.iItem = pnmv->iItem;

            if (FALSE == ListView_GetItem(GetDlgItem(hWnd,IDC_CONFIGDIALOG_ITEMLIST),&lvItem))
                {
                    return;
                }

            pConfigItemListViewlParam = (CONFIGITEMLISTVIEWLPARAM *) lvItem.lParam;

                if (NULL == pConfigItemListViewlParam)
                {
                    return;
                }

                ItemID = pConfigItemListViewlParam->ItemID;

            OnConfigDlgEdit(hWnd,pConfigSettingslParam,ItemID,pnmv->iItem);

                break;
        }
        default:
                break;
        }
    }

}

void CSettings::OnConfigDlgRemove | ( | HWND | hWnd,
 |  | CONFIGSETTINGSLPARAM * | pConfigSettingslParam,
 |  | SYNCMGRITEMID | ItemID,
 |  | int | iSelection |
 | ) |  |  | [private]

Definition at line 1166 of file Settings.Cpp.

{
LPSAMPLEITEMSETTINGS  pSettings;
CLock clock(this);

    Assert(iItem >= 0);

    clock.Enter();
    pSettings =  FindItemSettings(ItemID);

    if (pSettings && iItem >= 0)
    {
    HWND hwndListView = GetDlgItem(hWnd,IDC_CONFIGDIALOG_ITEMLIST);

        DeleteItemSettings(pSettings); // delete item from the registry

        DeleteItemFromList(m_pHandlerItems, (LPGENERICITEM) pSettings);// remove from enum list

        // now remove from UI
        if (hwndListView)
        {
            ConfigDlgDeleteListViewItem(hwndListView,iItem);
        }

        // on remove force a re-enum when return from ShowProperties.
        pConfigSettingslParam->hr = S_SYNCMGR_ENUMITEMS;
    }

    clock.Leave();
}

BOOL CSettings::OnItemConfigDlgApply | ( | HWND | hWnd,
 |  | ITEMCONFIGSETTINGSLPARAM * | pItemConfigDlglParam,
 |  | UINT | uMessage,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private]

Definition at line 1593 of file Settings.Cpp.

{
BOOL fResult = TRUE;
CLock clock(this);

    if (pItemConfigDlglParam->fDirty)
    {
    LPSAMPLEITEMSETTINGS pSampleItem;
    HWND hwndCtrl;
    TCHAR dir1[MAX_PATH];
    TCHAR dir2[MAX_PATH];
    TCHAR DisplayName[MAX_SYNCMGRITEMNAME];
    WCHAR *pDisplayName;
    BOOL fRecursive = FALSE;
    BOOL fPersist = TRUE;

    // get dialog values, if couldn't find don't return error so user can still cancel
    // dialog

        hwndCtrl = GetDlgItem(hWnd,IDC_ITEMCONFIGDIALOG_EDIT_DISPLAYNAME);
        if (hwndCtrl)
        {
            if (0 >= GetWindowText(hwndCtrl,DisplayName,sizeof(DisplayName)/sizeof(TCHAR)))
            {
                Alert(hWnd,TEXT("Display Name Is Not Valid."));
                SetFocus(hwndCtrl);
                return FALSE;
            }

            #if _UNICODE
                pDisplayName = DisplayName;
            #else
                WCHAR wszTextBuf[MAX_SYNCMGRITEMNAME];

                MultiByteToWideChar(CP_ACP, 0,
                                    DisplayName,
                                    -1, wszTextBuf,MAX_SYNCMGRITEMNAME);

                pDisplayName = wszTextBuf;

            #endif // _UNICODE

        }
        else
        {
            fPersist = FALSE;
        }

        // get the new dir names.
        hwndCtrl = GetDlgItem(hWnd,IDC_ITEMCONFIGDIALOG_EDIT_DIR1NAME);
        if (hwndCtrl)
        {
            if (0 >= GetWindowText(hwndCtrl,dir1,sizeof(dir1)/sizeof(TCHAR)))
            {
                Alert(hWnd,TEXT("Dir1 Name Is Not Valid."));
               return FALSE;
            }
        }
        else
        {
            fPersist = FALSE;
        }

        hwndCtrl = GetDlgItem(hWnd,IDC_ITEMCONFIGDIALOG_EDIT_DIR2NAME);
        if (hwndCtrl)
        {
            if (0 >= GetWindowText(hwndCtrl,dir2,sizeof(dir2)/sizeof(TCHAR)))
            {
                Alert(hWnd,TEXT("Dir2 Name Is Not Valid."));
                return FALSE;
            }
        }
        else
        {
            fPersist = FALSE;
        }

        // verify dir paths
        if (!IsValidDir(dir1))
        {
            Alert(hWnd,TEXT("Dir1 Name Is Not a Valid directory"));
            return FALSE;
        }

        if (!IsValidDir(dir2))
        {
            Alert(hWnd,TEXT("Dir2 Name Is Not a Valid directory"));
            return FALSE;
        }

        fRecursive = IsDlgButtonChecked(hWnd,IDC_ITEMCONFIGDIALOG_INCLUDESUBDIRS);

        // if everything validated write it out.
        clock.Enter();
        pSampleItem = ItemConfigDlgGetItemSettings(pItemConfigDlglParam);
        if (fPersist && pSampleItem)
        {

            lstrcpyW(pSampleItem->syncmgrItem.wszItemName,pDisplayName);
            lstrcpy(pSampleItem->dir1,dir1);
            lstrcpy(pSampleItem->dir2,dir2);
            pSampleItem->fRecursive = fRecursive;
            WriteItemSettings(pSampleItem);

            pItemConfigDlglParam->hr = S_OK; // only say items saved okay when dirty and saved properly
        }

        clock.Leave();
    }

    return fResult;
}

void CSettings::OnItemConfigDlgCommand | ( | HWND | hWnd,
 |  | ITEMCONFIGSETTINGSLPARAM * | pItemConfigDlglParam,
 |  | UINT | uMessage,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private]

Definition at line 1564 of file Settings.Cpp.

{
WORD wNotifyCode = HIWORD(wParam); // notification code
WORD wID = LOWORD(wParam);         // item, control, or accelerator identifier
HWND hwndCtl = (HWND) lParam;      // handle of control

    if ((EN_CHANGE == wNotifyCode) || (BN_CLICKED == wNotifyCode))
    {
        pItemConfigDlglParam->fDirty = TRUE;
        PropSheet_Changed(GetParent(hWnd), hWnd);
    }

}

void CSettings::OnItemConfigDlgDestroy | ( | HWND | hWnd,
 |  | ITEMCONFIGSETTINGSLPARAM * | pItemConfigDlglParam,
 |  | UINT | uMessage,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private]

Definition at line 1523 of file Settings.Cpp.

{

}

void CSettings::OnItemConfigDlgInit | ( | HWND | hWnd,
 |  | ITEMCONFIGSETTINGSLPARAM * | pItemConfigDlglParam,
 |  | UINT | uMessage,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private]

Definition at line 1445 of file Settings.Cpp.

{
LPSAMPLEITEMSETTINGS pSampleItem;
CLock clock(this);
    clock.Enter();

    pSampleItem = ItemConfigDlgGetItemSettings(pItemConfigDlglParam);

    pItemConfigDlglParam->hr = S_FALSE; // by default nothing has changed.

    // fill in the dialog values.
    if (pSampleItem)
    {
    HWND hwndCtrl;
    #ifndef _UNICODE
    char TextBuf[MAX_PATH];
    #endif // _UNICODE

        hwndCtrl = GetDlgItem(hWnd,IDC_ITEMCONFIGDIALOG_EDIT_DISPLAYNAME);
        if (hwndCtrl)
        {
        TCHAR *pDisplayName;

        #if _UNICODE
                pDisplayName = pSampleItem->syncmgrItem.wszItemName;
        #else
            *TextBuf = NULL;
            WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK,
                                pSampleItem->syncmgrItem.wszItemName,
                                -1, TextBuf,MAX_PATH, NULL, NULL);

            pDisplayName = TextBuf;

        #endif // _UNICODE

           SendMessage(hwndCtrl,EM_SETLIMITTEXT,MAX_SYNCMGRITEMNAME,0);
           SetWindowText(hwndCtrl,pDisplayName);
        }

        hwndCtrl = GetDlgItem(hWnd,IDC_ITEMCONFIGDIALOG_EDIT_DIR1NAME);
        if (hwndCtrl)
        {
            SendMessage(hwndCtrl,EM_SETLIMITTEXT,sizeof(pSampleItem->dir1),0);
            SendMessage(hwndCtrl,WM_SETTEXT,0,(LPARAM) pSampleItem->dir1);
        }

        hwndCtrl = GetDlgItem(hWnd,IDC_ITEMCONFIGDIALOG_EDIT_DIR2NAME);
        if (hwndCtrl)
        {
            SendMessage(hwndCtrl,EM_SETLIMITTEXT,sizeof(pSampleItem->dir2),0);
            SendMessage(hwndCtrl,WM_SETTEXT,0,(LPARAM) pSampleItem->dir2);
        }

        CheckDlgButton(hWnd,IDC_ITEMCONFIGDIALOG_INCLUDESUBDIRS,pSampleItem->fRecursive);

    }

    pItemConfigDlglParam->fDirty = FALSE;

    clock.Leave();
}

void CSettings::OnItemConfigDlgNotify | ( | HWND | hWnd,
 |  | ITEMCONFIGSETTINGSLPARAM * | pItemConfigDlglParam,
 |  | UINT | uMessage,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private]

Definition at line 1543 of file Settings.Cpp.

{

}

STDMETHODIMP CSettings::ReadSettings ( BOOL fForce ) [private]

Definition at line 457 of file Settings.Cpp.

{
HKEY hkeyHandlerPerf;

    ASSERT_LOCKHELD(this);

    // if not forced to refresh and already have a list just re-use it.
    if (!fForce && m_pHandlerItems)
    {
        return NOERROR;
    }

    Assert(NULL == m_pHandlerItems);

    m_pHandlerItems = CreateItemList();

    if (!m_pHandlerItems)
    {
        return E_OUTOFMEMORY;
    }

   // loop through registered items loading them in.
   if (hkeyHandlerPerf =  CreateHandlerPrefKey(CLSID_SyncMgrHandler))
   {
    TCHAR lpName[256];
    WCHAR *pszName;
    DWORD cbName = 256;
    CLSID clsid;
    DWORD dwIndex = 0;

        while ( ERROR_SUCCESS == RegEnumKey(hkeyHandlerPerf,dwIndex,
                lpName,cbName) )
        {
        #ifndef _UNICODE
            WCHAR  pwszItemID[MAX_SYNCMGRITEMNAME];

            MultiByteToWideChar(CP_ACP, 0,
                                lpName,
                                -1, pwszItemID,MAX_SYNCMGRITEMNAME);

            pszName = pwszItemID;
        #else
            pszName = lpName;
        #endif // _UNICODE

            if (NOERROR == CLSIDFromString(pszName,&clsid) )
            {
            LPSAMPLEITEMSETTINGS pSampleItem;

                // set up item list,
                pSampleItem = (LPSAMPLEITEMSETTINGS) AddNewItemToList(m_pHandlerItems,sizeof(SAMPLEITEMSETTINGS));

                if (!pSampleItem)
                {
                    continue;
                }

                // setup values we don't get from preferences.
                pSampleItem->syncmgrItem.cbSize = sizeof(SYNCMGRITEM);
                pSampleItem->syncmgrItem.dwItemState = SYNCMGRITEMSTATE_CHECKED;

                pSampleItem->syncmgrItem.hIcon =
                            LoadIcon(g_hmodThisDll,MAKEINTRESOURCE(IDI_SAMPLEHANDLERICON));

                pSampleItem->syncmgrItem.dwFlags =
                                    SYNCMGRITEM_HASPROPERTIES | SYNCMGRITEM_LASTUPDATETIME;

                 // read in items from preferences
                Reg_GetItemSettingsForHandlerItem(hkeyHandlerPerf,
                        clsid,
                        pSampleItem);

            }

            dwIndex++;
        }

        RegCloseKey(hkeyHandlerPerf);

   }

    return NOERROR;
}

BOOL CSettings::ReleaseItemLock | ( | CSyncMgrHandler * | pLockHandler,
 |  | REFSYNCMGRITEMID | ItemID,
 |  | FILETIME * | pfUpdateTime
 | ) |  |

Definition at line 304 of file Settings.Cpp.

{
    return ReleaseItemLockX(pLockHandler,ItemID,TRUE,pftLastUpdate);
}

BOOL CSettings::ReleaseItemLock | ( | CSyncMgrHandler * | pLockHandler,
 |  | REFSYNCMGRITEMID | ItemID
 | ) |  |

Definition at line 325 of file Settings.Cpp.

{
    return ReleaseItemLockX(pLockHandler,ItemID,FALSE,NULL);
}

BOOL CSettings::ReleaseItemLockX | ( | CSyncMgrHandler * | pLockHandler,
 |  | REFSYNCMGRITEMID | ItemID,
 |  | BOOL | fUpdateft,
 |  | FILETIME * | pfUpdateTime |
 | ) |  |  | [private]

Definition at line 345 of file Settings.Cpp.

{
LPSAMPLEITEMSETTINGS pItemSettings;
CLock clock(this);

    clock.Enter();

    pItemSettings = FindItemSettings(ItemID);

    if (pItemSettings)
    {
        Assert(TRUE == pItemSettings->fSyncLock);
        Assert(pLockHandler == pItemSettings->pLockHandler);

        if (pItemSettings->pLockHandler == pLockHandler)
        {
            pItemSettings->fSyncLock = FALSE;
            pItemSettings->pLockHandler = NULL;

            if (fUpdateft)
            {
                pItemSettings->syncmgrItem.ftLastUpdate = *pftLastUpdate;

                // write out item to registry to update the last update time.
                WriteItemSettings(pItemSettings);
            }
        }

        clock.Leave();
        return TRUE;
    }

    clock.Leave();
    return FALSE;
}

BOOL CSettings::RequestItemLock | ( | CSyncMgrHandler * | pLockHandler,
 |  | REFSYNCMGRITEMID | ItemID
 | ) |  |

Definition at line 263 of file Settings.Cpp.

{
LPSAMPLEITEMSETTINGS pItemSettings;
CLock clock(this);

    clock.Enter();

    pItemSettings = FindItemSettings(ItemID);

    if (pItemSettings && !(pItemSettings->fSyncLock))
    {
        Assert(NULL == pItemSettings->pLockHandler);

        pItemSettings->fSyncLock = TRUE;
        pItemSettings->pLockHandler = pLockHandler;

        clock.Leave();
        return TRUE;
    }

    clock.Leave();
    return FALSE;
}

STDMETHODIMP CSettings::ShowItemProperties | ( | HWND | hWndParent,
 |  | BOOL | fNew,
 |  | LPSAMPLEITEMSETTINGS | pItemSettings,
 |  | SYNCMGRITEMID | ItemID |
 | ) |  |  | [private]

Definition at line 650 of file Settings.Cpp.

{
HRESULT hr = NOERROR;
PROPSHEETPAGE psp [1];
HPROPSHEETPAGE hpsp [1];
PROPSHEETHEADER psh;
ITEMCONFIGSETTINGSLPARAM ItemConfiglParam;
TCHAR szLocalDisplayNameBuf[MAX_SYNCMGRITEMNAME];
TCHAR *pDisplayName;
WCHAR *pwszDisplayName = NULL;
CLock clock(this);

    ItemConfiglParam.pSettings = this;
    ItemConfiglParam.hr = NOERROR;

    ItemConfiglParam.fNewItem = fNewItem;

    // if new item save to use settings, else use ItemID and look up
    // in list when need in case item deleted by someone else.

    clock.Enter(); // setup lock to get the display Name.

    if (fNewItem)
    {
        Assert(pItemSettings);
        ItemConfiglParam.pItemSettings = pItemSettings;
        ItemConfiglParam.ItemID = GUID_NULL;

        pwszDisplayName = pItemSettings->syncmgrItem.wszItemName;
    }
    else
    {
    LPSAMPLEITEMSETTINGS pTempItemSettings;

        Assert(NULL == pItemSettings);
        ItemConfiglParam.pItemSettings = NULL;
        ItemConfiglParam.ItemID = ItemID;

        if (pTempItemSettings = FindItemSettings(ItemID))
        {
            pwszDisplayName = pTempItemSettings->syncmgrItem.wszItemName;
        }
    }

    // convert the display name before release lock to properly handler
    // existing items.
    pDisplayName = szLocalDisplayNameBuf;
    *szLocalDisplayNameBuf = NULL;

    if (pwszDisplayName)
    {
    #if _UNICODE
         lstrcpy(szLocalDisplayNameBuf,pwszDisplayName);
    #else
        WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK,
                            pwszDisplayName,
                            -1, szLocalDisplayNameBuf,MAX_SYNCMGRITEMNAME, NULL, NULL);

    #endif // _UNICODE
    }

    clock.Leave();

    memset(psp,0,sizeof(psp));
    memset(&psh,0,sizeof(psh));

    psp[0].dwSize = sizeof (psp[0]);
    psp[0].dwFlags = PSP_DEFAULT | PSP_USETITLE;
    psp[0].hInstance = g_hmodThisDll;
    psp[0].pszTemplate = MAKEINTRESOURCE(IDD_ITEMCONFIGDIALOG);
    psp[0].pszIcon = NULL;
    psp[0].pfnDlgProc = (DLGPROC) ItemConfigDlgProc;
    psp[0].pszTitle = MAKEINTRESOURCE(IDS_ITEMCONFIG_TAB);
    psp[0].lParam = (LPARAM) &ItemConfiglParam;

    if (hpsp[0] = CreatePropertySheetPage(&(psp[0])))
    {

        psh.dwSize = sizeof (psh);
        psh.dwFlags = PSH_DEFAULT | PSH_USEHICON;
        psh.hwndParent = hWndParent;
        psh.hInstance = g_hmodThisDll;
        psh.pszIcon = NULL;
        psh.hIcon =  LoadIcon(g_hmodThisDll, MAKEINTRESOURCE(IDI_SAMPLEHANDLERITEMICON));
        psh.pszCaption = pDisplayName;
        psh.nPages = 1;
        psh.phpage = hpsp;
        psh.pfnCallback = NULL;
        psh.nStartPage = 0;

        PropertySheet(&psh);

        hr = ItemConfiglParam.hr;
    }

    return hr;
}

STDMETHODIMP CSettings::ShowProperties | ( | HWND | hWndParent,
 |  | REFSYNCMGRITEMID | ItemID
 | ) |  |

Definition at line 181 of file Settings.Cpp.

{
HRESULT hr = NOERROR;
DWORD dwResult;
CLock clock(this);

    clock.Enter();
    ReadSettings(FALSE /* fForce */); // make sure settings are read in.a
    clock.Leave();

    if (GUID_NULL == ItemID)
    {
    PROPSHEETPAGE psp [1];
    HPROPSHEETPAGE hpsp [1];
    PROPSHEETHEADER psh;
    CONFIGSETTINGSLPARAM configlParam;

        configlParam.pSettings = this;
        configlParam.hr = NOERROR;

        memset(psp,0,sizeof(psp));
        memset(&psh,0,sizeof(psh));

        psp[0].dwSize = sizeof (psp[0]);
        psp[0].dwFlags = PSP_DEFAULT | PSP_USETITLE;
        psp[0].hInstance = g_hmodThisDll;
        psp[0].pszTemplate = MAKEINTRESOURCE(IDD_CONFIGDIALOG);
        psp[0].pszIcon = NULL;
        psp[0].pfnDlgProc = (DLGPROC) ConfigureDlgProc;
        psp[0].pszTitle = MAKEINTRESOURCE(IDS_CONFIG_TAB);
        psp[0].lParam = (LPARAM) &configlParam;

        if (hpsp[0] = CreatePropertySheetPage(&(psp[0])))
        {

            psh.dwSize = sizeof (psh);
            psh.dwFlags = PSH_DEFAULT | PSH_USEHICON;
            psh.hwndParent = hWndParent;
            psh.hInstance = g_hmodThisDll;
            psh.pszIcon = NULL;
            psh.hIcon =  LoadIcon(g_hmodThisDll, MAKEINTRESOURCE(IDI_SAMPLEHANDLERICON));
            psh.pszCaption = MAKEINTRESOURCE(IDS_CONFIG_TITLE);
            psh.nPages = 1;
            psh.phpage = hpsp;
            psh.pfnCallback = NULL;
            psh.nStartPage = 0;

            dwResult = (DWORD)PropertySheet(&psh);

            hr = configlParam.hr;
        }

    }
    else
    {
        if (S_OK == ShowItemProperties(hWndParent,FALSE /*fNewItem */,
                    NULL,ItemID))
        {
            hr = S_SYNCMGR_ENUMITEMS;
        }
    }

    return hr;
}

CSettings::STDMETHODIMP_ ( ULONG )
CSettings::STDMETHODIMP_ ( ULONG )
BOOL CSettings::WriteItemSettings ( LPSAMPLEITEMSETTINGS pSampleItemSettings ) [private]

Definition at line 557 of file Settings.Cpp.

{

    ASSERT_LOCKHELD(this);

    Reg_SetItemSettingsForHandlerItem(CLSID_SyncMgrHandler,
                        pSampleItemSettings->syncmgrItem.ItemID,
                        pSampleItemSettings);

    return TRUE;
}

Friends And Related Function Documentation

BOOL CALLBACK ConfigureDlgProc | ( | HWND | hDlg,
 |  | UINT | uMessage,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [friend]

Definition at line 1356 of file Settings.Cpp.

{
WORD wNotifyCode = HIWORD(wParam); // notification code
BOOL bResult = FALSE;
CONFIGSETTINGSLPARAM *pConfigSettingslParam = (CONFIGSETTINGSLPARAM *) GetWindowLongPtr(hWnd,DWLP_USER);

    if (WM_INITDIALOG == uMessage)
    {
        pConfigSettingslParam =  (CONFIGSETTINGSLPARAM *) ((PROPSHEETPAGE *) lParam)->lParam;
        SetWindowLongPtr(hWnd, DWLP_USER, (LONG_PTR) pConfigSettingslParam);

        pConfigSettingslParam->pSettings->OnConfigDlgInit(hWnd,pConfigSettingslParam,uMessage,wParam,lParam);
    }
    else if (pConfigSettingslParam)
    {
        switch (uMessage)
        {
            case WM_DESTROY:
                pConfigSettingslParam->pSettings->OnConfigDlgDestroy(hWnd,pConfigSettingslParam,uMessage,wParam,lParam);
            break;
            case WM_NOTIFY:
                switch (((NMHDR FAR *)lParam)->code)
                {
                    case PSN_APPLY:

                        // if anything changed mark OK even if later cancel, can't undo
                        break;
                  default:
                        pConfigSettingslParam->pSettings->OnConfigDlgNotify(hWnd,pConfigSettingslParam,uMessage,wParam,lParam);
                     break;
                }
                break;
        case WM_COMMAND:
                pConfigSettingslParam->pSettings->OnConfigDlgCommand(hWnd,pConfigSettingslParam,uMessage,wParam,lParam);
            break;
        default:
                break;
        }
    }

    return bResult;
}

BOOL CALLBACK ItemConfigDlgProc | ( | HWND | hDlg,
 |  | UINT | uMessage,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [friend]

Definition at line 1724 of file Settings.Cpp.

{
WORD wNotifyCode = HIWORD(wParam); // notification code
BOOL bResult = FALSE;
ITEMCONFIGSETTINGSLPARAM *pItemConfigDlglParam = (ITEMCONFIGSETTINGSLPARAM *) GetWindowLongPtr(hWnd,DWLP_USER);

    if (WM_INITDIALOG == uMessage)
    {
        pItemConfigDlglParam =  (ITEMCONFIGSETTINGSLPARAM *) ((PROPSHEETPAGE *) lParam)->lParam;
        SetWindowLongPtr(hWnd, DWLP_USER, (LONG_PTR) pItemConfigDlglParam);

        pItemConfigDlglParam->pSettings->OnItemConfigDlgInit(hWnd,pItemConfigDlglParam,uMessage,wParam,lParam);

    }
    else if (pItemConfigDlglParam)
    {
        switch (uMessage)
        {
            case WM_DESTROY:
                pItemConfigDlglParam->pSettings->OnItemConfigDlgDestroy(hWnd,pItemConfigDlglParam,uMessage,wParam,lParam);
            break;
            case WM_NOTIFY:
                switch (((NMHDR FAR *)lParam)->code)
                {
                    case PSN_APPLY:

                        // after a successful apply the item has changed.
                        // so set return value to S_OK:
                        if (pItemConfigDlglParam->pSettings->OnItemConfigDlgApply(hWnd,pItemConfigDlglParam,uMessage,wParam,lParam))
                        {
                           SetWindowLongPtr(hWnd,DWLP_MSGRESULT,PSNRET_NOERROR);
                        }
                        else
                        {
                            SetWindowLongPtr(hWnd,DWLP_MSGRESULT,PSNRET_INVALID);
                        }

                        return TRUE; // !!!return true so SetWindowLong DWL_MSGRESULT is applied
                        break;
                    default:
                        pItemConfigDlglParam->pSettings->OnItemConfigDlgNotify(hWnd,pItemConfigDlglParam,uMessage,wParam,lParam);
                        break;
                }
                break;
        case WM_COMMAND:
                pItemConfigDlglParam->pSettings->OnItemConfigDlgCommand(hWnd,pItemConfigDlglParam,uMessage,wParam,lParam);
        break;
        default:
                break;
        }
    }

    return bResult;
}

Member Data Documentation

LONG CSettings::m_cRefs [private]

Definition at line 151 of file Settings.h.

LPGENERICITEMLIST CSettings::m_pHandlerItems [private]

Definition at line 150 of file Settings.h.

The documentation for this class was generated from the following files:
  • NetDS/SyncMgr/SyncDir/Settings.h
  • NetDS/SyncMgr/SyncDir/Settings.Cpp
Generated on Wed Nov 13 2024 16:57:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSharp_Draw::Form1 Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • CSharp_Draw
  • CSharp_Draw::Form1
Public Member Functions | Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes

CSharp_Draw::Form1 Class Reference

Form1 is the main form for sending and receiving Drawing commands using MSMQ. More...

List of all members.

Public Member Functions

Form1 ()
override void | Dispose ()

Public Attributes

System.Drawing.Pen | BlackPen
System.Drawing.Brush | brushText
System.Drawing.Color | Color
System.Drawing.FontFamily | fontfamilyText
System.Drawing.Font | fontText
System.Drawing.Graphics | picture1Graphics
string | strName

Private Member Functions

void | AddLine (Util.line lineToDraw, System.Drawing.Graphics PG)
void | btnAttach_Click (object sender, System.EventArgs e)
void | btnCancel_Click (object sender, System.EventArgs e)
void | btnConnect_Click (object sender, System.EventArgs e)
void | DrawChar (string strCharToDraw)
void | DrawLine (Util.line lineToDraw, System.Drawing.Graphics PG)
void | InitializeComponent ()
void | picture1_MouseDown (object sender, System.Windows.Forms.MouseEventArgs e)
void | picture1_MouseMove (object sender, System.Windows.Forms.MouseEventArgs e)
void | picture1_MouseUp (object sender, System.Windows.Forms.MouseEventArgs e)
void | picture1_Paint (object sender, System.Windows.Forms.PaintEventArgs e)
void | qMe_ReceiveCompleted (object sender, System.Messaging.ReceiveCompletedEventArgs e)
void | textChars_KeyPress (object sender, System.Windows.Forms.KeyPressEventArgs e)
void | textFriendComputer_TextChanged (object sender, System.EventArgs e)
void | textFriendName_TextChanged (object sender, System.EventArgs e)

Static Private Member Functions

static void | Main ()

Private Attributes

bool | bDirectMode
bool | bDSEnabled
System.Windows.Forms.Button | btnAttach
System.Windows.Forms.Button | btnCancel
System.Windows.Forms.Button | btnConnect
System.ComponentModel.Container | components
System.Windows.Forms.GroupBox | groupConnectionMode
System.Windows.Forms.GroupBox | groupSendType
const string | guidDraw = "{151ceac0-acb5-11cf-8b51-0020af929546}"
Util.HelperFunctions | HP = new Util.HelperFunctions()
int | iLastX
int | iLastY
System.Windows.Forms.Label | lblDSConnection
System.Windows.Forms.Label | lblRemoteComputer
System.Windows.Forms.Label | lblRemoteQueue
ArrayList | lines = new ArrayList()
System.Windows.Forms.PictureBox | picture1
System.Messaging.MessageQueue | qFriend
System.Messaging.MessageQueue | qMe
System.Windows.Forms.RadioButton | radioDSDisabled
System.Windows.Forms.RadioButton | radioDSEnabled
System.Windows.Forms.RadioButton | radioSendExp
System.Windows.Forms.RadioButton | radioSendRec
System.Windows.Forms.TextBox | textChars
System.Windows.Forms.TextBox | textFriendComputer
System.Windows.Forms.TextBox | textFriendName

Detailed Description

Definition at line 66 of file form1.cs.

Constructor & Destructor Documentation

CSharp_Draw::Form1::Form1 ( ) [inline]

Definition at line 136 of file form1.cs.

    {
      //
      // Required for Windows Form Designer support
      //
      InitializeComponent();

      //
      // Prepare the Graphics elements for the drawing
      //

      picture1Graphics = picture1.CreateGraphics();
      Color = new System.Drawing.Color();
      BlackPen = new System.Drawing.Pen(Color.Black,1);
    }

Member Function Documentation

void CSharp_Draw::Form1::AddLine | ( | Util.line | lineToDraw,
 |  | System.Drawing.Graphics | PG |
 | ) |  |  | [inline, private]

Definition at line 523 of file form1.cs.

    {
      DrawLine(lineToDraw,PG);
      lines.Add(lineToDraw);
    }

void CSharp_Draw::Form1::btnAttach_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Definition at line 567 of file form1.cs.

    {
      MessageQueue[] mqlist;
      MessageQueueCriteria mqCriteria;

      if (textFriendName.Text == "")
      {
        MessageBox.Show("Please fill in queue name.","Missing value");
        return;
      }

      textFriendName.Text = textFriendName.Text.ToUpper();

      if (!bDirectMode)
      {
        //
        // Standard Connection mode = Working with public queues
        //

        mqCriteria = new MessageQueueCriteria();
        mqCriteria.Label=textFriendName.Text;
        mqCriteria.Category = new System.Guid(guidDraw);
        try
        {
          mqlist = MessageQueue.GetPublicQueues(mqCriteria);
        }
        catch(MessageQueueException MQE)
        {
          MessageBox.Show("An error occurred in locating the queue. ("+MQE.Message+")","C#_Draw");
          this.Close();
          return;
        }
        if (mqlist.Length == 0)
        {
          MessageBox.Show("Unable to locate queue.","C#_DRAW");
          return;
        }
        qFriend = mqlist[0];
        this.Text= strName + " - Connected to " + textFriendName.Text;
      }
      else
      {

        if (textFriendComputer.Text == "")
        {
          MessageBox.Show("Please fill in computer name.","Missing value");
          return;
        }

        textFriendComputer.Text = textFriendComputer.Text.ToUpper();

        /*
        When working in direct mode, we must use private queues. We are unable
        to know whether a given private queue on another computer exists or not,
        so here we will just assume that it does. To make the application more robust,
        an acknowledgement queue should be created on the local computer, and
        a request for acknowledgement messages should be added to the messages sent.
        Then the application can notify the user when a negative acknoledgement (NACK)
        message is received.
        */

        qFriend = new MessageQueue("FormatName:DIRECT=OS:" +
                       textFriendComputer.Text +
                                 @"\PRIVATE$\"+textFriendName.Text);
        this.Text = @".\PRIVATE$\"+strName + " - Connected to " +
              textFriendComputer.Text + @"\PRIVATE$\"+textFriendName.Text;
      }
      textChars.Enabled = true;
      picture1.Enabled = true;
      btnAttach.Enabled = false;
      return;
    }

void CSharp_Draw::Form1::btnCancel_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Definition at line 763 of file form1.cs.

    {
      this.Close();
    }

void CSharp_Draw::Form1::btnConnect_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Definition at line 651 of file form1.cs.

    {
      MessageQueue[] mqlist;
      MessageQueueCriteria mqCriteria;
      Cursor TempCursor;

      bDirectMode = radioDSDisabled.Checked;
      TempCursor = this.Cursor;
      this.Cursor = Cursors.WaitCursor;

      if (radioDSDisabled.Checked)
      { // User wants to use a private queue (direct connection).
        try
        {
          qMe=MessageQueue.Create(@".\private$\" + strName);
          qMe.Label = strName;
          qMe.Category = new System.Guid(guidDraw);

        }
        catch(MessageQueueException MQE)
        {
          qMe = new MessageQueue();
          qMe.Path = @".\private$\" + strName;
        }
      }
      else
      { // The user wants to use a public queue (standard mode)
        // so query the direcotry service for a public queue with the
        // user-specified name.
        mqCriteria = new MessageQueueCriteria();
        mqCriteria.Label=strName;
        mqCriteria.Category = new System.Guid(guidDraw);
        try
        {
          mqlist = MessageQueue.GetPublicQueues(mqCriteria);
        }
        catch(MessageQueueException MQE)
        {
          MessageBox.Show("An error occurred in locating the queue. ("+MQE.Message+")","C#_Draw");
          this.Close();
          return;
        }
        // If no such queue then create one
        if (mqlist.Length == 0)
        {
          try
          {
            MessageQueue.Create(@".\"+strName);
          }
          catch(MessageQueueException MQE)
          {
            MessageBox.Show("An error occurred in creating the queue. ("+MQE.Message+")","C#_Draw");
            this.Close();
            return;
          }
          qMe = new MessageQueue();
          qMe.Path = @".\"+strName;
          qMe.Label = strName;
          qMe.Category = new System.Guid(guidDraw);
        }
        else
        {
          qMe=mqlist[0];
        }
      }

      // Start receiving

      qMe.Formatter = new ActiveXMessageFormatter();
      qMe.ReceiveCompleted  += new ReceiveCompletedEventHandler(this.qMe_ReceiveCompleted);
      qMe.BeginReceive();

      groupConnectionMode.Visible = false;
      btnConnect.Visible=false;
      btnCancel.Visible=false;

      btnAttach.Visible=true;
      groupSendType.Visible=true;
      lblRemoteQueue.Visible=true;
      textFriendName.Visible=true;

      if (radioDSDisabled.Checked)
      {
        lblRemoteComputer.Visible=true;
        textFriendComputer.Visible=true;
      }

      this.Cursor = TempCursor;
      // Anyway, on the local computer, the connection to the Directory
      // service remains available
      lblDSConnection.Text = "MODE: Domain";
    }

override void CSharp_Draw::Form1::Dispose ( ) [inline]

Clean up any resources being used.

Definition at line 155 of file form1.cs.

    {
      base.Dispose();
      if(components != null)
        components.Dispose();
    }

void CSharp_Draw::Form1::DrawChar ( string strCharToDraw ) [inline, private]

Definition at line 547 of file form1.cs.

    {
      if (strCharToDraw == "\b")
      { // backspace
        if (textChars.Text.Length>0)
        {
          textChars.Text = textChars.Text.Substring(0,textChars.Text.Length -1);
        }
      }
      else
      {
        textChars.Text=textChars.Text+strCharToDraw;
      }
      return;
    }

void CSharp_Draw::Form1::DrawLine | ( | Util.line | lineToDraw,
 |  | System.Drawing.Graphics | PG |
 | ) |  |  | [inline, private]

Definition at line 514 of file form1.cs.

    {
      PG.DrawLine(BlackPen,
            lineToDraw.XFrom,
            lineToDraw.YFrom,
            lineToDraw.XTo,
            lineToDraw.YTo);
    }

void CSharp_Draw::Form1::InitializeComponent ( ) [inline, private]

Required method for Designer support - do not modify the contents of this method with the code editor.

Definition at line 167 of file form1.cs.

    {
      this.radioDSDisabled = new System.Windows.Forms.RadioButton();
      this.textChars = new System.Windows.Forms.TextBox();
      this.btnAttach = new System.Windows.Forms.Button();
      this.radioSendExp = new System.Windows.Forms.RadioButton();
      this.lblDSConnection = new System.Windows.Forms.Label();
      this.textFriendName = new System.Windows.Forms.TextBox();
      this.groupConnectionMode = new System.Windows.Forms.GroupBox();
      this.radioDSEnabled = new System.Windows.Forms.RadioButton();
      this.textFriendComputer = new System.Windows.Forms.TextBox();
      this.lblRemoteQueue = new System.Windows.Forms.Label();
      this.groupSendType = new System.Windows.Forms.GroupBox();
      this.radioSendRec = new System.Windows.Forms.RadioButton();
      this.btnCancel = new System.Windows.Forms.Button();
      this.picture1 = new System.Windows.Forms.PictureBox();
      this.btnConnect = new System.Windows.Forms.Button();
      this.lblRemoteComputer = new System.Windows.Forms.Label();
      this.groupConnectionMode.SuspendLayout();
      this.groupSendType.SuspendLayout();
      this.SuspendLayout();
      //
      // radioDSDisabled
      //
      this.radioDSDisabled.Location = new System.Drawing.Point(8, 56);
      this.radioDSDisabled.Name = "radioDSDisabled";
      this.radioDSDisabled.Size = new System.Drawing.Size(216, 16);
      this.radioDSDisabled.TabIndex = 1;
      this.radioDSDisabled.Text = "Private queue";
      //
      // textChars
      //
      this.textChars.Location = new System.Drawing.Point(16, 272);
      this.textChars.Name = "textChars";
      this.textChars.Size = new System.Drawing.Size(384, 20);
      this.textChars.TabIndex = 11;
      this.textChars.Text = "";
      this.textChars.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textChars_KeyPress);
      //
      // btnAttach
      //
      this.btnAttach.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
      this.btnAttach.Location = new System.Drawing.Point(312, 304);
      this.btnAttach.Name = "btnAttach";
      this.btnAttach.Size = new System.Drawing.Size(88, 24);
      this.btnAttach.TabIndex = 3;
      this.btnAttach.Text = "Start Sending";
      this.btnAttach.Click += new System.EventHandler(this.btnAttach_Click);
      //
      // radioSendExp
      //
      this.radioSendExp.Checked = true;
      this.radioSendExp.Location = new System.Drawing.Point(16, 24);
      this.radioSendExp.Name = "radioSendExp";
      this.radioSendExp.Size = new System.Drawing.Size(104, 16);
      this.radioSendExp.TabIndex = 0;
      this.radioSendExp.TabStop = true;
      this.radioSendExp.Text = "&Express";
      //
      // lblDSConnection
      //
      this.lblDSConnection.Location = new System.Drawing.Point(16, 384);
      this.lblDSConnection.Name = "lblDSConnection";
      this.lblDSConnection.Size = new System.Drawing.Size(100, 16);
      this.lblDSConnection.TabIndex = 7;
      //
      // textFriendName
      //
      this.textFriendName.Location = new System.Drawing.Point(160, 304);
      this.textFriendName.Name = "textFriendName";
      this.textFriendName.Size = new System.Drawing.Size(144, 20);
      this.textFriendName.TabIndex = 2;
      this.textFriendName.Text = "";
      this.textFriendName.TextChanged += new System.EventHandler(this.textFriendName_TextChanged);
      //
      // groupConnectionMode
      //
      this.groupConnectionMode.Controls.AddRange(new System.Windows.Forms.Control[] {
                                                this.radioDSDisabled,
                                                this.radioDSEnabled});
      this.groupConnectionMode.Location = new System.Drawing.Point(96, 304);
      this.groupConnectionMode.Name = "groupConnectionMode";
      this.groupConnectionMode.Size = new System.Drawing.Size(232, 96);
      this.groupConnectionMode.TabIndex = 10;
      this.groupConnectionMode.TabStop = false;
      this.groupConnectionMode.Text = "Queue Type";
      //
      // radioDSEnabled
      //
      this.radioDSEnabled.Checked = true;
      this.radioDSEnabled.Location = new System.Drawing.Point(8, 24);
      this.radioDSEnabled.Name = "radioDSEnabled";
      this.radioDSEnabled.Size = new System.Drawing.Size(208, 16);
      this.radioDSEnabled.TabIndex = 0;
      this.radioDSEnabled.TabStop = true;
      this.radioDSEnabled.Text = "Public queue";
      //
      // textFriendComputer
      //
      this.textFriendComputer.Location = new System.Drawing.Point(160, 336);
      this.textFriendComputer.Name = "textFriendComputer";
      this.textFriendComputer.Size = new System.Drawing.Size(144, 20);
      this.textFriendComputer.TabIndex = 6;
      this.textFriendComputer.Text = "";
      this.textFriendComputer.TextChanged += new System.EventHandler(this.textFriendComputer_TextChanged);
      //
      // lblRemoteQueue
      //
      this.lblRemoteQueue.Location = new System.Drawing.Point(16, 304);
      this.lblRemoteQueue.Name = "lblRemoteQueue";
      this.lblRemoteQueue.Size = new System.Drawing.Size(128, 16);
      this.lblRemoteQueue.TabIndex = 1;
      this.lblRemoteQueue.Text = "Send drawing to queue:";
      //
      // groupSendType
      //
      this.groupSendType.Controls.AddRange(new System.Windows.Forms.Control[] {
                                            this.radioSendRec,
                                            this.radioSendExp});
      this.groupSendType.Location = new System.Drawing.Point(256, 368);
      this.groupSendType.Name = "groupSendType";
      this.groupSendType.Size = new System.Drawing.Size(136, 72);
      this.groupSendType.TabIndex = 4;
      this.groupSendType.TabStop = false;
      this.groupSendType.Text = "Type of delivery";
      //
      // radioSendRec
      //
      this.radioSendRec.Location = new System.Drawing.Point(16, 48);
      this.radioSendRec.Name = "radioSendRec";
      this.radioSendRec.Size = new System.Drawing.Size(104, 16);
      this.radioSendRec.TabIndex = 0;
      this.radioSendRec.Text = "Recoverable";
      //
      // btnCancel
      //
      this.btnCancel.Location = new System.Drawing.Point(224, 408);
      this.btnCancel.Name = "btnCancel";
      this.btnCancel.Size = new System.Drawing.Size(104, 32);
      this.btnCancel.TabIndex = 9;
      this.btnCancel.Text = "Cancel";
      this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
      //
      // picture1
      //
      this.picture1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
      this.picture1.Location = new System.Drawing.Point(16, 8);
      this.picture1.Name = "picture1";
      this.picture1.Size = new System.Drawing.Size(383, 257);
      this.picture1.TabIndex = 0;
      this.picture1.TabStop = false;
      this.picture1.Paint += new System.Windows.Forms.PaintEventHandler(this.picture1_Paint);
      this.picture1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.picture1_MouseUp);
      this.picture1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.picture1_MouseMove);
      this.picture1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.picture1_MouseDown);
      //
      // btnConnect
      //
      this.btnConnect.Location = new System.Drawing.Point(96, 408);
      this.btnConnect.Name = "btnConnect";
      this.btnConnect.Size = new System.Drawing.Size(104, 32);
      this.btnConnect.TabIndex = 8;
      this.btnConnect.Text = "OK";
      this.btnConnect.Click += new System.EventHandler(this.btnConnect_Click);
      //
      // lblRemoteComputer
      //
      this.lblRemoteComputer.Location = new System.Drawing.Point(16, 336);
      this.lblRemoteComputer.Name = "lblRemoteComputer";
      this.lblRemoteComputer.Size = new System.Drawing.Size(144, 24);
      this.lblRemoteComputer.TabIndex = 5;
      this.lblRemoteComputer.Text = "Send drawing to computer:";
      //
      // Form1
      //
      this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
      this.ClientSize = new System.Drawing.Size(413, 450);
      this.Controls.AddRange(new System.Windows.Forms.Control[] {
                                      this.groupConnectionMode,
                                      this.textChars,
                                      this.btnCancel,
                                      this.btnConnect,
                                      this.lblDSConnection,
                                      this.textFriendComputer,
                                      this.groupSendType,
                                      this.btnAttach,
                                      this.textFriendName,
                                      this.lblRemoteQueue,
                                      this.picture1,
                                      this.lblRemoteComputer});
      this.Name = "Form1";
      this.Text = "Form1";
      this.groupConnectionMode.ResumeLayout(false);
      this.groupSendType.ResumeLayout(false);
      this.ResumeLayout(false);

    }

static void CSharp_Draw::Form1::Main ( ) [inline, static, private]

The main entry point for the application.

Definition at line 370 of file form1.cs.

    {
      string strResult;

      //
      // Get the name of the local drawing queue
      //
      InputBox dlg = new InputBox();
      dlg.ShowDialog();
      //
      // strResult holds the name of my drawing queue
      //
      strResult = dlg.textBoxName.Text.ToString().ToUpper();
      if ((!dlg.bResult) || (strResult == "")) return;

      Form1 F;
      F = new Form1();
      F.strName = strResult;
      F.Text = "Listening to: " + strResult;

      F.textChars.Enabled = false;
      F.picture1.Enabled = false;

      //
      // Check if we are running on a DS Enabled machine. This can be found in the Registry.
      //
      Microsoft.Win32.RegistryKey hKey;
      Int32 iWG;
      try
      {
        hKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\MSMQ\Parameters");
        iWG = (System.Int32)hKey.GetValue(@"Workgroup");
        Registry.LocalMachine.Close();
        if (iWG == 0)
        {
          F.bDSEnabled = true;
        }
        else
        {
          F.bDSEnabled = false;
        }
      }
      catch(Exception e)
      {
        F.bDSEnabled = true;
      }

      if (F.bDSEnabled)
      {
        F.btnAttach.Visible = false;
        F.groupSendType.Visible = false;
        F.lblRemoteComputer.Visible=false;
        F.lblRemoteQueue.Visible=false;
        F.textFriendComputer.Visible=false;
        F.textFriendName.Visible=false;
      }
      else
      {
        F.bDirectMode = true;
        F.lblDSConnection.Text = "MODE: Workgroup";
        F.groupConnectionMode.Visible = false;
        F.btnCancel.Visible = false;
        F.btnConnect.Visible = false;

        try
        {
          F.qMe=MessageQueue.Create(@".\private$\" + F.strName);
          F.qMe.Label = F.strName;
          F.qMe.Category = new System.Guid(guidDraw);
        }
        catch(MessageQueueException MQE)
        {
          F.qMe = new MessageQueue();
          F.qMe.Path = @".\private$\" + strResult;
        }
        //
        // Start Async - Receiving
        //
        F.qMe.Formatter = new ActiveXMessageFormatter();
        F.qMe.ReceiveCompleted  += new ReceiveCompletedEventHandler(F.qMe_ReceiveCompleted);
        F.qMe.BeginReceive();
      }

      Application.Run(F);
    }

void CSharp_Draw::Form1::picture1_MouseDown | ( | object | sender,
 |  | System.Windows.Forms.MouseEventArgs | e |
 | ) |  |  | [inline, private]

Definition at line 459 of file form1.cs.

    {
      if ((e.Button!=MouseButtons.Left) || (e.X <= 0) || (e.Y <= 0)) return;

      iLastX = e.X;
      iLastY = e.Y;
    }

void CSharp_Draw::Form1::picture1_MouseMove | ( | object | sender,
 |  | System.Windows.Forms.MouseEventArgs | e |
 | ) |  |  | [inline, private]

Definition at line 467 of file form1.cs.

    {
      if ((e.Button!=MouseButtons.Left) || (e.X <= 0) || (e.Y <= 0)) return;

      Util.line lineToDraw = new Util.line();
      lineToDraw.XFrom=iLastX;
      lineToDraw.YFrom=iLastY;
      lineToDraw.XTo=e.X;
      lineToDraw.YTo=e.Y;
      AddLine(lineToDraw,picture1Graphics);
      iLastX=e.X;
      iLastY=e.Y;

      if (qFriend == null) return;

      System.Messaging.Message SendMsg;
      SendMsg = new System.Messaging.Message();
      SendMsg.Formatter = new ActiveXMessageFormatter();
      SendMsg.Priority=MessagePriority.Normal;
      SendMsg.Body=HP.LineToString(lineToDraw.XFrom,
                     lineToDraw.YFrom,
                     lineToDraw.XTo,
                     lineToDraw.YTo);
      SendMsg.Label=lineToDraw.XFrom.ToString()+","+
                  lineToDraw.YFrom.ToString()+" To "+
                  lineToDraw.XTo.ToString()+","+
                  lineToDraw.YTo.ToString();
      SendMsg.Recoverable = radioSendRec.Checked;
      qFriend.Send(SendMsg);

    }

void CSharp_Draw::Form1::picture1_MouseUp | ( | object | sender,
 |  | System.Windows.Forms.MouseEventArgs | e |
 | ) |  |  | [inline, private]

Definition at line 501 of file form1.cs.

    {
      if (e.Button!=MouseButtons.Right) return;

      picture1Graphics.Clear(picture1.BackColor);
      lines.Clear();
      textChars.Text = "";
    }

void CSharp_Draw::Form1::picture1_Paint | ( | object | sender,
 |  | System.Windows.Forms.PaintEventArgs | e |
 | ) |  |  | [inline, private]

Definition at line 643 of file form1.cs.

    {
      int i;
      for (i=0;i<lines.Count;i++)
      {
        DrawLine((Util.line)lines[i],e.Graphics);
      }
    }

void CSharp_Draw::Form1::qMe_ReceiveCompleted | ( | object | sender,
 |  | System.Messaging.ReceiveCompletedEventArgs | e |
 | ) |  |  | [inline, private]

Definition at line 747 of file form1.cs.

    {
      Util.line lineToDraw = new Util.line();
      MessageQueue mq = (MessageQueue)sender;
      System.Messaging.Message m = mq.EndReceive(e.AsyncResult);
      if (m.Body.ToString().Length==1)
      { // Draw a char
        DrawChar(m.Body.ToString());
      }
      else
      { // Draw a line
        HP.StringToLine(m.Body.ToString(),ref lineToDraw);
        AddLine(lineToDraw,picture1Graphics);
      }
      mq.BeginReceive();
    }

void CSharp_Draw::Form1::textChars_KeyPress | ( | object | sender,
 |  | System.Windows.Forms.KeyPressEventArgs | e |
 | ) |  |  | [inline, private]

Definition at line 533 of file form1.cs.

    {
            if (qFriend == null) return;

      System.Messaging.Message SendMsg;
      SendMsg = new System.Messaging.Message();
      SendMsg.Formatter = new ActiveXMessageFormatter();
      SendMsg.Priority=MessagePriority.AboveNormal;
      SendMsg.Body=e.KeyChar.ToString();
      SendMsg.Label="Key: "+e.KeyChar.ToString();
      SendMsg.Recoverable = radioSendRec.Checked;
      qFriend.Send(SendMsg);
    }

void CSharp_Draw::Form1::textFriendComputer_TextChanged | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Definition at line 768 of file form1.cs.

    {
      btnAttach.Enabled = true;
    }

void CSharp_Draw::Form1::textFriendName_TextChanged | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Definition at line 773 of file form1.cs.

    {
      btnAttach.Enabled = true;
    }

Member Data Documentation

bool CSharp_Draw::Form1::bDirectMode [private]

Definition at line 113 of file form1.cs.

bool CSharp_Draw::Form1::bDSEnabled [private]

Definition at line 112 of file form1.cs.

System.Drawing.Pen CSharp_Draw::Form1::BlackPen

Definition at line 100 of file form1.cs.

System.Drawing.Brush CSharp_Draw::Form1::brushText

Definition at line 103 of file form1.cs.

System.Windows.Forms.Button CSharp_Draw::Form1::btnAttach [private]

Definition at line 117 of file form1.cs.

System.Windows.Forms.Button CSharp_Draw::Form1::btnCancel [private]

Definition at line 127 of file form1.cs.

System.Windows.Forms.Button CSharp_Draw::Form1::btnConnect [private]

Definition at line 126 of file form1.cs.

System.Drawing.Color CSharp_Draw::Form1::Color

Definition at line 101 of file form1.cs.

System.ComponentModel.Container CSharp_Draw::Form1::components [private]

Definition at line 134 of file form1.cs.

System.Drawing.FontFamily CSharp_Draw::Form1::fontfamilyText

Definition at line 104 of file form1.cs.

System.Drawing.Font CSharp_Draw::Form1::fontText

Definition at line 102 of file form1.cs.

System.Windows.Forms.GroupBox CSharp_Draw::Form1::groupConnectionMode [private]

Definition at line 128 of file form1.cs.

System.Windows.Forms.GroupBox CSharp_Draw::Form1::groupSendType [private]

Definition at line 119 of file form1.cs.

const string CSharp_Draw::Form1::guidDraw = "{151ceac0-acb5-11cf-8b51-0020af929546}" [private]

Definition at line 84 of file form1.cs.

Util.HelperFunctions CSharp_Draw::Form1::HP = new Util.HelperFunctions() [private]

Definition at line 116 of file form1.cs.

int CSharp_Draw::Form1::iLastX [private]

Required designer variable.

Definition at line 76 of file form1.cs.

int CSharp_Draw::Form1::iLastY [private]

Definition at line 77 of file form1.cs.

System.Windows.Forms.Label CSharp_Draw::Form1::lblDSConnection [private]

Definition at line 125 of file form1.cs.

System.Windows.Forms.Label CSharp_Draw::Form1::lblRemoteComputer [private]

Definition at line 124 of file form1.cs.

System.Windows.Forms.Label CSharp_Draw::Form1::lblRemoteQueue [private]

Definition at line 123 of file form1.cs.

ArrayList CSharp_Draw::Form1::lines = new ArrayList() [private]

Definition at line 92 of file form1.cs.

System.Windows.Forms.PictureBox CSharp_Draw::Form1::picture1 [private]

Definition at line 132 of file form1.cs.

System.Drawing.Graphics CSharp_Draw::Form1::picture1Graphics

Definition at line 99 of file form1.cs.

System.Messaging.MessageQueue CSharp_Draw::Form1::qFriend [private]

Definition at line 110 of file form1.cs.

System.Messaging.MessageQueue CSharp_Draw::Form1::qMe [private]

Definition at line 111 of file form1.cs.

System.Windows.Forms.RadioButton CSharp_Draw::Form1::radioDSDisabled [private]

Definition at line 129 of file form1.cs.

System.Windows.Forms.RadioButton CSharp_Draw::Form1::radioDSEnabled [private]

Definition at line 130 of file form1.cs.

System.Windows.Forms.RadioButton CSharp_Draw::Form1::radioSendExp [private]

Definition at line 121 of file form1.cs.

System.Windows.Forms.RadioButton CSharp_Draw::Form1::radioSendRec [private]

Definition at line 120 of file form1.cs.

string CSharp_Draw::Form1::strName

Definition at line 85 of file form1.cs.

System.Windows.Forms.TextBox CSharp_Draw::Form1::textChars [private]

Definition at line 131 of file form1.cs.

System.Windows.Forms.TextBox CSharp_Draw::Form1::textFriendComputer [private]

Definition at line 122 of file form1.cs.

System.Windows.Forms.TextBox CSharp_Draw::Form1::textFriendName [private]

Definition at line 118 of file form1.cs.

The documentation for this class was generated from the following file:
  • NetDS/MessageQueuing/csharp_draw/form1.cs
Generated on Wed Nov 13 2024 16:58:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSharp_Draw::InputBox Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • CSharp_Draw
  • CSharp_Draw::InputBox
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes

CSharp_Draw::InputBox Class Reference

Summary description for InputBox.

List of all members.

Public Member Functions

InputBox ()
override void | Dispose ()

Public Attributes

bool | bResult
System.Windows.Forms.TextBox | textBoxName

Private Member Functions

void | btnCancel_Click (object sender, System.EventArgs e)
void | btnOK_Click (object sender, System.EventArgs e)
void | InitializeComponent ()

Private Attributes

System.Windows.Forms.Button | btnCancel
System.Windows.Forms.Button | btnOK
System.ComponentModel.Container | components
System.Windows.Forms.Label | label1

Detailed Description

Definition at line 23 of file inputbox.cs.

Constructor & Destructor Documentation

CSharp_Draw::InputBox::InputBox ( ) [inline]

Definition at line 35 of file inputbox.cs.

    {
      //
      // Required for Windows Form Designer support
      //
      InitializeComponent();

      //
      // TODO: Add any constructor code after InitializeComponent call
      //
      bResult=false;
      textBoxName.Text=System.Environment.ExpandEnvironmentVariables("%USERNAME%");
    }

Member Function Documentation

void CSharp_Draw::InputBox::btnCancel_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Definition at line 101 of file inputbox.cs.

    {
      this.Close();
    }

void CSharp_Draw::InputBox::btnOK_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Definition at line 106 of file inputbox.cs.

    {
      bResult = true;
      this.Close();
    }

override void CSharp_Draw::InputBox::Dispose ( ) [inline]

Clean up any resources being used.

Definition at line 52 of file inputbox.cs.

    {
      base.Dispose();
      components.Dispose();
    }

void CSharp_Draw::InputBox::InitializeComponent ( ) [inline, private]

Required method for Designer support - do not modify the contents of this method with the code editor.

Definition at line 63 of file inputbox.cs.

    {
      this.textBoxName = new System.Windows.Forms.TextBox();
      this.btnCancel = new System.Windows.Forms.Button();
      this.label1 = new System.Windows.Forms.Label();
      this.btnOK = new System.Windows.Forms.Button();
      this.textBoxName.Location = new System.Drawing.Point(8, 96);
      this.textBoxName.Size = new System.Drawing.Size(336, 20);
      this.textBoxName.TabIndex = 1;
      this.textBoxName.Text = "";
      this.btnCancel.Location = new System.Drawing.Point(296, 48);
      this.btnCancel.Size = new System.Drawing.Size(48, 24);
      this.btnCancel.TabIndex = 3;
      this.btnCancel.Text = "Cancel";
      this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
      this.label1.Location = new System.Drawing.Point(8, 16);
      this.label1.Size = new System.Drawing.Size(280, 24);
      this.label1.TabIndex = 0;
      this.label1.Text = "Enter the name of the local input queue for drawings:";
      this.btnOK.Location = new System.Drawing.Point(296, 16);
      this.btnOK.Size = new System.Drawing.Size(48, 24);
      this.btnOK.TabIndex = 2;
      this.btnOK.Text = "OK";
      this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
      this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
      this.BorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
      this.ClientSize = new System.Drawing.Size(357, 131);
      this.Controls.AddRange(new System.Windows.Forms.Control[] {this.btnCancel,
                                      this.btnOK,
                                      this.textBoxName,
                                      this.label1});
      this.MaximizeBox = false;
      this.MinimizeBox = false;
      this.Text = "C#_Draw: Input Queue Name";

    }

Member Data Documentation

bool CSharp_Draw::InputBox::bResult

Definition at line 29 of file inputbox.cs.

System.Windows.Forms.Button CSharp_Draw::InputBox::btnCancel [private]

Definition at line 27 of file inputbox.cs.

System.Windows.Forms.Button CSharp_Draw::InputBox::btnOK [private]

Definition at line 25 of file inputbox.cs.

System.ComponentModel.Container CSharp_Draw::InputBox::components [private]

Required designer variable.

Definition at line 33 of file inputbox.cs.

System.Windows.Forms.Label CSharp_Draw::InputBox::label1 [private]

Definition at line 26 of file inputbox.cs.

System.Windows.Forms.TextBox CSharp_Draw::InputBox::textBoxName

Definition at line 28 of file inputbox.cs.

The documentation for this class was generated from the following file:
  • NetDS/MessageQueuing/csharp_draw/inputbox.cs
Generated on Wed Nov 13 2024 16:58:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CShellExt Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes

CShellExt Class Reference

#include "ShellExt.h"

List of all members.

Public Member Functions

CShellExt ()
~CShellExt ()
STDMETHODIMP | AddPages (LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam)
STDMETHODIMP | Extract (LPCSTR pszFile, UINT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize)
STDMETHODIMP | GetClassID (LPCLSID lpClassID)
STDMETHODIMP | GetCommandString (UINT_PTR idCmd, UINT uFlags, UINT FAR *reserved, LPSTR pszName, UINT cchMax)
STDMETHODIMP | GetCurFile (LPOLESTR FAR *lplpszFileName)
STDMETHODIMP | GetIconLocation (UINT uFlags, LPSTR szIconFile, UINT cchMax, int *piIndex, UINT *pwFlags)
STDMETHODIMP | Initialize (LPCITEMIDLIST pIDFolder, LPDATAOBJECT pDataObj, HKEY hKeyID)
STDMETHODIMP | InvokeCommand (LPCMINVOKECOMMANDINFO lpcmi)
STDMETHODIMP | IsDirty ()
STDMETHODIMP | Load (LPCOLESTR lpszFileName, DWORD grfMode)
STDMETHODIMP | QueryContextMenu (HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags)
STDMETHODIMP | QueryInterface (REFIID, LPVOID FAR *)
STDMETHODIMP | ReplacePage (UINT uPageID, LPFNADDPROPSHEETPAGE lpfnReplaceWith, LPARAM lParam)
STDMETHODIMP | Save (LPCOLESTR lpszFileName, BOOL fRemember)
STDMETHODIMP | SaveCompleted (LPCOLESTR lpszFileName)
STDMETHODIMP_ (UINT) CopyCallback(HWND hwnd
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()

Public Attributes

UINT UINT LPCSTR DWORD LPCSTR DWORD | dwDestAttribs
UINT UINT LPCSTR DWORD | dwSrcAttribs
char | m_szPropSheetFileUserClickedOn [MAX_PATH]
UINT UINT LPCSTR DWORD LPCSTR | pszDestFile
UINT UINT LPCSTR | pszSrcFile
UINT UINT wFlags
UINT wFunc

Protected Member Functions

STDMETHODIMP | DoGAKMenu1 (HWND hParent, LPCSTR pszWorkingDir, LPCSTR pszCmd, LPCSTR pszParam, int iShowCmd)
STDMETHODIMP | DoGAKMenu2 (HWND hParent, LPCSTR pszWorkingDir, LPCSTR pszCmd, LPCSTR pszParam, int iShowCmd)
STDMETHODIMP | DoGAKMenu3 (HWND hParent, LPCSTR pszWorkingDir, LPCSTR pszCmd, LPCSTR pszParam, int iShowCmd)
STDMETHODIMP | DoGAKMenu4 (HWND hParent, LPCSTR pszWorkingDir, LPCSTR pszCmd, LPCSTR pszParam, int iShowCmd)

Protected Attributes

ULONG m_cRef
LPDATAOBJECT | m_pDataObj
char | m_szFileUserClickedOn [MAX_PATH]

Detailed Description

Definition at line 43 of file ShellExt.h.

Constructor & Destructor Documentation

CShellExt::CShellExt ( )

Definition at line 159 of file ShellExt.Cpp.

{
    ODS("CShellExt::CShellExt()\r\n");

    m_cRef = 0L;
    m_pDataObj = NULL;

    g_cRefThisDll++;
}

CShellExt::~CShellExt ( )

Definition at line 169 of file ShellExt.Cpp.

{
    if (m_pDataObj)
        m_pDataObj->Release();

    g_cRefThisDll--;
}

Member Function Documentation

STDMETHODIMP CShellExt::AddPages | ( | LPFNADDPROPSHEETPAGE | lpfnAddPage,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 193 of file PropShet.Cpp.

{
    PROPSHEETPAGE psp;
    HPROPSHEETPAGE hpage;

    ODS("CShellExt::AddPages()\r\n");

    FORMATETC fmte = {CF_HDROP,
                      (DVTARGETDEVICE FAR *)NULL,
                      DVASPECT_CONTENT,
                      -1,
                      TYMED_HGLOBAL
                     };
    STGMEDIUM medium;
    HRESULT hres = 0;

    if (m_pDataObj)  //Paranoid check, m_pDataObj should have something by now...
       hres = m_pDataObj->GetData(&fmte, &medium);

    if (SUCCEEDED(hres))
    {
        //Find out how many files the user has selected...
        UINT cbFiles = 0;
        LPCSHELLEXT lpcsext = this;

        if (medium.hGlobal)
            cbFiles = DragQueryFile((HDROP)medium.hGlobal, (UINT)-1, 0, 0);

        if (cbFiles < 2)
        {
            //OK, the user has only selected a single file, so lets go ahead
            //and add the property sheet.  Note that it doesn't HAVE to be this
            //way, but for simplicity and educational reasons, I'll only add
            //the property sheet if a single .GAK file is selected.

            //Get the name of the file the user has clicked on
            if (cbFiles)
               DragQueryFile((HDROP)medium.hGlobal,
                             0,
                             m_szPropSheetFileUserClickedOn,
                             sizeof(m_szPropSheetFileUserClickedOn));

            //
            // Create a property sheet page object from a dialog box.
            //
            // We store a pointer to our class in the psp.lParam, so we
            // can access our class members from within the GAKPageDlgProc
            //
            // If the page needs more instance data, you can append
            // arbitrary size of data at the end of this structure,
            // and pass it to the CreatePropSheetPage. In such a case,
            // the size of entire data structure (including page specific
            // data) must be stored in the dwSize field.   Note that in
            // general you should NOT need to do this, as you can simply
            // store a pointer to date in the lParam member.
            //

            psp.dwSize      = sizeof(psp);  // no extra data.
            psp.dwFlags     = PSP_USEREFPARENT | PSP_USETITLE | PSP_USECALLBACK;
            psp.hInstance   = g_hmodThisDll;
            psp.pszTemplate = MAKEINTRESOURCE(IDD_GAKPAGE);
            psp.hIcon       = 0;
            psp.pszTitle    = "GAK Color";
            psp.pfnDlgProc  = GAKPageDlgProc;
            psp.pcRefParent = &g_cRefThisDll;
            psp.pfnCallback = GAKPageCallback;
            psp.lParam      = (LPARAM)lpcsext;

            AddRef();
            hpage = CreatePropertySheetPage(&psp);

            if (hpage)
            {
                if (!lpfnAddPage(hpage, lParam))
                {
                    DestroyPropertySheetPage(hpage);
                    Release();
                }
            }
        }
    }

    return NOERROR;
}

STDMETHODIMP CShellExt::DoGAKMenu1 | ( | HWND | hParent,
 |  | LPCSTR | pszWorkingDir,
 |  | LPCSTR | pszCmd,
 |  | LPCSTR | pszParam,
 |  | int | iShowCmd |
 | ) |  |  | [protected]

Definition at line 252 of file CtxMenu.Cpp.

{
    ODS("CShellExt::DoGAKMenu1()\r\n");

    MessageBox(hParent, "Menu item 1!", "Shell Extension Sample", MB_OK);

    return NOERROR;
}

STDMETHODIMP CShellExt::DoGAKMenu2 | ( | HWND | hParent,
 |  | LPCSTR | pszWorkingDir,
 |  | LPCSTR | pszCmd,
 |  | LPCSTR | pszParam,
 |  | int | iShowCmd |
 | ) |  |  | [protected]

Definition at line 265 of file CtxMenu.Cpp.

{
    ODS("CShellExt::DoGAKMenu2()\r\n");

    MessageBox(hParent, "Menu item 2!", "Shell Extension Sample", MB_OK);

    return NOERROR;
}

STDMETHODIMP CShellExt::DoGAKMenu3 | ( | HWND | hParent,
 |  | LPCSTR | pszWorkingDir,
 |  | LPCSTR | pszCmd,
 |  | LPCSTR | pszParam,
 |  | int | iShowCmd |
 | ) |  |  | [protected]

Definition at line 278 of file CtxMenu.Cpp.

{
    ODS("CShellExt::DoGAKMenu3()\r\n");

    MessageBox(hParent, "Menu item 3!", "Shell Extension Sample", MB_OK);

    return NOERROR;
}

STDMETHODIMP CShellExt::DoGAKMenu4 | ( | HWND | hParent,
 |  | LPCSTR | pszWorkingDir,
 |  | LPCSTR | pszCmd,
 |  | LPCSTR | pszParam,
 |  | int | iShowCmd |
 | ) |  |  | [protected]

Definition at line 291 of file CtxMenu.Cpp.

{
    ODS("CShellExt::DoGAKMenu4()\r\n");

    MessageBox(hParent, "Menu item 4!", "Shell Extension Sample", MB_OK);

    return NOERROR;
}

STDMETHODIMP CShellExt::Extract | ( | LPCSTR | pszFile,
 |  | UINT | nIconIndex,
 |  | HICON * | phiconLarge,
 |  | HICON * | phiconSmall,
 |  | UINT | nIconSize
 | ) |  |

Definition at line 41 of file IconHdlr.Cpp.

{
    ODS("CShellExt::Extract()\r\n");

    return S_FALSE;
}

STDMETHODIMP CShellExt::GetClassID ( LPCLSID lpClassID )

Definition at line 55 of file IconHdlr.Cpp.

{
    ODS("CShellExt::GetClassID()\r\n");

    return E_FAIL;
}

STDMETHODIMP CShellExt::GetCommandString | ( | UINT_PTR | idCmd,
 |  | UINT | uFlags,
 |  | UINT FAR * | reserved,
 |  | LPSTR | pszName,
 |  | UINT | cchMax
 | ) |  |

Definition at line 222 of file CtxMenu.Cpp.

{
    ODS("CShellExt::GetCommandString()\r\n");

    switch (idCmd)
    {
        case 0:
            lstrcpyn(pszName, "New menu item number 1", cchMax);
            break;

        case 1:
            lstrcpyn(pszName, "New menu item number 2", cchMax);
            break;

        case 2:
            lstrcpyn(pszName, "New menu item number 3", cchMax);
            break;

        case 3:
            lstrcpyn(pszName, "New menu item number 4", cchMax);
            break;
    }

    return NOERROR;
}

STDMETHODIMP CShellExt::GetCurFile ( LPOLESTR FAR * lplpszFileName )

Definition at line 99 of file IconHdlr.Cpp.

{
    ODS("CShellExt::GetCurFile()\r\n");

    return E_FAIL;
}

STDMETHODIMP CShellExt::GetIconLocation | ( | UINT | uFlags,
 |  | LPSTR | szIconFile,
 |  | UINT | cchMax,
 |  | int * | piIndex,
 |  | UINT * | pwFlags
 | ) |  |

Definition at line 22 of file IconHdlr.Cpp.

{
    ODS("CShellExt::GetIconLocation()\r\n");

    GetModuleFileName(g_hmodThisDll, szIconFile, cchMax);

    *piIndex = (int)GetPrivateProfileInt("IconImage",
                                         "Index",
                                         0,
                                         m_szFileUserClickedOn);

    return S_OK;
}

STDMETHODIMP CShellExt::Initialize | ( | LPCITEMIDLIST | pIDFolder,
 |  | LPDATAOBJECT | pDataObj,
 |  | HKEY | hKeyID
 | ) |  |

Definition at line 38 of file ShExInit.Cpp.

{
    ODS("CShellExt::Initialize()\r\n");

    // Initialize can be called more than once

    if (m_pDataObj)
        m_pDataObj->Release();

    // duplicate the object pointer and registry handle

    if (pDataObj)
    {
        m_pDataObj = pDataObj;
        pDataObj->AddRef();
    }

    return NOERROR;
}

STDMETHODIMP CShellExt::InvokeCommand ( LPCMINVOKECOMMANDINFO lpcmi )

Definition at line 154 of file CtxMenu.Cpp.

{
    ODS("CShellExt::InvokeCommand()\r\n");

    HRESULT hr = E_INVALIDARG;

    //If HIWORD(lpcmi->lpVerb) then we have been called programmatically
    //and lpVerb is a command that should be invoked.  Otherwise, the shell
    //has called us, and LOWORD(lpcmi->lpVerb) is the menu ID the user has
    //selected.  Actually, it's (menu ID - idCmdFirst) from QueryContextMenu().
    if (!HIWORD(lpcmi->lpVerb))
    {
        UINT idCmd = LOWORD(lpcmi->lpVerb);

        switch (idCmd)
        {
            case 0:
                hr = DoGAKMenu1(lpcmi->hwnd,
                                lpcmi->lpDirectory,
                                lpcmi->lpVerb,
                                lpcmi->lpParameters,
                                lpcmi->nShow);
                break;

            case 1:
                hr = DoGAKMenu2(lpcmi->hwnd,
                                lpcmi->lpDirectory,
                                lpcmi->lpVerb,
                                lpcmi->lpParameters,
                                lpcmi->nShow);
                break;

            case 2:
                hr = DoGAKMenu3(lpcmi->hwnd,
                                lpcmi->lpDirectory,
                                lpcmi->lpVerb,
                                lpcmi->lpParameters,
                                lpcmi->nShow);
                break;

            case 3:
                hr = DoGAKMenu4(lpcmi->hwnd,
                                lpcmi->lpDirectory,
                                lpcmi->lpVerb,
                                lpcmi->lpParameters,
                                lpcmi->nShow);
                break;
        }
    }
    return hr;
}

STDMETHODIMP CShellExt::IsDirty ( void )

Definition at line 62 of file IconHdlr.Cpp.

{
    ODS("CShellExt::IsDirty()\r\n");

    return S_FALSE;
}

STDMETHODIMP CShellExt::Load | ( | LPCOLESTR | lpszFileName,
 |  | DWORD | grfMode
 | ) |  |

Definition at line 69 of file IconHdlr.Cpp.

{
    ODS("CShellExt::Load()\r\n");

    WideCharToMultiByte(CP_ACP,                // CodePage
                        0,                    // dwFlags
                        lpszFileName,          // lpWideCharStr
                        -1,                    // cchWideChar
                        m_szFileUserClickedOn, // lpMultiByteStr
                        sizeof(m_szFileUserClickedOn),  // cchMultiByte,
                        NULL,                  // lpDefaultChar,
                        NULL);                 // lpUsedDefaultChar

    return NOERROR;
}

STDMETHODIMP CShellExt::QueryContextMenu | ( | HMENU | hMenu,
 |  | UINT | indexMenu,
 |  | UINT | idCmdFirst,
 |  | UINT | idCmdLast,
 |  | UINT | uFlags
 | ) |  |

Definition at line 43 of file CtxMenu.Cpp.

{
    ODS("CShellExt::QueryContextMenu()\r\n");

    UINT idCmd = idCmdFirst;
    char szMenuText[64];
    char szMenuText2[64];
    char szMenuText3[64];
    char szMenuText4[64];
    BOOL bAppendItems=TRUE;

    if ((uFlags & 0x000F) == CMF_NORMAL)  //Check == here, since CMF_NORMAL=0
    {
        ODS("CMF_NORMAL...\r\n");
        lstrcpyn(szMenuText, "&New .GAK menu 1, Normal File", ARRAYSIZE(szMenuText));
        lstrcpyn(szMenuText2, "&New .GAK menu 2, Normal File", ARRAYSIZE(szMenuText2));
        lstrcpyn(szMenuText3, "&New .GAK menu 3, Normal File", ARRAYSIZE(szMenuText3));
        lstrcpyn(szMenuText4, "&New .GAK menu 4, Normal File", ARRAYSIZE(szMenuText4));
    }
    else
        if (uFlags & CMF_VERBSONLY)
        {
            ODS("CMF_VERBSONLY...\r\n");
            lstrcpyn(szMenuText, "&New .GAK menu 1, Shortcut File", ARRAYSIZE(szMenuText));
            lstrcpyn(szMenuText2, "N&ew .GAK menu 2, Shortcut File", ARRAYSIZE(szMenuText2));
            lstrcpyn(szMenuText3, "&New .GAK menu 3, Shortcut File", ARRAYSIZE(szMenuText3));
            lstrcpyn(szMenuText4, "&New .GAK menu 4, Shortcut File", ARRAYSIZE(szMenuText4));
        }
    else
        if (uFlags & CMF_EXPLORE)
        {
            ODS("CMF_EXPLORE...\r\n");
            lstrcpyn(szMenuText, "&New .GAK menu 1, Normal File right click in Explorer", ARRAYSIZE(szMenuText));
            lstrcpyn(szMenuText2, "N&ew .GAK menu 2, Normal File right click in Explorer", ARRAYSIZE(szMenuText2));
            lstrcpyn(szMenuText3, "&New .GAK menu 3, Normal File right click in Explorer", ARRAYSIZE(szMenuText3));
            lstrcpyn(szMenuText4, "&New .GAK menu 4, Normal File right click in Explorer", ARRAYSIZE(szMenuText4));
        }
    else
        if (uFlags & CMF_DEFAULTONLY)
        {
            ODS("CMF_DEFAULTONLY...\r\n");
            bAppendItems = FALSE;
        }
    else
        {
            char szTemp[32];

            wsprintf(szTemp, "uFlags==>%d\r\n", uFlags);
            ODS("CMF_default...\r\n");
            ODS(szTemp);
            bAppendItems = FALSE;
        }

    if (bAppendItems)
    {
        InsertMenu(hMenu, indexMenu++, MF_SEPARATOR|MF_BYPOSITION, 0, NULL);

        InsertMenu(hMenu,
                   indexMenu++,
                   MF_STRING|MF_BYPOSITION,
                   idCmd++,
                   szMenuText);

        InsertMenu(hMenu, indexMenu++, MF_SEPARATOR|MF_BYPOSITION, 0, NULL);

        InsertMenu(hMenu,
                   indexMenu++,
                   MF_STRING|MF_BYPOSITION,
                   idCmd++,
                   szMenuText2);

        InsertMenu(hMenu, indexMenu++, MF_SEPARATOR|MF_BYPOSITION, 0, NULL);

        InsertMenu(hMenu,
                   indexMenu++,
                   MF_STRING|MF_BYPOSITION,
                   idCmd++,
                   szMenuText3);

        InsertMenu(hMenu,
                   indexMenu++,
                   MF_STRING|MF_BYPOSITION,
                   idCmd++,
                   szMenuText4);

        return ResultFromShort(idCmd-idCmdFirst); //Must return number of menu
                                                  //items we added.
   }

   return NOERROR;
}

STDMETHODIMP CShellExt::QueryInterface | ( | REFIID | riid,
 |  | LPVOID FAR * | ppv
 | ) |  |

Definition at line 177 of file ShellExt.Cpp.

{
    *ppv = NULL;

    if (IsEqualIID(riid, IID_IShellExtInit) || IsEqualIID(riid, IID_IUnknown))
    {
        ODS("CShellExt::QueryInterface()==>IID_IShellExtInit\r\n");

        *ppv = (LPSHELLEXTINIT)this;
    }
    else if (IsEqualIID(riid, IID_IContextMenu))
    {
        ODS("CShellExt::QueryInterface()==>IID_IContextMenu\r\n");

        *ppv = (LPCONTEXTMENU)this;
    }
    else if (IsEqualIID(riid, IID_IExtractIcon))
    {
        ODS("CShellExt::QueryInterface()==>IID_IExtractIcon\r\n");

        *ppv = (LPEXTRACTICON)this;
    }
    else if (IsEqualIID(riid, IID_IPersistFile))
    {
        ODS("CShellExt::QueryInterface()==>IPersistFile\r\n");

        *ppv = (LPPERSISTFILE)this;
    }
    else if (IsEqualIID(riid, IID_IShellPropSheetExt))
    {
        ODS("CShellExt::QueryInterface()==>IShellPropSheetExt\r\n");

        *ppv = (LPSHELLPROPSHEETEXT)this;
    }
    else if (IsEqualIID(riid, IID_IShellCopyHook))
    {
        ODS("CShellExt::QueryInterface()==>ICopyHook\r\n");

        *ppv = (LPCOPYHOOK)this;
    }

    if (*ppv)
    {
        AddRef();

        return NOERROR;
    }

    ODS("CShellExt::QueryInterface()==>Unknown Interface!\r\n");

    return E_NOINTERFACE;
}

STDMETHODIMP CShellExt::ReplacePage | ( | UINT | uPageID,
 |  | LPFNADDPROPSHEETPAGE | lpfnReplaceWith,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 297 of file PropShet.Cpp.

{
    ODS("CShellExt::ReplacePage()\r\n");

    return E_FAIL;
}

STDMETHODIMP CShellExt::Save | ( | LPCOLESTR | lpszFileName,
 |  | BOOL | fRemember
 | ) |  |

Definition at line 85 of file IconHdlr.Cpp.

{
    ODS("CShellExt::Save()\r\n");

    return E_FAIL;
}

STDMETHODIMP CShellExt::SaveCompleted ( LPCOLESTR lpszFileName )

Definition at line 92 of file IconHdlr.Cpp.

{
    ODS("CShellExt::SaveCompleted()\r\n");

    return E_FAIL;
}

CShellExt::STDMETHODIMP_ ( UINT )
CShellExt::STDMETHODIMP_ ( ULONG )
CShellExt::STDMETHODIMP_ ( ULONG )

Member Data Documentation

UINT UINT LPCSTR DWORD LPCSTR DWORD CShellExt::dwDestAttribs

Definition at line 155 of file ShellExt.h.

UINT UINT LPCSTR DWORD CShellExt::dwSrcAttribs

Definition at line 155 of file ShellExt.h.

ULONG CShellExt::m_cRef [protected]

Definition at line 64 of file ShellExt.h.

LPDATAOBJECT CShellExt::m_pDataObj [protected]

Definition at line 65 of file ShellExt.h.

char CShellExt::m_szFileUserClickedOn[MAX_PATH] [protected]

Definition at line 66 of file ShellExt.h.

char CShellExt::m_szPropSheetFileUserClickedOn[MAX_PATH]

Definition at line 51 of file ShellExt.h.

UINT UINT LPCSTR DWORD LPCSTR CShellExt::pszDestFile

Definition at line 155 of file ShellExt.h.

UINT UINT LPCSTR CShellExt::pszSrcFile

Definition at line 155 of file ShellExt.h.

UINT UINT CShellExt::wFlags

Definition at line 155 of file ShellExt.h.

UINT CShellExt::wFunc

Definition at line 155 of file ShellExt.h.

The documentation for this class was generated from the following files:
  • WinUI/Shell/ShellExt/ShellExt.h
  • WinUI/Shell/ShellExt/CtxMenu.Cpp
  • WinUI/Shell/ShellExt/IconHdlr.Cpp
  • WinUI/Shell/ShellExt/PropShet.Cpp
  • WinUI/Shell/ShellExt/ShellExt.Cpp
  • WinUI/Shell/ShellExt/ShExInit.Cpp
Generated on Wed Nov 13 2024 16:57:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CShellExtClassFactory Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CShellExtClassFactory Class Reference

#include "ShellExt.h"

List of all members.

Public Member Functions

CShellExtClassFactory ()
~CShellExtClassFactory ()
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, LPVOID FAR *)
STDMETHODIMP | LockServer (BOOL)
STDMETHODIMP | QueryInterface (REFIID, LPVOID FAR *)
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()

Protected Attributes

ULONG m_cRef

Detailed Description

Definition at line 21 of file ShellExt.h.

Constructor & Destructor Documentation

CShellExtClassFactory::CShellExtClassFactory ( )

Definition at line 77 of file ShellExt.Cpp.

{
    ODS("CShellExtClassFactory::CShellExtClassFactory()\r\n");

    m_cRef = 0L;

    g_cRefThisDll++;
}

CShellExtClassFactory::~CShellExtClassFactory ( )

Definition at line 86 of file ShellExt.Cpp.

{
    g_cRefThisDll--;
}

Member Function Documentation

STDMETHODIMP CShellExtClassFactory::CreateInstance | ( | LPUNKNOWN | ,
 |  | REFIID | ,
 |  | LPVOID FAR * |
 | ) |  |
STDMETHODIMP CShellExtClassFactory::LockServer ( BOOL fLock )

Definition at line 153 of file ShellExt.Cpp.

{
    return NOERROR;
}

STDMETHODIMP CShellExtClassFactory::QueryInterface | ( | REFIID | riid,
 |  | LPVOID FAR * | ppv
 | ) |  |

Definition at line 91 of file ShellExt.Cpp.

{
    ODS("CShellExtClassFactory::QueryInterface()\r\n");

    *ppv = NULL;

    // Any interface on this object is the object pointer

    if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_IClassFactory))
    {
        *ppv = (LPCLASSFACTORY)this;

        AddRef();

        return NOERROR;
    }

    return E_NOINTERFACE;
}

CShellExtClassFactory::STDMETHODIMP_ ( ULONG )
CShellExtClassFactory::STDMETHODIMP_ ( ULONG )

Member Data Documentation

ULONG CShellExtClassFactory::m_cRef [protected]

Definition at line 24 of file ShellExt.h.

The documentation for this class was generated from the following files:
  • WinUI/Shell/ShellExt/ShellExt.h
  • WinUI/Shell/ShellExt/ShellExt.Cpp
Generated on Wed Nov 13 2024 16:57:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CShellFolder Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes | Friends

CShellFolder Class Reference

#include "ShlFldr.h"

List of all members.

Public Member Functions

CShellFolder (CShellFolder *pParent=NULL, LPCITEMIDLIST pidl=NULL)
~CShellFolder ()
STDMETHOD() | BindToObject (LPCITEMIDLIST, LPBC, REFIID, LPVOID *)
STDMETHOD() | BindToStorage (LPCITEMIDLIST, LPBC, REFIID, LPVOID *)
STDMETHOD() | CompareIDs (LPARAM, LPCITEMIDLIST, LPCITEMIDLIST)
STDMETHOD() | CreateViewObject (HWND, REFIID, LPVOID *)
STDMETHOD() | EnumObjects (HWND, DWORD, LPENUMIDLIST *)
STDMETHOD() | GetAttributesOf (UINT, LPCITEMIDLIST *, LPDWORD)
STDMETHODIMP | GetClassID (LPCLSID)
STDMETHOD() | GetDisplayNameOf (LPCITEMIDLIST, DWORD, LPSTRRET)
STDMETHOD() | GetUIObjectOf (HWND, UINT, LPCITEMIDLIST *, REFIID, LPUINT, LPVOID *)
STDMETHODIMP | Initialize (LPCITEMIDLIST)
STDMETHOD() | ParseDisplayName (HWND, LPBC, LPOLESTR, LPDWORD, LPITEMIDLIST *, LPDWORD)
STDMETHOD() | QueryInterface (REFIID riid, LPVOID *ppvObj)
STDMETHOD() | SetNameOf (HWND, LPCITEMIDLIST, LPCOLESTR, DWORD, LPITEMIDLIST *)
STDMETHOD_ (ULONG, Release)(VOID)
STDMETHOD_ (ULONG, AddRef)(VOID)

Private Member Functions

STDMETHOD() | AddFolder (LPCTSTR, LPITEMIDLIST *)
STDMETHOD() | AddItem (LPCTSTR, LPCTSTR, LPITEMIDLIST *)
STDMETHOD() | CompareItems (LPCITEMIDLIST, LPCITEMIDLIST)
STDMETHOD() | CopyItems (CShellFolder *, LPITEMIDLIST *, UINT)
LPITEMIDLIST | CreateFQPidl (LPCITEMIDLIST)
STDMETHOD() | DeleteItems (LPITEMIDLIST *, UINT)
VOID | GetFullName (LPCITEMIDLIST, LPTSTR, DWORD, DWORD)
VOID | GetPath (LPCITEMIDLIST, LPTSTR, DWORD)
STDMETHOD() | GetUniqueName (BOOL, LPTSTR, DWORD)
BOOL | HasSubFolder (LPCITEMIDLIST)
VOID | NotifyViews (DWORD, LPCITEMIDLIST, LPCITEMIDLIST)
STDMETHOD() | SetItemData (LPCITEMIDLIST, LPCTSTR)

Private Attributes

DWORD m_ObjRefCount
LPITEMIDLIST | m_pidlFQ
LPITEMIDLIST | m_pidlRel
LPMALLOC | m_pMalloc
CPidlMgr * m_pPidlMgr
CShellFolder * m_psfParent

Friends

class | CContextMenu
class | CDataObject
class | CDropTarget
class | CShellView

Detailed Description

Definition at line 37 of file ShlFldr.h.

Constructor & Destructor Documentation

CShellFolder::CShellFolder | ( | CShellFolder * | pParent = NULL,
 |  | LPCITEMIDLIST | pidl = NULL
 | ) |  |

Definition at line 48 of file ShlFldr.Cpp.

{
g_DllRefCount++;

m_psfParent = pParent;
if(m_psfParent)
   m_psfParent->AddRef();

m_pPidlMgr = new CPidlMgr();
if(!m_pPidlMgr)
   {
   delete this;
   return;
   }

//get the shell's IMalloc pointer
//we'll keep this until we get destroyed
if(FAILED(SHGetMalloc(&m_pMalloc)))
   {
   delete this;
   return;
   }

m_pidlFQ = NULL;
m_pidlRel = NULL;
if(pidl)
   {
   m_pidlRel = m_pPidlMgr->Copy(pidl);
   }

m_ObjRefCount = 1;
}

CShellFolder::~CShellFolder ( )

Definition at line 88 of file ShlFldr.Cpp.

{
if(m_pidlRel)
   {
   m_pPidlMgr->Delete(m_pidlRel);
   m_pidlRel = NULL;
   }

if(m_pidlFQ)
   {
   m_pPidlMgr->Delete(m_pidlFQ);
   m_pidlFQ = NULL;
   }

if(m_psfParent)
   m_psfParent->Release();

if(m_pMalloc)
   {
   m_pMalloc->Release();
   }

if(m_pPidlMgr)
   {
   delete m_pPidlMgr;
   }

g_DllRefCount--;
}

Member Function Documentation

STDMETHODIMP CShellFolder::AddFolder | ( | LPCTSTR | pszName,
 |  | LPITEMIDLIST * | ppidlOut |
 | ) |  |  | [private]

Definition at line 778 of file ShlFldr.Cpp.

{
HRESULT  hr = E_FAIL;

//create a folder
TCHAR szFolder[MAX_PATH] = TEXT("");

if(m_pidlRel)
   {
   GetPath(NULL, szFolder, MAX_PATH);
   }
else
   {
   lstrcpyn(szFolder, g_szStoragePath, ARRAYSIZE(szFolder));
   }

SmartAppendBackslash(szFolder, ARRAYSIZE(szFolder));
StrCatBuff(szFolder, pszName, ARRAYSIZE(szFolder));

if(ppidlOut)
   *ppidlOut = NULL;

if(CreateDirectory(szFolder, NULL))
   {
   LPITEMIDLIST   pidl;

   //set the attributes that define one of our folders
   DWORD dwAttr = GetFileAttributes(szFolder);
   SetFileAttributes(szFolder, dwAttr | FILTER_ATTRIBUTES);

   //add an empty items.ini file because this also defines one of our folders
   TCHAR szFile[MAX_PATH];
   lstrcpyn(szFile, szFolder, ARRAYSIZE(szFile));
   SmartAppendBackslash(szFile, ARRAYSIZE(szFile));
   StrCatBuff(szFile, c_szDataFile, ARRAYSIZE(szFile));
   HANDLE   hFile;
   hFile = CreateFile(  szFile,
                        GENERIC_WRITE,
                        0,
                        NULL,
                        CREATE_ALWAYS,
                        FILE_ATTRIBUTE_NORMAL,
                        NULL);
   CloseHandle(hFile);

   pidl = m_pPidlMgr->CreateFolderPidl(pszName);
   if(pidl)
      {
      LPITEMIDLIST   pidlFQ;

      hr = S_OK;

      pidlFQ = CreateFQPidl(pidl);

      SHChangeNotify(SHCNE_MKDIR, SHCNF_IDLIST, pidlFQ, NULL);

      NotifyViews(SHCNE_MKDIR, pidl, NULL);

      m_pPidlMgr->Delete(pidlFQ);

      if(ppidlOut)
         *ppidlOut = pidl;
      else
         m_pPidlMgr->Delete(pidl);
      }
   }

return hr;
}

STDMETHODIMP CShellFolder::AddItem | ( | LPCTSTR | pszName,
 |  | LPCTSTR | pszData,
 |  | LPITEMIDLIST * | ppidlOut |
 | ) |  |  | [private]

Definition at line 854 of file ShlFldr.Cpp.

{
if(ppidlOut)
   *ppidlOut = NULL;

//create an item
HRESULT  hr = E_FAIL;
TCHAR    szFile[MAX_PATH];
LPCTSTR  psz = DEFAULT_DATA;

if(pszData && *pszData)
   psz = pszData;

//get the file name
if(m_pidlRel)
   {
   GetPath(NULL, szFile, MAX_PATH);
   }
else
   {
   lstrcpyn(szFile, g_szStoragePath, ARRAYSIZE(szFile));
   }

SmartAppendBackslash(szFile, ARRAYSIZE(szFile));
StrCatBuff(szFile, c_szDataFile, ARRAYSIZE(szFile));

//add the new entry into the INI file
if(WritePrivateProfileString( c_szSection,
                              pszName,
                              DEFAULT_DATA,
                              szFile))
   {
   LPITEMIDLIST   pidl;

   pidl = m_pPidlMgr->CreateItemPidl(pszName, psz);
   if(pidl)
      {
      LPITEMIDLIST   pidlFQ;

      hr = S_OK;

      pidlFQ = CreateFQPidl(pidl);

      SHChangeNotify(SHCNE_CREATE, SHCNF_IDLIST, pidlFQ, NULL);

      NotifyViews(SHCNE_CREATE, pidl, NULL);

      m_pPidlMgr->Delete(pidlFQ);

      if(ppidlOut)
         *ppidlOut = pidl;
      else
         m_pPidlMgr->Delete(pidl);
      }
   }

return hr;
}

STDMETHODIMP CShellFolder::BindToObject | ( | LPCITEMIDLIST | pidl,
 |  | LPBC | pbcReserved,
 |  | REFIID | riid,
 |  | LPVOID * | ppvOut
 | ) |  |

Definition at line 250 of file ShlFldr.Cpp.

{
*ppvOut = NULL;

//Make sure the item is a folder.
ULONG ulAttribs = SFGAO_FOLDER;
this->GetAttributesOf(1, &pidl, &ulAttribs);
if(!(ulAttribs & SFGAO_FOLDER))
   return E_INVALIDARG;

CShellFolder   *pShellFolder = new CShellFolder(this, pidl);
if(!pShellFolder)
   return E_OUTOFMEMORY;

LPITEMIDLIST   pidlTemp = m_pPidlMgr->Concatenate(m_pidlFQ, pidl);
pShellFolder->Initialize(pidlTemp);
m_pPidlMgr->Delete(pidlTemp);

HRESULT  hr = pShellFolder->QueryInterface(riid, ppvOut);

pShellFolder->Release();

return hr;
}

STDMETHODIMP CShellFolder::BindToStorage | ( | LPCITEMIDLIST | pidl,
 |  | LPBC | pbcReserved,
 |  | REFIID | riid,
 |  | LPVOID * | ppvOut
 | ) |  |

Definition at line 284 of file ShlFldr.Cpp.

{
*ppvOut = NULL;

return E_NOTIMPL;
}

STDMETHODIMP CShellFolder::CompareIDs | ( | LPARAM | lParam,
 |  | LPCITEMIDLIST | pidl1,
 |  | LPCITEMIDLIST | pidl2
 | ) |  |

Definition at line 300 of file ShlFldr.Cpp.

{
HRESULT        hr = E_FAIL;
LPITEMIDLIST   pidlTemp1;
LPITEMIDLIST   pidlTemp2;

//walk down the lists, comparing each individual item

pidlTemp1 = (LPITEMIDLIST)pidl1;
pidlTemp2 = (LPITEMIDLIST)pidl2;

while(pidlTemp1 && pidlTemp2)
   {
   hr = CompareItems(pidlTemp1, pidlTemp2);
   if(HRESULT_CODE(hr))
      {
      //the items are different
      break;
      }

   pidlTemp1 = m_pPidlMgr->GetNextItem(pidlTemp1);
   pidlTemp2 = m_pPidlMgr->GetNextItem(pidlTemp2);

   if(pidlTemp1 && !pidlTemp1->mkid.cb)
      {
      pidlTemp1 = NULL;
      }

   if(pidlTemp2 && !pidlTemp2->mkid.cb)
      {
      pidlTemp2 = NULL;
      }

   hr = E_FAIL;
   }

if(!pidlTemp1 && pidlTemp2)
   {
   //pidl1 is at a higher level than pidl2
   return MAKE_HRESULT(SEVERITY_SUCCESS, 0, USHORT(-1));
   }
else if(pidlTemp1 && !pidlTemp2)
   {
   //pidl2 is at a higher level than pidl1
   return MAKE_HRESULT(SEVERITY_SUCCESS, 0, USHORT(1));
   }
else if(SUCCEEDED(hr))
   {
   //the items are at the same level but are different
   return hr;
   }

//the items are the same
return MAKE_HRESULT(SEVERITY_SUCCESS, 0, 0);
}

STDMETHODIMP CShellFolder::CompareItems | ( | LPCITEMIDLIST | pidl1,
 |  | LPCITEMIDLIST | pidl2 |
 | ) |  |  | [private]

Definition at line 1440 of file ShlFldr.Cpp.

{
TCHAR szString1[MAX_PATH] = TEXT("");
TCHAR szString2[MAX_PATH] = TEXT("");

/*
Special case - If one of the items is a folder and the other is an item, always
make the folder come before the item.
*/
if(m_pPidlMgr->IsFolder(pidl1) != m_pPidlMgr->IsFolder(pidl2))
   {
   return MAKE_HRESULT( SEVERITY_SUCCESS,
                        0,
                        USHORT(m_pPidlMgr->IsFolder(pidl1) ? -1 : 1));
   }

m_pPidlMgr->GetRelativeName(pidl1, szString1, ARRAYSIZE(szString1));
m_pPidlMgr->GetRelativeName(pidl2, szString2, ARRAYSIZE(szString2));

return MAKE_HRESULT(SEVERITY_SUCCESS, 0, USHORT(lstrcmpi(szString1, szString2)));
}

STDMETHODIMP CShellFolder::CopyItems | ( | CShellFolder * | psfSource,
 |  | LPITEMIDLIST * | aPidls,
 |  | UINT | uCount |
 | ) |  |  | [private]

Definition at line 1272 of file ShlFldr.Cpp.

{
HRESULT  hr = E_FAIL;
TCHAR    szFromFolder[MAX_PATH];
TCHAR    szToFolder[MAX_PATH];
UINT     i;

//get the storage path of the folder being copied from
psfSource->GetPath(NULL, szFromFolder, MAX_PATH);
SmartAppendBackslash(szFromFolder, ARRAYSIZE(szFromFolder));

//get the storage path of the folder being copied to
this->GetPath(NULL, szToFolder, MAX_PATH);
SmartAppendBackslash(szToFolder, ARRAYSIZE(szToFolder));

for(i = 0; i < uCount; i++)
   {
   TCHAR    szFrom[MAX_PATH];
   TCHAR    szTo[MAX_PATH];

   lstrcpyn(szFrom, szFromFolder, ARRAYSIZE(szFrom));

   lstrcpyn(szTo, szToFolder, ARRAYSIZE(szTo));

   if(m_pPidlMgr->IsFolder(aPidls[i]))
      {
      LPTSTR   pszTemp;
      pszTemp = szFrom + lstrlen(szFrom);
      m_pPidlMgr->GetRelativeName(aPidls[i], pszTemp, MAX_PATH - lstrlen(szFrom));

      SmartAppendBackslash(szTo, ARRAYSIZE(szTo));

      //need to double NULL terminate the names
      *(szFrom + lstrlen(szFrom) + 1) = 0;
      *(szTo + lstrlen(szTo) + 1) = 0;

      SHFILEOPSTRUCT sfi;
      sfi.hwnd = NULL;
      sfi.wFunc = FO_COPY;
      sfi.pFrom = szFrom;
      sfi.pTo = szTo;
      sfi.fFlags = FOF_NOCONFIRMMKDIR | FOF_SILENT;

      if(0 == SHFileOperation(&sfi))
         {
         LPITEMIDLIST   pidlFQ;

         pidlFQ = CreateFQPidl(aPidls[i]);

         SHChangeNotify(SHCNE_MKDIR, SHCNF_IDLIST, pidlFQ, NULL);

         NotifyViews(SHCNE_MKDIR, aPidls[i], NULL);

         m_pPidlMgr->Delete(pidlFQ);

         hr = S_OK;
         }
      }
   else
      {
      TCHAR szName[MAX_NAME];
      TCHAR szData[MAX_DATA];

      StrCatBuff(szFrom, c_szDataFile, ARRAYSIZE(szFrom));
      StrCatBuff(szTo, c_szDataFile, ARRAYSIZE(szTo));

      m_pPidlMgr->GetRelativeName(aPidls[i], szName, MAX_NAME);

      if(GetPrivateProfileString(c_szSection, szName, TEXT(""), szData, MAX_DATA, szFrom))
         {
         //add the entry to the destination
         if(WritePrivateProfileString(c_szSection, szName, szData, szTo))
            {
            LPITEMIDLIST   pidlFQ;

            //remove the entry from the source
            WritePrivateProfileString(c_szSection, szName, NULL, szFrom);

            pidlFQ = CreateFQPidl(aPidls[i]);

            SHChangeNotify(SHCNE_CREATE, SHCNF_IDLIST, pidlFQ, NULL);

            NotifyViews(SHCNE_CREATE, aPidls[i], NULL);

            m_pPidlMgr->Delete(pidlFQ);

            hr = S_OK;
            }
         }
      }
   }

return hr;
}

LPITEMIDLIST CShellFolder::CreateFQPidl ( LPCITEMIDLIST pidl ) [private]

Definition at line 1065 of file ShlFldr.Cpp.

{
return m_pPidlMgr->Concatenate(m_pidlFQ, pidl);
}

STDMETHODIMP CShellFolder::CreateViewObject | ( | HWND | hwndOwner,
 |  | REFIID | riid,
 |  | LPVOID * | ppvOut
 | ) |  |

Definition at line 364 of file ShlFldr.Cpp.

{
HRESULT  hr = E_NOINTERFACE;

if(IsEqualIID(riid, IID_IShellView))
   {
   CShellView  *pShellView;

   *ppvOut = NULL;

   pShellView = new CShellView(this, m_pidlRel);
   if(!pShellView)
      return E_OUTOFMEMORY;

   hr = pShellView->QueryInterface(riid, ppvOut);

   pShellView->Release();
   }
else if(IsEqualIID(riid, IID_IDropTarget))
   {
   CDropTarget *pdt = new CDropTarget(this);

   if(pdt)
      {
      *ppvOut = pdt;
      return S_OK;
      }
   }
else if(IsEqualIID(riid, IID_IContextMenu))
   {
   /*
   Create a context menu object for this folder. This can be used for the
   background of a view.
   */
   CContextMenu   *pcm = new CContextMenu(this);

   if(pcm)
      {
      *ppvOut = pcm;
      return S_OK;
      }
   }

return hr;
}

STDMETHODIMP CShellFolder::DeleteItems | ( | LPITEMIDLIST * | aPidls,
 |  | UINT | uCount |
 | ) |  |  | [private]

Definition at line 1209 of file ShlFldr.Cpp.

{
HRESULT  hr = E_FAIL;
UINT     i;

for(i = 0; i < uCount; i++)
   {
   if(m_pPidlMgr->IsFolder(aPidls[i]))
      {
      TCHAR szPath[MAX_PATH];

      GetPath(aPidls[i], szPath, MAX_PATH);

      DeleteDirectory(szPath);

      LPITEMIDLIST   pidlFQ = CreateFQPidl(aPidls[i]);

      SHChangeNotify(SHCNE_RMDIR, SHCNF_IDLIST, pidlFQ, NULL);

      NotifyViews(SHCNE_RMDIR, aPidls[i], NULL);

      m_pPidlMgr->Delete(pidlFQ);

      hr = S_OK;
      }
   else
      {
      TCHAR szFile[MAX_PATH];
      TCHAR szName[MAX_NAME];

      //get the file name
      GetPath(aPidls[i], szFile, MAX_PATH);

      //get the item name
      m_pPidlMgr->GetName(aPidls[i], szName, MAX_NAME);

      //remove the entry from the INI file
      WritePrivateProfileString( c_szSection,
                                 szName,
                                 NULL,
                                 szFile);

      LPITEMIDLIST   pidlFQ = CreateFQPidl(aPidls[i]);

      SHChangeNotify(SHCNE_DELETE, SHCNF_IDLIST, pidlFQ, NULL);

      NotifyViews(SHCNE_DELETE, aPidls[i], NULL);

      m_pPidlMgr->Delete(pidlFQ);

      hr = S_OK;
      }
   }

return hr;
}

STDMETHODIMP CShellFolder::EnumObjects | ( | HWND | hwndOwner,
 |  | DWORD | dwFlags,
 |  | LPENUMIDLIST * | ppEnumIDList
 | ) |  |

Definition at line 419 of file ShlFldr.Cpp.

{
*ppEnumIDList = NULL;

TCHAR szPath[MAX_PATH];
GetPath(NULL, szPath, MAX_PATH);
*ppEnumIDList = new CEnumIDList(szPath, dwFlags);
if(!*ppEnumIDList)
   return E_OUTOFMEMORY;

return S_OK;
}

STDMETHOD() CShellFolder::GetAttributesOf | ( | UINT | ,
 |  | LPCITEMIDLIST * | ,
 |  | LPDWORD |
 | ) |  |
STDMETHODIMP CShellFolder::GetClassID ( LPCLSID lpClassID )

Definition at line 208 of file ShlFldr.Cpp.

{
*lpClassID = CLSID_SampleNameSpace;

return S_OK;
}

STDMETHODIMP CShellFolder::GetDisplayNameOf | ( | LPCITEMIDLIST | pidl,
 |  | DWORD | dwFlags,
 |  | LPSTRRET | lpName
 | ) |  |

Definition at line 578 of file ShlFldr.Cpp.

{
TCHAR szText[MAX_PATH] = TEXT("");
int   cchOleStr;

if(dwFlags & SHGDN_FORPARSING)
   {
   //a "path" is being requested - is it full or relative?
   if(dwFlags & SHGDN_INFOLDER)
      {
      //the relative path is being requested
      m_pPidlMgr->GetRelativeName(pidl, szText, ARRAYSIZE(szText));
      }
   else
      {
      GetFullName(pidl, szText, ARRAYSIZE(szText), dwFlags);
      }
   }
else
   {
   //only the text of the last item is being requested
   LPITEMIDLIST   pidlLast = m_pPidlMgr->GetLastItem(pidl);
   m_pPidlMgr->GetRelativeName(pidlLast, szText, ARRAYSIZE(szText));
   }

//get the number of characters required
cchOleStr = lstrlen(szText) + 1;

//allocate the wide character string
lpName->pOleStr = (LPWSTR)m_pMalloc->Alloc(cchOleStr * sizeof(WCHAR));
if(!lpName->pOleStr)
   return E_OUTOFMEMORY;

lpName->uType = STRRET_WSTR;

LocalToWideChar(lpName->pOleStr, szText, cchOleStr);

return S_OK;
}

VOID CShellFolder::GetFullName | ( | LPCITEMIDLIST | pidl,
 |  | LPTSTR | pszText,
 |  | DWORD | dwSize,
 |  | DWORD | dwFlags |
 | ) |  |  | [private]

Definition at line 961 of file ShlFldr.Cpp.

{
*pszText = 0;

//Get the name of our fully-qualified PIDL from the desktop folder.
IShellFolder   *psfDesktop = NULL;
SHGetDesktopFolder(&psfDesktop);
if(psfDesktop)
   {
   STRRET   str;
   if(SUCCEEDED(psfDesktop->GetDisplayNameOf(   m_pidlFQ,
                                                dwFlags,
                                                &str)))
      {
      GetTextFromSTRRET(m_pMalloc, &str, m_pidlFQ, pszText, dwSize);
      if(*pszText)
         {
         SmartAppendBackslash(pszText, dwSize);
         }
      }

   psfDesktop->Release();
   }

//add the current item's text
m_pPidlMgr->GetRelativeName(  pidl,
                              pszText + lstrlen(pszText),
                              dwSize - lstrlen(pszText));
}

VOID CShellFolder::GetPath | ( | LPCITEMIDLIST | pidl,
 |  | LPTSTR | pszPath,
 |  | DWORD | dwSize |
 | ) |  |  | [private]

Definition at line 1076 of file ShlFldr.Cpp.

{
CShellFolder   **ppsf;
CShellFolder   *psfCurrent;
int            nCount;

*pszPath = 0;

//we need the number of parent items in the chain
for(nCount = 0, psfCurrent = this; psfCurrent; nCount++)
   {
   psfCurrent = psfCurrent->m_psfParent;
   }

ppsf = (CShellFolder**)m_pMalloc->Alloc(nCount * sizeof(CShellFolder*));
if(ppsf)
   {
   int   i;

   //fill in the interface pointer array
   for(i = 0, psfCurrent = this; i < nCount; i++)
      {
      *(ppsf + i) = psfCurrent;
      psfCurrent = psfCurrent->m_psfParent;
      }

   //Get the name of the root of our storage.
   lstrcpyn(pszPath, g_szStoragePath, dwSize);
   SmartAppendBackslash(pszPath, dwSize);

   /*
   Starting at the top of the parent chain, walk down, getting the text for
   each folder's PIDL.
   */
   for(i = nCount - 1; i >= 0; i--)
      {
      psfCurrent = *(ppsf + i);
      if(psfCurrent)
         {
         LPTSTR   pszCurrent = pszPath + lstrlen(pszPath);
         DWORD    dwCurrentSize = dwSize - lstrlen(pszPath);

         m_pPidlMgr->GetRelativeName(  psfCurrent->m_pidlRel,
                                       pszCurrent,
                                       dwCurrentSize);
         SmartAppendBackslash(pszPath, dwSize);
         }
      }

   //add the item's path
   if(pidl)
      {
      if(m_pPidlMgr->IsFolder(pidl))
         {
         m_pPidlMgr->GetRelativeName(pidl, pszPath + lstrlen(pszPath),
            dwSize - lstrlen(pszPath));
         }
      else
         {
         lstrcpyn(   pszPath + lstrlen(pszPath),
                     c_szDataFile,
                     dwSize - lstrlen(pszPath));
         }
      }

   m_pMalloc->Free(ppsf);
   }
}

STDMETHODIMP CShellFolder::GetUIObjectOf | ( | HWND | hwndOwner,
 |  | UINT | uCount,
 |  | LPCITEMIDLIST * | pPidls,
 |  | REFIID | riid,
 |  | LPUINT | puReserved,
 |  | LPVOID * | ppvOut
 | ) |  |

Definition at line 492 of file ShlFldr.Cpp.

{
*ppvOut = NULL;

if(IsEqualIID(riid, IID_IContextMenu))
   {
   CContextMenu   *pcm = new CContextMenu(this, pPidls, uCount);

   if(pcm)
      {
      *ppvOut = pcm;
      return S_OK;
      }
   }

else if(IsEqualIID(riid, IID_IDataObject))
   {
   CDataObject *pdo = new CDataObject(this, pPidls, uCount);

   if(pdo)
      {
      *ppvOut = pdo;
      return S_OK;
      }
   }

if(uCount != 1)
   return E_INVALIDARG;

if(IsEqualIID(riid, IID_IExtractIcon))
   {
   CExtractIcon   *pei;
   LPITEMIDLIST   pidl;

   pidl = m_pPidlMgr->Concatenate(m_pidlRel, pPidls[0]);

   pei = new CExtractIcon(pidl);

   /*
   The temp PIDL can be deleted because the new CExtractIcon either failed or
   made its own copy of it.
   */
   m_pPidlMgr->Delete(pidl);

   if(pei)
      {
      *ppvOut = pei;
      return S_OK;
      }

   return E_OUTOFMEMORY;
   }
else if(IsEqualIID(riid, IID_IDropTarget))
   {
   CShellFolder   *psfTemp = NULL;

   BindToObject(pPidls[0], NULL, IID_IShellFolder, (LPVOID*)&psfTemp);

   if(psfTemp)
      {
      CDropTarget *pdt = new CDropTarget(psfTemp);

      psfTemp->Release();

      if(pdt)
         {
         *ppvOut = pdt;
         return S_OK;
         }
      }
   }

return E_NOINTERFACE;
}

STDMETHODIMP CShellFolder::GetUniqueName | ( | BOOL | fFolder,
 |  | LPTSTR | pszName,
 |  | DWORD | dwSize |
 | ) |  |  | [private]

Definition at line 1003 of file ShlFldr.Cpp.

{
HRESULT  hr;
IEnumIDList *pEnum = NULL;
LPTSTR pszTemp;

if(fFolder)
   {
   pszTemp = NEW_FOLDER_NAME;
   }
else
   {
   pszTemp = NEW_ITEM_NAME;
   }

hr = EnumObjects(NULL, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS | SHCONTF_INCLUDEHIDDEN, &pEnum);

if(pEnum)
   {
   BOOL  fUnique = FALSE;

   lstrcpyn(pszName, pszTemp, dwSize);

   while(!fUnique)
      {
      //see if this name already exists in this folder
      LPITEMIDLIST   pidl;
      DWORD          dwFetched;
      int            i = 1;
next:
      pEnum->Reset();

      while((S_OK == pEnum->Next(1, &pidl, &dwFetched)) && dwFetched)
         {
         STRRET   str;
         TCHAR    szText[MAX_PATH];

         GetDisplayNameOf(pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &str);

         GetTextFromSTRRET(m_pMalloc, &str, pidl, szText, MAX_PATH);

         if(0 == lstrcmpi(szText, pszName))
            {
            wsprintf(pszName, TEXT("%s %d"), pszTemp, i++);
            goto next;
            }
         }
      fUnique = TRUE;
      }

   pEnum->Release();
   }

return hr;
}

BOOL CShellFolder::HasSubFolder ( LPCITEMIDLIST pidl ) [private]

Definition at line 1151 of file ShlFldr.Cpp.

{
TCHAR             szPath[MAX_PATH];
TCHAR             szTemp[MAX_PATH];
HANDLE            hFind;
WIN32_FIND_DATA   wfd;
BOOL              fReturn = FALSE;

if(!m_pPidlMgr->IsFolder(pidl))
   return FALSE;

GetPath(pidl, szPath, MAX_PATH);
lstrcpyn(szTemp, szPath, ARRAYSIZE(szTemp));
SmartAppendBackslash(szTemp, ARRAYSIZE(szTemp));
StrCatBuff(szTemp, TEXT("*.*"), ARRAYSIZE(szTemp));

hFind = FindFirstFile(szTemp, &wfd);

if(INVALID_HANDLE_VALUE != hFind)
   {
   do
      {
      if((FILE_ATTRIBUTE_DIRECTORY & wfd.dwFileAttributes) &&
         ((wfd.dwFileAttributes & FILTER_ATTRIBUTES) == FILTER_ATTRIBUTES) &&
         lstrcmpi(wfd.cFileName, TEXT(".")) &&
         lstrcmpi(wfd.cFileName, TEXT("..")))
         {
         //We found one of our directories. Make sure it contains a data file.

         //build the path of the directory or file found
         lstrcpyn(szTemp, szPath, ARRAYSIZE(szTemp));
         SmartAppendBackslash(szTemp, ARRAYSIZE(szTemp));
         StrCatBuff(szTemp, wfd.cFileName, ARRAYSIZE(szTemp));
         SmartAppendBackslash(szTemp, ARRAYSIZE(szTemp));
         StrCatBuff(szTemp, c_szDataFile, ARRAYSIZE(szTemp));
         HANDLE   hDataFile = FindFirstFile(szTemp, &wfd);
         if(INVALID_HANDLE_VALUE != hDataFile)
            {
            fReturn = TRUE;
            FindClose(hDataFile);
            break;
            }
         }
      }
   while(FindNextFile(hFind, &wfd));

   FindClose(hFind);
   }

return fReturn;
}

STDMETHODIMP CShellFolder::Initialize ( LPCITEMIDLIST pidlFQ )

Definition at line 226 of file ShlFldr.Cpp.

{
if(m_pidlFQ)
   {
   m_pPidlMgr->Delete(m_pidlFQ);
   m_pidlFQ = NULL;
   }

m_pidlFQ = m_pPidlMgr->Copy(pidlFQ);

return S_OK;
}

VOID CShellFolder::NotifyViews | ( | DWORD | dwType,
 |  | LPCITEMIDLIST | pidlOld,
 |  | LPCITEMIDLIST | pidlNew |
 | ) |  |  | [private]

Definition at line 1381 of file ShlFldr.Cpp.

{
IShellFolder   *psfDesktop;

SHGetDesktopFolder(&psfDesktop);

if(psfDesktop)
   {
   if(g_pViewList)
      {
      CShellView  *pView;

      pView = g_pViewList->GetNextView(NULL);
      while(pView)
         {
         LPITEMIDLIST   pidlView = pView->GetFQPidl();

         //is this view a view of this folder?
         HRESULT  hr;
         hr = psfDesktop->CompareIDs(0, m_pidlFQ, pidlView);
         if(SUCCEEDED(hr) && 0 == HRESULT_CODE(hr))
            {
            switch(dwType)
               {
               case SHCNE_MKDIR:
               case SHCNE_CREATE:
                  pView->AddItem(pidlOld);
                  break;

               case SHCNE_RMDIR:
               case SHCNE_DELETE:
                  pView->DeleteItem(pidlOld);
                  break;

               case SHCNE_RENAMEFOLDER:
               case SHCNE_RENAMEITEM:
                  pView->RenameItem(pidlOld, pidlNew);
                  break;

               case SHCNE_UPDATEITEM:
                  pView->UpdateData(pidlOld);
                  break;
               }
            }
         pView = g_pViewList->GetNextView(pView);
         }
      }
   psfDesktop->Release();
   }
}

STDMETHODIMP CShellFolder::ParseDisplayName | ( | HWND | hwndOwner,
 |  | LPBC | pbcReserved,
 |  | LPOLESTR | lpDisplayName,
 |  | LPDWORD | pdwEaten,
 |  | LPITEMIDLIST * | pPidlNew,
 |  | LPDWORD | pdwAttributes
 | ) |  |

Definition at line 626 of file ShlFldr.Cpp.

{
return E_NOTIMPL;
}

STDMETHODIMP CShellFolder::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 129 of file ShlFldr.Cpp.

{
*ppReturn = NULL;

//IUnknown
if(IsEqualIID(riid, IID_IUnknown))
   {
   *ppReturn = this;
   }

//IShellFolder
else if(IsEqualIID(riid, IID_IShellFolder))
   {
   *ppReturn = (IShellFolder*)this;
   }

//IPersist
else if(IsEqualIID(riid, IID_IPersist))
   {
   *ppReturn = (IPersist*)this;
   }

//IPersistFolder
else if(IsEqualIID(riid, IID_IPersistFolder))
   {
   *ppReturn = (IPersistFolder*)this;
   }

if(*ppReturn)
   {
   (*(LPUNKNOWN*)ppReturn)->AddRef();
   return S_OK;
   }

return E_NOINTERFACE;
}

STDMETHODIMP CShellFolder::SetItemData | ( | LPCITEMIDLIST | pidl,
 |  | LPCTSTR | pszData |
 | ) |  |  | [private]

Definition at line 921 of file ShlFldr.Cpp.

{
BOOL  fResult;

if(m_pPidlMgr->IsFolder(pidl))
   {
   return E_INVALIDARG;
   }

if(!pszData)
   fResult = m_pPidlMgr->SetData(pidl, TEXT(""));
else
   fResult = m_pPidlMgr->SetData(pidl, pszData);

TCHAR szName[MAX_PATH];
TCHAR szFile[MAX_PATH];

//get the file name
GetPath(pidl, szFile, MAX_PATH);

//get the old item name
m_pPidlMgr->GetName(pidl, szName, MAX_PATH);

//change/add the name in the INI file
WritePrivateProfileString( c_szSection,
                           szName,
                           pszData,
                           szFile);

NotifyViews(SHCNE_UPDATEITEM, pidl, NULL);

return fResult ? S_OK : E_FAIL;
}

STDMETHODIMP CShellFolder::SetNameOf | ( | HWND | hwndOwner,
 |  | LPCITEMIDLIST | pidl,
 |  | LPCOLESTR | lpName,
 |  | DWORD | dwFlags,
 |  | LPITEMIDLIST * | ppidlOut
 | ) |  |

Definition at line 642 of file ShlFldr.Cpp.

{
if(!pidl)
   return E_INVALIDARG;

if(m_pPidlMgr->IsFolder(pidl))
   {
   TCHAR          szOld[MAX_PATH];
   TCHAR          szNew[MAX_PATH];
   LPTSTR         pszTemp;
   LPITEMIDLIST   pidlNew;
   LPITEMIDLIST   pidlFQOld;
   LPITEMIDLIST   pidlFQNew;

   //get the old name
   GetPath(pidl, szOld, MAX_PATH);

   //build the new name
   GetPath(pidl, szNew, MAX_PATH);
   for(pszTemp = szNew + lstrlen(szNew) - 1; pszTemp > szNew; pszTemp--)
      {
      if('\\' == *pszTemp)
         {
         *(pszTemp + 1) = 0;
         break;
         }
      }

   pszTemp = szNew + lstrlen(szNew);
   WideCharToLocal(pszTemp, (LPWSTR)lpName, MAX_PATH);

   if(!MoveFile(szOld, szNew))
      {
      MessageBeep(MB_ICONERROR);
      return E_FAIL;
      }

   //create a PIDL for the renamed folder using the relative name
   WideCharToLocal(szNew, (LPWSTR)lpName, MAX_PATH);
   pidlNew = m_pPidlMgr->CreateFolderPidl(szNew);

   pidlFQOld = CreateFQPidl(pidl);
   pidlFQNew = CreateFQPidl(pidlNew);

   SHChangeNotify(SHCNE_RENAMEFOLDER, SHCNF_IDLIST, pidlFQOld, pidlFQNew);

   NotifyViews(SHCNE_RENAMEFOLDER, pidl, pidlNew);

   if(ppidlOut)
      {
      *ppidlOut = pidlNew;
      }
   else
      {
      m_pPidlMgr->Delete(pidlNew);
      }

   m_pPidlMgr->Delete(pidlFQOld);
   m_pPidlMgr->Delete(pidlFQNew);
   }
else
   {
   TCHAR          szOld[MAX_PATH];
   TCHAR          szNew[MAX_PATH];
   TCHAR          szData[MAX_DATA];
   TCHAR          szFile[MAX_PATH];
   LPITEMIDLIST   pidlNew;
   LPITEMIDLIST   pidlFQOld;
   LPITEMIDLIST   pidlFQNew;

   //get the new name
   WideCharToLocal(szNew, (LPWSTR)lpName, MAX_PATH);

   //get the file name
   GetPath(pidl, szFile, MAX_PATH);

   //get the old item name
   m_pPidlMgr->GetName(pidl, szOld, MAX_PATH);

   //get the old item's data
   m_pPidlMgr->GetData(pidl, szData, MAX_PATH);

   //remove the old entry from the INI file
   WritePrivateProfileString( c_szSection,
                              szOld,
                              NULL,
                              szFile);

   //add the new entry into the INI file
   WritePrivateProfileString( c_szSection,
                              szNew,
                              szData,
                              szFile);

   m_pPidlMgr->GetData(pidl, szData, MAX_DATA);
   pidlNew = m_pPidlMgr->CreateItemPidl(szNew, szData);

   pidlFQOld = CreateFQPidl(pidl);
   pidlFQNew = CreateFQPidl(pidlNew);

   SHChangeNotify(SHCNE_RENAMEITEM, SHCNF_IDLIST, pidlFQOld, pidlFQNew);

   NotifyViews(SHCNE_RENAMEITEM, pidl, pidlNew);

   if(0 == lstrcmpi(szNew, DC_NAME))
      {
      SetItemData((LPCITEMIDLIST)pidlNew, DC_DATA);
      }

   if(ppidlOut)
      {
      *ppidlOut = pidlNew;
      m_pPidlMgr->Delete((LPITEMIDLIST)pidl);
      }
   else
      {
      m_pPidlMgr->Delete(pidlNew);
      }

   m_pPidlMgr->Delete(pidlFQOld);
   m_pPidlMgr->Delete(pidlFQNew);
   }

return S_OK;
}

CShellFolder::STDMETHOD_ | ( | ULONG | ,
 |  | AddRef |
 | ) |  |
CShellFolder::STDMETHOD_ | ( | ULONG | ,
 |  | Release |
 | ) |  |

Friends And Related Function Documentation

friend class CContextMenu [friend]

Definition at line 41 of file ShlFldr.h.

friend class CDataObject [friend]

Definition at line 43 of file ShlFldr.h.

friend class CDropTarget [friend]

Definition at line 42 of file ShlFldr.h.

friend class CShellView [friend]

Definition at line 40 of file ShlFldr.h.

Member Data Documentation

DWORD CShellFolder::m_ObjRefCount [private]

Definition at line 46 of file ShlFldr.h.

LPITEMIDLIST CShellFolder::m_pidlFQ [private]

Definition at line 48 of file ShlFldr.h.

LPITEMIDLIST CShellFolder::m_pidlRel [private]

Definition at line 47 of file ShlFldr.h.

LPMALLOC CShellFolder::m_pMalloc [private]

Definition at line 50 of file ShlFldr.h.

CPidlMgr* CShellFolder::m_pPidlMgr [private]

Definition at line 51 of file ShlFldr.h.

CShellFolder* CShellFolder::m_psfParent [private]

Definition at line 49 of file ShlFldr.h.

The documentation for this class was generated from the following files:
  • WinUI/Shell/SampView/ShlFldr.h
  • WinUI/Shell/SampView/ShlFldr.Cpp
Generated on Wed Nov 13 2024 16:57:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CShellIconOverlayID Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CShellIconOverlayID Class Reference

#include "IcnOvrly.h"

List of all members.

Public Member Functions

CShellIconOverlayID ()
~CShellIconOverlayID ()
STDMETHODIMP | GetOverlayInfo (LPWSTR pwszIconFile, int cchMax, LPINT pIndex, LPDWORD pdwFlags)
STDMETHODIMP | GetPriority (LPINT pPriority)
STDMETHODIMP | IsMemberOf (LPCWSTR pwszPath, DWORD dwAttr)
STDMETHODIMP | QueryInterface (REFIID, LPVOID FAR *)
STDMETHODIMP_ (DWORD) Release()
STDMETHODIMP_ (DWORD) AddRef()

Protected Attributes

DWORD m_ObjRefCount

Detailed Description

Definition at line 69 of file IcnOvrly.h.

Constructor & Destructor Documentation

CShellIconOverlayID::CShellIconOverlayID ( )

Definition at line 240 of file IcnOvrly.Cpp.

{
m_ObjRefCount = 1;
g_DllRefCount++;
}

CShellIconOverlayID::~CShellIconOverlayID ( )

Definition at line 252 of file IcnOvrly.Cpp.

{
g_DllRefCount--;
}

Member Function Documentation

STDMETHODIMP CShellIconOverlayID::GetOverlayInfo | ( | LPWSTR | pwszIconFile,
 |  | int | cchMax,
 |  | LPINT | pIndex,
 |  | LPDWORD | pdwFlags
 | ) |  |

Definition at line 362 of file IcnOvrly.Cpp.

{
if(IsBadWritePtr(pIndex, sizeof(int)))
   return E_INVALIDARG;

if(IsBadWritePtr(pdwFlags, sizeof(DWORD)))
   return E_INVALIDARG;

TCHAR szModule[MAX_PATH];

GetModuleFileName(g_hInst, szModule, ARRAYSIZE(szModule));

LocalToWideChar(pwszIconFile, szModule, cchMax);

*pIndex = 0;

*pdwFlags = ISIOI_ICONFILE | ISIOI_ICONINDEX;

return S_OK;
}

STDMETHODIMP CShellIconOverlayID::GetPriority ( LPINT pPriority )

Definition at line 397 of file IcnOvrly.Cpp.

{
if(IsBadWritePtr(pPriority, sizeof(int)))
   return E_INVALIDARG;

*pPriority = 0;

return S_OK;
}

STDMETHODIMP CShellIconOverlayID::IsMemberOf | ( | LPCWSTR | pwszPath,
 |  | DWORD | dwAttr
 | ) |  |

Definition at line 335 of file IcnOvrly.Cpp.

{
TCHAR szPath[MAX_PATH];
WideCharToLocal(szPath, pwszPath, MAX_PATH);

//display the overlay icon for files with the .TXT extension
LPTSTR   pszExt = PathFindExtension(szPath);
if(pszExt && (0 == lstrcmpi(pszExt, TEXT(".txt"))))
   return S_OK;

return S_FALSE;
}

STDMETHODIMP CShellIconOverlayID::QueryInterface | ( | REFIID | ,
 |  | LPVOID FAR * |
 | ) |  |
CShellIconOverlayID::STDMETHODIMP_ ( DWORD )
CShellIconOverlayID::STDMETHODIMP_ ( DWORD )

Member Data Documentation

DWORD CShellIconOverlayID::m_ObjRefCount [protected]

Definition at line 72 of file IcnOvrly.h.

The documentation for this class was generated from the following files:
  • WinUI/Shell/ShellIconOverlay/IcnOvrly.h
  • WinUI/Shell/ShellIconOverlay/IcnOvrly.Cpp
Generated on Wed Nov 13 2024 16:57:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CShellView Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Friends

CShellView Class Reference

#include "ShlView.h"

List of all members.

Public Member Functions

CShellView (CShellFolder *, LPCITEMIDLIST)
~CShellView ()
STDMETHOD() | AddPropertySheetPages (DWORD, LPFNADDPROPSHEETPAGE, LPARAM)
STDMETHOD() | ContextSensitiveHelp (BOOL)
STDMETHOD() | CreateViewWindow (LPSHELLVIEW, LPCFOLDERSETTINGS, LPSHELLBROWSER, LPRECT, HWND *)
STDMETHOD() | DestroyViewWindow (VOID)
STDMETHOD() | EnableModeless (BOOL)
STDMETHOD() | GetCurrentInfo (LPFOLDERSETTINGS)
STDMETHOD() | GetItemObject (UINT, REFIID, LPVOID *)
STDMETHOD() | GetWindow (HWND *)
STDMETHOD() | QueryInterface (REFIID, LPVOID *)
STDMETHOD() | Refresh (VOID)
STDMETHOD() | SaveViewState (VOID)
STDMETHOD() | SelectItem (LPCITEMIDLIST, UINT)
STDMETHOD_ (DWORD, Release)()
STDMETHOD_ (DWORD, AddRef)()
STDMETHOD() | TranslateAccelerator (LPMSG)
STDMETHOD() | UIActivate (UINT)

Private Member Functions

BOOL | AddItem (LPCITEMIDLIST)
BOOL | CreateList (VOID)
BOOL | DeleteItem (LPCITEMIDLIST)
VOID | DoContextMenu (WORD, WORD, BOOL, DWORD)
VOID | EditItem (LPCITEMIDLIST)
VOID | FillList (VOID)
int | FindItemPidl (LPCITEMIDLIST)
LPITEMIDLIST | GetFQPidl ()
LPITEMIDLIST | GetPidl ()
VOID | GetShellSettings (VOID)
BOOL | InitList (VOID)
VOID | MarkItemsAsCut (LPCITEMIDLIST *, UINT)
VOID | MergeEditMenu (HMENU, BOOL)
VOID | MergeFileMenu (HMENU, BOOL)
VOID | MergeToolbar (VOID)
VOID | MergeViewMenu (HMENU)
LRESULT | OnActivate (UINT)
LRESULT | OnCommand (DWORD, DWORD, HWND)
LRESULT | OnCreate (VOID)
VOID | OnDeactivate (VOID)
LRESULT | OnDestroy (VOID)
LRESULT | OnKillFocus (VOID)
LRESULT | OnNotify (UINT, LPNMHDR)
LRESULT | OnSetFocus (VOID)
LRESULT | OnSettingChange (LPCTSTR)
LRESULT | OnSize (WORD, WORD)
LRESULT | OnViewDetails (VOID)
LRESULT | OnViewLarge (VOID)
LRESULT | OnViewList (VOID)
LRESULT | OnViewSmall (VOID)
BOOL | RenameItem (LPCITEMIDLIST, LPCITEMIDLIST)
VOID | UpdateData (LPCITEMIDLIST)
LRESULT | UpdateMenu (HMENU hMenu)
LRESULT | UpdateToolbar (VOID)

Static Private Member Functions

static LRESULT CALLBACK | WndProc (HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam)

Private Attributes

BOOL m_fInEdit
FOLDERSETTINGS | m_FolderSettings
HACCEL | m_hAccels
HMENU | m_hMenu
HWND | m_hWnd
HWND | m_hwndList
HWND | m_hwndParent
DWORD m_ObjRefCount
LPITEMIDLIST | m_pidl
LPMALLOC | m_pMalloc
CPidlMgr * m_pPidlMgr
CShellFolder * m_psfParent
LPSHELLBROWSER | m_pShellBrowser
UINT m_uState

Friends

class | CContextMenu
class | CShellFolder

Detailed Description

Definition at line 44 of file ShlView.h.

Constructor & Destructor Documentation

CShellView::CShellView | ( | CShellFolder * | pFolder,
 |  | LPCITEMIDLIST | pidl
 | ) |  |

Definition at line 54 of file ShlView.Cpp.

{
g_DllRefCount++;

#ifdef INITCOMMONCONTROLSEX

INITCOMMONCONTROLSEX iccex;
iccex.dwSize = sizeof(INITCOMMONCONTROLSEX);
iccex.dwICC = ICC_LISTVIEW_CLASSES;
InitCommonControlsEx(&iccex);

#else

InitCommonControls();

#endif   //INITCOMMONCONTROLSEX

m_hMenu = NULL;
m_fInEdit = FALSE;
m_hAccels = LoadAccelerators(g_hInst, MAKEINTRESOURCE(IDR_ACCELS));

m_pPidlMgr = new CPidlMgr();
if(!m_pPidlMgr)
   {
   delete this;
   return;
   }

m_psfParent = pFolder;
if(m_psfParent)
   m_psfParent->AddRef();

//get the shell's IMalloc pointer
//we'll keep this until we get destroyed
if(FAILED(SHGetMalloc(&m_pMalloc)))
   {
   delete this;
   return;
   }

m_pidl = m_pPidlMgr->Copy(pidl);

m_uState = SVUIA_DEACTIVATE;

if(g_pViewList)
   g_pViewList->AddToList(this);

m_ObjRefCount = 1;
}

CShellView::~CShellView ( )

Definition at line 110 of file ShlView.Cpp.

{
if(g_pViewList)
   g_pViewList->RemoveFromList(this);

if(m_pidl)
   {
   m_pPidlMgr->Delete(m_pidl);
   m_pidl = NULL;
   }

if(m_psfParent)
   m_psfParent->Release();

if(m_pMalloc)
   {
   m_pMalloc->Release();
   }

if(m_pPidlMgr)
   {
   delete m_pPidlMgr;
   }

g_DllRefCount--;
}

Member Function Documentation

BOOL CShellView::AddItem ( LPCITEMIDLIST pidl ) [private]

Definition at line 1701 of file ShlView.Cpp.

{
LVITEM   lvItem;

ZeroMemory(&lvItem, sizeof(lvItem));

//set the mask
lvItem.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;

//add the item to the end of the list
lvItem.iItem = ListView_GetItemCount(m_hwndList);

//set the item's data
lvItem.lParam = (LPARAM)m_pPidlMgr->Copy(pidl);

//get text on a callback basis
lvItem.pszText = LPSTR_TEXTCALLBACK;

//get the image on a callback basis
lvItem.iImage = I_IMAGECALLBACK;

//add the item
if(-1 == ListView_InsertItem(m_hwndList, &lvItem))
   return FALSE;

return TRUE;
}

STDMETHODIMP CShellView::AddPropertySheetPages | ( | DWORD | dwReserved,
 |  | LPFNADDPROPSHEETPAGE | lpfn,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 719 of file ShlView.Cpp.

{
return E_NOTIMPL;
}

STDMETHODIMP CShellView::ContextSensitiveHelp ( BOOL fEnterMode )

Definition at line 232 of file ShlView.Cpp.

{
return E_NOTIMPL;
}

BOOL CShellView::CreateList ( VOID ) [private]

Definition at line 1320 of file ShlView.Cpp.

{
DWORD dwStyle;

dwStyle =   WS_TABSTOP |
            WS_VISIBLE |
            WS_CHILD |
            WS_BORDER |
            LVS_NOSORTHEADER |
            LVS_SHAREIMAGELISTS |
            LVS_EDITLABELS;

switch(m_FolderSettings.ViewMode)
   {
   default:
   case FVM_ICON:
      dwStyle |= LVS_ICON;
      break;

   case FVM_SMALLICON:
      dwStyle |= LVS_SMALLICON;
      break;

   case FVM_LIST:
      dwStyle |= LVS_LIST;
      break;

   case FVM_DETAILS:
      dwStyle |= LVS_REPORT;
      break;

   }

if(FWF_AUTOARRANGE & m_FolderSettings.fFlags)
   dwStyle |= LVS_AUTOARRANGE;

m_hwndList = CreateWindowEx(     WS_EX_CLIENTEDGE,
                                 WC_LISTVIEW,
                                 NULL,
                                 dwStyle,
                                 0,
                                 0,
                                 0,
                                 0,
                                 m_hWnd,
                                 (HMENU)ID_LISTVIEW,
                                 g_hInst,
                                 NULL);

if(!m_hwndList)
   return FALSE;

GetShellSettings();

return TRUE;
}

STDMETHODIMP CShellView::CreateViewWindow | ( | LPSHELLVIEW | pPrevView,
 |  | LPCFOLDERSETTINGS | lpfs,
 |  | LPSHELLBROWSER | psb,
 |  | LPRECT | prcView,
 |  | HWND * | phWnd
 | ) |  |

Definition at line 619 of file ShlView.Cpp.

{
WNDCLASS wc;

*phWnd = NULL;

//if our window class has not been registered, then do so
if(!GetClassInfo(g_hInst, NS_CLASS_NAME, &wc))
   {
   ZeroMemory(&wc, sizeof(wc));
   wc.style          = CS_HREDRAW | CS_VREDRAW;
   wc.lpfnWndProc    = (WNDPROC)WndProc;
   wc.cbClsExtra     = 0;
   wc.cbWndExtra     = 0;
   wc.hInstance      = g_hInst;
   wc.hIcon          = NULL;
   wc.hCursor        = LoadCursor(NULL, IDC_ARROW);
   wc.hbrBackground  = (HBRUSH)(COLOR_WINDOW + 1);
   wc.lpszMenuName   = NULL;
   wc.lpszClassName  = NS_CLASS_NAME;

   if(!RegisterClass(&wc))
      return E_FAIL;
   }

//set up the member variables
m_pShellBrowser = psb;
m_FolderSettings = *lpfs;

//get our parent window
m_pShellBrowser->GetWindow(&m_hwndParent);

*phWnd = CreateWindowEx(   0,
                           NS_CLASS_NAME,
                           NULL,
                           WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS,
                           prcView->left,
                           prcView->top,
                           prcView->right - prcView->left,
                           prcView->bottom - prcView->top,
                           m_hwndParent,
                           NULL,
                           g_hInst,
                           (LPVOID)this);

if(!*phWnd)
   return E_FAIL;

MergeToolbar();

m_pShellBrowser->AddRef();

return S_OK;
}

BOOL CShellView::DeleteItem ( LPCITEMIDLIST pidl ) [private]

Definition at line 1735 of file ShlView.Cpp.

{
//delete the item from the list
int   nIndex = FindItemPidl(pidl);

if(-1 != nIndex)
   {
   return ListView_DeleteItem(m_hwndList, nIndex);
   }

return FALSE;
}

STDMETHODIMP CShellView::DestroyViewWindow ( VOID )

Definition at line 684 of file ShlView.Cpp.

{
//Make absolutely sure all our UI is cleaned up.
UIActivate(SVUIA_DEACTIVATE);

if(m_hMenu)
   DestroyMenu(m_hMenu);

DestroyWindow(m_hWnd);

//release the shell browser object
m_pShellBrowser->Release();

return S_OK;
}

VOID CShellView::DoContextMenu | ( | WORD | x,
 |  | WORD | y,
 |  | BOOL | fDefault,
 |  | DWORD | dwCmdIn |
 | ) |  |  | [private]

Definition at line 1528 of file ShlView.Cpp.

{
UINT           uSelected = 0;
LPITEMIDLIST   *aSelectedItems = NULL;
LPCONTEXTMENU  pContextMenu = NULL;

if(m_uState != SVUIA_ACTIVATE_NOFOCUS)
   {
   uSelected = ListView_GetSelectedCount(m_hwndList);
   }

if(uSelected)
   {
   aSelectedItems = (LPITEMIDLIST*)m_pMalloc->Alloc((uSelected + 1) * sizeof(LPITEMIDLIST));

   if(aSelectedItems)
      {
      UINT     i;
      LVITEM   lvItem;

      ZeroMemory(&lvItem, sizeof(lvItem));
      lvItem.mask = LVIF_STATE | LVIF_PARAM;
      lvItem.stateMask = LVIS_SELECTED;
      lvItem.iItem = 0;

      i = 0;

      while(ListView_GetItem(m_hwndList, &lvItem) && (i < uSelected))
         {
         if(lvItem.state & LVIS_SELECTED)
            {
            aSelectedItems[i] = (LPITEMIDLIST)lvItem.lParam;
            i++;
            }
         lvItem.iItem++;
         }
      m_psfParent->GetUIObjectOf(   m_hwndParent,
                                    uSelected,
                                    (LPCITEMIDLIST*)aSelectedItems,
                                    IID_IContextMenu,
                                    NULL,
                                    (LPVOID*)&pContextMenu);

      }
   }
else
   {
   m_psfParent->CreateViewObject(   m_hwndParent,
                                    IID_IContextMenu,
                                    (LPVOID*)&pContextMenu);
   }

if(pContextMenu)
   {
   HMENU hMenu = CreatePopupMenu();

   /*
   See if we are in Explore or Open mode. If the browser's tree is present,
   then we are in Explore mode.
   */
   BOOL  fExplore = FALSE;
   HWND  hwndTree = NULL;
   if(SUCCEEDED(m_pShellBrowser->GetControlWindow(FCW_TREE, &hwndTree)) && hwndTree)
      {
      fExplore = TRUE;
      }

   if(hMenu && SUCCEEDED(pContextMenu->QueryContextMenu( hMenu,
                                                         0,
                                                         0,
                                                         MENU_MAX,
                                                         CMF_NORMAL |
                                                            (fExplore ? CMF_EXPLORE : 0) |
                                                            ((uSelected > 1) ? MYCMF_MULTISELECT: 0))))
      {
      UINT  uCommand;

      if(fDefault)
         {
         MENUITEMINFO   mii;
         int            nMenuIndex;

         uCommand = 0;

         ZeroMemory(&mii, sizeof(mii));
         mii.cbSize = sizeof(mii);
         mii.fMask = MIIM_STATE | MIIM_ID;

         nMenuIndex = 0;

         //find the default item in the menu
         while(GetMenuItemInfo(hMenu, nMenuIndex, TRUE, &mii))
            {
            if(mii.fState & MFS_DEFAULT)
               {
               uCommand = mii.wID;
               break;
               }

            nMenuIndex++;
            }
         }
      else if(-1 != dwCmdIn)
         {
         //this command will get sent directly without bringing up the menu
         uCommand = dwCmdIn;
         }
      else
         {
         uCommand = TrackPopupMenu( hMenu,
                                    TPM_LEFTALIGN | TPM_RETURNCMD,
                                    x,
                                    y,
                                    0,
                                    m_hWnd,
                                    NULL);
         }

      if(uCommand > 0)
         {
         //some commands need to be handled by the view itself
         switch(uCommand)
            {
            case IDM_VIEW_LARGE:
               OnViewLarge();
               break;

            case IDM_VIEW_SMALL:
               OnViewSmall();
               break;

            case IDM_VIEW_LIST:
               OnViewList();
               break;

            case IDM_VIEW_DETAILS:
               OnViewDetails();
               break;

            default:
               {
               CMINVOKECOMMANDINFO  cmi;

               ZeroMemory(&cmi, sizeof(cmi));
               cmi.cbSize = sizeof(cmi);
               cmi.hwnd = m_hWnd;
               cmi.lpVerb = (LPCSTR)MAKEINTRESOURCE(uCommand);

               pContextMenu->InvokeCommand(&cmi);
               }
               break;
            }

         }

      DestroyMenu(hMenu);
      }

   pContextMenu->Release();
   }

if(aSelectedItems)
   m_pMalloc->Free(aSelectedItems);

UpdateToolbar();
}

VOID CShellView::EditItem ( LPCITEMIDLIST pidl ) [private]

Definition at line 1867 of file ShlView.Cpp.

{
int   i;

i = FindItemPidl(pidl);

if(-1 != i)
   {
   SetFocus(m_hwndList);

   //put the ListView into edit mode
   ListView_EditLabel(m_hwndList, i);
   }
}

STDMETHODIMP CShellView::EnableModeless ( BOOL fEnable )

Definition at line 271 of file ShlView.Cpp.

{
return E_NOTIMPL;
}

VOID CShellView::FillList ( VOID ) [private]

Definition at line 1416 of file ShlView.Cpp.

{
LPENUMIDLIST   pEnumIDList;

if(SUCCEEDED(m_psfParent->EnumObjects(m_hWnd, SHCONTF_NONFOLDERS | SHCONTF_FOLDERS, &pEnumIDList)))
   {
   LPITEMIDLIST   pidl;
   DWORD          dwFetched;

   //turn the listview's redrawing off
   SendMessage(m_hwndList, WM_SETREDRAW, FALSE, 0);

   while((S_OK == pEnumIDList->Next(1, &pidl, &dwFetched)) && dwFetched)
      {
      AddItem(pidl);
/*
*/
      }

   //sort the items
   ListView_SortItems(m_hwndList, CompareItems, (LPARAM)m_psfParent);

   //turn the listview's redrawing back on and force it to draw
   SendMessage(m_hwndList, WM_SETREDRAW, TRUE, 0);
   InvalidateRect(m_hwndList, NULL, TRUE);
   UpdateWindow(m_hwndList);

   pEnumIDList->Release();
   }
}

int CShellView::FindItemPidl ( LPCITEMIDLIST pidl ) [private]

Definition at line 1816 of file ShlView.Cpp.

{
LVITEM   lvItem;

ZeroMemory(&lvItem, sizeof(lvItem));
lvItem.mask = LVIF_PARAM;

for(lvItem.iItem = 0; ListView_GetItem(m_hwndList, &lvItem); lvItem.iItem++)
   {
   LPITEMIDLIST   pidlFound = (LPITEMIDLIST)lvItem.lParam;
   HRESULT        hr = m_psfParent->CompareIDs(0, pidl, pidlFound);
   if(SUCCEEDED(hr) && 0 == HRESULT_CODE(hr))
      {
      //we found the item
      return lvItem.iItem;
      }
   }

return -1;
}

STDMETHODIMP CShellView::GetCurrentInfo ( LPFOLDERSETTINGS lpfs )

Definition at line 706 of file ShlView.Cpp.

{
*lpfs = m_FolderSettings;

return S_OK;
}

LPITEMIDLIST CShellView::GetFQPidl ( ) [private]

Definition at line 1805 of file ShlView.Cpp.

{
return m_psfParent->CreateFQPidl(NULL);
}

STDMETHODIMP CShellView::GetItemObject | ( | UINT | uItem,
 |  | REFIID | riid,
 |  | LPVOID * | ppvOut
 | ) |  |

Definition at line 754 of file ShlView.Cpp.

{
*ppvOut = NULL;

return E_NOTIMPL;
}

LPITEMIDLIST CShellView::GetPidl ( ) [private]

Definition at line 1794 of file ShlView.Cpp.

{
return m_psfParent->CreateFQPidl(NULL);
}

VOID CShellView::GetShellSettings ( VOID ) [private]

Definition at line 1500 of file ShlView.Cpp.

{
}

STDMETHODIMP CShellView::GetWindow ( HWND * phWnd )

Definition at line 219 of file ShlView.Cpp.

{
*phWnd = m_hWnd;

return S_OK;
}

BOOL CShellView::InitList ( VOID ) [private]

Definition at line 1383 of file ShlView.Cpp.

{
LVCOLUMN    lvColumn;
TCHAR       szString[MAX_PATH];

//empty the list
ListView_DeleteAllItems(m_hwndList);

//initialize the columns
lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
lvColumn.fmt = LVCFMT_LEFT;
lvColumn.pszText = szString;

lvColumn.cx = g_nColumn;
LoadString(g_hInst, IDS_COLUMN1, szString, sizeof(szString));
ListView_InsertColumn(m_hwndList, 0, &lvColumn);

lvColumn.cx = g_nColumn;
LoadString(g_hInst, IDS_COLUMN2, szString, sizeof(szString));
ListView_InsertColumn(m_hwndList, 1, &lvColumn);

ListView_SetImageList(m_hwndList, g_himlLarge, LVSIL_NORMAL);
ListView_SetImageList(m_hwndList, g_himlSmall, LVSIL_SMALL);

return TRUE;
}

VOID CShellView::MarkItemsAsCut | ( | LPCITEMIDLIST * | aPidls,
 |  | UINT | uItemCount |
 | ) |  |  | [private]

Definition at line 1845 of file ShlView.Cpp.

{
UINT  i;

for(i = 0; i < uItemCount; i++)
   {
   LPITEMIDLIST   pidlTemp = m_pPidlMgr->GetLastItem(aPidls[i]);
   int            nIndex = FindItemPidl(pidlTemp);

   if(nIndex != -1)
      {
      ListView_SetItemState(m_hwndList, nIndex, LVIS_CUT, LVIS_CUT);
      }
   }
}

VOID CShellView::MergeEditMenu | ( | HMENU | hMenu,
 |  | BOOL | fFocus |
 | ) |  |  | [private]

Definition at line 495 of file ShlView.Cpp.

{
if(hMenu)
   {
   MENUITEMINFO   mii;
   TCHAR          szText[MAX_PATH];

   ZeroMemory(&mii, sizeof(mii));
   mii.cbSize = sizeof(mii);

   if(fFocus)
      {
      LoadString(g_hInst, IDS_CUT, szText, sizeof(szText));
      mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE;
      mii.fType = MFT_STRING;
      mii.fState = MFS_ENABLED;
      mii.dwTypeData = szText;
      mii.wID = IDM_CUT;
      InsertMenuItem(hMenu, (UINT)-1, TRUE, &mii);

      LoadString(g_hInst, IDS_COPY, szText, sizeof(szText));
      mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE;
      mii.fType = MFT_STRING;
      mii.fState = MFS_ENABLED;
      mii.dwTypeData = szText;
      mii.wID = IDM_COPY;
      InsertMenuItem(hMenu, (UINT)-1, TRUE, &mii);
      }

   //add the paste menu items at the correct position in the menu
   LoadString(g_hInst, IDS_PASTE, szText, sizeof(szText));
   mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE;
   mii.fType = MFT_STRING;
   mii.fState = MFS_ENABLED;
   mii.dwTypeData = szText;
   mii.wID = IDM_PASTE;
   InsertMenuItem(hMenu, (UINT)-1, TRUE, &mii);
   }
}

VOID CShellView::MergeFileMenu | ( | HMENU | hMenu,
 |  | BOOL | fFocus |
 | ) |  |  | [private]

Definition at line 412 of file ShlView.Cpp.

{
MENUITEMINFO   mii;
UINT           uPos = 0;

ZeroMemory(&mii, sizeof(mii));

//uPos += AddFileMenuItems(hMenu, 0, IDM_SEPARATOR, FALSE);
uPos += AddFileMenuItems(hMenu, 0, 0, TRUE);

//add a separator
mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE;
mii.fType = MFT_SEPARATOR;
mii.wID = IDM_SEPARATOR;
mii.fState = MFS_ENABLED;

//insert this item at the beginning of the menu
InsertMenuItem(hMenu, uPos, TRUE, &mii);
uPos++;

if(fFocus)
   {
   TCHAR szText[MAX_PATH];

   //add the Delete item
   LoadString(g_hInst, IDS_DELETE, szText, sizeof(szText));
   mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE;
   mii.fType = MFT_STRING;
   mii.fState = MFS_ENABLED;
   mii.dwTypeData = szText;
   mii.wID = IDM_DELETE;
   InsertMenuItem(hMenu, uPos, TRUE, &mii);
   uPos++;

   //add the Rename item
   LoadString(g_hInst, IDS_RENAME, szText, sizeof(szText));
   mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE;
   mii.fType = MFT_STRING;
   mii.fState = MFS_ENABLED;
   mii.dwTypeData = szText;
   mii.wID = IDM_RENAME;
   InsertMenuItem(hMenu, uPos, TRUE, &mii);
   uPos++;

   //add a separator
   mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE;
   mii.fType = MFT_SEPARATOR;
   mii.wID = IDM_SEPARATOR;
   mii.fState = MFS_ENABLED;
   InsertMenuItem(hMenu, uPos, TRUE, &mii);
   uPos++;
   }
}

VOID CShellView::MergeToolbar ( VOID ) [private]

Definition at line 541 of file ShlView.Cpp.

{
int         i;
TBADDBITMAP tbab;
LRESULT     lStdOffset;
LRESULT     lViewOffset;

m_pShellBrowser->SetToolbarItems(NULL, 0, FCT_MERGE);

tbab.hInst = HINST_COMMCTRL;
tbab.nID = (int)IDB_STD_SMALL_COLOR;
m_pShellBrowser->SendControlMsg(FCW_TOOLBAR, TB_ADDBITMAP, 0, (LPARAM)&tbab, &lStdOffset);

tbab.hInst = HINST_COMMCTRL;
tbab.nID = (int)IDB_VIEW_SMALL_COLOR;
m_pShellBrowser->SendControlMsg(FCW_TOOLBAR, TB_ADDBITMAP, 0, (LPARAM)&tbab, &lViewOffset);

//get the number of items in tool array
for(i = 0; -1 != g_Tools[i].idCommand; i++)
   {
   }

LPTBBUTTON  ptbb = (LPTBBUTTON)GlobalAlloc(GPTR, sizeof(TBBUTTON) * i);

if(ptbb)
   {
   for(i = 0; -1 != g_Tools[i].idCommand; i++)
      {
      (ptbb + i)->iBitmap = 0;
      switch(g_Tools[i].uImageSet)
         {
         case IDB_STD_SMALL_COLOR:
            (ptbb + i)->iBitmap = (int)lStdOffset + g_Tools[i].iImage;
            break;

         case IDB_VIEW_SMALL_COLOR:
            (ptbb + i)->iBitmap = (int)lViewOffset + g_Tools[i].iImage;
            break;
         }

      (ptbb + i)->idCommand = g_Tools[i].idCommand;
      (ptbb + i)->fsState = g_Tools[i].bState;
      (ptbb + i)->fsStyle = g_Tools[i].bStyle;
      (ptbb + i)->dwData = 0;
      (ptbb + i)->iString = 0;
      }

   m_pShellBrowser->SetToolbarItems(ptbb, i, FCT_MERGE);

   GlobalFree((HGLOBAL)ptbb);
   }

UpdateToolbar();
}

VOID CShellView::MergeViewMenu ( HMENU hMenu ) [private]

Definition at line 472 of file ShlView.Cpp.

{
MENUITEMINFO   mii;

ZeroMemory(&mii, sizeof(mii));
mii.cbSize = sizeof(mii);

//add a separator at the correct position in the menu
mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE;
mii.fType = MFT_SEPARATOR;
mii.wID = IDM_SEPARATOR;
mii.fState = MFS_ENABLED;
InsertMenuItem(hMenu, FCIDM_MENU_VIEW_SEP_OPTIONS, FALSE, &mii);

AddViewMenuItems(hMenu, 0, FCIDM_MENU_VIEW_SEP_OPTIONS, FALSE);
}

LRESULT CShellView::OnActivate ( UINT uState ) [private]

Definition at line 282 of file ShlView.Cpp.

{
//don't do anything if the state isn't really changing
if(m_uState == uState)
   return S_OK;

OnDeactivate();

//only do this if we are active
if(uState != SVUIA_DEACTIVATE)
   {
   //merge the menus
   m_hMenu = CreateMenu();

   if(m_hMenu)
      {
    OLEMENUGROUPWIDTHS   omw = {0, 0, 0, 0, 0, 0};
      MENUITEMINFO         mii;

      m_pShellBrowser->InsertMenusSB(m_hMenu, &omw);

      //add your top level sub-menu here, if desired

      //get the view menu so we can merge with it
      ZeroMemory(&mii, sizeof(mii));
      mii.cbSize = sizeof(mii);
      mii.fMask = MIIM_SUBMENU;

      //merge our items into the File menu
      if(GetMenuItemInfo(m_hMenu, FCIDM_MENU_FILE, FALSE, &mii))
         {
         MergeFileMenu(mii.hSubMenu, (BOOL)(SVUIA_ACTIVATE_FOCUS == uState));
         }

      //merge our items into the Edit menu
      if(GetMenuItemInfo(m_hMenu, FCIDM_MENU_EDIT, FALSE, &mii))
         {
         MergeEditMenu(mii.hSubMenu, (BOOL)(SVUIA_ACTIVATE_FOCUS == uState));
         }

      //merge our items into the View menu
      if(GetMenuItemInfo(m_hMenu, FCIDM_MENU_VIEW, FALSE, &mii))
         {
         MergeViewMenu(mii.hSubMenu);
         }

      //add the items that should only be added if we have the focus
      if(SVUIA_ACTIVATE_FOCUS == uState)
         {
         }

      m_pShellBrowser->SetMenuSB(m_hMenu, NULL, m_hWnd);
      }
   }

m_uState = uState;

UpdateToolbar();

return 0;
}

LRESULT CShellView::OnCommand | ( | DWORD | dwCmdID,
 |  | DWORD | dwCmd,
 |  | HWND | hwndCmd |
 | ) |  |  | [private]

Definition at line 869 of file ShlView.Cpp.

{
//ignore command messages while in edit mode
if(m_fInEdit)
   return 0;

DoContextMenu(0, 0, FALSE, dwCmdID);

return 0;
}

LRESULT CShellView::OnCreate ( VOID ) [private]

Definition at line 1270 of file ShlView.Cpp.

{
//create the ListView
if(CreateList())
   {
   if(InitList())
      {
      FillList();
      }
   }

HRESULT  hr;
IDropTarget *pdt;

//get the IDropTarget for this folder
hr = m_psfParent->CreateViewObject( m_hWnd,
                                    IID_IDropTarget,
                                    (LPVOID*)&pdt);

if(SUCCEEDED(hr))
   {
   //register the window as a drop target
   RegisterDragDrop(m_hWnd, pdt);

   pdt->Release();
   }

return 0;
}

VOID CShellView::OnDeactivate ( VOID ) [private]

Definition at line 350 of file ShlView.Cpp.

{
if(m_uState != SVUIA_DEACTIVATE)
   {
   if(m_hMenu)
      {
      m_pShellBrowser->SetMenuSB(NULL, NULL, NULL);

      m_pShellBrowser->RemoveMenusSB(m_hMenu);

      DestroyMenu(m_hMenu);

      m_hMenu = NULL;
      }

   m_uState = SVUIA_DEACTIVATE;
   }
}

LRESULT CShellView::OnDestroy ( VOID ) [private]

Definition at line 1306 of file ShlView.Cpp.

{
//unregister the window as a drop target
RevokeDragDrop(m_hWnd);

return 0;
}

LRESULT CShellView::OnKillFocus ( VOID ) [private]

Definition at line 856 of file ShlView.Cpp.

{
OnActivate(SVUIA_ACTIVATE_NOFOCUS);

return 0;
}

LRESULT CShellView::OnNotify | ( | UINT | CtlID,
 |  | LPNMHDR | lpnmh |
 | ) |  |  | [private]

Definition at line 975 of file ShlView.Cpp.

{
switch(lpnmh->code)
   {
   /*
   The original shell on NT will always send TTN_NEEDTEXTW, so handle the
   cases separately.
   */
   case TTN_NEEDTEXTA:
      {
      LPNMTTDISPINFOA pttt = (LPNMTTDISPINFOA)lpnmh;
      int            i;

      for(i = 0; -1 != g_Tools[i].idCommand; i++)
         {
         if(g_Tools[i].idCommand == pttt->hdr.idFrom)
            {
            LoadStringA(g_hInst, g_Tools[i].idString, pttt->szText, sizeof(pttt->szText));
            return TRUE;
            }
         }
      }
      break;

   case TTN_NEEDTEXTW:
      {
      LPNMTTDISPINFOW pttt = (LPNMTTDISPINFOW)lpnmh;
      int            i;

      for(i = 0; -1 != g_Tools[i].idCommand; i++)
         {
         if(g_Tools[i].idCommand == pttt->hdr.idFrom)
            {
            LoadStringW(g_hInst, g_Tools[i].idString, pttt->szText, sizeof(pttt->szText));
            return TRUE;
            }
         }
      }
      break;

   case NM_SETFOCUS:
      OnSetFocus();
      break;

   case NM_KILLFOCUS:
      OnDeactivate();
      break;

   case HDN_ENDTRACK:
      {
      g_nColumn = ListView_GetColumnWidth(m_hwndList, 0);
      ListView_SetColumnWidth(m_hwndList, 1, LVSCW_AUTOSIZE_USEHEADER);
      }
      return 0;

   case LVN_DELETEITEM:
      {
      NM_LISTVIEW *lpnmlv = (NM_LISTVIEW*)lpnmh;

      //delete the pidl because we made a copy of it
      m_pPidlMgr->Delete((LPITEMIDLIST)lpnmlv->lParam);
      }
      break;

#ifdef LVN_ITEMACTIVATE

   case LVN_ITEMACTIVATE:

#else    //LVN_ITEMACTIVATE

   case NM_DBLCLK:
   case NM_RETURN:

#endif   //LVN_ITEMACTIVATE

      DoContextMenu(0, 0, TRUE, (DWORD)-1);
      return 0;

   case LVN_GETDISPINFO:
      {
      NMLVDISPINFO   *lpdi = (NMLVDISPINFO*)lpnmh;
      LPITEMIDLIST   pidl = (LPITEMIDLIST)lpdi->item.lParam;

      //is the sub-item information being requested?
      if(lpdi->item.iSubItem)
         {
         //is the text being requested?
         if(lpdi->item.mask & LVIF_TEXT)
            {
            //is this a folder or a value?
            if(m_pPidlMgr->IsFolder(pidl))
               {
               LoadString(g_hInst, IDS_FOLDER_DATA, lpdi->item.pszText, lpdi->item.cchTextMax);
               }
            //its an item
            else
               {
               m_pPidlMgr->GetData(pidl, lpdi->item.pszText, lpdi->item.cchTextMax);
               }
            }
         }
      //the item text is being requested
      else
         {
         //is the text being requested?
         if(lpdi->item.mask & LVIF_TEXT)
            {
            STRRET   str;

            if(SUCCEEDED(m_psfParent->GetDisplayNameOf(pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &str)))
               {
               GetTextFromSTRRET(m_pMalloc, &str, pidl, lpdi->item.pszText, lpdi->item.cchTextMax);
               }
            }

         //is the image being requested?
         if(lpdi->item.mask & LVIF_IMAGE)
            {
            IExtractIcon   *pei;

            if(SUCCEEDED(m_psfParent->GetUIObjectOf(m_hWnd, 1, (LPCITEMIDLIST*)&pidl, IID_IExtractIcon, NULL, (LPVOID*)&pei)))
               {
               UINT  uFlags;

               //GetIconLocation will give us the index into our image list
               pei->GetIconLocation(GIL_FORSHELL, NULL, 0, &lpdi->item.iImage, &uFlags);

               pei->Release();
               }
            }
         }
      }
      return 0;

   case LVN_BEGINLABELEDIT:
      {
      NMLVDISPINFO   *lpdi = (NMLVDISPINFO*)lpnmh;
      LPITEMIDLIST   pidl = (LPITEMIDLIST)lpdi->item.lParam;
      DWORD          dwAttr = SFGAO_CANRENAME;

      m_psfParent->GetAttributesOf(1, (LPCITEMIDLIST*)&pidl, &dwAttr);
      if(SFGAO_CANRENAME & dwAttr)
         {
         m_fInEdit = TRUE;
         return FALSE;
         }
      }
      return TRUE;

   case LVN_ENDLABELEDIT:
      {
      LRESULT        lResult = 0;
      NMLVDISPINFO   *pdi = (NMLVDISPINFO*)lpnmh;

      if(pdi->item.pszText)
         {
         //the user wants to keep the change
         LVITEM         lvItem;
         LPITEMIDLIST   pidl;
         WCHAR          wszNewName[MAX_PATH];

         ZeroMemory(&lvItem, sizeof(lvItem));
         lvItem.mask = LVIF_PARAM;
         lvItem.iItem = pdi->item.iItem;
         ListView_GetItem(m_hwndList, &lvItem);

         LocalToWideChar(wszNewName, pdi->item.pszText, MAX_PATH);

         /*
         This will cause this class' RenameItem function to be called. This
         can cause problems, so the m_fInEdit flag will prevent RenameItem
         from being called on this object. SetNameOf will also free the old
         PIDL, so we don't have to do it again.
         */
         HRESULT  hr = m_psfParent->SetNameOf(NULL, (LPITEMIDLIST)lvItem.lParam, wszNewName, 0, &pidl);

         if(SUCCEEDED(hr) && pidl)
            {
            lvItem.mask = LVIF_PARAM;
            lvItem.lParam = (LPARAM)pidl;
            ListView_SetItem(m_hwndList, &lvItem);
            lResult = TRUE;
            }
         }

      m_fInEdit = FALSE;
      return lResult;
      }

   case LVN_BEGINDRAG:
      {
      HRESULT        hr;
      IDataObject    *pDataObject = NULL;
      UINT           uItemCount;
      LPITEMIDLIST   *aPidls;

      //get the number of selected items
      uItemCount = ListView_GetSelectedCount(m_hwndList);
      if(!uItemCount)
         return 0;

      aPidls = (LPITEMIDLIST*)m_pMalloc->Alloc(uItemCount * sizeof(LPITEMIDLIST));

      if(aPidls)
         {
         int   i;
         UINT  x;

         for(i = 0, x = 0; x < uItemCount && i < ListView_GetItemCount(m_hwndList); i++)
            {
            if(ListView_GetItemState(m_hwndList, i, LVIS_SELECTED))
               {
               LVITEM   lvItem;

               lvItem.mask = LVIF_PARAM;
               lvItem.iItem = i;

               ListView_GetItem(m_hwndList, &lvItem);
               aPidls[x] = (LPITEMIDLIST)lvItem.lParam;
               x++;
               }
            }

         hr = m_psfParent->GetUIObjectOf( m_hWnd,
                                          uItemCount,
                                          (LPCITEMIDLIST*)aPidls,
                                          IID_IDataObject,
                                          NULL,
                                          (LPVOID*)&pDataObject);

         if(SUCCEEDED(hr) && pDataObject)
            {
            IDropSource *pDropSource = new CDropSource;
            DWORD       dwEffect = DROPEFFECT_COPY | DROPEFFECT_MOVE;
            DWORD       dwAttributes = SFGAO_CANLINK;

            hr = m_psfParent->GetAttributesOf(  uItemCount,
                                                (LPCITEMIDLIST*)aPidls,
                                                &dwAttributes);

            if(SUCCEEDED(hr) && (dwAttributes & SFGAO_CANLINK))
               {
               dwEffect |= DROPEFFECT_LINK;
               }

            DoDragDrop( pDataObject,
                        pDropSource,
                        dwEffect,
                        &dwEffect);

            pDataObject->Release();
            pDropSource->Release();
            }

         m_pMalloc->Free(aPidls);
         }
      }
      break;

   case LVN_ITEMCHANGED:
      {
      UpdateToolbar();
      }
      break;
   }

return 0;
}

LRESULT CShellView::OnSetFocus ( VOID ) [private]

Definition at line 836 of file ShlView.Cpp.

{
/*
Tell the browser one of our windows has received the focus. This should always
be done before merging menus (OnActivate merges the menus) if one of our
windows has the focus.
*/
m_pShellBrowser->OnViewWindowActive(this);

OnActivate(SVUIA_ACTIVATE_FOCUS);

return 0;
}

LRESULT CShellView::OnSettingChange ( LPCTSTR lpszSection ) [private]

Definition at line 1511 of file ShlView.Cpp.

{
if(0 == lstrcmpi(lpszSection, TEXT("ShellState")))
   {
   GetShellSettings();
   return 0;
   }

return 0;
}

LRESULT CShellView::OnSize | ( | WORD | wWidth,
 |  | WORD | wHeight |
 | ) |  |  | [private]

Definition at line 1250 of file ShlView.Cpp.

{
//resize the ListView to fit our window
if(m_hwndList)
   {
   MoveWindow(m_hwndList, 0, 0, wWidth, wHeight, TRUE);

   ListView_SetColumnWidth(m_hwndList, 0, g_nColumn);
   ListView_SetColumnWidth(m_hwndList, 1, LVSCW_AUTOSIZE_USEHEADER);
   }

return 0;
}

LRESULT CShellView::OnViewDetails ( VOID ) [private]

Definition at line 1974 of file ShlView.Cpp.

{
m_FolderSettings.ViewMode = FVM_DETAILS;

DWORD dwStyle = GetWindowLong(m_hwndList, GWL_STYLE);
dwStyle &= ~LVS_TYPEMASK;
dwStyle |= LVS_REPORT;
SetWindowLong(m_hwndList, GWL_STYLE, dwStyle);

return 0;
}

LRESULT CShellView::OnViewLarge ( VOID ) [private]

Definition at line 1920 of file ShlView.Cpp.

{
m_FolderSettings.ViewMode = FVM_ICON;

DWORD dwStyle = GetWindowLong(m_hwndList, GWL_STYLE);
dwStyle &= ~LVS_TYPEMASK;
dwStyle |= LVS_ICON;
SetWindowLong(m_hwndList, GWL_STYLE, dwStyle);

return 0;
}

LRESULT CShellView::OnViewList ( VOID ) [private]

Definition at line 1956 of file ShlView.Cpp.

{
m_FolderSettings.ViewMode = FVM_LIST;

DWORD dwStyle = GetWindowLong(m_hwndList, GWL_STYLE);
dwStyle &= ~LVS_TYPEMASK;
dwStyle |= LVS_LIST;
SetWindowLong(m_hwndList, GWL_STYLE, dwStyle);

return 0;
}

LRESULT CShellView::OnViewSmall ( VOID ) [private]

Definition at line 1938 of file ShlView.Cpp.

{
m_FolderSettings.ViewMode = FVM_SMALLICON;

DWORD dwStyle = GetWindowLong(m_hwndList, GWL_STYLE);
dwStyle &= ~LVS_TYPEMASK;
dwStyle |= LVS_SMALLICON;
SetWindowLong(m_hwndList, GWL_STYLE, dwStyle);

return 0;
}

STDMETHODIMP CShellView::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppReturn
 | ) |  |

Definition at line 148 of file ShlView.Cpp.

{
*ppReturn = NULL;

//IUnknown
if(IsEqualIID(riid, IID_IUnknown))
   {
   *ppReturn = this;
   }

//IOleWindow
else if(IsEqualIID(riid, IID_IOleWindow))
   {
   *ppReturn = (IOleWindow*)this;
   }

//IShellView
else if(IsEqualIID(riid, IID_IShellView))
   {
   *ppReturn = (IShellView*)this;
   }

if(*ppReturn)
   {
   (*(LPUNKNOWN*)ppReturn)->AddRef();
   return S_OK;
   }

return E_NOINTERFACE;
}

STDMETHODIMP CShellView::Refresh ( VOID )

Definition at line 602 of file ShlView.Cpp.

{
//empty the list
ListView_DeleteAllItems(m_hwndList);

//refill the list
FillList();

return S_OK;
}

BOOL CShellView::RenameItem | ( | LPCITEMIDLIST | pidlOld,
 |  | LPCITEMIDLIST | pidlNew |
 | ) |  |  | [private]

Definition at line 1754 of file ShlView.Cpp.

{
//don't allow this to be called if this object is the being edited

if(m_fInEdit)
   return TRUE;

//find the item in the list
int   nIndex = FindItemPidl(pidlOld);

if(-1 != nIndex)
   {
   BOOL     fReturn;
   LVITEM   lvItem;

   ZeroMemory(&lvItem, sizeof(lvItem));
   lvItem.mask = LVIF_PARAM;
   lvItem.iItem = nIndex;
   ListView_GetItem(m_hwndList, &lvItem);

   m_pPidlMgr->Delete((LPITEMIDLIST)lvItem.lParam);

   ZeroMemory(&lvItem, sizeof(lvItem));
   lvItem.mask = LVIF_PARAM;
   lvItem.iItem = nIndex;
   lvItem.lParam = (LPARAM)m_pPidlMgr->Copy(pidlNew);
   fReturn = ListView_SetItem(m_hwndList, &lvItem);
   ListView_Update(m_hwndList, nIndex);
   return fReturn;
   }

return FALSE;
}

STDMETHODIMP CShellView::SaveViewState ( VOID )

Definition at line 732 of file ShlView.Cpp.

{
return S_OK;
}

STDMETHODIMP CShellView::SelectItem | ( | LPCITEMIDLIST | pidlItem,
 |  | UINT | uFlags
 | ) |  |

Definition at line 743 of file ShlView.Cpp.

{
return E_NOTIMPL;
}

CShellView::STDMETHOD_ | ( | DWORD | ,
 |  | AddRef |
 | ) |  |
CShellView::STDMETHOD_ | ( | DWORD | ,
 |  | Release |
 | ) |  |
STDMETHODIMP CShellView::TranslateAccelerator ( LPMSG pmsg )

Definition at line 248 of file ShlView.Cpp.

{
if(m_fInEdit)
   {
   if((pmsg->message >= WM_KEYFIRST) && (pmsg->message <= WM_KEYLAST))
      {
      TranslateMessage(pmsg);
      DispatchMessage(pmsg);
      return S_OK;
      }
   }
else if(::TranslateAccelerator(m_hWnd, m_hAccels, pmsg))
   return S_OK;

return S_FALSE;
}

STDMETHODIMP CShellView::UIActivate ( UINT uState )

Definition at line 379 of file ShlView.Cpp.

{
//don't do anything if the state isn't really changing
if(m_uState == uState)
   return S_OK;

//OnActivate handles the menu merging and internal state
OnActivate(uState);

//only do this if we are active
if(uState != SVUIA_DEACTIVATE)
   {
   TCHAR szName[MAX_PATH] = TEXT("");
   LRESULT  lResult;
   int      nPartArray[1] = {-1};

   //update the status bar
   //set the number of parts
   m_pShellBrowser->SendControlMsg(FCW_STATUS, SB_SETPARTS, 1, (LPARAM)nPartArray, &lResult);

   //set the text for the parts
   m_pShellBrowser->SendControlMsg(FCW_STATUS, SB_SETTEXT, 0, (LPARAM)g_szExtTitle, &lResult);
   }

return S_OK;
}

VOID CShellView::UpdateData ( LPCITEMIDLIST pidl ) [private]

Definition at line 1888 of file ShlView.Cpp.

{
int   i;

i = FindItemPidl(pidl);

if(-1 != i)
   {
   LVITEM   lvItem;

   ZeroMemory(&lvItem, sizeof(lvItem));
   lvItem.mask = LVIF_PARAM;
   lvItem.iItem = i;
   ListView_GetItem(m_hwndList, &lvItem);

   m_pPidlMgr->Delete((LPITEMIDLIST)lvItem.lParam);

   ZeroMemory(&lvItem, sizeof(lvItem));
   lvItem.mask = LVIF_PARAM;
   lvItem.iItem = i;
   lvItem.lParam = (LPARAM)m_pPidlMgr->Copy(pidl);
   ListView_SetItem(m_hwndList, &lvItem);
   ListView_Update(m_hwndList, i);
   }
}

LRESULT CShellView::UpdateMenu ( HMENU hMenu ) [private]

Definition at line 886 of file ShlView.Cpp.

{
UINT  uCommand;

//enable/disable your menu items here
OpenClipboard(NULL);
HGLOBAL  hClip = GetClipboardData(RegisterClipboardFormat(CFSTR_SAMPVIEWDATA));
CloseClipboard();

EnableMenuItem(hMenu, IDM_PASTE, MF_BYCOMMAND | (hClip ? MF_ENABLED : MF_DISABLED | MF_GRAYED));

uCommand = ListView_GetSelectedCount(m_hwndList);
EnableMenuItem(hMenu, IDM_CUT, MF_BYCOMMAND | (uCommand ? MF_ENABLED : MF_DISABLED | MF_GRAYED));
EnableMenuItem(hMenu, IDM_COPY, MF_BYCOMMAND | (uCommand ? MF_ENABLED : MF_DISABLED | MF_GRAYED));

switch(m_FolderSettings.ViewMode)
   {
   case FVM_ICON:
      uCommand = IDM_VIEW_LARGE;
      break;

   case FVM_SMALLICON:
      uCommand = IDM_VIEW_SMALL;
      break;

   case FVM_LIST:
      uCommand = IDM_VIEW_LIST;
      break;

   case FVM_DETAILS:
   default:
      uCommand = IDM_VIEW_DETAILS;
      break;
   }

CheckMenuRadioItem(hMenu, IDM_VIEW_LARGE, IDM_VIEW_DETAILS, uCommand, MF_BYCOMMAND);

return 0;
}

LRESULT CShellView::UpdateToolbar ( VOID ) [private]

Definition at line 932 of file ShlView.Cpp.

{
LRESULT  lResult;
UINT     uCommand;

//enable/disable/check the toolbar items here
switch(m_FolderSettings.ViewMode)
   {
   case FVM_ICON:
      uCommand = IDM_VIEW_LARGE;
      break;

   case FVM_SMALLICON:
      uCommand = IDM_VIEW_SMALL;
      break;

   case FVM_LIST:
      uCommand = IDM_VIEW_LIST;
      break;

   case FVM_DETAILS:
   default:
      uCommand = IDM_VIEW_DETAILS;
      break;
   }

m_pShellBrowser->SendControlMsg( FCW_TOOLBAR,
                                 TB_CHECKBUTTON,
                                 uCommand,
                                 MAKELPARAM(TRUE, 0),
                                 &lResult);

return 0;
}

LRESULT CALLBACK CShellView::WndProc | ( | HWND | hWnd,
 |  | UINT | uMessage,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static, private]

Definition at line 768 of file ShlView.Cpp.

{
CShellView  *pThis = (CShellView*)GetWindowLongPtr(hWnd, VIEW_POINTER_OFFSET);

switch (uMessage)
   {
   case WM_NCCREATE:
      {
      LPCREATESTRUCT lpcs = (LPCREATESTRUCT)lParam;
      pThis = (CShellView*)(lpcs->lpCreateParams);
      SetWindowLongPtr(hWnd, VIEW_POINTER_OFFSET, (LONG_PTR)pThis);

      //set the window handle
      pThis->m_hWnd = hWnd;
      }
      break;

   case WM_SIZE:
      return pThis->OnSize(LOWORD(lParam), HIWORD(lParam));

   case WM_CREATE:
      return pThis->OnCreate();

   case WM_DESTROY:
      return pThis->OnDestroy();

   case WM_SETFOCUS:
      return pThis->OnSetFocus();

   case WM_KILLFOCUS:
      return pThis->OnKillFocus();

   case WM_ACTIVATE:
      return pThis->OnActivate(SVUIA_ACTIVATE_FOCUS);

   case WM_COMMAND:
      return pThis->OnCommand(   GET_WM_COMMAND_ID(wParam, lParam),
                                 GET_WM_COMMAND_CMD(wParam, lParam),
                                 GET_WM_COMMAND_HWND(wParam, lParam));

   case WM_INITMENUPOPUP:
      return pThis->UpdateMenu((HMENU)wParam);

   case WM_NOTIFY:
      return pThis->OnNotify((UINT)wParam, (LPNMHDR)lParam);

   case WM_SETTINGCHANGE:
      return pThis->OnSettingChange((LPCTSTR)lParam);

   case WM_CONTEXTMENU:
      {
      pThis->DoContextMenu(LOWORD(lParam), HIWORD(lParam), FALSE, (UINT)-1);
      return 0;
      }
   }

return DefWindowProc(hWnd, uMessage, wParam, lParam);
}

Friends And Related Function Documentation

friend class CContextMenu [friend]

Definition at line 47 of file ShlView.h.

friend class CShellFolder [friend]

Definition at line 46 of file ShlView.h.

Member Data Documentation

BOOL CShellView::m_fInEdit [private]

Definition at line 63 of file ShlView.h.

FOLDERSETTINGS CShellView::m_FolderSettings [private]

Definition at line 53 of file ShlView.h.

HACCEL CShellView::m_hAccels [private]

Definition at line 62 of file ShlView.h.

HMENU CShellView::m_hMenu [private]

Definition at line 58 of file ShlView.h.

HWND CShellView::m_hWnd [private]

Definition at line 56 of file ShlView.h.

HWND CShellView::m_hwndList [private]

Definition at line 57 of file ShlView.h.

HWND CShellView::m_hwndParent [private]

Definition at line 55 of file ShlView.h.

DWORD CShellView::m_ObjRefCount [private]

Definition at line 50 of file ShlView.h.

LPITEMIDLIST CShellView::m_pidl [private]

Definition at line 52 of file ShlView.h.

LPMALLOC CShellView::m_pMalloc [private]

Definition at line 60 of file ShlView.h.

CPidlMgr* CShellView::m_pPidlMgr [private]

Definition at line 61 of file ShlView.h.

CShellFolder* CShellView::m_psfParent [private]

Definition at line 59 of file ShlView.h.

LPSHELLBROWSER CShellView::m_pShellBrowser [private]

Definition at line 54 of file ShlView.h.

UINT CShellView::m_uState [private]

Definition at line 51 of file ShlView.h.

The documentation for this class was generated from the following files:
  • WinUI/Shell/SampView/ShlView.h
  • WinUI/Shell/SampView/ShlView.Cpp
Generated on Wed Nov 13 2024 16:57:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CShutdownDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Private Attributes

CShutdownDlg Class Reference

#include "ShutdownDlg.h"

List of all members.

Public Types

enum | { IDD = IDD_SHUTDOWN }

Public Member Functions

CShutdownDlg (CWnd *pParent=NULL)

Public Attributes

CEdit | m_serverName
CListBox | m_shutdown

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
virtual BOOL | OnInitDialog ()
afx_msg void | OnShutdown ()

Private Attributes

HANDLE serverHandle
TCHAR * | serverName

Detailed Description

Definition at line 29 of file ShutdownDlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 37 of file ShutdownDlg.h.

{ IDD = IDD_SHUTDOWN };

Constructor & Destructor Documentation

CShutdownDlg::CShutdownDlg ( CWnd * pParent = NULL )

Definition at line 33 of file ShutdownDlg.Cpp.

  : CDialog(CShutdownDlg::IDD, pParent)
{
  //{{AFX_DATA_INIT(CShutdownDlg)
    // NOTE: the ClassWizard will add member initialization here
  //}}AFX_DATA_INIT
}

Member Function Documentation

void CShutdownDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 42 of file ShutdownDlg.Cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CShutdownDlg)
  DDX_Control(pDX, IDC_SERVERNAME, m_serverName);
  DDX_Control(pDX, IDC_SHUTDOWN_PARAMETERS, m_shutdown);
  //}}AFX_DATA_MAP
}

BOOL CShutdownDlg::OnInitDialog ( void ) [protected, virtual]

Definition at line 61 of file ShutdownDlg.Cpp.

{
  CDialog::OnInitDialog();

  serverName = g_pDoc->GetServerName();
  //AfxMessageBox(serverName);
  serverHandle = WTSOpenServer(serverName);

  CString serverDisplay;
  serverDisplay = "Shutdown parameters for ";
  if (*serverName == NULL)
    serverDisplay += "local server";
  else
    serverDisplay += serverName;
  m_serverName.SetWindowText(serverDisplay);

  for (int i=0; i < MAXSHUTDOWNITEMS; i++)
    m_shutdown.InsertString(i, ShutdownItems[i].ShutdownName);
  m_shutdown.SetCurSel(0);
  return TRUE;
}

void CShutdownDlg::OnShutdown ( ) [protected]

Definition at line 84 of file ShutdownDlg.Cpp.

{
  int nIndex = m_shutdown.GetCurSel();
  if (!WTSShutdownSystem(serverHandle, ShutdownItems[nIndex].ShutdownFlag))
    AfxMessageBox("Unable to shutdown system");
  EndDialog(0);
}

Member Data Documentation

CEdit CShutdownDlg::m_serverName

Definition at line 38 of file ShutdownDlg.h.

CListBox CShutdownDlg::m_shutdown

Definition at line 39 of file ShutdownDlg.h.

HANDLE CShutdownDlg::serverHandle [private]

Definition at line 60 of file ShutdownDlg.h.

TCHAR* CShutdownDlg::serverName [private]

Definition at line 61 of file ShutdownDlg.h.

The documentation for this class was generated from the following files:
  • WinBase/WtsApi/WtsApi/ShutdownDlg.h
  • WinBase/WtsApi/WtsApi/ShutdownDlg.Cpp
Generated on Wed Nov 13 2024 16:57:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSids Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CSids Class Reference

#include "dbauthplugin.h"

List of all members.

Public Member Functions

CSids ()
~CSids ()
void | CleanUp (BOOL fFreeSid=TRUE)
HRESULT | CopyAndAddSid (PSID pSid, CSids **ppSids)
HRESULT | CopyAndRemoveItem (DWORD dwIndex, CSids **ppSids)
HRESULT | GetAuthorizedUsers (IWMSNamedValues *pNamedValues)
HRESULT | GetUsers (BSTR *pbstrUserNames)
BOOL | MatchSid (PSID pSid, DWORD *pdwIndex)
HRESULT | SetAuthorizedUsers (IWMSNamedValues *pNamedValues)

Public Attributes

DWORD m_cItems
PSID * m_pSidList

Detailed Description

Definition at line 24 of file dbauthplugin.h.

Constructor & Destructor Documentation

CSids::CSids ( ) [inline]

Definition at line 27 of file dbauthplugin.h.

: m_cItems( 0 ), m_pSidList( NULL ) {};

CSids::~CSids ( ) [inline]

Definition at line 28 of file dbauthplugin.h.

{ CleanUp(); };

Member Function Documentation

void CSids::CleanUp ( BOOL fFreeSid = TRUE )

Definition at line 744 of file dbauthplugin.cpp.

{

    if( fFreeSid && ( 0 != m_cItems ) && ( NULL != m_pSidList ) )
    {
        // Free the pSidList information
        for( DWORD dwIndex = 0; dwIndex < m_cItems; dwIndex ++ )
        {
            if( NULL != m_pSidList[ dwIndex ] )
            {
                LocalFree( m_pSidList[ dwIndex ] );
            }
        }
    }

    m_cItems = 0;

    if( NULL != m_pSidList )
    {
        delete [] m_pSidList;
        m_pSidList = NULL;
    }

    return;
}

HRESULT CSids::CopyAndAddSid | ( | PSID | pSid,
 |  | CSids ** | ppSids
 | ) |  |

Definition at line 803 of file dbauthplugin.cpp.

{
    HRESULT hr = S_OK;
    CSids *pNewSids = NULL;

    do
    {
        pNewSids = new CSids;
        if( NULL == pNewSids )
        {
            hr = E_OUTOFMEMORY;
            break;
        }

        pNewSids->m_pSidList = new PSID[ m_cItems + 1 ];
        if( NULL == pNewSids->m_pSidList )
        {
            hr = E_OUTOFMEMORY;
            break;
        }

        pNewSids->m_cItems = m_cItems + 1;

        // copy the Sids to the new array
        for( DWORD dwIndex = 0; dwIndex < m_cItems; dwIndex++ )
        {
            pNewSids->m_pSidList[ dwIndex ] = m_pSidList[ dwIndex ];
        }
        pNewSids->m_pSidList[ m_cItems ] = pSid;

    }
    while( FALSE );

    if( SUCCEEDED( hr ) )
    {
        *ppSids = pNewSids;
    }
    else if( NULL != pNewSids )
    {
        pNewSids->CleanUp( FALSE );
        delete pNewSids;
    }

    return( hr );
}

HRESULT CSids::CopyAndRemoveItem | ( | DWORD | dwIndex,
 |  | CSids ** | ppSids
 | ) |  |

Definition at line 851 of file dbauthplugin.cpp.

{
    HRESULT hr = S_OK;
    CSids *pNewSids = NULL;
    DWORD dwIndex = 0;

    do
    {
        if( ( 0 == m_cItems ) || ( dwIndex >= m_cItems ) )
        {
            hr = E_INVALIDARG;
            break;
        }

        pNewSids = new CSids;
        if( NULL == pNewSids )
        {
            hr = E_OUTOFMEMORY;
            break;
        }

        if( m_cItems > 1 )
        {
            pNewSids->m_pSidList = new PSID[ m_cItems - 1 ];
            if( NULL == pNewSids->m_pSidList )
            {
                hr = E_OUTOFMEMORY;
                break;
            }

            pNewSids->m_cItems = m_cItems - 1;

            // copy the Sids to the new array
            for( dwIndex = 0; dwIndex < dwIndexRemove; dwIndex ++ )
            {
                pNewSids->m_pSidList[ dwIndex ] = m_pSidList[ dwIndex ];
            }
            for( dwIndex = dwIndexRemove + 1; dwIndex < m_cItems; dwIndex ++ )
            {
                pNewSids->m_pSidList[ dwIndex - 1 ] = m_pSidList[ dwIndex ];
            }
        }

    }
    while( FALSE );

    if( SUCCEEDED( hr ) )
    {
        *ppSids = pNewSids;
    }
    else if( NULL != pNewSids )
    {
        pNewSids->CleanUp( FALSE );
        delete pNewSids;
    }

    return( hr );
}

HRESULT CSids::GetAuthorizedUsers ( IWMSNamedValues * pNamedValues )

Definition at line 1022 of file dbauthplugin.cpp.

{
    if( NULL == pNamedValues )
    {
        return( E_INVALIDARG );
    }

    CleanUp();

    HRESULT hr = S_OK;
    IWMSNamedValue * pValue = NULL;
    SAFEARRAY* psa = NULL;
    BOOL fPsaAccessed = FALSE;
    CComVariant varValue;
    VARIANT varPropName;
    VariantInit( &varPropName );

    do
    {

        BSTR bstrPropName = NULL;
        bstrPropName = SysAllocString( AUTHORIZED_USERS_PROPERTY );
        if( NULL == bstrPropName )
        {
            hr = E_OUTOFMEMORY;
            break;
        }

        // bstrPropName will be free by varPropName
        V_VT(&varPropName) = VT_BSTR;
        V_BSTR( &varPropName ) = bstrPropName;

        // Get the authorized users from namespace
        hr = pNamedValues->get_Item( varPropName, &pValue );
        if( FAILED( hr ) )
        {
            // no value found
            break;
        }

        hr = pValue->get_Value( &varValue );
        if( FAILED( hr ) )
        {
            break;
        }

        if( ( VT_ARRAY | VT_UI1 ) != V_VT( &varValue ) )
        {
            hr = E_FAIL;
            break;
        }

        psa = V_ARRAY( &varValue );

        DWORD dwBufSize = psa->rgsabound[ 0 ].cElements;
        DWORD dwCount = 0;
        if( dwBufSize < sizeof( dwCount ) )
        {
            hr = E_FAIL;
            break;
        }

        BYTE *pBuf = NULL;
        hr = SafeArrayAccessData( psa, (void **) &pBuf );
        if( FAILED( hr ) )
        {
            break;
        }

        fPsaAccessed = TRUE;

        memcpy( &dwCount, pBuf, sizeof( dwCount ) );
        pBuf += sizeof( dwCount );
        dwBufSize -= sizeof( dwCount );

        m_pSidList = new PSID[ dwCount ];
        if( NULL == m_pSidList )
        {
            hr = E_OUTOFMEMORY;
            break;
        }

        m_cItems = dwCount;

        for( DWORD dwIndex = 0; dwIndex < dwCount; dwIndex ++ )
        {
            m_pSidList[ dwIndex ] = NULL;
        }

        for( DWORD dwIndex = 0; dwIndex < dwCount; dwIndex ++ )
        {
            DWORD dwSize = 0;
            if( dwBufSize < sizeof( dwSize ) )
            {
                hr = E_FAIL;
                break;
            }

            memcpy( &dwSize, pBuf, sizeof( dwSize ) );
            pBuf += sizeof( dwSize );
            dwBufSize -= sizeof( dwSize );

            if( 0 != dwSize )
            {
                if( dwBufSize < dwSize )
                {
                    hr = E_FAIL;
                    break;
                }

                m_pSidList[ dwIndex ] = (SID *) LocalAlloc( LPTR, dwSize );
                if( NULL == m_pSidList[ dwIndex ] )
                {
                    hr = E_OUTOFMEMORY;
                    break;
                }
                memcpy( m_pSidList[ dwIndex ], pBuf, dwSize );
                pBuf += dwSize;
                dwBufSize -= dwSize;
            }
        }
    }
    while( FALSE );

    if( FAILED( hr ) )
    {
        CleanUp();
    }

    if( ( NULL == psa ) && fPsaAccessed )
    {
        SafeArrayUnaccessData( psa );
    }

    //
    // cleanup local variables
    //
    if( NULL != pValue )
    {
        pValue->Release();
    }

    VariantClear( &varPropName );

    return( hr );
}

HRESULT CSids::GetUsers ( BSTR * pbstrUserNames )

Definition at line 1171 of file dbauthplugin.cpp.

{
    if( NULL == pbstrUserNames )
    {
        return( E_INVALIDARG );
    }

    HRESULT hr = S_OK;
    PSID pSid = NULL;
    WCHAR *pwszUserNames = NULL;
    *pbstrUserNames = NULL;

    do
    {
        // Get the total bufer size needed to store all users
        DWORD dwBufSize = 0;
        for( DWORD dwIndex = 0; dwIndex < m_cItems; dwIndex ++ )
        {
            if( NULL != m_pSidList[ dwIndex ] )
            {
                DWORD cbUserName = 0;
                DWORD cbDomainName = 0;
                SID_NAME_USE eUse;
                BOOL fOk = LookupAccountSid( NULL,      // name of local or remote computer
                                m_pSidList[ dwIndex ],  // security identifier
                                NULL,                   // account name buffer
                                &cbUserName,            // size of account name buffer
                                NULL,                   // domain name
                                &cbDomainName,          // size of domain name buffer
                                &eUse                   // SID type
                                );
                dwBufSize = dwBufSize + cbUserName + cbDomainName;
            }
        }

        if( 0 == dwBufSize )
        {
            break;
        }

        pwszUserNames = new WCHAR[ dwBufSize ];
        if( NULL == pwszUserNames )
        {
            hr = E_OUTOFMEMORY;
            break;
        }

        WCHAR *p = pwszUserNames;
        for( DWORD dwIndex = 0; dwIndex < m_cItems; dwIndex ++ )
        {
            if( NULL != m_pSidList[ dwIndex ] )
            {
                DWORD cbUserName = 0;
                DWORD cbDomainName = 0;
                SID_NAME_USE eUse;
                BOOL fOk = LookupAccountSid( NULL,      // name of local or remote computer
                                m_pSidList[ dwIndex ],  // security identifier
                                NULL,                   // account name buffer
                                &cbUserName,            // size of account name buffer
                                NULL,                   // domain name
                                &cbDomainName,          // size of domain name buffer
                                &eUse                   // SID type
                                );

                fOk = LookupAccountSid( NULL,           // name of local or remote computer
                                m_pSidList[ dwIndex ],  // security identifier
                                p + cbDomainName,       // account name buffer
                                &cbUserName,            // size of account name buffer
                                p,                      // domain name
                                &cbDomainName,          // size of domain name buffer
                                &eUse                   // SID type
                                );
                if( !fOk )
                {
                    continue;
                }

                if( 0 != cbDomainName )
                {
                    p += cbDomainName;
                    *p = L'\\';
                    p++;
                }

                // seperate users with a space
                p += cbUserName;
                *p = L' ';
                p++;
            }

        }

        // null term the last user
        if( p > pwszUserNames )
        {
            *( p - 1 ) = L'\0';
        }
        else
        {
            *p = L'\0';
        }

        *pbstrUserNames = SysAllocString( pwszUserNames );
        if( NULL == *pbstrUserNames )
        {
            hr = E_OUTOFMEMORY;
        }

    }
    while( FALSE );

    if( NULL != pwszUserNames )
    {
        delete [] pwszUserNames;
    }

    return( hr );

}

BOOL CSids::MatchSid | ( | PSID | pSid,
 |  | DWORD * | pdwIndex
 | ) |  |

Definition at line 772 of file dbauthplugin.cpp.

{

    BOOL bFound = FALSE;

    do
    {
        if( NULL == m_pSidList )
        {
            break;
        }

        for( DWORD dwIndex = 0; dwIndex < m_cItems; dwIndex ++ )
        {
            if( ( NULL != m_pSidList[ dwIndex ] )
                && EqualSid( m_pSidList[ dwIndex], pSid ) )
            {
                bFound = TRUE;
                *pdwIndex = dwIndex;
                break;
            }
        }
    }
    while( FALSE );

    return( bFound );

}

HRESULT CSids::SetAuthorizedUsers ( IWMSNamedValues * pNamedValues )

Definition at line 912 of file dbauthplugin.cpp.

{
    if( NULL == pNamedValues )
    {
        return( E_INVALIDARG );
    }

    HRESULT hr = S_OK;
    DWORD dwIndex = 0;
    IWMSNamedValue * pValue = NULL;
    CComVariant varValue;
    BSTR bstrPropName = NULL;
    BYTE *pBuf = NULL;
    SAFEARRAY* psa = NULL;
    BOOL fPsaAccessed = FALSE;

    // size of m_cItems and one DWORD for each item to store the size of Sid
    DWORD dwBufSize = sizeof( m_cItems ) + m_cItems * sizeof( DWORD );

    do
    {
        // find the total buffer size required to store the Sid list
        for( dwIndex = 0; dwIndex < m_cItems; dwIndex ++ )
        {
            if( NULL != m_pSidList[ dwIndex ] )
            {
                dwBufSize += GetLengthSid( m_pSidList[ dwIndex ] );
            }
        }

        // create a safearry to store the Sid list
        SAFEARRAYBOUND rgsabound[ 1 ];
        rgsabound[ 0 ].lLbound = 0;
        rgsabound[ 0 ].cElements = dwBufSize;
        psa = SafeArrayCreate( VT_UI1, 1, rgsabound );
        if( NULL == psa )
        {
            hr = E_OUTOFMEMORY;
            break;
        }

        V_VT( &varValue ) = VT_ARRAY | VT_UI1;
        V_ARRAY( &varValue ) = psa;

        hr = SafeArrayAccessData( psa, (void **) &pBuf );
        if( FAILED( hr ) )
        {
            break;
        }

        fPsaAccessed = TRUE;

        // copy Sid list to buffer
        BYTE *p = pBuf;
        memcpy( p, &m_cItems, sizeof( m_cItems ) );
        p += sizeof( m_cItems );
        for( dwIndex = 0; dwIndex < m_cItems; dwIndex ++ )
        {
            DWORD dwSize = 0;
            if( NULL == m_pSidList[ dwIndex ] )
            {
                memcpy( p, &dwSize, sizeof( dwSize ) );
                p += sizeof( dwSize );
            }
            else
            {
                dwSize = GetLengthSid( m_pSidList[ dwIndex ] );
                memcpy( p, &dwSize, sizeof( dwSize ) );
                p += sizeof( dwSize );
                memcpy( p, m_pSidList[ dwIndex ], dwSize );
                p += dwSize;
            }
        }

        bstrPropName = SysAllocString( AUTHORIZED_USERS_PROPERTY );
        if( NULL == bstrPropName )
        {
            hr = E_OUTOFMEMORY;
            break;
        }

        // persist the sid data to namespace
        hr = pNamedValues->Add( bstrPropName, varValue, &pValue );

    }
    while( FALSE );

    //
    // cleanup local variables
    //
    if( ( NULL == psa ) && fPsaAccessed )
    {
        SafeArrayUnaccessData( psa );
    }

    if( NULL != pValue )
    {
        pValue->Release();
    }

    if( NULL != bstrPropName )
    {
        SysFreeString( bstrPropName );
    }

    return( hr );
}

Member Data Documentation

DWORD CSids::m_cItems

Definition at line 38 of file dbauthplugin.h.

PSID* CSids::m_pSidList

Definition at line 39 of file dbauthplugin.h.

The documentation for this class was generated from the following files:
  • Multimedia/WindowsMediaServices9/Authorization/dbauthplugin.h
  • Multimedia/WindowsMediaServices9/Authorization/dbauthplugin.cpp
Generated on Wed Nov 13 2024 16:57:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSimple Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CSimple Class Reference

#include "Simple.h"

List of all members.

Public Member Functions

CSimple ()
DECLARE_REGISTRY (CSimple, _T("IISSample.C++ATLSimple.1"), _T("IISSample.C++ATLSimple"), IDS_SIMPLE_DESC, THREADFLAGS_BOTH) STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid)
HRESULT | FinalCountruct ()
void | FinalRelease ()
STDMETHOD() | get_myProperty (BSTR *pbstrOutValue)
STDMETHOD() | myMethod (BSTR bstrIn, BSTR *pbstrOut)
STDMETHOD() | put_myProperty (BSTR bstrInValue)

Private Attributes

CComBSTR | m_bstrMyProperty
CComPtr< IUnknown > | m_pUnkMarshaler

Detailed Description

Definition at line 9 of file Simple.h.

Constructor & Destructor Documentation

CSimple::CSimple ( )

Definition at line 22 of file Simple.Cpp.

    : m_bstrMyProperty(OLESTR("C++ ATL Simple Component"))
{}

Member Function Documentation

CSimple::DECLARE_REGISTRY | ( | CSimple | ,
 |  | _T("IISSample.C++ATLSimple.1") | ,
 |  | _T("IISSample.C++ATLSimple") | ,
 |  | IDS_SIMPLE_DESC | ,
 |  | THREADFLAGS_BOTH |
 | ) |  |
HRESULT CSimple::FinalCountruct ( ) [inline]

Definition at line 35 of file Simple.h.

  {
    return CoCreateFreeThreadedMarshaler(
      GetControllingUnknown(), &m_pUnkMarshaler.p );
  }

void CSimple::FinalRelease ( ) [inline]

Definition at line 40 of file Simple.h.

  {
    m_pUnkMarshaler.Release();
  }

STDMETHODIMP CSimple::get_myProperty ( BSTR * pbstrOutValue )

Definition at line 40 of file Simple.Cpp.

{
    if (pbstrOutValue == NULL)
        return E_POINTER;

    // Get Value from Property

    *pbstrOutValue = m_bstrMyProperty.Copy();

    return S_OK;
}

STDMETHODIMP CSimple::myMethod | ( | BSTR | bstrIn,
 |  | BSTR * | pbstrOut
 | ) |  |

Definition at line 54 of file Simple.Cpp.

{
    if (bstrIn == NULL || pbstrOut == NULL)
        return E_POINTER;

    // Create a temporary CComBSTR

    CComBSTR bstrTemp(bstrIn);

    if (!bstrTemp)
        return E_OUTOFMEMORY;

    // Make string uppercase

    wcsupr(bstrTemp);

    // Return m_str member of bstrTemp

    *pbstrOut = bstrTemp.Detach();

    return S_OK;
}

STDMETHODIMP CSimple::put_myProperty ( BSTR bstrInValue )

Definition at line 28 of file Simple.Cpp.

{
    if (bstrInValue == NULL)
        return E_POINTER;

    m_bstrMyProperty = bstrInValue;

    return S_OK;
}

Member Data Documentation

CComBSTR CSimple::m_bstrMyProperty [private]

Definition at line 50 of file Simple.h.

CComPtr<IUnknown> CSimple::m_pUnkMarshaler [private]

Definition at line 51 of file Simple.h.

The documentation for this class was generated from the following files:
  • Web/iis/Components/Cpp/Simple/Simple.h
  • Web/iis/Components/Cpp/Simple/Simple.Cpp
Generated on Wed Nov 13 2024 16:57:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSimpleApp Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CSimpleApp Class Reference

#include "app.h"

Inherits com::ms::com::IUnknown, CSafeRefCount, com::ms::com::IUnknown, and CSafeRefCount.

List of all members.

Public Member Functions

CSimpleApp ()
CSimpleApp ()
~CSimpleApp ()
~CSimpleApp ()
void | AddFrameLevelTools ()
void | AddFrameLevelUI ()
void | ContextSensitiveHelp (BOOL fEnterMode)
void | DestroyDocs ()
void | DestroyDocs ()
BOOL | fInitApplication (HANDLE hInstance)
BOOL | fInitApplication (HANDLE hInstance)
BOOL | fInitInstance (HANDLE hInstance, int nCmdShow)
BOOL | fInitInstance (HANDLE hInstance, int nCmdShow)
BOOL | HandleAccelerators (LPMSG lpMsg)
BOOL | HandleAccelerators (LPMSG lpMsg)
long | lCommandHandler (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
long | lCommandHandler (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
long | lCreateDoc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
long | lCreateDoc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
long | lSizeHandler (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
long | lSizeHandler (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
void | PaintApp (HDC hDC)
void | PaintApp (HDC hDC)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID FAR *ppvObj)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID FAR *ppvObj)
LRESULT | QueryNewPalette (void)
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()

Public Attributes

BOOL m_fAppActive
BOOL m_fCSHMode
BOOL m_fInitialized
BOOL m_fMenuMode
BOOL m_fOleStdInit
HWND | m_hAppWnd
HMENU | m_hCascadeMenu
HMENU | m_hEditMenu
HMENU | m_hFileMenu
HMENU | m_hHelpMenu
HINSTANCE | m_hInst
HMENU | m_hMainMenu
HPALETTE | m_hStdPal
HWND | m_hwndUIActiveObj
CSimpleDoc FAR * | m_lpDoc
int | m_nDragDelay
int | m_nDragMinDist
int | m_nScrollDelay
int | m_nScrollInset
int | m_nScrollInterval
COleInPlaceFrame | m_OleInPlaceFrame
RECT | nullRect

Detailed Description

Definition at line 18 of file app.h.

Constructor & Destructor Documentation

CSimpleApp::CSimpleApp ( )

Definition at line 136 of file app.Cpp.

                       : m_OleInPlaceFrame(this)
#pragma warning (default : 4355)  // Turn the warning back on
{
        OutputDebugString("In CSimpleApp's Constructor \r\n");

        // clear members
        m_hAppWnd = NULL;
        m_hInst = NULL;
        m_lpDoc = NULL;
    m_hwndUIActiveObj = NULL;

        // clear flags
        m_fInitialized = FALSE;
        m_fCSHMode = FALSE;
        m_fMenuMode = FALSE;

        // used for inplace
        SetRectEmpty(&nullRect);
}

CSimpleApp::~CSimpleApp ( )

Definition at line 182 of file app.Cpp.

{
        OutputDebugString("In CSimpleApp's Destructor\r\n");

        if (m_hStdPal)
                DeleteObject(m_hStdPal);

        // need to uninit the library...
        if (m_fInitialized)
                OleUninitialize();
}

CSimpleApp::CSimpleApp ( )
CSimpleApp::~CSimpleApp ( )

Member Function Documentation

void CSimpleApp::AddFrameLevelTools ( )

Definition at line 817 of file app.Cpp.

{
        CStabilize stabilize(this);
        m_OleInPlaceFrame.SetBorderSpace(&nullRect);
        InvalidateRect(m_hAppWnd, NULL, TRUE);
}

void CSimpleApp::AddFrameLevelUI ( )

Definition at line 782 of file app.Cpp.

{
        CStabilize stabilize(this);
        m_OleInPlaceFrame.SetMenu(NULL, NULL, NULL);
        AddFrameLevelTools();
}

void CSimpleApp::ContextSensitiveHelp ( BOOL fEnterMode )

Definition at line 953 of file app.Cpp.

{
        CStabilize stabilize(this);
        if (m_fCSHMode != fEnterMode)
                {
                m_fCSHMode = fEnterMode;

                // this code "trickles" the context sensitive help via shift+f1
                // to the inplace active object.  See the technotes for implementation
                // details.
                if (m_lpDoc->m_lpActiveObject)
                        {
                        LPOLEINPLACEOBJECT lpInPlaceObject;
                        m_lpDoc->m_lpActiveObject->QueryInterface(IID_IOleInPlaceObject, (LPVOID FAR *)&lpInPlaceObject);
                        lpInPlaceObject->ContextSensitiveHelp(fEnterMode);
                        lpInPlaceObject->Release();
                        }
                }
}

void CSimpleApp::DestroyDocs ( )

Definition at line 219 of file app.Cpp.

{
        CStabilize stabilize(this);
        m_lpDoc->Close();   // we have only 1 document
}

void CSimpleApp::DestroyDocs ( )
BOOL CSimpleApp::fInitApplication ( HANDLE hInstance )

Definition at line 405 of file app.Cpp.

{
        WNDCLASS  wc;

        // Fill in window class structure with parameters that describe the
        // main window.

        wc.style = NULL;                    // Class style(s).
        wc.lpfnWndProc = MainWndProc;       // Function to retrieve messages for
                                                                                // windows of this class.
        wc.cbClsExtra = 0;                  // No per-class extra data.
        wc.cbWndExtra = 0;                  // No per-window extra data.
        wc.hInstance = (HINSTANCE) hInstance; // Application that owns the class.
        wc.hIcon = LoadIcon((HINSTANCE) hInstance, "SimpCntr");
        wc.hCursor = LoadCursor(NULL, IDC_ARROW);
        wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
        wc.lpszMenuName =  "SIMPLEMENU";    // Name of menu resource in .RC file.
        wc.lpszClassName = "SimpCntrAppWClass";  // Name used in CreateWindow call

        if (!RegisterClass(&wc))
                return FALSE;

        wc.style = CS_DBLCLKS;              // Class style(s). allow DBLCLK's
        wc.lpfnWndProc = DocWndProc;        // Function to retrieve messages for
                                                                                // windows of this class.
        wc.cbClsExtra = 0;                  // No per-class extra data.
        wc.cbWndExtra = 0;                  // No per-window extra data.
        wc.hInstance = (HINSTANCE) hInstance;           // Application that owns the class.
        wc.hIcon = NULL;
        wc.hCursor = LoadCursor(NULL, IDC_ARROW);
        wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
        wc.lpszMenuName =  NULL;
        wc.lpszClassName = "SimpCntrDocWClass"; // Name used in CreateWindow call.

        // Register the window class and return success/failure code.

        return (RegisterClass(&wc));
}

BOOL CSimpleApp::fInitApplication ( HANDLE hInstance )
BOOL CSimpleApp::fInitInstance | ( | HANDLE | hInstance,
 |  | int | nCmdShow
 | ) |  |

Definition at line 480 of file app.Cpp.

{
        DWORD dwVer = OleBuildVersion();
        LPMALLOC lpMalloc = NULL;

        // check to see if we are compatible with this version of the libraries
        if (HIWORD(dwVer) != rmm || LOWORD(dwVer) < rup) {
#ifdef _DEBUG
                OutputDebugString("WARNING: Incompatible OLE library version\r\n");
#else
                return FALSE;
#endif
        }

        if (SUCCEEDED(OleInitialize(lpMalloc)))
        {
                m_fInitialized = TRUE;
        }
        else
        {
            // Replacing the standard allocator may not be legal.
            // Try again using the default allocator.
            if (SUCCEEDED(OleInitialize(NULL)))
            {
                m_fInitialized = TRUE;
            }
        }

        m_hInst = (HINSTANCE) hInstance;

        // Create the "application" windows
        m_hAppWnd = CreateWindow ("SimpCntrAppWClass",
                                                          "Simple OLE 2.0 In-Place Container",
                                                          WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
                                                          CW_USEDEFAULT,
                                                          CW_USEDEFAULT,
                                                          CW_USEDEFAULT,
                                                          CW_USEDEFAULT,
                                                          NULL,
                                                          NULL,
                                                          (HINSTANCE) hInstance,
                                                          NULL);

        if (!m_hAppWnd)
                return FALSE;

        m_hStdPal = CreateStandardPalette();

        ShowWindow (m_hAppWnd, nCmdShow);
        UpdateWindow (m_hAppWnd);

        return m_fInitialized;
}

BOOL CSimpleApp::fInitInstance | ( | HANDLE | hInstance,
 |  | int | nCmdShow
 | ) |  |
BOOL CSimpleApp::HandleAccelerators ( LPMSG lpMsg )

Definition at line 853 of file app.Cpp.

{
        CStabilize stabilize(this);
        HRESULT hResult;
        BOOL retval = FALSE;

        // if we have an InPlace Active Object
        if (m_lpDoc->m_lpActiveObject)
                {
                // Pass the accelerator on...
                hResult = m_lpDoc->m_lpActiveObject->TranslateAccelerator(lpMsg);
                if (hResult == NOERROR)
                        retval = TRUE;
                }

        return retval;
}

BOOL CSimpleApp::HandleAccelerators ( LPMSG lpMsg )
long CSimpleApp::lCommandHandler | ( | HWND | hWnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |
long CSimpleApp::lCommandHandler | ( | HWND | hWnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 576 of file app.Cpp.

{
        CStabilize stabilize(this);
        RECT rect;

        // context sensitive help...
        if (m_fMenuMode || m_fCSHMode)
                {
                if (m_fCSHMode)
                        {
                        // clear context sensitive help flag
                        m_fCSHMode = FALSE;

                        // if there is an InPlace active object, call its context sensitive help
                        // method with the FALSE parameter to bring the object out of the
                        // csh state.  See the technotes for details.
                        if (m_lpDoc->m_lpActiveObject)
                                {
                                LPOLEINPLACEOBJECT lpInPlaceObject;
                                m_lpDoc->m_lpActiveObject->QueryInterface(IID_IOleInPlaceObject, (LPVOID FAR *)&lpInPlaceObject);
                                lpInPlaceObject->ContextSensitiveHelp(FALSE);
                                lpInPlaceObject->Release();
                                }
                        }

                // see the technotes for details on implementing context sensitive
                // help
                if (m_fMenuMode)
                        {
                        m_fMenuMode = FALSE;

                        if (m_lpDoc->m_lpActiveObject)
                                m_lpDoc->m_lpActiveObject->ContextSensitiveHelp(FALSE);
                        }
                // if we provided help, we would do it here...
                MessageBox (hWnd, "Help", "Help", MB_OK);

                return NULL;
                }

        // see if the command is a verb selections
        //@@WTK WIN32, UNICODE
        //if (wParam >= IDM_VERB0)
        if (LOWORD(wParam) >= IDM_VERB0)
                {
                // get the rectangle of the object
                m_lpDoc->m_lpSite->GetObjRect(&rect);

                //@@WTK WIN32, UNICODE
                //m_lpDoc->m_lpSite->m_lpOleObject->DoVerb(wParam - IDM_VERB0, NULL, &m_lpDoc->m_lpSite->m_OleClientSite, -1, m_lpDoc->m_hDocWnd, &rect);
                m_lpDoc->m_lpSite->m_lpOleObject->DoVerb(LOWORD(wParam) - IDM_VERB0, NULL,
                                &m_lpDoc->m_lpSite->m_OleClientSite, -1, m_lpDoc->m_hDocWnd, &rect);
                }
        else
                {
                //@@WTK WIN32, UNICODE
                //switch (wParam) {
                switch (LOWORD(wParam)) {
                        // bring up the About box
                        case IDM_ABOUT:
                                {

                                DialogBox(m_hInst,               // current instance
                                        "AboutBox",                  // resource to use
                                        m_hAppWnd,                   // parent handle
                                        (DLGPROC) About);                // About() instance address

                                break;
                                }

                        // bring up the InsertObject Dialog
                        case IDM_INSERTOBJECT:
                                m_lpDoc->InsertObject();
                                break;

                        // exit the application
                        case IDM_EXIT:
                                SendMessage(hWnd, WM_SYSCOMMAND, SC_CLOSE, 0L);
                                break;

                        case IDM_NEW:
                                m_lpDoc->Close();
                                m_lpDoc = NULL;
                                lCreateDoc(hWnd, 0, 0, 0);
                                break;

                        default:
                                return (DefWindowProc(hWnd, message, wParam, lParam));
                        }   // end of switch
                }  // end of else
        return NULL;
}

long CSimpleApp::lCreateDoc | ( | HWND | hWnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 742 of file app.Cpp.

{
        CStabilize stabilize(this);
        RECT rect;

        GetClientRect(hWnd, &rect);

        m_lpDoc = CSimpleDoc::Create(this, &rect, hWnd);

        return NULL;
}

long CSimpleApp::lCreateDoc | ( | HWND | hWnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |
long CSimpleApp::lSizeHandler | ( | HWND | hWnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |
long CSimpleApp::lSizeHandler | ( | HWND | hWnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 701 of file app.Cpp.

{
        CStabilize stabilize(this);
        RECT rect;

        GetClientRect(m_hAppWnd, &rect);
        return m_lpDoc->lResizeDoc(&rect);
}

void CSimpleApp::PaintApp ( HDC hDC )

Definition at line 900 of file app.Cpp.

{
        CStabilize stabilize(this);
        // at this level, we could enumerate through all of the
        // visible objects in the application, so that a palette
        // that best fits all of the objects can be built.

        // This app is designed to take on the same palette
        // functionality that was provided in OLE 1.0, the palette
        // of the last object drawn is realized.  Since we only
        // support one object at a time, it shouldn't be a big
        // deal.

        // if we supported multiple documents, we would enumerate
        // through each of the open documents and call paint.

        if (m_lpDoc)
                m_lpDoc->PaintDoc(hDC);

}

void CSimpleApp::PaintApp ( HDC hDC )
STDMETHODIMP CSimpleApp::QueryInterface | ( | REFIID | riid,
 |  | LPVOID FAR * | ppvObj
 | ) |  |
STDMETHODIMP CSimpleApp::QueryInterface | ( | REFIID | riid,
 |  | LPVOID FAR * | ppvObj
 | ) |  |

Definition at line 266 of file app.Cpp.

{
        OutputDebugString("In CSimpleApp::QueryInterface\r\n");

        *ppvObj = NULL;     // must set out pointer parameters to NULL

        // looking for IUnknown
        if ( riid == IID_IUnknown)
                {
                AddRef();
                *ppvObj = this;
                return S_OK;
                }

        // looking for IOleWindow
        if ( riid == IID_IOleWindow)
                {
                m_OleInPlaceFrame.AddRef();
                *ppvObj=&m_OleInPlaceFrame;
                return S_OK;
                }

        // looking for IOleInPlaceUIWindow
        if ( riid == IID_IOleInPlaceUIWindow)
                {
                m_OleInPlaceFrame.AddRef();
                *ppvObj=&m_OleInPlaceFrame;
                return S_OK;
                }

        // looking for IOleInPlaceFrame
        if ( riid == IID_IOleInPlaceFrame)
                {
                m_OleInPlaceFrame.AddRef();
                *ppvObj=&m_OleInPlaceFrame;
                return S_OK;
                }

        // Not a supported interface
        return E_NOINTERFACE;
}

LRESULT CSimpleApp::QueryNewPalette ( void )

Definition at line 994 of file app.Cpp.

{
        if (m_hwndUIActiveObj) {
                if (SendMessage(m_hwndUIActiveObj, WM_QUERYNEWPALETTE,
                                (WPARAM)0, (LPARAM)0)) {
                        /* Object selected its palette as foreground palette */
                        return (LRESULT)1;
                }
        }

        return wSelectPalette(m_hAppWnd, m_hStdPal, FALSE/*fBackground*/);
}

CSimpleApp::STDMETHODIMP_ ( ULONG )
CSimpleApp::STDMETHODIMP_ ( ULONG )
CSimpleApp::STDMETHODIMP_ ( ULONG )
CSimpleApp::STDMETHODIMP_ ( ULONG )

Member Data Documentation

BOOL CSimpleApp::m_fAppActive

Definition at line 39 of file app.h.

BOOL CSimpleApp::m_fCSHMode

Definition at line 35 of file app.h.

BOOL CSimpleApp::m_fInitialized

Definition at line 34 of file app.h.

BOOL CSimpleApp::m_fMenuMode

Definition at line 36 of file app.h.

BOOL CSimpleApp::m_fOleStdInit

Definition at line 25 of file app.h.

HWND CSimpleApp::m_hAppWnd

Definition at line 22 of file app.h.

HMENU CSimpleApp::m_hCascadeMenu

Definition at line 28 of file app.h.

HMENU CSimpleApp::m_hEditMenu

Definition at line 26 of file app.h.

HMENU CSimpleApp::m_hFileMenu

Definition at line 25 of file app.h.

HMENU CSimpleApp::m_hHelpMenu

Definition at line 27 of file app.h.

HINSTANCE CSimpleApp::m_hInst

Definition at line 23 of file app.h.

HMENU CSimpleApp::m_hMainMenu

Definition at line 24 of file app.h.

HPALETTE CSimpleApp::m_hStdPal

Definition at line 38 of file app.h.

HWND CSimpleApp::m_hwndUIActiveObj

Definition at line 37 of file app.h.

CSimpleDoc FAR * CSimpleApp::m_lpDoc

Definition at line 33 of file app.h.

int CSimpleApp::m_nDragDelay

Definition at line 34 of file app.h.

int CSimpleApp::m_nDragMinDist

Definition at line 35 of file app.h.

int CSimpleApp::m_nScrollDelay

Definition at line 36 of file app.h.

int CSimpleApp::m_nScrollInset

Definition at line 37 of file app.h.

int CSimpleApp::m_nScrollInterval

Definition at line 38 of file app.h.

COleInPlaceFrame CSimpleApp::m_OleInPlaceFrame

Definition at line 31 of file app.h.

RECT CSimpleApp::nullRect

Definition at line 43 of file app.h.

The documentation for this class was generated from the following files:
  • Com/Fundamentals/SimpCntr/app.h
  • Com/Fundamentals/SimpDnd/app.h
  • Com/Fundamentals/SimpCntr/app.Cpp
  • Com/Fundamentals/SimpDnd/app.Cpp
Generated on Wed Nov 13 2024 16:57:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSimpleArray< T > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CSimpleArray< T > Class Template Reference

#include "simplearray.h"

List of all members.

Public Member Functions

CSimpleArray ()
~CSimpleArray ()
BOOL | Add (T &t)
int | Find (T &t) const
T * | GetData () const
int | GetSize () const
T & | operator[] (int nIndex) const
BOOL | Remove (T &t)
void | RemoveAll ()
BOOL | RemoveAt (int nIndex)
void | SetAtIndex (int nIndex, T &t)

Public Attributes

T * | m_aT
int | m_nAllocSize
int | m_nSize

Detailed Description

template<class T>
class CSimpleArray< T >

Definition at line 24 of file simplearray.h.

Constructor & Destructor Documentation

template<class T>
CSimpleArray< T >::CSimpleArray ( ) [inline]

Definition at line 32 of file simplearray.h.

                 : m_aT(NULL), m_nSize(0), m_nAllocSize(0)
  { }

template<class T>
CSimpleArray< T >::~CSimpleArray ( ) [inline]

Definition at line 35 of file simplearray.h.

  {
    RemoveAll();
  }

Member Function Documentation

template<class T>
BOOL CSimpleArray< T >::Add ( T & t ) [inline]

Definition at line 45 of file simplearray.h.

  {
    if(m_nSize == m_nAllocSize)
    {
      T* aT;
      int nNewAllocSize = (m_nAllocSize == 0) ? 1 : (m_nSize * 2);
      aT = (T*)realloc(m_aT, nNewAllocSize * sizeof(T));
      if(aT == NULL)
        return FALSE;
      m_nAllocSize = nNewAllocSize;
      m_aT = aT;
    }
    m_nSize++;
    SetAtIndex(m_nSize - 1, t);
    return TRUE;
  }

template<class T>
int CSimpleArray< T >::Find ( T & t ) const [inline]

Definition at line 101 of file simplearray.h.

  {
    for(int i = 0; i < m_nSize; i++)
    {
      if(m_aT[i] == t)
        return i;
    }
    return -1;  // not found
  }

template<class T>
T* CSimpleArray< T >::GetData ( ) const [inline]

Definition at line 90 of file simplearray.h.

  {
    return m_aT;
  }

template<class T>
int CSimpleArray< T >::GetSize ( ) const [inline]

Definition at line 41 of file simplearray.h.

  {
    return m_nSize;
  }

template<class T>
T& CSimpleArray< T >::operator[] ( int nIndex ) const [inline]

Definition at line 85 of file simplearray.h.

  {
    _ASSERT(nIndex >= 0 && nIndex < m_nSize);
    return m_aT[nIndex];
  }

template<class T>
BOOL CSimpleArray< T >::Remove ( T & t ) [inline]

Definition at line 61 of file simplearray.h.

  {
    int nIndex = Find(t);
    if(nIndex == -1)
      return FALSE;
    return RemoveAt(nIndex);
  }

template<class T>
void CSimpleArray< T >::RemoveAll ( ) [inline]

Definition at line 75 of file simplearray.h.

  {
    if(m_aT != NULL)
    {
      free(m_aT);
      m_aT = NULL;
    }
    m_nSize = 0;
    m_nAllocSize = 0;
  }

template<class T>
BOOL CSimpleArray< T >::RemoveAt ( int nIndex ) [inline]

Definition at line 68 of file simplearray.h.

  {
    if(nIndex != (m_nSize - 1))
      memmove((void*)&m_aT[nIndex], (void*)&m_aT[nIndex + 1], (m_nSize - (nIndex + 1)) * sizeof(T));
    m_nSize--;
    return TRUE;
  }

template<class T>
void CSimpleArray< T >::SetAtIndex | ( | int | nIndex,
 |  | T & | t |
 | ) |  |  | [inline]

Definition at line 96 of file simplearray.h.

  {
    _ASSERT(nIndex >= 0 && nIndex < m_nSize);
    m_aT[nIndex] = t;
  }

Member Data Documentation

template<class T>
T* CSimpleArray< T >::m_aT

Definition at line 27 of file simplearray.h.

template<class T>
int CSimpleArray< T >::m_nAllocSize

Definition at line 29 of file simplearray.h.

template<class T>
int CSimpleArray< T >::m_nSize

Definition at line 28 of file simplearray.h.

The documentation for this class was generated from the following file:
  • SysMgmt/MMC/WMI/simplearray.h
Generated on Wed Nov 13 2024 16:57:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSimpleClass Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CSimpleClass Class Reference

#include "component.hxx"

List of all members.

Public Member Functions

CSimpleClass ()
~CSimpleClass ()
STDMETHODIMP | InInOutPipesSample (IPipeLong *pInPipe1, IPipeLong *pInPipe2, IPipeLong **ppOutPipe)
STDMETHODIMP | InOutPipeSample (IPipeLong **ppInOutPipe)
STDMETHODIMP | InPipeSample (IPipeLong *pInPipe)
STDMETHODIMP | OutPipeSample (IPipeLong **pOutPipe)
STDMETHODIMP | QueryInterface (REFIID riid, void **ppv)
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP_ (ULONG) Release(void)

Private Attributes

ULONG m_cRef

Detailed Description

Definition at line 6 of file component.hxx.

Constructor & Destructor Documentation

CSimpleClass::CSimpleClass ( )

Definition at line 22 of file component.cxx.

   : m_cRef(1)
{
   CoAddRefServerProcess();
};

CSimpleClass::~CSimpleClass ( )

Definition at line 28 of file component.cxx.

{
   if (0==CoReleaseServerProcess())
       PostQuitMessage(0);
};

Member Function Documentation

STDMETHODIMP CSimpleClass::InInOutPipesSample | ( | IPipeLong * | pInPipe1,
 |  | IPipeLong * | pInPipe2,
 |  | IPipeLong ** | ppOutPipe
 | ) |  |

Definition at line 379 of file component.cxx.

{
   HRESULT hr=S_OK;
   ULONG lPulled=0;

   AllocConsole();
   HANDLE hConsoleOutput;
   hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE);
   const TCHAR* lpMessage = __TEXT("\n***** SERVER SIDE CONSOLE *****\n \n");
   WriteConsole(hConsoleOutput, lpMessage, _tcslen(lpMessage), 0, NULL);

   /*
   ** PROCESS THE SECOND [IN] PARAMETER FIRST
   ** DCE Model wouldn't allow to use second 'in' pipe without
   ** using the first 'in' pipe.
   */

   lpMessage = __TEXT("DEMONSTRATING HOW ORDER OF PROCESSING DCOM PIPES IS NOT IMPORTANT \n\n");
   WriteConsole(hConsoleOutput, lpMessage, _tcslen(lpMessage), 0, NULL);

   lpMessage = __TEXT("\tOPERATION: PULLing one sequence from the second InPipe  \n");
   WriteConsole(hConsoleOutput, lpMessage, _tcslen(lpMessage), 0, NULL);

   LONG *buffer1 = new LONG[2000 + 1];
   lPulled=0;
   hr=GenericPull(pInPipe2, buffer1, &lPulled, 0);
   if (FAILED(hr) || (2000 != lPulled))
   {
      MessageBox(NULL, TEXT("PULL FAILED ON SECOND INPIPE"), TEXT("SERVER: ERROR"), MB_SETFOREGROUND);
      return E_FAIL;
   }
   else
   {
      lpMessage = __TEXT("\tRESULT: success ! \n \n");
      WriteConsole(hConsoleOutput, lpMessage, _tcslen(lpMessage), 0, NULL);
   }

   /*
   ** PUSH 500 elements to the 'out' pipe.
   */

   lpMessage = __TEXT("\tOPERATION: PUSHing one sequence to the OutPipe  \n");
   WriteConsole(hConsoleOutput, lpMessage, _tcslen(lpMessage), 0, NULL);

   // Create an Out pipe on the server side
   *ppOutPipe=new CSamplePipe();
   (*ppOutPipe)->AddRef();

   LONG *buffer2 = new LONG[2000 + 1];

   hr=GenericPush(*ppOutPipe, buffer2, 500);
   if (FAILED(hr))
   {
      MessageBox(NULL, TEXT("PUSH FAILED ON OUTPIPE"), TEXT("SERVER: ERROR"), MB_SETFOREGROUND);
      return E_FAIL;
   }
   hr=GenericPush(*ppOutPipe, buffer2, 0);
   if (FAILED(hr))
   {
      MessageBox(NULL, TEXT("PUSH FAILED ON OUTPIPE"), TEXT("SERVER: ERROR"), MB_SETFOREGROUND);
      return E_FAIL;
   }
   else
   {
      lpMessage = __TEXT("\tRESULT: success !\n \n");
      WriteConsole(hConsoleOutput, lpMessage, _tcslen(lpMessage), 0, NULL);
   }

   /*
   ** Drain in (PULL) the first 'in' parameter.
   */

   lpMessage = __TEXT("\tOPERATION: PULLing one sequence from the first InPipe  \n");
   WriteConsole(hConsoleOutput, lpMessage, _tcslen(lpMessage), 0, NULL);

   lPulled=0;
   hr=GenericPull(pInPipe1, buffer1, &lPulled, 0);
   if (FAILED(hr) || (2000 != lPulled))
   {
      MessageBox(NULL, TEXT("PULL FAILED ON FIRST INPIPE"), TEXT("SERVER: ERROR"), MB_SETFOREGROUND);
      return E_FAIL;
   }
   else
   {
      lpMessage = __TEXT("\tRESULT: success ! \n \n");
      WriteConsole(hConsoleOutput, lpMessage, _tcslen(lpMessage), 0, NULL);
   }

   lpMessage = __TEXT("NOTE: Using DCOM Pipes, it possible to process the parameters in any order. \n \n");
   WriteConsole(hConsoleOutput, lpMessage, _tcslen(lpMessage), 0, NULL);

   lpMessage = __TEXT("Press any key to return to the client..\n\n");
   WriteConsole(hConsoleOutput, lpMessage, _tcslen(lpMessage), 0, NULL);
   _getch();
   FreeConsole();
   return S_OK;
}

STDMETHODIMP CSimpleClass::InOutPipeSample ( IPipeLong ** ppInOutPipe )

Definition at line 310 of file component.cxx.

{
   HRESULT hr=S_OK;
   ULONG lPulled=0;

   AllocConsole();
   HANDLE hConsoleOutput;
   hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE);
   const TCHAR* lpMessage = __TEXT("\n***** SERVER SIDE CONSOLE *****\n \n");
   WriteConsole(hConsoleOutput, lpMessage, _tcslen(lpMessage), 0, NULL);

   /*******************************************
   ** DEMONSTRATING USE OF INOUTPIPE
   *******************************************/

   lpMessage = __TEXT("DEMONSTRATING USE OF [IN,OUT] PIPE \n\n");
   WriteConsole(hConsoleOutput, lpMessage, _tcslen(lpMessage), 0, NULL);

   /*
   ** PULL one sequence from the InPipe
   */

   lpMessage = __TEXT("\tOPERATION: PULLing one sequence from the InOutPipe  \n");
   WriteConsole(hConsoleOutput, lpMessage, _tcslen(lpMessage), 0, NULL);

   LONG *buffer1 = new LONG[2000 + 1];

   hr=GenericPull(*ppInOutPipe, buffer1, &lPulled, 0);
   if (FAILED(hr) || (2000 != lPulled))
   {
      MessageBox(NULL, TEXT("PULL FAILED ON INOUTPIPE"), TEXT("SERVER: ERROR"), MB_SETFOREGROUND);
      return E_FAIL;
   }
   else
   {
      lpMessage = __TEXT("\tRESULT: success ! \n \n");
      WriteConsole(hConsoleOutput, lpMessage, _tcslen(lpMessage), 0, NULL);
   }

   (*ppInOutPipe)->Release();

   // Create a pipe on the server side

   lpMessage = __TEXT("\tOPERATION: Creating a pipe on the server  \n");
   WriteConsole(hConsoleOutput, lpMessage, _tcslen(lpMessage), 0, NULL);
   *ppInOutPipe = new CSamplePipe();
   if (NULL == *ppInOutPipe)
   {
      MessageBox(NULL, TEXT("UNABLE TO CREATE PIPE"), TEXT("SERVER: ERROR"), MB_SETFOREGROUND);
      return E_OUTOFMEMORY;
   }
   else
   {
      lpMessage = __TEXT("\tRESULT: success ! \n \n");
      WriteConsole(hConsoleOutput, lpMessage, _tcslen(lpMessage), 0, NULL);
   }
   (*ppInOutPipe)->AddRef();

    lpMessage = __TEXT("Press any key to return to the client..");
   WriteConsole(hConsoleOutput, lpMessage, _tcslen(lpMessage), 0, NULL);
   _getch();
   FreeConsole();
   return S_OK;
};

STDMETHODIMP CSimpleClass::InPipeSample ( IPipeLong * pInPipe )

Definition at line 77 of file component.cxx.

{
   HRESULT hr=S_OK;
   LONG* buffer1=NULL;
   LONG* buffer2=NULL;
   ULONG lPulled=0;

   AllocConsole();
   HANDLE hConsoleOutput;
   hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE);
   const TCHAR* lpMessage = __TEXT("\n***** SERVER SIDE CONSOLE *****\n \n");
   WriteConsole(hConsoleOutput, lpMessage, _tcslen(lpMessage), 0, NULL);

   /*******************************************
   ** DEMONSTRATING MULTIPLE SEQUENCES OF PULLS
   *******************************************/

   lpMessage = __TEXT("DEMONSTRATING MULTIPLE SEQUENCES OF PULLS \n\n");
   WriteConsole(hConsoleOutput, lpMessage, _tcslen(lpMessage), 0, NULL);

   /*
   ** PULL one sequence from the InPipe
   */

   lpMessage = __TEXT("\tOPERATION: PULLing one sequence from the InPipe  \n");
   WriteConsole(hConsoleOutput, lpMessage, _tcslen(lpMessage), 0, NULL);

   buffer1 = new LONG[2000 + 1];
   lPulled=0;
   hr=GenericPull(pInPipe, buffer1, &lPulled, 0);
   if (FAILED(hr) || (2000 != lPulled))
   {
      MessageBox(NULL, TEXT("PULL FAILED ON INPIPE"), TEXT("SERVER: ERROR"), MB_SETFOREGROUND);
      return E_FAIL;
   }
   else
   {
      lpMessage = __TEXT("\tRESULT: success ! \n \n");
      WriteConsole(hConsoleOutput, lpMessage, _tcslen(lpMessage), 0, NULL);
   }

   /*
   ** PULL another sequence from the InPipe
   */

   lpMessage = __TEXT("\tOPERATION: PULLing second sequence from the InPipe  \n");
   WriteConsole(hConsoleOutput, lpMessage, _tcslen(lpMessage), 0, NULL);

   lPulled=0;
   hr=GenericPull(pInPipe, buffer1, &lPulled, 0);
   if (FAILED(hr) || (2000 != lPulled))
   {
      MessageBox(NULL, TEXT("PULL FAILED ON INPIPE"), TEXT("SERVER: ERROR"), MB_SETFOREGROUND);
      return E_FAIL;
   }
   else
   {
      lpMessage = __TEXT("\tRESULT: success ! \n \n");
      WriteConsole(hConsoleOutput, lpMessage, _tcslen(lpMessage), 0, NULL);
   }

   lpMessage = __TEXT("NOTE: Multiple sequences of PULLs are allowed using DCOM Pipes, each separated by a zero count PULL. \n \n");
   WriteConsole(hConsoleOutput, lpMessage, _tcslen(lpMessage), 0, NULL);

   lpMessage = __TEXT("Press any key to continue..\n\n");
   WriteConsole(hConsoleOutput, lpMessage, _tcslen(lpMessage), 0, NULL);
   _getch();

   /********************************************
   ** DEMONSTRATING MULTIPLE SEQUENCES OF PUSHES
   ********************************************/

   lpMessage = __TEXT("DEMONSTRATING MULTIPLE SEQUENCES OF PUSHES \n\n");
   WriteConsole(hConsoleOutput, lpMessage, _tcslen(lpMessage), 0, NULL);
   /*
   ** PUSH 500 elements to the pipe.
   */

   lpMessage = __TEXT("\tOPERATION: PUSHing 500 elements to the InPipe  \n");
   WriteConsole(hConsoleOutput, lpMessage, _tcslen(lpMessage), 0, NULL);
   buffer2 = new LONG[2000 + 1];

   hr=GenericPush(pInPipe, buffer2, 500);
   if (FAILED(hr))
   {
      MessageBox(NULL, TEXT("PUSH FAILED ON INPIPE"), TEXT("SERVER: ERROR"), MB_SETFOREGROUND);
      return E_FAIL;
   }
   else
   {
      lpMessage = __TEXT("\tRESULT: success !\n \n");
      WriteConsole(hConsoleOutput, lpMessage, _tcslen(lpMessage), 0, NULL);
   }

   /*
   ** Push 0 count to close this sequence
   */
   hr=GenericPush(pInPipe, buffer2, 0);
   if (FAILED(hr)) { return E_FAIL; }

   /*
   ** PUSH another 500 elements to the pipe.
   */
   lpMessage = __TEXT("\tOPERATION: PUSHing another sequence of 500 elements to the InPipe  \n");
   WriteConsole(hConsoleOutput, lpMessage, _tcslen(lpMessage), 0, NULL);

   hr=GenericPush(pInPipe, buffer2, 500);
   if (FAILED(hr))
   {
      MessageBox(NULL, TEXT("PUSH FAILED ON INPIPE"), TEXT("SERVER: ERROR"), MB_SETFOREGROUND);
      return E_FAIL;
   }
   else
   {
      lpMessage = __TEXT("\tRESULT: success !\n \n");
      WriteConsole(hConsoleOutput, lpMessage, _tcslen(lpMessage), 0, NULL);
   }

   /*
   ** Push 0 count to close this second sequence
   */

   hr=GenericPush(pInPipe, buffer2, 0);
   if (FAILED(hr)) { return E_FAIL; }

   lpMessage = __TEXT("NOTE: Multiple sequences of PUSHes are allowed using DCOM Pipes, each separated by a zero count PUSH. \n \n");
   WriteConsole(hConsoleOutput, lpMessage, _tcslen(lpMessage), 0, NULL);

   lpMessage = __TEXT("Press any key to continue..\n \n");
   WriteConsole(hConsoleOutput, lpMessage, _tcslen(lpMessage), 0, NULL);
   _getch();

   /*******************************************
   ** DEMONSTRATING MIX OF PULL AND PUSH
   *******************************************/

   lpMessage = __TEXT("DEMONSTRATING MIXING OF PULL AND PUSH \n\n");
   WriteConsole(hConsoleOutput, lpMessage, _tcslen(lpMessage), 0, NULL);
   /*
   ** Pull 1000 elements from the InPipe.
   */

   lpMessage = __TEXT("\tOPERATION: PULLing 1000 elements from the InPipe  \n");
   WriteConsole(hConsoleOutput, lpMessage, _tcslen(lpMessage), 0, NULL);

   lPulled=0;
   hr=GenericPull(pInPipe, buffer1, &lPulled, 1000);
   if (FAILED(hr))
   {
      MessageBox(NULL, TEXT("PULL FAILED ON INPIPE"), TEXT("SERVER: ERROR"), MB_SETFOREGROUND);
      return E_FAIL;
   }
   else
   {
      lpMessage = __TEXT("\tRESULT: success ! \n \n");
      WriteConsole(hConsoleOutput, lpMessage, _tcslen(lpMessage), 0, NULL);
   }

   /*
   ** PUSH 500 elements to the pipe. Notice how Pull and Push
   ** operations can be mixed on the same pipe.
   */

   lpMessage = __TEXT("\tOPERATION: PUSHing 500 elements to the InPipe  \n");
   WriteConsole(hConsoleOutput, lpMessage, _tcslen(lpMessage), 0, NULL);

   hr=GenericPush(pInPipe, buffer2, 500);
   if (FAILED(hr))
   {
      MessageBox(NULL, TEXT("PUSH FAILED ON INPIPE"), TEXT("SERVER: ERROR"), MB_SETFOREGROUND);
      return E_FAIL;
   }
   else
   {
      lpMessage = __TEXT("\tRESULT: success !\n \n");
      WriteConsole(hConsoleOutput, lpMessage, _tcslen(lpMessage), 0, NULL);
   }

   /*
   ** Push 0 count to close this sequence
   */
   hr=GenericPush(pInPipe, buffer2, 0);
   if (FAILED(hr)) { return E_FAIL; }

   /*
   ** Drain in the rest of the InPipe.
   */
   lpMessage = __TEXT("\tOPERATION: PULLing all the remaining elements from the InPipe  \n");
   WriteConsole(hConsoleOutput, lpMessage, _tcslen(lpMessage), 0, NULL);

   hr=GenericPull(pInPipe, buffer1, &lPulled, 2000);
   if (FAILED(hr))
   {
      MessageBox(NULL, TEXT("PULL FAILED ON INPIPE"), TEXT("SERVER: ERROR"), MB_SETFOREGROUND);
      return E_FAIL;
   }
   else
   {
      lpMessage = __TEXT("\tRESULT: success ! \n \n");
      WriteConsole(hConsoleOutput, lpMessage, _tcslen(lpMessage), 0, NULL);
   }

   lpMessage = __TEXT("NOTE: PULLs and PUSHes can be mixed on the same DCOM Pipe. \n \n");
   WriteConsole(hConsoleOutput, lpMessage, _tcslen(lpMessage), 0, NULL);

   lpMessage = __TEXT("Press any key to terminate the server console.. \n\n");
   WriteConsole(hConsoleOutput, lpMessage, _tcslen(lpMessage), 0, NULL);
   _getch();
   FreeConsole();
   return S_OK;
};

STDMETHODIMP CSimpleClass::OutPipeSample ( IPipeLong ** pOutPipe )

Definition at line 296 of file component.cxx.

{
   // Create a pipe on the server side
   *ppOutPipe=new CSamplePipe();
   if (NULL == *ppOutPipe)
   return E_OUTOFMEMORY;
   (*ppOutPipe)->AddRef();
   return S_OK;
};

STDMETHODIMP CSimpleClass::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppv
 | ) |  |

Definition at line 36 of file component.cxx.

{
   *ppv = NULL;

   if (IsEqualIID(IID_IUnknown, riid)) {
      *ppv = static_cast<ISimpleInterface*>(this);
   }
   else if (IsEqualIID(IID_ISimpleInterface, riid)) {
         *ppv = static_cast<ISimpleInterface*>(this);
   }
   else
   {
      return E_NOINTERFACE;
   }

   reinterpret_cast<IUnknown*>(*ppv)->AddRef();
   return S_OK;

};

CSimpleClass::STDMETHODIMP_ ( ULONG )
CSimpleClass::STDMETHODIMP_ ( ULONG )

Member Data Documentation

ULONG CSimpleClass::m_cRef [private]

Definition at line 10 of file component.hxx.

The documentation for this class was generated from the following files:
  • Com/Fundamentals/Pipes/LocalServer/component.hxx
  • Com/Fundamentals/Pipes/LocalServer/component.cxx
Generated on Wed Nov 13 2024 16:57:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSimpleDialog Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes

CSimpleDialog Class Reference

#include "cdialog.h"

List of all members.

Public Member Functions

CSimpleDialog (HINSTANCE hInstance, ULONG ulDialogId)
~CSimpleDialog ()
HRESULT | AddStatusMessage (LPCWSTR wszFormat,...)
HWND | GetHwnd ()
HRESULT | Show (INT iShowState)

Private Member Functions

HRESULT | CollectUserInput (IN OUT WCHAR *wszBuffVirtualDir, IN DWORD cchBuffVirtualDir, IN OUT WCHAR *wszBuffSampleText, IN DWORD cchBuffSampleText, OUT BOOL *fRequireUploadReply)
LRESULT | OnCancel (HWND hDlg, WPARAM wParam, LPARAM lParam)
LRESULT | OnClose (HWND hDlg, WPARAM wParam, LPARAM lParam)
LRESULT | OnDestroy (HWND hDlg, WPARAM wParam, LPARAM lParam)
LRESULT | OnInitDialog (HWND hDlg, WPARAM wParam, LPARAM lParam)
LRESULT | OnNcDestroy (HWND hDlg, WPARAM wParam, LPARAM lParam)
LRESULT | OnOK (HWND hDlg, WPARAM wParam, LPARAM lParam)
BOOL | ProcessMessage (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)

Static Private Member Functions

static INT_PTR CALLBACK | DlgProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)

Private Attributes

DLGPROC | m_DlgProc
HINSTANCE | m_hInstance
HWND | m_hWnd
ULONG m_ulDialogId

Detailed Description

Definition at line 26 of file cdialog.h.

Constructor & Destructor Documentation

CSimpleDialog::CSimpleDialog | ( | HINSTANCE | hInstance,
 |  | ULONG | ulDialogId
 | ) |  |

Definition at line 48 of file cdialog.cpp.

{
    m_hInstance   = hInstance;
    m_ulDialogId  = ulDialogId;
    m_hWnd        = NULL;           // Handle returned by CreateDialogParam
    m_DlgProc     = DlgProc;        // Point to default dialog proc
}

CSimpleDialog::~CSimpleDialog ( )

Definition at line 57 of file cdialog.cpp.

{
}

Member Function Documentation

HRESULT CSimpleDialog::AddStatusMessage | ( | LPCWSTR | wszFormat,
 |  |  | ...
 | ) |  |

Definition at line 98 of file cdialog.cpp.

{
    HRESULT    hr                          = S_OK;
    HWND       hJobStatus;
    WCHAR      *pwszExistingText           = NULL;
    DWORD      cchExistingText             = 0;
    WCHAR      *pwszBuf                    = NULL;
    DWORD      cchBuf                      = 0;
    SYSTEMTIME Time;
    WCHAR      wszTimeBuf[20]              = {0};
    WCHAR      wszNewText[MAX_BUFFER_SIZE] = {0};

    if (!wszFormat)
    {
        return S_OK;
    }

    //
    // Build a string with the text passed as a parameter
    //
    va_list arglist;
    va_start(arglist, wszFormat);

    hr = StringCchVPrintfW(wszNewText, MAX_BUFFER_SIZE, wszFormat, arglist);
    if (FAILED(hr))
    {
        goto cleanup;
    }

    //
    // Retrieve the text that is currently displayed in the Edit box
    //

    hJobStatus      = GetDlgItem(m_hWnd, IDC_JOBSTATUS);
    cchExistingText = GetWindowTextLength(hJobStatus) + 1;

    if (cchExistingText)
    {
        pwszExistingText = new WCHAR[cchExistingText];
        if (!pwszExistingText)
        {
            hr = E_OUTOFMEMORY;
            goto cleanup;
        }

        GetWindowText(hJobStatus, pwszExistingText, cchExistingText);
    }

    //
    // Get a string for the current time
    //

    GetLocalTime(&Time);
    hr = StringCchPrintfW(wszTimeBuf, ARRAYSIZE(wszTimeBuf), L"[%.2u:%.2u %.2u.%.3us] ", Time.wHour, Time.wMinute, Time.wSecond, Time.wMilliseconds);
    if (FAILED(hr))
    {
        goto cleanup;
    }

    //
    // Allocate a buffer for the new contents of the edit box
    //
    cchBuf  = cchExistingText + static_cast<DWORD>(wcslen(wszTimeBuf)) + static_cast<DWORD>(wcslen(wszNewText)) + 2 + 1;  // 2 for the break line
    pwszBuf = new WCHAR[cchBuf];
    if (!pwszBuf)
    {
        hr = E_OUTOFMEMORY;
        goto cleanup;
    }
    pwszBuf[0] = L'\0';

    //
    // Build the new string
    //
    hr = StringCchPrintfW(pwszBuf, cchBuf, L"%s%s%s\r\n", (pwszExistingText? pwszExistingText : L""), wszTimeBuf, wszNewText);
    if (FAILED(hr))
    {
        goto cleanup;
    }

    //
    // Update the control with the new string
    //
    if (!SetWindowText(hJobStatus, pwszBuf))
    {
        hr = HRESULT_FROM_WIN32(GetLastError());
        goto cleanup;
    }

    //
    // Automatically scroll down the edit box
    //
    SendMessage(hJobStatus, EM_SETSEL, (WPARAM)0, (LPARAM)-1);
  SendMessage(hJobStatus, EM_SCROLLCARET, 0, 0);

cleanup:

    va_end(arglist);

    if (pwszExistingText)
    {
        delete [] pwszExistingText;
        pwszExistingText = NULL;
    }

    if (pwszBuf)
    {
        delete [] pwszBuf;
        pwszBuf = NULL;
    }

    return hr;
}

HRESULT CSimpleDialog::CollectUserInput | ( | IN OUT WCHAR * | wszBuffVirtualDir,
 |  | IN DWORD | cchBuffVirtualDir,
 |  | IN OUT WCHAR * | wszBuffSampleText,
 |  | IN DWORD | cchBuffSampleText,
 |  | OUT BOOL * | fRequireUploadReply |
 | ) |  |  | [private]

Definition at line 477 of file cdialog.cpp.

{
    HRESULT hr                      = S_OK;
    HWND    hSampleText             = NULL;
    HWND    hVirtualDir             = NULL;
    HWND    hUploadReply            = NULL;
    INT     iEnd                    = 0;
    LRESULT idx                     = CB_ERR;
    LRESULT len                     = 0;

    if (!wszBuffVirtualDir || !wszBuffSampleText || !fRequireUploadReply)
    {
        hr = HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER);
        goto cleanup;
    }

    *fRequireUploadReply = FALSE;

    hVirtualDir = GetDlgItem(m_hWnd, IDC_VIRTUALDIR);

     // get the index of the selection on the combobox
    idx = SendMessage(hVirtualDir, CB_GETCURSEL, (LPARAM)0, 0);
    if (idx == CB_ERR)
    {
        // the user probably edited something and used the combobox as an edit box
        len = SendMessage(hVirtualDir, WM_GETTEXTLENGTH, 0, 0);

        if ((len == CB_ERR) || ((static_cast<DWORD>(len)+1) >= cchBuffVirtualDir))   // cchBuff includes the \0
        {
            hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
            goto cleanup;
        }

        SendMessage(
          hVirtualDir,                // handle to destination window
          WM_GETTEXT,                 // message to send
          (LPARAM)len,                // number of characters to copy
          (WPARAM)wszBuffVirtualDir   // text buffer
        );
    }
    else
    {
        len = SendMessage(
          hVirtualDir,                 // handle to destination window
          CB_GETLBTEXTLEN,             // message to send
          (WPARAM)idx,                 // item index
          (LPARAM)0                    // not used; must be zero
        );

        if ((len == CB_ERR) || ((static_cast<DWORD>(len)+1) >= cchBuffVirtualDir)) // len + 1 includes the \0
        {
            hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
            goto cleanup;
        }

        // get the string of the current selection
        SendMessage(hVirtualDir, CB_GETLBTEXT, (LPARAM)idx, (WPARAM)wszBuffVirtualDir);
    }

    // if virtual directory doesn't end with a /, add it
    iEnd = static_cast<INT>(wcslen(wszBuffVirtualDir));
    if (iEnd > 0 && wszBuffVirtualDir[iEnd-1] != L'/')
    {
        hr = StringCchCat(wszBuffVirtualDir, cchBuffVirtualDir, L"/");
        if (FAILED(hr))
        {
            // we should never get here;
            goto cleanup;
        }
    }

    hSampleText = GetDlgItem(m_hWnd, IDC_SAMPLETEXT);
    GetWindowText(hSampleText, wszBuffSampleText, cchBuffSampleText);

    hUploadReply = GetDlgItem(m_hWnd, IDC_UPLOADREPLY_CHECKBOX);
    if (SendMessage(hUploadReply, BM_GETCHECK, 0, 0) == BST_CHECKED)
    {
        *fRequireUploadReply = TRUE;
    }

cleanup:

    return hr;
}

INT_PTR CALLBACK CSimpleDialog::DlgProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static, private]

Definition at line 400 of file cdialog.cpp.

{
    BOOL bReturn = FALSE;
    if (WM_INITDIALOG == uMsg)
    {
        SetWindowLongPtr(hDlg, GWLP_USERDATA, lParam);
    }

    CSimpleDialog* pThis = reinterpret_cast<CSimpleDialog *>(GetWindowLongPtr(hDlg, GWLP_USERDATA));
    if (pThis != NULL)
    {
        bReturn = pThis->ProcessMessage(hDlg, uMsg, wParam, lParam);
    }

    return bReturn;
}

HWND CSimpleDialog::GetHwnd ( )

Definition at line 92 of file cdialog.cpp.

{
    return m_hWnd;
}

LRESULT CSimpleDialog::OnCancel | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private]

Definition at line 328 of file cdialog.cpp.

{
    return DestroyWindow(m_hWnd);
}

LRESULT CSimpleDialog::OnClose | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private]

Definition at line 334 of file cdialog.cpp.

{
    HRESULT hr = S_OK;
    CSmartComPtr<IEnumBackgroundCopyJobs> JobsEnum;
    CSmartComPtr<IBackgroundCopyJob>      Job;
    WCHAR *pwszJobName = NULL;

    //
    // As we are leaving the application, cancel jobs that are still
    // in progress. This will only apply to Jobs submitted by this
    // user AND with our predefined description string
    //
    hr = g_JobManager->EnumJobs(0, JobsEnum.GrabOutPtr());
    if (FAILED(hr))
    {
        DisplayErrorMessage(L"Failed to create a BITS job enumerator. Error id is 0x%X.", hr);
        goto done;
    }

    while((JobsEnum->Next(1, Job.GrabOutPtr(), NULL) == S_OK))
    {
        hr = Job->GetDisplayName(&pwszJobName);
        if (SUCCEEDED(hr))
        {
            if (wcscmp(pwszJobName, STR_JOBNAME_DEFAULT) == 0)
            {
                // Found a job that was created by this app -- remove the
                // notification callback and then cancel it
                hr = Job->SetNotifyInterface(NULL);
                if (FAILED(hr))
                {
                    DisplayErrorMessage(L"Failed to remove the notification callback for a job while cleaning up jobs created by this application.", hr);
                }

                hr = Job->Cancel();
                if (FAILED(hr))
                {
                    DisplayErrorMessage(L"Failed to cancel a job while cleaning up jobs created by this application.", hr);
                }
            }

            CoTaskMemFree(pwszJobName);
            pwszJobName = NULL;
        }
    }

done:

    return DestroyWindow(m_hWnd);
}

LRESULT CSimpleDialog::OnDestroy | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private]

Definition at line 308 of file cdialog.cpp.

{
    PostQuitMessage(0);
    return 1;
}

LRESULT CSimpleDialog::OnInitDialog | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private]

Definition at line 218 of file cdialog.cpp.

{
    HWND    hVirtualDir   = NULL;
    HWND    hSampleText   = NULL;
    HWND    hUploadReply  = NULL;

    // Set combobox contents
  SendDlgItemMessage(hDlg, IDC_VIRTUALDIR, CB_ADDSTRING, 0, (LPARAM)STR_VIRTUALDIR_PLAIN);
  SendDlgItemMessage(hDlg, IDC_VIRTUALDIR, CB_ADDSTRING, 0, (LPARAM)STR_VIRTUALDIR_NOTIFICATIONS);
    SendDlgItemMessage(hDlg, IDC_VIRTUALDIR, CB_LIMITTEXT, (WPARAM)(INTERNET_MAX_URL_LENGTH-1), (LPARAM)0);
    SendDlgItemMessage(hDlg, IDC_VIRTUALDIR, CB_SETCURSEL, (WPARAM)0, (LPARAM)0);

    //hVirtualDir = GetDlgItem(hDlg, IDC_VIRTUALDIR);
    //SetWindowText(hVirtualDir, STR_VIRTUALDIR_DEFAULT);

    hSampleText = GetDlgItem(hDlg, IDC_SAMPLETEXT);
    SetWindowText(hSampleText, STR_SAMPLETEXT_DEFAULT);

    hUploadReply = GetDlgItem(hDlg, IDC_UPLOADREPLY_CHECKBOX);
    SendMessage(hUploadReply, BM_SETCHECK, BST_UNCHECKED, 0 );

    SetFocus(hSampleText);

    return 1;
}

LRESULT CSimpleDialog::OnNcDestroy | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private]

Definition at line 319 of file cdialog.cpp.

{
    m_hWnd = NULL;             // Since this is a modeless-only dialog

    return 1;
}

LRESULT CSimpleDialog::OnOK | ( | HWND | hDlg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private]

Definition at line 246 of file cdialog.cpp.

{
    HRESULT hr = S_OK;
    WCHAR   wszBuffSampleText[MAX_BUFFER_SIZE]         = {0};
    WCHAR   wszBuffVirtualDir[INTERNET_MAX_URL_LENGTH] = {0};
    BOOL    fRequireUploadReply = FALSE;
    LRESULT lRet = 1;
    CPack   XMLPack;

    //
    // Grab input values from the UI
    //
    hr = CollectUserInput(
        wszBuffVirtualDir,
        ARRAYSIZE(wszBuffVirtualDir),
        wszBuffSampleText,
        ARRAYSIZE(wszBuffSampleText),
        &fRequireUploadReply
    );
    if (FAILED(hr))
    {

        DisplayErrorMessage(L"Failed to collect input values from the UI.", hr);
        lRet = 0;
        goto done;
    }

    //
    //  Pack the text as an XML file and UPLOAD it to the server!!
    //
    AddStatusMessage(L"START OF PROCESS TO UPLOAD FILE");

    hr = XMLPack.PackText(wszBuffSampleText);
    if (FAILED(hr))
    {
        lRet = 0;
        goto done;
    }

    hr = XMLPack.Upload(STR_JOBNAME_DEFAULT, wszBuffVirtualDir, fRequireUploadReply);
    if (FAILED(hr))
    {
        lRet = 0;
        goto done;
    }

done:

    if (!lRet)
    {
        AddStatusMessage(L"END OF UPLOAD PROCESS -- FAILED");
    }

    return lRet;
}

BOOL CSimpleDialog::ProcessMessage | ( | HWND | hDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private]

Definition at line 426 of file cdialog.cpp.

{
    LRESULT lResult = 0;
    switch (uMsg)
    {
        case WM_INITDIALOG:
            lResult = OnInitDialog(hDlg, wParam, lParam);
            break;

        case WM_DESTROY:
            lResult = OnDestroy(hDlg, wParam, lParam);
            break;

        case WM_NCDESTROY:
            lResult = OnNcDestroy(hDlg, wParam, lParam);
            break;

        case WM_CLOSE:
            lResult = OnClose(hDlg, wParam, lParam);
            break;

        case WM_COMMAND:
            switch (wParam)
            {
                case IDOK:
                    lResult = OnOK(hDlg, wParam, lParam);
                    break;

                case IDCANCEL:
                    lResult = OnCancel(hDlg, wParam, lParam);
                    break;

                default:
                    break;
            }
        default:
            break;
    }

    return(BOOL)lResult;
}

HRESULT CSimpleDialog::Show ( INT iShowState )

Definition at line 66 of file cdialog.cpp.

{
    HRESULT hr = S_OK;

    m_hWnd = CreateDialogParam(
        m_hInstance,
        MAKEINTRESOURCE(m_ulDialogId),
        NULL,                           // hWndParent
        m_DlgProc,
        (LPARAM)this
        );

    if (!m_hWnd)
    {
        hr = HRESULT_FROM_WIN32(GetLastError());
    }
    else
    {
        // the return just says if the window was previously visible or not
        BOOL bReturn = ShowWindow(m_hWnd, iShowState);
    }

    return hr;
}

Member Data Documentation

DLGPROC CSimpleDialog::m_DlgProc [private]

Definition at line 31 of file cdialog.h.

HINSTANCE CSimpleDialog::m_hInstance [private]

Definition at line 28 of file cdialog.h.

HWND CSimpleDialog::m_hWnd [private]

Definition at line 29 of file cdialog.h.

ULONG CSimpleDialog::m_ulDialogId [private]

Definition at line 30 of file cdialog.h.

The documentation for this class was generated from the following files:
  • Web/bits/Upload/cdialog.h
  • Web/bits/Upload/cdialog.cpp
Generated on Wed Nov 13 2024 16:57:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSimpleDoc Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Public Attributes

CSimpleDoc Class Reference

#include "doc.h"

Inherits com::ms::com::IUnknown, CSafeRefCount, com::ms::com::IUnknown, and CSafeRefCount.

List of all members.

Public Member Functions

CSimpleDoc ()
CSimpleDoc (CSimpleApp FAR *lpApp, HWND hWnd)
CSimpleDoc ()
CSimpleDoc (CSimpleApp FAR *lpApp, HWND hWnd)
~CSimpleDoc ()
~CSimpleDoc ()
void | Close (void)
void | Close (void)
void | CopyObjectToClip (void)
void | DisableInsertObject (void)
void | DisableInsertObject (void)
DWORD | DoDragDrop (void)
void | InsertObject (void)
void | InsertObject (void)
long | lAddVerbs (void)
long | lAddVerbs (void)
long | lResizeDoc (LPRECT lpRect)
long | lResizeDoc (LPRECT lpRect)
void | PaintDoc (HDC hDC)
void | PaintDoc (HDC hDC)
BOOL | QueryDrag (POINT pt)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID FAR *ppvObj)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID FAR *ppvObj)
void | Scroll (DWORD dwScrollDir)
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()

Static Public Member Functions

static CSimpleDoc FAR * | Create (CSimpleApp FAR *lpApp, LPRECT lpRect, HWND hWnd)
static CSimpleDoc FAR * | Create (CSimpleApp FAR *lpApp, LPRECT lpRect, HWND hWnd)

Public Attributes

CDropSource m_DropSource
CDropTarget m_DropTarget
BOOL m_fAddMyUI
BOOL m_fCanDropCopy
BOOL m_fCanDropLink
BOOL m_fDragLeave
BOOL m_fInPlaceActive
BOOL m_fLocalDrag
BOOL m_fLocalDrop
BOOL m_fModifiedMenu
BOOL m_fPendingDrag
BOOL m_fRegDragDrop
HWND | m_hDocWnd
LPOLEINPLACEACTIVEOBJECT | m_lpActiveObject
CSimpleApp FAR * | m_lpApp
CSimpleSite FAR * | m_lpSite
LPSTORAGE | m_lpStorage
POINT | m_ptButDown

Detailed Description

Definition at line 17 of file doc.h.

Constructor & Destructor Documentation

CSimpleDoc::CSimpleDoc ( )
CSimpleDoc::CSimpleDoc | ( | CSimpleApp FAR * | lpApp,
 |  | HWND | hWnd
 | ) |  |

Definition at line 180 of file doc.Cpp.

{
        OutputDebugString("In CSimpleDoc's Constructor\r\n");
        m_lpApp = lpApp;
        m_lpSite = NULL;
        // set up menu handles
        m_lpApp->m_hMainMenu = GetMenu(hWnd);
        m_lpApp->m_hFileMenu = GetSubMenu(m_lpApp->m_hMainMenu, 0);
        m_lpApp->m_hEditMenu = GetSubMenu(m_lpApp->m_hMainMenu, 1);
        m_lpApp->m_hHelpMenu = GetSubMenu(m_lpApp->m_hMainMenu, 2);
        m_lpApp->m_hCascadeMenu = NULL;

        m_lpActiveObject = NULL;

        // flags
        m_fInPlaceActive = FALSE;
        m_fAddMyUI = FALSE;
        m_fModifiedMenu = FALSE;
}

CSimpleDoc::~CSimpleDoc ( )

Definition at line 227 of file doc.Cpp.

{
        OutputDebugString("In CSimpleDoc's Destructor\r\n");

        // Release all pointers we hold to the OLE object. also release
        // the ref count added in CSimpleSite::Create. this will make
        // the Site's ref count go to 0, and the Site will be deleted.
        if (m_lpSite) {
                m_lpSite->UnloadOleObject();
                m_lpSite->Release();
                m_lpSite = NULL;
        }

        // Release the Storage
        if (m_lpStorage) {
                m_lpStorage->Release();
                m_lpStorage = NULL;
        }

        // if the edit menu was modified, remove the menu item and
        // destroy the popup if it exists
        if (m_fModifiedMenu)
                {
                int nCount = GetMenuItemCount(m_lpApp->m_hEditMenu);
                RemoveMenu(m_lpApp->m_hEditMenu, nCount-1, MF_BYPOSITION);
                if (m_lpApp->m_hCascadeMenu)
                        DestroyMenu(m_lpApp->m_hCascadeMenu);
                }

        DestroyWindow(m_hDocWnd);
}

CSimpleDoc::CSimpleDoc ( )
CSimpleDoc::CSimpleDoc | ( | CSimpleApp FAR * | lpApp,
 |  | HWND | hWnd
 | ) |  |
CSimpleDoc::~CSimpleDoc ( )

Member Function Documentation

void CSimpleDoc::Close ( void )

Definition at line 136 of file doc.Cpp.

{
        OutputDebugString("In CSimpleDoc::Close\r\n");

        ShowWindow(m_hDocWnd, SW_HIDE);  // Hide the window

        // Close the OLE object in our document
        if (m_lpSite)
                m_lpSite->CloseOleObject();

        // Release the ref count added in CSimpleDoc::Create. this will make
        // the document's ref count go to 0, and the document will be deleted.
        Release();
}

void CSimpleDoc::Close ( void )
void CSimpleDoc::CopyObjectToClip ( void )

Definition at line 704 of file doc.Cpp.

{
        LPDATAOBJECT lpDataObj;

        // Create a data transfer object by cloning the existing OLE object
        CDataXferObj FAR* pDataXferObj = CDataXferObj::Create(m_lpSite,NULL);
        if (! pDataXferObj) {
                MessageBox(NULL,"Out-of-memory","SimpDnD",MB_SYSTEMMODAL|MB_ICONHAND);
                return;
        }
        // initially obj is created with 0 refcnt. this QI will make it go to 1.
        pDataXferObj->QueryInterface(IID_IDataObject, (LPVOID FAR*)&lpDataObj);

        // put out data transfer object on the clipboard. this API will AddRef.
        OleSetClipboard(lpDataObj);

        // Give ownership of data transfer object to clipboard
        pDataXferObj->Release();
}

CSimpleDoc FAR * CSimpleDoc::Create | ( | CSimpleApp FAR * | lpApp,
 |  | LPRECT | lpRect,
 |  | HWND | hWnd |
 | ) |  |  | [static]

Definition at line 57 of file doc.Cpp.

{
        CSimpleDoc FAR * lpTemp = new CSimpleDoc(lpApp, hWnd);

        if (!lpTemp)
                return NULL;

        // create storage for the doc.
        HRESULT hErr = StgCreateDocfile (NULL, STGM_READWRITE | STGM_TRANSACTED | STGM_SHARE_EXCLUSIVE,
                                                                         0, &lpTemp->m_lpStorage);

        if (hErr != NOERROR)
                goto error;

        // create the document Window
        lpTemp->m_hDocWnd = CreateWindow(
                        "SimpCntrDocWClass",
                        NULL,
                        WS_CHILD | WS_CLIPCHILDREN,
                        lpRect->left,
                        lpRect->top,
                        lpRect->right,
                        lpRect->bottom,
                        hWnd,
                        NULL,
                        lpApp->m_hInst,
                        NULL);

        if (!lpTemp->m_hDocWnd)
                goto error;

        ShowWindow(lpTemp->m_hDocWnd, SW_SHOWNORMAL);  // Show the window
        UpdateWindow(lpTemp->m_hDocWnd);               // Sends WM_PAINT message

        // Ensable InsertObject menu choice
        EnableMenuItem( lpApp->m_hEditMenu, 0, MF_BYPOSITION | MF_ENABLED);

        // we will add one ref count on our document. later in CSimpleDoc::Close
        // we will release this  ref count. when the document's ref count goes
        // to 0, the document will be deleted.
        lpTemp->AddRef();

        return (lpTemp);

error:
        delete (lpTemp);
        return NULL;

}

static CSimpleDoc FAR* CSimpleDoc::Create | ( | CSimpleApp FAR * | lpApp,
 |  | LPRECT | lpRect,
 |  | HWND | hWnd |
 | ) |  |  | [static]
void CSimpleDoc::DisableInsertObject ( void )
void CSimpleDoc::DisableInsertObject ( void )

Definition at line 612 of file doc.Cpp.

{
        // Disable InsertObject menu choice
        EnableMenuItem( m_lpApp->m_hEditMenu, 0, MF_BYPOSITION | MF_DISABLED | MF_GRAYED);
}

DWORD CSimpleDoc::DoDragDrop ( void )

Definition at line 96 of file ids.Cpp.

{
  DWORD       dwEffect     = 0;
  LPDATAOBJECT lpDataObj;

  OutputDebugString("In CSimpleDoc::DoDragDrop\r\n");

  // Create a data transfer object by cloning the existing OLE object
  CDataXferObj FAR* pDataXferObj = CDataXferObj::Create(m_lpSite,NULL);

  if (! pDataXferObj) {
    MessageBox(NULL,"Out-of-memory","SimpDnD",MB_SYSTEMMODAL|MB_ICONHAND);
    return DROPEFFECT_NONE;
  }

  // initially obj is created with 0 refcnt. this QI will make it go to 1.
  pDataXferObj->QueryInterface(IID_IDataObject, (LPVOID FAR*)&lpDataObj);
  assert(lpDataObj);

  m_fLocalDrop     = FALSE;
  m_fLocalDrag     = TRUE;

    ::DoDragDrop ( lpDataObj,
         &m_DropSource,
         DROPEFFECT_COPY,   // we only allow copy
         &dwEffect
  );

  m_fLocalDrag     = FALSE;

  /* if after the Drag/Drop modal (mouse capture) loop is finished
  **    and a drag MOVE operation was performed, then we must delete
  **    the selection that was dragged.
  */
  if ( (dwEffect & DROPEFFECT_MOVE) != 0 ) {
    // ... delete source object here (we do NOT support MOVE)
  }

  pDataXferObj->Release();    // this should destroy the DataXferObj
  return dwEffect;
}

void CSimpleDoc::InsertObject ( void )
void CSimpleDoc::InsertObject ( void )

Definition at line 400 of file doc.Cpp.

{
        CStabilize stabilize(this);
        OLEUIINSERTOBJECT io;
        UINT iret;
  //@@WTK WIN32, UNICODE
        //char szFile[MAX_PATH];
        TCHAR szFile[MAX_PATH];

        m_lpSite = CSimpleSite::Create(this);

        // clear the structure
        memset(&io, 0, sizeof(OLEUIINSERTOBJECT));

        // fill the structure
        io.cbStruct = sizeof(OLEUIINSERTOBJECT);
        io.dwFlags = IOF_SELECTCREATENEW |
                                        IOF_DISABLELINK | IOF_DISABLEDISPLAYASICON |
                                        IOF_CREATENEWOBJECT | IOF_CREATEFILEOBJECT;
        io.hWndOwner = m_hDocWnd;
  //@@WTK WIN32, UNICODE
        //io.lpszCaption = (LPSTR)"Insert Object";
        io.lpszCaption = _T("Insert Object");
        io.iid = IID_IOleObject;
        io.oleRender = OLERENDER_DRAW;
        io.lpIOleClientSite = &m_lpSite->m_OleClientSite;
        io.lpIStorage = m_lpSite->m_lpObjStorage;
        io.ppvObj = (LPVOID FAR *)&m_lpSite->m_lpOleObject;
        io.lpszFile = szFile;
  //@@WTK WIN32, UNICODE
        //io.cchFile = sizeof(szFile);
        io.cchFile = sizeof(szFile) / sizeof *szFile;
  //@@WTK WIN32, UNICODE
        //_fmemset((LPSTR)szFile, 0, sizeof(szFile));
        memset(szFile, 0, sizeof(szFile));

        // call OUTLUI to do all the hard work
        iret = OleUIInsertObject(&io);

        if (iret == OLEUI_OK)
                {
                m_lpSite->InitObject((BOOL)(io.dwFlags & IOF_SELECTCREATENEW));
                // disable Insert Object menu item
                DisableInsertObject();
                }
        else
                {
                m_lpSite->Release();
                m_lpSite = NULL;
                m_lpStorage->Revert();
                }

}

long CSimpleDoc::lAddVerbs ( void )

Definition at line 520 of file doc.Cpp.

{
        CStabilize stabilize(this);
        // m_fModifiedMenu is TRUE if the menu has already been modified
        // once.  Since we only support one obect every time the application
        // is run, then once the menu is modified, it doesn't have
        // to be done again.
        if (m_lpSite && !m_fInPlaceActive  && !m_fModifiedMenu)
                {
                int nCount = GetMenuItemCount(m_lpApp->m_hEditMenu);

                OleUIAddVerbMenu ( m_lpSite->m_lpOleObject,
                                                   NULL,
                                                   m_lpApp->m_hEditMenu,
                                                   nCount + 1,
                                                   IDM_VERB0,
                                                   0,           // no maximum verb IDM enforced
                                                   FALSE,
                                                   0,
                                                   &m_lpApp->m_hCascadeMenu);

                m_fModifiedMenu = TRUE;
                }
        return (NULL);
}

long CSimpleDoc::lAddVerbs ( void )
long CSimpleDoc::lResizeDoc ( LPRECT lpRect )
long CSimpleDoc::lResizeDoc ( LPRECT lpRect )

Definition at line 481 of file doc.Cpp.

{
        CStabilize stabilize(this);
        // if we are InPlace, then call ResizeBorder on the object, otherwise
        // just move the document window.
        if (m_fInPlaceActive)
                m_lpActiveObject->ResizeBorder(lpRect, &m_lpApp->m_OleInPlaceFrame, TRUE);
        else
                MoveWindow(m_hDocWnd, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom, TRUE);

        return NULL;
}

void CSimpleDoc::PaintDoc ( HDC hDC )
void CSimpleDoc::PaintDoc ( HDC hDC )

Definition at line 571 of file doc.Cpp.

{
        CStabilize stabilize(this);
        // if we supported multiple objects, then we would enumerate
        // the objects and call paint on each of them from here.

        if (m_lpSite)
                m_lpSite->PaintObj(hDC);

}

BOOL CSimpleDoc::QueryDrag ( POINT pt )

Definition at line 47 of file ids.Cpp.

{
  // if pt is within rect of object, then start drag
  if (m_lpSite)
    {
    RECT rect;
    m_lpSite->GetObjRect(&rect);
    return ( PtInRect(&rect, pt) ? TRUE : FALSE );
    }
  else
    return FALSE;
}

STDMETHODIMP CSimpleDoc::QueryInterface | ( | REFIID | riid,
 |  | LPVOID FAR * | ppvObj
 | ) |  |
STDMETHODIMP CSimpleDoc::QueryInterface | ( | REFIID | riid,
 |  | LPVOID FAR * | ppvObj
 | ) |  |

Definition at line 292 of file doc.Cpp.

{
        OutputDebugString("In CSimpleDoc::QueryInterface\r\n");

        *ppvObj = NULL;     // must set out pointer parameters to NULL

        // Not a supported interface
        return E_NOINTERFACE;
}

void CSimpleDoc::Scroll ( DWORD dwScrollDir ) [inline]

Definition at line 67 of file doc.h.

{ /*...scroll Doc here...*/ }

CSimpleDoc::STDMETHODIMP_ ( ULONG )
CSimpleDoc::STDMETHODIMP_ ( ULONG )
CSimpleDoc::STDMETHODIMP_ ( ULONG )
CSimpleDoc::STDMETHODIMP_ ( ULONG )

Member Data Documentation

CDropSource CSimpleDoc::m_DropSource

Definition at line 41 of file doc.h.

CDropTarget CSimpleDoc::m_DropTarget

Definition at line 40 of file doc.h.

BOOL CSimpleDoc::m_fAddMyUI

Definition at line 23 of file doc.h.

BOOL CSimpleDoc::m_fCanDropCopy

Definition at line 29 of file doc.h.

BOOL CSimpleDoc::m_fCanDropLink

Definition at line 30 of file doc.h.

BOOL CSimpleDoc::m_fDragLeave

Definition at line 31 of file doc.h.

BOOL CSimpleDoc::m_fInPlaceActive

Definition at line 22 of file doc.h.

BOOL CSimpleDoc::m_fLocalDrag

Definition at line 27 of file doc.h.

BOOL CSimpleDoc::m_fLocalDrop

Definition at line 28 of file doc.h.

BOOL CSimpleDoc::m_fModifiedMenu

Definition at line 24 of file doc.h.

BOOL CSimpleDoc::m_fPendingDrag

Definition at line 32 of file doc.h.

BOOL CSimpleDoc::m_fRegDragDrop

Definition at line 26 of file doc.h.

HWND CSimpleDoc::m_hDocWnd

Definition at line 29 of file doc.h.

LPOLEINPLACEACTIVEOBJECT CSimpleDoc::m_lpActiveObject

Definition at line 21 of file doc.h.

CSimpleApp FAR * CSimpleDoc::m_lpApp

Definition at line 27 of file doc.h.

CSimpleSite FAR * CSimpleDoc::m_lpSite

Definition at line 26 of file doc.h.

LPSTORAGE CSimpleDoc::m_lpStorage

Definition at line 20 of file doc.h.

POINT CSimpleDoc::m_ptButDown

Definition at line 33 of file doc.h.

The documentation for this class was generated from the following files:
  • Com/Fundamentals/SimpCntr/doc.h
  • Com/Fundamentals/SimpDnd/doc.h
  • Com/Fundamentals/SimpCntr/doc.Cpp
  • Com/Fundamentals/SimpDnd/doc.Cpp
  • Com/Fundamentals/SimpDnd/ids.Cpp
Generated on Wed Nov 13 2024 16:57:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSimpleObject Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CSimpleObject Class Reference

List of all members.

Public Member Functions

CSimpleObject ()
CSimpleObject ()
CSimpleObject ()
CSimpleObject ()
~CSimpleObject ()
~CSimpleObject ()
~CSimpleObject ()
~CSimpleObject ()
STDMETHODIMP | Clone (IStream **ppstm)
STDMETHODIMP | Commit (DWORD grfCommitFlags)
STDMETHODIMP | CopyTo (IStream *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten)
STDMETHODIMP | GetClassID (CLSID *pClsID)
STDMETHODIMP | GetClassID (CLSID *pClsID)
STDMETHODIMP | GetClassID (CLSID *pClsID)
STDMETHODIMP | LockRegion (ULARGE_INTEGER bOffset, ULARGE_INTEGER cb, DWORD dwLockType)
STDMETHODIMP | QueryInterface (REFIID iid, void **ppv)
STDMETHODIMP | QueryInterface (REFIID iid, void **ppv)
STDMETHODIMP | QueryInterface (REFIID iid, void **ppv)
STDMETHODIMP | QueryInterface (REFIID iid, void **ppv)
STDMETHODIMP | Read (void *pv, ULONG cb, ULONG *pcbRead)
STDMETHODIMP | Revert (void)
STDMETHODIMP | Seek (LARGE_INTEGER dbMove, DWORD dwOrigin, ULARGE_INTEGER *pbNewPosition)
STDMETHODIMP | SetSize (ULARGE_INTEGER cbNewSize)
STDMETHODIMP | Stat (STATSTG *pstatstg, DWORD grfStatFlag)
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP | UnlockRegion (ULARGE_INTEGER bOffset, ULARGE_INTEGER cb, DWORD dwLockType)
STDMETHODIMP | WasteTime (TCHAR *szMessage)
STDMETHODIMP | WasteTime (TCHAR *szMessage)
STDMETHODIMP | WasteTime (TCHAR *szMessage)
STDMETHODIMP | Write (VOID const *pv, ULONG cb, ULONG *pcbWritten)

Private Attributes

HANDLE hConsole
LONG | m_cRef
COORD | xy

Detailed Description

Definition at line 64 of file SServer.Cpp.

Constructor & Destructor Documentation

CSimpleObject::CSimpleObject ( ) [inline]

Definition at line 81 of file SServer.Cpp.

                        {
    m_cRef = 1;
    xy.X = 0;
    xy.Y = (short)g_ConsoleData.y;
    InterlockedIncrement(&g_Count);
    hConsole = CreateFile(TEXT("CONOUT$"), GENERIC_READ|GENERIC_WRITE,
      FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
    if (INVALID_HANDLE_VALUE == hConsole)
      hConsole = 0;
  }

CSimpleObject::~CSimpleObject ( ) [inline]

Definition at line 91 of file SServer.Cpp.

{ InterlockedDecrement(&g_Count); if (hConsole) CloseHandle(hConsole);}

CSimpleObject::CSimpleObject ( ) [inline]

Definition at line 88 of file SServer.Cpp.

                        {
    m_cRef = 1; xy.X = 0; xy.Y = (short)g_ConsoleData.y;
    hConsole = CreateFile(TEXT("CONOUT$"), GENERIC_READ|GENERIC_WRITE,
      FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
    if (INVALID_HANDLE_VALUE == hConsole)
      hConsole = 0;
    CoAddRefServerProcess();
  }

CSimpleObject::~CSimpleObject ( ) [inline]

Definition at line 96 of file SServer.Cpp.

                        { if (hConsole) CloseHandle(hConsole);
      if (!CoReleaseServerProcess())
      {
        SetEvent(g_hEventDone);
      }
  }

CSimpleObject::CSimpleObject ( ) [inline]

Definition at line 86 of file SServer.Cpp.

                        {
    m_cRef = 1; xy.X = 0; xy.Y = (short)g_ConsoleData.y;
    hConsole = CreateFile(TEXT("CONOUT$"), GENERIC_READ|GENERIC_WRITE,
      FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
    if (INVALID_HANDLE_VALUE == hConsole)
      hConsole = 0;
    CoAddRefServerProcess();
  }

CSimpleObject::~CSimpleObject ( ) [inline]

Definition at line 94 of file SServer.Cpp.

                        { if (hConsole) CloseHandle(hConsole);
      if (!CoReleaseServerProcess())
      {
        PostThreadMessage(GetCurrentThreadId(), WM_QUIT, 0, 0);
      }
  }

CSimpleObject::CSimpleObject ( ) [inline]

Definition at line 117 of file sserver.cpp.

{ m_cRef = 1; }

CSimpleObject::~CSimpleObject ( ) [inline]

Definition at line 118 of file sserver.cpp.

{ SetEvent(hevtDone); }

Member Function Documentation

STDMETHODIMP CSimpleObject::Clone ( IStream ** ppstm ) [inline]

Definition at line 113 of file sserver.cpp.

        { return E_FAIL; }

STDMETHODIMP CSimpleObject::Commit ( DWORD grfCommitFlags ) [inline]

Definition at line 103 of file sserver.cpp.

        { return E_FAIL; }

STDMETHODIMP CSimpleObject::CopyTo | ( | IStream * | pstm,
 |  | ULARGE_INTEGER | cb,
 |  | ULARGE_INTEGER * | pcbRead,
 |  | ULARGE_INTEGER * | pcbWritten |
 | ) |  |  | [inline]

Definition at line 101 of file sserver.cpp.

        { return E_FAIL; }

STDMETHODIMP CSimpleObject::GetClassID ( CLSID * pClsID )

Definition at line 226 of file SServer.Cpp.

{
  UNREFERENCED_PARAMETER(pClsID);
  MessageBeep(0);
  xy.X = 0;
  return WasteTime(TEXT("In Call                               "));
}

STDMETHODIMP CSimpleObject::GetClassID ( CLSID * pClsID )
STDMETHODIMP CSimpleObject::GetClassID ( CLSID * pClsID )
STDMETHODIMP CSimpleObject::LockRegion | ( | ULARGE_INTEGER | bOffset,
 |  | ULARGE_INTEGER | cb,
 |  | DWORD | dwLockType |
 | ) |  |  | [inline]

Definition at line 107 of file sserver.cpp.

        { return E_FAIL; }

STDMETHODIMP CSimpleObject::QueryInterface | ( | REFIID | iid,
 |  | void ** | ppv
 | ) |  |

Definition at line 170 of file SServer.Cpp.

{
    if (ppv == NULL)
        return E_INVALIDARG;
    *ppv = NULL;
    if (riid == IID_IUnknown || riid == IID_IPersist)
    {
        *ppv =  this;
        ((IUnknown*)*ppv)->AddRef();
        return S_OK;
  }

    return E_NOINTERFACE;
}  // CSimpleObject::QueryInterface

STDMETHODIMP CSimpleObject::QueryInterface | ( | REFIID | iid,
 |  | void ** | ppv
 | ) |  |
STDMETHODIMP CSimpleObject::QueryInterface | ( | REFIID | iid,
 |  | void ** | ppv
 | ) |  |
STDMETHODIMP CSimpleObject::QueryInterface | ( | REFIID | iid,
 |  | void ** | ppv
 | ) |  |
STDMETHODIMP CSimpleObject::Read | ( | void * | pv,
 |  | ULONG | cb,
 |  | ULONG * | pcbRead
 | ) |  |

Definition at line 184 of file sserver.cpp.

{
    Message(TEXT("Server: IStream:Read"), S_OK);
    if (!pv && cb != 0)
        return E_INVALIDARG;

    // fill the buffer with FF's. we could read it from somewhere.
    if (cb != 0)
        memset(pv, 0xFF, cb);

    if (pcbRead)
        *pcbRead = cb;
    return S_OK;
}  // CSimpleObject::Read

STDMETHODIMP CSimpleObject::Revert ( void ) [inline]

Definition at line 105 of file sserver.cpp.

        { return E_FAIL; }

STDMETHODIMP CSimpleObject::Seek | ( | LARGE_INTEGER | dbMove,
 |  | DWORD | dwOrigin,
 |  | ULARGE_INTEGER * | pbNewPosition |
 | ) |  |  | [inline]

Definition at line 97 of file sserver.cpp.

        { return E_FAIL; }

STDMETHODIMP CSimpleObject::SetSize ( ULARGE_INTEGER cbNewSize ) [inline]

Definition at line 99 of file sserver.cpp.

        { return E_FAIL; }

STDMETHODIMP CSimpleObject::Stat | ( | STATSTG * | pstatstg,
 |  | DWORD | grfStatFlag |
 | ) |  |  | [inline]

Definition at line 111 of file sserver.cpp.

        { return E_FAIL; }

CSimpleObject::STDMETHODIMP_ ( ULONG ) [inline]

Definition at line 75 of file SServer.Cpp.

                                       {
    if (InterlockedDecrement(&m_cRef) == 0)
    { delete this; return 0;}
    else
      return m_cRef;
  }

CSimpleObject::STDMETHODIMP_ ( ULONG ) [inline]

Definition at line 77 of file SServer.Cpp.

                                       {
    if (InterlockedDecrement(&m_cRef) == 0)
    { delete this; return 0;}
    else
      return m_cRef;
  }

CSimpleObject::STDMETHODIMP_ ( ULONG ) [inline]

Definition at line 92 of file sserver.cpp.

{ if (InterlockedDecrement(&m_cRef) == 0) { delete this; return 0; } return 1; }

CSimpleObject::STDMETHODIMP_ ( ULONG ) [inline]

Definition at line 91 of file sserver.cpp.

{ return InterlockedIncrement(&m_cRef); };

CSimpleObject::STDMETHODIMP_ ( ULONG ) [inline]

Definition at line 69 of file SServer.Cpp.

{InterlockedIncrement(&m_cRef);return m_cRef;}

CSimpleObject::STDMETHODIMP_ ( ULONG ) [inline]

Definition at line 70 of file SServer.Cpp.

                                       {
    if (InterlockedDecrement(&m_cRef) == 0)
    { delete this; return 0;}
    else
      return m_cRef;
  }

CSimpleObject::STDMETHODIMP_ ( ULONG ) [inline]

Definition at line 76 of file SServer.Cpp.

{InterlockedIncrement(&m_cRef);return m_cRef;}

CSimpleObject::STDMETHODIMP_ ( ULONG ) [inline]

Definition at line 74 of file SServer.Cpp.

{InterlockedIncrement(&m_cRef);return m_cRef;}

STDMETHODIMP CSimpleObject::UnlockRegion | ( | ULARGE_INTEGER | bOffset,
 |  | ULARGE_INTEGER | cb,
 |  | DWORD | dwLockType |
 | ) |  |  | [inline]

Definition at line 109 of file sserver.cpp.

        { return E_FAIL; }

STDMETHODIMP CSimpleObject::WasteTime ( TCHAR * szMessage )

Definition at line 212 of file SServer.Cpp.

{
  if (hConsole)
  {
    SetConsoleCursorPosition(hConsole, xy);
    WriteConsole(hConsole, szMessage, lstrlen(szMessage), NULL, NULL);
    xy.X += 50;
    return Busy(hConsole, xy, 5000);
  }
  return S_OK;
}

STDMETHODIMP CSimpleObject::WasteTime ( TCHAR * szMessage )
STDMETHODIMP CSimpleObject::WasteTime ( TCHAR * szMessage )
STDMETHODIMP CSimpleObject::Write | ( | VOID const * | pv,
 |  | ULONG | cb,
 |  | ULONG * | pcbWritten
 | ) |  |

Definition at line 203 of file sserver.cpp.

{
    Message(TEXT("Server: IStream:Write"), S_OK);
    if (!pv && cb != 0)
        return E_INVALIDARG;
    // ignore the data, but we could examine it or put it somewhere
    if (pcbWritten)
        *pcbWritten = cb;
    return S_OK;
}  // CSimpleObject::Write

Member Data Documentation

HANDLE CSimpleObject::hConsole [private]

Definition at line 97 of file SServer.Cpp.

LONG CSimpleObject::m_cRef [private]

Definition at line 95 of file SServer.Cpp.

COORD CSimpleObject::xy [private]

Definition at line 96 of file SServer.Cpp.

The documentation for this class was generated from the following files:
  • Com/Fundamentals/DCom/Cancel/InProc/SServer.Cpp
  • Com/Fundamentals/DCom/Cancel/Local/Mta/SServer.Cpp
  • Com/Fundamentals/DCom/Cancel/Local/Sta/SServer.Cpp
  • Com/Fundamentals/DCom/Simple/sserver/sserver.cpp
Generated on Wed Nov 13 2024 16:57:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSimpleSite Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Public Attributes

CSimpleSite Class Reference

#include "site.h"

Inherits com::ms::com::IUnknown, com::ms::com::IUnknown, and CSafeRefCount.

List of all members.

Public Member Functions

CSimpleSite (CSimpleDoc FAR *lpDoc)
CSimpleSite (CSimpleDoc FAR *lpDoc)
~CSimpleSite ()
~CSimpleSite ()
void | CloseOleObject (void)
void | CloseOleObject (void)
void | GetObjRect (LPRECT lpRect)
void | GetObjRect (LPRECT lpRect)
void | InitObject (BOOL fCreateNew)
void | InitObject (BOOL fCreateNew)
void | PaintObj (HDC hDC)
void | PaintObj (HDC hDC)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID FAR *ppvObj)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID FAR *ppvObj)
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
void | UnloadOleObject (void)
void | UnloadOleObject (void)

Static Public Member Functions

static CSimpleSite FAR * | Create (CSimpleDoc FAR *lpDoc)
static CSimpleSite FAR * | Create (CSimpleDoc FAR *lpDoc)

Public Attributes

CAdviseSink | m_AdviseSink
DWORD m_dwConnection
DWORD m_dwDrawAspect
BOOL m_fInPlaceActive
BOOL m_fObjectOpen
HWND | m_hwndIPObj
CSimpleDoc FAR * | m_lpDoc
LPOLEINPLACEOBJECT | m_lpInPlaceObject
LPSTORAGE | m_lpObjStorage
LPOLEOBJECT | m_lpOleObject
int | m_nCount
COleClientSite | m_OleClientSite
COleInPlaceSite | m_OleInPlaceSite
SIZEL | m_sizel

Detailed Description

Definition at line 19 of file site.h.

Constructor & Destructor Documentation

CSimpleSite::CSimpleSite ( CSimpleDoc FAR * lpDoc )

Definition at line 193 of file site.Cpp.

                                               : m_OleClientSite(this),
                                                                                m_AdviseSink(this),
                                                                                m_OleInPlaceSite(this)
#pragma warning (default : 4355)  // Turn the warning back on
{
        // remember the pointer to the doc
        m_lpDoc = lpDoc;

        // clear the reference count

        m_dwDrawAspect = DVASPECT_CONTENT;
        m_lpOleObject = NULL;
        m_lpInPlaceObject = NULL;
        m_hwndIPObj = NULL;
        m_fInPlaceActive = FALSE;
        m_fObjectOpen = FALSE;

}

CSimpleSite::~CSimpleSite ( )

Definition at line 239 of file site.Cpp.

{
        OutputDebugString ("In CSimpleSite's Destructor \r\n");

        if (m_lpOleObject)
           m_lpOleObject->Release();

        if (m_lpObjStorage)
           m_lpObjStorage->Release();
}

CSimpleSite::CSimpleSite ( CSimpleDoc FAR * lpDoc )
CSimpleSite::~CSimpleSite ( )

Member Function Documentation

void CSimpleSite::CloseOleObject ( void )

Definition at line 281 of file site.Cpp.

{
        CStabilize stabilize(this);
        LPOLEINPLACEOBJECT lpObject;
        LPVIEWOBJECT lpViewObject = NULL;

        OutputDebugString ("In CSimpleSite::CloseOleObject \r\n");

        if (m_lpOleObject)
           {
           if (m_fInPlaceActive)
                   {
                   m_lpOleObject->QueryInterface(IID_IOleInPlaceObject, (LPVOID FAR *)&lpObject);
                   lpObject->UIDeactivate();
                   // don't need to worry about inside-out because the object
                   // is going away.
                   lpObject->InPlaceDeactivate();
                   lpObject->Release();
                   }

           m_lpOleObject->Close(OLECLOSE_NOSAVE);
           }
}

void CSimpleSite::CloseOleObject ( void )
CSimpleSite FAR * CSimpleSite::Create ( CSimpleDoc FAR * lpDoc ) [static]

Definition at line 132 of file site.Cpp.

{
        CSimpleSite FAR * lpTemp = new CSimpleSite(lpDoc);

        if (!lpTemp)
                return NULL;

        // create a sub-storage for the object
  //@@WTK WIN32, UNICODE
        //HRESULT hErr = lpDoc->m_lpStorage->CreateStorage( "Object",
        HRESULT hErr = lpDoc->m_lpStorage->CreateStorage( OLESTR("Object"),
                                STGM_READWRITE | STGM_TRANSACTED | STGM_SHARE_EXCLUSIVE,
                                0,
                                0,
                                &lpTemp->m_lpObjStorage);

        assert(hErr == NOERROR);

        if (hErr != NOERROR)
                {
                delete lpTemp;
                return NULL;
                }

        // we will add one ref count on our Site. later when we want to destroy
        // the Site object we will release this  ref count. when the Site's ref
        // count goes to 0, it will be deleted.
        lpTemp->AddRef();

        return lpTemp;
}

static CSimpleSite FAR* CSimpleSite::Create ( CSimpleDoc FAR * lpDoc ) [static]
void CSimpleSite::GetObjRect ( LPRECT lpRect )
void CSimpleSite::GetObjRect ( LPRECT lpRect )

Definition at line 704 of file site.Cpp.

{
        // convert it to pixels
        lpRect->left = lpRect->top = 0;
        lpRect->right = XformWidthInHimetricToPixels(NULL,(int)m_sizel.cx);
        lpRect->bottom = XformHeightInHimetricToPixels(NULL,(int)m_sizel.cy);
}

void CSimpleSite::InitObject ( BOOL fCreateNew )

Definition at line 534 of file site.Cpp.

{
        CStabilize stabilize(this);
        LPVIEWOBJECT2 lpViewObject2;
        RECT rect;

        // Set a View Advise
        m_lpOleObject->QueryInterface(IID_IViewObject2,(LPVOID FAR *)&lpViewObject2);
        lpViewObject2->SetAdvise(m_dwDrawAspect, ADVF_PRIMEFIRST, &m_AdviseSink);

        // get the initial size of the object
        lpViewObject2->GetExtent(m_dwDrawAspect, -1 /*lindex*/, NULL /*ptd*/, &m_sizel);
        GetObjRect(&rect);  // get the rectangle of the object in pixels
        lpViewObject2->Release();

        // give the object the name of the container app/document
  //@@WTK WIN32, UNICODE
        //m_lpOleObject->SetHostNames("Simple Application", "Simple OLE 2.0 In-Place Container");
        m_lpOleObject->SetHostNames(OLESTR("Simple Application"),
                        OLESTR("Simple OLE 2.0 In-Place Container"));

        // inform object handler/DLL object that it is used in the embedding container's context
        OleSetContainedObject(m_lpOleObject, TRUE);

        if (fCreateNew) {
           // force new object to save to guarantee valid object in our storage.
           // OLE 1.0 objects may close w/o saving. this is NOT necessary if the
           // object is created FROM FILE; its data in storage is already valid.
           m_OleClientSite.SaveObject();

           // we only want to DoVerb(SHOW) if this is an InsertNew object.
           // we should NOT DoVerb(SHOW) if the object is created FromFile.
           m_lpOleObject->DoVerb(
                           OLEIVERB_SHOW,
                           NULL,
                           &m_OleClientSite,
                           -1,
                           m_lpDoc->m_hDocWnd,
                           &rect);
        }
}

void CSimpleSite::InitObject ( BOOL fCreateNew )
void CSimpleSite::PaintObj ( HDC hDC )
void CSimpleSite::PaintObj ( HDC hDC )

Definition at line 610 of file site.Cpp.

{
RECT rect;
        CStabilize stabilize(this);

        // need to check to make sure there is a valid object
        // available.  This is needed if there is a paint msg
        // between the time that CSimpleSite is instantiated
        // and OleUIInsertObject returns.
        if (!m_lpOleObject)
                return;

        // convert it to pixels
        GetObjRect(&rect);

        LPLOGPALETTE pColorSet = NULL;
        LPVIEWOBJECT lpView = NULL;

        // get a pointer to IViewObject
        m_lpOleObject->QueryInterface(IID_IViewObject,(LPVOID FAR *) &lpView);

        // if the QI succeeds, get the LOGPALETTE for the object
        if (lpView)
                lpView->GetColorSet(m_dwDrawAspect, -1, NULL, NULL, NULL, &pColorSet);

        HPALETTE hPal=NULL;
        HPALETTE hOldPal=NULL;

        // if a LOGPALETTE was returned (not guarateed), create the palette and
        // realize it.  NOTE: A smarter application would want to get the LOGPALETTE
        // for each of its visible objects, and try to create a palette that
        // satisfies all of the visible objects.  ALSO: OleFree() is used to
        // free the returned LOGPALETTE.
        if ((pColorSet))
                {
                //@@WTK WIN32, UNICODE
                //hPal = CreatePalette((const LPLOGPALETTE) pColorSet);
                hPal = CreatePalette( pColorSet);
                hOldPal = SelectPalette(hDC, hPal, FALSE);
                RealizePalette(hDC);
                OleFree(pColorSet);
                }

        // draw the object
        OleDraw(m_lpOleObject, m_dwDrawAspect, hDC, &rect);

        // if the object is open, draw a hatch rect.
        if (m_fObjectOpen)
                {
                HBRUSH hBrush = CreateHatchBrush ( HS_BDIAGONAL, RGB(0,0,0) );
                HBRUSH hOldBrush = (HBRUSH) SelectObject (hDC, hBrush);
                SetROP2(hDC, R2_MASKPEN);
                Rectangle (hDC, rect.left, rect.top, rect.right, rect.bottom);
                SelectObject(hDC, hOldBrush);
                DeleteObject(hBrush);
                }

        // if we created a palette, restore the old one, and destroy
        // the object.
        if (hPal)
                {
                SelectPalette(hDC,hOldPal,FALSE);
                DeleteObject(hPal);
                }

        // if a view pointer was successfully returned, it needs to be released.
        if (lpView)
                lpView->Release();
}

STDMETHODIMP CSimpleSite::QueryInterface | ( | REFIID | riid,
 |  | LPVOID FAR * | ppvObj
 | ) |  |

Definition at line 397 of file site.Cpp.

{
        CStabilize stabilize(this);
        OutputDebugString("In CSimpleSite::QueryInterface\r\n");

        *ppvObj = NULL;     // must set out pointer parameters to NULL

        if ( riid == IID_IUnknown)
                {
                AddRef();
                *ppvObj = this;
                return S_OK;
                }

        if ( riid == IID_IOleClientSite)
                {
                m_OleClientSite.AddRef();
                *ppvObj = &m_OleClientSite;
                return S_OK;
                }

        if ( riid == IID_IAdviseSink)
                {
                m_AdviseSink.AddRef();
                *ppvObj = &m_AdviseSink;
                return S_OK;
                }

        if ( riid == IID_IOleInPlaceSite)
                {
                m_OleInPlaceSite.AddRef();
                *ppvObj = &m_OleInPlaceSite;
                return S_OK;
                }

        // Not a supported interface
        return E_NOINTERFACE;
}

STDMETHODIMP CSimpleSite::QueryInterface | ( | REFIID | riid,
 |  | LPVOID FAR * | ppvObj
 | ) |  |
CSimpleSite::STDMETHODIMP_ ( ULONG )
CSimpleSite::STDMETHODIMP_ ( ULONG )
CSimpleSite::STDMETHODIMP_ ( ULONG )
CSimpleSite::STDMETHODIMP_ ( ULONG )
void CSimpleSite::UnloadOleObject ( void )
void CSimpleSite::UnloadOleObject ( void )

Definition at line 336 of file site.Cpp.

{
        CStabilize stabilize(this);
        OutputDebugString ("In CSimpleSite::UnloadOleObject \r\n");

        if (m_lpOleObject)
           {
           LPVIEWOBJECT lpViewObject;
           CloseOleObject();    // ensure object is closed; NOP if already closed

           m_lpOleObject->QueryInterface(IID_IViewObject, (LPVOID FAR *)&lpViewObject);

           if (lpViewObject)
                   {
                   // Remove the view advise
                   lpViewObject->SetAdvise(m_dwDrawAspect, 0, NULL);
                   lpViewObject->Release();
                   }

           m_lpOleObject->Release();
           m_lpOleObject = NULL;
           }
}

Member Data Documentation

CAdviseSink CSimpleSite::m_AdviseSink

Definition at line 32 of file site.h.

DWORD CSimpleSite::m_dwConnection

Definition at line 22 of file site.h.

DWORD CSimpleSite::m_dwDrawAspect

Definition at line 26 of file site.h.

BOOL CSimpleSite::m_fInPlaceActive

Definition at line 28 of file site.h.

BOOL CSimpleSite::m_fObjectOpen

Definition at line 29 of file site.h.

HWND CSimpleSite::m_hwndIPObj

Definition at line 25 of file site.h.

CSimpleDoc FAR * CSimpleSite::m_lpDoc

Definition at line 36 of file site.h.

LPOLEINPLACEOBJECT CSimpleSite::m_lpInPlaceObject

Definition at line 24 of file site.h.

LPSTORAGE CSimpleSite::m_lpObjStorage

Definition at line 30 of file site.h.

LPOLEOBJECT CSimpleSite::m_lpOleObject

Definition at line 23 of file site.h.

int CSimpleSite::m_nCount

Definition at line 20 of file site.h.

COleClientSite CSimpleSite::m_OleClientSite

Definition at line 34 of file site.h.

COleInPlaceSite CSimpleSite::m_OleInPlaceSite

Definition at line 33 of file site.h.

SIZEL CSimpleSite::m_sizel

Definition at line 27 of file site.h.

The documentation for this class was generated from the following files:
  • Com/Fundamentals/SimpCntr/site.h
  • Com/Fundamentals/SimpDnd/site.h
  • Com/Fundamentals/SimpCntr/site.Cpp
  • Com/Fundamentals/SimpDnd/site.Cpp
Generated on Wed Nov 13 2024 16:57:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSimpSvrApp Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes | Friends

CSimpSvrApp Class Reference

#include "app.h"

Inherits com::ms::com::IUnknown, and CSafeRefCount.

List of all members.

Public Member Functions

CSimpSvrApp ()
~CSimpSvrApp ()
void | ClearDoc ()
BOOL | fInitApplication (HINSTANCE hInstance)
BOOL | fInitInstance (HINSTANCE hInstance, int nCmdShow, CClassFactory FAR *lpClassFactory)
HMENU | GetColorMenu ()
CSimpSvrDoc FAR * | GetDoc ()
HWND | GethAppWnd ()
HMENU | GetHelpMenu ()
HINSTANCE | GethInst ()
HMENU | GetMainMenu ()
LPOLEOBJECT | GetOleObject ()
DWORD GetRegisterClass ()
void | HideAppWnd ()
BOOL IsInitialized ()
BOOL IsInPlaceActive ()
BOOL IsStartedByOle ()
long | lCommandHandler (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
long | lCreateDoc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
long | lSizeHandler (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
void | PaintApp (HDC hDC)
void | ParseCmdLine (LPSTR lpCmdLine)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID FAR *ppvObj)
void | SetStatusText ()
void | ShowAppWnd (int nCmdShow=SW_SHOWNORMAL)
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()

Private Attributes

DWORD m_dwRegisterClass
BOOL m_fInitialized
BOOL m_fOleStdInit
BOOL m_fStartByOle
HWND | m_hAppWnd
HMENU | m_hColorMenu
HMENU | m_hHelpMenu
HINSTANCE | m_hInst
HMENU | m_hMainMenu
CSimpSvrDoc FAR * | m_lpDoc
LPOLEOBJECT | m_OleObject
RECT | nullRect

Friends

interface | CClassFactory

Detailed Description

Definition at line 16 of file app.h.

Constructor & Destructor Documentation

CSimpSvrApp::CSimpSvrApp ( )

Definition at line 50 of file app.Cpp.

{
        OutputDebugString("In CSimpSvrApp's Constructor \r\n");

        // clear members
        m_hAppWnd = NULL;
        m_hInst = NULL;
        m_lpDoc = NULL;

        // clear flags
        m_fInitialized = m_fOleStdInit = FALSE;

        // used for inplace
        SetRectEmpty(&nullRect);
}

CSimpSvrApp::~CSimpSvrApp ( )

Definition at line 94 of file app.Cpp.

{
        OutputDebugString("In CSimpSvrApp's Destructor\r\n");

        if (m_fOleStdInit)
            OleStdUninitialize();

        // need to uninit the library...
        if (IsInitialized())
                OleUninitialize();

        DestroyWindow(m_hAppWnd);
}

Member Function Documentation

void CSimpSvrApp::ClearDoc ( ) [inline]

Definition at line 76 of file app.h.

{ m_lpDoc = NULL; };

BOOL CSimpSvrApp::fInitApplication ( HINSTANCE hInstance )

Definition at line 266 of file app.Cpp.

{
        CStabilize stabilize(this);
        WNDCLASS  wc;

        // Fill in window class structure with parameters that describe the
        // main window.

        wc.style = NULL;                    // Class style(s).
        wc.lpfnWndProc = MainWndProc;       // Function to retrieve messages for
                                                                                // windows of this class.
        wc.cbClsExtra = 0;                  // No per-class extra data.
        wc.cbWndExtra = 0;                  // No per-window extra data.
        wc.hInstance = hInstance;           // Application that owns the class.
        wc.hIcon = LoadIcon(hInstance, "SimpSvr");
        wc.hCursor = LoadCursor(NULL, IDC_ARROW);
        wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
        wc.lpszMenuName =  "SimpSvrMENU";    // Name of menu resource in .RC file.
        wc.lpszClassName = "SimpSvrWClass";  // Name used in call to CreateWindow.

        if (!RegisterClass(&wc))
                return FALSE;

        wc.style = CS_VREDRAW | CS_HREDRAW;                    // Class style(s).
        wc.lpfnWndProc = DocWndProc;        // Function to retrieve messages for
                                                                                // windows of this class.
        wc.cbClsExtra = 0;                  // No per-class extra data.
        wc.cbWndExtra = 0;                  // No per-window extra data.
        wc.hInstance = hInstance;           // Application that owns the class.
        wc.hIcon = NULL;
        wc.hCursor = LoadCursor(NULL, IDC_ARROW);
        wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
        wc.lpszMenuName =  NULL;
        wc.lpszClassName = "DocWClass";     // Name used in call to CreateWindow.

        // Register the window class and return success/failure code.

        if (!RegisterClass(&wc))
                return FALSE;

        return (RegisterHatchWindowClass(hInstance));
}

BOOL CSimpSvrApp::fInitInstance | ( | HINSTANCE | hInstance,
 |  | int | nCmdShow,
 |  | CClassFactory FAR * | lpClassFactory
 | ) |  |

Definition at line 348 of file app.Cpp.

{
        CStabilize stabilize(this);
        m_hInst = hInstance;

                DWORD dwVer = OleBuildVersion();

        // check to see if we are compatible with this version of the libraries
        if (HIWORD(dwVer) != rmm || LOWORD(dwVer) < rup)
                OutputDebugString("*** WARNING:  Not compatible with current libs ***\r\n");

        // initialize the libraries
        if (OleInitialize(NULL) == NOERROR)
                m_fInitialized = TRUE;

        m_fOleStdInit = OleStdInitialize(hInstance);

        // Create the "application" windows
        m_hAppWnd = CreateWindow ("SimpSvrWClass",
                                                          "Simple OLE 2.0 Server",
                                                          WS_OVERLAPPEDWINDOW,
                                                          CW_USEDEFAULT,
                                                          CW_USEDEFAULT,
                                                          CW_USEDEFAULT,
                                                          CW_USEDEFAULT,
                                                          NULL,
                                                          NULL,
                                                          hInstance,
                                                          NULL);

        if (!m_hAppWnd)
                return FALSE;

        // if not started by OLE, then show the Window, and create a "fake" object, else
        // Register a pointer to IClassFactory so that OLE can instruct us to make an
        // object at the appropriate time.
        if (!m_fStartByOle)
                {
                ShowAppWnd(nCmdShow);
                m_lpDoc->CreateObject(IID_IOleObject, (LPVOID FAR *)&m_OleObject);
                InvalidateRect(m_lpDoc->GethDocWnd(), NULL, TRUE);
                }
        else
                {
                lpClassFactory = new CClassFactory(this);

                // shouldn't pass an API an object with a zero ref count
                lpClassFactory->AddRef();

                CoRegisterClassObject(GUID_SIMPLE,(IUnknown FAR *)lpClassFactory, CLSCTX_LOCAL_SERVER, REGCLS_SINGLEUSE, &m_dwRegisterClass);

                // remove artificial Ref. count
                lpClassFactory->Release();
                }

        m_hMainMenu = GetMenu(m_hAppWnd);
        m_hColorMenu = GetSubMenu(m_hMainMenu, 1);
        m_hHelpMenu = GetSubMenu(m_hMainMenu, 2);

        return m_fInitialized;
}

HMENU CSimpSvrApp::GetColorMenu ( ) [inline]

Definition at line 79 of file app.h.

{ return m_hColorMenu; };

CSimpSvrDoc FAR* CSimpSvrApp::GetDoc ( ) [inline]

Definition at line 75 of file app.h.

{ return m_lpDoc; };

HWND CSimpSvrApp::GethAppWnd ( ) [inline]

Definition at line 70 of file app.h.

{ return m_hAppWnd; };

HMENU CSimpSvrApp::GetHelpMenu ( ) [inline]

Definition at line 80 of file app.h.

{ return m_hHelpMenu; } ;

HINSTANCE CSimpSvrApp::GethInst ( ) [inline]

Definition at line 71 of file app.h.

{ return m_hInst; };

HMENU CSimpSvrApp::GetMainMenu ( ) [inline]

Definition at line 78 of file app.h.

{ return m_hMainMenu; };

LPOLEOBJECT CSimpSvrApp::GetOleObject ( ) [inline]

Definition at line 77 of file app.h.

{ return m_OleObject; };

DWORD CSimpSvrApp::GetRegisterClass ( ) [inline]

Definition at line 74 of file app.h.

{ return m_dwRegisterClass; };

void CSimpSvrApp::HideAppWnd ( )

Definition at line 804 of file app.Cpp.

{
        CoLockObjectExternal(this, FALSE, TRUE);
        ShowWindow (m_hAppWnd, SW_HIDE);
}

BOOL CSimpSvrApp::IsInitialized ( ) [inline]

Definition at line 73 of file app.h.

{ return m_fInitialized; };

BOOL CSimpSvrApp::IsInPlaceActive ( )

Definition at line 732 of file app.Cpp.

{
        CStabilize stabilize(this);
        BOOL retval = FALSE;

        if (m_lpDoc)
                if (m_lpDoc->GetObj())
                        retval = m_lpDoc->GetObj()->IsInPlaceActive();

        return retval;
}

BOOL CSimpSvrApp::IsStartedByOle ( ) [inline]

Definition at line 72 of file app.h.

{ return m_fStartByOle; };

long CSimpSvrApp::lCommandHandler | ( | HWND | hWnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 452 of file app.Cpp.

{
        CStabilize stabilize(this);
        //@@WTK WIN32, UNICODE
        //switch (wParam) {
        switch (LOWORD(wParam)) {
                // bring up the About box
                case IDM_ABOUT:
                        {

                        DialogBox(m_hInst,               // current instance
                                        "AboutBox",                  // resource to use
                                        m_hAppWnd,                   // parent handle
                                        (DLGPROC) About);                // About() instance address

                        break;
                        }

                // exit the application
                case IDM_EXIT:
                        SendMessage(hWnd, WM_SYSCOMMAND, SC_CLOSE, 0L);
                        break;

                case IDM_RED:
                        m_lpDoc->GetObj()->SetColor (128, 0, 0);
                        InvalidateRect(m_lpDoc->GethDocWnd(), NULL, TRUE);
                        break;

                case IDM_GREEN:
                        m_lpDoc->GetObj()->SetColor (0,128, 0);
                        InvalidateRect(m_lpDoc->GethDocWnd(), NULL, TRUE);
                        break;

                case IDM_BLUE:
                        m_lpDoc->GetObj()->SetColor (0, 0, 128);
                        InvalidateRect(m_lpDoc->GethDocWnd(), NULL, TRUE);
                        break;

                case IDM_ROTATE:
                        m_lpDoc->GetObj()->RotateColor();
                        InvalidateRect(m_lpDoc->GethDocWnd(), NULL, TRUE);
                        break;

                default:
                        return (DefWindowProc(hWnd, message, wParam, lParam));
                   }   // end of switch
        return NULL;
}

long CSimpSvrApp::lCreateDoc | ( | HWND | hWnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 574 of file app.Cpp.

{
        RECT rect;
        CStabilize stabilize(this);

        GetClientRect(hWnd, &rect);

        m_lpDoc = CSimpSvrDoc::Create(this, &rect, hWnd);

        return NULL;
}

long CSimpSvrApp::lSizeHandler | ( | HWND | hWnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 533 of file app.Cpp.

{
        RECT rect;
        CStabilize stabilize(this);

        GetClientRect(m_hAppWnd, &rect);
        return m_lpDoc->lResizeDoc(&rect);
}

void CSimpSvrApp::PaintApp ( HDC hDC )

Definition at line 615 of file app.Cpp.

{
        CStabilize stabilize(this);

        // if we supported multiple documents, we would enumerate
        // through each of the open documents and call paint.

        if (m_lpDoc)
                m_lpDoc->PaintDoc(hDC);

}

void CSimpSvrApp::ParseCmdLine ( LPSTR lpCmdLine )

Definition at line 658 of file app.Cpp.

{
        char szTemp[255];

        m_fStartByOle = TRUE;

        ::ParseCmdLine (lpCmdLine, &m_fStartByOle, szTemp);
}

STDMETHODIMP CSimpSvrApp::QueryInterface | ( | REFIID | riid,
 |  | LPVOID FAR * | ppvObj
 | ) |  |

Definition at line 142 of file app.Cpp.

{
        OutputDebugString("In CSimpSvrApp::QueryInterface\r\n");

        SCODE sc = S_OK;

        if (riid == IID_IUnknown)
                *ppvObj = this;
        else
                {
                *ppvObj = NULL;
                sc = E_NOINTERFACE;
                }

        if (*ppvObj)
                ((LPUNKNOWN)*ppvObj)->AddRef();

        // asking for something we don't understand at this level.
        return sc;
}

void CSimpSvrApp::SetStatusText ( )

Definition at line 695 of file app.Cpp.

{
        CStabilize stabilize(this);
        m_lpDoc->SetStatusText();
}

void CSimpSvrApp::ShowAppWnd ( int nCmdShow = SW_SHOWNORMAL )

Definition at line 771 of file app.Cpp.

{
        CoLockObjectExternal(this, TRUE, FALSE);
        ShowWindow (m_hAppWnd, nCmdShow);
        UpdateWindow (m_hAppWnd);
}

CSimpSvrApp::STDMETHODIMP_ ( ULONG )
CSimpSvrApp::STDMETHODIMP_ ( ULONG )

Friends And Related Function Documentation

friend interface CClassFactory [friend]

Definition at line 80 of file app.h.

Member Data Documentation

DWORD CSimpSvrApp::m_dwRegisterClass [private]

Definition at line 23 of file app.h.

BOOL CSimpSvrApp::m_fInitialized [private]

Definition at line 34 of file app.h.

BOOL CSimpSvrApp::m_fOleStdInit [private]

Definition at line 35 of file app.h.

BOOL CSimpSvrApp::m_fStartByOle [private]

Definition at line 22 of file app.h.

HWND CSimpSvrApp::m_hAppWnd [private]

Definition at line 20 of file app.h.

HMENU CSimpSvrApp::m_hColorMenu [private]

Definition at line 26 of file app.h.

HMENU CSimpSvrApp::m_hHelpMenu [private]

Definition at line 27 of file app.h.

HINSTANCE CSimpSvrApp::m_hInst [private]

Definition at line 21 of file app.h.

HMENU CSimpSvrApp::m_hMainMenu [private]

Definition at line 25 of file app.h.

CSimpSvrDoc FAR* CSimpSvrApp::m_lpDoc [private]

Definition at line 33 of file app.h.

LPOLEOBJECT CSimpSvrApp::m_OleObject [private]

Definition at line 30 of file app.h.

RECT CSimpSvrApp::nullRect [private]

Definition at line 37 of file app.h.

The documentation for this class was generated from the following files:
  • Com/Fundamentals/SimpSvr/app.h
  • Com/Fundamentals/SimpSvr/app.Cpp
Generated on Wed Nov 13 2024 16:57:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSimpSvrDoc Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Private Attributes

CSimpSvrDoc Class Reference

#include "doc.h"

Inherits com::ms::com::IUnknown, and CSafeRefCount.

List of all members.

Public Member Functions

CSimpSvrDoc ()
CSimpSvrDoc (CSimpSvrApp FAR *lpApp, HWND hWnd)
~CSimpSvrDoc ()
void | ClearObj ()
void | Close ()
HRESULT | CreateObject (REFIID riid, LPVOID FAR *ppvObject)
CSimpSvrApp FAR * | GetApp ()
HWND | GethAppWnd ()
HWND | GethDocWnd ()
HWND | GethHatchWnd ()
CSimpSvrObj FAR * | GetObj ()
void | HideDocWnd ()
void | HideHatchWnd ()
long | lAddVerbs ()
void | lButtonDown (WPARAM wParam, LPARAM lParam)
BOOL | Load (LPSTR lpszFileName)
long | lResizeDoc (LPRECT lpRect)
void | PaintDoc (HDC hDC)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID FAR *ppvObj)
void | SetStatusText ()
void | ShowDocWnd ()
void | ShowHatchWnd ()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()

Static Public Member Functions

static CSimpSvrDoc FAR * | Create (CSimpSvrApp FAR *lpApp, LPRECT lpRect, HWND hWnd)

Private Attributes

BOOL m_fClosing
HWND | m_hDocWnd
HWND | m_hHatchWnd
CSimpSvrApp FAR * | m_lpApp
CSimpSvrObj FAR * | m_lpObj

Detailed Description

Definition at line 16 of file doc.h.

Constructor & Destructor Documentation

CSimpSvrDoc::CSimpSvrDoc ( )
CSimpSvrDoc::CSimpSvrDoc | ( | CSimpSvrApp FAR * | lpApp,
 |  | HWND | hWnd
 | ) |  |

Definition at line 122 of file doc.Cpp.

{
        OutputDebugString("In CSimpSvrDoc's Constructor\r\n");
        m_lpApp = lpApp;
        m_lpObj = NULL;
        m_fClosing = FALSE;

        // set up menu handles

}

CSimpSvrDoc::~CSimpSvrDoc ( )

Definition at line 161 of file doc.Cpp.

{
        OutputDebugString("In CSimpSvrDoc's Destructor\r\n");
        m_lpApp->ClearDoc();
        DestroyWindow(m_hHatchWnd);
}

Member Function Documentation

void CSimpSvrDoc::ClearObj ( ) [inline]

Definition at line 60 of file doc.h.

{ m_lpObj = NULL; };

void CSimpSvrDoc::Close ( void )

Definition at line 459 of file doc.Cpp.

{
        OutputDebugString("In CSimpSvrDoc::Close() \r\n");
        CStabilize stabilize(this);

        m_lpObj->AddRef(); // hold object alive

        if (m_fClosing)
                return;

        m_fClosing = TRUE;

        // if the object is currently inplace active, then deactivate
        if (m_lpObj->IsInPlaceActive())
                m_lpObj->GetOleInPlaceObject()->InPlaceDeactivate();

        // unregister from the ROT...
        if (m_lpObj->GetRotRegister())
                {
                LPRUNNINGOBJECTTABLE lpRot;

                if (GetRunningObjectTable (0, &lpRot) == NOERROR )
                        {
                        lpRot->Revoke(m_lpObj->GetRotRegister());
                        lpRot->Release();
                        }
                }

        // if we have a clientsite, instruct it to save the object
        if (m_lpObj->GetOleClientSite())
                {
                m_lpObj->GetOleClientSite()->SaveObject();
                m_lpObj->GetOleClientSite()->OnShowWindow(FALSE);
                }

        // Do a final SendOnDataChange for those containers that have specified the
        // ADF_DATAONSTOP flag.
        if (m_lpObj->GetDataAdviseHolder())
                {
                m_lpObj->GetDataAdviseHolder()->SendOnDataChange( m_lpObj->GetDataObject(), 0, ADVF_DATAONSTOP);
                m_lpObj->GetDataAdviseHolder()->Release();
                m_lpObj->ClearDataAdviseHolder();
                }

        // Tell the container that we are shutting down.
        if (m_lpObj->GetOleAdviseHolder())
                {
                m_lpObj->GetOleAdviseHolder()->SendOnClose();
                m_lpObj->GetOleAdviseHolder()->Release();
                m_lpObj->ClearOleAdviseHolder();
                }

        if (m_lpObj->GetOleClientSite())
                {
                m_lpObj->GetOleClientSite()->Release();
                m_lpObj->ClearOleClientSite();
                }

        // release our streams and storage
        m_lpObj->GetPersistStorage()->ReleaseStreamsAndStorage();

        // Disconnect the object.  NOTE: This call should not do anything
        // unless the container has cause a GP Fault or some other problem
        // has occured...
        OutputDebugString("*** Before CoDisconnectObject *** \r\n");
        CoDisconnectObject((LPUNKNOWN)m_lpObj, 0);
        OutputDebugString("*** After CoDisconnectObject *** \r\n");

        m_lpObj->Release(); // let object close

}

CSimpSvrDoc FAR * CSimpSvrDoc::Create | ( | CSimpSvrApp FAR * | lpApp,
 |  | LPRECT | lpRect,
 |  | HWND | hWnd |
 | ) |  |  | [static]

Definition at line 55 of file doc.Cpp.

{
        CSimpSvrDoc FAR * lpTemp = new CSimpSvrDoc(lpApp, hWnd);

        if (!lpTemp)
                return NULL;

        // create the document Window
        lpTemp->m_hDocWnd = CreateWindow(
                        "DocWClass",
                        NULL,
                        WS_CHILD | WS_CLIPSIBLINGS,
                        lpRect->left,
                        lpRect->top,
                        lpRect->right,
                        lpRect->bottom,
                        hWnd,
                        NULL,
                        lpApp->GethInst(),
                        NULL);

        if (!lpTemp->m_hDocWnd)
                goto error;

        lpTemp->ShowDocWnd();

        lpTemp->m_hHatchWnd = CreateHatchWindow( lpTemp->m_hDocWnd, lpApp->GethInst());

        lpTemp->HideHatchWnd();

        return (lpTemp);

error:
        delete (lpTemp);
        return NULL;

}

HRESULT CSimpSvrDoc::CreateObject | ( | REFIID | riid,
 |  | LPVOID FAR * | ppvObject
 | ) |  |

Definition at line 401 of file doc.Cpp.

{
        SCODE sc = E_FAIL;

        m_lpObj = new CSimpSvrObj(this);

        if (m_lpObj)
                {
                m_lpObj->QueryInterface(riid, ppvObject);
                sc = S_OK;
                }

        return sc;
}

CSimpSvrApp FAR* CSimpSvrDoc::GetApp ( ) [inline]

Definition at line 58 of file doc.h.

{ return m_lpApp; };

HWND CSimpSvrDoc::GethAppWnd ( ) [inline]

Definition at line 57 of file doc.h.

{ return m_lpApp->GethAppWnd(); };

HWND CSimpSvrDoc::GethDocWnd ( ) [inline]

Definition at line 55 of file doc.h.

{ return m_hDocWnd; };

HWND CSimpSvrDoc::GethHatchWnd ( ) [inline]

Definition at line 56 of file doc.h.

{ return m_hHatchWnd; };

CSimpSvrObj FAR* CSimpSvrDoc::GetObj ( ) [inline]

Definition at line 59 of file doc.h.

{ return m_lpObj; };

void CSimpSvrDoc::HideDocWnd ( )

Definition at line 659 of file doc.Cpp.

{
        ShowWindow(m_hDocWnd, SW_HIDE);
}

void CSimpSvrDoc::HideHatchWnd ( )

Definition at line 689 of file doc.Cpp.

{
        ShowWindow(m_hHatchWnd, SW_HIDE);
}

long CSimpSvrDoc::lAddVerbs ( )
void CSimpSvrDoc::lButtonDown | ( | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |
BOOL CSimpSvrDoc::Load ( LPSTR lpszFileName )
long CSimpSvrDoc::lResizeDoc ( LPRECT lpRect )

Definition at line 323 of file doc.Cpp.

{
        MoveWindow(m_hDocWnd, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom, TRUE);
        return NULL;
}

void CSimpSvrDoc::PaintDoc ( HDC hDC )

Definition at line 359 of file doc.Cpp.

{
        // if the object hasn't been created yet, then don't draw
        if (m_lpObj)
                m_lpObj->Draw(hDC,FALSE);
        else
                return;

        CStabilize stabilize(this);

        // Sending a data change every time we paint, but only if we
        // were started by OLE
        if (m_lpApp->IsStartedByOle())
                        m_lpObj->SendOnDataChange( );
}

STDMETHODIMP CSimpSvrDoc::QueryInterface | ( | REFIID | riid,
 |  | LPVOID FAR * | ppvObj
 | ) |  |

Definition at line 201 of file doc.Cpp.

{
        OutputDebugString("In CSimpSvrDoc::QueryInterface\r\n");

        SCODE sc = E_NOINTERFACE;

        if ( (riid == IID_IUnknown) )
           {
           AddRef();
           *ppvObj = this;
           sc = S_OK;
           }

        return sc;
}

void CSimpSvrDoc::SetStatusText ( )

Definition at line 563 of file doc.Cpp.

{
        CStabilize stabilize(this);
        if (m_lpObj->IsInPlaceActive())
                //@@WTK WIN32, UNICODE
                //m_lpObj->GetInPlaceFrame()->SetStatusText("\0");
                m_lpObj->GetInPlaceFrame()->SetStatusText(OLESTR("\0"));
}

void CSimpSvrDoc::ShowDocWnd ( )

Definition at line 598 of file doc.Cpp.

{
        ShowWindow(m_hDocWnd, SW_SHOWNORMAL);  // Show the window
        UpdateWindow(m_hDocWnd);               // Sends WM_PAINT message
}

void CSimpSvrDoc::ShowHatchWnd ( )

Definition at line 629 of file doc.Cpp.

{
        ShowWindow(m_hHatchWnd, SW_SHOW);
}

CSimpSvrDoc::STDMETHODIMP_ ( ULONG )
CSimpSvrDoc::STDMETHODIMP_ ( ULONG )

Member Data Documentation

BOOL CSimpSvrDoc::m_fClosing [private]

Definition at line 24 of file doc.h.

HWND CSimpSvrDoc::m_hDocWnd [private]

Definition at line 22 of file doc.h.

HWND CSimpSvrDoc::m_hHatchWnd [private]

Definition at line 23 of file doc.h.

CSimpSvrApp FAR* CSimpSvrDoc::m_lpApp [private]

Definition at line 19 of file doc.h.

CSimpSvrObj FAR* CSimpSvrDoc::m_lpObj [private]

Definition at line 20 of file doc.h.

The documentation for this class was generated from the following files:
  • Com/Fundamentals/SimpSvr/doc.h
  • Com/Fundamentals/SimpSvr/doc.Cpp
Generated on Wed Nov 13 2024 16:57:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSimpSvrObj Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes | Friends

CSimpSvrObj Class Reference

#include "Obj.h"

Inherits com::ms::com::IUnknown.

List of all members.

Public Member Functions

CSimpSvrObj (CSimpSvrDoc FAR *lpSimpSvrDoc)
~CSimpSvrObj ()
void | AddFrameLevelUI ()
void | AssembleMenus ()
void | ClearDataAdviseHolder ()
void | ClearOleAdviseHolder ()
void | ClearOleClientSite ()
void | DeactivateUI ()
void | DisassembleMenus ()
BOOL | DoInPlaceActivate (LONG lVerb)
void | DoInPlaceHide ()
void | Draw (HDC hDC, BOOL fMetaDC=TRUE)
LPDATAADVISEHOLDER | GetDataAdviseHolder ()
CDataObject FAR * | GetDataObject ()
LPOLEINPLACEFRAMEINFO | GetFrameInfo ()
LPOLEINPLACEFRAME | GetInPlaceFrame ()
LPOLEINPLACESITE | GetInPlaceSite ()
HANDLE GetMetaFilePict ()
LPOLEADVISEHOLDER | GetOleAdviseHolder ()
LPOLECLIENTSITE | GetOleClientSite ()
COleInPlaceActiveObject FAR * | GetOleInPlaceActiveObject ()
COleInPlaceObject FAR * | GetOleInPlaceObject ()
COleObject FAR * | GetOleObject ()
HWND | GetParent ()
CPersistStorage FAR * | GetPersistStorage ()
LPRECT GetPosRect ()
DWORD GetRotRegister ()
LPPOINT | GetSize ()
LPSTORAGE | GetStorage ()
LPOLEINPLACEUIWINDOW | GetUIWindow ()
BOOL IsInPlaceActive ()
BOOL IsInPlaceVisible ()
BOOL IsUIActive ()
void | lButtonDown (WPARAM wParam, LPARAM lParam)
void | LoadFromStorage ()
void | PaintObj (HDC hDC)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID FAR *ppvObj)
void | RotateColor ()
void | SaveToStorage (LPSTORAGE lpStg, BOOL fSameAsLoad)
void | SendOnDataChange ()
void | SetColor (int nRed, int nGreen, int nBlue)
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()

Private Attributes

int | m_blue
CDataObject m_DataObject
DWORD m_dwRegister
CExternalConnection | m_ExternalConnection
BOOL m_fInPlaceActive
BOOL m_fInPlaceVisible
BOOL m_fNoScribbleMode
OLEINPLACEFRAMEINFO | m_FrameInfo
BOOL m_fSaveWithSameAsLoad
BOOL m_fUIActive
int | m_green
HMENU | m_hmenuShared
HOLEMENU | m_hOleMenu
HWND | m_hWndParent
LPOLEINPLACEUIWINDOW | m_lpCntrDoc
LPSTREAM | m_lpColorStm
LPDATAADVISEHOLDER | m_lpDataAdviseHolder
CSimpSvrDoc FAR * | m_lpDoc
LPOLEINPLACEFRAME | m_lpFrame
LPOLEINPLACESITE | m_lpIPSite
LPOLEADVISEHOLDER | m_lpOleAdviseHolder
LPOLECLIENTSITE | m_lpOleClientSite
LPSTREAM | m_lpSizeStm
LPSTORAGE | m_lpStorage
int | m_nCount
COleInPlaceActiveObject m_OleInPlaceActiveObject
COleInPlaceObject m_OleInPlaceObject
COleObject m_OleObject
CPersistStorage m_PersistStorage
RECT | m_posRect
int | m_red
float | m_scale
POINT | m_size
int | m_xOffset
int | m_yOffset

Friends

interface | CDataObject
interface | CExternalConnection
interface | COleInPlaceActiveObject
interface | COleInPlaceObject
interface | COleObject
interface | CPersistStorage

Detailed Description

Definition at line 27 of file Obj.h.

Constructor & Destructor Documentation

CSimpSvrObj::CSimpSvrObj ( CSimpSvrDoc FAR * lpSimpSvrDoc )

Definition at line 205 of file Obj.Cpp.

                                                       : m_OleObject(this),
                                                                                m_DataObject(this),
                                                                                m_PersistStorage(this),
                                                                                m_OleInPlaceActiveObject(this),
                                                                                m_OleInPlaceObject(this),
                                                                                m_ExternalConnection(this)
#pragma warning (default : 4355) // Turn the warning back on

{
        m_lpDoc = lpSimpSvrDoc;
        m_nCount = 0;
        m_fInPlaceActive = FALSE;
        m_fInPlaceVisible = FALSE;
        m_fUIActive = FALSE;
        m_hmenuShared = NULL;
        m_hOleMenu = NULL;

        m_dwRegister = 0;

        m_lpFrame = NULL;
        m_lpCntrDoc = NULL;

        m_lpStorage = NULL;
        m_lpColorStm = NULL;
        m_lpSizeStm = NULL;
        m_lpOleClientSite = NULL;
        m_lpOleAdviseHolder = NULL;
        m_lpDataAdviseHolder = NULL;
        m_lpIPSite = NULL;

        m_red = 128;
        m_green = 0;
        m_blue = 0;

        m_size.x = 100;
        m_size.y = 100;

        m_xOffset = 0;
        m_yOffset = 0;

        m_scale = (float) 1.0;

        m_fSaveWithSameAsLoad = FALSE;
        m_fNoScribbleMode = FALSE;

}

CSimpSvrObj::~CSimpSvrObj ( )

Definition at line 283 of file Obj.Cpp.

{
        OutputDebugString("In CSimpSvrObj's Destructor \r\n");

        // if we were started by ole, post ourselves a close message
        if (m_lpDoc->GetApp()->IsStartedByOle())
                PostMessage(m_lpDoc->GethAppWnd(), WM_SYSCOMMAND, SC_CLOSE, 0L);

        // clear the OBJ ptr in the doc class
        m_lpDoc->ClearObj();

}

Member Function Documentation

void CSimpSvrObj::AddFrameLevelUI ( )

Definition at line 841 of file Obj.Cpp.

{
        OutputDebugString("In CSimpSvrObj::AddFrameLevelUI\r\n");

        // add the combined menu
        m_lpFrame->SetMenu(m_hmenuShared, m_hOleMenu, m_lpDoc->GethDocWnd());

        // do hatched border
        SetParent (m_lpDoc->GethHatchWnd(), m_hWndParent);
        SetParent (m_lpDoc->GethDocWnd(), m_lpDoc->GethHatchWnd());

        // set the border space.  Normally we would negotiate for toolbar
        // space at this point.  Since this server doesn't have a toolbar,
        // this isn't needed...
        if (m_lpFrame)
                m_lpFrame->SetBorderSpace(NULL);

        if (m_lpCntrDoc)
                m_lpCntrDoc->SetBorderSpace(NULL);
}

void CSimpSvrObj::AssembleMenus ( )

Definition at line 776 of file Obj.Cpp.

{
        OutputDebugString("In CSimpSvrObj::AssembleMenus\r\n");
        OLEMENUGROUPWIDTHS menugroupwidths;

        m_hmenuShared = NULL;

        //  Create the menu resource
        m_hmenuShared = CreateMenu();

        // have the contaner insert its menus
        if (m_lpFrame->InsertMenus (m_hmenuShared, &menugroupwidths) == NOERROR)
                {
                int nFirstGroup = (int) menugroupwidths.width[0];

                // insert the server menus
                //@@WTK WIN32, UNICODE
                //InsertMenu( m_hmenuShared, nFirstGroup, MF_BYPOSITION | MF_POPUP, m_lpDoc->GetApp()->GetColorMenu(), "&Color");
                InsertMenu( m_hmenuShared, nFirstGroup, MF_BYPOSITION | MF_POPUP,
                        (UINT)m_lpDoc->GetApp()->GetColorMenu(), "&Color");
                menugroupwidths.width[1] = 1;
                menugroupwidths.width[3] = 0;
                menugroupwidths.width[5] = 0;
                }
        else
                {
                // Destroy the menu resource
                DestroyMenu(m_hmenuShared);
                m_hmenuShared = NULL;
                }

        // tell OLE to create the menu descriptor
        m_hOleMenu = OleCreateMenuDescriptor(m_hmenuShared, &menugroupwidths);
}

void CSimpSvrObj::ClearDataAdviseHolder ( ) [inline]

Definition at line 114 of file Obj.h.

{ m_lpDataAdviseHolder = NULL; };

void CSimpSvrObj::ClearOleAdviseHolder ( ) [inline]

Definition at line 115 of file Obj.h.

{ m_lpOleAdviseHolder = NULL; };

void CSimpSvrObj::ClearOleClientSite ( ) [inline]

Definition at line 113 of file Obj.h.

{ m_lpOleClientSite = NULL; };

void CSimpSvrObj::DeactivateUI ( )

Definition at line 1058 of file Obj.Cpp.

{
        // if not UI active, or no pointer to IOleInPlaceFrame, then
        // return NOERROR
        if (!(m_fUIActive || m_lpFrame))
                return;
        else
                {
                m_fUIActive = FALSE;

                // remove hatching
                SetParent (m_lpDoc->GethDocWnd(), m_lpDoc->GethAppWnd());
                SetParent (m_lpDoc->GethHatchWnd(),m_lpDoc->GethDocWnd());

                // if in an MDI container, call SetActiveObject on the DOC.
                if (m_lpCntrDoc)
                        m_lpCntrDoc->SetActiveObject(NULL, NULL);

                m_lpFrame->SetActiveObject(NULL, NULL);

                // tell the container that our UI is going away.
                if (m_lpIPSite)
                        m_lpIPSite->OnUIDeactivate(FALSE);
                }
}

void CSimpSvrObj::DisassembleMenus ( )

Definition at line 960 of file Obj.Cpp.

{
        // destroy the menu descriptor
        OleDestroyMenuDescriptor(m_hOleMenu);

        if (m_hmenuShared)
                {
                // remove the menus that we added
                RemoveMenu( m_hmenuShared, 1, MF_BYPOSITION);

                // have the container remove its menus
                m_lpFrame->RemoveMenus(m_hmenuShared);

                // Destroy the menu resource
                DestroyMenu(m_hmenuShared);

                m_hmenuShared = NULL;
                }
}

BOOL CSimpSvrObj::DoInPlaceActivate ( LONG lVerb )

Definition at line 628 of file Obj.Cpp.

{
        BOOL retval = FALSE;
        RECT posRect, clipRect;

        OutputDebugString("In CSimpSvrObj::DoInPlaceActivate\r\n");

        // if not currently in place active
        if (!m_fInPlaceActive)
                {
                // get the inplace site
                if (m_lpOleClientSite->QueryInterface(IID_IOleInPlaceSite,
                                                                                (LPVOID FAR *)&m_lpIPSite) != NOERROR)
                        goto error;

                // if the inplace site could not be obtained, or refuses to inplace
                // activate then goto error.
                if (m_lpIPSite == NULL || m_lpIPSite->CanInPlaceActivate() != NOERROR)
                        {
                        if (m_lpIPSite)
                                m_lpIPSite->Release();
                        m_lpIPSite = NULL;
                        goto error;
                        }

                // tell the site that we are activating.
                m_lpIPSite->OnInPlaceActivate();
                m_fInPlaceActive = TRUE;
                }

        // if not currently inplace visibl
        if (!m_fInPlaceVisible)
                {
                m_fInPlaceVisible = TRUE;

                // get the window handle of the site
                m_lpIPSite->GetWindow(&m_hWndParent);

                // get window context from the container
                m_lpIPSite->GetWindowContext ( &m_lpFrame,
                                                                         &m_lpCntrDoc,
                                                                         &posRect,
                                                                         &clipRect,
                                                                         &m_FrameInfo);

                // show the hatch window
                m_lpDoc->ShowHatchWnd();

                // Set the parenting
                SetParent (m_lpDoc->GethHatchWnd(), m_hWndParent);
                SetParent (m_lpDoc->GethDocWnd(), m_lpDoc->GethHatchWnd());

                // tell the client site to show the object
                m_lpOleClientSite->ShowObject();

                RECT resRect;

                // figure out the "real" size of the object
                IntersectRect(&resRect, &posRect, &clipRect);
                CopyRect(&m_posRect, &posRect);

                POINT pt;

                // adjust our hatch window size
                SetHatchWindowSize ( m_lpDoc->GethHatchWnd(),
                                                         &resRect,
                                                         &posRect,
                                                         &pt);

                // calculate the actual object rect inside the hatchwnd.
                OffsetRect (&resRect, pt.x, pt.y);

                // move the object window
                MoveWindow(m_lpDoc->GethDocWnd(),
                                   resRect.left,
                                   resRect.top,
                                   resRect.right - resRect.left,
                                   resRect.bottom - resRect.top,
                                   FALSE);

                // create the combined window
                AssembleMenus();
                }

        // if not UIActive
        if (!m_fUIActive)
                {
                m_fUIActive = TRUE;

                // tell the inplace site that we are activating
                m_lpIPSite->OnUIActivate();

                // set the focus to our object window
                SetFocus(m_lpDoc->GethDocWnd());

                // set the active object on the frame
                //@@WTK WIN32, UNICODE
                //m_lpFrame->SetActiveObject(&m_OleInPlaceActiveObject, "Simple OLE 2.0 Server");
                m_lpFrame->SetActiveObject(&m_OleInPlaceActiveObject, OLESTR("Simple OLE 2.0 Server"));

                // set the active object on the Doc, if available.
                if (m_lpCntrDoc)
                        //@@WTK WIN32, UNICODE
                        //m_lpCntrDoc->SetActiveObject(&m_OleInPlaceActiveObject, "Simple OLE 2.0 Server");
                        m_lpCntrDoc->SetActiveObject(&m_OleInPlaceActiveObject, OLESTR("Simple OLE 2.0 Server"));

                // add the frame level UI.
                AddFrameLevelUI();
                }

        retval = TRUE;
error:
        return retval;
}

void CSimpSvrObj::DoInPlaceHide ( )

Definition at line 898 of file Obj.Cpp.

{
        OutputDebugString("In CSimpSvrObj::DoInPlaceHide\r\n");

        // if we aren't inplace visible, then this routine is a NOP,
        if (!m_fInPlaceVisible)
                return;

        m_fInPlaceVisible = FALSE;

        // change the parenting
        SetParent (m_lpDoc->GethDocWnd(), m_lpDoc->GethAppWnd());
        SetParent (m_lpDoc->GethHatchWnd(),m_lpDoc->GethDocWnd());

        // rip down the combined menus
        DisassembleMenus();

        // release the inplace frame
        m_lpFrame->Release();

        m_lpFrame = NULL;  // only holding one ref. to frame.

        // release the UIWindow if it is there.
        if (m_lpCntrDoc)
                m_lpCntrDoc->Release();

        m_lpCntrDoc = NULL;

}

void CSimpSvrObj::Draw | ( | HDC | hDC,
 |  | BOOL | fMetaDC = TRUE
 | ) |  |

Definition at line 326 of file Obj.Cpp.

{
        LOGBRUSH lb;

        OutputDebugString("In CSimpSvrObj::Draw\r\n");

        char szBuffer[255];
        wsprintf(szBuffer,"Drawing Scale %3d\r\n",(int)m_scale);
        OutputDebugString(szBuffer);

        if (!m_fMeta)
                {
                SetMapMode(hDC, MM_ANISOTROPIC);
                //@@WTK WIN32, UNICODE
                //SetWindowOrg(hDC, (int)(m_xOffset/m_scale), (int)(m_yOffset/m_scale));
                SetWindowOrgEx(hDC, (int)(m_xOffset/m_scale),
                        (int)(m_yOffset/m_scale), NULL);
                //@@WTK WIN32, UNICODE
                //SetWindowExt(hDC, m_size.x, m_size.y);
                SetWindowExtEx(hDC, m_size.x, m_size.y, NULL);
                //@@WTK WIN32, UNICODE
                //SetViewportExt(hDC, (int)(m_size.x*m_scale), (int)(m_size.y*m_scale));
                SetViewportExtEx(hDC, (int)(m_size.x*m_scale),
                        (int)(m_size.y*m_scale), NULL);
                }

        // fill out a LOGBRUSH
        lb.lbStyle = BS_SOLID;
        lb.lbColor = RGB(m_red, m_green, m_blue);
        lb.lbHatch = 0;

        // create the brush
        HBRUSH hBrush = CreateBrushIndirect(&lb);

        // select the brush
        HBRUSH hOldBrush = (HBRUSH) SelectObject(hDC, hBrush);
        HPEN hPen = CreatePen(PS_INSIDEFRAME, 6, RGB(0, 0, 0));

        HPEN hOldPen = (HPEN) SelectObject(hDC, hPen);

        // draw the rectangle
        Rectangle (hDC, 0, 0, m_size.x, m_size.y);

        // restore the pen
        hPen = (HPEN) SelectObject(hDC, hOldPen);

        // free the pen
        DeleteObject(hPen);

        // restore the old brush
        hBrush = (HBRUSH) SelectObject(hDC, hOldBrush);

        // free the brush
        DeleteObject(hBrush);
}

LPDATAADVISEHOLDER CSimpSvrObj::GetDataAdviseHolder ( ) [inline]

Definition at line 103 of file Obj.h.

{ return m_lpDataAdviseHolder; };

CDataObject FAR* CSimpSvrObj::GetDataObject ( ) [inline]

Definition at line 110 of file Obj.h.

{ return &m_DataObject; };

LPOLEINPLACEFRAMEINFO CSimpSvrObj::GetFrameInfo ( ) [inline]

Definition at line 118 of file Obj.h.

{return &m_FrameInfo;};

LPOLEINPLACEFRAME CSimpSvrObj::GetInPlaceFrame ( ) [inline]

Definition at line 105 of file Obj.h.

{ return m_lpFrame; };

LPOLEINPLACESITE CSimpSvrObj::GetInPlaceSite ( ) [inline]

Definition at line 107 of file Obj.h.

{ return m_lpIPSite; };

HANDLE CSimpSvrObj::GetMetaFilePict ( )

Definition at line 418 of file Obj.Cpp.

{
        HANDLE hMFP;
        METAFILEPICT FAR * lpMFP;
        POINT pt;

        OutputDebugString("In CSimpSvrObj::GetMetaFilePict\r\n");

        // allocate the memory for the METAFILEPICT structure
        hMFP = GlobalAlloc (GMEM_SHARE | GHND, sizeof (METAFILEPICT) );
        lpMFP = (METAFILEPICT FAR*) GlobalLock(hMFP);

        // get the size of the object in HIMETRIC
        pt.x = XformWidthInPixelsToHimetric(NULL, m_size.x);
        pt.y = XformHeightInPixelsToHimetric(NULL, m_size.y);

        // fill out the METAFILEPICT structure
        lpMFP->mm = MM_ANISOTROPIC;
        lpMFP->xExt = pt.x;
        lpMFP->yExt = pt.y;

        // Create the metafile
        HDC hDC = CreateMetaFile(NULL);

        //@@WTK WIN32, UNICODE
        //SetWindowOrg (hDC, 0, 0);
        SetWindowOrgEx (hDC, 0, 0, NULL);
        //@@WTK WIN32, UNICODE
        //SetWindowExt (hDC, m_size.x,
        SetWindowExtEx (hDC, m_size.x,
                                           m_size.y, NULL);

        Draw(hDC);

        lpMFP->hMF = CloseMetaFile(hDC);

        // unlock the metafilepict
        GlobalUnlock(hMFP);

        return hMFP;
}

LPOLEADVISEHOLDER CSimpSvrObj::GetOleAdviseHolder ( ) [inline]

Definition at line 104 of file Obj.h.

{ return m_lpOleAdviseHolder; };

LPOLECLIENTSITE CSimpSvrObj::GetOleClientSite ( ) [inline]

Definition at line 102 of file Obj.h.

{ return m_lpOleClientSite; };

COleInPlaceActiveObject FAR* CSimpSvrObj::GetOleInPlaceActiveObject ( ) [inline]

Definition at line 111 of file Obj.h.

{ return &m_OleInPlaceActiveObject; };

COleInPlaceObject FAR* CSimpSvrObj::GetOleInPlaceObject ( ) [inline]

Definition at line 112 of file Obj.h.

{ return &m_OleInPlaceObject; };

COleObject FAR* CSimpSvrObj::GetOleObject ( ) [inline]

Definition at line 108 of file Obj.h.

{ return &m_OleObject; };

HWND CSimpSvrObj::GetParent ( ) [inline]

Definition at line 100 of file Obj.h.

{ return m_hWndParent; };

CPersistStorage FAR* CSimpSvrObj::GetPersistStorage ( ) [inline]

Definition at line 109 of file Obj.h.

{ return &m_PersistStorage; };

LPRECT CSimpSvrObj::GetPosRect ( ) [inline]

Definition at line 116 of file Obj.h.

{ return &m_posRect; };

DWORD CSimpSvrObj::GetRotRegister ( ) [inline]

Definition at line 119 of file Obj.h.

{ return m_dwRegister; };

LPPOINT CSimpSvrObj::GetSize ( ) [inline]

Definition at line 117 of file Obj.h.

{ return &m_size; };

LPSTORAGE CSimpSvrObj::GetStorage ( ) [inline]

Definition at line 101 of file Obj.h.

{ return m_lpStorage; };

LPOLEINPLACEUIWINDOW CSimpSvrObj::GetUIWindow ( ) [inline]

Definition at line 106 of file Obj.h.

{ return m_lpCntrDoc; };

BOOL CSimpSvrObj::IsInPlaceActive ( ) [inline]

Definition at line 97 of file Obj.h.

{ return m_fInPlaceActive; };

BOOL CSimpSvrObj::IsInPlaceVisible ( ) [inline]

Definition at line 98 of file Obj.h.

{ return m_fInPlaceVisible; };

BOOL CSimpSvrObj::IsUIActive ( ) [inline]

Definition at line 99 of file Obj.h.

{ return m_fUIActive; };

void CSimpSvrObj::lButtonDown | ( | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |
void CSimpSvrObj::LoadFromStorage ( )

Definition at line 564 of file Obj.Cpp.

{
        OutputDebugString("In CSimpSvrObj::LoadFromStorage\r\n");

        // Read the colors
        m_lpColorStm->Read(&m_red, sizeof(m_red), NULL);
        m_lpColorStm->Read(&m_green, sizeof(m_green), NULL);
        m_lpColorStm->Read(&m_blue, sizeof(m_blue), NULL);

        // read the size
        m_lpSizeStm->Read(&m_size, sizeof(m_size), NULL);

}

void CSimpSvrObj::PaintObj ( HDC hDC )
STDMETHODIMP CSimpSvrObj::QueryInterface | ( | REFIID | riid,
 |  | LPVOID FAR * | ppvObj
 | ) |  |

Definition at line 58 of file Obj.Cpp.

{
        OutputDebugString("In CSimpSvrObj::QueryInterface\r\n");

        SCODE sc = S_OK;

        if (riid == IID_IUnknown)
                *ppvObj = this;
        else if (riid == IID_IOleObject)
                *ppvObj = &m_OleObject;
        else if (riid == IID_IDataObject)
                *ppvObj = &m_DataObject;
        else if ( (riid == IID_IPersistStorage) || (riid == IID_IPersist) )
                *ppvObj = &m_PersistStorage;
        else if (riid == IID_IOleInPlaceObject)
                *ppvObj = &m_OleInPlaceObject;
        else if (riid == IID_IOleInPlaceActiveObject)
                *ppvObj = &m_OleInPlaceActiveObject;
        else if (riid == IID_IExternalConnection)
                 *ppvObj = &m_ExternalConnection;
        else
                {
                *ppvObj = NULL;
                sc = E_NOINTERFACE;
                }

        if (*ppvObj)
                ((LPUNKNOWN)*ppvObj)->AddRef();

        return  sc ;
};

void CSimpSvrObj::RotateColor ( ) [inline]

Definition at line 127 of file Obj.h.

    { m_red+=10; m_green+=10; m_blue+=10;};

void CSimpSvrObj::SaveToStorage | ( | LPSTORAGE | lpStg,
 |  | BOOL | fSameAsLoad
 | ) |  |

Definition at line 491 of file Obj.Cpp.

{
        OutputDebugString("In CSimpSvrObj::SaveToStorage\r\n");

        LPSTREAM lpTempColor, lpTempSize;

        if (!fSameAsLoad)
                m_PersistStorage.CreateStreams( lpStg, &lpTempColor, &lpTempSize);
        else
                {
                lpTempColor = m_lpColorStm;
                lpTempColor->AddRef();
                lpTempSize = m_lpSizeStm;
                lpTempSize->AddRef();
                }

        ULARGE_INTEGER uli;

        uli.LowPart = 0;
        uli.HighPart = 0;

        lpTempColor->SetSize(uli);
        lpTempSize->SetSize(uli);

        LARGE_INTEGER li;

        li.LowPart = 0;
        li.HighPart = 0;

        lpTempColor->Seek(li, STREAM_SEEK_SET, NULL);
        lpTempSize->Seek(li, STREAM_SEEK_SET, NULL);

        // write the colors to the stream
        lpTempColor->Write(&m_red, sizeof(m_red), NULL);
        lpTempColor->Write(&m_green, sizeof(m_green), NULL);
        lpTempColor->Write(&m_blue, sizeof(m_blue), NULL);

        // write the size to the stream
        lpTempSize->Write(&m_size, sizeof(m_size), NULL);

        lpTempColor->Release();
        lpTempSize->Release();
}

void CSimpSvrObj::SendOnDataChange ( )

Definition at line 1010 of file Obj.Cpp.

{
        if (m_lpDataAdviseHolder)
                m_lpDataAdviseHolder->SendOnDataChange( (LPDATAOBJECT)&m_DataObject, 0, 0);

        LPRUNNINGOBJECTTABLE lpRot;

        GetRunningObjectTable(0, &lpRot);

        if ( lpRot && m_dwRegister)
                {
                FILETIME ft;
                CoFileTimeNow(&ft);

                lpRot->NoteChangeTime(m_dwRegister, &ft);
                lpRot->Release();
                }
}

void CSimpSvrObj::SetColor | ( | int | nRed,
 |  | int | nGreen,
 |  | int | nBlue |
 | ) |  |  | [inline]

Definition at line 124 of file Obj.h.

    { m_red = nRed; m_green = nGreen; m_blue = nBlue; };

CSimpSvrObj::STDMETHODIMP_ ( ULONG )
CSimpSvrObj::STDMETHODIMP_ ( ULONG )

Friends And Related Function Documentation

friend interface CDataObject [friend]

Definition at line 135 of file Obj.h.

friend interface CExternalConnection [friend]

Definition at line 138 of file Obj.h.

friend interface COleInPlaceActiveObject [friend]

Definition at line 136 of file Obj.h.

friend interface COleInPlaceObject [friend]

Definition at line 137 of file Obj.h.

friend interface COleObject [friend]

Definition at line 128 of file Obj.h.

friend interface CPersistStorage [friend]

Definition at line 134 of file Obj.h.

Member Data Documentation

int CSimpSvrObj::m_blue [private]

Definition at line 44 of file Obj.h.

CDataObject CSimpSvrObj::m_DataObject [private]

Definition at line 65 of file Obj.h.

DWORD CSimpSvrObj::m_dwRegister [private]

Definition at line 42 of file Obj.h.

CExternalConnection CSimpSvrObj::m_ExternalConnection [private]

Definition at line 68 of file Obj.h.

BOOL CSimpSvrObj::m_fInPlaceActive [private]

Definition at line 32 of file Obj.h.

BOOL CSimpSvrObj::m_fInPlaceVisible [private]

Definition at line 33 of file Obj.h.

BOOL CSimpSvrObj::m_fNoScribbleMode [private]

Definition at line 40 of file Obj.h.

OLEINPLACEFRAMEINFO CSimpSvrObj::m_FrameInfo [private]

Definition at line 38 of file Obj.h.

BOOL CSimpSvrObj::m_fSaveWithSameAsLoad [private]

Definition at line 39 of file Obj.h.

BOOL CSimpSvrObj::m_fUIActive [private]

Definition at line 34 of file Obj.h.

int CSimpSvrObj::m_green [private]

Definition at line 44 of file Obj.h.

HMENU CSimpSvrObj::m_hmenuShared [private]

Definition at line 35 of file Obj.h.

HOLEMENU CSimpSvrObj::m_hOleMenu [private]

Definition at line 36 of file Obj.h.

HWND CSimpSvrObj::m_hWndParent [private]

Definition at line 50 of file Obj.h.

LPOLEINPLACEUIWINDOW CSimpSvrObj::m_lpCntrDoc [private]

Definition at line 59 of file Obj.h.

LPSTREAM CSimpSvrObj::m_lpColorStm [private]

Definition at line 54 of file Obj.h.

LPDATAADVISEHOLDER CSimpSvrObj::m_lpDataAdviseHolder [private]

Definition at line 57 of file Obj.h.

CSimpSvrDoc FAR* CSimpSvrObj::m_lpDoc [private]

Definition at line 30 of file Obj.h.

LPOLEINPLACEFRAME CSimpSvrObj::m_lpFrame [private]

Definition at line 58 of file Obj.h.

LPOLEINPLACESITE CSimpSvrObj::m_lpIPSite [private]

Definition at line 60 of file Obj.h.

LPOLEADVISEHOLDER CSimpSvrObj::m_lpOleAdviseHolder [private]

Definition at line 56 of file Obj.h.

LPOLECLIENTSITE CSimpSvrObj::m_lpOleClientSite [private]

Definition at line 55 of file Obj.h.

LPSTREAM CSimpSvrObj::m_lpSizeStm [private]

Definition at line 54 of file Obj.h.

LPSTORAGE CSimpSvrObj::m_lpStorage [private]

Definition at line 53 of file Obj.h.

int CSimpSvrObj::m_nCount [private]

Definition at line 31 of file Obj.h.

COleInPlaceActiveObject CSimpSvrObj::m_OleInPlaceActiveObject [private]

Definition at line 66 of file Obj.h.

COleInPlaceObject CSimpSvrObj::m_OleInPlaceObject [private]

Definition at line 67 of file Obj.h.

COleObject CSimpSvrObj::m_OleObject [private]

Definition at line 63 of file Obj.h.

CPersistStorage CSimpSvrObj::m_PersistStorage [private]

Definition at line 64 of file Obj.h.

RECT CSimpSvrObj::m_posRect [private]

Definition at line 37 of file Obj.h.

int CSimpSvrObj::m_red [private]

Definition at line 44 of file Obj.h.

float CSimpSvrObj::m_scale [private]

Definition at line 48 of file Obj.h.

POINT CSimpSvrObj::m_size [private]

Definition at line 45 of file Obj.h.

int CSimpSvrObj::m_xOffset [private]

Definition at line 46 of file Obj.h.

int CSimpSvrObj::m_yOffset [private]

Definition at line 47 of file Obj.h.

The documentation for this class was generated from the following files:
  • Com/Fundamentals/SimpSvr/Obj.h
  • Com/Fundamentals/SimpSvr/Obj.Cpp
Generated on Wed Nov 13 2024 16:57:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSite Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Private Attributes

CSite Class Reference

#include "Site.h"

Inherits com::ms::com::IUnknown.

List of all members.

Public Member Functions

CSite (DWORD, HWND, CFrame *)
~CSite (void)
void | Activate (LONG)
void | Close (BOOL)
BOOL | Create (LPTSTR, IStorage *)
BOOL | CreateStorage (IStorage *)
void | Destroy (IStorage *)
STDMETHODIMP | QueryInterface (REFIID, void **)
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) AddRef(void)
void | Update (void)
void | UpdateObjectRects (void)

Protected Member Functions

BOOL | ObjectInitialize (LPUNKNOWN)

Private Attributes

friend | CImpIAdviseSink
friend | CImpIOleClientSite
friend | CImpIOleDocumentSite
friend | CImpIOleInPlaceSite
ULONG m_cRef
DWORD m_dwID
BOOL m_fDocObj
BOOL m_fInitialized
HWND | m_hWnd
class CFrame * | m_pFR
PCImpIAdviseSink m_pImpIAdviseSink
PCImpIOleClientSite m_pImpIOleClientSite
PCImpIOleDocumentSite m_pImpIOleDocumentSite
PCImpIOleInPlaceSite m_pImpIOleIPSite
IOleDocumentView * | m_pIOleDocView
IOleInPlaceObject * | m_pIOleIPObject
IOleObject * | m_pIOleObject
LPSTORAGE | m_pIStorage
LPSTREAM | m_pIStream
IUnknown * | m_pObj

Detailed Description

Definition at line 144 of file Site.h.

Constructor & Destructor Documentation

CSite::CSite | ( | DWORD | ,
 |  | HWND | ,
 |  | CFrame * |
 | ) |  |
CSite::~CSite ( void )

Definition at line 63 of file Site.Cpp.

    {
    //Object pointers cleaned up in Close.

    //We delete our own interfaces since we control them
    DeleteInterfaceImp(m_pImpIOleDocumentSite);
    DeleteInterfaceImp(m_pImpIOleIPSite);
    DeleteInterfaceImp(m_pImpIAdviseSink);
    DeleteInterfaceImp(m_pImpIOleClientSite);
    return;
    }

Member Function Documentation

void CSite::Activate ( LONG iVerb )

Definition at line 452 of file Site.Cpp.

    {
    CHourglass *pHour;
    RECT        rc;

    pHour=new CHourglass;

    GetClientRect(m_hWnd, &rc);
    m_pIOleObject->DoVerb(iVerb, NULL, m_pImpIOleClientSite, 0
        , m_hWnd, &rc);

    delete pHour;
    return;
    }

void CSite::Close ( BOOL fCommit )

Definition at line 341 of file Site.Cpp.

    {
    //OnInPlaceDeactivate releases this pointer.
    if (NULL!=m_pIOleIPObject)
        m_pIOleIPObject->InPlaceDeactivate();

    ReleaseInterface(m_pIOleDocView);

    if (NULL!=m_pIOleObject)
        {
        m_pIOleObject->Close(fCommit
            ? OLECLOSE_SAVEIFDIRTY : OLECLOSE_NOSAVE);
        ReleaseInterface(m_pIOleObject);
        }

    ReleaseInterface(m_pObj);
  ReleaseInterface(m_pIStream);
    ReleaseInterface(m_pIStorage);

    return;
    }

BOOL CSite::Create | ( | LPTSTR | pszFile,
 |  | IStorage * | pIStorage
 | ) |  |

Definition at line 156 of file Site.Cpp.

    {
    HRESULT             hr=E_FAIL;
    LPUNKNOWN           pObj;

    //Create a new storage for this object (sets m_pIStorage)
    if (!CreateStorage(pIStorage))
        return FALSE;

    //Now create an object from the file
   #ifdef UNICODE
    hr=OleCreateFromFile(CLSID_NULL, pszFile, IID_IUnknown
        , OLERENDER_NONE, NULL, NULL, m_pIStorage, (void **)&pObj);
   #else
    OLECHAR     szFile[512];    //Assumption on string length

    MultiByteToWideChar(CP_ACP, 0, pszFile, -1, szFile, 512);
  hr=OleCreateFromFile(CLSID_NULL, szFile, IID_IUnknown
        , OLERENDER_NONE, NULL, NULL, m_pIStorage, (void **)&pObj);
   #endif

    //If creation didn't work, get rid of the element Open created.
    if (FAILED(hr))
        {
        Destroy(pIStorage);
        return FALSE;
        }

    //We don't get the size if PatronObject data was seen already.
    if (!ObjectInitialize(pObj))
        {
        Destroy(pIStorage);
        return FALSE;
        }

    m_fInitialized=TRUE;
    return TRUE;
    }

BOOL CSite::CreateStorage ( IStorage * pIStorage )

Definition at line 266 of file Site.Cpp.

    {
    HRESULT     hr;
    DWORD       dwMode=STGM_TRANSACTED | STGM_READWRITE
                    | STGM_SHARE_EXCLUSIVE;
    TCHAR       szName[32];

    if (NULL==pIStorage)
        return FALSE;

    /*
     * Attempt to open the storage under this ID.  If there is
     * none, then create it.  In either case we end up with an
     * IStorage that we either save in pPage or release.
     */
    wsprintf(szName, TEXT("Site %lu"), m_dwID);

   #ifdef UNICODE
    hr=pIStorage->CreateStorage(szName, dwMode, 0, 0, &m_pIStorage);
   #else
    OLECHAR  szwName[32];
  MultiByteToWideChar(CP_ACP, 0, szName, -1, szwName, 32);
    hr=pIStorage->CreateStorage(szwName, dwMode, 0, 0, &m_pIStorage);
   #endif

    if (FAILED(hr))
        return FALSE;

  //Create stream for the object; name is irrelevant
  dwMode=STGM_DIRECT | STGM_READWRITE | STGM_SHARE_EXCLUSIVE;
   #ifdef UNICODE
    hr=m_pIStorage->CreateStream(TEXT("\003DocObjInfo"), dwMode, 0, 0
        , &m_pIStream);
   #else
  MultiByteToWideChar(CP_ACP, 0, "\003DocObjInfo", -1, szwName, 32);
    hr=m_pIStorage->CreateStream(szwName, dwMode, 0, 0, &m_pIStream);
   #endif

    //If we failed to create a stream in the file, do it in memory
  if (FAILED(hr))
    {
    if (FAILED(CreateStreamOnHGlobal(NULL, TRUE, &m_pIStream)))
        return FALSE;
    }

    //Create interface implementations
    m_pImpIOleClientSite=new CImpIOleClientSite(this, this);
    m_pImpIAdviseSink=new CImpIAdviseSink(this, this);
    m_pImpIOleIPSite=new CImpIOleInPlaceSite(this, this);
    m_pImpIOleDocumentSite=new CImpIOleDocumentSite(this, this);

    if (NULL==m_pImpIOleClientSite || NULL==m_pImpIAdviseSink
        || NULL==m_pImpIOleIPSite || NULL==m_pImpIOleDocumentSite)
        return FALSE;

    return TRUE;
    }

void CSite::Destroy ( IStorage * pIStorage )

Definition at line 414 of file Site.Cpp.

    {
    TCHAR     szName[32];

    if (NULL==pIStorage)
        return;

    if (NULL!=m_pObj)
        Close(FALSE);

  wsprintf(szName, TEXT("Site %lu"), m_dwID);
   #ifdef UNICODE
    pIStorage->DestroyElement(szName);
   #else
    OLECHAR  szwName[32];
  MultiByteToWideChar(CP_ACP, 0, szName, -1, szwName, 32);
  pIStorage->DestroyElement(szwName);
   #endif
    return;
    }

BOOL CSite::ObjectInitialize ( LPUNKNOWN pObj ) [protected]

Definition at line 218 of file Site.Cpp.

    {
    HRESULT         hr;
    DWORD           dw;

    if (NULL==pObj)
        return FALSE;

    m_pObj=pObj;

    //We need an IOleObject most of the time, so get one here.
    m_pIOleObject=NULL;
    hr=pObj->QueryInterface(IID_IOleObject, (void **)&m_pIOleObject);

    /*
     * Follow up object creation with advises and so forth.  If
     * we cannot get IOleObject here, then we know we can't do
     * any IOleObject actions from here on--object is static.
     */
    if (FAILED(hr))
        return TRUE;

    //SetClientSite is critical for DocObjects
    m_pIOleObject->SetClientSite(m_pImpIOleClientSite);
    m_pIOleObject->Advise(m_pImpIAdviseSink, &dw);

  //This is to give PowerPoint a chance to initialize itself earlier
  OleRun(m_pIOleObject);
    return TRUE;
    }

STDMETHODIMP CSite::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppv
 | ) |  |

Definition at line 87 of file Site.Cpp.

    {
    *ppv=NULL;

    if (IID_IUnknown==riid)
        *ppv=this;

    if (IID_IOleClientSite==riid)
        *ppv=m_pImpIOleClientSite;

    if (IID_IAdviseSink==riid)
        *ppv=m_pImpIAdviseSink;

    if (IID_IOleWindow==riid || IID_IOleInPlaceSite==riid)
        *ppv=m_pImpIOleIPSite;

    if (IID_IOleDocumentSite==riid)
        *ppv=m_pImpIOleDocumentSite;

    if (NULL!=*ppv)
        {
        ((LPUNKNOWN)*ppv)->AddRef();
        return NOERROR;
        }

    return ResultFromScode(E_NOINTERFACE);
    }

CSite::STDMETHODIMP_ ( ULONG )
CSite::STDMETHODIMP_ ( ULONG )
void CSite::Update ( void )

Definition at line 379 of file Site.Cpp.

    {
    LPPERSISTSTORAGE    pIPS;

    if (NULL!=m_pIStorage)
        return;

    m_pObj->QueryInterface(IID_IPersistStorage, (void **)&pIPS);
    OleSave(pIPS, m_pIStorage, TRUE);
    pIPS->SaveCompleted(NULL);
    pIPS->Release();

    m_pIStorage->Commit(STGC_DEFAULT);
    return;
    }

void CSite::UpdateObjectRects ( void )

Definition at line 484 of file Site.Cpp.

    {
    RECT    rc;

    if (NULL==m_pIOleDocView)
        return;

    GetClientRect(m_hWnd, &rc);
    m_pIOleDocView->SetRect(&rc);
    return;
    }

Member Data Documentation

friend CSite::CImpIAdviseSink [private]

Definition at line 147 of file Site.h.

friend CSite::CImpIOleClientSite [private]

Definition at line 146 of file Site.h.

friend CSite::CImpIOleDocumentSite [private]

Definition at line 149 of file Site.h.

friend CSite::CImpIOleInPlaceSite [private]

Definition at line 148 of file Site.h.

ULONG CSite::m_cRef [private]

Definition at line 152 of file Site.h.

DWORD CSite::m_dwID [private]

Definition at line 153 of file Site.h.

BOOL CSite::m_fDocObj [private]

Definition at line 168 of file Site.h.

BOOL CSite::m_fInitialized [private]

Definition at line 158 of file Site.h.

HWND CSite::m_hWnd [private]

Definition at line 154 of file Site.h.

class CFrame* CSite::m_pFR [private]

Definition at line 156 of file Site.h.

PCImpIAdviseSink CSite::m_pImpIAdviseSink [private]

Definition at line 172 of file Site.h.

PCImpIOleClientSite CSite::m_pImpIOleClientSite [private]

Definition at line 171 of file Site.h.

PCImpIOleDocumentSite CSite::m_pImpIOleDocumentSite [private]

Definition at line 174 of file Site.h.

PCImpIOleInPlaceSite CSite::m_pImpIOleIPSite [private]

Definition at line 173 of file Site.h.

IOleDocumentView* CSite::m_pIOleDocView [private]

Definition at line 166 of file Site.h.

IOleInPlaceObject* CSite::m_pIOleIPObject [private]

Definition at line 165 of file Site.h.

IOleObject* CSite::m_pIOleObject [private]

Definition at line 164 of file Site.h.

LPSTORAGE CSite::m_pIStorage [private]

Definition at line 159 of file Site.h.

LPSTREAM CSite::m_pIStream [private]

Definition at line 160 of file Site.h.

IUnknown* CSite::m_pObj [private]

Definition at line 163 of file Site.h.

The documentation for this class was generated from the following files:
  • Com/Fundamentals/ActiveDocument/Framer/Site.h
  • Com/Fundamentals/ActiveDocument/Framer/Site.Cpp
Generated on Wed Nov 13 2024 16:57:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSkateboard Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes | Static Private Attributes

CSkateboard Class Reference

#include "people.h"

Inherits CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, and CDelegationBase.

List of all members.

Public Member Functions

CSkateboard (int i)
CSkateboard (int i)
CSkateboard (int i)
CSkateboard (int i)
CSkateboard (int i)
CSkateboard (int i)
CSkateboard (int i)
CSkateboard (int i)
CSkateboard (int i)
CSkateboard (int i)
CSkateboard (int i)
CSkateboard (int i)
virtual | ~CSkateboard ()
virtual | ~CSkateboard ()
virtual | ~CSkateboard ()
virtual | ~CSkateboard ()
virtual | ~CSkateboard ()
virtual | ~CSkateboard ()
virtual | ~CSkateboard ()
virtual | ~CSkateboard ()
virtual | ~CSkateboard ()
virtual | ~CSkateboard ()
virtual | ~CSkateboard ()
virtual | ~CSkateboard ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()

Private Attributes

int | id

Static Private Attributes

static const GUID | thisGuid = { 0xef163735, 0x9353, 0x11d2, { 0x99, 0x67, 0x0, 0x80, 0xc7, 0xdc, 0xb3, 0xdc } }

Detailed Description

Definition at line 62 of file people.h.

Constructor & Destructor Documentation

CSkateboard::CSkateboard ( int i ) [inline]

Definition at line 64 of file people.h.

: id(i) { }

virtual CSkateboard::~CSkateboard ( ) [inline, virtual]

Definition at line 65 of file people.h.

{}

CSkateboard::CSkateboard ( int i ) [inline]

Definition at line 68 of file people.h.

: id(i) { }

virtual CSkateboard::~CSkateboard ( ) [inline, virtual]

Definition at line 69 of file people.h.

{}

CSkateboard::CSkateboard ( int i ) [inline]

Definition at line 64 of file people.h.

: id(i) { }

virtual CSkateboard::~CSkateboard ( ) [inline, virtual]

Definition at line 65 of file people.h.

{}

CSkateboard::CSkateboard ( int i ) [inline]

Definition at line 64 of file people.h.

: id(i) { }

virtual CSkateboard::~CSkateboard ( ) [inline, virtual]

Definition at line 65 of file people.h.

{}

CSkateboard::CSkateboard ( int i ) [inline]

Definition at line 64 of file people.h.

: id(i) { }

virtual CSkateboard::~CSkateboard ( ) [inline, virtual]

Definition at line 65 of file people.h.

{}

CSkateboard::CSkateboard ( int i ) [inline]

Definition at line 64 of file people.h.

: id(i) { }

virtual CSkateboard::~CSkateboard ( ) [inline, virtual]

Definition at line 65 of file people.h.

{}

CSkateboard::CSkateboard ( int i ) [inline]

Definition at line 64 of file people.h.

: id(i) { }

virtual CSkateboard::~CSkateboard ( ) [inline, virtual]

Definition at line 65 of file people.h.

{}

CSkateboard::CSkateboard ( int i ) [inline]

Definition at line 64 of file people.h.

: id(i) { }

virtual CSkateboard::~CSkateboard ( ) [inline, virtual]

Definition at line 65 of file people.h.

{}

CSkateboard::CSkateboard ( int i ) [inline]

Definition at line 64 of file people.h.

: id(i) { }

virtual CSkateboard::~CSkateboard ( ) [inline, virtual]

Definition at line 65 of file people.h.

{}

CSkateboard::CSkateboard ( int i ) [inline]

Definition at line 74 of file people.h.

: id(i) { }

virtual CSkateboard::~CSkateboard ( ) [inline, virtual]

Definition at line 75 of file people.h.

{}

CSkateboard::CSkateboard ( int i ) [inline]

Definition at line 64 of file people.h.

: id(i) { }

virtual CSkateboard::~CSkateboard ( ) [inline, virtual]

Definition at line 65 of file people.h.

{}

CSkateboard::CSkateboard ( int i ) [inline]

Definition at line 141 of file people.h.

: id(i) { }

virtual CSkateboard::~CSkateboard ( ) [inline, virtual]

Definition at line 142 of file people.h.

{}

Member Function Documentation

virtual const int CSkateboard::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 69 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CSkateboard::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 69 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CSkateboard::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 69 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CSkateboard::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 69 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CSkateboard::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 146 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CSkateboard::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 69 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CSkateboard::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 73 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CSkateboard::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 69 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CSkateboard::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 69 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CSkateboard::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 69 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CSkateboard::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 69 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CSkateboard::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 79 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const _TCHAR* CSkateboard::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

virtual const _TCHAR* CSkateboard::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

virtual const _TCHAR* CSkateboard::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

virtual const _TCHAR* CSkateboard::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

virtual const _TCHAR* CSkateboard::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

virtual const _TCHAR* CSkateboard::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

virtual const _TCHAR* CSkateboard::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

const _TCHAR * CSkateboard::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

Definition at line 287 of file people.Cpp.

{
    static _TCHAR buf[128];

    _stprintf(buf, _T("Skateboard #%d"), id);

    return buf;
}

virtual const _TCHAR* CSkateboard::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

virtual const _TCHAR* CSkateboard::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

virtual const _TCHAR* CSkateboard::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

virtual const _TCHAR* CSkateboard::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

virtual const GUID& CSkateboard::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 145 of file people.h.

{ return thisGuid; }

virtual const GUID& CSkateboard::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 68 of file people.h.

{ return thisGuid; }

virtual const GUID& CSkateboard::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 68 of file people.h.

{ return thisGuid; }

virtual const GUID& CSkateboard::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 68 of file people.h.

{ return thisGuid; }

virtual const GUID& CSkateboard::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 78 of file people.h.

{ return thisGuid; }

virtual const GUID& CSkateboard::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 68 of file people.h.

{ return thisGuid; }

virtual const GUID& CSkateboard::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 68 of file people.h.

{ return thisGuid; }

virtual const GUID& CSkateboard::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 68 of file people.h.

{ return thisGuid; }

virtual const GUID& CSkateboard::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 72 of file people.h.

{ return thisGuid; }

virtual const GUID& CSkateboard::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 68 of file people.h.

{ return thisGuid; }

virtual const GUID& CSkateboard::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 68 of file people.h.

{ return thisGuid; }

virtual const GUID& CSkateboard::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 68 of file people.h.

{ return thisGuid; }

Member Data Documentation

int CSkateboard::id [private]

Definition at line 75 of file people.h.

static const GUID CSkateboard::thisGuid = { 0xef163735, 0x9353, 0x11d2, { 0x99, 0x67, 0x0, 0x80, 0xc7, 0xdc, 0xb3, 0xdc } } [static, private]

Reimplemented from CDelegationBase.

Definition at line 73 of file people.h.

The documentation for this class was generated from the following files:
  • SysMgmt/MMC/CMenu/people.h
  • SysMgmt/MMC/Complete/people.h
  • SysMgmt/MMC/CutCopy/people.h
  • SysMgmt/MMC/Extens/people.h
  • SysMgmt/MMC/Menubtn/people.h
  • SysMgmt/MMC/Multisel/people.h
  • SysMgmt/MMC/Nodes/people.h
  • SysMgmt/MMC/Openserv/people.h
  • SysMgmt/MMC/Proppage/people.h
  • SysMgmt/MMC/Taskpads/people.h
  • SysMgmt/MMC/Toolbar/people.h
  • SysMgmt/MMC/WMI/people.h
  • SysMgmt/MMC/CMenu/people.Cpp
  • SysMgmt/MMC/Complete/people.Cpp
  • SysMgmt/MMC/CutCopy/people.Cpp
  • SysMgmt/MMC/Extens/people.Cpp
  • SysMgmt/MMC/Menubtn/people.Cpp
  • SysMgmt/MMC/Multisel/people.Cpp
  • SysMgmt/MMC/Nodes/people.Cpp
  • SysMgmt/MMC/Openserv/people.Cpp
  • SysMgmt/MMC/Proppage/people.Cpp
  • SysMgmt/MMC/Taskpads/people.Cpp
  • SysMgmt/MMC/Toolbar/people.Cpp
  • SysMgmt/MMC/WMI/people.Cpp
Generated on Wed Nov 13 2024 16:57:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSkateboardFolder Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Types | Private Attributes | Static Private Attributes

CSkateboardFolder Class Reference

#include "people.h"

Inherits CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, and CDelegationBase.

List of all members.

Public Member Functions

CSkateboardFolder ()
CSkateboardFolder ()
CSkateboardFolder ()
CSkateboardFolder ()
CSkateboardFolder ()
CSkateboardFolder ()
CSkateboardFolder ()
CSkateboardFolder ()
CSkateboardFolder ()
CSkateboardFolder ()
CSkateboardFolder ()
CSkateboardFolder ()
virtual | ~CSkateboardFolder ()
virtual | ~CSkateboardFolder ()
virtual | ~CSkateboardFolder ()
virtual | ~CSkateboardFolder ()
virtual | ~CSkateboardFolder ()
virtual | ~CSkateboardFolder ()
virtual | ~CSkateboardFolder ()
virtual | ~CSkateboardFolder ()
virtual | ~CSkateboardFolder ()
virtual | ~CSkateboardFolder ()
virtual | ~CSkateboardFolder ()
virtual | ~CSkateboardFolder ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual HRESULT | GetListpadInfo (MMC_LISTPAD_INFO *lpListPadInfo)
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual HSCOPEITEM | GetParentScopeItem ()
virtual HRESULT | GetResultViewType (LPOLESTR *ppViewType, long *pViewOptions)
virtual MMC_TASK * | GetTaskList (LPOLESTR szTaskGroup, LONG *nCount)
virtual HRESULT | GetTaskpadBackground (MMC_TASK_DISPLAY_OBJECT *pTDO)
virtual HRESULT | GetTaskpadDescription (LPOLESTR *pszDescription)
virtual HRESULT | GetTaskpadTitle (LPOLESTR *pszTitle)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual void | SetScopeItemValue (HSCOPEITEM hscopeitem)
virtual HRESULT | TaskNotify (IConsole *pConsole, VARIANT *v1, VARIANT *v2)

Private Types

enum | { NUMBER_OF_CHILDREN = 20 }
enum | { NUMBER_OF_CHILDREN = 20 }
enum | { NUMBER_OF_CHILDREN = 20 }
enum | { NUMBER_OF_CHILDREN = 20 }
enum | { NUMBER_OF_CHILDREN = 20 }
enum | { NUMBER_OF_CHILDREN = 20 }
enum | { NUMBER_OF_CHILDREN = 20 }
enum | { NUMBER_OF_CHILDREN = 20 }
enum | { NUMBER_OF_CHILDREN = 20 }
enum | { NUMBER_OF_CHILDREN = 20 }
enum | { NUMBER_OF_CHILDREN = 20 }
enum | { NUMBER_OF_CHILDREN = 20 }

Private Attributes

CDelegationBase * | children [NUMBER_OF_CHILDREN]
HSCOPEITEM | m_hParentHScopeItem

Static Private Attributes

static const GUID | thisGuid = { 0xef163733, 0x9353, 0x11d2, { 0x99, 0x67, 0x0, 0x80, 0xc7, 0xdc, 0xb3, 0xdc } }

Detailed Description

Definition at line 78 of file people.h.

Member Enumeration Documentation

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 95 of file people.h.

{ NUMBER_OF_CHILDREN = 20 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 103 of file people.h.

{ NUMBER_OF_CHILDREN = 20 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 95 of file people.h.

{ NUMBER_OF_CHILDREN = 20 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 95 of file people.h.

{ NUMBER_OF_CHILDREN = 20 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 95 of file people.h.

{ NUMBER_OF_CHILDREN = 20 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 95 of file people.h.

{ NUMBER_OF_CHILDREN = 20 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 95 of file people.h.

{ NUMBER_OF_CHILDREN = 20 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 95 of file people.h.

{ NUMBER_OF_CHILDREN = 20 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 95 of file people.h.

{ NUMBER_OF_CHILDREN = 20 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 112 of file people.h.

{ NUMBER_OF_CHILDREN = 20 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 95 of file people.h.

{ NUMBER_OF_CHILDREN = 20 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 172 of file people.h.

{ NUMBER_OF_CHILDREN = 20 };

Constructor & Destructor Documentation

CSkateboardFolder::CSkateboardFolder ( )

Definition at line 213 of file people.Cpp.

{
    for (int n = 0; n < NUMBER_OF_CHILDREN; n++) {
        children[n] = new CSkateboard(n + 1);
    }
}

CSkateboardFolder::~CSkateboardFolder ( ) [virtual]

Definition at line 220 of file people.Cpp.

{
    for (int n = 0; n < NUMBER_OF_CHILDREN; n++)
        if (children[n]) {
            delete children[n];
        }
}

CSkateboardFolder::CSkateboardFolder ( )
virtual CSkateboardFolder::~CSkateboardFolder ( ) [virtual]
CSkateboardFolder::CSkateboardFolder ( )
virtual CSkateboardFolder::~CSkateboardFolder ( ) [virtual]
CSkateboardFolder::CSkateboardFolder ( )
virtual CSkateboardFolder::~CSkateboardFolder ( ) [virtual]
CSkateboardFolder::CSkateboardFolder ( )
virtual CSkateboardFolder::~CSkateboardFolder ( ) [virtual]
CSkateboardFolder::CSkateboardFolder ( )
virtual CSkateboardFolder::~CSkateboardFolder ( ) [virtual]
CSkateboardFolder::CSkateboardFolder ( )
virtual CSkateboardFolder::~CSkateboardFolder ( ) [virtual]
CSkateboardFolder::CSkateboardFolder ( )
virtual CSkateboardFolder::~CSkateboardFolder ( ) [virtual]
CSkateboardFolder::CSkateboardFolder ( )
virtual CSkateboardFolder::~CSkateboardFolder ( ) [virtual]
CSkateboardFolder::CSkateboardFolder ( )
virtual CSkateboardFolder::~CSkateboardFolder ( ) [virtual]
CSkateboardFolder::CSkateboardFolder ( )
virtual CSkateboardFolder::~CSkateboardFolder ( ) [virtual]
CSkateboardFolder::CSkateboardFolder ( )
virtual CSkateboardFolder::~CSkateboardFolder ( ) [virtual]

Member Function Documentation

virtual const int CSkateboardFolder::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 85 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CSkateboardFolder::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 85 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CSkateboardFolder::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 85 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CSkateboardFolder::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 85 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CSkateboardFolder::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 85 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CSkateboardFolder::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 95 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CSkateboardFolder::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 89 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CSkateboardFolder::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 85 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CSkateboardFolder::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 85 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CSkateboardFolder::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 85 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CSkateboardFolder::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 162 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const int CSkateboardFolder::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 85 of file people.h.

{ return INDEX_PEOPLEICON; }

virtual const _TCHAR* CSkateboardFolder::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 87 of file people.h.

{ return _T("Skateboards"); }

virtual const _TCHAR* CSkateboardFolder::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 83 of file people.h.

{ return _T("Skateboards"); }

virtual const _TCHAR* CSkateboardFolder::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 83 of file people.h.

{ return _T("Skateboards"); }

virtual const _TCHAR* CSkateboardFolder::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 93 of file people.h.

{ return _T("Skateboards (taskpad)"); }

virtual const _TCHAR* CSkateboardFolder::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 83 of file people.h.

{ return _T("Skateboards"); }

virtual const _TCHAR* CSkateboardFolder::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 83 of file people.h.

{ return _T("Skateboards"); }

virtual const _TCHAR* CSkateboardFolder::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 83 of file people.h.

{ return _T("Skateboards"); }

virtual const _TCHAR* CSkateboardFolder::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 160 of file people.h.

{ return _T("Skateboards"); }

virtual const _TCHAR* CSkateboardFolder::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 83 of file people.h.

{ return _T("Skateboards"); }

virtual const _TCHAR* CSkateboardFolder::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 83 of file people.h.

{ return _T("Skateboards"); }

virtual const _TCHAR* CSkateboardFolder::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 83 of file people.h.

{ return _T("Skateboards"); }

virtual const _TCHAR* CSkateboardFolder::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 83 of file people.h.

{ return _T("Skateboards"); }

HRESULT CSkateboardFolder::GetListpadInfo ( MMC_LISTPAD_INFO * lpListPadInfo ) [virtual]

Reimplemented from CDelegationBase.

Definition at line 689 of file people.Cpp.

{
        return S_FALSE;
}

virtual const GUID& CSkateboardFolder::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 84 of file people.h.

{ return thisGuid; }

virtual const GUID& CSkateboardFolder::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 84 of file people.h.

{ return thisGuid; }

virtual const GUID& CSkateboardFolder::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 88 of file people.h.

{ return thisGuid; }

virtual const GUID& CSkateboardFolder::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 84 of file people.h.

{ return thisGuid; }

virtual const GUID& CSkateboardFolder::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 161 of file people.h.

{ return thisGuid; }

virtual const GUID& CSkateboardFolder::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 94 of file people.h.

{ return thisGuid; }

virtual const GUID& CSkateboardFolder::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 84 of file people.h.

{ return thisGuid; }

virtual const GUID& CSkateboardFolder::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 84 of file people.h.

{ return thisGuid; }

virtual const GUID& CSkateboardFolder::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 84 of file people.h.

{ return thisGuid; }

virtual const GUID& CSkateboardFolder::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 84 of file people.h.

{ return thisGuid; }

virtual const GUID& CSkateboardFolder::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 84 of file people.h.

{ return thisGuid; }

virtual const GUID& CSkateboardFolder::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 84 of file people.h.

{ return thisGuid; }

virtual HSCOPEITEM CSkateboardFolder::GetParentScopeItem ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 91 of file people.h.

{ return m_hParentHScopeItem; }

HRESULT CSkateboardFolder::GetResultViewType | ( | LPOLESTR * | ppViewType,
 |  | long * | pViewOptions |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 616 of file people.Cpp.

{
  TCHAR taskpad[1024];
    TCHAR szThis[16];

    _ultot((unsigned long)this, szThis, 16);
  _tcscpy(taskpad, _T("default.htm#"));
    _tcscat(taskpad, szThis);
    MAKE_WIDEPTR_FROMTSTR_ALLOC(pszW, taskpad);

  *ppViewType = CreateResourcePath( NULL, pszW );

    *pViewOptions = MMC_VIEW_OPTIONS_NONE;
    return S_OK;
}

MMC_TASK * CSkateboardFolder::GetTaskList | ( | LPOLESTR | szTaskGroup,
 |  | LONG * | nCount |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 632 of file people.Cpp.

{
    *nCount = 4;

    _TCHAR buf[256];
    MMC_TASK *tasks = new MMC_TASK[*nCount];

    for (int t = 0; t < *nCount; t++) {
        tasks[t].sDisplayObject.eDisplayType = MMC_TASK_DISPLAY_TYPE_BITMAP;
        tasks[t].sDisplayObject.uBitmap.szMouseOverBitmap = CreateResourcePath(g_hinst, L"buttonover.bmp");
        tasks[t].sDisplayObject.uBitmap.szMouseOffBitmap = CreateResourcePath(g_hinst, L"buttonoff.bmp");

        _stprintf(buf, _T("Task #%d"), t);
        MAKE_WIDEPTR_FROMTSTR(wszText, buf);
        tasks[t].szText = OleDuplicateString(wszText);

        _stprintf(buf, _T("Click here to start task #%d"), t);
        MAKE_WIDEPTR_FROMTSTR(wszHelpString, buf);
        tasks[t].szHelpString = OleDuplicateString(wszHelpString);

        tasks[t].eActionType = MMC_ACTION_ID;
        tasks[t].nCommandID = t;
    }

    return tasks;
}

HRESULT CSkateboardFolder::GetTaskpadBackground ( MMC_TASK_DISPLAY_OBJECT * pTDO ) [virtual]

Reimplemented from CDelegationBase.

Definition at line 682 of file people.Cpp.

{
        pTDO->eDisplayType = MMC_TASK_DISPLAY_TYPE_BITMAP;
        pTDO->uBitmap.szMouseOverBitmap = CreateResourcePath(g_hinst, L"skateboard.bmp");
        return S_OK;
}

HRESULT CSkateboardFolder::GetTaskpadDescription ( LPOLESTR * pszDescription ) [virtual]

Reimplemented from CDelegationBase.

Definition at line 676 of file people.Cpp.

{
        *pszDescription = OleDuplicateString(L"This is a sample task pad for skateboard nodes");
        return S_OK;
}

HRESULT CSkateboardFolder::GetTaskpadTitle ( LPOLESTR * pszTitle ) [virtual]

Reimplemented from CDelegationBase.

Definition at line 670 of file people.Cpp.

{
        *pszTitle = OleDuplicateString(L"Skateboard Tasks");
        return S_OK;
}

HRESULT CSkateboardFolder::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 228 of file people.Cpp.

{
    HRESULT      hr = S_OK;

    IHeaderCtrl *pHeaderCtrl = NULL;
    IResultData *pResultData = NULL;

    if (bShow) {
        hr = pConsole->QueryInterface(IID_IHeaderCtrl, (void **)&pHeaderCtrl);
        _ASSERT( SUCCEEDED(hr) );

        hr = pConsole->QueryInterface(IID_IResultData, (void **)&pResultData);
        _ASSERT( SUCCEEDED(hr) );

        // Set the column headers in the results pane
        hr = pHeaderCtrl->InsertColumn( 0, L"Name                      ", 0, MMCLV_AUTO );
        _ASSERT( S_OK == hr );

        // insert items here
        RESULTDATAITEM rdi;

        hr = pResultData->DeleteAllRsltItems();
        _ASSERT( SUCCEEDED(hr) );

        if (!bExpanded) {
            // create the child nodes, then expand them
            for (int n = 0; n < NUMBER_OF_CHILDREN; n++) {
                ZeroMemory(&rdi, sizeof(RESULTDATAITEM) );
                rdi.mask       = RDI_STR       |   // Displayname is valid
                    RDI_IMAGE     |
                    RDI_PARAM;        // nImage is valid

                rdi.nImage      = children[n]->GetBitmapIndex();
                rdi.str         = MMC_CALLBACK;
                rdi.nCol        = 0;
                rdi.lParam      = (LPARAM)children[n];

                hr = pResultData->InsertItem( &rdi );

                _ASSERT( SUCCEEDED(hr) );
            }
        }

        pHeaderCtrl->Release();
        pResultData->Release();
    }

    return hr;
}

virtual HRESULT CSkateboardFolder::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CSkateboardFolder::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CSkateboardFolder::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CSkateboardFolder::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CSkateboardFolder::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CSkateboardFolder::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CSkateboardFolder::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CSkateboardFolder::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CSkateboardFolder::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CSkateboardFolder::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual void CSkateboardFolder::SetScopeItemValue ( HSCOPEITEM hscopeitem ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 90 of file people.h.

{ m_hParentHScopeItem = hscopeitem; }

HRESULT CSkateboardFolder::TaskNotify | ( | IConsole * | pConsole,
 |  | VARIANT * | v1,
 |  | VARIANT * | v2 |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 659 of file people.Cpp.

{
    _TCHAR buf[256];

    wsprintf(buf, _T("Skateboard task %ld has been selected."), v1->lVal);

    MessageBox(NULL, buf, _T("Task Notification"), MB_OK | MB_ICONINFORMATION);

    return S_OK;
}

Member Data Documentation

CDelegationBase * CSkateboardFolder::children [private]

Definition at line 96 of file people.h.

HSCOPEITEM CSkateboardFolder::m_hParentHScopeItem [private]

Definition at line 101 of file people.h.

static const GUID CSkateboardFolder::thisGuid = { 0xef163733, 0x9353, 0x11d2, { 0x99, 0x67, 0x0, 0x80, 0xc7, 0xdc, 0xb3, 0xdc } } [static, private]

Reimplemented from CDelegationBase.

Definition at line 93 of file people.h.

The documentation for this class was generated from the following files:
  • SysMgmt/MMC/CMenu/people.h
  • SysMgmt/MMC/Complete/people.h
  • SysMgmt/MMC/CutCopy/people.h
  • SysMgmt/MMC/Extens/people.h
  • SysMgmt/MMC/Menubtn/people.h
  • SysMgmt/MMC/Multisel/people.h
  • SysMgmt/MMC/Nodes/people.h
  • SysMgmt/MMC/Openserv/people.h
  • SysMgmt/MMC/Proppage/people.h
  • SysMgmt/MMC/Taskpads/people.h
  • SysMgmt/MMC/Toolbar/people.h
  • SysMgmt/MMC/WMI/people.h
  • SysMgmt/MMC/CMenu/people.Cpp
  • SysMgmt/MMC/Complete/people.Cpp
  • SysMgmt/MMC/CutCopy/people.Cpp
  • SysMgmt/MMC/Extens/people.Cpp
  • SysMgmt/MMC/Menubtn/people.Cpp
  • SysMgmt/MMC/Multisel/people.Cpp
  • SysMgmt/MMC/Nodes/people.Cpp
  • SysMgmt/MMC/Openserv/people.Cpp
  • SysMgmt/MMC/Proppage/people.Cpp
  • SysMgmt/MMC/Taskpads/people.Cpp
  • SysMgmt/MMC/Toolbar/people.Cpp
  • SysMgmt/MMC/WMI/people.Cpp
Generated on Wed Nov 13 2024 16:57:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSkyBasedVehicle Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Types | Private Attributes | Static Private Attributes

CSkyBasedVehicle Class Reference

#include "sky.h"

Inherits CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, and CDelegationBase.

List of all members.

Public Member Functions

CSkyBasedVehicle (CComponentData *pComponentData=NULL)
CSkyBasedVehicle ()
CSkyBasedVehicle ()
CSkyBasedVehicle (CComponentData *pComponentData=NULL)
CSkyBasedVehicle ()
CSkyBasedVehicle ()
CSkyBasedVehicle ()
CSkyBasedVehicle ()
CSkyBasedVehicle ()
CSkyBasedVehicle ()
CSkyBasedVehicle ()
CSkyBasedVehicle ()
CSkyBasedVehicle ()
virtual | ~CSkyBasedVehicle ()
virtual | ~CSkyBasedVehicle ()
virtual | ~CSkyBasedVehicle ()
virtual | ~CSkyBasedVehicle ()
virtual | ~CSkyBasedVehicle ()
virtual | ~CSkyBasedVehicle ()
virtual | ~CSkyBasedVehicle ()
virtual | ~CSkyBasedVehicle ()
virtual | ~CSkyBasedVehicle ()
virtual | ~CSkyBasedVehicle ()
virtual | ~CSkyBasedVehicle ()
virtual | ~CSkyBasedVehicle ()
virtual | ~CSkyBasedVehicle ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual HSCOPEITEM | GetParentScopeItem ()
virtual HRESULT | GetResultViewType (LPOLESTR *ppViewType, long *pViewOptions)
virtual HRESULT | GetResultViewType (LPOLESTR *ppViewType, long *pViewOptions)
virtual HRESULT | GetResultViewType (LPOLESTR *ppViewType, long *pViewOptions)
virtual HRESULT | OnAddMenuItems (IContextMenuCallback *pContextMenuCallback, long *pInsertionsAllowed)
virtual HRESULT | OnMenuCommand (IConsole *pConsole, long lCommandID)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual void | SetScopeItemValue (HSCOPEITEM hscopeitem)

Private Types

enum | { IDM_NEW_SKY = 3 }
enum | { IDM_NEW_SKY = 3 }
enum | { IDM_NEW_SKY = 3 }
enum | { IDM_NEW_SKY = 3 }
enum | { IDM_NEW_SKY = 3 }
enum | { IDM_NEW_SKY = 3 }
enum | { IDM_NEW_SKY = 3 }
enum | { IDM_NEW_SKY = 3 }
enum | { IDM_NEW_SKY = 3 }
enum | { IDM_NEW_SKY = 3 }
enum | { IDM_NEW_SKY = 3 }
enum | { IDM_NEW_SKY = 3 }
enum | { IDM_NEW_SKY = 3 }

Private Attributes

HSCOPEITEM | m_hParentHScopeItem

Static Private Attributes

static const GUID | thisGuid = { 0x2974380f, 0x4c4b, 0x11d2, { 0x89, 0xd8, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28 } }

Detailed Description

Definition at line 26 of file sky.h.

Member Enumeration Documentation

anonymous enum [private]
Enumerator:
IDM_NEW_SKY

Definition at line 38 of file sky.h.

{ IDM_NEW_SKY = 3 };

anonymous enum [private]
Enumerator:
IDM_NEW_SKY

Definition at line 41 of file sky.h.

{ IDM_NEW_SKY = 3 };

anonymous enum [private]
Enumerator:
IDM_NEW_SKY

Definition at line 39 of file sky.h.

{ IDM_NEW_SKY = 3 };

anonymous enum [private]
Enumerator:
IDM_NEW_SKY

Definition at line 40 of file sky.h.

{ IDM_NEW_SKY = 3 };

anonymous enum [private]
Enumerator:
IDM_NEW_SKY

Definition at line 36 of file sky.h.

{ IDM_NEW_SKY = 3 };

anonymous enum [private]
Enumerator:
IDM_NEW_SKY

Definition at line 39 of file sky.h.

{ IDM_NEW_SKY = 3 };

anonymous enum [private]
Enumerator:
IDM_NEW_SKY

Definition at line 40 of file sky.h.

{ IDM_NEW_SKY = 3 };

anonymous enum [private]
Enumerator:
IDM_NEW_SKY

Definition at line 40 of file sky.h.

{ IDM_NEW_SKY = 3 };

anonymous enum [private]
Enumerator:
IDM_NEW_SKY

Definition at line 36 of file sky.h.

{ IDM_NEW_SKY = 3 };

anonymous enum [private]
Enumerator:
IDM_NEW_SKY

Definition at line 36 of file sky.h.

{ IDM_NEW_SKY = 3 };

anonymous enum [private]
Enumerator:
IDM_NEW_SKY

Definition at line 36 of file sky.h.

{ IDM_NEW_SKY = 3 };

anonymous enum [private]
Enumerator:
IDM_NEW_SKY

Definition at line 40 of file sky.h.

{ IDM_NEW_SKY = 3 };

anonymous enum [private]
Enumerator:
IDM_NEW_SKY

Definition at line 36 of file sky.h.

{ IDM_NEW_SKY = 3 };

Constructor & Destructor Documentation

CSkyBasedVehicle::CSkyBasedVehicle ( CComponentData * pComponentData = NULL ) [inline]

Definition at line 28 of file sky.h.

    { m_pComponentData = pComponentData;  }

virtual CSkyBasedVehicle::~CSkyBasedVehicle ( ) [inline, virtual]

Definition at line 31 of file sky.h.

{}

CSkyBasedVehicle::CSkyBasedVehicle ( ) [inline]

Definition at line 27 of file sky.h.

{ }

virtual CSkyBasedVehicle::~CSkyBasedVehicle ( ) [inline, virtual]

Definition at line 29 of file sky.h.

{}

CSkyBasedVehicle::CSkyBasedVehicle ( ) [inline]

Definition at line 27 of file sky.h.

{ }

virtual CSkyBasedVehicle::~CSkyBasedVehicle ( ) [inline, virtual]

Definition at line 29 of file sky.h.

{}

CSkyBasedVehicle::CSkyBasedVehicle ( ) [inline]

Definition at line 27 of file sky.h.

{ }

virtual CSkyBasedVehicle::~CSkyBasedVehicle ( ) [inline, virtual]

Definition at line 29 of file sky.h.

{}

CSkyBasedVehicle::CSkyBasedVehicle ( ) [inline]

Definition at line 27 of file sky.h.

{ }

virtual CSkyBasedVehicle::~CSkyBasedVehicle ( ) [inline, virtual]

Definition at line 29 of file sky.h.

{}

CSkyBasedVehicle::CSkyBasedVehicle ( ) [inline]

Definition at line 27 of file sky.h.

{ }

virtual CSkyBasedVehicle::~CSkyBasedVehicle ( ) [inline, virtual]

Definition at line 29 of file sky.h.

{}

CSkyBasedVehicle::CSkyBasedVehicle ( ) [inline]

Definition at line 27 of file sky.h.

{ }

virtual CSkyBasedVehicle::~CSkyBasedVehicle ( ) [inline, virtual]

Definition at line 29 of file sky.h.

{}

CSkyBasedVehicle::CSkyBasedVehicle ( ) [inline]

Definition at line 27 of file sky.h.

{ }

virtual CSkyBasedVehicle::~CSkyBasedVehicle ( ) [inline, virtual]

Definition at line 29 of file sky.h.

{}

CSkyBasedVehicle::CSkyBasedVehicle ( ) [inline]

Definition at line 27 of file sky.h.

{ }

virtual CSkyBasedVehicle::~CSkyBasedVehicle ( ) [inline, virtual]

Definition at line 29 of file sky.h.

{}

CSkyBasedVehicle::CSkyBasedVehicle ( ) [inline]

Definition at line 27 of file sky.h.

{ }

virtual CSkyBasedVehicle::~CSkyBasedVehicle ( ) [inline, virtual]

Definition at line 29 of file sky.h.

{}

CSkyBasedVehicle::CSkyBasedVehicle ( ) [inline]

Definition at line 27 of file sky.h.

{ }

virtual CSkyBasedVehicle::~CSkyBasedVehicle ( ) [inline, virtual]

Definition at line 29 of file sky.h.

{}

CSkyBasedVehicle::CSkyBasedVehicle ( CComponentData * pComponentData = NULL ) [inline]

Definition at line 27 of file sky.h.

    { m_pComponentData = pComponentData;  }

virtual CSkyBasedVehicle::~CSkyBasedVehicle ( ) [inline, virtual]

Definition at line 30 of file sky.h.

{}

CSkyBasedVehicle::CSkyBasedVehicle ( ) [inline]

Definition at line 27 of file sky.h.

{ }

virtual CSkyBasedVehicle::~CSkyBasedVehicle ( ) [inline, virtual]

Definition at line 29 of file sky.h.

{}

Member Function Documentation

virtual const int CSkyBasedVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 35 of file sky.h.

{ return INDEX_SKYICON; }

virtual const int CSkyBasedVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 33 of file sky.h.

{ return INDEX_SKYICON; }

virtual const int CSkyBasedVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 33 of file sky.h.

{ return INDEX_SKYICON; }

virtual const int CSkyBasedVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 33 of file sky.h.

{ return INDEX_SKYICON; }

virtual const int CSkyBasedVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 33 of file sky.h.

{ return INDEX_SKYICON; }

virtual const int CSkyBasedVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 33 of file sky.h.

{ return INDEX_SKYICON; }

virtual const int CSkyBasedVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 33 of file sky.h.

{ return INDEX_SKYICON; }

virtual const int CSkyBasedVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 33 of file sky.h.

{ return INDEX_SKYICON; }

virtual const int CSkyBasedVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 34 of file sky.h.

{ return INDEX_SKYICON; }

virtual const int CSkyBasedVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 33 of file sky.h.

{ return INDEX_SKYICON; }

virtual const int CSkyBasedVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 33 of file sky.h.

{ return INDEX_SKYICON; }

virtual const int CSkyBasedVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 33 of file sky.h.

{ return INDEX_SKYICON; }

virtual const int CSkyBasedVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 33 of file sky.h.

{ return INDEX_SKYICON; }

virtual const _TCHAR* CSkyBasedVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 31 of file sky.h.

{ return _T("Sky-based Vehicles"); }

virtual const _TCHAR* CSkyBasedVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 31 of file sky.h.

{ return _T("Sky-based Vehicles"); }

virtual const _TCHAR* CSkyBasedVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 31 of file sky.h.

{ return _T("Sky-based Vehicles"); }

virtual const _TCHAR* CSkyBasedVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 31 of file sky.h.

{ return _T("Sky-based Vehicles"); }

virtual const _TCHAR* CSkyBasedVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 31 of file sky.h.

{ return _T("Sky-based Vehicles"); }

virtual const _TCHAR* CSkyBasedVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 31 of file sky.h.

{ return _T("Sky-based Vehicles"); }

virtual const _TCHAR* CSkyBasedVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 31 of file sky.h.

{ return _T("Sky-based Vehicles"); }

virtual const _TCHAR* CSkyBasedVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 32 of file sky.h.

{ return _T("Sky-based Vehicles"); }

virtual const _TCHAR* CSkyBasedVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 31 of file sky.h.

{ return _T("Sky-based Vehicles"); }

virtual const _TCHAR* CSkyBasedVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 33 of file sky.h.

{ return _T("Sky-based Vehicles"); }

virtual const _TCHAR* CSkyBasedVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 31 of file sky.h.

{ return _T("Sky-based Vehicles"); }

virtual const _TCHAR* CSkyBasedVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 31 of file sky.h.

{ return _T("Sky-based Vehicles"); }

virtual const _TCHAR* CSkyBasedVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 31 of file sky.h.

{ return _T("Sky-based Vehicles"); }

virtual const GUID& CSkyBasedVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 32 of file sky.h.

{ return thisGuid; }

virtual const GUID& CSkyBasedVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 32 of file sky.h.

{ return thisGuid; }

virtual const GUID& CSkyBasedVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 32 of file sky.h.

{ return thisGuid; }

virtual const GUID& CSkyBasedVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 32 of file sky.h.

{ return thisGuid; }

virtual const GUID& CSkyBasedVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 32 of file sky.h.

{ return thisGuid; }

virtual const GUID& CSkyBasedVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 32 of file sky.h.

{ return thisGuid; }

virtual const GUID& CSkyBasedVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 32 of file sky.h.

{ return thisGuid; }

virtual const GUID& CSkyBasedVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 32 of file sky.h.

{ return thisGuid; }

virtual const GUID& CSkyBasedVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 32 of file sky.h.

{ return thisGuid; }

virtual const GUID& CSkyBasedVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 34 of file sky.h.

{ return thisGuid; }

virtual const GUID& CSkyBasedVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 33 of file sky.h.

{ return thisGuid; }

virtual const GUID& CSkyBasedVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 32 of file sky.h.

{ return thisGuid; }

virtual const GUID& CSkyBasedVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 32 of file sky.h.

{ return thisGuid; }

virtual HSCOPEITEM CSkyBasedVehicle::GetParentScopeItem ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 36 of file sky.h.

{ return m_hParentHScopeItem; }

virtual HRESULT CSkyBasedVehicle::GetResultViewType | ( | LPOLESTR * | ppViewType,
 |  | long * | pViewOptions |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

HRESULT CSkyBasedVehicle::GetResultViewType | ( | LPOLESTR * | ppViewType,
 |  | long * | pViewOptions |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 54 of file sky.Cpp.

{
    // error message control
  LPOLESTR lpOleStr = NULL;
  HRESULT hr = StringFromCLSID(CLSID_MessageView, &lpOleStr);
    *ppViewType = lpOleStr;

  return hr;
}

virtual HRESULT CSkyBasedVehicle::GetResultViewType | ( | LPOLESTR * | ppViewType,
 |  | long * | pViewOptions |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

HRESULT CSkyBasedVehicle::OnAddMenuItems | ( | IContextMenuCallback * | pContextMenuCallback,
 |  | long * | pInsertionsAllowed |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 29 of file sky.Cpp.

{
    HRESULT hr = S_OK;
    CONTEXTMENUITEM menuItemsNew[] =
    {
        {
            L"Sky based", L"Add a new sky based vehicle",
                IDM_NEW_SKY, CCM_INSERTIONPOINTID_PRIMARY_NEW, 0, CCM_SPECIAL_DEFAULT_ITEM
        },
        { NULL, NULL, 0, 0, 0 }
    };

    // Loop through and add each of the menu items
    if (*pInsertionsAllowed & CCM_INSERTIONALLOWED_NEW)
    {
        for (LPCONTEXTMENUITEM m = menuItemsNew; m->strName; m++)
        {
            hr = pContextMenuCallback->AddItem(m);

            if (FAILED(hr))
                break;
        }
    }

    return hr;
}

HRESULT CSkyBasedVehicle::OnMenuCommand | ( | IConsole * | pConsole,
 |  | long | lCommandID |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 56 of file sky.Cpp.

{
    switch (lCommandID)
    {
    case IDM_NEW_SKY:
        pConsole->MessageBox(L"This sample does not create a new item\nSee Complete sample for a demonstration", L"Menu Command", MB_OK|MB_ICONINFORMATION, NULL);
        break;
    }

    return S_OK;
}

virtual HRESULT CSkyBasedVehicle::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

HRESULT CSkyBasedVehicle::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 29 of file sky.Cpp.

{
  HRESULT hr;
  IUnknown *pUnk = NULL;
  IMessageView *pMessageView = NULL;

  hr = pConsole->QueryResultView(&pUnk);

  if (SUCCEEDED(hr)) {
    hr = pUnk->QueryInterface(IID_IMessageView, (void **)&pMessageView);

    if (SUCCEEDED(hr)) {
      pMessageView->SetIcon(Icon_Information);
      pMessageView->SetTitleText(L"Sky-based vehicles");
      pMessageView->SetBodyText(L"Sky-based vehicles have no child nodes.");

      pMessageView->Release();
    }

    pUnk->Release();
  }

  return S_FALSE;
}

virtual HRESULT CSkyBasedVehicle::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual void CSkyBasedVehicle::SetScopeItemValue ( HSCOPEITEM hscopeitem ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 35 of file sky.h.

{ m_hParentHScopeItem = hscopeitem; }

Member Data Documentation

HSCOPEITEM CSkyBasedVehicle::m_hParentHScopeItem [private]

Definition at line 41 of file sky.h.

static const GUID CSkyBasedVehicle::thisGuid = { 0x2974380f, 0x4c4b, 0x11d2, { 0x89, 0xd8, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28 } } [static, private]

Reimplemented from CDelegationBase.

Definition at line 41 of file sky.h.

The documentation for this class was generated from the following files:
  • SysMgmt/MMC/ActiveX/sky.h
  • SysMgmt/MMC/CMenu/sky.h
  • SysMgmt/MMC/Complete/sky.h
  • SysMgmt/MMC/CutCopy/sky.h
  • SysMgmt/MMC/Extens/sky.h
  • SysMgmt/MMC/Menubtn/sky.h
  • SysMgmt/MMC/Multisel/sky.h
  • SysMgmt/MMC/Nodes/sky.h
  • SysMgmt/MMC/Openserv/sky.h
  • SysMgmt/MMC/Proppage/sky.h
  • SysMgmt/MMC/Taskpads/sky.h
  • SysMgmt/MMC/Toolbar/sky.h
  • SysMgmt/MMC/WMI/sky.h
  • SysMgmt/MMC/ActiveX/sky.Cpp
  • SysMgmt/MMC/CMenu/sky.Cpp
  • SysMgmt/MMC/Complete/sky.Cpp
  • SysMgmt/MMC/CutCopy/sky.Cpp
  • SysMgmt/MMC/Extens/sky.Cpp
  • SysMgmt/MMC/Menubtn/sky.Cpp
  • SysMgmt/MMC/Multisel/sky.Cpp
  • SysMgmt/MMC/Nodes/sky.Cpp
  • SysMgmt/MMC/Openserv/sky.Cpp
  • SysMgmt/MMC/Proppage/sky.Cpp
  • SysMgmt/MMC/Taskpads/sky.Cpp
  • SysMgmt/MMC/Toolbar/sky.Cpp
  • SysMgmt/MMC/WMI/sky.Cpp
Generated on Wed Nov 13 2024 16:57:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSkyVehicle Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Types | Private Attributes | Static Private Attributes

CSkyVehicle Class Reference

#include "sky.h"

Inherits CDelegationBase.

List of all members.

Public Member Functions

CSkyVehicle (int i)
virtual | ~CSkyVehicle ()
virtual const int | GetBitmapIndex ()
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const GUID & | getNodeType ()
virtual HRESULT | OnAddMenuItems (IContextMenuCallback *pContextMenuCallback, long *pInsertionsAllowed)
virtual HRESULT | OnMenuCommand (IConsole *pConsole, long lCommandID)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)

Private Types

enum | { IDM_NEW_SKY = 2 }
enum | { NUMBER_OF_CHILDREN = 4 }

Private Attributes

CPlane * | children [NUMBER_OF_CHILDREN]
int | id

Static Private Attributes

static const GUID | thisGuid = { 0xbd518283, 0x6a2e, 0x11d3, {0x91, 0x54, 0x0, 0xc0, 0x4f, 0x65, 0xb3, 0xf9} }

Detailed Description

Definition at line 55 of file sky.h.

Member Enumeration Documentation

anonymous enum [private]
Enumerator:
IDM_NEW_SKY

Definition at line 70 of file sky.h.

{ IDM_NEW_SKY = 2 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 75 of file sky.h.

{ NUMBER_OF_CHILDREN = 4 };

Constructor & Destructor Documentation

CSkyVehicle::CSkyVehicle ( int i )

Definition at line 34 of file sky.Cpp.

                              : id(i)
{
    for (int n = 0; n < NUMBER_OF_CHILDREN; n++) {
        children[n] = new CPlane(_T("Extension Space Vehicle"), n+1, 500000, 265, 75000);
    }
}

virtual CSkyVehicle::~CSkyVehicle ( ) [inline, virtual]

Definition at line 58 of file sky.h.

{}

Member Function Documentation

virtual const int CSkyVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 66 of file sky.h.

{ return INDEX_SKYICON; }

const _TCHAR * CSkyVehicle::GetDisplayName ( int nCol = 0 ) [virtual]

Implements CDelegationBase.

Definition at line 41 of file sky.Cpp.

{
    static _TCHAR buf[128];

    _stprintf(buf, _T("Extension Planes"));

    return buf;
}

virtual const GUID& CSkyVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 65 of file sky.h.

{ return thisGuid; }

HRESULT CSkyVehicle::OnAddMenuItems | ( | IContextMenuCallback * | pContextMenuCallback,
 |  | long * | pInsertionsAllowed |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 50 of file sky.Cpp.

{
    HRESULT hr = S_OK;
    CONTEXTMENUITEM menuItemsNew[] =
    {
        {
            L"Menu item from extension", L"The NameExt sample adds this item",
                IDM_NEW_SKY, CCM_INSERTIONPOINTID_PRIMARY_NEW  , 0, CCM_SPECIAL_DEFAULT_ITEM
        },
        { NULL, NULL, 0, 0, 0 }
    };

    // Loop through and add each of the menu items
    if (*pInsertionsAllowed & CCM_INSERTIONALLOWED_NEW)
    {
        for (LPCONTEXTMENUITEM m = menuItemsNew; m->strName; m++)
        {
            hr = pContextMenuCallback->AddItem(m);

            if (FAILED(hr))
                break;
        }
    }

    return hr;
}

HRESULT CSkyVehicle::OnMenuCommand | ( | IConsole * | pConsole,
 |  | long | lCommandID |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 77 of file sky.Cpp.

{
    switch (lCommandID)
    {
    case IDM_NEW_SKY:
        pConsole->MessageBox(L"Menu item from namespace extension selected", L"Menu Command", MB_YESNO|MB_ICONQUESTION, NULL);
        break;
    }

    return S_OK;
}

HRESULT CSkyVehicle::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 89 of file sky.Cpp.

{
    HRESULT      hr = S_OK;

    IHeaderCtrl *pHeaderCtrl = NULL;
    IResultData *pResultData = NULL;

    if (bShow) {
        hr = pConsole->QueryInterface(IID_IHeaderCtrl, (void **)&pHeaderCtrl);
        _ASSERT( SUCCEEDED(hr) );

        hr = pConsole->QueryInterface(IID_IResultData, (void **)&pResultData);
        _ASSERT( SUCCEEDED(hr) );

        // Set the column headers in the results pane
        hr = pHeaderCtrl->InsertColumn( 0, L"Plane Class", 0, MMCLV_AUTO );
        _ASSERT( S_OK == hr );
        hr = pHeaderCtrl->InsertColumn( 1, L"Plane Weight", 0, MMCLV_AUTO );
        _ASSERT( S_OK == hr );
        hr = pHeaderCtrl->InsertColumn( 2, L"Plane Height", 0, MMCLV_AUTO );
        _ASSERT( S_OK == hr );
        hr = pHeaderCtrl->InsertColumn( 3, L"Plane Payload", 0, MMCLV_AUTO );
        _ASSERT( S_OK == hr );
        hr = pHeaderCtrl->InsertColumn( 4, L"Plane", 0, MMCLV_AUTO );
        _ASSERT( S_OK == hr );

        // insert items here
        RESULTDATAITEM rdi;

        hr = pResultData->DeleteAllRsltItems();
        _ASSERT( SUCCEEDED(hr) );

        if (!bExpanded) {
            // create the child nodes, then expand them
            for (int n = 0; n < NUMBER_OF_CHILDREN; n++) {
                ZeroMemory(&rdi, sizeof(RESULTDATAITEM) );
                rdi.mask       = RDI_STR       |   // Displayname is valid
                    RDI_IMAGE     |
                    RDI_PARAM;        // nImage is valid

                rdi.nImage      = children[n]->GetBitmapIndex();
                rdi.str         = MMC_CALLBACK;
                rdi.nCol        = 0;
                rdi.lParam      = (LPARAM)children[n];

                hr = pResultData->InsertItem( &rdi );

                _ASSERT( SUCCEEDED(hr) );
            }
        }

        pHeaderCtrl->Release();
        pResultData->Release();
    }

    return hr;
}

Member Data Documentation

CPlane* CSkyVehicle::children[NUMBER_OF_CHILDREN] [private]

Definition at line 76 of file sky.h.

int CSkyVehicle::id [private]

Definition at line 78 of file sky.h.

const GUID CSkyVehicle::thisGuid = { 0xbd518283, 0x6a2e, 0x11d3, {0x91, 0x54, 0x0, 0xc0, 0x4f, 0x65, 0xb3, 0xf9} } [static, private]

Reimplemented from CDelegationBase.

Definition at line 73 of file sky.h.

The documentation for this class was generated from the following files:
  • SysMgmt/MMC/Nameext/sky.h
  • SysMgmt/MMC/Nameext/sky.Cpp
Generated on Wed Nov 13 2024 16:57:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSmartComPtr< T > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CSmartComPtr< T > Class Template Reference

#include "util.h"

List of all members.

Public Member Functions

CSmartComPtr ()
CSmartComPtr (T *pInterface)
CSmartComPtr (const CSmartComPtr< T > &lpAnother)
~CSmartComPtr ()
void | Clear ()
T ** | GrabOutPtr ()
operator const T * () const
T ** | operator& ()
T * | operator-> () const
CSmartComPtr & | operator= (CSmartComPtr &Other)
T * | Release ()

Private Member Functions

void | AddReference ()
void | ReleaseInterface ()

Private Attributes

T * | m_pI

Detailed Description

template<class T>
class CSmartComPtr< T >

Definition at line 41 of file util.h.

Constructor & Destructor Documentation

template<class T>
CSmartComPtr< T >::CSmartComPtr ( ) [inline]

Definition at line 64 of file util.h.

    {
        m_pI = NULL;
    }

template<class T>
CSmartComPtr< T >::CSmartComPtr ( T * pInterface ) [inline]

Definition at line 69 of file util.h.

    {
        m_pI = pInterface;
        AddReference();
    }

template<class T>
CSmartComPtr< T >::CSmartComPtr ( const CSmartComPtr< T > & lpAnother ) [inline]

Definition at line 75 of file util.h.

    {
        m_pI = lpAnother.m_pI;
        AddReference();
    }

template<class T>
CSmartComPtr< T >::~CSmartComPtr ( ) [inline]

Definition at line 81 of file util.h.

    {
        ReleaseInterface();
    }

Member Function Documentation

template<class T>
void CSmartComPtr< T >::AddReference ( ) [inline, private]

Definition at line 45 of file util.h.

    {
        if (m_pI)
        {
            m_pI->AddRef();
        }
    }

template<class T>
void CSmartComPtr< T >::Clear ( ) [inline]

Definition at line 93 of file util.h.

    {
        ReleaseInterface();
    }

template<class T>
T** CSmartComPtr< T >::GrabOutPtr ( ) [inline]

Definition at line 125 of file util.h.

    {
        ReleaseInterface();
        return &m_pI;
    }

template<class T>
CSmartComPtr< T >::operator const T * ( ) const [inline]

Definition at line 98 of file util.h.

    {
        return m_pI;
    }

template<class T>
T** CSmartComPtr< T >::operator& ( ) [inline]

Definition at line 105 of file util.h.

    {
        _ASSERT(m_pI == NULL);
        return &m_pI;
    }

template<class T>
T* CSmartComPtr< T >::operator-> ( ) const [inline]

Definition at line 111 of file util.h.

    {
        return m_pI;
    }

template<class T>
CSmartComPtr& CSmartComPtr< T >::operator= ( CSmartComPtr< T > & Other ) [inline]

Definition at line 116 of file util.h.

    {
        ReleaseInterface();
        m_pI = Other.m_pI;
        AddReference();

        return *this;
    }

template<class T>
T* CSmartComPtr< T >::Release ( void ) [inline]

Definition at line 86 of file util.h.

    {
        T* pTemp = m_pI;
        m_pI = NULL;
        return temp;
    }

template<class T>
void CSmartComPtr< T >::ReleaseInterface ( ) [inline, private]

Definition at line 53 of file util.h.

    {
        if (m_pI)
        {
            m_pI->Release();
            m_pI = NULL;
        }
    }

Member Data Documentation

template<class T>
T* CSmartComPtr< T >::m_pI [private]

Definition at line 43 of file util.h.

The documentation for this class was generated from the following file:
  • Web/bits/Upload/util.h
Generated on Wed Nov 13 2024 16:57:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSmartPtr< T > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CSmartPtr< T > Class Template Reference

#include "cdialoglite.h"

Inherited by CSmartPtrTrace< T >.

List of all members.

Public Member Functions

CSmartPtr ()
~CSmartPtr ()
ULONG AddRef ()
HRESULT | CoCreateInstance (REFCLSID rclsid, LPUNKNOWN pUnkOuter=NULL, DWORD dwClsContext=CLSCTX_ALL)
HRESULT | CoCreateInstance (LPCOLESTR szProgID, LPUNKNOWN pUnkOuter=NULL, DWORD dwClsContext=CLSCTX_ALL)
REFIID | iid ()
operator T * () const
bool | operator! () const
T ** | operator& ()
_NoAddRefReleaseQIOnSmartPtr< T > * | operator-> () const
bool | operator== (T *pT) const
template<class Q >
HRESULT | QueryInterface (Q **pp) const
ULONG Release ()

Protected Attributes

T * | m_p

Detailed Description

template<class T>
class CSmartPtr< T >

Definition at line 1625 of file cdialoglite.h.

Constructor & Destructor Documentation

template<class T>
CSmartPtr< T >::CSmartPtr ( ) [inline]

Definition at line 1629 of file cdialoglite.h.

  {
    m_p = NULL;
  }

template<class T>
CSmartPtr< T >::~CSmartPtr ( ) [inline]

Definition at line 1633 of file cdialoglite.h.

  {
    Release();
  }

Member Function Documentation

template<class T>
ULONG CSmartPtr< T >::AddRef ( void ) [inline]

Reimplemented in CSmartPtrTrace< T >.

Definition at line 1672 of file cdialoglite.h.

  {
    ASSERT(m_p);
    return m_p->AddRef();
  }

template<class T>
HRESULT CSmartPtr< T >::CoCreateInstance | ( | REFCLSID | rclsid,
 |  | LPUNKNOWN | pUnkOuter = NULL,
 |  | DWORD | dwClsContext = CLSCTX_ALL |
 | ) |  |  | [inline]

Reimplemented in CSmartPtrTrace< T >.

Definition at line 1698 of file cdialoglite.h.

  {
    ASSERT(!m_p);
    return ::CoCreateInstance(rclsid, pUnkOuter, dwClsContext, __uuidof(T), (void**)&m_p);
  }

template<class T>
HRESULT CSmartPtr< T >::CoCreateInstance | ( | LPCOLESTR | szProgID,
 |  | LPUNKNOWN | pUnkOuter = NULL,
 |  | DWORD | dwClsContext = CLSCTX_ALL |
 | ) |  |  | [inline]

Definition at line 1704 of file cdialoglite.h.

  {
    CLSID clsid;
    HRESULT hr = CLSIDFromProgID(szProgID, &clsid);

    if(SUCCEEDED(hr))
      hr = CoCreateInstance(clsid, pUnkOuter, dwClsContext);
    return hr;
  }

template<class T>
REFIID CSmartPtr< T >::iid ( ) [inline]

Definition at line 1639 of file cdialoglite.h.

{ return __uuidof(T); }

template<class T>
CSmartPtr< T >::operator T * ( ) const [inline]

Definition at line 1656 of file cdialoglite.h.

  {
    return (T*)m_p;
  }

template<class T>
bool CSmartPtr< T >::operator! ( ) const [inline]

Definition at line 1661 of file cdialoglite.h.

  {
    return (m_p == NULL);
  }

template<class T>
T** CSmartPtr< T >::operator& ( ) [inline]

Definition at line 1650 of file cdialoglite.h.

  {
    ASSERT(!m_p);
    return &m_p;
  }

template<class T>
_NoAddRefReleaseQIOnSmartPtr<T>* CSmartPtr< T >::operator-> ( ) const [inline]

Definition at line 1642 of file cdialoglite.h.

  {
    ASSERT(m_p);
    return (_NoAddRefReleaseQIOnSmartPtr<T>*)m_p;
  }

template<class T>
bool CSmartPtr< T >::operator== ( T * pT ) const [inline]

Definition at line 1666 of file cdialoglite.h.

  {
    return m_p == pT;
  }

template<class T>
template<class Q >
HRESULT CSmartPtr< T >::QueryInterface ( Q ** pp ) const [inline]

Reimplemented in CSmartPtrTrace< T >.

Definition at line 1691 of file cdialoglite.h.

  {
    ASSERT(pp && !*pp);
    return m_p->QueryInterface(__uuidof(Q), (void**)pp);
  }

template<class T>
ULONG CSmartPtr< T >::Release ( void ) [inline]

Reimplemented in CSmartPtrTrace< T >.

Definition at line 1678 of file cdialoglite.h.

  {
    ULONG ulRefCount = 0;

    if(m_p)
    {
      ulRefCount = m_p->Release();
      m_p = NULL;
    }

    return ulRefCount;
  }

Member Data Documentation

template<class T>
T* CSmartPtr< T >::m_p [protected]

Definition at line 1715 of file cdialoglite.h.

The documentation for this class was generated from the following file:
  • Dataaccess/oledb/rowsetviewer/cdialoglite.h
Generated on Wed Nov 13 2024 16:57:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSmartPtrTrace< T > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CSmartPtrTrace< T > Class Template Reference

#include "cdialoglite.h"

Inherits CSmartPtr< T >.

List of all members.

Public Member Functions

ULONG AddRef ()
HRESULT | CoCreateInstance (REFCLSID rclsid, LPUNKNOWN pUnkOuter=NULL, DWORD dwClsContext=CLSCTX_ALL)
template<class Q >
HRESULT | QueryInterface (Q **pp) const
ULONG Release ()
void | Write (LPCWSTR pwsz)
void | WriteLine (LPCWSTR pwsz)

Detailed Description

template<class T>
class CSmartPtrTrace< T >

Definition at line 1724 of file cdialoglite.h.

Member Function Documentation

template<class T >
ULONG CSmartPtrTrace< T >::AddRef ( void ) [inline]

Reimplemented from CSmartPtr< T >.

Definition at line 1728 of file cdialoglite.h.

  {
    //Delegate
    ULONG ulRefCount = CSmartPtr<T>::AddRef();

    //Trace the call
    Write(GetInterfaceName(__uuidof(T)));
    WriteLine(L"::AddRef() - ");
    return ulRefCount;
  }

template<class T >
HRESULT CSmartPtrTrace< T >::CoCreateInstance | ( | REFCLSID | rclsid,
 |  | LPUNKNOWN | pUnkOuter = NULL,
 |  | DWORD | dwClsContext = CLSCTX_ALL |
 | ) |  |  | [inline]

Reimplemented from CSmartPtr< T >.

Definition at line 1766 of file cdialoglite.h.

  {
    //Delegate
    HRESULT hr = CSmartPtr<T>::CoCreateInstance(rclsid, pUnkOuter, dwClsContext);

    //Trace the call
//    WriteLine(L"CoCreateInstance(..." WIDESTRING(__uuidof(T)) "...");
    return hr;
  }

template<class T >
template<class Q >
HRESULT CSmartPtrTrace< T >::QueryInterface ( Q ** pp ) const [inline]

Reimplemented from CSmartPtr< T >.

Definition at line 1752 of file cdialoglite.h.

  {
    //Delegate
    HRESULT hr = CSmartPtr<T>::QueryInterface(pp);

    //Trace the call
//    CSmartPtrTrace<T>::Write(GetInterfaceName(__uuidof(T)));
//    CSmartPtrTrace<T>::Write(L"::QueryInterface(");
//    CSmartPtrTrace<T>::Write(GetInterfaceName(__uuidof(Q)));
//    CSmartPtrTrace<T>::WriteLine(L") - ");
    return hr;
  }

template<class T >
ULONG CSmartPtrTrace< T >::Release ( void ) [inline]

Reimplemented from CSmartPtr< T >.

Definition at line 1740 of file cdialoglite.h.

  {
    //Delegate
    ULONG ulRefCount = CSmartPtr<T>::Release();

    //Trace the call
    Write(GetInterfaceName(__uuidof(T)));
    WriteLine(L"::Release() - ");
    return ulRefCount;
  }

template<class T >
void CSmartPtrTrace< T >::Write ( LPCWSTR pwsz ) [inline]

Definition at line 1776 of file cdialoglite.h.

  {
    TRACE(pwsz);
//    CTrace* pCTrace = GetTrace();
//    if(pCTrace)
//      pCTrace->OutputText(0, 0, pwsz);
  }

template<class T >
void CSmartPtrTrace< T >::WriteLine ( LPCWSTR pwsz ) [inline]

Definition at line 1784 of file cdialoglite.h.

  {
    Write(pwsz);
    Write(wWndEOL);
//    CTrace* pCTrace = GetTrace();
//    if(pCTrace)
//    {
//      pCTrace->OutputText(0, 0, pwsz);
//      pCTrace->OutputLineEnd();
//    }
  }

The documentation for this class was generated from the following file:
  • Dataaccess/oledb/rowsetviewer/cdialoglite.h
Generated on Wed Nov 13 2024 16:57:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSmpFilter Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes | Friends

CSmpFilter Class Reference

#include "SmpFilt.Hxx"

List of all members.

Public Member Functions

virtual ULONG STDMETHODCALLTYPE | AddRef ()
virtual SCODE STDMETHODCALLTYPE | BindRegion (FILTERREGION origPos, REFIID riid, void **ppunk)
virtual SCODE STDMETHODCALLTYPE | GetChunk (STAT_CHUNK *pStat)
virtual SCODE STDMETHODCALLTYPE | GetClassID (CLSID *pClassID)
virtual SCODE STDMETHODCALLTYPE | GetCurFile (LPWSTR *ppszFileName)
virtual SCODE STDMETHODCALLTYPE | GetText (ULONG *pcwcBuffer, WCHAR *awcBuffer)
virtual SCODE STDMETHODCALLTYPE | GetValue (PROPVARIANT **ppPropValue)
virtual SCODE STDMETHODCALLTYPE | Init (ULONG grfFlags, ULONG cAttributes, FULLPROPSPEC const *aAttributes, ULONG *pFlags)
virtual SCODE STDMETHODCALLTYPE | IsDirty ()
virtual SCODE STDMETHODCALLTYPE | Load (LPCWSTR pszFileName, DWORD dwMode)
virtual SCODE STDMETHODCALLTYPE | QueryInterface (REFIID riid, void **ppvObject)
virtual ULONG STDMETHODCALLTYPE | Release ()
virtual SCODE STDMETHODCALLTYPE | Save (LPCWSTR pszFileName, BOOL fRemember)
virtual SCODE STDMETHODCALLTYPE | SaveCompleted (LPCWSTR pszFileName)

Private Member Functions

CSmpFilter ()
~CSmpFilter ()

Private Attributes

BOOL m_fContents
BOOL m_fEof
HANDLE m_hFile
long | m_lRefs
WCHAR * | m_pwszFileName
ULONG m_ulBufferLen
ULONG m_ulCharsRead
ULONG m_ulChunkID
ULONG m_ulCodePage
WCHAR | m_wcsBuffer [TEXT_FILTER_CHUNK_SIZE]

Friends

class | CSmpFilterCF

Detailed Description

Definition at line 49 of file SmpFilt.Hxx.

Constructor & Destructor Documentation

CSmpFilter::CSmpFilter ( ) [private]

Definition at line 94 of file SmpFilt.Cxx.

                       :
    m_hFile(INVALID_HANDLE_VALUE),
    m_lRefs(1),
    m_pwszFileName(0),
    m_ulBufferLen(0),
    m_ulCharsRead(0),
    m_ulChunkID(1),
    m_fContents(FALSE),
    m_fEof(FALSE),
    m_ulCodePage( GetDefaultCodepage() )
{
    InterlockedIncrement( &g_lInstances );
}

CSmpFilter::~CSmpFilter ( ) [private]

Definition at line 120 of file SmpFilt.Cxx.

{
    delete [] m_pwszFileName;
    if ( INVALID_HANDLE_VALUE != m_hFile )
        CloseHandle( m_hFile );

    InterlockedDecrement( &g_lInstances );
}

Member Function Documentation

ULONG STDMETHODCALLTYPE CSmpFilter::AddRef ( void ) [virtual]

Definition at line 186 of file SmpFilt.Cxx.

{
    return InterlockedIncrement( &m_lRefs );
}

SCODE STDMETHODCALLTYPE CSmpFilter::BindRegion | ( | FILTERREGION | origPos,
 |  | REFIID | riid,
 |  | void ** | ppunk |
 | ) |  |  | [virtual]

Definition at line 507 of file SmpFilt.Cxx.

{
    // BindRegion is currently reserved for future use

    return E_NOTIMPL;
}

SCODE STDMETHODCALLTYPE CSmpFilter::GetChunk ( STAT_CHUNK * pStat ) [virtual]

Definition at line 344 of file SmpFilt.Cxx.

{
    if ( INVALID_HANDLE_VALUE == m_hFile )
        return FILTER_E_ACCESS;

    // Read characters from single-byte file

    char cszBuffer[TEXT_FILTER_CHUNK_SIZE];

    if ( !ReadFile(
              m_hFile,
              cszBuffer,
              TEXT_FILTER_CHUNK_SIZE,
              &m_ulBufferLen,
              NULL
          ) )
        return FILTER_E_ACCESS;
    else if( 0 == m_ulBufferLen )
        m_fEof = TRUE;

    if ( !m_fContents || m_fEof )
        return FILTER_E_END_OF_CHUNKS;

    // Convert single-byte characters to UNICODE
    //
    // This conversion assumes a one-to-one conversion:
    //     one input single-byte character to
    //     one output multibyte (UNICODE) character
    //
    // This is typically not the general case with multibyte
    // characters, and a general case needs to handle the possible
    // difference of pre- and post-conversion buffer lengths

    if ( !MultiByteToWideChar(
              m_ulCodePage,
              MB_COMPOSITE,
              cszBuffer,
              m_ulBufferLen,
              m_wcsBuffer,
              TEXT_FILTER_CHUNK_SIZE
          ) )
        return E_FAIL;

    // Set chunk description

    pStat->idChunk   = m_ulChunkID;
    pStat->breakType = CHUNK_NO_BREAK;
    pStat->flags     = CHUNK_TEXT;
    pStat->locale    = GetSystemDefaultLCID();
    pStat->attribute.guidPropSet       = guidStorage;
    pStat->attribute.psProperty.ulKind = PRSPEC_PROPID;
    pStat->attribute.psProperty.propid = PID_STG_CONTENTS;
    pStat->idChunkSource  = m_ulChunkID;
    pStat->cwcStartSource = 0;
    pStat->cwcLenSource   = 0;

    m_ulCharsRead = 0;
    m_ulChunkID++;

    return S_OK;
}

SCODE STDMETHODCALLTYPE CSmpFilter::GetClassID ( CLSID * pClassID ) [virtual]

Definition at line 534 of file SmpFilt.Cxx.

{
    *pClassID = CLSID_CSmpFilter;
    return S_OK;
}

SCODE STDMETHODCALLTYPE CSmpFilter::GetCurFile ( LPWSTR * ppszFileName ) [virtual]

Definition at line 680 of file SmpFilt.Cxx.

{
    if ( 0 == m_pwszFileName )
        return E_FAIL;

    ULONG ulChars = (ULONG)wcslen( m_pwszFileName ) + 1;
    *ppszFileName = (WCHAR *)CoTaskMemAlloc( ulChars * sizeof WCHAR );

    if ( 0 != *ppszFileName )
        wcscpy( *ppszFileName, m_pwszFileName );
    else
        return E_OUTOFMEMORY;

    return S_OK;
}

SCODE STDMETHODCALLTYPE CSmpFilter::GetText | ( | ULONG * | pcwcBuffer,
 |  | WCHAR * | awcBuffer |
 | ) |  |  | [virtual]

Definition at line 429 of file SmpFilt.Cxx.

{
    if ( !m_fContents || 0 == m_ulBufferLen )
    {
        *pcwcBuffer = 0;
        return FILTER_E_NO_MORE_TEXT;
    }

    // Copy characters in chunk buffer to output UNICODE buffer
    //
    // This copy assumes a one-to-one conversion in GetChunk
    // of input single-byte characters (each 1 byte long)
    // to output UNICODE characters (each 2 bytes long)

    ULONG ulToCopy = min( *pcwcBuffer, m_ulBufferLen - m_ulCharsRead );

    memcpy( awcBuffer, m_wcsBuffer + m_ulCharsRead, 2*ulToCopy );
    m_ulCharsRead += ulToCopy;
    *pcwcBuffer = ulToCopy;

    if ( m_ulBufferLen == m_ulCharsRead )
    {
        m_ulCharsRead = 0;
        m_ulBufferLen = 0;
        return FILTER_S_LAST_TEXT;
    }

    return S_OK;
}

SCODE STDMETHODCALLTYPE CSmpFilter::GetValue ( PROPVARIANT ** ppPropValue ) [virtual]

Definition at line 478 of file SmpFilt.Cxx.

{
    // Sample filter does not retieve any properties

    return FILTER_E_NO_VALUES;
}

SCODE STDMETHODCALLTYPE CSmpFilter::Init | ( | ULONG | grfFlags,
 |  | ULONG | cAttributes,
 |  | FULLPROPSPEC const * | aAttributes,
 |  | ULONG * | pFlags |
 | ) |  |  | [virtual]

Definition at line 241 of file SmpFilt.Cxx.

{
    // Ignore flags for text canonicalization (text is unformatted)
    // Check for proper attributes request and recognize only "contents"

    if( 0 < cAttributes )
    {
        ULONG ulNumAttr;

        if ( 0 == aAttributes )
            return E_INVALIDARG;

        for ( ulNumAttr = 0 ; ulNumAttr < cAttributes; ulNumAttr++ )
        {
            if ( guidStorage == aAttributes[ulNumAttr].guidPropSet &&
                PID_STG_CONTENTS == aAttributes[ulNumAttr].psProperty.propid )
                break;
        }

        if ( ulNumAttr < cAttributes )
            m_fContents = TRUE;
        else
            m_fContents = FALSE;
    }
    else if ( 0 == grfFlags ||
              (grfFlags & IFILTER_INIT_APPLY_INDEX_ATTRIBUTES) )
        m_fContents = TRUE;
    else
        m_fContents = FALSE;

    m_fEof = FALSE;

    // Open the file previously specified in call to IPersistFile::Load

    if ( 0 != m_pwszFileName )
    {
        if ( INVALID_HANDLE_VALUE != m_hFile )
        {
            CloseHandle( m_hFile );
            m_hFile = INVALID_HANDLE_VALUE;
        }

        m_hFile = CreateFile(
                      (LPCWSTR)m_pwszFileName,
                      GENERIC_READ,
                      FILE_SHARE_READ | FILE_SHARE_DELETE,
                      0,
                      OPEN_EXISTING,
                      FILE_ATTRIBUTE_NORMAL,
                      0
                  );

        if ( INVALID_HANDLE_VALUE == m_hFile )
            return FILTER_E_ACCESS;
    }
    else
        return E_FAIL;

    // Enumerate OLE properties, since any NTFS file can have them

    *pFlags = IFILTER_FLAGS_OLE_PROPERTIES;

    // Re-initialize

    m_ulChunkID = 1;
    m_ulCharsRead = 0;

    return S_OK;
}

SCODE STDMETHODCALLTYPE CSmpFilter::IsDirty ( void ) [virtual]

Definition at line 557 of file SmpFilt.Cxx.

{
    // File is opened read-only and never changes

    return S_FALSE;
}

SCODE STDMETHODCALLTYPE CSmpFilter::Load | ( | LPCWSTR | pszFileName,
 |  | DWORD | dwMode |
 | ) |  |  | [virtual]

Definition at line 585 of file SmpFilt.Cxx.

{
    // Load just sets the filename for GetChunk to read and ignores the mode

    ULONG ulChars = (ULONG)wcslen( pszFileName ) + 1;
    delete [] m_pwszFileName;

    m_pwszFileName = new WCHAR [ulChars];

    if ( 0 != m_pwszFileName )
        wcscpy( m_pwszFileName, pszFileName );
    else
        return E_OUTOFMEMORY;

    return S_OK;
}

SCODE STDMETHODCALLTYPE CSmpFilter::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppvObject |
 | ) |  |  | [virtual]

Definition at line 147 of file SmpFilt.Cxx.

{
    IUnknown *pUnkTemp = 0;

    if ( IID_IFilter == riid )
        pUnkTemp = (IUnknown *)(IFilter *)this;
    else if ( IID_IPersistFile == riid )
        pUnkTemp = (IUnknown *)(IPersistFile *)this;
    else if ( IID_IPersist == riid )
        pUnkTemp = (IUnknown *)(IPersist *)(IPersistFile *)this;
    else if ( IID_IUnknown == riid )
        pUnkTemp = (IUnknown *)(IPersist *)(IPersistFile *)this;
    else
    {
        *ppvObject = NULL;
        return E_NOINTERFACE;
    }

    *ppvObject = (void  *)pUnkTemp;
    pUnkTemp->AddRef();

    return S_OK;
}

ULONG STDMETHODCALLTYPE CSmpFilter::Release ( void ) [virtual]

Definition at line 203 of file SmpFilt.Cxx.

{
    ULONG ulTmp = InterlockedDecrement( &m_lRefs );

    if ( 0 == ulTmp )
        delete this;

    return ulTmp;
}

SCODE STDMETHODCALLTYPE CSmpFilter::Save | ( | LPCWSTR | pszFileName,
 |  | BOOL | fRemember |
 | ) |  |  | [virtual]

Definition at line 624 of file SmpFilt.Cxx.

{
    // File is opened read-only; saving it is an error

    return E_FAIL;
}

SCODE STDMETHODCALLTYPE CSmpFilter::SaveCompleted ( LPCWSTR pszFileName ) [virtual]

Definition at line 649 of file SmpFilt.Cxx.

{
    // File is opened read-only, so "save" is always finished

    return S_OK;
}

Friends And Related Function Documentation

friend class CSmpFilterCF [friend]

Definition at line 115 of file SmpFilt.Hxx.

Member Data Documentation

BOOL CSmpFilter::m_fContents [private]

Definition at line 127 of file SmpFilt.Hxx.

BOOL CSmpFilter::m_fEof [private]

Definition at line 128 of file SmpFilt.Hxx.

HANDLE CSmpFilter::m_hFile [private]

Definition at line 120 of file SmpFilt.Hxx.

long CSmpFilter::m_lRefs [private]

Definition at line 121 of file SmpFilt.Hxx.

WCHAR* CSmpFilter::m_pwszFileName [private]

Definition at line 122 of file SmpFilt.Hxx.

ULONG CSmpFilter::m_ulBufferLen [private]

Definition at line 123 of file SmpFilt.Hxx.

ULONG CSmpFilter::m_ulCharsRead [private]

Definition at line 124 of file SmpFilt.Hxx.

ULONG CSmpFilter::m_ulChunkID [private]

Definition at line 125 of file SmpFilt.Hxx.

ULONG CSmpFilter::m_ulCodePage [private]

Definition at line 126 of file SmpFilt.Hxx.

WCHAR CSmpFilter::m_wcsBuffer[TEXT_FILTER_CHUNK_SIZE] [private]

Definition at line 129 of file SmpFilt.Hxx.

The documentation for this class was generated from the following files:
  • WinBase/Indexing/SmpFilt/SmpFilt.Hxx
  • WinBase/Indexing/SmpFilt/SmpFilt.Cxx
Generated on Wed Nov 13 2024 16:57:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSmpFilterCF Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes | Friends

CSmpFilterCF Class Reference

#include "SmpFilt.Hxx"

List of all members.

Public Member Functions

virtual ULONG STDMETHODCALLTYPE | AddRef ()
virtual SCODE STDMETHODCALLTYPE | CreateInstance (IUnknown *pUnkOuter, REFIID riid, void **ppvObject)
virtual SCODE STDMETHODCALLTYPE | LockServer (BOOL fLock)
virtual SCODE STDMETHODCALLTYPE | QueryInterface (REFIID riid, void **ppvObject)
virtual ULONG STDMETHODCALLTYPE | Release ()

Private Member Functions

CSmpFilterCF ()
~CSmpFilterCF ()

Private Attributes

long | m_lRefs

Friends

SCODE STDMETHODCALLTYPE | DllGetClassObject (REFCLSID cid, REFIID iid, void **ppvObj)

Detailed Description

Definition at line 140 of file SmpFilt.Hxx.

Constructor & Destructor Documentation

CSmpFilterCF::CSmpFilterCF ( ) [private]

Definition at line 718 of file SmpFilt.Cxx.

                           :
    m_lRefs(1)
{
    InterlockedIncrement( &g_lInstances );
}

CSmpFilterCF::~CSmpFilterCF ( ) [private]

Definition at line 736 of file SmpFilt.Cxx.

{
   InterlockedDecrement( &g_lInstances );
}

Member Function Documentation

ULONG STDMETHODCALLTYPE CSmpFilterCF::AddRef ( void ) [virtual]

Definition at line 794 of file SmpFilt.Cxx.

{
   return InterlockedIncrement( &m_lRefs );
}

SCODE STDMETHODCALLTYPE CSmpFilterCF::CreateInstance | ( | IUnknown * | pUnkOuter,
 |  | REFIID | riid,
 |  | void ** | ppvObject |
 | ) |  |  | [virtual]

Definition at line 848 of file SmpFilt.Cxx.

{
    CSmpFilter *pIUnk = 0;

    if ( 0 != pUnkOuter )
        return CLASS_E_NOAGGREGATION;

    pIUnk = new CSmpFilter();

    if ( 0 != pIUnk )
    {
        if ( SUCCEEDED( pIUnk->QueryInterface( riid , ppvObject ) ) )
        {
            // Release extra refcount from QueryInterface

            pIUnk->Release();
        }
        else
        {
            delete pIUnk;
            return E_UNEXPECTED;
        }
    }
    else
        return E_OUTOFMEMORY;

    return S_OK;
}

SCODE STDMETHODCALLTYPE CSmpFilterCF::LockServer ( BOOL fLock ) [virtual]

Definition at line 901 of file SmpFilt.Cxx.

{
    if( fLock )
        InterlockedIncrement( &g_lInstances );
    else
        InterlockedDecrement( &g_lInstances );

    return S_OK;
}

SCODE STDMETHODCALLTYPE CSmpFilterCF::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppvObject |
 | ) |  |  | [virtual]

Definition at line 759 of file SmpFilt.Cxx.

{
    IUnknown *pUnkTemp;

    if ( IID_IClassFactory == riid )
        pUnkTemp = (IUnknown *)(IClassFactory *)this;
    else if ( IID_IUnknown == riid )
        pUnkTemp = (IUnknown *)this;
    else
    {
        *ppvObject = NULL;
        return E_NOINTERFACE;
    }

    *ppvObject = (void  *)pUnkTemp;
    pUnkTemp->AddRef();

    return S_OK;
}

ULONG STDMETHODCALLTYPE CSmpFilterCF::Release ( void ) [virtual]

Definition at line 811 of file SmpFilt.Cxx.

{
    ULONG ulTmp = InterlockedDecrement( &m_lRefs );

    if ( 0 == ulTmp )
        delete this;

    return ulTmp;
}

Friends And Related Function Documentation

SCODE STDMETHODCALLTYPE DllGetClassObject | ( | REFCLSID | cid,
 |  | REFIID | iid,
 |  | void ** | ppvObj |
 | ) |  |  | [friend]

Definition at line 1064 of file HtmlProp.Cxx.

{
    IUnknown * pUnk = 0;

    if ( CLSID_HtmlPropIFilter == cid ||
         CLSID_HtmlPropClass   == cid )
    {
        pUnk = new HtmlPropIFilterCF;

        if ( 0 == pUnk )
            return E_OUTOFMEMORY;
    }
    else
    {
        *ppvObj = 0;
        return E_NOINTERFACE;
    }

    SCODE sc = pUnk->QueryInterface( iid, ppvObj );

    pUnk->Release();

    return sc;
} //DllGetClassObject

Member Data Documentation

long CSmpFilterCF::m_lRefs [private]

Definition at line 178 of file SmpFilt.Hxx.

The documentation for this class was generated from the following files:
  • WinBase/Indexing/SmpFilt/SmpFilt.Hxx
  • WinBase/Indexing/SmpFilt/SmpFilt.Cxx
Generated on Wed Nov 13 2024 16:57:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSnap Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CSnap Class Reference

#include "Snap.h"

List of all members.

Public Member Functions

CSnap ()
STDMETHOD() | get_SnapIncrement (long *pVal)
STDMETHOD() | get_SnapOn (BOOL *pVal)
STDMETHOD() | put_SnapIncrement (long newVal)
STDMETHOD() | put_SnapOn (BOOL newVal)
STDMETHOD() | SnapRect (IHTMLElement *pIElement, RECT *prcNew, ELEMENT_CORNER eHandle)

Public Attributes

BOOL m_bSnapOn
long | m_lSnapIncrement

Detailed Description

Definition at line 15 of file Snap.h.

Constructor & Destructor Documentation

CSnap::CSnap ( ) [inline]

Definition at line 22 of file Snap.h.

          : m_lSnapIncrement(40), m_bSnapOn(FALSE)
  {
  }

Member Function Documentation

STDMETHODIMP CSnap::get_SnapIncrement ( long * pVal )

Definition at line 75 of file Snap.cpp.

{
  pVal = &m_lSnapIncrement;

  return S_OK;
}

STDMETHODIMP CSnap::get_SnapOn ( BOOL * pVal )

Definition at line 89 of file Snap.cpp.

{
  pVal = &m_bSnapOn;

  return S_OK;
}

STDMETHODIMP CSnap::put_SnapIncrement ( long newVal )

Definition at line 82 of file Snap.cpp.

{
  m_lSnapIncrement = newVal;

  return S_OK;
}

STDMETHODIMP CSnap::put_SnapOn ( BOOL newVal )

Definition at line 96 of file Snap.cpp.

{
  m_bSnapOn = newVal;

  return S_OK;
}

STDMETHODIMP CSnap::SnapRect | ( | IHTMLElement * | pIElement,
 |  | RECT * | prcNew,
 |  | ELEMENT_CORNER | eHandle
 | ) |  |

Definition at line 15 of file Snap.cpp.

{
  if (!m_bSnapOn) return S_OK; // Disables snap to grid when m_bSnapOn is FALSE

  LONG lWidth = prcNew->right - prcNew->left;
  LONG lHeight = prcNew->bottom - prcNew->top;

  switch (eHandle)
  {
  case ELEMENT_CORNER_NONE:
    prcNew->top = ((prcNew->top + (m_lSnapIncrement/2))/m_lSnapIncrement) * m_lSnapIncrement - 2;
    prcNew->left = ((prcNew->left + (m_lSnapIncrement/2))/m_lSnapIncrement) * m_lSnapIncrement - 2;
    prcNew->bottom = prcNew->top + lHeight;
    prcNew->right = prcNew->left + lWidth;
    break;

  case ELEMENT_CORNER_TOP:
    prcNew->top = ((prcNew->top + (m_lSnapIncrement/2))/m_lSnapIncrement) * m_lSnapIncrement - 2;
    break;

  case ELEMENT_CORNER_LEFT:
    prcNew->left = ((prcNew->left + (m_lSnapIncrement/2))/m_lSnapIncrement) * m_lSnapIncrement - 2;
    break;

  case ELEMENT_CORNER_BOTTOM:
    prcNew->bottom = ((prcNew->bottom + (m_lSnapIncrement/2))/m_lSnapIncrement) * m_lSnapIncrement + 1;
    break;

  case ELEMENT_CORNER_RIGHT:
    prcNew->right = ((prcNew->right + (m_lSnapIncrement/2))/m_lSnapIncrement) * m_lSnapIncrement + 1;
    break;

  case ELEMENT_CORNER_TOPLEFT:
    prcNew->top = ((prcNew->top + (m_lSnapIncrement/2))/m_lSnapIncrement) * m_lSnapIncrement - 2;
    prcNew->left = ((prcNew->left + (m_lSnapIncrement/2))/m_lSnapIncrement) * m_lSnapIncrement - 2;
    break;

  case ELEMENT_CORNER_TOPRIGHT:
    prcNew->top = ((prcNew->top + (m_lSnapIncrement/2))/m_lSnapIncrement) * m_lSnapIncrement - 2;
    prcNew->right = ((prcNew->right + (m_lSnapIncrement/2))/m_lSnapIncrement) * m_lSnapIncrement + 1;
    break;

  case ELEMENT_CORNER_BOTTOMLEFT:
    prcNew->bottom = ((prcNew->bottom + (m_lSnapIncrement/2))/m_lSnapIncrement) * m_lSnapIncrement + 1;
    prcNew->left = ((prcNew->left + (m_lSnapIncrement/2))/m_lSnapIncrement) * m_lSnapIncrement - 2;
    break;

  case ELEMENT_CORNER_BOTTOMRIGHT:
    prcNew->bottom = ((prcNew->bottom + (m_lSnapIncrement/2))/m_lSnapIncrement) * m_lSnapIncrement + 1;
    prcNew->right = ((prcNew->right + (m_lSnapIncrement/2))/m_lSnapIncrement) * m_lSnapIncrement + 1;
    break;
  }

  return S_OK;

}

Member Data Documentation

BOOL CSnap::m_bSnapOn

Definition at line 37 of file Snap.h.

long CSnap::m_lSnapIncrement

Definition at line 36 of file Snap.h.

The documentation for this class was generated from the following files:
  • Web/Browser/EditHost/Snap.h
  • Web/Browser/EditHost/Snap.cpp
Generated on Wed Nov 13 2024 16:57:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSnapinAbout Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CSnapinAbout Class Reference

#include "about.h"

List of all members.

Public Member Functions

CSnapinAbout ()
CSnapinAbout ()
CSnapinAbout ()
CSnapinAbout ()
CSnapinAbout ()
CSnapinAbout ()
CSnapinAbout ()
CSnapinAbout ()
CSnapinAbout ()
CSnapinAbout ()
CSnapinAbout ()
CSnapinAbout ()
CSnapinAbout ()
CSnapinAbout ()
CSnapinAbout ()
CSnapinAbout ()
CSnapinAbout ()
CSnapinAbout ()
CSnapinAbout ()
CSnapinAbout ()
CSnapinAbout ()
CSnapinAbout ()
CSnapinAbout ()
CSnapinAbout ()
CSnapinAbout ()
CSnapinAbout ()
~CSnapinAbout ()
~CSnapinAbout ()
~CSnapinAbout ()
~CSnapinAbout ()
~CSnapinAbout ()
~CSnapinAbout ()
~CSnapinAbout ()
~CSnapinAbout ()
~CSnapinAbout ()
~CSnapinAbout ()
~CSnapinAbout ()
~CSnapinAbout ()
~CSnapinAbout ()
~CSnapinAbout ()
~CSnapinAbout ()
~CSnapinAbout ()
~CSnapinAbout ()
~CSnapinAbout ()
~CSnapinAbout ()
~CSnapinAbout ()
~CSnapinAbout ()
~CSnapinAbout ()
~CSnapinAbout ()
~CSnapinAbout ()
~CSnapinAbout ()
~CSnapinAbout ()
STDMETHODIMP | GetProvider (LPOLESTR *lpName)
STDMETHODIMP | GetProvider (LPOLESTR *lpName)
STDMETHODIMP | GetProvider (LPOLESTR *pszProvider)
STDMETHODIMP | GetProvider (LPOLESTR *lpName)
STDMETHODIMP | GetProvider (LPOLESTR *pszProvider)
STDMETHODIMP | GetProvider (LPOLESTR *lpName)
STDMETHODIMP | GetProvider (LPOLESTR *lpName)
STDMETHODIMP | GetProvider (LPOLESTR *pszProvider)
STDMETHODIMP | GetProvider (LPOLESTR *lpName)
STDMETHODIMP | GetProvider (LPOLESTR *lpName)
STDMETHODIMP | GetProvider (LPOLESTR *lpName)
STDMETHODIMP | GetProvider (LPOLESTR *lpName)
STDMETHODIMP | GetProvider (LPOLESTR *lpName)
STDMETHODIMP | GetProvider (LPOLESTR *pszProvider)
STDMETHODIMP | GetProvider (LPOLESTR *lpName)
STDMETHODIMP | GetProvider (LPOLESTR *lpName)
STDMETHODIMP | GetProvider (LPOLESTR *lpName)
STDMETHODIMP | GetProvider (LPOLESTR *lpName)
STDMETHODIMP | GetProvider (LPOLESTR *pszProvider)
STDMETHODIMP | GetProvider (LPOLESTR *lpName)
STDMETHODIMP | GetProvider (LPOLESTR *lpName)
STDMETHODIMP | GetProvider (LPOLESTR *lpName)
STDMETHODIMP | GetProvider (LPOLESTR *pszProvider)
STDMETHODIMP | GetProvider (LPOLESTR *lpName)
STDMETHODIMP | GetProvider (LPOLESTR *lpName)
STDMETHODIMP | GetProvider (LPOLESTR *pszProvider)
STDMETHODIMP | GetSnapinDescription (LPOLESTR *lpDescription)
STDMETHODIMP | GetSnapinDescription (LPOLESTR *lpDescription)
STDMETHODIMP | GetSnapinDescription (LPOLESTR *lpDescription)
STDMETHODIMP | GetSnapinDescription (LPOLESTR *pszDescription)
STDMETHODIMP | GetSnapinDescription (LPOLESTR *lpDescription)
STDMETHODIMP | GetSnapinDescription (LPOLESTR *pszDescription)
STDMETHODIMP | GetSnapinDescription (LPOLESTR *lpDescription)
STDMETHODIMP | GetSnapinDescription (LPOLESTR *pszDescription)
STDMETHODIMP | GetSnapinDescription (LPOLESTR *lpDescription)
STDMETHODIMP | GetSnapinDescription (LPOLESTR *lpDescription)
STDMETHODIMP | GetSnapinDescription (LPOLESTR *lpDescription)
STDMETHODIMP | GetSnapinDescription (LPOLESTR *lpDescription)
STDMETHODIMP | GetSnapinDescription (LPOLESTR *lpDescription)
STDMETHODIMP | GetSnapinDescription (LPOLESTR *pszDescription)
STDMETHODIMP | GetSnapinDescription (LPOLESTR *lpDescription)
STDMETHODIMP | GetSnapinDescription (LPOLESTR *lpDescription)
STDMETHODIMP | GetSnapinDescription (LPOLESTR *lpDescription)
STDMETHODIMP | GetSnapinDescription (LPOLESTR *pszDescription)
STDMETHODIMP | GetSnapinDescription (LPOLESTR *lpDescription)
STDMETHODIMP | GetSnapinDescription (LPOLESTR *lpDescription)
STDMETHODIMP | GetSnapinDescription (LPOLESTR *lpDescription)
STDMETHODIMP | GetSnapinDescription (LPOLESTR *lpDescription)
STDMETHODIMP | GetSnapinDescription (LPOLESTR *pszDescription)
STDMETHODIMP | GetSnapinDescription (LPOLESTR *lpDescription)
STDMETHODIMP | GetSnapinDescription (LPOLESTR *lpDescription)
STDMETHODIMP | GetSnapinDescription (LPOLESTR *pszDescription)
STDMETHODIMP | GetSnapinImage (HICON *hAppIcon)
STDMETHODIMP | GetSnapinImage (HICON *hAppIcon)
STDMETHODIMP | GetSnapinImage (HICON *hAppIcon)
STDMETHODIMP | GetSnapinImage (HICON *hAppIcon)
STDMETHODIMP | GetSnapinImage (HICON *hAppIcon)
STDMETHODIMP | GetSnapinImage (HICON *hAppIcon)
STDMETHODIMP | GetSnapinImage (HICON *hAppIcon)
STDMETHODIMP | GetSnapinImage (HICON *hAppIcon)
STDMETHODIMP | GetSnapinImage (HICON *hAppIcon)
STDMETHODIMP | GetSnapinImage (HICON *hAppIcon)
STDMETHODIMP | GetSnapinImage (HICON *hAppIcon)
STDMETHODIMP | GetSnapinImage (HICON *hAppIcon)
STDMETHODIMP | GetSnapinImage (HICON *hAppIcon)
STDMETHODIMP | GetSnapinImage (HICON *hAppIcon)
STDMETHODIMP | GetSnapinImage (HICON *hAppIcon)
STDMETHODIMP | GetSnapinImage (HICON *hAppIcon)
STDMETHODIMP | GetSnapinImage (HICON *hAppIcon)
STDMETHODIMP | GetSnapinImage (HICON *hAppIcon)
STDMETHODIMP | GetSnapinImage (HICON *hAppIcon)
STDMETHODIMP | GetSnapinImage (HICON *hAppIcon)
STDMETHODIMP | GetSnapinImage (HICON *hAppIcon)
STDMETHODIMP | GetSnapinImage (HICON *hAppIcon)
STDMETHODIMP | GetSnapinImage (HICON *hAppIcon)
STDMETHODIMP | GetSnapinImage (HICON *hAppIcon)
STDMETHODIMP | GetSnapinImage (HICON *hAppIcon)
STDMETHODIMP | GetSnapinImage (HICON *hAppIcon)
STDMETHODIMP | GetSnapinVersion (LPOLESTR *lpVersion)
STDMETHODIMP | GetSnapinVersion (LPOLESTR *pszVersion)
STDMETHODIMP | GetSnapinVersion (LPOLESTR *lpVersion)
STDMETHODIMP | GetSnapinVersion (LPOLESTR *pszVersion)
STDMETHODIMP | GetSnapinVersion (LPOLESTR *lpVersion)
STDMETHODIMP | GetSnapinVersion (LPOLESTR *lpVersion)
STDMETHODIMP | GetSnapinVersion (LPOLESTR *pszVersion)
STDMETHODIMP | GetSnapinVersion (LPOLESTR *lpVersion)
STDMETHODIMP | GetSnapinVersion (LPOLESTR *lpVersion)
STDMETHODIMP | GetSnapinVersion (LPOLESTR *lpVersion)
STDMETHODIMP | GetSnapinVersion (LPOLESTR *lpVersion)
STDMETHODIMP | GetSnapinVersion (LPOLESTR *lpVersion)
STDMETHODIMP | GetSnapinVersion (LPOLESTR *pszVersion)
STDMETHODIMP | GetSnapinVersion (LPOLESTR *lpVersion)
STDMETHODIMP | GetSnapinVersion (LPOLESTR *lpVersion)
STDMETHODIMP | GetSnapinVersion (LPOLESTR *lpVersion)
STDMETHODIMP | GetSnapinVersion (LPOLESTR *lpVersion)
STDMETHODIMP | GetSnapinVersion (LPOLESTR *pszVersion)
STDMETHODIMP | GetSnapinVersion (LPOLESTR *pszVersion)
STDMETHODIMP | GetSnapinVersion (LPOLESTR *lpVersion)
STDMETHODIMP | GetSnapinVersion (LPOLESTR *pszVersion)
STDMETHODIMP | GetSnapinVersion (LPOLESTR *lpVersion)
STDMETHODIMP | GetSnapinVersion (LPOLESTR *lpVersion)
STDMETHODIMP | GetSnapinVersion (LPOLESTR *lpVersion)
STDMETHODIMP | GetSnapinVersion (LPOLESTR *lpVersion)
STDMETHODIMP | GetSnapinVersion (LPOLESTR *lpVersion)
STDMETHODIMP | GetStaticFolderImage (HBITMAP *hSmallImage, HBITMAP *hSmallImageOpen, HBITMAP *hLargeImage, COLORREF *cMask)
STDMETHODIMP | GetStaticFolderImage (HBITMAP *hSmallImage, HBITMAP *hSmallImageOpen, HBITMAP *hLargeImage, COLORREF *cMask)
STDMETHODIMP | GetStaticFolderImage (HBITMAP *hSmallImage, HBITMAP *hOpenImage, HBITMAP *hLargeImage, COLORREF *cMask)
STDMETHODIMP | GetStaticFolderImage (HBITMAP *hSmallImage, HBITMAP *hOpenImage, HBITMAP *hLargeImage, COLORREF *cMask)
STDMETHODIMP | GetStaticFolderImage (HBITMAP *hSmallImage, HBITMAP *hSmallImageOpen, HBITMAP *hLargeImage, COLORREF *cMask)
STDMETHODIMP | GetStaticFolderImage (HBITMAP *hSmallImage, HBITMAP *hSmallImageOpen, HBITMAP *hLargeImage, COLORREF *cMask)
STDMETHODIMP | GetStaticFolderImage (HBITMAP *hSmallImage, HBITMAP *hOpenImage, HBITMAP *hLargeImage, COLORREF *cMask)
STDMETHODIMP | GetStaticFolderImage (HBITMAP *hSmallImage, HBITMAP *hOpenImage, HBITMAP *hLargeImage, COLORREF *cMask)
STDMETHODIMP | GetStaticFolderImage (HBITMAP *hSmallImage, HBITMAP *hOpenImage, HBITMAP *hLargeImage, COLORREF *cMask)
STDMETHODIMP | GetStaticFolderImage (HBITMAP *hSmallImage, HBITMAP *hSmallImageOpen, HBITMAP *hLargeImage, COLORREF *cMask)
STDMETHODIMP | GetStaticFolderImage (HBITMAP *hSmallImage, HBITMAP *hSmallImageOpen, HBITMAP *hLargeImage, COLORREF *cMask)
STDMETHODIMP | GetStaticFolderImage (HBITMAP *hSmallImage, HBITMAP *hSmallImageOpen, HBITMAP *hLargeImage, COLORREF *cMask)
STDMETHODIMP | GetStaticFolderImage (HBITMAP *hSmallImage, HBITMAP *hSmallImageOpen, HBITMAP *hLargeImage, COLORREF *cMask)
STDMETHODIMP | GetStaticFolderImage (HBITMAP *hSmallImage, HBITMAP *hSmallImageOpen, HBITMAP *hLargeImage, COLORREF *cMask)
STDMETHODIMP | GetStaticFolderImage (HBITMAP *hSmallImage, HBITMAP *hSmallImageOpen, HBITMAP *hLargeImage, COLORREF *cMask)
STDMETHODIMP | GetStaticFolderImage (HBITMAP *hSmallImage, HBITMAP *hSmallImageOpen, HBITMAP *hLargeImage, COLORREF *cMask)
STDMETHODIMP | GetStaticFolderImage (HBITMAP *hSmallImage, HBITMAP *hSmallImageOpen, HBITMAP *hLargeImage, COLORREF *cMask)
STDMETHODIMP | GetStaticFolderImage (HBITMAP *hSmallImage, HBITMAP *hSmallImageOpen, HBITMAP *hLargeImage, COLORREF *cMask)
STDMETHODIMP | GetStaticFolderImage (HBITMAP *hSmallImage, HBITMAP *hSmallImageOpen, HBITMAP *hLargeImage, COLORREF *cMask)
STDMETHODIMP | GetStaticFolderImage (HBITMAP *hSmallImage, HBITMAP *hOpenImage, HBITMAP *hLargeImage, COLORREF *cMask)
STDMETHODIMP | GetStaticFolderImage (HBITMAP *hSmallImage, HBITMAP *hSmallImageOpen, HBITMAP *hLargeImage, COLORREF *cMask)
STDMETHODIMP | GetStaticFolderImage (HBITMAP *hSmallImage, HBITMAP *hSmallImageOpen, HBITMAP *hLargeImage, COLORREF *cMask)
STDMETHODIMP | GetStaticFolderImage (HBITMAP *hSmallImage, HBITMAP *hSmallImageOpen, HBITMAP *hLargeImage, COLORREF *cMask)
STDMETHODIMP | GetStaticFolderImage (HBITMAP *hSmallImage, HBITMAP *hSmallImageOpen, HBITMAP *hLargeImage, COLORREF *cMask)
STDMETHODIMP | GetStaticFolderImage (HBITMAP *hSmallImage, HBITMAP *hOpenImage, HBITMAP *hLargeImage, COLORREF *cMask)
STDMETHODIMP | GetStaticFolderImage (HBITMAP *hSmallImage, HBITMAP *hSmallImageOpen, HBITMAP *hLargeImage, COLORREF *cMask)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (ULONG) Release()

Private Member Functions

HRESULT | AllocOleStr (LPOLESTR *lpDest, _TCHAR *szBuffer)
HRESULT | AllocOleStr (LPOLESTR *lpDest, _TCHAR *szBuffer)
HRESULT | AllocOleStr (LPOLESTR *lpDest, _TCHAR *szBuffer)
HRESULT | AllocOleStr (LPOLESTR *lpDest, _TCHAR *szBuffer)
HRESULT | AllocOleStr (LPOLESTR *lpDest, _TCHAR *szBuffer)
HRESULT | AllocOleStr (LPOLESTR *lpDest, _TCHAR *szBuffer)
HRESULT | AllocOleStr (LPOLESTR *lpDest, _TCHAR *szBuffer)
HRESULT | AllocOleStr (LPOLESTR *lpDest, _TCHAR *szBuffer)
HRESULT | AllocOleStr (LPOLESTR *lpDest, _TCHAR *szBuffer)
HRESULT | AllocOleStr (LPOLESTR *lpDest, _TCHAR *szBuffer)
HRESULT | AllocOleStr (LPOLESTR *lpDest, _TCHAR *szBuffer)
HRESULT | AllocOleStr (LPOLESTR *lpDest, _TCHAR *szBuffer)
HRESULT | AllocOleStr (LPOLESTR *lpDest, _TCHAR *szBuffer)
HRESULT | AllocOleStr (LPOLESTR *lpDest, _TCHAR *szBuffer)
HRESULT | AllocOleStr (LPOLESTR *lpDest, _TCHAR *szBuffer)
HRESULT | AllocOleStr (LPOLESTR *lpDest, _TCHAR *szBuffer)
HRESULT | AllocOleStr (LPOLESTR *lpDest, _TCHAR *szBuffer)
HRESULT | AllocOleStr (LPOLESTR *lpDest, _TCHAR *szBuffer)
HRESULT | AllocOleStr (LPOLESTR *lpDest, _TCHAR *szBuffer)

Private Attributes

ULONG m_cref
ULONG m_cRef
HICON | m_hAppIcon
HBITMAP | m_hLargeImage
HBITMAP | m_hOpenImage
HBITMAP | m_hSmallImage
HBITMAP | m_hSmallImageOpen

Detailed Description

Definition at line 25 of file about.h.

Constructor & Destructor Documentation

CSnapinAbout::CSnapinAbout ( )

Definition at line 24 of file about.Cpp.

: m_cref(0)
{
    OBJECT_CREATED

        m_hSmallImage = (HBITMAP)LoadImage(g_hinst, MAKEINTRESOURCE(IDB_SMBMP), IMAGE_BITMAP, 16, 16, LR_LOADTRANSPARENT);
    m_hLargeImage = (HBITMAP)LoadImage(g_hinst, MAKEINTRESOURCE(IDB_LGBMP), IMAGE_BITMAP, 32, 32, LR_LOADTRANSPARENT);

    m_hSmallImageOpen = (HBITMAP)LoadImage(g_hinst, MAKEINTRESOURCE(IDB_SMOPEN), IMAGE_BITMAP, 16, 16, LR_LOADTRANSPARENT);

    m_hAppIcon = LoadIcon(g_hinst, MAKEINTRESOURCE(IDI_ICON1));
}

CSnapinAbout::~CSnapinAbout ( )

Definition at line 37 of file about.Cpp.

{
    if (m_hSmallImage != NULL)
        FreeResource(m_hSmallImage);

    if (m_hLargeImage != NULL)
        FreeResource(m_hLargeImage);

    if (m_hSmallImageOpen != NULL)
        FreeResource(m_hSmallImageOpen);

    if (m_hAppIcon != NULL)
        FreeResource(m_hAppIcon);

    m_hSmallImage = NULL;
    m_hLargeImage = NULL;
    m_hSmallImageOpen = NULL;
    m_hAppIcon = NULL;

    OBJECT_DESTROYED
}

CSnapinAbout::CSnapinAbout ( )
CSnapinAbout::~CSnapinAbout ( )
CSnapinAbout::CSnapinAbout ( )
CSnapinAbout::~CSnapinAbout ( )
CSnapinAbout::CSnapinAbout ( )
CSnapinAbout::~CSnapinAbout ( )
CSnapinAbout::CSnapinAbout ( )
CSnapinAbout::~CSnapinAbout ( )
CSnapinAbout::CSnapinAbout ( )
CSnapinAbout::~CSnapinAbout ( )
CSnapinAbout::CSnapinAbout ( )
CSnapinAbout::~CSnapinAbout ( )
CSnapinAbout::CSnapinAbout ( )
CSnapinAbout::~CSnapinAbout ( )
CSnapinAbout::CSnapinAbout ( )
CSnapinAbout::~CSnapinAbout ( )
CSnapinAbout::CSnapinAbout ( )
CSnapinAbout::~CSnapinAbout ( )
CSnapinAbout::CSnapinAbout ( )
CSnapinAbout::~CSnapinAbout ( )
CSnapinAbout::CSnapinAbout ( )
CSnapinAbout::~CSnapinAbout ( )
CSnapinAbout::CSnapinAbout ( )
CSnapinAbout::~CSnapinAbout ( )
CSnapinAbout::CSnapinAbout ( )
CSnapinAbout::~CSnapinAbout ( )
CSnapinAbout::CSnapinAbout ( )
CSnapinAbout::~CSnapinAbout ( )
CSnapinAbout::CSnapinAbout ( )
CSnapinAbout::~CSnapinAbout ( )
CSnapinAbout::CSnapinAbout ( )
CSnapinAbout::~CSnapinAbout ( )
CSnapinAbout::CSnapinAbout ( )
CSnapinAbout::~CSnapinAbout ( )
CSnapinAbout::CSnapinAbout ( )
CSnapinAbout::~CSnapinAbout ( )
CSnapinAbout::CSnapinAbout ( )
CSnapinAbout::~CSnapinAbout ( )
CSnapinAbout::CSnapinAbout ( )
CSnapinAbout::~CSnapinAbout ( )
CSnapinAbout::CSnapinAbout ( )
CSnapinAbout::~CSnapinAbout ( )
CSnapinAbout::CSnapinAbout ( )
CSnapinAbout::~CSnapinAbout ( )
CSnapinAbout::CSnapinAbout ( )
CSnapinAbout::~CSnapinAbout ( )
CSnapinAbout::CSnapinAbout ( )
CSnapinAbout::~CSnapinAbout ( )
CSnapinAbout::CSnapinAbout ( )
CSnapinAbout::~CSnapinAbout ( )

Member Function Documentation

HRESULT CSnapinAbout::AllocOleStr | ( | LPOLESTR * | lpDest,
 |  | _TCHAR * | szBuffer |
 | ) |  |  | [private]

Definition at line 161 of file about.Cpp.

{
  MAKE_WIDEPTR_FROMTSTR_ALLOC(wszStr, szBuffer);
  *lpDest = wszStr;

    return S_OK;
}

HRESULT CSnapinAbout::AllocOleStr | ( | LPOLESTR * | lpDest,
 |  | _TCHAR * | szBuffer |
 | ) |  |  | [private]
HRESULT CSnapinAbout::AllocOleStr | ( | LPOLESTR * | lpDest,
 |  | _TCHAR * | szBuffer |
 | ) |  |  | [private]
HRESULT CSnapinAbout::AllocOleStr | ( | LPOLESTR * | lpDest,
 |  | _TCHAR * | szBuffer |
 | ) |  |  | [private]
HRESULT CSnapinAbout::AllocOleStr | ( | LPOLESTR * | lpDest,
 |  | _TCHAR * | szBuffer |
 | ) |  |  | [private]
HRESULT CSnapinAbout::AllocOleStr | ( | LPOLESTR * | lpDest,
 |  | _TCHAR * | szBuffer |
 | ) |  |  | [private]
HRESULT CSnapinAbout::AllocOleStr | ( | LPOLESTR * | lpDest,
 |  | _TCHAR * | szBuffer |
 | ) |  |  | [private]
HRESULT CSnapinAbout::AllocOleStr | ( | LPOLESTR * | lpDest,
 |  | _TCHAR * | szBuffer |
 | ) |  |  | [private]
HRESULT CSnapinAbout::AllocOleStr | ( | LPOLESTR * | lpDest,
 |  | _TCHAR * | szBuffer |
 | ) |  |  | [private]
HRESULT CSnapinAbout::AllocOleStr | ( | LPOLESTR * | lpDest,
 |  | _TCHAR * | szBuffer |
 | ) |  |  | [private]
HRESULT CSnapinAbout::AllocOleStr | ( | LPOLESTR * | lpDest,
 |  | _TCHAR * | szBuffer |
 | ) |  |  | [private]
HRESULT CSnapinAbout::AllocOleStr | ( | LPOLESTR * | lpDest,
 |  | _TCHAR * | szBuffer |
 | ) |  |  | [private]
HRESULT CSnapinAbout::AllocOleStr | ( | LPOLESTR * | lpDest,
 |  | _TCHAR * | szBuffer |
 | ) |  |  | [private]
HRESULT CSnapinAbout::AllocOleStr | ( | LPOLESTR * | lpDest,
 |  | _TCHAR * | szBuffer |
 | ) |  |  | [private]
HRESULT CSnapinAbout::AllocOleStr | ( | LPOLESTR * | lpDest,
 |  | _TCHAR * | szBuffer |
 | ) |  |  | [private]
HRESULT CSnapinAbout::AllocOleStr | ( | LPOLESTR * | lpDest,
 |  | _TCHAR * | szBuffer |
 | ) |  |  | [private]
HRESULT CSnapinAbout::AllocOleStr | ( | LPOLESTR * | lpDest,
 |  | _TCHAR * | szBuffer |
 | ) |  |  | [private]
HRESULT CSnapinAbout::AllocOleStr | ( | LPOLESTR * | lpDest,
 |  | _TCHAR * | szBuffer |
 | ) |  |  | [private]
HRESULT CSnapinAbout::AllocOleStr | ( | LPOLESTR * | lpDest,
 |  | _TCHAR * | szBuffer |
 | ) |  |  | [private]
STDMETHODIMP CSnapinAbout::GetProvider ( LPOLESTR * lpName )
STDMETHODIMP CSnapinAbout::GetProvider ( LPOLESTR * pszProvider )
STDMETHODIMP CSnapinAbout::GetProvider ( LPOLESTR * lpName )
STDMETHODIMP CSnapinAbout::GetProvider ( LPOLESTR * lpName )
STDMETHODIMP CSnapinAbout::GetProvider ( LPOLESTR * lpName )

Definition at line 115 of file about.Cpp.

{
    return AllocOleStr(lpName, _T("Copyright © 1999 - 2001 Microsoft Corporation"));;
}

STDMETHODIMP CSnapinAbout::GetProvider ( LPOLESTR * lpName )
STDMETHODIMP CSnapinAbout::GetProvider ( LPOLESTR * lpName )
STDMETHODIMP CSnapinAbout::GetProvider ( LPOLESTR * lpName )
STDMETHODIMP CSnapinAbout::GetProvider ( LPOLESTR * lpName )
STDMETHODIMP CSnapinAbout::GetProvider ( LPOLESTR * lpName )
STDMETHODIMP CSnapinAbout::GetProvider ( LPOLESTR * pszProvider )
STDMETHODIMP CSnapinAbout::GetProvider ( LPOLESTR * lpName )
STDMETHODIMP CSnapinAbout::GetProvider ( LPOLESTR * lpName )
STDMETHODIMP CSnapinAbout::GetProvider ( LPOLESTR * lpName )
STDMETHODIMP CSnapinAbout::GetProvider ( LPOLESTR * pszProvider )
STDMETHODIMP CSnapinAbout::GetProvider ( LPOLESTR * lpName )
STDMETHODIMP CSnapinAbout::GetProvider ( LPOLESTR * lpName )
STDMETHODIMP CSnapinAbout::GetProvider ( LPOLESTR * pszProvider )
STDMETHODIMP CSnapinAbout::GetProvider ( LPOLESTR * lpName )
STDMETHODIMP CSnapinAbout::GetProvider ( LPOLESTR * lpName )
STDMETHODIMP CSnapinAbout::GetProvider ( LPOLESTR * lpName )
STDMETHODIMP CSnapinAbout::GetProvider ( LPOLESTR * pszProvider )
STDMETHODIMP CSnapinAbout::GetProvider ( LPOLESTR * lpName )
STDMETHODIMP CSnapinAbout::GetProvider ( LPOLESTR * pszProvider )
STDMETHODIMP CSnapinAbout::GetProvider ( LPOLESTR * lpName )
STDMETHODIMP CSnapinAbout::GetProvider ( LPOLESTR * pszProvider )
STDMETHODIMP CSnapinAbout::GetSnapinDescription ( LPOLESTR * lpDescription )
STDMETHODIMP CSnapinAbout::GetSnapinDescription ( LPOLESTR * pszDescription )
STDMETHODIMP CSnapinAbout::GetSnapinDescription ( LPOLESTR * lpDescription )
STDMETHODIMP CSnapinAbout::GetSnapinDescription ( LPOLESTR * lpDescription )

Definition at line 104 of file about.Cpp.

{
    _TCHAR szDesc[MAX_PATH];

    LoadString(g_hinst, IDS_SNAPINDESC, szDesc, (sizeof szDesc)/(sizeof szDesc[0]));

    return AllocOleStr(lpDescription, szDesc);
}

STDMETHODIMP CSnapinAbout::GetSnapinDescription ( LPOLESTR * lpDescription )
STDMETHODIMP CSnapinAbout::GetSnapinDescription ( LPOLESTR * lpDescription )
STDMETHODIMP CSnapinAbout::GetSnapinDescription ( LPOLESTR * lpDescription )
STDMETHODIMP CSnapinAbout::GetSnapinDescription ( LPOLESTR * lpDescription )
STDMETHODIMP CSnapinAbout::GetSnapinDescription ( LPOLESTR * lpDescription )
STDMETHODIMP CSnapinAbout::GetSnapinDescription ( LPOLESTR * lpDescription )
STDMETHODIMP CSnapinAbout::GetSnapinDescription ( LPOLESTR * pszDescription )
STDMETHODIMP CSnapinAbout::GetSnapinDescription ( LPOLESTR * lpDescription )
STDMETHODIMP CSnapinAbout::GetSnapinDescription ( LPOLESTR * lpDescription )
STDMETHODIMP CSnapinAbout::GetSnapinDescription ( LPOLESTR * lpDescription )
STDMETHODIMP CSnapinAbout::GetSnapinDescription ( LPOLESTR * pszDescription )
STDMETHODIMP CSnapinAbout::GetSnapinDescription ( LPOLESTR * lpDescription )
STDMETHODIMP CSnapinAbout::GetSnapinDescription ( LPOLESTR * pszDescription )
STDMETHODIMP CSnapinAbout::GetSnapinDescription ( LPOLESTR * lpDescription )
STDMETHODIMP CSnapinAbout::GetSnapinDescription ( LPOLESTR * lpDescription )
STDMETHODIMP CSnapinAbout::GetSnapinDescription ( LPOLESTR * lpDescription )
STDMETHODIMP CSnapinAbout::GetSnapinDescription ( LPOLESTR * pszDescription )
STDMETHODIMP CSnapinAbout::GetSnapinDescription ( LPOLESTR * lpDescription )
STDMETHODIMP CSnapinAbout::GetSnapinDescription ( LPOLESTR * pszDescription )
STDMETHODIMP CSnapinAbout::GetSnapinDescription ( LPOLESTR * lpDescription )
STDMETHODIMP CSnapinAbout::GetSnapinDescription ( LPOLESTR * pszDescription )
STDMETHODIMP CSnapinAbout::GetSnapinDescription ( LPOLESTR * lpDescription )
STDMETHODIMP CSnapinAbout::GetSnapinImage ( HICON * hAppIcon )
STDMETHODIMP CSnapinAbout::GetSnapinImage ( HICON * hAppIcon )
STDMETHODIMP CSnapinAbout::GetSnapinImage ( HICON * hAppIcon )
STDMETHODIMP CSnapinAbout::GetSnapinImage ( HICON * hAppIcon )
STDMETHODIMP CSnapinAbout::GetSnapinImage ( HICON * hAppIcon )
STDMETHODIMP CSnapinAbout::GetSnapinImage ( HICON * hAppIcon )
STDMETHODIMP CSnapinAbout::GetSnapinImage ( HICON * hAppIcon )
STDMETHODIMP CSnapinAbout::GetSnapinImage ( HICON * hAppIcon )
STDMETHODIMP CSnapinAbout::GetSnapinImage ( HICON * hAppIcon )
STDMETHODIMP CSnapinAbout::GetSnapinImage ( HICON * hAppIcon )
STDMETHODIMP CSnapinAbout::GetSnapinImage ( HICON * hAppIcon )
STDMETHODIMP CSnapinAbout::GetSnapinImage ( HICON * hAppIcon )
STDMETHODIMP CSnapinAbout::GetSnapinImage ( HICON * hAppIcon )
STDMETHODIMP CSnapinAbout::GetSnapinImage ( HICON * hAppIcon )
STDMETHODIMP CSnapinAbout::GetSnapinImage ( HICON * hAppIcon )
STDMETHODIMP CSnapinAbout::GetSnapinImage ( HICON * hAppIcon )
STDMETHODIMP CSnapinAbout::GetSnapinImage ( HICON * hAppIcon )
STDMETHODIMP CSnapinAbout::GetSnapinImage ( HICON * hAppIcon )
STDMETHODIMP CSnapinAbout::GetSnapinImage ( HICON * hAppIcon )
STDMETHODIMP CSnapinAbout::GetSnapinImage ( HICON * hAppIcon )
STDMETHODIMP CSnapinAbout::GetSnapinImage ( HICON * hAppIcon )
STDMETHODIMP CSnapinAbout::GetSnapinImage ( HICON * hAppIcon )

Definition at line 129 of file about.Cpp.

{
    *hAppIcon = m_hAppIcon;

    if (*hAppIcon == NULL)
        return E_FAIL;
    else
        return S_OK;
}

STDMETHODIMP CSnapinAbout::GetSnapinImage ( HICON * hAppIcon )
STDMETHODIMP CSnapinAbout::GetSnapinImage ( HICON * hAppIcon )
STDMETHODIMP CSnapinAbout::GetSnapinImage ( HICON * hAppIcon )
STDMETHODIMP CSnapinAbout::GetSnapinImage ( HICON * hAppIcon )
STDMETHODIMP CSnapinAbout::GetSnapinVersion ( LPOLESTR * lpVersion )
STDMETHODIMP CSnapinAbout::GetSnapinVersion ( LPOLESTR * lpVersion )
STDMETHODIMP CSnapinAbout::GetSnapinVersion ( LPOLESTR * pszVersion )
STDMETHODIMP CSnapinAbout::GetSnapinVersion ( LPOLESTR * lpVersion )
STDMETHODIMP CSnapinAbout::GetSnapinVersion ( LPOLESTR * lpVersion )
STDMETHODIMP CSnapinAbout::GetSnapinVersion ( LPOLESTR * pszVersion )
STDMETHODIMP CSnapinAbout::GetSnapinVersion ( LPOLESTR * lpVersion )
STDMETHODIMP CSnapinAbout::GetSnapinVersion ( LPOLESTR * lpVersion )
STDMETHODIMP CSnapinAbout::GetSnapinVersion ( LPOLESTR * lpVersion )
STDMETHODIMP CSnapinAbout::GetSnapinVersion ( LPOLESTR * lpVersion )
STDMETHODIMP CSnapinAbout::GetSnapinVersion ( LPOLESTR * pszVersion )
STDMETHODIMP CSnapinAbout::GetSnapinVersion ( LPOLESTR * lpVersion )
STDMETHODIMP CSnapinAbout::GetSnapinVersion ( LPOLESTR * lpVersion )
STDMETHODIMP CSnapinAbout::GetSnapinVersion ( LPOLESTR * pszVersion )
STDMETHODIMP CSnapinAbout::GetSnapinVersion ( LPOLESTR * lpVersion )
STDMETHODIMP CSnapinAbout::GetSnapinVersion ( LPOLESTR * pszVersion )
STDMETHODIMP CSnapinAbout::GetSnapinVersion ( LPOLESTR * lpVersion )
STDMETHODIMP CSnapinAbout::GetSnapinVersion ( LPOLESTR * lpVersion )
STDMETHODIMP CSnapinAbout::GetSnapinVersion ( LPOLESTR * lpVersion )
STDMETHODIMP CSnapinAbout::GetSnapinVersion ( LPOLESTR * lpVersion )
STDMETHODIMP CSnapinAbout::GetSnapinVersion ( LPOLESTR * lpVersion )
STDMETHODIMP CSnapinAbout::GetSnapinVersion ( LPOLESTR * lpVersion )

Definition at line 122 of file about.Cpp.

{
    return AllocOleStr(lpVersion, _T("1.0"));;
}

STDMETHODIMP CSnapinAbout::GetSnapinVersion ( LPOLESTR * pszVersion )
STDMETHODIMP CSnapinAbout::GetSnapinVersion ( LPOLESTR * lpVersion )
STDMETHODIMP CSnapinAbout::GetSnapinVersion ( LPOLESTR * lpVersion )
STDMETHODIMP CSnapinAbout::GetSnapinVersion ( LPOLESTR * pszVersion )
STDMETHODIMP CSnapinAbout::GetStaticFolderImage | ( | HBITMAP * | hSmallImage,
 |  | HBITMAP * | hOpenImage,
 |  | HBITMAP * | hLargeImage,
 |  | COLORREF * | cMask
 | ) |  |
STDMETHODIMP CSnapinAbout::GetStaticFolderImage | ( | HBITMAP * | hSmallImage,
 |  | HBITMAP * | hOpenImage,
 |  | HBITMAP * | hLargeImage,
 |  | COLORREF * | cMask
 | ) |  |
STDMETHODIMP CSnapinAbout::GetStaticFolderImage | ( | HBITMAP * | hSmallImage,
 |  | HBITMAP * | hOpenImage,
 |  | HBITMAP * | hLargeImage,
 |  | COLORREF * | cMask
 | ) |  |
STDMETHODIMP CSnapinAbout::GetStaticFolderImage | ( | HBITMAP * | hSmallImage,
 |  | HBITMAP * | hSmallImageOpen,
 |  | HBITMAP * | hLargeImage,
 |  | COLORREF * | cMask
 | ) |  |
STDMETHODIMP CSnapinAbout::GetStaticFolderImage | ( | HBITMAP * | hSmallImage,
 |  | HBITMAP * | hSmallImageOpen,
 |  | HBITMAP * | hLargeImage,
 |  | COLORREF * | cMask
 | ) |  |
STDMETHODIMP CSnapinAbout::GetStaticFolderImage | ( | HBITMAP * | hSmallImage,
 |  | HBITMAP * | hSmallImageOpen,
 |  | HBITMAP * | hLargeImage,
 |  | COLORREF * | cMask
 | ) |  |
STDMETHODIMP CSnapinAbout::GetStaticFolderImage | ( | HBITMAP * | hSmallImage,
 |  | HBITMAP * | hSmallImageOpen,
 |  | HBITMAP * | hLargeImage,
 |  | COLORREF * | cMask
 | ) |  |

Definition at line 141 of file about.Cpp.

{
    *hSmallImage = m_hSmallImage;
    *hLargeImage = m_hLargeImage;

    *hSmallImageOpen = m_hSmallImageOpen;

    *cMask = RGB(0, 128, 128);

    if (*hSmallImage == NULL || *hLargeImage == NULL || *hSmallImageOpen == NULL)
        return E_FAIL;
    else
        return S_OK;
}

STDMETHODIMP CSnapinAbout::GetStaticFolderImage | ( | HBITMAP * | hSmallImage,
 |  | HBITMAP * | hSmallImageOpen,
 |  | HBITMAP * | hLargeImage,
 |  | COLORREF * | cMask
 | ) |  |
STDMETHODIMP CSnapinAbout::GetStaticFolderImage | ( | HBITMAP * | hSmallImage,
 |  | HBITMAP * | hSmallImageOpen,
 |  | HBITMAP * | hLargeImage,
 |  | COLORREF * | cMask
 | ) |  |
STDMETHODIMP CSnapinAbout::GetStaticFolderImage | ( | HBITMAP * | hSmallImage,
 |  | HBITMAP * | hOpenImage,
 |  | HBITMAP * | hLargeImage,
 |  | COLORREF * | cMask
 | ) |  |
STDMETHODIMP CSnapinAbout::GetStaticFolderImage | ( | HBITMAP * | hSmallImage,
 |  | HBITMAP * | hSmallImageOpen,
 |  | HBITMAP * | hLargeImage,
 |  | COLORREF * | cMask
 | ) |  |
STDMETHODIMP CSnapinAbout::GetStaticFolderImage | ( | HBITMAP * | hSmallImage,
 |  | HBITMAP * | hSmallImageOpen,
 |  | HBITMAP * | hLargeImage,
 |  | COLORREF * | cMask
 | ) |  |
STDMETHODIMP CSnapinAbout::GetStaticFolderImage | ( | HBITMAP * | hSmallImage,
 |  | HBITMAP * | hSmallImageOpen,
 |  | HBITMAP * | hLargeImage,
 |  | COLORREF * | cMask
 | ) |  |
STDMETHODIMP CSnapinAbout::GetStaticFolderImage | ( | HBITMAP * | hSmallImage,
 |  | HBITMAP * | hSmallImageOpen,
 |  | HBITMAP * | hLargeImage,
 |  | COLORREF * | cMask
 | ) |  |
STDMETHODIMP CSnapinAbout::GetStaticFolderImage | ( | HBITMAP * | hSmallImage,
 |  | HBITMAP * | hSmallImageOpen,
 |  | HBITMAP * | hLargeImage,
 |  | COLORREF * | cMask
 | ) |  |
STDMETHODIMP CSnapinAbout::GetStaticFolderImage | ( | HBITMAP * | hSmallImage,
 |  | HBITMAP * | hSmallImageOpen,
 |  | HBITMAP * | hLargeImage,
 |  | COLORREF * | cMask
 | ) |  |
STDMETHODIMP CSnapinAbout::GetStaticFolderImage | ( | HBITMAP * | hSmallImage,
 |  | HBITMAP * | hOpenImage,
 |  | HBITMAP * | hLargeImage,
 |  | COLORREF * | cMask
 | ) |  |
STDMETHODIMP CSnapinAbout::GetStaticFolderImage | ( | HBITMAP * | hSmallImage,
 |  | HBITMAP * | hSmallImageOpen,
 |  | HBITMAP * | hLargeImage,
 |  | COLORREF * | cMask
 | ) |  |
STDMETHODIMP CSnapinAbout::GetStaticFolderImage | ( | HBITMAP * | hSmallImage,
 |  | HBITMAP * | hSmallImageOpen,
 |  | HBITMAP * | hLargeImage,
 |  | COLORREF * | cMask
 | ) |  |
STDMETHODIMP CSnapinAbout::GetStaticFolderImage | ( | HBITMAP * | hSmallImage,
 |  | HBITMAP * | hOpenImage,
 |  | HBITMAP * | hLargeImage,
 |  | COLORREF * | cMask
 | ) |  |
STDMETHODIMP CSnapinAbout::GetStaticFolderImage | ( | HBITMAP * | hSmallImage,
 |  | HBITMAP * | hSmallImageOpen,
 |  | HBITMAP * | hLargeImage,
 |  | COLORREF * | cMask
 | ) |  |
STDMETHODIMP CSnapinAbout::GetStaticFolderImage | ( | HBITMAP * | hSmallImage,
 |  | HBITMAP * | hSmallImageOpen,
 |  | HBITMAP * | hLargeImage,
 |  | COLORREF * | cMask
 | ) |  |
STDMETHODIMP CSnapinAbout::GetStaticFolderImage | ( | HBITMAP * | hSmallImage,
 |  | HBITMAP * | hSmallImageOpen,
 |  | HBITMAP * | hLargeImage,
 |  | COLORREF * | cMask
 | ) |  |
STDMETHODIMP CSnapinAbout::GetStaticFolderImage | ( | HBITMAP * | hSmallImage,
 |  | HBITMAP * | hSmallImageOpen,
 |  | HBITMAP * | hLargeImage,
 |  | COLORREF * | cMask
 | ) |  |
STDMETHODIMP CSnapinAbout::GetStaticFolderImage | ( | HBITMAP * | hSmallImage,
 |  | HBITMAP * | hOpenImage,
 |  | HBITMAP * | hLargeImage,
 |  | COLORREF * | cMask
 | ) |  |
STDMETHODIMP CSnapinAbout::GetStaticFolderImage | ( | HBITMAP * | hSmallImage,
 |  | HBITMAP * | hSmallImageOpen,
 |  | HBITMAP * | hLargeImage,
 |  | COLORREF * | cMask
 | ) |  |
STDMETHODIMP CSnapinAbout::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CSnapinAbout::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CSnapinAbout::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CSnapinAbout::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CSnapinAbout::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CSnapinAbout::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CSnapinAbout::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CSnapinAbout::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CSnapinAbout::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CSnapinAbout::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CSnapinAbout::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CSnapinAbout::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CSnapinAbout::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CSnapinAbout::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CSnapinAbout::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CSnapinAbout::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CSnapinAbout::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CSnapinAbout::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 63 of file about.Cpp.

{
    if (!ppv)
        return E_FAIL;

    *ppv = NULL;

    if (IsEqualIID(riid, IID_IUnknown))
        *ppv = static_cast<ISnapinAbout *>(this);
    else if (IsEqualIID(riid, IID_ISnapinAbout))
        *ppv = static_cast<ISnapinAbout *>(this);

    if (*ppv)
    {
        reinterpret_cast<IUnknown *>(*ppv)->AddRef();
        return S_OK;
    }

    return E_NOINTERFACE;
}

STDMETHODIMP CSnapinAbout::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CSnapinAbout::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CSnapinAbout::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CSnapinAbout::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CSnapinAbout::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CSnapinAbout::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CSnapinAbout::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
STDMETHODIMP CSnapinAbout::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )
CSnapinAbout::STDMETHODIMP_ ( ULONG )

Member Data Documentation

ULONG CSnapinAbout::m_cref [private]

Definition at line 28 of file about.h.

ULONG CSnapinAbout::m_cRef [private]

Definition at line 27 of file about.h.

HICON CSnapinAbout::m_hAppIcon [private]

Definition at line 32 of file about.h.

HBITMAP CSnapinAbout::m_hLargeImage [private]

Definition at line 30 of file about.h.

HBITMAP CSnapinAbout::m_hOpenImage [private]

Definition at line 30 of file about.h.

HBITMAP CSnapinAbout::m_hSmallImage [private]

Definition at line 29 of file about.h.

HBITMAP CSnapinAbout::m_hSmallImageOpen [private]

Definition at line 31 of file about.h.

The documentation for this class was generated from the following files:
  • SysMgmt/MMC/About/about.h
  • SysMgmt/MMC/ActiveX/about.h
  • SysMgmt/MMC/CMenu/about.h
  • SysMgmt/MMC/CMenuExt/about.h
  • SysMgmt/MMC/Complete/about.h
  • SysMgmt/MMC/CutCopy/about.h
  • SysMgmt/MMC/Extens/about.h
  • SysMgmt/MMC/Help/About.h
  • SysMgmt/MMC/Menubtn/about.h
  • SysMgmt/MMC/mmc2.0/about/about.h
  • SysMgmt/MMC/mmc2.0/contextmenu/about.h
  • SysMgmt/MMC/mmc2.0/dragdrop/about.h
  • SysMgmt/MMC/mmc2.0/help/about.h
  • SysMgmt/MMC/mmc2.0/multisel/about.h
  • SysMgmt/MMC/mmc2.0/proppage/about.h
  • SysMgmt/MMC/mmc2.0/viewex/about.h
  • SysMgmt/MMC/Multisel/about.h
  • SysMgmt/MMC/Nameext/about.h
  • SysMgmt/MMC/Nodes/about.h
  • SysMgmt/MMC/Openserv/about.h
  • SysMgmt/MMC/Ppgeext/about.h
  • SysMgmt/MMC/Proppage/about.h
  • SysMgmt/MMC/Taskpads/about.h
  • SysMgmt/MMC/Tbarext/about.h
  • SysMgmt/MMC/Toolbar/about.h
  • SysMgmt/MMC/WMI/about.h
  • SysMgmt/MMC/About/about.Cpp
  • SysMgmt/MMC/ActiveX/about.Cpp
  • SysMgmt/MMC/CMenu/about.Cpp
  • SysMgmt/MMC/CMenuExt/about.Cpp
  • SysMgmt/MMC/Complete/about.Cpp
  • SysMgmt/MMC/CutCopy/about.Cpp
  • SysMgmt/MMC/Extens/about.Cpp
  • SysMgmt/MMC/Help/About.Cpp
  • SysMgmt/MMC/Menubtn/about.Cpp
  • SysMgmt/MMC/mmc2.0/about/about.cpp
  • SysMgmt/MMC/mmc2.0/contextmenu/about.cpp
  • SysMgmt/MMC/mmc2.0/dragdrop/about.cpp
  • SysMgmt/MMC/mmc2.0/help/about.cpp
  • SysMgmt/MMC/mmc2.0/multisel/about.cpp
  • SysMgmt/MMC/mmc2.0/proppage/about.cpp
  • SysMgmt/MMC/mmc2.0/viewex/about.cpp
  • SysMgmt/MMC/Multisel/about.Cpp
  • SysMgmt/MMC/Nameext/about.Cpp
  • SysMgmt/MMC/Nodes/about.Cpp
  • SysMgmt/MMC/Openserv/about.Cpp
  • SysMgmt/MMC/Ppgeext/about.Cpp
  • SysMgmt/MMC/Proppage/about.Cpp
  • SysMgmt/MMC/Taskpads/about.Cpp
  • SysMgmt/MMC/Tbarext/about.Cpp
  • SysMgmt/MMC/Toolbar/about.Cpp
  • SysMgmt/MMC/WMI/about.Cpp
Generated on Wed Nov 13 2024 16:57:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSnoopWnd Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes

CSnoopWnd Class Reference

#include "snoop.h"

List of all members.

Public Member Functions

CSnoopWnd (CCaseTextService *pCase)
void | _Hide ()
BOOL _Init ()
void | _Show ()
void | _Uninit ()
void | _UpdateText (ITfRange *pRange)
void | _UpdateText (TfEditCookie ec, ITfContext *pContext, ITfRange *pRange)

Static Public Member Functions

static BOOL | _InitClass ()
static void | _UninitClass ()

Private Member Functions

void | _OnPaint (HWND hWnd, HDC hdc)

Static Private Member Functions

static CSnoopWnd * | _GetThis (HWND hWnd)
static void | _SetThis (HWND hWnd, LPARAM lParam)
static LRESULT CALLBACK | _WndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)

Private Attributes

WCHAR | _achText [MAX_SNOOP_TEXT]
ULONG _cchText
HWND | _hWnd
CCaseTextService * _pCase
friend | CUpdateTextEditSession

Static Private Attributes

static ATOM | _atomWndClass = 0

Detailed Description

Definition at line 15 of file snoop.h.

Constructor & Destructor Documentation

CSnoopWnd::CSnoopWnd ( CCaseTextService * pCase )

Definition at line 52 of file snoop.cpp.

{
    _pCase = pCase; // no AddRef because CSnoopWnd is contained in the
                    // pCase lifetime
    _hWnd = NULL;
    _cchText = 0;
}

Member Function Documentation

static CSnoopWnd* CSnoopWnd::_GetThis ( HWND hWnd ) [inline, static, private]

Definition at line 45 of file snoop.h.

    {
        return (CSnoopWnd *)GetWindowLongPtr(hWnd, GWLP_USERDATA);
    }

void CSnoopWnd::_Hide ( )

Definition at line 162 of file snoop.cpp.

{
    ShowWindow(_hWnd, SW_HIDE);
}

BOOL CSnoopWnd::_Init ( )

Definition at line 109 of file snoop.cpp.

{
    // nb: on windows 2000, you can use WS_EX_NOACTIVATE to prevent windows
    // from taking the foreground.  We don't use that here for compatibility.
    // Instead, we use WS_DISABLED, which can be burdensome for more complex
    // ui.

    _hWnd = CreateWindowEx(WS_EX_TOPMOST | WS_EX_TOOLWINDOW,
                           (LPCTSTR)_atomWndClass,
                           TEXT("Snoop Window"),
                           WS_BORDER | WS_DISABLED | WS_POPUP,
                           SNOOP_X_POS, SNOOP_Y_POS,
                           SNOOP_WIDTH, SNOOP_HEIGHT,
                           NULL,
                           NULL,
                           g_hInst,
                           this);

    return (_hWnd != NULL);
}

BOOL CSnoopWnd::_InitClass ( ) [static]

Definition at line 67 of file snoop.cpp.

{
    WNDCLASS wc;

    wc.style = 0;
    wc.lpfnWndProc = CSnoopWnd::_WndProc;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = 0;
    wc.hInstance = g_hInst;
    wc.hIcon = NULL;
    wc.hCursor = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = NULL;
    wc.lpszMenuName = NULL;
    wc.lpszClassName = TEXT("SnoopWndClass");

    _atomWndClass = RegisterClass(&wc);

    return (_atomWndClass != 0);
}

void CSnoopWnd::_OnPaint | ( | HWND | hWnd,
 |  | HDC | hdc |
 | ) |  |  | [private]

Definition at line 312 of file snoop.cpp.

{
    RECT rc;

    // background
    GetClientRect(hWnd, &rc);
    FillRect(hdc, &rc, (HBRUSH)GetStockObject(LTGRAY_BRUSH));

    // text
    TextOutW(hdc, 0, 0, _achText, _cchText);
}

static void CSnoopWnd::_SetThis | ( | HWND | hWnd,
 |  | LPARAM | lParam |
 | ) |  |  | [inline, static, private]

Definition at line 39 of file snoop.h.

    {
        SetWindowLongPtr(hWnd, GWLP_USERDATA,
                      (LONG_PTR)((CREATESTRUCT *)lParam)->lpCreateParams);
    }

void CSnoopWnd::_Show ( )

Definition at line 151 of file snoop.cpp.

{
    ShowWindow(_hWnd, SW_SHOWNA);
}

void CSnoopWnd::_Uninit ( )

Definition at line 136 of file snoop.cpp.

{
    if (_hWnd != NULL)
    {
        DestroyWindow(_hWnd);
        _hWnd = NULL;
    }
}

void CSnoopWnd::_UninitClass ( ) [static]

Definition at line 94 of file snoop.cpp.

{
    if (_atomWndClass != 0)
    {
        UnregisterClass((LPCTSTR)_atomWndClass, g_hInst);
    }
}

void CSnoopWnd::_UpdateText | ( | TfEditCookie | ec,
 |  | ITfContext * | pContext,
 |  | ITfRange * | pRange
 | ) |  |

Definition at line 227 of file snoop.cpp.

{
    LONG cchBefore;
    LONG cchAfter;
    TF_SELECTION tfSelection;
    ULONG cFetched;
    BOOL fReleaseRange = FALSE;

    if (pRange == NULL)
    {
        // caller wants us to use the selection
        if (pContext->GetSelection(ec, TS_DEFAULT_SELECTION, 1, &tfSelection, &cFetched) != S_OK ||
            cFetched != 1)
        {
            return;
        }

        pRange = tfSelection.range; // no AddRef, take ownership of the pointer
        fReleaseRange = TRUE;
    }

    // arbitrarily grab some text before and after the range start anchor

    pRange->Collapse(ec, TF_ANCHOR_START);

    pRange->ShiftStart(ec, -MAX_SNOOP_TEXT / 2, &cchBefore, NULL);

    cchBefore = -cchBefore; // we shifted backwards, so make count a positive number

    pRange->GetText(ec, 0, _achText, cchBefore, (ULONG *)&cchBefore);

    pRange->Collapse(ec, TF_ANCHOR_END);

    pRange->ShiftEnd(ec, MAX_SNOOP_TEXT - cchBefore, &cchAfter, NULL);

    pRange->GetText(ec, 0, _achText + cchBefore, cchAfter, (ULONG *)&cchAfter);

    _cchText = cchBefore + cchAfter;

    // force a repaint

    InvalidateRect(_hWnd, NULL, TRUE);

    if (fReleaseRange)
    {
        pRange->Release();
    }
}

void CSnoopWnd::_UpdateText ( ITfRange * pRange )

Definition at line 173 of file snoop.cpp.

{
    ITfDocumentMgr *pdmFocus;
    ITfContext *pContext;
    CUpdateTextEditSession *pEditSession;
    HRESULT hr;

    if (pRange == NULL)
    {
        // caller wants us to just use the selection in the focus doc
        if (_pCase->_GetThreadMgr()->GetFocus(&pdmFocus) != S_OK)
            return;

        hr = pdmFocus->GetTop(&pContext);

        pdmFocus->Release();

        if (hr != S_OK)
            return;
    }
    else if (pRange->GetContext(&pContext) != S_OK)
        return;

    if (pEditSession = new CUpdateTextEditSession(pContext, pRange, this))
    {
        // we need a document read lock to scan text
        // the CUpdateTextEditSession will do all the work when the
        // CUpdateTextEditSession::DoEditSession method is called by the context
        pContext->RequestEditSession(_pCase->_GetClientId(), pEditSession, TF_ES_READ | TF_ES_ASYNCDONTCARE, &hr);

        pEditSession->Release();
    }

    pContext->Release();
}

LRESULT CALLBACK CSnoopWnd::_WndProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static, private]

Definition at line 284 of file snoop.cpp.

{
    HDC hdc;
    PAINTSTRUCT ps;

    switch (uMsg)
    {
        case WM_CREATE:
            _SetThis(hWnd, lParam);
            return 0;

        case WM_PAINT:
            hdc = BeginPaint(hWnd, &ps);
            _GetThis(hWnd)->_OnPaint(hWnd, hdc);
            EndPaint(hWnd, &ps);
            return 0;
    }

    return DefWindowProc(hWnd, uMsg, wParam, lParam);
}

Member Data Documentation

WCHAR CSnoopWnd::_achText[MAX_SNOOP_TEXT] [private]

Definition at line 53 of file snoop.h.

ATOM CSnoopWnd::_atomWndClass = 0 [static, private]

Definition at line 54 of file snoop.h.

ULONG CSnoopWnd::_cchText [private]

Definition at line 52 of file snoop.h.

HWND CSnoopWnd::_hWnd [private]

Definition at line 51 of file snoop.h.

CCaseTextService* CSnoopWnd::_pCase [private]

Definition at line 50 of file snoop.h.

friend CSnoopWnd::CUpdateTextEditSession [private]

Definition at line 34 of file snoop.h.

The documentation for this class was generated from the following files:
  • WinUI/TSFcase/snoop.h
  • WinUI/TSFcase/snoop.cpp
Generated on Wed Nov 13 2024 16:57:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSpaceFolder Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Types | Private Attributes | Static Private Attributes

CSpaceFolder Class Reference

#include "space.h"

Inherits CDelegationBase, and CDelegationBase.

List of all members.

Public Member Functions

CSpaceFolder ()
CSpaceFolder ()
virtual | ~CSpaceFolder ()
virtual | ~CSpaceFolder ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual HRESULT | OnExpand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
virtual HRESULT | OnExpand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)

Private Types

enum | { IDM_NEW_SPACE = 4 }
enum | { NUMBER_OF_CHILDREN = 4 }
enum | { IDM_NEW_SPACE = 4 }
enum | { NUMBER_OF_CHILDREN = 4 }

Private Attributes

CSpaceStation * | children [NUMBER_OF_CHILDREN]

Static Private Attributes

static const GUID | thisGuid = { 0x29743810, 0x4c4b, 0x11d2, { 0x89, 0xd8, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28 } }

Detailed Description

Definition at line 103 of file space.h.

Member Enumeration Documentation

anonymous enum [private]
Enumerator:
IDM_NEW_SPACE

Definition at line 118 of file space.h.

{ IDM_NEW_SPACE = 4 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 124 of file space.h.

{ NUMBER_OF_CHILDREN = 4 };

anonymous enum [private]
Enumerator:
IDM_NEW_SPACE

Definition at line 112 of file space.h.

{ IDM_NEW_SPACE = 4 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 118 of file space.h.

{ NUMBER_OF_CHILDREN = 1 };

Constructor & Destructor Documentation

CSpaceFolder::CSpaceFolder ( )

Definition at line 35 of file space.Cpp.

{
    for (int n = 0; n < NUMBER_OF_CHILDREN; n++) {
        children[n] = new CSpaceStation();
    }
}

CSpaceFolder::~CSpaceFolder ( ) [virtual]

Definition at line 42 of file space.Cpp.

{
    for (int n = 0; n < NUMBER_OF_CHILDREN; n++)
        if (children[n]) {
            delete children[n];
        }
}

CSpaceFolder::CSpaceFolder ( )
virtual CSpaceFolder::~CSpaceFolder ( ) [virtual]

Member Function Documentation

virtual const int CSpaceFolder::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 111 of file space.h.

{ return INDEX_SPACEICON; }

virtual const int CSpaceFolder::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 105 of file space.h.

{ return INDEX_SPACEICON; }

virtual const _TCHAR* CSpaceFolder::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 103 of file space.h.

{ return _T("Space Vehicles"); }

virtual const _TCHAR* CSpaceFolder::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 109 of file space.h.

{ return _T("Space Vehicles"); }

virtual const GUID& CSpaceFolder::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 110 of file space.h.

{ return thisGuid; }

virtual const GUID& CSpaceFolder::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 104 of file space.h.

{ return thisGuid; }

HRESULT CSpaceFolder::OnExpand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 50 of file space.Cpp.

{
    SCOPEDATAITEM sdi;

    if (!bExpanded) {
        // create the child nodes, then expand them
        for (int n = 0; n < NUMBER_OF_CHILDREN; n++) {
            ZeroMemory(&sdi, sizeof(SCOPEDATAITEM) );
            sdi.mask = SDI_STR       |   // Displayname is valid
                SDI_PARAM     |   // lParam is valid
                SDI_IMAGE     |   // nImage is valid
                SDI_OPENIMAGE |   // nOpenImage is valid
                SDI_PARENT    |
                SDI_CHILDREN;

            sdi.relativeID  = (HSCOPEITEM)parent;
            sdi.nImage      = children[n]->GetBitmapIndex();
            sdi.nOpenImage  = INDEX_OPENFOLDER;
            sdi.displayname = MMC_CALLBACK;
            sdi.lParam      = (LPARAM)children[n];       // The cookie
            sdi.cChildren   = 0;

            HRESULT hr = pConsoleNameSpace->InsertItem( &sdi );

            _ASSERT( SUCCEEDED(hr) );

                    children[n]->SetHandle((HANDLE)sdi.ID);
        }
    }

    return S_OK;
}

virtual HRESULT CSpaceFolder::OnExpand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Member Data Documentation

CSpaceStation * CSpaceFolder::children [private]

Definition at line 125 of file space.h.

static const GUID CSpaceFolder::thisGuid = { 0x29743810, 0x4c4b, 0x11d2, { 0x89, 0xd8, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28 } } [static, private]

Reimplemented from CDelegationBase.

Definition at line 121 of file space.h.

The documentation for this class was generated from the following files:
  • SysMgmt/MMC/CutCopy/space.h
  • SysMgmt/MMC/Multisel/space.h
  • SysMgmt/MMC/CutCopy/space.Cpp
  • SysMgmt/MMC/Multisel/space.Cpp
Generated on Wed Nov 13 2024 16:57:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSpaceStation Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes

CSpaceStation Class Reference

#include "space.h"

Inherits CDelegationBase, and CDelegationBase.

List of all members.

Public Member Functions

CSpaceStation ()
CSpaceStation ()
virtual | ~CSpaceStation ()
virtual | ~CSpaceStation ()
void | DecrementCountChildSpaceStations ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
int | GetCountChildSpaceStations ()
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual HRESULT | GetResultViewType (LPOLESTR *ppViewType, long *pViewOptions)
virtual HRESULT | GetResultViewType (LPOLESTR *ppViewType, long *pViewOptions)
virtual HRESULT | OnDeleteScopeItem (IConsoleNameSpace *pConsoleNameSpace)
virtual HRESULT | OnPaste (IConsole *pConsole, CComponentData *pComponentData, CDelegationBase *pPasted)
virtual HRESULT | OnQueryPaste (CDelegationBase *pPasted)
virtual HRESULT | OnSelect (IConsole *pConsole, BOOL bScope, BOOL bSelect)
virtual HRESULT | OnSelect (IConsole *pConsole, BOOL bScope, BOOL bSelect)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnUpdateItem (IConsole *pConsole, long item, ITEM_TYPE itemtype)
virtual HRESULT | OnUpdateItem (IConsole *pConsole, long item, ITEM_TYPE itemtype)

Private Types

enum | { NUMBER_OF_CHILDREN = 9, MAX_CHILDREN = 20 }
enum | { NUMBER_OF_CHILDREN = 9, MAX_CHILDREN = 20 }

Private Member Functions

HRESULT | Expand (IConsoleNameSpace *pConsoleNameSpace)

Private Attributes

CRocket * | children [MAX_CHILDREN]
int | m_cChildSpaceStations
CComponentData * m_pComponentData

Static Private Attributes

static const GUID | thisGuid = { 0x62273a12, 0x1914, 0x11d3, { 0x9a, 0x38, 0x0, 0x80, 0xc7, 0x25, 0x80, 0x72 } }

Detailed Description

Definition at line 66 of file space.h.

Member Enumeration Documentation

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN
MAX_CHILDREN

Definition at line 93 of file space.h.

{ NUMBER_OF_CHILDREN = 9, MAX_CHILDREN = 20 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN
MAX_CHILDREN

Definition at line 92 of file space.h.

{ NUMBER_OF_CHILDREN = 9, MAX_CHILDREN = 20 };

Constructor & Destructor Documentation

CSpaceStation::CSpaceStation ( )

Definition at line 88 of file space.Cpp.

                             : m_cChildSpaceStations(0)
{
    for (int n = 0; n < MAX_CHILDREN; n++) {
        children[n] = NULL;
    }

    for (n = 0; n < NUMBER_OF_CHILDREN; n++) {
        children[n] = new CRocket(this, _T("Rocket"), n, 350115, 320, 52300);
    }
}

CSpaceStation::~CSpaceStation ( ) [virtual]

Definition at line 99 of file space.Cpp.

{
    for (int n = 0; n < MAX_CHILDREN; n++)
        if (children[n]) {
            delete children[n];
        }
}

CSpaceStation::CSpaceStation ( )
virtual CSpaceStation::~CSpaceStation ( ) [virtual]

Member Function Documentation

void CSpaceStation::DecrementCountChildSpaceStations ( ) [inline]

Definition at line 100 of file space.h.

{ m_cChildSpaceStations--; }

HRESULT CSpaceStation::Expand ( IConsoleNameSpace * pConsoleNameSpace ) [private]

Definition at line 107 of file space.Cpp.

{

        //Expand the CSpaceStation if necessary.
        //This method is called by the object's OnPaste method during paste operations.

        HRESULT hr = S_FALSE;

        //First, need the IConsoleNameSpace2 interface to call Expand.
        IConsoleNameSpace2 *pConsoleNamespace2 = NULL;
        hr = pConsoleNameSpace->QueryInterface(IID_IConsoleNameSpace2, (void **)&pConsoleNamespace2);
        _ASSERT( SUCCEEDED(hr) );

        hr = pConsoleNamespace2->Expand((HSCOPEITEM)GetHandle());

        pConsoleNamespace2->Release();

        return hr;
}

virtual const int CSpaceStation::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 73 of file space.h.

{ return INDEX_STATION; }

virtual const int CSpaceStation::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 77 of file space.h.

{ return INDEX_STATION; }

int CSpaceStation::GetCountChildSpaceStations ( ) [inline]

Definition at line 99 of file space.h.

{ return m_cChildSpaceStations; }

virtual const _TCHAR* CSpaceStation::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 71 of file space.h.

{ return _T("Space Station"); }

virtual const _TCHAR* CSpaceStation::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 75 of file space.h.

{ return _T("Space Station"); }

virtual const GUID& CSpaceStation::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 72 of file space.h.

{ return thisGuid; }

virtual const GUID& CSpaceStation::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 76 of file space.h.

{ return thisGuid; }

virtual HRESULT CSpaceStation::GetResultViewType | ( | LPOLESTR * | ppViewType,
 |  | long * | pViewOptions |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

HRESULT CSpaceStation::GetResultViewType | ( | LPOLESTR * | ppViewType,
 |  | long * | pViewOptions |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 128 of file space.Cpp.

{
        return S_FALSE;
}

HRESULT CSpaceStation::OnDeleteScopeItem ( IConsoleNameSpace * pConsoleNameSpace ) [virtual]

Reimplemented from CDelegationBase.

Definition at line 341 of file space.Cpp.

{
        HRESULT hr = S_FALSE;

        HSCOPEITEM hCutItem = (HSCOPEITEM)GetHandle();

        //Get handle and cookie of parent scope item. We need these to
        //remove the "+" sign if the parent's m_cChildSpaceStations goes to zero.
        HSCOPEITEM hParentItem;
        MMC_COOKIE cookieParentItem;

        HRESULT hr1 = pConsoleNameSpace->GetParentItem(hCutItem, &hParentItem,
                                                                                (long *)&cookieParentItem);

        //Delete the cut item
        hr = pConsoleNameSpace->DeleteItem(hCutItem, TRUE);
        _ASSERT(S_OK == hr);

        if (SUCCEEDED(hr1))
        {
                //Decrement parent's m_cChildSpaceStations count and
                //remove "+" sign if necessary
                CSpaceStation* pParentSpaceStn = reinterpret_cast<CSpaceStation*>(cookieParentItem);
                pParentSpaceStn->DecrementCountChildSpaceStations();

                if ( !pParentSpaceStn->GetCountChildSpaceStations() )
                {
                        SCOPEDATAITEM sdi;

                        ZeroMemory(&sdi, sizeof(SCOPEDATAITEM) );
                        sdi.mask                = SDI_CHILDREN; //cChildren is valid
                        sdi.ID          = (HSCOPEITEM)hParentItem;
                        sdi.cChildren   = 0;

                        hr = pConsoleNameSpace->SetItem( &sdi );
                        _ASSERT( SUCCEEDED(hr) );
                }

        }

        return hr;
}

HRESULT CSpaceStation::OnPaste | ( | IConsole * | pConsole,
 |  | CComponentData * | pComponentData,
 |  | CDelegationBase * | pPasted |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 222 of file space.Cpp.

{
        CRocket *pRocket = dynamic_cast<CRocket *>(pPasted);

        HRESULT hr = S_OK;

        if (NULL == pRocket)
        {
            // See if this is CSpaceStation, if so paste it into this item.
            // This sample simply creates a new CSpaceStation
            // and inserts it as a child of the destination of the paste.
            // It does not paste the cut/copied CSpaceStation and the
            // current state of its result items.
            CSpaceStation* pSpaceStn = dynamic_cast<CSpaceStation*>(pPasted);
            if ( (NULL != pSpaceStn) &&
                 (pSpaceStn != this) )
            {
                // Regardless of whether this item is expanded or not
                // always try to expand this scopeitem (so that paste can
                // succeed).
                hr = Expand(pComponentData->GetConsoleNameSpace());

                CSpaceStation* pNewStation = new CSpaceStation();

                SCOPEDATAITEM sdi;
                ZeroMemory(&sdi, sizeof(SCOPEDATAITEM) );
                sdi.mask = SDI_STR|   // Displayname is valid
                    SDI_PARAM     |   // lParam is valid
                    SDI_IMAGE     |   // nImage is valid
                    SDI_OPENIMAGE |   // nOpenImage is valid
                    SDI_PARENT    |
                    SDI_CHILDREN;

                sdi.relativeID  = (HSCOPEITEM)GetHandle();
                sdi.nImage      = pNewStation->GetBitmapIndex();
                sdi.nOpenImage  = INDEX_OPENFOLDER;
                sdi.displayname = MMC_CALLBACK;
                sdi.lParam      = (LPARAM)pNewStation;       // The cookie
                sdi.cChildren   = 0;

                hr = pComponentData->GetConsoleNameSpace()->InsertItem( &sdi );
                _ASSERT( SUCCEEDED(hr) );

                pNewStation->SetHandle((HANDLE)sdi.ID);

            }

                        //increment count of child space stations
                        m_cChildSpaceStations++;

            return hr;
        }

        if (pRocket->m_pSpaceStation == this)
                return S_FALSE;

                //Create a new CRocket for the destination CSpaceStation
                CRocket *myRocket = new CRocket(pRocket->m_pSpaceStation, pRocket->szName, pRocket->nId,
                                                                                pRocket->lWeight, pRocket->lHeight, pRocket->lPayload);

        for (int n = 0; n < MAX_CHILDREN; n++) {
                if (NULL == children[n]) {
                        // put it here

                                                children[n] = myRocket;
                                                children[n]->isDeleted = FALSE;
                                                children[n]->nId = n;
                                                children[n]->m_pSpaceStation = this;

                        return S_OK;
                }
        }

        return S_FALSE;
}

HRESULT CSpaceStation::OnQueryPaste ( CDelegationBase * pPasted ) [virtual]

Reimplemented from CDelegationBase.

Definition at line 298 of file space.Cpp.

{
        CRocket *pRocket = dynamic_cast<CRocket *>(pPasted);

        if (NULL == pRocket)
        {
            // See if this is CSpaceStation.
            CSpaceStation* pSpaceStn = dynamic_cast<CSpaceStation*>(pPasted);
            if ( (NULL != pSpaceStn) &&
                 (pSpaceStn != this) )
            {
                return S_OK;
            }

            return S_FALSE;
        }

        if (pRocket->m_pSpaceStation != this)
                for (int n = 0; n < MAX_CHILDREN; n++) {
                        if (NULL == children[n]) {
                                return S_OK;
                        }
                }

        return S_FALSE;
}

virtual HRESULT CSpaceStation::OnSelect | ( | IConsole * | pConsole,
 |  | BOOL | bScope,
 |  | BOOL | bSelect |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

HRESULT CSpaceStation::OnSelect | ( | IConsole * | pConsole,
 |  | BOOL | bScope,
 |  | BOOL | bSelect |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 201 of file space.Cpp.

{
    IConsoleVerb *pConsoleVerb;

    HRESULT hr = pConsole->QueryConsoleVerb(&pConsoleVerb);
    _ASSERT(SUCCEEDED(hr));

    hr = pConsoleVerb->SetVerbState(MMC_VERB_CUT, ENABLED, TRUE);
    hr = pConsoleVerb->SetVerbState(MMC_VERB_CUT, HIDDEN, FALSE);
    hr = pConsoleVerb->SetVerbState(MMC_VERB_COPY, ENABLED, TRUE);
    hr = pConsoleVerb->SetVerbState(MMC_VERB_COPY, HIDDEN, FALSE);
    hr = pConsoleVerb->SetVerbState(MMC_VERB_DELETE, ENABLED, TRUE);
    hr = pConsoleVerb->SetVerbState(MMC_VERB_DELETE, HIDDEN, FALSE);
    hr = pConsoleVerb->SetVerbState(MMC_VERB_PASTE, ENABLED, TRUE);
    hr = pConsoleVerb->SetVerbState(MMC_VERB_PASTE, HIDDEN, FALSE);

    pConsoleVerb->Release();

    return S_OK;
}

virtual HRESULT CSpaceStation::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

HRESULT CSpaceStation::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 133 of file space.Cpp.

{
    HRESULT      hr = S_OK;

    IHeaderCtrl *pHeaderCtrl = NULL;
    IResultData *pResultData = NULL;

    if (bShow) {
        hr = pConsole->QueryInterface(IID_IHeaderCtrl, (void **)&pHeaderCtrl);
        _ASSERT( SUCCEEDED(hr) );

        hr = pConsole->QueryInterface(IID_IResultData, (void **)&pResultData);
        _ASSERT( SUCCEEDED(hr) );

        // Set the column headers in the results pane
        hr = pHeaderCtrl->InsertColumn( 0, L"Rocket Class", 0, MMCLV_AUTO );
        _ASSERT( S_OK == hr );
        hr = pHeaderCtrl->InsertColumn( 1, L"Rocket Weight", 0, MMCLV_AUTO );
        _ASSERT( S_OK == hr );
        hr = pHeaderCtrl->InsertColumn( 2, L"Rocket Height", 0, MMCLV_AUTO );
        _ASSERT( S_OK == hr );
        hr = pHeaderCtrl->InsertColumn( 3, L"Rocket Payload", 0, MMCLV_AUTO );
        _ASSERT( S_OK == hr );
        hr = pHeaderCtrl->InsertColumn( 4, L"Status", 0, MMCLV_AUTO );
        _ASSERT( S_OK == hr );

        // insert items here
        RESULTDATAITEM rdi;

        hr = pResultData->DeleteAllRsltItems();
        _ASSERT( SUCCEEDED(hr) );

        if (!bExpanded) {
            // create the child nodes, then expand them
            for (int n = 0; n < MAX_CHILDREN; n++) {

                                if (NULL == children[n])
                                        //No more children to insert, so exit for loop
                                        break;

                                BOOL childDeleteStatus = children[n]->getDeletedStatus();
                                if ( !childDeleteStatus) {
                                                ZeroMemory(&rdi, sizeof(RESULTDATAITEM) );
                                                rdi.mask       = RDI_STR       |   // Displayname is valid
                                                                                RDI_IMAGE     |
                                                                                RDI_PARAM;        // nImage is valid

                                                rdi.nImage      = children[n]->GetBitmapIndex();
                                                rdi.str         = MMC_CALLBACK;
                                                rdi.nCol        = 0;
                                                rdi.lParam      = (LPARAM)children[n];

                                                hr = pResultData->InsertItem( &rdi );

                                                _ASSERT( SUCCEEDED(hr) );

                                                children[n]->SetHandle((HANDLE)rdi.itemID);
                 }
            }
        }

        pHeaderCtrl->Release();
        pResultData->Release();
    }

    return hr;
}

HRESULT CSpaceStation::OnUpdateItem | ( | IConsole * | pConsole,
 |  | long | item,
 |  | ITEM_TYPE | itemtype |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 325 of file space.Cpp.

{
        HRESULT hr = S_OK;

        _ASSERT(item);
        _ASSERT(SCOPE == itemtype);

        //refresh all result pane views
        hr = pConsole->SelectScopeItem( (HSCOPEITEM)item );
        _ASSERT( S_OK == hr);

        return hr;
}

virtual HRESULT CSpaceStation::OnUpdateItem | ( | IConsole * | pConsole,
 |  | long | item,
 |  | ITEM_TYPE | itemtype |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Member Data Documentation

CRocket * CSpaceStation::children [private]

Definition at line 94 of file space.h.

int CSpaceStation::m_cChildSpaceStations [private]

Definition at line 96 of file space.h.

CComponentData * CSpaceStation::m_pComponentData [private]

Reimplemented from CDelegationBase.

Definition at line 95 of file space.h.

static const GUID CSpaceStation::thisGuid = { 0x62273a12, 0x1914, 0x11d3, { 0x9a, 0x38, 0x0, 0x80, 0xc7, 0x25, 0x80, 0x72 } } [static, private]

Reimplemented from CDelegationBase.

Definition at line 88 of file space.h.

The documentation for this class was generated from the following files:
  • SysMgmt/MMC/CutCopy/space.h
  • SysMgmt/MMC/Multisel/space.h
  • SysMgmt/MMC/CutCopy/space.Cpp
  • SysMgmt/MMC/Multisel/space.Cpp
Generated on Wed Nov 13 2024 16:57:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSpaceVehicle Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Types | Private Attributes | Static Private Attributes

CSpaceVehicle Class Reference

#include "space.h"

Inherits CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, and CDelegationBase.

List of all members.

Public Member Functions

CSpaceVehicle (CComponentData *pComponentData=NULL)
CSpaceVehicle ()
CSpaceVehicle ()
CSpaceVehicle ()
CSpaceVehicle ()
CSpaceVehicle ()
CSpaceVehicle ()
CSpaceVehicle ()
CSpaceVehicle ()
CSpaceVehicle ()
CSpaceVehicle (CComponentData *pComponentData=NULL)
virtual | ~CSpaceVehicle ()
virtual | ~CSpaceVehicle ()
virtual | ~CSpaceVehicle ()
virtual | ~CSpaceVehicle ()
virtual | ~CSpaceVehicle ()
virtual | ~CSpaceVehicle ()
virtual | ~CSpaceVehicle ()
virtual | ~CSpaceVehicle ()
virtual | ~CSpaceVehicle ()
virtual | ~CSpaceVehicle ()
virtual | ~CSpaceVehicle ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual HSCOPEITEM | GetParentScopeItem ()
virtual HRESULT | OnAddMenuItems (IContextMenuCallback *pContextMenuCallback, long *pInsertionsAllowed)
virtual HRESULT | OnAddMenuItems (IContextMenuCallback *pContextMenuCallback, long *pInsertionsAllowed)
virtual HRESULT | OnMenuCommand (IConsole *pConsole, long lCommandID)
virtual HRESULT | OnMenuCommand (IConsole *pConsole, IConsoleNameSpace *pConsoleNameSpace, long lCommandID, IDataObject *piDataObject)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual HRESULT | OnShow (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)
virtual void | SetScopeItemValue (HSCOPEITEM hscopeitem)
virtual HRESULT | Show (IConsole *pConsole, BOOL bShow, HSCOPEITEM scopeitem)

Private Types

enum | { IDM_NEW_SPACE = 4 }
enum | { NUMBER_OF_CHILDREN = 4 }
enum | { IDM_NEW_SPACE = 4 }
enum | { NUMBER_OF_CHILDREN = 4 }
enum | { IDM_NEW_SPACE = 4 }
enum | { NUMBER_OF_CHILDREN = 4 }
enum | { MAX_NUMBER_OF_CHILDREN = 6 }
enum | { IDM_NEW_SPACE = 4 }
enum | { NUMBER_OF_CHILDREN = 4 }
enum | { IDM_NEW_SPACE = 4 }
enum | { NUMBER_OF_CHILDREN = 4 }
enum | { IDM_NEW_SPACE = 4 }
enum | { NUMBER_OF_CHILDREN = 4 }
enum | { IDM_NEW_SPACE = 4 }
enum | { NUMBER_OF_CHILDREN = 4 }
enum | { IDM_NEW_SPACE = 4 }
enum | { NUMBER_OF_CHILDREN = 4 }
enum | { IDM_NEW_SPACE = 4 }
enum | { NUMBER_OF_CHILDREN = 4 }
enum | { IDM_NEW_SPACE = 4 }
enum | { NUMBER_OF_CHILDREN = 4 }
enum | { IDM_NEW_SPACE = 4 }
enum | { NUMBER_OF_CHILDREN = 4 }

Private Attributes

CRocket * | children [NUMBER_OF_CHILDREN]
int | m_cchildren
HSCOPEITEM | m_hParentHScopeItem

Static Private Attributes

static const GUID | thisGuid = { 0x29743810, 0x4c4b, 0x11d2, { 0x89, 0xd8, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28 } }

Detailed Description

Definition at line 49 of file space.h.

Member Enumeration Documentation

anonymous enum [private]
Enumerator:
IDM_NEW_SPACE

Definition at line 62 of file space.h.

{ IDM_NEW_SPACE = 4 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 69 of file space.h.

{ NUMBER_OF_CHILDREN = 4 };

anonymous enum [private]
Enumerator:
IDM_NEW_SPACE

Definition at line 72 of file space.h.

{ IDM_NEW_SPACE = 4 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 78 of file space.h.

{ NUMBER_OF_CHILDREN = 4 };

anonymous enum [private]
Enumerator:
IDM_NEW_SPACE

Definition at line 106 of file space.h.

{ IDM_NEW_SPACE = 4 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 112 of file space.h.

{ NUMBER_OF_CHILDREN = 4 };

anonymous enum [private]
Enumerator:
MAX_NUMBER_OF_CHILDREN

Definition at line 113 of file space.h.

{ MAX_NUMBER_OF_CHILDREN = 6 };

anonymous enum [private]
Enumerator:
IDM_NEW_SPACE

Definition at line 66 of file space.h.

{ IDM_NEW_SPACE = 4 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 72 of file space.h.

{ NUMBER_OF_CHILDREN = 4 };

anonymous enum [private]
Enumerator:
IDM_NEW_SPACE

Definition at line 72 of file space.h.

{ IDM_NEW_SPACE = 4 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 78 of file space.h.

{ NUMBER_OF_CHILDREN = 4 };

anonymous enum [private]
Enumerator:
IDM_NEW_SPACE

Definition at line 66 of file space.h.

{ IDM_NEW_SPACE = 4 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 72 of file space.h.

{ NUMBER_OF_CHILDREN = 4 };

anonymous enum [private]
Enumerator:
IDM_NEW_SPACE

Definition at line 81 of file space.h.

{ IDM_NEW_SPACE = 4 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 87 of file space.h.

{ NUMBER_OF_CHILDREN = 4 };

anonymous enum [private]
Enumerator:
IDM_NEW_SPACE

Definition at line 85 of file space.h.

{ IDM_NEW_SPACE = 4 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 91 of file space.h.

{ NUMBER_OF_CHILDREN = 4 };

anonymous enum [private]
Enumerator:
IDM_NEW_SPACE

Definition at line 66 of file space.h.

{ IDM_NEW_SPACE = 4 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 72 of file space.h.

{ NUMBER_OF_CHILDREN = 4 };

anonymous enum [private]
Enumerator:
IDM_NEW_SPACE

Definition at line 71 of file space.h.

{ IDM_NEW_SPACE = 4 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 77 of file space.h.

{ NUMBER_OF_CHILDREN = 4 };

anonymous enum [private]
Enumerator:
IDM_NEW_SPACE

Definition at line 85 of file space.h.

{ IDM_NEW_SPACE = 4 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 91 of file space.h.

{ NUMBER_OF_CHILDREN = 4 };

Constructor & Destructor Documentation

CSpaceVehicle::CSpaceVehicle ( CComponentData * pComponentData = NULL )

Definition at line 32 of file space.Cpp.

{
    m_pComponentData = pComponentData;

    for (int n = 0; n < NUMBER_OF_CHILDREN; n++) {
        children[n] = new CRocket(pComponentData);
        children[n]->Initialize(_T("Vehicle"), 500000, 265, 75000);
    }
}

CSpaceVehicle::~CSpaceVehicle ( ) [virtual]

Definition at line 42 of file space.Cpp.

{
    for (int n = 0; n < NUMBER_OF_CHILDREN; n++)
        if (children[n]) {
            delete children[n];
        }
}

CSpaceVehicle::CSpaceVehicle ( )

Definition at line 34 of file space.Cpp.

{
    for (int n = 0; n < NUMBER_OF_CHILDREN; n++) {
        children[n] = new CRocket();
        children[n]->Initialize(_T("Vehicle"), 500000, 265, 75000);
    }
}

virtual CSpaceVehicle::~CSpaceVehicle ( ) [virtual]
CSpaceVehicle::CSpaceVehicle ( )
virtual CSpaceVehicle::~CSpaceVehicle ( ) [virtual]
CSpaceVehicle::CSpaceVehicle ( )
virtual CSpaceVehicle::~CSpaceVehicle ( ) [virtual]
CSpaceVehicle::CSpaceVehicle ( )
virtual CSpaceVehicle::~CSpaceVehicle ( ) [virtual]
CSpaceVehicle::CSpaceVehicle ( )
virtual CSpaceVehicle::~CSpaceVehicle ( ) [virtual]
CSpaceVehicle::CSpaceVehicle ( )
virtual CSpaceVehicle::~CSpaceVehicle ( ) [virtual]
CSpaceVehicle::CSpaceVehicle ( )
virtual CSpaceVehicle::~CSpaceVehicle ( ) [virtual]
CSpaceVehicle::CSpaceVehicle ( )
virtual CSpaceVehicle::~CSpaceVehicle ( ) [virtual]
CSpaceVehicle::CSpaceVehicle ( CComponentData * pComponentData = NULL )
virtual CSpaceVehicle::~CSpaceVehicle ( ) [virtual]
CSpaceVehicle::CSpaceVehicle ( )
virtual CSpaceVehicle::~CSpaceVehicle ( ) [virtual]

Member Function Documentation

virtual const int CSpaceVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 57 of file space.h.

{ return INDEX_SPACEICON; }

virtual const int CSpaceVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 59 of file space.h.

{ return INDEX_SPACEICON; }

virtual const int CSpaceVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 74 of file space.h.

{ return INDEX_SPACEICON; }

virtual const int CSpaceVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 78 of file space.h.

{ return INDEX_SPACEICON; }

virtual const int CSpaceVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 59 of file space.h.

{ return INDEX_SPACEICON; }

virtual const int CSpaceVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 64 of file space.h.

{ return INDEX_SPACEICON; }

virtual const int CSpaceVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 63 of file space.h.

{ return INDEX_SPACEICON; }

virtual const int CSpaceVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 94 of file space.h.

{ return INDEX_SPACEICON; }

virtual const int CSpaceVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 65 of file space.h.

{ return INDEX_SPACEICON; }

virtual const int CSpaceVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 78 of file space.h.

{ return INDEX_SPACEICON; }

virtual const int CSpaceVehicle::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 59 of file space.h.

{ return INDEX_SPACEICON; }

virtual const _TCHAR* CSpaceVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 57 of file space.h.

{ return _T("Future Vehicles"); }

virtual const _TCHAR* CSpaceVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 76 of file space.h.

{ return _T("Future Vehicles"); }

virtual const _TCHAR* CSpaceVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 57 of file space.h.

{ return _T("Future Vehicles"); }

virtual const _TCHAR* CSpaceVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 61 of file space.h.

{ return _T("Future Vehicles"); }

virtual const _TCHAR* CSpaceVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 92 of file space.h.

{ return _T("Future Vehicles"); }

virtual const _TCHAR* CSpaceVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 62 of file space.h.

{ return _T("Future Vehicles"); }

virtual const _TCHAR* CSpaceVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 63 of file space.h.

{ return _T("Future Vehicles"); }

virtual const _TCHAR* CSpaceVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 76 of file space.h.

{ return _T("Future Vehicles"); }

virtual const _TCHAR* CSpaceVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 57 of file space.h.

{ return _T("Future Vehicles"); }

virtual const _TCHAR* CSpaceVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 55 of file space.h.

{ return _T("Future Vehicles"); }

virtual const _TCHAR* CSpaceVehicle::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 72 of file space.h.

{ return _T("Future Vehicles"); }

virtual const GUID& CSpaceVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 73 of file space.h.

{ return thisGuid; }

virtual const GUID& CSpaceVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 64 of file space.h.

{ return thisGuid; }

virtual const GUID& CSpaceVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 62 of file space.h.

{ return thisGuid; }

virtual const GUID& CSpaceVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 77 of file space.h.

{ return thisGuid; }

virtual const GUID& CSpaceVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 56 of file space.h.

{ return thisGuid; }

virtual const GUID& CSpaceVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 77 of file space.h.

{ return thisGuid; }

virtual const GUID& CSpaceVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 58 of file space.h.

{ return thisGuid; }

virtual const GUID& CSpaceVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 63 of file space.h.

{ return thisGuid; }

virtual const GUID& CSpaceVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 93 of file space.h.

{ return thisGuid; }

virtual const GUID& CSpaceVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 58 of file space.h.

{ return thisGuid; }

virtual const GUID& CSpaceVehicle::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 58 of file space.h.

{ return thisGuid; }

virtual HSCOPEITEM CSpaceVehicle::GetParentScopeItem ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 97 of file space.h.

{ return m_hParentHScopeItem; }

virtual HRESULT CSpaceVehicle::OnAddMenuItems | ( | IContextMenuCallback * | pContextMenuCallback,
 |  | long * | pInsertionsAllowed |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

HRESULT CSpaceVehicle::OnAddMenuItems | ( | IContextMenuCallback * | pContextMenuCallback,
 |  | long * | pInsertionsAllowed |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 108 of file space.Cpp.

{
    HRESULT hr = S_OK;
    CONTEXTMENUITEM menuItemsNew[] =
    {
        {
            L"Space based", L"Add a new space based vehicle",
                IDM_NEW_SPACE, CCM_INSERTIONPOINTID_PRIMARY_NEW, 0, CCM_SPECIAL_DEFAULT_ITEM
        },
        { NULL, NULL, 0, 0, 0 }
    };

    // Loop through and add each of the menu items
    if (*pInsertionsAllowed & CCM_INSERTIONALLOWED_NEW)
    {
        for (LPCONTEXTMENUITEM m = menuItemsNew; m->strName; m++)
        {
            hr = pContextMenuCallback->AddItem(m);

            if (FAILED(hr))
                break;
        }
    }

    return hr;
}

HRESULT CSpaceVehicle::OnMenuCommand | ( | IConsole * | pConsole,
 |  | IConsoleNameSpace * | pConsoleNameSpace,
 |  | long | lCommandID,
 |  | IDataObject * | piDataObject |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 149 of file space.Cpp.

{
    switch (lCommandID)
    {
    case IDM_NEW_SPACE:

        if (m_cchildren < MAX_NUMBER_OF_CHILDREN)
        {       //create new Rocket
            children[m_cchildren] = new CRocket(_T("Rocket"), m_cchildren+1, 500000, 265, 75000, this);

            pConsole->MessageBox(L"Created a new future vehicle", L"Menu Command", MB_OK|MB_ICONINFORMATION, NULL);

            m_cchildren++;

            // We created a new object in result pane. We need to insert this object
            // in all the views, call UpdateAllViews for this.
            // Pass pointer to data object passed into OnMenuCommand.
            HRESULT hr;
            hr = pConsole->UpdateAllViews(pDataObject, m_hParentHScopeItem, UPDATE_SCOPEITEM);
            _ASSERT( S_OK == hr);

        }
        else
            pConsole->MessageBox(L"No more future vehicles allowed", L"Menu Command", MB_OK|MB_ICONWARNING, NULL);
        break;
    }

    return S_OK;
}

HRESULT CSpaceVehicle::OnMenuCommand | ( | IConsole * | pConsole,
 |  | long | lCommandID |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 135 of file space.Cpp.

{
    switch (lCommandID)
    {
    case IDM_NEW_SPACE:
        pConsole->MessageBox(L"This sample does not create a new item\nSee Complete sample for a demonstration", L"Menu Command", MB_OK|MB_ICONINFORMATION, NULL);
        break;
    }

    return S_OK;
}

virtual HRESULT CSpaceVehicle::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CSpaceVehicle::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CSpaceVehicle::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CSpaceVehicle::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CSpaceVehicle::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CSpaceVehicle::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CSpaceVehicle::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

HRESULT CSpaceVehicle::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 50 of file space.Cpp.

{
    HRESULT      hr = S_OK;

    IHeaderCtrl *pHeaderCtrl = NULL;
    IResultData *pResultData = NULL;

    if (bShow) {
        hr = pConsole->QueryInterface(IID_IHeaderCtrl, (void **)&pHeaderCtrl);
        _ASSERT( SUCCEEDED(hr) );

        hr = pConsole->QueryInterface(IID_IResultData, (void **)&pResultData);
        _ASSERT( SUCCEEDED(hr) );

        // Set the column headers in the results pane
        hr = pHeaderCtrl->InsertColumn( 0, L"Rocket Class", 0, MMCLV_AUTO );
        _ASSERT( S_OK == hr );
        hr = pHeaderCtrl->InsertColumn( 1, L"Rocket Weight", 0, MMCLV_AUTO );
        _ASSERT( S_OK == hr );
        hr = pHeaderCtrl->InsertColumn( 2, L"Rocket Height", 0, MMCLV_AUTO );
        _ASSERT( S_OK == hr );
        hr = pHeaderCtrl->InsertColumn( 3, L"Rocket Payload", 0, MMCLV_AUTO );
        _ASSERT( S_OK == hr );
        hr = pHeaderCtrl->InsertColumn( 4, L"Status", 0, MMCLV_AUTO );
        _ASSERT( S_OK == hr );

        // insert items here
        RESULTDATAITEM rdi;

        hr = pResultData->DeleteAllRsltItems();
        _ASSERT( SUCCEEDED(hr) );

        if (!bExpanded) {
            // create the child nodes, then expand them
            for (int n = 0; n < NUMBER_OF_CHILDREN; n++) {
                ZeroMemory(&rdi, sizeof(RESULTDATAITEM) );
                rdi.mask       = RDI_STR       |   // Displayname is valid
                    RDI_IMAGE     |
                    RDI_PARAM;        // nImage is valid

                rdi.nImage      = children[n]->GetBitmapIndex();
                rdi.str         = MMC_CALLBACK;
                rdi.nCol        = 0;
                rdi.lParam      = (LPARAM)children[n];

                hr = pResultData->InsertItem( &rdi );

                _ASSERT( SUCCEEDED(hr) );
            }
        }

        pHeaderCtrl->Release();
        pResultData->Release();
    }

    return hr;
}

virtual HRESULT CSpaceVehicle::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CSpaceVehicle::OnShow | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual void CSpaceVehicle::SetScopeItemValue ( HSCOPEITEM hscopeitem ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 96 of file space.h.

{ m_hParentHScopeItem = hscopeitem; }

HRESULT CSpaceVehicle::Show | ( | IConsole * | pConsole,
 |  | BOOL | bShow,
 |  | HSCOPEITEM | scopeitem |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 50 of file space.Cpp.

{
    HRESULT      hr = S_OK;

    IHeaderCtrl *pHeaderCtrl = NULL;
    IResultData *pResultData = NULL;

    if (bShow) {
        hr = pConsole->QueryInterface(IID_IHeaderCtrl, (void **)&pHeaderCtrl);
        _ASSERT( SUCCEEDED(hr) );

        hr = pConsole->QueryInterface(IID_IResultData, (void **)&pResultData);
        _ASSERT( SUCCEEDED(hr) );

        // Set the column headers in the results pane
        hr = pHeaderCtrl->InsertColumn( 0, L"Rocket Class", 0, MMCLV_AUTO );
        _ASSERT( S_OK == hr );
        hr = pHeaderCtrl->InsertColumn( 1, L"Rocket Weight", 0, MMCLV_AUTO );
        _ASSERT( S_OK == hr );
        hr = pHeaderCtrl->InsertColumn( 2, L"Rocket Height", 0, MMCLV_AUTO );
        _ASSERT( S_OK == hr );
        hr = pHeaderCtrl->InsertColumn( 3, L"Rocket Payload", 0, MMCLV_AUTO );
        _ASSERT( S_OK == hr );
        hr = pHeaderCtrl->InsertColumn( 4, L"Status", 0, MMCLV_AUTO );
        _ASSERT( S_OK == hr );

        // insert items here
        RESULTDATAITEM rdi;

        hr = pResultData->DeleteAllRsltItems();
        _ASSERT( SUCCEEDED(hr) );

        if (!bExpanded) {
            // create the child nodes, then expand them
            for (int n = 0; n < NUMBER_OF_CHILDREN; n++) {
                ZeroMemory(&rdi, sizeof(RESULTDATAITEM) );
                rdi.mask       = RDI_STR       |   // Displayname is valid
                    RDI_IMAGE     |
                    RDI_PARAM;        // nImage is valid

                rdi.nImage      = children[n]->GetBitmapIndex();
                rdi.str         = MMC_CALLBACK;
                rdi.nCol        = 0;
                rdi.lParam      = (LPARAM)children[n];

                hr = pResultData->InsertItem( &rdi );

                _ASSERT( SUCCEEDED(hr) );
            }
        }

        pHeaderCtrl->Release();
        pResultData->Release();
    }

    return hr;
}

Member Data Documentation

CRocket * CSpaceVehicle::children [private]

Definition at line 70 of file space.h.

int CSpaceVehicle::m_cchildren [private]

Definition at line 115 of file space.h.

HSCOPEITEM CSpaceVehicle::m_hParentHScopeItem [private]

Definition at line 116 of file space.h.

static const GUID CSpaceVehicle::thisGuid = { 0x29743810, 0x4c4b, 0x11d2, { 0x89, 0xd8, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28 } } [static, private]

Reimplemented from CDelegationBase.

Definition at line 65 of file space.h.

The documentation for this class was generated from the following files:
  • SysMgmt/MMC/ActiveX/space.h
  • SysMgmt/MMC/CMenu/space.h
  • SysMgmt/MMC/Complete/space.h
  • SysMgmt/MMC/Extens/space.h
  • SysMgmt/MMC/Menubtn/space.h
  • SysMgmt/MMC/Nodes/space.h
  • SysMgmt/MMC/Openserv/space.h
  • SysMgmt/MMC/Proppage/space.h
  • SysMgmt/MMC/Taskpads/space.h
  • SysMgmt/MMC/Toolbar/space.h
  • SysMgmt/MMC/WMI/space.h
  • SysMgmt/MMC/ActiveX/space.Cpp
  • SysMgmt/MMC/CMenu/space.Cpp
  • SysMgmt/MMC/Complete/space.Cpp
  • SysMgmt/MMC/Extens/space.Cpp
  • SysMgmt/MMC/Menubtn/space.Cpp
  • SysMgmt/MMC/Nodes/space.Cpp
  • SysMgmt/MMC/Openserv/space.Cpp
  • SysMgmt/MMC/Proppage/space.Cpp
  • SysMgmt/MMC/Taskpads/space.Cpp
  • SysMgmt/MMC/Toolbar/space.Cpp
  • SysMgmt/MMC/WMI/space.Cpp
Generated on Wed Nov 13 2024 16:57:28 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSpecialCharHashEntry Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CSpecialCharHashEntry Class Reference

#include "CharHash.Hxx"

List of all members.

Public Member Functions

CSpecialCharHashEntry (WCHAR *pwszName, WCHAR wch)
WCHAR * | GetName ()
CSpecialCharHashEntry * GetNextHashEntry ()
WCHAR | GetWideChar ()
void | SetNextHashEntry (CSpecialCharHashEntry *pEntry)

Private Attributes

CSpecialCharHashEntry * _pHashEntryNext
WCHAR | _wch
WCHAR | _wszName [MAX_TAG_LENGTH]

Detailed Description

Definition at line 30 of file CharHash.Hxx.

Constructor & Destructor Documentation

CSpecialCharHashEntry::CSpecialCharHashEntry | ( | WCHAR * | pwszName,
 |  | WCHAR | wch
 | ) |  |

Definition at line 28 of file CharHash.Cxx.

    : _wch(wch),
      _pHashEntryNext(0)
{
    Win4Assert( wcslen(pwszName) + 1 < MAX_TAG_LENGTH );
    wcscpy( _wszName, pwszName );
}

Member Function Documentation

WCHAR* CSpecialCharHashEntry::GetName ( void ) [inline]

Definition at line 36 of file CharHash.Hxx.

{ return _wszName; }

CSpecialCharHashEntry* CSpecialCharHashEntry::GetNextHashEntry ( ) [inline]

Definition at line 39 of file CharHash.Hxx.

{ return _pHashEntryNext; }

WCHAR CSpecialCharHashEntry::GetWideChar ( ) [inline]

Definition at line 37 of file CharHash.Hxx.

{ return _wch; }

void CSpecialCharHashEntry::SetNextHashEntry ( CSpecialCharHashEntry * pEntry ) [inline]

Definition at line 40 of file CharHash.Hxx.

{ _pHashEntryNext = pEntry; }

Member Data Documentation

CSpecialCharHashEntry* CSpecialCharHashEntry::_pHashEntryNext [private]

Definition at line 45 of file CharHash.Hxx.

WCHAR CSpecialCharHashEntry::_wch [private]

Definition at line 44 of file CharHash.Hxx.

WCHAR CSpecialCharHashEntry::_wszName[MAX_TAG_LENGTH] [private]

Definition at line 43 of file CharHash.Hxx.

The documentation for this class was generated from the following files:
  • WinBase/Indexing/IFilter/CharHash.Hxx
  • WinBase/Indexing/IFilter/CharHash.Cxx
Generated on Wed Nov 13 2024 16:57:28 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSpecialCharHashTable Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CSpecialCharHashTable Class Reference

#include "CharHash.Hxx"

List of all members.

Public Member Functions

CSpecialCharHashTable ()
~CSpecialCharHashTable ()
void | Add (WCHAR *pwszName, WCHAR wch)
BOOL | Lookup (WCHAR *pwcInputBuf, unsigned uLen, WCHAR &wch)

Private Member Functions

unsigned | Hash (WCHAR *pwszName, unsigned cLen)

Private Attributes

CSpecialCharHashEntry * _aHashTable [SPECIAL_CHAR_HASH_TABLE_SIZE]

Detailed Description

Definition at line 60 of file CharHash.Hxx.

Constructor & Destructor Documentation

CSpecialCharHashTable::CSpecialCharHashTable ( )

Definition at line 165 of file CharHash.Cxx.

{
    for (unsigned i=0; i<SPECIAL_CHAR_HASH_TABLE_SIZE; i++)
        _aHashTable[i] = 0;

    //
    // Initialize the table with various Ascii string->Unicode mappings
    //

    //
    // For lt and gt, use Unicode chars from private use area to avoid
    // collision with '<' and '>' chars in Html tags. These will be
    // mapped back to '<' and '>' by the scanner.
    //
    Add(L"lt",      PRIVATE_USE_MAPPING_FOR_LT);
    Add(L"gt",      PRIVATE_USE_MAPPING_FOR_GT);

    Add(L"amp",     0x26);
    Add(L"quot",    0x22);
    Add(L"nbsp",    0xa0);
    Add(L"shy",     0xad);
    Add(L"Agrave",  0xc0);
    Add(L"agrave",  0xe0);
    Add(L"Aacute",  0xc1);
    Add(L"aacute",  0xe1);
    Add(L"Acirc",   0xc2);
    Add(L"acirc",   0xe2);
    Add(L"Atilde",  0xc3);
    Add(L"atilde",  0xe3);
    Add(L"Auml",    0xc4);
    Add(L"auml",    0xe4);
    Add(L"Aring",   0xc5);
    Add(L"aring",   0xe5);
    Add(L"AElig",   0xc6);
    Add(L"aelig",   0xe6);
    Add(L"Ccedil",  0xc7);
    Add(L"ccedil",  0xe7);
    Add(L"Egrave",  0xc8);
    Add(L"egrave",  0xe8);
    Add(L"Eacute",  0xc9);
    Add(L"eacute",  0xe9);
    Add(L"Ecirc",   0xca);
    Add(L"ecirc",   0xea);
    Add(L"Euml",    0xcb);
    Add(L"euml",    0xeb);
    Add(L"Igrave",  0xcc);
    Add(L"igrave",  0xec);
    Add(L"Iacute",  0xcd);
    Add(L"iacute",  0xed);
    Add(L"Icirc",   0xce);
    Add(L"icirc",   0xee);
    Add(L"Iuml",    0xcf);
    Add(L"iuml",    0xef);
    Add(L"ETH",     0xd0);
    Add(L"eth",     0xf0);
    Add(L"Ntilde",  0xd1);
    Add(L"ntilde",  0xf1);
    Add(L"Ograve",  0xd2);
    Add(L"ograve",  0xf2);
    Add(L"Oacute",  0xd3);
    Add(L"oacute",  0xf3);
    Add(L"Ocirc",   0xd4);
    Add(L"ocirc",   0xf4);
    Add(L"Otilde",  0xd5);
    Add(L"otilde",  0xf5);
    Add(L"Ouml",    0xd6);
    Add(L"ouml",    0xf6);
    Add(L"Oslash",  0xd8);
    Add(L"oslash",  0xf8);
    Add(L"Ugrave",  0xd9);
    Add(L"ugrave",  0xf9);
    Add(L"Uacute",  0xda);
    Add(L"uacute",  0xfa);
    Add(L"Ucirc",   0xdb);
    Add(L"ucirc",   0xfb);
    Add(L"Uuml",    0xdc);
    Add(L"uuml",    0xfc);
    Add(L"Yacute",  0xdd);
    Add(L"yacute",  0xfd);
    Add(L"THORN",   0xde);
    Add(L"thorn",   0xfe);
    Add(L"szlig",   0xdf);
    Add(L"yuml",    0xff);
    Add(L"iexcl",   0xa1);
    Add(L"cent",    0xa2);
    Add(L"pound",   0xa3);
    Add(L"curren",  0xa4);
    Add(L"yen",     0xa5);
    Add(L"brvbar",  0xa6);
    Add(L"sect",    0xa7);
    Add(L"die",     0xa8);
    Add(L"copy",    0xa9);
    Add(L"laquo",   0xab);
    Add(L"reg",     0xae);
    Add(L"macron",  0xaf);
    Add(L"deg",     0xb0);
    Add(L"plusmn",  0xb1);
    Add(L"sup2",    0xb2);
    Add(L"sup3",    0xb3);
    Add(L"acute",   0xb4);
    Add(L"micro",   0xb5);
    Add(L"para",    0xb6);
    Add(L"middot",  0xb7);
    Add(L"cedil",   0xb8);
    Add(L"supl",    0xb9);
    Add(L"raquo",   0xbb);
    Add(L"frac14",  0xbc);
    Add(L"frac12",  0xbd);
    Add(L"frac34",  0xbe);
    Add(L"iquest",  0xbf);
    Add(L"times",   0xd7);
    Add(L"divide",  0xf7);
}

CSpecialCharHashTable::~CSpecialCharHashTable ( )

Definition at line 47 of file CharHash.Cxx.

{
    for ( unsigned i=0; i<SPECIAL_CHAR_HASH_TABLE_SIZE; i++)
    {
        CSpecialCharHashEntry *pHashEntry = _aHashTable[i];
        while ( pHashEntry != 0 )
        {
            CSpecialCharHashEntry *pHashEntryNext = pHashEntry->GetNextHashEntry();
            delete pHashEntry;
            pHashEntry = pHashEntryNext;
        }
    }
}

Member Function Documentation

void CSpecialCharHashTable::Add | ( | WCHAR * | pwszName,
 |  | WCHAR | wch
 | ) |  |

Definition at line 74 of file CharHash.Cxx.

{
#if DBG == 1
    //
    // Check for duplicate entries
    //
    WCHAR wchExisting;

    BOOL fFound = Lookup( pwszName, wcslen(pwszName), wchExisting );
    Win4Assert( !fFound );
#endif

    CSpecialCharHashEntry *pHashEntry = newk(mtNewX, NULL) CSpecialCharHashEntry( pwszName,
                                                                                wch );
    unsigned uHashValue = Hash( pwszName, (unsigned) wcslen(pwszName) );
    pHashEntry->SetNextHashEntry( _aHashTable[uHashValue] );
    _aHashTable[uHashValue] = pHashEntry;
}

unsigned CSpecialCharHashTable::Hash | ( | WCHAR * | pwszName,
 |  | unsigned | cLen |
 | ) |  |  | [private]

Definition at line 145 of file CharHash.Cxx.

{
    for ( ULONG uHashValue=0; cLen>0; pwszName++ )
    {
        uHashValue = *pwszName + 31 * uHashValue;
        cLen--;
    }

    return uHashValue % SPECIAL_CHAR_HASH_TABLE_SIZE;
}

BOOL CSpecialCharHashTable::Lookup | ( | WCHAR * | pwcInputBuf,
 |  | unsigned | uLen,
 |  | WCHAR & | wch
 | ) |  |

Definition at line 108 of file CharHash.Cxx.

{
    unsigned uHashValue = Hash( pwcInputBuf, uLen );

    Win4Assert( uHashValue < SPECIAL_CHAR_HASH_TABLE_SIZE );

    for ( CSpecialCharHashEntry *pHashEntry = _aHashTable[uHashValue];
          pHashEntry != 0;
          pHashEntry = pHashEntry->GetNextHashEntry() )
    {
        if ( wcsncmp( pwcInputBuf, pHashEntry->GetName(), uLen ) == 0 )
        {
            wch  = pHashEntry->GetWideChar();
            return TRUE;
        }
    }

    return FALSE;
}

Member Data Documentation

CSpecialCharHashEntry* CSpecialCharHashTable::_aHashTable[SPECIAL_CHAR_HASH_TABLE_SIZE] [private]

Definition at line 75 of file CharHash.Hxx.

The documentation for this class was generated from the following files:
  • WinBase/Indexing/IFilter/CharHash.Hxx
  • WinBase/Indexing/IFilter/CharHash.Cxx
Generated on Wed Nov 13 2024 16:57:28 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSplitterLite Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CSplitterLite Class Reference

#include "cdialoglite.h"

Inherits CWndLite.

Inherited by CEditBoxLite, CListViewLite, CScrollBarLite, CTabLite, and CTreeViewLite.

List of all members.

Public Member Functions

CSplitterLite (HWND hWndParent=NULL, UINT nID=0)
virtual BOOL | DrawSplitter (HDC hDC, BOOL fVertical, REFRECT rectLeft, REFRECT rectRight, REFPOINTS ptsClient)
virtual BOOL | OnBorder (REFPOINTS pts, INT iBorder)
virtual BOOL | OnNCButtonDown (WPARAM nHittest, REFPOINTS pts)
virtual BOOL | OnNCMouseMove (WPARAM nHittest, REFPOINTS pts)
virtual BOOL | SetSplitter (CSplitterLite *pCWndTop, CSplitterLite *pCWndBottom=NULL, CSplitterLite *pCWndLeft=NULL, CSplitterLite *pCWndRight=NULL)
virtual BOOL | StartTracking (REFPOINTS ptsScreen, REFRECT rectLeft, REFRECT rectRight, BOOL fVertical, POINT *pPoint)

Public Attributes

HCURSOR | m_hCursorOld
HCURSOR | m_hCursorRight
HCURSOR | m_hCursorTop
INT | m_iBorderCX
INT | m_iBorderCY
CSplitterLite * m_pCWndBottom
CSplitterLite * m_pCWndLeft
CSplitterLite * m_pCWndRight
CSplitterLite * m_pCWndTop

Detailed Description

Definition at line 367 of file cdialoglite.h.

Constructor & Destructor Documentation

CSplitterLite::CSplitterLite | ( | HWND | hWndParent = NULL,
 |  | UINT | nID = 0
 | ) |  |

Definition at line 1670 of file cdialoglite.cpp.

  : CWndLite(hWndParent, nID)
{
  m_pCWndTop    = NULL;
  m_pCWndBottom = NULL;
  m_pCWndLeft   = NULL;
  m_pCWndRight  = NULL;

  m_hCursorOld  = NULL;
  m_hCursorTop  = NULL;
  m_hCursorRight  = NULL;

  m_iBorderCX   = 0;
  m_iBorderCY   = 0;
}

Member Function Documentation

BOOL CSplitterLite::DrawSplitter | ( | HDC | hDC,
 |  | BOOL | fVertical,
 |  | REFRECT | rectLeft,
 |  | REFRECT | rectRight,
 |  | REFPOINTS | ptsClient |
 | ) |  |  | [virtual]

Definition at line 1939 of file cdialoglite.cpp.

{
  if(fVertical)
  {
    //Vertical Splitter
    //PatBlt - in Client Coordinates
    DWORD dwTop   = min(rectLeft.top, rectRight.top);
    DWORD dwHeight  = max(rectLeft.bottom, rectRight.bottom) - dwTop;
    PatBlt(hDC, ptsClient.x, dwTop, m_iBorderCX, dwHeight, DSTINVERT);
  }
  else
  {
    //Horizontal Splitter
    //PatBlt - in Client Coordinates
    DWORD dwLeft  = min(rectLeft.left, rectRight.left);
    DWORD dwWidth = max(rectLeft.right, rectRight.right) - dwLeft;
    PatBlt(hDC, dwLeft, ptsClient.y, dwWidth, m_iBorderCY, DSTINVERT);
  }
  return TRUE;
}

BOOL CSplitterLite::OnBorder | ( | REFPOINTS | pts,
 |  | INT | iBorder |
 | ) |  |  | [virtual]

Definition at line 1713 of file cdialoglite.cpp.

{
  RECT rect;
  GetWindowRect(m_hWnd, &rect);

  switch(iBorder)
  {
    case HTLEFT:
      return pts.x <= (rect.left + m_iBorderCX);

    case HTRIGHT:
      return pts.x >= (rect.right - m_iBorderCX);

    case HTTOP:
      return pts.y <= (rect.top + m_iBorderCY);

    case HTBOTTOM:
      return pts.y >= (rect.bottom - m_iBorderCY);
  };

  return FALSE;
}

BOOL CSplitterLite::OnNCButtonDown | ( | WPARAM | nHittest,
 |  | REFPOINTS | pts |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 1789 of file cdialoglite.cpp.

{
  //WM_NCLBUTTONDOWN is in Screen Coordinates, relateive to the desktop.

  if(nHittest == HTBORDER)
  {
    POINT pt;

    //Is the Mouse on the Bottom Border?
    if(m_pCWndBottom && OnBorder(ptsScreen, HTBOTTOM))
    {
      //Create the "Bounding" Rectangle...
      RECT rectLeft = GetClientCoords(m_hWndParent, m_hWnd);
      RECT rectRight  = GetClientCoords(m_hWndParent, m_pCWndBottom->m_hWnd);
      BOOL fVertical  = FALSE;

      //StartTracking...
      if(StartTracking(ptsScreen, rectLeft, rectRight, fVertical, &pt))
      {
        //MoveWindow is in Screen Coordinates.
        MoveWindow(m_hWnd, rectLeft.left, rectLeft.top, rectLeft.right-rectLeft.left, pt.y-rectLeft.top, FALSE);
        MoveWindow(m_pCWndBottom->m_hWnd, rectRight.left, pt.y, rectRight.right-rectRight.left, rectRight.bottom - pt.y, FALSE);

        if(m_pCWndRight && m_pCWndRight->m_pCWndBottom)
        {
          HWND hWndRight  = m_pCWndRight->m_hWnd;
          rectRight   = GetClientCoords(m_hWndParent, hWndRight);
          MoveWindow(hWndRight, rectRight.left, rectRight.top, rectRight.right-rectRight.left, pt.y - rectRight.top, FALSE);
        }

        if(m_pCWndBottom->m_pCWndRight && m_pCWndBottom->m_pCWndRight->m_pCWndTop)
        {
          HWND hWndRight  = m_pCWndBottom->m_pCWndRight->m_hWnd;
          rectRight   = GetClientCoords(m_hWndParent, hWndRight);
          MoveWindow(hWndRight, rectRight.left, pt.y, rectRight.right-rectRight.left, rectRight.bottom - pt.y, FALSE);
        }

        //Now invalidate all windows
        InvalidateRect(m_hWndParent, NULL, FALSE);
        return TRUE;
      }
    }

    //Is the Mouse on the Top Border?
    if(m_pCWndTop && OnBorder(ptsScreen, HTTOP))
    {
      //Create the "Bounding" Rectangle...
      RECT rectLeft = GetClientCoords(m_hWndParent, m_pCWndTop->m_hWnd);
      RECT rectRight  = GetClientCoords(m_hWndParent, m_hWnd);
      BOOL fVertical  = FALSE;

      //StartTracking...
      if(StartTracking(ptsScreen, rectLeft, rectRight, fVertical, &pt))
      {
        //MoveWindow is in Screen Coordinates.
        MoveWindow(m_pCWndTop->m_hWnd, rectLeft.left, rectLeft.top, rectLeft.right-rectLeft.left, pt.y-rectLeft.top, FALSE);
        MoveWindow(m_hWnd, rectRight.left, pt.y, rectRight.right-rectRight.left, rectRight.bottom - pt.y, FALSE);

        if(m_pCWndRight && m_pCWndRight->m_pCWndTop)
        {
          HWND hWndRight  = m_pCWndRight->m_hWnd;
          rectRight   = GetClientCoords(m_hWndParent, hWndRight);
          MoveWindow(hWndRight, rectRight.left, pt.y, rectRight.right-rectRight.left, rectRight.bottom - pt.y, FALSE);
        }

        if(m_pCWndTop->m_pCWndRight && m_pCWndTop->m_pCWndRight->m_pCWndBottom)
        {
          HWND hWndRight  = m_pCWndTop->m_pCWndRight->m_hWnd;
          rectRight = GetClientCoords(m_hWndParent, hWndRight);
          MoveWindow(hWndRight, rectRight.left, rectRight.top, rectRight.right-rectRight.left, pt.y - rectRight.top, FALSE);
        }

        //Now invalidate all windows
        InvalidateRect(m_hWndParent, NULL, FALSE);
        return TRUE;
      }
    }

    //Is the Mouse on the Left Border?
    if(m_pCWndLeft && OnBorder(ptsScreen, HTLEFT))
    {
      //Create the "Bounding" Rectangle...
      RECT rectLeft = GetClientCoords(m_hWndParent, m_pCWndLeft->m_hWnd);
      RECT rectRight  = GetClientCoords(m_hWndParent, m_hWnd);
      BOOL fVertical  = TRUE;

      //StartTracking...
      if(StartTracking(ptsScreen, rectLeft, rectRight, fVertical, &pt))
      {
        //MoveWindow is in Screen Coordinates.
        MoveWindow(m_pCWndLeft->m_hWnd, rectLeft.left, rectLeft.top, pt.x - rectLeft.left, rectLeft.bottom - rectLeft.top, FALSE);
        MoveWindow(m_hWnd, pt.x, rectRight.top, rectRight.right-pt.x, rectRight.bottom - rectRight.top, FALSE);

        if(m_pCWndLeft->m_pCWndBottom)
        {
          HWND hWndBottom = m_pCWndLeft->m_pCWndBottom->m_hWnd;
          RECT rectBottom = GetClientCoords(m_hWndParent, hWndBottom);
          MoveWindow(hWndBottom, rectBottom.left, rectBottom.top, pt.x-rectBottom.left, rectBottom.bottom-rectBottom.top, FALSE);
        }

        //Now invalidate all windows
        InvalidateRect(m_hWndParent, NULL, FALSE);
        return TRUE;
      }
    }

    //Is the Mouse on the Right Border?
    if(m_pCWndRight && OnBorder(ptsScreen, HTRIGHT) && m_pCWndRight->m_pCWndLeft)
    {
      //Create the "Bounding" Rectangle...
      RECT rectLeft = GetClientCoords(m_hWndParent, m_hWnd);
      RECT rectRight  = GetClientCoords(m_hWndParent, m_pCWndRight->m_hWnd);
      BOOL fVertical  = TRUE;

      //StartTracking...
      if(StartTracking(ptsScreen, rectLeft, rectRight, fVertical, &pt))
      {
        //MoveWindow is in Screen Coordinates.
        MoveWindow(m_hWnd, rectLeft.left, rectLeft.top, pt.x - rectLeft.left, rectLeft.bottom - rectLeft.top, FALSE);
        MoveWindow(m_pCWndRight->m_hWnd, pt.x, rectRight.top, rectRight.right-pt.x, rectRight.bottom - rectRight.top, FALSE);

        if(m_pCWndTop)
        {
          HWND hWndTop = m_pCWndTop->m_hWnd;
          RECT rectTop = GetClientCoords(m_hWndParent, hWndTop);
          MoveWindow(hWndTop, rectTop.left, rectTop.top, pt.x-rectTop.left, rectTop.bottom-rectTop.top, FALSE);
        }

        if(m_pCWndBottom)
        {
          HWND hWndBottom = m_pCWndBottom->m_hWnd;
          RECT rectBottom = GetClientCoords(m_hWndParent, hWndBottom);
          MoveWindow(hWndBottom, rectBottom.left, rectBottom.top, pt.x-rectBottom.left, rectBottom.bottom-rectBottom.top, FALSE);
        }

        //Now invalidate all windows
        InvalidateRect(m_hWndParent, NULL, FALSE);
        return TRUE;
      }
    }
  }

  return FALSE;
}

BOOL CSplitterLite::OnNCMouseMove | ( | WPARAM | nHittest,
 |  | REFPOINTS | pts |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 1741 of file cdialoglite.cpp.

{
  //HitTest
  if(nHittest == HTBORDER)
  {
    //HTBOTTOM
    if(m_pCWndBottom && OnBorder(pts, HTBOTTOM))
    {
       if(m_pCWndBottom->m_pCWndTop)
         m_hCursorOld = SetCursor(m_hCursorTop);
    }
    //HTTOP
    else if(m_pCWndTop && OnBorder(pts, HTTOP))
    {
       if(m_pCWndTop->m_pCWndBottom)
         m_hCursorOld = SetCursor(m_hCursorTop);
    }
    //HTRIGHT
    else if(m_pCWndRight && OnBorder(pts, HTRIGHT))
    {
      if(m_pCWndRight->m_pCWndLeft)
        m_hCursorOld = SetCursor(m_hCursorRight);
    }
    //HTLEFT
    else if(m_pCWndLeft && OnBorder(pts, HTLEFT))
    {
       if(m_pCWndLeft->m_pCWndRight)
         m_hCursorOld = SetCursor(m_hCursorRight);
    }
  }
  else
  {
    //Restore the Cursor
    if(m_hCursorOld)
    {
      SetCursor(m_hCursorOld);
      m_hCursorOld = NULL;
    }
  }

  return TRUE;
}

BOOL CSplitterLite::SetSplitter | ( | CSplitterLite * | pCWndTop,
 |  | CSplitterLite * | pCWndBottom = NULL,
 |  | CSplitterLite * | pCWndLeft = NULL,
 |  | CSplitterLite * | pCWndRight = NULL |
 | ) |  |  | [virtual]

Definition at line 1691 of file cdialoglite.cpp.

{
  m_pCWndTop    = pCWndTop;
  m_pCWndBottom = pCWndBottom;
  m_pCWndLeft   = pCWndLeft;
  m_pCWndRight  = pCWndRight;

  //Load the appropiate cursor
  m_hCursorOld  = NULL;
  m_hCursorTop  = LoadCursor(NULL, MAKEINTRESOURCE(IDC_SIZENS));
  m_hCursorRight  = LoadCursor(NULL, MAKEINTRESOURCE(IDC_SIZEWE));

  m_iBorderCX   = GetSystemMetrics(SM_CXFIXEDFRAME);
  m_iBorderCY   = GetSystemMetrics(SM_CYFIXEDFRAME);
  return TRUE;
}

BOOL CSplitterLite::StartTracking | ( | REFPOINTS | ptsScreen,
 |  | REFRECT | rectLeft,
 |  | REFRECT | rectRight,
 |  | BOOL | fVertical,
 |  | POINT * | pPoint |
 | ) |  |  | [virtual]

Definition at line 1966 of file cdialoglite.cpp.

{
  ASSERT(pPoint);
  BOOL bTracking = TRUE;
  MSG msgModal;

  //Capture mouse so Frame window gets mouse messages
  HDC hDC = GetDC(m_hWndParent);
  SetCapture(m_hWnd);
  m_hCursorOld = SetCursor(fVertical ? m_hCursorRight : m_hCursorTop);
  BOOL fWithinBounds = FALSE;

  RECT rect;
  GetWindowRect(m_hWnd, &rect);
  POINT ptLocal = { rect.left, rect.top };
  ScreenToClient(m_hWndParent, &ptLocal);

  //Convert Screen Coordinates to Client Coordinates...
  POINT ptClient = { ptsScreen.x, ptsScreen.y};
  ScreenToClient(m_hWndParent, &ptClient);
  POINTS ptsClient = { (SHORT)ptClient.x, (SHORT)ptClient.y };

  //Draw splitter
  DrawSplitter(hDC, fVertical, rectLeft, rectRight, ptsClient);

  //While the split-bar is being dragged
  while (bTracking)
  {
    //Get mouse message
    GetMessage(&msgModal, NULL, WM_MOUSEFIRST, WM_MOUSELAST);
    switch (msgModal.message)
    {
      case WM_MOUSEMOVE:
      {
        //WM_MOUSEMOVE is in Client Coordindates, relateive to the client window.
        SHORT px = LOWORD(msgModal.lParam);
        SHORT py = HIWORD(msgModal.lParam);

        //Only redraw if different position than last time
        if((fVertical && px != ptsClient.x) ||
          (!fVertical && py != ptsClient.y))
        {
          //Draw splitter - erase previous
          DrawSplitter(hDC, fVertical, rectLeft, rectRight, ptsClient);

          //Get new mouse positions
          ptsClient.x = (SHORT)ptLocal.x + px;
          ptsClient.y = (SHORT)ptLocal.y + py;

          //Draw splitter - draw new
          DrawSplitter(hDC, fVertical, rectLeft, rectRight, ptsClient);
        }
        break;
      }

      // End of split-bar drag
      case WM_LBUTTONUP:
      case WM_LBUTTONDOWN:
      case WM_LBUTTONDBLCLK:
      case WM_RBUTTONUP:
      case WM_RBUTTONDOWN:
      case WM_RBUTTONDBLCLK:
      {
        //WM_LBUTTONUP is in Client Coordindates, relateive to the client window.
        SHORT px = LOWORD(msgModal.lParam);
        SHORT py = HIWORD(msgModal.lParam);

        //Draw splitter - erase previous
        DrawSplitter(hDC, fVertical, rectLeft, rectRight, ptsClient);

        // Get new mouse positions
        ptsClient.x = (SHORT)ptLocal.x + px;
        ptsClient.y = (SHORT)ptLocal.y + py;

        //We Now need to resize the Window
        //Only adjust windows if Mouse is within Max/Min Coords
        if(fVertical)
          fWithinBounds = (ptsClient.x > rectLeft.left && ptsClient.x < rectRight.right);
        else
          fWithinBounds = (ptsClient.y > rectLeft.top && ptsClient.y < rectRight.bottom);

        bTracking = FALSE;  // Break out of tracking loop
        break;
      }
    }
  }

  ReleaseCapture();
  SetCursor(m_hCursorOld);
  ReleaseDC(m_hWnd, hDC);

  if(fWithinBounds)
  {
    pPoint->x = ptsClient.x;
    pPoint->y = ptsClient.y;
    return TRUE;
  }

  return FALSE;
}

Member Data Documentation

HCURSOR CSplitterLite::m_hCursorOld

Definition at line 390 of file cdialoglite.h.

HCURSOR CSplitterLite::m_hCursorRight

Definition at line 392 of file cdialoglite.h.

HCURSOR CSplitterLite::m_hCursorTop

Definition at line 391 of file cdialoglite.h.

INT CSplitterLite::m_iBorderCX

Definition at line 394 of file cdialoglite.h.

INT CSplitterLite::m_iBorderCY

Definition at line 395 of file cdialoglite.h.

CSplitterLite* CSplitterLite::m_pCWndBottom

Definition at line 386 of file cdialoglite.h.

CSplitterLite* CSplitterLite::m_pCWndLeft

Definition at line 387 of file cdialoglite.h.

CSplitterLite* CSplitterLite::m_pCWndRight

Definition at line 388 of file cdialoglite.h.

CSplitterLite* CSplitterLite::m_pCWndTop

Definition at line 385 of file cdialoglite.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialoglite.h
  • Dataaccess/oledb/rowsetviewer/cdialoglite.cpp
Generated on Wed Nov 13 2024 16:57:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSpyCon Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Private Attributes

CSpyCon Class Reference

#include "SpyCon.h"

List of all members.

Public Member Functions

CSpyCon ()
~CSpyCon ()
STDMETHOD() | CanInPlaceActivate (void)
STDMETHOD() | ContextSensitiveHelp (BOOL fEnterMode)
STDMETHOD() | DeactivateAndUndo (void)
STDMETHOD() | DiscardUndoState (void)
void | FinalRelease ()
STDMETHOD() | GetContainer (IOleContainer **ppContainer)
STDMETHOD() | GetMoniker (DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk)
STDMETHOD() | GetWindow (HWND *phwnd)
STDMETHOD() | GetWindowContext (IOleInPlaceFrame **ppFrame, IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect, LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
LRESULT | OnAbout (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnAlwaysOnTop (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnChooseFont (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnChooseLogFile (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnClear (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnClose (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnErase (UINT, WPARAM, LPARAM, BOOL &bHandled)
LRESULT | OnExit (WORD, WORD, HWND, BOOL &)
LRESULT | OnInitMenu (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
STDMETHOD() | OnInPlaceActivate (void)
STDMETHOD() | OnInPlaceDeactivate (void)
LRESULT | OnLogToFile (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnNCDestroy (UINT, WPARAM, LPARAM, BOOL &)
STDMETHOD() | OnPosRectChange (LPCRECT lprcPosRect)
LRESULT | OnSave (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnSaveNow (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnSelectFilter (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
STDMETHOD() | OnShowWindow (BOOL fShow)
LRESULT | OnSize (UINT, WPARAM, LPARAM, BOOL &)
LRESULT | OnSysCommand (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
LRESULT | OnToggleGridLines (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnToggleSaveOnExit (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnToggleShowOnScreen (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
STDMETHOD() | OnUIActivate (void)
STDMETHOD() | OnUIDeactivate (BOOL fUndoable)
STDMETHOD() | RequestNewObjectLayout (void)
STDMETHOD() | Run ()
STDMETHOD() | SaveObject (void)
HRESULT | SaveSettings ()
STDMETHOD() | Scroll (SIZE scrollExtant)
STDMETHOD() | ShowObject (void)

Public Attributes

BOOL m_bSaveOnExit
BOOL m_bTopmost
WINDOWPLACEMENT | m_wp

Private Attributes

BOOL m_bInPlaceActive
IOleObject * | m_pOleObject
IComSpy * m_pSpy

Detailed Description

Definition at line 24 of file SpyCon.h.

Constructor & Destructor Documentation

CSpyCon::~CSpyCon ( ) [inline]

Definition at line 43 of file SpyCon.h.

  {
    SafeRelease(m_pSpy);
    SafeRelease(m_pOleObject);
  }

CSpyCon::CSpyCon ( ) [inline]

Definition at line 48 of file SpyCon.h.

  {
    memset(&m_wp, NULL, sizeof(m_wp));
    m_wp.length = sizeof(m_wp);
    m_bTopmost = FALSE;
    m_bInPlaceActive = FALSE;
    m_bSaveOnExit = TRUE;
    m_pSpy = NULL;
    m_pOleObject = NULL;
  }

Member Function Documentation

STDMETHOD() CSpyCon::CanInPlaceActivate ( void ) [inline]

Definition at line 187 of file SpyCon.h.

  {
    return S_OK;
  }

STDMETHOD() CSpyCon::ContextSensitiveHelp ( BOOL fEnterMode ) [inline]

Definition at line 179 of file SpyCon.h.

  {
    ATLTRACENOTIMPL(_T("IOleWindow::CanInPlaceActivate"));
  }

STDMETHOD() CSpyCon::DeactivateAndUndo ( void ) [inline]

Definition at line 224 of file SpyCon.h.

  {
    ATLTRACENOTIMPL(_T("IOleInPlaceSite::DeactivateAndUndo"));
  }

STDMETHOD() CSpyCon::DiscardUndoState ( void ) [inline]

Definition at line 220 of file SpyCon.h.

  {
    ATLTRACENOTIMPL(_T("IOleInPlaceSite::DiscardUndoState"));
  }

void CSpyCon::FinalRelease ( ) [inline]

Definition at line 59 of file SpyCon.h.

  {
    SafeRelease(m_pSpy);
    SafeRelease(m_pOleObject);
  }

STDMETHOD() CSpyCon::GetContainer ( IOleContainer ** ppContainer ) [inline]

Definition at line 154 of file SpyCon.h.

  {
    ATLTRACENOTIMPL(_T("IOleClientSite::GetContainer"));
  }

STDMETHOD() CSpyCon::GetMoniker | ( | DWORD | dwAssign,
 |  | DWORD | dwWhichMoniker,
 |  | IMoniker ** | ppmk |
 | ) |  |  | [inline]

Definition at line 150 of file SpyCon.h.

  {
    ATLTRACENOTIMPL(_T("IOleClientSite::GetMoniker"));
  }

STDMETHOD() CSpyCon::GetWindow ( HWND * phwnd ) [inline]

Definition at line 174 of file SpyCon.h.

  {
    *phwnd = m_hWnd;
    return S_OK;
  }

STDMETHOD() CSpyCon::GetWindowContext | ( | IOleInPlaceFrame ** | ppFrame,
 |  | IOleInPlaceUIWindow ** | ppDoc,
 |  | LPRECT | lprcPosRect,
 |  | LPRECT | lprcClipRect,
 |  | LPOLEINPLACEFRAMEINFO | lpFrameInfo |
 | ) |  |  | [inline]

Definition at line 200 of file SpyCon.h.

  {
    GetClientRect(lprcPosRect);
    GetClientRect(lprcClipRect);
    return S_OK;
  }

LRESULT CSpyCon::OnAbout | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 258 of file SpyCon.Cpp.

{
  m_pSpy -> About();
  return 0;
}

LRESULT CSpyCon::OnAlwaysOnTop | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 245 of file SpyCon.Cpp.

{

  m_bTopmost = 1 - m_bTopmost;
  if (m_bTopmost)
    SetWindowPos(HWND_TOPMOST, 0,0,0,0, SWP_NOMOVE|SWP_NOSIZE);
  else
    SetWindowPos(HWND_NOTOPMOST, 0,0,0,0, SWP_NOMOVE|SWP_NOSIZE);
  return 0;
}

LRESULT CSpyCon::OnChooseFont | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 266 of file SpyCon.Cpp.

{
  m_pSpy -> ChooseFont();
  return 0;
}

LRESULT CSpyCon::OnChooseLogFile | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 149 of file SpyCon.Cpp.

{
  CComBSTR sFileName;
  BOOL bCanceled;
  m_pSpy -> ChooseLogFile(&sFileName, &bCanceled);
  return 0;

}

LRESULT CSpyCon::OnClear | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 299 of file SpyCon.Cpp.

{
  m_pSpy -> ClearAllEvents();
  return 0;
}

LRESULT CSpyCon::OnClose | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |
LRESULT CSpyCon::OnErase | ( | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM | ,
 |  | BOOL & | bHandled |
 | ) |  |  | [inline]

Definition at line 120 of file SpyCon.h.

  {
    if (m_bInPlaceActive)
      return 0;
    bHandled = FALSE;
    return 1;
  }

LRESULT CSpyCon::OnExit | ( | WORD | ,
 |  | WORD | ,
 |  | HWND | ,
 |  | BOOL & |
 | ) |  |

Definition at line 275 of file SpyCon.Cpp.

{
  if (m_bSaveOnExit)
    SaveSettings();
  m_pOleObject->Close(OLECLOSE_NOSAVE);
  SafeRelease(m_pOleObject);
  SafeRelease(m_pSpy);
  DestroyWindow();
  return 0;
}

LRESULT CSpyCon::OnInitMenu | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 200 of file SpyCon.Cpp.

{

  HMENU hMenu = (HMENU)wParam;
  CComBSTR temp = "&Log to File ";
  CComBSTR sFileName;
  m_pSpy -> get_LogFile(&sFileName);
  if (sFileName.Length() > 5)
    temp += sFileName;
  else
    temp = "&Log To file...";

  USES_CONVERSION;
  ModifyMenu(hMenu, ID_LOG, MF_BYCOMMAND|MF_STRING, ID_LOG, OLE2T(temp));
  BOOL bVal;
  m_pSpy -> get_LogToFile(&bVal);
  CheckMenuItem(hMenu, ID_LOG,   bVal ? MF_BYCOMMAND|MF_CHECKED : MF_BYCOMMAND|MF_UNCHECKED);
  m_pSpy -> get_ShowGridLines(&bVal);
  CheckMenuItem(hMenu, ID_OPTIONS_GRID_LINES,  bVal ? MF_BYCOMMAND|MF_CHECKED : MF_BYCOMMAND|MF_UNCHECKED);
  m_pSpy -> get_ShowOnScreen(&bVal);
  CheckMenuItem(hMenu, ID_SHOW_ON_SCREEN,  bVal ? MF_BYCOMMAND|MF_CHECKED : MF_BYCOMMAND|MF_UNCHECKED);
  CheckMenuItem(hMenu, IDM_ON_TOP,  m_bTopmost ? MF_BYCOMMAND|MF_CHECKED : MF_BYCOMMAND|MF_UNCHECKED);
  CheckMenuItem(hMenu, ID_SAVE_ON_EXIT,  m_bSaveOnExit ? MF_BYCOMMAND|MF_CHECKED : MF_BYCOMMAND|MF_UNCHECKED);

  return 0;
}

STDMETHOD() CSpyCon::OnInPlaceActivate ( void ) [inline]

Definition at line 191 of file SpyCon.h.

  {
    m_bInPlaceActive = TRUE;
    return S_OK;
  }

STDMETHOD() CSpyCon::OnInPlaceDeactivate ( void ) [inline]

Definition at line 215 of file SpyCon.h.

  {
    m_bInPlaceActive = FALSE;
    return S_OK;
  }

LRESULT CSpyCon::OnLogToFile | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 136 of file SpyCon.Cpp.

{

  _ASSERTE(m_pSpy);
  BOOL bVal;
  m_pSpy -> get_LogToFile(&bVal);
  bVal = 1 - bVal;
  m_pSpy -> put_LogToFile(bVal);
  return 0;
}

LRESULT CSpyCon::OnNCDestroy | ( | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM | ,
 |  | BOOL & |  |
 | ) |  |  | [inline]

Definition at line 114 of file SpyCon.h.

  {
    PostQuitMessage(0);
    return 0;
  }

STDMETHOD() CSpyCon::OnPosRectChange ( LPCRECT lprcPosRect ) [inline]

Definition at line 228 of file SpyCon.h.

  {
    ATLTRACENOTIMPL(_T("IOleInPlaceSite::OnPosRectChange"));
  }

LRESULT CSpyCon::OnSave | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 309 of file SpyCon.Cpp.

{
  m_pSpy -> SaveToFile();
  return 0;

}

LRESULT CSpyCon::OnSaveNow | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 289 of file SpyCon.Cpp.

{
  SaveSettings();
  return 0;
}

LRESULT CSpyCon::OnSelectFilter | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 112 of file SpyCon.Cpp.

{
  _ASSERTE(m_pSpy);
  m_pSpy->SelectApplications();
  return 0;
}

STDMETHOD() CSpyCon::OnShowWindow ( BOOL fShow ) [inline]

Definition at line 162 of file SpyCon.h.

  {
    ATLTRACENOTIMPL(_T("IOleClientSite::OnShowWindow"));
  }

LRESULT CSpyCon::OnSize | ( | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM | ,
 |  | BOOL & |  |
 | ) |  |  | [inline]

Definition at line 128 of file SpyCon.h.

  {
    if (m_pOleObject && m_bInPlaceActive)
    {
      CComQIPtr<IOleInPlaceObject, &IID_IOleInPlaceObject> pInPlaceObject(m_pOleObject);
      RECT rcClient;
      GetClientRect(&rcClient);
      pInPlaceObject->SetObjectRects(&rcClient, &rcClient);
      GetWindowPlacement(&m_wp); // for storing in the registry
    }
    return 0;
  }

LRESULT CSpyCon::OnSysCommand | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 121 of file SpyCon.Cpp.

{

  bHandled = FALSE; // always do default processing

  if (wParam == SC_CLOSE)
    OnExit(NULL, NULL, NULL, bHandled);

  return 0;
}

LRESULT CSpyCon::OnToggleGridLines | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 232 of file SpyCon.Cpp.

{

  _ASSERTE(m_pSpy);
  BOOL bVal;
  m_pSpy -> get_ShowGridLines(&bVal);
  bVal = 1 - bVal;
  m_pSpy -> put_ShowGridLines(bVal);
  return 0;
}

LRESULT CSpyCon::OnToggleSaveOnExit | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 160 of file SpyCon.Cpp.

{
  m_bSaveOnExit = 1 - m_bSaveOnExit;
  //
  //  the UI semantics are odd here...if you have this selected, and deselect it
  //  the fact you deselected it won't be saved (you have to click on "Save Now"
  //  so I'm going to always write what you choose to the registry if you deselect it

  if (FALSE == m_bSaveOnExit)
  {
    HKEY hKey = NULL;
    DWORD dwDisp;
    LONG lRes = RegCreateKeyEx(HKEY_LOCAL_MACHINE, gsSubKey, NULL, NULL, REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,  NULL,  &hKey, &dwDisp);
    if (hKey)
    {
      lRes = RegSetValueEx(hKey, _T("SaveOnExit"), NULL, REG_DWORD, (BYTE *)&m_bSaveOnExit, sizeof(BOOL));
      RegCloseKey(hKey);
    }
  }

  return 0;

}

LRESULT CSpyCon::OnToggleShowOnScreen | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 187 of file SpyCon.Cpp.

{
  _ASSERTE(m_pSpy);
  BOOL bVal;
  m_pSpy -> get_ShowOnScreen(&bVal);
  bVal = 1 - bVal;
  m_pSpy -> put_ShowOnScreen(bVal);
  return 0;

}

STDMETHOD() CSpyCon::OnUIActivate ( void ) [inline]

Definition at line 196 of file SpyCon.h.

  {
    ATLTRACENOTIMPL(_T("IOleInPlaceSite::OnUIActivate"));
  }

STDMETHOD() CSpyCon::OnUIDeactivate ( BOOL fUndoable ) [inline]

Definition at line 211 of file SpyCon.h.

  {
    ATLTRACENOTIMPL(_T("IOleInPlaceSite::OnUIDeactivate"));
  }

STDMETHOD() CSpyCon::RequestNewObjectLayout ( void ) [inline]

Definition at line 166 of file SpyCon.h.

  {
    ATLTRACENOTIMPL(_T("IOleClientSite::RequestNewObjectLayout"));
  }

STDMETHODIMP CSpyCon::Run ( )

Definition at line 27 of file SpyCon.Cpp.

{
  RECT rcPos = { CW_USEDEFAULT, 0, 0, 0 };
  HMENU hMenu = LoadMenu(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MENU1));
  Create(GetDesktopWindow(), rcPos, _T("COM Spy"), WS_VISIBLE | WS_OVERLAPPEDWINDOW, 0, PtrToUint(hMenu));
  //
  //  Set the right icon
  //
  HICON hIcon = LoadIcon(_Module.GetModuleInstance(), MAKEINTRESOURCE(IDI_MAIN));
  if (hIcon)
    SetIcon(hIcon, TRUE);

  // create the spy control
  CoCreateInstance(CLSID_ComSpy, NULL, CLSCTX_INPROC, IID_IOleObject, (void**)&m_pOleObject);
  if (!m_pOleObject)
  {
    MessageBox(_T("CoCreateInstance failed"));
    return 0;
  }
  m_pOleObject->SetClientSite(this);
  m_pOleObject -> QueryInterface(IID_IComSpy, (void **)&m_pSpy);
  _ASSERTE(m_pSpy);

// get our window state from the registry
  HKEY hKey = NULL;
  DWORD dwDisp;
  LONG lRes = RegCreateKeyEx(HKEY_LOCAL_MACHINE, gsSubKey, NULL, NULL, REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,  NULL,  &hKey, &dwDisp);
  if (hKey)
  {

    DWORD dwType = REG_DWORD;
    DWORD dwSize = sizeof(m_wp.rcNormalPosition.left);
    lRes = RegQueryValueEx(hKey, _T("Left"), NULL, &dwType, (BYTE *)&m_wp.rcNormalPosition.left, &dwSize);
    lRes = RegQueryValueEx(hKey, _T("Top"), NULL, &dwType, (BYTE *)&m_wp.rcNormalPosition.top, &dwSize);
    lRes = RegQueryValueEx(hKey, _T("Right"), NULL, &dwType, (BYTE *)&m_wp.rcNormalPosition.right, &dwSize);
    lRes = RegQueryValueEx(hKey, _T("Bottom"), NULL, &dwType, (BYTE *)&m_wp.rcNormalPosition.bottom, &dwSize);
    lRes = RegQueryValueEx(hKey, _T("ShowWindow"), NULL, &dwType, (BYTE *)&m_wp.showCmd, &dwSize);
    //always on top option
    lRes = RegQueryValueEx(hKey, _T("AlwaysOnTop"), NULL, &dwType, (BYTE *)&m_bTopmost, &dwSize);
    m_bTopmost = 1 - m_bTopmost;
    BOOL bHandled;
    OnAlwaysOnTop(0,0,0,bHandled);

    // save on exit
    lRes = RegQueryValueEx(hKey, _T("SaveOnExit"), NULL, &dwType, (BYTE *)&m_bSaveOnExit, &dwSize);

    // get the stream from the registry
    dwType = REG_BINARY;
    lRes = RegQueryValueEx(hKey, _T("ControlProperties"), NULL, &dwType, NULL, &dwSize);
    if (lRes == ERROR_SUCCESS)
    {
      HGLOBAL hGlobal = GlobalAlloc(GPTR, dwSize);
      BYTE * pByte = (BYTE *)GlobalLock(hGlobal);
      lRes = RegQueryValueEx(hKey, _T("ControlProperties"), NULL, &dwType, (BYTE *)pByte, &dwSize);
      GlobalUnlock(hGlobal);
      IStream * pStream;
      CreateStreamOnHGlobal(hGlobal, TRUE, &pStream);

      CComQIPtr<IPersistStreamInit, &IID_IPersistStreamInit> pPersist(m_pSpy);
      _ASSERTE(pPersist.p);

      if (pPersist != NULL)
      {
        pPersist -> Load(pStream);

      }
      pStream -> Release();
    }
  }

  if (!( ( m_wp.rcNormalPosition.right - m_wp.rcNormalPosition.left < 10) && (m_wp.rcNormalPosition.bottom - m_wp.rcNormalPosition.top < 10)))
    SetWindowPlacement(&m_wp);
  else
    ShowWindow(SW_SHOWNORMAL);

  GetClientRect(&rcPos);
  MSG msg;
  m_pOleObject->DoVerb(OLEIVERB_INPLACEACTIVATE, &msg, this, 0, m_hWnd, &rcPos);
  return S_OK;
}

STDMETHOD() CSpyCon::SaveObject ( void ) [inline]

Definition at line 146 of file SpyCon.h.

  {
    ATLTRACENOTIMPL(_T("IOleClientSite::SaveObject"));
  }

HRESULT CSpyCon::SaveSettings ( )

Definition at line 318 of file SpyCon.Cpp.

{
  _ASSERTE(m_pSpy);
  if(!m_pSpy)
    return E_UNEXPECTED;
  HKEY hKey = NULL;
  DWORD dwDisp;
  LONG lRes = RegCreateKeyEx(HKEY_LOCAL_MACHINE, gsSubKey, NULL, NULL, REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,  NULL,  &hKey, &dwDisp);
  if (hKey)
  {
    lRes = RegSetValueEx(hKey, _T("Left"), NULL, REG_DWORD, (BYTE *)&m_wp.rcNormalPosition.left, sizeof(m_wp.rcNormalPosition.left));
    lRes = RegSetValueEx(hKey, _T("Top"), NULL, REG_DWORD, (BYTE *)&m_wp.rcNormalPosition.top, sizeof(m_wp.rcNormalPosition.left));
    lRes = RegSetValueEx(hKey, _T("Right"), NULL, REG_DWORD, (BYTE *)&m_wp.rcNormalPosition.right, sizeof(m_wp.rcNormalPosition.left));
    lRes = RegSetValueEx(hKey, _T("Bottom"), NULL, REG_DWORD, (BYTE *)&m_wp.rcNormalPosition.bottom, sizeof(m_wp.rcNormalPosition.left));
    lRes = RegSetValueEx(hKey, _T("ShowWindow"), NULL, REG_DWORD, (BYTE *)&m_wp.showCmd, sizeof(BOOL));
    lRes = RegSetValueEx(hKey, _T("AlwaysOnTop"), NULL, REG_DWORD, (BYTE *)&m_bTopmost, sizeof(BOOL));
    lRes = RegSetValueEx(hKey, _T("SaveOnExit"), NULL, REG_DWORD, (BYTE *)&m_bSaveOnExit, sizeof(BOOL));

    CComQIPtr<IPersistStreamInit, &IID_IPersistStreamInit> pPersist(m_pSpy);
    _ASSERTE(pPersist.p);
    IStream * pStream;
    CreateStreamOnHGlobal(NULL, TRUE, &pStream);
    if (pPersist != NULL)
    {
      pPersist -> Save(pStream, TRUE);
      HGLOBAL hGlobal;
      GetHGlobalFromStream(pStream, &hGlobal);
      BYTE * pStByte = (BYTE *)GlobalLock(hGlobal);
      SIZE_T dwSize = GlobalSize(hGlobal);
      lRes = RegSetValueEx(hKey, _T("ControlProperties"), NULL, REG_BINARY, (BYTE *)pStByte, (DWORD) dwSize);
      GlobalUnlock(hGlobal);

    }
    pStream -> Release();
    RegCloseKey(hKey);
  }
  return S_OK;
}

STDMETHOD() CSpyCon::Scroll ( SIZE scrollExtant ) [inline]

Definition at line 207 of file SpyCon.h.

  {
    ATLTRACENOTIMPL(_T("IOleInPlaceSite::Scroll"));
  }

STDMETHOD() CSpyCon::ShowObject ( void ) [inline]

Definition at line 158 of file SpyCon.h.

  {
    ATLTRACENOTIMPL(_T("IOleClientSite::ShowObject"));
  }

Member Data Documentation

BOOL CSpyCon::m_bInPlaceActive [private]

Definition at line 35 of file SpyCon.h.

BOOL CSpyCon::m_bSaveOnExit

Definition at line 41 of file SpyCon.h.

BOOL CSpyCon::m_bTopmost

Definition at line 39 of file SpyCon.h.

IOleObject* CSpyCon::m_pOleObject [private]

Definition at line 34 of file SpyCon.h.

IComSpy* CSpyCon::m_pSpy [private]

Definition at line 36 of file SpyCon.h.

WINDOWPLACEMENT CSpyCon::m_wp

Definition at line 40 of file SpyCon.h.

The documentation for this class was generated from the following files:
  • Com/Administration/Spy/ComSpy/SpyCon.h
  • Com/Administration/Spy/ComSpy/SpyCon.Cpp
Generated on Wed Nov 13 2024 16:57:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CStabilize Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CStabilize Class Reference

#include "Stablize.h"

List of all members.

Public Member Functions

CStabilize (CSafeRefCount *pObjSafeRefCount)
~CStabilize ()

Private Attributes

CSafeRefCount * m_pObjSafeRefCount

Detailed Description

Definition at line 75 of file Stablize.h.

Constructor & Destructor Documentation

CStabilize::CStabilize ( CSafeRefCount * pObjSafeRefCount ) [inline]

Definition at line 85 of file Stablize.h.

{
        pObjSafeRefCount->IncrementNestCount();
        m_pObjSafeRefCount = pObjSafeRefCount;
}

CStabilize::~CStabilize ( ) [inline]

Definition at line 91 of file Stablize.h.

{
        m_pObjSafeRefCount->DecrementNestCount();
}

Member Data Documentation

CSafeRefCount* CStabilize::m_pObjSafeRefCount [private]

Definition at line 82 of file Stablize.h.

The documentation for this class was generated from the following file:
  • Com/Fundamentals/Include/Stablize.h
Generated on Wed Nov 13 2024 16:57:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Cstack_c Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

Cstack_c Class Reference

#include "CStack.h"

Inherits Stack_c< int >.

List of all members.

Public Member Functions

Cstack_c ()
~Cstack_c ()
int | CGetCounter ()
BOOL | CPop (int &Data)
BOOL CPush ()
BOOL IsEmpty ()

Private Attributes

int | counter

Detailed Description

Definition at line 27 of file CStack.h.

Constructor & Destructor Documentation

Cstack_c::Cstack_c ( ) [inline]

Definition at line 29 of file CStack.h.

:

Cstack_c::~Cstack_c ( ) [inline]

Definition at line 30 of file CStack.h.

: Stack_c<int>() { counter = 0; }

Member Function Documentation

int Cstack_c::CGetCounter ( ) [inline]

Definition at line 33 of file CStack.h.

{return Stack_c<int>::Pop(Data);}

BOOL Cstack_c::CPop ( int & Data ) [inline]

Definition at line 32 of file CStack.h.

{return Stack_c<int>::Push(counter++);}

BOOL Cstack_c::CPush ( ) [inline]

Definition at line 31 of file CStack.h.

{}

BOOL Cstack_c::IsEmpty ( void ) [inline]

Reimplemented from Stack_c< int >.

Definition at line 34 of file CStack.h.

{return counter;}

Member Data Documentation

int Cstack_c::counter [private]

Definition at line 37 of file CStack.h.

The documentation for this class was generated from the following file:
  • NetDS/WinSock/Dt_Dll/CStack.h
Generated on Wed Nov 13 2024 16:57:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CStartOfFileElement Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CStartOfFileElement Class Reference

#include "Start.Hxx"

Inherits CHtmlElement.

List of all members.

Public Member Functions

CStartOfFileElement (CHtmlIFilter &htmlIFilter, CSerialStream &serialStream)
virtual SCODE | GetChunk (STAT_CHUNK *pStat)
virtual SCODE | GetText (ULONG *pcwcBuffer, WCHAR *awcBuffer)
virtual void | InitStatChunk (STAT_CHUNK *pStat)

Detailed Description

Definition at line 25 of file Start.Hxx.

Constructor & Destructor Documentation

CStartOfFileElement::CStartOfFileElement | ( | CHtmlIFilter & | htmlIFilter,
 |  | CSerialStream & | serialStream
 | ) |  |

Definition at line 29 of file Start.Cxx.

    : CHtmlElement(htmlIFilter, serialStream)
{
}

Member Function Documentation

SCODE CStartOfFileElement::GetChunk ( STAT_CHUNK * pStat ) [virtual]

Implements CHtmlElement.

Definition at line 47 of file Start.Cxx.

{
    //
    // This is the first GetChunk call ever, hence setup the correct
    // Html Element
    //
    SCODE sc = SwitchToNextHtmlElement( pStat );

    return sc;
}

SCODE CStartOfFileElement::GetText | ( | ULONG * | pcwcBuffer,
 |  | WCHAR * | awcBuffer |
 | ) |  |  | [virtual]

Implements CHtmlElement.

Definition at line 71 of file Start.Cxx.

{
    //
    // CStartOfFile is used to set up the first chunk correctly, and the first
    // chunk cannot be of type CStartOfFile
    //
    Win4Assert( !"CStartOfFileElement::GetText() call unexpected" );

    return E_FAIL;
}

void CStartOfFileElement::InitStatChunk ( STAT_CHUNK * pStat ) [virtual]

Implements CHtmlElement.

Definition at line 94 of file Start.Cxx.

{
    Win4Assert( !"CStartOfFileElement::InitStatChunk() call unexpected" );
}

The documentation for this class was generated from the following files:
  • WinBase/Indexing/IFilter/Start.Hxx
  • WinBase/Indexing/IFilter/Start.Cxx
Generated on Wed Nov 13 2024 16:57:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSTATest Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CSTATest Class Reference

#include "STATest.h"

List of all members.

Public Member Functions

CSTATest ()
STDMETHOD() Exercise (void)

Detailed Description

Definition at line 29 of file STATest.h.

Constructor & Destructor Documentation

CSTATest::CSTATest ( ) [inline]

Definition at line 35 of file STATest.h.

  {
  }

Member Function Documentation

STDMETHODIMP CSTATest::Exercise ( void )

Definition at line 45 of file STATest.Cpp.

{

  DWORD dwCount, dwValue = 0;

  for (dwCount = 0; dwCount < LOOPCOUNT; dwCount++)
    dwValue += dwCount;

  return S_OK;
}

The documentation for this class was generated from the following files:
  • Com/Services/Concurrency/SyncComp/STAObject/STATest.h
  • Com/Services/Concurrency/SyncComp/STAObject/STATest.Cpp
Generated on Wed Nov 13 2024 16:57:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CStaticEntity Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Private Member Functions

CStaticEntity Class Reference

#include "entity.h"

List of all members.

Private Member Functions

DECLARE_FIXED_ALLOC (CStaticEntity)

Detailed Description

Definition at line 333 of file entity.h.

Member Function Documentation

CStaticEntity::DECLARE_FIXED_ALLOC ( CStaticEntity ) [private]
The documentation for this class was generated from the following file:
  • Com/Tools/EntityProxy/DataServices/entity.h
Generated on Wed Nov 13 2024 16:57:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CStaticMap Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CStaticMap Class Reference

#include "staticmap.h"

List of all members.

Public Member Functions

CStaticMap ()
~CStaticMap ()
BOOL | Add (LPCWSTR key, long len, long val)
BOOL | AddNoLen (LPCWSTR key, long val)
void | ClearArray ()
int | FindKey (LPCWSTR key) const
int | GetSize () const
void | Initialize (long Size)
long | Lookup (LPCWSTR key) const
void | RemoveAll ()
void | SetAtIndex (int nIndex, LPCWSTR key, long len)
void | SetAtIndexNoLen (int nIndex, LPCWSTR key)
BOOL | SetKey (long val, WCHAR *key) const

Public Attributes

CString * m_aKey
int | m_nSize

Detailed Description

Definition at line 2 of file staticmap.h.

Constructor & Destructor Documentation

CStaticMap::CStaticMap ( ) [inline]

Definition at line 9 of file staticmap.h.

               : m_nSize(0)
  {
    m_aKey = NULL;
  }

CStaticMap::~CStaticMap ( ) [inline]

Definition at line 23 of file staticmap.h.

  {
    RemoveAll();
    ClearArray();
  }

Member Function Documentation

BOOL CStaticMap::Add | ( | LPCWSTR | key,
 |  | long | len,
 |  | long | val |
 | ) |  |  | [inline]

Definition at line 41 of file staticmap.h.

  {
    if (val >= m_nSize)
    {
      m_nSize = val+1;
    }
    SetAtIndex(val, key, len);
    return TRUE;
  }

BOOL CStaticMap::AddNoLen | ( | LPCWSTR | key,
 |  | long | val |
 | ) |  |  | [inline]

Definition at line 50 of file staticmap.h.

  {
    if (val >= m_nSize)
    {
      m_nSize = val+1;
    }
    SetAtIndexNoLen(val, key);
    return TRUE;
  }

void CStaticMap::ClearArray ( ) [inline]

Definition at line 14 of file staticmap.h.

  {
    if (m_aKey != NULL)
    {
      delete [] m_aKey;
      m_aKey = NULL;
    }
  }

int CStaticMap::FindKey ( LPCWSTR key ) const [inline]

Definition at line 88 of file staticmap.h.

  {
    for(int i = 0; i < m_nSize; i++)
    {
      if(m_aKey[i] == key)
        return i;
    }
    return -1;  // not found
  }

int CStaticMap::GetSize ( ) const [inline]

Definition at line 37 of file staticmap.h.

  {
    return m_nSize;
  }

void CStaticMap::Initialize ( long Size ) [inline]

Definition at line 29 of file staticmap.h.

  {
    ClearArray();

    m_aKey = new CString[Size + 1];
  }

long CStaticMap::Lookup ( LPCWSTR key ) const [inline]

Definition at line 63 of file staticmap.h.

  {
    int nIndex = FindKey(key);
    return nIndex;
  }

void CStaticMap::RemoveAll ( ) [inline]

Definition at line 59 of file staticmap.h.

  {
    m_nSize = 0;
  }

void CStaticMap::SetAtIndex | ( | int | nIndex,
 |  | LPCWSTR | key,
 |  | long | len |
 | ) |  |  | [inline]

Definition at line 82 of file staticmap.h.

  {
    ATLASSERT(nIndex >= 0 && nIndex < m_nSize);

    m_aKey[nIndex].AssignCopy(len, key);
  }

void CStaticMap::SetAtIndexNoLen | ( | int | nIndex,
 |  | LPCWSTR | key |
 | ) |  |  | [inline]

Definition at line 76 of file staticmap.h.

  {
    ATLASSERT(nIndex >= 0 && nIndex < m_nSize);
    m_aKey[nIndex] = key;
  }

BOOL CStaticMap::SetKey | ( | long | val,
 |  | WCHAR * | key |
 | ) |  |  | const [inline]

Definition at line 68 of file staticmap.h.

  {
    m_aKey[val] = key;
    return TRUE;
  }

Member Data Documentation

CString* CStaticMap::m_aKey [mutable]

Definition at line 6 of file staticmap.h.

int CStaticMap::m_nSize

Definition at line 5 of file staticmap.h.

The documentation for this class was generated from the following file:
  • Com/Tools/EntityProxy/DataServices/staticmap.h
Generated on Wed Nov 13 2024 16:57:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CStaticNode Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes

CStaticNode Class Reference

#include "statnode.h"

Inherits CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CBaseNode, CBaseNode, CBaseNode, CBaseNode, CBaseNode, CBaseNode, CBaseNode, CBaseNode, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, CDelegationBase, and CDelegationBase.

List of all members.

Classes

struct | privateData

Public Member Functions

CStaticNode ()
CStaticNode ()
CStaticNode ()
CStaticNode ()
CStaticNode ()
CStaticNode ()
CStaticNode ()
CStaticNode ()
CStaticNode ()
CStaticNode (CComponentData *pComponentData=NULL)
CStaticNode ()
CStaticNode ()
CStaticNode ()
CStaticNode ()
CStaticNode ()
CStaticNode ()
CStaticNode ()
CStaticNode ()
CStaticNode ()
CStaticNode ()
CStaticNode ()
CStaticNode ()
CStaticNode (CComponentData *pComponentData=NULL)
CStaticNode ()
virtual | ~CStaticNode ()
virtual | ~CStaticNode ()
virtual | ~CStaticNode ()
virtual | ~CStaticNode ()
virtual | ~CStaticNode ()
virtual | ~CStaticNode ()
virtual | ~CStaticNode ()
virtual | ~CStaticNode ()
virtual | ~CStaticNode ()
virtual | ~CStaticNode ()
virtual | ~CStaticNode ()
virtual | ~CStaticNode ()
virtual | ~CStaticNode ()
virtual | ~CStaticNode ()
virtual | ~CStaticNode ()
virtual | ~CStaticNode ()
virtual | ~CStaticNode ()
virtual | ~CStaticNode ()
virtual | ~CStaticNode ()
virtual | ~CStaticNode ()
virtual | ~CStaticNode ()
virtual | ~CStaticNode ()
virtual | ~CStaticNode ()
virtual | ~CStaticNode ()
HRESULT | AddDeviceNode (NODE_PROPERTIES *pProperties)
HRESULT | AddDeviceNode (NODE_PROPERTIES *pProperties)
HRESULT | AddDeviceNode (NODE_PROPERTIES *pProperties)
HRESULT | AddDeviceNode (NODE_PROPERTIES *pProperties)
HRESULT | AddDeviceNode (NODE_PROPERTIES *pProperties)
HRESULT | AddDeviceNode (NODE_PROPERTIES *pProperties)
HRESULT | AddMenuItems (LPCONTEXTMENUCALLBACK ipCallback, long __RPC_FAR *pInsertionAllowed)
HRESULT | AddMenuItems (LPCONTEXTMENUCALLBACK ipCallback, long __RPC_FAR *pInsertionAllowed)
HRESULT | AddMenuItems (LPCONTEXTMENUCALLBACK ipCallback, long __RPC_FAR *pInsertionAllowed)
HRESULT | AddMenuItems (LPCONTEXTMENUCALLBACK ipCallback, long __RPC_FAR *pInsertionAllowed)
HRESULT | AddMenuItems (LPCONTEXTMENUCALLBACK ipCallback, long __RPC_FAR *pInsertionAllowed)
HRESULT | AddMenuItems (LPCONTEXTMENUCALLBACK ipCallback, long __RPC_FAR *pInsertionAllowed)
void | clearDirty ()
void | clearDirty ()
HRESULT | Command (long lCommandID)
HRESULT | Command (long lCommandID)
HRESULT | Command (long lCommandID)
HRESULT | Command (long lCommandID)
HRESULT | Command (long lCommandID)
HRESULT | Command (long lCommandID)
HRESULT | ControlbarNotify (LPARAM nArg, LPARAM lParam, LONG_PTR pCompData)
HRESULT | CreatePropertyPages (LPPROPERTYSHEETCALLBACK lpCallback, LONG_PTR Handle)
HRESULT | CreatePropertyPages (LPPROPERTYSHEETCALLBACK lpCallback, LONG_PTR Handle)
virtual HRESULT | CreatePropertyPages (IPropertySheetCallback *lpProvider, LONG_PTR handle)
virtual HRESULT | Expand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
DWORD GetAttributes ()
LPWSTR | GetAttributeString ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
virtual const int | GetBitmapIndex ()
void * | getData ()
void * | getData ()
LONG | getDataSize ()
LONG | getDataSize ()
HRESULT | GetDisplayInfo (SCOPEDATAITEM *pSDI)
HRESULT | GetDisplayInfo (SCOPEDATAITEM *pSDI)
HRESULT | GetDisplayInfo (RESULTDATAITEM *pRDI)
HRESULT | GetDisplayInfo (RESULTDATAITEM *pRDI)
HRESULT | GetDisplayInfo (SCOPEDATAITEM *pSDI)
HRESULT | GetDisplayInfo (RESULTDATAITEM *pRDI)
HRESULT | GetDisplayInfo (SCOPEDATAITEM *pSDI)
HRESULT | GetDisplayInfo (RESULTDATAITEM *pRDI)
HRESULT | GetDisplayInfo (SCOPEDATAITEM *pSDI)
HRESULT | GetDisplayInfo (RESULTDATAITEM *pRDI)
HRESULT | GetDisplayInfo (SCOPEDATAITEM *pSDI)
HRESULT | GetDisplayInfo (RESULTDATAITEM *pRDI)
HRESULT | GetDisplayInfo (SCOPEDATAITEM *pSDI)
HRESULT | GetDisplayInfo (RESULTDATAITEM *pRDI)
HRESULT | GetDisplayInfo (SCOPEDATAITEM *pSDI)
HRESULT | GetDisplayInfo (RESULTDATAITEM *pRDI)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
virtual const _TCHAR * | GetDisplayName (int nCol=0)
_TCHAR * | getHost ()
HWND | GetMessageWnd ()
HWND | GetMessageWnd ()
HWND | GetMessageWnd ()
HWND | GetMessageWnd ()
HWND | GetMessageWnd ()
HWND | GetMessageWnd ()
GUID & | GetNodeGUID ()
GUID & | GetNodeGUID ()
GUID & | GetNodeGUID ()
GUID * | GetNodeGUID ()
GUID & | GetNodeGUID ()
GUID & | GetNodeGUID ()
GUID * | GetNodeGUID ()
GUID & | GetNodeGUID ()
ULONG GetNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
ULONG GetNodeType ()
ULONG GetNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
ULONG GetNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
ULONG GetNodeType ()
virtual const GUID & | getNodeType ()
ULONG GetNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
ULONG GetNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
virtual const GUID & | getNodeType ()
ULONG GetNodeType ()
virtual const GUID & | getNodeType ()
LPWSTR | GetObjectPath ()
virtual HSCOPEITEM | GetParentScopeItem ()
HRESULT | GetProperties (LPNODEPROPS *ppNodeProps)
HRESULT | GetProperty (BSTR bstrPropertyName, PBSTR pbstrProperty)
HRESULT | GetResultViewType2 (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pRVTinfo)
HRESULT | GetResultViewType2 (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pRVTinfo)
HRESULT | GetResultViewType2 (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pRVTinfo)
HRESULT | GetResultViewType2 (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pRVTinfo)
HRESULT | GetResultViewType2 (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pRVTinfo)
HRESULT | GetResultViewType2 (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pRVTinfo)
HRESULT | GetResultViewType2 (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pRVTinfo)
HRESULT | GetResultViewType2 (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pRVTinfo)
HRESULT | GetWatermarks (HBITMAP __RPC_FAR *lphWatermark, HBITMAP __RPC_FAR *lphHeader, HPALETTE __RPC_FAR *lphPalette, BOOL __RPC_FAR *bStretch)
HRESULT | GetWatermarks (HBITMAP __RPC_FAR *lphWatermark, HBITMAP __RPC_FAR *lphHeader, HPALETTE __RPC_FAR *lphPalette, BOOL __RPC_FAR *bStretch)
virtual HRESULT | GetWatermarks (HBITMAP *lphWatermark, HBITMAP *lphHeader, HPALETTE *lphPalette, BOOL *bStretch)
virtual HRESULT | HasPropertySheets ()
HRESULT | Initialize (NODE_PROPERTIES *pNodeProps)
HRESULT | Initialize (NODE_PROPERTIES *pNodeProps)
HRESULT | Initialize (NODE_PROPERTIES *pNodeProps)
HRESULT | Initialize (LPNODEPROPS pNodeProps)
HRESULT | Initialize (NODE_PROPERTIES *pNodeProps)
HRESULT | Initialize (NODE_PROPERTIES *pNodeProps)
HRESULT | Initialize (NODE_PROPERTIES *pNodeProps)
HRESULT | Initialize (NODE_PROPERTIES *pNodeProps)
BOOL | IsAttributeSet (DWORD dwAttribute)
bool | isDirty ()
bool | isDirty ()
HRESULT | OnContextHelp (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnCutOrMove (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnDelete (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnDelete (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pComponent)
HRESULT | OnDelete (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
virtual HRESULT | OnExpand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
HRESULT | OnExpand (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pCompData)
HRESULT | OnExpand (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pCompData)
virtual HRESULT | OnExpand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
virtual HRESULT | OnExpand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
virtual HRESULT | OnExpand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
virtual HRESULT | OnExpand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
HRESULT | OnExpand (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pCompData)
HRESULT | OnExpand (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pCompData)
HRESULT | OnExpand (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pCompData)
virtual HRESULT | OnExpand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
virtual HRESULT | OnExpand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
HRESULT | OnExpand (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pCompData)
virtual HRESULT | OnExpand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
virtual HRESULT | OnExpand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
virtual HRESULT | OnExpand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
virtual HRESULT | OnExpand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
virtual HRESULT | OnExpand (IConsoleNameSpace *pConsoleNameSpace, IConsole *pConsole, HSCOPEITEM parent)
HRESULT | OnPaste (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnQueryPaste (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnRemoveChildren (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pCompData)
HRESULT | OnRemoveChildren (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pCompData)
HRESULT | OnRemoveChildren (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pCompData)
HRESULT | OnRemoveChildren (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pCompData)
HRESULT | OnRemoveChildren (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pCompData)
HRESULT | OnRemoveChildren (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pCompData)
HRESULT | OnRename (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnRename (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnRename (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnSelect (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnSelect (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pComponent)
HRESULT | OnSelect (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pComponent)
HRESULT | OnSelect (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnSelect (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pComponent)
HRESULT | OnSelect (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnSelect (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pComponent)
HRESULT | OnSelect (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnShow (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pComponent)
HRESULT | OnShow (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pComponent)
HRESULT | OnShow (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnShow (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnShow (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pComponent)
HRESULT | OnShow (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pComponent)
HRESULT | OnShow (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnShow (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
virtual HRESULT | OnShowContextHelp (IDisplayHelp *m_ipDisplayHelp, LPOLESTR helpFile)
virtual HRESULT | OnShowContextHelp (IDisplayHelp *m_ipDisplayHelp, LPOLESTR helpFile)
HRESULT | OnViewChange (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnViewChange (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | QueryForPropertyPage ()
HRESULT | QueryForPropertyPage ()
VOID | RemoveAttribute (DWORD dwAttribute)
VOID | SetAttribute (DWORD dwAttribute)
virtual void | SetScopeItemValue (HSCOPEITEM hscopeitem)
VOID | ToggleStatus (LPDATAOBJECT ipDataObject)
VOID | ToggleStatus (LPDATAOBJECT ipDataObject)
VOID | ToggleStatus (LPDATAOBJECT ipDataObject)
VOID | ToggleStatus (LPDATAOBJECT ipDataObject)
VOID | ToggleStatus (LPDATAOBJECT ipDataObject)
VOID | ToggleStatus (LPDATAOBJECT ipDataObject)

Static Public Member Functions

static LRESULT CALLBACK | StaticNodeWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
static LRESULT CALLBACK | StaticNodeWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
static LRESULT CALLBACK | StaticNodeWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
static LRESULT CALLBACK | StaticNodeWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
static LRESULT CALLBACK | StaticNodeWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
static LRESULT CALLBACK | StaticNodeWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)

Public Attributes

HWND | m_hAddDeviceDlg

Private Types

enum | { NUMBER_OF_CHILDREN = 4 }
enum | { NUMBER_OF_CHILDREN = 4 }
enum | { NUMBER_OF_CHILDREN = 4 }
enum | { NUMBER_OF_CHILDREN = 4 }
enum | { NUMBER_OF_CHILDREN = 4 }
enum | { NUMBER_OF_CHILDREN = 4 }
enum | { NUMBER_OF_CHILDREN = 4 }
enum | { NUMBER_OF_CHILDREN = 4 }
enum | { NUMBER_OF_CHILDREN = 4 }
enum | { NUMBER_OF_CHILDREN = 4 }
enum | { NUMBER_OF_CHILDREN = 4 }
enum | { NUMBER_OF_CHILDREN = 4 }
enum | { NUMBER_OF_CHILDREN = 4 }

Private Member Functions

HRESULT | DeleteScopeItems (LPCONSOLENAMESPACE2 ipCNS2)
HRESULT | DeleteScopeItems (LPCONSOLENAMESPACE2 ipCNS)
HRESULT | DeleteScopeItems (LPCONSOLENAMESPACE2 ipCNS2)
HRESULT | DeleteScopeItems (LPCONSOLENAMESPACE2 ipCNS2)
HRESULT | DeleteScopeItems (LPCONSOLENAMESPACE2 ipCNS)
HRESULT | DeleteScopeItems (LPCONSOLENAMESPACE2 ipCNS)
HRESULT | InitDefaultDevices ()
HRESULT | InsertScopeItems (LPCONSOLENAMESPACE2 ipCNS2)
HRESULT | InsertScopeItems (LPCONSOLENAMESPACE2 ipCNS2)
HRESULT | InsertScopeItems (LPCONSOLENAMESPACE2 ipCNS2)
HRESULT | InsertScopeItems (LPCONSOLENAMESPACE2 ipCNS)
HRESULT | InsertScopeItems (LPCONSOLENAMESPACE2 ipCNS)
HRESULT | InsertScopeItems (LPCONSOLENAMESPACE2 ipCNS)
HRESULT | RefreshNodeList ()
HRESULT | RefreshNodeList ()
HRESULT | RefreshNodeList ()
HRESULT | RefreshNodeList ()
HRESULT | RefreshNodeList ()
VOID | RemoveChildNodes ()
VOID | RemoveNodes ()
VOID | RemoveNodes ()
VOID | RemoveNodes ()
VOID | RemoveNodes ()
VOID | RemoveNodes ()

Static Private Member Functions

static BOOL CALLBACK | DialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)

Private Attributes

CDelegationBase * | children [NUMBER_OF_CHILDREN]
HWND | m_hMessageWnd
HSCOPEITEM | m_hParentHScopeItem
HSCOPEITEM | m_hStaticNode
CLListImpl< CDeviceNode
*, CDeviceNode * > 		m_NodeList
CComponentData * m_pCompData
struct CStaticNode::privateData | snapInData

Static Private Attributes

static GUID | m_thisGUID = CLSID_CComponentData
static const GUID | thisGuid = { 0x2974380c, 0x4c4b, 0x11d2, { 0x89, 0xd8, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28 } }
static GUID | thisGUID = { 0x2974380c, 0x4c4b, 0x11d2, { 0x89, 0xd8, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28 } }

Detailed Description

Definition at line 25 of file statnode.h.

Member Enumeration Documentation

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 42 of file statnode.h.

{ NUMBER_OF_CHILDREN = 4 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 45 of file statnode.h.

{ NUMBER_OF_CHILDREN = 4 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 46 of file statnode.h.

{ NUMBER_OF_CHILDREN = 4 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 44 of file statnode.h.

{ NUMBER_OF_CHILDREN = 5 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 44 of file statnode.h.

{ NUMBER_OF_CHILDREN = 4 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 44 of file statnode.h.

{ NUMBER_OF_CHILDREN = 4 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 44 of file statnode.h.

{ NUMBER_OF_CHILDREN = 5 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 44 of file statnode.h.

{ NUMBER_OF_CHILDREN = 5 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 57 of file statnode.h.

{ NUMBER_OF_CHILDREN = 4 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 44 of file statnode.h.

{ NUMBER_OF_CHILDREN = 4 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 44 of file statnode.h.

{ NUMBER_OF_CHILDREN = 4 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 44 of file statnode.h.

{ NUMBER_OF_CHILDREN = 4 };

anonymous enum [private]
Enumerator:
NUMBER_OF_CHILDREN

Definition at line 44 of file statnode.h.

{ NUMBER_OF_CHILDREN = 4 };

Constructor & Destructor Documentation

CStaticNode::CStaticNode ( )

Definition at line 29 of file statnode.Cpp.

{
}

CStaticNode::~CStaticNode ( ) [virtual]

Definition at line 33 of file statnode.Cpp.

{
}

CStaticNode::CStaticNode ( CComponentData * pComponentData = NULL )

Definition at line 34 of file statnode.Cpp.

{
    m_pComponentData = pComponentData;

    children[0] = new CPeoplePoweredVehicle(pComponentData);
    children[1] = new CLandBasedVehicle(pComponentData);
    children[2] = new CSkyBasedVehicle(pComponentData);
    children[3] = new CSpaceVehicle(pComponentData);
}

virtual CStaticNode::~CStaticNode ( ) [virtual]
CStaticNode::CStaticNode ( )
virtual CStaticNode::~CStaticNode ( ) [virtual]
CStaticNode::CStaticNode ( )
virtual CStaticNode::~CStaticNode ( ) [virtual]
CStaticNode::CStaticNode ( )
virtual CStaticNode::~CStaticNode ( ) [virtual]
CStaticNode::CStaticNode ( )
virtual CStaticNode::~CStaticNode ( ) [virtual]
CStaticNode::CStaticNode ( )
virtual CStaticNode::~CStaticNode ( ) [virtual]
CStaticNode::CStaticNode ( )
virtual CStaticNode::~CStaticNode ( ) [virtual]
CStaticNode::CStaticNode ( )
virtual CStaticNode::~CStaticNode ( ) [virtual]
CStaticNode::CStaticNode ( )
virtual CStaticNode::~CStaticNode ( ) [virtual]
CStaticNode::CStaticNode ( )
virtual CStaticNode::~CStaticNode ( ) [virtual]
CStaticNode::CStaticNode ( )
virtual CStaticNode::~CStaticNode ( ) [virtual]
CStaticNode::CStaticNode ( )
virtual CStaticNode::~CStaticNode ( ) [virtual]
CStaticNode::CStaticNode ( )
virtual CStaticNode::~CStaticNode ( ) [virtual]
CStaticNode::CStaticNode ( )
virtual CStaticNode::~CStaticNode ( ) [virtual]
CStaticNode::CStaticNode ( )
virtual CStaticNode::~CStaticNode ( ) [virtual]
CStaticNode::CStaticNode ( )
virtual CStaticNode::~CStaticNode ( ) [virtual]
CStaticNode::CStaticNode ( )
virtual CStaticNode::~CStaticNode ( ) [virtual]
CStaticNode::CStaticNode ( )
virtual CStaticNode::~CStaticNode ( ) [virtual]
CStaticNode::CStaticNode ( )
virtual CStaticNode::~CStaticNode ( ) [virtual]
CStaticNode::CStaticNode ( )
virtual CStaticNode::~CStaticNode ( ) [virtual]
CStaticNode::CStaticNode ( )
virtual CStaticNode::~CStaticNode ( ) [virtual]
CStaticNode::CStaticNode ( CComponentData * pComponentData = NULL )
virtual CStaticNode::~CStaticNode ( ) [virtual]
CStaticNode::CStaticNode ( )
virtual CStaticNode::~CStaticNode ( ) [virtual]

Member Function Documentation

HRESULT CStaticNode::AddDeviceNode ( NODE_PROPERTIES * pProperties )

Definition at line 484 of file staticnode.cpp.

{
  _ASSERT( NULL != pProps );

  CDeviceNode* pNode   = NULL;
  HRESULT      hResult = S_FALSE;

  // In this case we always have the same parent
  pProps->pParentObject  = reinterpret_cast<LONG_PTR>(this);
  pProps->pComponentData = reinterpret_cast<LONG_PTR>(m_pCompData);

  pNode = new CDeviceNode;         // Create and initialize the new
  pNode->Initialize( pProps );     // node, then add to our linked
  m_NodeList.AddTail( pNode );     // list, then insert the node

  pNode->m_SDI.relativeID = m_hStaticNode;

  LPCONSOLENAMESPACE2 ipCNS2 = NULL;
  hResult = m_pCompData->GetInterface( REQUEST_ICONSOLENAMESPACE2, (LONG*)&ipCNS2 );
  if( S_OK != hResult )
    return hResult;

  hResult = ipCNS2->InsertItem( &pNode->m_SDI );

  return hResult;
}

HRESULT CStaticNode::AddDeviceNode ( NODE_PROPERTIES * pProperties )
HRESULT CStaticNode::AddDeviceNode ( NODE_PROPERTIES * pProperties )
HRESULT CStaticNode::AddDeviceNode ( NODE_PROPERTIES * pProperties )
HRESULT CStaticNode::AddDeviceNode ( NODE_PROPERTIES * pProperties )
HRESULT CStaticNode::AddDeviceNode ( NODE_PROPERTIES * pProperties )
HRESULT CStaticNode::AddMenuItems | ( | LPCONTEXTMENUCALLBACK | ipCallback,
 |  | long __RPC_FAR * | pInsertionAllowed
 | ) |  |
HRESULT CStaticNode::AddMenuItems | ( | LPCONTEXTMENUCALLBACK | ipCallback,
 |  | long __RPC_FAR * | pInsertionAllowed
 | ) |  |
HRESULT CStaticNode::AddMenuItems | ( | LPCONTEXTMENUCALLBACK | ipCallback,
 |  | long __RPC_FAR * | pInsertionAllowed
 | ) |  |
HRESULT CStaticNode::AddMenuItems | ( | LPCONTEXTMENUCALLBACK | ipCallback,
 |  | long __RPC_FAR * | pInsertionAllowed
 | ) |  |

Definition at line 535 of file staticnode.cpp.

{
  _ASSERT( NULL != ipCallback );
  HRESULT hResult = S_FALSE;

  static CONTEXTMENUITEM ctxMenu;
    ctxMenu.lCommandID        = IDM_NEW_DEVICE;
    ctxMenu.lInsertionPointID = CCM_INSERTIONPOINTID_PRIMARY_NEW;
    ctxMenu.fSpecialFlags     = 0;
    ctxMenu.strName           = L"New Device...";
    ctxMenu.strStatusBarText  = L"Add a new device";

  if( NULL == m_hAddDeviceDlg )    // If the AddDevice dialog is running
    ctxMenu.fFlags = 0;            // gray the menu selection
  else
    ctxMenu.fFlags = MF_GRAYED;

  // Add the 'New Device' option to the New menu if allowed...
  if( CCM_INSERTIONALLOWED_NEW & *pInsertionAllowed )
  {
    hResult = ipCallback->AddItem( &ctxMenu );
  }

  return hResult;
}

HRESULT CStaticNode::AddMenuItems | ( | LPCONTEXTMENUCALLBACK | ipCallback,
 |  | long __RPC_FAR * | pInsertionAllowed
 | ) |  |
HRESULT CStaticNode::AddMenuItems | ( | LPCONTEXTMENUCALLBACK | ipCallback,
 |  | long __RPC_FAR * | pInsertionAllowed
 | ) |  |
void CStaticNode::clearDirty ( ) [inline]

Definition at line 82 of file statnode.h.

{ snapInData.m_isDirty = false; };

void CStaticNode::clearDirty ( ) [inline]

Definition at line 58 of file statnode.h.

{ snapInData.isDirty = false; };

HRESULT CStaticNode::Command ( long lCommandID )
HRESULT CStaticNode::Command ( long lCommandID )
HRESULT CStaticNode::Command ( long lCommandID )
HRESULT CStaticNode::Command ( long lCommandID )
HRESULT CStaticNode::Command ( long lCommandID )

Definition at line 569 of file staticnode.cpp.

{
  HRESULT hResult = S_OK;

  switch( lCommandID )
  {
    case IDM_NEW_DEVICE:
    {
      CAddDeviceDlg* pDlg = new CAddDeviceDlg( IDD_ADDDEVICE_DLG, m_hMessageWnd );
      m_hAddDeviceDlg = pDlg->Create( g_hInst, GetDesktopWindow(), 0 );
      break;
    }
    default:
    {
      hResult = S_FALSE;
      break;
    }
  }
  return hResult;
}

HRESULT CStaticNode::Command ( long lCommandID )
HRESULT CStaticNode::ControlbarNotify | ( | LPARAM | nArg,
 |  | LPARAM | lParam,
 |  | LONG_PTR | pCompData
 | ) |  |

Definition at line 575 of file staticnode.cpp.

{
  HRESULT hResult = S_FALSE;
  BOOL bScope  = (BOOL)LOWORD(nArg);
  BOOL bSelect = (BOOL)HIWORD(nArg);

  CComponent* pComponent = reinterpret_cast<CComponent*>(pComp);

  IControlbar* ipControlbar = NULL;
  hResult = pComponent->GetInterface( REQUEST_ICONTROLBAR, (LONG_PTR*)&ipControlbar );
  if( S_OK != hResult )
    return hResult;

  IToolbar* ipToolbar = NULL;
  hResult = pComponent->GetInterface( REQUEST_ISTATICTOOLBAR, (LONG_PTR*)&ipToolbar );
  if( S_OK != hResult )
    return hResult;

  if( TRUE == bSelect )
  {
    hResult = ipControlbar->Attach(TOOLBAR, (LPUNKNOWN)ipToolbar);
    hResult = ipToolbar->SetButtonState( IDM_NEW_DEVICE, ENABLED, TRUE );
  }
  else
  {
    hResult = ipControlbar->Detach( (LPUNKNOWN)ipToolbar );
  }

  return hResult;
}

HRESULT CStaticNode::CreatePropertyPages | ( | LPPROPERTYSHEETCALLBACK | lpCallback,
 |  | LONG_PTR | Handle |
 | ) |  |  | [inline]

Definition at line 54 of file staticnode.h.

            { return E_NOTIMPL; }

HRESULT CStaticNode::CreatePropertyPages | ( | LPPROPERTYSHEETCALLBACK | lpCallback,
 |  | LONG_PTR | Handle |
 | ) |  |  | [inline]

Definition at line 54 of file staticnode.h.

            { return E_NOTIMPL; }

HRESULT CStaticNode::CreatePropertyPages | ( | IPropertySheetCallback * | lpProvider,
 |  | LONG_PTR | handle |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 91 of file statnode.Cpp.

{
    PROPSHEETPAGE psp;
    HPROPSHEETPAGE hPage = NULL;

    psp.dwSize = sizeof(PROPSHEETPAGE);
    psp.dwFlags = PSP_DEFAULT;
    psp.hInstance = g_hinst;
    psp.pszTemplate = MAKEINTRESOURCE(IDD_CHOOSER_CHOOSE_MACHINE);
    psp.pfnDlgProc = DialogProc;
    psp.lParam = reinterpret_cast<LPARAM>(&snapInData);
    psp.pszTitle = MAKEINTRESOURCE(IDS_SELECT_COMPUTER);

    hPage = CreatePropertySheetPage(&psp);
    _ASSERT(hPage);

    return lpProvider->AddPage(hPage);
}

HRESULT CStaticNode::DeleteScopeItems ( LPCONSOLENAMESPACE2 ipCNS ) [private]
HRESULT CStaticNode::DeleteScopeItems ( LPCONSOLENAMESPACE2 ipCNS2 ) [private]
HRESULT CStaticNode::DeleteScopeItems ( LPCONSOLENAMESPACE2 ipCNS ) [private]
HRESULT CStaticNode::DeleteScopeItems ( LPCONSOLENAMESPACE2 ipCNS ) [private]
HRESULT CStaticNode::DeleteScopeItems ( LPCONSOLENAMESPACE2 ipCNS2 ) [private]

Definition at line 442 of file staticnode.cpp.

{
  _ASSERT( NULL != ipCNS2 );

  POSITION    Pos     = m_NodeList.GetHeadPosition();
  HSCOPEITEM  hItem   = NULL;
  LPBASENODE  pNode   = NULL;
  HRESULT     hResult = S_FALSE;

  while( Pos )                         // Delete everything...
  {
    pNode = m_NodeList.GetNext( Pos );
    hItem = (HSCOPEITEM)pNode->m_SDI.ID;
    if( 0 != hItem )
      hResult = ipCNS2->DeleteItem( hItem, TRUE );
  }

  return hResult;

}

HRESULT CStaticNode::DeleteScopeItems ( LPCONSOLENAMESPACE2 ipCNS2 ) [private]
BOOL CALLBACK CStaticNode::DialogProc | ( | HWND | hwndDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static, private]

Definition at line 127 of file statnode.Cpp.

{
    static privateData *pData = NULL;
    static HWND m_hwndCheckboxOverride;

    switch (uMsg)
    {
    case WM_INITDIALOG:
        pData = reinterpret_cast<privateData *>(reinterpret_cast<PROPSHEETPAGE *>(lParam)->lParam);

        SendDlgItemMessage(hwndDlg, IDC_CHOOSER_RADIO_LOCAL_MACHINE, BM_SETCHECK, pData->m_fIsRadioLocalMachine, 0L);
        SendDlgItemMessage(hwndDlg, IDC_CHOOSER_RADIO_SPECIFIC_MACHINE, BM_SETCHECK, !pData->m_fIsRadioLocalMachine, 0L);

        EnableWindow(GetDlgItem(hwndDlg, IDC_CHOOSER_EDIT_MACHINE_NAME), !pData->m_fIsRadioLocalMachine);
        EnableWindow(GetDlgItem(hwndDlg, IDC_CHOOSER_BUTTON_BROWSE_MACHINENAMES), !pData->m_fIsRadioLocalMachine);

        m_hwndCheckboxOverride = ::GetDlgItem(hwndDlg, IDC_CHOOSER_CHECK_OVERRIDE_MACHINE_NAME);

        // fill in the supplied machine name (could be us, need to check here first)
        if (*pData->m_host != '\0')
        {
            ::SetWindowText(GetDlgItem(hwndDlg, IDC_CHOOSER_EDIT_MACHINE_NAME), pData->m_host);
            ::SendMessage(GetDlgItem(hwndDlg, IDC_CHOOSER_RADIO_SPECIFIC_MACHINE), BM_CLICK, 0, 0);
        }

        return TRUE;

    case WM_COMMAND:
        switch (wParam)
        {
        case IDC_CHOOSER_RADIO_LOCAL_MACHINE:
            pData->m_fIsRadioLocalMachine = TRUE;
            EnableWindow(GetDlgItem(hwndDlg, IDC_CHOOSER_EDIT_MACHINE_NAME), FALSE);
            EnableWindow(GetDlgItem(hwndDlg, IDC_CHOOSER_BUTTON_BROWSE_MACHINENAMES), FALSE);
            break;

        case IDC_CHOOSER_RADIO_SPECIFIC_MACHINE:
            pData->m_fIsRadioLocalMachine = FALSE;
            EnableWindow(GetDlgItem(hwndDlg, IDC_CHOOSER_EDIT_MACHINE_NAME), TRUE);
            EnableWindow(GetDlgItem(hwndDlg, IDC_CHOOSER_BUTTON_BROWSE_MACHINENAMES), TRUE);
            break;

        case IDC_CHOOSER_BUTTON_BROWSE_MACHINENAMES:
            {
                // Fall back to IE-style browser
                BROWSEINFO bi;
                LPITEMIDLIST lpItemIdList;
                LPMALLOC lpMalloc;

                if (SUCCEEDED(SHGetSpecialFolderLocation(hwndDlg, CSIDL_NETWORK, &lpItemIdList)))
                {
                    _TCHAR szBrowserCaption[MAX_PATH];
                    LoadString(g_hinst, IDS_COMPUTER_BROWSER_CAPTION, szBrowserCaption, (sizeof szBrowserCaption)/(sizeof szBrowserCaption[0]));

                    bi.hwndOwner = hwndDlg;
                    bi.pidlRoot = lpItemIdList;
                    bi.pszDisplayName = pData->m_host;
                    bi.lpszTitle = szBrowserCaption;
                    bi.ulFlags = BIF_BROWSEFORCOMPUTER | BIF_EDITBOX;
                    bi.lpfn = NULL;
                    bi.lParam = NULL;
                    bi.iImage = NULL;

                    if (SHBrowseForFolder(&bi) != NULL)
                    {
                        if (*pData->m_host != '\0')
                        {
                            ::SetWindowText(GetDlgItem(hwndDlg,
                                IDC_CHOOSER_EDIT_MACHINE_NAME), pData->m_host);
                        }
                    }

                    if (SUCCEEDED(SHGetMalloc(&lpMalloc)))
                    {
                        lpMalloc->Free(lpItemIdList);
                        lpMalloc->Release();
                    }
                }
            }
            break;

        case IDC_CHOOSER_CHECK_OVERRIDE_MACHINE_NAME:
            break;
        }
        break;

        case WM_NOTIFY:
            switch (((LPNMHDR)lParam)->code) {
            case PSN_SETACTIVE:
                PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_FINISH);
                break;

            case PSN_WIZFINISH:
                if (pData->m_fIsRadioLocalMachine) {
                    // Return empty string to caller
                    *pData->m_host = '\0';
                } else {
                    // Get the machine name from the edit window
                    GetWindowText(GetDlgItem(hwndDlg, IDC_CHOOSER_EDIT_MACHINE_NAME),
                        pData->m_host, sizeof(pData->m_host));
                }

                // Save the override flag if the caller asked for it
                pData->m_fAllowOverrideMachineNameOut =
                    SendMessage(m_hwndCheckboxOverride, BM_GETCHECK, 0, 0) == BST_CHECKED ? TRUE : FALSE;

                break;
            }

            break;
    }

    return FALSE;
}

HRESULT CStaticNode::Expand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 52 of file statnode.Cpp.

{
    SCOPEDATAITEM sdi;

    if (!bExpanded) {
        // create the child nodes, then expand them
        for (int n = 0; n < NUMBER_OF_CHILDREN; n++) {
            ZeroMemory(&sdi, sizeof(SCOPEDATAITEM) );
            sdi.mask = SDI_STR       |   // Displayname is valid
                SDI_PARAM     |   // lParam is valid
                SDI_IMAGE     |   // nImage is valid
                SDI_OPENIMAGE |   // nOpenImage is valid
                SDI_PARENT    |
                SDI_CHILDREN;

            sdi.relativeID  = (HSCOPEITEM)parent;
            sdi.nImage      = children[n]->GetBitmapIndex();
            sdi.nOpenImage  = INDEX_OPENFOLDER;
            sdi.displayname = MMC_CALLBACK;
            sdi.lParam      = (LPARAM)children[n];       // The cookie
            sdi.cChildren   = (n == 0); // only the first child has children

            HRESULT hr = pConsoleNameSpace->InsertItem( &sdi );

            _ASSERT( SUCCEEDED(hr) );
        }
    }

    return S_OK;
}

DWORD CStaticNode::GetAttributes ( ) [inline]

Definition at line 113 of file staticnode.h.

{ return 0; }

LPWSTR CStaticNode::GetAttributeString ( ) [inline]

Definition at line 112 of file staticnode.h.

{ return m_pAttributeStr; }

virtual const int CStaticNode::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 37 of file statnode.h.

{ return INDEX_NONE; }

virtual const int CStaticNode::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 37 of file statnode.h.

{ return INDEX_NONE; }

virtual const int CStaticNode::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 37 of file statnode.h.

{ return INDEX_NONE; }

virtual const int CStaticNode::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 37 of file statnode.h.

{ return INDEX_NONE; }

virtual const int CStaticNode::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 37 of file statnode.h.

{ return INDEX_NONE; }

virtual const int CStaticNode::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 44 of file statnode.h.

{ return INDEX_NONE; }

virtual const int CStaticNode::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 36 of file statnode.h.

{ return INDEX_NONE; }

virtual const int CStaticNode::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 37 of file statnode.h.

{ return INDEX_NONE; }

virtual const int CStaticNode::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 37 of file statnode.h.

{ return INDEX_NONE; }

virtual const int CStaticNode::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 37 of file statnode.h.

{ return INDEX_NONE; }

virtual const int CStaticNode::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 36 of file statnode.h.

{ return INDEX_NONE; }

virtual const int CStaticNode::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 37 of file StatNode.h.

{ return INDEX_NONE; }

virtual const int CStaticNode::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 37 of file statnode.h.

{ return INDEX_NONE; }

virtual const int CStaticNode::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 37 of file statnode.h.

{ return INDEX_NONE; }

virtual const int CStaticNode::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 37 of file statnode.h.

{ return INDEX_NONE; }

virtual const int CStaticNode::GetBitmapIndex ( ) [inline, virtual]

Implements CDelegationBase.

Definition at line 37 of file statnode.h.

{ return INDEX_NONE; }

void* CStaticNode::getData ( ) [inline]

Definition at line 80 of file statnode.h.

{ return &snapInData; }

void* CStaticNode::getData ( ) [inline]

Definition at line 56 of file statnode.h.

{ return &snapInData; }

LONG CStaticNode::getDataSize ( ) [inline]

Definition at line 79 of file statnode.h.

{ return sizeof(privateData); }

LONG CStaticNode::getDataSize ( ) [inline]

Definition at line 55 of file statnode.h.

{ return sizeof(privateData); }

HRESULT CStaticNode::GetDisplayInfo ( SCOPEDATAITEM * pSDI )
HRESULT CStaticNode::GetDisplayInfo ( RESULTDATAITEM * pRDI )
HRESULT CStaticNode::GetDisplayInfo ( RESULTDATAITEM * pRDI )
HRESULT CStaticNode::GetDisplayInfo ( SCOPEDATAITEM * pSDI )
HRESULT CStaticNode::GetDisplayInfo ( SCOPEDATAITEM * pSDI )

Definition at line 82 of file staticnode.cpp.

{
  _ASSERT( NULL != pSDI );
  pSDI->displayname = m_pwszNodeName;

  return S_OK;
}

HRESULT CStaticNode::GetDisplayInfo ( RESULTDATAITEM * pRDI )

Definition at line 94 of file staticnode.cpp.

{

  return S_FALSE;
}

HRESULT CStaticNode::GetDisplayInfo ( SCOPEDATAITEM * pSDI )
HRESULT CStaticNode::GetDisplayInfo ( RESULTDATAITEM * pRDI )
HRESULT CStaticNode::GetDisplayInfo ( SCOPEDATAITEM * pSDI )
HRESULT CStaticNode::GetDisplayInfo ( RESULTDATAITEM * pRDI )
HRESULT CStaticNode::GetDisplayInfo ( RESULTDATAITEM * pRDI )
HRESULT CStaticNode::GetDisplayInfo ( SCOPEDATAITEM * pSDI )
HRESULT CStaticNode::GetDisplayInfo ( SCOPEDATAITEM * pSDI )
HRESULT CStaticNode::GetDisplayInfo ( RESULTDATAITEM * pRDI )
HRESULT CStaticNode::GetDisplayInfo ( SCOPEDATAITEM * pSDI )
HRESULT CStaticNode::GetDisplayInfo ( RESULTDATAITEM * pRDI )
virtual const _TCHAR* CStaticNode::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 31 of file statnode.h.

                                                       {
        static _TCHAR szDisplayName[256];
        LoadString(g_hinst, IDS_SNAPINNAME, szDisplayName, (sizeof szDisplayName)/(sizeof szDisplayName[0]));
        return szDisplayName;
    }

virtual const _TCHAR* CStaticNode::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 31 of file statnode.h.

                                                       {
        static _TCHAR szDisplayName[256];
        LoadString(g_hinst, IDS_SNAPINNAME, szDisplayName, (sizeof szDisplayName)/(sizeof szDisplayName[0]));
        return szDisplayName;
    }

virtual const _TCHAR* CStaticNode::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 31 of file statnode.h.

                                                       {
        static _TCHAR szDisplayName[256];
        LoadString(g_hinst, IDS_SNAPINNAME, szDisplayName, (sizeof szDisplayName)/(sizeof szDisplayName[0]));
        return szDisplayName;
    }

virtual const _TCHAR* CStaticNode::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 31 of file statnode.h.

                                                       {
        static _TCHAR szDisplayName[256];
        LoadString(g_hinst, IDS_SNAPINNAME, szDisplayName, (sizeof szDisplayName)/(sizeof szDisplayName[0]));
        return szDisplayName;
    }

virtual const _TCHAR* CStaticNode::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 30 of file statnode.h.

                                                       {
        static _TCHAR szDisplayName[256];
        LoadString(g_hinst, IDS_SNAPINNAME, szDisplayName, (sizeof szDisplayName)/(sizeof szDisplayName[0]));
        return szDisplayName;
    }

virtual const _TCHAR* CStaticNode::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 31 of file statnode.h.

                                                       {
        static _TCHAR szDisplayName[256];
        LoadString(g_hinst, IDS_SNAPINNAME, szDisplayName, (sizeof szDisplayName)/(sizeof szDisplayName[0]));
        return szDisplayName;
    }

virtual const _TCHAR* CStaticNode::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 31 of file statnode.h.

                                                       {
        static _TCHAR szDisplayName[256];
        LoadString(g_hinst, IDS_SNAPINNAME, szDisplayName, (sizeof szDisplayName)/(sizeof szDisplayName[0]));
        return szDisplayName;
    }

virtual const _TCHAR* CStaticNode::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 31 of file statnode.h.

                                                       {
        static _TCHAR szDisplayName[256] = {0};
        LoadString(g_hinst, IDS_SNAPINNAME, szDisplayName, (sizeof szDisplayName)/(sizeof szDisplayName[0]));

        if (*snapInData.m_host != 0) {
            _tcscat(szDisplayName, _T(" ("));
            _tcscat(szDisplayName, snapInData.m_host);
            _tcscat(szDisplayName, _T(")"));
        }

        return szDisplayName;
    }

virtual const _TCHAR* CStaticNode::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 31 of file statnode.h.

                                                       {
        static _TCHAR szDisplayName[256];
        LoadString(g_hinst, IDS_SNAPINNAME, szDisplayName, (sizeof szDisplayName)/(sizeof szDisplayName[0]));
        return szDisplayName;
    }

virtual const _TCHAR* CStaticNode::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 31 of file StatNode.h.

                                                       {
        static _TCHAR szDisplayName[256];
        LoadString(g_hinst, IDS_SNAPINNAME, szDisplayName, (sizeof szDisplayName)/(sizeof szDisplayName[0]));
        return szDisplayName;
    }

virtual const _TCHAR* CStaticNode::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 31 of file statnode.h.

                                                       {
        static _TCHAR szDisplayName[256];
        LoadString(g_hinst, IDS_SNAPINNAME, szDisplayName, (sizeof szDisplayName)/(sizeof szDisplayName[0]));
        return szDisplayName;
    }

virtual const _TCHAR* CStaticNode::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 30 of file statnode.h.

                                                       {
        static _TCHAR szDisplayName[256];
        LoadString(g_hinst, IDS_SNAPINNAME, szDisplayName, (sizeof szDisplayName)/(sizeof szDisplayName[0]));
        return szDisplayName;
    }

virtual const _TCHAR* CStaticNode::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 31 of file statnode.h.

                                                       {
        static _TCHAR szDisplayName[256];
        LoadString(g_hinst, IDS_SNAPINNAME, szDisplayName, (sizeof szDisplayName)/(sizeof szDisplayName[0]));
        return szDisplayName;
    }

virtual const _TCHAR* CStaticNode::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 31 of file statnode.h.

                                                       {
        static _TCHAR szDisplayName[256];
        LoadString(g_hinst, IDS_SNAPINNAME, szDisplayName, (sizeof szDisplayName)/(sizeof szDisplayName[0]));
        return szDisplayName;
    }

virtual const _TCHAR* CStaticNode::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 31 of file statnode.h.

                                                       {
        static _TCHAR szDisplayName[256];
        LoadString(g_hinst, IDS_SNAPINNAME, szDisplayName, (sizeof szDisplayName)/(sizeof szDisplayName[0]));
        return szDisplayName;
    }

virtual const _TCHAR* CStaticNode::GetDisplayName ( int nCol = 0 ) [inline, virtual]

Implements CDelegationBase.

Definition at line 31 of file statnode.h.

                                                       {
        static _TCHAR szDisplayName[256];
        LoadString(g_hinst, IDS_SNAPINNAME, szDisplayName, (sizeof szDisplayName)/(sizeof szDisplayName[0]));
        return szDisplayName;
    }

_TCHAR* CStaticNode::getHost ( ) [inline]

Definition at line 84 of file statnode.h.

{ return *snapInData.m_host == 0 ? NULL : snapInData.m_host; }

HWND CStaticNode::GetMessageWnd ( ) [inline]

Definition at line 90 of file staticnode.h.

{ return m_hMessageWnd; }

HWND CStaticNode::GetMessageWnd ( ) [inline]

Definition at line 92 of file staticnode.h.

{ return m_hMessageWnd; }

HWND CStaticNode::GetMessageWnd ( ) [inline]

Definition at line 90 of file staticnode.h.

{ return m_hMessageWnd; }

HWND CStaticNode::GetMessageWnd ( ) [inline]

Definition at line 87 of file staticnode.h.

{ return m_hMessageWnd; }

HWND CStaticNode::GetMessageWnd ( ) [inline]

Definition at line 95 of file staticnode.h.

{ return m_hMessageWnd; }

HWND CStaticNode::GetMessageWnd ( ) [inline]

Definition at line 76 of file staticnode.h.

{ return m_hMessageWnd; }

GUID& CStaticNode::GetNodeGUID ( ) [inline]

Definition at line 43 of file staticnode.h.

{ return thisGUID; }

GUID& CStaticNode::GetNodeGUID ( ) [inline]

Definition at line 42 of file staticnode.h.

{ return thisGUID; }

GUID* CStaticNode::GetNodeGUID ( ) [inline]

Definition at line 40 of file staticnode.h.

{ return &thisGUID; }

GUID* CStaticNode::GetNodeGUID ( ) [inline]

Definition at line 44 of file staticnode.h.

{ return &thisGUID; };

GUID& CStaticNode::GetNodeGUID ( ) [inline]

Definition at line 42 of file staticnode.h.

{ return thisGUID; }

GUID& CStaticNode::GetNodeGUID ( ) [inline]

Definition at line 42 of file staticnode.h.

{ return thisGUID; }

GUID& CStaticNode::GetNodeGUID ( ) [inline]

Definition at line 42 of file staticnode.h.

{ return thisGUID; }

GUID& CStaticNode::GetNodeGUID ( ) [inline]

Definition at line 42 of file staticnode.h.

{ return m_thisGUID; }

ULONG CStaticNode::GetNodeType ( ) [inline]

Definition at line 42 of file staticnode.h.

{ return NODETYPE_STATIC; }

virtual const GUID& CStaticNode::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 35 of file statnode.h.

{ return thisGuid; }

virtual const GUID& CStaticNode::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 36 of file statnode.h.

{ return thisGuid; }

ULONG CStaticNode::GetNodeType ( ) [inline]

Definition at line 41 of file staticnode.h.

{ return NODETYPE_STATIC; }

virtual const GUID& CStaticNode::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 36 of file statnode.h.

{ return thisGuid; }

ULONG CStaticNode::GetNodeType ( ) [inline]

Definition at line 39 of file staticnode.h.

{ return NODETYPE_STATIC; }

virtual const GUID& CStaticNode::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 36 of file statnode.h.

{ return thisGuid; }

virtual const GUID& CStaticNode::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 36 of file statnode.h.

{ return thisGuid; }

virtual const GUID& CStaticNode::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 36 of file statnode.h.

{ return thisGuid; }

ULONG CStaticNode::GetNodeType ( ) [inline]

Definition at line 43 of file staticnode.h.

{ return NODETYPE_STATIC; };

virtual const GUID& CStaticNode::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 36 of file statnode.h.

{ return thisGuid; }

ULONG CStaticNode::GetNodeType ( ) [inline]

Definition at line 41 of file staticnode.h.

{ return NODETYPE_STATIC; }

ULONG CStaticNode::GetNodeType ( ) [inline]

Definition at line 41 of file staticnode.h.

{ return NODETYPE_STATIC; }

ULONG CStaticNode::GetNodeType ( ) [inline]

Definition at line 41 of file staticnode.h.

{ return NODETYPE_STATIC; }

virtual const GUID& CStaticNode::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 36 of file statnode.h.

{ return thisGuid; }

virtual const GUID& CStaticNode::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 36 of file statnode.h.

{ return thisGuid; }

virtual const GUID& CStaticNode::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 36 of file statnode.h.

{ return thisGuid; }

virtual const GUID& CStaticNode::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 36 of file statnode.h.

{ return thisGuid; }

virtual const GUID& CStaticNode::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 43 of file statnode.h.

{ return thisGuid; }

virtual const GUID& CStaticNode::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 36 of file statnode.h.

{ return thisGuid; }

virtual const GUID& CStaticNode::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 35 of file statnode.h.

{ return thisGuid; }

virtual const GUID& CStaticNode::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 36 of file StatNode.h.

{ return thisGuid; }

ULONG CStaticNode::GetNodeType ( ) [inline]

Definition at line 41 of file staticnode.h.

{ return NODETYPE_STATIC; }

virtual const GUID& CStaticNode::getNodeType ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 36 of file statnode.h.

{ return thisGuid; }

LPWSTR CStaticNode::GetObjectPath ( ) [inline]

Definition at line 114 of file staticnode.h.

{ return NULL; }

virtual HSCOPEITEM CStaticNode::GetParentScopeItem ( ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 39 of file statnode.h.

{ return m_hParentHScopeItem; }

HRESULT CStaticNode::GetProperties ( LPNODEPROPS * ppNodeProps )

Definition at line 172 of file staticnode.cpp.

{
  _ASSERT( NULL == *ppNodeProps );
  return E_NOTIMPL;
}

HRESULT CStaticNode::GetProperty | ( | BSTR | bstrPropertyName,
 |  | PBSTR | pbstrProperty |
 | ) |  |  | [inline]

Definition at line 43 of file staticnode.h.

{ return E_NOTIMPL; }

HRESULT CStaticNode::GetResultViewType2 | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pRVTinfo
 | ) |  |
HRESULT CStaticNode::GetResultViewType2 | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pRVTinfo
 | ) |  |
HRESULT CStaticNode::GetResultViewType2 | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pRVTinfo
 | ) |  |
HRESULT CStaticNode::GetResultViewType2 | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pRVTinfo
 | ) |  |

Definition at line 65 of file staticnode.cpp.

{
  LPOLESTR pszDescStr = (LPOLESTR)CoTaskMemAlloc( sizeof(L"DefaultListView")+1 );
  if( NULL == pszDescStr )
    return E_OUTOFMEMORY;

  wcscpy( pszDescStr, L"DefaultListView" );
  pRVTinfo->pstrPersistableViewDescription = pszDescStr;

  return S_OK;
}

HRESULT CStaticNode::GetResultViewType2 | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pRVTinfo
 | ) |  |
HRESULT CStaticNode::GetResultViewType2 | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pRVTinfo
 | ) |  |
HRESULT CStaticNode::GetResultViewType2 | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pRVTinfo
 | ) |  |
HRESULT CStaticNode::GetResultViewType2 | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pRVTinfo
 | ) |  |
HRESULT CStaticNode::GetWatermarks | ( | HBITMAP __RPC_FAR * | lphWatermark,
 |  | HBITMAP __RPC_FAR * | lphHeader,
 |  | HPALETTE __RPC_FAR * | lphPalette,
 |  | BOOL __RPC_FAR * | bStretch |
 | ) |  |  | [inline]

Definition at line 57 of file staticnode.h.

            { return E_NOTIMPL; }

HRESULT CStaticNode::GetWatermarks | ( | HBITMAP __RPC_FAR * | lphWatermark,
 |  | HBITMAP __RPC_FAR * | lphHeader,
 |  | HPALETTE __RPC_FAR * | lphPalette,
 |  | BOOL __RPC_FAR * | bStretch |
 | ) |  |  | [inline]

Definition at line 57 of file staticnode.h.

            { return E_NOTIMPL; }

HRESULT CStaticNode::GetWatermarks | ( | HBITMAP * | lphWatermark,
 |  | HBITMAP * | lphHeader,
 |  | HPALETTE * | lphPalette,
 |  | BOOL * | bStretch |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 115 of file statnode.Cpp.

{
    *lphHeader = (HBITMAP)LoadImage(g_hinst, MAKEINTRESOURCE(IDB_HEADER), IMAGE_BITMAP, 0, 0, 0);
    *lphWatermark = (HBITMAP)LoadImage(g_hinst, MAKEINTRESOURCE(IDB_WATERMARK), IMAGE_BITMAP, 0, 0, 0);
    *bStretch = FALSE;

    return S_OK;
}

HRESULT CStaticNode::HasPropertySheets ( ) [virtual]

Reimplemented from CDelegationBase.

Definition at line 110 of file statnode.Cpp.

{
    return S_OK;
}

HRESULT CStaticNode::InitDefaultDevices ( ) [private]

Definition at line 383 of file staticnode.cpp.

{
  NODEPROPS NodeProps;
  ZeroMemory( &NodeProps, sizeof(NODEPROPS) );
  NodeProps.pComponentData = reinterpret_cast<LONG_PTR>(m_pCompData);
  NodeProps.pParentObject  = reinterpret_cast<LONG_PTR>(this);
  NodeProps.dwAttributes   = 0;
  NodeProps.nChildCount    = INIT_DEFAULT_NODE;

  WCHAR  szNames[2][32];
  wcscpy( szNames[0], L"RamDisk 0" );
  wcscpy( szNames[1], L"Archive 0" );

  RemoveNodes();                       // Clean the node list

  CDeviceNode* pNode = NULL;
  for( DWORD i = 0; i < 2; i++ )
  {
    wcscpy( NodeProps.szNodeName, szNames[i] );
    pNode = new CDeviceNode;
    pNode->Initialize( &NodeProps );
    m_NodeList.AddTail( pNode );

    // Kind of a hack, make the second device a backup device
    NodeProps.dwAttributes |= ATTRIBUTE_BACKUP_DEVICE;
  }

  return S_OK;
}

HRESULT CStaticNode::Initialize ( NODE_PROPERTIES * pNodeProps )
HRESULT CStaticNode::Initialize ( NODE_PROPERTIES * pNodeProps )

Definition at line 37 of file staticnode.cpp.

{
  _ASSERT( NULL != pNodeProps );
  _ASSERT( NULL != pNodeProps->pComponentData );

  UINT   nLen   = wcslen( pNodeProps->szNodeName ) + 1;
  LPWSTR pszTmp = (LPWSTR)CoTaskMemAlloc(nLen * sizeof(WCHAR));
  wcscpy( pszTmp, pNodeProps->szNodeName );
  if( NULL != m_pwszNodeName )
    CoTaskMemFree( m_pwszNodeName );

  m_pwszNodeName = pszTmp;
  m_pCompData    = reinterpret_cast<CComponentData*>(pNodeProps->pComponentData);

  return S_OK;
}

HRESULT CStaticNode::Initialize ( NODE_PROPERTIES * pNodeProps )
HRESULT CStaticNode::Initialize ( NODE_PROPERTIES * pNodeProps )
HRESULT CStaticNode::Initialize ( NODE_PROPERTIES * pNodeProps )
HRESULT CStaticNode::Initialize ( NODE_PROPERTIES * pNodeProps )
HRESULT CStaticNode::Initialize ( NODE_PROPERTIES * pNodeProps )
HRESULT CStaticNode::Initialize ( LPNODEPROPS pNodeProps )

Definition at line 61 of file staticnode.cpp.

{
  _ASSERT( NULL != pNodeProps );
  HRESULT hResult = S_FALSE;

  UINT   nLen   = wcslen( pNodeProps->szNodeName ) + 1;
  LPWSTR pszTmp = (LPWSTR)CoTaskMemAlloc(nLen * sizeof(WCHAR));
  wcscpy( pszTmp, pNodeProps->szNodeName );
  if( NULL != m_pwszNodeName )
    CoTaskMemFree( m_pwszNodeName );

  m_pwszNodeName = pszTmp;
  m_pCompData = reinterpret_cast<CComponentData*>(pNodeProps->pComponentData);

  if( INIT_DEFAULT_NODE == pNodeProps->nChildCount )
  {
    hResult = InitDefaultDevices();        // Initialize static top level scope nodes
  }
  else
  {
    // Can't DragDrop device nodes to another static node
  }

  // We create a hidden window to allow us to communicate with modeless
  // dialogs and other things which run in a seperate thread.
  //
  WNDCLASS wc;
  ZeroMemory (&wc, sizeof(WNDCLASS));
  wc.cbWndExtra    = sizeof(this);
  wc.lpfnWndProc   = StaticNodeWndProc;
  wc.hInstance     = g_hInst;
  wc.lpszClassName = _T("StaticNodeMessageWindow");

  RegisterClass( &wc );
  m_hMessageWnd = CreateWindow( _T("StaticNodeMessageWindow"), NULL,
                                0, 0, 0, 0, 0, NULL, 0, g_hInst, this);

  if( NULL == m_hMessageWnd )
    hResult = S_FALSE;

  return hResult;
}

HRESULT CStaticNode::InsertScopeItems ( LPCONSOLENAMESPACE2 ipCNS ) [private]
HRESULT CStaticNode::InsertScopeItems ( LPCONSOLENAMESPACE2 ipCNS2 ) [private]
HRESULT CStaticNode::InsertScopeItems ( LPCONSOLENAMESPACE2 ipCNS2 ) [private]

Definition at line 416 of file staticnode.cpp.

{
  _ASSERT( NULL != ipCNS2 );
  _ASSERT( NULL != m_hStaticNode );

  HRESULT      hResult = S_FALSE;
  POSITION     Pos     = m_NodeList.GetHeadPosition();
  CDeviceNode* pNode   = NULL;

  while( Pos )
  {
    pNode   = m_NodeList.GetNext( Pos );
    pNode->m_SDI.relativeID = m_hStaticNode;
    hResult = ipCNS2->InsertItem( &pNode->m_SDI );
  }

  return hResult;
}

HRESULT CStaticNode::InsertScopeItems ( LPCONSOLENAMESPACE2 ipCNS ) [private]
HRESULT CStaticNode::InsertScopeItems ( LPCONSOLENAMESPACE2 ipCNS ) [private]
HRESULT CStaticNode::InsertScopeItems ( LPCONSOLENAMESPACE2 ipCNS2 ) [private]
BOOL CStaticNode::IsAttributeSet ( DWORD dwAttribute ) [inline]

Definition at line 109 of file staticnode.h.

{ return FALSE; }

bool CStaticNode::isDirty ( ) [inline]

Definition at line 57 of file statnode.h.

{ return snapInData.isDirty; }

bool CStaticNode::isDirty ( ) [inline]

Definition at line 81 of file statnode.h.

{ return snapInData.m_isDirty; }

HRESULT CStaticNode::OnContextHelp | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [inline]

Definition at line 70 of file staticnode.h.

            { return E_NOTIMPL; }

HRESULT CStaticNode::OnCutOrMove | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [inline]

Definition at line 67 of file staticnode.h.

            { return E_NOTIMPL; }

HRESULT CStaticNode::OnDelete | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [inline]

Definition at line 73 of file staticnode.h.

            { return E_NOTIMPL; }

HRESULT CStaticNode::OnDelete | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [inline]

Definition at line 70 of file staticnode.h.

            { return E_NOTIMPL; }

HRESULT CStaticNode::OnDelete | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [inline]

Definition at line 60 of file staticnode.h.

            { return E_NOTIMPL; }

virtual HRESULT CStaticNode::OnExpand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CStaticNode::OnExpand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CStaticNode::OnExpand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CStaticNode::OnExpand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

HRESULT CStaticNode::OnExpand | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pCompData
 | ) |  |

Definition at line 312 of file staticnode.cpp.

{
  HRESULT hResult = S_FALSE;

  if( NULL == m_hStaticNode )          // Cache the root node handle
    m_hStaticNode = static_cast<HSCOPEITEM>(nParam);

  if( NULL == m_pCompData )
    m_pCompData = reinterpret_cast<CComponentData*>(pCompData);

  // Request an IConsoleNameSpace2 pointer from CComponentData
  LPCONSOLENAMESPACE2 ipCNS = NULL;
  hResult = m_pCompData->GetInterface( REQUEST_ICONSOLENAMESPACE, (LONG_PTR*)&ipCNS );
  if( S_OK != hResult )
    return hResult;

  hResult = DeleteScopeItems( ipCNS );
  hResult = InsertScopeItems( ipCNS );

  return hResult;
}

virtual HRESULT CStaticNode::OnExpand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

HRESULT CStaticNode::OnExpand | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pCompData
 | ) |  |

Definition at line 302 of file staticnode.cpp.

{
  HRESULT hResult = S_FALSE;

  if( NULL == m_hStaticNode )          // Cache the root node handle
    m_hStaticNode = (HSCOPEITEM)nParam;

  if( NULL == m_pCompData )
    m_pCompData = reinterpret_cast<CComponentData*>(pCompData);

  // Request an IConsoleNameSpace2 pointer from CComponentData
  // The static node is a unique case since it's parent is also IComponentData
  //
  LPCONSOLENAMESPACE2 ipCNS2 = NULL;
  hResult = m_pCompData->GetInterface( REQUEST_ICONSOLENAMESPACE2, (LONG_PTR*)&ipCNS2 );
  if( S_OK != hResult )
    return hResult;

  ipCNS2->AddRef();

  hResult = DeleteScopeItems( ipCNS2 );
  hResult = InsertScopeItems( ipCNS2 );

  ipCNS2->Release();
  return hResult;
}

virtual HRESULT CStaticNode::OnExpand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

HRESULT CStaticNode::OnExpand | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pCompData
 | ) |  |
virtual HRESULT CStaticNode::OnExpand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

HRESULT CStaticNode::OnExpand | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pCompData
 | ) |  |
virtual HRESULT CStaticNode::OnExpand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

HRESULT CStaticNode::OnExpand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 51 of file statnode.Cpp.

{
    SCOPEDATAITEM sdi;

    if (!bExpanded) {
        // create the child nodes, then expand them
        for (int n = 0; n < NUMBER_OF_CHILDREN; n++) {
            ZeroMemory(&sdi, sizeof(SCOPEDATAITEM) );
            sdi.mask = SDI_STR       |   // Displayname is valid
                SDI_PARAM     |   // lParam is valid
                SDI_IMAGE     |   // nImage is valid
                SDI_OPENIMAGE |   // nOpenImage is valid
                SDI_PARENT    |
                SDI_CHILDREN;

            sdi.relativeID  = (HSCOPEITEM)parent;
            sdi.nImage      = children[n]->GetBitmapIndex();
            sdi.nOpenImage  = INDEX_OPENFOLDER;
            sdi.displayname = MMC_CALLBACK;
            sdi.lParam      = (LPARAM)children[n];       // The cookie
            sdi.cChildren   = (n == 0); // only the first child has children

            HRESULT hr = pConsoleNameSpace->InsertItem( &sdi );

            _ASSERT( SUCCEEDED(hr) );
        }

        bExpanded = TRUE;
    }

    return S_OK;
}

virtual HRESULT CStaticNode::OnExpand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

HRESULT CStaticNode::OnExpand | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pCompData
 | ) |  |
virtual HRESULT CStaticNode::OnExpand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

virtual HRESULT CStaticNode::OnExpand | ( | IConsoleNameSpace * | pConsoleNameSpace,
 |  | IConsole * | pConsole,
 |  | HSCOPEITEM | parent |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

HRESULT CStaticNode::OnExpand | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pCompData
 | ) |  |
HRESULT CStaticNode::OnPaste | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [inline]

Definition at line 64 of file staticnode.h.

            { return E_NOTIMPL; }

HRESULT CStaticNode::OnQueryPaste | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [inline]

Definition at line 61 of file staticnode.h.

            { return S_FALSE; }

HRESULT CStaticNode::OnRemoveChildren | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pCompData
 | ) |  |
HRESULT CStaticNode::OnRemoveChildren | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pCompData
 | ) |  |

Definition at line 337 of file staticnode.cpp.

{
  HRESULT hResult = S_FALSE;

  if( NULL == m_pCompData )
    m_pCompData = reinterpret_cast<CComponentData*>(pCompData);

  LPCONSOLENAMESPACE2 ipCNS2 = NULL;
  hResult = m_pCompData->GetInterface( REQUEST_ICONSOLENAMESPACE2, (LONG_PTR*)&ipCNS2 );
  if( S_OK != hResult )
    return hResult;

  ipCNS2->AddRef();
  hResult = DeleteScopeItems( ipCNS2 );

  POSITION   Pos   = m_NodeList.GetHeadPosition();
  LPBASENODE pNode = NULL;
  while( Pos )                         // Delete everything...
  {
    pNode = m_NodeList.GetNext( Pos );
    pNode->OnRemoveChildren( ipDataObject, nArg, nParam, pCompData );
    delete pNode;
  }

  m_NodeList.RemoveAll();              // Cleanup the list
  ipCNS2->Release();

  TRACE_HRESULT( _T("OnRemoveChildren"), hResult );
  return hResult;
}

HRESULT CStaticNode::OnRemoveChildren | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pCompData
 | ) |  |

Definition at line 342 of file staticnode.cpp.

{
  HRESULT hResult = S_FALSE;

  if( NULL == m_pCompData )
    m_pCompData = reinterpret_cast<CComponentData*>(pCompData);

  LPCONSOLENAMESPACE2 ipCNS = NULL;
  hResult = m_pCompData->GetInterface( REQUEST_ICONSOLENAMESPACE, (LONG_PTR*)&ipCNS );
  if( S_OK != hResult )
    return hResult;

  hResult = DeleteScopeItems( ipCNS );

  POSITION   Pos   = m_NodeList.GetHeadPosition();
  LPBASENODE pNode = NULL;
  while( Pos )                         // Delete everything...
  {
    pNode = m_NodeList.GetNext( Pos );
    pNode->OnRemoveChildren( ipDataObject, nArg, nParam, pCompData );
    delete pNode;
  }

  m_NodeList.RemoveAll();              // Cleanup the list

  //TRACE_HRESULT( _T("OnRemoveChildren"), hResult );
  return hResult;
}

HRESULT CStaticNode::OnRemoveChildren | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pCompData
 | ) |  |
HRESULT CStaticNode::OnRemoveChildren | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pCompData
 | ) |  |
HRESULT CStaticNode::OnRemoveChildren | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pCompData
 | ) |  |
HRESULT CStaticNode::OnRename | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [inline]

Definition at line 57 of file staticnode.h.

            { return E_NOTIMPL; }

HRESULT CStaticNode::OnRename | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [inline]

Definition at line 54 of file staticnode.h.

            { return E_NOTIMPL; }

HRESULT CStaticNode::OnRename | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [inline]

Definition at line 56 of file staticnode.h.

            { return E_NOTIMPL; }

HRESULT CStaticNode::OnSelect | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent
 | ) |  |

Definition at line 276 of file staticnode.cpp.

{
  BOOL    fScopePane = LOWORD(nArg);
  BOOL    fSelected  = HIWORD(nArg);
  HRESULT hResult    = S_FALSE;

  if( NULL == ipDataObject )           // Can get this when closing the SnapIn
    return hResult;

  CComponent* pComp = reinterpret_cast<CComponent*>(pComponent);
  LPCONSOLEVERB  ipConsoleVerb = NULL;
  hResult = pComp->GetInterface( REQUEST_ICONSOLEVERB, (LONG_PTR*)&ipConsoleVerb );
  if( S_OK != hResult )
    return hResult;

  if( TRUE == fScopePane && TRUE == fSelected )
  {
    // No verbs for the static node
  }

  //TRACE_HRESULT(_T("OnSelect"), hResult );
  return hResult;

}

HRESULT CStaticNode::OnSelect | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [inline]

Definition at line 49 of file staticnode.h.

            { return E_NOTIMPL; }

HRESULT CStaticNode::OnSelect | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent
 | ) |  |
HRESULT CStaticNode::OnSelect | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent
 | ) |  |
HRESULT CStaticNode::OnSelect | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [inline]

Definition at line 53 of file staticnode.h.

            { return E_NOTIMPL; }

HRESULT CStaticNode::OnSelect | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pComponent
 | ) |  |
HRESULT CStaticNode::OnSelect | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pComponent
 | ) |  |
HRESULT CStaticNode::OnSelect | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent
 | ) |  |
HRESULT CStaticNode::OnShow | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [inline]

Definition at line 56 of file staticnode.h.

            { return E_NOTIMPL; }

HRESULT CStaticNode::OnShow | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent
 | ) |  |
HRESULT CStaticNode::OnShow | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pComponent
 | ) |  |
HRESULT CStaticNode::OnShow | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pComponent
 | ) |  |
HRESULT CStaticNode::OnShow | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent
 | ) |  |

Definition at line 229 of file staticnode.cpp.

{
  HRESULT  hResult = S_FALSE;

  CComponent* pComp = reinterpret_cast<CComponent*>(pComponent);

  LPHEADERCTRL2  ipHeaderCtrl = NULL;
  hResult = pComp->GetInterface( REQUEST_IHEADERCTRL, (LONG_PTR*)&ipHeaderCtrl );
  if( S_OK != hResult )
   return hResult;

  LPRESULTDATA  ipResultData = NULL;
  hResult = pComp->GetInterface( REQUEST_IRESULTDATA, (LONG_PTR*)&ipResultData );
  if( S_OK != hResult )
   return hResult;

  if( TRUE == nArg )  // Selecting a scope node
  {
    do
    {
      hResult = ipHeaderCtrl->InsertColumn( 0, L"Device Name", 0, 150 );
      BREAK_ON_ERROR( hResult );

      hResult = ipHeaderCtrl->InsertColumn( 1, L"Status", 0, 150 );
      BREAK_ON_ERROR( hResult );

      hResult = ipResultData->ModifyViewStyle( MMC_NOSORTHEADER, (MMC_RESULT_VIEW_STYLE)NULL );
      BREAK_ON_ERROR( hResult );

    }while(0);
  }
  else // not handling deselect notifications
  {
  }

  //TRACE_HRESULT(_T("OnShow"), hResult );
  return hResult;
}

HRESULT CStaticNode::OnShow | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent
 | ) |  |
HRESULT CStaticNode::OnShow | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [inline]

Definition at line 52 of file staticnode.h.

            { return E_NOTIMPL; }

HRESULT CStaticNode::OnShow | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent
 | ) |  |
HRESULT CStaticNode::OnShowContextHelp | ( | IDisplayHelp * | m_ipDisplayHelp,
 |  | LPOLESTR | helpFile |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

Definition at line 84 of file statnode.Cpp.

{
    WCHAR topicName[MAX_PATH];

    wcscpy(topicName, helpFile);

    // we should read this from a resource file
    wcscat(topicName, L"::/default.htm");

    LPOLESTR pszTopic = static_cast<LPOLESTR>(CoTaskMemAlloc((wcslen(topicName) + 1) * sizeof(WCHAR)));

    wcscpy(pszTopic, topicName);

    return m_ipDisplayHelp->ShowTopic(pszTopic);

}

virtual HRESULT CStaticNode::OnShowContextHelp | ( | IDisplayHelp * | m_ipDisplayHelp,
 |  | LPOLESTR | helpFile |
 | ) |  |  | [virtual]

Reimplemented from CDelegationBase.

HRESULT CStaticNode::OnViewChange | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [inline]

Definition at line 63 of file staticnode.h.

            { return E_NOTIMPL; }

HRESULT CStaticNode::OnViewChange | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [inline]

Definition at line 59 of file staticnode.h.

            { return E_NOTIMPL; }

HRESULT CStaticNode::QueryForPropertyPage ( ) [inline]

Definition at line 51 of file staticnode.h.

            { return E_NOTIMPL; }

HRESULT CStaticNode::QueryForPropertyPage ( ) [inline]

Definition at line 51 of file staticnode.h.

            { return E_NOTIMPL; }

HRESULT CStaticNode::RefreshNodeList ( ) [private]
HRESULT CStaticNode::RefreshNodeList ( ) [private]
HRESULT CStaticNode::RefreshNodeList ( ) [private]
HRESULT CStaticNode::RefreshNodeList ( ) [private]
HRESULT CStaticNode::RefreshNodeList ( ) [private]

Definition at line 381 of file staticnode.cpp.

{
  NODE_PROPERTIES NodeProps;
  ZeroMemory( &NodeProps, sizeof(NODE_PROPERTIES) );

  NodeProps.pParentObject  = reinterpret_cast<LONG_PTR>(this);
  NodeProps.pComponentData = reinterpret_cast<LONG_PTR>(m_pCompData);

  WCHAR  szNames[2][32];
  wcscpy( szNames[0], L"RamDisk 0" );
  wcscpy( szNames[1], L"Archive 0" );

  RemoveNodes();                       // Clean the node list

  CDeviceNode* pNode = NULL;
  for( DWORD i = 0; i < 2; i++ )
  {
    wcscpy( NodeProps.szNodeName, szNames[i] );
    pNode = new CDeviceNode;
    pNode->Initialize( &NodeProps );
    m_NodeList.AddTail( pNode );

    // Kind of a hack, make the second device a backup device
    NodeProps.dwAttributes |= ATTRIBUTE_BACKUP_DEVICE;
  }

  return S_OK;
}

VOID CStaticNode::RemoveAttribute ( DWORD dwAttribute ) [inline]

Definition at line 111 of file staticnode.h.

{}

VOID CStaticNode::RemoveChildNodes ( ) [private]

Definition at line 439 of file staticnode.cpp.

{
  LPBASENODE pNode = NULL;
  POSITION   Pos   = m_NodeList.GetHeadPosition();
  while( Pos )
  {
    pNode = m_NodeList.GetNext( Pos );
    delete pNode;
  }
  m_NodeList.RemoveAll();              // Clean the list
}

VOID CStaticNode::RemoveNodes ( ) [private]
VOID CStaticNode::RemoveNodes ( ) [private]

Definition at line 470 of file staticnode.cpp.

{
  LPBASENODE pNode = NULL;
  POSITION   Pos   = m_NodeList.GetHeadPosition();
  while( Pos )
  {
    pNode = m_NodeList.GetNext( Pos );
    delete pNode;
  }
  m_NodeList.RemoveAll();              // Clean the list
}

VOID CStaticNode::RemoveNodes ( ) [private]
VOID CStaticNode::RemoveNodes ( ) [private]
VOID CStaticNode::RemoveNodes ( ) [private]
VOID CStaticNode::SetAttribute ( DWORD dwAttribute ) [inline]

Definition at line 110 of file staticnode.h.

{}

virtual void CStaticNode::SetScopeItemValue ( HSCOPEITEM hscopeitem ) [inline, virtual]

Reimplemented from CDelegationBase.

Definition at line 38 of file statnode.h.

{ m_hParentHScopeItem = hscopeitem; }

static LRESULT CALLBACK CStaticNode::StaticNodeWndProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]
static LRESULT CALLBACK CStaticNode::StaticNodeWndProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]
static LRESULT CALLBACK CStaticNode::StaticNodeWndProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]
static LRESULT CALLBACK CStaticNode::StaticNodeWndProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]
static LRESULT CALLBACK CStaticNode::StaticNodeWndProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]
LRESULT CALLBACK CStaticNode::StaticNodeWndProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 105 of file staticnode.cpp.

{
  switch( uMsg )
  {
    // Since we registered the WndClass in Initialize, our WndProc will be
    // called with WM_CREATE right away.  Store our 'hWnd' pointer in the
    // CREATESTRUCT so we can retreive it later to get back to the specific
    // instance of CComponentData
    //
    case WM_CREATE:
    {
      LPCREATESTRUCT lpcs = (LPCREATESTRUCT)lParam;
      SetWindowLongPtr( hWnd, 0, (LONG_PTR)lpcs->lpCreateParams );
      break;
    }

    // This is our custom message which could have been sent from a worker
    // thread, or in this case a modeless dialog.  We retrieve our 'this'
    // pointer from the WndClass and cast it to a CComponentData pointer.
    // WPARAM is cast to a NODE_PROPERTIES struct which can be used to
    // call AddDeviceNode()
    //
    case WM_ADD_DEVICENODE:
    {
      CStaticNode* pThisNode = (CStaticNode*)GetWindowLongPtr( hWnd, 0 );
      NODE_PROPERTIES* pProps = (NODE_PROPERTIES*)wParam;
      pThisNode->AddDeviceNode( pProps );
      break;
    }

    // This message is sent by the AddDeviceDlg to let us know it's
    // being terminated.  Set our member handle to NULL so the item
    // will be show on the context menu
    //
    case WM_DEVICENODE_CLOSED:
    {
      CStaticNode* pThisNode = (CStaticNode*)GetWindowLongPtr( hWnd, 0 );
      pThisNode->m_hAddDeviceDlg = NULL;
      break;
    }
    default:
      return DefWindowProc( hWnd, uMsg, wParam, lParam );
  }
  return 0;
}

VOID CStaticNode::ToggleStatus ( LPDATAOBJECT ipDataObject )
VOID CStaticNode::ToggleStatus ( LPDATAOBJECT ipDataObject )
VOID CStaticNode::ToggleStatus ( LPDATAOBJECT ipDataObject )

Definition at line 517 of file staticnode.cpp.

{
  CDeviceNode* pNode = (CDeviceNode*)ExtractBaseNodePtr( ipDataObject );
  if( NULL != pNode )
    pNode->ToggleStatus();

}

VOID CStaticNode::ToggleStatus ( LPDATAOBJECT ipDataObject )
VOID CStaticNode::ToggleStatus ( LPDATAOBJECT ipDataObject )
VOID CStaticNode::ToggleStatus ( LPDATAOBJECT ipDataObject )

Member Data Documentation

CDelegationBase * CStaticNode::children [private]

Definition at line 43 of file statnode.h.

HWND CStaticNode::m_hAddDeviceDlg

Definition at line 89 of file staticnode.h.

HWND CStaticNode::m_hMessageWnd [private]

Definition at line 84 of file staticnode.h.

HSCOPEITEM CStaticNode::m_hParentHScopeItem [private]

Definition at line 49 of file statnode.h.

HSCOPEITEM CStaticNode::m_hStaticNode [private]

Definition at line 82 of file staticnode.h.

CLListImpl< CDeviceNode *, CDeviceNode * > CStaticNode::m_NodeList [private]

Definition at line 86 of file staticnode.h.

CComponentData * CStaticNode::m_pCompData [private]

Definition at line 57 of file staticnode.h.

GUID CStaticNode::m_thisGUID = CLSID_CComponentData [static, private]

Definition at line 95 of file staticnode.h.

struct CStaticNode::privateData CStaticNode::snapInData [private]
static const GUID CStaticNode::thisGuid = { 0x2974380c, 0x4c4b, 0x11d2, { 0x89, 0xd8, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28 } } [static, private]

Reimplemented from CDelegationBase.

Definition at line 43 of file statnode.h.

static GUID CStaticNode::thisGUID = { 0x2974380c, 0x4c4b, 0x11d2, { 0x89, 0xd8, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28 } } [static, private]

Definition at line 56 of file staticnode.h.

The documentation for this class was generated from the following files:
  • SysMgmt/MMC/About/statnode.h
  • SysMgmt/MMC/ActiveX/statnode.h
  • SysMgmt/MMC/CMenu/statnode.h
  • SysMgmt/MMC/Complete/statnode.h
  • SysMgmt/MMC/CutCopy/statnode.h
  • SysMgmt/MMC/Extens/statnode.h
  • SysMgmt/MMC/Menubtn/statnode.h
  • SysMgmt/MMC/Multisel/statnode.h
  • SysMgmt/MMC/Nodes/statnode.h
  • SysMgmt/MMC/Openserv/statnode.h
  • SysMgmt/MMC/Proppage/statnode.h
  • SysMgmt/MMC/Taskpads/statnode.h
  • SysMgmt/MMC/Toolbar/statnode.h
  • SysMgmt/MMC/WMI/statnode.h
  • SysMgmt/MMC/Help/StatNode.h
  • SysMgmt/MMC/mmc2.0/about/staticnode.h
  • SysMgmt/MMC/mmc2.0/contextmenu/staticnode.h
  • SysMgmt/MMC/mmc2.0/dragdrop/staticnode.h
  • SysMgmt/MMC/mmc2.0/help/staticnode.h
  • SysMgmt/MMC/mmc2.0/multisel/staticnode.h
  • SysMgmt/MMC/mmc2.0/proppage/staticnode.h
  • SysMgmt/MMC/mmc2.0/simple/staticnode.h
  • SysMgmt/MMC/mmc2.0/viewex/staticnode.h
  • SysMgmt/MMC/Simple/statnode.h
  • SysMgmt/MMC/About/statnode.Cpp
  • SysMgmt/MMC/ActiveX/statnode.Cpp
  • SysMgmt/MMC/CMenu/statnode.Cpp
  • SysMgmt/MMC/Complete/statnode.Cpp
  • SysMgmt/MMC/CutCopy/statnode.Cpp
  • SysMgmt/MMC/Extens/statnode.Cpp
  • SysMgmt/MMC/Help/StatNode.Cpp
  • SysMgmt/MMC/Menubtn/statnode.Cpp
  • SysMgmt/MMC/mmc2.0/about/staticnode.cpp
  • SysMgmt/MMC/mmc2.0/contextmenu/staticnode.cpp
  • SysMgmt/MMC/mmc2.0/dragdrop/staticnode.cpp
  • SysMgmt/MMC/mmc2.0/help/staticnode.cpp
  • SysMgmt/MMC/mmc2.0/multisel/staticnode.cpp
  • SysMgmt/MMC/mmc2.0/proppage/staticnode.cpp
  • SysMgmt/MMC/mmc2.0/simple/staticnode.cpp
  • SysMgmt/MMC/mmc2.0/viewex/staticnode.cpp
  • SysMgmt/MMC/Multisel/statnode.Cpp
  • SysMgmt/MMC/Nodes/statnode.Cpp
  • SysMgmt/MMC/Openserv/statnode.Cpp
  • SysMgmt/MMC/Proppage/statnode.Cpp
  • SysMgmt/MMC/Simple/statnode.Cpp
  • SysMgmt/MMC/Taskpads/statnode.Cpp
  • SysMgmt/MMC/Toolbar/statnode.Cpp
  • SysMgmt/MMC/WMI/statnode.Cpp
Generated on Wed Nov 13 2024 16:57:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CStaticNode::privateData Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • CStaticNode
  • CStaticNode::privateData
Public Member Functions | Public Attributes

CStaticNode::privateData Struct Reference

List of all members.

Public Member Functions

privateData ()
privateData ()

Public Attributes

_TCHAR | host [MAX_PATH]
bool | isDirty
BOOL m_fAllowOverrideMachineNameOut
BOOL m_fIsRadioLocalMachine
_TCHAR | m_host [MAX_PATH]
bool | m_isDirty

Detailed Description

Definition at line 63 of file statnode.h.

Constructor & Destructor Documentation

CStaticNode::privateData::privateData ( ) [inline]

Definition at line 69 of file statnode.h.

                      : m_isDirty(false) {
            ZeroMemory(m_host, sizeof(m_host));
            m_fIsRadioLocalMachine = TRUE;
            m_fAllowOverrideMachineNameOut = FALSE;
        }

CStaticNode::privateData::privateData ( ) [inline]

Definition at line 49 of file statnode.h.

                      : isDirty(false) {
            ZeroMemory(host, sizeof(host));
        }

Member Data Documentation

_TCHAR CStaticNode::privateData::host[MAX_PATH]

Definition at line 46 of file statnode.h.

bool CStaticNode::privateData::isDirty

Definition at line 47 of file statnode.h.

BOOL CStaticNode::privateData::m_fAllowOverrideMachineNameOut

Definition at line 66 of file statnode.h.

BOOL CStaticNode::privateData::m_fIsRadioLocalMachine

Definition at line 65 of file statnode.h.

_TCHAR CStaticNode::privateData::m_host[MAX_PATH]

Definition at line 64 of file statnode.h.

bool CStaticNode::privateData::m_isDirty

Definition at line 67 of file statnode.h.

The documentation for this struct was generated from the following files:
  • SysMgmt/MMC/Openserv/statnode.h
  • SysMgmt/MMC/Simple/statnode.h
Generated on Wed Nov 13 2024 16:57:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CStatusBarLite Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CStatusBarLite Class Reference

#include "cdialoglite.h"

Inherits CWndLite.

List of all members.

Public Member Functions

CStatusBarLite ()
virtual | ~CStatusBarLite ()
virtual BOOL | Create (HWND hWndParent, UINT nID, WCHAR *pwszText=L"", DWORD dwStyle=WS_CHILD|WS_VISIBLE)
virtual BOOL | SetParts (int nParts, int *pWidths)
virtual BOOL | SetText (WCHAR *pwszText, int nPane, int nType)

Detailed Description

Definition at line 923 of file cdialoglite.h.

Constructor & Destructor Documentation

CStatusBarLite::CStatusBarLite ( )

Definition at line 3844 of file cdialoglite.cpp.

{
}

CStatusBarLite::~CStatusBarLite ( ) [virtual]

Definition at line 3853 of file cdialoglite.cpp.

{
}

Member Function Documentation

BOOL CStatusBarLite::Create | ( | HWND | hWndParent,
 |  | UINT | nID,
 |  | WCHAR * | pwszText = L"",
 |  | DWORD | dwStyle = WS_CHILD | WS_VISIBLE |
 | ) |  |  | [virtual]

Definition at line 3862 of file cdialoglite.cpp.

{
  ASSERT(IsDestroyed());
  m_hWndParent = hWndParent;

  //Create StatusBar
  if(IsUnicodeOS())
  {
    m_hWnd = CreateStatusWindowW(dwStyle, pwszText, hWndParent, nID);
  }
  else
  {
    CHAR szBuffer[MAX_NAME_LEN];
    ConvertToMBCS(pwszText, szBuffer, MAX_NAME_LEN);
    m_hWnd = CreateStatusWindowA(dwStyle, szBuffer, hWndParent, nID);
  }

  return m_hWnd != NULL;

}

virtual BOOL CStatusBarLite::SetParts | ( | int | nParts,
 |  | int * | pWidths |
 | ) |  |  | [inline, virtual]

Definition at line 935 of file cdialoglite.h.

{ return (BOOL)SendMessage(m_hWnd, SB_SETPARTS, nParts, (LPARAM)pWidths);   }

virtual BOOL CStatusBarLite::SetText | ( | WCHAR * | pwszText,
 |  | int | nPane,
 |  | int | nType |
 | ) |  |  | [inline, virtual]

Definition at line 934 of file cdialoglite.h.

{ return (BOOL)wSendMessage(m_hWnd, SB_SETTEXTW, (nPane|nType), pwszText);    }

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialoglite.h
  • Dataaccess/oledb/rowsetviewer/cdialoglite.cpp
Generated on Wed Nov 13 2024 16:57:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CStatusHelper Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes | Private Member Functions

CStatusHelper Class Reference

#include "CStatHlp.h"

List of all members.

Public Member Functions

CStatusHelper (HWND, HINSTANCE)
~CStatusHelper (void)
void | MenuSelect (WORD, WORD, HMENU)
void | MessageDisplay (UINT)
BOOL | MessageMap (HWND, UINT, UINT, UINT, UINT, UINT, UINT, UINT, UINT, UINT)

Protected Attributes

USHORT m_cMessages
USHORT m_cPopups
BOOL m_fMapped
HINSTANCE | m_hInst
HGLOBAL m_hMemSMM
HWND | m_hWnd
HWND | m_hWndOwner
UINT m_idsMax
UINT m_idsMin
PPOPUPMENUMAP m_pPMM
PSTATMESSAGEMAP m_pSMM
PCStringTable m_pST
USHORT m_uIDBlank
UINT m_uIDCur
USHORT m_uIDPopupMax
USHORT m_uIDPopupMin
USHORT m_uIDStatic
USHORT m_uIDSysMenu

Private Member Functions

USHORT | IDFromHMenu (HMENU)
UINT IStringFromID (USHORT)
void | Sort (void)

Detailed Description

Definition at line 44 of file CStatHlp.h.

Constructor & Destructor Documentation

CStatusHelper::CStatusHelper | ( | HWND | hWnd,
 |  | HINSTANCE | hInst
 | ) |  |

Definition at line 31 of file CStatHlp.Cpp.

    {
    m_hWnd=hWnd;
    m_hInst=hInst;

    m_uIDCur=0xFFFFFFFF;    //Nothing shown yet.

    m_pST=NULL;
    m_pPMM=NULL;
    m_pSMM=NULL;
    m_hMemSMM=NULL;

    //With this FALSE, many other members are ignored.
    m_fMapped=FALSE;
    return;
    }

CStatusHelper::~CStatusHelper ( void )

Definition at line 52 of file CStatHlp.Cpp.

    {
    //Free up anything from MessageMap
    if (NULL!=m_pPMM)
        {
        LocalFree((HLOCAL)m_pPMM);
        m_pPMM=NULL;
        }

    if (NULL!=m_pST)
        {
        delete m_pST;
        m_pST=NULL;
        }

    if (NULL!=m_pSMM)
        {
        LocalFree((HLOCAL)m_pSMM);
        UnlockResource(m_hMemSMM);
        m_pSMM=NULL;
        }

    if (NULL!=m_hMemSMM)
        {
        FreeResource(m_hMemSMM);
        m_hMemSMM=NULL;
        }

    return;
    }

Member Function Documentation

USHORT CStatusHelper::IDFromHMenu ( HMENU hMenu ) [private]

Definition at line 331 of file CStatHlp.Cpp.

    {
    USHORT      uID=m_uIDBlank;      //Default is empty
    UINT        i;

    for (i=0; i < m_cPopups; i++)
        {
        if (m_pPMM[i].hMenu==hMenu)
            {
            uID=m_pPMM[i].uID;
            break;
            }
        }

    return uID;
    }

UINT CStatusHelper::IStringFromID ( USHORT uID ) [private]

Definition at line 359 of file CStatHlp.Cpp.

    {
    UINT        iLow =0;
    UINT        iHigh=m_cMessages-1;
    UINT        iMid;

    while (TRUE)
        {
        iMid=(iLow+iHigh) >> 1;

        if (uID < m_pSMM[iMid].uID)
            iHigh=iMid-1;
        else
            {
            if (uID > m_pSMM[iMid].uID)
                iLow=iMid+1;
            else
                break;    //Equality
            }

        if (iHigh < iLow)
            break;
        }

    return m_pSMM[iMid].idsMsg;
    }

void CStatusHelper::MenuSelect | ( | WORD | wItem,
 |  | WORD | wFlags,
 |  | HMENU | hMenu
 | ) |  |

Definition at line 214 of file CStatHlp.Cpp.

    {
    USHORT          uID;

    if (!m_fMapped)
        return;

    //Case 1:  Menu was cancelled, display static string
    if (0==wItem && (WORD)0xFFFF==wFlags)
        uID=m_uIDStatic;
    else
        {
        //Case 2:  System menu selected by itself.
        if ((MF_POPUP & wFlags) && (MF_SYSMENU & wFlags))
            uID=m_uIDSysMenu;
        else
            {
             //  Case 3:  A popup menu was chosen:
             //  Find the ID for the popup menu index in wItem
            if (MF_POPUP & wFlags)
                uID=IDFromHMenu((HMENU)wItem);
            else
                //Case 4:  A menu item is selected
                if (0!=wItem)
                    uID=(UINT)wItem;
                else
                    //Case 5:  Nothing is selected (e.g. separator)
                    uID=m_uIDBlank;
           }
        }

    //Display the message
    MessageDisplay(uID);
    return;
    }

void CStatusHelper::MessageDisplay ( UINT uID )

Definition at line 259 of file CStatHlp.Cpp.

    {
    UINT        idsMsg;

    if (!m_fMapped)
        return;

    //If we're already displaying this ID, nothing we need to do
    if (m_uIDCur==uID)
        return;

    //Go look up the string ID to display.
    idsMsg=IStringFromID(uID);

    //Display it.
    SetWindowText(m_hWnd, (*m_pST)[idsMsg]);
    return;
    }

BOOL CStatusHelper::MessageMap | ( | HWND | hWndOwner,
 |  | UINT | uIDRMap,
 |  | UINT | idsMin,
 |  | UINT | idsMax,
 |  | UINT | cchMax,
 |  | UINT | uIDPopupMin,
 |  | UINT | uIDPopupMax,
 |  | UINT | uIDStatic,
 |  | UINT | uIDBlank,
 |  | UINT | uIDSysMenu
 | ) |  |

Definition at line 109 of file CStatHlp.Cpp.

    {
    HMENU           hMenu;
    HRSRC           hRes;
    UINT            i;
    USHORT          uID;
    DWORD           dwSize;
    PSTATMESSAGEMAP pSMM;

    // Check if we even got a valid window in the constructor
    // or if we've already been called.
    if (!IsWindow(m_hWnd) || m_fMapped)
        return FALSE;

    //Parameter validation
    if (idsMax < idsMin || uIDPopupMax < uIDPopupMin)
        return FALSE;

    //Cache away all this vital information
    m_hWndOwner  =hWndOwner;
    m_idsMin     =idsMin;
    m_idsMax     =idsMax;
    m_cMessages  =(USHORT)(idsMax-idsMin+1);

    m_uIDPopupMin=uIDPopupMin;
    m_uIDPopupMax=uIDPopupMax;
    m_cPopups    =(USHORT)(uIDPopupMax-uIDPopupMin+1);
    m_uIDStatic  =uIDStatic;
    m_uIDBlank   =uIDBlank;
    m_uIDSysMenu =uIDSysMenu;

    //Get a stringtable with all the messages
    m_pST=new CStringTable(m_hInst);

    if (NULL==m_pST)
        return FALSE;

    if (!m_pST->FInit(idsMin, idsMax, CCHSTATUSMSGMAX))
        return FALSE;

    //Load the STATMESSAGEMAP array from resources
    hRes=FindResource(m_hInst, MAKEINTRESOURCE(uIDRMap), RT_RCDATA);

    if (NULL==hRes)
        return FALSE;

    m_hMemSMM=LoadResource(m_hInst, hRes);

    if (NULL==m_hMemSMM)
        return FALSE;

    pSMM=(PSTATMESSAGEMAP)LockResource(m_hMemSMM);

    if (NULL==pSMM)
        return FALSE;

    // Now get the size of the resource
    dwSize = SizeofResource(m_hInst, hRes);

    // Resources are ReadOnly data so copy it to memory that can
    // be used
    m_pSMM = (PSTATMESSAGEMAP)LocalAlloc(LPTR, dwSize);
    if (NULL==m_pSMM)
        return FALSE;
    CopyMemory(m_pSMM, pSMM, dwSize);

    //Sort these for binary search lookup.
    Sort();

    //Allocate an array of POPUPMENUMAP structures
    m_pPMM=(PPOPUPMENUMAP)LocalAlloc(LPTR
        , sizeof(POPUPMENUMAP)*m_cPopups);

    if (NULL==m_pPMM)
        return FALSE;

    //Initialize the array mapping popup menus to specific IDs.
    uID=uIDPopupMin;
    hMenu=GetMenu(m_hWndOwner);

    for (i=0; i < m_cPopups; i++)
        {
        m_pPMM[i].hMenu=GetSubMenu(hMenu, i);
        m_pPMM[i].uID  =uID++;
        }

    //All done!
    m_fMapped=TRUE;
    return TRUE;
    }

void CStatusHelper::Sort ( void ) [private]

Definition at line 288 of file CStatHlp.Cpp.

    {
    UINT            i, j, k;
    STATMESSAGEMAP  smm;

    for (j=0; j < (UINT)(m_cMessages-1); j++)
        {
        k=j;
        smm.uID   =m_pSMM[j].uID;
        smm.idsMsg=m_pSMM[j].idsMsg;

        for (i=j+1; i < (UINT)m_cMessages; i++)
            {
            if (m_pSMM[i].uID < smm.uID)
                {
                smm.uID   =m_pSMM[i].uID;
                smm.idsMsg=m_pSMM[i].idsMsg;
                k=i;
                }
            }

        smm.uID         =m_pSMM[j].uID;
        smm.idsMsg      =m_pSMM[j].idsMsg;
        m_pSMM[j].uID   =m_pSMM[k].uID;   ;
        m_pSMM[j].idsMsg=m_pSMM[k].idsMsg;;
        m_pSMM[k].uID   =smm.uID;
        m_pSMM[k].idsMsg=smm.idsMsg;
        }

    return;
    }

Member Data Documentation

USHORT CStatusHelper::m_cMessages [protected]

Definition at line 55 of file CStatHlp.h.

USHORT CStatusHelper::m_cPopups [protected]

Definition at line 63 of file CStatHlp.h.

BOOL CStatusHelper::m_fMapped [protected]

Definition at line 49 of file CStatHlp.h.

HINSTANCE CStatusHelper::m_hInst [protected]

Definition at line 48 of file CStatHlp.h.

HGLOBAL CStatusHelper::m_hMemSMM [protected]

Definition at line 67 of file CStatHlp.h.

HWND CStatusHelper::m_hWnd [protected]

Definition at line 47 of file CStatHlp.h.

HWND CStatusHelper::m_hWndOwner [protected]

Definition at line 54 of file CStatHlp.h.

UINT CStatusHelper::m_idsMax [protected]

Definition at line 57 of file CStatHlp.h.

UINT CStatusHelper::m_idsMin [protected]

Definition at line 56 of file CStatHlp.h.

PPOPUPMENUMAP CStatusHelper::m_pPMM [protected]

Definition at line 69 of file CStatHlp.h.

PSTATMESSAGEMAP CStatusHelper::m_pSMM [protected]

Definition at line 68 of file CStatHlp.h.

PCStringTable CStatusHelper::m_pST [protected]

Definition at line 50 of file CStatHlp.h.

USHORT CStatusHelper::m_uIDBlank [protected]

Definition at line 60 of file CStatHlp.h.

UINT CStatusHelper::m_uIDCur [protected]

Definition at line 52 of file CStatHlp.h.

USHORT CStatusHelper::m_uIDPopupMax [protected]

Definition at line 65 of file CStatHlp.h.

USHORT CStatusHelper::m_uIDPopupMin [protected]

Definition at line 64 of file CStatHlp.h.

USHORT CStatusHelper::m_uIDStatic [protected]

Definition at line 59 of file CStatHlp.h.

USHORT CStatusHelper::m_uIDSysMenu [protected]

Definition at line 61 of file CStatHlp.h.

The documentation for this class was generated from the following files:
  • WinUI/Shell/FileView/CStatHlp.h
  • WinUI/Shell/FileView/CStatHlp.Cpp
Generated on Wed Nov 13 2024 16:57:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CStdDbOutput Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Public Attributes | Private Attributes

CStdDbOutput Class Reference

List of all members.

Public Member Functions

CStdDbOutput ()
~CStdDbOutput ()
void | operator delete (void FAR *pv)
void FAR * | operator new (size_t cb)
virtual void _cdecl | Printf (char FAR *szFmt,...)
STDMETHOD() | QueryInterface (REFIID riid, void FAR *FAR *ppv)
STDMETHOD_ (ULONG, AddRef)(void)
STDMETHOD_ (ULONG, Release)(void)
STDMETHOD_ (void, Assertion)(BOOL cond

Static Public Member Functions

static IDbOutput FAR * | Create ()

Public Attributes

char FAR * | szExpr
char FAR char FAR * | szFile
char FAR char FAR UINT char FAR * | szMsg
char FAR char FAR UINT | uLine

Private Attributes

ULONG m_refs
char | m_rgch [128]

Detailed Description

Definition at line 154 of file dballoc.Cpp.

Constructor & Destructor Documentation

CStdDbOutput::CStdDbOutput ( ) [inline]

Definition at line 184 of file dballoc.Cpp.

                 {
     g_dwObjectCount++ ;
     m_refs = 0;
   }

CStdDbOutput::~CStdDbOutput ( ) [inline]

Definition at line 189 of file dballoc.Cpp.

{ g_dwObjectCount-- ; }

Member Function Documentation

IDbOutput FAR * CStdDbOutput::Create ( ) [static]

Definition at line 723 of file dballoc.Cpp.

{
   return (IDbOutput FAR*)new FAR CStdDbOutput();
}

void CStdDbOutput::operator delete ( void FAR * pv ) [inline]

Definition at line 180 of file dballoc.Cpp.

                                     {
     FREE(pv);
   }

void FAR* CStdDbOutput::operator new ( size_t cb ) [inline]

Definition at line 177 of file dballoc.Cpp.

                                    {
     return MALLOC(cb);
   }

void _cdecl CStdDbOutput::Printf | ( | char FAR * | szFmt,
 |  |  | ... |
 | ) |  |  | [virtual]

Definition at line 756 of file dballoc.Cpp.

{
   va_list args;
   char szBuf[256];
#if defined( OBSOLETE )
   char *pn, FAR* pf;
static char rgchFmtBuf[128];
static char rgchOutputBuf[128];

   // copy the 'far' format string to a near buffer so we can use
   // a medium model vsprintf, which only supports near data pointers.
   //
   pn = rgchFmtBuf, pf=szFmt;
   while(*pf != '\0')
     *pn++ = *pf++;
   *pn = '\0';
#endif

   va_start(args, lpszFmt);

//    wvsprintf(rgchOutputBuf, rgchFmtBuf, args);
   wvsprintf(szBuf, lpszFmt, args);

   OutputDebugString(szBuf);
}

STDMETHODIMP CStdDbOutput::QueryInterface | ( | REFIID | riid,
 |  | void FAR *FAR * | ppv
 | ) |  |

Definition at line 729 of file dballoc.Cpp.

{
   if(riid == IID_IUnknown){
     *ppv = this;
     AddRef();
     return NOERROR;
   }
   return E_NOINTERFACE;
}

CStdDbOutput::STDMETHOD_ | ( | ULONG | ,
 |  | Release |
 | ) |  |
CStdDbOutput::STDMETHOD_ | ( | ULONG | ,
 |  | AddRef |
 | ) |  |
CStdDbOutput::STDMETHOD_ | ( | void | ,
 |  | Assertion |
 | ) |  |

Member Data Documentation

ULONG CStdDbOutput::m_refs [private]

Definition at line 193 of file dballoc.Cpp.

char CStdDbOutput::m_rgch[128] [private]

Definition at line 195 of file dballoc.Cpp.

char FAR* CStdDbOutput::szExpr

Definition at line 171 of file dballoc.Cpp.

char FAR char FAR* CStdDbOutput::szFile

Definition at line 171 of file dballoc.Cpp.

char FAR char FAR UINT char FAR* CStdDbOutput::szMsg

Definition at line 171 of file dballoc.Cpp.

char FAR char FAR UINT CStdDbOutput::uLine

Definition at line 171 of file dballoc.Cpp.

The documentation for this class was generated from the following file:
  • Com/Fundamentals/OleStd/dballoc.Cpp
Generated on Wed Nov 13 2024 16:57:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CStorageBuffer Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CStorageBuffer Class Reference

#include "cstream.h"

List of all members.

Public Member Functions

CStorageBuffer ()
virtual | ~CStorageBuffer ()
STDMETHODIMP | Clone (IStream **ppstm)
STDMETHODIMP | Commit (DWORD grfCommitFlags)
STDMETHODIMP | CopyTo (IStream *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten)
STDMETHODIMP | Flush ()
STDMETHODIMP | LockRegion (ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
STDMETHODIMP | Read (void *pv, ULONG cb, ULONG *pcbRead)
STDMETHODIMP | ReadAt (ULARGE_INTEGER ulOffset, void *pv, ULONG cb, ULONG *pcbRead)
STDMETHODIMP | ReadBuffer (ULONG ulOffset, void *pv, ULONG cb, ULONG *pcbRead)
STDMETHODIMP | Revert ()
STDMETHODIMP | Seek (LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
STDMETHODIMP | Seek (LONG lOffset, DWORD dwOrigin=STREAM_SEEK_SET, ULONG *pulNewPosition=NULL)
STDMETHODIMP | SetSize (ULARGE_INTEGER libNewSize)
STDMETHODIMP | Stat (STATSTG *pstatstg, DWORD grfStatFlag)
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP | UnlockRegion (ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
STDMETHODIMP | Write (const void *pv, ULONG cb, ULONG *pcbWritten)
STDMETHODIMP | WriteAt (ULARGE_INTEGER ulOffset, const void *pv, ULONG cb, ULONG *pcbWritten)
STDMETHODIMP | WriteBuffer (ULONG ulOffset, const void *pv, ULONG cb, ULONG *pcbRead)

Private Attributes

ULONG m_cMaxSize
ULONG m_cRef
ULONG m_iPos
void * | m_pBuffer

Detailed Description

Definition at line 78 of file cstream.h.

Constructor & Destructor Documentation

CStorageBuffer::CStorageBuffer ( )

Definition at line 447 of file cstream.cpp.

{
  m_iPos    = 0;
  m_cRef    = 1;

  m_pBuffer   = NULL;
  m_cMaxSize  = 0;
}

CStorageBuffer::~CStorageBuffer ( ) [virtual]

Definition at line 457 of file cstream.cpp.

{
  SAFE_FREE(m_pBuffer);
}

Member Function Documentation

HRESULT CStorageBuffer::Clone ( IStream ** ppstm )

Definition at line 827 of file cstream.cpp.

{
  HRESULT hr = E_NOTIMPL;
  TRACE_METHOD(hr, L"\tILockBytes::Clone()");
  return hr;
}

HRESULT CStorageBuffer::Commit ( DWORD grfCommitFlags )

Definition at line 751 of file cstream.cpp.

{
  HRESULT hr = S_OK;
  TRACE_METHOD(hr, L"\tIStream::Commit()");
  return hr;
}

HRESULT CStorageBuffer::CopyTo | ( | IStream * | pstm,
 |  | ULARGE_INTEGER | cb,
 |  | ULARGE_INTEGER * | pcbRead,
 |  | ULARGE_INTEGER * | pcbWritten
 | ) |  |

Definition at line 693 of file cstream.cpp.

{
  HRESULT hr = S_OK;

  //This is equivlent of doing Read from our stream then Write into the destination.
  //It also moves the seek position.  Bug this would require allocating a temp buffer...
  //Just access our stream directly...

  //Parameter checking
  if(pcbRead)
    pcbRead->QuadPart = 0;
  if(pcbWritten)
    pcbWritten->QuadPart = 0;

  //Actual code
  ULONG cBytesLeft = m_cMaxSize - m_iPos;
  ULONG cBytesRead = (ULONG)cb.QuadPart > cBytesLeft ? cBytesLeft : (ULONG)cb.QuadPart;
  ULONG cBytesWritten = 0;

  if(!pIStream)
  {
    hr = STG_E_INVALIDPOINTER;
    goto CLEANUP;
  }

  if(cb.QuadPart == 0)
  {
    hr = S_OK;
    goto CLEANUP;
  }

  //if no more bytes to retrive return
  if(cBytesLeft == 0)
  {
    hr = S_FALSE;
    goto CLEANUP;
  }

  //Copy to users buffer the number of bytes requested or remaining
  pIStream->Write((BYTE*)m_pBuffer + m_iPos, cBytesRead, &cBytesWritten);
  m_iPos += cBytesRead;

  if(pcbRead)
    pcbRead->QuadPart = cBytesRead;
  if(pcbWritten)
    pcbWritten->QuadPart = cBytesWritten;

  if(cb.QuadPart != cBytesRead)
    hr = S_FALSE;

CLEANUP:
  TRACE_METHOD(hr, L"\tIStream::CopyTo(0x%p, %d, &%d, &%d)", pIStream, cb, cBytesRead, cBytesWritten);
  return hr;
}

HRESULT CStorageBuffer::Flush ( )

Definition at line 871 of file cstream.cpp.

{
  HRESULT hr = S_OK;
  TRACE_METHOD(hr, L"\tILockBytes::Flush()");
  return hr;
}

HRESULT CStorageBuffer::LockRegion | ( | ULARGE_INTEGER | libOffset,
 |  | ULARGE_INTEGER | cb,
 |  | DWORD | dwLockType
 | ) |  |

Definition at line 765 of file cstream.cpp.

{
  //Locking is optional
  HRESULT hr = STG_E_INVALIDFUNCTION;
  TRACE_METHOD(hr, L"\tIStream::LockRegion()");
  return hr;
}

STDMETHODIMP CStorageBuffer::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |
HRESULT CStorageBuffer::Read | ( | void * | pv,
 |  | ULONG | cb,
 |  | ULONG * | pcbRead
 | ) |  |

Definition at line 572 of file cstream.cpp.

{
  ULONG cbRead = 0;
  HRESULT hr = S_OK;

  //Delegate, reading from the current position
  XTEST(hr = ReadBuffer(m_iPos, pv, cb, &cbRead));
  TRACE_METHOD(hr, L"\tISequentialStream::Read(0x%p, %d, &%d)", pv, cb, cbRead);

  if(SUCCEEDED(hr))
    m_iPos += cbRead;

  if(pcbRead)
    *pcbRead = cbRead;

  return hr;
}

HRESULT CStorageBuffer::ReadAt | ( | ULARGE_INTEGER | ulOffset,
 |  | void * | pv,
 |  | ULONG | cb,
 |  | ULONG * | pcbRead
 | ) |  |

Definition at line 835 of file cstream.cpp.

{
  HRESULT hr = S_OK;
  ULONG cbRead = 0;

  //Delegate, reading from the current position
  XTEST(hr = ReadBuffer((ULONG)ulOffset.QuadPart, pv, cb, &cbRead));
  TRACE_METHOD(hr, L"\tILockBytes::ReadAt(%d, 0x%p, %d, &%d)", (ULONG)ulOffset.QuadPart, pv, cb, cbRead);

  if(pcbRead)
    *pcbRead = cbRead;
  return hr;
}

HRESULT CStorageBuffer::ReadBuffer | ( | ULONG | ulOffset,
 |  | void * | pv,
 |  | ULONG | cb,
 |  | ULONG * | pcbRead
 | ) |  |

Definition at line 508 of file cstream.cpp.

{
  //Parameter checking
  if(pcbRead)
    *pcbRead = 0;

  if(!pv)
    return STG_E_INVALIDPOINTER;

  if(cb == 0)
    return S_OK;

  //Actual code
  ULONG cBytesLeft = m_cMaxSize > ulOffset ? m_cMaxSize - ulOffset : 0;
  ULONG cBytesRead = cb > cBytesLeft ? cBytesLeft : cb;

  //if no more bytes to retrive return
  if(cBytesLeft == 0)
    return S_FALSE;

  //Copy to users buffer the number of bytes requested or remaining
  memcpy(pv, (void*)((BYTE*)m_pBuffer + ulOffset), cBytesRead);

  if(pcbRead)
    *pcbRead = cBytesRead;

  if(cb != cBytesRead)
    return S_FALSE;

  return S_OK;
}

HRESULT CStorageBuffer::Revert ( void )

Definition at line 758 of file cstream.cpp.

{
  HRESULT hr = S_OK;
  TRACE_METHOD(hr, L"\tIStream::Revert()");
  return hr;
}

HRESULT CStorageBuffer::Seek | ( | LARGE_INTEGER | dlibMove,
 |  | DWORD | dwOrigin,
 |  | ULARGE_INTEGER * | plibNewPosition
 | ) |  |

Definition at line 651 of file cstream.cpp.

{
  HRESULT hr = S_OK;
  ULONG ulNewPosition = 0;

  //Delegate to the simplier version
  TESTC(hr = Seek((LONG)dlibMove.QuadPart, dwOrigin, &ulNewPosition));

CLEANUP:
  if(plibNewPosition)
     plibNewPosition->QuadPart = ulNewPosition;
  return hr;
}

HRESULT CStorageBuffer::Seek | ( | LONG | lOffset,
 |  | DWORD | dwOrigin = STREAM_SEEK_SET,
 |  | ULONG * | pulNewPosition = NULL
 | ) |  |

Definition at line 610 of file cstream.cpp.

{
  HRESULT hr = S_OK;
  LONG lNewPos = 0;

  //Determine with respect to what the origin is...
  switch(dwOrigin)
  {
    case STREAM_SEEK_SET:
      lNewPos = lOffset;
      break;

    case STREAM_SEEK_CUR:
      lNewPos = m_iPos + lOffset;
      break;

    case STREAM_SEEK_END:
      lNewPos = m_cMaxSize + lOffset;
      break;

    default:
      //The value of the dwOrigin parameter is not valid
      hr = STG_E_INVALIDFUNCTION;
      goto CLEANUP;
      break;
  };

  if(lNewPos<0 || (ULONG)lNewPos>m_cMaxSize)
    return STG_E_INVALIDFUNCTION; //No good return code for this situaiton?

  //Reset the current buffer position
  m_iPos = lNewPos;

CLEANUP:
  if(pulNewPosition)
     *pulNewPosition = m_iPos;
  TRACE_METHOD(hr, L"\tIStream::Seek(%d, %d, &%d)", lOffset, dwOrigin, m_iPos);
  return S_OK;
}

HRESULT CStorageBuffer::SetSize ( ULARGE_INTEGER libNewSize )

Definition at line 666 of file cstream.cpp.

{
  HRESULT hr = STG_E_MEDIUMFULL;
  void* pBuffer = m_pBuffer;

  //The value of the libNewSize parameter is not valid.
  //Since streams cannot be greater than 2^32 bytes in the COM-provided
  //implementation, the high DWORD of libNewSize must be 0.
  //If it is nonzero, this parameter is not valid.
  if(libNewSize.QuadPart > ULONG_MAX)
  {
    hr = STG_E_INVALIDFUNCTION;
    goto CLEANUP;
  }

  //Use a copy variable, incase allocations fail...
  SAFE_REALLOC(pBuffer, BYTE, libNewSize.QuadPart);

  m_pBuffer = pBuffer;
  m_cMaxSize = (ULONG)libNewSize.QuadPart;
  hr = S_OK;

CLEANUP:
  TRACE_METHOD(hr, L"\tIStream::SetSize(%d)", (ULONG)libNewSize.QuadPart);
  return hr;
}

HRESULT CStorageBuffer::Stat | ( | STATSTG * | pstatstg,
 |  | DWORD | grfStatFlag
 | ) |  |

Definition at line 785 of file cstream.cpp.

{
  HRESULT hr = S_OK;
  ULARGE_INTEGER largeInteger = { m_cMaxSize };

  if(!pstatstg)
  {
    hr = STG_E_INVALIDPOINTER;
    goto CLEANUP;
  }

  //Initialize the struct
  memset(pstatstg, 0, sizeof(STATSTG));

  //Set the string...
  switch(grfStatFlag)
  {
    case STATFLAG_NONAME:
      pstatstg->pwcsName = NULL;
      break;

    case STATFLAG_DEFAULT:
      pstatstg->pwcsName = wcsDuplicate(L"OLE DB Test Storage Object...");
      break;

    default:
      hr = STG_E_INVALIDFLAG;
      goto CLEANUP;
  };

  //type
  pstatstg->type = STGTY_STREAM;
  pstatstg->grfMode = STGM_READ;
  pstatstg->grfLocksSupported = 0;
  pstatstg->cbSize = largeInteger;

CLEANUP:
  TRACE_METHOD(hr, L"\tIStream::Stat(0x%p, 0x%08x)", pstatstg, grfStatFlag);
  return hr;
}

CStorageBuffer::STDMETHODIMP_ ( ULONG )
CStorageBuffer::STDMETHODIMP_ ( ULONG )
HRESULT CStorageBuffer::UnlockRegion | ( | ULARGE_INTEGER | libOffset,
 |  | ULARGE_INTEGER | cb,
 |  | DWORD | dwLockType
 | ) |  |

Definition at line 775 of file cstream.cpp.

{
  //Locking is optional
  HRESULT hr = STG_E_INVALIDFUNCTION;
  TRACE_METHOD(hr, L"\tIStream::UnlockRegion()");
  return hr;
}

HRESULT CStorageBuffer::Write | ( | const void * | pv,
 |  | ULONG | cb,
 |  | ULONG * | pcbWritten
 | ) |  |

Definition at line 591 of file cstream.cpp.

{
  ULONG cbWritten = 0;
  HRESULT hr = S_OK;

  //Delegate, writting to the current position
  XTEST(hr = WriteBuffer(m_iPos, pv, cb, &cbWritten));
  TRACE_METHOD(hr, L"\tISequentialStream::Write(0x%p, %d, &%d)", pv, cb, cbWritten);

  if(SUCCEEDED(hr))
    m_iPos += cbWritten;

  if(pcbWritten)
    *pcbWritten = cbWritten;

  return hr;
}

HRESULT CStorageBuffer::WriteAt | ( | ULARGE_INTEGER | ulOffset,
 |  | const void * | pv,
 |  | ULONG | cb,
 |  | ULONG * | pcbWritten
 | ) |  |

Definition at line 853 of file cstream.cpp.

{
  HRESULT hr = S_OK;
  ULONG cbWritten = 0;

  //Delegate, reading from the current position
  XTEST(hr = WriteBuffer((ULONG)ulOffset.QuadPart, pv, cb, &cbWritten));
  TRACE_METHOD(hr, L"\tILockBytes::WriteAt(%d, 0x%p, %d, &%d)", (ULONG)ulOffset.QuadPart, pv, cb, cbWritten);

  if(pcbWritten)
    *pcbWritten = cbWritten;
  return hr;
}

HRESULT CStorageBuffer::WriteBuffer | ( | ULONG | ulOffset,
 |  | const void * | pv,
 |  | ULONG | cb,
 |  | ULONG * | pcbRead
 | ) |  |

Definition at line 541 of file cstream.cpp.

{
  //Parameter checking
  if(!pv)
    return STG_E_INVALIDPOINTER;

  if(pcbWritten)
    *pcbWritten = 0;

  if(cb == 0)
    return S_OK;

  //May need to Enlarge the current buffer
  if(ulOffset + cb >= m_cMaxSize)
  {
    //Need to append to the end of the stream
    ULARGE_INTEGER largeSize = { ulOffset + cb };
    if(FAILED(SetSize(largeSize)))
      return E_OUTOFMEMORY;
  }

  //Copy to the buffer
  memcpy((void*)((BYTE*)m_pBuffer + ulOffset), pv, cb);

  if(pcbWritten)
    *pcbWritten = cb;

  return S_OK;
}

Member Data Documentation

ULONG CStorageBuffer::m_cMaxSize [private]

Definition at line 159 of file cstream.h.

ULONG CStorageBuffer::m_cRef [private]

Definition at line 156 of file cstream.h.

ULONG CStorageBuffer::m_iPos [private]

Definition at line 160 of file cstream.h.

void* CStorageBuffer::m_pBuffer [private]

Definition at line 158 of file cstream.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cstream.h
  • Dataaccess/oledb/rowsetviewer/cstream.cpp
Generated on Wed Nov 13 2024 16:57:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CStorageResource Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CStorageResource Class Reference

#include "CStorageResource.h"

Inherits IWMIServices, IWMIObject, IStorageProperties, and CMgdClusCfgInit.

List of all members.

Public Member Functions

CStorageResource (void)
virtual | ~CStorageResource (void)
STDMETHOD() | CanBeManaged (void)
STDMETHOD() | Cleanup (EClusCfgCleanupReason cccrReasonIn)
STDMETHOD() | Clone (IEnumClusCfgPartitions **ppEnumClusCfgPartitionsOut)
STDMETHOD() | Count (DWORD *pnCountOut)
STDMETHOD() | Create (IUnknown *punkServicesIn)
STDMETHOD() | Evict (IUnknown *punkServicesIn)
STDMETHOD() | GetDriveLetterMappings (SDriveLetterMapping *pdlmDriveLetterMappingsOut)
STDMETHOD() | GetName (BSTR *pbstrNameOut)
STDMETHOD() | GetResourcePrivateData (BYTE *pbBufferOut, DWORD *pcbBufferInout)
STDMETHOD() | GetUID (BSTR *pbstrUIDOut)
STDMETHOD() | HrGetDeviceID (BSTR *pbstrDeviceIDOut)
STDMETHOD() | HrGetDeviceIndex (DWORD *pidxDeviceOut)
STDMETHOD() | HrGetDiskNames (BSTR *pbstrDiskNameOut, BSTR *pbstrDeviceNameOut)
STDMETHOD() | HrGetSCSIBus (ULONG *pulSCSIBusOut)
STDMETHOD() | HrGetSCSIPort (ULONG *pulSCSIPortOut)
STDMETHOD() | HrGetSignature (DWORD *pdwSignatureOut)
STDMETHOD() | HrIsDynamicDisk (void)
STDMETHOD() | HrIsGPTDisk (void)
STDMETHOD() | HrSetFriendlyName (LPCWSTR pcszFriendlyNameIn)
STDMETHOD() | IsManaged (void)
STDMETHOD() | IsManagedByDefault (void)
STDMETHOD() | IsMultiNodeCapable (void)
STDMETHOD() | IsQuorumCapable (void)
STDMETHOD() | IsQuorumResource (void)
STDMETHOD() | IsThisLogicalDisk (WCHAR cLogicalDiskIn)
STDMETHOD() | Next (ULONG cNumberRequestedIn, IClusCfgPartitionInfo **rgpPartitionInfoOut, ULONG *pcNumberFetchedOut)
STDMETHOD() | PostCreate (IUnknown *punkServicesIn)
STDMETHOD() | PreCreate (IUnknown *punkServicesIn)
STDMETHOD() | PrepareToHostQuorumResource (void)
STDMETHOD() | Reset (void)
STDMETHOD() | SetDriveLetterMappings (SDriveLetterMapping dlmDriveLetterMappingsIn)
STDMETHOD() | SetManaged (BOOL fIsManagedIn)
STDMETHOD() | SetManagedByDefault (BOOL fIsManagedByDefaultIn)
STDMETHOD() | SetMultiNodeCapable (BOOL fMultiNodeCapableIn)
STDMETHOD() | SetName (LPCWSTR pwszNameIn)
STDMETHOD() | SetQuorumCapable (BOOL fIsQuorumCapableIn)
STDMETHOD() | SetQuorumResource (BOOL fIsQuorumDeviceIn)
STDMETHOD() | SetResourcePrivateData (const BYTE *pcbBufferIn, DWORD cbBufferIn)
STDMETHOD() | SetWbemObject (IWbemClassObject *pDiskIn, BOOL *pfRetainObjectOut)
STDMETHOD() | SetWbemServices (IWbemServices *pIWbemServicesIn)
STDMETHOD() | Skip (ULONG cNumberToSkipIn)

Private Member Functions

CStorageResource (const CStorageResource &rSrcIn)
HRESULT | HrAddPartitionToArray (IUnknown *punkIn)
HRESULT | HrCreateFriendlyName (void)
HRESULT | HrCreateFriendlyName (BSTR bstrNameIn)
HRESULT | HrCreatePartitionInfo (IWbemClassObject *pPartitionIn)
HRESULT | HrGetPartitionInfo (IWbemClassObject *pDiskIn, BOOL *pfRetainObjectOut)
HRESULT | HrIsClusterCapable (void)
HRESULT | HrIsPartitionGPT (IWbemClassObject *pPartitionIn)
HRESULT | HrIsPartitionLDM (IWbemClassObject *pPartitionIn)
const CStorageResource & | operator= (const CStorageResource &rSrcIn)

Private Attributes

BSTR | m_bstrDescription
BSTR | m_bstrDeviceID
BSTR | m_bstrFriendlyName
BSTR | m_bstrName
DWORD m_cPartitions
DWORD m_dwSignature
BOOL m_fIsDynamicDisk
BOOL m_fIsGPTDisk
BOOL m_fIsManaged
BOOL m_fIsManagedByDefault
BOOL m_fIsMultiNodeCapable
BOOL m_fIsQuorumCapable
BOOL m_fIsQuorumResource
DWORD m_idxDevice
DWORD m_idxEnumPartitionNext
DWORD m_idxNextPartition
IWbemServices * | m_pIWbemServices
IUnknown *(* | m_prgPartitions )[]
ULONG m_ulSCSIBus
ULONG m_ulSCSILun
ULONG m_ulSCSIPort
ULONG m_ulSCSITid

Detailed Description

Definition at line 61 of file CStorageResource.h.

Constructor & Destructor Documentation

CStorageResource::CStorageResource ( void )

Definition at line 56 of file CStorageResource.cpp.

{
    m_bstrName = NULL;
    m_bstrDescription = NULL;
    m_bstrFriendlyName = NULL;
    m_bstrDeviceID = NULL;

    m_fIsQuorumCapable = FALSE;
    m_fIsQuorumResource = FALSE;
    m_fIsMultiNodeCapable = FALSE;
    m_fIsManaged = FALSE;
    m_fIsManagedByDefault = FALSE;
    m_fIsDynamicDisk = FALSE;
    m_fIsGPTDisk = FALSE;

    m_ulSCSIBus = 0;
    m_ulSCSITid = 0;
    m_ulSCSIPort = 0;
    m_ulSCSILun = 0;

    m_idxDevice = 0;
    m_idxNextPartition = 0;
    m_idxEnumPartitionNext = 0;
    m_cPartitions = 0;
    m_dwSignature = 0;

    m_pIWbemServices = NULL;
    m_prgPartitions = NULL;

} //*** CStorageResource::CStorageResource

CStorageResource::~CStorageResource ( void ) [virtual]

Definition at line 105 of file CStorageResource.cpp.

{
    ULONG   idx = 0;

    SysFreeString( m_bstrName );
    SysFreeString( m_bstrDeviceID );
    SysFreeString( m_bstrDescription );
    SysFreeString( m_bstrFriendlyName );

    for ( idx = 0; idx < m_idxNextPartition; idx++ )
    {
        ((*m_prgPartitions)[ idx ])->Release();
    } // for:

    HeapFree( GetProcessHeap(), 0, m_prgPartitions );

    if ( m_pIWbemServices != NULL )
    {
        m_pIWbemServices->Release();
    } // if:

} //*** CStorageResource::~CStorageResource

CStorageResource::CStorageResource ( const CStorageResource & rSrcIn ) [private]

Member Function Documentation

STDMETHODIMP CStorageResource::CanBeManaged ( void )

Definition at line 2268 of file CStorageResource.cpp.

{
    HRESULT                         hr = S_OK;
    ULONG                           idx;
    IPartitionProperties *          pipp = NULL;

    //
    //  Turn off the manageable state because this disk may already be managed by
    //  another node, or it may be RAW.
    //

    m_fIsManagedByDefault = FALSE;

    //
    //  A disk must have at least one NTFS partition in order to be a quorum
    //  resource.
    //

    m_fIsQuorumCapable = FALSE;
    m_fIsMultiNodeCapable = FALSE;

    //
    //  If this disk has no partitions then it may already be managed by
    //  another node, or it may be RAW.
    //

    if ( m_idxNextPartition == 0 )
    {
        hr = S_FALSE;
        goto Cleanup;
    } // if:

    //
    //  Enum the partitions and set the quorum capable flag if an NTFS
    //  partition is found.
    //

    for ( idx = 0; idx < m_idxNextPartition; idx++ )
    {
        hr = ( ((*m_prgPartitions)[ idx ])->TypeSafeQI( IPartitionProperties, &pipp ) );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:

        hr = pipp->HrIsNTFS();
        if ( hr == S_OK )
        {
            m_fIsQuorumCapable = TRUE;
            m_fIsMultiNodeCapable = TRUE;
            m_fIsManagedByDefault = TRUE;
            break;
        } // if:

        pipp->Release();
        pipp = NULL;
    } // for:

Cleanup:

    LOG_STATUS_REPORT_STRING3(
          L"%1!ws! resource '%2!ws!' %3!ws! quorum capable."
        , GetResTypeName()
        , ( ( m_bstrFriendlyName != NULL ) ? m_bstrFriendlyName : m_bstrName )
        , ( ( m_fIsQuorumCapable == TRUE ) ? L"is" : L"is NOT" )
        , hr
        );

    if ( FAILED( hr ) )
    {
        LOG_STATUS_REPORT( L"CStorageResource::CanBeManaged failed.", hr );
    } // if:

    if ( pipp != NULL )
    {
        pipp->Release();
    } // if:

    return hr;

} //*** CStorageResource::CanBeManaged

STDMETHODIMP CStorageResource::Cleanup ( EClusCfgCleanupReason cccrReasonIn )

Definition at line 867 of file CStorageResource.cpp.

{
    HRESULT hr = S_OK;

    UNREFERENCED_PARAMETER( cccrReasonIn );

    return hr;

} //*** CStorageResource::Cleanup

STDMETHODIMP CStorageResource::Clone ( IEnumClusCfgPartitions ** ppEnumClusCfgPartitionsOut )

Definition at line 1804 of file CStorageResource.cpp.

{
    HRESULT hr = S_OK;

    if ( ppEnumClusCfgPartitionsOut == NULL )
    {
        hr = E_POINTER;
        STATUS_REPORT_REF(
                  TASKID_Major_Find_Devices
                , TASKID_Minor_Clone_StorageResource
                , IDS_ERROR_NULL_POINTER
                , IDS_ERROR_NULL_POINTER_REF
                , hr
                );
        goto Cleanup;
    } // if:

    hr = E_NOTIMPL;

Cleanup:

    return hr;

} //*** CStorageResource::Clone

STDMETHODIMP CStorageResource::Count ( DWORD * pnCountOut )

Definition at line 1855 of file CStorageResource.cpp.

{
    HRESULT hr = S_OK;

    if ( pnCountOut == NULL )
    {
        hr = E_POINTER;
        goto Cleanup;
    } // if:

    *pnCountOut = m_cPartitions;

Cleanup:

    return hr;

} //*** CStorageResource::Count

STDMETHODIMP CStorageResource::Create ( IUnknown * punkServicesIn )

Definition at line 993 of file CStorageResource.cpp.

{
    HRESULT hr = S_OK;
    IClusCfgResourceCreate *    piccrc = NULL;
    BSTR *                      pbstrName = m_bstrFriendlyName != NULL ? &m_bstrFriendlyName : &m_bstrName;
    CClusPropList               cpl;
    BSTR                        bstrDescription = NULL;

    //
    // TODO: Add any code here to set default values for resource private
    // data.
    //

    hr = punkServicesIn->TypeSafeQI( IClusCfgResourceCreate, &piccrc );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    if ( m_dwSignature != 0 )
    {
        //
        // Set the private signature property on the resource.
        //

        LOG_STATUS_REPORT_STRING2(
                  L"Setting signature to '%1!u!' on resource '%2!ws!'."
                , m_dwSignature
                , *pbstrName
                , hr
                );
        hr = piccrc->SetPropertyDWORD( L"Signature", m_dwSignature );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:
    } // if:

    //
    // Set the description to indicate that this is the code that created the resource.
    //

    hr = HrFormatStringIntoBSTR(
              IDS_RESOURCE_DESCRIPTION
            , &bstrDescription
            , L"MyStorageResource.dll"
            );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    cpl.ScAddProp( L"Description", bstrDescription, NULL );
    LOG_STATUS_REPORT_STRING2(
              L"Setting description '%1!ws!' on resource '%2!ws!'."
            , bstrDescription
            , *pbstrName
            , hr
            );
    hr = piccrc->SendResourceControl(
              CLUSCTL_RESOURCE_SET_COMMON_PROPERTIES
            , cpl.Plist()
            , cpl.CbPropList()
            );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

Cleanup:

    STATUS_REPORT_STRING2(
              TASKID_Major_Configure_Resources
            , TASKID_Minor_StorageResource_Create
            , IDS_INFO_DISK_CREATE
            , GetDisplayName()
            , *pbstrName
            , hr
            );

    SysFreeString( bstrDescription );

    if ( piccrc != NULL )
    {
        piccrc->Release();
    } // if:

    return hr;

} //*** CStorageResource::Create

STDMETHODIMP CStorageResource::Evict ( IUnknown * punkServicesIn )

Definition at line 1146 of file CStorageResource.cpp.

{
    HRESULT hr = S_OK;

    //
    // TODO: Add any code here that might be necessary on evicting a node
    // from a cluster.
    //
    UNREFERENCED_PARAMETER( punkServicesIn );

    return hr;

} //*** CStorageResource::Evict

STDMETHODIMP CStorageResource::GetDriveLetterMappings ( SDriveLetterMapping * pdlmDriveLetterMappingsOut )

Definition at line 151 of file CStorageResource.cpp.

{
    HRESULT                 hr = S_FALSE;
    IClusCfgPartitionInfo * piccpi = NULL;
    ULONG                   idx;

    if ( pdlmDriveLetterMappingsOut == NULL )
    {
        hr = E_POINTER;
        STATUS_REPORT_REF(
                  TASKID_Major_Find_Devices
                , TASKID_Minor_GetDriveLetterMappings_StorageResource
                , IDS_ERROR_NULL_POINTER
                , IDS_ERROR_NULL_POINTER_REF
                , hr
                );
        goto Cleanup;
    } // if:

    for ( idx = 0; idx < m_idxNextPartition; idx++ )
    {
        hr = ( ((*m_prgPartitions)[ idx ])->TypeSafeQI( IClusCfgPartitionInfo, &piccpi ) );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:

        hr = piccpi->GetDriveLetterMappings( pdlmDriveLetterMappingsOut );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:

        piccpi->Release();
        piccpi = NULL;
    } // for:

Cleanup:

    if ( piccpi != NULL )
    {
        piccpi->Release();
    } // if:

    return hr;

} //*** CStorageResource::GetDriveLetterMappings

STDMETHODIMP CStorageResource::GetName ( BSTR * pbstrNameOut )

Definition at line 251 of file CStorageResource.cpp.

{
    HRESULT hr = S_OK;

    if ( pbstrNameOut == NULL )
    {
        hr = E_POINTER;
        STATUS_REPORT_REF(
                  TASKID_Major_Find_Devices
                , TASKID_Minor_GetName_Pointer
                , IDS_ERROR_NULL_POINTER
                , IDS_ERROR_NULL_POINTER_REF
                , hr
                );
        goto Cleanup;
    } // if:

    //
    //  Prefer the "friendly" name over the WMI name -- if we have it...
    //
    if ( m_bstrFriendlyName != NULL )
    {
        *pbstrNameOut = SysAllocString( m_bstrFriendlyName );
    } // if:
    else
    {
        LOG_STATUS_REPORT_STRING2(
                  L"There is not a \"friendly name\" for the %1!ws! resource '%2!ws!'."
                , GetResTypeName()
                , m_bstrName
                , hr
                );
        *pbstrNameOut = SysAllocString( m_bstrName );
    } // else:

    if (*pbstrNameOut == NULL )
    {
        hr = E_OUTOFMEMORY;
        STATUS_REPORT(
                  TASKID_Major_Find_Devices
                , TASKID_Minor_GetName_Memory
                , IDS_ERROR_OUTOFMEMORY
                , hr
                );
    } // if:

Cleanup:

    return hr;

} //*** CStorageResource::GetName

STDMETHODIMP CStorageResource::GetResourcePrivateData | ( | BYTE * | pbBufferOut,
 |  | DWORD * | pcbBufferInout
 | ) |  |

Definition at line 1202 of file CStorageResource.cpp.

{
    HRESULT hr = S_FALSE;

    pcbBufferInout = 0;
    UNREFERENCED_PARAMETER( pbBufferOut );

    return hr;

} //*** CStorageResource::GetResourcePrivateData

STDMETHODIMP CStorageResource::GetUID ( BSTR * pbstrUIDOut )

Definition at line 390 of file CStorageResource.cpp.

{
    HRESULT hr = S_OK;
    WCHAR   sz[ 256 ];

    if ( pbstrUIDOut == NULL )
    {
        hr = E_POINTER;
        STATUS_REPORT_REF(
                  TASKID_Major_Find_Devices
                , TASKID_Minor_StorageResource_GetUID_Pointer
                , IDS_ERROR_NULL_POINTER
                , IDS_ERROR_NULL_POINTER_REF
                , hr
                );
        goto Cleanup;
    } // if: incoming UID buffer was invalid (NULL)

    //
    // TODO: Retrieve the unique ID for this resource. If this same resource
    //       is going to be detected on other nodes of the cluster make sure
    //       that each of those resources have the same UID, otherwise a new
    //       resource will be generated for each UID.
    //

    hr = StringCchPrintfW(
              sz
            , RTL_NUMBER_OF( sz )
            , L"%s SCSI Tid %ld, SCSI Lun %ld"
            , GetDisplayName()
            , m_ulSCSITid
            , m_ulSCSILun
            );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    *pbstrUIDOut = SysAllocString( sz );
    if ( *pbstrUIDOut == NULL )
    {
        hr = E_OUTOFMEMORY;
        STATUS_REPORT(
                  TASKID_Major_Find_Devices
                , TASKID_Minor_StorageResource_GetUID_Memory
                , IDS_ERROR_OUTOFMEMORY
                , hr
                );
    } // if:

Cleanup:

    return hr;

} //*** CStorageResource::GetUID

HRESULT CStorageResource::HrAddPartitionToArray ( IUnknown * punkIn ) [private]

Definition at line 2850 of file CStorageResource.cpp.

{
    HRESULT     hr = S_OK;
    IUnknown *  ((*prgpunks)[]) = NULL;

    prgpunks = (IUnknown *((*)[])) HEAPREALLOC(
                      m_prgPartitions
                    , sizeof( IUnknown * ) * ( m_idxNextPartition + 1 )
                    , HEAP_ZERO_MEMORY
                    );
    if ( prgpunks == NULL )
    {
        hr = E_OUTOFMEMORY;
        STATUS_REPORT(
                  TASKID_Major_Find_Devices
                , TASKID_Minor_HrAddPartitionToArray
                , IDS_ERROR_OUTOFMEMORY
                , hr
                );
        goto Cleanup;
    } // if:

    m_prgPartitions = prgpunks;

    (*m_prgPartitions)[ m_idxNextPartition++ ] = punkIn;
    punkIn->AddRef();
    m_cPartitions += 1;

Cleanup:

    return hr;

} //*** CStorageResource::HrAddPartitionToArray

HRESULT CStorageResource::HrCreateFriendlyName ( BSTR bstrNameIn ) [private]

Definition at line 3078 of file CStorageResource.cpp.

{
    HRESULT hr = S_OK;
    WCHAR * pwsz = NULL;
    BSTR    bstr = NULL;

    //
    //  Disk names in WMI start with "\\.\".  As a better and easy
    //  friendly name I am just going to trim these leading chars
    //  off.
    //
    pwsz = bstrNameIn + wcslen( L"\\\\.\\" );

    bstr = SysAllocString( pwsz );
    if ( bstr == NULL )
    {
        hr =  E_OUTOFMEMORY;
        STATUS_REPORT(
                  TASKID_Major_Find_Devices
                , TASKID_Minor_HrCreateFriendlyName_BSTR
                , IDS_ERROR_OUTOFMEMORY
                , hr
                );
        goto Cleanup;
    } // if:

    SysFreeString( m_bstrName );
    m_bstrName = bstr;

Cleanup:

    return hr;

} //*** CStorageResource::HrCreateFriendlyName

HRESULT CStorageResource::HrCreateFriendlyName ( void ) [private]

Definition at line 2914 of file CStorageResource.cpp.

{
    HRESULT                         hr = S_FALSE;
    WCHAR *                         pwsz = NULL;
    WCHAR *                         pwszTmp = NULL;
    DWORD                           cch;
    DWORD                           idx;
    IPartitionProperties *          pipp = NULL;
    BSTR                            bstrName = NULL;
    BOOL                            fFoundLogicalDisk = FALSE;
    BSTR                            bstr = NULL;
    BSTR                            bstrDisk = NULL;

    if ( m_idxNextPartition == 0 )
    {
        goto Cleanup;
    } // if:

    hr = HrLoadStringIntoBSTR( IDS_DISK, &bstrDisk );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    cch = (UINT) wcslen( bstrDisk ) + 1;

    pwsz = new WCHAR[ cch ];
    if ( pwsz == NULL )
    {
        goto OutOfMemory;
    } // if:

    hr = StringCchCopyW( pwsz, cch, bstrDisk );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    for ( idx = 0; idx < m_idxNextPartition; idx++ )
    {
        hr = ((*m_prgPartitions)[ idx ])->TypeSafeQI( IPartitionProperties, &pipp );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:

        hr = pipp->HrGetFriendlyName( &bstrName );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:

        if ( hr == S_FALSE )
        {
            continue;
        } // if:

        fFoundLogicalDisk = TRUE;

        cch += (UINT) wcslen( bstrName ) + 1;

        pwszTmp = new WCHAR[ cch ];
        if ( pwszTmp == NULL )
        {
            goto OutOfMemory;
        } // if:

        hr = StringCchCopyW( pwszTmp, cch, pwsz );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:

        delete [] pwsz;

        pwsz = pwszTmp;
        pwszTmp = NULL;

        hr = StringCchCatW( pwsz, cch, bstrName );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:

        SysFreeString( bstrName );
        bstrName = NULL;

        pipp->Release();
        pipp = NULL;
    } // for:

    if ( !fFoundLogicalDisk )
    {
        // Ensure that that the caller doesn't fail since this is not a fatal error.
        hr = S_OK;
        goto Cleanup;
    } // if:

    bstr = SysAllocString( pwsz );
    if ( bstr == NULL )
    {
        goto OutOfMemory;
    } // if:

    SysFreeString( m_bstrFriendlyName );
    m_bstrFriendlyName = bstr;
    bstr = NULL;

    goto Cleanup;

OutOfMemory:

    hr = E_OUTOFMEMORY;
    STATUS_REPORT(
              TASKID_Major_Find_Devices
            , TASKID_Minor_HrCreateFriendlyName_VOID
            , IDS_ERROR_OUTOFMEMORY
            , hr
            );

Cleanup:

    if ( pipp != NULL )
    {
        pipp->Release();
    } // if:

    delete [] pwsz;
    delete [] pwszTmp;

    SysFreeString( bstrName );
    SysFreeString( bstrDisk );
    SysFreeString( bstr );

    return hr;

} //*** CStorageResource::HrCreateFriendlyName

HRESULT CStorageResource::HrCreatePartitionInfo ( IWbemClassObject * pPartitionIn ) [private]

Definition at line 2738 of file CStorageResource.cpp.

{
    assert( m_bstrDeviceID != NULL );

    HRESULT                     hr = S_OK;
    IUnknown *                  punk = NULL;
    IWMIObject *                pimswo = NULL;
    IPartitionProperties *      pipp = NULL;
    BOOL                        fRetainObject = TRUE;

    hr = CoCreateInstance(
              CLSID_CPartitionInfo
            , NULL
            , CLSCTX_INPROC_SERVER
            , IID_IUnknown
            , reinterpret_cast< void ** >( &punk )
            );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    hr = punk->TypeSafeQI( IPartitionProperties, &pipp );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    hr = pipp->HrSetDeviceID( m_bstrDeviceID );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    hr = HrSetInitialize( punk, GetCallback(), GetLCID() );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    hr = HrSetWbemServices( punk, m_pIWbemServices );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    hr = punk->TypeSafeQI( IWMIObject, &pimswo );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    hr = pimswo->SetWbemObject( pPartitionIn, &fRetainObject );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    if ( fRetainObject )
    {
        hr = HrAddPartitionToArray( punk );
    } // if:

Cleanup:

    if ( pipp != NULL )
    {
        pipp->Release();
    } // if:

    if ( pimswo != NULL )
    {
        pimswo->Release();
    } // if:

    if ( punk != NULL )
    {
        punk->Release();
    } // if:

    return hr;

} //*** CStorageResource::HrCreatePartitionInfo

STDMETHODIMP CStorageResource::HrGetDeviceID ( BSTR * pbstrDeviceIDOut )

Definition at line 2056 of file CStorageResource.cpp.

{
    assert( m_bstrDeviceID != NULL );

    HRESULT hr = S_OK;

    if ( pbstrDeviceIDOut == NULL )
    {
        hr = E_POINTER;
        STATUS_REPORT_REF(
                  TASKID_Major_Find_Devices
                , TASKID_Minor_HrGetDeviceID_Pointer
                , IDS_ERROR_NULL_POINTER
                , IDS_ERROR_NULL_POINTER_REF
                , hr
                );
        goto Cleanup;
    } // if:

    *pbstrDeviceIDOut = SysAllocString( m_bstrDeviceID );
    if ( *pbstrDeviceIDOut == NULL )
    {
        hr = E_OUTOFMEMORY;
        STATUS_REPORT_REF(
                  TASKID_Major_Find_Devices
                , TASKID_Minor_HrGetDeviceID_Memory
                , IDS_ERROR_OUTOFMEMORY
                , IDS_ERROR_OUTOFMEMORY_REF
                , hr
                );
    } // if:

Cleanup:

    return hr;

} //*** CStorageResource::HrGetDeviceID

STDMETHODIMP CStorageResource::HrGetDeviceIndex ( DWORD * pidxDeviceOut )

Definition at line 2223 of file CStorageResource.cpp.

{
    HRESULT hr = S_OK;

    if ( pidxDeviceOut == NULL )
    {
        hr = E_POINTER;
        goto Cleanup;
    } // if:

    *pidxDeviceOut = m_idxDevice;

Cleanup:

    return hr;

} //*** CStorageResource::HrGetDeviceIndex

STDMETHODIMP CStorageResource::HrGetDiskNames | ( | BSTR * | pbstrDiskNameOut,
 |  | BSTR * | pbstrDeviceNameOut
 | ) |  |

Definition at line 2447 of file CStorageResource.cpp.

{
    assert( m_bstrName != NULL );
    assert( m_bstrFriendlyName != NULL );

    assert( pbstrDiskNameOut != NULL );
    assert( pbstrDeviceNameOut != NULL );

    HRESULT hr = S_OK;
    BSTR    bstr = NULL;

    if ( ( pbstrDiskNameOut == NULL ) || ( pbstrDeviceNameOut == NULL ) )
    {
        hr = E_POINTER;
        goto Cleanup;
    } // if:

    bstr = SysAllocString( m_bstrFriendlyName );
    if ( bstr == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if:

    *pbstrDiskNameOut = bstr;
    bstr = NULL;

    bstr = SysAllocString( m_bstrName );
    if ( bstr == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if:

    *pbstrDeviceNameOut = bstr;
    bstr = NULL;

Cleanup:

    SysFreeString( bstr );

    return hr;

} //*** CStorageResource::HrGetDiskNames

HRESULT CStorageResource::HrGetPartitionInfo | ( | IWbemClassObject * | pDiskIn,
 |  | BOOL * | pfRetainObjectOut |
 | ) |  |  | [private]

Definition at line 2516 of file CStorageResource.cpp.

{
    assert( pDiskIn != NULL );
    assert( pfRetainObjectOut != NULL );

    HRESULT                 hr;
    VARIANT                 var;
    VARIANT                 varDiskName;
    WCHAR                   szBuf[ 256 ];
    IEnumWbemClassObject *  pPartitions = NULL;
    IWbemClassObject *      pPartition = NULL;
    ULONG                   ulReturned;
    BSTR                    bstrQuery = NULL;
    BSTR                    bstrWQL = NULL;
    DWORD                   cPartitions;

    UNREFERENCED_PARAMETER( pfRetainObjectOut );

    bstrWQL = SysAllocString( L"WQL" );
    if ( bstrWQL == NULL )
    {
        hr = E_OUTOFMEMORY;
        STATUS_REPORT(
                  TASKID_Major_Find_Devices
                , TASKID_Minor_HrGetPartitionInfo
                , IDS_ERROR_OUTOFMEMORY
                , hr
                );
        goto Cleanup;
    } // if:

    VariantInit( &var );
    VariantInit( &varDiskName );

    //
    //  Need to enum the partition(s) of this disk to determine if it is booted
    //  bootable.
    //
    hr = HrGetWMIProperty( pDiskIn, L"DeviceID", VT_BSTR, &var );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    hr = StringCchPrintfW(
                  szBuf
                , RTL_NUMBER_OF( szBuf )
                , L"Associators of {Win32_DiskDrive.DeviceID='%ws'} where AssocClass=Win32_DiskDriveToDiskPartition"
                , var.bstrVal
                );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    bstrQuery = SysAllocString( szBuf );
    if ( bstrQuery == NULL )
    {
        hr = E_OUTOFMEMORY;
        STATUS_REPORT(
                  TASKID_Major_Find_Devices
                , TASKID_Minor_HrGetPartitionInfo
                , IDS_ERROR_OUTOFMEMORY
                , hr
                );
        goto Cleanup;
    } // if:

    hr = m_pIWbemServices->ExecQuery(
              bstrWQL
            , bstrQuery
            , WBEM_FLAG_FORWARD_ONLY
            , NULL
            , &pPartitions
            );
    if ( FAILED( hr ) )
    {
        STATUS_REPORT_STRING_REF(
                TASKID_Major_Find_Devices
                , TASKID_Minor_WMI_DiskDrivePartitions_Qry_Failed
                , IDS_ERROR_WMI_DISKDRIVEPARTITIONS_QRY_FAILED
                , var.bstrVal
                , IDS_ERROR_WMI_DISKDRIVEPARTITIONS_QRY_FAILED_REF
                , hr
                );
        goto Cleanup;
    } // if:

    for ( cPartitions = 0; ; cPartitions++ )
    {
        hr = pPartitions->Next( WBEM_INFINITE, 1, &pPartition, &ulReturned );
        if ( ( hr == S_OK ) && ( ulReturned == 1 ) )
        {

            hr = HrIsPartitionLDM( pPartition );
            if ( FAILED( hr ) )
            {
                goto Cleanup;
            } // if:

            //
            //  If the partition is logical disk manager (LDM)  then
            //  we cannot accept this disk therefore cannot manage it.
            //

            if ( hr == S_OK )
            {
                m_fIsDynamicDisk = TRUE;
            } // if:

            hr = HrIsPartitionGPT( pPartition );
            if ( FAILED( hr ) )
            {
                goto Cleanup;
            } // if:

            if ( hr == S_OK )
            {
                m_fIsGPTDisk = TRUE;
            } // if:

            hr = HrCreatePartitionInfo( pPartition );
            if ( FAILED( hr ) )
            {
                goto Cleanup;
            } // if:

            pPartition->Release();
            pPartition = NULL;
        } // if:
        else if ( ( hr == S_FALSE ) && ( ulReturned == 0 ) )
        {
            break;
        } // else if:
        else
        {
            STATUS_REPORT_STRING_REF(
                      TASKID_Major_Find_Devices
                    , TASKID_Minor_WQL_Partition_Qry_Next_Failed
                    , IDS_ERROR_WQL_QRY_NEXT_FAILED
                    , bstrQuery
                    , IDS_ERROR_WQL_QRY_NEXT_FAILED_REF
                    , hr
                    );
            goto Cleanup;
        } // else:
    } // for:

    //
    //  The enumerator can be empty because we cannot read the partition info from
    //  clustered disks.  If the enumerator was empty retain the S_FALSE, otherwise
    //  return S_OK if count is greater than 0.
    //

    if ( cPartitions > 0 )
    {
        hr = S_OK;
    } // if:
    else
    {
        LOG_STATUS_REPORT_STRING2(
                  L"The %1!ws! resource '%2!ws!' does not have any partitions and will not be managed."
                , GetResTypeName()
                , var.bstrVal
                , hr
                );
        m_fIsManagedByDefault = FALSE;
    } // else:

Cleanup:

    VariantClear( &var );
    VariantClear( &varDiskName );

    SysFreeString( bstrQuery );
    SysFreeString( bstrWQL );

    if ( pPartition != NULL )
    {
        pPartition->Release();
    } // if:

    if ( pPartitions != NULL )
    {
        pPartitions->Release();
    } // if:

    return hr;

} //*** CStorageResource::HrGetPartitionInfo

STDMETHODIMP CStorageResource::HrGetSCSIBus ( ULONG * pulSCSIBusOut )

Definition at line 1962 of file CStorageResource.cpp.

{
    HRESULT hr = S_OK;

    if ( pulSCSIBusOut == NULL )
    {
        hr = E_POINTER;
        STATUS_REPORT_REF(
                  TASKID_Major_Find_Devices
                , TASKID_Minor_HrGetSCSIBus
                , IDS_ERROR_NULL_POINTER
                , IDS_ERROR_NULL_POINTER_REF
                , hr
                );
        goto Cleanup;
    } // if:

    *pulSCSIBusOut = m_ulSCSIBus;

Cleanup:

    return hr;

} //*** CStorageResource::HrGetSCSIBus

STDMETHODIMP CStorageResource::HrGetSCSIPort ( ULONG * pulSCSIPortOut )

Definition at line 2009 of file CStorageResource.cpp.

{
    HRESULT hr = S_OK;

    if ( pulSCSIPortOut == NULL )
    {
        hr = E_POINTER;
        STATUS_REPORT_REF(
                  TASKID_Major_Find_Devices
                , TASKID_Minor_HrGetSCSIPort
                , IDS_ERROR_NULL_POINTER
                , IDS_ERROR_NULL_POINTER_REF
                , hr
                );
        goto Cleanup;
    } // if:

    *pulSCSIPortOut = m_ulSCSIPort;

Cleanup:

    return hr;

} //*** CStorageResource::HrGetSCSIPort

STDMETHODIMP CStorageResource::HrGetSignature ( DWORD * pdwSignatureOut )

Definition at line 2116 of file CStorageResource.cpp.

{
    assert( m_dwSignature != 0 );

    HRESULT hr = S_OK;

    if ( pdwSignatureOut == NULL )
    {
        hr = E_POINTER;
        STATUS_REPORT_REF(
                  TASKID_Major_Find_Devices
                , TASKID_Minor_HrGetSignature_Pointer
                , IDS_ERROR_NULL_POINTER
                , IDS_ERROR_NULL_POINTER_REF
                , hr
                );
        goto Cleanup;
    } // if:

    *pdwSignatureOut = m_dwSignature;

Cleanup:

    return hr;

} //*** CStorageResource::HrGetSignature

HRESULT CStorageResource::HrIsClusterCapable ( void ) [private]

Definition at line 3290 of file CStorageResource.cpp.

{
    //
    // TODO: Determine whether this disk is cluster-capable.  You may need to
    //       send an IOCTL to the disk/miniport to determine this.
    //

//
//  WARNING - this is clusdisk/physical disk specific from ddk\inc\scsi.h
//

#define FILE_DEVICE_SCSI 0x0000001b
#define IOCTL_SCSI_MINIPORT_NOT_QUORUM_CAPABLE     ( ( FILE_DEVICE_SCSI << 16 ) + 0x0520 )

    HRESULT         hr = S_FALSE;
    HANDLE          hSCSIPort = NULL;
    DWORD           dwSize;
    BOOL            fRet;
    WCHAR           szSCSIPort[ 32 ];
    SRB_IO_CONTROL  srb;

    hr = StringCchPrintfW(
              szSCSIPort
            , RTL_NUMBER_OF( szSCSIPort )
            , L"\\\\.\\Scsi%d:"
            , m_ulSCSIPort
            );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    //
    // get handle to disk
    //

    hSCSIPort = CreateFileW(
                          szSCSIPort
                        , GENERIC_READ | GENERIC_WRITE
                        , FILE_SHARE_READ | FILE_SHARE_WRITE
                        , NULL
                        , OPEN_EXISTING
                        , FILE_ATTRIBUTE_NORMAL
                        , NULL
                        );
    if ( hSCSIPort == INVALID_HANDLE_VALUE )
    {
        hr = HRESULT_FROM_WIN32( GetLastError() );
        LOG_STATUS_REPORT_STRING( L"Failed to open device %1!ws!.", szSCSIPort, hr );
        goto Cleanup;
    } // if:

#define CLUSDISK_SRB_SIGNATURE "CLUSDISK"

    ZeroMemory( &srb, sizeof( srb ) );

    srb.HeaderLength = sizeof( srb );

    assert( sizeof( srb.Signature ) <= sizeof( CLUSDISK_SRB_SIGNATURE ) );
    CopyMemory( srb.Signature, CLUSDISK_SRB_SIGNATURE, sizeof( srb.Signature ) );

    srb.ControlCode = IOCTL_SCSI_MINIPORT_NOT_QUORUM_CAPABLE;

    //
    // issue mini port ioctl to determine whether the disk is cluster capable
    //

    fRet = DeviceIoControl(
                          hSCSIPort
                        , IOCTL_SCSI_MINIPORT
                        , &srb
                        , sizeof( srb )
                        , NULL
                        , 0
                        , &dwSize
                        , NULL
                        );
    if ( !fRet )
    {
        hr = S_OK;
    } // if:

Cleanup:

    if ( FAILED( hr ) )
    {
        CLSID   clsidMinorId;
        HRESULT hrTemp;

        hrTemp = CoCreateGuid( &clsidMinorId );
        if ( FAILED( hrTemp ) )
        {
            LOG_STATUS_REPORT( L"Could not create a guid for a not cluster capable disk minor task ID", hrTemp );
            clsidMinorId = IID_NULL;
        } // if:

        STATUS_REPORT_STRING2_REF(
                  TASKID_Minor_StorageResource_Cluster_Capable
                , clsidMinorId
                , IDS_ERROR_DISK_CLUSTER_CAPABLE
                , m_bstrFriendlyName
                , m_ulSCSIPort
                , IDS_ERROR_DISK_CLUSTER_CAPABLE_REF
                , hr
                );
    } // if:

    if ( hSCSIPort != NULL )
    {
        CloseHandle( hSCSIPort );
    } // if:

    return hr;

} //*** CStorageResource::HrIsClusterCapable

STDMETHODIMP CStorageResource::HrIsDynamicDisk ( void )

Definition at line 2373 of file CStorageResource.cpp.

{
    HRESULT hr = S_OK;

    if ( m_fIsDynamicDisk == FALSE )
    {
        hr = S_FALSE;
    } // if:

    return hr;

} //*** CStorageResource::HrIsDynamicDisk

STDMETHODIMP CStorageResource::HrIsGPTDisk ( void )

Definition at line 2409 of file CStorageResource.cpp.

{
    HRESULT hr = S_OK;

    if ( m_fIsGPTDisk == FALSE )
    {
        hr = S_FALSE;
    } // if:

    return hr;

} //*** CStorageResource::HrIsGPTDisk

HRESULT CStorageResource::HrIsPartitionGPT ( IWbemClassObject * pPartitionIn ) [private]

Definition at line 3144 of file CStorageResource.cpp.

{
    HRESULT hr = S_OK;
    VARIANT var;
    WCHAR   szData[ 4 ];
    BSTR    bstrGPT = NULL;

    VariantInit( &var );

    hr = HrLoadStringIntoBSTR( IDS_GPT, &bstrGPT );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    hr = HrGetWMIProperty( pPartitionIn, L"Type", VT_BSTR, &var );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    //
    //  Get the fist three characters.  When the spindle has GPT partitions then
    //  these characters will be "GPT".  I am unsure if this will be localized.
    //

    hr = StringCchCopyNW( szData, RTL_NUMBER_OF( szData ), var.bstrVal, 3 );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    CharUpper( szData );

    if ( NStringCompareW( szData, RTL_NUMBER_OF( szData ), bstrGPT, SysStringLen( bstrGPT ) ) != 0 )
    {
        hr = S_FALSE;
    } // if:

Cleanup:

    VariantClear( &var );

    SysFreeString( bstrGPT );

    return hr;

} //*** CStorageResource::HrIsPartitionGPT

HRESULT CStorageResource::HrIsPartitionLDM ( IWbemClassObject * pPartitionIn ) [private]

Definition at line 3224 of file CStorageResource.cpp.

{
    HRESULT hr = S_OK;
    VARIANT var;
    BSTR    bstrLDM = NULL;

    VariantInit( &var );

    hr = HrLoadStringIntoBSTR( IDS_LDM, &bstrLDM );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    hr = HrGetWMIProperty( pPartitionIn, L"Type", VT_BSTR, &var );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    CharUpper( var.bstrVal );

    if ( NBSTRCompareW( var.bstrVal, bstrLDM ) != 0 )
    {
        hr = S_FALSE;
    } // if:

Cleanup:

    VariantClear( &var );

    SysFreeString( bstrLDM );

    return hr;

} //*** CStorageResource::HrIsPartitionLDM

STDMETHODIMP CStorageResource::HrSetFriendlyName ( LPCWSTR pcszFriendlyNameIn )

Definition at line 2163 of file CStorageResource.cpp.

{
    HRESULT hr = S_OK;
    BSTR    bstr = NULL;

    if ( pcszFriendlyNameIn == NULL )
    {
        hr = E_INVALIDARG;
        goto Cleanup;
    } // if:

    bstr = SysAllocString( pcszFriendlyNameIn );
    if ( bstr == NULL )
    {
        hr = E_OUTOFMEMORY;
        STATUS_REPORT(
                  TASKID_Major_Find_Devices
                , TASKID_Minor_HrSetFriendlyName_StorageResource
                , IDS_ERROR_OUTOFMEMORY
                , hr
                );
        goto Cleanup;
    } // if:

    SysFreeString( m_bstrFriendlyName );
    m_bstrFriendlyName = bstr;

    LOG_STATUS_REPORT_STRING2(
              L"Setting %1!ws! resource friendly name to '%2!ws!'."
            , GetResTypeName()
            , m_bstrFriendlyName
            , hr
            );

Cleanup:

    return hr;

} //*** CStorageResource::HrSetFriendlyName

STDMETHODIMP CStorageResource::IsManaged ( void )

Definition at line 467 of file CStorageResource.cpp.

{
    HRESULT hr = S_OK;

    if ( m_fIsManaged == FALSE )
    {
        hr = S_FALSE;
    } // if: this resource is not managed

    return hr;

} //*** CStorageResource::IsManaged

STDMETHODIMP CStorageResource::IsManagedByDefault ( void )

Definition at line 499 of file CStorageResource.cpp.

{
    HRESULT hr = S_OK;

    if ( m_fIsManagedByDefault == FALSE )
    {
        hr = S_FALSE;
    } // if: this resource is not managed by default

    return hr;

} //*** CStorageResource::IsManagedByDefault

STDMETHODIMP CStorageResource::IsMultiNodeCapable ( void )

Definition at line 760 of file CStorageResource.cpp.

{
    HRESULT hr = S_OK;

    if ( m_fIsMultiNodeCapable == FALSE )
    {
        hr = S_FALSE;
    } // if: this resource can be used by one node only

    return hr;

} //*** CStorageResource::IsMultiNodeCapable

STDMETHODIMP CStorageResource::IsQuorumCapable ( void )

Definition at line 606 of file CStorageResource.cpp.

{
    HRESULT hr = S_OK;

    if ( m_fIsQuorumCapable == FALSE )
    {
        hr = S_FALSE;
    } // if:

    return hr;

} //*** CStorageResource::IsQuorumCapable

STDMETHODIMP CStorageResource::IsQuorumResource ( void )

Definition at line 673 of file CStorageResource.cpp.

{
    HRESULT hr = S_FALSE;

    if ( m_fIsQuorumResource )
    {
        hr = S_OK;
    } // if:

    return hr;

} //*** CStorageResource::IsQuorumResource

STDMETHODIMP CStorageResource::IsThisLogicalDisk ( WCHAR cLogicalDiskIn )

Definition at line 1900 of file CStorageResource.cpp.

{
    HRESULT                         hr = S_FALSE;
    ULONG                           idx;
    IPartitionProperties *          pipp = NULL;

    for ( idx = 0; idx < m_idxNextPartition; idx++ )
    {
        hr = ( ((*m_prgPartitions)[ idx ])->TypeSafeQI( IPartitionProperties, &pipp ) );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:

        hr = pipp->HrIsThisLogicalDisk( cLogicalDiskIn );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:

        if ( hr == S_OK )
        {
            break;
        } // if:

        pipp->Release();
        pipp = NULL;
    } // for:

Cleanup:

    if ( pipp != NULL )
    {
        pipp->Release();
    } // if:

    return hr;

} //*** CStorageResource::IsThisLogicalDisk

STDMETHODIMP CStorageResource::Next | ( | ULONG | cNumberRequestedIn,
 |  | IClusCfgPartitionInfo ** | rgpPartitionInfoOut,
 |  | ULONG * | pcNumberFetchedOut
 | ) |  |

Definition at line 1626 of file CStorageResource.cpp.

{
    HRESULT                 hr = S_FALSE;
    ULONG                   cFetched = 0;
    ULONG                   idx;
    IClusCfgPartitionInfo * piccpi = NULL;

    if ( rgpPartitionInfoOut == NULL )
    {
        hr = E_POINTER;
        STATUS_REPORT_REF(
                  TASKID_Major_Find_Devices
                , TASKID_Minor_Next_StorageResource
                , IDS_ERROR_NULL_POINTER
                , IDS_ERROR_NULL_POINTER_REF
                , hr
                );
        goto Cleanup;
    } // if:

    if ( pcNumberFetchedOut != NULL )
    {
        *pcNumberFetchedOut = 0;
    } // if:

    if ( m_prgPartitions == NULL )
    {
        LOG_STATUS_REPORT_MINOR_STRING(
                  TASKID_Minor_StorageResource_No_Partitions
                , L"The %1!ws! resource type not have a partitions enumerator"
                , GetDisplayName()
                , hr
                );
        goto Cleanup;
    } // if:

    cFetched = min( cNumberRequestedIn, ( m_idxNextPartition - m_idxEnumPartitionNext ) );

    for ( idx = 0; idx < cFetched; idx++, m_idxEnumPartitionNext++ )
    {
        hr = ((*m_prgPartitions)[ m_idxEnumPartitionNext ])->TypeSafeQI( IClusCfgPartitionInfo, &piccpi );
        if ( FAILED( hr ) )
        {
            LOG_STATUS_REPORT( L"CStorageResource::Next() could not query for IClusCfgPartitionInfo.", hr );
            break;
        } // if:

        rgpPartitionInfoOut[ idx ] = piccpi;
    } // for:

    if ( FAILED( hr ) )
    {
        ULONG   idxStop = idx;

        m_idxEnumPartitionNext -= idx;

        for ( idx = 0; idx < idxStop; idx++ )
        {
            (rgpPartitionInfoOut[ idx ])->Release();
        } // for:

        cFetched = 0;
        goto Cleanup;
    } // if:

    if ( pcNumberFetchedOut != NULL )
    {
        *pcNumberFetchedOut = cFetched;
    } // if:

    if ( cFetched < cNumberRequestedIn )
    {
        hr = S_FALSE;
    } // if:

Cleanup:

    return hr;

} //*** CStorageResource::Next

const CStorageResource& CStorageResource::operator= ( const CStorageResource & rSrcIn ) [private]
STDMETHODIMP CStorageResource::PostCreate ( IUnknown * punkServicesIn )

Definition at line 1108 of file CStorageResource.cpp.

{
    HRESULT hr = S_OK;

    //
    // TODO: Add any code here for any post create actions that may be
    // necessary for the managed resource.
    //
    UNREFERENCED_PARAMETER( punkServicesIn );

    return hr;

} //*** CStorageResource::PostCreate

STDMETHODIMP CStorageResource::PreCreate ( IUnknown * punkServicesIn )

Definition at line 908 of file CStorageResource.cpp.

{
    HRESULT                     hr = S_OK;
    IClusCfgResourcePreCreate * piccrpc = NULL;
    BSTR                        bstr = m_bstrFriendlyName != NULL ? m_bstrFriendlyName : m_bstrName;
    CLSID                       CLSID_Restype = RESTYPE_StorageResource;

    //
    // First, query for the IClusCfgResourcePreCreate interface which will
    // provide all services that we need.
    //

    hr = punkServicesIn->TypeSafeQI( IClusCfgResourcePreCreate, &piccrpc );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    //
    // Then, set the resource type of this managed resource.
    //
    hr = piccrpc->SetType( &CLSID_Restype );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    hr = piccrpc->SetClassType( (LPCLSID) &RESCLASSTYPE_StorageDevice );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

#if 0 // test code only
    hr = piccrpc->SetDependency( (LPCLSID) &IID_NULL, dfSHARED );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:
#endif // test code only

Cleanup:

    if ( piccrpc != NULL )
    {
        piccrpc->Release();
        piccrpc = NULL;
    } // if:

    STATUS_REPORT_STRING2(
              TASKID_Major_Configure_Resources
            , TASKID_Minor_StorageResource_PreCreate
            , IDS_INFO_DISK_PRECREATE
            , GetDisplayName()
            , bstr
            , hr
            );

    return hr;

} //*** CStorageResource::PreCreate

STDMETHODIMP CStorageResource::PrepareToHostQuorumResource ( void )

Definition at line 833 of file CStorageResource.cpp.

{
    HRESULT hr = S_OK;

    return hr;

} //*** CStorageResource::PrepareToHostQuorumResource

STDMETHODIMP CStorageResource::Reset ( void )

Definition at line 1770 of file CStorageResource.cpp.

{
    HRESULT hr = S_OK;

    m_idxEnumPartitionNext = 0;

    return hr;

} //*** CStorageResource::Reset

STDMETHODIMP CStorageResource::SetDriveLetterMappings ( SDriveLetterMapping dlmDriveLetterMappingsIn )

Definition at line 219 of file CStorageResource.cpp.

{
    HRESULT hr = E_NOTIMPL;

    UNREFERENCED_PARAMETER( dlmDriveLetterMappingsIn );

    return hr;

} //*** CStorageResource::SetDriveLetterMappings

STDMETHODIMP CStorageResource::SetManaged ( BOOL fIsManagedIn )

Definition at line 530 of file CStorageResource.cpp.

{
    HRESULT hr = S_OK;

    m_fIsManaged = fIsManagedIn;

    LOG_STATUS_REPORT_STRING3(
                          L"%1!ws! resource '%2!ws!' '%3!ws!"
                        , GetResTypeName()
                        , ( m_bstrFriendlyName != NULL ) ? m_bstrFriendlyName : m_bstrName
                        , m_fIsManaged ? L"is managed" : L"is not managed"
                        , hr
                        );
    return hr;

} //*** CStorageResource::SetManaged

STDMETHODIMP CStorageResource::SetManagedByDefault ( BOOL fIsManagedByDefaultIn )

Definition at line 567 of file CStorageResource.cpp.

{
    HRESULT hr = S_OK;

    m_fIsManagedByDefault = fIsManagedByDefaultIn;

    LOG_STATUS_REPORT_STRING3(
                          L"%1!ws! resource '%2!ws!' '%3!ws!"
                        , GetResTypeName()
                        , ( m_bstrFriendlyName != NULL ) ? m_bstrFriendlyName : m_bstrName
                        , fIsManagedByDefaultIn ? L"is manageable" : L"is not manageable"
                        , hr
                        );

    return hr;

} //*** CStorageResource::SetManagedByDefault

STDMETHODIMP CStorageResource::SetMultiNodeCapable ( BOOL fMultiNodeCapableIn )

Definition at line 795 of file CStorageResource.cpp.

{
    HRESULT hr = S_FALSE;

    UNREFERENCED_PARAMETER( fMultiNodeCapableIn );

    return hr;

} //*** CStorageResource::SetMultiNodeCapable

STDMETHODIMP CStorageResource::SetName ( LPCWSTR pwszNameIn )

Definition at line 325 of file CStorageResource.cpp.

{
    HRESULT hr = S_OK;
    BSTR    bstr = NULL;

    if ( pwszNameIn == NULL )
    {
        hr = E_INVALIDARG;
        goto Cleanup;
    } // if:

    bstr = SysAllocString( pwszNameIn );
    if ( bstr == NULL )
    {
        hr = E_OUTOFMEMORY;
        STATUS_REPORT(
                  TASKID_Major_Find_Devices
                , TASKID_Minor_SetName_StorageResource
                , IDS_ERROR_OUTOFMEMORY
                , hr
                );
        goto Cleanup;
    } // if:

    SysFreeString( m_bstrName );
    m_bstrName = bstr;

    //
    // Since we got asked from the outside to set a new name, this should actually be reflected in
    // the friendly name, too, since that, ultimately, gets preference over the real name
    //
    hr = HrSetFriendlyName( pwszNameIn );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

Cleanup:

    return hr;

} //*** CStorageResource::SetName

STDMETHODIMP CStorageResource::SetQuorumCapable ( BOOL fIsQuorumCapableIn )

Definition at line 642 of file CStorageResource.cpp.

{
    HRESULT hr = S_OK;

    m_fIsQuorumCapable = fIsQuorumCapableIn;

    return hr;

} //*** CStorageResource::IsQuorumCapable

STDMETHODIMP CStorageResource::SetQuorumResource ( BOOL fIsQuorumDeviceIn )

Definition at line 710 of file CStorageResource.cpp.

{
    HRESULT hr = S_OK;

    //
    //  Since no accurate determination can be made about a disk's quorum capability
    //  when the node that it's on does not hold the SCSI reservation and have access
    //  to the media we must blindly accept the input given...
    //

    m_fIsQuorumResource = fIsQuorumResourceIn;

    LOG_STATUS_REPORT_STRING3(
                          L"Setting %1!ws! resource '%2!ws!' '%3!ws!' the quorum device."
                        , GetResTypeName()
                        , ( m_bstrFriendlyName != NULL ) ? m_bstrFriendlyName : m_bstrDeviceID
                        , m_fIsQuorumResource ? L"to be" : L"to not be"
                        , hr
                        );
    return hr;

} //*** CStorageResource::SetQuorumResource

STDMETHODIMP CStorageResource::SetResourcePrivateData | ( | const BYTE * | pcbBufferIn,
 |  | DWORD | cbBufferIn
 | ) |  |

Definition at line 1243 of file CStorageResource.cpp.

{
    HRESULT hr = S_OK;

    UNREFERENCED_PARAMETER( pcbBufferIn );
    UNREFERENCED_PARAMETER( cbBufferIn );

    return hr;

} //*** CStorageResource::SetResourcePrivateData

STDMETHODIMP CStorageResource::SetWbemObject | ( | IWbemClassObject * | pDiskIn,
 |  | BOOL * | pfRetainObjectOut
 | ) |  |

Definition at line 1340 of file CStorageResource.cpp.

{
    assert( pDiskIn != NULL );
    assert( pfRetainObjectOut != NULL );

    HRESULT hr = S_FALSE;
    VARIANT var;
    CLSID   clsidMinorId;

    m_fIsQuorumCapable = TRUE;
    m_fIsMultiNodeCapable = TRUE;

    VariantInit( &var );

    hr = HrGetWMIProperty( pDiskIn, L"Name", VT_BSTR, &var );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    hr = HrCreateFriendlyName( var.bstrVal );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    VariantClear( &var );

    hr = HrGetWMIProperty( pDiskIn, L"DeviceID", VT_BSTR, &var );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    m_bstrDeviceID = SysAllocString( var.bstrVal );
    if (m_bstrDeviceID == NULL )
    {
        goto OutOfMemory;
    } // if:

    VariantClear( &var );

    hr = HrGetWMIProperty( pDiskIn, L"Description", VT_BSTR, &var );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    m_bstrDescription = SysAllocString( var.bstrVal );
    if ( m_bstrDescription == NULL  )
    {
        goto OutOfMemory;
    } // if:

    VariantClear( &var );

    hr = HrGetWMIProperty( pDiskIn, L"SCSIBus", VT_I4, &var );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    m_ulSCSIBus = var.lVal;

    VariantClear( &var );

    hr = HrGetWMIProperty( pDiskIn, L"SCSITargetId", VT_I4, &var );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    m_ulSCSITid = var.lVal;

    VariantClear( &var );

    hr = HrGetWMIProperty( pDiskIn, L"SCSIPort", VT_I4, &var );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    m_ulSCSIPort = var.lVal;

    VariantClear( &var );

    hr = HrGetWMIProperty( pDiskIn, L"SCSILogicalUnit", VT_I4, &var );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    m_ulSCSILun = var.lVal;

    VariantClear( &var );

    hr = HrGetWMIProperty( pDiskIn, L"Index", VT_I4, &var );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    m_idxDevice = var.lVal;

    VariantClear( &var );

    hr = HrGetWMIProperty( pDiskIn, L"Signature", VT_I4, &var );
    if ( hr == WBEM_E_NOT_FOUND )
    {
        //
        //  If the signature is not found then log it and let everything continue.
        //

        LOG_STATUS_REPORT_STRING2(
                  L"%1!ws! resource '%2!ws!' does not have a signature property."
                , GetResTypeName()
                , m_bstrName
                , hr
                );
        var.lVal = 0L;
        hr = S_OK;
    } // if:

    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    //
    //  Did we actually get a value?  Could be VT_NULL to indicate that it is empty.
    //  We only want VT_I4 values...
    //

    if ( var.vt == VT_I4 )
    {
        m_dwSignature = (DWORD) var.lVal;
    } // else if:

    LOG_STATUS_REPORT_STRING3(
              L"%1!ws! resource '%2!ws!' has signature %3!x!."
            , GetResTypeName()
            , m_bstrName
            , m_dwSignature
            , hr
            );

    if ( FAILED( hr ) )
    {
        STATUS_REPORT_STRING2_REF(
                  TASKID_Major_Find_Devices
                , TASKID_Minor_StorageResource_Signature
                , IDS_ERROR_DISK_SIGNATURE
                , GetDisplayName()
                , m_bstrName
                , IDS_ERROR_DISK_SIGNATURE_REF
                , hr
                );
        goto Cleanup;
    } // if:

    VariantClear( &var );

    hr = HrGetPartitionInfo( pDiskIn, pfRetainObjectOut );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    //
    //  HrGetPartitionInfo() returns S_FALSE when it cannot get the partition info for a disk.
    //  This is usually caused by the disk already being under ClusDisk control.  This is not
    //  an error, it just means we cannot query the partition or logical drive info.
    //
    if ( hr == S_OK )
    {
        hr = HrCreateFriendlyName();
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:

        //
        //  Since we have partition info we also have a signature and need to see if this
        //  disk is cluster capable.

        hr = HrIsClusterCapable();
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:

        //
        //  If the disk is not cluster capable then we don't want the enumerator
        //  to keep it.
        //
        if ( hr == S_FALSE )
        {
            HRESULT hrTemp;

            STATUS_REPORT(
                      TASKID_Major_Find_Devices
                    , TASKID_Minor_StorageResource_Cluster_Capable
                    , IDS_INFO_DISK_CLUSTER_CAPABLE
                    , hr
                    );

            hrTemp = CoCreateGuid( &clsidMinorId );
            if ( FAILED( hrTemp ) )
            {
                LOG_STATUS_REPORT(
                          L"Could not create a guid for a not cluster capable disk minor task ID"
                        , hrTemp
                        );
                clsidMinorId = IID_NULL;
            } // if:

            *pfRetainObjectOut = FALSE;
            STATUS_REPORT_STRING_REF(
                      TASKID_Minor_StorageResource_Cluster_Capable
                    , clsidMinorId
                    , IDS_INFO_DISK_NOT_CLUSTER_CAPABLE
                    , m_bstrFriendlyName
                    , IDS_INFO_DISK_NOT_CLUSTER_CAPABLE_REF
                    , hr
                    );
            LOG_STATUS_REPORT_STRING2(
                      L"The %1!ws! resource '%2!ws!' is not cluster capable"
                    , GetResTypeName()
                    , m_bstrFriendlyName
                    , hr
                    );
        } // if:
    } // if:

    goto Cleanup;

OutOfMemory:

    hr = E_OUTOFMEMORY;
    STATUS_REPORT(
              TASKID_Major_Find_Devices
            , TASKID_Minor_SetWbemObject_StorageResource
            , IDS_ERROR_OUTOFMEMORY
            , hr
            );

Cleanup:

    VariantClear( &var );

    return hr;

} //*** CStorageResource::SetWbemObject

STDMETHODIMP CStorageResource::SetWbemServices ( IWbemServices * pIWbemServicesIn )

Definition at line 1287 of file CStorageResource.cpp.

{
    HRESULT hr = S_OK;

    if ( pIWbemServicesIn == NULL )
    {
        hr = E_POINTER;
        STATUS_REPORT(
                  TASKID_Major_Find_Devices
                , TASKID_Minor_SetWbemServices_StorageResource
                , IDS_ERROR_NULL_POINTER
                , hr
                );
        goto Cleanup;
    } // if:

    m_pIWbemServices = pIWbemServicesIn;
    m_pIWbemServices->AddRef();

Cleanup:

    return hr;

} //*** CStorageResource::SetWbemServices

STDMETHODIMP CStorageResource::Skip ( ULONG cNumberToSkipIn )

Definition at line 1732 of file CStorageResource.cpp.

{
    HRESULT hr = S_OK;

    m_idxEnumPartitionNext += cNumberToSkipIn;
    if ( m_idxEnumPartitionNext > m_idxNextPartition )
    {
        m_idxEnumPartitionNext = m_idxNextPartition;
        hr = S_FALSE;
    } // if:

    return hr;

} //*** CStorageResource::Skip

Member Data Documentation

BSTR CStorageResource::m_bstrDescription [private]

Definition at line 180 of file CStorageResource.h.

BSTR CStorageResource::m_bstrDeviceID [private]

Definition at line 182 of file CStorageResource.h.

BSTR CStorageResource::m_bstrFriendlyName [private]

Definition at line 181 of file CStorageResource.h.

BSTR CStorageResource::m_bstrName [private]

Definition at line 179 of file CStorageResource.h.

DWORD CStorageResource::m_cPartitions [private]

Definition at line 200 of file CStorageResource.h.

DWORD CStorageResource::m_dwSignature [private]

Definition at line 201 of file CStorageResource.h.

BOOL CStorageResource::m_fIsDynamicDisk [private]

Definition at line 189 of file CStorageResource.h.

BOOL CStorageResource::m_fIsGPTDisk [private]

Definition at line 190 of file CStorageResource.h.

BOOL CStorageResource::m_fIsManaged [private]

Definition at line 187 of file CStorageResource.h.

BOOL CStorageResource::m_fIsManagedByDefault [private]

Definition at line 188 of file CStorageResource.h.

BOOL CStorageResource::m_fIsMultiNodeCapable [private]

Definition at line 186 of file CStorageResource.h.

BOOL CStorageResource::m_fIsQuorumCapable [private]

Definition at line 184 of file CStorageResource.h.

BOOL CStorageResource::m_fIsQuorumResource [private]

Definition at line 185 of file CStorageResource.h.

DWORD CStorageResource::m_idxDevice [private]

Definition at line 197 of file CStorageResource.h.

DWORD CStorageResource::m_idxEnumPartitionNext [private]

Definition at line 199 of file CStorageResource.h.

DWORD CStorageResource::m_idxNextPartition [private]

Definition at line 198 of file CStorageResource.h.

IWbemServices* CStorageResource::m_pIWbemServices [private]

Definition at line 203 of file CStorageResource.h.

IUnknown*(* CStorageResource::m_prgPartitions)[] [private]

Definition at line 204 of file CStorageResource.h.

ULONG CStorageResource::m_ulSCSIBus [private]

Definition at line 192 of file CStorageResource.h.

ULONG CStorageResource::m_ulSCSILun [private]

Definition at line 195 of file CStorageResource.h.

ULONG CStorageResource::m_ulSCSIPort [private]

Definition at line 194 of file CStorageResource.h.

ULONG CStorageResource::m_ulSCSITid [private]

Definition at line 193 of file CStorageResource.h.

The documentation for this class was generated from the following files:
  • WinBase/Cluster/Win2003/MyStorageResource/CStorageResource.h
  • WinBase/Cluster/Win2003/MyStorageResource/CStorageResource.cpp
Generated on Wed Nov 13 2024 16:57:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CStorageResType Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions

CStorageResType Class Reference

#include "CStorageResType.h"

Inherits CMgdClusCfgInit.

List of all members.

Public Member Functions

CStorageResType (void)
virtual | ~CStorageResType (void)
STDMETHOD() | CommitChanges (IUnknown *punkClusterInfoIn, IUnknown *punkResTypeServicesIn)
STDMETHOD() | GetTypeGUID (GUID *pguidGUIDOut)
STDMETHOD() | GetTypeName (BSTR *pbstrTypeNameOut)
STDMETHOD() | Notify (IUnknown *punkIn)

Private Member Functions

CStorageResType (const CStorageResType &rSrcIn)
const CStorageResType & | operator= (const CStorageResType &rSrcIn)

Detailed Description

Definition at line 36 of file CStorageResType.h.

Constructor & Destructor Documentation

CStorageResType::CStorageResType ( void ) [inline]

Definition at line 43 of file CStorageResType.h.

{}

virtual CStorageResType::~CStorageResType ( void ) [inline, virtual]

Definition at line 44 of file CStorageResType.h.

{}

CStorageResType::CStorageResType ( const CStorageResType & rSrcIn ) [private]

Member Function Documentation

STDMETHODIMP CStorageResType::CommitChanges | ( | IUnknown * | punkClusterInfoIn,
 |  | IUnknown * | punkResTypeServicesIn
 | ) |  |

Definition at line 77 of file CStorageResType.cpp.

{
    assert( punkClusterInfoIn != NULL );
    assert( punkResTypeServicesIn != NULL );

    HRESULT                         hr = S_OK;
    IClusCfgClusterInfo *           pccci = NULL;
    IClusCfgResourceTypeCreate *    pccrtc = NULL;
    ECommitMode                     ecm = cmUNKNOWN;

    hr = HrSendStatusReport(
          TASKID_Major_Configure_Resource_Types
        , TASKID_Minor_StorageResourceType_CommitChanges
        , 0
        , 6
        , 0
        , hr
        , IDS_CONFIGURING_RESTYPE
        , 0
        , GetDisplayName()
        );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    //
    // Validate arguments
    //

    if ( ( punkClusterInfoIn == NULL ) || ( punkResTypeServicesIn == NULL ) )
    {
        hr = E_POINTER;
        goto Cleanup;
    } // if: one of the arguments is NULL

    hr = HrSendStatusReport(
          TASKID_Major_Configure_Resource_Types
        , TASKID_Minor_StorageResourceType_CommitChanges
        , 0
        , 6
        , 1
        , hr
        , IDS_CONFIGURING_RESTYPE
        , 0
        , GetDisplayName()
        );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    //
    // Find out what event caused this call.
    //

    hr = punkClusterInfoIn->TypeSafeQI( IClusCfgClusterInfo, &pccci );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    hr = HrSendStatusReport(
          TASKID_Major_Configure_Resource_Types
        , TASKID_Minor_StorageResourceType_CommitChanges
        , 0
        , 6
        , 2
        , hr
        , IDS_CONFIGURING_RESTYPE
        , 0
        , GetDisplayName()
        );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    hr = pccci->GetCommitMode( &ecm );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if: we could not determine the commit mode

    hr = HrSendStatusReport(
          TASKID_Major_Configure_Resource_Types
        , TASKID_Minor_StorageResourceType_CommitChanges
        , 0
        , 6
        , 3
        , hr
        , IDS_CONFIGURING_RESTYPE
        , 0
        , GetDisplayName()
        );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    hr = S_OK;

    //
    //  Check if we are creating a cluster or adding nodes to an existing cluster.
    //

    if ( ( ecm == cmCREATE_CLUSTER ) || ( ecm == cmADD_NODE_TO_CLUSTER ) )
    {
        //
        //  We are either creating a cluster on this node or adding it to a
        //  cluster.  We need to register our resource type and the associated
        //  Cluadmin extension dll.
        //

        //
        // First, register our resource type.
        //

        hr = punkResTypeServicesIn->TypeSafeQI( IClusCfgResourceTypeCreate, &pccrtc );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:

        hr = pccrtc->Create(
                          GetResTypeName()
                        , GetDisplayName()
                        , GetDllName()
                        , CLUSTER_RESTYPE_DEFAULT_LOOKS_ALIVE
                        , CLUSTER_RESTYPE_DEFAULT_IS_ALIVE
                        );

        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:

        hr = HrSendStatusReport(
              TASKID_Major_Configure_Resource_Types
            , TASKID_Minor_StorageResourceType_CommitChanges
            , 0
            , 6
            , 4
            , hr
            , IDS_CONFIGURED_RESTYPE
            , 0
            , GetResTypeName()
            , GetDisplayName()
            , GetDllName()
            );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:

/*
        //
        // TODO:    If your resource type has a Cluadmin extension dll register it
        //          with the cluster here.

        hr = pccrtc->RegisterAdminExtensions(
                          GetDisplayName()
                        , 1
                        , &CLSID_CoMyResDllEx
                        );

        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:

        hr = HrSendStatusReport(
              TASKID_Major_Configure_Resource_Types
            , TASKID_Minor_StorageResourceType_CommitChanges
            , 0
            , 6
            , 5
            , hr
            , IDS_CONFIGURED_EXTENSION
            , 0
            , GetDisplayName()
            );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:
*/

    } // if: we are either forming or joining ( but not both )
    else
    {
        //
        // Check for invalid commit modes.
        //

        if ( ( ecm == cmUNKNOWN ) || ( ecm >= cmMAX ) )
        {
            hr = E_UNEXPECTED;
            goto Cleanup;
        } // if: invalid commit mode

        assert( ecm == cmCLEANUP_NODE_AFTER_EVICT );

        //
        // If we are here, then this node has been evicted.
        //

        //
        // TODO: Add code to cleanup your resource type after the
        // local node has been evicted from the cluster.
        //
        // If your resource has a different configuration when it's part of
        // cluster then this is where you return it to stand-alone server mode.
        //

        hr = S_OK;

    } // else: we are not forming nor joining

    //
    // Success.
    //

    HrSendStatusReport(
          TASKID_Major_Configure_Resource_Types
        , TASKID_Minor_StorageResourceType_CommitChanges
        , 0
        , 6
        , 6
        , hr
        , IDS_CONFIGURING_RESTYPE
        , 0
        , GetDisplayName()
        );

Cleanup:

    if ( pccci != NULL )
    {
        pccci->Release();
        pccci = NULL;
    } // if:

    if ( pccrtc != NULL )
    {
        pccrtc->Release();
        pccrtc = NULL;
    } // if:

    if ( FAILED( hr ) )
    {
        HrSendStatusReport(
              TASKID_Major_Configure_Resource_Types
            , TASKID_Minor_StorageResourceType_CommitChanges
            , 0
            , 6
            , 6
            , hr
            , IDS_CONFIGURING_RESTYPE_FAILED
            , 0
            , GetDisplayName()
            );
    } // if: FAILED

    return hr;

} //*** CStorageResType::CommitChanges

STDMETHODIMP CStorageResType::GetTypeGUID ( GUID * pguidGUIDOut )

Definition at line 377 of file CStorageResType.cpp.

{
    assert( pguidGUIDOut != NULL );

    HRESULT hr = S_OK;

    if ( pguidGUIDOut == NULL )
    {
        hr = E_POINTER;
    } // if: the output pointer is NULL
    else
    {
        *pguidGUIDOut = RESTYPE_StorageResource;
    } // else: the output pointer is valid

    return hr;

} //*** CStorageResType::GetTypeGUID

STDMETHODIMP CStorageResType::GetTypeName ( BSTR * pbstrTypeNameOut )

Definition at line 430 of file CStorageResType.cpp.

{
    assert( pbstrTypeNameOut != NULL );

    HRESULT hr = S_OK;

    if ( pbstrTypeNameOut == NULL )
    {
        hr = E_POINTER;
        goto Cleanup;
    } // if: the output pointer is NULL

    *pbstrTypeNameOut = SysAllocString( GetResTypeName() );
    if ( *pbstrTypeNameOut == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if: memory for the resource type name could not be allocated

Cleanup:

    return hr;

} //*** CStorageResType::GetTypeName

HRESULT CStorageResType::Notify ( IUnknown * punkIn )

Definition at line 494 of file CStorageResType.cpp.

{
    HRESULT                         hr = S_OK;
    IClusCfgResourceTypeCreate *    piccrtc = NULL;
    //const GUID *                    guidAdminEx = &CLSID_CoMyResDllEx
    ICatRegister *                  pcrCatReg = NULL;
    CATID                           rgCatId[ 1 ];

    hr = HrSendStatusReport(
                  TASKID_Major_Client_And_Server_Log
                , IID_NULL
                , 1
                , 1
                , 1
                , hr
                , L"Startup Notify called for resource type '%1!ws!'."
                , (LPCWSTR) NULL
                , GetResTypeName()
                );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    hr = punkIn->TypeSafeQI( IClusCfgResourceTypeCreate, &piccrtc );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    //
    // Create the resource type.
    //

    hr = piccrtc->Create(
                      GetResTypeName()
                    , GetDisplayName()
                    , GetDllName()
                    , 5 *  1000
                    , 60 * 1000
                    );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    hr = HrSendStatusReport(
                  TASKID_Major_Client_And_Server_Log
                , IID_NULL
                , 1
                , 1
                , 1
                , hr
                , L"Successfully created resource type '%1!ws!'."
                , (LPCWSTR) NULL
                , GetResTypeName()
                );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

/*
    //
    // TODO:    If your resource type has a Cluadmin extension dll register it
    //          with the cluster here.

    //
    // Register the cluadmin extensions.
    //

    hr = piccrtc->RegisterAdminExtensions(
                      GetResTypeName()
                    , 1
                    , guidAdminEx
                    );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    hr = HrSendStatusReport(
                  TASKID_Major_Client_And_Server_Log
                , IID_NULL
                , 1
                , 1
                , 1
                , hr
                , L"Successfully registered Cluster Administrator extensions for resource type '%1!ws!'."
                , (LPCWSTR) NULL
                , GetResTypeName()
                );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:
*/

    //
    // Unregister from StartupListener notifications.
    //

    hr = CoCreateInstance(
              CLSID_StdComponentCategoriesMgr
            , NULL
            , CLSCTX_INPROC_SERVER
            , __uuidof( pcrCatReg )
            , reinterpret_cast< void ** >( &pcrCatReg )
            );

    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if: CoCreate failed

    rgCatId[ 0 ] = CATID_ClusCfgStartupListeners;

    hr = pcrCatReg->UnRegisterClassImplCategories( CLSID_CStorageResType, RTL_NUMBER_OF( rgCatId ), rgCatId );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if: deregister failed

    pcrCatReg->Release();
    pcrCatReg = NULL;

    hr = HrSendStatusReport(
                  TASKID_Major_Client_And_Server_Log
                , IID_NULL
                , 1
                , 1
                , 1
                , hr
                , L"Successfully unregistered the '%1!ws!' resource type from StartupListener notifications."
                , (LPCWSTR) NULL
                , GetResTypeName()
                );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

Cleanup:

    if ( piccrtc != NULL )
    {
        piccrtc->Release();
    } // if:

    if ( pcrCatReg != NULL )
    {
        pcrCatReg->Release();
    } // if:

    return hr;

} //*** CStorageResType::Notify

const CStorageResType& CStorageResType::operator= ( const CStorageResType & rSrcIn ) [private]
The documentation for this class was generated from the following files:
  • WinBase/Cluster/Win2003/MyStorageResource/CStorageResType.h
  • WinBase/Cluster/Win2003/MyStorageResource/CStorageResType.cpp
Generated on Wed Nov 13 2024 16:57:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CStream Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Protected Attributes | Friends

CStream Class Reference

#include "cstream.h"

Inherits CBaseObj, and CAsynchBase.

List of all members.

Public Member Functions

CStream (CMainWindow *pCMainWindow, CMDIChild *pCMDIChild=NULL)
CStream (LPUNKNOWN)
virtual | ~CStream ()
~CStream (void)
virtual HRESULT | AutoQI (DWORD dwCreateOpts)
virtual HRESULT | AutoRelease ()
virtual HRESULT | Clone (IStream **ppStream)
virtual HRESULT | DisplayObject ()
BOOL FInit (CRow *, ROWBUFF *)
virtual REFIID | GetDefaultInterface ()
virtual IUnknown ** | GetInterfaceAddress (REFIID riid)
virtual LONG | GetObjectImage ()
virtual UINT | GetObjectMenu ()
virtual WCHAR * | GetObjectName ()
virtual void | OnDefOperation ()
STDMETHODIMP | QueryInterface (REFIID, LPVOID *)
virtual HRESULT | ReadBytes (REFIID riid, DBLENGTH ulOffset, DBLENGTH cBytes, DBLENGTH cbMaxSize, void *pBuffer, DBLENGTH *pcbRead=NULL)
virtual HRESULT | ReadString (REFIID riid, DBLENGTH ulOffset, DBLENGTH cBytes, DBLENGTH ulMaxSize, WCHAR *pwszBuffer, DBLENGTH *pcbRead=NULL)
virtual HRESULT | Seek (LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
virtual HRESULT | Stat (STATSTG *pSTATSTG)
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) AddRef(void)
virtual HRESULT | WriteBytes (REFIID riid, DBLENGTH ulOffset, DBLENGTH cBytes, void *pBuffer, DBLENGTH *pcbWritten=NULL)
virtual HRESULT | WriteString (REFIID riid, DBLENGTH ulOffset, DBLENGTH cBytes, WCHAR *pwszBuffer, DBLENGTH *pcbWritten=NULL)

Public Attributes

ILockBytes * | m_pILockBytes
ISequentialStream * | m_pISequentialStream
IStorage * | m_pIStorage
IStream * | m_pIStream
DBTYPE | m_wType

Protected Attributes

DBLENGTH | m_cMaxSize
ULONG m_cRef
ULONG m_iPos
void * | m_pBuffer
CImpIGetSourceRow * m_pIGetSourceRow
CImpIStream * m_pIStream
CRow * m_pParentObj

Friends

class | CImpIGetSourceRow
class | CImpIStream

Detailed Description

Definition at line 25 of file cstream.h.

Constructor & Destructor Documentation

CStream::CStream | ( | CMainWindow * | pCMainWindow,
 |  | CMDIChild * | pCMDIChild = NULL
 | ) |  |

Definition at line 22 of file cstream.cpp.

  : CAsynchBase(eCStream, pCMainWindow, pCMDIChild)
{
  //Storage Interfaces
  m_pISequentialStream  = NULL;
  m_pIStream        = NULL;
  m_pIStorage       = NULL;
  m_pILockBytes     = NULL;

  //Data
  m_wType         = DBTYPE_STR;
}

CStream::~CStream ( ) [virtual]

Definition at line 40 of file cstream.cpp.

{
  ReleaseObject(0);
}

CStream::CStream ( LPUNKNOWN pUnkOuter )

Definition at line 25 of file stream.cpp.

  : CBaseObj( BOT_STREAM )
{
  //  Initialize simple member vars
    m_cRef          = 0L;
  m_pUnkOuter   = pUnkOuter ? pUnkOuter : this;

  m_pBuffer   = NULL;
  m_pParentObj  = NULL;
  m_iPos      = 0;
  m_cMaxSize    = 0;

    //  Initially, NULL all contained interfaces
  m_pIGetSourceRow  = NULL;
  m_pIStream      = NULL;
}

CStream::~CStream ( void )

Member Function Documentation

HRESULT CStream::AutoQI ( DWORD dwCreateOpts ) [virtual]

Reimplemented from CAsynchBase.

Definition at line 83 of file cstream.cpp.

{
  //Delegate First so we have base interfaces
  CAsynchBase::AutoQI(dwCreateOpts);

  //[MANDATORY]
  if(dwCreateOpts & CREATE_QI_MANDATORY)
  {
    OBTAIN_INTERFACE(ISequentialStream);
  }

  //AutoQI
  if(dwCreateOpts & CREATE_QI_OPTIONAL)
  {
    //[OPTIONAL]
    OBTAIN_INTERFACE(IStream);
    OBTAIN_INTERFACE(IStorage);
    OBTAIN_INTERFACE(ILockBytes);
  }

  return S_OK;
}

HRESULT CStream::AutoRelease ( ) [virtual]

Reimplemented from CAsynchBase.

Definition at line 66 of file cstream.cpp.

{
  //Stream
  RELEASE_INTERFACE(ISequentialStream);
  RELEASE_INTERFACE(IStream);
  RELEASE_INTERFACE(IStorage);
  RELEASE_INTERFACE(ILockBytes);

  //Delegate
  return CAsynchBase::AutoRelease();
}

HRESULT CStream::Clone ( IStream ** ppStream ) [virtual]

Definition at line 378 of file cstream.cpp.

{
  HRESULT hr = S_OK;

  if(m_pIStream)
  {
    //IStream::Clone
    XTEST(hr = m_pIStream->Clone(ppStream));
    TESTC(TRACE_METHOD(hr, L"IStream::Clone(&0x%p)", ppStream ? *ppStream : NULL));
  }

CLEANUP:
  return hr;
}

HRESULT CStream::DisplayObject ( ) [virtual]

Reimplemented from CBase.

Definition at line 137 of file cstream.cpp.

{
  HRESULT hr = S_OK;

  //Display the object...
  OnDefOperation();

  //Delegate
  TESTC(hr = CAsynchBase::DisplayObject());

CLEANUP:
  return hr;
}

BOOL CStream::FInit | ( | CRow * | pParentRow,
 |  | ROWBUFF * | pRowBuff
 | ) |  |

Definition at line 74 of file stream.cpp.

{
  // Asserts
  assert(pParentRow);
  assert(pRowBuff);

  m_pParentObj = pParentRow;
  m_pParentObj->GetOuterUnknown()->AddRef();

    // Allocate contained interface objects
    m_pIStream      = new CImpIStream( this, m_pUnkOuter );
  m_pIGetSourceRow  = new CImpIGetSourceRow( this, m_pUnkOuter );

  m_cMaxSize = pParentRow->m_cbRowSize;
  m_pBuffer = new BYTE [ROUND_UP(m_cMaxSize , COLUMN_ALIGNVAL)];
  if( m_pBuffer )
  {
    memcpy(m_pBuffer, pRowBuff->cdData, m_cMaxSize );
  }

    // if all interfaces were created, return success
    return (BOOL) ( m_pIStream && m_pIGetSourceRow && m_pBuffer);
}

virtual REFIID CStream::GetDefaultInterface ( ) [inline, virtual]

Implements CBase.

Definition at line 42 of file cstream.h.

{ return IID_ISequentialStream; }

IUnknown ** CStream::GetInterfaceAddress ( REFIID riid ) [virtual]

Reimplemented from CAsynchBase.

Definition at line 50 of file cstream.cpp.

{
  HANDLE_GETINTERFACE(ISequentialStream);
  HANDLE_GETINTERFACE(IStream);
  HANDLE_GETINTERFACE(IStorage);
  HANDLE_GETINTERFACE(ILockBytes);

  //Otherwise delegate
  return CAsynchBase::GetInterfaceAddress(riid);
}

virtual LONG CStream::GetObjectImage ( ) [inline, virtual]

Implements CBase.

Definition at line 41 of file cstream.h.

{ return IMAGE_STREAM;      }

virtual UINT CStream::GetObjectMenu ( ) [inline, virtual]

Implements CBase.

Definition at line 40 of file cstream.h.

{ return IDM_STREAMMENU;    }

virtual WCHAR* CStream::GetObjectName ( ) [inline, virtual]

Implements CBase.

Definition at line 39 of file cstream.h.

{ return L"Stream";       }

void CStream::OnDefOperation ( ) [virtual]

Reimplemented from CBase.

Definition at line 112 of file cstream.cpp.

{
  //Need to bring up the StreamViewer
  if(m_pCMainWindow)
  {
    UINT uID = IDM_ISEQSTREAM_READ;

    //Determine which interface to use for reading.
    //Since the user just clicked on the object we have to guess which interface to use from those
    //that are available, and most functional...
    if(m_pIStream)
      uID = IDM_ISTREAM_READ;

    //Display the Stream Viewer...
    //NOTE: This dialog could be displayed from numerous sources, either the execute dialog,
    //or directly from clicking on the stream - (ie: use GetFocus to determine the parent window)
    m_pCMainWindow->DisplayDialog(IDD_STREAM_VIEWER, GetFocus(), CMainWindow::StreamViewerProc, this, uID);
  }
}

STDMETHODIMP CStream::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 114 of file stream.cpp.

{
    if( NULL == ppv )
    return E_INVALIDARG;

  //  Place NULL in *ppv in case of failure
    *ppv = NULL;

  //IUNKNOWN
  if( riid == IID_IUnknown )
    *ppv = this;
  else if( riid == IID_IGetSourceRow )
    *ppv = m_pIGetSourceRow;
  else if( riid == IID_IStream )
    *ppv = m_pIStream;
  else if (riid == IID_ISequentialStream )
    *ppv = m_pIStream;

    //  If we're going to return an interface, AddRef it first
    if (*ppv)
        {
        ((LPUNKNOWN) *ppv)->AddRef();
        return S_OK;
        }
    else
        return E_NOINTERFACE;
}

HRESULT CStream::ReadBytes | ( | REFIID | riid,
 |  | DBLENGTH | ulOffset,
 |  | DBLENGTH | cBytes,
 |  | DBLENGTH | cbMaxSize,
 |  | void * | pBuffer,
 |  | DBLENGTH * | pcbRead = NULL |
 | ) |  |  | [virtual]

Definition at line 156 of file cstream.cpp.

{
  HRESULT hr = S_OK;
  BOOL  bUseDefault = FALSE;

  ULONG cbRead = 0;
  cBytes = min(cBytes, cbMaxSize);

  //Determine object type
  if(riid != IID_ISequentialStream && riid != IID_ILockBytes && riid != IID_IStream)
    bUseDefault = TRUE;

  //IID_ISequentialStream
  if((riid == IID_ISequentialStream && m_pISequentialStream) || (bUseDefault && m_pISequentialStream))
  {
    //ISequentialStream::Read
    //TODO64:  I*::Read only takes a ULONG
    //NOTE: ::Read can post errorinfo objects in the case of warnings.  SQLOLEDB's XML Stream
    //object will post execution errors on the last read...
    XTEST_(hr = m_pISequentialStream->Read(pBuffer, (ULONG)cBytes, &cbRead),S_FALSE);
    TESTC(TRACE_METHOD(hr, L"ISequentialStream::Read(0x%p, %d, &%d)", pBuffer, cBytes, cbRead));
  }
  //IID_ILockBytes
  else if((riid == IID_ILockBytes && m_pILockBytes) || (bUseDefault && m_pILockBytes))
  {
    ULARGE_INTEGER ulgOffset;
    ulgOffset.QuadPart = ulOffset;

    //ILockBytes::ReadAt
    //TODO64:  I*::Read only takes a ULONG
    XTEST_(hr = m_pILockBytes->ReadAt(ulgOffset, pBuffer, (ULONG)cBytes, &cbRead),S_FALSE);
    TESTC(TRACE_METHOD(hr, L"ILockBytes::ReadAt(%d, 0x%p, %d, &%d)", ulOffset, pBuffer, cBytes, cbRead));
  }
  //IID_IStream
  else if((riid == IID_IStream && m_pIStream) || (bUseDefault && m_pIStream))
  {
    //IStream::Read
    //TODO64:  I*::Read only takes a ULONG
    XTEST_(hr = m_pIStream->Read(pBuffer, (ULONG)cBytes, &cbRead),S_FALSE);
    TESTC(TRACE_METHOD(hr, L"IStream::Read(0x%p, %d, &%d)", pBuffer, cBytes, cbRead));
  }
//  else if(m_pIStorage)
//  {
    //TODO
//  }
  else
  {
    TESTC(hr = E_FAIL);
  }

CLEANUP:
  if(pcbRead)
    *pcbRead = cbRead;
  return hr;
}

HRESULT CStream::ReadString | ( | REFIID | riid,
 |  | DBLENGTH | ulOffset,
 |  | DBLENGTH | cBytes,
 |  | DBLENGTH | ulMaxSize,
 |  | WCHAR * | pwszBuffer,
 |  | DBLENGTH * | pcbRead = NULL |
 | ) |  |  | [virtual]

Definition at line 217 of file cstream.cpp.

{
  ASSERT(pwszBuffer);
  HRESULT hr = S_OK;
  pwszBuffer[0] = wEOL;

  WCHAR pBuffer[MAX_COL_SIZE+1] = {0};
  DWORD dwConvFlags = GetOptions()->m_dwConvFlags;

  DBLENGTH cbRead = 0;
  cBytes = min(min(sizeof(pBuffer), cBytes), ulMaxSize*sizeof(WCHAR));

  //Delegate
  TESTC(hr = ReadBytes(riid, ulOffset, cBytes, ulMaxSize*sizeof(WCHAR), pBuffer, &cbRead));

  //What type of data are we reading
  switch(m_wType)
  {
    case DBTYPE_WSTR:
    case DBTYPE_STR:
      //Add a NULL terminator on the end of the data before conversion
      //since the spec indicates the stream is not NULL terminated...
      //NOTE: We made sure we had a full extra WCHAR in the buffer ahead of time
      memset((BYTE*)pBuffer + min(cBytes, cbRead), 0, sizeof(WCHAR));
      cbRead += (m_wType == DBTYPE_WSTR) ? sizeof(WCHAR) : sizeof(CHAR);
      break;
  };

  //Now that we have read the data, coerce it into a string for display purposes...
  XTESTC_(hr = DataConvert
    (
      DBSTATUS_S_OK,
      cbRead,
      sizeof(pBuffer),
      (m_wType == DBTYPE_WSTR || m_wType == DBTYPE_STR) ? m_wType : DBTYPE_BYTES,
      pBuffer,
      0,
      0,

      DBTYPE_WSTR,
      NULL,
      NULL,
      pwszBuffer,
      ulMaxSize*sizeof(WCHAR),
      dwConvFlags
    ),S_OK);

CLEANUP:
  if(pcbRead)
    *pcbRead = cbRead;
  return hr;
}

HRESULT CStream::Seek | ( | LARGE_INTEGER | dlibMove,
 |  | DWORD | dwOrigin,
 |  | ULARGE_INTEGER * | plibNewPosition |
 | ) |  |  | [virtual]

Definition at line 398 of file cstream.cpp.

{
  HRESULT hr = E_INVALIDARG;

  if(m_pIStream)
  {
    //IStream::Seek
    TEST(hr = m_pIStream->Seek(dlibMove, dwOrigin, plibNewPosition));
    TESTC(TRACE_METHOD(hr, L"IStream::Seek(%d, %d, &%d)", dlibMove.QuadPart, dwOrigin, plibNewPosition ? plibNewPosition->QuadPart : 0));
  }

CLEANUP:
  return hr;
}

HRESULT CStream::Stat ( STATSTG * pSTATSTG ) [virtual]

Definition at line 418 of file cstream.cpp.

{
  ASSERT(pstatstg);
  HRESULT hr = S_OK;
  WCHAR* pwszProgID = NULL;

  if(m_pIStream)
  {
    memset(pstatstg, 0, sizeof(STATSTG));

    //IStream::Stat
    XTEST(hr = m_pIStream->Stat(pstatstg, STATFLAG_DEFAULT));

    pwszProgID = GetProgID(pstatstg->clsid);
    TESTC(TRACE_METHOD(hr, L"IStream::Stat(&{\"%s\", %d, %d, 0x%08x, 0x%08x, 0x%08x, %d, %d, \"%s\", 0x%08x, %d}, \"%s\")", pstatstg->pwcsName, pstatstg->type, (ULONG)pstatstg->cbSize.QuadPart, &pstatstg->mtime, &pstatstg->ctime, &pstatstg->atime, pstatstg->grfMode, pstatstg->grfLocksSupported, pwszProgID, pstatstg->grfStateBits, pstatstg->reserved, L"STATFLAG_DEFAULT"));
  }

CLEANUP:
  SAFE_FREE(pwszProgID);
  return hr;
}

CStream::STDMETHODIMP_ ( ULONG )

Reimplemented from CBase.

CStream::STDMETHODIMP_ ( ULONG )

Reimplemented from CBase.

HRESULT CStream::WriteBytes | ( | REFIID | riid,
 |  | DBLENGTH | ulOffset,
 |  | DBLENGTH | cBytes,
 |  | void * | pBuffer,
 |  | DBLENGTH * | pcbWritten = NULL |
 | ) |  |  | [virtual]

Definition at line 275 of file cstream.cpp.

{
  HRESULT hr = S_OK;
  BOOL  bUseDefault = FALSE;
  ULONG cbWritten = 0;

  //Determine object type
  if(riid != IID_ISequentialStream && riid != IID_ILockBytes && riid != IID_IStream)
    bUseDefault = TRUE;

  //IID_ISequentialStream
  if((riid == IID_ISequentialStream && m_pISequentialStream) || (bUseDefault && m_pISequentialStream))
  {
    //ISequentialStream::Write
    //TODO64:  I*::Write only takes a ULONG
    XTEST(hr = m_pISequentialStream->Write(pBuffer, (ULONG)cBytes, &cbWritten));
    TESTC(TRACE_METHOD(hr, L"ISequentialStream::Write(0x%p, %d, &%d)", pBuffer, cBytes, cbWritten));
  }
  //IID_ILockBytes
  else if((riid == IID_ILockBytes && m_pILockBytes) || (bUseDefault && m_pILockBytes))
  {
    ULARGE_INTEGER ulgOffset;
    ulgOffset.QuadPart = ulOffset;

    //ILockBytes::WriteAt
    //TODO64:  I*::Write only takes a ULONG
    XTEST(hr = m_pILockBytes->WriteAt(ulgOffset, pBuffer, (ULONG)cBytes, &cbWritten));
    TESTC(TRACE_METHOD(hr, L"ILockBytes::WriteAt(%d, 0x%p, %d, &%d)", ulOffset, pBuffer, cBytes, cbWritten));
  }
  //IID_IStream
  else if((riid == IID_IStream && m_pIStream) || (bUseDefault && m_pIStream))
  {
    //IStream::Write
    //TODO64:  I*::Write only takes a ULONG
    XTEST(hr = m_pIStream->Write(pBuffer, (ULONG)cBytes, &cbWritten));
    TESTC(TRACE_METHOD(hr, L"IStream::Write(0x%p, %d, &%d)", pBuffer, cBytes, cbWritten));
  }
//  else if(m_pIStorage)
//  {
    //TODO
//  }
  else
  {
    TESTC(hr = E_FAIL);
  }

CLEANUP:
  if(pcbWritten)
    *pcbWritten = cbWritten;
  return hr;
}

HRESULT CStream::WriteString | ( | REFIID | riid,
 |  | DBLENGTH | ulOffset,
 |  | DBLENGTH | cBytes,
 |  | WCHAR * | pwszBuffer,
 |  | DBLENGTH * | pcbWritten = NULL |
 | ) |  |  | [virtual]

Definition at line 332 of file cstream.cpp.

{
  HRESULT hr = S_OK;
  WCHAR pBuffer[MAX_COL_SIZE] = {0};
  DWORD dwConvFlags = GetOptions()->m_dwConvFlags;

  DBLENGTH cbWritten = 0;
  cBytes = min(sizeof(pBuffer), cBytes);

  //First Convert the user entered data into the backend format...
  //So the stream is a native stream of bytes to set into the backend...
  XTESTC_(hr = DataConvert
    (
      DBSTATUS_S_OK,
      cBytes,
      cBytes + sizeof(WCHAR),
      DBTYPE_WSTR,
      pwszBuffer,
      0,  //Precision
      0,  //Scale

      (m_wType == DBTYPE_IUNKNOWN || m_wType == (DBTYPE_BYREF|DBTYPE_IUNKNOWN))
        ? DBTYPE_BYTES : m_wType,

      NULL,   //&dbDstStatus
      &cBytes,  //&cbDstLength
      pBuffer,
      sizeof(pBuffer),
      dwConvFlags
    ),S_OK);

  //Delegate
  TESTC(hr = WriteBytes(riid, ulOffset, cBytes, pBuffer, &cbWritten));

CLEANUP:
  if(pcbWritten)
    *pcbWritten = cbWritten;
  return hr;
}

Friends And Related Function Documentation

friend class CImpIGetSourceRow [friend]

Definition at line 33 of file stream.h.

friend class CImpIStream [friend]

Definition at line 32 of file stream.h.

Member Data Documentation

DBLENGTH CStream::m_cMaxSize [protected]

Definition at line 41 of file stream.h.

ULONG CStream::m_cRef [protected]

Reimplemented from CBase.

Definition at line 48 of file stream.h.

ULONG CStream::m_iPos [protected]

Definition at line 43 of file stream.h.

void* CStream::m_pBuffer [protected]

Definition at line 39 of file stream.h.

CImpIGetSourceRow* CStream::m_pIGetSourceRow [protected]

Definition at line 50 of file stream.h.

ILockBytes* CStream::m_pILockBytes

Definition at line 65 of file cstream.h.

ISequentialStream* CStream::m_pISequentialStream

Definition at line 60 of file cstream.h.

IStorage* CStream::m_pIStorage

Definition at line 64 of file cstream.h.

IStream* CStream::m_pIStream

Definition at line 63 of file cstream.h.

CImpIStream* CStream::m_pIStream [protected]

Definition at line 52 of file stream.h.

CRow* CStream::m_pParentObj [protected]

Definition at line 37 of file stream.h.

DBTYPE CStream::m_wType

Definition at line 68 of file cstream.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cstream.h
  • Dataaccess/oledb/sampprov/stream.h
  • Dataaccess/oledb/rowsetviewer/cstream.cpp
  • Dataaccess/oledb/sampprov/stream.cpp
Generated on Wed Nov 13 2024 16:57:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CString Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | Private Member Functions | Friends

CString Class Reference

#include "string.h"

List of all members.

Public Member Functions

CString ()
CString (const CString &stringSrc)
CString (LPCSTR lpsz)
CString (const unsigned char *psz)
CString (LPCWSTR lpsz)
CString (WCHAR ch, int nRepeat=1)
CString (LPCSTR lpch, int nLength)
CString (LPCWSTR lpch, int nLength)
~CString ()
void | AssignCopy (int nSrcLen, LPCWSTR lpszSrcData)
int | Compare (LPCWSTR lpsz) const
void | Empty ()
void | FreeExtra ()
int | GetAllocLength () const
WCHAR | GetAt (int nIndex) const
LPWSTR | GetBuffer (int nMinBufLength)
LPWSTR | GetBufferSetLength (int nNewLength)
int | GetLength () const
BOOL | IsEmpty () const
LPWSTR | LockBuffer ()
operator LPCWSTR () const
const CString & | operator+= (LPCWSTR lpsz)
const CString & | operator+= (const CString &string)
const CString & | operator+= (WCHAR ch)
const CString & | operator= (const CString &stringSrc)
const CString & | operator= (LPCSTR lpsz)
const CString & | operator= (const unsigned char *psz)
const CString & | operator= (WCHAR ch)
const CString & | operator= (LPCWSTR lpsz)
WCHAR | operator[] (int nIndex) const
void | ReleaseBuffer (int nNewLength=-1)
void | SetAt (int nIndex, WCHAR ch)
void | UnlockBuffer ()

Public Attributes

LPWSTR | m_pchData

Protected Member Functions

void | AllocBeforeWrite (int nLen)
void | AllocBuffer (int nLen)
void | AllocCopy (CString &dest, int nCopyLen, int nCopyIndex, int nExtraLen) const
void | ConcatCopy (int nSrc1Len, LPCWSTR lpszSrc1Data, int nSrc2Len, LPCWSTR lpszSrc2Data)
void | ConcatInPlace (int nSrcLen, LPCWSTR lpszSrcData)
void | CopyBeforeWrite ()
CStringData * | GetData () const
void | Init ()
void | Release ()

Static Protected Member Functions

static void | FreeData (CStringData *pData)
static void | Release (CStringData *pData)
static int | SafeStrlen (LPCWSTR lpsz)

Private Member Functions

DECLARE_FIXED_ALLOC (CString)

Friends

CString | operator+ (const CString &string1, const CString &string2)
CString | operator+ (LPCWSTR lpsz, const CString &string)
CString | operator+ (const CString &string, LPCWSTR lpsz)
CString | operator+ (WCHAR ch, const CString &string)
CString | operator+ (const CString &string, WCHAR ch)

Detailed Description

Definition at line 15 of file string.h.

Constructor & Destructor Documentation

CString::CString ( ) [inline]

Definition at line 205 of file string.h.

{
  m_pchData = epEmptyString.m_pchData;
}

CString::CString ( const CString & stringSrc )

Definition at line 17 of file string.Cpp.

{
  if (stringSrc.GetData()->nRefs >= 0)
  {
    m_pchData = stringSrc.m_pchData;
    InterlockedIncrement(&GetData()->nRefs);
  }
  else
  {
    Init();
    *this = stringSrc.m_pchData;
  }
}

CString::CString | ( | WCHAR | ch,
 |  | int | nRepeat = 1
 | ) |  |

Definition at line 31 of file string.Cpp.

{
  Init();
  if (nLength >= 1)
  {
    AllocBuffer(nLength);
    for (int i = 0; i < nLength; i++)
      m_pchData[i] = ch;
  }
}

CString::CString ( LPCSTR lpsz )
CString::CString ( LPCWSTR lpsz )

Definition at line 342 of file string.Cpp.

{
  Init();
  int nLen = SafeStrlen(lpsz);
  if (nLen != 0)
  {
    AllocBuffer(nLen);
    memcpy(m_pchData, lpsz, nLen*sizeof(WCHAR));
  }
}

CString::CString | ( | LPCSTR | lpch,
 |  | int | nLength
 | ) |  |
CString::CString | ( | LPCWSTR | lpch,
 |  | int | nLength
 | ) |  |

Definition at line 42 of file string.Cpp.

{
  Init();
  if (nLength != 0)
  {
    AllocBuffer(nLength);
    memcpy(m_pchData, lpch, nLength*sizeof(WCHAR));
  }
}

CString::CString ( const unsigned char * psz )
CString::~CString ( ) [inline]

Definition at line 306 of file string.Cpp.

{
  if (GetData() != _epDataNil)
  {
    if (InterlockedDecrement(&GetData()->nRefs) <= 0)
      FreeData(GetData());
  }
}

Member Function Documentation

void CString::AllocBeforeWrite ( int nLen ) [inline, protected]

Definition at line 151 of file string.h.

  {
    if (GetData()->nRefs > 1 || nLen > GetData()->nAllocLength)
    {
      Release();
      AllocBuffer(nLen);
    }
  }

void CString::AllocBuffer ( int nLen ) [protected]

Definition at line 82 of file string.Cpp.

{
  if (nLen == 0)
    Init();
  else
  {
    CStringData* pData;
    if (nLen <= 6)
    {
      pData = (CStringData*)_epAlloc6.Alloc();
      pData->nAllocLength = 6;
    }
    else if (nLen <= 7)
    {
      pData = (CStringData*)_epAlloc7.Alloc();
      pData->nAllocLength = 7;
    }
    else if (nLen <= 8)
    {
      pData = (CStringData*)_epAlloc8.Alloc();
      pData->nAllocLength = 8;
    }
    else if (nLen <= 9)
    {
      pData = (CStringData*)_epAlloc9.Alloc();
      pData->nAllocLength = 9;
    }
    else if (nLen <= 10)
    {
      pData = (CStringData*)_epAlloc10.Alloc();
      pData->nAllocLength = 10;
    }
    else if (nLen <= 11)
    {
      pData = (CStringData*)_epAlloc11.Alloc();
      pData->nAllocLength = 11;
    }
    else if (nLen <= 12)
    {
      pData = (CStringData*)_epAlloc12.Alloc();
      pData->nAllocLength = 12;
    }
    else if (nLen <= 16)
    {
      pData = (CStringData*)_epAlloc16.Alloc();
      pData->nAllocLength = 16;
    }
    else if (nLen <= 20)
    {
      pData = (CStringData*)_epAlloc20.Alloc();
      pData->nAllocLength = 20;
    }
    else if (nLen <= 24)
    {
      pData = (CStringData*)_epAlloc24.Alloc();
      pData->nAllocLength = 24;
    }
    else if (nLen <= 32)
    {
      pData = (CStringData*)_epAlloc32.Alloc();
      pData->nAllocLength = 32;
    }
    else if (nLen <= 64)
    {
      pData = (CStringData*)_epAlloc64.Alloc();
      pData->nAllocLength = 64;
    }
    else if (nLen <= 128)
    {
      pData = (CStringData*)_epAlloc128.Alloc();
      pData->nAllocLength = 128;
    }
    else if (nLen <= 256)
    {
      pData = (CStringData*)_epAlloc256.Alloc();
      pData->nAllocLength = 256;
    }
    else if (nLen <= 512)
    {
      pData = (CStringData*)_epAlloc512.Alloc();
      pData->nAllocLength = 512;
    }
    else
    {
      pData = (CStringData*)
        new BYTE[sizeof(CStringData) + (nLen+1)*sizeof(WCHAR)];
      pData->nAllocLength = nLen;
    }
    pData->nRefs = 1;
    pData->data()[nLen] = L'\0';
    pData->nDataLength = nLen;
    m_pchData = pData->data();
  }
}

void CString::AllocCopy | ( | CString & | dest,
 |  | int | nCopyLen,
 |  | int | nCopyIndex,
 |  | int | nExtraLen |
 | ) |  |  | const [protected]

Definition at line 319 of file string.Cpp.

{
  // will clone the data attached to this string
  // allocating 'nExtraLen' characters
  // Places results in uninitialized string 'dest'
  // Will copy the part or all of original data to start of new string

  int nNewLen = nCopyLen + nExtraLen;
  if (nNewLen == 0)
  {
    dest.Init();
  }
  else
  {
    dest.AllocBuffer(nNewLen);
    memcpy(dest.m_pchData, m_pchData+nCopyIndex, nCopyLen*sizeof(WCHAR));
  }
}

void CString::AssignCopy | ( | int | nSrcLen,
 |  | LPCWSTR | lpszSrcData |
 | ) |  |  | [inline]

Definition at line 130 of file string.h.

  {
    AllocBeforeWrite(nSrcLen);
  //  memcpy(m_pchData, lpszSrcData, nSrcLen*sizeof(WCHAR));
  //  m_pchData[nSrcLen] = L'\0';
    WCSNCPY(m_pchData, lpszSrcData, nSrcLen);
    GetData()->nDataLength = nSrcLen;
  }

int CString::Compare ( LPCWSTR lpsz ) const [inline]

Definition at line 222 of file string.h.

  { return WCSCMP(m_pchData, lpsz); }    // MBCS/Unicode aware

void CString::ConcatCopy | ( | int | nSrc1Len,
 |  | LPCWSTR | lpszSrc1Data,
 |  | int | nSrc2Len,
 |  | LPCWSTR | lpszSrc2Data |
 | ) |  |  | [protected]

Definition at line 386 of file string.Cpp.

{
  // -- master concatenation routine
  // Concatenate two sources
  // -- assume that 'this' is a new CString object

  int nNewLen = nSrc1Len + nSrc2Len;
  if (nNewLen != 0)
  {
    AllocBuffer(nNewLen);
    memcpy(m_pchData, lpszSrc1Data, nSrc1Len*sizeof(WCHAR));
    memcpy(m_pchData+nSrc1Len, lpszSrc2Data, nSrc2Len*sizeof(WCHAR));
  }
}

void CString::ConcatInPlace | ( | int | nSrcLen,
 |  | LPCWSTR | lpszSrcData |
 | ) |  |  | [protected]

Definition at line 443 of file string.Cpp.

{
  //  -- the main routine for += operators

  // concatenating an empty string is a no-op!
  if (nSrcLen == 0)
    return;

  // if the buffer is too small, or we have a width mis-match, just
  //   allocate a new buffer (slow but sure)
  if (GetData()->nRefs > 1 || GetData()->nDataLength + nSrcLen > GetData()->nAllocLength)
  {
    // we have to grow the buffer, use the ConcatCopy routine
    CStringData* pOldData = GetData();
    ConcatCopy(GetData()->nDataLength, m_pchData, nSrcLen, lpszSrcData);
    CString::Release(pOldData);
  }
  else
  {
    // fast concatenation when buffer big enough
    memcpy(m_pchData+GetData()->nDataLength, lpszSrcData, nSrcLen*sizeof(WCHAR));
    GetData()->nDataLength += nSrcLen;
    m_pchData[GetData()->nDataLength] = L'\0';
  }
}

void CString::CopyBeforeWrite ( ) [protected]

Definition at line 295 of file string.Cpp.

{
  if (GetData()->nRefs > 1)
  {
    CStringData* pData = GetData();
    Release();
    AllocBuffer(pData->nDataLength);
    memcpy(m_pchData, pData->data(), (pData->nDataLength+1)*sizeof(WCHAR));
  }
}

CString::DECLARE_FIXED_ALLOC ( CString ) [private]
void CString::Empty ( )

Definition at line 285 of file string.Cpp.

{
  if (GetData()->nDataLength == 0)
    return;
  if (GetData()->nRefs >= 0)
    Release();
  else
    *this = &epChNil;
}

void CString::FreeData ( CStringData * pData ) [static, protected]

Definition at line 179 of file string.Cpp.

{
  switch (pData->nAllocLength)
  {
    case 6:
    {
      _epAlloc6.Free(pData);
      break;
    }
    case 7:
    {
      _epAlloc7.Free(pData);
      break;
    }
    case 8:
    {
      _epAlloc8.Free(pData);
      break;
    }
    case 9:
    {
      _epAlloc9.Free(pData);
      break;
    }
    case 10:
    {
      _epAlloc10.Free(pData);
      break;
    }
    case 11:
    {
      _epAlloc11.Free(pData);
      break;
    }
    case 12:
    {
      _epAlloc12.Free(pData);
      break;
    }
    case 16:
    {
      _epAlloc16.Free(pData);
      break;
    }
    case 20:
    {
      _epAlloc20.Free(pData);
      break;
    }
    case 24:
    {
      _epAlloc24.Free(pData);
      break;
    }
    case 32:
    {
      _epAlloc32.Free(pData);
      break;
    }
    case 64:
    {
      _epAlloc64.Free(pData);
      break;
    }
    case 128:
    {
      _epAlloc128.Free(pData);
      break;
    }
    case 256:
    {
      _epAlloc256.Free(pData);
      break;
    }
    case 512:
    {
      _epAlloc512.Free(pData);
      break;
    }
    default:
    {
      delete[] (BYTE*)pData;
      break;
    }
  }
}

void CString::FreeExtra ( )

Definition at line 527 of file string.Cpp.

{
  if (GetData()->nDataLength != GetData()->nAllocLength)
  {
    CStringData* pOldData = GetData();
    AllocBuffer(GetData()->nDataLength);
    memcpy(m_pchData, pOldData->data(), pOldData->nDataLength*sizeof(WCHAR));
    CString::Release(pOldData);
  }
}

int CString::GetAllocLength ( ) const [inline]

Definition at line 212 of file string.h.

  { return GetData()->nAllocLength; }

WCHAR CString::GetAt ( int nIndex ) const [inline]

Definition at line 225 of file string.h.

{
  return m_pchData[nIndex];
}

LPWSTR CString::GetBuffer ( int nMinBufLength )

Definition at line 490 of file string.Cpp.

{
  if (GetData()->nRefs > 1 || nMinBufLength > GetData()->nAllocLength)
  {
    // we have to grow the buffer
    CStringData* pOldData = GetData();
    int nOldLen = GetData()->nDataLength;   // AllocBuffer will tromp it
    if (nMinBufLength < nOldLen)
      nMinBufLength = nOldLen;
    AllocBuffer(nMinBufLength);
    memcpy(m_pchData, pOldData->data(), (nOldLen+1)*sizeof(WCHAR));
    GetData()->nDataLength = nOldLen;
    CString::Release(pOldData);
  }
  // return a pointer to the character storage for this string
  return m_pchData;
}

LPWSTR CString::GetBufferSetLength ( int nNewLength )

Definition at line 519 of file string.Cpp.

{
  GetBuffer(nNewLength);
  GetData()->nDataLength = nNewLength;
  m_pchData[nNewLength] = L'\0';
  return m_pchData;
}

CStringData * CString::GetData ( ) const [inline, protected]

Definition at line 195 of file string.h.

{
  return ((CStringData*)m_pchData)-1;
}

int CString::GetLength ( ) const [inline]

Definition at line 210 of file string.h.

  { return GetData()->nDataLength; }

void CString::Init ( ) [inline, protected]

Definition at line 200 of file string.h.

{
  m_pchData = epEmptyString.m_pchData;
}

BOOL CString::IsEmpty ( void ) const [inline]

Definition at line 214 of file string.h.

  { return GetData()->nDataLength == 0; }

LPWSTR CString::LockBuffer ( )

Definition at line 538 of file string.Cpp.

{
  LPWSTR lpsz = GetBuffer(0);
  GetData()->nRefs = -1;
  return lpsz;
}

CString::operator LPCWSTR ( ) const [inline]

Definition at line 216 of file string.h.

  { return m_pchData; }

const CString & CString::operator+= ( LPCWSTR lpsz )

Definition at line 469 of file string.Cpp.

{
  ConcatInPlace(SafeStrlen(lpsz), lpsz);
  return *this;
}

const CString & CString::operator+= ( const CString & string )

Definition at line 481 of file string.Cpp.

{
  ConcatInPlace(string.GetData()->nDataLength, string.m_pchData);
  return *this;
}

const CString & CString::operator+= ( WCHAR ch )

Definition at line 475 of file string.Cpp.

{
  ConcatInPlace(1, &ch);
  return *this;
}

const CString& CString::operator= ( LPCWSTR lpsz ) [inline]

Definition at line 70 of file string.h.

  {
    AssignCopy(SafeStrlen(lpsz), lpsz);
    return *this;
  }

const CString & CString::operator= ( WCHAR ch )

Definition at line 55 of file string.Cpp.

{
  AssignCopy(1, &ch);
  return *this;
}

const CString& CString::operator= ( LPCSTR lpsz )
const CString& CString::operator= ( const unsigned char * psz )
const CString & CString::operator= ( const CString & stringSrc )

Definition at line 355 of file string.Cpp.

{
  if (m_pchData != stringSrc.m_pchData)
  {
    if ((GetData()->nRefs < 0 && GetData() != _epDataNil) ||
      stringSrc.GetData()->nRefs < 0)
    {
      // actual copy necessary since one of the strings is locked
      AssignCopy(stringSrc.GetData()->nDataLength, stringSrc.m_pchData);
    }
    else
    {
      // can just copy references around
      Release();
      m_pchData = stringSrc.m_pchData;
      InterlockedIncrement(&GetData()->nRefs);
    }
  }
  return *this;
}

WCHAR CString::operator[] ( int nIndex ) const [inline]

Definition at line 229 of file string.h.

{
  // same as GetAt
  return m_pchData[nIndex];
}

void CString::Release ( CStringData * pData ) [static, protected]

Definition at line 276 of file string.Cpp.

{
  if (pData != _epDataNil)
  {
    if (InterlockedDecrement(&pData->nRefs) <= 0)
      FreeData(pData);
  }
}

void CString::Release ( ) [protected]

Definition at line 266 of file string.Cpp.

{
  if (GetData() != _epDataNil)
  {
    if (InterlockedDecrement(&GetData()->nRefs) <= 0)
      FreeData(GetData());
    Init();
  }
}

void CString::ReleaseBuffer ( int nNewLength = -1 )

Definition at line 508 of file string.Cpp.

{
  CopyBeforeWrite();  // just in case GetBuffer was not called

  if (nNewLength == -1)
    nNewLength = wcslen(m_pchData); // zero terminated

  GetData()->nDataLength = nNewLength;
  m_pchData[nNewLength] = L'\0';
}

int CString::SafeStrlen ( LPCWSTR lpsz ) [inline, static, protected]

Definition at line 218 of file string.h.

  { return (lpsz == NULL) ? 0 : wcslen(lpsz); }

void CString::SetAt | ( | int | nIndex,
 |  | WCHAR | ch
 | ) |  |
void CString::UnlockBuffer ( )

Definition at line 545 of file string.Cpp.

{
  if (GetData() != _epDataNil)
    GetData()->nRefs = 1;
}

Friends And Related Function Documentation

CString operator+ | ( | const CString & | string1,
 |  | const CString & | string2 |
 | ) |  |  | [friend]

Definition at line 402 of file string.Cpp.

{
  CString s;
  s.ConcatCopy(string1.GetData()->nDataLength, string1.m_pchData,
    string2.GetData()->nDataLength, string2.m_pchData);
  return s;
}

CString operator+ | ( | LPCWSTR | lpsz,
 |  | const CString & | string |
 | ) |  |  | [friend]

Definition at line 418 of file string.Cpp.

{
  CString s;
  s.ConcatCopy(CString::SafeStrlen(lpsz), lpsz, string.GetData()->nDataLength,
    string.m_pchData);
  return s;
}

CString operator+ | ( | const CString & | string,
 |  | LPCWSTR | lpsz |
 | ) |  |  | [friend]

Definition at line 410 of file string.Cpp.

{
  CString s;
  s.ConcatCopy(string.GetData()->nDataLength, string.m_pchData,
    CString::SafeStrlen(lpsz), lpsz);
  return s;
}

CString operator+ | ( | WCHAR | ch,
 |  | const CString & | string |
 | ) |  |  | [friend]

Definition at line 433 of file string.Cpp.

{
  CString s;
  s.ConcatCopy(1, &ch, string.GetData()->nDataLength, string.m_pchData);
  return s;
}

CString operator+ | ( | const CString & | string,
 |  | WCHAR | ch |
 | ) |  |  | [friend]

Definition at line 426 of file string.Cpp.

{
  CString s;
  s.ConcatCopy(string1.GetData()->nDataLength, string1.m_pchData, 1, &ch);
  return s;
}

Member Data Documentation

LPWSTR CString::m_pchData

Definition at line 139 of file string.h.

The documentation for this class was generated from the following files:
  • Com/Tools/EntityProxy/DataServices/string.h
  • Com/Tools/EntityProxy/DataServices/string.Cpp
Generated on Wed Nov 13 2024 16:57:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CStringData Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CStringData Struct Reference

#include "string.h"

List of all members.

Public Member Functions

WCHAR * | data ()

Public Attributes

int | nAllocLength
int | nDataLength
long | nRefs

Detailed Description

Definition at line 4 of file string.h.

Member Function Documentation

WCHAR* CStringData::data ( ) [inline]

Definition at line 11 of file string.h.

    { return (WCHAR*)(this+1); }

Member Data Documentation

int CStringData::nAllocLength

Definition at line 8 of file string.h.

int CStringData::nDataLength

Definition at line 7 of file string.h.

long CStringData::nRefs

Definition at line 6 of file string.h.

The documentation for this struct was generated from the following file:
  • Com/Tools/EntityProxy/DataServices/string.h
Generated on Wed Nov 13 2024 16:57:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CStringException Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CStringException Class Reference

List of all members.

Public Member Functions

CStringException (CSZ cszError) throw ()
operator CSZ (VOID) throw ()

Private Attributes

stringW m_strError

Detailed Description

Definition at line 56 of file AdsiDump.cpp.

Constructor & Destructor Documentation

CStringException::CStringException ( CSZ cszError ) throw () [inline]

Definition at line 59 of file AdsiDump.cpp.

        {
        Assert(cszError);
        m_strError = cszError;
        }

Member Function Documentation

CStringException::operator CSZ ( VOID ) throw () [inline]

Definition at line 65 of file AdsiDump.cpp.

        { return m_strError.c_str(); }

Member Data Documentation

stringW CStringException::m_strError [private]

Definition at line 69 of file AdsiDump.cpp.

The documentation for this class was generated from the following file:
  • NetDS/ADSI/samples/General/ADSIDump/AdsiDump.cpp
Generated on Wed Nov 13 2024 16:57:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CStringTable Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CStringTable Class Reference

#include "CStrTabl.h"

List of all members.

Public Member Functions

CStringTable (HINSTANCE)
~CStringTable (void)
BOOL FInit (UINT, UINT, UINT)
const LPSTR | operator[] (const UINT) const

Protected Attributes

USHORT m_cStrings
HINSTANCE | m_hInst
UINT m_idsMax
UINT m_idsMin
LPSTR * m_ppszTable
LPSTR m_pszStrings

Detailed Description

Definition at line 27 of file CStrTabl.h.

Constructor & Destructor Documentation

CStringTable::CStringTable ( HINSTANCE hInst )

Definition at line 33 of file CStrTabl.Cpp.

    {
    m_hInst=hInst;
    m_pszStrings=NULL;
    m_ppszTable=NULL;
    return;
    }

CStringTable::~CStringTable ( void )

Definition at line 46 of file CStrTabl.Cpp.

    {
    if (NULL!=m_pszStrings)
        free(m_pszStrings);

    if (NULL!=m_ppszTable)
        free(m_ppszTable);

    return;
    }

Member Function Documentation

BOOL CStringTable::FInit | ( | UINT | idsMin,
 |  | UINT | idsMax,
 |  | UINT | cchMax
 | ) |  |

Definition at line 71 of file CStrTabl.Cpp.

    {
    UINT        i;
    UINT        cch;
    UINT        cchUsed=0;
    LPSTR       psz;

    m_idsMin=idsMin;
    m_idsMax=idsMax;
    m_cStrings=(idsMax-idsMin+1);

    //Allocate space for the pointer table.
    m_ppszTable=(LPSTR *)malloc(sizeof(LPSTR)*m_cStrings);

    if (NULL==m_ppszTable)
        return FALSE;
     // Allocate enough memory for cStrings*cchMax characters.  80
     // characters is the maximum string length we allow.  This
     // will result in some unused memory, but a few K is not
     // worth quibbling over.
    m_pszStrings=(LPSTR)malloc(m_cStrings * cchMax);

    if (NULL==m_pszStrings)
        {
        free(m_ppszTable);
        m_ppszTable=NULL;
        return FALSE;
        }
     // Load the strings:  we load each string in turn into psz,
     // store the string pointer into the table and increment psz
     // to the next positions.
    psz=m_pszStrings;

    for (i=idsMin; i <= idsMax; i++)
        {
        m_ppszTable[i-idsMin]=psz;
        cch=LoadString(m_hInst, i, psz, 255);

        //Account for a null terminator with +1
        psz    +=cch+1;
        cchUsed+=cch;
        }

    return TRUE;
    }

const LPSTR CStringTable::operator[] ( const UINT uID ) const

Definition at line 122 of file CStrTabl.Cpp.

    {
    if (uID < m_idsMin || uID > m_idsMax)
        return NULL;

    return (const LPSTR)m_ppszTable[uID-m_idsMin];
    }

Member Data Documentation

USHORT CStringTable::m_cStrings [protected]

Definition at line 33 of file CStrTabl.h.

HINSTANCE CStringTable::m_hInst [protected]

Definition at line 30 of file CStrTabl.h.

UINT CStringTable::m_idsMax [protected]

Definition at line 32 of file CStrTabl.h.

UINT CStringTable::m_idsMin [protected]

Definition at line 31 of file CStrTabl.h.

LPSTR* CStringTable::m_ppszTable [protected]

Definition at line 35 of file CStrTabl.h.

LPSTR CStringTable::m_pszStrings [protected]

Definition at line 34 of file CStrTabl.h.

The documentation for this class was generated from the following files:
  • WinUI/Shell/FileView/CStrTabl.h
  • WinUI/Shell/FileView/CStrTabl.Cpp
Generated on Wed Nov 13 2024 16:57:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSurrogate Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CSurrogate Class Reference

#include "csur.h"

List of all members.

Public Member Functions

CSurrogate ()
virtual | ~CSurrogate ()
STDMETHOD() | FreeSurrogate ()
STDMETHOD() | LoadDllServer (REFCLSID rclsid)
STDMETHOD() | QueryInterface (REFIID iid, LPVOID *ppv)
STDMETHOD_ (ULONG, AddRef)()
STDMETHOD_ (ULONG, Release)()

Private Attributes

std::stack
< CClassFactoryWrapper * > 		m_stkClassFactories

Detailed Description

Definition at line 21 of file csur.h.

Constructor & Destructor Documentation

CSurrogate::CSurrogate ( ) [inline]

Definition at line 28 of file csur.h.

{};

virtual CSurrogate::~CSurrogate ( ) [inline, virtual]

Definition at line 29 of file csur.h.

{};

Member Function Documentation

STDMETHODIMP CSurrogate::FreeSurrogate ( )

Definition at line 108 of file csur.Cpp.

{
  OutputDebugString("ISurrogate::FreeSurrogate() called.");
  // revoke all of our class factory wrapper objects from COM
  size_t i = m_stkClassFactories.size();
  while (i--)
  {
    CoRevokeClassObject(m_stkClassFactories.top()->m_dwReg);
    m_stkClassFactories.top()->Release();
    m_stkClassFactories.pop();
  }

  // terminate the message pump
  PostQuitMessage(0);
  return S_OK;
}

STDMETHODIMP CSurrogate::LoadDllServer ( REFCLSID rclsid )

Definition at line 79 of file csur.Cpp.

{
  OutputDebugString("ISurrogate::LoadDllServer() called.");
  // instantiate a new class factory wrapper object
  CClassFactoryWrapper * pcfw = new CClassFactoryWrapper(rclsid);

  if (!pcfw) return E_OUTOFMEMORY;

  // register this new class factory wrapper (use REGCLS_SURROGATE)
  pcfw->AddRef();
  HRESULT hr = CoRegisterClassObject(rclsid, (IClassFactory*)pcfw,
                    CLSCTX_LOCAL_SERVER, REGCLS_SURROGATE,
                    &pcfw->m_dwReg);

  // push this one into our stack
  if (SUCCEEDED(hr))
    m_stkClassFactories.push(pcfw);
  else
    pcfw->Release();
  return hr;
}

STDMETHOD() CSurrogate::QueryInterface | ( | REFIID | iid,
 |  | LPVOID * | ppv
 | ) |  |
CSurrogate::STDMETHOD_ | ( | ULONG | ,
 |  | Release |
 | ) |  |
CSurrogate::STDMETHOD_ | ( | ULONG | ,
 |  | AddRef |
 | ) |  |

Member Data Documentation

std::stack<CClassFactoryWrapper*> CSurrogate::m_stkClassFactories [private]

Definition at line 25 of file csur.h.

The documentation for this class was generated from the following files:
  • Com/Fundamentals/CustomSurrogate/Surrog/csur.h
  • Com/Fundamentals/CustomSurrogate/Surrog/csur.Cpp
Generated on Wed Nov 13 2024 16:57:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSyncMgrHandler Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes | Friends

CSyncMgrHandler Class Reference

#include "Handler.h"

Inherits CLockHandler.

List of all members.

Public Member Functions

CSyncMgrHandler ()
~CSyncMgrHandler ()
STDMETHODIMP | EnumSyncMgrItems (ISyncMgrEnumItems **ppenumOffineItems)
STDMETHODIMP | GetHandlerInfo (LPSYNCMGRHANDLERINFO *ppSyncMgrHandlerInfo)
STDMETHODIMP | GetItemObject (REFSYNCMGRITEMID ItemID, REFIID riid, void **ppv)
STDMETHODIMP | Initialize (DWORD dwReserved, DWORD dwSyncFlags, DWORD cbCookie, const BYTE *lpCooke)
STDMETHODIMP | PrepareForSync (ULONG cbNumItems, SYNCMGRITEMID *pItemIDs, HWND hWndParent, DWORD dwReserved)
void | PrepareForSyncCall (ULONG cbNumItems, SYNCMGRITEMID *pItemIDs, HWND hWndParent, DWORD dwReserved)
STDMETHODIMP | QueryInterface (REFIID, LPVOID FAR *)
STDMETHODIMP | SetItemStatus (REFSYNCMGRITEMID ItemID, DWORD dwSyncMgrStatus)
STDMETHODIMP | SetProgressCallback (ISyncMgrSynchronizeCallback *lpCallBack)
STDMETHODIMP | ShowError (HWND hWndParent, REFSYNCMGRERRORID ErrorID)
void | ShowErrorCall (HWND hWndParent, REFSYNCMGRERRORID ErrorID)
STDMETHODIMP | ShowProperties (HWND hWndParent, REFSYNCMGRITEMID ItemID)
void | ShowPropertiesCall (HWND hWndParent, REFSYNCMGRITEMID ItemID)
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP | Synchronize (HWND hWndParent)
void | SynchronizeCall (HWND hWndParent)

Private Member Functions

BOOL | CopyFileFullPath (TCHAR *pszFile1, TCHAR *pszFile2)
void | CopyFiles (LPHANDLERITEM_SYNCSTATUS pHandlerItemID, LPHANDLERITEMSETTINGS pHandlerSyncItem, LPSYNCMGRSYNCHRONIZECALLBACK pCallback, DWORD *pdwCurProgValue, TCHAR *pszDir1, LPFILEOBJECTLIST pDir1, TCHAR *pszDir2)
ULONG | CountNumberOfFilesInList (LPFILEOBJECTLIST pfObjList, BOOL fRecursive)
LPFILEOBJECTLIST | CreateDirFileListFromPath (TCHAR *pDirName, BOOL fRecursive)
STDMETHODIMP | CreateWorkerThread ()
LPFILEOBJECT | FindFileItemWithName (LPFILEOBJECTLIST pDir, TCHAR *pfName)
LPFILEOBJECTLIST | GetFilesForDir (TCHAR *pDirName, BOOL fRecursive)
LPSYNCMGRSYNCHRONIZECALLBACK | GetProgressCallback ()
void | LogError (ISyncMgrSynchronizeCallback *lpCallBack, REFSYNCMGRITEMID pItemID, DWORD dwErrorLevel, TCHAR *lpErrorText, DWORD mask, DWORD dwSyncMgrErrorFlags, SYNCMGRERRORID ErrorID)
void | LogError (ISyncMgrSynchronizeCallback *lpCallBack, REFSYNCMGRITEMID pItemID, DWORD dwErrorLevel, TCHAR *lpErrorText)
void | LogError (ISyncMgrSynchronizeCallback *lpCallBack, DWORD dwErrorLevel, TCHAR *lpErrorText)
void | Progress (ISyncMgrSynchronizeCallback *lpCallBack, REFSYNCMGRITEMID pItemID, UINT mask, TCHAR *pStatusText, DWORD dwStatusType, int iProgValue, int iMaxValue)
void | ProgressSetItemProgMaxValue (ISyncMgrSynchronizeCallback *lpCallBack, REFSYNCMGRITEMID pItemID, int iProgMaxValue)
void | ProgressSetItemProgValue (ISyncMgrSynchronizeCallback *lpCallBack, REFSYNCMGRITEMID pItemID, int iProgValue)
void | ProgressSetItemStatusText (ISyncMgrSynchronizeCallback *lpCallBack, REFSYNCMGRITEMID pItemID, TCHAR *pStatusText)
void | ProgressSetItemStatusType (ISyncMgrSynchronizeCallback *lpCallBack, REFSYNCMGRITEMID pItemID, DWORD dwSyncMgrStatus)
void | ReconcileDir (HWND hWndParent, LPHANDLERITEM_SYNCSTATUS pHandlerItemID, LPHANDLERITEMSETTINGS pHandlerSyncItem, LPSYNCMGRSYNCHRONIZECALLBACK pCallback, DWORD *pdwCurProgValue, TCHAR *pszDir1, LPFILEOBJECTLIST pDir1, TCHAR *pszDir2, LPFILEOBJECTLIST pDir2)
void | ReleaseFileObjectList (LPFILEOBJECTLIST pfObjList, BOOL fRecursive)
void | SyncDirs (HWND hWndParent, LPHANDLERITEM_SYNCSTATUS pHandlerItemID, LPHANDLERITEMSETTINGS pHandlerSyncItem)

Private Attributes

DWORD m_cRef
DWORD m_dwSyncFlags
BOOL m_fPrepareForSync
BOOL m_fStopped
BOOL m_fSynchronizing
HWND | m_hwndHandler
HWND | m_hwndWorker
HANDLE m_phThread
LPGENERICITEMLIST m_pItemsToSyncList
LPSYNCMGRSYNCHRONIZECALLBACK | m_pSyncMgrSynchronizeCallback

Friends

LRESULT CALLBACK | HandlerThreadWndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)

Detailed Description

Definition at line 44 of file Handler.h.

Constructor & Destructor Documentation

CSyncMgrHandler::CSyncMgrHandler ( )

Definition at line 32 of file Handler.Cpp.

{
    g_cRefThisDll++;

    m_cRef = 1;
    m_phThread = NULL;
    m_pSyncMgrSynchronizeCallback = NULL;
    m_pItemsToSyncList = NULL;
    m_dwSyncFlags = 0;
    m_hwndWorker = FALSE;
    m_hwndHandler = FALSE;
    m_fSynchronizing = FALSE;
    m_fPrepareForSync = FALSE;
    m_fStopped = FALSE;

}

CSyncMgrHandler::~CSyncMgrHandler ( )

Definition at line 64 of file Handler.Cpp.

{
    Assert(NULL == m_pSyncMgrSynchronizeCallback);

    Assert(NULL == m_pItemsToSyncList);

    if (m_phThread)
    {
    HANDLE hThread = m_phThread;

        m_phThread = NULL;

        PostMessage(m_hwndWorker,WM_WORKERMSG_RELEASE,0,0);

        WaitForSingleObject(hThread,INFINITE); // wait for thread to go away
        CloseHandle(hThread);
    }

    if (m_hwndHandler)
    {
        DestroyWindow(m_hwndHandler);
        m_hwndHandler = NULL;
    }

    g_cRefThisDll--;
}

Member Function Documentation

BOOL CSyncMgrHandler::CopyFileFullPath | ( | TCHAR * | pszFile1,
 |  | TCHAR * | pszFile2 |
 | ) |  |  | [private]

Definition at line 1596 of file Handler.Cpp.

{
HANDLE hfile;
DWORD dwAttribs;
FILETIME ftCreate,ftLastAccess,ftLastWrite;
BOOL fOk;

    fOk = CopyFile(pszFile1, pszFile2, FALSE);

    if (fOk)
    {
    BOOL fFileTime = FALSE;

        // having copied the file, now copy the times, attributes
        // if fail to get go ahead and say copy succeeded.

        hfile = CreateFile(pszFile1, GENERIC_READ, 0, NULL,
                        OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);

        if (INVALID_HANDLE_VALUE != hfile)
        {

            fFileTime = GetFileTime(hfile, &ftCreate,
                            &ftLastAccess, &ftLastWrite);
            CloseHandle(hfile);
        }

        if (fFileTime)
        {
            hfile = CreateFile(pszFile2, GENERIC_WRITE, 0, NULL,
                            OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);

            if (INVALID_HANDLE_VALUE != hfile)
            {
                SetFileTime(hfile, &ftCreate,
                                   &ftLastAccess,
                                   &ftLastWrite);

                CloseHandle(hfile);
            }
        }

        // update attributes
        dwAttribs = GetFileAttributes(pszFile1);
        if (-1 != dwAttribs)
        {
            SetFileAttributes(pszFile2,dwAttribs);
        }

    }

    return fOk;
}

void CSyncMgrHandler::CopyFiles | ( | LPHANDLERITEM_SYNCSTATUS | pHandlerItemID,
 |  | LPHANDLERITEMSETTINGS | pHandlerSyncItem,
 |  | LPSYNCMGRSYNCHRONIZECALLBACK | pCallback,
 |  | DWORD * | pdwCurProgValue,
 |  | TCHAR * | pszDir1,
 |  | LPFILEOBJECTLIST | pDir1,
 |  | TCHAR * | pszDir2 |
 | ) |  |  | [private]

Definition at line 1665 of file Handler.Cpp.

{
LPFILEOBJECT pCurDir1Item;
LPFILEOBJECT pNextDir1Item;

    // anything left is list when done is unique and needs to be copied
    // walk through each list moving the items.
    pNextDir1Item = (LPFILEOBJECT) pDir1->pFirstGenericItem;

    while(pNextDir1Item)
    {

       // each time through the loop check for if item is cancelled
       // and if so return;
       if (pHandlerItemID->fCancelled)
            return;

        Assert(sizeof(FILEOBJECT ) == pNextDir1Item->genericItem.cbSize);
        pCurDir1Item = pNextDir1Item;

        pNextDir1Item = (LPFILEOBJECT) pNextDir1Item->genericItem.pNextGenericItem;

        if (pCurDir1Item->fDirectory)
        {
            if (pCurDir1Item->pChildList)
            {
            TCHAR szDir1[MAX_PATH];
            TCHAR szDir2[MAX_PATH];

                wsprintf(szDir1,TEXT("%s\\%s"),pszDir1,pCurDir1Item->fName);
                wsprintf(szDir2,TEXT("%s\\%s"),pszDir2,pCurDir1Item->fName);

                // create destination dir if necessary.
                CreateDirectory(szDir2,NULL);

                CopyFiles(pHandlerItemID,pHANDLERITEMSETTINGS,pCallback,pdwCurProgValue,
                                szDir1,pCurDir1Item->pChildList,szDir2);
            }

        }
        else
        {
        TCHAR szFullPath1[MAX_PATH];
        TCHAR szFullPath2[MAX_PATH];
        TCHAR szProgress[MAX_PATH];

            wsprintf(szProgress,TEXT("Copying %s"),pCurDir1Item->fName);
            ProgressSetItemStatusText(pCallback,pHANDLERITEMSETTINGS->ItemID,szProgress);

            wsprintf(szFullPath1,TEXT("%s\\%s"),pszDir1,pCurDir1Item->fName);
            wsprintf(szFullPath2,TEXT("%s\\%s"),pszDir2,pCurDir1Item->fName);

            // copy the file over
            if (FALSE == CopyFileFullPath(szFullPath1,szFullPath2))
            {
                wsprintf(szProgress,TEXT("Error Copying %s"),pCurDir1Item->fName);

                LogError(pCallback,pHANDLERITEMSETTINGS->ItemID,SYNCMGRLOGLEVEL_ERROR,
                                    szProgress);
            }

            // update the progress bar value.
             *pdwCurProgValue += 1;
            ProgressSetItemProgValue(pCallback,pHANDLERITEMSETTINGS->ItemID,*pdwCurProgValue);

            // always release, even on
            DeleteItemFromList(pDir1,(LPGENERICITEM) pCurDir1Item);

        }

    }

}

ULONG CSyncMgrHandler::CountNumberOfFilesInList | ( | LPFILEOBJECTLIST | pfObjList,
 |  | BOOL | fRecursive |
 | ) |  |  | [private]

Definition at line 1501 of file Handler.Cpp.

{
LPFILEOBJECT pCurItem;
ULONG ulTotalCount = 0;

    if (!pfObjList)
    {
        Assert(pfObjList)
        return 0;
    }

    // see if object has any childs and free them if they do.
    pCurItem= (LPFILEOBJECT) pfObjList->pFirstGenericItem;

    while(pCurItem)
    {
        Assert(sizeof(FILEOBJECT ) == pCurItem->genericItem.cbSize);

        if (pCurItem->fDirectory)
        {
            Assert(pCurItem->pChildList || (!fRecursive));

            if (pCurItem->pChildList)
            {
                ulTotalCount += CountNumberOfFilesInList(pCurItem->pChildList,fRecursive);
            }
        }
        else
        {
            ++ulTotalCount;
        }

        pCurItem = (LPFILEOBJECT) pCurItem->genericItem.pNextGenericItem;
    }

    return ulTotalCount;
}

LPFILEOBJECTLIST CSyncMgrHandler::CreateDirFileListFromPath | ( | TCHAR * | pDirName,
 |  | BOOL | fRecursive |
 | ) |  |  | [private]

Definition at line 1407 of file Handler.Cpp.

{
LPFILEOBJECTLIST pDirObj;
BOOL fValidDir = FALSE;

    if (!IsValidDir(pDirName))
    {
        return NULL;
    }

    pDirObj = CreateItemList();

    if (pDirObj)
    {
    LPFILEOBJECT pFileObject;

        // go ahead and add this as the toplevel dir
        pFileObject = (LPFILEOBJECT) AddNewItemToList(pDirObj,sizeof(FILEOBJECT));

        if (pFileObject)
        {
            pFileObject->fDirectory = TRUE;
            lstrcpy(pFileObject->fName,pDirName);

            pFileObject->pChildList = GetFilesForDir(pFileObject->fName,fRecursive);

        }
    }

    return pDirObj;
}

HRESULT CSyncMgrHandler::CreateWorkerThread ( ) [private]

Definition at line 264 of file Handler.Cpp.

{
HRESULT hr = E_FAIL;
HANDLE hNewThread = NULL;
DWORD dwThreadID;
WorkerThreadArgs ThreadArgs;

    ThreadArgs.hEvent = CreateEvent(NULL,FALSE,FALSE,NULL);
    ThreadArgs.pThis = this;

    if (ThreadArgs.hEvent)
    {
    hNewThread = CreateThread(NULL,0,WorkerThread,&ThreadArgs,0,&dwThreadID);

    if (hNewThread)
    {
       WaitForSingleObject(ThreadArgs.hEvent,INFINITE);
       if (NOERROR == ThreadArgs.hr)
       {
                m_hwndWorker = ThreadArgs.hwnd;
                m_phThread = hNewThread;
        hr = NOERROR;
       }
       else
       {
        CloseHandle(hNewThread);
        hr = ThreadArgs.hr;
       }

    }
    else
    {
        hr = GetLastError();
    }

    CloseHandle(ThreadArgs.hEvent);
    }

    return hr;
}

STDMETHODIMP CSyncMgrHandler::EnumSyncMgrItems ( ISyncMgrEnumItems ** ppenumOffineItems )

Definition at line 382 of file Handler.Cpp.

{

    Assert(g_pSettings);

    if (g_pSettings)
    {
        return g_pSettings->EnumSyncMgrItems(ppenumOffineItems);
    }

    return E_UNEXPECTED;
}

LPFILEOBJECT CSyncMgrHandler::FindFileItemWithName | ( | LPFILEOBJECTLIST | pDir,
 |  | TCHAR * | pfName |
 | ) |  |  | [private]

Definition at line 1554 of file Handler.Cpp.

{
LPFILEOBJECT pCurItem = NULL;

    if (!pDir)
    {
        Assert(pDir)
        return NULL;
    }

    // see if object has any childs and free them if they do.
    pCurItem= (LPFILEOBJECT) pDir->pFirstGenericItem;

    while(pCurItem)
    {
        Assert(sizeof(FILEOBJECT ) == pCurItem->genericItem.cbSize);

        if (0 == lstrcmp(pfName,pCurItem->fName))
        {
            break;
        }

        pCurItem = (LPFILEOBJECT) pCurItem->genericItem.pNextGenericItem;
    }

    return pCurItem;
}

LPFILEOBJECTLIST CSyncMgrHandler::GetFilesForDir | ( | TCHAR * | pDirName,
 |  | BOOL | fRecursive |
 | ) |  |  | [private]

*******

Definition at line 1305 of file Handler.Cpp.

{
LPFILEOBJECTLIST pDirList;
HANDLE hFind;
BOOL bMore;
WIN32_FIND_DATA finddata;
TCHAR szSearch[MAX_PATH];

    pDirList = CreateItemList();

    if (!pDirList)
    {
        return NULL;
    }

    wsprintf(szSearch,TEXT("%s\\*.*"),pDirName);

    hFind = FindFirstFile(szSearch, &finddata);
    bMore = (hFind != (HANDLE) -1);

    while (bMore) {

            if ( (lstrcmp(finddata.cFileName, TEXT(".")) != 0) &&
                           ( lstrcmp(finddata.cFileName, TEXT("..")) != 0) )
            {
            LPFILEOBJECT pFileObject = (LPFILEOBJECT) AddNewItemToList(pDirList,sizeof(FILEOBJECT));
            BOOL bIsDir;

                if (!pFileObject) // if alloc ever fails just bail.
                {
                    break;
                }

                // init the data.
                lstrcpy(pFileObject->fName,finddata.cFileName);

                bIsDir = (finddata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? TRUE : FALSE;
                pFileObject->fDirectory = bIsDir;

                if (!bIsDir)
                {
                HANDLE hFile;
                FILETIME ftCreate;
                FILETIME ftLastAccess;

                    // Review - need to check failure
                    // and if way to get modified with openning file.

                    wsprintf(szSearch,TEXT("%s\\%s"),pDirName,pFileObject->fName);

                    hFile = CreateFile(szSearch, GENERIC_READ, 0, NULL,
                                    OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);

                    if (GetFileTime(hFile, &ftCreate,
                                    &ftLastAccess,&(pFileObject->ftLastUpdate)) )
                    {
                        pFileObject->fLastUpdateValid = TRUE;
                    }

                    CloseHandle(hFile);

                }
                else
                {
                    // if this is a directory and recursive, get children
                    if (fRecursive)
                    {
                    TCHAR szFullPath[MAX_PATH];

                        // fullpath is current dir name + \ + this dir name.
                        wsprintf(szFullPath,TEXT("%s\\%s"),pDirName,pFileObject->fName);

                        pFileObject->pChildList =
                                GetFilesForDir(szFullPath,fRecursive);
                    }
                }
            }

            bMore = FindNextFile(hFind, &finddata);
    }

    FindClose(hFind);

    return pDirList;
}

STDMETHODIMP CSyncMgrHandler::GetHandlerInfo ( LPSYNCMGRHANDLERINFO * ppSyncMgrHandlerInfo )

Definition at line 321 of file Handler.Cpp.

{
LPSYNCMGRHANDLERINFO pSyncInfo;

    if (!ppSyncMgrHandlerInfo)
    {
        Assert(ppSyncMgrHandlerInfo)
        return E_INVALIDARG;
    }

    pSyncInfo = (LPSYNCMGRHANDLERINFO) CoTaskMemAlloc(sizeof(SYNCMGRHANDLERINFO));

    if (pSyncInfo)
    {
        pSyncInfo->cbSize = sizeof(SYNCMGRHANDLERINFO);
        pSyncInfo->hIcon = LoadIcon(g_hmodThisDll,MAKEINTRESOURCE(IDI_SAMPLEHANDLERICON));
        pSyncInfo->SyncMgrHandlerFlags = SYNCMGRHANDLER_HASPROPERTIES;
        pSyncInfo->SyncMgrHandlerFlags |= SYNCMGRHANDLER_ALWAYSLISTHANDLER;
        lstrcpyW(pSyncInfo->wszHandlerName,L"Sample Handler");
    }

    *ppSyncMgrHandlerInfo = pSyncInfo;

    return *ppSyncMgrHandlerInfo ? NOERROR : E_OUTOFMEMORY;
}

STDMETHODIMP CSyncMgrHandler::GetItemObject | ( | REFSYNCMGRITEMID | ItemID,
 |  | REFIID | riid,
 |  | void ** | ppv
 | ) |  |

Definition at line 362 of file Handler.Cpp.

{

    return E_NOTIMPL;
}

LPSYNCMGRSYNCHRONIZECALLBACK CSyncMgrHandler::GetProgressCallback ( ) [private]

Definition at line 517 of file Handler.Cpp.

{
#ifdef _USECURRENTTHREADFORCALLBACK
LPSYNCMGRSYNCHRONIZECALLBACK pCallback;
CLock clock(this);

    clock.Enter();

    pCallback = m_pSyncMgrSynchronizeCallback;

    if (pCallback)
    {
        pCallback->AddRef();
    }

    clock.Leave();

    return pCallback;
#else
    return new CCallbackWrapper(m_hwndHandler);
#endif

}

STDMETHODIMP CSyncMgrHandler::Initialize | ( | DWORD | dwReserved,
 |  | DWORD | dwSyncFlags,
 |  | DWORD | cbCookie,
 |  | const BYTE * | lpCooke
 | ) |  |

Definition at line 187 of file Handler.Cpp.

{
HRESULT hr = NOERROR;

    m_dwSyncFlags = dwSyncFlags;

    RegisterHandlerWndClasses();

    // create hwnd for main class.
    m_hwndHandler = CreateWindowEx(0,
              SZ_SAMPLESYNCMGRHANDLERWNDCLASS,
              TEXT(""),
              // must use WS_POPUP so the window does not get
              // assigned a hot key by user.
              (WS_DISABLED | WS_POPUP),
              CW_USEDEFAULT,
              CW_USEDEFAULT,
              CW_USEDEFAULT,
              CW_USEDEFAULT,
              NULL,
              NULL,
              g_hmodThisDll,
              this);

    if (NULL == m_hwndHandler)
    {
        hr =  E_UNEXPECTED;
    }

    if (NOERROR == hr)
    {
        hr = CreateWorkerThread();
    }

    // if hr is not NOERROR then clean up.
    if (NOERROR != hr)
    {
        if (m_phThread)
        {
        HANDLE hThread = m_phThread;

            m_phThread = NULL;

            PostMessage(m_hwndWorker,WM_WORKERMSG_RELEASE,0,0);

            WaitForSingleObject(hThread,INFINITE); // wait for thread to go away
            CloseHandle(hThread);
        }

        if (m_hwndHandler)
        {
            DestroyWindow(m_hwndHandler);
            m_hwndHandler = NULL;
        }

    }

    return hr;
}

void CSyncMgrHandler::LogError | ( | ISyncMgrSynchronizeCallback * | lpCallBack,
 |  | REFSYNCMGRITEMID | pItemID,
 |  | DWORD | dwErrorLevel,
 |  | TCHAR * | lpErrorText,
 |  | DWORD | mask,
 |  | DWORD | dwSyncMgrErrorFlags,
 |  | SYNCMGRERRORID | ErrorID |
 | ) |  |  | [private]

Definition at line 1214 of file Handler.Cpp.

{
SYNCMGRLOGERRORINFO logError;
WCHAR *pwszErrorText;

    Assert(lpCallBack);

    logError.cbSize = sizeof(SYNCMGRLOGERRORINFO);
    logError.mask = mask | SYNCMGRLOGERROR_ERRORID | SYNCMGRLOGERROR_ERRORFLAGS;
    logError.dwSyncMgrErrorFlags = dwSyncMgrErrorFlags | SYNCMGRERRORFLAG_ENABLEJUMPTEXT;
    logError.ErrorID = ErrorID;
    logError.ItemID = pItemID;

#ifdef _UNICODE
    pwszErrorText = lpErrorText;
#else
    WCHAR wszErrorText[MAX_PATH];

   MultiByteToWideChar(CP_ACP, 0,
                lpErrorText,
                -1, wszErrorText,MAX_PATH);

    pwszErrorText = wszErrorText;
#endif // _UNICODE

    lpCallBack->LogError(dwErrorLevel,pwszErrorText,&logError);
}

void CSyncMgrHandler::LogError | ( | ISyncMgrSynchronizeCallback * | lpCallBack,
 |  | REFSYNCMGRITEMID | pItemID,
 |  | DWORD | dwErrorLevel,
 |  | TCHAR * | lpErrorText |
 | ) |  |  | [private]

Definition at line 1258 of file Handler.Cpp.

{
    LogError(lpCallBack,pItemID,dwErrorLevel,lpErrorText,SYNCMGRLOGERROR_ITEMID,0,GUID_NULL);
}

void CSyncMgrHandler::LogError | ( | ISyncMgrSynchronizeCallback * | lpCallBack,
 |  | DWORD | dwErrorLevel,
 |  | TCHAR * | lpErrorText |
 | ) |  |  | [private]

Definition at line 1278 of file Handler.Cpp.

{
    LogError(lpCallBack,GUID_NULL,dwErrorLevel,lpErrorText,0,0,GUID_NULL);
}

STDMETHODIMP CSyncMgrHandler::PrepareForSync | ( | ULONG | cbNumItems,
 |  | SYNCMGRITEMID * | pItemIDs,
 |  | HWND | hWndParent,
 |  | DWORD | dwReserved
 | ) |  |

Definition at line 557 of file Handler.Cpp.

{
METHODARGS *pMethodArgs;
SYNCMGRITEMID *pItemIdCopy;
LPSYNCMGRSYNCHRONIZECALLBACK pCallback = GetProgressCallback();
CLock clock(this);

    if (!pCallback)
    {
        Assert(pCallback);
        return E_UNEXPECTED;
    }

    pMethodArgs = (METHODARGS*) ALLOC(sizeof(METHODARGS));
    pItemIdCopy = (SYNCMGRITEMID *) ALLOC(sizeof(SYNCMGRITEMID) * cbNumItems);

    // create items list before kicking off async call so can handle case
    // skip and stop come in before PrepareForSyncCall is handled.

    clock.Enter();

    m_fStopped = FALSE; // always reset stop on a new PrepareForSync, (for example retry came in)
    m_fPrepareForSync = TRUE;

    Assert(NULL == m_pItemsToSyncList);
    m_pItemsToSyncList = CreateItemList();

     // lookup and request a lock on the items to synchronize
    // we then place the ones that we found and have permission into our
    // own private sync queue.

    if (g_pSettings && m_pItemsToSyncList)
    {
    ULONG ulIndex;
    SYNCMGRITEMID *pCurItemID;

        pCurItemID = pItemIDs;

        for (ulIndex = 0 ; ulIndex < cbNumItems; ++ulIndex)
        {
        BOOL fAdded = FALSE;;

            if (g_pSettings->RequestItemLock(this,*pCurItemID))
            {
            LPHANDLERITEM_SYNCSTATUS pNewItem;

                pNewItem = (LPHANDLERITEM_SYNCSTATUS) AddNewItemToList(m_pItemsToSyncList,sizeof(HANDLERITEM_SYNCSTATUS));

                if (pNewItem)
                {
                    pNewItem->ItemID = *pCurItemID;
                    fAdded = TRUE;
                }
                else
                {
                    // not enough memory to allocate itemList,
                    LogError(pCallback,(*pCurItemID),SYNCMGRLOGLEVEL_ERROR,
                                    TEXT("Not Enough Memory to Synchronize"));

                    // update progress for this item
                    ProgressSetItemStatusType(pCallback,(*pCurItemID),SYNCMGRSTATUS_FAILED);
                }

            }

            if (!fAdded)
            {
                // if another instance already syncing set progress
                // to complete since done but don't update statustext
                // so we dont' stomp the running instance.

                Progress(pCallback,(*pCurItemID),
                    SYNCMGRPROGRESSITEM_PROGVALUE | SYNCMGRPROGRESSITEM_MAXVALUE,
                    NULL,0,100,100);
            }

            ++pCurItemID;
        }
    }

    if (NULL == pMethodArgs || NULL == pItemIdCopy || NULL == m_pItemsToSyncList)
    {
        Assert(pMethodArgs);
        Assert(pItemIdCopy);

        if (pMethodArgs)
        {
            FREE(pMethodArgs);
        }

        if (pItemIdCopy)
        {
            FREE(pItemIdCopy);
        }

        if (m_pItemsToSyncList)
        {
            if (0 == Release_ItemList(m_pItemsToSyncList))
            {
                m_pItemsToSyncList = NULL;
            }
        }

        clock.Leave();

        pCallback->Release();
        m_fPrepareForSync = FALSE;

        return E_OUTOFMEMORY;
    }

    clock.Leave();

    // now make the async call
    pMethodArgs->fAsync = TRUE;
    pMethodArgs->dwWorkerMsg = WM_WORKERMSG_PREPFORSYNC;
    pMethodArgs->PrepareForSyncMsg.cbNumItems = cbNumItems;
    pMethodArgs->PrepareForSyncMsg.hWndParent = hWndParent;
    pMethodArgs->PrepareForSyncMsg.dwReserved = dwReserved;

    memcpy(pItemIdCopy,pItemIDs,sizeof(SYNCMGRITEMID) * cbNumItems);
    pMethodArgs->PrepareForSyncMsg.pItemIDs = pItemIdCopy;

    pCallback->Release();

    PostMessage(m_hwndWorker,WM_WORKERMSG_PREPFORSYNC,0,(LPARAM) pMethodArgs);

    return NOERROR;
}

void CSyncMgrHandler::PrepareForSyncCall | ( | ULONG | cbNumItems,
 |  | SYNCMGRITEMID * | pItemIDs,
 |  | HWND | hWndParent,
 |  | DWORD | dwReserved
 | ) |  |

Definition at line 706 of file Handler.Cpp.

{
LPSYNCMGRSYNCHRONIZECALLBACK pCallback = GetProgressCallback();
CLock clock(this);

    if (!pCallback)
    {
        Assert(pCallback);
        return;
    }

    clock.Enter();

    // if a stop came in then release the sync list if any
    if (m_fStopped && m_pItemsToSyncList)
    {
        if (0 == Release_ItemList(m_pItemsToSyncList))
        {
            m_pItemsToSyncList = NULL;
        }
    }

    m_fPrepareForSync = FALSE;

    clock.Leave();

    // currently all PrepareForSync is handled before the async call since we
    // just create a list and store it.

    pCallback->PrepareForSyncCompleted(NOERROR);
    pCallback->Release();

    return;
}

void CSyncMgrHandler::Progress | ( | ISyncMgrSynchronizeCallback * | lpCallBack,
 |  | REFSYNCMGRITEMID | pItemID,
 |  | UINT | mask,
 |  | TCHAR * | pStatusText,
 |  | DWORD | dwStatusType,
 |  | int | iProgValue,
 |  | int | iMaxValue |
 | ) |  |  | [private]

Definition at line 1084 of file Handler.Cpp.

{
SYNCMGRPROGRESSITEM syncProg;
    Assert(lpCallBack);

    syncProg.cbSize = sizeof(SYNCMGRPROGRESSITEM);
    syncProg.mask = mask;

    if (SYNCMGRPROGRESSITEM_STATUSTEXT & mask)
    {
    #ifdef _UNICODE
        syncProg.lpcStatusText = pStatusText;
    #else
        WCHAR wszStatusText[MAX_PATH];

       MultiByteToWideChar(CP_ACP, 0,
                    pStatusText,
                    -1, wszStatusText,MAX_PATH);

        syncProg.lpcStatusText = wszStatusText;
    #endif // _UNICODE
    }

    syncProg.dwStatusType = dwStatusType;
    syncProg.iProgValue = iProgValue;
    syncProg.iMaxValue = iMaxValue;

    lpCallBack->Progress(pItemID,&syncProg);
}

void CSyncMgrHandler::ProgressSetItemProgMaxValue | ( | ISyncMgrSynchronizeCallback * | lpCallBack,
 |  | REFSYNCMGRITEMID | pItemID,
 |  | int | iProgMaxValue |
 | ) |  |  | [private]

Definition at line 1193 of file Handler.Cpp.

{
    Progress(lpCallBack,pItemID,SYNCMGRPROGRESSITEM_MAXVALUE,
                    NULL,0,0,iProgMaxValue);
}

void CSyncMgrHandler::ProgressSetItemProgValue | ( | ISyncMgrSynchronizeCallback * | lpCallBack,
 |  | REFSYNCMGRITEMID | pItemID,
 |  | int | iProgValue |
 | ) |  |  | [private]

Definition at line 1172 of file Handler.Cpp.

{
    Progress(lpCallBack,pItemID,SYNCMGRPROGRESSITEM_PROGVALUE,
                    NULL,0,iProgValue,0);
}

void CSyncMgrHandler::ProgressSetItemStatusText | ( | ISyncMgrSynchronizeCallback * | lpCallBack,
 |  | REFSYNCMGRITEMID | pItemID,
 |  | TCHAR * | pStatusText |
 | ) |  |  | [private]

Definition at line 1151 of file Handler.Cpp.

{
    Progress(lpCallBack,pItemID,SYNCMGRPROGRESSITEM_STATUSTEXT,
                    pStatusText,0,0,0);
}

void CSyncMgrHandler::ProgressSetItemStatusType | ( | ISyncMgrSynchronizeCallback * | lpCallBack,
 |  | REFSYNCMGRITEMID | pItemID,
 |  | DWORD | dwSyncMgrStatus |
 | ) |  |  | [private]

Definition at line 1130 of file Handler.Cpp.

{
    Progress(lpCallBack,pItemID,SYNCMGRPROGRESSITEM_STATUSTYPE,
                    NULL,dwSyncMgrStatus,0,0);
}

STDMETHODIMP CSyncMgrHandler::QueryInterface | ( | REFIID | riid,
 |  | LPVOID FAR * | ppv
 | ) |  |

Definition at line 107 of file Handler.Cpp.

{
    *ppv = NULL;

    if (IsEqualIID(riid, IID_IUnknown))
    {
        *ppv = (LPUNKNOWN)this;
    }
    else if (IsEqualIID(riid, IID_ISyncMgrSynchronize))
    {
        *ppv = (LPSYNCMGRSYNCHRONIZE)this;
    }
    if (*ppv)
    {
        AddRef();

        return NOERROR;
    }

    return E_NOINTERFACE;
}

void CSyncMgrHandler::ReconcileDir | ( | HWND | hWndParent,
 |  | LPHANDLERITEM_SYNCSTATUS | pHandlerItemID,
 |  | LPHANDLERITEMSETTINGS | pHandlerSyncItem,
 |  | LPSYNCMGRSYNCHRONIZECALLBACK | pCallback,
 |  | DWORD * | pdwCurProgValue,
 |  | TCHAR * | pszDir1,
 |  | LPFILEOBJECTLIST | pDir1,
 |  | TCHAR * | pszDir2,
 |  | LPFILEOBJECTLIST | pDir2 |
 | ) |  |  | [private]

Definition at line 1759 of file Handler.Cpp.

{
LPFILEOBJECT pCurDir1Item;
LPFILEOBJECT pCurDir1NextItem;
LPFILEOBJECT pCurDir2Item;

    if (!pDir1 || !pDir2 || !pCallback)
    {
        Assert(pCallback);
        Assert(pDir1);
        Assert(pDir1);
        return;
    }
    // loop through dir finding and comparing matches,
    // if find matching dirs call ReconcileDir
    pCurDir1NextItem= (LPFILEOBJECT) pDir1->pFirstGenericItem;

    while(pCurDir1NextItem)
    {
        Assert(sizeof(FILEOBJECT ) == pCurDir1NextItem->genericItem.cbSize);

        // each time through the loop check for if item is cancelled
        // and if so return;
       if (pHandlerItemID->fCancelled)
            return;

        pCurDir1Item = pCurDir1NextItem;
        pCurDir1NextItem = (LPFILEOBJECT) pCurDir1Item->genericItem.pNextGenericItem;

        pCurDir2Item = FindFileItemWithName(pDir2,pCurDir1Item->fName);

        // if found match, deal with it, else leave in list and
        // catch on the copy pass.
        if (pCurDir2Item)
        {
            // if both directies
            if (pCurDir1Item->fDirectory && pCurDir2Item->fDirectory)
            {
                if (pCurDir1Item->pChildList && pCurDir2Item->pChildList)
                {
                TCHAR szDir1[MAX_PATH];
                TCHAR szDir2[MAX_PATH];

                    wsprintf(szDir1,TEXT("%s\\%s"),pszDir1,pCurDir1Item->fName);
                    wsprintf(szDir2,TEXT("%s\\%s"),pszDir2,pCurDir2Item->fName);

                    ReconcileDir(hWndParent,pHandlerItemID,pHANDLERITEMSETTINGS,
                                  pCallback,
                                  pdwCurProgValue,
                                  szDir1,pCurDir1Item->pChildList,
                                  szDir2,pCurDir2Item->pChildList);

                }
                else
                {
                    // one of the directories didn't have a child list and
                    // one did.

                     if (pCurDir1Item->pChildList)
                     {
                        *pdwCurProgValue += CountNumberOfFilesInList(pCurDir1Item->pChildList,pHANDLERITEMSETTINGS->fRecursive);
                        ReleaseFileObjectList(pCurDir1Item->pChildList,pHANDLERITEMSETTINGS->fRecursive);
                        pCurDir1Item->pChildList = NULL;
                     }

                     *pdwCurProgValue += 1;
                     DeleteItemFromList(pDir1,(LPGENERICITEM) pCurDir1Item);

                     if (pCurDir2Item->pChildList)
                     {
                        *pdwCurProgValue += CountNumberOfFilesInList(pCurDir2Item->pChildList,pHANDLERITEMSETTINGS->fRecursive);
                        ReleaseFileObjectList(pCurDir2Item->pChildList,pHANDLERITEMSETTINGS->fRecursive);
                        pCurDir2Item->pChildList = NULL;
                     }

                     *pdwCurProgValue += 1;
                     DeleteItemFromList(pDir2,(LPGENERICITEM) pCurDir2Item);

                    // update the progress value.
                    ProgressSetItemProgValue(pCallback,pHANDLERITEMSETTINGS->ItemID,*pdwCurProgValue);

                }
            }
            else if (!pCurDir1Item->fDirectory && !pCurDir2Item->fDirectory)
            {
            FILETIME *pftLastUpdate = &(pHANDLERITEMSETTINGS->ft);
            int iFileCompare;
            BOOL fCopy = FALSE;

                ProgressSetItemStatusText(pCallback,pHANDLERITEMSETTINGS->ItemID,pCurDir1Item->fName);

                // if filestimes are the same do nothing
                // both filetimes are greater than < last sync time, conflict,
                // else copy newer file over.

                if (0 != (iFileCompare  = CompareFileTime(&(pCurDir1Item->ftLastUpdate),&(pCurDir2Item->ftLastUpdate)) ))
                {
                int iFile1UpdateTimeCompare = CompareFileTime(&(pCurDir1Item->ftLastUpdate),pftLastUpdate);
                int iFile2UpdateTimeCompare = CompareFileTime(&(pCurDir2Item->ftLastUpdate),pftLastUpdate);

                    if (iFile1UpdateTimeCompare ==  iFile2UpdateTimeCompare)
                    {
                    RFCDLGPARAM rfcParam;
                    int iResolution;
                    TCHAR szNetModifiedOnBuf[MAX_PATH];
                    TCHAR szLocalModifiedOnBuf[MAX_PATH];

                        // !!! Conflict
                        memset(&rfcParam,0,sizeof(RFCDLGPARAM));

                        rfcParam.dwFlags = 0;
                        rfcParam.pszFilename = pCurDir1Item->fName;
                        rfcParam.pszLocation = pszDir1;
                        rfcParam.pszNewName = pCurDir2Item->fName;
                        rfcParam.pszNetworkModifiedOn
                                = FormatDateTime(&(pCurDir1Item->ftLastUpdate),szNetModifiedOnBuf,sizeof(szNetModifiedOnBuf)/sizeof(TCHAR));
                        rfcParam.pszLocalModifiedOn
                                = FormatDateTime(&(pCurDir2Item->ftLastUpdate),szLocalModifiedOnBuf,sizeof(szLocalModifiedOnBuf)/sizeof(TCHAR));

                       // if can show UI call enable modeless, and show
                        // conflict dialog, else log and error and treat
                        // as if use chose to keep both.

                        if ( (m_dwSyncFlags & SYNCMGRFLAG_MAYBOTHERUSER)
                             && (S_OK ==  pCallback->EnableModeless(TRUE)) )
                        {
                            iResolution = SyncMgrResolveConflict(hWndParent,&rfcParam);
                            pCallback->EnableModeless(FALSE);
                        }
                        else
                        {
                        TCHAR szLogText[MAX_PATH];

                            iResolution = RFC_KEEPBOTH;

                            wsprintf(szLogText,TEXT("Conflict occured - %s"),pCurDir1Item->fName);

                            LogError(pCallback,pHANDLERITEMSETTINGS->ItemID,SYNCMGRLOGLEVEL_WARNING,
                                        szLogText);

                        }

                        switch (iResolution)
                        {
                        case RFC_KEEPNETWORK: // treat dir1 as network copy
                            iFileCompare = 1;
                            fCopy = TRUE;
                            break;
                        case RFC_KEEPLOCAL: // treat dir2 as local copy.
                            iFileCompare = - 1;
                            fCopy = TRUE;
                            break;
                        case RFC_KEEPBOTH: // if keep both wait until next sync.
                        default:
                            fCopy = FALSE;
                            pHandlerItemID->fUnresolvedConflicts = TRUE;
                            break;
                        }

                    }
                    else
                    {
                        fCopy = TRUE;
                    }

                    if (fCopy)
                    {
                    TCHAR szProgressText[MAX_PATH];
                    TCHAR szFile1FullPath[MAX_PATH],szFile2FullPath[MAX_PATH];
                    BOOL fOk;

                        wsprintf(szProgressText,TEXT("Updating %s"),pCurDir1Item->fName);
                        ProgressSetItemStatusText(pCallback,pHANDLERITEMSETTINGS->ItemID,szProgressText);

                        wsprintf(szFile1FullPath,TEXT("%s\\%s"),pszDir1,pCurDir1Item->fName);
                        wsprintf(szFile2FullPath,TEXT("%s\\%s"),pszDir2,pCurDir2Item->fName);

                         // copy newer file.
                         if (0 < iFileCompare)
                         {
                            // 1 > 2.
                            fOk = CopyFileFullPath(szFile1FullPath,szFile2FullPath);
                         }
                         else
                         {
                            fOk = CopyFileFullPath(szFile2FullPath,szFile1FullPath);

                         }

                    }

                }

                // when done incmrement the progress value and release the items.
                *pdwCurProgValue += 2; // incrent progress by 2 since we handled both files.
                ProgressSetItemProgValue(pCallback,pHANDLERITEMSETTINGS->ItemID,*pdwCurProgValue);

                // always release, even on error since don't want copy to kick in.
                DeleteItemFromList(pDir1,(LPGENERICITEM) pCurDir1Item);
                DeleteItemFromList(pDir2,(LPGENERICITEM) pCurDir2Item);

            }
            else
            {
            TCHAR szLogError[MAX_PATH];

                wsprintf(szLogError,TEXT("%s is a Directory in one location and file in another.")
                                    ,pCurDir1Item->fName);
                LogError(pCallback,pHANDLERITEMSETTINGS->ItemID,SYNCMGRLOGLEVEL_ERROR,szLogError);

                // release both dir and file.
                 if (pCurDir1Item->fDirectory && pCurDir1Item->pChildList)
                 {
                    *pdwCurProgValue += CountNumberOfFilesInList(pCurDir1Item->pChildList,pHANDLERITEMSETTINGS->fRecursive);
                    ReleaseFileObjectList(pCurDir1Item->pChildList,pHANDLERITEMSETTINGS->fRecursive);
                    pCurDir1Item->pChildList = NULL;
                 }

                *pdwCurProgValue += 1;
                DeleteItemFromList(pDir1,(LPGENERICITEM) pCurDir1Item);

                 if (pCurDir2Item->fDirectory && pCurDir2Item->pChildList)
                 {
                    *pdwCurProgValue += CountNumberOfFilesInList(pCurDir2Item->pChildList,pHANDLERITEMSETTINGS->fRecursive);
                    ReleaseFileObjectList(pCurDir2Item->pChildList,pHANDLERITEMSETTINGS->fRecursive);
                    pCurDir2Item->pChildList = NULL;
                 }

                *pdwCurProgValue += 1;
                DeleteItemFromList(pDir2, (LPGENERICITEM) pCurDir2Item);

                // update the progress value.
                ProgressSetItemProgValue(pCallback,pHANDLERITEMSETTINGS->ItemID,*pdwCurProgValue);

            }

        }

    }

   // Anything left is a copy
   // This sample doesn't properly handle the following cases
   //  1)  file has been deleted in one folder and not the other - next sync file will be
   //       copied back to folder it was delted from
   //  2)  File has been renamed in one folder and not the other - next sync both files will
   //        appear.

   CopyFiles(pHandlerItemID,pHANDLERITEMSETTINGS,pCallback,pdwCurProgValue,pszDir1,pDir1,pszDir2);
   CopyFiles(pHandlerItemID,pHANDLERITEMSETTINGS,pCallback,pdwCurProgValue,pszDir2,pDir2,pszDir1);
}

void CSyncMgrHandler::ReleaseFileObjectList | ( | LPFILEOBJECTLIST | pfObjList,
 |  | BOOL | fRecursive |
 | ) |  |  | [private]

Definition at line 1453 of file Handler.Cpp.

{
LPFILEOBJECT pCurItem;

    if (!pfObjList)
    {
        Assert(pfObjList)
        return;
    }

    // see if object has any childs and free them if they do.

    pCurItem= (LPFILEOBJECT) pfObjList->pFirstGenericItem;

    while(pCurItem)
    {
        Assert(sizeof(FILEOBJECT ) == pCurItem->genericItem.cbSize);

        if (pCurItem->fDirectory)
        {
            Assert(pCurItem->pChildList || (!fRecursive));

            if (pCurItem->pChildList)
            {
                ReleaseFileObjectList(pCurItem->pChildList,fRecursive);
            }
        }

        pCurItem = (LPFILEOBJECT) pCurItem->genericItem.pNextGenericItem;
    }

    Release_ItemList(pfObjList);
}

STDMETHODIMP CSyncMgrHandler::SetItemStatus | ( | REFSYNCMGRITEMID | ItemID,
 |  | DWORD | dwSyncMgrStatus
 | ) |  |

Definition at line 916 of file Handler.Cpp.

{
LPSYNCMGRSYNCHRONIZECALLBACK pCallback = GetProgressCallback();
CLock clock(this);

    if (!pCallback)
    {
        Assert(pCallback);
        return E_UNEXPECTED;
    }

    clock.Enter();

    if (m_pItemsToSyncList)
    {
    LPHANDLERITEM_SYNCSTATUS  pCurItem =   (LPHANDLERITEM_SYNCSTATUS) m_pItemsToSyncList->pFirstGenericItem;

        while (pCurItem)
        {
        LPHANDLERITEM_SYNCSTATUS  pCurItemNext;

           pCurItemNext = (LPHANDLERITEM_SYNCSTATUS) pCurItem->genericItem.pNextGenericItem;

           Assert(sizeof(HANDLERITEM_SYNCSTATUS) == pCurItem->genericItem.cbSize);

           if ((SYNCMGRSTATUS_SKIPPED == dwSyncMgrStatus &&
               ItemID == pCurItem->ItemID)
               || SYNCMGRSTATUS_STOPPED == dwSyncMgrStatus)
           {
                pCurItem->fCancelled = TRUE;

                if (!pCurItem->fSynchronizeComplete)
                {
                    pCurItem->dwSyncMgrResultStatus = dwSyncMgrStatus;
                }

                // if not currently synchronizing and synchronization is
                // not already done on this item set the progress accordingly
                if (!pCurItem->fSynchronizing && !pCurItem->fSynchronizeComplete)
                {
                    ProgressSetItemStatusType(pCallback,pCurItem->ItemID,dwSyncMgrStatus);
                    ProgressSetItemProgMaxValue(pCallback,pCurItem->ItemID,10);
                    ProgressSetItemProgValue(pCallback,pCurItem->ItemID,10);

                    pCurItem->fSynchronizeComplete = TRUE;

                    // if we have a syncList
                    // then delete the items from the list
                    // and relesae the lock
                    // Note: this code relies on  PrepareForSync
                    // not yielding while setting up item table.

                    g_pSettings->ReleaseItemLock(this,pCurItem->ItemID);
                    DeleteItemFromList(m_pItemsToSyncList, (LPGENERICITEM) pCurItem);

                }

                if (SYNCMGRSTATUS_SKIPPED == dwSyncMgrStatus)
                {
                    break; // if skipped done when found a match.
                }
           }

           pCurItem = pCurItemNext;
        }
    }

    // if not in a synchronize or prepareForSync call when stop is
    // pressed release the itemList.
    if ((SYNCMGRSTATUS_STOPPED == dwSyncMgrStatus)
        && !m_fSynchronizing && !m_fPrepareForSync)
    {
        m_fStopped = TRUE;

        if (m_pItemsToSyncList)
        {
            if (0 == Release_ItemList(m_pItemsToSyncList))
            {
                m_pItemsToSyncList = NULL;
            }
        }
    }

    clock.Leave();

    pCallback->Release();
    return NOERROR;
}

STDMETHODIMP CSyncMgrHandler::SetProgressCallback ( ISyncMgrSynchronizeCallback * lpCallBack )

Definition at line 480 of file Handler.Cpp.

{
LPSYNCMGRSYNCHRONIZECALLBACK pCallbackCurrent;
CLock clock(this);

    clock.Enter();

    pCallbackCurrent = m_pSyncMgrSynchronizeCallback;

    m_pSyncMgrSynchronizeCallback = lpCallBack;

    if (m_pSyncMgrSynchronizeCallback)
        m_pSyncMgrSynchronizeCallback->AddRef();

    if (pCallbackCurrent)
        pCallbackCurrent->Release();

    clock.Leave();

    return NOERROR;
}

STDMETHODIMP CSyncMgrHandler::ShowError | ( | HWND | hWndParent,
 |  | REFSYNCMGRERRORID | ErrorID
 | ) |  |

Definition at line 1021 of file Handler.Cpp.

{
METHODARGS *pMethodArgs;

    pMethodArgs = (METHODARGS*) ALLOC(sizeof(METHODARGS));

    if (NULL == pMethodArgs)
    {
        Assert(pMethodArgs);
        return E_OUTOFMEMORY;
    }

    pMethodArgs->fAsync = TRUE;
    pMethodArgs->dwWorkerMsg = WM_WORKERMSG_SHOWERROR;
    pMethodArgs->ShowErrorMsg.hWndParent = hWndParent;
    pMethodArgs->ShowErrorMsg.ErrorID = ErrorID;

    PostMessage(m_hwndWorker,WM_WORKERMSG_SHOWERROR,0,(LPARAM) pMethodArgs);

    return NOERROR;
}

void CSyncMgrHandler::ShowErrorCall | ( | HWND | hWndParent,
 |  | REFSYNCMGRERRORID | ErrorID
 | ) |  |

Definition at line 1057 of file Handler.Cpp.

{
LPSYNCMGRSYNCHRONIZECALLBACK pCallback = GetProgressCallback();

    if (pCallback)
    {
        pCallback->ShowErrorCompleted(NOERROR,0,NULL);
        pCallback->Release();
    }

    return;
}

STDMETHODIMP CSyncMgrHandler::ShowProperties | ( | HWND | hWndParent,
 |  | REFSYNCMGRITEMID | ItemID
 | ) |  |

Definition at line 409 of file Handler.Cpp.

{
METHODARGS *pMethodArgs;

    pMethodArgs = (METHODARGS*) ALLOC(sizeof(METHODARGS));

    if (NULL == pMethodArgs)
    {
        Assert(pMethodArgs);
        return E_OUTOFMEMORY;
    }

    pMethodArgs->fAsync = TRUE;
    pMethodArgs->dwWorkerMsg = WM_WORKERMSG_SHOWPROPERTIES;
    pMethodArgs->ShowPropertiesMsg.hWndParent = hWndParent;
    pMethodArgs->ShowPropertiesMsg.ItemID = ItemID;

    PostMessage(m_hwndWorker,WM_WORKERMSG_SHOWPROPERTIES,0,(LPARAM) pMethodArgs);

    return NOERROR;
}

void CSyncMgrHandler::ShowPropertiesCall | ( | HWND | hWndParent,
 |  | REFSYNCMGRITEMID | ItemID
 | ) |  |

Definition at line 445 of file Handler.Cpp.

{
LPSYNCMGRSYNCHRONIZECALLBACK pCallback = GetProgressCallback();
HRESULT hr = NOERROR;

    Assert(g_pSettings);

    if (g_pSettings)
    {
        hr = g_pSettings->ShowProperties(hWndParent,ItemID);
    }

    if (pCallback)
    {
        pCallback->ShowPropertiesCompleted(hr);
        pCallback->Release();
    }

    return;
}

CSyncMgrHandler::STDMETHODIMP_ ( ULONG )
CSyncMgrHandler::STDMETHODIMP_ ( ULONG )
void CSyncMgrHandler::SyncDirs | ( | HWND | hWndParent,
 |  | LPHANDLERITEM_SYNCSTATUS | pHandlerItemID,
 |  | LPHANDLERITEMSETTINGS | pHandlerSyncItem |
 | ) |  |  | [private]

Definition at line 2037 of file Handler.Cpp.

{
LPSYNCMGRSYNCHRONIZECALLBACK pCallback = GetProgressCallback();
LPFILEOBJECTLIST pfObjDir1 = NULL,pfObjDir2 = NULL;
ULONG ulProgressMaxValue = 0;
ULONG ulProgressCurValue = 0;
TCHAR szStatusText[MAX_PATH];

    // if already cancelled go on.
    if (pHandlerItemID->fCancelled)
        goto synccomplete;

    // synchronizing flag should be TRUE so SetItemStatus knows this is
    Assert(TRUE == pHandlerItemID->fSynchronizing);

    pHandlerItemID->dwSyncMgrResultStatus = SYNCMGRSTATUS_SUCCEEDED;

    ProgressSetItemStatusType(pCallback,pHANDLERITEMSETTINGS->ItemID,SYNCMGRSTATUS_UPDATING);

    wsprintf(szStatusText,TEXT("Scanning %s"),pHANDLERITEMSETTINGS->dir1);
    ProgressSetItemStatusText(pCallback,pHANDLERITEMSETTINGS->ItemID,szStatusText);

    pfObjDir1 = CreateDirFileListFromPath(pHANDLERITEMSETTINGS->dir1,
                                                pHANDLERITEMSETTINGS->fRecursive);

    if (pHandlerItemID->fCancelled)
        goto synccomplete;

    if (!pfObjDir1)
    {
         wsprintf(szStatusText,TEXT("Error Scanning %s"),pHANDLERITEMSETTINGS->dir1);
         LogError(pCallback,pHANDLERITEMSETTINGS->ItemID,SYNCMGRLOGLEVEL_ERROR,szStatusText);
         pHandlerItemID->dwSyncMgrResultStatus = SYNCMGRSTATUS_FAILED;
    }
    else
    {
        wsprintf(szStatusText,TEXT("Scanning %s"),pHANDLERITEMSETTINGS->dir2);
        ProgressSetItemStatusText(pCallback,pHANDLERITEMSETTINGS->ItemID,szStatusText);

        pfObjDir2 = CreateDirFileListFromPath(pHANDLERITEMSETTINGS->dir2,
                                                    pHANDLERITEMSETTINGS->fRecursive);

        if (!pfObjDir2)
        {
             wsprintf(szStatusText,TEXT("Error Scanning %s"),pHANDLERITEMSETTINGS->dir2);
             LogError(pCallback,pHANDLERITEMSETTINGS->ItemID,SYNCMGRLOGLEVEL_ERROR,szStatusText);
             pHandlerItemID->dwSyncMgrResultStatus = SYNCMGRSTATUS_FAILED;
        }
    }

    if (pHandlerItemID->fCancelled)
        goto synccomplete;

    if (pfObjDir1 && pfObjDir2)
    {
        // Calc the progress Item MaxValue which is the total
        // number of items to sync.
        ulProgressMaxValue += CountNumberOfFilesInList(pfObjDir1,pHANDLERITEMSETTINGS->fRecursive);
        ulProgressMaxValue += CountNumberOfFilesInList(pfObjDir2,pHANDLERITEMSETTINGS->fRecursive);

        ProgressSetItemProgMaxValue(pCallback,pHANDLERITEMSETTINGS->ItemID,ulProgressMaxValue);
        ProgressSetItemProgValue(pCallback,pHANDLERITEMSETTINGS->ItemID,0);

        // want to kick Reconcil off pointing to childlist of each toplevel dir
        if (pfObjDir1->pFirstGenericItem && pfObjDir2->pFirstGenericItem)
        {
        LPFILEOBJECTLIST pfObjStartDir1,pfObjStartDir2;
        TCHAR *pszDir1Name,*pszDir2Name;

            pfObjStartDir1 = ((LPFILEOBJECT) pfObjDir1->pFirstGenericItem)->pChildList;
            pfObjStartDir2 = ((LPFILEOBJECT) pfObjDir2->pFirstGenericItem)->pChildList;

            pszDir1Name = ((LPFILEOBJECT) pfObjDir1->pFirstGenericItem)->fName;
            pszDir2Name = ((LPFILEOBJECT) pfObjDir2->pFirstGenericItem)->fName;

            if (pfObjStartDir1 && pfObjStartDir2)
            {
                ReconcileDir(hWndParent,pHandlerItemID,pHANDLERITEMSETTINGS,pCallback,&ulProgressCurValue,
                                        pszDir1Name,pfObjStartDir1,pszDir2Name,pfObjStartDir2);
            }
        }
    }

synccomplete:

    // set progress to max and clear status
    ProgressSetItemProgValue(pCallback,pHANDLERITEMSETTINGS->ItemID,ulProgressMaxValue);
    ProgressSetItemStatusText(pCallback,pHANDLERITEMSETTINGS->ItemID,TEXT(""));

    // update item status based on result.
    ProgressSetItemStatusType(pCallback,pHANDLERITEMSETTINGS->ItemID,pHandlerItemID->dwSyncMgrResultStatus);

    if (pCallback)
    {
        pCallback->Release();
    }

    if (pfObjDir1)
    {
        ReleaseFileObjectList(pfObjDir1,pHANDLERITEMSETTINGS->fRecursive);
    }

    if (pfObjDir2)
    {
        ReleaseFileObjectList(pfObjDir2,pHANDLERITEMSETTINGS->fRecursive);
    }
}

STDMETHODIMP CSyncMgrHandler::Synchronize ( HWND hWndParent )

Definition at line 757 of file Handler.Cpp.

{
METHODARGS *pMethodArgs;
CLock clock(this);

    clock.Enter();
    m_fSynchronizing = TRUE;
    clock.Leave();

    pMethodArgs = (METHODARGS*) ALLOC(sizeof(METHODARGS));

    if (NULL == pMethodArgs)
    {
        Assert(pMethodArgs);
        return E_OUTOFMEMORY;
    }

    pMethodArgs->fAsync = TRUE;
    pMethodArgs->dwWorkerMsg = WM_WORKERMSG_SYNCHRONIZE;
    pMethodArgs->SynchronizeMsg.hWndParent = hWndParent;

    PostMessage(m_hwndWorker,WM_WORKERMSG_SYNCHRONIZE,0,(LPARAM) pMethodArgs);

    return NOERROR;
}

void CSyncMgrHandler::SynchronizeCall ( HWND hWndParent )

Definition at line 797 of file Handler.Cpp.

{
LPSYNCMGRSYNCHRONIZECALLBACK pCallback = GetProgressCallback();
CLock clock(this);

    if (!pCallback)
    {
        Assert(pCallback);
        clock.Enter();
        m_fSynchronizing = FALSE;
        clock.Leave();
        return;
    }

    clock.Enter();

    // should either have a syncList or receive a Stop Item request.
    Assert(m_pItemsToSyncList || m_fStopped);

    if (m_pItemsToSyncList)
    {
    LPHANDLERITEM_SYNCSTATUS pCurItem;

        if (g_pSettings)
        {
            // get first item in the list, sync, remove, repeat
            // until no more items in the list.
            while (pCurItem = (LPHANDLERITEM_SYNCSTATUS)
                            m_pItemsToSyncList->pFirstGenericItem)
            {
            FILETIME ft;
            SYSTEMTIME sysTime;
            HANDLERITEMSETTINGS HANDLERITEMSETTINGS;

               // if already cancelled such as setItemstatus came in while not synchronizing
               // then just skip over

               if (!pCurItem->fSynchronizeComplete)
               {
                   Assert(sizeof(HANDLERITEM_SYNCSTATUS) == pCurItem->genericItem.cbSize);
                   Assert(FALSE == pCurItem->fSynchronizing);

                   if (g_pSettings->CopyHandlerSyncInfo(pCurItem->ItemID,&HANDLERITEMSETTINGS))
                   {
                        pCurItem->fSynchronizing = TRUE; // set synchronizing before releasing lock.
                        // release lock and call call helper to do the real sync work.

                        clock.Leave();
                        SyncDirs(hWndParent,pCurItem,&HANDLERITEMSETTINGS);
                        clock.Enter();

                        // assert that noboday changed the state on us while
                        // the sync was in progress.

                        Assert(TRUE == pCurItem->fSynchronizing);
                        Assert(FALSE == pCurItem->fSynchronizeComplete);

                        pCurItem->fSynchronizing = FALSE;
                        pCurItem->fSynchronizeComplete = TRUE;
                   }

                   // only update file time if item wasn't cancelled,
                   // no failures occured and no
                   // unresolved conflicts.
                   if (!pCurItem->fUnresolvedConflicts && !pCurItem->fCancelled
                       && (SYNCMGRSTATUS_SUCCEEDED == pCurItem->dwSyncMgrResultStatus) )
                   {
                       GetSystemTime(&sysTime);
                       SystemTimeToFileTime(&sysTime,&ft);
                   }
                   else
                   {
                        ft = HANDLERITEMSETTINGS.ft;
                   }

                   // tell settings class we are done syncing.
                    g_pSettings->ReleaseItemLock(this,pCurItem->ItemID,&ft);
                    DeleteItemFromList(m_pItemsToSyncList, (LPGENERICITEM) pCurItem);
                }
            }
        }

        // release the item list if this is the last ref then null out
        // the member var
        if (0 == Release_ItemList(m_pItemsToSyncList))
        {
            m_pItemsToSyncList = NULL;
        }

    }

    m_fSynchronizing = FALSE;
    clock.Leave();

    if (pCallback)
    {
        pCallback->SynchronizeCompleted(NOERROR);
        pCallback->Release();
    }

    return;
}

Friends And Related Function Documentation

LRESULT CALLBACK HandlerThreadWndProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [friend]

Definition at line 2161 of file Handler.Cpp.

{
CSyncMgrHandler *pThis = (CSyncMgrHandler *) GetWindowLongPtr(hWnd, DWL_THREADWNDPROCCLASS);
METHODARGS *pMethodArgs = (METHODARGS *) lParam;
BOOL fMethodCall = FALSE;

    switch (msg)
    {
    case WM_CREATE :
        {
        CREATESTRUCT *pCreateStruct = (CREATESTRUCT *) lParam;

        SetWindowLongPtr(hWnd, DWL_THREADWNDPROCCLASS,(LONG_PTR) pCreateStruct->lpCreateParams );
        pThis = (CSyncMgrHandler *) pCreateStruct->lpCreateParams ;
        }
        break;
        case WM_DESTROY:
        break;
        case WM_WORKERMSG_PROGRESS:
            Assert(pMethodArgs);
            fMethodCall = TRUE;

            if (pMethodArgs)
            {
                pMethodArgs->hr = E_UNEXPECTED;

                if (pThis->m_pSyncMgrSynchronizeCallback)
                {
                PROGRESSMSG *pMsg = &(pMethodArgs->ProgressMsg);

                    Assert(msg == pMethodArgs->dwWorkerMsg);

                    pMethodArgs->hr =
                        pThis->m_pSyncMgrSynchronizeCallback->Progress(
                                   pMsg->ItemID,
                                   pMsg->lpSyncProgressItem);
                }

                Assert(!pMethodArgs->fAsync);
            }
            break;
        case WM_WORKERMSG_PREPAREFORSYNCCOMPLETED:
            Assert(pMethodArgs);
            fMethodCall = TRUE;

            if (pMethodArgs)
            {
                pMethodArgs->hr = E_UNEXPECTED;

                if (pThis->m_pSyncMgrSynchronizeCallback)
                {
                PREPAREFORSYNCCOMPLETEDMSG *pMsg = &(pMethodArgs->PrepareForSyncCompletedMsg);

                    Assert(msg == pMethodArgs->dwWorkerMsg);

                    pMethodArgs->hr =
                        pThis->m_pSyncMgrSynchronizeCallback->PrepareForSyncCompleted(
                                   pMsg->hr);
                }

                Assert(!pMethodArgs->fAsync);
            }
            break;
        case WM_WORKERMSG_SYNCHRONIZECOMPLETED:
            Assert(pMethodArgs);
            fMethodCall = TRUE;

            if (pMethodArgs)
            {
                pMethodArgs->hr = E_UNEXPECTED;

                if (pThis->m_pSyncMgrSynchronizeCallback)
                {
                SYNCHRONIZECOMPLETEDMSG *pMsg = &(pMethodArgs->SynchronizeCompletedMsg);

                    Assert(msg == pMethodArgs->dwWorkerMsg);

                    pMethodArgs->hr =
                        pThis->m_pSyncMgrSynchronizeCallback->SynchronizeCompleted(
                                   pMsg->hr);
                }

                Assert(!pMethodArgs->fAsync);
            }
            break;
        case WM_WORKERMSG_SHOWPROPERTIESCOMPLETED:
            Assert(pMethodArgs);
            fMethodCall = TRUE;

            if (pMethodArgs)
            {
                pMethodArgs->hr = E_UNEXPECTED;

                if (pThis->m_pSyncMgrSynchronizeCallback)
                {
                SHOWPROPERTIESCOMPLETEDMSG *pMsg = &(pMethodArgs->ShowPropertiesCompletedMsg);

                    Assert(msg == pMethodArgs->dwWorkerMsg);

                    pMethodArgs->hr =
                        pThis->m_pSyncMgrSynchronizeCallback->ShowPropertiesCompleted(
                                  pMsg->hr);
                }

                Assert(!pMethodArgs->fAsync);
            }
            break;
        case WM_WORKERMSG_SHOWERRORCOMPLETED:
            Assert(pMethodArgs);
            fMethodCall = TRUE;

            if (pMethodArgs)
            {
                pMethodArgs->hr = E_UNEXPECTED;

                if (pThis->m_pSyncMgrSynchronizeCallback)
                {
                SHOWERRORCOMPLETEDMSG *pMsg = &(pMethodArgs->ShowErrorCompletedMsg);

                    Assert(msg == pMethodArgs->dwWorkerMsg);

                    pMethodArgs->hr =
                        pThis->m_pSyncMgrSynchronizeCallback->ShowErrorCompleted(
                                   pMsg->hr,
                                   pMsg->cbNumItems,
                                   pMsg->pItemIDs
                                   );
                }

                Assert(!pMethodArgs->fAsync);
            }
            break;
        case WM_WORKERMSG_ENABLEMODELESS:
            Assert(pMethodArgs);
            fMethodCall = TRUE;

            if (pMethodArgs)
            {
                pMethodArgs->hr = E_UNEXPECTED;

                if (pThis->m_pSyncMgrSynchronizeCallback)
                {
                ENABLEMODELESSMSG *pMsg = &(pMethodArgs->EnableModelessMsg);

                    Assert(msg == pMethodArgs->dwWorkerMsg);

                    pMethodArgs->hr =
                        pThis->m_pSyncMgrSynchronizeCallback->EnableModeless(
                            pMsg->fEnable);
                }

                Assert(!pMethodArgs->fAsync);
            }
            break;
        case WM_WORKERMSG_LOGERROR:
            Assert(pMethodArgs);
            fMethodCall = TRUE;

            if (pMethodArgs)
            {
                pMethodArgs->hr = E_UNEXPECTED;

                if (pThis->m_pSyncMgrSynchronizeCallback)
                {
                LOGERRORMSG *pMsg = &(pMethodArgs->LogErrorMsg);

                    Assert(msg == pMethodArgs->dwWorkerMsg);

                    pMethodArgs->hr =
                        pThis->m_pSyncMgrSynchronizeCallback->LogError(
                                   pMsg->dwErrorLevel,
                                   pMsg->lpcErrorText,
                                   pMsg->lpSyncLogError);
                }

                Assert(!pMethodArgs->fAsync);
            }
            break;
        case WM_WORKERMSG_DELETELOGERROR:
            Assert(pMethodArgs);
            fMethodCall = TRUE;

            if (pMethodArgs)
            {
                pMethodArgs->hr = E_UNEXPECTED;

                if (pThis->m_pSyncMgrSynchronizeCallback)
                {
                DELETELOGERRORMSG *pMsg = &(pMethodArgs->DeleteLogErrorMsg);

                    Assert(msg == pMethodArgs->dwWorkerMsg);

                    pMethodArgs->hr =
                        pThis->m_pSyncMgrSynchronizeCallback->DeleteLogError(
                                   pMsg->ErrorID,
                                   pMsg->dwReserved);
                }

                Assert(!pMethodArgs->fAsync);
            }
            break;
        case WM_WORKERMSG_ESTABLISHCONNECTION:
            Assert(pMethodArgs);
            fMethodCall = TRUE;

            if (pMethodArgs)
            {
                pMethodArgs->hr = E_UNEXPECTED;

                if (pThis->m_pSyncMgrSynchronizeCallback)
                {
                ESTABLISHCONNECTIONMSG *pMsg = &(pMethodArgs->EstablishConnectionMsg);

                    Assert(msg == pMethodArgs->dwWorkerMsg);

                    pMethodArgs->hr =
                        pThis->m_pSyncMgrSynchronizeCallback->EstablishConnection(
                                   pMsg->lpwszConnection,
                                   pMsg->dwReserved
                                   );
                }

                Assert(!pMethodArgs->fAsync);
            }
            break;
    default:
        break;
    }

    // if this was a method call and async then free methodArgs,
    // on synchronous calls up to the caller to free.
    if (fMethodCall && pMethodArgs && pMethodArgs->fAsync)
    {
        FREE(pMethodArgs);
    }

    return DefWindowProc(hWnd, msg, wParam, lParam);
}

Member Data Documentation

DWORD CSyncMgrHandler::m_cRef [private]

Definition at line 48 of file Handler.h.

DWORD CSyncMgrHandler::m_dwSyncFlags [private]

Definition at line 47 of file Handler.h.

BOOL CSyncMgrHandler::m_fPrepareForSync [private]

Definition at line 55 of file Handler.h.

BOOL CSyncMgrHandler::m_fStopped [private]

Definition at line 56 of file Handler.h.

BOOL CSyncMgrHandler::m_fSynchronizing [private]

Definition at line 54 of file Handler.h.

HWND CSyncMgrHandler::m_hwndHandler [private]

Definition at line 53 of file Handler.h.

HWND CSyncMgrHandler::m_hwndWorker [private]

Definition at line 52 of file Handler.h.

HANDLE CSyncMgrHandler::m_phThread [private]

Definition at line 51 of file Handler.h.

LPGENERICITEMLIST CSyncMgrHandler::m_pItemsToSyncList [private]

Definition at line 50 of file Handler.h.

LPSYNCMGRSYNCHRONIZECALLBACK CSyncMgrHandler::m_pSyncMgrSynchronizeCallback [private]

Definition at line 49 of file Handler.h.

The documentation for this class was generated from the following files:
  • NetDS/SyncMgr/SyncDir/Handler.h
  • NetDS/SyncMgr/SyncDir/Handler.Cpp
Generated on Wed Nov 13 2024 16:57:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSysLCESub Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes | Private Member Functions

CSysLCESub Class Reference

#include "syslcesub.h"

Inherits ICOMSysLCE.

Inherited by CActivitySub, CAppSub, CCRMSub, CEvtStoreSub, CExceptionSub, CIdentitySub, CInstanceSub, CLBSub, CMethodSub, CObjConstSub, CObjPool2Sub, CObjPoolSub, CObjSub, CQCSub, CResourceSub, CSecuritySub, CThreadSub, CTxSub, and CUserSub.

List of all members.

Public Member Functions

CSysLCESub ()
STDMETHOD() | GetEventClass (LPGUID EventClass)=0
STDMETHOD() | GetEventType (EventEnum *e)=0
STDMETHOD() | GetInterface (IID *iid)=0
STDMETHOD() | Install (BSTR *PropertyName, VARIANT PropertyValue)
void | SetSpyObj (CComSpy *pSpy)
STDMETHOD() | Uninstall ()

Protected Attributes

CComSpy * m_pSpy
GUID | m_SubscriptionGuid

Private Member Functions

OLECHAR * | EventName (EventEnum e)

Detailed Description

Definition at line 25 of file syslcesub.h.

Constructor & Destructor Documentation

CSysLCESub::CSysLCESub ( ) [inline]

Definition at line 37 of file syslcesub.h.

  {
    CoCreateGuid( &m_SubscriptionGuid );
  }

Member Function Documentation

OLECHAR * CSysLCESub::EventName ( EventEnum e ) [private]

Definition at line 127 of file syslcesub.Cpp.

{
  switch (e)
  {
    case Application:
    {
      return OLESTR("Application");
      break;
    }
    case Thread:
    {
      return OLESTR("Thread");
      break;
    }
    case Instance:
    {
      return OLESTR("Instance");
      break;
    }
    case Transaction:
    {
      return OLESTR("Transaction");
      break;
    }
    case Method:
    {
      return OLESTR("Method");
      break;
    }
    case Object:
    {
      return OLESTR("Object");
      break;
    }
    case Resource:
    {
      return OLESTR("Resource");
      break;
    }
    case User:
    {
      return OLESTR("User");
      break;
    }
    case Security:
    {
      return OLESTR("Security");
      break;
    }
    case ObjectConstruction:
    {
      return OLESTR("Construction");
      break;
    }
    case ObjectPool:
    {
      return OLESTR("Pool");
      break;
    }
    case ObjectPool2:
    {
      return OLESTR("Pool2");
      break;
    }
    case Activity:
    {
      return OLESTR("Activity");
      break;
    }
    case Identity:
    {
      return OLESTR("Identity");
      break;
    }
    case QC:
    {
      return OLESTR("Queued Components");
      break;
    }
    case Exception:
    {
      return OLESTR("Exception");
      break;
    }
    case CRM:
    {
      return OLESTR("CRM");
      break;
    }
    case EventStore:
    {
      return OLESTR("EventStore");
      break;
    }
    case LoadBalancing:
    {
      return OLESTR("LoadBalancing");
      break;
    }
    default:
      ATLTRACE(L"Object type not implemented in SysLCESub\n");
      _ASSERTE(0);
      break;
  }
  return NULL;
}

STDMETHOD() CSysLCESub::GetEventClass ( LPGUID EventClass ) [pure virtual]

Implements ICOMSysLCE.

Implemented in CActivitySub, CAppSub, CCRMSub, CEvtStoreSub, CExceptionSub, CIdentitySub, CInstanceSub, CLBSub, CMethodSub, CObjConstSub, CObjPool2Sub, CObjPoolSub, CObjSub, CQCSub, CResourceSub, CSecuritySub, CThreadSub, CTxSub, and CUserSub.

STDMETHOD() CSysLCESub::GetEventType ( EventEnum * e ) [pure virtual]

Implements ICOMSysLCE.

Implemented in CActivitySub, CAppSub, CCRMSub, CEvtStoreSub, CExceptionSub, CIdentitySub, CInstanceSub, CLBSub, CMethodSub, CObjConstSub, CObjPool2Sub, CObjPoolSub, CObjSub, CQCSub, CResourceSub, CSecuritySub, CThreadSub, CTxSub, and CUserSub.

STDMETHOD() CSysLCESub::GetInterface ( IID * iid ) [pure virtual]

Implemented in CActivitySub, CAppSub, CCRMSub, CEvtStoreSub, CExceptionSub, CIdentitySub, CInstanceSub, CLBSub, CMethodSub, CObjConstSub, CObjPool2Sub, CObjPoolSub, CObjSub, CQCSub, CResourceSub, CSecuritySub, CThreadSub, CTxSub, and CUserSub.

STDMETHODIMP CSysLCESub::Install | ( | BSTR * | PropertyName,
 |  | VARIANT | PropertyValue
 | ) |  |

Implements ICOMSysLCE.

Definition at line 28 of file syslcesub.Cpp.

{
  EventEnum eEvent;
  GetEventType( &eEvent );
  CComBSTR bstrSubscriptionName (EventName( eEvent ));
  CComBSTR bstrSubscriptionID;
  IID iid;
  CComBSTR bstrInterfaceID;
  GUID EventClass;
  CComBSTR bstrEventClassID;
  HRESULT hr = S_OK;
  LPOLESTR strGUID;

  hr = StringFromIID(m_SubscriptionGuid, &strGUID);
  if (FAILED(hr))
  {
    ATLTRACE(L"Failed to Create String from IID");
    return hr;
  }

  bstrSubscriptionID = strGUID;
  CoTaskMemFree(strGUID);

  GetEventClass( &EventClass );
  hr = StringFromIID(EventClass, &strGUID);
  if (FAILED(hr))
  {
    ATLTRACE(L"Failed to Create String from IID");
    return hr;
  }

  bstrEventClassID = strGUID;
  CoTaskMemFree(strGUID);

  GetInterface( &iid );
  hr = StringFromIID(iid, &strGUID);
  if (FAILED(hr))
  {
    ATLTRACE(L"Failed to Create String from IID");
    return hr;
  }

  bstrInterfaceID = strGUID;
  CoTaskMemFree(strGUID);

  ICOMAdminCatalog* pICat;
  if (SUCCEEDED(hr = CoCreateInstance(__uuidof(COMAdminCatalog),
                NULL,
              CLSCTX_SERVER,
              __uuidof(ICOMAdminCatalog),
              (LPVOID*)&pICat)))
  {
    AddTransientSubscription(pICat,
                bstrSubscriptionName,
                bstrEventClassID,
                NULL,
                bstrInterfaceID,
                GetUnknown(),
                NULL,
                NULL,
                pPropertyName ? *pPropertyName : NULL,
                pPropertyName ? PropertyValue.bstrVal : NULL);

    pICat->Release();
  }
  return hr;

}

void CSysLCESub::SetSpyObj ( CComSpy * pSpy ) [inline]

Definition at line 42 of file syslcesub.h.

  {
    m_pSpy = pSpy;
  }

STDMETHODIMP CSysLCESub::Uninstall ( )

Implements ICOMSysLCE.

Definition at line 98 of file syslcesub.Cpp.

{
  HRESULT hr;
  EventEnum eEvent;
  GetEventType( &eEvent );
  CComBSTR bstrSubscriptionName (EventName( eEvent ));
  ICOMAdminCatalog* pICat;
  if (SUCCEEDED(hr = CoCreateInstance(__uuidof(COMAdminCatalog),
                NULL,
              CLSCTX_SERVER,
              __uuidof(ICOMAdminCatalog),
              (LPVOID*)&pICat)))
  {
    RemoveTransientSubscription(pICat,
                bstrSubscriptionName);
    pICat->Release();
  }
  return hr;
}

Member Data Documentation

CComSpy* CSysLCESub::m_pSpy [protected]

Definition at line 34 of file syslcesub.h.

GUID CSysLCESub::m_SubscriptionGuid [protected]

Definition at line 33 of file syslcesub.h.

The documentation for this class was generated from the following files:
  • Com/Administration/Spy/ComSpyCtl/syslcesub.h
  • Com/Administration/Spy/ComSpyCtl/syslcesub.Cpp
Generated on Wed Nov 13 2024 16:57:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CTable Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CTable Class Reference

#include "table.h"

List of all members.

Public Member Functions

CTable (CWizard *pCWizard)
virtual | ~CTable ()
virtual HRESULT | AdjustBindings (ULONG cBindings, DBBINDING *rgBindings, void *pData)
virtual BOOL | Connect (HWND hWnd, CDataSource *pCDataSource=NULL)
virtual HRESULT | CopyData (CTable *pCSourceTable, ULONG *pcRowsCopied)
virtual HRESULT | CopyIndexes (CTable *pCSourceTable)
virtual HRESULT | CreateAccessors (ULONG *pcBindingInfo, BINDINGINFO **prgBindingInfo, ULONG *pcRowSize, ULONG ulBlobSize, BOOL *pbOutofLine)
virtual HRESULT | CreateSQLStmt (ESQL_STMT eSqlStmt, WCHAR *pwszSqlStmt, BOOL fShowSql=TRUE)
virtual HRESULT | CreateTable ()
virtual HRESULT | GetColInfo (DWORD dwInsertOpt)
virtual HRESULT | GetColumnDesc (DBCOLUMNDESC **prgColumnDesc)
virtual HRESULT | GetLiteralInfo ()
virtual BOOL | GetQuotedID (WCHAR *pwszOutBuff, WCHAR *pwszInBuff)
virtual HRESULT | GetRowset (DWORD dwInsertOpt)
virtual HRESULT | GetTypeInfo ()
virtual HRESULT | GetTypeInfoRowset (IAccessor **ppIAccessor, HACCESSOR *phAccessor, IRowset **ppIRowset)
virtual HRESULT | GetTypeNameAndParams (ULONG iCol, WCHAR *pwszName)
virtual BOOL | IsConnected ()
virtual HRESULT | MapTableInfo (CTable *pCSourceTable)

Public Attributes

ULONG m_cColumns
ULONG m_cIndexes
CDataSource * m_pCDataSource
CWizard * m_pCWizard
IAccessor * | m_pIAccessor
IRowset * | m_pIRowset
COLDESC * m_rgColDesc
INDEXINFO * m_rgIndexInfo
TABLEINFO m_TableInfo
WCHAR | m_wszIDQuote [MAX_NAME_LEN]
WCHAR | m_wszIDSeperator [MAX_NAME_LEN]
WCHAR | m_wszQualTableName [MAX_NAME_LEN]

Detailed Description

Definition at line 122 of file table.h.

Constructor & Destructor Documentation

CTable::CTable ( CWizard * pCWizard )

Definition at line 39 of file table.cpp.

{
  ASSERT(pCWizard);

  m_wszIDQuote[0]     = EOL;
  m_wszIDSeperator[0]   = EOL;

  //TableInfo
  memset(&m_TableInfo, 0, sizeof(TABLEINFO));
  m_wszQualTableName[0] = EOL;

  //IndexInfo
  m_cIndexes    = 0;    // Count of indexes
  m_rgIndexInfo = NULL;   // Index information

  //ColumnInfo
  m_cColumns    = 0;    // Count of columns
  m_rgColDesc   = NULL;   // Column information

  //DataSource
  m_pCDataSource  = new CDataSource;
  m_pCWizard    = pCWizard;     // Back pointer to Windowing class

  //Rowset
  m_pIAccessor  = NULL;
  m_pIRowset    = NULL;
}

CTable::~CTable ( ) [virtual]

Definition at line 72 of file table.cpp.

{
  delete m_pCDataSource;

  SAFE_FREE(m_rgIndexInfo);
  SAFE_FREE(m_rgColDesc);

  //Rowset
  SAFE_RELEASE(m_pIAccessor);
  SAFE_RELEASE(m_pIRowset);
}

Member Function Documentation

HRESULT CTable::AdjustBindings | ( | ULONG | cBindings,
 |  | DBBINDING * | rgBindings,
 |  | void * | pData |
 | ) |  |  | [virtual]

Definition at line 1165 of file table.cpp.

{
  ASSERT(pData);
  HRESULT hr = S_OK;

  //Adjust all Storage Objects
  //We have 2 problems.  First some providers (MSDASQL) may require the LENGTH
  //of the storage object bound.  We have no clue what the LENGTH is unless
  //we read the entire stream.  Second some providers may only allow 1 storage
  //object open at any one time.  The simplest soltuion would be just to buffer
  //the provider storage objects into our own and release the providers...

  for(ULONG i=0; i<cBindings; i++)
  {
    //DBSTATUS_S_ISNULL - nothing to adjust
    if(BINDING_STATUS(rgBindings[i],pData) == DBSTATUS_S_ISNULL)
      continue;

    //DB_S_TRUNCATED
    //Need to Adjust the LENGTH binding to be cbMaxLen
    if(BINDING_STATUS(rgBindings[i],pData) == DBSTATUS_S_TRUNCATED)
      BINDING_LENGTH(rgBindings[i], pData) = rgBindings[i].cbMaxLen;

    //DBTYPE_IUNKNOWN
    if(rgBindings[i].wType == DBTYPE_IUNKNOWN)
    {
       //Obtain the providers ISeqStream object
      ISequentialStream* pISequentialStream = (ISequentialStream*)BINDING_VALUE(rgBindings[i], pData);

      //Copy the providers stream into our own CISeqStream object
      CISeqStream* pCISeqStream = new CISeqStream();
      pCISeqStream->Write(pISequentialStream, NULL);
      BINDING_VALUE(rgBindings[i], pData) = (ULONG)pCISeqStream;
      SAFE_RELEASE(pISequentialStream);

      //Indicate the LENGTH Binding
      BINDING_LENGTH(rgBindings[i], pData) = pCISeqStream->Length();
    }

    //DBSTATUS_S_OK
    BINDING_STATUS(rgBindings[i],pData) = DBSTATUS_S_OK;
  }

  return hr;
}

BOOL CTable::Connect | ( | HWND | hWnd,
 |  | CDataSource * | pCDataSource = NULL |
 | ) |  |  | [virtual]

Definition at line 89 of file table.cpp.

{
  ASSERT(m_pCDataSource);

  HRESULT hr = m_pCDataSource->Connect(hWnd, m_pCDataSource);
  if (SUCCEEDED(hr) && (REGDB_E_CLASSNOTREG != hr))
  {
    //Get LiteralInfo for this table
    GetLiteralInfo();
    return TRUE;
  }

  return FALSE;
}

HRESULT CTable::CopyData | ( | CTable * | pCSourceTable,
 |  | ULONG * | pcRowsCopied |
 | ) |  |  | [virtual]

Definition at line 1405 of file table.cpp.

{
  ASSERT(pCSourceTable && pcRowsCopied);
  HRESULT hr;

  WCHAR   wszSqlStmt[MAX_QUERY_LEN];  // Format the select statement
  WCHAR   wszBuffer[MAX_NAME_LEN];

    ULONG   i,j,ulOffset = 0;
  ULONG   cBindings = 0;
  DBBINDING*  rgBindings = NULL;
  HACCESSOR  hAccessor = DB_NULL_HACCESSOR;
  IAccessor* pIAccessor = NULL;

  ULONG cRowSize = 0;
  IRowset*    pISourceRowset = pCSourceTable->m_pIRowset;
  IRowsetChange*  pIRowsetChange = NULL;
  IRowsetUpdate*  pIRowsetUpdate = NULL;

  ULONG cRowsObtained = 0;
  HROW* rghRows = NULL;
  DBPARAMS DBParams;

  void* pData = NULL;
  void* pRowData = NULL;
  ULONG cRows = 0;

  CTableCopy* pCTableCopy = m_pCWizard->m_pCTableCopy;
    ULONG ulParamSets = pCTableCopy->m_dwInsertOpt == IDR_PARAM_SETS ? pCTableCopy->m_ulParamSets : 0;
  ULONG ulBlobSize  = pCTableCopy->m_dwBlobOpt == IDR_BLOB_SIZE ? pCTableCopy->m_ulBlobSize : ULONG_MAX;
  ULONG ulMaxRows   = pCTableCopy->m_dwRowOpt == IDR_ROW_COUNT ? pCTableCopy->m_ulMaxRows : ULONG_MAX;

  BOOL bOutofLine = FALSE;
  ULONG cBindingInfo = 0;
  BINDINGINFO* rgBindingInfo = NULL;
  CProgress* pCProgress = m_pCWizard->m_pCProgress;

  //Get the Rowset from the SourceTable
  QTESTC(hr = pCSourceTable->CreateAccessors(&cBindingInfo, &rgBindingInfo, &cRowSize, ulBlobSize, &bOutofLine));

  //Obtain the Accessor
  SAFE_ALLOC(rgBindings, DBBINDING, m_cColumns);

  cBindings = 0;
  for(i=0; i<m_cColumns; i++)
  {
    rgBindings[cBindings].iOrdinal  = ulParamSets ? cBindings+1 : m_rgColDesc[i].iOrdinal;
    rgBindings[cBindings].obStatus  = ulOffset;
    rgBindings[cBindings].obLength  = ulOffset + sizeof(DBSTATUS);
    rgBindings[cBindings].obValue   = ulOffset + sizeof(ULONG) + sizeof(DBSTATUS);

    rgBindings[cBindings].pTypeInfo = NULL;
    rgBindings[cBindings].pBindExt  = NULL;

    rgBindings[cBindings].dwPart  = DBPART_VALUE | DBPART_LENGTH | DBPART_STATUS;
    rgBindings[cBindings].dwMemOwner= DBMEMOWNER_CLIENTOWNED;
    rgBindings[cBindings].eParamIO  = ulParamSets ? DBPARAMIO_INPUT : DBPARAMIO_NOTPARAM;
    rgBindings[cBindings].dwFlags = 0;

    rgBindings[cBindings].bPrecision= pCSourceTable->m_rgColDesc[i].bPrecision;
    rgBindings[cBindings].bScale  = pCSourceTable->m_rgColDesc[i].bScale;

    rgBindings[cBindings].pObject = NULL;
    rgBindings[cBindings].wType   = pCSourceTable->m_rgColDesc[i].wType;
    rgBindings[cBindings].cbMaxLen  = pCSourceTable->m_rgColDesc[i].ulColumnSize;

    //Account for the NULL terminator
    if(rgBindings[cBindings].wType == DBTYPE_STR)
      rgBindings[cBindings].cbMaxLen  += sizeof(CHAR);
    if(rgBindings[cBindings].wType == DBTYPE_WSTR)
      rgBindings[cBindings].cbMaxLen  += sizeof(WCHAR);

    //Adjust ISLONG Columns if not bound as ISeqStream
    if(pCSourceTable->m_rgColDesc[i].dwFlags & DBCOLUMNFLAGS_ISLONG)
      ADJUST_SIZE(rgBindings[cBindings].cbMaxLen, ulBlobSize);

    //ISeqStream
    if(m_rgColDesc[i].dwFlags & DBCOLUMNFLAGS_ISLONG &&
      pCTableCopy->m_dwBlobOpt == IDR_ISEQ_STREAM)
    {
      //Setup wType
      rgBindings[cBindings].wType   = DBTYPE_IUNKNOWN;
      rgBindings[cBindings].cbMaxLen  = sizeof(IUnknown*);

      //Setup pObject structure
      SAFE_ALLOC(rgBindings[cBindings].pObject, DBOBJECT, 1);
      rgBindings[cBindings].pObject->iid = IID_ISequentialStream;
      rgBindings[cBindings].pObject->dwFlags = STGM_READ;
    }

    ulOffset = ROUNDUP(rgBindings[cBindings].obValue + rgBindings[cBindings].cbMaxLen);

    //Only Bind Updatable columns
    //Note, we are not using the Source info here, since in the process
    //of adjusting columns to a different DSN, the columns may have become writeable
    if(m_rgColDesc[i].dwFlags & DBCOLUMNFLAGS_WRITE || m_rgColDesc[i].dwFlags & DBCOLUMNFLAGS_WRITEUNKNOWN)
      cBindings++;
  }

  //If using Parameters to INSERT the Data
  if(pCTableCopy->m_dwInsertOpt == IDR_PARAM_SETS)
  {
    // Now create the INSERT INTO statment
    CreateSQLStmt(ESQL_INSERT, wszSqlStmt, ulParamSets);

    //Set the command text
    XTESTC(hr = m_pCDataSource->m_pICommandText->SetCommandText(DBGUID_DBSQL, wszSqlStmt));

    //Create the Target Accessor
    XTESTC(hr = m_pCDataSource->m_pICommandText->QueryInterface(IID_IAccessor, (void**)&pIAccessor));
    XTESTC(hr = pIAccessor->CreateAccessor(DBACCESSOR_PARAMETERDATA, cBindings, rgBindings, ulOffset, &hAccessor, NULL));
  }
  //were using InsertRow
  else
  {
    //Obtain IRowsetChange interface from the TargetRowset
    XTESTC(hr = m_pIRowset->QueryInterface(IID_IRowsetChange, (void**)&pIRowsetChange));

    //Create the Target Accessor
    XTESTC(hr = m_pIRowset->QueryInterface(IID_IAccessor, (void**)&pIAccessor));
    XTESTC(hr = pIAccessor->CreateAccessor(DBACCESSOR_ROWDATA, cBindings, rgBindings, ulOffset, &hAccessor, NULL));

    if(pCTableCopy->m_dwInsertOpt == IDR_INSERTROW_BUFFERED)
      XTESTC(hr = m_pIRowset->QueryInterface(IID_IRowsetUpdate, (void**)&pIRowsetUpdate));
  }

  // Display the progress dialog
  pCProgress->Display();
  pCProgress->SetHeading(wsz_COPYING);

  //Alloc room for pData
  SAFE_ALLOC(pData, BYTE, max(ulParamSets, 1) * cRowSize);
  memset(pData, 0, max(ulParamSets, 1) * cRowSize);

  //Setup DBPARAMS Struct
  DBParams.cParamSets = 1;      //Numer of Parameter sets
  DBParams.hAccessor  = hAccessor;  //Target Param Accessor
  DBParams.pData    = pData;    //Source Data

  while(cRows < ulMaxRows)
  {
    XTESTC(hr = pISourceRowset->GetNextRows(NULL, 0, (ulParamSets > 1) ? ulParamSets : MAX_BLOCK_SIZE, &cRowsObtained, &rghRows));

    //ENDOFROWSET
    if(cRowsObtained==0)
      break;

    //Determine the number of rows that are actually needed to retrieve
    //The user might have specfified the number of rows to retrieve which could
    //be smaller than the number in the block size
    ULONG cRowsNeeded = min(cRowsObtained, ulMaxRows-cRows);

    //Use Parameters to INSERT the data, use MultipleParamSets
    if(ulParamSets > 1)
    {
      //GetData
      for(i=0; i<cRowsNeeded; i++)
      {
        pRowData = (BYTE*)pData + (i*cRowSize);
        for(j=0; j<cBindingInfo; j++)
        {
          XTESTC(hr = pISourceRowset->GetData(rghRows[i], rgBindingInfo[j].hAccessor, pRowData));

          //AdjustBindings
          QTESTC(hr = AdjustBindings(rgBindingInfo[j].cBindings, rgBindingInfo[j].rgBindings, pRowData));
        }
      }

      //Adjust the paramerer sets
      DBParams.cParamSets = cRowsNeeded;

      //Execute the INSERT (multiple param sets)
      XTESTC(hr = m_pCDataSource->m_pICommandText->Execute(NULL, IID_NULL, &DBParams, NULL, NULL));

      //FreeBindingData - outofline memory
      for(i=0; i<cRowsNeeded && bOutofLine; i++)
      {
        pRowData = (BYTE*)pData + (i*cRowSize);
        for(j=0; j<cBindingInfo; j++)
          QTESTC(FreeBindingData(rgBindingInfo[j].cBindings, rgBindingInfo[j].rgBindings, pData));
      }

      // Update insert progress
      swprintf(wszBuffer, wsz_COPIED_RECORDS, (cRows += cRowsNeeded));
      if(!pCProgress->Update(wszBuffer))
        goto CLEANUP;
    }
    //Use Paramseters to INSERT the data, but only 1 ParamSet (not multiple)
    else if(ulParamSets == 1)
    {
      for(i=0; i<cRowsNeeded; i++)
      {
        for(j=0; j<cBindingInfo; j++)
        {
          //GetData
          XTESTC(hr = pISourceRowset->GetData(rghRows[i], rgBindingInfo[j].hAccessor, pData));

          //AdjustBindings
          QTESTC(hr = AdjustBindings(rgBindingInfo[j].cBindings, rgBindingInfo[j].rgBindings, pData));
        }

        //Execute the INSERT
        XTESTC(hr = m_pCDataSource->m_pICommandText->Execute(NULL, IID_NULL, &DBParams, NULL, NULL));

        //FreeBindingData - outofline memory
        for(j=0; j<cBindingInfo && bOutofLine; j++)
          QTESTC(FreeBindingData(rgBindingInfo[j].cBindings, rgBindingInfo[j].rgBindings, pData));

        // Update insert progress
        swprintf(wszBuffer, wsz_COPIED_RECORDS, cRows++);
        if(!pCProgress->Update(wszBuffer))
          goto CLEANUP;
      }
    }
    //Use InsertRow to INSERT the Data
    else
    {
      for(i=0; i<cRowsNeeded; i++)
      {
        for(j=0; j<cBindingInfo; j++)
        {
          //GetData from the Source
          XTESTC(hr = pISourceRowset->GetData(rghRows[i], rgBindingInfo[j].hAccessor, pData));

          //AdjustBindings
          QTESTC(hr = AdjustBindings(rgBindingInfo[j].cBindings, rgBindingInfo[j].rgBindings, pData));
        }

        //InsertRow to the Target
        XTESTC(hr = pIRowsetChange->InsertRow(NULL, hAccessor, pData, NULL));

        // Update insert progress
        if(pCTableCopy->m_dwInsertOpt == IDR_INSERTROW_IMMEDIATE)
        {
          // Update insert progress
          swprintf(wszBuffer, wsz_COPIED_RECORDS, cRows++);
          if(!pCProgress->Update(wszBuffer))
            goto CLEANUP;
        }

        //FreeBindingData - outofline memory
        for(j=0; j<cBindingInfo && bOutofLine; j++)
          QTESTC(FreeBindingData(rgBindingInfo[j].cBindings, rgBindingInfo[j].rgBindings, pData));
      }

      //Use IRowsetUpdate::Update if in Bufferred mode
      //Update all, since we don't have the inserted row handles...
      if(pCTableCopy->m_dwInsertOpt == IDR_INSERTROW_BUFFERED)
      {
        XTESTC(hr = pIRowsetUpdate->Update(NULL, 0, NULL, NULL, NULL, NULL));

        // Update insert progress
        swprintf(wszBuffer, wsz_COPIED_RECORDS, cRows += cRowsNeeded);
        if(!pCProgress->Update(wszBuffer))
          goto CLEANUP;
      }
    }

    //Release the group of rows
    XTESTC(hr = pISourceRowset->ReleaseRows(cRowsObtained, rghRows, NULL, NULL, NULL));
    SAFE_FREE(rghRows);
  }

CLEANUP:
  //Stop the propgress
  pCProgress->Destroy();
  *pcRowsCopied = cRows;

  //Release Accessors
  if(hAccessor)
    XTEST(pIAccessor->ReleaseAccessor(hAccessor, NULL));
  SAFE_RELEASE(pIAccessor);

  //Free any outofbound data, (error case)
  for(i=0; i<cBindingInfo; i++)
    FreeBindingData(rgBindingInfo[i].cBindings, rgBindingInfo[i].rgBindings, pData);

  //Release Accessors
  for(i=0; i<cBindingInfo; i++)
  {
    XTEST(pCSourceTable->m_pIAccessor->ReleaseAccessor(rgBindingInfo[i].hAccessor, NULL));
    FreeBindings(rgBindingInfo[i].cBindings, rgBindingInfo[i].rgBindings);
  }

  SAFE_FREE(rgBindingInfo);
  FreeBindings(cBindings, rgBindings);
  SAFE_FREE(pData);

  SAFE_RELEASE(pIRowsetChange);
  SAFE_RELEASE(pIRowsetUpdate);
  SAFE_FREE(rghRows);
  return hr;
}

HRESULT CTable::CopyIndexes ( CTable * pCSourceTable ) [virtual]

Definition at line 781 of file table.cpp.

{
  ASSERT(pCTable);
  HRESULT hr;

  WCHAR     wszBuffer[MAX_NAME_LEN];
  WCHAR     wszSqlStmt[MAX_QUERY_LEN];
  ULONG i;

  // Don't waste time if there aren't any indexes.
  if (m_cIndexes == 0)
    return (S_OK);

  //Copy Index Info from Source table
  m_cIndexes  = pCTable->m_cIndexes;
  ULONG cIndexColumnDescs = 0;
  DBINDEXCOLUMNDESC* rgIndexColumnDescs = NULL;
  DBID* rgDBIDs = NULL;

  //Array to indicate which index/columns we have used
  ULONG* rgIndexUsed = NULL;
  SAFE_ALLOC(rgIndexUsed, ULONG, m_cIndexes);
  memset(rgIndexUsed, 0, m_cIndexes * sizeof(ULONG));

  SAFE_FREE(m_rgIndexInfo);
  SAFE_ALLOC(m_rgIndexInfo, INDEXINFO, m_cIndexes);
  memcpy(m_rgIndexInfo, pCTable->m_rgIndexInfo, m_cIndexes * sizeof(INDEXINFO));

  //Alloc DBINDEXCOLUMNDESC
  SAFE_ALLOC(rgIndexColumnDescs, DBINDEXCOLUMNDESC, m_cColumns);
  SAFE_ALLOC(rgDBIDs, DBID, m_cColumns);

  //Use IIndexDefinition::CreateIndex if supported
  if(m_pCDataSource->m_pIIndexDefinition)
  {
    //Create TableID
    DBID TableID;
    TableID.eKind = DBKIND_NAME;
    GetQuotedID(wszSqlStmt, m_wszQualTableName);
    TableID.uName.pwszName = wszSqlStmt;

    // Loop around each index that is valid.  See if any are to be created
    for(i=0; i<m_cIndexes; i++)
    {
      //If this index has already been created, skip
      //might have been used in another index creation
      if(rgIndexUsed[i])
        continue;

      //If this index is used as a primary key, skip
      //PrimaryKeys are taken care of differently
      if(m_rgIndexInfo[i].fIsPrimaryKey)
        continue;

      //Create IndexID
      DBID IndexID;
      IndexID.eKind = DBKIND_NAME;
      GetQuotedID(wszBuffer, m_rgIndexInfo[i].wszIndexName);
      IndexID.uName.pwszName = wszBuffer;

      // Now loop through all columns that belong to this index
      cIndexColumnDescs = 0;
      for(ULONG iCol=i; iCol<m_cIndexes; iCol++)
      {
        //If not the same index skip
        if(wcscmp(m_rgIndexInfo[i].wszIndexName, m_rgIndexInfo[iCol].wszIndexName)!=0)
          continue;

        //mark this Index as used
        rgIndexUsed[iCol] = TRUE;

        //DBINDEXCOLUMNDESC info
        rgIndexColumnDescs[cIndexColumnDescs].pColumnID = &rgDBIDs[cIndexColumnDescs];
        rgIndexColumnDescs[cIndexColumnDescs].pColumnID->eKind = DBKIND_NAME;
        rgIndexColumnDescs[cIndexColumnDescs].pColumnID->uName.pwszName = m_rgIndexInfo[iCol].wszColName;

        //Indicate column order
        rgIndexColumnDescs[cIndexColumnDescs].eIndexColOrder = (m_rgIndexInfo[iCol].dwCollation == DB_COLLATION_DESC) ? DBINDEX_COL_ORDER_DESC : DBINDEX_COL_ORDER_ASC;
        cIndexColumnDescs++;
      }

      //Now Setup Index Properties
      ULONG cPropSets = 0;
      DBPROPSET* rgPropSets = NULL;

      //DBPROP_INDEX_AUTOUPDATE
      if(IsSettableProperty(m_pCDataSource->m_pIDBInitialize, DBPROP_INDEX_AUTOUPDATE, DBPROPSET_INDEX))
        SetProperty(DBPROP_INDEX_AUTOUPDATE, DBPROPSET_INDEX, &cPropSets, &rgPropSets, DBTYPE_BOOL, m_rgIndexInfo[i].fAutoUpdate);

      //DBPROP_INDEX_CLUSTERED
      if(IsSettableProperty(m_pCDataSource->m_pIDBInitialize, DBPROP_INDEX_CLUSTERED, DBPROPSET_INDEX))
        SetProperty(DBPROP_INDEX_CLUSTERED, DBPROPSET_INDEX, &cPropSets, &rgPropSets, DBTYPE_BOOL, m_rgIndexInfo[i].fClustered);

      //DBPROP_INDEX_FILLFACTOR
      if(IsSettableProperty(m_pCDataSource->m_pIDBInitialize, DBPROP_INDEX_FILLFACTOR, DBPROPSET_INDEX))
        SetProperty(DBPROP_INDEX_FILLFACTOR, DBPROPSET_INDEX, &cPropSets, &rgPropSets, DBTYPE_I4, m_rgIndexInfo[i].dwFillFactor);

      //DBPROP_INDEX_INITIALSIZE
      if(IsSettableProperty(m_pCDataSource->m_pIDBInitialize, DBPROP_INDEX_INITIALSIZE, DBPROPSET_INDEX))
        SetProperty(DBPROP_INDEX_INITIALSIZE, DBPROPSET_INDEX, &cPropSets, &rgPropSets, DBTYPE_I4, m_rgIndexInfo[i].dwInitialSize);

      //DBPROP_INDEX_NULLCOLLATION
      if(IsSettableProperty(m_pCDataSource->m_pIDBInitialize, DBPROP_INDEX_NULLCOLLATION, DBPROPSET_INDEX))
        SetProperty(DBPROP_INDEX_NULLCOLLATION, DBPROPSET_INDEX, &cPropSets, &rgPropSets, DBTYPE_I4, m_rgIndexInfo[i].dwNullCollation);

      //DBPROP_INDEX_NULLS
      if(IsSettableProperty(m_pCDataSource->m_pIDBInitialize, DBPROP_INDEX_NULLS, DBPROPSET_INDEX))
        SetProperty(DBPROP_INDEX_NULLS, DBPROPSET_INDEX, &cPropSets, &rgPropSets, DBTYPE_I4, m_rgIndexInfo[i].dwNulls);

      //DBPROP_INDEX_PRIMARYKEY
      if(IsSettableProperty(m_pCDataSource->m_pIDBInitialize, DBPROP_INDEX_PRIMARYKEY, DBPROPSET_INDEX))
        SetProperty(DBPROP_INDEX_PRIMARYKEY, DBPROPSET_INDEX, &cPropSets, &rgPropSets, DBTYPE_BOOL, m_rgIndexInfo[i].fIsPrimaryKey);

      //DBPROP_INDEX_SORTBOOKMARKS
      if(IsSettableProperty(m_pCDataSource->m_pIDBInitialize, DBPROP_INDEX_SORTBOOKMARKS, DBPROPSET_INDEX))
        SetProperty(DBPROP_INDEX_SORTBOOKMARKS, DBPROPSET_INDEX, &cPropSets, &rgPropSets, DBTYPE_BOOL, m_rgIndexInfo[i].fSortBookmarks);

      //DBPROP_INDEX_TEMPINDEX
//      if(IsSettableProperty(m_pCDataSource->m_pIDBInitialize, DBPROP_INDEX_TEMPINDEX, DBPROPSET_INDEX))
//        SetProperty(DBPROP_INDEX_TEMPINDEX, DBPROPSET_INDEX, &cPropSets, &rgPropSets, DBTYPE_BOOL, m_rgIndexInfo[i].fTempIndex);

      //DBPROP_INDEX_TYPE
      if(IsSettableProperty(m_pCDataSource->m_pIDBInitialize, DBPROP_INDEX_TYPE, DBPROPSET_INDEX))
        SetProperty(DBPROP_INDEX_TYPE, DBPROPSET_INDEX, &cPropSets, &rgPropSets, DBTYPE_I4, m_rgIndexInfo[i].wType);

      //DBPROP_INDEX_UNIQUE
      if(IsSettableProperty(m_pCDataSource->m_pIDBInitialize, DBPROP_INDEX_UNIQUE, DBPROPSET_INDEX))
        SetProperty(DBPROP_INDEX_UNIQUE, DBPROPSET_INDEX, &cPropSets, &rgPropSets, DBTYPE_BOOL, m_rgIndexInfo[i].fUnique);

      //IIndexDefinition::CreateIndex
      //Don't exit yet, the user might want to continue even though this index failed
      XTEST(hr = m_pCDataSource->m_pIIndexDefinition->CreateIndex(&TableID, &IndexID, cIndexColumnDescs, rgIndexColumnDescs, cPropSets, rgPropSets, NULL));

      //Free Properties
      FreeProperties(cPropSets, rgPropSets);

      //If INDEX Failed
      if(FAILED(hr))
      {
        //Index Failed, Do you want to Continue?
        if(IDNO == wMessageBox(NULL, MB_TASKMODAL | MB_ICONINFORMATION | MB_YESNO, wsz_ERROR,
            wsz_INDEX_FAILED_, m_rgIndexInfo[i].wszIndexName))
          goto CLEANUP;
      }

      //Since the User didn't exit, continue as normal
      hr = S_OK;
    }
  }
  //Using SQL Commands to insert the index
  else if(m_pCDataSource->m_pICommandText)
  {

    // Loop around each index that is valid.  See if any are to be created
    for(i=0; i<m_cIndexes; i++)
    {
      //If this index has already been created, skip
      //might have been used in another index creation
      if(rgIndexUsed[i])
        continue;

      //If this index is used as a primary key, skip
      //PrimaryKeys are taken care of differently
      if(m_rgIndexInfo[i].fIsPrimaryKey)
        continue;

      //"CREATE <UNIQUE> INDEX "
      swprintf(wszSqlStmt, wsz_CREATE_INDEX_, (m_rgIndexInfo[i].fUnique == VARIANT_TRUE) ? wsz_UNIQUE_INDEX : wsz_SPACE);

      //Add IndexName to the list (quoted)
      GetQuotedID(wszBuffer, m_rgIndexInfo[i].wszIndexName);
      wcscat(wszSqlStmt, wszBuffer);

      //Add TableName
      wcscat(wszSqlStmt, L" ON ");
      GetQuotedID(wszBuffer, m_wszQualTableName);
      wcscat(wszSqlStmt, wszBuffer);
      wcscat(wszSqlStmt, wsz_LPAREN);

      // Now loop through find all columns that belong to this index
      for(ULONG iCol=i; iCol<m_cIndexes; iCol++)
      {
        //If not the same index skip
        if(wcscmp(m_rgIndexInfo[i].wszIndexName, m_rgIndexInfo[iCol].wszIndexName)!=0)
          continue;

        //mark this Index as used
        rgIndexUsed[iCol] = TRUE;

        //Add Column Name to the list (quoted)
        GetQuotedID(wszBuffer, m_rgIndexInfo[iCol].wszColName);
        wcscat(wszSqlStmt, wszBuffer);

        // Indicate Asending or Decending
        if(m_rgIndexInfo[iCol].dwCollation == DB_COLLATION_DESC)
          wcscat(wszSqlStmt, wsz_INDEX_DESC);

        //Add trailing "," between col names
        wcscat(wszSqlStmt, wsz_COMMA);
      }

      //Replace last trailing "," with a ")"
      wcscpy(&wszSqlStmt[wcslen(wszSqlStmt)-wcslen(wsz_COMMA)], wsz_RPAREN);

      // If user wants to see the statement, show it to them
      if(m_pCWizard->m_pCTableCopy->m_fShowQuery)
        wMessageBox(NULL, MB_TASKMODAL | MB_OK | MB_ICONINFORMATION, wsz_OLEDB,
          wsz_SHOW_SQL_, m_pCDataSource->m_pwszDataSource, wszSqlStmt);

      //Set the command text
      XTESTC(hr = m_pCDataSource->m_pICommandText->SetCommandText(DBGUID_DBSQL, wszSqlStmt));

      //Execute the command
      //Don't exit yet, the user might want to continue even though this index failed
      XTEST(hr = m_pCDataSource->m_pICommandText->Execute(NULL, IID_NULL, NULL, NULL, NULL));

      //If INDEX Failed
      if(FAILED(hr))
      {
        //Index Failed, Do you want to Continue?
        if(IDNO == wMessageBox(NULL, MB_TASKMODAL | MB_ICONINFORMATION | MB_YESNO, wsz_ERROR,
            wsz_INDEX_FAILED_, m_rgIndexInfo[i].wszIndexName))
          goto CLEANUP;
      }

      //Since the User didn't exit, continue as normal
      hr = S_OK;
    }
  }

CLEANUP:
  SAFE_FREE(rgIndexUsed);
  SAFE_FREE(rgIndexColumnDescs);
  SAFE_FREE(rgDBIDs);
  return hr;
}

HRESULT CTable::CreateAccessors | ( | ULONG * | pcBindingInfo,
 |  | BINDINGINFO ** | prgBindingInfo,
 |  | ULONG * | pcRowSize,
 |  | ULONG | ulBlobSize,
 |  | BOOL * | pbOutofLine |
 | ) |  |  | [virtual]

Definition at line 1216 of file table.cpp.

{
  ASSERT(m_pIRowset);
  ASSERT(m_pIAccessor);
  ASSERT(pcBindingInfo);
  ASSERT(prgBindingInfo);
  ASSERT(pbOutofLine);

  HRESULT hr = S_OK;

  ULONG ulOffset = 0;
  ULONG i,cBindings = 0;
  DBBINDING* rgBindings = NULL;
  ULONG cStorageObjects = 0;

  //Alloc the space for BindingInfo
  ULONG cBindingInfo = 0;
  BINDINGINFO* rgBindingInfo = NULL;
  SAFE_ALLOC(rgBindingInfo, BINDINGINFO, m_cColumns);

  //Alloc the space to hold the Bindings and Accessors
  SAFE_ALLOC(rgBindings, DBBINDING, m_cColumns);

  cBindings = 0;
  for(i=0; i<m_cColumns; i++)
  {
    //SetUp the Bindings
    rgBindings[cBindings].iOrdinal  = m_rgColDesc[i].iOrdinal;
    rgBindings[cBindings].obStatus  = ulOffset;
    rgBindings[cBindings].obLength  = ulOffset + sizeof(DBSTATUS);
    rgBindings[cBindings].obValue = ulOffset + sizeof(DBSTATUS) + sizeof(ULONG);

    rgBindings[cBindings].pTypeInfo = NULL;
    rgBindings[cBindings].pBindExt  = NULL;

    rgBindings[cBindings].dwPart  = DBPART_VALUE|DBPART_LENGTH|DBPART_STATUS;
    rgBindings[cBindings].dwMemOwner= DBMEMOWNER_CLIENTOWNED;
    rgBindings[cBindings].eParamIO  = DBPARAMIO_NOTPARAM;

    rgBindings[cBindings].dwFlags = 0;
    rgBindings[cBindings].bPrecision= m_rgColDesc[i].bPrecision;
    rgBindings[cBindings].bScale  = m_rgColDesc[i].bScale;

    rgBindings[cBindings].pObject = NULL;
    rgBindings[cBindings].wType   = m_rgColDesc[i].wType;
    rgBindings[cBindings].cbMaxLen  = m_rgColDesc[i].ulColumnSize;

    //Account for the NULL terminator
    if(rgBindings[cBindings].wType == DBTYPE_STR)
      rgBindings[cBindings].cbMaxLen  += sizeof(CHAR);
    if(rgBindings[cBindings].wType == DBTYPE_WSTR)
      rgBindings[cBindings].cbMaxLen  += sizeof(WCHAR);

    //Adjust ISLONG Columns if not bound as ISeqStream
    if(m_rgColDesc[i].dwFlags & DBCOLUMNFLAGS_ISLONG)
      ADJUST_SIZE(rgBindings[cBindings].cbMaxLen, ulBlobSize);

    //ISeqStream
    //Since some providers may only allow 1 storage object bound at a time
    //we will create a seperate accessor for each storage object bound.
    if(m_rgColDesc[i].dwFlags & DBCOLUMNFLAGS_ISLONG && ulBlobSize == ULONG_MAX)
    {
      cStorageObjects++;
      //Setup wType
      rgBindings[cBindings].wType   = DBTYPE_IUNKNOWN;
      rgBindings[cBindings].cbMaxLen  = sizeof(IUnknown*);

      //Setup pObject structure
      SAFE_ALLOC(rgBindings[cBindings].pObject, DBOBJECT, 1);
      rgBindings[cBindings].pObject->iid = IID_ISequentialStream;
      rgBindings[cBindings].pObject->dwFlags = STGM_READ;

      //Only need a seperate Accessor if there is more than 1 Storage column
      if(cStorageObjects > 1)
      {
        //Setup BindingInfo
        rgBindingInfo[cBindingInfo].cBindings = 1;
        SAFE_ALLOC(rgBindingInfo[cBindingInfo].rgBindings, DBBINDING, 1);
        memcpy(rgBindingInfo[cBindingInfo].rgBindings, &rgBindings[cBindings], sizeof(DBBINDING));

        //Create the accessor for the Storage column
        XTESTC(hr = m_pIAccessor->CreateAccessor(DBACCESSOR_ROWDATA, 1, &rgBindings[cBindings], 0, &rgBindingInfo[cBindingInfo].hAccessor, NULL));
        cBindingInfo++;
      }
    }

    //Determine if there is out of line data...
    switch(rgBindings[cBindings].wType)
    {
      case DBTYPE_VARIANT:
        *pbOutofLine = TRUE;
        break;
    }

    ulOffset = ROUNDUP(rgBindings[cBindings].obValue + rgBindings[cBindings].cbMaxLen);

    //Already handled ISeqStream columns
    if(!(m_rgColDesc[i].dwFlags & DBCOLUMNFLAGS_ISLONG && ulBlobSize == ULONG_MAX && cStorageObjects>1))
      cBindings++;
  }

  //Create the accessor for the entire row, (excluding Storage columns)
  if(cBindings)
  {
    //Setup BindingInfo
    rgBindingInfo[cBindingInfo].cBindings = cBindings;
    rgBindingInfo[cBindingInfo].rgBindings = rgBindings;

    XTESTC(hr = m_pIAccessor->CreateAccessor(DBACCESSOR_ROWDATA, cBindings, rgBindings, 0, &rgBindingInfo[cBindingInfo].hAccessor, NULL));
    cBindingInfo++;
  }

  //Size for pData
  if(pcRowSize)
    *pcRowSize = ulOffset;

  //Accessors
  *pcBindingInfo = cBindingInfo;
  *prgBindingInfo = rgBindingInfo;

CLEANUP:
  return hr;
}

HRESULT CTable::CreateSQLStmt | ( | ESQL_STMT | eSqlStmt,
 |  | WCHAR * | pwszSqlStmt,
 |  | BOOL | fShowSql = TRUE |
 | ) |  |  | [virtual]

Definition at line 1023 of file table.cpp.

{
  ASSERT(pwszSqlStmt);
  HRESULT hr = S_OK;
  WCHAR     wszBuffer[MAX_NAME_LEN*2];   // Buffer

  switch(eSqlStmt)
  {
    //SELECT <ColumnList> FROM <QualifiedTableName>
    case ESQL_SELECT:
    {
      //Create the SELECT statment
      wcscpy(pwszSqlStmt, wsz_SELECT);

      // Loop through each column
      for(ULONG i=0; i<m_cColumns; i++)
      {
        // Add the column to the list (quoted)
        GetQuotedID(wszBuffer, m_rgColDesc[i].wszColName);
        wcscat(pwszSqlStmt, wszBuffer);

        if(i<m_cColumns-1)
          wcscat(pwszSqlStmt, wsz_COMMA);
      }

      // Add the Table Name
      wcscat(pwszSqlStmt, wsz_FROM);
      GetQuotedID(wszBuffer, m_wszQualTableName);
      wcscat(pwszSqlStmt, wszBuffer);
    }
    break;

    case ESQL_INSERT:
    {
      wcscpy(pwszSqlStmt, wsz_INSERT_INTO);

      //Add the Table Name
      GetQuotedID(wszBuffer, m_wszQualTableName);
      wcscat(pwszSqlStmt, wszBuffer);
      wcscat(pwszSqlStmt, wsz_LPAREN);
      ULONG cColumns = 0;

      // Add the column list
      for(ULONG i=0; i<m_cColumns; i++)
      {
        //Only Bind updatable columns
        if(m_rgColDesc[i].dwFlags & DBCOLUMNFLAGS_WRITE || m_rgColDesc[i].dwFlags & DBCOLUMNFLAGS_WRITEUNKNOWN)
        {
          //Only add a leading comma if there are preceding columns
          if(cColumns++)
            wcscat(pwszSqlStmt, wsz_COMMA);

          // Add the column to the list (quoted)
          GetQuotedID(wszBuffer, m_rgColDesc[i].wszColName);
          wcscat(pwszSqlStmt, wszBuffer);
        }
      }

      //Add VALUES clause
      wcscat(pwszSqlStmt, wsz_VALUES_CLAUSE);

      // Loop through each column
      cColumns = 0;
      for(i=0; i<m_cColumns; i++)
      {
        //Only Bind those columns that are updatable
        if(m_rgColDesc[i].dwFlags & DBCOLUMNFLAGS_WRITE || m_rgColDesc[i].dwFlags & DBCOLUMNFLAGS_WRITEUNKNOWN)
        {
          //Only add a leading comma if there are preceding columns
          if(cColumns++)
            wcscat(pwszSqlStmt, wsz_COMMA);
          wcscat(pwszSqlStmt, wsz_PARAM);
        }
      }

      // Finish off the string
      wcscat(pwszSqlStmt, wsz_RPAREN);
    }
    break;

    case ESQL_CREATE_TABLE:
    {

      // Setup the initialize CREATE TABLE '<CTableName>'
      wcscpy(pwszSqlStmt, wsz_CREATE_TABLE);
      GetQuotedID(wszBuffer, m_wszQualTableName);
      wcscat(pwszSqlStmt, wszBuffer);

      // Setup (<ColList>)
      wcscat(pwszSqlStmt, wsz_LPAREN);

      // Loop through each column and format the column name, type, and precision
      for(ULONG i=0; i<m_cColumns; i++)
      {
        // Add the column to the list (quoted)
        GetQuotedID(wszBuffer, m_rgColDesc[i].wszColName);
        wcscat(pwszSqlStmt, wszBuffer);
        wcscat(pwszSqlStmt, wsz_SPACE);

        // Add ColumnType (formatted with CreateParams)
        GetTypeNameAndParams(i, wszBuffer);
        wcscat(pwszSqlStmt, wszBuffer);

        //Add PRIMARY KEY if Supported and a PrimaryKey Column
        if(m_rgColDesc[i].fIsPrimaryKey && m_pCDataSource->m_fPrimaryKeysSupported && m_pCWizard->m_pCTableCopy->m_fCopyPrimaryKeys)
          wcscat(pwszSqlStmt, wsz_PRIMARY_KEY);

        //Add Comma
        if(i<m_cColumns-1)
          wcscat(pwszSqlStmt, wsz_COMMA);
      }

      //Add trailing ")"
      wcscat(pwszSqlStmt, wsz_RPAREN);
    }
    break;

    case ESQL_DROP_TABLE:
    {
      GetQuotedID(wszBuffer, m_wszQualTableName);
      swprintf(pwszSqlStmt, wsz_DROP_TABLE_, wszBuffer);
    }
    break;

    default:
      ASSERT(!"Unhandled Case!");
      break;
  };

  // If user wants to see the statement, show it to them
  if(m_pCWizard->m_pCTableCopy->m_fShowQuery && fShowSql)
    wMessageBox(NULL, MB_TASKMODAL | MB_OK | MB_ICONINFORMATION, wsz_OLEDB,
      wsz_SHOW_SQL_, m_pCDataSource->m_pwszDataSource, pwszSqlStmt);

  return hr;
}

HRESULT CTable::CreateTable ( ) [virtual]

Definition at line 651 of file table.cpp.

{
  ASSERT(m_pCDataSource);
  ASSERT(m_pCDataSource->m_pICommandText || m_pCDataSource->m_pIOpenRowset);
  HRESULT hr;

  BSTR      bstrSqlState = NULL;
  WCHAR     wszSqlStmt[MAX_QUERY_LEN];  // Create table statement

  ULONG cRecords = 0;
  IErrorRecords* pIErrorRecords = NULL;
  ICommandText* pICommandText = NULL;
  DBCOLUMNDESC* rgColumnDesc = NULL;

  //Release any existing rowsets
  SAFE_RELEASE(m_pIRowset);
  SAFE_RELEASE(m_pIAccessor);

  //If ITableDefinition is supported by the provider, use it by default.
  if(m_pCDataSource->m_pITableDefinition)
  {
    DBID      TableID;

    //Get DBCOLUMNDESC info
    QTESTC(hr = GetColumnDesc(&rgColumnDesc));

    //Create TableID
    TableID.eKind = DBKIND_NAME;
    TableID.uName.pwszName = wszSqlStmt;
    GetQuotedID(wszSqlStmt, m_wszQualTableName);

    //ITableDefinition::CreateTable
    hr = m_pCDataSource->m_pITableDefinition->CreateTable(NULL, &TableID, m_cColumns, rgColumnDesc, IID_NULL, NULL, NULL, NULL, NULL);

    //If table already exists, offer to drop it
    if(hr == DB_E_DUPLICATETABLEID)
    {
      //If the user doesn't wants to drop it, exit
      if(IDNO == wMessageBox(NULL, MB_TASKMODAL | MB_ICONQUESTION | MB_YESNO, wsz_ERROR,
        wsz_ASK_DROP_TABLE_, m_pCDataSource->m_pwszTableTerm, m_wszQualTableName))
        goto CLEANUP;

      //Otherwise drop that table and continue
      XTESTC(hr = m_pCDataSource->m_pITableDefinition->DropTable(&TableID));
      XTESTC(hr = m_pCDataSource->m_pITableDefinition->CreateTable(NULL, &TableID, m_cColumns, rgColumnDesc, IID_NULL, NULL, NULL, NULL, NULL));
    }
    //If succeeded offer warning and continue
    if(hr == DB_S_ERRORSOCCURRED)
    {
            //TODO:display dialog
        }
    else
    {
      //Some other failure
      //Display Extended ErrorInfo
      XTESTC(hr);
    }
  }
  // Otherwise use SQL to create the table.
  else if(m_pCDataSource->m_pICommandText)
  {
    // Setup the initialize CREATE TABLE '<CTableName>'
    CreateSQLStmt(ESQL_CREATE_TABLE, wszSqlStmt);

    // Set the Command Text
    pICommandText = m_pCDataSource->m_pICommandText;
    XTESTC(hr = pICommandText->SetCommandText(DBGUID_DBSQL, wszSqlStmt));

    // Execute the command
    hr = pICommandText->Execute(NULL, IID_NULL, NULL, NULL, NULL);

    // If this didn't work, then we need to display messages, and if the
    // error was a duplicate table, offer to drop.
    if(FAILED(hr))
    {
      //Get the Error Records, need to save them, since every call
      //cleans the previous error objects
      QTESTC(GetErrorRecords(&cRecords, &pIErrorRecords));

      //If Error was due to an existing table, just ask to drop it
      if(GetSqlErrorInfo(0, pIErrorRecords, &bstrSqlState)==S_OK &&
        bstrSqlState && wcscmp(bstrSqlState, L"S0001")==0)
      {
        WCHAR   wszBuffer[MAX_QUERY_LEN];

        //If the user doesn't wants to drop it, exit
        if(IDNO == wMessageBox(NULL, MB_TASKMODAL | MB_ICONQUESTION | MB_YESNO, wsz_ERROR,
                  wsz_ASK_DROP_TABLE_, m_pCDataSource->m_pwszTableTerm, m_wszQualTableName))
          goto CLEANUP;

        //Otherwise drop that table and continue
        CreateSQLStmt(ESQL_DROP_TABLE, wszBuffer);

        //Drop the existing Table
        XTESTC(hr = pICommandText->SetCommandText(DBGUID_DBSQL, wszBuffer));
        XTESTC(hr = pICommandText->Execute(NULL, IID_NULL, NULL, NULL, NULL));

        //Now reset the CreateTable text to the SqlStmt and Execute
        XTESTC(hr = pICommandText->SetCommandText(DBGUID_DBSQL, wszSqlStmt));
        XTESTC(hr = pICommandText->Execute(NULL, IID_NULL, NULL, NULL, NULL));
      }
      else
      {
        //Otherwsie unknown error, just display it to the user
        DisplayErrorRecords(NULL, cRecords, pIErrorRecords);
      }
    }
  }

CLEANUP:
  SAFE_SYSFREE(bstrSqlState);
  SAFE_RELEASE(pIErrorRecords);

  //Free DBCOLUMNDESC
  if(rgColumnDesc)
  {
    for(ULONG i=0; i<m_cColumns && rgColumnDesc; i++)
      FreeProperties(rgColumnDesc[i].cPropertySets, rgColumnDesc[i].rgPropertySets);
    SAFE_FREE(rgColumnDesc);
  }
  return hr;
}

HRESULT CTable::GetColInfo ( DWORD dwInsertOpt ) [virtual]

Definition at line 286 of file table.cpp.

{
  HRESULT hr;

  ULONG i,cColumns = 0;
  DBCOLUMNINFO* rgColInfo = NULL;
  WCHAR*  rgStringBuffer = NULL;
  IColumnsInfo* pIColumnsInfo = NULL;

  //Obtain the rowset (m_pIRowset);
  QTESTC(hr = GetRowset(dwInsertOpt));
  CHECKC(m_pIRowset);

  //Now finally GetColInfo
  XTESTC(hr = m_pIRowset->QueryInterface(IID_IColumnsInfo, (void **)&pIColumnsInfo));
  XTESTC(hr = pIColumnsInfo->GetColumnInfo(&cColumns, &rgColInfo, &rgStringBuffer));

  //Alloc room for the COLDESC
  SAFE_FREE(m_rgColDesc);
  SAFE_ALLOC(m_rgColDesc, COLDESC, cColumns);
  memset(m_rgColDesc, 0, cColumns*sizeof(COLDESC));

  //Loop through the ColInfo and Copy to our ColDesc
  m_cColumns = 0;
  for(i=0; i<cColumns; i++)
  {
    //ignore Bookmark columns
    if(rgColInfo[i].iOrdinal == 0)
      continue;

    //DBCOLUMNINFO pwszName
    if(rgColInfo[i].pwszName==NULL)
    {
        //Although ColInfo is allowed to return NULL for unknown column names
      //TableCopy needs column names for many operations,
      //(CREATE TABLE, INSERT, INDEXES), so just "generate" one
      swprintf(m_rgColDesc[m_cColumns].wszColName, L"Unknown%d", i);
    }
    else
    {
      wcscpy(m_rgColDesc[m_cColumns].wszColName, rgColInfo[i].pwszName);
    }

    //Now copy the rest of the info
    m_rgColDesc[m_cColumns].iOrdinal    = rgColInfo[i].iOrdinal;
    m_rgColDesc[m_cColumns].ulColumnSize  = rgColInfo[i].ulColumnSize;
    m_rgColDesc[m_cColumns].wType     = rgColInfo[i].wType;
    m_rgColDesc[m_cColumns].dwFlags     = rgColInfo[i].dwFlags;
    m_rgColDesc[m_cColumns].bPrecision    = rgColInfo[i].bPrecision;
    m_rgColDesc[m_cColumns].bScale      = rgColInfo[i].bScale;
    m_cColumns++;
  }

CLEANUP:
  SAFE_RELEASE(pIColumnsInfo);
  SAFE_FREE(rgColInfo);
  SAFE_FREE(rgStringBuffer);
  return hr;
}

HRESULT CTable::GetColumnDesc ( DBCOLUMNDESC ** prgColumnDesc ) [virtual]

Definition at line 1843 of file table.cpp.

{
  //Init buffer
  ULONG i=0;
  HRESULT hr = S_OK;
  DBCOLUMNDESC* rgColumnDesc = NULL;
  SAFE_ALLOC(rgColumnDesc, DBCOLUMNDESC, m_cColumns);

  // For each column, fill out DBCOLUMNDESC info
  for(i=0; i<m_cColumns; i++)
  {
    //TypeName
    rgColumnDesc[i].pwszTypeName = m_rgColDesc[i].wszTypeName;

    rgColumnDesc[i].pTypeInfo  = NULL;
    rgColumnDesc[i].pclsid     = NULL;

    //ColumnID
    rgColumnDesc[i].dbcid.eKind = DBKIND_NAME;
    rgColumnDesc[i].dbcid.uName.pwszName = m_rgColDesc[i].wszColName;

    //Typeinfo
    rgColumnDesc[i].wType     = m_rgColDesc[i].wType;
    rgColumnDesc[i].ulColumnSize  = m_rgColDesc[i].ulColumnSize;
    rgColumnDesc[i].bPrecision    = m_rgColDesc[i].bPrecision;
    rgColumnDesc[i].bScale      = m_rgColDesc[i].bScale;

    //Properties
    rgColumnDesc[i].cPropertySets = 0;
    rgColumnDesc[i].rgPropertySets = NULL;

    //DBPPROP_COL_AUTOINCREMENT
//why make a column auto inc just cause it can be?
//    if(IsSettableProperty(m_pCDataSource->m_pIDBInitialize, DBPROP_COL_AUTOINCREMENT, DBPROPSET_COLUMN))
//      SetProperty(DBPROP_COL_AUTOINCREMENT, DBPROPSET_COLUMN, &rgColumnDesc[i].cPropertySets, &rgColumnDesc[i].rgPropertySets, DBTYPE_BOOL, m_rgColDesc[i].fIsAutoInc,DBPROPOPTIONS_OPTIONAL);

    //TODO DBPROP_COL_DEFAULT

    //TODO DBPROP_COL_DESCRIPTION

    //DBPROP_COL_FIXEDLENGTH
    if(IsSettableProperty(m_pCDataSource->m_pIDBInitialize, DBPROP_COL_FIXEDLENGTH, DBPROPSET_COLUMN))
      SetProperty(DBPROP_COL_FIXEDLENGTH, DBPROPSET_COLUMN, &rgColumnDesc[i].cPropertySets, &rgColumnDesc[i].rgPropertySets, DBTYPE_BOOL, IsNumericType(m_rgColDesc[i].wType),DBPROPOPTIONS_OPTIONAL);

    //DBPROP_COL_NULLABLE
    if(IsSettableProperty(m_pCDataSource->m_pIDBInitialize, DBPROP_COL_NULLABLE, DBPROPSET_COLUMN))
      SetProperty(DBPROP_COL_NULLABLE, DBPROPSET_COLUMN, &rgColumnDesc[i].cPropertySets, &rgColumnDesc[i].rgPropertySets, DBTYPE_BOOL, m_rgColDesc[i].fIsNullable,DBPROPOPTIONS_OPTIONAL);

    //DBPROP_COL_PRIMARYKEY
    if(IsSettableProperty(m_pCDataSource->m_pIDBInitialize, DBPROP_COL_PRIMARYKEY, DBPROPSET_COLUMN))
      SetProperty(DBPROP_COL_PRIMARYKEY, DBPROPSET_COLUMN, &rgColumnDesc[i].cPropertySets, &rgColumnDesc[i].rgPropertySets, DBTYPE_BOOL, m_rgColDesc[i].fIsPrimaryKey && m_pCWizard->m_pCTableCopy->m_fCopyPrimaryKeys,DBPROPOPTIONS_OPTIONAL);

    //TODO DBPROP_COL_UNIQUE
  }

CLEANUP:
  *prgColumnDesc = rgColumnDesc;
  return hr;
}

HRESULT CTable::GetLiteralInfo ( ) [virtual]

Definition at line 120 of file table.cpp.

{
  ASSERT(m_pCDataSource);
  ASSERT(m_pCDataSource->m_pIDBInitialize);

  HRESULT hr;

  const static ULONG cLiterals = 2;
  const static DBLITERAL rgLiterals[cLiterals] = {DBLITERAL_QUOTE, DBLITERAL_CATALOG_SEPARATOR};

  IDBInfo* pIDBInfo = NULL;

  ULONG cLiteralInfo = 0;
  DBLITERALINFO* rgLiteralInfo = NULL;
  WCHAR* pwszCharBuffer = NULL;

  //Reset Info
  m_wszIDQuote[0] = EOL;
  m_wszIDSeperator[0] = EOL;

  //Obtain IDBInfo interface
  //Some providers may not support IDBInfo so don't display dialog
  QTESTC(hr = m_pCDataSource->m_pIDBInitialize->QueryInterface(IID_IDBInfo, (void **)&pIDBInfo));

  //GetLiteralInfo
  //Can return an error for unsupported literals
  hr = pIDBInfo->GetLiteralInfo(cLiterals, rgLiterals, &cLiteralInfo, &rgLiteralInfo, &pwszCharBuffer);

  //DBLITERAL_QUOTE
  if(rgLiteralInfo && rgLiteralInfo[0].fSupported)
    wcscpy(m_wszIDQuote, rgLiteralInfo[0].pwszLiteralValue);

  //DBLITERAL_CATALOG_SEPARATOR
  if(rgLiteralInfo && rgLiteralInfo[1].fSupported)
    wcscpy(m_wszIDSeperator, rgLiteralInfo[1].pwszLiteralValue);

CLEANUP:
  SAFE_RELEASE(pIDBInfo);
  SAFE_FREE(rgLiteralInfo);
  SAFE_FREE(pwszCharBuffer);
  return hr;
}

BOOL CTable::GetQuotedID | ( | WCHAR * | pwszOutBuff,
 |  | WCHAR * | pwszInBuff |
 | ) |  |  | [virtual]

Definition at line 170 of file table.cpp.

{
  WCHAR pwsz[MAX_NAME_LEN*2];
  WCHAR* pwszItr = pwsz;

  ULONG cQuoteLen = wcslen(m_wszIDQuote);
  ULONG cSepLen = wcslen(m_wszIDSeperator);
  ULONG cPeriodLen= wcslen(wsz_PERIOD);

  //No-op case
  //If the provider doesn't have a delimiter, then just use input name.
  if(cQuoteLen == 0)
  {
    wcscpy(pwszOutBuff, pwszInBuff);
    return (TRUE);
  }

  //Put on front delimeter
  wcscpy(pwszItr, m_wszIDQuote);
  pwszItr += cQuoteLen;

  //Copy from Source to Temp
  while(*pwszInBuff!=EOL)
  {
    //If we have a seperator char, we need to quote both pieces
    if(wcsncmp(pwszInBuff, m_wszIDSeperator, cSepLen)==0)
    {
      // "nstl@odbc.authors -> "nstl"@"odbc.authors"
      wcscat(pwszItr, m_wszIDQuote);    //Ending Quote
      wcscat(pwszItr, m_wszIDSeperator);  //Seperator
      wcscat(pwszItr, m_wszIDQuote);    //Beginning Quote
      pwszItr += cQuoteLen + cSepLen + cQuoteLen;
    }
    else if(*pwszInBuff == L'.')
    {
      // "nstl@odbc.authors -> "nstl@odbc"."authors"
      wcscat(pwszItr, m_wszIDQuote);    //Ending Quote
      wcscat(pwszItr, wsz_PERIOD);    //Period
      wcscat(pwszItr, m_wszIDQuote);    //Beginning Quote
      pwszItr += cQuoteLen + cPeriodLen + cQuoteLen;
    }
    else
    {
      *pwszItr = *pwszInBuff;     //Actual Character
      pwszItr++;
    }

    pwszInBuff++;
    *pwszItr = EOL;
  }

  //Put on the Tail delimeter
  wcscat(pwszItr, m_wszIDQuote);

  //Give back to the user
  wcscpy(pwszOutBuff, pwsz);
  return TRUE;
}

HRESULT CTable::GetRowset ( DWORD dwInsertOpt ) [virtual]

Definition at line 1345 of file table.cpp.

{
  ASSERT(m_pCDataSource);
  WCHAR   wszBuffer[MAX_NAME_LEN];
  HRESULT hr;

  ULONG cPropSets = 0;
  DBPROPSET* rgPropSets = NULL;

  //Release the current rowset
  SAFE_RELEASE(m_pIRowset);
  SAFE_RELEASE(m_pIAccessor);

  //Kagera's Implementation requires IID_RowsetLocate for BLOB Support
  if(IsSettableProperty(m_pCDataSource->m_pIDBInitialize, DBPROP_IRowsetLocate, DBPROPSET_ROWSET))
    SetProperty(DBPROP_IRowsetLocate, DBPROPSET_ROWSET, &cPropSets, &rgPropSets, DBTYPE_BOOL, TRUE);

  //DBPROP_UPDATABILITY
  if(dwInsertOpt != IDR_PARAM_SETS && IsSettableProperty(m_pCDataSource->m_pIDBInitialize, DBPROP_UPDATABILITY, DBPROPSET_ROWSET))
    SetProperty(DBPROP_UPDATABILITY, DBPROPSET_ROWSET, &cPropSets, &rgPropSets, DBTYPE_I4, DBPROPVAL_UP_CHANGE | DBPROPVAL_UP_DELETE | DBPROPVAL_UP_INSERT);

  //DBPROP_IRowsetChange
  if(dwInsertOpt == IDR_INSERTROW_IMMEDIATE && IsSettableProperty(m_pCDataSource->m_pIDBInitialize, DBPROP_IRowsetChange, DBPROPSET_ROWSET))
    SetProperty(DBPROP_IRowsetChange, DBPROPSET_ROWSET, &cPropSets, &rgPropSets, DBTYPE_BOOL, TRUE);

  //DBPROP_IRowsetUpdate
  if(dwInsertOpt == IDR_INSERTROW_BUFFERED && IsSettableProperty(m_pCDataSource->m_pIDBInitialize, DBPROP_IRowsetUpdate, DBPROPSET_ROWSET))
  {
    //DBPROP_CANHOLDROWS
    //In order to insert more rows while there are pending changes
    SetProperty(DBPROP_CANHOLDROWS, DBPROPSET_ROWSET, &cPropSets, &rgPropSets, DBTYPE_BOOL, TRUE);
    SetProperty(DBPROP_IRowsetUpdate, DBPROPSET_ROWSET, &cPropSets, &rgPropSets, DBTYPE_BOOL, TRUE);
  }

  //Setup TableID
  DBID TableID;
  TableID.eKind = DBKIND_NAME;

  //Quote the TableName
  TableID.uName.pwszName = wszBuffer;
  GetQuotedID(wszBuffer, m_wszQualTableName);

  //IOpenRowset
  XTESTC(hr = m_pCDataSource->m_pIOpenRowset->OpenRowset(NULL, &TableID, NULL, IID_IRowset, cPropSets, rgPropSets, (IUnknown**)&m_pIRowset));
  CHECKC(m_pIRowset);

  //Obtain the Accessor
  XTESTC(hr = m_pIRowset->QueryInterface(IID_IAccessor, (void**)&m_pIAccessor));

CLEANUP:
  FreeProperties(cPropSets, rgPropSets);
  return hr;
}

HRESULT CTable::GetTypeInfo ( ) [virtual]

Definition at line 353 of file table.cpp.

{
  ASSERT(m_pCDataSource);
  HRESULT hr;

  IRowset*  pIRowset = NULL;
  IAccessor*  pIAccessor = NULL;
  HACCESSOR hAccessor = DB_NULL_HACCESSOR;

  ULONG   i;
  ULONG   cRowsObtained = 0;
  HROW*   rghRows = NULL;

  //Current SchemaInfo for each type, until we find the correct match
  TYPEINFO TypeInfo;
  TYPEINFO* rgTypeInfo = NULL;
  ULONG* rgMatch = NULL;

  //Arrays to store best TypeInfo
  SAFE_ALLOC(rgTypeInfo, TYPEINFO, m_cColumns);
  SAFE_ALLOC(rgMatch, ULONG, m_cColumns);
  memset(rgMatch, NO_MATCH, m_cColumns*sizeof(ULONG));

  //Get ProviderTypes rowset IDBSchemaRowset
  QTESTC(hr = GetTypeInfoRowset(&pIAccessor, &hAccessor, &pIRowset));

  //Loop over all the Schema TypeInfo rowset
  //And match up with ColInfo
  while(TRUE)
  {
    XTESTC(hr = pIRowset->GetNextRows(NULL,0,MAX_BLOCK_SIZE,&cRowsObtained, &rghRows));

    //ENDOFROWSET
    if(cRowsObtained==0)
      break;

    //Loop over the BLOCK of rows obtained
    for(i=0; i<cRowsObtained; i++)
    {
      //Reset all the TypeInfo fields
      memset(&TypeInfo, 0, sizeof(TYPEINFO));

      //Put the data for one type into the TypeInfo Struct
      XTESTC(hr = pIRowset->GetData(rghRows[i],hAccessor, (void*)&TypeInfo));

      //Loop over all the columns and see if they match this type
      for(ULONG iCol=0; iCol<m_cColumns; iCol++)
      {
        ASSERT(m_rgColDesc);

        //Only try matching if this is the correct type and
        //the column doesn't already have a perfect match
        if(TypeInfo.wType != m_rgColDesc[iCol].wType || (rgMatch[iCol] & MATCH_EXACT))
          continue;

        //A Nullable type cannot be mapped to a non-Nullable type
        if(m_rgColDesc[iCol].fIsNullable && !TypeInfo.fIsNullable)
          continue;

        //If never matched before, we at least know they match by type
        if(!rgMatch[iCol])
        {
          rgMatch[iCol] |= MATCH_TYPE;
          rgTypeInfo[iCol] = TypeInfo;
        }

        // Exact type/size matches take precedence
        if(COLINFO_SIZE(m_rgColDesc[iCol]) == TypeInfo.ulColumnSize)
        {
          rgMatch[iCol] |= MATCH_EXACT;
          rgTypeInfo[iCol] = TypeInfo;
        }

        // Otherwise try best fit size
        if(COLINFO_SIZE(m_rgColDesc[iCol]) < TypeInfo.ulColumnSize &&
          TypeInfo.ulColumnSize <= rgTypeInfo[iCol].ulColumnSize)
        {
          rgMatch[iCol] |= MATCH_SIZE;
          rgTypeInfo[iCol] = TypeInfo;
        }
      }
    }

    //Release this group of rows
    XTESTC(hr = pIRowset->ReleaseRows(cRowsObtained,rghRows,NULL,NULL,NULL));
    SAFE_FREE(rghRows);
  }

  //Now that we have the TypeInfo matched, fill in our ColDesc struct
  for(i=0; i<m_cColumns; i++)
  {
    ASSERT(m_rgColDesc);
    if(rgMatch[i])
    {
      //TYPEINFO
      wcscpy(m_rgColDesc[i].wszTypeName, rgTypeInfo[i].wszTypeName);
      m_rgColDesc[i].ulCreateParams = GetCreateParams(rgTypeInfo[i].wszCreateParams);
      m_rgColDesc[i].fIsNullable    = rgTypeInfo[i].fIsNullable == VARIANT_TRUE;
      m_rgColDesc[i].fIsAutoInc   = rgTypeInfo[i].fIsAutoInc == VARIANT_TRUE;
    }
    else
    {
      wMessageBox(NULL, MB_TASKMODAL | MB_ICONEXCLAMATION | MB_OK, wsz_ERROR,
        wsz_NO_TYPE_FOUND_, GetDBTypeName(m_rgColDesc[i].wType));
    }
  }

CLEANUP:
  if(hAccessor && pIAccessor)
    XTEST(pIAccessor->ReleaseAccessor(hAccessor,NULL));

  SAFE_RELEASE(pIAccessor);
  SAFE_RELEASE(pIRowset);

  SAFE_FREE(rgMatch);
  SAFE_FREE(rgTypeInfo);

  SAFE_FREE(rghRows);
  return hr;
}

HRESULT CTable::GetTypeInfoRowset | ( | IAccessor ** | ppIAccessor,
 |  | HACCESSOR * | phAccessor,
 |  | IRowset ** | ppIRowset |
 | ) |  |  | [virtual]

Definition at line 1706 of file table.cpp.

{
  ASSERT(ppIAccessor && phAccessor && ppIRowset);
  ASSERT(m_pCDataSource && m_pCDataSource->m_pIOpenRowset);
  HRESULT hr;

  IDBSchemaRowset* pIDBSchemaRowset = m_pCDataSource->m_pIDBSchemaRowset;

  //Provider doesn't have to support IDBSchemaRowset
  if(pIDBSchemaRowset == NULL)
    return E_FAIL;

  //Bind all the columns from types rowset:
  const static ULONG cBindings = 6;
  const static DBBINDING rgBindings[cBindings] =
  {
    //TYPE_NAME
    1,
    offsetof(TYPEINFO, wszTypeName),  // offset of value in consumers buffer
    0,                  // offset of length
    0,                  // offset of status
    NULL,               // reserved
    NULL,               // for ole object
    NULL,               // reserved
    DBPART_VALUE,           // specifies Value is bound only
    DBMEMOWNER_CLIENTOWNED,       // memory is client owned
    DBPARAMIO_NOTPARAM,         //
    MAX_NAME_LEN,           // size in bytes of the value part in the consumers buffer
    0,                  // reserved
    DBTYPE_WSTR,            // data type indicator
    0,                  // precision
    0,                  // scale

    //DATA_TYPE
    2,
    offsetof(TYPEINFO, wType),      // offset of value in consumers buffer
    0,                  // offset of length
    0,                  // offset of status
    NULL,               // reserved
    NULL,               // for ole object
    NULL,               // reserved
    DBPART_VALUE,           // specifies Value is bound only
    DBMEMOWNER_CLIENTOWNED,       // memory is client owned
    DBPARAMIO_NOTPARAM,         //
    sizeof(USHORT),           // size in bytes of the value part in the consumers buffer
    0,                  // reserved
    DBTYPE_UI2,             // data type indicator
    0,                  // precision
    0,                  // scale

    //COLUMN_SIZE
    3,
    offsetof(TYPEINFO, ulColumnSize), // offset of value in consumers buffer
    0,                  // offset of length
    0,                  // offset of status
    NULL,               // reserved
    NULL,               // for ole object
    NULL,               // reserved
    DBPART_VALUE,           // specifies Value is bound only
    DBMEMOWNER_CLIENTOWNED,       // memory is client owned
    DBPARAMIO_NOTPARAM,         //
    sizeof(ULONG),            // size in bytes of the value part in the consumers buffer
    0,                  // reserved
    DBTYPE_UI4,             // data type indicator
    0,                  // precision
    0,                  // scale

    //CREATE_PARAMS
    6,
    offsetof(TYPEINFO, wszCreateParams),// offset of value in consumers buffer
    0,                  // offset of length
    0,                  // offset of status
    NULL,               // reserved
    NULL,               // for ole object
    NULL,               // reserved
    DBPART_VALUE,           // specifies Value is bound only
    DBMEMOWNER_CLIENTOWNED,       // memory is client owned
    DBPARAMIO_NOTPARAM,         //
    MAX_NAME_LEN,           // size in bytes of the value part in the consumers buffer
    0,                  // reserved
    DBTYPE_WSTR,            // data type indicator
    0,                  // precision
    0,                  // scale

    //IS_NULLABLE
    7,
    offsetof(TYPEINFO, fIsNullable),  // offset of value in consumers buffer
    0,                  // offset of length
    0,                  // offset of status
    NULL,               // reserved
    NULL,               // for ole object
    NULL,               // reserved
    DBPART_VALUE,           // specifies Value is bound only
    DBMEMOWNER_CLIENTOWNED,       // memory is client owned
    DBPARAMIO_NOTPARAM,         //
    sizeof(VARIANT_BOOL),       // size in bytes of the value part in the consumers buffer
    0,                  // reserved
    DBTYPE_BOOL,            // data type indicator
    0,                  // precision
    0,                  // scale

    //AUTO_UNIQUE_VALUE
    12,
    offsetof(TYPEINFO, fIsAutoInc),   // offset of value in consumers buffer
    0,                  // offset of length
    0,                  // offset of status
    NULL,               // reserved
    NULL,               // for ole object
    NULL,               // reserved
    DBPART_VALUE,           // specifies Value is bound only
    DBMEMOWNER_CLIENTOWNED,       // memory is client owned
    DBPARAMIO_NOTPARAM,         //
    sizeof(VARIANT_BOOL),       // size in bytes of the value part in the consumers buffer
    0,                  // reserved
    DBTYPE_BOOL,            // data type indicator
    0,                  // precision
    0,                  // scale
  };

  //GetRowset
  //DBSCHEMA_PROVIDER_TYPES is required a SCHEMA
  XTESTC(hr = pIDBSchemaRowset->GetRowset(NULL, DBSCHEMA_PROVIDER_TYPES, 0, NULL, IID_IRowset,0, NULL, (IUnknown**)ppIRowset));

  //Create the the Accessor
  XTESTC(hr = (*ppIRowset)->QueryInterface(IID_IAccessor, (void **)ppIAccessor));
  XTESTC(hr = (*ppIAccessor)->CreateAccessor(DBACCESSOR_ROWDATA, cBindings, rgBindings, 0, phAccessor, NULL));

CLEANUP:
  return hr;
}

HRESULT CTable::GetTypeNameAndParams | ( | ULONG | iCol,
 |  | WCHAR * | pwszName |
 | ) |  |  | [virtual]

Definition at line 235 of file table.cpp.

{
  ASSERT(iCol < m_cColumns);
  ASSERT(pwszName);

  WCHAR  wszBuffer[MAX_NAME_LEN];  // Buffer

  // Add CreateParams precision and scale information
  wszBuffer[0] = EOL;
  if(m_rgColDesc[iCol].ulCreateParams & CP_PRECISION && m_rgColDesc[iCol].ulCreateParams & CP_SCALE)
  {
    swprintf(wszBuffer, L"(%lu,%lu)", COLINFO_SIZE(m_rgColDesc[iCol]), m_rgColDesc[iCol].bScale);
  }
  else if(m_rgColDesc[iCol].ulCreateParams & CP_PRECISION || m_rgColDesc[iCol].ulCreateParams & CP_LENGTH || m_rgColDesc[iCol].ulCreateParams & CP_MAXLENGTH)
  {
    swprintf(wszBuffer, L"(%lu)", COLINFO_SIZE(m_rgColDesc[iCol]));
  }

  //Add the ColumnType
  //Check for "()" in the typename, indicating creation params
  //are required at some other position besides the end, ie: "numeric() identity"
  pwszName[0] = EOL;
  if(wcsstr(m_rgColDesc[iCol].wszTypeName, L"()"))
  {
    // Add the ColumnType, upto the '()'
    wcsncat(pwszName, m_rgColDesc[iCol].wszTypeName, wcsstr(m_rgColDesc[iCol].wszTypeName, L"()") - m_rgColDesc[iCol].wszTypeName);

    // Add the precision and scale information
    wcscat(pwszName, wszBuffer);

    // Add the ColumnType, after the '()'
    wcscat(pwszName, wcsstr(m_rgColDesc[iCol].wszTypeName, L"()") + 2);
  }
  else
  {
    // Add the ColumnType
    wcscpy(pwszName, m_rgColDesc[iCol].wszTypeName);

    // If required, add the precision and scale information
    wcscat(pwszName, wszBuffer);
  }

  return S_OK;
}

BOOL CTable::IsConnected ( ) [virtual]

Definition at line 109 of file table.cpp.

{
  ASSERT(m_pCDataSource);
  return m_pCDataSource->IsConnected();
}

HRESULT CTable::MapTableInfo ( CTable * pCSourceTable ) [virtual]

Definition at line 480 of file table.cpp.

{
  ASSERT(pCSourceTable);
  ASSERT(m_pCDataSource);
  HRESULT hr;

  IAccessor* pIAccessor = NULL;
  HACCESSOR  hAccessor = DB_NULL_HACCESSOR;

  IRowset* pIRowset = NULL;

  ULONG cRowsObtained = 0;
  HROW* rghRows = NULL;

  //Match bitmask, indicating what type of match was found
  BOOL fMatchedAll = FALSE;

  TYPEINFO TypeInfo;
  TYPEINFO* rgTypeInfo = NULL;
  ULONG* rgMatch = NULL;

  //ColumnInfo
  m_cColumns  = pCSourceTable->m_cColumns;
  SAFE_FREE(m_rgColDesc);
  SAFE_ALLOC(m_rgColDesc, COLDESC, m_cColumns);
  memcpy(m_rgColDesc, pCSourceTable->m_rgColDesc, m_cColumns * sizeof(COLDESC));

  //IndexInfo
  m_cIndexes  = pCSourceTable->m_cIndexes;
  SAFE_FREE(m_rgIndexInfo);
  SAFE_ALLOC(m_rgIndexInfo, INDEXINFO, m_cIndexes);
  memcpy(m_rgIndexInfo, pCSourceTable->m_rgIndexInfo, m_cIndexes * sizeof(INDEXINFO));

  //Arrays to store best TypeInfo
  SAFE_ALLOC(rgTypeInfo, TYPEINFO, m_cColumns);
  SAFE_ALLOC(rgMatch, ULONG, m_cColumns);
  memset(rgMatch, NO_MATCH, m_cColumns*sizeof(ULONG));

  //Get ProviderTypes rowset IDBSchemaRowset
  QTESTC(hr = GetTypeInfoRowset(&pIAccessor, &hAccessor, &pIRowset));

  //Loop until all types are matched.
  //We may not find a match, which promotes the type to the next higher
  //type, which will require another cycle to match that type...
  while(!fMatchedAll)
  {
    //Get data for each row in rowset
    XTESTC(hr = pIRowset->RestartPosition(NULL));

    //Loops over the entire SchemaRowset
    while(TRUE)
    {
      XTESTC(hr = pIRowset->GetNextRows(NULL, 0, MAX_BLOCK_SIZE, &cRowsObtained, &rghRows));

      //ENDOFROWSET
      if(cRowsObtained == 0)
        break;

      //Loop over the BLOCK of rows obtained
      for(ULONG i=0; i<cRowsObtained; i++)
      {
        ASSERT(m_rgColDesc);

        //Reset all the TypeInfo fields
        memset(&TypeInfo, 0, sizeof(TYPEINFO));

        //Put the data for one type into the TypeInfo Struct
        XTESTC(hr = pIRowset->GetData(rghRows[i], hAccessor, (void *)&TypeInfo));

        //Loop over the columns and get TypeInfo
        for(ULONG iCol=0; iCol<m_cColumns; iCol++)
        {
          //Only try matching if this is the correct type and
          //the column doesn't already have a perfect match
          if(TypeInfo.wType != m_rgColDesc[iCol].wType || (rgMatch[iCol] & MATCH_EXACT))
            continue;

          //An NonAutoInc Column cannot be placed into an AutoInc type
          if(TypeInfo.fIsAutoInc && !m_rgColDesc[iCol].fIsNullable)
            continue;

          //A Nullable type cannot be mapped to a non-Nullable type
          if(m_rgColDesc[iCol].fIsNullable && !TypeInfo.fIsNullable)
            continue;

          //If never matched before, we at least know they match by type
          if(!rgMatch[iCol])
          {
            rgMatch[iCol] |= MATCH_TYPE;
            rgTypeInfo[iCol] = TypeInfo;
          }

          // Exact type/size matches take precedence
          if(COLINFO_SIZE(m_rgColDesc[iCol]) == TypeInfo.ulColumnSize)
          {
            rgMatch[iCol] |= MATCH_EXACT;
            rgTypeInfo[iCol] = TypeInfo;
          }

          // Otherwise try best fit size
          if(COLINFO_SIZE(m_rgColDesc[iCol]) < TypeInfo.ulColumnSize &&
            TypeInfo.ulColumnSize <= rgTypeInfo[iCol].ulColumnSize)
          {
              rgMatch[iCol] |= MATCH_SIZE;
              rgTypeInfo[iCol] = TypeInfo;
          }
        }
      }

      //Release this group of rows
      XTESTC(hr = pIRowset->ReleaseRows(cRowsObtained, rghRows, NULL, NULL, NULL));
      SAFE_FREE(rghRows);
    }

    // See if every type has a match
    fMatchedAll = TRUE;
    for(ULONG i=0; i<m_cColumns; i++)
    {
      ASSERT(m_rgColDesc);

      // If not we will have to promote a type and try again
      if(rgMatch[i])
      {
        //If found a match fill in the TypeInfo fileds of our ColDesc
        wcscpy(m_rgColDesc[i].wszTypeName, rgTypeInfo[i].wszTypeName);
        m_rgColDesc[i].ulCreateParams = GetCreateParams(rgTypeInfo[i].wszCreateParams);
        m_rgColDesc[i].fIsNullable    = rgTypeInfo[i].fIsNullable == VARIANT_TRUE;
        m_rgColDesc[i].fIsAutoInc   = rgTypeInfo[i].fIsAutoInc == VARIANT_TRUE;

        //TODO: why is this here?
        if (m_rgColDesc[i].ulColumnSize > rgTypeInfo[i].ulColumnSize)
          m_rgColDesc[i].ulColumnSize = rgTypeInfo[i].ulColumnSize;
      }
      else
      {
        fMatchedAll = FALSE;

        //Try to promote it to the next largest type
        if(!GetPromotedType(&m_rgColDesc[i].wType))
        {
          //If unable to promote, we are out of luck
          wMessageBox(NULL, MB_TASKMODAL | MB_ICONEXCLAMATION | MB_OK, wsz_ERROR,
            wsz_NO_TYPE_MATCH_, GetDBTypeName(m_rgColDesc[i].wType));
          goto CLEANUP;
        }
      }
    }
  }

CLEANUP:
  if(hAccessor && pIAccessor)
    XTEST(pIAccessor->ReleaseAccessor(hAccessor, NULL));

  SAFE_RELEASE(pIAccessor);
  SAFE_RELEASE(pIRowset);

  SAFE_FREE(rgMatch);
  SAFE_FREE(rgTypeInfo);

  SAFE_FREE(rghRows);
  return hr;
}

Member Data Documentation

ULONG CTable::m_cColumns

Definition at line 168 of file table.h.

ULONG CTable::m_cIndexes

Definition at line 164 of file table.h.

CDataSource* CTable::m_pCDataSource

Definition at line 172 of file table.h.

CWizard* CTable::m_pCWizard

Definition at line 173 of file table.h.

IAccessor* CTable::m_pIAccessor

Definition at line 176 of file table.h.

IRowset* CTable::m_pIRowset

Definition at line 177 of file table.h.

COLDESC* CTable::m_rgColDesc

Definition at line 169 of file table.h.

INDEXINFO* CTable::m_rgIndexInfo

Definition at line 165 of file table.h.

TABLEINFO CTable::m_TableInfo

Definition at line 160 of file table.h.

WCHAR CTable::m_wszIDQuote[MAX_NAME_LEN]

Definition at line 156 of file table.h.

WCHAR CTable::m_wszIDSeperator[MAX_NAME_LEN]

Definition at line 157 of file table.h.

WCHAR CTable::m_wszQualTableName[MAX_NAME_LEN]

Definition at line 161 of file table.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/tablecopy/table.h
  • Dataaccess/oledb/tablecopy/table.cpp
Generated on Wed Nov 13 2024 16:57:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CTableCopy Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CTableCopy Class Reference

#include "tablecopy.h"

List of all members.

Public Member Functions

CTableCopy (CWizard *pCWizard)
virtual | ~CTableCopy ()
virtual HRESULT | CopyTables ()
virtual HRESULT | MapTypes ()

Public Attributes

DWORD m_dwBlobOpt
DWORD m_dwInsertOpt
DWORD m_dwRowOpt
BOOL m_fCopyIndexes
BOOL m_fCopyPrimaryKeys
BOOL m_fCopyTables
BOOL m_fShowQuery
BOOL m_fTranslate
CTable * m_pCFromTable
CTable * m_pCToTable
CWizard * m_pCWizard
ULONG m_ulBlobSize
ULONG m_ulMaxRows
ULONG m_ulParamSets

Detailed Description

Definition at line 56 of file tablecopy.h.

Constructor & Destructor Documentation

CTableCopy::CTableCopy ( CWizard * pCWizard )

Definition at line 33 of file tablecopy.cpp.

{
  ASSERT(pCWizard);

  m_pCFromTable = new CTable(pCWizard);
  m_pCToTable   = new CTable(pCWizard);

  //RowOptions
  m_dwRowOpt    = IDR_ALL_ROWS;
  m_ulMaxRows   = 1;

  //InsertOptions
  m_dwInsertOpt = IDR_PARAM_SETS;
  m_ulParamSets = 10;

  //BLOB options
  m_dwBlobOpt   = IDR_BLOB_SIZE;
  m_ulBlobSize  = 5000;   //Some reasonable value less than MAX_COL_SIZE

  //Create Options
  m_fCopyTables   = TRUE;
  m_fCopyIndexes    = TRUE;
  m_fCopyPrimaryKeys  = TRUE;
  m_fShowQuery    = FALSE;

  //Data
  m_fTranslate  = TRUE;
  m_pCWizard    = pCWizard;  //Back pointer to windowing class
}

CTableCopy::~CTableCopy ( ) [virtual]

Definition at line 68 of file tablecopy.cpp.

{
  delete m_pCFromTable;
  delete m_pCToTable;
}

Member Function Documentation

HRESULT CTableCopy::CopyTables ( ) [virtual]

Definition at line 106 of file tablecopy.cpp.

{
  HRESULT hr = S_OK;
  ULONG cRowsCopied = 0;

  // Create the Table (if desired)
  if(m_fCopyTables)
    QTESTC(hr = m_pCToTable->CreateTable());

  // Create the indexes (if desired)
  if(m_fCopyIndexes)
    QTESTC(hr = m_pCToTable->CopyIndexes(m_pCFromTable));

  //GetColInfo for TargetTable
  QTESTC(hr = m_pCToTable->GetColInfo(m_dwInsertOpt));

  //Now Copy the Data
  QTESTC(hr = m_pCToTable->CopyData(m_pCFromTable, &cRowsCopied));

CLEANUP:
  //Display Results
  if(SUCCEEDED(hr))
    wMessageBox(NULL, MB_TASKMODAL | MB_ICONINFORMATION | MB_OK, wsz_SUCCESS, wsz_COPY_SUCCESS, cRowsCopied);
  else
    wMessageBox(NULL, MB_TASKMODAL | MB_ICONEXCLAMATION | MB_OK, wsz_ERROR, wsz_COPY_FAILURE);

  return hr;
}

HRESULT CTableCopy::MapTypes ( ) [virtual]

Definition at line 81 of file tablecopy.cpp.

{
  HRESULT hr = S_OK;

  //Now get the TypeInfo for all columns
  //IDBSchemaRowsets may not be supported, which we may be able to do without
  //on the source table, we are going to lose IsNullable, IsAutoInc and other options
  hr = m_pCFromTable->GetTypeInfo();

  //Now map all the Types correctly from the Source to the Target
  QTESTC(hr = m_pCToTable->MapTableInfo(m_pCFromTable));

CLEANUP:
  if(FAILED(hr))
    wMessageBox(NULL, MB_TASKMODAL | MB_ICONEXCLAMATION | MB_OK, wsz_ERROR, wsz_TYPEMAPPING_FAILURE);

  return hr;
}

Member Data Documentation

DWORD CTableCopy::m_dwBlobOpt

Definition at line 76 of file tablecopy.h.

DWORD CTableCopy::m_dwInsertOpt

Definition at line 72 of file tablecopy.h.

DWORD CTableCopy::m_dwRowOpt

Definition at line 68 of file tablecopy.h.

BOOL CTableCopy::m_fCopyIndexes

Definition at line 82 of file tablecopy.h.

BOOL CTableCopy::m_fCopyPrimaryKeys

Definition at line 83 of file tablecopy.h.

BOOL CTableCopy::m_fCopyTables

Definition at line 81 of file tablecopy.h.

BOOL CTableCopy::m_fShowQuery

Definition at line 80 of file tablecopy.h.

BOOL CTableCopy::m_fTranslate

Definition at line 89 of file tablecopy.h.

CTable* CTableCopy::m_pCFromTable

Definition at line 86 of file tablecopy.h.

CTable* CTableCopy::m_pCToTable

Definition at line 87 of file tablecopy.h.

CWizard* CTableCopy::m_pCWizard

Definition at line 90 of file tablecopy.h.

ULONG CTableCopy::m_ulBlobSize

Definition at line 77 of file tablecopy.h.

ULONG CTableCopy::m_ulMaxRows

Definition at line 69 of file tablecopy.h.

ULONG CTableCopy::m_ulParamSets

Definition at line 73 of file tablecopy.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/tablecopy/tablecopy.h
  • Dataaccess/oledb/tablecopy/tablecopy.cpp
Generated on Wed Nov 13 2024 16:57:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CTabLite Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CTabLite Class Reference

#include "cdialoglite.h"

Inherits CSplitterLite.

List of all members.

Public Member Functions

CTabLite (HWND hWndParent=NULL, UINT nID=0)
virtual | ~CTabLite ()
virtual void | AdjustRect (RECT *pRect, BOOL fLarger=FALSE)
virtual BOOL | DeleteAllItems ()
virtual BOOL | DeleteItem (INDEX iItem)
virtual INDEX | FindTab (LPARAM lParam)
virtual INDEX | GetCurSel () const
BOOL | GetItem (INDEX iItem, WCHAR *pwszText, ULONG ulMaxLength, LPARAM *plParam=NULL)
virtual INDEX | GetItemCount ()
LPARAM | GetItemData (INDEX iItem)
virtual INDEX | InsertItem (INDEX iItem, LPCWSTR pwszText, LPARAM lParam=PARAM_NONE, INT iImage=IMAGE_NONE, DWORD dwState=STATE_NONE, DWORD dwStateMask=STATE_NONE)
virtual BOOL | OnCreate (CREATESTRUCT *pCREATESTRUCT)
virtual BOOL | OnNotify (INT idCtrl, NMHDR *pNMHDR)
virtual BOOL | OnSelChange (INT iID, HWND hWndCtrl)
virtual BOOL | OnSelChanging (INT iID, HWND hWndCtrl)
virtual INDEX | SetCurSel (INDEX iItem, BOOL fSendNotification=FALSE)
virtual BOOL | SetItem (INDEX iItem, LPCWSTR pwszName, LPARAM lParam=PARAM_NONE, INT iImage=IMAGE_NONE, DWORD dwState=STATE_NONE, DWORD dwStateMask=STATE_NONE)
virtual BOOL | SetItemText (INDEX iItem, LPCWSTR pwszName)

Detailed Description

Definition at line 1001 of file cdialoglite.h.

Constructor & Destructor Documentation

CTabLite::CTabLite | ( | HWND | hWndParent = NULL,
 |  | UINT | nID = 0
 | ) |  |

Definition at line 4154 of file cdialoglite.cpp.

  : CSplitterLite(hWndParent, nID)
{
}

CTabLite::~CTabLite ( ) [virtual]

Definition at line 4164 of file cdialoglite.cpp.

{
}

Member Function Documentation

virtual void CTabLite::AdjustRect | ( | RECT * | pRect,
 |  | BOOL | fLarger = FALSE |
 | ) |  |  | [inline, virtual]

Definition at line 1022 of file cdialoglite.h.

{ SendMessageA(m_hWnd, TCM_ADJUSTRECT, fLarger, (LPARAM)pRect);     }

virtual BOOL CTabLite::DeleteAllItems ( ) [inline, virtual]

Definition at line 1020 of file cdialoglite.h.

{ return (BOOL)::SendMessageA(m_hWnd, TCM_DELETEALLITEMS, 0, 0);    }

virtual BOOL CTabLite::DeleteItem ( INDEX iItem ) [inline, virtual]

Definition at line 1021 of file cdialoglite.h.

{ return (BOOL)::SendMessageA(m_hWnd, TCM_DELETEITEM, iItem, 0);    }

INDEX CTabLite::FindTab ( LPARAM lParam ) [virtual]

Definition at line 4254 of file cdialoglite.cpp.

{
  //Try and find this suite in the list
  INDEX cItems = GetItemCount();
  for(INDEX iItem=0; iItem<cItems; iItem++)
  {
    LPARAM lCurParam = GetItemData(iItem);
    if(lParam == lCurParam)
      return iItem;
  }

  return CB_ERR;
}

virtual INDEX CTabLite::GetCurSel ( ) const [inline, virtual]

Definition at line 1017 of file cdialoglite.h.

{ return (INDEX)::SendMessageA(m_hWnd, TCM_GETCURSEL, 0, 0);      }

BOOL CTabLite::GetItem | ( | INDEX | iItem,
 |  | WCHAR * | pwszText,
 |  | ULONG | ulMaxLength,
 |  | LPARAM * | plParam = NULL
 | ) |  |

Definition at line 4289 of file cdialoglite.cpp.

{
  //Calculate the Mask/flags
  UINT dwMask = 0;
  if(pwszText && ulMaxLength)
    dwMask |= TCIF_TEXT;
//  if(iImage != IMAGE_NONE)
//    dwMask |= TCIF_IMAGE;
//  if(dwState != STATE_NONE)
//    dwMask |= TCIF_STATE;
  if(plParam)
    dwMask |= TCIF_PARAM;

  if(IsUnicodeOS())
  {
    //TCM_GETITEMW
    TCITEMW tcItem = { dwMask, 0, 0, pwszText, ulMaxLength, 0, 0/*lParam*/};
    if(SendMessageW(m_hWnd, TCM_GETITEMW, iItem, (LPARAM)&tcItem))
    {
      if(plParam)
        *plParam = tcItem.lParam;
      return TRUE;
    }
  }
  else
  {
    CHAR szBuffer[MAX_NAME_LEN+1];

    //TCM_GETITEMA
    TCITEMA tcItem = { dwMask, 0, 0, szBuffer, MAX_NAME_LEN, 0, 0/*lParam*/};
    if(SendMessageA(m_hWnd, TCM_GETITEMA, iItem, (LPARAM)&tcItem))
    {
      if(pwszText)
        ConvertToWCHAR(szBuffer, pwszText, ulMaxLength);
      if(plParam)
        *plParam = tcItem.lParam;
      return TRUE;
    }
  }

  //Otherwise
  return FALSE;
}

virtual INDEX CTabLite::GetItemCount ( ) [inline, virtual]

Definition at line 1016 of file cdialoglite.h.

{ return (INDEX)::SendMessageA(m_hWnd, TCM_GETITEMCOUNT, 0, 0);     }

LPARAM CTabLite::GetItemData ( INDEX iItem )

Definition at line 4273 of file cdialoglite.cpp.

{
  LPARAM lParam = CB_ERR;

  //Delegate
  if(GetItem(iItem, NULL, 0, &lParam))
    return lParam;

  return CB_ERR;
}

INDEX CTabLite::InsertItem | ( | INDEX | iItem,
 |  | LPCWSTR | pwszText,
 |  | LPARAM | lParam = PARAM_NONE,
 |  | INT | iImage = IMAGE_NONE,
 |  | DWORD | dwState = STATE_NONE,
 |  | DWORD | dwStateMask = STATE_NONE |
 | ) |  |  | [virtual]

Definition at line 4385 of file cdialoglite.cpp.

{
  //Calculate the Mask/flags
  UINT dwMask = 0;
  if(pwszText)
    dwMask |= TCIF_TEXT;
  if(iImage != IMAGE_NONE)
    dwMask |= TCIF_IMAGE;
  if(dwState != STATE_NONE)
    dwMask |= TCIF_STATE;
  if(lParam != PARAM_NONE)
    dwMask |= TCIF_PARAM;

  if(IsUnicodeOS())
  {
    //TCM_INSERTITEM
    TCITEMW tcItem = { dwMask, dwState, dwStateMask, (WCHAR*)pwszText, 0/*cchTextMax*/, iImage, lParam };
    return (INDEX)SendMessageW(m_hWnd, TCM_INSERTITEMW, iItem, (LPARAM)&tcItem);
  }
  else
  {
    CHAR szBuffer[MAX_QUERY_LEN+1] = {0};
    ConvertToMBCS(pwszText, szBuffer, MAX_QUERY_LEN);

    //TCM_INSERTITEM
    TCITEMA tcItem = { dwMask, dwState, dwStateMask, szBuffer, 0/*cchTextMax*/, iImage, lParam };
    return (INDEX)SendMessageA(m_hWnd, TCM_INSERTITEMA, iItem, (LPARAM)&tcItem);
  }

  return 0;
}

BOOL CTabLite::OnCreate ( CREATESTRUCT * pCREATESTRUCT ) [virtual]

Reimplemented from CWndLite.

Definition at line 4173 of file cdialoglite.cpp.

{
  //SubClass the window
  SubClassWindow(WndProc);

  //Delegate
  return CSplitterLite::OnCreate(pCREATESTRUCT);
}

BOOL CTabLite::OnNotify | ( | INT | idCtrl,
 |  | NMHDR * | pNMHDR |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 4187 of file cdialoglite.cpp.

{
  switch(pNMHDR->code)
  {
    ON_COMMAND(TCN_SELCHANGE,   OnSelChange((INT)pNMHDR->idFrom, pNMHDR->hwndFrom));
    ON_COMMAND(TCN_SELCHANGING,   OnSelChanging((INT)pNMHDR->idFrom, pNMHDR->hwndFrom));
//    ON_COMMAND(TCN_GETOBJECT,   OnGetObject((NMOBJECTNOTIFY*)pNMHDR));
  };

  return FALSE;
}

BOOL CTabLite::OnSelChange | ( | INT | iID,
 |  | HWND | hWndCtrl |
 | ) |  |  | [virtual]

Definition at line 4235 of file cdialoglite.cpp.

{
  return FALSE;
}

BOOL CTabLite::OnSelChanging | ( | INT | iID,
 |  | HWND | hWndCtrl |
 | ) |  |  | [virtual]

Definition at line 4245 of file cdialoglite.cpp.

{
  return FALSE;
}

INDEX CTabLite::SetCurSel | ( | INDEX | iItem,
 |  | BOOL | fSendNotification = FALSE |
 | ) |  |  | [virtual]

Definition at line 4204 of file cdialoglite.cpp.

{
  //NOTE: We have to send this message our selves due to the following MSDN Article
  //"This method selects a tab in a tab control. A tab control does not send a
  //TCN_SELCHANGING or TCN_SELCHANGE notification message when a tab is selected using
  //this method. These notifications are sent, using WM_NOTIFY, when the user clicks or
  //uses the keyboard to change tabs."
  if(fSendNotification)
  {
    NMHDR nmHdr = { m_hWnd, IDP_TABS, TCN_SELCHANGING };
    SendMessage(m_hWnd, WM_NOTIFY, 0, (LPARAM)&nmHdr);
  }

  //Send the message
  INDEX iSel = (INDEX)::SendMessageA(m_hWnd, TCM_SETCURSEL, iItem, 0);

  //Post
  if(fSendNotification)
  {
    NMHDR nmHdr = { m_hWnd, IDP_TABS, TCN_SELCHANGE };
    SendMessage(m_hWnd, WM_NOTIFY, 0, (LPARAM)&nmHdr);
  }

  return iSel;
}

BOOL CTabLite::SetItem | ( | INDEX | iItem,
 |  | LPCWSTR | pwszName,
 |  | LPARAM | lParam = PARAM_NONE,
 |  | INT | iImage = IMAGE_NONE,
 |  | DWORD | dwState = STATE_NONE,
 |  | DWORD | dwStateMask = STATE_NONE |
 | ) |  |  | [virtual]

Definition at line 4350 of file cdialoglite.cpp.

{
  //Calculate the Mask/flags
  UINT dwMask = 0;
  if(pwszText)
    dwMask |= TCIF_TEXT;
  if(iImage != IMAGE_NONE)
    dwMask |= TCIF_IMAGE;
  if(dwState != STATE_NONE)
    dwMask |= TCIF_STATE;
  if(lParam != PARAM_NONE)
    dwMask |= TCIF_PARAM;

  if(IsUnicodeOS())
  {
    //TVM_SETITEM
    TCITEMW tcItem = { dwMask, dwState, dwStateMask, (WCHAR*)pwszText, 0/*cchTextMax*/, iImage, lParam };
    return (BOOL)SendMessageW(m_hWnd, TCM_SETITEMW, iItem, (LPARAM)&tcItem);
  }
  else
  {
    CHAR szBuffer[MAX_NAME_LEN+1];
    ConvertToMBCS(pwszText, szBuffer, MAX_NAME_LEN);

    //TVM_SETITEM
    TCITEMA tcItem = { dwMask, dwState, dwStateMask, szBuffer, 0/*cchTextMax*/, iImage, lParam };
    return (BOOL)SendMessageA(m_hWnd, TCM_SETITEMA, iItem, (LPARAM)&tcItem);
  }
}

BOOL CTabLite::SetItemText | ( | INDEX | iItem,
 |  | LPCWSTR | pwszName |
 | ) |  |  | [virtual]

Definition at line 4339 of file cdialoglite.cpp.

{
  //Delegate
  return SetItem(iItem, pwszText);
}

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialoglite.h
  • Dataaccess/oledb/rowsetviewer/cdialoglite.cpp
Generated on Wed Nov 13 2024 16:57:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CTAPIEventNotification Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CTAPIEventNotification Class Reference

#include "CallNot.h"

List of all members.

Public Member Functions

CTAPIEventNotification ()
CTAPIEventNotification ()
CTAPIEventNotification ()
~CTAPIEventNotification ()
ULONG STDMETHODCALLTYPE | AddRef ()
ULONG STDMETHODCALLTYPE | AddRef ()
ULONG STDMETHODCALLTYPE | AddRef ()
HRESULT STDMETHODCALLTYPE | Event (IN TAPI_EVENT TapiEvent, IN IDispatch *pEvent)
HRESULT STDMETHODCALLTYPE | Event (IN TAPI_EVENT TapiEvent, IN IDispatch *pEvent)
HRESULT STDMETHODCALLTYPE | Event (TAPI_EVENT TapiEvent, IDispatch *pEvent)
HRESULT STDMETHODCALLTYPE | QueryInterface (REFIID iid, void **ppvObject)
HRESULT STDMETHODCALLTYPE | QueryInterface (REFIID iid, void **ppvObject)
HRESULT STDMETHODCALLTYPE | QueryInterface (IN REFIID iid, OUT void **ppvObject)
ULONG STDMETHODCALLTYPE | Release ()
ULONG STDMETHODCALLTYPE | Release ()
ULONG STDMETHODCALLTYPE | Release ()

Private Member Functions

~CTAPIEventNotification ()

Private Attributes

LONG | m_dwRefCount

Detailed Description

Definition at line 30 of file CallNot.h.

Constructor & Destructor Documentation

CTAPIEventNotification::CTAPIEventNotification ( ) [inline]

Definition at line 49 of file CallNot.h.

{ m_dwRefCount = 1;}

CTAPIEventNotification::CTAPIEventNotification ( ) [inline]

Definition at line 49 of file Callnot.h.

    {
        m_dwRefCount = 1;
    }

CTAPIEventNotification::~CTAPIEventNotification ( ) [inline]

Definition at line 59 of file Callnot.h.

    {
    }

CTAPIEventNotification::CTAPIEventNotification ( ) [inline]

Definition at line 106 of file Processing.h.

    {

        //
        // freshly created object has an outstanding reference count
        //

        m_dwRefCount = 1;
    }

CTAPIEventNotification::~CTAPIEventNotification ( ) [inline, private]

Definition at line 125 of file Processing.h.

    {

        //
        // reference count here must be 0, otherwise we have a bug in the app
        //

        _ASSERTE(m_dwRefCount == 0);
    }

Member Function Documentation

ULONG STDMETHODCALLTYPE CTAPIEventNotification::AddRef ( void ) [inline]

Definition at line 75 of file CallNot.h.

  {
    ULONG l = InterlockedIncrement(&m_dwRefCount);
    return l;
  }

ULONG STDMETHODCALLTYPE CTAPIEventNotification::AddRef ( void ) [inline]

Definition at line 82 of file Processing.h.

    {
        ULONG l = InterlockedIncrement(&m_dwRefCount);

        return l;
    }

ULONG STDMETHODCALLTYPE CTAPIEventNotification::AddRef ( void ) [inline]

Definition at line 87 of file Callnot.h.

    {
        ULONG l = InterlockedIncrement(&m_dwRefCount);
        return l;
    }

HRESULT STDMETHODCALLTYPE CTAPIEventNotification::Event | ( | IN TAPI_EVENT | TapiEvent,
 |  | IN IDispatch * | pEvent
 | ) |  |
HRESULT STDMETHODCALLTYPE CTAPIEventNotification::Event | ( | TAPI_EVENT | TapiEvent,
 |  | IDispatch * | pEvent
 | ) |  |

Definition at line 221 of file Callnot.Cpp.

{
    //
    // Addref the event so it doesn't go away.
    //

    pEvent->AddRef();

    //
    // Post a message to our own UI thread.
    //

    PostMessage(
                ghDlg,
                WM_PRIVATETAPIEVENT,
                (WPARAM) TapiEvent,
                (LPARAM) pEvent
               );

    return S_OK;
}

HRESULT STDMETHODCALLTYPE CTAPIEventNotification::Event | ( | IN TAPI_EVENT | TapiEvent,
 |  | IN IDispatch * | pEvent
 | ) |  |

Definition at line 123 of file CallNot.cpp.

{

  //
  //sanity check
  //
  if(NULL == pEvent)
  {
    return S_OK;
  }

    //
    // Addref the event so it doesn't go away.
    //
    pEvent->AddRef();

    //
    // Post a message to our own UI thread.
    //

    PostMessage(
                g_hDlg,
                WM_PRIVATETAPIEVENT,
                (WPARAM) TapiEvent,
                (LPARAM) pEvent
               );

    return S_OK;
}

HRESULT STDMETHODCALLTYPE CTAPIEventNotification::QueryInterface | ( | REFIID | iid,
 |  | void ** | ppvObject |
 | ) |  |  | [inline]

Definition at line 52 of file CallNot.h.

  {
    if (iid == IID_ITTAPIEventNotification)
    {
      AddRef();
      *ppvObject = (void *)this;
      return S_OK;
    }

    if (iid == IID_IUnknown)
    {
      AddRef();
      *ppvObject = (void *)this;
      return S_OK;
    }

    return E_NOINTERFACE;
  }

HRESULT STDMETHODCALLTYPE CTAPIEventNotification::QueryInterface | ( | IN REFIID | iid,
 |  | OUT void ** | ppvObject |
 | ) |  |  | [inline]

Definition at line 57 of file Processing.h.

    {
        if (iid == IID_ITTAPIEventNotification)
        {
            AddRef();
            *ppvObject = (void *)this;
            return S_OK;
        }

        if (iid == IID_IUnknown)
        {
            AddRef();
            *ppvObject = (void *)this;
            return S_OK;
        }

        return E_NOINTERFACE;
    }

HRESULT STDMETHODCALLTYPE CTAPIEventNotification::QueryInterface | ( | REFIID | iid,
 |  | void ** | ppvObject |
 | ) |  |  | [inline]

Definition at line 64 of file Callnot.h.

    {
        if (iid == IID_ITTAPIEventNotification)
        {
            AddRef();
            *ppvObject = (void *)this;
            return S_OK;
        }

        if (iid == IID_IUnknown)
        {
            AddRef();
            *ppvObject = (void *)this;
            return S_OK;
        }

        return E_NOINTERFACE;
    }

ULONG STDMETHODCALLTYPE CTAPIEventNotification::Release ( void ) [inline]

Definition at line 89 of file Processing.h.

    {
        ULONG l = InterlockedDecrement(&m_dwRefCount);

        if ( 0 == l)
        {
            delete this;
        }

        return l;
    }

ULONG STDMETHODCALLTYPE CTAPIEventNotification::Release ( void ) [inline]

Definition at line 81 of file CallNot.h.

  {
    ULONG l = InterlockedDecrement(&m_dwRefCount);

    if ( 0 == l)
    {
      delete this;
    }

    return l;
  }

ULONG STDMETHODCALLTYPE CTAPIEventNotification::Release ( void ) [inline]

Definition at line 93 of file Callnot.h.

    {
        ULONG l = InterlockedDecrement(&m_dwRefCount);

        if ( 0 == l)
        {
            delete this;
        }

        return l;
    }

Member Data Documentation

LONG CTAPIEventNotification::m_dwRefCount [private]

Definition at line 34 of file CallNot.h.

The documentation for this class was generated from the following files:
  • NetDS/Tapi/Tapi3/Cpp/FileTerm/CallNot.h
  • NetDS/Tapi/Tapi3/Cpp/Incoming/Callnot.h
  • NetDS/Tapi/Tapi3/Cpp/tapirecv/Processing.h
  • NetDS/Tapi/Tapi3/Cpp/FileTerm/CallNot.cpp
  • NetDS/Tapi/Tapi3/Cpp/Incoming/Callnot.Cpp
  • NetDS/Tapi/Tapi3/Cpp/tapirecv/Processing.cpp
Generated on Wed Nov 13 2024 16:57:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CTE_ENCODER_STRUCT Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

CTE_ENCODER_STRUCT Struct Reference

List of all members.

Public Attributes

DWORD cbData
DWORD dwChunkSize
BYTE * | pData
EXTENSION_CONTROL_BLOCK * | pECB

Detailed Description

Definition at line 25 of file cte_enc.c.

Member Data Documentation

DWORD CTE_ENCODER_STRUCT::cbData

Definition at line 25 of file cte_enc.c.

DWORD CTE_ENCODER_STRUCT::dwChunkSize

Definition at line 24 of file cte_enc.c.

BYTE* CTE_ENCODER_STRUCT::pData

Definition at line 26 of file cte_enc.c.

EXTENSION_CONTROL_BLOCK* CTE_ENCODER_STRUCT::pECB

Definition at line 23 of file cte_enc.c.

The documentation for this struct was generated from the following file:
  • Web/iis/extensions/Chunk/cte_enc.c
Generated on Wed Nov 13 2024 16:57:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CTerminateCompositionEditSession Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CTerminateCompositionEditSession Class Reference

Inherits CEditSessionBase.

List of all members.

Public Member Functions

CTerminateCompositionEditSession (CMarkTextService *pMark, ITfContext *pContext)
~CTerminateCompositionEditSession ()
STDMETHODIMP DoEditSession (TfEditCookie ec)

Private Attributes

CMarkTextService * _pMark

Detailed Description

Definition at line 31 of file compose.cpp.

Constructor & Destructor Documentation

CTerminateCompositionEditSession::CTerminateCompositionEditSession | ( | CMarkTextService * | pMark,
 |  | ITfContext * | pContext |
 | ) |  |  | [inline]

Definition at line 34 of file compose.cpp.

                                                                                : CEditSessionBase(pContext)
    {
        _pMark = pMark;
        _pMark->AddRef();
    }

CTerminateCompositionEditSession::~CTerminateCompositionEditSession ( ) [inline]

Definition at line 39 of file compose.cpp.

    {
        _pMark->Release();
    }

Member Function Documentation

STDMETHODIMP CTerminateCompositionEditSession::DoEditSession ( TfEditCookie ec ) [inline, virtual]

Implements CEditSessionBase.

Definition at line 45 of file compose.cpp.

    {
        _pMark->_TerminateComposition(ec);
        return S_OK;
    }

Member Data Documentation

CMarkTextService* CTerminateCompositionEditSession::_pMark [private]

Definition at line 52 of file compose.cpp.

The documentation for this class was generated from the following file:
  • WinUI/TSFmark/compose.cpp
Generated on Wed Nov 13 2024 16:57:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CTestApp Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions

CTestApp Class Reference

#include "MqApiTst.h"

Inherits CWinApp.

List of all members.

Public Member Functions

CTestApp ()
virtual BOOL | InitInstance ()
afx_msg void | OnAppAbout ()

Protected Member Functions

BOOL IsDsEnabledLocaly ()

Detailed Description

Definition at line 29 of file MqApiTst.h.

Constructor & Destructor Documentation

CTestApp::CTestApp ( )

Definition at line 48 of file MqApiTst.Cpp.

{
  // TODO: Add construction code here.
  // Place all significant initialization in InitInstance.
}

Member Function Documentation

BOOL CTestApp::InitInstance ( void ) [virtual]

Reimplemented from CWinApp.

Definition at line 62 of file MqApiTst.Cpp.

{
    //
    // This application should only be used when the computer is enabled to
  // access the directory service (DS-enabled). In workgroup (DS-disabled) mode,
  // we should stop execution.
    //
    if (!IsDsEnabledLocaly())
    {
        ::MessageBox(NULL,_T("This application is not designed to run in workgroup (DS-disabled) mode."), NULL,MB_OK);
        exit(0);
    }
    //
  // Standard initialization.
  // If you are not using these features and wish to reduce the size
  // of your final executable, remove the specific initialization routines
  // that you do not need from the following.

#ifdef _AFXDLL
  Enable3dControls();     // Call this function when using MFC in a shared DLL.
#else
  Enable3dControlsStatic(); // Call this function when linking to MFC statically.
#endif

  LoadStdProfileSettings();  // Load standard INI file options (including MRU).

  // Register the application's document templates. Document templates
  // serve as the connection between documents, frame windows, and views.

  CSingleDocTemplate* pDocTemplate;
  pDocTemplate = new CSingleDocTemplate(
    IDR_MAINFRAME,
    RUNTIME_CLASS(CTestDoc),
    RUNTIME_CLASS(CMainFrame),       // main SDI frame window
    RUNTIME_CLASS(CTestView));
  AddDocTemplate(pDocTemplate);

  // Parse command line for standard shell commands, DDE, and open file.
  CCommandLineInfo cmdInfo;
  ParseCommandLine(cmdInfo);

  // Dispatch commands specified on the command line.
  if (!ProcessShellCommand(cmdInfo))
    return FALSE;

  return TRUE;
}

BOOL CTestApp::IsDsEnabledLocaly ( ) [protected]

Definition at line 215 of file MqApiTst.Cpp.

                   :

      The routine checks whether the computer is enabled to access the directory service (DS-enabled).

Arguments:

      None

Return Value:

      TRUE     -  DS-enabled.
      FALSE    -  DS-disabled.

--*/

{

    MQPRIVATEPROPS PrivateProps;
    QMPROPID       aPropId[MAX_VAR];
    MQPROPVARIANT  aPropVar[MAX_VAR];
    DWORD          cProp;
    HRESULT        hr;
    //
    // Specify the PROPID_PC_DS_ENABLED, which indicates whether
  // the computer is DS-enabled.
    //
    cProp = 0;

    aPropId[cProp] = PROPID_PC_DS_ENABLED;
    aPropVar[cProp].vt = VT_NULL;
    ++cProp;
    //
    // Create a PRIVATEPROPS structure.
    //
    PrivateProps.cProp = cProp;
  PrivateProps.aPropID = aPropId;
  PrivateProps.aPropVar = aPropVar;
    PrivateProps.aStatus = NULL;

    //
    // Retrieve the information.
    //

    //
    // This code detects a DS connection.
    // This code is designed to allow the sample to compile on NT 4.0 and on Windows 2000
    // and later. The MQGetPrivateComputerInformation() function can be called directly
    // on Windows 2000 and later.
    //
    HINSTANCE hMqrtLibrary = GetModuleHandle(TEXT("mqrt.dll"));
  if (hMqrtLibrary == NULL)
  {
    AfxMessageBox(_T("An incomplete installation of MSMQ was detected. Exiting..."));
    exit(1);
  }

    typedef HRESULT (APIENTRY *MQGetPrivateComputerInformation_ROUTINE)(LPCWSTR , MQPRIVATEPROPS*);
    MQGetPrivateComputerInformation_ROUTINE pfMQGetPrivateComputerInformation =
          (MQGetPrivateComputerInformation_ROUTINE)GetProcAddress(hMqrtLibrary,
                           "MQGetPrivateComputerInformation");
    if(pfMQGetPrivateComputerInformation == NULL)
    {
        //
        // There is no entry point in the DLL matching this routine.
        // It must be an old version of mqrt.dll (MSMQ 1.0).
        // It will be OK to handle this case as a case of DS-enabled mode.
        //
        return TRUE;
    }

  hr = pfMQGetPrivateComputerInformation(
             NULL,
           &PrivateProps);
  if(FAILED(hr))
  {
        //
        // We were not able to determine whether the computer is enabled to access the DS.
        // Notify the user and assume the worst case, i.e., that the computer is DS-disasbled.
        //
        AfxMessageBox(_T("No DS connection could be detected."));
        return FALSE;
    }

    if(PrivateProps.aPropVar[0].boolVal == 0)
    {
        //
        // DS-disabled.
        //
        return FALSE;
    }

    return TRUE;

}

void CTestApp::OnAppAbout ( )

Definition at line 157 of file MqApiTst.Cpp.

{
  CAboutDlg aboutDlg;
  aboutDlg.DoModal();
}

The documentation for this class was generated from the following files:
  • NetDS/MessageQueuing/MqApiTst/MqApiTst.h
  • NetDS/MessageQueuing/MqApiTst/MqApiTst.Cpp
Generated on Wed Nov 13 2024 16:57:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CTestCOMPerformance Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CTestCOMPerformance Class Reference

List of all members.

Public Member Functions

CTestCOMPerformance ()
STDMETHODIMP | GetIDsOfNames (REFIID riid, WCHAR **rgszNames, unsigned int cNames, LCID lcid, DISPID *pdispid)
STDMETHODIMP | GetTypeInfo (unsigned int iti, LCID lcid, LPTYPEINFO *ppti)
STDMETHODIMP | GetTypeInfoCount (unsigned int *pcti)
STDMETHODIMP | Invoke (DISPID dispidMember, REFIID riid, LCID lcid, unsigned short wFlags, DISPPARAMS *pdispparams, VARIANT *pvarResult, EXCEPINFO *pexcepinfo, unsigned int *puArgErr)
STDMETHODIMP | QueryInterface (REFIID iid, void **ppv)
STDMETHODIMP_ (ULONG) AddRef(void)
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP | Test1 (int l)
STDMETHODIMP | Test23 (BSTR szDesc)

Private Attributes

ULONG m_cRef

Detailed Description

Definition at line 151 of file ComPerf.Cpp.

Constructor & Destructor Documentation

CTestCOMPerformance::CTestCOMPerformance ( ) [inline]

Definition at line 170 of file ComPerf.Cpp.

{ m_cRef = 1;}

Member Function Documentation

STDMETHODIMP CTestCOMPerformance::GetIDsOfNames | ( | REFIID | riid,
 |  | WCHAR ** | rgszNames,
 |  | unsigned int | cNames,
 |  | LCID | lcid,
 |  | DISPID * | pdispid
 | ) |  |

Definition at line 1140 of file ComPerf.Cpp.

{
    return E_NOTIMPL;
}  // CTestCOMPerformance::GetIDsOfNames

STDMETHODIMP CTestCOMPerformance::GetTypeInfo | ( | unsigned int | iti,
 |  | LCID | lcid,
 |  | LPTYPEINFO * | ppti
 | ) |  |

Definition at line 1126 of file ComPerf.Cpp.

{
  HRESULT hr;

    if (ppti == NULL)
    return E_POINTER;
  hr = CreateDispTypeInfo( &interfacedata, 0, ppti);
    return hr;
}  // CTestCOMPerformance::GetTypeInfo

STDMETHODIMP CTestCOMPerformance::GetTypeInfoCount ( unsigned int * pcti )
STDMETHODIMP CTestCOMPerformance::Invoke | ( | DISPID | dispidMember,
 |  | REFIID | riid,
 |  | LCID | lcid,
 |  | unsigned short | wFlags,
 |  | DISPPARAMS * | pdispparams,
 |  | VARIANT * | pvarResult,
 |  | EXCEPINFO * | pexcepinfo,
 |  | unsigned int * | puArgErr
 | ) |  |

Definition at line 1149 of file ComPerf.Cpp.

{
    LPTYPEINFO pti = NULL;
  HRESULT hr = GetTypeInfo(0, lcid, &pti);
  if(FAILED(hr))
    return hr;

  hr =  pti->Invoke((ICOMPerformance*)this, dispidMember,
      wFlags, pdispparams, pvarResult,
      pexcepinfo, puArgErr);
  hr = pti->Release();
  return hr;
}  // CTestCOMPerformance::Invoke

STDMETHODIMP CTestCOMPerformance::QueryInterface | ( | REFIID | iid,
 |  | void ** | ppv
 | ) |  |

Definition at line 1075 of file ComPerf.Cpp.

{
    *ppv = NULL;

    if (iid == IID_IUnknown || iid == IID_ICOMPerformance)
    {
  *ppv = (ICOMPerformance *)this;
    }
  else if (iid == IID_IDispatch)
    *ppv = (IDispatch *)this;
    if (*ppv == NULL)
    {
    return E_NOINTERFACE;
    }
  AddRef();
    return S_OK;
}  // CTestCOMPerformance::QueryInterface

CTestCOMPerformance::STDMETHODIMP_ ( ULONG ) [inline]

Definition at line 156 of file ComPerf.Cpp.

{ return m_cRef++; }

CTestCOMPerformance::STDMETHODIMP_ ( ULONG )
STDMETHODIMP CTestCOMPerformance::Test1 ( int l )

Definition at line 1166 of file ComPerf.Cpp.

{
   return S_OK;
}

STDMETHODIMP CTestCOMPerformance::Test23 ( BSTR szDesc )

Definition at line 1172 of file ComPerf.Cpp.

{
   return S_OK;
}

Member Data Documentation

ULONG CTestCOMPerformance::m_cRef [private]

Definition at line 172 of file ComPerf.Cpp.

The documentation for this class was generated from the following file:
  • Com/Fundamentals/DCom/ComPerf/ComPerf.Cpp
Generated on Wed Nov 13 2024 16:57:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CTestDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Private Attributes

CTestDlg Class Reference

#include "TestDlg.h"

List of all members.

Public Types

enum | { IDD = IDD_TESTDLG }

Public Member Functions

CTestDlg ()
~CTestDlg ()
LRESULT | OnCancel (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
LRESULT | OnInitDialog (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
LRESULT | OnTimer (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)

Private Attributes

DWORD dwPID
int | m_nNumberWrites
ILogFile * | m_pLF

Detailed Description

Definition at line 35 of file TestDlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 42 of file TestDlg.h.

{ IDD = IDD_TESTDLG };

Constructor & Destructor Documentation

CTestDlg::CTestDlg ( )

Definition at line 39 of file TestDlg.Cpp.

                   : m_nNumberWrites(0)
{
  // make our object
  HRESULT        hr;
  IClassFactory *pCF;

  hr=CoGetClassObject(CLSID_LogFile, CLSCTX_LOCAL_SERVER, NULL, IID_IClassFactory, (void **)&pCF);
  _ASSERTE(SUCCEEDED(hr));

  hr=pCF->CreateInstance(NULL, IID_ILogFile, (void **) &m_pLF);
  _ASSERTE(SUCCEEDED(hr));

  pCF->Release();

  //CoCreateInstance(CLSID_LogFile, NULL, CLSCTX_INPROC_SERVER, IID_ILogFile, (void **) &m_pLF);
}

CTestDlg::~CTestDlg ( )

Definition at line 63 of file TestDlg.Cpp.

{
  m_pLF->Release();
}

Member Function Documentation

LRESULT CTestDlg::OnCancel | ( | WORD | wNotifyCode,
 |  | WORD | wID,
 |  | HWND | hWndCtl,
 |  | BOOL & | bHandled |
 | ) |  |  | [inline]

Definition at line 56 of file TestDlg.h.

  {
    EndDialog(wID);
    return 0;
  }

LRESULT CTestDlg::OnInitDialog | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 75 of file TestDlg.Cpp.

{
  // get our process id
  dwPID = GetCurrentProcessId();

  // set our timer to do the log writes
  SetTimer(NULL, 1000);

  return 1;  // Let the system set the focus
}

LRESULT CTestDlg::OnTimer | ( | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | BOOL & | bHandled
 | ) |  |

Definition at line 94 of file TestDlg.Cpp.

{
  _bstr_t msg = "Test String";
  WCHAR buf[50];

  wsprintfW(buf, L"Message number %d\r\n", ++m_nNumberWrites);
  // move our buf into a BSTR
  msg = buf;
  m_pLF->Write(msg, dwPID);
  SetDlgItemInt(IDC_NUMBERWRITES, m_nNumberWrites);
  return 0;
}

Member Data Documentation

DWORD CTestDlg::dwPID [private]

Definition at line 66 of file TestDlg.h.

int CTestDlg::m_nNumberWrites [private]

Definition at line 64 of file TestDlg.h.

ILogFile* CTestDlg::m_pLF [private]

Definition at line 65 of file TestDlg.h.

The documentation for this class was generated from the following files:
  • Com/Services/Object_Pooling/PoolTest/TestDlg.h
  • Com/Services/Object_Pooling/PoolTest/TestDlg.Cpp
Generated on Wed Nov 13 2024 16:57:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CTestDoc Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions

CTestDoc Class Reference

#include "TestDoc.h"

List of all members.

Public Member Functions

virtual | ~CTestDoc ()
virtual BOOL | OnNewDocument ()
virtual void | Serialize (CArchive &ar)

Protected Member Functions

CTestDoc ()

Detailed Description

Definition at line 17 of file TestDoc.h.

Constructor & Destructor Documentation

CTestDoc::CTestDoc ( ) [protected]

Definition at line 43 of file TestDoc.Cpp.

{
  // TODO: add one-time construction code here

}

CTestDoc::~CTestDoc ( ) [virtual]

Definition at line 49 of file TestDoc.Cpp.

{
}

Member Function Documentation

BOOL CTestDoc::OnNewDocument ( ) [virtual]

Definition at line 53 of file TestDoc.Cpp.

{
  if (!CDocument::OnNewDocument())
    return FALSE;

  ((CEditView*)m_viewList.GetHead())->SetWindowText(NULL);

  // TODO: add reinitialization code here
  // (SDI documents will reuse this document)

  return TRUE;
}

void CTestDoc::Serialize ( CArchive & ar ) [virtual]

Definition at line 69 of file TestDoc.Cpp.

{
  // CEditView contains an edit control which handles all serialization
  ((CEditView*)m_viewList.GetHead())->SerializeRaw(ar);
}

The documentation for this class was generated from the following files:
  • NetDS/MessageQueuing/MqApiTst/TestDoc.h
  • NetDS/MessageQueuing/MqApiTst/TestDoc.Cpp
Generated on Wed Nov 13 2024 16:57:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CTestView Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions

CTestView Class Reference

#include "TestVIEW.h"

List of all members.

Public Member Functions

virtual | ~CTestView ()
CTestDoc * GetDocument ()
virtual void | OnDraw (CDC *pDC)
virtual BOOL | PreCreateWindow (CREATESTRUCT &cs)

Protected Member Functions

CTestView ()
afx_msg int | OnCreate (LPCREATESTRUCT lpCreateStruct)

Detailed Description

Definition at line 16 of file TestVIEW.h.

Constructor & Destructor Documentation

CTestView::CTestView ( ) [protected]

Definition at line 44 of file TestVIEW.Cpp.

{
  // TODO: add construction code here

}

CTestView::~CTestView ( ) [virtual]

Definition at line 50 of file TestVIEW.Cpp.

{
}

Member Function Documentation

CTestDoc * CTestView::GetDocument ( ) [inline]

Definition at line 57 of file TestVIEW.h.

   { return (CTestDoc*)m_pDocument; }

int CTestView::OnCreate ( LPCREATESTRUCT lpCreateStruct ) [protected]

Definition at line 104 of file TestVIEW.Cpp.

{
  if (CEditView::OnCreate(lpCreateStruct) == -1)
    return -1;

  // TODO: Add your specialized creation code here

  pMainView = this;
  return 0;
}

void CTestView::OnDraw ( CDC * pDC ) [virtual]

Definition at line 68 of file TestVIEW.Cpp.

{
  CTestDoc* pDoc = GetDocument();
  ASSERT_VALID(pDoc);

  // TODO: add draw code for native data here
}

BOOL CTestView::PreCreateWindow ( CREATESTRUCT & cs ) [virtual]

Definition at line 54 of file TestVIEW.Cpp.

{
  // TODO: Modify the Window class or styles here by modifying
  //  the CREATESTRUCT cs

  BOOL bPreCreated = CEditView::PreCreateWindow(cs);
  cs.style &= ~(ES_AUTOHSCROLL|WS_HSCROLL); // Enable word-wrapping

  return bPreCreated;
}

The documentation for this class was generated from the following files:
  • NetDS/MessageQueuing/MqApiTst/TestVIEW.h
  • NetDS/MessageQueuing/MqApiTst/TestVIEW.Cpp
Generated on Wed Nov 13 2024 16:57:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CTextElement Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CTextElement Class Reference

#include "TextElem.Hxx"

Inherits CHtmlElement.

List of all members.

Public Member Functions

CTextElement (CHtmlIFilter &htmlIFilter, CSerialStream &serialStream)
virtual SCODE | GetChunk (STAT_CHUNK *pStat)
virtual SCODE | GetText (ULONG *pcwcBuffer, WCHAR *awcBuffer)
virtual void | InitFilterRegion (ULONG &idChunkSource, ULONG &cwcStartSource, ULONG &cwcLenSource)
virtual void | InitStatChunk (STAT_CHUNK *pStat)

Private Attributes

ULONG _cTextChars
HtmlTokenType _eTokTypeNext
BOOL _fNoMoreText
ULONG _idChunk

Detailed Description

Definition at line 25 of file TextElem.Hxx.

Constructor & Destructor Documentation

CTextElement::CTextElement | ( | CHtmlIFilter & | htmlIFilter,
 |  | CSerialStream & | serialStream
 | ) |  |

Definition at line 31 of file TextElem.Cxx.

    : CHtmlElement(htmlIFilter, serialStream),
      _fNoMoreText(TRUE),
      _eTokTypeNext(GenericToken),
      _idChunk(0),
      _cTextChars(0)
{
}

Member Function Documentation

SCODE CTextElement::GetChunk ( STAT_CHUNK * pStat ) [virtual]

Implements CHtmlElement.

Definition at line 53 of file TextElem.Cxx.

{
    if ( _serialStream.Eof() )
        return FILTER_E_END_OF_CHUNKS;

    if ( _fNoMoreText )
    {
        //
        // This is the GetChunk call after we've returned FILTER_E_NO_MORE_TEXT
        // for the previous chunk
        //
        CHtmlElement *pHtmlElemNext = _htmlIFilter.QueryHtmlElement( _eTokTypeNext );
        Win4Assert( pHtmlElemNext );
        pHtmlElemNext->InitStatChunk( pStat );
        _htmlIFilter.ChangeState( pHtmlElemNext );
    }
    else
    {
        //
        // GetChunk was called even though we had not returned
        // FILTER_E_NO_MORE_TEXT.
        //
        SCODE sc = SkipRemainingTextAndGotoNextChunk( pStat );

        return sc;
    }

    return S_OK;
}

SCODE CTextElement::GetText | ( | ULONG * | pcwcBuffer,
 |  | WCHAR * | awcBuffer |
 | ) |  |  | [virtual]

Implements CHtmlElement.

Definition at line 96 of file TextElem.Cxx.

{
    if ( _fNoMoreText || _serialStream.Eof() )
    {
        *pcwcOutput = 0;
        return FILTER_E_NO_MORE_TEXT;
    }

    ULONG cCharsRead = 0;  // count of chars read from input
    while ( cCharsRead < *pcwcOutput )
    {
        CToken token;
        ULONG cCharsScanned;
        ULONG cCharsNeeded = *pcwcOutput - cCharsRead;

        _scanner.GetBlockOfChars( cCharsNeeded,
                                  awcBuffer + cCharsRead,
                                  cCharsScanned,
                                  token );

        cCharsRead += cCharsScanned;
        if ( cCharsScanned == cCharsNeeded )
        {
            //
            // We've read the #chars requested by the user
            //
            break;
        }

        HtmlTokenType eTokType = token.GetTokenType();
        if ( eTokType == EofToken || _htmlIFilter.IsStopToken( token ) )
        {
            //
            // End of file, or we've hit an interesting token
            //
            _fNoMoreText = TRUE;
            _eTokTypeNext = eTokType;         // Need the token type to set up the next chunk

            break;
        }
        else if ( eTokType == BreakToken )
        {
            //
            // Insert a newline char
            //
            Win4Assert( cCharsRead < *pcwcOutput );
            awcBuffer[cCharsRead++] = L'\n';
            _scanner.EatTag();
        }
        else
        {
            //
            // Skip over uninteresting tag and continue processing
            //
            _scanner.EatTag();
        }
    }

    *pcwcOutput = cCharsRead;

    _cTextChars += cCharsRead;

    if ( _fNoMoreText )
        return FILTER_S_LAST_TEXT;
    else
        return S_OK;
}

void CTextElement::InitFilterRegion | ( | ULONG & | idChunkSource,
 |  | ULONG & | cwcStartSource,
 |  | ULONG & | cwcLenSource |
 | ) |  |  | [virtual]

Reimplemented from CHtmlElement.

Definition at line 214 of file TextElem.Cxx.

{
    idChunkSource = _idChunk;
    cwcStartSource = 0;
    cwcLenSource = _cTextChars;
}

void CTextElement::InitStatChunk ( STAT_CHUNK * pStat ) [virtual]

Implements CHtmlElement.

Definition at line 178 of file TextElem.Cxx.

{
    //
    // There is more text to be returned
    //
    _fNoMoreText = FALSE;

    pStat->idChunk = _htmlIFilter.GetNextChunkId();
    pStat->flags = CHUNK_TEXT;
    pStat->locale = _htmlIFilter.GetLocale();
    pStat->attribute.guidPropSet = CLSID_Storage;
    pStat->attribute.psProperty.ulKind = PRSPEC_PROPID;
    pStat->attribute.psProperty.propid = PID_STG_CONTENTS;
    pStat->breakType = CHUNK_EOS;
    pStat->idChunkSource = pStat->idChunk;
    pStat->cwcStartSource = 0;
    pStat->cwcLenSource = 0;

    _idChunk = pStat->idChunk;
    _cTextChars = 0;
}

Member Data Documentation

ULONG CTextElement::_cTextChars [private]

Definition at line 43 of file TextElem.Hxx.

HtmlTokenType CTextElement::_eTokTypeNext [private]

Definition at line 41 of file TextElem.Hxx.

BOOL CTextElement::_fNoMoreText [private]

Definition at line 40 of file TextElem.Hxx.

ULONG CTextElement::_idChunk [private]

Definition at line 42 of file TextElem.Hxx.

The documentation for this class was generated from the following files:
  • WinBase/Indexing/IFilter/TextElem.Hxx
  • WinBase/Indexing/IFilter/TextElem.Cxx
Generated on Wed Nov 13 2024 16:57:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CTextField Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CTextField Class Reference

#include "Box.Hxx"

List of all members.

Public Member Functions

CTextField (TCHAR *sz)
void | GetExtent (CCanvas &canvas, SIZE *psize)
UINT | Hittest (CCanvas &canvas, POINT pt)
void | Paint (CCanvas &canvas, int x, int y)
void | SetFont (HFONT hfont)

Protected Attributes

HFONT | _font
TCHAR * | _sz

Detailed Description

Definition at line 8 of file Box.Hxx.

Constructor & Destructor Documentation

CTextField::CTextField ( TCHAR * sz )

Definition at line 6 of file Box.Cxx.

{
    _sz = sz;
}

Member Function Documentation

void CTextField::GetExtent | ( | CCanvas & | canvas,
 |  | SIZE * | psize
 | ) |  |

Definition at line 18 of file Box.Cxx.

{
    CFontSelect fs(canvas, _font);
    GetTextExtentPoint(canvas, _sz, lstrlen(_sz), pSize);
}

UINT CTextField::Hittest | ( | CCanvas & | canvas,
 |  | POINT | pt
 | ) |  |
void CTextField::Paint | ( | CCanvas & | canvas,
 |  | int | x,
 |  | int | y
 | ) |  |

Definition at line 11 of file Box.Cxx.

{
    SetTextAlign(canvas, TA_LEFT | TA_BASELINE );
    CFontSelect fs(canvas, _font);
    canvas.Text(x, y, _sz, lstrlen(_sz) );
}

void CTextField::SetFont ( HFONT hfont )

Definition at line 24 of file Box.Cxx.

{
    _font = hfont;
}

Member Data Documentation

HFONT CTextField::_font [protected]

Definition at line 17 of file Box.Hxx.

TCHAR* CTextField::_sz [protected]

Definition at line 18 of file Box.Hxx.

The documentation for this class was generated from the following files:
  • Multimedia/Gdi/Fonts/GridFont/Box.Hxx
  • Multimedia/Gdi/Fonts/GridFont/Box.Cxx
Generated on Wed Nov 13 2024 16:57:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CTextGrid Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CTextGrid Class Reference

#include "Grid.Hxx"

Inherits CGrid.

Inherited by CCharGrid, and CCodeGrid.

List of all members.

Public Member Functions

CTextGrid ()
~CTextGrid ()
virtual void | DrawElement (CCanvas &canvas, COORD x, COORD y, UINT i, UINT j)=0
UINT | Hittest (POINT pt, POINT ptTest)
virtual void | Paint (CCanvas &canvas, RECT rc, POINT pt)
void | SetCharTable ()
void | SetFont (HFONT hfont)
void | SetTextOrg ()
void | SetTextOrg (COORD x, COORD y)

Protected Attributes

HFONT | _font
UINT _iEltOffset
USHORT * _pCharUsed
POINT | _ptOrg

Detailed Description

Definition at line 79 of file Grid.Hxx.

Constructor & Destructor Documentation

CTextGrid::CTextGrid ( ) [inline]

Definition at line 82 of file Grid.Hxx.

{ _pCharUsed = NULL;};

CTextGrid::~CTextGrid ( ) [inline]

Definition at line 83 of file Grid.Hxx.

{ if (_pCharUsed != NULL) _pCharUsed = (USHORT*)LocalFree(LocalHandle(_pCharUsed));};

Member Function Documentation

virtual void CTextGrid::DrawElement | ( | CCanvas & | canvas,
 |  | COORD | x,
 |  | COORD | y,
 |  | UINT | i,
 |  | UINT | j |
 | ) |  |  | [pure virtual]

Implemented in CCharGrid, and CCodeGrid.

UINT CTextGrid::Hittest | ( | POINT | pt,
 |  | POINT | ptTest
 | ) |  |

Definition at line 125 of file Grid.Cxx.

{
    for( CGridIt It( _cCol, _cRow, _size, pt ); !It.Done(); ++It)
    {
        if( It.Cx() <= ptTest.x && It.Cy() <= ptTest.y  &&
            It.Cx()+_size.cx > ptTest.x && It.Cy() +_size.cy > ptTest.y)
            {
                return   _cRow* It.Col()+ It.Row() + _iEltOffset;
            }
    }
    return 0xFFFF;
}

void CTextGrid::Paint | ( | CCanvas & | canvas,
 |  | RECT | rc,
 |  | POINT | pt |
 | ) |  |  | [virtual]

Implements CGrid.

Definition at line 107 of file Grid.Cxx.

{
    // Choose text alignment
    SetTextAlign(HDC(canvas), TA_BASELINE|TA_CENTER);

    CFontSelect fs(canvas, _font);

    for( CGridIt It( _cCol, _cRow, _size, pt ); !It.Done(); ++It)
    {
        if( It.Cx()+_size.cx > rc.left && It.Cx() < rc.right &&
                It.Cy()+_size.cy > rc.top && It.Cy() < rc.bottom )
        {
            DrawElement(canvas, It.Cx()+_ptOrg.x, It.Cy()+_ptOrg.y,
                                It.Col(), It.Row());
        }
    }
}

void CTextGrid::SetCharTable ( )

Definition at line 138 of file Grid.Cxx.

{
     USHORT i;
   UINT imin = _iEltOffset;
   UINT imax = imin + _cCol*_cRow - 1;

   // Make sure the block is used by the font
   if (_pCharUsed != NULL)
       LocalFree (LocalHandle(_pCharUsed));
   // Allocate buffer and make it not used (LPTR put zero in memory)
   if ((_pCharUsed = (USHORT *)LocalAlloc(LPTR, _cCol*_cRow*sizeof(USHORT))) == NULL)
       return;
   if (imin > vEndCount[vSegCount-1] || imax < vStartCount[0])
       return;
   for (i = 0; i < vSegCount; i++)
       {
       if (imax < vStartCount[i])  // no more useful cmap ranges
           break;
       if (imin <= vEndCount[i] && imax >= vStartCount[i]) // check for include
         {
           UINT icur = imin;
           while (icur++ < vStartCount[i]);  // scan until reaching vStartCount
       icur--;
       while (icur <= imax && icur <= vEndCount[i])
         _pCharUsed[icur++ - imin] = TRUE;
       }
      }
}

void CTextGrid::SetFont ( HFONT hfont )

Definition at line 102 of file Grid.Cxx.

{
    _font = hfont;
}

void CTextGrid::SetTextOrg | ( | COORD | x,
 |  | COORD | y |
 | ) |  |  | [inline]

Definition at line 91 of file Grid.Hxx.

        {
            _ptOrg.x=x;
            _ptOrg.y=y;
        };

void CTextGrid::SetTextOrg ( ) [inline]

Definition at line 85 of file Grid.Hxx.

        {
            _ptOrg.x = _size.cx/2;
            _ptOrg.y=7*_size.cy/11;
        };

Member Data Documentation

HFONT CTextGrid::_font [protected]

Definition at line 103 of file Grid.Hxx.

UINT CTextGrid::_iEltOffset [protected]

Definition at line 104 of file Grid.Hxx.

USHORT* CTextGrid::_pCharUsed [protected]

Definition at line 105 of file Grid.Hxx.

POINT CTextGrid::_ptOrg [protected]

Definition at line 102 of file Grid.Hxx.

The documentation for this class was generated from the following files:
  • Multimedia/Gdi/Fonts/GridFont/Grid.Hxx
  • Multimedia/Gdi/Fonts/GridFont/Grid.Cxx
Generated on Wed Nov 13 2024 16:57:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CThreadData Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CThreadData Class Reference

#include "bankdlg.h"

Inherits CLinkable.

List of all members.

Public Member Functions

CThreadData ()
CThreadData (THREADDATA *pData)
THREADDATA * GetThreadData ()

Private Attributes

THREADDATA m_td

Detailed Description

Definition at line 69 of file bankdlg.h.

Constructor & Destructor Documentation

CThreadData::CThreadData ( ) [inline]

Definition at line 75 of file bankdlg.h.

    {
      ZeroMemory(&m_td, sizeof(m_td));
    }

CThreadData::CThreadData ( THREADDATA * pData ) [inline]

Definition at line 79 of file bankdlg.h.

    {
      memcpy(&m_td, pData, sizeof(m_td));
    }

Member Function Documentation

THREADDATA* CThreadData::GetThreadData ( ) [inline]

Definition at line 85 of file bankdlg.h.

{return &m_td;}

Member Data Documentation

THREADDATA CThreadData::m_td [private]

Definition at line 72 of file bankdlg.h.

The documentation for this class was generated from the following file:
  • Com/Services/Object_Pooling/OPBankSample/OPBank/bankdlg.h
Generated on Wed Nov 13 2024 16:57:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CThreadSub Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CThreadSub Class Reference

#include "threadsub.h"

Inherits CSysLCESub.

List of all members.

Public Member Functions

CThreadSub (CComSpy *pSpy)
CThreadSub ()
STDMETHODIMP | GetEventClass (LPGUID guid)
STDMETHODIMP | GetEventType (EventEnum *e)
STDMETHODIMP | GetInterface (IID *iid)
STDMETHODIMP | OnThreadAssignApartment (COMSVCSEVENTINFO *pInfo, REFGUID guidActivity, ULONG64 AptId)
STDMETHODIMP | OnThreadBindToApartment (COMSVCSEVENTINFO *pInfo, ULONG64 ThreadID, ULONG64 AptID, DWORD dwActCnt, DWORD dwLowCnt)
STDMETHODIMP | OnThreadStart (COMSVCSEVENTINFO *pInfo, ULONG64 ThreadID, DWORD dwThread, DWORD dwThreadCnt)
STDMETHODIMP | OnThreadTerminate (COMSVCSEVENTINFO *pInfo, ULONG64 ThreadID, DWORD dwThread, DWORD dwThreadCnt)
STDMETHODIMP | OnThreadUnassignApartment (COMSVCSEVENTINFO *pInfo, ULONG64 AptId)
STDMETHODIMP | OnThreadUnBind (COMSVCSEVENTINFO *pInfo, ULONG64 ThreadID, ULONG64 AptID, DWORD dwActCnt)
STDMETHODIMP | OnThreadWorkEnque (COMSVCSEVENTINFO *pInfo, ULONG64 ThreadID, ULONG64 MsgWorkID, DWORD dwQueueLen)
STDMETHODIMP | OnThreadWorkPrivate (COMSVCSEVENTINFO *pInfo, ULONG64 ThreadID, ULONG64 MsgWorkID)
STDMETHODIMP | OnThreadWorkPublic (COMSVCSEVENTINFO *pInfo, ULONG64 ThreadID, ULONG64 MsgWorkID, DWORD dwQueueLen)
STDMETHODIMP | OnThreadWorkRedirect (COMSVCSEVENTINFO *pInfo, ULONG64 ThreadID, ULONG64 MsgWorkID, DWORD dwQueueLen, ULONG64 ThreadNum)
STDMETHODIMP | OnThreadWorkReject (COMSVCSEVENTINFO *pInfo, ULONG64 ThreadID, ULONG64 MsgWorkID, DWORD dwQueueLen)

Detailed Description

Definition at line 30 of file threadsub.h.

Constructor & Destructor Documentation

CThreadSub::CThreadSub ( CComSpy * pSpy ) [inline]

Definition at line 36 of file threadsub.h.

  {
    m_pSpy = pSpy;
  }

CThreadSub::CThreadSub ( ) [inline]

Definition at line 40 of file threadsub.h.

  {
    m_pSpy = NULL;
  }

Member Function Documentation

STDMETHODIMP CThreadSub::GetEventClass ( LPGUID guid ) [inline, virtual]

Implements CSysLCESub.

Definition at line 55 of file threadsub.h.

{*guid = CLSID_ComServiceEvents;return S_OK;}

STDMETHODIMP CThreadSub::GetEventType ( EventEnum * e ) [inline, virtual]

Implements CSysLCESub.

Definition at line 54 of file threadsub.h.

{*e = Thread;return S_OK;}

STDMETHODIMP CThreadSub::GetInterface ( IID * iid ) [inline, virtual]

Implements CSysLCESub.

Definition at line 56 of file threadsub.h.

{*iid = IID_IComThreadEvents;return S_OK;}

STDMETHODIMP CThreadSub::OnThreadAssignApartment | ( | COMSVCSEVENTINFO * | pInfo,
 |  | REFGUID | guidActivity,
 |  | ULONG64 | AptId |
 | ) |  |  | [inline]

Definition at line 249 of file threadsub.h.

  {
    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnThreadAssignApartment"), GuidToBstr(pInfo->guidApp));

    CComBSTR sGuidActivity = GuidToBstr(guidActivity);
    m_pSpy -> AddParamValueToList(L"guidActivity", sGuidActivity);

    WCHAR szAptID[32];
    wsprintfW(szAptID,L"0x%016X", AptId);
    m_pSpy -> AddParamValueToList(L"AptID", szAptID);

    IF_AUDIT_DO(OnThreadAssignApartment)(pInfo->perfCount,GuidToBstr(pInfo->guidApp),sGuidActivity,szAptID);

    return S_OK;
  }

STDMETHODIMP CThreadSub::OnThreadBindToApartment | ( | COMSVCSEVENTINFO * | pInfo,
 |  | ULONG64 | ThreadID,
 |  | ULONG64 | AptID,
 |  | DWORD | dwActCnt,
 |  | DWORD | dwLowCnt |
 | ) |  |  | [inline]

Definition at line 98 of file threadsub.h.

  {
    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnThreadBindToApartment"), GuidToBstr(pInfo->guidApp));

    WCHAR szThreadID[32];
    wsprintfW(szThreadID,L"0x%016X", ThreadID);
    m_pSpy -> AddParamValueToList(L"ThreadID", szThreadID);

    WCHAR szAptID[32];
    wsprintfW(szAptID,L"0x%016X", AptID);
    m_pSpy -> AddParamValueToList(L"AptID", szAptID);

    WCHAR szActCnt[16];
    wsprintfW(szActCnt,L"%lu", dwActCnt);
    m_pSpy -> AddParamValueToList(L"dwActCnt", szActCnt);

    //dwLowCnt  reserved - currently is 0.

    IF_AUDIT_DO(OnThreadBindToApartment)(pInfo->perfCount,GuidToBstr(pInfo->guidApp),szThreadID,szAptID,dwActCnt);

    return S_OK;
  }

STDMETHODIMP CThreadSub::OnThreadStart | ( | COMSVCSEVENTINFO * | pInfo,
 |  | ULONG64 | ThreadID,
 |  | DWORD | dwThread,
 |  | DWORD | dwThreadCnt |
 | ) |  |  | [inline]

Definition at line 58 of file threadsub.h.

  {
    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnThreadStart"), GuidToBstr(pInfo->guidApp));

    WCHAR szThreadID[32];
    wsprintfW(szThreadID,L"0x%016X", ThreadID);
    m_pSpy -> AddParamValueToList(L"ThreadID", szThreadID);

    WCHAR szW2KThreadID[16];
    wsprintfW(szW2KThreadID,L"0x%08X", dwThread);
    m_pSpy -> AddParamValueToList(L"dwThread", szW2KThreadID);

    WCHAR szThreadCnt[16];
    wsprintfW(szThreadCnt,L"%lu", dwThreadCnt);
    m_pSpy -> AddParamValueToList(L"dwThreadCnt", szThreadCnt);

    IF_AUDIT_DO(OnThreadStart)(pInfo->perfCount,GuidToBstr(pInfo->guidApp),szThreadID,szW2KThreadID,dwThreadCnt);
    return S_OK;
  }

STDMETHODIMP CThreadSub::OnThreadTerminate | ( | COMSVCSEVENTINFO * | pInfo,
 |  | ULONG64 | ThreadID,
 |  | DWORD | dwThread,
 |  | DWORD | dwThreadCnt |
 | ) |  |  | [inline]

Definition at line 78 of file threadsub.h.

  {
    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnThreadTerminate"), GuidToBstr(pInfo->guidApp));

    WCHAR szThreadID[32];
    wsprintfW(szThreadID,L"0x%016X", ThreadID);
    m_pSpy -> AddParamValueToList(L"ThreadID", szThreadID);

    WCHAR szW2KThreadID[16];
    wsprintfW(szW2KThreadID,L"0x%08X", dwThread);
    m_pSpy -> AddParamValueToList(L"dwThread", szW2KThreadID);

    WCHAR szThreadCnt[16];
    wsprintfW(szThreadCnt,L"%lu", dwThreadCnt);
    m_pSpy -> AddParamValueToList(L"dwThreadCnt", szThreadCnt);

    IF_AUDIT_DO(OnThreadTerminate)(pInfo->perfCount,GuidToBstr(pInfo->guidApp),szThreadID,szW2KThreadID,dwThreadCnt);
    return S_OK;
  }

STDMETHODIMP CThreadSub::OnThreadUnassignApartment | ( | COMSVCSEVENTINFO * | pInfo,
 |  | ULONG64 | AptId |
 | ) |  |  | [inline]

Definition at line 265 of file threadsub.h.

  {
    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnThreadUnassignApartment"), GuidToBstr(pInfo->guidApp));

    WCHAR szAptID[32];
    wsprintfW(szAptID,L"0x%016X", AptId);
    m_pSpy -> AddParamValueToList(L"AptID", szAptID);

    IF_AUDIT_DO(OnThreadUnassignApartment)(pInfo->perfCount,GuidToBstr(pInfo->guidApp),szAptID);

    return S_OK;
  }

STDMETHODIMP CThreadSub::OnThreadUnBind | ( | COMSVCSEVENTINFO * | pInfo,
 |  | ULONG64 | ThreadID,
 |  | ULONG64 | AptID,
 |  | DWORD | dwActCnt |
 | ) |  |  | [inline]

Definition at line 121 of file threadsub.h.

  {
    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnThreadUnBind"), GuidToBstr(pInfo->guidApp));

    WCHAR szThreadID[32];
    wsprintfW(szThreadID,L"0x%016X", ThreadID);
    m_pSpy -> AddParamValueToList(L"ThreadID", szThreadID);

    WCHAR szAptID[32];
    wsprintfW(szAptID,L"0x%016X", AptID);
    m_pSpy -> AddParamValueToList(L"AptID", szAptID);

    WCHAR szActCnt[16];
    wsprintfW(szActCnt,L"%lu", dwActCnt);
    m_pSpy -> AddParamValueToList(L"dwActCnt", szActCnt);

    //dwLowCnt  reserved - currently is 0.

    IF_AUDIT_DO(OnThreadUnBind)(pInfo->perfCount,GuidToBstr(pInfo->guidApp),szThreadID,szAptID,dwActCnt);

    return S_OK;
  }

STDMETHODIMP CThreadSub::OnThreadWorkEnque | ( | COMSVCSEVENTINFO * | pInfo,
 |  | ULONG64 | ThreadID,
 |  | ULONG64 | MsgWorkID,
 |  | DWORD | dwQueueLen |
 | ) |  |  | [inline]

Definition at line 144 of file threadsub.h.

  {
    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnThreadWorkEnque"), GuidToBstr(pInfo->guidApp));

    WCHAR szThreadID[32];
    wsprintfW(szThreadID,L"0x%016X", ThreadID);
    m_pSpy -> AddParamValueToList(L"ThreadID", szThreadID);

    WCHAR szMsgWorkID[32];
    wsprintfW(szMsgWorkID,L"0x%016X", MsgWorkID);
    m_pSpy -> AddParamValueToList(L"MsgWorkID", szMsgWorkID);

    WCHAR szQueueLen[16];
    wsprintfW(szQueueLen,L"%lu", dwQueueLen);
    m_pSpy -> AddParamValueToList(L"QueueLen", szQueueLen);

    IF_AUDIT_DO(OnThreadWorkEnque)(pInfo->perfCount,GuidToBstr(pInfo->guidApp),szThreadID,szMsgWorkID,dwQueueLen);

    return S_OK;
  }

STDMETHODIMP CThreadSub::OnThreadWorkPrivate | ( | COMSVCSEVENTINFO * | pInfo,
 |  | ULONG64 | ThreadID,
 |  | ULONG64 | MsgWorkID |
 | ) |  |  | [inline]

Definition at line 165 of file threadsub.h.

  {
    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnThreadWorkPrivate"), GuidToBstr(pInfo->guidApp));

    WCHAR szThreadID[32];
    wsprintfW(szThreadID,L"0x%016X", ThreadID);
    m_pSpy -> AddParamValueToList(L"ThreadID", szThreadID);

    WCHAR szMsgWorkID[32];
    wsprintfW(szMsgWorkID,L"0x%016X", MsgWorkID);
    m_pSpy -> AddParamValueToList(L"MsgWorkID", szMsgWorkID);

    IF_AUDIT_DO(OnThreadWorkPrivate)(pInfo->perfCount,GuidToBstr(pInfo->guidApp),szThreadID,szMsgWorkID);

    return S_OK;
  }

STDMETHODIMP CThreadSub::OnThreadWorkPublic | ( | COMSVCSEVENTINFO * | pInfo,
 |  | ULONG64 | ThreadID,
 |  | ULONG64 | MsgWorkID,
 |  | DWORD | dwQueueLen |
 | ) |  |  | [inline]

Definition at line 182 of file threadsub.h.

  {
    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnThreadWorkPublic"), GuidToBstr(pInfo->guidApp));

    WCHAR szThreadID[32];
    wsprintfW(szThreadID,L"0x%016X", ThreadID);
    m_pSpy -> AddParamValueToList(L"ThreadID", szThreadID);

    WCHAR szMsgWorkID[32];
    wsprintfW(szMsgWorkID,L"0x%016X", MsgWorkID);
    m_pSpy -> AddParamValueToList(L"MsgWorkID", szMsgWorkID);

    WCHAR szQueueLen[16];
    wsprintfW(szQueueLen,L"%lu", dwQueueLen);
    m_pSpy -> AddParamValueToList(L"QueueLen", szQueueLen);

    IF_AUDIT_DO(OnThreadWorkPublic)(pInfo->perfCount,GuidToBstr(pInfo->guidApp),szThreadID,szMsgWorkID,dwQueueLen);

    return S_OK;
  }

STDMETHODIMP CThreadSub::OnThreadWorkRedirect | ( | COMSVCSEVENTINFO * | pInfo,
 |  | ULONG64 | ThreadID,
 |  | ULONG64 | MsgWorkID,
 |  | DWORD | dwQueueLen,
 |  | ULONG64 | ThreadNum |
 | ) |  |  | [inline]

Definition at line 203 of file threadsub.h.

  {
    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnThreadWorkRedirect"), GuidToBstr(pInfo->guidApp));

    WCHAR szThreadID[32];
    wsprintfW(szThreadID,L"0x%016X", ThreadID);
    m_pSpy -> AddParamValueToList(L"ThreadID", szThreadID);

    WCHAR szMsgWorkID[32];
    wsprintfW(szMsgWorkID,L"0x%016X", MsgWorkID);
    m_pSpy -> AddParamValueToList(L"MsgWorkID", szMsgWorkID);

    WCHAR szQueueLen[16];
    wsprintfW(szQueueLen,L"%lu", dwQueueLen);
    m_pSpy -> AddParamValueToList(L"QueueLen", szQueueLen);

    WCHAR szThreadNum[32];
    wsprintfW(szThreadNum,L"0x%016X", ThreadNum);
    m_pSpy -> AddParamValueToList(L"ThreadNum", szThreadNum);

    IF_AUDIT_DO(OnThreadWorkRedirect)(pInfo->perfCount,GuidToBstr(pInfo->guidApp),szThreadID,szMsgWorkID,dwQueueLen,szThreadNum);

    return S_OK;
  }

STDMETHODIMP CThreadSub::OnThreadWorkReject | ( | COMSVCSEVENTINFO * | pInfo,
 |  | ULONG64 | ThreadID,
 |  | ULONG64 | MsgWorkID,
 |  | DWORD | dwQueueLen |
 | ) |  |  | [inline]

Definition at line 228 of file threadsub.h.

  {
    m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnThreadWorkReject"), GuidToBstr(pInfo->guidApp));

    WCHAR szThreadID[32];
    wsprintfW(szThreadID,L"0x%016X", ThreadID);
    m_pSpy -> AddParamValueToList(L"ThreadID", szThreadID);

    WCHAR szMsgWorkID[32];
    wsprintfW(szMsgWorkID,L"0x%016X", MsgWorkID);
    m_pSpy -> AddParamValueToList(L"MsgWorkID", szMsgWorkID);

    WCHAR szQueueLen[16];
    wsprintfW(szQueueLen,L"%lu", dwQueueLen);
    m_pSpy -> AddParamValueToList(L"QueueLen", szQueueLen);

    IF_AUDIT_DO(OnThreadWorkReject)(pInfo->perfCount,GuidToBstr(pInfo->guidApp),szThreadID,szMsgWorkID,dwQueueLen);

    return S_OK;
  }

The documentation for this class was generated from the following file:
  • Com/Administration/Spy/ComSpyCtl/threadsub.h
Generated on Wed Nov 13 2024 16:57:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CThumbNailPhotoHolder Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CThumbNailPhotoHolder Class Reference

#include "util.h"

List of all members.

Public Member Functions

CThumbNailPhotoHolder ()
CThumbNailPhotoHolder ()
~CThumbNailPhotoHolder ()
~CThumbNailPhotoHolder ()
BOOL | Change (HWND hWndOwner)
BOOL | Change (HWND hWndOwner)
BOOL Clear ()
BOOL Clear ()
void | Initialize (HWND hWndFileNameEdit, HWND hWndPictureControl)
void | Initialize (HWND hWndFileNameEdit, HWND hWndPictureControl)
HRESULT | Read (IDirectoryObject *pDirObj)
HRESULT | Read (IADs *pIADs)
HRESULT | Read (IDirectoryObject *pDirObj)
HRESULT | Read (IADs *pIADs)
HRESULT | Write (IDirectoryObject *pDirObj)
HRESULT | Write (IADs *pIADs)
HRESULT | Write (IADs *pIADs)
HRESULT | Write (IDirectoryObject *pDirObj)

Private Member Functions

void | _Clear ()
void | _Clear ()
BOOL | _DisplayPicture (LPCWSTR lpszPath)
BOOL | _DisplayPicture (LPCWSTR lpszPath)
void | _SetPictureControl (HBITMAP hBitmap)
void | _SetPictureControl (HBITMAP hBitmap)
void | _WriteHelper (HRESULT hr)
void | _WriteHelper (HRESULT hr)

Private Attributes

DWORD m_dwPictureSize
HWND | m_hWndFileNameEdit
HWND | m_hWndPictureControl
BYTE * | m_pPictureArray

Detailed Description

Definition at line 29 of file util.h.

Constructor & Destructor Documentation

CThumbNailPhotoHolder::CThumbNailPhotoHolder ( ) [inline]

Definition at line 32 of file util.h.

  {
    m_hWndFileNameEdit = NULL;
    m_hWndPictureControl = NULL;

    m_pPictureArray = NULL;
    m_dwPictureSize = 0x0;
  }

CThumbNailPhotoHolder::~CThumbNailPhotoHolder ( ) [inline]

Definition at line 40 of file util.h.

  {
    _Clear();
  }

CThumbNailPhotoHolder::CThumbNailPhotoHolder ( ) [inline]

Definition at line 32 of file util.h.

  {
    m_hWndFileNameEdit = NULL;
    m_hWndPictureControl = NULL;

    m_pPictureArray = NULL;
    m_dwPictureSize = 0x0;
  }

CThumbNailPhotoHolder::~CThumbNailPhotoHolder ( ) [inline]

Definition at line 40 of file util.h.

  {
    _Clear();
  }

Member Function Documentation

void CThumbNailPhotoHolder::_Clear ( ) [inline, private]

Definition at line 68 of file util.h.

  {
    if (m_pPictureArray != NULL)
    {
      ASSERT(m_dwPictureSize != NULL);
      delete m_pPictureArray;
      m_pPictureArray = NULL;
      m_dwPictureSize = 0x0;
    }
  }

void CThumbNailPhotoHolder::_Clear ( ) [inline, private]

Definition at line 68 of file util.h.

  {
    if (m_pPictureArray != NULL)
    {
      ASSERT(m_dwPictureSize != NULL);
      delete m_pPictureArray;
      m_pPictureArray = NULL;
      m_dwPictureSize = 0x0;
    }
  }

BOOL CThumbNailPhotoHolder::_DisplayPicture ( LPCWSTR lpszPath ) [private]

Definition at line 439 of file util.cpp.

{
  //
  // Load and display the picture
  //
  HBITMAP hPicture = (HBITMAP)::LoadImage(NULL, lpszPath, IMAGE_BITMAP, 0, 0 , LR_LOADFROMFILE);
  if (hPicture == NULL)
  {
    return FALSE;
  }
  _SetPictureControl(hPicture);
  return TRUE;
}

BOOL CThumbNailPhotoHolder::_DisplayPicture ( LPCWSTR lpszPath ) [private]
void CThumbNailPhotoHolder::_SetPictureControl ( HBITMAP hBitmap ) [inline, private]

Definition at line 78 of file util.h.

  {
    ::SendMessage(m_hWndPictureControl, STM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM)(HANDLE)hBitmap);
    if (hBitmap != NULL)
      return;
    ::ShowWindow(m_hWndPictureControl, FALSE);
    ::ShowWindow(m_hWndPictureControl, TRUE);
  }

void CThumbNailPhotoHolder::_SetPictureControl ( HBITMAP hBitmap ) [inline, private]

Definition at line 78 of file util.h.

  {
    ::SendMessage(m_hWndPictureControl, STM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM)(HANDLE)hBitmap);
    if (hBitmap != NULL)
      return;
    ::ShowWindow(m_hWndPictureControl, FALSE);
    ::ShowWindow(m_hWndPictureControl, TRUE);
  }

void CThumbNailPhotoHolder::_WriteHelper ( HRESULT hr ) [private]
void CThumbNailPhotoHolder::_WriteHelper ( HRESULT hr ) [private]

Definition at line 323 of file util.cpp.

{
  if (FAILED(hr))
  {
    CString szMsg;
    szMsg.Format(_T("Failed to write Thumbnail Photo attribute, with hr = 0x%x\n"), hr);
    AfxMessageBox(szMsg);
  }
  else
  {
    //
    // Show the picture path in the read-only edit box
    //
    ::SetWindowText(m_hWndFileNameEdit, (m_pPictureArray != NULL) ? lpszPhotoInDS : NULL);
  }
}

BOOL CThumbNailPhotoHolder::Change ( HWND hWndOwner )
BOOL CThumbNailPhotoHolder::Change ( HWND hWndOwner )

Definition at line 341 of file util.cpp.

{
  TCHAR szFileName[MAX_PATH] = _T("\0");
  OPENFILENAME OpenFileName;
  memset(&OpenFileName, 0, sizeof(OpenFileName));

  //
  // Fill in the OPENFILENAME structure
  //
  OpenFileName.lStructSize        = sizeof(OPENFILENAME);
  OpenFileName.hwndOwner          = hWndOwner;
  OpenFileName.hInstance          = AfxGetInstanceHandle();
  OpenFileName.lpstrFile          = szFileName;
  OpenFileName.nMaxFile           = sizeof(szFileName);
  OpenFileName.lpstrFilter        = _T("Bitmap Files (*.bmp)\0*.bmp");
  OpenFileName.lpstrTitle         = _T("Select bitmap file");
  OpenFileName.Flags              = OFN_EXPLORER;

  //
  // Open file browse dialog and retrieve the path and name of the bitmap to use.
  //
  if (GetOpenFileName(&OpenFileName))
  {
    //
    // Load the picture into a temporary byte array
    //
    BYTE* pNewPictureArray = NULL;
    DWORD dwNewPictureSize = 0x0;

    if (!LoadFileAsByteArray(szFileName, &pNewPictureArray, &dwNewPictureSize))
    {
      CString szMsg;
      szMsg.Format(_T("Failed to open file %s."), szFileName);
      AfxMessageBox(szMsg);
      return FALSE;
    }

    ASSERT(pNewPictureArray != NULL);

    ::SetWindowText(m_hWndFileNameEdit, szFileName);

    //
    // Display the picture in the static window
    //
    if (!_DisplayPicture(szFileName))
    {
      CString szMsg;
      szMsg.Format(_T("Failed to load file %s as a bitmap."), szFileName);
      AfxMessageBox(szMsg);

      if (pNewPictureArray != NULL)
        delete pNewPictureArray;
      return FALSE;

    }

    //
    // Update any existing picture information
    //
    _Clear();
    m_pPictureArray = pNewPictureArray;
    m_dwPictureSize = dwNewPictureSize;

    //
    // we have a new one
    //
    return TRUE;
  }

  //
  // no change
  //
  return FALSE;
}

BOOL CThumbNailPhotoHolder::Clear ( )
BOOL CThumbNailPhotoHolder::Clear ( )

Definition at line 416 of file util.cpp.

{
  if (m_pPictureArray == NULL)
    return FALSE;

  //
  // clear the picture array info
  //
  _Clear();

  //
  // clear the path info
  //
  ::SetWindowText(m_hWndFileNameEdit, NULL);

  //
  // clear the picture
  //
  _SetPictureControl(NULL);

  return TRUE;
}

void CThumbNailPhotoHolder::Initialize | ( | HWND | hWndFileNameEdit,
 |  | HWND | hWndPictureControl |
 | ) |  |  | [inline]

Definition at line 46 of file util.h.

  {
    ASSERT(::IsWindow(hWndFileNameEdit));
    ASSERT(::IsWindow(hWndPictureControl));

    m_hWndFileNameEdit = hWndFileNameEdit;
    m_hWndPictureControl = hWndPictureControl;
  }

void CThumbNailPhotoHolder::Initialize | ( | HWND | hWndFileNameEdit,
 |  | HWND | hWndPictureControl |
 | ) |  |  | [inline]

Definition at line 46 of file util.h.

  {
    ASSERT(::IsWindow(hWndFileNameEdit));
    ASSERT(::IsWindow(hWndPictureControl));

    m_hWndFileNameEdit = hWndFileNameEdit;
    m_hWndPictureControl = hWndPictureControl;
  }

HRESULT CThumbNailPhotoHolder::Read ( IADs * pIADs )
HRESULT CThumbNailPhotoHolder::Read ( IDirectoryObject * pDirObj )
HRESULT CThumbNailPhotoHolder::Read ( IADs * pIADs )

Definition at line 180 of file util.cpp.

{
  return E_FAIL;
}

HRESULT CThumbNailPhotoHolder::Read ( IDirectoryObject * pDirObj )

Definition at line 185 of file util.cpp.

{
  LPWSTR lpszAttrArray[] = { _T("thumbnailPhoto") };
  PADS_ATTR_INFO pAttrInfo;
  DWORD dwReturned = 0;

  //
  // Get the thumbnailPhoto information from the object
  //
  HRESULT hr = pDirObj->GetObjectAttributes(lpszAttrArray, 1, &pAttrInfo, &dwReturned);
  if (FAILED(hr))
  {
    CString szMsg;
    szMsg.Format(_T("Failed to read Thumbnail Photo attribute, with hr = 0x%x\n"), hr);
    AfxMessageBox(szMsg);
    return hr;
  }

  if (dwReturned > 0)
  {
    ASSERT(pAttrInfo != NULL);
    //
    // Create a temporary bmp file in the temp directory
    //

    WCHAR szTempPath[MAX_PATH];
    ::GetTempPath(MAX_PATH, szTempPath);

    CString szPicturePath;
    ::GetTempFileName(szTempPath, _T("thumbnail"), 0x0, szPicturePath.GetBuffer(MAX_PATH));
    szPicturePath.ReleaseBuffer();

    CFile tempPhotoFile;
    if (!tempPhotoFile.Open(szPicturePath,
        CFile::modeCreate | CFile::modeReadWrite |CFile::shareExclusive | CFile::typeBinary))
    {
      // Failed to open temp file, display error message
      AfxMessageBox(_T("Unable to display thumbnail photo."));
      return E_FAIL;
    }

    ASSERT(pAttrInfo->dwADsType == ADSTYPE_OCTET_STRING);

    //
    // Delete current picture if one exists
    //
    _Clear();

    //
    // Create a new byte array to hold the bitmap
    //
    m_dwPictureSize = pAttrInfo->pADsValues->OctetString.dwLength;
    m_pPictureArray = new BYTE[m_dwPictureSize];
    memcpy(m_pPictureArray, pAttrInfo->pADsValues->OctetString.lpValue, m_dwPictureSize);
    ASSERT(m_pPictureArray != NULL);

    //
    // Write the byte array to a temp file
    //
    tempPhotoFile.Write(m_pPictureArray, m_dwPictureSize);
    CString szPath = tempPhotoFile.GetFilePath();
    tempPhotoFile.Close();

    //
    // Show the picture path in the read-only edit box
    //
    ::SetWindowText(m_hWndFileNameEdit, lpszPhotoInDS);

    //
    // Display the picture in the static control
    //
    _DisplayPicture(szPath);

    //
    // Delete temp file after picture is displayed
    //
    CFile::Remove(szPath);

    //
    // Free the attribute memory
    //
    FreeADsMem(pAttrInfo);
  }

  return S_OK;
}

HRESULT CThumbNailPhotoHolder::Write ( IADs * pIADs )
HRESULT CThumbNailPhotoHolder::Write ( IDirectoryObject * pDirObj )
HRESULT CThumbNailPhotoHolder::Write ( IDirectoryObject * pDirObj )

Definition at line 290 of file util.cpp.

{
  ADS_ATTR_INFO attrInfo[1];
  PWSTR rgpwzAttrNames[] = { _T("thumbnailPhoto")};
  ADSVALUE Value[1];

  //
  // Set the update/clear value
  //

  attrInfo[0].dwADsType = ADSTYPE_OCTET_STRING;
  attrInfo[0].pszAttrName = rgpwzAttrNames[0];

  Value[0].dwType = ADSTYPE_OCTET_STRING;
  Value[0].OctetString.dwLength = (m_pPictureArray != NULL) ? m_dwPictureSize : 0;
  Value[0].OctetString.lpValue = m_pPictureArray;

  attrInfo[0].pADsValues = &Value[0];
  attrInfo[0].dwNumValues = 1;
  attrInfo[0].dwControlCode = (m_pPictureArray != NULL) ? ADS_ATTR_UPDATE : ADS_ATTR_CLEAR;

  //
  // Write the changes to the object
  //
  DWORD dwModified = 0;
  HRESULT hr = pDirObj->SetObjectAttributes(attrInfo, 1, &dwModified);

  _WriteHelper(hr);

  return hr;
}

HRESULT CThumbNailPhotoHolder::Write ( IADs * pIADs )

Definition at line 274 of file util.cpp.

{
  //
  // Write the changes to the object
  //
  HRESULT hr = SetByteArrayAsOctetString(pIADs,
                                  _T("thumbnailPhoto"),
                                  m_pPictureArray,
                                  (m_pPictureArray != NULL) ? m_dwPictureSize : 0);

  _WriteHelper(hr);

  return hr;
}

Member Data Documentation

DWORD CThumbNailPhotoHolder::m_dwPictureSize [private]

Definition at line 96 of file util.h.

HWND CThumbNailPhotoHolder::m_hWndFileNameEdit [private]

Definition at line 92 of file util.h.

HWND CThumbNailPhotoHolder::m_hWndPictureControl [private]

Definition at line 93 of file util.h.

BYTE * CThumbNailPhotoHolder::m_pPictureArray [private]

Definition at line 95 of file util.h.

The documentation for this class was generated from the following files:
  • NetDS/ADSI/samples/DSUI/userext/userproppage/util.h
  • NetDS/ADSI/samples/DSUI/userext/userwizard/util.h
  • NetDS/ADSI/samples/DSUI/userext/userproppage/util.cpp
  • NetDS/ADSI/samples/DSUI/userext/userwizard/util.cpp
Generated on Wed Nov 13 2024 16:57:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CTIMER Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CTIMER Class Reference

List of all members.

Public Member Functions

CTIMER ()
float | OutputTime ()
void | Start ()
void | Stop ()

Public Attributes

LARGE_INTEGER | m_liFreq
LARGE_INTEGER | m_sStart
LARGE_INTEGER | m_sStop

Detailed Description

Definition at line 175 of file ComPerf.Cpp.

Constructor & Destructor Documentation

CTIMER::CTIMER ( ) [inline]

Definition at line 178 of file ComPerf.Cpp.

{ memset(this, 0, sizeof(*this)); }

Member Function Documentation

float CTIMER::OutputTime ( ) [inline]

Definition at line 181 of file ComPerf.Cpp.

                                  { QueryPerformanceFrequency(&m_liFreq);
      return (float)(( m_sStop.LowPart - m_sStart.LowPart)/(float)m_liFreq.LowPart);}

void CTIMER::Start ( ) [inline]

Definition at line 179 of file ComPerf.Cpp.

{ QueryPerformanceCounter(&m_sStart); }

void CTIMER::Stop ( ) [inline]

Definition at line 180 of file ComPerf.Cpp.

{ QueryPerformanceCounter(&m_sStop); }

Member Data Documentation

LARGE_INTEGER CTIMER::m_liFreq

Definition at line 184 of file ComPerf.Cpp.

LARGE_INTEGER CTIMER::m_sStart

Definition at line 184 of file ComPerf.Cpp.

LARGE_INTEGER CTIMER::m_sStop

Definition at line 184 of file ComPerf.Cpp.

The documentation for this class was generated from the following file:
  • Com/Fundamentals/DCom/ComPerf/ComPerf.Cpp
Generated on Wed Nov 13 2024 16:57:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CTitleTag Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CTitleTag Class Reference

#include "TitleTag.Hxx"

Inherits CPropertyTag.

List of all members.

Public Member Functions

CTitleTag (CHtmlIFilter &htmlIFilter, CSerialStream &serialStream, CFullPropSpec &propSpec, HtmlTokenType eTokType)
virtual SCODE | GetChunk (STAT_CHUNK *pStat)
virtual SCODE | GetText (ULONG *pcwcOutput, WCHAR *awcBuffer)
virtual SCODE | GetValue (PROPVARIANT **ppPropValue)

Private Attributes

int | dummy

Detailed Description

Definition at line 24 of file TitleTag.Hxx.

Constructor & Destructor Documentation

CTitleTag::CTitleTag | ( | CHtmlIFilter & | htmlIFilter,
 |  | CSerialStream & | serialStream,
 |  | CFullPropSpec & | propSpec,
 |  | HtmlTokenType | eTokType
 | ) |  |

Definition at line 32 of file TitleTag.Cxx.

    : CPropertyTag(htmlIFilter, serialStream, propSpec, eTokType)
{
}

Member Function Documentation

SCODE CTitleTag::GetChunk ( STAT_CHUNK * pStat ) [virtual]

Reimplemented from CPropertyTag.

Definition at line 52 of file TitleTag.Cxx.

{
    switch ( _eState )
    {
    case NoMoreProperty:
        _eState = FilteringValueProperty;

        pStat->idChunk = _htmlIFilter.GetNextChunkId();
        pStat->breakType = CHUNK_EOS;
        pStat->flags = CHUNK_VALUE;
        pStat->locale = _htmlIFilter.GetLocale();
        pStat->attribute.guidPropSet = _propSpec.GetPropSet();

        Win4Assert( _propSpec.IsPropertyPropid() );

        pStat->attribute.psProperty.ulKind = PRSPEC_PROPID;
        pStat->attribute.psProperty.propid = _propSpec.GetPropertyPropid();
        pStat->idChunkSource = _ulIdContentChunk;
        pStat->cwcStartSource = 0;
        pStat->cwcLenSource = 0;

        return S_OK;

    case FilteringValueProperty:
    case NoMoreValueProperty:
        //
        // Skip over the end property tag
        //
        _scanner.EatTag();

        return SwitchToNextHtmlElement( pStat );

    default:
        return CPropertyTag::GetChunk( pStat );
    }
}

SCODE CTitleTag::GetText | ( | ULONG * | pcwcOutput,
 |  | WCHAR * | awcBuffer |
 | ) |  |  | [virtual]

Reimplemented from CPropertyTag.

Definition at line 102 of file TitleTag.Cxx.

{
    switch ( _eState )
    {
    case FilteringValueProperty:
    case NoMoreValueProperty:
        return FILTER_E_NO_TEXT;

    default:
        return CPropertyTag::GetText( pcwcOutput, awcBuffer );
    }
}

SCODE CTitleTag::GetValue ( PROPVARIANT ** ppPropValue ) [virtual]

Reimplemented from CHtmlElement.

Definition at line 127 of file TitleTag.Cxx.

{
    switch (_eState)
    {
    case FilteringContent:
    case NoMoreContent:
    case FilteringProperty:
    case FilteringPropertyButContentNotFiltered:
    case NoMoreProperty:
        return FILTER_E_NO_VALUES;

    case FilteringValueProperty:
    {
        ConcatenateProperty( L"\0", 1 );     // Null terminate for SetLPWSTR

        PROPVARIANT *pPropVar = (PROPVARIANT *) CoTaskMemAlloc( sizeof PROPVARIANT );
        if ( pPropVar == 0 )
            return E_OUTOFMEMORY;

        pPropVar->vt = VT_LPWSTR;
        int cb = (int) ( ( wcslen(_pwcPropBuf) + 1 ) * sizeof( WCHAR ) );
        pPropVar->pwszVal = (WCHAR *) CoTaskMemAlloc( cb );

        if ( pPropVar->pwszVal == 0 )
        {
            CoTaskMemFree( (void *) pPropVar );
            return E_OUTOFMEMORY;
        }

        RtlCopyMemory( pPropVar->pwszVal, _pwcPropBuf, cb );

        *ppPropValue = pPropVar;

        _eState = NoMoreValueProperty;
        return S_OK;
    }

    case NoMoreValueProperty:
        return FILTER_E_NO_MORE_VALUES;

    default:
        Win4Assert( !"Unknown value of _eState" );
        htmlDebugOut(( DEB_ERROR,
                       "CTitleTag::GetValue, unknown value of _eState: %d\n",
                       _eState ));
        return E_FAIL;
    }
}

Member Data Documentation

int CTitleTag::dummy [private]

Definition at line 38 of file TitleTag.Hxx.

The documentation for this class was generated from the following files:
  • WinBase/Indexing/IFilter/TitleTag.Hxx
  • WinBase/Indexing/IFilter/TitleTag.Cxx
Generated on Wed Nov 13 2024 16:57:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CToken Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CToken Class Reference

#include "HtmlScan.Hxx"

List of all members.

Public Member Functions

HtmlTokenType GetTokenType ()
BOOL | IsMatchProperty (CFullPropSpec &propSpec)
BOOL IsStartToken ()
void | SetPropid (PROPID propid)
void | SetPropset (GUID guidPropset)
void | SetStartTokenFlag (BOOL fStart)
void | SetTokenType (HtmlTokenType eTokType)

Private Attributes

HtmlTokenType _eTokenType
BOOL _fStartToken
GUID | _guidPropset
PROPID | _propid

Detailed Description

Definition at line 47 of file HtmlScan.Hxx.

Member Function Documentation

HtmlTokenType CToken::GetTokenType ( ) [inline]

Definition at line 52 of file HtmlScan.Hxx.

{ return _eTokenType; }

BOOL CToken::IsMatchProperty ( CFullPropSpec & propSpec )

Definition at line 30 of file HtmlScan.Cxx.

{
    if ( propSpec.IsPropertyPropid()
         && propSpec.GetPropSet() == _guidPropset
         && propSpec.GetPropertyPropid() == _propid )
    {
        return TRUE;
    }
    else
        return FALSE;
}

BOOL CToken::IsStartToken ( ) [inline]

Definition at line 55 of file HtmlScan.Hxx.

{ return _fStartToken; }

void CToken::SetPropid ( PROPID propid ) [inline]

Definition at line 58 of file HtmlScan.Hxx.

{ _propid = propid; }

void CToken::SetPropset ( GUID guidPropset ) [inline]

Definition at line 57 of file HtmlScan.Hxx.

{ _guidPropset = guidPropset; }

void CToken::SetStartTokenFlag ( BOOL fStart ) [inline]

Definition at line 54 of file HtmlScan.Hxx.

{ _fStartToken = fStart; }

void CToken::SetTokenType ( HtmlTokenType eTokType ) [inline]

Definition at line 51 of file HtmlScan.Hxx.

{ _eTokenType = eTokType; }

Member Data Documentation

HtmlTokenType CToken::_eTokenType [private]

Definition at line 63 of file HtmlScan.Hxx.

BOOL CToken::_fStartToken [private]

Definition at line 64 of file HtmlScan.Hxx.

GUID CToken::_guidPropset [private]

Definition at line 65 of file HtmlScan.Hxx.

PROPID CToken::_propid [private]

Definition at line 66 of file HtmlScan.Hxx.

The documentation for this class was generated from the following files:
  • WinBase/Indexing/IFilter/HtmlScan.Hxx
  • WinBase/Indexing/IFilter/HtmlScan.Cxx
Generated on Wed Nov 13 2024 16:57:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CToolBand Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes | Private Member Functions | Static Private Member Functions | Private Attributes

CToolBand Class Reference

#include "ToolBand.h"

List of all members.

Public Member Functions

CToolBand ()
~CToolBand ()
STDMETHOD() | CloseDW (DWORD dwReserved)
STDMETHOD() | ContextSensitiveHelp (BOOL)
STDMETHOD() | GetBandInfo (DWORD, DWORD, DESKBANDINFO *)
STDMETHOD() | GetClassID (LPCLSID)
STDMETHOD() | GetSite (REFIID, LPVOID *)
STDMETHOD() | GetSizeMax (ULARGE_INTEGER *)
STDMETHOD() | GetWindow (HWND *)
STDMETHOD() | HasFocusIO (void)
STDMETHOD() | IsDirty (void)
STDMETHOD() | Load (LPSTREAM)
STDMETHODIMP | QueryInterface (REFIID, LPVOID *)
STDMETHOD() | ResizeBorderDW (LPCRECT prcBorder, IUnknown *punkToolbarSite, BOOL fReserved)
STDMETHOD() | Save (LPSTREAM, BOOL)
STDMETHOD() | SetSite (IUnknown *)
STDMETHOD() | ShowDW (BOOL fShow)
STDMETHODIMP_ (DWORD) Release()
STDMETHODIMP_ (DWORD) AddRef()
STDMETHOD() | TranslateAcceleratorIO (LPMSG)
STDMETHOD() | UIActivateIO (BOOL, LPMSG)

Protected Attributes

DWORD m_ObjRefCount

Private Member Functions

void | FocusChange (BOOL)
LRESULT | OnCommand (WPARAM wParam, LPARAM lParam)
LRESULT | OnKillFocus (void)
LRESULT | OnPaint (void)
LRESULT | OnSetFocus (void)
LRESULT | OnSize (LPARAM)
BOOL | RegisterAndCreateWindow (void)

Static Private Member Functions

static LRESULT CALLBACK | WndProc (HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam)

Private Attributes

BOOL m_bFocus
DWORD m_dwBandID
DWORD m_dwViewMode
HWND | m_hWnd
HWND | m_hwndParent
IInputObjectSite * | m_pSite

Detailed Description

Definition at line 46 of file ToolBand.h.

Constructor & Destructor Documentation

CToolBand::CToolBand ( )

Definition at line 31 of file ToolBand.Cpp.

{
m_pSite = NULL;

m_hWnd = NULL;
m_hwndParent = NULL;

m_bFocus = FALSE;

m_dwViewMode = 0;
m_dwBandID = 0;

m_ObjRefCount = 1;
g_DllRefCount++;
}

CToolBand::~CToolBand ( )

Definition at line 53 of file ToolBand.Cpp.

{
//this should have been freed in a call to SetSite(NULL), but just to be safe
if(m_pSite)
   {
   m_pSite->Release();
   m_pSite = NULL;
   }

g_DllRefCount--;
}

Member Function Documentation

STDMETHODIMP CToolBand::CloseDW ( DWORD dwReserved )

Definition at line 237 of file ToolBand.Cpp.

{
ShowDW(FALSE);

if(IsWindow(m_hWnd))
   DestroyWindow(m_hWnd);

m_hWnd = NULL;

return S_OK;
}

STDMETHODIMP CToolBand::ContextSensitiveHelp ( BOOL fEnterMode )

Definition at line 196 of file ToolBand.Cpp.

{
return E_NOTIMPL;
}

void CToolBand::FocusChange ( BOOL bFocus ) [private]

Definition at line 616 of file ToolBand.Cpp.

{
m_bFocus = bFocus;

//inform the input object site that the focus has changed
if(m_pSite)
   {
   m_pSite->OnFocusChangeIS((IDockingWindow*)this, bFocus);
   }
}

STDMETHODIMP CToolBand::GetBandInfo | ( | DWORD | dwBandID,
 |  | DWORD | dwViewMode,
 |  | DESKBANDINFO * | pdbi
 | ) |  |

Definition at line 393 of file ToolBand.Cpp.

{
if(pdbi)
   {
   m_dwBandID = dwBandID;
   m_dwViewMode = dwViewMode;

   if(pdbi->dwMask & DBIM_MINSIZE)
      {
      pdbi->ptMinSize.x = TB_MIN_SIZE_X;
      pdbi->ptMinSize.y = TB_MIN_SIZE_Y;
      }

   if(pdbi->dwMask & DBIM_MAXSIZE)
      {
      pdbi->ptMaxSize.x = -1;
      pdbi->ptMaxSize.y = TB_MAX_SIZE_Y;
      }

   if(pdbi->dwMask & DBIM_INTEGRAL)
      {
      pdbi->ptIntegral.x = 1;
      pdbi->ptIntegral.y = 1;
      }

   if(pdbi->dwMask & DBIM_ACTUAL)
      {
      pdbi->ptActual.x = 200;
      pdbi->ptActual.y = TB_MAX_SIZE_Y;
      }

   if(pdbi->dwMask & DBIM_TITLE)
      {
      lstrcpyW(pdbi->wszTitle, L"Sample Tool Band");
      }

   if(pdbi->dwMask & DBIM_MODEFLAGS)
      {
      pdbi->dwModeFlags = DBIMF_NORMAL;

      pdbi->dwModeFlags |= DBIMF_VARIABLEHEIGHT;
      }

   if(pdbi->dwMask & DBIM_BKCOLOR)
      {
      //Use the default background color by removing this flag.
      pdbi->dwMask &= ~DBIM_BKCOLOR;
      }

   return S_OK;
   }

return E_INVALIDARG;
}

STDMETHODIMP CToolBand::GetClassID ( LPCLSID pClassID )

Definition at line 463 of file ToolBand.Cpp.

{
*pClassID = CLSID_SampleDeskBand;

return S_OK;
}

STDMETHODIMP CToolBand::GetSite | ( | REFIID | riid,
 |  | LPVOID * | ppvReturn
 | ) |  |

Definition at line 372 of file ToolBand.Cpp.

{
*ppvReturn = NULL;

if(m_pSite)
   return m_pSite->QueryInterface(riid, ppvReturn);

return E_FAIL;
}

STDMETHODIMP CToolBand::GetSizeMax ( ULARGE_INTEGER * pul )

Definition at line 509 of file ToolBand.Cpp.

{
return E_NOTIMPL;
}

STDMETHODIMP CToolBand::GetWindow ( HWND * phWnd )

Definition at line 183 of file ToolBand.Cpp.

{
*phWnd = m_hWnd;

return S_OK;
}

STDMETHODIMP CToolBand::HasFocusIO ( void )

Definition at line 293 of file ToolBand.Cpp.

{
if(m_bFocus)
   return S_OK;

return S_FALSE;
}

STDMETHODIMP CToolBand::IsDirty ( void )

Definition at line 476 of file ToolBand.Cpp.

{
return S_FALSE;
}

STDMETHODIMP CToolBand::Load ( LPSTREAM pStream )

Definition at line 487 of file ToolBand.Cpp.

{
return S_OK;
}

LRESULT CToolBand::OnCommand | ( | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private]

Definition at line 590 of file ToolBand.Cpp.

{
return 0;
}

LRESULT CToolBand::OnKillFocus ( void ) [private]

Definition at line 646 of file ToolBand.Cpp.

{
FocusChange(FALSE);

return 0;
}

LRESULT CToolBand::OnPaint ( void ) [private]

Definition at line 567 of file ToolBand.Cpp.

{
PAINTSTRUCT ps;
RECT        rc;

BeginPaint(m_hWnd, &ps);

GetClientRect(m_hWnd, &rc);
SetTextColor(ps.hdc, RGB(0, 0, 0));
SetBkMode(ps.hdc, TRANSPARENT);
DrawText(ps.hdc, TEXT("Sample Tool Band"), -1, &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER);

EndPaint(m_hWnd, &ps);

return 0;
}

LRESULT CToolBand::OnSetFocus ( void ) [private]

Definition at line 633 of file ToolBand.Cpp.

{
FocusChange(TRUE);

return 0;
}

LRESULT CToolBand::OnSize ( LPARAM lParam ) [private]

Definition at line 601 of file ToolBand.Cpp.

{
int   cx, cy;

cx = LOWORD(lParam);
cy = HIWORD(lParam);
return 0;
}

STDMETHODIMP CToolBand::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppReturn
 | ) |  |

Definition at line 76 of file ToolBand.Cpp.

{
*ppReturn = NULL;

//IUnknown
if(IsEqualIID(riid, IID_IUnknown))
   {
   *ppReturn = this;
   }

//IOleWindow
else if(IsEqualIID(riid, IID_IOleWindow))
   {
   *ppReturn = (IOleWindow*)this;
   }

//IDockingWindow
else if(IsEqualIID(riid, IID_IDockingWindow))
   {
   *ppReturn = (IDockingWindow*)this;
   }

//IInputObject
else if(IsEqualIID(riid, IID_IInputObject))
   {
   *ppReturn = (IInputObject*)this;
   }

//IObjectWithSite
else if(IsEqualIID(riid, IID_IObjectWithSite))
   {
   *ppReturn = (IObjectWithSite*)this;
   }

//IDeskBand
else if(IsEqualIID(riid, IID_IDeskBand))
   {
   *ppReturn = (IDeskBand*)this;
   }

//IPersist
else if(IsEqualIID(riid, IID_IPersist))
   {
   *ppReturn = (IPersist*)this;
   }

//IPersistStream
else if(IsEqualIID(riid, IID_IPersistStream))
   {
   *ppReturn = (IPersistStream*)this;
   }

//IContextMenu
else if(IsEqualIID(riid, IID_IContextMenu))
   {
   *ppReturn = (IContextMenu*)this;
   }

if(*ppReturn)
   {
   (*(LPUNKNOWN*)ppReturn)->AddRef();
   return S_OK;
   }

return E_NOINTERFACE;
}

BOOL CToolBand::RegisterAndCreateWindow ( void ) [private]

Definition at line 659 of file ToolBand.Cpp.

{
//If the window doesn't exist yet, create it now.
if(!m_hWnd)
   {
   //Can't create a child window without a parent.
   if(!m_hwndParent)
      {
      return FALSE;
      }

   //If the window class has not been registered, then do so.
   WNDCLASS wc;
   if(!GetClassInfo(g_hInst, TB_CLASS_NAME, &wc))
      {
      ZeroMemory(&wc, sizeof(wc));
      wc.style          = CS_HREDRAW | CS_VREDRAW | CS_GLOBALCLASS;
      wc.lpfnWndProc    = (WNDPROC)WndProc;
      wc.cbClsExtra     = 0;
      wc.cbWndExtra     = 0;
      wc.hInstance      = g_hInst;
      wc.hIcon          = NULL;
      wc.hCursor        = LoadCursor(NULL, IDC_ARROW);
      wc.hbrBackground  = (HBRUSH)CreateSolidBrush(RGB(255, 255, 0));
      wc.lpszMenuName   = NULL;
      wc.lpszClassName  = TB_CLASS_NAME;

      if(!RegisterClass(&wc))
         {
         //If RegisterClass fails, CreateWindow below will fail.
         }
      }

   RECT  rc;

   GetClientRect(m_hwndParent, &rc);

   //Create the window. The WndProc will set m_hWnd.
   CreateWindowEx(   0,
                     TB_CLASS_NAME,
                     NULL,
                     WS_CHILD | WS_CLIPSIBLINGS | WS_BORDER,
                     rc.left,
                     rc.top,
                     rc.right - rc.left,
                     rc.bottom - rc.top,
                     m_hwndParent,
                     NULL,
                     g_hInst,
                     (LPVOID)this);

   }

return (NULL != m_hWnd);
}

STDMETHODIMP CToolBand::ResizeBorderDW | ( | LPCRECT | prcBorder,
 |  | IUnknown * | punkToolbarSite,
 |  | BOOL | fReserved
 | ) |  |

Definition at line 255 of file ToolBand.Cpp.

{
/*
This method is never called for Band Objects.
*/
return E_NOTIMPL;
}

STDMETHODIMP CToolBand::Save | ( | LPSTREAM | pStream,
 |  | BOOL | fClearDirty
 | ) |  |

Definition at line 498 of file ToolBand.Cpp.

{
return S_OK;
}

STDMETHODIMP CToolBand::SetSite ( IUnknown * punkSite )

Definition at line 325 of file ToolBand.Cpp.

{
//If a site is being held, release it.
if(m_pSite)
   {
   m_pSite->Release();
   m_pSite = NULL;
   }

//If punkSite is not NULL, a new site is being set.
if(punkSite)
   {
   //Get the parent window.
   IOleWindow  *pOleWindow;

   m_hwndParent = NULL;

   if(SUCCEEDED(punkSite->QueryInterface(IID_IOleWindow, (LPVOID*)&pOleWindow)))
      {
      pOleWindow->GetWindow(&m_hwndParent);
      pOleWindow->Release();
      }

   if(!m_hwndParent)
      return E_FAIL;

   if(!RegisterAndCreateWindow())
      return E_FAIL;

   //Get and keep the IInputObjectSite pointer.
   if(SUCCEEDED(punkSite->QueryInterface(IID_IInputObjectSite, (LPVOID*)&m_pSite)))
      {
      return S_OK;
      }

   return E_FAIL;
   }

return S_OK;
}

STDMETHODIMP CToolBand::ShowDW ( BOOL fShow )

Definition at line 212 of file ToolBand.Cpp.

{
if(m_hWnd)
   {
   if(fShow)
      {
      //show our window
      ShowWindow(m_hWnd, SW_SHOW);
      }
   else
      {
      //hide our window
      ShowWindow(m_hWnd, SW_HIDE);
      }
   }

return S_OK;
}

CToolBand::STDMETHODIMP_ ( DWORD )
CToolBand::STDMETHODIMP_ ( DWORD )
STDMETHODIMP CToolBand::TranslateAcceleratorIO ( LPMSG pMsg )

Definition at line 309 of file ToolBand.Cpp.

{
return S_FALSE;
}

STDMETHODIMP CToolBand::UIActivateIO | ( | BOOL | fActivate,
 |  | LPMSG | pMsg
 | ) |  |

Definition at line 276 of file ToolBand.Cpp.

{
if(fActivate)
   SetFocus(m_hWnd);

return S_OK;
}

LRESULT CALLBACK CToolBand::WndProc | ( | HWND | hWnd,
 |  | UINT | uMessage,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static, private]

Definition at line 525 of file ToolBand.Cpp.

{
CToolBand  *pThis = (CToolBand*)GetWindowLongPtr(hWnd, GWLP_USERDATA);

switch (uMessage)
   {
   case WM_NCCREATE:
      {
      LPCREATESTRUCT lpcs = (LPCREATESTRUCT)lParam;
      pThis = (CToolBand*)(lpcs->lpCreateParams);
      SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)pThis);

      //set the window handle
      pThis->m_hWnd = hWnd;
      }
      break;

   case WM_PAINT:
      return pThis->OnPaint();

   case WM_COMMAND:
      return pThis->OnCommand(wParam, lParam);

   case WM_SETFOCUS:
      return pThis->OnSetFocus();

   case WM_KILLFOCUS:
      return pThis->OnKillFocus();

   case WM_SIZE:
      return pThis->OnSize(lParam);
   }

return DefWindowProc(hWnd, uMessage, wParam, lParam);
}

Member Data Documentation

BOOL CToolBand::m_bFocus [private]

Definition at line 92 of file ToolBand.h.

DWORD CToolBand::m_dwBandID [private]

Definition at line 96 of file ToolBand.h.

DWORD CToolBand::m_dwViewMode [private]

Definition at line 95 of file ToolBand.h.

HWND CToolBand::m_hWnd [private]

Definition at line 94 of file ToolBand.h.

HWND CToolBand::m_hwndParent [private]

Definition at line 93 of file ToolBand.h.

DWORD CToolBand::m_ObjRefCount [protected]

Definition at line 52 of file ToolBand.h.

IInputObjectSite* CToolBand::m_pSite [private]

Definition at line 97 of file ToolBand.h.

The documentation for this class was generated from the following files:
  • WinUI/Shell/BandObjs/ToolBand.h
  • WinUI/Shell/BandObjs/ToolBand.Cpp
Generated on Wed Nov 13 2024 16:57:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CToolBarExtension Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes

CToolBarExtension Class Reference

#include "tbarext.h"

List of all members.

Public Member Functions

CToolBarExtension ()
~CToolBarExtension ()
virtual HRESULT STDMETHODCALLTYPE | ControlbarNotify (MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)
IToolbar * | getToolbar ()
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID *ppv)
virtual HRESULT STDMETHODCALLTYPE | SetControlbar (LPCONTROLBAR pControlbar)
STDMETHODIMP_ (ULONG) Release()
STDMETHODIMP_ (ULONG) AddRef()

Private Types

enum | STATUS { RUNNING, PAUSED, STOPPED }

Private Member Functions

HRESULT | ExtractData (IDataObject *piDataObject, CLIPFORMAT cfClipFormat, BYTE *pbData, DWORD cbData)
HRESULT | ExtractObjectTypeGUID (IDataObject *piDataObject, GUID *pguidObjectType)
HRESULT | ExtractSnapInCLSID (IDataObject *piDataObject, CLSID *pclsidSnapin)
HRESULT | ExtractString (IDataObject *piDataObject, CLIPFORMAT cfClipFormat, WCHAR *pstr, DWORD cchMaxLength)
HRESULT | SetToolbarButtons (STATUS iVehicleStatus)

Private Attributes

enum CToolBarExtension::STATUS | iStatus
ULONG m_cref
IControlbar * | m_ipControlBar
IToolbar * | m_ipToolbar

Static Private Attributes

static UINT | s_cfDisplayName = RegisterClipboardFormat(_T_CCF_DISPLAY_NAME)
static UINT | s_cfNodeType = RegisterClipboardFormat(_T_CCF_NODETYPE)
static UINT | s_cfSnapInCLSID = RegisterClipboardFormat(_T_CCF_SNAPIN_CLASSID)

Detailed Description

Definition at line 26 of file tbarext.h.

Member Enumeration Documentation

enum CToolBarExtension::STATUS [private]
Enumerator:
RUNNING
PAUSED
STOPPED

Definition at line 35 of file tbarext.h.

{RUNNING, PAUSED, STOPPED} iStatus;

Constructor & Destructor Documentation

CToolBarExtension::CToolBarExtension ( )

Definition at line 45 of file tbarext.Cpp.

                                     : m_cref(0), m_ipControlBar(NULL),
                     m_ipToolbar(NULL)
{
    OBJECT_CREATED
}

CToolBarExtension::~CToolBarExtension ( )

Definition at line 51 of file tbarext.Cpp.

{
    OBJECT_DESTROYED
}

Member Function Documentation

HRESULT CToolBarExtension::ControlbarNotify | ( | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param |
 | ) |  |  | [virtual]

Definition at line 214 of file tbarext.Cpp.

{

    _TCHAR pszMsg[255];

  BYTE *pbVehicleStatus = NULL;

  HRESULT hr = S_OK;

    if (event == MMCN_SELECT) {

    BOOL bScope = (BOOL) LOWORD(arg);
        BOOL bSelect = (BOOL) HIWORD(arg);

    if (bSelect) {

      // Always make sure the toolbar is attached
      hr = m_ipControlBar->Attach(TOOLBAR, m_ipToolbar);

      // Set button states

      //fake value to set toolbar button states
      iStatus = RUNNING;
      SetToolbarButtons(iStatus);

    } else {
      // Always make sure the toolbar is detached
      hr = m_ipControlBar->Detach(m_ipToolbar);
    }

    } else if (event == MMCN_BTN_CLICK) {
    //the arg parameter contains the data object from the primary
    //snap-in. Use it to get the display name of the currently selected item
        WCHAR pszName[255];
    HRESULT hr = ExtractString(reinterpret_cast<IDataObject *>(arg), s_cfDisplayName, pszName, sizeof(pszName));
        MAKE_TSTRPTR_FROMWIDE(ptrname, pszName);

    switch ((int)param)
    {
    case ID_BUTTONSTART:
      iStatus = RUNNING;
      break;

    case ID_BUTTONPAUSE:
      iStatus = PAUSED;
      break;

    case ID_BUTTONSTOP:
      iStatus = STOPPED;
      break;
    }

    _stprintf(pszMsg, _T("%s selected and extension button %s pressed"), ptrname,
      (long)param == ID_BUTTONSTART ? _T("1") :
    (long)param == ID_BUTTONPAUSE ? _T("2") :
    (long)param == ID_BUTTONSTOP ? _T("3") : _T("!!!unknown command!!!"));

        ::MessageBox(NULL, pszMsg, _T("Messagebox from Toolbar Extension"), MB_OK|MB_ICONEXCLAMATION);

    //Reset toolbar button states
    SetToolbarButtons(iStatus);

    }

    return hr;
}

HRESULT CToolBarExtension::ExtractData | ( | IDataObject * | piDataObject,
 |  | CLIPFORMAT | cfClipFormat,
 |  | BYTE * | pbData,
 |  | DWORD | cbData |
 | ) |  |  | [private]

Definition at line 98 of file tbarext.Cpp.

{
    HRESULT hr = S_OK;

    FORMATETC formatetc = {cfClipFormat, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL};
    STGMEDIUM stgmedium = {TYMED_HGLOBAL, NULL};

    stgmedium.hGlobal = ::GlobalAlloc(GPTR, cbData);
    do // false loop
    {
        if (NULL == stgmedium.hGlobal)
        {
            hr = E_OUTOFMEMORY;
            break;
        }
        hr = piDataObject->GetDataHere( &formatetc, &stgmedium );
        if ( FAILED(hr) )
        {
            break;
        }

        BYTE* pbNewData = reinterpret_cast<BYTE*>(stgmedium.hGlobal);
        if (NULL == pbNewData)
        {
            hr = E_UNEXPECTED;
            break;
        }
        ::memcpy( pbData, pbNewData, cbData );
    } while (FALSE); // false loop

    if (NULL != stgmedium.hGlobal)
    {
        ::GlobalFree(stgmedium.hGlobal);
    }
    return hr;
} // ExtractData()

HRESULT CToolBarExtension::ExtractObjectTypeGUID | ( | IDataObject * | piDataObject,
 |  | GUID * | pguidObjectType |
 | ) |  |  | [private]

Definition at line 151 of file tbarext.Cpp.

{
    return ExtractData( piDataObject, s_cfNodeType, (PBYTE)pguidObjectType, sizeof(GUID) );
}

HRESULT CToolBarExtension::ExtractSnapInCLSID | ( | IDataObject * | piDataObject,
 |  | CLSID * | pclsidSnapin |
 | ) |  |  | [private]

Definition at line 146 of file tbarext.Cpp.

{
    return ExtractData( piDataObject, s_cfSnapInCLSID, (PBYTE)pclsidSnapin, sizeof(CLSID) );
}

HRESULT CToolBarExtension::ExtractString | ( | IDataObject * | piDataObject,
 |  | CLIPFORMAT | cfClipFormat,
 |  | WCHAR * | pstr,
 |  | DWORD | cchMaxLength |
 | ) |  |  | [private]

Definition at line 138 of file tbarext.Cpp.

{
    return ExtractData( piDataObject, cfClipFormat, (PBYTE)pstr, cchMaxLength );
}

IToolbar* CToolBarExtension::getToolbar ( ) [inline]

Definition at line 72 of file tbarext.h.

{ return m_ipToolbar; }

STDMETHODIMP CToolBarExtension::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 60 of file tbarext.Cpp.

{
    if (!ppv)
        return E_FAIL;

    *ppv = NULL;

    if (IsEqualIID(riid, IID_IUnknown))
        *ppv = static_cast<IExtendControlbar *>(this);
    else if (IsEqualIID(riid, IID_IExtendControlbar))
        *ppv = static_cast<IExtendControlbar *>(this);

    if (*ppv)
    {
        reinterpret_cast<IUnknown *>(*ppv)->AddRef();
        return S_OK;
    }

    return E_NOINTERFACE;
}

HRESULT CToolBarExtension::SetControlbar ( LPCONTROLBAR pControlbar ) [virtual]

Definition at line 166 of file tbarext.Cpp.

{
    HRESULT hr = S_OK;

  //
    //  Clean up
    //

    // if we've got a cached toolbar, release it
    if (m_ipToolbar) {
        m_ipToolbar->Release();
        m_ipToolbar = NULL;
    }

    // if we've got a cached control bar, release it
    if (m_ipControlBar) {
        m_ipControlBar->Release();
        m_ipControlBar = NULL;
    }

    //
    // Install new pieces if necessary
    //

    // if a new one came in, cache and AddRef
    if (pControlbar) {
        m_ipControlBar = pControlbar;
        m_ipControlBar->AddRef();

        hr = m_ipControlBar->Create(TOOLBAR,  // type of control to be created
            dynamic_cast<IExtendControlbar *>(this),
            reinterpret_cast<IUnknown **>(&m_ipToolbar));
        _ASSERT(SUCCEEDED(hr));

        // add the bitmap to the toolbar
        HBITMAP hbmp = LoadBitmap(g_hinst, MAKEINTRESOURCE(IDR_TOOLBAR1));
        hr = m_ipToolbar->AddBitmap(3, hbmp, 16, 16, RGB(0, 128, 128)); // NOTE, hardcoded value 3
        _ASSERT(SUCCEEDED(hr));

        // Add the buttons to the toolbar
        hr = m_ipToolbar->AddButtons(ARRAYLEN(SnapinButtons1), SnapinButtons1);
        _ASSERT(SUCCEEDED(hr));
    }

    return hr;
}

HRESULT CToolBarExtension::SetToolbarButtons ( STATUS iVehicleStatus ) [private]

Definition at line 286 of file tbarext.Cpp.

{

  HRESULT hr = S_OK;

  switch (iVehicleStatus)
  {
  case RUNNING:
    m_ipToolbar->SetButtonState(ID_BUTTONSTART, BUTTONPRESSED, TRUE);
    m_ipToolbar->SetButtonState(ID_BUTTONSTART, ENABLED, FALSE);
    m_ipToolbar->SetButtonState(ID_BUTTONPAUSE, BUTTONPRESSED, FALSE);
    m_ipToolbar->SetButtonState(ID_BUTTONPAUSE, ENABLED, TRUE);
    m_ipToolbar->SetButtonState(ID_BUTTONSTOP, BUTTONPRESSED, FALSE);
    m_ipToolbar->SetButtonState(ID_BUTTONSTOP, ENABLED, TRUE);
    break;

  case PAUSED:
    m_ipToolbar->SetButtonState(ID_BUTTONSTART, BUTTONPRESSED, FALSE);
    m_ipToolbar->SetButtonState(ID_BUTTONSTART, ENABLED, TRUE);
    m_ipToolbar->SetButtonState(ID_BUTTONPAUSE, BUTTONPRESSED, TRUE);
    m_ipToolbar->SetButtonState(ID_BUTTONPAUSE, ENABLED, FALSE);
    m_ipToolbar->SetButtonState(ID_BUTTONSTOP, BUTTONPRESSED, FALSE);
    m_ipToolbar->SetButtonState(ID_BUTTONSTOP, ENABLED, TRUE);
    break;

  case STOPPED:
    m_ipToolbar->SetButtonState(ID_BUTTONSTART, BUTTONPRESSED, FALSE);
    m_ipToolbar->SetButtonState(ID_BUTTONSTART, ENABLED, TRUE);
    m_ipToolbar->SetButtonState(ID_BUTTONPAUSE, BUTTONPRESSED, FALSE);
    m_ipToolbar->SetButtonState(ID_BUTTONPAUSE, ENABLED, TRUE);
    m_ipToolbar->SetButtonState(ID_BUTTONSTOP, BUTTONPRESSED, TRUE);
    m_ipToolbar->SetButtonState(ID_BUTTONSTOP, ENABLED, FALSE);
    break;
  }

  return hr;
}

CToolBarExtension::STDMETHODIMP_ ( ULONG )
CToolBarExtension::STDMETHODIMP_ ( ULONG )

Member Data Documentation

enum CToolBarExtension::STATUS CToolBarExtension::iStatus [private]
ULONG CToolBarExtension::m_cref [private]

Definition at line 30 of file tbarext.h.

IControlbar* CToolBarExtension::m_ipControlBar [private]

Definition at line 32 of file tbarext.h.

IToolbar* CToolBarExtension::m_ipToolbar [private]

Definition at line 33 of file tbarext.h.

UINT CToolBarExtension::s_cfDisplayName = RegisterClipboardFormat(_T_CCF_DISPLAY_NAME) [static, private]

Definition at line 45 of file tbarext.h.

UINT CToolBarExtension::s_cfNodeType = RegisterClipboardFormat(_T_CCF_NODETYPE) [static, private]

Definition at line 47 of file tbarext.h.

UINT CToolBarExtension::s_cfSnapInCLSID = RegisterClipboardFormat(_T_CCF_SNAPIN_CLASSID) [static, private]

Definition at line 46 of file tbarext.h.

The documentation for this class was generated from the following files:
  • SysMgmt/MMC/Tbarext/tbarext.h
  • SysMgmt/MMC/Tbarext/tbarext.Cpp
Generated on Wed Nov 13 2024 16:57:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CToolBarLite Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CToolBarLite Class Reference

#include "cdialoglite.h"

Inherits CWndLite.

List of all members.

Public Member Functions

CToolBarLite ()
virtual | ~CToolBarLite ()
virtual BOOL | Create (HWND hWndParent, UINT nID, UINT nBitmapID, UINT cButtons, TBBUTTON *rgButtons, DWORD dwStyle=WS_CHILD|WS_VISIBLE|TBSTYLE_TOOLTIPS)
virtual BOOL | EnableButton (UINT nID, bool fEnable)

Detailed Description

Definition at line 905 of file cdialoglite.h.

Constructor & Destructor Documentation

CToolBarLite::CToolBarLite ( )

Definition at line 3782 of file cdialoglite.cpp.

{
}

CToolBarLite::~CToolBarLite ( ) [virtual]

Definition at line 3791 of file cdialoglite.cpp.

{
}

Member Function Documentation

BOOL CToolBarLite::Create | ( | HWND | hWndParent,
 |  | UINT | nID,
 |  | UINT | nBitmapID,
 |  | UINT | cButtons,
 |  | TBBUTTON * | rgButtons,
 |  | DWORD | dwStyle = WS_CHILD | WS_VISIBLE | TBSTYLE_TOOLTIPS |
 | ) |  |  | [virtual]

Definition at line 3800 of file cdialoglite.cpp.

{
  ASSERT(IsDestroyed());
  m_hWndParent = hWndParent;
  HINSTANCE hInstance = GetAppLite()->m_hInstance;

  //Create ToolBar
  m_hWnd = CreateToolbarEx(
    hWndParent,       // parent
    dwStyle,
    nID,          // toolbar id
    3,                      // number of bitmaps
    hInstance,              // mod instance
    nBitmapID,        // resource ID for bitmap
    rgButtons,        // address of buttons
    cButtons,       // number of buttons
    16,16,                  // width & height of buttons
    16,16,                  // width & height of bitmaps
    sizeof(TBBUTTON));      // structure size

    //Create ToolTips
    HWND hWndTT = (HWND)SendMessage(m_hWnd, TB_GETTOOLTIPS, 0, 0);
  if(hWndTT)
    {
      TOOLINFOA toolInfo;
    memset(&toolInfo, 0, sizeof(TOOLINFO));
        toolInfo.cbSize   = sizeof(TOOLINFO);
        toolInfo.uFlags   = TTF_CENTERTIP;
        toolInfo.hwnd   = m_hWnd;
        toolInfo.uId    = (UINT)ID_TOOLBAR;
        toolInfo.hinst    = hInstance;
        toolInfo.lpszText = (LPSTR)LPSTR_TEXTCALLBACKA;

        // Set up the ToolTips
        SendMessage(hWndTT, TTM_ADDTOOLA, 0, (LPARAM)&toolInfo);
  }
  return m_hWnd != NULL;
}

virtual BOOL CToolBarLite::EnableButton | ( | UINT | nID,
 |  | bool | fEnable |
 | ) |  |  | [inline, virtual]

Definition at line 915 of file cdialoglite.h.

{ return (BOOL)SendMessage(m_hWnd, TB_ENABLEBUTTON, nID, fEnable);        }

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialoglite.h
  • Dataaccess/oledb/rowsetviewer/cdialoglite.cpp
Generated on Wed Nov 13 2024 16:57:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CTransaction Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CTransaction Class Reference

#include "ctransaction.h"

Inherits CContainerBase.

List of all members.

Public Member Functions

CTransaction (CMainWindow *pCMainWindow, CMDIChild *pCMDIChild=NULL)
virtual | ~CTransaction ()
virtual HRESULT | AutoQI (DWORD dwCreateOpts)
virtual HRESULT | AutoRelease ()
virtual REFIID | GetDefaultInterface ()
virtual IUnknown ** | GetInterfaceAddress (REFIID riid)
virtual LONG | GetObjectImage ()
virtual UINT | GetObjectMenu ()
virtual WCHAR * | GetObjectName ()

Public Attributes

DWORD m_dwCookieTransNotify
ITransaction * | m_pITransaction

Detailed Description

Definition at line 26 of file ctransaction.h.

Constructor & Destructor Documentation

CTransaction::CTransaction | ( | CMainWindow * | pCMainWindow,
 |  | CMDIChild * | pCMDIChild = NULL
 | ) |  |

Definition at line 22 of file ctransaction.cpp.

  : CContainerBase(eCTransaction, pCMainWindow, pCMDIChild)
{
  //OLE DB Interfaces
  m_pITransaction       = NULL;   //Transaction interface

  //Extra interfaces
  m_dwCookieTransNotify   = 0;
}

CTransaction::~CTransaction ( ) [virtual]

Definition at line 36 of file ctransaction.cpp.

{
  ReleaseObject(0);
}

Member Function Documentation

HRESULT CTransaction::AutoQI ( DWORD dwCreateOpts ) [virtual]

Reimplemented from CContainerBase.

Definition at line 73 of file ctransaction.cpp.

{
  //Delegate First so we have base interfaces
  CContainerBase::AutoQI(dwCreateOpts);

  //[MANDATORY]
  if(dwCreateOpts & CREATE_QI_MANDATORY)
  {
    OBTAIN_INTERFACE(ITransaction);
  }

  //Auto QI
  if(dwCreateOpts & CREATE_QI_OPTIONAL)
  {
  }

  return S_OK;
}

HRESULT CTransaction::AutoRelease ( ) [virtual]

Reimplemented from CContainerBase.

Definition at line 59 of file ctransaction.cpp.

{
  //DataSource interfaces
  RELEASE_INTERFACE(ITransaction);

  //Delegate
  return CContainerBase::AutoRelease();
}

virtual REFIID CTransaction::GetDefaultInterface ( ) [inline, virtual]

Implements CBase.

Definition at line 42 of file ctransaction.h.

{ return IID_ITransaction;    }

IUnknown ** CTransaction::GetInterfaceAddress ( REFIID riid ) [virtual]

Reimplemented from CContainerBase.

Definition at line 46 of file ctransaction.cpp.

{
  HANDLE_GETINTERFACE(ITransaction);

  //Otherwise delegate
  return CContainerBase::GetInterfaceAddress(riid);
}

virtual LONG CTransaction::GetObjectImage ( ) [inline, virtual]

Implements CBase.

Definition at line 41 of file ctransaction.h.

{ return IMAGE_FORM;      }

virtual UINT CTransaction::GetObjectMenu ( ) [inline, virtual]

Implements CBase.

Definition at line 40 of file ctransaction.h.

{ return IDM_TRANSACTIONMENU; }

virtual WCHAR* CTransaction::GetObjectName ( ) [inline, virtual]

Implements CBase.

Definition at line 39 of file ctransaction.h.

{ return L"Transaction";    }

Member Data Documentation

DWORD CTransaction::m_dwCookieTransNotify

Definition at line 55 of file ctransaction.h.

ITransaction* CTransaction::m_pITransaction

Definition at line 50 of file ctransaction.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/ctransaction.h
  • Dataaccess/oledb/rowsetviewer/ctransaction.cpp
Generated on Wed Nov 13 2024 16:57:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CTransactionOptions Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CTransactionOptions Class Reference

#include "ctransaction.h"

Inherits CBase.

List of all members.

Public Member Functions

CTransactionOptions (CMainWindow *pCMainWindow, CMDIChild *pCMDIChild=NULL)
virtual | ~CTransactionOptions ()
virtual HRESULT | AutoQI (DWORD dwCreateOpts)
virtual HRESULT | AutoRelease ()
virtual REFIID | GetDefaultInterface ()
virtual IUnknown ** | GetInterfaceAddress (REFIID riid)
virtual LONG | GetObjectImage ()
virtual UINT | GetObjectMenu ()
virtual WCHAR * | GetObjectName ()

Public Attributes

ITransactionOptions * | m_pITransactionOptions

Detailed Description

Definition at line 64 of file ctransaction.h.

Constructor & Destructor Documentation

CTransactionOptions::CTransactionOptions | ( | CMainWindow * | pCMainWindow,
 |  | CMDIChild * | pCMDIChild = NULL
 | ) |  |

Definition at line 99 of file ctransaction.cpp.

  : CBase(eCTransactionOptions, pCMainWindow, pCMDIChild)
{
  //OLE DB Interfaces
  m_pITransactionOptions    = NULL;   //TransactionOptions interface
}

CTransactionOptions::~CTransactionOptions ( ) [virtual]

Definition at line 110 of file ctransaction.cpp.

{
  ReleaseObject(0);
}

Member Function Documentation

HRESULT CTransactionOptions::AutoQI ( DWORD dwCreateOpts ) [virtual]

Implements CBase.

Definition at line 147 of file ctransaction.cpp.

{
  //Delegate First so we have base interfaces
  CBase::AutoQI(dwCreateOpts);

  //[MANDATORY]
  if(dwCreateOpts & CREATE_QI_MANDATORY)
  {
    OBTAIN_INTERFACE(ITransactionOptions);
  }

  //Auto QI
  if(dwCreateOpts & CREATE_QI_OPTIONAL)
  {
  }

  return S_OK;
}

HRESULT CTransactionOptions::AutoRelease ( ) [virtual]

Implements CBase.

Definition at line 133 of file ctransaction.cpp.

{
  //Interfaces
  RELEASE_INTERFACE(ITransactionOptions);

  //Delegate
  return CBase::AutoRelease();
}

virtual REFIID CTransactionOptions::GetDefaultInterface ( ) [inline, virtual]

Implements CBase.

Definition at line 80 of file ctransaction.h.

{ return IID_ITransactionOptions;   }

IUnknown ** CTransactionOptions::GetInterfaceAddress ( REFIID riid ) [virtual]

Implements CBase.

Definition at line 120 of file ctransaction.cpp.

{
  HANDLE_GETINTERFACE(ITransactionOptions);

  //Otherwise delegate
  return CBase::GetInterfaceAddress(riid);
}

virtual LONG CTransactionOptions::GetObjectImage ( ) [inline, virtual]

Implements CBase.

Definition at line 79 of file ctransaction.h.

{ return IMAGE_FORM;          }

virtual UINT CTransactionOptions::GetObjectMenu ( ) [inline, virtual]

Implements CBase.

Definition at line 78 of file ctransaction.h.

{ return IDM_TRANSACTIONOPTIONSMENU;  }

virtual WCHAR* CTransactionOptions::GetObjectName ( ) [inline, virtual]

Implements CBase.

Definition at line 77 of file ctransaction.h.

{ return L"TransactionOptions";     }

Member Data Documentation

ITransactionOptions* CTransactionOptions::m_pITransactionOptions

Definition at line 88 of file ctransaction.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/ctransaction.h
  • Dataaccess/oledb/rowsetviewer/ctransaction.cpp
Generated on Wed Nov 13 2024 16:57:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CTreeViewLite Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CTreeViewLite Class Reference

#include "cdialoglite.h"

Inherits CSplitterLite.

Inherited by CObjTree.

List of all members.

Public Member Functions

CTreeViewLite (HWND hWndParent=NULL, UINT nID=0)
virtual | ~CTreeViewLite ()
BOOL DeleteAllItems ()
BOOL | DeleteItem (HTREEITEM hItem)
BOOL | EnsureVisible (HTREEITEM hItem)
BOOL | Expand (HTREEITEM hItem, UINT flag=TVE_EXPAND)
HTREEITEM | GetChildItem (HTREEITEM hItem)
LPARAM | GetItemParam (HTREEITEM hItem)
HTREEITEM | GetNextItem (HTREEITEM hItem, UINT nCode=TVGN_NEXT)
HTREEITEM | GetParentItem (HTREEITEM hItem)
HTREEITEM | GetSelectedItem ()
HTREEITEM | HitTest (REFPOINTS pts, UINT *pFlags=NULL, BOOL fClientCoords=TRUE)
HTREEITEM | InsertItem (HTREEITEM hParent, HTREEITEM hInsAfter, WCHAR *wszName, LPARAM lParam=PARAM_NONE, INT iImage=IMAGE_NONE, INT iSelectedImage=IMAGE_NONE, UINT iState=IMAGE_NONE, UINT iStateMask=IMAGE_NONE)
virtual BOOL | OnBeginDrag (INT idCtrl, NMTREEVIEW *pNMTreeView)
virtual BOOL | OnBeginLabelEdit (INT idCtrl, NMTVDISPINFO *ptvdi)
virtual BOOL | OnCreate (CREATESTRUCT *pCREATESTRUCT)
virtual BOOL | OnEndLabelEdit (INT idCtrl, NMTVDISPINFO *ptvdi)
virtual BOOL | OnLButtonUp (WPARAM fwKeys, REFPOINTS pts)
virtual BOOL | OnMouseMove (WPARAM nHittest, REFPOINTS pts)
virtual BOOL | OnNotify (INT idCtrl, NMHDR *pNMHDR)
virtual BOOL | OnSelChanged (INT idCtrl, NMTREEVIEW *pNMTreeView)
BOOL | SelectItem (HTREEITEM hItem)
BOOL | SetItemImage (HTREEITEM hItem, INT iImage, INT iSelectedImage)
BOOL | SetItemParam (HTREEITEM hItem, LPARAM lParam)
BOOL | SetItemState (HTREEITEM hItem, UINT iState, UINT iStateMask)
BOOL | SetItemText (HTREEITEM hItem, WCHAR *pwszText)

Protected Attributes

HTREEITEM | m_hDraggingItem

Detailed Description

Definition at line 750 of file cdialoglite.h.

Constructor & Destructor Documentation

CTreeViewLite::CTreeViewLite | ( | HWND | hWndParent = NULL,
 |  | UINT | nID = 0
 | ) |  |

Definition at line 3195 of file cdialoglite.cpp.

  : CSplitterLite(hWndParent, nID)
{
  m_hDraggingItem = NULL;
}

CTreeViewLite::~CTreeViewLite ( ) [virtual]

Definition at line 3206 of file cdialoglite.cpp.

{
}

Member Function Documentation

BOOL CTreeViewLite::DeleteAllItems ( ) [inline]

Definition at line 771 of file cdialoglite.h.

{ ASSERT(IsWindow(m_hWnd));   return (BOOL)SendMessage(m_hWnd, TVM_DELETEITEM, 0, (LPARAM)TVI_ROOT);        }

BOOL CTreeViewLite::DeleteItem ( HTREEITEM hItem ) [inline]

Definition at line 775 of file cdialoglite.h.

{ ASSERT(IsWindow(m_hWnd));   return (BOOL)SendMessage(m_hWnd, TVM_DELETEITEM, 0, (LPARAM)hItem);         }

BOOL CTreeViewLite::EnsureVisible ( HTREEITEM hItem ) [inline]

Definition at line 776 of file cdialoglite.h.

{ ASSERT(IsWindow(m_hWnd));   return (BOOL)SendMessage(m_hWnd, TVM_ENSUREVISIBLE, 0, (LPARAM)hItem);        }

BOOL CTreeViewLite::Expand | ( | HTREEITEM | hItem,
 |  | UINT | flag = TVE_EXPAND |
 | ) |  |  | [inline]

Definition at line 777 of file cdialoglite.h.

{ ASSERT(IsWindow(m_hWnd));   return (BOOL)SendMessage(m_hWnd, TVM_EXPAND, flag, (LPARAM)hItem);          }

HTREEITEM CTreeViewLite::GetChildItem ( HTREEITEM hItem ) [inline]

Definition at line 773 of file cdialoglite.h.

{ ASSERT(IsWindow(m_hWnd));   return (HTREEITEM)SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)hItem);  }

LPARAM CTreeViewLite::GetItemParam ( HTREEITEM hItem )

Definition at line 3362 of file cdialoglite.cpp.

{
  return TV_GetItemParam(m_hWnd, hTreeItem);
}

HTREEITEM CTreeViewLite::GetNextItem | ( | HTREEITEM | hItem,
 |  | UINT | nCode = TVGN_NEXT |
 | ) |  |  | [inline]

Definition at line 772 of file cdialoglite.h.

{ ASSERT(IsWindow(m_hWnd));   return (HTREEITEM)SendMessage(m_hWnd, TVM_GETNEXTITEM, nCode, (LPARAM)hItem);   }

HTREEITEM CTreeViewLite::GetParentItem ( HTREEITEM hItem ) [inline]

Definition at line 774 of file cdialoglite.h.

{ ASSERT(IsWindow(m_hWnd));   return (HTREEITEM)SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_PARENT, (LPARAM)hItem); }

HTREEITEM CTreeViewLite::GetSelectedItem ( ) [inline]

Definition at line 770 of file cdialoglite.h.

{ ASSERT(IsWindow(m_hWnd));   return (HTREEITEM)SendMessage(m_hWnd, TVM_GETNEXTITEM, TVGN_CARET, 0);        }

HTREEITEM CTreeViewLite::HitTest | ( | REFPOINTS | pts,
 |  | UINT * | pFlags = NULL,
 |  | BOOL | fClientCoords = TRUE
 | ) |  |

Definition at line 3440 of file cdialoglite.cpp.

{
  TVHITTESTINFO tvHitInfo = {{pts.x, pts.y}, 0, NULL};
  if(!fClientCoords)
    ScreenToClient(m_hWnd, &tvHitInfo.pt);

  //TVM_HITTEST
  HTREEITEM hItem = (HTREEITEM)SendMessage(m_hWnd, TVM_HITTEST, 0, (LPARAM)&tvHitInfo);
  if(pFlags)
    *pFlags = tvHitInfo.flags;

  return hItem;
}

HTREEITEM CTreeViewLite::InsertItem | ( | HTREEITEM | hParent,
 |  | HTREEITEM | hInsAfter,
 |  | WCHAR * | wszName,
 |  | LPARAM | lParam = PARAM_NONE,
 |  | INT | iImage = IMAGE_NONE,
 |  | INT | iSelectedImage = IMAGE_NONE,
 |  | UINT | iState = IMAGE_NONE,
 |  | UINT | iStateMask = IMAGE_NONE
 | ) |  |

Definition at line 3430 of file cdialoglite.cpp.

{
  return TV_InsertItem(m_hWnd, hParent, hInsAfter, wszName, lParam, iImage, iSelectedImage, iState, iStateMask);
}

BOOL CTreeViewLite::OnBeginDrag | ( | INT | idCtrl,
 |  | NMTREEVIEW * | pNMTreeView |
 | ) |  |  | [virtual]

Definition at line 3278 of file cdialoglite.cpp.

{
    //Tell the TreeView control to create an image to use for dragging.
  HTREEITEM hItem = pNMTreeView->itemNew.hItem;
    HIMAGELIST hImageList = TreeView_CreateDragImage(m_hWnd, hItem);

  RECT rect;
  TreeView_GetItemRect(m_hWnd, pNMTreeView->itemNew.hItem, &rect, FALSE);
  m_hDraggingItem = hItem;

  //Start the drag operation.
  ULONG level = 0;

  do
  {
    hItem = TreeView_GetParent(m_hWnd, hItem);
    level++;
  }
  while(hItem);

  LONG xIndent = TreeView_GetIndent( m_hWnd ) * level;
    ImageList_BeginDrag(hImageList, 0,  pNMTreeView->ptDrag.x - rect.left - xIndent,  pNMTreeView->ptDrag.y - rect.top);

  //Hide the mouse cursor, and direct mouse input to the parent window.
    ShowCursor( FALSE );
  SetCapture(m_hWnd);

  ImageList_DragEnter(m_hWnd, pNMTreeView->ptDrag.x - rect.left - xIndent, pNMTreeView->ptDrag.y);
  return TRUE;
}

BOOL CTreeViewLite::OnBeginLabelEdit | ( | INT | idCtrl,
 |  | NMTVDISPINFO * | ptvdi |
 | ) |  |  | [virtual]

Definition at line 3258 of file cdialoglite.cpp.

{
  return FALSE;
}

BOOL CTreeViewLite::OnCreate ( CREATESTRUCT * pCREATESTRUCT ) [virtual]

Reimplemented from CWndLite.

Definition at line 3215 of file cdialoglite.cpp.

{
  //SubClass the window
  SubClassWindow(WndProc);

  //Delegate
  return CSplitterLite::OnCreate(pCREATESTRUCT);
}

BOOL CTreeViewLite::OnEndLabelEdit | ( | INT | idCtrl,
 |  | NMTVDISPINFO * | ptvdi |
 | ) |  |  | [virtual]

Definition at line 3268 of file cdialoglite.cpp.

{
  return FALSE;
}

BOOL CTreeViewLite::OnLButtonUp | ( | WPARAM | fwKeys,
 |  | REFPOINTS | pts |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 3339 of file cdialoglite.cpp.

{
  if(m_hDraggingItem)
  {
    //End the Drag
    ImageList_EndDrag();
    ReleaseCapture();
    ShowCursor(TRUE);
    ImageList_DragLeave( m_hWnd );
    TreeView_SelectDropTarget(m_hWnd, NULL);

    m_hDraggingItem = NULL;
    return TRUE;
  }

  return FALSE;
}

BOOL CTreeViewLite::OnMouseMove | ( | WPARAM | nHittest,
 |  | REFPOINTS | pts |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 3314 of file cdialoglite.cpp.

{
  if(m_hDraggingItem)
  {
    ImageList_DragMove(pts.x, pts.y);

    //If the cursor is on an item, hilite it as the drop target
    HTREEITEM hItem = HitTest(pts);
    if(hItem)
    {
      ImageList_DragLeave( m_hWnd );
      TreeView_SelectDropTarget(m_hWnd, hItem);
      ImageList_DragEnter( m_hWnd, pts.x, pts.y);
    }
    return TRUE;
  }

  return FALSE;
}

BOOL CTreeViewLite::OnNotify | ( | INT | idCtrl,
 |  | NMHDR * | pNMHDR |
 | ) |  |  | [virtual]

Reimplemented from CWndLite.

Definition at line 3229 of file cdialoglite.cpp.

{
  switch(pNMHDR->code)
  {
    ON_COMMAND(TVN_SELCHANGED,    OnSelChanged(idCtrl, (NMTREEVIEW*)pNMHDR));
    ON_COMMAND(TVN_BEGINLABELEDIT,  OnBeginLabelEdit(idCtrl, (NMTVDISPINFO*)pNMHDR));
    ON_COMMAND(TVN_ENDLABELEDIT,  OnEndLabelEdit(idCtrl, (NMTVDISPINFO*)pNMHDR));
    ON_COMMAND(TVN_BEGINDRAG,   OnBeginDrag(idCtrl, (NMTREEVIEW*)pNMHDR));
  };

  //Delegate
  return CSplitterLite::OnNotify(idCtrl, pNMHDR);
}

BOOL CTreeViewLite::OnSelChanged | ( | INT | idCtrl,
 |  | NMTREEVIEW * | pNMTreeView |
 | ) |  |  | [virtual]

Definition at line 3248 of file cdialoglite.cpp.

{
  return FALSE;
}

BOOL CTreeViewLite::SelectItem ( HTREEITEM hItem ) [inline]

Definition at line 769 of file cdialoglite.h.

{ ASSERT(IsWindow(m_hWnd));   return (BOOL)SendMessage(m_hWnd, TVM_SELECTITEM, TVGN_CARET, (LPARAM)hItem);    }

BOOL CTreeViewLite::SetItemImage | ( | HTREEITEM | hItem,
 |  | INT | iImage,
 |  | INT | iSelectedImage
 | ) |  |

Definition at line 3382 of file cdialoglite.cpp.

{
  //TVM_SETITEM
  TVITEM tvItem = { TVIF_IMAGE|TVIF_SELECTEDIMAGE, hItem, 0, 0, NULL, 0, iImage, iSelectedImage, 0, 0};
  return (BOOL)SendMessage(m_hWnd, TVM_SETITEM, 0, (LPARAM)&tvItem);
}

BOOL CTreeViewLite::SetItemParam | ( | HTREEITEM | hItem,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 3394 of file cdialoglite.cpp.

{
  //TVM_SETITEM
  TVITEM tvItem = { TVIF_PARAM, hItem, 0, 0, NULL, 0, 0, 0, 0, lParam};
  return (BOOL)SendMessage(m_hWnd, TVM_SETITEM, 0, (LPARAM)&tvItem);
}

BOOL CTreeViewLite::SetItemState | ( | HTREEITEM | hItem,
 |  | UINT | iState,
 |  | UINT | iStateMask
 | ) |  |

Definition at line 3372 of file cdialoglite.cpp.

{
  return TV_SetItemState(m_hWnd, hItem, iState, iStateMask);
}

BOOL CTreeViewLite::SetItemText | ( | HTREEITEM | hItem,
 |  | WCHAR * | pwszText
 | ) |  |

Definition at line 3406 of file cdialoglite.cpp.

{
  if(IsUnicodeOS())
  {
    //TVM_SETITEM
    TVITEMW tvItem = { TVIF_TEXT, hItem, 0, 0, pwszText, 0, 0, 0, 0, 0};
    return (BOOL)SendMessageW(m_hWnd, TVM_SETITEMW, 0, (LPARAM)&tvItem);
  }
  else
  {
    CHAR szBuffer[MAX_NAME_LEN+1];
    ConvertToMBCS(pwszText, szBuffer, MAX_NAME_LEN);

    //TVM_SETITEM
    TVITEMA tvItem = { TVIF_TEXT, hItem, 0, 0, szBuffer, 0, 0, 0, 0, 0};
    return (BOOL)SendMessageA(m_hWnd, TVM_SETITEMA, 0, (LPARAM)&tvItem);
  }
}

Member Data Documentation

HTREEITEM CTreeViewLite::m_hDraggingItem [protected]

Definition at line 791 of file cdialoglite.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialoglite.h
  • Dataaccess/oledb/rowsetviewer/cdialoglite.cpp
Generated on Wed Nov 13 2024 16:57:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CTSFDataObject Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CTSFDataObject Class Reference

#include "dataobj.h"

List of all members.

Public Member Functions

CTSFDataObject ()
~CTSFDataObject ()
HRESULT | _SetText (LPWSTR pwszText)
STDMETHODIMP | DAdvise (LPFORMATETC, DWORD, IAdviseSink *, LPDWORD)
STDMETHODIMP | DUnadvise (DWORD dwConnection)
STDMETHODIMP | EnumDAdvise (IEnumSTATDATA **ppEnumAdvise)
STDMETHODIMP | EnumFormatEtc (DWORD, IEnumFORMATETC **)
STDMETHODIMP | GetCanonicalFormatEtc (LPFORMATETC, LPFORMATETC)
STDMETHODIMP | GetData (LPFORMATETC, LPSTGMEDIUM)
STDMETHODIMP | GetDataHere (LPFORMATETC, LPSTGMEDIUM)
STDMETHODIMP | QueryGetData (LPFORMATETC)
STDMETHODIMP | QueryInterface (REFIID, LPVOID FAR *)
STDMETHODIMP | SetData (LPFORMATETC, LPSTGMEDIUM, BOOL)
STDMETHODIMP_ (DWORD) AddRef()
STDMETHODIMP_ (DWORD) Release()

Private Attributes

FORMATETC | m_FormatEtc
DWORD m_ObjRefCount
LPWSTR | m_pwszText

Detailed Description

Definition at line 29 of file dataobj.h.

Constructor & Destructor Documentation

CTSFDataObject::CTSFDataObject ( )

Definition at line 34 of file dataobj.cpp.

{
    m_ObjRefCount = 1;

    m_FormatEtc.cfFormat = CF_UNICODETEXT;
    m_FormatEtc.dwAspect = DVASPECT_CONTENT;
    m_FormatEtc.ptd = NULL;
    m_FormatEtc.tymed = TYMED_HGLOBAL;
    m_FormatEtc.lindex = -1;

    m_pwszText = NULL;
}

CTSFDataObject::~CTSFDataObject ( )

Definition at line 53 of file dataobj.cpp.

{
    _SetText(NULL);
}

Member Function Documentation

HRESULT CTSFDataObject::_SetText ( LPWSTR pwszText )

Definition at line 311 of file dataobj.cpp.

{
    if(m_pwszText)
    {
        GlobalFree(m_pwszText);
        m_pwszText = NULL;
    }

    if(pwszText && *pwszText)
    {
        m_pwszText = (LPWSTR)GlobalAlloc(GMEM_FIXED, (lstrlenW(pwszText) + 1) * sizeof(WCHAR));
        if(NULL == m_pwszText)
        {
            return E_OUTOFMEMORY;
        }

        lstrcpyW(m_pwszText, pwszText);
    }

    return S_OK;
}

STDMETHODIMP CTSFDataObject::DAdvise | ( | LPFORMATETC | pFE,
 |  | DWORD | advf,
 |  | IAdviseSink * | ppAdviseSink,
 |  | LPDWORD | pdwConnection
 | ) |  |

Definition at line 270 of file dataobj.cpp.

{
    return E_NOTIMPL;
}

STDMETHODIMP CTSFDataObject::DUnadvise ( DWORD dwConnection )

Definition at line 284 of file dataobj.cpp.

{
    return E_NOTIMPL;
}

STDMETHODIMP CTSFDataObject::EnumDAdvise ( IEnumSTATDATA ** ppEnumAdvise )

Definition at line 295 of file dataobj.cpp.

{
    return E_NOTIMPL;
}

STDMETHODIMP CTSFDataObject::EnumFormatEtc | ( | DWORD | dwDirection,
 |  | IEnumFORMATETC ** | ppEFE
 | ) |  |

Definition at line 245 of file dataobj.cpp.

{
    return E_NOTIMPL;
}

STDMETHODIMP CTSFDataObject::GetCanonicalFormatEtc | ( | LPFORMATETC | pFEIn,
 |  | LPFORMATETC | pFEOut
 | ) |  |

Definition at line 227 of file dataobj.cpp.

{
    if(NULL == pFEOut)
    {
        return E_INVALIDARG;
    }

    pFEOut->ptd = NULL;

    return DATA_S_SAMEFORMATETC;
}

STDMETHODIMP CTSFDataObject::GetData | ( | LPFORMATETC | pFE,
 |  | LPSTGMEDIUM | pStgMedium
 | ) |  |

Definition at line 130 of file dataobj.cpp.

{
    if(pFE->cfFormat == m_FormatEtc.cfFormat)
    {
        pStgMedium->pUnkForRelease = NULL;
        pStgMedium->hGlobal = GlobalAlloc(GHND | GMEM_SHARE, (lstrlenW(m_pwszText) + 1) * sizeof(WCHAR));

        if(pStgMedium->hGlobal)
        {
            pStgMedium->tymed = TYMED_HGLOBAL;
            return GetDataHere(pFE, pStgMedium);
        }

        return E_OUTOFMEMORY;
    }

    return E_INVALIDARG;
}

STDMETHODIMP CTSFDataObject::GetDataHere | ( | LPFORMATETC | pFE,
 |  | LPSTGMEDIUM | pStgMedium
 | ) |  |

Definition at line 155 of file dataobj.cpp.

{
    if(pFE->cfFormat == m_FormatEtc.cfFormat)
    {
        if(pFE->tymed & TYMED_HGLOBAL)
        {
            //copy the text into the buffer
            LPWSTR  pwsz = (LPWSTR)GlobalLock(pStgMedium->hGlobal);

            if(pwsz)
            {
                SIZE_T  sizeDestBytes = GlobalSize(pStgMedium->hGlobal);
                SIZE_T  sizeSrcBytes = (lstrlenW(m_pwszText) + 1) * sizeof(WCHAR);

                if(sizeDestBytes < sizeSrcBytes)
                {
                    return STG_E_MEDIUMFULL;
                }

                CopyMemory(pwsz, m_pwszText, sizeSrcBytes);

                GlobalUnlock(pStgMedium->hGlobal);

                return S_OK;
            }
        }
        else
        {
            return DV_E_TYMED;
        }
    }
    else
    {
        return DV_E_CLIPFORMAT;
    }

    return E_FAIL;
}

STDMETHODIMP CTSFDataObject::QueryGetData ( LPFORMATETC pFE )

Definition at line 200 of file dataobj.cpp.

{
BOOL fReturn = FALSE;

    /*
    Check the aspects we support. Implementations of this object will only
    support DVASPECT_CONTENT.
    */
    if(!(DVASPECT_CONTENT & pFE->dwAspect))
    {
        return DV_E_DVASPECT;
    }

    if(pFE->cfFormat == m_FormatEtc.cfFormat)
    {
        fReturn |= m_FormatEtc.tymed & pFE->tymed;
    }

    return (fReturn ? S_OK : DV_E_TYMED);
}

STDMETHODIMP CTSFDataObject::QueryInterface | ( | REFIID | ,
 |  | LPVOID FAR * |
 | ) |  |
STDMETHODIMP CTSFDataObject::SetData | ( | LPFORMATETC | pFE,
 |  | LPSTGMEDIUM | pStgMedium,
 |  | BOOL | fRelease
 | ) |  |

Definition at line 257 of file dataobj.cpp.

{
    return E_NOTIMPL;
}

CTSFDataObject::STDMETHODIMP_ ( DWORD )
CTSFDataObject::STDMETHODIMP_ ( DWORD )

Member Data Documentation

FORMATETC CTSFDataObject::m_FormatEtc [private]

Definition at line 33 of file dataobj.h.

DWORD CTSFDataObject::m_ObjRefCount [private]

Definition at line 32 of file dataobj.h.

LPWSTR CTSFDataObject::m_pwszText [private]

Definition at line 34 of file dataobj.h.

The documentation for this class was generated from the following files:
  • WinUI/tsfapp/dataobj.h
  • WinUI/tsfapp/dataobj.cpp
Generated on Wed Nov 13 2024 16:57:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CTSFEditWnd Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes

CTSFEditWnd Class Reference

#include "tsfedit.h"

List of all members.

Public Member Functions

CTSFEditWnd (HINSTANCE hInstance, HWND hwndParent)
~CTSFEditWnd ()
void | _GetComposing (void)
void | _GetDisplayAttributes (void)
void | _GetReadingText (void)
void | _GetTextOwner (void)
HWND | _GetWindow ()
BOOL | _Initialize (ITfThreadMgr *pThreadMgr, TfClientId tfcId)
void | _LoadFromFile (LPTSTR pszFile)
HRESULT | _OnGetPreservedKey ()
LRESULT | _OnInitMenuPopup (WPARAM, LPARAM)
void | _OnTest (void)
void | _OnUpdate (void)
void | _Playback (void)
void | _Reconvert (void)
void | _SaveToFile (LPTSTR pszFile)
HRESULT | _TerminateAllCompositions (void)
void | _Uninitialize ()
STDMETHODIMP | AdviseSink (REFIID riid, IUnknown *punk, DWORD dwMask)
STDMETHODIMP | FindNextAttrTransition (LONG acpStart, LONG acpHalt, ULONG cFilterAttrs, const TS_ATTRID *paFilterAttrs, DWORD dwFlags, LONG *pacpNext, BOOL *pfFound, LONG *plFoundOffset)
STDMETHODIMP | GetACPFromPoint (TsViewCookie vcView, const POINT *pt, DWORD dwFlags, LONG *pacp)
STDMETHODIMP | GetActiveView (TsViewCookie *pvcView)
STDMETHODIMP | GetDescription (BSTR *pbstrDesc)
STDMETHODIMP | GetEmbedded (LONG acpPos, REFGUID rguidService, REFIID riid, IUnknown **ppunk)
STDMETHODIMP | GetEndACP (LONG *pacp)
STDMETHODIMP | GetFormattedText (LONG acpStart, LONG acpEnd, IDataObject **ppDataObject)
STDMETHODIMP | GetFunction (REFGUID rguid, REFIID riid, IUnknown **ppunk)
STDMETHODIMP | GetScreenExt (TsViewCookie vcView, RECT *prc)
STDMETHODIMP | GetSelection (ULONG ulIndex, ULONG ulCount, TS_SELECTION_ACP *pSelection, ULONG *pcFetched)
STDMETHODIMP | GetStatus (TS_STATUS *pdcs)
STDMETHODIMP | GetText (LONG acpStart, LONG acpEnd, WCHAR *pchPlain, ULONG cchPlainReq, ULONG *pcchPlainOut, TS_RUNINFO *prgRunInfo, ULONG ulRunInfoReq, ULONG *pulRunInfoOut, LONG *pacpNext)
STDMETHODIMP | GetTextExt (TsViewCookie vcView, LONG acpStart, LONG acpEnd, RECT *prc, BOOL *pfClipped)
STDMETHODIMP | GetType (GUID *pguid)
STDMETHODIMP | GetWnd (TsViewCookie vcView, HWND *phwnd)
STDMETHODIMP | InsertEmbedded (DWORD dwFlags, LONG acpStart, LONG acpEnd, IDataObject *pDataObject, TS_TEXTCHANGE *pChange)
STDMETHODIMP | InsertEmbeddedAtSelection (DWORD dwFlags, IDataObject *pDataObject, LONG *pacpStart, LONG *pacpEnd, TS_TEXTCHANGE *pChange)
STDMETHODIMP | InsertTextAtSelection (DWORD dwFlags, const WCHAR *pchText, ULONG cch, LONG *pacpStart, LONG *pacpEnd, TS_TEXTCHANGE *pChange)
STDMETHODIMP | OnEndComposition (ITfCompositionView *pComposition)
STDMETHODIMP | OnStartComposition (ITfCompositionView *pComposition, BOOL *pfOk)
STDMETHODIMP | OnUpdateComposition (ITfCompositionView *pComposition, ITfRange *pRangeNew)
STDMETHODIMP | QueryInsert (LONG acpTestStart, LONG acpTestEnd, ULONG cch, LONG *pacpResultStart, LONG *pacpResultEnd)
STDMETHODIMP | QueryInsertEmbedded (const GUID *pguidService, const FORMATETC *pFormatEtc, BOOL *pfInsertable)
STDMETHOD() | QueryInterface (REFIID, LPVOID *)
STDMETHODIMP | RequestAttrsAtPosition (LONG acpPos, ULONG cFilterAttrs, const TS_ATTRID *paFilterAttrs, DWORD dwFlags)
STDMETHODIMP | RequestAttrsTransitioningAtPosition (LONG acpPos, ULONG cFilterAttrs, const TS_ATTRID *paFilterAttrs, DWORD dwFlags)
STDMETHODIMP | RequestLock (DWORD dwLockFlags, HRESULT *phrSession)
STDMETHODIMP | RequestSupportedAttrs (DWORD dwFlags, ULONG cFilterAttrs, const TS_ATTRID *paFilterAttrs)
STDMETHODIMP | RetrieveRequestedAttrs (ULONG ulCount, TS_ATTRVAL *paAttrVals, ULONG *pcFetched)
STDMETHODIMP | SetSelection (ULONG ulCount, const TS_SELECTION_ACP *pSelection)
STDMETHODIMP | SetText (DWORD dwFlags, LONG acpStart, LONG acpEnd, const WCHAR *pchText, ULONG cch, TS_TEXTCHANGE *pChange)
STDMETHOD_ (DWORD, AddRef)()
STDMETHOD_ (DWORD, Release)()
STDMETHODIMP | UnadviseSink (IUnknown *punk)

Private Member Functions

BOOL | _CanPlaybackSelection (void)
BOOL | _CanReconvertSelection (void)
HRESULT | _ClearAdviseSink (PADVISE_SINK pAdviseSink)
void | _ClearRequestedAttributes (void)
void | _ClearText (void)
BOOL | _GetCurrentSelection (void)
HRESULT | _GetText (LPWSTR *ppwsz, LPLONG pcch=NULL)
BOOL _InitFunctionProvider ()
BOOL | _InternalLockDocument (DWORD dwLockFlags)
void | _InternalUnlockDocument ()
BOOL | _IsLocked (DWORD dwLockType)
void | _Load (IStream *pStream)
BOOL | _LockDocument (DWORD dwLockFlags)
LRESULT | _OnCommand (WORD, WORD, HWND)
LRESULT | _OnCreate (VOID)
LRESULT | _OnDestroy (VOID)
LRESULT | _OnEditChange (void)
LRESULT | _OnEditKillFocus (VOID)
LRESULT | _OnEditSetFocus (VOID)
LRESULT | _OnKillFocus (VOID)
LRESULT | _OnNotify (UINT, LPNMHDR)
LRESULT | _OnSetFocus (VOID)
LRESULT | _OnSize (WPARAM, LPARAM)
void | _Save (IStream *pStream)
STDMETHODIMP | _TestInsert (LONG acpTestStart, LONG acpTestEnd, ULONG cch, LONG *pacpResultStart, LONG *pacpResultEnd)
void | _UninitFunctionProvider ()
void | _UnlockDocument ()
void | _UpdateStatusBar (void)

Static Private Member Functions

static LRESULT CALLBACK | _WndProc (HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam)

Private Attributes

LONG | m_acpEnd
LONG | m_acpStart
TsActiveSelEnd | m_ActiveSelEnd
ADVISE_SINK m_AdviseSink
ULONG m_cchOldLength
ULONG m_cCompositions
DWORD m_dwInternalLockType
DWORD m_dwLockType
TfEditCookie | m_EditCookie
BOOL m_fInterimChar
BOOL m_fLayoutChanged
BOOL m_fLocked
BOOL m_fNotify
BOOL m_fPendingLockUpgrade
HINSTANCE | m_hInst
HWND | m_hWnd
HWND | m_hwndEdit
HWND | m_hwndParent
HWND | m_hwndStatus
DWORD m_ObjRefCount
ITfCategoryMgr * | m_pCategoryMgr
ITfContext * | m_pContext
ITfDisplayAttributeMgr * | m_pDisplayAttrMgr
ITfDocumentMgr * | m_pDocMgr
ITfDocumentMgr * | m_pPrevDocMgr
ITextStoreACPServices * | m_pServices
ITfThreadMgr * | m_pThreadMgr
ATTRIBUTES | m_rgAttributes [NUM_SUPPORTED_ATTRS]
ITfCompositionView * | m_rgCompositions [MAX_COMPOSITIONS]
TfClientId | m_tfClientID

Detailed Description

Definition at line 74 of file tsfedit.h.

Constructor & Destructor Documentation

CTSFEditWnd::CTSFEditWnd | ( | HINSTANCE | hInstance,
 |  | HWND | hwndParent
 | ) |  |

Definition at line 53 of file tsfedit.cpp.

{
    m_hWnd = NULL;
    m_hwndEdit = NULL;
    m_hwndStatus = NULL;
    m_hInst = hInstance;
    m_ObjRefCount = 1;
    m_hwndParent = hwndParent;
    m_pThreadMgr = NULL;
    m_pDocMgr = NULL;
    m_pPrevDocMgr = NULL;
    m_pContext = NULL;
    m_fLocked = FALSE;
    m_dwLockType = 0;
    m_fPendingLockUpgrade = FALSE;
    m_acpStart = 0;
    m_acpEnd = 0;
    m_fInterimChar = FALSE;
    m_ActiveSelEnd = TS_AE_START;
    m_pServices = NULL;
    m_cCompositions = 0;
    m_pCategoryMgr = NULL;
    m_pDisplayAttrMgr = NULL;
    m_fLayoutChanged = FALSE;
    m_fNotify = TRUE;
    m_cchOldLength = 0;

    ZeroMemory(&m_AdviseSink, sizeof(m_AdviseSink));
    ZeroMemory(&m_rgCompositions, sizeof(m_rgCompositions));
}

CTSFEditWnd::~CTSFEditWnd ( )

Definition at line 90 of file tsfedit.cpp.

{
    /*
    Make sure the advise sink is cleaned up. This should have been done
    before, but this is just in case.
    */
    _ClearAdviseSink(&m_AdviseSink);

    if(m_pServices)
    {
        m_pServices->Release();
        m_pServices = NULL;
    }

    _Uninitialize();
}

Member Function Documentation

BOOL CTSFEditWnd::_CanPlaybackSelection ( void ) [private]

Definition at line 1583 of file tsfedit.cpp.

{
    BOOL                fCanPlayback = FALSE;
    HRESULT             hr;
    ITfFunctionProvider *pFuncProv;

    _InternalLockDocument(TS_LF_READ);

    hr = m_pThreadMgr->GetFunctionProvider(CLSID_SapiLayr, &pFuncProv);
    if(SUCCEEDED(hr))
    {
        ITfFnPlayBack *pPlayback;

        hr = pFuncProv->GetFunction(GUID_NULL, IID_ITfFnPlayBack, (IUnknown**)&pPlayback);
        if(SUCCEEDED(hr))
        {
            TF_SELECTION    ts;
            ULONG           uFetched;

            hr = m_pContext->GetSelection(m_EditCookie, TF_DEFAULT_SELECTION, 1, &ts, &uFetched);
            if(SUCCEEDED(hr))
            {
                ITfRange    *pRange = NULL;

                hr = pPlayback->QueryRange(ts.range, &pRange, &fCanPlayback);
                if(SUCCEEDED(hr) && pRange)
                {
                    pRange->Release();
                }

            ts.range->Release();
            }

            pPlayback->Release();
        }

        pFuncProv->Release();
    }

    _InternalUnlockDocument();

    return fCanPlayback;
}

BOOL CTSFEditWnd::_CanReconvertSelection ( void ) [private]

Definition at line 1443 of file tsfedit.cpp.

{
    BOOL                fConv = FALSE;
    HRESULT             hr;
    ITfFunctionProvider *pFuncProv;

    _InternalLockDocument(TS_LF_READ);

    hr = m_pThreadMgr->GetFunctionProvider(GUID_SYSTEM_FUNCTIONPROVIDER, &pFuncProv);
    if(SUCCEEDED(hr))
    {
        ITfFnReconversion  *pRecon;

        hr = pFuncProv->GetFunction(GUID_NULL, IID_ITfFnReconversion, (IUnknown**)&pRecon);
        if(SUCCEEDED(hr))
        {
            TF_SELECTION    ts;
            ULONG           uFetched;

            hr = m_pContext->GetSelection(m_EditCookie, TF_DEFAULT_SELECTION, 1, &ts, &uFetched);
            if(SUCCEEDED(hr))
            {
                ITfRange    *pRange = NULL;

                hr = pRecon->QueryRange(ts.range, &pRange, &fConv);
                if(SUCCEEDED(hr) && pRange)
                {
                    pRange->Release();
                }

            ts.range->Release();
            }

            pRecon->Release();
        }

        pFuncProv->Release();
    }

    _InternalUnlockDocument();

    return fConv;
}

HRESULT CTSFEditWnd::_ClearAdviseSink ( PADVISE_SINK pAdviseSink ) [private]

Definition at line 703 of file tsfedit.cpp.

{
    if(pAdviseSink->punkID)
    {
        pAdviseSink->punkID->Release();
        pAdviseSink->punkID = NULL;
    }

    if(pAdviseSink->pTextStoreACPSink)
    {
        pAdviseSink->pTextStoreACPSink->Release();
        pAdviseSink->pTextStoreACPSink = NULL;
    }

    pAdviseSink->dwMask = 0;

    return S_OK;
}

void CTSFEditWnd::_ClearRequestedAttributes ( void ) [private]

Definition at line 898 of file tsfedit.cpp.

{
    int i;

    for (i = 0; i < NUM_SUPPORTED_ATTRS; i++)
    {
        VariantClear(&m_rgAttributes[i].varValue);
        m_rgAttributes[i].dwFlags = ATTR_FLAG_NONE;
    }
}

void CTSFEditWnd::_ClearText ( void ) [private]

Definition at line 915 of file tsfedit.cpp.

{
    //can't do this if someone has a lock
    if(_IsLocked(TS_LF_READ))
    {
        return;
    }

    _LockDocument(TS_LF_READWRITE);

    //empty the text in the edit control, but don't send a change notification
    BOOL    fOldNotify = m_fNotify;
    m_fNotify = FALSE;
    SetWindowTextW(m_hwndEdit, NULL);
    m_fNotify = fOldNotify;

    //update current selection
    m_acpStart = m_acpEnd = 0;

    //notify TSF about the changes
    m_AdviseSink.pTextStoreACPSink->OnSelectionChange();

    _OnEditChange();

    _UnlockDocument();

    // make sure to send the OnLayoutChange notification AFTER releasing the lock
    // so clients can do something useful during the notification
    m_AdviseSink.pTextStoreACPSink->OnLayoutChange(TS_LC_CHANGE, EDIT_VIEW_COOKIE);
}

void CTSFEditWnd::_GetComposing ( void )

Definition at line 1336 of file tsfedit.cpp.

{
    HRESULT             hr;
    const GUID          *rGuidProperties[1];
    ITfReadOnlyProperty *pTrackProperty;

    //get the tracking property for the attributes
    rGuidProperties[0] = &GUID_PROP_COMPOSING;
    hr = m_pContext->TrackProperties(   rGuidProperties,
                                        1,
                                        NULL,
                                        0,
                                        &pTrackProperty);
    if(SUCCEEDED(hr))
    {
        ITfRangeACP *pRangeAllText;
        LONG        acpEnd;

        //get the range of the entire text
        acpEnd = GetWindowTextLength(m_hwndEdit);
        hr = m_pServices->CreateRange(0, acpEnd, &pRangeAllText);
        if(SUCCEEDED(hr))
        {
            IEnumTfRanges   *pEnumRanges;

            hr = pTrackProperty->EnumRanges(m_EditCookie, &pEnumRanges, pRangeAllText);
            if(SUCCEEDED(hr))
            {
                ITfRange    *pPropRange;
                ULONG       uFetched;

                /*
                Each range in pEnumRanges represents a span of text that has
                the same properties specified in TrackProperties.
                */
                while((hr = pEnumRanges->Next(1, &pPropRange, &uFetched)) == S_OK && uFetched)
                {
                    //get the attribute property for the property range
                    VARIANT var;

                    VariantInit(&var);

                    hr = pTrackProperty->GetValue(m_EditCookie, pPropRange, &var);
                    if(SUCCEEDED(hr))
                    {
                        /*
                        The property is actually a VT_UNKNOWN that contains an
                        IEnumTfPropertyValue object.
                        */
                        IEnumTfPropertyValue    *pEnumPropertyVal;

                        hr = var.punkVal->QueryInterface(IID_IEnumTfPropertyValue, (LPVOID*)&pEnumPropertyVal);
                        if(SUCCEEDED(hr))
                        {
                            TF_PROPERTYVAL tfPropVal;

                            while((hr = pEnumPropertyVal->Next(1, &tfPropVal, &uFetched)) == S_OK && uFetched)
                            {
                                /*
                                The GUID_PROP_COMPOSING attribute value is a VT_I4 that contains a boolean indicating if the text is part of a composition.
                                */
                                BOOL    fComposing = FALSE;

                                if(VT_EMPTY == tfPropVal.varValue.vt)
                                {
                                    //the text is not part of a composition
                                }
                                else if(VT_I4 == tfPropVal.varValue.vt)
                                {
                                    //the property is a VT_I4.
                                    if(tfPropVal.varValue.lVal)
                                    {
                                        //The text is part of a composition
                                        fComposing = TRUE;
                                    }
                                }
                                else
                                {
                                    //the property is not recognized
                                }
                            }

                            pEnumPropertyVal->Release();
                        }

                        VariantClear(&var);
                    }

                    pPropRange->Release();
                }

                pEnumRanges->Release();
            }

            pRangeAllText->Release();
        }

        pTrackProperty->Release();
    }
}

BOOL CTSFEditWnd::_GetCurrentSelection ( void ) [private]

Definition at line 800 of file tsfedit.cpp.

{
    //get the selection from the edit control
    ::SendMessage(m_hwndEdit, EM_GETSEL, (WPARAM)&m_acpStart, (LPARAM)&m_acpEnd);

    return TRUE;
}

void CTSFEditWnd::_GetDisplayAttributes ( void )

Definition at line 984 of file tsfedit.cpp.

{
    HRESULT             hr;
    const GUID          *rGuidProperties[1];
    ITfReadOnlyProperty *pTrackProperty;

    //get the tracking property for the attributes
    rGuidProperties[0] = &GUID_PROP_ATTRIBUTE;
    hr = m_pContext->TrackProperties(   rGuidProperties,
                                        1,
                                        NULL,
                                        0,
                                        &pTrackProperty);
    if(SUCCEEDED(hr))
    {
        ITfRangeACP *pRangeAllText;
        LONG        acpEnd;

        //get the range of the entire text
        acpEnd = GetWindowTextLength(m_hwndEdit);
        hr = m_pServices->CreateRange(0, acpEnd, &pRangeAllText);
        if(SUCCEEDED(hr))
        {
            IEnumTfRanges   *pEnumRanges;

            hr = pTrackProperty->EnumRanges(m_EditCookie, &pEnumRanges, pRangeAllText);
            if(SUCCEEDED(hr))
            {
                ITfRange    *pPropRange;
                ULONG       uFetched;

                /*
                Each range in pEnumRanges represents a span of text that has
                the same properties specified in TrackProperties.
                */
                while((hr = pEnumRanges->Next(1, &pPropRange, &uFetched)) == S_OK && uFetched)
                {
                    //get the attribute property for the property range
                    VARIANT var;

                    VariantInit(&var);

                    hr = pTrackProperty->GetValue(m_EditCookie, pPropRange, &var);
                    if(SUCCEEDED(hr))
                    {
                        /*
                        The property is actually a VT_UNKNOWN that contains an
                        IEnumTfPropertyValue object.
                        */
                        IEnumTfPropertyValue    *pEnumPropertyVal;

                        hr = var.punkVal->QueryInterface(IID_IEnumTfPropertyValue, (LPVOID*)&pEnumPropertyVal);
                        if(SUCCEEDED(hr))
                        {
                            TF_PROPERTYVAL tfPropVal;

                            while((hr = pEnumPropertyVal->Next(1, &tfPropVal, &uFetched)) == S_OK && uFetched)
                            {
                                if(VT_EMPTY == tfPropVal.varValue.vt)
                                {
                                    //the property for this range has no value
                                    continue;
                                }
                                else if(VT_I4 == tfPropVal.varValue.vt)
                                {
                                    //the property is a guidatom
                                    TfGuidAtom  gaVal;
                                    GUID        guid;

                                    gaVal = (TfGuidAtom)tfPropVal.varValue.lVal;

                                    hr = m_pCategoryMgr->GetGUID(gaVal, &guid);
                                    if(SUCCEEDED(hr))
                                    {
                                        ITfDisplayAttributeInfo *pDispInfo;

                                        hr = m_pDisplayAttrMgr->GetDisplayAttributeInfo(guid, &pDispInfo, NULL);
                                        if(SUCCEEDED(hr))
                                        {
                                            TF_DISPLAYATTRIBUTE da;

                                            hr = pDispInfo->GetAttributeInfo(&da);

                                            {
                                                GUID    guidDispInfo;
                                                hr = pDispInfo->GetGUID(&guidDispInfo);
                                                guidDispInfo.Data1 = 0;
                                            }

                                            {
                                                BSTR    bstr;

                                                hr = pDispInfo->GetDescription(&bstr);
                                                if(SUCCEEDED(hr))
                                                {
                                                    SysFreeString(bstr);
                                                }
                                            }

                                            pDispInfo->Release();
                                        }
                                    }
                                }
                                else
                                {
                                    //the property is not recognized
                                }
                            }

                            pEnumPropertyVal->Release();
                        }

                        VariantClear(&var);
                    }

                    pPropRange->Release();
                }

                pEnumRanges->Release();
            }

            pRangeAllText->Release();
        }

        pTrackProperty->Release();
    }
}

void CTSFEditWnd::_GetReadingText ( void )

Definition at line 1228 of file tsfedit.cpp.

{
    HRESULT             hr;
    const GUID          *rGuidProperties[1];
    ITfReadOnlyProperty *pTrackProperty;

    //get the tracking property for the attributes
    rGuidProperties[0] = &GUID_PROP_READING;
    hr = m_pContext->TrackProperties(   rGuidProperties,
                                        1,
                                        NULL,
                                        0,
                                        &pTrackProperty);
    if(SUCCEEDED(hr))
    {
        ITfRangeACP *pRangeAllText;
        LONG        acpEnd;

        //get the range of the entire text
        acpEnd = GetWindowTextLength(m_hwndEdit);
        hr = m_pServices->CreateRange(0, acpEnd, &pRangeAllText);
        if(SUCCEEDED(hr))
        {
            IEnumTfRanges   *pEnumRanges;

            hr = pTrackProperty->EnumRanges(m_EditCookie, &pEnumRanges, pRangeAllText);
            if(SUCCEEDED(hr))
            {
                ITfRange    *pPropRange;
                ULONG       uFetched;

                /*
                Each range in pEnumRanges represents a span of text that has
                the same properties specified in TrackProperties.
                */
                while((hr = pEnumRanges->Next(1, &pPropRange, &uFetched)) == S_OK && uFetched)
                {
                    //get the attribute property for the property range
                    VARIANT var;

                    VariantInit(&var);

                    hr = pTrackProperty->GetValue(m_EditCookie, pPropRange, &var);
                    if(SUCCEEDED(hr))
                    {
                        /*
                        The property is actually a VT_UNKNOWN that contains an
                        IEnumTfPropertyValue object.
                        */
                        IEnumTfPropertyValue    *pEnumPropertyVal;

                        hr = var.punkVal->QueryInterface(IID_IEnumTfPropertyValue, (LPVOID*)&pEnumPropertyVal);
                        if(SUCCEEDED(hr))
                        {
                            TF_PROPERTYVAL tfPropVal;

                            while((hr = pEnumPropertyVal->Next(1, &tfPropVal, &uFetched)) == S_OK && uFetched)
                            {
                                /*
                                The GUID_PROP_TEXTOWNER attribute value is the CLSID of the text service that owns the text. If the text is not owned, the value is VT_EMPTY.
                                */
                                if(VT_EMPTY == tfPropVal.varValue.vt)
                                {
                                    //the text is not owned
                                    continue;
                                }
                                else if(VT_BSTR == tfPropVal.varValue.vt)
                                {
                                    //the property is a BSTR.
                                    tfPropVal.varValue.bstrVal;

                                    HRESULT hr;
                                    WCHAR   wsz[MAX_PATH];
                                    ULONG   cch;
                                    hr = pPropRange->GetText(m_EditCookie, 0, wsz, MAX_PATH-1, &cch);
                                    wsz[cch] = 0;
                                }
                                else
                                {
                                    //the property is not recognized
                                }
                            }

                            pEnumPropertyVal->Release();
                        }

                        VariantClear(&var);
                    }

                    pPropRange->Release();
                }

                pEnumRanges->Release();
            }

            pRangeAllText->Release();
        }

        pTrackProperty->Release();
    }
}

HRESULT CTSFEditWnd::_GetText | ( | LPWSTR * | ppwsz,
 |  | LPLONG | pcch = NULL |
 | ) |  |  | [private]

Definition at line 952 of file tsfedit.cpp.

{
    DWORD   cch;
    LPWSTR  pwszText;

    *ppwsz = NULL;

    cch = GetWindowTextLength(m_hwndEdit);
    pwszText = (LPWSTR)GlobalAlloc(GMEM_FIXED, (cch + 1) * sizeof(WCHAR));
    if(NULL == pwszText)
    {
        return E_OUTOFMEMORY;
    }

    GetWindowTextW(m_hwndEdit, pwszText, cch + 1);

    *ppwsz = pwszText;

    if(pcch)
    {
        *pcch = cch;
    }

    return S_OK;
}

void CTSFEditWnd::_GetTextOwner ( void )

Definition at line 1118 of file tsfedit.cpp.

{
    HRESULT             hr;
    const GUID          *rGuidProperties[1];
    ITfReadOnlyProperty *pTrackProperty;

    //get the tracking property for the attributes
    rGuidProperties[0] = &GUID_PROP_TEXTOWNER;
    hr = m_pContext->TrackProperties(   rGuidProperties,
                                        1,
                                        NULL,
                                        0,
                                        &pTrackProperty);
    if(SUCCEEDED(hr))
    {
        ITfRangeACP *pRangeAllText;
        LONG        acpEnd;

        //get the range of the entire text
        acpEnd = GetWindowTextLength(m_hwndEdit);
        hr = m_pServices->CreateRange(0, acpEnd, &pRangeAllText);
        if(SUCCEEDED(hr))
        {
            IEnumTfRanges   *pEnumRanges;

            hr = pTrackProperty->EnumRanges(m_EditCookie, &pEnumRanges, pRangeAllText);
            if(SUCCEEDED(hr))
            {
                ITfRange    *pPropRange;
                ULONG       uFetched;

                /*
                Each range in pEnumRanges represents a span of text that has
                the same properties specified in TrackProperties.
                */
                while((hr = pEnumRanges->Next(1, &pPropRange, &uFetched)) == S_OK && uFetched)
                {
                    //get the attribute property for the property range
                    VARIANT var;

                    VariantInit(&var);

                    hr = pTrackProperty->GetValue(m_EditCookie, pPropRange, &var);
                    if(SUCCEEDED(hr))
                    {
                        /*
                        The property is actually a VT_UNKNOWN that contains an
                        IEnumTfPropertyValue object.
                        */
                        IEnumTfPropertyValue    *pEnumPropertyVal;

                        hr = var.punkVal->QueryInterface(IID_IEnumTfPropertyValue, (LPVOID*)&pEnumPropertyVal);
                        if(SUCCEEDED(hr))
                        {
                            TF_PROPERTYVAL tfPropVal;

                            while((hr = pEnumPropertyVal->Next(1, &tfPropVal, &uFetched)) == S_OK && uFetched)
                            {
                                /*
                                The GUID_PROP_TEXTOWNER attribute value is the CLSID of the text service that owns the text. If the text is not owned, the value is VT_EMPTY.
                                */
                                if(VT_EMPTY == tfPropVal.varValue.vt)
                                {
                                    //the text is not owned
                                    continue;
                                }
                                else if(VT_I4 == tfPropVal.varValue.vt)
                                {
                                    //the property is a guidatom that represents the CLSID of the text service that owns the text.
                                    TfGuidAtom  gaVal;
                                    CLSID       clsidOwner;

                                    gaVal = (TfGuidAtom)tfPropVal.varValue.lVal;

                                    hr = m_pCategoryMgr->GetGUID(gaVal, &clsidOwner);
                                    if(SUCCEEDED(hr))
                                    {
                                    }
                                }
                                else
                                {
                                    //the property is not recognized
                                }
                            }

                            pEnumPropertyVal->Release();
                        }

                        VariantClear(&var);
                    }

                    pPropRange->Release();
                }

                pEnumRanges->Release();
            }

            pRangeAllText->Release();
        }

        pTrackProperty->Release();
    }
}

HWND CTSFEditWnd::_GetWindow ( )

Definition at line 376 of file tsfedit.cpp.

{
    return m_hWnd;
}

BOOL CTSFEditWnd::_InitFunctionProvider ( ) [private]

Definition at line 76 of file funcprov.cpp.

{
    HRESULT hr = E_FAIL;
    ITfSourceSingle *pSourceSingle;

    hr = m_pThreadMgr->QueryInterface(&pSourceSingle);
    if(SUCCEEDED(hr))
    {
        hr = pSourceSingle->AdviseSingleSink(m_tfClientID, IID_ITfFunctionProvider, (ITfFunctionProvider*)this);

        pSourceSingle->Release();
    }

    return SUCCEEDED(hr);
}

BOOL CTSFEditWnd::_Initialize | ( | ITfThreadMgr * | pThreadMgr,
 |  | TfClientId | tfcId
 | ) |  |

Definition at line 113 of file tsfedit.cpp.

{
    HRESULT hr;

    InitCommonControls();

    m_tfClientID = tfcId;
    hr = ptm->QueryInterface(IID_ITfThreadMgr, (LPVOID*)&m_pThreadMgr);
    if(FAILED(hr))
    {
        return FALSE;
    }

    hr = CoCreateInstance(  CLSID_TF_CategoryMgr,
                            NULL,
                            CLSCTX_INPROC_SERVER,
                            IID_ITfCategoryMgr,
                            (LPVOID*)&m_pCategoryMgr);
    if(FAILED(hr))
    {
        return FALSE;
    }

    //create the display attribute manager
    hr = CoCreateInstance(  CLSID_TF_DisplayAttributeMgr,
                            NULL,
                            CLSCTX_INPROC_SERVER,
                            IID_ITfDisplayAttributeMgr,
                            (LPVOID*)&m_pDisplayAttrMgr);
    if(FAILED(hr))
    {
        return FALSE;
    }

    //create the document manager
    hr = m_pThreadMgr->CreateDocumentMgr(&m_pDocMgr);
    if(FAILED(hr))
    {
        return FALSE;
    }

    //create the context
    hr = m_pDocMgr->CreateContext(  tfcId,
                                    0,
                                    (ITextStoreACP*)this,
                                    &m_pContext,
                                    &m_EditCookie);
    if(FAILED(hr))
    {
        return FALSE;
    }

    //push the context onto the document stack
    hr = m_pDocMgr->Push(m_pContext);
    if(FAILED(hr))
    {
        return FALSE;
    }

    WNDCLASS  wc;

    //If the class is not already registered, register it.
    if(!GetClassInfo(m_hInst, g_szTSFEditClassName, &wc))
    {
        ZeroMemory(&wc, sizeof(wc));

        wc.style          = CS_HREDRAW | CS_VREDRAW;
        wc.lpfnWndProc    = CTSFEditWnd::_WndProc;
        wc.cbClsExtra     = 0;
        wc.cbWndExtra     = sizeof(CTSFEditWnd*);
        wc.hInstance      = m_hInst;
        wc.hIcon          = LoadIcon(m_hInst, MAKEINTRESOURCE(IDI_MAIN_ICON));
        wc.hCursor        = LoadCursor(NULL, IDC_ARROW);
        wc.hbrBackground  = (HBRUSH)(COLOR_WINDOW + 1);
        wc.lpszMenuName   = MAKEINTRESOURCE(IDR_MAIN_MENU);
        wc.lpszClassName  = g_szTSFEditClassName;

        if(0 == RegisterClass(&wc))
        {
            return FALSE;
        }
    }
    //create the main window
    m_hWnd = CreateWindowEx(    0,
                                g_szTSFEditClassName,
                                NULL,
                                WS_OVERLAPPED |
                                    WS_CHILD |
                                    WS_VISIBLE |
                                    WS_TABSTOP,
                                CW_USEDEFAULT,
                                CW_USEDEFAULT,
                                CW_USEDEFAULT,
                                CW_USEDEFAULT,
                                m_hwndParent,
                                NULL,
                                m_hInst,
                                (LPVOID)this);

    if(NULL != m_hWnd)
    {
        m_hwndEdit = CreateWindowEx(    WS_EX_CLIENTEDGE,
                                        TEXT("edit"),
                                        NULL,
                                        WS_CLIPSIBLINGS |
                                            WS_CHILD |
                                            WS_VISIBLE |
                                            WS_BORDER |
                                            WS_VSCROLL |
                                            ES_AUTOVSCROLL |
                                            ES_MULTILINE,
                                        0, 0, 0, 0,
                                        m_hWnd,
                                        (HMENU)IDC_EDIT,
                                        m_hInst,
                                        NULL);
        if(NULL == m_hwndEdit)
        {
            return FALSE;
        }

        //create the status bar
        m_hwndStatus = CreateStatusWindow(  WS_CHILD | WS_VISIBLE | SBARS_SIZEGRIP,
                                            NULL,
                                            m_hWnd,
                                            IDC_STATUSBAR);

        if(m_hwndStatus)
        {
            _UpdateStatusBar();
        }

#ifdef USE_ASSOC_FOCUS
        /*
        Associate the focus with this window. The TSF Manager watches for
        focus changes throughout the system. When a window handle that has
        been associated gets the focus, it then knows the window receiving
        the focus is TSF enabled.
        */
        hr = m_pThreadMgr->AssociateFocus(m_hwndEdit, m_pDocMgr, &m_pPrevDocMgr);
#endif

        //initialize the supported attributes
        TfGuidAtom guidatom;

        //mode bias
        m_rgAttributes[ATTR_INDEX_MODEBIAS].dwFlags = 0;
        m_rgAttributes[ATTR_INDEX_MODEBIAS].attrid = &GUID_PROP_MODEBIAS;
        VariantInit(&(m_rgAttributes[ATTR_INDEX_MODEBIAS].varValue));
        hr = m_pCategoryMgr->RegisterGUID(GUID_MODEBIAS_NONE, &guidatom);
        if(FAILED(hr))
        {
            guidatom = TF_INVALID_GUIDATOM;
        }
        m_rgAttributes[ATTR_INDEX_MODEBIAS].varDefaultValue.vt = VT_I4;
        m_rgAttributes[ATTR_INDEX_MODEBIAS].varDefaultValue.lVal = guidatom;

        //text orientation - this is a VT_I4 that is always zero in this app
        m_rgAttributes[ATTR_INDEX_TEXT_ORIENTATION].dwFlags = 0;
        m_rgAttributes[ATTR_INDEX_TEXT_ORIENTATION].attrid = &TSATTRID_Text_Orientation;
        VariantInit(&m_rgAttributes[ATTR_INDEX_TEXT_ORIENTATION].varValue);
        m_rgAttributes[ATTR_INDEX_TEXT_ORIENTATION].varDefaultValue.vt = VT_I4;
        m_rgAttributes[ATTR_INDEX_TEXT_ORIENTATION].varDefaultValue.lVal = 0;

        //vertical writing - this is a VT_BOOL that is always FALSE in this app
        m_rgAttributes[ATTR_INDEX_TEXT_VERTICALWRITING].dwFlags = 0;
        m_rgAttributes[ATTR_INDEX_TEXT_VERTICALWRITING].attrid = &TSATTRID_Text_VerticalWriting;
        VariantInit(&m_rgAttributes[ATTR_INDEX_TEXT_VERTICALWRITING].varValue);
        m_rgAttributes[ATTR_INDEX_TEXT_VERTICALWRITING].varDefaultValue.vt = VT_BOOL;
        m_rgAttributes[ATTR_INDEX_TEXT_VERTICALWRITING].varDefaultValue.lVal = FALSE;

        _InitFunctionProvider();

        UpdateWindow(m_hWnd);

        return TRUE;
    }

    return FALSE;
}

BOOL CTSFEditWnd::_InternalLockDocument ( DWORD dwLockFlags ) [private]

Definition at line 747 of file tsfedit.cpp.

{
    m_dwInternalLockType = dwLockFlags;

    return TRUE;
}

void CTSFEditWnd::_InternalUnlockDocument ( ) [private]

Definition at line 789 of file tsfedit.cpp.

{
    m_dwInternalLockType = 0;
}

BOOL CTSFEditWnd::_IsLocked ( DWORD dwLockType ) [private]

Definition at line 687 of file tsfedit.cpp.

{
    if(m_dwInternalLockType)
    {
        return TRUE;
    }

    return m_fLocked && (m_dwLockType & dwLockType);
}

void CTSFEditWnd::_Load ( IStream * pStream ) [private]

Definition at line 269 of file persist.cpp.

{
    if(NULL == pStream)
    {
        return;
    }

    //can't do this if someone has a lock
    if(_IsLocked(TS_LF_READ))
    {
        return;
    }

    _ClearText();

    HRESULT         hr;
    ULONG           uRead;
    LARGE_INTEGER   li;
    ULONG           uSize;

    //set the stream pointer to the start of the stream
    li.QuadPart = 0;
    pStream->Seek(li, STREAM_SEEK_SET, NULL);

    //get the size of the text, in BYTES. This is the first ULONG in the stream
    hr = pStream->Read(&uSize, sizeof(ULONG), &uRead);
    if(SUCCEEDED(hr) && (sizeof(ULONG) == uRead))
    {
        LPWSTR  pwsz;

        //allocate a buffer for the text plus one NULL character
        pwsz = (LPWSTR)GlobalAlloc(GPTR, uSize + sizeof(WCHAR));
        if(NULL != pwsz)
        {
            //get the plain UNICODE text from the stream
            hr = pStream->Read(pwsz, uSize, &uRead);
            if(SUCCEEDED(hr) && (uSize == uRead))
            {
                TF_PERSISTENT_PROPERTY_HEADER_ACP   PropHeader;

                //put the text into the edit control, but don't send a change notification
                BOOL    fOldNotify = m_fNotify;
                m_fNotify = FALSE;
                SetWindowTextW(m_hwndEdit, pwsz);
                m_fNotify = fOldNotify;

                /*
                Read each property header and property data from the stream. The
                list of properties is terminated by a TF_PERSISTENT_PROPERTY_HEADER_ACP
                structure with a cb member of zero.
                */
                hr = pStream->Read(&PropHeader, sizeof(TF_PERSISTENT_PROPERTY_HEADER_ACP), &uRead);
                while(  SUCCEEDED(hr) &&
                        (sizeof(TF_PERSISTENT_PROPERTY_HEADER_ACP) == uRead) &&
                        (0 != PropHeader.cb))
                {
                    ITfProperty *pProp;

                    hr = m_pContext->GetProperty(PropHeader.guidType, &pProp);
                    if(SUCCEEDED(hr))
                    {
                        /*
                        Have TSF read the property data from the stream. This call
                        will request a read lock, so make sure it can be granted
                        or else this method will fail.
                        */
                        CTSFPersistentPropertyLoader *pLoader = new CTSFPersistentPropertyLoader(&PropHeader, pStream);
                        hr = m_pServices->Unserialize(pProp, &PropHeader, NULL, pLoader);

                        pProp->Release();
                    }

                    hr = pStream->Read(&PropHeader, sizeof(TF_PERSISTENT_PROPERTY_HEADER_ACP), &uRead);
                }
            }

            GlobalFree(pwsz);
        }
    }
}

void CTSFEditWnd::_LoadFromFile ( LPTSTR pszFile )

Definition at line 208 of file persist.cpp.

{
    if(pszFile)
    {
        HANDLE  hFile;

        hFile = CreateFile( pszFile,
                            GENERIC_READ,
                            0,
                            NULL,
                            OPEN_EXISTING,
                            FILE_ATTRIBUTE_NORMAL,
                            NULL);

        if(INVALID_HANDLE_VALUE != hFile)
        {
            IStream *pStream;

            //create a stream on global memory
            if(SUCCEEDED(CreateStreamOnHGlobal(NULL, TRUE, &pStream)))
            {
                //read the contents of the file into the stream
                LARGE_INTEGER   li;

                //set the stream pointer to the start of the stream
                li.QuadPart = 0;
                pStream->Seek(li, STREAM_SEEK_SET, NULL);

                //write the contents of the stream to the file
                BYTE    buffer[BLOCK_SIZE];
                ULONG   uRead;
                HRESULT hr;

                uRead = 0;
                ReadFile(hFile, buffer, BLOCK_SIZE, &uRead, NULL);
                while(uRead > 0)
                {
                    ULONG   uWritten;

                    hr = pStream->Write(buffer, uRead, &uWritten);

                    uRead = 0;
                    ReadFile(hFile, buffer, BLOCK_SIZE, &uRead, NULL);
                }

                _Load(pStream);

                pStream->Release();
            }

            CloseHandle(hFile);
        }
    }
}

BOOL CTSFEditWnd::_LockDocument ( DWORD dwLockFlags ) [private]

Definition at line 728 of file tsfedit.cpp.

{
    if(m_fLocked)
    {
        return FALSE;
    }

    m_fLocked = TRUE;
    m_dwLockType = dwLockFlags;

    return TRUE;
}

LRESULT CTSFEditWnd::_OnCommand | ( | WORD | wID,
 |  | WORD | wCmd,
 |  | HWND | hWnd |
 | ) |  |  | [private]

Definition at line 526 of file tsfedit.cpp.

{
    switch(wID)
    {
    case IDC_EDIT:
        switch(wCmd)
        {
        case EN_SETFOCUS:
            _OnEditSetFocus();
            break;

        case EN_KILLFOCUS:
            _OnEditKillFocus();
            break;

        case EN_CHANGE:
            _OnEditChange();
            break;

        }
        break;
    }

    return 0;
}

LRESULT CTSFEditWnd::_OnCreate ( VOID ) [private]

Definition at line 500 of file tsfedit.cpp.

{
    return 0;
}

LRESULT CTSFEditWnd::_OnDestroy ( VOID ) [private]

Definition at line 511 of file tsfedit.cpp.

{
    _Uninitialize();

    PostQuitMessage(0);

    return 0;
}

LRESULT CTSFEditWnd::_OnEditChange ( void ) [private]

Definition at line 590 of file tsfedit.cpp.

{
    if(m_fNotify && m_AdviseSink.pTextStoreACPSink && (m_AdviseSink.dwMask & TS_AS_TEXT_CHANGE))
    {
        DWORD           dwFlags;
        TS_TEXTCHANGE   tc;
        ULONG           cch;

        cch = GetWindowTextLength(m_hwndEdit);

        /*
        dwFlags can be 0 or TS_TC_CORRECTION
        */
        dwFlags = 0;

        tc.acpStart = 0;
        tc.acpOldEnd = m_cchOldLength;
        tc.acpNewEnd = cch;

        m_AdviseSink.pTextStoreACPSink->OnTextChange(dwFlags, &tc);

        m_cchOldLength = cch;
    }

    return 0;
}

LRESULT CTSFEditWnd::_OnEditKillFocus ( VOID ) [private]

Definition at line 636 of file tsfedit.cpp.

{
    OutputDebugString(TEXT("CTSFEditWnd::_OnEditKillFocus\n"));

    return 0;
}

LRESULT CTSFEditWnd::_OnEditSetFocus ( VOID ) [private]

Definition at line 573 of file tsfedit.cpp.

{
    OutputDebugString(TEXT("CTSFEditWnd::_OnEditSetFocus\n"));

#ifndef USE_ASSOC_FOCUS
    m_pThreadMgr->SetFocus(m_pDocMgr);
#endif

    return 0;
}

HRESULT CTSFEditWnd::_OnGetPreservedKey ( )

Definition at line 387 of file tsfedit.cpp.

{
    HRESULT hr;
    ITfKeystrokeMgr *pKeyMgr;

    hr = m_pThreadMgr->QueryInterface(IID_ITfKeystrokeMgr, (LPVOID*)&pKeyMgr);
    if(SUCCEEDED(hr))
    {
        GUID            guid;
        TF_PRESERVEDKEY tfPreKey;

        tfPreKey.uVKey = 'F';
        tfPreKey.uModifiers = TF_MOD_CONTROL;

        hr = pKeyMgr->GetPreservedKey(m_pContext, &tfPreKey, &guid);

        if(SUCCEEDED(hr) && !IsEqualGUID(guid, GUID_NULL))
        {
            BOOL fPreserved;

            hr = pKeyMgr->IsPreservedKey(guid, &tfPreKey, &fPreserved);

            BOOL    fEaten;

            guid.Data1 = 12;
            hr = pKeyMgr->SimulatePreservedKey(m_pContext, guid, &fEaten);
        }

        pKeyMgr->Release();
    }

    return S_OK;
}

LRESULT CTSFEditWnd::_OnInitMenuPopup | ( | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 877 of file tsfedit.cpp.

{
    HMENU hMenu = (HMENU)wParam;

    if(NULL != hMenu)
    {
        EnableMenuItem(hMenu, IDM_TERMINATE_COMPOSITION, m_cCompositions ? MF_ENABLED : MF_DISABLED | MF_GRAYED);
        EnableMenuItem(hMenu, IDM_RECONVERT, _CanReconvertSelection() ? MF_ENABLED : MF_DISABLED | MF_GRAYED);
        EnableMenuItem(hMenu, IDM_PLAYBACK, _CanPlaybackSelection() ? MF_ENABLED : MF_DISABLED | MF_GRAYED);
        EnableMenuItem(hMenu, IDM_LOAD, !_IsLocked(TS_LF_READ) ? MF_ENABLED : MF_DISABLED | MF_GRAYED);
    }

    return 0;
}

LRESULT CTSFEditWnd::_OnKillFocus ( VOID ) [private]

Definition at line 623 of file tsfedit.cpp.

{
    OutputDebugString(TEXT("CTSFEditWnd::_OnKillFocus\n"));

    return 0;
}

LRESULT CTSFEditWnd::_OnNotify | ( | UINT | ,
 |  | LPNMHDR |  |
 | ) |  |  | [private]

Definition at line 649 of file tsfedit.cpp.

{
    return 0;
}

LRESULT CTSFEditWnd::_OnSetFocus ( VOID ) [private]

Definition at line 558 of file tsfedit.cpp.

{
    OutputDebugString(TEXT("CTSFEditWnd::_OnSetFocus\n"));

    SetFocus(m_hwndEdit);

    return 0;
}

LRESULT CTSFEditWnd::_OnSize | ( | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private]

Definition at line 660 of file tsfedit.cpp.

{
    //adjust the size and location of the status bar
    SendMessage(m_hwndStatus, WM_SIZE, wParam, lParam);

    RECT    rc;

    GetWindowRect(m_hwndStatus, &rc);

    MoveWindow( m_hwndEdit,
                0,
                0,
                LOWORD(lParam),
                HIWORD(lParam) - (rc.bottom - rc.top),
                TRUE);

    m_AdviseSink.pTextStoreACPSink->OnLayoutChange(TS_LC_CHANGE, EDIT_VIEW_COOKIE);

    return 0;
}

void CTSFEditWnd::_OnTest ( void )

Definition at line 35 of file test.cpp.

{
}

void CTSFEditWnd::_OnUpdate ( void )

Definition at line 814 of file tsfedit.cpp.

{
    //something changed, but it is not known what specifically changed
    //just update the status bar
    _UpdateStatusBar();
}

void CTSFEditWnd::_Playback ( void )

Definition at line 1633 of file tsfedit.cpp.

{
    HRESULT             hr;
    ITfFunctionProvider *pFuncProv;

    _InternalLockDocument(TS_LF_READ);

    hr = m_pThreadMgr->GetFunctionProvider(CLSID_SapiLayr, &pFuncProv);
    if(SUCCEEDED(hr))
    {
        ITfFnPlayBack *pPlayback;

        hr = pFuncProv->GetFunction(GUID_NULL, IID_ITfFnPlayBack, (IUnknown**)&pPlayback);
        if(SUCCEEDED(hr))
        {
            TF_SELECTION    ts;
            ULONG           uFetched;

            hr = m_pContext->GetSelection(m_EditCookie, TF_DEFAULT_SELECTION, 1, &ts, &uFetched);
            if(SUCCEEDED(hr))
            {
                BOOL        fCanPlayback;
                ITfRange    *pRange = NULL;

                hr = pPlayback->QueryRange(ts.range, &pRange, &fCanPlayback);
                if(SUCCEEDED(hr) && pRange)
                {
                    hr = pPlayback->Play(pRange);

                    pRange->Release();
                }

            ts.range->Release();
            }

            pPlayback->Release();
        }

        pFuncProv->Release();
    }

    _InternalUnlockDocument();
}

void CTSFEditWnd::_Reconvert ( void )

Definition at line 1493 of file tsfedit.cpp.

{
    HRESULT hr;
    ITfFunctionProvider *pFuncProv;

    _InternalLockDocument(TS_LF_READ);

    hr = m_pThreadMgr->GetFunctionProvider(GUID_SYSTEM_FUNCTIONPROVIDER, &pFuncProv);
    if(SUCCEEDED(hr))
    {
        ITfFnReconversion  *pRecon;

        hr = pFuncProv->GetFunction(GUID_NULL, IID_ITfFnReconversion, (IUnknown**)&pRecon);
        if(SUCCEEDED(hr))
        {
            TF_SELECTION    ts;
            ULONG           uFetched;

            hr = m_pContext->GetSelection(m_EditCookie, TF_DEFAULT_SELECTION, 1, &ts, &uFetched);
            if(SUCCEEDED(hr))
            {
                ITfRange    *pRange;
                BOOL        fConv;

                //get the range that covers the text to be reconverted
                hr = pRecon->QueryRange(ts.range, &pRange, &fConv);
                if(SUCCEEDED(hr) && pRange)
                {
                    {
                        WCHAR   wsz[MAX_PATH];
                        ULONG   cch = 0;
                        pRange->GetText(m_EditCookie, 0, wsz, MAX_PATH-1, &cch);
                        wsz[cch] = 0;
                    }

                    //get the list of reconversion candidates
                    ITfCandidateList    *pCandList;
                    hr = pRecon->GetReconversion(pRange, &pCandList);
                    if(SUCCEEDED(hr))
                    {
                        ULONG   i;
                        ULONG   uCandidateCount = 0;

                        hr = pCandList->GetCandidateNum(&uCandidateCount);

                        for(i = 0; i < uCandidateCount; i++)
                        {
                            ITfCandidateString  *pCandString;

                            hr = pCandList->GetCandidate(i, &pCandString);
                            if(SUCCEEDED(hr))
                            {
                                BSTR    bstr;

                                hr = pCandString->GetString(&bstr);
                                if(SUCCEEDED(hr))
                                {
                                    OutputDebugString(TEXT("\tCandidate - \""));
                                    OutputDebugStringW(bstr);
                                    OutputDebugString(TEXT("\"\n"));
                                    SysFreeString(bstr);
                                }

                                pCandString->Release();
                            }
                        }

                        pCandList->Release();
                    }
                    //cause the reconversion to happen
                    hr = pRecon->Reconvert(pRange);

                }
            }

            pRecon->Release();
        }

        pFuncProv->Release();
    }

    _InternalUnlockDocument();
}

void CTSFEditWnd::_Save ( IStream * pStream ) [private]

Definition at line 99 of file persist.cpp.

{
    if(pStream)
    {
        HRESULT hr;

        //write the plain UNICODE text into the stream
        LPWSTR          pwsz;
        LONG            cch;
        ULONG           uWritten;
        LARGE_INTEGER   li;
        ULONG           uSize;

        //set the stream pointer to the start of the stream
        li.QuadPart = 0;
        pStream->Seek(li, STREAM_SEEK_SET, NULL);

        //get the text
        if(SUCCEEDED(_GetText(&pwsz, &cch)))
        {
            TF_PERSISTENT_PROPERTY_HEADER_ACP   PropHeader;

            //write the size, in BYTES, of the text
            uSize = cch * sizeof(WCHAR);
            hr = pStream->Write(&uSize, sizeof(ULONG), &uWritten);

            //write the text, including the NULL_terminator, into the stream
            hr = pStream->Write(pwsz, uSize, &uWritten);

            //free the memory allocated by _GetText
            GlobalFree(pwsz);

            //enumerate the properties in the context
            IEnumTfProperties   *pEnumProps;
            hr = m_pContext->EnumProperties(&pEnumProps);
            if(SUCCEEDED(hr))
            {
                ITfProperty *pProp;
                ULONG       uFetched;

                while(SUCCEEDED(pEnumProps->Next(1, &pProp, &uFetched)) && uFetched)
                {
                    //enumerate all the ranges that contain the property
                    IEnumTfRanges   *pEnumRanges;
                    hr = pProp->EnumRanges(m_EditCookie, &pEnumRanges, NULL);
                    if(SUCCEEDED(hr))
                    {
                        IStream *pTempStream;

                        //create a temporary stream to write the property data to
                        hr = CreateStreamOnHGlobal(NULL, TRUE, &pTempStream);
                        if(SUCCEEDED(hr))
                        {
                            ITfRange    *pRange;

                            while(SUCCEEDED(pEnumRanges->Next(1, &pRange, &uFetched)) && uFetched)
                            {
                                //reset the temporary stream's pointer
                                li.QuadPart = 0;
                                pTempStream->Seek(li, STREAM_SEEK_SET, NULL);

                                //get the property header and data for the range
                                hr = m_pServices->Serialize(pProp, pRange, &PropHeader, pTempStream);

                                /*
                                Write the property header into the primary stream.
                                The header also contains the size of the property
                                data.
                                */
                                hr = pStream->Write(&PropHeader, sizeof(TF_PERSISTENT_PROPERTY_HEADER_ACP), &uWritten);

                                //reset the temporary stream's pointer
                                li.QuadPart = 0;
                                pTempStream->Seek(li, STREAM_SEEK_SET, NULL);

                                //copy the property data from the temporary stream into the primary stream
                                ULARGE_INTEGER  uli;
                                uli.QuadPart = PropHeader.cb;

                                hr = pTempStream->CopyTo(pStream, uli, NULL, NULL);

                                pRange->Release();
                            }

                            pTempStream->Release();
                        }

                        pEnumRanges->Release();
                    }

                    pProp->Release();
                }

                pEnumProps->Release();
            }

            //write a property header with zero size and guid into the stream as a terminator
            ZeroMemory(&PropHeader, sizeof(TF_PERSISTENT_PROPERTY_HEADER_ACP));
            hr = pStream->Write(&PropHeader, sizeof(TF_PERSISTENT_PROPERTY_HEADER_ACP), &uWritten);
        }
    }
}

void CTSFEditWnd::_SaveToFile ( LPTSTR pszFile )

Definition at line 35 of file persist.cpp.

{
    if(pszFile)
    {
        HANDLE  hFile;

        hFile = CreateFile( pszFile,
                            GENERIC_WRITE,
                            0,
                            NULL,
                            CREATE_ALWAYS,
                            FILE_ATTRIBUTE_NORMAL,
                            NULL);

        if(INVALID_HANDLE_VALUE != hFile)
        {
            IStream *pStream;

            //create a stream on global memory
            if(SUCCEEDED(CreateStreamOnHGlobal(NULL, TRUE, &pStream)))
            {
                LARGE_INTEGER   li;

                _Save(pStream);

                //initialize the file
                SetFilePointer(hFile, 0, NULL, FILE_BEGIN);
                SetEndOfFile(hFile);

                //set the stream pointer to the start of the stream
                li.QuadPart = 0;
                pStream->Seek(li, STREAM_SEEK_SET, NULL);

                //write the contents of the stream to the file
                BYTE    buffer[BLOCK_SIZE];
                ULONG   uRead;
                HRESULT hr;

                uRead = 0;
                hr = pStream->Read(buffer, BLOCK_SIZE, &uRead);
                while(uRead > 0)
                {
                    DWORD   dwWritten;

                    WriteFile(hFile, buffer, uRead, &dwWritten, NULL);

                    uRead = 0;
                    hr = pStream->Read(buffer, BLOCK_SIZE, &uRead);
                }

                pStream->Release();
            }

            CloseHandle(hFile);
        }
    }
}

HRESULT CTSFEditWnd::_TerminateAllCompositions ( void )

Definition at line 115 of file context.cpp.

{
    HRESULT hr;
    ITfContextOwnerCompositionServices *pCompServices;

    //get the ITfContextOwnerCompositionServices interface pointer
    hr = m_pContext->QueryInterface(IID_ITfContextOwnerCompositionServices, (LPVOID*)&pCompServices);
    if(SUCCEEDED(hr))
    {
        //passing NULL terminates all compositions
        hr = pCompServices->TerminateComposition(NULL);

        pCompServices->Release();
    }

    return hr;
}

STDMETHODIMP CTSFEditWnd::_TestInsert | ( | LONG | acpTestStart,
 |  | LONG | acpTestEnd,
 |  | ULONG | cch,
 |  | LONG * | pacpResultStart,
 |  | LONG * | pacpResultEnd |
 | ) |  |  | [private]

Definition at line 293 of file textstor.cpp.

{
    //make sure the parameters are within range of the document
    if(acpTestStart > acpTestEnd)
    {
        return E_INVALIDARG;
    }

    //set the start point after the insertion
    *pacpResultStart = acpTestStart;

    //set the end point after the insertion
    *pacpResultEnd = acpTestStart + cch;

    return S_OK;
}

void CTSFEditWnd::_UninitFunctionProvider ( ) [private]

Definition at line 98 of file funcprov.cpp.

{
    HRESULT hr;
    ITfSourceSingle *pSourceSingle;

    hr = m_pThreadMgr->QueryInterface(&pSourceSingle);
    if(SUCCEEDED(hr))
    {
        hr = pSourceSingle->UnadviseSingleSink(m_tfClientID, IID_ITfFunctionProvider);

        pSourceSingle->Release();
    }
}

void CTSFEditWnd::_Uninitialize ( )

Definition at line 302 of file tsfedit.cpp.

{
    if(m_pThreadMgr)
    {
        _UninitFunctionProvider();

#ifdef USE_ASSOC_FOCUS
        ITfDocumentMgr *pTempDocMgr = NULL;

        /*
        Its okay if m_pPrevDocMgr is NULL as this will just disassociate the
        focus from the window.
        */
        m_pThreadMgr->AssociateFocus(m_hwndEdit, m_pPrevDocMgr, &pTempDocMgr);

        if(pTempDocMgr)
        {
            pTempDocMgr->Release();
        }

        if(m_pPrevDocMgr)
        {
            m_pPrevDocMgr->Release();
            m_pPrevDocMgr = NULL;
        }
#endif

        int i;

        for (i = 0; i < NUM_SUPPORTED_ATTRS; i++)
        {
            VariantClear(&m_rgAttributes[i].varValue);
            VariantClear(&m_rgAttributes[i].varDefaultValue);
            m_rgAttributes[i].dwFlags = ATTR_FLAG_NONE;
        }

        if(m_pDocMgr)
        {
            //pop all of the contexts off of the stack
            m_pDocMgr->Pop(TF_POPF_ALL);

            m_pDocMgr->Release();
            m_pDocMgr = NULL;
        }

        if(m_pDisplayAttrMgr)
        {
            m_pDisplayAttrMgr->Release();
            m_pDisplayAttrMgr = NULL;
        }

        if(m_pContext)
        {
            m_pContext->Release();
            m_pContext = NULL;
        }

        if(m_pCategoryMgr)
        {
            m_pCategoryMgr->Release();
            m_pCategoryMgr = NULL;
        }

        m_pThreadMgr->Release();
        m_pThreadMgr = NULL;
    }
}

void CTSFEditWnd::_UnlockDocument ( ) [private]

Definition at line 760 of file tsfedit.cpp.

{
    HRESULT hr;

    m_fLocked = FALSE;
    m_dwLockType = 0;

    //if there is a pending lock upgrade, grant it
    if(m_fPendingLockUpgrade)
    {
        m_fPendingLockUpgrade = FALSE;

        RequestLock(TS_LF_READWRITE, &hr);
    }

    //if any layout changes occurred during the lock, notify the manager
    if(m_fLayoutChanged)
    {
        m_fLayoutChanged = FALSE;
        m_AdviseSink.pTextStoreACPSink->OnLayoutChange(TS_LC_CHANGE, EDIT_VIEW_COOKIE);
    }
}

void CTSFEditWnd::_UpdateStatusBar ( void ) [private]

Definition at line 827 of file tsfedit.cpp.

{
    int     nParts[2];
    HDC     hdc;
    HFONT   hFont;
    SIZE    size;
    TCHAR   szComposition[MAX_PATH];

    hdc = GetDC(m_hwndStatus);
    hFont = (HFONT)SendMessage(m_hwndStatus, WM_GETFONT, 0, 0);
    hFont = (HFONT)SelectObject(hdc, hFont);

    if(m_cCompositions)
    {
        lstrcpy(szComposition, TEXT("In Composition"));
    }
    else
    {
        lstrcpy(szComposition, TEXT("No Composition"));
    }

    GetTextExtentPoint32(hdc, szComposition, lstrlen(szComposition), &size);
    nParts[0] = size.cx + (GetSystemMetrics(SM_CXEDGE) * 4);

    nParts[1] = -1;

    SendMessage(m_hwndStatus, SB_SIMPLE, FALSE, 0);
    SendMessage(m_hwndStatus, SB_SETPARTS, ARRAYSIZE(nParts), (LPARAM)nParts);

    SendMessage(m_hwndStatus, SB_SETTEXT, 0, (LPARAM)szComposition);
    SendMessage(m_hwndStatus, SB_SETTEXT, 1, (LPARAM)TEXT(""));

    //reset the DC
    SelectObject(hdc, hFont);
    ReleaseDC(m_hwndStatus, hdc);

    //enable/disable the menu items as necessary
    HMENU hMenu = GetMenu(m_hwndParent);
    if(NULL != hMenu)
    {
    }

}

LRESULT CALLBACK CTSFEditWnd::_WndProc | ( | HWND | hWnd,
 |  | UINT | uMessage,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static, private]

Definition at line 428 of file tsfedit.cpp.

{
    CTSFEditWnd *pThis = (CTSFEditWnd*)GetWindowLongPtr(hWnd, THIS_POINTER_OFFSET);

    if((NULL == pThis) && (uMessage != WM_NCCREATE))
    {
        return DefWindowProc(hWnd, uMessage, wParam, lParam);
    }

    switch (uMessage)
    {
    case WM_NCCREATE:
        {
            LPCREATESTRUCT lpcs = (LPCREATESTRUCT)lParam;
            pThis = (CTSFEditWnd*)(lpcs->lpCreateParams);
            SetWindowLongPtr(hWnd, THIS_POINTER_OFFSET, (LONG_PTR)pThis);

            //set the window handle
            pThis->m_hWnd = hWnd;

            /*
            AddRef() the object. Release() will be called in WM_NCDESTROY.
            Many owners will call Release during their WM_DESTROY, but the
            child window isn't destroyed until after the parent, so the object
            gets deleted while the window still exists. Calling Release()
            ourselves in WM_NCDESTROY ensures the object exists for the entire
            life of the window.
            */
            pThis->AddRef();
        }
        break;

    case WM_CREATE:
        return pThis->_OnCreate();

    case WM_SIZE:
        return pThis->_OnSize(wParam, lParam);

    case WM_DESTROY:
        return pThis->_OnDestroy();

    case WM_SETFOCUS:
        return pThis->_OnSetFocus();

    case WM_KILLFOCUS:
        return pThis->_OnKillFocus();

    case WM_COMMAND:
        return pThis->_OnCommand(   GET_WM_COMMAND_ID(wParam, lParam),
                                    GET_WM_COMMAND_CMD(wParam, lParam),
                                    GET_WM_COMMAND_HWND(wParam, lParam));

    case WM_NCDESTROY:
        pThis->Release();

        pThis->m_hWnd = NULL;
        break;

    }

    return DefWindowProc(hWnd, uMessage, wParam, lParam);
}

STDMETHODIMP CTSFEditWnd::AdviseSink | ( | REFIID | riid,
 |  | IUnknown * | punk,
 |  | DWORD | dwMask
 | ) |  |

Definition at line 38 of file textstor.cpp.

{
    OutputDebugString(TEXT("CTSFEditWnd::AdviseSink \n"));

    HRESULT     hr;
    IUnknown    *punkID;

    //Get the "real" IUnknown pointer. This needs to be done for comparison purposes.
    hr = pUnknown->QueryInterface(IID_IUnknown, (LPVOID*)&punkID);
    if(FAILED(hr))
    {
        return hr;
    }

    hr = E_INVALIDARG;

    //see if this advise sink already exists
    if(punkID == m_AdviseSink.punkID)
    {
        //this is the same advise sink, so just update the advise mask
        m_AdviseSink.dwMask = dwMask;

        hr = S_OK;
    }
    else if(NULL != m_AdviseSink.punkID)
    {
        //only one advise sink is allowed at a time
        hr = CONNECT_E_ADVISELIMIT;
    }
    else if(IsEqualIID(riid, IID_ITextStoreACPSink))
    {
        //set the advise mask
        m_AdviseSink.dwMask = dwMask;

        /*
        Set the IUnknown pointer. This is used for comparison in
        UnadviseSink and future calls to this method.
        */
        m_AdviseSink.punkID = punkID;

        //AddRef this because it will get released below and it needs to be kept
        punkID->AddRef();

        //get the ITextStoreACPSink interface
        pUnknown->QueryInterface(IID_ITextStoreACPSink, (LPVOID*)&m_AdviseSink.pTextStoreACPSink);

        //get the ITextStoreACPServices interface
        pUnknown->QueryInterface(IID_ITextStoreACPServices, (LPVOID*)&m_pServices);

        hr = S_OK;
    }

    //this isn't needed anymore
    punkID->Release();

    return hr;
}

STDMETHODIMP CTSFEditWnd::FindNextAttrTransition | ( | LONG | acpStart,
 |  | LONG | acpHalt,
 |  | ULONG | cFilterAttrs,
 |  | const TS_ATTRID * | paFilterAttrs,
 |  | DWORD | dwFlags,
 |  | LONG * | pacpNext,
 |  | BOOL * | pfFound,
 |  | LONG * | plFoundOffset
 | ) |  |

Definition at line 918 of file textstor.cpp.

{
    OutputDebugString(TEXT("CTSFEditWnd::FindNextAttrTransition \n"));

    return E_NOTIMPL;
}

STDMETHODIMP CTSFEditWnd::GetACPFromPoint | ( | TsViewCookie | vcView,
 |  | const POINT * | pt,
 |  | DWORD | dwFlags,
 |  | LONG * | pacp
 | ) |  |

Definition at line 1034 of file textstor.cpp.

{
    OutputDebugString(TEXT("CTSFEditWnd::GetACPFromPoint \n"));

    return E_NOTIMPL;
}

STDMETHODIMP CTSFEditWnd::GetActiveView ( TsViewCookie * pvcView )

Definition at line 1018 of file textstor.cpp.

{
    OutputDebugString(TEXT("CTSFEditWnd::GetActiveView \n"));

    //this app only supports one view, so this can be constant
    *pvcView = EDIT_VIEW_COOKIE;

    return S_OK;
}

STDMETHODIMP CTSFEditWnd::GetDescription ( BSTR * pbstrDesc )

Definition at line 44 of file funcprov.cpp.

{
    *pbstrDesc = SysAllocString(L"TSFApp Function Provider");

    return *pbstrDesc ? S_OK : E_OUTOFMEMORY;
}

STDMETHODIMP CTSFEditWnd::GetEmbedded | ( | LONG | acpPos,
 |  | REFGUID | rguidService,
 |  | REFIID | riid,
 |  | IUnknown ** | ppunk
 | ) |  |

Definition at line 757 of file textstor.cpp.

{
    OutputDebugString(TEXT("CTSFEditWnd::GetEmbedded \n"));

    //this implementation doesn't support embedded objects
    return E_NOTIMPL;
}

STDMETHODIMP CTSFEditWnd::GetEndACP ( LONG * pacp )

Definition at line 989 of file textstor.cpp.

{
    OutputDebugString(TEXT("CTSFEditWnd::GetEndACP \n"));

    //does the caller have a lock
    if(!_IsLocked(TS_LF_READWRITE))
    {
        //the caller doesn't have a lock
        return TS_E_NOLOCK;
    }

    if(IsBadWritePtr(pacp, sizeof(LONG)))
    {
        return E_INVALIDARG;
    }

    _GetCurrentSelection();

    *pacp = m_acpEnd;

    return S_OK;
}

STDMETHODIMP CTSFEditWnd::GetFormattedText | ( | LONG | acpStart,
 |  | LONG | acpEnd,
 |  | IDataObject ** | ppDataObject
 | ) |  |

Definition at line 676 of file textstor.cpp.

{
    OutputDebugString(TEXT("CTSFEditWnd::GetFormattedText \n"));

    if(IsBadWritePtr(ppDataObject, sizeof(IDataObject*)))
    {
        return E_INVALIDARG;
    }

    *ppDataObject = NULL;

    //does the caller have a lock
    if(!_IsLocked(TS_LF_READ))
    {
        //the caller doesn't have a lock
        return TS_E_NOLOCK;
    }

    HRESULT     hr;

    CTSFDataObject *pdo = new CTSFDataObject;
    if(NULL != pdo)
    {
        //get the text
        ULONG   cchOut;

        if(-1 == acpEnd)
        {
            //get the length of all of the text
            hr = GetText(acpStart, acpEnd, NULL, 0, &cchOut, NULL, 0, NULL, NULL);
        }
        else
        {
            cchOut = acpEnd - acpStart;
            hr = S_OK;
        }

        if(SUCCEEDED(hr))
        {
            LPWSTR  pwszTemp = (LPWSTR)GlobalAlloc(GPTR, (cchOut + 1) * sizeof(WCHAR));
            if(NULL != pwszTemp)
            {
                hr = GetText(acpStart, acpEnd, pwszTemp, cchOut, &cchOut, NULL, 0, NULL, NULL);
                pwszTemp[cchOut] = '\0';
                if(SUCCEEDED(hr))
                {
                    //set the text in the data object
                    hr = pdo->_SetText(pwszTemp);
                    if(SUCCEEDED(hr))
                    {
                        //get the IID_IDataObject interface
                        hr = pdo->QueryInterface(IID_IDataObject, (LPVOID*)ppDataObject);
                    }
                }
            }
            else
            {
                hr = E_OUTOFMEMORY;
            }
        }

        //release the interface
        pdo->Release();
    }
    else
    {
        hr = E_OUTOFMEMORY;
    }

    return hr;
}

STDMETHODIMP CTSFEditWnd::GetFunction | ( | REFGUID | rguid,
 |  | REFIID | riid,
 |  | IUnknown ** | ppunk
 | ) |  |

Definition at line 57 of file funcprov.cpp.

{
    HRESULT hr = E_NOINTERFACE;

    *ppunk = NULL;

    if(IsEqualGUID(rguid, GUID_NULL))
    {
    }

    return hr;
}

STDMETHODIMP CTSFEditWnd::GetScreenExt | ( | TsViewCookie | vcView,
 |  | RECT * | prc
 | ) |  |

Definition at line 1206 of file textstor.cpp.

{
    OutputDebugString(TEXT("CTSFEditWnd::GetScreenExt \n"));

    if(IsBadWritePtr(prc, sizeof(RECT)))
    {
        return E_INVALIDARG;
    }

    ZeroMemory(prc, sizeof(RECT));

    if(EDIT_VIEW_COOKIE != vcView)
    {
        return E_INVALIDARG;
    }

    //no lock is necessary for this method.

    GetClientRect(m_hwndEdit, prc);
    MapWindowPoints(m_hwndEdit, NULL, (LPPOINT)prc, 2);

    return S_OK;
}

STDMETHODIMP CTSFEditWnd::GetSelection | ( | ULONG | ulIndex,
 |  | ULONG | ulCount,
 |  | TS_SELECTION_ACP * | pSelection,
 |  | ULONG * | pcFetched
 | ) |  |

Definition at line 320 of file textstor.cpp.

{
    OutputDebugString(TEXT("CTSFEditWnd::GetSelection \n"));

    //verify pSelection
    if(IsBadWritePtr(pSelection, sizeof(TS_SELECTION_ACP) * ulCount))
    {
        return E_INVALIDARG;
    }

    //verify pcFetched
    if(IsBadWritePtr(pcFetched, sizeof(ULONG)))
    {
        return E_INVALIDARG;
    }

    *pcFetched = 0;

    //does the caller have a lock
    if(!_IsLocked(TS_LF_READ))
    {
        //the caller doesn't have a lock
        return TS_E_NOLOCK;
    }

    //check the requested index
    if(TF_DEFAULT_SELECTION == ulIndex)
    {
        ulIndex = 0;
    }
    else if (ulIndex > 1)
    {
        /*
        The index is too high. This app only supports one selection.
        */
        return E_INVALIDARG;
    }

    _GetCurrentSelection();

    //find out which end of the selection the caret (insertion point) is
    POINT   pt;
    LRESULT lPos;
    GetCaretPos(&pt);
    lPos = ::SendMessage(m_hwndEdit, EM_POSFROMCHAR, m_acpStart, 0);

    //if the caret position is the same as the start character, then the selection end is the start of the selection
    m_ActiveSelEnd = ((pt.x == LOWORD(lPos) && pt.y == HIWORD(lPos)) ? TS_AE_START : TS_AE_END);

    pSelection[0].acpStart = m_acpStart;
    pSelection[0].acpEnd = m_acpEnd;
    pSelection[0].style.fInterimChar = m_fInterimChar;
    if(m_fInterimChar)
    {
        /*
        fInterimChar will be set when an intermediate character has been
        set. One example of when this will happen is when an IME is being
        used to enter characters and a character has been set, but the IME
        is still active.
        */
        pSelection[0].style.ase = TS_AE_NONE;
    }
    else
    {
        pSelection[0].style.ase = m_ActiveSelEnd;
    }

    *pcFetched = 1;

    return S_OK;
}

STDMETHODIMP CTSFEditWnd::GetStatus ( TS_STATUS * pdcs )

Definition at line 220 of file textstor.cpp.

{
    OutputDebugString(TEXT("CTSFEditWnd::GetStatus \n"));

    if(IsBadWritePtr(pdcs, sizeof(TS_STATUS)))
    {
        return E_INVALIDARG;
    }

    /*
    Can be zero or:
    TS_SD_READONLY  // if set, document is read only; writes will fail
    TS_SD_LOADING   // if set, document is loading, expect additional inserts
    */
    pdcs->dwDynamicFlags = 0;

    /*
    Can be zero or:
    TS_SS_DISJOINTSEL   // if set, the document supports multiple selections
    TS_SS_REGIONS       // if clear, the document will never contain multiple regions
    TS_SS_TRANSITORY    // if set, the document is expected to have a short lifespan
    TS_SS_NOHIDDENTEXT  // if set, the document will never contain hidden text (for perf)
    */
    pdcs->dwStaticFlags = TS_SS_REGIONS;

    return S_OK;
}

STDMETHODIMP CTSFEditWnd::GetText | ( | LONG | acpStart,
 |  | LONG | acpEnd,
 |  | WCHAR * | pchPlain,
 |  | ULONG | cchPlainReq,
 |  | ULONG * | pcchPlainOut,
 |  | TS_RUNINFO * | prgRunInfo,
 |  | ULONG | ulRunInfoReq,
 |  | ULONG * | pulRunInfoOut,
 |  | LONG * | pacpNext
 | ) |  |

Definition at line 468 of file textstor.cpp.

{
    OutputDebugString(TEXT("CTSFEditWnd::GetText\n"));

    //does the caller have a lock
    if(!_IsLocked(TS_LF_READ))
    {
        //the caller doesn't have a lock
        return TS_E_NOLOCK;
    }

    BOOL    fDoText = cchPlainReq > 0;
    BOOL    fDoRunInfo = ulRunInfoReq > 0;
    LONG    cchTotal;
    HRESULT hr = E_FAIL;

    if(pcchPlainOut)
    {
        *pcchPlainOut = 0;
    }

    if(fDoRunInfo)
    {
        *pulRunInfoOut = 0;
    }

    if(pacpNext)
    {
        *pacpNext = acpStart;
    }

    //get all of the text
    LPWSTR  pwszText;
    hr = _GetText(&pwszText, &cchTotal);
    if(FAILED(hr))
    {
        return hr;
    }

    //validate the start pos
    if((acpStart < 0) || (acpStart > cchTotal))
    {
        hr = TS_E_INVALIDPOS;
    }
    else
    {
        //are we at the end of the document
        if(acpStart == cchTotal)
        {
            hr = S_OK;
        }
        else
        {
            ULONG    cchReq;

            /*
            acpEnd will be -1 if all of the text up to the end is being requested.
            */

            if(acpEnd >= acpStart)
            {
                cchReq = acpEnd - acpStart;
            }
            else
            {
                cchReq = cchTotal - acpStart;
            }

            if(fDoText)
            {
                if(cchReq > cchPlainReq)
                {
                    cchReq = cchPlainReq;
                }

                //extract the specified text range
                LPWSTR  pwszStart = pwszText + acpStart;

                if(pchPlain && cchPlainReq)
                {
                    //the text output is not NULL terminated
                    CopyMemory(pchPlain, pwszStart, cchReq * sizeof(WCHAR));
                }
            }

            //it is possible that only the length of the text is being requested
            if(pcchPlainOut)
            {
                *pcchPlainOut = cchReq;
            }

            if(fDoRunInfo)
            {
                /*
                Runs are used to separate text characters from formatting characters.

                In this example, sequences inside and including the <> are treated as
                control sequences and are not displayed.

                Plain text = "Text formatting."
                Actual text = "Text <B><I>formatting</I></B>."

                If all of this text were requested, the run sequence would look like this:

                prgRunInfo[0].type = TS_RT_PLAIN;   //"Text "
                prgRunInfo[0].uCount = 5;

                prgRunInfo[1].type = TS_RT_HIDDEN;  //<B><I>
                prgRunInfo[1].uCount = 6;

                prgRunInfo[2].type = TS_RT_PLAIN;   //"formatting"
                prgRunInfo[2].uCount = 10;

                prgRunInfo[3].type = TS_RT_HIDDEN;  //</B></I>
                prgRunInfo[3].uCount = 8;

                prgRunInfo[4].type = TS_RT_PLAIN;   //"."
                prgRunInfo[4].uCount = 1;

                TS_RT_OPAQUE is used to indicate characters or character sequences
                that are in the document, but are used privately by the application
                and do not map to text.  Runs of text tagged with TS_RT_OPAQUE should
                NOT be included in the pchPlain or cchPlainOut [out] parameters.
                */

                /*
                This implementation is plain text, so the text only consists of one run.
                If there were multiple runs, it would be an error to have consecuative runs
                of the same type.
                */
                *pulRunInfoOut = 1;
                prgRunInfo[0].type = TS_RT_PLAIN;
                prgRunInfo[0].uCount = cchReq;
            }

            if(pacpNext)
            {
                *pacpNext = acpStart + cchReq;
            }

            hr = S_OK;
        }
    }

    GlobalFree(pwszText);

    return hr;
}

STDMETHODIMP CTSFEditWnd::GetTextExt | ( | TsViewCookie | vcView,
 |  | LONG | acpStart,
 |  | LONG | acpEnd,
 |  | RECT * | prc,
 |  | BOOL * | pfClipped
 | ) |  |

Definition at line 1053 of file textstor.cpp.

{
    OutputDebugString(TEXT("CTSFEditWnd::GetTextExt \n"));

    if(IsBadWritePtr(prc, sizeof(RECT)) || IsBadWritePtr(pfClipped, sizeof(BOOL)))
    {
        return E_INVALIDARG;
    }

    *pfClipped = FALSE;
    ZeroMemory(prc, sizeof(RECT));

    if(EDIT_VIEW_COOKIE != vcView)
    {
        return E_INVALIDARG;
    }

    //does the caller have a lock
    if(!_IsLocked(TS_LF_READ))
    {
        //the caller doesn't have a lock
        return TS_E_NOLOCK;
    }

    //is this an empty request?
    if(acpStart == acpEnd)
    {
        return E_INVALIDARG;
    }

    LONG        lTextLength;
    LONG        lTemp;
    RECT        rc;
    DWORD       dwStart;
    DWORD       dwEnd;
    HDC         hdc;
    HFONT       hfont;
    TEXTMETRIC  tm;
    LONG        lLineHeight;
    LPWSTR      pwszText;
    HRESULT     hr;

    hr = _GetText(&pwszText);
    if(FAILED(hr))
    {
        return hr;
    }

    lTextLength = (LONG)SendMessage(m_hwndEdit, WM_GETTEXTLENGTH, 0, 0);

    //are the start and end reversed?
    if(acpStart > acpEnd)
    {
        lTemp = acpStart;
        acpStart = acpEnd;
        acpEnd = lTemp;
    }

    //request to the end of the text?
    if(-1 == acpEnd)
    {
        acpEnd = lTextLength - 1;
    }

    hdc = GetDC(m_hwndEdit);
    hfont = (HFONT)SendMessage(m_hwndEdit, WM_GETFONT, 0, 0);
    hfont = (HFONT)SelectObject(hdc, hfont);

    //get the position of the start character
    dwStart = (DWORD)SendMessage(m_hwndEdit, EM_POSFROMCHAR, acpStart, 0);
    rc.left = LOWORD(dwStart);
    rc.top = HIWORD(dwStart);

    //get the position of the last character
    /*
    The character offset passed to this method is inclusive. For example, if
    the first character is being requested, acpStart will be 0 and acpEnd will
    be 1. If the last character is requested, acpEnd will not equal a valid
    character, so EM_POSFROMCHAR fails. If the next character is on another
    line, EM_POSFROMCHAR won't return a valid value. To work around this, get
    the position of the beginning of the end character, calculate the width of
    the end character and add the width to the rectangle.
    */
    acpEnd--;
    dwEnd = (DWORD)SendMessage(m_hwndEdit, EM_POSFROMCHAR, acpEnd, 0);

    //calculate the width of the last character
    SIZE    size;
    GetTextExtentPoint32(hdc, pwszText + acpEnd, 1, &size);
    rc.right = LOWORD(dwEnd) + size.cx;
    rc.bottom = HIWORD(dwEnd);

    //calculate the line height
    GetTextMetrics(hdc, &tm);
    lLineHeight = tm.tmHeight;

    SelectObject(hdc, hfont);
    ReleaseDC(m_hwndEdit, hdc);

    /*
    If the text range spans multiple lines, expand the rectangle to include all
    of the requested text.
    */
    if(rc.bottom > rc.top)
    {
        DWORD   dwMargins;
        RECT    rcEdit;

        GetClientRect(m_hwndEdit, &rcEdit);

        dwMargins = (DWORD)SendMessage(m_hwndEdit, EM_GETMARGINS, 0, 0);

        //set the left point of the rectangle to the left margin of the edit control
        rc.left = LOWORD(dwMargins);

        //set the right member to the width of the edit control less both the right margin
        rc.right = rc.right - HIWORD(dwMargins);
    }

    //add the line height to the bottom of the rectangle
    rc.bottom += lLineHeight;

    *prc = rc;

    //if any part of the text rectangle is not visible, set *pfClipped to TRUE
    GetClientRect(m_hwndEdit, &rc);

    if( (prc->left < rc.left) ||
        (prc->top < rc.top) ||
        (prc->right > rc.right) ||
        (prc->bottom > rc.bottom))
    {
        *pfClipped = TRUE;
    }

    //convert the rectangle to screen coordinates
    MapWindowPoints(m_hwndEdit, NULL, (LPPOINT)prc, 2);

    GlobalFree(pwszText);

    return S_OK;
}

STDMETHODIMP CTSFEditWnd::GetType ( GUID * pguid )

Definition at line 31 of file funcprov.cpp.

{
    *pguid = GUID_NULL;

    return S_OK;
}

STDMETHODIMP CTSFEditWnd::GetWnd | ( | TsViewCookie | vcView,
 |  | HWND * | phwnd
 | ) |  |

Definition at line 1236 of file textstor.cpp.

{
    OutputDebugString(TEXT("CTSFEditWnd::GetWnd \n"));

    if(EDIT_VIEW_COOKIE == vcView)
    {
        *phwnd = _GetWindow();

        return S_OK;
    }

    return E_INVALIDARG;
}

STDMETHODIMP CTSFEditWnd::InsertEmbedded | ( | DWORD | dwFlags,
 |  | LONG | acpStart,
 |  | LONG | acpEnd,
 |  | IDataObject * | pDataObject,
 |  | TS_TEXTCHANGE * | pChange
 | ) |  |

Definition at line 791 of file textstor.cpp.

{
    OutputDebugString(TEXT("CTSFEditWnd::InsertEmbedded \n"));

    //this implementation doesn't support embedded objects
    return E_NOTIMPL;
}

STDMETHODIMP CTSFEditWnd::InsertEmbeddedAtSelection | ( | DWORD | dwFlags,
 |  | IDataObject * | pDataObject,
 |  | LONG * | pacpStart,
 |  | LONG * | pacpEnd,
 |  | TS_TEXTCHANGE * | pChange
 | ) |  |

Definition at line 1358 of file textstor.cpp.

{
    OutputDebugString(TEXT("CTSFEditWnd::InsertEmbeddedAtSelection \n"));

    return E_NOTIMPL;
}

STDMETHODIMP CTSFEditWnd::InsertTextAtSelection | ( | DWORD | dwFlags,
 |  | const WCHAR * | pchText,
 |  | ULONG | cch,
 |  | LONG * | pacpStart,
 |  | LONG * | pacpEnd,
 |  | TS_TEXTCHANGE * | pChange
 | ) |  |

Definition at line 1256 of file textstor.cpp.

{
    OutputDebugString(TEXT("CTSFEditWnd::InsertTextAtSelection \n"));

    LONG    lTemp;

    //does the caller have a lock
    if(!_IsLocked(TS_LF_READWRITE))
    {
        //the caller doesn't have a lock
        return TS_E_NOLOCK;
    }

    //verify pwszText
    if(IsBadReadPtr(pwszText, cch * sizeof(WCHAR)))
    {
        return E_INVALIDARG;
    }

    //verify pacpStart
    if(IsBadWritePtr(pacpStart, sizeof(LONG)))
    {
        pacpStart = &lTemp;
    }

    //verify pacpEnd
    if(IsBadWritePtr(pacpEnd, sizeof(LONG)))
    {
        pacpEnd = &lTemp;
    }

    LONG    acpStart;
    LONG    acpOldEnd;
    LONG    acpNewEnd;

    _GetCurrentSelection();

    acpOldEnd = m_acpEnd;
    _TestInsert(m_acpStart, m_acpEnd, cch, &acpStart, &acpNewEnd);

    if(dwFlags & TS_IAS_QUERYONLY)
    {
        *pacpStart = acpStart;
        *pacpEnd = acpOldEnd;
        return S_OK;
    }

    LPWSTR  pwszCopy;

    pwszCopy = (LPWSTR)GlobalAlloc(GMEM_FIXED, (cch + 1) * sizeof(WCHAR));
    if(NULL == pwszCopy)
    {
        return E_OUTOFMEMORY;
    }

    //pwszText will most likely not be NULL terminated
    CopyMemory(pwszCopy, pwszText, cch * sizeof(WCHAR));
    pwszCopy[cch] = 0;

    //don't notify TSF of text and selection changes when in response to a TSF action
    m_fNotify = FALSE;

    //insert the text
    ::SendMessage(m_hwndEdit, EM_REPLACESEL, TRUE, (LPARAM)pwszCopy);

    //set the selection
    ::SendMessage(m_hwndEdit, EM_SETSEL, acpStart, acpNewEnd);

    m_fNotify = TRUE;

    _GetCurrentSelection();

    if(!(dwFlags & TS_IAS_NOQUERY))
    {
        *pacpStart = acpStart;
        *pacpEnd = acpNewEnd;
    }

    //set the TS_TEXTCHANGE members
    pChange->acpStart = acpStart;
    pChange->acpOldEnd = acpOldEnd;
    pChange->acpNewEnd = acpNewEnd;

    GlobalFree(pwszCopy);

    //defer the layout change notification until the document is unlocked
    m_fLayoutChanged = TRUE;

    return S_OK;
}

STDMETHODIMP CTSFEditWnd::OnEndComposition ( ITfCompositionView * pComposition )

Definition at line 85 of file context.cpp.

{
    OutputDebugString(TEXT("CTSFEditWnd::OnEndComposition\n"));

    //find the composition pointer in the array
    ULONG i;
    for(i = 0; i < MAX_COMPOSITIONS; i++)
    {
        if(pComposition == m_rgCompositions[i])
        {
            m_rgCompositions[i]->Release();
            m_rgCompositions[i] = NULL;

            m_cCompositions--;
            break;
        }
    }

    _UpdateStatusBar();

    return S_OK;
}

STDMETHODIMP CTSFEditWnd::OnStartComposition | ( | ITfCompositionView * | pComposition,
 |  | BOOL * | pfOk
 | ) |  |

Definition at line 30 of file context.cpp.

{
    OutputDebugString(TEXT("CTSFEditWnd::OnStartComposition\n"));

    *pfOk = TRUE;

    if(m_cCompositions >= MAX_COMPOSITIONS)
    {
        //can't handle any more compositions
        *pfOk = FALSE;
        return S_OK;
    }

    m_cCompositions++;

    //increment the reference count
    pComposition->AddRef();

    //find an empty slot to put the composition pointer in
    ULONG i;
    for(i = 0; i < MAX_COMPOSITIONS; i++)
    {
        if(NULL == m_rgCompositions[i])
        {
            m_rgCompositions[i] = pComposition;
            break;
        }
    }

    _UpdateStatusBar();

    return S_OK;
}

STDMETHODIMP CTSFEditWnd::OnUpdateComposition | ( | ITfCompositionView * | pComposition,
 |  | ITfRange * | pRangeNew
 | ) |  |

Definition at line 70 of file context.cpp.

{
    OutputDebugString(TEXT("CTSFEditWnd::OnUpdateComposition\n"));

    _UpdateStatusBar();

    return S_OK;
}

STDMETHODIMP CTSFEditWnd::QueryInsert | ( | LONG | acpTestStart,
 |  | LONG | acpTestEnd,
 |  | ULONG | cch,
 |  | LONG * | pacpResultStart,
 |  | LONG * | pacpResultEnd
 | ) |  |

Definition at line 254 of file textstor.cpp.

{
    OutputDebugString(TEXT("CTSFEditWnd::QueryInsert\n"));

    LONG   lTextLength;

    lTextLength = GetWindowTextLength(m_hwndEdit);

    //make sure the parameters are within range of the document
    if( (acpTestStart > acpTestEnd) ||
        (acpTestEnd > lTextLength))
    {
        return E_INVALIDARG;
    }

    //set the start point to the given start point
    *pacpResultStart = acpTestStart;

    //set the end point to the given end point
    *pacpResultEnd = acpTestEnd;

    return S_OK;
}

STDMETHODIMP CTSFEditWnd::QueryInsertEmbedded | ( | const GUID * | pguidService,
 |  | const FORMATETC * | pFormatEtc,
 |  | BOOL * | pfInsertable
 | ) |  |

Definition at line 773 of file textstor.cpp.

{
    OutputDebugString(TEXT("CTSFEditWnd::QueryInsertEmbedded \n"));

    //this implementation doesn't support embedded objects
    *pfInsertable = FALSE;

    return S_OK;
}

STDMETHODIMP CTSFEditWnd::QueryInterface | ( | REFIID | riid,
 |  | LPVOID * | ppReturn
 | ) |  |

Definition at line 1689 of file tsfedit.cpp.

{
    *ppReturn = NULL;

    //IUnknown
    if(IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_ITextStoreACP))
    {
        *ppReturn = (ITextStoreACP*)this;
    }

    //ITfContextOwnerCompositionSink
    else if(IsEqualIID(riid, IID_ITfContextOwnerCompositionSink))
    {
        *ppReturn = (ITfContextOwnerCompositionSink*)this;
    }

    //ITfFunctionProvider
    else if(IsEqualIID(riid, IID_ITfFunctionProvider))
    {
        *ppReturn = (ITfFunctionProvider*)this;
    }

    if(*ppReturn)
    {
        (*(LPUNKNOWN*)ppReturn)->AddRef();
        return S_OK;
    }

    return E_NOINTERFACE;
}

STDMETHODIMP CTSFEditWnd::RequestAttrsAtPosition | ( | LONG | acpPos,
 |  | ULONG | cFilterAttrs,
 |  | const TS_ATTRID * | paFilterAttrs,
 |  | DWORD | dwFlags
 | ) |  |

Definition at line 850 of file textstor.cpp.

{
    OutputDebugString(TEXT("CTSFEditWnd::RequestAttrsAtPosition \n"));

    int cch = GetWindowTextLength(m_hwndEdit);

    if(acpPos < 0 || acpPos > cch)
    {
        return TS_E_INVALIDPOS;
    }

    _ClearRequestedAttributes();

    /*
    This app doesn't maintain per-character attributes, so just return the default attributes.
    */
    int i;

    for(i = 0; i < NUM_SUPPORTED_ATTRS; i++)
    {
        ULONG x;

        for(x = 0; x < cFilterAttrs; x++)
        {
            if(IsEqualGUID(*m_rgAttributes[i].attrid, paFilterAttrs[x]))
            {
                m_rgAttributes[i].dwFlags = ATTR_FLAG_REQUESTED;
                if(dwFlags & TS_ATTR_FIND_WANT_VALUE)
                {
                    m_rgAttributes[i].dwFlags |= ATTR_FLAG_DEFAULT;
                }
                else
                {
                    //just copy the default value into the regular value
                    VariantCopy(&m_rgAttributes[i].varValue, &m_rgAttributes[i].varDefaultValue);
                }
            }
        }
    }

    return S_OK;
}

STDMETHODIMP CTSFEditWnd::RequestAttrsTransitioningAtPosition | ( | LONG | acpPos,
 |  | ULONG | cFilterAttrs,
 |  | const TS_ATTRID * | paFilterAttrs,
 |  | DWORD | dwFlags
 | ) |  |

Definition at line 902 of file textstor.cpp.

{
    OutputDebugString(TEXT("CTSFEditWnd::RequestAttrsTransitioningAtPosition \n"));

    return E_NOTIMPL;
}

STDMETHODIMP CTSFEditWnd::RequestLock | ( | DWORD | dwLockFlags,
 |  | HRESULT * | phrSession
 | ) |  |

Definition at line 149 of file textstor.cpp.

{
    OutputDebugString(TEXT("CTSFEditWnd::RequestLock \n"));

    if(NULL == m_AdviseSink.pTextStoreACPSink)
    {
        return E_UNEXPECTED;
    }

    if(IsBadWritePtr(phrSession, sizeof(HRESULT)))
    {
        return E_INVALIDARG;
    }

    *phrSession = E_FAIL;

    if(m_fLocked)
    {
        //the document is locked

        if(dwLockFlags & TS_LF_SYNC)
        {
            /*
            The caller wants an immediate lock, but this cannot be granted because
            the document is already locked.
            */
            *phrSession = TS_E_SYNCHRONOUS;
            return S_OK;
        }
        else
        {
            //the request is asynchronous

            /*
            The only type of asynchronous lock request this application
            supports while the document is locked is to upgrade from a read
            lock to a read/write lock. This scenario is referred to as a lock
            upgrade request.
            */
            if(((m_dwLockType & TS_LF_READWRITE) == TS_LF_READ) &&
                ((dwLockFlags & TS_LF_READWRITE) == TS_LF_READWRITE))
            {
                m_fPendingLockUpgrade = TRUE;

                *phrSession = TS_S_ASYNC;

                return S_OK;
            }

        }
        return E_FAIL;
    }

    //lock the document
    _LockDocument(dwLockFlags);

    //call OnLockGranted
    *phrSession = m_AdviseSink.pTextStoreACPSink->OnLockGranted(dwLockFlags);

    //unlock the document
    _UnlockDocument();

    return S_OK;
}

STDMETHODIMP CTSFEditWnd::RequestSupportedAttrs | ( | DWORD | dwFlags,
 |  | ULONG | cFilterAttrs,
 |  | const TS_ATTRID * | paFilterAttrs
 | ) |  |

Definition at line 809 of file textstor.cpp.

{
    OutputDebugString(TEXT("CTSFEditWnd::RequestSupportedAttrs \n"));

    _ClearRequestedAttributes();

    int i;

    for(i = 0; i < NUM_SUPPORTED_ATTRS; i++)
    {
        ULONG x;

        for(x = 0; x < cFilterAttrs; x++)
        {
            if(IsEqualGUID(*m_rgAttributes[i].attrid, paFilterAttrs[x]))
            {
                m_rgAttributes[i].dwFlags = ATTR_FLAG_REQUESTED;
                if(dwFlags & TS_ATTR_FIND_WANT_VALUE)
                {
                    m_rgAttributes[i].dwFlags |= ATTR_FLAG_DEFAULT;
                }
                else
                {
                    //just copy the default value into the regular value
                    VariantCopy(&m_rgAttributes[i].varValue, &m_rgAttributes[i].varDefaultValue);
                }
            }
        }
    }

    return S_OK;
}

STDMETHODIMP CTSFEditWnd::RetrieveRequestedAttrs | ( | ULONG | ulCount,
 |  | TS_ATTRVAL * | paAttrVals,
 |  | ULONG * | pcFetched
 | ) |  |

Definition at line 938 of file textstor.cpp.

{
    OutputDebugString(TEXT("CTSFEditWnd::RetrieveRequestedAttrs \n"));

    ULONG   uFetched = 0;
    int     i;

    for(i = 0; i < NUM_SUPPORTED_ATTRS && ulCount; i++)
    {
        if(m_rgAttributes[i].dwFlags & ATTR_FLAG_REQUESTED)
        {
            paAttrVals->varValue.vt = VT_EMPTY;

            //copy the attribute ID
            CopyMemory(&paAttrVals->idAttr, m_rgAttributes[i].attrid, sizeof(GUID));

            //this app doesn't support overlapped attributes
            paAttrVals->dwOverlapId = 0;

            if (m_rgAttributes[i].dwFlags & ATTR_FLAG_DEFAULT)
            {
                VariantCopy(&paAttrVals->varValue, &m_rgAttributes[i].varDefaultValue);
            }
            else
            {
                VariantCopy(&paAttrVals->varValue, &m_rgAttributes[i].varValue);
            }

            paAttrVals++;
            uFetched++;
            ulCount--;

            //remove the item from the requested state
            VariantClear(&m_rgAttributes[i].varValue);
            m_rgAttributes[i].dwFlags = ATTR_FLAG_NONE;
        }
    }

    *pcFetched = uFetched;

    return S_OK;
}

STDMETHODIMP CTSFEditWnd::SetSelection | ( | ULONG | ulCount,
 |  | const TS_SELECTION_ACP * | pSelection
 | ) |  |

Definition at line 401 of file textstor.cpp.

{
    OutputDebugString(TEXT("CTSFEditWnd::SetSelection \n"));

    //verify pSelection
    if(IsBadReadPtr(pSelection, sizeof(TS_SELECTION_ACP) * ulCount))
    {
        return E_INVALIDARG;
    }

    if(ulCount > 1)
    {
        //this implementaiton only supports a single selection
        return E_INVALIDARG;
    }

    //does the caller have a lock
    if(!_IsLocked(TS_LF_READWRITE))
    {
        //the caller doesn't have a lock
        return TS_E_NOLOCK;
    }

    m_acpStart = pSelection[0].acpStart;
    m_acpEnd = pSelection[0].acpEnd;
    m_fInterimChar = pSelection[0].style.fInterimChar;
    if(m_fInterimChar)
    {
        /*
        fInterimChar will be set when an intermediate character has been
        set. One example of when this will happen is when an IME is being
        used to enter characters and a character has been set, but the IME
        is still active.
        */
        m_ActiveSelEnd = TS_AE_NONE;
    }
    else
    {
        m_ActiveSelEnd = pSelection[0].style.ase;
    }

    //if the selection end is at the start of the selection, reverse the parameters
    LONG    lStart = m_acpStart;
    LONG    lEnd = m_acpEnd;

    if(TS_AE_START == m_ActiveSelEnd)
    {
        lStart = m_acpEnd;
        lEnd = m_acpStart;
    }

    m_fNotify = FALSE;

    ::SendMessage(m_hwndEdit, EM_SETSEL, lStart, lEnd);

    m_fNotify = TRUE;

    return S_OK;
}

STDMETHODIMP CTSFEditWnd::SetText | ( | DWORD | dwFlags,
 |  | LONG | acpStart,
 |  | LONG | acpEnd,
 |  | const WCHAR * | pchText,
 |  | ULONG | cch,
 |  | TS_TEXTCHANGE * | pChange
 | ) |  |

Definition at line 631 of file textstor.cpp.

{
    OutputDebugString(TEXT("CTSFEditWnd::SetText \n"));

    HRESULT hr;

    /*
    dwFlags can be:
    TS_ST_CORRECTION
    */

    if(dwFlags & TS_ST_CORRECTION)
    {
        OutputDebugString(TEXT("\tTS_ST_CORRECTION\n"));
    }

    //set the selection to the specified range
    TS_SELECTION_ACP    tsa;
    tsa.acpStart = acpStart;
    tsa.acpEnd = acpEnd;
    tsa.style.ase = TS_AE_START;
    tsa.style.fInterimChar = FALSE;

    hr = SetSelection(1, &tsa);

    if(SUCCEEDED(hr))
    {
        //call InsertTextAtSelection
        hr = InsertTextAtSelection(TS_IAS_NOQUERY, pchText, cch, NULL, NULL, pChange);
    }

    return hr;
}

CTSFEditWnd::STDMETHOD_ | ( | DWORD | ,
 |  | AddRef |
 | ) |  |
CTSFEditWnd::STDMETHOD_ | ( | DWORD | ,
 |  | Release |
 | ) |  |
STDMETHODIMP CTSFEditWnd::UnadviseSink ( IUnknown * punk )

Definition at line 102 of file textstor.cpp.

{
    OutputDebugString(TEXT("CTSFEditWnd::UnadviseSink \n"));

    HRESULT     hr;
    IUnknown    *punkID;

    /*
    Get the "real" IUnknown pointer. This needs to be done for comparison
    purposes.
    */
    hr = pUnknown->QueryInterface(IID_IUnknown, (LPVOID*)&punkID);
    if(FAILED(hr))
    {
        return hr;
    }

    //find the advise sink
    if(punkID == m_AdviseSink.punkID)
    {
        //remove the advise sink from the list
        _ClearAdviseSink(&m_AdviseSink);

        if(m_pServices)
        {
            m_pServices->Release();
            m_pServices = NULL;
        }

        hr = S_OK;
    }
    else
    {
        hr = CONNECT_E_NOCONNECTION;
    }

    punkID->Release();

    return hr;
}

Member Data Documentation

LONG CTSFEditWnd::m_acpEnd [private]

Definition at line 97 of file tsfedit.h.

LONG CTSFEditWnd::m_acpStart [private]

Definition at line 96 of file tsfedit.h.

TsActiveSelEnd CTSFEditWnd::m_ActiveSelEnd [private]

Definition at line 99 of file tsfedit.h.

ADVISE_SINK CTSFEditWnd::m_AdviseSink [private]

Definition at line 91 of file tsfedit.h.

ULONG CTSFEditWnd::m_cchOldLength [private]

Definition at line 108 of file tsfedit.h.

ULONG CTSFEditWnd::m_cCompositions [private]

Definition at line 101 of file tsfedit.h.

DWORD CTSFEditWnd::m_dwInternalLockType [private]

Definition at line 95 of file tsfedit.h.

DWORD CTSFEditWnd::m_dwLockType [private]

Definition at line 93 of file tsfedit.h.

TfEditCookie CTSFEditWnd::m_EditCookie [private]

Definition at line 90 of file tsfedit.h.

BOOL CTSFEditWnd::m_fInterimChar [private]

Definition at line 98 of file tsfedit.h.

BOOL CTSFEditWnd::m_fLayoutChanged [private]

Definition at line 106 of file tsfedit.h.

BOOL CTSFEditWnd::m_fLocked [private]

Definition at line 92 of file tsfedit.h.

BOOL CTSFEditWnd::m_fNotify [private]

Definition at line 107 of file tsfedit.h.

BOOL CTSFEditWnd::m_fPendingLockUpgrade [private]

Definition at line 94 of file tsfedit.h.

HINSTANCE CTSFEditWnd::m_hInst [private]

Definition at line 80 of file tsfedit.h.

HWND CTSFEditWnd::m_hWnd [private]

Definition at line 81 of file tsfedit.h.

HWND CTSFEditWnd::m_hwndEdit [private]

Definition at line 83 of file tsfedit.h.

HWND CTSFEditWnd::m_hwndParent [private]

Definition at line 82 of file tsfedit.h.

HWND CTSFEditWnd::m_hwndStatus [private]

Definition at line 84 of file tsfedit.h.

DWORD CTSFEditWnd::m_ObjRefCount [private]

Definition at line 79 of file tsfedit.h.

ITfCategoryMgr* CTSFEditWnd::m_pCategoryMgr [private]

Definition at line 104 of file tsfedit.h.

ITfContext* CTSFEditWnd::m_pContext [private]

Definition at line 89 of file tsfedit.h.

ITfDisplayAttributeMgr* CTSFEditWnd::m_pDisplayAttrMgr [private]

Definition at line 105 of file tsfedit.h.

ITfDocumentMgr* CTSFEditWnd::m_pDocMgr [private]

Definition at line 87 of file tsfedit.h.

ITfDocumentMgr* CTSFEditWnd::m_pPrevDocMgr [private]

Definition at line 88 of file tsfedit.h.

ITextStoreACPServices* CTSFEditWnd::m_pServices [private]

Definition at line 100 of file tsfedit.h.

ITfThreadMgr* CTSFEditWnd::m_pThreadMgr [private]

Definition at line 85 of file tsfedit.h.

ATTRIBUTES CTSFEditWnd::m_rgAttributes[NUM_SUPPORTED_ATTRS] [private]

Definition at line 103 of file tsfedit.h.

ITfCompositionView* CTSFEditWnd::m_rgCompositions[MAX_COMPOSITIONS] [private]

Definition at line 102 of file tsfedit.h.

TfClientId CTSFEditWnd::m_tfClientID [private]

Definition at line 86 of file tsfedit.h.

The documentation for this class was generated from the following files:
  • WinUI/tsfapp/tsfedit.h
  • WinUI/tsfapp/context.cpp
  • WinUI/tsfapp/funcprov.cpp
  • WinUI/tsfapp/persist.cpp
  • WinUI/tsfapp/test.cpp
  • WinUI/tsfapp/textstor.cpp
  • WinUI/tsfapp/tsfedit.cpp
Generated on Wed Nov 13 2024 16:57:37 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CTSFMainWnd Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes

CTSFMainWnd Class Reference

#include "tsfwnd.h"

List of all members.

Public Member Functions

CTSFMainWnd (HINSTANCE hInstance)
~CTSFMainWnd ()
BOOL | Initialize (int nCmdShow)

Private Member Functions

void | _CleanupEditWnd (BOOL fNuke)
BOOL | _GetFileName (HWND hwndOwner, LPTSTR lpszFileName, ULONG uChars, BOOL fOpen)
LRESULT | _OnActivate (WPARAM)
LRESULT | _OnCommand (WORD, WORD, HWND)
LRESULT | _OnCreate (VOID)
LRESULT | _OnDestroy (VOID)
LRESULT | _OnInitMenuPopup (WPARAM, LPARAM)
LRESULT | _OnKillFocus (VOID)
LRESULT | _OnNotify (UINT, LPNMHDR)
LRESULT | _OnSetFocus (VOID)
LRESULT | _OnSize (WORD, WORD)

Static Private Member Functions

static LRESULT CALLBACK | _WndProc (HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam)

Private Attributes

HINSTANCE | m_hInst
HWND | m_hWnd
CTSFEditWnd * m_pTSFEditWnd
TfClientId | m_tfClientID

Detailed Description

Definition at line 41 of file tsfwnd.h.

Constructor & Destructor Documentation

CTSFMainWnd::CTSFMainWnd ( HINSTANCE hInstance )

Definition at line 44 of file tsfwnd.cpp.

{
    m_hWnd = NULL;
    m_hInst = hInstance;
    m_pTSFEditWnd = NULL;
    m_tfClientID = 0;
}

CTSFMainWnd::~CTSFMainWnd ( )

Definition at line 58 of file tsfwnd.cpp.

{
    if(m_hWnd)
    {
        DestroyWindow(m_hWnd);
    }

    if(g_pThreadMgr)
    {
        g_pThreadMgr->Deactivate();

        g_pThreadMgr->Release();
        g_pThreadMgr = NULL;
    }
}

Member Function Documentation

void CTSFMainWnd::_CleanupEditWnd ( BOOL fNuke ) [private]

Definition at line 149 of file tsfwnd.cpp.

{
    if(NULL != m_pTSFEditWnd)
    {
        if(fNuke)
        {
            delete m_pTSFEditWnd;
        }

        else
        {
            m_pTSFEditWnd->Release();
        }

        m_pTSFEditWnd = NULL;
    }
}

BOOL CTSFMainWnd::_GetFileName | ( | HWND | hwndOwner,
 |  | LPTSTR | lpszFileName,
 |  | ULONG | uChars,
 |  | BOOL | fOpen |
 | ) |  |  | [private]

Definition at line 431 of file tsfwnd.cpp.

{
    OPENFILENAME    ofn;
    BOOL            fReturn = FALSE;

    *lpszFile = 0;

    ZeroMemory(&ofn, sizeof(ofn));
    ofn.lStructSize = sizeof(OPENFILENAME);
    ofn.hwndOwner   = hwndOwner;
    ofn.lpstrFilter = TEXT("TSFApp Files (*.tsf)\0*.tsf\0");
    ofn.lpstrFile   = lpszFile;
    ofn.nMaxFile    = uChars;
    ofn.Flags       = OFN_HIDEREADONLY | OFN_PATHMUSTEXIST;
    ofn.lpstrDefExt = TEXT("tsf");

    if(fOpen)
    {
        ofn.Flags |= OFN_FILEMUSTEXIST;

        fReturn = GetOpenFileName(&ofn);
    }
    else
    {
        fReturn = GetSaveFileName(&ofn);
    }

    return fReturn;
}

LRESULT CTSFMainWnd::_OnActivate ( WPARAM ) [private]

Definition at line 408 of file tsfwnd.cpp.

{
    return 0;
}

LRESULT CTSFMainWnd::_OnCommand | ( | WORD | wID,
 |  | WORD | wCmd,
 |  | HWND | hWnd |
 | ) |  |  | [private]

Definition at line 279 of file tsfwnd.cpp.

{
    switch(wID)
    {
    case IDM_EXIT:
        PostMessage(m_hWnd, WM_CLOSE, 0, 0);
        break;

    case IDM_ABOUT:
        MessageBox(m_hWnd, TEXT(""), g_szTSFAppTitle, MB_OK | MB_ICONINFORMATION);
        break;

    case IDM_GETPRESERVEDKEY:
        m_pTSFEditWnd->_OnGetPreservedKey();
        break;

    case IDM_GETDISPATTR:
        m_pTSFEditWnd->_GetDisplayAttributes();
        break;

    case IDM_GET_TEXTOWNER:
        m_pTSFEditWnd->_GetTextOwner();
        break;

    case IDM_GET_READING:
        m_pTSFEditWnd->_GetReadingText();
        break;

    case IDM_GET_COMPOSING:
        m_pTSFEditWnd->_GetComposing();
        break;

    case IDM_TERMINATE_COMPOSITION:
        m_pTSFEditWnd->_TerminateAllCompositions();
        break;

    case IDM_RECONVERT:
        m_pTSFEditWnd->_Reconvert();
        break;

    case IDM_PLAYBACK:
        m_pTSFEditWnd->_Playback();
        break;

    case IDM_LOAD:
        {
            TCHAR   szFile[MAX_PATH];

            if(_GetFileName(m_hWnd, szFile, MAX_PATH, TRUE))
            {
                m_pTSFEditWnd->_LoadFromFile(szFile);
            }
        }
        break;

    case IDM_SAVE:
        {
            TCHAR   szFile[MAX_PATH];

            if(_GetFileName(m_hWnd, szFile, MAX_PATH, FALSE))
            {
                m_pTSFEditWnd->_SaveToFile(szFile);
            }
        }
        break;

    case IDM_TEST:
        m_pTSFEditWnd->_OnTest();
        break;
    }

    return 0;
}

LRESULT CTSFMainWnd::_OnCreate ( VOID ) [private]

Definition at line 239 of file tsfwnd.cpp.

{
    m_pTSFEditWnd = new CTSFEditWnd(m_hInst, m_hWnd);

    if(!m_pTSFEditWnd)
    {
        return -1;
    }

    if(!m_pTSFEditWnd->_Initialize(g_pThreadMgr, m_tfClientID))
    {
        _CleanupEditWnd(TRUE);

        return -1;
    }

    return 0;
}

LRESULT CTSFMainWnd::_OnDestroy ( VOID ) [private]

Definition at line 264 of file tsfwnd.cpp.

{
    _CleanupEditWnd(FALSE);

    PostQuitMessage(0);

    return 0;
}

LRESULT CTSFMainWnd::_OnInitMenuPopup | ( | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private]

Definition at line 419 of file tsfwnd.cpp.

{
    return m_pTSFEditWnd->_OnInitMenuPopup(wParam, lParam);
}

LRESULT CTSFMainWnd::_OnKillFocus ( VOID ) [private]

Definition at line 372 of file tsfwnd.cpp.

{
    return 0;
}

LRESULT CTSFMainWnd::_OnNotify | ( | UINT | ,
 |  | LPNMHDR |  |
 | ) |  |  | [private]

Definition at line 383 of file tsfwnd.cpp.

{
    return 0;
}

LRESULT CTSFMainWnd::_OnSetFocus ( VOID ) [private]

Definition at line 359 of file tsfwnd.cpp.

{
    SetFocus(m_pTSFEditWnd->_GetWindow());

    return 0;
}

LRESULT CTSFMainWnd::_OnSize | ( | WORD | wWidth,
 |  | WORD | wHeight |
 | ) |  |  | [private]

Definition at line 394 of file tsfwnd.cpp.

{
    //position the edit window to fill the client area
    MoveWindow(m_pTSFEditWnd->_GetWindow(), 0, 0, wWidth, wHeight, TRUE);

    return 0;
}

LRESULT CALLBACK CTSFMainWnd::_WndProc | ( | HWND | hWnd,
 |  | UINT | uMessage,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static, private]

Definition at line 173 of file tsfwnd.cpp.

{
    CTSFMainWnd *pThis = (CTSFMainWnd*)GetWindowLongPtr(hWnd, THIS_POINTER_OFFSET);

    if((NULL == pThis) && (uMessage != WM_NCCREATE))
    {
        return DefWindowProc(hWnd, uMessage, wParam, lParam);
    }

    switch (uMessage)
    {
    case WM_NCCREATE:
        {
            LPCREATESTRUCT lpcs = (LPCREATESTRUCT)lParam;
            pThis = (CTSFMainWnd*)(lpcs->lpCreateParams);
            SetWindowLongPtr(hWnd, THIS_POINTER_OFFSET, (LONG_PTR)pThis);

            //set the window handle
            pThis->m_hWnd = hWnd;
        }
        break;

    case WM_CREATE:
        return pThis->_OnCreate();

    case WM_SIZE:
        return pThis->_OnSize(LOWORD(lParam), HIWORD(lParam));

    case WM_DESTROY:
        return pThis->_OnDestroy();

    case WM_SETFOCUS:
        return pThis->_OnSetFocus();

    case WM_KILLFOCUS:
        return pThis->_OnKillFocus();

    case WM_ACTIVATE:
        return pThis->_OnActivate(wParam);

    case WM_INITMENUPOPUP:
        return pThis->_OnInitMenuPopup(wParam, lParam);

    case WM_COMMAND:
        return pThis->_OnCommand(   GET_WM_COMMAND_ID(wParam, lParam),
                                    GET_WM_COMMAND_CMD(wParam, lParam),
                                    GET_WM_COMMAND_HWND(wParam, lParam));

    case WM_NCDESTROY:
        pThis->m_hWnd = NULL;
        break;

    }

    return DefWindowProc(hWnd, uMessage, wParam, lParam);
}

BOOL CTSFMainWnd::Initialize ( int nCmdShow )

Definition at line 80 of file tsfwnd.cpp.

{
    HRESULT hr;
#if 1
    hr = CoCreateInstance(  CLSID_TF_ThreadMgr,
                            NULL,
                            CLSCTX_INPROC_SERVER,
                            IID_ITfThreadMgr,
                            (void**)&g_pThreadMgr);
#else
    hr = TF_CreateThreadMgr(&g_pThreadMgr);
#endif
    if(SUCCEEDED(hr))
    {
        hr = g_pThreadMgr->Activate(&m_tfClientID);

        if(SUCCEEDED(hr))
        {
            WNDCLASS  wc;

            ZeroMemory(&wc, sizeof(wc));

            wc.style          = CS_HREDRAW | CS_VREDRAW;
            wc.lpfnWndProc    = CTSFMainWnd::_WndProc;
            wc.cbClsExtra     = 0;
            wc.cbWndExtra     = sizeof(CTSFMainWnd*);
            wc.hInstance      = m_hInst;
            wc.hIcon          = LoadIcon(m_hInst, MAKEINTRESOURCE(IDI_MAIN_ICON));
            wc.hCursor        = LoadCursor(NULL, IDC_ARROW);
            wc.hbrBackground  = (HBRUSH)(COLOR_DESKTOP + 1);
            wc.lpszMenuName   = MAKEINTRESOURCE(IDR_MAIN_MENU);
            wc.lpszClassName  = g_szTSFMainClassName;

            if(0 != RegisterClass(&wc))
            {
                //create the main window
                m_hWnd = CreateWindowEx(    0,
                                            g_szTSFMainClassName,
                                            g_szTSFAppTitle,
                                            WS_OVERLAPPEDWINDOW,
                                            CW_USEDEFAULT,
                                            CW_USEDEFAULT,
                                            CW_USEDEFAULT,
                                            CW_USEDEFAULT,
                                            NULL,
                                            NULL,
                                            m_hInst,
                                            (LPVOID)this);

                if(NULL != m_hWnd)
                {
                    ShowWindow(m_hWnd, nCmdShow);
                    UpdateWindow(m_hWnd);

                    return TRUE;
                }
            }
        }
    }

    return FALSE;
}

Member Data Documentation

HINSTANCE CTSFMainWnd::m_hInst [private]

Definition at line 44 of file tsfwnd.h.

HWND CTSFMainWnd::m_hWnd [private]

Definition at line 45 of file tsfwnd.h.

CTSFEditWnd* CTSFMainWnd::m_pTSFEditWnd [private]

Definition at line 46 of file tsfwnd.h.

TfClientId CTSFMainWnd::m_tfClientID [private]

Definition at line 47 of file tsfwnd.h.

The documentation for this class was generated from the following files:
  • WinUI/tsfapp/tsfwnd.h
  • WinUI/tsfapp/tsfwnd.cpp
Generated on Wed Nov 13 2024 16:57:37 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CTSFPersistentPropertyLoader Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CTSFPersistentPropertyLoader Class Reference

#include "propldr.h"

List of all members.

Public Member Functions

CTSFPersistentPropertyLoader (TF_PERSISTENT_PROPERTY_HEADER_ACP *pHdr, IStream *pStream)
~CTSFPersistentPropertyLoader ()
STDMETHODIMP | LoadProperty (const TF_PERSISTENT_PROPERTY_HEADER_ACP *pHdr, IStream **ppStream)
virtual STDMETHODIMP | QueryInterface (REFIID riid, void **ppvObj)
virtual | STDMETHODIMP_ (ULONG) Release(void)
virtual | STDMETHODIMP_ (ULONG) AddRef(void)

Private Attributes

TF_PERSISTENT_PROPERTY_HEADER_ACP | m_hdr
int | m_ObjRefCount
BYTE * | m_pb

Detailed Description

Definition at line 38 of file propldr.h.

Constructor & Destructor Documentation

CTSFPersistentPropertyLoader::CTSFPersistentPropertyLoader | ( | TF_PERSISTENT_PROPERTY_HEADER_ACP * | pHdr,
 |  | IStream * | pStream
 | ) |  |

Definition at line 30 of file propldr.cpp.

{
    m_ObjRefCount = 1;
    m_hdr = *pHdr;
    m_pb = (BYTE *)GlobalAlloc(GPTR, pHdr->cb);
    if(m_pb)
    {
        pStream->Read(m_pb, pHdr->cb, NULL);
    }
}

CTSFPersistentPropertyLoader::~CTSFPersistentPropertyLoader ( )

Definition at line 47 of file propldr.cpp.

{
    if(m_pb)
    {
        GlobalFree(m_pb);
    }
}

Member Function Documentation

STDMETHODIMP CTSFPersistentPropertyLoader::LoadProperty | ( | const TF_PERSISTENT_PROPERTY_HEADER_ACP * | pHdr,
 |  | IStream ** | ppStream
 | ) |  |

Definition at line 133 of file propldr.cpp.

{
    HRESULT hr;
    IStream *pStream;

    *ppStream = NULL;

    if (m_pb == NULL)
        return E_FAIL; // failed initial mem alloc

    //create a stream to return
    hr = CreateStreamOnHGlobal(NULL, TRUE, &pStream);
    if(SUCCEEDED(hr))
    {
        //write the property data into the stream
        hr = pStream->Write(m_pb, m_hdr.cb, NULL);
        if(SUCCEEDED(hr))
        {
            LARGE_INTEGER   li;

            li.QuadPart = 0;
            hr = pStream->Seek(li, STREAM_SEEK_SET, NULL);
            if(SUCCEEDED(hr))
            {
                *ppStream = pStream;
            }
        }
    }

    return hr;
}

STDAPI CTSFPersistentPropertyLoader::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppvObj |
 | ) |  |  | [virtual]

Definition at line 66 of file propldr.cpp.

{
    if(ppvObj == NULL)
    {
        return E_POINTER;
    }

    *ppvObj = NULL;

    if (IsEqualIID(riid, IID_IUnknown) ||
        IsEqualIID(riid, IID_ITfPersistentPropertyLoaderACP))
    {
        *ppvObj = (ITfPersistentPropertyLoaderACP*)this;
    }

    if (*ppvObj == NULL)
    {
        return E_NOINTERFACE;
    }

    AddRef();
    return S_OK;
}

virtual CTSFPersistentPropertyLoader::STDMETHODIMP_ ( ULONG ) [virtual]
virtual CTSFPersistentPropertyLoader::STDMETHODIMP_ ( ULONG ) [virtual]

Member Data Documentation

TF_PERSISTENT_PROPERTY_HEADER_ACP CTSFPersistentPropertyLoader::m_hdr [private]

Definition at line 55 of file propldr.h.

int CTSFPersistentPropertyLoader::m_ObjRefCount [private]

Definition at line 54 of file propldr.h.

BYTE* CTSFPersistentPropertyLoader::m_pb [private]

Definition at line 56 of file propldr.h.

The documentation for this class was generated from the following files:
  • WinUI/tsfapp/propldr.h
  • WinUI/tsfapp/propldr.cpp
Generated on Wed Nov 13 2024 16:57:37 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CTxSub Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CTxSub Class Reference

#include "txsub.h"

Inherits CSysLCESub.

List of all members.

Public Member Functions

CTxSub (CComSpy *pSpy)
CTxSub ()
STDMETHODIMP | GetEventClass (LPGUID guid)
STDMETHODIMP | GetEventType (EventEnum *e)
STDMETHODIMP | GetInterface (IID *iid)
STDMETHOD() | OnTransactionAbort (COMSVCSEVENTINFO *pInfo, REFGUID guidTx)
STDMETHOD() | OnTransactionCommit (COMSVCSEVENTINFO *pInfo, REFGUID guidTx)
STDMETHOD() | OnTransactionPrepare (COMSVCSEVENTINFO *pInfo, REFGUID guidTx, BOOL bVoteYes)
STDMETHOD() | OnTransactionStart (COMSVCSEVENTINFO *pInfo, REFGUID guidTx, REFGUID tsid, BOOL bRoot)

Detailed Description

Definition at line 28 of file txsub.h.

Constructor & Destructor Documentation

CTxSub::CTxSub ( CComSpy * pSpy ) [inline]

Definition at line 34 of file txsub.h.

  {
    m_pSpy = pSpy;
  }

CTxSub::CTxSub ( ) [inline]

Definition at line 38 of file txsub.h.

  {
    m_pSpy = NULL;
  }

Member Function Documentation

STDMETHODIMP CTxSub::GetEventClass ( LPGUID guid ) [inline, virtual]

Implements CSysLCESub.

Definition at line 52 of file txsub.h.

{*guid = CLSID_ComServiceEvents;return S_OK;}

STDMETHODIMP CTxSub::GetEventType ( EventEnum * e ) [inline, virtual]

Implements CSysLCESub.

Definition at line 51 of file txsub.h.

{*e = Transaction;return S_OK;}

STDMETHODIMP CTxSub::GetInterface ( IID * iid ) [inline, virtual]

Implements CSysLCESub.

Definition at line 53 of file txsub.h.

{*iid = IID_IComTransactionEvents;return S_OK;}

STDMETHODIMP CTxSub::OnTransactionAbort | ( | COMSVCSEVENTINFO * | pInfo,
 |  | REFGUID | guidTx
 | ) |  |

Definition at line 65 of file txsub.Cpp.

{
  m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnTransactionAbort"), GuidToBstr(pInfo->guidApp));

    CComBSTR sguidTx = GuidToBstr(guidTx);
    m_pSpy -> AddParamValueToList(L"*guidTx", sguidTx);

  IF_AUDIT_DO(OnTransactionAborted)(pInfo->perfCount, GuidToBstr(pInfo->guidApp),sguidTx);

  return S_OK;
}

STDMETHODIMP CTxSub::OnTransactionCommit | ( | COMSVCSEVENTINFO * | pInfo,
 |  | REFGUID | guidTx
 | ) |  |

Definition at line 77 of file txsub.Cpp.

{
  m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnTransactionCommit"), GuidToBstr(pInfo->guidApp));

  CComBSTR sguidTx = GuidToBstr(guidTx);
  m_pSpy -> AddParamValueToList(L"*guidTx", sguidTx);

  IF_AUDIT_DO(OnTransactionCommit)(pInfo->perfCount, GuidToBstr(pInfo->guidApp),sguidTx);
  return S_OK;
}

STDMETHODIMP CTxSub::OnTransactionPrepare | ( | COMSVCSEVENTINFO * | pInfo,
 |  | REFGUID | guidTx,
 |  | BOOL | bVoteYes
 | ) |  |

Definition at line 50 of file txsub.Cpp.

{
  m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnTransactionPrepare"), GuidToBstr(pInfo->guidApp));

    CComBSTR sguidTx = GuidToBstr(guidTx);
    m_pSpy -> AddParamValueToList(L"*guidTx", sguidTx);

  m_pSpy -> AddParamValueToList(L"Vote",  bVoteYes == TRUE ? L"Yes" : L"No");

  IF_AUDIT_DO(OnTransactionPrepared)(pInfo->perfCount,GuidToBstr(pInfo->guidApp),
                    sguidTx,
                    bVoteYes);
  return S_OK;
}

STDMETHODIMP CTxSub::OnTransactionStart | ( | COMSVCSEVENTINFO * | pInfo,
 |  | REFGUID | guidTx,
 |  | REFGUID | tsid,
 |  | BOOL | bRoot
 | ) |  |

Definition at line 30 of file txsub.Cpp.

{
  m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnTransactionStart"), GuidToBstr(pInfo->guidApp));

    CComBSTR sGuidTx = GuidToBstr(guidTx);
  m_pSpy -> AddParamValueToList(L"GuidTx", sGuidTx);

  CComBSTR sTsid = GuidToBstr(tsid);
  m_pSpy -> AddParamValueToList(L"tsid", sTsid);

  m_pSpy -> AddParamValueToList(L"Is a Root Tx?", bRoot ? L"Yes" : L"No");

  IF_AUDIT_DO(OnTransactionStart)(pInfo->perfCount,GuidToBstr(pInfo->guidApp),
                    sGuidTx,
                    sTsid,
                    bRoot);

  return S_OK;
}

The documentation for this class was generated from the following files:
  • Com/Administration/Spy/ComSpyCtl/txsub.h
  • Com/Administration/Spy/ComSpyCtl/txsub.Cpp
Generated on Wed Nov 13 2024 16:57:37 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CTypesDialog Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Public Attributes

CTypesDialog Class Reference

#include "wizard.h"

Inherits CDialogBase.

List of all members.

Public Member Functions

CTypesDialog (HWND hWnd, HINSTANCE hInst, CTableCopy *pTableCopy)
virtual | ~CTypesDialog ()
virtual ULONG | Display ()
virtual BOOL | InitControls ()
virtual BOOL | RefreshControls ()
virtual BOOL | ResetTypeLists ()

Static Public Member Functions

static BOOL WINAPI | DlgProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)

Public Attributes

CTableCopy * m_pCTableCopy

Detailed Description

Definition at line 194 of file wizard.h.

Constructor & Destructor Documentation

CTypesDialog::CTypesDialog | ( | HWND | hWnd,
 |  | HINSTANCE | hInst,
 |  | CTableCopy * | pTableCopy
 | ) |  |

Definition at line 304 of file step4.cpp.

  : CDialogBase(hWnd, hInst)
{
  ASSERT(pCTableCopy);
  m_pCTableCopy = pCTableCopy;
}

CTypesDialog::~CTypesDialog ( ) [virtual]

Definition at line 316 of file step4.cpp.

{
}

Member Function Documentation

ULONG CTypesDialog::Display ( ) [virtual]

Implements CDialogBase.

Definition at line 325 of file step4.cpp.

{
  return DialogBoxParam(m_hInst, MAKEINTRESOURCE(IDD_DATA_TYPES), NULL, DlgProc, (LPARAM)this);
}

BOOL WINAPI CTypesDialog::DlgProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 335 of file step4.cpp.

{
  switch(msg)
  {
    case WM_INITDIALOG:
    {
      Busy();
      //Store the "this" pointer, since this is a static method
      CTypesDialog* pThis = (CTypesDialog*)lParam;
      SetWindowLong(hWnd, GWL_USERDATA, (LONG)pThis);

      //On INIT we know we have a valid hWnd to store
      CenterDialog(hWnd);
      pThis->m_hWnd = hWnd;

      //Tell TableCopy to Map the Types from the Source->Target
      //If MapTypes fails, start over, (ie: same as hitting OK)
      if(FAILED(pThis->m_pCTableCopy->MapTypes()))
      {
        EndDialog(hWnd, 0);
        return UNHANDLED_MSG;
      }

      pThis->InitControls();
      pThis->RefreshControls();

      // Now Display the lists of Mappings
      pThis->ResetTypeLists();
      pThis->m_pCTableCopy->m_pCWizard->DestroyPrevStep(WIZ_TYPES);
      return HANDLED_MSG;
    }

    // Now look for WM_NOTIFY messages
    case WM_NOTIFY:
    {
      if(wParam == IDL_FROM_TYPES || wParam == IDL_TO_TYPES)
      {
        //Obtain the "this" pointer
        CTypesDialog* pThis = (CTypesDialog*)GetWindowLong(hWnd, GWL_USERDATA);
        NM_LISTVIEW* pListView = (NM_LISTVIEW*)lParam;

        switch(pListView->hdr.code)
        {
          case LVN_ITEMCHANGED:
          {
            if(pListView->uNewState & LVNI_FOCUSED &&
              pListView->uNewState & LVNI_SELECTED)
            {
              if(wParam == IDL_FROM_TYPES)
              {
                Busy();
                SyncSibling(GetDlgItem(hWnd,IDL_TO_TYPES), GetDlgItem(hWnd,IDL_FROM_TYPES));
                      return HANDLED_MSG;
              }

              if(wParam == IDL_TO_TYPES)
              {
                Busy();
                SyncSibling(GetDlgItem(hWnd,IDL_FROM_TYPES), GetDlgItem(hWnd,IDL_TO_TYPES));
                        return HANDLED_MSG;
              }
              return UNHANDLED_MSG; //No return Value
            }
            return UNHANDLED_MSG;
          }//case LVN_ITEMCHANGED
        }
        return UNHANDLED_MSG;
      }//IDL_TABLES
      return UNHANDLED_MSG;
    }//WM_NOTIFY

    case WM_COMMAND:
    {
      // All buttons are handled the same way

      //Obtain the "this" pointer
      CTypesDialog* pThis = (CTypesDialog*)GetWindowLong(hWnd, GWL_USERDATA);

      switch(GET_WM_COMMAND_ID(wParam, lParam))
      {
                case IDOK:
          //Now copy the Tables
          pThis->m_pCTableCopy->CopyTables();

          Busy();
          pThis->m_pCTableCopy->m_pCWizard->DisplayStep(WIZ_STEP1);
                  return HANDLED_MSG;

        case IDB_PREV:
          Busy();
          pThis->m_pCTableCopy->m_pCWizard->DisplayStep(WIZ_STEP4);
                  return HANDLED_MSG;

        case IDCANCEL:
          Busy();
          EndDialog(hWnd, GET_WM_COMMAND_ID(wParam, lParam));
                  return HANDLED_MSG;
      }
    }
  }

  return UNHANDLED_MSG;
}

BOOL CTypesDialog::InitControls ( ) [virtual]

Definition at line 444 of file step4.cpp.

{
  HWND hWndFrom = GetDlgItem(m_hWnd, IDL_FROM_TYPES);
  HWND hWndTo = GetDlgItem(m_hWnd, IDL_TO_TYPES);

  CDataSource* pCFromDataSource = m_pCTableCopy->m_pCFromTable->m_pCDataSource;
  CDataSource* pCToDataSource = m_pCTableCopy->m_pCToTable->m_pCDataSource;

  //CONNECT_STRING
  wSetDlgItemText(m_hWnd, IDT_FROM_CONNECT, wsz_TYPES_STRING_,
    pCFromDataSource->m_pwszProviderName,
    pCFromDataSource->m_pwszDataSource,
    pCFromDataSource->m_pwszTableTerm,
    m_pCTableCopy->m_pCFromTable->m_wszQualTableName);

  //CONNECT_STRING
  wSetDlgItemText(m_hWnd, IDT_TO_CONNECT, wsz_TYPES_STRING_,
    pCToDataSource->m_pwszProviderName,
    pCToDataSource->m_pwszDataSource,
    pCToDataSource->m_pwszTableTerm,
    m_pCTableCopy->m_pCToTable->m_wszQualTableName);

  //Create the Col ImageList
  HIMAGELIST hColImageList = ImageList_Create(16, 16, ILC_MASK, 1, 0 );

  //IDI_COLUMN - normal column icon
  HICON hIcon = LoadIcon(m_hInst, MAKEINTRESOURCE(IDI_COLUMN));
  ImageList_AddIcon(hColImageList, hIcon);
  //IDI_COLUMNREAD - read-only column icon
  hIcon = LoadIcon(m_hInst, MAKEINTRESOURCE(IDI_COLUMNREAD));
  ImageList_AddIcon(hColImageList, hIcon);
  //IDI_COLUMNLONG - long column icon
  hIcon = LoadIcon(m_hInst, MAKEINTRESOURCE(IDI_COLUMNLONG));
  ImageList_AddIcon(hColImageList, hIcon);

  //Set image list to the Table Window
  ListView_SetImageList(hWndFrom, hColImageList, LVSIL_SMALL);
  ListView_SetImageList(hWndTo, hColImageList, LVSIL_SMALL);

  //Use Extended ListView Styles!
  SendMessage(hWndFrom, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE | LVS_EX_SUBITEMIMAGES, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE | LVS_EX_SUBITEMIMAGES);
  SendMessage(hWndTo, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE | LVS_EX_SUBITEMIMAGES, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_TWOCLICKACTIVATE | LVS_EX_SUBITEMIMAGES);

  //Source ListView COLUMNS
  LV_InsertColumn(hWndFrom, COL_COLNAME,    "ColName");
  LV_InsertColumn(hWndFrom, COL_COLTYPENAME,  "TypeName");
  LV_InsertColumn(hWndFrom, COL_COLTYPE,    "Type");
  LV_InsertColumn(hWndFrom, COL_COLSIZE,    "Size");
  LV_InsertColumn(hWndFrom, COL_COLORDINAL,   "Ordinal");
  LV_InsertColumn(hWndFrom, COL_COLPREC,    "Precision");
  LV_InsertColumn(hWndFrom, COL_COLSCALE,   "Scale");
  LV_InsertColumn(hWndFrom, COL_COLISFIXED,   "ISFIXED");
  LV_InsertColumn(hWndFrom, COL_COLISLONG,    "ISLONG");
  LV_InsertColumn(hWndFrom, COL_COLISNULLABLE,  "ISNULLABLE");
  LV_InsertColumn(hWndFrom, COL_COLWRITE,   "WRITE");
  LV_InsertColumn(hWndFrom, COL_COLISROWID,   "ISROWID");
  LV_InsertColumn(hWndFrom, COL_COLISROWVER,  "ISROWVER");

  //Target ListView COLUMNS
  LV_InsertColumn(hWndTo,   COL_COLNAME,    "ColName");
  LV_InsertColumn(hWndTo,   COL_COLTYPENAME,  "TypeName");
  LV_InsertColumn(hWndTo,   COL_COLTYPE,    "Type");
  LV_InsertColumn(hWndTo,   COL_COLSIZE,    "Size");
  LV_InsertColumn(hWndTo,   COL_COLORDINAL,   "Ordinal");
  LV_InsertColumn(hWndTo,   COL_COLPREC,    "Precision");
  LV_InsertColumn(hWndTo,   COL_COLSCALE,   "Scale");
  LV_InsertColumn(hWndTo,   COL_COLISFIXED,   "ISFIXED");
  LV_InsertColumn(hWndTo,   COL_COLISLONG,    "ISLONG");
  LV_InsertColumn(hWndTo,   COL_COLISNULLABLE,  "ISNULLABLE");
  LV_InsertColumn(hWndTo,   COL_COLWRITE,   "WRITE");
  LV_InsertColumn(hWndTo,   COL_COLISROWID,   "ISROWID");
  LV_InsertColumn(hWndTo,   COL_COLISROWVER,  "ISROWVER");

  //AutoSize all columns
  for(ULONG i=0; i<=COL_COLISROWVER; i++)
  {
    SendMessage(hWndFrom, LVM_SETCOLUMNWIDTH, (WPARAM)i,    (LPARAM)LVSCW_AUTOSIZE_USEHEADER);
    SendMessage(hWndTo, LVM_SETCOLUMNWIDTH, (WPARAM)i,    (LPARAM)LVSCW_AUTOSIZE_USEHEADER);
  }
  return TRUE;
}

BOOL CTypesDialog::RefreshControls ( ) [virtual]

Definition at line 530 of file step4.cpp.

{
  return TRUE;
}

BOOL CTypesDialog::ResetTypeLists ( ) [virtual]

Definition at line 539 of file step4.cpp.

{
  HWND    hWndFrom;       // From data types
  HWND    hWndTo;         // To data types

  WCHAR   wszBuffer[MAX_NAME_LEN];
  CHAR    szBuffer[MAX_NAME_LEN];

  CTable* pCFromTable = m_pCTableCopy->m_pCFromTable;
  CTable* pCToTable = m_pCTableCopy->m_pCToTable;

  // Get window handles to speed up the population
  hWndFrom = GetDlgItem(m_hWnd, IDL_FROM_TYPES);
  hWndTo   = GetDlgItem(m_hWnd, IDL_TO_TYPES);

  // Now populate each list
  for(ULONG i=0;  i<pCFromTable->m_cColumns; i++)
  {
    COLDESC* pCFromColDesc = &pCFromTable->m_rgColDesc[i];
    COLDESC* pCToColDesc = &pCToTable->m_rgColDesc[i];

    //COLNAME (item)
    ConvertToMBCS(pCFromColDesc->wszColName, szBuffer, MAX_NAME_LEN);
    LV_InsertItem(hWndFrom, i, COL_COLNAME, szBuffer, 0, pCFromColDesc->dwFlags & (DBCOLUMNFLAGS_WRITE | DBCOLUMNFLAGS_WRITEUNKNOWN) ? ((pCFromColDesc->dwFlags & DBCOLUMNFLAGS_ISLONG) ? ICON_LONG : ICON_COLUMN) : ICON_READONLY);
    ConvertToMBCS(pCToColDesc->wszColName, szBuffer, MAX_NAME_LEN);
    LV_InsertItem(hWndTo, i, COL_COLNAME, szBuffer, 0, pCToColDesc->dwFlags & (DBCOLUMNFLAGS_WRITE | DBCOLUMNFLAGS_WRITEUNKNOWN) ? ((pCToColDesc->dwFlags & DBCOLUMNFLAGS_ISLONG) ? ICON_LONG : ICON_COLUMN) : ICON_READONLY);

    //COLTYPENAME (subitem)
    pCFromTable->GetTypeNameAndParams(i, wszBuffer);
    ConvertToMBCS(wszBuffer, szBuffer, MAX_NAME_LEN);
    LV_InsertItem(hWndFrom, i, COL_COLTYPENAME, szBuffer);
    pCToTable->GetTypeNameAndParams(i, wszBuffer);
    ConvertToMBCS(wszBuffer, szBuffer, MAX_NAME_LEN);
    LV_InsertItem(hWndTo, i, COL_COLTYPENAME, szBuffer);

    //COLTYPE (subitem)
    ConvertToMBCS(GetDBTypeName(pCFromColDesc->wType), szBuffer, MAX_NAME_LEN);
    LV_InsertItem(hWndFrom, i, COL_COLTYPE, szBuffer);
    ConvertToMBCS(GetDBTypeName(pCToColDesc->wType), szBuffer, MAX_NAME_LEN);
    LV_InsertItem(hWndTo, i, COL_COLTYPE, szBuffer);

    //Ordinal (SubItem)
    sprintf(szBuffer, "%d", pCFromColDesc->iOrdinal);
    LV_InsertItem(hWndFrom, i, COL_COLORDINAL, szBuffer);
    sprintf(szBuffer, "%d", pCToColDesc->iOrdinal);
    LV_InsertItem(hWndTo, i, COL_COLORDINAL, szBuffer);

    //ColumnSize (SubItem)
    sprintf(szBuffer, "%d", pCFromColDesc->ulColumnSize);
    LV_InsertItem(hWndFrom, i, COL_COLSIZE, szBuffer);
    sprintf(szBuffer, "%d", pCToColDesc->ulColumnSize);
    LV_InsertItem(hWndTo, i, COL_COLSIZE, szBuffer);

    //Precision (SubItem)
    sprintf(szBuffer, "%d", pCFromColDesc->bPrecision);
    LV_InsertItem(hWndFrom, i, COL_COLPREC, szBuffer);
    sprintf(szBuffer, "%d", pCToColDesc->bPrecision);
    LV_InsertItem(hWndTo, i, COL_COLPREC, szBuffer);

    //Scale (SubItem)
    sprintf(szBuffer, "%d", pCFromColDesc->bScale);
    LV_InsertItem(hWndFrom, i, COL_COLSCALE, szBuffer);
    sprintf(szBuffer, "%d", pCToColDesc->bScale);
    LV_InsertItem(hWndTo, i, COL_COLSCALE, szBuffer);

    //ISFIXED (SubItem)
    LV_InsertItem(hWndFrom, i, COL_COLISFIXED, pCFromColDesc->dwFlags & DBCOLUMNFLAGS_ISFIXEDLENGTH ? "TRUE" : "FALSE");
    LV_InsertItem(hWndTo, i, COL_COLISFIXED, pCToColDesc->dwFlags & DBCOLUMNFLAGS_ISFIXEDLENGTH ? "TRUE" : "FALSE");

    //ISLONG (SubItem)
    LV_InsertItem(hWndFrom, i, COL_COLISLONG, pCFromColDesc->dwFlags & DBCOLUMNFLAGS_ISLONG ? "TRUE" : "FALSE");
    LV_InsertItem(hWndTo, i, COL_COLISLONG, pCToColDesc->dwFlags & DBCOLUMNFLAGS_ISLONG ? "TRUE" : "FALSE");

    //ISNULLABLE (SubItem)
    LV_InsertItem(hWndFrom, i, COL_COLISNULLABLE, pCFromColDesc->dwFlags & DBCOLUMNFLAGS_ISNULLABLE ? "TRUE" : "FALSE");
    LV_InsertItem(hWndTo, i, COL_COLISNULLABLE, pCToColDesc->dwFlags & DBCOLUMNFLAGS_ISNULLABLE ? "TRUE" : "FALSE");

    //WRITE (SubItem)
    LV_InsertItem(hWndFrom, i, COL_COLWRITE, pCFromColDesc->dwFlags & (DBCOLUMNFLAGS_WRITE | DBCOLUMNFLAGS_WRITEUNKNOWN) ? "TRUE" : "FALSE");
    LV_InsertItem(hWndTo, i, COL_COLWRITE, pCToColDesc->dwFlags & (DBCOLUMNFLAGS_WRITE | DBCOLUMNFLAGS_WRITEUNKNOWN) ? "TRUE" : "FALSE");

    //ISROWID (SubItem)
    LV_InsertItem(hWndFrom, i, COL_COLISROWID, pCFromColDesc->dwFlags & DBCOLUMNFLAGS_ISROWID ? "TRUE" : "FALSE");
    LV_InsertItem(hWndTo, i, COL_COLISROWID, pCToColDesc->dwFlags & DBCOLUMNFLAGS_ISROWID ? "TRUE" : "FALSE");

    //ISROWVER (SubItem)
    LV_InsertItem(hWndFrom, i, COL_COLISROWVER, pCFromColDesc->dwFlags & DBCOLUMNFLAGS_ISROWVER ? "TRUE" : "FALSE");
    LV_InsertItem(hWndTo, i, COL_COLISROWVER, pCToColDesc->dwFlags & DBCOLUMNFLAGS_ISROWVER ? "TRUE" : "FALSE");
  }

  return TRUE;
}

Member Data Documentation

CTableCopy* CTypesDialog::m_pCTableCopy

Definition at line 212 of file wizard.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/tablecopy/wizard.h
  • Dataaccess/oledb/tablecopy/step4.cpp
Generated on Wed Nov 13 2024 16:57:37 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CUnknown Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Private Attributes | Static Private Attributes | Friends

CUnknown Class Reference

#include "cunknown.h"

Inherits CBase.

Inherited by CAsyncXXX< T, ISyncFace, IAsyncFace >, CAsyncXXX< CServer, ITest, CAsyncTest >, and CServer.

List of all members.

Public Member Functions

CUnknown (CMainWindow *pCMainWindow, CMDIChild *pCMDIChild=NULL)
virtual | ~CUnknown ()
virtual HRESULT | AutoQI (DWORD dwCreateOpts)
virtual HRESULT | AutoRelease ()
virtual REFIID | GetDefaultInterface ()
virtual IUnknown ** | GetInterfaceAddress (REFIID riid)
virtual LONG | GetObjectImage ()
virtual UINT | GetObjectMenu ()
virtual WCHAR * | GetObjectName ()
LPUNKNOWN | GetOuterUnknown () const

Protected Member Functions

CUnknown (IUnknown *pUnknownOuter, LPCSTR className="CUnknown")
virtual | ~CUnknown ()
virtual void __stdcall | FinalRelease ()
HRESULT _stdcall | FinishQI (IUnknown *pI, REFIID iid, void **ppv)
virtual HRESULT | Init ()
virtual HRESULT __stdcall | Init (const CFactoryData *pData)=0
virtual ULONG __stdcall | NondelegatingAddRef ()
virtual HRESULT __stdcall | NondelegatingQueryInterface (const IID &, void **)
virtual ULONG __stdcall | NondelegatingRelease ()
virtual HRESULT __stdcall | Quit ()

Static Protected Member Functions

static DWORD | ActiveComponents ()

Private Attributes

long | m_cRef
LPCSTR | m_lpstrClass
IUnknown * | m_pUnknownOuter

Static Private Attributes

static long | s_cActiveComponents = 0

Friends

class | CFactory

Detailed Description

Definition at line 90 of file cunknown.h.

Constructor & Destructor Documentation

CUnknown::CUnknown | ( | IUnknown * | pUnknownOuter,
 |  | LPCSTR | className = "CUnknown" |
 | ) |  |  | [protected]
CUnknown::~CUnknown ( ) [protected, virtual]

Definition at line 57 of file cunknown.cpp.

{
  DEBUGTRACE(_T("In CUnknown dtor"));
  InterlockedDecrement(&s_cActiveComponents) ;
}

CUnknown::CUnknown | ( | CMainWindow * | pCMainWindow,
 |  | CMDIChild * | pCMDIChild = NULL |
 | ) |  |  | [inline]

Definition at line 206 of file cbase.h.

    : CBase(eCUnknown, pCMainWindow, pCMDIChild)
  {
  }

virtual CUnknown::~CUnknown ( ) [inline, virtual]

Definition at line 211 of file cbase.h.

  {
    ReleaseObject(0);
  }

Member Function Documentation

static DWORD CUnknown::ActiveComponents ( ) [inline, static, protected]

Definition at line 116 of file cunknown.h.

    { return s_cActiveComponents ;}

virtual HRESULT CUnknown::AutoQI ( DWORD dwCreateOpts ) [inline, virtual]

Implements CBase.

Definition at line 218 of file cbase.h.

{ return CBase::AutoQI(dwCreateOpts); }

virtual HRESULT CUnknown::AutoRelease ( ) [inline, virtual]

Implements CBase.

Definition at line 219 of file cbase.h.

{ return CBase::AutoRelease();      }

void CUnknown::FinalRelease ( ) [protected, virtual]

Reimplemented in CAsyncXXX< T, ISyncFace, IAsyncFace >.

Definition at line 66 of file cunknown.cpp.

{
  DEBUGTRACE(_T("Increment reference count for final release")) ;
  m_cRef = 1 ;
}

HRESULT _stdcall CUnknown::FinishQI | ( | IUnknown * | pI,
 |  | REFIID | iid,
 |  | void ** | ppv |
 | ) |  |  | [protected]

Definition at line 132 of file cunknown.cpp.

{
#if defined(_DEBUG)
  LPWSTR lpstrIID;
  StringFromIID(iid, &lpstrIID);
  DEBUGTRACE(_T("%s::QueryInterface has been asked for %S returning S_OK"), m_lpstrClass, lpstrIID);
  CoTaskMemFree(lpstrIID);
#endif

  *ppv = pI ;
  pI->AddRef() ;
  return S_OK ;
}

virtual REFIID CUnknown::GetDefaultInterface ( ) [inline, virtual]

Implements CBase.

Definition at line 225 of file cbase.h.

{ return IID_IUnknown;          }

virtual IUnknown** CUnknown::GetInterfaceAddress ( REFIID riid ) [inline, virtual]

Implements CBase.

Definition at line 220 of file cbase.h.

{ return CBase::GetInterfaceAddress(riid);    }

virtual LONG CUnknown::GetObjectImage ( ) [inline, virtual]

Implements CBase.

Definition at line 224 of file cbase.h.

{ return IMAGE_QUESTION;        }

virtual UINT CUnknown::GetObjectMenu ( ) [inline, virtual]

Implements CBase.

Definition at line 223 of file cbase.h.

{ return IDM_UNKNOWNMENU;       }

virtual WCHAR* CUnknown::GetObjectName ( ) [inline, virtual]

Implements CBase.

Definition at line 222 of file cbase.h.

{ return L"Unknown";          }

LPUNKNOWN CUnknown::GetOuterUnknown ( ) const [inline]

Definition at line 123 of file cunknown.h.

    { return m_pUnknownOuter;}

virtual HRESULT __stdcall CUnknown::Init ( const CFactoryData * pData ) [protected, pure virtual]

Implemented in CAsyncXXX< T, ISyncFace, IAsyncFace >.

virtual HRESULT CUnknown::Init ( ) [inline, protected, virtual]

Definition at line 110 of file cunknown.h.

{return S_OK;}

ULONG __stdcall CUnknown::NondelegatingAddRef ( ) [protected, virtual]

Definition at line 105 of file cunknown.cpp.

{
  DEBUGTRACE(_T("In %s::NondelegatingAddRef refcounts = %i"), m_lpstrClass, m_cRef+1);
  return ::InterlockedIncrement(&m_cRef) ;
}

HRESULT __stdcall CUnknown::NondelegatingQueryInterface | ( | const IID & | iid,
 |  | void ** | ppv |
 | ) |  |  | [protected, virtual]

Reimplemented in CAsyncXXX< T, ISyncFace, IAsyncFace >.

Definition at line 77 of file cunknown.cpp.

{
  // CUnknown supports only IUnknown.
#if defined(_DEBUG)
  LPWSTR lpstrIID;
  StringFromIID(iid, &lpstrIID);
  DEBUGTRACE(_T("%s::QueryInterface has been asked for %S returning %s"), m_lpstrClass, lpstrIID,
    iid == IID_IUnknown ? "S_OK" : "E_NOINTERFACE");
  CoTaskMemFree(lpstrIID);
#endif

  CHECKPOINTER(ppv);

  if (iid == IID_IUnknown)
  {
    return FinishQI(reinterpret_cast<LPUNKNOWN>
                       (static_cast<INondelegatingUnknown*>(this)), iid, ppv) ;
  }
  else
  {
    *ppv = NULL ;
    return E_NOINTERFACE ;
  }
}

ULONG __stdcall CUnknown::NondelegatingRelease ( ) [protected, virtual]

Definition at line 114 of file cunknown.cpp.

{
  _ASSERT(m_cRef > 0); // not thread safe
  DEBUGTRACE(_T("In %s::NondelegatingRelease refcounts = %i"), m_lpstrClass, m_cRef-1);
  if (InterlockedDecrement(&m_cRef) == 0)
  {
    FinalRelease() ;
    delete this ;
    return 0 ;
  }
  return m_cRef ;
}

HRESULT _stdcall CUnknown::Quit ( ) [protected, virtual]

Definition at line 147 of file cunknown.cpp.

{
  // clean up any outstanding interfaces including those which have been aggregated
  m_cRef = 1;
  CFactory::s_cServerLocks = 0;
  // the reason the count is 1 is to keep the proxy alive till the client has time to call CUnknown::Release()
  return S_OK;
}

Friends And Related Function Documentation

friend class CFactory [friend]

Definition at line 93 of file cunknown.h.

Member Data Documentation

long CUnknown::m_cRef [private]

Reimplemented from CBase.

Definition at line 131 of file cunknown.h.

LPCSTR CUnknown::m_lpstrClass [private]

Definition at line 139 of file cunknown.h.

IUnknown* CUnknown::m_pUnknownOuter [private]

Definition at line 134 of file cunknown.h.

long CUnknown::s_cActiveComponents = 0 [static, private]

Definition at line 137 of file cunknown.h.

The documentation for this class was generated from the following files:
  • Com/async/server/cunknown.h
  • Dataaccess/oledb/rowsetviewer/cbase.h
  • Com/async/server/cunknown.cpp
Generated on Wed Nov 13 2024 16:57:37 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CUpdateReceipt Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CUpdateReceipt Class Reference

#include "updrec.h"

List of all members.

Public Member Functions

CUpdateReceipt ()
CUpdateReceipt ()
STDMETHODIMP | Activate ()
STDMETHODIMP | Construct (IDispatch *pUnk)
void | FinalRelease ()
STDMETHOD() | InterfaceSupportsErrorInfo (REFIID riid)
STDMETHOD() | InterfaceSupportsErrorInfo (REFIID riid)
STDMETHODIMP_ (void) Deactivate()
STDMETHODIMP_ (BOOL) CanBePooled()
STDMETHOD() | Update (OUT long *plReceiptNo)
STDMETHOD() | Update (OUT long *plReceiptNo)

Private Member Functions

HRESULT | Enlist ()

Private Attributes

BOOL m_bConstructed
BOOL m_bObjectPooled
BOOL m_bShouldEnlist
HDBC | m_hdbc
HENV | m_henv
HSTMT | m_hstmt
CComBSTR | m_sDSN
GUID | m_txuow

Detailed Description

Definition at line 32 of file updrec.h.

Constructor & Destructor Documentation

CUpdateReceipt::CUpdateReceipt ( ) [inline]

Definition at line 52 of file updrec.h.

  {
    m_henv = 0;
    m_hdbc = 0;
    m_hstmt= 0;
    m_bConstructed = FALSE;
    m_txuow = GUID_NULL;
    m_bObjectPooled = FALSE;
  }

CUpdateReceipt::CUpdateReceipt ( ) [inline]

Definition at line 41 of file Updatereceipt.h.

{}

Member Function Documentation

STDMETHODIMP CUpdateReceipt::Activate ( void )

Definition at line 236 of file updrec.Cpp.

{

  //
  //  should only do this when we are being activated in different
  //  tx units of work
  m_bShouldEnlist = FALSE;

  if (!m_bObjectPooled)
    return S_OK;

  HRESULT hr;
  IObjectContext * pObjectContext = NULL;
  hr = CoGetObjectContext(IID_IObjectContext, (void**)&pObjectContext);
  _ASSERTE(pObjectContext);
  GUID txUOW = GUID_NULL;
  IObjectContextInfo  * pObjTx = NULL;
  pObjectContext -> QueryInterface(IID_IObjectContextInfo, (void **)&pObjTx);
  if (pObjTx)
  {
    pObjTx -> GetTransactionId (&txUOW);
    pObjTx -> Release();
  }
  pObjectContext -> Release();

  if (txUOW != m_txuow)
  {
    m_bShouldEnlist = TRUE;
    m_txuow = txUOW;

  }

  return S_OK;
}

STDMETHODIMP CUpdateReceipt::Construct ( IDispatch * pUnk )

Definition at line 41 of file updrec.Cpp.

{

  if (!pUnk)
    return E_UNEXPECTED;
  HRESULT hr;
  IObjectConstructString * pString = NULL;
  hr = pUnk -> QueryInterface(IID_IObjectConstructString, (void **)&pString);
  if (pString)
  {
    CComBSTR s;
    pString -> get_ConstructString(&s);
    WCHAR * p = wcsstr(s.m_str, L"/NP");
    if (p)
    {
      m_bObjectPooled = FALSE;
      *p = NULL;
    }
    else
      m_bObjectPooled = TRUE;

    m_sDSN = s;
    pString -> Release();
    hr = GetConnection(m_sDSN.m_str, &m_henv, &m_hdbc, &m_hstmt, m_bObjectPooled);
    if (FAILED(hr))
    {
      BSTR sResult;
      GetODBCError(m_henv, m_hdbc, NULL, &sResult);
      AtlReportError( CLSID_CUpdateReceipt, sResult, IID_IAccount, hr);
      SysFreeString(sResult);
      return hr;
    }
  }

  m_bConstructed = TRUE;

  return hr;

}

HRESULT CUpdateReceipt::Enlist ( ) [private]

Definition at line 277 of file updrec.Cpp.

{

  HRESULT hr;
  IObjectContext * pObjectContext = NULL;
  hr = CoGetObjectContext(IID_IObjectContext, (void**)&pObjectContext);
  _ASSERTE(pObjectContext);

  IObjectContextInfo  * pObjTx = NULL;
  pObjectContext -> QueryInterface(IID_IObjectContextInfo, (void **)&pObjTx);
  pObjectContext -> Release();
  if (pObjTx)
  {
    ITransaction * pTx = NULL;
    pObjTx -> GetTransaction ((IUnknown **)&pTx);
    RETCODE rc ;
    if (pTx)
    {
      rc = SQLSetConnectOption(m_hdbc, SQL_ATTR_ENLIST_IN_DTC, (UDWORD)pTx);
      if (SQL_FAILED(rc))
      {
#ifdef _DEBUG
        BSTR sErr;
        GetODBCError(m_henv, m_hdbc, m_hstmt, &sErr);
        AtlTrace(L"Warning! Failed to enlist on caller tx in VCAccount!\n");
        AtlTrace(L"ODBC Error: ");
        AtlTrace(sErr);
        AtlTrace(L"\n");
        SysFreeString(sErr);
#endif
        hr = E_FAIL;
      }

      pTx -> Release();
    }

    pObjTx -> Release();
  }

  return hr;
}

void CUpdateReceipt::FinalRelease ( )

Definition at line 210 of file updrec.Cpp.

{
  if (m_hstmt)
    SQLFreeStmt(m_hstmt, SQL_DROP);
  if (m_hdbc)
  {
    SQLDisconnect(m_hdbc);
    SQLFreeConnect(m_hdbc);
  }
  if (m_henv)
    SQLFreeEnv(m_henv);

  m_hstmt = 0;
  m_henv = 0;
  m_hdbc = 0;
}

STDMETHOD() CUpdateReceipt::InterfaceSupportsErrorInfo ( REFIID riid )
STDMETHODIMP CUpdateReceipt::InterfaceSupportsErrorInfo ( REFIID riid )

Definition at line 88 of file updrec.Cpp.

{
  static const IID* arr[] =
  {
    &IID_IUpdateReceipt,
  };

  for (int i=0;i<sizeof(arr)/sizeof(arr[0]);i++)
  {
    // refer to guiddef.h
    if (::InlineIsEqualGUID(*arr[i],riid))
      return S_OK;
  }
  return S_FALSE;
}

CUpdateReceipt::STDMETHODIMP_ ( void ) [inline]

Definition at line 95 of file updrec.h.

  {
  }

CUpdateReceipt::STDMETHODIMP_ ( BOOL ) [inline]

Definition at line 88 of file updrec.h.

  {
    return TRUE;
  }

STDMETHODIMP CUpdateReceipt::Update ( OUT long * plReceiptNo )

Definition at line 113 of file updrec.Cpp.

{

  HRESULT hr = S_OK;
  IObjectContext* pObjectContext = NULL;

  RETCODE rc;
  BSTR sErr = 0;
  long len = 0;
  if (!m_bConstructed)
  {
    m_sDSN = L"FILEDSN=OPBankSamples;DATABASE=pubs;UID=sa;PWD=;APP=OPBank";
    hr = GetConnection(m_sDSN.m_str, &m_henv, &m_hdbc, &m_hstmt, m_bObjectPooled);
    if (FAILED(hr))
    {
      BSTR sResult;
      GetODBCError(m_henv, m_hdbc, NULL, &sResult);
      AtlReportError( CLSID_CAccount, sResult, IID_IAccount, hr);
      SysFreeString(sResult);
      return hr;
    }
  }

  hr = CoGetObjectContext(IID_IObjectContext, (void**)&pObjectContext);
  if (!pObjectContext)
  {
    sErr = SysAllocString(L"No Object Context");
    goto end;
  }

  if (m_bShouldEnlist)
  {
    //
    // NOTE: I know I call SetComplete, so I don't have to set
    //       the m_bShouldEnlist flag to FALSE after I enlist
    //
    hr = Enlist();
    if (FAILED(hr))
      return hr;
  }

  *plReceiptNo = 0;

  rc = SQLExecDirect(m_hstmt, L"Update Receipt set NextReceipt = NextReceipt + 100", SQL_NTS);
  if (SQL_FAILED(rc))
  {
    GetODBCError(m_henv, m_hdbc, m_hstmt, &sErr);
    hr = E_FAIL;
    goto end;

  }

  // Obtain the desired recordset with an SQL query
  rc = SQLExecDirect(m_hstmt, L"SELECT NextReceipt FROM Receipt", SQL_NTS);
  if (SQL_FAILED(rc))
  {
    GetODBCError(m_henv, m_hdbc, m_hstmt, &sErr);
    hr = E_FAIL;
    goto end;

  }
  while (SQLFetch(m_hstmt) == SQL_SUCCESS) // only get the first one for now
  {

    rc = SQLGetData(m_hstmt, 1, SQL_C_LONG, plReceiptNo, 0, &len);
  }

  SQLFreeStmt(m_hstmt, SQL_CLOSE);
  pObjectContext -> SetComplete();

end:

  if (sErr)
  {
    AtlReportError( CLSID_CUpdateReceipt, sErr, IID_IUpdateReceipt, hr);
    SysFreeString(sErr);
    pObjectContext -> SetAbort();
  }

  // (03.22.00 mdl) Release connection if object is not pooled.
  if (!m_bObjectPooled)
  {
    FinalRelease();
  }

  SafeRelease(pObjectContext);
  return hr;

}

STDMETHOD() CUpdateReceipt::Update ( OUT long * plReceiptNo )

Member Data Documentation

BOOL CUpdateReceipt::m_bConstructed [private]

Definition at line 45 of file updrec.h.

BOOL CUpdateReceipt::m_bObjectPooled [private]

Definition at line 48 of file updrec.h.

BOOL CUpdateReceipt::m_bShouldEnlist [private]

Definition at line 47 of file updrec.h.

HDBC CUpdateReceipt::m_hdbc [private]

Definition at line 43 of file updrec.h.

HENV CUpdateReceipt::m_henv [private]

Definition at line 42 of file updrec.h.

HSTMT CUpdateReceipt::m_hstmt [private]

Definition at line 44 of file updrec.h.

CComBSTR CUpdateReceipt::m_sDSN [private]

Definition at line 41 of file updrec.h.

GUID CUpdateReceipt::m_txuow [private]

Definition at line 46 of file updrec.h.

The documentation for this class was generated from the following files:
  • Com/Services/Object_Pooling/OPBankSample/Account.VC/updrec.h
  • Com/Services/Transaction/SampleBank/VCAcct/Updatereceipt.h
  • Com/Services/Object_Pooling/OPBankSample/Account.VC/updrec.Cpp
  • Com/Services/Transaction/SampleBank/VCAcct/Updatereceipt.Cpp
Generated on Wed Nov 13 2024 16:57:37 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CUpdateTextEditSession Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CUpdateTextEditSession Class Reference

Inherits CEditSessionBase.

List of all members.

Public Member Functions

CUpdateTextEditSession (ITfContext *pContext, ITfRange *pRange, CSnoopWnd *pSnoopWnd)
~CUpdateTextEditSession ()
STDMETHODIMP | DoEditSession (TfEditCookie ec)

Private Attributes

ITfRange * | _pRange
CSnoopWnd * _pSnoopWnd

Detailed Description

Definition at line 12 of file snoop.cpp.

Constructor & Destructor Documentation

CUpdateTextEditSession::CUpdateTextEditSession | ( | ITfContext * | pContext,
 |  | ITfRange * | pRange,
 |  | CSnoopWnd * | pSnoopWnd |
 | ) |  |  | [inline]

Definition at line 15 of file snoop.cpp.

                                                                                : CEditSessionBase(pContext)
    {
        _pSnoopWnd = pSnoopWnd;
        _pRange = pRange;
        if (_pRange != NULL)
        {
            _pRange->AddRef();
        }
    }

CUpdateTextEditSession::~CUpdateTextEditSession ( ) [inline]

Definition at line 24 of file snoop.cpp.

    {
        SafeRelease(_pRange);
    }

Member Function Documentation

STDAPI CUpdateTextEditSession::DoEditSession ( TfEditCookie ec ) [virtual]

Implements CEditSessionBase.

Definition at line 215 of file snoop.cpp.

{
    _pSnoopWnd->_UpdateText(ec, _pContext, _pRange);
    return S_OK;
}

Member Data Documentation

ITfRange* CUpdateTextEditSession::_pRange [private]

Definition at line 34 of file snoop.cpp.

CSnoopWnd* CUpdateTextEditSession::_pSnoopWnd [private]

Definition at line 33 of file snoop.cpp.

The documentation for this class was generated from the following file:
  • WinUI/TSFcase/snoop.cpp
Generated on Wed Nov 13 2024 16:57:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CUrlmonCallback Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CUrlmonCallback Class Reference

#include "callback.hpp"

Inherits RecvBuf.

List of all members.

Public Member Functions

CUrlmonCallback (PHTTP_REQUEST_PARAM)
~CUrlmonCallback ()
STDMETHODIMP | BeginningTransaction (LPCWSTR szURL, LPCWSTR szHeaders, DWORD dwReserved, LPWSTR __RPC_FAR *pszAdditionalHeaders)
STDMETHODIMP | GetBindInfo (DWORD *pgrfBINDF, BINDINFO *pbindinfo)
STDMETHODIMP | GetPriority (LONG *pnPriority)
STDMETHODIMP | OnDataAvailable (DWORD grfBSCF, DWORD dwSize, FORMATETC *pfmtetc, STGMEDIUM *pstgmed)
STDMETHODIMP | OnLowResource (DWORD dwReserved)
STDMETHODIMP | OnObjectAvailable (REFIID riid, IUnknown *punk)
STDMETHODIMP | OnProgress (ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR pwzStatusText)
STDMETHODIMP | OnResponse (DWORD dwResponseCode, LPCWSTR szResponseHeaders, LPCWSTR szRequestHeaders, LPWSTR *pszAdditionalRequestHeaders)
STDMETHODIMP | OnStartBinding (DWORD grfBSCOption, IBinding *pBinding)
STDMETHODIMP | OnStopBinding (HRESULT hrResult, LPCWSTR szError)
HRESULT | ParseMultiPartBuffer (BOOL fLastCall)
BOOL | ParseMultiPartHeader (void)
STDMETHODIMP | QueryInterface (REFIID riid, void **ppv)
STDMETHODIMP_ (ULONG) Release(void)
STDMETHODIMP_ (ULONG) AddRef(void)

Public Attributes

HTTP_REQUESTCB_PARAM m_CBParam
DWORD m_cchRangeDelimiter
DWORD m_cRef
DWORD m_dwOffset
DWORD m_dwRangeBeg
DWORD m_dwRangeEnd
DWORD m_dwResponseCode
IBinding * | m_pBinding
PHTTP_REQUEST_PARAM m_pParam
IStream * | m_pstm
PSTR | m_pszRangeDelimiter

Detailed Description

Definition at line 21 of file callback.hpp.

Constructor & Destructor Documentation

CUrlmonCallback::CUrlmonCallback ( PHTTP_REQUEST_PARAM pParam )

Definition at line 30 of file callback.Cpp.

{
    m_pBinding = NULL;
    m_pstm = NULL;
    m_cRef = 0;

    m_pParam = pParam;

    if (m_pParam->punkOuter)
        ((IUnknown *) m_pParam->punkOuter)->AddRef();

    m_CBParam.cbStruct = sizeof(m_CBParam);
    m_CBParam.dwRequestCtx = m_pParam->dwRequestCtx;

    m_dwOffset = 0;
    m_dwResponseCode = 0;
    m_pszRangeDelimiter = NULL;
}

CUrlmonCallback::~CUrlmonCallback ( )

Definition at line 52 of file callback.Cpp.

{
    if (m_pParam->punkOuter)
        ((IUnknown *) m_pParam->punkOuter)->Release();
    if (m_pstm)
        m_pstm->Release();
    if (m_pszRangeDelimiter)
        LocalFree ((HLOCAL) m_pszRangeDelimiter);
}

Member Function Documentation

STDMETHODIMP CUrlmonCallback::BeginningTransaction | ( | LPCWSTR | szURL,
 |  | LPCWSTR | szHeaders,
 |  | DWORD | dwReserved,
 |  | LPWSTR __RPC_FAR * | pszAdditionalHeaders
 | ) |  |
STDMETHODIMP CUrlmonCallback::GetBindInfo | ( | DWORD * | pgrfBINDF,
 |  | BINDINFO * | pbindinfo
 | ) |  |

Definition at line 450 of file callback.Cpp.

{
    *pgrfBINDF = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA;
    *pgrfBINDF |= BINDF_GETNEWESTVERSION;
    pbindInfo->cbSize = sizeof(BINDINFO);
    pbindInfo->szExtraInfo = NULL;
    ZeroMemory (&pbindInfo->stgmedData, sizeof(STGMEDIUM));
    pbindInfo->grfBindInfoF = 0;
    pbindInfo->dwBindVerb = BINDVERB_GET;
    pbindInfo->szCustomVerb = NULL;
    return S_OK;
}

STDMETHODIMP CUrlmonCallback::GetPriority ( LONG * pnPriority )

Definition at line 399 of file callback.Cpp.

{
  UNREFERENCED_PARAMETER(pnPriority);
    return E_NOTIMPL;
}

STDMETHODIMP CUrlmonCallback::OnDataAvailable | ( | DWORD | grfBSCF,
 |  | DWORD | dwSize,
 |  | FORMATETC * | pfmtetc,
 |  | STGMEDIUM * | pstgmed
 | ) |  |

Definition at line 467 of file callback.Cpp.

{
  UNREFERENCED_PARAMETER(dwSize);
  UNREFERENCED_PARAMETER(pfmtetc);
    if (!m_pstm && pstgmed->tymed == TYMED_ISTREAM)
    {
        m_pstm = pstgmed->pstm;
        m_pstm->AddRef();
        m_CBParam.CallbackType = REQUESTCB_DATA;
    }

    // Check for multi-part response.
    if (m_pszRangeDelimiter)
       return ParseMultiPartBuffer (grfBSCF & BSCF_LASTDATANOTIFICATION);

    HRESULT hrRead;
    DWORD cbActual;

    do // until hrRead != S_OK
    {
        // Read some more data.
        hrRead = m_pstm->Read (BufBeg(), BufSize(), &cbActual);

        // Notify the client we got some data.
        if (cbActual)
        {
            m_CBParam.dwDataOffset = m_dwOffset;
            m_CBParam.lpDataBuffer = BufBeg();
            m_CBParam.cbDataLength = cbActual;
            if (!(*(m_pParam->pfnRequestCB)) (&m_CBParam))
            {
                 // Client wants to stop.
                 m_pBinding->Abort();
                 return S_OK;
            }
        }

        m_dwOffset += cbActual;

    } while (hrRead == S_OK);

    return (hrRead == S_FALSE || hrRead == E_PENDING)? S_OK : hrRead;
}

STDMETHODIMP CUrlmonCallback::OnLowResource ( DWORD dwReserved )

Definition at line 408 of file callback.Cpp.

{
  UNREFERENCED_PARAMETER(dwReserved);
    return E_NOTIMPL;
}

STDMETHODIMP CUrlmonCallback::OnObjectAvailable | ( | REFIID | riid,
 |  | IUnknown * | punk
 | ) |  |

Definition at line 514 of file callback.Cpp.

{
  UNREFERENCED_PARAMETER(riid);
  UNREFERENCED_PARAMETER(punk);
    return E_NOTIMPL;
}

STDMETHODIMP CUrlmonCallback::OnProgress | ( | ULONG | ulProgress,
 |  | ULONG | ulProgressMax,
 |  | ULONG | ulStatusCode,
 |  | LPCWSTR | pwzStatusText
 | ) |  |

Definition at line 418 of file callback.Cpp.

{
  UNREFERENCED_PARAMETER(ulProgress);
  UNREFERENCED_PARAMETER(ulProgressMax);
  UNREFERENCED_PARAMETER(ulStatusCode);
  UNREFERENCED_PARAMETER(szStatusText);
    return S_OK;
}

STDMETHODIMP CUrlmonCallback::OnResponse | ( | DWORD | dwResponseCode,
 |  | LPCWSTR | szResponseHeaders,
 |  | LPCWSTR | szRequestHeaders,
 |  | LPWSTR * | pszAdditionalRequestHeaders
 | ) |  |

Definition at line 222 of file callback.Cpp.

{
  UNREFERENCED_PARAMETER(pszAdditionalRequestHeaders);
  UNREFERENCED_PARAMETER(szResponseHeaders);
  UNREFERENCED_PARAMETER(szRequestHeaders);
    // Get the HttpQueryInfo wrapper object.
    IWinInetHttpInfo *pHttpInfo = NULL;
    HRESULT hr = m_pBinding->QueryInterface
        (IID_IWinInetHttpInfo, (void **) &pHttpInfo);
    if (FAILED(hr))
        goto done;

    // Save the response code.
    m_dwResponseCode = dwResponseCode;
    m_CBParam.dwResponseCode = dwResponseCode;

    DWORD cbBuf;

    // Check for partial response.
    if (dwResponseCode == 206)
    {
       // Server responded with byte ranges, ergo must support them.
       m_CBParam.fdwRequestFlags = HTTP_REQUEST_ACCEPT_RANGES;

       // Look for multi-part delimiter embedded in content type.
       const static char szMultiPart[] = "multipart/x-byteranges; boundary";
       const static DWORD cbMultiPart = sizeof(szMultiPart);

       // Get length of buffer to hold content type.
       DWORD cbContentType = 0;
       pHttpInfo->QueryInfo
          (HTTP_QUERY_CONTENT_TYPE, NULL, &cbContentType, NULL, 0);

       if (cbContentType > cbMultiPart + 1)
       {
            // Content type is big enough to embed a delimiter.
            m_pszRangeDelimiter = (PSTR) LocalAlloc (LMEM_FIXED, cbContentType);
            if (!m_pszRangeDelimiter)
            {
                hr = E_OUTOFMEMORY;
                goto done;
            }

            if (S_OK != pHttpInfo->QueryInfo (HTTP_QUERY_CONTENT_TYPE,
                 m_pszRangeDelimiter, &cbContentType, NULL, 0))
            {
                hr = E_FAIL;
                goto done;
            }

            // Split the string at the '='
            m_pszRangeDelimiter[cbMultiPart - 1] = 0;
            if (lstrcmpi (m_pszRangeDelimiter, szMultiPart))
            {
                // Response must not be multi-part.
                LocalFree ((HLOCAL) m_pszRangeDelimiter);
                m_pszRangeDelimiter = NULL;
            }
            else
            {
                m_cchRangeDelimiter =
                    lstrlen (m_pszRangeDelimiter + cbMultiPart);

                // Shift the delimiter to offset 2 of string.
                MoveMemory
                (
                  m_pszRangeDelimiter + 2, // +2 for prefix
                  m_pszRangeDelimiter + cbMultiPart,
                  m_cchRangeDelimiter + 1  // +1 for null
                );

                // Prefix delimiter with "--"
                m_pszRangeDelimiter[0] = '-';
                m_pszRangeDelimiter[1] = '-';
                m_cchRangeDelimiter += 2;

                // Initialize range boundaries.
                m_dwRangeBeg = 0;
                m_dwRangeEnd = 0;
            }

        } // end if (cbContentType > cbMultiPart + 1)

        // Adjust the offset if we have a single range
        if (!m_pszRangeDelimiter)
            m_dwOffset = m_pParam->pRanges[0].dwOffset;
    }

    else // if (dwResponseCode != 206)
    {
        // Check if ranges are supported.
        static char szBytes[] = "bytes";
        char szBuf[sizeof(szBytes)];
        cbBuf = sizeof(szBytes);
        hr = pHttpInfo->QueryInfo
            (HTTP_QUERY_ACCEPT_RANGES, szBuf, &cbBuf, NULL, 0);
        if (SUCCEEDED(hr) && !lstrcmpi (szBytes, szBuf))
            m_CBParam.fdwRequestFlags = HTTP_REQUEST_ACCEPT_RANGES;
        else
            m_CBParam.fdwRequestFlags = 0;
    }

    // Get last modified time.
    SYSTEMTIME stLastModified;
    cbBuf = sizeof(stLastModified);
    hr = pHttpInfo->QueryInfo
    (
        HTTP_QUERY_FLAG_SYSTEMTIME | HTTP_QUERY_LAST_MODIFIED,
        &stLastModified, &cbBuf, NULL, 0
    );
    if (hr != S_OK)
    {
        memset (&stLastModified, 0, sizeof(stLastModified));
        hr = S_OK;
    }
    m_CBParam.pstLastModified = &stLastModified;

    // Get content length.
    m_CBParam.dwContentLength = 0;
    if (dwResponseCode != 206)
    {
        cbBuf = sizeof(m_CBParam.dwContentLength);
        hr = pHttpInfo->QueryInfo
        (
            HTTP_QUERY_FLAG_NUMBER | HTTP_QUERY_CONTENT_LENGTH,
            &m_CBParam.dwContentLength, &cbBuf, NULL, 0
        );
        if (hr != S_OK)
        {
            m_CBParam.dwContentLength = 0;
            hr = S_OK;
        }
    }

    // Inform the client the request is started.
    m_CBParam.CallbackType = REQUESTCB_STARTED;
    if (!(*(m_pParam->pfnRequestCB)) (&m_CBParam))
         m_pBinding->Abort();
    hr = S_OK;

done:

    if (pHttpInfo)
        pHttpInfo->Release();

    return hr;
}

STDMETHODIMP CUrlmonCallback::OnStartBinding | ( | DWORD | grfBSCOption,
 |  | IBinding * | pBinding
 | ) |  |

Definition at line 380 of file callback.Cpp.

{
  UNREFERENCED_PARAMETER(grfBSCOption);
    if (pBinding != NULL)
    {
         m_pBinding = pBinding;
         m_pBinding->AddRef();
    }

    // Initialize receive buffer.
    if (!BufAlloc(RECV_BUF_SIZE))
        return E_OUTOFMEMORY;

    return S_OK;
}

STDMETHODIMP CUrlmonCallback::OnStopBinding | ( | HRESULT | hrResult,
 |  | LPCWSTR | szError
 | ) |  |

Definition at line 431 of file callback.Cpp.

{
  UNREFERENCED_PARAMETER(pszError);
    // Release the binding, which will eventually release the callback object.
    m_pBinding->Release();
    m_pBinding = NULL;

    // Notify the client that we are done.
    m_CBParam.CallbackType = REQUESTCB_DONE;
    m_CBParam.hrRequest = hrStatus;
    (*(m_pParam->pfnRequestCB)) (&m_CBParam);

    return S_OK;
}

HRESULT CUrlmonCallback::ParseMultiPartBuffer ( BOOL fLastCall )

Definition at line 573 of file callback.Cpp.

{
  UNREFERENCED_PARAMETER(fLastCall);
    HRESULT hrRead;
    DWORD cbActual;

    do // until hrRead != S_OK
    {
        // Read data and append to buffer.
        hrRead = m_pstm->Read(m_pbDataEnd, BufSpace(), &cbActual);
        m_pbDataEnd += cbActual;

        // Dispatch to current state handler.
        if (m_dwRangeBeg != m_dwRangeEnd)
            goto process_data;
        else
            goto parse_header;

parse_header:

        // If download not at EOF, don't try to parse multi-part
        // boundary if any chance it would be split across buffers.
        if (hrRead != S_FALSE && m_pbDataBeg > m_pbDataEnd - BOUNDARY_MAXSIZE)
        {
            BufShift();
            continue;
        }

        // Attempt to parse the multi-part boundary.
        if (!ParseMultiPartHeader())
            break;

        // Check if we got termination boundary.
        if (m_dwRangeBeg == m_dwRangeEnd)
            break;

        goto process_data;

process_data:

        // Calculate amount of data to report.
        DWORD cbData   = (DWORD)(m_pbDataEnd  - m_pbDataBeg);
        DWORD cbRange  = m_dwRangeEnd - m_dwRangeBeg;
        DWORD cbLength = min (cbData, cbRange);

        if (cbLength)
        {
            // Call back the client with more data.
            m_CBParam.dwDataOffset = m_dwRangeBeg;
            m_CBParam.lpDataBuffer = m_pbDataBeg;
            m_CBParam.cbDataLength = cbLength;
            if (!(*(m_pParam->pfnRequestCB)) (&m_CBParam))
            {
                 // Client wants to stop.
                 m_pBinding->Abort();
                 break;
            }
            m_dwRangeBeg += cbLength;
        }

        // Adjust the buffer depending on next state.
        if (m_dwRangeBeg == m_dwRangeEnd) // (cbLength == cbRange)
        {
            // Consume the data and look for next header.
            m_pbDataBeg += cbLength;
            goto parse_header;
        }
        else
        {
            // Reset buffer and get some more data.
            BufReset();
            continue;
        }

    } while (hrRead == S_OK);

    return (hrRead == S_FALSE || hrRead == E_PENDING)? S_OK : hrRead;
}

BOOL CUrlmonCallback::ParseMultiPartHeader ( void )

Definition at line 524 of file callback.Cpp.

{
    // multi-part boundary string literals.
    static char szContentType[]  = "Content-Type: ";
    static char szContentRange[] = "Content-Range: bytes ";

// Some macros for prettiness...
#define GrokStr(str) if (!BufScanStr (str, sizeof(str)-1)) return FALSE;
#define GrokInt(pint, delim) if (!BufScanInt (pint,delim)) return FALSE;

  // Check for presence of boundary.
    if (m_dwRangeBeg > 0) // must not be first range
      GrokStr (szLF);   // will also detect a CR-LF
  if (!BufScanStr (m_pszRangeDelimiter, m_cchRangeDelimiter))
      return FALSE;

  // Check for end boundary.
  if
  (    m_pbDataBeg + 2 <= m_pbDataEnd
    && m_pbDataBeg[0] == '-'
    && m_pbDataBeg[1] == '-'
  )
  {
      m_dwRangeBeg = 0;
      m_dwRangeEnd = 0;
      return TRUE;
    }

  // Scan content type and data range.
  GrokStr (szLF);
  GrokStr (szContentType);
  GrokStr (szLF);
  GrokStr (szContentRange);
    GrokInt (&m_dwRangeBeg, '-');
    GrokInt (&m_dwRangeEnd, '/');
    GrokStr (szLF);
    GrokStr (szLF);

    // Range end is inclusive; make it exclusive.
    m_dwRangeEnd++;
    return TRUE;

#undef GrokStr
#undef GrokInt
}

STDMETHODIMP CUrlmonCallback::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppv
 | ) |  |

Definition at line 65 of file callback.Cpp.

{
    if(IsEqualGUID(riid,IID_IUnknown))
        *ppv = (IUnknown *) (IBindStatusCallback *) this;
    else if (IsEqualGUID(riid,IID_IBindStatusCallback))
        *ppv = (IBindStatusCallback *) this;
    else if (IsEqualGUID(riid, IID_IHttpNegotiate))
        *ppv = (IHttpNegotiate *) this;
    else
        *ppv = NULL;

    if (!*ppv)
        return E_NOINTERFACE;

    // Increment our reference count before we hand out our interface
    ((LPUNKNOWN)*ppv)->AddRef();
    return S_OK;

}

CUrlmonCallback::STDMETHODIMP_ ( ULONG )
CUrlmonCallback::STDMETHODIMP_ ( ULONG )

Member Data Documentation

HTTP_REQUESTCB_PARAM CUrlmonCallback::m_CBParam

Definition at line 66 of file callback.hpp.

DWORD CUrlmonCallback::m_cchRangeDelimiter

Definition at line 72 of file callback.hpp.

DWORD CUrlmonCallback::m_cRef

Definition at line 60 of file callback.hpp.

DWORD CUrlmonCallback::m_dwOffset

Definition at line 63 of file callback.hpp.

DWORD CUrlmonCallback::m_dwRangeBeg

Definition at line 73 of file callback.hpp.

DWORD CUrlmonCallback::m_dwRangeEnd

Definition at line 74 of file callback.hpp.

DWORD CUrlmonCallback::m_dwResponseCode

Definition at line 68 of file callback.hpp.

IBinding* CUrlmonCallback::m_pBinding

Definition at line 61 of file callback.hpp.

PHTTP_REQUEST_PARAM CUrlmonCallback::m_pParam

Definition at line 65 of file callback.hpp.

IStream* CUrlmonCallback::m_pstm

Definition at line 62 of file callback.hpp.

PSTR CUrlmonCallback::m_pszRangeDelimiter

Definition at line 71 of file callback.hpp.

The documentation for this class was generated from the following files:
  • Com/Fundamentals/ActiveDocument/Range/callback.hpp
  • Com/Fundamentals/ActiveDocument/Range/callback.Cpp
Generated on Wed Nov 13 2024 16:57:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CUserSub Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CUserSub Class Reference

#include "usersub.h"

Inherits CSysLCESub.

List of all members.

Public Member Functions

CUserSub (CComSpy *pSpy)
CUserSub ()
STDMETHODIMP | GetEventClass (LPGUID guid)
STDMETHODIMP | GetEventType (EventEnum *e)
STDMETHODIMP | GetInterface (IID *iid)
STDMETHODIMP | OnUserEvent (COMSVCSEVENTINFO *pInfo, VARIANT *var)

Detailed Description

Definition at line 30 of file usersub.h.

Constructor & Destructor Documentation

CUserSub::CUserSub ( CComSpy * pSpy ) [inline]

Definition at line 36 of file usersub.h.

  {
    m_pSpy = pSpy;
  }

CUserSub::CUserSub ( ) [inline]

Definition at line 40 of file usersub.h.

  {
    m_pSpy = NULL;
  }

Member Function Documentation

STDMETHODIMP CUserSub::GetEventClass ( LPGUID guid ) [inline, virtual]

Implements CSysLCESub.

Definition at line 54 of file usersub.h.

{*guid = CLSID_ComServiceEvents;return S_OK;}

STDMETHODIMP CUserSub::GetEventType ( EventEnum * e ) [inline, virtual]

Implements CSysLCESub.

Definition at line 53 of file usersub.h.

{*e = User;return S_OK;}

STDMETHODIMP CUserSub::GetInterface ( IID * iid ) [inline, virtual]

Implements CSysLCESub.

Definition at line 55 of file usersub.h.

{*iid = IID_IComUserEvent;return S_OK;}

STDMETHODIMP CUserSub::OnUserEvent | ( | COMSVCSEVENTINFO * | pInfo,
 |  | VARIANT * | var |
 | ) |  |  | [inline]

Definition at line 57 of file usersub.h.

  {
    if (var -> vt == VT_BSTR)
    {
      m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnUserEvent"), GuidToBstr(pInfo->guidApp));
      m_pSpy -> AddParamValueToList(L"String Value",  var->bstrVal);
    }
    else if (var -> vt == VT_UNKNOWN)
    {
      IMtsEventInfo * pEvtInfo = NULL;

      var -> punkVal -> QueryInterface(IID_IMtsEventInfo, (void **)&pEvtInfo);
      if(pEvtInfo)
      {
        CComBSTR s;
        pEvtInfo -> get_DisplayName(&s.m_str);
        m_pSpy -> AddEventToList(pInfo->perfCount, s.m_str, GuidToBstr(pInfo->guidApp));

        long lCount;
        pEvtInfo -> get_Count(&lCount);
        if (lCount)
        {
          VARIANT var;
          LPOLESTR * pKeys = new LPOLESTR[lCount+1];
          IUnknown * pUnk = NULL;
          pEvtInfo -> get_Names(&pUnk);
          _ASSERTE(pUnk);
          IEnumString * pEnum;
          pUnk -> QueryInterface(IID_IEnumString, (void **)&pEnum);
          _ASSERTE(pEnum);
          pUnk -> Release();
          ULONG lFetched;
          pEnum -> Next(lCount, pKeys, &lFetched);
          pEnum -> Release();
          _ASSERTE(lFetched == lCount);
          UINT i;
          for (i=0; i<lFetched; i++)
          {
            s = pKeys[i];
            pEvtInfo -> get_Value(s, &var);
            if (var.vt == VT_BSTR)
            {
              m_pSpy -> AddParamValueToList(pKeys[i],  var.bstrVal);
              VariantClear(&var);
            }
          }
          for (i=0;i<lCount;i++)
            CoTaskMemFree(pKeys[i]);

          delete pKeys;
        }
        pEvtInfo -> Release();
      }
    }
    else
      m_pSpy -> AddEventToList(pInfo->perfCount, _TEXT("OnUserEvent"), GuidToBstr(pInfo->guidApp));

    return S_OK;
  }

The documentation for this class was generated from the following file:
  • Com/Administration/Spy/ComSpyCtl/usersub.h
Generated on Wed Nov 13 2024 16:57:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CUtil Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CUtil Class Reference

#include "util.h"

List of all members.

Public Member Functions

CUtil ()
~CUtil ()
WCHAR * | GetConn ()
WCHAR * | GetSql ()
CHAR * | GetUsername ()
BOOL HasReadAccess ()
BOOL HasWriteAccess ()
void | RaiseError (HRESULT hr)
void | SetConn (BSTR conn)
void | SetIniFile (BSTR args)
void | SetSql (BSTR str)

Private Member Functions

CHAR * | GetIniString (CHAR *section, CHAR *key)
void | ParseConn (WCHAR *conn)
void | SetSection (void)
void | SubstituteParameters (CUtilString &RetVal, CHAR *str, WCHAR *params)

Private Attributes

CUtilString m_bstrConn
CUtilString m_bstrDatasource
CUtilString m_bstrIniFile
CUtilString m_bstrSectionConn
CUtilString m_bstrSectionName
CUtilString m_bstrSectionUserlist
CUtilString m_bstrSql
CUtilString m_bstrSqlSection
ULONG m_cLastIniString
long | m_lAccess
CHAR * | m_pszLastIniString
CHAR * | m_pszUsername

Detailed Description

Definition at line 142 of file util.h.

Constructor & Destructor Documentation

CUtil::CUtil ( )

Definition at line 36 of file util.cpp.

{
  m_bstrIniFile = L"msdfmap.ini";
  m_lAccess = UTIL_NOACCESS;

  m_cLastIniString = 4096;
  m_pszLastIniString = new CHAR [m_cLastIniString];

  ULONG namelen = 0;
  GetUserNameA("", &namelen);
  if (namelen == 0)
    namelen = 256;
  m_pszUsername = new CHAR [namelen + 1];
  if (!m_pszUsername)
    ThrowHR(E_OUTOFMEMORY);
    if (!GetUserNameA(m_pszUsername, &namelen))
    m_pszUsername[0] = '\0';

  if (!m_pszLastIniString)
    ThrowHR(E_OUTOFMEMORY);
}

CUtil::~CUtil ( )

Definition at line 62 of file util.cpp.

{
  delete [] m_pszLastIniString;
  delete [] m_pszUsername;
}

Member Function Documentation

WCHAR* CUtil::GetConn ( ) [inline]

Definition at line 151 of file util.h.

{ return (WCHAR *)m_bstrConn; }

CHAR * CUtil::GetIniString | ( | CHAR * | section,
 |  | CHAR * | key |
 | ) |  |  | [private]

Definition at line 211 of file util.cpp.

{
  assert(section);
  assert(key);
  ULONG rc;

  while(1)
  {
    if (!m_pszLastIniString)
      ThrowHR(E_OUTOFMEMORY);

    // Get the value for the key in the section.
    rc = GetPrivateProfileStringA(section, key, "",
      m_pszLastIniString, m_cLastIniString, m_bstrIniFile);
    if (rc == 0)
      m_pszLastIniString[0] = '\0';
    if (rc < (m_cLastIniString-1))
      break;

    // Make the buffer twice as big and try again.
    m_cLastIniString *= 2;
    delete [] m_pszLastIniString;
    m_pszLastIniString = new CHAR [m_cLastIniString];
  }
  return m_pszLastIniString;
}

WCHAR* CUtil::GetSql ( ) [inline]

Definition at line 150 of file util.h.

{ return (WCHAR *)m_bstrSql; }

CHAR* CUtil::GetUsername ( ) [inline]

Definition at line 155 of file util.h.

{ return m_pszUsername; }

BOOL CUtil::HasReadAccess ( ) [inline]

Definition at line 152 of file util.h.

{ return (m_lAccess >= UTIL_READONLY); }

BOOL CUtil::HasWriteAccess ( ) [inline]

Definition at line 153 of file util.h.

{ return (m_lAccess == UTIL_READWRITE); }

void CUtil::ParseConn ( WCHAR * conn ) [private]

Definition at line 403 of file util.cpp.

{
  assert(conn);
  WCHAR *pwszValue;
  WCHAR *pwszSemi;
  CUtilString bstrTemp(conn, true);

  m_bstrDatasource = L"default";

  // Search for the "Data Source" name/value pair.
  pwszValue = FindDatasource(bstrTemp);
  if (!pwszValue)
    return;

  // See if there is more connection string after the value.
  pwszSemi = wcschr(pwszValue, L';');
  if (pwszSemi)
    *pwszSemi = L'\0';

  // Save off the value of "Data Source".
  m_bstrDatasource = pwszValue;
}

void CUtil::RaiseError ( HRESULT hr )

Definition at line 72 of file util.cpp.

{
  CHAR * ErrFileName = GetIniString("logs", "err");

  if (ErrFileName[0])
  {
    FILE * fp = fopen(ErrFileName, "at");
    if (fp)
    {
      time_t t;
      struct tm *ptm;

      time(&t);
      ptm = localtime(&t);
      fprintf(fp, "user=%s, hr=%lX, datetime=%s", GetUsername(), hr, asctime(ptm));
      fclose(fp);
    }
  }
  ThrowHR(hr);
}

void CUtil::SetConn ( BSTR conn )

Definition at line 328 of file util.cpp.

{
  CHAR *pTemp;
  WCHAR *pConn = conn ? conn : L"";

  // Parse the connection string for the value of "Data Source".
  ParseConn(pConn);

  // Figure out the section names.
  SetSection();

  // Get the override for the connection string, if any.
  pTemp = GetIniString(m_bstrSectionConn, "Connect");
  if (*pTemp)
    m_bstrConn = pTemp;
  else
    m_bstrConn = pConn;

  // Get the connect access.
  pTemp = GetIniString(m_bstrSectionConn, "Access");
  m_lAccess = DecodeAccess(pTemp);

  if (m_pszUsername[0])
  {
    pTemp = GetIniString(m_bstrSectionUserlist, m_pszUsername);
    if (*pTemp)
      m_lAccess = DecodeAccess(pTemp);
  }
}

void CUtil::SetIniFile ( BSTR args )

Definition at line 98 of file util.cpp.

{
  if (!args || !wcslen(args))
    return;

  if (wcschr(args, L':') || wcschr(args, L'\\'))
  {
    RaiseError(HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED));  //Handler argument can't specify a path.
    return;
  }

  m_bstrIniFile = args;
}

void CUtil::SetSection ( void ) [private]

Definition at line 291 of file util.cpp.

{
  CHAR *pTemp;

  m_bstrSectionName = m_bstrDatasource;
  m_bstrSectionConn = L"connect ";
  m_bstrSectionConn += m_bstrSectionName;
  pTemp = GetIniString(m_bstrSectionConn, "Access");
  if (!*pTemp)
  {
    m_bstrSectionName = L"default";
    m_bstrSectionConn = L"connect default";
  }
  m_bstrSectionUserlist = L"userlist ";
  m_bstrSectionUserlist += m_bstrSectionName;
}

void CUtil::SetSql ( BSTR str )

Definition at line 247 of file util.cpp.

{
  WCHAR *pLP, *pRP, *pFunc, *pArgs;
  CHAR *pTemp;
  WCHAR *str = bstrStr ? bstrStr : L"";
  CUtilString temp(str, true);  // Make a copy of the string, so we are not destructive.

  // Parse "func(args)" into "func" and "args".
  pFunc = temp;
  pLP = wcschr(pFunc, L'(');
  if (pLP)
  {
    *pLP++ = L'\0';
    pArgs = pLP;
    pRP = wcsrchr(pLP, L')');
    if (pRP)
      *pRP = L'\0';
  }
  else
    pArgs = L"";

  // Figure out the section name and get the override for the sql string, if any.
  m_bstrSqlSection = L"sql ";
  m_bstrSqlSection += pFunc;
  pTemp = GetIniString(m_bstrSqlSection, "Sql");
  if (*pTemp)
  {
    SubstituteParameters(m_bstrSql, pTemp, pArgs);
  }
  else
  {
    m_bstrSqlSection = L"sql default";
    pTemp = GetIniString(m_bstrSqlSection, "Sql");
    if (*pTemp)
      m_bstrSql = pTemp;
    else
      m_bstrSql = str;
  }
}

void CUtil::SubstituteParameters | ( | CUtilString & | RetVal,
 |  | CHAR * | str,
 |  | WCHAR * | params |
 | ) |  |  | [private]

Definition at line 159 of file util.cpp.

{
  assert(pszStr);
  assert(params);
  WCHAR *pStrNext;
  WCHAR *pArgNext;
  CUtilString bstrStr(pszStr, true);
  WCHAR *str;

  // Initialize return value.
  RetVal = L"";

  // Check and initialize input arguments
  str = bstrStr;
  if (!str)
    return;

  while(1)
  {
    // Search for a parameter in the input string.
    pStrNext = FindChr(str, L'?');
    if (!pStrNext)
      break;

    // Append the stuff before the parameter to the output string.
    *pStrNext++ = L'\0';
    RetVal += str;

    // Search for a parameter in the parameter list.
    pArgNext = FindChr(params, L',');
    if (pArgNext)
      *pArgNext++ = L'\0';
    else
      pArgNext = params;

    // Append the parameter to the output string.
    RetVal += params;

    // Next interation.
    str = pStrNext;
    params = pArgNext;
  }

  // Append the last stuff to the output string.
  RetVal += str;
}

Member Data Documentation

CUtilString CUtil::m_bstrConn [private]

Definition at line 179 of file util.h.

CUtilString CUtil::m_bstrDatasource [private]

Definition at line 180 of file util.h.

CUtilString CUtil::m_bstrIniFile [private]

Definition at line 164 of file util.h.

CUtilString CUtil::m_bstrSectionConn [private]

Definition at line 177 of file util.h.

CUtilString CUtil::m_bstrSectionName [private]

Definition at line 176 of file util.h.

CUtilString CUtil::m_bstrSectionUserlist [private]

Definition at line 178 of file util.h.

CUtilString CUtil::m_bstrSql [private]

Definition at line 173 of file util.h.

CUtilString CUtil::m_bstrSqlSection [private]

Definition at line 172 of file util.h.

ULONG CUtil::m_cLastIniString [private]

Definition at line 166 of file util.h.

long CUtil::m_lAccess [private]

Definition at line 181 of file util.h.

CHAR* CUtil::m_pszLastIniString [private]

Definition at line 165 of file util.h.

CHAR* CUtil::m_pszUsername [private]

Definition at line 169 of file util.h.

The documentation for this class was generated from the following files:
  • Dataaccess/rds/handler/vc/util.h
  • Dataaccess/rds/handler/vc/util.cpp
Generated on Wed Nov 13 2024 16:57:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CUtilBSTR Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CUtilBSTR Class Reference

#include "util.h"

List of all members.

Public Member Functions

CUtilBSTR (WCHAR *s)
~CUtilBSTR ()
operator BSTR ()

Private Attributes

BSTR m_bstr

Detailed Description

Definition at line 185 of file util.h.

Constructor & Destructor Documentation

CUtilBSTR::CUtilBSTR ( WCHAR * s ) [inline]

Definition at line 188 of file util.h.

{ m_bstr = SysAllocString(s); }

CUtilBSTR::~CUtilBSTR ( ) [inline]

Definition at line 189 of file util.h.

{ SysFreeString(m_bstr); }

Member Function Documentation

CUtilBSTR::operator BSTR ( ) [inline]

Definition at line 190 of file util.h.

{ return m_bstr; }

Member Data Documentation

BSTR CUtilBSTR::m_bstr [private]

Definition at line 192 of file util.h.

The documentation for this class was generated from the following file:
  • Dataaccess/rds/handler/vc/util.h
Generated on Wed Nov 13 2024 16:57:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CUtilComPtr< T > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CUtilComPtr< T > Class Template Reference

#include "util.h"

List of all members.

Public Member Functions

CUtilComPtr ()
~CUtilComPtr ()
T * | Detach ()
operator T * ()
T ** | operator& ()

Private Attributes

T * | m_p

Detailed Description

template<class T>
class CUtilComPtr< T >

Definition at line 197 of file util.h.

Constructor & Destructor Documentation

template<class T>
CUtilComPtr< T >::CUtilComPtr ( ) [inline]

Definition at line 200 of file util.h.

{ m_p = NULL; }

template<class T>
CUtilComPtr< T >::~CUtilComPtr ( ) [inline]

Definition at line 201 of file util.h.

{ if (m_p) m_p->Release(); }

Member Function Documentation

template<class T>
T* CUtilComPtr< T >::Detach ( ) [inline]

Definition at line 204 of file util.h.

{ T * p = m_p; m_p = NULL; return p; }

template<class T>
CUtilComPtr< T >::operator T * ( ) [inline]

Definition at line 202 of file util.h.

{ return m_p; }

template<class T>
T** CUtilComPtr< T >::operator& ( ) [inline]

Definition at line 203 of file util.h.

{ assert(m_p==NULL); return &m_p; }

Member Data Documentation

template<class T>
T* CUtilComPtr< T >::m_p [private]

Definition at line 206 of file util.h.

The documentation for this class was generated from the following file:
  • Dataaccess/rds/handler/vc/util.h
Generated on Wed Nov 13 2024 16:57:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CUtilitiesDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes

CUtilitiesDlg Class Reference

#include "UtilitiesDlg.h"

List of all members.

Public Types

enum | { IDD = IDD_UTILITIES }

Public Member Functions

CUtilitiesDlg (CWnd *pParent=NULL)
void | set_Catalog (ICOMAdminCatalog *pCatalog)

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
afx_msg void | OnClose ()
virtual BOOL | OnInitDialog ()
afx_msg void | OnJNEC ()
virtual void | OnOK ()
afx_msg void | OnRefresh ()
afx_msg void | OnRouter ()
afx_msg void | OnStart ()
afx_msg void | OnStop ()

Protected Attributes

HICON | m_hIcon

Private Member Functions

void | ReleaseCatalog ()

Private Attributes

int | m_nUtilityOption
int | m_nUtilityType
ICOMAdminCatalog * | m_pCatalog

Detailed Description

Definition at line 30 of file UtilitiesDlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 39 of file UtilitiesDlg.h.

{ IDD = IDD_UTILITIES };

Constructor & Destructor Documentation

CUtilitiesDlg::CUtilitiesDlg ( CWnd * pParent = NULL )

Definition at line 45 of file UtilitiesDlg.Cpp.

  : CDialog(CUtilitiesDlg::IDD, pParent)
{
  //{{AFX_DATA_INIT(CUtilitiesDlg)
    // NOTE: the ClassWizard will add member initialization here
  //}}AFX_DATA_INIT

  // Set the dialogs icon
  m_hIcon = AfxGetApp()->LoadIcon(IDI_UTILITIES);

  // Initialize the members
  m_pCatalog = NULL;
  m_nUtilityType = UTILITY_TYPE_UNDEFINED;
  m_nUtilityOption = UTILITY_OPTION_UNDEFINED;
}

Member Function Documentation

void CUtilitiesDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 62 of file UtilitiesDlg.Cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CUtilitiesDlg)
    // NOTE: the ClassWizard will add DDX and DDV calls here
  //}}AFX_DATA_MAP
}

void CUtilitiesDlg::OnClose ( ) [protected]

Definition at line 94 of file UtilitiesDlg.Cpp.

{
  // Release the reference to the Catalog object if needed
  ReleaseCatalog();

  CDialog::OnClose();
}

BOOL CUtilitiesDlg::OnInitDialog ( ) [protected, virtual]

Definition at line 102 of file UtilitiesDlg.Cpp.

{
  CDialog::OnInitDialog();

  // Setup the dialogs icon resource
  SetIcon(m_hIcon, true);   // 32x32 Icon
  SetIcon(m_hIcon, false);  // 16x16 Icon

  // Check the default radio buttons, set default UI state, and set appropriate member variables
  //  used to manage UI state
  CheckRadioButton(IDC_RADIO_ROUTER, IDC_RADIO_JNEC, IDC_RADIO_ROUTER);

  // Set the import type and description to match the current selection
  OnRouter();

  // Enable the "Refresh" option
  CWnd* pWnd = GetDlgItem(IDC_RADIO_REFRESH);
  if (NULL != pWnd)
    pWnd->EnableWindow(true);

  CheckRadioButton(IDC_RADIO_START, IDC_RADIO_REFRESH, IDC_RADIO_START);
  m_nUtilityOption = UTILITY_OPTION_START;

  return TRUE;  // return TRUE unless you set the focus to a control
                // EXCEPTION: OCX Property Pages should return FALSE
}

void CUtilitiesDlg::OnJNEC ( ) [protected]

Definition at line 129 of file UtilitiesDlg.Cpp.

{

}

void CUtilitiesDlg::OnOK ( ) [protected, virtual]

Definition at line 163 of file UtilitiesDlg.Cpp.

{
  // Continue only if we have a valid Catalog pointer
  if (NULL != m_pCatalog)
  {
    // Perform actions depending upon specified utility type (i.e., router )
    switch (m_nUtilityType)
    {
    case UTILITY_TYPE_ROUTER:
      switch (m_nUtilityOption)
      {
      case UTILITY_OPTION_START:
        m_pCatalog->StartRouter();
        break;
      case UTILITY_OPTION_STOP:
        m_pCatalog->StopRouter();
        break;
      case UTILITY_OPTION_REFRESH:
        m_pCatalog->RefreshRouter();
        break;
      default:
        MessageBox("Invalid utility option.\n\nNo processing will be performed.\n\nPress OK to continue.",
              "Error",
              (MB_OK | MB_ICONERROR));
        break;
      }
      break;
    case UTILITY_TYPE_JNEC:
      break;

    default:
      MessageBox("Invalid utility type.\n\nNo processing will be performed.\n\nPress OK to continue.",
            "Error",
            (MB_OK | MB_ICONERROR));
    }
  }
  else
    MessageBox("Invalid Catalog reference.\n\nNo processing will be performed.\n\nPress OK to continue.",
          "Error",
          (MB_OK | MB_ICONERROR));

  // Release the reference to the Catalog object
  ReleaseCatalog();

  CDialog::OnOK();
}

void CUtilitiesDlg::OnRefresh ( ) [protected]

Definition at line 134 of file UtilitiesDlg.Cpp.

{
  m_nUtilityOption = UTILITY_OPTION_REFRESH;
}

void CUtilitiesDlg::OnRouter ( ) [protected]

Definition at line 139 of file UtilitiesDlg.Cpp.

{
  // Set the utility type
  m_nUtilityType = UTILITY_TYPE_ROUTER;

  // Enable the "Refresh" option
  CWnd* pWnd = GetDlgItem(IDC_RADIO_REFRESH);
  if (NULL != pWnd)
    pWnd->EnableWindow(true);

  // Set default option
  CheckRadioButton(IDC_RADIO_START, IDC_RADIO_REFRESH, IDC_RADIO_START);
}

void CUtilitiesDlg::OnStart ( ) [protected]

Definition at line 153 of file UtilitiesDlg.Cpp.

{
  m_nUtilityOption = UTILITY_OPTION_START;
}

void CUtilitiesDlg::OnStop ( ) [protected]

Definition at line 158 of file UtilitiesDlg.Cpp.

{
  m_nUtilityOption = UTILITY_OPTION_STOP;
}

void CUtilitiesDlg::ReleaseCatalog ( ) [private]

Definition at line 210 of file UtilitiesDlg.Cpp.

{
  // Release the reference to the Catalog object if needed
  if (NULL != m_pCatalog)
    m_pCatalog->Release();
}

void CUtilitiesDlg::set_Catalog ( ICOMAdminCatalog * pCatalog )

Definition at line 85 of file UtilitiesDlg.Cpp.

{
  // Only can have one Catalog object reference... release all prior references before assignment
  ReleaseCatalog();

  // Assign the new Catalog reference
  m_pCatalog = pCatalog;
}

Member Data Documentation

HICON CUtilitiesDlg::m_hIcon [protected]

Definition at line 53 of file UtilitiesDlg.h.

int CUtilitiesDlg::m_nUtilityOption [private]

Definition at line 69 of file UtilitiesDlg.h.

int CUtilitiesDlg::m_nUtilityType [private]

Definition at line 70 of file UtilitiesDlg.h.

ICOMAdminCatalog* CUtilitiesDlg::m_pCatalog [private]

Definition at line 71 of file UtilitiesDlg.h.

The documentation for this class was generated from the following files:
  • Com/Administration/Explore.VC/UtilitiesDlg.h
  • Com/Administration/Explore.VC/UtilitiesDlg.Cpp
Generated on Wed Nov 13 2024 16:57:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CUtilProp Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes

CUtilProp Class Reference

#include "utilprop.h"

List of all members.

Public Member Functions

CUtilProp (void)
~CUtilProp (void)
STDMETHODIMP | GetProperties (DWORD dwBitMask, ULONG cPropertySets, const DBPROPIDSET rgPropertySets[], ULONG *pcProperties, DBPROPSET **prgProperties)
STDMETHODIMP | GetPropertyInfo (BOOL fDSOInitialized, ULONG cPropertySets, const DBPROPIDSET rgPropertySets[], ULONG *pcPropertyInfoSets, DBPROPINFOSET **prgPropertyInfoSets, WCHAR **ppDescBuffer)
STDMETHODIMP | SetProperties (DWORD dwBitMask, ULONG cProperties, DBPROPSET rgProperties[])

Static Public Member Functions

static HRESULT | GetPropertiesArgChk (DWORD dwBitMask, const ULONG cPropertySets, const DBPROPIDSET rgPropertySets[], ULONG *pcProperties, DBPROPSET **prgProperties)
static HRESULT | SetPropertiesArgChk (const ULONG cProperties, const DBPROPSET rgProperties[])

Protected Member Functions

BOOL | GetPropIndex (DBPROPID dwPropertyID, ULONG *pulIndex)
HRESULT | IsValidValue (DBPROP *pDBProp)
HRESULT | LoadDBPROP (PROPSTRUCT *pPropStruct, DBPROP *pPropSupport)
void | LoadDBPROPINFO (PROPSTRUCT *pPropStruct, DBPROPINFO *pPropInfo)

Protected Attributes

PROPSTRUCT | m_rgproperties [NUMBER_OF_SUPPORTED_PROPERTIES]
WCHAR | m_wszFilePath [MAX_PATH]

Detailed Description

Definition at line 75 of file utilprop.h.

Constructor & Destructor Documentation

CUtilProp::CUtilProp ( void )

Definition at line 84 of file utilprop.cpp.

{
  memcpy(m_rgproperties, s_rgprop, sizeof(s_rgprop));
  memset(m_wszFilePath,0,sizeof(m_wszFilePath));
    return;
}

CUtilProp::~CUtilProp ( void )

Definition at line 101 of file utilprop.cpp.

{
  return;
}

Member Function Documentation

STDMETHODIMP CUtilProp::GetProperties | ( | DWORD | dwBitMask,
 |  | ULONG | cPropertySets,
 |  | const DBPROPIDSET | rgPropertySets[],
 |  | ULONG * | pcProperties,
 |  | DBPROPSET ** | prgProperties
 | ) |  |

Definition at line 714 of file utilprop.cpp.

{
    HRESULT     hr            = S_OK;
  BOOL      fPropsinError = FALSE;
  BOOL      fPropsSucceed = FALSE;
    ULONG     cProps      = 0;
  ULONG     cCount      = 0;
    ULONG     ulPropertySets= 0;
    DBPROP*     pProp;
    DBPROPSET*    pPropSet;

  // save the count of PropertyIDSets
  cProps = cPropertyIDSets;

  // If the consumer does not restrict the property sets
  // by specify an array of property sets and a cPropertySets
  // greater than 0, then we need to make sure we
  // have some to return
  if( cPropertyIDSets == 0 )
  {
    // only allow the DBINIT, DATASOURCE and DATASOURCEINFO if Initialized
    if( dwBitMask & PROPSET_INIT )
      cProps = 2;
    else
      cProps = 1;
  }

    // use task memory allocater to alloc a DBPROPSET struct
    SAFE_ALLOC(pPropSet, DBPROPSET, cProps);
    memset(pPropSet, 0, cProps * sizeof(DBPROPSET));

  // For each supported Property Set
  for (ulPropertySets=0; ulPropertySets < cProps; ulPropertySets++)
  {
    BOOL fGetAllProps = FALSE;

    // If no restrictions return all properties from the three supported property sets
    if( cPropertyIDSets == 0 )
    {
        fGetAllProps = TRUE;

        // only do this once
        if( ulPropertySets == 0 )
        {
          if( !(dwBitMask & PROPSET_SESSION) )
          {
            if( !(dwBitMask & PROPSET_ROWSET) )
            {
                pPropSet[0].guidPropertySet = DBPROPSET_DBINIT;
                pPropSet[0].cProperties  = NUMBER_OF_SUPPORTED_DBINIT_PROPERTIES;

              if( dwBitMask & PROPSET_INIT )
              {
                pPropSet[1].guidPropertySet = DBPROPSET_DATASOURCEINFO;
                pPropSet[1].cProperties  = NUMBER_OF_SUPPORTED_DATASOURCEINFO_PROPERTIES;
              }
            }
            else
            {
              pPropSet[0].guidPropertySet = DBPROPSET_ROWSET;
              pPropSet[0].cProperties  = NUMBER_OF_SUPPORTED_ROWSET_PROPERTIES;
            }
          }
          else
          {
            pPropSet[0].guidPropertySet = DBPROPSET_SESSION;
            pPropSet[0].cProperties  = NUMBER_OF_SUPPORTED_SESSION_PROPERTIES;
          }
        }
    }
    else
    {
      pPropSet[ulPropertySets].guidPropertySet = rgPropertyIDSets[ulPropertySets].guidPropertySet;
      pPropSet[ulPropertySets].cProperties  = rgPropertyIDSets[ulPropertySets].cPropertyIDs;

      if( rgPropertyIDSets[ulPropertySets].cPropertyIDs == 0 )
      {
        fGetAllProps = TRUE;

        if( rgPropertyIDSets[ulPropertySets].guidPropertySet == DBPROPSET_DBINIT &&
          dwBitMask & PROPSET_DSO )
        {
          pPropSet[ulPropertySets].cProperties  = NUMBER_OF_SUPPORTED_DBINIT_PROPERTIES;
        }
        else if( (rgPropertyIDSets[ulPropertySets].guidPropertySet == DBPROPSET_DATASOURCEINFO) &&
             ((dwBitMask & PROPSET_DSOINIT) == PROPSET_DSOINIT) )
        {
          pPropSet[ulPropertySets].cProperties  = NUMBER_OF_SUPPORTED_DATASOURCEINFO_PROPERTIES;
        }
        else if( (rgPropertyIDSets[ulPropertySets].guidPropertySet == DBPROPSET_SESSION) &&
             (dwBitMask & PROPSET_SESSION))
        {
          pPropSet[ulPropertySets].cProperties  = NUMBER_OF_SUPPORTED_SESSION_PROPERTIES;
        }
        else if( (rgPropertyIDSets[ulPropertySets].guidPropertySet == DBPROPSET_ROWSET) &&
             (dwBitMask & PROPSET_ROWSET))
        {
          pPropSet[ulPropertySets].cProperties  = NUMBER_OF_SUPPORTED_ROWSET_PROPERTIES;
        }
        else if( rgPropertyIDSets[ulPropertySets].guidPropertySet == DBPROPSET_PROPERTIESINERROR )
        {
          if( dwBitMask & PROPSET_DSO ) {
            pPropSet[ulPropertySets].guidPropertySet = DBPROPSET_DBINIT;
            fPropsSucceed = TRUE;
          }
          else if( dwBitMask & PROPSET_ROWSET ) {
            pPropSet[ulPropertySets].guidPropertySet = DBPROPSET_ROWSET;
            fPropsSucceed = TRUE;
          }
          else
            fPropsinError = TRUE;
        }
        else
        {
          fGetAllProps = FALSE;
          fPropsinError = TRUE;
        }
      }
    }

    if( pPropSet[ulPropertySets].cProperties )
    {
        // use task memory allocater to alloc array of DBPROP structs
      pProp = (DBPROP*) PROVIDER_ALLOC(sizeof( DBPROP ) *
                     pPropSet[ulPropertySets].cProperties);

      if (!pProp)
      {
        for(ULONG ul=0; ul<ulPropertySets; ul++)
        {
          for(ULONG ul2=0; ul2<pPropSet[ul].cProperties; ul2++)
            VariantClear( &pPropSet[ul].rgProperties[ul2].vValue );

          SAFE_FREE( pPropSet[ul].rgProperties );
        }
        SAFE_FREE( pPropSet );

        return ResultFromScode( E_OUTOFMEMORY );
      }

      pPropSet[ulPropertySets].rgProperties = &pProp[0];

      memset( pProp, 0,
        (pPropSet[ulPropertySets].cProperties * sizeof( DBPROP )));
    }

      // for each prop in our table..
    for (cCount=0; cCount < pPropSet[ulPropertySets].cProperties; cCount++)
    {
      // init the Variant right up front
      // that way we can VariantClear with no worried (if we need to)
      VariantInit( &pProp[cCount].vValue );

      // Check supported property sets
      if ( pPropSet[ulPropertySets].guidPropertySet == DBPROPSET_DBINIT &&
         fGetAllProps )
      {
        fPropsSucceed = TRUE;
        // load up their DBPROP from our table
        hr = LoadDBPROP( &m_rgproperties[START_OF_SUPPORTED_DBINIT_PROPERTIES + cCount],
              &pProp[cCount] );
      }
      else if ( pPropSet[ulPropertySets].guidPropertySet == DBPROPSET_DATASOURCEINFO &&
            fGetAllProps )
      {
        fPropsSucceed = TRUE;
        // load up their DBPROPINFO from our table
        hr = LoadDBPROP( &m_rgproperties[START_OF_SUPPORTED_DATASOURCEINFO_PROPERTIES + cCount],
              &pProp[cCount] );
      }
      else if ( pPropSet[ulPropertySets].guidPropertySet == DBPROPSET_SESSION &&
            fGetAllProps )
      {
        fPropsSucceed = TRUE;
        // load up their DBPROPINFO from our table
        hr = LoadDBPROP( &m_rgproperties[START_OF_SUPPORTED_SESSION_PROPERTIES + cCount],
              &pProp[cCount] );
      }
      else if ( pPropSet[ulPropertySets].guidPropertySet == DBPROPSET_ROWSET &&
            fGetAllProps )
      {
        fPropsSucceed = TRUE;
        // load up their DBPROPINFO from our table
        hr = LoadDBPROP( &m_rgproperties[START_OF_SUPPORTED_ROWSET_PROPERTIES + cCount],
              &pProp[cCount] );
      }
      else
      {
        ULONG ulIndex;

        pProp[cCount].dwPropertyID  = rgPropertyIDSets[ulPropertySets].rgPropertyIDs[cCount];
        pProp[cCount].dwStatus    = DBPROPSTATUS_NOTSUPPORTED;

        if(  (GetPropIndex(rgPropertyIDSets[ulPropertySets].rgPropertyIDs[cCount], &ulIndex)) &&
           (((dwBitMask & PROPSET_DSO) &&
             (rgPropertyIDSets[ulPropertySets].guidPropertySet == DBPROPSET_DBINIT)) ||
            (((dwBitMask & PROPSET_DSOINIT) == PROPSET_DSOINIT) &&
             ((rgPropertyIDSets[ulPropertySets].guidPropertySet == DBPROPSET_DATASOURCE) ||
            (rgPropertyIDSets[ulPropertySets].guidPropertySet == DBPROPSET_DATASOURCEINFO))) ||
            ((dwBitMask & PROPSET_SESSION) &&
             (rgPropertyIDSets[ulPropertySets].guidPropertySet == DBPROPSET_SESSION)) ||
            ((dwBitMask & PROPSET_ROWSET) &&
             (rgPropertyIDSets[ulPropertySets].guidPropertySet == DBPROPSET_ROWSET))) )
        {
          fPropsSucceed = TRUE;
          hr = LoadDBPROP( &m_rgproperties[ulIndex], &pProp[cCount] );
        }
        else
          fPropsinError = TRUE;
      }
    }
    // Set local back to FALSE
    fGetAllProps = FALSE;
  }

  // set count of properties and property information
    *pcPropertySets  = cProps;
    *prgPropertySets = pPropSet;

CLEANUP:

  if( FAILED(hr) )
  {
    // clear all variants used so far..
    for (ULONG ulFor=0; ulFor < cCount; ulFor++)
      VariantClear(&pProp[ulFor].vValue);

    // delete the pProp array, return failure
    SAFE_FREE(pProp);
    SAFE_FREE(pPropSet);
  }

  if ( (!fPropsSucceed && cPropertyIDSets) || (!fPropsSucceed && fPropsinError) )
    return ResultFromScode( DB_E_ERRORSOCCURRED );
  else if ( fPropsSucceed && fPropsinError )
    return ResultFromScode( DB_S_ERRORSOCCURRED );
  else
    return ResultFromScode( hr );
}

HRESULT CUtilProp::GetPropertiesArgChk | ( | DWORD | dwBitMask,
 |  | const ULONG | cPropertySets,
 |  | const DBPROPIDSET | rgPropertySets[],
 |  | ULONG * | pcProperties,
 |  | DBPROPSET ** | prgProperties |
 | ) |  |  | [static]

Definition at line 281 of file utilprop.cpp.

{
  //
  // Initialize values
  //
  if( pcProperties )
    *pcProperties = 0;

  if( prgProperties )
    *prgProperties = NULL;

  //
  // Check Arguments
  //
  if( (cPropertySets && !rgPropertySets) || !pcProperties || !prgProperties )
    return E_INVALIDARG;

  //
  // New argument check for > 1 cPropertyIDs and NULL pointer for the array.
  //
  for(ULONG ul=0; ul < cPropertySets; ul++)
  {
    if( rgPropertySets[ul].cPropertyIDs && !rgPropertySets[ul].rgPropertyIDs )
      return E_INVALIDARG;

    //
    // Check for propper formation of DBPROPSET_PROPERTIESINERROR
    //
    if( (dwBitMask & PROPSET_DSO || dwBitMask & PROPSET_ROWSET) &&
      (rgPropertySets[ul].guidPropertySet == DBPROPSET_PROPERTIESINERROR) )
    {
      if( (cPropertySets > 1) ||
        rgPropertySets[ul].cPropertyIDs ||
        rgPropertySets[ul].rgPropertyIDs )
        return E_INVALIDARG;
    }
  }

  return S_OK;
}

STDMETHODIMP CUtilProp::GetPropertyInfo | ( | BOOL | fDSOInitialized,
 |  | ULONG | cPropertySets,
 |  | const DBPROPIDSET | rgPropertySets[],
 |  | ULONG * | pcPropertyInfoSets,
 |  | DBPROPINFOSET ** | prgPropertyInfoSets,
 |  | WCHAR ** | ppDescBuffer
 | ) |  |

Definition at line 413 of file utilprop.cpp.

{
    HRESULT     hr          = S_OK;
  BOOL      fPropsinError   = FALSE;
  BOOL      fPropsSucceed   = FALSE;
  BOOL      fIsSpecialGUID    = FALSE;
  BOOL      fIsNotSpecialGUID = FALSE;
    ULONG     cProps        = 0;
  ULONG     cCount        = 0;
    ULONG     ulPropertySets    = 0;
  ULONG     cBuffer       = NUMBER_OF_SUPPORTED_PROPERTIES;

    DBPROPINFOSET*  pPropInfoSet = NULL;
    DBPROPINFO*   pPropInfo  = NULL;
  WCHAR*      pDescBuffer  = NULL;

  //
  // Initialize values
  //
  if( pcPropertyInfoSets )
    *pcPropertyInfoSets  = 0;

  if( prgPropertyInfoSets )
    *prgPropertyInfoSets = NULL;

  if( ppDescBuffer )
    *ppDescBuffer = NULL;

  //
  // Check Arguments
  //
  if( ((cPropertyIDSets > 0) && !rgPropertyIDSets) ||
    !pcPropertyInfoSets || !prgPropertyInfoSets )
        return E_INVALIDARG;

  //
  // New argument check for > 1 cPropertyIDs and NULL pointer for the array.
  //
  for(ULONG ul=0; ul < cPropertyIDSets; ul++)
  {
    if( rgPropertyIDSets[ul].cPropertyIDs && !(rgPropertyIDSets[ul].rgPropertyIDs) )
      return E_INVALIDARG;

    if( DBPROPSET_VIEWALL == rgPropertyIDSets[ul].guidPropertySet     ||
      DBPROPSET_TRUSTEEALL == rgPropertyIDSets[ul].guidPropertySet    ||
      DBPROPSET_TABLEALL == rgPropertyIDSets[ul].guidPropertySet      ||
      DBPROPSET_SESSIONALL == rgPropertyIDSets[ul].guidPropertySet    ||
      DBPROPSET_ROWSETALL == rgPropertyIDSets[ul].guidPropertySet     ||
      DBPROPSET_INDEXALL == rgPropertyIDSets[ul].guidPropertySet      ||
      DBPROPSET_DBINITALL == rgPropertyIDSets[ul].guidPropertySet     ||
      DBPROPSET_DATASOURCEINFOALL == rgPropertyIDSets[ul].guidPropertySet ||
      DBPROPSET_DATASOURCEALL == rgPropertyIDSets[ul].guidPropertySet   ||
      DBPROPSET_CONSTRAINTALL == rgPropertyIDSets[ul].guidPropertySet   ||
      DBPROPSET_COLUMNALL == rgPropertyIDSets[ul].guidPropertySet )
      fIsSpecialGUID = TRUE;
    else
      fIsNotSpecialGUID = TRUE;

    if( fIsSpecialGUID && fIsNotSpecialGUID )
      return E_INVALIDARG;

    // figure out the nuber of property descriptions
    if( !rgPropertyIDSets[ul].cPropertyIDs )
      cBuffer += NUMBER_OF_SUPPORTED_PROPERTIES;
    else
      cBuffer += rgPropertyIDSets[ul].cPropertyIDs;
  }

  // save the count of PropertyIDSets
  cProps = cPropertyIDSets;

  // If the consumer does not restrict the property sets
  // by specify an array of property sets and a cPropertySets
  // greater than 0, then we need to make sure we
  // have some to return
  if( cPropertyIDSets == 0 )
  {
    if( fDSOInitialized )
      cProps = NUMBER_OF_SUPPORTED_PROPERTY_SETS;
    else
      cProps = 1;
  }

    // use task memory allocater to alloc a DBPROPINFOSET struct
    SAFE_ALLOC(pPropInfoSet, DBPROPINFOSET, cProps);
    memset(pPropInfoSet, 0, cProps * sizeof(DBPROPINFOSET));

  // Alloc memory for ppDescBuffer
  if( ppDescBuffer )
  {
    SAFE_ALLOC(pDescBuffer, WCHAR,
           cProps * cBuffer * CCH_GETPROPERTYINFO_DESCRIP_BUFFER_SIZE);
    memset(pDescBuffer, 0, (cProps * cBuffer * sizeof(WCHAR) *
                   CCH_GETPROPERTYINFO_DESCRIP_BUFFER_SIZE));
    *ppDescBuffer = pDescBuffer;
  }

  // For each supported Property Set
  for(ulPropertySets=0; ulPropertySets < cProps; ulPropertySets++)
  {
    BOOL fGetAllProps = FALSE;

    // If no restrictions return all properties from the three supported property sets
    if( cPropertyIDSets == 0 )
    {
      fGetAllProps = TRUE;

      // only do this once
      if( ulPropertySets == 0 )
      {
        pPropInfoSet[0].guidPropertySet = DBPROPSET_DBINIT;
        pPropInfoSet[0].cPropertyInfos  = NUMBER_OF_SUPPORTED_DBINIT_PROPERTIES;

        if( fDSOInitialized )
        {
          pPropInfoSet[1].guidPropertySet = DBPROPSET_DATASOURCEINFO;
          pPropInfoSet[1].cPropertyInfos  = NUMBER_OF_SUPPORTED_DATASOURCEINFO_PROPERTIES;
          pPropInfoSet[2].guidPropertySet = DBPROPSET_SESSION;
          pPropInfoSet[2].cPropertyInfos  = NUMBER_OF_SUPPORTED_SESSION_PROPERTIES;
          pPropInfoSet[3].guidPropertySet = DBPROPSET_ROWSET;
          pPropInfoSet[3].cPropertyInfos  = NUMBER_OF_SUPPORTED_ROWSET_PROPERTIES;
        }
      }
    }
    else
    {
      pPropInfoSet[ulPropertySets].guidPropertySet = rgPropertyIDSets[ulPropertySets].guidPropertySet;
      pPropInfoSet[ulPropertySets].cPropertyInfos  = rgPropertyIDSets[ulPropertySets].cPropertyIDs;

      if( (rgPropertyIDSets[ulPropertySets].guidPropertySet == DBPROPSET_DBINITALL) ||
        (rgPropertyIDSets[ulPropertySets].guidPropertySet == DBPROPSET_DBINIT   &&
         rgPropertyIDSets[ulPropertySets].cPropertyIDs == 0) )
      {
        fGetAllProps = TRUE;
        pPropInfoSet[ulPropertySets].guidPropertySet = DBPROPSET_DBINIT;
        pPropInfoSet[ulPropertySets].cPropertyInfos  = NUMBER_OF_SUPPORTED_DBINIT_PROPERTIES;
      }
      else if( fDSOInitialized )
      {
        if( (rgPropertyIDSets[ulPropertySets].guidPropertySet == DBPROPSET_DATASOURCEINFOALL) ||
          ((rgPropertyIDSets[ulPropertySets].guidPropertySet == DBPROPSET_DATASOURCEINFO)   &&
           (rgPropertyIDSets[ulPropertySets].cPropertyIDs == 0)) )
        {
          fGetAllProps = TRUE;
          pPropInfoSet[ulPropertySets].guidPropertySet = DBPROPSET_DATASOURCEINFO;
          pPropInfoSet[ulPropertySets].cPropertyInfos  = NUMBER_OF_SUPPORTED_DATASOURCEINFO_PROPERTIES;
        }
        else if( (rgPropertyIDSets[ulPropertySets].guidPropertySet == DBPROPSET_SESSIONALL) ||
             ((rgPropertyIDSets[ulPropertySets].guidPropertySet == DBPROPSET_SESSION)   &&
              (rgPropertyIDSets[ulPropertySets].cPropertyIDs == 0)) )
        {
          fGetAllProps = TRUE;
          pPropInfoSet[ulPropertySets].guidPropertySet = DBPROPSET_SESSION;
          pPropInfoSet[ulPropertySets].cPropertyInfos  = NUMBER_OF_SUPPORTED_SESSION_PROPERTIES;
        }
        else if( (rgPropertyIDSets[ulPropertySets].guidPropertySet == DBPROPSET_ROWSETALL) ||
             ((rgPropertyIDSets[ulPropertySets].guidPropertySet == DBPROPSET_ROWSET)   &&
              (rgPropertyIDSets[ulPropertySets].cPropertyIDs == 0)) )
        {
          fGetAllProps = TRUE;
          pPropInfoSet[ulPropertySets].guidPropertySet = DBPROPSET_ROWSET;
          pPropInfoSet[ulPropertySets].cPropertyInfos  = NUMBER_OF_SUPPORTED_ROWSET_PROPERTIES;
        }
        else if( rgPropertyIDSets[ulPropertySets].cPropertyIDs == 0 )
          fPropsinError = TRUE;
      }
      else if( rgPropertyIDSets[ulPropertySets].cPropertyIDs == 0 )
      {
        // Since we do not support it should return a error with 0 & NULL
        fPropsinError = TRUE;
      }
    }

    if( pPropInfoSet[ulPropertySets].cPropertyInfos )
    {
        // use task memory allocater to alloc array of DBPROPINFO structs
      SAFE_ALLOC(pPropInfo, DBPROPINFO,
                  pPropInfoSet[ulPropertySets].cPropertyInfos);
      memset(pPropInfo, 0,
        pPropInfoSet[ulPropertySets].cPropertyInfos * sizeof(DBPROPINFO));

      pPropInfoSet[ulPropertySets].rgPropertyInfos = &pPropInfo[0];
    }

      // for each prop in our table..
    for (cCount=0; cCount < pPropInfoSet[ulPropertySets].cPropertyInfos; cCount++)
    {
      // init the Variant right up front
      // that way we can VariantClear with no worried (if we need to)
      VariantInit( &pPropInfo[cCount].vValues );

      // set the description pointer
      pPropInfo[cCount].pwszDescription = pDescBuffer;

      // Check supported property sets
      if( fGetAllProps )
      {
        if( pPropInfoSet[ulPropertySets].guidPropertySet == DBPROPSET_DBINIT )
        {
          // load up their DBPROPINFO from our table
          fPropsSucceed = TRUE;
          LoadDBPROPINFO(&m_rgproperties[START_OF_SUPPORTED_DBINIT_PROPERTIES + cCount],
                   &pPropInfo[cCount]);
        }
        else if( pPropInfoSet[ulPropertySets].guidPropertySet == DBPROPSET_DATASOURCEINFO )
        {
          // load up their DBPROPINFO from our table
          fPropsSucceed = TRUE;
          LoadDBPROPINFO(&m_rgproperties[START_OF_SUPPORTED_DATASOURCEINFO_PROPERTIES + cCount],
                   &pPropInfo[cCount] );
        }
        else if( pPropInfoSet[ulPropertySets].guidPropertySet == DBPROPSET_SESSION )
        {
          // load up their DBPROPINFO from our table
          fPropsSucceed = TRUE;
          LoadDBPROPINFO(&m_rgproperties[START_OF_SUPPORTED_SESSION_PROPERTIES + cCount],
                   &pPropInfo[cCount] );
        }
        else
        {
          // load up their DBPROPINFO from our table
          fPropsSucceed = TRUE;
          LoadDBPROPINFO(&m_rgproperties[START_OF_SUPPORTED_ROWSET_PROPERTIES + cCount],
                   &pPropInfo[cCount] );
        }
      }
      else
      {
        ULONG ulIndex;

        pPropInfo[cCount].dwPropertyID = rgPropertyIDSets[ulPropertySets].rgPropertyIDs[cCount];
        pPropInfo[cCount].dwFlags    = DBPROPFLAGS_NOTSUPPORTED;

        if( (GetPropIndex(rgPropertyIDSets[ulPropertySets].rgPropertyIDs[cCount], &ulIndex)) &&
          (pPropInfoSet[ulPropertySets].guidPropertySet == DBPROPSET_DBINIT ||
           pPropInfoSet[ulPropertySets].guidPropertySet == DBPROPSET_DATASOURCEINFO && fDSOInitialized ||
           pPropInfoSet[ulPropertySets].guidPropertySet == DBPROPSET_SESSION && fDSOInitialized ||
           pPropInfoSet[ulPropertySets].guidPropertySet == DBPROPSET_ROWSET && fDSOInitialized) )
        {
          fPropsSucceed = TRUE;
          LoadDBPROPINFO( &m_rgproperties[ulIndex], &pPropInfo[cCount] );
        }
        else
        {
          fPropsinError = TRUE;
          pPropInfo[cCount].pwszDescription = NULL;
        }
      }

      // move the description pointer to the next
      if( pPropInfo[cCount].pwszDescription )
        pDescBuffer += (wcslen(pPropInfo[cCount].pwszDescription) + sizeof(CHAR));
    }
    // Set local back to FALSE
    fGetAllProps = FALSE;
  }

  // set count of properties and property information
    *pcPropertyInfoSets  = cProps;
    *prgPropertyInfoSets = pPropInfoSet;

CLEANUP:

  if( FAILED(hr) )
  {
    SAFE_FREE(pPropInfo);
    SAFE_FREE(pPropInfoSet);
    if( ppDescBuffer )
      SAFE_FREE(*ppDescBuffer);
  }

  if( fPropsSucceed && fPropsinError )
    return DB_S_ERRORSOCCURRED;
  else if( fPropsinError )
  {
    if( ppDescBuffer )
      SAFE_FREE(*ppDescBuffer);
    return DB_E_ERRORSOCCURRED;
  }
  else
    return hr;
}

BOOL CUtilProp::GetPropIndex | ( | DBPROPID | dwPropertyID,
 |  | ULONG * | pulIndex |
 | ) |  |  | [protected]

Definition at line 119 of file utilprop.cpp.

{
    //
  // asserts
  //
    assert(pulIndex);

    for (ULONG cNumberOfProperties = 0;
     cNumberOfProperties < NUMBER_OF_SUPPORTED_PROPERTIES;
     cNumberOfProperties++)
    {
        if( dwPropertyID == m_rgproperties[cNumberOfProperties].dwPropertyID )
        {
            // found a match
            *pulIndex = cNumberOfProperties;
            return TRUE;
         }
    }

  // found no matches
    return FALSE;
}

HRESULT CUtilProp::IsValidValue ( DBPROP * pDBProp ) [protected]

Definition at line 336 of file utilprop.cpp.

{
  //
  // Switch on the vt type first.
  //
  switch (V_VT(&pDBProp->vValue))
  {
    case VT_BOOL:
      if( V_BOOL(&pDBProp->vValue) != VARIANT_TRUE &&
        V_BOOL(&pDBProp->vValue) != VARIANT_FALSE )
        return S_FALSE;
      break;

    case VT_I2:
      if( V_I2(&pDBProp->vValue) < 0 )
        return S_FALSE;

      //
      // Switch on the property ID for VT_I2.
      //
      switch( pDBProp->dwPropertyID )
      {
        case DBPROP_INIT_PROMPT:

          if( V_I2(&pDBProp->vValue) != DBPROMPT_PROMPT &&
            V_I2(&pDBProp->vValue) != DBPROMPT_COMPLETE &&
            V_I2(&pDBProp->vValue) != DBPROMPT_COMPLETEREQUIRED &&
            V_I2(&pDBProp->vValue) != DBPROMPT_NOPROMPT )
            return S_FALSE;
      }

      break;

    case VT_I4:
      if( V_I4(&pDBProp->vValue) < 0 )
        return S_FALSE;

      //
      // Switch on the property ID for VT_I4.
      //
      switch( pDBProp->dwPropertyID )
      {
        case DBPROP_SESS_AUTOCOMMITISOLEVELS:

        if( V_I4(&pDBProp->vValue) != 0 &&
          V_I4(&pDBProp->vValue) != DBPROPVAL_TI_CHAOS &&
          V_I4(&pDBProp->vValue) != DBPROPVAL_TI_READUNCOMMITTED &&
          V_I4(&pDBProp->vValue) != DBPROPVAL_TI_READCOMMITTED &&
          V_I4(&pDBProp->vValue) != DBPROPVAL_TI_REPEATABLEREAD &&
          V_I4(&pDBProp->vValue) != DBPROPVAL_TI_SERIALIZABLE )
          return S_FALSE;
      }

      break;

    default:
      break;
  }

  return S_OK;
}

HRESULT CUtilProp::LoadDBPROP | ( | PROPSTRUCT * | pPropStruct,
 |  | DBPROP * | pPropSupport |
 | ) |  |  | [protected]

Definition at line 198 of file utilprop.cpp.

{
    HRESULT hr = S_OK;

  //
  // asserts
  //
    assert(pPropStruct);
    assert(pPropSupport);

    //
  // set the easy fields..
  //
    pPropSupport->dwPropertyID = pPropStruct->dwPropertyID;
    pPropSupport->colid      = DB_NULLID;
  pPropSupport->dwStatus     = DBPROPSTATUS_OK;

    //
  // init the variant
  //
    VariantInit(&pPropSupport->vValue);

  //
    // set pPropSupport->vValue based on Variant type
  //
    switch (pPropStruct->vtType)
    {
      case VT_BOOL:
      V_VT(&pPropSupport->vValue) = VT_BOOL;
      V_BOOL(&pPropSupport->vValue) =
          (pPropStruct->boolVal ? VARIANT_TRUE : VARIANT_FALSE);
      break;

      case VT_I2:
        V_VT(&pPropSupport->vValue) = VT_I2;
      V_I2(&pPropSupport->vValue) = (SHORT)pPropStruct->longVal;
      break;

    case VT_I4:
        V_VT(&pPropSupport->vValue) = VT_I4;
      V_I4(&pPropSupport->vValue) = (LONG)pPropStruct->longVal;
      break;

#ifdef _WIN64
      case VT_I8:
        V_VT(&pPropSupport->vValue) = VT_I8;
      V_I8(&pPropSupport->vValue) = (LONGLONG)pPropStruct->longVal;
      break;
#endif

      case VT_BSTR:
      V_VT(&pPropSupport->vValue) = VT_BSTR;
      SAFE_SYSALLOC(V_BSTR(&pPropSupport->vValue), pPropStruct->pwstrVal);
      break;

    default:
      assert( !"LoadDBPROP unknown variant type!\n\r" );
      hr = E_FAIL;
      break;
    }

CLEANUP:

  return hr;
}

void CUtilProp::LoadDBPROPINFO | ( | PROPSTRUCT * | pPropStruct,
 |  | DBPROPINFO * | pPropInfo |
 | ) |  |  | [protected]

Definition at line 156 of file utilprop.cpp.

{
    //
  // asserts
  //
    assert(pPropStruct);
    assert(pPropInfo);

    //
  // set the easy fields..
  //
    pPropInfo->dwPropertyID = pPropStruct->dwPropertyID;
    pPropInfo->dwFlags    = pPropStruct->dwFlags;
    pPropInfo->vtType   = pPropStruct->vtType;

    //
  // init the variant
  //
    VariantInit(&pPropInfo->vValues);

  //
  // fill in the description
  //
  if( pPropInfo->pwszDescription )
    wcscpy(pPropInfo->pwszDescription, pPropStruct->pwstrDescBuffer);

  return;
}

STDMETHODIMP CUtilProp::SetProperties | ( | DWORD | dwBitMask,
 |  | ULONG | cProperties,
 |  | DBPROPSET | rgProperties[]
 | ) |  |

Definition at line 1001 of file utilprop.cpp.

{
  ULONG cCountProps = 0;
  ULONG cValidProps = 0;
  ULONG ulIndex     = 0;

  // For each supported Property Set
  for (ULONG cPropSets=0; cPropSets < cPropertyIDSets; cPropSets++)
  {
      // for each prop in the propset
    for (ULONG cCnt=0; cCnt < rgPropertyIDSets[cPropSets].cProperties; cCnt++)
    {
      //Keep track of the number
      cCountProps++;

      // Check Check to see if valid
      switch( dwBitMask )
      {
        case PROPSET_DSO:
          if( rgPropertyIDSets[cPropSets].guidPropertySet == DBPROPSET_DBINIT &&
            GetPropIndex(rgPropertyIDSets[cPropSets].rgProperties[cCnt].dwPropertyID, &ulIndex) )
            break;

          rgPropertyIDSets[cPropSets].rgProperties[cCnt].dwStatus = DBPROPSTATUS_NOTSUPPORTED;
          continue;

        case PROPSET_DSOINIT:
          if( (rgPropertyIDSets[cPropSets].guidPropertySet == DBPROPSET_DATASOURCEINFO ||
             rgPropertyIDSets[cPropSets].guidPropertySet == DBPROPSET_DATASOURCE)  &&
            GetPropIndex(rgPropertyIDSets[cPropSets].rgProperties[cCnt].dwPropertyID, &ulIndex) )
            break;

          if( rgPropertyIDSets[cPropSets].guidPropertySet == DBPROPSET_DBINIT )
            rgPropertyIDSets[cPropSets].rgProperties[cCnt].dwStatus = DBPROPSTATUS_NOTSETTABLE;
          else
            rgPropertyIDSets[cPropSets].rgProperties[cCnt].dwStatus = DBPROPSTATUS_NOTSUPPORTED;
          continue;

        case PROPSET_SESSION:
          if( rgPropertyIDSets[cPropSets].guidPropertySet == DBPROPSET_SESSION  &&
            GetPropIndex(rgPropertyIDSets[cPropSets].rgProperties[cCnt].dwPropertyID, &ulIndex) )
            break;

          rgPropertyIDSets[cPropSets].rgProperties[cCnt].dwStatus = DBPROPSTATUS_NOTSUPPORTED;
          continue;

        case PROPSET_ROWSET:
          if( rgPropertyIDSets[cPropSets].guidPropertySet == DBPROPSET_ROWSET  &&
            GetPropIndex(rgPropertyIDSets[cPropSets].rgProperties[cCnt].dwPropertyID, &ulIndex) )
            break;

          rgPropertyIDSets[cPropSets].rgProperties[cCnt].dwStatus = DBPROPSTATUS_NOTSUPPORTED;
          continue;

        default:
          assert("Unsupported dwBitMask");
      }

      // arg checking for the prop
      if( rgPropertyIDSets[cPropSets].rgProperties[cCnt].dwOptions != DBPROPOPTIONS_OPTIONAL &&
        rgPropertyIDSets[cPropSets].rgProperties[cCnt].dwOptions != DBPROPOPTIONS_REQUIRED )
      {
        rgPropertyIDSets[cPropSets].rgProperties[cCnt].dwStatus = DBPROPSTATUS_BADOPTION;
        continue;
      }

      if( (V_VT(&rgPropertyIDSets[cPropSets].rgProperties[cCnt].vValue) != VT_EMPTY) &&
        (V_VT(&rgPropertyIDSets[cPropSets].rgProperties[cCnt].vValue) != m_rgproperties[ulIndex].vtType ||
         IsValidValue(&rgPropertyIDSets[cPropSets].rgProperties[cCnt]) == S_FALSE) )
      {
        rgPropertyIDSets[cPropSets].rgProperties[cCnt].dwStatus = DBPROPSTATUS_BADVALUE;
        continue;
      }

      switch( V_VT(&rgPropertyIDSets[cPropSets].rgProperties[cCnt].vValue) )
      {
        case VT_BOOL:
          if( m_rgproperties[ulIndex].dwFlags & DBPROPFLAGS_WRITE ) {
            m_rgproperties[ulIndex].boolVal = !!(V_BOOL(&rgPropertyIDSets[cPropSets].rgProperties[cCnt].vValue));
            break;
          }

          if( !!(V_BOOL(&rgPropertyIDSets[cPropSets].rgProperties[cCnt].vValue)) == m_rgproperties[ulIndex].boolVal )
            break;

          if( rgPropertyIDSets[cPropSets].rgProperties[cCnt].dwOptions == DBPROPOPTIONS_OPTIONAL)
            rgPropertyIDSets[cPropSets].rgProperties[cCnt].dwStatus = DBPROPSTATUS_NOTSET;
          else
            rgPropertyIDSets[cPropSets].rgProperties[cCnt].dwStatus = DBPROPSTATUS_NOTSETTABLE;
          continue;

        case VT_I2:
          if( m_rgproperties[ulIndex].dwFlags & DBPROPFLAGS_WRITE ) {
            m_rgproperties[ulIndex].longVal = V_I2(&rgPropertyIDSets[cPropSets].rgProperties[cCnt].vValue);
            break;
          }

          if( V_I2(&rgPropertyIDSets[cPropSets].rgProperties[cCnt].vValue) == (SHORT)m_rgproperties[ulIndex].longVal )
            break;

          if( rgPropertyIDSets[cPropSets].rgProperties[cCnt].dwOptions == DBPROPOPTIONS_OPTIONAL)
            rgPropertyIDSets[cPropSets].rgProperties[cCnt].dwStatus = DBPROPSTATUS_NOTSET;
          else
            rgPropertyIDSets[cPropSets].rgProperties[cCnt].dwStatus = DBPROPSTATUS_NOTSETTABLE;
          continue;

        case VT_I4:
          if( m_rgproperties[ulIndex].dwFlags & DBPROPFLAGS_WRITE ) {
            m_rgproperties[ulIndex].longVal = V_I4(&rgPropertyIDSets[cPropSets].rgProperties[cCnt].vValue);
            break;
          }

          if( (V_I4(&rgPropertyIDSets[cPropSets].rgProperties[cCnt].vValue) == (LONG)m_rgproperties[ulIndex].longVal) ||
            (rgPropertyIDSets[cPropSets].rgProperties[cCnt].dwPropertyID == DBPROP_UPDATABILITY &&
             V_I4(&rgPropertyIDSets[cPropSets].rgProperties[cCnt].vValue) & m_rgproperties[ulIndex].longVal) )
            break;

          if( rgPropertyIDSets[cPropSets].rgProperties[cCnt].dwOptions == DBPROPOPTIONS_OPTIONAL)
            rgPropertyIDSets[cPropSets].rgProperties[cCnt].dwStatus = DBPROPSTATUS_NOTSET;
          else
            rgPropertyIDSets[cPropSets].rgProperties[cCnt].dwStatus = DBPROPSTATUS_NOTSETTABLE;
          continue;

#ifdef _WIN64
                case VT_I8:
          if( m_rgproperties[ulIndex].dwFlags & DBPROPFLAGS_WRITE ) {
            m_rgproperties[ulIndex].longVal = V_I8(&rgPropertyIDSets[cPropSets].rgProperties[cCnt].vValue);
            break;
          }

          if( (V_I8(&rgPropertyIDSets[cPropSets].rgProperties[cCnt].vValue) == (LONG)m_rgproperties[ulIndex].longVal) ||
            (rgPropertyIDSets[cPropSets].rgProperties[cCnt].dwPropertyID == DBPROP_UPDATABILITY &&
             V_I8(&rgPropertyIDSets[cPropSets].rgProperties[cCnt].vValue) & m_rgproperties[ulIndex].longVal) )
            break;

          if( rgPropertyIDSets[cPropSets].rgProperties[cCnt].dwOptions == DBPROPOPTIONS_OPTIONAL)
            rgPropertyIDSets[cPropSets].rgProperties[cCnt].dwStatus = DBPROPSTATUS_NOTSET;
          else
            rgPropertyIDSets[cPropSets].rgProperties[cCnt].dwStatus = DBPROPSTATUS_NOTSETTABLE;
          continue;
#endif

        case VT_BSTR:
          if( m_rgproperties[ulIndex].dwFlags & DBPROPFLAGS_WRITE ) {
            if( m_rgproperties[ulIndex].dwPropertyID == DBPROP_INIT_DATASOURCE ) {
              wcscpy(m_wszFilePath, V_BSTR(&rgPropertyIDSets[cPropSets].rgProperties[cCnt].vValue));
              m_rgproperties[ulIndex].pwstrVal = m_wszFilePath;
            }
            break;
          }

          if( !(wcscmp(V_BSTR(&rgPropertyIDSets[cPropSets].rgProperties[cCnt].vValue), m_rgproperties[ulIndex].pwstrVal)) )
            break;

          if( rgPropertyIDSets[cPropSets].rgProperties[cCnt].dwOptions == DBPROPOPTIONS_OPTIONAL)
            rgPropertyIDSets[cPropSets].rgProperties[cCnt].dwStatus = DBPROPSTATUS_NOTSET;
          else
            rgPropertyIDSets[cPropSets].rgProperties[cCnt].dwStatus = DBPROPSTATUS_NOTSETTABLE;
          continue;

        case VT_EMPTY:
          if( m_rgproperties[ulIndex].dwFlags & DBPROPFLAGS_WRITE )
            memcpy(&m_rgproperties[ulIndex], &s_rgprop[ulIndex], sizeof(PROPSTRUCT));
          break;
      }

      // Initialize dwStatus
      rgPropertyIDSets[cPropSets].rgProperties[cCnt].dwStatus = DBPROPSTATUS_OK;
      cValidProps++;
    }
  }

  // Figure out the retcode
  if( cValidProps == cCountProps )
    return ResultFromScode( S_OK );
  else if( cValidProps )
    return ResultFromScode( DB_S_ERRORSOCCURRED );
  else
    return ResultFromScode( DB_E_ERRORSOCCURRED );
}

HRESULT CUtilProp::SetPropertiesArgChk | ( | const ULONG | cProperties,
 |  | const DBPROPSET | rgProperties[] |
 | ) |  |  | [static]

Definition at line 970 of file utilprop.cpp.

{
  // Argument Checking
  if( !rgPropertySets )
    return ResultFromScode( E_INVALIDARG );

  // New argument check for > 1 cPropertyIDs and NULL pointer for
  // array of property ids.
  for(ULONG ul=0; ul<cPropertySets; ul++)
  {
    if( rgPropertySets[ul].cProperties && !(rgPropertySets[ul].rgProperties) )
      return ResultFromScode( E_INVALIDARG );
  }

  return ResultFromScode( S_OK );
}

Member Data Documentation

PROPSTRUCT CUtilProp::m_rgproperties[NUMBER_OF_SUPPORTED_PROPERTIES] [protected]

Definition at line 78 of file utilprop.h.

WCHAR CUtilProp::m_wszFilePath[MAX_PATH] [protected]

Definition at line 79 of file utilprop.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/sampprov/utilprop.h
  • Dataaccess/oledb/sampprov/utilprop.cpp
Generated on Wed Nov 13 2024 16:57:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CUtilString Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CUtilString Class Reference

#include "util.h"

List of all members.

Public Member Functions

CUtilString (bool fAllowStomping=false)
CUtilString (const CHAR *s, bool fAllowStomping=false)
CUtilString (const WCHAR *s, bool fAllowStomping=false)
~CUtilString ()
void | Clear ()
void | Free ()
operator CHAR * ()
operator WCHAR * ()
CUtilString & | operator+= (const WCHAR *s)
CUtilString & | operator= (const WCHAR *s)
CUtilString & | operator= (const CHAR *s)
CUtilString & | operator= (const CUtilString &s)

Private Attributes

DWORD m_dwCurLen
DWORD m_dwMaxLen
bool | m_fAllowStomping
bool | m_fDirty
CHAR * | m_pszVal
WCHAR * | m_pwszVal

Detailed Description

Definition at line 27 of file util.h.

Constructor & Destructor Documentation

CUtilString::CUtilString ( bool fAllowStomping = false ) [inline]

Definition at line 30 of file util.h.

  {
    Clear();
    m_fAllowStomping = fAllowStomping;
  }

CUtilString::~CUtilString ( ) [inline]

Definition at line 35 of file util.h.

{ Free(); }

CUtilString::CUtilString | ( | const WCHAR * | s,
 |  | bool | fAllowStomping = false |
 | ) |  |  | [inline]

Definition at line 36 of file util.h.

  {
    Clear();
    *this = s;
    m_fAllowStomping = fAllowStomping;
  }

CUtilString::CUtilString | ( | const CHAR * | s,
 |  | bool | fAllowStomping = false |
 | ) |  |  | [inline]

Definition at line 42 of file util.h.

  {
    Clear();
    *this = s;
    m_fAllowStomping = fAllowStomping;
  }

Member Function Documentation

void CUtilString::Clear ( ) [inline]

Definition at line 130 of file util.h.

{ m_pwszVal = NULL; m_pszVal = NULL; m_dwCurLen = 0; m_dwMaxLen = 0; m_fDirty = true; m_fAllowStomping = false; }

void CUtilString::Free ( ) [inline]

Definition at line 129 of file util.h.

{ delete [] m_pwszVal; delete [] m_pszVal; Clear(); }

CUtilString::operator CHAR * ( ) [inline]

Definition at line 52 of file util.h.

  {
    if (!m_pwszVal)
      return NULL;
    assert(m_fAllowStomping || m_dwCurLen == wcslen(m_pwszVal));
    if (!m_fDirty && !m_fAllowStomping)
      return m_pszVal;
    m_fDirty = false;
    delete [] m_pszVal;
    DWORD len = WideCharToMultiByte(CP_ACP, 0, m_pwszVal, -1, 0, 0, 0, 0);
    m_pszVal = new CHAR[len+1];
    if (WideCharToMultiByte(CP_ACP, 0, m_pwszVal, -1, m_pszVal, len, 0, 0) == 0)
      m_pszVal[0] = '\0';
    return m_pszVal;
  }

CUtilString::operator WCHAR * ( ) [inline]

Definition at line 48 of file util.h.

  {
    return m_pwszVal;
  }

CUtilString& CUtilString::operator+= ( const WCHAR * s ) [inline]

Definition at line 84 of file util.h.

  {
    if (!s)
      return *this;
    if (!m_pwszVal)
      return operator=(s);
    if (m_fAllowStomping)
      m_dwCurLen = wcslen(m_pwszVal);
    assert(m_dwCurLen == wcslen(m_pwszVal));
    m_fDirty = true;
    DWORD len = wcslen(s);
    if ((m_dwCurLen+len) > m_dwMaxLen)
    {
      m_dwMaxLen = m_dwCurLen + len + CUtilString_padsize;
      WCHAR * pwsz = new WCHAR[m_dwMaxLen+1];
      wcscpy(pwsz, m_pwszVal);
      delete [] m_pwszVal;
      m_pwszVal = pwsz;
    }
    wcscpy(m_pwszVal+m_dwCurLen, s);
    m_dwCurLen += len;
    assert(m_dwCurLen == wcslen(m_pwszVal));
    return *this;
  }

CUtilString& CUtilString::operator= ( const WCHAR * s ) [inline]

Definition at line 71 of file util.h.

  {
    Free();
    if (s)
    {
      m_dwCurLen = wcslen(s);
      m_dwMaxLen = m_dwCurLen + CUtilString_padsize;
      m_pwszVal = new WCHAR[m_dwMaxLen+1];
      wcscpy(m_pwszVal, s);
      assert(m_dwCurLen == wcslen(m_pwszVal));
    }
    return *this;
  }

CUtilString& CUtilString::operator= ( const CUtilString & s ) [inline]

Definition at line 67 of file util.h.

  {
    return operator=(s.m_pwszVal);
  }

CUtilString& CUtilString::operator= ( const CHAR * s ) [inline]

Definition at line 108 of file util.h.

  {
    Free();
    if (s)
    {
      m_dwCurLen = MultiByteToWideChar(CP_ACP, 0, s, -1, 0, 0);
      if (m_dwCurLen)
      {
        m_dwCurLen--;
        m_dwMaxLen = m_dwCurLen + CUtilString_padsize;
        m_pwszVal = new WCHAR[m_dwMaxLen+1];
        if (MultiByteToWideChar(CP_ACP, 0, s, -1, m_pwszVal, m_dwMaxLen+1) == 0)
        {
          m_pwszVal[0] = L'\0';
          m_dwCurLen = 0;
        }
        assert(m_dwCurLen == wcslen(m_pwszVal));
      }
    }
    return *this;
  }

Member Data Documentation

DWORD CUtilString::m_dwCurLen [private]

Definition at line 135 of file util.h.

DWORD CUtilString::m_dwMaxLen [private]

Definition at line 136 of file util.h.

bool CUtilString::m_fAllowStomping [private]

Definition at line 138 of file util.h.

bool CUtilString::m_fDirty [private]

Definition at line 137 of file util.h.

CHAR* CUtilString::m_pszVal [private]

Definition at line 134 of file util.h.

WCHAR* CUtilString::m_pwszVal [private]

Definition at line 133 of file util.h.

The documentation for this class was generated from the following file:
  • Dataaccess/rds/handler/vc/util.h
Generated on Wed Nov 13 2024 16:57:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CVariant Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CVariant Class Reference

#include "common.h"

List of all members.

Public Member Functions

CVariant ()
~CVariant ()
HRESULT | Attach (VARIANT *pSrc)
HRESULT | ChangeType (VARTYPE vt, VARIANT *pSrc=NULL)
HRESULT | Clear ()
HRESULT | Copy (VARIANT *pSrc)
HRESULT | Detach (VARIANT *pDest)
HRESULT | Init ()

Detailed Description

Definition at line 304 of file common.h.

Constructor & Destructor Documentation

CVariant::CVariant ( )

Definition at line 630 of file common.cpp.

{
  Init();
}

CVariant::~CVariant ( )

Definition at line 639 of file common.cpp.

{
  Clear();
}

Member Function Documentation

HRESULT CVariant::Attach ( VARIANT * pSrc )

Definition at line 667 of file common.cpp.

{
  ASSERT(pSrc);

  //Clear the previous value
  HRESULT hr = Clear();
  if(SUCCEEDED(hr))
  {
    memcpy(this, pSrc, sizeof(VARIANT));
    pSrc->vt = VT_EMPTY;
  }

  return hr;
}

HRESULT CVariant::ChangeType | ( | VARTYPE | vt,
 |  | VARIANT * | pSrc = NULL
 | ) |  |

Definition at line 718 of file common.cpp.

{
  //If NULL, we are doing an inplace conversion
  if(!pSrc)
    pSrc = this;

  return VariantChangeFast(this, pSrc, ULONG_MAX, 0, vt);
}

HRESULT CVariant::Clear ( )

Definition at line 657 of file common.cpp.

{
  return VariantClearFast(this);
}

HRESULT CVariant::Copy ( VARIANT * pSrc )

Definition at line 707 of file common.cpp.

{
  ASSERT(pSrc);
  return VariantCopyFast(pSrc, this);
}

HRESULT CVariant::Detach ( VARIANT * pDest )

Definition at line 687 of file common.cpp.

{
  ASSERT(pDest);

  //Clear the previous value
  HRESULT hr = VariantClearFast(pDest);
  if(SUCCEEDED(hr))
  {
    memcpy(pDest, this, sizeof(VARIANT));
    vt = VT_EMPTY;
  }

  return hr;
}

HRESULT CVariant::Init ( )

Definition at line 648 of file common.cpp.

{
  return VariantInitFast(this);
}

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/common.h
  • Dataaccess/oledb/rowsetviewer/common.cpp
Generated on Wed Nov 13 2024 16:57:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CVARIANT Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CVARIANT Class Reference

List of all members.

Public Member Functions

CVARIANT ()
CVARIANT (BOOL b)
CVARIANT (short i)
CVARIANT ()
CVARIANT (double d)
CVARIANT (BYTE b)
CVARIANT (LPWSTR pSrc)
CVARIANT (LONG lSrc)
CVARIANT (BOOL b)
CVARIANT (short i)
CVARIANT (LPWSTR pSrc)
CVARIANT (IDispatch *pDisp)
CVARIANT (double d)
CVARIANT (BYTE b)
CVARIANT (IDispatch *pDisp)
CVARIANT (LONG lSrc)
~CVARIANT ()
~CVARIANT ()
void | Clear ()
void | Clear ()
BOOL GetBool ()
BOOL GetBool ()
BYTE | GetByte ()
BYTE | GetByte ()
IDispatch * | GetDispatch ()
IDispatch * | GetDispatch ()
double | GetDouble ()
double | GetDouble ()
LONG | GetLONG ()
LONG | GetLONG ()
short | GetShort ()
short | GetShort ()
LPWSTR | GetStr ()
LPWSTR | GetStr ()
VARTYPE | GetType ()
VARTYPE | GetType ()
IUnknown * | GetUnknown ()
IUnknown * | GetUnknown ()
operator BOOL ()
operator BOOL ()
operator BYTE ()
operator BYTE ()
operator double ()
operator double ()
operator LONG ()
operator LONG ()
operator LPWSTR ()
operator LPWSTR ()
operator SAFEARRAY * ()
operator SAFEARRAY * ()
operator short ()
operator short ()
operator VARIANT * ()
operator VARIANT * ()
VARIANT * | operator& ()
VARIANT * | operator& ()
void | SetArray (SAFEARRAY *p, VARTYPE vt)
void | SetArray (SAFEARRAY *p, VARTYPE vt)
void | SetBool (BOOL b)
void | SetBool (BOOL b)
void | SetByte (BYTE bySrc)
void | SetByte (BYTE bySrc)
void | SetDispatch (IDispatch *pDisp)
void | SetDispatch (IDispatch *pDisp)
void | SetDouble (double dSrc)
void | SetDouble (double dSrc)
void | SetLONG (LONG lSrc)
void | SetLONG (LONG lSrc)
void | SetShort (short i)
void | SetShort (short i)
void | SetStr (LPWSTR pSrc)
void | SetStr (LPWSTR pSrc)
void | SetUnknown (IUnknown *pUnk)
void | SetUnknown (IUnknown *pUnk)
void | Unbind ()
void | Unbind ()

Private Attributes

VARIANT | v

Detailed Description

Definition at line 29 of file OaHelp.Inl.

Constructor & Destructor Documentation

CVARIANT::CVARIANT ( ) [inline]

Definition at line 33 of file OaHelp.Inl.

{ VariantInit(&v); }

CVARIANT::~CVARIANT ( ) [inline]

Definition at line 34 of file OaHelp.Inl.

{ VariantClear(&v); }

CVARIANT::CVARIANT ( LPWSTR pSrc ) [inline]

Definition at line 40 of file OaHelp.Inl.

{ VariantInit(&v); SetStr(pSrc); }

CVARIANT::CVARIANT ( LONG lSrc ) [inline]

Definition at line 41 of file OaHelp.Inl.

{ VariantInit(&v); SetLONG(lSrc); }

CVARIANT::CVARIANT ( BOOL b ) [inline]

Definition at line 42 of file OaHelp.Inl.

{ VariantInit(&v); SetBool(b); }

CVARIANT::CVARIANT ( short i ) [inline]

Definition at line 43 of file OaHelp.Inl.

{ VariantInit(&v); SetShort(i); }

CVARIANT::CVARIANT ( double d ) [inline]

Definition at line 44 of file OaHelp.Inl.

{ VariantInit(&v); SetDouble(d); }

CVARIANT::CVARIANT ( BYTE b ) [inline]

Definition at line 45 of file OaHelp.Inl.

{ VariantInit(&v); SetByte(b); }

CVARIANT::CVARIANT ( IDispatch * pDisp ) [inline]

Definition at line 46 of file OaHelp.Inl.

{ VariantInit(&v); pDisp->AddRef(); SetDispatch(pDisp); }

CVARIANT::CVARIANT ( ) [inline]

Definition at line 31 of file OaHelp.Inl.

{ VariantInit(&v); }

CVARIANT::~CVARIANT ( ) [inline]

Definition at line 32 of file OaHelp.Inl.

{ VariantClear(&v); }

CVARIANT::CVARIANT ( LPWSTR pSrc ) [inline]

Definition at line 38 of file OaHelp.Inl.

{ VariantInit(&v); SetStr(pSrc); }

CVARIANT::CVARIANT ( LONG lSrc ) [inline]

Definition at line 39 of file OaHelp.Inl.

{ VariantInit(&v); SetLONG(lSrc); }

CVARIANT::CVARIANT ( BOOL b ) [inline]

Definition at line 40 of file OaHelp.Inl.

{ VariantInit(&v); SetBool(b); }

CVARIANT::CVARIANT ( short i ) [inline]

Definition at line 41 of file OaHelp.Inl.

{ VariantInit(&v); SetShort(i); }

CVARIANT::CVARIANT ( double d ) [inline]

Definition at line 42 of file OaHelp.Inl.

{ VariantInit(&v); SetDouble(d); }

CVARIANT::CVARIANT ( BYTE b ) [inline]

Definition at line 43 of file OaHelp.Inl.

{ VariantInit(&v); SetByte(b); }

CVARIANT::CVARIANT ( IDispatch * pDisp ) [inline]

Definition at line 44 of file OaHelp.Inl.

{ VariantInit(&v); pDisp->AddRef(); SetDispatch(pDisp); }

Member Function Documentation

void CVARIANT::Clear ( ) [inline]

Definition at line 35 of file OaHelp.Inl.

{ VariantClear(&v); }

void CVARIANT::Clear ( ) [inline]

Definition at line 33 of file OaHelp.Inl.

{ VariantClear(&v); }

BOOL CVARIANT::GetBool ( ) [inline]

Definition at line 69 of file OaHelp.Inl.

{ return V_BOOL(&v) == VARIANT_TRUE; }

BOOL CVARIANT::GetBool ( ) [inline]

Definition at line 67 of file OaHelp.Inl.

{ return V_BOOL(&v) == VARIANT_TRUE; }

BYTE CVARIANT::GetByte ( ) [inline]

Definition at line 63 of file OaHelp.Inl.

{ return V_UI1(&v); }

BYTE CVARIANT::GetByte ( ) [inline]

Definition at line 65 of file OaHelp.Inl.

{ return V_UI1(&v); }

IDispatch* CVARIANT::GetDispatch ( ) [inline]

Definition at line 73 of file OaHelp.Inl.

{ return V_DISPATCH(&v); }

IDispatch* CVARIANT::GetDispatch ( ) [inline]

Definition at line 71 of file OaHelp.Inl.

{ return V_DISPATCH(&v); }

double CVARIANT::GetDouble ( ) [inline]

Definition at line 61 of file OaHelp.Inl.

{ return V_R8(&v); }

double CVARIANT::GetDouble ( ) [inline]

Definition at line 59 of file OaHelp.Inl.

{ return V_R8(&v); }

LONG CVARIANT::GetLONG ( ) [inline]

Definition at line 55 of file OaHelp.Inl.

{ return V_I4(&v); }

LONG CVARIANT::GetLONG ( ) [inline]

Definition at line 57 of file OaHelp.Inl.

{ return V_I4(&v); }

short CVARIANT::GetShort ( ) [inline]

Definition at line 79 of file OaHelp.Inl.

{ return V_I2(&v); }

short CVARIANT::GetShort ( ) [inline]

Definition at line 77 of file OaHelp.Inl.

{ return V_I2(&v); }

LPWSTR CVARIANT::GetStr ( ) [inline]

Definition at line 53 of file OaHelp.Inl.

{ return V_VT(&v) == VT_BSTR ? V_BSTR(&v) : 0; }

LPWSTR CVARIANT::GetStr ( ) [inline]

Definition at line 51 of file OaHelp.Inl.

{ return V_VT(&v) == VT_BSTR ? V_BSTR(&v) : 0; }

VARTYPE CVARIANT::GetType ( ) [inline]

Definition at line 82 of file OaHelp.Inl.

{ return V_VT(&v); }

VARTYPE CVARIANT::GetType ( ) [inline]

Definition at line 80 of file OaHelp.Inl.

{ return V_VT(&v); }

IUnknown* CVARIANT::GetUnknown ( ) [inline]

Definition at line 76 of file OaHelp.Inl.

{ return V_UNKNOWN(&v); }

IUnknown* CVARIANT::GetUnknown ( ) [inline]

Definition at line 74 of file OaHelp.Inl.

{ return V_UNKNOWN(&v); }

CVARIANT::operator BOOL ( ) [inline]

Definition at line 70 of file OaHelp.Inl.

{ return V_BOOL(&v); }

CVARIANT::operator BOOL ( ) [inline]

Definition at line 68 of file OaHelp.Inl.

{ return V_BOOL(&v); }

CVARIANT::operator BYTE ( ) [inline]

Definition at line 64 of file OaHelp.Inl.

{ return V_UI1(&v);  }

CVARIANT::operator BYTE ( ) [inline]

Definition at line 66 of file OaHelp.Inl.

{ return V_UI1(&v);  }

CVARIANT::operator double ( ) [inline]

Definition at line 60 of file OaHelp.Inl.

{ return V_R8(&v);  }

CVARIANT::operator double ( ) [inline]

Definition at line 62 of file OaHelp.Inl.

{ return V_R8(&v);  }

CVARIANT::operator LONG ( ) [inline]

Definition at line 58 of file OaHelp.Inl.

{ return V_I4(&v);  }

CVARIANT::operator LONG ( ) [inline]

Definition at line 56 of file OaHelp.Inl.

{ return V_I4(&v);  }

CVARIANT::operator LPWSTR ( ) [inline]

Definition at line 52 of file OaHelp.Inl.

{ return V_VT(&v) == VT_BSTR ? V_BSTR(&v) : 0; }

CVARIANT::operator LPWSTR ( ) [inline]

Definition at line 54 of file OaHelp.Inl.

{ return V_VT(&v) == VT_BSTR ? V_BSTR(&v) : 0; }

CVARIANT::operator SAFEARRAY * ( ) [inline]

Definition at line 88 of file OaHelp.Inl.

{ return (V_VT(&v) & VT_ARRAY ? V_ARRAY(&v) : 0); }

CVARIANT::operator SAFEARRAY * ( ) [inline]

Definition at line 86 of file OaHelp.Inl.

{ return (V_VT(&v) & VT_ARRAY ? V_ARRAY(&v) : 0); }

CVARIANT::operator short ( ) [inline]

Definition at line 78 of file OaHelp.Inl.

{ return V_I2(&v); }

CVARIANT::operator short ( ) [inline]

Definition at line 80 of file OaHelp.Inl.

{ return V_I2(&v); }

CVARIANT::operator VARIANT * ( ) [inline]

Definition at line 37 of file OaHelp.Inl.

{ return &v; }

CVARIANT::operator VARIANT * ( ) [inline]

Definition at line 35 of file OaHelp.Inl.

{ return &v; }

VARIANT* CVARIANT::operator& ( ) [inline]

Definition at line 36 of file OaHelp.Inl.

{ return &v; }

VARIANT* CVARIANT::operator& ( ) [inline]

Definition at line 38 of file OaHelp.Inl.

{ return &v; }

void CVARIANT::SetArray | ( | SAFEARRAY * | p,
 |  | VARTYPE | vt |
 | ) |  |  | [inline]

Definition at line 84 of file OaHelp.Inl.

{ Clear(); V_VT(&v) = vt; V_ARRAY(&v) = p; }

void CVARIANT::SetArray | ( | SAFEARRAY * | p,
 |  | VARTYPE | vt |
 | ) |  |  | [inline]

Definition at line 82 of file OaHelp.Inl.

{ Clear(); V_VT(&v) = vt; V_ARRAY(&v) = p; }

void CVARIANT::SetBool ( BOOL b ) [inline]

Definition at line 68 of file OaHelp.Inl.

{ V_VT(&v) = VT_BOOL; V_BOOL(&v) = b ? VARIANT_TRUE : VARIANT_FALSE; }

void CVARIANT::SetBool ( BOOL b ) [inline]

Definition at line 66 of file OaHelp.Inl.

{ V_VT(&v) = VT_BOOL; V_BOOL(&v) = b ? VARIANT_TRUE : VARIANT_FALSE; }

void CVARIANT::SetByte ( BYTE bySrc ) [inline]

Definition at line 64 of file OaHelp.Inl.

{ Clear(); V_VT(&v) = VT_UI1; V_UI1(&v) = bySrc; }

void CVARIANT::SetByte ( BYTE bySrc ) [inline]

Definition at line 62 of file OaHelp.Inl.

{ Clear(); V_VT(&v) = VT_UI1; V_UI1(&v) = bySrc; }

void CVARIANT::SetDispatch ( IDispatch * pDisp ) [inline]

Definition at line 72 of file OaHelp.Inl.

{ V_VT(&v) = VT_DISPATCH; V_DISPATCH(&v) = pDisp; }

void CVARIANT::SetDispatch ( IDispatch * pDisp ) [inline]

Definition at line 70 of file OaHelp.Inl.

{ V_VT(&v) = VT_DISPATCH; V_DISPATCH(&v) = pDisp; }

void CVARIANT::SetDouble ( double dSrc ) [inline]

Definition at line 60 of file OaHelp.Inl.

{ Clear(); V_VT(&v) = VT_R8; V_R8(&v) = dSrc; }

void CVARIANT::SetDouble ( double dSrc ) [inline]

Definition at line 58 of file OaHelp.Inl.

{ Clear(); V_VT(&v) = VT_R8; V_R8(&v) = dSrc; }

void CVARIANT::SetLONG ( LONG lSrc ) [inline]

Definition at line 56 of file OaHelp.Inl.

{ Clear(); V_VT(&v) = VT_I4; V_I4(&v) = lSrc; }

void CVARIANT::SetLONG ( LONG lSrc ) [inline]

Definition at line 54 of file OaHelp.Inl.

{ Clear(); V_VT(&v) = VT_I4; V_I4(&v) = lSrc; }

void CVARIANT::SetShort ( short i ) [inline]

Definition at line 78 of file OaHelp.Inl.

{ V_VT(&v) = VT_I2; V_I2(&v) = i; }

void CVARIANT::SetShort ( short i ) [inline]

Definition at line 76 of file OaHelp.Inl.

{ V_VT(&v) = VT_I2; V_I2(&v) = i; }

void CVARIANT::SetStr ( LPWSTR pSrc ) [inline]

Definition at line 46 of file OaHelp.Inl.

    { Clear(); V_VT(&v) = pSrc ? VT_BSTR : VT_NULL;
      V_BSTR(&v) = pSrc ? SysAllocString(pSrc) : 0;
    }

void CVARIANT::SetStr ( LPWSTR pSrc ) [inline]

Definition at line 48 of file OaHelp.Inl.

    { Clear(); V_VT(&v) = pSrc ? VT_BSTR : VT_NULL;
      V_BSTR(&v) = pSrc ? SysAllocString(pSrc) : 0;
    }

void CVARIANT::SetUnknown ( IUnknown * pUnk ) [inline]

Definition at line 73 of file OaHelp.Inl.

{ V_VT(&v) = VT_UNKNOWN; V_UNKNOWN(&v) = pUnk; }

void CVARIANT::SetUnknown ( IUnknown * pUnk ) [inline]

Definition at line 75 of file OaHelp.Inl.

{ V_VT(&v) = VT_UNKNOWN; V_UNKNOWN(&v) = pUnk; }

void CVARIANT::Unbind ( ) [inline]

Definition at line 90 of file OaHelp.Inl.

{ VariantInit(&v); }

void CVARIANT::Unbind ( ) [inline]

Definition at line 88 of file OaHelp.Inl.

{ VariantInit(&v); }

Member Data Documentation

VARIANT CVARIANT::v [private]

Definition at line 31 of file OaHelp.Inl.

The documentation for this class was generated from the following files:
  • SysMgmt/WMI/VC/EventProvider/OaHelp.Inl
  • SysMgmt/WMI/VC/TempConsumer/OaHelp.Inl
Generated on Wed Nov 13 2024 16:57:39 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CVCExploreApp Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CVCExploreApp Class Reference

#include "VCExplore.h"

Inherits CWinApp.

List of all members.

Public Member Functions

CVCExploreApp ()
virtual BOOL InitInstance ()

Detailed Description

Definition at line 41 of file VCExplore.h.

Constructor & Destructor Documentation

CVCExploreApp::CVCExploreApp ( )

Definition at line 47 of file VCExplore.Cpp.

{
  // TODO: add construction code here,
  // Place all significant initialization in InitInstance
}

Member Function Documentation

BOOL CVCExploreApp::InitInstance ( void ) [virtual]

Reimplemented from CWinApp.

Definition at line 61 of file VCExplore.Cpp.

{
  AfxEnableControlContainer();

  // Standard initialization
  // If you are not using these features and wish to reduce the size
  //  of your final executable, you should remove from the following
  //  the specific initialization routines you do not need.

#ifdef _AFXDLL
  Enable3dControls();     // Call this when using MFC in a shared DLL
#else
  Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif

  // Attempt to get a reference to current catalog
  //_bstr_t bstrCollectionName = "Root";
  //g_pCurrCatalog = new ICatalog;
  //g_pCurrCollection = g_pCurrCatalog->GetCollection(bstrCollectionName);

  CVCExploreDlg dlg;
  m_pMainWnd = &dlg;
  dlg.DoModal();

  // Since the dialog has been closed, return FALSE so that we exit the
  //  application, rather than start the application's message pump.
  return FALSE;
}

The documentation for this class was generated from the following files:
  • Com/Administration/Explore.VC/VCExplore.h
  • Com/Administration/Explore.VC/VCExplore.Cpp
Generated on Wed Nov 13 2024 16:57:39 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CVCExploreDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes

CVCExploreDlg Class Reference

#include "VCExploreDlg.h"

List of all members.

Public Types

enum | { IDD = IDD_VCEXPLORE }

Public Member Functions

CVCExploreDlg (CWnd *pParent=NULL)
void | set_ComputerName (_bstr_t bstrComputerName)
void | set_CurrentCollection (ICatalogCollection *pCollection)

Public Attributes

CButton | m_btnSetProperty
CEdit | m_edtPropertyValue
CStatic | m_lblCollectionName
CStatic | m_lblComputerName
CListBox | m_lstObjects
CListBox | m_lstParentCollections
CListBox | m_lstProperties
CListBox | m_lstRelatedCollections

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
afx_msg void | OnClose ()
virtual BOOL | OnInitDialog ()
afx_msg void | OnPaint ()
afx_msg HCURSOR | OnQueryDragIcon ()
afx_msg void | OnSelChangeObjects ()
afx_msg void | OnSelChangeParentCollections ()
afx_msg void | OnSelChangeProperties ()
afx_msg void | OnSelChangeRelatedCollections ()
afx_msg void | OnSetProperty ()
afx_msg void | OnSysCommand (UINT nID, LPARAM lParam)
afx_msg void | OnTBtnAbout ()
afx_msg void | OnTBtnConnect ()
afx_msg void | OnTBtnDelete ()
afx_msg void | OnTBtnExportApp ()
afx_msg void | OnTBtnImportComponent ()
afx_msg void | OnTBtnInstallApp ()
afx_msg void | OnTBtnInstallComponent ()
afx_msg void | OnTBtnNew ()
afx_msg void | OnTBtnRefresh ()
afx_msg void | OnTBtnSave ()
afx_msg void | OnTBtnStartApp ()
afx_msg void | OnTBtnStopApp ()
afx_msg void | OnTBtnUtility ()

Protected Attributes

HICON | m_hIcon

Private Member Functions

int | AddParent (ICatalogCollection *pCatalogCollection)
HRESULT | CreateCatalog ()
void | DestroyCatalog ()
void | DisplayPropertyValue ()
ICOMAdminCatalog * | GetCatalog ()
HRESULT | NavigateTo (ICatalogCollection *pCatalogCollection, BOOL bPopulate=TRUE)
void | RemoveParent (int nNewCurrIndex)
void | TryToSaveChanges ()

Private Attributes

BOOL m_bChangesArePending
HWND | m_hwndToolBar
ICOMAdminCatalog * | m_pCatalog
ICatalogCollection * | m_pCurrCollection

Detailed Description

Definition at line 29 of file VCExploreDlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 39 of file VCExploreDlg.h.

{ IDD = IDD_VCEXPLORE };

Constructor & Destructor Documentation

CVCExploreDlg::CVCExploreDlg ( CWnd * pParent = NULL )

Definition at line 124 of file VCExploreDlg.Cpp.

  : CDialog(CVCExploreDlg::IDD)
{
  UNREFERENCED_PARAMETER(pParent);
  //{{AFX_DATA_INIT(CVCExploreDlg)
    // NOTE: the ClassWizard will add member initialization here
  //}}AFX_DATA_INIT
  // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
  m_hIcon = AfxGetApp()->LoadIcon(IDI_APP_ICON);

  // Pointer Initialization
  m_pCatalog = NULL;
  m_pCurrCollection = NULL;
  m_bChangesArePending = FALSE;
}

Member Function Documentation

int CVCExploreDlg::AddParent ( ICatalogCollection * pCatalogCollection ) [private]

Definition at line 940 of file VCExploreDlg.Cpp.

{
  _variant_t  vtName;
  int     nIndex = -1;

  // Add the CatalogCollections name to the ParentCollection listbox
  HRESULT hr = pCatalogCollection->get_Name(&vtName);
  if SUCCEEDED(hr)
  {
    // Attempt to dd the name to the ParentCollections listbox
    nIndex = m_lstParentCollections.AddString(_bstr_t(vtName));

    // If successful, store/cache the ICatalogCollection pointer
    if ((LB_ERR != nIndex) && (LB_ERRSPACE != nIndex))
      m_lstParentCollections.SetItemDataPtr(nIndex, pCatalogCollection);
  }

  return nIndex;
}

HRESULT CVCExploreDlg::CreateCatalog ( ) [private]

Definition at line 554 of file VCExploreDlg.Cpp.

{
  // Close any previous Catalog instances
  DestroyCatalog();

  IUnknown* pUnknown = NULL;

  // Attempt to get a reference to the objects IUnknown pointer
  HRESULT hr = CoCreateInstance(CLSID_COMAdminCatalog,
                  NULL,
                  CLSCTX_INPROC_SERVER,
                  IID_IUnknown,
                  (void**) &pUnknown);

  // Continue only if successful
  if SUCCEEDED(hr)
  {
    // Attempt to get a reference to the object's ICOMAdminCatalog interface
    hr = pUnknown->QueryInterface(IID_ICOMAdminCatalog,
                    (void**) &m_pCatalog);

    // Release the IUnknown pointer
    pUnknown->Release();

    // Continue only if successful
    if SUCCEEDED(hr)
    {
      _bstr_t bstrRootCollection = "Root";

      // Attempt to connect to "Root" of the Catalog object
      hr = m_pCatalog->GetCollection(bstrRootCollection,
                      (IDispatch**) &m_pCurrCollection);

      // Continue only if successful
      if SUCCEEDED(hr)
      {
        // Attempt to load the "Root" collection objects
        hr = m_pCurrCollection->Populate();

        // Continue only if successful
        if SUCCEEDED(hr)
          return S_OK;
        else
          MessageBox("Failed to populate the current Catalog objects root collection.\n\nPress OK to continue.",
                "Error",
                (MB_OK | MB_ICONERROR));
      }
      else
        MessageBox("Failed to obtain a reference to the current Catalog objects root collection.\n\nNo processing will be performed.\n\nPress OK to continue.",
              "Error",
              (MB_OK | MB_ICONERROR));
    }
    else
      MessageBox("ICOMAdminCatalog interface is not supported.\n\nNo processing will be performed.\n\nPress OK to continue.",
            "Error",
            (MB_OK | MB_ICONERROR));
  }
  else
    MessageBox("Failed to instantiate the COMAdmin object.\n\nNo processing will be performed.\n\nPress OK to continue.",
          "Error",
          (MB_OK | MB_ICONERROR));

  // Default return value
  return hr;
}

void CVCExploreDlg::DestroyCatalog ( ) [private]

Definition at line 620 of file VCExploreDlg.Cpp.

{
  if (NULL != m_pCurrCollection)
  {
    m_pCurrCollection->Release();
    m_pCurrCollection = NULL;
  }

  if (NULL != m_pCatalog)
  {
    m_pCatalog->Release();
    m_pCatalog = NULL;
  }
}

void CVCExploreDlg::DisplayPropertyValue ( ) [private]

Definition at line 987 of file VCExploreDlg.Cpp.

{
  // Clear the current contents of the edit control
  m_edtPropertyValue.SetSel(0, -1, false);
  m_edtPropertyValue.Clear();

  // Determine which (if any) CatalogObject is selected
  int nObjectIndex = m_lstObjects.GetCurSel();
  int nPropertyIndex = m_lstProperties.GetCurSel();

  // Bail if no CatalogObject OR Property selected
  if ((LB_ERR == nObjectIndex) || (LB_ERR == nPropertyIndex))
    return;

  // Attempt to get a reference to the currently selected CatalogObject
  ICatalogObject* pCatalogObject = NULL;

  HRESULT hr = m_pCurrCollection->get_Item(nObjectIndex,
                      (IDispatch**) &pCatalogObject);
  if SUCCEEDED(hr)
  {
    // Get the Properties name
    int nTextLength = m_lstProperties.GetTextLen(nPropertyIndex);
    char* pBuf = new char[nTextLength + 1];
    m_lstProperties.GetText(nPropertyIndex, pBuf);

    // Attempt to get the actual properties value
    _bstr_t   bstrPropertyName = pBuf;
    delete [] pBuf;

    _variant_t  vtPropertyValue = "";

    hr = pCatalogObject->get_Value(bstrPropertyName, &vtPropertyValue);

    // Set the text if successful
    if SUCCEEDED(hr)
    {
      short sFlag = 0;

      // Read only check (i.e., enable update only if allowed)
      hr = pCatalogObject->IsPropertyReadOnly(bstrPropertyName, &sFlag);
      if (sFlag || FAILED(hr))
        m_btnSetProperty.EnableWindow(false);
      else
        m_btnSetProperty.EnableWindow(true);

      // Write only check (i.e., display the value only if allowed)
      hr = pCatalogObject->IsPropertyWriteOnly(bstrPropertyName, &sFlag);
      if (!sFlag && SUCCEEDED(hr))
      {
        // Set the new edit control text
        try
        {
          m_edtPropertyValue.SetWindowText(_bstr_t(vtPropertyValue));
          // Select the text
          m_edtPropertyValue.SetSel(0, -1, false);
        }

        catch (...)
        {
          m_btnSetProperty.EnableWindow(false);
          vtPropertyValue = "";
          m_edtPropertyValue.SetWindowText(_bstr_t(vtPropertyValue));
        }
      }
    }

    // Release the temporary CatalogObject
    pCatalogObject->Release();
  }
}

void CVCExploreDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 140 of file VCExploreDlg.Cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CVCExploreDlg)
  DDX_Control(pDX, IDC_BUTTON_SET_PROPERTY, m_btnSetProperty);
  DDX_Control(pDX, IDC_EDIT_PROPERTY_VALUE, m_edtPropertyValue);
  DDX_Control(pDX, IDC_LIST_RELATED_COLLECTIONS, m_lstRelatedCollections);
  DDX_Control(pDX, IDC_LIST_PROPERTIES, m_lstProperties);
  DDX_Control(pDX, IDC_LIST_PARENT_COLLECTIONS, m_lstParentCollections);
  DDX_Control(pDX, IDC_LIST_OBJECTS, m_lstObjects);
  DDX_Control(pDX, IDC_LABEL_COMPUTER_NAME_VALUE, m_lblComputerName);
  DDX_Control(pDX, IDC_LABEL_COLLECTION_NAME_VALUE, m_lblCollectionName);
  //}}AFX_DATA_MAP
}

ICOMAdminCatalog * CVCExploreDlg::GetCatalog ( ) [private]

Definition at line 1071 of file VCExploreDlg.Cpp.

{
  // Increment the reference count on the Catalog object only if it's valid
  if (NULL != m_pCatalog)
    m_pCatalog->AddRef();

  // Return a reference to the current Catalog object
  return m_pCatalog;
}

HRESULT CVCExploreDlg::NavigateTo | ( | ICatalogCollection * | pCatalogCollection,
 |  | BOOL | bPopulate = TRUE |
 | ) |  |  | [private]

Definition at line 635 of file VCExploreDlg.Cpp.

{
  long          lObjCount = 0;

  _bstr_t         bstrRelatedCollectionInfo = "RelatedCollectionInfo";
  _bstr_t         bstrPropertyInfo = "PropertyInfo";

  _variant_t        vtRelatedCollInfoKey = "RelatedCollectionInfo";
  _variant_t        vtPropertyInfoKey = "PropertyInfo";
  _variant_t        vtKey = "";
  _variant_t        vtName = "";

  ICatalogObject*     pCatalogObject = NULL;
  ICatalogCollection*   pRelatedCollInfo = NULL;
  ICatalogCollection*   pPropertyInfo = NULL;

  // Make sure the current CatalogCollection object has been populated
  HRESULT hr;

  if (bPopulate)
    hr = pCatalogCollection->Populate();

  ////////////////////////////////////////////////////////////////////////////////////////
  // FIRST...
  //  Display the current CatalogCollection's name

  hr = pCatalogCollection->get_Name(&vtName);
  if SUCCEEDED(hr)
    m_lblCollectionName.SetWindowText(_bstr_t(vtName));

  ////////////////////////////////////////////////////////////////////////////////////////
  // SECOND...
  //  Enumerate "RelatedCollectionInfo" for the current collection
  //

  // Clear the listbox control
  m_lstRelatedCollections.ResetContent();

  hr = pCatalogCollection->GetCollection(bstrRelatedCollectionInfo,
                          vtRelatedCollInfoKey,
                          (IDispatch**) &pRelatedCollInfo);
  if SUCCEEDED(hr)
  {
    // Attempt to populate the RelatedCollectionInfo
    hr = pRelatedCollInfo->Populate();
    if SUCCEEDED(hr)
    {
      // Output the number of RelatedCollectionInfo objects in the collection
      long lCount = 0;
      hr = pRelatedCollInfo->get_Count(&lCount);

      for (long lIndex = 0; lIndex < lCount; lIndex++)
      {
        hr = pRelatedCollInfo->get_Item(lIndex,
                        (IDispatch**) &pCatalogObject);
        if SUCCEEDED(hr)
        {
          // Display the current CatalogObject's Key and Name
          pCatalogObject->get_Key(&vtKey);
          pCatalogObject->get_Name(&vtName);

          // Add the RelatedCollection's name to the listbox control
          m_lstRelatedCollections.AddString(_bstr_t(vtName));

          // Release the ICatalogObject pointer
          pCatalogObject->Release();
        }
      }
    }

    // Release the ICatalogCollection pointer
    pRelatedCollInfo->Release();
  }

  ////////////////////////////////////////////////////////////////////////////////////////
  // THIRD...
  //  Enumerate "PropertyInfo" for the current collection
  //

  // Clear the listbox control
  m_lstProperties.ResetContent();

  hr = pCatalogCollection->GetCollection(bstrPropertyInfo,
                      vtPropertyInfoKey,
                      (IDispatch**) &pPropertyInfo);
  if SUCCEEDED(hr)
  {
    // Populate the collection
    hr = pPropertyInfo->Populate();
    if SUCCEEDED(hr)
    {
      // Display the number of PropertyInfo objects in the collection
      long lPropCnt = 0;
      pPropertyInfo->get_Count(&lPropCnt);

      for (int lIndex = 0; lIndex < lPropCnt; lIndex++)
      {
        hr = pPropertyInfo->get_Item(lIndex,
                      (IDispatch**) &pCatalogObject);
        if SUCCEEDED(hr)
        {
          // Display the current CatalogObject's Key and Name
          pCatalogObject->get_Key(&vtKey);
          pCatalogObject->get_Name(&vtName);

          // Add property names to the listbox control
          m_lstProperties.AddString(_bstr_t(vtName));

          // Release the ICatalogObject pointer
          pCatalogObject->Release();
        }
      }
    }

    // Release the ICatalogCollection pointer
    pPropertyInfo->Release();
  }

  ////////////////////////////////////////////////////////////////////////////////////////
  // FORTH...
  //  Enumerate the current collection's objects
  //

  // Clear the listbox control
  m_lstObjects.ResetContent();

  // Get the number of objects available in this CatalogCollection
  hr = pCatalogCollection->get_Count(&lObjCount);

  // Output each objects (i.e., CatalogObject) properties in the current collection
  for (long lIndex = 0; lIndex < lObjCount; lIndex++)
  {
    hr = pCatalogCollection->get_Item(lIndex,
                      (IDispatch**) &pCatalogObject);

    if SUCCEEDED(hr)
    {
      // Get the current CatalogObject's Name
      pCatalogObject->get_Name(&vtName);

      // Add the Object names to the listbox control
      m_lstObjects.AddString(_bstr_t(vtName));

      // Release the temporary ICatalogObject pointer
      pCatalogObject->Release();
    }
  }

  ////////////////////////////////////////////////////////////////////////////////////////
  // FIFTH...
  //  Set the state of the persistence (i.e., new & delete) toolbar buttons
  //

  // Set the persistence toolbar buttons state depending upon the current collections
  //  properties (i.e., whether or not save & delete are permitted
  short sSaveEnabled = 0;
  short sRemoveEnabled = 0;
  CWnd* pToolBar = GetDlgItem(IDR_TOOLBAR_MAIN);

  hr = pCatalogCollection->get_AddEnabled(&sSaveEnabled);
  if (sSaveEnabled && SUCCEEDED(hr))
    pToolBar->SendMessage(TB_ENABLEBUTTON, ID_TBTN_NEW, MAKELONG(true, 0));

  hr = pCatalogCollection->get_RemoveEnabled(&sRemoveEnabled);
  if (sRemoveEnabled && SUCCEEDED(hr))
    pToolBar->SendMessage(TB_ENABLEBUTTON, ID_TBTN_DELETE, MAKELONG(true, 0));

  ////////////////////////////////////////////////////////////////////////////////////////
  // SIXTH...
  //  Clear any existing property value
  //
  m_edtPropertyValue.SetSel(0, -1, false);
  m_edtPropertyValue.Clear();

  m_lstObjects.SetCurSel(0);
  m_lstProperties.SetCurSel(0);

  return hr;
}

void CVCExploreDlg::OnClose ( ) [protected]

Definition at line 544 of file VCExploreDlg.Cpp.

{
  // Release the pointers to out objects and unload the COM libraries
  RemoveParent(RELEASE_ALL_PARENT_OBJECTS);
  DestroyCatalog();
  CoUninitialize();

  CDialog::OnClose();
}

BOOL CVCExploreDlg::OnInitDialog ( ) [protected, virtual]

Definition at line 185 of file VCExploreDlg.Cpp.

{
  CDialog::OnInitDialog();

  // Add "About..." menu item to system menu.

  // IDM_ABOUTBOX must be in the system command range.
  ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
  ASSERT(IDM_ABOUTBOX < 0xF000);

  CMenu* pSysMenu = GetSystemMenu(FALSE);
  if (pSysMenu != NULL)
  {
    CString strAboutMenu;
    strAboutMenu.LoadString(IDS_ABOUTBOX);
    if (!strAboutMenu.IsEmpty())
    {
      pSysMenu->AppendMenu(MF_SEPARATOR);
      pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
    }
  }

  // Set the icon for this dialog.  The framework does this automatically
  //  when the application's main window is not a dialog
  SetIcon(m_hIcon, TRUE);     // Set big icon
  SetIcon(m_hIcon, FALSE);    // Set small icon

  // Create the button structure
  TBBUTTON tbButtons[] = {
    {0, ID_TBTN_CONNECT, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0L, 0},
    {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0L, (UCHAR)-1},
    {1, ID_TBTN_REFRESH, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0L, 0},
    {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0L, (UCHAR)-1},
    {2, ID_TBTN_NEW, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0L, 0},
    {3, ID_TBTN_SAVE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0L, 0},
    {4, ID_TBTN_DELETE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0L, 0},
    {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0L, (UCHAR)-1},
    {5, ID_TBTN_START_APP, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0L, 0},
    {6, ID_TBTN_STOP_APP, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0L, 0},
    {7, ID_TBTN_INSTALL_APP, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0L, 0},
    {8, ID_TBTN_EXPORT_APP, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0L, 0},
    {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0L, (UCHAR)-1},
    {9, ID_TBTN_INSTALL_COMPONENT, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0L, 0},
    {10, ID_TBTN_IMPORT_COMPONENT, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0L, 0},
    {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0L, (UCHAR)-1},
    {11, ID_TBTN_UTILITY, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0L, 0},
    {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0L, (UCHAR)-1},
    {12, ID_TBTN_ABOUT, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0L, 0}
  };

  // Create the bitmap structure that represents the toolbar
  TBADDBITMAP tbBitmap;
  tbBitmap.hInst = AfxGetApp()->m_hInstance;
  tbBitmap.nID = IDR_TOOLBAR_MAIN;

  // Create the toolbar
  m_hwndToolBar = CreateToolbarEx(this->m_hWnd,                     // HWND of the toolbar's parent
                  WS_CHILD | WS_BORDER | WS_VISIBLE | TBSTYLE_TOOLTIPS, // Toolbar style
                  IDR_TOOLBAR_MAIN,                   // Toolbar Command ID
                  13,                           // Number of bitmaps
                  AfxGetApp()->m_hInstance,               // HINST of the module that contains the resource
                  IDR_TOOLBAR_MAIN,                   // Toolbar Resoure ID
                  (LPCTBBUTTON) &tbButtons,               // Toolbar button structure
                  19,                           // Number of buttons (including seperators)
                  16, 16,                         // Button width & height
                  16, 16,                         // Bitmap width & height
                  sizeof(TBBUTTON));                    // Size of single TBBUTTON structure (i.e., individual button)

  if (NULL != m_hwndToolBar)
  {
    CWnd* pToolBar = GetDlgItem(IDR_TOOLBAR_MAIN);
    pToolBar->SendMessage(TB_ENABLEBUTTON, ID_TBTN_NEW, MAKELONG(false, 0));
    pToolBar->SendMessage(TB_ENABLEBUTTON, ID_TBTN_SAVE, MAKELONG(false, 0));
    pToolBar->SendMessage(TB_ENABLEBUTTON, ID_TBTN_DELETE, MAKELONG(false, 0));
  }
  else
    MessageBox("Failed to create toolbar.\n\nPress OK to continue.",
          "Error",
          (MB_OK | MB_ICONERROR));

  // Enable the tooltip window for this CWnd object
  this->EnableToolTips(true);

  // Load the COM libraries
  HRESULT hr = CoInitialize(NULL);
  if SUCCEEDED(hr)
  {
    hr = CreateCatalog();
    if SUCCEEDED(hr)
      hr = NavigateTo(m_pCurrCollection);
  }

  // Display the computer name
  _bstr_t bstrComputerName = "( Local )";
  set_ComputerName(bstrComputerName);

  return TRUE;  // return TRUE  unless you set the focus to a control
}

void CVCExploreDlg::OnPaint ( ) [protected]

Definition at line 301 of file VCExploreDlg.Cpp.

{
  if (IsIconic())
  {
    CPaintDC dc(this); // device context for painting

    SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

    // Center icon in client rectangle
    int cxIcon = GetSystemMetrics(SM_CXICON);
    int cyIcon = GetSystemMetrics(SM_CYICON);
    CRect rect;
    GetClientRect(&rect);
    int x = (rect.Width() - cxIcon + 1) / 2;
    int y = (rect.Height() - cyIcon + 1) / 2;

    // Draw the icon
    dc.DrawIcon(x, y, m_hIcon);
  }
  else
  {
    CDialog::OnPaint();
  }
}

HCURSOR CVCExploreDlg::OnQueryDragIcon ( ) [protected]

Definition at line 328 of file VCExploreDlg.Cpp.

{
  return (HCURSOR) m_hIcon;
}

void CVCExploreDlg::OnSelChangeObjects ( ) [protected]

Definition at line 1059 of file VCExploreDlg.Cpp.

{
  DisplayPropertyValue();
}

void CVCExploreDlg::OnSelChangeParentCollections ( ) [protected]

Definition at line 925 of file VCExploreDlg.Cpp.

{
  TryToSaveChanges();

  // Determine which item is selected
  int nIndex = m_lstParentCollections.GetCurSel();

  // Remove the strings from the listbox and release the un-needed objects (i.e., un-wind/pop values off the stack)
  RemoveParent(nIndex);

  // Navigate to the "new" currrent CatalogCollection
  NavigateTo(m_pCurrCollection);

}

void CVCExploreDlg::OnSelChangeProperties ( ) [protected]

Definition at line 1064 of file VCExploreDlg.Cpp.

{
  DisplayPropertyValue();
}

void CVCExploreDlg::OnSelChangeRelatedCollections ( ) [protected]

Definition at line 816 of file VCExploreDlg.Cpp.

{
  TryToSaveChanges();

  // Get the index of the currently selected listbox item
  int   nCurrSelection = m_lstRelatedCollections.GetCurSel();

  // Get the currently selected items text (i.e., new collection name)
  int   nBufSize = m_lstRelatedCollections.GetTextLen(nCurrSelection) + 1;
  char* pBuf = new char[nBufSize];
  int   nRetVal = m_lstRelatedCollections.GetText(nCurrSelection, pBuf);

  // Attempt to get a reference to the new CatalogCollection object
  _bstr_t       bstrCollectionName = pBuf;
  _variant_t    vtCollectionKey;
  ICatalogCollection* pCatalogCollection = NULL;

  // We might need an object key, depending on which related collection was
  // selected
  HRESULT hr = E_UNEXPECTED;

  if (!lstrcmpW(bstrCollectionName, L"RolesForMethod") ||
      !lstrcmpW(bstrCollectionName, L"MethodsForInterface") ||
      !lstrcmpW(bstrCollectionName, L"InterfacesForComponent") ||
      !lstrcmpW(bstrCollectionName, L"RolesForComponent") ||
      !lstrcmpW(bstrCollectionName, L"Roles") ||
      !lstrcmpW(bstrCollectionName, L"SubscriptionsForComponent") ||
      !lstrcmpW(bstrCollectionName, L"UsersInRole") ||
      !lstrcmpW(bstrCollectionName, L"Components") )
  {
    //  Need to get the object key
    int   nObjectCurrSelection = m_lstObjects.GetCurSel();
    int   nObjectBufSize = m_lstObjects.GetTextLen(nObjectCurrSelection) + 1;
    char* pObjectBuf = new char[nObjectBufSize];
    nRetVal = m_lstObjects.GetText(nObjectCurrSelection, pObjectBuf);

    long  lCollectionCount;
    int   iLoopIndex;
    ICatalogObject* pCatalogObject = NULL;

    m_pCurrCollection->get_Count(&lCollectionCount);

    _bstr_t bstrSelObjName = pObjectBuf;
    for (iLoopIndex = 0; iLoopIndex < lCollectionCount; iLoopIndex++)
    {
      hr = m_pCurrCollection->get_Item(iLoopIndex, (IDispatch**)&pCatalogObject);
      if (SUCCEEDED(hr))
      {
        _variant_t vtName;
        hr = pCatalogObject->get_Name(&vtName);
        if (SUCCEEDED(hr) && !lstrcmp(bstrSelObjName, (_bstr_t)vtName))
        {
          // Found it
          break;
        }
        pCatalogObject->Release();
        pCatalogObject = NULL;
      }
    }

    if (pCatalogObject)
    {
      hr = pCatalogObject->get_Key(&vtCollectionKey);
      pCatalogObject->Release();
    }

    delete [] pObjectBuf;
  }
  else
  {
    // No key needed
    vtCollectionKey = bstrCollectionName;
  }

  hr = m_pCurrCollection->GetCollection(bstrCollectionName,
                        vtCollectionKey,
                        (IDispatch**) &pCatalogCollection);

  if SUCCEEDED(hr)
  {
    // Navigate to the new collection
    hr = NavigateTo(pCatalogCollection);

    if SUCCEEDED(hr)
    {
      // Increment the reference count to the current CatalogCollection
      //  before caching its value
      m_pCurrCollection->AddRef();

      // Add the current CatalogCollection to the ParentCollection
      //  listbox (i.e., cache the current CatalogCollection object)
      AddParent(m_pCurrCollection);

      // Increment the reference count to the temporary CatalogCollection
      //  object before setting/copying it as the currenct CatalogCollection
      pCatalogCollection->AddRef();

      // Set the "new" current CatalogCollection to the user's selection
      m_pCurrCollection = pCatalogCollection;
    }

    // Release the temporary ICatalogCollection pointer
    pCatalogCollection->Release();
  }

  // Cleanup
  delete [] pBuf;
}

void CVCExploreDlg::OnSetProperty ( ) [protected]

Definition at line 1109 of file VCExploreDlg.Cpp.

{
  // Continue only if we have a valid reference to a Catalog object
  if (NULL != m_pCatalog)
  {
    ICatalogObject* pCatalogObject = NULL;
    int       nObjectIndex = m_lstObjects.GetCurSel();
    int       nPropertyIndex = m_lstProperties.GetCurSel();

    // Only try to set a property value if a property of an object has actually
    //  been selected
    if ((LB_ERR == nObjectIndex) || (LB_ERR == nPropertyIndex))
      return;

    // Attempt to get a reference to the current CatalogObject selected
    HRESULT hr = m_pCurrCollection->get_Item(nObjectIndex,
                        (IDispatch**) &pCatalogObject);
    if SUCCEEDED(hr)
    {
      // Get the currently selected Properties name
      int   nTextLength = m_lstProperties.GetTextLen(nPropertyIndex);
      char* pBuf = new char[nTextLength + 1];
      m_lstProperties.GetText(nPropertyIndex, pBuf);
      _bstr_t bstrPropertyName = pBuf;
      delete [] pBuf;

      // Extract the new value from the UI
      int     nNewValueLength = m_edtPropertyValue.GetWindowTextLength() + 1;
      char*   pNewValueBuf = new char[nNewValueLength];
      m_edtPropertyValue.GetWindowText(pNewValueBuf, nNewValueLength);
      _bstr_t   bstrNewValue = pNewValueBuf;
      delete [] pNewValueBuf;
      _variant_t  vtPropertyValue = bstrNewValue;

      // Attempt to update the Properties value
      hr = pCatalogObject->put_Value(bstrPropertyName, vtPropertyValue);

      // Validate success/fail of the operation
      if SUCCEEDED(hr)
      {
        CWnd* pToolbar = GetDlgItem(IDR_TOOLBAR_MAIN);
        pToolbar->SendMessage(TB_ENABLEBUTTON, ID_TBTN_SAVE, MAKELONG(true, 0));
        m_bChangesArePending = TRUE;
      }
      else
        MessageBox("Failed to save the selected CatalogObject's property value.\n\nPress OK to continue.",
              "Error",
              (MB_OK | MB_ICONERROR));

      // Release the temporary CatalogObject
      pCatalogObject->Release();
    }
    else
      MessageBox("Failed to obtain a reference to the selected CatalogObject.\n\nNo Processing will be performed.\n\nPress OK to continue.",
            "Error",
            (MB_OK | MB_ICONERROR));
  }
  else
    MessageBox("Invalid Catalog object.\n\nNo Processing will be performed.\n\nPress OK to continue.",
          "Error",
          (MB_OK | MB_ICONERROR));
}

void CVCExploreDlg::OnSysCommand | ( | UINT | nID,
 |  | LPARAM | lParam |
 | ) |  |  | [protected]

Definition at line 284 of file VCExploreDlg.Cpp.

{
  if ((nID & 0xFFF0) == IDM_ABOUTBOX)
  {
    CAboutDlg dlgAbout;
    dlgAbout.DoModal();
  }
  else
  {
    CDialog::OnSysCommand(nID, lParam);
  }
}

void CVCExploreDlg::OnTBtnAbout ( ) [protected]

Definition at line 333 of file VCExploreDlg.Cpp.

{
  // Continue only if we have a valid reference to a Catalog object
  if (NULL != GetCatalog())
  {
    CAboutDlg dlg;

    // Display the "About" dialog
    dlg.DoModal();
  }
}

void CVCExploreDlg::OnTBtnConnect ( ) [protected]

Definition at line 345 of file VCExploreDlg.Cpp.

{
  if (NULL != GetCatalog())
  {
    CConnectDlg dlg;

    // Set the dialog's catalog reference...
    dlg.set_Catalog(GetCatalog());
    //... and set the "child" dialog's parent (i.e., communication channel)
    dlg.set_ParentDlg(this);

    // Display the "Connect" dialog
    dlg.DoModal();
  }
}

void CVCExploreDlg::OnTBtnDelete ( ) [protected]

Definition at line 361 of file VCExploreDlg.Cpp.

{
  // Get the current object selected
  int nObjectIndex = m_lstObjects.GetCurSel();

  // Continue only if an object is selected
  if (LB_ERR == nObjectIndex)
    return;

  // Attempt to remove the item from the collection
  HRESULT hr = m_pCurrCollection->Remove(nObjectIndex);
  if (SUCCEEDED(hr))
  {
    CWnd* pToolBar = GetDlgItem(IDR_TOOLBAR_MAIN);
    pToolBar->SendMessage(TB_ENABLEBUTTON, ID_TBTN_SAVE, MAKELONG(true, 0));
    m_bChangesArePending = TRUE;
  }
  else
  {
    MessageBox("Failed to delete the specified object from the current collection.\n\nPress OK to continue.",
          "Error",
          (MB_OK | MB_ICONERROR));
  }
}

void CVCExploreDlg::OnTBtnExportApp ( ) [protected]

Definition at line 386 of file VCExploreDlg.Cpp.

{
  if (NULL != GetCatalog())
  {
    CAppExportDlg dlg;

    // Set the dialog's catalog reference... ONLY if we aren't invoking the Connect dialog
    dlg.set_Catalog(GetCatalog());

    // Display the "App Export" dialog
    dlg.DoModal();
  }
}

void CVCExploreDlg::OnTBtnImportComponent ( ) [protected]

Definition at line 400 of file VCExploreDlg.Cpp.

{
  if (NULL != GetCatalog())
  {
    CCompImportDlg dlg;

    // Set the dialog's catalog reference... ONLY if we aren't invoking the Connect dialog
    dlg.set_Catalog(GetCatalog());

    // Display the "Import Component" dialog
    dlg.DoModal();
  }
}

void CVCExploreDlg::OnTBtnInstallApp ( ) [protected]

Definition at line 414 of file VCExploreDlg.Cpp.

{
  if (NULL != GetCatalog())
  {
    CAppInstallDlg dlg;

    // Set the dialog's catalog reference... ONLY if we aren't invoking the Connect dialog
    dlg.set_Catalog(GetCatalog());

    // Display the "Import Component" dialog
    dlg.DoModal();
  }
}

void CVCExploreDlg::OnTBtnInstallComponent ( ) [protected]

Definition at line 428 of file VCExploreDlg.Cpp.

{
  if (NULL != GetCatalog())
  {
    CCompInstallDlg dlg;

    // Set the dialog's catalog reference... ONLY if we aren't invoking the Connect dialog
    dlg.set_Catalog(GetCatalog());

    // Display the "Import Component" dialog
    dlg.DoModal();
  }
}

void CVCExploreDlg::OnTBtnNew ( ) [protected]

Definition at line 442 of file VCExploreDlg.Cpp.

{
  ICatalogObject* pCatalogObject = NULL;

  // Attempt to add a new item to the current collection
  HRESULT hr = m_pCurrCollection->Add((IDispatch**) &pCatalogObject);

  // Validate success/fail of the requested operation
  if SUCCEEDED(hr)
  {
     // Toggle the toolbar save button
    CWnd* pToolBar = GetDlgItem(IDR_TOOLBAR_MAIN);
    pToolBar->SendMessage(TB_ENABLEBUTTON, ID_TBTN_SAVE, MAKELONG(true, 0));
    m_bChangesArePending = TRUE;

    // Release the new CatalogObject reference
    pCatalogObject->Release();
  }
  else
    MessageBox("Failed to add the new object to the current collection.\n\nPress OK to continue.",
          "Error",
          (MB_OK | MB_ICONERROR));

  // Refresh the UI
  NavigateTo(m_pCurrCollection, FALSE);
}

void CVCExploreDlg::OnTBtnRefresh ( ) [protected]

Definition at line 469 of file VCExploreDlg.Cpp.

{
  // Refresh the UI with the current collection
  NavigateTo(m_pCurrCollection);
}

void CVCExploreDlg::OnTBtnSave ( ) [protected]

Definition at line 475 of file VCExploreDlg.Cpp.

{
  // Attempt to save the requested changes
  long lRetValue = 0;
  HRESULT hr = m_pCurrCollection->SaveChanges(&lRetValue);
  if FAILED(hr)
  {
    MessageBox("Failed to save changes to the current collection.\n\nPress OK to continue.",
          "Error",
          (MB_OK | MB_ICONERROR));
  }

   // Turn off the toolbar save button
  CWnd* pToolBar = GetDlgItem(IDR_TOOLBAR_MAIN);
  pToolBar->SendMessage(TB_ENABLEBUTTON, ID_TBTN_SAVE, MAKELONG(false, 0));
  m_bChangesArePending = FALSE;

  // Refresh the UI with the current collection
  NavigateTo(m_pCurrCollection);
}

void CVCExploreDlg::OnTBtnStartApp ( ) [protected]

Definition at line 496 of file VCExploreDlg.Cpp.

{
  if (NULL != GetCatalog())
  {
    CAppUtilDlg dlg;

    // Set the dialog's catalog reference... ONLY if we aren't invoking the Connect dialog
    dlg.set_Catalog(GetCatalog());

    // Set the dialog "type"
    dlg.set_UtilityType(UTILITY_TYPE_START_APP);

    // Display the "Import Component" dialog
    dlg.DoModal();
  }
}

void CVCExploreDlg::OnTBtnStopApp ( ) [protected]

Definition at line 513 of file VCExploreDlg.Cpp.

{
  if (NULL != GetCatalog())
  {
    CAppUtilDlg dlg;

    // Set the dialog's catalog reference... ONLY if we aren't invoking the Connect dialog
    dlg.set_Catalog(GetCatalog());

    // Set the dialog "type"
    dlg.set_UtilityType(UTILITY_TYPE_STOP_APP);

    // Display the "Import Component" dialog
    dlg.DoModal();
  }
}

void CVCExploreDlg::OnTBtnUtility ( ) [protected]

Definition at line 530 of file VCExploreDlg.Cpp.

{
  if (NULL != GetCatalog())
  {
    CUtilitiesDlg dlg;

    // Set the dialog's catalog reference... ONLY if we aren't invoking the Connect dialog
    dlg.set_Catalog(GetCatalog());

    // Display the "Import Component" dialog
    dlg.DoModal();
  }
}

void CVCExploreDlg::RemoveParent ( int nNewCurrIndex ) [private]

Definition at line 960 of file VCExploreDlg.Cpp.

{
  // Remove the strings from the listbox and release the un-needed objects (i.e., un-wind/pop values off the stack)
  for (int nPtr = (m_lstParentCollections.GetCount() - 1); nPtr >= nNewCurrIndex; nPtr--)
  {
    // Get the current listbox item's cached ICatalogCollection pointer
    ICatalogCollection* pCatalogCollection = (ICatalogCollection*) m_lstParentCollections.GetItemDataPtr(nPtr);

    // If we are on the item the user selected...
    if (nNewCurrIndex == nPtr)
    {
      //... release the CatalogCollection we are currently pointing to...
      m_pCurrCollection->Release();
      //... increment the number of references to the CatalogCollection we are currently using...
      pCatalogCollection->AddRef();
      //... set the "new" current CatalogCollection
      m_pCurrCollection = pCatalogCollection;
    }

    // Remove the current listbox item
    m_lstParentCollections.DeleteString(nPtr);

    // Release the temporary CatalogCollection object
    pCatalogCollection->Release();
  }
}

void CVCExploreDlg::set_ComputerName ( _bstr_t bstrComputerName )

Definition at line 1104 of file VCExploreDlg.Cpp.

{
  m_lblComputerName.SetWindowText(bstrComputerName);
}

void CVCExploreDlg::set_CurrentCollection ( ICatalogCollection * pCollection )

Definition at line 1081 of file VCExploreDlg.Cpp.

{
  // Clear the Object and Property listbox contents, if any
  m_lstObjects.ResetContent();
  m_lstProperties.ResetContent();

  // Release all of the parent Collection objects, if any
  RemoveParent(RELEASE_ALL_PARENT_OBJECTS);

  // Release the current Collection
  if (NULL != m_pCurrCollection)
    m_pCurrCollection->Release();

  // Assign the new Catalog
  m_pCurrCollection = pCollection;

  // Populate the collection
  HRESULT hr = m_pCurrCollection->Populate();
  if SUCCEEDED(hr)
    // Navigate to the new collection (i.e., fill in the UI)
    NavigateTo(m_pCurrCollection);
}

void CVCExploreDlg::TryToSaveChanges ( ) [private]

Definition at line 1172 of file VCExploreDlg.Cpp.

{
  if (!m_bChangesArePending)
  {
    // nothing to do
    return;
  }

  int iMBRet = MessageBox("Do you wish to save your changes before continuing?", "Changes may be lost!", MB_ICONQUESTION | MB_YESNO);
  if (iMBRet == IDYES)
  {
    long lCount;
    m_pCurrCollection->SaveChanges(&lCount);
  }
  CWnd* pToolBar = GetDlgItem(IDR_TOOLBAR_MAIN);
  pToolBar->SendMessage(TB_ENABLEBUTTON, ID_TBTN_SAVE, MAKELONG(false, 0));
  m_bChangesArePending = FALSE;
}

Member Data Documentation

BOOL CVCExploreDlg::m_bChangesArePending [private]

Definition at line 101 of file VCExploreDlg.h.

CButton CVCExploreDlg::m_btnSetProperty

Definition at line 40 of file VCExploreDlg.h.

CEdit CVCExploreDlg::m_edtPropertyValue

Definition at line 41 of file VCExploreDlg.h.

HICON CVCExploreDlg::m_hIcon [protected]

Definition at line 58 of file VCExploreDlg.h.

HWND CVCExploreDlg::m_hwndToolBar [private]

Definition at line 98 of file VCExploreDlg.h.

CStatic CVCExploreDlg::m_lblCollectionName

Definition at line 47 of file VCExploreDlg.h.

CStatic CVCExploreDlg::m_lblComputerName

Definition at line 46 of file VCExploreDlg.h.

CListBox CVCExploreDlg::m_lstObjects

Definition at line 45 of file VCExploreDlg.h.

CListBox CVCExploreDlg::m_lstParentCollections

Definition at line 44 of file VCExploreDlg.h.

CListBox CVCExploreDlg::m_lstProperties

Definition at line 43 of file VCExploreDlg.h.

CListBox CVCExploreDlg::m_lstRelatedCollections

Definition at line 42 of file VCExploreDlg.h.

ICOMAdminCatalog* CVCExploreDlg::m_pCatalog [private]

Definition at line 99 of file VCExploreDlg.h.

ICatalogCollection* CVCExploreDlg::m_pCurrCollection [private]

Definition at line 100 of file VCExploreDlg.h.

The documentation for this class was generated from the following files:
  • Com/Administration/Explore.VC/VCExploreDlg.h
  • Com/Administration/Explore.VC/VCExploreDlg.Cpp
Generated on Wed Nov 13 2024 16:57:40 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CVCSecuritySampleClass Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CVCSecuritySampleClass Class Reference

#include "VCSecuritySampleCLASS.h"

List of all members.

Public Member Functions

CVCSecuritySampleClass ()
STDMETHOD() | AmIAnAdministrator (short *)
STDMETHOD() | WhoAmI (BSTR *)

Detailed Description

Definition at line 10 of file VCSecuritySampleCLASS.h.

Constructor & Destructor Documentation

CVCSecuritySampleClass::CVCSecuritySampleClass ( ) [inline]

Definition at line 16 of file VCSecuritySampleCLASS.h.

  {
  }

Member Function Documentation

STDMETHODIMP CVCSecuritySampleClass::AmIAnAdministrator ( short * retval )

Definition at line 13 of file VCSecuritySampleCLASS.Cpp.

{
IObjectContext * pObjCtx;
HRESULT hr;
int fIsInRole;

hr = CoGetObjectContext(IID_IObjectContext, (void**)&pObjCtx);
if(FAILED(hr))
{
  *retval = 2;
  return S_OK;
}

if(NULL == pObjCtx)
{
    //Return Error Code
  *retval = 2;
  return S_OK;
}

if(!pObjCtx->IsSecurityEnabled())
{
    //Return Error Code
  *retval = 2;
  return S_OK;
}

BSTR strAdminRole = SysAllocString(L"Administrator");
hr = pObjCtx->IsCallerInRole(strAdminRole, &fIsInRole);
SysFreeString(strAdminRole);

//An error will be caused if the Administrator role does
//not exist.
if(CONTEXT_E_ROLENOTFOUND == hr)
{
  *retval = 0;
  return S_OK;
}

if(FAILED(hr))
{
  *retval = 2;
  return S_OK;
}

if (fIsInRole)
  *retval = 1;
else
  *retval = 0;

return S_OK;

}

STDMETHODIMP CVCSecuritySampleClass::WhoAmI ( BSTR * retval )

Definition at line 69 of file VCSecuritySampleCLASS.Cpp.

{
IObjectContext * pIObjCtx = NULL;
ISecurityProperty* pISecurityProperty = NULL;
DWORD     cbDomain = 20;
DWORD     cbUserName = 20 ;
OLECHAR     lpwstrDomain[20 + 20 + 2] = _T("");
OLECHAR     lpwstrUserName[20] = _T("");
PSID      pSID = NULL;
SID_NAME_USE  peUse;

if(FAILED(CoGetObjectContext(IID_IObjectContext, (void**)&pIObjCtx)))
  goto error;

if(NULL == pIObjCtx)
  goto error;

if(!pIObjCtx->IsSecurityEnabled())
  goto error;

if(FAILED(pIObjCtx->QueryInterface(IID_ISecurityProperty,
  (void**)&pISecurityProperty)))
  goto error;

if(FAILED(pISecurityProperty->GetDirectCallerSID(&pSID)))
  goto error;

if(!LookupAccountSid(NULL, pSID,lpwstrUserName,&cbUserName,
  lpwstrDomain, &cbDomain, &peUse))
  goto error;

if((!cbDomain) || (!cbUserName))
  goto error;

_tcsncat(lpwstrDomain, _T("\\"),1);
_tcsncat(lpwstrDomain, lpwstrUserName, _tcslen(lpwstrUserName));
*retval = SysAllocString(lpwstrDomain);
goto cleanup;

error:
*retval = SysAllocString(L"");
goto cleanup;

cleanup:
if(pSID)
  pISecurityProperty->ReleaseSID(pSID);
if(pIObjCtx)
  pIObjCtx->Release();
if(pISecurityProperty)
  pISecurityProperty->Release();
return S_OK;
}

The documentation for this class was generated from the following files:
  • Com/Services/Security/VC/VCSecuritySampleCLASS.h
  • Com/Services/Security/VC/VCSecuritySampleCLASS.Cpp
Generated on Wed Nov 13 2024 16:57:40 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CVector< TYPE, IDX > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CVector< TYPE, IDX > Class Template Reference

#include "list.h"

Inherited by CVectorEx< TYPE, IDX >.

List of all members.

Public Member Functions

CVector (IDX ulLowerBound=0, IDX ulGrowSize=10)
virtual | ~CVector ()
virtual TYPE * | AddElement (TYPE element)
virtual void | Attach (IDX cElements, TYPE *rgElements)
virtual void | Attach (CVector &rVector)
virtual void | Detach (IDX *pcElements, TYPE **prgElements)
virtual const IDX | GetCount ()
virtual TYPE & | GetElement (IDX iIndex)
virtual const TYPE * | GetElements () const
virtual TYPE * | InsertAt (IDX iIndex, TYPE element)
virtual TYPE & | operator[] (IDX iIndex)
virtual void | RemoveAll ()
virtual void | RemoveAt (IDX iIndex)

Protected Attributes

IDX | m_cElements
TYPE * | m_rgElements
IDX | m_ulGrowSize
IDX | m_ulLowerBound
IDX | m_ulMaxSize

Detailed Description

template<class TYPE, class IDX = ULONG>
class CVector< TYPE, IDX >

Definition at line 803 of file list.h.

Constructor & Destructor Documentation

template<class TYPE , class IDX>
CVector< TYPE, IDX >::CVector | ( | IDX | ulLowerBound = 0,
 |  | IDX | ulGrowSize = 10
 | ) |  |

Definition at line 846 of file list.h.

{
    //construct the array
    m_ulLowerBound = ulLowerBound;
    m_ulMaxSize = 0;
    m_ulGrowSize = ulGrowSize;

    m_cElements = 0;
    m_rgElements = NULL;
}

template<class TYPE , class IDX >
CVector< TYPE, IDX >::~CVector ( ) [virtual]

Definition at line 862 of file list.h.

{
    //Delete the Array
    CoTaskMemFree(m_rgElements);
    m_rgElements    = NULL;
    m_cElements        = 0;
}

Member Function Documentation

template<class TYPE, class IDX >
TYPE * CVector< TYPE, IDX >::AddElement ( TYPE element ) [virtual]

Definition at line 959 of file list.h.

{
    //Add an element to the end of the list

    //Just delegate out to our InsertAt method, since we may need
    //to enlarge the buffer size...
    return InsertAt(m_cElements + m_ulLowerBound, element);
}

template<class TYPE , class IDX >
void CVector< TYPE, IDX >::Attach ( CVector< TYPE, IDX > & rVector ) [virtual]

Definition at line 875 of file list.h.

{
    //Detach from passed in object
    IDX cElements = 0;
    TYPE* rgElements = NULL;
    rVector.Detach(&cElements, &rgElements);

    //Now Attch them to our object
    Attach(cElements, rgElements);
}

template<class TYPE, class IDX>
void CVector< TYPE, IDX >::Attach | ( | IDX | cElements,
 |  | TYPE * | rgElements |
 | ) |  |  | [virtual]

Definition at line 891 of file list.h.

{
    RemoveAll();
    CoTaskMemFree(m_rgElements);

    m_ulMaxSize        = cElements;
    m_cElements        = cElements;
    m_rgElements    = rgElements;
}

template<class TYPE, class IDX>
void CVector< TYPE, IDX >::Detach | ( | IDX * | pcElements,
 |  | TYPE ** | prgElements |
 | ) |  |  | [virtual]

Definition at line 906 of file list.h.

{
    ASSERT(pcElements);
    ASSERT(prgElements);

    //Give our elements to the user...
    *pcElements = m_cElements;
    *prgElements = m_rgElements;

    //We are done with them (consumer owns them...)
    m_ulMaxSize    = 0;
    m_cElements = 0;
    m_rgElements = NULL;
}

template<class TYPE, class IDX = ULONG>
virtual const IDX CVector< TYPE, IDX >::GetCount ( ) [inline, virtual]

Definition at line 829 of file list.h.

{    return m_cElements;            }

template<class TYPE , class IDX>
TYPE & CVector< TYPE, IDX >::GetElement ( IDX iIndex ) [virtual]

Definition at line 1008 of file list.h.

{
    iIndex -= m_ulLowerBound;

    ASSERT(m_rgElements && iIndex < m_cElements);
    return m_rgElements[iIndex];
}

template<class TYPE, class IDX = ULONG>
virtual const TYPE* CVector< TYPE, IDX >::GetElements ( ) const [inline, virtual]

Definition at line 830 of file list.h.

{    return m_rgElements;        }

template<class TYPE, class IDX>
TYPE * CVector< TYPE, IDX >::InsertAt | ( | IDX | iIndex,
 |  | TYPE | element |
 | ) |  |  | [virtual]

Definition at line 972 of file list.h.

{
    iIndex -= m_ulLowerBound;
    ASSERT(iIndex <= m_cElements); //Could be adding at end

    //May need to alloc more room (if needed)
    if(m_cElements == m_ulMaxSize)
    {
        m_ulMaxSize += 1 + m_ulGrowSize;
        m_rgElements = (TYPE*)CoTaskMemRealloc(m_rgElements, m_ulMaxSize * sizeof(TYPE));

        //Check Allocation
        if(!m_rgElements)
            return NULL;
    }

    //At this point we need an array...
    ASSERT(m_rgElements);

    //May Need to shift the entire array after this element down
    //If not inserting at the end of the list
    if(iIndex < m_cElements)
        memmove(&m_rgElements[iIndex+1], &m_rgElements[iIndex], (m_cElements-iIndex) * sizeof(TYPE));

    //Set new value
    m_rgElements[iIndex] = element;
    m_cElements++;
    return &m_rgElements[iIndex];
}

template<class TYPE, class IDX = ULONG>
virtual TYPE& CVector< TYPE, IDX >::operator[] ( IDX iIndex ) [inline, virtual]

Definition at line 826 of file list.h.

{    return GetElement(iIndex);    }

template<class TYPE , class IDX >
void CVector< TYPE, IDX >::RemoveAll ( ) [virtual]

Reimplemented in CBindings, CColumnInfo, CProperties, CPropertyInfos, TPropSetBase< TYPE, OBJTYPE >, TPropSetBase< DBPROPIDSET, CPropertyIDs >, TPropSetBase< DBPROPINFOSET, CPropertyInfos >, and TPropSetBase< DBPROPSET, CProperties >.

Definition at line 926 of file list.h.

{
    //NOTE: We don't actually free the array, for optmizations.
    //We just reset the count of elements, and m_ulMaxSize records the amount of
    //memory that can be reused without needing reallocations...
    m_cElements = 0;
}

template<class TYPE , class IDX>
void CVector< TYPE, IDX >::RemoveAt ( IDX iIndex ) [virtual]

Definition at line 939 of file list.h.

{
    //Remove CVector[position]
    iIndex -= m_ulLowerBound;
    ASSERT(iIndex < m_cElements);

    //May Need to shift the entire array after this element up
    //If it is not the last row in the vector
    if(iIndex < m_cElements)
        memmove(m_rgElements + iIndex, m_rgElements + iIndex + 1, (m_cElements-iIndex) * sizeof(TYPE));

    m_cElements--;
}

Member Data Documentation

template<class TYPE, class IDX = ULONG>
IDX CVector< TYPE, IDX >::m_cElements [protected]

Definition at line 837 of file list.h.

template<class TYPE, class IDX = ULONG>
TYPE* CVector< TYPE, IDX >::m_rgElements [protected]

Definition at line 838 of file list.h.

template<class TYPE, class IDX = ULONG>
IDX CVector< TYPE, IDX >::m_ulGrowSize [protected]

Definition at line 835 of file list.h.

template<class TYPE, class IDX = ULONG>
IDX CVector< TYPE, IDX >::m_ulLowerBound [protected]

Definition at line 836 of file list.h.

template<class TYPE, class IDX = ULONG>
IDX CVector< TYPE, IDX >::m_ulMaxSize [protected]

Definition at line 834 of file list.h.

The documentation for this class was generated from the following file:
  • Dataaccess/oledb/rowsetviewer/list.h
Generated on Wed Nov 13 2024 16:57:40 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CVectorEx< TYPE, IDX > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CVectorEx< TYPE, IDX > Class Template Reference

#include "list.h"

Inherits CVector< TYPE, IDX >.

List of all members.

Public Member Functions

CVectorEx (IDX ulLowerBound=0, IDX ulGrowSize=10)
virtual | ~CVectorEx ()
virtual IDX | FindElement (TYPE element)
virtual void | RemoveElement (TYPE element)

Detailed Description

template<class TYPE, class IDX = ULONG>
class CVectorEx< TYPE, IDX >

Definition at line 1023 of file list.h.

Constructor & Destructor Documentation

template<class TYPE , class IDX >
CVectorEx< TYPE, IDX >::CVectorEx | ( | IDX | ulLowerBound = 0,
 |  | IDX | ulGrowSize = 10
 | ) |  |

Definition at line 1044 of file list.h.

    : CVector<TYPE, IDX>(ulLowerBound, ulGrowSize)
{
}

template<class TYPE , class IDX >
CVectorEx< TYPE, IDX >::~CVectorEx ( ) [virtual]

Definition at line 1054 of file list.h.

{
}

Member Function Documentation

template<class TYPE , class IDX >
IDX CVectorEx< TYPE, IDX >::FindElement ( TYPE element ) [virtual]

Definition at line 1075 of file list.h.

{
    //return pointer to found element
    for(IDX i=0; i<m_cElements; i++)
      if(m_rgElements[i] == element)
        return i + m_ulLowerBound;   // return position to found element

    return ULONG_MAX;
}

template<class TYPE , class IDX >
void CVectorEx< TYPE, IDX >::RemoveElement ( TYPE element ) [virtual]

Definition at line 1062 of file list.h.

{
    //Try to find the index of the element
    IDX iIndex = FindElement(element);

    //Deletgate to our RemoveAt method
    RemoveAt(iIndex);
}

The documentation for this class was generated from the following file:
  • Dataaccess/oledb/rowsetviewer/list.h
Generated on Wed Nov 13 2024 16:57:40 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CView Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Protected Attributes

CView Class Reference

#include "View.Hxx"

Inherited by CAPIView, CPrintSDIView, and CScrollableView.

List of all members.

Public Member Functions

CView (int cx, int cy)
UINT | Hittest (CCanvas &canvas, POINT pt, CModel *_pModel)
void | Invalidate (HWND hwnd, LPRECT lpRect=NULL)
BOOL | Paint (CCanvas &canvas, CModel *_pModel, RECT rc)
void | SetSize (int cx, int cy)

Protected Member Functions

void | Scroll (CCanvas &canvas)

Protected Attributes

UINT _iScale
POINT | _ptClient
POINT | _ptOrg
POINT | _ptScroll
SIZE | _size

Detailed Description

Definition at line 25 of file View.Hxx.

Constructor & Destructor Documentation

CView::CView | ( | int | cx,
 |  | int | cy
 | ) |  |

Definition at line 31 of file View.Cxx.

{
        _iScale = 100;        // percentage magnification
        _ptOrg.x = 0;         // 0..(PAGEWIDTH - widht of window)
        _ptOrg.y = 0;         // 0..(PAGEHEIGHT - height of window)
        _ptScroll.x = 0;      // 0..PAGEWIDTH
        _ptScroll.y = 0;      // 0..PAGEHEIGHT
        _size.cx = cx;        // width of window (dev. coord)
        _size.cy = cy;        // widht of window (dev. coord)
}

Member Function Documentation

UINT CView::Hittest | ( | CCanvas & | canvas,
 |  | POINT | pt,
 |  | CModel * | _pModel
 | ) |  |

Definition at line 84 of file View.Cxx.

{

        // Scale using MapMode = logical TWIPS
        canvas.Scale(_iScale);

        // Client rect in logical coordinates
        _ptClient.x=_size.cx;
        _ptClient.y=_size.cy;
        canvas.DPtoLP(&_ptClient);

        // Adjust GDIwindow origin, set _ptOrg
        Scroll(canvas);

        // Hittest

        canvas.DPtoLP(&ptTest);
        return _pModel->Hittest( ptTest);
}

void CView::Invalidate | ( | HWND | hwnd,
 |  | LPRECT | lpRect = NULL
 | ) |  |

Definition at line 48 of file View.Cxx.

{
        InvalidateRect(hwnd, lpRect, TRUE);
}

BOOL CView::Paint | ( | CCanvas & | canvas,
 |  | CModel * | _pModel,
 |  | RECT | rc
 | ) |  |

Definition at line 53 of file View.Cxx.

{

        // Scale using MapMode = logical TWIPS
        canvas.Scale(_iScale);

        // Client rect in logical coordinates
        _ptClient.x=_size.cx;
        _ptClient.y=_size.cy;
        canvas.DPtoLP(&_ptClient);

        // Adjust GDIwindow origin, set _ptOrg
        Scroll(canvas);

        // ClipRectangle in logical coordinates
        POINT pt;
        pt.x = rc.left; pt.y = rc.top;
        canvas.DPtoLP(&pt);
        rc.left = pt.x; rc.top = pt.y;

        pt.x = rc.right; pt.y = rc.bottom;
        canvas.DPtoLP(&pt);
        rc.right = pt.x; rc.bottom = pt.y;

        // Paint
        _pModel->Paint(canvas, rc);

        return TRUE;  // screen Paints don't fail
}

void CView::Scroll ( CCanvas & canvas ) [protected]

Definition at line 104 of file View.Cxx.

{
        int dx=MulDiv(_ptClient.x,_ptScroll.x,PAGEWIDTH);
        int dy=MulDiv(_ptClient.y,_ptScroll.y,PAGEHEIGHT);

        // Adjust GDIwindow origin, set _ptOrg
        _ptOrg.x = _ptScroll.x-dx;
        _ptOrg.y = _ptScroll.y-dy;

        canvas.Scroll(_ptOrg.x, _ptOrg.y);
}

void CView::SetSize | ( | int | cx,
 |  | int | cy
 | ) |  |

Definition at line 42 of file View.Cxx.

{
        _size.cx = cx;
        _size.cy = cy;
}

Member Data Documentation

UINT CView::_iScale [protected]

Definition at line 36 of file View.Hxx.

POINT CView::_ptClient [protected]

Definition at line 39 of file View.Hxx.

POINT CView::_ptOrg [protected]

Definition at line 37 of file View.Hxx.

POINT CView::_ptScroll [protected]

Definition at line 38 of file View.Hxx.

SIZE CView::_size [protected]

Definition at line 35 of file View.Hxx.

The documentation for this class was generated from the following files:
  • Multimedia/Gdi/Fonts/GridFont/View.Hxx
  • Multimedia/Gdi/Fonts/GridFont/View.Cxx
Generated on Wed Nov 13 2024 16:57:40 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CViewList Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CViewList Class Reference

#include "Viewlist.h"

List of all members.

Public Member Functions

CViewList ()
~CViewList ()
BOOL AddToList (CShellView *)
CShellView * GetNextView (CShellView *)
VOID | RemoveFromList (CShellView *)

Private Member Functions

BOOL | DeleteList (VOID)

Private Attributes

LPVIEWLIST m_pFirst
LPVIEWLIST m_pLast
LPMALLOC | m_pMalloc

Detailed Description

Definition at line 43 of file Viewlist.h.

Constructor & Destructor Documentation

CViewList::CViewList ( )

Definition at line 31 of file Viewlist.Cpp.

{
m_pFirst = m_pLast = NULL;

//get the shell's IMalloc pointer
//we'll keep this until we get destroyed
if(FAILED(SHGetMalloc(&m_pMalloc)))
   {
   delete this;
   return;
   }
}

CViewList::~CViewList ( )

Definition at line 50 of file Viewlist.Cpp.

{
DeleteList();

if(m_pMalloc)
   m_pMalloc->Release();
}

Member Function Documentation

BOOL CViewList::AddToList ( CShellView * pView )

Definition at line 97 of file Viewlist.Cpp.

{
LPVIEWLIST  pNew;

pNew = (LPVIEWLIST)m_pMalloc->Alloc(sizeof(VIEWLIST));

if(pNew)
   {
   //set the next pointer
   pNew->pNext = NULL;
   pNew->pView = pView;

   //is this the first item in the list?
   if(!m_pFirst)
      {
      m_pFirst = pNew;
      }

   if(m_pLast)
      {
      //add the new item to the end of the list
      m_pLast->pNext = pNew;
      }

   //update the last item pointer
   m_pLast = pNew;

   return TRUE;
   }

return FALSE;
}

BOOL CViewList::DeleteList ( VOID ) [private]

Definition at line 178 of file Viewlist.Cpp.

{
LPVIEWLIST  pDelete;

while(m_pFirst)
   {
   pDelete = m_pFirst;
   m_pFirst = pDelete->pNext;

   //free the list item
   m_pMalloc->Free(pDelete);
   }

m_pFirst = m_pLast = NULL;

return TRUE;
}

CShellView * CViewList::GetNextView ( CShellView * pViewIn )

Definition at line 64 of file Viewlist.Cpp.

{
LPVIEWLIST  pTemp;
CShellView  *pViewOut = NULL;

if(!pViewIn)
   pTemp = m_pFirst;
else
   {
   for(pTemp = m_pFirst; pTemp; pTemp = pTemp->pNext)
      {
      if(pTemp->pView == pViewIn)
         {
         pTemp = pTemp->pNext;
         break;
         }
      }
   }

if(pTemp)
   {
   pViewOut = pTemp->pView;
   }

return pViewOut;
}

VOID CViewList::RemoveFromList ( CShellView * pView )

Definition at line 136 of file Viewlist.Cpp.

{
LPVIEWLIST  pDelete;
LPVIEWLIST  pPrev;

//find the item to be removed
for(pDelete = m_pFirst, pPrev = NULL; pDelete; pDelete = pDelete->pNext)
   {
   if(pDelete->pView == pView)
      break;

   //save the previous item in the list
   pPrev = pDelete;
   }

if(pDelete)
   {
   if(pPrev)
      {
      pPrev->pNext = pDelete->pNext;
      }
   else
      {
      //the item being deleted is the first item in the list
      m_pFirst = pDelete->pNext;
      }

   //was the last item deleted?
   if(!pDelete->pNext)
      m_pLast = pPrev;

   //free the list item
   m_pMalloc->Free(pDelete);
   }
}

Member Data Documentation

LPVIEWLIST CViewList::m_pFirst [private]

Definition at line 56 of file Viewlist.h.

LPVIEWLIST CViewList::m_pLast [private]

Definition at line 57 of file Viewlist.h.

LPMALLOC CViewList::m_pMalloc [private]

Definition at line 55 of file Viewlist.h.

The documentation for this class was generated from the following files:
  • WinUI/Shell/SampView/Viewlist.h
  • WinUI/Shell/SampView/Viewlist.Cpp
Generated on Wed Nov 13 2024 16:57:40 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CVirtualFile Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes

CVirtualFile Class Reference

#include "virtualfile.h"

Inherits CBaseNode, CBaseNode, CBaseNode, CBaseNode, and CBaseNode.

List of all members.

Public Member Functions

CVirtualFile ()
CVirtualFile ()
CVirtualFile ()
CVirtualFile ()
CVirtualFile ()
virtual | ~CVirtualFile ()
virtual | ~CVirtualFile ()
virtual | ~CVirtualFile ()
virtual | ~CVirtualFile ()
virtual | ~CVirtualFile ()
HRESULT | AddMenuItems (LPCONTEXTMENUCALLBACK ipCallback, long __RPC_FAR *pInsertionAllowed)
HRESULT | AddMenuItems (LPCONTEXTMENUCALLBACK ipCallback, long __RPC_FAR *pInsertionAllowed)
HRESULT | AddMenuItems (LPCONTEXTMENUCALLBACK ipCallback, long __RPC_FAR *pInsertionAllowed)
HRESULT | AddMenuItems (LPCONTEXTMENUCALLBACK ipCallback, long __RPC_FAR *pInsertionAllowed)
HRESULT | AddMenuItems (LPCONTEXTMENUCALLBACK ipCallback, long __RPC_FAR *pInsertionAllowed)
HRESULT | Command (long lCommandID)
HRESULT | Command (long lCommandID)
HRESULT | Command (long lCommandID)
HRESULT | Command (long lCommandID)
HRESULT | Command (long lCommandID)
HRESULT | ControlbarNotify (LPARAM nArg, LPARAM lParam, LONG_PTR pComp)
HRESULT | CreatePropertyPages (LPPROPERTYSHEETCALLBACK lpCallback, LONG_PTR Handle)
HRESULT | CreatePropertyPages (LPPROPERTYSHEETCALLBACK lpCallback, LONG_PTR Handle)
DWORD GetAttributes ()
DWORD GetAttributes ()
DWORD GetAttributes ()
DWORD GetAttributes ()
LPWSTR | GetAttributeString ()
LPWSTR | GetAttributeString ()
LPWSTR | GetAttributeString ()
LPWSTR | GetAttributeString ()
LPWSTR | GetAttributeString ()
LPWSTR | GetDescriptionString ()
HRESULT | GetDisplayInfo (RESULTDATAITEM *pRDI)
HRESULT | GetDisplayInfo (RESULTDATAITEM *pRDI)
HRESULT | GetDisplayInfo (SCOPEDATAITEM *pSDI)
HRESULT | GetDisplayInfo (SCOPEDATAITEM *pSDI)
HRESULT | GetDisplayInfo (RESULTDATAITEM *pRDI)
HRESULT | GetDisplayInfo (SCOPEDATAITEM *pSDI)
HRESULT | GetDisplayInfo (RESULTDATAITEM *pRDI)
HRESULT | GetDisplayInfo (RESULTDATAITEM *pRDI)
HRESULT | GetDisplayInfo (SCOPEDATAITEM *pSDI)
HRESULT | GetDisplayInfo (SCOPEDATAITEM *pSDI)
GUID & | GetNodeGUID ()
GUID & | GetNodeGUID ()
GUID & | GetNodeGUID ()
GUID & | GetNodeGUID ()
GUID & | GetNodeGUID ()
ULONG GetNodeType ()
ULONG GetNodeType ()
ULONG GetNodeType ()
ULONG GetNodeType ()
ULONG GetNodeType ()
LPWSTR | GetObjectPath ()
LONG_PTR | GetParent ()
HRESULT | GetProperties (LPNODEPROPS *ppNodeProps)
HRESULT | GetProperty (BSTR bstrPropertyName, PBSTR pbstrProperty)
HRESULT | GetResultViewType2 (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pRVTinfo)
HRESULT | GetResultViewType2 (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pRVTinfo)
HRESULT | GetResultViewType2 (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pRVTinfo)
HRESULT | GetResultViewType2 (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pRVTinfo)
HRESULT | GetResultViewType2 (MMC_COOKIE nCookie, PRESULT_VIEW_TYPE_INFO pRVTinfo)
HRESULT | GetWatermarks (HBITMAP __RPC_FAR *lphWatermark, HBITMAP __RPC_FAR *lphHeader, HPALETTE __RPC_FAR *lphPalette, BOOL __RPC_FAR *bStretch)
HRESULT | GetWatermarks (HBITMAP __RPC_FAR *lphWatermark, HBITMAP __RPC_FAR *lphHeader, HPALETTE __RPC_FAR *lphPalette, BOOL __RPC_FAR *bStretch)
HRESULT | Initialize (LPNODEPROPS pNodeProps)
HRESULT | Initialize (NODE_PROPERTIES *pNodeProps)
HRESULT | Initialize (NODE_PROPERTIES *pNodeProps)
HRESULT | Initialize (NODE_PROPERTIES *pNodeProps)
HRESULT | Initialize (LPNODEPROPS pNodeProps)
BOOL | IsAttributeSet (DWORD dwAttribute)
BOOL | IsAttributeSet (DWORD dwAttribute)
BOOL | IsAttributeSet (DWORD dwAttribute)
BOOL | IsAttributeSet (DWORD dwAttribute)
BOOL | IsAttributeSet (DWORD dwAttribute)
HRESULT | OnContextHelp (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnCutOrMove (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnDelete (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnDelete (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnDelete (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pComponent)
HRESULT | OnExpand (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pCompData)
HRESULT | OnExpand (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pCompData)
HRESULT | OnExpand (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pCompData)
HRESULT | OnExpand (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pCompData)
HRESULT | OnExpand (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pCompData)
HRESULT | OnPaste (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnQueryPaste (LPDATAOBJECT ipTargetDO, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnRemoveChildren (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pCompData)
HRESULT | OnRemoveChildren (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pCompData)
HRESULT | OnRemoveChildren (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pCompData)
HRESULT | OnRemoveChildren (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pCompData)
HRESULT | OnRemoveChildren (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pCompData)
HRESULT | OnRename (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnRename (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnRename (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnSelect (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pComponent)
HRESULT | OnSelect (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnSelect (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnSelect (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnSelect (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnShow (LPDATAOBJECT ipDataObject, LONG nArg, LONG nParam, LONG_PTR pComponent)
HRESULT | OnShow (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnShow (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnShow (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnShow (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnViewChange (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | OnViewChange (LPDATAOBJECT ipDataObject, LPARAM nArg, LPARAM nParam, LONG_PTR pComponent)
HRESULT | QueryForPropertyPage ()
HRESULT | QueryForPropertyPage ()
VOID | RemoveAttribute (DWORD dwAttribute)
VOID | RemoveAttribute (DWORD dwAttribute)
VOID | RemoveAttribute (DWORD dwAttribute)
VOID | RemoveAttribute (DWORD dwAttribute)
VOID | RemoveAttribute (DWORD dwAttribute)
VOID | SetAttribute (DWORD dwAttribute)
VOID | SetAttribute (DWORD dwAttribute)
VOID | SetAttribute (DWORD dwAttribute)
VOID | SetAttribute (DWORD dwAttribute)
VOID | SetAttribute (DWORD dwAttribute)

Public Attributes

LONG_PTR | m_nNotifyHandle

Private Member Functions

BOOL | OnApplyChanges (HWND hPage, WPARAM wParam, LPARAM lParam)
BOOL | OnApplyChanges (HWND hPage, WPARAM wParam, LPARAM lParam)
BOOL | OnInitPropPage (HWND hPage, WPARAM wParam, LPARAM lParam)
BOOL | OnInitPropPage (HWND hPage, WPARAM wParam, LPARAM lParam)

Static Private Member Functions

static BOOL CALLBACK | PPageWndProc0 (HWND hPage, UINT uMsg, WPARAM wParam, LPARAM lParam)
static BOOL CALLBACK | PPageWndProc0 (HWND hPage, UINT uMsg, WPARAM wParam, LPARAM lParam)

Private Attributes

DWORD m_dwAttributes
SYSTEMTIME | m_InitTime
WCHAR | m_pAttribStr [16]
WCHAR | m_pAttributeStr [16]
CComponentData * m_pCompData
CComponent * m_pComponent
WCHAR | m_pDescripStr [64]
CFolderNode * m_pParentFolder

Static Private Attributes

static GUID | m_thisGUID = CLSID_CVirtualFile
static GUID | thisGUID = CLSID_CVirtualFile

Detailed Description

Definition at line 29 of file virtualfile.h.

Constructor & Destructor Documentation

CVirtualFile::CVirtualFile ( )

Definition at line 36 of file virtualfile.cpp.

{
  m_RDI.mask      = DEFAULT_RDI_MASK;
  m_RDI.str       = MMC_CALLBACK;
  m_RDI.nImage    = IMG_DATA_FILE;
  m_RDI.lParam    = reinterpret_cast<LPARAM>(this);

  m_dwAttributes  = 0;
  m_pParentFolder = NULL;
  m_pCompData     = NULL;
}

CVirtualFile::~CVirtualFile ( ) [virtual]

Definition at line 49 of file virtualfile.cpp.

{
}

CVirtualFile::CVirtualFile ( )
virtual CVirtualFile::~CVirtualFile ( ) [virtual]
CVirtualFile::CVirtualFile ( )
virtual CVirtualFile::~CVirtualFile ( ) [virtual]
CVirtualFile::CVirtualFile ( )
virtual CVirtualFile::~CVirtualFile ( ) [virtual]
CVirtualFile::CVirtualFile ( )
virtual CVirtualFile::~CVirtualFile ( ) [virtual]

Member Function Documentation

HRESULT CVirtualFile::AddMenuItems | ( | LPCONTEXTMENUCALLBACK | ipCallback,
 |  | long __RPC_FAR * | pInsertionAllowed |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 430 of file virtualfile.cpp.

{
  HRESULT hResult = E_NOTIMPL;
  //TRACE_HRESULT(_T("AddMenuItems"), hResult );
  return hResult;
}

HRESULT CVirtualFile::AddMenuItems | ( | LPCONTEXTMENUCALLBACK | ipCallback,
 |  | long __RPC_FAR * | pInsertionAllowed |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CVirtualFile::AddMenuItems | ( | LPCONTEXTMENUCALLBACK | ipCallback,
 |  | long __RPC_FAR * | pInsertionAllowed |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CVirtualFile::AddMenuItems | ( | LPCONTEXTMENUCALLBACK | ipCallback,
 |  | long __RPC_FAR * | pInsertionAllowed |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CVirtualFile::AddMenuItems | ( | LPCONTEXTMENUCALLBACK | ipCallback,
 |  | long __RPC_FAR * | pInsertionAllowed |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CVirtualFile::Command ( long lCommandID ) [virtual]

Implements CBaseNode.

Definition at line 443 of file virtualfile.cpp.

{
  HRESULT hResult = E_NOTIMPL;
  //TRACE_HRESULT(_T("Command"), hResult );
  return hResult;
}

HRESULT CVirtualFile::Command ( long lCommandID ) [virtual]

Implements CBaseNode.

HRESULT CVirtualFile::Command ( long lCommandID ) [virtual]

Implements CBaseNode.

HRESULT CVirtualFile::Command ( long lCommandID ) [virtual]

Implements CBaseNode.

HRESULT CVirtualFile::Command ( long lCommandID ) [virtual]

Implements CBaseNode.

HRESULT CVirtualFile::ControlbarNotify | ( | LPARAM | nArg,
 |  | LPARAM | lParam,
 |  | LONG_PTR | pComp |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 200 of file virtualfile.cpp.

{
  HRESULT hResult = S_FALSE;
  BOOL bScope  = (BOOL)LOWORD(nArg);
  BOOL bSelect = (BOOL)HIWORD(nArg);

  CComponent* pComponent = reinterpret_cast<CComponent*>(pComp);

  IControlbar* ipControlbar = NULL;
  hResult = pComponent->GetInterface( REQUEST_ICONTROLBAR, (LONG_PTR*)&ipControlbar );
  if( S_OK != hResult )
    return hResult;

  IToolbar* ipToolbar = NULL;
  hResult = pComponent->GetInterface( REQUEST_IVFILETOOLBAR, (LONG_PTR*)&ipToolbar );
  if( S_OK != hResult )
    return hResult;

  if( TRUE == bSelect )
  {
    hResult = ipControlbar->Attach(TOOLBAR, (LPUNKNOWN)ipToolbar);
    hResult = ipToolbar->SetButtonState( IDM_CLEAR_ATTRIBS, ENABLED, TRUE );
  }
  else
  {
    hResult = ipControlbar->Detach( (LPUNKNOWN)ipToolbar );
  }

  return hResult;

}

HRESULT CVirtualFile::CreatePropertyPages | ( | LPPROPERTYSHEETCALLBACK | lpCallback,
 |  | LONG_PTR | Handle |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CVirtualFile::CreatePropertyPages | ( | LPPROPERTYSHEETCALLBACK | lpCallback,
 |  | LONG_PTR | Handle |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 275 of file virtualfile.cpp.

{
  HRESULT hResult = S_FALSE;

  m_nNotifyHandle = Handle;            // Cache the routing handle

  // Create an array of PropertySheetPages
  HPROPSHEETPAGE* hPPages = new HPROPSHEETPAGE[m_nPropPageCount];
  if( NULL == hPPages )
    return E_OUTOFMEMORY;

  PROPSHEETPAGE  psp;

  psp.dwSize      = sizeof(PROPSHEETPAGE);
  psp.dwFlags     = PSP_DEFAULT | PSP_USETITLE | PSP_HASHELP;
  psp.hInstance   = g_hInst;
  psp.pszTemplate = MAKEINTRESOURCE(IDD_VFILE_PPAGE0);
  psp.pfnDlgProc  = (DLGPROC)PPageWndProc0;
  psp.lParam      = reinterpret_cast<LPARAM>(this);
  psp.pszTitle    = _T("General");
  psp.pfnCallback = NULL;

  hPPages[0] = ::CreatePropertySheetPage( &psp );

  // Add the pages to the console's Property Sheet
  for( LONG nPageCount = 0; nPageCount < m_nPropPageCount; nPageCount++ )
  {
    hResult = lpCallback->AddPage( hPPages[nPageCount] );
    BREAK_ON_ERROR( hResult );
  }

  delete [] hPPages;

  return hResult;
}

DWORD CVirtualFile::GetAttributes ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 80 of file virtualfile.h.

{ return m_dwAttributes; }

DWORD CVirtualFile::GetAttributes ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 100 of file virtualfile.h.

{ return m_dwAttributes; }

DWORD CVirtualFile::GetAttributes ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 92 of file virtualfile.h.

{ return m_dwAttributes; }

DWORD CVirtualFile::GetAttributes ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 83 of file virtualfile.h.

{ return m_dwAttributes; }

LPWSTR CVirtualFile::GetAttributeString ( ) [virtual]

Implements CBaseNode.

LPWSTR CVirtualFile::GetAttributeString ( ) [virtual]

Implements CBaseNode.

Definition at line 405 of file virtualfile.cpp.

{
  *m_pAttributeStr = NULL;

  if( IsAttributeSet(ATTRIBUTE_DATA_ARCHIVE) )
    wcscat( m_pAttributeStr, L"A " );

  if( IsAttributeSet(ATTRIBUTE_DATA_HIDDEN) )
    wcscat( m_pAttributeStr, L"H " );

  if( IsAttributeSet(ATTRIBUTE_DATA_LOCKED) )
    wcscat( m_pAttributeStr, L"L " );

  if( IsAttributeSet(ATTRIBUTE_DATA_READONLY) )
    wcscat( m_pAttributeStr, L"R " );

  return m_pAttributeStr;
}

LPWSTR CVirtualFile::GetAttributeString ( ) [virtual]

Implements CBaseNode.

LPWSTR CVirtualFile::GetAttributeString ( ) [virtual]

Implements CBaseNode.

LPWSTR CVirtualFile::GetAttributeString ( ) [virtual]

Implements CBaseNode.

LPWSTR CVirtualFile::GetDescriptionString ( ) [inline]

Definition at line 91 of file virtualfile.h.

{ return m_pDescripStr; }

HRESULT CVirtualFile::GetDisplayInfo ( RESULTDATAITEM * pRDI ) [virtual]

Implements CBaseNode.

HRESULT CVirtualFile::GetDisplayInfo ( SCOPEDATAITEM * pSDI ) [inline, virtual]

Implements CBaseNode.

Definition at line 46 of file virtualfile.h.

            { return E_NOTIMPL; }

HRESULT CVirtualFile::GetDisplayInfo ( SCOPEDATAITEM * pSDI ) [inline, virtual]

Implements CBaseNode.

Definition at line 47 of file virtualfile.h.

            { return E_NOTIMPL; }

HRESULT CVirtualFile::GetDisplayInfo ( SCOPEDATAITEM * pSDI ) [inline, virtual]

Implements CBaseNode.

Definition at line 47 of file virtualfile.h.

            { return E_NOTIMPL; }

HRESULT CVirtualFile::GetDisplayInfo ( SCOPEDATAITEM * pSDI ) [inline, virtual]

Implements CBaseNode.

Definition at line 47 of file virtualfile.h.

            { return E_NOTIMPL; }

HRESULT CVirtualFile::GetDisplayInfo ( RESULTDATAITEM * pRDI ) [virtual]

Implements CBaseNode.

HRESULT CVirtualFile::GetDisplayInfo ( RESULTDATAITEM * pRDI ) [virtual]

Implements CBaseNode.

HRESULT CVirtualFile::GetDisplayInfo ( SCOPEDATAITEM * pSDI ) [inline, virtual]

Implements CBaseNode.

Definition at line 46 of file virtualfile.h.

            { return E_NOTIMPL; }

HRESULT CVirtualFile::GetDisplayInfo ( RESULTDATAITEM * pRDI ) [virtual]

Implements CBaseNode.

Definition at line 115 of file virtualfile.cpp.

{
  HRESULT hResult = S_OK;

  if( pRDI->mask & RDI_STR )         // Console is requesting strings...
  {                                  // for each column
    switch( pRDI->nCol )
    {
      case 0:
        pRDI->str = m_pwszNodeName;
        break;

      case 1:                        // Display attributes as a string
        pRDI->str = GetAttributeString();
        break;

      default:
        hResult = S_FALSE;
        TRACE_VAL(_T("GetDisplayInfo"), _T("Column"), pRDI->nCol );
        break;
    }
  }

  if( pRDI->mask & RDI_IMAGE )       // Looking for an image?
  {
    pRDI->nImage = m_RDI.nImage;
  }

  //TRACE_HRESULT(_T("GetDisplayInfo"), hResult );
  return hResult;
}

HRESULT CVirtualFile::GetDisplayInfo ( RESULTDATAITEM * pRDI ) [virtual]

Implements CBaseNode.

GUID& CVirtualFile::GetNodeGUID ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 41 of file virtualfile.h.

{ return thisGUID; }

GUID& CVirtualFile::GetNodeGUID ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 41 of file virtualfile.h.

{ return thisGUID; }

GUID& CVirtualFile::GetNodeGUID ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 42 of file virtualfile.h.

{ return m_thisGUID; }

GUID& CVirtualFile::GetNodeGUID ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 41 of file virtualfile.h.

{ return thisGUID; }

GUID& CVirtualFile::GetNodeGUID ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 42 of file virtualfile.h.

{ return thisGUID; }

ULONG CVirtualFile::GetNodeType ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 41 of file virtualfile.h.

{ return NODETYPE_VFILE; }

ULONG CVirtualFile::GetNodeType ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 40 of file virtualfile.h.

{ return NODETYPE_VFILE; }

ULONG CVirtualFile::GetNodeType ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 40 of file virtualfile.h.

{ return NODETYPE_VFILE; }

ULONG CVirtualFile::GetNodeType ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 41 of file virtualfile.h.

{ return NODETYPE_VFILE; }

ULONG CVirtualFile::GetNodeType ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 40 of file virtualfile.h.

{ return NODETYPE_VFILE; }

LPWSTR CVirtualFile::GetObjectPath ( ) [inline, virtual]

Implements CBaseNode.

Definition at line 102 of file virtualfile.h.

{ return L"X:\\TestDirectory\\TestFile.cpp"; }

LONG_PTR CVirtualFile::GetParent ( ) [inline]

Definition at line 88 of file virtualfile.h.

{ return (LONG_PTR)m_pParentFolder; }

HRESULT CVirtualFile::GetProperties ( LPNODEPROPS * ppNodeProps ) [virtual]

Implements CBaseNode.

Definition at line 86 of file virtualfile.cpp.

{
  _ASSERT( NULL == *ppNodeProps );

  LONG nBlockSize = sizeof(NODEPROPS);
  LPNODEPROPS pTmpProps = NULL;
  HGLOBAL hMemory = ::GlobalAlloc( GMEM_SHARE | GMEM_MOVEABLE, nBlockSize );
  if( NULL == hMemory )
    return E_OUTOFMEMORY;

  pTmpProps = (LPNODEPROPS)::GlobalLock( hMemory );
  ZeroMemory( pTmpProps, nBlockSize );
  wcscpy( pTmpProps->szNodeName,  m_pwszNodeName );
  pTmpProps->pComponentData = NULL;    // Pointers not used for DragDrop
  pTmpProps->pParentObject  = NULL;
  pTmpProps->dwAttributes   = m_dwAttributes;
  pTmpProps->nChildCount    = 0;       // Result nodes don't have children
  pTmpProps->nBlockSize     = nBlockSize;

  ::GlobalUnlock( pTmpProps );
  *ppNodeProps = pTmpProps;            // Return the properties

  return S_OK;
}

HRESULT CVirtualFile::GetProperty | ( | BSTR | bstrPropertyName,
 |  | PBSTR | pbstrProperty |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 325 of file virtualfile.cpp.

{
  HRESULT hResult = S_FALSE;
  BSTR bstrDesc = SysAllocString( L"CCF_DESCRIPTION" );
  BSTR bstrHTML = SysAllocString( L"CCF_HTML_DETAILS");

  if( NULL == bstrDesc || NULL == bstrHTML )
    return E_OUTOFMEMORY;

  if( VARCMP_EQ == VarBstrCmp(bstrPropertyName, bstrDesc, 0, 0) )
  {
    *pbstrProperty = SysAllocString( m_pDescripStr );
    if( NULL != *pbstrProperty )
      hResult = S_OK;
  }

  if( VARCMP_EQ == VarBstrCmp( bstrPropertyName, bstrHTML, 0, 0 ) )
  {
    // Build the script we want to run from our predefined mini-scripts
    // which are defined in Scripts.h
    //
    WCHAR szScriptBuffer[1024];
    wcscpy( szScriptBuffer, GSCRP_BEGIN_FORM    );
    wcscat( szScriptBuffer, GSCRP_RENAME_BUTTON );
    wcscat( szScriptBuffer, GSCRP_DELETE_BUTTON );
    wcscat( szScriptBuffer, GSCRP_LINK_HOMEPAGE );
    wcscat( szScriptBuffer, GSCRP_END_FORM      );

    *pbstrProperty = SysAllocString( szScriptBuffer );
    if( NULL != *pbstrProperty )
      hResult = S_OK;                  // If you don't return S_OK the HTML
  }                                    // code will not be executed

  SysFreeString( bstrDesc );           // Free string resources
  SysFreeString( bstrHTML );

  return hResult;
 }

HRESULT CVirtualFile::GetResultViewType2 | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pRVTinfo |
 | ) |  |  | [inline, virtual]

Implements CBaseNode.

Definition at line 43 of file virtualfile.h.

            { return E_NOTIMPL; }

HRESULT CVirtualFile::GetResultViewType2 | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pRVTinfo |
 | ) |  |  | [inline, virtual]

Implements CBaseNode.

Definition at line 44 of file virtualfile.h.

            { return E_NOTIMPL; }

HRESULT CVirtualFile::GetResultViewType2 | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pRVTinfo |
 | ) |  |  | [inline, virtual]

Implements CBaseNode.

Definition at line 44 of file virtualfile.h.

            { return E_NOTIMPL; }

HRESULT CVirtualFile::GetResultViewType2 | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pRVTinfo |
 | ) |  |  | [inline, virtual]

Implements CBaseNode.

Definition at line 44 of file virtualfile.h.

            { return E_NOTIMPL; }

HRESULT CVirtualFile::GetResultViewType2 | ( | MMC_COOKIE | nCookie,
 |  | PRESULT_VIEW_TYPE_INFO | pRVTinfo |
 | ) |  |  | [inline, virtual]

Implements CBaseNode.

Definition at line 43 of file virtualfile.h.

            { return E_NOTIMPL; }

HRESULT CVirtualFile::GetWatermarks | ( | HBITMAP __RPC_FAR * | lphWatermark,
 |  | HBITMAP __RPC_FAR * | lphHeader,
 |  | HPALETTE __RPC_FAR * | lphPalette,
 |  | BOOL __RPC_FAR * | bStretch |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CVirtualFile::GetWatermarks | ( | HBITMAP __RPC_FAR * | lphWatermark,
 |  | HBITMAP __RPC_FAR * | lphHeader,
 |  | HPALETTE __RPC_FAR * | lphPalette,
 |  | BOOL __RPC_FAR * | bStretch |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 317 of file virtualfile.cpp.

{
  HRESULT hResult = S_FALSE;

  return hResult;
}

HRESULT CVirtualFile::Initialize ( LPNODEPROPS pNodeProps ) [virtual]

Implements CBaseNode.

Definition at line 55 of file virtualfile.cpp.

{
  _ASSERT( NULL != pNodeProps );

  UINT   nLen   = wcslen( pNodeProps->szNodeName ) + 1;
  LPWSTR pszTmp = (LPWSTR)CoTaskMemAlloc(nLen * sizeof(WCHAR));
  wcscpy( pszTmp, pNodeProps->szNodeName );
  if( NULL != m_pwszNodeName )
    CoTaskMemFree( m_pwszNodeName );

  m_pwszNodeName  = pszTmp;
  m_pParentFolder = reinterpret_cast<CFolderNode*>(pNodeProps->pParentObject);
  m_pCompData     = reinterpret_cast<CComponentData*>(pNodeProps->pComponentData);
  m_dwAttributes  = pNodeProps->dwAttributes;

  return S_OK;
}

HRESULT CVirtualFile::Initialize ( NODE_PROPERTIES * pNodeProps ) [virtual]

Implements CBaseNode.

HRESULT CVirtualFile::Initialize ( NODE_PROPERTIES * pNodeProps ) [virtual]

Implements CBaseNode.

Definition at line 56 of file virtualfile.cpp.

{
  _ASSERT( NULL != pNodeProps );
  _ASSERT( NULL != pNodeProps->pParentObject );

  SIZE_T   nLen  = wcslen( pNodeProps->szNodeName ) + 1;
  LPWSTR pszTmp = (LPWSTR)CoTaskMemAlloc(nLen * sizeof(WCHAR));
  wcscpy( pszTmp, pNodeProps->szNodeName );
  if( NULL != m_pwszNodeName )
    CoTaskMemFree( m_pwszNodeName );

  m_pwszNodeName  = pszTmp;
  m_pParentFolder = reinterpret_cast<CFolderNode*>(pNodeProps->pParentObject);
  m_pCompData     = reinterpret_cast<CComponentData*>(pNodeProps->pComponentData);
  m_dwAttributes  = pNodeProps->dwAttributes;

  return S_OK;
}

HRESULT CVirtualFile::Initialize ( NODE_PROPERTIES * pNodeProps ) [virtual]

Implements CBaseNode.

HRESULT CVirtualFile::Initialize ( LPNODEPROPS pNodeProps ) [virtual]

Implements CBaseNode.

BOOL CVirtualFile::IsAttributeSet ( DWORD dwAttribute ) [virtual]

Implements CBaseNode.

Definition at line 379 of file virtualfile.cpp.

{
  return (m_dwAttributes & dwAttribute) ? TRUE : FALSE;
}

BOOL CVirtualFile::IsAttributeSet ( DWORD dwAttribute ) [virtual]

Implements CBaseNode.

BOOL CVirtualFile::IsAttributeSet ( DWORD dwAttribute ) [virtual]

Implements CBaseNode.

BOOL CVirtualFile::IsAttributeSet ( DWORD dwAttribute ) [virtual]

Implements CBaseNode.

BOOL CVirtualFile::IsAttributeSet ( DWORD dwAttribute ) [virtual]

Implements CBaseNode.

BOOL CVirtualFile::OnApplyChanges | ( | HWND | hPage,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private]

Definition at line 466 of file virtualfile.cpp.

{
  LRESULT lResult = 0;

  HWND hArchiveCtrl  = GetDlgItem( hPage, IDC_ARCHIVE_ATTR  );
  if( BST_CHECKED == SendMessage( hArchiveCtrl, BM_GETCHECK, 0, 0 ) )
    SetAttribute( ATTRIBUTE_DATA_ARCHIVE );
  else
    RemoveAttribute( ATTRIBUTE_DATA_ARCHIVE );

  HWND hHiddenCtrl   = GetDlgItem( hPage, IDC_HIDDEN_ATTR   );
  if( BST_CHECKED == SendMessage( hHiddenCtrl, BM_GETCHECK, 0, 0 ) )
    SetAttribute( ATTRIBUTE_DATA_HIDDEN );
  else
    RemoveAttribute( ATTRIBUTE_DATA_HIDDEN );

  HWND hLockedCtrl   = GetDlgItem( hPage, IDC_LOCKED_ATTR   );
  if( BST_CHECKED == SendMessage( hLockedCtrl, BM_GETCHECK, 0, 0 ) )
    SetAttribute( ATTRIBUTE_DATA_LOCKED );
  else
    RemoveAttribute( ATTRIBUTE_DATA_LOCKED );

  HWND hReadOnlyCtrl   = GetDlgItem( hPage, IDC_READONLY_ATTR   );
  if( BST_CHECKED == SendMessage( hReadOnlyCtrl, BM_GETCHECK, 0, 0 ) )
    SetAttribute( ATTRIBUTE_DATA_READONLY );
  else
    RemoveAttribute( ATTRIBUTE_DATA_READONLY );

  return TRUE;
}

BOOL CVirtualFile::OnApplyChanges | ( | HWND | hPage,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private]
HRESULT CVirtualFile::OnContextHelp | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 202 of file virtualfile.cpp.

{
  HRESULT   hResult = S_FALSE;
  CComponent* pComp = reinterpret_cast<CComponent*>(pComponent);

  LPOLESTR pszBaseHelpPath  = GetHelpFilePath();
  LPOLESTR pszTopicPath     = L"::/VirtualFiles.html";

  // Allocate space for the topic string
  SIZE_T nBasePathLen  = wcslen( pszBaseHelpPath );
  SIZE_T nTopicPathLen = wcslen( pszTopicPath );
  SIZE_T nBufferSize   = (nBasePathLen + nTopicPathLen + 1) * sizeof(WCHAR);

  // Build the topic string
  LPOLESTR pszThisTopicPath = (LPOLESTR)CoTaskMemAlloc( nBufferSize );
  wcscpy( pszThisTopicPath, pszBaseHelpPath );
  wcscat( pszThisTopicPath, pszTopicPath );

  // Request a pointer to IDisplayHelp
  IDisplayHelp* ipDisplayHelp = NULL;
  pComp->GetInterface( REQUEST_IDISPLAYHELP, (LONG_PTR*)&ipDisplayHelp );

  hResult = ipDisplayHelp->ShowTopic( pszThisTopicPath );

  TRACE_HRESULT(_T("OnContextHelp"), hResult );   // Return value is not used
  return hResult;
}

HRESULT CVirtualFile::OnCutOrMove | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 205 of file virtualfile.cpp.

{
  _ASSERT( NULL != m_pParentFolder );
  HRESULT hResult = S_FALSE;

  m_pParentFolder->RemoveChildNode( reinterpret_cast<LONG_PTR>(this) );

  LPRESULTDATA ipResultData = NULL;
  CComponent* pComp = reinterpret_cast<CComponent*>(pComponent);
  hResult = pComp->GetInterface( REQUEST_IRESULTDATA, (LONG_PTR*)&ipResultData );
  if( S_OK == hResult )
  {
    hResult = ipResultData->DeleteItem( m_RDI.itemID, 0 );
    delete this;
  }
  return hResult;
}

HRESULT CVirtualFile::OnDelete | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 171 of file virtualfile.cpp.

{
  _ASSERT( NULL != ipDataObject );
  _ASSERT( NULL != m_pParentFolder );

  HRESULT hResult = S_FALSE;

  m_pParentFolder->RemoveVirtualFile( this );

  LPRESULTDATA ipResultData = NULL;
  CComponent* pComp = reinterpret_cast<CComponent*>(pComponent);
  hResult = pComp->GetInterface( REQUEST_IRESULTDATA, (LONG_PTR*)&ipResultData );
  if( S_OK != hResult )
    return hResult;

  ipResultData->DeleteItem( m_RDI.itemID, 0 );
  delete this;

  return hResult;
}

HRESULT CVirtualFile::OnDelete | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CVirtualFile::OnDelete | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 170 of file virtualfile.cpp.

{
  _ASSERT( NULL != ipDataObject );
  _ASSERT( NULL != m_pParentFolder );

  HRESULT hResult = S_FALSE;

  m_pParentFolder->RemoveVirtualFile( this );

  LPRESULTDATA ipResultData = NULL;
  CComponent* pComp = reinterpret_cast<CComponent*>(pComponent);
  hResult = pComp->GetInterface( REQUEST_IRESULTDATA, (LONG_PTR*)&ipResultData );
  if( S_OK != hResult )
    return hResult;

  ipResultData->DeleteItem( m_RDI.itemID, 0 );
  delete this;

  return hResult;
}

HRESULT CVirtualFile::OnExpand | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [inline, virtual]

Implements CBaseNode.

Definition at line 59 of file virtualfile.h.

            { return E_NOTIMPL; }

HRESULT CVirtualFile::OnExpand | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [inline, virtual]

Implements CBaseNode.

Definition at line 70 of file virtualfile.h.

            { return E_NOTIMPL; }

HRESULT CVirtualFile::OnExpand | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [inline, virtual]

Implements CBaseNode.

Definition at line 69 of file virtualfile.h.

            { return E_NOTIMPL; }

HRESULT CVirtualFile::OnExpand | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [inline, virtual]

Implements CBaseNode.

Definition at line 59 of file virtualfile.h.

            { return E_NOTIMPL; }

HRESULT CVirtualFile::OnExpand | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [inline, virtual]

Implements CBaseNode.

Definition at line 63 of file virtualfile.h.

            { return E_NOTIMPL; }

BOOL CVirtualFile::OnInitPropPage | ( | HWND | hPage,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private]
BOOL CVirtualFile::OnInitPropPage | ( | HWND | hPage,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private]

Definition at line 435 of file virtualfile.cpp.

{
  LRESULT lResult = 0;

  HWND hArchiveCtrl  = GetDlgItem( hPage, IDC_ARCHIVE_ATTR  );
  HWND hHiddenCtrl   = GetDlgItem( hPage, IDC_HIDDEN_ATTR   );
  HWND hLockedCtrl   = GetDlgItem( hPage, IDC_LOCKED_ATTR   );
  HWND hReadOnlyCtrl = GetDlgItem( hPage, IDC_READONLY_ATTR );

  if( TRUE == IsAttributeSet( ATTRIBUTE_DATA_ARCHIVE ) )
    lResult = SendMessage( hArchiveCtrl,  BM_SETCHECK, BST_CHECKED, 0 );

  if( TRUE == IsAttributeSet( ATTRIBUTE_DATA_HIDDEN ) )
    lResult = SendMessage( hHiddenCtrl,  BM_SETCHECK, BST_CHECKED, 0 );

  if( TRUE == IsAttributeSet( ATTRIBUTE_DATA_LOCKED ) )
    lResult = SendMessage( hLockedCtrl,  BM_SETCHECK, BST_CHECKED, 0 );

  if( TRUE == IsAttributeSet( ATTRIBUTE_DATA_READONLY ) )
    lResult = SendMessage( hReadOnlyCtrl,  BM_SETCHECK, BST_CHECKED, 0 );

  return TRUE;
}

HRESULT CVirtualFile::OnPaste | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 309 of file virtualfile.cpp.

{
  _ASSERT( NULL != nArg );
  _ASSERT( NULL != pComponent );

  HRESULT hResult = S_FALSE;
  CComponent* pComp = reinterpret_cast<CComponent*>(pComponent);
  LPDATAOBJECT ipSourceDO = reinterpret_cast<LPDATAOBJECT>(nArg);

  do
  {
    // Test to see if the data object supports the clipformat we need
    //
    FORMATETC NodePropFormatEtc = NP_FORMATETC;
    hResult = ipSourceDO->QueryGetData( &NodePropFormatEtc );
    BREAK_ON_ERROR( hResult );

    STGMEDIUM StgMedium = {TYMED_HGLOBAL, NULL};
    hResult = ipSourceDO->GetData( &NodePropFormatEtc, &StgMedium );
    BREAK_ON_ERROR( hResult );

    NODE_PROPERTIES* pNodeProps = NULL;
    pNodeProps = (NODE_PROPERTIES*)::GlobalLock( StgMedium.hGlobal );

    // Set variables which must be local
    //
    pNodeProps->pParentObject  = reinterpret_cast<LONG_PTR>(this);
    pNodeProps->pComponentData = reinterpret_cast<LONG_PTR>(m_pCompData);

    // For Virtual Files all we care about are Attributes
    //
    SetAttribute( pNodeProps->dwAttributes );

    // Now do some housekeeping, and test that everything went OK....
    //
    BOOL    bStatus = ::GlobalUnlock( StgMedium.hGlobal );
    HGLOBAL hReturn = ::GlobalFree( StgMedium.hGlobal );
    _ASSERT( NULL == hReturn );

    if( NULL != nParam )              // Is this a copy or move?
    {
      // We just AddRef it becuase MMC will release it once when we
      // return, and again when CVirtualFile::OnCutOrMove returns.
      //
      BOOL* pbPasted = reinterpret_cast<BOOL*>(nParam);
      ULONG nCount = ipSourceDO->AddRef();
      *pbPasted = reinterpret_cast<BOOL>(ipSourceDO);
    }

    LPCONSOLE3 ipConsole3 = NULL;
    hResult = m_pCompData->GetInterface( REQUEST_ICONSOLE, (LONG_PTR*)&ipConsole3 );
    hResult = ipConsole3->SelectScopeItem( m_pParentFolder->m_SDI.ID );

  }while(0);

  return hResult;
}

HRESULT CVirtualFile::OnQueryPaste | ( | LPDATAOBJECT | ipTargetDO,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 272 of file virtualfile.cpp.

{
  _ASSERT( NULL != nArg );
  HRESULT hResult = S_FALSE;

  // Make the default operation "Copy Here" as opposed to "Move Here"
  //
  DWORD* pdwDefaultOperation = reinterpret_cast<DWORD*>(nParam);
  *pdwDefaultOperation = MMC_DEFAULT_OPERATION_COPY;

  // Disallow pasting on top of ourself
  //
  CBaseNode* pNode1 = ExtractBaseNodePtr( ipTargetDO );
  CBaseNode* pNode2 = ExtractBaseNodePtr( reinterpret_cast<LPDATAOBJECT>(nArg) );
  if( pNode1 == pNode2 )
    return S_FALSE;

  // Only allow other VFiles as source objects
  //
  ULONG nTypeFlag = ExtractNodeTypeFlg( reinterpret_cast<LPDATAOBJECT>(nArg) );
  return (NODETYPE_VFILE == nTypeFlag) ? S_OK : S_FALSE;
}

HRESULT CVirtualFile::OnRemoveChildren | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [inline, virtual]

Implements CBaseNode.

Definition at line 73 of file virtualfile.h.

            { return E_NOTIMPL; }

HRESULT CVirtualFile::OnRemoveChildren | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [inline, virtual]

Implements CBaseNode.

Definition at line 66 of file virtualfile.h.

            { return E_NOTIMPL; }

HRESULT CVirtualFile::OnRemoveChildren | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [inline, virtual]

Implements CBaseNode.

Definition at line 72 of file virtualfile.h.

            { return E_NOTIMPL; }

HRESULT CVirtualFile::OnRemoveChildren | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [inline, virtual]

Implements CBaseNode.

Definition at line 62 of file virtualfile.h.

            { return E_NOTIMPL; }

HRESULT CVirtualFile::OnRemoveChildren | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pCompData |
 | ) |  |  | [inline, virtual]

Implements CBaseNode.

Definition at line 62 of file virtualfile.h.

            { return E_NOTIMPL; }

HRESULT CVirtualFile::OnRename | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 233 of file virtualfile.cpp.

{
  _ASSERT( NULL != ipDataObject );
  HRESULT hResult = S_OK;

  LPWSTR pszTmpName = NULL;
  LPWSTR pszNewName = (LPWSTR)nParam;  // New name
  LONG   nLen = wcslen( pszNewName ) + 1;

  pszTmpName = (LPWSTR)CoTaskMemAlloc(nLen * sizeof(WCHAR));
  if( NULL == pszTmpName )
  {
    hResult = S_FALSE;                 // Can't change the name
  }
  else
  {
    wcscpy( pszTmpName, pszNewName );
    CoTaskMemFree( m_pwszNodeName );   // Free existing name...
    m_pwszNodeName = pszTmpName;       // Assign new name to pointer
  }

  return hResult;
}

HRESULT CVirtualFile::OnRename | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CVirtualFile::OnRename | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CVirtualFile::OnSelect | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CVirtualFile::OnSelect | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 156 of file virtualfile.cpp.

{
  HRESULT hResult = S_FALSE;

  CComponent* pComp = reinterpret_cast<CComponent*>(pComponent);

  IConsoleVerb* ipConsoleVerb = NULL;
  hResult = pComp->GetInterface( REQUEST_ICONSOLEVERB, (LONG_PTR*)&ipConsoleVerb );
  if( S_OK == hResult )
  {
    // DRAGDROP: Add MMC_VERB_CUT/COPY/PASTE verbs for this object.
    //
    hResult = ipConsoleVerb->SetVerbState( MMC_VERB_CUT,   ENABLED, TRUE );
    hResult = ipConsoleVerb->SetVerbState( MMC_VERB_COPY,  ENABLED, TRUE );
    hResult = ipConsoleVerb->SetVerbState( MMC_VERB_PASTE, ENABLED, TRUE );

    hResult = ipConsoleVerb->SetVerbState( MMC_VERB_RENAME, ENABLED, TRUE );
  }
  //TRACE_HRESULT(_T("OnSelect"), hResult );
  return hResult;
}

HRESULT CVirtualFile::OnSelect | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 120 of file virtualfile.cpp.

{
  HRESULT hResult = S_FALSE;

  BOOL    fScopePane = LOWORD(nArg);
  BOOL    fSelected  = HIWORD(nArg);

  // Don't care about de-select notifications so just return
  if( FALSE == fSelected )
    return hResult;

  CComponent* pComp = reinterpret_cast<CComponent*>(pComponent);

  IConsoleVerb* ipConsoleVerb = NULL;
  hResult = pComp->GetInterface( REQUEST_ICONSOLEVERB, (LONG_PTR*)&ipConsoleVerb );
  if( S_OK != hResult )
   return hResult;

  // PROPPAGE:  Adding the Properties verb and making it the default
  hResult = ipConsoleVerb->SetVerbState( MMC_VERB_DELETE,     ENABLED, TRUE );
  hResult = ipConsoleVerb->SetVerbState( MMC_VERB_PROPERTIES, ENABLED, TRUE );

  hResult = ipConsoleVerb->SetDefaultVerb( MMC_VERB_PROPERTIES );

  TRACE_HRESULT(_T("OnSelect"), hResult );
  return hResult;
}

HRESULT CVirtualFile::OnSelect | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CVirtualFile::OnSelect | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CVirtualFile::OnShow | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CVirtualFile::OnShow | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 186 of file virtualfile.cpp.

{
  HRESULT  hResult = S_FALSE;
  //TRACE_HRESULT(_T("OnShow"), hResult );
  return hResult;
}

HRESULT CVirtualFile::OnShow | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CVirtualFile::OnShow | ( | LPDATAOBJECT | ipDataObject,
 |  | LONG | nArg,
 |  | LONG | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

Definition at line 155 of file virtualfile.cpp.

{
  HRESULT  hResult = S_FALSE;

  TRACE_HRESULT(_T("OnShow"), hResult );
  return hResult;
}

HRESULT CVirtualFile::OnShow | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [virtual]

Implements CBaseNode.

HRESULT CVirtualFile::OnViewChange | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [inline, virtual]

Reimplemented from CBaseNode.

Definition at line 60 of file virtualfile.h.

            { return E_NOTIMPL; }

HRESULT CVirtualFile::OnViewChange | ( | LPDATAOBJECT | ipDataObject,
 |  | LPARAM | nArg,
 |  | LPARAM | nParam,
 |  | LONG_PTR | pComponent |
 | ) |  |  | [inline, virtual]

Reimplemented from CBaseNode.

Definition at line 65 of file virtualfile.h.

            { return E_NOTIMPL; }

BOOL CALLBACK CVirtualFile::PPageWndProc0 | ( | HWND | hPage,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static, private]

Definition at line 334 of file virtualfile.cpp.

{
  static CVirtualFile* pVFile  = NULL;
         BOOL          bReturn = FALSE;

  switch( uMsg )                       // Begin message switch
  {
    case WM_INITDIALOG:
    {
      // Cache the pointer to the calling instance of CVirtualFile and
      // call it's OnInitPropPage method
      PROPSHEETPAGE* psp = (PROPSHEETPAGE*)lParam;
      pVFile = reinterpret_cast<CVirtualFile*>(psp->lParam);
      pVFile->OnInitPropPage( hPage, wParam, lParam );
      break;
    }
    case WM_HELP:
    {
      LPOLESTR pszBasePath  = GetHelpFilePath();
      LPOLESTR pszTopicPath = L"::/WM_HELP.html";

      SIZE_T nBasePathLen  = wcslen( pszBasePath  );
      SIZE_T nTopicPathLen = wcslen( pszTopicPath );
      SIZE_T nBufferSize   = (nBasePathLen + nTopicPathLen + 1) * sizeof(WCHAR);

      LPOLESTR pszThisTopicPath = (LPOLESTR)CoTaskMemAlloc( nBufferSize );
      wcscpy( pszThisTopicPath, pszBasePath  );
      wcscat( pszThisTopicPath, pszTopicPath );

      CoTaskMemFree( pszBasePath );

      MMCPropertyHelp( pszThisTopicPath );
      break;
    }
    case WM_COMMAND:
    {
      // Activate the 'Apply' button if the user clicked a button
      if( BN_CLICKED == HIWORD(wParam) )
        SendMessage(GetParent(hPage), PSM_CHANGED, (WPARAM)hPage, 0);

      break;
    }
    case WM_DESTROY:
    {
      MMCFreeNotifyHandle( pVFile->m_nNotifyHandle );
      TRACE_START( _T("WM_DESTROY") );
      bReturn = TRUE;
    }

    case WM_NOTIFY:
    {
      if( 0 == lParam )  //BUGLIST:  AV if we don't do this
        return 0;

      switch( (reinterpret_cast<NMHDR*>(lParam))->code )
      {
        case PSN_APPLY:      // Really the 'OK' button
        {
          pVFile->OnApplyChanges( hPage, wParam, lParam );
          return PSNRET_NOERROR;
        }
        case PSN_HELP:
        {
          LPOLESTR pszBasePath  = GetHelpFilePath();
          LPOLESTR pszTopicPath = L"::/PSN_HELP.html";

          SIZE_T nBasePathLen  = wcslen( pszBasePath  );
          SIZE_T nTopicPathLen = wcslen( pszTopicPath );
          SIZE_T nBufferSize   = (nBasePathLen + nTopicPathLen + 1) * sizeof(WCHAR);

          LPOLESTR pszThisTopicPath = (LPOLESTR)CoTaskMemAlloc( nBufferSize );
          wcscpy( pszThisTopicPath, pszBasePath  );
          wcscat( pszThisTopicPath, pszTopicPath );

          CoTaskMemFree( pszBasePath );

          MMCPropertyHelp( pszThisTopicPath );
          return PSNRET_NOERROR;
        }
        default:
        {
          break;
        }
      } //end lParam->code switch
    } // end WM_NOTIFY

    default: break;

  } // end uMsg switch

  return bReturn;

}

static BOOL CALLBACK CVirtualFile::PPageWndProc0 | ( | HWND | hPage,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static, private]
HRESULT CVirtualFile::QueryForPropertyPage ( ) [virtual]

Implements CBaseNode.

HRESULT CVirtualFile::QueryForPropertyPage ( ) [virtual]

Implements CBaseNode.

Definition at line 266 of file virtualfile.cpp.

{
  TRACE_HRESULT(_T("OnShow"), S_OK );
  return S_OK;
}

VOID CVirtualFile::RemoveAttribute ( DWORD dwAttribute ) [virtual]

Implements CBaseNode.

VOID CVirtualFile::RemoveAttribute ( DWORD dwAttribute ) [virtual]

Implements CBaseNode.

Definition at line 397 of file virtualfile.cpp.

{
  m_dwAttributes &= ~dwAttribute;
}

VOID CVirtualFile::RemoveAttribute ( DWORD dwAttribute ) [virtual]

Implements CBaseNode.

VOID CVirtualFile::RemoveAttribute ( DWORD dwAttribute ) [virtual]

Implements CBaseNode.

VOID CVirtualFile::RemoveAttribute ( DWORD dwAttribute ) [virtual]

Implements CBaseNode.

VOID CVirtualFile::SetAttribute ( DWORD dwAttribute ) [virtual]

Implements CBaseNode.

VOID CVirtualFile::SetAttribute ( DWORD dwAttribute ) [virtual]

Implements CBaseNode.

Definition at line 388 of file virtualfile.cpp.

{
  m_dwAttributes |= dwAttribute;
}

VOID CVirtualFile::SetAttribute ( DWORD dwAttribute ) [virtual]

Implements CBaseNode.

VOID CVirtualFile::SetAttribute ( DWORD dwAttribute ) [virtual]

Implements CBaseNode.

VOID CVirtualFile::SetAttribute ( DWORD dwAttribute ) [virtual]

Implements CBaseNode.

Member Data Documentation

DWORD CVirtualFile::m_dwAttributes [private]

Reimplemented from CBaseNode.

Definition at line 89 of file virtualfile.h.

SYSTEMTIME CVirtualFile::m_InitTime [private]

Definition at line 83 of file virtualfile.h.

LONG_PTR CVirtualFile::m_nNotifyHandle

Definition at line 96 of file virtualfile.h.

WCHAR CVirtualFile::m_pAttribStr[16] [private]

Definition at line 81 of file virtualfile.h.

WCHAR CVirtualFile::m_pAttributeStr [private]

Reimplemented from CBaseNode.

Definition at line 90 of file virtualfile.h.

CComponentData * CVirtualFile::m_pCompData [private]

Definition at line 92 of file virtualfile.h.

CComponent* CVirtualFile::m_pComponent [private]

Definition at line 97 of file virtualfile.h.

WCHAR CVirtualFile::m_pDescripStr[64] [private]

Definition at line 82 of file virtualfile.h.

CFolderNode * CVirtualFile::m_pParentFolder [private]

Definition at line 91 of file virtualfile.h.

GUID CVirtualFile::m_thisGUID = CLSID_CVirtualFile [static, private]

Definition at line 92 of file virtualfile.h.

static GUID CVirtualFile::thisGUID = CLSID_CVirtualFile [static, private]

Definition at line 88 of file virtualfile.h.

The documentation for this class was generated from the following files:
  • SysMgmt/MMC/mmc2.0/dragdrop/virtualfile.h
  • SysMgmt/MMC/mmc2.0/help/virtualfile.h
  • SysMgmt/MMC/mmc2.0/multisel/virtualfile.h
  • SysMgmt/MMC/mmc2.0/proppage/virtualfile.h
  • SysMgmt/MMC/mmc2.0/viewex/virtualfile.h
  • SysMgmt/MMC/mmc2.0/dragdrop/virtualfile.cpp
  • SysMgmt/MMC/mmc2.0/help/virtualfile.cpp
  • SysMgmt/MMC/mmc2.0/multisel/virtualfile.cpp
  • SysMgmt/MMC/mmc2.0/proppage/virtualfile.cpp
  • SysMgmt/MMC/mmc2.0/viewex/virtualfile.cpp
Generated on Wed Nov 13 2024 16:57:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CWaitCursor Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CWaitCursor Class Reference

#include "cdialoglite.h"

List of all members.

Public Member Functions

CWaitCursor ()
virtual | ~CWaitCursor ()
void | RestoreCursor ()
void | WaitCursor ()

Protected Attributes

HCURSOR | m_hPrevCursor

Detailed Description

Definition at line 1069 of file cdialoglite.h.

Constructor & Destructor Documentation

CWaitCursor::CWaitCursor ( )

Definition at line 5518 of file cdialoglite.cpp.

{
  m_hPrevCursor = NULL;
  WaitCursor();
}

CWaitCursor::~CWaitCursor ( ) [virtual]

Definition at line 5529 of file cdialoglite.cpp.

{
  RestoreCursor();
};

Member Function Documentation

void CWaitCursor::RestoreCursor ( )

Definition at line 5552 of file cdialoglite.cpp.

{
  //Restore the previous cursor...
  SetCursor(m_hPrevCursor);
};

void CWaitCursor::WaitCursor ( )

Definition at line 5539 of file cdialoglite.cpp.

{
  static HCURSOR  hWaitCursor = LoadCursor(NULL, IDC_WAIT);

  //Set the "HourGlass" wait cursor
  m_hPrevCursor = SetCursor(hWaitCursor);
};

Member Data Documentation

HCURSOR CWaitCursor::m_hPrevCursor [protected]

Definition at line 1082 of file cdialoglite.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialoglite.h
  • Dataaccess/oledb/rowsetviewer/cdialoglite.cpp
Generated on Wed Nov 13 2024 16:57:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CWaitDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Protected Member Functions

CWaitDlg Class Reference

#include "WaitDlg.h"

List of all members.

Public Types

enum | { IDD = IDD_DIALOG1 }

Public Member Functions

CWaitDlg (CWnd *pParent=NULL)

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)

Detailed Description

Definition at line 16 of file WaitDlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 24 of file WaitDlg.h.

{ IDD = IDD_DIALOG1 };

Constructor & Destructor Documentation

CWaitDlg::CWaitDlg ( CWnd * pParent = NULL )

Definition at line 22 of file WaitDlg.Cpp.

  : CDialog(CWaitDlg::IDD, pParent)
{
  //{{AFX_DATA_INIT(CWaitDlg)
    // NOTE: the ClassWizard will add member initialization here
  //}}AFX_DATA_INIT
}

Member Function Documentation

void CWaitDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 31 of file WaitDlg.Cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CWaitDlg)
    // NOTE: the ClassWizard will add DDX and DDV calls here
  //}}AFX_DATA_MAP
}

The documentation for this class was generated from the following files:
  • WinBase/WtsApi/WtsApi/WaitDlg.h
  • WinBase/WtsApi/WtsApi/WaitDlg.Cpp
Generated on Wed Nov 13 2024 16:57:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CWaitSystemDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Private Attributes

CWaitSystemDlg Class Reference

#include "WaitSystemDlg.h"

List of all members.

Public Types

enum | { IDD = IDD_WAIT_SYSTEM_EVENT }

Public Member Functions

CWaitSystemDlg (CWnd *pParent=NULL)

Public Attributes

CListBox | m_eventFlags
CEdit | m_serverName

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
virtual BOOL | OnInitDialog ()
virtual void | OnOK ()

Private Attributes

HANDLE serverHandle
LPSTR serverName

Detailed Description

Definition at line 23 of file WaitSystemDlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 31 of file WaitSystemDlg.h.

{ IDD = IDD_WAIT_SYSTEM_EVENT };

Constructor & Destructor Documentation

CWaitSystemDlg::CWaitSystemDlg ( CWnd * pParent = NULL )

Definition at line 42 of file WaitSystemDlg.Cpp.

  : CDialog(CWaitSystemDlg::IDD, pParent)
{
  //{{AFX_DATA_INIT(CWaitSystemDlg)
    // NOTE: the ClassWizard will add member initialization here
  //}}AFX_DATA_INIT
}

Member Function Documentation

void CWaitSystemDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 51 of file WaitSystemDlg.Cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CWaitSystemDlg)
  DDX_Control(pDX, IDC_SERVERNAME, m_serverName);
  DDX_Control(pDX, IDC_EVENT_FLAGS, m_eventFlags);
  //}}AFX_DATA_MAP
}

BOOL CWaitSystemDlg::OnInitDialog ( void ) [protected, virtual]

Definition at line 69 of file WaitSystemDlg.Cpp.

{
  CDialog::OnInitDialog();

  serverName = g_pDoc->GetServerName();
  serverHandle = WTSOpenServer(serverName);

  CString serverDisplay;
  serverDisplay = "Choose event for ";
  if (*serverName == NULL)
    serverDisplay += "local server";
  else
    serverDisplay += serverName;
  serverDisplay += " to wait on";

  m_serverName.SetWindowText(serverDisplay);

  for (int i=0; i < MAXEVENTITEMS; i++)
    m_eventFlags.InsertString(i, EventFlags[i].EventName);
  m_eventFlags.SetCurSel(0);
  return TRUE;
}

void CWaitSystemDlg::OnOK ( ) [protected, virtual]

Definition at line 94 of file WaitSystemDlg.Cpp.

{
  DWORD EventFlag;
  //CString message;
  int nIndex = m_eventFlags.GetCurSel();
  //message.Format("The current selection is  %x, %u", EventFlags[nIndex].EventFlag, EventFlags[nIndex].EventFlag);
  //MessageBox((LPCTSTR)message);
  if (!WTSWaitSystemEvent(serverHandle,
       EventFlags[nIndex].EventFlag, &EventFlag))
     AfxMessageBox("Unable to wait on system event");

  CDialog::OnOK();
}

Member Data Documentation

CListBox CWaitSystemDlg::m_eventFlags

Definition at line 33 of file WaitSystemDlg.h.

CEdit CWaitSystemDlg::m_serverName

Definition at line 32 of file WaitSystemDlg.h.

HANDLE CWaitSystemDlg::serverHandle [private]

Definition at line 54 of file WaitSystemDlg.h.

LPSTR CWaitSystemDlg::serverName [private]

Definition at line 55 of file WaitSystemDlg.h.

The documentation for this class was generated from the following files:
  • WinBase/WtsApi/WtsApi/WaitSystemDlg.h
  • WinBase/WtsApi/WtsApi/WaitSystemDlg.Cpp
Generated on Wed Nov 13 2024 16:57:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CWbemClientApp Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CWbemClientApp Class Reference

#include "WbemClient.h"

Inherits CWinApp.

List of all members.

Public Member Functions

CWbemClientApp ()
virtual BOOL | InitInstance ()
bool | InitSecurity ()

Detailed Description

Definition at line 25 of file WbemClient.h.

Constructor & Destructor Documentation

CWbemClientApp::CWbemClientApp ( )

Definition at line 31 of file WbemClient.Cpp.

{
  // TODO: add construction code here,
  // Place all significant initialization in InitInstance
}

Member Function Documentation

BOOL CWbemClientApp::InitInstance ( void ) [virtual]

Reimplemented from CWinApp.

Definition at line 45 of file WbemClient.Cpp.

{
  // Initialize OLE libraries
  if (!AfxOleInit())
  {
    AfxMessageBox(_T("Failed to initialize OLE"));
    return FALSE;
  }
  if (!InitSecurity())
  {
    AfxMessageBox(_T("Failed to fix security"));
    return FALSE;
  }

  // Standard initialization
  // If you are not using these features and wish to reduce the size
  //  of your final executable, you should remove from the following
  //  the specific initialization routines you do not need.

#ifdef _AFXDLL
  Enable3dControls();     // Call this when using MFC in a shared DLL
#else
  Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif

  CWbemClientDlg dlg;
  m_pMainWnd = &dlg;
  INT_PTR nResponse = dlg.DoModal();
  if (nResponse == IDOK)
  {
    // TODO: Place code here to handle when the dialog is
    //  dismissed with OK
  }
  else if (nResponse == IDCANCEL)
  {
    // TODO: Place code here to handle when the dialog is
    //  dismissed with Cancel
  }

  // Since the dialog has been closed, return FALSE so that we exit the
  //  application, rather than start the application's message pump.
  return FALSE;
}

bool CWbemClientApp::InitSecurity ( void )

Definition at line 94 of file WbemClient.Cpp.

{
  // Adjust the security to allow client impersonation.

  //  NOTE:
  //  When using asynchronous WMI API's remotely in an environment where the "Local System" account
  //  has no network identity (such as non-Kerberos domains), the authentication level of
  //  RPC_C_AUTHN_LEVEL_NONE is needed. However, lowering the authentication level to
  //  RPC_C_AUTHN_LEVEL_NONE makes your application less secure. It is wise to
  //  use semi-synchronous API's for accessing WMI data and events instead of the asynchronous ones.

  HRESULT hres = CoInitializeSecurity
                ( NULL, -1, NULL, NULL,
                      RPC_C_AUTHN_LEVEL_PKT_PRIVACY,
                      RPC_C_IMP_LEVEL_IMPERSONATE,
                      NULL,
                      EOAC_SECURE_REFS, //change to EOAC_NONE if you change dwAuthnLevel to RPC_C_AUTHN_LEVEL_NONE
                      NULL );
  return (SUCCEEDED(hres));
}

The documentation for this class was generated from the following files:
  • SysMgmt/WMI/VC/SimpleClient/WbemClient.h
  • SysMgmt/WMI/VC/SimpleClient/WbemClient.Cpp
Generated on Wed Nov 13 2024 16:57:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CWbemClientDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Attributes

CWbemClientDlg Class Reference

#include "WbemClientDlg.h"

List of all members.

Public Types

enum | { IDD = IDD_WBEMCLIENT_DIALOG }

Public Member Functions

CWbemClientDlg (CWnd *pParent=NULL)
~CWbemClientDlg ()

Public Attributes

CButton | m_diskInfo
CButton | m_enumDisks
CString m_namespace
CListBox | m_outputList

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
afx_msg void | OnConnect ()
afx_msg void | OnDiskinfo ()
afx_msg void | OnEnumdisks ()
virtual BOOL | OnInitDialog ()
afx_msg void | OnMakeoffice ()
afx_msg void | OnPaint ()
afx_msg HCURSOR | OnQueryDragIcon ()
afx_msg void | OnSysCommand (UINT nID, LPARAM lParam)

Protected Attributes

HICON | m_hIcon

Private Attributes

IWbemServices * | m_pIWbemServices
IWbemServices * | m_pOfficeService

Detailed Description

Definition at line 41 of file WbemClientDlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 58 of file WbemClientDlg.h.

{ IDD = IDD_WBEMCLIENT_DIALOG };

Constructor & Destructor Documentation

CWbemClientDlg::CWbemClientDlg ( CWnd * pParent = NULL )

Definition at line 72 of file WbemClientDlg.Cpp.

  : CDialog(CWbemClientDlg::IDD, pParent)
{
  //{{AFX_DATA_INIT(CWbemClientDlg)
  m_namespace = _T("\\\\.\\root\\cimv2");
  //}}AFX_DATA_INIT
  // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
  m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
  m_pIWbemServices = NULL;
  m_pOfficeService = NULL;
}

CWbemClientDlg::~CWbemClientDlg ( )

Definition at line 84 of file WbemClientDlg.Cpp.

{
  if (m_pIWbemServices)
    m_pIWbemServices->Release();
  if (m_pOfficeService)
    m_pOfficeService->Release();
}

Member Function Documentation

void CWbemClientDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 92 of file WbemClientDlg.Cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CWbemClientDlg)
  DDX_Control(pDX, IDC_DISKINFO, m_diskInfo);
  DDX_Control(pDX, IDC_ENUMDISKS, m_enumDisks);
  DDX_Control(pDX, IDC_OUTPUTLIST, m_outputList);
  DDX_Text(pDX, IDC_NAMESPACE, m_namespace);
  //}}AFX_DATA_MAP
}

void CWbemClientDlg::OnConnect ( ) [protected]

Definition at line 203 of file WbemClientDlg.Cpp.

{
  CWaitCursor wait; // show wait cursor until finished

  // Create an instance of the WbemLocator interface.
  IWbemLocator *pIWbemLocator = NULL;

  BSTR pNamespace = m_namespace.AllocSysString();
  if (!pNamespace)
  {
    AfxMessageBox(_T("AllocSysString() failed. "));
    return;
  }

  UpdateData();

  if(CoCreateInstance(CLSID_WbemLocator,
    NULL,
    CLSCTX_INPROC_SERVER,
    IID_IWbemLocator,
    (LPVOID *) &pIWbemLocator) == S_OK)
  {
    // If already connected, release m_pIWbemServices.
    if (m_pIWbemServices)  m_pIWbemServices->Release();

    // Using the locator, connect to CIMOM in the given namespace.

    if(pIWbemLocator->ConnectServer(pNamespace,
                NULL,   //using current account for simplicity
                NULL, //using current password for simplicity
                0L,   // locale
                0L,   // securityFlags
                NULL, // authority (domain for NTLM)
                NULL, // context
                &m_pIWbemServices) == S_OK)
    {
      // Indicate success.
      m_outputList.ResetContent();
      m_outputList.AddString(_T("Connected to namespace"));

      // It's safe the hit the other buttons now.
      m_enumDisks.EnableWindow(TRUE);

      //...except Disk Info button
      m_diskInfo.EnableWindow(FALSE);

    }
    else AfxMessageBox(_T("Bad namespace"));

    // Done with pNamespace.
    SysFreeString(pNamespace);

    // Done with pIWbemLocator.
    pIWbemLocator->Release();
  }
  else AfxMessageBox(_T("Failed to create IWbemLocator object"));
}

void CWbemClientDlg::OnDiskinfo ( ) [protected]

Definition at line 478 of file WbemClientDlg.Cpp.

{
  CWaitCursor wait;

  BSTR cimType  = SysAllocString(L"CIMTYPE");
  if (!cimType)
  {
    m_outputList.AddString(_T("SysAllocString failed"));
    return;
  }

  // OnEnumDisks must precede next OnDiskInfo.
  m_diskInfo.EnableWindow(FALSE);

  // Get selected disk from list box as a BSTR
  CString sDevice;
  int index = m_outputList.GetCurSel();
  m_outputList.GetText(index, sDevice);

  BSTR sDisk = sDevice.AllocSysString();
  if (!sDisk)
  {
    m_outputList.AddString(_T("SysAllocString failed"));
    return;
  }

  // Get the selected Win32_LogicalDisk instance.
  IWbemClassObject *pDisk = NULL;

  HRESULT hRes = m_pIWbemServices->GetObject(
    sDisk,    // object path
    0L, NULL,
    &pDisk,   // pointer to object
    NULL);

  SysFreeString(sDisk);
  if (FAILED(hRes))
  {
    m_outputList.AddString(_T("GetObject() failed"));
    return;
  }

  // Get the property names from this instance.
  SAFEARRAY *psaNames = NULL;

  hRes = pDisk->GetNames(
    NULL,
    WBEM_FLAG_ALWAYS | WBEM_FLAG_NONSYSTEM_ONLY,
    NULL,
    &psaNames);

  if (SUCCEEDED(hRes))
  {
    // Get the number of properties.
    long lLower, lUpper;

    SafeArrayGetLBound(psaNames, 1, &lLower);
    SafeArrayGetUBound(psaNames, 1, &lUpper);
    TRACE("SAFEARRAY from %d to %d\n", lLower, lUpper);

    // For each property...
    BSTR PropName = NULL;

    m_outputList.ResetContent();

    for (long i = lLower; i <= lUpper; i++)
    {
      // Get this property.
      hRes = SafeArrayGetElement(
        psaNames,
        &i,
        &PropName);
      if (SUCCEEDED(hRes))
      {
        // Format: name (type) ==> value
        CString sProp = CString(PropName) + _T(" (");

        VARIANT pVal;
        VariantClear(&pVal);

        // Get qualifier set for this property.
        // Note that system properties have no qualifier set.
        IWbemQualifierSet *pQualSet = NULL;

        hRes = pDisk->GetPropertyQualifierSet(
          PropName,   // name of property
          &pQualSet);   // qualifier set pointer

        if (SUCCEEDED(hRes))
        {
          hRes = pQualSet->Get(
            cimType,  // property name
            0L,
            &pVal,    // output to this variant
            NULL);

          if (SUCCEEDED(hRes))
          {
             sProp += V_BSTR(&pVal);
          }
        }
        sProp += _T(")");
        m_outputList.AddString(sProp);
      }
      SysFreeString(PropName);

    }
    SafeArrayDestroy(psaNames);
  }
  pDisk->Release();
}

void CWbemClientDlg::OnEnumdisks ( ) [protected]

Definition at line 263 of file WbemClientDlg.Cpp.

{
  CWaitCursor wait; // show wait cursor until finished

  HRESULT hRes = S_OK;
  IEnumWbemClassObject *pEnumStorageDevs = NULL;

  m_outputList.ResetContent();

  // Get the Win32_LogicalDisk class
  BSTR className = SysAllocString(L"Win32_LogicalDisk");
  if (!className)
  {
    hRes = WBEM_E_OUT_OF_MEMORY;
    m_outputList.AddString( ErrorMsg(_T("OnEnumdisks() failed:"), hRes));
    return;
  }

  // Get the list of logical storage device instances.
  hRes = m_pIWbemServices->CreateInstanceEnum(
    className,      // name of class
    0,
    NULL,
    &pEnumStorageDevs); // pointer to enumerator

  SysFreeString(className);

  // For each logical storage device...
  if (SUCCEEDED(hRes))
  {
    ULONG uReturned = 1;
    while(uReturned == 1)
    {
      IWbemClassObject *pStorageDev = NULL;
      //---------------------------
      // enumerate through the resultset.
      hRes = pEnumStorageDevs->Next(
        2000,     // timeout in two seconds
        1,        // return just one storage device
        &pStorageDev, // pointer to storage device
        &uReturned);  // number obtained: one or zero

      if (SUCCEEDED(hRes) && (uReturned == 1))
      {
        VARIANT pVal;
        VariantClear(&pVal);

        // Get the "__RELPATH" system property.
        BSTR propName = SysAllocString(L"__RELPATH");
        if (!propName)
        {
          if (pEnumStorageDevs)  pEnumStorageDevs->Release();
          if (pStorageDev)  pStorageDev->Release();
          hRes = WBEM_E_OUT_OF_MEMORY;
          m_outputList.AddString( ErrorMsg(_T("OnEnumdisks() failed:"), hRes));
          return;
        }

        hRes = pStorageDev->Get(
          propName, // property name
          0L,
          &pVal,    // output to this variant
          NULL,
          NULL);

        // Done with this object.
        pStorageDev->Release();

        // Add the path property to the output listbox.
        if (SUCCEEDED(hRes))
          m_outputList.AddString(CString(V_BSTR(&pVal)));
      }
        } // end while

    // Done with this enumerator.
    if (pEnumStorageDevs)  pEnumStorageDevs->Release();

    // Enable disk info button if disk info is available.
    if (m_outputList.GetCount() > 0)
    {
      m_outputList.SetCurSel(0);
      m_diskInfo.EnableWindow(TRUE);
    }
    }
  else m_outputList.AddString(
    ErrorMsg(_T("CreateInstanceEnum() failed:"), hRes));
}

BOOL CWbemClientDlg::OnInitDialog ( ) [protected, virtual]

Definition at line 118 of file WbemClientDlg.Cpp.

{
  CDialog::OnInitDialog();

  // Add "About..." menu item to system menu.

  // IDM_ABOUTBOX must be in the system command range.
  ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
  ASSERT(IDM_ABOUTBOX < 0xF000);

  CMenu* pSysMenu = GetSystemMenu(FALSE);
  if (pSysMenu != NULL)
  {
    CString strAboutMenu;
    strAboutMenu.LoadString(IDS_ABOUTBOX);
    if (!strAboutMenu.IsEmpty())
    {
      pSysMenu->AppendMenu(MF_SEPARATOR);
      pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
    }
  }

  // Set the icon for this dialog.  The framework does this automatically
  //  when the application's main window is not a dialog
  SetIcon(m_hIcon, TRUE);     // Set big icon
  SetIcon(m_hIcon, FALSE);    // Set small icon

  // TODO: Add extra initialization here

  return TRUE;  // return TRUE  unless you set the focus to a control
}

void CWbemClientDlg::OnMakeoffice ( ) [protected]

Definition at line 358 of file WbemClientDlg.Cpp.

{
  CWaitCursor wait;
  m_outputList.ResetContent();

  // If already connected to the namespace, we are done.
  if (m_pOfficeService)  return;

  // if "Office" namespace doesn't exist...
  BSTR Namespace = SysAllocString(L"SAMPLE_Office");
  if (!Namespace)
  {
    m_outputList.AddString( _T("SysAllocString failed"));
    return;
  }

  HRESULT hRes = m_pIWbemServices->OpenNamespace(
    Namespace,
    0, NULL,
    &m_pOfficeService,
    NULL);

  // Don't SysFreeString(Namespace) here; we'll need it later.

  if (FAILED(hRes))
  {
    // Create __namespace class.
    BSTR NamespaceClass = SysAllocString(L"__Namespace");
    if (!NamespaceClass)
    {
      SysFreeString(Namespace);
      m_outputList.AddString(_T("SysAllocString failed"));
      return;
    }

    IWbemClassObject *pNSClass = NULL;

    hRes = m_pIWbemServices->GetObject(
      NamespaceClass, // object path
      0L, NULL,
      &pNSClass,    // pointer to object
      NULL);

    SysFreeString(NamespaceClass);

    if (SUCCEEDED(hRes))
    {
      // Spawn a new instance of this class.
      IWbemClassObject *pNSInst = NULL;

      hRes = pNSClass->SpawnInstance(0, &pNSInst);
      if(SUCCEEDED(hRes))
      {
        // Set the new namespace's name.
        VARIANT v;
        VariantInit(&v);
        V_VT(&v) = VT_BSTR;
        V_BSTR(&v) = Namespace;

        BSTR Prop = SysAllocString(L"Name");
        if (!Prop)
        {
          pNSClass->Release();
          pNSInst->Release();
          SysFreeString(Namespace);
          m_outputList.AddString( _T("SysAllocString failed"));
          return;
        }

        hRes = pNSInst->Put(
          Prop,
          0,
          &v,
          0);

        SysFreeString(Prop);
        VariantClear(&v);

        // Create the instance.
        hRes = m_pIWbemServices->PutInstance(
          pNSInst,
          WBEM_FLAG_CREATE_OR_UPDATE,
          NULL, NULL);

        pNSInst->Release();
        pNSInst = NULL;

        if (SUCCEEDED(hRes)) {
          m_outputList.AddString(_T("Created office namespace"));

          // open the new namespace.
          hRes = m_pIWbemServices->OpenNamespace(
            Namespace, 0, NULL, &m_pOfficeService, NULL);
        }
      }
      pNSClass->Release();  // Don't need the class any more
      pNSClass = NULL;
    }
  }

  SysFreeString(Namespace);

  if (m_pOfficeService)
  {
     // Note: We should always 'try' to create the namespace.  We
     // don't use m_pOfficeService for anything else, so it is a good idea to
     // Release() and NULL it
     m_pOfficeService->Release();
     m_pOfficeService = NULL;
     m_outputList.AddString(_T("Connected to office"));
  }
  else m_outputList.AddString(
    ErrorMsg(_T("Failed to connect to office"), hRes));

  m_diskInfo.EnableWindow(FALSE);
}

void CWbemClientDlg::OnPaint ( void ) [protected]

Definition at line 167 of file WbemClientDlg.Cpp.

{
  if (IsIconic())
  {
    CPaintDC dc(this); // device context for painting

    SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

    // Center icon in client rectangle
    int cxIcon = GetSystemMetrics(SM_CXICON);
    int cyIcon = GetSystemMetrics(SM_CYICON);
    CRect rect;
    GetClientRect(&rect);
    int x = (rect.Width() - cxIcon + 1) / 2;
    int y = (rect.Height() - cyIcon + 1) / 2;

    // Draw the icon
    dc.DrawIcon(x, y, m_hIcon);
  }
  else
  {
    CDialog::OnPaint();
  }
}

HCURSOR CWbemClientDlg::OnQueryDragIcon ( ) [protected]

Definition at line 194 of file WbemClientDlg.Cpp.

{
  return (HCURSOR) m_hIcon;
}

void CWbemClientDlg::OnSysCommand | ( | UINT | nID,
 |  | LPARAM | lParam |
 | ) |  |  | [protected]

Definition at line 150 of file WbemClientDlg.Cpp.

{
  if ((nID & 0xFFF0) == IDM_ABOUTBOX)
  {
    CAboutDlg dlgAbout;
    dlgAbout.DoModal();
  }
  else
  {
    CDialog::OnSysCommand(nID, lParam);
  }
}

Member Data Documentation

CButton CWbemClientDlg::m_diskInfo

Definition at line 60 of file WbemClientDlg.h.

CButton CWbemClientDlg::m_enumDisks

Definition at line 62 of file WbemClientDlg.h.

HICON CWbemClientDlg::m_hIcon [protected]

Definition at line 96 of file WbemClientDlg.h.

CString CWbemClientDlg::m_namespace

Definition at line 66 of file WbemClientDlg.h.

CListBox CWbemClientDlg::m_outputList

Definition at line 64 of file WbemClientDlg.h.

IWbemServices* CWbemClientDlg::m_pIWbemServices [private]

Definition at line 86 of file WbemClientDlg.h.

IWbemServices* CWbemClientDlg::m_pOfficeService [private]

Definition at line 88 of file WbemClientDlg.h.

The documentation for this class was generated from the following files:
  • SysMgmt/WMI/VC/SimpleClient/WbemClientDlg.h
  • SysMgmt/WMI/VC/SimpleClient/WbemClientDlg.Cpp
Generated on Wed Nov 13 2024 16:57:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CWebBrowser Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CWebBrowser Class Reference

#include "cdialoglite.h"

Inherits COleClient.

List of all members.

Public Member Functions

CWebBrowser (HWND hWndParent=NULL, UINT nID=0)
virtual | ~CWebBrowser ()
STDMETHODIMP | Invoke (DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pvarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
virtual HRESULT | Load (IStream *pIStream)
virtual HRESULT | Navigate (LPWSTR pwszURL)
virtual BOOL | OnDocumentComplete ()
virtual BOOL | OnDownloadBegin ()
virtual BOOL | OnDownloadComplete ()
virtual BOOL | OnDownloadControl ()
virtual BOOL | OnInitialUpdate ()
virtual BOOL | OnNavigateComplete ()
virtual HRESULT | Show (LONG iVerb=OLEIVERB_INPLACEACTIVATE)

Public Attributes

CComPtr< IStream > | m_spLoadStream
CComPtr< IOleObject > | m_spOleObject
CComPtr< IWebBrowser2 > | m_spWebBrowser2

Detailed Description

Definition at line 1423 of file cdialoglite.h.

Constructor & Destructor Documentation

CWebBrowser::CWebBrowser | ( | HWND | hWndParent = NULL,
 |  | UINT | nID = 0 |
 | ) |  |  | [inline]

Definition at line 1427 of file cdialoglite.h.

    : COleClient(hWndParent, nID)
  {
  }

virtual CWebBrowser::~CWebBrowser ( ) [inline, virtual]

Definition at line 1431 of file cdialoglite.h.

  {
  }

Member Function Documentation

STDMETHODIMP CWebBrowser::Invoke | ( | DISPID | dispidMember,
 |  | REFIID | riid,
 |  | LCID | lcid,
 |  | WORD | wFlags,
 |  | DISPPARAMS * | pDispParams,
 |  | VARIANT * | pvarResult,
 |  | EXCEPINFO * | pExcepInfo,
 |  | UINT * | puArgErr |
 | ) |  |  | [inline]

Reimplemented from COleClient.

Definition at line 1506 of file cdialoglite.h.

  {
     switch (dispidMember)
     {
      case DISPID_DOWNLOADBEGIN:
       OnDownloadBegin();
       break;

      case DISPID_DOWNLOADCOMPLETE:
       OnDownloadComplete();
       break;

      case DISPID_DOCUMENTCOMPLETE:
       OnDocumentComplete();
       break;

      case DISPID_NAVIGATECOMPLETE:
       OnNavigateComplete();
       break;

    case DISPID_AMBIENT_DLCONTROL:
      OnDownloadControl();
      break;

    default:
       return DISP_E_MEMBERNOTFOUND;
     }

     return S_OK;
  }

virtual HRESULT CWebBrowser::Load ( IStream * pIStream ) [inline, virtual]

Definition at line 1487 of file cdialoglite.h.

  {
    HRESULT hr = S_OK;

    //We need a defualt page
    TESTC(hr = Navigate(L"about:blank"));

    //Save the stream for later use, since we have to wait for DocumentComplete
    //Before we can finish loading the stream.  Se OnDocumentComplete for the remainder of
    //this function...
    m_spLoadStream = pIStream;

  CLEANUP:
    return hr;
  }

virtual HRESULT CWebBrowser::Navigate ( LPWSTR pwszURL ) [inline, virtual]

Definition at line 1473 of file cdialoglite.h.

  {
    HRESULT hr = S_OK;

    //Navigate
    TESTC(hr = m_spWebBrowser2->Navigate(pwszURL, NULL, NULL, NULL, NULL));

    //Show
    TESTC(hr = Show());

  CLEANUP:
    return hr;
  }

virtual BOOL CWebBrowser::OnDocumentComplete ( ) [inline, virtual]

Definition at line 1548 of file cdialoglite.h.

  {
    HRESULT hr = S_OK;

    //Default Implementation
    if(m_spLoadStream)
    {
      CComPtr<IDispatch>        spDocument;
      CComPtr<IPersistStreamInit>   spPersistStream;

      CComPtr<IStream>        spStream;
        CHAR szHTMLText[] = "<html><h1>Stream Test</h1><p>This HTML content is being loaded from a stream.</html>";

      HGLOBAL hHTMLText = GlobalAlloc(GPTR, lstrlen(szHTMLText)+1);
      TESTC(hr = CreateStreamOnHGlobal(hHTMLText, TRUE, &spStream));

        //Obtain the document
      TESTC(hr = m_spWebBrowser2->get_Document(&spDocument));
      TESTC(hr = spDocument->QueryInterface(&spPersistStream));

      //Load the passed in stream
      TESTC(hr = spPersistStream->InitNew());
      TESTC(hr = spPersistStream->Load(/*m_spLoadStream*/spStream));
//      TESTC(hr = m_spWebBrowser2->Refresh());

      //We are now done with the stream
      m_spLoadStream.Release();
    }

  CLEANUP:
    return SUCCEEDED(hr);
  }

virtual BOOL CWebBrowser::OnDownloadBegin ( ) [inline, virtual]

Definition at line 1540 of file cdialoglite.h.

  {
    return FALSE;
  }

virtual BOOL CWebBrowser::OnDownloadComplete ( ) [inline, virtual]

Definition at line 1544 of file cdialoglite.h.

  {
    return FALSE;
  }

virtual BOOL CWebBrowser::OnDownloadControl ( ) [inline, virtual]

Definition at line 1586 of file cdialoglite.h.

  {
    return FALSE;
  }

virtual BOOL CWebBrowser::OnInitialUpdate ( ) [inline, virtual]

Reimplemented from CWndLite.

Definition at line 1436 of file cdialoglite.h.

  {
    HRESULT hr = S_OK;
    DWORD dwCookie = 0;

    //Create the WebBrowser Control
    m_spOleObject.Release();
    TESTC(hr = m_spOleObject.CoCreateInstance(CLSID_WebBrowser));

    //Obtain the WebBrowser interface
    m_spWebBrowser2.Release();
    TESTC(hr = m_spOleObject->QueryInterface(&m_spWebBrowser2));

    //Advise our liseners
    TESTC(hr = AtlAdvise(m_spWebBrowser2, (IDispatch*)this, DIID_DWebBrowserEvents2, &dwCookie));

    //Set the client to be this window
    TESTC(hr = m_spOleObject->SetClientSite(this));

  CLEANUP:
    return SUCCEEDED(hr);
  }

virtual BOOL CWebBrowser::OnNavigateComplete ( ) [inline, virtual]

Definition at line 1582 of file cdialoglite.h.

  {
    return FALSE;
  }

virtual HRESULT CWebBrowser::Show ( LONG iVerb = OLEIVERB_INPLACEACTIVATE ) [inline, virtual]

Definition at line 1459 of file cdialoglite.h.

  {
    HRESULT hr = S_OK;
    MSG msg;
    RECT rect;
    GetClientRect(m_hWnd, &rect);

    //OLEIVERB_HIDE
    TESTC(hr = m_spOleObject->DoVerb(iVerb, &msg, this, 0, m_hWnd, &rect));

  CLEANUP:
    return hr;
  }

Member Data Documentation

CComPtr<IStream> CWebBrowser::m_spLoadStream

Definition at line 1595 of file cdialoglite.h.

CComPtr<IOleObject> CWebBrowser::m_spOleObject

Definition at line 1593 of file cdialoglite.h.

CComPtr<IWebBrowser2> CWebBrowser::m_spWebBrowser2

Definition at line 1594 of file cdialoglite.h.

The documentation for this class was generated from the following file:
  • Dataaccess/oledb/rowsetviewer/cdialoglite.h
Generated on Wed Nov 13 2024 16:57:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CWiaDataCallback Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

CWiaDataCallback Class Reference

List of all members.

Public Member Functions

CWiaDataCallback ()
virtual | ~CWiaDataCallback ()
ULONG CALLBACK | AddRef ()
HRESULT CALLBACK | BandedDataCallback (LONG lMessage, LONG lStatus, LONG lPercentComplete, LONG lOffset, LONG lLength, LONG lReserved, LONG lResLength, BYTE *pbBuffer)
HRESULT CALLBACK | QueryInterface (REFIID riid, void **ppvObject)
ULONG CALLBACK | Release ()

Private Member Functions

CWiaDataCallback (const CWiaDataCallback &)
CWiaDataCallback & | operator= (const CWiaDataCallback &)

Private Attributes

LONG | m_cRef

Detailed Description

Definition at line 44 of file wiassamp.cpp.

Constructor & Destructor Documentation

CWiaDataCallback::CWiaDataCallback ( const CWiaDataCallback & ) [private]
CWiaDataCallback::CWiaDataCallback ( ) [inline]

Definition at line 63 of file wiassamp.cpp.

        : m_cRef(1)
    {
    }

virtual CWiaDataCallback::~CWiaDataCallback ( ) [inline, virtual]

Definition at line 67 of file wiassamp.cpp.

    {
    }

Member Function Documentation

ULONG CALLBACK CWiaDataCallback::AddRef ( void ) [inline]

Definition at line 107 of file wiassamp.cpp.

    {
        return InterlockedIncrement(&m_cRef);
    }

HRESULT CALLBACK CWiaDataCallback::BandedDataCallback | ( | LONG | lMessage,
 |  | LONG | lStatus,
 |  | LONG | lPercentComplete,
 |  | LONG | lOffset,
 |  | LONG | lLength,
 |  | LONG | lReserved,
 |  | LONG | lResLength,
 |  | BYTE * | pbBuffer |
 | ) |  |  | [inline]

Definition at line 124 of file wiassamp.cpp.

    {
        UNREFERENCED_PARAMETER(lMessage);
        UNREFERENCED_PARAMETER(lStatus);
        UNREFERENCED_PARAMETER(lPercentComplete);
        UNREFERENCED_PARAMETER(lOffset);
        UNREFERENCED_PARAMETER(lLength);
        UNREFERENCED_PARAMETER(lReserved);
        UNREFERENCED_PARAMETER(lResLength);
        UNREFERENCED_PARAMETER(pbBuffer);
        switch (lMessage)
        {
        case IT_MSG_STATUS:
            _tprintf( TEXT("lPercentComplete: %d\n"), lPercentComplete );
            break;
        }

        return S_OK;
    }

CWiaDataCallback& CWiaDataCallback::operator= ( const CWiaDataCallback & ) [private]
HRESULT CALLBACK CWiaDataCallback::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppvObject |
 | ) |  |  | [inline]

Definition at line 74 of file wiassamp.cpp.

    {
        //
        // Validate arguments
        //
        if (NULL == ppvObject)
        {
            return E_INVALIDARG;
        }

        //
        // Return the appropropriate interface
        //
        if (IsEqualIID( riid, IID_IUnknown ))
        {
            *ppvObject = static_cast<CWiaDataCallback*>(this);
        }
        else if (IsEqualIID( riid, IID_IWiaDataCallback ))
        {
            *ppvObject = static_cast<CWiaDataCallback*>(this);
        }
        else
        {
            *ppvObject = NULL;
            return (E_NOINTERFACE);
        }

        //
        // Increment the reference count before we return the interface
        //
        reinterpret_cast<IUnknown*>(*ppvObject)->AddRef();
        return S_OK;
    }

ULONG CALLBACK CWiaDataCallback::Release ( void ) [inline]

Definition at line 111 of file wiassamp.cpp.

    {
        LONG cRef = InterlockedDecrement(&m_cRef);
        if (0 == cRef)
        {
            delete this;
        }
        return cRef;
    }

Member Data Documentation

LONG CWiaDataCallback::m_cRef [private]

Definition at line 50 of file wiassamp.cpp.

The documentation for this class was generated from the following file:
  • Multimedia/wia/wiassamp/wiassamp.cpp
Generated on Wed Nov 13 2024 16:57:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CWinApp Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CWinApp Class Reference

#include "cwinapp.h"

Inherits CAppLite.

Inherited by CADQIApp, CADsFirstExtApp, CADsFirstExtApp, CADVCGENApp, CAPIApp, CCapMFCApp, CClientApp, CClipBookServerApp, CCmdLineConsumerApp, CDisdrawApp, CDisdrawApp, CFileShareSampleApp, CGenericUCPApp, CHMMSampleApp, CImp_DrawApp, CMultichanApp, CMyUIExtApp, CMyUIExtApp, CMyWizExtApp, CPermEventsApp, CPrintSDIApp, CRTCIncomingApp, CRTCOutgoingApp, CSCPCMenuApp, CSCPWizApp, CTestApp, CVCExploreApp, CWbemClientApp, and CXMLTreeApp.

List of all members.

Public Member Functions

CWinApp ()
virtual | ~CWinApp ()
virtual int | ExitInstance ()
virtual BOOL | InitInstance ()

Public Attributes

CMallocSpy * m_pCMallocSpy

Detailed Description

Definition at line 27 of file cwinapp.h.

Constructor & Destructor Documentation

CWinApp::CWinApp ( )

Definition at line 23 of file cwinapp.cpp.

  : CAppLite(IDR_ROWSETVIEWER)
{
  //Windows
  m_pCMainWindow    = NULL;

  //Data
  m_pCMallocSpy   = NULL;
}

CWinApp::~CWinApp ( ) [virtual]

Definition at line 38 of file cwinapp.cpp.

{
}

Member Function Documentation

int CWinApp::ExitInstance ( void ) [virtual]

Reimplemented from CAppLite.

Reimplemented in CSCPCMenuApp, CMyUIExtApp, CSCPWizApp, CMyUIExtApp, CMyWizExtApp, CADsFirstExtApp, CADsFirstExtApp, CGenericUCPApp, CHMMSampleApp, CCmdLineConsumerApp, CPermEventsApp, CClipBookServerApp, and CFileShareSampleApp.

Definition at line 112 of file cwinapp.cpp.

{
  //Since we use the CRT hooks, it will be called on delete.
  //So we need to first NULL the global pointer, then delete the actual object...
  CFrameWndLite* pCMainWindow = m_pCMainWindow;
  m_pCMainWindow = NULL;
  SAFE_DELETE(pCMainWindow);

  //Globals
  g_spDataConvert.Release();

  //Unitialize COM
  SetErrorInfo(0, NULL);
  OleUninitialize();

  //Display any Leaks
  if(m_pCMallocSpy)
  {
    if(GetErrorPosting(EP_IMALLOC_SPY))
      m_pCMallocSpy->DumpLeaks();
    m_pCMallocSpy->Unregister();
    SAFE_RELEASE(m_pCMallocSpy);
  }

  return CAppLite::ExitInstance();
}

BOOL CWinApp::InitInstance ( void ) [virtual]

Reimplemented from CAppLite.

Reimplemented in CVCExploreApp, CClientApp, CADVCGENApp, CMultichanApp, CSCPCMenuApp, CMyUIExtApp, CSCPWizApp, CMyUIExtApp, CMyWizExtApp, CADsFirstExtApp, CADsFirstExtApp, CADQIApp, CPrintSDIApp, CDisdrawApp, CImp_DrawApp, CTestApp, CDisdrawApp, CRTCIncomingApp, CRTCOutgoingApp, CGenericUCPApp, CHMMSampleApp, CCmdLineConsumerApp, CPermEventsApp, CWbemClientApp, CCapMFCApp, CXMLTreeApp, CClipBookServerApp, CFileShareSampleApp, and CAPIApp.

Definition at line 54 of file cwinapp.cpp.

{
  //CoInitialize before we do anything...
  //NOTE: We have to use OleInitialize for Drag-n-Drop.  RegisterDragDrop fails
  //with E_OUTOFMEMORY if just CoInitialize is done...
  OleInitialize(NULL);

  // Ensure that common control DLL is loaded
  INITCOMMONCONTROLSEX iccex;
  iccex.dwSize = sizeof(INITCOMMONCONTROLSEX);
  iccex.dwICC = ICC_USEREX_CLASSES | ICC_LISTVIEW_CLASSES | ICC_TREEVIEW_CLASSES | ICC_TAB_CLASSES | ICC_BAR_CLASSES;
  InitCommonControlsEx(&iccex);

  //Set the Locale for all C runtime functions...
  setlocale(LC_ALL, ".ACP");

/*
  // Load all saved user options
  LoadUserOptions();

  //C-runtime hooks
  EnableCRTReportHook();
  EnableCRTAllocHook();
*/
  //Create the Main Window and Child Windows...
  m_pCMainWindow = new CMainWindow;
  if(!m_pCMainWindow->Create(NULL, L"RowsetViewer", L"Microsoft OLE DB RowsetViewer", IDR_ROWSETVIEWER, LoadIcon(GetAppLite()->m_hInstance, MAKEINTRESOURCE(IDR_ROWSETVIEWER))))
    return FALSE;

  //Register IMallocSpy (if requested)
  if(GetErrorPosting(EP_IMALLOC_SPY))
  {
    m_pCMallocSpy = new CMallocSpy;
    if(m_pCMallocSpy)
      m_pCMallocSpy->Register();
  }

  //Restore the window positions and state
  if(m_pCMainWindow->m_wndPlacement.length)
  {
    //This already does a ShowWindow/UpdateWindow
    m_pCMainWindow->SetWindowPlacement();
  }
  else
  {
    //Show the window...
    m_pCMainWindow->ShowWindow(GetAppLite()->m_nCmdShow);
    m_pCMainWindow->UpdateWindow();
  }

  return TRUE;
}

Member Data Documentation

CMallocSpy* CWinApp::m_pCMallocSpy

Definition at line 41 of file cwinapp.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cwinapp.h
  • Dataaccess/oledb/rowsetviewer/cwinapp.cpp
Generated on Wed Nov 13 2024 16:57:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CWindow Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

CWindow Class Reference

#include "APP.Hxx"

List of all members.

Public Member Functions

CWindow ()
CWindow (LPTSTR caption, LPTSTR lpszClassName, HINSTANCE hInstance, int cx=CW_USEDEFAULT, int cy=CW_USEDEFAULT)
operator HWND ()
void | Show (int nCmdShow)

Protected Attributes

HWND | _hwnd

Detailed Description

Definition at line 90 of file APP.Hxx.

Constructor & Destructor Documentation

CWindow::CWindow ( ) [inline]

Definition at line 93 of file APP.Hxx.

: _hwnd(0) {}

CWindow::CWindow | ( | LPTSTR | caption,
 |  | LPTSTR | lpszClassName,
 |  | HINSTANCE | hInstance,
 |  | int | cx = CW_USEDEFAULT,
 |  | int | cy = CW_USEDEFAULT |
 | ) |  |  | [inline]

Definition at line 106 of file APP.Hxx.

{
   _hwnd = CreateWindow (
      lpszClassName,
      caption,
      WS_OVERLAPPEDWINDOW | WS_VSCROLL | WS_HSCROLL,
      CW_USEDEFAULT,
      CW_USEDEFAULT,
      cx,
      cy,
      NULL,
      NULL,
      hInstance,
      NULL );
}

Member Function Documentation

CWindow::operator HWND ( ) [inline]

Definition at line 101 of file APP.Hxx.

{ return _hwnd; }

void CWindow::Show ( int nCmdShow ) [inline]

Definition at line 96 of file APP.Hxx.

   {
      ShowWindow ( _hwnd, nCmdShow );
      UpdateWindow ( _hwnd );
   }

Member Data Documentation

HWND CWindow::_hwnd [protected]

Definition at line 103 of file APP.Hxx.

The documentation for this class was generated from the following file:
  • Multimedia/Gdi/Fonts/GridFont/APP.Hxx
Generated on Wed Nov 13 2024 16:57:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CWizard Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CWizard Class Reference

#include "wizard.h"

Inherits CDialogBase.

List of all members.

Public Member Functions

CWizard (HWND hWnd, HINSTANCE hInst)
virtual | ~CWizard ()
virtual ULONG | DestroyPrevStep (ULONG iCurStep)
virtual ULONG | Display ()
virtual ULONG | DisplayStep (ULONG iStep)

Public Attributes

ULONG m_iPrevStep
CProgress * m_pCProgress
CTableCopy * m_pCTableCopy
CDialogBase * | m_rgDialogSteps [END_WIZ]

Detailed Description

Definition at line 220 of file wizard.h.

Constructor & Destructor Documentation

CWizard::CWizard | ( | HWND | hWnd,
 |  | HINSTANCE | hInst
 | ) |  |

Definition at line 65 of file wizard.cpp.

  : CDialogBase(hWnd, hInst)
{
  m_pCTableCopy = new CTableCopy(this);
  m_pCProgress = new CProgress(hWnd, hInst);

  m_iPrevStep = WIZ_STEP1;
  m_rgDialogSteps[WIZ_STEP1] = new CS1Dialog(hWnd, hInst, m_pCTableCopy);
  m_rgDialogSteps[WIZ_STEP2] = new CS2Dialog(hWnd, hInst, m_pCTableCopy);
  m_rgDialogSteps[WIZ_STEP3] = new CS3Dialog(hWnd, hInst, m_pCTableCopy);
  m_rgDialogSteps[WIZ_STEP4] = new CS4Dialog(hWnd, hInst, m_pCTableCopy);
  m_rgDialogSteps[WIZ_TYPES] = new CTypesDialog(hWnd, hInst, m_pCTableCopy);
}

CWizard::~CWizard ( ) [virtual]

Definition at line 84 of file wizard.cpp.

{
  delete m_pCTableCopy;
  delete m_pCProgress;

  delete m_rgDialogSteps[WIZ_STEP1];
  delete m_rgDialogSteps[WIZ_STEP2];
  delete m_rgDialogSteps[WIZ_STEP3];
  delete m_rgDialogSteps[WIZ_STEP4];
  delete m_rgDialogSteps[WIZ_TYPES];
}

Member Function Documentation

ULONG CWizard::DestroyPrevStep ( ULONG iCurStep ) [virtual]

Definition at line 122 of file wizard.cpp.

{
  if(iCurStep != m_iPrevStep)
    m_rgDialogSteps[m_iPrevStep]->Destroy();
  m_iPrevStep = iCurStep;
  return 0;
}

ULONG CWizard::Display ( ) [virtual]

Implements CDialogBase.

Definition at line 101 of file wizard.cpp.

{
  return DisplayStep(WIZ_STEP1);
}

ULONG CWizard::DisplayStep ( ULONG iStep ) [virtual]

Definition at line 111 of file wizard.cpp.

{
  ASSERT(iStep >= WIZ_STEP1 && iStep < END_WIZ);
  return m_rgDialogSteps[iStep]->Display();
}

Member Data Documentation

ULONG CWizard::m_iPrevStep

Definition at line 236 of file wizard.h.

CProgress* CWizard::m_pCProgress

Definition at line 234 of file wizard.h.

CTableCopy* CWizard::m_pCTableCopy

Definition at line 233 of file wizard.h.

CDialogBase* CWizard::m_rgDialogSteps[END_WIZ]

Definition at line 237 of file wizard.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/tablecopy/wizard.h
  • Dataaccess/oledb/tablecopy/wizard.cpp
Generated on Wed Nov 13 2024 16:57:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CWizExtUser Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes | Private Attributes

CWizExtUser Class Reference

#include "wizext.h"

List of all members.

Public Member Functions

CWizExtUser ()
~CWizExtUser ()
STDMETHOD() | AddPages (LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam)
DECLARE_REGISTRY_CLSID ()
HICON | GetClassIcon ()
LPCWSTR | GetClassName ()
IADsContainer * | GetContainer ()
LPCWSTR | GetContainerCanonicalName ()
IADs * | GetCopySourceObj ()
void | GetDefaultSummary (CString &s)
IDsAdminNewObj * | GetIDsAdminNewObj ()
IADs * | GetObj ()
STDMETHOD() | GetSummaryInfo (BSTR *pBstrText)
LPCWSTR | GetTitle ()
STDMETHOD() | Initialize (IADsContainer *pADsContainerObj, IADs *pADsCopySource, LPCWSTR lpszClassName, IDsAdminNewObj *pDsAdminNewObj, LPDSA_NEWOBJ_DISPINFO pDispInfo)
STDMETHOD() | OnError (HWND hWnd, HRESULT hr, ULONG uContext)
void | SetObj (IADs *pADsObj)
STDMETHOD() | SetObject (IADs *pADsObj)
STDMETHOD() | WriteData (HWND hWnd, ULONG uContext)
HRESULT | WriteDataHelper ()

Protected Attributes

HICON | m_hObjClassIcon
CExtPageUser * m_pExtPageUser
CString m_szClassName
CString m_szContCanonicalName
CString m_szTitle

Private Attributes

CComPtr< IADsContainer > | m_spADsContainerObj
CComPtr< IADs > | m_spADsCopySourceObj
CComPtr< IADs > | m_spADsObj
CComPtr< IDsAdminNewObj > | m_spDsAdminNewObj

Detailed Description

Definition at line 29 of file wizext.h.

Constructor & Destructor Documentation

CWizExtUser::CWizExtUser ( ) [inline]

Definition at line 35 of file wizext.h.

  {
    m_hObjClassIcon = NULL;
  }

CWizExtUser::~CWizExtUser ( ) [inline]

Definition at line 40 of file wizext.h.

  {
    if (m_pExtPageUser != NULL)
      delete m_pExtPageUser;
  }

Member Function Documentation

HRESULT CWizExtUser::AddPages | ( | LPFNADDPROPSHEETPAGE | lpfnAddPage,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 72 of file wizext.cpp.

{
  //
  // Add the pages for the wizard extension in the order they are to appear.
  //
  AFX_MANAGE_STATE(AfxGetStaticModuleState());
  m_pExtPageUser = new CExtPageUser(this);
  (*lpfnAddPage)(CreatePropertySheetPage((PROPSHEETPAGE*)(&m_pExtPageUser->m_psp)), lParam);
  return S_OK;
}

CWizExtUser::DECLARE_REGISTRY_CLSID ( )
HICON CWizExtUser::GetClassIcon ( ) [inline]

Definition at line 87 of file wizext.h.

{ return m_hObjClassIcon;}

LPCWSTR CWizExtUser::GetClassName ( ) [inline]

Definition at line 85 of file wizext.h.

{ return m_szClassName;}

IADsContainer* CWizExtUser::GetContainer ( ) [inline]

Definition at line 80 of file wizext.h.

{ return m_spADsContainerObj;}

LPCWSTR CWizExtUser::GetContainerCanonicalName ( ) [inline]

Definition at line 86 of file wizext.h.

{ return m_szContCanonicalName;}

IADs* CWizExtUser::GetCopySourceObj ( ) [inline]

Definition at line 83 of file wizext.h.

{ return m_spADsCopySourceObj;}

void CWizExtUser::GetDefaultSummary ( CString & s )
IDsAdminNewObj* CWizExtUser::GetIDsAdminNewObj ( ) [inline]

Definition at line 81 of file wizext.h.

{ return m_spDsAdminNewObj;}

IADs* CWizExtUser::GetObj ( ) [inline]

Definition at line 78 of file wizext.h.

{ return m_spADsObj;}

HRESULT CWizExtUser::GetSummaryInfo ( BSTR * pBstrText )

Definition at line 136 of file wizext.cpp.

{
  //
  // Verify valid arguments
  //
  if (pBstrText == NULL)
  {
    return E_INVALIDARG;
  }

  ASSERT(m_pExtPageUser != NULL);
  m_pExtPageUser->GetSummaryInfo(pBstrText);

  return S_OK;
}

LPCWSTR CWizExtUser::GetTitle ( ) [inline]

Definition at line 88 of file wizext.h.

{ return m_szTitle;}

HRESULT CWizExtUser::Initialize | ( | IADsContainer * | pADsContainerObj,
 |  | IADs * | pADsCopySource,
 |  | LPCWSTR | lpszClassName,
 |  | IDsAdminNewObj * | pDsAdminNewObj,
 |  | LPDSA_NEWOBJ_DISPINFO | pDispInfo
 | ) |  |

Definition at line 20 of file wizext.cpp.

{
  //
  // Debug Traces
  //
  TRACE(_T("IDsAdminNewObjExt::Initialize()\n"));
  TRACE(_T("\tpADsContainerObj = %p\n"), pADsContainerObj);
  TRACE(_T("\tlpszClassName = <%s>\n"), lpszClassName);
  TRACE(_T("\tpDsAdminNewObj = %p\n"), pDsAdminNewObj);
  TRACE(_T("\tpDispInfo = %p\n"), pDispInfo);

  //
  // make sure we have valid parameters
  //
  if ( (pADsContainerObj == NULL) || (pDsAdminNewObj == NULL) || (lpszClassName == NULL) )
  {
    return E_INVALIDARG;
  }

  if ( (pDispInfo == NULL) || (pDispInfo->dwSize != sizeof(DSA_NEWOBJ_DISPINFO)) )
  {
    return E_INVALIDARG;
  }

  //
  // save the parameters passed
  //
  m_spDsAdminNewObj     = pDsAdminNewObj;
  m_spADsCopySourceObj  = pADsCopySource;
  m_spADsContainerObj   = pADsContainerObj;
  m_szClassName         = lpszClassName;

  //
  // save data from the DSA_NEWOBJ_DISPINFO struct
  //
  TRACE(_T("\tpDispInfo->dwSize = %d\n"), pDispInfo->dwSize);
  TRACE(_T("\tpDispInfo->hObjClassIcon  = 0x%x\n"), pDispInfo->hObjClassIcon);
  TRACE(_T("\tpDispInfo->lpszWizTitle = <%s>\n"), pDispInfo->lpszWizTitle);
  TRACE(_T("\tpDispInfo->lpszContDisplayName = <%s>\n"), pDispInfo->lpszContDisplayName);

  m_hObjClassIcon = pDispInfo->hObjClassIcon;
  m_szTitle = pDispInfo->lpszWizTitle;
  m_szContCanonicalName = pDispInfo->lpszContDisplayName;

  return S_OK;
}

HRESULT CWizExtUser::OnError | ( | HWND | hWnd,
 |  | HRESULT | hr,
 |  | ULONG | uContext
 | ) |  |

Definition at line 152 of file wizext.cpp.

{
  AFX_MANAGE_STATE(AfxGetStaticModuleState());

  CString szMessage;

  if (uContext == DSA_NEWOBJ_CTX_COMMIT)
  {
    //
    // The extension gets notified if the SetInfo() or an attempt to cleanup
    // a temporary object failed.
    //
    szMessage.Format(_T("SetInfo() failed: hr = 0x%x"), hr);
    AfxMessageBox(szMessage);
  }
  else if (uContext == DSA_NEWOBJ_CTX_PRECOMMIT)
  {
    //
    // Pre-commit failure is rare.  If it does occur handle the error here.
    //
  }
  else if (uContext == DSA_NEWOBJ_CTX_POSTCOMMIT)
  {
    //
    // Post-commit failure is rare.  If it does occur handle the error here.
    //
  }
  else if (uContext == DSA_NEWOBJ_CTX_CLEANUP)
  {
    //
    // For some reason (e.g. network failure or not enough privileges) DS Admin
    // could not remove the ill constructed (but committed) object after a
    // failure to write on post commit.  If appropriate, the extension can
    // handle the error message.
    //

    //
    // NOTE : this is not a primary extension so we will leave it up to DS Admin
    //        to handle this error message.
    //
    return E_FAIL;
  }

  //
  // Returning success means that DS Admin will not put up its own generic
  // error message.
  //
  return S_OK;
}

void CWizExtUser::SetObj ( IADs * pADsObj ) [inline]

Definition at line 79 of file wizext.h.

{ m_spADsObj = pADsObj;}

HRESULT CWizExtUser::SetObject ( IADs * pADsObj )

Definition at line 83 of file wizext.cpp.

{
  //
  // Hang on to the object passed in
  // the smart pointer will handle the ref count
  //
  m_spADsObj = pADsObj;
  return S_OK;
}

HRESULT CWizExtUser::WriteData | ( | HWND | hWnd,
 |  | ULONG | uContext
 | ) |  |

Definition at line 93 of file wizext.cpp.

{
  //
  // NOTICE: when the property page has received the kill focus
  // notification, it has already written the data, so we do not
  // need to do anything on a precommit notification.
  //
  if (uContext == DSA_NEWOBJ_CTX_PRECOMMIT)
  {
    return S_OK;
  }

  //
  // This extension does not write anything during the post commit phase
  // so we can just return.
  //
  if (uContext == DSA_NEWOBJ_CTX_POSTCOMMIT)
  {
    return S_OK;
  }

  //
  // We have to handle the case when the creation failed, the object
  // got destroyed, a new temporary object was created, and it has to
  // be initialized again.
  //
  if (uContext == DSA_NEWOBJ_CTX_CLEANUP)
  {
    //
    // Call the helper function to do a precommit write.
    //
    ASSERT(m_pExtPageUser != NULL);
    return m_pExtPageUser->WriteDataHelper();
  }

  //
  // This should never happen.  We have covered all the cases.
  //
  ASSERT(FALSE);
  return E_INVALIDARG;
}

HRESULT CWizExtUser::WriteDataHelper ( )

Member Data Documentation

HICON CWizExtUser::m_hObjClassIcon [protected]

Definition at line 123 of file wizext.h.

CExtPageUser* CWizExtUser::m_pExtPageUser [protected]

Definition at line 128 of file wizext.h.

CComPtr<IADsContainer> CWizExtUser::m_spADsContainerObj [private]

Definition at line 95 of file wizext.h.

CComPtr<IADs> CWizExtUser::m_spADsCopySourceObj [private]

Definition at line 105 of file wizext.h.

CComPtr<IADs> CWizExtUser::m_spADsObj [private]

Definition at line 100 of file wizext.h.

CComPtr<IDsAdminNewObj> CWizExtUser::m_spDsAdminNewObj [private]

Definition at line 110 of file wizext.h.

CString CWizExtUser::m_szClassName [protected]

Definition at line 116 of file wizext.h.

CString CWizExtUser::m_szContCanonicalName [protected]

Definition at line 122 of file wizext.h.

CString CWizExtUser::m_szTitle [protected]

Definition at line 121 of file wizext.h.

The documentation for this class was generated from the following files:
  • NetDS/ADSI/samples/DSUI/userext/userwizard/wizext.h
  • NetDS/ADSI/samples/DSUI/userext/userwizard/wizext.cpp
Generated on Wed Nov 13 2024 16:57:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CWndLite Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Public Attributes

CWndLite Class Reference

#include "cdialoglite.h"

Inherited by CButtonLite, CComboBoxLite, CDialogLite, CFrameWndLite, CListBoxLite, CMDIChildLite, COleClient, CPropSheetLite, CSchemaDlg, CSplitterLite, CStatusBarLite, and CToolBarLite.

List of all members.

Public Member Functions

CWndLite (HWND hWndParent=NULL, UINT nID=0)
virtual | ~CWndLite ()
BOOL | CheckDlgButton (INT iResourceID, UINT uCheck)
virtual BOOL | Create (HWND hWndParent, WCHAR *pwszClassName, WCHAR *pwszWindowName, UINT uID, DWORD dwStyle=WS_TABSTOP|WS_CHILD|WS_VISIBLE|WS_BORDER|WS_VSCROLL|WS_HSCROLL, DWORD dwExStyle=WS_EX_CLIENTEDGE, int x=CW_USEDEFAULT, int y=CW_USEDEFAULT, int cx=CW_USEDEFAULT, int cy=CW_USEDEFAULT)
virtual BOOL | CreateIndirect (HWND hWndParent, UINT nID=0)
virtual BOOL | DestroyWindow ()
BOOL | EnableWindow (BOOL bEnable=TRUE)
HWND | GetDlgItem (INT iResourceID)
HFONT | GetFont ()
BOOL GetWindowPlacement ()
WCHAR * | GetWindowText ()
LRESULT | GetWindowText (WCHAR *pwszBuffer, ULONG ulMaxSize)
HWND | GetWnd ()
virtual BOOL | HandleMenuPos (HMENU hMenu, UINT uPos, DWORD *pdwFlags)
virtual BOOL | HandleMessage (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
virtual BOOL | IsDestroyed ()
UINT | IsDlgButtonChecked (INT iResourceID)
BOOL IsVisible ()
virtual BOOL | OnActivate (UINT fActive, UINT fMinimized, HWND hWndPrevious)
virtual BOOL | OnChar (TCHAR chCharCode, LPARAM lKeyData)
virtual BOOL | OnClose ()
virtual BOOL | OnCommand (UINT iID, HWND hWndCtrl)
virtual BOOL | OnCommandNotify (INT wNotifyCode, INT iID, HWND hWndCtrl)
virtual BOOL | OnContextMenu (HWND hWnd, REFPOINTS pts)
virtual BOOL | OnCreate (CREATESTRUCT *pCREATESTRUCT)
virtual BOOL | OnDblclk (WPARAM fwKeys, REFPOINTS pts)
virtual BOOL | OnDestroy ()
virtual BOOL | OnDropFiles (HDROP hDrop)
virtual BOOL | OnHScroll (int nScrollCode, int nPos, HWND hWnd)
virtual BOOL | OnInitialUpdate ()
virtual BOOL | OnInitMenuPopup (HMENU hMenu, UINT uPos, BOOL fSysMenu)
virtual BOOL | OnKeyDown (WPARAM nVirtKey, LPARAM lKeyData)
virtual BOOL | OnLButtonDown (WPARAM fwKeys, REFPOINTS pts)
virtual BOOL | OnLButtonUp (WPARAM fwKeys, REFPOINTS pts)
virtual BOOL | OnMenuSelect (UINT uID)
virtual BOOL | OnMouseMove (WPARAM nHittest, REFPOINTS pts)
virtual BOOL | OnMove (REFPOINTS pts)
virtual BOOL | OnNCButtonDown (WPARAM nHittest, REFPOINTS pts)
virtual BOOL | OnNCMouseMove (WPARAM nHittest, REFPOINTS pts)
virtual BOOL | OnNotify (INT idCtrl, NMHDR *pNMHDR)
virtual BOOL | OnRButtonDown (WPARAM fwKeys, REFPOINTS pts)
virtual BOOL | OnRButtonUp (WPARAM fwKeys, REFPOINTS pts)
virtual BOOL | OnSetCursor (HWND hWnd, INT nHittest, INT nMouseMsg)
virtual BOOL | OnSetFocus (HWND hWndPrevFocus)
virtual BOOL | OnSize (WPARAM nType, REFPOINTS pts)
virtual BOOL | OnSizing (WPARAM nType, REFPOINTS pts)
virtual BOOL | OnSysCommand (WPARAM nCmdType, REFPOINTS pts)
virtual BOOL | OnSysKeyDown (WPARAM nVirtKey, LPARAM lKeyData)
virtual BOOL | OnTimer (WPARAM nIDEvent)
virtual BOOL | OnUpdateCommand (HMENU hMenu, UINT nID, DWORD *pdwFlags)
virtual BOOL | OnVScroll (int nScrollCode, int nPos, HWND hWnd)
virtual BOOL | PreCreateWindow (CREATESTRUCTW &cs)
HWND | SetFocus ()
void | SetFont (HFONT hFont)
BOOL SetWindowPlacement ()
BOOL | SetWindowText (WCHAR *pwszString)
LONG | ShowWindow (UINT nCmdShow)
virtual BOOL | SubClassWindow (WNDPROC pWndProc)
virtual LRESULT | UnhandledMessage (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
LONG | UpdateWindow ()

Static Public Member Functions

static LRESULT WINAPI | WndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)

Public Attributes

BOOL m_bUnicodeMsg
HWND | m_hWnd
HWND | m_hWndParent
UINT m_nID
WNDPROC | m_pSubClassProc
WCHAR * | m_pwszClassName
WINDOWPLACEMENT | m_wndPlacement

Detailed Description

Definition at line 112 of file cdialoglite.h.

Constructor & Destructor Documentation

CWndLite::CWndLite | ( | HWND | hWndParent = NULL,
 |  | UINT | nID = 0
 | ) |  |

Definition at line 170 of file cdialoglite.cpp.

{
  m_hWnd      = NULL;
  m_hWndParent  = NULL;
  m_pwszClassName = NULL;
  m_nID     = 0;
  m_bUnicodeMsg = IsUnicodeOS();

  if(hWndParent && nID)
    CreateIndirect(hWndParent, nID);

  //SubClass
  m_pSubClassProc  = NULL;
}

CWndLite::~CWndLite ( ) [virtual]

Definition at line 190 of file cdialoglite.cpp.

{
  SAFE_FREE(m_pwszClassName);
}

Member Function Documentation

BOOL CWndLite::CheckDlgButton | ( | INT | iResourceID,
 |  | UINT | uCheck |
 | ) |  |  | [inline]

Definition at line 127 of file cdialoglite.h.

{ ASSERT(uCheck == BST_CHECKED || uCheck == BST_UNCHECKED || BST_INDETERMINATE); return ::CheckDlgButton(m_hWnd, iResourceID, uCheck);    }

BOOL CWndLite::Create | ( | HWND | hWndParent,
 |  | WCHAR * | pwszClassName,
 |  | WCHAR * | pwszWindowName,
 |  | UINT | uID,
 |  | DWORD | dwStyle = WS_TABSTOP | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_HSCROLL,
 |  | DWORD | dwExStyle = WS_EX_CLIENTEDGE,
 |  | int | x = CW_USEDEFAULT,
 |  | int | y = CW_USEDEFAULT,
 |  | int | cx = CW_USEDEFAULT,
 |  | int | cy = CW_USEDEFAULT |
 | ) |  |  | [virtual]

Definition at line 211 of file cdialoglite.cpp.

{
  ASSERT(IsDestroyed());
  m_hWndParent = hWndParent;

  //Setup CreateStruct
  CREATESTRUCTW cs;
  cs.dwExStyle    = dwExStyle;
  cs.lpszClass    = pwszClassName;
  cs.lpszName     = pwszWindowName;
  cs.style      = dwStyle;
  cs.x        = x;
  cs.y        = y;
  cs.cx       = cx;
  cs.cy       = cy;
  cs.hwndParent   = hWndParent;
  cs.hMenu      = (HMENU)(ULONG_PTR)uID;
  cs.hInstance    = GetAppLite()->m_hInstance;
  cs.lpCreateParams = this;

  //Allow Modification of CreateParams...
  if(!PreCreateWindow(cs))
    return FALSE;

  //Convert the Params
  CHAR szClassName[MAX_NAME_LEN] = {0};
  ConvertToMBCS(pwszClassName, szClassName, MAX_NAME_LEN);
  CHAR szWindowName[MAX_NAME_LEN] = {0};
  ConvertToMBCS(pwszWindowName, szWindowName, MAX_NAME_LEN);

  //Copy the Class Name
  SAFE_FREE(m_pwszClassName);
  m_pwszClassName = wcsDuplicate(pwszClassName);

  //Actually CreateWindowEx
  m_hWnd = CreateWindowExA(cs.dwExStyle, szClassName,
      szWindowName, cs.style, cs.x, cs.y, cs.cx, cs.cy,
      cs.hwndParent, cs.hMenu, cs.hInstance, cs.lpCreateParams);

  //Assoicate this window with this class
  if(m_hWnd)
  {
    SetThis(m_hWnd, this);
    return OnInitialUpdate();
  }

  GETLASTERROR(m_hWnd)
  return NULL;
}

BOOL CWndLite::CreateIndirect | ( | HWND | hWndParent,
 |  | UINT | nID = 0 |
 | ) |  |  | [virtual]

Definition at line 269 of file cdialoglite.cpp.

{
  m_nID     = nID;

  if(nID)
  {
    //Its a control on a window
    m_hWnd      = ::GetDlgItem(hWndParent, m_nID);
    m_hWndParent  = hWndParent;
  }
  else
  {
    //Its just a window
    m_hWnd      = hWndParent;
    m_hWndParent  = GetParent(m_hWnd);
  }

  //TODO:
  //Some messages (ie: EM_GETTEXTRANGE), since their is not a W-unicode and A-ansi version),
  //the message is completly based upon how you created the window.  If we created the window
  //incorectly, then we are limited to how the resource created it which is basically how you
  //compile the source.  Its also dependent upon weither you subclass the window.
  //(SetWindowLongPtrA or SetWindowLongW).
#ifndef UNICODE
  m_bUnicodeMsg = FALSE;
#endif

  if(m_hWnd)
  {
    //NOTE: You only need to save the "this" pointer if your going
    //to subclass the window.  Otherwise two simple classes on a window control
    //will end up overwriting each other.  So we moved this to SubClassWindow
    return OnInitialUpdate();
  }

  return FALSE;
}

BOOL CWndLite::DestroyWindow ( ) [virtual]

Definition at line 323 of file cdialoglite.cpp.

{
  if(m_hWnd)
  {
        ::DestroyWindow(m_hWnd);
    m_hWnd = NULL;
    return TRUE;
  }

  return FALSE;
}

BOOL CWndLite::EnableWindow ( BOOL bEnable = TRUE ) [inline]

Definition at line 132 of file cdialoglite.h.

{ return ::EnableWindow(m_hWnd, bEnable);         }

HWND CWndLite::GetDlgItem ( INT iResourceID ) [inline]

Definition at line 125 of file cdialoglite.h.

{ return ::GetDlgItem(m_hWnd, iResourceID);         }

HFONT CWndLite::GetFont ( ) [inline]

Reimplemented in CDataGrid.

Definition at line 130 of file cdialoglite.h.

{ return (HFONT)::SendMessage(m_hWnd, WM_GETFONT, 0, 0);  }

BOOL CWndLite::GetWindowPlacement ( ) [inline]

Definition at line 136 of file cdialoglite.h.

{ memset(&m_wndPlacement, 0, sizeof(WINDOWPLACEMENT)); m_wndPlacement.length  = sizeof(WINDOWPLACEMENT); return ::GetWindowPlacement(m_hWnd, &m_wndPlacement); }

LRESULT CWndLite::GetWindowText | ( | WCHAR * | pwszBuffer,
 |  | ULONG | ulMaxSize |
 | ) |  |  | [inline]

Definition at line 140 of file cdialoglite.h.

{ return wSendMessage(m_hWnd, WM_GETTEXT, ulMaxSize, pwszBuffer);   }

WCHAR* CWndLite::GetWindowText ( ) [inline]

Definition at line 139 of file cdialoglite.h.

{ return wGetWindowText(m_hWnd);                    }

HWND CWndLite::GetWnd ( ) [inline]

Definition at line 135 of file cdialoglite.h.

{ /*ASSERT(m_hWnd);*/ return m_hWnd;            }

BOOL CWndLite::HandleMenuPos | ( | HMENU | hMenu,
 |  | UINT | uPos,
 |  | DWORD * | pdwFlags |
 | ) |  |  | [virtual]

Definition at line 706 of file cdialoglite.cpp.

{
  ASSERT(pdwFlags);
  *pdwFlags = 0;
  ULONG ulMenuID = GetMenuItemID(hMenu, uPos);

  //SubMenu
  if(ulMenuID == ULONG_MAX)
  {
    BOOL bHandled = FALSE;

    //Recursive Alogorytm
    HMENU hSubMenu = GetSubMenu(hMenu, uPos);
    INT iItems = GetMenuItemCount(hSubMenu);
    for(LONG i=0; i<iItems; i++)
    {
      //As soon as we find one menu item that we handle, we can return
      //since we now know the entire sub menu needs to be enabled for this item...
      if(HandleMenuPos(hSubMenu, i, pdwFlags))
      {
        bHandled = TRUE;
        if(*pdwFlags == MF_ENABLED)
          return TRUE;
      }
    }

    return bHandled;
  }

  //Otherwise we have a valid Menu ID...
  return OnUpdateCommand(hMenu, ulMenuID, pdwFlags);
}

BOOL CWndLite::HandleMessage | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [virtual]

Reimplemented in CMDIChildLite, CDialogLite, and CPropPageLite.

Definition at line 744 of file cdialoglite.cpp.

{
  switch(msg)
  {
    case WM_COMMAND:
    {
      UINT wNotifyCode  = HIWORD(wParam); // notification code
      UINT iID      = LOWORD(wParam); // item, control, or accelerator identifier
      HWND hWndCtrl   = (HWND)lParam;   // handle of control

      //Filter out any Control Notification codes
      //  wNotifyCode   - Specifies the notification code if the message is from a control. If the message is from an accelerator, this parameter is 1. If the message is from a menu, this parameter is 0.
      //  wID       - Specifies the identifier of the menu item, control, or accelerator.
      //  hwndCtl     - Identifies the control sending the message if the message is from a control. Otherwise, this parameter is NULL.
      if(hWndCtrl && wNotifyCode)
        return OnCommandNotify(wNotifyCode, iID, hWndCtrl);

      return OnCommand(iID, hWndCtrl);
    }

    case WM_SYSCOMMAND:
      return OnSysCommand(wParam, MAKEPOINTS(lParam));

    case WM_ACTIVATE:
      return OnActivate(LOWORD(wParam), HIWORD(wParam), (HWND)lParam);

    case WM_MENUSELECT:
      return OnMenuSelect(LOWORD(wParam));

    case WM_INITMENUPOPUP:
      return OnInitMenuPopup((HMENU)wParam, LOWORD(lParam), HIWORD(lParam));

    case WM_NOTIFY:
      return OnNotify((INT)wParam, (NMHDR*)lParam);

    case WM_CLOSE:
      return OnClose();

    case WM_DESTROY:
      return OnDestroy();

    case WM_TIMER:
      return OnTimer(wParam);

    case WM_DROPFILES:
      return OnDropFiles((HDROP)wParam);

    case WM_SIZE:
      return OnSize(wParam, MAKEPOINTS(lParam));

    case WM_SIZING:
      return OnSizing(wParam, MAKEPOINTS(lParam));

    case WM_MOVE:
      return OnMove(MAKEPOINTS(lParam));

    case WM_MOUSEMOVE:
      return OnMouseMove(wParam, MAKEPOINTS(lParam));

    case WM_LBUTTONDBLCLK:
      return OnDblclk(wParam, MAKEPOINTS(lParam));

    case WM_LBUTTONDOWN:
      return OnLButtonDown(wParam, MAKEPOINTS(lParam));

    case WM_LBUTTONUP:
      return OnLButtonUp(wParam, MAKEPOINTS(lParam));

    case WM_RBUTTONDOWN:
      return OnRButtonDown(wParam, MAKEPOINTS(lParam));

    case WM_RBUTTONUP:
      return OnRButtonUp(wParam, MAKEPOINTS(lParam));

    case WM_CONTEXTMENU:
      return OnContextMenu((HWND)wParam, MAKEPOINTS(lParam));

    case WM_CHAR:
      return OnChar((TCHAR)wParam, lParam);

    case WM_KEYDOWN:
      return OnKeyDown(wParam, lParam);

    case WM_SYSKEYDOWN:
      return OnSysKeyDown(wParam, lParam);

    case WM_VSCROLL:
      return OnVScroll(LOWORD(wParam), HIWORD(wParam), (HWND) lParam);

    case WM_HSCROLL:
      return OnHScroll(LOWORD(wParam), HIWORD(wParam), (HWND) lParam);

    case WM_NCMOUSEMOVE:
      return OnNCMouseMove(wParam, MAKEPOINTS(lParam));

    case WM_NCLBUTTONDOWN:
      return OnNCButtonDown(wParam, MAKEPOINTS(lParam));

    case WM_SETFOCUS:
      return OnSetFocus((HWND)wParam);
  }

  return FALSE;
}

virtual BOOL CWndLite::IsDestroyed ( ) [inline, virtual]

Reimplemented in CMDIFrameLite.

Definition at line 201 of file cdialoglite.h.

{ return !m_hWnd && !m_hWndParent && !m_pSubClassProc && !m_pwszClassName;  }

UINT CWndLite::IsDlgButtonChecked ( INT iResourceID ) [inline]

Definition at line 126 of file cdialoglite.h.

{ return ::IsDlgButtonChecked(m_hWnd, iResourceID);     }

BOOL CWndLite::IsVisible ( ) [inline]

Definition at line 129 of file cdialoglite.h.

{ return ::IsWindowVisible(m_hWnd);             }

BOOL CWndLite::OnActivate | ( | UINT | fActive,
 |  | UINT | fMinimized,
 |  | HWND | hWndPrevious |
 | ) |  |  | [virtual]

Reimplemented in CDialogLite.

Definition at line 409 of file cdialoglite.cpp.

{
  return FALSE;
}

BOOL CWndLite::OnChar | ( | TCHAR | chCharCode,
 |  | LPARAM | lKeyData |
 | ) |  |  | [virtual]

Definition at line 585 of file cdialoglite.cpp.

{
  return FALSE;
}

BOOL CWndLite::OnClose ( ) [virtual]

Reimplemented in CFrameWndLite, CMDIChild, CMDIObjects, and CMDITrace.

Definition at line 419 of file cdialoglite.cpp.

{
  return FALSE;
}

BOOL CWndLite::OnCommand | ( | UINT | iID,
 |  | HWND | hWndCtrl |
 | ) |  |  | [virtual]

Reimplemented in CInterfaceDlg, CFullConnectProvider, CFullConnectProperties, CFullConnectSecurity, CFullConnectOptions, CMDIFrameLite, CMainWindow, CMDIChild, CObjTree, CMDIObjects, COptionsDataSource, COptionsRowset, COptionsError, and CMDITrace.

Definition at line 379 of file cdialoglite.cpp.

{
  return FALSE;
}

BOOL CWndLite::OnCommandNotify | ( | INT | wNotifyCode,
 |  | INT | iID,
 |  | HWND | hWndCtrl |
 | ) |  |  | [virtual]

Reimplemented in CFullConnectProvider, CMDIFrameLite, CListBoxLite, and CComboBoxLite.

Definition at line 369 of file cdialoglite.cpp.

{
  return FALSE;
}

BOOL CWndLite::OnContextMenu | ( | HWND | hWnd,
 |  | REFPOINTS | pts |
 | ) |  |  | [virtual]

Reimplemented in CDataGrid, and CObjTree.

Definition at line 575 of file cdialoglite.cpp.

{
  return FALSE;
}

BOOL CWndLite::OnCreate ( CREATESTRUCT * pCREATESTRUCT ) [virtual]

Reimplemented in CMDIFrameLite, CEditBoxLite, CListViewLite, CTreeViewLite, and CTabLite.

Definition at line 359 of file cdialoglite.cpp.

{
  return TRUE;
}

BOOL CWndLite::OnDblclk | ( | WPARAM | fwKeys,
 |  | REFPOINTS | pts |
 | ) |  |  | [virtual]

Reimplemented in CObjTree.

Definition at line 514 of file cdialoglite.cpp.

{
  return FALSE;
}

BOOL CWndLite::OnDestroy ( ) [virtual]

Reimplemented in CFrameWndLite, CMDIFrameLite, CMainWindow, CMDIChild, CMDIObjects, and CMDITrace.

Definition at line 429 of file cdialoglite.cpp.

{
  //Remove our Class from the hWnd lookup...
  SetThis(m_hWnd, NULL);

  //Remove window items...
  m_hWnd      = NULL;
  m_hWndParent  = NULL;
  SAFE_FREE(m_pwszClassName);
  m_pSubClassProc = NULL;
  return TRUE;
}

BOOL CWndLite::OnDropFiles ( HDROP hDrop ) [virtual]

Reimplemented in CMainWindow.

Definition at line 457 of file cdialoglite.cpp.

{
  return FALSE;
}

BOOL CWndLite::OnHScroll | ( | int | nScrollCode,
 |  | int | nPos,
 |  | HWND | hWnd |
 | ) |  |  | [virtual]

Definition at line 623 of file cdialoglite.cpp.

{
  return FALSE;
}

BOOL CWndLite::OnInitialUpdate ( ) [virtual]

Reimplemented in CComboBoxString, CComboBoxEx, CWebBrowser, CMainWindow, CMDIChild, CMDIObjects, and CMDITrace.

Definition at line 313 of file cdialoglite.cpp.

{
  return TRUE;
}

BOOL CWndLite::OnInitMenuPopup | ( | HMENU | hMenu,
 |  | UINT | uPos,
 |  | BOOL | fSysMenu |
 | ) |  |  | [virtual]

Reimplemented in CMainWindow.

Definition at line 671 of file cdialoglite.cpp.

{
  //Ignore the msg if it is for a system menu
  if(fSysMenu)
    return FALSE;

  //Go through the menu items for current popup menu
  //and enable/disable menu item, if required

  //Also note that HandleMenuPos is a recursive algortym.  This is for the
  //case where I need to detmerine if a "submenu->" is enabled or diasbled.
  //The only way to really tell is to know if there are any subitems that
  //are needed, but some of the subitems inturn may be "submenu->".
  //Therefore a item will be enabled if there is at least one subitem
  //The is wanted, and disabled if there are no subitems wanted.
  INT iMenuItems = GetMenuItemCount(hMenu);
  DWORD dwFlags = 0;
  for(LONG i=0; i<iMenuItems; i++)
  {
    dwFlags = 0;
    if(HandleMenuPos(hMenu, i, &dwFlags))
    {
      EnableMenuItem(hMenu, i, MF_BYPOSITION | dwFlags);
      CheckMenuItem(hMenu, i, MF_BYPOSITION | dwFlags);
    }
  }

  return TRUE;
}

BOOL CWndLite::OnKeyDown | ( | WPARAM | nVirtKey,
 |  | LPARAM | lKeyData |
 | ) |  |  | [virtual]

Reimplemented in CDSLContextBox, CDataGrid, and CObjTree.

Definition at line 595 of file cdialoglite.cpp.

{
  return FALSE;
}

BOOL CWndLite::OnLButtonDown | ( | WPARAM | fwKeys,
 |  | REFPOINTS | pts |
 | ) |  |  | [virtual]

Definition at line 524 of file cdialoglite.cpp.

{
  return FALSE;
}

BOOL CWndLite::OnLButtonUp | ( | WPARAM | fwKeys,
 |  | REFPOINTS | pts |
 | ) |  |  | [virtual]

Reimplemented in CTreeViewLite.

Definition at line 534 of file cdialoglite.cpp.

{
  return FALSE;
}

BOOL CWndLite::OnMenuSelect ( UINT uID ) [virtual]

Reimplemented in CMainWindow.

Definition at line 661 of file cdialoglite.cpp.

{
  return FALSE;
}

BOOL CWndLite::OnMouseMove | ( | WPARAM | nHittest,
 |  | REFPOINTS | pts |
 | ) |  |  | [virtual]

Reimplemented in CTreeViewLite.

Definition at line 504 of file cdialoglite.cpp.

{
  return FALSE;
}

BOOL CWndLite::OnMove ( REFPOINTS pts ) [virtual]

Definition at line 495 of file cdialoglite.cpp.

{
  return FALSE;
}

BOOL CWndLite::OnNCButtonDown | ( | WPARAM | nHittest,
 |  | REFPOINTS | pts |
 | ) |  |  | [virtual]

Reimplemented in CSplitterLite.

Definition at line 642 of file cdialoglite.cpp.

{
  return FALSE;
}

BOOL CWndLite::OnNCMouseMove | ( | WPARAM | nHittest,
 |  | REFPOINTS | pts |
 | ) |  |  | [virtual]

Reimplemented in CSplitterLite.

Definition at line 633 of file cdialoglite.cpp.

{
  return FALSE;
}

BOOL CWndLite::OnNotify | ( | INT | idCtrl,
 |  | NMHDR * | pNMHDR |
 | ) |  |  | [virtual]

Reimplemented in CFrameWndLite, CMDIFrameLite, CListViewLite, CTreeViewLite, CTabLite, CMDIChild, CMDIObjects, and CMDITrace.

Definition at line 399 of file cdialoglite.cpp.

{
  return FALSE;
}

BOOL CWndLite::OnRButtonDown | ( | WPARAM | fwKeys,
 |  | REFPOINTS | pts |
 | ) |  |  | [virtual]

Reimplemented in CDataGrid, and CObjTree.

Definition at line 544 of file cdialoglite.cpp.

{
  //NOTE: The right mouse button doesn't automatically activate the MDI window...
  return FALSE;
}

BOOL CWndLite::OnRButtonUp | ( | WPARAM | fwKeys,
 |  | REFPOINTS | pts |
 | ) |  |  | [virtual]

Definition at line 555 of file cdialoglite.cpp.

{
  return FALSE;
}

BOOL CWndLite::OnSetCursor | ( | HWND | hWnd,
 |  | INT | nHittest,
 |  | INT | nMouseMsg |
 | ) |  |  | [virtual]

Definition at line 565 of file cdialoglite.cpp.

{
  return FALSE;
}

BOOL CWndLite::OnSetFocus ( HWND hWndPrevFocus ) [virtual]

Reimplemented in CMDIChild, CMDIObjects, and CMDITrace.

Definition at line 651 of file cdialoglite.cpp.

{
  return FALSE;
}

BOOL CWndLite::OnSize | ( | WPARAM | nType,
 |  | REFPOINTS | pts |
 | ) |  |  | [virtual]

Reimplemented in CMainWindow, CDataGrid, CMDIChild, CMDIObjects, and CMDITrace.

Definition at line 476 of file cdialoglite.cpp.

{
  return FALSE;
}

BOOL CWndLite::OnSizing | ( | WPARAM | nType,
 |  | REFPOINTS | pts |
 | ) |  |  | [virtual]

Reimplemented in CMDIChild.

Definition at line 485 of file cdialoglite.cpp.

{
  return FALSE;
}

BOOL CWndLite::OnSysCommand | ( | WPARAM | nCmdType,
 |  | REFPOINTS | pts |
 | ) |  |  | [virtual]

Definition at line 467 of file cdialoglite.cpp.

{
  return FALSE;
}

BOOL CWndLite::OnSysKeyDown | ( | WPARAM | nVirtKey,
 |  | LPARAM | lKeyData |
 | ) |  |  | [virtual]

Definition at line 604 of file cdialoglite.cpp.

{
  return FALSE;
}

BOOL CWndLite::OnTimer ( WPARAM nIDEvent ) [virtual]

Definition at line 447 of file cdialoglite.cpp.

{
  return FALSE;
}

BOOL CWndLite::OnUpdateCommand | ( | HMENU | hMenu,
 |  | UINT | nID,
 |  | DWORD * | pdwFlags |
 | ) |  |  | [virtual]

Reimplemented in CMDIFrameLite, CMainWindow, CMDIChild, CObjTree, CMDIObjects, and CMDITrace.

Definition at line 389 of file cdialoglite.cpp.

{
  return FALSE;
}

BOOL CWndLite::OnVScroll | ( | int | nScrollCode,
 |  | int | nPos,
 |  | HWND | hWnd |
 | ) |  |  | [virtual]

Reimplemented in CDataGrid.

Definition at line 613 of file cdialoglite.cpp.

{
  return FALSE;
}

BOOL CWndLite::PreCreateWindow ( CREATESTRUCTW & cs ) [virtual]

Reimplemented in CMDIObjects, and CMDITrace.

Definition at line 200 of file cdialoglite.cpp.

{
  return TRUE;
}

HWND CWndLite::SetFocus ( ) [inline]

Definition at line 133 of file cdialoglite.h.

{ return ::SetFocus(m_hWnd);                }

void CWndLite::SetFont ( HFONT hFont ) [inline]

Definition at line 131 of file cdialoglite.h.

{ ::SendMessage(m_hWnd, WM_SETFONT, (WPARAM)hFont, 0);    }

BOOL CWndLite::SetWindowPlacement ( ) [inline]

Definition at line 137 of file cdialoglite.h.

{ m_wndPlacement.length = sizeof(WINDOWPLACEMENT); return ::SetWindowPlacement(m_hWnd, &m_wndPlacement); }

BOOL CWndLite::SetWindowText ( WCHAR * pwszString ) [inline]

Definition at line 141 of file cdialoglite.h.

{ return (BOOL)wSendMessage(m_hWnd, WM_SETTEXT, 0,     pwszString); }

LONG CWndLite::ShowWindow ( UINT nCmdShow ) [inline]

Definition at line 143 of file cdialoglite.h.

{ return ::ShowWindow(m_hWnd, nCmdShow);                    }

BOOL CWndLite::SubClassWindow ( WNDPROC pWndProc ) [virtual]

Definition at line 340 of file cdialoglite.cpp.

{
  //NOTE: This method does not handle multiple levels...
  ASSERT(m_pSubClassProc == NULL);

  //Save the "this" pointer (in case we haven't already, for the case where
  //we are subclassing a window thats already created - CreateIndirect).
  SetThis(m_hWnd, this);

  m_pSubClassProc = (WNDPROC)GetWindowLongPtr(m_hWnd, GWLP_WNDPROC);
    SetWindowLongPtr(m_hWnd, GWLP_WNDPROC, (LONG_PTR)pWndProc);
  return TRUE;
}

LRESULT CWndLite::UnhandledMessage | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [virtual]

Reimplemented in CMDIChildLite, and CMDIFrameLite.

Definition at line 854 of file cdialoglite.cpp.

{
  return DefWindowProc(hWnd, msg, wParam, lParam);
}

LONG CWndLite::UpdateWindow ( ) [inline]

Definition at line 144 of file cdialoglite.h.

{ return ::UpdateWindow(m_hWnd);                        }

LRESULT WINAPI CWndLite::WndProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static]

Definition at line 864 of file cdialoglite.cpp.

{
  CWndLite* pCWndLite = (CWndLite*)GetThis(hWnd);

  switch(msg)
  {
    case WM_CREATE:
        {
      //Save the Window Handle
      CREATESTRUCT* pCS = (CREATESTRUCT*)lParam;
      pCWndLite = (CWndLite*)pCS->lpCreateParams;
      pCWndLite->m_hWnd = hWnd;

      //Save the "this" pointer
      SetThis(hWnd, pCWndLite);
      if(pCWndLite->OnCreate(pCS))
        return 0;
      return -1;
    }
  };

  //Otherwise just pass on message to original control
  if(pCWndLite)
  {
    //Pass onto our handler
    if(pCWndLite->HandleMessage(hWnd, msg, wParam, lParam))
      return 0;

    //Pass onto SubClass'd window, if their is one...
    if(pCWndLite->m_pSubClassProc)
      return CallWindowProc(pCWndLite->m_pSubClassProc, hWnd, msg, wParam, lParam);

    //Otherwise pass onto our default handler
    return pCWndLite->UnhandledMessage(hWnd, msg, wParam, lParam);
  }

  return DefWindowProc(hWnd, msg, wParam, lParam);
}

Member Data Documentation

BOOL CWndLite::m_bUnicodeMsg

Definition at line 209 of file cdialoglite.h.

HWND CWndLite::m_hWnd

Definition at line 204 of file cdialoglite.h.

HWND CWndLite::m_hWndParent

Definition at line 205 of file cdialoglite.h.

UINT CWndLite::m_nID

Definition at line 208 of file cdialoglite.h.

WNDPROC CWndLite::m_pSubClassProc

Definition at line 212 of file cdialoglite.h.

WCHAR* CWndLite::m_pwszClassName

Definition at line 207 of file cdialoglite.h.

WINDOWPLACEMENT CWndLite::m_wndPlacement

Definition at line 206 of file cdialoglite.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialoglite.h
  • Dataaccess/oledb/rowsetviewer/cdialoglite.cpp
Generated on Wed Nov 13 2024 16:57:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CWorkerThread Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Protected Member Functions | Private Attributes

CWorkerThread Class Reference

#include "workerthread.h"

List of all members.

Public Member Functions

CWorkerThread ()
virtual | ~CWorkerThread ()
HRESULT | Initialize ()
BOOL | PostMessage (UINT Msg, WPARAM wParam, LPARAM lParam)
HRESULT | Shutdown ()

Static Protected Member Functions

static unsigned long _stdcall | ThreadFunction (void *)

Private Attributes

HANDLE m_hThreadHandle
unsigned long | m_nThreadID

Detailed Description

Definition at line 26 of file workerthread.h.

Constructor & Destructor Documentation

CWorkerThread::CWorkerThread ( ) [inline]

Definition at line 56 of file workerthread.h.

        :m_hThreadHandle(NULL),
        m_nThreadID(0)
    {}

CWorkerThread::~CWorkerThread ( ) [virtual]

Definition at line 163 of file workerthread.cpp.

{
    LogError("CWorkerThread::~CWorkerThread() entered");

    //
    // the thread should not be running at this point -- the app should have
    // called Shutdown()
    //

    if (NULL != m_hThreadHandle)
    {
        LogError("CWorkerThread::~CWorkerThread thread [%ld] is still running",
                  m_nThreadID);
    }

    _ASSERTE(NULL == m_hThreadHandle);

    LogError("CWorkerThread::~CWorkerThread() finished");
}

Member Function Documentation

HRESULT CWorkerThread::Initialize ( void )

Definition at line 29 of file workerthread.cpp.

{

    //
    // if the thread is already initialized
    //

    if ( (NULL != m_hThreadHandle) && (0 != m_nThreadID) )
    {

        LogError("CWorkerThread::Initialize() thread is already running");

        return E_UNEXPECTED;
    }

    //
    // start the thread
    //

    m_hThreadHandle = CreateThread(NULL,        // security
                                   0,           // stack
                                   ThreadFunction,    // thread function
                                   0,           // thread parameter
                                   0,           // flags
                                   &m_nThreadID);

    //
    // thread creation failed. log a message and return an error
    //

    if (NULL == m_hThreadHandle)
    {
        LogError("CWorkerThread::Initialize() "
                 "failed to start the worker thread");

        return E_FAIL;
    }

    //
    // thread created. log thread id.
    //

    LogMessage("CWorkerThread::Initialize() succeeded. thread id [0x%lx]",
                m_nThreadID);

    return S_OK;

}

BOOL CWorkerThread::PostMessage | ( | UINT | Msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 194 of file workerthread.cpp.

{

    BOOL bReturn = FALSE;

    if (NULL != m_hThreadHandle)
    {

        //
        // the thread is running, post the message
        //

        bReturn = PostThreadMessage(m_nThreadID, Msg, wParam, lParam);

    }

    return bReturn;
}

HRESULT CWorkerThread::Shutdown ( )

Definition at line 89 of file workerthread.cpp.

{

     LogError("CWorkerThread::Shutdown() entered");

    //
    // if the thread is running, post quit message and wait for thread to exit
    //

    if (NULL != m_hThreadHandle)
    {

        //
        // let the thread know it's time to go home
        //

        PostMessage(WM_QUIT, NULL, NULL);

        //
        // wait for the thread to disappear
        //

        DWORD rc = WaitForSingleObject(m_hThreadHandle, INFINITE);

        //
        // close thread handle
        //

        CloseHandle(m_hThreadHandle);
        m_hThreadHandle = NULL;

        m_nThreadID = 0;

        if (rc != WAIT_OBJECT_0)
        {
            LogError("CWorkerThread::Shutdown() "
                     "Failed waiting for thread to shutdown");

            return E_FAIL;
        }
        else
        {

            LogMessage("CWorkerThread::Shutdown() finished");

            return S_OK;

        }

    }
    else
    {
        //
        // thread was not running
        //

        LogError("CWorkerThread::Shutdown() thread is not running");

        return E_FAIL;
    }

}

unsigned long _stdcall CWorkerThread::ThreadFunction ( void * ) [static, protected]

Definition at line 229 of file workerthread.cpp.

{

    LogMessage("CWorkerThread::ThreadFunction() starting");

    CoInitializeEx(NULL, COINIT_MULTITHREADED);

    //
    // force creation of message queue
    //

    MSG msg;

    //
    // keep retrieving messages until we fail or get WM_QUIT
    //

    while (GetMessage(&msg, NULL, 0, 0))
    {

        switch (msg.message)
        {

        case WM_PRIVATETAPIEVENT:
            {

                //
                // get event from the message
                //

                TAPI_EVENT TapiEvent = (TAPI_EVENT)msg.wParam;
                IDispatch *pEvent = (IDispatch*)msg.lParam;

                //
                // pass event to the event handler
                //

                OnTapiEvent(TapiEvent, pEvent);

                pEvent = NULL;

                //
                // do not check the error code from event handler -
                // there is not much we can do here anyway.
                //

                //
                // Note: pEvent is released by OnTapiEvent, so we should not
                // use it after OnTapiEvent returns
                //

            }

            break;

        default:

            //
            // we are not interested in any other messages
            //

            break;
        }

    } // while (GetMessage())

    CoUninitialize();

    LogMessage("CWorkerThread::ThreadFunction() exiting");

    return 0;

} // CWorkerThread::ThreadFunction

Member Data Documentation

HANDLE CWorkerThread::m_hThreadHandle [private]

Definition at line 79 of file workerthread.h.

unsigned long CWorkerThread::m_nThreadID [private]

Definition at line 81 of file workerthread.h.

The documentation for this class was generated from the following files:
  • NetDS/Tapi/Tapi3/Cpp/tapirecv/workerthread.h
  • NetDS/Tapi/Tapi3/Cpp/tapirecv/workerthread.cpp
Generated on Wed Nov 13 2024 16:57:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CWrapVBComponent Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CWrapVBComponent Class Reference

#include "mmcsample.h"

List of all members.

Public Member Functions

CWrapVBComponent ()
CWrapVBComponent (IUnknown *pUnk)
virtual | ~CWrapVBComponent ()
STDMETHOD() | GetIDsOfNames (THIS_ REFIID riid, unsigned short FAR *FAR *rgszNames, unsigned int cNames, unsigned long lcid, long FAR *rgdispid)
STDMETHOD() | GetTypeInfo (THIS_ unsigned int itinfo, unsigned long lcid, ITypeInfo FAR *FAR *pptinfo)
STDMETHOD() | GetTypeInfoCount (THIS_ unsigned int FAR *pctinfo)
STDMETHOD() | Invoke (THIS_ long dispidMember, REFIID riid, unsigned long lcid, unsigned short wFlags, DISPPARAMS FAR *pdispparams, VARIANT FAR *pvarResult, EXCEPINFO FAR *pexcepinfo, unsigned int FAR *puArgErr)
HRESULT | LaunchError ()
STDMETHOD() | QueryInterface (THIS_ REFIID riid, void FAR *FAR *ppvObj)
STDMETHOD() | StartAnimation (THIS)
STDMETHOD_ (unsigned long, AddRef)(THIS)
STDMETHOD_ (unsigned long, Release)(THIS)
STDMETHOD() | StopAnimation (THIS)

Private Attributes

HRESULT | m_hrLaunch
_VBComponent FAR * | m_pInternal

Detailed Description

Definition at line 11 of file mmcsample.h.

Constructor & Destructor Documentation

CWrapVBComponent::CWrapVBComponent ( ) [inline]

Definition at line 25 of file mmcsample.h.

    {
      m_pInternal = NULL;
      IUnknown FAR* pUnk;
      if SUCCEEDED(m_hrLaunch = CoCreateInstance(CLSID_VBComponent, NULL, CLSCTX_SERVER,
                                               IID_IUnknown, (void FAR* FAR*) &pUnk)) {
        m_hrLaunch = pUnk->QueryInterface(IID__VBComponent, (void FAR* FAR*) &m_pInternal);
        pUnk->Release();
      }
    }

CWrapVBComponent::CWrapVBComponent ( IUnknown * pUnk ) [inline]

Definition at line 35 of file mmcsample.h.

    {
      m_pInternal = NULL;
      m_hrLaunch = pUnk->QueryInterface(IID__VBComponent, (void FAR* FAR*) &m_pInternal);
    }

virtual CWrapVBComponent::~CWrapVBComponent ( ) [inline, virtual]

Definition at line 40 of file mmcsample.h.

{if (m_pInternal) m_pInternal->Release();}

Member Function Documentation

STDMETHOD() CWrapVBComponent::GetIDsOfNames | ( | THIS_ REFIID | riid,
 |  | unsigned short FAR *FAR * | rgszNames,
 |  | unsigned int | cNames,
 |  | unsigned long | lcid,
 |  | long FAR * | rgdispid |
 | ) |  |  | [inline]

Definition at line 19 of file mmcsample.h.

                                                                                { return m_pInternal->GetIDsOfNames(riid,
        rgszNames, cNames, lcid, rgdispid); }

STDMETHOD() CWrapVBComponent::GetTypeInfo | ( | THIS_ unsigned int | itinfo,
 |  | unsigned long | lcid,
 |  | ITypeInfo FAR *FAR * | pptinfo |
 | ) |  |  | [inline]

Definition at line 18 of file mmcsample.h.

{ return m_pInternal->GetTypeInfo(itinfo, lcid, pptinfo); }

STDMETHOD() CWrapVBComponent::GetTypeInfoCount ( THIS_ unsigned int FAR * pctinfo ) [inline]

Definition at line 17 of file mmcsample.h.

{ return m_pInternal->GetTypeInfoCount(pctinfo); }

STDMETHOD() CWrapVBComponent::Invoke | ( | THIS_ long | dispidMember,
 |  | REFIID | riid,
 |  | unsigned long | lcid,
 |  | unsigned short | wFlags,
 |  | DISPPARAMS FAR * | pdispparams,
 |  | VARIANT FAR * | pvarResult,
 |  | EXCEPINFO FAR * | pexcepinfo,
 |  | unsigned int FAR * | puArgErr |
 | ) |  |  | [inline]

Definition at line 21 of file mmcsample.h.

                                                    { return m_pInternal->Invoke(dispidMember, riid, lcid, wFlags, pdispparams, pvarResult, pexcepinfo, puArgErr); }

HRESULT CWrapVBComponent::LaunchError ( ) [inline]

Definition at line 41 of file mmcsample.h.

{return m_hrLaunch;}

STDMETHOD() CWrapVBComponent::QueryInterface | ( | THIS_ REFIID | riid,
 |  | void FAR *FAR * | ppvObj |
 | ) |  |  | [inline]

Definition at line 14 of file mmcsample.h.

{ return m_pInternal->QueryInterface(riid, ppvObj); }

STDMETHOD() CWrapVBComponent::StartAnimation ( THIS ) [inline]

Definition at line 23 of file mmcsample.h.

{ return m_pInternal->StartAnimation(); }

CWrapVBComponent::STDMETHOD_ | ( | unsigned | long,
 |  | AddRef |  |
 | ) |  |  | [inline]

Definition at line 15 of file mmcsample.h.

{ return m_pInternal->AddRef(); }

CWrapVBComponent::STDMETHOD_ | ( | unsigned | long,
 |  | Release |  |
 | ) |  |  | [inline]

Definition at line 16 of file mmcsample.h.

{ return m_pInternal->Release(); }

STDMETHOD() CWrapVBComponent::StopAnimation ( THIS ) [inline]

Definition at line 24 of file mmcsample.h.

{ return m_pInternal->StopAnimation(); }

Member Data Documentation

HRESULT CWrapVBComponent::m_hrLaunch [private]

Definition at line 44 of file mmcsample.h.

_VBComponent FAR* CWrapVBComponent::m_pInternal [private]

Definition at line 43 of file mmcsample.h.

The documentation for this class was generated from the following file:
  • SysMgmt/MMC/ActiveX/vb/mmcsample.h
Generated on Wed Nov 13 2024 16:57:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CX224 Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

CX224 Class Reference

#include "x224.h"

List of all members.

Public Member Functions

CX224 (void)
~CX224 (void)
HRESULT | CloseListenSocket ()
HRESULT | CloseSocket ()
HRESULT | CreateAcceptSocket (HWND hWnd)
HRESULT | CreateConnectSocket (HWND hwnd, LPSTR pszHostName)
HRESULT | CreateListenSocket (HWND hwnd)
SOCKET | GetSocket ()
LPSTR SetAndGetHostName ()

Private Attributes

SOCKET | m_hListenSocket
SOCKET | m_hSocket
TCHAR | m_szHostName [MAXHOSTNAMELENGTH]

Detailed Description

Definition at line 22 of file x224.h.

Constructor & Destructor Documentation

CX224::CX224 ( void )

Definition at line 30 of file x224.cpp.

{
    m_hListenSocket = INVALID_SOCKET;
    m_hSocket = INVALID_SOCKET;
    m_szHostName[0] = '\0';
}

CX224::~CX224 ( void )

Definition at line 49 of file x224.cpp.

{}

Member Function Documentation

HRESULT CX224::CloseListenSocket ( )

Definition at line 271 of file x224.cpp.

{
    if (m_hListenSocket != INVALID_SOCKET)
    {
        closesocket(m_hListenSocket);
        m_hListenSocket = INVALID_SOCKET;
        return S_OK;
    }

    return S_FALSE;
}

HRESULT CX224::CloseSocket ( )

Definition at line 242 of file x224.cpp.

{
    HRESULT hr = S_FALSE;

    if (m_hSocket != INVALID_SOCKET)
    {
        closesocket(m_hListenSocket);
        m_hSocket = INVALID_SOCKET;
        hr = S_OK;
    }

    // close listen socket also
    CloseListenSocket();

    return hr;
}

HRESULT CX224::CreateAcceptSocket ( HWND hWnd )

Definition at line 189 of file x224.cpp.

{
    SOCKADDR_IN socket_control;
    int         size    = sizeof(socket_control);
    int         nRet    = 0;

    m_hSocket = accept(m_hListenSocket, (struct sockaddr *) &socket_control, &size);
    if (INVALID_SOCKET == m_hSocket)
    {
        return HRESULT_FROM_WIN32(WSAGetLastError());
    }

    nRet = ::WSAAsyncSelect(    m_hSocket,
                                hWnd,
                                WM_PLUGABLE_SOCKET,
                                FD_READ | FD_WRITE | FD_CLOSE | FD_CONNECT);
    if (SOCKET_ERROR == nRet)
       return E_FAIL;

    return S_OK;
}

HRESULT CX224::CreateConnectSocket | ( | HWND | hwnd,
 |  | LPSTR | pszHostName
 | ) |  |

Definition at line 125 of file x224.cpp.

{
    SOCKET      socket_number   = INVALID_SOCKET;
    u_short     uPort           = PLUGABLE_PORT_NUMBER;
    PHOSTENT    phe             = NULL;
    SOCKADDR_IN socket_control;
    DWORD       dwIPAddress     = 0;

    lstrcpyn(m_szHostName, pszHostName, MAXHOSTNAMELENGTH);

    // create the connect socket
    socket_number = ::socket(AF_INET, SOCK_STREAM, 0);
    if (INVALID_SOCKET == socket_number)
        return HRESULT_FROM_WIN32(WSAGetLastError());

    // Enable Tx and Rx messages to the window
    int nRet = ::WSAAsyncSelect(socket_number, hwnd, WM_PLUGABLE_SOCKET,
                           FD_READ | FD_WRITE | FD_CLOSE | FD_CONNECT);
    if (SOCKET_ERROR == nRet)
        return E_FAIL;

    // fill in other info in SockAddr
    ::ZeroMemory(&socket_control, sizeof(socket_control));
    socket_control.sin_family = AF_INET;
    socket_control.sin_port = htons (PLUGABLE_PORT_NUMBER);

    // get server's IP address
    dwIPAddress = ::inet_addr(m_szHostName);
    if (dwIPAddress != INADDR_NONE)
    {
        *((PDWORD) &socket_control.sin_addr) = dwIPAddress;
    }
    else
    {
        phe = ::gethostbyname(m_szHostName);
        if (NULL == phe)
        {
            return 0;
        }

        ::CopyMemory(&socket_control.sin_addr, phe->h_addr, phe->h_length);
    }

    // Attempt a connection to the remote site
    nRet = ::connect(socket_number, (const struct sockaddr *) &socket_control, sizeof(socket_control));
//    if (SOCKET_ERROR == nRet) //&& WSAEWOULDBLOCK != ::WSAGetLastError())
//        return E_FAIL;

    m_hSocket = socket_number;
    return S_OK;
}

HRESULT CX224::CreateListenSocket ( HWND hwnd )

Definition at line 64 of file x224.cpp.

{
    SOCKADDR_IN socket_control;
    SOCKET      socket_number   = INVALID_SOCKET;

    // We are already have created a listenning socket
    if (m_hListenSocket != INVALID_SOCKET)
        return S_OK;

    // Create the listening socket.
    socket_number = ::socket(AF_INET, SOCK_STREAM, 0);
    if (INVALID_SOCKET == socket_number)
        return E_FAIL;

    // The listen socket only waits for FD_ACCEPT msgs.
    int nRet = ::WSAAsyncSelect(socket_number, hwnd, WM_PLUGABLE_SOCKET, FD_ACCEPT);
    if (SOCKET_ERROR == nRet)
        return E_FAIL;

    // Load the socket control structure with the parameters necessary.
    // Internet socket
    // Let it assign any address to this socket
    // Assign our port number
    socket_control.sin_family = AF_INET;
    socket_control.sin_addr.s_addr = INADDR_ANY;
    socket_control.sin_port = htons(PLUGABLE_PORT_NUMBER);

    char * szReuse = "1";
    nRet = setsockopt(socket_number, SOL_SOCKET, SO_REUSEADDR, szReuse, sizeof(int));

    // Issue the bind call
    nRet = ::bind(socket_number, (LPSOCKADDR) &socket_control, sizeof(SOCKADDR_IN));
    if (SOCKET_ERROR == nRet)
    {
        return E_FAIL;
    }

    // Issue a listen to WinSock to tell it we are willing to accept calls.
    // This is a non-blocking listen, therefore we will receive FD_ACCEPT
    // if someone is trying to call us.
    nRet =::listen(socket_number, 3); // LISTEN_QUEUE_SIZE
    if (SOCKET_ERROR == nRet)
        return E_FAIL;

    m_hListenSocket = socket_number;
    return S_OK;
}

SOCKET CX224::GetSocket ( )

Definition at line 295 of file x224.cpp.

{
  return m_hSocket;
}

LPSTR CX224::SetAndGetHostName ( )

Definition at line 224 of file x224.cpp.

{
    gethostname(m_szHostName, MAXHOSTNAMELENGTH);
    return m_szHostName;
}

Member Data Documentation

SOCKET CX224::m_hListenSocket [private]

Definition at line 25 of file x224.h.

SOCKET CX224::m_hSocket [private]

Definition at line 27 of file x224.h.

TCHAR CX224::m_szHostName[MAXHOSTNAMELENGTH] [private]

Definition at line 26 of file x224.h.

The documentation for this class was generated from the following files:
  • Web/NetMeeting/PlugTransport/x224.h
  • Web/NetMeeting/PlugTransport/x224.cpp
Generated on Wed Nov 13 2024 16:57:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CXmlDOM Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

CXmlDOM Class Reference

#include "cdialoglite.h"

List of all members.

Public Member Functions

CXmlDOM ()
virtual | ~CXmlDOM ()
virtual HRESULT | Create ()
virtual HRESULT | LoadFile (VARIANT *pVariant)
virtual HRESULT | LoadStream (IUnknown *pIUnkStream)
virtual HRESULT | LoadXML (BSTR bstrXML)
virtual HRESULT | PrintAttributes (IXMLDOMNode *spNode, CConsole &rConsole)
virtual HRESULT | PrintNode (IXMLDOMNode *spNode, CConsole &rConsole, ULONG ullevel=0)
virtual HRESULT | Save (VARIANT *pVariant)
virtual HRESULT | Save (BSTR bstrFileName)

Public Attributes

CSmartPtr< IXMLDOMDocument > | m_spXMLDocument

Detailed Description

Definition at line 1802 of file cdialoglite.h.

Constructor & Destructor Documentation

CXmlDOM::CXmlDOM ( )

Definition at line 2353 of file cdialoglite.cpp.

{
}

CXmlDOM::~CXmlDOM ( ) [virtual]

Definition at line 2362 of file cdialoglite.cpp.

{
}

Member Function Documentation

virtual HRESULT CXmlDOM::Create ( ) [inline, virtual]

Definition at line 1810 of file cdialoglite.h.

  {
    HRESULT hr = S_OK;

    //Create the DOM
    TESTC(hr = m_spXMLDocument.CoCreateInstance(CLSID_DOMDocument));

    //TODO: Why is the DOM Asynch by default?
    //This makes it so an app has to register to events just to know when its complete...
    //We will make the Document Synchquential unless the user makes it asynch before they call load...
    TESTC(hr = m_spXMLDocument->put_async(VARIANT_FALSE));

  CLEANUP:
    return hr;
  }

virtual HRESULT CXmlDOM::LoadFile ( VARIANT * pVariant ) [inline, virtual]

Definition at line 1848 of file cdialoglite.h.

  {
    ASSERT(pVariant);
    HRESULT hr = S_OK;
    VARIANT_BOOL bSuccessful = VARIANT_FALSE;

    //Load the document
    TESTC(hr = m_spXMLDocument->load(*pVariant, &bSuccessful));

    if(!bSuccessful)
      TESTC(hr = E_FAIL);

  CLEANUP:
    return hr;
  }

virtual HRESULT CXmlDOM::LoadStream ( IUnknown * pIUnkStream ) [inline, virtual]

Definition at line 1826 of file cdialoglite.h.

  {
    //Delegate
    CComVariant varXML = pIUnkStream;
    return LoadFile(&varXML);
  }

virtual HRESULT CXmlDOM::LoadXML ( BSTR bstrXML ) [inline, virtual]

Definition at line 1833 of file cdialoglite.h.

  {
    HRESULT hr = S_OK;
    VARIANT_BOOL bSuccessful = VARIANT_FALSE;

    //Load the document
    TESTC(hr = m_spXMLDocument->loadXML(bstrXML, &bSuccessful));

    if(!bSuccessful)
      TESTC(hr = E_FAIL);

  CLEANUP:
    return hr;
  }

HRESULT CXmlDOM::PrintAttributes | ( | IXMLDOMNode * | spNode,
 |  | CConsole & | rConsole |
 | ) |  |  | [virtual]

Definition at line 2474 of file cdialoglite.cpp.

{
  HRESULT hr = S_OK;
  CComBSTR        bstrName;
  CComVariant       varValue;

  CComPtr<IXMLDOMNamedNodeMap>  spAttrs;
  CComPtr<IXMLDOMNode>      spChild;

  //Write out the Attributes
  if(spNode)
  {
    //Write out all attributes
    TESTC(hr = spNode->get_attributes(&spAttrs));
    if(spAttrs)
    {
      TESTC(hr = spAttrs->nextNode(&spChild));
      while(spChild)
      {
        //Attribute name
        TESTC(hr = spChild->get_nodeName(&bstrName));

        //Attribute Value
        TESTC(hr = spChild->get_nodeValue(&varValue));
        varValue.ChangeType(VT_BSTR);

        //Node type
        DOMNodeType nodeType;
        TESTC(hr = spNode->get_nodeType(&nodeType));

        switch(nodeType)
        {
          case NODE_PROCESSING_INSTRUCTION:
            //Output: AttributeName="
            rConsole << RGB_BLUE;
            rConsole << L" " << bstrName;
            rConsole << L"=\"";

            //Output: AttributeValue
            rConsole << V_BSTR(&varValue);

            //Output: "
            rConsole << L"\"" << RGB_NONE;
            break;

          default:
            ASSERT(!"Unhandled Node Type?");
            //FALL THROUGH TO DISPLAY UNKNOWN ELEMENT

          case NODE_ELEMENT:
            //Output: AttributeName="
            rConsole << RGB_DARK_RED;
            rConsole << L" " << bstrName;
            rConsole << RGB_BLUE << L"=\"";

            //Output: AttributeValue
            rConsole << RGB_NONE << CA_BOLD << V_BSTR(&varValue);

            //Output: "
            rConsole << RGB_BLUE << CA_NORMAL << L"\"" << RGB_NONE;
            break;
        };

        bstrName.Empty();
        varValue.Clear();

        //Next Attribute
        spChild.Release();
        TESTC(hr = spAttrs->nextNode(&spChild));
      }
    }
  }

CLEANUP:
  return hr;
}

HRESULT CXmlDOM::PrintNode | ( | IXMLDOMNode * | spNode,
 |  | CConsole & | rConsole,
 |  | ULONG | ullevel = 0 |
 | ) |  |  | [virtual]

Definition at line 2371 of file cdialoglite.cpp.

{
  HRESULT hr = S_OK;
  CComBSTR        bstrName;
  CComVariant       varValue;

  CComPtr<IXMLDOMNamedNodeMap>  spAttrs;
  CComPtr<IXMLDOMNode>      spChild;

  //Write out this node
  if(spNode)
  {
    //Output: Indentation Level
    for(ULONG i=0; i<ullevel; i++)
      rConsole << L"    ";

    //Node Name
    TESTC(hr = spNode->get_nodeName(&bstrName));

    //Node type
    DOMNodeType nodeType;
    TESTC(hr = spNode->get_nodeType(&nodeType));

    //Node Value
    TESTC(hr = spNode->get_nodeValue(&varValue));
    varValue.ChangeType(VT_BSTR);

    switch(nodeType)
    {
      case NODE_PROCESSING_INSTRUCTION:
        rConsole << RGB_BLUE << L"<?" << RGB_NONE;
        rConsole << RGB_BLUE  << bstrName << RGB_NONE;

        //Output: Attributes
        PrintAttributes(spNode, rConsole);

        //Output: >
        rConsole << RGB_BLUE << L" ?>" << RGB_NONE;
        rConsole.WriteLine();
        break;

      case NODE_DOCUMENT_TYPE:
      {
        //<!DOCTYPE root (View Source for full doctype...)>
        rConsole << RGB_BLUE << L"<!DOCTYPE " << bstrName;
        rConsole << CA_ITALIC << L" (View Source for full doctype...)" << CA_NORMAL;
        rConsole.WriteLine();
        break;
      }

      case NODE_TEXT:
        //This is the text of a node, not an element (ie: doesn't need tags)
        rConsole << CA_BOLD << V_BSTR(&varValue) << CA_NORMAL;
        rConsole.WriteLine();
        break;

      default:
        ASSERT(!"Unhandled Node Type?");
        //FALL THROUGH TO DISPLAY UNKNOWN ELEMENT

      case NODE_ELEMENT:
      case NODE_DOCUMENT:
        //Output: <ElementName
        rConsole << RGB_BLUE << L"<" << RGB_NONE;
        rConsole << RGB_DARK_RED  << bstrName << RGB_NONE;

        //Output: Attributes
        PrintAttributes(spNode, rConsole);

        //Output: Value
        rConsole << CA_BOLD << V_BSTR(&varValue) << CA_NORMAL;

        //Output: >
        rConsole << RGB_BLUE << L">" << RGB_NONE;
        rConsole.WriteLine();
        break;

    }

    //Now recurse into any children...
    TESTC(hr = spNode->get_firstChild(&spChild));
    while(spChild)
    {
      CComPtr<IXMLDOMNode>  spNext;

      //Recurse for all siblings...
      TESTC(hr = PrintNode(spChild, rConsole, ullevel+1));
      TESTC(hr = spChild->get_nextSibling(&spNext));

      spChild.Attach(spNext);
      spNext.Detach();
    }
  }

CLEANUP:
  return hr;
}

virtual HRESULT CXmlDOM::Save ( VARIANT * pVariant ) [inline, virtual]

Definition at line 1878 of file cdialoglite.h.

  {
    ASSERT(pVariant);
    HRESULT hr = S_OK;

    //Save the XML
    TESTC(hr = m_spXMLDocument->save(*pVariant));

  CLEANUP:
    return hr;
  }

virtual HRESULT CXmlDOM::Save ( BSTR bstrFileName ) [inline, virtual]

Definition at line 1864 of file cdialoglite.h.

  {
    //Prevent a copy of the BSTR
    CComVariant varFileName;
    varFileName.vt    = VT_BSTR;
    varFileName.bstrVal = bstrFileName;

    //Delegate
    HRESULT hr = Save(&varFileName);

    varFileName.bstrVal = NULL;
    return hr;
  }

Member Data Documentation

CSmartPtr<IXMLDOMDocument> CXmlDOM::m_spXMLDocument

Definition at line 1895 of file cdialoglite.h.

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/cdialoglite.h
  • Dataaccess/oledb/rowsetviewer/cdialoglite.cpp
Generated on Wed Nov 13 2024 16:57:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CXMLTreeApp Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

CXMLTreeApp Class Reference

#include "XMLTree.h"

Inherits CWinApp.

List of all members.

Public Member Functions

CXMLTreeApp ()
virtual BOOL InitInstance ()

Detailed Description

Definition at line 26 of file XMLTree.h.

Constructor & Destructor Documentation

CXMLTreeApp::CXMLTreeApp ( )

Definition at line 32 of file XMLTree.cpp.

{
  // TODO: add construction code here,
  // Place all significant initialization in InitInstance
}

Member Function Documentation

BOOL CXMLTreeApp::InitInstance ( void ) [virtual]

Reimplemented from CWinApp.

Definition at line 46 of file XMLTree.cpp.

{
  AfxEnableControlContainer();

  // Standard initialization
  // If you are not using these features and wish to reduce the size
  //  of your final executable, you should remove from the following
  //  the specific initialization routines you do not need.

#ifdef _AFXDLL
  Enable3dControls();     // Call this when using MFC in a shared DLL
#else
  Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif

  CXMLTreeDlg dlg;
  m_pMainWnd = &dlg;
  int nResponse = dlg.DoModal();
  if (nResponse == IDOK)
  {
    // TODO: Place code here to handle when the dialog is
    //  dismissed with OK
  }
  else if (nResponse == IDCANCEL)
  {
    // TODO: Place code here to handle when the dialog is
    //  dismissed with Cancel
  }

  // Since the dialog has been closed, return FALSE so that we exit the
  //  application, rather than start the application's message pump.
  return FALSE;
}

The documentation for this class was generated from the following files:
  • Web/xml/mfc_tree/XMLTree.h
  • Web/xml/mfc_tree/XMLTree.cpp
Generated on Wed Nov 13 2024 16:57:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CXMLTreeDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes

CXMLTreeDlg Class Reference

#include "XMLTreeDlg.h"

List of all members.

Public Types

enum | { IDD = IDD_XMLTREE_DIALOG }

Public Member Functions

CXMLTreeDlg (CWnd *pParent=NULL)
int | LoadXML (CString filename)
int | MakeTree (MSXML::IXMLDOMElement *node, HTREEITEM ht)

Public Attributes

CString m_debug
CString m_filename
CImageList | m_imageList
CTreeCtrl | m_tree

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)
afx_msg void | OnChangeFilename ()
virtual BOOL | OnInitDialog ()
afx_msg void | OnLoad ()
virtual void | OnOK ()
afx_msg void | OnOpen ()
afx_msg void | OnPaint ()
afx_msg HCURSOR | OnQueryDragIcon ()
afx_msg void | OnSysCommand (UINT nID, LPARAM lParam)

Protected Attributes

HICON | m_hIcon

Detailed Description

Definition at line 19 of file XMLTreeDlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 30 of file XMLTreeDlg.h.

{ IDD = IDD_XMLTREE_DIALOG };

Constructor & Destructor Documentation

CXMLTreeDlg::CXMLTreeDlg ( CWnd * pParent = NULL )

Definition at line 65 of file XMLTreeDlg.cpp.

  : CDialog(CXMLTreeDlg::IDD, pParent)
{
  //{{AFX_DATA_INIT(CXMLTreeDlg)
  m_filename = _T("");
  m_debug = _T("Enter a URL to load or click the open button to find an XML file to open.");
  //}}AFX_DATA_INIT
  // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
  m_hIcon = AfxGetApp()->LoadIcon(IDR_XMLTREE);
}

Member Function Documentation

void CXMLTreeDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 76 of file XMLTreeDlg.cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(CXMLTreeDlg)
  DDX_Control(pDX, IDC_TREE, m_tree);
  DDX_Text(pDX, IDC_FILENAME, m_filename);
  DDX_Text(pDX, IDC_DEBUG, m_debug);
  //}}AFX_DATA_MAP
}

int CXMLTreeDlg::LoadXML ( CString filename )

Definition at line 197 of file XMLTreeDlg.cpp.

{
  MSXML::IXMLDOMDocument    *pDoc        = NULL;
  MSXML::IXMLDOMParseError  *pParsingErr = NULL;
  MSXML::IXMLDOMElement   *element     = NULL;
  MSXML::IXMLDOMNodeList    *childs      = NULL;
  MSXML::IXMLDOMNode      *node        = NULL;
  HTREEITEM ht;

  BSTR  bstr = NULL;
  HRESULT hr;
    int     rc = 0;
  char msg[500];

  m_tree.DeleteAllItems();

  m_debug = "Loading " + filename;
  UpdateData(FALSE);
    UpdateWindow();

  hr = CoInitialize(NULL);
  if(!SUCCEEDED(hr))
    return 0;

  hr = CoCreateInstance (MSXML::CLSID_DOMDocument, NULL, CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER,
              MSXML::IID_IXMLDOMDocument, (LPVOID *)&pDoc);
  if(!pDoc)
    {
        m_debug = "Error co-creating IXMLDOMDocument";
        goto cleanup;
    }

    pDoc->put_async(VARIANT_FALSE);
    bstr = filename.AllocSysString();
  hr = pDoc->load (bstr);
    SysFreeString(bstr);

  if(!hr)
  {
    long line, linePos;
    BSTR reason = NULL;

    pDoc->get_parseError(&pParsingErr);

      pParsingErr->get_line(&line);
    pParsingErr->get_linepos(&linePos);
    pParsingErr->get_reason(&reason);
    pParsingErr->get_errorCode(&hr);

    sprintf(msg, "Error 0x%.8X on line %d, position %d\r\n", hr, line, linePos);

    m_debug = reason;
    m_debug += CString(msg);

        SysFreeString(reason);
  }
    else
    {
        m_debug = "Building Tree View...";
      UpdateData(FALSE);
        UpdateWindow();

      pDoc->get_documentElement(&element);

      ht = m_tree.InsertItem("#document",0,0,TVI_ROOT,TVI_LAST);

      int count = MakeTree(element,ht);

      m_tree.Expand(ht,TVE_EXPAND);
      ht = m_tree.GetChildItem( ht );
      m_tree.Expand(ht,TVE_EXPAND);
        rc = 1;

    sprintf(msg, "Loaded %d XML nodes.", count);
        m_debug = msg;
      UpdateData(FALSE);
        UpdateWindow();
    }

cleanup:
    UpdateData(FALSE);
  return rc;
}

int CXMLTreeDlg::MakeTree | ( | MSXML::IXMLDOMElement * | node,
 |  | HTREEITEM | ht
 | ) |  |

Definition at line 282 of file XMLTreeDlg.cpp.

{
  MSXML::IXMLDOMNodeList  *childs    = NULL;
  MSXML::IXMLDOMNode    *childnode = NULL;

  BSTR        s = NULL;
  long        i;
  HTREEITEM ht2;

    // Note this builds the entire tree view.  It would
    // be much more efficient to build only the visible
    // part of the tree and expand the child elements on demand.
    // But that is left as an exercise for the reader.

  node->get_nodeTypeString(&s);

    int result = 1;

    if(!wcscmp(s,L"element"))
  {
    node->get_nodeName(&s);
    ht2 = m_tree.InsertItem(CString(s),1,1,ht,TVI_LAST);
  } else if(!wcscmp(s,L"text")){
    node->get_text(&s);
    ht2 = m_tree.InsertItem(CString(s),2,2,ht,TVI_LAST);
  } else {
        // Note: There are more node types than this.
        // Correctly displaying all nodes types is left
        // as an exercise for the reader.
    node->get_nodeName(&s);
    ht2 = m_tree.InsertItem(CString(s),3,3,ht,TVI_LAST);
  }

  if(node->hasChildNodes())
  {
    node->get_childNodes(&childs);
    for(i=0;i<childs->Getlength();i++)
    {
      childs->get_item(i,&childnode);
      result += MakeTree((MSXML::IXMLDOMElement *)childnode,ht2);
    }
  }
    return result;
}

void CXMLTreeDlg::OnChangeFilename ( ) [protected]

Definition at line 332 of file XMLTreeDlg.cpp.

{
  // TODO: If this is a RICHEDIT control, the control will not
  // send this notification unless you override the CDialog::OnInitDialog()
  // function and call CRichEditCtrl().SetEventMask()
  // with the ENM_CHANGE flag ORed into the mask.

  // TODO: Add your control notification handler code here
}

BOOL CXMLTreeDlg::OnInitDialog ( ) [protected, virtual]

Definition at line 100 of file XMLTreeDlg.cpp.

{
  CDialog::OnInitDialog();

  // Add "About..." menu item to system menu.

  // IDM_ABOUTBOX must be in the system command range.
  ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
  ASSERT(IDM_ABOUTBOX < 0xF000);

  CMenu* pSysMenu = GetSystemMenu(FALSE);
  if (pSysMenu != NULL)
  {
    CString strAboutMenu;
    strAboutMenu.LoadString(IDS_ABOUTBOX);
    if (!strAboutMenu.IsEmpty())
    {
      pSysMenu->AppendMenu(MF_SEPARATOR);
      pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
    }
  }

  // Set the icon for this dialog.  The framework does this automatically
  //  when the application's main window is not a dialog
  SetIcon(m_hIcon, TRUE);     // Set big icon
  SetIcon(m_hIcon, FALSE);    // Set small icon

  // TODO: Add extra initialization here

  m_imageList.Create(IDB_TREEICON, 16, 4, RGB( 255, 255, 255 ));
  m_tree.SetImageList( &m_imageList, TVSIL_NORMAL );

  return TRUE;  // return TRUE  unless you set the focus to a control
}

void CXMLTreeDlg::OnLoad ( ) [protected]

Definition at line 184 of file XMLTreeDlg.cpp.

{
    GetDlgItemText(IDC_FILENAME, m_filename);
    if (0 == m_filename.GetLength())
    {
        OnOpen();
    }
    else
    {
        LoadXML(m_filename);
    }
}

void CXMLTreeDlg::OnOK ( ) [protected, virtual]

Definition at line 327 of file XMLTreeDlg.cpp.

{
    OnLoad();
}

void CXMLTreeDlg::OnOpen ( ) [protected]

Definition at line 342 of file XMLTreeDlg.cpp.

{
  // TODO: Add your control notification handler code here
  CFileDialog dlg(TRUE,NULL,NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
    "XML Files (*.xml)|*.xml|All Files (*.*)|*.*||",this);

  if (IDOK == dlg.DoModal())
    {
      m_filename = dlg.GetPathName();
      UpdateData(FALSE);
        LoadXML(m_filename);
    }
}

void CXMLTreeDlg::OnPaint ( void ) [protected]

Definition at line 152 of file XMLTreeDlg.cpp.

{
  if (IsIconic())
  {
    CPaintDC dc(this); // device context for painting

    SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

    // Center icon in client rectangle
    int cxIcon = GetSystemMetrics(SM_CXICON);
    int cyIcon = GetSystemMetrics(SM_CYICON);
    CRect rect;
    GetClientRect(&rect);
    int x = (rect.Width() - cxIcon + 1) / 2;
    int y = (rect.Height() - cyIcon + 1) / 2;

    // Draw the icon
    dc.DrawIcon(x, y, m_hIcon);
  }
  else
  {
    CDialog::OnPaint();
  }
}

HCURSOR CXMLTreeDlg::OnQueryDragIcon ( ) [protected]

Definition at line 179 of file XMLTreeDlg.cpp.

{
  return (HCURSOR) m_hIcon;
}

void CXMLTreeDlg::OnSysCommand | ( | UINT | nID,
 |  | LPARAM | lParam |
 | ) |  |  | [protected]

Definition at line 135 of file XMLTreeDlg.cpp.

{
  if ((nID & 0xFFF0) == IDM_ABOUTBOX)
  {
    CAboutDlg dlgAbout;
    dlgAbout.DoModal();
  }
  else
  {
    CDialog::OnSysCommand(nID, lParam);
  }
}

Member Data Documentation

CString CXMLTreeDlg::m_debug

Definition at line 33 of file XMLTreeDlg.h.

CString CXMLTreeDlg::m_filename

Definition at line 32 of file XMLTreeDlg.h.

HICON CXMLTreeDlg::m_hIcon [protected]

Definition at line 45 of file XMLTreeDlg.h.

CImageList CXMLTreeDlg::m_imageList

Definition at line 23 of file XMLTreeDlg.h.

CTreeCtrl CXMLTreeDlg::m_tree

Definition at line 31 of file XMLTreeDlg.h.

The documentation for this class was generated from the following files:
  • Web/xml/mfc_tree/XMLTreeDlg.h
  • Web/xml/mfc_tree/XMLTreeDlg.cpp
Generated on Wed Nov 13 2024 16:57:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: DBCONN Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

DBCONN Struct Reference

List of all members.

Public Attributes

HDBC | hdbc
HSTMT | hstmt
char | pszPasswd [STR_LEN]
char | pszSrv [STR_LEN]
char | pszUser [STR_LEN]

Detailed Description

Definition at line 99 of file MqTrans.Cpp.

Member Data Documentation

HDBC DBCONN::hdbc

Definition at line 104 of file MqTrans.Cpp.

HSTMT DBCONN::hstmt

Definition at line 105 of file MqTrans.Cpp.

char DBCONN::pszPasswd[STR_LEN]

Definition at line 103 of file MqTrans.Cpp.

char DBCONN::pszSrv[STR_LEN]

Definition at line 101 of file MqTrans.Cpp.

char DBCONN::pszUser[STR_LEN]

Definition at line 102 of file MqTrans.Cpp.

The documentation for this struct was generated from the following file:
  • NetDS/MessageQueuing/MqTrans/MqTrans.Cpp
Generated on Wed Nov 13 2024 16:57:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: DBG_THREAD_INFO Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

DBG_THREAD_INFO Struct Reference

List of all members.

Public Attributes

DWORD dwThreadID
HANDLE hThread

Detailed Description

Definition at line 33 of file Utils.c.

Member Data Documentation

DWORD DBG_THREAD_INFO::dwThreadID

Definition at line 34 of file Utils.c.

HANDLE DBG_THREAD_INFO::hThread

Definition at line 35 of file Utils.c.

The documentation for this struct was generated from the following file:
  • WinBase/Debug/BPSamp/Utils.c
Generated on Wed Nov 13 2024 16:57:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: DEB_DLL_LIST_INFO_STRUCT Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

DEB_DLL_LIST_INFO_STRUCT Struct Reference

#include "DebDebug.h"

List of all members.

Public Attributes

DWORD dwActiveDlls

Detailed Description

Definition at line 46 of file DebDebug.h.

Member Data Documentation

DWORD DEB_DLL_LIST_INFO_STRUCT::dwActiveDlls

Definition at line 47 of file DebDebug.h.

The documentation for this struct was generated from the following file:
  • WinBase/Debug/Deb/DebDebug.h
Generated on Wed Nov 13 2024 16:57:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: DEB_DLL_NODE_INFO_STRUCT Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

DEB_DLL_NODE_INFO_STRUCT Struct Reference

#include "DebDebug.h"

List of all members.

Public Attributes

LOAD_DLL_DEBUG_INFO DllDebugInfo
LPTSTR lpstrFileName
LPTSTR lpstrPathName

Detailed Description

Definition at line 70 of file DebDebug.h.

Member Data Documentation

LOAD_DLL_DEBUG_INFO DEB_DLL_NODE_INFO_STRUCT::DllDebugInfo

Definition at line 73 of file DebDebug.h.

LPTSTR DEB_DLL_NODE_INFO_STRUCT::lpstrFileName

Definition at line 71 of file DebDebug.h.

LPTSTR DEB_DLL_NODE_INFO_STRUCT::lpstrPathName

Definition at line 72 of file DebDebug.h.

The documentation for this struct was generated from the following file:
  • WinBase/Debug/Deb/DebDebug.h
Generated on Wed Nov 13 2024 16:57:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: DEB_PROCESS_LIST_INFO_STRUCT Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

DEB_PROCESS_LIST_INFO_STRUCT Struct Reference

#include "DebDebug.h"

List of all members.

Public Attributes

DWORD dwActiveProcesses

Detailed Description

Definition at line 36 of file DebDebug.h.

Member Data Documentation

DWORD DEB_PROCESS_LIST_INFO_STRUCT::dwActiveProcesses

Definition at line 37 of file DebDebug.h.

The documentation for this struct was generated from the following file:
  • WinBase/Debug/Deb/DebDebug.h
Generated on Wed Nov 13 2024 16:57:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: DEB_PROCESS_NODE_INFO_STRUCT Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

DEB_PROCESS_NODE_INFO_STRUCT Struct Reference

#include "DebDebug.h"

List of all members.

Public Attributes

DWORD dwProcessId
DWORD dwThreadId
LPTSTR lpstrFileName
LPTSTR lpstrPathName
PLIST pDllList
CREATE_PROCESS_DEBUG_INFO ProcessDebugInfo
PLIST pThreadList

Detailed Description

Definition at line 52 of file DebDebug.h.

Member Data Documentation

DWORD DEB_PROCESS_NODE_INFO_STRUCT::dwProcessId

Definition at line 53 of file DebDebug.h.

DWORD DEB_PROCESS_NODE_INFO_STRUCT::dwThreadId

Definition at line 54 of file DebDebug.h.

LPTSTR DEB_PROCESS_NODE_INFO_STRUCT::lpstrFileName

Definition at line 55 of file DebDebug.h.

LPTSTR DEB_PROCESS_NODE_INFO_STRUCT::lpstrPathName

Definition at line 56 of file DebDebug.h.

PLIST DEB_PROCESS_NODE_INFO_STRUCT::pDllList

Definition at line 58 of file DebDebug.h.

CREATE_PROCESS_DEBUG_INFO DEB_PROCESS_NODE_INFO_STRUCT::ProcessDebugInfo

Definition at line 59 of file DebDebug.h.

PLIST DEB_PROCESS_NODE_INFO_STRUCT::pThreadList

Definition at line 57 of file DebDebug.h.

The documentation for this struct was generated from the following file:
  • WinBase/Debug/Deb/DebDebug.h
Generated on Wed Nov 13 2024 16:57:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: DEB_STARTUP_INFO_STRUCT Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

DEB_STARTUP_INFO_STRUCT Struct Reference

#include "DebDebug.h"

List of all members.

Public Attributes

DWORD dwProcessId
BOOL fActive
HWND | hWndListBox
LPTSTR lpstrFileName
LPTSTR lpstrPathName
PROCESS_INFORMATION | ProcessInfo
STARTUPINFO | StartupInfo

Detailed Description

Definition at line 24 of file DebDebug.h.

Member Data Documentation

DWORD DEB_STARTUP_INFO_STRUCT::dwProcessId

Definition at line 26 of file DebDebug.h.

BOOL DEB_STARTUP_INFO_STRUCT::fActive

Definition at line 25 of file DebDebug.h.

HWND DEB_STARTUP_INFO_STRUCT::hWndListBox

Definition at line 29 of file DebDebug.h.

LPTSTR DEB_STARTUP_INFO_STRUCT::lpstrFileName

Definition at line 27 of file DebDebug.h.

LPTSTR DEB_STARTUP_INFO_STRUCT::lpstrPathName

Definition at line 28 of file DebDebug.h.

PROCESS_INFORMATION DEB_STARTUP_INFO_STRUCT::ProcessInfo

Definition at line 31 of file DebDebug.h.

STARTUPINFO DEB_STARTUP_INFO_STRUCT::StartupInfo

Definition at line 30 of file DebDebug.h.

The documentation for this struct was generated from the following file:
  • WinBase/Debug/Deb/DebDebug.h
Generated on Wed Nov 13 2024 16:57:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: DEB_THREAD_LIST_INFO_STRUCT Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

DEB_THREAD_LIST_INFO_STRUCT Struct Reference

#include "DebDebug.h"

List of all members.

Public Attributes

DWORD dwActiveThreads

Detailed Description

Definition at line 41 of file DebDebug.h.

Member Data Documentation

DWORD DEB_THREAD_LIST_INFO_STRUCT::dwActiveThreads

Definition at line 42 of file DebDebug.h.

The documentation for this struct was generated from the following file:
  • WinBase/Debug/Deb/DebDebug.h
Generated on Wed Nov 13 2024 16:57:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: DEB_THREAD_NODE_INFO_STRUCT Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

DEB_THREAD_NODE_INFO_STRUCT Struct Reference

#include "DebDebug.h"

List of all members.

Public Attributes

DWORD dwProcessId
DWORD dwThreadId
CREATE_THREAD_DEBUG_INFO ThreadDebugInfo

Detailed Description

Definition at line 63 of file DebDebug.h.

Member Data Documentation

DWORD DEB_THREAD_NODE_INFO_STRUCT::dwProcessId

Definition at line 64 of file DebDebug.h.

DWORD DEB_THREAD_NODE_INFO_STRUCT::dwThreadId

Definition at line 65 of file DebDebug.h.

CREATE_THREAD_DEBUG_INFO DEB_THREAD_NODE_INFO_STRUCT::ThreadDebugInfo

Definition at line 66 of file DebDebug.h.

The documentation for this struct was generated from the following file:
  • WinBase/Debug/Deb/DebDebug.h
Generated on Wed Nov 13 2024 16:57:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: DebugGlobals Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

DebugGlobals Struct Reference

Debug variables.

#include "Global.h"

List of all members.

Public Attributes

HRESULT | hrLastError
int | iLine
char * | psFile
CHAR | sLastError [100]

Detailed Description

Definition at line 222 of file Global.h.

Member Data Documentation

HRESULT DebugGlobals::hrLastError

Definition at line 225 of file Global.h.

int DebugGlobals::iLine

Definition at line 224 of file Global.h.

char* DebugGlobals::psFile

Definition at line 223 of file Global.h.

CHAR DebugGlobals::sLastError[100]

Definition at line 226 of file Global.h.

The documentation for this struct was generated from the following file:
  • WinUI/GlobalDev/CSSamp/Global.h
Generated on Wed Nov 13 2024 16:57:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Deers Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Attributes

Deers Struct Reference

#include "FrameworkProv.h"

List of all members.

Public Types

enum | { NDeers = 9 }

Public Attributes

bool | m_deleted
WCHAR * | m_name
bool | m_redNose
DWORD m_weight

Detailed Description

Definition at line 67 of file FrameworkProv.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
NDeers

Definition at line 74 of file FrameworkProv.h.

{NDeers = 9};

Member Data Documentation

bool Deers::m_deleted

Definition at line 72 of file FrameworkProv.h.

WCHAR* Deers::m_name

Definition at line 69 of file FrameworkProv.h.

bool Deers::m_redNose

Definition at line 71 of file FrameworkProv.h.

DWORD Deers::m_weight

Definition at line 70 of file FrameworkProv.h.

The documentation for this struct was generated from the following file:
  • SysMgmt/WMI/VC/FrameworkProv/FrameworkProv.h
Generated on Wed Nov 13 2024 16:57:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: direct Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

direct Struct Reference

List of all members.

Public Attributes

BOOL bScanned
struct direct * | curdir
LIST directs
LIST diritems
DIRLIST head
struct direct * | parent
int | pos
LPSTR relname

Detailed Description

Definition at line 94 of file scandir.cpp.

Member Data Documentation

BOOL direct::bScanned

Definition at line 99 of file scandir.cpp.

struct direct* direct::curdir

Definition at line 104 of file scandir.cpp.

LIST direct::directs

Definition at line 101 of file scandir.cpp.

LIST direct::diritems

Definition at line 100 of file scandir.cpp.

DIRLIST direct::head

Definition at line 96 of file scandir.cpp.

struct direct* direct::parent

Definition at line 97 of file scandir.cpp.

int direct::pos

Definition at line 103 of file scandir.cpp.

LPSTR direct::relname

Definition at line 95 of file scandir.cpp.

The documentation for this struct was generated from the following file:
  • Begin/sdkdiff/scandir.cpp
Generated on Wed Nov 13 2024 16:57:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: diritem Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

diritem Struct Reference

List of all members.

Public Attributes

DWORD attr
BOOL bLocalIsTemp
DWORD checksum
struct direct * | direct
BOOL fileerror
FILETIME ft_lastwrite
LPSTR localname
LPSTR name
int | sequence
long | size
BOOL sumvalid

Detailed Description

Definition at line 75 of file scandir.cpp.

Member Data Documentation

DWORD diritem::attr

Definition at line 79 of file scandir.cpp.

BOOL diritem::bLocalIsTemp

Definition at line 85 of file scandir.cpp.

DWORD diritem::checksum

Definition at line 78 of file scandir.cpp.

struct direct* diritem::direct

Definition at line 83 of file scandir.cpp.

BOOL diritem::fileerror

Definition at line 82 of file scandir.cpp.

FILETIME diritem::ft_lastwrite

Definition at line 80 of file scandir.cpp.

LPSTR diritem::localname

Definition at line 84 of file scandir.cpp.

LPSTR diritem::name

Definition at line 76 of file scandir.cpp.

int diritem::sequence

Definition at line 88 of file scandir.cpp.

long diritem::size

Definition at line 77 of file scandir.cpp.

BOOL diritem::sumvalid

Definition at line 81 of file scandir.cpp.

The documentation for this struct was generated from the following file:
  • Begin/sdkdiff/scandir.cpp
Generated on Wed Nov 13 2024 16:57:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: dirlist Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

dirlist Struct Reference

List of all members.

Public Attributes

BOOL bFile
BOOL bSum
DIRECT dot
LPSTR pDescription
DIRLIST pOtherDirList
LPSTR pPattern
char rootname [MAX_PATH]

Detailed Description

Definition at line 117 of file scandir.cpp.

Member Data Documentation

BOOL dirlist::bFile

Definition at line 120 of file scandir.cpp.

BOOL dirlist::bSum

Definition at line 121 of file scandir.cpp.

DIRECT dirlist::dot

Definition at line 122 of file scandir.cpp.

LPSTR dirlist::pDescription

Definition at line 125 of file scandir.cpp.

DIRLIST dirlist::pOtherDirList

Definition at line 127 of file scandir.cpp.

LPSTR dirlist::pPattern

Definition at line 124 of file scandir.cpp.

char dirlist::rootname[MAX_PATH]

Definition at line 119 of file scandir.cpp.

The documentation for this struct was generated from the following file:
  • Begin/sdkdiff/scandir.cpp
Generated on Wed Nov 13 2024 16:57:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: DOREGSTRUCT Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

DOREGSTRUCT Struct Reference

List of all members.

Public Attributes

HKEY hRootKey
LPTSTR lpszValueName
LPTSTR szData
LPTSTR szSubKey
TCHAR | szSubKey [MAX_PATH]
TCHAR | szValue [MAX_PATH]

Detailed Description

Definition at line 400 of file OLEDoc.Cpp.

Member Data Documentation

HKEY DOREGSTRUCT::hRootKey

Definition at line 401 of file OLEDoc.Cpp.

LPTSTR DOREGSTRUCT::lpszValueName

Definition at line 209 of file BandObjs.Cpp.

LPTSTR DOREGSTRUCT::szData

Definition at line 210 of file BandObjs.Cpp.

LPTSTR DOREGSTRUCT::szSubKey

Definition at line 208 of file BandObjs.Cpp.

TCHAR DOREGSTRUCT::szSubKey[MAX_PATH]

Definition at line 402 of file OLEDoc.Cpp.

TCHAR DOREGSTRUCT::szValue[MAX_PATH]

Definition at line 403 of file OLEDoc.Cpp.

The documentation for this struct was generated from the following files:
  • Com/Fundamentals/ActiveDocument/DoServer/OLEDoc.Cpp
  • WinUI/Shell/BandObjs/BandObjs.Cpp
Generated on Wed Nov 13 2024 16:57:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: DTHandler Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Static Private Member Functions | Static Private Attributes

DTHandler Class Reference

#include "DtHandler.Hpp"

Inherited by SocketMonitor.

List of all members.

Public Member Functions

bool | dispatch (int notificationCode, void *returnCode, char *LibraryName, bool preAPI, va_list vl)

Protected Member Functions

virtual bool | __WSAFDIsSet (SOCKET s, FD_SET FAR *set, APIHook< int > &hook)
virtual bool | accept (SOCKET s, struct sockaddr FAR *addr, int FAR *addrlen, APIHook< SOCKET > &hook)
virtual bool | bind (SOCKET s, const struct sockaddr FAR *name, int namelen, APIHook< int > &hook)
virtual bool | closesocket (SOCKET s, APIHook< int > &hook)
virtual bool | connect (SOCKET s, const struct sockaddr FAR *name, int namelen, APIHook< int > &hook)
virtual bool | gethostbyaddr (const char FAR *addr, int len, int type, APIHook< HOSTENT > &hook)
virtual bool | gethostbyname (const char FAR *name, APIHook< HOSTENT > &hook)
virtual bool | gethostname (char FAR *name, int namelen, APIHook< int > &hook)
virtual bool | getpeername (SOCKET s, struct sockaddr FAR *name, int FAR *namelen, APIHook< int > &hook)
virtual bool | getprotobyname (const char FAR *name, APIHook< PROTOENT > &hook)
virtual bool | getprotobynumber (int number, APIHook< PROTOENT > &hook)
virtual bool | getservbyname (const char FAR *name, const char FAR *proto, APIHook< SERVENT > &hook)
virtual bool | getservbyport (int port, const char FAR *proto, APIHook< SERVENT > &hook)
virtual bool | getsockname (SOCKET s, struct sockaddr FAR *name, int FAR *namelen, APIHook< int > &hook)
virtual bool | getsockopt (SOCKET s, int level, int optname, char FAR *optval, int FAR *optlen, APIHook< int > &hook)
virtual bool | htonl (unsigned long hostlong, APIHook< unsigned long > &hook)
virtual bool | htons (unsigned short hostshort, APIHook< unsigned short > &hook)
virtual bool | inet_addr (const char FAR *cp, APIHook< unsigned long > &hook)
virtual bool | inet_ntoa (struct in_addr in, APIHook< char FAR * > &hook)
virtual bool | ioctlsocket (SOCKET s, long cmd, unsigned long FAR *argp, APIHook< int > &hook)
virtual bool | listen (SOCKET s, int backlog, APIHook< int > &hook)
virtual bool | NSPAddressToString (LPSOCKADDR lpsaAddress, DWORD dwAddressLength, LPWSAPROTOCOL_INFOW lpProtocolInfo, LPWSTR lpszAddressString, LPDWORD lpdwAddressStringLength, APIHook< int > &hook)
virtual bool | NSPGetAddressByName (LPWSTR lpszServiceInstanceName, LPGUID lpServiceClassId, DWORD dwNameSpace, LPDWORD lpdwBufferLength, LPWSAQUERYSETW lpqsResults, DWORD dwResolution, LPWSTR lpszAliasBuffer, LPDWORD lpdwAliasBufferLength, APIHook< int > &hook)
virtual bool | NSPGetServiceClassInfo (IN LPGUID lpProviderId, IN OUT LPDWORD lpdwBufSize, IN OUT LPWSASERVICECLASSINFOW lpServiceClassInfo, APIHook< int > &hook)
virtual bool | NSPGetServiceClassNameByClassId (LPGUID lpServiceClassId, LPWSTR lpszServiceClassName, LPDWORD lpdwBufferLength, APIHook< int > &hook)
virtual bool | NSPInstallServiceClass (LPGUID lpProviderId, LPWSASERVICECLASSINFOW lpServiceClassInfo, APIHook< int > &hook)
virtual bool | NSPLookupServiceBegin (LPGUID lpProviderId, LPWSAQUERYSETW lpqsRestrictions, LPWSASERVICECLASSINFOW lpServiceClassInfo, DWORD dwControlFlags, LPHANDLE lphLookup, APIHook< int > &hook)
virtual bool | NSPLookupServiceEnd (HANDLE hLookup, APIHook< int > &hook)
virtual bool | NSPLookupServiceNext (HANDLE hLookup, DWORD dwControlFlags, LPDWORD lpdwBufferLength, LPWSAQUERYSET lpqsResults, APIHook< int > &hook)
virtual bool | NSPRemoveServiceClass (IN LPGUID lpProviderId, IN LPGUID lpServiceClassId, APIHook< int > &hook)
virtual bool | NSPSetService (LPGUID lpProviderId, LPWSASERVICECLASSINFOW lpServiceClassInfo, LPWSAQUERYSETW lpqsRegInfo, WSAESETSERVICEOP essOperation, DWORD dwControlFlags, APIHook< int > &hook)
virtual bool | NSPStringToAddress (LPWSTR AddressString, INT AddressFamily, LPWSAPROTOCOL_INFOW lpProtocolInfo, LPSOCKADDR lpAddress, LPINT lpAddressLength, APIHook< int > &hook)
virtual bool | ntohl (unsigned long netlong, APIHook< unsigned long > &hook)
virtual bool | ntohs (unsigned short netshort, APIHook< unsigned short > &hook)
virtual bool | recv (SOCKET s, char FAR *buf, int len, int flags, APIHook< int > &hook)
virtual bool | recvfrom (SOCKET s, char FAR *buf, int len, int flags, struct sockaddr FAR *from, int FAR *fromlen, APIHook< int > &hook)
virtual bool | select (int nfds, fd_set FAR *readfds, fd_set FAR *writefds, fd_set FAR *exceptfds, const struct timeval FAR *timeout, APIHook< int > &hook)
virtual bool | send (SOCKET s, const char FAR *buf, int len, int flags, APIHook< int > &hook)
virtual bool | sendto (SOCKET s, const char FAR *buf, int len, int flags, const struct sockaddr FAR *to, int tolen, APIHook< int > &hook)
virtual bool | setsockopt (SOCKET s, int level, int optname, const char FAR *optval, int optlen, APIHook< int > &hook)
virtual bool | shutdown (SOCKET s, int how, APIHook< int > &hook)
virtual bool | socket (int af, int type, int protocol, APIHook< SOCKET > &hook)
virtual bool | WPUCloseEvent (WSAEVENT hEvent, LPINT lpErrno, APIHook< BOOL > &hook)
virtual bool | WPUCloseSocketHandle (SOCKET s, LPINT lpErrno, APIHook< int > &hook)
virtual bool | WPUCreateEvent (LPINT lpErrno, APIHook< WSAEVENT > &hook)
virtual bool | WPUCreateSocketHandle (DWORD dwCatalogEntryId, DWORD dwContext, LPINT lpErrno, APIHook< SOCKET > &hook)
virtual bool | WPUFDIsSet (SOCKET s, FD_SET FAR *set, APIHook< int > &hook)
virtual bool | WPUGetProviderPath (LPGUID lpProviderId, LPWSTR lpszProviderDllPath, LPINT lpProviderDllPathLen, LPINT lpErrno, APIHook< int > &hook)
virtual bool | WPUModifyIFSHandle (DWORD dwCatalogEntryId, SOCKET ProposedHandle, LPINT lpErrno, APIHook< SOCKET > &hook)
virtual bool | WPUPostMessage (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, APIHook< BOOL > &hook)
virtual bool | WPUQueryBlockingCallback (DWORD dwCatalogEntryId, LPBLOCKINGCALLBACK FAR *lplpfnCallback, LPDWORD lpdwContext, LPINT lpErrno, APIHook< int > &hook)
virtual bool | WPUQuerySocketHandleContext (SOCKET s, LPDWORD lpContext, LPINT lpErrno, APIHook< int > &hook)
virtual bool | WPUQueueApc (LPWSATHREADID lpThreadId, LPWSAUSERAPC lpfnUserApc, DWORD dwContext, LPINT lpErrno, APIHook< int > &hook)
virtual bool | WPUResetEvent (WSAEVENT hEvent, LPINT lpErrno, APIHook< BOOL > &hook)
virtual bool | WPUSetEvent (WSAEVENT hEvent, LPINT lpErrno, APIHook< BOOL > &hook)
virtual bool | WSAAccept (SOCKET s, struct sockaddr FAR *addr, int FAR *addrlen, LPCONDITIONPROC lpfnCondition, unsigned long dwCallbackData, APIHook< SOCKET > &hook)
virtual bool | WSAAddressToStringA (LPSOCKADDR lpsaAddress, DWORD dwAddressLength, LPWSAPROTOCOL_INFOA lpProtocolInfo, OUT LPTSTR lpszAddressString, IN OUT LPDWORD lpdwAddressStringLength, APIHook< INT > &hook)
virtual bool | WSAAddressToStringW (LPSOCKADDR lpsaAddress, DWORD dwAddressLength, LPWSAPROTOCOL_INFOW lpProtocolInfo, OUT LPTSTR lpszAddressString, IN OUT LPDWORD lpdwAddressStringLength, APIHook< INT > &hook)
virtual bool | WSAAsyncGetHostByAddr (HWND hWnd, unsigned int wMsg, const char FAR *addr, int len, int type, char FAR *buf, int buflen, APIHook< HANDLE > &hook)
virtual bool | WSAAsyncGetHostByName (HWND hWnd, unsigned int wMsg, const char FAR *name, char FAR *buf, int buflen, APIHook< HANDLE > &hook)
virtual bool | WSAAsyncGetProtoByName (HWND hWnd, unsigned int wMsg, const char FAR *name, char FAR *buf, int buflen, APIHook< HANDLE > &hook)
virtual bool | WSAAsyncGetProtoByNumber (HWND hWnd, unsigned int wMsg, int number, char FAR *buf, int buflen, APIHook< HANDLE > &hook)
virtual bool | WSAAsyncGetServByName (HWND hWnd, unsigned int wMsg, const char FAR *name, const char FAR *proto, char FAR *buf, int buflen, APIHook< HANDLE > &hook)
virtual bool | WSAAsyncGetServByPort (HWND hWnd, unsigned int wMsg, int port, const char FAR *proto, char FAR *buf, int buflen, APIHook< HANDLE > &hook)
virtual bool | WSAAsyncSelect (SOCKET s, HWND hWnd, unsigned int wMsg, long lEvent, APIHook< int > &hook)
virtual bool | WSACancelAsyncRequest (HANDLE hAsyncTaskHandle, APIHook< int > &hook)
virtual bool | WSACancelBlockingCall (APIHook< int > &hook)
virtual bool | WSACleanup (APIHook< int > &hook)
virtual bool | WSACloseEvent (WSAEVENT hEvent, APIHook< int > &hook)
virtual bool | WSAConnect (SOCKET s, const struct sockaddr FAR *name, int namelen, LPWSABUF lpCallerData, LPWSABUF lpCalleeData, LPQOS lpSQOS, LPQOS lpGQOS, APIHook< int > &hook)
virtual bool | WSACreateEvent (APIHook< WSAEVENT > &hook)
virtual bool | WSADuplicateSocketA (SOCKET s, DWORD dwProcessId, LPWSAPROTOCOL_INFOA lpProtocolInfo, APIHook< int > &hook)
virtual bool | WSADuplicateSocketW (SOCKET s, DWORD dwProcessId, LPWSAPROTOCOL_INFOW lpProtocolInfo, APIHook< int > &hook)
virtual bool | WSAEnumNameSpaceProvidersA (IN OUT LPDWORD lpdwBufferLength, OUT LPWSANAMESPACE_INFOA lpnspBuffer, APIHook< INT > &hook)
virtual bool | WSAEnumNameSpaceProvidersW (IN OUT LPDWORD lpdwBufferLength, OUT LPWSANAMESPACE_INFOW lpnspBuffer, APIHook< INT > &hook)
virtual bool | WSAEnumNetworkEvents (SOCKET s, WSAEVENT hEventObject, LPWSANETWORKEVENTS lpNetworkEvents, APIHook< int > &hook)
virtual bool | WSAEnumProtocolsA (LPINT lpiProtocols, LPWSAPROTOCOL_INFOA lpProtocolBuffer, LPDWORD lpdwBufferLength, APIHook< int > &hook)
virtual bool | WSAEnumProtocolsW (LPINT lpiProtocols, LPWSAPROTOCOL_INFOW lpProtocolBuffer, LPDWORD lpdwBufferLength, APIHook< int > &hook)
virtual bool | WSAEventSelect (SOCKET s, WSAEVENT hEventObject, long lNetworkEvents, APIHook< int > &hook)
virtual bool | WSAGetLastError (APIHook< int > &hook)
virtual bool | WSAGetOverlappedResult (SOCKET s, LPWSAOVERLAPPED lpOverlapped, LPDWORD lpcbTransfer, BOOL fWait, unsigned long *lpdwFlags, APIHook< int > &hook)
virtual bool | WSAGetQOSByName (SOCKET s, LPWSABUF lpQOSName, LPQOS lpQOS, APIHook< int > &hook)
virtual bool | WSAGetServiceClassInfoA (LPGUID lpProviderId, LPGUID lpServiceClassId, LPDWORD lpdwBufferLength, LPWSASERVICECLASSINFOA lpServiceClassInfo, APIHook< INT > &hook)
virtual bool | WSAGetServiceClassInfoW (LPGUID lpProviderId, LPGUID lpServiceClassId, LPDWORD lpdwBufferLength, LPWSASERVICECLASSINFOW lpServiceClassInfo, APIHook< INT > &hook)
virtual bool | WSAGetServiceClassNameByClassIdA (LPGUID lpServiceClassId, LPSTR lpszServiceClassName, LPDWORD lpdwBufferLength, APIHook< int > &hook)
virtual bool | WSAGetServiceClassNameByClassIdW (LPGUID lpServiceClassId, LPWSTR lpszServiceClassName, LPDWORD lpdwBufferLength, APIHook< int > &hook)
virtual bool | WSAHtonl (SOCKET s, unsigned long hostlong, unsigned long FAR *lpnetlong, APIHook< int > &hook)
virtual bool | WSAHtons (SOCKET s, unsigned short hostshort, unsigned short FAR *lpnetshort, APIHook< int > &hook)
virtual bool | WSAInstallServiceClassA (LPWSASERVICECLASSINFOA lpServiceClassInfo, APIHook< INT > &hook)
virtual bool | WSAInstallServiceClassW (LPWSASERVICECLASSINFOW lpServiceClassInfo, APIHook< INT > &hook)
virtual bool | WSAIoctl (SOCKET s, DWORD dwIoControlCode, LPVOID lpvInBuffer, DWORD cbInBuffer, LPVOID lpvOutBuffer, DWORD cbOutBuffer, LPDWORD lpcbBytesReturned, LPWSAOVERLAPPED lpOverlapped, LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine, APIHook< int > &hook)
virtual bool | WSAIsBlocking (APIHook< int > &hook)
virtual bool | WSAJoinLeaf (SOCKET s, const struct sockaddr *name, int namelen, LPWSABUF lpCallerData, LPWSABUF lpCalleeData, LPQOS lpSQOS, LPQOS lpGQOS, DWORD dwFlags, APIHook< SOCKET > &hook)
virtual bool | WSALookupServiceBeginA (LPWSAQUERYSETA lpqsRestrictions, DWORD dwControlFlags, LPHANDLE lphLookup, APIHook< INT > &hook)
virtual bool | WSALookupServiceBeginW (LPWSAQUERYSETW lpqsRestrictions, DWORD dwControlFlags, LPHANDLE lphLookup, APIHook< INT > &hook)
virtual bool | WSALookupServiceEnd (HANDLE hLookup, APIHook< INT > &hook)
virtual bool | WSALookupServiceNextA (HANDLE hLookup, DWORD dwControlFlags, LPDWORD lpdwBufferLength, LPWSAQUERYSETA lpqsResults, APIHook< INT > &hook)
virtual bool | WSALookupServiceNextW (HANDLE hLookup, DWORD dwControlFlags, LPDWORD lpdwBufferLength, LPWSAQUERYSETW lpqsResults, APIHook< INT > &hook)
virtual bool | WSANtohl (SOCKET s, unsigned long netlong, unsigned long *lphostlong, APIHook< int > &hook)
virtual bool | WSANtohs (SOCKET s, unsigned short netshort, unsigned short *lphostshort, APIHook< int > &hook)
virtual bool | WSARecv (SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount, LPDWORD lpNumberOfBytesRecvd, LPDWORD lpFlags, LPWSAOVERLAPPED lpOverlapped, LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine, APIHook< int > &hook)
virtual bool | WSARecvDisconnect (SOCKET s, LPWSABUF lpInboundDisconnectData, APIHook< int > &hook)
virtual bool | WSARecvFrom (SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount, LPDWORD lpNumberOfBytesRecvd, LPDWORD lpFlags, struct sockaddr *lpFrom, LPINT lpFromlen, LPWSAOVERLAPPED lpOverlapped, LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine, APIHook< int > &hook)
virtual bool | WSARemoveServiceClass (LPGUID lpServiceClassId, APIHook< INT > &hook)
virtual bool | WSAResetEvent (WSAEVENT hEvent, APIHook< int > &hook)
virtual bool | WSASend (SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount, LPDWORD lpNumberOfBytesSent, DWORD dwFlags, LPWSAOVERLAPPED lpOverlapped, LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine, APIHook< int > &hook)
virtual bool | WSASendDisconnect (SOCKET s, LPWSABUF lpOutboundDisconnectData, APIHook< int > &hook)
virtual bool | WSASendTo (SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount, LPDWORD lpNumberOfBytesSent, DWORD dwFlags, const struct sockaddr *lpTo, int iTolen, LPWSAOVERLAPPED lpOverlapped, LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine, APIHook< int > &hook)
virtual bool | WSASetBlockingHook (FARPROC lpBlockFunc, APIHook< FARPROC > &hook)
virtual bool | WSASetEvent (WSAEVENT hEvent, APIHook< int > &hook)
virtual bool | WSASetLastError (int iError, APIHook< void > &hook)
virtual bool | WSASetServiceA (LPWSAQUERYSETA lpqsRegInfo, WSAESETSERVICEOP essOperation, DWORD dwControlFlags, APIHook< INT > &hook)
virtual bool | WSASetServiceW (LPWSAQUERYSETW lpqsRegInfo, WSAESETSERVICEOP essOperation, DWORD dwControlFlags, APIHook< INT > &hook)
virtual bool | WSASocketA (int af, int type, int protocol, LPWSAPROTOCOL_INFOA lpProtocolInfo, GROUP g, DWORD dwFlags, APIHook< SOCKET > &hook)
virtual bool | WSASocketW (int af, int type, int protocol, LPWSAPROTOCOL_INFOW lpProtocolInfo, GROUP g, DWORD dwFlags, APIHook< SOCKET > &hook)
virtual bool | WSAStartup (WORD wVersionRequested, LPWSADATA lpWSAData, APIHook< int > &hook)
virtual bool | WSAStringToAddressA (LPTSTR AddressString, INT AddressFamily, LPWSAPROTOCOL_INFOA lpProtocolInfo, LPSOCKADDR lpAddress, LPINT lpAddressLength, APIHook< INT > &hook)
virtual bool | WSAStringToAddressW (LPTSTR AddressString, INT AddressFamily, LPWSAPROTOCOL_INFOW lpProtocolInfo, LPSOCKADDR lpAddress, LPINT lpAddressLength, APIHook< INT > &hook)
virtual bool | WSAUnhookBlockingHook (APIHook< int > &hook)
virtual bool | WSAWaitForMultipleEvents (DWORD cEvents, const WSAEVENT FAR *lphEvents, BOOL fWaitAll, DWORD dwTimeout, BOOL fAlertable, APIHook< DWORD > &hook)
virtual bool | WSCDeinstallProvider (LPGUID lpProviderId, LPINT lpErrno, APIHook< int > &hook)
virtual bool | WSCEnableNSProvider (LPGUID lpProviderId, BOOL fEnable, APIHook< int > &hook)
virtual bool | WSCEnumProtocols (LPINT lpiProtocols, LPWSAPROTOCOL_INFOW lpProtocolBuffer, LPDWORD lpdwBufferLength, LPINT lpErrno, APIHook< int > &hook)
virtual bool | WSCGetProviderPath (LPGUID lpProviderId, LPWSTR lpszProviderDllPath, LPINT lpProviderDllPathLen, LPINT lpErrno, APIHook< int > &hook)
virtual bool | WSCInstallNameSpace (LPWSTR lpszIdentifier, LPWSTR lpszPathName, DWORD dwNameSpace, DWORD dwVersion, LPGUID lpProviderId, APIHook< int > &hook)
virtual bool | WSCInstallProvider (const LPGUID lpProviderId, const LPWSTR lpszProviderDllPath, const LPWSAPROTOCOL_INFOW lpProtocolInfoList, DWORD dwNumberOfEntries, LPINT lpErrno, APIHook< int > &hook)
virtual bool | WSCUnInstallNameSpace (LPGUID lpProviderId, APIHook< int > &hook)
virtual bool | WSPAccept (SOCKET s, struct sockaddr FAR *addr, LPINT addrlen, LPCONDITIONPROC lpfnCondition, DWORD dwCallbackData, LPINT lpErrno, APIHook< SOCKET > &hook)
virtual bool | WSPAddressToString (LPSOCKADDR lpsaAddress, DWORD dwAddressLength, LPWSAPROTOCOL_INFOW lpProtocolInfo, LPWSTR lpszAddressString, LPDWORD lpdwAddressStringLength, LPINT lpErrno, APIHook< int > &hook)
virtual bool | WSPAsyncSelect (SOCKET s, HWND hWnd, unsigned int wMsg, long lEvent, LPINT lpErrno, APIHook< int > &hook)
virtual bool | WSPBind (SOCKET s, const struct sockaddr FAR *name, int namelen, LPINT lpErrno, APIHook< int > &hook)
virtual bool | WSPCancelBlockingCall (LPINT lpErrno, APIHook< int > &hook)
virtual bool | WSPCleanup (LPINT lpErrno, APIHook< int > &hook)
virtual bool | WSPCloseSocket (SOCKET s, LPINT lpErrno, APIHook< int > &hook)
virtual bool | WSPConnect (SOCKET s, const struct sockaddr FAR *name, int namelen, LPWSABUF lpCallerData, LPWSABUF lpCalleeData, LPQOS lpSQOS, LPQOS lpGQOS, LPINT lpErrno, APIHook< int > &hook)
virtual bool | WSPDuplicateSocket (SOCKET s, DWORD dwProcessId, LPWSAPROTOCOL_INFOW lpProtocolInfo, LPINT lpErrno, APIHook< int > &hook)
virtual bool | WSPEnumNetworkEvents (SOCKET s, WSAEVENT hEventObject, LPWSANETWORKEVENTS lpNetworkEvents, LPINT lpErrno, APIHook< int > &hook)
virtual bool | WSPEventSelect (SOCKET s, WSAEVENT hEventObject, long lNetworkEvents, LPINT lpErrno, APIHook< int > &hook)
virtual bool | WSPGetOverlappedResult (SOCKET s, LPWSAOVERLAPPED lpOverlapped, LPDWORD lpcbTransfer, BOOL fWait, LPDWORD lpdwFlags, LPINT lpErrno, APIHook< BOOL > &hook)
virtual bool | WSPGetPeerName (SOCKET s, struct sockaddr FAR *name, LPINT namelen, LPINT lpErrno, APIHook< int > &hook)
virtual bool | WSPGetQOSByName (SOCKET s, LPWSABUF lpQOSName, LPQOS lpQOS, LPINT lpErrno, APIHook< BOOL > &hook)
virtual bool | WSPGetSockName (SOCKET s, struct sockaddr FAR *name, LPINT namelen, LPINT lpErrno, APIHook< int > &hook)
virtual bool | WSPGetSockOpt (SOCKET s, int level, int optname, char FAR *optval, LPINT optlen, LPINT lpErrno, APIHook< int > &hook)
virtual bool | WSPIoctl (SOCKET s, DWORD dwIoControlCode, LPVOID lpvInBuffer, DWORD cbInBuffer, LPVOID lpvOutBuffer, DWORD cbOutBuffer, LPDWORD lpcbBytesReturned, LPWSAOVERLAPPED lpOverlapped, LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine, LPWSATHREADID lpThreadId, LPINT lpErrno, APIHook< int > &hook)
virtual bool | WSPJoinLeaf (SOCKET s, const struct sockaddr FAR *name, int namelen, LPWSABUF lpCallerData, LPWSABUF lpCalleeData, LPQOS lpSQOS, LPQOS lpGQOS, DWORD dwFlags, LPINT lpErrno, APIHook< SOCKET > &hook)
virtual bool | WSPListen (SOCKET s, int backlog, LPINT lpErrno, APIHook< int > &hook)
virtual bool | WSPRecv (SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount, LPDWORD lpNumberOfBytesRecvd, LPDWORD lpFlags, LPWSAOVERLAPPED lpOverlapped, LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine, LPWSATHREADID lpThreadId, LPINT lpErrno, APIHook< int > &hook)
virtual bool | WSPRecvDisconnect (SOCKET s, LPWSABUF lpInboundDisconnectData, LPINT lpErrno, APIHook< int > &hook)
virtual bool | WSPRecvFrom (SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount, LPDWORD lpNumberOfBytesRecvd, LPDWORD lpFlags, struct sockaddr FAR *lpFrom, LPINT lpFromlen, LPWSAOVERLAPPED lpOverlapped, LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine, LPWSATHREADID lpThreadId, LPINT lpErrno, APIHook< int > &hook)
virtual bool | WSPSelect (int nfds, fd_set FAR *readfds, fd_set FAR *writefds, fd_set FAR *exceptfds, const struct timeval FAR *timeout, LPINT lpErrno, APIHook< int > &hook)
virtual bool | WSPSend (SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount, LPDWORD lpNumberOfBytesSent, DWORD dwFlags, LPWSAOVERLAPPED lpOverlapped, LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine, LPWSATHREADID lpThreadId, LPINT lpErrno, APIHook< int > &hook)
virtual bool | WSPSendDisconnect (SOCKET s, LPWSABUF lpOutboundDisconnectData, LPINT lpErrno, APIHook< int > &hook)
virtual bool | WSPSendTo (SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount, LPDWORD lpNumberOfBytesSent, DWORD dwFlags, const struct sockaddr FAR *lpTo, int iTolen, LPWSAOVERLAPPED lpOverlapped, LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine, LPWSATHREADID lpThreadId, LPINT lpErrno, APIHook< int > &hook)
virtual bool | WSPSetSockOpt (SOCKET s, int level, int optname, const char FAR *optval, int optlen, LPINT lpErrno, APIHook< int > &hook)
virtual bool | WSPShutdown (SOCKET s, int how, LPINT lpErrno, APIHook< int > &hook)
virtual bool | WSPSocket (int af, int type, int protocol, LPWSAPROTOCOL_INFOW lpProtocolInfo, GROUP g, DWORD dwFlags, LPINT lpErrno, APIHook< SOCKET > &hook)
virtual bool | WSPStartup (WORD wVersionRequested, LPWSPDATA lpWSPData, LPWSAPROTOCOL_INFOW lpProtocolInfo, WSPUPCALLTABLE UpcallTable, LPWSPPROC_TABLE lpProcTable, APIHook< int > &hook)
virtual bool | WSPStringToAddress (LPWSTR AddressString, INT AddressFamily, LPWSAPROTOCOL_INFOW lpProtocolInfo, LPSOCKADDR lpAddress, LPINT lpAddressLength, LPINT lpErrno, APIHook< int > &hook)

Static Private Member Functions

static bool | ___WSAFDIsSet (DTHandler *, APIHook< void > &, va_list)
static bool | _accept (DTHandler *, APIHook< void > &, va_list)
static bool | _bind (DTHandler *, APIHook< void > &, va_list)
static bool | _closesocket (DTHandler *, APIHook< void > &, va_list)
static bool | _connect (DTHandler *, APIHook< void > &, va_list)
static bool | _gethostbyaddr (DTHandler *, APIHook< void > &, va_list)
static bool | _gethostbyname (DTHandler *, APIHook< void > &, va_list)
static bool | _gethostname (DTHandler *, APIHook< void > &, va_list)
static bool | _getpeername (DTHandler *, APIHook< void > &, va_list)
static bool | _getprotobyname (DTHandler *, APIHook< void > &, va_list)
static bool | _getprotobynumber (DTHandler *, APIHook< void > &, va_list)
static bool | _getservbyname (DTHandler *, APIHook< void > &, va_list)
static bool | _getservbyport (DTHandler *, APIHook< void > &, va_list)
static bool | _getsockname (DTHandler *, APIHook< void > &, va_list)
static bool | _getsockopt (DTHandler *, APIHook< void > &, va_list)
static bool | _htonl (DTHandler *, APIHook< void > &, va_list)
static bool | _htons (DTHandler *, APIHook< void > &, va_list)
static bool | _inet_addr (DTHandler *, APIHook< void > &, va_list)
static bool | _inet_ntoa (DTHandler *, APIHook< void > &, va_list)
static bool | _ioctlsocket (DTHandler *, APIHook< void > &, va_list)
static bool | _listen (DTHandler *, APIHook< void > &, va_list)
static bool | _NSPAddressToString (DTHandler *, APIHook< void > &, va_list)
static bool | _NSPCleanup (DTHandler *, APIHook< void > &, va_list)
static bool | _NSPGetAddressByName (DTHandler *, APIHook< void > &, va_list)
static bool | _NSPGetServiceClassInfo (DTHandler *, APIHook< void > &, va_list)
static bool | _NSPGetServiceClassNameByClassId (DTHandler *, APIHook< void > &, va_list)
static bool | _NSPInstallServiceClass (DTHandler *, APIHook< void > &, va_list)
static bool | _NSPLookupServiceBegin (DTHandler *, APIHook< void > &, va_list)
static bool | _NSPLookupServiceEnd (DTHandler *, APIHook< void > &, va_list)
static bool | _NSPLookupServiceNext (DTHandler *, APIHook< void > &, va_list)
static bool | _NSPRemoveServiceClass (DTHandler *, APIHook< void > &, va_list)
static bool | _NSPSetService (DTHandler *, APIHook< void > &, va_list)
static bool | _NSPStringToAddress (DTHandler *, APIHook< void > &, va_list)
static bool | _ntohl (DTHandler *, APIHook< void > &, va_list)
static bool | _ntohs (DTHandler *, APIHook< void > &, va_list)
static bool | _recv (DTHandler *, APIHook< void > &, va_list)
static bool | _recvfrom (DTHandler *, APIHook< void > &, va_list)
static bool | _select (DTHandler *, APIHook< void > &, va_list)
static bool | _send (DTHandler *, APIHook< void > &, va_list)
static bool | _sendto (DTHandler *, APIHook< void > &, va_list)
static bool | _setsockopt (DTHandler *, APIHook< void > &, va_list)
static bool | _shutdown (DTHandler *, APIHook< void > &, va_list)
static bool | _socket (DTHandler *, APIHook< void > &, va_list)
static bool | _WPUCloseEvent (DTHandler *, APIHook< void > &, va_list)
static bool | _WPUCloseSocketHandle (DTHandler *, APIHook< void > &, va_list)
static bool | _WPUCreateEvent (DTHandler *, APIHook< void > &, va_list)
static bool | _WPUCreateSocketHandle (DTHandler *, APIHook< void > &, va_list)
static bool | _WPUFDIsSet (DTHandler *, APIHook< void > &, va_list)
static bool | _WPUGetProviderPath (DTHandler *, APIHook< void > &, va_list)
static bool | _WPUModifyIFSHandle (DTHandler *, APIHook< void > &, va_list)
static bool | _WPUPostMessage (DTHandler *, APIHook< void > &, va_list)
static bool | _WPUQueryBlockingCallback (DTHandler *, APIHook< void > &, va_list)
static bool | _WPUQuerySocketHandleContext (DTHandler *, APIHook< void > &, va_list)
static bool | _WPUQueueApc (DTHandler *, APIHook< void > &, va_list)
static bool | _WPUResetEvent (DTHandler *, APIHook< void > &, va_list)
static bool | _WPUSetEvent (DTHandler *, APIHook< void > &, va_list)
static bool | _WSAAccept (DTHandler *, APIHook< void > &, va_list)
static bool | _WSAAddressToStringA (DTHandler *, APIHook< void > &, va_list)
static bool | _WSAAddressToStringW (DTHandler *, APIHook< void > &, va_list)
static bool | _WSAAsyncGetHostByAddr (DTHandler *, APIHook< void > &, va_list)
static bool | _WSAAsyncGetHostByName (DTHandler *, APIHook< void > &, va_list)
static bool | _WSAAsyncGetProtoByName (DTHandler *, APIHook< void > &, va_list)
static bool | _WSAAsyncGetProtoByNumber (DTHandler *, APIHook< void > &, va_list)
static bool | _WSAAsyncGetServByName (DTHandler *, APIHook< void > &, va_list)
static bool | _WSAAsyncGetServByPort (DTHandler *, APIHook< void > &, va_list)
static bool | _WSAAsyncSelect (DTHandler *, APIHook< void > &, va_list)
static bool | _WSACancelAsyncRequest (DTHandler *, APIHook< void > &, va_list)
static bool | _WSACancelBlockingCall (DTHandler *, APIHook< void > &, va_list)
static bool | _WSACleanup (DTHandler *, APIHook< void > &, va_list)
static bool | _WSACloseEvent (DTHandler *, APIHook< void > &, va_list)
static bool | _WSAConnect (DTHandler *, APIHook< void > &, va_list)
static bool | _WSACreateEvent (DTHandler *, APIHook< void > &, va_list)
static bool | _WSADuplicateSocketA (DTHandler *, APIHook< void > &, va_list)
static bool | _WSADuplicateSocketW (DTHandler *, APIHook< void > &, va_list)
static bool | _WSAEnumNameSpaceProvidersA (DTHandler *, APIHook< void > &, va_list)
static bool | _WSAEnumNameSpaceProvidersW (DTHandler *, APIHook< void > &, va_list)
static bool | _WSAEnumNetworkEvents (DTHandler *, APIHook< void > &, va_list)
static bool | _WSAEnumProtocolsA (DTHandler *, APIHook< void > &, va_list)
static bool | _WSAEnumProtocolsW (DTHandler *, APIHook< void > &, va_list)
static bool | _WSAEventSelect (DTHandler *, APIHook< void > &, va_list)
static bool | _WSAGetLastError (DTHandler *, APIHook< void > &, va_list)
static bool | _WSAGetOverlappedResult (DTHandler *, APIHook< void > &, va_list)
static bool | _WSAGetQOSByName (DTHandler *, APIHook< void > &, va_list)
static bool | _WSAGetServiceClassInfoA (DTHandler *, APIHook< void > &, va_list)
static bool | _WSAGetServiceClassInfoW (DTHandler *, APIHook< void > &, va_list)
static bool | _WSAGetServiceClassNameByClassIdA (DTHandler *, APIHook< void > &, va_list)
static bool | _WSAGetServiceClassNameByClassIdW (DTHandler *, APIHook< void > &, va_list)
static bool | _WSAHtonl (DTHandler *, APIHook< void > &, va_list)
static bool | _WSAHtons (DTHandler *, APIHook< void > &, va_list)
static bool | _WSAInstallServiceClassA (DTHandler *, APIHook< void > &, va_list)
static bool | _WSAInstallServiceClassW (DTHandler *, APIHook< void > &, va_list)
static bool | _WSAIoctl (DTHandler *, APIHook< void > &, va_list)
static bool | _WSAIsBlocking (DTHandler *, APIHook< void > &, va_list)
static bool | _WSAJoinLeaf (DTHandler *, APIHook< void > &, va_list)
static bool | _WSALookupServiceBeginA (DTHandler *, APIHook< void > &, va_list)
static bool | _WSALookupServiceBeginW (DTHandler *, APIHook< void > &, va_list)
static bool | _WSALookupServiceEnd (DTHandler *, APIHook< void > &, va_list)
static bool | _WSALookupServiceNextA (DTHandler *, APIHook< void > &, va_list)
static bool | _WSALookupServiceNextW (DTHandler *, APIHook< void > &, va_list)
static bool | _WSANtohl (DTHandler *, APIHook< void > &, va_list)
static bool | _WSANtohs (DTHandler *, APIHook< void > &, va_list)
static bool | _WSARecv (DTHandler *, APIHook< void > &, va_list)
static bool | _WSARecvDisconnect (DTHandler *, APIHook< void > &, va_list)
static bool | _WSARecvFrom (DTHandler *, APIHook< void > &, va_list)
static bool | _WSARemoveServiceClass (DTHandler *, APIHook< void > &, va_list)
static bool | _WSAResetEvent (DTHandler *, APIHook< void > &, va_list)
static bool | _WSASend (DTHandler *, APIHook< void > &, va_list)
static bool | _WSASendDisconnect (DTHandler *, APIHook< void > &, va_list)
static bool | _WSASendTo (DTHandler *, APIHook< void > &, va_list)
static bool | _WSASetBlockingHook (DTHandler *, APIHook< void > &, va_list)
static bool | _WSASetEvent (DTHandler *, APIHook< void > &, va_list)
static bool | _WSASetLastError (DTHandler *, APIHook< void > &, va_list)
static bool | _WSASetServiceA (DTHandler *, APIHook< void > &, va_list)
static bool | _WSASetServiceW (DTHandler *, APIHook< void > &, va_list)
static bool | _WSASocketA (DTHandler *, APIHook< void > &, va_list)
static bool | _WSASocketW (DTHandler *, APIHook< void > &, va_list)
static bool | _WSAStartup (DTHandler *, APIHook< void > &, va_list)
static bool | _WSAStringToAddressA (DTHandler *, APIHook< void > &, va_list)
static bool | _WSAStringToAddressW (DTHandler *, APIHook< void > &, va_list)
static bool | _WSAUnhookBlockingHook (DTHandler *, APIHook< void > &, va_list)
static bool | _WSAWaitForMultipleEvents (DTHandler *, APIHook< void > &, va_list)
static bool | _WSCDeinstallProvider (DTHandler *, APIHook< void > &, va_list)
static bool | _WSCEnableNSProvider (DTHandler *, APIHook< void > &, va_list)
static bool | _WSCEnumProtocols (DTHandler *, APIHook< void > &, va_list)
static bool | _WSCGetProviderPath (DTHandler *, APIHook< void > &, va_list)
static bool | _WSCInstallNameSpace (DTHandler *, APIHook< void > &, va_list)
static bool | _WSCInstallProvider (DTHandler *, APIHook< void > &, va_list)
static bool | _WSCUnInstallNameSpace (DTHandler *, APIHook< void > &, va_list)
static bool | _WSPAccept (DTHandler *, APIHook< void > &, va_list)
static bool | _WSPAddressToString (DTHandler *, APIHook< void > &, va_list)
static bool | _WSPAsyncSelect (DTHandler *, APIHook< void > &, va_list)
static bool | _WSPBind (DTHandler *, APIHook< void > &, va_list)
static bool | _WSPCancelBlockingCall (DTHandler *, APIHook< void > &, va_list)
static bool | _WSPCleanup (DTHandler *, APIHook< void > &, va_list)
static bool | _WSPCloseSocket (DTHandler *, APIHook< void > &, va_list)
static bool | _WSPConnect (DTHandler *, APIHook< void > &, va_list)
static bool | _WSPDuplicateSocket (DTHandler *, APIHook< void > &, va_list)
static bool | _WSPEnumNetworkEvents (DTHandler *, APIHook< void > &, va_list)
static bool | _WSPEventSelect (DTHandler *, APIHook< void > &, va_list)
static bool | _WSPGetOverlappedResult (DTHandler *, APIHook< void > &, va_list)
static bool | _WSPGetPeerName (DTHandler *, APIHook< void > &, va_list)
static bool | _WSPGetQOSByName (DTHandler *, APIHook< void > &, va_list)
static bool | _WSPGetSockName (DTHandler *, APIHook< void > &, va_list)
static bool | _WSPGetSockOpt (DTHandler *, APIHook< void > &, va_list)
static bool | _WSPIoctl (DTHandler *, APIHook< void > &, va_list)
static bool | _WSPJoinLeaf (DTHandler *, APIHook< void > &, va_list)
static bool | _WSPListen (DTHandler *, APIHook< void > &, va_list)
static bool | _WSPRecv (DTHandler *, APIHook< void > &, va_list)
static bool | _WSPRecvDisconnect (DTHandler *, APIHook< void > &, va_list)
static bool | _WSPRecvFrom (DTHandler *, APIHook< void > &, va_list)
static bool | _WSPSelect (DTHandler *, APIHook< void > &, va_list)
static bool | _WSPSend (DTHandler *, APIHook< void > &, va_list)
static bool | _WSPSendDisconnect (DTHandler *, APIHook< void > &, va_list)
static bool | _WSPSendTo (DTHandler *, APIHook< void > &, va_list)
static bool | _WSPSetSockOpt (DTHandler *, APIHook< void > &, va_list)
static bool | _WSPShutdown (DTHandler *, APIHook< void > &, va_list)
static bool | _WSPSocket (DTHandler *, APIHook< void > &, va_list)
static bool | _WSPStartup (DTHandler *, APIHook< void > &, va_list)
static bool | _WSPStringToAddress (DTHandler *, APIHook< void > &, va_list)

Static Private Attributes

static bool(* | _dispatchTable [MAX_DTCODE+1])(DTHandler *, APIHook< void > &, va_list)

Detailed Description

Definition at line 34 of file DtHandler.Hpp.

Member Function Documentation

bool DTHandler::___WSAFDIsSet | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 2851 of file DtHandler.Cpp.

                                                                               {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    FD_SET *set = (FD_SET *)*va_arg(vList, FD_SET **);

    return (handler->WPUFDIsSet(s, set, (APIHook<int> &)hook));

} // DTHandler::___WSAFDIsSet()

virtual bool DTHandler::__WSAFDIsSet | ( | SOCKET | s,
 |  | FD_SET FAR * | set,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]
bool DTHandler::_accept | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 249 of file DtHandler.Cpp.

                                                                         {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    struct sockaddr *addr = (struct sockaddr *)*va_arg(vList, struct sockaddr **);
    int *addrlen = (int *)*va_arg(vList, int **);

    return (handler->accept(s, addr, addrlen, (APIHook<SOCKET> &)hook));

} // DTHandler::_accept()

bool DTHandler::_bind | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 269 of file DtHandler.Cpp.

                                                                       {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    const struct sockaddr *name = (const struct sockaddr *)*va_arg(vList, const struct sockaddr **);
    int namelen = (int)*va_arg(vList, int *);

    return (handler->bind(s, name, namelen, (APIHook<int> &)hook));

} // DTHandler::_bind()

bool DTHandler::_closesocket | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 289 of file DtHandler.Cpp.

                                                                              {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);

    return (handler->closesocket(s, (APIHook<int> &)hook));

} // DTHandler::_closesocket()

bool DTHandler::_connect | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 307 of file DtHandler.Cpp.

                                                                          {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    const struct sockaddr *name = (const struct sockaddr *)*va_arg(vList, const struct sockaddr **);
    int namelen = (int)*va_arg(vList, int *);

    return (handler->connect(s, name, namelen, (APIHook<int> &)hook));

} // DTHandler::_connect()

bool DTHandler::_gethostbyaddr | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1485 of file DtHandler.Cpp.

                                                                                {

    const char *addr = (const char *)*va_arg(vList, const char **);
    int len = (int)*va_arg(vList, int *);
    int type = (int)*va_arg(vList, int *);

    return (handler->gethostbyaddr(addr, len, type, (APIHook<HOSTENT> &)hook));

} // DTHandler::_gethostbyaddr()

bool DTHandler::_gethostbyname | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1505 of file DtHandler.Cpp.

                                                                                {

    const char *name = (const char *)*va_arg(vList, const char **);

    return (handler->gethostbyname(name, (APIHook<HOSTENT> &)hook));

} // DTHandler::_gethostbyname()

bool DTHandler::_gethostname | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1523 of file DtHandler.Cpp.

                                                                              {

    char *name = (char *)*va_arg(vList, char **);
    int namelen = (int)*va_arg(vList, int *);

    return (handler->gethostname(name, namelen, (APIHook<int> &)hook));

} // DTHandler::_gethostname()

bool DTHandler::_getpeername | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 327 of file DtHandler.Cpp.

                                                                              {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    struct sockaddr *name = (struct sockaddr *)*va_arg(vList, struct sockaddr **);
    int *namelen = (int *)*va_arg(vList, int **);

    return (handler->getpeername(s, name, namelen, (APIHook<int> &)hook));

} // DTHandler::_getpeername()

bool DTHandler::_getprotobyname | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1542 of file DtHandler.Cpp.

                                                                                {

    const char *name = (const char *)*va_arg(vList, const char **);

    return (handler->getprotobyname(name, (APIHook<PROTOENT> &)hook));

} // DTHandler::_getprotobyname()

bool DTHandler::_getprotobynumber | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1560 of file DtHandler.Cpp.

                                                                                {

    int number = (int)*va_arg(vList, int *);

    return (handler->getprotobynumber(number, (APIHook<PROTOENT> &)hook));

} // DTHandler::_getprotobynumber()

bool DTHandler::_getservbyname | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1578 of file DtHandler.Cpp.

                                                                                {

    const char *name = (const char *)*va_arg(vList, const char **);
    const char *proto = (const char *)*va_arg(vList, const char **);

    return (handler->getservbyname(name, proto, (APIHook<SERVENT> &)hook));

} // DTHandler::_getservbyname()

bool DTHandler::_getservbyport | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1597 of file DtHandler.Cpp.

                                                                                {

    int port = (int)*va_arg(vList, int *);
    const char *proto = (const char *)*va_arg(vList, const char **);

    return (handler->getservbyport(port, proto, (APIHook<SERVENT> &)hook));

} // DTHandler::_getservbyport()

bool DTHandler::_getsockname | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 347 of file DtHandler.Cpp.

                                                                              {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    struct sockaddr *name = (struct sockaddr *)*va_arg(vList, struct sockaddr **);
    int *namelen = (int *)*va_arg(vList, int **);

    return (handler->getsockname(s, name, namelen, (APIHook<int> &)hook));

} // DTHandler::_getsockname()

bool DTHandler::_getsockopt | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 367 of file DtHandler.Cpp.

                                                                             {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    int level = (int)*va_arg(vList, int *);
    int optname = (int)*va_arg(vList, int *);
    char *optval = (char *)*va_arg(vList, char **);
    int *optlen = (int *)*va_arg(vList, int **);

    return (handler->getsockopt(s, level, optname, optval, optlen, (APIHook<int> &)hook));

} // DTHandler::_getsockopt()

bool DTHandler::_htonl | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 389 of file DtHandler.Cpp.

                                                                        {

    DWORD hostlong = (DWORD)*va_arg(vList, DWORD *);

    return (handler->htonl(hostlong, (APIHook<DWORD> &)hook));

} // DTHandler::_htonl()

bool DTHandler::_htons | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 407 of file DtHandler.Cpp.

                                                                        {

    unsigned short hostshort = (unsigned short)*va_arg(vList, unsigned short *);

    return (handler->htons(hostshort, (APIHook<unsigned short> &)hook));

} // DTHandler::_htons()

bool DTHandler::_inet_addr | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1616 of file DtHandler.Cpp.

                                                                            {

    const char *cp = (const char *)*va_arg(vList, const char **);

    return (handler->inet_addr(cp, (APIHook<unsigned long> &)hook));

} // DTHandler::_inet_addr()

bool DTHandler::_inet_ntoa | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1634 of file DtHandler.Cpp.

                                                                            {

    struct in_addr in = (struct in_addr)*va_arg(vList, struct in_addr *);

    return (handler->inet_ntoa(in, (APIHook<char *> &)hook));

} // DTHandler::_inet_ntoa()

bool DTHandler::_ioctlsocket | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 425 of file DtHandler.Cpp.

                                                                              {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    long cmd = (long)*va_arg(vList, long *);
    unsigned long *argp = (unsigned long *)*va_arg(vList, unsigned long **);

    return (handler->ioctlsocket(s, cmd, argp, (APIHook<int> &)hook));

} // DTHandler::_ioctlsocket()

bool DTHandler::_listen | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 445 of file DtHandler.Cpp.

                                                                         {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    int backlog = (int)*va_arg(vList, int *);

    return (handler->listen(s, backlog, (APIHook<int> &)hook));

} // DTHandler::_listen()

bool DTHandler::_NSPAddressToString | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 3331 of file DtHandler.Cpp.

                                                                                {

    LPSOCKADDR lpsaAddress = (LPSOCKADDR)*va_arg(vList, LPSOCKADDR *);
    DWORD dwAddressLength = (DWORD)*va_arg(vList, DWORD *);
    LPWSAPROTOCOL_INFOW lpProtocolInfo = (LPWSAPROTOCOL_INFOW)*va_arg(vList, LPWSAPROTOCOL_INFOW *);
    LPWSTR lpszAddressString = (LPWSTR)*va_arg(vList, LPWSTR *);
    LPDWORD lpdwAddressStringLength = (LPDWORD)*va_arg(vList, LPDWORD *);

    return (handler->NSPAddressToString(lpsaAddress, dwAddressLength, lpProtocolInfo,
                                        lpszAddressString, lpdwAddressStringLength, (APIHook<int> &)hook));

} // DTHandler::_NSPAddressToString()

static bool DTHandler::_NSPCleanup | ( | DTHandler * | ,
 |  | APIHook< void > & | ,
 |  | va_list |  |
 | ) |  |  | [static, private]
bool DTHandler::_NSPGetAddressByName | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 3450 of file DtHandler.Cpp.

                                                                                {

    LPWSTR lpszServiceInstanceName = (LPWSTR)*va_arg(vList, LPWSTR *);
    LPGUID lpServiceClassId = (LPGUID)*va_arg(vList, LPGUID *);
    DWORD dwNameSpace = (DWORD)*va_arg(vList, DWORD *);
    LPDWORD lpdwBufferLength = (LPDWORD)*va_arg(vList, LPDWORD *);
    LPWSAQUERYSETW lpqsResults = (LPWSAQUERYSETW)*va_arg(vList, LPWSAQUERYSETW *);
    DWORD dwResolution = (DWORD)*va_arg(vList, DWORD *);
    LPWSTR lpszAliasBuffer = (LPWSTR)*va_arg(vList, LPWSTR *);
    LPDWORD lpdwAliasBufferLength = (LPDWORD)*va_arg(vList, LPDWORD *);

    return (handler->NSPGetAddressByName(lpszServiceInstanceName, lpServiceClassId, dwNameSpace,
                                         lpdwBufferLength, lpqsResults, dwResolution,
                                         lpszAliasBuffer, lpdwAliasBufferLength, (APIHook<int> &)hook));

} // DTHandler::_NSPGetAddressByName()

bool DTHandler::_NSPGetServiceClassInfo | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 3544 of file DtHandler.Cpp.

                                                                                {

    LPGUID lpProviderId = (LPGUID)*va_arg(vList, LPGUID *);
    LPDWORD lpdwBufSize = (LPDWORD)*va_arg(vList, LPDWORD *);
    LPWSASERVICECLASSINFOW lpServiceClassInfo = (LPWSASERVICECLASSINFOW)*va_arg(vList, LPWSASERVICECLASSINFOW *);

    return (handler->NSPGetServiceClassInfo(lpProviderId, lpdwBufSize, lpServiceClassInfo, (APIHook<int> &)hook));

} // DTHandler::_NSPGetServiceClassInfo()

bool DTHandler::_NSPGetServiceClassNameByClassId | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 3565 of file DtHandler.Cpp.

                                                                                {

    LPGUID lpServiceClassId = (LPGUID)*va_arg(vList, LPGUID *);
    LPWSTR lpszServiceClassName = (LPWSTR)*va_arg(vList, LPWSTR *);
    LPDWORD lpdwBufferLength = (LPDWORD)*va_arg(vList, LPDWORD *);

    return (handler->NSPGetServiceClassNameByClassId(lpServiceClassId, lpszServiceClassName,
                                                     lpdwBufferLength, (APIHook<int> &)hook));

} // DTHandler::_NSPGetServiceClassNameByClassId()

bool DTHandler::_NSPInstallServiceClass | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 3478 of file DtHandler.Cpp.

                                                                                {

    LPGUID lpProviderId = (LPGUID)*va_arg(vList, LPGUID *);
    LPWSASERVICECLASSINFOW lpServiceClassInfo = (LPWSASERVICECLASSINFOW)*va_arg(vList, LPWSASERVICECLASSINFOW *);

    return (handler->NSPInstallServiceClass(lpProviderId, lpServiceClassInfo, (APIHook<int> &)hook));

} // DTHandler::_NSPInstallServiceClass()

bool DTHandler::_NSPLookupServiceBegin | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 3382 of file DtHandler.Cpp.

                                                                                {

    LPGUID lpProviderId = (LPGUID)*va_arg(vList, LPGUID *);
    LPWSAQUERYSETW lpqsRestrictions = (LPWSAQUERYSETW)*va_arg(vList, LPWSAQUERYSETW *);
    LPWSASERVICECLASSINFOW lpServiceClassInfo = (LPWSASERVICECLASSINFOW)*va_arg(vList, LPWSASERVICECLASSINFOW *);
    DWORD dwControlFlags = (DWORD)*va_arg(vList, DWORD *);
    LPHANDLE lphLookup = (LPHANDLE)*va_arg(vList, LPHANDLE *);

    return (handler->NSPLookupServiceBegin(lpProviderId, lpqsRestrictions, lpServiceClassInfo,
                                           dwControlFlags, lphLookup, (APIHook<int> &)hook));

} // DTHandler::_NSPLookupServiceBegin()

bool DTHandler::_NSPLookupServiceEnd | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 3428 of file DtHandler.Cpp.

                                                                                {

    HANDLE hLookup = (HANDLE)*va_arg(vList, HANDLE *);

    return (handler->NSPLookupServiceEnd(hLookup, (APIHook<int> &)hook));

} // DTHandler::_NSPLookupServiceEnd()

bool DTHandler::_NSPLookupServiceNext | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 3406 of file DtHandler.Cpp.

                                                                                {

    HANDLE hLookup = (HANDLE)*va_arg(vList, HANDLE *);
    DWORD dwControlFlags = (DWORD)*va_arg(vList, DWORD *);
    LPDWORD lpdwBufferLength = (LPDWORD)*va_arg(vList, LPDWORD *);
    LPWSAQUERYSET lpqsResults = (LPWSAQUERYSET)*va_arg(vList, LPWSAQUERYSET *);

    return (handler->NSPLookupServiceNext(hLookup, dwControlFlags, lpdwBufferLength,
                                          lpqsResults, (APIHook<int> &)hook));

} // DTHandler::_NSPLookupServiceNext()

bool DTHandler::_NSPRemoveServiceClass | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 3523 of file DtHandler.Cpp.

                                                                                {

    LPGUID lpProviderId = (LPGUID)*va_arg(vList, LPGUID *);
    LPGUID lpServiceClassId = (LPGUID)*va_arg(vList, LPGUID *);

    return (handler->NSPRemoveServiceClass(lpProviderId, lpServiceClassId, (APIHook<int> &)hook));

} // DTHandler::_NSPRemoveServiceClass()

bool DTHandler::_NSPSetService | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 3499 of file DtHandler.Cpp.

                                                                                {

    LPGUID lpProviderId = (LPGUID)*va_arg(vList, LPGUID *);
    LPWSASERVICECLASSINFOW lpServiceClassInfo = (LPWSASERVICECLASSINFOW)*va_arg(vList, LPWSASERVICECLASSINFOW *);
    LPWSAQUERYSETW lpqsRegInfo = (LPWSAQUERYSETW)*va_arg(vList, LPWSAQUERYSETW *);
    WSAESETSERVICEOP essOperation = (WSAESETSERVICEOP)*va_arg(vList, WSAESETSERVICEOP *);
    DWORD dwControlFlags = (DWORD)*va_arg(vList, DWORD *);

    return (handler->NSPSetService(lpProviderId, lpServiceClassInfo, lpqsRegInfo, essOperation,
                                   dwControlFlags, (APIHook<int> &)hook));

} // DTHandler::_NSPSetService()

bool DTHandler::_NSPStringToAddress | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 3356 of file DtHandler.Cpp.

                                                                                {

    LPWSTR AddressString = (LPWSTR)*va_arg(vList, LPWSTR *);
    INT AddressFamily = (INT)*va_arg(vList, INT *);
    LPWSAPROTOCOL_INFOW lpProtocolInfo = (LPWSAPROTOCOL_INFOW)*va_arg(vList, LPWSAPROTOCOL_INFOW *);
    LPSOCKADDR lpAddress = (LPSOCKADDR)*va_arg(vList, LPSOCKADDR *);
    LPINT lpAddressLength = (LPINT)*va_arg(vList, LPINT *);

    return (handler->NSPStringToAddress(AddressString, AddressFamily, lpProtocolInfo,
                                        lpAddress, lpAddressLength, (APIHook<int> &)hook));

} // DTHandler::_NSPStringToAddress()

bool DTHandler::_ntohl | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 464 of file DtHandler.Cpp.

                                                                        {

    unsigned long netlong = (unsigned long)*va_arg(vList, unsigned long *);

    return (handler->ntohl(netlong, (APIHook<DWORD> &)hook));

} // DTHandler::_ntohl()

bool DTHandler::_ntohs | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 482 of file DtHandler.Cpp.

                                                                        {

    unsigned short netshort = (unsigned short)*va_arg(vList, unsigned short *);

    return (handler->ntohs(netshort, (APIHook<WORD> &)hook));

} // DTHandler::_ntohs()

bool DTHandler::_recv | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 500 of file DtHandler.Cpp.

                                                                       {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    char *buf = (char *)*va_arg(vList, char **);
    int len = (int)*va_arg(vList, int *);
    int flags = (int)*va_arg(vList, int *);

    return (handler->recv(s, buf, len, flags, (APIHook<int> &)hook));

} // DTHandler::_recv()

bool DTHandler::_recvfrom | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 521 of file DtHandler.Cpp.

                                                                           {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    char *buf = (char *)*va_arg(vList, char **);
    int len = (int)*va_arg(vList, int *);
    int flags = (int)*va_arg(vList, int *);
    struct sockaddr *from = (struct sockaddr *)*va_arg(vList, struct sockaddr **);
    int *fromlen = (int *)*va_arg(vList, int **);

    return (handler->recvfrom(s, buf, len, flags, from, fromlen, (APIHook<int> &)hook));

} // DTHandler::_recvfrom()

bool DTHandler::_select | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 545 of file DtHandler.Cpp.

                                                                         {

    int nfds = (int)*va_arg(vList, int *);
    fd_set *readfds = (fd_set *)*va_arg(vList, fd_set **);
    fd_set *writefds = (fd_set *)*va_arg(vList, fd_set **);
    fd_set *exceptfds = (fd_set *)*va_arg(vList, fd_set **);
    const struct timeval *timeout = (const struct timeval *)*va_arg(vList, const struct timeval **);

    return (handler->select(nfds, readfds, writefds, exceptfds, timeout, (APIHook<int> &)hook));

} // DTHandler::_select()

bool DTHandler::_send | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 567 of file DtHandler.Cpp.

                                                                       {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    const char *buf = (const char *)*va_arg(vList, const char **);
    int len = (int)*va_arg(vList, int *);
    int flags = (int)*va_arg(vList, int *);

    return (handler->send(s, buf, len, flags, (APIHook<int> &)hook));

} // DTHandler::_send()

bool DTHandler::_sendto | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 588 of file DtHandler.Cpp.

                                                                         {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    const char *buf = (const char *)*va_arg(vList, const char **);
    int len = (int)*va_arg(vList, int *);
    int flags = (int)*va_arg(vList, int *);
    const struct sockaddr *to = (const struct sockaddr *)*va_arg(vList, const struct sockaddr **);
    int tolen = (int)*va_arg(vList, int *);

    return (handler->sendto(s, buf, len, flags, to, tolen, (APIHook<int> &)hook));

} // DTHandler::_sendto()

bool DTHandler::_setsockopt | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 611 of file DtHandler.Cpp.

                                                                             {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    int level = (int)*va_arg(vList, int *);
    int optname = (int)*va_arg(vList, int *);
    const char *optval = (const char *)*va_arg(vList, const char **);
    int optlen = (int)*va_arg(vList, int *);

    return (handler->setsockopt(s, level, optname, optval, optlen, (APIHook<int> &)hook));

} // DTHandler::_setsockopt()

bool DTHandler::_shutdown | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 633 of file DtHandler.Cpp.

                                                                           {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    int how = (int)*va_arg(vList, int *);

    return (handler->shutdown(s, how, (APIHook<int> &)hook));

} // DTHandler::_shutdown()

bool DTHandler::_socket | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 652 of file DtHandler.Cpp.

                                                                         {

    int af = (int)*va_arg(vList, int *);
    int type = (int)*va_arg(vList, int *);
    int protocol = (int)*va_arg(vList, int *);

    return (handler->socket(af, type, protocol, (APIHook<SOCKET> &)hook));

} // DTHandler::_socket()

bool DTHandler::_WPUCloseEvent | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 2540 of file DtHandler.Cpp.

                                                                                {

    WSAEVENT hEvent = (WSAEVENT)*va_arg(vList, WSAEVENT *);
    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WPUCloseEvent(hEvent, lpErrno, (APIHook<BOOL> &)hook));

} // DTHandler::_WPUCloseEvent()

bool DTHandler::_WPUCloseSocketHandle | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 2559 of file DtHandler.Cpp.

                                                                                {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WPUCloseSocketHandle(s, lpErrno, (APIHook<int> &)hook));

} // DTHandler::_WPUCloseSocketHandle()

bool DTHandler::_WPUCreateEvent | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 2578 of file DtHandler.Cpp.

                                                                                {

    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WPUCreateEvent(lpErrno, (APIHook<WSAEVENT> &)hook));

} // DTHandler::_WPUCreateEvent()

bool DTHandler::_WPUCreateSocketHandle | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 2597 of file DtHandler.Cpp.

                                                                                {

    DWORD dwCatalogEntryId = (DWORD)*va_arg(vList, DWORD *);
    DWORD dwContext = (DWORD)*va_arg(vList, DWORD *);
    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WPUCreateSocketHandle(dwCatalogEntryId, dwContext, lpErrno, (APIHook<SOCKET> &)hook));

} // DTHandler::_WPUCreateSocketHandle()

bool DTHandler::_WPUFDIsSet | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 2787 of file DtHandler.Cpp.

                                                                             {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    FD_SET *set = (FD_SET *)*va_arg(vList, FD_SET **);

    return (handler->WPUFDIsSet(s, set, (APIHook<int> &)hook));

} // DTHandler::_WPUFDIsSet()

bool DTHandler::_WPUGetProviderPath | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 2808 of file DtHandler.Cpp.

                                                                                {

    LPGUID lpProviderId = (LPGUID)*va_arg(vList, LPGUID *);
    LPWSTR lpszProviderDllPath = (LPWSTR)*va_arg(vList, LPWSTR *);
    LPINT lpProviderDllPathLen = (LPINT)*va_arg(vList, LPINT *);
    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WPUGetProviderPath(lpProviderId, lpszProviderDllPath, lpProviderDllPathLen,
                                        lpErrno, (APIHook<int> &)hook));

} // DTHandler::_WPUGetProviderPath()

bool DTHandler::_WPUModifyIFSHandle | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 2662 of file DtHandler.Cpp.

                                                                                {

    DWORD dwCatalogEntryId = (DWORD)*va_arg(vList, DWORD *);
    SOCKET ProposedHandle = (SOCKET)*va_arg(vList, SOCKET *);
    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WPUModifyIFSHandle(dwCatalogEntryId, ProposedHandle, lpErrno, (APIHook<SOCKET> &)hook));

} // DTHandler::_WPUModifyIFSHandle()

bool DTHandler::_WPUPostMessage | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 2830 of file DtHandler.Cpp.

                                                                                {

    HWND hWnd = (HWND)*va_arg(vList, HWND *);
    UINT Msg = (UINT)*va_arg(vList, UINT *);
    WPARAM wParam = (WPARAM)*va_arg(vList, WPARAM *);
    LPARAM lParam = (LPARAM)*va_arg(vList, LPARAM *);

    return (handler->WPUPostMessage(hWnd, Msg, wParam, lParam, (APIHook<BOOL> &)hook));

} // DTHandler::_WPUPostMessage()

bool DTHandler::_WPUQueryBlockingCallback | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 2685 of file DtHandler.Cpp.

                                                                                {

    DWORD dwCatalogEntryId = (DWORD)*va_arg(vList, DWORD *);
    LPBLOCKINGCALLBACK *lplpfnCallback = (LPBLOCKINGCALLBACK *)*va_arg(vList, LPBLOCKINGCALLBACK **);
    LPDWORD lpdwContext = (LPDWORD)*va_arg(vList, LPDWORD *);
    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WPUQueryBlockingCallback(dwCatalogEntryId, lplpfnCallback, lpdwContext, lpErrno, (APIHook<int> &)hook));

} // DTHandler::_WPUQueryBlockingCallback()

bool DTHandler::_WPUQuerySocketHandleContext | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 2707 of file DtHandler.Cpp.

                                                                                {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    LPDWORD lpContext = (LPDWORD)*va_arg(vList, LPDWORD *);
    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WPUQuerySocketHandleContext(s, lpContext, lpErrno, (APIHook<int> &)hook));

} // DTHandler::_WPUQuerySocketHandleContext()

bool DTHandler::_WPUQueueApc | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 2728 of file DtHandler.Cpp.

                                                                              {

    LPWSATHREADID lpThreadId = (LPWSATHREADID)*va_arg(vList, LPWSATHREADID *);
    LPWSAUSERAPC lpfnUserApc = (LPWSAUSERAPC)*va_arg(vList, LPWSAUSERAPC *);
    DWORD dwContext = (DWORD)*va_arg(vList, DWORD *);
    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WPUQueueApc(lpThreadId, lpfnUserApc, dwContext, lpErrno, (APIHook<int> &)hook));

} // DTHandler::_WPUQueueApc()

bool DTHandler::_WPUResetEvent | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 2749 of file DtHandler.Cpp.

                                                                                {

    WSAEVENT hEvent = (WSAEVENT)*va_arg(vList, WSAEVENT *);
    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WPUResetEvent(hEvent, lpErrno, (APIHook<BOOL> &)hook));

} // DTHandler::_WPUResetEvent()

bool DTHandler::_WPUSetEvent | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 2768 of file DtHandler.Cpp.

                                                                              {

    WSAEVENT hEvent = (WSAEVENT)*va_arg(vList, WSAEVENT *);
    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WPUSetEvent(hEvent, lpErrno, (APIHook<BOOL> &)hook));

} // DTHandler::_WPUSetEvent()

bool DTHandler::_WSAAccept | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 673 of file DtHandler.Cpp.

                                                                            {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    struct sockaddr *addr = (struct sockaddr *)*va_arg(vList, struct sockaddr **);
    int *addrlen = (int *)*va_arg(vList, int **);
    LPCONDITIONPROC lpfnCondition = (LPCONDITIONPROC)*va_arg(vList, LPCONDITIONPROC *);
    unsigned long dwCallbackData = (unsigned long)*va_arg(vList, unsigned long *);

    return (handler->WSAAccept(s, addr, addrlen, lpfnCondition, dwCallbackData, (APIHook<SOCKET> &)hook));

} // DTHandler::_WSAAccept()

bool DTHandler::_WSAAddressToStringA | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 2895 of file DtHandler.Cpp.

                                                                                {

    LPSOCKADDR lpsaAddress = (LPSOCKADDR)*va_arg(vList, LPSOCKADDR *);
    DWORD dwAddressLength = (DWORD)*va_arg(vList, DWORD *);
    LPWSAPROTOCOL_INFOA lpProtocolInfo = (LPWSAPROTOCOL_INFOA)*va_arg(vList, LPWSAPROTOCOL_INFOA *);
    LPTSTR lpszAddressString = (LPTSTR)*va_arg(vList, LPTSTR *);
    LPDWORD lpdwAddressStringLength = (LPDWORD)*va_arg(vList, LPDWORD *);

    return (handler->WSAAddressToStringA(lpsaAddress, dwAddressLength, lpProtocolInfo,
                                         lpszAddressString, lpdwAddressStringLength, (APIHook<INT> &)hook));

} // DTHandler::_WSAAddressToStringA()

bool DTHandler::_WSAAddressToStringW | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 2920 of file DtHandler.Cpp.

                                                                                {

    LPSOCKADDR lpsaAddress = (LPSOCKADDR)*va_arg(vList, LPSOCKADDR *);
    DWORD dwAddressLength = (DWORD)*va_arg(vList, DWORD *);
    LPWSAPROTOCOL_INFOW lpProtocolInfo = (LPWSAPROTOCOL_INFOW)*va_arg(vList, LPWSAPROTOCOL_INFOW *);
    LPTSTR lpszAddressString = (LPTSTR)*va_arg(vList, LPTSTR *);
    LPDWORD lpdwAddressStringLength = (LPDWORD)*va_arg(vList, LPDWORD *);

    return (handler->WSAAddressToStringW(lpsaAddress, dwAddressLength, lpProtocolInfo,
                                         lpszAddressString, lpdwAddressStringLength, (APIHook<INT> &)hook));

} // DTHandler::_WSAAddressToStringW()

bool DTHandler::_WSAAsyncGetHostByAddr | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1654 of file DtHandler.Cpp.

                                                                                {

    HWND hWnd = (HWND)*va_arg(vList, HWND *);
    unsigned int wMsg = (unsigned int)*va_arg(vList, unsigned int *);
    const char *addr = (const char *)*va_arg(vList, const char **);
    int len = (int)*va_arg(vList, int *);
    int type = (int)*va_arg(vList, int *);
    char *buf = (char *)*va_arg(vList, char **);
    int buflen = (int)*va_arg(vList, int *);

    return (handler->WSAAsyncGetHostByAddr(hWnd, wMsg, addr, len, type, buf, buflen, (APIHook<HANDLE> &)hook));

} // DTHandler::_WSAAsyncGetHostByAddr()

bool DTHandler::_WSAAsyncGetHostByName | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1679 of file DtHandler.Cpp.

                                                                                {

    HWND hWnd = (HWND)*va_arg(vList, HWND *);
    unsigned int wMsg = (unsigned int)*va_arg(vList, unsigned int *);
    const char *name = (const char *)*va_arg(vList, const char **);
    char *buf = (char *)*va_arg(vList, char **);
    int buflen = (int)*va_arg(vList, int *);

    return (handler->WSAAsyncGetHostByName(hWnd, wMsg, name, buf, buflen, (APIHook<HANDLE> &)hook));

} // DTHandler::_WSAAsyncGetHostByName()

bool DTHandler::_WSAAsyncGetProtoByName | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1702 of file DtHandler.Cpp.

                                                                                {

    HWND hWnd = (HWND)*va_arg(vList, HWND *);
    unsigned int wMsg = (unsigned int)*va_arg(vList, unsigned int *);
    const char *name = (const char *)*va_arg(vList, const char **);
    char *buf = (char *)*va_arg(vList, char **);
    int buflen = (int)*va_arg(vList, int *);

    return (handler->WSAAsyncGetProtoByName(hWnd, wMsg, name, buf, buflen, (APIHook<HANDLE> &)hook));

} // DTHandler::_WSAAsyncGetProtoByName()

bool DTHandler::_WSAAsyncGetProtoByNumber | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1725 of file DtHandler.Cpp.

                                                                                {

    HWND hWnd = (HWND)*va_arg(vList, HWND *);
    unsigned int wMsg = (unsigned int)*va_arg(vList, unsigned int *);
    int number = (int)*va_arg(vList, int *);
    char *buf = (char *)*va_arg(vList, char **);
    int buflen = (int)*va_arg(vList, int *);

    return (handler->WSAAsyncGetProtoByNumber(hWnd, wMsg, number, buf, buflen, (APIHook<HANDLE> &)hook));

} // DTHandler::_WSAAsyncGetProtoByNumber()

bool DTHandler::_WSAAsyncGetServByName | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1749 of file DtHandler.Cpp.

                                                                                {

    HWND hWnd = (HWND)*va_arg(vList, HWND *);
    unsigned int wMsg = (unsigned int)*va_arg(vList, unsigned int *);
    const char *name = (const char *)*va_arg(vList, const char **);
    const char *proto = (const char *)*va_arg(vList, const char **);
    char *buf = (char *)*va_arg(vList, char **);
    int buflen = (int)*va_arg(vList, int *);

    return (handler->WSAAsyncGetServByName(hWnd, wMsg, name, proto, buf, buflen, (APIHook<HANDLE> &)hook));

} // DTHandler::_WSAAsyncGetServByName()

bool DTHandler::_WSAAsyncGetServByPort | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1774 of file DtHandler.Cpp.

                                                                                {

    HWND hWnd = (HWND)*va_arg(vList, HWND *);
    unsigned int wMsg = (unsigned int)*va_arg(vList, unsigned int *);
    int port = (int)*va_arg(vList, int *);
    char *proto = (char *)*va_arg(vList, char **);
    char *buf = (char *)*va_arg(vList, char **);
    int buflen = (int)*va_arg(vList, int *);

    return (handler->WSAAsyncGetServByPort(hWnd, wMsg, port, proto, buf, buflen, (APIHook<HANDLE> &)hook));

} // DTHandler::_WSAAsyncGetServByPort()

bool DTHandler::_WSAAsyncSelect | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 695 of file DtHandler.Cpp.

                                                                                {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    HWND hWnd = (HWND)*va_arg(vList, HWND *);
    unsigned int wMsg = (unsigned int)*va_arg(vList, unsigned int *);
    long lEvent = (long)*va_arg(vList, long *);

    return (handler->WSAAsyncSelect(s, hWnd, wMsg, lEvent, (APIHook<int> &)hook));

} // DTHandler::_WSAAsyncSelect()

bool DTHandler::_WSACancelAsyncRequest | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1797 of file DtHandler.Cpp.

                                                                                {

    HANDLE hAsyncTaskHandle = (HANDLE)*va_arg(vList, HANDLE *);

    return (handler->WSACancelAsyncRequest(hAsyncTaskHandle, (APIHook<int> &)hook));

} // DTHandler::_WSACancelAsyncRequest()

bool DTHandler::_WSACancelBlockingCall | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 716 of file DtHandler.Cpp.

                                                                                {

    return (handler->WSACancelBlockingCall((APIHook<int> &)hook));

} // DTHandler::_WSACancelBlockingCall()

bool DTHandler::_WSACleanup | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 732 of file DtHandler.Cpp.

                                                                             {

    return (handler->WSACleanup((APIHook<int> &)hook));

} // DTHandler::_WSACleanup()

bool DTHandler::_WSACloseEvent | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 748 of file DtHandler.Cpp.

                                                                                {

    WSAEVENT hEvent = (WSAEVENT)*va_arg(vList, WSAEVENT *);

    return (handler->WSACloseEvent(hEvent, (APIHook<int> &)hook));

} // DTHandler::_WSACloseEvent()

bool DTHandler::_WSAConnect | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 767 of file DtHandler.Cpp.

                                                                             {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    const struct sockaddr *name = (const struct sockaddr *)*va_arg(vList, const struct sockaddr **);
    int namelen = (int)*va_arg(vList, int *);
    LPWSABUF lpCallerData = (LPWSABUF)*va_arg(vList, LPWSABUF *);
    LPWSABUF lpCalleeData = (LPWSABUF)*va_arg(vList, LPWSABUF *);
    LPQOS lpSQOS = (LPQOS)*va_arg(vList, LPQOS *);
    LPQOS lpGQOS = (LPQOS)*va_arg(vList, LPQOS *);

    return (handler->WSAConnect(s, name, namelen, lpCallerData, lpCalleeData, lpSQOS, lpGQOS, (APIHook<int> &)hook));

} // DTHandler::_WSAConnect()

bool DTHandler::_WSACreateEvent | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 791 of file DtHandler.Cpp.

                                                                                {

    return (handler->WSACreateEvent((APIHook<WSAEVENT> &)hook));

} // DTHandler::_WSACreateEvent()

bool DTHandler::_WSADuplicateSocketA | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 807 of file DtHandler.Cpp.

                                                                                {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    DWORD dwProcessId = (DWORD)*va_arg(vList, DWORD *);
    LPWSAPROTOCOL_INFOA lpProtocolInfo = (LPWSAPROTOCOL_INFOA)*va_arg(vList, LPWSAPROTOCOL_INFOA *);

    return (handler->WSADuplicateSocketA(s, dwProcessId, lpProtocolInfo, (APIHook<int> &)hook));

} // DTHandler::_WSADuplicateSocketA()

bool DTHandler::_WSADuplicateSocketW | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 827 of file DtHandler.Cpp.

                                                                                {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    DWORD dwProcessId = (DWORD)*va_arg(vList, DWORD *);
    LPWSAPROTOCOL_INFOW lpProtocolInfo = (LPWSAPROTOCOL_INFOW)*va_arg(vList, LPWSAPROTOCOL_INFOA *);

    return (handler->WSADuplicateSocketW(s, dwProcessId, lpProtocolInfo, (APIHook<int> &)hook));

} // DTHandler::_WSADuplicateSocketW()

bool DTHandler::_WSAEnumNameSpaceProvidersA | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 3245 of file DtHandler.Cpp.

                                                                                {

    LPDWORD lpdwBufferLength = (LPDWORD)*va_arg(vList, LPDWORD *);
    LPWSANAMESPACE_INFOA lpnspBuffer = (LPWSANAMESPACE_INFOA)*va_arg(vList, LPWSANAMESPACE_INFOA *);

    return (handler->WSAEnumNameSpaceProvidersA(lpdwBufferLength, lpnspBuffer, (APIHook<INT> &)hook));

} // DTHandler::_WSAEnumNameSpaceProvidersA()

bool DTHandler::_WSAEnumNameSpaceProvidersW | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 3266 of file DtHandler.Cpp.

                                                                                {

    LPDWORD lpdwBufferLength = (LPDWORD)*va_arg(vList, LPDWORD *);
    LPWSANAMESPACE_INFOW lpnspBuffer = (LPWSANAMESPACE_INFOW)*va_arg(vList, LPWSANAMESPACE_INFOW *);

    return (handler->WSAEnumNameSpaceProvidersW(lpdwBufferLength, lpnspBuffer, (APIHook<INT> &)hook));

} // DTHandler::_WSAEnumNameSpaceProvidersW()

bool DTHandler::_WSAEnumNetworkEvents | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 847 of file DtHandler.Cpp.

                                                                                {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    WSAEVENT hEventObject = (WSAEVENT)*va_arg(vList, WSAEVENT *);
    LPWSANETWORKEVENTS lpNetworkEvents = (LPWSANETWORKEVENTS)*va_arg(vList, LPWSANETWORKEVENTS *);

    return (handler->WSAEnumNetworkEvents(s, hEventObject, lpNetworkEvents, (APIHook<int> &)hook));

} // DTHandler::_WSAEnumNetworkEvents()

bool DTHandler::_WSAEnumProtocolsA | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 868 of file DtHandler.Cpp.

                                                                                {

    LPINT lpiProtocols = (LPINT)*va_arg(vList, LPINT *);
    LPWSAPROTOCOL_INFOA lpProtocolBuffer = (LPWSAPROTOCOL_INFOA)*va_arg(vList, LPWSAPROTOCOL_INFOA *);
    LPDWORD lpdwBufferLength = (LPDWORD)*va_arg(vList, LPDWORD *);

    return (handler->WSAEnumProtocolsA(lpiProtocols, lpProtocolBuffer, lpdwBufferLength, (APIHook<int> &)hook));

} // DTHandler::_WSAEnumProtocolsA()

bool DTHandler::_WSAEnumProtocolsW | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 889 of file DtHandler.Cpp.

                                                                                {

    LPINT lpiProtocols = (LPINT)*va_arg(vList, LPINT *);
    LPWSAPROTOCOL_INFOW lpProtocolBuffer = (LPWSAPROTOCOL_INFOW)*va_arg(vList, LPWSAPROTOCOL_INFOA *);
    LPDWORD lpdwBufferLength = (LPDWORD)*va_arg(vList, LPDWORD *);

    return (handler->WSAEnumProtocolsW(lpiProtocols, lpProtocolBuffer, lpdwBufferLength, (APIHook<int> &)hook));

} // DTHandler::_WSAEnumProtocolsW()

bool DTHandler::_WSAEventSelect | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 909 of file DtHandler.Cpp.

                                                                                {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    WSAEVENT hEventObject = (WSAEVENT)*va_arg(vList, WSAEVENT *);
    long lNetworkEvents = (long)*va_arg(vList, long *);

    return (handler->WSAEventSelect(s, hEventObject, lNetworkEvents, (APIHook<int> &)hook));

} // DTHandler::_WSAEventSelect()

bool DTHandler::_WSAGetLastError | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 929 of file DtHandler.Cpp.

                                                                                {

    return (handler->WSAGetLastError((APIHook<int> &)hook));

} // DTHandler::_WSAGetLastError()

bool DTHandler::_WSAGetOverlappedResult | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 946 of file DtHandler.Cpp.

                                                                                {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    LPWSAOVERLAPPED lpOverlapped = (LPWSAOVERLAPPED)*va_arg(vList, LPWSAOVERLAPPED *);
    LPDWORD lpcbTransfer = (LPDWORD)*va_arg(vList, LPDWORD *);
    BOOL fWait = (BOOL)*va_arg(vList, BOOL *);
    LPDWORD lpdwFlags = (LPDWORD)*va_arg(vList, LPDWORD *);

    return (handler->WSAGetOverlappedResult(s, lpOverlapped, lpcbTransfer, fWait, lpdwFlags, (APIHook<int> &)hook));

} // DTHandler::_WSAGetOverlappedResult()

bool DTHandler::_WSAGetQOSByName | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 968 of file DtHandler.Cpp.

                                                                                {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    LPWSABUF lpQOSName = (LPWSABUF)*va_arg(vList, LPWSABUF *);
    LPQOS lpQOS = (LPQOS)*va_arg(vList, LPQOS *);

    return (handler->WSAGetQOSByName(s, lpQOSName, lpQOS, (APIHook<int> &)hook));

} // DTHandler::_WSAGetQOSByName()

bool DTHandler::_WSAGetServiceClassInfoA | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 3197 of file DtHandler.Cpp.

                                                                                {

    LPGUID lpProviderId = (LPGUID)*va_arg(vList, LPGUID *);
    LPGUID lpServiceClassId = (LPGUID)*va_arg(vList, LPGUID *);
    LPDWORD lpdwBufferLength = (LPDWORD)*va_arg(vList, LPDWORD *);
    LPWSASERVICECLASSINFOA lpServiceClassInfo = (LPWSASERVICECLASSINFOA)*va_arg(vList, LPWSASERVICECLASSINFOA *);

    return (handler->WSAGetServiceClassInfoA(lpProviderId, lpServiceClassId, lpdwBufferLength,
                                             lpServiceClassInfo, (APIHook<INT> &)hook));

} // DTHandler::_WSAGetServiceClassInfoA()

bool DTHandler::_WSAGetServiceClassInfoW | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 3221 of file DtHandler.Cpp.

                                                                                {

    LPGUID lpProviderId = (LPGUID)*va_arg(vList, LPGUID *);
    LPGUID lpServiceClassId = (LPGUID)*va_arg(vList, LPGUID *);
    LPDWORD lpdwBufferLength = (LPDWORD)*va_arg(vList, LPDWORD *);
    LPWSASERVICECLASSINFOW lpServiceClassInfo = (LPWSASERVICECLASSINFOW)*va_arg(vList, LPWSASERVICECLASSINFOW *);

    return (handler->WSAGetServiceClassInfoW(lpProviderId, lpServiceClassId, lpdwBufferLength,
                                             lpServiceClassInfo, (APIHook<INT> &)hook));

} // DTHandler::_WSAGetServiceClassInfoW()

bool DTHandler::_WSAGetServiceClassNameByClassIdA | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 3286 of file DtHandler.Cpp.

                                                                                {

    LPGUID lpServiceClassId = (LPGUID)*va_arg(vList, LPGUID *);
    LPSTR lpszServiceClassName = (LPSTR)*va_arg(vList, LPSTR *);
    LPDWORD lpdwBufferLength = (LPDWORD)*va_arg(vList, LPDWORD *);

    return (handler->WSAGetServiceClassNameByClassIdA(lpServiceClassId, lpszServiceClassName,
                                                      lpdwBufferLength, (APIHook<int> &)hook));

} // DTHandler::_WSAGetServiceClassNameByClassIdA()

bool DTHandler::_WSAGetServiceClassNameByClassIdW | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 3308 of file DtHandler.Cpp.

                                                                                {

    LPGUID lpServiceClassId = (LPGUID)*va_arg(vList, LPGUID *);
    LPWSTR lpszServiceClassName = (LPWSTR)*va_arg(vList, LPWSTR *);
    LPDWORD lpdwBufferLength = (LPDWORD)*va_arg(vList, LPDWORD *);

    return (handler->WSAGetServiceClassNameByClassIdW(lpServiceClassId, lpszServiceClassName,
                                                      lpdwBufferLength, (APIHook<int> &)hook));

} // DTHandler::_WSAGetServiceClassNameByClassIdW()

bool DTHandler::_WSAHtonl | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 988 of file DtHandler.Cpp.

                                                                           {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    unsigned long hostlong = (unsigned long)*va_arg(vList, unsigned long *);
    unsigned long *lpnetlong = (unsigned long *)*va_arg(vList, unsigned long **);

    return (handler->WSAHtonl(s, hostlong, lpnetlong, (APIHook<int> &)hook));

} // DTHandler::_WSAHtonl()

bool DTHandler::_WSAHtons | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1008 of file DtHandler.Cpp.

                                                                           {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    unsigned short hostshort = (unsigned short)*va_arg(vList, unsigned short *);
    unsigned short *lpnetshort = (unsigned short *)*va_arg(vList, unsigned short **);

    return (handler->WSAHtons(s, hostshort, lpnetshort, (APIHook<int> &)hook));

} // DTHandler::_WSAHtons()

bool DTHandler::_WSAInstallServiceClassA | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 3099 of file DtHandler.Cpp.

                                                                                {

    LPWSASERVICECLASSINFOA lpServiceClassInfo = (LPWSASERVICECLASSINFOA)*va_arg(vList, LPWSASERVICECLASSINFOA *);

    return (handler->WSAInstallServiceClassA(lpServiceClassInfo, (APIHook<INT> &)hook));

} // DTHandler::_WSAInstallServiceClassA()

bool DTHandler::_WSAInstallServiceClassW | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 3117 of file DtHandler.Cpp.

                                                                                {

    LPWSASERVICECLASSINFOW lpServiceClassInfo = (LPWSASERVICECLASSINFOW)*va_arg(vList, LPWSASERVICECLASSINFOW *);

    return (handler->WSAInstallServiceClassW(lpServiceClassInfo, (APIHook<INT> &)hook));

} // DTHandler::_WSAInstallServiceClassW()

bool DTHandler::_WSAIoctl | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1032 of file DtHandler.Cpp.

                                                                           {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    DWORD dwIoControlCode = (DWORD)*va_arg(vList, DWORD *);
    LPVOID lpvInBuffer = (LPVOID)*va_arg(vList, LPVOID *);
    DWORD cbInBuffer = (DWORD)*va_arg(vList, DWORD *);
    LPVOID lpvOutBuffer = (LPVOID)*va_arg(vList, LPVOID *);
    DWORD cbOutBuffer = (DWORD)*va_arg(vList, DWORD *);
    LPDWORD lpcbBytesReturned = (LPDWORD)*va_arg(vList, LPDWORD *);
    LPWSAOVERLAPPED lpOverlapped = (LPWSAOVERLAPPED)*va_arg(vList, LPWSAOVERLAPPED *);
    LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine =
    (LPWSAOVERLAPPED_COMPLETION_ROUTINE)*va_arg(vList, LPWSAOVERLAPPED_COMPLETION_ROUTINE *);

    return (handler->WSAIoctl(s, dwIoControlCode, lpvInBuffer, cbInBuffer, lpvOutBuffer, cbOutBuffer,
                              lpcbBytesReturned, lpOverlapped, lpCompletionRoutine, (APIHook<int> &)hook));

} // DTHandler::_WSAIoctl()

bool DTHandler::_WSAIsBlocking | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1060 of file DtHandler.Cpp.

                                                                                {

    return (handler->WSAIsBlocking((APIHook<int> &)hook));

} // DTHandler::_WSAIsBlocking()

bool DTHandler::_WSAJoinLeaf | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1079 of file DtHandler.Cpp.

                                                                              {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    const struct sockaddr *name = (const struct sockaddr *)*va_arg(vList, const struct sockaddr **);
    int namelen = (int)*va_arg(vList, int *);
    LPWSABUF lpCallerData = (LPWSABUF)*va_arg(vList, LPWSABUF *);
    LPWSABUF lpCalleeData = (LPWSABUF)*va_arg(vList, LPWSABUF *);
    LPQOS lpSQOS = (LPQOS)*va_arg(vList, LPQOS *);
    LPQOS lpGQOS = (LPQOS)*va_arg(vList, LPQOS *);
    DWORD dwFlags = (DWORD)*va_arg(vList, DWORD *);

    return (handler->WSAJoinLeaf(s, name, namelen, lpCallerData, lpCalleeData,
                                 lpSQOS, lpGQOS, dwFlags, (APIHook<SOCKET> &)hook));

} // DTHandler::_WSAJoinLeaf()

bool DTHandler::_WSALookupServiceBeginA | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 2994 of file DtHandler.Cpp.

                                                                                {

    LPWSAQUERYSETA lpqsRestrictions = (LPWSAQUERYSETA)*va_arg(vList, LPWSAQUERYSETA *);
    DWORD dwControlFlags = (DWORD)*va_arg(vList, DWORD *);
    LPHANDLE lphLookup = (LPHANDLE)*va_arg(vList, LPHANDLE *);

    return (handler->WSALookupServiceBeginA(lpqsRestrictions, dwControlFlags, lphLookup, (APIHook<INT> &)hook));

} // DTHandler::_WSALookupServiceBeginA()

bool DTHandler::_WSALookupServiceBeginW | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 3015 of file DtHandler.Cpp.

                                                                                {

    LPWSAQUERYSETW lpqsRestrictions = (LPWSAQUERYSETW)*va_arg(vList, LPWSAQUERYSETW *);
    DWORD dwControlFlags = (DWORD)*va_arg(vList, DWORD *);
    LPHANDLE lphLookup = (LPHANDLE)*va_arg(vList, LPHANDLE *);

    return (handler->WSALookupServiceBeginW(lpqsRestrictions, dwControlFlags, lphLookup, (APIHook<INT> &)hook));

} // DTHandler::_WSALookupServiceBeginW()

bool DTHandler::_WSALookupServiceEnd | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 3081 of file DtHandler.Cpp.

                                                                                {

    HANDLE hLookup = (HANDLE)*va_arg(vList, HANDLE *);

    return (handler->WSALookupServiceEnd(hLookup, (APIHook<INT> &)hook));

} // DTHandler::_WSALookupServiceEnd()

bool DTHandler::_WSALookupServiceNextA | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 3036 of file DtHandler.Cpp.

                                                                                {

    HANDLE hLookup = (HANDLE)*va_arg(vList, HANDLE *);
    DWORD dwControlFlags = (DWORD)*va_arg(vList, DWORD *);
    LPDWORD lpdwBufferLength = (LPDWORD)*va_arg(vList, LPDWORD *);
    LPWSAQUERYSETA lpqsResults = (LPWSAQUERYSETA)*va_arg(vList, LPWSAQUERYSETA *);

    return (handler->WSALookupServiceNextA(hLookup, dwControlFlags, lpdwBufferLength,
                                           lpqsResults, (APIHook<INT> &)hook));

} // DTHandler::_WSALookupServiceNextA()

bool DTHandler::_WSALookupServiceNextW | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 3059 of file DtHandler.Cpp.

                                                                                {

    HANDLE hLookup = (HANDLE)*va_arg(vList, HANDLE *);
    DWORD dwControlFlags = (DWORD)*va_arg(vList, DWORD *);
    LPDWORD lpdwBufferLength = (LPDWORD)*va_arg(vList, LPDWORD *);
    LPWSAQUERYSETW lpqsResults = (LPWSAQUERYSETW)*va_arg(vList, LPWSAQUERYSETW *);

    return (handler->WSALookupServiceNextW(hLookup, dwControlFlags, lpdwBufferLength,
                                           lpqsResults, (APIHook<INT> &)hook));

} // DTHandler::_WSALookupServiceNextW()

bool DTHandler::_WSANtohl | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1105 of file DtHandler.Cpp.

                                                                           {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    unsigned long netlong = (unsigned long)*va_arg(vList, unsigned long *);
    unsigned long *lphostlong = (unsigned long *)*va_arg(vList, unsigned long **);

    return (handler->WSANtohl(s, netlong, lphostlong, (APIHook<int> &)hook));

} // DTHandler::_WSANtohl()

bool DTHandler::_WSANtohs | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1125 of file DtHandler.Cpp.

                                                                           {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    unsigned short netshort = (unsigned short)*va_arg(vList, unsigned short *);
    unsigned short *lphostshort = (unsigned short *)*va_arg(vList, unsigned short **);

    return (handler->WSANtohs(s, netshort, lphostshort, (APIHook<int> &)hook));

} // DTHandler::_WSANtohs()

bool DTHandler::_WSARecv | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1149 of file DtHandler.Cpp.

                                                                          {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    LPWSABUF lpBuffers = (LPWSABUF)*va_arg(vList, LPWSABUF *);
    DWORD dwBufferCount = (DWORD)*va_arg(vList, DWORD *);
    LPDWORD lpNumberOfBytesRecvd = (LPDWORD)*va_arg(vList, LPDWORD *);
    LPDWORD lpFlags = (LPDWORD)*va_arg(vList, LPDWORD *);
    LPWSAOVERLAPPED lpOverlapped = (LPWSAOVERLAPPED)*va_arg(vList, LPWSAOVERLAPPED *);
    LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine =
    (LPWSAOVERLAPPED_COMPLETION_ROUTINE)*va_arg(vList, LPWSAOVERLAPPED_COMPLETION_ROUTINE *);

    return (handler->WSARecv(s, lpBuffers, dwBufferCount, lpNumberOfBytesRecvd, lpFlags,
                             lpOverlapped, lpCompletionRoutine, (APIHook<int> &)hook));

} // DTHandler::_WSARecv()

bool DTHandler::_WSARecvDisconnect | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1175 of file DtHandler.Cpp.

                                                                                {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    LPWSABUF lpInboundDisconnectData = (LPWSABUF)*va_arg(vList, LPWSABUF *);

    return (handler->WSARecvDisconnect(s, lpInboundDisconnectData, (APIHook<int> &)hook));

} // DTHandler::_WSARecvDisconnect()

bool DTHandler::_WSARecvFrom | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1199 of file DtHandler.Cpp.

                                                                              {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    LPWSABUF lpBuffers = (LPWSABUF)*va_arg(vList, LPWSABUF *);
    DWORD dwBufferCount = (DWORD)*va_arg(vList, DWORD *);
    LPDWORD lpNumberOfBytesRecvd = (LPDWORD)*va_arg(vList, LPDWORD *);
    LPDWORD lpFlags = (LPDWORD)*va_arg(vList, LPDWORD *);
    struct sockaddr *lpFrom = (struct sockaddr *)*va_arg(vList, struct sockaddr **);
    LPINT lpFromlen = (LPINT)*va_arg(vList, LPINT *);
    LPWSAOVERLAPPED lpOverlapped = (LPWSAOVERLAPPED)*va_arg(vList, LPWSAOVERLAPPED *);
    LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine =
    (LPWSAOVERLAPPED_COMPLETION_ROUTINE)*va_arg(vList, LPWSAOVERLAPPED_COMPLETION_ROUTINE *);

    return (handler->WSARecvFrom(s, lpBuffers, dwBufferCount, lpNumberOfBytesRecvd, lpFlags,
                                 lpFrom, lpFromlen, lpOverlapped, lpCompletionRoutine, (APIHook<int> &)hook));

} // DTHandler::_WSARecvFrom()

bool DTHandler::_WSARemoveServiceClass | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 3177 of file DtHandler.Cpp.

                                                                                {

    LPGUID lpServiceClassId = (LPGUID)*va_arg(vList, LPGUID *);

    return (handler->WSARemoveServiceClass(lpServiceClassId, (APIHook<INT> &)hook));

} // DTHandler::_WSARemoveServiceClass()

bool DTHandler::_WSAResetEvent | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1227 of file DtHandler.Cpp.

                                                                                {

    WSAEVENT hEvent = (WSAEVENT)*va_arg(vList, WSAEVENT *);

    return (handler->WSAResetEvent(hEvent, (APIHook<int> &)hook));

} // DTHandler::_WSAResetEvent()

bool DTHandler::_WSASend | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1248 of file DtHandler.Cpp.

                                                                          {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    LPWSABUF lpBuffers = (LPWSABUF)*va_arg(vList, LPWSABUF *);
    DWORD dwBufferCount = (DWORD)*va_arg(vList, DWORD *);
    LPDWORD lpNumberOfBytesSent = (LPDWORD)*va_arg(vList, LPDWORD *);
    DWORD dwFlags = (DWORD)*va_arg(vList, DWORD *);
    LPWSAOVERLAPPED lpOverlapped = (LPWSAOVERLAPPED)*va_arg(vList, LPWSAOVERLAPPED *);
    LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine =
    (LPWSAOVERLAPPED_COMPLETION_ROUTINE)*va_arg(vList, LPWSAOVERLAPPED_COMPLETION_ROUTINE *);

    return (handler->WSASend(s, lpBuffers, dwBufferCount, lpNumberOfBytesSent, dwFlags,
                             lpOverlapped, lpCompletionRoutine, (APIHook<int> &)hook));

} // DTHandler::_WSASend()

bool DTHandler::_WSASendDisconnect | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1274 of file DtHandler.Cpp.

                                                                                {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    LPWSABUF lpOutboundDisconnectData = (LPWSABUF)*va_arg(vList, LPWSABUF *);

    return (handler->WSASendDisconnect(s, lpOutboundDisconnectData, (APIHook<int> &)hook));

} // DTHandler::_WSASendDisconnect()

bool DTHandler::_WSASendTo | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1296 of file DtHandler.Cpp.

                                                                            {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    LPWSABUF lpBuffers = (LPWSABUF)*va_arg(vList, LPWSABUF *);
    DWORD dwBufferCount = (DWORD)*va_arg(vList, DWORD *);
    LPDWORD lpNumberOfBytesSent = (LPDWORD)*va_arg(vList, LPDWORD *);
    DWORD dwFlags = (DWORD)*va_arg(vList, DWORD *);
    const struct sockaddr *lpTo = (const struct sockaddr *)*va_arg(vList, const struct sockaddr **);
    int iTolen = (int)*va_arg(vList, int *);
    LPWSAOVERLAPPED lpOverlapped = (LPWSAOVERLAPPED)*va_arg(vList, LPWSAOVERLAPPED *);
    LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine =
    (LPWSAOVERLAPPED_COMPLETION_ROUTINE)*va_arg(vList, LPWSAOVERLAPPED_COMPLETION_ROUTINE *);

    return (handler->WSASendTo(s, lpBuffers, dwBufferCount, lpNumberOfBytesSent, dwFlags,
                               lpTo, iTolen, lpOverlapped, lpCompletionRoutine, (APIHook<int> &)hook));

} // DTHandler::_WSASendTo()

bool DTHandler::_WSASetBlockingHook | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1324 of file DtHandler.Cpp.

                                                                                {

    FARPROC lpBlockFunc = (FARPROC)*va_arg(vList, FARPROC *);

    return (handler->WSASetBlockingHook(lpBlockFunc, (APIHook<FARPROC> &)hook));

} // DTHandler::_WSASetBlockingHook()

bool DTHandler::_WSASetEvent | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1342 of file DtHandler.Cpp.

                                                                              {

    WSAEVENT hEvent = (WSAEVENT)*va_arg(vList, WSAEVENT *);

    return (handler->WSASetEvent(hEvent, (APIHook<int> &)hook));

} // DTHandler::_WSASetEvent()

bool DTHandler::_WSASetLastError | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1360 of file DtHandler.Cpp.

                                                                                {

    int iError = (int)*va_arg(vList, int *);

    return (handler->WSASetLastError(iError, hook));

} // DTHandler::_WSASetLastError()

bool DTHandler::_WSASetServiceA | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 3136 of file DtHandler.Cpp.

                                                                                {

    LPWSAQUERYSETA lpqsRegInfo = (LPWSAQUERYSETA)*va_arg(vList, LPWSAQUERYSETA *);
    WSAESETSERVICEOP essOperation = (WSAESETSERVICEOP)*va_arg(vList, LPWSAESETSERVICEOP);
    DWORD dwControlFlags = (DWORD)*va_arg(vList, DWORD *);

    return (handler->WSASetServiceA(lpqsRegInfo, essOperation, dwControlFlags, (APIHook<INT> &)hook));

} // DTHandler::_WSASetServiceA()

bool DTHandler::_WSASetServiceW | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 3157 of file DtHandler.Cpp.

                                                                                {

    LPWSAQUERYSETW lpqsRegInfo = (LPWSAQUERYSETW)*va_arg(vList, LPWSAQUERYSETW *);
    WSAESETSERVICEOP essOperation = (WSAESETSERVICEOP)*va_arg(vList, LPWSAESETSERVICEOP);
    DWORD dwControlFlags = (DWORD)*va_arg(vList, DWORD *);

    return (handler->WSASetServiceW(lpqsRegInfo, essOperation, dwControlFlags, (APIHook<INT> &)hook));

} // DTHandler::_WSASetServiceW()

bool DTHandler::_WSASocketA | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1379 of file DtHandler.Cpp.

                                                                             {

    int af = (int)*va_arg(vList, int *);
    int type = (int)*va_arg(vList, int *);
    int protocol = (int)*va_arg(vList, int *);
    LPWSAPROTOCOL_INFOA lpProtocolInfo = (LPWSAPROTOCOL_INFOA)*va_arg(vList, LPWSAPROTOCOL_INFOA *);
    GROUP g = (GROUP)*va_arg(vList, GROUP *);
    DWORD dwFlags = (DWORD)*va_arg(vList, DWORD *);

    return (handler->WSASocketA(af, type, protocol, lpProtocolInfo, g, dwFlags, (APIHook<SOCKET> &)hook));

} // DTHandler::_WSASocketA()

bool DTHandler::_WSASocketW | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1403 of file DtHandler.Cpp.

                                                                             {

    int af = (int)*va_arg(vList, int *);
    int type = (int)*va_arg(vList, int *);
    int protocol = (int)*va_arg(vList, int *);
    LPWSAPROTOCOL_INFOW lpProtocolInfo = (LPWSAPROTOCOL_INFOW)*va_arg(vList, LPWSAPROTOCOL_INFOW *);
    GROUP g = (GROUP)*va_arg(vList, GROUP *);
    DWORD dwFlags = (DWORD)*va_arg(vList, DWORD *);

    return (handler->WSASocketW(af, type, protocol, lpProtocolInfo, g, dwFlags, (APIHook<SOCKET> &)hook));

} // DTHandler::_WSASocketW()

bool DTHandler::_WSAStartup | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1426 of file DtHandler.Cpp.

                                                                             {

    WORD wVersionRequested = (WORD)*va_arg(vList, LPDWORD);
    LPWSADATA lpWSAData = (LPWSADATA)*va_arg(vList, LPWSADATA *);

    return (handler->WSAStartup(wVersionRequested, lpWSAData, (APIHook<int> &)hook));

} // DTHandler::_WSAStartup()

bool DTHandler::_WSAStringToAddressA | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 2945 of file DtHandler.Cpp.

                                                                                {

    LPTSTR AddressString = (LPTSTR)*va_arg(vList, LPTSTR *);
    INT AddressFamily = (INT)*va_arg(vList, INT *);
    LPWSAPROTOCOL_INFOA lpProtocolInfo = (LPWSAPROTOCOL_INFOA)*va_arg(vList, LPWSAPROTOCOL_INFOA *);
    LPSOCKADDR lpAddress = (LPSOCKADDR)*va_arg(vList, LPSOCKADDR *);
    LPINT lpAddressLength = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WSAStringToAddressA(AddressString, AddressFamily, lpProtocolInfo,
                                         lpAddress, lpAddressLength, (APIHook<INT> &)hook));

} // DTHandler::_WSAStringToAddressA()

bool DTHandler::_WSAStringToAddressW | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 2970 of file DtHandler.Cpp.

                                                                                {

    LPTSTR AddressString = (LPTSTR)*va_arg(vList, LPTSTR *);
    INT AddressFamily = (INT)*va_arg(vList, INT *);
    LPWSAPROTOCOL_INFOW lpProtocolInfo = (LPWSAPROTOCOL_INFOW)*va_arg(vList, LPWSAPROTOCOL_INFOW *);
    LPSOCKADDR lpAddress = (LPSOCKADDR)*va_arg(vList, LPSOCKADDR *);
    LPINT lpAddressLength = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WSAStringToAddressW(AddressString, AddressFamily, lpProtocolInfo,
                                         lpAddress, lpAddressLength, (APIHook<INT> &)hook));

} // DTHandler::_WSAStringToAddressW()

bool DTHandler::_WSAUnhookBlockingHook | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1445 of file DtHandler.Cpp.

                                                                                {

    return (handler->WSAUnhookBlockingHook((APIHook<int> &)hook));

} // DTHandler::_WSAUnhookBlockingHook()

bool DTHandler::_WSAWaitForMultipleEvents | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1463 of file DtHandler.Cpp.

                                                                                {

    DWORD cEvents = (DWORD)*va_arg(vList, DWORD *);
    const WSAEVENT *lphEvents = (const WSAEVENT *)*va_arg(vList, const WSAEVENT **);
    BOOL fWaitAll = (BOOL)*va_arg(vList, BOOL *);
    DWORD dwTimeout = (DWORD)*va_arg(vList, DWORD *);
    BOOL fAlertable = (BOOL)*va_arg(vList, BOOL *);

    return (handler->WSAWaitForMultipleEvents(cEvents, lphEvents, fWaitAll, dwTimeout, fAlertable, (APIHook<DWORD> &)hook));

} // DTHandler::_WSAWaitForMultipleEvents()

bool DTHandler::_WSCDeinstallProvider | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 2617 of file DtHandler.Cpp.

                                                                                {

    LPGUID lpProviderId = (LPGUID)*va_arg(vList, LPGUID *);
    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WSCDeinstallProvider(lpProviderId, lpErrno, (APIHook<int> &)hook));

} // DTHandler::_WSCDeinstallProvider()

bool DTHandler::_WSCEnableNSProvider | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 3653 of file DtHandler.Cpp.

                                                                                {

    LPGUID lpProviderId = (LPGUID)*va_arg(vList, LPGUID *);
    BOOL fEnable = (BOOL)*va_arg(vList, BOOL *);

    return (handler->WSCEnableNSProvider(lpProviderId, fEnable, (APIHook<int> &)hook));

} // DTHandler::_WSCEnableNSProvider()

bool DTHandler::_WSCEnumProtocols | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 2871 of file DtHandler.Cpp.

                                                                                {

    LPINT lpiProtocols = (LPINT)*va_arg(vList, LPINT *);
    LPWSAPROTOCOL_INFOW lpProtocolBuffer = (LPWSAPROTOCOL_INFOW)*va_arg(vList, LPWSAPROTOCOL_INFOW *);
    LPDWORD lpdwBufferLength = (LPDWORD)*va_arg(vList, LPDWORD *);
    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WSCEnumProtocols(lpiProtocols, lpProtocolBuffer, lpdwBufferLength,
                                      lpErrno, (APIHook<int> &)hook));

} // DTHandler::_WSCEnumProtocols()

bool DTHandler::_WSCGetProviderPath | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 3588 of file DtHandler.Cpp.

                                                                                {

    LPGUID lpProviderId = (LPGUID)*va_arg(vList, LPGUID *);
    LPWSTR lpszProviderDllPath = (LPWSTR)*va_arg(vList, LPWSTR *);
    LPINT lpProviderDllPathLen = (LPINT)*va_arg(vList, LPINT *);
    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WSCGetProviderPath(lpProviderId, lpszProviderDllPath, lpProviderDllPathLen,
                                        lpErrno, (APIHook<int> &)hook));

} // DTHandler::_WSCGetProviderPath()

bool DTHandler::_WSCInstallNameSpace | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 3612 of file DtHandler.Cpp.

                                                                                {

    LPWSTR lpszIdentifier = (LPWSTR)*va_arg(vList, LPWSTR *);
    LPWSTR lpszPathName = (LPWSTR)*va_arg(vList, LPWSTR *);
    DWORD dwNameSpace = (DWORD)*va_arg(vList, DWORD *);
    DWORD dwVersion = (DWORD)*va_arg(vList, DWORD *);
    LPGUID lpProviderId = (LPGUID)*va_arg(vList, LPGUID *);

    return (handler->WSCInstallNameSpace(lpszIdentifier, lpszPathName, dwNameSpace,
                                         dwVersion, lpProviderId, (APIHook<int> &)hook));

} // DTHandler::_WSCInstallNameSpace()

bool DTHandler::_WSCInstallProvider | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 2638 of file DtHandler.Cpp.

                                                                                {

    const LPGUID lpProviderId = (const LPGUID)*va_arg(vList, const LPGUID *);
    const LPWSTR lpszProviderDllPath = (const LPWSTR)*va_arg(vList, const LPWSTR *);
    const LPWSAPROTOCOL_INFOW lpProtocolInfoList = (LPWSAPROTOCOL_INFOW)*va_arg(vList, LPWSAPROTOCOL_INFOW *);
    DWORD dwNumberOfEntries = (DWORD)*va_arg(vList, DWORD *);
    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WSCInstallProvider(lpProviderId, lpszProviderDllPath, lpProtocolInfoList,
                                        dwNumberOfEntries, lpErrno, (APIHook<int> &)hook));

} // DTHandler::_WSCInstallProvider()

bool DTHandler::_WSCUnInstallNameSpace | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 3635 of file DtHandler.Cpp.

                                                                                {

    LPGUID lpProviderId = (LPGUID)*va_arg(vList, LPGUID *);

    return (handler->WSCUnInstallNameSpace(lpProviderId, (APIHook<int> &)hook));

} // DTHandler::_WSCUnInstallNameSpace()

bool DTHandler::_WSPAccept | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1817 of file DtHandler.Cpp.

                                                                            {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    struct sockaddr *addr = (struct sockaddr *)*va_arg(vList, struct sockaddr **);
    LPINT addrlen = (LPINT)*va_arg(vList, LPINT *);
    LPCONDITIONPROC lpfnCondition = (LPCONDITIONPROC)*va_arg(vList, LPCONDITIONPROC *);
    DWORD dwCallbackData = (DWORD)*va_arg(vList, DWORD *);
    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WSPAccept(s, addr, addrlen, lpfnCondition, dwCallbackData, lpErrno, (APIHook<SOCKET> &)hook));

} // DTHandler::_WSPAccept()

bool DTHandler::_WSPAddressToString | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 3674 of file DtHandler.Cpp.

                                                                                {

    LPSOCKADDR lpsaAddress = (LPSOCKADDR)*va_arg(vList, LPSOCKADDR *);
    DWORD dwAddressLength = (DWORD)*va_arg(vList, DWORD *);
    LPWSAPROTOCOL_INFOW lpProtocolInfo = (LPWSAPROTOCOL_INFOW)*va_arg(vList, LPWSAPROTOCOL_INFOW *);
    LPWSTR lpszAddressString = (LPWSTR)*va_arg(vList, LPWSTR *);
    LPDWORD lpdwAddressStringLength = (LPDWORD)*va_arg(vList, LPDWORD *);
    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WSPAddressToString(lpsaAddress, dwAddressLength, lpProtocolInfo, lpszAddressString,
                                        lpdwAddressStringLength, lpErrno, (APIHook<int> &)hook));

} // DTHandler::_WSPAddressToString()

bool DTHandler::_WSPAsyncSelect | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1841 of file DtHandler.Cpp.

                                                                                {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    HWND hWnd = (HWND)*va_arg(vList, HWND *);
    unsigned int wMsg = (unsigned int)*va_arg(vList, unsigned int *);
    long lEvent = (long)*va_arg(vList, long *);
    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WSPAsyncSelect(s, hWnd, wMsg, lEvent, lpErrno, (APIHook<int> &)hook));

} // DTHandler::_WSPAsyncSelect()

bool DTHandler::_WSPBind | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1864 of file DtHandler.Cpp.

                                                                          {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    const struct sockaddr *name = (const struct sockaddr *)*va_arg(vList, const struct sockaddr **);
    int namelen = (int)*va_arg(vList, int *);
    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WSPBind(s, name, namelen, lpErrno, (APIHook<int> &)hook));

} // DTHandler::_WSPBind()

bool DTHandler::_WSPCancelBlockingCall | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1885 of file DtHandler.Cpp.

                                                                                {

    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WSPCancelBlockingCall(lpErrno, (APIHook<int> &)hook));

} // DTHandler::_WSPCancelBlockingCall()

bool DTHandler::_WSPCleanup | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1903 of file DtHandler.Cpp.

                                                                             {

    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WSPCleanup(lpErrno, (APIHook<int> &)hook));

} // DTHandler::_WSPCleanup()

bool DTHandler::_WSPCloseSocket | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1921 of file DtHandler.Cpp.

                                                                                {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WSPCloseSocket(s, lpErrno, (APIHook<int> &)hook));

} // DTHandler::_WSPCloseSocket()

bool DTHandler::_WSPConnect | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1943 of file DtHandler.Cpp.

                                                                             {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    const struct sockaddr *name = (const struct sockaddr *)*va_arg(vList, const struct sockaddr **);
    int namelen = (int)*va_arg(vList, int *);
    LPWSABUF lpCallerData = (LPWSABUF)*va_arg(vList, LPWSABUF *);
    LPWSABUF lpCalleeData = (LPWSABUF)*va_arg(vList, LPWSABUF *);
    LPQOS lpSQOS = (LPQOS)*va_arg(vList, LPQOS *);
    LPQOS lpGQOS = (LPQOS)*va_arg(vList, LPQOS *);
    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WSPConnect(s, name, namelen, lpCallerData, lpCalleeData,
                           lpSQOS, lpGQOS, lpErrno, (APIHook<int> &)hook));

} // DTHandler::_WSPConnect()

bool DTHandler::_WSPDuplicateSocket | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1971 of file DtHandler.Cpp.

                                                                                {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    DWORD dwProcessId = (DWORD)*va_arg(vList, DWORD *);
    LPWSAPROTOCOL_INFOW lpProtocolInfo = (LPWSAPROTOCOL_INFOW)*va_arg(vList, LPWSAPROTOCOL_INFOW *);
    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WSPDuplicateSocket(s, dwProcessId, lpProtocolInfo, lpErrno, (APIHook<int> &)hook));

} // DTHandler::_WSPDuplicateSocket()

bool DTHandler::_WSPEnumNetworkEvents | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 1994 of file DtHandler.Cpp.

                                                                                {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    WSAEVENT hEventObject = (WSAEVENT)*va_arg(vList, WSAEVENT *);
    LPWSANETWORKEVENTS lpNetworkEvents = (LPWSANETWORKEVENTS)*va_arg(vList, LPWSANETWORKEVENTS *);
    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WSPEnumNetworkEvents(s, hEventObject, lpNetworkEvents, lpErrno, (APIHook<int> &)hook));

} // DTHandler::_WSPEnumNetworkEvents()

bool DTHandler::_WSPEventSelect | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 2016 of file DtHandler.Cpp.

                                                                                {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    WSAEVENT hEventObject = (WSAEVENT)*va_arg(vList, WSAEVENT *);
    long lNetworkEvents = (long)*va_arg(vList, long *);
    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WSPEventSelect(s, hEventObject, lNetworkEvents, lpErrno, (APIHook<int> &)hook));

} // DTHandler::_WSPEventSelect()

bool DTHandler::_WSPGetOverlappedResult | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 2039 of file DtHandler.Cpp.

                                                                                {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    LPWSAOVERLAPPED lpOverlapped = (LPWSAOVERLAPPED)*va_arg(vList, LPWSAOVERLAPPED *);
    LPDWORD lpcbTransfer = (LPDWORD)*va_arg(vList, LPDWORD *);
    BOOL fWait = (BOOL)*va_arg(vList, BOOL *);
    LPDWORD lpdwFlags = (LPDWORD)*va_arg(vList, LPDWORD *);
    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WSPGetOverlappedResult(s, lpOverlapped, lpcbTransfer, fWait,
                                            lpdwFlags, lpErrno, (APIHook<BOOL> &)hook));

} // DTHandler::_WSPGetOverlappedResult()

bool DTHandler::_WSPGetPeerName | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 2064 of file DtHandler.Cpp.

                                                                                {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    struct sockaddr *name = (struct sockaddr *)*va_arg(vList, struct sockaddr **);
    LPINT namelen = (LPINT)*va_arg(vList, LPINT *);
    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WSPGetPeerName(s, name, namelen, lpErrno, (APIHook<int> &)hook));

} // DTHandler::_WSPGetPeerName()

bool DTHandler::_WSPGetQOSByName | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 2132 of file DtHandler.Cpp.

                                                                                {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    LPWSABUF lpQOSName = (LPWSABUF)*va_arg(vList, LPWSABUF *);
    LPQOS lpQOS = (LPQOS)*va_arg(vList, LPQOS *);
    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WSPGetQOSByName(s, lpQOSName, lpQOS, lpErrno, (APIHook<BOOL> &)hook));

} // DTHandler::_WSPGetQOSByName()

bool DTHandler::_WSPGetSockName | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 2086 of file DtHandler.Cpp.

                                                                                {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    struct sockaddr *name = (struct sockaddr *)*va_arg(vList, struct sockaddr **);
    LPINT namelen = (LPINT)*va_arg(vList, LPINT *);
    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WSPGetSockName(s, name, namelen, lpErrno, (APIHook<int> &)hook));

} // DTHandler::_WSPGetSockName()

bool DTHandler::_WSPGetSockOpt | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 2108 of file DtHandler.Cpp.

                                                                                {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    int level = (int)*va_arg(vList, int *);
    int optname = (int)*va_arg(vList, int *);
    char *optval = (char *)*va_arg(vList, char **);
    LPINT optlen = (LPINT)*va_arg(vList, LPINT *);
    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WSPGetSockOpt(s, level, optname, optval, optlen, lpErrno, (APIHook<int> &)hook));

} // DTHandler::_WSPGetSockOpt()

bool DTHandler::_WSPIoctl | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 2158 of file DtHandler.Cpp.

                                                                           {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    DWORD dwIoControlCode = (DWORD)*va_arg(vList, DWORD *);
    LPVOID lpvInBuffer = (LPVOID)*va_arg(vList, LPVOID *);
    DWORD cbInBuffer = (DWORD)*va_arg(vList, DWORD *);
    LPVOID lpvOutBuffer = (LPVOID)*va_arg(vList, LPVOID *);
    DWORD cbOutBuffer = (DWORD)*va_arg(vList, DWORD *);
    LPDWORD lpcbBytesReturned = (LPDWORD)*va_arg(vList, LPDWORD *);
    LPWSAOVERLAPPED lpOverlapped = (LPWSAOVERLAPPED)*va_arg(vList, LPWSAOVERLAPPED *);
    LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine =
    (LPWSAOVERLAPPED_COMPLETION_ROUTINE)*va_arg(vList, LPWSAOVERLAPPED_COMPLETION_ROUTINE *);
    LPWSATHREADID lpThreadId = (LPWSATHREADID)*va_arg(vList, LPWSATHREADID *);
    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WSPIoctl(s, dwIoControlCode, lpvInBuffer, cbInBuffer, lpvOutBuffer,
                              cbOutBuffer, lpcbBytesReturned, lpOverlapped,
                              lpCompletionRoutine, lpThreadId, lpErrno, (APIHook<int> &)hook));

} // DTHandler::_WSPIoctl()

bool DTHandler::_WSPJoinLeaf | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 2192 of file DtHandler.Cpp.

                                                                              {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    const struct sockaddr *name = (const struct sockaddr *)*va_arg(vList, const struct sockaddr **);
    int namelen = (int)*va_arg(vList, int *);
    LPWSABUF lpCallerData = (LPWSABUF)*va_arg(vList, LPWSABUF *);
    LPWSABUF lpCalleeData = (LPWSABUF)*va_arg(vList, LPWSABUF *);
    LPQOS lpSQOS = (LPQOS)*va_arg(vList, LPQOS *);
    LPQOS lpGQOS = (LPQOS)*va_arg(vList, LPQOS *);
    DWORD dwFlags = (DWORD)*va_arg(vList, DWORD *);
    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WSPJoinLeaf(s, name, namelen, lpCallerData, lpCalleeData,
                                 lpSQOS, lpGQOS, dwFlags, lpErrno, (APIHook<SOCKET> &)hook));

} // DTHandler::_WSPJoinLeaf()

bool DTHandler::_WSPListen | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 2219 of file DtHandler.Cpp.

                                                                            {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    int backlog = (int)*va_arg(vList, int *);
    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WSPListen(s, backlog, lpErrno, (APIHook<int> &)hook));

} // DTHandler::_WSPListen()

bool DTHandler::_WSPRecv | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 2244 of file DtHandler.Cpp.

                                                                          {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    LPWSABUF lpBuffers = (LPWSABUF)*va_arg(vList, LPWSABUF *);
    DWORD dwBufferCount = (DWORD)*va_arg(vList, DWORD *);
    LPDWORD lpNumberOfBytesRecvd = (LPDWORD)*va_arg(vList, LPDWORD *);
    LPDWORD lpFlags = (LPDWORD)*va_arg(vList, LPDWORD *);
    LPWSAOVERLAPPED lpOverlapped = (LPWSAOVERLAPPED)*va_arg(vList, LPWSAOVERLAPPED *);
    LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine =
    (LPWSAOVERLAPPED_COMPLETION_ROUTINE)*va_arg(vList, LPWSAOVERLAPPED_COMPLETION_ROUTINE *);
    LPWSATHREADID lpThreadId = (LPWSATHREADID)*va_arg(vList, LPWSATHREADID *);
    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WSPRecv(s, lpBuffers, dwBufferCount, lpNumberOfBytesRecvd, lpFlags,
                             lpOverlapped, lpCompletionRoutine, lpThreadId, lpErrno, (APIHook<int> &)hook));

} // DTHandler::_WSPRecv()

bool DTHandler::_WSPRecvDisconnect | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 2273 of file DtHandler.Cpp.

                                                                                {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    LPWSABUF lpInboundDisconnectData = (LPWSABUF)*va_arg(vList, LPWSABUF *);
    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WSPRecvDisconnect(s, lpInboundDisconnectData, lpErrno, (APIHook<int> &)hook));

} // DTHandler::_WSPRecvDisconnect()

bool DTHandler::_WSPRecvFrom | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 2299 of file DtHandler.Cpp.

                                                                              {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    LPWSABUF lpBuffers = (LPWSABUF)*va_arg(vList, LPWSABUF *);
    DWORD dwBufferCount = (DWORD)*va_arg(vList, DWORD *);
    LPDWORD lpNumberOfBytesRecvd = (LPDWORD)*va_arg(vList, LPDWORD *);
    LPDWORD lpFlags = (LPDWORD)*va_arg(vList, LPDWORD *);
    struct sockaddr *lpFrom = (struct sockaddr *)*va_arg(vList, struct sockaddr **);
    LPINT lpFromlen = (LPINT)*va_arg(vList, LPINT *);
    LPWSAOVERLAPPED lpOverlapped = (LPWSAOVERLAPPED)*va_arg(vList, LPWSAOVERLAPPED *);
    LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine =
    (LPWSAOVERLAPPED_COMPLETION_ROUTINE)*va_arg(vList, LPWSAOVERLAPPED_COMPLETION_ROUTINE *);
    LPWSATHREADID lpThreadId = (LPWSATHREADID)*va_arg(vList, LPWSATHREADID *);
    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WSPRecvFrom(s, lpBuffers, dwBufferCount, lpNumberOfBytesRecvd, lpFlags,
                                 lpFrom, lpFromlen, lpOverlapped, lpCompletionRoutine,
                                 lpThreadId, lpErrno, (APIHook<int> &)hook));

} // DTHandler::_WSPRecvFrom()

bool DTHandler::_WSPSelect | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 2332 of file DtHandler.Cpp.

                                                                            {

    int nfds = (int)*va_arg(vList, int *);
    fd_set *readfds = (fd_set *)*va_arg(vList, fd_set **);
    fd_set *writefds = (fd_set *)*va_arg(vList, fd_set **);
    fd_set *exceptfds = (fd_set *)*va_arg(vList, fd_set **);
    const struct timeval *timeout = (const struct timeval *)*va_arg(vList, const struct timeval **);
    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WSPSelect(nfds, readfds, writefds, exceptfds, timeout, lpErrno, (APIHook<int> &)hook));

} // DTHandler::_WSPSelect()

bool DTHandler::_WSPSend | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 2360 of file DtHandler.Cpp.

                                                                          {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    LPWSABUF lpBuffers = (LPWSABUF)*va_arg(vList, LPWSABUF *);
    DWORD dwBufferCount = (DWORD)*va_arg(vList, DWORD *);
    LPDWORD lpNumberOfBytesSent = (LPDWORD)*va_arg(vList, LPDWORD *);
    DWORD dwFlags = (DWORD)*va_arg(vList, DWORD *);
    LPWSAOVERLAPPED lpOverlapped = (LPWSAOVERLAPPED)*va_arg(vList, LPWSAOVERLAPPED *);
    LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine =
    (LPWSAOVERLAPPED_COMPLETION_ROUTINE)*va_arg(vList, LPWSAOVERLAPPED_COMPLETION_ROUTINE *);
    LPWSATHREADID lpThreadId = (LPWSATHREADID)*va_arg(vList, LPWSATHREADID *);
    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WSPSend(s, lpBuffers, dwBufferCount, lpNumberOfBytesSent, dwFlags,
                             lpOverlapped, lpCompletionRoutine, lpThreadId, lpErrno, (APIHook<int> &)hook));

} // DTHandler::_WSPSend()

bool DTHandler::_WSPSendDisconnect | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 2389 of file DtHandler.Cpp.

                                                                                {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    LPWSABUF lpOutboundDisconnectData = (LPWSABUF)*va_arg(vList, LPWSABUF *);
    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WSPSendDisconnect(s, lpOutboundDisconnectData, lpErrno, (APIHook<int> &)hook));

} // DTHandler::_WSPSendDisconnect()

bool DTHandler::_WSPSendTo | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 2415 of file DtHandler.Cpp.

                                                                            {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    LPWSABUF lpBuffers = (LPWSABUF)*va_arg(vList, LPWSABUF *);
    DWORD dwBufferCount = (DWORD)*va_arg(vList, DWORD *);
    LPDWORD lpNumberOfBytesSent = (LPDWORD)*va_arg(vList, LPDWORD *);
    DWORD dwFlags = (DWORD)*va_arg(vList, DWORD *);
    const struct sockaddr *lpTo = (const struct sockaddr *)*va_arg(vList, const struct sockaddr **);
    int iTolen = (int)*va_arg(vList, int *);
    LPWSAOVERLAPPED lpOverlapped = (LPWSAOVERLAPPED)*va_arg(vList, LPWSAOVERLAPPED *);
    LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine =
    (LPWSAOVERLAPPED_COMPLETION_ROUTINE)*va_arg(vList, LPWSAOVERLAPPED_COMPLETION_ROUTINE *);
    LPWSATHREADID lpThreadId = (LPWSATHREADID)*va_arg(vList, LPWSATHREADID *);
    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WSPSendTo(s, lpBuffers, dwBufferCount, lpNumberOfBytesSent, dwFlags,
                               lpTo, iTolen, lpOverlapped, lpCompletionRoutine,
                               lpThreadId, lpErrno, (APIHook<int> &)hook));

} // DTHandler::_WSPSendTo()

bool DTHandler::_WSPSetSockOpt | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 2447 of file DtHandler.Cpp.

                                                                                {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    int level = (int)*va_arg(vList, int *);
    int optname = (int)*va_arg(vList, int *);
    const char *optval = (const char *)*va_arg(vList, const char **);
    int optlen = (int)*va_arg(vList, int *);
    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WSPSetSockOpt(s, level, optname, optval, optlen, lpErrno, (APIHook<int> &)hook));

} // DTHandler::_WSPSetSockOpt()

bool DTHandler::_WSPShutdown | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 2470 of file DtHandler.Cpp.

                                                                              {

    SOCKET s = (SOCKET)*va_arg(vList, SOCKET *);
    int how = (int)*va_arg(vList, int *);
    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WSPShutdown(s, how, lpErrno, (APIHook<int> &)hook));

} // DTHandler::_WSPShutdown()

bool DTHandler::_WSPSocket | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 2491 of file DtHandler.Cpp.

                                                                            {

    int af = (int)*va_arg(vList, int *);
    int type = (int)*va_arg(vList, int *);
    int protocol = (int)*va_arg(vList, int *);
    LPWSAPROTOCOL_INFOW lpProtocolInfo = (LPWSAPROTOCOL_INFOW)*va_arg(vList, LPWSAPROTOCOL_INFOW *);
    GROUP g = (GROUP)*va_arg(vList, GROUP *);
    DWORD dwFlags = (DWORD)*va_arg(vList, DWORD *);
    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WSPSocket(af, type, protocol, lpProtocolInfo, g, dwFlags, lpErrno, (APIHook<SOCKET> &)hook));

} // DTHandler::_WSPSocket()

bool DTHandler::_WSPStartup | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 2517 of file DtHandler.Cpp.

                                                                             {

    WORD wVersionRequested = (WORD)*va_arg(vList, WORD *);
    LPWSPDATA lpWSPData = (LPWSPDATA)*va_arg(vList, LPWSPDATA *);
    LPWSAPROTOCOL_INFOW lpProtocolInfo = (LPWSAPROTOCOL_INFOW)*va_arg(vList, LPWSAPROTOCOL_INFOW *);
    WSPUPCALLTABLE UpcallTable = (WSPUPCALLTABLE)*va_arg(vList, WSPUPCALLTABLE *);
    LPWSPPROC_TABLE lpProcTable = (LPWSPPROC_TABLE)*va_arg(vList, LPWSPPROC_TABLE *);

    return (handler->WSPStartup(wVersionRequested, lpWSPData, lpProtocolInfo,
                                UpcallTable, lpProcTable, (APIHook<int> &)hook));

} // DTHandler::_WSPStartup()

bool DTHandler::_WSPStringToAddress | ( | DTHandler * | handler,
 |  | APIHook< void > & | hook,
 |  | va_list | vList |
 | ) |  |  | [static, private]

Definition at line 3701 of file DtHandler.Cpp.

                                                                                {

    LPWSTR AddressString = (LPWSTR)*va_arg(vList, LPWSTR *);
    INT AddressFamily = (INT)*va_arg(vList, INT *);
    LPWSAPROTOCOL_INFOW lpProtocolInfo = (LPWSAPROTOCOL_INFOW)*va_arg(vList, LPWSAPROTOCOL_INFOW *);
    LPSOCKADDR lpAddress = (LPSOCKADDR)*va_arg(vList, LPSOCKADDR *);
    LPINT lpAddressLength = (LPINT)*va_arg(vList, LPINT *);
    LPINT lpErrno = (LPINT)*va_arg(vList, LPINT *);

    return (handler->WSPStringToAddress(AddressString, AddressFamily, lpProtocolInfo, lpAddress,
                                        lpAddressLength, lpErrno, (APIHook<int> &)hook));

} // DTHandler::_WSPStringToAddress()

virtual bool DTHandler::accept | ( | SOCKET | s,
 |  | struct sockaddr FAR * | addr,
 |  | int FAR * | addrlen,
 |  | APIHook< SOCKET > & | hook |
 | ) |  |  | [protected, virtual]
virtual bool DTHandler::bind | ( | SOCKET | s,
 |  | const struct sockaddr FAR * | name,
 |  | int | namelen,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]
bool DTHandler::closesocket | ( | SOCKET | s,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 281 of file DtHandler.Cpp.

                                                   {

    return (false);

} // DTHandler::closesocket()

virtual bool DTHandler::connect | ( | SOCKET | s,
 |  | const struct sockaddr FAR * | name,
 |  | int | namelen,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]
bool DTHandler::dispatch | ( | int | notificationCode,
 |  | void * | returnCode,
 |  | char * | LibraryName,
 |  | bool | preAPI,
 |  | va_list | vl
 | ) |  |

Definition at line 225 of file DtHandler.Cpp.

                                                                                {

    if ((notificationCode >= 1) && (notificationCode <= MAX_DTCODE) && (_dispatchTable[notificationCode] != NULL)) {

        APIHook<void> hook(returnCode, LibraryName, preAPI);

        return (_dispatchTable[notificationCode](this, hook, vl));

    }

    return (false);

} // DTHandler::dispatch()

virtual bool DTHandler::gethostbyaddr | ( | const char FAR * | addr,
 |  | int | len,
 |  | int | type,
 |  | APIHook< HOSTENT > & | hook |
 | ) |  |  | [protected, virtual]
virtual bool DTHandler::gethostbyname | ( | const char FAR * | name,
 |  | APIHook< HOSTENT > & | hook |
 | ) |  |  | [protected, virtual]
virtual bool DTHandler::gethostname | ( | char FAR * | name,
 |  | int | namelen,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]
virtual bool DTHandler::getpeername | ( | SOCKET | s,
 |  | struct sockaddr FAR * | name,
 |  | int FAR * | namelen,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]
virtual bool DTHandler::getprotobyname | ( | const char FAR * | name,
 |  | APIHook< PROTOENT > & | hook |
 | ) |  |  | [protected, virtual]
bool DTHandler::getprotobynumber | ( | int | number,
 |  | APIHook< PROTOENT > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 1552 of file DtHandler.Cpp.

                                                               {

    return (false);

} // DTHandler::getprotobynumber()

virtual bool DTHandler::getservbyname | ( | const char FAR * | name,
 |  | const char FAR * | proto,
 |  | APIHook< SERVENT > & | hook |
 | ) |  |  | [protected, virtual]
virtual bool DTHandler::getservbyport | ( | int | port,
 |  | const char FAR * | proto,
 |  | APIHook< SERVENT > & | hook |
 | ) |  |  | [protected, virtual]
virtual bool DTHandler::getsockname | ( | SOCKET | s,
 |  | struct sockaddr FAR * | name,
 |  | int FAR * | namelen,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]
virtual bool DTHandler::getsockopt | ( | SOCKET | s,
 |  | int | level,
 |  | int | optname,
 |  | char FAR * | optval,
 |  | int FAR * | optlen,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]
virtual bool DTHandler::htonl | ( | unsigned long | hostlong,
 |  | APIHook< unsigned long > & | hook |
 | ) |  |  | [protected, virtual]
bool DTHandler::htons | ( | unsigned short | hostshort,
 |  | APIHook< unsigned short > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 399 of file DtHandler.Cpp.

                                                                        {

    return (false);

} // DTHandler::htons()

virtual bool DTHandler::inet_addr | ( | const char FAR * | cp,
 |  | APIHook< unsigned long > & | hook |
 | ) |  |  | [protected, virtual]
virtual bool DTHandler::inet_ntoa | ( | struct in_addr | in,
 |  | APIHook< char FAR * > & | hook |
 | ) |  |  | [protected, virtual]
virtual bool DTHandler::ioctlsocket | ( | SOCKET | s,
 |  | long | cmd,
 |  | unsigned long FAR * | argp,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]
bool DTHandler::listen | ( | SOCKET | s,
 |  | int | backlog,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 437 of file DtHandler.Cpp.

                                                           {

    return (false);

} // DTHandler::listen()

bool DTHandler::NSPAddressToString | ( | LPSOCKADDR | lpsaAddress,
 |  | DWORD | dwAddressLength,
 |  | LPWSAPROTOCOL_INFOW | lpProtocolInfo,
 |  | LPWSTR | lpszAddressString,
 |  | LPDWORD | lpdwAddressStringLength,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 3321 of file DtHandler.Cpp.

                                                                                {

    return (false);

} // DTHandler::NSPAddressToString()

bool DTHandler::NSPGetAddressByName | ( | LPWSTR | lpszServiceInstanceName,
 |  | LPGUID | lpServiceClassId,
 |  | DWORD | dwNameSpace,
 |  | LPDWORD | lpdwBufferLength,
 |  | LPWSAQUERYSETW | lpqsResults,
 |  | DWORD | dwResolution,
 |  | LPWSTR | lpszAliasBuffer,
 |  | LPDWORD | lpdwAliasBufferLength,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 3438 of file DtHandler.Cpp.

                                                   {

    return (false);

} // DTHandler::NSPGetAddressByName()

bool DTHandler::NSPGetServiceClassInfo | ( | IN LPGUID | lpProviderId,
 |  | IN OUT LPDWORD | lpdwBufSize,
 |  | IN OUT LPWSASERVICECLASSINFOW | lpServiceClassInfo,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 3534 of file DtHandler.Cpp.

                                                      {

    return (false);

} // DTHandler::NSPGetServiceClassInfo()

bool DTHandler::NSPGetServiceClassNameByClassId | ( | LPGUID | lpServiceClassId,
 |  | LPWSTR | lpszServiceClassName,
 |  | LPDWORD | lpdwBufferLength,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 3556 of file DtHandler.Cpp.

                                                                                {

    return (false);

} // DTHandler::NSPGetServiceClassNameByClassId()

bool DTHandler::NSPInstallServiceClass | ( | LPGUID | lpProviderId,
 |  | LPWSASERVICECLASSINFOW | lpServiceClassInfo,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 3469 of file DtHandler.Cpp.

                                                      {

    return (false);

} // DTHandler::NSPInstallServiceClass()

bool DTHandler::NSPLookupServiceBegin | ( | LPGUID | lpProviderId,
 |  | LPWSAQUERYSETW | lpqsRestrictions,
 |  | LPWSASERVICECLASSINFOW | lpServiceClassInfo,
 |  | DWORD | dwControlFlags,
 |  | LPHANDLE | lphLookup,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 3371 of file DtHandler.Cpp.

                                                     {

    return (false);

} // DTHandler::NSPLookupServiceBegin()

bool DTHandler::NSPLookupServiceEnd | ( | HANDLE | hLookup,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 3420 of file DtHandler.Cpp.

                                                                 {

    return (false);

} // DTHandler::NSPLookupServiceEnd()

bool DTHandler::NSPLookupServiceNext | ( | HANDLE | hLookup,
 |  | DWORD | dwControlFlags,
 |  | LPDWORD | lpdwBufferLength,
 |  | LPWSAQUERYSET | lpqsResults,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 3397 of file DtHandler.Cpp.

                                                                               {

    return (false);

} // DTHandler::NSPLookupServiceNext()

bool DTHandler::NSPRemoveServiceClass | ( | IN LPGUID | lpProviderId,
 |  | IN LPGUID | lpServiceClassId,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 3514 of file DtHandler.Cpp.

                                                     {

    return (false);

} // DTHandler::NSPRemoveServiceClass()

bool DTHandler::NSPSetService | ( | LPGUID | lpProviderId,
 |  | LPWSASERVICECLASSINFOW | lpServiceClassInfo,
 |  | LPWSAQUERYSETW | lpqsRegInfo,
 |  | WSAESETSERVICEOP | essOperation,
 |  | DWORD | dwControlFlags,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 3489 of file DtHandler.Cpp.

                                                                   {

    return (false);

} // DTHandler::NSPSetService()

bool DTHandler::NSPStringToAddress | ( | LPWSTR | AddressString,
 |  | INT | AddressFamily,
 |  | LPWSAPROTOCOL_INFOW | lpProtocolInfo,
 |  | LPSOCKADDR | lpAddress,
 |  | LPINT | lpAddressLength,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 3346 of file DtHandler.Cpp.

                                                                         {

    return (false);

} // DTHandler::NSPStringToAddress()

virtual bool DTHandler::ntohl | ( | unsigned long | netlong,
 |  | APIHook< unsigned long > & | hook |
 | ) |  |  | [protected, virtual]
bool DTHandler::ntohs | ( | unsigned short | netshort,
 |  | APIHook< unsigned short > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 474 of file DtHandler.Cpp.

                                                                       {

    return (false);

} // DTHandler::ntohs()

virtual bool DTHandler::recv | ( | SOCKET | s,
 |  | char FAR * | buf,
 |  | int | len,
 |  | int | flags,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Reimplemented in SocketMonitor.

virtual bool DTHandler::recvfrom | ( | SOCKET | s,
 |  | char FAR * | buf,
 |  | int | len,
 |  | int | flags,
 |  | struct sockaddr FAR * | from,
 |  | int FAR * | fromlen,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]
virtual bool DTHandler::select | ( | int | nfds,
 |  | fd_set FAR * | readfds,
 |  | fd_set FAR * | writefds,
 |  | fd_set FAR * | exceptfds,
 |  | const struct timeval FAR * | timeout,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]
virtual bool DTHandler::send | ( | SOCKET | s,
 |  | const char FAR * | buf,
 |  | int | len,
 |  | int | flags,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Reimplemented in SocketMonitor.

virtual bool DTHandler::sendto | ( | SOCKET | s,
 |  | const char FAR * | buf,
 |  | int | len,
 |  | int | flags,
 |  | const struct sockaddr FAR * | to,
 |  | int | tolen,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]
virtual bool DTHandler::setsockopt | ( | SOCKET | s,
 |  | int | level,
 |  | int | optname,
 |  | const char FAR * | optval,
 |  | int | optlen,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]
bool DTHandler::shutdown | ( | SOCKET | s,
 |  | int | how,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 625 of file DtHandler.Cpp.

                                                         {

    return (false);

} // DTHandler::shutdown()

bool DTHandler::socket | ( | int | af,
 |  | int | type,
 |  | int | protocol,
 |  | APIHook< SOCKET > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 644 of file DtHandler.Cpp.

                                                                       {

    return (false);

} // DTHandler::socket()

bool DTHandler::WPUCloseEvent | ( | WSAEVENT | hEvent,
 |  | LPINT | lpErrno,
 |  | APIHook< BOOL > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 2532 of file DtHandler.Cpp.

                                                                            {

    return (false);

} // DTHandler::WPUCloseEvent()

bool DTHandler::WPUCloseSocketHandle | ( | SOCKET | s,
 |  | LPINT | lpErrno,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 2551 of file DtHandler.Cpp.

                                                                           {

    return (false);

} // DTHandler::WPUCloseSocketHandle()

bool DTHandler::WPUCreateEvent | ( | LPINT | lpErrno,
 |  | APIHook< WSAEVENT > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 2570 of file DtHandler.Cpp.

                                                                {

    return (false);

} // DTHandler::WPUCreateEvent()

bool DTHandler::WPUCreateSocketHandle | ( | DWORD | dwCatalogEntryId,
 |  | DWORD | dwContext,
 |  | LPINT | lpErrno,
 |  | APIHook< SOCKET > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 2588 of file DtHandler.Cpp.

                                                                       {

    return (false);

} // DTHandler::WPUCreateSocketHandle()

virtual bool DTHandler::WPUFDIsSet | ( | SOCKET | s,
 |  | FD_SET FAR * | set,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]
bool DTHandler::WPUGetProviderPath | ( | LPGUID | lpProviderId,
 |  | LPWSTR | lpszProviderDllPath,
 |  | LPINT | lpProviderDllPathLen,
 |  | LPINT | lpErrno,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 2798 of file DtHandler.Cpp.

                                                  {

    return (false);

} // DTHandler::WPUGetProviderPath()

bool DTHandler::WPUModifyIFSHandle | ( | DWORD | dwCatalogEntryId,
 |  | SOCKET | ProposedHandle,
 |  | LPINT | lpErrno,
 |  | APIHook< SOCKET > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 2653 of file DtHandler.Cpp.

                                                                    {

    return (false);

} // DTHandler::WPUModifyIFSHandle()

bool DTHandler::WPUPostMessage | ( | HWND | hWnd,
 |  | UINT | Msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | APIHook< BOOL > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 2822 of file DtHandler.Cpp.

                                                                                {

    return (false);

} // DTHandler::WPUPostMessage()

virtual bool DTHandler::WPUQueryBlockingCallback | ( | DWORD | dwCatalogEntryId,
 |  | LPBLOCKINGCALLBACK FAR * | lplpfnCallback,
 |  | LPDWORD | lpdwContext,
 |  | LPINT | lpErrno,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]
bool DTHandler::WPUQuerySocketHandleContext | ( | SOCKET | s,
 |  | LPDWORD | lpContext,
 |  | LPINT | lpErrno,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 2698 of file DtHandler.Cpp.

                                                                          {

    return (false);

} // DTHandler::WPUQuerySocketHandleContext()

bool DTHandler::WPUQueueApc | ( | LPWSATHREADID | lpThreadId,
 |  | LPWSAUSERAPC | lpfnUserApc,
 |  | DWORD | dwContext,
 |  | LPINT | lpErrno,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 2719 of file DtHandler.Cpp.

                                                                           {

    return (false);

} // DTHandler::WPUQueueApc()

bool DTHandler::WPUResetEvent | ( | WSAEVENT | hEvent,
 |  | LPINT | lpErrno,
 |  | APIHook< BOOL > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 2741 of file DtHandler.Cpp.

                                                                            {

    return (false);

} // DTHandler::WPUResetEvent()

bool DTHandler::WPUSetEvent | ( | WSAEVENT | hEvent,
 |  | LPINT | lpErrno,
 |  | APIHook< BOOL > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 2760 of file DtHandler.Cpp.

                                                                          {

    return (false);

} // DTHandler::WPUSetEvent()

virtual bool DTHandler::WSAAccept | ( | SOCKET | s,
 |  | struct sockaddr FAR * | addr,
 |  | int FAR * | addrlen,
 |  | LPCONDITIONPROC | lpfnCondition,
 |  | unsigned long | dwCallbackData,
 |  | APIHook< SOCKET > & | hook |
 | ) |  |  | [protected, virtual]
bool DTHandler::WSAAddressToStringA | ( | LPSOCKADDR | lpsaAddress,
 |  | DWORD | dwAddressLength,
 |  | LPWSAPROTOCOL_INFOA | lpProtocolInfo,
 |  | OUT LPTSTR | lpszAddressString,
 |  | IN OUT LPDWORD | lpdwAddressStringLength,
 |  | APIHook< INT > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 2885 of file DtHandler.Cpp.

                                                                                {

    return (false);

} // DTHandler::WSAAddressToStringA()

bool DTHandler::WSAAddressToStringW | ( | LPSOCKADDR | lpsaAddress,
 |  | DWORD | dwAddressLength,
 |  | LPWSAPROTOCOL_INFOW | lpProtocolInfo,
 |  | OUT LPTSTR | lpszAddressString,
 |  | IN OUT LPDWORD | lpdwAddressStringLength,
 |  | APIHook< INT > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 2910 of file DtHandler.Cpp.

                                                                                {

    return (false);

} // DTHandler::WSAAddressToStringW()

virtual bool DTHandler::WSAAsyncGetHostByAddr | ( | HWND | hWnd,
 |  | unsigned int | wMsg,
 |  | const char FAR * | addr,
 |  | int | len,
 |  | int | type,
 |  | char FAR * | buf,
 |  | int | buflen,
 |  | APIHook< HANDLE > & | hook |
 | ) |  |  | [protected, virtual]
virtual bool DTHandler::WSAAsyncGetHostByName | ( | HWND | hWnd,
 |  | unsigned int | wMsg,
 |  | const char FAR * | name,
 |  | char FAR * | buf,
 |  | int | buflen,
 |  | APIHook< HANDLE > & | hook |
 | ) |  |  | [protected, virtual]
virtual bool DTHandler::WSAAsyncGetProtoByName | ( | HWND | hWnd,
 |  | unsigned int | wMsg,
 |  | const char FAR * | name,
 |  | char FAR * | buf,
 |  | int | buflen,
 |  | APIHook< HANDLE > & | hook |
 | ) |  |  | [protected, virtual]
virtual bool DTHandler::WSAAsyncGetProtoByNumber | ( | HWND | hWnd,
 |  | unsigned int | wMsg,
 |  | int | number,
 |  | char FAR * | buf,
 |  | int | buflen,
 |  | APIHook< HANDLE > & | hook |
 | ) |  |  | [protected, virtual]
virtual bool DTHandler::WSAAsyncGetServByName | ( | HWND | hWnd,
 |  | unsigned int | wMsg,
 |  | const char FAR * | name,
 |  | const char FAR * | proto,
 |  | char FAR * | buf,
 |  | int | buflen,
 |  | APIHook< HANDLE > & | hook |
 | ) |  |  | [protected, virtual]
virtual bool DTHandler::WSAAsyncGetServByPort | ( | HWND | hWnd,
 |  | unsigned int | wMsg,
 |  | int | port,
 |  | const char FAR * | proto,
 |  | char FAR * | buf,
 |  | int | buflen,
 |  | APIHook< HANDLE > & | hook |
 | ) |  |  | [protected, virtual]
bool DTHandler::WSAAsyncSelect | ( | SOCKET | s,
 |  | HWND | hWnd,
 |  | unsigned int | wMsg,
 |  | long | lEvent,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 687 of file DtHandler.Cpp.

                                                                                {

    return (false);

} // DTHandler::WSAAsyncSelect()

bool DTHandler::WSACancelAsyncRequest | ( | HANDLE | hAsyncTaskHandle,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 1789 of file DtHandler.Cpp.

                                                                            {

    return (false);

} // DTHandler::WSACancelAsyncRequest()

bool DTHandler::WSACancelBlockingCall ( APIHook< int > & hook ) [protected, virtual]

Definition at line 708 of file DtHandler.Cpp.

                                                   {

    return (false);

} // DTHandler::WSACancelBlockingCall()

bool DTHandler::WSACleanup ( APIHook< int > & hook ) [protected, virtual]

Reimplemented in SocketMonitor.

Definition at line 724 of file DtHandler.Cpp.

                                        {

    return (false);

} // DTHandler::WSACleanup()

bool DTHandler::WSACloseEvent | ( | WSAEVENT | hEvent,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 740 of file DtHandler.Cpp.

                                                            {

    return (false);

} // DTHandler::WSACloseEvent()

virtual bool DTHandler::WSAConnect | ( | SOCKET | s,
 |  | const struct sockaddr FAR * | name,
 |  | int | namelen,
 |  | LPWSABUF | lpCallerData,
 |  | LPWSABUF | lpCalleeData,
 |  | LPQOS | lpSQOS,
 |  | LPQOS | lpGQOS,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]
bool DTHandler::WSACreateEvent ( APIHook< WSAEVENT > & hook ) [protected, virtual]

Definition at line 783 of file DtHandler.Cpp.

                                                 {

    return (false);

} // DTHandler::WSACreateEvent()

bool DTHandler::WSADuplicateSocketA | ( | SOCKET | s,
 |  | DWORD | dwProcessId,
 |  | LPWSAPROTOCOL_INFOA | lpProtocolInfo,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 799 of file DtHandler.Cpp.

                                                                                {

    return (false);

} // DTHandler::WSADuplicateSocketA()

bool DTHandler::WSADuplicateSocketW | ( | SOCKET | s,
 |  | DWORD | dwProcessId,
 |  | LPWSAPROTOCOL_INFOW | lpProtocolInfo,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 819 of file DtHandler.Cpp.

                                                                                {

    return (false);

} // DTHandler::WSADuplicateSocketW()

bool DTHandler::WSAEnumNameSpaceProvidersA | ( | IN OUT LPDWORD | lpdwBufferLength,
 |  | OUT LPWSANAMESPACE_INFOA | lpnspBuffer,
 |  | APIHook< INT > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 3235 of file DtHandler.Cpp.

                                                          {

    return (false);

} // DTHandler::WSAEnumNameSpaceProvidersA()

bool DTHandler::WSAEnumNameSpaceProvidersW | ( | IN OUT LPDWORD | lpdwBufferLength,
 |  | OUT LPWSANAMESPACE_INFOW | lpnspBuffer,
 |  | APIHook< INT > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 3256 of file DtHandler.Cpp.

                                                          {

    return (false);

} // DTHandler::WSAEnumNameSpaceProvidersW()

bool DTHandler::WSAEnumNetworkEvents | ( | SOCKET | s,
 |  | WSAEVENT | hEventObject,
 |  | LPWSANETWORKEVENTS | lpNetworkEvents,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 839 of file DtHandler.Cpp.

                                                                                {

    return (false);

} // DTHandler::WSAEnumNetworkEvents()

bool DTHandler::WSAEnumProtocolsA | ( | LPINT | lpiProtocols,
 |  | LPWSAPROTOCOL_INFOA | lpProtocolBuffer,
 |  | LPDWORD | lpdwBufferLength,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 859 of file DtHandler.Cpp.

                                                                           {

    return (false);

} // DTHandler::WSAEnumProtocolsA()

bool DTHandler::WSAEnumProtocolsW | ( | LPINT | lpiProtocols,
 |  | LPWSAPROTOCOL_INFOW | lpProtocolBuffer,
 |  | LPDWORD | lpdwBufferLength,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 880 of file DtHandler.Cpp.

                                                                           {

    return (false);

} // DTHandler::WSAEnumProtocolsW()

bool DTHandler::WSAEventSelect | ( | SOCKET | s,
 |  | WSAEVENT | hEventObject,
 |  | long | lNetworkEvents,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 901 of file DtHandler.Cpp.

                                                                                {

    return (false);

} // DTHandler::WSAEventSelect()

bool DTHandler::WSAGetLastError ( APIHook< int > & hook ) [protected, virtual]

Definition at line 921 of file DtHandler.Cpp.

                                             {

    return (false);

} // DTHandler::WSAGetLastError()

virtual bool DTHandler::WSAGetOverlappedResult | ( | SOCKET | s,
 |  | LPWSAOVERLAPPED | lpOverlapped,
 |  | LPDWORD | lpcbTransfer,
 |  | BOOL | fWait,
 |  | unsigned long * | lpdwFlags,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]
bool DTHandler::WSAGetQOSByName | ( | SOCKET | s,
 |  | LPWSABUF | lpQOSName,
 |  | LPQOS | lpQOS,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 960 of file DtHandler.Cpp.

                                                                                {

    return (false);

} // DTHandler::WSAGetQOSByName()

bool DTHandler::WSAGetServiceClassInfoA | ( | LPGUID | lpProviderId,
 |  | LPGUID | lpServiceClassId,
 |  | LPDWORD | lpdwBufferLength,
 |  | LPWSASERVICECLASSINFOA | lpServiceClassInfo,
 |  | APIHook< INT > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 3187 of file DtHandler.Cpp.

                                                       {

    return (false);

} // DTHandler::WSAGetServiceClassInfoA()

bool DTHandler::WSAGetServiceClassInfoW | ( | LPGUID | lpProviderId,
 |  | LPGUID | lpServiceClassId,
 |  | LPDWORD | lpdwBufferLength,
 |  | LPWSASERVICECLASSINFOW | lpServiceClassInfo,
 |  | APIHook< INT > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 3211 of file DtHandler.Cpp.

                                                       {

    return (false);

} // DTHandler::WSAGetServiceClassInfoW()

bool DTHandler::WSAGetServiceClassNameByClassIdA | ( | LPGUID | lpServiceClassId,
 |  | LPSTR | lpszServiceClassName,
 |  | LPDWORD | lpdwBufferLength,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 3277 of file DtHandler.Cpp.

                                                                                {

    return (false);

} // DTHandler::WSAGetServiceClassNameByClassIdA()

bool DTHandler::WSAGetServiceClassNameByClassIdW | ( | LPGUID | lpServiceClassId,
 |  | LPWSTR | lpszServiceClassName,
 |  | LPDWORD | lpdwBufferLength,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 3299 of file DtHandler.Cpp.

                                                                                {

    return (false);

} // DTHandler::WSAGetServiceClassNameByClassIdW()

virtual bool DTHandler::WSAHtonl | ( | SOCKET | s,
 |  | unsigned long | hostlong,
 |  | unsigned long FAR * | lpnetlong,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]
virtual bool DTHandler::WSAHtons | ( | SOCKET | s,
 |  | unsigned short | hostshort,
 |  | unsigned short FAR * | lpnetshort,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]
bool DTHandler::WSAInstallServiceClassA | ( | LPWSASERVICECLASSINFOA | lpServiceClassInfo,
 |  | APIHook< INT > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 3091 of file DtHandler.Cpp.

                                                                                {

    return (false);

} // DTHandler::WSAInstallServiceClassA()

bool DTHandler::WSAInstallServiceClassW | ( | LPWSASERVICECLASSINFOW | lpServiceClassInfo,
 |  | APIHook< INT > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 3109 of file DtHandler.Cpp.

                                                                                {

    return (false);

} // DTHandler::WSAInstallServiceClassW()

bool DTHandler::WSAIoctl | ( | SOCKET | s,
 |  | DWORD | dwIoControlCode,
 |  | LPVOID | lpvInBuffer,
 |  | DWORD | cbInBuffer,
 |  | LPVOID | lpvOutBuffer,
 |  | DWORD | cbOutBuffer,
 |  | LPDWORD | lpcbBytesReturned,
 |  | LPWSAOVERLAPPED | lpOverlapped,
 |  | LPWSAOVERLAPPED_COMPLETION_ROUTINE | lpCompletionRoutine,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 1020 of file DtHandler.Cpp.

                                                                                {

    return (false);

} // DTHandler::WSAIoctl()

bool DTHandler::WSAIsBlocking ( APIHook< int > & hook ) [protected, virtual]

Definition at line 1052 of file DtHandler.Cpp.

                                           {

    return (false);

} // DTHandler::WSAIsBlocking()

bool DTHandler::WSAJoinLeaf | ( | SOCKET | s,
 |  | const struct sockaddr * | name,
 |  | int | namelen,
 |  | LPWSABUF | lpCallerData,
 |  | LPWSABUF | lpCalleeData,
 |  | LPQOS | lpSQOS,
 |  | LPQOS | lpGQOS,
 |  | DWORD | dwFlags,
 |  | APIHook< SOCKET > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 1068 of file DtHandler.Cpp.

                                              {

    return (false);

} // DTHandler::WSAJoinLeaf()

bool DTHandler::WSALookupServiceBeginA | ( | LPWSAQUERYSETA | lpqsRestrictions,
 |  | DWORD | dwControlFlags,
 |  | LPHANDLE | lphLookup,
 |  | APIHook< INT > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 2985 of file DtHandler.Cpp.

                                                                          {

    return (false);

} // DTHandler::WSALookupServiceBeginA()

bool DTHandler::WSALookupServiceBeginW | ( | LPWSAQUERYSETW | lpqsRestrictions,
 |  | DWORD | dwControlFlags,
 |  | LPHANDLE | lphLookup,
 |  | APIHook< INT > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 3006 of file DtHandler.Cpp.

                                                                          {

    return (false);

} // DTHandler::WSALookupServiceBeginW()

bool DTHandler::WSALookupServiceEnd | ( | HANDLE | hLookup,
 |  | APIHook< INT > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 3073 of file DtHandler.Cpp.

                                                                 {

    return (false);

} // DTHandler::WSALookupServiceEnd()

bool DTHandler::WSALookupServiceNextA | ( | HANDLE | hLookup,
 |  | DWORD | dwControlFlags,
 |  | LPDWORD | lpdwBufferLength,
 |  | LPWSAQUERYSETA | lpqsResults,
 |  | APIHook< INT > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 3027 of file DtHandler.Cpp.

                                                                                {

    return (false);

} // DTHandler::WSALookupServiceNextA()

bool DTHandler::WSALookupServiceNextW | ( | HANDLE | hLookup,
 |  | DWORD | dwControlFlags,
 |  | LPDWORD | lpdwBufferLength,
 |  | LPWSAQUERYSETW | lpqsResults,
 |  | APIHook< INT > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 3050 of file DtHandler.Cpp.

                                                                                {

    return (false);

} // DTHandler::WSALookupServiceNextW()

bool DTHandler::WSANtohl | ( | SOCKET | s,
 |  | unsigned long | netlong,
 |  | unsigned long * | lphostlong,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 1097 of file DtHandler.Cpp.

                                                                                {

    return (false);

} // DTHandler::WSANtohl()

bool DTHandler::WSANtohs | ( | SOCKET | s,
 |  | unsigned short | netshort,
 |  | unsigned short * | lphostshort,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 1117 of file DtHandler.Cpp.

                                                                                {

    return (false);

} // DTHandler::WSANtohs()

bool DTHandler::WSARecv | ( | SOCKET | s,
 |  | LPWSABUF | lpBuffers,
 |  | DWORD | dwBufferCount,
 |  | LPDWORD | lpNumberOfBytesRecvd,
 |  | LPDWORD | lpFlags,
 |  | LPWSAOVERLAPPED | lpOverlapped,
 |  | LPWSAOVERLAPPED_COMPLETION_ROUTINE | lpCompletionRoutine,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 1137 of file DtHandler.Cpp.

                                       {

    return (false);

} // DTHandler::WSARecv()

bool DTHandler::WSARecvDisconnect | ( | SOCKET | s,
 |  | LPWSABUF | lpInboundDisconnectData,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 1167 of file DtHandler.Cpp.

                                                                                {

    return (false);

} // DTHandler::WSARecvDisconnect()

bool DTHandler::WSARecvFrom | ( | SOCKET | s,
 |  | LPWSABUF | lpBuffers,
 |  | DWORD | dwBufferCount,
 |  | LPDWORD | lpNumberOfBytesRecvd,
 |  | LPDWORD | lpFlags,
 |  | struct sockaddr * | lpFrom,
 |  | LPINT | lpFromlen,
 |  | LPWSAOVERLAPPED | lpOverlapped,
 |  | LPWSAOVERLAPPED_COMPLETION_ROUTINE | lpCompletionRoutine,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 1186 of file DtHandler.Cpp.

                                           {

    return (false);

} // DTHandler::WSARecvFrom()

bool DTHandler::WSARemoveServiceClass | ( | LPGUID | lpServiceClassId,
 |  | APIHook< INT > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 3169 of file DtHandler.Cpp.

                                                                            {

    return (false);

} // DTHandler::WSARemoveServiceClass()

bool DTHandler::WSAResetEvent | ( | WSAEVENT | hEvent,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 1219 of file DtHandler.Cpp.

                                                            {

    return (false);

} // DTHandler::WSAResetEvent()

bool DTHandler::WSASend | ( | SOCKET | s,
 |  | LPWSABUF | lpBuffers,
 |  | DWORD | dwBufferCount,
 |  | LPDWORD | lpNumberOfBytesSent,
 |  | DWORD | dwFlags,
 |  | LPWSAOVERLAPPED | lpOverlapped,
 |  | LPWSAOVERLAPPED_COMPLETION_ROUTINE | lpCompletionRoutine,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 1237 of file DtHandler.Cpp.

                                       {

    return (false);

} // DTHandler::WSASend()

bool DTHandler::WSASendDisconnect | ( | SOCKET | s,
 |  | LPWSABUF | lpOutboundDisconnectData,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 1266 of file DtHandler.Cpp.

                                                                                {

    return (false);

} // DTHandler::WSASendDisconnect()

bool DTHandler::WSASendTo | ( | SOCKET | s,
 |  | LPWSABUF | lpBuffers,
 |  | DWORD | dwBufferCount,
 |  | LPDWORD | lpNumberOfBytesSent,
 |  | DWORD | dwFlags,
 |  | const struct sockaddr * | lpTo,
 |  | int | iTolen,
 |  | LPWSAOVERLAPPED | lpOverlapped,
 |  | LPWSAOVERLAPPED_COMPLETION_ROUTINE | lpCompletionRoutine,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 1285 of file DtHandler.Cpp.

                                         {

    return (false);

} // DTHandler::WSASendTo()

bool DTHandler::WSASetBlockingHook | ( | FARPROC | lpBlockFunc,
 |  | APIHook< FARPROC > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 1316 of file DtHandler.Cpp.

                                                                         {

    return (false);

} // DTHandler::WSASetBlockingHook()

bool DTHandler::WSASetEvent | ( | WSAEVENT | hEvent,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 1334 of file DtHandler.Cpp.

                                                          {

    return (false);

} // DTHandler::WSASetEvent()

bool DTHandler::WSASetLastError | ( | int | iError,
 |  | APIHook< void > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 1352 of file DtHandler.Cpp.

                                                          {

    return (false);

} // DTHandler::WSASetLastError()

bool DTHandler::WSASetServiceA | ( | LPWSAQUERYSETA | lpqsRegInfo,
 |  | WSAESETSERVICEOP | essOperation,
 |  | DWORD | dwControlFlags,
 |  | APIHook< INT > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 3127 of file DtHandler.Cpp.

                                                                    {

    return (false);

} // DTHandler::WSASetServiceA()

bool DTHandler::WSASetServiceW | ( | LPWSAQUERYSETW | lpqsRegInfo,
 |  | WSAESETSERVICEOP | essOperation,
 |  | DWORD | dwControlFlags,
 |  | APIHook< INT > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 3148 of file DtHandler.Cpp.

                                                                    {

    return (false);

} // DTHandler::WSASetServiceW()

bool DTHandler::WSASocketA | ( | int | af,
 |  | int | type,
 |  | int | protocol,
 |  | LPWSAPROTOCOL_INFOA | lpProtocolInfo,
 |  | GROUP | g,
 |  | DWORD | dwFlags,
 |  | APIHook< SOCKET > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 1370 of file DtHandler.Cpp.

                                                                     {

    return (false);

} // DTHandler::WSASocketA()

bool DTHandler::WSASocketW | ( | int | af,
 |  | int | type,
 |  | int | protocol,
 |  | LPWSAPROTOCOL_INFOW | lpProtocolInfo,
 |  | GROUP | g,
 |  | DWORD | dwFlags,
 |  | APIHook< SOCKET > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 1394 of file DtHandler.Cpp.

                                                                     {

    return (false);

} // DTHandler::WSASocketW()

bool DTHandler::WSAStartup | ( | WORD | wVersionRequested,
 |  | LPWSADATA | lpWSAData,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Reimplemented in SocketMonitor.

Definition at line 1418 of file DtHandler.Cpp.

                                                                                {

    return (false);

} // DTHandler::WSAStartup()

bool DTHandler::WSAStringToAddressA | ( | LPTSTR | AddressString,
 |  | INT | AddressFamily,
 |  | LPWSAPROTOCOL_INFOA | lpProtocolInfo,
 |  | LPSOCKADDR | lpAddress,
 |  | LPINT | lpAddressLength,
 |  | APIHook< INT > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 2935 of file DtHandler.Cpp.

                                                                          {

    return (false);

} // DTHandler::WSAStringToAddressA()

bool DTHandler::WSAStringToAddressW | ( | LPTSTR | AddressString,
 |  | INT | AddressFamily,
 |  | LPWSAPROTOCOL_INFOW | lpProtocolInfo,
 |  | LPSOCKADDR | lpAddress,
 |  | LPINT | lpAddressLength,
 |  | APIHook< INT > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 2960 of file DtHandler.Cpp.

                                                                      {

    return (false);

} // DTHandler::WSAStringToAddressW()

bool DTHandler::WSAUnhookBlockingHook ( APIHook< int > & hook ) [protected, virtual]

Definition at line 1437 of file DtHandler.Cpp.

                                                   {

    return (false);

} // DTHandler::WSAUnhookBlockingHook()

virtual bool DTHandler::WSAWaitForMultipleEvents | ( | DWORD | cEvents,
 |  | const WSAEVENT FAR * | lphEvents,
 |  | BOOL | fWaitAll,
 |  | DWORD | dwTimeout,
 |  | BOOL | fAlertable,
 |  | APIHook< DWORD > & | hook |
 | ) |  |  | [protected, virtual]
bool DTHandler::WSCDeinstallProvider | ( | LPGUID | lpProviderId,
 |  | LPINT | lpErrno,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 2609 of file DtHandler.Cpp.

                                                                                {

    return (false);

} // DTHandler::WSCDeinstallProvider()

bool DTHandler::WSCEnableNSProvider | ( | LPGUID | lpProviderId,
 |  | BOOL | fEnable,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 3645 of file DtHandler.Cpp.

                                                                                {

    return (false);

} // DTHandler::WSCEnableNSProvider()

bool DTHandler::WSCEnumProtocols | ( | LPINT | lpiProtocols,
 |  | LPWSAPROTOCOL_INFOW | lpProtocolBuffer,
 |  | LPDWORD | lpdwBufferLength,
 |  | LPINT | lpErrno,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 2862 of file DtHandler.Cpp.

                                                                                {

    return (false);

} // DTHandler::WSCEnumProtocols()

bool DTHandler::WSCGetProviderPath | ( | LPGUID | lpProviderId,
 |  | LPWSTR | lpszProviderDllPath,
 |  | LPINT | lpProviderDllPathLen,
 |  | LPINT | lpErrno,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 3578 of file DtHandler.Cpp.

                                                  {

    return (false);

} // DTHandler::WSCGetProviderPath()

bool DTHandler::WSCInstallNameSpace | ( | LPWSTR | lpszIdentifier,
 |  | LPWSTR | lpszPathName,
 |  | DWORD | dwNameSpace,
 |  | DWORD | dwVersion,
 |  | LPGUID | lpProviderId,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 3602 of file DtHandler.Cpp.

                                                                        {

    return (false);

} // DTHandler::WSCInstallNameSpace()

bool DTHandler::WSCInstallProvider | ( | const LPGUID | lpProviderId,
 |  | const LPWSTR | lpszProviderDllPath,
 |  | const LPWSAPROTOCOL_INFOW | lpProtocolInfoList,
 |  | DWORD | dwNumberOfEntries,
 |  | LPINT | lpErrno,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 2628 of file DtHandler.Cpp.

                                                                                {

    return (false);

} // DTHandler::WSCInstallProvider()

bool DTHandler::WSCUnInstallNameSpace | ( | LPGUID | lpProviderId,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 3627 of file DtHandler.Cpp.

                                                                        {

    return (false);

} // DTHandler::WSCUnInstallNameSpace()

virtual bool DTHandler::WSPAccept | ( | SOCKET | s,
 |  | struct sockaddr FAR * | addr,
 |  | LPINT | addrlen,
 |  | LPCONDITIONPROC | lpfnCondition,
 |  | DWORD | dwCallbackData,
 |  | LPINT | lpErrno,
 |  | APIHook< SOCKET > & | hook |
 | ) |  |  | [protected, virtual]
bool DTHandler::WSPAddressToString | ( | LPSOCKADDR | lpsaAddress,
 |  | DWORD | dwAddressLength,
 |  | LPWSAPROTOCOL_INFOW | lpProtocolInfo,
 |  | LPWSTR | lpszAddressString,
 |  | LPDWORD | lpdwAddressStringLength,
 |  | LPINT | lpErrno,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 3663 of file DtHandler.Cpp.

                                                                 {

    return (false);

} // DTHandler::WSPAddressToString()

bool DTHandler::WSPAsyncSelect | ( | SOCKET | s,
 |  | HWND | hWnd,
 |  | unsigned int | wMsg,
 |  | long | lEvent,
 |  | LPINT | lpErrno,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 1832 of file DtHandler.Cpp.

                                                                          {

    return (false);

} // DTHandler::WSPAsyncSelect()

virtual bool DTHandler::WSPBind | ( | SOCKET | s,
 |  | const struct sockaddr FAR * | name,
 |  | int | namelen,
 |  | LPINT | lpErrno,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]
bool DTHandler::WSPCancelBlockingCall | ( | LPINT | lpErrno,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 1877 of file DtHandler.Cpp.

                                                                  {

    return (false);

} // DTHandler::WSPCancelBlockingCall()

bool DTHandler::WSPCleanup | ( | LPINT | lpErrno,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 1895 of file DtHandler.Cpp.

                                                       {

    return (false);

} // DTHandler::WSPCleanup()

bool DTHandler::WSPCloseSocket | ( | SOCKET | s,
 |  | LPINT | lpErrno,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 1913 of file DtHandler.Cpp.

                                                                     {

    return (false);

} // DTHandler::WSPCloseSocket()

virtual bool DTHandler::WSPConnect | ( | SOCKET | s,
 |  | const struct sockaddr FAR * | name,
 |  | int | namelen,
 |  | LPWSABUF | lpCallerData,
 |  | LPWSABUF | lpCalleeData,
 |  | LPQOS | lpSQOS,
 |  | LPQOS | lpGQOS,
 |  | LPINT | lpErrno,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]
bool DTHandler::WSPDuplicateSocket | ( | SOCKET | s,
 |  | DWORD | dwProcessId,
 |  | LPWSAPROTOCOL_INFOW | lpProtocolInfo,
 |  | LPINT | lpErrno,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 1961 of file DtHandler.Cpp.

                                                  {

    return (false);

} // DTHandler::WSPDuplicateSocket()

bool DTHandler::WSPEnumNetworkEvents | ( | SOCKET | s,
 |  | WSAEVENT | hEventObject,
 |  | LPWSANETWORKEVENTS | lpNetworkEvents,
 |  | LPINT | lpErrno,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 1984 of file DtHandler.Cpp.

                                                    {

    return (false);

} // DTHandler::WSPEnumNetworkEvents()

bool DTHandler::WSPEventSelect | ( | SOCKET | s,
 |  | WSAEVENT | hEventObject,
 |  | long | lNetworkEvents,
 |  | LPINT | lpErrno,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 2007 of file DtHandler.Cpp.

                                                             {

    return (false);

} // DTHandler::WSPEventSelect()

bool DTHandler::WSPGetOverlappedResult | ( | SOCKET | s,
 |  | LPWSAOVERLAPPED | lpOverlapped,
 |  | LPDWORD | lpcbTransfer,
 |  | BOOL | fWait,
 |  | LPDWORD | lpdwFlags,
 |  | LPINT | lpErrno,
 |  | APIHook< BOOL > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 2029 of file DtHandler.Cpp.

                                                                      {

    return (false);

} // DTHandler::WSPGetOverlappedResult()

virtual bool DTHandler::WSPGetPeerName | ( | SOCKET | s,
 |  | struct sockaddr FAR * | name,
 |  | LPINT | namelen,
 |  | LPINT | lpErrno,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]
bool DTHandler::WSPGetQOSByName | ( | SOCKET | s,
 |  | LPWSABUF | lpQOSName,
 |  | LPQOS | lpQOS,
 |  | LPINT | lpErrno,
 |  | APIHook< BOOL > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 2123 of file DtHandler.Cpp.

                                                               {

    return (false);

} // DTHandler::WSPGetQOSByName()

virtual bool DTHandler::WSPGetSockName | ( | SOCKET | s,
 |  | struct sockaddr FAR * | name,
 |  | LPINT | namelen,
 |  | LPINT | lpErrno,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]
virtual bool DTHandler::WSPGetSockOpt | ( | SOCKET | s,
 |  | int | level,
 |  | int | optname,
 |  | char FAR * | optval,
 |  | LPINT | optlen,
 |  | LPINT | lpErrno,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]
bool DTHandler::WSPIoctl | ( | SOCKET | s,
 |  | DWORD | dwIoControlCode,
 |  | LPVOID | lpvInBuffer,
 |  | DWORD | cbInBuffer,
 |  | LPVOID | lpvOutBuffer,
 |  | DWORD | cbOutBuffer,
 |  | LPDWORD | lpcbBytesReturned,
 |  | LPWSAOVERLAPPED | lpOverlapped,
 |  | LPWSAOVERLAPPED_COMPLETION_ROUTINE | lpCompletionRoutine,
 |  | LPWSATHREADID | lpThreadId,
 |  | LPINT | lpErrno,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 2145 of file DtHandler.Cpp.

                                        {

    return (false);

} // DTHandler::WSPIoctl()

virtual bool DTHandler::WSPJoinLeaf | ( | SOCKET | s,
 |  | const struct sockaddr FAR * | name,
 |  | int | namelen,
 |  | LPWSABUF | lpCallerData,
 |  | LPWSABUF | lpCalleeData,
 |  | LPQOS | lpSQOS,
 |  | LPQOS | lpGQOS,
 |  | DWORD | dwFlags,
 |  | LPINT | lpErrno,
 |  | APIHook< SOCKET > & | hook |
 | ) |  |  | [protected, virtual]
bool DTHandler::WSPListen | ( | SOCKET | s,
 |  | int | backlog,
 |  | LPINT | lpErrno,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 2211 of file DtHandler.Cpp.

                                                                             {

    return (false);

} // DTHandler::WSPListen()

bool DTHandler::WSPRecv | ( | SOCKET | s,
 |  | LPWSABUF | lpBuffers,
 |  | DWORD | dwBufferCount,
 |  | LPDWORD | lpNumberOfBytesRecvd,
 |  | LPDWORD | lpFlags,
 |  | LPWSAOVERLAPPED | lpOverlapped,
 |  | LPWSAOVERLAPPED_COMPLETION_ROUTINE | lpCompletionRoutine,
 |  | LPWSATHREADID | lpThreadId,
 |  | LPINT | lpErrno,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 2231 of file DtHandler.Cpp.

                                       {

    return (false);

} // DTHandler::WSPRecv()

bool DTHandler::WSPRecvDisconnect | ( | SOCKET | s,
 |  | LPWSABUF | lpInboundDisconnectData,
 |  | LPINT | lpErrno,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 2264 of file DtHandler.Cpp.

                                                                {

    return (false);

} // DTHandler::WSPRecvDisconnect()

virtual bool DTHandler::WSPRecvFrom | ( | SOCKET | s,
 |  | LPWSABUF | lpBuffers,
 |  | DWORD | dwBufferCount,
 |  | LPDWORD | lpNumberOfBytesRecvd,
 |  | LPDWORD | lpFlags,
 |  | struct sockaddr FAR * | lpFrom,
 |  | LPINT | lpFromlen,
 |  | LPWSAOVERLAPPED | lpOverlapped,
 |  | LPWSAOVERLAPPED_COMPLETION_ROUTINE | lpCompletionRoutine,
 |  | LPWSATHREADID | lpThreadId,
 |  | LPINT | lpErrno,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]
virtual bool DTHandler::WSPSelect | ( | int | nfds,
 |  | fd_set FAR * | readfds,
 |  | fd_set FAR * | writefds,
 |  | fd_set FAR * | exceptfds,
 |  | const struct timeval FAR * | timeout,
 |  | LPINT | lpErrno,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]
bool DTHandler::WSPSend | ( | SOCKET | s,
 |  | LPWSABUF | lpBuffers,
 |  | DWORD | dwBufferCount,
 |  | LPDWORD | lpNumberOfBytesSent,
 |  | DWORD | dwFlags,
 |  | LPWSAOVERLAPPED | lpOverlapped,
 |  | LPWSAOVERLAPPED_COMPLETION_ROUTINE | lpCompletionRoutine,
 |  | LPWSATHREADID | lpThreadId,
 |  | LPINT | lpErrno,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 2347 of file DtHandler.Cpp.

                                       {

    return (false);

} // DTHandler::WSPSend()

bool DTHandler::WSPSendDisconnect | ( | SOCKET | s,
 |  | LPWSABUF | lpOutboundDisconnectData,
 |  | LPINT | lpErrno,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 2380 of file DtHandler.Cpp.

                                                                {

    return (false);

} // DTHandler::WSPSendDisconnect()

virtual bool DTHandler::WSPSendTo | ( | SOCKET | s,
 |  | LPWSABUF | lpBuffers,
 |  | DWORD | dwBufferCount,
 |  | LPDWORD | lpNumberOfBytesSent,
 |  | DWORD | dwFlags,
 |  | const struct sockaddr FAR * | lpTo,
 |  | int | iTolen,
 |  | LPWSAOVERLAPPED | lpOverlapped,
 |  | LPWSAOVERLAPPED_COMPLETION_ROUTINE | lpCompletionRoutine,
 |  | LPWSATHREADID | lpThreadId,
 |  | LPINT | lpErrno,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]
virtual bool DTHandler::WSPSetSockOpt | ( | SOCKET | s,
 |  | int | level,
 |  | int | optname,
 |  | const char FAR * | optval,
 |  | int | optlen,
 |  | LPINT | lpErrno,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]
bool DTHandler::WSPShutdown | ( | SOCKET | s,
 |  | int | how,
 |  | LPINT | lpErrno,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 2462 of file DtHandler.Cpp.

                                                                           {

    return (false);

} // DTHandler::WSPShutdown()

bool DTHandler::WSPSocket | ( | int | af,
 |  | int | type,
 |  | int | protocol,
 |  | LPWSAPROTOCOL_INFOW | lpProtocolInfo,
 |  | GROUP | g,
 |  | DWORD | dwFlags,
 |  | LPINT | lpErrno,
 |  | APIHook< SOCKET > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 2482 of file DtHandler.Cpp.

                                                                                {

    return (false);

} // DTHandler::WSPSocket()

bool DTHandler::WSPStartup | ( | WORD | wVersionRequested,
 |  | LPWSPDATA | lpWSPData,
 |  | LPWSAPROTOCOL_INFOW | lpProtocolInfo,
 |  | WSPUPCALLTABLE | UpcallTable,
 |  | LPWSPPROC_TABLE | lpProcTable,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 2507 of file DtHandler.Cpp.

                                                                       {

    return (false);

} // DTHandler::WSPStartup()

bool DTHandler::WSPStringToAddress | ( | LPWSTR | AddressString,
 |  | INT | AddressFamily,
 |  | LPWSAPROTOCOL_INFOW | lpProtocolInfo,
 |  | LPSOCKADDR | lpAddress,
 |  | LPINT | lpAddressLength,
 |  | LPINT | lpErrno,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Definition at line 3690 of file DtHandler.Cpp.

                                                  {

    return (false);

} // DTHandler::WSPStringToAddress()

Member Data Documentation

bool(* DTHandler::_dispatchTable[MAX_DTCODE + 1])(DTHandler *, APIHook< void > &, va_list) [static, private]

Definition at line 36 of file DtHandler.Hpp.

The documentation for this class was generated from the following files:
  • NetDS/WinSock/Dt_Dll2/DtHandler.Hpp
  • NetDS/WinSock/Dt_Dll2/DtHandler.Cpp
Generated on Wed Nov 13 2024 16:57:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: DWSTR Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

DWSTR Struct Reference

#include "Global.h"

List of all members.

Public Attributes

DWORD dw
LPTSTR psz

Detailed Description

Definition at line 177 of file Global.h.

Member Data Documentation

DWORD DWSTR::dw

Definition at line 178 of file Global.h.

LPTSTR DWSTR::psz

Definition at line 179 of file Global.h.

The documentation for this struct was generated from the following file:
  • Web/NetMeeting/NMUI/Global.h
Generated on Wed Nov 13 2024 16:57:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ECB_QUEUE_ENTRY Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

ECB_QUEUE_ENTRY Struct Reference

List of all members.

Public Attributes

DWORD dwNextEntry
EXTENSION_CONTROL_BLOCK * pECB

Detailed Description

Definition at line 19 of file ThreadPool.c.

Member Data Documentation

DWORD ECB_QUEUE_ENTRY::dwNextEntry

Definition at line 21 of file ThreadPool.c.

EXTENSION_CONTROL_BLOCK* ECB_QUEUE_ENTRY::pECB

Definition at line 20 of file ThreadPool.c.

The documentation for this struct was generated from the following file:
  • Web/iis/extensions/KeepAliveWithThreads/ThreadPool.c
Generated on Wed Nov 13 2024 16:57:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: EDANNOTATORLib::Annotator Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • EDANNOTATORLib
  • EDANNOTATORLib::Annotator

EDANNOTATORLib::Annotator Class Reference

import "EDAnnotator.idl";

Detailed Description

Definition at line 46 of file EDAnnotator.idl.

The documentation for this class was generated from the following file:
  • Web/Browser/EdAnnotator/AnnotatorProject/EDAnnotator.idl
Generated on Wed Nov 13 2024 16:58:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: EDCOMMANDSLib::BrowserHost Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • EDCOMMANDSLib
  • EDCOMMANDSLib::BrowserHost

EDCOMMANDSLib::BrowserHost Class Reference

import "EdCommands.idl";

Detailed Description

Definition at line 39 of file EdCommands.idl.

The documentation for this class was generated from the following file:
  • Web/Browser/EditCommands/EdCommands.idl
Generated on Wed Nov 13 2024 16:58:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: EDGLYPHSLib::BrowserHost Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • EDGLYPHSLib
  • EDGLYPHSLib::BrowserHost

EDGLYPHSLib::BrowserHost Class Reference

import "EdGlyphs.idl";

Detailed Description

Definition at line 55 of file EdGlyphs.idl.

The documentation for this class was generated from the following file:
  • Web/Browser/EditGlyphs/EdGlyphs.idl
Generated on Wed Nov 13 2024 16:58:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: EDHOSTLib::BrowserHost Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • EDHOSTLib
  • EDHOSTLib::BrowserHost

EDHOSTLib::BrowserHost Class Reference

import "EdHost.idl";

Detailed Description

Definition at line 68 of file EdHost.idl.

The documentation for this class was generated from the following file:
  • Web/Browser/EditHost/EdHost.idl
Generated on Wed Nov 13 2024 16:58:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: EDHOSTLib::Grid Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • EDHOSTLib
  • EDHOSTLib::Grid

EDHOSTLib::Grid Class Reference

import "EdHost.idl";

Detailed Description

Definition at line 77 of file EdHost.idl.

The documentation for this class was generated from the following file:
  • Web/Browser/EditHost/EdHost.idl
Generated on Wed Nov 13 2024 16:58:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: EDHOSTLib::Snap Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • EDHOSTLib
  • EDHOSTLib::Snap

EDHOSTLib::Snap Class Reference

import "EdHost.idl";

Detailed Description

Definition at line 85 of file EdHost.idl.

The documentation for this class was generated from the following file:
  • Web/Browser/EditHost/EdHost.idl
Generated on Wed Nov 13 2024 16:58:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: EDITARGS Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

EDITARGS Struct Reference

List of all members.

Public Attributes

int | option
long | selection
VIEW view

Detailed Description

Definition at line 237 of file sdkdiff.cpp.

Member Data Documentation

int EDITARGS::option

Definition at line 239 of file sdkdiff.cpp.

long EDITARGS::selection

Definition at line 240 of file sdkdiff.cpp.

VIEW EDITARGS::view

Definition at line 238 of file sdkdiff.cpp.

The documentation for this struct was generated from the following file:
  • Begin/sdkdiff/sdkdiff.cpp
Generated on Wed Nov 13 2024 16:57:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ENUMINFO Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

ENUMINFO Struct Reference

#include "cenum.h"

List of all members.

Public Attributes

USHORT eType
VARIANT_BOOL | fIsParent
WCHAR | wszDescription [MAX_NAME_LEN]
WCHAR | wszName [MAX_NAME_LEN]
WCHAR | wszParseName [MAX_NAME_LEN]

Detailed Description

Definition at line 27 of file cenum.h.

Member Data Documentation

USHORT ENUMINFO::eType

Definition at line 32 of file cenum.h.

VARIANT_BOOL ENUMINFO::fIsParent

Definition at line 33 of file cenum.h.

WCHAR ENUMINFO::wszDescription[MAX_NAME_LEN]

Definition at line 31 of file cenum.h.

WCHAR ENUMINFO::wszName[MAX_NAME_LEN]

Definition at line 29 of file cenum.h.

WCHAR ENUMINFO::wszParseName[MAX_NAME_LEN]

Definition at line 30 of file cenum.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/oledb/rowsetviewer/cenum.h
Generated on Wed Nov 13 2024 16:57:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ENUMSYMDATA Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

ENUMSYMDATA Struct Reference

List of all members.

Public Attributes

DWORD64 | base
char | mask [MAX_STR]

Detailed Description

Definition at line 43 of file dbh.cpp.

Member Data Documentation

DWORD64 ENUMSYMDATA::base

Definition at line 45 of file dbh.cpp.

char ENUMSYMDATA::mask[MAX_STR]

Definition at line 44 of file dbh.cpp.

The documentation for this struct was generated from the following file:
  • WinBase/Debug/dbh/dbh.cpp
Generated on Wed Nov 13 2024 16:57:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ErrorsVtbl Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

ErrorsVtbl Struct Reference

#include "adoint.h"

List of all members.

Public Member Functions

BEGIN_INTERFACE | HRESULT (STDMETHODCALLTYPE __RPC_FAR *QueryInterface)(ADOErrors __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount)(ADOErrors __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Item)(ADOErrors __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Refresh)(ADOErrors __RPC_FAR *This)
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Count)(ADOErrors __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *_NewEnum)(ADOErrors __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Invoke)(ADOErrors __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Clear)(ADOErrors __RPC_FAR *This)
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo)(ADOErrors __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames)(ADOErrors __RPC_FAR *This
ULONG (STDMETHODCALLTYPE __RPC_FAR *Release)(ADOErrors __RPC_FAR *This)
ULONG (STDMETHODCALLTYPE __RPC_FAR *AddRef)(ADOErrors __RPC_FAR *This)

Public Attributes

long __RPC_FAR * | c
REFIID LPOLESTR __RPC_FAR UINT | cNames
DISPID | dispIdMember
VARIANT | Index
UINT iTInfo
UINT LCID | lcid
REFIID LPOLESTR __RPC_FAR UINT LCID | lcid
DISPID REFIID LCID | lcid
UINT __RPC_FAR * | pctinfo
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR * 		pDispParams
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR EXCEPINFO __RPC_FAR * 		pExcepInfo
UINT LCID ITypeInfo __RPC_FAR
*__RPC_FAR * 		ppTInfo
IUnknown __RPC_FAR *__RPC_FAR * | ppvObject
VARIANT ADOError __RPC_FAR
*__RPC_FAR * 		ppvObject
BEGIN_INTERFACE REFIID void
__RPC_FAR *__RPC_FAR * 		ppvObject
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR EXCEPINFO __RPC_FAR
UINT __RPC_FAR * 		puArgErr
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR * 		pVarResult
REFIID LPOLESTR __RPC_FAR UINT
LCID DISPID __RPC_FAR * 		rgDispId
REFIID LPOLESTR __RPC_FAR * | rgszNames
BEGIN_INTERFACE REFIID | riid
REFIID | riid
DISPID REFIID | riid
DISPID REFIID LCID WORD | wFlags

Detailed Description

Definition at line 1051 of file adoint.h.

Member Function Documentation

BEGIN_INTERFACE ErrorsVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * QueryInterface )
ErrorsVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetTypeInfoCount )
ErrorsVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Item )
ErrorsVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Refresh )
ErrorsVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Count )
ErrorsVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * _NewEnum )
ErrorsVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Invoke )
ErrorsVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Clear )
ErrorsVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetTypeInfo )
ErrorsVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetIDsOfNames )
ErrorsVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * Release )
ErrorsVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * AddRef )

Member Data Documentation

long __RPC_FAR* ErrorsVtbl::c

Definition at line 1097 of file adoint.h.

REFIID LPOLESTR __RPC_FAR UINT ErrorsVtbl::cNames

Definition at line 1078 of file adoint.h.

DISPID ErrorsVtbl::dispIdMember

Definition at line 1086 of file adoint.h.

VARIANT ErrorsVtbl::Index

Definition at line 1108 of file adoint.h.

UINT ErrorsVtbl::iTInfo

Definition at line 1072 of file adoint.h.

UINT LCID ErrorsVtbl::lcid

Definition at line 1072 of file adoint.h.

REFIID LPOLESTR __RPC_FAR UINT LCID ErrorsVtbl::lcid

Definition at line 1078 of file adoint.h.

DISPID REFIID LCID ErrorsVtbl::lcid

Definition at line 1086 of file adoint.h.

UINT __RPC_FAR* ErrorsVtbl::pctinfo

Definition at line 1068 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR* ErrorsVtbl::pDispParams

Definition at line 1086 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR EXCEPINFO __RPC_FAR* ErrorsVtbl::pExcepInfo

Definition at line 1086 of file adoint.h.

UINT LCID ITypeInfo __RPC_FAR* __RPC_FAR* ErrorsVtbl::ppTInfo

Definition at line 1072 of file adoint.h.

IUnknown __RPC_FAR* __RPC_FAR* ErrorsVtbl::ppvObject

Definition at line 1101 of file adoint.h.

VARIANT ADOError __RPC_FAR* __RPC_FAR* ErrorsVtbl::ppvObject

Definition at line 1108 of file adoint.h.

BEGIN_INTERFACE REFIID void __RPC_FAR* __RPC_FAR* ErrorsVtbl::ppvObject

Definition at line 1057 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR EXCEPINFO __RPC_FAR UINT __RPC_FAR* ErrorsVtbl::puArgErr

Definition at line 1086 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR* ErrorsVtbl::pVarResult

Definition at line 1086 of file adoint.h.

REFIID LPOLESTR __RPC_FAR UINT LCID DISPID __RPC_FAR* ErrorsVtbl::rgDispId

Definition at line 1078 of file adoint.h.

REFIID LPOLESTR __RPC_FAR* ErrorsVtbl::rgszNames

Definition at line 1078 of file adoint.h.

BEGIN_INTERFACE REFIID ErrorsVtbl::riid

Definition at line 1057 of file adoint.h.

REFIID ErrorsVtbl::riid

Definition at line 1078 of file adoint.h.

DISPID REFIID ErrorsVtbl::riid

Definition at line 1086 of file adoint.h.

DISPID REFIID LCID WORD ErrorsVtbl::wFlags

Definition at line 1086 of file adoint.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/rds/handler/vc/adoint.h
Generated on Wed Nov 13 2024 16:57:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ErrorVtbl Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

ErrorVtbl Struct Reference

#include "adoint.h"

List of all members.

Public Member Functions

BEGIN_INTERFACE | HRESULT (STDMETHODCALLTYPE __RPC_FAR *QueryInterface)(ADOError __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_NativeError)(ADOError __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_SQLState)(ADOError __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount)(ADOError __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_HelpFile)(ADOError __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Description)(ADOError __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Number)(ADOError __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Source)(ADOError __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Invoke)(ADOError __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_HelpContext)(ADOError __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo)(ADOError __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames)(ADOError __RPC_FAR *This
ULONG (STDMETHODCALLTYPE __RPC_FAR *Release)(ADOError __RPC_FAR *This)
ULONG (STDMETHODCALLTYPE __RPC_FAR *AddRef)(ADOError __RPC_FAR *This)

Public Attributes

REFIID LPOLESTR __RPC_FAR UINT | cNames
DISPID | dispIdMember
UINT iTInfo
UINT LCID | lcid
REFIID LPOLESTR __RPC_FAR UINT LCID | lcid
DISPID REFIID LCID | lcid
BSTR __RPC_FAR * | pbstr
UINT __RPC_FAR * | pctinfo
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR * 		pDispParams
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR EXCEPINFO __RPC_FAR * 		pExcepInfo
long __RPC_FAR * | pl
UINT LCID ITypeInfo __RPC_FAR
*__RPC_FAR * 		ppTInfo
BEGIN_INTERFACE REFIID void
__RPC_FAR *__RPC_FAR * 		ppvObject
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR EXCEPINFO __RPC_FAR
UINT __RPC_FAR * 		puArgErr
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR * 		pVarResult
REFIID LPOLESTR __RPC_FAR UINT
LCID DISPID __RPC_FAR * 		rgDispId
REFIID LPOLESTR __RPC_FAR * | rgszNames
BEGIN_INTERFACE REFIID | riid
DISPID REFIID | riid
REFIID | riid
DISPID REFIID LCID WORD | wFlags

Detailed Description

Definition at line 860 of file adoint.h.

Member Function Documentation

BEGIN_INTERFACE ErrorVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * QueryInterface )
ErrorVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_NativeError )
ErrorVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_SQLState )
ErrorVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetTypeInfoCount )
ErrorVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_HelpFile )
ErrorVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Description )
ErrorVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Number )
ErrorVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Source )
ErrorVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Invoke )
ErrorVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_HelpContext )
ErrorVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetTypeInfo )
ErrorVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetIDsOfNames )
ErrorVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * Release )
ErrorVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * AddRef )

Member Data Documentation

REFIID LPOLESTR __RPC_FAR UINT ErrorVtbl::cNames

Definition at line 887 of file adoint.h.

DISPID ErrorVtbl::dispIdMember

Definition at line 895 of file adoint.h.

UINT ErrorVtbl::iTInfo

Definition at line 881 of file adoint.h.

UINT LCID ErrorVtbl::lcid

Definition at line 881 of file adoint.h.

REFIID LPOLESTR __RPC_FAR UINT LCID ErrorVtbl::lcid

Definition at line 887 of file adoint.h.

DISPID REFIID LCID ErrorVtbl::lcid

Definition at line 895 of file adoint.h.

BSTR __RPC_FAR * ErrorVtbl::pbstr

Definition at line 910 of file adoint.h.

UINT __RPC_FAR* ErrorVtbl::pctinfo

Definition at line 877 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR* ErrorVtbl::pDispParams

Definition at line 895 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR EXCEPINFO __RPC_FAR* ErrorVtbl::pExcepInfo

Definition at line 895 of file adoint.h.

long __RPC_FAR * ErrorVtbl::pl

Definition at line 906 of file adoint.h.

UINT LCID ITypeInfo __RPC_FAR* __RPC_FAR* ErrorVtbl::ppTInfo

Definition at line 881 of file adoint.h.

BEGIN_INTERFACE REFIID void __RPC_FAR* __RPC_FAR* ErrorVtbl::ppvObject

Definition at line 866 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR EXCEPINFO __RPC_FAR UINT __RPC_FAR* ErrorVtbl::puArgErr

Definition at line 895 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR* ErrorVtbl::pVarResult

Definition at line 895 of file adoint.h.

REFIID LPOLESTR __RPC_FAR UINT LCID DISPID __RPC_FAR* ErrorVtbl::rgDispId

Definition at line 887 of file adoint.h.

REFIID LPOLESTR __RPC_FAR* ErrorVtbl::rgszNames

Definition at line 887 of file adoint.h.

BEGIN_INTERFACE REFIID ErrorVtbl::riid

Definition at line 866 of file adoint.h.

DISPID REFIID ErrorVtbl::riid

Definition at line 895 of file adoint.h.

REFIID ErrorVtbl::riid

Definition at line 887 of file adoint.h.

DISPID REFIID LCID WORD ErrorVtbl::wFlags

Definition at line 895 of file adoint.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/rds/handler/vc/adoint.h
Generated on Wed Nov 13 2024 16:57:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: EventID Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

EventID Struct Reference

#include "CConnectionPT.h"

List of all members.

Public Attributes

DWORD cEventID
const IID * EventIDs

Detailed Description

Definition at line 23 of file CConnectionPT.h.

Member Data Documentation

DWORD EventID::cEventID

Definition at line 24 of file CConnectionPT.h.

const IID* EventID::EventIDs

Definition at line 25 of file CConnectionPT.h.

The documentation for this struct was generated from the following file:
  • Com/async/server/CConnectionPT.h
Generated on Wed Nov 13 2024 16:57:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: EXEDLLICONINFO Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

EXEDLLICONINFO Struct Reference

List of all members.

Public Attributes

HINSTANCE | hInstance
PTSTR | pID
PCTSTR | szFileName

Detailed Description

Definition at line 62 of file Icons.C.

Member Data Documentation

HINSTANCE EXEDLLICONINFO::hInstance

Definition at line 65 of file Icons.C.

PTSTR EXEDLLICONINFO::pID

Definition at line 66 of file Icons.C.

PCTSTR EXEDLLICONINFO::szFileName

Definition at line 64 of file Icons.C.

The documentation for this struct was generated from the following file:
  • WinUI/Resource/Iconpro/Icons.C
Generated on Wed Nov 13 2024 16:57:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: EXTENDER_NODE Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

EXTENDER_NODE Struct Reference

#include "extend.h"

List of all members.

Public Attributes

EXTENSION_TYPE eType
GUID | guidExtension
GUID | guidNode
_TCHAR | szDescription [256]

Detailed Description

Definition at line 40 of file extend.h.

Member Data Documentation

EXTENSION_TYPE EXTENDER_NODE::eType

Definition at line 42 of file extend.h.

GUID EXTENDER_NODE::guidExtension

Definition at line 44 of file extend.h.

GUID EXTENDER_NODE::guidNode

Definition at line 43 of file extend.h.

_TCHAR EXTENDER_NODE::szDescription

Definition at line 45 of file extend.h.

The documentation for this struct was generated from the following files:
  • SysMgmt/MMC/CMenuExt/extend.h
  • SysMgmt/MMC/Nameext/extend.h
  • SysMgmt/MMC/Ppgeext/extend.h
  • SysMgmt/MMC/Tbarext/extend.h
Generated on Wed Nov 13 2024 16:57:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: EXTENSION_NODE Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

EXTENSION_NODE Struct Reference

#include "extend.h"

List of all members.

Public Attributes

GUID GUID
_TCHAR szDescription [256]

Detailed Description

Definition at line 23 of file extend.h.

Member Data Documentation

GUID EXTENSION_NODE::GUID

Definition at line 25 of file extend.h.

_TCHAR EXTENSION_NODE::szDescription

Definition at line 26 of file extend.h.

The documentation for this struct was generated from the following files:
  • SysMgmt/MMC/CMenuExt/extend.h
  • SysMgmt/MMC/Nameext/extend.h
  • SysMgmt/MMC/Ppgeext/extend.h
  • SysMgmt/MMC/Tbarext/extend.h
Generated on Wed Nov 13 2024 16:57:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: FaxDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions

FaxDlg Class Reference

#include "FaxDlg.h"

List of all members.

Public Types

enum | { IDD = IDD_FAX }

Public Member Functions

FaxDlg (CWnd *pParent=NULL)

Public Attributes

CString m_FaxNumber
CString m_RecipientName

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)

Detailed Description

Definition at line 13 of file FaxDlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 21 of file FaxDlg.h.

{ IDD = IDD_FAX };

Constructor & Destructor Documentation

FaxDlg::FaxDlg ( CWnd * pParent = NULL )

Definition at line 18 of file FaxDlg.Cpp.

  : CDialog(FaxDlg::IDD, pParent)
{
  //{{AFX_DATA_INIT(FaxDlg)
  m_FaxNumber = _T("");
  m_RecipientName = _T("");
  //}}AFX_DATA_INIT
}

Member Function Documentation

void FaxDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 28 of file FaxDlg.Cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(FaxDlg)
  DDX_Text(pDX, IDC_EDIT1, m_FaxNumber);
  DDV_MaxChars(pDX, m_FaxNumber, 30);
  DDX_Text(pDX, IDC_EDIT2, m_RecipientName);
  DDV_MaxChars(pDX, m_RecipientName, 64);
  //}}AFX_DATA_MAP
}

Member Data Documentation

CString FaxDlg::m_FaxNumber

Definition at line 22 of file FaxDlg.h.

CString FaxDlg::m_RecipientName

Definition at line 23 of file FaxDlg.h.

The documentation for this class was generated from the following files:
  • NetDS/fax/PrintSdi/FaxDlg.h
  • NetDS/fax/PrintSdi/FaxDlg.Cpp
Generated on Wed Nov 13 2024 16:57:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: FieldInfo Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

FieldInfo Struct Reference

#include "quiktest.h"

List of all members.

Public Attributes

SWORD autoinc
int | fAutoUpdate
SWORD fSearchable
SDWORD fUnsigned
int | iField
UDWORD length
SWORD nullable
SDWORD precision
SWORD scale
TCHAR | szFieldName [MAX_FIELD]
TCHAR | szLength [MAX_FIELD]
TCHAR | szParams [MAX_PARAM_SIZE]
TCHAR | szPrefix [MAX_PREFIX]
TCHAR | szSuffix [MAX_SUFFIX]
TCHAR | szType [MAX_TYPE_NAME]
SWORD wSQLType

Detailed Description

Definition at line 117 of file quiktest.h.

Member Data Documentation

SWORD FieldInfo::autoinc

Definition at line 133 of file quiktest.h.

int FieldInfo::fAutoUpdate

Definition at line 130 of file quiktest.h.

SWORD FieldInfo::fSearchable

Definition at line 131 of file quiktest.h.

SDWORD FieldInfo::fUnsigned

Definition at line 132 of file quiktest.h.

int FieldInfo::iField

Definition at line 118 of file quiktest.h.

UDWORD FieldInfo::length

Definition at line 129 of file quiktest.h.

SWORD FieldInfo::nullable

Definition at line 128 of file quiktest.h.

SDWORD FieldInfo::precision

Definition at line 126 of file quiktest.h.

SWORD FieldInfo::scale

Definition at line 127 of file quiktest.h.

TCHAR FieldInfo::szFieldName[MAX_FIELD]

Definition at line 120 of file quiktest.h.

TCHAR FieldInfo::szLength[MAX_FIELD]

Definition at line 123 of file quiktest.h.

TCHAR FieldInfo::szParams[MAX_PARAM_SIZE]

Definition at line 122 of file quiktest.h.

TCHAR FieldInfo::szPrefix[MAX_PREFIX]

Definition at line 124 of file quiktest.h.

TCHAR FieldInfo::szSuffix[MAX_SUFFIX]

Definition at line 125 of file quiktest.h.

TCHAR FieldInfo::szType[MAX_TYPE_NAME]

Definition at line 119 of file quiktest.h.

SWORD FieldInfo::wSQLType

Definition at line 121 of file quiktest.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/odbc/quiktest/quiktest.h
Generated on Wed Nov 13 2024 16:57:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: FieldsVtbl Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

FieldsVtbl Struct Reference

#include "adoint.h"

List of all members.

Public Member Functions

BEGIN_INTERFACE | HRESULT (STDMETHODCALLTYPE __RPC_FAR *QueryInterface)(ADOFields __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Item)(ADOFields __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Refresh)(ADOFields __RPC_FAR *This)
HRESULT (STDMETHODCALLTYPE __RPC_FAR *_NewEnum)(ADOFields __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount)(ADOFields __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Invoke)(ADOFields __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Count)(ADOFields __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo)(ADOFields __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames)(ADOFields __RPC_FAR *This
ULONG (STDMETHODCALLTYPE __RPC_FAR *AddRef)(ADOFields __RPC_FAR *This)
ULONG (STDMETHODCALLTYPE __RPC_FAR *Release)(ADOFields __RPC_FAR *This)

Public Attributes

long __RPC_FAR * | c
REFIID LPOLESTR __RPC_FAR UINT | cNames
DISPID | dispIdMember
VARIANT | Index
UINT iTInfo
UINT LCID | lcid
REFIID LPOLESTR __RPC_FAR UINT LCID | lcid
DISPID REFIID LCID | lcid
UINT __RPC_FAR * | pctinfo
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR * 		pDispParams
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR EXCEPINFO __RPC_FAR * 		pExcepInfo
UINT LCID ITypeInfo __RPC_FAR
*__RPC_FAR * 		ppTInfo
IUnknown __RPC_FAR *__RPC_FAR * | ppvObject
VARIANT ADOField __RPC_FAR
*__RPC_FAR * 		ppvObject
BEGIN_INTERFACE REFIID void
__RPC_FAR *__RPC_FAR * 		ppvObject
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR EXCEPINFO __RPC_FAR
UINT __RPC_FAR * 		puArgErr
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR * 		pVarResult
REFIID LPOLESTR __RPC_FAR UINT
LCID DISPID __RPC_FAR * 		rgDispId
REFIID LPOLESTR __RPC_FAR * | rgszNames
BEGIN_INTERFACE REFIID | riid
REFIID | riid
DISPID REFIID | riid
DISPID REFIID LCID WORD | wFlags

Detailed Description

Definition at line 3970 of file adoint.h.

Member Function Documentation

BEGIN_INTERFACE FieldsVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * QueryInterface )
FieldsVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Item )
FieldsVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Refresh )
FieldsVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * _NewEnum )
FieldsVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetTypeInfoCount )
FieldsVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Invoke )
FieldsVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Count )
FieldsVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetTypeInfo )
FieldsVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetIDsOfNames )
FieldsVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * AddRef )
FieldsVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * Release )

Member Data Documentation

long __RPC_FAR* FieldsVtbl::c

Definition at line 4016 of file adoint.h.

REFIID LPOLESTR __RPC_FAR UINT FieldsVtbl::cNames

Definition at line 3997 of file adoint.h.

DISPID FieldsVtbl::dispIdMember

Definition at line 4005 of file adoint.h.

VARIANT FieldsVtbl::Index

Definition at line 4027 of file adoint.h.

UINT FieldsVtbl::iTInfo

Definition at line 3991 of file adoint.h.

UINT LCID FieldsVtbl::lcid

Definition at line 3991 of file adoint.h.

REFIID LPOLESTR __RPC_FAR UINT LCID FieldsVtbl::lcid

Definition at line 3997 of file adoint.h.

DISPID REFIID LCID FieldsVtbl::lcid

Definition at line 4005 of file adoint.h.

UINT __RPC_FAR* FieldsVtbl::pctinfo

Definition at line 3987 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR* FieldsVtbl::pDispParams

Definition at line 4005 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR EXCEPINFO __RPC_FAR* FieldsVtbl::pExcepInfo

Definition at line 4005 of file adoint.h.

UINT LCID ITypeInfo __RPC_FAR* __RPC_FAR* FieldsVtbl::ppTInfo

Definition at line 3991 of file adoint.h.

IUnknown __RPC_FAR* __RPC_FAR* FieldsVtbl::ppvObject

Definition at line 4020 of file adoint.h.

VARIANT ADOField __RPC_FAR* __RPC_FAR* FieldsVtbl::ppvObject

Definition at line 4027 of file adoint.h.

BEGIN_INTERFACE REFIID void __RPC_FAR* __RPC_FAR* FieldsVtbl::ppvObject

Definition at line 3976 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR EXCEPINFO __RPC_FAR UINT __RPC_FAR* FieldsVtbl::puArgErr

Definition at line 4005 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR* FieldsVtbl::pVarResult

Definition at line 4005 of file adoint.h.

REFIID LPOLESTR __RPC_FAR UINT LCID DISPID __RPC_FAR* FieldsVtbl::rgDispId

Definition at line 3997 of file adoint.h.

REFIID LPOLESTR __RPC_FAR* FieldsVtbl::rgszNames

Definition at line 3997 of file adoint.h.

BEGIN_INTERFACE REFIID FieldsVtbl::riid

Definition at line 3976 of file adoint.h.

REFIID FieldsVtbl::riid

Definition at line 3997 of file adoint.h.

DISPID REFIID FieldsVtbl::riid

Definition at line 4005 of file adoint.h.

DISPID REFIID LCID WORD FieldsVtbl::wFlags

Definition at line 4005 of file adoint.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/rds/handler/vc/adoint.h
Generated on Wed Nov 13 2024 16:57:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: FieldVtbl Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

FieldVtbl Struct Reference

#include "adoint.h"

List of all members.

Public Member Functions

BEGIN_INTERFACE | HRESULT (STDMETHODCALLTYPE __RPC_FAR *QueryInterface)(ADOField __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_UnderlyingValue)(ADOField __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_OriginalValue)(ADOField __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetChunk)(ADOField __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *AppendChunk)(ADOField __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_NumericScale)(ADOField __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount)(ADOField __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *put_Value)(ADOField __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Value)(ADOField __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Type)(ADOField __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Properties)(ADOField __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_DefinedSize)(ADOField __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Attributes)(ADOField __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Precision)(ADOField __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_ActualSize)(ADOField __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Invoke)(ADOField __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Name)(ADOField __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo)(ADOField __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames)(ADOField __RPC_FAR *This
ULONG (STDMETHODCALLTYPE __RPC_FAR *Release)(ADOField __RPC_FAR *This)
ULONG (STDMETHODCALLTYPE __RPC_FAR *AddRef)(ADOField __RPC_FAR *This)

Public Attributes

REFIID LPOLESTR __RPC_FAR UINT | cNames
VARIANT | Data
DISPID | dispIdMember
UINT iTInfo
UINT LCID | lcid
REFIID LPOLESTR __RPC_FAR UINT LCID | lcid
DISPID REFIID LCID | lcid
long | Length
BYTE __RPC_FAR * | pbNumericScale
BYTE __RPC_FAR * | pbPrecision
BSTR __RPC_FAR * | pbstr
UINT __RPC_FAR * | pctinfo
DataTypeEnum __RPC_FAR * | pDataType
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR * 		pDispParams
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR EXCEPINFO __RPC_FAR * 		pExcepInfo
long __RPC_FAR * | pl
UINT LCID ITypeInfo __RPC_FAR
*__RPC_FAR * 		ppTInfo
ADOProperties __RPC_FAR
*__RPC_FAR * 		ppvObject
BEGIN_INTERFACE REFIID void
__RPC_FAR *__RPC_FAR * 		ppvObject
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR EXCEPINFO __RPC_FAR
UINT __RPC_FAR * 		puArgErr
VARIANT __RPC_FAR * | pvar
long VARIANT __RPC_FAR * | pvar
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR * 		pVarResult
REFIID LPOLESTR __RPC_FAR UINT
LCID DISPID __RPC_FAR * 		rgDispId
REFIID LPOLESTR __RPC_FAR * | rgszNames
REFIID | riid
BEGIN_INTERFACE REFIID | riid
DISPID REFIID | riid
VARIANT | Val
DISPID REFIID LCID WORD | wFlags

Detailed Description

Definition at line 3689 of file adoint.h.

Member Function Documentation

BEGIN_INTERFACE FieldVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * QueryInterface )
FieldVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_UnderlyingValue )
FieldVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_OriginalValue )
FieldVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetChunk )
FieldVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * AppendChunk )
FieldVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_NumericScale )
FieldVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetTypeInfoCount )
FieldVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * put_Value )
FieldVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Value )
FieldVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Type )
FieldVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Properties )
FieldVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_DefinedSize )
FieldVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Attributes )
FieldVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Precision )
FieldVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_ActualSize )
FieldVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Invoke )
FieldVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Name )
FieldVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetTypeInfo )
FieldVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetIDsOfNames )
FieldVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * Release )
FieldVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * AddRef )

Member Data Documentation

REFIID LPOLESTR __RPC_FAR UINT FieldVtbl::cNames

Definition at line 3716 of file adoint.h.

VARIANT FieldVtbl::Data

Definition at line 3775 of file adoint.h.

DISPID FieldVtbl::dispIdMember

Definition at line 3724 of file adoint.h.

UINT FieldVtbl::iTInfo

Definition at line 3710 of file adoint.h.

UINT LCID FieldVtbl::lcid

Definition at line 3710 of file adoint.h.

REFIID LPOLESTR __RPC_FAR UINT LCID FieldVtbl::lcid

Definition at line 3716 of file adoint.h.

DISPID REFIID LCID FieldVtbl::lcid

Definition at line 3724 of file adoint.h.

long FieldVtbl::Length

Definition at line 3779 of file adoint.h.

BYTE __RPC_FAR* FieldVtbl::pbNumericScale

Definition at line 3771 of file adoint.h.

BYTE __RPC_FAR* FieldVtbl::pbPrecision

Definition at line 3767 of file adoint.h.

BSTR __RPC_FAR* FieldVtbl::pbstr

Definition at line 3751 of file adoint.h.

UINT __RPC_FAR* FieldVtbl::pctinfo

Definition at line 3706 of file adoint.h.

DataTypeEnum __RPC_FAR* FieldVtbl::pDataType

Definition at line 3755 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR* FieldVtbl::pDispParams

Definition at line 3724 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR EXCEPINFO __RPC_FAR* FieldVtbl::pExcepInfo

Definition at line 3724 of file adoint.h.

long __RPC_FAR * FieldVtbl::pl

Definition at line 3739 of file adoint.h.

UINT LCID ITypeInfo __RPC_FAR* __RPC_FAR* FieldVtbl::ppTInfo

Definition at line 3710 of file adoint.h.

ADOProperties __RPC_FAR* __RPC_FAR* FieldVtbl::ppvObject

Definition at line 3735 of file adoint.h.

BEGIN_INTERFACE REFIID void __RPC_FAR* __RPC_FAR* FieldVtbl::ppvObject

Definition at line 3695 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR EXCEPINFO __RPC_FAR UINT __RPC_FAR* FieldVtbl::puArgErr

Definition at line 3724 of file adoint.h.

VARIANT __RPC_FAR * FieldVtbl::pvar

Definition at line 3759 of file adoint.h.

long VARIANT __RPC_FAR* FieldVtbl::pvar

Definition at line 3779 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR* FieldVtbl::pVarResult

Definition at line 3724 of file adoint.h.

REFIID LPOLESTR __RPC_FAR UINT LCID DISPID __RPC_FAR* FieldVtbl::rgDispId

Definition at line 3716 of file adoint.h.

REFIID LPOLESTR __RPC_FAR* FieldVtbl::rgszNames

Definition at line 3716 of file adoint.h.

REFIID FieldVtbl::riid

Definition at line 3716 of file adoint.h.

BEGIN_INTERFACE REFIID FieldVtbl::riid

Definition at line 3695 of file adoint.h.

DISPID REFIID FieldVtbl::riid

Definition at line 3724 of file adoint.h.

VARIANT FieldVtbl::Val

Definition at line 3763 of file adoint.h.

DISPID REFIID LCID WORD FieldVtbl::wFlags

Definition at line 3724 of file adoint.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/rds/handler/vc/adoint.h
Generated on Wed Nov 13 2024 16:57:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: FILE_CONTEXT_TYPE Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

FILE_CONTEXT_TYPE Struct Reference

List of all members.

Public Attributes

char | achFile [256]
BYTE | EOFCheck
FILE * | hFile
HANDLE hFile

Detailed Description

Definition at line 34 of file filerepserverproc.cpp.

Member Data Documentation

char FILE_CONTEXT_TYPE::achFile[256]

Definition at line 27 of file Cxhndlp.c.

BYTE FILE_CONTEXT_TYPE::EOFCheck

Definition at line 40 of file filerepserverproc.cpp.

FILE* FILE_CONTEXT_TYPE::hFile

Definition at line 26 of file Cxhndlp.c.

HANDLE FILE_CONTEXT_TYPE::hFile

Definition at line 35 of file filerepserverproc.cpp.

The documentation for this struct was generated from the following files:
  • NetDS/RPC/FileRep/filerepmultiuser/filerepserverproc.cpp
  • NetDS/RPC/FileRep/filerepsecure/filerepserverproc.cpp
  • NetDS/RPC/FileRep/filerepsimple/filerepserverproc.cpp
  • NetDS/RPC/Handles/cxhndl/Cxhndlp.c
Generated on Wed Nov 13 2024 16:57:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: filebuffer Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

filebuffer Struct Reference

List of all members.

Public Attributes

char | buffer [BUFFER_SIZE]
HANDLE fh
BOOL fUnicode
LPSTR last
LPWSTR | pwzLast
LPWSTR | pwzStart
LPSTR start
WCHAR | wzBuffer [MAX_LINE_LENGTH]

Detailed Description

Definition at line 53 of file utils.cpp.

Member Data Documentation

char filebuffer::buffer[BUFFER_SIZE]

Definition at line 58 of file utils.cpp.

HANDLE filebuffer::fh

Definition at line 54 of file utils.cpp.

BOOL filebuffer::fUnicode

Definition at line 60 of file utils.cpp.

LPSTR filebuffer::last

Definition at line 56 of file utils.cpp.

LPWSTR filebuffer::pwzLast

Definition at line 63 of file utils.cpp.

LPWSTR filebuffer::pwzStart

Definition at line 62 of file utils.cpp.

LPSTR filebuffer::start

Definition at line 55 of file utils.cpp.

WCHAR filebuffer::wzBuffer[MAX_LINE_LENGTH]

Definition at line 61 of file utils.cpp.

The documentation for this struct was generated from the following file:
  • Begin/sdkdiff/utils.cpp
Generated on Wed Nov 13 2024 16:57:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: filedata Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

filedata Struct Reference

List of all members.

Public Attributes

DIRITEM diritem
BOOL fUnicode
LIST lines

Detailed Description

Definition at line 46 of file file.cpp.

Member Data Documentation

DIRITEM filedata::diritem

Definition at line 48 of file file.cpp.

BOOL filedata::fUnicode

Definition at line 51 of file file.cpp.

LIST filedata::lines

Definition at line 49 of file file.cpp.

The documentation for this struct was generated from the following file:
  • Begin/sdkdiff/file.cpp
Generated on Wed Nov 13 2024 16:57:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: FILEDEX Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

FILEDEX Struct Reference

#include "fileidx.h"

List of all members.

Public Attributes

BYTE bStatus
ULONG ulOffset

Detailed Description

Definition at line 18 of file fileidx.h.

Member Data Documentation

BYTE FILEDEX::bStatus

Definition at line 20 of file fileidx.h.

ULONG FILEDEX::ulOffset

Definition at line 19 of file fileidx.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/oledb/sampprov/fileidx.h
Generated on Wed Nov 13 2024 16:57:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: fileline Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

fileline Struct Reference

List of all members.

Public Attributes

UINT flags
DWORD hash
UINT linenr
LINE link
LPWSTR pwzText
LPSTR text

Detailed Description

Definition at line 44 of file line.cpp.

Member Data Documentation

UINT fileline::flags

Definition at line 46 of file line.cpp.

DWORD fileline::hash

Definition at line 49 of file line.cpp.

UINT fileline::linenr

Definition at line 51 of file line.cpp.

LINE fileline::link

Definition at line 50 of file line.cpp.

LPWSTR fileline::pwzText

Definition at line 52 of file line.cpp.

LPSTR fileline::text

Definition at line 48 of file line.cpp.

The documentation for this struct was generated from the following file:
  • Begin/sdkdiff/line.cpp
Generated on Wed Nov 13 2024 16:57:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: FileRepClient Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions

FileRepClient Interface Reference

import "FileRepClient.idl";

List of all members.

Public Types

typedef unsigned char * | STR
typedef unsigned char * | STR
typedef unsigned char * | STR
typedef unsigned char * | STR

Public Member Functions

void | RequestFile ([in] handle_t hFileRepClient,[in, ref, string] STR ServerName,[in, ref, string] STR RemoteFileName,[in, ref, string] STR LocalFileName)
void | RequestFile ([in] handle_t hFileRepClient,[in, ref, string] STR ServerName,[in, ref, string] STR RemoteFileName,[in, ref, string] STR LocalFileName)
void | RequestFile ([in] handle_t hFileRepClient,[in, ref, string] STR ServerName,[in, ref, string] STR RemoteFileName,[in, ref, string] STR LocalFileName)
void | RequestFile ([in] handle_t hFileRepClient,[in, ref, string] STR ServerName,[in, ref, string] STR RemoteFileName,[in, ref, string] STR LocalFileName)

Detailed Description

Definition at line 18 of file FileRepClient.idl.

Member Typedef Documentation

typedef unsigned char* FileRepClient::STR

Definition at line 24 of file FileRepClient.idl.

typedef unsigned char* FileRepClient::STR

Definition at line 24 of file filerepclient.idl.

typedef unsigned char* FileRepClient::STR

Definition at line 24 of file filerepclient.idl.

typedef unsigned char* FileRepClient::STR

Definition at line 24 of file filerepclient.idl.

Member Function Documentation

void FileRepClient::RequestFile | ( | [in] handle_t | hFileRepClient,
 |  | [in, ref, string] STR | ServerName,
 |  | [in, ref, string] STR | RemoteFileName,
 |  | [in, ref, string] STR | LocalFileName
 | ) |  |
void FileRepClient::RequestFile | ( | [in] handle_t | hFileRepClient,
 |  | [in, ref, string] STR | ServerName,
 |  | [in, ref, string] STR | RemoteFileName,
 |  | [in, ref, string] STR | LocalFileName
 | ) |  |
void FileRepClient::RequestFile | ( | [in] handle_t | hFileRepClient,
 |  | [in, ref, string] STR | ServerName,
 |  | [in, ref, string] STR | RemoteFileName,
 |  | [in, ref, string] STR | LocalFileName
 | ) |  |
void FileRepClient::RequestFile | ( | [in] handle_t | hFileRepClient,
 |  | [in, ref, string] STR | ServerName,
 |  | [in, ref, string] STR | RemoteFileName,
 |  | [in, ref, string] STR | LocalFileName
 | ) |  |
The documentation for this interface was generated from the following files:
  • NetDS/RPC/FileRep/FileRepAsyncPipe/FileRepClient.idl
  • NetDS/RPC/FileRep/filerepmultiuser/filerepclient.idl
  • NetDS/RPC/FileRep/filerepsecure/filerepclient.idl
  • NetDS/RPC/FileRep/filerepsimple/filerepclient.idl
Generated on Wed Nov 13 2024 16:57:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: FileRepServer Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes

FileRepServer Interface Reference

import "FileRepServer.idl";

List of all members.

Public Types

typedef pipe CHAR | CHAR_PIPE_TYPE
typedef unsigned char | CHAR_TYPE
typedef unsigned char * | STR
typedef unsigned char * | STR
typedef unsigned char * | STR
typedef unsigned char * | STR

Public Member Functions

void | RemoteOpen ([in] handle_t hFileRepServer,[out] PCONTEXT_HANDLE_TYPE *pphContext,[in, ref, string] STR pszFile,[out, ref, size_is(OPEN_BUFSIZE+1), length_is(*cbRead)] byte *Buf,[in, out, ref] unsigned long *cbRead)
void | RemoteOpen ([in] handle_t hFileRepServer,[out] PCONTEXT_HANDLE_TYPE *pphContext,[in, ref, string] STR pszFile,[out, ref, size_is(OPEN_BUFSIZE+1), length_is(*cbRead)] byte *Buf,[in, out, ref] unsigned long *cbRead)
void | RemoteOpen ([in] handle_t hFileRepServer,[out] PCONTEXT_HANDLE_TYPE *pphContext,[in, ref, string] STR pszFile,[out, ref, size_is(OPEN_BUFSIZE+1), length_is(*cbRead)] byte *Buf,[in, out, ref] unsigned long *cbRead)
void | RemoteRead ([in] handle_t hFileRepServer,[in, out] PCONTEXT_HANDLE_TYPE *pphContext,[out, ref, size_is(READ_BUFSIZE+1), length_is(*cbRead)] byte *Buf,[in, out, ref] unsigned long *cbRead)
void | RemoteRead ([in] handle_t hFileRepServer,[in, out] PCONTEXT_HANDLE_TYPE *pphContext,[out, ref, size_is(READ_BUFSIZE+1), length_is(*cbRead)] byte *Buf,[in, out, ref] unsigned long *cbRead)
void | RemoteRead ([in] handle_t hFileRepServer,[in, out] PCONTEXT_HANDLE_TYPE *pphContext,[out, ref, size_is(READ_BUFSIZE+1), length_is(*cbRead)] byte *Buf,[in, out, ref] unsigned long *cbRead)
void | RemoteReadAsyncPipe ([in] handle_t hFileRepServer,[in, ref, string] STR RemoteFileName,[out] CHAR_PIPE_TYPE *PipeData)

Public Attributes

const unsigned short | OPEN_BUFSIZE = 1024 * 1
MAX_BUFSIZE(READ_BUFSIZE+1)
typedef void * 		PCONTEXT_HANDLE_TYPE
const unsigned short | PULL_BUFSIZE = 10*1024
const unsigned short | PUSH_BUFSIZE = 10*1024
const unsigned short | READ_BUFSIZE = 10000

Detailed Description

Definition at line 8 of file FileRepServer.idl.

Member Typedef Documentation

typedef pipe CHAR FileRepServer::CHAR_PIPE_TYPE

Definition at line 19 of file FileRepServer.idl.

typedef unsigned char FileRepServer::CHAR_TYPE

Definition at line 15 of file FileRepServer.idl.

typedef unsigned char* FileRepServer::STR

Definition at line 13 of file filerepserver.idl.

typedef unsigned char* FileRepServer::STR

Definition at line 13 of file filerepserver.idl.

typedef unsigned char* FileRepServer::STR

Definition at line 24 of file filerepserver.idl.

typedef unsigned char* FileRepServer::STR

Definition at line 16 of file FileRepServer.idl.

Member Function Documentation

void FileRepServer::RemoteOpen | ( | [in] handle_t | hFileRepServer,
 |  | [out] PCONTEXT_HANDLE_TYPE * | pphContext,
 |  | [in, ref, string] STR | pszFile,
 |  | [out, ref, size_is(OPEN_BUFSIZE+1), length_is(*cbRead)] byte * | Buf,
 |  | [in, out, ref] unsigned long * | cbRead
 | ) |  |
void FileRepServer::RemoteOpen | ( | [in] handle_t | hFileRepServer,
 |  | [out] PCONTEXT_HANDLE_TYPE * | pphContext,
 |  | [in, ref, string] STR | pszFile,
 |  | [out, ref, size_is(OPEN_BUFSIZE+1), length_is(*cbRead)] byte * | Buf,
 |  | [in, out, ref] unsigned long * | cbRead
 | ) |  |
void FileRepServer::RemoteOpen | ( | [in] handle_t | hFileRepServer,
 |  | [out] PCONTEXT_HANDLE_TYPE * | pphContext,
 |  | [in, ref, string] STR | pszFile,
 |  | [out, ref, size_is(OPEN_BUFSIZE+1), length_is(*cbRead)] byte * | Buf,
 |  | [in, out, ref] unsigned long * | cbRead
 | ) |  |
void FileRepServer::RemoteRead | ( | [in] handle_t | hFileRepServer,
 |  | [in, out] PCONTEXT_HANDLE_TYPE * | pphContext,
 |  | [out, ref, size_is(READ_BUFSIZE+1), length_is(*cbRead)] byte * | Buf,
 |  | [in, out, ref] unsigned long * | cbRead
 | ) |  |
void FileRepServer::RemoteRead | ( | [in] handle_t | hFileRepServer,
 |  | [in, out] PCONTEXT_HANDLE_TYPE * | pphContext,
 |  | [out, ref, size_is(READ_BUFSIZE+1), length_is(*cbRead)] byte * | Buf,
 |  | [in, out, ref] unsigned long * | cbRead
 | ) |  |
void FileRepServer::RemoteRead | ( | [in] handle_t | hFileRepServer,
 |  | [in, out] PCONTEXT_HANDLE_TYPE * | pphContext,
 |  | [out, ref, size_is(READ_BUFSIZE+1), length_is(*cbRead)] byte * | Buf,
 |  | [in, out, ref] unsigned long * | cbRead
 | ) |  |
void FileRepServer::RemoteReadAsyncPipe | ( | [in] handle_t | hFileRepServer,
 |  | [in, ref, string] STR | RemoteFileName,
 |  | [out] CHAR_PIPE_TYPE * | PipeData
 | ) |  |

Member Data Documentation

const unsigned short FileRepServer::OPEN_BUFSIZE = 1024 * 1

Definition at line 20 of file filerepserver.idl.

MAX_BUFSIZE (READ_BUFSIZE+1) typedef void* FileRepServer::PCONTEXT_HANDLE_TYPE

Definition at line 28 of file filerepserver.idl.

const unsigned short FileRepServer::PULL_BUFSIZE = 10*1024

Definition at line 29 of file FileRepServer.idl.

const unsigned short FileRepServer::PUSH_BUFSIZE = 10*1024

Definition at line 25 of file FileRepServer.idl.

const unsigned short FileRepServer::READ_BUFSIZE = 10000

Definition at line 24 of file filerepserver.idl.

The documentation for this interface was generated from the following files:
  • NetDS/RPC/FileRep/FileRepAsyncPipe/FileRepServer.idl
  • NetDS/RPC/FileRep/filerepmultiuser/filerepserver.idl
  • NetDS/RPC/FileRep/filerepsecure/filerepserver.idl
  • NetDS/RPC/FileRep/filerepsimple/filerepserver.idl
Generated on Wed Nov 13 2024 16:57:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: FLAGMAPPING Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

FLAGMAPPING Struct Reference

#include "Gss-Misc.h"

List of all members.

Public Attributes

PCHAR | name
PCHAR | realname
OM_uint32 value

Detailed Description

Definition at line 57 of file Gss-Misc.h.

Member Data Documentation

PCHAR FLAGMAPPING::name

Definition at line 60 of file Gss-Misc.h.

PCHAR FLAGMAPPING::realname

Definition at line 62 of file Gss-Misc.h.

OM_uint32 FLAGMAPPING::value

Definition at line 61 of file Gss-Misc.h.

The documentation for this struct was generated from the following file:
  • Security/SSPI/GSS/Gss-Misc.h
Generated on Wed Nov 13 2024 16:57:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: FONTENUM Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

FONTENUM Struct Reference

List of all members.

Public Attributes

short | ft
LOGFONT | lf
TEXTMETRIC | tm

Detailed Description

Definition at line 26 of file Dialogs.c.

Member Data Documentation

short FONTENUM::ft

Definition at line 27 of file Dialogs.c.

LOGFONT FONTENUM::lf

Definition at line 29 of file Dialogs.c.

TEXTMETRIC FONTENUM::tm

Definition at line 28 of file Dialogs.c.

The documentation for this struct was generated from the following file:
  • Multimedia/Gdi/Fonts/FontView/Dialogs.c
Generated on Wed Nov 13 2024 16:57:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: FONTLIST Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

FONTLIST Struct Reference

List of all members.

Public Attributes

int count
HANDLE hList

Detailed Description

Definition at line 35 of file Dialogs.c.

Member Data Documentation

int FONTLIST::count

Definition at line 36 of file Dialogs.c.

HANDLE FONTLIST::hList

Definition at line 37 of file Dialogs.c.

The documentation for this struct was generated from the following file:
  • Multimedia/Gdi/Fonts/FontView/Dialogs.c
Generated on Wed Nov 13 2024 16:57:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: fullsvr::AsyncFullServ Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • fullsvr
  • fullsvr::AsyncFullServ
Public Member Functions | Static Public Attributes

fullsvr::AsyncFullServ Class Reference

.class(classid=F03BE176-A8DE-40D1-9161-A36BCBE1FEA6,DynamicCasts) .interface(iid=D3140113-D43F-4718-9119-EF62D631F2AB, thread=AUTO)

Inherits com::ms::com::IUnknown, fullsvr::AsyncIFullServ, fullsvr::ISynchronize, and fullsvr::ICancelMethodCalls.

List of all members.

Public Member Functions

native void | Begin_Sum (int i, int j)
native void | Cancel (int ulSeconds)
native int | Finish_Sum ()
native void | Reset ()
native void | Signal ()
native void | TestCancel ()
native void | Wait (int dwFlags, int dwMilliseconds)

Static Public Attributes

static final com.ms.com._Guid | clsid = new com.ms.com._Guid((int)0xf03be176, (short)0xa8de, (short)0x40d1, (byte)0x91, (byte)0x61, (byte)0xa3, (byte)0x6b, (byte)0xcb, (byte)0xe1, (byte)0xfe, (byte)0xa6)
static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0xd3140113, (short)0xd43f, (short)0x4718, (byte)0x91, (byte)0x19, (byte)0xef, (byte)0x62, (byte)0xd6, (byte)0x31, (byte)0xf2, (byte)0xab)

Detailed Description

Definition at line 20 of file AsyncFullServ.java.

Member Function Documentation

native void fullsvr::AsyncFullServ::Begin_Sum | ( | int | i,
 |  | int | j
 | ) |  |

.method(vtoffset=0, addFlagsVtable=4) .parameters([in,type=I4] i, [in,type=I4] j)

native void fullsvr::AsyncFullServ::Cancel ( int ulSeconds )

.method()

Implements fullsvr::ICancelMethodCalls.

native int fullsvr::AsyncFullServ::Finish_Sum ( )

.method(vtoffset=1, addFlagsVtable=4) .parameters([type=I4] return)

native void fullsvr::AsyncFullServ::Reset ( )

.method()

native void fullsvr::AsyncFullServ::Signal ( )

.method()

native void fullsvr::AsyncFullServ::TestCancel ( )

.method()

Implements fullsvr::ICancelMethodCalls.

native void fullsvr::AsyncFullServ::Wait | ( | int | dwFlags,
 |  | int | dwMilliseconds
 | ) |  |

.method()

Member Data Documentation

final com.ms.com._Guid fullsvr::AsyncFullServ::clsid = new com.ms.com._Guid((int)0xf03be176, (short)0xa8de, (short)0x40d1, (byte)0x91, (byte)0x61, (byte)0xa3, (byte)0x6b, (byte)0xcb, (byte)0xe1, (byte)0xfe, (byte)0xa6) [static]

Definition at line 53 of file AsyncFullServ.java.

final com.ms.com._Guid fullsvr::AsyncFullServ::iid = new com.ms.com._Guid((int)0xd3140113, (short)0xd43f, (short)0x4718, (byte)0x91, (byte)0x19, (byte)0xef, (byte)0x62, (byte)0xd6, (byte)0x31, (byte)0xf2, (byte)0xab) [static]

Implements fullsvr::ICancelMethodCalls.

Definition at line 31 of file AsyncFullServ.java.

The documentation for this class was generated from the following file:
  • Com/Fundamentals/AsyncCalls/JavaClient/FullSvr/AsyncFullServ.java
Generated on Wed Nov 13 2024 16:58:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: fullsvr::AsyncIFullServ Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • fullsvr
  • fullsvr::AsyncIFullServ
Public Member Functions | Static Public Attributes

fullsvr::AsyncIFullServ Interface Reference

.interface(iid=D3140113-D43F-4718-9119-EF62D631F2AB, thread=AUTO)

Inherits com::ms::com::IUnknown.

Inherited by fullsvr::AsyncFullServ.

List of all members.

Public Member Functions

void | Begin_Sum (int i, int j)
int | Finish_Sum ()

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0xd3140113, (short)0xd43f, (short)0x4718, (byte)0x91, (byte)0x19, (byte)0xef, (byte)0x62, (byte)0xd6, (byte)0x31, (byte)0xf2, (byte)0xab)

Detailed Description

Definition at line 20 of file AsyncIFullServ.java.

Member Function Documentation

void fullsvr::AsyncIFullServ::Begin_Sum | ( | int | i,
 |  | int | j
 | ) |  |

.method(vtoffset=0, addFlagsVtable=4) .parameters([in,type=I4] i, [in,type=I4] j)

int fullsvr::AsyncIFullServ::Finish_Sum ( )

.method(vtoffset=1, addFlagsVtable=4) .parameters([type=I4] return)

Member Data Documentation

final com.ms.com._Guid fullsvr::AsyncIFullServ::iid = new com.ms.com._Guid((int)0xd3140113, (short)0xd43f, (short)0x4718, (byte)0x91, (byte)0x19, (byte)0xef, (byte)0x62, (byte)0xd6, (byte)0x31, (byte)0xf2, (byte)0xab) [static]

Definition at line 31 of file AsyncIFullServ.java.

The documentation for this interface was generated from the following file:
  • Com/Fundamentals/AsyncCalls/JavaClient/FullSvr/AsyncIFullServ.java
Generated on Wed Nov 13 2024 16:58:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: fullsvr::FullServ Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • fullsvr
  • fullsvr::FullServ
Public Member Functions | Static Public Attributes

fullsvr::FullServ Class Reference

.class(classid=F03BE175-A8DE-40D1-9161-A36BCBE1FEA6,DynamicCasts) .interface(iid=D3140112-D43F-4718-9119-EF62D631F2AB, thread=AUTO)

Inherits com::ms::com::IUnknown, fullsvr::IFullServ, and fullsvr::ICallFactory.

List of all members.

Public Member Functions

native void | CreateCall (com.ms.com._Guid riid, IUnknown pCtrlUnk, com.ms.com._Guid riid2, IUnknown[] ppv)
native int | Sum (int i, int j)

Static Public Attributes

static final com.ms.com._Guid | clsid = new com.ms.com._Guid((int)0xf03be175, (short)0xa8de, (short)0x40d1, (byte)0x91, (byte)0x61, (byte)0xa3, (byte)0x6b, (byte)0xcb, (byte)0xe1, (byte)0xfe, (byte)0xa6)
static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0xd3140112, (short)0xd43f, (short)0x4718, (byte)0x91, (byte)0x19, (byte)0xef, (byte)0x62, (byte)0xd6, (byte)0x31, (byte)0xf2, (byte)0xab)

Detailed Description

Definition at line 20 of file FullServ.java.

Member Function Documentation

native void fullsvr::FullServ::CreateCall | ( | com.ms.com._Guid | riid,
 |  | IUnknown | pCtrlUnk,
 |  | com.ms.com._Guid | riid2,
 |  | IUnknown[] | ppv
 | ) |  |

.method()

Implements fullsvr::ICallFactory.

native int fullsvr::FullServ::Sum | ( | int | i,
 |  | int | j
 | ) |  |

.method(vtoffset=0, addFlagsVtable=4) .parameters([in,type=I4] i, [in,type=I4] j, [type=I4] return)

Member Data Documentation

final com.ms.com._Guid fullsvr::FullServ::clsid = new com.ms.com._Guid((int)0xf03be175, (short)0xa8de, (short)0x40d1, (byte)0x91, (byte)0x61, (byte)0xa3, (byte)0x6b, (byte)0xcb, (byte)0xe1, (byte)0xfe, (byte)0xa6) [static]

Definition at line 33 of file FullServ.java.

final com.ms.com._Guid fullsvr::FullServ::iid = new com.ms.com._Guid((int)0xd3140112, (short)0xd43f, (short)0x4718, (byte)0x91, (byte)0x19, (byte)0xef, (byte)0x62, (byte)0xd6, (byte)0x31, (byte)0xf2, (byte)0xab) [static]

Implements fullsvr::ICallFactory.

Definition at line 27 of file FullServ.java.

The documentation for this class was generated from the following file:
  • Com/Fundamentals/AsyncCalls/JavaClient/FullSvr/FullServ.java
Generated on Wed Nov 13 2024 16:58:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: fullsvr::ICallFactory Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • fullsvr
  • fullsvr::ICallFactory
Public Member Functions | Static Public Attributes

fullsvr::ICallFactory Interface Reference

.interface(iid=1C733A30-2A1C-11CE-ADE5-00AA0044773D, thread=AUTO)

Inherits com::ms::com::IUnknown.

Inherited by fullsvr::FullServ.

List of all members.

Public Member Functions

void | CreateCall (com.ms.com._Guid riid, IUnknown pCtrlUnk, com.ms.com._Guid riid2, IUnknown[] ppv)

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x1c733a30, (short)0x2a1c, (short)0x11ce, (byte)0xad, (byte)0xe5, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x44, (byte)0x77, (byte)0x3d)

Detailed Description

Definition at line 20 of file ICallFactory.java.

Member Function Documentation

void fullsvr::ICallFactory::CreateCall | ( | com.ms.com._Guid | riid,
 |  | IUnknown | pCtrlUnk,
 |  | com.ms.com._Guid | riid2,
 |  | IUnknown[] | ppv
 | ) |  |

.method(vtoffset=0, addFlagsVtable=4) .parameters([in,type=PTR] riid, [in,iid=00000000-0000-0000-C000-000000000046,thread=AUTO,type=OBJECT] pCtrlUnk, [in,type=PTR] riid2, [out,size=1,type=ARRAY] ppv)

Implemented in fullsvr::FullServ.

Member Data Documentation

final com.ms.com._Guid fullsvr::ICallFactory::iid = new com.ms.com._Guid((int)0x1c733a30, (short)0x2a1c, (short)0x11ce, (byte)0xad, (byte)0xe5, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x44, (byte)0x77, (byte)0x3d) [static]

Implemented in fullsvr::FullServ.

Definition at line 27 of file ICallFactory.java.

The documentation for this interface was generated from the following file:
  • Com/Fundamentals/AsyncCalls/JavaClient/FullSvr/ICallFactory.java
Generated on Wed Nov 13 2024 16:58:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: fullsvr::ICancelMethodCalls Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • fullsvr
  • fullsvr::ICancelMethodCalls
Public Member Functions | Static Public Attributes

fullsvr::ICancelMethodCalls Interface Reference

.interface(iid=00000029-0000-0000-C000-000000000046, thread=AUTO)

Inherits com::ms::com::IUnknown.

Inherited by fullsvr::AsyncFullServ.

List of all members.

Public Member Functions

void | Cancel (int ulSeconds)
void | TestCancel ()

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x29, (short)0x0, (short)0x0, (byte)0xc0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x46)

Detailed Description

Definition at line 20 of file ICancelMethodCalls.java.

Member Function Documentation

void fullsvr::ICancelMethodCalls::Cancel ( int ulSeconds )

.method(vtoffset=0, addFlagsVtable=4) .parameters([in,type=U4] ulSeconds)

Implemented in fullsvr::AsyncFullServ.

void fullsvr::ICancelMethodCalls::TestCancel ( )

.method(vtoffset=1, addFlagsVtable=4) .parameters()

Implemented in fullsvr::AsyncFullServ.

Member Data Documentation

final com.ms.com._Guid fullsvr::ICancelMethodCalls::iid = new com.ms.com._Guid((int)0x29, (short)0x0, (short)0x0, (byte)0xc0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x46) [static]

Implemented in fullsvr::AsyncFullServ.

Definition at line 31 of file ICancelMethodCalls.java.

The documentation for this interface was generated from the following file:
  • Com/Fundamentals/AsyncCalls/JavaClient/FullSvr/ICancelMethodCalls.java
Generated on Wed Nov 13 2024 16:58:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: fullsvr::IFullServ Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • fullsvr
  • fullsvr::IFullServ
Public Member Functions | Static Public Attributes

fullsvr::IFullServ Interface Reference

.interface(iid=D3140112-D43F-4718-9119-EF62D631F2AB, thread=AUTO)

Inherits com::ms::com::IUnknown.

Inherited by fullsvr::FullServ.

List of all members.

Public Member Functions

int | Sum (int i, int j)

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0xd3140112, (short)0xd43f, (short)0x4718, (byte)0x91, (byte)0x19, (byte)0xef, (byte)0x62, (byte)0xd6, (byte)0x31, (byte)0xf2, (byte)0xab)

Detailed Description

Definition at line 20 of file IFullServ.java.

Member Function Documentation

int fullsvr::IFullServ::Sum | ( | int | i,
 |  | int | j
 | ) |  |

.method(vtoffset=0, addFlagsVtable=4) .parameters([in,type=I4] i, [in,type=I4] j, [type=I4] return)

Member Data Documentation

final com.ms.com._Guid fullsvr::IFullServ::iid = new com.ms.com._Guid((int)0xd3140112, (short)0xd43f, (short)0x4718, (byte)0x91, (byte)0x19, (byte)0xef, (byte)0x62, (byte)0xd6, (byte)0x31, (byte)0xf2, (byte)0xab) [static]

Definition at line 27 of file IFullServ.java.

The documentation for this interface was generated from the following file:
  • Com/Fundamentals/AsyncCalls/JavaClient/FullSvr/IFullServ.java
Generated on Wed Nov 13 2024 16:58:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: fullsvr::ISynchronize Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • fullsvr
  • fullsvr::ISynchronize
Public Member Functions | Static Public Attributes

fullsvr::ISynchronize Interface Reference

.interface(iid=00000030-0000-0000-C000-000000000046, thread=AUTO)

Inherits com::ms::com::IUnknown.

Inherited by fullsvr::AsyncFullServ.

List of all members.

Public Member Functions

void | Reset ()
void | Signal ()
void | Wait (int dwFlags, int dwMilliseconds)

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x30, (short)0x0, (short)0x0, (byte)0xc0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x46)

Detailed Description

Definition at line 20 of file ISynchronize.java.

Member Function Documentation

void fullsvr::ISynchronize::Reset ( )

.method(vtoffset=2, addFlagsVtable=4) .parameters()

void fullsvr::ISynchronize::Signal ( )

.method(vtoffset=1, addFlagsVtable=4) .parameters()

void fullsvr::ISynchronize::Wait | ( | int | dwFlags,
 |  | int | dwMilliseconds
 | ) |  |

.method(vtoffset=0, addFlagsVtable=4) .parameters([in,type=U4] dwFlags, [in,type=U4] dwMilliseconds)

Member Data Documentation

final com.ms.com._Guid fullsvr::ISynchronize::iid = new com.ms.com._Guid((int)0x30, (short)0x0, (short)0x0, (byte)0xc0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x46) [static]

Definition at line 35 of file ISynchronize.java.

The documentation for this interface was generated from the following file:
  • Com/Fundamentals/AsyncCalls/JavaClient/FullSvr/ISynchronize.java
Generated on Wed Nov 13 2024 16:58:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: GBGETINT Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

GBGETINT Struct Reference

#include "GizmoBar.h"

List of all members.

Public Attributes

BOOL fSigned
BOOL fSuccess

Detailed Description

Definition at line 198 of file GizmoBar.h.

Member Data Documentation

BOOL GBGETINT::fSigned

Definition at line 200 of file GizmoBar.h.

BOOL GBGETINT::fSuccess

Definition at line 201 of file GizmoBar.h.

The documentation for this struct was generated from the following file:
  • Com/Fundamentals/Include/GizmoBar.h
Generated on Wed Nov 13 2024 16:57:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: GBGETTEXTA Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

GBGETTEXTA Struct Reference

#include "GizmoBar.h"

List of all members.

Public Attributes

UINT cch
LPSTR psz

Detailed Description

Definition at line 175 of file GizmoBar.h.

Member Data Documentation

UINT GBGETTEXTA::cch

Definition at line 178 of file GizmoBar.h.

LPSTR GBGETTEXTA::psz

Definition at line 177 of file GizmoBar.h.

The documentation for this struct was generated from the following file:
  • Com/Fundamentals/Include/GizmoBar.h
Generated on Wed Nov 13 2024 16:57:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: GBGETTEXTW Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

GBGETTEXTW Struct Reference

#include "GizmoBar.h"

List of all members.

Public Attributes

UINT cch
LPWSTR psz

Detailed Description

Definition at line 180 of file GizmoBar.h.

Member Data Documentation

UINT GBGETTEXTW::cch

Definition at line 183 of file GizmoBar.h.

LPWSTR GBGETTEXTW::psz

Definition at line 182 of file GizmoBar.h.

The documentation for this struct was generated from the following file:
  • Com/Fundamentals/Include/GizmoBar.h
Generated on Wed Nov 13 2024 16:57:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: GBMSG Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

GBMSG Struct Reference

#include "GizmoBar.h"

List of all members.

Public Attributes

UINT iMsg
LPARAM | lParam
WPARAM | wParam

Detailed Description

Definition at line 165 of file GizmoBar.h.

Member Data Documentation

UINT GBMSG::iMsg

Definition at line 167 of file GizmoBar.h.

LPARAM GBMSG::lParam

Definition at line 169 of file GizmoBar.h.

WPARAM GBMSG::wParam

Definition at line 168 of file GizmoBar.h.

The documentation for this struct was generated from the following file:
  • Com/Fundamentals/Include/GizmoBar.h
Generated on Wed Nov 13 2024 16:57:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: GBSETINT Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

GBSETINT Struct Reference

#include "GizmoBar.h"

List of all members.

Public Attributes

BOOL fSigned
UINT uValue

Detailed Description

Definition at line 208 of file GizmoBar.h.

Member Data Documentation

BOOL GBSETINT::fSigned

Definition at line 211 of file GizmoBar.h.

UINT GBSETINT::uValue

Definition at line 210 of file GizmoBar.h.

The documentation for this struct was generated from the following file:
  • Com/Fundamentals/Include/GizmoBar.h
Generated on Wed Nov 13 2024 16:57:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: GLOBAL_STRUCT Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

GLOBAL_STRUCT Struct Reference

#include "DebMain.h"

List of all members.

Public Attributes

SIZE | ClientSize
DWORD dwActiveDebuggees
BOOL fHelpUsed
HINSTANCE | hInstance
HWND | hWndListBox
HWND | hWndMain
HWND | hWndToolBar
SIZE | ListBoxSize
LONG | MaxStrLen
WNDPROC | OldListBoxWndProc
TCHAR | szApiFailed [64]
TCHAR | szAppName [64]
TCHAR | szShortAppName [32]
INT | ToolBarHeight
INT | xPosOld
INT | yPosOld

Detailed Description

Definition at line 50 of file DebMain.h.

Member Data Documentation

SIZE GLOBAL_STRUCT::ClientSize

Definition at line 61 of file DebMain.h.

DWORD GLOBAL_STRUCT::dwActiveDebuggees

Definition at line 60 of file DebMain.h.

BOOL GLOBAL_STRUCT::fHelpUsed

Definition at line 66 of file DebMain.h.

HINSTANCE GLOBAL_STRUCT::hInstance

Definition at line 51 of file DebMain.h.

HWND GLOBAL_STRUCT::hWndListBox

Definition at line 53 of file DebMain.h.

HWND GLOBAL_STRUCT::hWndMain

Definition at line 52 of file DebMain.h.

HWND GLOBAL_STRUCT::hWndToolBar

Definition at line 54 of file DebMain.h.

SIZE GLOBAL_STRUCT::ListBoxSize

Definition at line 62 of file DebMain.h.

LONG GLOBAL_STRUCT::MaxStrLen

Definition at line 59 of file DebMain.h.

WNDPROC GLOBAL_STRUCT::OldListBoxWndProc

Definition at line 55 of file DebMain.h.

TCHAR GLOBAL_STRUCT::szApiFailed[64]

Definition at line 58 of file DebMain.h.

TCHAR GLOBAL_STRUCT::szAppName[64]

Definition at line 56 of file DebMain.h.

TCHAR GLOBAL_STRUCT::szShortAppName[32]

Definition at line 57 of file DebMain.h.

INT GLOBAL_STRUCT::ToolBarHeight

Definition at line 63 of file DebMain.h.

INT GLOBAL_STRUCT::xPosOld

Definition at line 64 of file DebMain.h.

INT GLOBAL_STRUCT::yPosOld

Definition at line 65 of file DebMain.h.

The documentation for this struct was generated from the following file:
  • WinBase/Debug/Deb/DebMain.h
Generated on Wed Nov 13 2024 16:57:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: GlobalVars Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

GlobalVars Class Reference

#include "WSnmpUtil.h"

List of all members.

Public Member Functions

GlobalVars ()
~GlobalVars ()

Public Attributes

struct sockaddr_in | agentSockAddr
BOOL doSet
BOOL fDone
HINSTANCE | g_hInst
smiINT | max_repetitions
smiINT | non_repeaters
smiINT32 | nRequestId
smiINT32 | nRetries
smiINT32 | nTimeOut
smiOID | oid
smiINT32 | oidCount
smiINT32 | operation
CHAR * | pAgentCommunity
CHAR * | pAgentStrAddr
CHAR * | pSetValue
CHAR * | pszOid [CMD_LINE_ARGS]
smiOID | startOid
smiVALUE | value
BOOL version

Detailed Description

Definition at line 74 of file WSnmpUtil.h.

Constructor & Destructor Documentation

GlobalVars::GlobalVars ( ) [inline]

Definition at line 77 of file WSnmpUtil.h.

    {
        nTimeOut        = 6000;
        nRetries        = 3;
        nRequestId      = 1;
        oidCount        = 0;
        pAgentStrAddr   = NULL;
        pAgentCommunity = NULL;
        pSetValue       = NULL;
        fDone           = FALSE;           // default
        version         = FALSE;           // Use v1 by default;
        doSet           = FALSE;           // dont do set by default.
    }

GlobalVars::~GlobalVars ( ) [inline]

Definition at line 91 of file WSnmpUtil.h.

{ }

Member Data Documentation

struct sockaddr_in GlobalVars::agentSockAddr

Definition at line 110 of file WSnmpUtil.h.

BOOL GlobalVars::doSet

Definition at line 103 of file WSnmpUtil.h.

BOOL GlobalVars::fDone

Definition at line 104 of file WSnmpUtil.h.

HINSTANCE GlobalVars::g_hInst

Definition at line 92 of file WSnmpUtil.h.

smiINT GlobalVars::max_repetitions

Definition at line 102 of file WSnmpUtil.h.

smiINT GlobalVars::non_repeaters

Definition at line 101 of file WSnmpUtil.h.

smiINT32 GlobalVars::nRequestId

Definition at line 97 of file WSnmpUtil.h.

smiINT32 GlobalVars::nRetries

Definition at line 96 of file WSnmpUtil.h.

smiINT32 GlobalVars::nTimeOut

Definition at line 95 of file WSnmpUtil.h.

smiOID GlobalVars::oid

Definition at line 100 of file WSnmpUtil.h.

smiINT32 GlobalVars::oidCount

Definition at line 93 of file WSnmpUtil.h.

smiINT32 GlobalVars::operation

Definition at line 94 of file WSnmpUtil.h.

CHAR* GlobalVars::pAgentCommunity

Definition at line 108 of file WSnmpUtil.h.

CHAR* GlobalVars::pAgentStrAddr

Definition at line 106 of file WSnmpUtil.h.

CHAR* GlobalVars::pSetValue

Definition at line 107 of file WSnmpUtil.h.

CHAR* GlobalVars::pszOid[CMD_LINE_ARGS]

Definition at line 109 of file WSnmpUtil.h.

smiOID GlobalVars::startOid

Definition at line 99 of file WSnmpUtil.h.

smiVALUE GlobalVars::value

Definition at line 98 of file WSnmpUtil.h.

BOOL GlobalVars::version

Definition at line 105 of file WSnmpUtil.h.

The documentation for this class was generated from the following file:
  • NetDS/Snmp/WSnmp/WSnmpUtil.h
Generated on Wed Nov 13 2024 16:57:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: gss_buffer_desc_struct Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

gss_buffer_desc_struct Struct Reference

#include "GssAPI.h"

List of all members.

Public Attributes

size_t | length
void FAR * | value

Detailed Description

Definition at line 116 of file GssAPI.h.

Member Data Documentation

size_t gss_buffer_desc_struct::length

Definition at line 118 of file GssAPI.h.

void FAR* gss_buffer_desc_struct::value

Definition at line 119 of file GssAPI.h.

The documentation for this struct was generated from the following file:
  • Security/SSPI/GSS/GssAPI.h
Generated on Wed Nov 13 2024 16:57:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: gss_channel_bindings_struct Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

gss_channel_bindings_struct Struct Reference

#include "GssAPI.h"

List of all members.

Public Attributes

gss_buffer_desc acceptor_address
OM_uint32 acceptor_addrtype
gss_buffer_desc application_data
gss_buffer_desc initiator_address
OM_uint32 initiator_addrtype

Detailed Description

Definition at line 122 of file GssAPI.h.

Member Data Documentation

gss_buffer_desc gss_channel_bindings_struct::acceptor_address

Definition at line 127 of file GssAPI.h.

OM_uint32 gss_channel_bindings_struct::acceptor_addrtype

Definition at line 126 of file GssAPI.h.

gss_buffer_desc gss_channel_bindings_struct::application_data

Definition at line 128 of file GssAPI.h.

gss_buffer_desc gss_channel_bindings_struct::initiator_address

Definition at line 125 of file GssAPI.h.

OM_uint32 gss_channel_bindings_struct::initiator_addrtype

Definition at line 124 of file GssAPI.h.

The documentation for this struct was generated from the following file:
  • Security/SSPI/GSS/GssAPI.h
Generated on Wed Nov 13 2024 16:57:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: gss_OID_desc_struct Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

gss_OID_desc_struct Struct Reference

#include "GssAPI.h"

List of all members.

Public Attributes

void FAR * elements
OM_uint32 length

Detailed Description

Definition at line 104 of file GssAPI.h.

Member Data Documentation

void FAR* gss_OID_desc_struct::elements

Definition at line 107 of file GssAPI.h.

OM_uint32 gss_OID_desc_struct::length

Definition at line 106 of file GssAPI.h.

The documentation for this struct was generated from the following file:
  • Security/SSPI/GSS/GssAPI.h
Generated on Wed Nov 13 2024 16:57:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: gss_OID_set_desc_struct Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

gss_OID_set_desc_struct Struct Reference

#include "GssAPI.h"

List of all members.

Public Attributes

size_t count
gss_OID elements

Detailed Description

Definition at line 110 of file GssAPI.h.

Member Data Documentation

size_t gss_OID_set_desc_struct::count

Definition at line 112 of file GssAPI.h.

gss_OID gss_OID_set_desc_struct::elements

Definition at line 113 of file GssAPI.h.

The documentation for this struct was generated from the following file:
  • Security/SSPI/GSS/GssAPI.h
Generated on Wed Nov 13 2024 16:57:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Hello2J Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

Hello2J Class Reference

List of all members.

Public Member Functions

Hello2J ()
void | destroy ()
String | getAppletInfo ()
void | init ()
void | paint (Graphics g)
void | start ()
void | stop ()

Private Attributes

final int | FALSE = 0
IAgentEx | m_AgentEx = null
boolean | m_bUsingDefaultCharacter
IAgentCharacterEx | m_Character [] = {null}
int | m_CharacterID [] = {-1}
final String | m_CharacterPathOld = "\\program files\\microsoft agent\\characters\\merlin.acs"
int | m_CommandID [] = {-1}
IAgentCommands | m_Commands = null
int | m_RequestID [] = {0}
Notify | m_Sink = null
int | m_SinkID [] = {-1}
final int | TRUE = 1

Detailed Description

Definition at line 34 of file Hello2J.java.

Constructor & Destructor Documentation

Hello2J::Hello2J ( ) [inline]

Definition at line 58 of file Hello2J.java.

  {
    // Constructor left intentionally blank
  }

Member Function Documentation

void Hello2J::destroy ( ) [inline]

Definition at line 75 of file Hello2J.java.

  {
  }

String Hello2J::getAppletInfo ( ) [inline]

Definition at line 63 of file Hello2J.java.

  {
    return "Name: HelloJ\r\n" +
           "Author: anonymous\r\n" +
           "Created with Microsoft Visual J++ Version 1.1";
  }

void Hello2J::init ( ) [inline]

Definition at line 70 of file Hello2J.java.

  {
      resize(0, 0);
  }

void Hello2J::paint ( Graphics g ) [inline]

Definition at line 79 of file Hello2J.java.

  {
  }

void Hello2J::start ( ) [inline]

Definition at line 83 of file Hello2J.java.

  {
    // Start the Microsoft Agent Server

    m_AgentEx = (IAgentEx) new AgentServer();

    // Create a notify sink object

    m_Sink = new Notify();

    try
    {
      // And register it with Microsoft Agent so that we
      // can receive notifications.

      m_AgentEx.Register(m_Sink, m_SinkID);

    }
    catch(com.ms.com.ComException eSink)
    {
      stop();
      return;
    }

    // Load a character

    try
    {
      // First try to load a default character

      m_AgentEx.Load(new Variant(), m_CharacterID, m_RequestID);

      m_bUsingDefaultCharacter = true;

    }
    catch(com.ms.com.ComException e)
    {
      // No default character. Try to load Merlin from the directory
      // most commonly used in version 1.5 applications.

      Variant characterPath = new Variant();
      characterPath.putString(m_CharacterPathOld);

      try {

        m_AgentEx.Load(characterPath, m_CharacterID, m_RequestID);

        m_bUsingDefaultCharacter = false;

      }
      catch(com.ms.com.ComException e2)
      {
        // Hmmm.  We couldn't load the character so what else
        // can we do?

        stop();
        return;
      }
    }

    try {

      // Get the IAgentCharacter interface.
      // NOTE NOTE NOTE!!! If you are using Visual J++ or
      // other Java environments that can correctly handle
      // derived COM types (e.g. IAgentCharacterEx) then you
      // can retrieve the character interface with a single
      // call to GetCharacterEx.
      //
      //    m_AgentEx.GetCharacterEx(m_CharacterID[0], m_Character);
      //
      // Some environments (e.g. Visual J++ 1.1) do not correctly
      // handle derived COM types. So retrieving the IAgentCharacterEx
      // interface is a 2 step process. First get the IAgentCharacter
      // interface.

      IAgentCharacter char15[] = {null};
      m_AgentEx.GetCharacter(m_CharacterID[0], char15);

      // Then get the IAgentCharacterEx interface and release
      // the IAgentCharacter interface.

      m_Character[0] = (IAgentCharacterEx)char15[0];
      char15 = null;

      // Set the character's language

      m_Character[0].SetLanguageID(0x0409);

      // If we successfully loaded the default character,
      // add a command so that the user can switch characters.

      if (m_bUsingDefaultCharacter)
      {
        m_Commands = (IAgentCommands)m_Character[0];
        m_Commands.Add("&Choose Character...", "", TRUE, TRUE, m_CommandID);
        m_Commands = null;
      }

      // Give our notify sink access to the necessary data

      m_Sink.Initialize(m_AgentEx, m_Character[0], m_CommandID[0]);

      // Show the character

      m_Character[0].Show(FALSE, m_RequestID);

      // And speak hello

      m_Character[0].Speak("Hello World!", null, m_RequestID);

    }
    catch(com.ms.com.ComException e)
    {
      stop();
    }
  }

void Hello2J::stop ( ) [inline]

Definition at line 201 of file Hello2J.java.

  {
    if (m_CharacterID[0] > 0)
    {
      m_Character[0] = null;
      m_AgentEx.Unload(m_CharacterID[0]);
      m_CharacterID[0] = -1;
    }

    // Unregister the notify sink, we're done with the
    // Agent server.

    if (m_SinkID[0] > 0)
    {
      m_AgentEx.Unregister(m_SinkID[0]);
      m_SinkID[0] = -1;
    }

    m_Sink = null;
    m_AgentEx = null;
  }

Member Data Documentation

final int Hello2J::FALSE = 0 [private]

Definition at line 54 of file Hello2J.java.

IAgentEx Hello2J::m_AgentEx = null [private]

Definition at line 38 of file Hello2J.java.

boolean Hello2J::m_bUsingDefaultCharacter [private]

Definition at line 46 of file Hello2J.java.

IAgentCharacterEx Hello2J::m_Character[] = {null} [private]

Definition at line 39 of file Hello2J.java.

int Hello2J::m_CharacterID[] = {-1} [private]

Definition at line 40 of file Hello2J.java.

final String Hello2J::m_CharacterPathOld = "\\program files\\microsoft agent\\characters\\merlin.acs" [private]

Definition at line 44 of file Hello2J.java.

int Hello2J::m_CommandID[] = {-1} [private]

Definition at line 42 of file Hello2J.java.

IAgentCommands Hello2J::m_Commands = null [private]

Definition at line 41 of file Hello2J.java.

int Hello2J::m_RequestID[] = {0} [private]

Definition at line 43 of file Hello2J.java.

Notify Hello2J::m_Sink = null [private]

Definition at line 51 of file Hello2J.java.

int Hello2J::m_SinkID[] = {-1} [private]

Definition at line 52 of file Hello2J.java.

final int Hello2J::TRUE = 1 [private]

Definition at line 55 of file Hello2J.java.

The documentation for this class was generated from the following file:
  • Web/MSAgent/Java/Hello2/Hello2J.java
Generated on Wed Nov 13 2024 16:57:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Hello3J Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

Hello3J Class Reference

List of all members.

Public Member Functions

Hello3J ()
void | destroy ()
String | getAppletInfo ()
void | HideCharacters ()
void | init ()
void | paint (Graphics g)
void | start ()
void | stop ()

Private Member Functions

boolean | LoadCharacter (String filename, int[] characterID, IAgentCharacterEx[] character)

Private Attributes

final int | FALSE = 0
IAgentEx | m_AgentEx = null
IAgentCharacterEx | m_Genie [] = {null}
final String | m_GenieFilename = "genie.acs"
int | m_GenieID [] = {-1}
IAgentCharacterEx | m_Merlin [] = {null}
final String | m_MerlinFilename = "merlin.acs"
int | m_MerlinID [] = {-1}
final String | m_OldPath = "\\program files\\microsoft agent\\characters\\"
int | m_RequestID [] = {0}
Notify | m_Sink = null
int | m_SinkID [] = {-1}
int | m_WaitID [] = {-1}
final int | TRUE = 1

Detailed Description

Definition at line 33 of file Hello3J.java.

Constructor & Destructor Documentation

Hello3J::Hello3J ( ) [inline]

Definition at line 59 of file Hello3J.java.

  {
    // Constructor left intentionally blank
  }

Member Function Documentation

void Hello3J::destroy ( ) [inline]

Definition at line 76 of file Hello3J.java.

  {
  }

String Hello3J::getAppletInfo ( ) [inline]

Definition at line 64 of file Hello3J.java.

  {
    return "Name: Hello3J\r\n" +
           "Author: anonymous\r\n" +
           "Created with Microsoft Visual J++ Version 1.1";
  }

void Hello3J::HideCharacters ( ) [inline]

Definition at line 259 of file Hello3J.java.

  {
    // This method is called by the notification sink when the
    // last Agent request has completed.  We'll just hide the
    // characters.

    m_Merlin[0].Hide(FALSE, m_RequestID);
    m_Genie[0].Hide(FALSE, m_RequestID);
  }

void Hello3J::init ( ) [inline]

Definition at line 71 of file Hello3J.java.

  {
      resize(0, 0);
  }

boolean Hello3J::LoadCharacter | ( | String | filename,
 |  | int[] | characterID,
 |  | IAgentCharacterEx[] | character |
 | ) |  |  | [inline, private]

Definition at line 84 of file Hello3J.java.

  {
    try
    {
      // First, try to load using just the filename. This is
      // a new feature for Agent 2.0. Agent will look in the
      // %windows%\msagent\chars directory.

      m_AgentEx.Load(new Variant(filename), characterID, m_RequestID);

    }
    catch(com.ms.com.ComException e)
    {
      // Couldn't load it. Construct a path using the directory
      // most common to Agent 1.5 applications and try to load
      // from there.

      try
      {

        m_AgentEx.Load(new Variant(m_OldPath + filename), characterID, m_RequestID);

      }
      catch(com.ms.com.ComException e2)
      {
        return false;
      }
    }

    try
    {
      // Get the IAgentCharacter interface.
      // NOTE NOTE NOTE!!! If you are using Visual J++ or
      // other Java environments that can correctly handle
      // derived COM types (e.g. IAgentCharacterEx) then you
      // can retrieve the character interface with a single
      // call to GetCharacterEx.
      //
      //    m_AgentEx.GetCharacterEx(characterID[0], character);
      //
      // Some environments (e.g. Visual J++ 1.1) do not correctly
      // handle derived COM types. So retrieving the IAgentCharacterEx
      // interface is a 2 step process. First get the IAgentCharacter
      // interface.

      IAgentCharacter char15[] = {null};
      m_AgentEx.GetCharacter(characterID[0], char15);

      // Then get the IAgentCharacterEx interface and release
      // the IAgentCharacter interface.

      character[0] = (IAgentCharacterEx)char15[0];
      char15 = null;

    }
    catch(com.ms.com.ComException e3)
    {
      return false;
    }

    return true;
  }

void Hello3J::paint ( Graphics g ) [inline]

Definition at line 80 of file Hello3J.java.

  {
  }

void Hello3J::start ( ) [inline]

Definition at line 149 of file Hello3J.java.

  {
    // Start the Microsoft Agent Server

    m_AgentEx = (IAgentEx) new AgentServer();

    // Create and register a notify sink

    m_Sink = new Notify(this);

    try
    {
      // And register it with Microsoft Agent so that we
      // can receive notifications.

      m_AgentEx.Register(m_Sink, m_SinkID);

    }
    catch(com.ms.com.ComException eSink)
    {
      stop();
      return;
    }

    // Load the characters

    if (!LoadCharacter(m_MerlinFilename, m_MerlinID, m_Merlin) ||
      !LoadCharacter(m_GenieFilename, m_GenieID, m_Genie))
    {
      stop();
      return;
    }

    try {

      // Set their language

      m_Genie[0].SetLanguageID(0x0409);
      m_Merlin[0].SetLanguageID(0x0409);

      // Position the characters

      m_Genie[0].MoveTo((short)0, (short)100, 0, m_RequestID);
      m_Merlin[0].MoveTo((short)200, (short)100, 0, m_RequestID);

      // Show them

      m_Genie[0].Show(FALSE, m_RequestID);
      m_Merlin[0].Show(FALSE, m_RequestID);

      // Have Genie gesture towards Merlin

      m_Genie[0].GestureAt((short)150, (short)100, m_RequestID);

      // And have Genie say hello to Merlin

      m_Genie[0].Speak("Hi there Merlin.", null, m_WaitID);

      // Make Merlin wait for Genie to finish speaking

      m_Merlin[0].Wait(m_WaitID[0], m_RequestID);

      // Have Merlin gesture towards Genie

      m_Merlin[0].GestureAt((short)0, (short)100, m_RequestID);

      // And then speak back to Genie.  Use a request id owned by the
      // sink object.  When we get a request complete notification, the
      // sink will call back into the applet.

      m_Merlin[0].Speak("Hi Genie.  See you later", null, m_Sink.m_DoneID);

    }
    catch(com.ms.com.ComException e)
    {
      stop();
    }
  }

void Hello3J::stop ( ) [inline]

Definition at line 228 of file Hello3J.java.

  {
    // Unload the characters

    if (m_MerlinID[0] > 0)
    {
      m_Merlin[0] = null;
      m_AgentEx.Unload(m_MerlinID[0]);
      m_MerlinID[0] = -1;
    }

    if (m_GenieID[0] > 0)
    {
      m_Genie[0] = null;
      m_AgentEx.Unload(m_GenieID[0]);
      m_GenieID[0] = -1;
    }

    // Unregister the notify sink, we're done with the
    // Agent server.

    if (m_SinkID[0] > 0)
    {
      m_AgentEx.Unregister(m_SinkID[0]);
      m_SinkID[0] = -1;
    }

    m_Sink = null;
    m_AgentEx = null;
  }

Member Data Documentation

final int Hello3J::FALSE = 0 [private]

Definition at line 55 of file Hello3J.java.

IAgentEx Hello3J::m_AgentEx = null [private]

Definition at line 38 of file Hello3J.java.

IAgentCharacterEx Hello3J::m_Genie[] = {null} [private]

Definition at line 43 of file Hello3J.java.

final String Hello3J::m_GenieFilename = "genie.acs" [private]

Definition at line 46 of file Hello3J.java.

int Hello3J::m_GenieID[] = {-1} [private]

Definition at line 44 of file Hello3J.java.

IAgentCharacterEx Hello3J::m_Merlin[] = {null} [private]

Definition at line 41 of file Hello3J.java.

final String Hello3J::m_MerlinFilename = "merlin.acs" [private]

Definition at line 45 of file Hello3J.java.

int Hello3J::m_MerlinID[] = {-1} [private]

Definition at line 42 of file Hello3J.java.

final String Hello3J::m_OldPath = "\\program files\\microsoft agent\\characters\\" [private]

Definition at line 47 of file Hello3J.java.

int Hello3J::m_RequestID[] = {0} [private]

Definition at line 40 of file Hello3J.java.

Notify Hello3J::m_Sink = null [private]

Definition at line 52 of file Hello3J.java.

int Hello3J::m_SinkID[] = {-1} [private]

Definition at line 53 of file Hello3J.java.

int Hello3J::m_WaitID[] = {-1} [private]

Definition at line 39 of file Hello3J.java.

final int Hello3J::TRUE = 1 [private]

Definition at line 56 of file Hello3J.java.

The documentation for this class was generated from the following file:
  • Web/MSAgent/Java/Hello3/Hello3J.java
Generated on Wed Nov 13 2024 16:57:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: HelloJ Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

HelloJ Class Reference

List of all members.

Public Member Functions

HelloJ ()
void | destroy ()
String | getAppletInfo ()
void | init ()
void | paint (Graphics g)
void | start ()
void | stop ()

Private Attributes

final int | FALSE = 0
IAgentEx | m_AgentEx = null
IAgentCharacterEx | m_Character [] = {null}
int | m_CharacterID [] = {-1}
final String | m_CharacterPathOld = "\\program files\\microsoft agent\\characters\\merlin.acs"
int | m_RequestID [] = {0}
final int | TRUE = 1

Detailed Description

Definition at line 32 of file HelloJ.java.

Constructor & Destructor Documentation

HelloJ::HelloJ ( ) [inline]

Definition at line 46 of file HelloJ.java.

  {
    // Constructor left intentionally blank
  }

Member Function Documentation

void HelloJ::destroy ( ) [inline]

Definition at line 63 of file HelloJ.java.

  {
  }

String HelloJ::getAppletInfo ( ) [inline]

Definition at line 51 of file HelloJ.java.

  {
    return "Name: HelloJ\r\n" +
           "Author: anonymous\r\n" +
           "Created with Microsoft Visual J++ Version 1.1";
  }

void HelloJ::init ( ) [inline]

Definition at line 58 of file HelloJ.java.

  {
      resize(0, 0);
  }

void HelloJ::paint ( Graphics g ) [inline]

Definition at line 67 of file HelloJ.java.

  {
  }

void HelloJ::start ( ) [inline]

Definition at line 71 of file HelloJ.java.

  {
    // Start the Microsoft Agent Server

    m_AgentEx = (IAgentEx) new AgentServer();

    try
    {
      // First try to load a default character

      m_AgentEx.Load(new Variant(), m_CharacterID, m_RequestID);

    }
    catch(com.ms.com.ComException e)
    {
      // No default character. Try to load Merlin from the directory
      // most commonly used in version 1.5 applications.

      Variant characterPath = new Variant();
      characterPath.putString(m_CharacterPathOld);

      try {

        m_AgentEx.Load(characterPath, m_CharacterID, m_RequestID);

      }
      catch(com.ms.com.ComException e2)
      {
        // Hmmm.  We couldn't load the character so what else
        // can we do?

        stop();
        return;
      }
    }

    try {

      // Get the IAgentCharacter interface.
      // NOTE NOTE NOTE!!! If you are using Visual J++ or
      // other Java environments that can correctly handle
      // derived COM types (e.g. IAgentCharacterEx) then you
      // can retrieve the character interface with a single
      // call to GetCharacterEx.
      //
      //    m_AgentEx.GetCharacterEx(m_CharacterID[0], m_Character);
      //
      // Some environments (e.g. Visual J++ 1.1) do not correctly
      // handle derived COM types. So retrieving the IAgentCharacterEx
      // interface is a 2 step process. First get the IAgentCharacter
      // interface.

      IAgentCharacter char15[] = {null};
      m_AgentEx.GetCharacter(m_CharacterID[0], char15);

      // Then get the IAgentCharacterEx interface and release
      // the IAgentCharacter interface.

      m_Character[0] = (IAgentCharacterEx)char15[0];
      char15 = null;

      // Set the character's language

      m_Character[0].SetLanguageID(0x0409);

      // Show the character

      m_Character[0].Show(FALSE, m_RequestID);

      // And speak hello

      m_Character[0].Speak("Hello World!", null, m_RequestID);

    }
    catch(com.ms.com.ComException e)
    {
      stop();
    }
  }

void HelloJ::stop ( ) [inline]

Definition at line 151 of file HelloJ.java.

  {
    if (m_CharacterID[0] > 0)
    {
      m_Character[0] = null;
      m_AgentEx.Unload(m_CharacterID[0]);
      m_CharacterID[0] = -1;
    }

    m_AgentEx = null;
  }

Member Data Documentation

final int HelloJ::FALSE = 0 [private]

Definition at line 42 of file HelloJ.java.

IAgentEx HelloJ::m_AgentEx = null [private]

Definition at line 36 of file HelloJ.java.

IAgentCharacterEx HelloJ::m_Character[] = {null} [private]

Definition at line 37 of file HelloJ.java.

int HelloJ::m_CharacterID[] = {-1} [private]

Definition at line 38 of file HelloJ.java.

final String HelloJ::m_CharacterPathOld = "\\program files\\microsoft agent\\characters\\merlin.acs" [private]

Definition at line 40 of file HelloJ.java.

int HelloJ::m_RequestID[] = {0} [private]

Definition at line 39 of file HelloJ.java.

final int HelloJ::TRUE = 1 [private]

Definition at line 43 of file HelloJ.java.

The documentation for this class was generated from the following file:
  • Web/MSAgent/Java/Hello/HelloJ.java
Generated on Wed Nov 13 2024 16:57:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: HelloWorld Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

HelloWorld Class Reference

#include "HelloWorld.h"

Inherits IHelloWorld.

List of all members.

Public Member Functions

HelloWorld ()
HelloWorld ()
~HelloWorld ()
STDMETHOD() | GetIDsOfNames (REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgdispid)
STDMETHOD() | GetTypeInfo (UINT itinfo, LCID lcid, ITypeInfo **pptinfo)
STDMETHOD() | GetTypeInfoCount (UINT *pctinfo)
STDMETHOD() | InterfaceSupportsErrorInfo (REFIID riid)
STDMETHOD() | InterfaceSupportsErrorInfo (REFIID riid)
STDMETHOD() | Invoke (DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pdispparams, VARIANT *pvarResult, EXCEPINFO *pexcepinfo, UINT *puArgErr)
STDMETHOD() | Operate (ULONG dwCode, VARIANT varData1, VARIANT varData2, VARIANT varData3)
STDMETHOD() | PrivateGetIDsOfNames (REFIID riid, OLECHAR **rgszNames, unsigned int cNames, LCID lcid, DISPID *rgdispid)
STDMETHOD() | PrivateInvoke (DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pdispparams, VARIANT *pvarResult, EXCEPINFO *pexcepinfo, UINT *puArgErr)
STDMETHOD() | Say ()
STDMETHOD() | Say ()

Protected Attributes

ITypeInfo * | m_pTypeInfo

Detailed Description

Definition at line 17 of file HelloWorld.h.

Constructor & Destructor Documentation

HelloWorld::HelloWorld ( ) [inline]

Definition at line 24 of file HelloWorld.h.

{}

HelloWorld::HelloWorld ( )
HelloWorld::~HelloWorld ( )

Definition at line 31 of file HelloWorld.cpp.

{
  if ( m_pTypeInfo )
  {
    m_pTypeInfo->Release();
  }

}

Member Function Documentation

STDMETHODIMP HelloWorld::GetIDsOfNames | ( | REFIID | riid,
 |  | LPOLESTR * | rgszNames,
 |  | UINT | cNames,
 |  | LCID | lcid,
 |  | DISPID * | rgdispid
 | ) |  |

Definition at line 92 of file HelloWorld.cpp.

{
   IDispatch *pDisp;
   HRESULT    hr;
   hr = OuterQueryInterface( IID_IDispatch, (void**) &pDisp );
   if ( SUCCEEDED(hr) )
   {
     hr = pDisp->GetIDsOfNames( riid, rgszNames, cNames, lcid, rgdispid);
     pDisp->Release();
   }

   return hr;

}

STDMETHODIMP HelloWorld::GetTypeInfo | ( | UINT | itinfo,
 |  | LCID | lcid,
 |  | ITypeInfo ** | pptinfo
 | ) |  |

Definition at line 78 of file HelloWorld.cpp.

{
   IDispatch *pDisp;
   HRESULT    hr;
   hr = OuterQueryInterface( IID_IDispatch, (void**) &pDisp );
   if ( SUCCEEDED(hr) )
   {
     hr = pDisp->GetTypeInfo( itinfo, lcid, pptinfo );
     pDisp->Release();
   }

   return hr;
}

STDMETHODIMP HelloWorld::GetTypeInfoCount ( UINT * pctinfo )

Definition at line 64 of file HelloWorld.cpp.

{
   IDispatch *pDisp;
   HRESULT    hr;
   hr = OuterQueryInterface( IID_IDispatch, (void**) &pDisp );
   if ( SUCCEEDED(hr) )
   {
     hr = pDisp->GetTypeInfoCount( pctinfo );
     pDisp->Release();
   }
   return hr;
}

STDMETHODIMP HelloWorld::InterfaceSupportsErrorInfo ( REFIID riid )

Definition at line 11 of file HelloWorld.cpp.

{
  static const IID* arr[] =
  {
    &IID_IHelloWorld,
  };

  for (int i=0;i<sizeof(arr)/sizeof(arr[0]);i++)
  {
    if (::InlineIsEqualGUID(*arr[i],riid))
      return S_OK;
  }
  return S_FALSE;
}

STDMETHOD() HelloWorld::InterfaceSupportsErrorInfo ( REFIID riid )
STDMETHODIMP HelloWorld::Invoke | ( | DISPID | dispidMember,
 |  | REFIID | riid,
 |  | LCID | lcid,
 |  | WORD | wFlags,
 |  | DISPPARAMS * | pdispparams,
 |  | VARIANT * | pvarResult,
 |  | EXCEPINFO * | pexcepinfo,
 |  | UINT * | puArgErr
 | ) |  |

Definition at line 108 of file HelloWorld.cpp.

{
   IDispatch *pDisp;
   HRESULT    hr;
   hr = OuterQueryInterface( IID_IDispatch, (void**) &pDisp );
   if ( SUCCEEDED(hr) )
   {
     hr = pDisp->Invoke( dispidMember, riid, lcid, wFlags, pdispparams, pvarResult,
                       pexcepinfo, puArgErr);
     pDisp->Release();
   }

   return hr;
}

STDMETHOD() HelloWorld::Operate | ( | ULONG | dwCode,
 |  | VARIANT | varData1,
 |  | VARIANT | varData2,
 |  | VARIANT | varData3 |
 | ) |  |  | [inline]

Definition at line 61 of file HelloWorld.h.

  {
    HRESULT hr = S_OK;

    switch (dwCode)
    {

      case ADS_EXT_INITCREDENTIALS:
          // For debugging purpose you can prompt a dialog box
          // MessageBox(NULL, "INITCRED", "ADsExt", MB_OK);
          break;

      default:
          hr = E_FAIL;
          break;

    }

        return hr;

  }

STDMETHOD() HelloWorld::PrivateGetIDsOfNames | ( | REFIID | riid,
 |  | OLECHAR ** | rgszNames,
 |  | unsigned int | cNames,
 |  | LCID | lcid,
 |  | DISPID * | rgdispid |
 | ) |  |  | [inline]

Definition at line 84 of file HelloWorld.h.

  {

    if (rgdispid == NULL)
    {
      return E_POINTER;
    }

    return  DispGetIDsOfNames(m_pTypeInfo, rgszNames, cNames, rgdispid);
  }

STDMETHOD() HelloWorld::PrivateInvoke | ( | DISPID | dispidMember,
 |  | REFIID | riid,
 |  | LCID | lcid,
 |  | WORD | wFlags,
 |  | DISPPARAMS * | pdispparams,
 |  | VARIANT * | pvarResult,
 |  | EXCEPINFO * | pexcepinfo,
 |  | UINT * | puArgErr |
 | ) |  |  | [inline]

Definition at line 97 of file HelloWorld.h.

  {
       return DispInvoke( (IHelloWorld*)this,
        m_pTypeInfo,
        dispidMember,
        wFlags,
        pdispparams,
        pvarResult,
        pexcepinfo,
        puArgErr );
  }

STDMETHODIMP HelloWorld::Say ( )

Implements IHelloWorld.

Definition at line 26 of file HelloWorld.cpp.

{
  AFX_MANAGE_STATE(AfxGetStaticModuleState())

  IADs *pADs;
  HRESULT hr;
  BSTR    bstr;
  TCHAR  szText[256];

  hr = OuterQueryInterface(IID_IADs, (void **) &pADs );
  if ( !SUCCEEDED(hr) )
  {
    return hr;
  }

  hr = pADs->get_Name(&bstr);
  if ( !SUCCEEDED(hr) )
  {
    pADs->Release();
    return hr;
  }

  ////////////////////////////////////////
  // Check for buffer overrun.
  UINT nMaxLen = sizeof(szText)/sizeof(TCHAR);
  UINT nLength = SysStringLen(bstr);
  TCHAR  szHelloFmt[] = _T("Hello %S");
  UINT fmtLen = sizeof(szHelloFmt)/sizeof(TCHAR);

  if ( nMaxLen <= (nLength+fmtLen) )
  {
    _tcscpy(szText,_T("Your string is too long"));

  }
  else
  {
    wsprintf(szText, _T("Hello %S"), bstr );
  }

  SysFreeString(bstr);

  ::MessageBox(NULL, szText, _T("From ADSI Extension"), MB_OK);
  pADs->Release();

  return S_OK;
}

STDMETHOD() HelloWorld::Say ( )

Implements IHelloWorld.

Member Data Documentation

ITypeInfo* HelloWorld::m_pTypeInfo [protected]

Definition at line 27 of file HelloWorld.h.

The documentation for this class was generated from the following files:
  • NetDS/ADSI/samples/Extension/tutorial/step1/HelloWorld.h
  • NetDS/ADSI/samples/Extension/tutorial/step2/HelloWorld.h
  • NetDS/ADSI/samples/Extension/tutorial/step1/HelloWorld.cpp
  • NetDS/ADSI/samples/Extension/tutorial/step2/HelloWorld.cpp
Generated on Wed Nov 13 2024 16:57:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: helper::DatabaseSettings Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • helper
  • helper::DatabaseSettings
Static Public Attributes

helper::DatabaseSettings Interface Reference

List of all members.

Static Public Attributes

static String | DSN = "QCSample"
static String | Pass = ""
static String | User = "sa"

Detailed Description

Definition at line 2 of file DatabaseSettings.java.

Member Data Documentation

String helper::DatabaseSettings::DSN = "QCSample" [static]

Definition at line 5 of file DatabaseSettings.java.

String helper::DatabaseSettings::Pass = "" [static]

Definition at line 7 of file DatabaseSettings.java.

String helper::DatabaseSettings::User = "sa" [static]

Definition at line 6 of file DatabaseSettings.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Queued_Components/QCJAVA/Components/Helper/DatabaseSettings.java
Generated on Wed Nov 13 2024 16:58:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: helper::sampleConstants Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • helper
  • helper::sampleConstants
Static Public Attributes

helper::sampleConstants Interface Reference

List of all members.

Static Public Attributes

static final String | CASCADE_EVENT_CLSID = "{8CE4A9E0-0FC1-11D3-925A-0080C7C30D72}"
static final String | CASCADE_EVENT_DLL = "D:\\mssdk\\Samples\\COM\\Services\\Events\\EventNewsJAVA\\CascadeEvent\\CascadeEvent.dll"
static final String | CASCADE_EVENT_NAME = "CASCADEECLib.CascadeEC"
static final String | CASCADE_NAME = "CascadeSubscription"
static final String | EVENT_CLSID = "{997FF9C0-0F01-11D3-9257-0080C7C30D72}"
static final String | EVENT_NAME = "NEWSEVENTCLASSLib.NewsEvent"
static final boolean | INSTALL_FLAG = true
static final String | NEW_EVENT_DLL = "D:\\mssdk\\Samples\\COM\\Services\\Events\\EventNewsJAVA\\NewsEvent\\NewsEvent.dll"
static final boolean | PARALLEL_FLAG = true
static final String | PERSIS_EVENT_NAME = "PERSISTATLLib.NewsEvent"
static final String | PERSIS_NAME = "PersistentNewsSubscription"
static final String | PERSIST_EVENT_DLL = "D:\\mssdk\\Samples\\COM\\Services\\Events\\EventNewsJAVA\\PersistSubs\\PersistSubs.dll"
static final String | PUBLISHER_NAME = "NewsPublisher"
static final boolean | SUBSCRIBE_FLAG = true
static final String | SUBSCRIBER_NAME = "NewsSubscriber"
static final String | TRANSIENT_NAME = "TransientSubscription"
static final boolean | UNINSTALL_FLAG = false
static final boolean | UNSUBSCRIBE_FLAG = false

Detailed Description

Definition at line 2 of file sampleConstants.java.

Member Data Documentation

final String helper::sampleConstants::CASCADE_EVENT_CLSID = "{8CE4A9E0-0FC1-11D3-925A-0080C7C30D72}" [static]

Definition at line 11 of file sampleConstants.java.

final String helper::sampleConstants::CASCADE_EVENT_DLL = "D:\\mssdk\\Samples\\COM\\Services\\Events\\EventNewsJAVA\\CascadeEvent\\CascadeEvent.dll" [static]

Definition at line 24 of file sampleConstants.java.

final String helper::sampleConstants::CASCADE_EVENT_NAME = "CASCADEECLib.CascadeEC" [static]

Definition at line 14 of file sampleConstants.java.

final String helper::sampleConstants::CASCADE_NAME = "CascadeSubscription" [static]

Definition at line 18 of file sampleConstants.java.

final String helper::sampleConstants::EVENT_CLSID = "{997FF9C0-0F01-11D3-9257-0080C7C30D72}" [static]

Definition at line 10 of file sampleConstants.java.

final String helper::sampleConstants::EVENT_NAME = "NEWSEVENTCLASSLib.NewsEvent" [static]

Definition at line 13 of file sampleConstants.java.

final boolean helper::sampleConstants::INSTALL_FLAG = true [static]

Definition at line 6 of file sampleConstants.java.

final String helper::sampleConstants::NEW_EVENT_DLL = "D:\\mssdk\\Samples\\COM\\Services\\Events\\EventNewsJAVA\\NewsEvent\\NewsEvent.dll" [static]

Definition at line 25 of file sampleConstants.java.

final boolean helper::sampleConstants::PARALLEL_FLAG = true [static]

Definition at line 4 of file sampleConstants.java.

final String helper::sampleConstants::PERSIS_EVENT_NAME = "PERSISTATLLib.NewsEvent" [static]

Definition at line 15 of file sampleConstants.java.

final String helper::sampleConstants::PERSIS_NAME = "PersistentNewsSubscription" [static]

Definition at line 20 of file sampleConstants.java.

final String helper::sampleConstants::PERSIST_EVENT_DLL = "D:\\mssdk\\Samples\\COM\\Services\\Events\\EventNewsJAVA\\PersistSubs\\PersistSubs.dll" [static]

Definition at line 23 of file sampleConstants.java.

final String helper::sampleConstants::PUBLISHER_NAME = "NewsPublisher" [static]

Definition at line 19 of file sampleConstants.java.

final boolean helper::sampleConstants::SUBSCRIBE_FLAG = true [static]

Definition at line 7 of file sampleConstants.java.

final String helper::sampleConstants::SUBSCRIBER_NAME = "NewsSubscriber" [static]

Definition at line 17 of file sampleConstants.java.

final String helper::sampleConstants::TRANSIENT_NAME = "TransientSubscription" [static]

Definition at line 21 of file sampleConstants.java.

final boolean helper::sampleConstants::UNINSTALL_FLAG = false [static]

Definition at line 5 of file sampleConstants.java.

final boolean helper::sampleConstants::UNSUBSCRIBE_FLAG = false [static]

Definition at line 8 of file sampleConstants.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Events/EventNewsJAVA/NewsEvent/Helper/sampleConstants.java
Generated on Wed Nov 13 2024 16:58:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: HtmlPropIFilter Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Protected Attributes | Friends

HtmlPropIFilter Class Reference

#include "HtmlProp.Hxx"

List of all members.

Public Member Functions

ULONG STDMETHODCALLTYPE | AddRef ()
SCODE STDMETHODCALLTYPE | BindRegion (FILTERREGION origPos, REFIID riid, void **ppunk)
SCODE STDMETHODCALLTYPE | GetChunk (STAT_CHUNK *pStat)
SCODE STDMETHODCALLTYPE | GetClassID (CLSID *pClassID)
SCODE STDMETHODCALLTYPE | GetCurFile (LPWSTR *ppszFileName)
SCODE STDMETHODCALLTYPE | GetText (ULONG *pcwcBuffer, WCHAR *awcBuffer)
SCODE STDMETHODCALLTYPE | GetValue (PROPVARIANT **ppPropValue)
SCODE STDMETHODCALLTYPE | Init (ULONG grfFlags, ULONG cAttributes, FULLPROPSPEC const *aAttributes, ULONG *pFlags)
SCODE STDMETHODCALLTYPE | IsDirty ()
SCODE STDMETHODCALLTYPE | Load (LPCWSTR pszFileName, DWORD dwMode)
SCODE STDMETHODCALLTYPE | QueryInterface (REFIID riid, void **ppvObject)
ULONG STDMETHODCALLTYPE | Release ()
SCODE STDMETHODCALLTYPE | Save (LPCWSTR pszFileName, BOOL fRemember)
SCODE STDMETHODCALLTYPE | SaveCompleted (LPCWSTR pszFileName)

Protected Member Functions

HtmlPropIFilter ()
~HtmlPropIFilter ()

Protected Attributes

WCHAR | _awcName [cwcMaxName]
BOOL _fMetaProperty
long | _lRefs
IFilter * | _pHtmlFilter
IPersistFile * | _pPersistFile

Friends

class | HtmlPropIFilterCF

Detailed Description

Definition at line 33 of file HtmlProp.Hxx.

Constructor & Destructor Documentation

HtmlPropIFilter::HtmlPropIFilter ( ) [protected]

Definition at line 124 of file HtmlProp.Cxx.

                                 :
    _pHtmlFilter( 0 ),
    _pPersistFile( 0 ),
    _lRefs( 1 ),
    _fMetaProperty( FALSE )
{
    _awcName[0] = 0;
    InterlockedIncrement( &g_cInstances );
} //HtmlPropIFilter

HtmlPropIFilter::~HtmlPropIFilter ( ) [protected]

Definition at line 142 of file HtmlProp.Cxx.

{
    InterlockedDecrement( &g_cInstances );

    if ( _pHtmlFilter )
        _pHtmlFilter->Release();

    if ( _pPersistFile )
        _pPersistFile->Release();
} //~HtmlPropIFilter

Member Function Documentation

ULONG STDMETHODCALLTYPE HtmlPropIFilter::AddRef ( void )

Definition at line 196 of file HtmlProp.Cxx.

{
    return InterlockedIncrement( &_lRefs );
} //AddRef

SCODE STDMETHODCALLTYPE HtmlPropIFilter::BindRegion | ( | FILTERREGION | origPos,
 |  | REFIID | riid,
 |  | void ** | ppunk
 | ) |  |

Definition at line 627 of file HtmlProp.Cxx.

{
    return _pHtmlFilter->BindRegion( origPos, riid, ppunk );
} //BindRegion

SCODE STDMETHODCALLTYPE HtmlPropIFilter::GetChunk ( STAT_CHUNK * pStat )

Definition at line 250 of file HtmlProp.Cxx.

{
    SCODE sc = _pHtmlFilter->GetChunk( pStat );

    // If we got a chunk, it's a value chunk, and it's a meta property with
    // a string identifier, store away the name so it's available when the
    // value is retrieved.

    if ( ( SUCCEEDED( sc ) ) &&
         ( 0 != ( pStat->flags & CHUNK_VALUE ) ) &&
         ( PRSPEC_LPWSTR == pStat->attribute.psProperty.ulKind ) &&
         ( CLSID_MetaProperty == pStat->attribute.guidPropSet ) &&
         ( 0 != pStat->attribute.psProperty.lpwstr ) &&
         ( wcslen( pStat->attribute.psProperty.lpwstr ) < cwcMaxName ) )
    {
        _fMetaProperty = TRUE;
        wcscpy( _awcName, pStat->attribute.psProperty.lpwstr );
    }
    else
    {
        _fMetaProperty = FALSE;
    }

    return sc;
} //GetChunk

SCODE STDMETHODCALLTYPE HtmlPropIFilter::GetClassID ( CLSID * pClassID )

Definition at line 641 of file HtmlProp.Cxx.

{
    *pClassID = CLSID_HtmlPropIFilter;
    return S_OK;
} //GetClassID

SCODE STDMETHODCALLTYPE HtmlPropIFilter::GetCurFile ( LPWSTR * ppszFileName )

Definition at line 750 of file HtmlProp.Cxx.

{
    return _pPersistFile->GetCurFile( ppszFileName );
} //GetCurFile

SCODE STDMETHODCALLTYPE HtmlPropIFilter::GetText | ( | ULONG * | pcwcBuffer,
 |  | WCHAR * | awcBuffer
 | ) |  |

Definition at line 614 of file HtmlProp.Cxx.

{
    return _pHtmlFilter->GetText( pcwcBuffer, awcBuffer );
} //GetText

SCODE STDMETHODCALLTYPE HtmlPropIFilter::GetValue ( PROPVARIANT ** ppPropValue )

Definition at line 576 of file HtmlProp.Cxx.

{
    SCODE sc = _pHtmlFilter->GetValue( ppPropValue );

    // Is this a value that must be translated?

    if ( SUCCEEDED( sc ) && _fMetaProperty && 0 != *ppPropValue )
    {
        // lookup the datatype of the translation based on property name

        for ( ULONG i = 0; i < g_cEntries; i++ )
        {
            if ( !_wcsicmp( g_aEntries[i].awcName, _awcName ) )
            {
                // found it, so translate it

                sc = Translate( **ppPropValue,
                                g_aEntries[i].dbType );
                break;
            }
        }
    }

    return sc;
} //GetValue

SCODE STDMETHODCALLTYPE HtmlPropIFilter::Init | ( | ULONG | grfFlags,
 |  | ULONG | cAttributes,
 |  | FULLPROPSPEC const * | aAttributes,
 |  | ULONG * | pFlags
 | ) |  |

Definition at line 231 of file HtmlProp.Cxx.

{
    return _pHtmlFilter->Init( grfFlags, cAttributes, aAttributes, pFlags );
} //Init

SCODE STDMETHODCALLTYPE HtmlPropIFilter::IsDirty ( void )

Definition at line 653 of file HtmlProp.Cxx.

{
    return S_FALSE;
} //IsDirty

SCODE STDMETHODCALLTYPE HtmlPropIFilter::Load | ( | LPCWSTR | pszFileName,
 |  | DWORD | dwMode
 | ) |  |

Definition at line 669 of file HtmlProp.Cxx.

{
    //
    // Get html filter class object and class factory
    //

    IClassFactory * pcf = 0;
    SCODE sc = E_FAIL;

    if ( 0 != g_hHtmlDll )
    {
        LPFNGETCLASSOBJECT pfn = (LPFNGETCLASSOBJECT)GetProcAddress(
                                 g_hHtmlDll,
                                 "DllGetClassObject" );

        if ( 0 != pfn )
            sc = (pfn)( CLSID_HtmlIFilter, IID_IClassFactory, (void **)&pcf );
    }

    if ( SUCCEEDED(sc) && ( 0 != pcf ) )
    {
        // Get an html filter

        sc = pcf->CreateInstance( 0, IID_IFilter, (void **)&_pHtmlFilter );
        pcf->Release();

        if ( SUCCEEDED(sc) )
        {
            // Load the file

            sc = _pHtmlFilter->QueryInterface( IID_IPersistFile,
                                               (void **) &_pPersistFile );

            if ( SUCCEEDED(sc) )
            {
                sc = _pPersistFile->Load( pszFileName, dwMode );
            }
            else
            {
                _pHtmlFilter->Release();
                _pHtmlFilter = 0;
            }
        }
    }

    return sc;
} //Load

SCODE STDMETHODCALLTYPE HtmlPropIFilter::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppvObject
 | ) |  |

Definition at line 166 of file HtmlProp.Cxx.

{
    if ( IID_IFilter == riid )
        *ppvObject = (IFilter *)this;
    else if ( IID_IPersist == riid )
        *ppvObject = (IPersist *)(IPersistFile *)this;
    else if ( IID_IPersistFile == riid )
        *ppvObject = (IPersistFile *)this;
    else if ( IID_IUnknown == riid )
        *ppvObject = (IUnknown *)(IPersist *)(IPersistFile *)this;
    else
    {
        *ppvObject = 0;
        return E_NOINTERFACE;
    }

    AddRef();
    return S_OK;
} //QueryInterface

ULONG STDMETHODCALLTYPE HtmlPropIFilter::Release ( void )

Definition at line 209 of file HtmlProp.Cxx.

{
    long lTmp = InterlockedDecrement( &_lRefs );

    if ( 0 == lTmp )
        delete this;
    return lTmp;
} //Release

SCODE STDMETHODCALLTYPE HtmlPropIFilter::Save | ( | LPCWSTR | pszFileName,
 |  | BOOL | fRemember
 | ) |  |

Definition at line 725 of file HtmlProp.Cxx.

{
    return E_FAIL;
} //Save

SCODE STDMETHODCALLTYPE HtmlPropIFilter::SaveCompleted ( LPCWSTR pszFileName )

Definition at line 738 of file HtmlProp.Cxx.

{
    return E_FAIL;
} //SaveCompleted

Friends And Related Function Documentation

friend class HtmlPropIFilterCF [friend]

Definition at line 86 of file HtmlProp.Hxx.

Member Data Documentation

WCHAR HtmlPropIFilter::_awcName[cwcMaxName] [protected]

Definition at line 95 of file HtmlProp.Hxx.

BOOL HtmlPropIFilter::_fMetaProperty [protected]

Definition at line 94 of file HtmlProp.Hxx.

long HtmlPropIFilter::_lRefs [protected]

Definition at line 93 of file HtmlProp.Hxx.

IFilter* HtmlPropIFilter::_pHtmlFilter [protected]

Definition at line 91 of file HtmlProp.Hxx.

IPersistFile* HtmlPropIFilter::_pPersistFile [protected]

Definition at line 92 of file HtmlProp.Hxx.

The documentation for this class was generated from the following files:
  • WinBase/Indexing/HtmlProp/HtmlProp.Hxx
  • WinBase/Indexing/HtmlProp/HtmlProp.Cxx
Generated on Wed Nov 13 2024 16:57:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: HtmlPropIFilterCF Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Protected Attributes | Friends

HtmlPropIFilterCF Class Reference

#include "HtmlProp.Hxx"

List of all members.

Public Member Functions

HtmlPropIFilterCF ()
ULONG STDMETHODCALLTYPE | AddRef ()
SCODE STDMETHODCALLTYPE | CreateInstance (IUnknown *pUnkOuter, REFIID riid, void **ppvObject)
SCODE STDMETHODCALLTYPE | LockServer (BOOL fLock)
SCODE STDMETHODCALLTYPE | QueryInterface (REFIID riid, void **ppvObject)
ULONG STDMETHODCALLTYPE | Release ()

Protected Member Functions

~HtmlPropIFilterCF ()

Protected Attributes

long | _lRefs

Friends

SCODE STDMETHODCALLTYPE | DllGetClassObject (REFCLSID cid, REFIID iid, void **ppvObj)

Detailed Description

Definition at line 98 of file HtmlProp.Hxx.

Constructor & Destructor Documentation

HtmlPropIFilterCF::HtmlPropIFilterCF ( )

Definition at line 898 of file HtmlProp.Cxx.

{
    _lRefs = 1;

    long c = InterlockedIncrement( &g_cInstances );

    if ( 0 == g_hHtmlDll && 1 == c )
    {
        // load the html filter dll

        g_hHtmlDll = LoadLibrary( pwcHTMLFilter );

        // load the property information

        ParsePropertyFile();
    }
} //HtmlPropIFilterCF

HtmlPropIFilterCF::~HtmlPropIFilterCF ( ) [protected]

Definition at line 924 of file HtmlProp.Cxx.

{
    long c = InterlockedDecrement( &g_cInstances );

    if ( 0 != g_hHtmlDll && 0 == c )
    {
        FreeLibrary( g_hHtmlDll );
        g_hHtmlDll = 0;
    }
} //~HtmlPropIFilterCF

Member Function Documentation

ULONG STDMETHODCALLTYPE HtmlPropIFilterCF::AddRef ( void )

Definition at line 974 of file HtmlProp.Cxx.

{
    return InterlockedIncrement( &_lRefs );
} //AddRef

SCODE STDMETHODCALLTYPE HtmlPropIFilterCF::CreateInstance | ( | IUnknown * | pUnkOuter,
 |  | REFIID | riid,
 |  | void ** | ppvObject
 | ) |  |

Definition at line 1009 of file HtmlProp.Cxx.

{
    *ppvObject = 0;

    HtmlPropIFilter * pFilter = new HtmlPropIFilter;

    if ( 0 == pFilter )
        return E_OUTOFMEMORY;

    SCODE sc = pFilter->QueryInterface( riid , ppvObject );

    pFilter->Release();

    return sc;
} //CreateInstance

SCODE STDMETHODCALLTYPE HtmlPropIFilterCF::LockServer ( BOOL fLock )

Definition at line 1040 of file HtmlProp.Cxx.

{
    if(fLock)
        InterlockedIncrement( &g_cInstances );
    else
        InterlockedDecrement( &g_cInstances );

    return S_OK;
} //LockServer

SCODE STDMETHODCALLTYPE HtmlPropIFilterCF::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppvObject
 | ) |  |

Definition at line 948 of file HtmlProp.Cxx.

{
    if ( IID_IClassFactory == riid )
        *ppvObject = (IUnknown *) (IClassFactory *) this;
    else if ( IID_IUnknown == riid )
        *ppvObject = (IUnknown *) (IPersist *) this;
    else
    {
        *ppvObject = 0;
        return E_NOINTERFACE;
    }

    AddRef();
    return S_OK;
} //QueryInterface

ULONG STDMETHODCALLTYPE HtmlPropIFilterCF::Release ( void )

Definition at line 987 of file HtmlProp.Cxx.

{
    long lTmp = InterlockedDecrement( &_lRefs );

    if ( 0 == lTmp )
        delete this;

    return lTmp;
} //Release

Friends And Related Function Documentation

SCODE STDMETHODCALLTYPE DllGetClassObject | ( | REFCLSID | cid,
 |  | REFIID | iid,
 |  | void ** | ppvObj |
 | ) |  |  | [friend]

Definition at line 1064 of file HtmlProp.Cxx.

{
    IUnknown * pUnk = 0;

    if ( CLSID_HtmlPropIFilter == cid ||
         CLSID_HtmlPropClass   == cid )
    {
        pUnk = new HtmlPropIFilterCF;

        if ( 0 == pUnk )
            return E_OUTOFMEMORY;
    }
    else
    {
        *ppvObj = 0;
        return E_NOINTERFACE;
    }

    SCODE sc = pUnk->QueryInterface( iid, ppvObj );

    pUnk->Release();

    return sc;
} //DllGetClassObject

Member Data Documentation

long HtmlPropIFilterCF::_lRefs [protected]

Definition at line 122 of file HtmlProp.Hxx.

The documentation for this class was generated from the following files:
  • WinBase/Indexing/HtmlProp/HtmlProp.Hxx
  • WinBase/Indexing/HtmlProp/HtmlProp.Cxx
Generated on Wed Nov 13 2024 16:57:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: HTTP_REQUEST_PARAM Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

HTTP_REQUEST_PARAM Struct Reference

#include "Range.h"

List of all members.

Public Attributes

DWORD cbStruct
DWORD cRanges
DWORD dwRequestCtx
PFN_REQUESTCB pfnRequestCB
PHTTP_REQUEST_RANGE pRanges
SYSTEMTIME * | pstUnlessModifiedSince
PCSTR | pszUrl
LPVOID | punkOuter

Detailed Description

Definition at line 115 of file Range.h.

Member Data Documentation

DWORD HTTP_REQUEST_PARAM::cbStruct

Definition at line 117 of file Range.h.

DWORD HTTP_REQUEST_PARAM::cRanges

Definition at line 125 of file Range.h.

DWORD HTTP_REQUEST_PARAM::dwRequestCtx

Definition at line 121 of file Range.h.

PFN_REQUESTCB HTTP_REQUEST_PARAM::pfnRequestCB

Definition at line 120 of file Range.h.

PHTTP_REQUEST_RANGE HTTP_REQUEST_PARAM::pRanges

Definition at line 124 of file Range.h.

SYSTEMTIME* HTTP_REQUEST_PARAM::pstUnlessModifiedSince

Definition at line 126 of file Range.h.

PCSTR HTTP_REQUEST_PARAM::pszUrl

Definition at line 119 of file Range.h.

LPVOID HTTP_REQUEST_PARAM::punkOuter

Definition at line 118 of file Range.h.

The documentation for this struct was generated from the following file:
  • Com/Fundamentals/ActiveDocument/Range/Range.h
Generated on Wed Nov 13 2024 16:57:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: HTTP_REQUEST_RANGE Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

HTTP_REQUEST_RANGE Struct Reference

#include "Range.h"

List of all members.

Public Attributes

DWORD dwOffset
DWORD dwSize

Detailed Description

Definition at line 107 of file Range.h.

Member Data Documentation

DWORD HTTP_REQUEST_RANGE::dwOffset

Definition at line 109 of file Range.h.

DWORD HTTP_REQUEST_RANGE::dwSize

Definition at line 110 of file Range.h.

The documentation for this struct was generated from the following file:
  • Com/Fundamentals/ActiveDocument/Range/Range.h
Generated on Wed Nov 13 2024 16:57:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: HTTP_REQUESTCB_PARAM Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

HTTP_REQUESTCB_PARAM Struct Reference

#include "Range.h"

List of all members.

Public Attributes

union {
struct {
DWORD dwContentLength
DWORD dwResponseCode
DWORD fdwRequestFlags
SYSTEMTIME * pstLastModified
}
struct {
DWORD cbDataLength
DWORD dwDataOffset
LPVOID lpDataBuffer
}
struct {
HRESULT hrRequest
}
};
HTTP_REQUESTCB_TYPE CallbackType
DWORD cbStruct
DWORD dwRequestCtx

Detailed Description

Definition at line 63 of file Range.h.

Member Data Documentation

union { ... }
HTTP_REQUESTCB_TYPE HTTP_REQUESTCB_PARAM::CallbackType

Definition at line 67 of file Range.h.

DWORD HTTP_REQUESTCB_PARAM::cbDataLength

Definition at line 83 of file Range.h.

DWORD HTTP_REQUESTCB_PARAM::cbStruct

Definition at line 65 of file Range.h.

DWORD HTTP_REQUESTCB_PARAM::dwContentLength

Definition at line 76 of file Range.h.

DWORD HTTP_REQUESTCB_PARAM::dwDataOffset

Definition at line 81 of file Range.h.

DWORD HTTP_REQUESTCB_PARAM::dwRequestCtx

Definition at line 66 of file Range.h.

DWORD HTTP_REQUESTCB_PARAM::dwResponseCode

Definition at line 74 of file Range.h.

DWORD HTTP_REQUESTCB_PARAM::fdwRequestFlags

Definition at line 73 of file Range.h.

HRESULT HTTP_REQUESTCB_PARAM::hrRequest

Definition at line 88 of file Range.h.

LPVOID HTTP_REQUESTCB_PARAM::lpDataBuffer

Definition at line 82 of file Range.h.

SYSTEMTIME* HTTP_REQUESTCB_PARAM::pstLastModified

Definition at line 75 of file Range.h.

The documentation for this struct was generated from the following file:
  • Com/Fundamentals/ActiveDocument/Range/Range.h
Generated on Wed Nov 13 2024 16:57:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IAccount Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

IAccount Interface Reference

import "Account.idl";

List of all members.

Public Member Functions

HRESULT | Post ([in] long lAccount,[in] long lAmount,[out, retval] BSTR *pbstrResult)
HRESULT | Post ([in] long lngAccntNum,[in] long lngAmount,[out, retval] BSTR *pVal)

Detailed Description

Definition at line 34 of file Account.idl.

Member Function Documentation

HRESULT IAccount::Post | ( | [in] long | lAccount,
 |  | [in] long | lAmount,
 |  | [out, retval] BSTR * | pbstrResult
 | ) |  |
HRESULT IAccount::Post | ( | [in] long | lngAccntNum,
 |  | [in] long | lngAmount,
 |  | [out, retval] BSTR * | pVal
 | ) |  |
The documentation for this interface was generated from the following files:
  • Com/Services/Events/UserEvents/VCAcct/Account.idl
  • Web/iis/Components/Cpp/MTXSample/BankVC.idl
Generated on Wed Nov 13 2024 16:57:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IADsError Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

IADsError Interface Reference

import "ADsError.idl";

List of all members.

Public Member Functions

HRESULT GetErrorMessage ([in] long hResult,[out, retval] BSTR *pbMsg)

Detailed Description

Definition at line 17 of file ADsError.idl.

Member Function Documentation

HRESULT IADsError::GetErrorMessage | ( | [in] long | hResult,
 |  | [out, retval] BSTR * | pbMsg
 | ) |  |
The documentation for this interface was generated from the following file:
  • NetDS/ADSI/samples/General/ADsError/ADsError.idl
Generated on Wed Nov 13 2024 16:57:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IADsErrorVtbl Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

IADsErrorVtbl Struct Reference

#include "ADsError.h"

List of all members.

Public Member Functions

BEGIN_INTERFACE | HRESULT (STDMETHODCALLTYPE __RPC_FAR *QueryInterface)(IADsError __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount)(IADsError __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Invoke)(IADsError __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetErrorMessage)(IADsError __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo)(IADsError __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames)(IADsError __RPC_FAR *This
ULONG (STDMETHODCALLTYPE __RPC_FAR *AddRef)(IADsError __RPC_FAR *This)
ULONG (STDMETHODCALLTYPE __RPC_FAR *Release)(IADsError __RPC_FAR *This)

Public Attributes

REFIID LPOLESTR __RPC_FAR UINT | cNames
DISPID | dispIdMember
long | hResult
UINT iTInfo
UINT LCID | lcid
REFIID LPOLESTR __RPC_FAR UINT LCID | lcid
DISPID REFIID LCID | lcid
long BSTR __RPC_FAR * | pbMsg
UINT __RPC_FAR * | pctinfo
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR * 		pDispParams
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR EXCEPINFO __RPC_FAR * 		pExcepInfo
UINT LCID ITypeInfo __RPC_FAR
*__RPC_FAR * 		ppTInfo
BEGIN_INTERFACE REFIID void
__RPC_FAR *__RPC_FAR * 		ppvObject
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR EXCEPINFO __RPC_FAR
UINT __RPC_FAR * 		puArgErr
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR * 		pVarResult
REFIID LPOLESTR __RPC_FAR UINT
LCID DISPID __RPC_FAR * 		rgDispId
REFIID LPOLESTR __RPC_FAR * | rgszNames
REFIID | riid
DISPID REFIID | riid
BEGIN_INTERFACE REFIID | riid
DISPID REFIID LCID WORD | wFlags

Detailed Description

Definition at line 88 of file ADsError.h.

Member Function Documentation

BEGIN_INTERFACE IADsErrorVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * QueryInterface )
IADsErrorVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetTypeInfoCount )
IADsErrorVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Invoke )
IADsErrorVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetErrorMessage )
IADsErrorVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetTypeInfo )
IADsErrorVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetIDsOfNames )
IADsErrorVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * AddRef )
IADsErrorVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * Release )

Member Data Documentation

REFIID LPOLESTR __RPC_FAR UINT IADsErrorVtbl::cNames

Definition at line 115 of file ADsError.h.

DISPID IADsErrorVtbl::dispIdMember

Definition at line 123 of file ADsError.h.

long IADsErrorVtbl::hResult

Definition at line 134 of file ADsError.h.

UINT IADsErrorVtbl::iTInfo

Definition at line 109 of file ADsError.h.

UINT LCID IADsErrorVtbl::lcid

Definition at line 109 of file ADsError.h.

REFIID LPOLESTR __RPC_FAR UINT LCID IADsErrorVtbl::lcid

Definition at line 115 of file ADsError.h.

DISPID REFIID LCID IADsErrorVtbl::lcid

Definition at line 123 of file ADsError.h.

long BSTR __RPC_FAR* IADsErrorVtbl::pbMsg

Definition at line 134 of file ADsError.h.

UINT __RPC_FAR* IADsErrorVtbl::pctinfo

Definition at line 105 of file ADsError.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR* IADsErrorVtbl::pDispParams

Definition at line 123 of file ADsError.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR EXCEPINFO __RPC_FAR* IADsErrorVtbl::pExcepInfo

Definition at line 123 of file ADsError.h.

UINT LCID ITypeInfo __RPC_FAR* __RPC_FAR* IADsErrorVtbl::ppTInfo

Definition at line 109 of file ADsError.h.

BEGIN_INTERFACE REFIID void __RPC_FAR* __RPC_FAR* IADsErrorVtbl::ppvObject

Definition at line 94 of file ADsError.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR EXCEPINFO __RPC_FAR UINT __RPC_FAR* IADsErrorVtbl::puArgErr

Definition at line 123 of file ADsError.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR* IADsErrorVtbl::pVarResult

Definition at line 123 of file ADsError.h.

REFIID LPOLESTR __RPC_FAR UINT LCID DISPID __RPC_FAR* IADsErrorVtbl::rgDispId

Definition at line 115 of file ADsError.h.

REFIID LPOLESTR __RPC_FAR* IADsErrorVtbl::rgszNames

Definition at line 115 of file ADsError.h.

REFIID IADsErrorVtbl::riid

Definition at line 115 of file ADsError.h.

DISPID REFIID IADsErrorVtbl::riid

Definition at line 123 of file ADsError.h.

BEGIN_INTERFACE REFIID IADsErrorVtbl::riid

Definition at line 94 of file ADsError.h.

DISPID REFIID LCID WORD IADsErrorVtbl::wFlags

Definition at line 123 of file ADsError.h.

The documentation for this struct was generated from the following file:
  • NetDS/ADSI/samples/General/ADsError/ADsError.h
Generated on Wed Nov 13 2024 16:57:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IAnnotator Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

IAnnotator Interface Reference

import "EDAnnotator.idl";

List of all members.

Public Member Functions

HRESULT | AddComment ()
HRESULT | AttachAnnotator (IHTMLDocument2 *pDoc)
HRESULT | DetachAnnotator ()
HRESULT | ShowCommentGlyphs (BOOL bShow)

Detailed Description

Definition at line 24 of file EDAnnotator.idl.

Member Function Documentation

HRESULT IAnnotator::AddComment ( )
HRESULT IAnnotator::AttachAnnotator ( IHTMLDocument2 * pDoc )
HRESULT IAnnotator::DetachAnnotator ( )
HRESULT IAnnotator::ShowCommentGlyphs ( BOOL bShow )
The documentation for this interface was generated from the following file:
  • Web/Browser/EdAnnotator/AnnotatorProject/EDAnnotator.idl
Generated on Wed Nov 13 2024 16:57:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IAppletNotifyVtbl Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

IAppletNotifyVtbl Struct Reference

#include "iapplet.h"

List of all members.

Public Member Functions

BEGIN_INTERFACE | HRESULT (STDMETHODCALLTYPE __RPC_FAR *QueryInterface)(IAppletNotify __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *AutoJoinSessionIndication)(IAppletNotify __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *PermitToJoinSessionIndication)(IAppletNotify __RPC_FAR *This
ULONG (STDMETHODCALLTYPE __RPC_FAR *Release)(IAppletNotify __RPC_FAR *This)
ULONG (STDMETHODCALLTYPE __RPC_FAR *AddRef)(IAppletNotify __RPC_FAR *This)

Public Attributes

IAppletSession __RPC_FAR
HRESULT AppletUserID
AppletNodeID AppletSessionID
AppletEntityID ULONG
AppletChannelID __RPC_FAR 		aDynamicChannels []
IAppletSession __RPC_FAR
HRESULT AppletUserID
AppletNodeID AppletSessionID
AppletEntityID ULONG 		cDynamicChannels
IAppletSession __RPC_FAR
HRESULT AppletUserID
AppletNodeID AppletSessionID
AppletEntityID 		eidMyself
AppletConfID BOOL fPermissionGranted
IAppletSession __RPC_FAR HRESULT | hrResult
AppletConfID nConfID
IAppletSession __RPC_FAR
HRESULT AppletUserID
AppletNodeID 		nidMyself
BEGIN_INTERFACE REFIID void
__RPC_FAR *__RPC_FAR * 		ppvObject
IAppletSession __RPC_FAR * | pSession
BEGIN_INTERFACE REFIID | riid
IAppletSession __RPC_FAR
HRESULT AppletUserID
AppletNodeID AppletSessionID 		sidMyself
IAppletSession __RPC_FAR
HRESULT AppletUserID 		uidMyself

Detailed Description

Definition at line 1221 of file iapplet.h.

Member Function Documentation

BEGIN_INTERFACE IAppletNotifyVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * QueryInterface )
IAppletNotifyVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * AutoJoinSessionIndication )
IAppletNotifyVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * PermitToJoinSessionIndication )
IAppletNotifyVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * Release )
IAppletNotifyVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * AddRef )

Member Data Documentation

IAppletSession __RPC_FAR HRESULT AppletUserID AppletNodeID AppletSessionID AppletEntityID ULONG AppletChannelID __RPC_FAR IAppletNotifyVtbl::aDynamicChannels[]

Definition at line 1243 of file iapplet.h.

IAppletSession __RPC_FAR HRESULT AppletUserID AppletNodeID AppletSessionID AppletEntityID ULONG IAppletNotifyVtbl::cDynamicChannels

Definition at line 1243 of file iapplet.h.

IAppletSession __RPC_FAR HRESULT AppletUserID AppletNodeID AppletSessionID AppletEntityID IAppletNotifyVtbl::eidMyself

Definition at line 1243 of file iapplet.h.

AppletConfID BOOL IAppletNotifyVtbl::fPermissionGranted

Definition at line 1238 of file iapplet.h.

IAppletSession __RPC_FAR HRESULT IAppletNotifyVtbl::hrResult

Definition at line 1243 of file iapplet.h.

AppletConfID IAppletNotifyVtbl::nConfID

Definition at line 1238 of file iapplet.h.

IAppletSession __RPC_FAR HRESULT AppletUserID AppletNodeID IAppletNotifyVtbl::nidMyself

Definition at line 1243 of file iapplet.h.

BEGIN_INTERFACE REFIID void __RPC_FAR* __RPC_FAR* IAppletNotifyVtbl::ppvObject

Definition at line 1227 of file iapplet.h.

IAppletSession __RPC_FAR* IAppletNotifyVtbl::pSession

Definition at line 1243 of file iapplet.h.

BEGIN_INTERFACE REFIID IAppletNotifyVtbl::riid

Definition at line 1227 of file iapplet.h.

IAppletSession __RPC_FAR HRESULT AppletUserID AppletNodeID AppletSessionID IAppletNotifyVtbl::sidMyself

Definition at line 1243 of file iapplet.h.

IAppletSession __RPC_FAR HRESULT AppletUserID IAppletNotifyVtbl::uidMyself

Definition at line 1243 of file iapplet.h.

The documentation for this struct was generated from the following file:
  • Web/NetMeeting/NMChat2/iapplet.h
Generated on Wed Nov 13 2024 16:57:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IAppletSessionNotifyVtbl Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

IAppletSessionNotifyVtbl Struct Reference

#include "iapplet.h"

List of all members.

Public Member Functions

BEGIN_INTERFACE | HRESULT (STDMETHODCALLTYPE __RPC_FAR *QueryInterface)(IAppletSessionNotify __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *JoinSessionConfirm)(IAppletSessionNotify __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *TestTokenConfirm)(IAppletSessionNotify __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *TokenConfirm)(IAppletSessionNotify __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *ChannelIndication)(IAppletSessionNotify __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *InquireRosterConfirm)(IAppletSessionNotify __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *AllocateHandleConfirm)(IAppletSessionNotify __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *RegistryConfirm)(IAppletSessionNotify __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *TokenIndication)(IAppletSessionNotify __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *InvokeAppletConfirm)(IAppletSessionNotify __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *RosterReportIndication)(IAppletSessionNotify __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *ChannelConfirm)(IAppletSessionNotify __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *LeaveSessionIndication)(IAppletSessionNotify __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *SendDataIndication)(IAppletSessionNotify __RPC_FAR *This
ULONG (STDMETHODCALLTYPE __RPC_FAR *Release)(IAppletSessionNotify __RPC_FAR *This)
ULONG (STDMETHODCALLTYPE __RPC_FAR *AddRef)(IAppletSessionNotify __RPC_FAR *This)

Public Attributes

HRESULT AppletUserID
AppletNodeID AppletSessionID
AppletEntityID ULONG
AppletChannelID __RPC_FAR 		aDynamicChannels []
ULONG AppletRoster __RPC_FAR
*__RPC_FAR * 		apAppRosters
HRESULT ULONG AppletRoster
__RPC_FAR *__RPC_FAR * 		apAppRosters
HRESULT AppletUserID
AppletNodeID AppletSessionID
AppletEntityID ULONG 		cDynamicChannels
HRESULT ULONG ULONG | cHandles
ULONG cRosters
HRESULT ULONG | cRosters
BOOL AppletUserID
AppletChannelID AppletPriority
AppletOctetString 		Data
AppletTokenCommand eCommand
AppletRegistryCommand eCommand
AppletChannelCommand eCommand
BOOL AppletUserID
AppletChannelID AppletPriority 		eDataPriority
HRESULT AppletUserID
AppletNodeID AppletSessionID
AppletEntityID 		eidMyself
AppletChannelCommand
AppletChannelID AppletReason 		eReason
AppletReason eReason
AppletTokenCommand AppletReason eReason
AppletRegistryCommand HRESULT
AppletRegistryKey __RPC_FAR
AppletRegistryItem __RPC_FAR
AppletRegistryEntryOwner
__RPC_FAR
AppletModificationRights 		eRights
AppletTokenID AppletTokenStatus eStatus
BOOL fUniformSend
AppletChannelCommand HRESULT | hrResult
AppletTokenCommand HRESULT | hrResult
AppletRequestTag HRESULT | hrResult
HRESULT | hrResult
AppletRegistryCommand HRESULT | hrResult
AppletChannelCommand HRESULT
AppletChannelID 		nChannelID
AppletChannelCommand
AppletChannelID 		nChannelID
BOOL AppletUserID AppletChannelID nChannelID
HRESULT ULONG | nFirstHandle
HRESULT AppletUserID AppletNodeID | nidMyself
AppletRequestTag nReqTag
AppletTokenCommand HRESULT
AppletTokenID 		nTokenID
AppletTokenID nTokenID
AppletTokenCommand
AppletReason AppletTokenID 		nTokenID
AppletRegistryCommand HRESULT
AppletRegistryKey __RPC_FAR
AppletRegistryItem __RPC_FAR
AppletRegistryEntryOwner
__RPC_FAR * 		pEntryOwner
BEGIN_INTERFACE REFIID void
__RPC_FAR *__RPC_FAR * 		ppvObject
AppletRegistryCommand HRESULT
AppletRegistryKey __RPC_FAR
AppletRegistryItem __RPC_FAR * 		pRegistryItem
AppletRegistryCommand HRESULT
AppletRegistryKey __RPC_FAR * 		pRegistryKey
BEGIN_INTERFACE REFIID | riid
HRESULT AppletUserID
AppletNodeID AppletSessionID 		sidMyself
AppletTokenCommand
AppletReason AppletTokenID
AppletUserID 		uidInitiator
BOOL AppletUserID uidInitiator
AppletReason AppletUserID uidLeave
AppletChannelCommand
AppletChannelID AppletReason
AppletUserID 		uidManager
HRESULT AppletUserID | uidMyself

Detailed Description

Definition at line 473 of file iapplet.h.

Member Function Documentation

BEGIN_INTERFACE IAppletSessionNotifyVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * QueryInterface )
IAppletSessionNotifyVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * JoinSessionConfirm )
IAppletSessionNotifyVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * TestTokenConfirm )
IAppletSessionNotifyVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * TokenConfirm )
IAppletSessionNotifyVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * ChannelIndication )
IAppletSessionNotifyVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * InquireRosterConfirm )
IAppletSessionNotifyVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * AllocateHandleConfirm )
IAppletSessionNotifyVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * RegistryConfirm )
IAppletSessionNotifyVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * TokenIndication )
IAppletSessionNotifyVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * InvokeAppletConfirm )
IAppletSessionNotifyVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * RosterReportIndication )
IAppletSessionNotifyVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * ChannelConfirm )
IAppletSessionNotifyVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * LeaveSessionIndication )
IAppletSessionNotifyVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * SendDataIndication )
IAppletSessionNotifyVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * Release )
IAppletSessionNotifyVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * AddRef )

Member Data Documentation

HRESULT AppletUserID AppletNodeID AppletSessionID AppletEntityID ULONG AppletChannelID __RPC_FAR IAppletSessionNotifyVtbl::aDynamicChannels[]

Definition at line 490 of file iapplet.h.

ULONG AppletRoster __RPC_FAR* __RPC_FAR* IAppletSessionNotifyVtbl::apAppRosters

Definition at line 513 of file iapplet.h.

HRESULT ULONG AppletRoster __RPC_FAR* __RPC_FAR* IAppletSessionNotifyVtbl::apAppRosters

Definition at line 518 of file iapplet.h.

HRESULT AppletUserID AppletNodeID AppletSessionID AppletEntityID ULONG IAppletSessionNotifyVtbl::cDynamicChannels

Definition at line 490 of file iapplet.h.

HRESULT ULONG ULONG IAppletSessionNotifyVtbl::cHandles

Definition at line 538 of file iapplet.h.

ULONG IAppletSessionNotifyVtbl::cRosters

Definition at line 513 of file iapplet.h.

HRESULT ULONG IAppletSessionNotifyVtbl::cRosters

Definition at line 518 of file iapplet.h.

BOOL AppletUserID AppletChannelID AppletPriority AppletOctetString IAppletSessionNotifyVtbl::Data

Definition at line 505 of file iapplet.h.

AppletTokenCommand IAppletSessionNotifyVtbl::eCommand

Definition at line 557 of file iapplet.h.

AppletTokenCommand IAppletSessionNotifyVtbl::eCommand

Definition at line 529 of file iapplet.h.

AppletChannelCommand IAppletSessionNotifyVtbl::eCommand

Definition at line 544 of file iapplet.h.

BOOL AppletUserID AppletChannelID AppletPriority IAppletSessionNotifyVtbl::eDataPriority

Definition at line 505 of file iapplet.h.

HRESULT AppletUserID AppletNodeID AppletSessionID AppletEntityID IAppletSessionNotifyVtbl::eidMyself

Definition at line 490 of file iapplet.h.

AppletChannelCommand AppletChannelID AppletReason IAppletSessionNotifyVtbl::eReason

Definition at line 550 of file iapplet.h.

AppletReason IAppletSessionNotifyVtbl::eReason

Definition at line 500 of file iapplet.h.

AppletTokenCommand AppletReason IAppletSessionNotifyVtbl::eReason

Definition at line 568 of file iapplet.h.

AppletRegistryCommand HRESULT AppletRegistryKey __RPC_FAR AppletRegistryItem __RPC_FAR AppletRegistryEntryOwner __RPC_FAR AppletModificationRights IAppletSessionNotifyVtbl::eRights

Definition at line 529 of file iapplet.h.

AppletTokenID AppletTokenStatus IAppletSessionNotifyVtbl::eStatus

Definition at line 563 of file iapplet.h.

BOOL IAppletSessionNotifyVtbl::fUniformSend

Definition at line 505 of file iapplet.h.

AppletChannelCommand HRESULT IAppletSessionNotifyVtbl::hrResult

Definition at line 544 of file iapplet.h.

AppletTokenCommand HRESULT IAppletSessionNotifyVtbl::hrResult

Definition at line 557 of file iapplet.h.

AppletRequestTag HRESULT IAppletSessionNotifyVtbl::hrResult

Definition at line 524 of file iapplet.h.

HRESULT IAppletSessionNotifyVtbl::hrResult

Definition at line 490 of file iapplet.h.

AppletRegistryCommand HRESULT IAppletSessionNotifyVtbl::hrResult

Definition at line 529 of file iapplet.h.

AppletChannelCommand HRESULT AppletChannelID IAppletSessionNotifyVtbl::nChannelID

Definition at line 544 of file iapplet.h.

AppletChannelCommand AppletChannelID IAppletSessionNotifyVtbl::nChannelID

Definition at line 550 of file iapplet.h.

BOOL AppletUserID AppletChannelID IAppletSessionNotifyVtbl::nChannelID

Definition at line 505 of file iapplet.h.

HRESULT ULONG IAppletSessionNotifyVtbl::nFirstHandle

Definition at line 538 of file iapplet.h.

HRESULT AppletUserID AppletNodeID IAppletSessionNotifyVtbl::nidMyself

Definition at line 490 of file iapplet.h.

AppletRequestTag IAppletSessionNotifyVtbl::nReqTag

Definition at line 524 of file iapplet.h.

AppletTokenCommand HRESULT AppletTokenID IAppletSessionNotifyVtbl::nTokenID

Definition at line 557 of file iapplet.h.

AppletTokenID IAppletSessionNotifyVtbl::nTokenID

Definition at line 563 of file iapplet.h.

AppletTokenCommand AppletReason AppletTokenID IAppletSessionNotifyVtbl::nTokenID

Definition at line 568 of file iapplet.h.

AppletRegistryCommand HRESULT AppletRegistryKey __RPC_FAR AppletRegistryItem __RPC_FAR AppletRegistryEntryOwner __RPC_FAR* IAppletSessionNotifyVtbl::pEntryOwner

Definition at line 529 of file iapplet.h.

BEGIN_INTERFACE REFIID void __RPC_FAR* __RPC_FAR* IAppletSessionNotifyVtbl::ppvObject

Definition at line 479 of file iapplet.h.

AppletRegistryCommand HRESULT AppletRegistryKey __RPC_FAR AppletRegistryItem __RPC_FAR* IAppletSessionNotifyVtbl::pRegistryItem

Definition at line 529 of file iapplet.h.

AppletRegistryCommand HRESULT AppletRegistryKey __RPC_FAR* IAppletSessionNotifyVtbl::pRegistryKey

Definition at line 529 of file iapplet.h.

BEGIN_INTERFACE REFIID IAppletSessionNotifyVtbl::riid

Definition at line 479 of file iapplet.h.

HRESULT AppletUserID AppletNodeID AppletSessionID IAppletSessionNotifyVtbl::sidMyself

Definition at line 490 of file iapplet.h.

AppletTokenCommand AppletReason AppletTokenID AppletUserID IAppletSessionNotifyVtbl::uidInitiator

Definition at line 568 of file iapplet.h.

BOOL AppletUserID IAppletSessionNotifyVtbl::uidInitiator

Definition at line 505 of file iapplet.h.

AppletReason AppletUserID IAppletSessionNotifyVtbl::uidLeave

Definition at line 500 of file iapplet.h.

AppletChannelCommand AppletChannelID AppletReason AppletUserID IAppletSessionNotifyVtbl::uidManager

Definition at line 550 of file iapplet.h.

HRESULT AppletUserID IAppletSessionNotifyVtbl::uidMyself

Definition at line 490 of file iapplet.h.

The documentation for this struct was generated from the following file:
  • Web/NetMeeting/NMChat2/iapplet.h
Generated on Wed Nov 13 2024 16:57:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IAppletSessionVtbl Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

IAppletSessionVtbl Struct Reference

#include "iapplet.h"

List of all members.

Public Member Functions

BEGIN_INTERFACE | HRESULT (STDMETHODCALLTYPE __RPC_FAR *QueryInterface)(IAppletSession __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *UnAdvise)(IAppletSession __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Advise)(IAppletSession __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *TokenRequest)(IAppletSession __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetConfID)(IAppletSession __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *RegistryRequest)(IAppletSession __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *InquireRoster)(IAppletSession __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *SendData)(IAppletSession __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *InvokeApplet)(IAppletSession __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Leave)(IAppletSession __RPC_FAR *This)
HRESULT (STDMETHODCALLTYPE __RPC_FAR *ChannelRequest)(IAppletSession __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *IsThisNodeTopProvider)(IAppletSession __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Join)(IAppletSession __RPC_FAR *This
ULONG (STDMETHODCALLTYPE __RPC_FAR *Release)(IAppletSession __RPC_FAR *This)
ULONG (STDMETHODCALLTYPE __RPC_FAR *AddRef)(IAppletSession __RPC_FAR *This)

Public Attributes

AppletRequestTag __RPC_FAR
AppletProtocolEntity __RPC_FAR
ULONG AppletNodeID __RPC_FAR 		aNodeIDs []
BOOL AppletChannelID
AppletPriority ULONG 		cbBufSize
AppletRequestTag __RPC_FAR
AppletProtocolEntity __RPC_FAR
ULONG 		cNodes
DWORD dwCookie
BOOL AppletChannelID AppletPriority ePriority
BOOL fUniformSend
BOOL AppletChannelID nChannelID
AppletRequestTag __RPC_FAR
AppletProtocolEntity __RPC_FAR * 		pAPE
BOOL AppletChannelID
AppletPriority ULONG BYTE
__RPC_FAR * 		pBuffer
IAppletSessionNotify __RPC_FAR
DWORD __RPC_FAR * 		pdwCookie
BOOL __RPC_FAR * | pfTopProvider
AppletConfID __RPC_FAR * | pnConfID
IAppletSessionNotify __RPC_FAR * | pNotify
AppletRequestTag __RPC_FAR * | pnReqTag
BEGIN_INTERFACE REFIID void
__RPC_FAR *__RPC_FAR * 		ppvObject
AppletTokenRequest __RPC_FAR * | pRequest
AppletRegistryRequest __RPC_FAR * | pRequest
AppletChannelRequest __RPC_FAR * | pRequest
AppletSessionRequest __RPC_FAR * | pRequest
AppletSessionKey __RPC_FAR * | pSessionKey
BEGIN_INTERFACE REFIID | riid

Detailed Description

Definition at line 897 of file iapplet.h.

Member Function Documentation

BEGIN_INTERFACE IAppletSessionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * QueryInterface )
IAppletSessionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * UnAdvise )
IAppletSessionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Advise )
IAppletSessionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * TokenRequest )
IAppletSessionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetConfID )
IAppletSessionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * RegistryRequest )
IAppletSessionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * InquireRoster )
IAppletSessionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * SendData )
IAppletSessionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * InvokeApplet )
IAppletSessionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Leave )
IAppletSessionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * ChannelRequest )
IAppletSessionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * IsThisNodeTopProvider )
IAppletSessionVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Join )
IAppletSessionVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * Release )
IAppletSessionVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * AddRef )

Member Data Documentation

AppletRequestTag __RPC_FAR AppletProtocolEntity __RPC_FAR ULONG AppletNodeID __RPC_FAR IAppletSessionVtbl::aNodeIDs[]

Definition at line 937 of file iapplet.h.

BOOL AppletChannelID AppletPriority ULONG IAppletSessionVtbl::cbBufSize

Definition at line 929 of file iapplet.h.

AppletRequestTag __RPC_FAR AppletProtocolEntity __RPC_FAR ULONG IAppletSessionVtbl::cNodes

Definition at line 937 of file iapplet.h.

DWORD IAppletSessionVtbl::dwCookie

Definition at line 965 of file iapplet.h.

BOOL AppletChannelID AppletPriority IAppletSessionVtbl::ePriority

Definition at line 929 of file iapplet.h.

BOOL IAppletSessionVtbl::fUniformSend

Definition at line 929 of file iapplet.h.

BOOL AppletChannelID IAppletSessionVtbl::nChannelID

Definition at line 929 of file iapplet.h.

AppletRequestTag __RPC_FAR AppletProtocolEntity __RPC_FAR* IAppletSessionVtbl::pAPE

Definition at line 937 of file iapplet.h.

BOOL AppletChannelID AppletPriority ULONG BYTE __RPC_FAR* IAppletSessionVtbl::pBuffer

Definition at line 929 of file iapplet.h.

IAppletSessionNotify __RPC_FAR DWORD __RPC_FAR* IAppletSessionVtbl::pdwCookie

Definition at line 960 of file iapplet.h.

BOOL __RPC_FAR* IAppletSessionVtbl::pfTopProvider

Definition at line 918 of file iapplet.h.

AppletConfID __RPC_FAR* IAppletSessionVtbl::pnConfID

Definition at line 914 of file iapplet.h.

IAppletSessionNotify __RPC_FAR* IAppletSessionVtbl::pNotify

Definition at line 960 of file iapplet.h.

AppletRequestTag __RPC_FAR* IAppletSessionVtbl::pnReqTag

Definition at line 937 of file iapplet.h.

BEGIN_INTERFACE REFIID void __RPC_FAR* __RPC_FAR* IAppletSessionVtbl::ppvObject

Definition at line 903 of file iapplet.h.

AppletTokenRequest __RPC_FAR* IAppletSessionVtbl::pRequest

Definition at line 956 of file iapplet.h.

AppletRegistryRequest __RPC_FAR* IAppletSessionVtbl::pRequest

Definition at line 948 of file iapplet.h.

AppletChannelRequest __RPC_FAR* IAppletSessionVtbl::pRequest

Definition at line 952 of file iapplet.h.

AppletSessionRequest __RPC_FAR* IAppletSessionVtbl::pRequest

Definition at line 922 of file iapplet.h.

AppletSessionKey __RPC_FAR* IAppletSessionVtbl::pSessionKey

Definition at line 944 of file iapplet.h.

BEGIN_INTERFACE REFIID IAppletSessionVtbl::riid

Definition at line 903 of file iapplet.h.

The documentation for this struct was generated from the following file:
  • Web/NetMeeting/NMChat2/iapplet.h
Generated on Wed Nov 13 2024 16:57:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IAppletVtbl Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

IAppletVtbl Struct Reference

#include "iapplet.h"

List of all members.

Public Member Functions

BEGIN_INTERFACE | HRESULT (STDMETHODCALLTYPE __RPC_FAR *QueryInterface)(IApplet __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *UnAdvise)(IApplet __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Initialize)(IApplet __RPC_FAR *This)
HRESULT (STDMETHODCALLTYPE __RPC_FAR *CreateSession)(IApplet __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Advise)(IApplet __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *RegisterAutoJoin)(IApplet __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *UnregisterAutoJoin)(IApplet __RPC_FAR *This)
ULONG (STDMETHODCALLTYPE __RPC_FAR *AddRef)(IApplet __RPC_FAR *This)
ULONG (STDMETHODCALLTYPE __RPC_FAR *Release)(IApplet __RPC_FAR *This)

Public Attributes

DWORD dwCookie
IAppletSession __RPC_FAR
*__RPC_FAR AppletConfID 		nConfID
IAppletNotify __RPC_FAR DWORD
__RPC_FAR * 		pdwCookie
IAppletNotify __RPC_FAR * | pNotify
IAppletSession __RPC_FAR
*__RPC_FAR * 		ppSession
BEGIN_INTERFACE REFIID void
__RPC_FAR *__RPC_FAR * 		ppvObject
AppletSessionRequest __RPC_FAR * | pRequest
BEGIN_INTERFACE REFIID | riid

Detailed Description

Definition at line 1361 of file iapplet.h.

Member Function Documentation

BEGIN_INTERFACE IAppletVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * QueryInterface )
IAppletVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * UnAdvise )
IAppletVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Initialize )
IAppletVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * CreateSession )
IAppletVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Advise )
IAppletVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * RegisterAutoJoin )
IAppletVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * UnregisterAutoJoin )
IAppletVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * AddRef )
IAppletVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * Release )

Member Data Documentation

DWORD IAppletVtbl::dwCookie

Definition at line 1398 of file iapplet.h.

IAppletSession __RPC_FAR* __RPC_FAR AppletConfID IAppletVtbl::nConfID

Definition at line 1388 of file iapplet.h.

IAppletNotify __RPC_FAR DWORD __RPC_FAR* IAppletVtbl::pdwCookie

Definition at line 1393 of file iapplet.h.

IAppletNotify __RPC_FAR* IAppletVtbl::pNotify

Definition at line 1393 of file iapplet.h.

IAppletSession __RPC_FAR* __RPC_FAR* IAppletVtbl::ppSession

Definition at line 1388 of file iapplet.h.

BEGIN_INTERFACE REFIID void __RPC_FAR* __RPC_FAR* IAppletVtbl::ppvObject

Definition at line 1367 of file iapplet.h.

AppletSessionRequest __RPC_FAR* IAppletVtbl::pRequest

Definition at line 1381 of file iapplet.h.

BEGIN_INTERFACE REFIID IAppletVtbl::riid

Definition at line 1367 of file iapplet.h.

The documentation for this struct was generated from the following file:
  • Web/NetMeeting/NMChat2/iapplet.h
Generated on Wed Nov 13 2024 16:57:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IAuthenticateAdmin Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

IAuthenticateAdmin Interface Reference

import "Authenticate.idl";

Detailed Description

Definition at line 62 of file Authenticate.idl.

The documentation for this interface was generated from the following file:
  • Multimedia/WindowsMediaServices9/Authentication/Authenticate.idl
Generated on Wed Nov 13 2024 16:57:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IAuthenticateContext Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

IAuthenticateContext Interface Reference

import "Authenticate.idl";

Inherits com::ms::com::IUnknown.

Detailed Description

Definition at line 51 of file Authenticate.idl.

The documentation for this interface was generated from the following file:
  • Multimedia/WindowsMediaServices9/Authentication/Authenticate.idl
Generated on Wed Nov 13 2024 16:57:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IAuthenticatePlugin Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

IAuthenticatePlugin Interface Reference

import "Authenticate.idl";

Inherits com::ms::com::IUnknown.

Inherited by CAuthenticatePlugin.

Detailed Description

Definition at line 41 of file Authenticate.idl.

The documentation for this interface was generated from the following file:
  • Multimedia/WindowsMediaServices9/Authentication/Authenticate.idl
Generated on Wed Nov 13 2024 16:57:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IBehavior Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

IBehavior Interface Reference

import "Render.idl";

Detailed Description

Definition at line 31 of file Render.idl.

The documentation for this interface was generated from the following file:
  • Web/Browser/RenderBehave/renderproject/Render.idl
Generated on Wed Nov 13 2024 16:57:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IBrowserHost Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

IBrowserHost Interface Reference

import "EdCommands.idl";

List of all members.

Public Member Functions

HRESULT | GetHwnd (long *phwnd)
HRESULT | GetHwnd (long *phwnd)
HRESULT | GetHwnd (long *phwnd)
HRESULT | Run ()
HRESULT | Run ()
HRESULT | Run ()
HRESULT | Run ()
HRESULT | Stop ()
HRESULT | Stop ()
HRESULT | Stop ()
HRESULT | Stop ()

Detailed Description

Definition at line 19 of file EdCommands.idl.

Member Function Documentation

HRESULT IBrowserHost::GetHwnd ( long * phwnd )
HRESULT IBrowserHost::GetHwnd ( long * phwnd )
HRESULT IBrowserHost::GetHwnd ( long * phwnd )
HRESULT IBrowserHost::Run ( )
HRESULT IBrowserHost::Run ( )
HRESULT IBrowserHost::Run ( )
HRESULT IBrowserHost::Run ( )
HRESULT IBrowserHost::Stop ( )
HRESULT IBrowserHost::Stop ( )
HRESULT IBrowserHost::Stop ( )
HRESULT IBrowserHost::Stop ( )
The documentation for this interface was generated from the following files:
  • Web/Browser/EditCommands/EdCommands.idl
  • Web/Browser/EditFeatures/EdCommands.idl
  • Web/Browser/EditGlyphs/EdGlyphs.idl
  • Web/Browser/EditHost/EdHost.idl
Generated on Wed Nov 13 2024 16:57:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: icmp_hdr Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

icmp_hdr Struct Reference

#include "iphdr.h"

List of all members.

Public Attributes

unsigned short | icmp_checksum
unsigned char | icmp_code
unsigned short | icmp_id
unsigned short | icmp_sequence
unsigned char | icmp_type

Detailed Description

Definition at line 52 of file iphdr.h.

Member Data Documentation

unsigned short icmp_hdr::icmp_checksum

Definition at line 56 of file iphdr.h.

unsigned char icmp_hdr::icmp_code

Definition at line 55 of file iphdr.h.

unsigned short icmp_hdr::icmp_id

Definition at line 57 of file iphdr.h.

unsigned short icmp_hdr::icmp_sequence

Definition at line 58 of file iphdr.h.

unsigned char icmp_hdr::icmp_type

Definition at line 54 of file iphdr.h.

The documentation for this struct was generated from the following file:
  • NetDS/WinSock/Ping/iphdr.h
Generated on Wed Nov 13 2024 16:57:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: icmpv6_echo_request Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

icmpv6_echo_request Struct Reference

#include "iphdr.h"

List of all members.

Public Attributes

unsigned short | icmp6_echo_id
unsigned short | icmp6_echo_sequence

Detailed Description

Definition at line 91 of file iphdr.h.

Member Data Documentation

unsigned short icmpv6_echo_request::icmp6_echo_id

Definition at line 93 of file iphdr.h.

unsigned short icmpv6_echo_request::icmp6_echo_sequence

Definition at line 94 of file iphdr.h.

The documentation for this struct was generated from the following file:
  • NetDS/WinSock/Ping/iphdr.h
Generated on Wed Nov 13 2024 16:57:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: icmpv6_hdr Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

icmpv6_hdr Struct Reference

#include "iphdr.h"

List of all members.

Public Attributes

unsigned short | icmp6_checksum
unsigned char | icmp6_code
unsigned char | icmp6_type

Detailed Description

Definition at line 84 of file iphdr.h.

Member Data Documentation

unsigned short icmpv6_hdr::icmp6_checksum

Definition at line 87 of file iphdr.h.

unsigned char icmpv6_hdr::icmp6_code

Definition at line 86 of file iphdr.h.

unsigned char icmpv6_hdr::icmp6_type

Definition at line 85 of file iphdr.h.

The documentation for this struct was generated from the following file:
  • NetDS/WinSock/Ping/iphdr.h
Generated on Wed Nov 13 2024 16:57:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IComSpy Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

IComSpy Interface Reference

import "comspyctl.idl";

List of all members.

Public Member Functions

HRESULT | About ()
HRESULT | Audit ([out, retval] BOOL *pVal)
HRESULT | Audit ([in] BOOL newVal)
HRESULT | ChooseFont ()
HRESULT | ChooseLogFile ([out] BSTR *sLogFileName,[out] BOOL *bCanceled)
HRESULT | ClearAllEvents ()
HRESULT | ColWidth (short nColumn,[in] long newVal)
HRESULT | ColWidth (short nColumn,[out, retval] long *pVal)
HRESULT | Font ([out, retval]IFontDisp **ppFont)
HRESULT | Font ([in]IFontDisp *pFont)
HRESULT | Font ([in]IFontDisp *pFont)
HRESULT | LogFile ([out, retval] BSTR *pVal)
HRESULT | LogFile ([in] BSTR newVal)
HRESULT | LogToFile ([in] BOOL newVal)
HRESULT | LogToFile ([out, retval] BOOL *pVal)
HRESULT | SaveToFile ()
HRESULT | SelectApplications ()
HRESULT | ShowGridLines ([in] BOOL newVal)
HRESULT | ShowGridLines ([out, retval] BOOL *pVal)
HRESULT | ShowOnScreen ([in] BOOL newVal)
HRESULT | ShowOnScreen ([out, retval] BOOL *pVal)
HRESULT | Window ([out, retval]LONG_PTR *phwnd)

Detailed Description

Definition at line 62 of file comspyctl.idl.

Member Function Documentation

HRESULT IComSpy::About ( )
HRESULT IComSpy::Audit ( [out, retval] BOOL * pVal ) [get]
HRESULT IComSpy::Audit ( [in] BOOL newVal ) [set]
HRESULT IComSpy::ChooseFont ( )
HRESULT IComSpy::ChooseLogFile | ( | [out] BSTR * | sLogFileName,
 |  | [out] BOOL * | bCanceled
 | ) |  |
HRESULT IComSpy::ClearAllEvents ( )
HRESULT IComSpy::ColWidth | ( | short | nColumn,
 |  | [in] long | newVal |
 | ) |  |  | [set]
HRESULT IComSpy::ColWidth | ( | short | nColumn,
 |  | [out, retval] long * | pVal |
 | ) |  |  | [get]
HRESULT IComSpy::Font ( [out, retval] IFontDisp ** ppFont ) [get]
HRESULT IComSpy::Font ( [in] IFontDisp * pFont ) [set]
HRESULT IComSpy::Font ( [in] IFontDisp * pFont ) [set]
HRESULT IComSpy::LogFile ( [out, retval] BSTR * pVal ) [get]
HRESULT IComSpy::LogFile ( [in] BSTR newVal ) [set]
HRESULT IComSpy::LogToFile ( [in] BOOL newVal ) [set]
HRESULT IComSpy::LogToFile ( [out, retval] BOOL * pVal ) [get]
HRESULT IComSpy::SaveToFile ( )
HRESULT IComSpy::SelectApplications ( )
HRESULT IComSpy::ShowGridLines ( [in] BOOL newVal ) [set]
HRESULT IComSpy::ShowGridLines ( [out, retval] BOOL * pVal ) [get]
HRESULT IComSpy::ShowOnScreen ( [in] BOOL newVal ) [set]
HRESULT IComSpy::ShowOnScreen ( [out, retval] BOOL * pVal ) [get]
HRESULT IComSpy::Window ( [out, retval] LONG_PTR * phwnd ) [get]
The documentation for this interface was generated from the following file:
  • Com/Administration/Spy/idl/comspyctl.idl
Generated on Wed Nov 13 2024 16:57:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IComSpyAudit Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

IComSpyAudit Interface Reference

import "comspyaudit.idl";

Inherits com::ms::com::IUnknown.

Inherited by CComSpySqlAudit.

List of all members.

Public Member Functions

HRESULT | EngineDefined ([in] LONGLONG perfCount,[in] LPCOLESTR pszPropName,[in] VARIANT *varPropValue,[in] LPCOLESTR pszClsidEng)
HRESULT | Init (LPCOLESTR sDSN, LPCOLESTR sUser, LPCOLESTR sPw)
HRESULT | OnActivityCreate ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidActivityID)
HRESULT | OnActivityDestroy ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidActivityID)
HRESULT | OnActivityEnter ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidCurrentApp,[in] LPCOLESTR pszGuidEnteredApp,[in] LPCOLESTR pszW2KThreadID)
HRESULT | OnActivityLeave ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidCurrentApp,[in] LPCOLESTR pszGuidLeftApp)
HRESULT | OnActivityLeaveSame ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidCurrentApp,[in] DWORD dwCallDepth)
HRESULT | OnActivityReenter ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidCurrentApp,[in] LPCOLESTR pszW2KThreadID,[in] DWORD dwCallDepth)
HRESULT | OnActivityTimeout ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidCurrentApp,[in] LPCOLESTR pszGuidEnteredApp,[in] LPCOLESTR pszW2KThreadID,[in] DWORD dwTimeout)
HRESULT | OnAppActivation ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp)
HRESULT | OnAppShutdown ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp)
HRESULT | OnAuthenticate ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidActivity,[in] LPCOLESTR pszObjectID,[in] LPCOLESTR pszGuidIID,[in] LPCOLESTR pszMethod,[in] LPCOLESTR pszOriginalUser,[in] LPCOLESTR pszDirectUser,[in] BOOL bCurrentUserInpersonatingInProc)
HRESULT | OnAuthenticateFail ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidActivity,[in] LPCOLESTR pszObjectID,[in] LPCOLESTR pszGuidIID,[in] LPCOLESTR pszMethod,[in] LPCOLESTR pszOriginalUser,[in] LPCOLESTR pszDirectUser,[in] BOOL bCurrentUserInpersonatingInProc)
HRESULT | OnCRMAbort ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidClerkCLSID)
HRESULT | OnCRMAnalyze ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidClerkCLSID,[in] LPCOLESTR pszCrmRecordType,[in] DWORD dwRecordSize)
HRESULT | OnCRMBegin ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidClerkCLSID,[in] LPCOLESTR pszGuidActivityID,[in] LPCOLESTR pszGuidTxUOWID,[in] LPCOLESTR pszProgIdCompensator,[in] LPCOLESTR pszDescription)
HRESULT | OnCRMCheckpoint ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp)
HRESULT | OnCRMCommit ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidClerkCLSID)
HRESULT | OnCRMDeliver ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidClerkCLSID,[in] BOOL bVariants,[in] DWORD dwRecordSize)
HRESULT | OnCRMDone ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidClerkCLSID)
HRESULT | OnCRMForce ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidClerkCLSID)
HRESULT | OnCRMForget ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidClerkCLSID)
HRESULT | OnCRMIndoubt ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidClerkCLSID)
HRESULT | OnCRMPrepare ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidClerkCLSID)
HRESULT | OnCRMRecoveryDone ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp)
HRESULT | OnCRMRecoveryStart ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp)
HRESULT | OnCRMRelease ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidClerkCLSID)
HRESULT | OnCRMWrite ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidClerkCLSID,[in] BOOL bVariants,[in] DWORD dwRecordSize)
HRESULT | OnDisableCommit ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszContextID)
HRESULT | OnEnableCommit ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszContextID)
HRESULT | OnExceptionUser ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszCode,[in] LPCOLESTR pszAddress,[in] LPCOLESTR pszStackTrace)
HRESULT | OnIISRequestInfo ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszObjectID,[in] LPCOLESTR pszClientIP,[in] LPCOLESTR pszServerIP,[in] LPCOLESTR pszURL)
HRESULT | OnMethodCall ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszObjectID,[in] LPCOLESTR pszGuidClassID,[in] LPCOLESTR pszGuidInterfaceID,[in] LPCOLESTR pszMethod)
HRESULT | OnMethodException ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszObjectID,[in] LPCOLESTR pszGuidClassID,[in] LPCOLESTR pszGuidInterfaceID,[in] LPCOLESTR pszMethod)
HRESULT | OnMethodReturn ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszObjectID,[in] LPCOLESTR pszGuidClassID,[in] LPCOLESTR pszGuidInterfaceID,[in] LPCOLESTR pszMethod,[in] HRESULT hr,[in] LPCOLESTR pszCallTime)
HRESULT | OnObjectActivate ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszContextID,[in] LPCOLESTR pszObjectID)
HRESULT | OnObjectConstruct ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszClassID,[in] LPCOLESTR pszConstructString,[in] LPCOLESTR pszObjectID)
HRESULT | OnObjectCreate ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidActivityID,[in] LPCOLESTR pszClassID,[in] LPCOLESTR pszTSID,[in] LPCOLESTR pszContextID,[in] LPCOLESTR pszObjectID)
HRESULT | OnObjectDeactivate ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszContextID,[in] LPCOLESTR pszObjectID)
HRESULT | OnObjectDestroy ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszContextID)
HRESULT | OnObjPoolCreateDecision ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] DWORD dwThreadsWaiting,[in] DWORD dwAvailableObjs,[in] DWORD dwCreatedObjs,[in] DWORD dwMin,[in] DWORD dwMax)
HRESULT | OnObjPoolCreateObject ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszClassID,[in] DWORD dwAvailableObjs,[in] LPCOLESTR pszObjectID)
HRESULT | OnObjPoolCreatePool ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszClassID,[in] DWORD dwMin,[in] DWORD dwMax,[in] DWORD dwTimeout)
HRESULT | OnObjPoolDestroyObject ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszClassID,[in] DWORD dwAvailableObjs,[in] LPCOLESTR pszObjectID)
HRESULT | OnObjPoolGetFromTx ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidActivityID,[in] LPCOLESTR pszClassID,[in] LPCOLESTR pszGuidTx,[in] LPCOLESTR pszObjectID)
HRESULT | OnObjPoolGetObject ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidActivityID,[in] LPCOLESTR pszClassID,[in] DWORD dwAvailableObjs,[in] LPCOLESTR pszObjectID)
HRESULT | OnObjPoolPutObject ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszClassID,[in] int nReason,[in] DWORD dwAvailableObjs,[in] LPCOLESTR pszObjectID)
HRESULT | OnObjPoolRecycleToTx ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidActivityID,[in] LPCOLESTR pszClassID,[in] LPCOLESTR pszGuidTx,[in] LPCOLESTR pszObjectID)
HRESULT | OnObjPoolTimeout ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszClassID,[in] LPCOLESTR pszGuidActivityID,[in] DWORD dwTimeout)
HRESULT | OnQCMoveToDeadQueue ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidMsgID,[in] LPCOLESTR pszGuidWorkFlowID)
HRESULT | OnQCMoveToReTryQueue ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidMsgID,[in] LPCOLESTR pszGuidWorkFlowID,[in] ULONG RetryIndex)
HRESULT | OnQCPlayback ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszObjectID,[in] LPCOLESTR pszGuidMsgID,[in] LPCOLESTR pszGuidWorkFlowID,[in] HRESULT hr)
HRESULT | OnQCQueueOpen ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszQueueName,[in] LPCOLESTR pszQueueID,[in] HRESULT hr)
HRESULT | OnQCReceive ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszQueueID,[in] LPCOLESTR pszGuidMsgID,[in] LPCOLESTR pszGuidWorkFlowID,[in] HRESULT hr)
HRESULT | OnQCReceiveFail ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszQueueID,[in] HRESULT hr)
HRESULT | OnQCRecord ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszObjectID,[in] LPCOLESTR pszQueueName,[in] LPCOLESTR pszGuidMsgID,[in] LPCOLESTR pszGuidWorkFlowID,[in] HRESULT hr)
HRESULT | OnResourceAllocate ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszObjectID,[in] LPCOLESTR pszType,[in] LPCOLESTR pszResId,[in] BOOL bEnlisted,[in] LPCOLESTR pszNumRated,[in] LPCOLESTR pszRating)
HRESULT | OnResourceCreate ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszObjectID,[in] LPCOLESTR pszType,[in] LPCOLESTR pszResId,[in] BOOL bEnlisted)
HRESULT | OnResourceDestroy ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszObjectID,[in] HRESULT hResult,[in] LPCOLESTR pszType,[in] LPCOLESTR pszResId)
HRESULT | OnResourceRecycle ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszObjectID,[in] LPCOLESTR pszType,[in] LPCOLESTR pszResId)
HRESULT | OnResourceTrack ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszObjectID,[in] LPCOLESTR pszType,[in] LPCOLESTR pszResId,[in] BOOL bEnlisted)
HRESULT | OnSetAbort ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszContextID)
HRESULT | OnSetComplete ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszContextID)
HRESULT | OnThreadAssignApartment ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidActivityID,[in] LPCOLESTR pszAptID)
HRESULT | OnThreadBindToApartment ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszThreadID,[in] LPCOLESTR pszAptID,[in] DWORD dwActivityCnt)
HRESULT | OnThreadStart ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszThreadID,[in] LPCOLESTR pszW2KThreadID,[in] DWORD dwThreadCnt)
HRESULT | OnThreadTerminate ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszThreadID,[in] LPCOLESTR pszW2KThreadID,[in] DWORD dwThreadCnt)
HRESULT | OnThreadUnassignApartment ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszAptID)
HRESULT | OnThreadUnBind ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszThreadID,[in] LPCOLESTR pszAptID,[in] DWORD dwActivityCnt)
HRESULT | OnThreadWorkEnque ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszThreadID,[in] LPCOLESTR MsgWorkID,[in] DWORD dwQueueLen)
HRESULT | OnThreadWorkPrivate ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszThreadID,[in] LPCOLESTR MsgWorkID)
HRESULT | OnThreadWorkPublic ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszThreadID,[in] LPCOLESTR MsgWorkID,[in] DWORD dwQueueLen)
HRESULT | OnThreadWorkRedirect ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszThreadID,[in] LPCOLESTR MsgWorkID,[in] DWORD dwQueueLen,[in] LPCOLESTR pszThreadNum)
HRESULT | OnThreadWorkReject ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszThreadID,[in] LPCOLESTR MsgWorkID,[in] DWORD dwQueueLen)
HRESULT | OnTransactionAborted ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidTxID)
HRESULT | OnTransactionCommit ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidTxID)
HRESULT | OnTransactionPrepared ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidTxID,[in] BOOL bVoteYes)
HRESULT | OnTransactionStart ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidTxID,[in] LPCOLESTR pszGuidTSID,[in] BOOL bRoot)
HRESULT | TargetDown ([in] LONGLONG perfCount,[in] LPCOLESTR pszServerName,[in] LPCOLESTR pszClsidEng)
HRESULT | TargetUp ([in] LONGLONG perfCount,[in] LPCOLESTR pszServerName,[in] LPCOLESTR pszClsidEng)

Detailed Description

Definition at line 27 of file comspyaudit.idl.

Member Function Documentation

HRESULT IComSpyAudit::EngineDefined | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszPropName,
 |  | [in] VARIANT * | varPropValue,
 |  | [in] LPCOLESTR | pszClsidEng
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::Init | ( | LPCOLESTR | sDSN,
 |  | LPCOLESTR | sUser,
 |  | LPCOLESTR | sPw
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnActivityCreate | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidActivityID
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnActivityDestroy | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidActivityID
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnActivityEnter | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidCurrentApp,
 |  | [in] LPCOLESTR | pszGuidEnteredApp,
 |  | [in] LPCOLESTR | pszW2KThreadID
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnActivityLeave | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidCurrentApp,
 |  | [in] LPCOLESTR | pszGuidLeftApp
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnActivityLeaveSame | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidCurrentApp,
 |  | [in] DWORD | dwCallDepth
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnActivityReenter | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidCurrentApp,
 |  | [in] LPCOLESTR | pszW2KThreadID,
 |  | [in] DWORD | dwCallDepth
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnActivityTimeout | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidCurrentApp,
 |  | [in] LPCOLESTR | pszGuidEnteredApp,
 |  | [in] LPCOLESTR | pszW2KThreadID,
 |  | [in] DWORD | dwTimeout
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnAppActivation | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnAppShutdown | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnAuthenticate | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidActivity,
 |  | [in] LPCOLESTR | pszObjectID,
 |  | [in] LPCOLESTR | pszGuidIID,
 |  | [in] LPCOLESTR | pszMethod,
 |  | [in] LPCOLESTR | pszOriginalUser,
 |  | [in] LPCOLESTR | pszDirectUser,
 |  | [in] BOOL | bCurrentUserInpersonatingInProc
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnAuthenticateFail | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidActivity,
 |  | [in] LPCOLESTR | pszObjectID,
 |  | [in] LPCOLESTR | pszGuidIID,
 |  | [in] LPCOLESTR | pszMethod,
 |  | [in] LPCOLESTR | pszOriginalUser,
 |  | [in] LPCOLESTR | pszDirectUser,
 |  | [in] BOOL | bCurrentUserInpersonatingInProc
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnCRMAbort | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidClerkCLSID
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnCRMAnalyze | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidClerkCLSID,
 |  | [in] LPCOLESTR | pszCrmRecordType,
 |  | [in] DWORD | dwRecordSize
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnCRMBegin | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidClerkCLSID,
 |  | [in] LPCOLESTR | pszGuidActivityID,
 |  | [in] LPCOLESTR | pszGuidTxUOWID,
 |  | [in] LPCOLESTR | pszProgIdCompensator,
 |  | [in] LPCOLESTR | pszDescription
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnCRMCheckpoint | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnCRMCommit | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidClerkCLSID
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnCRMDeliver | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidClerkCLSID,
 |  | [in] BOOL | bVariants,
 |  | [in] DWORD | dwRecordSize
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnCRMDone | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidClerkCLSID
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnCRMForce | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidClerkCLSID
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnCRMForget | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidClerkCLSID
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnCRMIndoubt | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidClerkCLSID
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnCRMPrepare | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidClerkCLSID
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnCRMRecoveryDone | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnCRMRecoveryStart | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnCRMRelease | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidClerkCLSID
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnCRMWrite | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidClerkCLSID,
 |  | [in] BOOL | bVariants,
 |  | [in] DWORD | dwRecordSize
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnDisableCommit | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszContextID
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnEnableCommit | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszContextID
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnExceptionUser | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszCode,
 |  | [in] LPCOLESTR | pszAddress,
 |  | [in] LPCOLESTR | pszStackTrace
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnIISRequestInfo | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszObjectID,
 |  | [in] LPCOLESTR | pszClientIP,
 |  | [in] LPCOLESTR | pszServerIP,
 |  | [in] LPCOLESTR | pszURL
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnMethodCall | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszObjectID,
 |  | [in] LPCOLESTR | pszGuidClassID,
 |  | [in] LPCOLESTR | pszGuidInterfaceID,
 |  | [in] LPCOLESTR | pszMethod
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnMethodException | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszObjectID,
 |  | [in] LPCOLESTR | pszGuidClassID,
 |  | [in] LPCOLESTR | pszGuidInterfaceID,
 |  | [in] LPCOLESTR | pszMethod
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnMethodReturn | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszObjectID,
 |  | [in] LPCOLESTR | pszGuidClassID,
 |  | [in] LPCOLESTR | pszGuidInterfaceID,
 |  | [in] LPCOLESTR | pszMethod,
 |  | [in] HRESULT | hr,
 |  | [in] LPCOLESTR | pszCallTime
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnObjectActivate | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszContextID,
 |  | [in] LPCOLESTR | pszObjectID
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnObjectConstruct | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszClassID,
 |  | [in] LPCOLESTR | pszConstructString,
 |  | [in] LPCOLESTR | pszObjectID
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnObjectCreate | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidActivityID,
 |  | [in] LPCOLESTR | pszClassID,
 |  | [in] LPCOLESTR | pszTSID,
 |  | [in] LPCOLESTR | pszContextID,
 |  | [in] LPCOLESTR | pszObjectID
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnObjectDeactivate | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszContextID,
 |  | [in] LPCOLESTR | pszObjectID
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnObjectDestroy | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszContextID
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnObjPoolCreateDecision | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] DWORD | dwThreadsWaiting,
 |  | [in] DWORD | dwAvailableObjs,
 |  | [in] DWORD | dwCreatedObjs,
 |  | [in] DWORD | dwMin,
 |  | [in] DWORD | dwMax
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnObjPoolCreateObject | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszClassID,
 |  | [in] DWORD | dwAvailableObjs,
 |  | [in] LPCOLESTR | pszObjectID
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnObjPoolCreatePool | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszClassID,
 |  | [in] DWORD | dwMin,
 |  | [in] DWORD | dwMax,
 |  | [in] DWORD | dwTimeout
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnObjPoolDestroyObject | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszClassID,
 |  | [in] DWORD | dwAvailableObjs,
 |  | [in] LPCOLESTR | pszObjectID
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnObjPoolGetFromTx | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidActivityID,
 |  | [in] LPCOLESTR | pszClassID,
 |  | [in] LPCOLESTR | pszGuidTx,
 |  | [in] LPCOLESTR | pszObjectID
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnObjPoolGetObject | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidActivityID,
 |  | [in] LPCOLESTR | pszClassID,
 |  | [in] DWORD | dwAvailableObjs,
 |  | [in] LPCOLESTR | pszObjectID
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnObjPoolPutObject | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszClassID,
 |  | [in] int | nReason,
 |  | [in] DWORD | dwAvailableObjs,
 |  | [in] LPCOLESTR | pszObjectID
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnObjPoolRecycleToTx | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidActivityID,
 |  | [in] LPCOLESTR | pszClassID,
 |  | [in] LPCOLESTR | pszGuidTx,
 |  | [in] LPCOLESTR | pszObjectID
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnObjPoolTimeout | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszClassID,
 |  | [in] LPCOLESTR | pszGuidActivityID,
 |  | [in] DWORD | dwTimeout
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnQCMoveToDeadQueue | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidMsgID,
 |  | [in] LPCOLESTR | pszGuidWorkFlowID
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnQCMoveToReTryQueue | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidMsgID,
 |  | [in] LPCOLESTR | pszGuidWorkFlowID,
 |  | [in] ULONG | RetryIndex
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnQCPlayback | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszObjectID,
 |  | [in] LPCOLESTR | pszGuidMsgID,
 |  | [in] LPCOLESTR | pszGuidWorkFlowID,
 |  | [in] HRESULT | hr
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnQCQueueOpen | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszQueueName,
 |  | [in] LPCOLESTR | pszQueueID,
 |  | [in] HRESULT | hr
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnQCReceive | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszQueueID,
 |  | [in] LPCOLESTR | pszGuidMsgID,
 |  | [in] LPCOLESTR | pszGuidWorkFlowID,
 |  | [in] HRESULT | hr
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnQCReceiveFail | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszQueueID,
 |  | [in] HRESULT | hr
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnQCRecord | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszObjectID,
 |  | [in] LPCOLESTR | pszQueueName,
 |  | [in] LPCOLESTR | pszGuidMsgID,
 |  | [in] LPCOLESTR | pszGuidWorkFlowID,
 |  | [in] HRESULT | hr
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnResourceAllocate | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszObjectID,
 |  | [in] LPCOLESTR | pszType,
 |  | [in] LPCOLESTR | pszResId,
 |  | [in] BOOL | bEnlisted,
 |  | [in] LPCOLESTR | pszNumRated,
 |  | [in] LPCOLESTR | pszRating
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnResourceCreate | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszObjectID,
 |  | [in] LPCOLESTR | pszType,
 |  | [in] LPCOLESTR | pszResId,
 |  | [in] BOOL | bEnlisted
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnResourceDestroy | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszObjectID,
 |  | [in] HRESULT | hResult,
 |  | [in] LPCOLESTR | pszType,
 |  | [in] LPCOLESTR | pszResId
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnResourceRecycle | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszObjectID,
 |  | [in] LPCOLESTR | pszType,
 |  | [in] LPCOLESTR | pszResId
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnResourceTrack | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszObjectID,
 |  | [in] LPCOLESTR | pszType,
 |  | [in] LPCOLESTR | pszResId,
 |  | [in] BOOL | bEnlisted
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnSetAbort | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszContextID
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnSetComplete | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszContextID
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnThreadAssignApartment | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidActivityID,
 |  | [in] LPCOLESTR | pszAptID
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnThreadBindToApartment | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszThreadID,
 |  | [in] LPCOLESTR | pszAptID,
 |  | [in] DWORD | dwActivityCnt
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnThreadStart | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszThreadID,
 |  | [in] LPCOLESTR | pszW2KThreadID,
 |  | [in] DWORD | dwThreadCnt
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnThreadTerminate | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszThreadID,
 |  | [in] LPCOLESTR | pszW2KThreadID,
 |  | [in] DWORD | dwThreadCnt
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnThreadUnassignApartment | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszAptID
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnThreadUnBind | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszThreadID,
 |  | [in] LPCOLESTR | pszAptID,
 |  | [in] DWORD | dwActivityCnt
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnThreadWorkEnque | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszThreadID,
 |  | [in] LPCOLESTR | MsgWorkID,
 |  | [in] DWORD | dwQueueLen
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnThreadWorkPrivate | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszThreadID,
 |  | [in] LPCOLESTR | MsgWorkID
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnThreadWorkPublic | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszThreadID,
 |  | [in] LPCOLESTR | MsgWorkID,
 |  | [in] DWORD | dwQueueLen
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnThreadWorkRedirect | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszThreadID,
 |  | [in] LPCOLESTR | MsgWorkID,
 |  | [in] DWORD | dwQueueLen,
 |  | [in] LPCOLESTR | pszThreadNum
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnThreadWorkReject | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszThreadID,
 |  | [in] LPCOLESTR | MsgWorkID,
 |  | [in] DWORD | dwQueueLen
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnTransactionAborted | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidTxID
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnTransactionCommit | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidTxID
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnTransactionPrepared | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidTxID,
 |  | [in] BOOL | bVoteYes
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::OnTransactionStart | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidTxID,
 |  | [in] LPCOLESTR | pszGuidTSID,
 |  | [in] BOOL | bRoot
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::TargetDown | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszServerName,
 |  | [in] LPCOLESTR | pszClsidEng
 | ) |  |

Implemented in CComSpySqlAudit.

HRESULT IComSpyAudit::TargetUp | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszServerName,
 |  | [in] LPCOLESTR | pszClsidEng
 | ) |  |

Implemented in CComSpySqlAudit.

The documentation for this interface was generated from the following file:
  • Com/Administration/Spy/idl/comspyaudit.idl
Generated on Wed Nov 13 2024 16:57:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ICOMSysLCE Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

ICOMSysLCE Interface Reference

import "comspyctl.idl";

Inherits com::ms::com::IUnknown.

Inherited by CSysLCESub.

List of all members.

Public Member Functions

HRESULT | GetEventClass ([out] LPGUID guid)
HRESULT | GetEventType ([out] EventEnum *e)
HRESULT | Install ([in] BSTR *PropertyName,[in] VARIANT PropertyValue)
HRESULT | Uninstall ()

Detailed Description

Definition at line 99 of file comspyctl.idl.

Member Function Documentation

HRESULT ICOMSysLCE::GetEventClass ( [out] LPGUID guid )

Implemented in CActivitySub, CAppSub, CCRMSub, CEvtStoreSub, CExceptionSub, CIdentitySub, CInstanceSub, CLBSub, CMethodSub, CObjConstSub, CObjPool2Sub, CObjPoolSub, CObjSub, CQCSub, CResourceSub, CSecuritySub, CSysLCESub, CThreadSub, CTxSub, and CUserSub.

HRESULT ICOMSysLCE::GetEventType ( [out] EventEnum * e )

Implemented in CActivitySub, CAppSub, CCRMSub, CEvtStoreSub, CExceptionSub, CIdentitySub, CInstanceSub, CLBSub, CMethodSub, CObjConstSub, CObjPool2Sub, CObjPoolSub, CObjSub, CQCSub, CResourceSub, CSecuritySub, CSysLCESub, CThreadSub, CTxSub, and CUserSub.

HRESULT ICOMSysLCE::Install | ( | [in] BSTR * | PropertyName,
 |  | [in] VARIANT | PropertyValue
 | ) |  |

Implemented in CSysLCESub.

HRESULT ICOMSysLCE::Uninstall ( )

Implemented in CSysLCESub.

The documentation for this interface was generated from the following file:
  • Com/Administration/Spy/idl/comspyctl.idl
Generated on Wed Nov 13 2024 16:57:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ICONDIR Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

ICONDIR Struct Reference

#include "Icons.h"

List of all members.

Public Attributes

WORD | idCount
ICONDIRENTRY | idEntries [1]
WORD | idReserved
WORD | idType

Detailed Description

Definition at line 62 of file Icons.h.

Member Data Documentation

WORD ICONDIR::idCount

Definition at line 66 of file Icons.h.

ICONDIRENTRY ICONDIR::idEntries[1]

Definition at line 67 of file Icons.h.

WORD ICONDIR::idReserved

Definition at line 64 of file Icons.h.

WORD ICONDIR::idType

Definition at line 65 of file Icons.h.

The documentation for this struct was generated from the following file:
  • WinUI/Resource/Iconpro/Icons.h
Generated on Wed Nov 13 2024 16:57:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ICONDIRENTRY Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

ICONDIRENTRY Struct Reference

#include "Icons.h"

List of all members.

Public Attributes

BYTE | bColorCount
BYTE | bHeight
BYTE | bReserved
BYTE | bWidth
DWORD dwBytesInRes
DWORD dwImageOffset
WORD | wBitCount
WORD | wPlanes

Detailed Description

Definition at line 51 of file Icons.h.

Member Data Documentation

BYTE ICONDIRENTRY::bColorCount

Definition at line 55 of file Icons.h.

BYTE ICONDIRENTRY::bHeight

Definition at line 54 of file Icons.h.

BYTE ICONDIRENTRY::bReserved

Definition at line 56 of file Icons.h.

BYTE ICONDIRENTRY::bWidth

Definition at line 53 of file Icons.h.

DWORD ICONDIRENTRY::dwBytesInRes

Definition at line 59 of file Icons.h.

DWORD ICONDIRENTRY::dwImageOffset

Definition at line 60 of file Icons.h.

WORD ICONDIRENTRY::wBitCount

Definition at line 58 of file Icons.h.

WORD ICONDIRENTRY::wPlanes

Definition at line 57 of file Icons.h.

The documentation for this struct was generated from the following file:
  • WinUI/Resource/Iconpro/Icons.h
Generated on Wed Nov 13 2024 16:57:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ICONIMAGE Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

ICONIMAGE Struct Reference

#include "Icons.h"

List of all members.

Public Attributes

UINT Colors
DWORD dwNumBytes
UINT Height
PBYTE | pAND
PBITMAPINFO | pbi
PBYTE | pBits
PBYTE | pXOR
UINT Width

Detailed Description

Definition at line 76 of file Icons.h.

Member Data Documentation

UINT ICONIMAGE::Colors

Definition at line 78 of file Icons.h.

DWORD ICONIMAGE::dwNumBytes

Definition at line 80 of file Icons.h.

UINT ICONIMAGE::Height

Definition at line 78 of file Icons.h.

PBYTE ICONIMAGE::pAND

Definition at line 83 of file Icons.h.

PBITMAPINFO ICONIMAGE::pbi

Definition at line 81 of file Icons.h.

PBYTE ICONIMAGE::pBits

Definition at line 79 of file Icons.h.

PBYTE ICONIMAGE::pXOR

Definition at line 82 of file Icons.h.

UINT ICONIMAGE::Width

Definition at line 78 of file Icons.h.

The documentation for this struct was generated from the following file:
  • WinUI/Resource/Iconpro/Icons.h
Generated on Wed Nov 13 2024 16:57:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IConnectionPointImpl Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

IConnectionPointImpl Class Reference

Inherited by CProxyIRowsetNotify< T >, and CProxyIRowsetNotify< CMSOmniProvRowset >.

The documentation for this class was generated from the following file:
  • Dataaccess/oledb/omniprov/source/rncp.h
Generated on Wed Nov 13 2024 16:57:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ICONRESOURCE Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

ICONRESOURCE Struct Reference

#include "Icons.h"

List of all members.

Public Attributes

BOOL bHasChanged
ICONIMAGE | IconImages [1]
UINT nNumImages
TCHAR | szOriginalDLLFileName [MAX_PATH]
TCHAR | szOriginalICOFileName [MAX_PATH]

Detailed Description

Definition at line 85 of file Icons.h.

Member Data Documentation

BOOL ICONRESOURCE::bHasChanged

Definition at line 87 of file Icons.h.

ICONIMAGE ICONRESOURCE::IconImages[1]

Definition at line 91 of file Icons.h.

UINT ICONRESOURCE::nNumImages

Definition at line 90 of file Icons.h.

TCHAR ICONRESOURCE::szOriginalDLLFileName[MAX_PATH]

Definition at line 89 of file Icons.h.

TCHAR ICONRESOURCE::szOriginalICOFileName[MAX_PATH]

Definition at line 88 of file Icons.h.

The documentation for this struct was generated from the following file:
  • WinUI/Resource/Iconpro/Icons.h
Generated on Wed Nov 13 2024 16:57:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ICreateTable Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

ICreateTable Interface Reference

import "BankVC.idl";

List of all members.

Public Member Functions

HRESULT CreateAccount ()

Detailed Description

Definition at line 27 of file BankVC.idl.

Member Function Documentation

HRESULT ICreateTable::CreateAccount ( )
The documentation for this interface was generated from the following file:
  • Web/iis/Components/Cpp/MTXSample/BankVC.idl
Generated on Wed Nov 13 2024 16:57:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IDBAuthAdmin Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

IDBAuthAdmin Interface Reference

import "dbauth.idl";

List of all members.

Public Member Functions

HRESULT | AddUser (BSTR bstrUserName)
HRESULT | GetUsers ([out, retval] BSTR *pbstrUserNames)
HRESULT | RemoveUser (BSTR bstrUserName)
HRESULT | VerifyUser (BSTR bstrUserName,[out, retval] VARIANT_BOOL *bFound)

Detailed Description

Definition at line 52 of file dbauth.idl.

Member Function Documentation

HRESULT IDBAuthAdmin::AddUser ( BSTR bstrUserName )
HRESULT IDBAuthAdmin::GetUsers ( [out, retval] BSTR * pbstrUserNames )
HRESULT IDBAuthAdmin::RemoveUser ( BSTR bstrUserName )
HRESULT IDBAuthAdmin::VerifyUser | ( | BSTR | bstrUserName,
 |  | [out, retval] VARIANT_BOOL * | bFound
 | ) |  |
The documentation for this interface was generated from the following file:
  • Multimedia/WindowsMediaServices9/Authorization/dbauth.idl
Generated on Wed Nov 13 2024 16:57:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IDBAuthPlugin Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

IDBAuthPlugin Interface Reference

import "dbauth.idl";

Inherits com::ms::com::IUnknown.

Inherited by CDBAuthPlugin.

Detailed Description

Definition at line 40 of file dbauth.idl.

The documentation for this interface was generated from the following file:
  • Multimedia/WindowsMediaServices9/Authorization/dbauth.idl
Generated on Wed Nov 13 2024 16:57:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IDimmer Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

IDimmer Interface Reference

import "MyDevice.idl";

Detailed Description

Definition at line 16 of file MyDevice.idl.

The documentation for this interface was generated from the following file:
  • NetDS/upnp/StepByStep/Step2/MyDevice.idl
Generated on Wed Nov 13 2024 16:57:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IDimmerService Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

IDimmerService Interface Reference

import "MyDevice.idl";

Detailed Description

Definition at line 26 of file MyDevice.idl.

The documentation for this interface was generated from the following file:
  • NetDS/upnp/StepByStep/Step2/MyDevice.idl
Generated on Wed Nov 13 2024 16:57:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IDispEventSimpleImpl Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

IDispEventSimpleImpl Class Reference

Inherited by IInkCollectorEventsImpl< T >, IInkCollectorEventsImpl< T >, IInkCollectorEventsImpl< CAdvRecoApp >, IInkCollectorEventsImpl< CAdvRecoApp >, IInkCollectorEventsImpl< CMultiRecoApp >, IInkCollectorEventsImpl< CMultiRecoApp >, IInkRecognitionEventsImpl< T >, IInkRecognitionEventsImpl< T >, IInkRecognitionEventsImpl< CAdvRecoApp >, IInkRecognitionEventsImpl< CAdvRecoApp >, IInkRecognitionEventsImpl< CMultiRecoApp >, and IInkRecognitionEventsImpl< CMultiRecoApp >.

The documentation for this class was generated from the following file:
  • TabletPC/MultiReco/EventSinks.h
Generated on Wed Nov 13 2024 16:57:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IEnumConnectionPoints Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

IEnumConnectionPoints Class Reference

Inherited by CEnumXXX< CEnumConnectionPoints, LPCONNECTIONPOINT, IEnumConnectionPoints >.

The documentation for this class was generated from the following file:
  • Com/async/server/CEnumXXX.h
Generated on Wed Nov 13 2024 16:57:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IEnumConnections Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

IEnumConnections Class Reference

Inherited by CEnumXXX< CEnumConnections, CONNECTDATA, IEnumConnections >.

The documentation for this class was generated from the following file:
  • Com/async/server/CEnumXXX.h
Generated on Wed Nov 13 2024 16:57:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IEventSink Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

IEventSink Interface Reference

import "Render.idl";

Detailed Description

Definition at line 41 of file Render.idl.

The documentation for this interface was generated from the following file:
  • Web/Browser/RenderBehave/renderproject/Render.idl
Generated on Wed Nov 13 2024 16:57:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IFactory Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

IFactory Interface Reference

import "Render.idl";

Inherits com::ms::com::IUnknown.

Detailed Description

Definition at line 21 of file Render.idl.

The documentation for this interface was generated from the following file:
  • Web/Browser/RenderBehave/renderproject/Render.idl
Generated on Wed Nov 13 2024 16:57:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: igmp_group_record_v3 Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

igmp_group_record_v3 Struct Reference

#include "iphdr.h"

List of all members.

Public Attributes

unsigned char | aux_data_len
unsigned long | group_addr
unsigned short | num_sources
unsigned long | source_addr [1]
unsigned char | type

Detailed Description

Definition at line 108 of file iphdr.h.

Member Data Documentation

unsigned char igmp_group_record_v3::aux_data_len

Definition at line 111 of file iphdr.h.

unsigned long igmp_group_record_v3::group_addr

Definition at line 113 of file iphdr.h.

unsigned short igmp_group_record_v3::num_sources

Definition at line 112 of file iphdr.h.

unsigned long igmp_group_record_v3::source_addr[1]

Definition at line 114 of file iphdr.h.

unsigned char igmp_group_record_v3::type

Definition at line 110 of file iphdr.h.

The documentation for this struct was generated from the following file:
  • NetDS/WinSock/rcvall/iphdr.h
Generated on Wed Nov 13 2024 16:57:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: igmp_hdr Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

igmp_hdr Struct Reference

#include "iphdr.h"

List of all members.

Public Attributes

unsigned short | checksum
unsigned long | group_addr
unsigned char | max_resp_time
unsigned char | version_type

Detailed Description

Definition at line 88 of file iphdr.h.

Member Data Documentation

unsigned short igmp_hdr::checksum

Definition at line 92 of file iphdr.h.

unsigned long igmp_hdr::group_addr

Definition at line 93 of file iphdr.h.

unsigned char igmp_hdr::max_resp_time

Definition at line 91 of file iphdr.h.

unsigned char igmp_hdr::version_type

Definition at line 90 of file iphdr.h.

The documentation for this struct was generated from the following file:
  • NetDS/WinSock/rcvall/iphdr.h
Generated on Wed Nov 13 2024 16:57:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: igmp_hdr_query_v3 Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

igmp_hdr_query_v3 Struct Reference

#include "iphdr.h"

List of all members.

Public Attributes

unsigned short | checksum
unsigned long | group_addr
unsigned char | max_resp_time
unsigned short | num_sources
unsigned char | qqi
unsigned char | resv_suppr_robust
unsigned long | sources [1]
unsigned char | type

Detailed Description

Definition at line 96 of file iphdr.h.

Member Data Documentation

unsigned short igmp_hdr_query_v3::checksum

Definition at line 100 of file iphdr.h.

unsigned long igmp_hdr_query_v3::group_addr

Definition at line 101 of file iphdr.h.

unsigned char igmp_hdr_query_v3::max_resp_time

Definition at line 99 of file iphdr.h.

unsigned short igmp_hdr_query_v3::num_sources

Definition at line 104 of file iphdr.h.

unsigned char igmp_hdr_query_v3::qqi

Definition at line 103 of file iphdr.h.

unsigned char igmp_hdr_query_v3::resv_suppr_robust

Definition at line 102 of file iphdr.h.

unsigned long igmp_hdr_query_v3::sources[1]

Definition at line 105 of file iphdr.h.

unsigned char igmp_hdr_query_v3::type

Definition at line 98 of file iphdr.h.

The documentation for this struct was generated from the following file:
  • NetDS/WinSock/rcvall/iphdr.h
Generated on Wed Nov 13 2024 16:57:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: igmp_hdr_report_v3 Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

igmp_hdr_report_v3 Struct Reference

#include "iphdr.h"

List of all members.

Public Attributes

unsigned short | checksum
unsigned short | num_records
unsigned char | reserved1
unsigned short | reserved2
unsigned char | type

Detailed Description

Definition at line 117 of file iphdr.h.

Member Data Documentation

unsigned short igmp_hdr_report_v3::checksum

Definition at line 121 of file iphdr.h.

unsigned short igmp_hdr_report_v3::num_records

Definition at line 123 of file iphdr.h.

unsigned char igmp_hdr_report_v3::reserved1

Definition at line 120 of file iphdr.h.

unsigned short igmp_hdr_report_v3::reserved2

Definition at line 122 of file iphdr.h.

unsigned char igmp_hdr_report_v3::type

Definition at line 119 of file iphdr.h.

The documentation for this struct was generated from the following file:
  • NetDS/WinSock/rcvall/iphdr.h
Generated on Wed Nov 13 2024 16:57:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IGrid Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

IGrid Interface Reference

import "EdHost.idl";

Inherits com::ms::com::IUnknown.

Inherited by CGrid.

List of all members.

Public Member Functions

HRESULT | GridSize ([out, retval] long *pVal)
HRESULT | GridSize ([in] long newVal)

Detailed Description

Definition at line 34 of file EdHost.idl.

Member Function Documentation

HRESULT IGrid::GridSize ( [out, retval] long * pVal ) [get]
HRESULT IGrid::GridSize ( [in] long newVal ) [set]
The documentation for this interface was generated from the following file:
  • Web/Browser/EditHost/EdHost.idl
Generated on Wed Nov 13 2024 16:57:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IHelloWorld Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

IHelloWorld Interface Reference

import "ADsFirstExt.idl";

Inherited by HelloWorld.

List of all members.

Public Member Functions

HRESULT | Say ()
HRESULT | Say ()

Detailed Description

Definition at line 18 of file ADsFirstExt.idl.

Member Function Documentation

HRESULT IHelloWorld::Say ( )

Implemented in HelloWorld, and HelloWorld.

HRESULT IHelloWorld::Say ( )

Implemented in HelloWorld, and HelloWorld.

The documentation for this interface was generated from the following files:
  • NetDS/ADSI/samples/Extension/tutorial/step1/ADsFirstExt.idl
  • NetDS/ADSI/samples/Extension/tutorial/step2/ADsFirstExt.idl
Generated on Wed Nov 13 2024 16:57:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IHelloWorldVtbl Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

IHelloWorldVtbl Struct Reference

#include "ADsFirstExt.h"

List of all members.

Public Member Functions

BEGIN_INTERFACE | HRESULT (STDMETHODCALLTYPE __RPC_FAR *QueryInterface)(IHelloWorld __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount)(IHelloWorld __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Invoke)(IHelloWorld __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames)(IHelloWorld __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo)(IHelloWorld __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Say)(IHelloWorld __RPC_FAR *This)
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Say)(IHelloWorld __RPC_FAR *This)
BEGIN_INTERFACE | HRESULT (STDMETHODCALLTYPE __RPC_FAR *QueryInterface)(IHelloWorld __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo)(IHelloWorld __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames)(IHelloWorld __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Invoke)(IHelloWorld __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount)(IHelloWorld __RPC_FAR *This
ULONG (STDMETHODCALLTYPE __RPC_FAR *AddRef)(IHelloWorld __RPC_FAR *This)
ULONG (STDMETHODCALLTYPE __RPC_FAR *Release)(IHelloWorld __RPC_FAR *This)
ULONG (STDMETHODCALLTYPE __RPC_FAR *AddRef)(IHelloWorld __RPC_FAR *This)
ULONG (STDMETHODCALLTYPE __RPC_FAR *Release)(IHelloWorld __RPC_FAR *This)

Public Attributes

REFIID LPOLESTR __RPC_FAR UINT | cNames
DISPID | dispIdMember
UINT iTInfo
UINT LCID | lcid
REFIID LPOLESTR __RPC_FAR UINT LCID | lcid
DISPID REFIID LCID | lcid
UINT __RPC_FAR * | pctinfo
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR * 		pDispParams
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR EXCEPINFO __RPC_FAR * 		pExcepInfo
UINT LCID ITypeInfo __RPC_FAR
*__RPC_FAR * 		ppTInfo
BEGIN_INTERFACE REFIID void
__RPC_FAR *__RPC_FAR * 		ppvObject
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR EXCEPINFO __RPC_FAR
UINT __RPC_FAR * 		puArgErr
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR * 		pVarResult
REFIID LPOLESTR __RPC_FAR UINT
LCID DISPID __RPC_FAR * 		rgDispId
REFIID LPOLESTR __RPC_FAR * | rgszNames
REFIID | riid
DISPID REFIID | riid
BEGIN_INTERFACE REFIID | riid
DISPID REFIID LCID WORD | wFlags

Detailed Description

Definition at line 86 of file ADsFirstExt.h.

Member Function Documentation

BEGIN_INTERFACE IHelloWorldVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * QueryInterface )
IHelloWorldVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetTypeInfoCount )
IHelloWorldVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Invoke )
IHelloWorldVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetIDsOfNames )
IHelloWorldVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetTypeInfo )
IHelloWorldVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Say )
IHelloWorldVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Say )
BEGIN_INTERFACE IHelloWorldVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * QueryInterface )
IHelloWorldVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetTypeInfo )
IHelloWorldVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetIDsOfNames )
IHelloWorldVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Invoke )
IHelloWorldVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetTypeInfoCount )
IHelloWorldVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * AddRef )
IHelloWorldVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * Release )
IHelloWorldVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * AddRef )
IHelloWorldVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * Release )

Member Data Documentation

REFIID LPOLESTR __RPC_FAR UINT IHelloWorldVtbl::cNames

Definition at line 113 of file ADsFirstExt.h.

DISPID IHelloWorldVtbl::dispIdMember

Definition at line 121 of file ADsFirstExt.h.

UINT IHelloWorldVtbl::iTInfo

Definition at line 107 of file ADsFirstExt.h.

DISPID REFIID LCID IHelloWorldVtbl::lcid

Definition at line 107 of file ADsFirstExt.h.

REFIID LPOLESTR __RPC_FAR UINT LCID IHelloWorldVtbl::lcid

Definition at line 113 of file ADsFirstExt.h.

DISPID REFIID LCID IHelloWorldVtbl::lcid

Definition at line 121 of file ADsFirstExt.h.

UINT __RPC_FAR * IHelloWorldVtbl::pctinfo

Definition at line 103 of file ADsFirstExt.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR * IHelloWorldVtbl::pDispParams

Definition at line 121 of file ADsFirstExt.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR EXCEPINFO __RPC_FAR * IHelloWorldVtbl::pExcepInfo

Definition at line 121 of file ADsFirstExt.h.

UINT LCID ITypeInfo __RPC_FAR *__RPC_FAR * IHelloWorldVtbl::ppTInfo

Definition at line 107 of file ADsFirstExt.h.

BEGIN_INTERFACE REFIID void __RPC_FAR *__RPC_FAR * IHelloWorldVtbl::ppvObject

Definition at line 92 of file ADsFirstExt.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR EXCEPINFO __RPC_FAR UINT __RPC_FAR * IHelloWorldVtbl::puArgErr

Definition at line 121 of file ADsFirstExt.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR * IHelloWorldVtbl::pVarResult

Definition at line 121 of file ADsFirstExt.h.

REFIID LPOLESTR __RPC_FAR UINT LCID DISPID __RPC_FAR * IHelloWorldVtbl::rgDispId

Definition at line 113 of file ADsFirstExt.h.

REFIID LPOLESTR __RPC_FAR * IHelloWorldVtbl::rgszNames

Definition at line 113 of file ADsFirstExt.h.

REFIID IHelloWorldVtbl::riid

Definition at line 113 of file ADsFirstExt.h.

DISPID REFIID IHelloWorldVtbl::riid

Definition at line 121 of file ADsFirstExt.h.

DISPID REFIID IHelloWorldVtbl::riid

Definition at line 92 of file ADsFirstExt.h.

DISPID REFIID LCID WORD IHelloWorldVtbl::wFlags

Definition at line 121 of file ADsFirstExt.h.

The documentation for this struct was generated from the following files:
  • NetDS/ADSI/samples/Extension/tutorial/step1/ADsFirstExt.h
  • NetDS/ADSI/samples/Extension/tutorial/step2/ADsFirstExt.h
Generated on Wed Nov 13 2024 16:57:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IIDLookUp Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

IIDLookUp Struct Reference

List of all members.

Public Member Functions

IIDLookUp (GUID iNewID, char *pNewIDName)

Public Attributes

GUID | id
char * | pIDName

Detailed Description

Definition at line 703 of file ADSIhelpers.cpp.

Constructor & Destructor Documentation

IIDLookUp::IIDLookUp | ( | GUID | iNewID,
 |  | char * | pNewIDName |
 | ) |  |  | [inline]

Definition at line 708 of file ADSIhelpers.cpp.

                                           :
  id(iNewID), pIDName(pNewIDName) {};

Member Data Documentation

GUID IIDLookUp::id

Definition at line 705 of file ADSIhelpers.cpp.

char* IIDLookUp::pIDName

Definition at line 706 of file ADSIhelpers.cpp.

The documentation for this struct was generated from the following file:
  • NetDS/ADSI/samples/activedir/guidbind/vc/ADSIhelpers.cpp
Generated on Wed Nov 13 2024 16:57:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IInkCollectorEventsImpl< T > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Static Public Attributes

IInkCollectorEventsImpl< T > Class Template Reference

#include "EventSinks.h"

Inherits IDispEventSimpleImpl< SINK_ID, IInkCollectorEventsImpl< T >,&DIID__IInkCollectorEvents >, and IDispEventSimpleImpl< SINK_ID, IInkCollectorEventsImpl< T >,&DIID__IInkCollectorEvents >.

List of all members.

Public Member Functions

const_cast (&mc_AtlFuncInfo[1])) HRESULT __stdcall Stroke(IInkCursor *pIInkCursor
SINK_ENTRY_INFO (SINK_ID, DIID__IInkCollectorEvents, DISPID_CEStroke, Stroke, const_cast< _ATL_FUNC_INFO * >(&mc_AtlFuncInfo)) HRESULT __stdcall Stroke(IInkCursor *pIInkCursor
SINK_ENTRY_INFO (SINK_ID, DIID__IInkCollectorEvents, DISPID_CEStroke, Stroke, const_cast< _ATL_FUNC_INFO * >(&mc_AtlFuncInfo[0])) SINK_ENTRY_INFO(SINK_ID

Public Attributes

DIID__IInkCollectorEvents
DISPID_CEGesture
Gesture
IInkStrokeDisp * | pInkStroke

Static Public Attributes

static const _ATL_FUNC_INFO | mc_AtlFuncInfo [2]

Detailed Description

template<class T>
class IInkCollectorEventsImpl< T >

Definition at line 93 of file EventSinks.h.

Member Function Documentation

template<class T>
IInkCollectorEventsImpl< T >::const_cast ( & mc_AtlFuncInfo[1] )
template<class T>
IInkCollectorEventsImpl< T >::SINK_ENTRY_INFO | ( | SINK_ID | ,
 |  | DIID__IInkCollectorEvents | ,
 |  | DISPID_CEStroke | ,
 |  | Stroke | ,
 |  | const_cast< _ATL_FUNC_INFO * > & | mc_AtlFuncInfo
 | ) |  |
template<class T>
IInkCollectorEventsImpl< T >::SINK_ENTRY_INFO | ( | SINK_ID | ,
 |  | DIID__IInkCollectorEvents | ,
 |  | DISPID_CEStroke | ,
 |  | Stroke | ,
 |  | const_cast< _ATL_FUNC_INFO * > &[0] | mc_AtlFuncInfo
 | ) |  |

Member Data Documentation

template<class T>
IInkCollectorEventsImpl< T >::DIID__IInkCollectorEvents

Definition at line 110 of file EventSinks.h.

template<class T>
IInkCollectorEventsImpl< T >::DISPID_CEGesture

Definition at line 110 of file EventSinks.h.

template<class T>
IInkCollectorEventsImpl< T >::Gesture

Definition at line 110 of file EventSinks.h.

template<class T>
static const _ATL_FUNC_INFO IInkCollectorEventsImpl< T >::mc_AtlFuncInfo [static]

Definition at line 101 of file EventSinks.h.

template<class T>
IInkStrokeDisp * IInkCollectorEventsImpl< T >::pInkStroke

Definition at line 116 of file EventSinks.h.

The documentation for this class was generated from the following files:
  • TabletPC/AdvReco/EventSinks.h
  • TabletPC/MultiReco/EventSinks.h
Generated on Wed Nov 13 2024 16:57:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IInkRecognitionEventsImpl< T > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Static Public Attributes

IInkRecognitionEventsImpl< T > Class Template Reference

#include "EventSinks.h"

Inherits IDispEventSimpleImpl< SINK_ID, IInkRecognitionEventsImpl< T >,&DIID__IInkRecognitionEvents >, and IDispEventSimpleImpl< SINK_ID, IInkRecognitionEventsImpl< T >,&DIID__IInkRecognitionEvents >.

List of all members.

Public Member Functions

return pT | OnRecognitionWithAlternates (pIInkRecoResult, vCustomParam, RecognitionStatus)
SINK_ENTRY_INFO (SINK_ID, DIID__IInkRecognitionEvents, DISPID_RERecognition, Recognition, const_cast< _ATL_FUNC_INFO * >(&mc_AtlFuncInfo)) HRESULT __stdcall Recognition(BSTR bstrRecognizedString
SINK_ENTRY_INFO (SINK_ID, DIID__IInkRecognitionEvents, DISPID_RERecognitionWithAlternates, RecognitionWithAlternates, const_cast< _ATL_FUNC_INFO * >(&mc_AtlFuncInfo)) HRESULT __stdcall RecognitionWithAlternates(IInkRecognitionResult *pIInkRecoResult

Public Attributes

VARIANT InkRecognitionStatus
RecognitionStatus T * 		pT = static_cast<T*>(this)
VARIANT | vCustomParam

Static Public Attributes

static const _ATL_FUNC_INFO | mc_AtlFuncInfo

Detailed Description

template<class T>
class IInkRecognitionEventsImpl< T >

Definition at line 50 of file EventSinks.h.

Member Function Documentation

template<class T>
return pT IInkRecognitionEventsImpl< T >::OnRecognitionWithAlternates | ( | pIInkRecoResult | ,
 |  | vCustomParam | ,
 |  | RecognitionStatus |
 | ) |  |
template<class T>
IInkRecognitionEventsImpl< T >::SINK_ENTRY_INFO | ( | SINK_ID | ,
 |  | DIID__IInkRecognitionEvents | ,
 |  | DISPID_RERecognition | ,
 |  | Recognition | ,
 |  | const_cast< _ATL_FUNC_INFO * > & | mc_AtlFuncInfo
 | ) |  |
template<class T>
IInkRecognitionEventsImpl< T >::SINK_ENTRY_INFO | ( | SINK_ID | ,
 |  | DIID__IInkRecognitionEvents | ,
 |  | DISPID_RERecognitionWithAlternates | ,
 |  | RecognitionWithAlternates | ,
 |  | const_cast< _ATL_FUNC_INFO * > & | mc_AtlFuncInfo
 | ) |  |

Member Data Documentation

template<class T>
static const _ATL_FUNC_INFO IInkRecognitionEventsImpl< T >::mc_AtlFuncInfo [static]

Definition at line 57 of file EventSinks.h.

template<class T>
VARIANT InkRecognitionStatus RecognitionStatus T* IInkRecognitionEventsImpl< T >::pT = static_cast<T*>(this)

Definition at line 71 of file EventSinks.h.

template<class T>
VARIANT IInkRecognitionEventsImpl< T >::vCustomParam

Definition at line 68 of file EventSinks.h.

The documentation for this class was generated from the following files:
  • TabletPC/AdvReco/EventSinks.h
  • TabletPC/MultiReco/EventSinks.h
Generated on Wed Nov 13 2024 16:57:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IMMCControl Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

IMMCControl Interface Reference

import "atlcontrol.idl";

List of all members.

Public Member Functions

HRESULT | DoHelp ()
HRESULT | StartAnimation ()
HRESULT | StopAnimation ()

Detailed Description

Definition at line 18 of file atlcontrol.idl.

Member Function Documentation

HRESULT IMMCControl::DoHelp ( )
HRESULT IMMCControl::StartAnimation ( )
HRESULT IMMCControl::StopAnimation ( )
The documentation for this interface was generated from the following file:
  • SysMgmt/MMC/ActiveX/atl/atlcontrol.idl
Generated on Wed Nov 13 2024 16:57:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IMMCControlVtbl Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

IMMCControlVtbl Struct Reference

#include "atlcontrol.h"

List of all members.

Public Member Functions

BEGIN_INTERFACE | HRESULT (STDMETHODCALLTYPE __RPC_FAR *QueryInterface)(IMMCControl __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *DoHelp)(IMMCControl __RPC_FAR *This)
HRESULT (STDMETHODCALLTYPE __RPC_FAR *StopAnimation)(IMMCControl __RPC_FAR *This)
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount)(IMMCControl __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Invoke)(IMMCControl __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *StartAnimation)(IMMCControl __RPC_FAR *This)
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo)(IMMCControl __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames)(IMMCControl __RPC_FAR *This
ULONG (STDMETHODCALLTYPE __RPC_FAR *AddRef)(IMMCControl __RPC_FAR *This)
ULONG (STDMETHODCALLTYPE __RPC_FAR *Release)(IMMCControl __RPC_FAR *This)

Public Attributes

REFIID LPOLESTR __RPC_FAR UINT | cNames
DISPID | dispIdMember
UINT iTInfo
UINT LCID | lcid
REFIID LPOLESTR __RPC_FAR UINT LCID | lcid
DISPID REFIID LCID | lcid
UINT __RPC_FAR * | pctinfo
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR * 		pDispParams
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR EXCEPINFO __RPC_FAR * 		pExcepInfo
UINT LCID ITypeInfo __RPC_FAR
*__RPC_FAR * 		ppTInfo
BEGIN_INTERFACE REFIID void
__RPC_FAR *__RPC_FAR * 		ppvObject
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR EXCEPINFO __RPC_FAR
UINT __RPC_FAR * 		puArgErr
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR * 		pVarResult
REFIID LPOLESTR __RPC_FAR UINT
LCID DISPID __RPC_FAR * 		rgDispId
REFIID LPOLESTR __RPC_FAR * | rgszNames
REFIID | riid
DISPID REFIID | riid
BEGIN_INTERFACE REFIID | riid
DISPID REFIID LCID WORD | wFlags

Detailed Description

Definition at line 90 of file atlcontrol.h.

Member Function Documentation

BEGIN_INTERFACE IMMCControlVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * QueryInterface )
IMMCControlVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * DoHelp )
IMMCControlVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * StopAnimation )
IMMCControlVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetTypeInfoCount )
IMMCControlVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Invoke )
IMMCControlVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * StartAnimation )
IMMCControlVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetTypeInfo )
IMMCControlVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetIDsOfNames )
IMMCControlVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * AddRef )
IMMCControlVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * Release )

Member Data Documentation

REFIID LPOLESTR __RPC_FAR UINT IMMCControlVtbl::cNames

Definition at line 117 of file atlcontrol.h.

DISPID IMMCControlVtbl::dispIdMember

Definition at line 125 of file atlcontrol.h.

UINT IMMCControlVtbl::iTInfo

Definition at line 111 of file atlcontrol.h.

UINT LCID IMMCControlVtbl::lcid

Definition at line 111 of file atlcontrol.h.

REFIID LPOLESTR __RPC_FAR UINT LCID IMMCControlVtbl::lcid

Definition at line 117 of file atlcontrol.h.

DISPID REFIID LCID IMMCControlVtbl::lcid

Definition at line 125 of file atlcontrol.h.

UINT __RPC_FAR* IMMCControlVtbl::pctinfo

Definition at line 107 of file atlcontrol.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR* IMMCControlVtbl::pDispParams

Definition at line 125 of file atlcontrol.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR EXCEPINFO __RPC_FAR* IMMCControlVtbl::pExcepInfo

Definition at line 125 of file atlcontrol.h.

UINT LCID ITypeInfo __RPC_FAR* __RPC_FAR* IMMCControlVtbl::ppTInfo

Definition at line 111 of file atlcontrol.h.

BEGIN_INTERFACE REFIID void __RPC_FAR* __RPC_FAR* IMMCControlVtbl::ppvObject

Definition at line 96 of file atlcontrol.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR EXCEPINFO __RPC_FAR UINT __RPC_FAR* IMMCControlVtbl::puArgErr

Definition at line 125 of file atlcontrol.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR* IMMCControlVtbl::pVarResult

Definition at line 125 of file atlcontrol.h.

REFIID LPOLESTR __RPC_FAR UINT LCID DISPID __RPC_FAR* IMMCControlVtbl::rgDispId

Definition at line 117 of file atlcontrol.h.

REFIID LPOLESTR __RPC_FAR* IMMCControlVtbl::rgszNames

Definition at line 117 of file atlcontrol.h.

REFIID IMMCControlVtbl::riid

Definition at line 117 of file atlcontrol.h.

DISPID REFIID IMMCControlVtbl::riid

Definition at line 125 of file atlcontrol.h.

BEGIN_INTERFACE REFIID IMMCControlVtbl::riid

Definition at line 96 of file atlcontrol.h.

DISPID REFIID LCID WORD IMMCControlVtbl::wFlags

Definition at line 125 of file atlcontrol.h.

The documentation for this struct was generated from the following file:
  • SysMgmt/MMC/ActiveX/atl/atlcontrol.h
Generated on Wed Nov 13 2024 16:57:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IMoveMoney Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

IMoveMoney Interface Reference

import "BankVC.idl";

List of all members.

Public Member Functions

HRESULT Perform ([in]long lngAcnt1,[in] long lngAcnt2,[in]long lngAmount,[in]long lngType,[out, retval]BSTR *pVal)

Detailed Description

Definition at line 38 of file BankVC.idl.

Member Function Documentation

HRESULT IMoveMoney::Perform | ( | [in] long | lngAcnt1,
 |  | [in] long | lngAcnt2,
 |  | [in] long | lngAmount,
 |  | [in] long | lngType,
 |  | [out, retval] BSTR * | pVal
 | ) |  |
The documentation for this interface was generated from the following file:
  • Web/iis/Components/Cpp/MTXSample/BankVC.idl
Generated on Wed Nov 13 2024 16:57:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IMyPersistStreamImpl< T > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

IMyPersistStreamImpl< T > Class Template Reference

#include "IPersistStm.h"

List of all members.

Public Member Functions

STDMETHOD() | GetClassID (CLSID *pClassID)
STDMETHOD() | GetSizeMax (ULARGE_INTEGER FAR *pcbSize)
STDMETHOD() | IsDirty ()
STDMETHOD() | Load (LPSTREAM pStm)
STDMETHOD() | QueryInterface (REFIID riid, void **ppvObject)=0
STDMETHOD() | Save (LPSTREAM pStm, BOOL fClearDirty)

Detailed Description

template<class T>
class IMyPersistStreamImpl< T >

Definition at line 16 of file IPersistStm.h.

Member Function Documentation

template<class T>
STDMETHOD() IMyPersistStreamImpl< T >::GetClassID ( CLSID * pClassID ) [inline]

Definition at line 25 of file IPersistStm.h.

  {
    ATLTRACE(_T("IMyPersistStreamImpl::GetClassID\n"));
    T* pT = static_cast<T*>(this);
    *pClassID = pT->GetObjectCLSID();
    return S_OK;
  }

template<class T>
STDMETHOD() IMyPersistStreamImpl< T >::GetSizeMax ( ULARGE_INTEGER FAR * pcbSize ) [inline]

Definition at line 52 of file IPersistStm.h.

  {
    T* pT = static_cast<T*>(this);
    ATLTRACE(_T("IMyPersistStreamImpl::GetSizeMax\n"));
    return pT->IMyPersistStreamImpl_GetSizeMax(pcbSize);
  }

template<class T>
STDMETHOD() IMyPersistStreamImpl< T >::IsDirty ( void ) [inline]

Definition at line 34 of file IPersistStm.h.

  {
    ATLTRACE(_T("IMyPersistStreamImpl::IsDirty\n"));
    T* pT = static_cast<T*>(this);
    return (pT->m_bRequiresSave) ? S_OK : S_FALSE;
  }

template<class T>
STDMETHOD() IMyPersistStreamImpl< T >::Load ( LPSTREAM pStm ) [inline]

Definition at line 40 of file IPersistStm.h.

  {
    ATLTRACE(_T("IMyPersistStreamImpl::Load\n"));
    T* pT = static_cast<T*>(this);
    return pT->IMyPersistStreamImpl_Load(pStm);
  }

template<class T>
STDMETHOD() IMyPersistStreamImpl< T >::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppvObject |
 | ) |  |  | [pure virtual]
template<class T>
STDMETHOD() IMyPersistStreamImpl< T >::Save | ( | LPSTREAM | pStm,
 |  | BOOL | fClearDirty |
 | ) |  |  | [inline]

Definition at line 46 of file IPersistStm.h.

  {
    T* pT = static_cast<T*>(this);
    ATLTRACE(_T("IMyPersistStreamImpl::Save\n"));
    return pT->IMyPersistStreamImpl_Save(pStm, fClearDirty);
  }

The documentation for this class was generated from the following file:
  • NetDS/MessageQueuing/MQPers/GraphObj/IPersistStm.h
Generated on Wed Nov 13 2024 16:57:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: INDEXINFO Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

INDEXINFO Struct Reference

#include "table.h"

List of all members.

Public Attributes

DWORD dwCollation
DWORD dwFillFactor
DWORD dwInitialSize
DWORD dwNullCollation
DWORD dwNulls
VARIANT_BOOL | fAutoUpdate
VARIANT_BOOL | fClustered
BOOL fIsPrimaryKey
VARIANT_BOOL | fSortBookmarks
VARIANT_BOOL | fUnique
DWORD iOrdinal
WCHAR | wszColName [MAX_NAME_LEN]
WCHAR | wszIndexName [MAX_NAME_LEN]
DBTYPE | wType

Detailed Description

Definition at line 51 of file table.h.

Member Data Documentation

DWORD INDEXINFO::dwCollation

Definition at line 66 of file table.h.

DWORD INDEXINFO::dwFillFactor

Definition at line 58 of file table.h.

DWORD INDEXINFO::dwInitialSize

Definition at line 59 of file table.h.

DWORD INDEXINFO::dwNullCollation

Definition at line 63 of file table.h.

DWORD INDEXINFO::dwNulls

Definition at line 60 of file table.h.

VARIANT_BOOL INDEXINFO::fAutoUpdate

Definition at line 62 of file table.h.

VARIANT_BOOL INDEXINFO::fClustered

Definition at line 56 of file table.h.

BOOL INDEXINFO::fIsPrimaryKey

Definition at line 69 of file table.h.

VARIANT_BOOL INDEXINFO::fSortBookmarks

Definition at line 61 of file table.h.

VARIANT_BOOL INDEXINFO::fUnique

Definition at line 55 of file table.h.

DWORD INDEXINFO::iOrdinal

Definition at line 64 of file table.h.

WCHAR INDEXINFO::wszColName[MAX_NAME_LEN]

Definition at line 65 of file table.h.

WCHAR INDEXINFO::wszIndexName[MAX_NAME_LEN]

Definition at line 54 of file table.h.

DBTYPE INDEXINFO::wType

Definition at line 57 of file table.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/oledb/tablecopy/table.h
Generated on Wed Nov 13 2024 16:57:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: InitOle Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

InitOle Struct Reference

#include "QueueDef.h"

List of all members.

Public Member Functions

InitOle ()
~InitOle ()

Detailed Description

Definition at line 20 of file QueueDef.h.

Constructor & Destructor Documentation

InitOle::InitOle ( ) [inline]

Definition at line 21 of file QueueDef.h.

{ CoInitialize(NULL); }   // Initialize Component Object Model(COM) library

InitOle::~InitOle ( ) [inline]

Definition at line 22 of file QueueDef.h.

{ CoUninitialize(); } // Uninitialize Component Object Model(COM) library

The documentation for this struct was generated from the following file:
  • NetDS/MessageQueuing/MQPers/QueueDef.h
Generated on Wed Nov 13 2024 16:57:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: InkBlog::_Default Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • InkBlog
  • InkBlog::_Default
Protected Member Functions | Private Member Functions

InkBlog::_Default Class Reference

The Default code-behind page.

List of all members.

Protected Member Functions

override void | OnInit (EventArgs e)

Private Member Functions

void | InitializeComponent ()
void | Page_Load (object sender, System.EventArgs e)

Detailed Description

Definition at line 28 of file Default.aspx.cs.

Member Function Documentation

void InkBlog::_Default::InitializeComponent ( ) [inline, private]

Required method for Designer support - do not modify the contents of this method with the code editor.

Definition at line 76 of file Default.aspx.cs.

        {
            this.Load += new System.EventHandler(this.Page_Load);

        }

override void InkBlog::_Default::OnInit ( EventArgs e ) [inline, protected]

Definition at line 63 of file Default.aspx.cs.

        {
            //
            // CODEGEN: This call is required by the ASP.NET Web Form Designer.
            //
            InitializeComponent();
            base.OnInit(e);
        }

void InkBlog::_Default::Page_Load | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Handles the Load event for this Page.

Displays a web page with a list of all blog entries collected on the server. It also contains a button that allows the user to add more blog entries using AddBlog.aspx.

Parameters:
sender | The object that raised the event.
e | The event arguments.

Definition at line 40 of file Default.aspx.cs.

        {

            // Display a button that allows the user to add more blog entries
            Response.Write("<hr><a href=\"AddBlog.aspx\">Add Blog</a><br><hr>");

            string path = Server.MapPath("Blogs");
            DirectoryInfo dirInfo = new DirectoryInfo(path);

            // Output the content of each page in the server's blog directory.
            if (dirInfo.Exists)
            {
                foreach (FileInfo file in dirInfo.GetFiles("*.htm"))
                {
                    using (StreamReader sr = file.OpenText())
                    {
                        Response.Write(sr.ReadToEnd());
                    }
                }
            }
        }

The documentation for this class was generated from the following file:
  • TabletPC/InkBlog/C#/Default.aspx.cs
Generated on Wed Nov 13 2024 16:58:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: InkBlog::AddBlog Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • InkBlog
  • InkBlog::AddBlog
Protected Member Functions | Private Member Functions

InkBlog::AddBlog Class Reference

The AddBlog code-behind page.

List of all members.

Protected Member Functions

void | CreateGif (String path, String fileName, String inkBody)
void | CreateHtm (String path, String fileName, String blogTitle, String content)
override void | OnInit (EventArgs e)

Private Member Functions

void | InitializeComponent ()
void | Page_Load (object sender, System.EventArgs e)

Detailed Description

Definition at line 34 of file AddBlog.aspx.cs.

Member Function Documentation

void InkBlog::AddBlog::CreateGif | ( | String | path,
 |  | String | fileName,
 |  | String | inkBody |
 | ) |  |  | [inline, protected]

Helper method to create a GIF image file from the serialized ink data.

Note: since the ink data was serialized on the client side, the server does not need to have any specialized knowledge of ink.

Parameters:
path | The location where the image should be created
fileName | The filename of the image
inkData | The serialized ink data

Definition at line 114 of file AddBlog.aspx.cs.

        {
            String gifFilePath = Path.Combine(path, fileName + ".gif");
            using (FileStream fs = File.Create(gifFilePath))
            {
                byte[] bytes = Convert.FromBase64String(inkBody);
                fs.Write(bytes,0,bytes.Length);
            }
        }

void InkBlog::AddBlog::CreateHtm | ( | String | path,
 |  | String | fileName,
 |  | String | blogTitle,
 |  | String | content |
 | ) |  |  | [inline, protected]

Helper method to create a HTM file from the blog data.

Parameters:
fileName | The location where the HTM file should be created
blogName | The filename of the image
content | The HTML fragment that either references the ink image or text data

Definition at line 130 of file AddBlog.aspx.cs.

        {
            String htmFilePath = Path.Combine(path, fileName + ".htm");

            using (StreamWriter htmFile = File.CreateText(htmFilePath))
            {
                htmFile.Write("<h3 align=center>" + blogTitle + " (" +DateTime.Now.ToString() + ")</h3>");
                htmFile.Write(content);
            }
        }

void InkBlog::AddBlog::InitializeComponent ( ) [inline, private]

Required method for Designer support - do not modify the contents of this method with the code editor.

Definition at line 155 of file AddBlog.aspx.cs.

        {
            this.Load += new System.EventHandler(this.Page_Load);
        }

override void InkBlog::AddBlog::OnInit ( EventArgs e ) [inline, protected]

Definition at line 142 of file AddBlog.aspx.cs.

        {
            //
            // CODEGEN: This call is required by the ASP.NET Web Form Designer.
            //
            InitializeComponent();
            base.OnInit(e);
        }

void InkBlog::AddBlog::Page_Load | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Handles the Load event for this Page.

Retrieves the blog data posted to the server and uses it to create an HTML page that is viewable from Default.aspx. If the blog contains ink data, this page will consist of a GIF containing serialized ink data; otherwise, it will consist only of text.

Parameters:
sender | The object that raised the event.
e | The event arguments.

Definition at line 48 of file AddBlog.aspx.cs.

        {
            NameValueCollection form = Request.Form;

            if ( form.Keys.Count > 0 )
            {
                // Determine the location where blog web pages and images are
                // stored on the server
                string blogPath = Server.MapPath("Blogs/");
                string imagePath = Path.Combine(blogPath,"Images");

                // If this location does not yet exist, create it.
                DirectoryInfo dirInfo = new DirectoryInfo(imagePath);
                if (!dirInfo.Exists)
                {
                    dirInfo.Create();
                }

                // Specifies the name of the web page file to generate.
                //    In this case, we use a timestamp to uniquely identify each blog.
                string fileName = DateTime.Now.Ticks.ToString();

                // Extract the blog title and body data posted to the server
                String blogTitle = form.GetValues("BlogTitleText")[0];
                String inkBody  = form.GetValues("BlogBodyInkData")[0];
                String textBody = form.GetValues("BlogBodyText")[0];

                // Html fragment to be inserted into the blog's web page.
                string content = null;

                // Check if ink data is available.  If so create a corresponding GIF
                // from the serialized ink data and an HTML fragment referencing it.
                // Otherwise, create an HTML fragment with text from the blog.
                if ( ( String.Empty != inkBody ) )
                {
                    // Use helper method to create a GIF image file from ink data
                    CreateGif(imagePath, fileName, inkBody);

                    // Create an HTML fragment to reference the image file
                    content = "<img src=\"Blogs/Images/" + fileName + ".gif\"></img>";
                }
                else
                {
                    // If no ink data is available create an HTML fragment that contains
                    // the blog's text directly.
                    content = "<P>" + textBody + "</P>";
                }

                // Use helper method to create the blog web page on the server
                CreateHtm(blogPath, fileName, blogTitle, content);

                // Redirect the user to Default.aspx, which displays a list of all
                // available blogs.
                Response.Clear();
                Response.Redirect("Default.aspx");
            }
        }

The documentation for this class was generated from the following file:
  • TabletPC/InkBlog/C#/AddBlog.aspx.cs
Generated on Wed Nov 13 2024 16:58:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: InkBlog::InkArea Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • InkBlog
  • InkBlog::InkArea
Public Member Functions | Protected Member Functions | Properties | Private Member Functions | Private Attributes

InkBlog::InkArea Class Reference

The InkArea Sample Control class. More...

List of all members.

Public Member Functions

InkArea ()
void | DisposeResources ()

Protected Member Functions

Control | CreateInkCollectionSurface ()
override void | Dispose (bool disposing)
override void | OnResize (EventArgs e)
String | RecognizeInkData ()
String | SerializeInkData ()

Properties

string | InkData [get]
bool | InkEnabled [get]
string | TextData [get]

Private Member Functions

void | InitializeComponent ()

Private Attributes

System.ComponentModel.Container | components = null
object | inkCollector = null
Control | inputArea = null

Detailed Description

Definition at line 39 of file InkArea.cs.

Constructor & Destructor Documentation

InkBlog::InkArea::InkArea ( ) [inline]

Definition at line 56 of file InkArea.cs.

        {
            #region Standard Template Code
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();
            #endregion

            // Attempt to create an InkCollector and attach it to
            // a Panel control.  If successful, this client can
            // support inking within a web page.  Otherwise, use a
            // Textbox for collecting blog input.
            try
            {
                inputArea = CreateInkCollectionSurface();
            }
            catch (FileNotFoundException)
            {
                inputArea = new TextBox();
                ((TextBox)inputArea).Multiline = true;
            }

            inputArea.Size = this.Size;

            // Add the control used for collecting blog input
            this.Controls.Add(inputArea);

        }

Member Function Documentation

Control InkBlog::InkArea::CreateInkCollectionSurface ( ) [inline, protected]

Attempts to create an InkCollector and attach it to a Panel control.

If unable to create the InkCollector, an exception is thrown.

Returns:
Control to be used for this inking area

Definition at line 198 of file InkArea.cs.

        {
            try
            {
                Panel inkPanel = new Panel();
                inkPanel.BorderStyle = BorderStyle.Fixed3D;
                inkCollector = new InkCollector(inkPanel);
                ((InkCollector)inkCollector).Enabled = true;
                return inkPanel;
            }
            catch
            {
                throw;
            }
        }

override void InkBlog::InkArea::Dispose ( bool disposing ) [inline, protected]

Clean up any resources being used.

Definition at line 88 of file InkArea.cs.

        {
            if( disposing )
            {
                if(components != null)
                {
                    components.Dispose();
                }
            }
            base.Dispose( disposing );
        }

void InkBlog::InkArea::DisposeResources ( ) [inline]

Disposes of the internal child control used for collecting ink.

Definition at line 181 of file InkArea.cs.

        {
            if (InkEnabled)
            {
                ((InkCollector)inkCollector).Dispose();
            }
        }

void InkBlog::InkArea::InitializeComponent ( ) [inline, private]

Required method for Designer support - do not modify the contents of this method with the code editor.

Definition at line 106 of file InkArea.cs.

        {
            this.SuspendLayout();
            this.Name = "InkArea";
            this.ResumeLayout(false);
        }

override void InkBlog::InkArea::OnResize ( EventArgs e ) [inline, protected]

Event hander from this control's Resize event Updates the child control to have the same size.

Parameters:
e

Definition at line 119 of file InkArea.cs.

        {
            if (null != inputArea)
            {
                inputArea.Size = this.Size;
            }
        }

String InkBlog::InkArea::RecognizeInkData ( ) [inline, protected]

Recognize ink data using the default recognizer.

Returns:
The string containing the top recognition result.

Definition at line 240 of file InkArea.cs.

        {
            Debug.Assert(InkEnabled, null, "Client must be ink-enabled");

            // Obtain the ink associated with this control
            Ink ink = ((InkCollector)inkCollector).Ink;

            if (ink.Strokes.Count > 0)
            {

                // Attempt to create a recognition context and use it to
                // retrieve the top alternate.
                try
                {
                    RecognizerContext recognizerContext = new RecognizerContext();
                    RecognitionStatus recognitionStatus;
                    recognizerContext.Strokes = ink.Strokes;
                    RecognitionResult recognitionResult = recognizerContext.Recognize(out recognitionStatus);
                    if ( ( recognitionStatus == RecognitionStatus.NoError ) &&
                         ( null != recognitionResult) )
                    {
                        return recognitionResult.TopString;
                    }
                }
                catch (Exception)
                {
                    // An exception will occur if the client does not have
                    // any handwriting recognizers installed on their system.
                    // In this case, we default to returning an empty string.
                }
            }

            return String.Empty;
        }

String InkBlog::InkArea::SerializeInkData ( ) [inline, protected]

Serializes the ink data as GIF using a Base 64 string.

Returns:
Ink data as a GIF using a Base 64 string

Definition at line 218 of file InkArea.cs.

        {
            Debug.Assert(InkEnabled, null, "Client must be ink-enabled");

            // Obtain the ink associated with this control
            Ink ink = ((InkCollector)inkCollector).Ink;

            // Serialize the ink
            if (ink.Strokes.Count > 0)
            {
                byte[] inkDataBytes = ink.Save(PersistenceFormat.Gif);
                return Convert.ToBase64String(inkDataBytes);
            }

            // Default to returning the empty string.
            return String.Empty;
        }

Member Data Documentation

System.ComponentModel.Container InkBlog::InkArea::components = null [private]

Required designer variable.

Definition at line 53 of file InkArea.cs.

object InkBlog::InkArea::inkCollector = null [private]

Definition at line 47 of file InkArea.cs.

Control InkBlog::InkArea::inputArea = null [private]

Definition at line 43 of file InkArea.cs.

Property Documentation

string InkBlog::InkArea::InkData [get]

If inking is supported, returns the serialized ink data.

Otherwise, returns an empty string.

Definition at line 145 of file InkArea.cs.

bool InkBlog::InkArea::InkEnabled [get]

Indicates whether inking is supported on the client machine.

Returns:
Returns true if inking is supported and false otherwise.

Definition at line 133 of file InkArea.cs.

string InkBlog::InkArea::TextData [get]

If inking is supported, returns the recognized ink.

Otherwise, returns the contents of the text box.

Definition at line 164 of file InkArea.cs.

The documentation for this class was generated from the following file:
  • TabletPC/InkBlog/C#/InkArea.cs
Generated on Wed Nov 13 2024 16:58:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: InkClipboard::InkClipboard Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • InkClipboard
  • InkClipboard::InkClipboard
Public Member Functions | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes

InkClipboard::InkClipboard Class Reference

The InkClipboard with Selection Sample Application form class. More...

List of all members.

Public Member Functions

InkClipboard ()
void | DrawLasso (Graphics g, int newPacketIndex)
bool | HasSelection ()
void | SetLocation (PictureBox pb, int xCenter, int yCenter)

Protected Member Functions

override void | Dispose (bool disposing)

Private Member Functions

void | CopyInkToClipboard (InkClipboardModes clipboardModes)
void | DrawLassoConnector (int start, int end)
void | DrawSelectionInkDot (Graphics g, int x, int y)
void | DrawStrokes (Graphics g)
void | InitializeComponent ()
void | InkClipboard_Load (object sender, System.EventArgs e)
void | InkClipboard_MouseDown (object sender, System.Windows.Forms.MouseEventArgs e)
void | InkClipboard_MouseMove (object sender, System.Windows.Forms.MouseEventArgs e)
void | InkClipboard_MouseUp (object sender, System.Windows.Forms.MouseEventArgs e)
void | InkClipboard_Paint (object sender, System.Windows.Forms.PaintEventArgs e)
void | InkSpaceToPixel (Graphics g, ref Rectangle r)
void | miBlack_Click (object sender, System.EventArgs e)
void | miBlue_Click (object sender, System.EventArgs e)
void | miBMP_Click (object sender, System.EventArgs e)
void | miClear_Click (object sender, System.EventArgs e)
void | miCopy_Click (object sender, System.EventArgs e)
void | miCut_Click (object sender, System.EventArgs e)
void | miEMF_Click (object sender, System.EventArgs e)
void | miExit_Click (object sender, System.EventArgs e)
void | miGreen_Click (object sender, System.EventArgs e)
void | miInk_Click (object sender, System.EventArgs e)
void | miISF_Click (object sender, System.EventArgs e)
void | miLassoSelect_Click (object sender, System.EventArgs e)
void | miMainEdit_Popup (object sender, System.EventArgs e)
void | miMedium_Click (object sender, System.EventArgs e)
void | miMetafile_Click (object sender, System.EventArgs e)
void | miNoOLE_Click (object sender, System.EventArgs e)
void | miPaste_Click (object sender, System.EventArgs e)
void | miRed_Click (object sender, System.EventArgs e)
void | miSInk_Click (object sender, System.EventArgs e)
void | miThick_Click (object sender, System.EventArgs e)
void | miThin_Click (object sender, System.EventArgs e)
void | miTInk_Click (object sender, System.EventArgs e)
void | myInkCollector_NewPackets (object sender, InkCollectorNewPacketsEventArgs e)
void | myInkCollector_Stroke (object sender, InkCollectorStrokeEventArgs e)
void | PixelToInkSpace (Graphics g, ref Rectangle r)
void | SetColor (Color newColor)
void | SetSelection (Strokes strokes)
void | SetWidth (float newWidth)

Static Private Member Functions

static void | Main ()

Private Attributes

ApplicationMode | applicationMode = ApplicationMode.Ink
System.Windows.Forms.PictureBox | centerBottomHandle
System.Windows.Forms.PictureBox | centerTopHandle
System.ComponentModel.Container | components = null
Color | connectorColor = Color.Black
Pen | connectorPen = null
Color | dotColor = SystemColors.Highlight
Color | dotEdgeColor = Color.White
Pen | dotEdgePen = null
Pen | dotPen = null
const int | DotSize = 6
const int | DotSpacing = 7
const float | LassoPercent = 50
ArrayList | lassoPoints = null
Point | lastDrawnLassoDot = Point.Empty
System.Windows.Forms.PictureBox | leftBottomHandle
System.Windows.Forms.PictureBox | leftCenterHandle
System.Windows.Forms.PictureBox | leftTopHandle
System.Windows.Forms.MainMenu | mainMenu
const float | MediumInkWidth = 100
System.Windows.Forms.MenuItem | miBlack
System.Windows.Forms.MenuItem | miBlue
System.Windows.Forms.MenuItem | miBMP
System.Windows.Forms.MenuItem | miClear
System.Windows.Forms.MenuItem | miColor
System.Windows.Forms.MenuItem | miCopy
System.Windows.Forms.MenuItem | miCut
System.Windows.Forms.MenuItem | miEditSeparator
System.Windows.Forms.MenuItem | miEMF
System.Windows.Forms.MenuItem | miExit
System.Windows.Forms.MenuItem | miFormatSeparator
System.Windows.Forms.MenuItem | miGreen
System.Windows.Forms.MenuItem | miInk
System.Windows.Forms.MenuItem | miInkSeparator
System.Windows.Forms.MenuItem | miISF
System.Windows.Forms.MenuItem | miLassoSelect
System.Windows.Forms.MenuItem | miMainAction
System.Windows.Forms.MenuItem | miMainEdit
System.Windows.Forms.MenuItem | miMainFormat
System.Windows.Forms.MenuItem | miMedium
System.Windows.Forms.MenuItem | miMetafile
System.Windows.Forms.MenuItem | miNoOLE
System.Windows.Forms.MenuItem | miPaste
System.Windows.Forms.MenuItem | miRed
System.Windows.Forms.MenuItem | miSInk
System.Windows.Forms.MenuItem | miStyle
System.Windows.Forms.MenuItem | miThick
System.Windows.Forms.MenuItem | miThin
System.Windows.Forms.MenuItem | miTInk
System.Windows.Forms.MenuItem | miWidth
InkCollector | myInkCollector = null
System.Windows.Forms.PictureBox | rightBottomHandle
System.Windows.Forms.PictureBox | rightCenterHandle
System.Windows.Forms.PictureBox | rightTopHandle
const int | SelectedInkWidthIncrease = 105
Strokes | selectedStrokes = null
PictureBox[] | selectionHandles
Rectangle | selectionRect = Rectangle.Empty
const int | SelectionRectBuffer = 8
Point | startMoveLocation = Point.Empty
const float | ThickInkWidth = 200
const float | ThinInkWidth = 10
const int | XPacketIndex = 0
const int | YPacketIndex = 1

Detailed Description

Definition at line 78 of file InkClipboard.cs.

Constructor & Destructor Documentation

InkClipboard::InkClipboard::InkClipboard ( ) [inline]

Definition at line 197 of file InkClipboard.cs.

        {
            #region Standard Template Code
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            #endregion
        }

Member Function Documentation

void InkClipboard::InkClipboard::CopyInkToClipboard ( InkClipboardModes clipboardModes ) [inline, private]

This method uses the Ink API to copy ink onto the clipboard.

Parameters:
clipboardModes The clipboard modes (such as copy or paste)

Definition at line 1315 of file InkClipboard.cs.

        {

            // Declare the ink clipboard formats to put on the clipboard
            InkClipboardFormats formats = new InkClipboardFormats();

            // Use selected format menu items to set the clipboard formats
            if (miISF.Checked)
            {
                formats |= InkClipboardFormats.InkSerializedFormat;
            }
            if (miMetafile.Checked)
            {
                formats |= InkClipboardFormats.Metafile;
            }
            if (miEMF.Checked)
            {
                formats |= InkClipboardFormats.EnhancedMetafile;
            }
            if (miBMP.Checked)
            {
                formats |= InkClipboardFormats.Bitmap;
            }
            if (miSInk.Checked)
            {
                formats |= InkClipboardFormats.SketchInk;
            }
            if (miTInk.Checked)
            {
                formats |= InkClipboardFormats.TextInk;
            }

            // If at least one format was selected, invoke the Ink
            // API's ClipboardCopy method.  Note that selectedStrokes
            // could be null, but that this is ok - if selectedStrokes
            // is null, all of the ink is copied.
            if (formats != InkClipboardFormats.None)
            {
                myInkCollector.Ink.ClipboardCopy(selectedStrokes,formats,clipboardModes);
            }
            else
            {
                MessageBox.Show("No clipboard formats selected");
            }
        }

override void InkClipboard::InkClipboard::Dispose ( bool disposing ) [inline, protected]

Clean up any resources being used.

Definition at line 211 of file InkClipboard.cs.

        {
            if( disposing )
            {
                if (components != null)
                {
                    components.Dispose();
                }
            }
            base.Dispose( disposing );
        }

void InkClipboard::InkClipboard::DrawLasso | ( | Graphics | g,
 |  | int | newPacketIndex |
 | ) |  |  | [inline]

Draws the selection lasso.

Note that this method does NOT draw a point for every piece of packet data. Instead, it draws evenly spaced dots that fall along the lasso path.

Parameters:
g | The graphics device
newPacketIndex | The index where the new packets begin

Definition at line 1472 of file InkClipboard.cs.

        {

            // The distance between the current point and the next point
            int     dx, dy;

            // The distance and angle of the line connecting the current
            // point and the next point
            double  lineLength;
            double  angle;

            // The horizontal and vertical spacing between the dots
            double  segSpaceX, segSpaceY;

            // The total number of dots to draw
            int     totalSegments;

            // Undraw the line that connected the first point to the
            // last point before the latest packets were added.
            DrawLassoConnector(0,newPacketIndex-1);

            // For each lasso point, draw the corresponding lasso dots.
            // Note that this method does NOT draw a point for every piece
            // of packet data.  Instead, it draws evenly spaced dots that
            // fall along the lasso path.
            for (int i = newPacketIndex; i < lassoPoints.Count; i++)
            {
                //  Always draw the first packet...
                if (0 == i)
                {
                    // Update the last drawn lasso dot to this packet
                    lastDrawnLassoDot.X = ((Point)lassoPoints[i]).X;
                    lastDrawnLassoDot.Y = ((Point)lassoPoints[i]).Y;

                    // use a helper method to draw the lasso dot
                    DrawSelectionInkDot(g, lastDrawnLassoDot.X, lastDrawnLassoDot.Y);
                }
                else
                {
                    // Compute the x and y distance between this point and the last drawn
                    // lasso dot
                    dx = ((Point)lassoPoints[i]).X - lastDrawnLassoDot.X;
                    dy = ((Point)lassoPoints[i]).Y - lastDrawnLassoDot.Y;

                    // Compute length of the line between this point and the last drawn
                    // lasso dot
                    lineLength = Math.Sqrt(dx*dx + dy*dy);

                    // If the spacing between this packet and the last drawn lasso
                    // dot is greater than the desired DotSpacing, draw as many
                    // evently spaced lasso points as needed to fill the distance...
                    if (DotSpacing <= lineLength)
                    {

                        // Calculate the angle of the line connecting this point
                        // to the last drawn lasso point.
                        angle = Math.Atan2(dy, dx);

                        // Calculate the x and y components of the dot spacing
                        segSpaceX = DotSpacing * Math.Cos(angle);
                        segSpaceY = DotSpacing * Math.Sin(angle);

                        // Calculate the number of dots we will need to draw.
                        totalSegments = (int)(lineLength/ (double)DotSpacing);

                        // draw the lasso dots...
                        for (int j = 0; j < totalSegments; j++)
                        {
                            // The coordinates of the lasso dot are determined by the
                            // previous lasso dot plus the x and y components of the
                            // dot spacing (computed above).
                            lastDrawnLassoDot.X = (int)(lastDrawnLassoDot.X + segSpaceX);
                            lastDrawnLassoDot.Y = (int)(lastDrawnLassoDot.Y + segSpaceY);

                            // use a helper method to draw the lasso dot
                            DrawSelectionInkDot(g, lastDrawnLassoDot.X, lastDrawnLassoDot.Y);

                        }
                    }
                }
            }

            // draw the line connecting the first point to the last point
            DrawLassoConnector(0,lassoPoints.Count-1);
        }

void InkClipboard::InkClipboard::DrawLassoConnector | ( | int | start,
 |  | int | end |
 | ) |  |  | [inline, private]

Helper method to draw/undraw the lasso connector line.

Parameters:
start | The index of the start point
end | The index of the end point
points | The lasso points

Definition at line 1564 of file InkClipboard.cs.

        {
            if ((end > start) && (lassoPoints.Count>1) && (end < lassoPoints.Count))
            {
                // Draw a reversible line from the point at start
                // to the point at end.
                Point startPoint = (Point)lassoPoints[start];
                Point endPoint = (Point)lassoPoints[end];

                // Convert to screen space
                startPoint = PointToScreen(startPoint);
                endPoint = PointToScreen(endPoint);

                // Reverse the line - this is the .NET way of drawing
                // an XOR line.
                ControlPaint.DrawReversibleLine(startPoint,endPoint,BackColor);
            }
        }

void InkClipboard::InkClipboard::DrawSelectionInkDot | ( | Graphics | g,
 |  | int | x,
 |  | int | y |
 | ) |  |  | [inline, private]

Helper method to draw a lasso seletion dot.

Parameters:
g | The graphics device
x | The x coordinate of the center of the dot
y | The y coordinate of the center of the dot

Definition at line 1589 of file InkClipboard.cs.

        {
            //
            // Offset the x and y by 1/2 the dot size (biasing lower-right)
            //
            x = x-(DotSize/2);
            y = y-(DotSize/2);

            // Draw the inside of the lasso dot
            g.FillEllipse(dotPen.Brush,x,y,DotSize,DotSize);

            // Draw the outside edge of the lasso dot
            g.DrawEllipse(dotEdgePen, x,y, DotSize, DotSize);

        }

void InkClipboard::InkClipboard::DrawStrokes ( Graphics g ) [inline, private]

This method is used to render ink when there is a selection.

Parameters:
g The graphics device

Definition at line 1610 of file InkClipboard.cs.

        {

            // First, draw the strokes that are not part of the
            // selection.  These strokes will appear the same
            // as the InkCollector would normally draw them.
            Strokes unselectedStrokes = myInkCollector.Ink.Strokes;
            unselectedStrokes.Remove(selectedStrokes);
            myInkCollector.Renderer.Draw(g, unselectedStrokes);

            // Next, draw each selected stroke.  A selected stroke
            // is rendered in white with a selection border.
            foreach (Stroke selectedStroke in selectedStrokes)
            {
                DrawingAttributes da = selectedStroke.DrawingAttributes.Clone();
                da.Color = SystemColors.WindowText;
                da.Width = da.Width+SelectedInkWidthIncrease;
                myInkCollector.Renderer.Draw(g, selectedStroke, da);
                da.Color = Color.White;
                da.Width = da.Width-SelectedInkWidthIncrease;
                myInkCollector.Renderer.Draw(g, selectedStroke, da);
            }
        }

bool InkClipboard::InkClipboard::HasSelection ( ) [inline]

Helper method to determine if there is a selection.

Returns:
True if there is a selection

Definition at line 1458 of file InkClipboard.cs.

        {
            return selectedStrokes!=null && selectedStrokes.Count > 0;
        }

void InkClipboard::InkClipboard::InitializeComponent ( ) [inline, private]

Required method for Designer support - do not modify the contents of this method with the code editor.

Definition at line 229 of file InkClipboard.cs.

        {
            System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(InkClipboard));
            this.mainMenu = new System.Windows.Forms.MainMenu();
            this.miMainAction = new System.Windows.Forms.MenuItem();
            this.miClear = new System.Windows.Forms.MenuItem();
            this.miInkSeparator = new System.Windows.Forms.MenuItem();
            this.miExit = new System.Windows.Forms.MenuItem();
            this.miMainEdit = new System.Windows.Forms.MenuItem();
            this.miCut = new System.Windows.Forms.MenuItem();
            this.miCopy = new System.Windows.Forms.MenuItem();
            this.miPaste = new System.Windows.Forms.MenuItem();
            this.miEditSeparator = new System.Windows.Forms.MenuItem();
            this.miLassoSelect = new System.Windows.Forms.MenuItem();
            this.miInk = new System.Windows.Forms.MenuItem();
            this.miMainFormat = new System.Windows.Forms.MenuItem();
            this.miISF = new System.Windows.Forms.MenuItem();
            this.miMetafile = new System.Windows.Forms.MenuItem();
            this.miEMF = new System.Windows.Forms.MenuItem();
            this.miBMP = new System.Windows.Forms.MenuItem();
            this.miFormatSeparator = new System.Windows.Forms.MenuItem();
            this.miSInk = new System.Windows.Forms.MenuItem();
            this.miTInk = new System.Windows.Forms.MenuItem();
            this.miNoOLE = new System.Windows.Forms.MenuItem();
            this.miStyle = new System.Windows.Forms.MenuItem();
            this.miWidth = new System.Windows.Forms.MenuItem();
            this.miThin = new System.Windows.Forms.MenuItem();
            this.miMedium = new System.Windows.Forms.MenuItem();
            this.miThick = new System.Windows.Forms.MenuItem();
            this.miColor = new System.Windows.Forms.MenuItem();
            this.miRed = new System.Windows.Forms.MenuItem();
            this.miGreen = new System.Windows.Forms.MenuItem();
            this.miBlue = new System.Windows.Forms.MenuItem();
            this.miBlack = new System.Windows.Forms.MenuItem();
            this.rightBottomHandle = new System.Windows.Forms.PictureBox();
            this.centerBottomHandle = new System.Windows.Forms.PictureBox();
            this.leftBottomHandle = new System.Windows.Forms.PictureBox();
            this.rightCenterHandle = new System.Windows.Forms.PictureBox();
            this.leftCenterHandle = new System.Windows.Forms.PictureBox();
            this.rightTopHandle = new System.Windows.Forms.PictureBox();
            this.centerTopHandle = new System.Windows.Forms.PictureBox();
            this.leftTopHandle = new System.Windows.Forms.PictureBox();
            this.SuspendLayout();
            //
            // mainMenu
            //
            this.mainMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                                this.miMainAction,
                                                                                this.miMainEdit,
                                                                                this.miMainFormat,
                                                                                this.miStyle});
            //
            // miMainAction
            //
            this.miMainAction.Index = 0;
            this.miMainAction.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                                this.miClear,
                                                                                this.miInkSeparator,
                                                                                this.miExit});
            this.miMainAction.Text = "&Action";
            //
            // miClear
            //
            this.miClear.Index = 0;
            this.miClear.Text = "&Clear";
            this.miClear.Click += new System.EventHandler(this.miClear_Click);
            //
            // miInkSeparator
            //
            this.miInkSeparator.Index = 1;
            this.miInkSeparator.Text = "-";
            //
            // miExit
            //
            this.miExit.Index = 2;
            this.miExit.Text = "&Exit";
            this.miExit.Click += new System.EventHandler(this.miExit_Click);
            //
            // miMainEdit
            //
            this.miMainEdit.Index = 1;
            this.miMainEdit.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                                this.miCut,
                                                                                this.miCopy,
                                                                                this.miPaste,
                                                                                this.miEditSeparator,
                                                                                this.miLassoSelect,
                                                                                this.miInk});
            this.miMainEdit.Text = "&Edit";
            this.miMainEdit.Popup += new System.EventHandler(this.miMainEdit_Popup);
            //
            // miCut
            //
            this.miCut.Index = 0;
            this.miCut.Shortcut = System.Windows.Forms.Shortcut.CtrlX;
            this.miCut.Text = "Cu&t";
            this.miCut.Click += new System.EventHandler(this.miCut_Click);
            //
            // miCopy
            //
            this.miCopy.Index = 1;
            this.miCopy.Shortcut = System.Windows.Forms.Shortcut.CtrlC;
            this.miCopy.Text = "&Copy";
            this.miCopy.Click += new System.EventHandler(this.miCopy_Click);
            //
            // miPaste
            //
            this.miPaste.Index = 2;
            this.miPaste.Shortcut = System.Windows.Forms.Shortcut.CtrlV;
            this.miPaste.Text = "&Paste";
            this.miPaste.Click += new System.EventHandler(this.miPaste_Click);
            //
            // miEditSeparator
            //
            this.miEditSeparator.Index = 3;
            this.miEditSeparator.Text = "-";
            //
            // miLassoSelect
            //
            this.miLassoSelect.Index = 4;
            this.miLassoSelect.RadioCheck = true;
            this.miLassoSelect.Text = "&Select";
            this.miLassoSelect.Click += new System.EventHandler(this.miLassoSelect_Click);
            //
            // miInk
            //
            this.miInk.Checked = true;
            this.miInk.Index = 5;
            this.miInk.RadioCheck = true;
            this.miInk.Text = "&Ink";
            this.miInk.Click += new System.EventHandler(this.miInk_Click);
            //
            // miMainFormat
            //
            this.miMainFormat.Index = 2;
            this.miMainFormat.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                                this.miISF,
                                                                                this.miMetafile,
                                                                                this.miEMF,
                                                                                this.miBMP,
                                                                                this.miFormatSeparator,
                                                                                this.miSInk,
                                                                                this.miTInk,
                                                                                this.miNoOLE});
            this.miMainFormat.Text = "&Format";
            //
            // miISF
            //
            this.miISF.Checked = true;
            this.miISF.Index = 0;
            this.miISF.Text = "&Ink Serialized Format (ISF)";
            this.miISF.Click += new System.EventHandler(this.miISF_Click);
            //
            // miMetafile
            //
            this.miMetafile.Checked = true;
            this.miMetafile.Index = 1;
            this.miMetafile.Text = "&Metafile";
            this.miMetafile.Click += new System.EventHandler(this.miMetafile_Click);
            //
            // miEMF
            //
            this.miEMF.Checked = true;
            this.miEMF.Index = 2;
            this.miEMF.Text = "&Enhanced Metafile";
            this.miEMF.Click += new System.EventHandler(this.miEMF_Click);
            //
            // miBMP
            //
            this.miBMP.Checked = true;
            this.miBMP.Index = 3;
            this.miBMP.Text = "&Bitmap";
            this.miBMP.Click += new System.EventHandler(this.miBMP_Click);
            //
            // miFormatSeparator
            //
            this.miFormatSeparator.Index = 4;
            this.miFormatSeparator.Text = "-";
            //
            // miSInk
            //
            this.miSInk.Index = 5;
            this.miSInk.RadioCheck = true;
            this.miSInk.Text = "&Sketch Ink";
            this.miSInk.Click += new System.EventHandler(this.miSInk_Click);
            //
            // miTInk
            //
            this.miTInk.Checked = true;
            this.miTInk.Index = 6;
            this.miTInk.RadioCheck = true;
            this.miTInk.Text = "&Text Ink";
            this.miTInk.Click += new System.EventHandler(this.miTInk_Click);
            //
            // miNoOLE
            //
            this.miNoOLE.Index = 7;
            this.miNoOLE.RadioCheck = true;
            this.miNoOLE.Text = "&No OLE Object Format";
            this.miNoOLE.Click += new System.EventHandler(this.miNoOLE_Click);
            //
            // miStyle
            //
            this.miStyle.Index = 3;
            this.miStyle.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                                this.miWidth,
                                                                                this.miColor});
            this.miStyle.Text = "&Style";
            //
            // miWidth
            //
            this.miWidth.Index = 0;
            this.miWidth.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                                this.miThin,
                                                                                this.miMedium,
                                                                                this.miThick});
            this.miWidth.Text = "&Width";
            //
            // miThin
            //
            this.miThin.Index = 0;
            this.miThin.Text = "Thin";
            this.miThin.Click += new System.EventHandler(this.miThin_Click);
            //
            // miMedium
            //
            this.miMedium.Index = 1;
            this.miMedium.Text = "Medium";
            this.miMedium.Click += new System.EventHandler(this.miMedium_Click);
            //
            // miThick
            //
            this.miThick.Index = 2;
            this.miThick.Text = "Thick";
            this.miThick.Click += new System.EventHandler(this.miThick_Click);
            //
            // miColor
            //
            this.miColor.Index = 1;
            this.miColor.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                                this.miRed,
                                                                                this.miGreen,
                                                                                this.miBlue,
                                                                                this.miBlack});
            this.miColor.Text = "&Color";
            //
            // miRed
            //
            this.miRed.Index = 0;
            this.miRed.Text = "Red";
            this.miRed.Click += new System.EventHandler(this.miRed_Click);
            //
            // miGreen
            //
            this.miGreen.Index = 1;
            this.miGreen.Text = "Green";
            this.miGreen.Click += new System.EventHandler(this.miGreen_Click);
            //
            // miBlue
            //
            this.miBlue.Index = 2;
            this.miBlue.Text = "Blue";
            this.miBlue.Click += new System.EventHandler(this.miBlue_Click);
            //
            // miBlack
            //
            this.miBlack.Index = 3;
            this.miBlack.Text = "Black";
            this.miBlack.Click += new System.EventHandler(this.miBlack_Click);
            //
            // rightBottomHandle
            //
            this.rightBottomHandle.BackColor = System.Drawing.Color.Gray;
            this.rightBottomHandle.Cursor = System.Windows.Forms.Cursors.Default;
            this.rightBottomHandle.Image = ((System.Drawing.Bitmap)(resources.GetObject("rightBottomHandle.Image")));
            this.rightBottomHandle.Location = new System.Drawing.Point(281, 256);
            this.rightBottomHandle.Name = "rightBottomHandle";
            this.rightBottomHandle.Size = new System.Drawing.Size(11, 11);
            this.rightBottomHandle.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
            this.rightBottomHandle.TabIndex = 20;
            this.rightBottomHandle.TabStop = false;
            this.rightBottomHandle.Visible = false;
            //
            // centerBottomHandle
            //
            this.centerBottomHandle.Cursor = System.Windows.Forms.Cursors.Default;
            this.centerBottomHandle.Image = ((System.Drawing.Bitmap)(resources.GetObject("centerBottomHandle.Image")));
            this.centerBottomHandle.Location = new System.Drawing.Point(137, 256);
            this.centerBottomHandle.Name = "centerBottomHandle";
            this.centerBottomHandle.Size = new System.Drawing.Size(9, 9);
            this.centerBottomHandle.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
            this.centerBottomHandle.TabIndex = 19;
            this.centerBottomHandle.TabStop = false;
            this.centerBottomHandle.Visible = false;
            //
            // leftBottomHandle
            //
            this.leftBottomHandle.BackColor = System.Drawing.Color.Gray;
            this.leftBottomHandle.Cursor = System.Windows.Forms.Cursors.Default;
            this.leftBottomHandle.Image = ((System.Drawing.Bitmap)(resources.GetObject("leftBottomHandle.Image")));
            this.leftBottomHandle.Location = new System.Drawing.Point(1, 256);
            this.leftBottomHandle.Name = "leftBottomHandle";
            this.leftBottomHandle.Size = new System.Drawing.Size(11, 11);
            this.leftBottomHandle.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
            this.leftBottomHandle.TabIndex = 18;
            this.leftBottomHandle.TabStop = false;
            this.leftBottomHandle.Visible = false;
            //
            // rightCenterHandle
            //
            this.rightCenterHandle.Cursor = System.Windows.Forms.Cursors.Default;
            this.rightCenterHandle.Image = ((System.Drawing.Bitmap)(resources.GetObject("rightCenterHandle.Image")));
            this.rightCenterHandle.Location = new System.Drawing.Point(281, 128);
            this.rightCenterHandle.Name = "rightCenterHandle";
            this.rightCenterHandle.Size = new System.Drawing.Size(9, 9);
            this.rightCenterHandle.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
            this.rightCenterHandle.TabIndex = 17;
            this.rightCenterHandle.TabStop = false;
            this.rightCenterHandle.Visible = false;
            //
            // leftCenterHandle
            //
            this.leftCenterHandle.Cursor = System.Windows.Forms.Cursors.Default;
            this.leftCenterHandle.Image = ((System.Drawing.Bitmap)(resources.GetObject("leftCenterHandle.Image")));
            this.leftCenterHandle.Location = new System.Drawing.Point(1, 128);
            this.leftCenterHandle.Name = "leftCenterHandle";
            this.leftCenterHandle.Size = new System.Drawing.Size(9, 9);
            this.leftCenterHandle.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
            this.leftCenterHandle.TabIndex = 16;
            this.leftCenterHandle.TabStop = false;
            this.leftCenterHandle.Visible = false;
            //
            // rightTopHandle
            //
            this.rightTopHandle.BackColor = System.Drawing.Color.Gray;
            this.rightTopHandle.Cursor = System.Windows.Forms.Cursors.Default;
            this.rightTopHandle.Image = ((System.Drawing.Bitmap)(resources.GetObject("rightTopHandle.Image")));
            this.rightTopHandle.Location = new System.Drawing.Point(281, 0);
            this.rightTopHandle.Name = "rightTopHandle";
            this.rightTopHandle.Size = new System.Drawing.Size(11, 11);
            this.rightTopHandle.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
            this.rightTopHandle.TabIndex = 15;
            this.rightTopHandle.TabStop = false;
            this.rightTopHandle.Visible = false;
            //
            // centerTopHandle
            //
            this.centerTopHandle.Cursor = System.Windows.Forms.Cursors.Default;
            this.centerTopHandle.Image = ((System.Drawing.Bitmap)(resources.GetObject("centerTopHandle.Image")));
            this.centerTopHandle.Location = new System.Drawing.Point(137, 0);
            this.centerTopHandle.Name = "centerTopHandle";
            this.centerTopHandle.Size = new System.Drawing.Size(9, 9);
            this.centerTopHandle.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
            this.centerTopHandle.TabIndex = 14;
            this.centerTopHandle.TabStop = false;
            this.centerTopHandle.Visible = false;
            //
            // leftTopHandle
            //
            this.leftTopHandle.BackColor = System.Drawing.Color.Gray;
            this.leftTopHandle.Cursor = System.Windows.Forms.Cursors.Default;
            this.leftTopHandle.Image = ((System.Drawing.Bitmap)(resources.GetObject("leftTopHandle.Image")));
            this.leftTopHandle.Location = new System.Drawing.Point(1, 0);
            this.leftTopHandle.Name = "leftTopHandle";
            this.leftTopHandle.Size = new System.Drawing.Size(11, 11);
            this.leftTopHandle.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
            this.leftTopHandle.TabIndex = 13;
            this.leftTopHandle.TabStop = false;
            this.leftTopHandle.Visible = false;
            //
            // InkClipboard
            //
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize = new System.Drawing.Size(292, 266);
            this.Controls.AddRange(new System.Windows.Forms.Control[] {
                                                                          this.rightBottomHandle,
                                                                          this.centerBottomHandle,
                                                                          this.leftBottomHandle,
                                                                          this.rightCenterHandle,
                                                                          this.leftCenterHandle,
                                                                          this.rightTopHandle,
                                                                          this.centerTopHandle,
                                                                          this.leftTopHandle});
            this.Menu = this.mainMenu;
            this.Name = "InkClipboard";
            this.Text = "InkClipboard";
            this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.InkClipboard_MouseDown);
            this.Load += new System.EventHandler(this.InkClipboard_Load);
            this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.InkClipboard_MouseUp);
            this.Paint += new System.Windows.Forms.PaintEventHandler(this.InkClipboard_Paint);
            this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.InkClipboard_MouseMove);
            this.ResumeLayout(false);

        }

void InkClipboard::InkClipboard::InkClipboard_Load | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Form Load Event Setup the ink collector for collection.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 645 of file InkClipboard.cs.

        {
            // Set the application mode to inking
            applicationMode = ApplicationMode.Ink;

            // Initialize the selection data
            lassoPoints = new ArrayList();
            selectionHandles = new PictureBox[] {leftTopHandle,centerTopHandle,rightTopHandle,leftCenterHandle,rightCenterHandle,leftBottomHandle,centerBottomHandle,rightBottomHandle};
            selectionRect = new Rectangle();
            selectedStrokes = null;

            // Create the pens used to draw the lasso selection
            connectorPen = new Pen(connectorColor);     // Pen used to draw dotted lasso connector line
            connectorPen.DashStyle = DashStyle.Dash;
            dotEdgePen = new Pen(dotEdgeColor);         // Pen used to draw the outer edge of the lasso dot
            dotPen = new Pen(dotColor);                 // Pen used to draw the center of the lasso dot

            // Create a new ink collector and assign it to this form's window
            myInkCollector = new InkCollector(this.Handle);

            // Set the ink collector's pen width
            myInkCollector.DefaultDrawingAttributes.Width = MediumInkWidth;

            // Turn the ink collector on
            myInkCollector.Enabled = true;

        }

void InkClipboard::InkClipboard::InkClipboard_MouseDown | ( | object | sender,
 |  | System.Windows.Forms.MouseEventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Form Mouse Down Event.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 708 of file InkClipboard.cs.

        {
            // If the mouse button was pressed down within the
            // current selection area, update the application mode
            // to indicate that the user is moving ink and record
            // the starting location of the move.  This value will
            // be used in MouseMove to determine how much the selected
            // ink should be moved.
            if (selectionRect.Contains(e.X,e.Y))
            {
                applicationMode = ApplicationMode.MoveInk;

                startMoveLocation = new Point(e.X, e.Y);
            }
                // Otherwise, if there is a selection and the mouse
                // is pressed, clear the selection.
            else if (HasSelection())
            {
                SetSelection(null);
            }
        }

void InkClipboard::InkClipboard::InkClipboard_MouseMove | ( | object | sender,
 |  | System.Windows.Forms.MouseEventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Form Mouse Move Event.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 735 of file InkClipboard.cs.

        {
            // If the selected ink is currently being moved...
            if (applicationMode == ApplicationMode.MoveInk && HasSelection())
            {
                // Compute the ink space distance the mouse has moved and
                // move the selected strokes correspondingly.
                Point moveAmount = new Point(e.X-startMoveLocation.X,e.Y-startMoveLocation.Y);
                myInkCollector.Renderer.PixelToInkSpace(CreateGraphics(),ref moveAmount);
                selectedStrokes.Move(moveAmount.X, moveAmount.Y);

                // Record the location of the mouse since the next
                // move should be relative to it.
                startMoveLocation.X = e.X;
                startMoveLocation.Y = e.Y;

                // Update the selection rectangle
                SetSelection(selectedStrokes);

            }
            else
            {

                // If the mouse has entered the rectangular selection
                // region, disable ink collection and update the cursor
                // to show that the user can move this region.  It is
                // necessary to disable ink collection since ink should not
                // flow from the pen while the user is moving the selection.
                if ( selectionRect.Contains(e.X,e.Y) )
                {
                    if (myInkCollector.Enabled)
                    {
                        myInkCollector.Enabled = false;
                        Cursor = System.Windows.Forms.Cursors.SizeAll;
                    }
                }
                    // Otherwise, enable ink collection and set the cursor
                    // to its default value (if necessary).
                else if (!myInkCollector.Enabled)
                {
                    myInkCollector.Enabled = true;
                    Cursor = System.Windows.Forms.Cursors.Arrow;
                }
            }
        }

void InkClipboard::InkClipboard::InkClipboard_MouseUp | ( | object | sender,
 |  | System.Windows.Forms.MouseEventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Form Mouse Up Event.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 788 of file InkClipboard.cs.

        {
            // If the user was moving selected ink and the
            // mouse is raised, set the application mode back to
            // its original value.
            if (applicationMode == ApplicationMode.MoveInk)
            {
                if (miLassoSelect.Checked)
                {
                    applicationMode = ApplicationMode.LassoSelection;
                }
                else
                {
                    applicationMode = ApplicationMode.Ink;
                }
            }
        }

void InkClipboard::InkClipboard::InkClipboard_Paint | ( | object | sender,
 |  | System.Windows.Forms.PaintEventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Form Paint Event.

When no ink is selected, autoredrawing is turned on and this method doesn't need to do anything. However, if there is a selection, autoredrawing is turned off and it is necessary to draw the strokes manually (in order to display the strokes as selected).

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 685 of file InkClipboard.cs.

        {
            // If AutoRedraw is turned off, perform the drawing manually.
            if (!myInkCollector.AutoRedraw)
            {

                DrawStrokes(e.Graphics);

                e.Graphics.DrawRectangle(connectorPen,selectionRect);
            }

            // If the user is drawing a lasso, repaint the lasso points.
            if (ApplicationMode.LassoSelection == applicationMode)
            {
                DrawLasso(e.Graphics, 0);
            }
        }

void InkClipboard::InkClipboard::InkSpaceToPixel | ( | Graphics | g,
 |  | ref Rectangle | r |
 | ) |  |  | [inline, private]

Helper method to convert a rectangle in ink space coordinates to pixel coordinates.

(1 ink space unit = .01mm)

Note that this method works since there is guaranteed not to be any rotation in this sample.

Parameters:
g | The graphics display
r | The rectangle to convert

Definition at line 1298 of file InkClipboard.cs.

        {
            Point leftTop = new Point(r.X,r.Y);
            Point widthHeight = new Point (r.Width, r.Height);
            myInkCollector.Renderer.InkSpaceToPixel(g, ref leftTop);
            myInkCollector.Renderer.InkSpaceToPixel(g, ref widthHeight);

            r.Location = leftTop;
            r.Size = new Size(widthHeight);

        }

static void InkClipboard::InkClipboard::Main ( ) [inline, static, private]

The main entry point for the application.

Definition at line 630 of file InkClipboard.cs.

        {
            Application.Run(new InkClipboard());
        }

void InkClipboard::InkClipboard::miBlack_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Style->Color->Black Menu Item.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 1101 of file InkClipboard.cs.

        {

            // Use helper method to set the InkCollector and the
            // selected strokes to the selected color.
            SetColor(Color.Black);

        }

void InkClipboard::InkClipboard::miBlue_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Style->Color->Blue Menu Item.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 1087 of file InkClipboard.cs.

        {

            // Use helper method to set the InkCollector and the
            // selected strokes to the selected color.
            SetColor(Color.Blue);

        }

void InkClipboard::InkClipboard::miBMP_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Format->BMP Menu Item.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 1013 of file InkClipboard.cs.

        {
            miBMP.Checked = !miBMP.Checked;
        }

void InkClipboard::InkClipboard::miClear_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Ink->Clear Menu Item.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 811 of file InkClipboard.cs.

        {
            // Clear the selection and delete all strokes from the ink
            myInkCollector.Ink.DeleteStrokes();
            SetSelection(null);

        }

void InkClipboard::InkClipboard::miCopy_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Edit->Copy Menu Item.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 875 of file InkClipboard.cs.

        {

            // Use helper method to copy the selection
            CopyInkToClipboard(InkClipboardModes.Copy);

        }

void InkClipboard::InkClipboard::miCut_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Edit->Cut Menu Item.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 860 of file InkClipboard.cs.

        {

            // Use helper method to cut the selection
            CopyInkToClipboard(InkClipboardModes.Cut);

            SetSelection(null);

        }

void InkClipboard::InkClipboard::miEMF_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Format->EMF Menu Item.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 1003 of file InkClipboard.cs.

        {
            miEMF.Checked = !miEMF.Checked;
        }

void InkClipboard::InkClipboard::miExit_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Ink->Exit Menu Item.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 824 of file InkClipboard.cs.

        {
            // Although not required, it is good practice to disable
            // ink collection before exiting
            myInkCollector.Enabled = false;

            Application.Exit();
        }

void InkClipboard::InkClipboard::miGreen_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Style->Color->Green Menu Item.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 1073 of file InkClipboard.cs.

        {

            // Use helper method to set the InkCollector and the
            // selected strokes to the selected color.
            SetColor(Color.Green);

        }

void InkClipboard::InkClipboard::miInk_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Edit->Ink Menu Item.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 953 of file InkClipboard.cs.

        {

            // Set the application mode to ink collection
            applicationMode = ApplicationMode.Ink;

            // Ink strokes should be opaque
            myInkCollector.DefaultDrawingAttributes.Transparency = 0;

            // Use helper method to clear the selection
            SetSelection(null);

            // Update menu item state
            miLassoSelect.Checked = false;
            miInk.Checked = true;

            // Unhook the new packets and stroke events since
            // these events are only needed to implement lasso selection.
            // These events are only hooked when they are needed to improve
            // performance.
            myInkCollector.NewPackets -= new InkCollectorNewPacketsEventHandler(myInkCollector_NewPackets);
            myInkCollector.Stroke -= new InkCollectorStrokeEventHandler(myInkCollector_Stroke);

        }

void InkClipboard::InkClipboard::miISF_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Format->ISF Menu Item.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 983 of file InkClipboard.cs.

        {
            miISF.Checked = !miISF.Checked;
        }

void InkClipboard::InkClipboard::miLassoSelect_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Edit->Select Menu Item.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 923 of file InkClipboard.cs.

        {
            // Set the application mode to lasso selection
            applicationMode = ApplicationMode.LassoSelection;

            // Lasso strokes should be transparent
            myInkCollector.DefaultDrawingAttributes.Transparency = 255;

            // Use helper method to clear the selection
            SetSelection(null);

            // Update menu item state
            miLassoSelect.Checked = true;
            miInk.Checked = false;

            // Hook the new packets and stroke events since
            // these events are needed to implement lasso selection.
            // These events are only hooked when they are needed to improve
            // performance.
            myInkCollector.NewPackets += new InkCollectorNewPacketsEventHandler(myInkCollector_NewPackets);
            myInkCollector.Stroke += new InkCollectorStrokeEventHandler(myInkCollector_Stroke);

        }

void InkClipboard::InkClipboard::miMainEdit_Popup | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Edit Select Event.

If the Edit menu is selected, check whether the object that is currently on the clipboard can be pasted into the ink. Disable the Paste item if it can't be pasted. Also, disable Copy and Cut if no ink is selected.

Allowable formats: Ink Serialized Format or Embeddable OLE Object (Text Ink or Sketch Ink).

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 848 of file InkClipboard.cs.

        {
            miPaste.Enabled = myInkCollector.Ink.CanPaste();
            miCopy.Enabled = HasSelection();
            miCut.Enabled = HasSelection();
        }

void InkClipboard::InkClipboard::miMedium_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Style->Width->Medium Menu Item.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 1129 of file InkClipboard.cs.

        {

            // Use helper method to set the InkCollector and the
            // selected strokes to the selected pen width.
            SetWidth(MediumInkWidth);

        }

void InkClipboard::InkClipboard::miMetafile_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Metafile->ISF Menu Item.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 993 of file InkClipboard.cs.

        {
            miMetafile.Checked = !miMetafile.Checked;
        }

void InkClipboard::InkClipboard::miNoOLE_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Format->No OLE Object Menu Item.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 1047 of file InkClipboard.cs.

        {
            miSInk.Checked = false;
            miTInk.Checked = false;
            miNoOLE.Checked = true;
        }

void InkClipboard::InkClipboard::miPaste_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Edit->Paste Menu Item.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 888 of file InkClipboard.cs.

        {
            if (myInkCollector.Ink.CanPaste())
            {
                // Compute the location where the ink should be pasted;
                // this location should be shifted from the origin
                // to account for the width of the selection rectangle's handle.
                Point offset = new Point(leftTopHandle.Width+1,leftTopHandle.Height+1);
                myInkCollector.Renderer.PixelToInkSpace(CreateGraphics(), ref offset);

                // Use Ink API to paste the clipboard data into the Ink
                Strokes pastedStrokes = myInkCollector.Ink.ClipboardPaste(offset);

                // If the contents of the clipboard were a valid format
                // (Ink Serialized Format or Embeddable OLE Object) and at
                // least one stroke was pasted into the ink, use a helper
                // method to update the stroke selection.  Otherwise,
                // the result will be null and this paste becomes a no-op.
                if (null != pastedStrokes)
                {
                    SetSelection(pastedStrokes);
                }

            }
            else
            {
                MessageBox.Show("Unable to paste ink.");
            }
        }

void InkClipboard::InkClipboard::miRed_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Style->Color->Red Menu Item.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 1059 of file InkClipboard.cs.

        {

            // Use helper method to set the InkCollector and the
            // selected strokes to the selected color.
            SetColor(Color.Red);

        }

void InkClipboard::InkClipboard::miSInk_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Format->Sketch Ink Menu Item.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 1035 of file InkClipboard.cs.

        {
            miSInk.Checked = true;
            miTInk.Checked = false;
            miNoOLE.Checked = false;
        }

void InkClipboard::InkClipboard::miThick_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Style->Width->Thick Menu Item.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 1143 of file InkClipboard.cs.

        {

            // Use helper method to set the InkCollector and the
            // selected strokes to the selected pen width.
            SetWidth(ThickInkWidth);

        }

void InkClipboard::InkClipboard::miThin_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Style->Width->Thin Menu Item.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 1115 of file InkClipboard.cs.

        {

            // Use helper method to set the InkCollector and the
            // selected strokes to the selected pen width.
            SetWidth(ThinInkWidth);

        }

void InkClipboard::InkClipboard::miTInk_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Format->Text Ink Menu Item.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 1023 of file InkClipboard.cs.

        {
            miSInk.Checked = false;
            miTInk.Checked = true;
            miNoOLE.Checked = false;
        }

void InkClipboard::InkClipboard::myInkCollector_NewPackets | ( | object | sender,
 |  | InkCollectorNewPacketsEventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Ink Collector's NewPackets event.

This event is fired when the Ink Collector receives new packet data and the user is drawing a lasso. In this case, it is necessary to intercept the new packets and use them to draw the selection lasso.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 1164 of file InkClipboard.cs.

        {

            // retrieve the size of each packet
            int packetSize = e.Stroke.PacketSize;

            // the index where the new lasso points will be added
            int newPacketIndex = lassoPoints.Count;

            // Add each new packet into the lasso points collection
            for (int i = 0; i < e.PacketCount; i++)
            {

                // retrieve the x and y packet values
                Point pt = new Point(e.PacketData[i*packetSize+XPacketIndex],
                    e.PacketData[i*packetSize+YPacketIndex]);
                myInkCollector.Renderer.InkSpaceToPixel(this.Handle, ref pt);

                // If the x or y packet values fall outside of
                // the drawing area , update them to the nearest
                // location on the drawing area.  This adjustment
                // prevents the lasso's boundaries from going
                // beyond the drawing area.
                if (pt.X<0)
                {
                    pt.X = 0;
                }
                if (pt.X>ClientSize.Width)
                {
                    pt.X = ClientSize.Width;
                }
                if (pt.Y<0)
                {
                    pt.Y = 0;
                }
                if (pt.Y>this.ClientSize.Height)
                {
                    pt.Y = ClientSize.Height;
                }

                // Add the new point into the lasso points collection
                lassoPoints.Add(pt);

            }

            // Draw the updated lasso.  In order to improve performance,
            // only the new lasso packets will be drawn.
            DrawLasso(CreateGraphics(),newPacketIndex);
        }

void InkClipboard::InkClipboard::myInkCollector_Stroke | ( | object | sender,
 |  | InkCollectorStrokeEventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Ink Collector's Stroke event.

This event is fired when a new lasso stroke is drawn. In this case, it is necessary to update the selected strokes information.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 1224 of file InkClipboard.cs.

        {

            // This stroke corresponds to the lasso -
            // cancel it so that it is not added into the ink
            e.Cancel = true;

            Strokes hitStrokes = null;

            // If there are enough lasso points, perform a hit test
            // to determine which strokes were selected.
            if (lassoPoints.Count > 2)
            {

                // Convert the lasso points from pixels to ink space
                Point[] inkLassoPoints = (Point[])lassoPoints.ToArray(typeof(Point));
                myInkCollector.Renderer.PixelToInkSpace(CreateGraphics(), ref inkLassoPoints);

                // Perform a hit test on this ink collector's ink to
                // determine which points were selected by the lasso stroke.
                //
                // Note that there is a slight inefficiency here since the
                // lasso stroke is part of the ink and, therefore, part of the
                // hit test - even though we don't need it.   It would have
                // been more efficient to remove the stroke from the ink before
                // calling HitTest.  However, it is not good practice to modify
                // the stroke inside of its own event handler.
                hitStrokes = myInkCollector.Ink.HitTest(inkLassoPoints, LassoPercent);
                hitStrokes.Remove(e.Stroke);

            }

            // Reset the lasso points
            lassoPoints.Clear();
            lastDrawnLassoDot = Point.Empty;

            // Use helper method to set the selection
            SetSelection(hitStrokes);

        }

void InkClipboard::InkClipboard::PixelToInkSpace | ( | Graphics | g,
 |  | ref Rectangle | r |
 | ) |  |  | [inline, private]

Helper method to convert a rectangle in pixel coordinates to ink space coordinates.

(1 ink space unit = .01mm)

Note that this method works since there is guaranteed not to be any rotation in this sample.

Parameters:
g | The graphics display
r | The rectangle to convert

Definition at line 1276 of file InkClipboard.cs.

        {

            Point leftTop = new Point(r.X,r.Y);
            Point widthHeight = new Point (r.Width, r.Height);
            myInkCollector.Renderer.PixelToInkSpace(g, ref leftTop);
            myInkCollector.Renderer.PixelToInkSpace(g, ref widthHeight);

            r.Location = leftTop;
            r.Size = new Size(widthHeight);

        }

void InkClipboard::InkClipboard::SetColor ( Color newColor ) [inline, private]

Helper method to set the InkCollector and the selected stroke color.

Parameters:
newColor The new color

Definition at line 1639 of file InkClipboard.cs.

        {
            myInkCollector.DefaultDrawingAttributes.Color = newColor;

            // In addition to updating the ink collector, also update
            // the drawing attributes of all selected strokes.
            if (HasSelection())
            {
                foreach (Stroke s in selectedStrokes)
                {
                    s.DrawingAttributes.Color = newColor;
                }
            }

            Refresh();
        }

void InkClipboard::InkClipboard::SetLocation | ( | PictureBox | pb,
 |  | int | xCenter,
 |  | int | yCenter |
 | ) |  |  | [inline]

Helper method to set the location of the selection rectangle handle.

Parameters:
pb | The handle's picture box
xCenter | The desired x coordinate of the center
yCenter | The desired y coordinate of the center

Definition at line 1444 of file InkClipboard.cs.

        {
            Point location = new Point();

            location.X = xCenter - pb.Width/2;
            location.Y = yCenter - pb.Height/2;

            pb.Location = location;
        }

void InkClipboard::InkClipboard::SetSelection ( Strokes strokes ) [inline, private]

Sets the selected strokes and selection rectangle.

Parameters:
strokes The strokes that should be selected. If null, the selection becomes empty

Definition at line 1365 of file InkClipboard.cs.

        {
            // Tracks whether the rectangle that bounds the selected
            // strokes should be displayed
            bool isSelectionVisible = false;

            // Update the selected strokes collection
            selectedStrokes = strokes;

            // If no strokes are selected, set the selection rectangle
            // to empty
            if (!HasSelection())
            {
                selectionRect = Rectangle.Empty;
            }
                // Otherwise, at least one stroke is selected and it is necessary
                // to display the selection rectangle.
            else
            {
                isSelectionVisible = true;

                // Retrieve the bounding box of the strokes
                selectionRect = selectedStrokes.GetBoundingBox();
                InkSpaceToPixel(CreateGraphics(),ref selectionRect);

                // Pad the selection rectangle so that the selected ink
                // doesn't overlap with the selection rectangle's handles.
                selectionRect.Inflate(SelectionRectBuffer, SelectionRectBuffer);

                // compute the center of the rectangle that bounds the
                // selected strokes
                int xAvg = (selectionRect.Right+selectionRect.Left)/2;
                int yAvg = (selectionRect.Top+selectionRect.Bottom)/2;

                // Draw the resize handles
                // top left
                SetLocation(selectionHandles[0],selectionRect.Left, selectionRect.Top);
                // top
                SetLocation(selectionHandles[1],xAvg, selectionRect.Top);
                // top right
                SetLocation(selectionHandles[2],selectionRect.Right, selectionRect.Top);

                // left
                SetLocation(selectionHandles[3],selectionRect.Left, yAvg);
                // right
                SetLocation(selectionHandles[4],selectionRect.Right, yAvg);

                // bottom left
                SetLocation(selectionHandles[5],selectionRect.Left, selectionRect.Bottom);
                // bottom
                SetLocation(selectionHandles[6],xAvg, selectionRect.Bottom);
                // bottom right
                SetLocation(selectionHandles[7],selectionRect.Right, selectionRect.Bottom);
            }

            // Set the visibility of each selection handle in the
            // selection rectangle.  If there is no selection, all
            // handles should be hidden.  Otherwise, all handles should
            // be visible.
            foreach(PictureBox pb in selectionHandles)
            {
                pb.Visible = isSelectionVisible;
            }

            // Turn off autoredrawing if there is a selection - otherwise,
            // the selected ink will not be displayed as selected.
            myInkCollector.AutoRedraw = !isSelectionVisible;

            // Since the selection has changed, repaint the screen.
            Refresh();
        }

void InkClipboard::InkClipboard::SetWidth ( float newWidth ) [inline, private]

Helper method to set the InkCollector and the selected stroke pen width.

Parameters:
newWidth The new pen width

Definition at line 1661 of file InkClipboard.cs.

        {
            myInkCollector.DefaultDrawingAttributes.Width = newWidth;

            // In addition to updating the ink collector, also update
            // the drawing attributes of all selected strokes.
            if (HasSelection())
            {
                foreach (Stroke s in selectedStrokes)
                {
                    s.DrawingAttributes.Width = newWidth;
                }
            }

            Refresh();
        }

Member Data Documentation

ApplicationMode InkClipboard::InkClipboard::applicationMode = ApplicationMode.Ink [private]

Definition at line 117 of file InkClipboard.cs.

System.Windows.Forms.PictureBox InkClipboard::InkClipboard::centerBottomHandle [private]

Definition at line 174 of file InkClipboard.cs.

System.Windows.Forms.PictureBox InkClipboard::InkClipboard::centerTopHandle [private]

Definition at line 179 of file InkClipboard.cs.

System.ComponentModel.Container InkClipboard::InkClipboard::components = null [private]

Required designer variable.

Definition at line 194 of file InkClipboard.cs.

Color InkClipboard::InkClipboard::connectorColor = Color.Black [private]

Definition at line 140 of file InkClipboard.cs.

Pen InkClipboard::InkClipboard::connectorPen = null [private]

Definition at line 143 of file InkClipboard.cs.

Color InkClipboard::InkClipboard::dotColor = SystemColors.Highlight [private]

Definition at line 139 of file InkClipboard.cs.

Color InkClipboard::InkClipboard::dotEdgeColor = Color.White [private]

Definition at line 138 of file InkClipboard.cs.

Pen InkClipboard::InkClipboard::dotEdgePen = null [private]

Definition at line 144 of file InkClipboard.cs.

Pen InkClipboard::InkClipboard::dotPen = null [private]

Definition at line 145 of file InkClipboard.cs.

const int InkClipboard::InkClipboard::DotSize = 6 [private]

Definition at line 93 of file InkClipboard.cs.

const int InkClipboard::InkClipboard::DotSpacing = 7 [private]

Definition at line 96 of file InkClipboard.cs.

const float InkClipboard::InkClipboard::LassoPercent = 50 [private]

Definition at line 104 of file InkClipboard.cs.

ArrayList InkClipboard::InkClipboard::lassoPoints = null [private]

Definition at line 120 of file InkClipboard.cs.

Point InkClipboard::InkClipboard::lastDrawnLassoDot = Point.Empty [private]

Definition at line 135 of file InkClipboard.cs.

System.Windows.Forms.PictureBox InkClipboard::InkClipboard::leftBottomHandle [private]

Definition at line 175 of file InkClipboard.cs.

System.Windows.Forms.PictureBox InkClipboard::InkClipboard::leftCenterHandle [private]

Definition at line 177 of file InkClipboard.cs.

System.Windows.Forms.PictureBox InkClipboard::InkClipboard::leftTopHandle [private]

Definition at line 180 of file InkClipboard.cs.

System.Windows.Forms.MainMenu InkClipboard::InkClipboard::mainMenu [private]

Definition at line 182 of file InkClipboard.cs.

const float InkClipboard::InkClipboard::MediumInkWidth = 100 [private]

Definition at line 86 of file InkClipboard.cs.

System.Windows.Forms.MenuItem InkClipboard::InkClipboard::miBlack [private]

Definition at line 172 of file InkClipboard.cs.

System.Windows.Forms.MenuItem InkClipboard::InkClipboard::miBlue [private]

Definition at line 171 of file InkClipboard.cs.

System.Windows.Forms.MenuItem InkClipboard::InkClipboard::miBMP [private]

Definition at line 161 of file InkClipboard.cs.

System.Windows.Forms.MenuItem InkClipboard::InkClipboard::miClear [private]

Definition at line 151 of file InkClipboard.cs.

System.Windows.Forms.MenuItem InkClipboard::InkClipboard::miColor [private]

Definition at line 188 of file InkClipboard.cs.

System.Windows.Forms.MenuItem InkClipboard::InkClipboard::miCopy [private]

Definition at line 155 of file InkClipboard.cs.

System.Windows.Forms.MenuItem InkClipboard::InkClipboard::miCut [private]

Definition at line 154 of file InkClipboard.cs.

System.Windows.Forms.MenuItem InkClipboard::InkClipboard::miEditSeparator [private]

Definition at line 184 of file InkClipboard.cs.

System.Windows.Forms.MenuItem InkClipboard::InkClipboard::miEMF [private]

Definition at line 162 of file InkClipboard.cs.

System.Windows.Forms.MenuItem InkClipboard::InkClipboard::miExit [private]

Definition at line 152 of file InkClipboard.cs.

System.Windows.Forms.MenuItem InkClipboard::InkClipboard::miFormatSeparator [private]

Definition at line 185 of file InkClipboard.cs.

System.Windows.Forms.MenuItem InkClipboard::InkClipboard::miGreen [private]

Definition at line 170 of file InkClipboard.cs.

System.Windows.Forms.MenuItem InkClipboard::InkClipboard::miInk [private]

Definition at line 157 of file InkClipboard.cs.

System.Windows.Forms.MenuItem InkClipboard::InkClipboard::miInkSeparator [private]

Definition at line 183 of file InkClipboard.cs.

System.Windows.Forms.MenuItem InkClipboard::InkClipboard::miISF [private]

Definition at line 159 of file InkClipboard.cs.

System.Windows.Forms.MenuItem InkClipboard::InkClipboard::miLassoSelect [private]

Definition at line 181 of file InkClipboard.cs.

System.Windows.Forms.MenuItem InkClipboard::InkClipboard::miMainAction [private]

Definition at line 189 of file InkClipboard.cs.

System.Windows.Forms.MenuItem InkClipboard::InkClipboard::miMainEdit [private]

Definition at line 153 of file InkClipboard.cs.

System.Windows.Forms.MenuItem InkClipboard::InkClipboard::miMainFormat [private]

Definition at line 158 of file InkClipboard.cs.

System.Windows.Forms.MenuItem InkClipboard::InkClipboard::miMedium [private]

Definition at line 167 of file InkClipboard.cs.

System.Windows.Forms.MenuItem InkClipboard::InkClipboard::miMetafile [private]

Definition at line 160 of file InkClipboard.cs.

System.Windows.Forms.MenuItem InkClipboard::InkClipboard::miNoOLE [private]

Definition at line 165 of file InkClipboard.cs.

System.Windows.Forms.MenuItem InkClipboard::InkClipboard::miPaste [private]

Definition at line 156 of file InkClipboard.cs.

System.Windows.Forms.MenuItem InkClipboard::InkClipboard::miRed [private]

Definition at line 169 of file InkClipboard.cs.

System.Windows.Forms.MenuItem InkClipboard::InkClipboard::miSInk [private]

Definition at line 163 of file InkClipboard.cs.

System.Windows.Forms.MenuItem InkClipboard::InkClipboard::miStyle [private]

Definition at line 186 of file InkClipboard.cs.

System.Windows.Forms.MenuItem InkClipboard::InkClipboard::miThick [private]

Definition at line 168 of file InkClipboard.cs.

System.Windows.Forms.MenuItem InkClipboard::InkClipboard::miThin [private]

Definition at line 166 of file InkClipboard.cs.

System.Windows.Forms.MenuItem InkClipboard::InkClipboard::miTInk [private]

Definition at line 164 of file InkClipboard.cs.

System.Windows.Forms.MenuItem InkClipboard::InkClipboard::miWidth [private]

Definition at line 187 of file InkClipboard.cs.

InkCollector InkClipboard::InkClipboard::myInkCollector = null [private]

Definition at line 114 of file InkClipboard.cs.

System.Windows.Forms.PictureBox InkClipboard::InkClipboard::rightBottomHandle [private]

Definition at line 173 of file InkClipboard.cs.

System.Windows.Forms.PictureBox InkClipboard::InkClipboard::rightCenterHandle [private]

Definition at line 176 of file InkClipboard.cs.

System.Windows.Forms.PictureBox InkClipboard::InkClipboard::rightTopHandle [private]

Definition at line 178 of file InkClipboard.cs.

const int InkClipboard::InkClipboard::SelectedInkWidthIncrease = 105 [private]

Definition at line 90 of file InkClipboard.cs.

Strokes InkClipboard::InkClipboard::selectedStrokes = null [private]

Definition at line 129 of file InkClipboard.cs.

PictureBox [] InkClipboard::InkClipboard::selectionHandles [private]

Definition at line 123 of file InkClipboard.cs.

Rectangle InkClipboard::InkClipboard::selectionRect = Rectangle.Empty [private]

Definition at line 126 of file InkClipboard.cs.

const int InkClipboard::InkClipboard::SelectionRectBuffer = 8 [private]

Definition at line 100 of file InkClipboard.cs.

Point InkClipboard::InkClipboard::startMoveLocation = Point.Empty [private]

Definition at line 132 of file InkClipboard.cs.

const float InkClipboard::InkClipboard::ThickInkWidth = 200 [private]

Definition at line 87 of file InkClipboard.cs.

const float InkClipboard::InkClipboard::ThinInkWidth = 10 [private]

Definition at line 85 of file InkClipboard.cs.

const int InkClipboard::InkClipboard::XPacketIndex = 0 [private]

Definition at line 108 of file InkClipboard.cs.

const int InkClipboard::InkClipboard::YPacketIndex = 1 [private]

Definition at line 109 of file InkClipboard.cs.

The documentation for this class was generated from the following file:
  • TabletPC/InkClipboard/InkClipboard.cs
Generated on Wed Nov 13 2024 16:58:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: InkCollection::InkCollection Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • InkCollection
  • InkCollection::InkCollection
Public Member Functions | Protected Member Functions | Properties | Private Member Functions | Static Private Member Functions | Private Attributes

InkCollection::InkCollection Class Reference

The InkCollection Sample Application form class. More...

List of all members.

Public Member Functions

InkCollection ()
InkCollection ()
void | CustomStylusDataAdded (RealTimeStylus sender, CustomStylusData data)
void | Error (RealTimeStylus sender, ErrorData data)
void | InAirPackets (RealTimeStylus sender, InAirPacketsData data)
void | Packets (RealTimeStylus sender, PacketsData data)
void | RealTimeStylusDisabled (RealTimeStylus sender, RealTimeStylusDisabledData data)
void | RealTimeStylusEnabled (RealTimeStylus sender, RealTimeStylusEnabledData data)
void | StylusButtonDown (RealTimeStylus sender, StylusButtonDownData data)
void | StylusButtonUp (RealTimeStylus sender, StylusButtonUpData data)
void | StylusDown (RealTimeStylus sender, StylusDownData data)
void | StylusInRange (RealTimeStylus sender, StylusInRangeData data)
void | StylusOutOfRange (RealTimeStylus sender, StylusOutOfRangeData data)
void | StylusUp (RealTimeStylus sender, StylusUpData data)
void | SystemGesture (RealTimeStylus sender, SystemGestureData data)
void | TabletAdded (RealTimeStylus sender, TabletAddedData data)
void | TabletRemoved (RealTimeStylus sender, TabletRemovedData data)

Protected Member Functions

override void | Dispose (bool disposing)
override void | Dispose (bool disposing)

Properties

DataInterestMask | DataInterest [get]

Private Member Functions

void | InitializeComponent ()
void | InitializeComponent ()
void | InkCollection_Load (object sender, System.EventArgs e)
void | InkCollection_Load (object sender, System.EventArgs e)
void | InkCollection_Paint (object sender, System.Windows.Forms.PaintEventArgs e)
void | miBlack_Click (object sender, System.EventArgs e)
void | miBlack_Click (object sender, System.EventArgs e)
void | miBlue_Click (object sender, System.EventArgs e)
void | miBlue_Click (object sender, System.EventArgs e)
void | miEnabled_Click (object sender, System.EventArgs e)
void | miEnabled_Click (object sender, System.EventArgs e)
void | miExit_Click (object sender, System.EventArgs e)
void | miExit_Click (object sender, System.EventArgs e)
void | miGreen_Click (object sender, System.EventArgs e)
void | miGreen_Click (object sender, System.EventArgs e)
void | miMedium_Click (object sender, System.EventArgs e)
void | miMedium_Click (object sender, System.EventArgs e)
void | miRed_Click (object sender, System.EventArgs e)
void | miRed_Click (object sender, System.EventArgs e)
void | miThick_Click (object sender, System.EventArgs e)
void | miThick_Click (object sender, System.EventArgs e)
void | miThin_Click (object sender, System.EventArgs e)
void | miThin_Click (object sender, System.EventArgs e)

Static Private Member Functions

static void | Main ()
static void | Main ()

Private Attributes

System.ComponentModel.Container | components = null
const float | MediumInkWidth = 100
System.Windows.Forms.MenuItem | miBlack
System.Windows.Forms.MenuItem | miBlue
System.Windows.Forms.MenuItem | miColor
System.Windows.Forms.MenuItem | miEnabled
System.Windows.Forms.MenuItem | miExit
System.Windows.Forms.MenuItem | miGreen
System.Windows.Forms.MainMenu | miMain
System.Windows.Forms.MenuItem | miMainFile
System.Windows.Forms.MenuItem | miMainInk
System.Windows.Forms.MenuItem | miMedium
System.Windows.Forms.MenuItem | miRed
System.Windows.Forms.MenuItem | miThick
System.Windows.Forms.MenuItem | miThin
System.Windows.Forms.MenuItem | miWidth
DynamicRenderer | myDynamicRenderer
Ink | myInk
InkCollector | myInkCollector
Hashtable | myPackets
RealTimeStylus | myRealTimeStylus
Renderer | myRenderer
const float | ThickInkWidth = 200
const float | ThinInkWidth = 10

Detailed Description

Definition at line 39 of file InkCollection.cs.

Constructor & Destructor Documentation

InkCollection::InkCollection::InkCollection ( ) [inline]

Definition at line 70 of file InkCollection.cs.

    {
            #region Standard Template Code
      // Required for Windows Form Designer support
      InitializeComponent();
            #endregion
        }

InkCollection::InkCollection::InkCollection ( ) [inline]

Definition at line 86 of file InkCollection.cs.

        {
            #region Standard Template Code
            // Required for Windows Form Designer support
            InitializeComponent();
            #endregion
        }

Member Function Documentation

void InkCollection::InkCollection::CustomStylusDataAdded | ( | RealTimeStylus | sender,
 |  | CustomStylusData | data |
 | ) |  |  | [inline]

Definition at line 521 of file InkCollection.cs.

{}

override void InkCollection::InkCollection::Dispose ( bool disposing ) [inline, protected]

Clean up any resources being used.

Definition at line 82 of file InkCollection.cs.

    {
      if( disposing )
      {
        if (components != null)
        {
          components.Dispose();
        }
      }
      base.Dispose( disposing );
    }

override void InkCollection::InkCollection::Dispose ( bool disposing ) [inline, protected]

Clean up any resources being used.

Definition at line 98 of file InkCollection.cs.

        {
            if( disposing )
            {
                if (components != null)
                {
                    components.Dispose();
                }
            }
            base.Dispose( disposing );

        }

void InkCollection::InkCollection::Error | ( | RealTimeStylus | sender,
 |  | ErrorData | data |
 | ) |  |  | [inline]

Called when the current plugin or the ones previous in the list threw an exception.

Parameters:
sender | The real time stylus
data | Error data

Definition at line 495 of file InkCollection.cs.

        {
            Debug.Assert(false, null, "An error occurred.  DataId=" + data.DataId + ", " + "Exception=" + data.InnerException);
        }

void InkCollection::InkCollection::InAirPackets | ( | RealTimeStylus | sender,
 |  | InAirPacketsData | data |
 | ) |  |  | [inline]

Definition at line 523 of file InkCollection.cs.

{}

void InkCollection::InkCollection::InitializeComponent ( ) [inline, private]

----- Standard Template Code ----- Required method for Designer support - do not modify the contents of this method with the code editor.

Definition at line 101 of file InkCollection.cs.

    {
            this.miMain = new System.Windows.Forms.MainMenu();
            this.miMainFile = new System.Windows.Forms.MenuItem();
            this.miExit = new System.Windows.Forms.MenuItem();
            this.miMainInk = new System.Windows.Forms.MenuItem();
            this.miEnabled = new System.Windows.Forms.MenuItem();
            this.miColor = new System.Windows.Forms.MenuItem();
            this.miRed = new System.Windows.Forms.MenuItem();
            this.miGreen = new System.Windows.Forms.MenuItem();
            this.miBlue = new System.Windows.Forms.MenuItem();
            this.miBlack = new System.Windows.Forms.MenuItem();
            this.miWidth = new System.Windows.Forms.MenuItem();
            this.miThin = new System.Windows.Forms.MenuItem();
            this.miMedium = new System.Windows.Forms.MenuItem();
            this.miThick = new System.Windows.Forms.MenuItem();
            //
            // miMain
            //
            this.miMain.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                                this.miMainFile,
                                                                                this.miMainInk});
            //
            // miMainFile
            //
            this.miMainFile.Index = 0;
            this.miMainFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                                this.miExit});
            this.miMainFile.Text = "File";
            //
            // miExit
            //
            this.miExit.Index = 0;
            this.miExit.Text = "Exit";
            this.miExit.Click += new System.EventHandler(this.miExit_Click);
            //
            // miMainInk
            //
            this.miMainInk.Index = 1;
            this.miMainInk.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                                this.miEnabled,
                                                                                this.miColor,
                                                                                this.miWidth});
            this.miMainInk.Text = "Ink";
            //
            // miEnabled
            //
            this.miEnabled.Checked = true;
            this.miEnabled.Index = 0;
            this.miEnabled.Text = "Enabled";
            this.miEnabled.Click += new System.EventHandler(this.miEnabled_Click);
            //
            // miColor
            //
            this.miColor.Index = 1;
            this.miColor.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                                this.miRed,
                                                                                this.miGreen,
                                                                                this.miBlue,
                                                                                this.miBlack});
            this.miColor.Text = "Color";
            //
            // miRed
            //
            this.miRed.Index = 0;
            this.miRed.Text = "Red";
            this.miRed.Click += new System.EventHandler(this.miRed_Click);
            //
            // miGreen
            //
            this.miGreen.Index = 1;
            this.miGreen.Text = "Green";
            this.miGreen.Click += new System.EventHandler(this.miGreen_Click);
            //
            // miBlue
            //
            this.miBlue.Index = 2;
            this.miBlue.Text = "Blue";
            this.miBlue.Click += new System.EventHandler(this.miBlue_Click);
            //
            // miBlack
            //
            this.miBlack.Index = 3;
            this.miBlack.Text = "Black";
            this.miBlack.Click += new System.EventHandler(this.miBlack_Click);
            //
            // miWidth
            //
            this.miWidth.Index = 2;
            this.miWidth.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                                this.miThin,
                                                                                this.miMedium,
                                                                                this.miThick});
            this.miWidth.Text = "Width";
            //
            // miThin
            //
            this.miThin.Index = 0;
            this.miThin.Text = "Thin";
            this.miThin.Click += new System.EventHandler(this.miThin_Click);
            //
            // miMedium
            //
            this.miMedium.Index = 1;
            this.miMedium.Text = "Medium";
            this.miMedium.Click += new System.EventHandler(this.miMedium_Click);
            //
            // miThick
            //
            this.miThick.Index = 2;
            this.miThick.Text = "Thick";
            this.miThick.Click += new System.EventHandler(this.miThick_Click);
            //
            // InkCollection
            //
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize = new System.Drawing.Size(292, 245);
            this.Menu = this.miMain;
            this.Name = "InkCollection";
            this.Text = "Ink Collection Sample";
            this.Load += new System.EventHandler(this.InkCollection_Load);

        }

void InkCollection::InkCollection::InitializeComponent ( ) [inline, private]

----- Standard Template Code ----- Required method for Designer support - do not modify the contents of this method with the code editor.

Definition at line 118 of file InkCollection.cs.

        {
            this.miMain = new System.Windows.Forms.MainMenu();
            this.miMainFile = new System.Windows.Forms.MenuItem();
            this.miExit = new System.Windows.Forms.MenuItem();
            this.miMainInk = new System.Windows.Forms.MenuItem();
            this.miEnabled = new System.Windows.Forms.MenuItem();
            this.miColor = new System.Windows.Forms.MenuItem();
            this.miRed = new System.Windows.Forms.MenuItem();
            this.miGreen = new System.Windows.Forms.MenuItem();
            this.miBlue = new System.Windows.Forms.MenuItem();
            this.miBlack = new System.Windows.Forms.MenuItem();
            this.miWidth = new System.Windows.Forms.MenuItem();
            this.miThin = new System.Windows.Forms.MenuItem();
            this.miMedium = new System.Windows.Forms.MenuItem();
            this.miThick = new System.Windows.Forms.MenuItem();
            //
            // miMain
            //
            this.miMain.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                                this.miMainFile,
                                                                                this.miMainInk});
            //
            // miMainFile
            //
            this.miMainFile.Index = 0;
            this.miMainFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                                this.miExit});
            this.miMainFile.Text = "File";
            //
            // miExit
            //
            this.miExit.Index = 0;
            this.miExit.Text = "Exit";
            this.miExit.Click += new System.EventHandler(this.miExit_Click);
            //
            // miMainInk
            //
            this.miMainInk.Index = 1;
            this.miMainInk.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                                this.miEnabled,
                                                                                this.miColor,
                                                                                this.miWidth});
            this.miMainInk.Text = "Ink";
            //
            // miEnabled
            //
            this.miEnabled.Checked = true;
            this.miEnabled.Index = 0;
            this.miEnabled.Text = "Enabled";
            this.miEnabled.Click += new System.EventHandler(this.miEnabled_Click);
            //
            // miColor
            //
            this.miColor.Index = 1;
            this.miColor.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                                this.miRed,
                                                                                this.miGreen,
                                                                                this.miBlue,
                                                                                this.miBlack});
            this.miColor.Text = "Color";
            //
            // miRed
            //
            this.miRed.Index = 0;
            this.miRed.Text = "Red";
            this.miRed.Click += new System.EventHandler(this.miRed_Click);
            //
            // miGreen
            //
            this.miGreen.Index = 1;
            this.miGreen.Text = "Green";
            this.miGreen.Click += new System.EventHandler(this.miGreen_Click);
            //
            // miBlue
            //
            this.miBlue.Index = 2;
            this.miBlue.Text = "Blue";
            this.miBlue.Click += new System.EventHandler(this.miBlue_Click);
            //
            // miBlack
            //
            this.miBlack.Index = 3;
            this.miBlack.Text = "Black";
            this.miBlack.Click += new System.EventHandler(this.miBlack_Click);
            //
            // miWidth
            //
            this.miWidth.Index = 2;
            this.miWidth.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                                this.miThin,
                                                                                this.miMedium,
                                                                                this.miThick});
            this.miWidth.Text = "Width";
            //
            // miThin
            //
            this.miThin.Index = 0;
            this.miThin.Text = "Thin";
            this.miThin.Click += new System.EventHandler(this.miThin_Click);
            //
            // miMedium
            //
            this.miMedium.Index = 1;
            this.miMedium.Text = "Medium";
            this.miMedium.Click += new System.EventHandler(this.miMedium_Click);
            //
            // miThick
            //
            this.miThick.Index = 2;
            this.miThick.Text = "Thick";
            this.miThick.Click += new System.EventHandler(this.miThick_Click);
            //
            // InkCollection
            //
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize = new System.Drawing.Size(292, 245);
            this.Menu = this.miMain;
            this.Name = "InkCollection";
            this.Text = "RTS Ink Collection Sample";
            this.Load += new System.EventHandler(this.InkCollection_Load);
            this.Paint += new System.Windows.Forms.PaintEventHandler(this.InkCollection_Paint);

        }

void InkCollection::InkCollection::InkCollection_Load | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Form Load Event Set up the real time stylus for collection.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 262 of file InkCollection.cs.

        {

            // Create the renderers.  The dynamic renderer is used to render the ink
            // stroke that is currently being collected, whereas the static renderer
            // is used to render strokes that have already been collected.
            myDynamicRenderer = new DynamicRenderer(this);
            myRenderer = new Renderer();

            //
            // If you do not modify the default drawing attributes, the default
            // drawing attributes will use the following properties and values:
            //
            //      AntiAliased     = true
            //      Color           = black
            //      FitToCurve      = false
            //      Height          = 1
            //      IgnorePressure  = false
            //      PenTip          = ball
            //      RasterOperation = copy pen
            //      Transparency    = 0
            //      Width           = 53 (2 pixels on a 96 dpi screen)
            //
            // For an example of how to modify other drawing attributes, uncomment
            // the following lines of code:
            // myDynamicRenderer.DrawingAttributes.PenTip = PenTip.Rectangle;
            // myDynamicRenderer.DrawingAttributes.Height = (.5F)*MediumInkWidth;
            // myDynamicRenderer.DrawingAttributes.Transparency = 128;
            //

            // Create the real time stylus used to receive stylus notifications
            myRealTimeStylus = new RealTimeStylus(this, true);

            // Add the dynamic renderer to the synchronous plugin notification chain.
            // Synchronous notifications occur on the pen thread.
            myRealTimeStylus.SyncPluginCollection.Add(myDynamicRenderer);

            // Add the form to the asynchronous plugin notification chain.  This plugin
            // will be used to collect stylus data into an ink object.  Asynchronous
            // notifications occur on the UI thread.
            myRealTimeStylus.AsyncPluginCollection.Add(this);

            // Enable the real time stylus and the dynamic renderer
            myRealTimeStylus.Enabled = true;
            myDynamicRenderer.Enabled = true;

            // Create the ink object used to store ink collected from the real time stylus
            myPackets = new Hashtable();
            myInk = new Ink();
        }

void InkCollection::InkCollection::InkCollection_Load | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Form Load Event Setup the ink collector for collection.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 243 of file InkCollection.cs.

        {

            // Create a new ink collector and assign it to this form's window
            myInkCollector = new InkCollector(this.Handle);

            // Set the pen width to be a medium width
            myInkCollector.DefaultDrawingAttributes.Width = MediumInkWidth;

            //
            // If you do not modify the default drawing attributes, the default
            // drawing attributes will use the following properties and values:
            //
            //      AntiAliased     = true
            //      Color           = black
            //      FitToCurve      = false
            //      Height          = 1
            //      IgnorePressure  = false
            //      PenTip          = ball
            //      RasterOperation = copy pen
            //      Transparency    = 0
            //      Width           = 53 (2 pixels on a 96 dpi screen)
            //
            // For an example of how to modify other drawing attributes, uncomment
            // the following lines of code:
            // myInkCollector.DefaultDrawingAttributes.PenTip = PenTip.Rectangle;
            // myInkCollector.DefaultDrawingAttributes.Height = (.5F)*MediumInkWidth;
            // myInkCollector.DefaultDrawingAttributes.Transparency = 128;
            //

            // Turn the ink collector on
            myInkCollector.Enabled = true;
        }

void InkCollection::InkCollection::InkCollection_Paint | ( | object | sender,
 |  | System.Windows.Forms.PaintEventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from the form Paint event.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 318 of file InkCollection.cs.

        {
            // Refresh the dynamic renderer, since it's possible that a stroke is being
            // collected at the time Paint occurs.  In this case, the portion of the stroke
            // that has already been collected will need to be redrawn.
            myDynamicRenderer.Refresh();

            // Use the static renderer to redraw strokes that have already been collected.
            myRenderer.Draw(e.Graphics, myInk.Strokes);
        }

static void InkCollection::InkCollection::Main ( ) [inline, static, private]

The main entry point for the application.

Definition at line 250 of file InkCollection.cs.

        {
            Application.Run(new InkCollection());
        }

static void InkCollection::InkCollection::Main ( ) [inline, static, private]

The main entry point for the application.

Definition at line 231 of file InkCollection.cs.

    {
      Application.Run(new InkCollection());
    }

void InkCollection::InkCollection::miBlack_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Ink->Color->Black Menu Item.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 312 of file InkCollection.cs.

        {
            myInkCollector.DefaultDrawingAttributes.Color = Color.Black;
        }

void InkCollection::InkCollection::miBlack_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Ink->Color->Black Menu Item.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 366 of file InkCollection.cs.

        {
            myDynamicRenderer.DrawingAttributes.Color = Color.Black;
        }

void InkCollection::InkCollection::miBlue_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Ink->Color->Blue Menu Item.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 356 of file InkCollection.cs.

        {
            myDynamicRenderer.DrawingAttributes.Color = Color.Blue;
        }

void InkCollection::InkCollection::miBlue_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Ink->Color->Blue Menu Item.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 302 of file InkCollection.cs.

        {
            myInkCollector.DefaultDrawingAttributes.Color = Color.Blue;
        }

void InkCollection::InkCollection::miEnabled_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Ink->Enabled Menu Item.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 363 of file InkCollection.cs.

        {
            // Toggle the enabled state of the ink collector
            myInkCollector.Enabled = !myInkCollector.Enabled;
            miEnabled.Checked = myInkCollector.Enabled;
        }

void InkCollection::InkCollection::miEnabled_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Ink->Enabled Menu Item.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 417 of file InkCollection.cs.

        {
            // Toggle the enabled state of the real time stylus
            myRealTimeStylus.Enabled = !myRealTimeStylus.Enabled;
            miEnabled.Checked = myRealTimeStylus.Enabled;
        }

void InkCollection::InkCollection::miExit_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from File->Exit Menu Item.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 352 of file InkCollection.cs.

        {
            myInkCollector.Enabled = false;
            this.Dispose();
        }

void InkCollection::InkCollection::miExit_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from File->Exit Menu Item.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 406 of file InkCollection.cs.

        {
            myRealTimeStylus.Enabled = false;
            Application.Exit();
        }

void InkCollection::InkCollection::miGreen_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Ink->Color->Green Menu Item.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 346 of file InkCollection.cs.

        {
            myDynamicRenderer.DrawingAttributes.Color = Color.Green;
        }

void InkCollection::InkCollection::miGreen_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Ink->Color->Green Menu Item.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 292 of file InkCollection.cs.

        {
            myInkCollector.DefaultDrawingAttributes.Color = Color.Green;
        }

void InkCollection::InkCollection::miMedium_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Ink->Width->Medium Menu Item.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 332 of file InkCollection.cs.

        {
            myInkCollector.DefaultDrawingAttributes.Width = MediumInkWidth;
        }

void InkCollection::InkCollection::miMedium_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Ink->Width->Medium Menu Item.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 386 of file InkCollection.cs.

        {
            myDynamicRenderer.DrawingAttributes.Width = MediumInkWidth;
        }

void InkCollection::InkCollection::miRed_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Ink->Color->Red Menu Item.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 335 of file InkCollection.cs.

        {

            myDynamicRenderer.DrawingAttributes.Color = Color.Red;
        }

void InkCollection::InkCollection::miRed_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Ink->Color->Red Menu Item.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 282 of file InkCollection.cs.

        {
            myInkCollector.DefaultDrawingAttributes.Color = Color.Red;
    }

void InkCollection::InkCollection::miThick_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Ink->Width->Thick Menu Item.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 342 of file InkCollection.cs.

        {
            myInkCollector.DefaultDrawingAttributes.Width = ThickInkWidth;
        }

void InkCollection::InkCollection::miThick_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Ink->Width->Thick Menu Item.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 396 of file InkCollection.cs.

        {
            myDynamicRenderer.DrawingAttributes.Width = ThickInkWidth;
        }

void InkCollection::InkCollection::miThin_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Ink->Width->Thin Menu Item.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 322 of file InkCollection.cs.

        {
            myInkCollector.DefaultDrawingAttributes.Width = ThinInkWidth;
        }

void InkCollection::InkCollection::miThin_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Ink->Width->Thin Menu Item.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 376 of file InkCollection.cs.

        {
            myDynamicRenderer.DrawingAttributes.Width = ThinInkWidth;
        }

void InkCollection::InkCollection::Packets | ( | RealTimeStylus | sender,
 |  | PacketsData | data |
 | ) |  |  | [inline]

Occurs when the stylus moves on the digitizer surface.

Add new packet data into the packet array for this stylus.

Parameters:
sender | The real time stylus associated with the notification
data | The notification data

Definition at line 452 of file InkCollection.cs.

        {
            // Use the stylus id as a key to retrieve the packet array for the
            // stylus.  Insert the new packet data into this array.
            ((ArrayList)(myPackets[data.Stylus.Id])).AddRange(data.GetData());
        }

void InkCollection::InkCollection::RealTimeStylusDisabled | ( | RealTimeStylus | sender,
 |  | RealTimeStylusDisabledData | data |
 | ) |  |  | [inline]

Definition at line 515 of file InkCollection.cs.

{}

void InkCollection::InkCollection::RealTimeStylusEnabled | ( | RealTimeStylus | sender,
 |  | RealTimeStylusEnabledData | data |
 | ) |  |  | [inline]

Definition at line 516 of file InkCollection.cs.

{}

void InkCollection::InkCollection::StylusButtonDown | ( | RealTimeStylus | sender,
 |  | StylusButtonDownData | data |
 | ) |  |  | [inline]

Definition at line 519 of file InkCollection.cs.

{}

void InkCollection::InkCollection::StylusButtonUp | ( | RealTimeStylus | sender,
 |  | StylusButtonUpData | data |
 | ) |  |  | [inline]

Definition at line 520 of file InkCollection.cs.

{}

void InkCollection::InkCollection::StylusDown | ( | RealTimeStylus | sender,
 |  | StylusDownData | data |
 | ) |  |  | [inline]

Occurs when the stylus touches the digitizer surface.

Allocate a new array to store the packet data for this stylus.

Parameters:
sender | The real time stylus associated with the notification
data | The notification data

Definition at line 433 of file InkCollection.cs.

        {
            // Allocate an empty array to store the packet data that will be
            // collected for this stylus.
            ArrayList collectedPackets = new ArrayList();

            // Add the packet data from StylusDown to the array
            collectedPackets.AddRange(data.GetData());

            // Insert the array into a hashtable using the stylus id as a key.
            myPackets.Add(data.Stylus.Id, collectedPackets);
        }

void InkCollection::InkCollection::StylusInRange | ( | RealTimeStylus | sender,
 |  | StylusInRangeData | data |
 | ) |  |  | [inline]

Definition at line 518 of file InkCollection.cs.

{}

void InkCollection::InkCollection::StylusOutOfRange | ( | RealTimeStylus | sender,
 |  | StylusOutOfRangeData | data |
 | ) |  |  | [inline]

Definition at line 517 of file InkCollection.cs.

{}

void InkCollection::InkCollection::StylusUp | ( | RealTimeStylus | sender,
 |  | StylusUpData | data |
 | ) |  |  | [inline]

Occurs when the stylus leaves the digitizer surface.

Retrieve the packet array for this stylus and use it to create a new stoke.

Parameters:
sender | The real time stylus associated with the notification
data | The notification data

Definition at line 466 of file InkCollection.cs.

        {
            // Retrieve the packet array from the hashtable using the cursor id
            // as a key.  Then, clean this entry from the hash since it is no
            // longer needed.
            ArrayList collectedPackets = (ArrayList)myPackets[data.Stylus.Id];
            myPackets.Remove(data.Stylus.Id);

            // Add the packet data from StylusUp to the array
            collectedPackets.AddRange(data.GetData());

            // Create the stroke using the specified drawing attributes.
            int[] packets = (int[])(collectedPackets.ToArray(typeof(int)));
            TabletPropertyDescriptionCollection tabletProperties = myRealTimeStylus.GetTabletPropertyDescriptionCollection(data.Stylus.TabletContextId);

            Stroke stroke = myInk.CreateStroke(packets, tabletProperties);
            if (stroke != null)
            {
                stroke.DrawingAttributes.Color = myDynamicRenderer.DrawingAttributes.Color;
                stroke.DrawingAttributes.Width = myDynamicRenderer.DrawingAttributes.Width;
            }
        }

void InkCollection::InkCollection::SystemGesture | ( | RealTimeStylus | sender,
 |  | SystemGestureData | data |
 | ) |  |  | [inline]

Definition at line 522 of file InkCollection.cs.

{}

void InkCollection::InkCollection::TabletAdded | ( | RealTimeStylus | sender,
 |  | TabletAddedData | data |
 | ) |  |  | [inline]

Definition at line 524 of file InkCollection.cs.

{}

void InkCollection::InkCollection::TabletRemoved | ( | RealTimeStylus | sender,
 |  | TabletRemovedData | data |
 | ) |  |  | [inline]

Definition at line 525 of file InkCollection.cs.

{}

Member Data Documentation

System ComponentModel Container InkCollection::InkCollection::components = null [private]

Definition at line 67 of file InkCollection.cs.

const float InkCollection::InkCollection::MediumInkWidth = 100 [private]

Definition at line 48 of file InkCollection.cs.

System Windows Forms MenuItem InkCollection::InkCollection::miBlack [private]

Definition at line 61 of file InkCollection.cs.

System Windows Forms MenuItem InkCollection::InkCollection::miBlue [private]

Definition at line 60 of file InkCollection.cs.

System Windows Forms MenuItem InkCollection::InkCollection::miColor [private]

Definition at line 57 of file InkCollection.cs.

System Windows Forms MenuItem InkCollection::InkCollection::miEnabled [private]

Definition at line 56 of file InkCollection.cs.

System Windows Forms MenuItem InkCollection::InkCollection::miExit [private]

Definition at line 54 of file InkCollection.cs.

System Windows Forms MenuItem InkCollection::InkCollection::miGreen [private]

Definition at line 59 of file InkCollection.cs.

System Windows Forms MainMenu InkCollection::InkCollection::miMain [private]

Definition at line 66 of file InkCollection.cs.

System Windows Forms MenuItem InkCollection::InkCollection::miMainFile [private]

Definition at line 53 of file InkCollection.cs.

System Windows Forms MenuItem InkCollection::InkCollection::miMainInk [private]

Definition at line 55 of file InkCollection.cs.

System Windows Forms MenuItem InkCollection::InkCollection::miMedium [private]

Definition at line 64 of file InkCollection.cs.

System Windows Forms MenuItem InkCollection::InkCollection::miRed [private]

Definition at line 58 of file InkCollection.cs.

System Windows Forms MenuItem InkCollection::InkCollection::miThick [private]

Definition at line 65 of file InkCollection.cs.

System Windows Forms MenuItem InkCollection::InkCollection::miThin [private]

Definition at line 63 of file InkCollection.cs.

System Windows Forms MenuItem InkCollection::InkCollection::miWidth [private]

Definition at line 62 of file InkCollection.cs.

DynamicRenderer InkCollection::InkCollection::myDynamicRenderer [private]

Definition at line 56 of file InkCollection.cs.

Ink InkCollection::InkCollection::myInk [private]

Definition at line 65 of file InkCollection.cs.

InkCollector InkCollection::InkCollection::myInkCollector [private]

Definition at line 43 of file InkCollection.cs.

Hashtable InkCollection::InkCollection::myPackets [private]

Definition at line 62 of file InkCollection.cs.

RealTimeStylus InkCollection::InkCollection::myRealTimeStylus [private]

Definition at line 51 of file InkCollection.cs.

Renderer InkCollection::InkCollection::myRenderer [private]

Definition at line 57 of file InkCollection.cs.

const float InkCollection::InkCollection::ThickInkWidth = 200 [private]

Definition at line 49 of file InkCollection.cs.

const float InkCollection::InkCollection::ThinInkWidth = 10 [private]

Definition at line 47 of file InkCollection.cs.

Property Documentation

DataInterestMask InkCollection::InkCollection::DataInterest [get]

Defines the types of notifications the plugin is interested in.

Definition at line 504 of file InkCollection.cs.

The documentation for this class was generated from the following files:
  • TabletPC/InkCollection/C#/InkCollection.cs
  • TabletPC/InkCollection_RTS/C#/InkCollection.cs
Generated on Wed Nov 13 2024 16:58:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: InkCollectorEvents Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

InkCollectorEvents Class Reference

#include "TpcConpt.h"

Inherited by CMyInkEvents.

List of all members.

Public Member Functions

InkCollectorEvents ()
~InkCollectorEvents ()
virtual ULONG STDMETHODCALLTYPE | AddRef ()
HRESULT | AdviseInkCollector (IInkCollector *pIInkCollector)
virtual void | CursorButtonDown (IInkCursor *Cursor, IInkCursorButton *Button)
virtual void | CursorButtonUp (IInkCursor *Cursor, IInkCursorButton *Button)
virtual void | CursorDown (IInkCursor *Cursor, IInkStrokeDisp *Stroke)
virtual void | CursorInRange (IInkCursor *Cursor, VARIANT_BOOL NewCursor, VARIANT ButtonsState)
virtual void | CursorOutOfRange (IInkCursor *Cursor)
virtual void | DblClick (VARIANT_BOOL *Cancel)
virtual void | Gesture (IInkCursor *Cursor, IInkStrokes *Strokes, VARIANT Gestures, VARIANT_BOOL *Cancel)
STDMETHOD() | GetIDsOfNames (REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgdispid)
STDMETHOD() | GetTypeInfo (UINT itinfo, LCID lcid, ITypeInfo **pptinfo)
STDMETHOD() | GetTypeInfoCount (UINT *pctinfo)
HRESULT | Init ()
STDMETHOD() | Invoke (DISPID dispidMember, REFIID riid, LCID lcid, WORD, DISPPARAMS *pdispparams, VARIANT *pvarResult, EXCEPINFO *, UINT *)
virtual void | MouseDown (InkMouseButton Button, InkShiftKeyModifierFlags Shift, long pX, long pY, VARIANT_BOOL *Cancel)
virtual void | MouseMove (InkMouseButton Button, InkShiftKeyModifierFlags Shift, long pX, long pY, VARIANT_BOOL *Cancel)
virtual void | MouseUp (InkMouseButton Button, InkShiftKeyModifierFlags Shift, long pX, long pY, VARIANT_BOOL *Cancel)
virtual void | MouseWheel (InkMouseButton Button, InkShiftKeyModifierFlags Shift, long Delta, long X, long Y, VARIANT_BOOL *Cancel)
virtual void | NewInAirPackets (IInkCursor *Cursor, long lPacketCount, VARIANT *PacketData)
virtual void | NewPackets (IInkCursor *Cursor, IInkStrokeDisp *Stroke, long PacketCount, VARIANT *PacketData)
HRESULT __stdcall | QueryInterface (REFIID riid, void **ppvObject)
virtual ULONG STDMETHODCALLTYPE | Release ()
virtual void | Stroke (IInkCursor *Cursor, IInkStrokeDisp *Stroke, VARIANT_BOOL *Cancel)
virtual void | SystemGesture (IInkCursor *Cursor, InkSystemGesture Id, long X, long Y, long Modifier, BSTR Character, long CursorMode)
virtual void | TabletAdded (IInkTablet *Tablet)
virtual void | TabletRemoved (long TabletId)
HRESULT | UnadviseInkCollector ()

Private Attributes

DWORD m_dwCookie
IConnectionPoint * | m_pIConnectionPoint
IUnknown * | m_punkFTM

Detailed Description

Definition at line 59 of file TpcConpt.h.

Constructor & Destructor Documentation

InkCollectorEvents::InkCollectorEvents ( ) [inline]

Definition at line 481 of file TpcConpt.h.

    {
        m_pIConnectionPoint = NULL;
        m_punkFTM = NULL;
    }

InkCollectorEvents::~InkCollectorEvents ( ) [inline]

Definition at line 488 of file TpcConpt.h.

    {
        UnadviseInkCollector();

        if (m_punkFTM != NULL)
        {
            m_punkFTM->Release();
        }
    }

Member Function Documentation

virtual ULONG STDMETHODCALLTYPE InkCollectorEvents::AddRef ( void ) [inline, virtual]

Definition at line 105 of file TpcConpt.h.

    {

        // Note: we do not AddRef here because the lifetime
        //  of this object does not depend on reference counting
        //  but on the duration of the connection set up by
        //  the user of this class.
        return 1;
    }

HRESULT InkCollectorEvents::AdviseInkCollector ( IInkCollector * pIInkCollector ) [inline]

Definition at line 507 of file TpcConpt.h.

    {
        HRESULT hr = S_OK;

        // Check to ensure that the sink is not currently connected
        // with another Ink Collector...
        if (NULL == m_pIConnectionPoint)
        {
            // Get the connection point container
            IConnectionPointContainer *pIConnectionPointContainer;
            hr = pIInkCollector->QueryInterface(
                IID_IConnectionPointContainer,
                (void **) &pIConnectionPointContainer);

            if (FAILED(hr))
            {
                return hr;
            }

            // Find the connection point for Ink Collector events
            hr = pIConnectionPointContainer->FindConnectionPoint(
                __uuidof(_IInkCollectorEvents), &m_pIConnectionPoint);

            if (SUCCEEDED(hr))
            {
                // Hook up sink to connection point
                hr = m_pIConnectionPoint->Advise(this, &m_dwCookie);
            }

            if (FAILED(hr))
            {
                // Clean up after an error.
                if (m_pIConnectionPoint)
                {
                    m_pIConnectionPoint->Release();
                    m_pIConnectionPoint = NULL;
                }
            }

            // We don't need the connection point container any more.
            pIConnectionPointContainer->Release();
        }
        // If the sink is already connected to an Ink Collector, return a
        // failure; only one Ink Collector can be attached at any given time.
        else
        {
            hr = E_FAIL;
        }

        return hr;
    }

virtual void InkCollectorEvents::CursorButtonDown | ( | IInkCursor * | Cursor,
 |  | IInkCursorButton * | Button |
 | ) |  |  | [inline, virtual]

Definition at line 399 of file TpcConpt.h.

    {
        // This is a place holder designed to be overridden by
        //  user of this class.
        return;
    }

virtual void InkCollectorEvents::CursorButtonUp | ( | IInkCursor * | Cursor,
 |  | IInkCursorButton * | Button |
 | ) |  |  | [inline, virtual]

Definition at line 408 of file TpcConpt.h.

    {
        // This is a place holder designed to be overridden by
        //  user of this class.
        return;
    }

virtual void InkCollectorEvents::CursorDown | ( | IInkCursor * | Cursor,
 |  | IInkStrokeDisp * | Stroke |
 | ) |  |  | [inline, virtual]

Definition at line 312 of file TpcConpt.h.

    {
        // This is a place holder designed to be overridden by
        //  user of this class.
        return;
    }

virtual void InkCollectorEvents::CursorInRange | ( | IInkCursor * | Cursor,
 |  | VARIANT_BOOL | NewCursor,
 |  | VARIANT | ButtonsState |
 | ) |  |  | [inline, virtual]

Definition at line 417 of file TpcConpt.h.

    {
        // This is a place holder designed to be overridden by
        //  user of this class.
        return;
    }

virtual void InkCollectorEvents::CursorOutOfRange ( IInkCursor * Cursor ) [inline, virtual]

Definition at line 427 of file TpcConpt.h.

    {
        // This is a place holder designed to be overridden by
        //  user of this class.
        return;
    }

virtual void InkCollectorEvents::DblClick ( VARIANT_BOOL * Cancel ) [inline, virtual]

Definition at line 332 of file TpcConpt.h.

    {
        // This is a place holder designed to be overridden by
        //  user of this class.
        return;
    }

virtual void InkCollectorEvents::Gesture | ( | IInkCursor * | Cursor,
 |  | IInkStrokes * | Strokes,
 |  | VARIANT | Gestures,
 |  | VARIANT_BOOL * | Cancel |
 | ) |  |  | [inline, virtual]

Definition at line 449 of file TpcConpt.h.

    {
        // This is a place holder designed to be overridden by
        //  user of this class.
        return;
    }

STDMETHOD() InkCollectorEvents::GetIDsOfNames | ( | REFIID | riid,
 |  | LPOLESTR * | rgszNames,
 |  | UINT | cNames,
 |  | LCID | lcid,
 |  | DISPID * | rgdispid |
 | ) |  |  | [inline]

Definition at line 143 of file TpcConpt.h.

    {
        // This method is not needed for processing events.
        return E_NOTIMPL;
    }

STDMETHOD() InkCollectorEvents::GetTypeInfo | ( | UINT | itinfo,
 |  | LCID | lcid,
 |  | ITypeInfo ** | pptinfo |
 | ) |  |  | [inline]

Definition at line 134 of file TpcConpt.h.

    {
        // This method is not needed for processing events.
        return E_NOTIMPL;
    }

STDMETHOD() InkCollectorEvents::GetTypeInfoCount ( UINT * pctinfo ) [inline]

Definition at line 128 of file TpcConpt.h.

    {
        // This method is not needed for processing events.
        return E_NOTIMPL;
    }

HRESULT InkCollectorEvents::Init ( ) [inline]

Definition at line 501 of file TpcConpt.h.

    {
        return CoCreateFreeThreadedMarshaler(this, &m_punkFTM);
    }

STDMETHOD() InkCollectorEvents::Invoke | ( | DISPID | dispidMember,
 |  | REFIID | riid,
 |  | LCID | lcid,
 |  | WORD | ,
 |  | DISPPARAMS * | pdispparams,
 |  | VARIANT * | pvarResult,
 |  | EXCEPINFO * | ,
 |  | UINT * |  |
 | ) |  |  | [inline]

Definition at line 156 of file TpcConpt.h.

    {
        switch(dispidMember)
        {
            case DISPID_ICEStroke:
                Stroke(
                    (IInkCursor*) pdispparams->rgvarg[2].pdispVal,
                    (IInkStrokeDisp*) pdispparams->rgvarg[1].pdispVal,
                    (VARIANT_BOOL *)pdispparams->rgvarg[0].pboolVal);
                break;

            case DISPID_ICECursorDown:
                CursorDown(
                    (IInkCursor*) pdispparams->rgvarg[1].pdispVal,
                    (IInkStrokeDisp*) pdispparams->rgvarg[0].pdispVal);
                break;

            case DISPID_ICENewPackets:
                NewPackets(
                    (IInkCursor*) pdispparams->rgvarg[3].pdispVal,
                    (IInkStrokeDisp*) pdispparams->rgvarg[2].pdispVal,
                    pdispparams->rgvarg[1].lVal,
                    pdispparams->rgvarg[0].pvarVal);
                break;

            case DISPID_IPEDblClick:
                DblClick(
                    (VARIANT_BOOL *)pdispparams->rgvarg[0].pboolVal);
                break;

            case DISPID_IPEMouseMove:
                MouseMove(
                    (InkMouseButton) pdispparams->rgvarg[4].lVal,
                    (InkShiftKeyModifierFlags) pdispparams->rgvarg[3].lVal,
                    pdispparams->rgvarg[2].lVal,
                    pdispparams->rgvarg[1].lVal,
                    (VARIANT_BOOL *)pdispparams->rgvarg[0].pboolVal);
                break;

            case DISPID_IPEMouseDown:
                MouseDown(
                    (InkMouseButton) pdispparams->rgvarg[4].lVal,
                    (InkShiftKeyModifierFlags) pdispparams->rgvarg[3].lVal,
                    pdispparams->rgvarg[2].lVal,
                    pdispparams->rgvarg[1].lVal,
                    (VARIANT_BOOL *)pdispparams->rgvarg[0].pboolVal);
                break;

            case DISPID_IPEMouseUp:
                MouseUp(
                    (InkMouseButton) pdispparams->rgvarg[4].lVal,
                    (InkShiftKeyModifierFlags) pdispparams->rgvarg[3].lVal,
                    pdispparams->rgvarg[2].lVal,
                    pdispparams->rgvarg[1].lVal,
                    (VARIANT_BOOL *)pdispparams->rgvarg[0].pboolVal);
                break;

            case DISPID_IPEMouseWheel:
                MouseWheel(
                    (InkMouseButton) pdispparams->rgvarg[5].lVal,
                    (InkShiftKeyModifierFlags) pdispparams->rgvarg[4].lVal,
                    pdispparams->rgvarg[3].lVal,
                    pdispparams->rgvarg[2].lVal,
                    pdispparams->rgvarg[1].lVal,
                    (VARIANT_BOOL *)pdispparams->rgvarg[0].pboolVal);
                break;

            case DISPID_ICENewInAirPackets:
                NewInAirPackets(
                    (IInkCursor*) pdispparams->rgvarg[2].pdispVal,
                    pdispparams->rgvarg[1].lVal,
                    pdispparams->rgvarg[0].pvarVal);
                break;

            case DISPID_ICECursorButtonDown:
                CursorButtonDown(
                    (IInkCursor*) pdispparams->rgvarg[1].pdispVal,
                    (IInkCursorButton*) pdispparams->rgvarg[0].pdispVal);
                break;

            case DISPID_ICECursorButtonUp:
                CursorButtonUp(
                    (IInkCursor*) pdispparams->rgvarg[1].pdispVal,
                    (IInkCursorButton*) pdispparams->rgvarg[0].pdispVal);
                break;

            case DISPID_ICECursorInRange:
                CursorInRange(
                    (IInkCursor*) pdispparams->rgvarg[2].pdispVal,
                    (VARIANT_BOOL) pdispparams->rgvarg[1].iVal,
                    pdispparams->rgvarg[0]);
                break;

            case DISPID_ICECursorOutOfRange:
                CursorOutOfRange(
                    (IInkCursor*) pdispparams->rgvarg[0].pdispVal);
                break;

            case DISPID_ICESystemGesture:
                SystemGesture(
                    (IInkCursor*) pdispparams->rgvarg[6].pdispVal,
                    (InkSystemGesture) pdispparams->rgvarg[5].lVal,
                    pdispparams->rgvarg[4].lVal,
                    pdispparams->rgvarg[3].lVal,
                    pdispparams->rgvarg[2].lVal,
                    pdispparams->rgvarg[1].bstrVal,
                    pdispparams->rgvarg[0].lVal);
                break;

            case DISPID_ICEGesture:
                Gesture(
                    (IInkCursor*) pdispparams->rgvarg[3].pdispVal,
                    (IInkStrokes*) pdispparams->rgvarg[2].pdispVal,
                    pdispparams->rgvarg[1],
                    (VARIANT_BOOL *)pdispparams->rgvarg[0].pboolVal);
                break;

            case DISPID_ICETabletAdded:
                TabletAdded(
                    (IInkTablet*) pdispparams->rgvarg[0].pdispVal);
                break;

            case DISPID_ICETabletRemoved:
                TabletRemoved(
                    pdispparams->rgvarg[0].lVal);
                break;

            default:
                break;
        }

        return S_OK;
    }

virtual void InkCollectorEvents::MouseDown | ( | InkMouseButton | Button,
 |  | InkShiftKeyModifierFlags | Shift,
 |  | long | pX,
 |  | long | pY,
 |  | VARIANT_BOOL * | Cancel |
 | ) |  |  | [inline, virtual]

Definition at line 352 of file TpcConpt.h.

    {
        // This is a place holder designed to be overridden by
        //  user of this class.
        return;
    }

virtual void InkCollectorEvents::MouseMove | ( | InkMouseButton | Button,
 |  | InkShiftKeyModifierFlags | Shift,
 |  | long | pX,
 |  | long | pY,
 |  | VARIANT_BOOL * | Cancel |
 | ) |  |  | [inline, virtual]

Definition at line 340 of file TpcConpt.h.

    {
        // This is a place holder designed to be overridden by
        //  user of this class.
        return;
    }

virtual void InkCollectorEvents::MouseUp | ( | InkMouseButton | Button,
 |  | InkShiftKeyModifierFlags | Shift,
 |  | long | pX,
 |  | long | pY,
 |  | VARIANT_BOOL * | Cancel |
 | ) |  |  | [inline, virtual]

Definition at line 364 of file TpcConpt.h.

    {
        // This is a place holder designed to be overridden by
        //  user of this class.
        return;
    }

virtual void InkCollectorEvents::MouseWheel | ( | InkMouseButton | Button,
 |  | InkShiftKeyModifierFlags | Shift,
 |  | long | Delta,
 |  | long | X,
 |  | long | Y,
 |  | VARIANT_BOOL * | Cancel |
 | ) |  |  | [inline, virtual]

Definition at line 376 of file TpcConpt.h.

    {
        // This is a place holder designed to be overridden by
        //  user of this class.
        return;
    }

virtual void InkCollectorEvents::NewInAirPackets | ( | IInkCursor * | Cursor,
 |  | long | lPacketCount,
 |  | VARIANT * | PacketData |
 | ) |  |  | [inline, virtual]

Definition at line 389 of file TpcConpt.h.

    {
        // This is a place holder designed to be overridden by
        //  user of this class.
        return;
    }

virtual void InkCollectorEvents::NewPackets | ( | IInkCursor * | Cursor,
 |  | IInkStrokeDisp * | Stroke,
 |  | long | PacketCount,
 |  | VARIANT * | PacketData |
 | ) |  |  | [inline, virtual]

Definition at line 321 of file TpcConpt.h.

    {
        // This is a place holder designed to be overridden by
        //  user of this class.
        return;
    }

HRESULT __stdcall InkCollectorEvents::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppvObject |
 | ) |  |  | [inline]

Definition at line 66 of file TpcConpt.h.

    {

        // Validate the input
        if (NULL == ppvObject)
        {
            return E_POINTER;
        }

        // This object only supports IDispatch/_IInkCollectorEvents
        if ((riid == IID_IUnknown)
            || (riid == IID_IDispatch)
            || (riid == DIID__IInkCollectorEvents))
        {
            *ppvObject = (IDispatch *) this;

            // Note: we do not AddRef here because the lifetime
            //  of this object does not depend on reference counting
            //  but on the duration of the connection set up by
            //  the user of this class.

            return S_OK;
        }
        else if (riid == IID_IMarshal)
        {
            // Assert that the free threaded marshaller has been
            // initialized.  It is necessary to call Init() before
            // invoking this method.
            assert(NULL != m_punkFTM);

            // Use free threaded marshalling.
            return m_punkFTM->QueryInterface(riid, ppvObject);
        }

        return E_NOINTERFACE;
    }

virtual ULONG STDMETHODCALLTYPE InkCollectorEvents::Release ( void ) [inline, virtual]

Definition at line 115 of file TpcConpt.h.

    {

        // Note: we do not do Release here because the lifetime
        //  of this object does not depend on reference counting
        //  but on the duration of the connection set up by
        //  the user of this class.
        return 1;
    }

virtual void InkCollectorEvents::Stroke | ( | IInkCursor * | Cursor,
 |  | IInkStrokeDisp * | Stroke,
 |  | VARIANT_BOOL * | Cancel |
 | ) |  |  | [inline, virtual]

Reimplemented in CMyInkEvents.

Definition at line 302 of file TpcConpt.h.

    {
        // This is a place holder designed to be overridden by
        //  user of this class.
        return;
    }

virtual void InkCollectorEvents::SystemGesture | ( | IInkCursor * | Cursor,
 |  | InkSystemGesture | Id,
 |  | long | X,
 |  | long | Y,
 |  | long | Modifier,
 |  | BSTR | Character,
 |  | long | CursorMode |
 | ) |  |  | [inline, virtual]

Definition at line 435 of file TpcConpt.h.

    {
        // This is a place holder designed to be overridden by
        //  user of this class.
        return;
    }

virtual void InkCollectorEvents::TabletAdded ( IInkTablet * Tablet ) [inline, virtual]

Definition at line 460 of file TpcConpt.h.

    {
        // This is a place holder designed to be overridden by
        //  user of this class.
        return;
    }

virtual void InkCollectorEvents::TabletRemoved ( long TabletId ) [inline, virtual]

Definition at line 468 of file TpcConpt.h.

    {
        // This is a place holder designed to be overridden by
        //  user of this class.
        return;
    }

HRESULT InkCollectorEvents::UnadviseInkCollector ( ) [inline]

Definition at line 561 of file TpcConpt.h.

    {
        HRESULT hr = S_OK;

        // If there the ink collector is connected to the sink,
        // remove it.  Otherwise, do nothing (there is nothing
        // to unadvise).
        if (m_pIConnectionPoint != NULL)
        {
            hr = m_pIConnectionPoint->Unadvise(m_dwCookie);
            m_pIConnectionPoint->Release();
            m_pIConnectionPoint = NULL;
        }

        return hr;
    }

Member Data Documentation

DWORD InkCollectorEvents::m_dwCookie [private]

Definition at line 588 of file TpcConpt.h.

IConnectionPoint* InkCollectorEvents::m_pIConnectionPoint [private]

Definition at line 585 of file TpcConpt.h.

IUnknown* InkCollectorEvents::m_punkFTM [private]

Definition at line 591 of file TpcConpt.h.

The documentation for this class was generated from the following file:
  • TabletPC/EventSink/TpcConpt.h
Generated on Wed Nov 13 2024 16:57:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: InkErase::InkErase Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • InkErase
  • InkErase::InkErase
Public Member Functions | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes

InkErase::InkErase Class Reference

Summary description for InkErase.

List of all members.

Public Member Functions

InkErase ()
void | myInkCollector_CursorDown (object sender, InkCollectorCursorDownEventArgs e)
void | myInkCollector_Stroke (object sender, InkCollectorStrokeEventArgs e)

Protected Member Functions

override void | Dispose (bool disposing)

Private Member Functions

void | EraseAtCusps (Point pt)
void | EraseAtIntersections (Point pt)
void | EraseStrokes (Point pt, Stroke currentStroke)
void | InitializeComponent ()
void | InkErase_Load (object sender, System.EventArgs e)
void | InkErase_OnMouseMove (object sender, MouseEventArgs e)
void | InkErase_OnPaint (object sender, PaintEventArgs e)
void | miClear_Click (object sender, System.EventArgs e)
void | miCuspErase_Click (object sender, System.EventArgs e)
void | miExit_Click (object sender, System.EventArgs e)
void | miInk_Click (object sender, System.EventArgs e)
void | miIntersectErase_Click (object sender, System.EventArgs e)
void | miStrokeErase_Click (object sender, System.EventArgs e)
void | myInkCollector_NewPackets (object sender, InkCollectorNewPacketsEventArgs e)
void | PaintCusps (Graphics g, Strokes strokesToPaint)
void | PaintIntersections (Graphics g, Strokes strokesToPaint)
void | UpdateApplicationMode (ApplicationMode newMode)

Static Private Member Functions

static void | Main ()

Private Attributes

System.ComponentModel.Container | components = null
const float | HitTestRadius = 30
const float | MediumInkWidth = 100
System.Windows.Forms.MenuItem | miClear
System.Windows.Forms.MenuItem | miCuspErase
System.Windows.Forms.MenuItem | miExit
System.Windows.Forms.MenuItem | miInk
System.Windows.Forms.MenuItem | miIntersectErase
System.Windows.Forms.MainMenu | miMain
System.Windows.Forms.MenuItem | miMainAction
System.Windows.Forms.MenuItem | miMainMode
System.Windows.Forms.MenuItem | miSeparator
System.Windows.Forms.MenuItem | miStrokeErase
ApplicationMode | mode = ApplicationMode.Ink
InkCollector | myInkCollector
const int | StrokePointRadius = 3
const int | XPacketIndex = 0
const int | YPacketIndex = 1

Detailed Description

Definition at line 67 of file InkErase.cs.

Constructor & Destructor Documentation

InkErase::InkErase::InkErase ( ) [inline]

The InkErase Sample Application form class.

Definition at line 109 of file InkErase.cs.

        {
            #region Standard Template Code
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            #endregion
        }

Member Function Documentation

override void InkErase::InkErase::Dispose ( bool disposing ) [inline, protected]

Clean up any resources being used.

Definition at line 123 of file InkErase.cs.

        {
            if( disposing )
            {
                if (components != null)
                {
                    components.Dispose();
                }
            }
            base.Dispose( disposing );
        }

void InkErase::InkErase::EraseAtCusps ( Point pt ) [inline, private]

Helper method that performs a hit test using the specified point.

When a hit occurs, the application splits the stroke at the cusps on either side of the hit and erases the corresponding stroke segment.

Parameters:
pt The point to use for hit testing.

Definition at line 595 of file InkErase.cs.

        {

            // Declare the collection of strokes returned from HitTest
            Strokes strokesHit = null;

            // Use HitTest to find the collection of strokes that are intersected
            // by the point.  The HitTestRadius constant is used to specify the
            // radius of the hit test circle in ink space coordinates (1 unit = .01mm).
      strokesHit = myInkCollector.Ink.HitTest(pt, HitTestRadius);

            // Loop over each stroke returned from the hit test to determine
            // which portion to erase...
            foreach (Stroke currentStroke in strokesHit)
            {

                // Retrieve the cusps of the stroke.  The cusps mark the points where
                // the stroke changes direction abruptly.  A segment is defined as the
                // points between two cusps.
                int[] cusps = currentStroke.PolylineCusps;

                // If there are 1 or two cusps, it's a single stroke - delete the
                // entire stroke.
                if (cusps.Length <= 2)
                {
                    myInkCollector.Ink.DeleteStroke(currentStroke);
                }

                // If there are more than 2 cusps, determine which cusps bound the
                // hit-tested portion of the stroke, split the stroke at these cusps,
                // and delete the stroke that defines the segment we hit-tested.
                else
                {
                    // Get the FINDEX of the nearest point on the stroke.  An FINDEX
                    // is a float value representing a location somewhere between two
                    // points in the stroke.  For instance, 0.0 is the first point in
                    // the stroke. 1.0 is the second point in the stroke. 0.5 is halfway
                    // between the first and second points.
                    float findex = currentStroke.NearestPoint(pt);

                    // Declare the stroke segment to delete
                    Stroke strokeToDelete = null;

                    // Cycle through each cusp of the stroke to determine
                    // which cusps bound the hit-tested portion of the stroke...
                    for(int i = cusps.Length-2; i>=0; i--)
                    {
                        // If this cusp is less than the findex, then split
                        // the stroke at this cusp and the cusp immediately
                        // after it
                        if (cusps[i]<=findex)
                        {
                            // Provided we aren't at the end of the stroke, split at
                            // cusp i+1.
                            if (i < (cusps.Length-2))
                            {
                                strokeToDelete = currentStroke.Split(cusps[i+1]);
                            }

                            // If the hit occurred between the first and second cusp,
                            // delete the stroke.  Keep in mind that the stroke has
                            // already been split at index 1, so the delete will only
                            // remove the beginning portion of the stroke (as desired).
                            if (i==0)
                            {
                                myInkCollector.Ink.DeleteStroke(currentStroke);
                            }
                            // Otherwise, split the stroke at the current cusp and
                            // delete the result.  Keep in mind that the stroke has
                            // already been split at index i+1, so the delete will
                            // remove the segment from cusp i to i+1.
                            else
                            {
                                strokeToDelete = currentStroke.Split(cusps[i]);
                                myInkCollector.Ink.DeleteStroke(strokeToDelete);
                            }

                            break;
                        }
                    }
                }
            }

            if (strokesHit.Count > 0)
            {
                // Repaint the screen to reflect the change
                this.Refresh();
            }
        }

void InkErase::InkErase::EraseAtIntersections ( Point pt ) [inline, private]

Helper method that performs a hit test using the specified point.

When a hit occurs, the application splits the stroke at the intersections on either side of the hit and erases the corresponding stroke segment.

Parameters:
pt The point to use for hit testing.

Definition at line 691 of file InkErase.cs.

        {

            // Use HitTest to find the collection of strokes that are intersected
            // by the point.  The HitTestRadius constant is used to specify the
            // radius of the hit test circle in ink space coordinates (1 unit = .01mm).
            Strokes strokesHit = myInkCollector.Ink.HitTest(pt, HitTestRadius);

            // Loop over each stroke returned from the hit test to determine
            // which portion to erase...
            foreach (Stroke currentStroke in strokesHit)
            {

                // Retrieve the intersection of the stroke.
                float[] intersections = currentStroke.FindIntersections(myInkCollector.Ink.Strokes);

                // If there aren't any intersections, delete the entire stroke.
                if (intersections.Length <= 0)
                {
                    myInkCollector.Ink.DeleteStroke(currentStroke);
                }

                // If there is at least one intersection, determine which
                // intersections bound the hit-tested portion of the stroke,
                // split the stroke at these intersections, and delete the stroke
                // that defines the segment we hit-tested.
                else
                {
                    // Get the FINDEX of the nearest point on the stroke.  An FINDEX
                    // is a float value representing a location somewhere between two
                    // points in the stroke.  For instance, 0.0 is the first point in
                    // the stroke. 1.0 is the second point in the stroke. 0.5 is halfway
                    // between the first and second points.
                    float findex = currentStroke.NearestPoint(pt);

                    // If the hit occured before the first intersection, split the stroke
                    // at the current intersection and delete the beginning of the
                    // stroke
                    if (findex < intersections[0])
                    {
                        currentStroke.Split (intersections[0]);
                        myInkCollector.Ink.DeleteStroke(currentStroke);
                    }
                    else
                    {
                        // Declare the stroke segment to delete
                        Stroke strokeToDelete = null;

                        // Cycle through each intersection of the stroke to determine
                        // which intersections bound the hit-tested portion of the stroke...
                        for(int i = intersections.Length-1; i>=0; i--)
                        {

                            // If this intersection is less than the findex, the intersection
                            // occurs between this intersection and the one after it
                            if (intersections[i]<=findex)
                            {
                                // Provided we aren't at the end of the stroke, split at
                                // intersection i+1.
                                if (i < (intersections.Length-1))
                                {
                                    strokeToDelete = currentStroke.Split(intersections[i+1]);
                                }

                                // Split the stroke at the current intersection.  Keep in
                                // mind that the stroke has already been split at index i+1,
                                // so the delete will remove the segment from intersection i
                                // to i+1.
                                strokeToDelete = currentStroke.Split(intersections[i]);
                                myInkCollector.Ink.DeleteStroke(strokeToDelete);

                                break;
                            }
                        }
                    }
                }
            }

            if (strokesHit.Count > 0)
            {
                // Repaint the screen to reflect the change
                this.Refresh();
            }
        }

void InkErase::InkErase::EraseStrokes | ( | Point | pt,
 |  | Stroke | currentStroke |
 | ) |  |  | [inline, private]

Helper method that performs a hit test using the specified point.

It deletes all strokes that were hit by the point

Parameters:
pt The point to use for hit testing

Definition at line 781 of file InkErase.cs.

        {

            // Use HitTest to find the collection of strokes that are intersected
            // by the point.  The HitTestRadius constant is used to specify the
            // radius of the hit test circle in ink space coordinates (1 unit = .01mm).
            Strokes strokesHit = myInkCollector.Ink.HitTest(pt, HitTestRadius);

            if (null!=currentStroke && strokesHit.Contains(currentStroke))
            {
                strokesHit.Remove(currentStroke);
            }

            // Delete all strokes that were hit by the point
            myInkCollector.Ink.DeleteStrokes(strokesHit);

            if (strokesHit.Count > 0)
            {
                // Repaint the screen to reflect the change
                this.Refresh();
            }
        }

void InkErase::InkErase::InitializeComponent ( ) [inline, private]

Required method for Designer support - do not modify the contents of this method with the code editor.

Definition at line 141 of file InkErase.cs.

        {
            this.miMain = new System.Windows.Forms.MainMenu();
            this.miMainAction = new System.Windows.Forms.MenuItem();
            this.miClear = new System.Windows.Forms.MenuItem();
            this.miSeparator = new System.Windows.Forms.MenuItem();
            this.miExit = new System.Windows.Forms.MenuItem();
            this.miMainMode = new System.Windows.Forms.MenuItem();
            this.miInk = new System.Windows.Forms.MenuItem();
            this.miCuspErase = new System.Windows.Forms.MenuItem();
            this.miIntersectErase = new System.Windows.Forms.MenuItem();
            this.miStrokeErase = new System.Windows.Forms.MenuItem();
            //
            // miMain
            //
            this.miMain.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                                this.miMainAction,
                                                                                this.miMainMode});
            //
            // miMainAction
            //
            this.miMainAction.Index = 0;
            this.miMainAction.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                                this.miClear,
                                                                                this.miSeparator,
                                                                                this.miExit});
            this.miMainAction.Text = "&Action";
            //
            // miClear
            //
            this.miClear.Index = 0;
            this.miClear.Text = "&Clear";
            this.miClear.Click += new System.EventHandler(this.miClear_Click);
            //
            // miSeparator
            //
            this.miSeparator.Index = 1;
            this.miSeparator.Text = "-";
            //
            // miExit
            //
            this.miExit.Index = 2;
            this.miExit.Text = "E&xit";
            this.miExit.Click += new System.EventHandler(this.miExit_Click);
            //
            // miMainMode
            //
            this.miMainMode.Index = 1;
            this.miMainMode.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                                this.miInk,
                                                                                this.miCuspErase,
                                                                                this.miIntersectErase,
                                                                                this.miStrokeErase});
            this.miMainMode.Text = "&Mode";
            //
            // miInk
            //
            this.miInk.Checked = true;
            this.miInk.Index = 0;
            this.miInk.RadioCheck = true;
            this.miInk.Shortcut = System.Windows.Forms.Shortcut.CtrlI;
            this.miInk.Text = "&Ink";
            this.miInk.Click += new System.EventHandler(this.miInk_Click);
            //
            // miCuspErase
            //
            this.miCuspErase.Index = 1;
            this.miCuspErase.RadioCheck = true;
            this.miCuspErase.Shortcut = System.Windows.Forms.Shortcut.CtrlC;
            this.miCuspErase.Text = "Erase at &Cusps";
            this.miCuspErase.Click += new System.EventHandler(this.miCuspErase_Click);
            //
            // miIntersectErase
            //
            this.miIntersectErase.Index = 2;
            this.miIntersectErase.RadioCheck = true;
            this.miIntersectErase.Shortcut = System.Windows.Forms.Shortcut.CtrlN;
            this.miIntersectErase.Text = "Erase at I&ntersections";
            this.miIntersectErase.Click += new System.EventHandler(this.miIntersectErase_Click);
            //
            // miStrokeErase
            //
            this.miStrokeErase.Index = 3;
            this.miStrokeErase.RadioCheck = true;
            this.miStrokeErase.Shortcut = System.Windows.Forms.Shortcut.CtrlS;
            this.miStrokeErase.Text = "Erase &Strokes";
            this.miStrokeErase.Click += new System.EventHandler(this.miStrokeErase_Click);
            //
            // InkErase
            //
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize = new System.Drawing.Size(292, 267);
            this.Menu = this.miMain;
            this.Name = "InkErase";
            this.Text = "InkErase";
            this.Load += new System.EventHandler(this.InkErase_Load);
            this.Paint += new System.Windows.Forms.PaintEventHandler(this.InkErase_OnPaint);
            this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.InkErase_OnMouseMove);

        }

void InkErase::InkErase::InkErase_Load | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handle from form's Load event.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 259 of file InkErase.cs.

        {
            // Start the application in inking mode
            mode = ApplicationMode.Ink;

            // Create a new ink collector and assign it to this form's window
            myInkCollector = new InkCollector(Handle);

            // Turn off auto-redrawing since this sample application
            // needs to display the stroke cusps as red points over the strokes.
            // If autoredraw is enabled, the strokes will be drawn over
            // the red points, which will make the cusps hard to see.
            myInkCollector.AutoRedraw = false;

            // Set the pen width to be a medium width
            myInkCollector.DefaultDrawingAttributes.Width = MediumInkWidth;

            // Hook event handle for Cursor down event to myInkCollector_CursorDown.
            // This is necessary since the application needs to check if the cursor
            // is inverted and use the result to determine the visibility of the ink.
            myInkCollector.CursorDown += new InkCollectorCursorDownEventHandler(myInkCollector_CursorDown);

            // Hook event handle for NewPackets event to myInkCollector_NewPackets.
            // This is necessary since the application needs to examine new packets
            // when the cursor is inverted and use them to determine whether
            // any strokes should be erased.
            myInkCollector.NewPackets += new InkCollectorNewPacketsEventHandler(myInkCollector_NewPackets);

            // Hook event handle for the Stroke event to myInkCollector_Stroke.
            // This is necessary since the application needs to cancel strokes drawn
            // while the cursor is inverted.
            myInkCollector.Stroke += new InkCollectorStrokeEventHandler(myInkCollector_Stroke);

            // Turn the ink collector on
            myInkCollector.Enabled = true;
        }

void InkErase::InkErase::InkErase_OnMouseMove | ( | object | sender,
 |  | MouseEventArgs | e |
 | ) |  |  | [inline, private]

Event Handle from MouseMove event.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 301 of file InkErase.cs.

        {
            // If the application is in erase mode and a mouse button is
            // pressed, perform a hit test to determine which stroke segments
            // to erase (if any).
            if ( (ApplicationMode.Ink != mode) && (MouseButtons.None != MouseButtons) )
            {
                Point pt = new Point(e.X, e.Y);

                // Convert the specified point from pixel to ink space coordinates
                myInkCollector.Renderer.PixelToInkSpace(this.Handle, ref pt);

                switch(mode)
                {
                    case ApplicationMode.CuspErase:
                        EraseAtCusps(pt);
                        break;
                    case ApplicationMode.IntersectErase:
                        EraseAtIntersections(pt);
                        break;
                    case ApplicationMode.StrokeErase:
                        EraseStrokes(pt,null);
                        break;
                }
            }
        }

void InkErase::InkErase::InkErase_OnPaint | ( | object | sender,
 |  | PaintEventArgs | e |
 | ) |  |  | [inline, private]

Event Handle from Paint event.

It is necessary to handle the paint event since this sample needs to draw red points to indicate the strokes' cusps.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 335 of file InkErase.cs.

        {
            // Get the strokes to paint from the ink
            Strokes strokesToPaint = myInkCollector.Ink.Strokes;

            // Draw the strokes - note that it is necessary to manually
            // paint the strokes since auto-redrawing is set to false.
            myInkCollector.Renderer.Draw(e.Graphics, strokesToPaint);

            switch (mode)
            {
                case ApplicationMode.CuspErase:
                    PaintCusps(e.Graphics, strokesToPaint);
                    break;
                case ApplicationMode.IntersectErase:
                    PaintIntersections(e.Graphics, strokesToPaint);
                    break;
            }
        }

static void InkErase::InkErase::Main ( ) [inline, static, private]

The main entry point for the application.

Definition at line 248 of file InkErase.cs.

        {
            Application.Run(new InkErase());
        }

void InkErase::InkErase::miClear_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handle from Action->Clear menu.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 360 of file InkErase.cs.

        {
            Strokes strokesToDelete = myInkCollector.Ink.Strokes;

            // Check to ensure that the ink collector isn't currently
            // in the middle of a stroke before clearing the ink.
            // Deleting a stroke that is currently being collected
            // will result in an error condition.
            if (!myInkCollector.CollectingInk)
            {
                myInkCollector.Ink.DeleteStrokes(strokesToDelete);

                miInk_Click(sender, e);
            }
            else
            {
                MessageBox.Show("Cannot clear ink while the ink collector is busy.");
            }
        }

void InkErase::InkErase::miCuspErase_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handle from Mode->Cusp Erase menu.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 406 of file InkErase.cs.

        {
            UpdateApplicationMode(ApplicationMode.CuspErase);
        }

void InkErase::InkErase::miExit_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handle from Action->Exit menu.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 385 of file InkErase.cs.

        {
            myInkCollector.Enabled = false;
            Application.Exit();
        }

void InkErase::InkErase::miInk_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handle from Mode->Ink menu.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 396 of file InkErase.cs.

        {
            UpdateApplicationMode(ApplicationMode.Ink);
        }

void InkErase::InkErase::miIntersectErase_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handle from Mode->Intersect Erase menu.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 416 of file InkErase.cs.

        {
             UpdateApplicationMode(ApplicationMode.IntersectErase);
        }

void InkErase::InkErase::miStrokeErase_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handle from Mode->Stroke Erase menu.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 426 of file InkErase.cs.

        {
            UpdateApplicationMode(ApplicationMode.StrokeErase);
        }

void InkErase::InkErase::myInkCollector_CursorDown | ( | object | sender,
 |  | InkCollectorCursorDownEventArgs | e |
 | ) |  |  | [inline]

Event Handle from Cursor event.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 456 of file InkErase.cs.

        {
            // If the pen is inverted, this application will perform stroke
            // erasing; since we do not want to show the pen while the user
            // is erasing, make this stroke transparent.
            if (e.Cursor.Inverted)
            {
                e.Stroke.DrawingAttributes.Transparency = 255;
            }
        }

void InkErase::InkErase::myInkCollector_NewPackets | ( | object | sender,
 |  | InkCollectorNewPacketsEventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Ink Collector's NewPackets event.

This event is fired when the Ink Collector receives new packet data.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 475 of file InkErase.cs.

        {
            // If the cursor is inverted
            if (e.Cursor.Inverted)
            {

                // retrieve the size of each packet
                int packetSize = e.Stroke.PacketSize;

                Point pt = Point.Empty;

                // Perform a hit test with each point and delete
                // the hit strokes
                for (int i = 0; i < e.PacketCount; i++)
                {
                    // retrieve the x and y packet values
                    pt.X = e.PacketData[i*packetSize+XPacketIndex];
                    pt.Y = e.PacketData[i*packetSize+YPacketIndex];

                    EraseStrokes(pt,e.Stroke);
                }
            }
        }

void InkErase::InkErase::myInkCollector_Stroke | ( | object | sender,
 |  | InkCollectorStrokeEventArgs | e |
 | ) |  |  | [inline]

Event Handle from Stroke event.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 504 of file InkErase.cs.

        {
            if (e.Cursor.Inverted)
            {
                e.Cancel = true;
            }
        }

void InkErase::InkErase::PaintCusps | ( | Graphics | g,
 |  | Strokes | strokesToPaint |
 | ) |  |  | [inline, private]

Helper method to paint the stroke collection's cusps.

Parameters:
g | The graphics object to use for painting
strokesToPaint | The collection of strokes to paint

Definition at line 517 of file InkErase.cs.

        {
            // now draw PolylineCusp points
            foreach (Stroke currentStroke in strokesToPaint)
            {

                // Retrieve the cusps of the stroke.  The cusps mark the points where
                // the stroke changes direction abruptly.  A segment is defined as the
                // points between two cusps.
                int[] cusps = currentStroke.PolylineCusps;

                // Draw each cusp in the stroke
                foreach (int i in cusps)
                {

                    // Get the X, Y position of the cusp
                    Point pt = currentStroke.GetPoint(i);

                    // Convert the X, Y position to Window based pixel coordinates
                    myInkCollector.Renderer.InkSpaceToPixel(g, ref pt);

                    // Draw a red circle as the cusp position
                    g.DrawEllipse(Pens.Red, pt.X-3, pt.Y-3, 6, 6);
                }
            }
        }

void InkErase::InkErase::PaintIntersections | ( | Graphics | g,
 |  | Strokes | strokesToPaint |
 | ) |  |  | [inline, private]

Helper method to paint the stroke collection's intersections.

Parameters:
g | The graphics object to use for painting
strokesToPaint | The collection of strokes to paint

Definition at line 549 of file InkErase.cs.

        {
            // Draw the intersections of each stroke as little red circles
            foreach (Stroke currentStroke in strokesToPaint)
            {

                // Get the intersections of the stroke
                float[] intersections = currentStroke.FindIntersections(strokesToPaint);

                Point[] points = currentStroke.GetPoints();

                // Draw each intersection in the stroke
                foreach (float fi in intersections)
                {
                    // Get the point before the FINDEX
                    Point ptIntersect = currentStroke.GetPoint((int)fi);

                    // Find the fractional part of the FINDEX
                    float fiFraction = fi - (int)fi;

                    // if the fi does not have a fractional part, we have already
                    // found the intersection point.  Otherwise, use the FINDEX to
                    // calculate the interpolated intersection point on the stroke
                    if (fiFraction > 0.0f)
                    {
                        Point ptNextIntersect = currentStroke.GetPoint((int)fi + 1);
                        ptIntersect.X += (int)((ptNextIntersect.X - ptIntersect.X) * fiFraction);
                        ptIntersect.Y += (int)((ptNextIntersect.Y - ptIntersect.Y) * fiFraction);

                    }

                    // Convert the X, Y position to Window based pixel coordinates
                    myInkCollector.Renderer.InkSpaceToPixel(g, ref ptIntersect);

                    // Draw a red circle as the intersection position
                    g.DrawEllipse(Pens.Red, ptIntersect.X-3, ptIntersect.Y-3, 6, 6);
                }
            }
        }

void InkErase::InkErase::UpdateApplicationMode ( ApplicationMode newMode ) [inline, private]

Helper method to update the application mode.

Parameters:
newMode The new mode

Definition at line 435 of file InkErase.cs.

        {
            // Turn on/off the ink collector
            myInkCollector.Enabled = (ApplicationMode.Ink == newMode);

            // Update the state of the Ink and Erase menu items
            miInk.Checked = (ApplicationMode.Ink == newMode);
            miCuspErase.Checked  = (ApplicationMode.CuspErase == newMode);
            miIntersectErase.Checked = (ApplicationMode.IntersectErase == newMode);
            miStrokeErase.Checked = (ApplicationMode.StrokeErase == newMode);

            mode = newMode;

            Refresh();
        }

Member Data Documentation

System.ComponentModel.Container InkErase::InkErase::components = null [private]

Definition at line 103 of file InkErase.cs.

const float InkErase::InkErase::HitTestRadius = 30 [private]

Definition at line 78 of file InkErase.cs.

const float InkErase::InkErase::MediumInkWidth = 100 [private]

Definition at line 74 of file InkErase.cs.

System.Windows.Forms.MenuItem InkErase::InkErase::miClear [private]

Definition at line 96 of file InkErase.cs.

System.Windows.Forms.MenuItem InkErase::InkErase::miCuspErase [private]

Definition at line 101 of file InkErase.cs.

System.Windows.Forms.MenuItem InkErase::InkErase::miExit [private]

Definition at line 97 of file InkErase.cs.

System.Windows.Forms.MenuItem InkErase::InkErase::miInk [private]

Definition at line 94 of file InkErase.cs.

System.Windows.Forms.MenuItem InkErase::InkErase::miIntersectErase [private]

Definition at line 98 of file InkErase.cs.

System.Windows.Forms.MainMenu InkErase::InkErase::miMain [private]

Definition at line 100 of file InkErase.cs.

System.Windows.Forms.MenuItem InkErase::InkErase::miMainAction [private]

Definition at line 95 of file InkErase.cs.

System.Windows.Forms.MenuItem InkErase::InkErase::miMainMode [private]

Definition at line 93 of file InkErase.cs.

System.Windows.Forms.MenuItem InkErase::InkErase::miSeparator [private]

Definition at line 102 of file InkErase.cs.

System.Windows.Forms.MenuItem InkErase::InkErase::miStrokeErase [private]

Definition at line 99 of file InkErase.cs.

ApplicationMode InkErase::InkErase::mode = ApplicationMode.Ink [private]

Definition at line 89 of file InkErase.cs.

InkCollector InkErase::InkErase::myInkCollector [private]

Definition at line 70 of file InkErase.cs.

const int InkErase::InkErase::StrokePointRadius = 3 [private]

Definition at line 81 of file InkErase.cs.

const int InkErase::InkErase::XPacketIndex = 0 [private]

Definition at line 84 of file InkErase.cs.

const int InkErase::InkErase::YPacketIndex = 1 [private]

Definition at line 85 of file InkErase.cs.

The documentation for this class was generated from the following file:
  • TabletPC/InkErase/C#/InkErase.cs
Generated on Wed Nov 13 2024 16:58:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: InkHitTest::InkHitTest Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • InkHitTest
  • InkHitTest::InkHitTest
Public Member Functions | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes

InkHitTest::InkHitTest Class Reference

The InkHitTest Sample Application form class. More...

List of all members.

Public Member Functions

InkHitTest ()

Protected Member Functions

override void | Dispose (bool disposing)

Private Member Functions

void | clearCheck ()
void | enterHitTestMode (object sender, System.EventArgs e)
void | enterInkMode (object sender, System.EventArgs e)
void | enterNearestPointMode (object sender, System.EventArgs e)
void | handleHitTest (System.Windows.Forms.MouseEventArgs e)
void | handleNearestPoint (System.Windows.Forms.MouseEventArgs e)
void | InitializeComponent ()
void | InkHitTest_Load (object sender, System.EventArgs e)
void | InkHitTestForm_Paint (object sender, System.Windows.Forms.PaintEventArgs e)
void | miExit_Click (object sender, System.EventArgs e)
void | onClearClick (object sender, System.EventArgs e)
void | onMouseMove (object sender, System.Windows.Forms.MouseEventArgs e)

Static Private Member Functions

static void | Main ()

Private Attributes

Pen | activePen
Pen | blackPen
System.Windows.Forms.MenuItem | ClearItem
System.ComponentModel.Container | components = null
System.Windows.Forms.MenuItem | FileItem
const int | HitSize = 30
System.Windows.Forms.MenuItem | HitTestItem
InkCollector | ic
System.Windows.Forms.MenuItem | InkItem
Rectangle | invalidateRect
System.Windows.Forms.MainMenu | mainMenu1
System.Windows.Forms.MenuItem | miExit
ApplicationMode mode
System.Windows.Forms.MenuItem | ModeItem
System.Windows.Forms.MenuItem | NearestPointItem
Point | nearestPt = Point.Empty
Point | penPt = Point.Empty
Pen | redPen

Detailed Description

Definition at line 60 of file InkHitTest.cs.

Constructor & Destructor Documentation

InkHitTest::InkHitTest::InkHitTest ( ) [inline]

Definition at line 110 of file InkHitTest.cs.

        {
            #region Standard Template Code
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            #endregion
        }

Member Function Documentation

void InkHitTest::InkHitTest::clearCheck ( ) [inline, private]

small helper method to clear the Mode menu check marks

Definition at line 429 of file InkHitTest.cs.

        {
            switch(mode)
            {
                case ApplicationMode.Ink:
                    InkItem.Checked = false;
                    break;
                case ApplicationMode.HitTest:
                    HitTestItem.Checked = false;
                    break;
                case ApplicationMode.NearestPoint:
                    NearestPointItem.Checked = false;
                    break;
            }

            mode = ApplicationMode.None;
        }

override void InkHitTest::InkHitTest::Dispose ( bool disposing ) [inline, protected]

Clean up any resources being used.

Definition at line 124 of file InkHitTest.cs.

        {
            if( disposing )
            {
                if (components != null)
                {
                    components.Dispose();
                }
            }
            base.Dispose( disposing );
        }

void InkHitTest::InkHitTest::enterHitTestMode | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Mode->Hit Test Menu Item Helper function to enter HitTest mode.

In this mode, we highlight the cursor when it is over an ink stroke.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 374 of file InkHitTest.cs.

        {
            Cursor = System.Windows.Forms.Cursors.Cross;

            // Turn off the ink collector and set flags enable the hit
            // test code.
            clearCheck();
            mode = ApplicationMode.HitTest;
            HitTestItem.Checked = true;
            ic.Enabled = false;

            Invalidate(invalidateRect);
        }

void InkHitTest::InkHitTest::enterInkMode | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Mode->Ink Menu Item Helper function to enter Ink mode.

In this mode, the user can draw ink.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 355 of file InkHitTest.cs.

        {

            clearCheck();
            mode = ApplicationMode.Ink;
            InkItem.Checked = true;
            ic.Enabled = true;

            Invalidate(invalidateRect);
        }

void InkHitTest::InkHitTest::enterNearestPointMode | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Mode->Nearest Point Menu Item Helper function to enter NearestPoint mode.

In this mode, we draw a line to the nearest point in the ink from the current location of the cursor.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 396 of file InkHitTest.cs.

        {
            Cursor = System.Windows.Forms.Cursors.Default;

            // Turn off the ink collector and set flags to enable
            // the nearest point code
            clearCheck();
            mode = ApplicationMode.NearestPoint;
            NearestPointItem.Checked = true;
            ic.Enabled = false;

            Invalidate(invalidateRect);
        }

void InkHitTest::InkHitTest::handleHitTest ( System.Windows.Forms.MouseEventArgs e ) [inline, private]

Helper method implementing the hit test functionality.

Parameters:
e The mouse event args from MouseMove

Definition at line 451 of file InkHitTest.cs.

        {
            // remember two points:
            // 1.  the location of the pen
            // 2.  the location that is HitSize/2 pixels across from the pen
            //     location.  This will be the radius of our hit test area.
            Point pt1 = new Point(e.X, e.Y);
            Point pt2 = new Point(e.X + HitSize/2, e.Y);

            // Convert these points into ink space coordinates.  Recall that ink is
            // kept in a high dpi "ink space" by default.  Thus, we need to map
            // screen pixel locations to their corresponding locations in ink
            // space.  The distance between the X coordinates will be used to compute
            // the ink space radius of the hit test circle.  We can make this simplification
            // as long as the renderer has a scalar transformation (it wouldn't work if a
            // shear or rotation transformation had been applied to the renderer).
            //
            // For simplicity, we are assuming "square" pixels in this example.  As a result,
            // the hit test 'circle' will really be an ellispe on most monitors.  Applications
            // wishing to draw true circles, etc. will want to take the screen aspect ratio
            // into account for their pixel computations.
            Graphics g = CreateGraphics();
            ic.Renderer.PixelToInkSpace(g, ref pt1);
            ic.Renderer.PixelToInkSpace(g, ref pt2);
            g.Dispose();

            // Retrieve the strokes (if any) that are either completely inside or
            // intersected by the circular region around the pen.
            //
            // Note that this method takes the stroke's drawing attributes into account
            // when it computes the intersection, including the pen width, Bezier smoothing,
            // and shape of the pen tip.
            Strokes strokes = ic.Ink.HitTest(pt1, (float)(pt2.X - pt1.X));

            if( strokes.Count > 0 )
            {
                activePen = redPen;
            }
            else
            {
                activePen = blackPen;
            }

            // Clear out the previous drawing and trigger a draw
            Invalidate(invalidateRect);

            invalidateRect.X = e.X - HitSize/2;
            invalidateRect.Y = e.Y - HitSize/2;
            invalidateRect.Width = invalidateRect.Height = HitSize;

            // Since the hit test circle has thickness, it is necessary
            // to inflate the invalidation area to account for it (the
            // invalidation area is the hit test area + the pen width).
            invalidateRect.Inflate((int)activePen.Width, (int)activePen.Width);

            Invalidate(invalidateRect);
        }

void InkHitTest::InkHitTest::handleNearestPoint ( System.Windows.Forms.MouseEventArgs e ) [inline, private]

Helper function implementing the nearest point functionality.

Parameters:
e The mouse event args from MouseMove

Definition at line 513 of file InkHitTest.cs.

        {
            Graphics g = CreateGraphics();

            // Remeber pen location
            Point inkPenPt = new Point(e.X, e.Y);

            // Convert the pen location into a location in ink space
            ic.Renderer.PixelToInkSpace(g, ref inkPenPt);

            // Get the nearest point.  NearestPoint will return the
            // stroke *and* the index of the actual location within
            // the stroke.
            //
            // The location is represented as a floating point value.
            // 3.3 for example, would indicate that the nearest point
            // is 30% along the vector between point index 3 and point
            // index 4 in the stroke.

            float fIndex;
            Stroke stroke = ic.Ink.NearestPoint(inkPenPt, out fIndex);

            // Provided that the stroke isn't null, use the fIndex to
            // compute the ink space coordinates of the nearest point.
            if( stroke != null )
            {

                // If the findex lies directly over one of the stroke's
                // points, retrieve the coordinates of this point.
                if ((int)fIndex == fIndex)
                {
                    Point pt = stroke.GetPoint((int)fIndex);

                    nearestPt = new Point(pt.X, pt.Y);
                }
                    // Otherwise, it is necessary to approximate the coordinates
                    // of the stroke using the points on the stroke that bound
                    // the nearest point findex
                else
                {

                    // Retrieve the two points on the stroke on either side of
                    // the nearest point findex.
                    Point[] pts = stroke.GetPoints((int)fIndex, 2);

                    // Since we already handled the case where the findex was directly
                    // over one of the stroke's points, the call above should always
                    // return two points.
                    if( pts.Length == 2 )
                    {

                        // To compute the coordinates of the nearest point from
                        // the findex:  take the difference between the two points,
                        // scale it by the percentage offset, and then add the
                        // percentage offset back in.  This yeilds the following formula:
                        //
                        // X1 * p + X0 * q
                        // Y1 * p + Y0 * q
                        //
                        // Where:
                        // p == percentage offset from point 1
                        // q == percentage offset from point 2 (p-1)
                        //
                        float p = fIndex - (int)fIndex;
                        float q = 1F - p;
                        nearestPt = new Point((int)((float)(pts[1].X) * p + (float)(pts[0].X) * q),
                            (int)((float)(pts[1].Y) * p + (float)(pts[0].Y) * q ));

                    }
                }
            }
            else
            {
                // if there is no ink on the page, just reference ourselves.
                nearestPt = inkPenPt;
            }

            // Now that we have the ink space coordinates of the nearest
            // point, convert it back into pixel coordinates.  Again, we
            // assume perfectly square pixels in this example for simplicity.
            ic.Renderer.InkSpaceToPixel(g, ref nearestPt);

            // Clear out the previous drawing and trigger a draw
            Invalidate(invalidateRect);

            invalidateRect.X = Math.Min(e.X, nearestPt.X);
            invalidateRect.Y = Math.Min(e.Y, nearestPt.Y);
            invalidateRect.Width = Math.Abs(e.X - nearestPt.X);
            invalidateRect.Height = Math.Abs(e.Y - nearestPt.Y);

            // Since the red nearest point line has thickness, it is
            // necessary to inflate the invalidation area to account for it
            // (the invalidation area is the rectangle around the nearest point
            // line + the pen width).
            invalidateRect.Inflate((int)redPen.Width, (int)redPen.Width);

            Invalidate(invalidateRect);

            g.Dispose();
        }

void InkHitTest::InkHitTest::InitializeComponent ( ) [inline, private]

Required method for Designer support - do not modify the contents of this method with the code editor.

Definition at line 142 of file InkHitTest.cs.

        {
            this.mainMenu1 = new System.Windows.Forms.MainMenu();
            this.FileItem = new System.Windows.Forms.MenuItem();
            this.miExit = new System.Windows.Forms.MenuItem();
            this.ModeItem = new System.Windows.Forms.MenuItem();
            this.InkItem = new System.Windows.Forms.MenuItem();
            this.HitTestItem = new System.Windows.Forms.MenuItem();
            this.NearestPointItem = new System.Windows.Forms.MenuItem();
            this.ClearItem = new System.Windows.Forms.MenuItem();
            //
            // mainMenu1
            //
            this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                                this.FileItem,
                                                                                this.ModeItem,
                                                                                this.ClearItem});
            //
            // FileItem
            //
            this.FileItem.Index = 0;
            this.FileItem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                                this.miExit});
            this.FileItem.Text = "&File";

            //
            // miExit
            //
            this.miExit.Index = 0;
            this.miExit.Text = "E&xit";
            this.miExit.Click += new System.EventHandler(this.miExit_Click);
            //
            // ModeItem
            //
            this.ModeItem.Index = 1;
            this.ModeItem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                                this.InkItem,
                                                                                this.HitTestItem,
                                                                                this.NearestPointItem});
            this.ModeItem.Text = "&Mode";
            //
            // InkItem
            //
            this.InkItem.Checked = true;
            this.InkItem.Index = 0;
            this.InkItem.Text = "&Ink";
            this.InkItem.Click += new System.EventHandler(this.enterInkMode);
            //
            // HitTestItem
            //
            this.HitTestItem.Index = 1;
            this.HitTestItem.Text = "&Hit Test";
            this.HitTestItem.Click += new System.EventHandler(this.enterHitTestMode);
            //
            // NearestPointItem
            //
            this.NearestPointItem.Index = 2;
            this.NearestPointItem.Text = "&Nearest Point";
            this.NearestPointItem.Click += new System.EventHandler(this.enterNearestPointMode);
            //
            // ClearItem
            //
            this.ClearItem.Index = 2;
            this.ClearItem.Text = "&Clear!";
            this.ClearItem.Click += new System.EventHandler(this.onClearClick);
            //
            // InkHitTest
            //
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize = new System.Drawing.Size(292, 245);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
            this.MaximizeBox = false;
            this.Menu = this.mainMenu1;
            this.Name = "InkHitTest";
            this.Text = "Tablet PC InkHitTest Sample";
            this.Load += new System.EventHandler(this.InkHitTest_Load);
            this.Paint += new System.Windows.Forms.PaintEventHandler(this.InkHitTestForm_Paint);
            this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.onMouseMove);

        }

void InkHitTest::InkHitTest::InkHitTest_Load | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Form Load Event Setup the ink collector for collection.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 243 of file InkHitTest.cs.

        {
            //
            // Setup some useful objects for drawing
            //
            activePen = blackPen = new Pen(Color.Black, 3);
            redPen = new Pen(Color.Red, 3);
            invalidateRect = new Rectangle(0,0,0,0);

            //
            // Create the InkCollector, and turn it on
            //
            ic = new InkCollector(Handle);  // attach it to the form's frame window

            // default to inking mode
            mode = ApplicationMode.Ink;

            // turn the collector on
            ic.Enabled = true;

        }

void InkHitTest::InkHitTest::InkHitTestForm_Paint | ( | object | sender,
 |  | System.Windows.Forms.PaintEventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Form Paint Event.

This sample has a very straightforward repaint algorithm. We "know" at all times how to paint the control. Since AutoRedraw is on by default, the ink will take care of painting itself.

That leaves just repaints of the circle hit test cursor or the nearest point line. To simplify redraw, we just remember a "bounding box" for the area that we paint in the invalidateRect member variable. We will invalidate this region each time something new happens.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 303 of file InkHitTest.cs.

        {
            if( mode == ApplicationMode.HitTest)
            {
                e.Graphics.DrawEllipse(activePen, penPt.X - HitSize/2, penPt.Y - HitSize/2, HitSize, HitSize);
            }
            else if( mode == ApplicationMode.NearestPoint )
            {
                e.Graphics.DrawLine(redPen, penPt, nearestPt);
            }
        }

static void InkHitTest::InkHitTest::Main ( ) [inline, static, private]

The main entry point for the application.

Definition at line 229 of file InkHitTest.cs.

        {
            Application.Run(new InkHitTest());
        }

void InkHitTest::InkHitTest::miExit_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from File->Exit Menu Item.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 415 of file InkHitTest.cs.

        {
            // Although not required, it is good practice to disable
            // ink collection before exiting
            ic.Enabled = false;
            Application.Exit();
        }

void InkHitTest::InkHitTest::onClearClick | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Form Paint Event Clears all of the ink in the form.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 321 of file InkHitTest.cs.

        {
            // Retrieve all strokes in the ink object
            Strokes strokesToDelete = ic.Ink.Strokes;

            // Check to ensure that the ink collector isn't currently
            // in the middle of a stroke before clearing the ink.
            // Deleting a stroke that is currently being collected
            // will result in an error condition.
            if (!ic.CollectingInk)
            {

                // Delete the strokes from the ink object
                ic.Ink.DeleteStrokes(strokesToDelete);

                // Put the application in ink mode
                enterInkMode(sender, e);

                //go ahead and redraw the form, now that it has been cleared.
                Refresh();
            }
            else
            {
                MessageBox.Show("Cannot clear ink while the ink collector is busy");
            }
        }

void InkHitTest::InkHitTest::onMouseMove | ( | object | sender,
 |  | System.Windows.Forms.MouseEventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Form Mouse Move Event Handle Mouse/Pen movement.

If we are not in ink mode, then we will be doing either nearest point or hit test computations.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 272 of file InkHitTest.cs.

        {
            // Update the location of the pen
            penPt.X = e.X;
            penPt.Y = e.Y;

            if ( mode == ApplicationMode.HitTest)
            {
                handleHitTest(e);
            }
            else if (mode == ApplicationMode.NearestPoint)
            {
                handleNearestPoint(e);
            }
        }

Member Data Documentation

Pen InkHitTest::InkHitTest::activePen [private]

Definition at line 77 of file InkHitTest.cs.

Pen InkHitTest::InkHitTest::blackPen [private]

Definition at line 80 of file InkHitTest.cs.

System.Windows.Forms.MenuItem InkHitTest::InkHitTest::ClearItem [private]

Definition at line 98 of file InkHitTest.cs.

System.ComponentModel.Container InkHitTest::InkHitTest::components = null [private]

Required designer variable.

Definition at line 107 of file InkHitTest.cs.

System.Windows.Forms.MenuItem InkHitTest::InkHitTest::FileItem [private]

Definition at line 96 of file InkHitTest.cs.

const int InkHitTest::InkHitTest::HitSize = 30 [private]

Definition at line 67 of file InkHitTest.cs.

System.Windows.Forms.MenuItem InkHitTest::InkHitTest::HitTestItem [private]

Definition at line 100 of file InkHitTest.cs.

InkCollector InkHitTest::InkHitTest::ic [private]

Definition at line 74 of file InkHitTest.cs.

System.Windows.Forms.MenuItem InkHitTest::InkHitTest::InkItem [private]

Definition at line 99 of file InkHitTest.cs.

Rectangle InkHitTest::InkHitTest::invalidateRect [private]

Definition at line 90 of file InkHitTest.cs.

System.Windows.Forms.MainMenu InkHitTest::InkHitTest::mainMenu1 [private]

Definition at line 95 of file InkHitTest.cs.

System.Windows.Forms.MenuItem InkHitTest::InkHitTest::miExit [private]

Definition at line 102 of file InkHitTest.cs.

ApplicationMode InkHitTest::InkHitTest::mode [private]

Definition at line 92 of file InkHitTest.cs.

System.Windows.Forms.MenuItem InkHitTest::InkHitTest::ModeItem [private]

Definition at line 97 of file InkHitTest.cs.

System.Windows.Forms.MenuItem InkHitTest::InkHitTest::NearestPointItem [private]

Definition at line 101 of file InkHitTest.cs.

Point InkHitTest::InkHitTest::nearestPt = Point.Empty [private]

Definition at line 87 of file InkHitTest.cs.

Point InkHitTest::InkHitTest::penPt = Point.Empty [private]

Definition at line 84 of file InkHitTest.cs.

Pen InkHitTest::InkHitTest::redPen [private]

Definition at line 81 of file InkHitTest.cs.

The documentation for this class was generated from the following file:
  • TabletPC/InkHitTest/InkHitTest.cs
Generated on Wed Nov 13 2024 16:58:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: InkRecognition::InkRecognition Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • InkRecognition
  • InkRecognition::InkRecognition
Public Member Functions | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes

InkRecognition::InkRecognition Class Reference

The InkRecognition Sample Application form class. More...

List of all members.

Public Member Functions

InkRecognition ()

Protected Member Functions

override void | Dispose (bool disposing)

Private Member Functions

void | btnRecognize_Click (object sender, System.EventArgs e)
void | InitializeComponent ()
void | InkRecognition_Load (object sender, System.EventArgs e)

Static Private Member Functions

static void | Main ()

Private Attributes

System.Windows.Forms.Button | btnRecognize
System.ComponentModel.Container | components = null
System.Windows.Forms.GroupBox | gbInkArea
InkCollector | myInkCollector
Recognizers | myRecognizers
System.Windows.Forms.TextBox | txtResults

Detailed Description

Definition at line 40 of file InkRecognition.cs.

Constructor & Destructor Documentation

InkRecognition::InkRecognition::InkRecognition ( ) [inline]

Initialize the form and ink collector.

Definition at line 58 of file InkRecognition.cs.

    {
            #region Standard Template Code
      //
      // Required for Windows Form Designer support
      //
      InitializeComponent();
            #endregion

        }

Member Function Documentation

void InkRecognition::InkRecognition::btnRecognize_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handle recognize button click event.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 180 of file InkRecognition.cs.

        {
            // Check to ensure that the user has at least one recognizer installed
            // Note that this is a preventive check - otherwise, an exception will
            // occur during recognition.
            if (0 == myRecognizers.Count)
            {
                MessageBox.Show("There are no handwriting recognizers installed.  You need to have at least one in order to recognize ink.");
            }
            else
            {

                // Note that the Strokes' ToString() method is a
                // shortcut  for retrieving the best match using the
                // default recognizer.  The same result can also be
                // obtained using the RecognizerContext.  For an
                // example, uncomment the following lines of code:
                //
                // RecognizerContext myRecoContext = new RecognizerContext();
                // RecognitionStatus status;
                // RecognitionResult recoResult;
                //
                // myRecoContext.Strokes = myInkCollector.Ink.Strokes;
                // recoResult = myRecoContext.Recognize(out status);
                // txtResults.SelectedText = recoResult.TopString;
                //
                txtResults.SelectedText = myInkCollector.Ink.Strokes.ToString();

                // If the mouse is pressed, do not perform the deletion -
                // this prevents deleting a stroke that is still being drawn
                if (!myInkCollector.CollectingInk)
                {
                    // Once the strokes have been recognized, delete them
                    myInkCollector.Ink.DeleteStrokes();

                    // Repaint the drawing area
                    gbInkArea.Refresh();
                }
            }
        }

override void InkRecognition::InkRecognition::Dispose ( bool disposing ) [inline, protected]

Clean up any resources being used.

Definition at line 73 of file InkRecognition.cs.

    {
      if( disposing )
      {
        if (components != null)
        {
          components.Dispose();
        }
      }
      base.Dispose( disposing );
    }

void InkRecognition::InkRecognition::InitializeComponent ( ) [inline, private]

Required method for Designer support - do not modify the contents of this method with the code editor.

Definition at line 91 of file InkRecognition.cs.

    {
            this.gbInkArea = new System.Windows.Forms.GroupBox();
            this.btnRecognize = new System.Windows.Forms.Button();
            this.txtResults = new System.Windows.Forms.TextBox();
            this.SuspendLayout();
            //
            // gbInkArea
            //
            this.gbInkArea.Location = new System.Drawing.Point(8, 0);
            this.gbInkArea.Name = "gbInkArea";
            this.gbInkArea.Size = new System.Drawing.Size(280, 136);
            this.gbInkArea.TabIndex = 0;
            this.gbInkArea.TabStop = false;
            this.gbInkArea.Text = "Ink Here";
            //
            // btnRecognize
            //
            this.btnRecognize.Location = new System.Drawing.Point(8, 144);
            this.btnRecognize.Name = "btnRecognize";
            this.btnRecognize.Size = new System.Drawing.Size(280, 23);
            this.btnRecognize.TabIndex = 1;
            this.btnRecognize.Text = "Recognize Ink";
            this.btnRecognize.Click += new System.EventHandler(this.btnRecognize_Click);
            //
            // txtResults
            //
            this.txtResults.BackColor = System.Drawing.SystemColors.Window;
            this.txtResults.ForeColor = System.Drawing.SystemColors.WindowText;
            this.txtResults.Location = new System.Drawing.Point(8, 176);
            this.txtResults.Name = "txtResults";
            this.txtResults.ReadOnly = true;
            this.txtResults.Size = new System.Drawing.Size(280, 20);
            this.txtResults.TabIndex = 2;
            this.txtResults.Text = "";
            //
            // InkRecognition
            //
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize = new System.Drawing.Size(292, 206);
            this.Controls.AddRange(new System.Windows.Forms.Control[] {
                                                                          this.txtResults,
                                                                          this.btnRecognize,
                                                                          this.gbInkArea});
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
            this.MaximizeBox = false;
            this.Name = "InkRecognition";
            this.Text = "Ink Recognition Sample";
            this.Load += new System.EventHandler(this.InkRecognition_Load);
            this.ResumeLayout(false);

        }

void InkRecognition::InkRecognition::InkRecognition_Load | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Form Load Event Setup the ink collector for collection.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 162 of file InkRecognition.cs.

        {
            // Create the recognizers collection
            myRecognizers = new Recognizers();

            // Create a new ink collector that uses the group box handle
            myInkCollector = new InkCollector(gbInkArea.Handle);

            // Turn the ink collector on
            myInkCollector.Enabled = true;

        }

static void InkRecognition::InkRecognition::Main ( ) [inline, static, private]

The main entry point for the application.

Definition at line 150 of file InkRecognition.cs.

    {
      Application.Run(new InkRecognition());
    }

Member Data Documentation

System.Windows.Forms.Button InkRecognition::InkRecognition::btnRecognize [private]

Definition at line 50 of file InkRecognition.cs.

System.ComponentModel.Container InkRecognition::InkRecognition::components = null [private]

Definition at line 52 of file InkRecognition.cs.

System.Windows.Forms.GroupBox InkRecognition::InkRecognition::gbInkArea [private]

Definition at line 49 of file InkRecognition.cs.

InkCollector InkRecognition::InkRecognition::myInkCollector [private]

Definition at line 43 of file InkRecognition.cs.

Recognizers InkRecognition::InkRecognition::myRecognizers [private]

Definition at line 46 of file InkRecognition.cs.

System.Windows.Forms.TextBox InkRecognition::InkRecognition::txtResults [private]

Definition at line 51 of file InkRecognition.cs.

The documentation for this class was generated from the following file:
  • TabletPC/InkRecognition/C#/InkRecognition.cs
Generated on Wed Nov 13 2024 16:58:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: InstDef Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

InstDef Struct Reference

#include "Sample.h"

List of all members.

Public Attributes

long | lValue
WCHAR * | pwcKey

Detailed Description

Definition at line 240 of file Sample.h.

Member Data Documentation

long InstDef::lValue

Definition at line 242 of file Sample.h.

WCHAR * InstDef::pwcKey

Definition at line 241 of file Sample.h.

The documentation for this struct was generated from the following files:
  • SysMgmt/WMI/VC/ClassProv/Sample.h
  • SysMgmt/WMI/VC/InstProv/Sample.h
Generated on Wed Nov 13 2024 16:57:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: INVOKE_INFO Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

INVOKE_INFO Struct Reference

#include "session.h"

List of all members.

Public Attributes

BOOL fValid
AppletConfID nConfID
AppletNodeID nidInitiator

Detailed Description

Definition at line 197 of file session.h.

Member Data Documentation

BOOL INVOKE_INFO::fValid

Definition at line 199 of file session.h.

AppletConfID INVOKE_INFO::nConfID

Definition at line 200 of file session.h.

AppletNodeID INVOKE_INFO::nidInitiator

Definition at line 201 of file session.h.

The documentation for this struct was generated from the following file:
  • Web/NetMeeting/NMChat2/session.h
Generated on Wed Nov 13 2024 16:57:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ip_hdr Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

ip_hdr Struct Reference

#include "iphdr.h"

List of all members.

Public Attributes

unsigned short | ip_checksum
unsigned int | ip_destaddr
unsigned short | ip_id
unsigned short | ip_offset
unsigned char | ip_protocol
unsigned int | ip_srcaddr
unsigned char | ip_tos
unsigned short | ip_totallength
unsigned char | ip_ttl
unsigned char | ip_verlen

Detailed Description

Definition at line 17 of file iphdr.h.

Member Data Documentation

unsigned short ip_hdr::ip_checksum

Definition at line 27 of file iphdr.h.

unsigned int ip_hdr::ip_destaddr

Definition at line 29 of file iphdr.h.

unsigned short ip_hdr::ip_id

Definition at line 23 of file iphdr.h.

unsigned short ip_hdr::ip_offset

Definition at line 24 of file iphdr.h.

unsigned char ip_hdr::ip_protocol

Definition at line 26 of file iphdr.h.

unsigned int ip_hdr::ip_srcaddr

Definition at line 28 of file iphdr.h.

unsigned char ip_hdr::ip_tos

Definition at line 21 of file iphdr.h.

unsigned short ip_hdr::ip_totallength

Definition at line 22 of file iphdr.h.

unsigned char ip_hdr::ip_ttl

Definition at line 25 of file iphdr.h.

unsigned char ip_hdr::ip_verlen

Definition at line 19 of file iphdr.h.

The documentation for this struct was generated from the following files:
  • NetDS/WinSock/iphdrinc/iphdr.h
  • NetDS/WinSock/Ping/iphdr.h
  • NetDS/WinSock/rcvall/iphdr.h
Generated on Wed Nov 13 2024 16:57:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IPartitionProperties Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

IPartitionProperties Interface Reference

import "MyStorageResource.idl";

Inherits com::ms::com::IUnknown.

Inherited by CPartitionInfo.

List of all members.

Public Member Functions

HRESULT | HrGetFriendlyName (BSTR *pbstrNameOut)
HRESULT | HrIsNTFS (void)
HRESULT | HrIsThisLogicalDisk (WCHAR cLogicalDiskIn)
HRESULT | HrSetDeviceID (BSTR bstDeviceIDIn)

Detailed Description

Definition at line 118 of file MyStorageResource.idl.

Member Function Documentation

HRESULT IPartitionProperties::HrGetFriendlyName ( BSTR * pbstrNameOut )
HRESULT IPartitionProperties::HrIsNTFS ( void )
HRESULT IPartitionProperties::HrIsThisLogicalDisk ( WCHAR cLogicalDiskIn )
HRESULT IPartitionProperties::HrSetDeviceID ( BSTR bstDeviceIDIn )
The documentation for this interface was generated from the following file:
  • WinBase/Cluster/Win2003/MyStorageResource/MyStorageResource.idl
Generated on Wed Nov 13 2024 16:57:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IPluggableTransport Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

IPluggableTransport Interface Reference

import "iplgxprt.idl";

Inherits com::ms::com::IUnknown.

List of all members.

Public Member Functions

HRESULT | CloseConnection ([in] BSTR bstrConnectionID)
HRESULT | CreateConnection ([out] BSTR *pbstrConnectionID,[in] PLUGXPRT_CALL_TYPE eCaller,[in] DWORD dwProcessID,[in] HCOMMDEV hCommLink,[in] HEVENT hevtDataAvailable,[in] HEVENT hevtWriteReady,[in] HEVENT hevtConnectionClosed,[in] PLUGXPRT_FRAMING eFraming,[in] PLUGXPRT_PARAMETERS *pParams)
HRESULT | DisableWinsock ()
HRESULT | EnableWinsock ()

Detailed Description

Definition at line 82 of file iplgxprt.idl.

Member Function Documentation

HRESULT IPluggableTransport::CloseConnection ( [in] BSTR bstrConnectionID )
HRESULT IPluggableTransport::CreateConnection | ( | [out] BSTR * | pbstrConnectionID,
 |  | [in] PLUGXPRT_CALL_TYPE | eCaller,
 |  | [in] DWORD | dwProcessID,
 |  | [in] HCOMMDEV | hCommLink,
 |  | [in] HEVENT | hevtDataAvailable,
 |  | [in] HEVENT | hevtWriteReady,
 |  | [in] HEVENT | hevtConnectionClosed,
 |  | [in] PLUGXPRT_FRAMING | eFraming,
 |  | [in] PLUGXPRT_PARAMETERS * | pParams
 | ) |  |
HRESULT IPluggableTransport::DisableWinsock ( )
HRESULT IPluggableTransport::EnableWinsock ( )
The documentation for this interface was generated from the following file:
  • Web/NetMeeting/PlugTransport/iplgxprt.idl
Generated on Wed Nov 13 2024 16:57:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IPTLauncher Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

IPTLauncher Interface Reference

import "BrochureMachine.idl";

List of all members.

Public Member Functions

HRESULT LaunchPT ()

Detailed Description

Definition at line 20 of file BrochureMachine.idl.

Member Function Documentation

HRESULT IPTLauncher::LaunchPT ( )
The documentation for this interface was generated from the following file:
  • Web/Browser/BrochureMachine/BrochureMachine.idl
Generated on Wed Nov 13 2024 16:57:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ipv4_option_hdr Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

ipv4_option_hdr Struct Reference

#include "iphdr.h"

List of all members.

Public Attributes

unsigned long | opt_addr [9]
unsigned char | opt_code
unsigned char | opt_len
unsigned char | opt_ptr

Detailed Description

Definition at line 43 of file iphdr.h.

Member Data Documentation

unsigned long ipv4_option_hdr::opt_addr[9]

Definition at line 48 of file iphdr.h.

unsigned char ipv4_option_hdr::opt_code

Definition at line 45 of file iphdr.h.

unsigned char ipv4_option_hdr::opt_len

Definition at line 46 of file iphdr.h.

unsigned char ipv4_option_hdr::opt_ptr

Definition at line 47 of file iphdr.h.

The documentation for this struct was generated from the following file:
  • NetDS/WinSock/Ping/iphdr.h
Generated on Wed Nov 13 2024 16:57:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ipv6_fragment_hdr Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

ipv6_fragment_hdr Struct Reference

#include "iphdr.h"

List of all members.

Public Attributes

unsigned long | ipv6_frag_id
unsigned char | ipv6_frag_nexthdr
unsigned short | ipv6_frag_offset
unsigned char | ipv6_frag_reserved

Detailed Description

Definition at line 50 of file iphdr.h.

Member Data Documentation

unsigned long ipv6_fragment_hdr::ipv6_frag_id

Definition at line 55 of file iphdr.h.

unsigned char ipv6_fragment_hdr::ipv6_frag_nexthdr

Definition at line 52 of file iphdr.h.

unsigned short ipv6_fragment_hdr::ipv6_frag_offset

Definition at line 54 of file iphdr.h.

unsigned char ipv6_fragment_hdr::ipv6_frag_reserved

Definition at line 53 of file iphdr.h.

The documentation for this struct was generated from the following files:
  • NetDS/WinSock/iphdrinc/iphdr.h
  • NetDS/WinSock/Ping/iphdr.h
  • NetDS/WinSock/rcvall/iphdr.h
Generated on Wed Nov 13 2024 16:57:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ipv6_hdr Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

ipv6_hdr Struct Reference

#include "iphdr.h"

List of all members.

Public Attributes

struct in6_addr | ipv6_destaddr
unsigned char | ipv6_hoplimit
unsigned char | ipv6_nexthdr
unsigned short | ipv6_payloadlen
struct in6_addr | ipv6_srcaddr
unsigned long | ipv6_vertcflow

Detailed Description

Definition at line 35 of file iphdr.h.

Member Data Documentation

struct in6_addr ipv6_hdr::ipv6_destaddr

Definition at line 44 of file iphdr.h.

unsigned char ipv6_hdr::ipv6_hoplimit

Definition at line 42 of file iphdr.h.

unsigned char ipv6_hdr::ipv6_nexthdr

Definition at line 41 of file iphdr.h.

unsigned short ipv6_hdr::ipv6_payloadlen

Definition at line 40 of file iphdr.h.

struct in6_addr ipv6_hdr::ipv6_srcaddr

Definition at line 43 of file iphdr.h.

unsigned long ipv6_hdr::ipv6_vertcflow

Definition at line 37 of file iphdr.h.

The documentation for this struct was generated from the following files:
  • NetDS/WinSock/iphdrinc/iphdr.h
  • NetDS/WinSock/Ping/iphdr.h
  • NetDS/WinSock/rcvall/iphdr.h
Generated on Wed Nov 13 2024 16:57:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IRowsetChange Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

IRowsetChange Class Reference

Inherited by CImpIRowsetChange, IRowsetChangeImpl< T, Storage, RowClass >, and IRowsetChangeImpl< CMSOmniProvRowset, dummyStore >.

The documentation for this class was generated from the following file:
  • Dataaccess/oledb/omniprov/source/irowsetchange.h
Generated on Wed Nov 13 2024 16:57:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IRowsetChangeImpl< T, Storage, RowClass > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

IRowsetChangeImpl< T, Storage, RowClass > Class Template Reference

#include "irowsetchange.h"

Inherits IRowsetChange.

List of all members.

Public Member Functions

HRESULT | CreateHRow (LONG lRowsOffset, HROW *phRow)
HRESULT | CreateRecord (ULONG &cRowsObtained, HROW *phRow)
STDMETHOD() | DeleteRows (HCHAPTER hReserved, ULONG cRows, const HROW __RPC_FAR rghRows[], DBROWSTATUS __RPC_FAR rgRowStatus[])
STDMETHOD() | InsertRow (HCHAPTER hReserved, HACCESSOR hAccessor, void __RPC_FAR *pData, HROW __RPC_FAR *phRow)
STDMETHOD() | SetData (HROW hRow, HACCESSOR hAccessor, void __RPC_FAR *pData)

Detailed Description

template<class T, class Storage, class RowClass = CSimpleRow>
class IRowsetChangeImpl< T, Storage, RowClass >

Definition at line 22 of file irowsetchange.h.

Member Function Documentation

template<class T, class Storage, class RowClass = CSimpleRow>
HRESULT IRowsetChangeImpl< T, Storage, RowClass >::CreateHRow | ( | LONG | lRowsOffset,
 |  | HROW * | phRow |
 | ) |  |  | [inline]

Definition at line 199 of file irowsetchange.h.

    {
      T* pT = (T*) this;
      T::_HRowClass* pRow = NULL;
      ATLASSERT(lRowsOffset >= 0);
      T::_HRowClass::KeyType key = lRowsOffset+1;
      ATLASSERT(key > 0);
      pRow = pT->m_rgRowHandles.Lookup(key);
      if (pRow == NULL)
      {
        ATLTRY(pRow = new T::_HRowClass(lRowsOffset))  // Copy constructor
        if (pRow == NULL)
          return E_OUTOFMEMORY;
        if (!pT->m_rgRowHandles.Add(key, pRow))
          return E_OUTOFMEMORY;
      }
      // Doing the AddRef here
      pRow->AddRefRow();
      pT->m_bReset = false;
      if(phRow != NULL)
        *phRow = (HROW)key;

      return S_OK;
    }

template<class T, class Storage, class RowClass = CSimpleRow>
HRESULT IRowsetChangeImpl< T, Storage, RowClass >::CreateRecord | ( | ULONG & | cRowsObtained,
 |  | HROW * | phRow |
 | ) |  |  | [inline]

Definition at line 226 of file irowsetchange.h.

    {
      ATLTRACE2(atlTraceDBProvider, 0, "IRowsetChangeImpl::CreateRecord\n");
      HRESULT hr = S_OK;
      T* pT = (T*) this;

      CRow* pRow = new CRow();  // A New blank row inserted into the MM file
      if(pRow == NULL)
        return E_OUTOFMEMORY;

      // Need to Set the BookMark appropriately after creating the Row
      // Get the last Bookmark
      int tmpSize = pT->m_DBFile.m_Rows.m_nSize;
      DWORD newBkMrk;
      if (0 != tmpSize)
        newBkMrk = pT->m_DBFile.m_Rows[tmpSize-1]->m_bmk + 1;
      else  // When there are 0 records
        newBkMrk = 1;

      // Create new Row in the Row Array
      ATLCOLUMNINFO* pColInfo;  // Column Information structure
      ULONG cCols;  // # of cols.
      pColInfo =pT-> GetColumnInfo( pT,&cCols);
      if (!pT->m_DBFile.AddRow(pRow, pColInfo, cCols)) // This will add the CRow object to the file and initialize it
      {
        ATLTRACE2(atlTraceDBProvider, 0, _T("InsertRow : Unsuccessful in creating a Row\n"));
        // The Cleanup
        phRow = NULL;
        if(FAILED(pT->Fire_OnRowChange((T*)this, 1, phRow, DBREASON_ROW_INSERT, DBEVENTPHASE_FAILEDTODO, TRUE)))
          ATLTRACE2(atlTraceDBProvider, 0, "Failed to Fire DBREASON_ROW_INSERT in DBEVENTPHASE_FAILEDTODO phase\n");
        return E_FAIL;
      }

      // Set the new BookMark
      if(newBkMrk)
        pT->m_DBFile.m_Rows[tmpSize]->m_bmk= newBkMrk;

      // Add the data to the File
      if( FAILED(hr = pT->m_DBFile.InsertRowImmediate(pRow, pColInfo, cCols,false)) )
      {
        ATLTRACE2(atlTraceDBProvider, 0, _T("InsertRow : Unsuccessful in converting data\n"));
        // Clean-up the Rows of the Data Buffer
        if(!(pT->m_DBFile.m_Rows.Remove(pRow)) )
          _ASSERTE(0); // This should not happen...
        pT->m_iRowset--;
        phRow = NULL;
        if(FAILED(pT->Fire_OnRowChange((T*)this, 1, phRow, DBREASON_ROW_INSERT, DBEVENTPHASE_FAILEDTODO, TRUE)))
          ATLTRACE2(atlTraceDBProvider, 0, "Failed to Fire DBREASON_ROW_INSERT in DBEVENTPHASE_FAILEDTODO phase\n");
        return hr;
      }

      //Add the Row into the m_rgRowHandles
      if((hr=pT->CreateHRow(pT->m_DBFile.m_Rows.m_nSize - 1, phRow)) != S_OK)
      {
        ATLTRACE2(atlTraceDBProvider, 0, _T("InsertRow : Unsuccessful in creating a Row Handle\n"));
        // The Cleanup
        phRow = NULL;
        if(FAILED(pT->Fire_OnRowChange((T*)this, 1, phRow, DBREASON_ROW_INSERT, DBEVENTPHASE_FAILEDTODO, TRUE)))
          ATLTRACE2(atlTraceDBProvider, 0, "Failed to Fire DBREASON_ROW_INSERT in DBEVENTPHASE_FAILEDTODO phase\n");
        return hr;
      }

      if(FAILED(pT->Fire_OnRowChange((T*)this, 1, phRow, DBREASON_ROW_INSERT, DBEVENTPHASE_SYNCHAFTER, TRUE)))
        ATLTRACE2(atlTraceDBProvider, 0, "Failed to Fire DBREASON_ROW_INSERT in DBEVENTPHASE_SYNCHAFTER phase\n");

      if(FAILED(pT->Fire_OnRowChange((T*)this, 1, phRow, DBREASON_ROW_INSERT, DBEVENTPHASE_DIDEVENT, TRUE)))
      ATLTRACE2(atlTraceDBProvider, 0, "Failed to Fire DBREASON_ROW_INSERT in DBEVENTPHASE_DIDEVENT phase\n");

      return S_OK;
    }

template<class T, class Storage, class RowClass = CSimpleRow>
STDMETHOD() IRowsetChangeImpl< T, Storage, RowClass >::DeleteRows | ( | HCHAPTER | hReserved,
 |  | ULONG | cRows,
 |  | const HROW __RPC_FAR | rghRows[],
 |  | DBROWSTATUS __RPC_FAR | rgRowStatus[] |
 | ) |  |  | [inline]

Definition at line 516 of file irowsetchange.h.

    {
      ATLTRACE2(atlTraceDBProvider, 0, "IRowsetChangeImpl::DeleteRows\n");
      T* pT = (T*) this;
      T::ObjectLock cab((T*) pT);
      HRESULT hr = S_OK;

      HRESULT hrEvent = S_OK;
      if(FAILED(pT->Fire_OnRowChange((T*)this, cRows, rghRows, DBREASON_ROW_DELETE, DBEVENTPHASE_OKTODO, TRUE)))
      {
        ATLTRACE2(atlTraceDBProvider, 0, "Failed to Fire DBREASON_ROW_DELETE in DBEVENTPHASE_OKTODO phase\n");
        if(hrEvent==S_FALSE)
          return hrEvent;
      }
      // Putting a Lock on the object in the scope of this member function

  // A. Validation

      if(DB_NULL_HCHAPTER != hReserved)
      {
        ATLTRACE2(atlTraceDBProvider, 0, "IRowsetChangeImpl::DeleteRows: Chapters are not supported\n");
        return DB_E_NOTSUPPORTED;
      }

      if(cRows <= 0)
      {
        ATLTRACE2(atlTraceDBProvider, 0, "IRowsetChangeImpl::DeleteRows: Too few Rows\n");
        return E_INVALIDARG;
      }

      if(NULL == rghRows)
      {
        ATLTRACE2(atlTraceDBProvider, 0, "IRowsetChangeImpl::DeleteRows: Too few Row Handles\n");
        return E_INVALIDARG;
      }

      if(FAILED(pT->Fire_OnRowChange((T*)this, cRows, rghRows, DBREASON_ROW_DELETE, DBEVENTPHASE_ABOUTTODO, TRUE)))
        ATLTRACE2(atlTraceDBProvider, 0, "Failed to Fire DBREASON_ROW_DELETE in DBEVENTPHASE_ABOUTTODO phase\n");

  // B. Deleting the rows
      // Delete Rows dealing only with the m_rgRowData
      // ADO client Release the rows appropriately
      // The process of Deleting the rows

      for(ULONG i=0; i<cRows; i++)
      {
        // Find the Row from the handle
        T::_HRowClass *pHRow = pT->m_rgRowHandles.Lookup((T::_HRowClass::KeyType)rghRows[i]);
        if(!pHRow)
        {
          ATLTRACE2(atlTraceDBProvider, 0, _T("IRowsetChangeImpl::DeleteRows: Bad Row Handle\n"));
          if(rgRowStatus) rgRowStatus[i] = DBROWSTATUS_E_INVALID;
          if(FAILED(pT->Fire_OnRowChange((T*)this, cRows, rghRows, DBREASON_ROW_DELETE, DBEVENTPHASE_FAILEDTODO, TRUE)))
            ATLTRACE2(atlTraceDBProvider, 0, "Failed to Fire DBREASON_ROW_DELETE in DBEVENTPHASE_FAILEDTODO phase\n");
          return DB_E_BADROWHANDLE;
        }

        // The marking of the rows to be deleted is to be from the Buffer (m_rgRowData) itself
        // 1. rghRows[i] - handle of therow to deleted
        // 2. phRow - CSimpleRow in m_rgRowHandles whose m_aKey = rghRows[i]
        // 3. pHRow->m_iRowset - index of the row in the Data array
        // 4. pT->m_DBFile.m_Rows - the Data array
        hr = pT->m_DBFile.DeleteRowImmediate(pT->m_DBFile.m_Rows[pHRow->m_iRowset]);
        if (FAILED(hr))
        {
          ATLTRACE2(atlTraceDBProvider, 0, _T("IRowsetChangeImpl::DeleteRows: Unable to remove Row \n"));
          if(rgRowStatus) rgRowStatus[i] = DBROWSTATUS_E_FAIL;
          if(FAILED(pT->Fire_OnRowChange((T*)this, cRows, rghRows, DBREASON_ROW_DELETE, DBEVENTPHASE_FAILEDTODO, TRUE)))
            ATLTRACE2(atlTraceDBProvider, 0, "Failed to Fire DBREASON_ROW_DELETE in DBEVENTPHASE_FAILEDTODO phase\n");
          return DB_S_ERRORSOCCURRED;
        }

        if (rgRowStatus)
          rgRowStatus[i] = DBROWSTATUS_S_OK;

      }

    if(FAILED(pT->Fire_OnRowChange((T*)this, cRows, rghRows, DBREASON_ROW_DELETE, DBEVENTPHASE_SYNCHAFTER, TRUE)))
        ATLTRACE2(atlTraceDBProvider, 0, "Failed to Fire DBREASON_ROW_DELETE in DBEVENTPHASE_SYNCHAFTER phase\n");

    if(FAILED(pT->Fire_OnRowChange((T*)this, cRows, rghRows, DBREASON_ROW_DELETE, DBEVENTPHASE_DIDEVENT, TRUE)))
      ATLTRACE2(atlTraceDBProvider, 0, "Failed to Fire DBREASON_ROW_DELETE in DBEVENTPHASE_DIDEVENT phase\n");

    return hr;
     }

template<class T, class Storage, class RowClass = CSimpleRow>
STDMETHOD() IRowsetChangeImpl< T, Storage, RowClass >::InsertRow | ( | HCHAPTER | hReserved,
 |  | HACCESSOR | hAccessor,
 |  | void __RPC_FAR * | pData,
 |  | HROW __RPC_FAR * | phRow |
 | ) |  |  | [inline]

* [in] */ DBSTATUS dbsSrcStatus,

Definition at line 301 of file irowsetchange.h.

    {
      ATLTRACE2(atlTraceDBProvider, 0, "IRowsetChangeImpl::InsertRow\n");
      HRESULT hr;
      T* pT = (T*) this;
      // Putting a Lock on the object in the scope of this member function
      T::ObjectLock cab((T*) this);

      HRESULT hrEvent = S_OK;
      ULONG cRows = 1;

  // A. Validate

      // Chapters not supported
      if(DB_NULL_HCHAPTER != hReserved)
        return DB_E_NOTSUPPORTED;

      if (FAILED(hrEvent = pT->Fire_OnRowChange((T*)this, cRows, phRow, DBREASON_ROW_INSERT, DBEVENTPHASE_OKTODO, TRUE)))
      {
        ATLTRACE2(atlTraceDBProvider, 0, "Failed to Fire DBREASON_ROW_INSERT in DBEVENTPHASE_OKTODO phase\n");
        if(hrEvent==S_FALSE)
          return hrEvent;
      }
      // Check the Accessor Handle
      if(NULL==hAccessor)
      {
        ATLTRACE2(atlTraceDBProvider, 0, _T("InsertRow : Bad hAccessor\n"));
        return DB_E_BADACCESSORHANDLE;
      }
      // Check the Data pointer
      if(NULL== pData)
      {
        ATLTRACE2(atlTraceDBProvider, 0, _T("InsertRow : Data Pointer was NULL\n"));
        ULONG cRowsObtained=0;
        if(FAILED(pT->Fire_OnRowChange((T*)this, cRows, phRow, DBREASON_ROW_INSERT, DBEVENTPHASE_ABOUTTODO, TRUE)))
          ATLTRACE2(atlTraceDBProvider, 0, "Failed to Fire DBREASON_ROW_INSERT in DBEVENTPHASE_ABOUTTODO phase\n");
        // Create a new record if the pData pointer is NULL
        // The ADO Data Grid asks for a NULL or Default row during insertions
        return CreateRecord(cRowsObtained, phRow);
      }

  // B. Instantiation

      // 1. Instantiate the Bindings Accessor pointer and get the pointer to the row in m_rgBindings from the Accessor handle...
      // m_rgBindings for the Row Bindings oftype ATLBINDINGS or _BindType
      T::_BindType *pAccessor = pT->m_rgBindings.Lookup(hAccessor);
      if(!pAccessor)
      {
        ATLTRACE2(atlTraceDBProvider, 0, _T("InsertRow : Could not get Accessor\n"));
        return DB_E_BADACCESSORHANDLE;
      }

  //C. Preparing for Insertion

      // Check for a ROW accessor
      if(!(pAccessor->dwAccessorFlags & DBACCESSOR_ROWDATA))
      {
        ATLTRACE2(atlTraceDBProvider, 0, _T("InsertRow : Not a Row Accessor\n"));
        return DB_E_BADACCESSORHANDLE;
      }

      // Create a new row in the Row Array
      CRow * pRow = new CRow;
      ATLCOLUMNINFO* pColInfo;  // Column Information structure
      ULONG cCols;  // # of cols.
      pColInfo =pT-> GetColumnInfo( pT,&cCols);

      // Need to Set the BookMark appropriately after creating the Row
      // Get the last Bookmark
      int tmpSize = pT->m_DBFile.m_Rows.m_nSize;
      DWORD newBkMrk;
      if (0 != tmpSize)
        newBkMrk = pT->m_DBFile.m_Rows[tmpSize-1]->m_bmk + 1;
      else  // When there are 0 records
        newBkMrk = 1;

      // This will add the CRow object to the file and initialize it
      if (!pT->m_DBFile.AddRow(pRow, pColInfo, cCols))
      {
        ATLTRACE2(atlTraceDBProvider, 0, _T("InsertRow : Unsuccessful in creating a Row\n"));
        // The Cleanup
        phRow = NULL;
        if(FAILED(pT->Fire_OnRowChange((T*)this, 1, phRow, DBREASON_ROW_INSERT, DBEVENTPHASE_FAILEDTODO, TRUE)))
          ATLTRACE2(atlTraceDBProvider, 0, "Failed to Fire DBREASON_ROW_INSERT in DBEVENTPHASE_FAILEDTODO phase\n");
        return E_FAIL;
      }

      // Assign proxy buffer to the destination pointer
      BYTE * pRowData = pRow->m_pbProxyData;

      if(FAILED(pT->Fire_OnRowChange((T*)this, cRows, phRow, DBREASON_ROW_INSERT, DBEVENTPHASE_ABOUTTODO, TRUE)))
        ATLTRACE2(atlTraceDBProvider, 0, "Failed to Fire DBREASON_ROW_INSERT in DBEVENTPHASE_ABOUTTODO phase\n");

  //D. Inserting the Row

      ULONG cBindings = pAccessor->cBindings; // Total # of Bindings
      DBBINDING *pBinding = pAccessor->pBindings; // The DBBINDINGS structure pointer...
      for(ULONG iBind =0; iBind < cBindings; iBind++)
      {
        DBBINDING *pBindCur = &pBinding[iBind];
        // To ensure one or zero Bindings per Column
        for(ULONG iCol=0; iCol < cCols && pBindCur->iOrdinal != pColInfo[iCol].iOrdinal; iCol++);
        if(iCol == cCols)
        {
          if(FAILED(pT->Fire_OnRowChange((T*)this, cRows, phRow, DBREASON_ROW_INSERT, DBEVENTPHASE_FAILEDTODO, TRUE)))
            ATLTRACE2(atlTraceDBProvider, 0, "Failed to Fire DBREASON_ROW_INSERT in DBEVENTPHASE_FAILEDTODO phase\n");
          return DB_E_BADORDINAL;
        }
        ATLCOLUMNINFO* pColCur = &pColInfo[iCol];
        // Build up the 12 parameters to IConvertType::DataConvert(  )
        // 1. Types x 2
        DBTYPE wSrcType = pBindCur->wType;
        DBTYPE wDstType = pColCur->wType;
        // 2. Lengths x 2
        ULONG dwSrcLength = *((ULONG *)((BYTE*)pData + pBindCur->obLength));
        ULONG dwDstLength = pColCur->ulColumnSize;  // [in]/[out]
        // 3. Data ptrs or Offsets from the base ptrs - pRowData (Dst) and pDstData x 2
        BYTE *pSrc = (BYTE*)((BYTE*)pData + pBindCur->obValue);   // obValue contains the offset...
        BYTE *pDst = (BYTE*) ((BYTE*) pRowData + pColCur->cbOffset);
        // 4. Dst Max Length
        ULONG dwDstMaxLen = pColCur->ulColumnSize;
        // 5. Status x 2
        DWORD dwSrcStatus = pBindCur->obStatus;
        DWORD dwDstStatus;
        // 6. Precision - pBindCur->bPrecision;
        // 7. Scale - pBindCur->bScale;
        // 8. Convert Flags - DATACONVERT_SETDATABEHAVIOUR
        // Check on DBMEMBER_PROVIDEROWNED or DBMEMBER_PROVIDEROWNED
        BOOL bProvOwn = pBindCur->dwMemOwner == DBMEMOWNER_PROVIDEROWNED;
        bProvOwn;

        if(bProvOwn && pColCur->wType == pBindCur->wType)
          // If Provider owned and the types are the same then return the Src pointer to consumer
          pDst =  (BYTE*)((BYTE*)pData + pBindCur->obValue);
        else
        {
          // The memory is to be freed by consumer or types differ
          if(FAILED( hr = pT->m_spConvert->DataConvert(
                                          wSrcType,                         //* [in] */ DBTYPE wSrcType,
                                          wDstType,                         //* [in] */ DBTYPE wDstType,
                                          dwSrcLength,                      //* [in] */ ULONG cbSrcLength,
                                          &dwDstLength,                     //* [out][in] */ ULONG __RPC_FAR *pcbDstLength,
                                          pSrc,                             //* [in] */ void __RPC_FAR *pSrc,
                                          pDst,                             //* [out] */ void __RPC_FAR *pDst,
                                          dwDstMaxLen,                    //* [in] */ ULONG cbDstMaxLength,
                                          dwSrcStatus,                      ///* [in] */ DBSTATUS dbsSrcStatus,
                                          &dwDstStatus,                     //* [out] */ DBSTATUS __RPC_FAR *pdbsStatus,
                                          pBindCur->bPrecision,               //* [in] */ BYTE bPrecision,
                                          pBindCur->bScale,                   //* [in] */ BYTE bScale,
                                          DBDATACONVERT_SETDATABEHAVIOR //* [in] */ DBDATACONVERT dwFlags) = 0;
                                        )))
          {
            ATLTRACE2(atlTraceDBProvider, 0, _T("InsertRow : Unsuccessful in converting data\n"));
            // The Cleanup...
            pT->m_iRowset--;
            phRow = NULL;
            if(FAILED(pT->Fire_OnRowChange((T*)this, cRows, phRow, DBREASON_ROW_INSERT, DBEVENTPHASE_FAILEDTODO, TRUE)))
              ATLTRACE2(atlTraceDBProvider, 0, "Failed to Fire DBREASON_ROW_INSERT in DBEVENTPHASE_FAILEDTODO phase\n");
            return hr | E_FAIL;
          }
        }
      }

      // Set the new BookMark
      if(newBkMrk)
        pT->m_DBFile.m_Rows[tmpSize]->m_bmk= newBkMrk;

      // Insert the data into the Storage from
      //now that the data has been transfer to the proxy buffer, store to file
      if( FAILED(hr = pT->m_DBFile.InsertRowImmediate(pRow, pColInfo, cCols,true)) )
      {
        ATLTRACE2(atlTraceDBProvider, 0, _T("InsertRow : Unsuccessful in converting data\n"));
        // Clean-up the Rows of the Data Buffer
        if(!(pT->m_DBFile.m_Rows.Remove(pRow)) )
          _ASSERTE(0); // This should not happen...
        pT->m_iRowset--;
        phRow = NULL;
        if(FAILED(pT->Fire_OnRowChange((T*)this, cRows, phRow, DBREASON_ROW_INSERT, DBEVENTPHASE_FAILEDTODO, TRUE)))
          ATLTRACE2(atlTraceDBProvider, 0, "Failed to Fire DBREASON_ROW_INSERT in DBEVENTPHASE_FAILEDTODO phase\n");
        return hr;
      }

      //Add the Row into the m_rgRowHandles
      if((hr=pT->CreateHRow(pT->m_DBFile.m_Rows.m_nSize - 1, phRow)) != S_OK)
      {
        ATLTRACE2(atlTraceDBProvider, 0, _T("InsertRow : Unsuccessful in creating a Row Handle\n"));
        // Clean-up the Rows of the Data Buffer
        if(!(pT->m_DBFile.m_Rows.Remove(pRow)) )
          _ASSERTE(0); // This should not happen...
        // The Cleanup
        pT->m_iRowset--;
        phRow = NULL;
        if(FAILED(pT->Fire_OnRowChange((T*)this, 1, phRow, DBREASON_ROW_INSERT, DBEVENTPHASE_FAILEDTODO, TRUE)))
          ATLTRACE2(atlTraceDBProvider, 0, "Failed to Fire DBREASON_ROW_INSERT in DBEVENTPHASE_FAILEDTODO phase\n");
        return hr;
      }

      if(FAILED(pT->Fire_OnRowChange((T*)this, cRows, phRow, DBREASON_ROW_INSERT, DBEVENTPHASE_SYNCHAFTER, TRUE)))
          ATLTRACE2(atlTraceDBProvider, 0, "Failed to Fire DBREASON_ROW_INSERT in DBEVENTPHASE_SYNCHAFTER phase\n");

      if(FAILED(pT->Fire_OnRowChange((T*)this, cRows, phRow, DBREASON_ROW_INSERT, DBEVENTPHASE_DIDEVENT, TRUE)))
        ATLTRACE2(atlTraceDBProvider, 0, "Failed to Fire DBREASON_ROW_INSERT in DBEVENTPHASE_DIDEVENT phase\n");

      return S_OK;
    }

template<class T, class Storage, class RowClass = CSimpleRow>
STDMETHOD() IRowsetChangeImpl< T, Storage, RowClass >::SetData | ( | HROW | hRow,
 |  | HACCESSOR | hAccessor,
 |  | void __RPC_FAR * | pData |
 | ) |  |  | [inline]

* [in] */ DBSTATUS dbsSrcStatus,

Definition at line 29 of file irowsetchange.h.

    {
      ATLTRACE2(atlTraceDBProvider, 0, "IRowsetChangeImpl::SetData\n");
      HRESULT hr;
      T* pT = (T*) this;
      // Putting a Lock on the object in the scope of this member function
      T::ObjectLock cab((T*) this);

    // A. Validation
      // Check the Row Handle
      if(NULL==hRow)
      {
        ATLTRACE2(atlTraceDBProvider, 0, _T("SetData: Bad hRow\n"));
        return DB_E_BADROWHANDLE;
      }
      // Check the Accessor Handle
      if(NULL==hAccessor)
      {
        ATLTRACE2(atlTraceDBProvider, 0, _T("SetData : Bad hAccessor\n"));
        return DB_E_BADACCESSORHANDLE;
      }
      // Check the Data pointer
      if(NULL== pData)
      {
        ATLTRACE2(atlTraceDBProvider, 0, _T("SetData : Data Pointer was NULL\n"));
        return E_INVALIDARG;
      }
      // Getting the Row structure from the row handle
    // B. Instantiation
      // 1. Instantiate the T::_HRowClass pointer and get the pointer to the row in m_rgRowHandles from the Row handle...
      // m_rgHandles --- for the row handles
      T::_HRowClass *pHRow = pT->m_rgRowHandles.Lookup((T::_HRowClass::KeyType)hRow);
      if(!pHRow)
      {
        ATLTRACE2(atlTraceDBProvider, 0, _T("SetData : Could not get Accessor\n"));
        return DB_E_BADROWHANDLE;
      }
      CRow* pRow = pT->m_DBFile.m_Rows[pHRow->m_iRowset];
      if(!pRow)
      {
        ATLTRACE2(atlTraceDBProvider, 0, _T("SetData : Could not get Accessor\n"));
        return DB_E_BADROWHANDLE;
      }
      // 2. Instantiate the Bindings Accessor pointer and get the pointer to the row in m_rgBindings from the Accessor handle...
      // m_rgBindings for the Row Bindings oftype ATLBINDINGS or _BindType
      T::_BindType *pAccessor = pT->m_rgBindings.Lookup(hAccessor);
      if(!pAccessor)
      {
        ATLTRACE2(atlTraceDBProvider, 0, _T("SetData : Could not get Accessor\n"));
        return DB_E_BADACCESSORHANDLE;
      }
      // Now all the pointers are obtained ...
    // C. Updating
      // Check for a ROW accessor
      if(!(pAccessor->dwAccessorFlags & DBACCESSOR_ROWDATA))
      {
        ATLTRACE2(atlTraceDBProvider, 0, _T("SetData : Not a Row Accessor\n"));
        return DB_E_BADACCESSORHANDLE;
      }
      // Get pointer to the Row Data from the Data buffer for the handle from m_rgRowData of type _RowsetArrayType
      // Pointer returned is a Storage Class pointer...
      // The index lies in m_iRowset in IRowset
      //The data is taken out as a BYTE array

      // Get the column info about the Destination rowset i.e. in the Provider Buffer !!!
      ATLCOLUMNINFO* pColInfo;  // Column Information structure
      ULONG cCols;  // # of cols.
      pColInfo = pT->GetColumnInfo((T*) this,&cCols);
      // D. Transfer data into the Data Buffer for Updation
      ULONG cBindings = pAccessor->cBindings; // Total # of Bindings
      DBBINDING *pBinding = pAccessor->pBindings; // The DBBINDINGS structure pointer...
      HRESULT hrEvent;

      for(ULONG iBind =0; iBind < cBindings; iBind++)
      {
        DBBINDING *pBindCur = &pBinding[iBind];
        // To ensure one or zero Bindings per Column
        for(ULONG iCol=0; iCol < cCols && pBindCur->iOrdinal != pColInfo[iCol].iOrdinal; iCol++);
        if(iCol == cCols)
        {
          return DB_E_BADORDINAL;
        }
        ATLCOLUMNINFO* pColCur = &pColInfo[iCol];
        if (FAILED(hrEvent = pT->Fire_OnFieldChange((T*)this,  hRow, 1,&iCol, DBREASON_COLUMN_SET, DBEVENTPHASE_OKTODO, TRUE)))
        {
          ATLTRACE2(atlTraceDBProvider, 0, "Failed to Fire DBREASON_COLUMN_SET in DBEVENTPHASE_OKTODO phase\n");
          if(hrEvent==S_FALSE)
            return hrEvent;
        }
        if(FAILED(hrEvent = pT->Fire_OnFieldChange((T*)this,  hRow, 1,&iCol, DBREASON_COLUMN_SET, DBEVENTPHASE_ABOUTTODO, TRUE)))
          ATLTRACE2(atlTraceDBProvider, 0, "Failed to Fire DBREASON_COLUMN_SET in DBEVENTPHASE_ABOUTTODO phase\n");
        // 1. Build up the 12 parameters to IConvertType::DataConvert(  )
        // 1. Types x 2
        DBTYPE wSrcType = pBindCur->wType;
        DBTYPE wDstType = pColCur->wType;
        // 2. Lengths x 2
        //DANK: Changed the following line as it was calculating the dwSrcLength incorrectly. This caused a problem
        //      in rowsetviewer when I change the last record, last column value from 300 to 400. IDataConvert would
        //      fail with errors occurred
        ULONG dwSrcLength = *((ULONG *)((BYTE*)pData + pBindCur->obLength));
        //ULONG dwDstLength = dwSrcLength;  // [in]/[out]
        ULONG dwDstLength = pColCur->ulColumnSize;  // [in]/[out]
        // 3. Data ptrs or Offsets from the base ptrs - pRowData (Dst) and pDstData x 2
        BYTE *pSrc = (BYTE*)((BYTE*)pData + pBindCur->obValue);   // obValue contains the offset...
        BYTE *pDst = (BYTE*) ((BYTE*) pRow->m_pbProxyData + pColCur->cbOffset);
        // 4. Dst Max Length
        ULONG dwDstMaxLen = pColCur->ulColumnSize;
        // 5. Status x 2
        DWORD dwSrcStatus = pBindCur->obStatus;
        DWORD dwDstStatus;
        // 6. Precision - pBindCur->bPrecision;
        // 7. Scale - pBindCur->bScale;
        // 8. Convert Flags - DATACONVERT_SETDATABEHAVIOUR
        T* pT = (T*) this;
        // Check on DBMEMBER_PROVIDEROWNED or DBMEMBER_PROVIDEROWNED
        BOOL bProvOwn = pBindCur->dwMemOwner == DBMEMOWNER_PROVIDEROWNED;
        bProvOwn;
        // Initialize the Destination Memory to all 0's to remove the junk seen after the string data
        //memset(pDst,0,dwDstMaxLen);
        if(bProvOwn && pColCur->wType == pBindCur->wType)
          // If Provider owned and the types are the same then return the Src pointer to consumer
          pDst =  (BYTE*)((BYTE*)pData + pBindCur->obValue);
        else
        {
          // The memory is to be freed by consumer or types differ
          if(FAILED( hr = pT->m_spConvert->DataConvert(
                                          wSrcType,                         //* [in] */ DBTYPE wSrcType,
                                          wDstType,                         //* [in] */ DBTYPE wDstType,
                                          dwSrcLength,                      //* [in] */ ULONG cbSrcLength,
                                          &dwDstLength,                     //* [out][in] */ ULONG __RPC_FAR *pcbDstLength,
                                          pSrc,                             //* [in] */ void __RPC_FAR *pSrc,
                                          pDst,                             //* [out] */ void __RPC_FAR *pDst,
                                          dwDstMaxLen,                    //* [in] */ ULONG cbDstMaxLength,
                                          dwSrcStatus,                      ///* [in] */ DBSTATUS dbsSrcStatus,
                                          &dwDstStatus,                     //* [out] */ DBSTATUS __RPC_FAR *pdbsStatus,
                                          pBindCur->bPrecision,               //* [in] */ BYTE bPrecision,
                                          pBindCur->bScale,                   //* [in] */ BYTE bScale,
                                          DBDATACONVERT_SETDATABEHAVIOR //* [in] */ DBDATACONVERT dwFlags) = 0;
                                        )))
          {
            //TODO: Need to handle failure
            if(FAILED(hrEvent = pT->Fire_OnFieldChange((T*)this,  hRow, 1,&iCol, DBREASON_COLUMN_SET, DBEVENTPHASE_FAILEDTODO, TRUE)))
              ATLTRACE2(atlTraceDBProvider, 0, "Failed to Fire DBREASON_COLUMN_SET in DBEVENTPHASE_FAILEDTODO phase\n");
            return hr;
          }
        }
        // 2. Write the data to the Storage
        if( FAILED(hr=pT->m_DBFile.UpdateRowImmediate(pRow, pT->m_prgColInfo, pT->m_cCols)) )
        {
          ATLTRACE2(atlTraceDBProvider, 0, _T("SetData : Unsuccessful in writing data to storage\n"));
          // Clean-up the Rows of the Data Buffer
          if(FAILED(hrEvent = pT->Fire_OnFieldChange((T*)this,  hRow, 1,&iCol, DBREASON_COLUMN_SET, DBEVENTPHASE_FAILEDTODO, TRUE)))
            ATLTRACE2(atlTraceDBProvider, 0, "Failed to Fire DBREASON_COLUMN_SET in DBEVENTPHASE_FAILEDTODO phase\n");
          return hr;
        }

        if(FAILED(pT->Fire_OnFieldChange((T*)this, hRow, 1, &iCol, DBREASON_COLUMN_SET, DBEVENTPHASE_SYNCHAFTER, TRUE)))
          ATLTRACE2(atlTraceDBProvider, 0, "Failed to Fire DBREASON_COLUMN_SET in DBEVENTPHASE_SYNCHAFTER phase\n");

        if(FAILED(pT->Fire_OnFieldChange((T*)this, hRow, 1, &iCol, DBREASON_COLUMN_SET, DBEVENTPHASE_DIDEVENT, TRUE)))
          ATLTRACE2(atlTraceDBProvider, 0, "Failed to Fire DBREASON_COLUMN_SET in DBEVENTPHASE_DIDEVENT phase\n");

        if(FAILED(pT->Fire_OnFieldChange((T*)this, hRow, 1, &iCol, DBREASON_COLUMN_RECALCULATED, DBEVENTPHASE_DIDEVENT, TRUE)))
          ATLTRACE2(atlTraceDBProvider, 0, "Failed to Fire DBREASON_COLUMN_SET in DBEVENTPHASE_DIDEVENT phase\n");
      }
      return S_OK;
    }

The documentation for this class was generated from the following file:
  • Dataaccess/oledb/omniprov/source/irowsetchange.h
Generated on Wed Nov 13 2024 16:57:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IRowsetScrollImpl< T, RowsetInterface > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions

IRowsetScrollImpl< T, RowsetInterface > Class Template Reference

#include "irowsetscroll.h"

List of all members.

Public Member Functions

STDMETHOD() | Compare (HCHAPTER hReserved, ULONG cbBookmark1, const BYTE *pBookmark1, ULONG cbBookmark2, const BYTE *pBookmark2, DBCOMPARE *pComparison)
STDMETHOD() | GetApproximatePosition (HCHAPTER hReserved, ULONG cbBookmark, const BYTE __RPC_FAR *pBookmark, ULONG __RPC_FAR *pulPosition, ULONG __RPC_FAR *pcRows)
STDMETHOD() | GetRowsAt (HWATCHREGION hReserved1, HCHAPTER hReserved2, ULONG cbBookmark, const BYTE *pBookmark, LONG lRowsOffset, LONG cRows, ULONG *pcRowsObtained, HROW **prghRows)
STDMETHOD() | GetRowsAtRatio (HWATCHREGION hReserved1, HCHAPTER hReserved2, ULONG ulNumerator, ULONG ulDenominator, LONG cRows, ULONG __RPC_FAR *pcRowsObtained, HROW __RPC_FAR *__RPC_FAR *prghRows)
STDMETHOD() | GetRowsByBookmark (HCHAPTER hReserved, ULONG cRows, const ULONG rgcbBookmarks[], const BYTE *rgpBookmarks[], HROW rghRows[], DBROWSTATUS rgRowStatus[])
STDMETHOD() | Hash (HCHAPTER hReserved, ULONG cBookmarks, const ULONG rgcbBookmarks[], const BYTE *rgpBookmarks[], DWORD rgHashedValues[], DBROWSTATUS rgBookmarkStatus[])

Protected Member Functions

HRESULT | HashBmk (ULONG cbBmk, const BYTE *pbBmk, ULONG *pdwHashedValue, ULONG ulTableSize=0xffffffff)
HRESULT | ValidateBookmark (ULONG cbBookmark, const BYTE *pBookmark)

Detailed Description

template<class T, class RowsetInterface = IRowsetScroll>
class IRowsetScrollImpl< T, RowsetInterface >

Definition at line 24 of file irowsetscroll.h.

Member Function Documentation

template<class T , class RowsetInterface = IRowsetScroll>
STDMETHOD() IRowsetScrollImpl< T, RowsetInterface >::Compare | ( | HCHAPTER | hReserved,
 |  | ULONG | cbBookmark1,
 |  | const BYTE * | pBookmark1,
 |  | ULONG | cbBookmark2,
 |  | const BYTE * | pBookmark2,
 |  | DBCOMPARE * | pComparison |
 | ) |  |  | [inline]

Definition at line 138 of file irowsetscroll.h.

  {
    ATLTRACE("IRowsetLocateImpl::Compare");
    T* pT = (T*)this;
    T::ObjectLock cab((T*) pT);
    if(DB_NULL_HCHAPTER != hReserved)
      return DB_E_NOTSUPPORTED;
    HRESULT hr = ValidateBookmark(cbBookmark1, pBookmark1);
    if (hr != S_OK)
      return hr;
    hr = ValidateBookmark(cbBookmark2, pBookmark2);
    if (hr != S_OK)
      return hr;

    // Return the value based on the bookmark values
    if (*pBookmark1 == *pBookmark2)
      *pComparison = DBCOMPARE_EQ;

    if (*pBookmark1 < *pBookmark2)
      *pComparison = DBCOMPARE_LT;

    if (*pBookmark1 > *pBookmark2)

template<class T , class RowsetInterface = IRowsetScroll>
STDMETHOD() IRowsetScrollImpl< T, RowsetInterface >::GetApproximatePosition | ( | HCHAPTER | hReserved,
 |  | ULONG | cbBookmark,
 |  | const BYTE __RPC_FAR * | pBookmark,
 |  | ULONG __RPC_FAR * | pulPosition,
 |  | ULONG __RPC_FAR * | pcRows |
 | ) |  |  | [inline]

Definition at line 24 of file irowsetscroll.h.

                                      : public IRowsetImpl<T, IRowsetScroll>
{
public:
    STDMETHOD (GetApproximatePosition)(
        /* [in] */ HCHAPTER hReserved,
        /* [in] */ ULONG cbBookmark,
        /* [size_is][in] */ const BYTE __RPC_FAR *pBookmark,
        /* [out] */ ULONG __RPC_FAR *pulPosition,
        /* [out] */ ULONG __RPC_FAR *pcRows)
  {
    ATLTRACE2(atlTraceDBProvider, 0, "IRowsetScrollImpl::GetApproximatePosition\n");
    HRESULT hr;
    T* pT = (T*)this;
    T::ObjectLock cab((T*) pT);
    if(DB_NULL_HCHAPTER != hReserved)
      return DB_E_NOTSUPPORTED;

    // DANK: RowsetViewer was getting an error as it would use this function to get the
    //       approximate number of rows. I modified to  do the arg checking earlier before the
    //       bookmark validation
    if(pulPosition == NULL && pcRows == NULL)
      return S_OK;

    if(cbBookmark == 0)
    {
      if (*pcRows != NULL)
        *pcRows = pT->m_rgRowHandles.GetSize();
      return S_OK;
    }

    // SQLOLEDB does not have this implemented MDAC 2.1 SP2...
    // Validate the bookmarks only if a bookmark is specified
    // If No-op
    hr = ValidateBookmark(cbBookmark, pBookmark);
    if(hr != S_OK)
      return hr;
    // This deals with all the ros inside the rowset after a GetNextRows( )...
    // Hence, operations are confined to m_rgRowHandles
    // There is no change to the state of the cursor just return the number of rows between m_iRowset and the current bookmark...
    // *pcRows should always be greater than *pulPosition !!

    // Now if cbBookmark != 0 and pBookmark is valid-> check pBookmark and find the ulPosition and pcRows
    if(pBookmark != NULL)
    {
      ULONG iRowsetTemp = pT->m_iRowset;  // Cache the current rowset
      if ((cbBookmark == 1) && (*pBookmark == DBBMK_FIRST))
        iRowsetTemp = 1;
      if ((cbBookmark == 1) && (*pBookmark == DBBMK_LAST))
      //  iRowsetTemp = pT->m_rgRowData.GetSize();
        iRowsetTemp = pT->m_DBFile.m_Rows.GetSize();
      // m_iRowset - From current cursor get current Bookmark
      // Check if iRowsetTemp exists in the current current
      // Need to economize this if many rows exist in the cursor....
      for(LONG i =0 ; i < pT->m_rgRowHandles.m_nSize && m_rgRowHandles.m_aVal[i]->m_iRowset != (LONG) iRowsetTemp; i++);
      if( i >= pT->m_rgRowHandles.m_nSize )
        return DB_E_BADBOOKMARK;
      //ULONG dwCurBkmrk = pT->m_rgRowData[iRowsetTemp].m_dwBookmark;
      ULONG dwCurBkmrk = pT->m_DBFile.m_Rows[iRowsetTemp]->m_bmk;

      if( (*pBookmark < dwCurBkmrk) )
        return DB_E_BADBOOKMARK;
      ULONG ulNumRows = *pBookmark - dwCurBkmrk;
      *pulPosition = iRowsetTemp;
      *pcRows = ulNumRows;
    }

template<class T , class RowsetInterface = IRowsetScroll>
STDMETHOD() IRowsetScrollImpl< T, RowsetInterface >::GetRowsAt | ( | HWATCHREGION | hReserved1,
 |  | HCHAPTER | hReserved2,
 |  | ULONG | cbBookmark,
 |  | const BYTE * | pBookmark,
 |  | LONG | lRowsOffset,
 |  | LONG | cRows,
 |  | ULONG * | pcRowsObtained,
 |  | HROW ** | prghRows |
 | ) |  |  | [inline]

Definition at line 166 of file irowsetscroll.h.

  {
    ATLTRACE("IRowsetScrollImpl::GetRowsAt\n");
    T* pT = (T*)this;
    T::ObjectLock cab((T*) pT);
    if(DB_NULL_HCHAPTER != hReserved2)
      return DB_E_NOTSUPPORTED;
    // Check bookmark
    HRESULT hr = ValidateBookmark(cbBookmark, pBookmark);
    if (hr != S_OK)
      return hr;

    // Check the other pointers
    if (pcRowsObtained == NULL || prghRows == NULL)
      return E_INVALIDARG;

    // Set the current row position to the bookmark.  Handle any
    // normal values

    // We need to handle the offset as the start position is defined
    // as the bookmark + offset.  If the offset is negative, and we
    // do not have m_bCanScrollBack then return an error.  The
    // GetNextRows function handles the case where cRows is negative
    // and we don't have m_bCanFetchBack set.
    if (lRowsOffset < 0 && !pT->m_bCanScrollBack)
      return DB_E_CANTSCROLLBACKWARDS;
    if (cRows < 0 && !pT->m_bCanFetchBack)
      return DB_E_CANTFETCHBACKWARDS;

    LONG iRowsetTemp = pT->m_iRowset;  // Cache the current rowset
    pT->m_iRowset = *pBookmark;
    if ((cbBookmark == 1) && (*pBookmark == DBBMK_FIRST))
      pT->m_iRowset = 1;

    if ((cbBookmark == 1) && (*pBookmark == DBBMK_LAST))
//      pT->m_iRowset = pT->m_rgRowData.GetSize();
      pT->m_iRowset = pT->m_DBFile.m_Rows.GetSize();

    // Set the start position to m_iRowset + lRowsOffset
    pT->m_iRowset += lRowsOffset;
    if (lRowsOffset >= 0)
      (cRows >= 0) ? pT->m_iRowset -= 1 : pT->m_iRowset +=0;
    else
      (cRows >= 0) ? pT->m_iRowset -= 1 : pT->m_iRowset +=0;
//      (lRowsOffset >= 0) ? m_iRowset -= 1 : m_iRowset += 1;
    // TODO: this is not very generic - perhaps there is something we can do here
    if (pT->m_iRowset < 0 || pT->m_iRowset > (DWORD)pT->m_DBFile.m_Rows.GetSize())
    {
      pT->m_iRowset = iRowsetTemp;
      return DB_E_BADSTARTPOSITION; // For 1.x Provider
    }

    // Call IRowsetImpl::GetNextRows to actually get the rows.
    hr = pT->GetNextRows(hReserved2, 0, cRows, pcRowsObtained, prghRows);
    pT->m_iRowset = iRowsetTemp;
    // Send notification message
    if(FAILED(pT->Fire_OnRowChange(this, cRows, *prghRows, DBREASON_ROW_ACTIVATE, DBEVENTPHASE_DIDEVENT, TRUE)))

template<class T , class RowsetInterface = IRowsetScroll>
STDMETHOD() IRowsetScrollImpl< T, RowsetInterface >::GetRowsAtRatio | ( | HWATCHREGION | hReserved1,
 |  | HCHAPTER | hReserved2,
 |  | ULONG | ulNumerator,
 |  | ULONG | ulDenominator,
 |  | LONG | cRows,
 |  | ULONG __RPC_FAR * | pcRowsObtained,
 |  | HROW __RPC_FAR *__RPC_FAR * | prghRows |
 | ) |  |  | [inline]

Definition at line 90 of file irowsetscroll.h.

  {
    ATLTRACE2(atlTraceDBProvider, 0, "IRowsetScrollImpl::GetRowsAtRatio\n");
    T* pT = (T*)this;
    T::ObjectLock cab((T*) pT);
    HRESULT hr = S_OK;
    // Validation
    if(DB_NULL_HCHAPTER != hReserved2)
      return DB_E_NOTSUPPORTED;
    if(NULL == pcRowsObtained || NULL == prghRows)
      return E_INVALIDARG;
    // Check Fetching Backwards
    if (cRows < 0 && !pT->m_bCanFetchBack)
      return DB_E_CANTFETCHBACKWARDS;
    if(ulDenominator == 0 || (ulNumerator > ulDenominator) )
      return DB_E_BADRATIO;

    // Setting up the Start Position
    LONG iRowsetTemp = pT->m_iRowset;  // Cache the current rowset
    if(ulNumerator == 0 && cRows >0) // Start Point - First Row
      pT->m_iRowset = 0;
    else if ( (ulNumerator == 0 && cRows < 0) || (ulNumerator == ulDenominator && cRows > 0))   // DB_S_ENDOFROWSET
      hr = DB_S_ENDOFROWSET;
    else if (ulNumerator == ulDenominator && cRows < 0)  // Last Row
      //pT->m_iRowset = pT->m_rgRowData.GetSize() - 1;
      pT->m_iRowset = pT->m_DBFile.m_Rows.GetSize() - 1;
    else // All other conditions
      //pT->m_iRowset = (ulNumerator /ulDenominator) * pT->m_rgRowData.GetSize();
      pT->m_iRowset = (ulNumerator /ulDenominator) * pT->m_DBFile.m_Rows.GetSize();
    // Not sure about HOLDROWS optimizations - DB_E_ROWSNOTRELEASED
    // Call IRowsetImpl::GetNextRows to actually get the rows.
    if(hr == S_OK)
      hr = pT->GetNextRows(hReserved2, 0, cRows, pcRowsObtained, prghRows);
    pT->m_iRowset = iRowsetTemp; // Return back to orignal cursor position
    // Send notification message
    if(FAILED(pT->Fire_OnRowChange(this, cRows, *prghRows, DBREASON_ROW_ACTIVATE, DBEVENTPHASE_DIDEVENT, TRUE)))

template<class T , class RowsetInterface = IRowsetScroll>
STDMETHOD() IRowsetScrollImpl< T, RowsetInterface >::GetRowsByBookmark | ( | HCHAPTER | hReserved,
 |  | ULONG | cRows,
 |  | const ULONG | rgcbBookmarks[],
 |  | const BYTE * | rgpBookmarks[],
 |  | HROW | rghRows[],
 |  | DBROWSTATUS | rgRowStatus[] |
 | ) |  |  | [inline]

Definition at line 230 of file irowsetscroll.h.

  {
    HRESULT hr = S_OK;
    ATLTRACE("IRowsetLocateImpl::GetRowsByBookmark");

    T* pT = (T*)this;
    if (rgcbBookmarks == NULL || rgpBookmarks == NULL || rghRows == NULL)
      return E_INVALIDARG;

    if (cRows == 0)
      return S_OK;    // No rows fetched in this case.

    bool bErrors = false;
    for (ULONG l=0; l<cRows; l++)
    {
      // Validate each bookmark before fetching the row.  Note, it is
      // an error for the bookmark to be one of the standard values
      hr = ValidateBookmark(rgcbBookmarks[l], rgpBookmarks[l]);
      if (hr != S_OK)
      {
        bErrors = TRUE;
        if (rgRowStatus != NULL)
        {
          rgRowStatus[l] = DBROWSTATUS_E_INVALID;
          continue;
        }
      }

      // Fetch the row, we now that it is a valid row after validation.
      ULONG ulRowsObtained = 0;
      if (pT->CreateRow((long)*rgpBookmarks[l], ulRowsObtained, &rghRows[l]) != S_OK)
      {
        bErrors = TRUE;
      }
      else
      {
        if (rgRowStatus != NULL)
          rgRowStatus[l] = DBROWSTATUS_S_OK;
      }
    }

    if (bErrors)
      return DB_S_ERRORSOCCURRED;
    if (FAILED(pT->Fire_OnRowChange(this, cRows, rghRows, DBREASON_ROW_ACTIVATE, DBEVENTPHASE_DIDEVENT, TRUE)))

template<class T , class RowsetInterface = IRowsetScroll>
STDMETHOD() IRowsetScrollImpl< T, RowsetInterface >::Hash | ( | HCHAPTER | hReserved,
 |  | ULONG | cBookmarks,
 |  | const ULONG | rgcbBookmarks[],
 |  | const BYTE * | rgpBookmarks[],
 |  | DWORD | rgHashedValues[],
 |  | DBROWSTATUS | rgBookmarkStatus[] |
 | ) |  |  | [inline]

Definition at line 280 of file irowsetscroll.h.

  {
    ATLTRACE("IRowsetScrollImpl::Hash\n");
    T* pT = (T*)this;
    T::ObjectLock cab((T*) pT);
    // Validation
    //ROWSET_NOTIFICATION_REENTRANCY_CHECK
    if(DB_NULL_HCHAPTER != hReserved)
      return DB_E_NOTSUPPORTED;
    if (cBookmarks <= 0)
      return S_OK;
    if((rgHashedValues == NULL) || (cBookmarks != 0 && (rgcbBookmarks == NULL || rgpBookmarks==NULL)) )
      return E_INVALIDARG;
    // Logic for hashing
    ULONG cerrors =0;
    if(rgBookmarkStatus)
    {
      // Loop through the array hashing them and recording their status
      for(ULONG i=0;i<cBookmarks; i++)
      {
        if(SUCCEEDED(HashBmk(rgcbBookmarks[i],rgpBookmarks[i],&(rgHashedValues[i]))) )
          rgBookmarkStatus[i] = DBROWSTATUS_S_OK;
        else
        {
          cerrors++;
          rgBookmarkStatus[i] = DBROWSTATUS_E_INVALID;
        }
      }
    }
    else
    {
      // Loop through the array hashing them
      for(ULONG i=0;i<cBookmarks; i++)
      {
        if(FAILED(HashBmk(rgcbBookmarks[i],rgpBookmarks[i],&(rgHashedValues[i]))) )
          cerrors++;
      }
    }
    if (cerrors == 0) return S_OK;
    if (cerrors < cBookmarks)

template<class T , class RowsetInterface = IRowsetScroll>
HRESULT IRowsetScrollImpl< T, RowsetInterface >::HashBmk | ( | ULONG | cbBmk,
 |  | const BYTE * | pbBmk,
 |  | ULONG * | pdwHashedValue,
 |  | ULONG | ulTableSize = 0xffffffff |
 | ) |  |  | [inline, protected]

Definition at line 328 of file irowsetscroll.h.

           :
  HRESULT HashBmk(ULONG cbBmk,const BYTE  *pbBmk,ULONG  *pdwHashedValue,ULONG ulTableSize=0xffffffff)
  {
    if (cbBmk != sizeof(DWORD) || pbBmk == NULL)
      return E_INVALIDARG;
    ATLASSERT(pdwHashedValue);

template<class T , class RowsetInterface = IRowsetScroll>
HRESULT IRowsetScrollImpl< T, RowsetInterface >::ValidateBookmark | ( | ULONG | cbBookmark,
 |  | const BYTE * | pBookmark |
 | ) |  |  | [inline, protected]

Definition at line 338 of file irowsetscroll.h.

  {
    T* pT = (T*)this;
    T::ObjectLock cab((T*) pT);
    if (cbBookmark == 0 || pBookmark == NULL)
      return E_INVALIDARG;

    if(*pBookmark == DBBMK_INVALID)
        return DB_E_BADBOOKMARK;
    // All of our bookmarks are DWORDs, if they are anything other than
    // sizeof(DWORD) then we have an invalid bookmark
    if ((cbBookmark != sizeof(DWORD)) && (cbBookmark != 1))
    {
      ATLTRACE("Bookmarks are invalid length, should be DWORDs");
      return DB_E_BADBOOKMARK;
    }

    // If the contents of our bookmarks are less than 0 or greater than
    // rowcount, then they are invalid
    UINT nRows = pT->m_DBFile.m_Rows.GetSize();
    if ((*pBookmark <= 0 || *pBookmark > nRows)
      && *pBookmark != DBBMK_FIRST && *pBookmark != DBBMK_LAST)
    {
      ATLTRACE("Bookmark has invalid range");
      return DB_E_BADBOOKMARK;
    }

The documentation for this class was generated from the following file:
  • Dataaccess/oledb/omniprov/source/irowsetscroll.h
Generated on Wed Nov 13 2024 16:57:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ISAPI_BUFFER Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

ISAPI_BUFFER Class Reference

#include "IsapiBuffer.h"

List of all members.

Public Member Functions

ISAPI_BUFFER (DWORD dwMaxAlloc=0)
virtual | ~ISAPI_BUFFER ()
BOOL | AppendData (VOID *pData, DWORD cbData)
BOOL | Base64Decode (CHAR *szString)
DWORD | QueryBufferSize (VOID)
DWORD | QueryDataSize (VOID)
DWORD | QueryMaxAlloc (VOID)
VOID * | QueryPtr (VOID)
VOID | Reset (BOOL fDealloc=FALSE)
BOOL | Resize (DWORD cbNewSize)
BOOL | SetData (VOID *pData, DWORD cbData)
BOOL | SetDataSize (DWORD cbNewSize)
VOID | SetMaxAlloc (DWORD dwMaxAlloc)
VOID | ZeroBuffer (VOID)

Private Attributes

DWORD _cbBuffer
DWORD _cbData
DWORD _dwMaxAlloc
BYTE | _InlineData [INLINE_BUFFER_SIZE]
VOID * | _pData

Detailed Description

Definition at line 36 of file IsapiBuffer.h.

Constructor & Destructor Documentation

ISAPI_BUFFER::ISAPI_BUFFER ( DWORD dwMaxAlloc = 0 )

Definition at line 37 of file IsapiBuffer.cpp.

      : _pData( _InlineData ),
        _cbData( 0 ),
        _cbBuffer( INLINE_BUFFER_SIZE ),
        _dwMaxAlloc( dwMaxAlloc ? dwMaxAlloc : DEFAULT_MAX_ALLOC_SIZE )
/*++

Purpose:

    Constructor for the ISAPI_BUFFER object

Arguments:

    dwMaxAlloc - Initial value of max allocation size

Returns:

    None

--*/
{
    return;
}

ISAPI_BUFFER::~ISAPI_BUFFER ( ) [virtual]

Definition at line 62 of file IsapiBuffer.cpp.

       :

    Destructory for the ISAPI_BUFFER object

Arguments:

    None

Returns:

    None

--*/
{
    //
    // Reset the object.  Ensure that we
    // deallocate any associated heap.
    //

    Reset( TRUE );
}

Member Function Documentation

BOOL ISAPI_BUFFER::AppendData | ( | VOID * | pData,
 |  | DWORD | cbData
 | ) |  |

Definition at line 133 of file IsapiBuffer.cpp.

       :

    Appends data to the ISAPI_BUFFER object

Arguments:

    pData  - Pointer to the data to append
    cbData - Size of the data to append

Returns:

    TRUE on success, FALSE on failure

--*/
{
    DWORD   cbNewSize;

    //
    // Ensure that the buffer is sufficient to
    // store the data.
    //

    cbNewSize = _cbData + cbData;

    if ( cbNewSize > _cbBuffer &&
         !Resize( cbNewSize ) )
    {
        return FALSE;
    }

    //
    // Copy the data into the buffer, beginning
    // at the specified offset, and set the new size.
    //

    CopyMemory( (BYTE*)_pData + _cbData, pData, cbData );

    _cbData = cbNewSize;

    return TRUE;
}

BOOL ISAPI_BUFFER::Base64Decode ( CHAR * szString )

Definition at line 500 of file IsapiBuffer.cpp.

       :

    Base64 decodes a string into ISAPI_BUFFER object.

Arguments:

    szString - The string to decode

Returns:

    TRUE on success, FALSE on failure

--*/
{
    BYTE    pData[SIZE_UNENCODED_CHUNK];
    CHAR *  pCursor;
    DWORD   cchRemaining;
    DWORD   cchString;
    DWORD   cbData;
    BOOL    fResult;

    //
    // Validate the input.  Make sure that size the input data
    // is evenly divisible by 4
    //

    cchString = strlen( szString );

    if ( cchString % 4 )
    {
        SetLastError( ERROR_INVALID_PARAMETER );
        goto Failed;
    }

    //
    // Decode the data in 4 byte chunks
    //

    pCursor = szString;
    cchRemaining = cchString;

    while ( cchRemaining )
    {
        fResult = Base64DecodeChunk( pCursor,
                                     pData,
                                     &cbData );

        if ( !fResult )
        {
            goto Failed;
        }

        fResult = AppendData( pData, cbData );

        if ( !fResult )
        {
            goto Failed;
        }

        cchRemaining -= SIZE_ENCODED_CHUNK;
        pCursor += SIZE_ENCODED_CHUNK;
    }

    return TRUE;

Failed:

    //
    // No special cleanup required
    //

    return FALSE;
}

DWORD ISAPI_BUFFER::QueryBufferSize ( VOID )

Definition at line 477 of file IsapiBuffer.cpp.

       :

    Returns the buffer size of the ISAPI_BUFFER object.

Arguments:

    None

Returns:

    The size of the buffer

--*/
{
    return _cbBuffer;
}

DWORD ISAPI_BUFFER::QueryDataSize ( VOID )

Definition at line 454 of file IsapiBuffer.cpp.

       :

    returns the data size of the ISAPI_BUFFER object.

Arguments:

    None

Returns:

    The data size

--*/
{
    return _cbData;
}

DWORD ISAPI_BUFFER::QueryMaxAlloc ( VOID )

Definition at line 408 of file IsapiBuffer.cpp.

       :

    Returns the max alloc size of the ISAPI_BUFFER object.

Arguments:

    None

Returns:

    The max alloc size

--*/
{
    return _dwMaxAlloc;
}

VOID * ISAPI_BUFFER::QueryPtr ( VOID )

Definition at line 431 of file IsapiBuffer.cpp.

       :

    returns a pointer to the data member ISAPI_BUFFER object.

Arguments:

    None

Returns:

    A pointer to the data member

--*/
{
    return _pData;
}

VOID ISAPI_BUFFER::Reset ( BOOL fDealloc = FALSE )

Definition at line 309 of file IsapiBuffer.cpp.

       :

    Resets the ISAPI_BUFFER object

Arguments:

    fDealloc - If TRUE, then any heap associated with the
               object is freed.

Returns:

    None

--*/
{
    //
    // If we are supposed to dealloc some
    // heap memory, do so now.
    //

    if ( fDealloc &&
         _pData != _InlineData )
    {
        LocalFree( _pData );
        _pData = _InlineData;
        _cbBuffer = INLINE_BUFFER_SIZE;
    }

    //
    // Reset the data size
    //

    _cbData = 0;
}

BOOL ISAPI_BUFFER::Resize ( DWORD cbNewSize )

Definition at line 182 of file IsapiBuffer.cpp.

       :

    Ensures that the storage for ISAPI_BUFFER is sufficient to
    contain the specified number of bytes

Arguments:

    cbNewSize - The target size

Returns:

    TRUE on success, FALSE on failure

--*/
{
    HANDLE  hNew;
    DWORD   cbAdjustedNewSize;

    //
    // If the buffer is already large enough, then
    // just return TRUE.
    //

    if ( cbNewSize <= _cbBuffer )
    {
        return TRUE;
    }

    //
    // If the new requested size is larger than the
    // maximum we will allocate, then fail the call
    //

    if ( cbNewSize > _dwMaxAlloc )
    {
        SetLastError( ERROR_NOT_ENOUGH_MEMORY );

        goto Failed;
    }

    //
    // Adjust the new size so that we allocate blocks
    // using a granularity of ISAPILIB_BUFFER_INLINE_SIZE.
    // Also, make sure that this adjustment does not
    // exceed _dwMaxAlloc.
    //

    cbAdjustedNewSize = cbNewSize / INLINE_BUFFER_SIZE * INLINE_BUFFER_SIZE;

    if ( cbAdjustedNewSize < cbNewSize )
    {
        cbAdjustedNewSize += INLINE_BUFFER_SIZE;
    }

    if ( cbAdjustedNewSize > _dwMaxAlloc )
    {
        cbAdjustedNewSize = _dwMaxAlloc;
    }

    //
    // Allocate the new storage.
    //

    if ( _pData == _InlineData )
    {
        //
        // If _pData is currently pointed at the new buffer,
        // then we need to allocate some heap storage.
        //

        hNew = LocalAlloc( NONZEROLPTR, cbAdjustedNewSize );

        if ( hNew == NULL )
        {
            SetLastError( ERROR_NOT_ENOUGH_MEMORY );

            goto Failed;
        }

        //
        // If there was data in the old buffer, copy
        // it to the new buffer.
        //

        if ( _cbData )
        {
            CopyMemory( (BYTE*)hNew, _pData, _cbData );
        }
    }
    else
    {
        //
        // If _pData is already on the heap, then reallocate it.
        //

        hNew = LocalReAlloc( _pData, cbAdjustedNewSize, LMEM_MOVEABLE );

        if ( hNew == NULL )
        {
            goto Failed;
        }
    }

    //
    // Adjust the pointer and size of the new buffer
    //

    _pData = (BYTE*)hNew;
    _cbBuffer = cbAdjustedNewSize;

    return TRUE;

Failed:

    //
    // No special cleanup to be done
    //

    return FALSE;
}

BOOL ISAPI_BUFFER::SetData | ( | VOID * | pData,
 |  | DWORD | cbData
 | ) |  |

Definition at line 88 of file IsapiBuffer.cpp.

       :

    Sets the specified data into the ISAPI_BUFFER object

Arguments:

    pData  - Pointer to the data to set
    cbData - Size of the data to set

Returns:

    TRUE on success, FALSE on failure

--*/
{
    //
    // Ensure that the buffer is sufficient to
    // store the data.
    //

    if ( cbData > _cbBuffer &&
         !Resize( cbData ) )
    {
        return FALSE;
    }

    //
    // Copy the data into the buffer and
    // set the new size
    //

    CopyMemory( _pData, pData, cbData );

    _cbData = cbData;

    return TRUE;
}

BOOL ISAPI_BUFFER::SetDataSize ( DWORD cbNewSize )

Definition at line 350 of file IsapiBuffer.cpp.

       :

    Resets the size member ISAPI_BUFFER object.

Arguments:

    cbNewSize - The new size to set

Returns:

    TRUE on success, FALSE on failure

--*/
{
    //
    // Don't allow it to be set to something bigger
    // than the buffer
    //

    if ( cbNewSize > _cbBuffer )
    {
        return FALSE;
    }

    _cbData = cbNewSize;

    return TRUE;
}

VOID ISAPI_BUFFER::SetMaxAlloc ( DWORD dwMaxAlloc )

Definition at line 385 of file IsapiBuffer.cpp.

       :

    Sets the max alloc size of the ISAPI_BUFFER object.

Arguments:

    dwMaxAlloc - The new size to set

Returns:

    None

--*/
{
    _dwMaxAlloc = dwMaxAlloc ? dwMaxAlloc : DEFAULT_MAX_ALLOC_SIZE;
}

VOID ISAPI_BUFFER::ZeroBuffer ( VOID )

Definition at line 580 of file IsapiBuffer.cpp.

       :

    Fills the ISAPI_BUFFER data buffer with zeros.

Arguments:

    None

Returns:

    None

--*/
{
    ZeroMemory( _pData, _cbBuffer );
}

Member Data Documentation

DWORD ISAPI_BUFFER::_cbBuffer [private]

Definition at line 114 of file IsapiBuffer.h.

DWORD ISAPI_BUFFER::_cbData [private]

Definition at line 113 of file IsapiBuffer.h.

DWORD ISAPI_BUFFER::_dwMaxAlloc [private]

Definition at line 115 of file IsapiBuffer.h.

BYTE ISAPI_BUFFER::_InlineData[INLINE_BUFFER_SIZE] [private]

Definition at line 112 of file IsapiBuffer.h.

VOID* ISAPI_BUFFER::_pData [private]

Definition at line 111 of file IsapiBuffer.h.

The documentation for this class was generated from the following files:
  • Web/iis/ISAPI_6.0/inc/IsapiBuffer.h
  • Web/iis/ISAPI_6.0/src/IsapiBuffer.cpp
Generated on Wed Nov 13 2024 16:57:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ISAPI_EXTENSION Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

ISAPI_EXTENSION Class Reference

#include "IsapiExtension.h"

List of all members.

Public Member Functions

ISAPI_EXTENSION ()
virtual | ~ISAPI_EXTENSION ()
BOOL | Initialize (LPSTR szModuleName)
BOOL | InitOnce (PFN_FIRST_HIT_INIT pfnInit, VOID *pContext)
CHAR * | QueryModulePath (VOID)

Private Attributes

CRITICAL_SECTION | _csInit
BOOL _fFirstHitInitDone
BOOL _fInitialized
PFN_FIRST_HIT_INIT _pfnInit
ISAPI_STRING _strModuleName
ISAPI_STRING _strModulePath

Detailed Description

Definition at line 26 of file IsapiExtension.h.

Constructor & Destructor Documentation

ISAPI_EXTENSION::ISAPI_EXTENSION ( )

Definition at line 24 of file IsapiExtension.cpp.

    : _fInitialized( FALSE ),
      _fFirstHitInitDone( FALSE ),
      _pfnInit( NULL )
/*++

Purpose:

    Constructor for the ISAPI_EXTENSION object

Arguments:

    None

Returns:

    None

--*/
{
}

ISAPI_EXTENSION::~ISAPI_EXTENSION ( ) [virtual]

Definition at line 46 of file IsapiExtension.cpp.

       :

    Destructor for the ISAPI_EXTENSION object

Arguments:

    None

Returns:

    None

--*/
{
    //
    // If we successfully initialized, then we
    // need to delete the critical section
    //

    if ( _fInitialized )
    {
        DeleteCriticalSection( &_csInit );
        _fInitialized = FALSE;
    }
}

Member Function Documentation

BOOL ISAPI_EXTENSION::Initialize ( LPSTR szModuleName )

Definition at line 76 of file IsapiExtension.cpp.

       :

    Initializes the ISAPI_EXTENSION object

Arguments:

    szModuleName - The name of the module

Returns:

    TRUE on success, FALSE on failure

--*/
{
    LPSTR   pCursor;
    BOOL    fResult;
    DWORD   cchModuleFileName;

    //
    // Store the module name
    //

    if ( !_strModuleName.Copy( szModuleName ) )
    {
        return FALSE;
    }

    //
    // Derive the full path to this module.  We'll assume
    // that the full file name for this module does not
    // exceed MAX_PATH characters.  If it does, we'll
    // detect the condition and fail.
    //

    if ( !_strModulePath.ResizeBuffer( MAX_PATH+1 ) )
    {
        return FALSE;
    }

    cchModuleFileName = GetModuleFileName( GetModuleHandle(szModuleName),
                                           _strModulePath.QueryStr(),
                                           MAX_PATH );
    if ( cchModuleFileName == 0 ||
         cchModuleFileName == MAX_PATH )
    {
        if ( cchModuleFileName == MAX_PATH )
        {
            SetLastError( ERROR_INSUFFICIENT_BUFFER );
        }

        return FALSE;
    }

    _strModulePath.CalcLen();

    //
    // At this point, _strModulePath contains the full file
    // name to this module, including the ".dll".  We'll
    // strip off the module name to get the final result.
    //

    pCursor = strrchr( _strModulePath.QueryStr(), '\\' );

    if ( !pCursor )
    {
        //
        // Hmmm.  We really expected a backslash...
        //

        SetLastError( ERROR_INVALID_PARAMETER );
        return FALSE;
    }

    *pCursor = '\0';

    _strModulePath.CalcLen();

    //
    // Initialize the first hit init critical section.
    //
    // Note that the InitializeCriticalSection function
    // does not necessarily leave the critical section in
    // a useable state.  It's possible, in low memory
    // conditions, that a call to EnterCriticalSection
    // could cause an access violation.  To avoid this
    // situation, we'll use InitializeCriticalSectionAndSpinCount,
    // which detects this condition and returns FALSE
    // if it cannot fully initialize.
    //

    fResult = InitializeCriticalSectionAndSpinCount( &_csInit,
                                                     0 );

    if ( fResult )
    {
        _fInitialized = TRUE;
    }

    return fResult;
}

BOOL ISAPI_EXTENSION::InitOnce | ( | PFN_FIRST_HIT_INIT | pfnInit,
 |  | VOID * | pContext
 | ) |  |

Definition at line 183 of file IsapiExtension.cpp.

       :

    Performs a guaranteed one-time call of the specified
    function.

Arguments:

    pfnInit  - The function to call exactly once
    pContext - Context to be passed to the specified function

Returns:

    TRUE on success, FALSE on failure

--*/
{
    BOOL    fResult;

    //
    // If we are already initialized, just return
    // TRUE.
    //
    // Note that we expect that most calls to this
    // function will return here.  It is important
    // that we do not enter a critical section on this
    // code path, as this would create contention as
    // multiple threads enter the ISAPI extension
    // concurrently.
    //

    if ( _fFirstHitInitDone )
    {
        return TRUE;
    }

    //
    // If we get here, then we need to call the
    // initialization function.  This needs to
    // happen exactly once, even if multiple threads
    // get past the above check.  We'll use a
    // critical section to ensure this.
    //

    EnterCriticalSection( &_csInit );

    //
    // Now that we're in the critical section, the current
    // thread has exclusive access to this code.  We'll
    // check to see if we are still uninitialized.  If so,
    // we'll call the init function and update the state
    // of this object so that other threads that get here
    // won't also call it.
    //

    if ( !_fFirstHitInitDone )
    {
        fResult = pfnInit( pContext );

        if ( fResult )
        {
            _fFirstHitInitDone = TRUE;
        }
    }

    LeaveCriticalSection( &_csInit );

    return fResult;
}

CHAR * ISAPI_EXTENSION::QueryModulePath ( VOID )

Definition at line 260 of file IsapiExtension.cpp.

       :

    Returns the path of the module of the ISAPI_EXTENSION object

Arguments:

    None

Returns:

    Pointer to the module name

--*/
{
    return _strModulePath.QueryStr();
}

Member Data Documentation

CRITICAL_SECTION ISAPI_EXTENSION::_csInit [private]

Definition at line 56 of file IsapiExtension.h.

BOOL ISAPI_EXTENSION::_fFirstHitInitDone [private]

Definition at line 57 of file IsapiExtension.h.

BOOL ISAPI_EXTENSION::_fInitialized [private]

Definition at line 58 of file IsapiExtension.h.

PFN_FIRST_HIT_INIT ISAPI_EXTENSION::_pfnInit [private]

Definition at line 55 of file IsapiExtension.h.

ISAPI_STRING ISAPI_EXTENSION::_strModuleName [private]

Definition at line 53 of file IsapiExtension.h.

ISAPI_STRING ISAPI_EXTENSION::_strModulePath [private]

Definition at line 54 of file IsapiExtension.h.

The documentation for this class was generated from the following files:
  • Web/iis/ISAPI_6.0/inc/IsapiExtension.h
  • Web/iis/ISAPI_6.0/src/IsapiExtension.cpp
Generated on Wed Nov 13 2024 16:57:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ISAPI_REQUEST Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes

ISAPI_REQUEST Class Reference

#include "IsapiRequest.h"

List of all members.

Public Member Functions

ISAPI_REQUEST (EXTENSION_CONTROL_BLOCK *pEcb)
virtual | ~ISAPI_REQUEST (VOID)
BOOL | AddDataToResponseBuffer (VOID *pData, DWORD cbData)
BOOL | AddHeaderToBufferedResponse (CHAR *szName, CHAR *szValue)
BOOL | AsyncTransmitBufferedResponse (PFN_HSE_IO_COMPLETION pfnCompletion, DWORD dwExpireSeconds=NO_EXPIRATION)
BOOL | GetServerVariable (CHAR *szVariable, ISAPI_STRINGW *pIsapiStringW)
BOOL | GetServerVariable (CHAR *szVariable, ISAPI_STRING *pIsapiString)
BOOL | ImpersonateClient (VOID)
BOOL | PrintfToResponseBuffer (CHAR *szFormat,...)
EXTENSION_CONTROL_BLOCK * | QueryEcb (VOID)
DWORD | QueryIISMajorVersion (VOID)
DWORD | QueryIISMinorVersion (VOID)
BOOL | QueryIsClientConnected (VOID)
DWORD | QueryMaxResponseBufferSize (VOID)
DWORD | QueryMaxSyncWriteSize (VOID)
BOOL | ReadAllEntity (ISAPI_BUFFER *pBuffer)
BOOL | SetBufferedResponseStatus (CHAR *szStatus)
VOID | SetMaxResponseBufferSize (DWORD dwMaxResponseBufferSize)
VOID | SetMaxSyncWriteSize (DWORD dwMaxSyncWriteSize)
BOOL | SyncSendStatusAndHeaders (CHAR *szStatus=NULL, CHAR *szHeaders=NULL)
BOOL | SyncWriteClientArgs (CHAR *szFormat, va_list args)
BOOL | SyncWriteClientString (CHAR *szFormat,...)
BOOL | SyncWriteCompleteResponse (CHAR *szStatus, CHAR *szHeaders, CHAR *szFormat,...)
BOOL | UnimpersonateClient (VOID)

Private Member Functions

BOOL | AsyncSendResponseIIS4 (PFN_HSE_IO_COMPLETION pfnCompletion)
BOOL | AsyncSendResponseIIS5 (PFN_HSE_IO_COMPLETION pfnCompletion)
BOOL | AsyncSendResponseIIS6 (PFN_HSE_IO_COMPLETION pfcCompletion, BOOL fCacheResponse)
DWORD | QueryOsMajorVersion (VOID)

Private Attributes

DWORD _dwIISMajorVersion
DWORD _dwIISMinorVersion
DWORD _dwMaxSyncWriteSize
BOOL _fClientIsConnected
BOOL _fNeedDoneWithSession
ISAPI_STRING _HeaderBuffer
HANDLE _hImpersonationToken
EXTENSION_CONTROL_BLOCK * | _pEcb
ISAPI_BUFFER _ResponseBuffer
ISAPI_STRING _StatusBuffer

Static Private Attributes

static DWORD | _dwOsMajorVersion = 0

Detailed Description

Definition at line 37 of file IsapiRequest.h.

Constructor & Destructor Documentation

ISAPI_REQUEST::ISAPI_REQUEST ( EXTENSION_CONTROL_BLOCK * pEcb )

Definition at line 38 of file IsapiRequest.cpp.

    : _pEcb( pEcb ),
      _dwMaxSyncWriteSize( 0 ), // Use ISAPI_STRING default
      _fNeedDoneWithSession( FALSE ),
      _fClientIsConnected( TRUE ),
      _hImpersonationToken( NULL )
/*++

Purpose:

    Initializes the ISAPI_REQUEST object

    During initialization, this object will determine
    the IIS version.

Arguments:

    pEcb - The ECB for the request to associate with this object

Returns:

    None

--*/
{
    //
    // Set the max response buffer size
    //

    _ResponseBuffer.SetMaxAlloc( DEFAULT_RESPONSE_BUFFER_SIZE );

    //
    // Get the IIS version info from the ECB.
    //

    _dwIISMajorVersion = pEcb->dwVersion >> 16;
    _dwIISMinorVersion = pEcb->dwVersion & 0xffff;

    //
    // Note that not all versions of IIS return
    // their version correctly.
    //
    // In particular, IIS version 4.0 and 5.0 will
    // both return 4.  IIS versions 5.1 and 6.0 do
    // correctly set this value in the ECB.
    //
    // Therefore, if we see a major version of 4,
    // we'll look at the OS version to break the tie.
    //

    if ( _dwIISMajorVersion == 4 &&
         _dwIISMinorVersion == 0 )
    {
        _dwIISMajorVersion = QueryOsMajorVersion();
    }
}

ISAPI_REQUEST::~ISAPI_REQUEST ( VOID ) [virtual]

Definition at line 97 of file IsapiRequest.cpp.

       :

    Destructor for the ISAPI_REQUEST object.

    If the extension called AsyncTransmitBufferedResponse, then
    this code will take responsibility for notifying IIS that
    the request has been completed.

Arguments:

    None

Returns:

    None

--*/
{
    DWORD   dwState;

    //
    // If we send the response back via this object's
    // buffer, then we need to let IIS know that we
    // are done with the session.
    //

    if ( _fNeedDoneWithSession )
    {
        //
        // Since buffered responses always send a content-length,
        // we should go ahead and keep the connection open
        //

        dwState = HSE_STATUS_SUCCESS_AND_KEEP_CONN;

        _pEcb->ServerSupportFunction( _pEcb->ConnID,
                                      HSE_REQ_DONE_WITH_SESSION,
                                      &dwState,
                                      NULL,
                                      NULL );
    }
}

Member Function Documentation

BOOL ISAPI_REQUEST::AddDataToResponseBuffer | ( | VOID * | pData,
 |  | DWORD | cbData
 | ) |  |

Definition at line 955 of file IsapiRequest.cpp.

       :

    Adds data to the response buffer.

    Note that if this data causes the size of the buffer to exceed
    its max allocation, then this function will fail.

Arguments:

    pData  - The data to append
    cbData - The size of the data to append

Returns:

    TRUE on success, FALSE on failure

--*/
{
    return _ResponseBuffer.AppendData( pData,
                                       cbData );
}

BOOL ISAPI_REQUEST::AddHeaderToBufferedResponse | ( | CHAR * | szName,
 |  | CHAR * | szValue
 | ) |  |

Definition at line 832 of file IsapiRequest.cpp.

       :

    Adds a response header to be used in a buffered response

Arguments:

    szName  - The name of the header to add
    szValie - The value of the header to add

Returns:

    TRUE on success, FALSE on failure

--*/
{
    ISAPI_STRING    CookedHeader;
    BOOL            fResult;

    //
    // Build a cooked header in the form of
    // "name: value\r\n"
    //

    fResult = CookedHeader.Printf( "%s: %s\r\n",
                                   szName,
                                   szValue );

    if ( !fResult )
    {
        goto Failed;
    }

    //
    // Append the cooked header into the buffer
    //

    fResult = _HeaderBuffer.Append( CookedHeader.QueryStr() );

    return fResult;

Failed:

    //
    // No special cleanup required
    //

    return FALSE;
}

BOOL ISAPI_REQUEST::AsyncSendResponseIIS4 ( PFN_HSE_IO_COMPLETION pfnCompletion ) [private]

Definition at line 1489 of file IsapiRequest.cpp.

       :

    Asynchronously sends the buffered response using calls
    that will work on IIS 4.

Arguments:

    pfnCompletion - The function to call on completion of the I/O

Returns:

    TRUE on success, FALSE on failure

--*/
{
    DWORD   cbResponse;
    BOOL    fResult;

    //
    // Before doing an asynchronous write, we need to set
    // the completion routine.  We'll use a this pointer
    // as the completion context.
    //

    fResult = _pEcb->ServerSupportFunction( _pEcb->ConnID,
                                            HSE_REQ_IO_COMPLETION,
                                            pfnCompletion,
                                            NULL,
                                            (DWORD*)this );

    if ( !fResult )
    {
        goto Failed;
    }

    //
    // There is no mechanism in IIS 4 and earlier to send
    // status and headers asynchronously, unless you are using
    // TRANSMIT_FILE with a valid file handle.  As a result,
    // we need to synchronously send the status and headers.
    //

    fResult = SyncSendStatusAndHeaders( _StatusBuffer.QueryStr(),
                                        _HeaderBuffer.QueryStr() );

    if ( !fResult )
    {
        goto Failed;
    }

    //
    // Now, we can send the entity body asynchronously
    //
    // We'll need to properly set the state of this
    // object so that the destructor knows to do
    // DONE_WITH_SESSION.
    //

    cbResponse = _ResponseBuffer.QueryDataSize();

    _fNeedDoneWithSession = TRUE;

    fResult = _pEcb->WriteClient( _pEcb->ConnID,
                                  _ResponseBuffer.QueryPtr(),
                                  &cbResponse,
                                  HSE_IO_ASYNC | HSE_IO_NODELAY );

    if ( !fResult )
    {
        //
        // Reset the state so that this object knows not
        // to do DONE_WITH_SESSION in the destructor
        //

        _fNeedDoneWithSession = FALSE;

        goto Failed;
    }

    return TRUE;

Failed:

    //
    // No special cleanup required
    //

    return FALSE;
}

BOOL ISAPI_REQUEST::AsyncSendResponseIIS5 ( PFN_HSE_IO_COMPLETION pfnCompletion ) [private]

Definition at line 1585 of file IsapiRequest.cpp.

       :

    Asynchronously sends the buffered response using calls
    that will work on IIS 5.

Arguments:

    pfnCompletion - The function to call on completion of the I/O

Returns:

    TRUE on success, FALSE on failure

--*/
{
    HSE_TF_INFO TfInfo;
    BOOL        fResult;

    TfInfo.pfnHseIO = pfnCompletion;
    TfInfo.pszStatusCode = _StatusBuffer.QueryStr();

    //
    // We'll send the buffered response headers in the
    // pHead member.
    //

    TfInfo.pHead = _HeaderBuffer.QueryStr();
    TfInfo.HeadLength = _HeaderBuffer.QueryCCH() + sizeof(CHAR);

    //
    // Since we're not sending a file, we'll use a NULL
    // file handle and set the offset and length to zero
    //

    TfInfo.hFile = NULL;
    TfInfo.Offset = 0;
    TfInfo.BytesToWrite = 0;

    //
    // We'll send the buffered response entity in the tail
    //

    TfInfo.pTail = _ResponseBuffer.QueryPtr();
    TfInfo.TailLength = _ResponseBuffer.QueryDataSize();

    //
    // Pass a pointer to this object as the context.
    //
    // Note that it is very important that this object
    // was allocated via "new" and not declared as an
    // object on HttpExtensionProc's stack.  If it was
    // declared on the stack, intermittent failures may
    // result, depending on whether HttpExtensionProc
    // returns before or after the completion.
    //

    TfInfo.pContext = this;

    //
    // Set the following flags:
    //
    // HSE_IO_ASYNC        - Always required for TRANSMIT_FILE
    // HSE_IO_SEND_HEADERS - Have TRANSMIT_FILE send the response headers
    // HSE_IO_NODELAY      - Dont nagle (IIS 5 only. This no-ops on IIS 6)
    //

    TfInfo.dwFlags = HSE_IO_ASYNC | HSE_IO_SEND_HEADERS | HSE_IO_NODELAY;

    //
    // Transmit the data
    //
    // Note that there is some state housekeeping that we need to do
    // here.  After HttpExtensionProc calls this function, it will
    // need to return HSE_STATUS_PENDING.  Cleanup of the request,
    // including this object, will then be done in the completion
    // routine, which will generally just delete this object. The
    // destructor for this object will call HSE_REQ_DONE_WITH_SESSION
    // if the below flag is so set.
    //
    // It is important to consider that the completion routine
    // might get called before any code following ServerSupportFunction
    // has a chance to run.  If this happens, the _fNeedDoneWithSession
    // flag needs to be already set for the destructor to work
    // properly.  Also, any attempts to touch members of this object
    // will result in an access violation.  Such failures may be
    // difficult to debug.
    //

    _fNeedDoneWithSession = TRUE;

    fResult = _pEcb->ServerSupportFunction( _pEcb->ConnID,
                                            HSE_REQ_TRANSMIT_FILE,
                                            &TfInfo,
                                            NULL,
                                            NULL );

    if ( !fResult )
    {
        //
        // Since the ServerSupportFunction failed, we know that no
        // completion will occur.  It is therefore safe for us to
        // touch members of this object.
        //
        // We will do so now, to reset the below flag back to the
        // state where HSE_REQ_DONE_WITH_SESSION is not called by
        // the destructor.
        //

        _fNeedDoneWithSession = FALSE;
    }

    return fResult;
}

BOOL ISAPI_REQUEST::AsyncSendResponseIIS6 | ( | PFN_HSE_IO_COMPLETION | pfcCompletion,
 |  | BOOL | fCacheResponse |
 | ) |  |  | [private]

Definition at line 1705 of file IsapiRequest.cpp.

       :

    Asynchronously sends the buffered response using calls
    that will work on IIS 6

Arguments:

    pfnCompletion  - The function to call on completion of the I/O
    fCacheResponse - If TRUE, then the response will be marked as
                     cacheable in the http.sys response cache.  Note
                     that this is just a "suggestion" to http.sys.
                     If something about the request disqualifies it
                     for caching, then http.sys is not required to
                     add this response to the cache.

Returns:

    TRUE on success, FALSE on failure

--*/
{
    HSE_VECTOR_ELEMENT  Element;
    HSE_RESPONSE_VECTOR Vector;
    BOOL                fResult;

    //
    // Declare a single element containing the contents
    // of the response buffer.
    //

    Element.ElementType = HSE_VECTOR_ELEMENT_TYPE_MEMORY_BUFFER;
    Element.pvContext = _ResponseBuffer.QueryPtr();
    Element.cbOffset = 0;
    Element.cbSize = _ResponseBuffer.QueryDataSize();

    //
    // Declare our response vector containing a single
    // element in the array, and using the ISAPI_REQUEST's
    // status and headers.
    //
    // We will set the following IO flags for all calls:
    //
    //   HSE_IO_ASYNC        - Do an asynchronous send
    //   HSE_IO_FINAL_SEND   - Optimization, since we know
    //                         that this send is the complete
    //                         response (note that this is
    //                         required to be able to cache
    //                         the response in http.sys)
    //   HSE_IO_SEND_HEADERS - Specifies that we are sending
    //                         response headers in this call
    //

    Vector.dwFlags = HSE_IO_ASYNC | HSE_IO_FINAL_SEND | HSE_IO_SEND_HEADERS;

    //
    // If the response is cacheable, then we should add
    // HSE_IO_CACHE_RESPONSE
    //

    if ( fCacheResponse )
    {
        Vector.dwFlags |= HSE_IO_CACHE_RESPONSE;
    }

    //
    // Set the status and headers
    //

    Vector.pszStatus = _StatusBuffer.QueryStr();
    Vector.pszHeaders = _HeaderBuffer.QueryStr();

    //
    // Finally, we have a single element array.  Note
    // that the elements of this array need to stay valid
    // until the completion occurs.  This will be taken
    // care of automatically by the ISAPI_REQUEST object,
    // since it doesn't free the response buffer until
    // the completion.
    //

    Vector.nElementCount = 1;
    Vector.lpElementArray = &Element;

    //
    // Before doing an asynchronous vector send, we need to set
    // the completion routine.  We'll use a this pointer
    // as the completion context.
    //

    fResult = _pEcb->ServerSupportFunction( _pEcb->ConnID,
                                            HSE_REQ_IO_COMPLETION,
                                            pfnCompletion,
                                            NULL,
                                            (DWORD*)this );

    if ( !fResult )
    {
        goto Failed;
    }

    //
    // Send the data
    //
    // Note that there is some state housekeeping that we need to do
    // here.  After HttpExtensionProc calls this function, it will
    // need to return HSE_STATUS_PENDING.  Cleanup of the request,
    // including this object, will then be done in the completion
    // routine, which will generally just delete this object. The
    // destructor for this object will call HSE_REQ_DONE_WITH_SESSION
    // if the below flag is so set.
    //
    // It is important to consider that the completion routine
    // might get called before any code following ServerSupportFunction
    // has a chance to run.  If this happens, the _fNeedDoneWithSession
    // flag needs to be already set for the destructor to work
    // properly.  Also, any attempts to touch members of this object
    // will result in an access violation.  Such failures may be
    // difficult to debug.
    //

    _fNeedDoneWithSession = TRUE;

    fResult = _pEcb->ServerSupportFunction( _pEcb->ConnID,
                                            HSE_REQ_VECTOR_SEND,
                                            &Vector,
                                            NULL,
                                            NULL );

    if ( !fResult )
    {
        //
        // Since the ServerSupportFunction failed, we know that no
        // completion will occur.  It is therefore safe for us to
        // touch members of this object.
        //
        // We will do so now, to reset the below flag back to the
        // state where HSE_REQ_DONE_WITH_SESSION is not called by
        // the destructor.
        //

        _fNeedDoneWithSession = FALSE;
    }

    return fResult;

Failed:

    //
    // No special cleanup required
    //

    return FALSE;
}

BOOL ISAPI_REQUEST::AsyncTransmitBufferedResponse | ( | PFN_HSE_IO_COMPLETION | pfnCompletion,
 |  | DWORD | dwExpireSeconds = NO_EXPIRATION
 | ) |  |

Definition at line 984 of file IsapiRequest.cpp.

       :

    Asynchronously sends the complete, buffered response
    to the client.

    This function automatically calculates and adds an "Expires"
    header, based on the expiration specified by the caller. It
    also calculates and adds a content-length header, and
    keep-alive will be supported if the client requested it.

    Note that various versions of IIS have different capabilities
    for sending asynchronous responses.  This function will
    check the IIS version and call a function to send the data
    in the most appropriate way.

Arguments:

    pfnCompletion   - The function to call on completion of the send
    dwExpireSeconds - If NO_EXPIRATION, then no expiration header will
                      be added to the response.  If 0, then an
                      "Expires: 0" header will be added to the
                      response.  Otherwise a valid expiration time
                      will be calculated and added as an Expires
                      header.  On IIS 6, this will mark the request
                      as eligible for the http.sys response cache.

Returns:

    TRUE on success, FALSE on failure

--*/
{
    CHAR            szContentLength[32];
    ISAPI_STRING    strExpires;
    BOOL            fIIS6Cacheable = FALSE;
    BOOL            fResult;

    //
    // If a status has not been set, use the default
    //

    if ( _StatusBuffer.QueryCCH() == 0 )
    {
        fResult = _StatusBuffer.Copy( DEFAULT_STATUS );

        if ( !fResult )
        {
            goto Failed;
        }
    }

    //
    // Calculate the content-length and add the header.
    // This is required for keep-alive.
    //

    itoa( _ResponseBuffer.QueryDataSize(),
          szContentLength,
          10 );

    fResult = AddHeaderToBufferedResponse( "Content-Length",
                                           szContentLength );

    if ( !fResult )
    {
        goto Failed;
    }

    //
    // Add an expires header if specified
    //

    if ( dwExpireSeconds != NO_EXPIRATION )
    {
        if ( dwExpireSeconds == IMMEDIATE_EXPIRATION )
        {
            fResult = strExpires.Copy( "0" );
        }
        else
        {
            FILETIME        ft;

            if ( GetCurrentTimeAsFileTime( &ft ) == FALSE )
            {
                goto Failed;
            }

            //
            // Add the cache milliseconds.  Note that FILETIME
            // is a count of 100 nanosecond invervals, thus we
            // need to multiply by 10000000 to get seconds
            //

            ((LARGE_INTEGER*)&ft)->QuadPart += dwExpireSeconds * 10000000;

            fResult = GetFileTimeAsString( &ft, &strExpires );

            //
            // On IIS 6, this response should be marked as
            // cacheable.
            //

            fIIS6Cacheable = TRUE;
        }

        if ( !fResult )
        {
            goto Failed;
        }

        if ( AddHeaderToBufferedResponse( "Expires",
                                          strExpires.QueryStr() ) == FALSE )
        {
            goto Failed;
        }
    }

    //
    // Terminate the header string
    //

    fResult = _HeaderBuffer.Append( "\r\n" );

    if ( !fResult )
    {
        goto Failed;
    }

    //
    // Call the private member function appropriate to
    // the IIS version being used.
    //

    if ( _dwIISMajorVersion <= 4 )
    {
        fResult = AsyncSendResponseIIS4( pfnCompletion );
    }
    else if ( _dwIISMajorVersion == 5 )
    {
        fResult = AsyncSendResponseIIS5( pfnCompletion );
    }
    else
    {
        fResult = AsyncSendResponseIIS6( pfnCompletion,
                                         fIIS6Cacheable );
    }

    return fResult;

Failed:

    //
    // No special cleanup required
    //

    return FALSE;

}

BOOL ISAPI_REQUEST::GetServerVariable | ( | CHAR * | szVariable,
 |  | ISAPI_STRINGW * | pIsapiStringW
 | ) |  |

Definition at line 549 of file IsapiRequest.cpp.

       :

    Gets a Unicode server variable value.

Arguments:

    szVariable    - The variable to get
    pIsapiStringW - ISAPI_STRINGW object to store the value on return

Returns:

    TRUE on success, FALSE on failure

--*/
{
    DWORD   cbData;
    BOOL    fResult;

    //
    // If the caller is not trying to get a Unicode value,
    // the this is the wrong function to call.  They
    // should pass an ISAPI_STRING instead of an
    // ISAPI_STRINGW to get the correct overloaded function.
    //

    if ( strnicmp( szVariable,
                   "UNICODE_",
                   sizeof("UNICODE_") - 1 ) != 0 )
    {
        SetLastError( ERROR_INVALID_PARAMETER );
        goto Failed;
    }

    //
    // Try and get the variable with the
    // buffer "as is".
    //

    cbData = pIsapiStringW->QueryBufferSize();

    fResult = _pEcb->GetServerVariable( _pEcb->ConnID,
                                        szVariable,
                                        pIsapiStringW->QueryStr(),
                                        &cbData );

    if ( !fResult )
    {
        //
        // If the failure was not due to the size of the
        // buffer, then just fail.
        //

        if ( GetLastError() != ERROR_INSUFFICIENT_BUFFER )
        {
            goto Failed;
        }

        //
        // Resize the buffer and try again
        //

        if ( !pIsapiStringW->ResizeBuffer( cbData ) )
        {
            goto Failed;
        }

        fResult = _pEcb->GetServerVariable( _pEcb->ConnID,
                                            szVariable,
                                            pIsapiStringW->QueryStr(),
                                            &cbData );
    }

    if ( fResult )
    {
        //
        // Adjust string size
        //

        pIsapiStringW->SetLen( cbData / sizeof(WCHAR) - 1 );
    }

    return fResult;

Failed:

    //
    // No special cleanup required
    //

    return FALSE;
}

BOOL ISAPI_REQUEST::GetServerVariable | ( | CHAR * | szVariable,
 |  | ISAPI_STRING * | pIsapiString
 | ) |  |

Definition at line 450 of file IsapiRequest.cpp.

       :

    Gets a server variable value.

Arguments:

    szVariable   - The variable to get
    pIsapiString - ISAPI_STRING object to store the value on return

Returns:

    TRUE on success, FALSE on failure

--*/
{
    DWORD   cbData;
    BOOL    fResult;

    //
    // If the caller is trying to get a Unicode value,
    // the this is the wrong function to call.  They
    // should pass an ISAPI_STRINGW instead of an
    // ISAPI_STRING to get the correct overloaded function.
    //

    if ( strnicmp( szVariable,
                   "UNICODE_",
                   sizeof("UNICODE_") - 1 ) == 0 )
    {
        SetLastError( ERROR_INVALID_PARAMETER );
        goto Failed;
    }

    //
    // Try and get the variable with the
    // buffer "as is".
    //

    cbData = pIsapiString->QueryBufferSize();

    fResult = _pEcb->GetServerVariable( _pEcb->ConnID,
                                        szVariable,
                                        pIsapiString->QueryStr(),
                                        &cbData );

    if ( !fResult )
    {
        //
        // If the failure was not due to the size of the
        // buffer, then just fail.
        //

        if ( GetLastError() != ERROR_INSUFFICIENT_BUFFER )
        {
            goto Failed;
        }

        //
        // Resize the buffer and try again
        //

        if ( !pIsapiString->ResizeBuffer( cbData ) )
        {
            goto Failed;
        }

        fResult = _pEcb->GetServerVariable( _pEcb->ConnID,
                                            szVariable,
                                            pIsapiString->QueryStr(),
                                            &cbData );
    }

    if ( fResult )
    {
        //
        // Adjust string size
        //

        pIsapiString->SetLen( cbData - sizeof(CHAR) );
    }

    return fResult;

Failed:

    //
    // No special cleanup required
    //

    return FALSE;
}

BOOL ISAPI_REQUEST::ImpersonateClient ( VOID )

Definition at line 1439 of file IsapiRequest.cpp.

       :

    Sets an impersonation token for the authenticated client
    on the calling thread.  If the token has been previously
    cached, use it.  Otherwise, get the correct token from ISAPI.

Arguments:

    None

Returns:

    TRUE on success, FALSE on failure

--*/
{
    BOOL    fResult;

    if ( _hImpersonationToken == NULL )
    {
        //
        // Get the token from the ISAPI
        //

        fResult = _pEcb->ServerSupportFunction( _pEcb->ConnID,
                                                HSE_REQ_GET_IMPERSONATION_TOKEN,
                                                &_hImpersonationToken,
                                                NULL,
                                                NULL );

        if ( !fResult )
        {
            goto Failed;
        }
    }

    return SetThreadToken( NULL, _hImpersonationToken );

Failed:

    return FALSE;
}

BOOL ISAPI_REQUEST::PrintfToResponseBuffer | ( | CHAR * | szFormat,
 |  |  | ...
 | ) |  |

Definition at line 888 of file IsapiRequest.cpp.

       :

    Appends string data to the response buffer using printf-style
    formatting and a variable number of arguments.

    Note that if this data causes the size of the buffer to exceed
    its max allocation, then this function will fail.

Arguments:

    szFormat - The string format
    ...      - Zero or more additional arguments

Returns:

    TRUE on success, FALSE on failure

--*/
{
    ISAPI_STRING    CurrentChunk( _dwMaxSyncWriteSize );
    va_list         args;
    BOOL            fResult;

    //
    // Build a formatted chunk to append to the response
    // buffer.  We'll use the max sync write size value
    // as the limit to the size that the formatted chunk
    // can be.
    //

    va_start( args, szFormat );

    fResult = CurrentChunk.Vsprintf( szFormat,
                                     args );

    va_end( args );

    if ( !fResult )
    {
        goto Failed;
    }

    //
    // Append the chunk to the response buffer.
    //

    fResult = _ResponseBuffer.AppendData( CurrentChunk.QueryStr(),
                                          CurrentChunk.QueryCCH() );

    return fResult;

Failed:

    //
    // No special cleanup required.
    //

    return FALSE;
}

EXTENSION_CONTROL_BLOCK * ISAPI_REQUEST::QueryEcb ( VOID )

Definition at line 1255 of file IsapiRequest.cpp.

       :

    Returns the ECB associated with this ISAPI_REQUEST object

Arguments:

    None

Returns:

    The EXTENSION_CONTROL_BLOCK

--*/
{
    return _pEcb;
}

DWORD ISAPI_REQUEST::QueryIISMajorVersion ( VOID )

Definition at line 1278 of file IsapiRequest.cpp.

       :

    Returns the IIS major version

Arguments:

    None

Returns:

    The IIS major version

--*/
{
    return _dwIISMajorVersion;
}

DWORD ISAPI_REQUEST::QueryIISMinorVersion ( VOID )

Definition at line 1301 of file IsapiRequest.cpp.

       :

    Returns the IIS minor version

Arguments:

    None

Returns:

    The IIS minor version

--*/
{
    return _dwIISMinorVersion;
}

BOOL ISAPI_REQUEST::QueryIsClientConnected ( VOID )

Definition at line 1324 of file IsapiRequest.cpp.

       :

    Determines if the client is still connected

Arguments:

    None

Returns:

    TRUE if the client is connected, FALSE if not.

--*/
{
    //
    // Check to see if the client is connected
    //
    // Note that this call is somewhat expensive in the
    // OOP case, since an RPC call must occur between the
    // dllhost and inetinfo processes.  It should be used
    // sparingly.
    //
    // In the spirit of this, we will only make the call
    // if we believe that the client is still connected.
    //

    if ( _fClientIsConnected == TRUE )
    {
        if ( _pEcb->ServerSupportFunction( _pEcb->ConnID,
                                           HSE_REQ_IS_CONNECTED,
                                           &_fClientIsConnected,
                                           NULL,
                                           NULL ) == FALSE )
        {
            //
            // If the call fails, we should assume that the
            // client is really still connected.
            //

            _fClientIsConnected = TRUE;
        }
    }

    //
    // If the client has been disconnected, set the last
    // error to WSAECONNRESET, as this is generally the
    // error that will result if an extension attempts to
    // do IO with a client that has disconnected.
    //

    if ( !_fClientIsConnected )
    {
        SetLastError( WSAECONNRESET );
    }

    return _fClientIsConnected;
}

DWORD ISAPI_REQUEST::QueryMaxResponseBufferSize ( VOID )

Definition at line 1209 of file IsapiRequest.cpp.

       :

    Returns the maximum size of the response buffer

Arguments:

    None

Returns:

    The maximum response buffer size

--*/
{
    return _ResponseBuffer.QueryMaxAlloc();
}

DWORD ISAPI_REQUEST::QueryMaxSyncWriteSize ( VOID )

Definition at line 1151 of file IsapiRequest.cpp.

       :

    Returns the maximum write size supported in a single call to
    one of the following member functions:

      SyncWriteClientArgs
      SyncWriteClientString
      SyncWriteCompleteResponse
      PrintfToResponseBuffer

Arguments:

    None

Returns:

    The maximum write size

--*/
{
    return _dwMaxSyncWriteSize;
}

DWORD ISAPI_REQUEST::QueryOsMajorVersion ( VOID ) [private]

Definition at line 1866 of file IsapiRequest.cpp.

       :

    Returns the major version of the OS.

    Since this requires a system call, the result will be
    stored in a static member of this function so that we
    only need to do it once for all ISAPI_REQUEST instances.

Arguments:

    None

Returns:

    The OS major version

--*/
{
    OSVERSIONINFO   OsVersionInfo;
    BOOL            fResult;

    //
    // If we've already determined the major version,
    // use the data already acquired.
    //
    // Note that _dwOsMajorVersion is static, so we don't
    // do the below system call for every instance of this
    // object.
    //

    if ( _dwOsMajorVersion != 0 )
    {
        goto Done;
    }

    //
    // Otherwise, get it
    //

    fResult = GetVersionEx( &OsVersionInfo );

    if ( !fResult )
    {
        //
        // Hmmm.  Better to assume 4, I guess.
        //

        _dwOsMajorVersion = 4;

        goto Done;
    }

    _dwOsMajorVersion = OsVersionInfo.dwMajorVersion;

Done:

    return _dwOsMajorVersion;
}

BOOL ISAPI_REQUEST::ReadAllEntity ( ISAPI_BUFFER * pBuffer )

Definition at line 648 of file IsapiRequest.cpp.

       :

    Reads all request entity into the specified ISAPI_BUFFER.

    Note that this function will fail if the max allocation
    size of the target ISAPI_BUFFER is less than the size of
    the request's entity data.

Arguments:

    pBuffer - The ISAPI_BUFFER to store the result on return

Returns:

    TRUE on success, FALSE on failure

--*/
{
    ISAPI_STRING    TransferEncoding;
    BYTE            pInline[INLINE_READ_SIZE];
    BYTE *          pNewData;
    DWORD           cbRemaining;
    DWORD           cbReadThisTime;
    BOOL            fChunked = FALSE;

    //
    // Is this a chunked request?
    //

    if ( GetServerVariable( "HTTP_TRANSFER_ENCODING",
                            &TransferEncoding ) )
    {
        if ( stricmp( TransferEncoding.QueryStr(), "chunked" ) == 0 )
        {
            fChunked = TRUE;
        }
    }

    //
    // If the request is not chunked, go ahead and resize
    // the buffer now, so that no new allocations will be
    // done while reading stuff in.
    //

    if ( !fChunked && !pBuffer->Resize( _pEcb->cbTotalBytes ) )
    {
        return FALSE;
    }

    //
    // Copy the already available bytes into the buffer
    //

    if ( !pBuffer->SetData( _pEcb->lpbData, _pEcb->cbAvailable ) )
    {
        return FALSE;
    }

    //
    // Loop on ReadClient until we've got all the data
    //

    cbRemaining = _pEcb->cbTotalBytes - _pEcb->cbAvailable;
    pNewData = pInline;

    while ( fChunked || cbRemaining )
    {
        //
        // If the request is not chunked, then read directly
        // into the buffer
        //

        if ( !fChunked )
        {
            pNewData = (BYTE*)pBuffer->QueryPtr() +
                       _pEcb->cbTotalBytes -
                       cbRemaining;
        }

        //
        // Read the data
        //

        cbReadThisTime = cbRemaining;

        if ( fChunked && cbRemaining > INLINE_READ_SIZE )
        {
            cbReadThisTime = INLINE_READ_SIZE;
        }

        if ( !_pEcb->ReadClient( _pEcb->ConnID,
                                 pNewData,
                                 &cbReadThisTime ) )
        {
            //
            // Since the call failed, we should assume
            // that the client is no longer connected.
            //

            _fClientIsConnected = FALSE;

            return FALSE;
        }

        //
        // If the request is not chunked, then we just need
        // to decrement the remaining byte count, else we
        // need to do some extra processing to handle the
        // chunk.
        //

        if ( !fChunked )
        {
            cbRemaining -= cbReadThisTime;
        }
        else
        {
            //
            // If we successfully read zero bytes, then we
            // are done.
            //

            if ( cbReadThisTime == 0 )
            {
                return TRUE;
            }

            //
            // We got some data.  Append it to the buffer.
            //

            if ( !pBuffer->AppendData( pInline, cbReadThisTime ) )
            {
                return FALSE;
            }
        }
    }

    //
    // We need to update the buffer to reflect the data
    // placed there in the read loop.
    //

    if ( !pBuffer->SetDataSize( _pEcb->cbTotalBytes ) )
    {
        return FALSE;
    }

    //
    // Done.
    //

    return TRUE;
}

BOOL ISAPI_REQUEST::SetBufferedResponseStatus ( CHAR * szStatus )

Definition at line 809 of file IsapiRequest.cpp.

       :

    Sets the HTTP status code to be used in a buffered response

Arguments:

    szStatus - The status (ie. "200 OK") to be sent with the response

Returns:

    TRUE on success, FALSE on failure

--*/
{
    return _StatusBuffer.Copy( szStatus );
}

VOID ISAPI_REQUEST::SetMaxResponseBufferSize ( DWORD dwMaxResponseBufferSize )

Definition at line 1232 of file IsapiRequest.cpp.

       :

    Sets the maximum size of the response buffer

Arguments:

    The maximum buffer size

Returns:

    None

--*/
{
    _ResponseBuffer.SetMaxAlloc( dwMaxResponseBufferSize );
}

VOID ISAPI_REQUEST::SetMaxSyncWriteSize ( DWORD dwMaxSyncWriteSize )

Definition at line 1180 of file IsapiRequest.cpp.

       :

    Sets the maximum write size supported in a single call to
    one of the following member functions:

      SyncWriteClientArgs
      SyncWriteClientString
      SyncWriteCompleteResponse
      PrintfToResponseBuffer

Arguments:

    The maximum write size

Returns:

    None

--*/
{
    _dwMaxSyncWriteSize = dwMaxSyncWriteSize;
}

BOOL ISAPI_REQUEST::SyncSendStatusAndHeaders | ( | CHAR * | szStatus = NULL,
 |  | CHAR * | szHeaders = NULL
 | ) |  |

Definition at line 146 of file IsapiRequest.cpp.

       :

    Synchronously sends the specified HTTP status codes
    and response headers to the client.

Arguments:

    szStatus  - The status to send (ie. "200 OK")
    szHeaders - The response headers to send

Returns:

    TRUE on success, FALSE on failure

--*/
{
    DWORD   cchHeaders;
    DWORD   dwStatus;
    BOOL    fResult;

    //
    // Set defaults if needed
    //

    if ( szStatus == NULL )
    {
        szStatus = DEFAULT_STATUS;
    }

    if ( szHeaders == NULL )
    {
        szHeaders = DEFAULT_HEADERS;
    }

    //
    // Make sure that headers are properly terminated
    //

    cchHeaders = strlen( szHeaders );

    if ( strcmp( szHeaders, DEFAULT_HEADERS ) != 0 )
    {
        //
        // If we are not using the default value, szHeaders
        // must end with "\r\n\r\n" (the first "\r\n" pair is
        // to mark the end of the last header value, and the
        // second is to mark the end of all headers.
        //

        if ( cchHeaders < 4 )
        {
            SetLastError( ERROR_INVALID_PARAMETER );
            goto Failed;
        }

        if ( strcmp( szHeaders + cchHeaders - 4, "\r\n\r\n" ) != 0 )
        {
            SetLastError( ERROR_INVALID_PARAMETER );
            goto Failed;
        }
    }

    //
    // To ensure proper logging, we need to set the dwHttpStatusCode
    // member on the ECB to reflect the proper value.  We'll get
    // this from the szStatus string, and ensure that it is in the
    // range of 100 to 999.
    //

    dwStatus = atoi( szStatus );

    if ( dwStatus < 100 ||
         dwStatus > 999 )
    {
        SetLastError( ERROR_INVALID_PARAMETER );
        goto Failed;
    }

    _pEcb->dwHttpStatusCode = dwStatus;

    //
    // Send the response now.
    //
    // Note that HSE_REQ_SEND_RESPONSE header will take care
    // of managing proper keep-alive behavior.  Basically, if
    // the headers contains a content-length, then IIS will
    // cause the response to honor keep-alive.  If not, then
    // IIS will close the connection when the ISAPI extension
    // is done processing.
    //

    fResult =  _pEcb->ServerSupportFunction( _pEcb->ConnID,
                                             HSE_REQ_SEND_RESPONSE_HEADER,
                                             szStatus,
                                             NULL,
                                             (DWORD*)szHeaders );

    if ( !fResult )
    {
        //
        // Since the call failed, we should assume
        // that the client is no longer connected.
        //

        _fClientIsConnected = FALSE;

        goto Failed;
    }

    return TRUE;

Failed:

    //
    // No special cleanup required
    //

    return FALSE;
}

BOOL ISAPI_REQUEST::SyncWriteClientArgs | ( | CHAR * | szFormat,
 |  | va_list | args
 | ) |  |

Definition at line 273 of file IsapiRequest.cpp.

       :

    Synchronously sends a string to the client using
    vsprintf-style formatting and a va_list of arguments.

Arguments:

    szFormat - The string format to send
    args     - A va_list of additional arguments

Returns:

    TRUE on success, FALSE on failure

--*/
{
    ISAPI_STRING    IsapiString( _dwMaxSyncWriteSize );
    DWORD           cbData;
    BOOL            fResult;

    //
    // Build the formatted data
    //

    fResult = IsapiString.Vsprintf( szFormat,
                                    args );

    if ( !fResult )
    {
        goto Failed;
    }

    //
    // Send it
    //

    cbData = IsapiString.QueryCCH();

    fResult = _pEcb->WriteClient( _pEcb->ConnID,
                                  IsapiString.QueryStr(),
                                  &cbData,
                                  HSE_IO_SYNC | HSE_IO_NODELAY );

    if ( !fResult )
    {
        //
        // Since the call failed, we should assume
        // that the client is no longer connected.
        //

        _fClientIsConnected = FALSE;
    }

    return fResult;

Failed:

    //
    // No special cleanup required
    //

    return FALSE;
}

BOOL ISAPI_REQUEST::SyncWriteClientString | ( | CHAR * | szFormat,
 |  |  | ...
 | ) |  |

Definition at line 344 of file IsapiRequest.cpp.

       :

    Synchronously sends a string to the client using
    printf-style formatting an a variable number of
    arguments

Arguments:

    szFormat - The string format
    ...      - Zero or more additional arguments

Returns:

    TRUE on success, FALSE on failure

--*/
{
    BOOL    fResult;
    va_list args;

    //
    // Let SyncWriteClientArgs do the work
    //

    va_start( args, szFormat );

    fResult = SyncWriteClientArgs( szFormat,
                                   args );

    va_end( args );

    return fResult;
}

BOOL ISAPI_REQUEST::SyncWriteCompleteResponse | ( | CHAR * | szStatus,
 |  | CHAR * | szHeaders,
 |  | CHAR * | szFormat,
 |  |  | ...
 | ) |  |

Definition at line 385 of file IsapiRequest.cpp.

       :

    Synchronously sends a complete response to the client
    using the specified status and headers, with a formatted
    string with variable arguments as the entity.

Arguments:

    szStatus  - The status to send (ie. "200 OK")
    szHeaders - The response headers to send
    szFormat  - The string format
    ...       - Zero or more additional arguments

Returns:

    TRUE on success, FALSE on failure

--*/
{
    va_list args;
    BOOL    fResult;

    //
    // Send the status and headers
    //

    fResult = SyncSendStatusAndHeaders( szStatus,
                                        szHeaders );

    if ( !fResult )
    {
        goto Failed;
    }

    //
    // Send the entity
    //

    va_start( args, szFormat );

    fResult = SyncWriteClientArgs( szFormat,
                                   args );

    va_end( args );

    return fResult;

Failed:

    //
    // No special cleanup required
    //

    return FALSE;
}

BOOL ISAPI_REQUEST::UnimpersonateClient ( VOID )

Definition at line 1388 of file IsapiRequest.cpp.

       :

    Removes an impersonation token from the calling
    thread.  On the first call per object, the authenticated
    client token will be cached so that it can be easily
    reapplied by ImpersonateClient.

Arguments:

    None

Returns:

    TRUE on success, FALSE on failure

--*/
{
    BOOL    fResult = TRUE;

    //
    // If we haven't already got the client's impersonation
    // token, then we need to get it now.
    //

    if ( _hImpersonationToken == NULL )
    {
        fResult = _pEcb->ServerSupportFunction( _pEcb->ConnID,
                                                HSE_REQ_GET_IMPERSONATION_TOKEN,
                                                &_hImpersonationToken,
                                                NULL,
                                                NULL );

        if ( !fResult )
        {
            goto Failed;
        }
    }

    return RevertToSelf();

Failed:

    return FALSE;
}

Member Data Documentation

DWORD ISAPI_REQUEST::_dwIISMajorVersion [private]

Definition at line 179 of file IsapiRequest.h.

DWORD ISAPI_REQUEST::_dwIISMinorVersion [private]

Definition at line 180 of file IsapiRequest.h.

DWORD ISAPI_REQUEST::_dwMaxSyncWriteSize [private]

Definition at line 178 of file IsapiRequest.h.

DWORD ISAPI_REQUEST::_dwOsMajorVersion = 0 [static, private]

Definition at line 181 of file IsapiRequest.h.

BOOL ISAPI_REQUEST::_fClientIsConnected [private]

Definition at line 182 of file IsapiRequest.h.

BOOL ISAPI_REQUEST::_fNeedDoneWithSession [private]

Definition at line 183 of file IsapiRequest.h.

ISAPI_STRING ISAPI_REQUEST::_HeaderBuffer [private]

Definition at line 176 of file IsapiRequest.h.

HANDLE ISAPI_REQUEST::_hImpersonationToken [private]

Definition at line 184 of file IsapiRequest.h.

EXTENSION_CONTROL_BLOCK* ISAPI_REQUEST::_pEcb [private]

Definition at line 174 of file IsapiRequest.h.

ISAPI_BUFFER ISAPI_REQUEST::_ResponseBuffer [private]

Definition at line 177 of file IsapiRequest.h.

ISAPI_STRING ISAPI_REQUEST::_StatusBuffer [private]

Definition at line 175 of file IsapiRequest.h.

The documentation for this class was generated from the following files:
  • Web/iis/ISAPI_6.0/inc/IsapiRequest.h
  • Web/iis/ISAPI_6.0/src/IsapiRequest.cpp
Generated on Wed Nov 13 2024 16:57:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ISAPI_STRING Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

ISAPI_STRING Class Reference

#include "IsapiString.h"

List of all members.

Public Member Functions

ISAPI_STRING (DWORD dwMaxAlloc=0)
virtual | ~ISAPI_STRING ()
BOOL | Append (CHAR *szString, DWORD cchString=0)
BOOL | AppendW (WCHAR *szStringW, DWORD cchStringW=0)
BOOL | Base64Encode (VOID *pBuffer, DWORD cbBuffer)
VOID | CalcLen (VOID)
BOOL | Copy (CHAR *szString, DWORD cchString=0)
BOOL | CopyW (WCHAR *szStringW, DWORD cchStringW=0)
BOOL | Escape (BOOL fAllowDoubleEscaping=FALSE)
CHAR * | FindStr (CHAR *szSubString, BOOL fCaseInsensitive=FALSE, DWORD dwStartingOffset=0)
BOOL | Printf (CHAR *szString,...)
DWORD | QueryBufferSize (VOID)
DWORD | QueryCB (VOID)
DWORD | QueryCCH (VOID)
DWORD | QueryMaxAlloc (VOID)
CHAR * | QueryStr (VOID)
BOOL | ResizeBuffer (DWORD cbSize)
BOOL | SetLen (DWORD cchNewLength)
VOID | SetMaxAlloc (DWORD dwMaxAlloc)
VOID | Unescape (VOID)
BOOL | Vsprintf (CHAR *szFormat, va_list args)
VOID | ZeroBuffer (VOID)

Private Member Functions

BOOL | CopyToOffset (CHAR *szString, DWORD cchString, DWORD dwOffset)
BOOL | CopyWToOffset (WCHAR *szStringW, DWORD cchStringW, DWORD dwOffset)

Private Attributes

ISAPI_BUFFER _Buffer

Detailed Description

Definition at line 23 of file IsapiString.h.

Constructor & Destructor Documentation

ISAPI_STRING::ISAPI_STRING ( DWORD dwMaxAlloc = 0 )

Definition at line 58 of file IsapiString.cpp.

       :

    Constructor for ISAPI_STRING object

Arguments:

    dwMaxAlloc - The max allocation for the storage of this object

Returns:

    None

--*/
{
    _Buffer.SetMaxAlloc( dwMaxAlloc );
}

ISAPI_STRING::~ISAPI_STRING ( ) [virtual]

Definition at line 80 of file IsapiString.cpp.

       :

    Destructor for the ISAPI_STRING object

Arguments:

    None

Returns:

    None

--*/
{
}

Member Function Documentation

BOOL ISAPI_STRING::Append | ( | CHAR * | szString,
 |  | DWORD | cchString = 0
 | ) |  |

Definition at line 176 of file IsapiString.cpp.

       :

    Appends the specified NULL terminated string into the
    ISAPI_STRING object.

Arguments:

    szString  - The string to append
    cchString - The number of characters to append

Returns:

    TRUE on success, FALSE on failure

--*/
{
    //
    // If necessary, calculate the length
    // of the new data.
    //

    if ( cchString == 0 )
    {
        cchString = strlen( szString );
    }

    return CopyToOffset( szString,
                         cchString,
                         QueryCCH() );
}

BOOL ISAPI_STRING::AppendW | ( | WCHAR * | szStringW,
 |  | DWORD | cchStringW = 0
 | ) |  |

Definition at line 214 of file IsapiString.cpp.

       :

    Appends the specified NULL terminated Unicode string into the
    ISAPI_STRING object.

Arguments:

    szStringW  - The Unicode string to append
    cchStringW - The number of characters to append

Returns:

    TRUE on success, FALSE on failure

--*/
{
    //
    // If necessary, calculate the length
    // of the new data
    //

    if ( cchStringW == 0 )
    {
        cchStringW = wcslen( szStringW );
    }

    return CopyWToOffset( szStringW,
                          cchStringW,
                          QueryCCH() );
}

BOOL ISAPI_STRING::Base64Encode | ( | VOID * | pBuffer,
 |  | DWORD | cbBuffer
 | ) |  |

Definition at line 706 of file IsapiString.cpp.

       :

    Base64 encodes the specified buffer into the ISAPI_STRING

Arguments:

    pBuffer  - The buffer to encode
    cbBuffer - The size of the buffer

Returns:

    TRUE on success, FALSE on failure

--*/
{
    CHAR    szChunk[SIZE_ENCODED_CHUNK+1];
    BYTE *  pCursor;
    DWORD   cbRemaining;
    DWORD   cbThisTime;
    BOOL    fResult;

    //
    // Encode the data in chunks
    //

    pCursor = (BYTE*)pBuffer;
    cbRemaining = cbBuffer;

    while ( cbRemaining )
    {
        cbThisTime = cbRemaining > SIZE_UNENCODED_CHUNK ?
                     SIZE_UNENCODED_CHUNK :
                     cbRemaining;

        Base64EncodeChunk( pCursor,
                           cbThisTime,
                           szChunk );

        fResult = Append( szChunk, SIZE_ENCODED_CHUNK );

        if ( !fResult )
        {
            goto Failed;
        }

        cbRemaining -= cbThisTime;
        pCursor += cbThisTime;
    }

    return TRUE;

Failed:

    //
    // No special cleanup required
    //

    return FALSE;
}

VOID ISAPI_STRING::CalcLen ( VOID )

Definition at line 385 of file IsapiString.cpp.

       :

    Calculates the size in characters of the ISAPI_STRING data by
    doing a strlen.

Arguments:

    None

Returns:

    None

--*/
{
    _Buffer.SetDataSize( strlen( QueryStr() ) + 1 );
}

BOOL ISAPI_STRING::Copy | ( | CHAR * | szString,
 |  | DWORD | cchString = 0
 | ) |  |

Definition at line 100 of file IsapiString.cpp.

       :

    Copies the specified NULL terminated string into the
    ISAPI_STRING object.

Arguments:

    szString  - The string to copy
    cchString - The number of characters to copy

Returns:

    TRUE on success, FALSE on failure

--*/
{
    //
    // If necessary, calculate the length
    // of the new data.
    //

    if ( cchString == 0 )
    {
        cchString = strlen( szString );
    }

    return CopyToOffset( szString,
                         cchString,
                         0 );
}

BOOL ISAPI_STRING::CopyToOffset | ( | CHAR * | szString,
 |  | DWORD | cchString,
 |  | DWORD | dwOffset |
 | ) |  |  | [private]

Definition at line 982 of file IsapiString.cpp.

       :

    Copies a string into the ISAPI_STRING's data, starting at the
    specified offset.

Arguments:

    szString  - The string to copy
    cchString - The number of characters to copy
    dwOffset  - The offset at which to copy

Returns:

    TRUE on success, FALSE on failure

--*/
{
    DWORD   cbData;

    //
    // Ensure that we have enough storage available
    //

    cbData = cchString + sizeof(CHAR);

    if ( ResizeBuffer( cbData + dwOffset ) == FALSE )
    {
        return FALSE;
    }

    //
    // Copy the data and ensure proper termination
    //

    CopyMemory( QueryStr() + dwOffset, szString, cbData );

    SetLen( QueryCCH() + cbData - sizeof(CHAR) );

    return TRUE;
}

BOOL ISAPI_STRING::CopyW | ( | WCHAR * | szStringW,
 |  | DWORD | cchStringW = 0
 | ) |  |

Definition at line 138 of file IsapiString.cpp.

       :

    Copies the specified NULL terminated Unicode string into the
    ISAPI_STRING object.

Arguments:

    szStringW  - The Unicode string to copy
    cchStringW - The number of characters to copy

Returns:

    TRUE on success, FALSE on failure

--*/
{
    //
    // If necessary, calculate the length
    // of the new data
    //

    if ( cchStringW == 0 )
    {
        cchStringW = wcslen( szStringW );
    }

    return CopyWToOffset( szStringW,
                          cchStringW,
                          0 );
}

BOOL ISAPI_STRING::CopyWToOffset | ( | WCHAR * | szStringW,
 |  | DWORD | cchStringW,
 |  | DWORD | dwOffset |
 | ) |  |  | [private]

Definition at line 1031 of file IsapiString.cpp.

       :

    Copies a Unicode string into the ISAPI_STRING's data,
    starting at the specified offset.

Arguments:

    szStringW  - The Unicode string to copy
    cchStringW - The number of characters to copy
    dwOffset   - The offset at which to copy

Returns:

    TRUE on success, FALSE on failure

--*/
{
    CHAR *  pCursor;
    DWORD   cbData;
    DWORD   cbCopied;
    DWORD   cchData;

    cchData = QueryCCH();

    //
    // Ensure that we have enough storage available
    //

    cbData = cchStringW + sizeof(CHAR);

    if ( QueryBufferSize() < cbData + dwOffset &&
         ResizeBuffer( cbData + dwOffset ) == FALSE )
    {
        goto Failed;
    }

    //
    // Set the point into which the copy will occur
    //

    pCursor = QueryStr() + cchData;

    //
    // Convert the wide string into ANSI using
    // the default system code page.
    //

    cbCopied = WideCharToMultiByte( CP_ACP,
                                    0,
                                    szStringW,
                                    cchStringW,
                                    pCursor,
                                    cbData,
                                    NULL,
                                    NULL );

    if ( cbCopied == 0 )
    {
        goto Failed;
    }

    SetLen( cchData + cbCopied );

    return TRUE;

Failed:

    //
    // No special cleanup to be done
    //

    return FALSE;
}

BOOL ISAPI_STRING::Escape ( BOOL fAllowDoubleEscaping = FALSE )

Definition at line 773 of file IsapiString.cpp.

       :

    Escape encodes the ISAPI_STRING's data per RFC2396

Arguments:

    fAllowDoubleEscaping - If FALSE, then this function will not encode
                           any '%' characters that are part of an escape
                           sequence.  If TRUE, all '%' characters will
                           be encoded.

Returns:

    TRUE on success, FALSE on failure

--*/
{
    ISAPI_STRING    strCooked;
    DWORD           dwNumEscapes = 0;
    CHAR            szHex[3] = {0};
    BYTE *          pRead;
    BYTE *          pWrite;

    //
    // Walk through the string once.  If there
    // are no escapes, then we can just return.
    //

    pRead = (BYTE*)_Buffer.QueryPtr();

    while ( *pRead != '\0' )
    {
        if ( ( fAllowDoubleEscaping ||
               !IsEscapeSequence( (CHAR*)pRead ) ) &&
             ShouldEscape( *pRead ) )
        {
            dwNumEscapes++;
        }

        pRead++;
    }

    if ( dwNumEscapes == 0 )
    {
        return TRUE;
    }

    //
    // Make sure that our cooked string buffer is big enough, so
    // we can manipulate its pointer directly.
    //

    if ( strCooked.ResizeBuffer( QueryCB() + dwNumEscapes * 2 + 1 ) == FALSE )
    {
        goto Failed;
    }

    pRead = (BYTE*)_Buffer.QueryPtr();
    pWrite = (BYTE*)strCooked.QueryStr();

    while ( *pRead != '\0' )
    {
        if ( ( fAllowDoubleEscaping ||
               !IsEscapeSequence( (CHAR*)pRead ) ) &&
             ShouldEscape( *pRead ) )
        {
            itoa( *pRead, szHex, 16 );

            *pWrite = '%';
            *(pWrite+1) = szHex[0];
            *(pWrite+2) = szHex[1];

            pRead++;
            pWrite += 3;

            continue;
        }

        *pWrite = *pRead;

        pRead++;
        pWrite++;
    }

    *pWrite = '\0';

    if ( Copy( strCooked.QueryStr() ) == FALSE )
    {
        goto Failed;
    }

    return TRUE;

Failed:

    return FALSE;
}

CHAR * ISAPI_STRING::FindStr | ( | CHAR * | szSubString,
 |  | BOOL | fCaseInsensitive = FALSE,
 |  | DWORD | dwStartingOffset = 0
 | ) |  |

Definition at line 595 of file IsapiString.cpp.

       :

    Finds the specified sub-string in the ISAPI_STRING's
    data.

Arguments:

    szSubString      - The sub-string to find
    fCaseInsensitive - If TRUE, does a case insensitive search
    dwStartingOffset - The starting offset in the ISAPI_STRING to start search

Returns:

    Pointer to the instance of the sub-string if found, NULL if not found

--*/
{
    CHAR *  pCursor;
    CHAR *  pEnd;
    CHAR *  szFound;
    CHAR *  szString;
    CHAR    c1;
    CHAR    c2;
    DWORD   cchString;
    DWORD   cchSubString;
    DWORD   cchData;
    DWORD   n;

    //
    // If we are trying to search beyond the length
    // of the string, then we aren't going to find it
    //

    cchData = QueryCCH();

    if ( dwStartingOffset > cchData )
    {
        goto NotFound;
    }

    szString = QueryStr() + dwStartingOffset;

    cchString = cchData - dwStartingOffset;

    //
    // If szString is smaller than szSubString, then
    // we aren't going to find it.
    //

    cchSubString = strlen( szSubString );

    if ( cchSubString > cchString )
    {
        goto NotFound;
    }

    //
    // Set boundaries for the search
    //

    pEnd = szString + cchString - cchSubString;

    //
    // Search now
    //

    szFound = NULL;

    for ( pCursor = szString; pCursor <= pEnd; pCursor++ )
    {
        c1 = fCaseInsensitive ? UPCASE_ANSI_CHAR( *pCursor ) : *pCursor;
        c2 = fCaseInsensitive ? UPCASE_ANSI_CHAR( *szSubString ) : *szSubString;

        if ( c1 == c2 )
        {
            szFound = pCursor;

            for ( n = 1; n < cchSubString; n++ )
            {
                c1 = fCaseInsensitive ? UPCASE_ANSI_CHAR( *(pCursor+n) ) : *(pCursor+n);
                c2 = fCaseInsensitive ? UPCASE_ANSI_CHAR( *(szSubString+n) ) : *(szSubString+n);

                if ( c1 != c2 )
                {
                    szFound = NULL;
                    break;
                }
            }

            if ( szFound )
            {
                return szFound;
            }
        }
    }

NotFound:

    SetLastError( ERROR_INVALID_INDEX );

    return NULL;
}

BOOL ISAPI_STRING::Printf | ( | CHAR * | szString,
 |  |  | ...
 | ) |  |

Definition at line 252 of file IsapiString.cpp.

       :

    Sets the specified printf-style formatted string
    into the ISAPI_STRING object using a variable number
    of arguments.

Arguments:

    szString - The string format
    ...      - Zero or more additional arguments

Returns:

    TRUE on success, FALSE on failure

--*/
{
    BOOL    fResult;

    //
    // Let ISAPI_BUFFER::Vsprintf do the work
    //

    va_list args;

    va_start( args, szString );

    fResult = Vsprintf( szString,
                        args );

    va_end( args );

    return fResult;
}

DWORD ISAPI_STRING::QueryBufferSize ( VOID )

Definition at line 502 of file IsapiString.cpp.

       :

    Returns the number of bytes in the ISAPI_STRING data buffer

Arguments:

    None

Returns:

    The number of bytes

--*/
{
    return _Buffer.QueryBufferSize();
}

DWORD ISAPI_STRING::QueryCB ( VOID )

Definition at line 409 of file IsapiString.cpp.

       :

    Returns the number of bytes (not including NULL terminator)
    in the ISAPI_STRING data

Arguments:

    None

Returns:

    The number of bytes

--*/
{
    return QueryCCH();
}

DWORD ISAPI_STRING::QueryCCH ( VOID )

Definition at line 433 of file IsapiString.cpp.

       :

    Returns the number of characters (not including NULL terminator)
    in the ISAPI_STRING data

Arguments:

    None

Returns:

    The number of characters

--*/
{
    DWORD   cbBuffer = _Buffer.QueryDataSize();

    return cbBuffer == 0 ? 0 : cbBuffer - 1;
}

DWORD ISAPI_STRING::QueryMaxAlloc ( VOID )

Definition at line 549 of file IsapiString.cpp.

       :

    Returns the max allocation size for the ISAPI_STRING's buffer

Arguments:

    None

Returns:

    The max allocation size

--*/
{
    return _Buffer.QueryMaxAlloc();
}

CHAR * ISAPI_STRING::QueryStr ( VOID )

Definition at line 935 of file IsapiString.cpp.

       :

    Returns a pointer to the ISAPI_STRING's data

Arguments:

    None

Returns:

    The data pointer

--*/
{
    return (CHAR*)_Buffer.QueryPtr();
}

BOOL ISAPI_STRING::ResizeBuffer ( DWORD cbSize )

Definition at line 525 of file IsapiString.cpp.

       :

    Guarantees that the data storage buffer of the ISAPI_STRING
    object is at least the number of specified bytes.

Arguments:

    cbSize - The target size

Returns:

    TRUE on success, FALSE on failure

--*/
{
    return _Buffer.Resize( cbSize );
}

BOOL ISAPI_STRING::SetLen ( DWORD cchNewLength )

Definition at line 459 of file IsapiString.cpp.

       :

    Sets the length of the data in the ISAPI_STRING object,
    truncating the current data if necessary.

Arguments:

    cchNewLength - The new data length.

Returns:

    TRUE on success, FALSE on failure.

--*/
{
    CHAR *  pCursor;

    //
    // Ensure that we don't set the length to
    // something longer than the current buffer
    //

    if ( cchNewLength > QueryBufferSize() - 1 )
    {
        SetLastError( ERROR_INVALID_PARAMETER );
        return FALSE;
    }

    pCursor = QueryStr();

    pCursor[cchNewLength] = '\0';

    _Buffer.SetDataSize( cchNewLength + sizeof(CHAR) );

    return TRUE;
}

VOID ISAPI_STRING::SetMaxAlloc ( DWORD dwMaxAlloc )

Definition at line 572 of file IsapiString.cpp.

       :

    Sets the max allocation size for the ISAPI_STRING's buffer

Arguments:

    The max allocation size

Returns:

    None

--*/
{
    _Buffer.SetMaxAlloc( dwMaxAlloc );
}

VOID ISAPI_STRING::Unescape ( VOID )

Definition at line 877 of file IsapiString.cpp.

       :

    Decodes escape sequences in the ISAPI_STRING's data

Arguments:

    None

Returns:

    None

--*/
{
    CHAR *  pRead;
    CHAR *  pWrite;
    CHAR    szHex[3] = {0};
    BYTE    c;

    pRead = (CHAR*)_Buffer.QueryPtr();
    pWrite = pRead;

    while ( *pRead )
    {
        if ( IsEscapeSequence( pRead ) )
        {
            szHex[0] = *(pRead+1);
            szHex[1] = *(pRead+2);

            c = (BYTE)strtoul( szHex, NULL, 16 );

            *pWrite = c;

            pRead += 3;
            pWrite++;

            continue;
        }

        *pWrite = *pRead;

        pRead++;
        pWrite++;
    }

    *pWrite = '\0';

    CalcLen();

    return;
}

BOOL ISAPI_STRING::Vsprintf | ( | CHAR * | szFormat,
 |  | va_list | args
 | ) |  |

Definition at line 294 of file IsapiString.cpp.

       :

    Sets the specified printf-style formatted string
    into the ISAPI_STRING object using a va_list of args.

Arguments:

    szFormat - The string format
    ...      - Zero or more additional arguments

Returns:

    TRUE on success, FALSE on failure

--*/
{
    DWORD   cchWritten;
    DWORD   cbBuffer;
    BOOL    fResult;

    //
    // Build the formatted string
    //

    do
    {
        cbBuffer = QueryBufferSize();

        cchWritten = (DWORD)_vsnprintf( QueryStr(),
                                        cbBuffer,
                                        szFormat,
                                        args );

        if ( cchWritten == (DWORD)-1 )
        {
            //
            // If we just failed, and the buffer
            // is already at its maximum size,
            // then fail.
            //

            if ( cbBuffer >= QueryMaxAlloc() )
            {
                goto Failed;
            }

            //
            // Grow the buffer and try again
            //

            cbBuffer *= 2;

            //
            // Don't exceed the max buffer size
            //

            if ( cbBuffer > QueryMaxAlloc() )
            {
                cbBuffer = QueryMaxAlloc();
            }

            fResult = ResizeBuffer( cbBuffer );

            if ( !fResult )
            {
                goto Failed;
            }
        }

    } while ( cchWritten == (DWORD)-1 );

    SetLen( cchWritten );

    return TRUE;

Failed:

    //
    // No special cleanup needed
    //

    return FALSE;
}

VOID ISAPI_STRING::ZeroBuffer ( VOID )

Definition at line 958 of file IsapiString.cpp.

       :

    Fills the ISAPI_STRING's buffer with zeros

Arguments:

    None

Returns:

    None

--*/
{
    _Buffer.ZeroBuffer();
    _Buffer.SetDataSize( 0 );
}

Member Data Documentation

ISAPI_BUFFER ISAPI_STRING::_Buffer [private]

Definition at line 145 of file IsapiString.h.

The documentation for this class was generated from the following files:
  • Web/iis/ISAPI_6.0/inc/IsapiString.h
  • Web/iis/ISAPI_6.0/src/IsapiString.cpp
Generated on Wed Nov 13 2024 16:57:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ISAPI_STRINGW Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

ISAPI_STRINGW Class Reference

#include "IsapiStringW.h"

List of all members.

Public Member Functions

ISAPI_STRINGW (DWORD dwMaxAlloc=0)
virtual | ~ISAPI_STRINGW ()
BOOL | Append (WCHAR *szStringW, DWORD cchStringW=0)
BOOL | AppendA (CHAR *szString, DWORD cchString=0)
VOID | CalcLen (VOID)
BOOL | Copy (WCHAR *szStringW, DWORD cchStringW=0)
BOOL | CopyA (CHAR *szString, DWORD cchString=0)
BOOL | Printf (WCHAR *szStringW,...)
DWORD | QueryBufferSize (VOID)
DWORD | QueryCB (VOID)
DWORD | QueryCCH (VOID)
DWORD | QueryMaxAlloc (VOID)
WCHAR * | QueryStr (VOID)
BOOL | ResizeBuffer (DWORD cbSize)
BOOL | SetLen (DWORD cchNewLength)
VOID | SetMaxAlloc (DWORD dwMaxAlloc)
BOOL | Vsprintf (WCHAR *szFormatW, va_list args)

Private Member Functions

BOOL | CopyAToOffset (CHAR *szString, DWORD cchString, DWORD cchOffset)
BOOL | CopyToOffset (WCHAR *szStringW, DWORD cchStringW, DWORD cchOffset)

Private Attributes

ISAPI_BUFFER _Buffer

Detailed Description

Definition at line 23 of file IsapiStringW.h.

Constructor & Destructor Documentation

ISAPI_STRINGW::ISAPI_STRINGW ( DWORD dwMaxAlloc = 0 )

Definition at line 21 of file IsapiStringW.cpp.

       :

    Constructor for ISAPI_STRINGW object

Arguments:

    dwMaxAlloc - The max allocation for the storage of this object

Returns:

    None

--*/
{
    _Buffer.SetMaxAlloc( dwMaxAlloc );
}

ISAPI_STRINGW::~ISAPI_STRINGW ( ) [virtual]

Definition at line 43 of file IsapiStringW.cpp.

       :

    Destructor for ISAPI_STRING object

Arguments:

    None

Returns:

    None

--*/
{
}

Member Function Documentation

BOOL ISAPI_STRINGW::Append | ( | WCHAR * | szStringW,
 |  | DWORD | cchStringW = 0
 | ) |  |

Definition at line 137 of file IsapiStringW.cpp.

       :

    Appends a Unicode string to the ISAPI_STRINGW object

Arguments:

    szStringW  - The Unicode string to append
    cchStringW - The number of characters to append

Returns:

    TRUE on success, FALSE on failure

--*/
{
    //
    // If necessary, calculate the length
    // of the new data.
    //

    if ( cchStringW == 0 )
    {
        cchStringW = wcslen( szStringW );
    }

    return CopyToOffset( szStringW,
                         cchStringW,
                         QueryCCH() );
}

BOOL ISAPI_STRINGW::AppendA | ( | CHAR * | szString,
 |  | DWORD | cchString = 0
 | ) |  |

Definition at line 174 of file IsapiStringW.cpp.

       :

    Appends an ANSI string to the ISAPI_STRINGW object

Arguments:

    szString  - The ANSI string to append
    cchString - The number of characters to Append

Returns:

    TRUE on success, FALSE on failure

--*/
{
    //
    // If necessary, calculate the length
    // of the new data
    //

    if ( cchString == 0 )
    {
        cchString = strlen( szString );
    }

    return CopyAToOffset( szString,
                          cchString,
                          QueryCCH() );
}

VOID ISAPI_STRINGW::CalcLen ( VOID )

Definition at line 344 of file IsapiStringW.cpp.

       :

    Calculates the size in characters of the ISAPI_STRINGW data by
    doing a wcslen.

Arguments:

    None

Returns:

    None

--*/
{
    _Buffer.SetDataSize( wcslen( QueryStr() ) + 1 );
}

BOOL ISAPI_STRINGW::Copy | ( | WCHAR * | szStringW,
 |  | DWORD | cchStringW = 0
 | ) |  |

Definition at line 63 of file IsapiStringW.cpp.

       :

    Copies a Unicode string to the ISAPI_STRINGW object

Arguments:

    szStringW  - The Unicode string to copy
    cchStringW - The number of characters to copy

Returns:

    TRUE on success, FALSE on failure

--*/
{
    //
    // If necessary, calculate the length
    // of the new data.
    //

    if ( cchStringW == 0 )
    {
        cchStringW = wcslen( szStringW );
    }

    return CopyToOffset( szStringW,
                         cchStringW,
                         0 );
}

BOOL ISAPI_STRINGW::CopyA | ( | CHAR * | szString,
 |  | DWORD | cchString = 0
 | ) |  |

Definition at line 100 of file IsapiStringW.cpp.

       :

    Copies an ANSI string to the ISAPI_STRINGW object

Arguments:

    szString  - The ANSI string to copy
    cchString - The number of characters to copy

Returns:

    TRUE on success, FALSE on failure

--*/
{
    //
    // If necessary, calculate the length
    // of the new data
    //

    if ( cchString == 0 )
    {
        cchString = strlen( szString );
    }

    return CopyAToOffset( szString,
                          cchString,
                          0 );
}

BOOL ISAPI_STRINGW::CopyAToOffset | ( | CHAR * | szString,
 |  | DWORD | cchString,
 |  | DWORD | cchOffset |
 | ) |  |  | [private]

Definition at line 622 of file IsapiStringW.cpp.

       :

    Copies an ANSI string into the ISAPI_STRINGW's data, starting at the
    specified offset, in characters.

Arguments:

    szString  - The ANSI string to copy
    cchString - The number of characters to copy
    cchOffset - The offset, in chracters, at which to copy

Returns:

    TRUE on success, FALSE on failure

--*/
{
    WCHAR * pCursor;
    DWORD   cbString;
    DWORD   cchCopied;
    DWORD   cchData;
    DWORD   cbData;

    cchData = QueryCCH();
    cbData = QueryCB();

    //
    // Ensure that we have enough storage available
    //

    cbString = ( cchString + 1 ) * sizeof(WCHAR);

    if ( ResizeBuffer( cbString + cchOffset * sizeof(WCHAR) ) == FALSE )
    {
        goto Failed;
    }

    //
    // Set the point into which the copy will occur
    //

    pCursor = QueryStr() + cchData;

    //
    // Convert the ANSI string into Unicode using
    // the default system code page.
    //

    cchCopied = MultiByteToWideChar( CP_ACP,
                                     MB_PRECOMPOSED,
                                     szString,
                                     cchString,
                                     pCursor,
                                     cbData );

    if ( cchCopied == 0 )
    {
        goto Failed;
    }

    SetLen( cchData + cchCopied );

    return TRUE;

Failed:

    //
    // No special cleanup to be done
    //

    return FALSE;
}

BOOL ISAPI_STRINGW::CopyToOffset | ( | WCHAR * | szStringW,
 |  | DWORD | cchStringW,
 |  | DWORD | cchOffset |
 | ) |  |  | [private]

Definition at line 573 of file IsapiStringW.cpp.

       :

    Copies a Unicode string into the ISAPI_STRINGW's data, starting at the
    specified offset, in characters.

Arguments:

    szStringW  - The Unicode string to copy
    cchStringW - The number of characters to copy
    cchOffset  - The offset, in chracters, at which to copy

Returns:

    TRUE on success, FALSE on failure

--*/
{
    DWORD   cbData;

    //
    // Ensure that we have enough storage available
    //

    cbData = ( cchStringW + 1 ) * sizeof(WCHAR);

    if ( ResizeBuffer( cbData + cchOffset * sizeof(WCHAR) ) == FALSE )
    {
        return FALSE;
    }

    //
    // Copy the data and ensure proper termination
    //

    CopyMemory( QueryStr() + cchOffset, szStringW, cbData );

    SetLen( QueryCCH() + cchStringW );

    return TRUE;
}

BOOL ISAPI_STRINGW::Printf | ( | WCHAR * | szStringW,
 |  |  | ...
 | ) |  |

Definition at line 211 of file IsapiStringW.cpp.

       :

    Sets the specified printf-style formatted Unicode string
    into the ISAPI_STRINGW object using a variable number
    of arguments.

Arguments:

    szString - The Unicode string format
    ...      - Zero or more additional arguments

Returns:

    TRUE on success, FALSE on failure

--*/
{
    BOOL    fResult;

    //
    // Let ISAPI_BUFFER::Vsprintf do the work
    //

    va_list args;

    va_start( args, szStringW );

    fResult = Vsprintf( szStringW,
                        args );

    va_end( args );

    return fResult;
}

DWORD ISAPI_STRINGW::QueryBufferSize ( VOID )

Definition at line 457 of file IsapiStringW.cpp.

       :

    Returns the size, in bytes, of the ISAPI_STRINGW buffer

Arguments:

    None

Returns:

    The buffer size, in bytes

--*/
{
    return _Buffer.QueryBufferSize();
}

DWORD ISAPI_STRINGW::QueryCB ( VOID )

Definition at line 368 of file IsapiStringW.cpp.

       :

    Returns the size, in bytes, of the ISAPI_STRINGW data (not
    including the NULL terminator).

Arguments:

    None

Returns:

    The size in bytes

--*/
{
    DWORD   cbBuffer = _Buffer.QueryDataSize();

    return cbBuffer == 0 ? 0 : ( cbBuffer - 1 );
}

DWORD ISAPI_STRINGW::QueryCCH ( VOID )

Definition at line 394 of file IsapiStringW.cpp.

       :

    Returns the size, in characters, of the ISAPI_STRINGW data (not
    including the NULL terminator).

Arguments:

    None

Returns:

    The size in characters

--*/
{
    return QueryCB() / sizeof(WCHAR);
}

DWORD ISAPI_STRINGW::QueryMaxAlloc ( VOID )

Definition at line 504 of file IsapiStringW.cpp.

       :

    Returns the max allocation size for the ISAPI_STRINGW's buffer

Arguments:

    None

Returns:

    The max allocation size

--*/
{
    return _Buffer.QueryMaxAlloc();
}

WCHAR * ISAPI_STRINGW::QueryStr ( VOID )

Definition at line 550 of file IsapiStringW.cpp.

       :

    Returns the data pointer for the ISAPI_STRINGW

Arguments:

    None

Returns:

    The data pointer

--*/
{
    return (WCHAR*)_Buffer.QueryPtr();
}

BOOL ISAPI_STRINGW::ResizeBuffer ( DWORD cbSize )

Definition at line 480 of file IsapiStringW.cpp.

       :

    Guarantees that the data storage buffer of the ISAPI_STRINGW
    object is at least the number of specified bytes.

Arguments:

    cbSize - The target size

Returns:

    TRUE on success, FALSE on failure

--*/
{
    return _Buffer.Resize( cbSize );
}

BOOL ISAPI_STRINGW::SetLen ( DWORD cchNewLength )

Definition at line 418 of file IsapiStringW.cpp.

       :

    Sets the length of the data, in characters, in the ISAPI_STRINGW
    object, truncating the current data if necessary.

Arguments:

    cchNewLength - The new data length in characters.

Returns:

    TRUE on success, FALSE on failure.

--*/
{
    WCHAR * pCursor;
    DWORD   cbNewLength = cchNewLength * sizeof(WCHAR);
    BOOL    fResult;

    fResult = _Buffer.SetDataSize( cbNewLength + sizeof(WCHAR) );

    if ( !fResult )
    {
        return FALSE;
    }

    pCursor = (WCHAR*)_Buffer.QueryPtr() + cchNewLength;

    *pCursor = L'\0';

    return TRUE;
}

VOID ISAPI_STRINGW::SetMaxAlloc ( DWORD dwMaxAlloc )

Definition at line 527 of file IsapiStringW.cpp.

       :

    Sets the max allocation size for the ISAPI_STRINGW's buffer

Arguments:

    The max allocation size

Returns:

    None

--*/
{
    _Buffer.SetMaxAlloc( dwMaxAlloc );
}

BOOL ISAPI_STRINGW::Vsprintf | ( | WCHAR * | szFormatW,
 |  | va_list | args
 | ) |  |

Definition at line 253 of file IsapiStringW.cpp.

       :

    Sets the specified printf-style formatted Unicode string
    into the ISAPI_STRINGW object using a va_list of args.

Arguments:

    szFormat - The Unicode string format
    ...      - Zero or more additional arguments

Returns:

    TRUE on success, FALSE on failure

--*/
{
    INT     cchWritten;
    DWORD   cbBuffer;
    BOOL    fResult;

    //
    // Build the formatted string
    //

    do
    {
        cbBuffer = QueryBufferSize();

        cchWritten = (DWORD)_vsnwprintf( QueryStr(),
                                         cbBuffer,
                                         szFormatW,
                                         args );

        if ( cchWritten < 0 )
        {
            //
            // If we just failed, and the buffer
            // is already at its maximum size,
            // then fail.
            //

            if ( cbBuffer >= QueryMaxAlloc() )
            {
                goto Failed;
            }

            //
            // Grow the buffer and try again
            //

            cbBuffer *= 2;

            //
            // Don't exceed the max buffer size
            //

            if ( cbBuffer > QueryMaxAlloc() )
            {
                cbBuffer = QueryMaxAlloc();
            }

            fResult = ResizeBuffer( cbBuffer );

            if ( !fResult )
            {
                goto Failed;
            }
        }

    } while ( cchWritten < 0 );

    SetLen( cchWritten );

    return TRUE;

Failed:

    //
    // No special cleanup needed
    //

    return FALSE;
}

Member Data Documentation

ISAPI_BUFFER ISAPI_STRINGW::_Buffer [private]

Definition at line 117 of file IsapiStringW.h.

The documentation for this class was generated from the following files:
  • Web/iis/ISAPI_6.0/inc/IsapiStringW.h
  • Web/iis/ISAPI_6.0/src/IsapiStringW.cpp
Generated on Wed Nov 13 2024 16:57:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ISAPITHREAD Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Private Attributes

ISAPITHREAD Class Reference

#include "IsapiThread.h"

List of all members.

Public Member Functions

ISAPITHREAD (void)
~ISAPITHREAD (void)
void | ClearQueue (void)
EXTENSION_CONTROL_BLOCK * | GetWorkItem (void)
BOOL | InitThreadPool (LPTHREAD_START_ROUTINE pThreadProc, DWORD dwNumThreads=5, DWORD dwQueueSize=0xffffffff)
BOOL | QueueWorkItem (EXTENSION_CONTROL_BLOCK *pecb, BOOL fReleaseThread=TRUE)
void | ReleaseThread (DWORD dwNumThreads=1)

Public Attributes

HANDLE m_hWorkerThreadSemaphore

Private Attributes

HANDLE * m_arrWorkerThreads
CRITICAL_SECTION | m_csQueue
DWORD m_dwCurrentItem
DWORD m_dwItemsInQueue
DWORD m_dwNumThreads
DWORD m_dwWorkItemQueueSize
EXTENSION_CONTROL_BLOCK ** | m_WorkItemQueue

Detailed Description

Definition at line 17 of file IsapiThread.h.

Constructor & Destructor Documentation

ISAPITHREAD::ISAPITHREAD ( void )

Definition at line 266 of file IsapiThread.cpp.

{
}

ISAPITHREAD::~ISAPITHREAD ( void )

Definition at line 282 of file IsapiThread.cpp.

{
  // Clear the work item queue

  ClearQueue();

  // Release the worker threads.  The threads should exit
  // gracefully when they retrieve a NULL item from the queue.

  ReleaseThread(m_dwNumThreads);

  // Wait for the worker threads to exit.

  #ifdef _DEBUG
    OutputDebugString("Waiting for worker threads to exit...\r\n");
  #endif

  WaitForMultipleObjects(
    m_dwNumThreads,       // number of objects
    m_arrWorkerThreads,   // array of handles
    TRUE,                 // wait all flag
    INFINITE              // timeout
    );

  #ifdef _DEBUG
    OutputDebugString("All worker threads exited gracefully.\r\n");
  #endif

  // Close the handles

  for (DWORD x = 0; x < m_dwNumThreads; x++)
    CloseHandle(m_arrWorkerThreads[x]);

  CloseHandle(m_hWorkerThreadSemaphore);

  // Delete the critical section

  DeleteCriticalSection(&m_csQueue);

  // Deallocate the arrays

  delete m_arrWorkerThreads;
  delete m_WorkItemQueue;

  return;
}

Member Function Documentation

void ISAPITHREAD::ClearQueue ( void )

Definition at line 235 of file IsapiThread.cpp.

{
  EnterCriticalSection(&m_csQueue);

  // Clear the work items in the queue

  for (DWORD x = 0; x < m_dwWorkItemQueueSize; x++)
    m_WorkItemQueue[x] = NULL;

  // Reset the index counters

  m_dwCurrentItem = 0;
  m_dwItemsInQueue = 0;

  LeaveCriticalSection(&m_csQueue);

  return;
}

EXTENSION_CONTROL_BLOCK * ISAPITHREAD::GetWorkItem ( void )

Definition at line 171 of file IsapiThread.cpp.

{
  EnterCriticalSection(&m_csQueue);

  // Check to see if the queue is empty

  if (!m_dwItemsInQueue)
    goto Failed;

  // Get the next item from the queue

  EXTENSION_CONTROL_BLOCK *pRet = m_WorkItemQueue[m_dwCurrentItem];

  m_dwCurrentItem++;

  if (m_dwCurrentItem == m_dwWorkItemQueueSize)
    m_dwCurrentItem = 0;

  m_dwItemsInQueue--;

  // Done

  LeaveCriticalSection(&m_csQueue);

  return pRet;

Failed:

  LeaveCriticalSection(&m_csQueue);

  return NULL;
}

BOOL ISAPITHREAD::InitThreadPool | ( | LPTHREAD_START_ROUTINE | pThreadProc,
 |  | DWORD | dwNumThreads = 5,
 |  | DWORD | dwQueueSize = 0xffffffff
 | ) |  |

Definition at line 28 of file IsapiThread.cpp.

{
  DWORD dwThreadId;

  // Initialize the member variables

  m_WorkItemQueue = NULL;
  m_dwCurrentItem = 0;
  m_dwItemsInQueue = 0;
  m_arrWorkerThreads = NULL;
  m_dwNumThreads = 0;

  // Queue size defaults to twice the number of worker threads

  m_dwWorkItemQueueSize = (dwQueueSize == 0xffffffff) ? dwNumThreads * 2 : dwQueueSize;

  // Allocate the array to store the worker thread handles

  m_arrWorkerThreads = new HANDLE[dwNumThreads];

  if (!m_arrWorkerThreads)
    goto Failed;

  // Allocate the work item queue

  m_WorkItemQueue = new EXTENSION_CONTROL_BLOCK *[m_dwWorkItemQueueSize];

  if (!m_WorkItemQueue)
    goto Failed;

  // Initialize the queue critical section

  InitializeCriticalSection(&m_csQueue);

  // Start the worker threads

  for (DWORD x = 0; x < dwNumThreads; x++)
  {
    m_arrWorkerThreads[x] = CreateThread(
      NULL,                 // security attributes
      0,                    // stack size
      pThreadProc,          // thread routine
      this,                 // parameter
      0,                    // flags
      &dwThreadId           // thread id
      );

    if (m_arrWorkerThreads[x])
      m_dwNumThreads++;
    else
      break;
  }

  if (m_dwNumThreads != dwNumThreads)
    goto Failed;

  // Create the worker thread semaphore

  m_hWorkerThreadSemaphore = CreateSemaphore(
    NULL,       // security attributes
    0,          // initial count - nonsignaled
    0x7fffffff, // max count
    NULL        // name
    );

  if (!m_hWorkerThreadSemaphore)
    goto Failed;

  // Done

  return TRUE;

Failed:

  // The destructor will deallocate buffers, so we don't need to here

  return FALSE;
}

BOOL ISAPITHREAD::QueueWorkItem | ( | EXTENSION_CONTROL_BLOCK * | pecb,
 |  | BOOL | fReleaseThread = TRUE
 | ) |  |

Definition at line 120 of file IsapiThread.cpp.

{
  EnterCriticalSection(&m_csQueue);

  // Check to see if the queue is full

  if (m_dwItemsInQueue == m_dwWorkItemQueueSize)
    goto Failed;

  // Add the work item to the queue

  DWORD dwInsertionPoint = m_dwCurrentItem + m_dwItemsInQueue;

  if (dwInsertionPoint > m_dwWorkItemQueueSize - 1)
    dwInsertionPoint -= m_dwWorkItemQueueSize;

  m_WorkItemQueue[dwInsertionPoint] = pecb;

  m_dwItemsInQueue++;

  // Done

  LeaveCriticalSection(&m_csQueue);

  // If requested, release a worker thread

  if (fReleaseThread)
      ReleaseThread();

  return TRUE;

Failed:

  LeaveCriticalSection(&m_csQueue);

  return FALSE;
}

void ISAPITHREAD::ReleaseThread ( DWORD dwNumThreads = 1 )

Definition at line 216 of file IsapiThread.cpp.

{
  ReleaseSemaphore(m_hWorkerThreadSemaphore, dwNumThreads, NULL);

  return;
}

Member Data Documentation

HANDLE* ISAPITHREAD::m_arrWorkerThreads [private]

Definition at line 57 of file IsapiThread.h.

CRITICAL_SECTION ISAPITHREAD::m_csQueue [private]

Definition at line 52 of file IsapiThread.h.

DWORD ISAPITHREAD::m_dwCurrentItem [private]

Definition at line 55 of file IsapiThread.h.

DWORD ISAPITHREAD::m_dwItemsInQueue [private]

Definition at line 56 of file IsapiThread.h.

DWORD ISAPITHREAD::m_dwNumThreads [private]

Definition at line 53 of file IsapiThread.h.

DWORD ISAPITHREAD::m_dwWorkItemQueueSize [private]

Definition at line 54 of file IsapiThread.h.

HANDLE ISAPITHREAD::m_hWorkerThreadSemaphore

Definition at line 23 of file IsapiThread.h.

EXTENSION_CONTROL_BLOCK** ISAPITHREAD::m_WorkItemQueue [private]

Definition at line 51 of file IsapiThread.h.

The documentation for this class was generated from the following files:
  • Web/iis/extensions/InvokObjThreads/IsapiThread.h
  • Web/iis/extensions/InvokObjThreads/IsapiThread.cpp
Generated on Wed Nov 13 2024 16:57:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ISnap Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

ISnap Interface Reference

import "EdCommands.idl";

List of all members.

Public Member Functions

HRESULT | GetSnapOn (LONG *lIsOn)
HRESULT | GetSnapOn (LONG *lIsOn)
HRESULT | SetSnapOn (LONG lIsOn)
HRESULT | SetSnapOn (LONG lIsOn)
HRESULT | SnapIncrement ([out, retval] long *pVal)
HRESULT | SnapIncrement ([in] long newVal)
HRESULT | SnapOn ([out, retval] BOOL *pVal)
HRESULT | SnapOn ([in] BOOL newVal)

Detailed Description

Definition at line 35 of file EdCommands.idl.

Member Function Documentation

HRESULT ISnap::GetSnapOn ( LONG * lIsOn )
HRESULT ISnap::GetSnapOn ( LONG * lIsOn )
HRESULT ISnap::SetSnapOn ( LONG lIsOn )
HRESULT ISnap::SetSnapOn ( LONG lIsOn )
HRESULT ISnap::SnapIncrement ( [out, retval] long * pVal ) [get]
HRESULT ISnap::SnapIncrement ( [in] long newVal ) [set]
HRESULT ISnap::SnapOn ( [out, retval] BOOL * pVal ) [get]
HRESULT ISnap::SnapOn ( [in] BOOL newVal ) [set]
The documentation for this interface was generated from the following files:
  • Web/Browser/EditFeatures/EdCommands.idl
  • Web/Browser/EditGlyphs/EdGlyphs.idl
  • Web/Browser/EditHost/EdHost.idl
Generated on Wed Nov 13 2024 16:57:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IStorageProperties Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

IStorageProperties Interface Reference

import "MyStorageResource.idl";

Inherits com::ms::com::IUnknown.

Inherited by CStorageResource.

List of all members.

Public Member Functions

HRESULT | CanBeManaged (void)
HRESULT | HrGetDeviceID (BSTR *pbstrDeviceIDOut)
HRESULT | HrGetDeviceIndex (DWORD *pidxDeviceOut)
HRESULT | HrGetDiskNames (BSTR *pbstrDiskNameOut, BSTR *pbstrDeviceNameOut)
HRESULT | HrGetSCSIBus (ULONG *pulSCSIBusOut)
HRESULT | HrGetSCSIPort (ULONG *pulSCSIPortOut)
HRESULT | HrGetSignature (DWORD *pdwSignatureOut)
HRESULT | HrIsDynamicDisk (void)
HRESULT | HrIsGPTDisk (void)
HRESULT | HrSetFriendlyName (LPCWSTR pcszFriendlyNameIn)
HRESULT | IsThisLogicalDisk (WCHAR cLogicalDiskIn)

Detailed Description

Definition at line 82 of file MyStorageResource.idl.

Member Function Documentation

HRESULT IStorageProperties::CanBeManaged ( void )
HRESULT IStorageProperties::HrGetDeviceID ( BSTR * pbstrDeviceIDOut )
HRESULT IStorageProperties::HrGetDeviceIndex ( DWORD * pidxDeviceOut )
HRESULT IStorageProperties::HrGetDiskNames | ( | BSTR * | pbstrDiskNameOut,
 |  | BSTR * | pbstrDeviceNameOut
 | ) |  |
HRESULT IStorageProperties::HrGetSCSIBus ( ULONG * pulSCSIBusOut )
HRESULT IStorageProperties::HrGetSCSIPort ( ULONG * pulSCSIPortOut )
HRESULT IStorageProperties::HrGetSignature ( DWORD * pdwSignatureOut )
HRESULT IStorageProperties::HrIsDynamicDisk ( void )
HRESULT IStorageProperties::HrIsGPTDisk ( void )
HRESULT IStorageProperties::HrSetFriendlyName ( LPCWSTR pcszFriendlyNameIn )
HRESULT IStorageProperties::IsThisLogicalDisk ( WCHAR cLogicalDiskIn )
The documentation for this interface was generated from the following file:
  • WinBase/Cluster/Win2003/MyStorageResource/MyStorageResource.idl
Generated on Wed Nov 13 2024 16:57:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ISynchronize Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

ISynchronize Class Reference

Inherited by CAsyncXXX< CServer, ITest, CAsyncTest >, and CCallBack.

The documentation for this class was generated from the following file:
  • Com/async/server/CAsyncXXX.h
Generated on Wed Nov 13 2024 16:57:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: item_tag Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

item_tag Struct Reference

List of all members.

Public Attributes

BOOL bAnchor
BOOL bOK
char * | Data [1]
int | iLen
PBLOCK pBlock
struct item_tag * | pitNext
struct item_tag * | pitPrev

Detailed Description

Definition at line 117 of file list.cpp.

Member Data Documentation

BOOL item_tag::bAnchor

Definition at line 121 of file list.cpp.

BOOL item_tag::bOK

Definition at line 122 of file list.cpp.

char* item_tag::Data[1]

Definition at line 124 of file list.cpp.

int item_tag::iLen

Definition at line 123 of file list.cpp.

PBLOCK item_tag::pBlock

Definition at line 120 of file list.cpp.

struct item_tag* item_tag::pitNext

Definition at line 118 of file list.cpp.

struct item_tag* item_tag::pitPrev

Definition at line 119 of file list.cpp.

The documentation for this struct was generated from the following file:
  • Begin/sdkdiff/list.cpp
Generated on Wed Nov 13 2024 16:57:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ITEMINFO Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

ITEMINFO Struct Reference

#include "enumdesk.h"

List of all members.

Public Attributes

LPITEMIDLIST | pidlFQ
LPITEMIDLIST | pidlRel
LPSHELLFOLDER | pParentFolder

Detailed Description

Definition at line 24 of file enumdesk.h.

Member Data Documentation

LPITEMIDLIST ITEMINFO::pidlFQ

Definition at line 27 of file enumdesk.h.

LPITEMIDLIST ITEMINFO::pidlRel

Definition at line 28 of file enumdesk.h.

LPSHELLFOLDER ITEMINFO::pParentFolder

Definition at line 26 of file enumdesk.h.

The documentation for this struct was generated from the following file:
  • WinUI/Shell/EnumDesk/enumdesk.h
Generated on Wed Nov 13 2024 16:57:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: itemlist Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

itemlist Struct Reference

List of all members.

Public Attributes

BOOL isselected
int | nitems
int | selitem
PSTATEL statels

Detailed Description

Definition at line 42 of file status.cpp.

Member Data Documentation

BOOL itemlist::isselected

Definition at line 47 of file status.cpp.

int itemlist::nitems

Definition at line 43 of file status.cpp.

int itemlist::selitem

Definition at line 46 of file status.cpp.

PSTATEL itemlist::statels

Definition at line 44 of file status.cpp.

The documentation for this struct was generated from the following file:
  • Begin/sdkdiff/status.cpp
Generated on Wed Nov 13 2024 16:57:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ITest Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions

ITest Interface Reference

import "Proxy.idl";

Inherits com::ms::com::IUnknown.

Inherited by CServer.

List of all members.

Public Types

typedef ITest * | LPTEST

Public Member Functions

HRESULT | Test1 ([in, out] BSTR lpbstr)
HRESULT | Test2 ([in] BSTR bstrIn,[out] BSTR *lpbstrOut)

Detailed Description

Definition at line 25 of file Proxy.idl.

Member Typedef Documentation

typedef ITest* ITest::LPTEST

Definition at line 27 of file Proxy.idl.

Member Function Documentation

HRESULT ITest::Test1 ( [in, out] BSTR lpbstr )

Implemented in CServer.

HRESULT ITest::Test2 | ( | [in] BSTR | bstrIn,
 |  | [out] BSTR * | lpbstrOut
 | ) |  |

Implemented in CServer.

The documentation for this interface was generated from the following file:
  • Com/async/proxy/Proxy.idl
Generated on Wed Nov 13 2024 16:57:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IUPnPService_DimmingService_SCPD Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

IUPnPService_DimmingService_SCPD Interface Reference

import "DimmingService_SCPD.idl";

List of all members.

Public Member Functions

HRESULT | dimLevel ([out, retval] long *pdimLevel)
HRESULT | GetConfigDetails ([in, out] VARIANT_BOOL *ppowerVal,[in, out] long *pdLevel)
HRESULT | GetDimLevel ([in, out] long *pdLevel)
HRESULT | GetPowerValue ([in, out] VARIANT_BOOL *ppowerVall)
HRESULT | Power ([out, retval] VARIANT_BOOL *pPower)
HRESULT | PowerOff ()
HRESULT | PowerOn ()
HRESULT | SetDimLevel ([in] long dLevel)

Detailed Description

Definition at line 19 of file DimmingService_SCPD.idl.

Member Function Documentation

HRESULT IUPnPService_DimmingService_SCPD::dimLevel ( [out, retval] long * pdimLevel ) [get]
HRESULT IUPnPService_DimmingService_SCPD::GetConfigDetails | ( | [in, out] VARIANT_BOOL * | ppowerVal,
 |  | [in, out] long * | pdLevel
 | ) |  |
HRESULT IUPnPService_DimmingService_SCPD::GetDimLevel ( [in, out] long * pdLevel )
HRESULT IUPnPService_DimmingService_SCPD::GetPowerValue ( [in, out] VARIANT_BOOL * ppowerVall )
HRESULT IUPnPService_DimmingService_SCPD::Power ( [out, retval] VARIANT_BOOL * pPower ) [get]
HRESULT IUPnPService_DimmingService_SCPD::PowerOff ( )
HRESULT IUPnPService_DimmingService_SCPD::PowerOn ( )
HRESULT IUPnPService_DimmingService_SCPD::SetDimLevel ( [in] long dLevel )
The documentation for this interface was generated from the following file:
  • NetDS/upnp/StepByStep/Step1/DimmingService_SCPD.idl
Generated on Wed Nov 13 2024 16:57:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IUPnPService_DimmingService_SCPDVtbl Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

IUPnPService_DimmingService_SCPDVtbl Struct Reference

#include "MyDevice.h"

List of all members.

Public Member Functions

BEGIN_INTERFACE | HRESULT (STDMETHODCALLTYPE __RPC_FAR *QueryInterface)(IUPnPService_DimmingService_SCPD __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetConfigDetails)(IUPnPService_DimmingService_SCPD __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetDimLevel)(IUPnPService_DimmingService_SCPD __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *SetDimLevel)(IUPnPService_DimmingService_SCPD __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetPowerValue)(IUPnPService_DimmingService_SCPD __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *PowerOff)(IUPnPService_DimmingService_SCPD __RPC_FAR *This)
HRESULT (STDMETHODCALLTYPE __RPC_FAR *PowerOn)(IUPnPService_DimmingService_SCPD __RPC_FAR *This)
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount)(IUPnPService_DimmingService_SCPD __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Power)(IUPnPService_DimmingService_SCPD __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Invoke)(IUPnPService_DimmingService_SCPD __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames)(IUPnPService_DimmingService_SCPD __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo)(IUPnPService_DimmingService_SCPD __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount)(IUPnPService_DimmingService_SCPD __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Power)(IUPnPService_DimmingService_SCPD __RPC_FAR *This
BEGIN_INTERFACE | HRESULT (STDMETHODCALLTYPE __RPC_FAR *QueryInterface)(IUPnPService_DimmingService_SCPD __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_dimLevel)(IUPnPService_DimmingService_SCPD __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetConfigDetails)(IUPnPService_DimmingService_SCPD __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetDimLevel)(IUPnPService_DimmingService_SCPD __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *SetDimLevel)(IUPnPService_DimmingService_SCPD __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_dimLevel)(IUPnPService_DimmingService_SCPD __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *PowerOff)(IUPnPService_DimmingService_SCPD __RPC_FAR *This)
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo)(IUPnPService_DimmingService_SCPD __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *PowerOn)(IUPnPService_DimmingService_SCPD __RPC_FAR *This)
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames)(IUPnPService_DimmingService_SCPD __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Invoke)(IUPnPService_DimmingService_SCPD __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetPowerValue)(IUPnPService_DimmingService_SCPD __RPC_FAR *This
ULONG (STDMETHODCALLTYPE __RPC_FAR *AddRef)(IUPnPService_DimmingService_SCPD __RPC_FAR *This)
ULONG (STDMETHODCALLTYPE __RPC_FAR *AddRef)(IUPnPService_DimmingService_SCPD __RPC_FAR *This)
ULONG (STDMETHODCALLTYPE __RPC_FAR *Release)(IUPnPService_DimmingService_SCPD __RPC_FAR *This)
ULONG (STDMETHODCALLTYPE __RPC_FAR *Release)(IUPnPService_DimmingService_SCPD __RPC_FAR *This)

Public Attributes

REFIID LPOLESTR __RPC_FAR UINT | cNames
DISPID | dispIdMember
long | dLevel
UINT iTInfo
UINT LCID | lcid
REFIID LPOLESTR __RPC_FAR UINT LCID | lcid
DISPID REFIID LCID | lcid
UINT __RPC_FAR * | pctinfo
long __RPC_FAR * | pdimLevel
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR * 		pDispParams
long __RPC_FAR * | pdLevel
VARIANT_BOOL __RPC_FAR long
__RPC_FAR * 		pdLevel
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR EXCEPINFO __RPC_FAR * 		pExcepInfo
VARIANT_BOOL __RPC_FAR * | pPower
VARIANT_BOOL __RPC_FAR * | ppowerVal
VARIANT_BOOL __RPC_FAR * | ppowerVall
UINT LCID ITypeInfo __RPC_FAR
*__RPC_FAR * 		ppTInfo
BEGIN_INTERFACE REFIID void
__RPC_FAR *__RPC_FAR * 		ppvObject
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR EXCEPINFO __RPC_FAR
UINT __RPC_FAR * 		puArgErr
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR * 		pVarResult
REFIID LPOLESTR __RPC_FAR UINT
LCID DISPID __RPC_FAR * 		rgDispId
REFIID LPOLESTR __RPC_FAR * | rgszNames
REFIID | riid
BEGIN_INTERFACE REFIID | riid
DISPID REFIID | riid
DISPID REFIID LCID WORD | wFlags

Detailed Description

Definition at line 120 of file MyDevice.h.

Member Function Documentation

BEGIN_INTERFACE IUPnPService_DimmingService_SCPDVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * QueryInterface )
IUPnPService_DimmingService_SCPDVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetConfigDetails )
IUPnPService_DimmingService_SCPDVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetDimLevel )
IUPnPService_DimmingService_SCPDVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * SetDimLevel )
IUPnPService_DimmingService_SCPDVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetPowerValue )
IUPnPService_DimmingService_SCPDVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * PowerOff )
IUPnPService_DimmingService_SCPDVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * PowerOn )
IUPnPService_DimmingService_SCPDVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetTypeInfoCount )
IUPnPService_DimmingService_SCPDVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Power )
IUPnPService_DimmingService_SCPDVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Invoke )
IUPnPService_DimmingService_SCPDVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetIDsOfNames )
IUPnPService_DimmingService_SCPDVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetTypeInfo )
IUPnPService_DimmingService_SCPDVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetTypeInfoCount )
IUPnPService_DimmingService_SCPDVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Power )
BEGIN_INTERFACE IUPnPService_DimmingService_SCPDVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * QueryInterface )
IUPnPService_DimmingService_SCPDVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_dimLevel )
IUPnPService_DimmingService_SCPDVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetConfigDetails )
IUPnPService_DimmingService_SCPDVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetDimLevel )
IUPnPService_DimmingService_SCPDVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * SetDimLevel )
IUPnPService_DimmingService_SCPDVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_dimLevel )
IUPnPService_DimmingService_SCPDVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * PowerOff )
IUPnPService_DimmingService_SCPDVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetTypeInfo )
IUPnPService_DimmingService_SCPDVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * PowerOn )
IUPnPService_DimmingService_SCPDVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetIDsOfNames )
IUPnPService_DimmingService_SCPDVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Invoke )
IUPnPService_DimmingService_SCPDVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetPowerValue )
IUPnPService_DimmingService_SCPDVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * AddRef )
IUPnPService_DimmingService_SCPDVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * AddRef )
IUPnPService_DimmingService_SCPDVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * Release )
IUPnPService_DimmingService_SCPDVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * Release )

Member Data Documentation

REFIID LPOLESTR __RPC_FAR UINT IUPnPService_DimmingService_SCPDVtbl::cNames

Definition at line 147 of file MyDevice.h.

DISPID IUPnPService_DimmingService_SCPDVtbl::dispIdMember

Definition at line 155 of file MyDevice.h.

long IUPnPService_DimmingService_SCPDVtbl::dLevel

Definition at line 184 of file MyDevice.h.

UINT IUPnPService_DimmingService_SCPDVtbl::iTInfo

Definition at line 141 of file MyDevice.h.

DISPID REFIID LCID IUPnPService_DimmingService_SCPDVtbl::lcid

Definition at line 141 of file MyDevice.h.

REFIID LPOLESTR __RPC_FAR UINT LCID IUPnPService_DimmingService_SCPDVtbl::lcid

Definition at line 147 of file MyDevice.h.

DISPID REFIID LCID IUPnPService_DimmingService_SCPDVtbl::lcid

Definition at line 155 of file MyDevice.h.

UINT __RPC_FAR * IUPnPService_DimmingService_SCPDVtbl::pctinfo

Definition at line 137 of file MyDevice.h.

long __RPC_FAR * IUPnPService_DimmingService_SCPDVtbl::pdimLevel

Definition at line 170 of file MyDevice.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR * IUPnPService_DimmingService_SCPDVtbl::pDispParams

Definition at line 155 of file MyDevice.h.

VARIANT_BOOL __RPC_FAR long __RPC_FAR * IUPnPService_DimmingService_SCPDVtbl::pdLevel

Definition at line 188 of file MyDevice.h.

VARIANT_BOOL __RPC_FAR long __RPC_FAR* IUPnPService_DimmingService_SCPDVtbl::pdLevel

Definition at line 192 of file MyDevice.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR EXCEPINFO __RPC_FAR * IUPnPService_DimmingService_SCPDVtbl::pExcepInfo

Definition at line 155 of file MyDevice.h.

VARIANT_BOOL __RPC_FAR * IUPnPService_DimmingService_SCPDVtbl::pPower

Definition at line 166 of file MyDevice.h.

VARIANT_BOOL __RPC_FAR * IUPnPService_DimmingService_SCPDVtbl::ppowerVal

Definition at line 192 of file MyDevice.h.

VARIANT_BOOL __RPC_FAR * IUPnPService_DimmingService_SCPDVtbl::ppowerVall

Definition at line 180 of file MyDevice.h.

UINT LCID ITypeInfo __RPC_FAR *__RPC_FAR * IUPnPService_DimmingService_SCPDVtbl::ppTInfo

Definition at line 141 of file MyDevice.h.

BEGIN_INTERFACE REFIID void __RPC_FAR *__RPC_FAR * IUPnPService_DimmingService_SCPDVtbl::ppvObject

Definition at line 126 of file MyDevice.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR EXCEPINFO __RPC_FAR UINT __RPC_FAR * IUPnPService_DimmingService_SCPDVtbl::puArgErr

Definition at line 155 of file MyDevice.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR * IUPnPService_DimmingService_SCPDVtbl::pVarResult

Definition at line 155 of file MyDevice.h.

REFIID LPOLESTR __RPC_FAR UINT LCID DISPID __RPC_FAR * IUPnPService_DimmingService_SCPDVtbl::rgDispId

Definition at line 147 of file MyDevice.h.

REFIID LPOLESTR __RPC_FAR * IUPnPService_DimmingService_SCPDVtbl::rgszNames

Definition at line 147 of file MyDevice.h.

REFIID IUPnPService_DimmingService_SCPDVtbl::riid

Definition at line 147 of file MyDevice.h.

DISPID REFIID IUPnPService_DimmingService_SCPDVtbl::riid

Definition at line 126 of file MyDevice.h.

DISPID REFIID IUPnPService_DimmingService_SCPDVtbl::riid

Definition at line 155 of file MyDevice.h.

DISPID REFIID LCID WORD IUPnPService_DimmingService_SCPDVtbl::wFlags

Definition at line 155 of file MyDevice.h.

The documentation for this struct was generated from the following files:
  • NetDS/upnp/StepByStep/Step3/MyDevice.h
  • NetDS/upnp/StepByStep/Step4/MyDevice.h
Generated on Wed Nov 13 2024 16:57:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IWMIObject Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

IWMIObject Interface Reference

import "MyStorageResource.idl";

Inherits com::ms::com::IUnknown.

Inherited by CPartitionInfo, and CStorageResource.

List of all members.

Public Member Functions

HRESULT SetWbemObject (IWbemClassObject *pObjectIn, BOOL *pfRetainObjectOut)

Detailed Description

Definition at line 56 of file MyStorageResource.idl.

Member Function Documentation

HRESULT IWMIObject::SetWbemObject | ( | IWbemClassObject * | pObjectIn,
 |  | BOOL * | pfRetainObjectOut
 | ) |  |
The documentation for this interface was generated from the following file:
  • WinBase/Cluster/Win2003/MyStorageResource/MyStorageResource.idl
Generated on Wed Nov 13 2024 16:57:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IWMIServices Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

IWMIServices Interface Reference

import "MyStorageResource.idl";

Inherits com::ms::com::IUnknown.

Inherited by CEnumStorageResource, CPartitionInfo, and CStorageResource.

List of all members.

Public Member Functions

HRESULT SetWbemServices (IWbemServices *pIWbemServicesIn)

Detailed Description

Definition at line 31 of file MyStorageResource.idl.

Member Function Documentation

HRESULT IWMIServices::SetWbemServices ( IWbemServices * pIWbemServicesIn )
The documentation for this interface was generated from the following file:
  • WinBase/Cluster/Win2003/MyStorageResource/MyStorageResource.idl
Generated on Wed Nov 13 2024 16:57:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IWMSCacheAdmin Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes | Properties

IWMSCacheAdmin Interface Reference

Inherited by CachePluginAdmin.

List of all members.

Public Attributes

int DiskQuota | get
set

Properties

int | ArchiveQuotaPerStream [get, set]
string | BackendServer [get, set]
string | CacheDirectoryPath [get, set]
bool | CacheOnDemandCacheMiss [get, set]
string | PreferredProtocol [get, set]
bool | ProxyOnDemandCacheMiss [get, set]
string | ProxyRedirectURL [get, set]

Detailed Description

Definition at line 28 of file PluginAdmin.cs.

Member Data Documentation

int DiskQuota IWMSCacheAdmin::get

Definition at line 30 of file PluginAdmin.cs.

IWMSCacheAdmin::set

Definition at line 30 of file PluginAdmin.cs.

Property Documentation

int IWMSCacheAdmin::ArchiveQuotaPerStream [get, set]

Implemented in CachePluginAdmin, and CachePluginAdmin.

Definition at line 35 of file PluginAdmin.cs.

string IWMSCacheAdmin::BackendServer [get, set]

Implemented in CachePluginAdmin, and CachePluginAdmin.

Definition at line 37 of file PluginAdmin.cs.

string IWMSCacheAdmin::CacheDirectoryPath [get, set]

Implemented in CachePluginAdmin, and CachePluginAdmin.

Definition at line 31 of file PluginAdmin.cs.

bool IWMSCacheAdmin::CacheOnDemandCacheMiss [get, set]

Implemented in CachePluginAdmin, and CachePluginAdmin.

Definition at line 34 of file PluginAdmin.cs.

string IWMSCacheAdmin::PreferredProtocol [get, set]

Implemented in CachePluginAdmin, and CachePluginAdmin.

Definition at line 33 of file PluginAdmin.cs.

bool IWMSCacheAdmin::ProxyOnDemandCacheMiss [get, set]

Implemented in CachePluginAdmin, and CachePluginAdmin.

Definition at line 32 of file PluginAdmin.cs.

string IWMSCacheAdmin::ProxyRedirectURL [get, set]

Implemented in CachePluginAdmin, and CachePluginAdmin.

Definition at line 36 of file PluginAdmin.cs.

The documentation for this interface was generated from the following file:
  • Multimedia/WindowsMediaServices9/CacheProxy/csharp/PluginAdmin.cs
Generated on Wed Nov 13 2024 16:57:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IWMSContextAdmin Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

IWMSContextAdmin Interface Reference

import "ContextDll.idl";

List of all members.

Public Member Functions

HRESULT | ContextTypes ([out, retval] WMS_CONTEXT_PLUGIN_CONTEXT_TYPE *retval)
HRESULT | ContextTypes ([in] WMS_CONTEXT_PLUGIN_CONTEXT_TYPE value)
HRESULT | OutputPath ([out, retval] BSTR *retval)
HRESULT | OutputPath ([in] BSTR value)

Detailed Description

Definition at line 71 of file ContextDll.idl.

Member Function Documentation

HRESULT IWMSContextAdmin::ContextTypes ( [out, retval] WMS_CONTEXT_PLUGIN_CONTEXT_TYPE * retval ) [get]
HRESULT IWMSContextAdmin::ContextTypes ( [in] WMS_CONTEXT_PLUGIN_CONTEXT_TYPE value ) [set]
HRESULT IWMSContextAdmin::OutputPath ( [out, retval] BSTR * retval ) [get]
HRESULT IWMSContextAdmin::OutputPath ( [in] BSTR value ) [set]
The documentation for this interface was generated from the following file:
  • Multimedia/WindowsMediaServices9/EventNotification/ContextDll.idl
Generated on Wed Nov 13 2024 16:57:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: IWMSContextPlugin Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

IWMSContextPlugin Interface Reference

import "ContextDll.idl";

Inherits com::ms::com::IUnknown.

Inherited by CContextPlugin.

Detailed Description

Definition at line 58 of file ContextDll.idl.

The documentation for this interface was generated from the following file:
  • Multimedia/WindowsMediaServices9/EventNotification/ContextDll.idl
Generated on Wed Nov 13 2024 16:57:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: KEY_HEADER Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

KEY_HEADER Struct Reference

List of all members.

Public Attributes

BLOBHEADER | blob
RSAPUBKEY | rsa

Detailed Description

Definition at line 5 of file CertGetKey.c.

Member Data Documentation

BLOBHEADER KEY_HEADER::blob

Definition at line 6 of file CertGetKey.c.

RSAPUBKEY KEY_HEADER::rsa

Definition at line 7 of file CertGetKey.c.

The documentation for this struct was generated from the following file:
  • Security/capicom/c_sharp/xmldsig/CertGetKey.c
Generated on Wed Nov 13 2024 16:57:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: LessThan< Item > Struct Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

LessThan< Item > Struct Template Reference

#include "InsertionSort.h"

List of all members.

Public Member Functions

bool operator() (const Item &rLeftIn, const Item &rRightIn) const

Detailed Description

template<class Item>
struct LessThan< Item >

Definition at line 153 of file InsertionSort.h.

Member Function Documentation

template<class Item >
bool LessThan< Item >::operator() | ( | const Item & | rLeftIn,
 |  | const Item & | rRightIn |
 | ) |  |  | const [inline]

Definition at line 155 of file InsertionSort.h.

    {
        return ( rLeftIn < rRightIn );
    }

The documentation for this struct was generated from the following file:
  • WinBase/Cluster/Win2003/MyStorageResource/InsertionSort.h
Generated on Wed Nov 13 2024 16:57:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: LineData Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

LineData Struct Reference

#include "tpriv.h"

List of all members.

Public Attributes

CellPos linepos
lpCellData pdata

Detailed Description

Definition at line 26 of file tpriv.h.

Member Data Documentation

CellPos LineData::linepos

Definition at line 27 of file tpriv.h.

lpCellData LineData::pdata

Definition at line 29 of file tpriv.h.

The documentation for this struct was generated from the following file:
  • Begin/sdkdiff/tpriv.h
Generated on Wed Nov 13 2024 16:57:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: LIST_STRUCT Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

LIST_STRUCT Struct Reference

#include "LinkList.h"

List of all members.

Public Attributes

int | ListError
int(* | OrderFunction )(PNODE, PNODE)
PNODE pCurrentNode
PNODE pFirstNode
PNODE pLastNode
PVOID pListData

Detailed Description

Definition at line 88 of file LinkList.h.

Member Data Documentation

int LIST_STRUCT::ListError

Definition at line 94 of file LinkList.h.

int(* LIST_STRUCT::OrderFunction)(PNODE, PNODE)

Definition at line 93 of file LinkList.h.

PNODE LIST_STRUCT::pCurrentNode

Definition at line 91 of file LinkList.h.

PNODE LIST_STRUCT::pFirstNode

Definition at line 90 of file LinkList.h.

PNODE LIST_STRUCT::pLastNode

Definition at line 92 of file LinkList.h.

PVOID LIST_STRUCT::pListData

Definition at line 89 of file LinkList.h.

The documentation for this struct was generated from the following file:
  • WinBase/Debug/Deb/LinkList.h
Generated on Wed Nov 13 2024 16:57:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: LOGON_DATA Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

LOGON_DATA Struct Reference

List of all members.

Public Attributes

WCHAR | szServer [MAX_STRING]
WCHAR | szTransport [MAX_STRING]
WCHAR | szUserURI [MAX_STRING]

Detailed Description

Definition at line 41 of file rtcdialogs.cpp.

Member Data Documentation

WCHAR LOGON_DATA::szServer[MAX_STRING]

Definition at line 44 of file rtcdialogs.cpp.

WCHAR LOGON_DATA::szTransport[MAX_STRING]

Definition at line 45 of file rtcdialogs.cpp.

WCHAR LOGON_DATA::szUserURI[MAX_STRING]

Definition at line 43 of file rtcdialogs.cpp.

The documentation for this struct was generated from the following file:
  • NetDS/rtc/Client/CPP/rtcsample/rtcdialogs.cpp
Generated on Wed Nov 13 2024 16:57:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: LOGPAL Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

LOGPAL Struct Reference

List of all members.

Public Attributes

WORD | cpe
PALETTEENTRY | rgpe [cpeAppPal]
WORD | wVersion

Detailed Description

Definition at line 20 of file stdpal.c.

Member Data Documentation

WORD LOGPAL::cpe

Definition at line 23 of file stdpal.c.

PALETTEENTRY LOGPAL::rgpe

Definition at line 24 of file stdpal.c.

WORD LOGPAL::wVersion

Definition at line 22 of file stdpal.c.

The documentation for this struct was generated from the following files:
  • Com/Fundamentals/OleStd/stdpal.c
  • Com/Fundamentals/SimpCntr/app.Cpp
Generated on Wed Nov 13 2024 16:57:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: MainDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | Friends

MainDlg Class Reference

#include "MainDlg.h"

List of all members.

Public Member Functions

MainDlg ()
HRESULT | Init ()
void | LoadCharacter (LPCTSTR pszFilename)

Public Attributes

HACCEL | m_hAccel
HWND | m_hWnd

Private Member Functions

void | MakeEllipsisPath (LPCTSTR pszPath, LPTSTR pszEllipsisPath, UINT cchMaxEllipsisPath)
void | OnActivateApp (BOOL bActive)
void | OnButtonClick (UINT uID)
void | OnCharacterCommand (long lID)
void | OnCharacterMove (long x, long y)
void | OnCharacterRightClick (long x, long y)
BOOL | OnCommand (WPARAM wParam, LPARAM lParam)
void | OnDestroy ()
void | OnDropFiles (HDROP hDrop)
BOOL OnInitDialog ()
BOOL | OnInitMenuPopup (HMENU hMenu, UINT uPos, BOOL bSysMenu)
void | OnPropertyChange ()
void | OnRecentFile (UINT uFile)
void | OnSpeak ()
BOOL | OnSysCommand (WPARAM wParam)
void | UpdateRecentFiles (LPCTSTR pszFilename)

Private Attributes

BOOL m_bAddedCommands
BOOL m_bHasMRUSeparator
long | m_lCharacterID
long | m_lCmdPropertiesID
long | m_lSinkID
IAgentEx * | m_pAgent
IAgentBalloonEx * | m_pBalloon
IAgentCharacterEx * | m_pCharacter
AgentNotifySink * m_pSink
WNDPROC | m_wpListBox
WNDPROC | m_wpMoveX
WNDPROC | m_wpMoveY
WNDPROC | m_wpSpeakText

Friends

class | AgentNotifySink
LRESULT CALLBACK | ListBoxWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT CALLBACK | MoveXWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT CALLBACK | MoveYWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT CALLBACK | SpeakTextWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT CALLBACK | WndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)

Detailed Description

Definition at line 10 of file MainDlg.h.

Constructor & Destructor Documentation

MainDlg::MainDlg ( )

Definition at line 79 of file MainDlg.Cpp.

                 {

  m_hWnd = NULL;
  m_hAccel = NULL;
  m_pAgent = NULL;
  m_pSink = NULL;
  m_pCharacter = NULL;
  m_pBalloon = NULL;
  m_lCharacterID = -1;
  m_lSinkID = -1;
  m_lCmdPropertiesID = -1;
  m_bHasMRUSeparator = FALSE;
  m_bAddedCommands = FALSE;
}

Member Function Documentation

HRESULT MainDlg::Init ( )

Definition at line 95 of file MainDlg.Cpp.

                      {

  // We should only call this once

  _ASSERT(m_pAgent == NULL);

  WNDCLASS wndClass;
  HRESULT hRes;

  // Initialize the Microsoft Agent server

  hRes = CoCreateInstance(CLSID_AgentServer,
              NULL,
              CLSCTX_SERVER,
              IID_IAgentEx,
              (LPVOID *)&m_pAgent);

  // Uh oh!!!

  if (FAILED(hRes))
    return hRes;

  // Create a notify sink object. NOTE: we want to
  // control it's lifetime so we AddRef it.

  m_pSink = new AgentNotifySink(this);

  if (m_pSink == NULL)
    return E_OUTOFMEMORY;

  m_pSink->AddRef();

  // And register it with Microsoft Agent

  hRes = m_pAgent->Register(m_pSink, &m_lSinkID);

  if (FAILED(hRes))
    return hRes;

  // Create/register a window class

  ZeroMemory(&wndClass, sizeof(WNDCLASS));

  wndClass.lpfnWndProc = WndProc;
  wndClass.cbWndExtra = DLGWINDOWEXTRA;
  wndClass.hInstance = g_hInst;
  wndClass.hIcon = LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_APP));
  wndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
  wndClass.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1);
  wndClass.lpszClassName = kpszWindowClass;

  RegisterClass(&wndClass);

  // Create the Main dialog window. NOTE: specifying a NULL
  // DlgProc tells the system to use the DlgProc specified
  // by the class assigned to the dialog in the dialog's
  // resource.

  m_hWnd = CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_CAP), NULL, NULL);

  if (m_hWnd == NULL)
    return HRESULT_FROM_WIN32(GetLastError());

  // Stuff the C++ class into window long data

  SetWindowLongPtr(m_hWnd, GWLP_USERDATA, (LONG_PTR)this);

  // Initialize the dialog

  OnInitDialog();

  return NOERROR;
}

void MainDlg::LoadCharacter ( LPCTSTR pszFilename )

Definition at line 265 of file MainDlg.Cpp.

                                               {

  _ASSERT(m_pAgent);

  HRESULT       hRes;
  OPENFILENAME    ofn;
  _TCHAR        szFilename[_MAX_PATH];
  _TCHAR        szTemp[256];
  _TCHAR         *pchFilename;
  VARIANT       vFilename;
  VARIANT       vAnimName;
  DWORD       dwRetrieved;
  BOOL        bHasAnims;
  BOOL        bUseSfx;
  UINT        uBalloonStyle;
  BSTR        bszName;
  long        lReqID;
  long        lCharID;
  long        lVisibilityCause;
  IAgentCharacterEx  *pCharacter;
  IUnknown       *punkAnimNames;
  IEnumVARIANT     *pevAnimNames;

  USES_CONVERSION;

  // If no filename was specified, bring up the common
  // open dialog to get one from the user.

  if (pszFilename == NULL) {

    ZeroMemory(&ofn, sizeof(OPENFILENAME));
    szFilename[0] = 0;

    ofn.lStructSize = sizeof(OPENFILENAME);
    ofn.hwndOwner = m_hWnd;
    ofn.lpstrDefExt = _T(".acs");
    ofn.Flags = OFN_HIDEREADONLY;
    ofn.lpstrFilter = kpszFileTypes;
    ofn.lpstrFile = szFilename;
    ofn.nMaxFile = _MAX_PATH;

    if (!GetOpenFileName(&ofn))
      return;

    pszFilename = szFilename;
  }

  SetCursor(LoadCursor(NULL, IDC_WAIT));

  // Construct a VARIANT to hold the filename

  VariantInit(&vFilename);
  vFilename.bstrVal = SysAllocString(T2W(pszFilename));
  vFilename.vt = VT_BSTR;

  // Load the new character. NOTE: we don't release the
  // existing character until we're sure we've successfully
  // loaded the new one.

  hRes = m_pAgent->Load(vFilename, &lCharID, &lReqID);

  // Clean up the VARIANT

  VariantClear(&vFilename);

  // Did we successfully load the character? NOTE: if it's the
  // same character as we already have loaded we'll get the
  // error code AGENTERR_CHARACTERALREADYLOADED.

  if (SUCCEEDED(hRes)) {

    // Get the IAgentCharacterEx interface

    hRes = m_pAgent->GetCharacterEx(lCharID, &pCharacter);
  }

  if (FAILED(hRes)) {
    SetCursor(LoadCursor(NULL, IDC_ARROW));
    return;
  }

  // Release the previous balloon interface

  if (m_pBalloon) {
    m_pBalloon->Release();
    m_pBalloon = NULL;
  }

  // Unload the previous character if we have one

  if (m_pCharacter) {
    m_pAgent->Unload(m_lCharacterID);
    m_pCharacter->Release();
  }

  // We'll need to reload our commands. We do this only
  // on a right click for better character load performance.

  m_bAddedCommands = FALSE;

  // Assign our member variables

  m_lCharacterID = lCharID;
  m_pCharacter = pCharacter;

  // Query for the balloon interface

  m_pCharacter->QueryInterface(IID_IAgentBalloonEx, (LPVOID *)&m_pBalloon);

  // Reset the contents of the animation list box

  SendDlgItemMessage(m_hWnd, IDC_ANIMATIONS, LB_RESETCONTENT, 0, 0);

  // Add it to the MRU menu

  UpdateRecentFiles(pszFilename);

  // Turn off the Auto-Popup menu. Then we'll add our commands
  // the first time the user right clicks the character.

  m_pCharacter->SetAutoPopupMenu(FALSE);

  // Get the last visibility cause of the character. If
  // it's never been shown we'll position it. Otherwise,
  // we'll leave it alone and assume it's where the user
  // or another app wants it.

  if (SUCCEEDED(m_pCharacter->GetVisibilityCause(&lVisibilityCause))) {

    if (lVisibilityCause == NeverShown) {

      RECT rcWindow;
      long lWidth;
      long lHeight;

      // Get the window rect

      GetWindowRect(m_hWnd, &rcWindow);

      // And the size of the character

      if (SUCCEEDED(m_pCharacter->GetSize(&lWidth, &lHeight))) {

        // Make sure we'll fit to the right (NOTE: a production
        // quality app would handle multi-monitor!!!)

        if ((rcWindow.right + lWidth) > GetSystemMetrics(SM_CXSCREEN))
          rcWindow.right = rcWindow.left - lWidth;
      }

      // Move it (non-animated)

      m_pCharacter->MoveTo((short)rcWindow.right, (short)rcWindow.top, 0, &lReqID);
    }
  }

  // Show the character

  m_pCharacter->Show(FALSE, &lReqID);

  // Get the IUnknown for the animation name enumerator

  if (SUCCEEDED(m_pCharacter->GetAnimationNames(&punkAnimNames))) {

    // Then query for IEnumVARIANT

    if (SUCCEEDED(punkAnimNames->QueryInterface(IID_IEnumVARIANT, (LPVOID *)&pevAnimNames))) {

      while (TRUE) {

        // Get the next animation name

        hRes = pevAnimNames->Next(1, &vAnimName, &dwRetrieved);

        // Was there one?

        if (hRes != NOERROR)
          break;

        // Hmmmm

        _ASSERT(dwRetrieved > 0);
        _ASSERT(vAnimName.vt == VT_BSTR);
        _ASSERT(vAnimName.bstrVal != NULL);

        // Add it to the list box

        SendDlgItemMessage(m_hWnd, IDC_ANIMATIONS, LB_ADDSTRING, 0, (LPARAM)W2T(vAnimName.bstrVal));

        // And clean up

        VariantClear(&vAnimName);
      }

      pevAnimNames->Release();
    }

    punkAnimNames->Release();
  }

  // Do we have any animations?

  bHasAnims = (SendDlgItemMessage(m_hWnd, IDC_ANIMATIONS, LB_GETCOUNT, 0, 0) > 0);

  if (bHasAnims)
    SendDlgItemMessage(m_hWnd, IDC_ANIMATIONS, LB_SETCURSEL, 0, 0);

  // Enable/Disable controls

  EnableWindow(GetDlgItem(m_hWnd, IDC_PLAY), bHasAnims);
  EnableWindow(GetDlgItem(m_hWnd, IDC_STOP), bHasAnims);
  EnableWindow(GetDlgItem(m_hWnd, IDC_SFX), bHasAnims);
  EnableWindow(GetDlgItem(m_hWnd, IDC_STOPBEFOREPLAY), bHasAnims);
  EnableWindow(GetDlgItem(m_hWnd, IDC_SPEAK), bHasAnims && (GetWindowTextLength(GetDlgItem(m_hWnd, IDC_SPEAKTEXT)) > 0));
  EnableWindow(GetDlgItem(m_hWnd, IDC_SPEAKTEXT), bHasAnims);

  EnableWindow(GetDlgItem(m_hWnd, IDC_BALLOON_USE), bHasAnims);

  EnableWindow(GetDlgItem(m_hWnd, IDC_MOVE_X), bHasAnims);
  EnableWindow(GetDlgItem(m_hWnd, IDC_MOVE_Y), bHasAnims);
  EnableWindow(GetDlgItem(m_hWnd, IDC_MOVE), bHasAnims);

  EnableWindow(GetDlgItem(m_hWnd, IDC_ANIMATIONS_LABEL), bHasAnims);
  EnableWindow(GetDlgItem(m_hWnd, IDC_SPEECHOUTPUT_LABEL), bHasAnims);
  EnableWindow(GetDlgItem(m_hWnd, IDC_POSITION_LABEL), bHasAnims);
  EnableWindow(GetDlgItem(m_hWnd, IDC_X_LABEL), bHasAnims);
  EnableWindow(GetDlgItem(m_hWnd, IDC_Y_LABEL), bHasAnims);

  // Sound Effects

  if (SUCCEEDED(m_pCharacter->GetSoundEffectsOn((long *)&bUseSfx)))
    CheckDlgButton(m_hWnd, IDC_SFX, bUseSfx);
  else
    CheckDlgButton(m_hWnd, IDC_SFX, FALSE);

  // Update the balloon buttons

  uBalloonStyle = 0;

  if (m_pBalloon && bHasAnims) {

    if (SUCCEEDED(m_pBalloon->GetStyle((long *)&uBalloonStyle))) {

      CheckDlgButton(m_hWnd, IDC_BALLOON_USE, uBalloonStyle & BALLOON_STYLE_BALLOON_ON);
      CheckDlgButton(m_hWnd, IDC_BALLOON_SIZETOTEXT, uBalloonStyle & BALLOON_STYLE_SIZETOTEXT);
      CheckDlgButton(m_hWnd, IDC_BALLOON_AUTOPACE, uBalloonStyle & BALLOON_STYLE_AUTOPACE);
      CheckDlgButton(m_hWnd, IDC_BALLOON_AUTOHIDE, uBalloonStyle & BALLOON_STYLE_AUTOHIDE);
    }
  }

  EnableWindow(GetDlgItem(m_hWnd, IDC_BALLOON_SIZETOTEXT), bHasAnims && (uBalloonStyle & BALLOON_STYLE_BALLOON_ON));
  EnableWindow(GetDlgItem(m_hWnd, IDC_BALLOON_AUTOPACE), bHasAnims && (uBalloonStyle & BALLOON_STYLE_BALLOON_ON));
  EnableWindow(GetDlgItem(m_hWnd, IDC_BALLOON_AUTOHIDE), bHasAnims && (uBalloonStyle & BALLOON_STYLE_BALLOON_ON));

  // Call our OnPropertyChange function. This will sync
  // our dialog with Agent properties.

  OnPropertyChange();

  // Force a WM_SETFOCUS to the animation list box. The
  // subclassed listbox correctly sets the play button's
  // highlight state.

  SetFocus(NULL);
  SetFocus(GetDlgItem(m_hWnd, IDC_ANIMATIONS));

  // Set the text of the title bar

  pchFilename = _tcsrchr(pszFilename, '\\');

  if (pchFilename)
    pchFilename = _tcsinc(pchFilename);
  else
    pchFilename = (LPTSTR)pszFilename;

    ZeroMemory(szTemp, sizeof(szTemp));
    _tcsncpy(szTemp, pchFilename, (sizeof(szTemp) / sizeof(szTemp[0])) - (_tcslen(kpszAppTitle) + 4));
    _tcscat(szTemp, _T(" - "));
    _tcscat(szTemp, kpszAppTitle);

  SetWindowText(m_hWnd, szTemp);

  // Update the "Animations" group box text with the character's
  // name.

  if (SUCCEEDED(m_pCharacter->GetName(&bszName))) {

    _TCHAR szTemplate[64];
    _TCHAR szLabel[256];

    LoadString(GetModuleHandle(NULL), IDS_ANIMATIONS_LABEL, szTemplate, 64);

    _ASSERT(_tcslen(W2T(bszName)) < 192);

    wsprintf(szLabel, szTemplate, W2T(bszName));

    SetWindowText(GetDlgItem(m_hWnd, IDC_ANIMATIONS_LABEL), szLabel);

    SysFreeString(bszName);
  }

  SetCursor(LoadCursor(NULL, IDC_ARROW));
}

void MainDlg::MakeEllipsisPath | ( | LPCTSTR | pszPath,
 |  | LPTSTR | pszEllipsisPath,
 |  | UINT | cchMaxEllipsisPath |
 | ) |  |  | [private]

Definition at line 570 of file MainDlg.Cpp.

                                                                                {

  // This function takes a full path and truncates to a fixed
  // specified size using ellipses as necessary. It's main goal
  // is to keep the first directory in the path and the filename
  // intact and use ellipsis in the middle.
  //
  // NOTE: cchMaxEllipsisPath is NOT the size of the pszEllipsisPath
  // buffer (in characters). It is simply the maximum number of
  // characters to allow in the path so we'd better have room for at
  // least that many.

  _ASSERT(!IsBadWritePtr(pszEllipsisPath, (cchMaxEllipsisPath+1) * sizeof(_TCHAR)));
  _ASSERT(cchMaxEllipsisPath <= _MAX_PATH);

  _TCHAR  szPathCopy[_MAX_PATH];
  _TCHAR *pchEndDir;
  LPCTSTR pchFilename;
  UINT  uPathPartLen;
  UINT  uFilenameLen;

  // If the specified path fits, then just copy it and return

  if ((UINT)lstrlen(pszPath) < cchMaxEllipsisPath) {
    lstrcpy(pszEllipsisPath, pszPath);
    return;
  }

  // See if the filename alone is too big

  pchFilename = _tcsrchr(pszPath, '\\');

  if (pchFilename != NULL)
    pchFilename = _tcsinc(pchFilename);
  else
    pchFilename = pszPath;

  _ASSERT(pchFilename);

  uFilenameLen = lstrlen(pchFilename);

  if (uFilenameLen >= cchMaxEllipsisPath) {
    lstrcpyn(pszEllipsisPath, pchFilename, cchMaxEllipsisPath-2);
    lstrcat(pszEllipsisPath, _T("..."));
    return;
  }

  // Save a local copy of the specified path

  lstrcpy(szPathCopy, pszPath);

  pchEndDir = szPathCopy;

  // See if it's a UNC name

  if (_tcsncmp(pchEndDir, _T("\\\\"), 2) == 0) {
    pchEndDir = _tcsinc(pchEndDir);
    pchEndDir = _tcsinc(pchEndDir);
    pchEndDir = _tcschr(pchEndDir, '\\');
  }
  else {
    pchEndDir = _tcschr(pchEndDir, '\\');
    if (pchEndDir) {
      pchEndDir = _tcsinc(pchEndDir);
      pchEndDir = _tcschr(pchEndDir, '\\');
    }
  }

  if (pchEndDir != NULL)
    pchEndDir = _tcsinc(pchEndDir);

  // If we couldn't find the first directory component, give up
  // and just return the filename only.

  if (pchEndDir == NULL) {
    lstrcpy(pszEllipsisPath, pchFilename);
    return;
  }

  *pchEndDir = 0;

  uPathPartLen = min((UINT)lstrlen(szPathCopy), cchMaxEllipsisPath - uFilenameLen - 4);

  lstrcpyn(pszEllipsisPath, szPathCopy, uPathPartLen+1);
  lstrcat(pszEllipsisPath, _T("...\\"));
  lstrcat(pszEllipsisPath, pchFilename);
}

void MainDlg::OnActivateApp ( BOOL bActive ) [private]

Definition at line 1303 of file MainDlg.Cpp.

                                        {

  _TCHAR  szText[256];
  long  lOtherClients;
  long  lReqID;
  long  lVisibilityCause;

  // If we don't have a character loaded, we're done

  if (m_pCharacter == NULL)
    return;

  // If we're being deactivated, and the foreground
  // window is an Agent character, we don't want to
  // hide the character.

  if (!bActive) {

    // Get the window title text for the foreground window.
    // NOTE: Microsoft Agent character's window titles are
    // always "Microsoft Agent"

    if (GetWindowText(GetForegroundWindow(), szText, 256) > 0) {

      if (lstrcmpi(szText, kpszAgentCharacterTitle) == 0)
        return;

      // Check to see if it's the Agent Character Property
      // Sheet. NOTE: this currently only works on English
      // systems. A more robust way to do this would be to
      // use the process id of the window that is getting
      // focus, and make sure that it's not AgentSvr.exe.

      if (lstrcmpi(szText, kpszAgentCharacterOptions) == 0)
        return;
    }

    // If the character has other clients, we're not going
    // to hide it.

    if (FAILED(m_pCharacter->HasOtherClients(&lOtherClients)))
      lOtherClients = FALSE;

    if (!lOtherClients)
      m_pCharacter->Hide(TRUE, &lReqID);
  }
  else {

    // Is the window minimized?

    if (!IsIconic(m_hWnd)) {

      // We want to show the character on activation but there's
      // a special case. If the user hid the character we could get
      // a WM_ACTIVATEAPP message after the character window hides.
      // In that case, we sure don't want to show the character. So
      // check the visibility cause of the character. If the user hid
      // it, we won't show it.

      if (SUCCEEDED(m_pCharacter->GetVisibilityCause(&lVisibilityCause))) {
        if (lVisibilityCause == UserHid)
          return;
      }

      m_pCharacter->Show(TRUE, &lReqID);
    }
  }
}

void MainDlg::OnButtonClick ( UINT uID ) [private]

Definition at line 1180 of file MainDlg.Cpp.

                                    {

  // We'd better have a character

  _ASSERT(m_pCharacter);

  int   iCurSel;
  int   iLen;
  LPTSTR  pszTemp;
  BSTR  bszTemp;
  long  lReqID;
  BOOL  bCheck;
  BOOL  bConvert;
  int   iX;
  int   iY;

  USES_CONVERSION;

  switch (uID) {
    case IDC_PLAY:

      // Get the current selection

      iCurSel = (int)SendDlgItemMessage(m_hWnd, IDC_ANIMATIONS, LB_GETCURSEL, 0, 0);

      if (iCurSel == LB_ERR)
        return;

      // Get the length of the text

      iLen = (int)SendDlgItemMessage(m_hWnd, IDC_ANIMATIONS, LB_GETTEXTLEN, (WPARAM)iCurSel, 0);

      if (iLen == LB_ERR)
        return;

      // Allocate a buffer on the stack

      pszTemp = (LPTSTR)_alloca((iLen + 1) * sizeof(_TCHAR));

      // No need to check for NULL. It wouldn't do us any good
      // anyway since _alloca raises an exception if it fails.
      // Production quality code would wrap this in a __try/__except
      // block.

      SendDlgItemMessage(m_hWnd, IDC_ANIMATIONS, LB_GETTEXT, (WPARAM)iCurSel, (LPARAM)pszTemp);

      // Stop the character if the button is checked

      if (IsDlgButtonChecked(m_hWnd, IDC_STOPBEFOREPLAY))
        m_pCharacter->StopAll(STOP_TYPE_ALL);

      // Play the animation

      bszTemp = SysAllocString(T2W(pszTemp));

      if (bszTemp) {

        m_pCharacter->Play(bszTemp, &lReqID);

        SysFreeString(bszTemp);
      }

      SetFocus(GetDlgItem(m_hWnd, IDC_ANIMATIONS));

      break;

    case IDC_SPEAK:

      OnSpeak();

      SendDlgItemMessage(m_hWnd, IDC_SPEAKTEXT, EM_SETSEL, 0, (LPARAM)-1);
      SetFocus(GetDlgItem(m_hWnd, IDC_SPEAKTEXT));

      break;

    case IDC_MOVE:

      iX = GetDlgItemInt(m_hWnd, IDC_MOVE_X, &bConvert, TRUE);

      if (!bConvert || (iX > 32767) || (iX < -32767))
        break;

      iY = GetDlgItemInt(m_hWnd, IDC_MOVE_Y, &bConvert, TRUE);

      if (!bConvert || (iY > 32767) || (iY < -32767))
        break;

      if (IsDlgButtonChecked(m_hWnd, IDC_STOPBEFOREPLAY))
        m_pCharacter->StopAll(STOP_TYPE_ALL);

      m_pCharacter->MoveTo((short)iX, (short)iY, 1000, &lReqID);

      break;

    case IDC_STOP:

      m_pCharacter->StopAll(STOP_TYPE_ALL);

      break;

    case IDC_SFX:

      m_pCharacter->SetSoundEffectsOn(IsDlgButtonChecked(m_hWnd, IDC_SFX));
      break;

    case IDC_BALLOON_USE:

      bCheck = IsDlgButtonChecked(m_hWnd, IDC_BALLOON_USE);

      EnableWindow(GetDlgItem(m_hWnd, IDC_BALLOON_SIZETOTEXT), bCheck);
      EnableWindow(GetDlgItem(m_hWnd, IDC_BALLOON_AUTOPACE), bCheck);
      EnableWindow(GetDlgItem(m_hWnd, IDC_BALLOON_AUTOHIDE), bCheck);

      break;
  }
}

void MainDlg::OnCharacterCommand ( long lID ) [private]

Definition at line 1059 of file MainDlg.Cpp.

                                         {

  _ASSERT(m_pAgent);
  _ASSERT(m_pCharacter);

  if (lID == m_lCmdPropertiesID) {

    IAgentPropertySheet *pPropSheet;
    RECT rc;
    long lReqID;

    // Query for the IAgentPropertySheet interface

    if (SUCCEEDED(m_pAgent->QueryInterface(IID_IAgentPropertySheet, (LPVOID *)&pPropSheet))) {

      // Show the property sheet

      pPropSheet->SetVisible(TRUE);

      // Get it's rect

      if (SUCCEEDED(pPropSheet->GetPosition(&rc.left, &rc.top)) &&
        SUCCEEDED(pPropSheet->GetSize(&rc.right, &rc.bottom))) {

        rc.right += rc.left;
        rc.bottom += rc.top;

        // Stop the character

        m_pCharacter->StopAll(STOP_TYPE_ALL);

        // And gesture at the property sheet

        m_pCharacter->GestureAt((short)(rc.left + (rc.right - rc.left) / 2),
                    (short)(rc.top + (rc.bottom - rc.top) / 2),
                    &lReqID);
      }

      pPropSheet->Release();
    }
  }
}

void MainDlg::OnCharacterMove | ( | long | x,
 |  | long | y |
 | ) |  |  | [private]

Definition at line 999 of file MainDlg.Cpp.

                                            {

  // Update the position fields

  SetDlgItemInt(m_hWnd, IDC_MOVE_X, x, TRUE);
  SetDlgItemInt(m_hWnd, IDC_MOVE_Y, y, TRUE);
}

void MainDlg::OnCharacterRightClick | ( | long | x,
 |  | long | y |
 | ) |  |  | [private]

Definition at line 1008 of file MainDlg.Cpp.

                                                  {

  _ASSERT(m_pCharacter);

  _TCHAR      szCommand[256];
  BSTR      bszCommand;
  IAgentCommands *pCommands;

  USES_CONVERSION;

  // If we've already added them, the AutoPopup feature will
  // do everything for us.

  if (m_bAddedCommands)
    return;

  m_bAddedCommands = TRUE;

  // Turn AutoPopup back on

  m_pCharacter->SetAutoPopupMenu(TRUE);

  // Query for the IAgentCommands interface

  if (SUCCEEDED(m_pCharacter->QueryInterface(IID_IAgentCommands, (LPVOID *)&pCommands))) {

    // Load our command strings and add them

    LoadString(GetModuleHandle(NULL), IDS_COMMAND_PROPERTIES, szCommand, 256);

    bszCommand = SysAllocString(T2W(szCommand));

    if (bszCommand) {

      pCommands->Add(bszCommand, NULL, TRUE, TRUE, &m_lCmdPropertiesID);

      SysFreeString(bszCommand);
    }

    // The AutoPopup menu feature was previously off. So we have
    // to show the popup menu ourself.

    m_pCharacter->ShowPopupMenu((short)x, (short)y);

    // We're done with the IAgentCommands interface

    pCommands->Release();
  }
}

BOOL MainDlg::OnCommand | ( | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [private]

Definition at line 1138 of file MainDlg.Cpp.

                                                    {

  WORD wID;

  wID = LOWORD(wParam);

  // First check for a recent file command

  if ((wID >= ID_RECENT_FILE_0) && (wID < ID_RECENT_FILE_0+MAX_RECENT_FILES)) {
    OnRecentFile(wID - ID_RECENT_FILE_0 + 1);
    return TRUE;
  }

  switch (wID) {
    case ID_FILE_OPENCHARACTER:
      LoadCharacter(NULL);
      return TRUE;

    case ID_FILE_EXIT:
      ShowWindow(m_hWnd, SW_HIDE);
      PostQuitMessage(0);
      return TRUE;

    case ID_HELP_ABOUT:

      _ASSERT(m_pAgent);

      short sMajor;
      short sMinor;
      AboutDlg about;

      m_pAgent->GetVersion(&sMajor, &sMinor);

      about.DoModal(m_hWnd, sMajor, sMinor);

      return TRUE;
  }

  return FALSE;
}

void MainDlg::OnDestroy ( ) [private]

Definition at line 207 of file MainDlg.Cpp.

                        {

  // Release the balloon interface

  if (m_pBalloon) {
    m_pBalloon->Release();
    m_pBalloon = NULL;
  }

  // Unload/Release the character

  if (m_pCharacter) {

    _ASSERT(m_pAgent);
    _ASSERT(m_lCharacterID != -1);

    m_pAgent->Unload(m_lCharacterID);
    m_pCharacter->Release();
    m_pCharacter = NULL;
  }

  // Release our Agent interface

  if (m_pAgent) {

    if (m_pSink) {

      _ASSERT(m_lSinkID != -1);

      m_pAgent->Unregister(m_lSinkID);
      m_pSink->Release();
      m_pSink = NULL;
    }

    m_pAgent->Release();
    m_pAgent = NULL;
  }
}

void MainDlg::OnDropFiles ( HDROP hDrop ) [private]

Definition at line 910 of file MainDlg.Cpp.

                                     {

  _TCHAR szFilename[_MAX_PATH];

  // Make sure only one file was dropped

  if (DragQueryFile(hDrop, 0xFFFFFFFF, NULL, 0) > 1)
    return;

  // Get the dropped filename

  DragQueryFile(hDrop, 0, szFilename, _MAX_PATH);

  // And load it

  LoadCharacter(szFilename);
}

BOOL MainDlg::OnInitDialog ( ) [private]

Definition at line 170 of file MainDlg.Cpp.

                           {

  // Subclass controls (as necessary). This allows us
  // to control the default button state.

  m_wpListBox = (WNDPROC)SetWindowLongPtr(GetDlgItem(m_hWnd, IDC_ANIMATIONS),
                     GWLP_WNDPROC,
                     (LONG_PTR)ListBoxWndProc);

  m_wpSpeakText = (WNDPROC)SetWindowLongPtr(GetDlgItem(m_hWnd, IDC_SPEAKTEXT),
                       GWLP_WNDPROC,
                       (LONG_PTR)SpeakTextWndProc);

  m_wpMoveX = (WNDPROC)SetWindowLongPtr(GetDlgItem(m_hWnd, IDC_MOVE_X),
                     GWLP_WNDPROC,
                     (LONG_PTR)MoveXWndProc);

  m_wpMoveY = (WNDPROC)SetWindowLongPtr(GetDlgItem(m_hWnd, IDC_MOVE_Y),
                     GWLP_WNDPROC,
                     (LONG_PTR)MoveYWndProc);

  // Load the accelerator table

  m_hAccel = LoadAccelerators(g_hInst, MAKEINTRESOURCE(IDR_ACCELERATORS));

  // Initialize the MRU menu

  UpdateRecentFiles(NULL);

  // Set the focus to the empty list box

  SetFocus(GetDlgItem(m_hWnd, IDC_ANIMATIONS));

  return TRUE;
}

BOOL MainDlg::OnInitMenuPopup | ( | HMENU | hMenu,
 |  | UINT | uPos,
 |  | BOOL | bSysMenu |
 | ) |  |  | [private]

Definition at line 247 of file MainDlg.Cpp.

                                                                   {

  // We're not going to allow the dialog to be sized or
  // maximized, so disable those menu items on the context
  // menu.

  if (bSysMenu) {
    EnableMenuItem(hMenu, SC_MAXIMIZE, MF_GRAYED);
    EnableMenuItem(hMenu, SC_MINIMIZE, IsIconic(m_hWnd) ? MF_GRAYED : MF_ENABLED);
    EnableMenuItem(hMenu, SC_RESTORE, IsIconic(m_hWnd) ? MF_ENABLED : MF_GRAYED);
    EnableMenuItem(hMenu, SC_SIZE, MF_GRAYED);
    return TRUE;
  }
  else
    return FALSE;
}

void MainDlg::OnPropertyChange ( ) [private]

Definition at line 1103 of file MainDlg.Cpp.

                               {

  _ASSERT(m_pAgent);
  _ASSERT(m_pBalloon);

  // The user has changed an Agent property via the
  // Advanced Characters Property Sheet. Update any
  // of our own fields to reflect the change.

  IAgentAudioOutputPropertiesEx *pAudio;
  BOOL bTemp;
  BOOL bUseBalloon;

  if (SUCCEEDED(m_pAgent->QueryInterface(IID_IAgentAudioOutputPropertiesEx, (LPVOID *)&pAudio))) {

    if (SUCCEEDED(pAudio->GetUsingSoundEffects((long *)&bTemp)))
      EnableWindow(GetDlgItem(m_hWnd, IDC_SFX), bTemp);

    pAudio->Release();
  }

  if (SUCCEEDED(m_pBalloon->GetEnabled((long *)&bTemp))) {

    EnableWindow(GetDlgItem(m_hWnd, IDC_BALLOON_USE), bTemp);

    bUseBalloon = IsWindowEnabled(GetDlgItem(m_hWnd, IDC_BALLOON_USE)) &&
            IsDlgButtonChecked(m_hWnd, IDC_BALLOON_USE);

    EnableWindow(GetDlgItem(m_hWnd, IDC_BALLOON_SIZETOTEXT), bUseBalloon);
    EnableWindow(GetDlgItem(m_hWnd, IDC_BALLOON_AUTOPACE), bUseBalloon);
    EnableWindow(GetDlgItem(m_hWnd, IDC_BALLOON_AUTOHIDE), bUseBalloon);
  }
}

void MainDlg::OnRecentFile ( UINT uFile ) [private]

Definition at line 834 of file MainDlg.Cpp.

                                     {

  // Hmmm

  _ASSERT((uFile >= 1) && (uFile <= MAX_RECENT_FILES));

  LONG  lRes;
  DWORD dwRetType;
  DWORD dwSize;
  _TCHAR  szValueName[256];
  _TCHAR  szFile[_MAX_PATH];
  HKEY  hKeyMRU;

  // Open the Recent Files subkey

  lRes = RegOpenKeyEx(HKEY_CURRENT_USER,
            kpszRecentFilesSubkey,
            0,
            KEY_ALL_ACCESS,
            &hKeyMRU);

  if (lRes != ERROR_SUCCESS) {
    SystemError(m_hWnd, (HRESULT)HRESULT_FROM_WIN32(lRes), TRUE);
    return;
  }

  // Query the value for the specified item

  wsprintf(szValueName, _T("%s%d"), kpszRecentFilesItem, uFile);

  dwSize = _MAX_PATH;

  lRes = RegQueryValueEx(hKeyMRU,
               szValueName,
               NULL,
               &dwRetType,
               (LPBYTE)szFile,
               &dwSize);

  // If we found it, Load the character.

  if ((lRes == ERROR_SUCCESS) && (dwRetType == REG_SZ))
    LoadCharacter(szFile);

  RegCloseKey(hKeyMRU);
}

void MainDlg::OnSpeak ( ) [private]

Definition at line 929 of file MainDlg.Cpp.

                      {

  _ASSERT(m_pCharacter);

  int       iLen;
  long      lReqID;
  LPTSTR      pszTemp;
  BSTR      bszTemp;
  UINT      uBalloonFlags;

  USES_CONVERSION;

  // Get the length of the text to speak

  iLen = GetWindowTextLength(GetDlgItem(m_hWnd, IDC_SPEAKTEXT));

  // We should never be in here if there's no text

  _ASSERT(iLen > 0);

  // Set the balloon style if we have the interface

  if (m_pBalloon) {

    uBalloonFlags = 0;

    if (IsDlgButtonChecked(m_hWnd, IDC_BALLOON_USE))
      uBalloonFlags |= BALLOON_STYLE_BALLOON_ON;

    if (IsDlgButtonChecked(m_hWnd, IDC_BALLOON_SIZETOTEXT))
      uBalloonFlags |= BALLOON_STYLE_SIZETOTEXT;

    if (IsDlgButtonChecked(m_hWnd, IDC_BALLOON_AUTOPACE))
      uBalloonFlags |= BALLOON_STYLE_AUTOPACE;

    if (IsDlgButtonChecked(m_hWnd, IDC_BALLOON_AUTOHIDE))
      uBalloonFlags |= BALLOON_STYLE_AUTOHIDE;

    m_pBalloon->SetStyle((long)uBalloonFlags);
  }

  // Allocate a buffer on the stack

  pszTemp = (LPTSTR)_alloca((iLen + 1) * sizeof(_TCHAR));

  // No need to check for NULL. It wouldn't do us any good
  // anyway since _alloca raises an exception if it fails.
  // Production quality code would wrap this in a __try/__except
  // block.

  GetDlgItemText(m_hWnd, IDC_SPEAKTEXT, pszTemp, iLen + 1);

  // Speak the text

  bszTemp = SysAllocString(T2W(pszTemp));

  if (bszTemp) {

    // Stop the character if the button is checked

    if (IsDlgButtonChecked(m_hWnd, IDC_STOPBEFOREPLAY))
      m_pCharacter->StopAll(STOP_TYPE_ALL);

    m_pCharacter->Speak(bszTemp, NULL, &lReqID);

    SysFreeString(bszTemp);
  }
}

BOOL MainDlg::OnSysCommand ( WPARAM wParam ) [private]

Definition at line 882 of file MainDlg.Cpp.

                                        {

  UINT uCmdType;
  long lReqID;

  uCmdType = wParam & 0xFFF0;

  switch (uCmdType) {
    case SC_CLOSE:
      ShowWindow(m_hWnd, SW_HIDE);
      PostQuitMessage(0);
      return TRUE;

    case SC_MINIMIZE:
      if (m_pCharacter)
        m_pCharacter->Hide(TRUE, &lReqID);
      return FALSE;

    case SC_RESTORE:
      if (m_pCharacter)
        m_pCharacter->Show(TRUE, &lReqID);
      return FALSE;
  }

  return FALSE;
}

void MainDlg::UpdateRecentFiles ( LPCTSTR pszFilename ) [private]

Definition at line 659 of file MainDlg.Cpp.

                                                   {

  // This function updates our recent file list if a filename
  // is specified or initializes the file menu with existing
  // filenames from the registry.

  LONG  lRes;
  HKEY  hKeyMRU;
  HMENU hMenuFile;
  DWORD dwSize;
  DWORD dwDisposition;
  DWORD dwRetType;
  int   iNumExisting = 0;
  int   iFind = -1;
  int   iCount;
  int   iFileExitPos;
  _TCHAR  szValueName[256];
  _TCHAR  rgszExisting[MAX_RECENT_FILES][_MAX_PATH];
  _TCHAR  szEllipsisText[_MAX_PATH];
  _TCHAR  szMenuItemText[_MAX_PATH];

  // Open/Create the registry key

  lRes = RegCreateKeyEx(HKEY_CURRENT_USER,
              kpszRecentFilesSubkey,
                0,
                _T(""),
                REG_OPTION_NON_VOLATILE,
                KEY_ALL_ACCESS,
                NULL,
                &hKeyMRU,
                &dwDisposition);

  if (lRes != ERROR_SUCCESS)
    return;

  // Get all of the current entries

  for (int i=0; i < MAX_RECENT_FILES; i++) {

    // Format the value string

    wsprintf(szValueName, _T("%s%d"), kpszRecentFilesItem, i+1);

    // Get the next value

    dwSize = _MAX_PATH;

    lRes = RegQueryValueEx(hKeyMRU,
                 szValueName,
                 NULL,
                 &dwRetType,
                 (LPBYTE)rgszExisting[iNumExisting],
                 &dwSize);

    // Was it there?

    if (lRes == ERROR_SUCCESS) {

      // If a filename was specified, see if it matches this one

      if (pszFilename) {

        if (lstrcmpi(pszFilename, rgszExisting[iNumExisting]) == 0) {

          // If the specified file is the first file we find,
          // then we're done.

          if (iNumExisting == 0) {
            RegCloseKey(hKeyMRU);
            return;
          }

          iFind = iNumExisting;
        }
      }

      ++iNumExisting;
    }
  }

  // If no filename was specified, and we don't have any
  // existing files, we're done.

  if ((pszFilename == NULL) && (iNumExisting == 0))
    return;

  // If a file was specified, we have to update the registry

  if (pszFilename) {

    // Write the new filename to the registry

    wsprintf(szValueName, _T("%s%d"), kpszRecentFilesItem, 1);
    dwSize = (_tcslen(pszFilename)+1) * sizeof(_TCHAR);
    RegSetValueEx(hKeyMRU, szValueName, 0, REG_SZ, (LPBYTE)pszFilename, dwSize);

    // If we previously had the maximum number of files, and
    // the new one is not one of them, we disregard the last
    // one.

    if ((iNumExisting == MAX_RECENT_FILES) && (iFind < 0))
      --iNumExisting;

    // Now, write the remaining items

    iCount = 1;

    for (i=0; i < iNumExisting; i++) {
      if (i != iFind) {
        wsprintf(szValueName, _T("%s%d"), kpszRecentFilesItem, ++iCount);
        dwSize = (_tcslen(rgszExisting[i])+1) * sizeof(_TCHAR);
        RegSetValueEx(hKeyMRU, szValueName, 0, REG_SZ, (LPBYTE)rgszExisting[i], dwSize);
      }
    }
  }

  // Get the File submenu

  hMenuFile = GetSubMenu(GetMenu(m_hWnd), 0);

  // Delete any existing recent file entries

  for (i=0; i < MAX_RECENT_FILES; i++)
    DeleteMenu(hMenuFile, ID_RECENT_FILE_0+i, MF_BYCOMMAND);

  // Where's the Exit item?

  iFileExitPos = GetMenuItemCount(hMenuFile) - 1;

  // Create an ellipsis path from the specified filename and
  // insert it into the menu.

  if (pszFilename) {
    MakeEllipsisPath(pszFilename, szEllipsisText, MAX_RECENT_FILENAME);
    wsprintf(szMenuItemText, _T("&%d %s"), 1, szEllipsisText);
    InsertMenu(hMenuFile, iFileExitPos-1, MF_BYPOSITION, ID_RECENT_FILE_0, szMenuItemText);
    iCount = 1;
  }
  else {
    iCount = 0;
  }

  // Then do the same for the remaining items

  for (i=0; i < iNumExisting; i++) {
    if (i != iFind) {
      MakeEllipsisPath(rgszExisting[i], szEllipsisText, MAX_RECENT_FILENAME);
      wsprintf(szMenuItemText, _T("&%d %s"), iCount+1, szEllipsisText);
      InsertMenu(hMenuFile, iFileExitPos-1+iCount, MF_BYPOSITION, ID_RECENT_FILE_0+iCount, szMenuItemText);
      ++iCount;
    }
  }

  // Delete/Insert the separator as appropriate

  if ((iNumExisting == 0) && (pszFilename == NULL)) {
    if (m_bHasMRUSeparator) {
      DeleteMenu(hMenuFile, iFileExitPos-2, MF_BYPOSITION);
      m_bHasMRUSeparator = FALSE;
    }
  }
  else {
    if (!m_bHasMRUSeparator) {
      InsertMenu(hMenuFile, ID_RECENT_FILE_0, MF_BYCOMMAND | MF_SEPARATOR, 0, NULL);
      m_bHasMRUSeparator = TRUE;
    }
  }

  // We're done with the registry

  RegCloseKey(hKeyMRU);
}

Friends And Related Function Documentation

friend class AgentNotifySink [friend]

Definition at line 68 of file MainDlg.h.

LRESULT CALLBACK ListBoxWndProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [friend]

Definition at line 1464 of file MainDlg.Cpp.

                                                                                {

  _ASSERT(g_pMainDlg);

  switch (uMsg) {
    case WM_SETFOCUS:
      if (g_pMainDlg->m_pCharacter)
        SendMessage(GetParent(hWnd), DM_SETDEFID, IDC_PLAY, 0);
      break;

    case WM_LBUTTONDBLCLK:
      if (g_pMainDlg->m_pCharacter)
        g_pMainDlg->OnButtonClick(IDC_PLAY);
      return 0;
  }

  return CallWindowProc(g_pMainDlg->m_wpListBox, hWnd, uMsg, wParam, lParam);
}

LRESULT CALLBACK MoveXWndProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [friend]

Definition at line 1500 of file MainDlg.Cpp.

                                                                                {

  _ASSERT(g_pMainDlg);

  switch (uMsg) {
    case WM_SETFOCUS:
      _ASSERT(g_pMainDlg->m_pCharacter);
      SendMessage(GetParent(hWnd), DM_SETDEFID, IDC_MOVE, 0);
      break;
  }

  return CallWindowProc(g_pMainDlg->m_wpMoveX, hWnd, uMsg, wParam, lParam);
}

LRESULT CALLBACK MoveYWndProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [friend]

Definition at line 1515 of file MainDlg.Cpp.

                                                                                {

  _ASSERT(g_pMainDlg);

  switch (uMsg) {
    case WM_SETFOCUS:
      _ASSERT(g_pMainDlg->m_pCharacter);
      SendMessage(GetParent(hWnd), DM_SETDEFID, IDC_MOVE, 0);
      break;
  }

  return CallWindowProc(g_pMainDlg->m_wpMoveY, hWnd, uMsg, wParam, lParam);
}

LRESULT CALLBACK SpeakTextWndProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [friend]

Definition at line 1484 of file MainDlg.Cpp.

                                                                                {

  _ASSERT(g_pMainDlg);

  switch (uMsg) {
    case WM_SETFOCUS:
      _ASSERT(g_pMainDlg->m_pCharacter);
      if (GetWindowTextLength(hWnd) > 0)
        SendMessage(GetParent(hWnd), DM_SETDEFID, IDC_SPEAK, 0);
      break;
  }

  return CallWindowProc(g_pMainDlg->m_wpSpeakText, hWnd, uMsg, wParam, lParam);
}

LRESULT CALLBACK WndProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [friend]

Definition at line 290 of file Generic.C.

{
   int wmId, wmEvent;
   PAINTSTRUCT ps;
   HDC hdc;
      POINT pnt;
   HMENU hMenu;
      BOOL bGotHelp;

   switch (message) {

      case WM_COMMAND:
         wmId    = LOWORD(wParam); // Remember, these are...
         wmEvent = HIWORD(wParam); // ...different for Win32!

         //Parse the menu selections:
         switch (wmId) {

            case IDM_ABOUT:
               DialogBox(hInst, "AboutBox", hWnd, (DLGPROC)About);
               break;

            case IDM_EXIT:
               DestroyWindow (hWnd);
               break;

            case IDM_HELPTOPICS: // Only called in Windows 95
               bGotHelp = WinHelp (hWnd, APPNAME".HLP", HELP_FINDER,(DWORD)0);
               if (!bGotHelp)
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            case IDM_HELPCONTENTS: // Not called in Windows 95
               bGotHelp = WinHelp (hWnd, APPNAME".HLP", HELP_CONTENTS,(DWORD)0);
               if (!bGotHelp)
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            case IDM_HELPSEARCH: // Not called in Windows 95
               if (!WinHelp(hWnd, APPNAME".HLP", HELP_PARTIALKEY,
                           (ULONG_PTR)(LPSTR)""))
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            case IDM_HELPHELP: // Not called in Windows 95
               if(!WinHelp(hWnd, (LPSTR)NULL, HELP_HELPONHELP, 0))
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            // Here are all the other possible menu options,
            // all of these are currently disabled:
            case IDM_NEW:
            case IDM_OPEN:
            case IDM_SAVE:
            case IDM_SAVEAS:
            case IDM_UNDO:
            case IDM_CUT:
            case IDM_COPY:
            case IDM_PASTE:
            case IDM_LINK:
            case IDM_LINKS:

            default:
               return (DefWindowProc(hWnd, message, wParam, lParam));
         }
         break;

      case WM_NCRBUTTONUP: // RightClick on windows non-client area...
         if (IS_WIN95 && SendMessage(hWnd, WM_NCHITTEST, 0, lParam) == HTSYSMENU)
         {
            // The user has clicked the right button on the applications
            // 'System Menu'. Here is where you would alter the default
            // system menu to reflect your application. Notice how the
            // explorer deals with this. For this app, we aren't doing
            // anything
            return (DefWindowProc(hWnd, message, wParam, lParam));
         } else {
            // Nothing we are interested in, allow default handling...
            return (DefWindowProc(hWnd, message, wParam, lParam));
         }
            break;

        case WM_RBUTTONDOWN: // RightClick in windows client area...
            pnt.x = LOWORD(lParam);
            pnt.y = HIWORD(lParam);
            ClientToScreen(hWnd, (LPPOINT) &pnt);
      // This is where you would determine the appropriate 'context'
      // menu to bring up. Since this app has no real functionality,
      // we will just bring up the 'Help' menu:
            hMenu = GetSubMenu (GetMenu (hWnd), 2);
            if (hMenu) {
                TrackPopupMenu (hMenu, 0, pnt.x, pnt.y, 0, hWnd, NULL);
            } else {
            // Couldn't find the menu...
                MessageBeep(0);
            }
            break;

      case WM_DISPLAYCHANGE: // Only comes through on plug'n'play systems
      {
         SIZE  szScreen;
         DWORD dwBitsPerPixel = (DWORD)wParam;

         szScreen.cx = LOWORD(lParam);
         szScreen.cy = HIWORD(lParam);

         MessageBox (GetFocus(), GetStringRes(IDS_DISPLAYCHANGED),
                     szAppName, 0);
      }
      break;

      case WM_PAINT:
         hdc = BeginPaint (hWnd, &ps);
         // Add any drawing code here...
         EndPaint (hWnd, &ps);
         break;

      case WM_DESTROY:
         // Tell WinHelp we don't need it any more...
               WinHelp (hWnd, APPNAME".HLP", HELP_QUIT,(DWORD)0);
         PostQuitMessage(0);
         break;

      default:
         return (DefWindowProc(hWnd, message, wParam, lParam));
   }
   return (0);
}

Member Data Documentation

BOOL MainDlg::m_bAddedCommands [private]

Definition at line 47 of file MainDlg.h.

BOOL MainDlg::m_bHasMRUSeparator [private]

Definition at line 46 of file MainDlg.h.

HACCEL MainDlg::m_hAccel

Definition at line 20 of file MainDlg.h.

HWND MainDlg::m_hWnd

Definition at line 19 of file MainDlg.h.

long MainDlg::m_lCharacterID [private]

Definition at line 62 of file MainDlg.h.

long MainDlg::m_lCmdPropertiesID [private]

Definition at line 64 of file MainDlg.h.

long MainDlg::m_lSinkID [private]

Definition at line 63 of file MainDlg.h.

IAgentEx* MainDlg::m_pAgent [private]

Definition at line 58 of file MainDlg.h.

IAgentBalloonEx* MainDlg::m_pBalloon [private]

Definition at line 60 of file MainDlg.h.

IAgentCharacterEx* MainDlg::m_pCharacter [private]

Definition at line 59 of file MainDlg.h.

AgentNotifySink* MainDlg::m_pSink [private]

Definition at line 61 of file MainDlg.h.

WNDPROC MainDlg::m_wpListBox [private]

Definition at line 51 of file MainDlg.h.

WNDPROC MainDlg::m_wpMoveX [private]

Definition at line 53 of file MainDlg.h.

WNDPROC MainDlg::m_wpMoveY [private]

Definition at line 54 of file MainDlg.h.

WNDPROC MainDlg::m_wpSpeakText [private]

Definition at line 52 of file MainDlg.h.

The documentation for this class was generated from the following files:
  • Web/MSAgent/c/Cap/MainDlg.h
  • Web/MSAgent/c/Cap/MainDlg.Cpp
Generated on Wed Nov 13 2024 16:57:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Margin Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

Margin Struct Reference

#include "table.h"

List of all members.

Public Attributes

int | bottom
int | bottominner
int | left
int | right
int | top
int | topinner

Detailed Description

Definition at line 290 of file table.h.

Member Data Documentation

int Margin::bottom

Definition at line 294 of file table.h.

int Margin::bottominner

Definition at line 296 of file table.h.

int Margin::left

Definition at line 291 of file table.h.

int Margin::right

Definition at line 292 of file table.h.

int Margin::top

Definition at line 293 of file table.h.

int Margin::topinner

Definition at line 295 of file table.h.

The documentation for this struct was generated from the following file:
  • Begin/sdkdiff/table.h
Generated on Wed Nov 13 2024 16:57:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: MEMICONDIR Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

MEMICONDIR Struct Reference

#include "Icons.h"

List of all members.

Public Attributes

WORD | idCount
MEMICONDIRENTRY | idEntries [1]
WORD | idReserved
WORD | idType

Detailed Description

Definition at line 40 of file Icons.h.

Member Data Documentation

WORD MEMICONDIR::idCount

Definition at line 44 of file Icons.h.

MEMICONDIRENTRY MEMICONDIR::idEntries[1]

Definition at line 45 of file Icons.h.

WORD MEMICONDIR::idReserved

Definition at line 42 of file Icons.h.

WORD MEMICONDIR::idType

Definition at line 43 of file Icons.h.

The documentation for this struct was generated from the following file:
  • WinUI/Resource/Iconpro/Icons.h
Generated on Wed Nov 13 2024 16:57:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: MEMICONDIRENTRY Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

MEMICONDIRENTRY Struct Reference

#include "Icons.h"

List of all members.

Public Attributes

BYTE | bColorCount
BYTE | bHeight
BYTE | bReserved
BYTE | bWidth
DWORD dwBytesInRes
WORD | nID
WORD | wBitCount
WORD | wPlanes

Detailed Description

Definition at line 29 of file Icons.h.

Member Data Documentation

BYTE MEMICONDIRENTRY::bColorCount

Definition at line 33 of file Icons.h.

BYTE MEMICONDIRENTRY::bHeight

Definition at line 32 of file Icons.h.

BYTE MEMICONDIRENTRY::bReserved

Definition at line 34 of file Icons.h.

BYTE MEMICONDIRENTRY::bWidth

Definition at line 31 of file Icons.h.

DWORD MEMICONDIRENTRY::dwBytesInRes

Definition at line 37 of file Icons.h.

WORD MEMICONDIRENTRY::nID

Definition at line 38 of file Icons.h.

WORD MEMICONDIRENTRY::wBitCount

Definition at line 36 of file Icons.h.

WORD MEMICONDIRENTRY::wPlanes

Definition at line 35 of file Icons.h.

The documentation for this struct was generated from the following file:
  • WinUI/Resource/Iconpro/Icons.h
Generated on Wed Nov 13 2024 16:57:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: MGDRESOURCELib::ClipBookServer Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • MGDRESOURCELib
  • MGDRESOURCELib::ClipBookServer

MGDRESOURCELib::ClipBookServer Class Reference

import "MgdResource.idl";

Detailed Description

Definition at line 38 of file MgdResource.idl.

The documentation for this class was generated from the following file:
  • WinBase/Cluster/Win2003/ClipBookServer/ClipBook Server/MgdResource.idl
Generated on Wed Nov 13 2024 16:58:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: mib_entry Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

mib_entry Struct Reference

#include "TestMIB.h"

List of all members.

Public Attributes

UINT Access
UINT(* | MibFunc )(UINT, struct mib_entry *, RFC1157VarBind *)
struct mib_entry * | MibNext
AsnObjectIdentifier | Oid
void * | Storage
BYTE | Type

Detailed Description

Definition at line 70 of file TestMIB.h.

Member Data Documentation

UINT mib_entry::Access

Definition at line 75 of file TestMIB.h.

UINT(* mib_entry::MibFunc)(UINT, struct mib_entry *, RFC1157VarBind *)

Definition at line 76 of file TestMIB.h.

struct mib_entry* mib_entry::MibNext

Definition at line 78 of file TestMIB.h.

AsnObjectIdentifier mib_entry::Oid

Definition at line 72 of file TestMIB.h.

void* mib_entry::Storage

Definition at line 73 of file TestMIB.h.

BYTE mib_entry::Type

Definition at line 74 of file TestMIB.h.

The documentation for this struct was generated from the following file:
  • NetDS/Snmp/TestDll/TestMIB.h
Generated on Wed Nov 13 2024 16:57:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • Microsoft
  • Samples
  • Ink
  • CS
  • InkDividerSample
  • Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm
Public Member Functions | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes

Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm Class Reference

InkDivider sample application form class.

List of all members.

Public Member Functions

InkDividerForm ()

Protected Member Functions

override void | Dispose (bool disposing)

Private Member Functions

void | DivideInk ()
void | DrawArea_Paint (object sender, System.Windows.Forms.PaintEventArgs e)
Rectangle[] | GetUnitBBoxes (DivisionResult divResult, InkDivisionType divType, int inflate)
void | InitializeComponent ()
void | InkDividerForm_Load (object sender, System.EventArgs e)
void | miAutomaticLayoutAnalysis_Click (object sender, System.EventArgs e)
void | miDivide_Click (object sender, System.EventArgs e)
void | miErase_Click (object sender, System.EventArgs e)
void | miExit_Click (object sender, System.EventArgs e)
void | miInk_Click (object sender, System.EventArgs e)
void | myInkOverlay_Stroke (object sender, InkCollectorStrokeEventArgs e)
void | myInkOverlay_StrokeDeleted (object sender, System.EventArgs e)
void | myInkOverlay_StrokeDeleting (object sender, InkOverlayStrokesDeletingEventArgs e)

Static Private Member Functions

static void | Main ()

Private Attributes

System.ComponentModel.Container | components = null
System.Windows.Forms.Panel | DrawArea
System.Windows.Forms.MainMenu | mainMenu
System.Windows.Forms.MenuItem | miAutomaticLayoutAnalysis
System.Windows.Forms.MenuItem | miDivide
System.Windows.Forms.MenuItem | miErase
System.Windows.Forms.MenuItem | miExit
System.Windows.Forms.MenuItem | miFile
System.Windows.Forms.MenuItem | miInk
System.Windows.Forms.MenuItem | miMode
System.Windows.Forms.MenuItem | miSeparate
Rectangle[] | myDrawingBoundingBoxes
Divider | myInkDivider = null
InkOverlay | myInkOverlay = null
Rectangle[] | myLineBoundingBoxes
Rectangle[] | myParagraphBoundingBoxes
Rectangle[] | myWordBoundingBoxes
System.Windows.Forms.StatusBar | statusBar
System.Windows.Forms.StatusBarPanel | statusBarPanelDrawing
System.Windows.Forms.StatusBarPanel | statusBarPanelDummy
System.Windows.Forms.StatusBarPanel | statusBarPanelLine
System.Windows.Forms.StatusBarPanel | statusBarPanelParagraph
System.Windows.Forms.StatusBarPanel | statusBarPanelWord

Detailed Description

Definition at line 70 of file InkDividerForm.cs.

Constructor & Destructor Documentation

Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm::InkDividerForm ( ) [inline]

Definition at line 107 of file InkDividerForm.cs.

        {
            #region Standard Template Code
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // Add any constructor code after InitializeComponent call to be added here
            //
            #endregion

        }

Member Function Documentation

override void Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm::Dispose ( bool disposing ) [inline, protected]

Clean up any resources being used.

Definition at line 126 of file InkDividerForm.cs.

        {
            if( disposing )
            {
                if (components != null)
                {
                    components.Dispose();
                }

                // dispose the ink overlay's resources
                if (myInkOverlay != null)
                {
                    myInkOverlay.Dispose();
                }

                // dispose the divider's resources
                if (myInkDivider != null)
                {
                    // dispose the recognizer context that we associated
                    // with the divider
                    if (myInkDivider.RecognizerContext != null)
                    {
                        myInkDivider.RecognizerContext.Dispose();
                    }

                    // dispose the strokes that we associated
                    // with the divider
                    if (myInkDivider.Strokes != null)
                    {
                        myInkDivider.Strokes.Dispose();
                    }
                    myInkDivider.Dispose();
                }
            }
            base.Dispose( disposing );
        }

void Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm::DivideInk ( ) [inline, private]

Helper function that calls Ink Divider to perform the ink division.

This function is called by File->Divide menu handler and strokes event handler.

Definition at line 545 of file InkDividerForm.cs.

        {
            // Ink Divider produces result based on its own Strokes object
            // Invoke the Ink Divider
            DivisionResult divResult = myInkDivider.Divide();

            // Call helper function to get the bounding boxes for Words
            // Rectangles are inflated by 1 pixel in all direction to
            // avoid overlapping with stroke
            myWordBoundingBoxes = GetUnitBBoxes(divResult, InkDivisionType.Segment, 1);

            // Call helper function to get the bounding boxes for Lines
            // Rectangles are inflated by 3 pixels in all directions
            myLineBoundingBoxes = GetUnitBBoxes(divResult, InkDivisionType.Line, 3);

            // Call helper function to get the bounding boxes for Paragraphs
            // Rectangles are inflated by 5 pixels in all directions
            myParagraphBoundingBoxes = GetUnitBBoxes(divResult, InkDivisionType.Paragraph, 5);

            // Call helper function to get the bounding boxes for Drawings
            // The rectangles are inflated by 1 pixel in all directions
            myDrawingBoundingBoxes = GetUnitBBoxes(divResult, InkDivisionType.Drawing, 1);

            // Update the form to reflect these changes
            DrawArea.Refresh();
        }

void Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm::DrawArea_Paint | ( | object | sender,
 |  | System.Windows.Forms.PaintEventArgs | e |
 | ) |  |  | [inline, private]

Paint method gets called everytime when the window is refreshed.

Parameters:
sender
e

Definition at line 349 of file InkDividerForm.cs.

        {
            // Create the Pen used to draw bounding boxes.
            // First set of bounding boxes drawn here are the bounding boxes of paragraphs.
            // These boxes are drawn with Blue pen.
            Pen penBox = new Pen(Color.Blue, 2);

            // First, draw the bounding boxes for Paragraphs
            if(null != myParagraphBoundingBoxes)
            {
                // Draw bounding boxes for Paragraphs
                e.Graphics.DrawRectangles(penBox, myParagraphBoundingBoxes);
            }

            // Next, draw the bounding boxes for Lines
            if(null != myLineBoundingBoxes)
            {
                // Color is Magenta pen
                penBox.Color = Color.Magenta;
                // Draw the bounding boxes for Lines
                e.Graphics.DrawRectangles(penBox, myLineBoundingBoxes);
            }

            // Then, draw the bounding boxes for Words
            if(null != myWordBoundingBoxes)
            {
                // Color is Green
                penBox.Color = Color.Green;
                // Draw bounding boxes for Words
                e.Graphics.DrawRectangles(penBox, myWordBoundingBoxes);
            }

            // Finally, draw the boxes for Drawings
            if(null != myDrawingBoundingBoxes)
            {
                // Color is Red pen
                penBox.Color = Color.Red;
                // Draw bounding boxes for Drawings
                e.Graphics.DrawRectangles(penBox, myDrawingBoundingBoxes);
            }
        }

Rectangle [] Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm::GetUnitBBoxes | ( | DivisionResult | divResult,
 |  | InkDivisionType | divType,
 |  | int | inflate |
 | ) |  |  | [inline, private]

Helper function to obtain array of rectangles from the division result of the division type of interest.

Each rectangle is inflated by the amount specified in the third parameter. This is done to ensure the visibility of all rectangles.

Parameters:
divResult | Ink Divider division result
divType | Division type
inflate | Number of Pixels by which the rectangles are inflated
Returns:
Array of rectangles containing bounding boxes of division type specified by divType. The rectangles are in pixel unit.

Definition at line 468 of file InkDividerForm.cs.

        {
            // Declare the array of rectangles to hold the result
            Rectangle[] divRects;

            // Get the division units from the division result of division type
            DivisionUnits units = divResult.ResultByType(divType);

            // If there is at least one unit, we construct the rectangles
            if((null != units) && (0 < units.Count))
            {
                // We need to convert rectangles from ink units to
                // pixel units. For that, we need Graphics object
                // to pass to InkRenderer.InkSpaceToPixel method
                using (Graphics g = DrawArea.CreateGraphics())
                {

                    // Construct the rectangles
                    divRects = new Rectangle[units.Count];

                    // InkRenderer.InkSpaceToPixel takes Point as parameter.
                    // Create two Point objects to point to (Top, Left) and
                    // (Width, Height) properties of ractangle. (Width, Height)
                    // is used instead of (Right, Bottom) because (Right, Bottom)
                    // are read-only properties on Rectangle
                    Point ptLocation = new Point();
                    Point ptSize = new Point();

                    // Index into the bounding boxes
                    int i = 0;

                    // Iterate through the collection of division units to obtain the bounding boxes
                    foreach(DivisionUnit unit in units)
                    {
                        // Get the bounding box of the strokes of the division unit
                        divRects[i] = unit.Strokes.GetBoundingBox();

                        // The bounding box is in ink space unit. Convert them into pixel unit.
                        ptLocation = divRects[i].Location;
                        ptSize.X = divRects[i].Width;
                        ptSize.Y = divRects[i].Height;

                        // Convert the Location from Ink Space to Pixel Space
                        myInkOverlay.Renderer.InkSpaceToPixel(g, ref ptLocation);

                        // Convert the Size from Ink Space to Pixel Space
                        myInkOverlay.Renderer.InkSpaceToPixel(g, ref ptSize);

                        // Assign the result back to the corresponding properties
                        divRects[i].Location = ptLocation;
                        divRects[i].Width = ptSize.X;
                        divRects[i].Height = ptSize.Y;

                        // Inflate the rectangle by inflate pixels in both directions
                        divRects[i].Inflate(inflate, inflate);

                        // Increment the index
                        ++i;
                    }

                } // Relinquish the Graphics object
            }
            else
            {
                // Otherwise we return null
                divRects = null;
            }

            // Return the Rectangle[] object
            return divRects;
        }

void Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm::InitializeComponent ( ) [inline, private]

Required method for Designer support - do not modify the contents of this method with the code editor.

Definition at line 169 of file InkDividerForm.cs.

        {
            this.mainMenu = new System.Windows.Forms.MainMenu();
            this.miFile = new System.Windows.Forms.MenuItem();
            this.miDivide = new System.Windows.Forms.MenuItem();
            this.miExit = new System.Windows.Forms.MenuItem();
            this.miMode = new System.Windows.Forms.MenuItem();
            this.miInk = new System.Windows.Forms.MenuItem();
            this.miErase = new System.Windows.Forms.MenuItem();
            this.miSeparate = new System.Windows.Forms.MenuItem();
            this.miAutomaticLayoutAnalysis = new System.Windows.Forms.MenuItem();
            this.DrawArea = new System.Windows.Forms.Panel();
            this.statusBar = new System.Windows.Forms.StatusBar();
            this.statusBarPanelDummy = new System.Windows.Forms.StatusBarPanel();
            this.statusBarPanelWord = new System.Windows.Forms.StatusBarPanel();
            this.statusBarPanelLine = new System.Windows.Forms.StatusBarPanel();
            this.statusBarPanelParagraph = new System.Windows.Forms.StatusBarPanel();
            this.statusBarPanelDrawing = new System.Windows.Forms.StatusBarPanel();
            ((System.ComponentModel.ISupportInitialize)(this.statusBarPanelDummy)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.statusBarPanelWord)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.statusBarPanelLine)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.statusBarPanelParagraph)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.statusBarPanelDrawing)).BeginInit();
            this.SuspendLayout();
            //
            // mainMenu
            //
            this.mainMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                                this.miFile,
                                                                                this.miMode});
            //
            // miFile
            //
            this.miFile.Index = 0;
            this.miFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                                this.miDivide,
                                                                                this.miExit});
            this.miFile.Text = "&File";
            //
            // miDivide
            //
            this.miDivide.Index = 0;
            this.miDivide.Text = "&Divide";
            this.miDivide.Click += new System.EventHandler(this.miDivide_Click);
            //
            // miExit
            //
            this.miExit.Index = 1;
            this.miExit.Text = "E&xit";
            this.miExit.Click += new System.EventHandler(this.miExit_Click);
            //
            // miMode
            //
            this.miMode.Index = 1;
            this.miMode.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                                this.miInk,
                                                                                this.miErase,
                                                                                this.miSeparate,
                                                                                this.miAutomaticLayoutAnalysis});
            this.miMode.Text = "&Mode";
            //
            // miInk
            //
            this.miInk.Index = 0;
            this.miInk.Text = "&Ink";
            this.miInk.Click += new System.EventHandler(this.miInk_Click);
            //
            // miErase
            //
            this.miErase.Index = 1;
            this.miErase.Text = "&Erase";
            this.miErase.Click += new System.EventHandler(this.miErase_Click);
            //
            // miSeparate
            //
            this.miSeparate.Index = 2;
            this.miSeparate.Text = "-";
            //
            // miAutomaticLayoutAnalysis
            //
            this.miAutomaticLayoutAnalysis.Checked = true;
            this.miAutomaticLayoutAnalysis.Index = 3;
            this.miAutomaticLayoutAnalysis.Text = "&Automatic Layout Analysis";
            this.miAutomaticLayoutAnalysis.Click += new System.EventHandler(this.miAutomaticLayoutAnalysis_Click);
            //
            // DrawArea
            //
            this.DrawArea.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                | System.Windows.Forms.AnchorStyles.Left)
                | System.Windows.Forms.AnchorStyles.Right);
            this.DrawArea.BackColor = System.Drawing.SystemColors.Window;
            this.DrawArea.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
            this.DrawArea.Name = "DrawArea";
            this.DrawArea.Size = new System.Drawing.Size(560, 420);
            this.DrawArea.TabIndex = 2;
            this.DrawArea.Paint += new System.Windows.Forms.PaintEventHandler(this.DrawArea_Paint);
            //
            // statusBar
            //
            this.statusBar.Location = new System.Drawing.Point(0, 420);
            this.statusBar.Name = "statusBar";
            this.statusBar.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
                                                                                this.statusBarPanelDummy,
                                                                                this.statusBarPanelWord,
                                                                                this.statusBarPanelLine,
                                                                                this.statusBarPanelParagraph,
                                                                                this.statusBarPanelDrawing});
            this.statusBar.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.statusBar.ShowPanels = true;
            this.statusBar.Size = new System.Drawing.Size(560, 21);
            this.statusBar.TabIndex = 3;
            //
            // statusBarPanelDummy
            //
            this.statusBarPanelDummy.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring;
            this.statusBarPanelDummy.BorderStyle = System.Windows.Forms.StatusBarPanelBorderStyle.None;
            this.statusBarPanelDummy.Width = 200;
            //
            // statusBarPanelWord
            //
            this.statusBarPanelWord.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Contents;
            this.statusBarPanelWord.Text = "Green: Word";
            this.statusBarPanelWord.Width = 79;
            //
            // statusBarPanelLine
            //
            this.statusBarPanelLine.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Contents;
            this.statusBarPanelLine.Text = "Magenta: Line";
            this.statusBarPanelLine.Width = 86;
            //
            // statusBarPanelParagraph
            //
            this.statusBarPanelParagraph.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Contents;
            this.statusBarPanelParagraph.Text = "Blue: Paragraph";
            this.statusBarPanelParagraph.Width = 96;
            //
            // statusBarPanelDrawing
            //
            this.statusBarPanelDrawing.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Contents;
            this.statusBarPanelDrawing.Text = "Red: Drawing";
            this.statusBarPanelDrawing.Width = 83;
            //
            // InkDividerForm
            //
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize = new System.Drawing.Size(560, 441);
            this.Controls.AddRange(new System.Windows.Forms.Control[] {
                                                                          this.statusBar,
                                                                          this.DrawArea});
            this.Menu = this.mainMenu;
            this.Name = "InkDividerForm";
            this.Text = "Ink Divider";
            this.Load += new System.EventHandler(this.InkDividerForm_Load);
            ((System.ComponentModel.ISupportInitialize)(this.statusBarPanelDummy)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.statusBarPanelWord)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.statusBarPanelLine)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.statusBarPanelParagraph)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.statusBarPanelDrawing)).EndInit();
            this.ResumeLayout(false);

        }

void Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm::InkDividerForm_Load | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Form Load Event Setup the ink overlay for collection.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 397 of file InkDividerForm.cs.

        {
            // Create the ink overlay and associate it with the form
            myInkOverlay = new Microsoft.Ink.InkOverlay(DrawArea.Handle);

            // Hook event handler for the Stroke event to myInkOverlay_Stroke.
            // This is necessary since the application needs to pass the strokes
            // to the ink divider.
            myInkOverlay.Stroke += new InkCollectorStrokeEventHandler(myInkOverlay_Stroke);

            // Hook the event handler for StrokeDeleting event to myInkOverlay_StrokeDeleting.
            // This is necessary as the application needs to remove the strokes from
            // ink divider object as well.
            myInkOverlay.StrokesDeleting += new InkOverlayStrokesDeletingEventHandler(myInkOverlay_StrokeDeleting);

            // Hook the event handler for StrokeDeleted event to myInkOverlay_StrokeDeleted.
            // This is necessary to update the layout analysis result when automatic layout analysis
            // option is selected.
            myInkOverlay.StrokesDeleted += new InkOverlayStrokesDeletedEventHandler(myInkOverlay_StrokeDeleted);

            // Create the ink divider object
            myInkDivider = new Divider();

            // Add a default recognizer context to the divider object
            // without adding the recognizer context, the divider would
            // not use a recognizer to do its word segmentation and would
            // have less accurate results.
            // Adding the recognizer context will slow down the call to
            // myInkDivider.Divide though.
            // It is possible that there is no recognizer installed on the
            // machine for this language. In that case the divider will
            // not use a recognizer to improve its accuracy.
            // Get the default recognizer if any
            try
            {
                Recognizers recognizers = new Recognizers();
                myInkDivider.RecognizerContext = recognizers.GetDefaultRecognizer().CreateRecognizerContext();
            }
            catch (InvalidOperationException)
            {
                //We are in the case where no default recognizers can be found
            }

            // The LineHeight property helps the InkDivider distinguish between
            // drawing and handwriting. The value should be the expected height
            // of the user's handwriting in ink space units (0.01mm).
            // Here we set the LineHeight to 840, which is about 1/3 of an inch.
            myInkDivider.LineHeight = 840;

            // Assign ink overlay's strokes collection to the ink divider
            // This strokes collection will be updated in the event handler
            myInkDivider.Strokes = myInkOverlay.Ink.Strokes;

            // Enable ink collection
            myInkOverlay.Enabled = true;

            // Set check for ink menu item
            miInk.Checked = true;
        }

static void Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm::Main ( ) [inline, static, private]

The main entry point for the application.

Definition at line 337 of file InkDividerForm.cs.

        {
            Application.Run(new InkDividerForm());
        }

void Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm::miAutomaticLayoutAnalysis_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event handler for Mode->AutomaticLayoutAnalysis menu item.

Parameters:
sender | The control that raised the event.
e | The event argument.

Definition at line 696 of file InkDividerForm.cs.

        {
            // Toggle the check on the menu item.
            miAutomaticLayoutAnalysis.Checked = !miAutomaticLayoutAnalysis.Checked;
            // Update the window.
            this.Refresh();
        }

void Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm::miDivide_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event handler for File->Divide menu item.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 577 of file InkDividerForm.cs.

        {
            // Call DivideInk to perform the ink division
            DivideInk();
        }

void Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm::miErase_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event handler for Mode->Erase menu item.

Parameters:
sender | The control that raised the event.
e | The event argument.

Definition at line 678 of file InkDividerForm.cs.

        {
            // Turn on the ink deletion mode
            myInkOverlay.EditingMode = InkOverlayEditingMode.Delete;

            // Update the state of the Ink and Erase menu items
            miInk.Checked = false;
            miErase.Checked = true;

            // Update the UI
            this.Refresh();
        }

void Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm::miExit_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event handler for File->Exit menu item.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 650 of file InkDividerForm.cs.

        {
            this.Close();
        }

void Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm::miInk_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event handler for Mode->Ink menu item.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 660 of file InkDividerForm.cs.

        {
            // Turn on the inking mode
            myInkOverlay.EditingMode = InkOverlayEditingMode.Ink;

            // Update the state of the Ink and Erase menu items
            miInk.Checked = true;
            miErase.Checked = false;

            // Update the UI
            this.Refresh();
        }

void Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm::myInkOverlay_Stroke | ( | object | sender,
 |  | InkCollectorStrokeEventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Ink Overlay's Stroke event This event is fired when a new stroke is drawn.

In this case, it is necessary to update the ink divider's strokes collection. The event is fired even when the eraser stroke is created. The event handler must filter out the eraser strokes.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 592 of file InkDividerForm.cs.

        {
            // Filter out the eraser stroke.
            if(InkOverlayEditingMode.Ink == myInkOverlay.EditingMode)
            {
                // Add the new stroke to the ink divider's strokes collection
                myInkDivider.Strokes.Add(e.Stroke);

                if(miAutomaticLayoutAnalysis.Checked)
                {
                    // Call DivideInk
                    DivideInk();

                    // Repaint the screen to reflect the change
                    DrawArea.Refresh();
                }
            }
        }

void Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm::myInkOverlay_StrokeDeleted | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event handler for Ink Overlay's StrokeDeleted event.

This event is fired when the set of strokes were actually deleted. DivideInk method is called to analyze the current layout.

Parameters:
sender | The control that raised the event
e | The event argument

Definition at line 632 of file InkDividerForm.cs.

        {
            // If automatic layout analysis is turned on, call DivideInk
            if(miAutomaticLayoutAnalysis.Checked)
            {
                // Call Divide Ink
                DivideInk();

                // Repaint the screen to reflect the change
                DrawArea.Refresh();
            }
        }

void Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm::myInkOverlay_StrokeDeleting | ( | object | sender,
 |  | InkOverlayStrokesDeletingEventArgs | e |
 | ) |  |  | [inline, private]

Event Handler for Ink Overlay's StrokeDeleting event.

This event is fired when a set of stroke is about to be deleted. The stroke should also be removed from the ink divider's stroke collection as well

Parameters:
sender | The control that raised the event
e | The event arguments

Definition at line 619 of file InkDividerForm.cs.

        {
            // Remove the strokes to be deleted from the ink divider's stroke collection
            myInkDivider.Strokes.Remove(e.StrokesToDelete);
        }

Member Data Documentation

System.ComponentModel.Container Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm::components = null [private]

Required designer variable.

Definition at line 104 of file InkDividerForm.cs.

System.Windows.Forms.Panel Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm::DrawArea [private]

Definition at line 86 of file InkDividerForm.cs.

System.Windows.Forms.MainMenu Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm::mainMenu [private]

Definition at line 85 of file InkDividerForm.cs.

System.Windows.Forms.MenuItem Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm::miAutomaticLayoutAnalysis [private]

Definition at line 99 of file InkDividerForm.cs.

System.Windows.Forms.MenuItem Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm::miDivide [private]

Definition at line 94 of file InkDividerForm.cs.

System.Windows.Forms.MenuItem Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm::miErase [private]

Definition at line 98 of file InkDividerForm.cs.

System.Windows.Forms.MenuItem Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm::miExit [private]

Definition at line 95 of file InkDividerForm.cs.

System.Windows.Forms.MenuItem Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm::miFile [private]

Definition at line 93 of file InkDividerForm.cs.

System.Windows.Forms.MenuItem Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm::miInk [private]

Definition at line 97 of file InkDividerForm.cs.

System.Windows.Forms.MenuItem Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm::miMode [private]

Definition at line 96 of file InkDividerForm.cs.

System.Windows.Forms.MenuItem Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm::miSeparate [private]

Definition at line 100 of file InkDividerForm.cs.

Rectangle [] Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm::myDrawingBoundingBoxes [private]

Definition at line 80 of file InkDividerForm.cs.

Divider Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm::myInkDivider = null [private]

Definition at line 76 of file InkDividerForm.cs.

InkOverlay Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm::myInkOverlay = null [private]

Definition at line 73 of file InkDividerForm.cs.

Rectangle [] Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm::myLineBoundingBoxes [private]

Definition at line 81 of file InkDividerForm.cs.

Rectangle [] Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm::myParagraphBoundingBoxes [private]

Definition at line 82 of file InkDividerForm.cs.

Rectangle [] Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm::myWordBoundingBoxes [private]

Definition at line 79 of file InkDividerForm.cs.

System.Windows.Forms.StatusBar Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm::statusBar [private]

Definition at line 87 of file InkDividerForm.cs.

System.Windows.Forms.StatusBarPanel Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm::statusBarPanelDrawing [private]

Definition at line 89 of file InkDividerForm.cs.

System.Windows.Forms.StatusBarPanel Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm::statusBarPanelDummy [private]

Definition at line 88 of file InkDividerForm.cs.

System.Windows.Forms.StatusBarPanel Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm::statusBarPanelLine [private]

Definition at line 92 of file InkDividerForm.cs.

System.Windows.Forms.StatusBarPanel Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm::statusBarPanelParagraph [private]

Definition at line 90 of file InkDividerForm.cs.

System.Windows.Forms.StatusBarPanel Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm::statusBarPanelWord [private]

Definition at line 91 of file InkDividerForm.cs.

The documentation for this class was generated from the following file:
  • TabletPC/InkDivider/C#/InkDividerForm.cs
Generated on Wed Nov 13 2024 16:58:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Microsoft::Samples::Ink::Cs::InkZoom::InkZoom Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • Microsoft
  • Samples
  • Ink
  • Cs
  • InkZoom
  • Microsoft::Samples::Ink::Cs::InkZoom::InkZoom
Public Member Functions | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes

Microsoft::Samples::Ink::Cs::InkZoom::InkZoom Class Reference

The InkZoom Sample Application form class. More...

List of all members.

Public Member Functions

InkZoom ()
void | ZoomToRectangle ()

Protected Member Functions

override void | Dispose (bool disposing)

Private Member Functions

void | hScrollBar_Scroll (object sender, System.Windows.Forms.ScrollEventArgs e)
void | hScrollBar_ValueChanged (object sender, System.EventArgs e)
void | InitializeComponent ()
void | InkZoom_Load (object sender, System.EventArgs e)
void | InkZoom_Resize (object sender, System.EventArgs e)
void | miClear_Click (object sender, System.EventArgs e)
void | miExit_Click (object sender, System.EventArgs e)
void | miInk_Click (object sender, System.EventArgs e)
void | miScalePenWidth_Click (object sender, System.EventArgs e)
void | miZoomToRect_Click (object sender, System.EventArgs e)
void | pnlDrawingArea_MouseDown (object sender, System.Windows.Forms.MouseEventArgs e)
void | pnlDrawingArea_MouseMove (object sender, System.Windows.Forms.MouseEventArgs e)
void | pnlDrawingArea_MouseUp (object sender, System.Windows.Forms.MouseEventArgs e)
void | UpdateScrollBars ()
void | UpdateZoomAndScroll ()
void | vScrollBar_Scroll (object sender, System.Windows.Forms.ScrollEventArgs e)
void | vScrollBar_ValueChanged (object sender, System.EventArgs e)
void | xZoomUpDown_ValueChanged (object sender, System.EventArgs e)

Static Private Member Functions

static void | Main ()

Private Attributes

Pen | blackPen = null
System.ComponentModel.Container | components = null
System.Windows.Forms.HScrollBar | hScrollBar
const int | InkSpaceHeight = 50000
const int | InkSpaceWidth = 50000
System.Windows.Forms.Label | lblZoom
const float | MediumInkWidth = 100
System.Windows.Forms.MenuItem | miActionSeparator
System.Windows.Forms.MenuItem | miClear
System.Windows.Forms.MenuItem | miExit
System.Windows.Forms.MenuItem | miFile
System.Windows.Forms.MenuItem | miInk
System.Windows.Forms.MainMenu | miMain
System.Windows.Forms.MenuItem | miModeSepararator
System.Windows.Forms.MenuItem | miOther
System.Windows.Forms.MenuItem | miScalePenWidth
System.Windows.Forms.MenuItem | miZoomToRect
InkCollector | myInkCollector = null
System.Windows.Forms.Panel | pnlDrawingArea
System.Windows.Forms.Panel | pnlZoom
const int | SmallChangeSize = 2
System.Windows.Forms.VScrollBar | vScrollBar
float | zoomFactor = 1
Rectangle | zoomRectangle = Rectangle.Empty
System.Windows.Forms.ToolBar | zoomToolBar
System.Windows.Forms.NumericUpDown | zoomUpDown

Detailed Description

Definition at line 49 of file InkZoom.cs.

Constructor & Destructor Documentation

Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::InkZoom ( ) [inline]

The InkZoom Sample Application form class.

Definition at line 99 of file InkZoom.cs.

    {

            #region Standard Template Code
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            #endregion
        }

Member Function Documentation

override void Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::Dispose ( bool disposing ) [inline, protected]

Clean up any resources being used.

Definition at line 114 of file InkZoom.cs.

    {
      if( disposing )
      {
        if (components != null)
        {
          components.Dispose();
        }
      }
      base.Dispose( disposing );
    }

void Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::hScrollBar_Scroll | ( | object | sender,
 |  | System.Windows.Forms.ScrollEventArgs | e |
 | ) |  |  | [inline, private]

Event Handle from Horizontal Scroll Event.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 402 of file InkZoom.cs.

        {
            // Apply the new zoom/scroll settings
            UpdateZoomAndScroll();
        }

void Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::hScrollBar_ValueChanged | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handle from Horizontal Scroll Value Changed Event.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 424 of file InkZoom.cs.

        {
            // Apply the new zoom/scroll settings
            UpdateZoomAndScroll();
        }

void Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::InitializeComponent ( ) [inline, private]

Required method for Designer support - do not modify the contents of this method with the code editor.

Definition at line 132 of file InkZoom.cs.

    {
            this.hScrollBar = new System.Windows.Forms.HScrollBar();
            this.vScrollBar = new System.Windows.Forms.VScrollBar();
            this.miMain = new System.Windows.Forms.MainMenu();
            this.miFile = new System.Windows.Forms.MenuItem();
            this.miClear = new System.Windows.Forms.MenuItem();
            this.miActionSeparator = new System.Windows.Forms.MenuItem();
            this.miExit = new System.Windows.Forms.MenuItem();
            this.miOther = new System.Windows.Forms.MenuItem();
            this.miInk = new System.Windows.Forms.MenuItem();
            this.miZoomToRect = new System.Windows.Forms.MenuItem();
            this.miModeSepararator = new System.Windows.Forms.MenuItem();
            this.miScalePenWidth = new System.Windows.Forms.MenuItem();
            this.pnlZoom = new System.Windows.Forms.Panel();
            this.lblZoom = new System.Windows.Forms.Label();
            this.zoomUpDown = new System.Windows.Forms.NumericUpDown();
            this.zoomToolBar = new System.Windows.Forms.ToolBar();
            this.pnlDrawingArea = new System.Windows.Forms.Panel();
            this.pnlZoom.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.zoomUpDown)).BeginInit();
            this.SuspendLayout();
            //
            // hScrollBar
            //
            this.hScrollBar.Anchor = ((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
                | System.Windows.Forms.AnchorStyles.Right);
            this.hScrollBar.LargeChange = 100;
            this.hScrollBar.Location = new System.Drawing.Point(0, 279);
            this.hScrollBar.Maximum = 1000;
            this.hScrollBar.Name = "hScrollBar";
            this.hScrollBar.Size = new System.Drawing.Size(275, 17);
            this.hScrollBar.TabIndex = 0;
            this.hScrollBar.ValueChanged += new System.EventHandler(this.hScrollBar_ValueChanged);
            this.hScrollBar.Scroll += new System.Windows.Forms.ScrollEventHandler(this.hScrollBar_Scroll);
            //
            // vScrollBar
            //
            this.vScrollBar.Anchor = ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                | System.Windows.Forms.AnchorStyles.Right);
            this.vScrollBar.LargeChange = 100;
            this.vScrollBar.Location = new System.Drawing.Point(275, 26);
            this.vScrollBar.Maximum = 1000;
            this.vScrollBar.Name = "vScrollBar";
            this.vScrollBar.Size = new System.Drawing.Size(17, 254);
            this.vScrollBar.TabIndex = 1;
            this.vScrollBar.ValueChanged += new System.EventHandler(this.vScrollBar_ValueChanged);
            this.vScrollBar.Scroll += new System.Windows.Forms.ScrollEventHandler(this.vScrollBar_Scroll);
            //
            // miMain
            //
            this.miMain.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                                this.miFile,
                                                                                this.miOther});
            //
            // miFile
            //
            this.miFile.Index = 0;
            this.miFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                                this.miClear,
                                                                                this.miActionSeparator,
                                                                                this.miExit});
            this.miFile.Text = "&Action";
            //
            // miClear
            //
            this.miClear.Index = 0;
            this.miClear.Text = "&Clear";
            this.miClear.Click += new System.EventHandler(this.miClear_Click);
            //
            // miActionSeparator
            //
            this.miActionSeparator.Index = 1;
            this.miActionSeparator.Text = "-";
            //
            // miExit
            //
            this.miExit.Index = 2;
            this.miExit.Text = "E&xit";
            this.miExit.Click += new System.EventHandler(this.miExit_Click);
            //
            // miOther
            //
            this.miOther.Index = 1;
            this.miOther.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                                this.miInk,
                                                                                this.miZoomToRect,
                                                                                this.miModeSepararator,
                                                                                this.miScalePenWidth});
            this.miOther.Text = "&Mode";
            //
            // miInk
            //
            this.miInk.Checked = true;
            this.miInk.Index = 0;
            this.miInk.RadioCheck = true;
            this.miInk.Text = "&Ink";
            this.miInk.Click += new System.EventHandler(this.miInk_Click);
            //
            // miZoomToRect
            //
            this.miZoomToRect.Index = 1;
            this.miZoomToRect.RadioCheck = true;
            this.miZoomToRect.Text = "&Zoom To Rect";
            this.miZoomToRect.Click += new System.EventHandler(this.miZoomToRect_Click);
            //
            // miModeSepararator
            //
            this.miModeSepararator.Index = 2;
            this.miModeSepararator.Text = "-";
            //
            // miScalePenWidth
            //
            this.miScalePenWidth.Checked = true;
            this.miScalePenWidth.Index = 3;
            this.miScalePenWidth.Text = "&Scale Pen Width";
            this.miScalePenWidth.Click += new System.EventHandler(this.miScalePenWidth_Click);
            //
            // pnlZoom
            //
            this.pnlZoom.Anchor = ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                | System.Windows.Forms.AnchorStyles.Right);
            this.pnlZoom.BackColor = System.Drawing.SystemColors.Control;
            this.pnlZoom.Controls.AddRange(new System.Windows.Forms.Control[] {
                                                                                this.lblZoom,
                                                                                this.zoomUpDown,
                                                                                this.zoomToolBar});
            this.pnlZoom.ForeColor = System.Drawing.SystemColors.ControlText;
            this.pnlZoom.Name = "pnlZoom";
            this.pnlZoom.Size = new System.Drawing.Size(292, 26);
            this.pnlZoom.TabIndex = 3;
            //
            // lblZoom
            //
            this.lblZoom.Location = new System.Drawing.Point(8, 7);
            this.lblZoom.Name = "lblZoom";
            this.lblZoom.Size = new System.Drawing.Size(56, 16);
            this.lblZoom.TabIndex = 3;
            this.lblZoom.Text = "Zoom %:";
            //
            // zoomUpDown
            //
            this.zoomUpDown.Location = new System.Drawing.Point(64, 3);
            this.zoomUpDown.Maximum = new System.Decimal(new int[] {
                                                                       5000,
                                                                       0,
                                                                       0,
                                                                       0});
            this.zoomUpDown.Minimum = new System.Decimal(new int[] {
                                                                       10,
                                                                       0,
                                                                       0,
                                                                       0});
            this.zoomUpDown.Name = "zoomUpDown";
            this.zoomUpDown.Size = new System.Drawing.Size(56, 20);
            this.zoomUpDown.TabIndex = 2;
            this.zoomUpDown.Value = new System.Decimal(new int[] {
                                                                     100,
                                                                     0,
                                                                     0,
                                                                     0});
            this.zoomUpDown.ValueChanged += new System.EventHandler(this.xZoomUpDown_ValueChanged);
            //
            // zoomToolBar
            //
            this.zoomToolBar.DropDownArrows = true;
            this.zoomToolBar.Name = "zoomToolBar";
            this.zoomToolBar.ShowToolTips = true;
            this.zoomToolBar.Size = new System.Drawing.Size(292, 39);
            this.zoomToolBar.TabIndex = 4;
            //
            // pnlDrawingArea
            //
            this.pnlDrawingArea.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                | System.Windows.Forms.AnchorStyles.Left)
                | System.Windows.Forms.AnchorStyles.Right);
            this.pnlDrawingArea.BackColor = System.Drawing.Color.White;
            this.pnlDrawingArea.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
            this.pnlDrawingArea.Location = new System.Drawing.Point(0, 26);
            this.pnlDrawingArea.Name = "pnlDrawingArea";
            this.pnlDrawingArea.Size = new System.Drawing.Size(275, 254);
            this.pnlDrawingArea.TabIndex = 4;
            this.pnlDrawingArea.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pnlDrawingArea_MouseUp);
            this.pnlDrawingArea.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pnlDrawingArea_MouseMove);
            this.pnlDrawingArea.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pnlDrawingArea_MouseDown);
            //
            // InkZoom
            //
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize = new System.Drawing.Size(292, 296);
            this.Controls.AddRange(new System.Windows.Forms.Control[] {
                                                                          this.pnlDrawingArea,
                                                                          this.pnlZoom,
                                                                          this.vScrollBar,
                                                                          this.hScrollBar});
            this.Menu = this.miMain;
            this.Name = "InkZoom";
            this.Text = "InkZoom";
            this.Resize += new System.EventHandler(this.InkZoom_Resize);
            this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pnlDrawingArea_MouseDown);
            this.Load += new System.EventHandler(this.InkZoom_Load);
            this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pnlDrawingArea_MouseUp);
            this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pnlDrawingArea_MouseMove);
            this.pnlZoom.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.zoomUpDown)).EndInit();
            this.ResumeLayout(false);

        }

void Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::InkZoom_Load | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handle from form Load Event.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 358 of file InkZoom.cs.

        {
            // Create the pen used to draw the zoom rectangle
            blackPen = new Pen(Color.Black, 1);

            // Create the ink collector and associate it with the form
            myInkCollector = new InkCollector(pnlDrawingArea.Handle);

            // Set the pen width
            myInkCollector.DefaultDrawingAttributes.Width = MediumInkWidth;

            // Enable ink collection
            myInkCollector.Enabled = true;

            // Define ink space size - note that the scroll bars
            // map directly to ink space
            hScrollBar.Minimum = 0;
            hScrollBar.Maximum = InkSpaceWidth;
            vScrollBar.Minimum = 0;
            vScrollBar.Maximum = InkSpaceHeight;

            // Set the scroll bars to map to the current zoom level
            UpdateZoomAndScroll();
        }

void Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::InkZoom_Resize | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handle from form's Resize Event.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 556 of file InkZoom.cs.

        {
            // If the user resizes the window, update the scroll
            // bars to reflect the change.  However, it is necessary
            // to check whether the ink collector is null before
            // invoking this method since the Resize event also occurs
            // automatically before the ink collector is created.
            if (myInkCollector!=null)
            {
                UpdateScrollBars();
            }
        }

static void Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::Main ( ) [inline, static, private]

The main entry point for the application.

Definition at line 347 of file InkZoom.cs.

    {
      Application.Run(new InkZoom());
    }

void Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::miClear_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handle from Clear Click Event.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 516 of file InkZoom.cs.

        {
            // Set the zoom level to 100%
            zoomFactor = 1;

            // Set the scroll bars to the top left of the screen
            hScrollBar.Value = 0;
            vScrollBar.Value = 0;

            zoomUpDown.Value = 100;

            // remove all strokes from the ink collector
            myInkCollector.Ink.DeleteStrokes();

            // Apply the new zoom/scroll settings
            UpdateZoomAndScroll();

            // Reset the application mode to inking
            miInk.Checked = true;
            miZoomToRect.Checked = false;
            Cursor = System.Windows.Forms.Cursors.Default;
            myInkCollector.Enabled = true;
        }

void Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::miExit_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handle from File->Exit Click Event.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 545 of file InkZoom.cs.

        {
            myInkCollector.Enabled = false;
            this.Dispose();
        }

void Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::miInk_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handle from Ink Click Event.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 478 of file InkZoom.cs.

        {
            // Update the Mode menu to be in ink mode
            miInk.Checked = true;
            miZoomToRect.Checked = false;

            // Update the cursor
            // Note that it is necessary to use the full name to avoid a
            // namespace conflict with InkCollector's Cursors property.
            pnlDrawingArea.Cursor = System.Windows.Forms.Cursors.Default;

            // Enable the ink collector
            myInkCollector.Enabled = true;
        }

void Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::miScalePenWidth_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handle from ApplyToPenWidth Click Event.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 446 of file InkZoom.cs.

        {
            // Toggle the value indicating whether to apply the zoom to pen width
            // If on,  use the view transform.  Otherwise, use the object transform.
            miScalePenWidth.Checked = !miScalePenWidth.Checked;

            // Renderer's view and object transforms are used to perform
            // zooming and scrolling.  The view transform applies to the
            // points and pen width.  The object transform  applies
            // only to the points.  Since the sample only uses one of these
            // transforms at a time, it is necessary to clear out the unused
            // transform and then invoke SetViewTransform to apply the
            // zoom/scroll settings on the view or object transform
            // (depending if pen width scaling is desired).
            if (miScalePenWidth.Checked)
            {
                myInkCollector.Renderer.SetObjectTransform(null);
            }
            else
            {
                myInkCollector.Renderer.SetViewTransform(null);
            }

            // Apply the new zoom/scroll settings
            UpdateZoomAndScroll();
        }

void Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::miZoomToRect_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handle from ZoomToRect Click Event.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 498 of file InkZoom.cs.

        {
            // Update the Mode menu to be in zoom to rect mode
            miInk.Checked = false;
            miZoomToRect.Checked = true;

            // Update the cursor
            pnlDrawingArea.Cursor = System.Windows.Forms.Cursors.Cross;

            // Disable the ink collector
            myInkCollector.Enabled = false;
        }

void Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::pnlDrawingArea_MouseDown | ( | object | sender,
 |  | System.Windows.Forms.MouseEventArgs | e |
 | ) |  |  | [inline, private]

Event Handle from MouseDown Event.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 574 of file InkZoom.cs.

        {
            // If the user has selected to draw a zoom rectangle, update
            // the zoom rectangle's start point to the mouse location.
            if (miZoomToRect.Checked)
            {
                zoomRectangle.Location = new Point(e.X,e.Y);
                zoomRectangle.Width = 0;
                zoomRectangle.Height = 0;
            }
        }

void Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::pnlDrawingArea_MouseMove | ( | object | sender,
 |  | System.Windows.Forms.MouseEventArgs | e |
 | ) |  |  | [inline, private]

Event Handle from MouseMove event.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 591 of file InkZoom.cs.

        {
            // If the user has selected to draw a zoom rectangle and has a mouse
            // button pressed down, update the zoom rectangle end point to the
            // new mouse location.
            if ( (miZoomToRect.Checked) &&  (MouseButtons != MouseButtons.None) )
            {
                // Erase the previous zoom rectangle
                Rectangle screenRect = zoomRectangle;
                screenRect.Offset(pnlDrawingArea.PointToScreen(Point.Empty));
                ControlPaint.DrawReversibleFrame(screenRect,Color.Transparent,FrameStyle.Dashed);

                int xSize = e.X - zoomRectangle.Location.X;
                int ySize = e.Y - zoomRectangle.Location.Y;

                int zoomRectSize = Math.Max(Math.Abs(xSize),Math.Abs(ySize));

                zoomRectangle.Width = (xSize>0)?zoomRectSize:-zoomRectSize;
                zoomRectangle.Height = (ySize>0)?zoomRectSize:-zoomRectSize;

                // Draw the current zoom rectangle
                screenRect = zoomRectangle;
                screenRect.Offset(pnlDrawingArea.PointToScreen(Point.Empty));
                ControlPaint.DrawReversibleFrame(screenRect,Color.Transparent,FrameStyle.Dashed);
            }
        }

void Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::pnlDrawingArea_MouseUp | ( | object | sender,
 |  | System.Windows.Forms.MouseEventArgs | e |
 | ) |  |  | [inline, private]

Event Handle from MouseUp Event.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 623 of file InkZoom.cs.

        {
            // If the user has selected to draw a zoom rectangle...
            if (miZoomToRect.Checked)
            {
                // Erase the zoom rectangle
                Rectangle screenRect = zoomRectangle;
                screenRect.Offset(pnlDrawingArea.PointToScreen(Point.Empty));
                ControlPaint.DrawReversibleFrame(screenRect,Color.Transparent,FrameStyle.Dashed);

                // Perform the zoom
                ZoomToRectangle();
            }
        }

void Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::UpdateScrollBars ( ) [inline, private]

Helper method to update the scroll bars small and large change values to the new zoom level.

If the scroll bars are no longer needed, this method will also hide them.

Definition at line 681 of file InkZoom.cs.

        {
            if ( (hScrollBar.Width>0) && (vScrollBar.Height>0))
            {
                // The following code sets the small and large change
                // values of the scroll bars.  These values specify
                // desired scroll size when the scroll box is moved a
                // small/large distance.  In this sample, the large
                // change scrolls by the width of the visible drawing
                // area and the small change scrolls by the constant
                // SmallChangeSize.  Note that it is necessary to account
                // for the zoom factor when calculating the large and
                // small change values.  Also, since the scroll bar
                // uses ink space units, it is necessary to calculate
                // the small and large change values in ink space.
                //
                // In summary:
                // 1.  Calculate the large change value as the width
                //     of the visible drawing area in ink space units.
                // 2.  Calculate the small change value as the
                //     SmallChangeSize in ink space units.

                // Create a point representing the top left of the drawing area (in pixels)
                Point ptUpperLeft = new Point(0, 0);

                // Create a point representing the size of a small change
                Point ptSmallChange = new Point(SmallChangeSize, SmallChangeSize);

                // Create a point representing the bottom right of the drawing area (in pixels)
                Point ptLowerRight = new Point(hScrollBar.Width, vScrollBar.Height);

                // Convert each of the points to ink space
                myInkCollector.Renderer.PixelToInkSpace(Handle, ref ptUpperLeft);
                myInkCollector.Renderer.PixelToInkSpace(Handle, ref ptLowerRight);
                myInkCollector.Renderer.PixelToInkSpace(Handle, ref ptSmallChange);

                // Set the SmallChange values (in ink space)
                // Note that it is necessary to subract the upper left point
                // value to account for scrolling.
                hScrollBar.SmallChange = ptSmallChange.X - ptUpperLeft.X;
                vScrollBar.SmallChange = ptSmallChange.Y - ptUpperLeft.Y;

                // Set the LargeChange values to the drawing area width (in ink space)
                // Note that it is necessary to subract the upper left point
                // value to account for scrolling.
                hScrollBar.LargeChange = ptLowerRight.X - ptUpperLeft.X;
                vScrollBar.LargeChange = ptLowerRight.Y - ptUpperLeft.Y;

                // If the scroll bars are not needed, hide them
                hScrollBar.Visible = hScrollBar.LargeChange < hScrollBar.Maximum;
                vScrollBar.Visible = vScrollBar.LargeChange < vScrollBar.Maximum;

                // If the horizontal scroll bar value would run off of the drawing area,
                // adjust it
                if(hScrollBar.Visible && (hScrollBar.Value + hScrollBar.LargeChange > hScrollBar.Maximum))
                {
                    hScrollBar.Value = hScrollBar.Maximum - hScrollBar.LargeChange;
                }

                // If the vertical scroll bar value would run off of the drawing area,
                // adjust it
                if(vScrollBar.Visible && (vScrollBar.Value + vScrollBar.LargeChange > vScrollBar.Maximum))
                {
                    vScrollBar.Value = vScrollBar.Maximum - vScrollBar.LargeChange;
                }
            }
        }

void Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::UpdateZoomAndScroll ( ) [inline, private]

Helper method to update the ink collector with the current zoom and scroll values.

Definition at line 642 of file InkZoom.cs.

        {
            // Create a new transformation matrix
            Matrix m = new Matrix();

            // Apply the current scale factor
            m.Scale(zoomFactor,zoomFactor);

            // Apply the current translation factor - note that since
            // the scroll bars map directly to ink space, their values
            // can be used directly.
            m.Translate(-hScrollBar.Value, -vScrollBar.Value);

            // Renderer's view and object transforms are used to perform
            // zooming and scrolling.  The view transform applies to the
            // points and pen width.  The object transform  applies
            // only to the points.  Depending on whether the user has
            // selected to apply the transform to pen width, update the
            // view or object transform.
            if (miScalePenWidth.Checked)
            {
                myInkCollector.Renderer.SetViewTransform(m);
            }
            else
            {
                myInkCollector.Renderer.SetObjectTransform(m);
            }

            // Set the scroll bars to map to the current zoom level
            UpdateScrollBars();

            Refresh();
        }

void Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::vScrollBar_Scroll | ( | object | sender,
 |  | System.Windows.Forms.ScrollEventArgs | e |
 | ) |  |  | [inline, private]

Event Handle from Vertical Scroll Event.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 413 of file InkZoom.cs.

        {
            // Apply the new zoom/scroll settings
            UpdateZoomAndScroll();
        }

void Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::vScrollBar_ValueChanged | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handle form Vertical Scroll Value Changed Event.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 435 of file InkZoom.cs.

        {
            // Apply the new zoom/scroll settings
            UpdateZoomAndScroll();
        }

void Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::xZoomUpDown_ValueChanged | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handle from xZoomUpDown Click Event.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 388 of file InkZoom.cs.

        {
            // Update the zoom factor to the new value
            zoomFactor = (float)zoomUpDown.Value/100;

            // Apply the new zoom/scroll settings
            UpdateZoomAndScroll();
        }

void Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::ZoomToRectangle ( ) [inline]

Helper method to zoom into a specified rectangle.

Definition at line 753 of file InkZoom.cs.

        {

            // Calculate the width/height of the zoom rectangle
            int newWidth = Math.Abs(zoomRectangle.Width);
            int newHeight = Math.Abs(zoomRectangle.Height);

            // Check to ensure that the zoom rectangle isn't just a point...
            if (newWidth>0 && newHeight>0)
            {

                // To determine the new scale factor, take the ratio of the
                // scaled drawing area to the size of the zoom rectangle.
                // Since the ratio of the width could be different than
                // the ratio of the height, the minimum scale value is used.
                float newZoomFactor = Math.Min((zoomFactor*pnlDrawingArea.Width)/newWidth,
                                          (zoomFactor*pnlDrawingArea.Height)/newHeight);

                // Check whether the zoom rectangle would exceed the allowable
                // zoom level.  If so, display an error.
                if ((int)(newZoomFactor*100) < zoomUpDown.Minimum)
                {
                    MessageBox.Show("Minimum zoom level reached.");
                }
                else if ((int)(newZoomFactor*100) > zoomUpDown.Maximum)
                {
                    MessageBox.Show("Maximum zoom level reached.");
                }
                else
                {

                    // Set the scroll bar values to the zoom rectangle's top left corner
                    // Note that it is necessary to convert to ink space since the scroll
                    // bars use ink space coordinates.
                    Point scrollValue = new Point();
                    scrollValue.X = Math.Min(zoomRectangle.Left,zoomRectangle.Left + zoomRectangle.Width);
                    scrollValue.Y = Math.Min(zoomRectangle.Top,zoomRectangle.Top + zoomRectangle.Height);
                    myInkCollector.Renderer.PixelToInkSpace(Handle,ref scrollValue);

                    // If the new scroll bar values would fall outside of the
                    // allowable range, adjust them to the nearest allowable
                    // value.
                    if (scrollValue.X > hScrollBar.Maximum)
                    {
                        scrollValue.X = hScrollBar.Maximum;
                    }
                    else if (scrollValue.X < hScrollBar.Minimum)
                    {
                        scrollValue.X = hScrollBar.Minimum;
                    }

                    if (scrollValue.Y > vScrollBar.Maximum)
                    {
                        scrollValue.Y = vScrollBar.Maximum;
                    }
                    else if (scrollValue.Y < vScrollBar.Minimum)
                    {
                        scrollValue.Y = vScrollBar.Minimum;
                    }

                    // Update the new scale factor to the ratio of the scroll bar
                    // to the zoom rectangle's width
                    zoomFactor = newZoomFactor;
                    zoomUpDown.Value = (decimal)zoomFactor*100;

                    // Apply the new zoom/scroll settings
                    UpdateZoomAndScroll();

                    // Update the scroll bar values.
                    hScrollBar.Value = scrollValue.X;
                    vScrollBar.Value = scrollValue.Y;

                }
            }

            // Reset the zoom rectangle
            zoomRectangle = Rectangle.Empty;

            Refresh();
        }

Member Data Documentation

Pen Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::blackPen = null [private]

Definition at line 56 of file InkZoom.cs.

System.ComponentModel.Container Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::components = null [private]

Definition at line 93 of file InkZoom.cs.

System.Windows.Forms.HScrollBar Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::hScrollBar [private]

Definition at line 76 of file InkZoom.cs.

const int Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::InkSpaceHeight = 50000 [private]

Definition at line 67 of file InkZoom.cs.

const int Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::InkSpaceWidth = 50000 [private]

Definition at line 66 of file InkZoom.cs.

System.Windows.Forms.Label Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::lblZoom [private]

Definition at line 83 of file InkZoom.cs.

const float Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::MediumInkWidth = 100 [private]

Definition at line 73 of file InkZoom.cs.

System.Windows.Forms.MenuItem Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::miActionSeparator [private]

Definition at line 89 of file InkZoom.cs.

System.Windows.Forms.MenuItem Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::miClear [private]

Definition at line 91 of file InkZoom.cs.

System.Windows.Forms.MenuItem Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::miExit [private]

Definition at line 82 of file InkZoom.cs.

System.Windows.Forms.MenuItem Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::miFile [private]

Definition at line 81 of file InkZoom.cs.

System.Windows.Forms.MenuItem Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::miInk [private]

Definition at line 87 of file InkZoom.cs.

System.Windows.Forms.MainMenu Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::miMain [private]

Definition at line 88 of file InkZoom.cs.

System.Windows.Forms.MenuItem Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::miModeSepararator [private]

Definition at line 90 of file InkZoom.cs.

System.Windows.Forms.MenuItem Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::miOther [private]

Definition at line 78 of file InkZoom.cs.

System.Windows.Forms.MenuItem Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::miScalePenWidth [private]

Definition at line 86 of file InkZoom.cs.

System.Windows.Forms.MenuItem Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::miZoomToRect [private]

Definition at line 79 of file InkZoom.cs.

InkCollector Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::myInkCollector = null [private]

Definition at line 53 of file InkZoom.cs.

System.Windows.Forms.Panel Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::pnlDrawingArea [private]

Definition at line 80 of file InkZoom.cs.

System.Windows.Forms.Panel Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::pnlZoom [private]

Definition at line 85 of file InkZoom.cs.

const int Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::SmallChangeSize = 2 [private]

Definition at line 70 of file InkZoom.cs.

System.Windows.Forms.VScrollBar Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::vScrollBar [private]

Definition at line 77 of file InkZoom.cs.

float Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::zoomFactor = 1 [private]

Definition at line 62 of file InkZoom.cs.

Rectangle Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::zoomRectangle = Rectangle.Empty [private]

Definition at line 59 of file InkZoom.cs.

System.Windows.Forms.ToolBar Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::zoomToolBar [private]

Definition at line 92 of file InkZoom.cs.

System.Windows.Forms.NumericUpDown Microsoft::Samples::Ink::Cs::InkZoom::InkZoom::zoomUpDown [private]

Definition at line 84 of file InkZoom.cs.

The documentation for this class was generated from the following file:
  • TabletPC/InkZoom/C#/InkZoom.cs
Generated on Wed Nov 13 2024 16:58:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Microsoft::Uddi::Demo::Publish Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • Microsoft
  • Uddi
  • Demo
  • Microsoft::Uddi::Demo::Publish
Static Public Member Functions | Static Private Member Functions | Static Private Attributes

Microsoft::Uddi::Demo::Publish Class Reference

List of all members.

Static Public Member Functions

static void | Main ()

Static Private Member Functions

static BusinessService | AddService (BusinessEntity entity, string name, string desc)
static void | DisplayOwnedEntities ()
static void | DisplayTaxonomy (string key)
static void | DisplayTaxonomyItems (string key, string value, int tabs)
static UddiSiteLocation | GetFirstLocation (AuthenticationMode mode)
static BusinessEntity | SaveNewProvider (string name, string desc)

Static Private Attributes

static UddiConnection | _connection

Detailed Description

Definition at line 25 of file publish.cs.

Member Function Documentation

static BusinessService Microsoft::Uddi::Demo::Publish::AddService | ( | BusinessEntity | entity,
 |  | string | name,
 |  | string | desc |
 | ) |  |  | [inline, static, private]

Create a service, and save it using the provided BusinessEntity, name, and description.

Parameters:
entity | The BusinessEntity that will own this BusinessService.
name | The name for the new BusinessService.
desc | The description for the new BusinessService.
Returns:
The resulting BusinessService after the save.

Definition at line 166 of file publish.cs.

    {
      BusinessService service = new BusinessService();
      service.BusinessKey = entity.BusinessKey;
      service.Names.Add( name );
      service.Descriptions.Add( desc );

      SaveService ss = new SaveService( service );
      ServiceDetail detail = ss.Send( _connection );

      return detail.BusinessServices[ 0 ];
    }

static void Microsoft::Uddi::Demo::Publish::DisplayOwnedEntities ( ) [inline, static, private]

Writes information about the current publishers owned data to STDOUT.

Definition at line 118 of file publish.cs.

    {
      GetRegisteredInfo gri = new GetRegisteredInfo();
      RegisteredInfo ri = gri.Send( _connection );

      foreach( BusinessInfo binfo in ri.BusinessInfos )
      {
        Console.WriteLine( "Business Entity" );
        Console.WriteLine( "\tName: " + binfo.Names[ 0 ].Text );
        Console.WriteLine( "\tBusinessKey: " + binfo.BusinessKey );
        Console.WriteLine( "\tServiceCount: " + binfo.ServiceInfos.Count );
      }
      foreach( TModelInfo tinfo in ri.TModelInfos )
      {
        Console.WriteLine( "Business Entity" );
        Console.WriteLine( "\tName: " + tinfo.Name.Text );
        Console.WriteLine( "\tTModelKey: " + tinfo.TModelKey );
      }

    }

static void Microsoft::Uddi::Demo::Publish::DisplayTaxonomy ( string key ) [inline, static, private]

Displays the Taxonomy information for a specified TModelKey.

Parameters:
key TModelKey to perferm the Categorization lookup on.

Definition at line 183 of file publish.cs.

    {
      Category cat = new Category( key );
      cat.RelationshipQualifiers.Add( RelationshipQualifier.root );

      GetRelatedCategories grc = new GetRelatedCategories();

      grc.Categories.Add( cat );

      CategoryList list = grc.Send( _connection );

      foreach( CategoryInfo info in list.CategoryInfos )
      {
        Console.WriteLine( info.TModelKey );
        foreach( CategoryValue cv in info.Roots )
        {
          Console.WriteLine( "\t" + cv.KeyName + "(" + cv.KeyValue + ")" );
          DisplayTaxonomyItems( info.TModelKey, cv.KeyValue, 2 );
        }
      }
    }

static void Microsoft::Uddi::Demo::Publish::DisplayTaxonomyItems | ( | string | key,
 |  | string | value,
 |  | int | tabs |
 | ) |  |  | [inline, static, private]

Displays the Taxonomy information for a specified TModelKey, begining at a specified KeyValue.

Parameters:
key | TModelKey for the the Taxonomy
value | KeyValue to start from.
tabs | Number or characters to prepend to the Output.

Definition at line 212 of file publish.cs.

    {
      string line = "";
      for( int i = 0;i<tabs;i++ )
        line += "\t";

      Category cat = new Category( key, value );
      cat.RelationshipQualifiers.Add( RelationshipQualifier.child );

      GetRelatedCategories grc = new GetRelatedCategories();

      grc.Categories.Add( cat );

      CategoryList list = grc.Send( _connection );

      foreach( CategoryInfo info in list.CategoryInfos )
      {
        foreach( CategoryValue cv in info.Children )
        {
          Console.WriteLine( line + cv.KeyName + "(" + cv.KeyValue + ")" );
          DisplayTaxonomyItems( key, cv.KeyValue, tabs + 1 );
        }
      }
    }

static UddiSiteLocation Microsoft::Uddi::Demo::Publish::GetFirstLocation ( AuthenticationMode mode ) [inline, static, private]

Searches Active Directory for Uddi Sites, using the specified Authentication Mode as criteria for the search.

Parameters:
mode The authentication mode you would like to query for.
Returns:
The first UddiSiteLocation registered with Active Directory.

Definition at line 105 of file publish.cs.

    {
      UddiSiteLocation[] locations = UddiSiteDiscovery.Find( UddiSiteUrlType.All, mode );
      if( locations.Length > 0 )
        return locations[ 0 ];
      else
        return null;

    }

static void Microsoft::Uddi::Demo::Publish::Main ( ) [inline, static]

Entry Point.

Definition at line 32 of file publish.cs.

    {

      //
      // Attempt to find the first site listed in Active Directory
      //
      UddiSiteLocation location = GetFirstLocation( AuthenticationMode.WindowsAuthentication );

      //
      // Create a location if no location was returned from Active Directory
      // These settings use the default access points for UDDI Services and Windows Authentication
      // TODO: Update with actual servername
      //

      string httpServerName = "http://servername/uddi/";
      string httpsServerName = "https://servername/uddi/";

      if( null == location )
      {
        location = new UddiSiteLocation(
          httpServerName + "inquire.asmx",
          httpsServerName + "publish.asmx",
          httpServerName + "extension.asmx",
          "My Site",
          AuthenticationMode.WindowsAuthentication );
      }

      //
      // Create the connection object.
      //
      _connection = new UddiConnection( location );

      Console.WriteLine( "Current Data" );

      //
      // Display the current entities owned by this publisher
      //
      DisplayOwnedEntities();

      Console.WriteLine( "Saving New Data" );

      //
      // Create a new Provider.
      //
      BusinessEntity entity = SaveNewProvider( "My New Provider Name", "Description of my new Provider" );

      //
      // Add a new Service to that provider
      //
      AddService( entity, "My New Service", "Description for my new Service" );

      Console.WriteLine( "New Data" );

      //
      // Display the currently owned entities again.
      //
      DisplayOwnedEntities();

      Console.WriteLine( "Taxonomy Data" );

      //
      // Display the taxonomy information for UddiOrgTypes.
      //
      DisplayTaxonomy( CommonCanonical.UddiOrgTypes );
    }

static BusinessEntity Microsoft::Uddi::Demo::Publish::SaveNewProvider | ( | string | name,
 |  | string | desc |
 | ) |  |  | [inline, static, private]

Saves a new BusinessEntity object with the specified name and description.

Parameters:
name | Name for the new BusinessEntity.
desc | Description for the new BusinessEntity.
Returns:
The Resulting BusinessEntity after saving it.

Definition at line 146 of file publish.cs.

    {
      BusinessEntity entity = new BusinessEntity();
      entity.Names.Add( name );
      entity.Descriptions.Add( desc );

      SaveBusiness sb = new SaveBusiness( entity );
      BusinessDetail detail = sb.Send( _connection );

      return detail.BusinessEntities[ 0 ];
    }

Member Data Documentation

UddiConnection Microsoft::Uddi::Demo::Publish::_connection [static, private]

Definition at line 27 of file publish.cs.

The documentation for this class was generated from the following file:
  • UDDI/publish/publish.cs
Generated on Wed Nov 13 2024 16:58:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::_ADO Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::_ADO
Public Member Functions | Static Public Attributes

msado15::_ADO Interface Reference

.interface(iid=00000534-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)

Inherits com::ms::com::IUnknown.

Inherited by msado15::_Parameter, msado15::_Record, msado15::Command15, msado15::Connection15, msado15::Field, msado15::Field15, and msado15::Recordset15.

List of all members.

Public Member Functions

msado15.Properties getProperties ()

Static Public Attributes

static final com.ms.com._Guid iid = new com.ms.com._Guid((int)0x534, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)

Detailed Description

Definition at line 20 of file _ADO.java.

Member Function Documentation

msado15.Properties msado15::_ADO::getProperties ( )

.method(vtoffset=4, dispid=500, type=PROPGET, name="Properties", name2="getProperties", addFlagsVtable=4) .parameters([iid=00000504-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implemented in msado15::_Command, msado15::_Connection, msado15::_Parameter, msado15::_Record, msado15::_Recordset, msado15::Command, msado15::Command15, msado15::Connection, msado15::Connection15, msado15::Field, msado15::Field15, msado15::Parameter, msado15::Record, msado15::Recordset, msado15::Recordset15, msado15::Recordset20, and msado15::Recordset21.

Member Data Documentation

final com.ms.com._Guid msado15::_ADO::iid = new com.ms.com._Guid((int)0x534, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Implemented in msado15::_Command, msado15::_Connection, msado15::_Parameter, msado15::_Record, msado15::_Recordset, msado15::Command, msado15::Command15, msado15::Connection, msado15::Connection15, msado15::Field, msado15::Field15, msado15::Parameter, msado15::Record, msado15::Recordset, msado15::Recordset15, msado15::Recordset20, and msado15::Recordset21.

Definition at line 27 of file _ADO.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/_ADO.java
Generated on Wed Nov 13 2024 16:58:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::_Collection Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::_Collection
Public Member Functions | Static Public Attributes

msado15::_Collection Interface Reference

.interface(iid=00000512-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)

Inherits com::ms::com::IUnknown.

Inherited by msado15::_DynaCollection, msado15::Errors, msado15::Fields15, and msado15::Properties.

List of all members.

Public Member Functions

IUnknown | _NewEnum ()
int | getCount ()
void | Refresh ()

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x512, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)

Detailed Description

Definition at line 20 of file _Collection.java.

Member Function Documentation

IUnknown msado15::_Collection::_NewEnum ( )

.method(vtoffset=5, dispid=4294967292, type=METHOD, name="_NewEnum", addFlagsVtable=4) .parameters([iid=00000000-0000-0000-C000-000000000046,thread=AUTO,type=OBJECT] return)

Implemented in msado15::_DynaCollection, msado15::Errors, msado15::Fields, msado15::Fields15, msado15::Fields20, msado15::Parameters, and msado15::Properties.

int msado15::_Collection::getCount ( )

.method(vtoffset=4, dispid=1610743808, type=PROPGET, name="Count", name2="getCount", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in msado15::_DynaCollection, msado15::Errors, msado15::Fields, msado15::Fields15, msado15::Fields20, msado15::Parameters, and msado15::Properties.

void msado15::_Collection::Refresh ( )

.method(vtoffset=6, dispid=1610743810, type=METHOD, name="Refresh", addFlagsVtable=4) .parameters()

Implemented in msado15::_DynaCollection, msado15::Errors, msado15::Fields, msado15::Fields15, msado15::Fields20, msado15::Parameters, and msado15::Properties.

Member Data Documentation

final com.ms.com._Guid msado15::_Collection::iid = new com.ms.com._Guid((int)0x512, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Implemented in msado15::_DynaCollection, msado15::Errors, msado15::Fields, msado15::Fields15, msado15::Fields20, msado15::Parameters, and msado15::Properties.

Definition at line 35 of file _Collection.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/_Collection.java
Generated on Wed Nov 13 2024 16:58:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::_Command Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::_Command
Public Member Functions | Static Public Attributes

msado15::_Command Interface Reference

.interface(iid=0000054E-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)

Inherits msado15::Command15.

Inherited by msado15::Command.

List of all members.

Public Member Functions

void | Cancel ()
msado15._Parameter | CreateParameter (String Name, int Type, int Direction, int Size, Variant Value)
msado15._Recordset | Execute (Variant RecordsAffected, Variant Parameters, int Options)
msado15._Connection getActiveConnection ()
String | getCommandText ()
int | getCommandTimeout ()
int | getCommandType ()
String | getName ()
msado15.Parameters getParameters ()
boolean | getPrepared ()
msado15.Properties getProperties ()
int | getState ()
void | setActiveConnection (Variant ppvObject)
void | setActiveConnection (msado15._Connection ppvObject)
void | setCommandText (String pbstr)
void | setCommandTimeout (int pl)
void | setCommandType (int plCmdType)
void | setName (String pbstrName)
void | setPrepared (boolean pfPrepared)

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x54e, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)

Detailed Description

Definition at line 20 of file _Command.java.

Member Function Documentation

void msado15::_Command::Cancel ( )

.method(vtoffset=22, dispid=1610874881, type=METHOD, name="Cancel", addFlagsVtable=4) .parameters()

Implemented in msado15::Command.

msado15._Parameter msado15::_Command::CreateParameter | ( | String | Name,
 |  | int | Type,
 |  | int | Direction,
 |  | int | Size,
 |  | Variant | Value
 | ) |  |

.method(vtoffset=15, dispid=1610809354, type=METHOD, name="CreateParameter", addFlagsVtable=4) .parameters([in,type=STRING] Name, [in,type=I4] Type, [in,type=I4] Direction, [in,type=I4] Size, [in,type=VARIANT] Value, [iid=0000050C-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::Command15.

Implemented in msado15::Command.

msado15._Recordset msado15::_Command::Execute | ( | Variant | RecordsAffected,
 |  | Variant | Parameters,
 |  | int | Options
 | ) |  |

.method(vtoffset=14, dispid=1610809353, type=METHOD, name="Execute", addFlagsVtable=4) .parameters([out,elementType=VARIANT,type=PTR] RecordsAffected, [in,elementType=VARIANT,type=PTR] Parameters, [in,type=I4] Options, [iid=00000556-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::Command15.

Implemented in msado15::Command.

msado15._Connection msado15::_Command::getActiveConnection ( )

.method(vtoffset=5, dispid=1610809344, type=PROPGET, name="ActiveConnection", name2="getActiveConnection", addFlagsVtable=4) .parameters([iid=00000550-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::Command15.

Implemented in msado15::Command.

String msado15::_Command::getCommandText ( )

.method(vtoffset=8, dispid=1610809347, type=PROPGET, name="CommandText", name2="getCommandText", addFlagsVtable=4) .parameters([type=STRING] return)

Implements msado15::Command15.

Implemented in msado15::Command.

int msado15::_Command::getCommandTimeout ( )

.method(vtoffset=10, dispid=1610809349, type=PROPGET, name="CommandTimeout", name2="getCommandTimeout", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Command15.

Implemented in msado15::Command.

int msado15::_Command::getCommandType ( )

.method(vtoffset=18, dispid=1610809356, type=PROPGET, name="CommandType", name2="getCommandType", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Command15.

Implemented in msado15::Command.

String msado15::_Command::getName ( )

.method(vtoffset=19, dispid=1610809358, type=PROPGET, name="Name", name2="getName", addFlagsVtable=4) .parameters([type=STRING] return)

Implements msado15::Command15.

Implemented in msado15::Command.

msado15.Parameters msado15::_Command::getParameters ( )

.method(vtoffset=16, dispid=0, type=PROPGET, name="Parameters", name2="getParameters", addFlagsVtable=4) .parameters([iid=0000050D-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::Command15.

Implemented in msado15::Command.

boolean msado15::_Command::getPrepared ( )

.method(vtoffset=12, dispid=1610809351, type=PROPGET, name="Prepared", name2="getPrepared", addFlagsVtable=4) .parameters([type=BOOLEAN] return)

Implements msado15::Command15.

Implemented in msado15::Command.

msado15.Properties msado15::_Command::getProperties ( )

.method(vtoffset=4, dispid=500, type=PROPGET, name="Properties", name2="getProperties", addFlagsVtable=4) .parameters([iid=00000504-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::Command15.

Implemented in msado15::Command.

int msado15::_Command::getState ( )

.method(vtoffset=21, dispid=1610874880, type=PROPGET, name="State", name2="getState", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in msado15::Command.

void msado15::_Command::setActiveConnection ( Variant ppvObject )

.method(vtoffset=7, dispid=1610809344, type=PROPPUT, name="ActiveConnection", name2="putActiveConnection", addFlagsVtable=4) .parameters([in,type=VARIANT] ppvObject)

Implements msado15::Command15.

Implemented in msado15::Command.

void msado15::_Command::setActiveConnection ( msado15._Connection ppvObject )

.method(vtoffset=6, dispid=1610809344, type=PROPPUTREF, name="ActiveConnection", name2="putActiveConnection", addFlagsVtable=4) .parameters([in,iid=00000550-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] ppvObject)

Implements msado15::Command15.

Implemented in msado15::Command.

void msado15::_Command::setCommandText ( String pbstr )

.method(vtoffset=9, dispid=1610809347, type=PROPPUT, name="CommandText", name2="putCommandText", addFlagsVtable=4) .parameters([in,type=STRING] pbstr)

Implements msado15::Command15.

Implemented in msado15::Command.

void msado15::_Command::setCommandTimeout ( int pl )

.method(vtoffset=11, dispid=1610809349, type=PROPPUT, name="CommandTimeout", name2="putCommandTimeout", addFlagsVtable=4) .parameters([in,type=I4] pl)

Implements msado15::Command15.

Implemented in msado15::Command.

void msado15::_Command::setCommandType ( int plCmdType )

.method(vtoffset=17, dispid=1610809356, type=PROPPUT, name="CommandType", name2="putCommandType", addFlagsVtable=4) .parameters([in,type=I4] plCmdType)

Implements msado15::Command15.

Implemented in msado15::Command.

void msado15::_Command::setName ( String pbstrName )

.method(vtoffset=20, dispid=1610809358, type=PROPPUT, name="Name", name2="putName", addFlagsVtable=4) .parameters([in,type=STRING] pbstrName)

Implements msado15::Command15.

Implemented in msado15::Command.

void msado15::_Command::setPrepared ( boolean pfPrepared )

.method(vtoffset=13, dispid=1610809351, type=PROPPUT, name="Prepared", name2="putPrepared", addFlagsVtable=4) .parameters([in,type=BOOLEAN] pfPrepared)

Implements msado15::Command15.

Implemented in msado15::Command.

Member Data Documentation

final com.ms.com._Guid msado15::_Command::iid = new com.ms.com._Guid((int)0x54e, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Implements msado15::Command15.

Implemented in msado15::Command.

Definition at line 99 of file _Command.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/_Command.java
Generated on Wed Nov 13 2024 16:58:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::_Connection Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::_Connection
Public Member Functions | Static Public Attributes

msado15::_Connection Interface Reference

.interface(iid=00000550-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)

Inherits msado15::Connection15.

Inherited by msado15::Connection.

List of all members.

Public Member Functions

int | BeginTrans ()
void | Cancel ()
void | Close ()
void | CommitTrans ()
msado15._Recordset | Execute (String CommandText, Variant RecordsAffected, int Options)
int | getAttributes ()
int | getCommandTimeout ()
String | getConnectionString ()
int | getConnectionTimeout ()
int | getCursorLocation ()
String | getDefaultDatabase ()
msado15.Errors getErrors ()
int | getIsolationLevel ()
int | getMode ()
msado15.Properties getProperties ()
String | getProvider ()
int | getState ()
String | getVersion ()
void | Open (String ConnectionString, String UserID, String Password, int Options)
msado15._Recordset | OpenSchema (int Schema, Variant Restrictions, Variant SchemaID)
void | RollbackTrans ()
void | setAttributes (int plAttr)
void | setCommandTimeout (int plTimeout)
void | setConnectionString (String pbstr)
void | setConnectionTimeout (int plTimeout)
void | setCursorLocation (int plCursorLoc)
void | setDefaultDatabase (String pbstr)
void | setIsolationLevel (int Level)
void | setMode (int plMode)
void | setProvider (String pbstr)

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x550, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)

Detailed Description

Definition at line 20 of file _Connection.java.

Member Function Documentation

int msado15::_Connection::BeginTrans ( )

.method(vtoffset=14, dispid=7, type=METHOD, name="BeginTrans", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Connection15.

Implemented in msado15::Connection.

void msado15::_Connection::Cancel ( )

.method(vtoffset=33, dispid=21, type=METHOD, name="Cancel", addFlagsVtable=4) .parameters()

Implemented in msado15::Connection.

void msado15::_Connection::Close ( )

.method(vtoffset=12, dispid=5, type=METHOD, name="Close", addFlagsVtable=4) .parameters()

Implements msado15::Connection15.

Implemented in msado15::Connection.

void msado15::_Connection::CommitTrans ( )

.method(vtoffset=15, dispid=8, type=METHOD, name="CommitTrans", addFlagsVtable=4) .parameters()

Implements msado15::Connection15.

Implemented in msado15::Connection.

msado15._Recordset msado15::_Connection::Execute | ( | String | CommandText,
 |  | Variant | RecordsAffected,
 |  | int | Options
 | ) |  |

.method(vtoffset=13, dispid=6, type=METHOD, name="Execute", addFlagsVtable=4) .parameters([in,type=STRING] CommandText, [out,elementType=VARIANT,type=PTR] RecordsAffected, [in,type=I4] Options, [iid=00000556-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::Connection15.

Implemented in msado15::Connection.

int msado15::_Connection::getAttributes ( )

.method(vtoffset=23, dispid=14, type=PROPGET, name="Attributes", name2="getAttributes", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Connection15.

Implemented in msado15::Connection.

int msado15::_Connection::getCommandTimeout ( )

.method(vtoffset=7, dispid=2, type=PROPGET, name="CommandTimeout", name2="getCommandTimeout", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Connection15.

Implemented in msado15::Connection.

String msado15::_Connection::getConnectionString ( )

.method(vtoffset=5, dispid=0, type=PROPGET, name="ConnectionString", name2="getConnectionString", addFlagsVtable=4) .parameters([type=STRING] return)

Implements msado15::Connection15.

Implemented in msado15::Connection.

int msado15::_Connection::getConnectionTimeout ( )

.method(vtoffset=9, dispid=3, type=PROPGET, name="ConnectionTimeout", name2="getConnectionTimeout", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Connection15.

Implemented in msado15::Connection.

int msado15::_Connection::getCursorLocation ( )

.method(vtoffset=25, dispid=15, type=PROPGET, name="CursorLocation", name2="getCursorLocation", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Connection15.

Implemented in msado15::Connection.

String msado15::_Connection::getDefaultDatabase ( )

.method(vtoffset=19, dispid=12, type=PROPGET, name="DefaultDatabase", name2="getDefaultDatabase", addFlagsVtable=4) .parameters([type=STRING] return)

Implements msado15::Connection15.

Implemented in msado15::Connection.

msado15.Errors msado15::_Connection::getErrors ( )

.method(vtoffset=18, dispid=11, type=PROPGET, name="Errors", name2="getErrors", addFlagsVtable=4) .parameters([iid=00000501-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::Connection15.

Implemented in msado15::Connection.

int msado15::_Connection::getIsolationLevel ( )

.method(vtoffset=21, dispid=13, type=PROPGET, name="IsolationLevel", name2="getIsolationLevel", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Connection15.

Implemented in msado15::Connection.

int msado15::_Connection::getMode ( )

.method(vtoffset=27, dispid=16, type=PROPGET, name="Mode", name2="getMode", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Connection15.

Implemented in msado15::Connection.

msado15.Properties msado15::_Connection::getProperties ( )

.method(vtoffset=4, dispid=500, type=PROPGET, name="Properties", name2="getProperties", addFlagsVtable=4) .parameters([iid=00000504-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::Connection15.

Implemented in msado15::Connection.

String msado15::_Connection::getProvider ( )

.method(vtoffset=29, dispid=17, type=PROPGET, name="Provider", name2="getProvider", addFlagsVtable=4) .parameters([type=STRING] return)

Implements msado15::Connection15.

Implemented in msado15::Connection.

int msado15::_Connection::getState ( )

.method(vtoffset=31, dispid=18, type=PROPGET, name="State", name2="getState", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Connection15.

Implemented in msado15::Connection.

String msado15::_Connection::getVersion ( )

.method(vtoffset=11, dispid=4, type=PROPGET, name="Version", name2="getVersion", addFlagsVtable=4) .parameters([type=STRING] return)

Implements msado15::Connection15.

Implemented in msado15::Connection.

void msado15::_Connection::Open | ( | String | ConnectionString,
 |  | String | UserID,
 |  | String | Password,
 |  | int | Options
 | ) |  |

.method(vtoffset=17, dispid=10, type=METHOD, name="Open", addFlagsVtable=4) .parameters([in,type=STRING] ConnectionString, [in,type=STRING] UserID, [in,type=STRING] Password, [in,type=I4] Options)

Implements msado15::Connection15.

Implemented in msado15::Connection.

msado15._Recordset msado15::_Connection::OpenSchema | ( | int | Schema,
 |  | Variant | Restrictions,
 |  | Variant | SchemaID
 | ) |  |

.method(vtoffset=32, dispid=19, type=METHOD, name="OpenSchema", addFlagsVtable=4) .parameters([in,type=I4] Schema, [in,type=VARIANT] Restrictions, [in,type=VARIANT] SchemaID, [iid=00000556-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::Connection15.

Implemented in msado15::Connection.

void msado15::_Connection::RollbackTrans ( )

.method(vtoffset=16, dispid=9, type=METHOD, name="RollbackTrans", addFlagsVtable=4) .parameters()

Implements msado15::Connection15.

Implemented in msado15::Connection.

void msado15::_Connection::setAttributes ( int plAttr )

.method(vtoffset=24, dispid=14, type=PROPPUT, name="Attributes", name2="putAttributes", addFlagsVtable=4) .parameters([in,type=I4] plAttr)

Implements msado15::Connection15.

Implemented in msado15::Connection.

void msado15::_Connection::setCommandTimeout ( int plTimeout )

.method(vtoffset=8, dispid=2, type=PROPPUT, name="CommandTimeout", name2="putCommandTimeout", addFlagsVtable=4) .parameters([in,type=I4] plTimeout)

Implements msado15::Connection15.

Implemented in msado15::Connection.

void msado15::_Connection::setConnectionString ( String pbstr )

.method(vtoffset=6, dispid=0, type=PROPPUT, name="ConnectionString", name2="putConnectionString", addFlagsVtable=4) .parameters([in,type=STRING] pbstr)

Implements msado15::Connection15.

Implemented in msado15::Connection.

void msado15::_Connection::setConnectionTimeout ( int plTimeout )

.method(vtoffset=10, dispid=3, type=PROPPUT, name="ConnectionTimeout", name2="putConnectionTimeout", addFlagsVtable=4) .parameters([in,type=I4] plTimeout)

Implements msado15::Connection15.

Implemented in msado15::Connection.

void msado15::_Connection::setCursorLocation ( int plCursorLoc )

.method(vtoffset=26, dispid=15, type=PROPPUT, name="CursorLocation", name2="putCursorLocation", addFlagsVtable=4) .parameters([in,type=I4] plCursorLoc)

Implements msado15::Connection15.

Implemented in msado15::Connection.

void msado15::_Connection::setDefaultDatabase ( String pbstr )

.method(vtoffset=20, dispid=12, type=PROPPUT, name="DefaultDatabase", name2="putDefaultDatabase", addFlagsVtable=4) .parameters([in,type=STRING] pbstr)

Implements msado15::Connection15.

Implemented in msado15::Connection.

void msado15::_Connection::setIsolationLevel ( int Level )

.method(vtoffset=22, dispid=13, type=PROPPUT, name="IsolationLevel", name2="putIsolationLevel", addFlagsVtable=4) .parameters([in,type=I4] Level)

Implements msado15::Connection15.

Implemented in msado15::Connection.

void msado15::_Connection::setMode ( int plMode )

.method(vtoffset=28, dispid=16, type=PROPPUT, name="Mode", name2="putMode", addFlagsVtable=4) .parameters([in,type=I4] plMode)

Implements msado15::Connection15.

Implemented in msado15::Connection.

void msado15::_Connection::setProvider ( String pbstr )

.method(vtoffset=30, dispid=17, type=PROPPUT, name="Provider", name2="putProvider", addFlagsVtable=4) .parameters([in,type=STRING] pbstr)

Implements msado15::Connection15.

Implemented in msado15::Connection.

Member Data Documentation

final com.ms.com._Guid msado15::_Connection::iid = new com.ms.com._Guid((int)0x550, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Implements msado15::Connection15.

Implemented in msado15::Connection.

Definition at line 143 of file _Connection.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/_Connection.java
Generated on Wed Nov 13 2024 16:58:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::_DynaCollection Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::_DynaCollection
Public Member Functions | Static Public Attributes

msado15::_DynaCollection Interface Reference

.interface(iid=00000513-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)

Inherits msado15::_Collection.

Inherited by msado15::Parameters.

List of all members.

Public Member Functions

IUnknown | _NewEnum ()
void | Append (Object Object)
void | Delete (Variant Index)
int | getCount ()
void | Refresh ()

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x513, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)

Detailed Description

Definition at line 20 of file _DynaCollection.java.

Member Function Documentation

IUnknown msado15::_DynaCollection::_NewEnum ( )

.method(vtoffset=5, dispid=4294967292, type=METHOD, name="_NewEnum", addFlagsVtable=4) .parameters([iid=00000000-0000-0000-C000-000000000046,thread=AUTO,type=OBJECT] return)

Implements msado15::_Collection.

Implemented in msado15::Parameters.

void msado15::_DynaCollection::Append ( Object Object )

.method(vtoffset=7, dispid=1610809344, type=METHOD, name="Append", addFlagsVtable=4) .parameters([in,iid=00020400-0000-0000-C000-000000000046,thread=AUTO,type=DISPATCH] Object)

Implemented in msado15::Parameters.

void msado15::_DynaCollection::Delete ( Variant Index )

.method(vtoffset=8, dispid=1610809345, type=METHOD, name="Delete", addFlagsVtable=4) .parameters([in,type=VARIANT] Index)

Implemented in msado15::Parameters.

int msado15::_DynaCollection::getCount ( )

.method(vtoffset=4, dispid=1610743808, type=PROPGET, name="Count", name2="getCount", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::_Collection.

Implemented in msado15::Parameters.

void msado15::_DynaCollection::Refresh ( )

.method(vtoffset=6, dispid=1610743810, type=METHOD, name="Refresh", addFlagsVtable=4) .parameters()

Implements msado15::_Collection.

Implemented in msado15::Parameters.

Member Data Documentation

final com.ms.com._Guid msado15::_DynaCollection::iid = new com.ms.com._Guid((int)0x513, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Implements msado15::_Collection.

Implemented in msado15::Parameters.

Definition at line 43 of file _DynaCollection.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/_DynaCollection.java
Generated on Wed Nov 13 2024 16:58:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::_Parameter Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::_Parameter
Public Member Functions | Static Public Attributes

msado15::_Parameter Interface Reference

.interface(iid=0000050C-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)

Inherits msado15::_ADO.

Inherited by msado15::Parameter.

List of all members.

Public Member Functions

void | AppendChunk (Variant Val)
int | getAttributes ()
int | getDirection ()
String | getName ()
byte | getNumericScale ()
byte | getPrecision ()
msado15.Properties getProperties ()
int | getSize ()
int | getType ()
Variant | getValue ()
void | setAttributes (int plParmAttribs)
void | setDirection (int plParmDirection)
void | setName (String pbstr)
void | setNumericScale (byte pbScale)
void | setPrecision (byte pbPrecision)
void | setSize (int pl)
void | setType (int psDataType)
void | setValue (Variant pvar)

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x50c, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)

Detailed Description

Definition at line 20 of file _Parameter.java.

Member Function Documentation

void msado15::_Parameter::AppendChunk ( Variant Val )

.method(vtoffset=19, dispid=1610809358, type=METHOD, name="AppendChunk", addFlagsVtable=4) .parameters([in,type=VARIANT] Val)

Implemented in msado15::Parameter.

int msado15::_Parameter::getAttributes ( )

.method(vtoffset=20, dispid=1610809359, type=PROPGET, name="Attributes", name2="getAttributes", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in msado15::Parameter.

int msado15::_Parameter::getDirection ( )

.method(vtoffset=12, dispid=1610809350, type=PROPGET, name="Direction", name2="getDirection", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in msado15::Parameter.

String msado15::_Parameter::getName ( )

.method(vtoffset=5, dispid=1610809344, type=PROPGET, name="Name", name2="getName", addFlagsVtable=4) .parameters([type=STRING] return)

Implemented in msado15::Parameter.

byte msado15::_Parameter::getNumericScale ( )

.method(vtoffset=16, dispid=1610809354, type=PROPGET, name="NumericScale", name2="getNumericScale", addFlagsVtable=4) .parameters([type=U1] return)

Implemented in msado15::Parameter.

byte msado15::_Parameter::getPrecision ( )

.method(vtoffset=14, dispid=1610809352, type=PROPGET, name="Precision", name2="getPrecision", addFlagsVtable=4) .parameters([type=U1] return)

Implemented in msado15::Parameter.

msado15.Properties msado15::_Parameter::getProperties ( )

.method(vtoffset=4, dispid=500, type=PROPGET, name="Properties", name2="getProperties", addFlagsVtable=4) .parameters([iid=00000504-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::_ADO.

Implemented in msado15::Parameter.

int msado15::_Parameter::getSize ( )

.method(vtoffset=18, dispid=1610809356, type=PROPGET, name="Size", name2="getSize", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in msado15::Parameter.

int msado15::_Parameter::getType ( )

.method(vtoffset=9, dispid=1610809348, type=PROPGET, name="Type", name2="getType", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in msado15::Parameter.

Variant msado15::_Parameter::getValue ( )

.method(vtoffset=7, dispid=0, type=PROPGET, name="Value", name2="getValue", addFlagsVtable=4) .parameters([type=VARIANT] return)

Implemented in msado15::Parameter.

void msado15::_Parameter::setAttributes ( int plParmAttribs )

.method(vtoffset=21, dispid=1610809359, type=PROPPUT, name="Attributes", name2="putAttributes", addFlagsVtable=4) .parameters([in,type=I4] plParmAttribs)

Implemented in msado15::Parameter.

void msado15::_Parameter::setDirection ( int plParmDirection )

.method(vtoffset=11, dispid=1610809350, type=PROPPUT, name="Direction", name2="putDirection", addFlagsVtable=4) .parameters([in,type=I4] plParmDirection)

Implemented in msado15::Parameter.

void msado15::_Parameter::setName ( String pbstr )

.method(vtoffset=6, dispid=1610809344, type=PROPPUT, name="Name", name2="putName", addFlagsVtable=4) .parameters([in,type=STRING] pbstr)

Implemented in msado15::Parameter.

void msado15::_Parameter::setNumericScale ( byte pbScale )

.method(vtoffset=15, dispid=1610809354, type=PROPPUT, name="NumericScale", name2="putNumericScale", addFlagsVtable=4) .parameters([in,type=U1] pbScale)

Implemented in msado15::Parameter.

void msado15::_Parameter::setPrecision ( byte pbPrecision )

.method(vtoffset=13, dispid=1610809352, type=PROPPUT, name="Precision", name2="putPrecision", addFlagsVtable=4) .parameters([in,type=U1] pbPrecision)

Implemented in msado15::Parameter.

void msado15::_Parameter::setSize ( int pl )

.method(vtoffset=17, dispid=1610809356, type=PROPPUT, name="Size", name2="putSize", addFlagsVtable=4) .parameters([in,type=I4] pl)

Implemented in msado15::Parameter.

void msado15::_Parameter::setType ( int psDataType )

.method(vtoffset=10, dispid=1610809348, type=PROPPUT, name="Type", name2="putType", addFlagsVtable=4) .parameters([in,type=I4] psDataType)

Implemented in msado15::Parameter.

void msado15::_Parameter::setValue ( Variant pvar )

.method(vtoffset=8, dispid=0, type=PROPPUT, name="Value", name2="putValue", addFlagsVtable=4) .parameters([in,type=VARIANT] pvar)

Implemented in msado15::Parameter.

Member Data Documentation

final com.ms.com._Guid msado15::_Parameter::iid = new com.ms.com._Guid((int)0x50c, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Implements msado15::_ADO.

Implemented in msado15::Parameter.

Definition at line 95 of file _Parameter.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/_Parameter.java
Generated on Wed Nov 13 2024 16:58:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::_Record Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::_Record
Public Member Functions | Static Public Attributes

msado15::_Record Interface Reference

.interface(iid=00000562-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)

Inherits msado15::_ADO.

Inherited by msado15::Record.

List of all members.

Public Member Functions

void | Cancel ()
void | Close ()
String | CopyRecord (String Source, String Destination, String UserName, String Password, int Options, boolean Async)
void | DeleteRecord (String Source, boolean Async)
Variant | getActiveConnection ()
msado15._Recordset GetChildren ()
msado15.Fields getFields ()
int | getMode ()
String | getParentURL ()
msado15.Properties getProperties ()
int | getRecordType ()
Variant | getSource ()
int | getState ()
String | MoveRecord (String Source, String Destination, String UserName, String Password, int Options, boolean Async)
void | Open (Variant Source, Variant ActiveConnection, int Mode, int CreateOptions, int Options, String UserName, String Password)
void | setActiveConnection (msado15._Connection pvar)
void | setActiveConnection (String pvar)
void | setMode (int pMode)
void | setSource (String pvar)
void | setSource (Object pvar)

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x562, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)

Detailed Description

Definition at line 20 of file _Record.java.

Member Function Documentation

void msado15::_Record::Cancel ( )

.method(vtoffset=23, dispid=13, type=METHOD, name="Cancel", addFlagsVtable=4) .parameters()

Implemented in msado15::Record.

void msado15::_Record::Close ( )

.method(vtoffset=19, dispid=10, type=METHOD, name="Close", addFlagsVtable=4) .parameters()

Implemented in msado15::Record.

String msado15::_Record::CopyRecord | ( | String | Source,
 |  | String | Destination,
 |  | String | UserName,
 |  | String | Password,
 |  | int | Options,
 |  | boolean | Async
 | ) |  |

.method(vtoffset=16, dispid=7, type=METHOD, name="CopyRecord", addFlagsVtable=4) .parameters([in,type=STRING] Source, [in,type=STRING] Destination, [in,type=STRING] UserName, [in,type=STRING] Password, [in,type=I4] Options, [in,type=BOOLEAN] Async, [type=STRING] return)

Implemented in msado15::Record.

void msado15::_Record::DeleteRecord | ( | String | Source,
 |  | boolean | Async
 | ) |  |

.method(vtoffset=17, dispid=8, type=METHOD, name="DeleteRecord", addFlagsVtable=4) .parameters([in,type=STRING] Source, [in,type=BOOLEAN] Async)

Implemented in msado15::Record.

Variant msado15::_Record::getActiveConnection ( )

.method(vtoffset=5, dispid=1, type=PROPGET, name="ActiveConnection", name2="getActiveConnection", addFlagsVtable=4) .parameters([type=VARIANT] return)

Implemented in msado15::Record.

msado15._Recordset msado15::_Record::GetChildren ( )

.method(vtoffset=22, dispid=12, type=METHOD, name="GetChildren", addFlagsVtable=4) .parameters([iid=00000556-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implemented in msado15::Record.

msado15.Fields msado15::_Record::getFields ( )

.method(vtoffset=20, dispid=0, type=PROPGET, name="Fields", name2="getFields", addFlagsVtable=4) .parameters([iid=00000564-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implemented in msado15::Record.

int msado15::_Record::getMode ( )

.method(vtoffset=12, dispid=4, type=PROPGET, name="Mode", name2="getMode", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in msado15::Record.

String msado15::_Record::getParentURL ( )

.method(vtoffset=14, dispid=5, type=PROPGET, name="ParentURL", name2="getParentURL", addFlagsVtable=4) .parameters([type=STRING] return)

Implemented in msado15::Record.

msado15.Properties msado15::_Record::getProperties ( )

.method(vtoffset=4, dispid=500, type=PROPGET, name="Properties", name2="getProperties", addFlagsVtable=4) .parameters([iid=00000504-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::_ADO.

Implemented in msado15::Record.

int msado15::_Record::getRecordType ( )

.method(vtoffset=21, dispid=11, type=PROPGET, name="RecordType", name2="getRecordType", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in msado15::Record.

Variant msado15::_Record::getSource ( )

.method(vtoffset=9, dispid=3, type=PROPGET, name="Source", name2="getSource", addFlagsVtable=4) .parameters([type=VARIANT] return)

Implemented in msado15::Record.

int msado15::_Record::getState ( )

.method(vtoffset=8, dispid=2, type=PROPGET, name="State", name2="getState", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in msado15::Record.

String msado15::_Record::MoveRecord | ( | String | Source,
 |  | String | Destination,
 |  | String | UserName,
 |  | String | Password,
 |  | int | Options,
 |  | boolean | Async
 | ) |  |

.method(vtoffset=15, dispid=6, type=METHOD, name="MoveRecord", addFlagsVtable=4) .parameters([in,type=STRING] Source, [in,type=STRING] Destination, [in,type=STRING] UserName, [in,type=STRING] Password, [in,type=I4] Options, [in,type=BOOLEAN] Async, [type=STRING] return)

Implemented in msado15::Record.

void msado15::_Record::Open | ( | Variant | Source,
 |  | Variant | ActiveConnection,
 |  | int | Mode,
 |  | int | CreateOptions,
 |  | int | Options,
 |  | String | UserName,
 |  | String | Password
 | ) |  |

.method(vtoffset=18, dispid=9, type=METHOD, name="Open", addFlagsVtable=4) .parameters([in,type=VARIANT] Source, [in,type=VARIANT] ActiveConnection, [in,type=I4] Mode, [in,type=I4] CreateOptions, [in,type=I4] Options, [in,type=STRING] UserName, [in,type=STRING] Password)

Implemented in msado15::Record.

void msado15::_Record::setActiveConnection ( msado15._Connection pvar )

.method(vtoffset=7, dispid=1, type=PROPPUTREF, name="ActiveConnection", name2="putActiveConnection", addFlagsVtable=4) .parameters([in,iid=00000550-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] pvar)

Implemented in msado15::Record.

void msado15::_Record::setActiveConnection ( String pvar )

.method(vtoffset=6, dispid=1, type=PROPPUT, name="ActiveConnection", name2="putActiveConnection", addFlagsVtable=4) .parameters([in,type=STRING] pvar)

Implemented in msado15::Record.

void msado15::_Record::setMode ( int pMode )

.method(vtoffset=13, dispid=4, type=PROPPUT, name="Mode", name2="putMode", addFlagsVtable=4) .parameters([in,type=I4] pMode)

Implemented in msado15::Record.

void msado15::_Record::setSource ( String pvar )

.method(vtoffset=10, dispid=3, type=PROPPUT, name="Source", name2="putSource", addFlagsVtable=4) .parameters([in,type=STRING] pvar)

Implemented in msado15::Record.

void msado15::_Record::setSource ( Object pvar )

.method(vtoffset=11, dispid=3, type=PROPPUTREF, name="Source", name2="putSource", addFlagsVtable=4) .parameters([in,iid=00020400-0000-0000-C000-000000000046,thread=AUTO,type=DISPATCH] pvar)

Implemented in msado15::Record.

Member Data Documentation

final com.ms.com._Guid msado15::_Record::iid = new com.ms.com._Guid((int)0x562, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Implements msado15::_ADO.

Implemented in msado15::Record.

Definition at line 103 of file _Record.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/_Record.java
Generated on Wed Nov 13 2024 16:58:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::_Recordset Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::_Recordset
Public Member Functions | Static Public Attributes

msado15::_Recordset Interface Reference

.interface(iid=00000556-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)

Inherits msado15::Recordset21.

Inherited by msado15::Recordset.

List of all members.

Public Member Functions

msado15._Recordset _xClone ()
void | _xResync (int AffectRecords)
void | _xSave (String FileName, int PersistFormat)
void | AddNew (Variant FieldList, Variant Values)
void | Cancel ()
void | CancelBatch (int AffectRecords)
void | CancelUpdate ()
msado15._Recordset | Clone (int LockType)
void | Close ()
int | CompareBookmarks (Variant Bookmark1, Variant Bookmark2)
void | Delete (int AffectRecords)
void | Find (String Criteria, int SkipRecords, int SearchDirection, Variant Start)
int | getAbsolutePage ()
int | getAbsolutePosition ()
Object | getActiveCommand ()
Variant | getActiveConnection ()
boolean | getBOF ()
Variant | getBookmark ()
int | getCacheSize ()
Variant | getCollect (Variant Index)
int | getCursorLocation ()
int | getCursorType ()
String | getDataMember ()
IUnknown | getDataSource ()
int | getEditMode ()
boolean | getEOF ()
msado15.Fields getFields ()
Variant | getFilter ()
String | getIndex ()
int | getLockType ()
int | getMarshalOptions ()
int | getMaxRecords ()
int | getPageCount ()
int | getPageSize ()
msado15.Properties getProperties ()
int | getRecordCount ()
Variant | GetRows (int Rows, Variant Start, Variant Fields)
String | getSort ()
Variant | getSource ()
int | getState ()
int | getStatus ()
boolean | getStayInSync ()
String | GetString (int StringFormat, int NumRows, String ColumnDelimeter, String RowDelimeter, String NullExpr)
void | Move (int NumRecords, Variant Start)
void | MoveFirst ()
void | MoveLast ()
void | MoveNext ()
void | MovePrevious ()
msado15._Recordset | NextRecordset (Variant RecordsAffected)
void | Open (Variant Source, Variant ActiveConnection, int CursorType, int LockType, int Options)
void | Requery (int Options)
void | Resync (int AffectRecords, int ResyncValues)
void | Save (Variant Destination, int PersistFormat)
void | Seek (Variant KeyValues, int SeekOption)
void | setAbsolutePage (int pl)
void | setAbsolutePosition (int pl)
void | setActiveConnection (Object pvar)
void | setActiveConnection (Variant pvar)
void | setBookmark (Variant pvBookmark)
void | setCacheSize (int pl)
void | setCollect (Variant Index, Variant pvar)
void | setCursorLocation (int plCursorLoc)
void | setCursorType (int plCursorType)
void | setDataMember (String pbstrDataMember)
void | setDataSource (IUnknown ppunkDataSource)
void | setFilter (Variant Criteria)
void | setIndex (String pbstrIndex)
void | setLockType (int plLockType)
void | setMarshalOptions (int peMarshal)
void | setMaxRecords (int plMaxRecords)
void | setPageSize (int pl)
void | setSort (String Criteria)
void | setSource (String pvSource)
void | setSource (Object pvSource)
void | setStayInSync (boolean pbStayInSync)
boolean | Supports (int CursorOptions)
void | Update (Variant Fields, Variant Values)
void | UpdateBatch (int AffectRecords)

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x556, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)

Detailed Description

Definition at line 20 of file _Recordset.java.

Member Function Documentation

msado15._Recordset msado15::_Recordset::_xClone ( )

.method(vtoffset=53, dispid=1610809392, type=METHOD, name="_xClone", addFlagsVtable=4) .parameters([iid=00000556-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

void msado15::_Recordset::_xResync ( int AffectRecords )

.method(vtoffset=39, dispid=1610809378, type=METHOD, name="_xResync", addFlagsVtable=4) .parameters([in,type=I4] AffectRecords)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

void msado15::_Recordset::_xSave | ( | String | FileName,
 |  | int | PersistFormat
 | ) |  |

.method(vtoffset=68, dispid=1610874883, type=METHOD, name="_xSave", addFlagsVtable=4) .parameters([in,type=STRING] FileName, [in,type=I4] PersistFormat)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

void msado15::_Recordset::AddNew | ( | Variant | FieldList,
 |  | Variant | Values
 | ) |  |

.method(vtoffset=27, dispid=1012, type=METHOD, name="AddNew", addFlagsVtable=4) .parameters([in,type=VARIANT] FieldList, [in,type=VARIANT] Values)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

void msado15::_Recordset::Cancel ( )

.method(vtoffset=65, dispid=1055, type=METHOD, name="Cancel", addFlagsVtable=4) .parameters()

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

void msado15::_Recordset::CancelBatch ( int AffectRecords )

.method(vtoffset=55, dispid=1049, type=METHOD, name="CancelBatch", addFlagsVtable=4) .parameters([in,type=I4] AffectRecords)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

void msado15::_Recordset::CancelUpdate ( )

.method(vtoffset=28, dispid=1013, type=METHOD, name="CancelUpdate", addFlagsVtable=4) .parameters()

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

msado15._Recordset msado15::_Recordset::Clone ( int LockType )

.method(vtoffset=76, dispid=1034, type=METHOD, name="Clone", addFlagsVtable=4) .parameters([in,type=I4] LockType, [iid=00000556-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

void msado15::_Recordset::Close ( )

.method(vtoffset=29, dispid=1014, type=METHOD, name="Close", addFlagsVtable=4) .parameters()

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

int msado15::_Recordset::CompareBookmarks | ( | Variant | Bookmark1,
 |  | Variant | Bookmark2
 | ) |  |

.method(vtoffset=75, dispid=1065, type=METHOD, name="CompareBookmarks", addFlagsVtable=4) .parameters([in,type=VARIANT] Bookmark1, [in,type=VARIANT] Bookmark2, [type=I4] return)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

void msado15::_Recordset::Delete ( int AffectRecords )

.method(vtoffset=30, dispid=1015, type=METHOD, name="Delete", addFlagsVtable=4) .parameters([in,type=I4] AffectRecords)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

void msado15::_Recordset::Find | ( | String | Criteria,
 |  | int | SkipRecords,
 |  | int | SearchDirection,
 |  | Variant | Start
 | ) |  |

.method(vtoffset=64, dispid=1058, type=METHOD, name="Find", addFlagsVtable=4) .parameters([in,type=STRING] Criteria, [in,type=I4] SkipRecords, [in,type=I4] SearchDirection, [in,type=VARIANT] Start)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

int msado15::_Recordset::getAbsolutePage ( )

.method(vtoffset=41, dispid=1047, type=PROPGET, name="AbsolutePage", name2="getAbsolutePage", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

int msado15::_Recordset::getAbsolutePosition ( )

.method(vtoffset=5, dispid=1000, type=PROPGET, name="AbsolutePosition", name2="getAbsolutePosition", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

Object msado15::_Recordset::getActiveCommand ( )

.method(vtoffset=69, dispid=1061, type=PROPGET, name="ActiveCommand", name2="getActiveCommand", addFlagsVtable=4) .parameters([iid=00020400-0000-0000-C000-000000000046,thread=AUTO,type=DISPATCH] return)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

Variant msado15::_Recordset::getActiveConnection ( )

.method(vtoffset=9, dispid=1001, type=PROPGET, name="ActiveConnection", name2="getActiveConnection", addFlagsVtable=4) .parameters([type=VARIANT] return)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

boolean msado15::_Recordset::getBOF ( )

.method(vtoffset=10, dispid=1002, type=PROPGET, name="BOF", name2="getBOF", addFlagsVtable=4) .parameters([type=BOOLEAN] return)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

Variant msado15::_Recordset::getBookmark ( )

.method(vtoffset=11, dispid=1003, type=PROPGET, name="Bookmark", name2="getBookmark", addFlagsVtable=4) .parameters([type=VARIANT] return)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

int msado15::_Recordset::getCacheSize ( )

.method(vtoffset=13, dispid=1004, type=PROPGET, name="CacheSize", name2="getCacheSize", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

Variant msado15::_Recordset::getCollect ( Variant Index )

.method(vtoffset=60, dispid=4294967288, type=PROPGET, name="Collect", name2="getCollect", addFlagsVtable=4) .parameters([in,type=VARIANT] Index, [type=VARIANT] return)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

int msado15::_Recordset::getCursorLocation ( )

.method(vtoffset=56, dispid=1051, type=PROPGET, name="CursorLocation", name2="getCursorLocation", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

int msado15::_Recordset::getCursorType ( )

.method(vtoffset=15, dispid=1005, type=PROPGET, name="CursorType", name2="getCursorType", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

String msado15::_Recordset::getDataMember ( )

.method(vtoffset=73, dispid=1064, type=PROPGET, name="DataMember", name2="getDataMember", addFlagsVtable=4) .parameters([type=STRING] return)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

IUnknown msado15::_Recordset::getDataSource ( )

.method(vtoffset=66, dispid=1056, type=PROPGET, name="DataSource", name2="getDataSource", addFlagsVtable=4) .parameters([iid=00000000-0000-0000-C000-000000000046,thread=AUTO,type=OBJECT] return)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

int msado15::_Recordset::getEditMode ( )

.method(vtoffset=43, dispid=1026, type=PROPGET, name="EditMode", name2="getEditMode", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

boolean msado15::_Recordset::getEOF ( )

.method(vtoffset=17, dispid=1006, type=PROPGET, name="EOF", name2="getEOF", addFlagsVtable=4) .parameters([type=BOOLEAN] return)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

msado15.Fields msado15::_Recordset::getFields ( )

.method(vtoffset=18, dispid=0, type=PROPGET, name="Fields", name2="getFields", addFlagsVtable=4) .parameters([iid=00000564-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

Variant msado15::_Recordset::getFilter ( )

.method(vtoffset=44, dispid=1030, type=PROPGET, name="Filter", name2="getFilter", addFlagsVtable=4) .parameters([type=VARIANT] return)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

String msado15::_Recordset::getIndex ( )

.method(vtoffset=80, dispid=1067, type=PROPGET, name="Index", name2="getIndex", addFlagsVtable=4) .parameters([type=STRING] return)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

int msado15::_Recordset::getLockType ( )

.method(vtoffset=19, dispid=1008, type=PROPGET, name="LockType", name2="getLockType", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

int msado15::_Recordset::getMarshalOptions ( )

.method(vtoffset=62, dispid=1053, type=PROPGET, name="MarshalOptions", name2="getMarshalOptions", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

int msado15::_Recordset::getMaxRecords ( )

.method(vtoffset=21, dispid=1009, type=PROPGET, name="MaxRecords", name2="getMaxRecords", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

int msado15::_Recordset::getPageCount ( )

.method(vtoffset=46, dispid=1050, type=PROPGET, name="PageCount", name2="getPageCount", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

int msado15::_Recordset::getPageSize ( )

.method(vtoffset=47, dispid=1048, type=PROPGET, name="PageSize", name2="getPageSize", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

msado15.Properties msado15::_Recordset::getProperties ( )

.method(vtoffset=4, dispid=500, type=PROPGET, name="Properties", name2="getProperties", addFlagsVtable=4) .parameters([iid=00000504-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

int msado15::_Recordset::getRecordCount ( )

.method(vtoffset=23, dispid=1010, type=PROPGET, name="RecordCount", name2="getRecordCount", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

Variant msado15::_Recordset::GetRows | ( | int | Rows,
 |  | Variant | Start,
 |  | Variant | Fields
 | ) |  |

.method(vtoffset=31, dispid=1016, type=METHOD, name="GetRows", addFlagsVtable=4) .parameters([in,type=I4] Rows, [in,type=VARIANT] Start, [in,type=VARIANT] Fields, [type=VARIANT] return)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

String msado15::_Recordset::getSort ( )

.method(vtoffset=49, dispid=1031, type=PROPGET, name="Sort", name2="getSort", addFlagsVtable=4) .parameters([type=STRING] return)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

Variant msado15::_Recordset::getSource ( )

.method(vtoffset=26, dispid=1011, type=PROPGET, name="Source", name2="getSource", addFlagsVtable=4) .parameters([type=VARIANT] return)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

int msado15::_Recordset::getState ( )

.method(vtoffset=52, dispid=1054, type=PROPGET, name="State", name2="getState", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

int msado15::_Recordset::getStatus ( )

.method(vtoffset=51, dispid=1029, type=PROPGET, name="Status", name2="getStatus", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

boolean msado15::_Recordset::getStayInSync ( )

.method(vtoffset=71, dispid=1063, type=PROPGET, name="StayInSync", name2="getStayInSync", addFlagsVtable=4) .parameters([type=BOOLEAN] return)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

String msado15::_Recordset::GetString | ( | int | StringFormat,
 |  | int | NumRows,
 |  | String | ColumnDelimeter,
 |  | String | RowDelimeter,
 |  | String | NullExpr
 | ) |  |

.method(vtoffset=72, dispid=1062, type=METHOD, name="GetString", addFlagsVtable=4) .parameters([in,type=I4] StringFormat, [in,type=I4] NumRows, [in,type=STRING] ColumnDelimeter, [in,type=STRING] RowDelimeter, [in,type=STRING] NullExpr, [type=STRING] return)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

void msado15::_Recordset::Move | ( | int | NumRecords,
 |  | Variant | Start
 | ) |  |

.method(vtoffset=32, dispid=1017, type=METHOD, name="Move", addFlagsVtable=4) .parameters([in,type=I4] NumRecords, [in,type=VARIANT] Start)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

void msado15::_Recordset::MoveFirst ( )

.method(vtoffset=35, dispid=1020, type=METHOD, name="MoveFirst", addFlagsVtable=4) .parameters()

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

void msado15::_Recordset::MoveLast ( )

.method(vtoffset=36, dispid=1021, type=METHOD, name="MoveLast", addFlagsVtable=4) .parameters()

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

void msado15::_Recordset::MoveNext ( )

.method(vtoffset=33, dispid=1018, type=METHOD, name="MoveNext", addFlagsVtable=4) .parameters()

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

void msado15::_Recordset::MovePrevious ( )

.method(vtoffset=34, dispid=1019, type=METHOD, name="MovePrevious", addFlagsVtable=4) .parameters()

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

msado15._Recordset msado15::_Recordset::NextRecordset ( Variant RecordsAffected )

.method(vtoffset=58, dispid=1052, type=METHOD, name="NextRecordset", addFlagsVtable=4) .parameters([out,elementType=VARIANT,type=PTR] RecordsAffected, [iid=00000556-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

void msado15::_Recordset::Open | ( | Variant | Source,
 |  | Variant | ActiveConnection,
 |  | int | CursorType,
 |  | int | LockType,
 |  | int | Options
 | ) |  |

.method(vtoffset=37, dispid=1022, type=METHOD, name="Open", addFlagsVtable=4) .parameters([in,type=VARIANT] Source, [in,type=VARIANT] ActiveConnection, [in,type=I4] CursorType, [in,type=I4] LockType, [in,type=I4] Options)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

void msado15::_Recordset::Requery ( int Options )

.method(vtoffset=38, dispid=1023, type=METHOD, name="Requery", addFlagsVtable=4) .parameters([in,type=I4] Options)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

void msado15::_Recordset::Resync | ( | int | AffectRecords,
 |  | int | ResyncValues
 | ) |  |

.method(vtoffset=77, dispid=1024, type=METHOD, name="Resync", addFlagsVtable=4) .parameters([in,type=I4] AffectRecords, [in,type=I4] ResyncValues)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

void msado15::_Recordset::Save | ( | Variant | Destination,
 |  | int | PersistFormat
 | ) |  |

.method(vtoffset=81, dispid=1057, type=METHOD, name="Save", addFlagsVtable=4) .parameters([in,type=VARIANT] Destination, [in,type=I4] PersistFormat)

Implemented in msado15::Recordset.

void msado15::_Recordset::Seek | ( | Variant | KeyValues,
 |  | int | SeekOption
 | ) |  |

.method(vtoffset=78, dispid=1066, type=METHOD, name="Seek", addFlagsVtable=4) .parameters([in,type=VARIANT] KeyValues, [in,type=I4] SeekOption)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

void msado15::_Recordset::setAbsolutePage ( int pl )

.method(vtoffset=42, dispid=1047, type=PROPPUT, name="AbsolutePage", name2="putAbsolutePage", addFlagsVtable=4) .parameters([in,type=I4] pl)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

void msado15::_Recordset::setAbsolutePosition ( int pl )

.method(vtoffset=6, dispid=1000, type=PROPPUT, name="AbsolutePosition", name2="putAbsolutePosition", addFlagsVtable=4) .parameters([in,type=I4] pl)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

void msado15::_Recordset::setActiveConnection ( Object pvar )

.method(vtoffset=7, dispid=1001, type=PROPPUTREF, name="ActiveConnection", name2="putActiveConnection", addFlagsVtable=4) .parameters([in,iid=00020400-0000-0000-C000-000000000046,thread=AUTO,type=DISPATCH] pvar)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

void msado15::_Recordset::setActiveConnection ( Variant pvar )

.method(vtoffset=8, dispid=1001, type=PROPPUT, name="ActiveConnection", name2="putActiveConnection", addFlagsVtable=4) .parameters([in,type=VARIANT] pvar)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

void msado15::_Recordset::setBookmark ( Variant pvBookmark )

.method(vtoffset=12, dispid=1003, type=PROPPUT, name="Bookmark", name2="putBookmark", addFlagsVtable=4) .parameters([in,type=VARIANT] pvBookmark)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

void msado15::_Recordset::setCacheSize ( int pl )

.method(vtoffset=14, dispid=1004, type=PROPPUT, name="CacheSize", name2="putCacheSize", addFlagsVtable=4) .parameters([in,type=I4] pl)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

void msado15::_Recordset::setCollect | ( | Variant | Index,
 |  | Variant | pvar
 | ) |  |

.method(vtoffset=61, dispid=4294967288, type=PROPPUT, name="Collect", name2="putCollect", addFlagsVtable=4) .parameters([in,type=VARIANT] Index, [in,type=VARIANT] pvar)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

void msado15::_Recordset::setCursorLocation ( int plCursorLoc )

.method(vtoffset=57, dispid=1051, type=PROPPUT, name="CursorLocation", name2="putCursorLocation", addFlagsVtable=4) .parameters([in,type=I4] plCursorLoc)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

void msado15::_Recordset::setCursorType ( int plCursorType )

.method(vtoffset=16, dispid=1005, type=PROPPUT, name="CursorType", name2="putCursorType", addFlagsVtable=4) .parameters([in,type=I4] plCursorType)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

void msado15::_Recordset::setDataMember ( String pbstrDataMember )

.method(vtoffset=74, dispid=1064, type=PROPPUT, name="DataMember", name2="putDataMember", addFlagsVtable=4) .parameters([in,type=STRING] pbstrDataMember)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

void msado15::_Recordset::setDataSource ( IUnknown ppunkDataSource )

.method(vtoffset=67, dispid=1056, type=PROPPUTREF, name="DataSource", name2="putDataSource", addFlagsVtable=4) .parameters([in,iid=00000000-0000-0000-C000-000000000046,thread=AUTO,type=OBJECT] ppunkDataSource)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

void msado15::_Recordset::setFilter ( Variant Criteria )

.method(vtoffset=45, dispid=1030, type=PROPPUT, name="Filter", name2="putFilter", addFlagsVtable=4) .parameters([in,type=VARIANT] Criteria)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

void msado15::_Recordset::setIndex ( String pbstrIndex )

.method(vtoffset=79, dispid=1067, type=PROPPUT, name="Index", name2="putIndex", addFlagsVtable=4) .parameters([in,type=STRING] pbstrIndex)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

void msado15::_Recordset::setLockType ( int plLockType )

.method(vtoffset=20, dispid=1008, type=PROPPUT, name="LockType", name2="putLockType", addFlagsVtable=4) .parameters([in,type=I4] plLockType)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

void msado15::_Recordset::setMarshalOptions ( int peMarshal )

.method(vtoffset=63, dispid=1053, type=PROPPUT, name="MarshalOptions", name2="putMarshalOptions", addFlagsVtable=4) .parameters([in,type=I4] peMarshal)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

void msado15::_Recordset::setMaxRecords ( int plMaxRecords )

.method(vtoffset=22, dispid=1009, type=PROPPUT, name="MaxRecords", name2="putMaxRecords", addFlagsVtable=4) .parameters([in,type=I4] plMaxRecords)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

void msado15::_Recordset::setPageSize ( int pl )

.method(vtoffset=48, dispid=1048, type=PROPPUT, name="PageSize", name2="putPageSize", addFlagsVtable=4) .parameters([in,type=I4] pl)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

void msado15::_Recordset::setSort ( String Criteria )

.method(vtoffset=50, dispid=1031, type=PROPPUT, name="Sort", name2="putSort", addFlagsVtable=4) .parameters([in,type=STRING] Criteria)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

void msado15::_Recordset::setSource ( String pvSource )

.method(vtoffset=25, dispid=1011, type=PROPPUT, name="Source", name2="putSource", addFlagsVtable=4) .parameters([in,type=STRING] pvSource)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

void msado15::_Recordset::setSource ( Object pvSource )

.method(vtoffset=24, dispid=1011, type=PROPPUTREF, name="Source", name2="putSource", addFlagsVtable=4) .parameters([in,iid=00020400-0000-0000-C000-000000000046,thread=AUTO,type=DISPATCH] pvSource)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

void msado15::_Recordset::setStayInSync ( boolean pbStayInSync )

.method(vtoffset=70, dispid=1063, type=PROPPUT, name="StayInSync", name2="putStayInSync", addFlagsVtable=4) .parameters([in,type=BOOLEAN] pbStayInSync)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

boolean msado15::_Recordset::Supports ( int CursorOptions )

.method(vtoffset=59, dispid=1036, type=METHOD, name="Supports", addFlagsVtable=4) .parameters([in,type=I4] CursorOptions, [type=BOOLEAN] return)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

void msado15::_Recordset::Update | ( | Variant | Fields,
 |  | Variant | Values
 | ) |  |

.method(vtoffset=40, dispid=1025, type=METHOD, name="Update", addFlagsVtable=4) .parameters([in,type=VARIANT] Fields, [in,type=VARIANT] Values)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

void msado15::_Recordset::UpdateBatch ( int AffectRecords )

.method(vtoffset=54, dispid=1035, type=METHOD, name="UpdateBatch", addFlagsVtable=4) .parameters([in,type=I4] AffectRecords)

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

Member Data Documentation

final com.ms.com._Guid msado15::_Recordset::iid = new com.ms.com._Guid((int)0x556, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Implements msado15::Recordset21.

Implemented in msado15::Recordset.

Definition at line 340 of file _Recordset.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/_Recordset.java
Generated on Wed Nov 13 2024 16:58:11 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::_Stream Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::_Stream
Public Member Functions | Static Public Attributes

msado15::_Stream Interface Reference

.interface(iid=00000565-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)

Inherits com::ms::com::IUnknown.

Inherited by msado15::Stream.

List of all members.

Public Member Functions

void | Cancel ()
void | Close ()
void | CopyTo (msado15._Stream DestStream, int CharNumber)
void | Flush ()
String | getCharset ()
boolean | getEOS ()
int | getLineSeparator ()
int | getMode ()
int | getPosition ()
int | getSize ()
int | getState ()
int | getType ()
void | LoadFromFile (String FileName)
void | Open (Variant Source, int Mode, int Options, String UserName, String Password)
Variant | Read (int NumBytes)
String | ReadText (int NumChars)
void | SaveToFile (String FileName, int Options)
void | setCharset (String pbstrCharset)
void | SetEOS ()
void | setLineSeparator (int pLS)
void | setMode (int pMode)
void | setPosition (int pPos)
void | setType (int ptype)
void | SkipLine ()
void | Write (Variant Buffer)
void | WriteText (String Data, int Options)

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x565, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)

Detailed Description

Definition at line 20 of file _Stream.java.

Member Function Documentation

void msado15::_Stream::Cancel ( )

.method(vtoffset=29, dispid=21, type=METHOD, name="Cancel", addFlagsVtable=4) .parameters()

Implemented in msado15::Stream.

void msado15::_Stream::Close ( )

.method(vtoffset=19, dispid=11, type=METHOD, name="Close", addFlagsVtable=4) .parameters()

Implemented in msado15::Stream.

void msado15::_Stream::CopyTo | ( | msado15._Stream | DestStream,
 |  | int | CharNumber
 | ) |  |

.method(vtoffset=23, dispid=15, type=METHOD, name="CopyTo", addFlagsVtable=4) .parameters([in,iid=00000565-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] DestStream, [in,type=I4] CharNumber)

Implemented in msado15::Stream.

void msado15::_Stream::Flush ( )

.method(vtoffset=24, dispid=16, type=METHOD, name="Flush", addFlagsVtable=4) .parameters()

Implemented in msado15::Stream.

String msado15::_Stream::getCharset ( )

.method(vtoffset=15, dispid=8, type=PROPGET, name="Charset", name2="getCharset", addFlagsVtable=4) .parameters([type=STRING] return)

Implemented in msado15::Stream.

boolean msado15::_Stream::getEOS ( )

.method(vtoffset=5, dispid=2, type=PROPGET, name="EOS", name2="getEOS", addFlagsVtable=4) .parameters([type=BOOLEAN] return)

Implemented in msado15::Stream.

int msado15::_Stream::getLineSeparator ( )

.method(vtoffset=10, dispid=5, type=PROPGET, name="LineSeparator", name2="getLineSeparator", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in msado15::Stream.

int msado15::_Stream::getMode ( )

.method(vtoffset=13, dispid=7, type=PROPGET, name="Mode", name2="getMode", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in msado15::Stream.

int msado15::_Stream::getPosition ( )

.method(vtoffset=6, dispid=3, type=PROPGET, name="Position", name2="getPosition", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in msado15::Stream.

int msado15::_Stream::getSize ( )

.method(vtoffset=4, dispid=1, type=PROPGET, name="Size", name2="getSize", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in msado15::Stream.

int msado15::_Stream::getState ( )

.method(vtoffset=12, dispid=6, type=PROPGET, name="State", name2="getState", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in msado15::Stream.

int msado15::_Stream::getType ( )

.method(vtoffset=8, dispid=4, type=PROPGET, name="Type", name2="getType", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in msado15::Stream.

void msado15::_Stream::LoadFromFile ( String FileName )

.method(vtoffset=26, dispid=18, type=METHOD, name="LoadFromFile", addFlagsVtable=4) .parameters([in,type=STRING] FileName)

Implemented in msado15::Stream.

void msado15::_Stream::Open | ( | Variant | Source,
 |  | int | Mode,
 |  | int | Options,
 |  | String | UserName,
 |  | String | Password
 | ) |  |

.method(vtoffset=18, dispid=10, type=METHOD, name="Open", addFlagsVtable=4) .parameters([in,type=VARIANT] Source, [in,type=I4] Mode, [in,type=I4] Options, [in,type=STRING] UserName, [in,type=STRING] Password)

Implemented in msado15::Stream.

Variant msado15::_Stream::Read ( int NumBytes )

.method(vtoffset=17, dispid=9, type=METHOD, name="Read", addFlagsVtable=4) .parameters([in,type=I4] NumBytes, [type=VARIANT] return)

Implemented in msado15::Stream.

String msado15::_Stream::ReadText ( int NumChars )

.method(vtoffset=27, dispid=19, type=METHOD, name="ReadText", addFlagsVtable=4) .parameters([in,type=I4] NumChars, [type=STRING] return)

Implemented in msado15::Stream.

void msado15::_Stream::SaveToFile | ( | String | FileName,
 |  | int | Options
 | ) |  |

.method(vtoffset=25, dispid=17, type=METHOD, name="SaveToFile", addFlagsVtable=4) .parameters([in,type=STRING] FileName, [in,type=I4] Options)

Implemented in msado15::Stream.

void msado15::_Stream::setCharset ( String pbstrCharset )

.method(vtoffset=16, dispid=8, type=PROPPUT, name="Charset", name2="putCharset", addFlagsVtable=4) .parameters([in,type=STRING] pbstrCharset)

Implemented in msado15::Stream.

void msado15::_Stream::SetEOS ( )

.method(vtoffset=22, dispid=14, type=METHOD, name="SetEOS", addFlagsVtable=4) .parameters()

Implemented in msado15::Stream.

void msado15::_Stream::setLineSeparator ( int pLS )

.method(vtoffset=11, dispid=5, type=PROPPUT, name="LineSeparator", name2="putLineSeparator", addFlagsVtable=4) .parameters([in,type=I4] pLS)

Implemented in msado15::Stream.

void msado15::_Stream::setMode ( int pMode )

.method(vtoffset=14, dispid=7, type=PROPPUT, name="Mode", name2="putMode", addFlagsVtable=4) .parameters([in,type=I4] pMode)

Implemented in msado15::Stream.

void msado15::_Stream::setPosition ( int pPos )

.method(vtoffset=7, dispid=3, type=PROPPUT, name="Position", name2="putPosition", addFlagsVtable=4) .parameters([in,type=I4] pPos)

Implemented in msado15::Stream.

void msado15::_Stream::setType ( int ptype )

.method(vtoffset=9, dispid=4, type=PROPPUT, name="Type", name2="putType", addFlagsVtable=4) .parameters([in,type=I4] ptype)

Implemented in msado15::Stream.

void msado15::_Stream::SkipLine ( )

.method(vtoffset=20, dispid=12, type=METHOD, name="SkipLine", addFlagsVtable=4) .parameters()

Implemented in msado15::Stream.

void msado15::_Stream::Write ( Variant Buffer )

.method(vtoffset=21, dispid=13, type=METHOD, name="Write", addFlagsVtable=4) .parameters([in,type=VARIANT] Buffer)

Implemented in msado15::Stream.

void msado15::_Stream::WriteText | ( | String | Data,
 |  | int | Options
 | ) |  |

.method(vtoffset=28, dispid=20, type=METHOD, name="WriteText", addFlagsVtable=4) .parameters([in,type=STRING] Data, [in,type=I4] Options)

Implemented in msado15::Stream.

Member Data Documentation

final com.ms.com._Guid msado15::_Stream::iid = new com.ms.com._Guid((int)0x565, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Implemented in msado15::Stream.

Definition at line 127 of file _Stream.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/_Stream.java
Generated on Wed Nov 13 2024 16:58:11 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::ADCPROP_ASYNCTHREADPRIORITY_ENUM Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::ADCPROP_ASYNCTHREADPRIORITY_ENUM
Static Public Attributes

msado15::ADCPROP_ASYNCTHREADPRIORITY_ENUM Class Reference

List of all members.

Static Public Attributes

static final short | adPriorityAboveNormal = 4
static final short | adPriorityBelowNormal = 2
static final short | adPriorityHighest = 5
static final short | adPriorityLowest = 1
static final short | adPriorityNormal = 3

Detailed Description

Definition at line 20 of file ADCPROP_ASYNCTHREADPRIORITY_ENUM.java.

Member Data Documentation

final short msado15::ADCPROP_ASYNCTHREADPRIORITY_ENUM::adPriorityAboveNormal = 4 [static]

Definition at line 25 of file ADCPROP_ASYNCTHREADPRIORITY_ENUM.java.

final short msado15::ADCPROP_ASYNCTHREADPRIORITY_ENUM::adPriorityBelowNormal = 2 [static]

Definition at line 23 of file ADCPROP_ASYNCTHREADPRIORITY_ENUM.java.

final short msado15::ADCPROP_ASYNCTHREADPRIORITY_ENUM::adPriorityHighest = 5 [static]

Definition at line 26 of file ADCPROP_ASYNCTHREADPRIORITY_ENUM.java.

final short msado15::ADCPROP_ASYNCTHREADPRIORITY_ENUM::adPriorityLowest = 1 [static]

Definition at line 22 of file ADCPROP_ASYNCTHREADPRIORITY_ENUM.java.

final short msado15::ADCPROP_ASYNCTHREADPRIORITY_ENUM::adPriorityNormal = 3 [static]

Definition at line 24 of file ADCPROP_ASYNCTHREADPRIORITY_ENUM.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ADCPROP_ASYNCTHREADPRIORITY_ENUM.java
Generated on Wed Nov 13 2024 16:58:11 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::ADCPROP_AUTORECALC_ENUM Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::ADCPROP_AUTORECALC_ENUM
Static Public Attributes

msado15::ADCPROP_AUTORECALC_ENUM Class Reference

List of all members.

Static Public Attributes

static final short | adRecalcAlways = 1
static final short | adRecalcUpFront = 0

Detailed Description

Definition at line 20 of file ADCPROP_AUTORECALC_ENUM.java.

Member Data Documentation

final short msado15::ADCPROP_AUTORECALC_ENUM::adRecalcAlways = 1 [static]

Definition at line 23 of file ADCPROP_AUTORECALC_ENUM.java.

final short msado15::ADCPROP_AUTORECALC_ENUM::adRecalcUpFront = 0 [static]

Definition at line 22 of file ADCPROP_AUTORECALC_ENUM.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ADCPROP_AUTORECALC_ENUM.java
Generated on Wed Nov 13 2024 16:58:11 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::ADCPROP_UPDATECRITERIA_ENUM Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::ADCPROP_UPDATECRITERIA_ENUM
Static Public Attributes

msado15::ADCPROP_UPDATECRITERIA_ENUM Class Reference

List of all members.

Static Public Attributes

static final short | adCriteriaAllCols = 1
static final short | adCriteriaKey = 0
static final short | adCriteriaTimeStamp = 3
static final short | adCriteriaUpdCols = 2

Detailed Description

Definition at line 20 of file ADCPROP_UPDATECRITERIA_ENUM.java.

Member Data Documentation

final short msado15::ADCPROP_UPDATECRITERIA_ENUM::adCriteriaAllCols = 1 [static]

Definition at line 23 of file ADCPROP_UPDATECRITERIA_ENUM.java.

final short msado15::ADCPROP_UPDATECRITERIA_ENUM::adCriteriaKey = 0 [static]

Definition at line 22 of file ADCPROP_UPDATECRITERIA_ENUM.java.

final short msado15::ADCPROP_UPDATECRITERIA_ENUM::adCriteriaTimeStamp = 3 [static]

Definition at line 25 of file ADCPROP_UPDATECRITERIA_ENUM.java.

final short msado15::ADCPROP_UPDATECRITERIA_ENUM::adCriteriaUpdCols = 2 [static]

Definition at line 24 of file ADCPROP_UPDATECRITERIA_ENUM.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ADCPROP_UPDATECRITERIA_ENUM.java
Generated on Wed Nov 13 2024 16:58:11 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::ADOCommandConstruction Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::ADOCommandConstruction
Public Member Functions | Static Public Attributes

msado15::ADOCommandConstruction Interface Reference

.interface(iid=00000517-0000-0010-8000-00AA006D2EA4, thread=AUTO)

Inherits com::ms::com::IUnknown.

List of all members.

Public Member Functions

IUnknown | getOLEDBCommand ()
void | setOLEDBCommand (IUnknown ppOLEDBCommand)

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x517, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)

Detailed Description

Definition at line 20 of file ADOCommandConstruction.java.

Member Function Documentation

IUnknown msado15::ADOCommandConstruction::getOLEDBCommand ( )

.method(vtoffset=0, addFlagsVtable=4) .parameters([iid=00000000-0000-0000-C000-000000000046,thread=AUTO,type=OBJECT] return)

void msado15::ADOCommandConstruction::setOLEDBCommand ( IUnknown ppOLEDBCommand )

.method(vtoffset=1, addFlagsVtable=4) .parameters([in,iid=00000000-0000-0000-C000-000000000046,thread=AUTO,type=OBJECT] ppOLEDBCommand)

Member Data Documentation

final com.ms.com._Guid msado15::ADOCommandConstruction::iid = new com.ms.com._Guid((int)0x517, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Definition at line 31 of file ADOCommandConstruction.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ADOCommandConstruction.java
Generated on Wed Nov 13 2024 16:58:11 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::ADOConnectionConstruction Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::ADOConnectionConstruction
Public Member Functions | Static Public Attributes

msado15::ADOConnectionConstruction Interface Reference

.interface(iid=00000551-0000-0010-8000-00AA006D2EA4, thread=AUTO)

Inherits msado15::ADOConnectionConstruction15.

List of all members.

Public Member Functions

IUnknown | getDSO ()
IUnknown | getSession ()
void | WrapDSOandSession (IUnknown pDSO, IUnknown pSession)

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x551, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)

Detailed Description

Definition at line 20 of file ADOConnectionConstruction.java.

Member Function Documentation

IUnknown msado15::ADOConnectionConstruction::getDSO ( )

.method(vtoffset=0, addFlagsVtable=4) .parameters([iid=00000000-0000-0000-C000-000000000046,thread=AUTO,type=OBJECT] return)

Implements msado15::ADOConnectionConstruction15.

IUnknown msado15::ADOConnectionConstruction::getSession ( )

.method(vtoffset=1, addFlagsVtable=4) .parameters([iid=00000000-0000-0000-C000-000000000046,thread=AUTO,type=OBJECT] return)

Implements msado15::ADOConnectionConstruction15.

void msado15::ADOConnectionConstruction::WrapDSOandSession | ( | IUnknown | pDSO,
 |  | IUnknown | pSession
 | ) |  |

.method(vtoffset=2, addFlagsVtable=4) .parameters([in,iid=00000000-0000-0000-C000-000000000046,thread=AUTO,type=OBJECT] pDSO, [in,iid=00000000-0000-0000-C000-000000000046,thread=AUTO,type=OBJECT] pSession)

Implements msado15::ADOConnectionConstruction15.

Member Data Documentation

final com.ms.com._Guid msado15::ADOConnectionConstruction::iid = new com.ms.com._Guid((int)0x551, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Implements msado15::ADOConnectionConstruction15.

Definition at line 35 of file ADOConnectionConstruction.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ADOConnectionConstruction.java
Generated on Wed Nov 13 2024 16:58:11 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::ADOConnectionConstruction15 Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::ADOConnectionConstruction15
Public Member Functions | Static Public Attributes

msado15::ADOConnectionConstruction15 Interface Reference

.interface(iid=00000516-0000-0010-8000-00AA006D2EA4, thread=AUTO)

Inherits com::ms::com::IUnknown.

Inherited by msado15::ADOConnectionConstruction.

List of all members.

Public Member Functions

IUnknown | getDSO ()
IUnknown | getSession ()
void | WrapDSOandSession (IUnknown pDSO, IUnknown pSession)

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x516, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)

Detailed Description

Definition at line 20 of file ADOConnectionConstruction15.java.

Member Function Documentation

IUnknown msado15::ADOConnectionConstruction15::getDSO ( )

.method(vtoffset=0, addFlagsVtable=4) .parameters([iid=00000000-0000-0000-C000-000000000046,thread=AUTO,type=OBJECT] return)

Implemented in msado15::ADOConnectionConstruction.

IUnknown msado15::ADOConnectionConstruction15::getSession ( )

.method(vtoffset=1, addFlagsVtable=4) .parameters([iid=00000000-0000-0000-C000-000000000046,thread=AUTO,type=OBJECT] return)

Implemented in msado15::ADOConnectionConstruction.

void msado15::ADOConnectionConstruction15::WrapDSOandSession | ( | IUnknown | pDSO,
 |  | IUnknown | pSession
 | ) |  |

.method(vtoffset=2, addFlagsVtable=4) .parameters([in,iid=00000000-0000-0000-C000-000000000046,thread=AUTO,type=OBJECT] pDSO, [in,iid=00000000-0000-0000-C000-000000000046,thread=AUTO,type=OBJECT] pSession)

Implemented in msado15::ADOConnectionConstruction.

Member Data Documentation

final com.ms.com._Guid msado15::ADOConnectionConstruction15::iid = new com.ms.com._Guid((int)0x516, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Implemented in msado15::ADOConnectionConstruction.

Definition at line 35 of file ADOConnectionConstruction15.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ADOConnectionConstruction15.java
Generated on Wed Nov 13 2024 16:58:11 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::ADORecordConstruction Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::ADORecordConstruction
Public Member Functions | Static Public Attributes

msado15::ADORecordConstruction Interface Reference

.interface(iid=00000567-0000-0010-8000-00AA006D2EA4, thread=AUTO)

Inherits com::ms::com::IUnknown.

List of all members.

Public Member Functions

IUnknown | getRow ()
void | setParentRow (IUnknown _jcomparam_0)
void | setRow (IUnknown ppRow)

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x567, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)

Detailed Description

Definition at line 20 of file ADORecordConstruction.java.

Member Function Documentation

IUnknown msado15::ADORecordConstruction::getRow ( )

.method(vtoffset=4, addFlagsVtable=4) .parameters([iid=00000000-0000-0000-C000-000000000046,thread=AUTO,type=OBJECT] return)

void msado15::ADORecordConstruction::setParentRow ( IUnknown _jcomparam_0 )

.method(vtoffset=6, addFlagsVtable=4) .parameters([in,iid=00000000-0000-0000-C000-000000000046,thread=AUTO,type=OBJECT] _jcomparam_0)

void msado15::ADORecordConstruction::setRow ( IUnknown ppRow )

.method(vtoffset=5, addFlagsVtable=4) .parameters([in,iid=00000000-0000-0000-C000-000000000046,thread=AUTO,type=OBJECT] ppRow)

Member Data Documentation

final com.ms.com._Guid msado15::ADORecordConstruction::iid = new com.ms.com._Guid((int)0x567, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Definition at line 35 of file ADORecordConstruction.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ADORecordConstruction.java
Generated on Wed Nov 13 2024 16:58:11 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::ADORecordsetConstruction Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::ADORecordsetConstruction
Public Member Functions | Static Public Attributes

msado15::ADORecordsetConstruction Interface Reference

.interface(iid=00000283-0000-0010-8000-00AA006D2EA4, thread=AUTO)

Inherits com::ms::com::IUnknown.

List of all members.

Public Member Functions

int | getChapter ()
IUnknown | getRowPosition ()
IUnknown | getRowset ()
void | setChapter (int plChapter)
void | setRowPosition (IUnknown ppRowPos)
void | setRowset (IUnknown ppRowset)

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x283, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)

Detailed Description

Definition at line 20 of file ADORecordsetConstruction.java.

Member Function Documentation

int msado15::ADORecordsetConstruction::getChapter ( )

.method(vtoffset=6, addFlagsVtable=4) .parameters([type=I4] return)

IUnknown msado15::ADORecordsetConstruction::getRowPosition ( )

.method(vtoffset=8, addFlagsVtable=4) .parameters([iid=00000000-0000-0000-C000-000000000046,thread=AUTO,type=OBJECT] return)

IUnknown msado15::ADORecordsetConstruction::getRowset ( )

.method(vtoffset=4, addFlagsVtable=4) .parameters([iid=00000000-0000-0000-C000-000000000046,thread=AUTO,type=OBJECT] return)

void msado15::ADORecordsetConstruction::setChapter ( int plChapter )

.method(vtoffset=7, addFlagsVtable=4) .parameters([in,type=I4] plChapter)

void msado15::ADORecordsetConstruction::setRowPosition ( IUnknown ppRowPos )

.method(vtoffset=9, addFlagsVtable=4) .parameters([in,iid=00000000-0000-0000-C000-000000000046,thread=AUTO,type=OBJECT] ppRowPos)

void msado15::ADORecordsetConstruction::setRowset ( IUnknown ppRowset )

.method(vtoffset=5, addFlagsVtable=4) .parameters([in,iid=00000000-0000-0000-C000-000000000046,thread=AUTO,type=OBJECT] ppRowset)

Member Data Documentation

final com.ms.com._Guid msado15::ADORecordsetConstruction::iid = new com.ms.com._Guid((int)0x283, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Definition at line 47 of file ADORecordsetConstruction.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ADORecordsetConstruction.java
Generated on Wed Nov 13 2024 16:58:11 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::ADOStreamConstruction Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::ADOStreamConstruction
Public Member Functions | Static Public Attributes

msado15::ADOStreamConstruction Interface Reference

.interface(iid=00000568-0000-0010-8000-00AA006D2EA4, thread=AUTO)

Inherits com::ms::com::IUnknown.

List of all members.

Public Member Functions

IUnknown | getStream ()
void | setStream (IUnknown ppStm)

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x568, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)

Detailed Description

Definition at line 20 of file ADOStreamConstruction.java.

Member Function Documentation

IUnknown msado15::ADOStreamConstruction::getStream ( )

.method(vtoffset=4, addFlagsVtable=4) .parameters([iid=00000000-0000-0000-C000-000000000046,thread=AUTO,type=OBJECT] return)

void msado15::ADOStreamConstruction::setStream ( IUnknown ppStm )

.method(vtoffset=5, addFlagsVtable=4) .parameters([in,iid=00000000-0000-0000-C000-000000000046,thread=AUTO,type=OBJECT] ppStm)

Member Data Documentation

final com.ms.com._Guid msado15::ADOStreamConstruction::iid = new com.ms.com._Guid((int)0x568, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Definition at line 31 of file ADOStreamConstruction.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ADOStreamConstruction.java
Generated on Wed Nov 13 2024 16:58:11 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::AffectEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::AffectEnum
Static Public Attributes

msado15::AffectEnum Class Reference

List of all members.

Static Public Attributes

static final short | adAffectAll = 3
static final short | adAffectAllChapters = 4
static final short | adAffectCurrent = 1
static final short | adAffectGroup = 2

Detailed Description

Definition at line 20 of file AffectEnum.java.

Member Data Documentation

final short msado15::AffectEnum::adAffectAll = 3 [static]

Definition at line 24 of file AffectEnum.java.

final short msado15::AffectEnum::adAffectAllChapters = 4 [static]

Definition at line 25 of file AffectEnum.java.

final short msado15::AffectEnum::adAffectCurrent = 1 [static]

Definition at line 22 of file AffectEnum.java.

final short msado15::AffectEnum::adAffectGroup = 2 [static]

Definition at line 23 of file AffectEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/AffectEnum.java
Generated on Wed Nov 13 2024 16:58:11 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::BookmarkEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::BookmarkEnum
Static Public Attributes

msado15::BookmarkEnum Class Reference

List of all members.

Static Public Attributes

static final short | adBookmarkCurrent = 0
static final short | adBookmarkFirst = 1
static final short | adBookmarkLast = 2

Detailed Description

Definition at line 20 of file BookmarkEnum.java.

Member Data Documentation

final short msado15::BookmarkEnum::adBookmarkCurrent = 0 [static]

Definition at line 22 of file BookmarkEnum.java.

final short msado15::BookmarkEnum::adBookmarkFirst = 1 [static]

Definition at line 23 of file BookmarkEnum.java.

final short msado15::BookmarkEnum::adBookmarkLast = 2 [static]

Definition at line 24 of file BookmarkEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/BookmarkEnum.java
Generated on Wed Nov 13 2024 16:58:11 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::CEResyncEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::CEResyncEnum
Static Public Attributes

msado15::CEResyncEnum Class Reference

List of all members.

Static Public Attributes

static final short | adResyncAll = 15
static final short | adResyncAutoIncrement = 1
static final short | adResyncConflicts = 2
static final short | adResyncInserts = 8
static final short | adResyncNone = 0
static final short | adResyncUpdates = 4

Detailed Description

Definition at line 20 of file CEResyncEnum.java.

Member Data Documentation

final short msado15::CEResyncEnum::adResyncAll = 15 [static]

Definition at line 27 of file CEResyncEnum.java.

final short msado15::CEResyncEnum::adResyncAutoIncrement = 1 [static]

Definition at line 23 of file CEResyncEnum.java.

final short msado15::CEResyncEnum::adResyncConflicts = 2 [static]

Definition at line 24 of file CEResyncEnum.java.

final short msado15::CEResyncEnum::adResyncInserts = 8 [static]

Definition at line 26 of file CEResyncEnum.java.

final short msado15::CEResyncEnum::adResyncNone = 0 [static]

Definition at line 22 of file CEResyncEnum.java.

final short msado15::CEResyncEnum::adResyncUpdates = 4 [static]

Definition at line 25 of file CEResyncEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/CEResyncEnum.java
Generated on Wed Nov 13 2024 16:58:11 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::Command Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::Command
Public Member Functions | Static Public Attributes

msado15::Command Class Reference

.class(classid=00000507-0000-0010-8000-00AA006D2EA4,DynamicCasts) .interface(iid=0000054E-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)

Inherits com::ms::com::IUnknown, and msado15::_Command.

List of all members.

Public Member Functions

native void | Cancel ()
native msado15._Parameter | CreateParameter (String Name, int Type, int Direction, int Size, Variant Value)
native msado15._Recordset | Execute (Variant RecordsAffected, Variant Parameters, int Options)
native msado15._Connection | getActiveConnection ()
native String | getCommandText ()
native int | getCommandTimeout ()
native int | getCommandType ()
native String | getName ()
native msado15.Parameters | getParameters ()
native boolean | getPrepared ()
native msado15.Properties | getProperties ()
native int | getState ()
native void | setActiveConnection (Variant ppvObject)
native void | setActiveConnection (msado15._Connection ppvObject)
native void | setCommandText (String pbstr)
native void | setCommandTimeout (int pl)
native void | setCommandType (int plCmdType)
native void | setName (String pbstrName)
native void | setPrepared (boolean pfPrepared)

Static Public Attributes

static final com.ms.com._Guid | clsid = new com.ms.com._Guid((int)0x507, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)
static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x54e, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)

Detailed Description

Definition at line 20 of file Command.java.

Member Function Documentation

native void msado15::Command::Cancel ( )

.method(vtoffset=22, dispid=1610874881, type=METHOD, name="Cancel", addFlagsVtable=4) .parameters()

Implements msado15::_Command.

native msado15._Parameter msado15::Command::CreateParameter | ( | String | Name,
 |  | int | Type,
 |  | int | Direction,
 |  | int | Size,
 |  | Variant | Value
 | ) |  |

.method(vtoffset=15, dispid=1610809354, type=METHOD, name="CreateParameter", addFlagsVtable=4) .parameters([in,type=STRING] Name, [in,type=I4] Type, [in,type=I4] Direction, [in,type=I4] Size, [in,type=VARIANT] Value, [iid=0000050C-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::_Command.

native msado15._Recordset msado15::Command::Execute | ( | Variant | RecordsAffected,
 |  | Variant | Parameters,
 |  | int | Options
 | ) |  |

.method(vtoffset=14, dispid=1610809353, type=METHOD, name="Execute", addFlagsVtable=4) .parameters([out,elementType=VARIANT,type=PTR] RecordsAffected, [in,elementType=VARIANT,type=PTR] Parameters, [in,type=I4] Options, [iid=00000556-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::_Command.

native msado15._Connection msado15::Command::getActiveConnection ( )

.method(vtoffset=5, dispid=1610809344, type=PROPGET, name="ActiveConnection", name2="getActiveConnection", addFlagsVtable=4) .parameters([iid=00000550-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::_Command.

native String msado15::Command::getCommandText ( )

.method(vtoffset=8, dispid=1610809347, type=PROPGET, name="CommandText", name2="getCommandText", addFlagsVtable=4) .parameters([type=STRING] return)

Implements msado15::_Command.

native int msado15::Command::getCommandTimeout ( )

.method(vtoffset=10, dispid=1610809349, type=PROPGET, name="CommandTimeout", name2="getCommandTimeout", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::_Command.

native int msado15::Command::getCommandType ( )

.method(vtoffset=18, dispid=1610809356, type=PROPGET, name="CommandType", name2="getCommandType", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::_Command.

native String msado15::Command::getName ( )

.method(vtoffset=19, dispid=1610809358, type=PROPGET, name="Name", name2="getName", addFlagsVtable=4) .parameters([type=STRING] return)

Implements msado15::_Command.

native msado15.Parameters msado15::Command::getParameters ( )

.method(vtoffset=16, dispid=0, type=PROPGET, name="Parameters", name2="getParameters", addFlagsVtable=4) .parameters([iid=0000050D-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::_Command.

native boolean msado15::Command::getPrepared ( )

.method(vtoffset=12, dispid=1610809351, type=PROPGET, name="Prepared", name2="getPrepared", addFlagsVtable=4) .parameters([type=BOOLEAN] return)

Implements msado15::_Command.

native msado15.Properties msado15::Command::getProperties ( )

.method(vtoffset=4, dispid=500, type=PROPGET, name="Properties", name2="getProperties", addFlagsVtable=4) .parameters([iid=00000504-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::_Command.

native int msado15::Command::getState ( )

.method(vtoffset=21, dispid=1610874880, type=PROPGET, name="State", name2="getState", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::_Command.

native void msado15::Command::setActiveConnection ( Variant ppvObject )

.method(vtoffset=7, dispid=1610809344, type=PROPPUT, name="ActiveConnection", name2="putActiveConnection", addFlagsVtable=4) .parameters([in,type=VARIANT] ppvObject)

Implements msado15::_Command.

native void msado15::Command::setActiveConnection ( msado15._Connection ppvObject )

.method(vtoffset=6, dispid=1610809344, type=PROPPUTREF, name="ActiveConnection", name2="putActiveConnection", addFlagsVtable=4) .parameters([in,iid=00000550-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] ppvObject)

Implements msado15::_Command.

native void msado15::Command::setCommandText ( String pbstr )

.method(vtoffset=9, dispid=1610809347, type=PROPPUT, name="CommandText", name2="putCommandText", addFlagsVtable=4) .parameters([in,type=STRING] pbstr)

Implements msado15::_Command.

native void msado15::Command::setCommandTimeout ( int pl )

.method(vtoffset=11, dispid=1610809349, type=PROPPUT, name="CommandTimeout", name2="putCommandTimeout", addFlagsVtable=4) .parameters([in,type=I4] pl)

Implements msado15::_Command.

native void msado15::Command::setCommandType ( int plCmdType )

.method(vtoffset=17, dispid=1610809356, type=PROPPUT, name="CommandType", name2="putCommandType", addFlagsVtable=4) .parameters([in,type=I4] plCmdType)

Implements msado15::_Command.

native void msado15::Command::setName ( String pbstrName )

.method(vtoffset=20, dispid=1610809358, type=PROPPUT, name="Name", name2="putName", addFlagsVtable=4) .parameters([in,type=STRING] pbstrName)

Implements msado15::_Command.

native void msado15::Command::setPrepared ( boolean pfPrepared )

.method(vtoffset=13, dispid=1610809351, type=PROPPUT, name="Prepared", name2="putPrepared", addFlagsVtable=4) .parameters([in,type=BOOLEAN] pfPrepared)

Implements msado15::_Command.

Member Data Documentation

final com.ms.com._Guid msado15::Command::clsid = new com.ms.com._Guid((int)0x507, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Definition at line 101 of file Command.java.

final com.ms.com._Guid msado15::Command::iid = new com.ms.com._Guid((int)0x54e, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Implements msado15::_Command.

Definition at line 99 of file Command.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Command.java
Generated on Wed Nov 13 2024 16:58:11 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::Command15 Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::Command15
Public Member Functions | Static Public Attributes

msado15::Command15 Interface Reference

.interface(iid=00000508-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)

Inherits msado15::_ADO.

Inherited by msado15::_Command.

List of all members.

Public Member Functions

msado15._Parameter | CreateParameter (String Name, int Type, int Direction, int Size, Variant Value)
msado15._Recordset | Execute (Variant RecordsAffected, Variant Parameters, int Options)
msado15._Connection getActiveConnection ()
String | getCommandText ()
int | getCommandTimeout ()
int | getCommandType ()
String | getName ()
msado15.Parameters getParameters ()
boolean | getPrepared ()
msado15.Properties getProperties ()
void | setActiveConnection (Variant ppvObject)
void | setActiveConnection (msado15._Connection ppvObject)
void | setCommandText (String pbstr)
void | setCommandTimeout (int pl)
void | setCommandType (int plCmdType)
void | setName (String pbstrName)
void | setPrepared (boolean pfPrepared)

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x508, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)

Detailed Description

Definition at line 20 of file Command15.java.

Member Function Documentation

msado15._Parameter msado15::Command15::CreateParameter | ( | String | Name,
 |  | int | Type,
 |  | int | Direction,
 |  | int | Size,
 |  | Variant | Value
 | ) |  |

.method(vtoffset=15, dispid=1610809354, type=METHOD, name="CreateParameter", addFlagsVtable=4) .parameters([in,type=STRING] Name, [in,type=I4] Type, [in,type=I4] Direction, [in,type=I4] Size, [in,type=VARIANT] Value, [iid=0000050C-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implemented in msado15::_Command, and msado15::Command.

msado15._Recordset msado15::Command15::Execute | ( | Variant | RecordsAffected,
 |  | Variant | Parameters,
 |  | int | Options
 | ) |  |

.method(vtoffset=14, dispid=1610809353, type=METHOD, name="Execute", addFlagsVtable=4) .parameters([out,elementType=VARIANT,type=PTR] RecordsAffected, [in,elementType=VARIANT,type=PTR] Parameters, [in,type=I4] Options, [iid=00000556-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implemented in msado15::_Command, and msado15::Command.

msado15._Connection msado15::Command15::getActiveConnection ( )

.method(vtoffset=5, dispid=1610809344, type=PROPGET, name="ActiveConnection", name2="getActiveConnection", addFlagsVtable=4) .parameters([iid=00000550-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implemented in msado15::_Command, and msado15::Command.

String msado15::Command15::getCommandText ( )

.method(vtoffset=8, dispid=1610809347, type=PROPGET, name="CommandText", name2="getCommandText", addFlagsVtable=4) .parameters([type=STRING] return)

Implemented in msado15::_Command, and msado15::Command.

int msado15::Command15::getCommandTimeout ( )

.method(vtoffset=10, dispid=1610809349, type=PROPGET, name="CommandTimeout", name2="getCommandTimeout", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in msado15::_Command, and msado15::Command.

int msado15::Command15::getCommandType ( )

.method(vtoffset=18, dispid=1610809356, type=PROPGET, name="CommandType", name2="getCommandType", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in msado15::_Command, and msado15::Command.

String msado15::Command15::getName ( )

.method(vtoffset=19, dispid=1610809358, type=PROPGET, name="Name", name2="getName", addFlagsVtable=4) .parameters([type=STRING] return)

Implemented in msado15::_Command, and msado15::Command.

msado15.Parameters msado15::Command15::getParameters ( )

.method(vtoffset=16, dispid=0, type=PROPGET, name="Parameters", name2="getParameters", addFlagsVtable=4) .parameters([iid=0000050D-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implemented in msado15::_Command, and msado15::Command.

boolean msado15::Command15::getPrepared ( )

.method(vtoffset=12, dispid=1610809351, type=PROPGET, name="Prepared", name2="getPrepared", addFlagsVtable=4) .parameters([type=BOOLEAN] return)

Implemented in msado15::_Command, and msado15::Command.

msado15.Properties msado15::Command15::getProperties ( )

.method(vtoffset=4, dispid=500, type=PROPGET, name="Properties", name2="getProperties", addFlagsVtable=4) .parameters([iid=00000504-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::_ADO.

Implemented in msado15::_Command, and msado15::Command.

void msado15::Command15::setActiveConnection ( Variant ppvObject )

.method(vtoffset=7, dispid=1610809344, type=PROPPUT, name="ActiveConnection", name2="putActiveConnection", addFlagsVtable=4) .parameters([in,type=VARIANT] ppvObject)

Implemented in msado15::_Command, and msado15::Command.

void msado15::Command15::setActiveConnection ( msado15._Connection ppvObject )

.method(vtoffset=6, dispid=1610809344, type=PROPPUTREF, name="ActiveConnection", name2="putActiveConnection", addFlagsVtable=4) .parameters([in,iid=00000550-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] ppvObject)

Implemented in msado15::_Command, and msado15::Command.

void msado15::Command15::setCommandText ( String pbstr )

.method(vtoffset=9, dispid=1610809347, type=PROPPUT, name="CommandText", name2="putCommandText", addFlagsVtable=4) .parameters([in,type=STRING] pbstr)

Implemented in msado15::_Command, and msado15::Command.

void msado15::Command15::setCommandTimeout ( int pl )

.method(vtoffset=11, dispid=1610809349, type=PROPPUT, name="CommandTimeout", name2="putCommandTimeout", addFlagsVtable=4) .parameters([in,type=I4] pl)

Implemented in msado15::_Command, and msado15::Command.

void msado15::Command15::setCommandType ( int plCmdType )

.method(vtoffset=17, dispid=1610809356, type=PROPPUT, name="CommandType", name2="putCommandType", addFlagsVtable=4) .parameters([in,type=I4] plCmdType)

Implemented in msado15::_Command, and msado15::Command.

void msado15::Command15::setName ( String pbstrName )

.method(vtoffset=20, dispid=1610809358, type=PROPPUT, name="Name", name2="putName", addFlagsVtable=4) .parameters([in,type=STRING] pbstrName)

Implemented in msado15::_Command, and msado15::Command.

void msado15::Command15::setPrepared ( boolean pfPrepared )

.method(vtoffset=13, dispid=1610809351, type=PROPPUT, name="Prepared", name2="putPrepared", addFlagsVtable=4) .parameters([in,type=BOOLEAN] pfPrepared)

Implemented in msado15::_Command, and msado15::Command.

Member Data Documentation

final com.ms.com._Guid msado15::Command15::iid = new com.ms.com._Guid((int)0x508, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Implements msado15::_ADO.

Implemented in msado15::_Command, and msado15::Command.

Definition at line 91 of file Command15.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Command15.java
Generated on Wed Nov 13 2024 16:58:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::CommandTypeEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::CommandTypeEnum
Static Public Attributes

msado15::CommandTypeEnum Class Reference

List of all members.

Static Public Attributes

static final short | adCmdFile = 256
static final short | adCmdStoredProc = 4
static final short | adCmdTable = 2
static final short | adCmdTableDirect = 512
static final short | adCmdText = 1
static final short | adCmdUnknown = 8
static final short | adCmdUnspecified = -1
static final short | adCmdURLBind = 1024

Detailed Description

Definition at line 20 of file CommandTypeEnum.java.

Member Data Documentation

final short msado15::CommandTypeEnum::adCmdFile = 256 [static]

Definition at line 27 of file CommandTypeEnum.java.

final short msado15::CommandTypeEnum::adCmdStoredProc = 4 [static]

Definition at line 26 of file CommandTypeEnum.java.

final short msado15::CommandTypeEnum::adCmdTable = 2 [static]

Definition at line 25 of file CommandTypeEnum.java.

final short msado15::CommandTypeEnum::adCmdTableDirect = 512 [static]

Definition at line 28 of file CommandTypeEnum.java.

final short msado15::CommandTypeEnum::adCmdText = 1 [static]

Definition at line 24 of file CommandTypeEnum.java.

final short msado15::CommandTypeEnum::adCmdUnknown = 8 [static]

Definition at line 23 of file CommandTypeEnum.java.

final short msado15::CommandTypeEnum::adCmdUnspecified = -1 [static]

Definition at line 22 of file CommandTypeEnum.java.

final short msado15::CommandTypeEnum::adCmdURLBind = 1024 [static]

Definition at line 29 of file CommandTypeEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/CommandTypeEnum.java
Generated on Wed Nov 13 2024 16:58:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::CompareEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::CompareEnum
Static Public Attributes

msado15::CompareEnum Class Reference

List of all members.

Static Public Attributes

static final short | adCompareEqual = 1
static final short | adCompareGreaterThan = 2
static final short | adCompareLessThan = 0
static final short | adCompareNotComparable = 4
static final short | adCompareNotEqual = 3

Detailed Description

Definition at line 20 of file CompareEnum.java.

Member Data Documentation

final short msado15::CompareEnum::adCompareEqual = 1 [static]

Definition at line 23 of file CompareEnum.java.

final short msado15::CompareEnum::adCompareGreaterThan = 2 [static]

Definition at line 24 of file CompareEnum.java.

final short msado15::CompareEnum::adCompareLessThan = 0 [static]

Definition at line 22 of file CompareEnum.java.

final short msado15::CompareEnum::adCompareNotComparable = 4 [static]

Definition at line 26 of file CompareEnum.java.

final short msado15::CompareEnum::adCompareNotEqual = 3 [static]

Definition at line 25 of file CompareEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/CompareEnum.java
Generated on Wed Nov 13 2024 16:58:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::Connection Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::Connection
Public Member Functions | Static Public Attributes

msado15::Connection Class Reference

.class(classid=00000514-0000-0010-8000-00AA006D2EA4,DynamicCasts) .interface(iid=00000550-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)

Inherits com::ms::com::IUnknown, and msado15::_Connection.

List of all members.

Public Member Functions

native int | BeginTrans ()
native void | Cancel ()
native void | Close ()
native void | CommitTrans ()
native msado15._Recordset | Execute (String CommandText, Variant RecordsAffected, int Options)
native int | getAttributes ()
native int | getCommandTimeout ()
native String | getConnectionString ()
native int | getConnectionTimeout ()
native int | getCursorLocation ()
native String | getDefaultDatabase ()
native msado15.Errors | getErrors ()
native int | getIsolationLevel ()
native int | getMode ()
native msado15.Properties | getProperties ()
native String | getProvider ()
native int | getState ()
native String | getVersion ()
native void | Open (String ConnectionString, String UserID, String Password, int Options)
native msado15._Recordset | OpenSchema (int Schema, Variant Restrictions, Variant SchemaID)
native void | RollbackTrans ()
native void | setAttributes (int plAttr)
native void | setCommandTimeout (int plTimeout)
native void | setConnectionString (String pbstr)
native void | setConnectionTimeout (int plTimeout)
native void | setCursorLocation (int plCursorLoc)
native void | setDefaultDatabase (String pbstr)
native void | setIsolationLevel (int Level)
native void | setMode (int plMode)
native void | setProvider (String pbstr)

Static Public Attributes

static final com.ms.com._Guid | clsid = new com.ms.com._Guid((int)0x514, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)
static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x550, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)

Detailed Description

Definition at line 20 of file Connection.java.

Member Function Documentation

native int msado15::Connection::BeginTrans ( )

.method(vtoffset=14, dispid=7, type=METHOD, name="BeginTrans", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::_Connection.

native void msado15::Connection::Cancel ( )

.method(vtoffset=33, dispid=21, type=METHOD, name="Cancel", addFlagsVtable=4) .parameters()

Implements msado15::_Connection.

native void msado15::Connection::Close ( )

.method(vtoffset=12, dispid=5, type=METHOD, name="Close", addFlagsVtable=4) .parameters()

Implements msado15::_Connection.

native void msado15::Connection::CommitTrans ( )

.method(vtoffset=15, dispid=8, type=METHOD, name="CommitTrans", addFlagsVtable=4) .parameters()

Implements msado15::_Connection.

native msado15._Recordset msado15::Connection::Execute | ( | String | CommandText,
 |  | Variant | RecordsAffected,
 |  | int | Options
 | ) |  |

.method(vtoffset=13, dispid=6, type=METHOD, name="Execute", addFlagsVtable=4) .parameters([in,type=STRING] CommandText, [out,elementType=VARIANT,type=PTR] RecordsAffected, [in,type=I4] Options, [iid=00000556-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::_Connection.

native int msado15::Connection::getAttributes ( )

.method(vtoffset=23, dispid=14, type=PROPGET, name="Attributes", name2="getAttributes", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::_Connection.

native int msado15::Connection::getCommandTimeout ( )

.method(vtoffset=7, dispid=2, type=PROPGET, name="CommandTimeout", name2="getCommandTimeout", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::_Connection.

native String msado15::Connection::getConnectionString ( )

.method(vtoffset=5, dispid=0, type=PROPGET, name="ConnectionString", name2="getConnectionString", addFlagsVtable=4) .parameters([type=STRING] return)

Implements msado15::_Connection.

native int msado15::Connection::getConnectionTimeout ( )

.method(vtoffset=9, dispid=3, type=PROPGET, name="ConnectionTimeout", name2="getConnectionTimeout", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::_Connection.

native int msado15::Connection::getCursorLocation ( )

.method(vtoffset=25, dispid=15, type=PROPGET, name="CursorLocation", name2="getCursorLocation", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::_Connection.

native String msado15::Connection::getDefaultDatabase ( )

.method(vtoffset=19, dispid=12, type=PROPGET, name="DefaultDatabase", name2="getDefaultDatabase", addFlagsVtable=4) .parameters([type=STRING] return)

Implements msado15::_Connection.

native msado15.Errors msado15::Connection::getErrors ( )

.method(vtoffset=18, dispid=11, type=PROPGET, name="Errors", name2="getErrors", addFlagsVtable=4) .parameters([iid=00000501-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::_Connection.

native int msado15::Connection::getIsolationLevel ( )

.method(vtoffset=21, dispid=13, type=PROPGET, name="IsolationLevel", name2="getIsolationLevel", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::_Connection.

native int msado15::Connection::getMode ( )

.method(vtoffset=27, dispid=16, type=PROPGET, name="Mode", name2="getMode", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::_Connection.

native msado15.Properties msado15::Connection::getProperties ( )

.method(vtoffset=4, dispid=500, type=PROPGET, name="Properties", name2="getProperties", addFlagsVtable=4) .parameters([iid=00000504-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::_Connection.

native String msado15::Connection::getProvider ( )

.method(vtoffset=29, dispid=17, type=PROPGET, name="Provider", name2="getProvider", addFlagsVtable=4) .parameters([type=STRING] return)

Implements msado15::_Connection.

native int msado15::Connection::getState ( )

.method(vtoffset=31, dispid=18, type=PROPGET, name="State", name2="getState", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::_Connection.

native String msado15::Connection::getVersion ( )

.method(vtoffset=11, dispid=4, type=PROPGET, name="Version", name2="getVersion", addFlagsVtable=4) .parameters([type=STRING] return)

Implements msado15::_Connection.

native void msado15::Connection::Open | ( | String | ConnectionString,
 |  | String | UserID,
 |  | String | Password,
 |  | int | Options
 | ) |  |

.method(vtoffset=17, dispid=10, type=METHOD, name="Open", addFlagsVtable=4) .parameters([in,type=STRING] ConnectionString, [in,type=STRING] UserID, [in,type=STRING] Password, [in,type=I4] Options)

Implements msado15::_Connection.

native msado15._Recordset msado15::Connection::OpenSchema | ( | int | Schema,
 |  | Variant | Restrictions,
 |  | Variant | SchemaID
 | ) |  |

.method(vtoffset=32, dispid=19, type=METHOD, name="OpenSchema", addFlagsVtable=4) .parameters([in,type=I4] Schema, [in,type=VARIANT] Restrictions, [in,type=VARIANT] SchemaID, [iid=00000556-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::_Connection.

native void msado15::Connection::RollbackTrans ( )

.method(vtoffset=16, dispid=9, type=METHOD, name="RollbackTrans", addFlagsVtable=4) .parameters()

Implements msado15::_Connection.

native void msado15::Connection::setAttributes ( int plAttr )

.method(vtoffset=24, dispid=14, type=PROPPUT, name="Attributes", name2="putAttributes", addFlagsVtable=4) .parameters([in,type=I4] plAttr)

Implements msado15::_Connection.

native void msado15::Connection::setCommandTimeout ( int plTimeout )

.method(vtoffset=8, dispid=2, type=PROPPUT, name="CommandTimeout", name2="putCommandTimeout", addFlagsVtable=4) .parameters([in,type=I4] plTimeout)

Implements msado15::_Connection.

native void msado15::Connection::setConnectionString ( String pbstr )

.method(vtoffset=6, dispid=0, type=PROPPUT, name="ConnectionString", name2="putConnectionString", addFlagsVtable=4) .parameters([in,type=STRING] pbstr)

Implements msado15::_Connection.

native void msado15::Connection::setConnectionTimeout ( int plTimeout )

.method(vtoffset=10, dispid=3, type=PROPPUT, name="ConnectionTimeout", name2="putConnectionTimeout", addFlagsVtable=4) .parameters([in,type=I4] plTimeout)

Implements msado15::_Connection.

native void msado15::Connection::setCursorLocation ( int plCursorLoc )

.method(vtoffset=26, dispid=15, type=PROPPUT, name="CursorLocation", name2="putCursorLocation", addFlagsVtable=4) .parameters([in,type=I4] plCursorLoc)

Implements msado15::_Connection.

native void msado15::Connection::setDefaultDatabase ( String pbstr )

.method(vtoffset=20, dispid=12, type=PROPPUT, name="DefaultDatabase", name2="putDefaultDatabase", addFlagsVtable=4) .parameters([in,type=STRING] pbstr)

Implements msado15::_Connection.

native void msado15::Connection::setIsolationLevel ( int Level )

.method(vtoffset=22, dispid=13, type=PROPPUT, name="IsolationLevel", name2="putIsolationLevel", addFlagsVtable=4) .parameters([in,type=I4] Level)

Implements msado15::_Connection.

native void msado15::Connection::setMode ( int plMode )

.method(vtoffset=28, dispid=16, type=PROPPUT, name="Mode", name2="putMode", addFlagsVtable=4) .parameters([in,type=I4] plMode)

Implements msado15::_Connection.

native void msado15::Connection::setProvider ( String pbstr )

.method(vtoffset=30, dispid=17, type=PROPPUT, name="Provider", name2="putProvider", addFlagsVtable=4) .parameters([in,type=STRING] pbstr)

Implements msado15::_Connection.

Member Data Documentation

final com.ms.com._Guid msado15::Connection::clsid = new com.ms.com._Guid((int)0x514, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Definition at line 145 of file Connection.java.

final com.ms.com._Guid msado15::Connection::iid = new com.ms.com._Guid((int)0x550, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Implements msado15::_Connection.

Definition at line 143 of file Connection.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Connection.java
Generated on Wed Nov 13 2024 16:58:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::Connection15 Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::Connection15
Public Member Functions | Static Public Attributes

msado15::Connection15 Interface Reference

.interface(iid=00000515-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)

Inherits msado15::_ADO.

Inherited by msado15::_Connection.

List of all members.

Public Member Functions

int | BeginTrans ()
void | Close ()
void | CommitTrans ()
msado15._Recordset | Execute (String CommandText, Variant RecordsAffected, int Options)
int | getAttributes ()
int | getCommandTimeout ()
String | getConnectionString ()
int | getConnectionTimeout ()
int | getCursorLocation ()
String | getDefaultDatabase ()
msado15.Errors getErrors ()
int | getIsolationLevel ()
int | getMode ()
msado15.Properties getProperties ()
String | getProvider ()
int | getState ()
String | getVersion ()
void | Open (String ConnectionString, String UserID, String Password, int Options)
msado15._Recordset | OpenSchema (int Schema, Variant Restrictions, Variant SchemaID)
void | RollbackTrans ()
void | setAttributes (int plAttr)
void | setCommandTimeout (int plTimeout)
void | setConnectionString (String pbstr)
void | setConnectionTimeout (int plTimeout)
void | setCursorLocation (int plCursorLoc)
void | setDefaultDatabase (String pbstr)
void | setIsolationLevel (int Level)
void | setMode (int plMode)
void | setProvider (String pbstr)

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x515, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)

Detailed Description

Definition at line 20 of file Connection15.java.

Member Function Documentation

int msado15::Connection15::BeginTrans ( )

.method(vtoffset=14, dispid=7, type=METHOD, name="BeginTrans", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in msado15::_Connection, and msado15::Connection.

void msado15::Connection15::Close ( )

.method(vtoffset=12, dispid=5, type=METHOD, name="Close", addFlagsVtable=4) .parameters()

Implemented in msado15::_Connection, and msado15::Connection.

void msado15::Connection15::CommitTrans ( )

.method(vtoffset=15, dispid=8, type=METHOD, name="CommitTrans", addFlagsVtable=4) .parameters()

Implemented in msado15::_Connection, and msado15::Connection.

msado15._Recordset msado15::Connection15::Execute | ( | String | CommandText,
 |  | Variant | RecordsAffected,
 |  | int | Options
 | ) |  |

.method(vtoffset=13, dispid=6, type=METHOD, name="Execute", addFlagsVtable=4) .parameters([in,type=STRING] CommandText, [out,elementType=VARIANT,type=PTR] RecordsAffected, [in,type=I4] Options, [iid=00000556-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implemented in msado15::_Connection, and msado15::Connection.

int msado15::Connection15::getAttributes ( )

.method(vtoffset=23, dispid=14, type=PROPGET, name="Attributes", name2="getAttributes", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in msado15::_Connection, and msado15::Connection.

int msado15::Connection15::getCommandTimeout ( )

.method(vtoffset=7, dispid=2, type=PROPGET, name="CommandTimeout", name2="getCommandTimeout", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in msado15::_Connection, and msado15::Connection.

String msado15::Connection15::getConnectionString ( )

.method(vtoffset=5, dispid=0, type=PROPGET, name="ConnectionString", name2="getConnectionString", addFlagsVtable=4) .parameters([type=STRING] return)

Implemented in msado15::_Connection, and msado15::Connection.

int msado15::Connection15::getConnectionTimeout ( )

.method(vtoffset=9, dispid=3, type=PROPGET, name="ConnectionTimeout", name2="getConnectionTimeout", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in msado15::_Connection, and msado15::Connection.

int msado15::Connection15::getCursorLocation ( )

.method(vtoffset=25, dispid=15, type=PROPGET, name="CursorLocation", name2="getCursorLocation", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in msado15::_Connection, and msado15::Connection.

String msado15::Connection15::getDefaultDatabase ( )

.method(vtoffset=19, dispid=12, type=PROPGET, name="DefaultDatabase", name2="getDefaultDatabase", addFlagsVtable=4) .parameters([type=STRING] return)

Implemented in msado15::_Connection, and msado15::Connection.

msado15.Errors msado15::Connection15::getErrors ( )

.method(vtoffset=18, dispid=11, type=PROPGET, name="Errors", name2="getErrors", addFlagsVtable=4) .parameters([iid=00000501-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implemented in msado15::_Connection, and msado15::Connection.

int msado15::Connection15::getIsolationLevel ( )

.method(vtoffset=21, dispid=13, type=PROPGET, name="IsolationLevel", name2="getIsolationLevel", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in msado15::_Connection, and msado15::Connection.

int msado15::Connection15::getMode ( )

.method(vtoffset=27, dispid=16, type=PROPGET, name="Mode", name2="getMode", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in msado15::_Connection, and msado15::Connection.

msado15.Properties msado15::Connection15::getProperties ( )

.method(vtoffset=4, dispid=500, type=PROPGET, name="Properties", name2="getProperties", addFlagsVtable=4) .parameters([iid=00000504-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::_ADO.

Implemented in msado15::_Connection, and msado15::Connection.

String msado15::Connection15::getProvider ( )

.method(vtoffset=29, dispid=17, type=PROPGET, name="Provider", name2="getProvider", addFlagsVtable=4) .parameters([type=STRING] return)

Implemented in msado15::_Connection, and msado15::Connection.

int msado15::Connection15::getState ( )

.method(vtoffset=31, dispid=18, type=PROPGET, name="State", name2="getState", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in msado15::_Connection, and msado15::Connection.

String msado15::Connection15::getVersion ( )

.method(vtoffset=11, dispid=4, type=PROPGET, name="Version", name2="getVersion", addFlagsVtable=4) .parameters([type=STRING] return)

Implemented in msado15::_Connection, and msado15::Connection.

void msado15::Connection15::Open | ( | String | ConnectionString,
 |  | String | UserID,
 |  | String | Password,
 |  | int | Options
 | ) |  |

.method(vtoffset=17, dispid=10, type=METHOD, name="Open", addFlagsVtable=4) .parameters([in,type=STRING] ConnectionString, [in,type=STRING] UserID, [in,type=STRING] Password, [in,type=I4] Options)

Implemented in msado15::_Connection, and msado15::Connection.

msado15._Recordset msado15::Connection15::OpenSchema | ( | int | Schema,
 |  | Variant | Restrictions,
 |  | Variant | SchemaID
 | ) |  |

.method(vtoffset=32, dispid=19, type=METHOD, name="OpenSchema", addFlagsVtable=4) .parameters([in,type=I4] Schema, [in,type=VARIANT] Restrictions, [in,type=VARIANT] SchemaID, [iid=00000556-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implemented in msado15::_Connection, and msado15::Connection.

void msado15::Connection15::RollbackTrans ( )

.method(vtoffset=16, dispid=9, type=METHOD, name="RollbackTrans", addFlagsVtable=4) .parameters()

Implemented in msado15::_Connection, and msado15::Connection.

void msado15::Connection15::setAttributes ( int plAttr )

.method(vtoffset=24, dispid=14, type=PROPPUT, name="Attributes", name2="putAttributes", addFlagsVtable=4) .parameters([in,type=I4] plAttr)

Implemented in msado15::_Connection, and msado15::Connection.

void msado15::Connection15::setCommandTimeout ( int plTimeout )

.method(vtoffset=8, dispid=2, type=PROPPUT, name="CommandTimeout", name2="putCommandTimeout", addFlagsVtable=4) .parameters([in,type=I4] plTimeout)

Implemented in msado15::_Connection, and msado15::Connection.

void msado15::Connection15::setConnectionString ( String pbstr )

.method(vtoffset=6, dispid=0, type=PROPPUT, name="ConnectionString", name2="putConnectionString", addFlagsVtable=4) .parameters([in,type=STRING] pbstr)

Implemented in msado15::_Connection, and msado15::Connection.

void msado15::Connection15::setConnectionTimeout ( int plTimeout )

.method(vtoffset=10, dispid=3, type=PROPPUT, name="ConnectionTimeout", name2="putConnectionTimeout", addFlagsVtable=4) .parameters([in,type=I4] plTimeout)

Implemented in msado15::_Connection, and msado15::Connection.

void msado15::Connection15::setCursorLocation ( int plCursorLoc )

.method(vtoffset=26, dispid=15, type=PROPPUT, name="CursorLocation", name2="putCursorLocation", addFlagsVtable=4) .parameters([in,type=I4] plCursorLoc)

Implemented in msado15::_Connection, and msado15::Connection.

void msado15::Connection15::setDefaultDatabase ( String pbstr )

.method(vtoffset=20, dispid=12, type=PROPPUT, name="DefaultDatabase", name2="putDefaultDatabase", addFlagsVtable=4) .parameters([in,type=STRING] pbstr)

Implemented in msado15::_Connection, and msado15::Connection.

void msado15::Connection15::setIsolationLevel ( int Level )

.method(vtoffset=22, dispid=13, type=PROPPUT, name="IsolationLevel", name2="putIsolationLevel", addFlagsVtable=4) .parameters([in,type=I4] Level)

Implemented in msado15::_Connection, and msado15::Connection.

void msado15::Connection15::setMode ( int plMode )

.method(vtoffset=28, dispid=16, type=PROPPUT, name="Mode", name2="putMode", addFlagsVtable=4) .parameters([in,type=I4] plMode)

Implemented in msado15::_Connection, and msado15::Connection.

void msado15::Connection15::setProvider ( String pbstr )

.method(vtoffset=30, dispid=17, type=PROPPUT, name="Provider", name2="putProvider", addFlagsVtable=4) .parameters([in,type=STRING] pbstr)

Implemented in msado15::_Connection, and msado15::Connection.

Member Data Documentation

final com.ms.com._Guid msado15::Connection15::iid = new com.ms.com._Guid((int)0x515, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Implements msado15::_ADO.

Implemented in msado15::_Connection, and msado15::Connection.

Definition at line 139 of file Connection15.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Connection15.java
Generated on Wed Nov 13 2024 16:58:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::ConnectionEvents Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::ConnectionEvents
Public Member Functions | Static Public Attributes

msado15::ConnectionEvents Interface Reference

.interface(iid=00000400-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DISPATCH)

Inherits com::ms::com::IUnknown.

List of all members.

Public Member Functions

void | BeginTransComplete (int TransactionLevel, msado15.Error pError, int[] adStatus, msado15._Connection pConnection)
void | CommitTransComplete (msado15.Error pError, int[] adStatus, msado15._Connection pConnection)
void | ConnectComplete (msado15.Error pError, int[] adStatus, msado15._Connection pConnection)
void | Disconnect (int[] adStatus, msado15._Connection pConnection)
void | ExecuteComplete (int RecordsAffected, msado15.Error pError, int[] adStatus, msado15._Command pCommand, msado15._Recordset pRecordset, msado15._Connection pConnection)
void | InfoMessage (msado15.Error pError, int[] adStatus, msado15._Connection pConnection)
void | RollbackTransComplete (msado15.Error pError, int[] adStatus, msado15._Connection pConnection)
void | WillConnect (String[] ConnectionString, String[] UserID, String[] Password, int[] Options, int[] adStatus, msado15._Connection pConnection)
void | WillExecute (String[] Source, int[] CursorType, int[] LockType, int[] Options, int[] adStatus, msado15._Command pCommand, msado15._Recordset pRecordset, msado15._Connection pConnection)

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x400, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)

Detailed Description

Definition at line 20 of file ConnectionEvents.java.

Member Function Documentation

void msado15::ConnectionEvents::BeginTransComplete | ( | int | TransactionLevel,
 |  | msado15.Error | pError,
 |  | int[] | adStatus,
 |  | msado15._Connection | pConnection
 | ) |  |

.method(dispid=1, type=METHOD, name="BeginTransComplete") .parameters([in,type=I4] TransactionLevel, [in,type=DISPATCH] pError, [in,out,elementType=I4,type=PTR] adStatus, [in,type=DISPATCH] pConnection)

void msado15::ConnectionEvents::CommitTransComplete | ( | msado15.Error | pError,
 |  | int[] | adStatus,
 |  | msado15._Connection | pConnection
 | ) |  |

.method(dispid=3, type=METHOD, name="CommitTransComplete") .parameters([in,type=DISPATCH] pError, [in,out,elementType=I4,type=PTR] adStatus, [in,type=DISPATCH] pConnection)

void msado15::ConnectionEvents::ConnectComplete | ( | msado15.Error | pError,
 |  | int[] | adStatus,
 |  | msado15._Connection | pConnection
 | ) |  |

.method(dispid=7, type=METHOD, name="ConnectComplete") .parameters([in,type=DISPATCH] pError, [in,out,elementType=I4,type=PTR] adStatus, [in,type=DISPATCH] pConnection)

void msado15::ConnectionEvents::Disconnect | ( | int[] | adStatus,
 |  | msado15._Connection | pConnection
 | ) |  |

.method(dispid=8, type=METHOD, name="Disconnect") .parameters([in,out,elementType=I4,type=PTR] adStatus, [in,type=DISPATCH] pConnection)

void msado15::ConnectionEvents::ExecuteComplete | ( | int | RecordsAffected,
 |  | msado15.Error | pError,
 |  | int[] | adStatus,
 |  | msado15._Command | pCommand,
 |  | msado15._Recordset | pRecordset,
 |  | msado15._Connection | pConnection
 | ) |  |

.method(dispid=5, type=METHOD, name="ExecuteComplete") .parameters([in,type=I4] RecordsAffected, [in,type=DISPATCH] pError, [in,out,elementType=I4,type=PTR] adStatus, [in,type=DISPATCH] pCommand, [in,type=DISPATCH] pRecordset, [in,type=DISPATCH] pConnection)

void msado15::ConnectionEvents::InfoMessage | ( | msado15.Error | pError,
 |  | int[] | adStatus,
 |  | msado15._Connection | pConnection
 | ) |  |

.method(dispid=0, type=METHOD, name="InfoMessage") .parameters([in,type=DISPATCH] pError, [in,out,elementType=I4,type=PTR] adStatus, [in,type=DISPATCH] pConnection)

void msado15::ConnectionEvents::RollbackTransComplete | ( | msado15.Error | pError,
 |  | int[] | adStatus,
 |  | msado15._Connection | pConnection
 | ) |  |

.method(dispid=2, type=METHOD, name="RollbackTransComplete") .parameters([in,type=DISPATCH] pError, [in,out,elementType=I4,type=PTR] adStatus, [in,type=DISPATCH] pConnection)

void msado15::ConnectionEvents::WillConnect | ( | String[] | ConnectionString,
 |  | String[] | UserID,
 |  | String[] | Password,
 |  | int[] | Options,
 |  | int[] | adStatus,
 |  | msado15._Connection | pConnection
 | ) |  |

.method(dispid=6, type=METHOD, name="WillConnect") .parameters([in,out,elementType=STRING,type=ARRAY] ConnectionString, [in,out,elementType=STRING,type=ARRAY] UserID, [in,out,elementType=STRING,type=ARRAY] Password, [in,out,elementType=I4,type=ARRAY] Options, [in,out,elementType=I4,type=PTR] adStatus, [in,type=DISPATCH] pConnection)

void msado15::ConnectionEvents::WillExecute | ( | String[] | Source,
 |  | int[] | CursorType,
 |  | int[] | LockType,
 |  | int[] | Options,
 |  | int[] | adStatus,
 |  | msado15._Command | pCommand,
 |  | msado15._Recordset | pRecordset,
 |  | msado15._Connection | pConnection
 | ) |  |

.method(dispid=4, type=METHOD, name="WillExecute") .parameters([in,out,elementType=STRING,type=ARRAY] Source, [in,out,elementType=I4,type=PTR] CursorType, [in,out,elementType=I4,type=PTR] LockType, [in,out,elementType=I4,type=ARRAY] Options, [in,out,elementType=I4,type=PTR] adStatus, [in,type=DISPATCH] pCommand, [in,type=DISPATCH] pRecordset, [in,type=DISPATCH] pConnection)

Member Data Documentation

final com.ms.com._Guid msado15::ConnectionEvents::iid = new com.ms.com._Guid((int)0x400, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Definition at line 59 of file ConnectionEvents.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ConnectionEvents.java
Generated on Wed Nov 13 2024 16:58:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::ConnectionEventsVt Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::ConnectionEventsVt
Public Member Functions | Static Public Attributes

msado15::ConnectionEventsVt Interface Reference

.interface(iid=00000402-0000-0010-8000-00AA006D2EA4, thread=AUTO)

Inherits com::ms::com::IUnknown.

List of all members.

Public Member Functions

void | BeginTransComplete (int TransactionLevel, msado15.Error pError, int[] adStatus, msado15._Connection pConnection)
void | CommitTransComplete (msado15.Error pError, int[] adStatus, msado15._Connection pConnection)
void | ConnectComplete (msado15.Error pError, int[] adStatus, msado15._Connection pConnection)
void | Disconnect (int[] adStatus, msado15._Connection pConnection)
void | ExecuteComplete (int RecordsAffected, msado15.Error pError, int[] adStatus, msado15._Command pCommand, msado15._Recordset pRecordset, msado15._Connection pConnection)
void | InfoMessage (msado15.Error pError, int[] adStatus, msado15._Connection pConnection)
void | RollbackTransComplete (msado15.Error pError, int[] adStatus, msado15._Connection pConnection)
void | WillConnect (String[] ConnectionString, String[] UserID, String[] Password, int[] Options, int[] adStatus, msado15._Connection pConnection)
void | WillExecute (String[] Source, int[] CursorType, int[] LockType, int[] Options, int[] adStatus, msado15._Command pCommand, msado15._Recordset pRecordset, msado15._Connection pConnection)

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x402, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)

Detailed Description

Definition at line 20 of file ConnectionEventsVt.java.

Member Function Documentation

void msado15::ConnectionEventsVt::BeginTransComplete | ( | int | TransactionLevel,
 |  | msado15.Error | pError,
 |  | int[] | adStatus,
 |  | msado15._Connection | pConnection
 | ) |  |

.method(vtoffset=1, addFlagsVtable=4) .parameters([in,type=I4] TransactionLevel, [in,iid=00000500-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] pError, [in,out,type=PTR] adStatus, [in,iid=00000550-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] pConnection)

void msado15::ConnectionEventsVt::CommitTransComplete | ( | msado15.Error | pError,
 |  | int[] | adStatus,
 |  | msado15._Connection | pConnection
 | ) |  |

.method(vtoffset=2, addFlagsVtable=4) .parameters([in,iid=00000500-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] pError, [in,out,type=PTR] adStatus, [in,iid=00000550-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] pConnection)

void msado15::ConnectionEventsVt::ConnectComplete | ( | msado15.Error | pError,
 |  | int[] | adStatus,
 |  | msado15._Connection | pConnection
 | ) |  |

.method(vtoffset=7, addFlagsVtable=4) .parameters([in,iid=00000500-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] pError, [in,out,type=PTR] adStatus, [in,iid=00000550-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] pConnection)

void msado15::ConnectionEventsVt::Disconnect | ( | int[] | adStatus,
 |  | msado15._Connection | pConnection
 | ) |  |

.method(vtoffset=8, addFlagsVtable=4) .parameters([in,out,type=PTR] adStatus, [in,iid=00000550-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] pConnection)

void msado15::ConnectionEventsVt::ExecuteComplete | ( | int | RecordsAffected,
 |  | msado15.Error | pError,
 |  | int[] | adStatus,
 |  | msado15._Command | pCommand,
 |  | msado15._Recordset | pRecordset,
 |  | msado15._Connection | pConnection
 | ) |  |

.method(vtoffset=5, addFlagsVtable=4) .parameters([in,type=I4] RecordsAffected, [in,iid=00000500-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] pError, [in,out,type=PTR] adStatus, [in,iid=0000054E-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] pCommand, [in,iid=00000556-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] pRecordset, [in,iid=00000550-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] pConnection)

void msado15::ConnectionEventsVt::InfoMessage | ( | msado15.Error | pError,
 |  | int[] | adStatus,
 |  | msado15._Connection | pConnection
 | ) |  |

.method(vtoffset=0, addFlagsVtable=4) .parameters([in,iid=00000500-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] pError, [in,out,type=PTR] adStatus, [in,iid=00000550-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] pConnection)

void msado15::ConnectionEventsVt::RollbackTransComplete | ( | msado15.Error | pError,
 |  | int[] | adStatus,
 |  | msado15._Connection | pConnection
 | ) |  |

.method(vtoffset=3, addFlagsVtable=4) .parameters([in,iid=00000500-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] pError, [in,out,type=PTR] adStatus, [in,iid=00000550-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] pConnection)

void msado15::ConnectionEventsVt::WillConnect | ( | String[] | ConnectionString,
 |  | String[] | UserID,
 |  | String[] | Password,
 |  | int[] | Options,
 |  | int[] | adStatus,
 |  | msado15._Connection | pConnection
 | ) |  |

.method(vtoffset=6, addFlagsVtable=4) .parameters([in,out,size=1,type=ARRAY] ConnectionString, [in,out,size=1,type=ARRAY] UserID, [in,out,size=1,type=ARRAY] Password, [in,out,size=1,type=ARRAY] Options, [in,out,type=PTR] adStatus, [in,iid=00000550-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] pConnection)

void msado15::ConnectionEventsVt::WillExecute | ( | String[] | Source,
 |  | int[] | CursorType,
 |  | int[] | LockType,
 |  | int[] | Options,
 |  | int[] | adStatus,
 |  | msado15._Command | pCommand,
 |  | msado15._Recordset | pRecordset,
 |  | msado15._Connection | pConnection
 | ) |  |

.method(vtoffset=4, addFlagsVtable=4) .parameters([in,out,size=1,type=ARRAY] Source, [in,out,type=PTR] CursorType, [in,out,type=PTR] LockType, [in,out,size=1,type=ARRAY] Options, [in,out,type=PTR] adStatus, [in,iid=0000054E-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] pCommand, [in,iid=00000556-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] pRecordset, [in,iid=00000550-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] pConnection)

Member Data Documentation

final com.ms.com._Guid msado15::ConnectionEventsVt::iid = new com.ms.com._Guid((int)0x402, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Definition at line 59 of file ConnectionEventsVt.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ConnectionEventsVt.java
Generated on Wed Nov 13 2024 16:58:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::ConnectModeEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::ConnectModeEnum
Static Public Attributes

msado15::ConnectModeEnum Class Reference

List of all members.

Static Public Attributes

static final short | adModeRead = 1
static final short | adModeReadWrite = 3
static final short | adModeRecursive = 32
static final short | adModeShareDenyNone = 16
static final short | adModeShareDenyRead = 4
static final short | adModeShareDenyWrite = 8
static final short | adModeShareExclusive = 12
static final short | adModeUnknown = 0
static final short | adModeWrite = 2
static final short | adoModeRead = 1
static final short | adoModeReadWrite = 3
static final short | adoModeRecursive = 32
static final short | adoModeShareDenyRead = 4
static final short | adoModeShareDenyWrite = 8
static final short | adoModeShareExclusive = 12
static final short | adoModeShareNone = 16
static final short | adoModeUnknown = 0
static final short | adoModeWrite = 2

Detailed Description

Definition at line 20 of file ConnectModeEnum.java.

Member Data Documentation

final short msado15::ConnectModeEnum::adModeRead = 1 [static]

Definition at line 23 of file ConnectModeEnum.java.

final short msado15::ConnectModeEnum::adModeReadWrite = 3 [static]

Definition at line 25 of file ConnectModeEnum.java.

final short msado15::ConnectModeEnum::adModeRecursive = 32 [static]

Definition at line 30 of file ConnectModeEnum.java.

final short msado15::ConnectModeEnum::adModeShareDenyNone = 16 [static]

Definition at line 29 of file ConnectModeEnum.java.

final short msado15::ConnectModeEnum::adModeShareDenyRead = 4 [static]

Definition at line 26 of file ConnectModeEnum.java.

final short msado15::ConnectModeEnum::adModeShareDenyWrite = 8 [static]

Definition at line 27 of file ConnectModeEnum.java.

final short msado15::ConnectModeEnum::adModeShareExclusive = 12 [static]

Definition at line 28 of file ConnectModeEnum.java.

final short msado15::ConnectModeEnum::adModeUnknown = 0 [static]

Definition at line 22 of file ConnectModeEnum.java.

final short msado15::ConnectModeEnum::adModeWrite = 2 [static]

Definition at line 24 of file ConnectModeEnum.java.

final short msado15::ConnectModeEnum::adoModeRead = 1 [static]

Definition at line 32 of file ConnectModeEnum.java.

final short msado15::ConnectModeEnum::adoModeReadWrite = 3 [static]

Definition at line 34 of file ConnectModeEnum.java.

final short msado15::ConnectModeEnum::adoModeRecursive = 32 [static]

Definition at line 39 of file ConnectModeEnum.java.

final short msado15::ConnectModeEnum::adoModeShareDenyRead = 4 [static]

Definition at line 35 of file ConnectModeEnum.java.

final short msado15::ConnectModeEnum::adoModeShareDenyWrite = 8 [static]

Definition at line 36 of file ConnectModeEnum.java.

final short msado15::ConnectModeEnum::adoModeShareExclusive = 12 [static]

Definition at line 37 of file ConnectModeEnum.java.

final short msado15::ConnectModeEnum::adoModeShareNone = 16 [static]

Definition at line 38 of file ConnectModeEnum.java.

final short msado15::ConnectModeEnum::adoModeUnknown = 0 [static]

Definition at line 31 of file ConnectModeEnum.java.

final short msado15::ConnectModeEnum::adoModeWrite = 2 [static]

Definition at line 33 of file ConnectModeEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ConnectModeEnum.java
Generated on Wed Nov 13 2024 16:58:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::ConnectOptionEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::ConnectOptionEnum
Static Public Attributes

msado15::ConnectOptionEnum Class Reference

List of all members.

Static Public Attributes

static final short | adAsyncConnect = 16
static final short | adConnectUnspecified = -1

Detailed Description

Definition at line 20 of file ConnectOptionEnum.java.

Member Data Documentation

final short msado15::ConnectOptionEnum::adAsyncConnect = 16 [static]

Definition at line 23 of file ConnectOptionEnum.java.

final short msado15::ConnectOptionEnum::adConnectUnspecified = -1 [static]

Definition at line 22 of file ConnectOptionEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ConnectOptionEnum.java
Generated on Wed Nov 13 2024 16:58:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::ConnectPromptEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::ConnectPromptEnum
Static Public Attributes

msado15::ConnectPromptEnum Class Reference

List of all members.

Static Public Attributes

static final short | adPromptAlways = 1
static final short | adPromptComplete = 2
static final short | adPromptCompleteRequired = 3
static final short | adPromptNever = 4

Detailed Description

Definition at line 20 of file ConnectPromptEnum.java.

Member Data Documentation

final short msado15::ConnectPromptEnum::adPromptAlways = 1 [static]

Definition at line 22 of file ConnectPromptEnum.java.

final short msado15::ConnectPromptEnum::adPromptComplete = 2 [static]

Definition at line 23 of file ConnectPromptEnum.java.

final short msado15::ConnectPromptEnum::adPromptCompleteRequired = 3 [static]

Definition at line 24 of file ConnectPromptEnum.java.

final short msado15::ConnectPromptEnum::adPromptNever = 4 [static]

Definition at line 25 of file ConnectPromptEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ConnectPromptEnum.java
Generated on Wed Nov 13 2024 16:58:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::CopyRecordOptionsEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::CopyRecordOptionsEnum
Static Public Attributes

msado15::CopyRecordOptionsEnum Class Reference

List of all members.

Static Public Attributes

static final short | adCopyAllowEmulation = 4
static final short | adCopyNonRecursive = 2
static final short | adCopyOverWrite = 1

Detailed Description

Definition at line 20 of file CopyRecordOptionsEnum.java.

Member Data Documentation

final short msado15::CopyRecordOptionsEnum::adCopyAllowEmulation = 4 [static]

Definition at line 23 of file CopyRecordOptionsEnum.java.

final short msado15::CopyRecordOptionsEnum::adCopyNonRecursive = 2 [static]

Definition at line 24 of file CopyRecordOptionsEnum.java.

final short msado15::CopyRecordOptionsEnum::adCopyOverWrite = 1 [static]

Definition at line 22 of file CopyRecordOptionsEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/CopyRecordOptionsEnum.java
Generated on Wed Nov 13 2024 16:58:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::CursorLocationEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::CursorLocationEnum
Static Public Attributes

msado15::CursorLocationEnum Class Reference

List of all members.

Static Public Attributes

static final short | adUseClient = 3
static final short | adUseClientBatch = 3
static final short | adUseNone = 1
static final short | adUseServer = 2

Detailed Description

Definition at line 20 of file CursorLocationEnum.java.

Member Data Documentation

final short msado15::CursorLocationEnum::adUseClient = 3 [static]

Definition at line 24 of file CursorLocationEnum.java.

final short msado15::CursorLocationEnum::adUseClientBatch = 3 [static]

Definition at line 25 of file CursorLocationEnum.java.

final short msado15::CursorLocationEnum::adUseNone = 1 [static]

Definition at line 22 of file CursorLocationEnum.java.

final short msado15::CursorLocationEnum::adUseServer = 2 [static]

Definition at line 23 of file CursorLocationEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/CursorLocationEnum.java
Generated on Wed Nov 13 2024 16:58:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::CursorOptionEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::CursorOptionEnum
Static Public Attributes

msado15::CursorOptionEnum Class Reference

List of all members.

Static Public Attributes

static final int | adAddNew = 16778240
static final int | adApproxPosition = 16384
static final int | adBookmark = 8192
static final int | adDelete = 16779264
static final int | adFind = 524288
static final int | adHoldRecords = 256
static final int | adIndex = 8388608
static final int | adMovePrevious = 512
static final int | adNotify = 262144
static final int | adResync = 131072
static final int | adSeek = 4194304
static final int | adUpdate = 16809984
static final int | adUpdateBatch = 65536

Detailed Description

Definition at line 20 of file CursorOptionEnum.java.

Member Data Documentation

final int msado15::CursorOptionEnum::adAddNew = 16778240 [static]

Definition at line 24 of file CursorOptionEnum.java.

final int msado15::CursorOptionEnum::adApproxPosition = 16384 [static]

Definition at line 28 of file CursorOptionEnum.java.

final int msado15::CursorOptionEnum::adBookmark = 8192 [static]

Definition at line 27 of file CursorOptionEnum.java.

final int msado15::CursorOptionEnum::adDelete = 16779264 [static]

Definition at line 25 of file CursorOptionEnum.java.

final int msado15::CursorOptionEnum::adFind = 524288 [static]

Definition at line 32 of file CursorOptionEnum.java.

final int msado15::CursorOptionEnum::adHoldRecords = 256 [static]

Definition at line 22 of file CursorOptionEnum.java.

final int msado15::CursorOptionEnum::adIndex = 8388608 [static]

Definition at line 34 of file CursorOptionEnum.java.

final int msado15::CursorOptionEnum::adMovePrevious = 512 [static]

Definition at line 23 of file CursorOptionEnum.java.

final int msado15::CursorOptionEnum::adNotify = 262144 [static]

Definition at line 31 of file CursorOptionEnum.java.

final int msado15::CursorOptionEnum::adResync = 131072 [static]

Definition at line 30 of file CursorOptionEnum.java.

final int msado15::CursorOptionEnum::adSeek = 4194304 [static]

Definition at line 33 of file CursorOptionEnum.java.

final int msado15::CursorOptionEnum::adUpdate = 16809984 [static]

Definition at line 26 of file CursorOptionEnum.java.

final int msado15::CursorOptionEnum::adUpdateBatch = 65536 [static]

Definition at line 29 of file CursorOptionEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/CursorOptionEnum.java
Generated on Wed Nov 13 2024 16:58:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::CursorTypeEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::CursorTypeEnum
Static Public Attributes

msado15::CursorTypeEnum Class Reference

List of all members.

Static Public Attributes

static final short | adOpenDynamic = 2
static final short | adOpenForwardOnly = 0
static final short | adOpenKeyset = 1
static final short | adOpenStatic = 3
static final short | adOpenUnspecified = -1

Detailed Description

Definition at line 20 of file CursorTypeEnum.java.

Member Data Documentation

final short msado15::CursorTypeEnum::adOpenDynamic = 2 [static]

Definition at line 25 of file CursorTypeEnum.java.

final short msado15::CursorTypeEnum::adOpenForwardOnly = 0 [static]

Definition at line 23 of file CursorTypeEnum.java.

final short msado15::CursorTypeEnum::adOpenKeyset = 1 [static]

Definition at line 24 of file CursorTypeEnum.java.

final short msado15::CursorTypeEnum::adOpenStatic = 3 [static]

Definition at line 26 of file CursorTypeEnum.java.

final short msado15::CursorTypeEnum::adOpenUnspecified = -1 [static]

Definition at line 22 of file CursorTypeEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/CursorTypeEnum.java
Generated on Wed Nov 13 2024 16:58:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::DataTypeEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::DataTypeEnum
Static Public Attributes

msado15::DataTypeEnum Class Reference

List of all members.

Static Public Attributes

static final short | adBigInt = 20
static final short | adBinary = 128
static final short | adBoolean = 11
static final short | adBSTR = 8
static final short | adChapter = 136
static final short | adChar = 129
static final short | adCurrency = 6
static final short | adDate = 7
static final short | adDBDate = 133
static final short | adDBFileTime = 137
static final short | adDBTime = 134
static final short | adDBTimeStamp = 135
static final short | adDecimal = 14
static final short | adDouble = 5
static final short | adEmpty = 0
static final short | adError = 10
static final short | adFileTime = 64
static final short | adGUID = 72
static final short | adIDispatch = 9
static final short | adInteger = 3
static final short | adIUnknown = 13
static final short | adLongVarBinary = 205
static final short | adLongVarChar = 201
static final short | adLongVarWChar = 203
static final short | adNumeric = 131
static final short | adPropVariant = 138
static final short | adSingle = 4
static final short | adSmallInt = 2
static final short | adTinyInt = 16
static final short | adUnsignedBigInt = 21
static final short | adUnsignedInt = 19
static final short | adUnsignedSmallInt = 18
static final short | adUnsignedTinyInt = 17
static final short | adUserDefined = 132
static final short | adVarBinary = 204
static final short | adVarChar = 200
static final short | adVariant = 12
static final short | adVarNumeric = 139
static final short | adVarWChar = 202
static final short | adWChar = 130

Detailed Description

Definition at line 20 of file DataTypeEnum.java.

Member Data Documentation

final short msado15::DataTypeEnum::adBigInt = 20 [static]

Definition at line 26 of file DataTypeEnum.java.

final short msado15::DataTypeEnum::adBinary = 128 [static]

Definition at line 54 of file DataTypeEnum.java.

final short msado15::DataTypeEnum::adBoolean = 11 [static]

Definition at line 36 of file DataTypeEnum.java.

final short msado15::DataTypeEnum::adBSTR = 8 [static]

Definition at line 47 of file DataTypeEnum.java.

final short msado15::DataTypeEnum::adChapter = 136 [static]

Definition at line 57 of file DataTypeEnum.java.

final short msado15::DataTypeEnum::adChar = 129 [static]

Definition at line 48 of file DataTypeEnum.java.

final short msado15::DataTypeEnum::adCurrency = 6 [static]

Definition at line 33 of file DataTypeEnum.java.

final short msado15::DataTypeEnum::adDate = 7 [static]

Definition at line 43 of file DataTypeEnum.java.

final short msado15::DataTypeEnum::adDBDate = 133 [static]

Definition at line 44 of file DataTypeEnum.java.

final short msado15::DataTypeEnum::adDBFileTime = 137 [static]

Definition at line 59 of file DataTypeEnum.java.

final short msado15::DataTypeEnum::adDBTime = 134 [static]

Definition at line 45 of file DataTypeEnum.java.

final short msado15::DataTypeEnum::adDBTimeStamp = 135 [static]

Definition at line 46 of file DataTypeEnum.java.

final short msado15::DataTypeEnum::adDecimal = 14 [static]

Definition at line 34 of file DataTypeEnum.java.

final short msado15::DataTypeEnum::adDouble = 5 [static]

Definition at line 32 of file DataTypeEnum.java.

final short msado15::DataTypeEnum::adEmpty = 0 [static]

Definition at line 22 of file DataTypeEnum.java.

final short msado15::DataTypeEnum::adError = 10 [static]

Definition at line 37 of file DataTypeEnum.java.

final short msado15::DataTypeEnum::adFileTime = 64 [static]

Definition at line 58 of file DataTypeEnum.java.

final short msado15::DataTypeEnum::adGUID = 72 [static]

Definition at line 42 of file DataTypeEnum.java.

final short msado15::DataTypeEnum::adIDispatch = 9 [static]

Definition at line 40 of file DataTypeEnum.java.

final short msado15::DataTypeEnum::adInteger = 3 [static]

Definition at line 25 of file DataTypeEnum.java.

final short msado15::DataTypeEnum::adIUnknown = 13 [static]

Definition at line 41 of file DataTypeEnum.java.

final short msado15::DataTypeEnum::adLongVarBinary = 205 [static]

Definition at line 56 of file DataTypeEnum.java.

final short msado15::DataTypeEnum::adLongVarChar = 201 [static]

Definition at line 50 of file DataTypeEnum.java.

final short msado15::DataTypeEnum::adLongVarWChar = 203 [static]

Definition at line 53 of file DataTypeEnum.java.

final short msado15::DataTypeEnum::adNumeric = 131 [static]

Definition at line 35 of file DataTypeEnum.java.

final short msado15::DataTypeEnum::adPropVariant = 138 [static]

Definition at line 60 of file DataTypeEnum.java.

final short msado15::DataTypeEnum::adSingle = 4 [static]

Definition at line 31 of file DataTypeEnum.java.

final short msado15::DataTypeEnum::adSmallInt = 2 [static]

Definition at line 24 of file DataTypeEnum.java.

final short msado15::DataTypeEnum::adTinyInt = 16 [static]

Definition at line 23 of file DataTypeEnum.java.

final short msado15::DataTypeEnum::adUnsignedBigInt = 21 [static]

Definition at line 30 of file DataTypeEnum.java.

final short msado15::DataTypeEnum::adUnsignedInt = 19 [static]

Definition at line 29 of file DataTypeEnum.java.

final short msado15::DataTypeEnum::adUnsignedSmallInt = 18 [static]

Definition at line 28 of file DataTypeEnum.java.

final short msado15::DataTypeEnum::adUnsignedTinyInt = 17 [static]

Definition at line 27 of file DataTypeEnum.java.

final short msado15::DataTypeEnum::adUserDefined = 132 [static]

Definition at line 38 of file DataTypeEnum.java.

final short msado15::DataTypeEnum::adVarBinary = 204 [static]

Definition at line 55 of file DataTypeEnum.java.

final short msado15::DataTypeEnum::adVarChar = 200 [static]

Definition at line 49 of file DataTypeEnum.java.

final short msado15::DataTypeEnum::adVariant = 12 [static]

Definition at line 39 of file DataTypeEnum.java.

final short msado15::DataTypeEnum::adVarNumeric = 139 [static]

Definition at line 61 of file DataTypeEnum.java.

final short msado15::DataTypeEnum::adVarWChar = 202 [static]

Definition at line 52 of file DataTypeEnum.java.

final short msado15::DataTypeEnum::adWChar = 130 [static]

Definition at line 51 of file DataTypeEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/DataTypeEnum.java
Generated on Wed Nov 13 2024 16:58:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::EditModeEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::EditModeEnum
Static Public Attributes

msado15::EditModeEnum Class Reference

List of all members.

Static Public Attributes

static final short | adEditAdd = 2
static final short | adEditDelete = 4
static final short | adEditInProgress = 1
static final short | adEditNone = 0

Detailed Description

Definition at line 20 of file EditModeEnum.java.

Member Data Documentation

final short msado15::EditModeEnum::adEditAdd = 2 [static]

Definition at line 24 of file EditModeEnum.java.

final short msado15::EditModeEnum::adEditDelete = 4 [static]

Definition at line 25 of file EditModeEnum.java.

final short msado15::EditModeEnum::adEditInProgress = 1 [static]

Definition at line 23 of file EditModeEnum.java.

final short msado15::EditModeEnum::adEditNone = 0 [static]

Definition at line 22 of file EditModeEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/EditModeEnum.java
Generated on Wed Nov 13 2024 16:58:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::Error Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::Error
Public Member Functions | Static Public Attributes

msado15::Error Interface Reference

.interface(iid=00000500-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)

Inherits com::ms::com::IUnknown.

List of all members.

Public Member Functions

String | getDescription ()
int | getHelpContext ()
String | getHelpFile ()
int | getNativeError ()
int | getNumber ()
String | getSource ()
String | getSQLState ()

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x500, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)

Detailed Description

Definition at line 20 of file Error.java.

Member Function Documentation

String msado15::Error::getDescription ( )

.method(vtoffset=6, dispid=0, type=PROPGET, name="Description", name2="getDescription", addFlagsVtable=4) .parameters([type=STRING] return)

int msado15::Error::getHelpContext ( )

.method(vtoffset=8, dispid=1610743812, type=PROPGET, name="HelpContext", name2="getHelpContext", addFlagsVtable=4) .parameters([type=I4] return)

String msado15::Error::getHelpFile ( )

.method(vtoffset=7, dispid=1610743811, type=PROPGET, name="HelpFile", name2="getHelpFile", addFlagsVtable=4) .parameters([type=STRING] return)

int msado15::Error::getNativeError ( )

.method(vtoffset=10, dispid=1610743814, type=PROPGET, name="NativeError", name2="getNativeError", addFlagsVtable=4) .parameters([type=I4] return)

int msado15::Error::getNumber ( )

.method(vtoffset=4, dispid=1610743808, type=PROPGET, name="Number", name2="getNumber", addFlagsVtable=4) .parameters([type=I4] return)

String msado15::Error::getSource ( )

.method(vtoffset=5, dispid=1610743809, type=PROPGET, name="Source", name2="getSource", addFlagsVtable=4) .parameters([type=STRING] return)

String msado15::Error::getSQLState ( )

.method(vtoffset=9, dispid=1610743813, type=PROPGET, name="SQLState", name2="getSQLState", addFlagsVtable=4) .parameters([type=STRING] return)

Member Data Documentation

final com.ms.com._Guid msado15::Error::iid = new com.ms.com._Guid((int)0x500, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Definition at line 51 of file Error.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Error.java
Generated on Wed Nov 13 2024 16:58:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::Errors Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::Errors
Public Member Functions | Static Public Attributes

msado15::Errors Interface Reference

.interface(iid=00000501-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)

Inherits msado15::_Collection.

List of all members.

Public Member Functions

IUnknown | _NewEnum ()
void | Clear ()
int | getCount ()
msado15.Error | getItem (Variant Index)
void | Refresh ()

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x501, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)

Detailed Description

Definition at line 20 of file Errors.java.

Member Function Documentation

IUnknown msado15::Errors::_NewEnum ( )

.method(vtoffset=5, dispid=4294967292, type=METHOD, name="_NewEnum", addFlagsVtable=4) .parameters([iid=00000000-0000-0000-C000-000000000046,thread=AUTO,type=OBJECT] return)

Implements msado15::_Collection.

void msado15::Errors::Clear ( )

.method(vtoffset=8, dispid=1610809345, type=METHOD, name="Clear", addFlagsVtable=4) .parameters()

int msado15::Errors::getCount ( )

.method(vtoffset=4, dispid=1610743808, type=PROPGET, name="Count", name2="getCount", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::_Collection.

msado15.Error msado15::Errors::getItem ( Variant Index )

.method(vtoffset=7, dispid=0, type=PROPGET, name="Item", name2="getItem", addFlagsVtable=4) .parameters([in,type=VARIANT] Index, [iid=00000500-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

void msado15::Errors::Refresh ( )

.method(vtoffset=6, dispid=1610743810, type=METHOD, name="Refresh", addFlagsVtable=4) .parameters()

Implements msado15::_Collection.

Member Data Documentation

final com.ms.com._Guid msado15::Errors::iid = new com.ms.com._Guid((int)0x501, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Implements msado15::_Collection.

Definition at line 43 of file Errors.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Errors.java
Generated on Wed Nov 13 2024 16:58:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::ErrorValueEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::ErrorValueEnum
Static Public Attributes

msado15::ErrorValueEnum Class Reference

List of all members.

Static Public Attributes

static final short | adErrBoundToCommand = 3707
static final short | adErrDataConversion = 3421
static final short | adErrFeatureNotAvailable = 3251
static final short | adErrIllegalOperation = 3219
static final short | adErrInTransaction = 3246
static final short | adErrInvalidArgument = 3001
static final short | adErrInvalidConnection = 3709
static final short | adErrInvalidParamInfo = 3708
static final short | adErrItemNotFound = 3265
static final short | adErrNoCurrentRecord = 3021
static final short | adErrNotExecuting = 3715
static final short | adErrNotReentrant = 3710
static final short | adErrObjectClosed = 3704
static final short | adErrObjectInCollection = 3367
static final short | adErrObjectNotSet = 3420
static final short | adErrObjectOpen = 3705
static final short | adErrOpeningFile = 3002
static final short | adErrOperationCancelled = 3712
static final short | adErrProviderNotFound = 3706
static final short | adErrReadFile = 3003
static final short | adErrStillConnecting = 3713
static final short | adErrStillExecuting = 3711
static final short | adErrUnsafeOperation = 3716
static final short | adErrWriteFile = 3004

Detailed Description

Definition at line 20 of file ErrorValueEnum.java.

Member Data Documentation

final short msado15::ErrorValueEnum::adErrBoundToCommand = 3707 [static]

Definition at line 37 of file ErrorValueEnum.java.

final short msado15::ErrorValueEnum::adErrDataConversion = 3421 [static]

Definition at line 33 of file ErrorValueEnum.java.

final short msado15::ErrorValueEnum::adErrFeatureNotAvailable = 3251 [static]

Definition at line 29 of file ErrorValueEnum.java.

final short msado15::ErrorValueEnum::adErrIllegalOperation = 3219 [static]

Definition at line 27 of file ErrorValueEnum.java.

final short msado15::ErrorValueEnum::adErrInTransaction = 3246 [static]

Definition at line 28 of file ErrorValueEnum.java.

final short msado15::ErrorValueEnum::adErrInvalidArgument = 3001 [static]

Definition at line 22 of file ErrorValueEnum.java.

final short msado15::ErrorValueEnum::adErrInvalidConnection = 3709 [static]

Definition at line 39 of file ErrorValueEnum.java.

final short msado15::ErrorValueEnum::adErrInvalidParamInfo = 3708 [static]

Definition at line 38 of file ErrorValueEnum.java.

final short msado15::ErrorValueEnum::adErrItemNotFound = 3265 [static]

Definition at line 30 of file ErrorValueEnum.java.

final short msado15::ErrorValueEnum::adErrNoCurrentRecord = 3021 [static]

Definition at line 26 of file ErrorValueEnum.java.

final short msado15::ErrorValueEnum::adErrNotExecuting = 3715 [static]

Definition at line 44 of file ErrorValueEnum.java.

final short msado15::ErrorValueEnum::adErrNotReentrant = 3710 [static]

Definition at line 40 of file ErrorValueEnum.java.

final short msado15::ErrorValueEnum::adErrObjectClosed = 3704 [static]

Definition at line 34 of file ErrorValueEnum.java.

final short msado15::ErrorValueEnum::adErrObjectInCollection = 3367 [static]

Definition at line 31 of file ErrorValueEnum.java.

final short msado15::ErrorValueEnum::adErrObjectNotSet = 3420 [static]

Definition at line 32 of file ErrorValueEnum.java.

final short msado15::ErrorValueEnum::adErrObjectOpen = 3705 [static]

Definition at line 35 of file ErrorValueEnum.java.

final short msado15::ErrorValueEnum::adErrOpeningFile = 3002 [static]

Definition at line 23 of file ErrorValueEnum.java.

final short msado15::ErrorValueEnum::adErrOperationCancelled = 3712 [static]

Definition at line 42 of file ErrorValueEnum.java.

final short msado15::ErrorValueEnum::adErrProviderNotFound = 3706 [static]

Definition at line 36 of file ErrorValueEnum.java.

final short msado15::ErrorValueEnum::adErrReadFile = 3003 [static]

Definition at line 24 of file ErrorValueEnum.java.

final short msado15::ErrorValueEnum::adErrStillConnecting = 3713 [static]

Definition at line 43 of file ErrorValueEnum.java.

final short msado15::ErrorValueEnum::adErrStillExecuting = 3711 [static]

Definition at line 41 of file ErrorValueEnum.java.

final short msado15::ErrorValueEnum::adErrUnsafeOperation = 3716 [static]

Definition at line 45 of file ErrorValueEnum.java.

final short msado15::ErrorValueEnum::adErrWriteFile = 3004 [static]

Definition at line 25 of file ErrorValueEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ErrorValueEnum.java
Generated on Wed Nov 13 2024 16:58:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::EventReasonEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::EventReasonEnum
Static Public Attributes

msado15::EventReasonEnum Class Reference

List of all members.

Static Public Attributes

static final short | adRsnAddNew = 1
static final short | adRsnClose = 9
static final short | adRsnDelete = 2
static final short | adRsnFirstChange = 11
static final short | adRsnMove = 10
static final short | adRsnMoveFirst = 12
static final short | adRsnMoveLast = 15
static final short | adRsnMoveNext = 13
static final short | adRsnMovePrevious = 14
static final short | adRsnRequery = 7
static final short | adRsnResynch = 8
static final short | adRsnUndoAddNew = 5
static final short | adRsnUndoDelete = 6
static final short | adRsnUndoUpdate = 4
static final short | adRsnUpdate = 3

Detailed Description

Definition at line 20 of file EventReasonEnum.java.

Member Data Documentation

final short msado15::EventReasonEnum::adRsnAddNew = 1 [static]

Definition at line 22 of file EventReasonEnum.java.

final short msado15::EventReasonEnum::adRsnClose = 9 [static]

Definition at line 30 of file EventReasonEnum.java.

final short msado15::EventReasonEnum::adRsnDelete = 2 [static]

Definition at line 23 of file EventReasonEnum.java.

final short msado15::EventReasonEnum::adRsnFirstChange = 11 [static]

Definition at line 32 of file EventReasonEnum.java.

final short msado15::EventReasonEnum::adRsnMove = 10 [static]

Definition at line 31 of file EventReasonEnum.java.

final short msado15::EventReasonEnum::adRsnMoveFirst = 12 [static]

Definition at line 33 of file EventReasonEnum.java.

final short msado15::EventReasonEnum::adRsnMoveLast = 15 [static]

Definition at line 36 of file EventReasonEnum.java.

final short msado15::EventReasonEnum::adRsnMoveNext = 13 [static]

Definition at line 34 of file EventReasonEnum.java.

final short msado15::EventReasonEnum::adRsnMovePrevious = 14 [static]

Definition at line 35 of file EventReasonEnum.java.

final short msado15::EventReasonEnum::adRsnRequery = 7 [static]

Definition at line 28 of file EventReasonEnum.java.

final short msado15::EventReasonEnum::adRsnResynch = 8 [static]

Definition at line 29 of file EventReasonEnum.java.

final short msado15::EventReasonEnum::adRsnUndoAddNew = 5 [static]

Definition at line 26 of file EventReasonEnum.java.

final short msado15::EventReasonEnum::adRsnUndoDelete = 6 [static]

Definition at line 27 of file EventReasonEnum.java.

final short msado15::EventReasonEnum::adRsnUndoUpdate = 4 [static]

Definition at line 25 of file EventReasonEnum.java.

final short msado15::EventReasonEnum::adRsnUpdate = 3 [static]

Definition at line 24 of file EventReasonEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/EventReasonEnum.java
Generated on Wed Nov 13 2024 16:58:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::EventStatusEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::EventStatusEnum
Static Public Attributes

msado15::EventStatusEnum Class Reference

List of all members.

Static Public Attributes

static final short | adStatusCancel = 4
static final short | adStatusCantDeny = 3
static final short | adStatusErrorsOccurred = 2
static final short | adStatusOK = 1
static final short | adStatusUnwantedEvent = 5

Detailed Description

Definition at line 20 of file EventStatusEnum.java.

Member Data Documentation

final short msado15::EventStatusEnum::adStatusCancel = 4 [static]

Definition at line 25 of file EventStatusEnum.java.

final short msado15::EventStatusEnum::adStatusCantDeny = 3 [static]

Definition at line 24 of file EventStatusEnum.java.

final short msado15::EventStatusEnum::adStatusErrorsOccurred = 2 [static]

Definition at line 23 of file EventStatusEnum.java.

final short msado15::EventStatusEnum::adStatusOK = 1 [static]

Definition at line 22 of file EventStatusEnum.java.

final short msado15::EventStatusEnum::adStatusUnwantedEvent = 5 [static]

Definition at line 26 of file EventStatusEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/EventStatusEnum.java
Generated on Wed Nov 13 2024 16:58:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::ExecuteOptionEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::ExecuteOptionEnum
Static Public Attributes

msado15::ExecuteOptionEnum Class Reference

List of all members.

Static Public Attributes

static final short | adAsyncExecute = 16
static final short | adAsyncFetch = 32
static final short | adAsyncFetchNonBlocking = 64
static final short | adExecuteNoRecords = 128
static final short | adOptionUnspecified = -1

Detailed Description

Definition at line 20 of file ExecuteOptionEnum.java.

Member Data Documentation

final short msado15::ExecuteOptionEnum::adAsyncExecute = 16 [static]

Definition at line 23 of file ExecuteOptionEnum.java.

final short msado15::ExecuteOptionEnum::adAsyncFetch = 32 [static]

Definition at line 24 of file ExecuteOptionEnum.java.

final short msado15::ExecuteOptionEnum::adAsyncFetchNonBlocking = 64 [static]

Definition at line 25 of file ExecuteOptionEnum.java.

final short msado15::ExecuteOptionEnum::adExecuteNoRecords = 128 [static]

Definition at line 26 of file ExecuteOptionEnum.java.

final short msado15::ExecuteOptionEnum::adOptionUnspecified = -1 [static]

Definition at line 22 of file ExecuteOptionEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ExecuteOptionEnum.java
Generated on Wed Nov 13 2024 16:58:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::Field Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::Field
Public Member Functions | Static Public Attributes

msado15::Field Interface Reference

.interface(iid=0000054C-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)

Inherits msado15::_ADO.

List of all members.

Public Member Functions

void | AppendChunk (Variant Data)
int | getActualSize ()
int | getAttributes ()
Variant | GetChunk (int Length)
IUnknown | getDataFormat ()
int | getDefinedSize ()
String | getName ()
byte | getNumericScale ()
Variant | getOriginalValue ()
byte | getPrecision ()
msado15.Properties getProperties ()
int | getType ()
Variant | getUnderlyingValue ()
Variant | getValue ()
void | setAttributes (int pl)
void | setDataFormat (IUnknown ppiDF)
void | setDefinedSize (int pl)
void | setNumericScale (byte pbNumericScale)
void | setPrecision (byte pbPrecision)
void | setType (int pDataType)
void | setValue (Variant pvar)

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x54c, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)

Detailed Description

Definition at line 20 of file Field.java.

Member Function Documentation

void msado15::Field::AppendChunk ( Variant Data )

.method(vtoffset=14, dispid=1107, type=METHOD, name="AppendChunk", addFlagsVtable=4) .parameters([in,type=VARIANT] Data)

int msado15::Field::getActualSize ( )

.method(vtoffset=5, dispid=1109, type=PROPGET, name="ActualSize", name2="getActualSize", addFlagsVtable=4) .parameters([type=I4] return)

int msado15::Field::getAttributes ( )

.method(vtoffset=6, dispid=1036, type=PROPGET, name="Attributes", name2="getAttributes", addFlagsVtable=4) .parameters([type=I4] return)

Variant msado15::Field::GetChunk ( int Length )

.method(vtoffset=15, dispid=1108, type=METHOD, name="GetChunk", addFlagsVtable=4) .parameters([in,type=I4] Length, [type=VARIANT] return)

IUnknown msado15::Field::getDataFormat ( )

.method(vtoffset=18, dispid=1610809357, type=PROPGET, name="DataFormat", name2="getDataFormat", addFlagsVtable=4) .parameters([iid=00000000-0000-0000-C000-000000000046,thread=AUTO,type=OBJECT] return)

int msado15::Field::getDefinedSize ( )

.method(vtoffset=7, dispid=1103, type=PROPGET, name="DefinedSize", name2="getDefinedSize", addFlagsVtable=4) .parameters([type=I4] return)

String msado15::Field::getName ( )

.method(vtoffset=8, dispid=1100, type=PROPGET, name="Name", name2="getName", addFlagsVtable=4) .parameters([type=STRING] return)

byte msado15::Field::getNumericScale ( )

.method(vtoffset=13, dispid=1610809352, type=PROPGET, name="NumericScale", name2="getNumericScale", addFlagsVtable=4) .parameters([type=U1] return)

Variant msado15::Field::getOriginalValue ( )

.method(vtoffset=16, dispid=1104, type=PROPGET, name="OriginalValue", name2="getOriginalValue", addFlagsVtable=4) .parameters([type=VARIANT] return)

byte msado15::Field::getPrecision ( )

.method(vtoffset=12, dispid=1610809351, type=PROPGET, name="Precision", name2="getPrecision", addFlagsVtable=4) .parameters([type=U1] return)

msado15.Properties msado15::Field::getProperties ( )

.method(vtoffset=4, dispid=500, type=PROPGET, name="Properties", name2="getProperties", addFlagsVtable=4) .parameters([iid=00000504-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::_ADO.

int msado15::Field::getType ( )

.method(vtoffset=9, dispid=1102, type=PROPGET, name="Type", name2="getType", addFlagsVtable=4) .parameters([type=I4] return)

Variant msado15::Field::getUnderlyingValue ( )

.method(vtoffset=17, dispid=1105, type=PROPGET, name="UnderlyingValue", name2="getUnderlyingValue", addFlagsVtable=4) .parameters([type=VARIANT] return)

Variant msado15::Field::getValue ( )

.method(vtoffset=10, dispid=0, type=PROPGET, name="Value", name2="getValue", addFlagsVtable=4) .parameters([type=VARIANT] return)

void msado15::Field::setAttributes ( int pl )

.method(vtoffset=24, dispid=1036, type=PROPPUT, name="Attributes", name2="putAttributes", addFlagsVtable=4) .parameters([in,type=I4] pl)

void msado15::Field::setDataFormat ( IUnknown ppiDF )

.method(vtoffset=19, dispid=1610809357, type=PROPPUTREF, name="DataFormat", name2="putDataFormat", addFlagsVtable=4) .parameters([in,iid=00000000-0000-0000-C000-000000000046,thread=AUTO,type=OBJECT] ppiDF)

void msado15::Field::setDefinedSize ( int pl )

.method(vtoffset=23, dispid=1103, type=PROPPUT, name="DefinedSize", name2="putDefinedSize", addFlagsVtable=4) .parameters([in,type=I4] pl)

void msado15::Field::setNumericScale ( byte pbNumericScale )

.method(vtoffset=21, dispid=1610809352, type=PROPPUT, name="NumericScale", name2="putNumericScale", addFlagsVtable=4) .parameters([in,type=U1] pbNumericScale)

void msado15::Field::setPrecision ( byte pbPrecision )

.method(vtoffset=20, dispid=1610809351, type=PROPPUT, name="Precision", name2="putPrecision", addFlagsVtable=4) .parameters([in,type=U1] pbPrecision)

void msado15::Field::setType ( int pDataType )

.method(vtoffset=22, dispid=1102, type=PROPPUT, name="Type", name2="putType", addFlagsVtable=4) .parameters([in,type=I4] pDataType)

void msado15::Field::setValue ( Variant pvar )

.method(vtoffset=11, dispid=0, type=PROPPUT, name="Value", name2="putValue", addFlagsVtable=4) .parameters([in,type=VARIANT] pvar)

Member Data Documentation

final com.ms.com._Guid msado15::Field::iid = new com.ms.com._Guid((int)0x54c, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Implements msado15::_ADO.

Definition at line 107 of file Field.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Field.java
Generated on Wed Nov 13 2024 16:58:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::Field15 Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::Field15
Public Member Functions | Static Public Attributes

msado15::Field15 Interface Reference

.interface(iid=00000505-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)

Inherits msado15::_ADO.

List of all members.

Public Member Functions

void | AppendChunk (Variant Data)
int | getActualSize ()
int | getAttributes ()
Variant | GetChunk (int Length)
int | getDefinedSize ()
String | getName ()
byte | getNumericScale ()
Variant | getOriginalValue ()
byte | getPrecision ()
msado15.Properties getProperties ()
int | getType ()
Variant | getUnderlyingValue ()
Variant | getValue ()
void | setValue (Variant pvar)

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x505, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)

Detailed Description

Definition at line 20 of file Field15.java.

Member Function Documentation

void msado15::Field15::AppendChunk ( Variant Data )

.method(vtoffset=14, dispid=1107, type=METHOD, name="AppendChunk", addFlagsVtable=4) .parameters([in,type=VARIANT] Data)

int msado15::Field15::getActualSize ( )

.method(vtoffset=5, dispid=1109, type=PROPGET, name="ActualSize", name2="getActualSize", addFlagsVtable=4) .parameters([type=I4] return)

int msado15::Field15::getAttributes ( )

.method(vtoffset=6, dispid=1036, type=PROPGET, name="Attributes", name2="getAttributes", addFlagsVtable=4) .parameters([type=I4] return)

Variant msado15::Field15::GetChunk ( int Length )

.method(vtoffset=15, dispid=1108, type=METHOD, name="GetChunk", addFlagsVtable=4) .parameters([in,type=I4] Length, [type=VARIANT] return)

int msado15::Field15::getDefinedSize ( )

.method(vtoffset=7, dispid=1103, type=PROPGET, name="DefinedSize", name2="getDefinedSize", addFlagsVtable=4) .parameters([type=I4] return)

String msado15::Field15::getName ( )

.method(vtoffset=8, dispid=1100, type=PROPGET, name="Name", name2="getName", addFlagsVtable=4) .parameters([type=STRING] return)

byte msado15::Field15::getNumericScale ( )

.method(vtoffset=13, dispid=1610809352, type=PROPGET, name="NumericScale", name2="getNumericScale", addFlagsVtable=4) .parameters([type=U1] return)

Variant msado15::Field15::getOriginalValue ( )

.method(vtoffset=16, dispid=1104, type=PROPGET, name="OriginalValue", name2="getOriginalValue", addFlagsVtable=4) .parameters([type=VARIANT] return)

byte msado15::Field15::getPrecision ( )

.method(vtoffset=12, dispid=1610809351, type=PROPGET, name="Precision", name2="getPrecision", addFlagsVtable=4) .parameters([type=U1] return)

msado15.Properties msado15::Field15::getProperties ( )

.method(vtoffset=4, dispid=500, type=PROPGET, name="Properties", name2="getProperties", addFlagsVtable=4) .parameters([iid=00000504-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::_ADO.

int msado15::Field15::getType ( )

.method(vtoffset=9, dispid=1102, type=PROPGET, name="Type", name2="getType", addFlagsVtable=4) .parameters([type=I4] return)

Variant msado15::Field15::getUnderlyingValue ( )

.method(vtoffset=17, dispid=1105, type=PROPGET, name="UnderlyingValue", name2="getUnderlyingValue", addFlagsVtable=4) .parameters([type=VARIANT] return)

Variant msado15::Field15::getValue ( )

.method(vtoffset=10, dispid=0, type=PROPGET, name="Value", name2="getValue", addFlagsVtable=4) .parameters([type=VARIANT] return)

void msado15::Field15::setValue ( Variant pvar )

.method(vtoffset=11, dispid=0, type=PROPPUT, name="Value", name2="putValue", addFlagsVtable=4) .parameters([in,type=VARIANT] pvar)

Member Data Documentation

final com.ms.com._Guid msado15::Field15::iid = new com.ms.com._Guid((int)0x505, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Implements msado15::_ADO.

Definition at line 79 of file Field15.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Field15.java
Generated on Wed Nov 13 2024 16:58:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::FieldAttributeEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::FieldAttributeEnum
Static Public Attributes

msado15::FieldAttributeEnum Class Reference

List of all members.

Static Public Attributes

static final int | adFldCacheDeferred = 4096
static final int | adFldFixed = 16
static final int | adFldIsNullable = 32
static final int | adFldKeyColumn = 32768
static final int | adFldLong = 128
static final int | adFldMayBeNull = 64
static final int | adFldMayDefer = 2
static final int | adFldNegativeScale = 16384
static final int | adFldRowID = 256
static final int | adFldRowVersion = 512
static final int | adFldUnknownUpdatable = 8
static final int | adFldUnspecified = -1
static final int | adFldUpdatable = 4

Detailed Description

Definition at line 20 of file FieldAttributeEnum.java.

Member Data Documentation

final int msado15::FieldAttributeEnum::adFldCacheDeferred = 4096 [static]

Definition at line 32 of file FieldAttributeEnum.java.

final int msado15::FieldAttributeEnum::adFldFixed = 16 [static]

Definition at line 26 of file FieldAttributeEnum.java.

final int msado15::FieldAttributeEnum::adFldIsNullable = 32 [static]

Definition at line 27 of file FieldAttributeEnum.java.

final int msado15::FieldAttributeEnum::adFldKeyColumn = 32768 [static]

Definition at line 34 of file FieldAttributeEnum.java.

final int msado15::FieldAttributeEnum::adFldLong = 128 [static]

Definition at line 29 of file FieldAttributeEnum.java.

final int msado15::FieldAttributeEnum::adFldMayBeNull = 64 [static]

Definition at line 28 of file FieldAttributeEnum.java.

final int msado15::FieldAttributeEnum::adFldMayDefer = 2 [static]

Definition at line 23 of file FieldAttributeEnum.java.

final int msado15::FieldAttributeEnum::adFldNegativeScale = 16384 [static]

Definition at line 33 of file FieldAttributeEnum.java.

final int msado15::FieldAttributeEnum::adFldRowID = 256 [static]

Definition at line 30 of file FieldAttributeEnum.java.

final int msado15::FieldAttributeEnum::adFldRowVersion = 512 [static]

Definition at line 31 of file FieldAttributeEnum.java.

final int msado15::FieldAttributeEnum::adFldUnknownUpdatable = 8 [static]

Definition at line 25 of file FieldAttributeEnum.java.

final int msado15::FieldAttributeEnum::adFldUnspecified = -1 [static]

Definition at line 22 of file FieldAttributeEnum.java.

final int msado15::FieldAttributeEnum::adFldUpdatable = 4 [static]

Definition at line 24 of file FieldAttributeEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/FieldAttributeEnum.java
Generated on Wed Nov 13 2024 16:58:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::FieldEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::FieldEnum
Static Public Attributes

msado15::FieldEnum Class Reference

List of all members.

Static Public Attributes

static final short | adDefaultStream = -1
static final short | adRecordURL = -2

Detailed Description

Definition at line 20 of file FieldEnum.java.

Member Data Documentation

final short msado15::FieldEnum::adDefaultStream = -1 [static]

Definition at line 22 of file FieldEnum.java.

final short msado15::FieldEnum::adRecordURL = -2 [static]

Definition at line 23 of file FieldEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/FieldEnum.java
Generated on Wed Nov 13 2024 16:58:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::Fields Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::Fields
Public Member Functions | Static Public Attributes

msado15::Fields Interface Reference

.interface(iid=00000564-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)

Inherits msado15::Fields20.

List of all members.

Public Member Functions

void | _Append (String Name, int Type, int DefinedSize, int Attrib)
IUnknown | _NewEnum ()
void | Append (String Name, int Type, int DefinedSize, int Attrib, Variant FieldValue)
void | Delete (Variant Index)
int | getCount ()
msado15.Field | getItem (Variant Index)
void | Refresh ()
void | Update ()

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x564, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)

Detailed Description

Definition at line 20 of file Fields.java.

Member Function Documentation

void msado15::Fields::_Append | ( | String | Name,
 |  | int | Type,
 |  | int | DefinedSize,
 |  | int | Attrib
 | ) |  |

.method(vtoffset=8, dispid=1610874880, type=METHOD, name="_Append", addFlagsVtable=4) .parameters([in,type=STRING] Name, [in,type=I4] Type, [in,type=I4] DefinedSize, [in,type=I4] Attrib)

Implements msado15::Fields20.

IUnknown msado15::Fields::_NewEnum ( )

.method(vtoffset=5, dispid=4294967292, type=METHOD, name="_NewEnum", addFlagsVtable=4) .parameters([iid=00000000-0000-0000-C000-000000000046,thread=AUTO,type=OBJECT] return)

Implements msado15::Fields20.

void msado15::Fields::Append | ( | String | Name,
 |  | int | Type,
 |  | int | DefinedSize,
 |  | int | Attrib,
 |  | Variant | FieldValue
 | ) |  |

.method(vtoffset=10, dispid=1610940416, type=METHOD, name="Append", addFlagsVtable=4) .parameters([in,type=STRING] Name, [in,type=I4] Type, [in,type=I4] DefinedSize, [in,type=I4] Attrib, [in,type=VARIANT] FieldValue)

void msado15::Fields::Delete ( Variant Index )

.method(vtoffset=9, dispid=1610874881, type=METHOD, name="Delete", addFlagsVtable=4) .parameters([in,type=VARIANT] Index)

Implements msado15::Fields20.

int msado15::Fields::getCount ( )

.method(vtoffset=4, dispid=1610743808, type=PROPGET, name="Count", name2="getCount", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Fields20.

msado15.Field msado15::Fields::getItem ( Variant Index )

.method(vtoffset=7, dispid=0, type=PROPGET, name="Item", name2="getItem", addFlagsVtable=4) .parameters([in,type=VARIANT] Index, [iid=0000054C-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::Fields20.

void msado15::Fields::Refresh ( )

.method(vtoffset=6, dispid=1610743810, type=METHOD, name="Refresh", addFlagsVtable=4) .parameters()

Implements msado15::Fields20.

void msado15::Fields::Update ( )

.method(vtoffset=11, dispid=1610940417, type=METHOD, name="Update", addFlagsVtable=4) .parameters()

Member Data Documentation

final com.ms.com._Guid msado15::Fields::iid = new com.ms.com._Guid((int)0x564, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Implements msado15::Fields20.

Definition at line 55 of file Fields.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Fields.java
Generated on Wed Nov 13 2024 16:58:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::Fields15 Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::Fields15
Public Member Functions | Static Public Attributes

msado15::Fields15 Interface Reference

.interface(iid=00000506-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)

Inherits msado15::_Collection.

Inherited by msado15::Fields20.

List of all members.

Public Member Functions

IUnknown | _NewEnum ()
int | getCount ()
msado15.Field | getItem (Variant Index)
void | Refresh ()

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x506, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)

Detailed Description

Definition at line 20 of file Fields15.java.

Member Function Documentation

IUnknown msado15::Fields15::_NewEnum ( )

.method(vtoffset=5, dispid=4294967292, type=METHOD, name="_NewEnum", addFlagsVtable=4) .parameters([iid=00000000-0000-0000-C000-000000000046,thread=AUTO,type=OBJECT] return)

Implements msado15::_Collection.

Implemented in msado15::Fields, and msado15::Fields20.

int msado15::Fields15::getCount ( )

.method(vtoffset=4, dispid=1610743808, type=PROPGET, name="Count", name2="getCount", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::_Collection.

Implemented in msado15::Fields, and msado15::Fields20.

msado15.Field msado15::Fields15::getItem ( Variant Index )

.method(vtoffset=7, dispid=0, type=PROPGET, name="Item", name2="getItem", addFlagsVtable=4) .parameters([in,type=VARIANT] Index, [iid=0000054C-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implemented in msado15::Fields, and msado15::Fields20.

void msado15::Fields15::Refresh ( )

.method(vtoffset=6, dispid=1610743810, type=METHOD, name="Refresh", addFlagsVtable=4) .parameters()

Implements msado15::_Collection.

Implemented in msado15::Fields, and msado15::Fields20.

Member Data Documentation

final com.ms.com._Guid msado15::Fields15::iid = new com.ms.com._Guid((int)0x506, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Implements msado15::_Collection.

Implemented in msado15::Fields, and msado15::Fields20.

Definition at line 39 of file Fields15.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Fields15.java
Generated on Wed Nov 13 2024 16:58:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::Fields20 Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::Fields20
Public Member Functions | Static Public Attributes

msado15::Fields20 Interface Reference

.interface(iid=0000054D-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)

Inherits msado15::Fields15.

Inherited by msado15::Fields.

List of all members.

Public Member Functions

void | _Append (String Name, int Type, int DefinedSize, int Attrib)
IUnknown | _NewEnum ()
void | Delete (Variant Index)
int | getCount ()
msado15.Field | getItem (Variant Index)
void | Refresh ()

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x54d, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)

Detailed Description

Definition at line 20 of file Fields20.java.

Member Function Documentation

void msado15::Fields20::_Append | ( | String | Name,
 |  | int | Type,
 |  | int | DefinedSize,
 |  | int | Attrib
 | ) |  |

.method(vtoffset=8, dispid=1610874880, type=METHOD, name="_Append", addFlagsVtable=4) .parameters([in,type=STRING] Name, [in,type=I4] Type, [in,type=I4] DefinedSize, [in,type=I4] Attrib)

Implemented in msado15::Fields.

IUnknown msado15::Fields20::_NewEnum ( )

.method(vtoffset=5, dispid=4294967292, type=METHOD, name="_NewEnum", addFlagsVtable=4) .parameters([iid=00000000-0000-0000-C000-000000000046,thread=AUTO,type=OBJECT] return)

Implements msado15::Fields15.

Implemented in msado15::Fields.

void msado15::Fields20::Delete ( Variant Index )

.method(vtoffset=9, dispid=1610874881, type=METHOD, name="Delete", addFlagsVtable=4) .parameters([in,type=VARIANT] Index)

Implemented in msado15::Fields.

int msado15::Fields20::getCount ( )

.method(vtoffset=4, dispid=1610743808, type=PROPGET, name="Count", name2="getCount", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Fields15.

Implemented in msado15::Fields.

msado15.Field msado15::Fields20::getItem ( Variant Index )

.method(vtoffset=7, dispid=0, type=PROPGET, name="Item", name2="getItem", addFlagsVtable=4) .parameters([in,type=VARIANT] Index, [iid=0000054C-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::Fields15.

Implemented in msado15::Fields.

void msado15::Fields20::Refresh ( )

.method(vtoffset=6, dispid=1610743810, type=METHOD, name="Refresh", addFlagsVtable=4) .parameters()

Implements msado15::Fields15.

Implemented in msado15::Fields.

Member Data Documentation

final com.ms.com._Guid msado15::Fields20::iid = new com.ms.com._Guid((int)0x54d, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Implements msado15::Fields15.

Implemented in msado15::Fields.

Definition at line 47 of file Fields20.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Fields20.java
Generated on Wed Nov 13 2024 16:58:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::FilterGroupEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::FilterGroupEnum
Static Public Attributes

msado15::FilterGroupEnum Class Reference

List of all members.

Static Public Attributes

static final short | adFilterAffectedRecords = 2
static final short | adFilterConflictingRecords = 5
static final short | adFilterFetchedRecords = 3
static final short | adFilterNone = 0
static final short | adFilterPendingRecords = 1
static final short | adFilterPredicate = 4

Detailed Description

Definition at line 20 of file FilterGroupEnum.java.

Member Data Documentation

final short msado15::FilterGroupEnum::adFilterAffectedRecords = 2 [static]

Definition at line 24 of file FilterGroupEnum.java.

final short msado15::FilterGroupEnum::adFilterConflictingRecords = 5 [static]

Definition at line 27 of file FilterGroupEnum.java.

final short msado15::FilterGroupEnum::adFilterFetchedRecords = 3 [static]

Definition at line 25 of file FilterGroupEnum.java.

final short msado15::FilterGroupEnum::adFilterNone = 0 [static]

Definition at line 22 of file FilterGroupEnum.java.

final short msado15::FilterGroupEnum::adFilterPendingRecords = 1 [static]

Definition at line 23 of file FilterGroupEnum.java.

final short msado15::FilterGroupEnum::adFilterPredicate = 4 [static]

Definition at line 26 of file FilterGroupEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/FilterGroupEnum.java
Generated on Wed Nov 13 2024 16:58:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::GetRowsOptionEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::GetRowsOptionEnum
Static Public Attributes

msado15::GetRowsOptionEnum Class Reference

List of all members.

Static Public Attributes

static final short adGetRowsRest = -1

Detailed Description

Definition at line 20 of file GetRowsOptionEnum.java.

Member Data Documentation

final short msado15::GetRowsOptionEnum::adGetRowsRest = -1 [static]

Definition at line 22 of file GetRowsOptionEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/GetRowsOptionEnum.java
Generated on Wed Nov 13 2024 16:58:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::IRecFields Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::IRecFields
Public Member Functions | Static Public Attributes

msado15::IRecFields Interface Reference

.interface(iid=00000563-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)

Inherits com::ms::com::IUnknown.

List of all members.

Public Member Functions

void | ADOCheck ()

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x563, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)

Detailed Description

Definition at line 20 of file IRecFields.java.

Member Function Documentation

void msado15::IRecFields::ADOCheck ( )

.method(vtoffset=0, dispid=1, type=METHOD, name="ADOCheck", addFlagsVtable=4) .parameters()

Member Data Documentation

final com.ms.com._Guid msado15::IRecFields::iid = new com.ms.com._Guid((int)0x563, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Definition at line 27 of file IRecFields.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/IRecFields.java
Generated on Wed Nov 13 2024 16:58:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::IsolationLevelEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::IsolationLevelEnum
Static Public Attributes

msado15::IsolationLevelEnum Class Reference

List of all members.

Static Public Attributes

static final int | adXactBrowse = 256
static final int | adXactChaos = 16
static final int | adXactCursorStability = 4096
static final int | adXactIsolated = 1048576
static final int | adXactReadCommitted = 4096
static final int | adXactReadUncommitted = 256
static final int | adXactRepeatableRead = 65536
static final int | adXactSerializable = 1048576
static final int | adXactUnspecified = -1

Detailed Description

Definition at line 20 of file IsolationLevelEnum.java.

Member Data Documentation

final int msado15::IsolationLevelEnum::adXactBrowse = 256 [static]

Definition at line 25 of file IsolationLevelEnum.java.

final int msado15::IsolationLevelEnum::adXactChaos = 16 [static]

Definition at line 23 of file IsolationLevelEnum.java.

final int msado15::IsolationLevelEnum::adXactCursorStability = 4096 [static]

Definition at line 26 of file IsolationLevelEnum.java.

final int msado15::IsolationLevelEnum::adXactIsolated = 1048576 [static]

Definition at line 30 of file IsolationLevelEnum.java.

final int msado15::IsolationLevelEnum::adXactReadCommitted = 4096 [static]

Definition at line 27 of file IsolationLevelEnum.java.

final int msado15::IsolationLevelEnum::adXactReadUncommitted = 256 [static]

Definition at line 24 of file IsolationLevelEnum.java.

final int msado15::IsolationLevelEnum::adXactRepeatableRead = 65536 [static]

Definition at line 28 of file IsolationLevelEnum.java.

final int msado15::IsolationLevelEnum::adXactSerializable = 1048576 [static]

Definition at line 29 of file IsolationLevelEnum.java.

final int msado15::IsolationLevelEnum::adXactUnspecified = -1 [static]

Definition at line 22 of file IsolationLevelEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/IsolationLevelEnum.java
Generated on Wed Nov 13 2024 16:58:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::LineSeparatorEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::LineSeparatorEnum
Static Public Attributes

msado15::LineSeparatorEnum Class Reference

List of all members.

Static Public Attributes

static final short | adCR = 13
static final short | adCRLF = -1
static final short | adLF = 10

Detailed Description

Definition at line 20 of file LineSeparatorEnum.java.

Member Data Documentation

final short msado15::LineSeparatorEnum::adCR = 13 [static]

Definition at line 23 of file LineSeparatorEnum.java.

final short msado15::LineSeparatorEnum::adCRLF = -1 [static]

Definition at line 24 of file LineSeparatorEnum.java.

final short msado15::LineSeparatorEnum::adLF = 10 [static]

Definition at line 22 of file LineSeparatorEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/LineSeparatorEnum.java
Generated on Wed Nov 13 2024 16:58:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::LockTypeEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::LockTypeEnum
Static Public Attributes

msado15::LockTypeEnum Class Reference

List of all members.

Static Public Attributes

static final short | adLockBatchOptimistic = 4
static final short | adLockOptimistic = 3
static final short | adLockPessimistic = 2
static final short | adLockReadOnly = 1
static final short | adLockUnspecified = -1

Detailed Description

Definition at line 20 of file LockTypeEnum.java.

Member Data Documentation

final short msado15::LockTypeEnum::adLockBatchOptimistic = 4 [static]

Definition at line 26 of file LockTypeEnum.java.

final short msado15::LockTypeEnum::adLockOptimistic = 3 [static]

Definition at line 25 of file LockTypeEnum.java.

final short msado15::LockTypeEnum::adLockPessimistic = 2 [static]

Definition at line 24 of file LockTypeEnum.java.

final short msado15::LockTypeEnum::adLockReadOnly = 1 [static]

Definition at line 23 of file LockTypeEnum.java.

final short msado15::LockTypeEnum::adLockUnspecified = -1 [static]

Definition at line 22 of file LockTypeEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/LockTypeEnum.java
Generated on Wed Nov 13 2024 16:58:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::MarshalOptionsEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::MarshalOptionsEnum
Static Public Attributes

msado15::MarshalOptionsEnum Class Reference

List of all members.

Static Public Attributes

static final short | adMarshalAll = 0
static final short | adMarshalModifiedOnly = 1

Detailed Description

Definition at line 20 of file MarshalOptionsEnum.java.

Member Data Documentation

final short msado15::MarshalOptionsEnum::adMarshalAll = 0 [static]

Definition at line 22 of file MarshalOptionsEnum.java.

final short msado15::MarshalOptionsEnum::adMarshalModifiedOnly = 1 [static]

Definition at line 23 of file MarshalOptionsEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/MarshalOptionsEnum.java
Generated on Wed Nov 13 2024 16:58:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::MoveRecordOptionsEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::MoveRecordOptionsEnum
Static Public Attributes

msado15::MoveRecordOptionsEnum Class Reference

List of all members.

Static Public Attributes

static final short | adMoveAllowEmulation = 4
static final short | adMoveDontUpdateLinks = 2
static final short | adMoveOverWrite = 1

Detailed Description

Definition at line 20 of file MoveRecordOptionsEnum.java.

Member Data Documentation

final short msado15::MoveRecordOptionsEnum::adMoveAllowEmulation = 4 [static]

Definition at line 24 of file MoveRecordOptionsEnum.java.

final short msado15::MoveRecordOptionsEnum::adMoveDontUpdateLinks = 2 [static]

Definition at line 23 of file MoveRecordOptionsEnum.java.

final short msado15::MoveRecordOptionsEnum::adMoveOverWrite = 1 [static]

Definition at line 22 of file MoveRecordOptionsEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/MoveRecordOptionsEnum.java
Generated on Wed Nov 13 2024 16:58:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::ObjectStateEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::ObjectStateEnum
Static Public Attributes

msado15::ObjectStateEnum Class Reference

List of all members.

Static Public Attributes

static final short | adStateClosed = 0
static final short | adStateConnecting = 2
static final short | adStateExecuting = 4
static final short | adStateFetching = 8
static final short | adStateOpen = 1

Detailed Description

Definition at line 20 of file ObjectStateEnum.java.

Member Data Documentation

final short msado15::ObjectStateEnum::adStateClosed = 0 [static]

Definition at line 22 of file ObjectStateEnum.java.

final short msado15::ObjectStateEnum::adStateConnecting = 2 [static]

Definition at line 24 of file ObjectStateEnum.java.

final short msado15::ObjectStateEnum::adStateExecuting = 4 [static]

Definition at line 25 of file ObjectStateEnum.java.

final short msado15::ObjectStateEnum::adStateFetching = 8 [static]

Definition at line 26 of file ObjectStateEnum.java.

final short msado15::ObjectStateEnum::adStateOpen = 1 [static]

Definition at line 23 of file ObjectStateEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ObjectStateEnum.java
Generated on Wed Nov 13 2024 16:58:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::Parameter Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::Parameter
Public Member Functions | Static Public Attributes

msado15::Parameter Class Reference

.class(classid=0000050B-0000-0010-8000-00AA006D2EA4,DynamicCasts) .interface(iid=0000050C-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)

Inherits com::ms::com::IUnknown, and msado15::_Parameter.

List of all members.

Public Member Functions

native void | AppendChunk (Variant Val)
native int | getAttributes ()
native int | getDirection ()
native String | getName ()
native byte | getNumericScale ()
native byte | getPrecision ()
native msado15.Properties | getProperties ()
native int | getSize ()
native int | getType ()
native Variant | getValue ()
native void | setAttributes (int plParmAttribs)
native void | setDirection (int plParmDirection)
native void | setName (String pbstr)
native void | setNumericScale (byte pbScale)
native void | setPrecision (byte pbPrecision)
native void | setSize (int pl)
native void | setType (int psDataType)
native void | setValue (Variant pvar)

Static Public Attributes

static final com.ms.com._Guid | clsid = new com.ms.com._Guid((int)0x50b, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)
static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x50c, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)

Detailed Description

Definition at line 20 of file Parameter.java.

Member Function Documentation

native void msado15::Parameter::AppendChunk ( Variant Val )

.method(vtoffset=19, dispid=1610809358, type=METHOD, name="AppendChunk", addFlagsVtable=4) .parameters([in,type=VARIANT] Val)

Implements msado15::_Parameter.

native int msado15::Parameter::getAttributes ( )

.method(vtoffset=20, dispid=1610809359, type=PROPGET, name="Attributes", name2="getAttributes", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::_Parameter.

native int msado15::Parameter::getDirection ( )

.method(vtoffset=12, dispid=1610809350, type=PROPGET, name="Direction", name2="getDirection", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::_Parameter.

native String msado15::Parameter::getName ( )

.method(vtoffset=5, dispid=1610809344, type=PROPGET, name="Name", name2="getName", addFlagsVtable=4) .parameters([type=STRING] return)

Implements msado15::_Parameter.

native byte msado15::Parameter::getNumericScale ( )

.method(vtoffset=16, dispid=1610809354, type=PROPGET, name="NumericScale", name2="getNumericScale", addFlagsVtable=4) .parameters([type=U1] return)

Implements msado15::_Parameter.

native byte msado15::Parameter::getPrecision ( )

.method(vtoffset=14, dispid=1610809352, type=PROPGET, name="Precision", name2="getPrecision", addFlagsVtable=4) .parameters([type=U1] return)

Implements msado15::_Parameter.

native msado15.Properties msado15::Parameter::getProperties ( )

.method(vtoffset=4, dispid=500, type=PROPGET, name="Properties", name2="getProperties", addFlagsVtable=4) .parameters([iid=00000504-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::_Parameter.

native int msado15::Parameter::getSize ( )

.method(vtoffset=18, dispid=1610809356, type=PROPGET, name="Size", name2="getSize", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::_Parameter.

native int msado15::Parameter::getType ( )

.method(vtoffset=9, dispid=1610809348, type=PROPGET, name="Type", name2="getType", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::_Parameter.

native Variant msado15::Parameter::getValue ( )

.method(vtoffset=7, dispid=0, type=PROPGET, name="Value", name2="getValue", addFlagsVtable=4) .parameters([type=VARIANT] return)

Implements msado15::_Parameter.

native void msado15::Parameter::setAttributes ( int plParmAttribs )

.method(vtoffset=21, dispid=1610809359, type=PROPPUT, name="Attributes", name2="putAttributes", addFlagsVtable=4) .parameters([in,type=I4] plParmAttribs)

Implements msado15::_Parameter.

native void msado15::Parameter::setDirection ( int plParmDirection )

.method(vtoffset=11, dispid=1610809350, type=PROPPUT, name="Direction", name2="putDirection", addFlagsVtable=4) .parameters([in,type=I4] plParmDirection)

Implements msado15::_Parameter.

native void msado15::Parameter::setName ( String pbstr )

.method(vtoffset=6, dispid=1610809344, type=PROPPUT, name="Name", name2="putName", addFlagsVtable=4) .parameters([in,type=STRING] pbstr)

Implements msado15::_Parameter.

native void msado15::Parameter::setNumericScale ( byte pbScale )

.method(vtoffset=15, dispid=1610809354, type=PROPPUT, name="NumericScale", name2="putNumericScale", addFlagsVtable=4) .parameters([in,type=U1] pbScale)

Implements msado15::_Parameter.

native void msado15::Parameter::setPrecision ( byte pbPrecision )

.method(vtoffset=13, dispid=1610809352, type=PROPPUT, name="Precision", name2="putPrecision", addFlagsVtable=4) .parameters([in,type=U1] pbPrecision)

Implements msado15::_Parameter.

native void msado15::Parameter::setSize ( int pl )

.method(vtoffset=17, dispid=1610809356, type=PROPPUT, name="Size", name2="putSize", addFlagsVtable=4) .parameters([in,type=I4] pl)

Implements msado15::_Parameter.

native void msado15::Parameter::setType ( int psDataType )

.method(vtoffset=10, dispid=1610809348, type=PROPPUT, name="Type", name2="putType", addFlagsVtable=4) .parameters([in,type=I4] psDataType)

Implements msado15::_Parameter.

native void msado15::Parameter::setValue ( Variant pvar )

.method(vtoffset=8, dispid=0, type=PROPPUT, name="Value", name2="putValue", addFlagsVtable=4) .parameters([in,type=VARIANT] pvar)

Implements msado15::_Parameter.

Member Data Documentation

final com.ms.com._Guid msado15::Parameter::clsid = new com.ms.com._Guid((int)0x50b, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Definition at line 97 of file Parameter.java.

final com.ms.com._Guid msado15::Parameter::iid = new com.ms.com._Guid((int)0x50c, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Implements msado15::_Parameter.

Definition at line 95 of file Parameter.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Parameter.java
Generated on Wed Nov 13 2024 16:58:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::ParameterAttributesEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::ParameterAttributesEnum
Static Public Attributes

msado15::ParameterAttributesEnum Class Reference

List of all members.

Static Public Attributes

static final short | adParamLong = 128
static final short | adParamNullable = 64
static final short | adParamSigned = 16

Detailed Description

Definition at line 20 of file ParameterAttributesEnum.java.

Member Data Documentation

final short msado15::ParameterAttributesEnum::adParamLong = 128 [static]

Definition at line 24 of file ParameterAttributesEnum.java.

final short msado15::ParameterAttributesEnum::adParamNullable = 64 [static]

Definition at line 23 of file ParameterAttributesEnum.java.

final short msado15::ParameterAttributesEnum::adParamSigned = 16 [static]

Definition at line 22 of file ParameterAttributesEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ParameterAttributesEnum.java
Generated on Wed Nov 13 2024 16:58:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::ParameterDirectionEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::ParameterDirectionEnum
Static Public Attributes

msado15::ParameterDirectionEnum Class Reference

List of all members.

Static Public Attributes

static final short | adParamInput = 1
static final short | adParamInputOutput = 3
static final short | adParamOutput = 2
static final short | adParamReturnValue = 4
static final short | adParamUnknown = 0

Detailed Description

Definition at line 20 of file ParameterDirectionEnum.java.

Member Data Documentation

final short msado15::ParameterDirectionEnum::adParamInput = 1 [static]

Definition at line 23 of file ParameterDirectionEnum.java.

final short msado15::ParameterDirectionEnum::adParamInputOutput = 3 [static]

Definition at line 25 of file ParameterDirectionEnum.java.

final short msado15::ParameterDirectionEnum::adParamOutput = 2 [static]

Definition at line 24 of file ParameterDirectionEnum.java.

final short msado15::ParameterDirectionEnum::adParamReturnValue = 4 [static]

Definition at line 26 of file ParameterDirectionEnum.java.

final short msado15::ParameterDirectionEnum::adParamUnknown = 0 [static]

Definition at line 22 of file ParameterDirectionEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ParameterDirectionEnum.java
Generated on Wed Nov 13 2024 16:58:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::Parameters Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::Parameters
Public Member Functions | Static Public Attributes

msado15::Parameters Interface Reference

.interface(iid=0000050D-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)

Inherits msado15::_DynaCollection.

List of all members.

Public Member Functions

IUnknown | _NewEnum ()
void | Append (Object Object)
void | Delete (Variant Index)
int | getCount ()
msado15._Parameter | getItem (Variant Index)
void | Refresh ()

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x50d, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)

Detailed Description

Definition at line 20 of file Parameters.java.

Member Function Documentation

IUnknown msado15::Parameters::_NewEnum ( )

.method(vtoffset=5, dispid=4294967292, type=METHOD, name="_NewEnum", addFlagsVtable=4) .parameters([iid=00000000-0000-0000-C000-000000000046,thread=AUTO,type=OBJECT] return)

Implements msado15::_DynaCollection.

void msado15::Parameters::Append ( Object Object )

.method(vtoffset=7, dispid=1610809344, type=METHOD, name="Append", addFlagsVtable=4) .parameters([in,iid=00020400-0000-0000-C000-000000000046,thread=AUTO,type=DISPATCH] Object)

Implements msado15::_DynaCollection.

void msado15::Parameters::Delete ( Variant Index )

.method(vtoffset=8, dispid=1610809345, type=METHOD, name="Delete", addFlagsVtable=4) .parameters([in,type=VARIANT] Index)

Implements msado15::_DynaCollection.

int msado15::Parameters::getCount ( )

.method(vtoffset=4, dispid=1610743808, type=PROPGET, name="Count", name2="getCount", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::_DynaCollection.

msado15._Parameter msado15::Parameters::getItem ( Variant Index )

.method(vtoffset=9, dispid=0, type=PROPGET, name="Item", name2="getItem", addFlagsVtable=4) .parameters([in,type=VARIANT] Index, [iid=0000050C-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

void msado15::Parameters::Refresh ( )

.method(vtoffset=6, dispid=1610743810, type=METHOD, name="Refresh", addFlagsVtable=4) .parameters()

Implements msado15::_DynaCollection.

Member Data Documentation

final com.ms.com._Guid msado15::Parameters::iid = new com.ms.com._Guid((int)0x50d, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Implements msado15::_DynaCollection.

Definition at line 47 of file Parameters.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Parameters.java
Generated on Wed Nov 13 2024 16:58:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::PersistFormatEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::PersistFormatEnum
Static Public Attributes

msado15::PersistFormatEnum Class Reference

List of all members.

Static Public Attributes

static final short | adPersistADTG = 0
static final short | adPersistXML = 1

Detailed Description

Definition at line 20 of file PersistFormatEnum.java.

Member Data Documentation

final short msado15::PersistFormatEnum::adPersistADTG = 0 [static]

Definition at line 22 of file PersistFormatEnum.java.

final short msado15::PersistFormatEnum::adPersistXML = 1 [static]

Definition at line 23 of file PersistFormatEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/PersistFormatEnum.java
Generated on Wed Nov 13 2024 16:58:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::PositionEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::PositionEnum
Static Public Attributes

msado15::PositionEnum Class Reference

List of all members.

Static Public Attributes

static final short | adPosBOF = -2
static final short | adPosEOF = -3
static final short | adPosUnknown = -1

Detailed Description

Definition at line 20 of file PositionEnum.java.

Member Data Documentation

final short msado15::PositionEnum::adPosBOF = -2 [static]

Definition at line 23 of file PositionEnum.java.

final short msado15::PositionEnum::adPosEOF = -3 [static]

Definition at line 24 of file PositionEnum.java.

final short msado15::PositionEnum::adPosUnknown = -1 [static]

Definition at line 22 of file PositionEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/PositionEnum.java
Generated on Wed Nov 13 2024 16:58:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::Properties Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::Properties
Public Member Functions | Static Public Attributes

msado15::Properties Interface Reference

.interface(iid=00000504-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)

Inherits msado15::_Collection.

List of all members.

Public Member Functions

IUnknown | _NewEnum ()
int | getCount ()
msado15.Property | getItem (Variant Index)
void | Refresh ()

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x504, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)

Detailed Description

Definition at line 20 of file Properties.java.

Member Function Documentation

IUnknown msado15::Properties::_NewEnum ( )

.method(vtoffset=5, dispid=4294967292, type=METHOD, name="_NewEnum", addFlagsVtable=4) .parameters([iid=00000000-0000-0000-C000-000000000046,thread=AUTO,type=OBJECT] return)

Implements msado15::_Collection.

int msado15::Properties::getCount ( )

.method(vtoffset=4, dispid=1610743808, type=PROPGET, name="Count", name2="getCount", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::_Collection.

msado15.Property msado15::Properties::getItem ( Variant Index )

.method(vtoffset=7, dispid=0, type=PROPGET, name="Item", name2="getItem", addFlagsVtable=4) .parameters([in,type=VARIANT] Index, [iid=00000503-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

void msado15::Properties::Refresh ( )

.method(vtoffset=6, dispid=1610743810, type=METHOD, name="Refresh", addFlagsVtable=4) .parameters()

Implements msado15::_Collection.

Member Data Documentation

final com.ms.com._Guid msado15::Properties::iid = new com.ms.com._Guid((int)0x504, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Implements msado15::_Collection.

Definition at line 39 of file Properties.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Properties.java
Generated on Wed Nov 13 2024 16:58:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::Property Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::Property
Public Member Functions | Static Public Attributes

msado15::Property Interface Reference

.interface(iid=00000503-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)

Inherits com::ms::com::IUnknown.

List of all members.

Public Member Functions

int | getAttributes ()
String | getName ()
int | getType ()
Variant | getValue ()
void | setAttributes (int plAttributes)
void | setValue (Variant pval)

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x503, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)

Detailed Description

Definition at line 20 of file Property.java.

Member Function Documentation

int msado15::Property::getAttributes ( )

.method(vtoffset=8, dispid=1610743812, type=PROPGET, name="Attributes", name2="getAttributes", addFlagsVtable=4) .parameters([type=I4] return)

String msado15::Property::getName ( )

.method(vtoffset=6, dispid=1610743810, type=PROPGET, name="Name", name2="getName", addFlagsVtable=4) .parameters([type=STRING] return)

int msado15::Property::getType ( )

.method(vtoffset=7, dispid=1610743811, type=PROPGET, name="Type", name2="getType", addFlagsVtable=4) .parameters([type=I4] return)

Variant msado15::Property::getValue ( )

.method(vtoffset=4, dispid=0, type=PROPGET, name="Value", name2="getValue", addFlagsVtable=4) .parameters([type=VARIANT] return)

void msado15::Property::setAttributes ( int plAttributes )

.method(vtoffset=9, dispid=1610743812, type=PROPPUT, name="Attributes", name2="putAttributes", addFlagsVtable=4) .parameters([in,type=I4] plAttributes)

void msado15::Property::setValue ( Variant pval )

.method(vtoffset=5, dispid=0, type=PROPPUT, name="Value", name2="putValue", addFlagsVtable=4) .parameters([in,type=VARIANT] pval)

Member Data Documentation

final com.ms.com._Guid msado15::Property::iid = new com.ms.com._Guid((int)0x503, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Definition at line 47 of file Property.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Property.java
Generated on Wed Nov 13 2024 16:58:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::PropertyAttributesEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::PropertyAttributesEnum
Static Public Attributes

msado15::PropertyAttributesEnum Class Reference

List of all members.

Static Public Attributes

static final short | adPropNotSupported = 0
static final short | adPropOptional = 2
static final short | adPropRead = 512
static final short | adPropRequired = 1
static final short | adPropWrite = 1024

Detailed Description

Definition at line 20 of file PropertyAttributesEnum.java.

Member Data Documentation

final short msado15::PropertyAttributesEnum::adPropNotSupported = 0 [static]

Definition at line 22 of file PropertyAttributesEnum.java.

final short msado15::PropertyAttributesEnum::adPropOptional = 2 [static]

Definition at line 24 of file PropertyAttributesEnum.java.

final short msado15::PropertyAttributesEnum::adPropRead = 512 [static]

Definition at line 25 of file PropertyAttributesEnum.java.

final short msado15::PropertyAttributesEnum::adPropRequired = 1 [static]

Definition at line 23 of file PropertyAttributesEnum.java.

final short msado15::PropertyAttributesEnum::adPropWrite = 1024 [static]

Definition at line 26 of file PropertyAttributesEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/PropertyAttributesEnum.java
Generated on Wed Nov 13 2024 16:58:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::Record Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::Record
Public Member Functions | Static Public Attributes

msado15::Record Class Reference

.class(classid=00000560-0000-0010-8000-00AA006D2EA4,DynamicCasts) .interface(iid=00000562-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)

Inherits com::ms::com::IUnknown, and msado15::_Record.

List of all members.

Public Member Functions

native void | Cancel ()
native void | Close ()
native String | CopyRecord (String Source, String Destination, String UserName, String Password, int Options, boolean Async)
native void | DeleteRecord (String Source, boolean Async)
native Variant | getActiveConnection ()
native msado15._Recordset | GetChildren ()
native msado15.Fields | getFields ()
native int | getMode ()
native String | getParentURL ()
native msado15.Properties | getProperties ()
native int | getRecordType ()
native Variant | getSource ()
native int | getState ()
native String | MoveRecord (String Source, String Destination, String UserName, String Password, int Options, boolean Async)
native void | Open (Variant Source, Variant ActiveConnection, int Mode, int CreateOptions, int Options, String UserName, String Password)
native void | setActiveConnection (msado15._Connection pvar)
native void | setActiveConnection (String pvar)
native void | setMode (int pMode)
native void | setSource (String pvar)
native void | setSource (Object pvar)

Static Public Attributes

static final com.ms.com._Guid | clsid = new com.ms.com._Guid((int)0x560, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)
static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x562, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)

Detailed Description

Definition at line 20 of file Record.java.

Member Function Documentation

native void msado15::Record::Cancel ( )

.method(vtoffset=23, dispid=13, type=METHOD, name="Cancel", addFlagsVtable=4) .parameters()

Implements msado15::_Record.

native void msado15::Record::Close ( )

.method(vtoffset=19, dispid=10, type=METHOD, name="Close", addFlagsVtable=4) .parameters()

Implements msado15::_Record.

native String msado15::Record::CopyRecord | ( | String | Source,
 |  | String | Destination,
 |  | String | UserName,
 |  | String | Password,
 |  | int | Options,
 |  | boolean | Async
 | ) |  |

.method(vtoffset=16, dispid=7, type=METHOD, name="CopyRecord", addFlagsVtable=4) .parameters([in,type=STRING] Source, [in,type=STRING] Destination, [in,type=STRING] UserName, [in,type=STRING] Password, [in,type=I4] Options, [in,type=BOOLEAN] Async, [type=STRING] return)

Implements msado15::_Record.

native void msado15::Record::DeleteRecord | ( | String | Source,
 |  | boolean | Async
 | ) |  |

.method(vtoffset=17, dispid=8, type=METHOD, name="DeleteRecord", addFlagsVtable=4) .parameters([in,type=STRING] Source, [in,type=BOOLEAN] Async)

Implements msado15::_Record.

native Variant msado15::Record::getActiveConnection ( )

.method(vtoffset=5, dispid=1, type=PROPGET, name="ActiveConnection", name2="getActiveConnection", addFlagsVtable=4) .parameters([type=VARIANT] return)

Implements msado15::_Record.

native msado15._Recordset msado15::Record::GetChildren ( )

.method(vtoffset=22, dispid=12, type=METHOD, name="GetChildren", addFlagsVtable=4) .parameters([iid=00000556-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::_Record.

native msado15.Fields msado15::Record::getFields ( )

.method(vtoffset=20, dispid=0, type=PROPGET, name="Fields", name2="getFields", addFlagsVtable=4) .parameters([iid=00000564-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::_Record.

native int msado15::Record::getMode ( )

.method(vtoffset=12, dispid=4, type=PROPGET, name="Mode", name2="getMode", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::_Record.

native String msado15::Record::getParentURL ( )

.method(vtoffset=14, dispid=5, type=PROPGET, name="ParentURL", name2="getParentURL", addFlagsVtable=4) .parameters([type=STRING] return)

Implements msado15::_Record.

native msado15.Properties msado15::Record::getProperties ( )

.method(vtoffset=4, dispid=500, type=PROPGET, name="Properties", name2="getProperties", addFlagsVtable=4) .parameters([iid=00000504-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::_Record.

native int msado15::Record::getRecordType ( )

.method(vtoffset=21, dispid=11, type=PROPGET, name="RecordType", name2="getRecordType", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::_Record.

native Variant msado15::Record::getSource ( )

.method(vtoffset=9, dispid=3, type=PROPGET, name="Source", name2="getSource", addFlagsVtable=4) .parameters([type=VARIANT] return)

Implements msado15::_Record.

native int msado15::Record::getState ( )

.method(vtoffset=8, dispid=2, type=PROPGET, name="State", name2="getState", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::_Record.

native String msado15::Record::MoveRecord | ( | String | Source,
 |  | String | Destination,
 |  | String | UserName,
 |  | String | Password,
 |  | int | Options,
 |  | boolean | Async
 | ) |  |

.method(vtoffset=15, dispid=6, type=METHOD, name="MoveRecord", addFlagsVtable=4) .parameters([in,type=STRING] Source, [in,type=STRING] Destination, [in,type=STRING] UserName, [in,type=STRING] Password, [in,type=I4] Options, [in,type=BOOLEAN] Async, [type=STRING] return)

Implements msado15::_Record.

native void msado15::Record::Open | ( | Variant | Source,
 |  | Variant | ActiveConnection,
 |  | int | Mode,
 |  | int | CreateOptions,
 |  | int | Options,
 |  | String | UserName,
 |  | String | Password
 | ) |  |

.method(vtoffset=18, dispid=9, type=METHOD, name="Open", addFlagsVtable=4) .parameters([in,type=VARIANT] Source, [in,type=VARIANT] ActiveConnection, [in,type=I4] Mode, [in,type=I4] CreateOptions, [in,type=I4] Options, [in,type=STRING] UserName, [in,type=STRING] Password)

Implements msado15::_Record.

native void msado15::Record::setActiveConnection ( msado15._Connection pvar )

.method(vtoffset=7, dispid=1, type=PROPPUTREF, name="ActiveConnection", name2="putActiveConnection", addFlagsVtable=4) .parameters([in,iid=00000550-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] pvar)

Implements msado15::_Record.

native void msado15::Record::setActiveConnection ( String pvar )

.method(vtoffset=6, dispid=1, type=PROPPUT, name="ActiveConnection", name2="putActiveConnection", addFlagsVtable=4) .parameters([in,type=STRING] pvar)

Implements msado15::_Record.

native void msado15::Record::setMode ( int pMode )

.method(vtoffset=13, dispid=4, type=PROPPUT, name="Mode", name2="putMode", addFlagsVtable=4) .parameters([in,type=I4] pMode)

Implements msado15::_Record.

native void msado15::Record::setSource ( String pvar )

.method(vtoffset=10, dispid=3, type=PROPPUT, name="Source", name2="putSource", addFlagsVtable=4) .parameters([in,type=STRING] pvar)

Implements msado15::_Record.

native void msado15::Record::setSource ( Object pvar )

.method(vtoffset=11, dispid=3, type=PROPPUTREF, name="Source", name2="putSource", addFlagsVtable=4) .parameters([in,iid=00020400-0000-0000-C000-000000000046,thread=AUTO,type=DISPATCH] pvar)

Implements msado15::_Record.

Member Data Documentation

final com.ms.com._Guid msado15::Record::clsid = new com.ms.com._Guid((int)0x560, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Definition at line 105 of file Record.java.

final com.ms.com._Guid msado15::Record::iid = new com.ms.com._Guid((int)0x562, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Implements msado15::_Record.

Definition at line 103 of file Record.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Record.java
Generated on Wed Nov 13 2024 16:58:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::RecordCreateOptionsEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::RecordCreateOptionsEnum
Static Public Attributes

msado15::RecordCreateOptionsEnum Class Reference

List of all members.

Static Public Attributes

static final int | adCreateCollection = 8192
static final int | adCreateNonCollection = 0
static final int | adCreateOverwrite = 67108864
static final int | adCreateStructDoc = 0x80000000
static final int | adFailIfNotExists = -1
static final int | adOpenIfExists = 33554432

Detailed Description

Definition at line 20 of file RecordCreateOptionsEnum.java.

Member Data Documentation

final int msado15::RecordCreateOptionsEnum::adCreateCollection = 8192 [static]

Definition at line 22 of file RecordCreateOptionsEnum.java.

final int msado15::RecordCreateOptionsEnum::adCreateNonCollection = 0 [static]

Definition at line 24 of file RecordCreateOptionsEnum.java.

final int msado15::RecordCreateOptionsEnum::adCreateOverwrite = 67108864 [static]

Definition at line 26 of file RecordCreateOptionsEnum.java.

final int msado15::RecordCreateOptionsEnum::adCreateStructDoc = 0x80000000 [static]

Definition at line 23 of file RecordCreateOptionsEnum.java.

final int msado15::RecordCreateOptionsEnum::adFailIfNotExists = -1 [static]

Definition at line 27 of file RecordCreateOptionsEnum.java.

final int msado15::RecordCreateOptionsEnum::adOpenIfExists = 33554432 [static]

Definition at line 25 of file RecordCreateOptionsEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/RecordCreateOptionsEnum.java
Generated on Wed Nov 13 2024 16:58:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::RecordOpenOptionsEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::RecordOpenOptionsEnum
Static Public Attributes

msado15::RecordOpenOptionsEnum Class Reference

List of all members.

Static Public Attributes

static final int | adDelayFetchFields = 32768
static final int | adDelayFetchStream = 16384
static final int | adOpenAsync = 4096
static final int | adOpenSource = 128
static final int | adOpenURLBind = 1024

Detailed Description

Definition at line 20 of file RecordOpenOptionsEnum.java.

Member Data Documentation

final int msado15::RecordOpenOptionsEnum::adDelayFetchFields = 32768 [static]

Definition at line 25 of file RecordOpenOptionsEnum.java.

final int msado15::RecordOpenOptionsEnum::adDelayFetchStream = 16384 [static]

Definition at line 24 of file RecordOpenOptionsEnum.java.

final int msado15::RecordOpenOptionsEnum::adOpenAsync = 4096 [static]

Definition at line 23 of file RecordOpenOptionsEnum.java.

final int msado15::RecordOpenOptionsEnum::adOpenSource = 128 [static]

Definition at line 22 of file RecordOpenOptionsEnum.java.

final int msado15::RecordOpenOptionsEnum::adOpenURLBind = 1024 [static]

Definition at line 26 of file RecordOpenOptionsEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/RecordOpenOptionsEnum.java
Generated on Wed Nov 13 2024 16:58:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::Recordset Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::Recordset
Public Member Functions | Static Public Attributes

msado15::Recordset Class Reference

.class(classid=00000535-0000-0010-8000-00AA006D2EA4,DynamicCasts) .interface(iid=00000556-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)

Inherits com::ms::com::IUnknown, and msado15::_Recordset.

List of all members.

Public Member Functions

native msado15._Recordset | _xClone ()
native void | _xResync (int AffectRecords)
native void | _xSave (String FileName, int PersistFormat)
native void | AddNew (Variant FieldList, Variant Values)
native void | Cancel ()
native void | CancelBatch (int AffectRecords)
native void | CancelUpdate ()
native msado15._Recordset | Clone (int LockType)
native void | Close ()
native int | CompareBookmarks (Variant Bookmark1, Variant Bookmark2)
native void | Delete (int AffectRecords)
native void | Find (String Criteria, int SkipRecords, int SearchDirection, Variant Start)
native int | getAbsolutePage ()
native int | getAbsolutePosition ()
native Object | getActiveCommand ()
native Variant | getActiveConnection ()
native boolean | getBOF ()
native Variant | getBookmark ()
native int | getCacheSize ()
native Variant | getCollect (Variant Index)
native int | getCursorLocation ()
native int | getCursorType ()
native String | getDataMember ()
native IUnknown | getDataSource ()
native int | getEditMode ()
native boolean | getEOF ()
native msado15.Fields | getFields ()
native Variant | getFilter ()
native String | getIndex ()
native int | getLockType ()
native int | getMarshalOptions ()
native int | getMaxRecords ()
native int | getPageCount ()
native int | getPageSize ()
native msado15.Properties | getProperties ()
native int | getRecordCount ()
native Variant | GetRows (int Rows, Variant Start, Variant Fields)
native String | getSort ()
native Variant | getSource ()
native int | getState ()
native int | getStatus ()
native boolean | getStayInSync ()
native String | GetString (int StringFormat, int NumRows, String ColumnDelimeter, String RowDelimeter, String NullExpr)
native void | Move (int NumRecords, Variant Start)
native void | MoveFirst ()
native void | MoveLast ()
native void | MoveNext ()
native void | MovePrevious ()
native msado15._Recordset | NextRecordset (Variant RecordsAffected)
native void | Open (Variant Source, Variant ActiveConnection, int CursorType, int LockType, int Options)
native void | Requery (int Options)
native void | Resync (int AffectRecords, int ResyncValues)
native void | Save (Variant Destination, int PersistFormat)
native void | Seek (Variant KeyValues, int SeekOption)
native void | setAbsolutePage (int pl)
native void | setAbsolutePosition (int pl)
native void | setActiveConnection (Object pvar)
native void | setActiveConnection (Variant pvar)
native void | setBookmark (Variant pvBookmark)
native void | setCacheSize (int pl)
native void | setCollect (Variant Index, Variant pvar)
native void | setCursorLocation (int plCursorLoc)
native void | setCursorType (int plCursorType)
native void | setDataMember (String pbstrDataMember)
native void | setDataSource (IUnknown ppunkDataSource)
native void | setFilter (Variant Criteria)
native void | setIndex (String pbstrIndex)
native void | setLockType (int plLockType)
native void | setMarshalOptions (int peMarshal)
native void | setMaxRecords (int plMaxRecords)
native void | setPageSize (int pl)
native void | setSort (String Criteria)
native void | setSource (String pvSource)
native void | setSource (Object pvSource)
native void | setStayInSync (boolean pbStayInSync)
native boolean | Supports (int CursorOptions)
native void | Update (Variant Fields, Variant Values)
native void | UpdateBatch (int AffectRecords)

Static Public Attributes

static final com.ms.com._Guid | clsid = new com.ms.com._Guid((int)0x535, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)
static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x556, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)

Detailed Description

Definition at line 20 of file Recordset.java.

Member Function Documentation

native msado15._Recordset msado15::Recordset::_xClone ( )

.method(vtoffset=53, dispid=1610809392, type=METHOD, name="_xClone", addFlagsVtable=4) .parameters([iid=00000556-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::_Recordset.

native void msado15::Recordset::_xResync ( int AffectRecords )

.method(vtoffset=39, dispid=1610809378, type=METHOD, name="_xResync", addFlagsVtable=4) .parameters([in,type=I4] AffectRecords)

Implements msado15::_Recordset.

native void msado15::Recordset::_xSave | ( | String | FileName,
 |  | int | PersistFormat
 | ) |  |

.method(vtoffset=68, dispid=1610874883, type=METHOD, name="_xSave", addFlagsVtable=4) .parameters([in,type=STRING] FileName, [in,type=I4] PersistFormat)

Implements msado15::_Recordset.

native void msado15::Recordset::AddNew | ( | Variant | FieldList,
 |  | Variant | Values
 | ) |  |

.method(vtoffset=27, dispid=1012, type=METHOD, name="AddNew", addFlagsVtable=4) .parameters([in,type=VARIANT] FieldList, [in,type=VARIANT] Values)

Implements msado15::_Recordset.

native void msado15::Recordset::Cancel ( )

.method(vtoffset=65, dispid=1055, type=METHOD, name="Cancel", addFlagsVtable=4) .parameters()

Implements msado15::_Recordset.

native void msado15::Recordset::CancelBatch ( int AffectRecords )

.method(vtoffset=55, dispid=1049, type=METHOD, name="CancelBatch", addFlagsVtable=4) .parameters([in,type=I4] AffectRecords)

Implements msado15::_Recordset.

native void msado15::Recordset::CancelUpdate ( )

.method(vtoffset=28, dispid=1013, type=METHOD, name="CancelUpdate", addFlagsVtable=4) .parameters()

Implements msado15::_Recordset.

native msado15._Recordset msado15::Recordset::Clone ( int LockType )

.method(vtoffset=76, dispid=1034, type=METHOD, name="Clone", addFlagsVtable=4) .parameters([in,type=I4] LockType, [iid=00000556-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::_Recordset.

native void msado15::Recordset::Close ( )

.method(vtoffset=29, dispid=1014, type=METHOD, name="Close", addFlagsVtable=4) .parameters()

Implements msado15::_Recordset.

native int msado15::Recordset::CompareBookmarks | ( | Variant | Bookmark1,
 |  | Variant | Bookmark2
 | ) |  |

.method(vtoffset=75, dispid=1065, type=METHOD, name="CompareBookmarks", addFlagsVtable=4) .parameters([in,type=VARIANT] Bookmark1, [in,type=VARIANT] Bookmark2, [type=I4] return)

Implements msado15::_Recordset.

native void msado15::Recordset::Delete ( int AffectRecords )

.method(vtoffset=30, dispid=1015, type=METHOD, name="Delete", addFlagsVtable=4) .parameters([in,type=I4] AffectRecords)

Implements msado15::_Recordset.

native void msado15::Recordset::Find | ( | String | Criteria,
 |  | int | SkipRecords,
 |  | int | SearchDirection,
 |  | Variant | Start
 | ) |  |

.method(vtoffset=64, dispid=1058, type=METHOD, name="Find", addFlagsVtable=4) .parameters([in,type=STRING] Criteria, [in,type=I4] SkipRecords, [in,type=I4] SearchDirection, [in,type=VARIANT] Start)

Implements msado15::_Recordset.

native int msado15::Recordset::getAbsolutePage ( )

.method(vtoffset=41, dispid=1047, type=PROPGET, name="AbsolutePage", name2="getAbsolutePage", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::_Recordset.

native int msado15::Recordset::getAbsolutePosition ( )

.method(vtoffset=5, dispid=1000, type=PROPGET, name="AbsolutePosition", name2="getAbsolutePosition", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::_Recordset.

native Object msado15::Recordset::getActiveCommand ( )

.method(vtoffset=69, dispid=1061, type=PROPGET, name="ActiveCommand", name2="getActiveCommand", addFlagsVtable=4) .parameters([iid=00020400-0000-0000-C000-000000000046,thread=AUTO,type=DISPATCH] return)

Implements msado15::_Recordset.

native Variant msado15::Recordset::getActiveConnection ( )

.method(vtoffset=9, dispid=1001, type=PROPGET, name="ActiveConnection", name2="getActiveConnection", addFlagsVtable=4) .parameters([type=VARIANT] return)

Implements msado15::_Recordset.

native boolean msado15::Recordset::getBOF ( )

.method(vtoffset=10, dispid=1002, type=PROPGET, name="BOF", name2="getBOF", addFlagsVtable=4) .parameters([type=BOOLEAN] return)

Implements msado15::_Recordset.

native Variant msado15::Recordset::getBookmark ( )

.method(vtoffset=11, dispid=1003, type=PROPGET, name="Bookmark", name2="getBookmark", addFlagsVtable=4) .parameters([type=VARIANT] return)

Implements msado15::_Recordset.

native int msado15::Recordset::getCacheSize ( )

.method(vtoffset=13, dispid=1004, type=PROPGET, name="CacheSize", name2="getCacheSize", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::_Recordset.

native Variant msado15::Recordset::getCollect ( Variant Index )

.method(vtoffset=60, dispid=4294967288, type=PROPGET, name="Collect", name2="getCollect", addFlagsVtable=4) .parameters([in,type=VARIANT] Index, [type=VARIANT] return)

Implements msado15::_Recordset.

native int msado15::Recordset::getCursorLocation ( )

.method(vtoffset=56, dispid=1051, type=PROPGET, name="CursorLocation", name2="getCursorLocation", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::_Recordset.

native int msado15::Recordset::getCursorType ( )

.method(vtoffset=15, dispid=1005, type=PROPGET, name="CursorType", name2="getCursorType", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::_Recordset.

native String msado15::Recordset::getDataMember ( )

.method(vtoffset=73, dispid=1064, type=PROPGET, name="DataMember", name2="getDataMember", addFlagsVtable=4) .parameters([type=STRING] return)

Implements msado15::_Recordset.

native IUnknown msado15::Recordset::getDataSource ( )

.method(vtoffset=66, dispid=1056, type=PROPGET, name="DataSource", name2="getDataSource", addFlagsVtable=4) .parameters([iid=00000000-0000-0000-C000-000000000046,thread=AUTO,type=OBJECT] return)

Implements msado15::_Recordset.

native int msado15::Recordset::getEditMode ( )

.method(vtoffset=43, dispid=1026, type=PROPGET, name="EditMode", name2="getEditMode", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::_Recordset.

native boolean msado15::Recordset::getEOF ( )

.method(vtoffset=17, dispid=1006, type=PROPGET, name="EOF", name2="getEOF", addFlagsVtable=4) .parameters([type=BOOLEAN] return)

Implements msado15::_Recordset.

native msado15.Fields msado15::Recordset::getFields ( )

.method(vtoffset=18, dispid=0, type=PROPGET, name="Fields", name2="getFields", addFlagsVtable=4) .parameters([iid=00000564-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::_Recordset.

native Variant msado15::Recordset::getFilter ( )

.method(vtoffset=44, dispid=1030, type=PROPGET, name="Filter", name2="getFilter", addFlagsVtable=4) .parameters([type=VARIANT] return)

Implements msado15::_Recordset.

native String msado15::Recordset::getIndex ( )

.method(vtoffset=80, dispid=1067, type=PROPGET, name="Index", name2="getIndex", addFlagsVtable=4) .parameters([type=STRING] return)

Implements msado15::_Recordset.

native int msado15::Recordset::getLockType ( )

.method(vtoffset=19, dispid=1008, type=PROPGET, name="LockType", name2="getLockType", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::_Recordset.

native int msado15::Recordset::getMarshalOptions ( )

.method(vtoffset=62, dispid=1053, type=PROPGET, name="MarshalOptions", name2="getMarshalOptions", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::_Recordset.

native int msado15::Recordset::getMaxRecords ( )

.method(vtoffset=21, dispid=1009, type=PROPGET, name="MaxRecords", name2="getMaxRecords", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::_Recordset.

native int msado15::Recordset::getPageCount ( )

.method(vtoffset=46, dispid=1050, type=PROPGET, name="PageCount", name2="getPageCount", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::_Recordset.

native int msado15::Recordset::getPageSize ( )

.method(vtoffset=47, dispid=1048, type=PROPGET, name="PageSize", name2="getPageSize", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::_Recordset.

native msado15.Properties msado15::Recordset::getProperties ( )

.method(vtoffset=4, dispid=500, type=PROPGET, name="Properties", name2="getProperties", addFlagsVtable=4) .parameters([iid=00000504-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::_Recordset.

native int msado15::Recordset::getRecordCount ( )

.method(vtoffset=23, dispid=1010, type=PROPGET, name="RecordCount", name2="getRecordCount", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::_Recordset.

native Variant msado15::Recordset::GetRows | ( | int | Rows,
 |  | Variant | Start,
 |  | Variant | Fields
 | ) |  |

.method(vtoffset=31, dispid=1016, type=METHOD, name="GetRows", addFlagsVtable=4) .parameters([in,type=I4] Rows, [in,type=VARIANT] Start, [in,type=VARIANT] Fields, [type=VARIANT] return)

Implements msado15::_Recordset.

native String msado15::Recordset::getSort ( )

.method(vtoffset=49, dispid=1031, type=PROPGET, name="Sort", name2="getSort", addFlagsVtable=4) .parameters([type=STRING] return)

Implements msado15::_Recordset.

native Variant msado15::Recordset::getSource ( )

.method(vtoffset=26, dispid=1011, type=PROPGET, name="Source", name2="getSource", addFlagsVtable=4) .parameters([type=VARIANT] return)

Implements msado15::_Recordset.

native int msado15::Recordset::getState ( )

.method(vtoffset=52, dispid=1054, type=PROPGET, name="State", name2="getState", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::_Recordset.

native int msado15::Recordset::getStatus ( )

.method(vtoffset=51, dispid=1029, type=PROPGET, name="Status", name2="getStatus", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::_Recordset.

native boolean msado15::Recordset::getStayInSync ( )

.method(vtoffset=71, dispid=1063, type=PROPGET, name="StayInSync", name2="getStayInSync", addFlagsVtable=4) .parameters([type=BOOLEAN] return)

Implements msado15::_Recordset.

native String msado15::Recordset::GetString | ( | int | StringFormat,
 |  | int | NumRows,
 |  | String | ColumnDelimeter,
 |  | String | RowDelimeter,
 |  | String | NullExpr
 | ) |  |

.method(vtoffset=72, dispid=1062, type=METHOD, name="GetString", addFlagsVtable=4) .parameters([in,type=I4] StringFormat, [in,type=I4] NumRows, [in,type=STRING] ColumnDelimeter, [in,type=STRING] RowDelimeter, [in,type=STRING] NullExpr, [type=STRING] return)

Implements msado15::_Recordset.

native void msado15::Recordset::Move | ( | int | NumRecords,
 |  | Variant | Start
 | ) |  |

.method(vtoffset=32, dispid=1017, type=METHOD, name="Move", addFlagsVtable=4) .parameters([in,type=I4] NumRecords, [in,type=VARIANT] Start)

Implements msado15::_Recordset.

native void msado15::Recordset::MoveFirst ( )

.method(vtoffset=35, dispid=1020, type=METHOD, name="MoveFirst", addFlagsVtable=4) .parameters()

Implements msado15::_Recordset.

native void msado15::Recordset::MoveLast ( )

.method(vtoffset=36, dispid=1021, type=METHOD, name="MoveLast", addFlagsVtable=4) .parameters()

Implements msado15::_Recordset.

native void msado15::Recordset::MoveNext ( )

.method(vtoffset=33, dispid=1018, type=METHOD, name="MoveNext", addFlagsVtable=4) .parameters()

Implements msado15::_Recordset.

native void msado15::Recordset::MovePrevious ( )

.method(vtoffset=34, dispid=1019, type=METHOD, name="MovePrevious", addFlagsVtable=4) .parameters()

Implements msado15::_Recordset.

native msado15._Recordset msado15::Recordset::NextRecordset ( Variant RecordsAffected )

.method(vtoffset=58, dispid=1052, type=METHOD, name="NextRecordset", addFlagsVtable=4) .parameters([out,elementType=VARIANT,type=PTR] RecordsAffected, [iid=00000556-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::_Recordset.

native void msado15::Recordset::Open | ( | Variant | Source,
 |  | Variant | ActiveConnection,
 |  | int | CursorType,
 |  | int | LockType,
 |  | int | Options
 | ) |  |

.method(vtoffset=37, dispid=1022, type=METHOD, name="Open", addFlagsVtable=4) .parameters([in,type=VARIANT] Source, [in,type=VARIANT] ActiveConnection, [in,type=I4] CursorType, [in,type=I4] LockType, [in,type=I4] Options)

Implements msado15::_Recordset.

native void msado15::Recordset::Requery ( int Options )

.method(vtoffset=38, dispid=1023, type=METHOD, name="Requery", addFlagsVtable=4) .parameters([in,type=I4] Options)

Implements msado15::_Recordset.

native void msado15::Recordset::Resync | ( | int | AffectRecords,
 |  | int | ResyncValues
 | ) |  |

.method(vtoffset=77, dispid=1024, type=METHOD, name="Resync", addFlagsVtable=4) .parameters([in,type=I4] AffectRecords, [in,type=I4] ResyncValues)

Implements msado15::_Recordset.

native void msado15::Recordset::Save | ( | Variant | Destination,
 |  | int | PersistFormat
 | ) |  |

.method(vtoffset=81, dispid=1057, type=METHOD, name="Save", addFlagsVtable=4) .parameters([in,type=VARIANT] Destination, [in,type=I4] PersistFormat)

Implements msado15::_Recordset.

native void msado15::Recordset::Seek | ( | Variant | KeyValues,
 |  | int | SeekOption
 | ) |  |

.method(vtoffset=78, dispid=1066, type=METHOD, name="Seek", addFlagsVtable=4) .parameters([in,type=VARIANT] KeyValues, [in,type=I4] SeekOption)

Implements msado15::_Recordset.

native void msado15::Recordset::setAbsolutePage ( int pl )

.method(vtoffset=42, dispid=1047, type=PROPPUT, name="AbsolutePage", name2="putAbsolutePage", addFlagsVtable=4) .parameters([in,type=I4] pl)

Implements msado15::_Recordset.

native void msado15::Recordset::setAbsolutePosition ( int pl )

.method(vtoffset=6, dispid=1000, type=PROPPUT, name="AbsolutePosition", name2="putAbsolutePosition", addFlagsVtable=4) .parameters([in,type=I4] pl)

Implements msado15::_Recordset.

native void msado15::Recordset::setActiveConnection ( Object pvar )

.method(vtoffset=7, dispid=1001, type=PROPPUTREF, name="ActiveConnection", name2="putActiveConnection", addFlagsVtable=4) .parameters([in,iid=00020400-0000-0000-C000-000000000046,thread=AUTO,type=DISPATCH] pvar)

Implements msado15::_Recordset.

native void msado15::Recordset::setActiveConnection ( Variant pvar )

.method(vtoffset=8, dispid=1001, type=PROPPUT, name="ActiveConnection", name2="putActiveConnection", addFlagsVtable=4) .parameters([in,type=VARIANT] pvar)

Implements msado15::_Recordset.

native void msado15::Recordset::setBookmark ( Variant pvBookmark )

.method(vtoffset=12, dispid=1003, type=PROPPUT, name="Bookmark", name2="putBookmark", addFlagsVtable=4) .parameters([in,type=VARIANT] pvBookmark)

Implements msado15::_Recordset.

native void msado15::Recordset::setCacheSize ( int pl )

.method(vtoffset=14, dispid=1004, type=PROPPUT, name="CacheSize", name2="putCacheSize", addFlagsVtable=4) .parameters([in,type=I4] pl)

Implements msado15::_Recordset.

native void msado15::Recordset::setCollect | ( | Variant | Index,
 |  | Variant | pvar
 | ) |  |

.method(vtoffset=61, dispid=4294967288, type=PROPPUT, name="Collect", name2="putCollect", addFlagsVtable=4) .parameters([in,type=VARIANT] Index, [in,type=VARIANT] pvar)

Implements msado15::_Recordset.

native void msado15::Recordset::setCursorLocation ( int plCursorLoc )

.method(vtoffset=57, dispid=1051, type=PROPPUT, name="CursorLocation", name2="putCursorLocation", addFlagsVtable=4) .parameters([in,type=I4] plCursorLoc)

Implements msado15::_Recordset.

native void msado15::Recordset::setCursorType ( int plCursorType )

.method(vtoffset=16, dispid=1005, type=PROPPUT, name="CursorType", name2="putCursorType", addFlagsVtable=4) .parameters([in,type=I4] plCursorType)

Implements msado15::_Recordset.

native void msado15::Recordset::setDataMember ( String pbstrDataMember )

.method(vtoffset=74, dispid=1064, type=PROPPUT, name="DataMember", name2="putDataMember", addFlagsVtable=4) .parameters([in,type=STRING] pbstrDataMember)

Implements msado15::_Recordset.

native void msado15::Recordset::setDataSource ( IUnknown ppunkDataSource )

.method(vtoffset=67, dispid=1056, type=PROPPUTREF, name="DataSource", name2="putDataSource", addFlagsVtable=4) .parameters([in,iid=00000000-0000-0000-C000-000000000046,thread=AUTO,type=OBJECT] ppunkDataSource)

Implements msado15::_Recordset.

native void msado15::Recordset::setFilter ( Variant Criteria )

.method(vtoffset=45, dispid=1030, type=PROPPUT, name="Filter", name2="putFilter", addFlagsVtable=4) .parameters([in,type=VARIANT] Criteria)

Implements msado15::_Recordset.

native void msado15::Recordset::setIndex ( String pbstrIndex )

.method(vtoffset=79, dispid=1067, type=PROPPUT, name="Index", name2="putIndex", addFlagsVtable=4) .parameters([in,type=STRING] pbstrIndex)

Implements msado15::_Recordset.

native void msado15::Recordset::setLockType ( int plLockType )

.method(vtoffset=20, dispid=1008, type=PROPPUT, name="LockType", name2="putLockType", addFlagsVtable=4) .parameters([in,type=I4] plLockType)

Implements msado15::_Recordset.

native void msado15::Recordset::setMarshalOptions ( int peMarshal )

.method(vtoffset=63, dispid=1053, type=PROPPUT, name="MarshalOptions", name2="putMarshalOptions", addFlagsVtable=4) .parameters([in,type=I4] peMarshal)

Implements msado15::_Recordset.

native void msado15::Recordset::setMaxRecords ( int plMaxRecords )

.method(vtoffset=22, dispid=1009, type=PROPPUT, name="MaxRecords", name2="putMaxRecords", addFlagsVtable=4) .parameters([in,type=I4] plMaxRecords)

Implements msado15::_Recordset.

native void msado15::Recordset::setPageSize ( int pl )

.method(vtoffset=48, dispid=1048, type=PROPPUT, name="PageSize", name2="putPageSize", addFlagsVtable=4) .parameters([in,type=I4] pl)

Implements msado15::_Recordset.

native void msado15::Recordset::setSort ( String Criteria )

.method(vtoffset=50, dispid=1031, type=PROPPUT, name="Sort", name2="putSort", addFlagsVtable=4) .parameters([in,type=STRING] Criteria)

Implements msado15::_Recordset.

native void msado15::Recordset::setSource ( String pvSource )

.method(vtoffset=25, dispid=1011, type=PROPPUT, name="Source", name2="putSource", addFlagsVtable=4) .parameters([in,type=STRING] pvSource)

Implements msado15::_Recordset.

native void msado15::Recordset::setSource ( Object pvSource )

.method(vtoffset=24, dispid=1011, type=PROPPUTREF, name="Source", name2="putSource", addFlagsVtable=4) .parameters([in,iid=00020400-0000-0000-C000-000000000046,thread=AUTO,type=DISPATCH] pvSource)

Implements msado15::_Recordset.

native void msado15::Recordset::setStayInSync ( boolean pbStayInSync )

.method(vtoffset=70, dispid=1063, type=PROPPUT, name="StayInSync", name2="putStayInSync", addFlagsVtable=4) .parameters([in,type=BOOLEAN] pbStayInSync)

Implements msado15::_Recordset.

native boolean msado15::Recordset::Supports ( int CursorOptions )

.method(vtoffset=59, dispid=1036, type=METHOD, name="Supports", addFlagsVtable=4) .parameters([in,type=I4] CursorOptions, [type=BOOLEAN] return)

Implements msado15::_Recordset.

native void msado15::Recordset::Update | ( | Variant | Fields,
 |  | Variant | Values
 | ) |  |

.method(vtoffset=40, dispid=1025, type=METHOD, name="Update", addFlagsVtable=4) .parameters([in,type=VARIANT] Fields, [in,type=VARIANT] Values)

Implements msado15::_Recordset.

native void msado15::Recordset::UpdateBatch ( int AffectRecords )

.method(vtoffset=54, dispid=1035, type=METHOD, name="UpdateBatch", addFlagsVtable=4) .parameters([in,type=I4] AffectRecords)

Implements msado15::_Recordset.

Member Data Documentation

final com.ms.com._Guid msado15::Recordset::clsid = new com.ms.com._Guid((int)0x535, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Definition at line 342 of file Recordset.java.

final com.ms.com._Guid msado15::Recordset::iid = new com.ms.com._Guid((int)0x556, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Implements msado15::_Recordset.

Definition at line 340 of file Recordset.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Recordset.java
Generated on Wed Nov 13 2024 16:58:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::Recordset15 Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::Recordset15
Public Member Functions | Static Public Attributes

msado15::Recordset15 Interface Reference

.interface(iid=0000050E-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)

Inherits msado15::_ADO.

Inherited by msado15::Recordset20.

List of all members.

Public Member Functions

msado15._Recordset _xClone ()
void | _xResync (int AffectRecords)
void | AddNew (Variant FieldList, Variant Values)
void | CancelBatch (int AffectRecords)
void | CancelUpdate ()
void | Close ()
void | Delete (int AffectRecords)
void | Find (String Criteria, int SkipRecords, int SearchDirection, Variant Start)
int | getAbsolutePage ()
int | getAbsolutePosition ()
Variant | getActiveConnection ()
boolean | getBOF ()
Variant | getBookmark ()
int | getCacheSize ()
Variant | getCollect (Variant Index)
int | getCursorLocation ()
int | getCursorType ()
int | getEditMode ()
boolean | getEOF ()
msado15.Fields getFields ()
Variant | getFilter ()
int | getLockType ()
int | getMarshalOptions ()
int | getMaxRecords ()
int | getPageCount ()
int | getPageSize ()
msado15.Properties getProperties ()
int | getRecordCount ()
Variant | GetRows (int Rows, Variant Start, Variant Fields)
String | getSort ()
Variant | getSource ()
int | getState ()
int | getStatus ()
void | Move (int NumRecords, Variant Start)
void | MoveFirst ()
void | MoveLast ()
void | MoveNext ()
void | MovePrevious ()
msado15._Recordset | NextRecordset (Variant RecordsAffected)
void | Open (Variant Source, Variant ActiveConnection, int CursorType, int LockType, int Options)
void | Requery (int Options)
void | setAbsolutePage (int pl)
void | setAbsolutePosition (int pl)
void | setActiveConnection (Object pvar)
void | setActiveConnection (Variant pvar)
void | setBookmark (Variant pvBookmark)
void | setCacheSize (int pl)
void | setCollect (Variant Index, Variant pvar)
void | setCursorLocation (int plCursorLoc)
void | setCursorType (int plCursorType)
void | setFilter (Variant Criteria)
void | setLockType (int plLockType)
void | setMarshalOptions (int peMarshal)
void | setMaxRecords (int plMaxRecords)
void | setPageSize (int pl)
void | setSort (String Criteria)
void | setSource (Object pvSource)
void | setSource (String pvSource)
boolean | Supports (int CursorOptions)
void | Update (Variant Fields, Variant Values)
void | UpdateBatch (int AffectRecords)

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x50e, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)

Detailed Description

Definition at line 20 of file Recordset15.java.

Member Function Documentation

msado15._Recordset msado15::Recordset15::_xClone ( )

.method(vtoffset=53, dispid=1610809392, type=METHOD, name="_xClone", addFlagsVtable=4) .parameters([iid=00000556-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

void msado15::Recordset15::_xResync ( int AffectRecords )

.method(vtoffset=39, dispid=1610809378, type=METHOD, name="_xResync", addFlagsVtable=4) .parameters([in,type=I4] AffectRecords)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

void msado15::Recordset15::AddNew | ( | Variant | FieldList,
 |  | Variant | Values
 | ) |  |

.method(vtoffset=27, dispid=1012, type=METHOD, name="AddNew", addFlagsVtable=4) .parameters([in,type=VARIANT] FieldList, [in,type=VARIANT] Values)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

void msado15::Recordset15::CancelBatch ( int AffectRecords )

.method(vtoffset=55, dispid=1049, type=METHOD, name="CancelBatch", addFlagsVtable=4) .parameters([in,type=I4] AffectRecords)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

void msado15::Recordset15::CancelUpdate ( )

.method(vtoffset=28, dispid=1013, type=METHOD, name="CancelUpdate", addFlagsVtable=4) .parameters()

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

void msado15::Recordset15::Close ( )

.method(vtoffset=29, dispid=1014, type=METHOD, name="Close", addFlagsVtable=4) .parameters()

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

void msado15::Recordset15::Delete ( int AffectRecords )

.method(vtoffset=30, dispid=1015, type=METHOD, name="Delete", addFlagsVtable=4) .parameters([in,type=I4] AffectRecords)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

void msado15::Recordset15::Find | ( | String | Criteria,
 |  | int | SkipRecords,
 |  | int | SearchDirection,
 |  | Variant | Start
 | ) |  |

.method(vtoffset=64, dispid=1058, type=METHOD, name="Find", addFlagsVtable=4) .parameters([in,type=STRING] Criteria, [in,type=I4] SkipRecords, [in,type=I4] SearchDirection, [in,type=VARIANT] Start)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

int msado15::Recordset15::getAbsolutePage ( )

.method(vtoffset=41, dispid=1047, type=PROPGET, name="AbsolutePage", name2="getAbsolutePage", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

int msado15::Recordset15::getAbsolutePosition ( )

.method(vtoffset=5, dispid=1000, type=PROPGET, name="AbsolutePosition", name2="getAbsolutePosition", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

Variant msado15::Recordset15::getActiveConnection ( )

.method(vtoffset=9, dispid=1001, type=PROPGET, name="ActiveConnection", name2="getActiveConnection", addFlagsVtable=4) .parameters([type=VARIANT] return)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

boolean msado15::Recordset15::getBOF ( )

.method(vtoffset=10, dispid=1002, type=PROPGET, name="BOF", name2="getBOF", addFlagsVtable=4) .parameters([type=BOOLEAN] return)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

Variant msado15::Recordset15::getBookmark ( )

.method(vtoffset=11, dispid=1003, type=PROPGET, name="Bookmark", name2="getBookmark", addFlagsVtable=4) .parameters([type=VARIANT] return)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

int msado15::Recordset15::getCacheSize ( )

.method(vtoffset=13, dispid=1004, type=PROPGET, name="CacheSize", name2="getCacheSize", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

Variant msado15::Recordset15::getCollect ( Variant Index )

.method(vtoffset=60, dispid=4294967288, type=PROPGET, name="Collect", name2="getCollect", addFlagsVtable=4) .parameters([in,type=VARIANT] Index, [type=VARIANT] return)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

int msado15::Recordset15::getCursorLocation ( )

.method(vtoffset=56, dispid=1051, type=PROPGET, name="CursorLocation", name2="getCursorLocation", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

int msado15::Recordset15::getCursorType ( )

.method(vtoffset=15, dispid=1005, type=PROPGET, name="CursorType", name2="getCursorType", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

int msado15::Recordset15::getEditMode ( )

.method(vtoffset=43, dispid=1026, type=PROPGET, name="EditMode", name2="getEditMode", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

boolean msado15::Recordset15::getEOF ( )

.method(vtoffset=17, dispid=1006, type=PROPGET, name="EOF", name2="getEOF", addFlagsVtable=4) .parameters([type=BOOLEAN] return)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

msado15.Fields msado15::Recordset15::getFields ( )

.method(vtoffset=18, dispid=0, type=PROPGET, name="Fields", name2="getFields", addFlagsVtable=4) .parameters([iid=00000564-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

Variant msado15::Recordset15::getFilter ( )

.method(vtoffset=44, dispid=1030, type=PROPGET, name="Filter", name2="getFilter", addFlagsVtable=4) .parameters([type=VARIANT] return)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

int msado15::Recordset15::getLockType ( )

.method(vtoffset=19, dispid=1008, type=PROPGET, name="LockType", name2="getLockType", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

int msado15::Recordset15::getMarshalOptions ( )

.method(vtoffset=62, dispid=1053, type=PROPGET, name="MarshalOptions", name2="getMarshalOptions", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

int msado15::Recordset15::getMaxRecords ( )

.method(vtoffset=21, dispid=1009, type=PROPGET, name="MaxRecords", name2="getMaxRecords", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

int msado15::Recordset15::getPageCount ( )

.method(vtoffset=46, dispid=1050, type=PROPGET, name="PageCount", name2="getPageCount", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

int msado15::Recordset15::getPageSize ( )

.method(vtoffset=47, dispid=1048, type=PROPGET, name="PageSize", name2="getPageSize", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

msado15.Properties msado15::Recordset15::getProperties ( )

.method(vtoffset=4, dispid=500, type=PROPGET, name="Properties", name2="getProperties", addFlagsVtable=4) .parameters([iid=00000504-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::_ADO.

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

int msado15::Recordset15::getRecordCount ( )

.method(vtoffset=23, dispid=1010, type=PROPGET, name="RecordCount", name2="getRecordCount", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

Variant msado15::Recordset15::GetRows | ( | int | Rows,
 |  | Variant | Start,
 |  | Variant | Fields
 | ) |  |

.method(vtoffset=31, dispid=1016, type=METHOD, name="GetRows", addFlagsVtable=4) .parameters([in,type=I4] Rows, [in,type=VARIANT] Start, [in,type=VARIANT] Fields, [type=VARIANT] return)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

String msado15::Recordset15::getSort ( )

.method(vtoffset=49, dispid=1031, type=PROPGET, name="Sort", name2="getSort", addFlagsVtable=4) .parameters([type=STRING] return)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

Variant msado15::Recordset15::getSource ( )

.method(vtoffset=26, dispid=1011, type=PROPGET, name="Source", name2="getSource", addFlagsVtable=4) .parameters([type=VARIANT] return)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

int msado15::Recordset15::getState ( )

.method(vtoffset=52, dispid=1054, type=PROPGET, name="State", name2="getState", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

int msado15::Recordset15::getStatus ( )

.method(vtoffset=51, dispid=1029, type=PROPGET, name="Status", name2="getStatus", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

void msado15::Recordset15::Move | ( | int | NumRecords,
 |  | Variant | Start
 | ) |  |

.method(vtoffset=32, dispid=1017, type=METHOD, name="Move", addFlagsVtable=4) .parameters([in,type=I4] NumRecords, [in,type=VARIANT] Start)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

void msado15::Recordset15::MoveFirst ( )

.method(vtoffset=35, dispid=1020, type=METHOD, name="MoveFirst", addFlagsVtable=4) .parameters()

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

void msado15::Recordset15::MoveLast ( )

.method(vtoffset=36, dispid=1021, type=METHOD, name="MoveLast", addFlagsVtable=4) .parameters()

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

void msado15::Recordset15::MoveNext ( )

.method(vtoffset=33, dispid=1018, type=METHOD, name="MoveNext", addFlagsVtable=4) .parameters()

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

void msado15::Recordset15::MovePrevious ( )

.method(vtoffset=34, dispid=1019, type=METHOD, name="MovePrevious", addFlagsVtable=4) .parameters()

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

msado15._Recordset msado15::Recordset15::NextRecordset ( Variant RecordsAffected )

.method(vtoffset=58, dispid=1052, type=METHOD, name="NextRecordset", addFlagsVtable=4) .parameters([out,elementType=VARIANT,type=PTR] RecordsAffected, [iid=00000556-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

void msado15::Recordset15::Open | ( | Variant | Source,
 |  | Variant | ActiveConnection,
 |  | int | CursorType,
 |  | int | LockType,
 |  | int | Options
 | ) |  |

.method(vtoffset=37, dispid=1022, type=METHOD, name="Open", addFlagsVtable=4) .parameters([in,type=VARIANT] Source, [in,type=VARIANT] ActiveConnection, [in,type=I4] CursorType, [in,type=I4] LockType, [in,type=I4] Options)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

void msado15::Recordset15::Requery ( int Options )

.method(vtoffset=38, dispid=1023, type=METHOD, name="Requery", addFlagsVtable=4) .parameters([in,type=I4] Options)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

void msado15::Recordset15::setAbsolutePage ( int pl )

.method(vtoffset=42, dispid=1047, type=PROPPUT, name="AbsolutePage", name2="putAbsolutePage", addFlagsVtable=4) .parameters([in,type=I4] pl)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

void msado15::Recordset15::setAbsolutePosition ( int pl )

.method(vtoffset=6, dispid=1000, type=PROPPUT, name="AbsolutePosition", name2="putAbsolutePosition", addFlagsVtable=4) .parameters([in,type=I4] pl)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

void msado15::Recordset15::setActiveConnection ( Object pvar )

.method(vtoffset=7, dispid=1001, type=PROPPUTREF, name="ActiveConnection", name2="putActiveConnection", addFlagsVtable=4) .parameters([in,iid=00020400-0000-0000-C000-000000000046,thread=AUTO,type=DISPATCH] pvar)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

void msado15::Recordset15::setActiveConnection ( Variant pvar )

.method(vtoffset=8, dispid=1001, type=PROPPUT, name="ActiveConnection", name2="putActiveConnection", addFlagsVtable=4) .parameters([in,type=VARIANT] pvar)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

void msado15::Recordset15::setBookmark ( Variant pvBookmark )

.method(vtoffset=12, dispid=1003, type=PROPPUT, name="Bookmark", name2="putBookmark", addFlagsVtable=4) .parameters([in,type=VARIANT] pvBookmark)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

void msado15::Recordset15::setCacheSize ( int pl )

.method(vtoffset=14, dispid=1004, type=PROPPUT, name="CacheSize", name2="putCacheSize", addFlagsVtable=4) .parameters([in,type=I4] pl)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

void msado15::Recordset15::setCollect | ( | Variant | Index,
 |  | Variant | pvar
 | ) |  |

.method(vtoffset=61, dispid=4294967288, type=PROPPUT, name="Collect", name2="putCollect", addFlagsVtable=4) .parameters([in,type=VARIANT] Index, [in,type=VARIANT] pvar)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

void msado15::Recordset15::setCursorLocation ( int plCursorLoc )

.method(vtoffset=57, dispid=1051, type=PROPPUT, name="CursorLocation", name2="putCursorLocation", addFlagsVtable=4) .parameters([in,type=I4] plCursorLoc)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

void msado15::Recordset15::setCursorType ( int plCursorType )

.method(vtoffset=16, dispid=1005, type=PROPPUT, name="CursorType", name2="putCursorType", addFlagsVtable=4) .parameters([in,type=I4] plCursorType)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

void msado15::Recordset15::setFilter ( Variant Criteria )

.method(vtoffset=45, dispid=1030, type=PROPPUT, name="Filter", name2="putFilter", addFlagsVtable=4) .parameters([in,type=VARIANT] Criteria)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

void msado15::Recordset15::setLockType ( int plLockType )

.method(vtoffset=20, dispid=1008, type=PROPPUT, name="LockType", name2="putLockType", addFlagsVtable=4) .parameters([in,type=I4] plLockType)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

void msado15::Recordset15::setMarshalOptions ( int peMarshal )

.method(vtoffset=63, dispid=1053, type=PROPPUT, name="MarshalOptions", name2="putMarshalOptions", addFlagsVtable=4) .parameters([in,type=I4] peMarshal)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

void msado15::Recordset15::setMaxRecords ( int plMaxRecords )

.method(vtoffset=22, dispid=1009, type=PROPPUT, name="MaxRecords", name2="putMaxRecords", addFlagsVtable=4) .parameters([in,type=I4] plMaxRecords)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

void msado15::Recordset15::setPageSize ( int pl )

.method(vtoffset=48, dispid=1048, type=PROPPUT, name="PageSize", name2="putPageSize", addFlagsVtable=4) .parameters([in,type=I4] pl)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

void msado15::Recordset15::setSort ( String Criteria )

.method(vtoffset=50, dispid=1031, type=PROPPUT, name="Sort", name2="putSort", addFlagsVtable=4) .parameters([in,type=STRING] Criteria)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

void msado15::Recordset15::setSource ( Object pvSource )

.method(vtoffset=24, dispid=1011, type=PROPPUTREF, name="Source", name2="putSource", addFlagsVtable=4) .parameters([in,iid=00020400-0000-0000-C000-000000000046,thread=AUTO,type=DISPATCH] pvSource)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

void msado15::Recordset15::setSource ( String pvSource )

.method(vtoffset=25, dispid=1011, type=PROPPUT, name="Source", name2="putSource", addFlagsVtable=4) .parameters([in,type=STRING] pvSource)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

boolean msado15::Recordset15::Supports ( int CursorOptions )

.method(vtoffset=59, dispid=1036, type=METHOD, name="Supports", addFlagsVtable=4) .parameters([in,type=I4] CursorOptions, [type=BOOLEAN] return)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

void msado15::Recordset15::Update | ( | Variant | Fields,
 |  | Variant | Values
 | ) |  |

.method(vtoffset=40, dispid=1025, type=METHOD, name="Update", addFlagsVtable=4) .parameters([in,type=VARIANT] Fields, [in,type=VARIANT] Values)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

void msado15::Recordset15::UpdateBatch ( int AffectRecords )

.method(vtoffset=54, dispid=1035, type=METHOD, name="UpdateBatch", addFlagsVtable=4) .parameters([in,type=I4] AffectRecords)

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

Member Data Documentation

final com.ms.com._Guid msado15::Recordset15::iid = new com.ms.com._Guid((int)0x50e, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Implements msado15::_ADO.

Implemented in msado15::_Recordset, msado15::Recordset, msado15::Recordset20, and msado15::Recordset21.

Definition at line 271 of file Recordset15.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Recordset15.java
Generated on Wed Nov 13 2024 16:58:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::Recordset20 Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::Recordset20
Public Member Functions | Static Public Attributes

msado15::Recordset20 Interface Reference

.interface(iid=0000054F-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)

Inherits msado15::Recordset15.

Inherited by msado15::Recordset21.

List of all members.

Public Member Functions

msado15._Recordset _xClone ()
void | _xResync (int AffectRecords)
void | _xSave (String FileName, int PersistFormat)
void | AddNew (Variant FieldList, Variant Values)
void | Cancel ()
void | CancelBatch (int AffectRecords)
void | CancelUpdate ()
msado15._Recordset | Clone (int LockType)
void | Close ()
int | CompareBookmarks (Variant Bookmark1, Variant Bookmark2)
void | Delete (int AffectRecords)
void | Find (String Criteria, int SkipRecords, int SearchDirection, Variant Start)
int | getAbsolutePage ()
int | getAbsolutePosition ()
Object | getActiveCommand ()
Variant | getActiveConnection ()
boolean | getBOF ()
Variant | getBookmark ()
int | getCacheSize ()
Variant | getCollect (Variant Index)
int | getCursorLocation ()
int | getCursorType ()
String | getDataMember ()
IUnknown | getDataSource ()
int | getEditMode ()
boolean | getEOF ()
msado15.Fields getFields ()
Variant | getFilter ()
int | getLockType ()
int | getMarshalOptions ()
int | getMaxRecords ()
int | getPageCount ()
int | getPageSize ()
msado15.Properties getProperties ()
int | getRecordCount ()
Variant | GetRows (int Rows, Variant Start, Variant Fields)
String | getSort ()
Variant | getSource ()
int | getState ()
int | getStatus ()
boolean | getStayInSync ()
String | GetString (int StringFormat, int NumRows, String ColumnDelimeter, String RowDelimeter, String NullExpr)
void | Move (int NumRecords, Variant Start)
void | MoveFirst ()
void | MoveLast ()
void | MoveNext ()
void | MovePrevious ()
msado15._Recordset | NextRecordset (Variant RecordsAffected)
void | Open (Variant Source, Variant ActiveConnection, int CursorType, int LockType, int Options)
void | Requery (int Options)
void | Resync (int AffectRecords, int ResyncValues)
void | setAbsolutePage (int pl)
void | setAbsolutePosition (int pl)
void | setActiveConnection (Object pvar)
void | setActiveConnection (Variant pvar)
void | setBookmark (Variant pvBookmark)
void | setCacheSize (int pl)
void | setCollect (Variant Index, Variant pvar)
void | setCursorLocation (int plCursorLoc)
void | setCursorType (int plCursorType)
void | setDataMember (String pbstrDataMember)
void | setDataSource (IUnknown ppunkDataSource)
void | setFilter (Variant Criteria)
void | setLockType (int plLockType)
void | setMarshalOptions (int peMarshal)
void | setMaxRecords (int plMaxRecords)
void | setPageSize (int pl)
void | setSort (String Criteria)
void | setSource (Object pvSource)
void | setSource (String pvSource)
void | setStayInSync (boolean pbStayInSync)
boolean | Supports (int CursorOptions)
void | Update (Variant Fields, Variant Values)
void | UpdateBatch (int AffectRecords)

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x54f, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)

Detailed Description

Definition at line 20 of file Recordset20.java.

Member Function Documentation

msado15._Recordset msado15::Recordset20::_xClone ( )

.method(vtoffset=53, dispid=1610809392, type=METHOD, name="_xClone", addFlagsVtable=4) .parameters([iid=00000556-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

void msado15::Recordset20::_xResync ( int AffectRecords )

.method(vtoffset=39, dispid=1610809378, type=METHOD, name="_xResync", addFlagsVtable=4) .parameters([in,type=I4] AffectRecords)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

void msado15::Recordset20::_xSave | ( | String | FileName,
 |  | int | PersistFormat
 | ) |  |

.method(vtoffset=68, dispid=1610874883, type=METHOD, name="_xSave", addFlagsVtable=4) .parameters([in,type=STRING] FileName, [in,type=I4] PersistFormat)

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

void msado15::Recordset20::AddNew | ( | Variant | FieldList,
 |  | Variant | Values
 | ) |  |

.method(vtoffset=27, dispid=1012, type=METHOD, name="AddNew", addFlagsVtable=4) .parameters([in,type=VARIANT] FieldList, [in,type=VARIANT] Values)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

void msado15::Recordset20::Cancel ( )

.method(vtoffset=65, dispid=1055, type=METHOD, name="Cancel", addFlagsVtable=4) .parameters()

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

void msado15::Recordset20::CancelBatch ( int AffectRecords )

.method(vtoffset=55, dispid=1049, type=METHOD, name="CancelBatch", addFlagsVtable=4) .parameters([in,type=I4] AffectRecords)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

void msado15::Recordset20::CancelUpdate ( )

.method(vtoffset=28, dispid=1013, type=METHOD, name="CancelUpdate", addFlagsVtable=4) .parameters()

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

msado15._Recordset msado15::Recordset20::Clone ( int LockType )

.method(vtoffset=76, dispid=1034, type=METHOD, name="Clone", addFlagsVtable=4) .parameters([in,type=I4] LockType, [iid=00000556-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

void msado15::Recordset20::Close ( )

.method(vtoffset=29, dispid=1014, type=METHOD, name="Close", addFlagsVtable=4) .parameters()

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

int msado15::Recordset20::CompareBookmarks | ( | Variant | Bookmark1,
 |  | Variant | Bookmark2
 | ) |  |

.method(vtoffset=75, dispid=1065, type=METHOD, name="CompareBookmarks", addFlagsVtable=4) .parameters([in,type=VARIANT] Bookmark1, [in,type=VARIANT] Bookmark2, [type=I4] return)

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

void msado15::Recordset20::Delete ( int AffectRecords )

.method(vtoffset=30, dispid=1015, type=METHOD, name="Delete", addFlagsVtable=4) .parameters([in,type=I4] AffectRecords)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

void msado15::Recordset20::Find | ( | String | Criteria,
 |  | int | SkipRecords,
 |  | int | SearchDirection,
 |  | Variant | Start
 | ) |  |

.method(vtoffset=64, dispid=1058, type=METHOD, name="Find", addFlagsVtable=4) .parameters([in,type=STRING] Criteria, [in,type=I4] SkipRecords, [in,type=I4] SearchDirection, [in,type=VARIANT] Start)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

int msado15::Recordset20::getAbsolutePage ( )

.method(vtoffset=41, dispid=1047, type=PROPGET, name="AbsolutePage", name2="getAbsolutePage", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

int msado15::Recordset20::getAbsolutePosition ( )

.method(vtoffset=5, dispid=1000, type=PROPGET, name="AbsolutePosition", name2="getAbsolutePosition", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

Object msado15::Recordset20::getActiveCommand ( )

.method(vtoffset=69, dispid=1061, type=PROPGET, name="ActiveCommand", name2="getActiveCommand", addFlagsVtable=4) .parameters([iid=00020400-0000-0000-C000-000000000046,thread=AUTO,type=DISPATCH] return)

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

Variant msado15::Recordset20::getActiveConnection ( )

.method(vtoffset=9, dispid=1001, type=PROPGET, name="ActiveConnection", name2="getActiveConnection", addFlagsVtable=4) .parameters([type=VARIANT] return)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

boolean msado15::Recordset20::getBOF ( )

.method(vtoffset=10, dispid=1002, type=PROPGET, name="BOF", name2="getBOF", addFlagsVtable=4) .parameters([type=BOOLEAN] return)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

Variant msado15::Recordset20::getBookmark ( )

.method(vtoffset=11, dispid=1003, type=PROPGET, name="Bookmark", name2="getBookmark", addFlagsVtable=4) .parameters([type=VARIANT] return)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

int msado15::Recordset20::getCacheSize ( )

.method(vtoffset=13, dispid=1004, type=PROPGET, name="CacheSize", name2="getCacheSize", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

Variant msado15::Recordset20::getCollect ( Variant Index )

.method(vtoffset=60, dispid=4294967288, type=PROPGET, name="Collect", name2="getCollect", addFlagsVtable=4) .parameters([in,type=VARIANT] Index, [type=VARIANT] return)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

int msado15::Recordset20::getCursorLocation ( )

.method(vtoffset=56, dispid=1051, type=PROPGET, name="CursorLocation", name2="getCursorLocation", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

int msado15::Recordset20::getCursorType ( )

.method(vtoffset=15, dispid=1005, type=PROPGET, name="CursorType", name2="getCursorType", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

String msado15::Recordset20::getDataMember ( )

.method(vtoffset=73, dispid=1064, type=PROPGET, name="DataMember", name2="getDataMember", addFlagsVtable=4) .parameters([type=STRING] return)

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

IUnknown msado15::Recordset20::getDataSource ( )

.method(vtoffset=66, dispid=1056, type=PROPGET, name="DataSource", name2="getDataSource", addFlagsVtable=4) .parameters([iid=00000000-0000-0000-C000-000000000046,thread=AUTO,type=OBJECT] return)

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

int msado15::Recordset20::getEditMode ( )

.method(vtoffset=43, dispid=1026, type=PROPGET, name="EditMode", name2="getEditMode", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

boolean msado15::Recordset20::getEOF ( )

.method(vtoffset=17, dispid=1006, type=PROPGET, name="EOF", name2="getEOF", addFlagsVtable=4) .parameters([type=BOOLEAN] return)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

msado15.Fields msado15::Recordset20::getFields ( )

.method(vtoffset=18, dispid=0, type=PROPGET, name="Fields", name2="getFields", addFlagsVtable=4) .parameters([iid=00000564-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

Variant msado15::Recordset20::getFilter ( )

.method(vtoffset=44, dispid=1030, type=PROPGET, name="Filter", name2="getFilter", addFlagsVtable=4) .parameters([type=VARIANT] return)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

int msado15::Recordset20::getLockType ( )

.method(vtoffset=19, dispid=1008, type=PROPGET, name="LockType", name2="getLockType", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

int msado15::Recordset20::getMarshalOptions ( )

.method(vtoffset=62, dispid=1053, type=PROPGET, name="MarshalOptions", name2="getMarshalOptions", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

int msado15::Recordset20::getMaxRecords ( )

.method(vtoffset=21, dispid=1009, type=PROPGET, name="MaxRecords", name2="getMaxRecords", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

int msado15::Recordset20::getPageCount ( )

.method(vtoffset=46, dispid=1050, type=PROPGET, name="PageCount", name2="getPageCount", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

int msado15::Recordset20::getPageSize ( )

.method(vtoffset=47, dispid=1048, type=PROPGET, name="PageSize", name2="getPageSize", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

msado15.Properties msado15::Recordset20::getProperties ( )

.method(vtoffset=4, dispid=500, type=PROPGET, name="Properties", name2="getProperties", addFlagsVtable=4) .parameters([iid=00000504-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

int msado15::Recordset20::getRecordCount ( )

.method(vtoffset=23, dispid=1010, type=PROPGET, name="RecordCount", name2="getRecordCount", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

Variant msado15::Recordset20::GetRows | ( | int | Rows,
 |  | Variant | Start,
 |  | Variant | Fields
 | ) |  |

.method(vtoffset=31, dispid=1016, type=METHOD, name="GetRows", addFlagsVtable=4) .parameters([in,type=I4] Rows, [in,type=VARIANT] Start, [in,type=VARIANT] Fields, [type=VARIANT] return)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

String msado15::Recordset20::getSort ( )

.method(vtoffset=49, dispid=1031, type=PROPGET, name="Sort", name2="getSort", addFlagsVtable=4) .parameters([type=STRING] return)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

Variant msado15::Recordset20::getSource ( )

.method(vtoffset=26, dispid=1011, type=PROPGET, name="Source", name2="getSource", addFlagsVtable=4) .parameters([type=VARIANT] return)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

int msado15::Recordset20::getState ( )

.method(vtoffset=52, dispid=1054, type=PROPGET, name="State", name2="getState", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

int msado15::Recordset20::getStatus ( )

.method(vtoffset=51, dispid=1029, type=PROPGET, name="Status", name2="getStatus", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

boolean msado15::Recordset20::getStayInSync ( )

.method(vtoffset=71, dispid=1063, type=PROPGET, name="StayInSync", name2="getStayInSync", addFlagsVtable=4) .parameters([type=BOOLEAN] return)

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

String msado15::Recordset20::GetString | ( | int | StringFormat,
 |  | int | NumRows,
 |  | String | ColumnDelimeter,
 |  | String | RowDelimeter,
 |  | String | NullExpr
 | ) |  |

.method(vtoffset=72, dispid=1062, type=METHOD, name="GetString", addFlagsVtable=4) .parameters([in,type=I4] StringFormat, [in,type=I4] NumRows, [in,type=STRING] ColumnDelimeter, [in,type=STRING] RowDelimeter, [in,type=STRING] NullExpr, [type=STRING] return)

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

void msado15::Recordset20::Move | ( | int | NumRecords,
 |  | Variant | Start
 | ) |  |

.method(vtoffset=32, dispid=1017, type=METHOD, name="Move", addFlagsVtable=4) .parameters([in,type=I4] NumRecords, [in,type=VARIANT] Start)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

void msado15::Recordset20::MoveFirst ( )

.method(vtoffset=35, dispid=1020, type=METHOD, name="MoveFirst", addFlagsVtable=4) .parameters()

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

void msado15::Recordset20::MoveLast ( )

.method(vtoffset=36, dispid=1021, type=METHOD, name="MoveLast", addFlagsVtable=4) .parameters()

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

void msado15::Recordset20::MoveNext ( )

.method(vtoffset=33, dispid=1018, type=METHOD, name="MoveNext", addFlagsVtable=4) .parameters()

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

void msado15::Recordset20::MovePrevious ( )

.method(vtoffset=34, dispid=1019, type=METHOD, name="MovePrevious", addFlagsVtable=4) .parameters()

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

msado15._Recordset msado15::Recordset20::NextRecordset ( Variant RecordsAffected )

.method(vtoffset=58, dispid=1052, type=METHOD, name="NextRecordset", addFlagsVtable=4) .parameters([out,elementType=VARIANT,type=PTR] RecordsAffected, [iid=00000556-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

void msado15::Recordset20::Open | ( | Variant | Source,
 |  | Variant | ActiveConnection,
 |  | int | CursorType,
 |  | int | LockType,
 |  | int | Options
 | ) |  |

.method(vtoffset=37, dispid=1022, type=METHOD, name="Open", addFlagsVtable=4) .parameters([in,type=VARIANT] Source, [in,type=VARIANT] ActiveConnection, [in,type=I4] CursorType, [in,type=I4] LockType, [in,type=I4] Options)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

void msado15::Recordset20::Requery ( int Options )

.method(vtoffset=38, dispid=1023, type=METHOD, name="Requery", addFlagsVtable=4) .parameters([in,type=I4] Options)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

void msado15::Recordset20::Resync | ( | int | AffectRecords,
 |  | int | ResyncValues
 | ) |  |

.method(vtoffset=77, dispid=1024, type=METHOD, name="Resync", addFlagsVtable=4) .parameters([in,type=I4] AffectRecords, [in,type=I4] ResyncValues)

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

void msado15::Recordset20::setAbsolutePage ( int pl )

.method(vtoffset=42, dispid=1047, type=PROPPUT, name="AbsolutePage", name2="putAbsolutePage", addFlagsVtable=4) .parameters([in,type=I4] pl)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

void msado15::Recordset20::setAbsolutePosition ( int pl )

.method(vtoffset=6, dispid=1000, type=PROPPUT, name="AbsolutePosition", name2="putAbsolutePosition", addFlagsVtable=4) .parameters([in,type=I4] pl)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

void msado15::Recordset20::setActiveConnection ( Object pvar )

.method(vtoffset=7, dispid=1001, type=PROPPUTREF, name="ActiveConnection", name2="putActiveConnection", addFlagsVtable=4) .parameters([in,iid=00020400-0000-0000-C000-000000000046,thread=AUTO,type=DISPATCH] pvar)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

void msado15::Recordset20::setActiveConnection ( Variant pvar )

.method(vtoffset=8, dispid=1001, type=PROPPUT, name="ActiveConnection", name2="putActiveConnection", addFlagsVtable=4) .parameters([in,type=VARIANT] pvar)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

void msado15::Recordset20::setBookmark ( Variant pvBookmark )

.method(vtoffset=12, dispid=1003, type=PROPPUT, name="Bookmark", name2="putBookmark", addFlagsVtable=4) .parameters([in,type=VARIANT] pvBookmark)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

void msado15::Recordset20::setCacheSize ( int pl )

.method(vtoffset=14, dispid=1004, type=PROPPUT, name="CacheSize", name2="putCacheSize", addFlagsVtable=4) .parameters([in,type=I4] pl)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

void msado15::Recordset20::setCollect | ( | Variant | Index,
 |  | Variant | pvar
 | ) |  |

.method(vtoffset=61, dispid=4294967288, type=PROPPUT, name="Collect", name2="putCollect", addFlagsVtable=4) .parameters([in,type=VARIANT] Index, [in,type=VARIANT] pvar)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

void msado15::Recordset20::setCursorLocation ( int plCursorLoc )

.method(vtoffset=57, dispid=1051, type=PROPPUT, name="CursorLocation", name2="putCursorLocation", addFlagsVtable=4) .parameters([in,type=I4] plCursorLoc)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

void msado15::Recordset20::setCursorType ( int plCursorType )

.method(vtoffset=16, dispid=1005, type=PROPPUT, name="CursorType", name2="putCursorType", addFlagsVtable=4) .parameters([in,type=I4] plCursorType)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

void msado15::Recordset20::setDataMember ( String pbstrDataMember )

.method(vtoffset=74, dispid=1064, type=PROPPUT, name="DataMember", name2="putDataMember", addFlagsVtable=4) .parameters([in,type=STRING] pbstrDataMember)

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

void msado15::Recordset20::setDataSource ( IUnknown ppunkDataSource )

.method(vtoffset=67, dispid=1056, type=PROPPUTREF, name="DataSource", name2="putDataSource", addFlagsVtable=4) .parameters([in,iid=00000000-0000-0000-C000-000000000046,thread=AUTO,type=OBJECT] ppunkDataSource)

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

void msado15::Recordset20::setFilter ( Variant Criteria )

.method(vtoffset=45, dispid=1030, type=PROPPUT, name="Filter", name2="putFilter", addFlagsVtable=4) .parameters([in,type=VARIANT] Criteria)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

void msado15::Recordset20::setLockType ( int plLockType )

.method(vtoffset=20, dispid=1008, type=PROPPUT, name="LockType", name2="putLockType", addFlagsVtable=4) .parameters([in,type=I4] plLockType)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

void msado15::Recordset20::setMarshalOptions ( int peMarshal )

.method(vtoffset=63, dispid=1053, type=PROPPUT, name="MarshalOptions", name2="putMarshalOptions", addFlagsVtable=4) .parameters([in,type=I4] peMarshal)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

void msado15::Recordset20::setMaxRecords ( int plMaxRecords )

.method(vtoffset=22, dispid=1009, type=PROPPUT, name="MaxRecords", name2="putMaxRecords", addFlagsVtable=4) .parameters([in,type=I4] plMaxRecords)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

void msado15::Recordset20::setPageSize ( int pl )

.method(vtoffset=48, dispid=1048, type=PROPPUT, name="PageSize", name2="putPageSize", addFlagsVtable=4) .parameters([in,type=I4] pl)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

void msado15::Recordset20::setSort ( String Criteria )

.method(vtoffset=50, dispid=1031, type=PROPPUT, name="Sort", name2="putSort", addFlagsVtable=4) .parameters([in,type=STRING] Criteria)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

void msado15::Recordset20::setSource ( Object pvSource )

.method(vtoffset=24, dispid=1011, type=PROPPUTREF, name="Source", name2="putSource", addFlagsVtable=4) .parameters([in,iid=00020400-0000-0000-C000-000000000046,thread=AUTO,type=DISPATCH] pvSource)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

void msado15::Recordset20::setSource ( String pvSource )

.method(vtoffset=25, dispid=1011, type=PROPPUT, name="Source", name2="putSource", addFlagsVtable=4) .parameters([in,type=STRING] pvSource)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

void msado15::Recordset20::setStayInSync ( boolean pbStayInSync )

.method(vtoffset=70, dispid=1063, type=PROPPUT, name="StayInSync", name2="putStayInSync", addFlagsVtable=4) .parameters([in,type=BOOLEAN] pbStayInSync)

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

boolean msado15::Recordset20::Supports ( int CursorOptions )

.method(vtoffset=59, dispid=1036, type=METHOD, name="Supports", addFlagsVtable=4) .parameters([in,type=I4] CursorOptions, [type=BOOLEAN] return)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

void msado15::Recordset20::Update | ( | Variant | Fields,
 |  | Variant | Values
 | ) |  |

.method(vtoffset=40, dispid=1025, type=METHOD, name="Update", addFlagsVtable=4) .parameters([in,type=VARIANT] Fields, [in,type=VARIANT] Values)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

void msado15::Recordset20::UpdateBatch ( int AffectRecords )

.method(vtoffset=54, dispid=1035, type=METHOD, name="UpdateBatch", addFlagsVtable=4) .parameters([in,type=I4] AffectRecords)

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

Member Data Documentation

final com.ms.com._Guid msado15::Recordset20::iid = new com.ms.com._Guid((int)0x54f, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Implements msado15::Recordset15.

Implemented in msado15::_Recordset, msado15::Recordset, and msado15::Recordset21.

Definition at line 324 of file Recordset20.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Recordset20.java
Generated on Wed Nov 13 2024 16:58:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::Recordset21 Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::Recordset21
Public Member Functions | Static Public Attributes

msado15::Recordset21 Interface Reference

.interface(iid=00000555-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)

Inherits msado15::Recordset20.

Inherited by msado15::_Recordset.

List of all members.

Public Member Functions

msado15._Recordset _xClone ()
void | _xResync (int AffectRecords)
void | _xSave (String FileName, int PersistFormat)
void | AddNew (Variant FieldList, Variant Values)
void | Cancel ()
void | CancelBatch (int AffectRecords)
void | CancelUpdate ()
msado15._Recordset | Clone (int LockType)
void | Close ()
int | CompareBookmarks (Variant Bookmark1, Variant Bookmark2)
void | Delete (int AffectRecords)
void | Find (String Criteria, int SkipRecords, int SearchDirection, Variant Start)
int | getAbsolutePage ()
int | getAbsolutePosition ()
Object | getActiveCommand ()
Variant | getActiveConnection ()
boolean | getBOF ()
Variant | getBookmark ()
int | getCacheSize ()
Variant | getCollect (Variant Index)
int | getCursorLocation ()
int | getCursorType ()
String | getDataMember ()
IUnknown | getDataSource ()
int | getEditMode ()
boolean | getEOF ()
msado15.Fields getFields ()
Variant | getFilter ()
String | getIndex ()
int | getLockType ()
int | getMarshalOptions ()
int | getMaxRecords ()
int | getPageCount ()
int | getPageSize ()
msado15.Properties getProperties ()
int | getRecordCount ()
Variant | GetRows (int Rows, Variant Start, Variant Fields)
String | getSort ()
Variant | getSource ()
int | getState ()
int | getStatus ()
boolean | getStayInSync ()
String | GetString (int StringFormat, int NumRows, String ColumnDelimeter, String RowDelimeter, String NullExpr)
void | Move (int NumRecords, Variant Start)
void | MoveFirst ()
void | MoveLast ()
void | MoveNext ()
void | MovePrevious ()
msado15._Recordset | NextRecordset (Variant RecordsAffected)
void | Open (Variant Source, Variant ActiveConnection, int CursorType, int LockType, int Options)
void | Requery (int Options)
void | Resync (int AffectRecords, int ResyncValues)
void | Seek (Variant KeyValues, int SeekOption)
void | setAbsolutePage (int pl)
void | setAbsolutePosition (int pl)
void | setActiveConnection (Variant pvar)
void | setActiveConnection (Object pvar)
void | setBookmark (Variant pvBookmark)
void | setCacheSize (int pl)
void | setCollect (Variant Index, Variant pvar)
void | setCursorLocation (int plCursorLoc)
void | setCursorType (int plCursorType)
void | setDataMember (String pbstrDataMember)
void | setDataSource (IUnknown ppunkDataSource)
void | setFilter (Variant Criteria)
void | setIndex (String pbstrIndex)
void | setLockType (int plLockType)
void | setMarshalOptions (int peMarshal)
void | setMaxRecords (int plMaxRecords)
void | setPageSize (int pl)
void | setSort (String Criteria)
void | setSource (String pvSource)
void | setSource (Object pvSource)
void | setStayInSync (boolean pbStayInSync)
boolean | Supports (int CursorOptions)
void | Update (Variant Fields, Variant Values)
void | UpdateBatch (int AffectRecords)

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x555, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)

Detailed Description

Definition at line 20 of file Recordset21.java.

Member Function Documentation

msado15._Recordset msado15::Recordset21::_xClone ( )

.method(vtoffset=53, dispid=1610809392, type=METHOD, name="_xClone", addFlagsVtable=4) .parameters([iid=00000556-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

void msado15::Recordset21::_xResync ( int AffectRecords )

.method(vtoffset=39, dispid=1610809378, type=METHOD, name="_xResync", addFlagsVtable=4) .parameters([in,type=I4] AffectRecords)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

void msado15::Recordset21::_xSave | ( | String | FileName,
 |  | int | PersistFormat
 | ) |  |

.method(vtoffset=68, dispid=1610874883, type=METHOD, name="_xSave", addFlagsVtable=4) .parameters([in,type=STRING] FileName, [in,type=I4] PersistFormat)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

void msado15::Recordset21::AddNew | ( | Variant | FieldList,
 |  | Variant | Values
 | ) |  |

.method(vtoffset=27, dispid=1012, type=METHOD, name="AddNew", addFlagsVtable=4) .parameters([in,type=VARIANT] FieldList, [in,type=VARIANT] Values)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

void msado15::Recordset21::Cancel ( )

.method(vtoffset=65, dispid=1055, type=METHOD, name="Cancel", addFlagsVtable=4) .parameters()

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

void msado15::Recordset21::CancelBatch ( int AffectRecords )

.method(vtoffset=55, dispid=1049, type=METHOD, name="CancelBatch", addFlagsVtable=4) .parameters([in,type=I4] AffectRecords)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

void msado15::Recordset21::CancelUpdate ( )

.method(vtoffset=28, dispid=1013, type=METHOD, name="CancelUpdate", addFlagsVtable=4) .parameters()

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

msado15._Recordset msado15::Recordset21::Clone ( int LockType )

.method(vtoffset=76, dispid=1034, type=METHOD, name="Clone", addFlagsVtable=4) .parameters([in,type=I4] LockType, [iid=00000556-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

void msado15::Recordset21::Close ( )

.method(vtoffset=29, dispid=1014, type=METHOD, name="Close", addFlagsVtable=4) .parameters()

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

int msado15::Recordset21::CompareBookmarks | ( | Variant | Bookmark1,
 |  | Variant | Bookmark2
 | ) |  |

.method(vtoffset=75, dispid=1065, type=METHOD, name="CompareBookmarks", addFlagsVtable=4) .parameters([in,type=VARIANT] Bookmark1, [in,type=VARIANT] Bookmark2, [type=I4] return)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

void msado15::Recordset21::Delete ( int AffectRecords )

.method(vtoffset=30, dispid=1015, type=METHOD, name="Delete", addFlagsVtable=4) .parameters([in,type=I4] AffectRecords)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

void msado15::Recordset21::Find | ( | String | Criteria,
 |  | int | SkipRecords,
 |  | int | SearchDirection,
 |  | Variant | Start
 | ) |  |

.method(vtoffset=64, dispid=1058, type=METHOD, name="Find", addFlagsVtable=4) .parameters([in,type=STRING] Criteria, [in,type=I4] SkipRecords, [in,type=I4] SearchDirection, [in,type=VARIANT] Start)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

int msado15::Recordset21::getAbsolutePage ( )

.method(vtoffset=41, dispid=1047, type=PROPGET, name="AbsolutePage", name2="getAbsolutePage", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

int msado15::Recordset21::getAbsolutePosition ( )

.method(vtoffset=5, dispid=1000, type=PROPGET, name="AbsolutePosition", name2="getAbsolutePosition", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

Object msado15::Recordset21::getActiveCommand ( )

.method(vtoffset=69, dispid=1061, type=PROPGET, name="ActiveCommand", name2="getActiveCommand", addFlagsVtable=4) .parameters([iid=00020400-0000-0000-C000-000000000046,thread=AUTO,type=DISPATCH] return)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

Variant msado15::Recordset21::getActiveConnection ( )

.method(vtoffset=9, dispid=1001, type=PROPGET, name="ActiveConnection", name2="getActiveConnection", addFlagsVtable=4) .parameters([type=VARIANT] return)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

boolean msado15::Recordset21::getBOF ( )

.method(vtoffset=10, dispid=1002, type=PROPGET, name="BOF", name2="getBOF", addFlagsVtable=4) .parameters([type=BOOLEAN] return)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

Variant msado15::Recordset21::getBookmark ( )

.method(vtoffset=11, dispid=1003, type=PROPGET, name="Bookmark", name2="getBookmark", addFlagsVtable=4) .parameters([type=VARIANT] return)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

int msado15::Recordset21::getCacheSize ( )

.method(vtoffset=13, dispid=1004, type=PROPGET, name="CacheSize", name2="getCacheSize", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

Variant msado15::Recordset21::getCollect ( Variant Index )

.method(vtoffset=60, dispid=4294967288, type=PROPGET, name="Collect", name2="getCollect", addFlagsVtable=4) .parameters([in,type=VARIANT] Index, [type=VARIANT] return)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

int msado15::Recordset21::getCursorLocation ( )

.method(vtoffset=56, dispid=1051, type=PROPGET, name="CursorLocation", name2="getCursorLocation", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

int msado15::Recordset21::getCursorType ( )

.method(vtoffset=15, dispid=1005, type=PROPGET, name="CursorType", name2="getCursorType", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

String msado15::Recordset21::getDataMember ( )

.method(vtoffset=73, dispid=1064, type=PROPGET, name="DataMember", name2="getDataMember", addFlagsVtable=4) .parameters([type=STRING] return)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

IUnknown msado15::Recordset21::getDataSource ( )

.method(vtoffset=66, dispid=1056, type=PROPGET, name="DataSource", name2="getDataSource", addFlagsVtable=4) .parameters([iid=00000000-0000-0000-C000-000000000046,thread=AUTO,type=OBJECT] return)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

int msado15::Recordset21::getEditMode ( )

.method(vtoffset=43, dispid=1026, type=PROPGET, name="EditMode", name2="getEditMode", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

boolean msado15::Recordset21::getEOF ( )

.method(vtoffset=17, dispid=1006, type=PROPGET, name="EOF", name2="getEOF", addFlagsVtable=4) .parameters([type=BOOLEAN] return)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

msado15.Fields msado15::Recordset21::getFields ( )

.method(vtoffset=18, dispid=0, type=PROPGET, name="Fields", name2="getFields", addFlagsVtable=4) .parameters([iid=00000564-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

Variant msado15::Recordset21::getFilter ( )

.method(vtoffset=44, dispid=1030, type=PROPGET, name="Filter", name2="getFilter", addFlagsVtable=4) .parameters([type=VARIANT] return)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

String msado15::Recordset21::getIndex ( )

.method(vtoffset=80, dispid=1067, type=PROPGET, name="Index", name2="getIndex", addFlagsVtable=4) .parameters([type=STRING] return)

Implemented in msado15::_Recordset, and msado15::Recordset.

int msado15::Recordset21::getLockType ( )

.method(vtoffset=19, dispid=1008, type=PROPGET, name="LockType", name2="getLockType", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

int msado15::Recordset21::getMarshalOptions ( )

.method(vtoffset=62, dispid=1053, type=PROPGET, name="MarshalOptions", name2="getMarshalOptions", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

int msado15::Recordset21::getMaxRecords ( )

.method(vtoffset=21, dispid=1009, type=PROPGET, name="MaxRecords", name2="getMaxRecords", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

int msado15::Recordset21::getPageCount ( )

.method(vtoffset=46, dispid=1050, type=PROPGET, name="PageCount", name2="getPageCount", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

int msado15::Recordset21::getPageSize ( )

.method(vtoffset=47, dispid=1048, type=PROPGET, name="PageSize", name2="getPageSize", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

msado15.Properties msado15::Recordset21::getProperties ( )

.method(vtoffset=4, dispid=500, type=PROPGET, name="Properties", name2="getProperties", addFlagsVtable=4) .parameters([iid=00000504-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

int msado15::Recordset21::getRecordCount ( )

.method(vtoffset=23, dispid=1010, type=PROPGET, name="RecordCount", name2="getRecordCount", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

Variant msado15::Recordset21::GetRows | ( | int | Rows,
 |  | Variant | Start,
 |  | Variant | Fields
 | ) |  |

.method(vtoffset=31, dispid=1016, type=METHOD, name="GetRows", addFlagsVtable=4) .parameters([in,type=I4] Rows, [in,type=VARIANT] Start, [in,type=VARIANT] Fields, [type=VARIANT] return)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

String msado15::Recordset21::getSort ( )

.method(vtoffset=49, dispid=1031, type=PROPGET, name="Sort", name2="getSort", addFlagsVtable=4) .parameters([type=STRING] return)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

Variant msado15::Recordset21::getSource ( )

.method(vtoffset=26, dispid=1011, type=PROPGET, name="Source", name2="getSource", addFlagsVtable=4) .parameters([type=VARIANT] return)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

int msado15::Recordset21::getState ( )

.method(vtoffset=52, dispid=1054, type=PROPGET, name="State", name2="getState", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

int msado15::Recordset21::getStatus ( )

.method(vtoffset=51, dispid=1029, type=PROPGET, name="Status", name2="getStatus", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

boolean msado15::Recordset21::getStayInSync ( )

.method(vtoffset=71, dispid=1063, type=PROPGET, name="StayInSync", name2="getStayInSync", addFlagsVtable=4) .parameters([type=BOOLEAN] return)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

String msado15::Recordset21::GetString | ( | int | StringFormat,
 |  | int | NumRows,
 |  | String | ColumnDelimeter,
 |  | String | RowDelimeter,
 |  | String | NullExpr
 | ) |  |

.method(vtoffset=72, dispid=1062, type=METHOD, name="GetString", addFlagsVtable=4) .parameters([in,type=I4] StringFormat, [in,type=I4] NumRows, [in,type=STRING] ColumnDelimeter, [in,type=STRING] RowDelimeter, [in,type=STRING] NullExpr, [type=STRING] return)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

void msado15::Recordset21::Move | ( | int | NumRecords,
 |  | Variant | Start
 | ) |  |

.method(vtoffset=32, dispid=1017, type=METHOD, name="Move", addFlagsVtable=4) .parameters([in,type=I4] NumRecords, [in,type=VARIANT] Start)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

void msado15::Recordset21::MoveFirst ( )

.method(vtoffset=35, dispid=1020, type=METHOD, name="MoveFirst", addFlagsVtable=4) .parameters()

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

void msado15::Recordset21::MoveLast ( )

.method(vtoffset=36, dispid=1021, type=METHOD, name="MoveLast", addFlagsVtable=4) .parameters()

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

void msado15::Recordset21::MoveNext ( )

.method(vtoffset=33, dispid=1018, type=METHOD, name="MoveNext", addFlagsVtable=4) .parameters()

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

void msado15::Recordset21::MovePrevious ( )

.method(vtoffset=34, dispid=1019, type=METHOD, name="MovePrevious", addFlagsVtable=4) .parameters()

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

msado15._Recordset msado15::Recordset21::NextRecordset ( Variant RecordsAffected )

.method(vtoffset=58, dispid=1052, type=METHOD, name="NextRecordset", addFlagsVtable=4) .parameters([out,elementType=VARIANT,type=PTR] RecordsAffected, [iid=00000556-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] return)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

void msado15::Recordset21::Open | ( | Variant | Source,
 |  | Variant | ActiveConnection,
 |  | int | CursorType,
 |  | int | LockType,
 |  | int | Options
 | ) |  |

.method(vtoffset=37, dispid=1022, type=METHOD, name="Open", addFlagsVtable=4) .parameters([in,type=VARIANT] Source, [in,type=VARIANT] ActiveConnection, [in,type=I4] CursorType, [in,type=I4] LockType, [in,type=I4] Options)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

void msado15::Recordset21::Requery ( int Options )

.method(vtoffset=38, dispid=1023, type=METHOD, name="Requery", addFlagsVtable=4) .parameters([in,type=I4] Options)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

void msado15::Recordset21::Resync | ( | int | AffectRecords,
 |  | int | ResyncValues
 | ) |  |

.method(vtoffset=77, dispid=1024, type=METHOD, name="Resync", addFlagsVtable=4) .parameters([in,type=I4] AffectRecords, [in,type=I4] ResyncValues)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

void msado15::Recordset21::Seek | ( | Variant | KeyValues,
 |  | int | SeekOption
 | ) |  |

.method(vtoffset=78, dispid=1066, type=METHOD, name="Seek", addFlagsVtable=4) .parameters([in,type=VARIANT] KeyValues, [in,type=I4] SeekOption)

Implemented in msado15::_Recordset, and msado15::Recordset.

void msado15::Recordset21::setAbsolutePage ( int pl )

.method(vtoffset=42, dispid=1047, type=PROPPUT, name="AbsolutePage", name2="putAbsolutePage", addFlagsVtable=4) .parameters([in,type=I4] pl)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

void msado15::Recordset21::setAbsolutePosition ( int pl )

.method(vtoffset=6, dispid=1000, type=PROPPUT, name="AbsolutePosition", name2="putAbsolutePosition", addFlagsVtable=4) .parameters([in,type=I4] pl)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

void msado15::Recordset21::setActiveConnection ( Variant pvar )

.method(vtoffset=8, dispid=1001, type=PROPPUT, name="ActiveConnection", name2="putActiveConnection", addFlagsVtable=4) .parameters([in,type=VARIANT] pvar)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

void msado15::Recordset21::setActiveConnection ( Object pvar )

.method(vtoffset=7, dispid=1001, type=PROPPUTREF, name="ActiveConnection", name2="putActiveConnection", addFlagsVtable=4) .parameters([in,iid=00020400-0000-0000-C000-000000000046,thread=AUTO,type=DISPATCH] pvar)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

void msado15::Recordset21::setBookmark ( Variant pvBookmark )

.method(vtoffset=12, dispid=1003, type=PROPPUT, name="Bookmark", name2="putBookmark", addFlagsVtable=4) .parameters([in,type=VARIANT] pvBookmark)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

void msado15::Recordset21::setCacheSize ( int pl )

.method(vtoffset=14, dispid=1004, type=PROPPUT, name="CacheSize", name2="putCacheSize", addFlagsVtable=4) .parameters([in,type=I4] pl)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

void msado15::Recordset21::setCollect | ( | Variant | Index,
 |  | Variant | pvar
 | ) |  |

.method(vtoffset=61, dispid=4294967288, type=PROPPUT, name="Collect", name2="putCollect", addFlagsVtable=4) .parameters([in,type=VARIANT] Index, [in,type=VARIANT] pvar)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

void msado15::Recordset21::setCursorLocation ( int plCursorLoc )

.method(vtoffset=57, dispid=1051, type=PROPPUT, name="CursorLocation", name2="putCursorLocation", addFlagsVtable=4) .parameters([in,type=I4] plCursorLoc)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

void msado15::Recordset21::setCursorType ( int plCursorType )

.method(vtoffset=16, dispid=1005, type=PROPPUT, name="CursorType", name2="putCursorType", addFlagsVtable=4) .parameters([in,type=I4] plCursorType)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

void msado15::Recordset21::setDataMember ( String pbstrDataMember )

.method(vtoffset=74, dispid=1064, type=PROPPUT, name="DataMember", name2="putDataMember", addFlagsVtable=4) .parameters([in,type=STRING] pbstrDataMember)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

void msado15::Recordset21::setDataSource ( IUnknown ppunkDataSource )

.method(vtoffset=67, dispid=1056, type=PROPPUTREF, name="DataSource", name2="putDataSource", addFlagsVtable=4) .parameters([in,iid=00000000-0000-0000-C000-000000000046,thread=AUTO,type=OBJECT] ppunkDataSource)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

void msado15::Recordset21::setFilter ( Variant Criteria )

.method(vtoffset=45, dispid=1030, type=PROPPUT, name="Filter", name2="putFilter", addFlagsVtable=4) .parameters([in,type=VARIANT] Criteria)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

void msado15::Recordset21::setIndex ( String pbstrIndex )

.method(vtoffset=79, dispid=1067, type=PROPPUT, name="Index", name2="putIndex", addFlagsVtable=4) .parameters([in,type=STRING] pbstrIndex)

Implemented in msado15::_Recordset, and msado15::Recordset.

void msado15::Recordset21::setLockType ( int plLockType )

.method(vtoffset=20, dispid=1008, type=PROPPUT, name="LockType", name2="putLockType", addFlagsVtable=4) .parameters([in,type=I4] plLockType)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

void msado15::Recordset21::setMarshalOptions ( int peMarshal )

.method(vtoffset=63, dispid=1053, type=PROPPUT, name="MarshalOptions", name2="putMarshalOptions", addFlagsVtable=4) .parameters([in,type=I4] peMarshal)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

void msado15::Recordset21::setMaxRecords ( int plMaxRecords )

.method(vtoffset=22, dispid=1009, type=PROPPUT, name="MaxRecords", name2="putMaxRecords", addFlagsVtable=4) .parameters([in,type=I4] plMaxRecords)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

void msado15::Recordset21::setPageSize ( int pl )

.method(vtoffset=48, dispid=1048, type=PROPPUT, name="PageSize", name2="putPageSize", addFlagsVtable=4) .parameters([in,type=I4] pl)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

void msado15::Recordset21::setSort ( String Criteria )

.method(vtoffset=50, dispid=1031, type=PROPPUT, name="Sort", name2="putSort", addFlagsVtable=4) .parameters([in,type=STRING] Criteria)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

void msado15::Recordset21::setSource ( String pvSource )

.method(vtoffset=25, dispid=1011, type=PROPPUT, name="Source", name2="putSource", addFlagsVtable=4) .parameters([in,type=STRING] pvSource)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

void msado15::Recordset21::setSource ( Object pvSource )

.method(vtoffset=24, dispid=1011, type=PROPPUTREF, name="Source", name2="putSource", addFlagsVtable=4) .parameters([in,iid=00020400-0000-0000-C000-000000000046,thread=AUTO,type=DISPATCH] pvSource)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

void msado15::Recordset21::setStayInSync ( boolean pbStayInSync )

.method(vtoffset=70, dispid=1063, type=PROPPUT, name="StayInSync", name2="putStayInSync", addFlagsVtable=4) .parameters([in,type=BOOLEAN] pbStayInSync)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

boolean msado15::Recordset21::Supports ( int CursorOptions )

.method(vtoffset=59, dispid=1036, type=METHOD, name="Supports", addFlagsVtable=4) .parameters([in,type=I4] CursorOptions, [type=BOOLEAN] return)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

void msado15::Recordset21::Update | ( | Variant | Fields,
 |  | Variant | Values
 | ) |  |

.method(vtoffset=40, dispid=1025, type=METHOD, name="Update", addFlagsVtable=4) .parameters([in,type=VARIANT] Fields, [in,type=VARIANT] Values)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

void msado15::Recordset21::UpdateBatch ( int AffectRecords )

.method(vtoffset=54, dispid=1035, type=METHOD, name="UpdateBatch", addFlagsVtable=4) .parameters([in,type=I4] AffectRecords)

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

Member Data Documentation

final com.ms.com._Guid msado15::Recordset21::iid = new com.ms.com._Guid((int)0x555, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Implements msado15::Recordset20.

Implemented in msado15::_Recordset, and msado15::Recordset.

Definition at line 336 of file Recordset21.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Recordset21.java
Generated on Wed Nov 13 2024 16:58:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::RecordsetEvents Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::RecordsetEvents
Public Member Functions | Static Public Attributes

msado15::RecordsetEvents Interface Reference

.interface(iid=00000266-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DISPATCH)

Inherits com::ms::com::IUnknown.

List of all members.

Public Member Functions

void | EndOfRecordset (boolean[] fMoreData, int[] adStatus, msado15._Recordset pRecordset)
void | FetchComplete (msado15.Error pError, int[] adStatus, msado15._Recordset pRecordset)
void | FetchProgress (int Progress, int MaxProgress, int[] adStatus, msado15._Recordset pRecordset)
void | FieldChangeComplete (int cFields, Variant Fields, msado15.Error pError, int[] adStatus, msado15._Recordset pRecordset)
void | MoveComplete (int adReason, msado15.Error pError, int[] adStatus, msado15._Recordset pRecordset)
void | RecordChangeComplete (int adReason, int cRecords, msado15.Error pError, int[] adStatus, msado15._Recordset pRecordset)
void | RecordsetChangeComplete (int adReason, msado15.Error pError, int[] adStatus, msado15._Recordset pRecordset)
void | WillChangeField (int cFields, Variant Fields, int[] adStatus, msado15._Recordset pRecordset)
void | WillChangeRecord (int adReason, int cRecords, int[] adStatus, msado15._Recordset pRecordset)
void | WillChangeRecordset (int adReason, int[] adStatus, msado15._Recordset pRecordset)
void | WillMove (int adReason, int[] adStatus, msado15._Recordset pRecordset)

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x266, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)

Detailed Description

Definition at line 20 of file RecordsetEvents.java.

Member Function Documentation

void msado15::RecordsetEvents::EndOfRecordset | ( | boolean[] | fMoreData,
 |  | int[] | adStatus,
 |  | msado15._Recordset | pRecordset
 | ) |  |

.method(dispid=17, type=METHOD, name="EndOfRecordset") .parameters([in,out,elementType=BOOLEAN,type=ARRAY] fMoreData, [in,out,elementType=I4,type=PTR] adStatus, [in,type=DISPATCH] pRecordset)

void msado15::RecordsetEvents::FetchComplete | ( | msado15.Error | pError,
 |  | int[] | adStatus,
 |  | msado15._Recordset | pRecordset
 | ) |  |

.method(dispid=19, type=METHOD, name="FetchComplete") .parameters([in,type=DISPATCH] pError, [in,out,elementType=I4,type=PTR] adStatus, [in,type=DISPATCH] pRecordset)

void msado15::RecordsetEvents::FetchProgress | ( | int | Progress,
 |  | int | MaxProgress,
 |  | int[] | adStatus,
 |  | msado15._Recordset | pRecordset
 | ) |  |

.method(dispid=18, type=METHOD, name="FetchProgress") .parameters([in,type=I4] Progress, [in,type=I4] MaxProgress, [in,out,elementType=I4,type=PTR] adStatus, [in,type=DISPATCH] pRecordset)

void msado15::RecordsetEvents::FieldChangeComplete | ( | int | cFields,
 |  | Variant | Fields,
 |  | msado15.Error | pError,
 |  | int[] | adStatus,
 |  | msado15._Recordset | pRecordset
 | ) |  |

.method(dispid=10, type=METHOD, name="FieldChangeComplete") .parameters([in,type=I4] cFields, [in,type=VARIANT] Fields, [in,type=DISPATCH] pError, [in,out,elementType=I4,type=PTR] adStatus, [in,type=DISPATCH] pRecordset)

void msado15::RecordsetEvents::MoveComplete | ( | int | adReason,
 |  | msado15.Error | pError,
 |  | int[] | adStatus,
 |  | msado15._Recordset | pRecordset
 | ) |  |

.method(dispid=16, type=METHOD, name="MoveComplete") .parameters([in,type=I4] adReason, [in,type=DISPATCH] pError, [in,out,elementType=I4,type=PTR] adStatus, [in,type=DISPATCH] pRecordset)

void msado15::RecordsetEvents::RecordChangeComplete | ( | int | adReason,
 |  | int | cRecords,
 |  | msado15.Error | pError,
 |  | int[] | adStatus,
 |  | msado15._Recordset | pRecordset
 | ) |  |

.method(dispid=12, type=METHOD, name="RecordChangeComplete") .parameters([in,type=I4] adReason, [in,type=I4] cRecords, [in,type=DISPATCH] pError, [in,out,elementType=I4,type=PTR] adStatus, [in,type=DISPATCH] pRecordset)

void msado15::RecordsetEvents::RecordsetChangeComplete | ( | int | adReason,
 |  | msado15.Error | pError,
 |  | int[] | adStatus,
 |  | msado15._Recordset | pRecordset
 | ) |  |

.method(dispid=14, type=METHOD, name="RecordsetChangeComplete") .parameters([in,type=I4] adReason, [in,type=DISPATCH] pError, [in,out,elementType=I4,type=PTR] adStatus, [in,type=DISPATCH] pRecordset)

void msado15::RecordsetEvents::WillChangeField | ( | int | cFields,
 |  | Variant | Fields,
 |  | int[] | adStatus,
 |  | msado15._Recordset | pRecordset
 | ) |  |

.method(dispid=9, type=METHOD, name="WillChangeField") .parameters([in,type=I4] cFields, [in,type=VARIANT] Fields, [in,out,elementType=I4,type=PTR] adStatus, [in,type=DISPATCH] pRecordset)

void msado15::RecordsetEvents::WillChangeRecord | ( | int | adReason,
 |  | int | cRecords,
 |  | int[] | adStatus,
 |  | msado15._Recordset | pRecordset
 | ) |  |

.method(dispid=11, type=METHOD, name="WillChangeRecord") .parameters([in,type=I4] adReason, [in,type=I4] cRecords, [in,out,elementType=I4,type=PTR] adStatus, [in,type=DISPATCH] pRecordset)

void msado15::RecordsetEvents::WillChangeRecordset | ( | int | adReason,
 |  | int[] | adStatus,
 |  | msado15._Recordset | pRecordset
 | ) |  |

.method(dispid=13, type=METHOD, name="WillChangeRecordset") .parameters([in,type=I4] adReason, [in,out,elementType=I4,type=PTR] adStatus, [in,type=DISPATCH] pRecordset)

void msado15::RecordsetEvents::WillMove | ( | int | adReason,
 |  | int[] | adStatus,
 |  | msado15._Recordset | pRecordset
 | ) |  |

.method(dispid=15, type=METHOD, name="WillMove") .parameters([in,type=I4] adReason, [in,out,elementType=I4,type=PTR] adStatus, [in,type=DISPATCH] pRecordset)

Member Data Documentation

final com.ms.com._Guid msado15::RecordsetEvents::iid = new com.ms.com._Guid((int)0x266, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Definition at line 67 of file RecordsetEvents.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/RecordsetEvents.java
Generated on Wed Nov 13 2024 16:58:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::RecordsetEventsVt Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::RecordsetEventsVt
Public Member Functions | Static Public Attributes

msado15::RecordsetEventsVt Interface Reference

.interface(iid=00000403-0000-0010-8000-00AA006D2EA4, thread=AUTO)

Inherits com::ms::com::IUnknown.

List of all members.

Public Member Functions

void | EndOfRecordset (boolean[] fMoreData, int[] adStatus, msado15._Recordset pRecordset)
void | FetchComplete (msado15.Error pError, int[] adStatus, msado15._Recordset pRecordset)
void | FetchProgress (int Progress, int MaxProgress, int[] adStatus, msado15._Recordset pRecordset)
void | FieldChangeComplete (int cFields, Variant Fields, msado15.Error pError, int[] adStatus, msado15._Recordset pRecordset)
void | MoveComplete (int adReason, msado15.Error pError, int[] adStatus, msado15._Recordset pRecordset)
void | RecordChangeComplete (int adReason, int cRecords, msado15.Error pError, int[] adStatus, msado15._Recordset pRecordset)
void | RecordsetChangeComplete (int adReason, msado15.Error pError, int[] adStatus, msado15._Recordset pRecordset)
void | WillChangeField (int cFields, Variant Fields, int[] adStatus, msado15._Recordset pRecordset)
void | WillChangeRecord (int adReason, int cRecords, int[] adStatus, msado15._Recordset pRecordset)
void | WillChangeRecordset (int adReason, int[] adStatus, msado15._Recordset pRecordset)
void | WillMove (int adReason, int[] adStatus, msado15._Recordset pRecordset)

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x403, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)

Detailed Description

Definition at line 20 of file RecordsetEventsVt.java.

Member Function Documentation

void msado15::RecordsetEventsVt::EndOfRecordset | ( | boolean[] | fMoreData,
 |  | int[] | adStatus,
 |  | msado15._Recordset | pRecordset
 | ) |  |

.method(vtoffset=8, addFlagsVtable=4) .parameters([in,out,size=1,type=ARRAY] fMoreData, [in,out,type=PTR] adStatus, [in,iid=00000556-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] pRecordset)

void msado15::RecordsetEventsVt::FetchComplete | ( | msado15.Error | pError,
 |  | int[] | adStatus,
 |  | msado15._Recordset | pRecordset
 | ) |  |

.method(vtoffset=10, addFlagsVtable=4) .parameters([in,iid=00000500-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] pError, [in,out,type=PTR] adStatus, [in,iid=00000556-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] pRecordset)

void msado15::RecordsetEventsVt::FetchProgress | ( | int | Progress,
 |  | int | MaxProgress,
 |  | int[] | adStatus,
 |  | msado15._Recordset | pRecordset
 | ) |  |

.method(vtoffset=9, addFlagsVtable=4) .parameters([in,type=I4] Progress, [in,type=I4] MaxProgress, [in,out,type=PTR] adStatus, [in,iid=00000556-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] pRecordset)

void msado15::RecordsetEventsVt::FieldChangeComplete | ( | int | cFields,
 |  | Variant | Fields,
 |  | msado15.Error | pError,
 |  | int[] | adStatus,
 |  | msado15._Recordset | pRecordset
 | ) |  |

.method(vtoffset=1, addFlagsVtable=4) .parameters([in,type=I4] cFields, [in,type=VARIANT] Fields, [in,iid=00000500-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] pError, [in,out,type=PTR] adStatus, [in,iid=00000556-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] pRecordset)

void msado15::RecordsetEventsVt::MoveComplete | ( | int | adReason,
 |  | msado15.Error | pError,
 |  | int[] | adStatus,
 |  | msado15._Recordset | pRecordset
 | ) |  |

.method(vtoffset=7, addFlagsVtable=4) .parameters([in,type=I4] adReason, [in,iid=00000500-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] pError, [in,out,type=PTR] adStatus, [in,iid=00000556-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] pRecordset)

void msado15::RecordsetEventsVt::RecordChangeComplete | ( | int | adReason,
 |  | int | cRecords,
 |  | msado15.Error | pError,
 |  | int[] | adStatus,
 |  | msado15._Recordset | pRecordset
 | ) |  |

.method(vtoffset=3, addFlagsVtable=4) .parameters([in,type=I4] adReason, [in,type=I4] cRecords, [in,iid=00000500-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] pError, [in,out,type=PTR] adStatus, [in,iid=00000556-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] pRecordset)

void msado15::RecordsetEventsVt::RecordsetChangeComplete | ( | int | adReason,
 |  | msado15.Error | pError,
 |  | int[] | adStatus,
 |  | msado15._Recordset | pRecordset
 | ) |  |

.method(vtoffset=5, addFlagsVtable=4) .parameters([in,type=I4] adReason, [in,iid=00000500-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] pError, [in,out,type=PTR] adStatus, [in,iid=00000556-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] pRecordset)

void msado15::RecordsetEventsVt::WillChangeField | ( | int | cFields,
 |  | Variant | Fields,
 |  | int[] | adStatus,
 |  | msado15._Recordset | pRecordset
 | ) |  |

.method(vtoffset=0, addFlagsVtable=4) .parameters([in,type=I4] cFields, [in,type=VARIANT] Fields, [in,out,type=PTR] adStatus, [in,iid=00000556-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] pRecordset)

void msado15::RecordsetEventsVt::WillChangeRecord | ( | int | adReason,
 |  | int | cRecords,
 |  | int[] | adStatus,
 |  | msado15._Recordset | pRecordset
 | ) |  |

.method(vtoffset=2, addFlagsVtable=4) .parameters([in,type=I4] adReason, [in,type=I4] cRecords, [in,out,type=PTR] adStatus, [in,iid=00000556-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] pRecordset)

void msado15::RecordsetEventsVt::WillChangeRecordset | ( | int | adReason,
 |  | int[] | adStatus,
 |  | msado15._Recordset | pRecordset
 | ) |  |

.method(vtoffset=4, addFlagsVtable=4) .parameters([in,type=I4] adReason, [in,out,type=PTR] adStatus, [in,iid=00000556-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] pRecordset)

void msado15::RecordsetEventsVt::WillMove | ( | int | adReason,
 |  | int[] | adStatus,
 |  | msado15._Recordset | pRecordset
 | ) |  |

.method(vtoffset=6, addFlagsVtable=4) .parameters([in,type=I4] adReason, [in,out,type=PTR] adStatus, [in,iid=00000556-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] pRecordset)

Member Data Documentation

final com.ms.com._Guid msado15::RecordsetEventsVt::iid = new com.ms.com._Guid((int)0x403, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Definition at line 67 of file RecordsetEventsVt.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/RecordsetEventsVt.java
Generated on Wed Nov 13 2024 16:58:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::RecordStatusEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::RecordStatusEnum
Static Public Attributes

msado15::RecordStatusEnum Class Reference

List of all members.

Static Public Attributes

static final int | adRecCanceled = 256
static final int | adRecCantRelease = 1024
static final int | adRecConcurrencyViolation = 2048
static final int | adRecDBDeleted = 262144
static final int | adRecDeleted = 4
static final int | adRecIntegrityViolation = 4096
static final int | adRecInvalid = 16
static final int | adRecMaxChangesExceeded = 8192
static final int | adRecModified = 2
static final int | adRecMultipleChanges = 64
static final int | adRecNew = 1
static final int | adRecObjectOpen = 16384
static final int | adRecOK = 0
static final int | adRecOutOfMemory = 32768
static final int | adRecPendingChanges = 128
static final int | adRecPermissionDenied = 65536
static final int | adRecSchemaViolation = 131072
static final int | adRecUnmodified = 8

Detailed Description

Definition at line 20 of file RecordStatusEnum.java.

Member Data Documentation

final int msado15::RecordStatusEnum::adRecCanceled = 256 [static]

Definition at line 30 of file RecordStatusEnum.java.

final int msado15::RecordStatusEnum::adRecCantRelease = 1024 [static]

Definition at line 31 of file RecordStatusEnum.java.

final int msado15::RecordStatusEnum::adRecConcurrencyViolation = 2048 [static]

Definition at line 32 of file RecordStatusEnum.java.

final int msado15::RecordStatusEnum::adRecDBDeleted = 262144 [static]

Definition at line 39 of file RecordStatusEnum.java.

final int msado15::RecordStatusEnum::adRecDeleted = 4 [static]

Definition at line 25 of file RecordStatusEnum.java.

final int msado15::RecordStatusEnum::adRecIntegrityViolation = 4096 [static]

Definition at line 33 of file RecordStatusEnum.java.

final int msado15::RecordStatusEnum::adRecInvalid = 16 [static]

Definition at line 27 of file RecordStatusEnum.java.

final int msado15::RecordStatusEnum::adRecMaxChangesExceeded = 8192 [static]

Definition at line 34 of file RecordStatusEnum.java.

final int msado15::RecordStatusEnum::adRecModified = 2 [static]

Definition at line 24 of file RecordStatusEnum.java.

final int msado15::RecordStatusEnum::adRecMultipleChanges = 64 [static]

Definition at line 28 of file RecordStatusEnum.java.

final int msado15::RecordStatusEnum::adRecNew = 1 [static]

Definition at line 23 of file RecordStatusEnum.java.

final int msado15::RecordStatusEnum::adRecObjectOpen = 16384 [static]

Definition at line 35 of file RecordStatusEnum.java.

final int msado15::RecordStatusEnum::adRecOK = 0 [static]

Definition at line 22 of file RecordStatusEnum.java.

final int msado15::RecordStatusEnum::adRecOutOfMemory = 32768 [static]

Definition at line 36 of file RecordStatusEnum.java.

final int msado15::RecordStatusEnum::adRecPendingChanges = 128 [static]

Definition at line 29 of file RecordStatusEnum.java.

final int msado15::RecordStatusEnum::adRecPermissionDenied = 65536 [static]

Definition at line 37 of file RecordStatusEnum.java.

final int msado15::RecordStatusEnum::adRecSchemaViolation = 131072 [static]

Definition at line 38 of file RecordStatusEnum.java.

final int msado15::RecordStatusEnum::adRecUnmodified = 8 [static]

Definition at line 26 of file RecordStatusEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/RecordStatusEnum.java
Generated on Wed Nov 13 2024 16:58:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::RecordTypeEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::RecordTypeEnum
Static Public Attributes

msado15::RecordTypeEnum Class Reference

List of all members.

Static Public Attributes

static final short | adCollectionRecord = 1
static final short | adSimpleRecord = 0
static final short | adStructDoc = 2

Detailed Description

Definition at line 20 of file RecordTypeEnum.java.

Member Data Documentation

final short msado15::RecordTypeEnum::adCollectionRecord = 1 [static]

Definition at line 23 of file RecordTypeEnum.java.

final short msado15::RecordTypeEnum::adSimpleRecord = 0 [static]

Definition at line 22 of file RecordTypeEnum.java.

final short msado15::RecordTypeEnum::adStructDoc = 2 [static]

Definition at line 24 of file RecordTypeEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/RecordTypeEnum.java
Generated on Wed Nov 13 2024 16:58:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::ResyncEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::ResyncEnum
Static Public Attributes

msado15::ResyncEnum Class Reference

List of all members.

Static Public Attributes

static final short | adResyncAllValues = 2
static final short | adResyncUnderlyingValues = 1

Detailed Description

Definition at line 20 of file ResyncEnum.java.

Member Data Documentation

final short msado15::ResyncEnum::adResyncAllValues = 2 [static]

Definition at line 23 of file ResyncEnum.java.

final short msado15::ResyncEnum::adResyncUnderlyingValues = 1 [static]

Definition at line 22 of file ResyncEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ResyncEnum.java
Generated on Wed Nov 13 2024 16:58:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::SaveOptionsEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::SaveOptionsEnum
Static Public Attributes

msado15::SaveOptionsEnum Class Reference

List of all members.

Static Public Attributes

static final short | adSaveCreateNotExist = 1
static final short | adSaveCreateOverWrite = 2

Detailed Description

Definition at line 20 of file SaveOptionsEnum.java.

Member Data Documentation

final short msado15::SaveOptionsEnum::adSaveCreateNotExist = 1 [static]

Definition at line 22 of file SaveOptionsEnum.java.

final short msado15::SaveOptionsEnum::adSaveCreateOverWrite = 2 [static]

Definition at line 23 of file SaveOptionsEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/SaveOptionsEnum.java
Generated on Wed Nov 13 2024 16:58:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::SchemaEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::SchemaEnum
Static Public Attributes

msado15::SchemaEnum Class Reference

List of all members.

Static Public Attributes

static final short | adSchemaAsserts = 0
static final short | adSchemaCatalogs = 1
static final short | adSchemaCharacterSets = 2
static final short | adSchemaCheckConstraints = 5
static final short | adSchemaCollations = 3
static final short | adSchemaColumnPrivileges = 13
static final short | adSchemaColumns = 4
static final short | adSchemaColumnsDomainUsage = 11
static final short | adSchemaConstraintColumnUsage = 6
static final short | adSchemaConstraintTableUsage = 7
static final short | adSchemaCubes = 32
static final short | adSchemaDBInfoKeywords = 30
static final short | adSchemaDBInfoLiterals = 31
static final short | adSchemaDimensions = 33
static final short | adSchemaForeignKeys = 27
static final short | adSchemaHierarchies = 34
static final short | adSchemaIndexes = 12
static final short | adSchemaKeyColumnUsage = 8
static final short | adSchemaLevels = 35
static final short | adSchemaMeasures = 36
static final short | adSchemaMembers = 38
static final short | adSchemaPrimaryKeys = 28
static final short | adSchemaProcedureColumns = 29
static final short | adSchemaProcedureParameters = 26
static final short | adSchemaProcedures = 16
static final short | adSchemaProperties = 37
static final short | adSchemaProviderSpecific = -1
static final short | adSchemaProviderTypes = 22
static final short | adSchemaReferentialConstraints = 9
static final short | adSchemaReferentialContraints = 9
static final short | adSchemaSchemata = 17
static final short | adSchemaSQLLanguages = 18
static final short | adSchemaStatistics = 19
static final short | adSchemaTableConstraints = 10
static final short | adSchemaTablePrivileges = 14
static final short | adSchemaTables = 20
static final short | adSchemaTranslations = 21
static final short | adSchemaTrustees = 39
static final short | adSchemaUsagePrivileges = 15
static final short | adSchemaViewColumnUsage = 24
static final short | adSchemaViews = 23
static final short | adSchemaViewTableUsage = 25

Detailed Description

Definition at line 20 of file SchemaEnum.java.

Member Data Documentation

final short msado15::SchemaEnum::adSchemaAsserts = 0 [static]

Definition at line 23 of file SchemaEnum.java.

final short msado15::SchemaEnum::adSchemaCatalogs = 1 [static]

Definition at line 24 of file SchemaEnum.java.

final short msado15::SchemaEnum::adSchemaCharacterSets = 2 [static]

Definition at line 25 of file SchemaEnum.java.

final short msado15::SchemaEnum::adSchemaCheckConstraints = 5 [static]

Definition at line 28 of file SchemaEnum.java.

final short msado15::SchemaEnum::adSchemaCollations = 3 [static]

Definition at line 26 of file SchemaEnum.java.

final short msado15::SchemaEnum::adSchemaColumnPrivileges = 13 [static]

Definition at line 37 of file SchemaEnum.java.

final short msado15::SchemaEnum::adSchemaColumns = 4 [static]

Definition at line 27 of file SchemaEnum.java.

final short msado15::SchemaEnum::adSchemaColumnsDomainUsage = 11 [static]

Definition at line 35 of file SchemaEnum.java.

final short msado15::SchemaEnum::adSchemaConstraintColumnUsage = 6 [static]

Definition at line 29 of file SchemaEnum.java.

final short msado15::SchemaEnum::adSchemaConstraintTableUsage = 7 [static]

Definition at line 30 of file SchemaEnum.java.

final short msado15::SchemaEnum::adSchemaCubes = 32 [static]

Definition at line 56 of file SchemaEnum.java.

final short msado15::SchemaEnum::adSchemaDBInfoKeywords = 30 [static]

Definition at line 54 of file SchemaEnum.java.

final short msado15::SchemaEnum::adSchemaDBInfoLiterals = 31 [static]

Definition at line 55 of file SchemaEnum.java.

final short msado15::SchemaEnum::adSchemaDimensions = 33 [static]

Definition at line 57 of file SchemaEnum.java.

final short msado15::SchemaEnum::adSchemaForeignKeys = 27 [static]

Definition at line 51 of file SchemaEnum.java.

final short msado15::SchemaEnum::adSchemaHierarchies = 34 [static]

Definition at line 58 of file SchemaEnum.java.

final short msado15::SchemaEnum::adSchemaIndexes = 12 [static]

Definition at line 36 of file SchemaEnum.java.

final short msado15::SchemaEnum::adSchemaKeyColumnUsage = 8 [static]

Definition at line 31 of file SchemaEnum.java.

final short msado15::SchemaEnum::adSchemaLevels = 35 [static]

Definition at line 59 of file SchemaEnum.java.

final short msado15::SchemaEnum::adSchemaMeasures = 36 [static]

Definition at line 60 of file SchemaEnum.java.

final short msado15::SchemaEnum::adSchemaMembers = 38 [static]

Definition at line 62 of file SchemaEnum.java.

final short msado15::SchemaEnum::adSchemaPrimaryKeys = 28 [static]

Definition at line 52 of file SchemaEnum.java.

final short msado15::SchemaEnum::adSchemaProcedureColumns = 29 [static]

Definition at line 53 of file SchemaEnum.java.

final short msado15::SchemaEnum::adSchemaProcedureParameters = 26 [static]

Definition at line 50 of file SchemaEnum.java.

final short msado15::SchemaEnum::adSchemaProcedures = 16 [static]

Definition at line 40 of file SchemaEnum.java.

final short msado15::SchemaEnum::adSchemaProperties = 37 [static]

Definition at line 61 of file SchemaEnum.java.

final short msado15::SchemaEnum::adSchemaProviderSpecific = -1 [static]

Definition at line 22 of file SchemaEnum.java.

final short msado15::SchemaEnum::adSchemaProviderTypes = 22 [static]

Definition at line 46 of file SchemaEnum.java.

final short msado15::SchemaEnum::adSchemaReferentialConstraints = 9 [static]

Definition at line 33 of file SchemaEnum.java.

final short msado15::SchemaEnum::adSchemaReferentialContraints = 9 [static]

Definition at line 32 of file SchemaEnum.java.

final short msado15::SchemaEnum::adSchemaSchemata = 17 [static]

Definition at line 41 of file SchemaEnum.java.

final short msado15::SchemaEnum::adSchemaSQLLanguages = 18 [static]

Definition at line 42 of file SchemaEnum.java.

final short msado15::SchemaEnum::adSchemaStatistics = 19 [static]

Definition at line 43 of file SchemaEnum.java.

final short msado15::SchemaEnum::adSchemaTableConstraints = 10 [static]

Definition at line 34 of file SchemaEnum.java.

final short msado15::SchemaEnum::adSchemaTablePrivileges = 14 [static]

Definition at line 38 of file SchemaEnum.java.

final short msado15::SchemaEnum::adSchemaTables = 20 [static]

Definition at line 44 of file SchemaEnum.java.

final short msado15::SchemaEnum::adSchemaTranslations = 21 [static]

Definition at line 45 of file SchemaEnum.java.

final short msado15::SchemaEnum::adSchemaTrustees = 39 [static]

Definition at line 63 of file SchemaEnum.java.

final short msado15::SchemaEnum::adSchemaUsagePrivileges = 15 [static]

Definition at line 39 of file SchemaEnum.java.

final short msado15::SchemaEnum::adSchemaViewColumnUsage = 24 [static]

Definition at line 48 of file SchemaEnum.java.

final short msado15::SchemaEnum::adSchemaViews = 23 [static]

Definition at line 47 of file SchemaEnum.java.

final short msado15::SchemaEnum::adSchemaViewTableUsage = 25 [static]

Definition at line 49 of file SchemaEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/SchemaEnum.java
Generated on Wed Nov 13 2024 16:58:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::SearchDirectionEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::SearchDirectionEnum
Static Public Attributes

msado15::SearchDirectionEnum Class Reference

List of all members.

Static Public Attributes

static final short | adSearchBackward = -1
static final short | adSearchForward = 1

Detailed Description

Definition at line 20 of file SearchDirectionEnum.java.

Member Data Documentation

final short msado15::SearchDirectionEnum::adSearchBackward = -1 [static]

Definition at line 23 of file SearchDirectionEnum.java.

final short msado15::SearchDirectionEnum::adSearchForward = 1 [static]

Definition at line 22 of file SearchDirectionEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/SearchDirectionEnum.java
Generated on Wed Nov 13 2024 16:58:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::SeekEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::SeekEnum
Static Public Attributes

msado15::SeekEnum Class Reference

List of all members.

Static Public Attributes

static final short | adSeekAfter = 8
static final short | adSeekAfterEQ = 4
static final short | adSeekBefore = 32
static final short | adSeekBeforeEQ = 16
static final short | adSeekFirstEQ = 1
static final short | adSeekLastEQ = 2

Detailed Description

Definition at line 20 of file SeekEnum.java.

Member Data Documentation

final short msado15::SeekEnum::adSeekAfter = 8 [static]

Definition at line 25 of file SeekEnum.java.

final short msado15::SeekEnum::adSeekAfterEQ = 4 [static]

Definition at line 24 of file SeekEnum.java.

final short msado15::SeekEnum::adSeekBefore = 32 [static]

Definition at line 27 of file SeekEnum.java.

final short msado15::SeekEnum::adSeekBeforeEQ = 16 [static]

Definition at line 26 of file SeekEnum.java.

final short msado15::SeekEnum::adSeekFirstEQ = 1 [static]

Definition at line 22 of file SeekEnum.java.

final short msado15::SeekEnum::adSeekLastEQ = 2 [static]

Definition at line 23 of file SeekEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/SeekEnum.java
Generated on Wed Nov 13 2024 16:58:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::Stream Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::Stream
Public Member Functions | Static Public Attributes

msado15::Stream Class Reference

.class(classid=00000566-0000-0010-8000-00AA006D2EA4,DynamicCasts) .interface(iid=00000565-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL)

Inherits com::ms::com::IUnknown, and msado15::_Stream.

List of all members.

Public Member Functions

native void | Cancel ()
native void | Close ()
native void | CopyTo (msado15._Stream DestStream, int CharNumber)
native void | Flush ()
native String | getCharset ()
native boolean | getEOS ()
native int | getLineSeparator ()
native int | getMode ()
native int | getPosition ()
native int | getSize ()
native int | getState ()
native int | getType ()
native void | LoadFromFile (String FileName)
native void | Open (Variant Source, int Mode, int Options, String UserName, String Password)
native Variant | Read (int NumBytes)
native String | ReadText (int NumChars)
native void | SaveToFile (String FileName, int Options)
native void | setCharset (String pbstrCharset)
native void | SetEOS ()
native void | setLineSeparator (int pLS)
native void | setMode (int pMode)
native void | setPosition (int pPos)
native void | setType (int ptype)
native void | SkipLine ()
native void | Write (Variant Buffer)
native void | WriteText (String Data, int Options)

Static Public Attributes

static final com.ms.com._Guid | clsid = new com.ms.com._Guid((int)0x566, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)
static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x565, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4)

Detailed Description

Definition at line 20 of file Stream.java.

Member Function Documentation

native void msado15::Stream::Cancel ( )

.method(vtoffset=29, dispid=21, type=METHOD, name="Cancel", addFlagsVtable=4) .parameters()

Implements msado15::_Stream.

native void msado15::Stream::Close ( )

.method(vtoffset=19, dispid=11, type=METHOD, name="Close", addFlagsVtable=4) .parameters()

Implements msado15::_Stream.

native void msado15::Stream::CopyTo | ( | msado15._Stream | DestStream,
 |  | int | CharNumber
 | ) |  |

.method(vtoffset=23, dispid=15, type=METHOD, name="CopyTo", addFlagsVtable=4) .parameters([in,iid=00000565-0000-0010-8000-00AA006D2EA4,thread=AUTO,type=DISPATCH] DestStream, [in,type=I4] CharNumber)

Implements msado15::_Stream.

native void msado15::Stream::Flush ( )

.method(vtoffset=24, dispid=16, type=METHOD, name="Flush", addFlagsVtable=4) .parameters()

Implements msado15::_Stream.

native String msado15::Stream::getCharset ( )

.method(vtoffset=15, dispid=8, type=PROPGET, name="Charset", name2="getCharset", addFlagsVtable=4) .parameters([type=STRING] return)

Implements msado15::_Stream.

native boolean msado15::Stream::getEOS ( )

.method(vtoffset=5, dispid=2, type=PROPGET, name="EOS", name2="getEOS", addFlagsVtable=4) .parameters([type=BOOLEAN] return)

Implements msado15::_Stream.

native int msado15::Stream::getLineSeparator ( )

.method(vtoffset=10, dispid=5, type=PROPGET, name="LineSeparator", name2="getLineSeparator", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::_Stream.

native int msado15::Stream::getMode ( )

.method(vtoffset=13, dispid=7, type=PROPGET, name="Mode", name2="getMode", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::_Stream.

native int msado15::Stream::getPosition ( )

.method(vtoffset=6, dispid=3, type=PROPGET, name="Position", name2="getPosition", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::_Stream.

native int msado15::Stream::getSize ( )

.method(vtoffset=4, dispid=1, type=PROPGET, name="Size", name2="getSize", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::_Stream.

native int msado15::Stream::getState ( )

.method(vtoffset=12, dispid=6, type=PROPGET, name="State", name2="getState", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::_Stream.

native int msado15::Stream::getType ( )

.method(vtoffset=8, dispid=4, type=PROPGET, name="Type", name2="getType", addFlagsVtable=4) .parameters([type=I4] return)

Implements msado15::_Stream.

native void msado15::Stream::LoadFromFile ( String FileName )

.method(vtoffset=26, dispid=18, type=METHOD, name="LoadFromFile", addFlagsVtable=4) .parameters([in,type=STRING] FileName)

Implements msado15::_Stream.

native void msado15::Stream::Open | ( | Variant | Source,
 |  | int | Mode,
 |  | int | Options,
 |  | String | UserName,
 |  | String | Password
 | ) |  |

.method(vtoffset=18, dispid=10, type=METHOD, name="Open", addFlagsVtable=4) .parameters([in,type=VARIANT] Source, [in,type=I4] Mode, [in,type=I4] Options, [in,type=STRING] UserName, [in,type=STRING] Password)

Implements msado15::_Stream.

native Variant msado15::Stream::Read ( int NumBytes )

.method(vtoffset=17, dispid=9, type=METHOD, name="Read", addFlagsVtable=4) .parameters([in,type=I4] NumBytes, [type=VARIANT] return)

Implements msado15::_Stream.

native String msado15::Stream::ReadText ( int NumChars )

.method(vtoffset=27, dispid=19, type=METHOD, name="ReadText", addFlagsVtable=4) .parameters([in,type=I4] NumChars, [type=STRING] return)

Implements msado15::_Stream.

native void msado15::Stream::SaveToFile | ( | String | FileName,
 |  | int | Options
 | ) |  |

.method(vtoffset=25, dispid=17, type=METHOD, name="SaveToFile", addFlagsVtable=4) .parameters([in,type=STRING] FileName, [in,type=I4] Options)

Implements msado15::_Stream.

native void msado15::Stream::setCharset ( String pbstrCharset )

.method(vtoffset=16, dispid=8, type=PROPPUT, name="Charset", name2="putCharset", addFlagsVtable=4) .parameters([in,type=STRING] pbstrCharset)

Implements msado15::_Stream.

native void msado15::Stream::SetEOS ( )

.method(vtoffset=22, dispid=14, type=METHOD, name="SetEOS", addFlagsVtable=4) .parameters()

Implements msado15::_Stream.

native void msado15::Stream::setLineSeparator ( int pLS )

.method(vtoffset=11, dispid=5, type=PROPPUT, name="LineSeparator", name2="putLineSeparator", addFlagsVtable=4) .parameters([in,type=I4] pLS)

Implements msado15::_Stream.

native void msado15::Stream::setMode ( int pMode )

.method(vtoffset=14, dispid=7, type=PROPPUT, name="Mode", name2="putMode", addFlagsVtable=4) .parameters([in,type=I4] pMode)

Implements msado15::_Stream.

native void msado15::Stream::setPosition ( int pPos )

.method(vtoffset=7, dispid=3, type=PROPPUT, name="Position", name2="putPosition", addFlagsVtable=4) .parameters([in,type=I4] pPos)

Implements msado15::_Stream.

native void msado15::Stream::setType ( int ptype )

.method(vtoffset=9, dispid=4, type=PROPPUT, name="Type", name2="putType", addFlagsVtable=4) .parameters([in,type=I4] ptype)

Implements msado15::_Stream.

native void msado15::Stream::SkipLine ( )

.method(vtoffset=20, dispid=12, type=METHOD, name="SkipLine", addFlagsVtable=4) .parameters()

Implements msado15::_Stream.

native void msado15::Stream::Write ( Variant Buffer )

.method(vtoffset=21, dispid=13, type=METHOD, name="Write", addFlagsVtable=4) .parameters([in,type=VARIANT] Buffer)

Implements msado15::_Stream.

native void msado15::Stream::WriteText | ( | String | Data,
 |  | int | Options
 | ) |  |

.method(vtoffset=28, dispid=20, type=METHOD, name="WriteText", addFlagsVtable=4) .parameters([in,type=STRING] Data, [in,type=I4] Options)

Implements msado15::_Stream.

Member Data Documentation

final com.ms.com._Guid msado15::Stream::clsid = new com.ms.com._Guid((int)0x566, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Definition at line 129 of file Stream.java.

final com.ms.com._Guid msado15::Stream::iid = new com.ms.com._Guid((int)0x565, (short)0x0, (short)0x10, (byte)0x80, (byte)0x0, (byte)0x0, (byte)0xaa, (byte)0x0, (byte)0x6d, (byte)0x2e, (byte)0xa4) [static]

Implements msado15::_Stream.

Definition at line 127 of file Stream.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Stream.java
Generated on Wed Nov 13 2024 16:58:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::StreamOpenOptionsEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::StreamOpenOptionsEnum
Static Public Attributes

msado15::StreamOpenOptionsEnum Class Reference

List of all members.

Static Public Attributes

static final short | adOpenStreamAsync = 1
static final short | adOpenStreamFromRecord = 4
static final short | adOpenStreamFromURL = 8
static final short | stOpenAsync = 1
static final short | stOpenFromRecord = 4
static final short | stOpenFromURL = 8

Detailed Description

Definition at line 20 of file StreamOpenOptionsEnum.java.

Member Data Documentation

final short msado15::StreamOpenOptionsEnum::adOpenStreamAsync = 1 [static]

Definition at line 22 of file StreamOpenOptionsEnum.java.

final short msado15::StreamOpenOptionsEnum::adOpenStreamFromRecord = 4 [static]

Definition at line 23 of file StreamOpenOptionsEnum.java.

final short msado15::StreamOpenOptionsEnum::adOpenStreamFromURL = 8 [static]

Definition at line 24 of file StreamOpenOptionsEnum.java.

final short msado15::StreamOpenOptionsEnum::stOpenAsync = 1 [static]

Definition at line 25 of file StreamOpenOptionsEnum.java.

final short msado15::StreamOpenOptionsEnum::stOpenFromRecord = 4 [static]

Definition at line 26 of file StreamOpenOptionsEnum.java.

final short msado15::StreamOpenOptionsEnum::stOpenFromURL = 8 [static]

Definition at line 27 of file StreamOpenOptionsEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/StreamOpenOptionsEnum.java
Generated on Wed Nov 13 2024 16:58:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::StreamReadEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::StreamReadEnum
Static Public Attributes

msado15::StreamReadEnum Class Reference

List of all members.

Static Public Attributes

static final short | adReadAll = -1
static final short | adReadLine = -2

Detailed Description

Definition at line 20 of file StreamReadEnum.java.

Member Data Documentation

final short msado15::StreamReadEnum::adReadAll = -1 [static]

Definition at line 22 of file StreamReadEnum.java.

final short msado15::StreamReadEnum::adReadLine = -2 [static]

Definition at line 23 of file StreamReadEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/StreamReadEnum.java
Generated on Wed Nov 13 2024 16:58:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::StreamTypeEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::StreamTypeEnum
Static Public Attributes

msado15::StreamTypeEnum Class Reference

List of all members.

Static Public Attributes

static final short | adTypeBinary = 1
static final short | adTypeText = 2

Detailed Description

Definition at line 20 of file StreamTypeEnum.java.

Member Data Documentation

final short msado15::StreamTypeEnum::adTypeBinary = 1 [static]

Definition at line 22 of file StreamTypeEnum.java.

final short msado15::StreamTypeEnum::adTypeText = 2 [static]

Definition at line 23 of file StreamTypeEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/StreamTypeEnum.java
Generated on Wed Nov 13 2024 16:58:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::StreamWriteEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::StreamWriteEnum
Static Public Attributes

msado15::StreamWriteEnum Class Reference

List of all members.

Static Public Attributes

static final short | adWriteChar = 0
static final short | adWriteLine = 1
static final short | stWriteChar = 0
static final short | stWriteLine = 1

Detailed Description

Definition at line 20 of file StreamWriteEnum.java.

Member Data Documentation

final short msado15::StreamWriteEnum::adWriteChar = 0 [static]

Definition at line 22 of file StreamWriteEnum.java.

final short msado15::StreamWriteEnum::adWriteLine = 1 [static]

Definition at line 23 of file StreamWriteEnum.java.

final short msado15::StreamWriteEnum::stWriteChar = 0 [static]

Definition at line 24 of file StreamWriteEnum.java.

final short msado15::StreamWriteEnum::stWriteLine = 1 [static]

Definition at line 25 of file StreamWriteEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/StreamWriteEnum.java
Generated on Wed Nov 13 2024 16:58:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::StringFormatEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::StringFormatEnum
Static Public Attributes

msado15::StringFormatEnum Class Reference

List of all members.

Static Public Attributes

static final short adClipString = 2

Detailed Description

Definition at line 20 of file StringFormatEnum.java.

Member Data Documentation

final short msado15::StringFormatEnum::adClipString = 2 [static]

Definition at line 22 of file StringFormatEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/StringFormatEnum.java
Generated on Wed Nov 13 2024 16:58:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15::XactAttributeEnum Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • msado15
  • msado15::XactAttributeEnum
Static Public Attributes

msado15::XactAttributeEnum Class Reference

List of all members.

Static Public Attributes

static final int | adXactAbortRetaining = 262144
static final int | adXactAsyncPhaseOne = 524288
static final int | adXactCommitRetaining = 131072
static final int | adXactSyncPhaseOne = 1048576

Detailed Description

Definition at line 20 of file XactAttributeEnum.java.

Member Data Documentation

final int msado15::XactAttributeEnum::adXactAbortRetaining = 262144 [static]

Definition at line 23 of file XactAttributeEnum.java.

final int msado15::XactAttributeEnum::adXactAsyncPhaseOne = 524288 [static]

Definition at line 24 of file XactAttributeEnum.java.

final int msado15::XactAttributeEnum::adXactCommitRetaining = 131072 [static]

Definition at line 22 of file XactAttributeEnum.java.

final int msado15::XactAttributeEnum::adXactSyncPhaseOne = 1048576 [static]

Definition at line 25 of file XactAttributeEnum.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/XactAttributeEnum.java
Generated on Wed Nov 13 2024 16:58:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: MSDFHDL::IDataFactoryHandler Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • MSDFHDL
  • MSDFHDL::IDataFactoryHandler
Public Member Functions

MSDFHDL::IDataFactoryHandler Interface Reference

import "msdfhdl.idl";

Inherits com::ms::com::IUnknown.

List of all members.

Public Member Functions

HRESULT _stdcall | GetRecordset ([in] BSTR conn,[in] BSTR args,[in] BSTR query,[out, retval] _Recordset **ppRS)
HRESULT _stdcall | OpenConnection ([in] BSTR conn,[in] BSTR args,[in] long lFlags,[in, out] BSTR *pQuery,[out, retval] _Connection **ppConnection)
HRESULT _stdcall | Reconnect ([in] BSTR conn,[in] BSTR args,[in] _Recordset *pRS)

Detailed Description

Definition at line 37 of file msdfhdl.idl.

Member Function Documentation

HRESULT _stdcall MSDFHDL::IDataFactoryHandler::GetRecordset | ( | [in] BSTR | conn,
 |  | [in] BSTR | args,
 |  | [in] BSTR | query,
 |  | [out, retval] _Recordset ** | ppRS
 | ) |  |
HRESULT _stdcall MSDFHDL::IDataFactoryHandler::OpenConnection | ( | [in] BSTR | conn,
 |  | [in] BSTR | args,
 |  | [in] long | lFlags,
 |  | [in, out] BSTR * | pQuery,
 |  | [out, retval] _Connection ** | ppConnection
 | ) |  |
HRESULT _stdcall MSDFHDL::IDataFactoryHandler::Reconnect | ( | [in] BSTR | conn,
 |  | [in] BSTR | args,
 |  | [in] _Recordset * | pRS
 | ) |  |
The documentation for this interface was generated from the following file:
  • Dataaccess/rds/handler/vc/msdfhdl.idl
Generated on Wed Nov 13 2024 16:58:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: MSDFMAPLib::Handler Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • MSDFMAPLib
  • MSDFMAPLib::Handler

MSDFMAPLib::Handler Class Reference

import "msdfmap.idl";

Detailed Description

Definition at line 40 of file msdfmap.idl.

The documentation for this class was generated from the following file:
  • Dataaccess/rds/handler/vc/msdfmap.idl
Generated on Wed Nov 13 2024 16:58:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: MyClassFactory Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes

MyClassFactory Class Reference

#include "myclassfactory.h"

List of all members.

Public Member Functions

MyClassFactory (void)
virtual | ~MyClassFactory (void)
STDMETHODIMP | CreateInstance (LPUNKNOWN, REFIID, LPVOID *)
HRESULT | GetProviderCLSID ()
STDMETHODIMP | LockServer (BOOL)
virtual STDMETHODIMP | QueryInterface (REFIID riid, void **ppv)
virtual | STDMETHODIMP_ (ULONG) AddRef()
virtual | STDMETHODIMP_ (ULONG) Release()

Protected Attributes

ULONG m_cRef
GUID | m_guidProv

Detailed Description

Definition at line 21 of file myclassfactory.h.

Constructor & Destructor Documentation

MyClassFactory::MyClassFactory ( void )

Definition at line 51 of file myclassfactory.cpp.

{
    m_cRef = 0;
  InterlockedIncrement(&g_cObj);
}

MyClassFactory::~MyClassFactory ( void ) [virtual]

Definition at line 57 of file myclassfactory.cpp.

{
  InterlockedDecrement(&g_cObj);
}

Member Function Documentation

STDMETHODIMP MyClassFactory::CreateInstance | ( | LPUNKNOWN | ,
 |  | REFIID | ,
 |  | LPVOID * |
 | ) |  |
HRESULT MyClassFactory::GetProviderCLSID ( )
STDMETHODIMP MyClassFactory::LockServer ( BOOL fLock )

Definition at line 127 of file myclassfactory.cpp.

{
    if (fLock)
        InterlockedIncrement( &g_cLock );
    else
        InterlockedDecrement( &g_cLock );

    return NOERROR;
}

STDMETHODIMP MyClassFactory::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppv |
 | ) |  |  | [virtual]

Definition at line 63 of file myclassfactory.cpp.

{
    if(ppv == NULL)
        return E_INVALIDARG;

    // Do we support this interface?
    if (riid == IID_IUnknown ||
        riid == IID_IClassFactory)
    {
    *ppv = this;
  }
    else
  {
    *ppv = NULL;
        return E_NOINTERFACE;
  }

    if ((IUnknown*)*ppv)
  {
    ((IUnknown*)*ppv)->AddRef();
  }
    return S_OK;
}

virtual MyClassFactory::STDMETHODIMP_ ( ULONG ) [inline, virtual]

Definition at line 28 of file myclassfactory.h.

    {
      InterlockedIncrement((LONG*)&m_cRef);
      return m_cRef;
    }

virtual MyClassFactory::STDMETHODIMP_ ( ULONG ) [inline, virtual]

Definition at line 33 of file myclassfactory.h.

    {
      if(InterlockedDecrement((LONG*)&m_cRef))
        return m_cRef;

      delete this;
      return 0;
    }

Member Data Documentation

ULONG MyClassFactory::m_cRef [protected]

Definition at line 50 of file myclassfactory.h.

GUID MyClassFactory::m_guidProv [protected]

Definition at line 51 of file myclassfactory.h.

The documentation for this class was generated from the following files:
  • Dataaccess/osp/vc/myclassfactory.h
  • Dataaccess/osp/vc/myclassfactory.cpp
Generated on Wed Nov 13 2024 16:57:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: MyDataSource Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Protected Attributes | Package Attributes

MyDataSource Class Reference

.register ( clsid=81C75D38-790A-11D2-8A61-0060088F441E, typelib=81C75D37-790A-11D2-8A61-0060088F441E )

#include "mydatasource.h"

List of all members.

Public Member Functions

MyDataSource ()
MyDataSource ()
virtual | ~MyDataSource ()
void | addDataSourceListener (DataSourceListener rDataSourceListener) throws ComException
virtual STDMETHODIMP | addDataSourceListener (IDataSourceListener *pDSL)
virtual STDMETHODIMP | getDataMember (BSTR bstrDM, REFIID riid, IUnknown **ppUnk)
IUnknown | getDataMember (String sDataMember, _Guid riid) throws ComException
virtual STDMETHODIMP | getDataMemberCount (LONG *plCount)
int | getDataMemberCount ()
virtual STDMETHODIMP | getDataMemberName (LONG lIndex, BSTR *pbstrDM)
String | getDataMemberName (int lIndex)
virtual HRESULT | Init ()
virtual STDMETHODIMP | QueryInterface (REFIID riid, void **ppv)
virtual STDMETHODIMP | removeDataSourceListener (IDataSourceListener *pDSL)
void | removeDataSourceListener (DataSourceListener rDataSourceListener) throws ComException
virtual | STDMETHODIMP_ (ULONG) Release()
virtual | STDMETHODIMP_ (ULONG) AddRef()

Static Public Member Functions

static void | main (String args[])

Protected Attributes

ULONG m_cRef
ULONG m_cTables
CExList< IDataSourceListener * > | m_listListeners
MyOSPObject * m_pMyOSPObject
WCHAR * | m_rgpwszTableName [1]

Package Attributes

MyOSPObject m_rOSPObject
String | m_sDataMember
Vector | m_vListeners

Detailed Description

Definition at line 24 of file mydatasource.h.

Constructor & Destructor Documentation

MyDataSource::MyDataSource ( )

Definition at line 22 of file mydatasource.cpp.

{
  //IUnknown
  m_cRef = 0;

  //OLEDBSimpleProvider
  m_pMyOSPObject = NULL;

  //DataMembers (tables)
  m_cTables = 1;
  m_rgpwszTableName[0] = L"";
}

MyDataSource::~MyDataSource ( ) [virtual]

Definition at line 35 of file mydatasource.cpp.

{
  // Remove all Listeners:
  while (!m_listListeners.IsEmpty())
    m_listListeners.RemoveHead()->Release();

  // Remove the Simple provider instance:
  SAFE_RELEASE(m_pMyOSPObject);
}

MyDataSource::MyDataSource ( ) [inline]

Definition at line 34 of file mydatasource.java.

  {
    // Reference a new simple provider object:
    m_sDataMember = new String("Unitialized Sample");
    m_vListeners = new Vector();
    m_rOSPObject = new MyOSPObject();
  }

Member Function Documentation

HRESULT MyDataSource::addDataSourceListener ( IDataSourceListener * pDSL ) [virtual]

Definition at line 127 of file mydatasource.cpp.

{
  if (pIDataSourceListener == NULL)
    return E_INVALIDARG;

  // Add the Listener:
  pIDataSourceListener->AddRef();
  m_listListeners.AddTail(pIDataSourceListener);
  return S_OK;
}

void MyDataSource::addDataSourceListener ( DataSourceListener rDataSourceListener ) throws ComException [inline]

Definition at line 73 of file mydatasource.java.

  {
    if (rDataSourceListener == null)
      throw new ComFailException();

    // Add the listener:
    m_vListeners.addElement(rDataSourceListener);
  }

HRESULT MyDataSource::getDataMember | ( | BSTR | bstrDM,
 |  | REFIID | riid,
 |  | IUnknown ** | ppUnk |
 | ) |  |  | [virtual]

Definition at line 84 of file mydatasource.cpp.

{
  HRESULT hr = S_OK;

  if (ppUnk==NULL)
    return E_INVALIDARG;

  if (bstrDM == NULL || bstrDM[0] == L'\0')
  {
    hr = m_pMyOSPObject->Init(m_rgpwszTableName[0]);
  }
  else
  {
    hr = m_pMyOSPObject->Init(bstrDM);
  }
  if (hr != S_OK)
    return hr;

  hr = m_pMyOSPObject->QueryInterface(riid, (void**)ppUnk);
  return hr;
}

IUnknown MyDataSource::getDataMember | ( | String | sDataMember,
 |  | _Guid | riid |
 | ) |  |  | throws ComException [inline]

Definition at line 47 of file mydatasource.java.

  {
    if (sDataMember == null)
      throw new ComFailException();

    // The DataMember string contains the file name.  Use it to prompt the
    // OSPObject to load its data.  Return the OSP Object:
    m_sDataMember = new String(sDataMember);
    m_rOSPObject.setFile(sDataMember);
    m_rOSPObject.loadData();
    return m_rOSPObject;
  }

HRESULT MyDataSource::getDataMemberCount ( LONG * plCount ) [virtual]

Definition at line 116 of file mydatasource.cpp.

{
  if(plCount==NULL)
    return E_INVALIDARG;

  //Return number of tables
  *plCount = m_cTables;
  return S_OK;
}

int MyDataSource::getDataMemberCount ( ) [inline]

Definition at line 67 of file mydatasource.java.

  {
    // This sample DataSource has only one data member:
    return 1;
  }

String MyDataSource::getDataMemberName ( int lIndex ) [inline]

Definition at line 60 of file mydatasource.java.

  {
    if (lIndex != 0)
      throw new ComFailException();
    return new String(m_sDataMember);
  }

HRESULT MyDataSource::getDataMemberName | ( | LONG | lIndex,
 |  | BSTR * | pbstrDM |
 | ) |  |  | [virtual]

Definition at line 106 of file mydatasource.cpp.

{
  if (lIndex < 0 || lIndex >= (LONG)m_cTables || pbstrDM==NULL)
    return E_INVALIDARG;

  //Return indexed TableName
  *pbstrDM = SysAllocString(m_rgpwszTableName[lIndex]);
  return S_OK;
}

HRESULT MyDataSource::Init ( ) [virtual]

Definition at line 45 of file mydatasource.cpp.

{
  //Create a new Simple Provider instance:
  m_pMyOSPObject = new MyOSPObject;
  if (!m_pMyOSPObject)
    return E_OUTOFMEMORY;
  SAFE_ADDREF(m_pMyOSPObject);
  return S_OK;
}

static void MyDataSource::main ( String args[] ) [inline, static]

Definition at line 91 of file mydatasource.java.

  {
    // Test code:
    MyDataSource dso = new MyDataSource();
    MyOSPObject osp = (MyOSPObject)dso.getDataMember("C:\\Customer.txt", OLEDBSimpleProvider.iid);
    System.out.println("Data Member = " + dso.getDataMemberName(0) + ".");
    int cRows = osp.getRowCount();
    int cColumns = osp.getColumnCount();
    System.out.println("Row count = " + cRows + ".");
    System.out.println("Column count = " + cColumns + ".");
  }

HRESULT MyDataSource::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppv |
 | ) |  |  | [virtual]

Definition at line 55 of file mydatasource.cpp.

{
  if (ppv == NULL)
    return E_INVALIDARG;

  // IUnknown:
  if (riid == IID_IUnknown)
    *ppv = (IUnknown*)this;

  // DataSource:
  else if (riid == IID_DataSource)
    *ppv = (IDataSource*)this;

  // Unsupported:
  else
  {
    *ppv = NULL;
    return E_NOINTERFACE;
  }

  SAFE_ADDREF((IUnknown*)*ppv);
  return S_OK;
}

void MyDataSource::removeDataSourceListener ( DataSourceListener rDataSourceListener ) throws ComException [inline]

Definition at line 82 of file mydatasource.java.

  {
    if (rDataSourceListener == null)
      throw new ComFailException();

    // Find the Listener in the list and remove it:
    m_vListeners.removeElement(rDataSourceListener);
  }

HRESULT MyDataSource::removeDataSourceListener ( IDataSourceListener * pDSL ) [virtual]

Definition at line 138 of file mydatasource.cpp.

{
  if (pIDataSourceListener == NULL)
    return E_INVALIDARG;

  // Find the Listener in the list and release it:
  POS pos = m_listListeners.Find(pIDataSourceListener);
  if (pos == NULL)
    return E_FAIL;
  SAFE_RELEASE(pIDataSourceListener);
  m_listListeners.RemoveAt(pos);
  return S_OK;
}

virtual MyDataSource::STDMETHODIMP_ ( ULONG ) [inline, virtual]

Definition at line 39 of file mydatasource.h.

  {
    if(InterlockedDecrement((LONG*)&m_cRef))
      return m_cRef;

    delete this;
    return 0;
  }

virtual MyDataSource::STDMETHODIMP_ ( ULONG ) [inline, virtual]

Definition at line 34 of file mydatasource.h.

  {
    InterlockedIncrement((LONG*)&m_cRef);
    return m_cRef;
  }

Member Data Documentation

ULONG MyDataSource::m_cRef [protected]

Definition at line 67 of file mydatasource.h.

ULONG MyDataSource::m_cTables [protected]

Definition at line 63 of file mydatasource.h.

CExList<IDataSourceListener*> MyDataSource::m_listListeners [protected]

Definition at line 60 of file mydatasource.h.

MyOSPObject* MyDataSource::m_pMyOSPObject [protected]

Definition at line 59 of file mydatasource.h.

WCHAR* MyDataSource::m_rgpwszTableName[1] [protected]

Definition at line 64 of file mydatasource.h.

MyOSPObject MyDataSource::m_rOSPObject [package]

Definition at line 31 of file mydatasource.java.

String MyDataSource::m_sDataMember [package]

Definition at line 29 of file mydatasource.java.

Vector MyDataSource::m_vListeners [package]

Definition at line 30 of file mydatasource.java.

The documentation for this class was generated from the following files:
  • Dataaccess/osp/vc/mydatasource.h
  • Dataaccess/osp/vj/mydatasource.java
  • Dataaccess/osp/vc/mydatasource.cpp
Generated on Wed Nov 13 2024 16:57:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: MYDEVICELib::Dimmer Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • MYDEVICELib
  • MYDEVICELib::Dimmer

MYDEVICELib::Dimmer Class Reference

import "MyDevice.idl";

Detailed Description

Definition at line 96 of file MyDevice.idl.

The documentation for this class was generated from the following file:
  • NetDS/upnp/StepByStep/Step2/MyDevice.idl
Generated on Wed Nov 13 2024 16:58:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: MYDEVICELib::DimmerService Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • MYDEVICELib
  • MYDEVICELib::DimmerService

MYDEVICELib::DimmerService Class Reference

import "MyDevice.idl";

Detailed Description

Definition at line 104 of file MyDevice.idl.

The documentation for this class was generated from the following file:
  • NetDS/upnp/StepByStep/Step2/MyDevice.idl
Generated on Wed Nov 13 2024 16:58:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: MYDEVICELib::IUPnPService_DimmingService_SCPD Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • MYDEVICELib
  • MYDEVICELib::IUPnPService_DimmingService_SCPD
Public Member Functions

MYDEVICELib::IUPnPService_DimmingService_SCPD Interface Reference

import "MyDevice.idl";

List of all members.

Public Member Functions

HRESULT | dimLevel ([out, retval] long *pdimLevel)
HRESULT | dimLevel ([out, retval] long *pdimLevel)
HRESULT | dimLevel ([out, retval] long *pdimLevel)
HRESULT | GetConfigDetails ([in, out] VARIANT_BOOL *ppowerVal,[in, out] long *pdLevel)
HRESULT | GetConfigDetails ([in, out] VARIANT_BOOL *ppowerVal,[in, out] long *pdLevel)
HRESULT | GetConfigDetails ([in, out] VARIANT_BOOL *ppowerVal,[in, out] long *pdLevel)
HRESULT | GetDimLevel ([in, out] long *pdLevel)
HRESULT | GetDimLevel ([in, out] long *pdLevel)
HRESULT | GetDimLevel ([in, out] long *pdLevel)
HRESULT | GetPowerValue ([in, out] VARIANT_BOOL *ppowerVall)
HRESULT | GetPowerValue ([in, out] VARIANT_BOOL *ppowerVall)
HRESULT | GetPowerValue ([in, out] VARIANT_BOOL *ppowerVall)
HRESULT | Power ([out, retval] VARIANT_BOOL *pPower)
HRESULT | Power ([out, retval] VARIANT_BOOL *pPower)
HRESULT | Power ([out, retval] VARIANT_BOOL *pPower)
HRESULT | PowerOff ()
HRESULT | PowerOff ()
HRESULT | PowerOff ()
HRESULT | PowerOn ()
HRESULT | PowerOn ()
HRESULT | PowerOn ()
HRESULT | SetDimLevel ([in] long dLevel)
HRESULT | SetDimLevel ([in] long dLevel)
HRESULT | SetDimLevel ([in] long dLevel)

Detailed Description

Definition at line 58 of file MyDevice.idl.

Member Function Documentation

HRESULT MYDEVICELib::IUPnPService_DimmingService_SCPD::dimLevel ( [out, retval] long * pdimLevel ) [get]
HRESULT MYDEVICELib::IUPnPService_DimmingService_SCPD::dimLevel ( [out, retval] long * pdimLevel ) [get]
HRESULT MYDEVICELib::IUPnPService_DimmingService_SCPD::dimLevel ( [out, retval] long * pdimLevel ) [get]
HRESULT MYDEVICELib::IUPnPService_DimmingService_SCPD::GetConfigDetails | ( | [in, out] VARIANT_BOOL * | ppowerVal,
 |  | [in, out] long * | pdLevel
 | ) |  |
HRESULT MYDEVICELib::IUPnPService_DimmingService_SCPD::GetConfigDetails | ( | [in, out] VARIANT_BOOL * | ppowerVal,
 |  | [in, out] long * | pdLevel
 | ) |  |
HRESULT MYDEVICELib::IUPnPService_DimmingService_SCPD::GetConfigDetails | ( | [in, out] VARIANT_BOOL * | ppowerVal,
 |  | [in, out] long * | pdLevel
 | ) |  |
HRESULT MYDEVICELib::IUPnPService_DimmingService_SCPD::GetDimLevel ( [in, out] long * pdLevel )
HRESULT MYDEVICELib::IUPnPService_DimmingService_SCPD::GetDimLevel ( [in, out] long * pdLevel )
HRESULT MYDEVICELib::IUPnPService_DimmingService_SCPD::GetDimLevel ( [in, out] long * pdLevel )
HRESULT MYDEVICELib::IUPnPService_DimmingService_SCPD::GetPowerValue ( [in, out] VARIANT_BOOL * ppowerVall )
HRESULT MYDEVICELib::IUPnPService_DimmingService_SCPD::GetPowerValue ( [in, out] VARIANT_BOOL * ppowerVall )
HRESULT MYDEVICELib::IUPnPService_DimmingService_SCPD::GetPowerValue ( [in, out] VARIANT_BOOL * ppowerVall )
HRESULT MYDEVICELib::IUPnPService_DimmingService_SCPD::Power ( [out, retval] VARIANT_BOOL * pPower ) [get]
HRESULT MYDEVICELib::IUPnPService_DimmingService_SCPD::Power ( [out, retval] VARIANT_BOOL * pPower ) [get]
HRESULT MYDEVICELib::IUPnPService_DimmingService_SCPD::Power ( [out, retval] VARIANT_BOOL * pPower ) [get]
HRESULT MYDEVICELib::IUPnPService_DimmingService_SCPD::PowerOff ( )
HRESULT MYDEVICELib::IUPnPService_DimmingService_SCPD::PowerOff ( )
HRESULT MYDEVICELib::IUPnPService_DimmingService_SCPD::PowerOff ( )
HRESULT MYDEVICELib::IUPnPService_DimmingService_SCPD::PowerOn ( )
HRESULT MYDEVICELib::IUPnPService_DimmingService_SCPD::PowerOn ( )
HRESULT MYDEVICELib::IUPnPService_DimmingService_SCPD::PowerOn ( )
HRESULT MYDEVICELib::IUPnPService_DimmingService_SCPD::SetDimLevel ( [in] long dLevel )
HRESULT MYDEVICELib::IUPnPService_DimmingService_SCPD::SetDimLevel ( [in] long dLevel )
HRESULT MYDEVICELib::IUPnPService_DimmingService_SCPD::SetDimLevel ( [in] long dLevel )
The documentation for this interface was generated from the following files:
  • NetDS/upnp/StepByStep/Step2/MyDevice.idl
  • NetDS/upnp/StepByStep/Step3/MyDevice.idl
  • NetDS/upnp/StepByStep/Step4/MyDevice.idl
Generated on Wed Nov 13 2024 16:58:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: MyOSPObject Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Protected Attributes | Package Attributes | Private Member Functions

MyOSPObject Class Reference

#include "myospobject.h"

List of all members.

Public Member Functions

MyOSPObject ()
MyOSPObject ()
virtual | ~MyOSPObject ()
virtual STDMETHODIMP | addOLEDBSimpleProviderListener (OLEDBSimpleProviderListener *pospIListener)
void | addOLEDBSimpleProviderListener (OLEDBSimpleProviderListener rListener) throws ComException
boolean | compareString (String s1, String s2, boolean fCaseSensitive, int findFlags)
virtual STDMETHODIMP | deleteRows (LONG iRow, LONG cRows, LONG *pcRowsDeleted)
int | deleteRows (int iRow, int cRows) throws ComException
int | find (int iRowStart, int iColumn, Object obj, int findFlags, int compType) throws ComException
virtual STDMETHODIMP | find (LONG iRowStart, LONG iColumn, VARIANT val, OSPFIND findFlags, OSPCOMP compType, LONG *piRowFound)
virtual STDMETHODIMP | getColumnCount (LONG *pcColumns)
int | getColumnCount () throws ComException
virtual STDMETHODIMP | getEstimatedRows (LONG *piRows)
int | getEstimatedRows () throws ComException
virtual STDMETHODIMP | getLocale (BSTR *pbstrLocale)
String | getLocale () throws ComException
virtual STDMETHODIMP | getRowCount (LONG *pcRows)
int | getRowCount () throws ComException
int | getRWStatus (int iRow, int iColumn) throws ComException
virtual STDMETHODIMP | getRWStatus (LONG iRow, LONG iColumn, OSPRW *prwStatus)
Object | getVariant (int iRow, int iColumn, int format) throws ComException
virtual STDMETHODIMP | getVariant (LONG iRow, LONG iColumn, OSPFORMAT format, VARIANT *pVar)
virtual HRESULT | Init (WCHAR *pwszFilePath)
int | insertRows (int iRow, int cRows) throws ComException
virtual STDMETHODIMP | insertRows (LONG iRow, LONG cRows, LONG *pcRowsInserted)
virtual STDMETHODIMP | isAsync (BOOL *pbAsynch)
int | isAsync () throws ComException
virtual HRESULT | loadData ()
void | loadData ()
virtual HRESULT | Notify (EOSPEVENTS eEvent, ULONG iRow, ULONG iColumn, ULONG cRows)
virtual STDMETHODIMP | QueryInterface (REFIID riid, void **ppv)
void | removeOLEDBSimpleProviderListener (OLEDBSimpleProviderListener rListener) throws ComException
virtual STDMETHODIMP | removeOLEDBSimpleProviderListener (OLEDBSimpleProviderListener *pospIListener)
void | saveData ()
void | setFile (String sFilePath)
void | setVariant (int iRow, int iColumn, int format, Object obj) throws ComException
virtual STDMETHODIMP | setVariant (LONG iRow, LONG iColumn, OSPFORMAT format, VARIANT Var)
virtual | STDMETHODIMP_ (ULONG) AddRef()
virtual | STDMETHODIMP_ (ULONG) Release()
virtual STDMETHODIMP | stopTransfer ()
void | stopTransfer () throws ComException

Static Public Member Functions

static void | main (String args[])

Protected Attributes

LONG | m_cColumns
ULONG m_cRef
LONG | m_cRows
CExList
< OLEDBSimpleProviderListener * > 		m_listListeners
VARIANT ** | m_rvTable
LPSTR m_szFilePath

Package Attributes

int | m_cColumns
int | m_cRows
String[][] | m_rsTable
String | m_sFilePath
Vector | m_vListeners

Private Member Functions

HRESULT | saveData ()

Detailed Description

Definition at line 49 of file myospobject.h.

Constructor & Destructor Documentation

MyOSPObject::MyOSPObject ( )

Definition at line 25 of file myospobject.cpp.

{
  //IUnknown
  m_cRef = 0;

  //Member variables
  m_rvTable   = NULL;
  m_cRows     = 0;
  m_cColumns    = 0;
  m_szFilePath  = NULL;
}

MyOSPObject::~MyOSPObject ( ) [virtual]

Definition at line 38 of file myospobject.cpp.

{
  LONG    i, j;

  // Save the internal table to the data file:
  if (m_szFilePath != NULL)
    saveData();

  // Walk through the internal table.  Free any
  // variants, each row, and finally the table.
  if (m_rvTable != NULL)
  {
    for (i = 0; i <= m_cRows; i++)
    {
      for (j = 1; j <= m_cColumns; j++)
      {
        if (m_rvTable[i][j].vt == VT_BSTR)
          SysFreeString(V_BSTR(&m_rvTable[i][j]));
      }
      CoTaskMemFree(m_rvTable[i]);
    }
    CoTaskMemFree(m_rvTable);
  }

  //Remove all Listeners:
  while(!m_listListeners.IsEmpty())
    m_listListeners.RemoveHead()->Release();

}

MyOSPObject::MyOSPObject ( ) [inline]

Definition at line 37 of file myospobject.java.

  {
    // The file name is not set until the DataSource object
    // does it:
    m_sFilePath   = null;
    m_cRows     = 0;
    m_cColumns    = 0;
    m_vListeners  = new Vector();
  }

Member Function Documentation

HRESULT MyOSPObject::addOLEDBSimpleProviderListener ( OLEDBSimpleProviderListener * pospIListener ) [virtual]

Definition at line 336 of file myospobject.cpp.

{
  if(pospIListener==NULL)
    return E_INVALIDARG;

  //Add the Listener:
  pospIListener->AddRef();
  m_listListeners.AddTail(pospIListener);

  return S_OK;
}

void MyOSPObject::addOLEDBSimpleProviderListener ( OLEDBSimpleProviderListener rListener ) throws ComException [inline]

Definition at line 366 of file myospobject.java.

  {
    // Add a listener:
    m_vListeners.addElement(rListener);
    return;
  }

boolean MyOSPObject::compareString | ( | String | s1,
 |  | String | s2,
 |  | boolean | fCaseSensitive,
 |  | int | findFlags |
 | ) |  |  | [inline]

Definition at line 159 of file myospobject.java.

  {
    if (fCaseSensitive)
    {
      switch (findFlags)
      {
      case OSPCOMP.OSPCOMP_EQ:
        return s1.equals(s2);
      case OSPCOMP.OSPCOMP_LT:
        return (s1.compareTo(s2) < 0) ? true : false;
      case OSPCOMP.OSPCOMP_LE:
        return (s1.compareTo(s2) <= 0) ? true : false;
      case OSPCOMP.OSPCOMP_GE:
        return (s1.compareTo(s2) >= 0) ? true : false;
      case OSPCOMP.OSPCOMP_GT:
        return (s1.compareTo(s2) > 0) ? true : false;
      };
    }
    else
    {
      if (findFlags == OSPCOMP.OSPCOMP_EQ)
        return s1.equalsIgnoreCase(s2);
      else
      {
        String ls1 = new String(s1.toLowerCase());
        String ls2 = new String(s2.toLowerCase());
        switch (findFlags)
        {
        case OSPCOMP.OSPCOMP_LT:
          return (ls1.compareTo(ls2) < 0) ? true : false;
        case OSPCOMP.OSPCOMP_LE:
          return (ls1.compareTo(ls2) <= 0) ? true : false;
        case OSPCOMP.OSPCOMP_GE:
          return (ls1.compareTo(ls2) >= 0) ? true : false;
        case OSPCOMP.OSPCOMP_GT:
          return (ls1.compareTo(ls2) > 0) ? true : false;
        };
      }
    }
    return false;
  }

HRESULT MyOSPObject::deleteRows | ( | LONG | iRow,
 |  | LONG | cRows,
 |  | LONG * | pcRowsDeleted |
 | ) |  |  | [virtual]

Definition at line 348 of file myospobject.cpp.

{
  LONG    cNewRows, i, j;
  VARIANT** rvNewTable;

  // Doesn't handle label or wildcard rows
  if (iRow <= 0)
    return E_FAIL;

  // InvalidArg
  if (cRows < 0)
    return E_INVALIDARG;

  // Is starting row within range?
  if (iRow > m_cRows)
    return E_INVALIDARG;

  // Adjust row count to stay within range:
  if (iRow + cRows > m_cRows + 1)
    cRows = m_cRows - iRow + 1;

  // Notify our Listeners:
  Notify(DELETEROWS_ABOUTTODO, iRow, -1, cRows);

  // Allocate new array with reduced rows:
  cNewRows = m_cRows - cRows;
  rvNewTable = (VARIANT**)CoTaskMemAlloc((cNewRows+1) * sizeof(VARIANT*));

  j = 0;
  for (i = 0; i <= m_cRows; i++)
  {
    if (i < iRow || i > (iRow + cRows - 1))
      rvNewTable[j++] = m_rvTable[i];   // retain rows
    else
      CoTaskMemFree(m_rvTable[i]);    // free deleted row
  }

  // Free old table, point to new table and adjust count:
  CoTaskMemFree(m_rvTable);
  m_rvTable = rvNewTable;
  m_cRows = cNewRows;

  // Save the internal table to the data file:
  if (m_szFilePath != NULL)
    saveData();

  // Notify our Listeners:
  Notify(DELETEROWS_DIDEVENT, iRow, -1, cRows);

  // Return the count of rows deleted:
  *pcRowsDeleted = cRows;
    return S_OK;
}

int MyOSPObject::deleteRows | ( | int | iRow,
 |  | int | cRows |
 | ) |  |  | throws ComException [inline]

Definition at line 203 of file myospobject.java.

  {
    if (iRow <= 0)
      throw new ComFailException();

    if (cRows < 1)
      throw new ComFailException();

    if (iRow > m_cRows)
      throw new ComFailException();

    // Adjust row count to stay within range:
    if (iRow + cRows > m_cRows + 1)
      cRows = m_cRows - iRow + 1;

    // Create new array with reduced rows; copy over remaining rows:
    int cNewRows = m_cRows - cRows;
    String[][] rsNewTable = new String[cNewRows+1][m_cColumns+1];
    int i, j, k = 0;
    for (i = 0; i <= m_cRows; i++)
    {
      if (i < iRow || i > (iRow + cRows - 1))
      {
        for (j = 1; j <= m_cColumns; j++)
          rsNewTable[k][j] = m_rsTable[i][j];
        k++;
      }
    }

    //  Refer to new table and adjust row count:
    for (Enumeration e = m_vListeners.elements(); e.hasMoreElements(); )
      ((OLEDBSimpleProviderListener)e.nextElement()).aboutToDeleteRows(iRow, cRows);
    m_rsTable = rsNewTable;
    m_cRows = cNewRows;
    saveData();
    for (Enumeration e = m_vListeners.elements(); e.hasMoreElements(); )
      ((OLEDBSimpleProviderListener)e.nextElement()).deletedRows(iRow, cRows);

    // Return the count of rows deleted:
    return cRows;
  }

int MyOSPObject::find | ( | int | iRowStart,
 |  | int | iColumn,
 |  | Object | obj,
 |  | int | findFlags,
 |  | int | compType |
 | ) |  |  | throws ComException [inline]

Definition at line 339 of file myospobject.java.

  {
    // Check arguments:
    if (iRowStart <= 0 || iRowStart > m_cRows)
      throw new ComFailException();
    if (iColumn <= 0 || iColumn > m_cColumns)
      throw new ComFailException();

    // Determine search order:
    int   iRowStop = (findFlags == OSPFIND.OSPFIND_UP) ? 0 : m_cRows+1;
    boolean fCaseSensitive = (compType == OSPFIND.OSPFIND_CASESENSITIVE);

    // Linear search through all rows:
    while (iRowStart != iRowStop)
    {
      if (compareString(m_rsTable[iRowStart][iColumn], (String)obj, fCaseSensitive, findFlags))
        return iRowStart;

      if(findFlags == OSPFIND.OSPFIND_UP)
        iRowStart--;
      else
        iRowStart++;
    }

    return 0;
  }

HRESULT MyOSPObject::find | ( | LONG | iRowStart,
 |  | LONG | iColumn,
 |  | VARIANT | val,
 |  | OSPFIND | findFlags,
 |  | OSPCOMP | compType,
 |  | LONG * | piRowFound |
 | ) |  |  | [virtual]

Definition at line 403 of file myospobject.cpp.

{
  // Check arguments:
  if (piRowFound == NULL)
    return E_INVALIDARG;
  if (iRowStart <= 0 || iRowStart > m_cRows)
    return E_FAIL;
  if (iColumn <= 0 || iColumn > m_cColumns)
    return E_FAIL;

  // Determine search order:
  LONG  iRowStop = (findFlags == OSPFIND_UP || findFlags == OSPFIND_UPCASESENSITIVE) ? 0 : m_cRows+1;
  BOOL  fCaseSensitive = (findFlags == OSPFIND_CASESENSITIVE || findFlags == OSPFIND_UPCASESENSITIVE);

  // Linear search through all rows:
  while (iRowStart != iRowStop)
  {
    LONG iCompVal = CompareVariant(&m_rvTable[iRowStart][iColumn], &val, fCaseSensitive);
    switch(compType)
    {
      case OSPCOMP_EQ:
        if (iCompVal == 0)
        {
          *piRowFound = iRowStart;
          return S_OK;
        }
        break;

      case OSPCOMP_LT:
        if (iCompVal < 0)
        {
          *piRowFound = iRowStart;
          return S_OK;
        }
        break;

      case OSPCOMP_LE:
        if (iCompVal <= 0)
        {
          *piRowFound = iRowStart;
          return S_OK;
        }
        break;

      case OSPCOMP_GE:
        if (iCompVal >= 0)
        {
          *piRowFound = iRowStart;
          return S_OK;
        }
        break;

      case OSPCOMP_GT:
        if (iCompVal > 0)
        {
          *piRowFound = iRowStart;
          return S_OK;
        }
        break;

      case OSPCOMP_NE:
        if (iCompVal != 0)
        {
          *piRowFound = iRowStart;
          return S_OK;
        }
        break;

      default:
        break;
    };

    if (findFlags == OSPFIND_UP || findFlags == OSPFIND_UPCASESENSITIVE)
      iRowStart--;
    else
      iRowStart++;
  }
  *piRowFound = -1;
  return S_FALSE;
}

HRESULT MyOSPObject::getColumnCount ( LONG * pcColumns ) [virtual]

Definition at line 539 of file myospobject.cpp.

{
  if (pcColumns == NULL)
    return E_INVALIDARG;
  *pcColumns = m_cColumns;
  return S_OK;
}

int MyOSPObject::getColumnCount ( ) throws ComException [inline]

Definition at line 245 of file myospobject.java.

  {
    return m_cColumns;
  }

HRESULT MyOSPObject::getEstimatedRows ( LONG * piRows ) [virtual]

Definition at line 548 of file myospobject.cpp.

{
  return getRowCount(piRows);
}

int MyOSPObject::getEstimatedRows ( ) throws ComException [inline]

Definition at line 387 of file myospobject.java.

  {
    return getRowCount();
  }

HRESULT MyOSPObject::getLocale ( BSTR * pbstrLocale ) [virtual]

Definition at line 554 of file myospobject.cpp.

{
  if (pbstrLocale == NULL)
    return E_INVALIDARG;

  // Return default locale:
  TCHAR* pszLocale;
  int cchData = GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_SLANGUAGE, NULL, 0);
  pszLocale = (TCHAR*)CoTaskMemAlloc(cchData * sizeof(TCHAR));
  if (pszLocale)
  {
    BSTR bstr = SysAllocStringLen(NULL, cchData);
    GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_SLANGUAGE, pszLocale, cchData);
#if !defined(_UNICODE)
    bstr = SysAllocStringLen(NULL, cchData);
    mbstowcs(bstr, pszLocale, cchData);
#else
    bstr = SysAllocStringLen(pszLocale, cchData);
#endif
    *pbstrLocale = bstr;
  }
  return S_OK;
}

String MyOSPObject::getLocale ( ) throws ComException [inline]

Definition at line 250 of file myospobject.java.

  {
    Locale lc = Locale.US;
    return lc.getDisplayName(Locale.US);
  }

HRESULT MyOSPObject::getRowCount ( LONG * pcRows ) [virtual]

Definition at line 579 of file myospobject.cpp.

{
  if (pcRows == NULL)
    return E_INVALIDARG;
  *pcRows = m_cRows;
  return S_OK;
}

int MyOSPObject::getRowCount ( ) throws ComException [inline]

Definition at line 256 of file myospobject.java.

  {
    return m_cRows;
  }

HRESULT MyOSPObject::getRWStatus | ( | LONG | iRow,
 |  | LONG | iColumn,
 |  | OSPRW * | prwStatus |
 | ) |  |  | [virtual]

Definition at line 588 of file myospobject.cpp.

{
  if (prwStatus == NULL)
    return E_INVALIDARG;

  // In this sample, column 1 is read-only.  All other columns may be changed:
  if (iColumn == 1)
    *prwStatus = OSPRW_READONLY;
  else
    *prwStatus = OSPRW_READWRITE;

  return S_OK;
}

int MyOSPObject::getRWStatus | ( | int | iRow,
 |  | int | iColumn |
 | ) |  |  | throws ComException [inline]

Definition at line 261 of file myospobject.java.

  {
    if (iColumn == 1)
      return OSPRW.OSPRW_READONLY;
    else
      return OSPRW.OSPRW_READWRITE;
  }

Object MyOSPObject::getVariant | ( | int | iRow,
 |  | int | iColumn,
 |  | int | format |
 | ) |  |  | throws ComException [inline]

Definition at line 269 of file myospobject.java.

  {
    if (iRow < 0 || iColumn < 0 || iRow > m_cRows || iColumn > m_cColumns)
      throw new ComFailException();
    // Allocate a new object because the caller will free it when it wants
    // to:
    String s = new String(m_rsTable[iRow][iColumn]);
    return s;
  }

HRESULT MyOSPObject::getVariant | ( | LONG | iRow,
 |  | LONG | iColumn,
 |  | OSPFORMAT | format,
 |  | VARIANT * | pVar |
 | ) |  |  | [virtual]

Definition at line 603 of file myospobject.cpp.

{
  //INVALIDARG
  if (pVar == NULL)
    return E_INVALIDARG;

  //Doesn't handle wildcards
  if (iRow < 0 || iColumn < 0)
    return E_FAIL;

  //Get Column Value
  VariantCopy(pVar, &m_rvTable[iRow][iColumn]);
  return S_OK;
}

HRESULT MyOSPObject::Init ( WCHAR * pwszFilePath ) [virtual]

Definition at line 69 of file myospobject.cpp.

{
  // Store the name of the data file:
  m_szFilePath = (LPSTR)CoTaskMemAlloc(FILENAME_MAX);
  wcstombs(m_szFilePath, pwszFilePath, FILENAME_MAX);

  // Load the file into a table:
  return loadData();
}

int MyOSPObject::insertRows | ( | int | iRow,
 |  | int | cRows |
 | ) |  |  | throws ComException [inline]

Definition at line 291 of file myospobject.java.

  {
    //  Do not handle label or wildcard rows:
    if (iRow <= 0)
      throw new ComFailException();

    //  Count of rows to insert must be more than 0:
    if (cRows <= 0)
      throw new ComFailException();

    //  If called to insert after the end, adjust to insert at the end:
    if (iRow > m_cRows)
      iRow = m_cRows + 1;

    //  Create new array with additional rows:
    int cNewRows = m_cRows + cRows;
    String[][] rsNewTable = new String[cNewRows+1][m_cColumns+1];
    int i, j, k = 0;
    for (i = 0; i <= cNewRows; i++)
    {
      if (i < iRow || i > (iRow + cRows - 1))
      {
        for (j = 1; j <= m_cColumns; j++)
          rsNewTable[i][j] = m_rsTable[k][j];
        k++;
      }
      else
      {
        for (j = 1; j <= m_cColumns; j++)
        {
          rsNewTable[i][j] = new String("");
        }
      }
    }

    //  Refer to new table and adjust row count:
    for (Enumeration e = m_vListeners.elements(); e.hasMoreElements(); )
      ((OLEDBSimpleProviderListener)e.nextElement()).aboutToInsertRows(iRow, cRows);
    m_rsTable = rsNewTable;
    m_cRows = cNewRows;
    saveData();
    for (Enumeration e = m_vListeners.elements(); e.hasMoreElements(); )
      ((OLEDBSimpleProviderListener)e.nextElement()).insertedRows(iRow, cRows);

    // Return the count of rows inserted::
    return cRows;
  }

HRESULT MyOSPObject::insertRows | ( | LONG | iRow,
 |  | LONG | cRows,
 |  | LONG * | pcRowsInserted |
 | ) |  |  | [virtual]

Definition at line 485 of file myospobject.cpp.

{
  LONG    cNewRows, i, j, k;
  VARIANT** rvNewTable;

  // Doesn't handle label or wildcard rows
  if (iRow <= 0)
    return E_FAIL;

  // InvalidArg
  if (cRows < 0)
    return E_INVALIDARG;

  // If called to insert after the end, adjust to insert at the end:
  if (iRow > m_cRows)
    iRow = m_cRows + 1;

  // Notify our Listeners:
  Notify(INSERTROWS_ABOUTTODO, iRow, -1, cRows);

  // Allocate new array with more rows:
  cNewRows = m_cRows + cRows;
  rvNewTable = (VARIANT**)CoTaskMemAlloc((cNewRows+1) * sizeof(VARIANT*));
  j = 0;
  for (i = 0; i <= cNewRows; i++)
  {
    if (i < iRow || i > (iRow + cRows - 1))
      rvNewTable[i] = m_rvTable[j++];   // retain rows
    else
    {                   // insert new empty row
      rvNewTable[i] = (VARIANT*)CoTaskMemAlloc((m_cColumns+1) * sizeof(VARIANT));
      for (k = 0; k <= m_cColumns; k++) // initialize new columns
        rvNewTable[i][k].vt = VT_NULL;
    }
  }

  // Free old table, point to new table and adjust count:
  CoTaskMemFree(m_rvTable);
  m_rvTable = rvNewTable;
  m_cRows = cNewRows;

  // Save the internal table to the data file:
  if (m_szFilePath != NULL)
    saveData();

  // Notify our Listeners:
  Notify(INSERTROWS_DIDEVENT, iRow, -1, cRows);

  // Return the count of rows inserted:
  *pcRowsInserted = cRows;
  return S_OK;
}

HRESULT MyOSPObject::isAsync ( BOOL * pbAsynch ) [virtual]

Definition at line 619 of file myospobject.cpp.

{
  if(pbAsynch==NULL)
    return E_INVALIDARG;

  *pbAsynch = FALSE;
  return S_OK;
}

int MyOSPObject::isAsync ( ) throws ComException [inline]

Definition at line 380 of file myospobject.java.

  {
    // This function should return TRUE or FALSE.  But the interface definition
    // converts it to "int".  Return the equivalent of 'FALSE":
    return 0;
  }

HRESULT MyOSPObject::loadData ( ) [virtual]

Definition at line 109 of file myospobject.cpp.

{
  ifstream  myOSPFile;
  int     cChar;
  BSTR    pwszSeps;   // separator char in file
  BSTR    pwszBuffer;   // -> wide character buffer
  BSTR    pwszRow;    // -> wide character buffer (position)
  BSTR    pwszToken;
  LPTSTR    pvInput;    // -> input buffer
  LPSTR   pszPos;
  LONG    i, j;

  // Build the internal array by reading the file:
  myOSPFile.open(m_szFilePath, ios::in | ios::nocreate, filebuf::sh_none );
    if (!(myOSPFile.is_open()))
        return E_FAIL;

  // Line 1 contains cRows ; cColumns:
  pvInput = new char[MAX_INPUT_BUFFER ];
  if (NULL == pvInput)
        return E_FAIL;
  myOSPFile.getline(pvInput, MAX_INPUT_BUFFER);
  pszPos = pvInput;
  m_cRows = strtol(pszPos, &pszPos, 10);
  pszPos++; // consume delimiter
  m_cColumns = strtol(pszPos, &pszPos, 10);

  // allocate array of size cRows X cColumns:
  m_rvTable = (VARIANT**)CoTaskMemAlloc((m_cRows+1) * sizeof(VARIANT*));
  for (i = 0; i <= m_cRows; i++)
  {
    m_rvTable[i] = (VARIANT*)CoTaskMemAlloc((m_cColumns+1) * sizeof(VARIANT));
  }

  // read the rest of the file and stuff each line into the next row:
  i = 0;
  j = 0;
  pwszSeps = L";";
  pwszBuffer = (BSTR)CoTaskMemAlloc(MAX_WIDE_BUFFER);
  do
  {
    myOSPFile.getline(pvInput, MAX_INPUT_BUFFER);
    pwszRow = pwszBuffer;
    MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, pvInput, -1, pwszRow,
              MAX_WIDE_BUFFER);
    for (j = 1; j <= m_cColumns; j++)
    {
      if (pwszRow == NULL)
      {
        m_rvTable[i][j].vt = VT_NULL;
        continue;
      }
      cChar = wcscspn(pwszRow, pwszSeps);
      if (cChar)
      {
        pwszToken = wcstok(pwszRow, pwszSeps);
        m_rvTable[i][j].vt = VT_BSTR;
        V_BSTR(&m_rvTable[i][j]) = SysAllocString(pwszToken);
        pwszRow += (cChar+1);
      }
      else
      {
        m_rvTable[i][j].vt = VT_NULL;
        pwszRow += 1;
      }
    }
    i++;
    if (i > m_cRows)
      break;
  }
  while (!(myOSPFile.eof()));

  myOSPFile.close();
  CoTaskMemFree(pwszBuffer);
  return S_OK;
}

void MyOSPObject::loadData ( ) [inline]

Definition at line 54 of file myospobject.java.

  {
    int       i = 0, j = 0, iStart, iEnd;
    BufferedReader  rdr;
    FileReader    frdr;
    Integer     iToken;
    String      s, t;
    StringTokenizer st;

    // Build the internal array by reading the file:
    try
    {
      frdr = new FileReader(m_sFilePath);
      rdr = new BufferedReader(frdr);

      // Line 1 contains cRows ; cColumns
      s = new String(rdr.readLine());
      st = new StringTokenizer(s, ";");
      iToken = new Integer(st.nextToken());
      m_cRows = iToken.intValue();
      iToken = new Integer(st.nextToken());
      m_cColumns = iToken.intValue();

      // Create arrary of size cRows+1 X cColumns+1:
      m_rsTable = new String[m_cRows+1][m_cColumns+1];

      // Read the rest of the file and stuff each line into the next row:
      for (i = 0; i <= m_cRows; i++)
      {
        m_rsTable[i][0] = new String("");
        s = new String(rdr.readLine());
        iStart = 0;
        iEnd = s.indexOf(';');
        j = 1;
        while (iEnd != -1 & j <= m_cColumns)
        {
          t = new String(s.substring(0, iEnd));
          s = new String(s.substring(iEnd+1));
          iEnd = s.indexOf(';');
          //System.out.println("[j = " + j + "]: " + t);
          m_rsTable[i][j] = t;
          j++;
        }
        if (s != "" & j <= m_cColumns)
        {
          m_rsTable[i][j] = s;
          j++;
        }
      }
      rdr.close();
      frdr.close();
    }
    catch(NullPointerException npe)
    {
    }
    catch(Exception e)
    {
      System.out.println(e.toString() + "\n");
      throw new ComFailException();
    }
    return;
  }

static void MyOSPObject::main ( String args[] ) [inline, static]

Definition at line 398 of file myospobject.java.

  {
    // Test code:
    MyOSPObject osp = new MyOSPObject();
    System.out.println("Locale = " + osp.getLocale());
    osp.m_sFilePath = new String("C:\\Customer.txt");
    osp.loadData();
    osp.m_sFilePath = new String("C:\\Savedata.txt");
    Variant var;
    int i = 70, j = 3;
    var = (Variant)osp.getVariant(i, j, 0);
    System.out.println("Column[" + j + "] = {" + var.getString() + "}");
    //osp.deleteRows(1, 1);
    osp.insertRows(89, 1);
    var = null;
    var = (Variant)osp.getVariant(i, j, 0);
    System.out.println("Column[" + j + "] = {" + var.getString() + "}");
    //osp.saveData();
  }

HRESULT MyOSPObject::Notify | ( | EOSPEVENTS | eEvent,
 |  | ULONG | iRow,
 |  | ULONG | iColumn,
 |  | ULONG | cRows |
 | ) |  |  | [virtual]

Definition at line 256 of file myospobject.cpp.

{
  //no-op case
  if(m_listListeners.GetCount()==0)
    return S_OK;

  //obtain first element
  HRESULT hr = S_OK;
  POS pos = m_listListeners.GetHeadPosition();

  //otherwise notify for reason/phase
  switch(eEvent)
  {
    //Multi-Cast
    case CHANGECELL_ABOUTTODO:
      while(pos)
        hr = m_listListeners.GetNext(pos)->aboutToChangeCell(iRow, iColumn);
      break;

    //Multi-Cast
    case CHANGECELL_DIDEVENT:
      while(pos)
        hr = m_listListeners.GetNext(pos)->cellChanged(iRow, iColumn);
      break;

    //Multi-Cast
    case DELETEROWS_ABOUTTODO:
      while(pos)
        hr = m_listListeners.GetNext(pos)->aboutToDeleteRows(iRow, cRows);
      break;

    //Multi-Cast
    case DELETEROWS_DIDEVENT:
      while(pos)
        hr = m_listListeners.GetNext(pos)->deletedRows(iRow, cRows);
      break;

    //Multi-Cast
    case INSERTROWS_ABOUTTODO:
      while(pos)
        hr = m_listListeners.GetNext(pos)->aboutToInsertRows(iRow, cRows);
      break;

    //Multi-Cast
    case INSERTROWS_DIDEVENT:
      while(pos)
        hr = m_listListeners.GetNext(pos)->insertedRows(iRow, cRows);
      break;

    //Multi-Cast
    case ROWSAVAILABLE_DIDEVENT:
      while(pos)
        hr = m_listListeners.GetNext(pos)->rowsAvailable(iRow, cRows);
      break;

    //Multi-Cast
    case TRANSFERCOMPLETE_DIDEVENT:
      while(pos)
        hr = m_listListeners.GetNext(pos)->transferComplete(OSPXFER_COMPLETE);
      break;

    //Multi-Cast
    case TRANSFERCOMPLETE_FAILEDTODO:
      while(pos)
        hr = m_listListeners.GetNext(pos)->transferComplete(OSPXFER_ABORT);
      break;

    default:
      //Unknown event?
      break;
  };

  return hr;
}

HRESULT MyOSPObject::QueryInterface | ( | REFIID | riid,
 |  | void ** | ppv |
 | ) |  |  | [virtual]

Definition at line 80 of file myospobject.cpp.

{
  if (ppv == NULL)
    return E_INVALIDARG;

  // IUnknown:
  if (riid == IID_IUnknown)
    *ppv = this;

  // OLEDBSimpleProvider:
  else if (riid == IID_OLEDBSimpleProvider)
    *ppv = this;

  // Unsupported:
  else
  {
    *ppv = NULL;
    return E_NOINTERFACE;
  }

  SAFE_ADDREF((IUnknown*)*ppv);
  return S_OK;
}

HRESULT MyOSPObject::removeOLEDBSimpleProviderListener ( OLEDBSimpleProviderListener * pospIListener ) [virtual]

Definition at line 629 of file myospobject.cpp.

{
  if(pospIListener==NULL)
    return E_INVALIDARG;

  //Find the Listener in the list:
  POS pos = m_listListeners.Find(pospIListener);
  if (pos == NULL)
    return E_FAIL;

  //Remove the Listener from the list and release it:
  SAFE_RELEASE(pospIListener);
  m_listListeners.RemoveAt(pos);

  return S_OK;
}

void MyOSPObject::removeOLEDBSimpleProviderListener ( OLEDBSimpleProviderListener rListener ) throws ComException [inline]

Definition at line 373 of file myospobject.java.

  {
    // Remove a listener:
    m_vListeners.removeElement(rListener);
    return;
  }

HRESULT MyOSPObject::saveData ( ) [private]

Definition at line 187 of file myospobject.cpp.

{
  HRESULT   hr = S_OK;
  ofstream  myOSPFile;
  int     nCnt;
  BSTR    pbstrCell;
  LONG    i, j;
  LPTSTR    pvOutput;   // -> output buffer

  // Open the file for output:
  myOSPFile.open(m_szFilePath, ios::out | ios::nocreate, filebuf::sh_none);
    if (!(myOSPFile.is_open()))
        return E_FAIL;

  pvOutput = new char[MAX_OUTPUT_BUFFER+1];

  // Write the first line containing "rows ; columns":
  wsprintf(pvOutput, "%li;%li\n", m_cRows, m_cColumns);
  myOSPFile.write(pvOutput, lstrlen(pvOutput));
  myOSPFile.flush();

  // Write the columns of each row on a line:
  for (i = 0; i <= m_cRows && hr == S_OK; i++)
  {
    nCnt = 0;
    for (j = 1; j <= m_cColumns; j++)
    {
      if (m_rvTable[i][j].vt == VT_NULL)
      {
        if ((nCnt + lstrlen(";")) >= MAX_OUTPUT_BUFFER)
        {
          hr = DB_E_DATAOVERFLOW;
          break;
        }
        nCnt += wsprintf(pvOutput+nCnt, ";");
      }
      else
      {
        pbstrCell = V_BSTR(&m_rvTable[i][j]);
        if ((nCnt + SysStringByteLen(pbstrCell)) >= MAX_OUTPUT_BUFFER)
        {
          hr = DB_E_DATAOVERFLOW;
          break;
        }
        nCnt += wsprintf(pvOutput+nCnt, "%ws;", pbstrCell);
      }
    }
    if ((nCnt + lstrlen("\n")) >= MAX_OUTPUT_BUFFER)
    {
      hr = DB_E_DATAOVERFLOW;
      break;
    }
    nCnt += wsprintf(pvOutput+nCnt, "\n");
    myOSPFile.write(pvOutput, nCnt);
    myOSPFile.flush();
  }

  // close the file
  myOSPFile.close();
  delete pvOutput;

  return hr;
}

void MyOSPObject::saveData ( ) [inline]

Definition at line 117 of file myospobject.java.

  {
    int       i = 0, j = 0;
    BufferedWriter  bwtr = null;
    FileWriter    fwtr = null;
    PrintWriter   pwtr = null;

    try
    {
      // Prepare the file for output:
      fwtr = new FileWriter(m_sFilePath);
      bwtr = new BufferedWriter(fwtr);
      pwtr = new PrintWriter(bwtr);

      // Write out the first line
      pwtr.println(m_cRows + ";" + m_cColumns);

      // Write the columns of each row on a line:
      for (i = 0; i <= m_cRows; i++)
      {
        for (j = 1; j <= m_cColumns; j++)
        {
          if (m_rsTable[i][j].equals(""))
            pwtr.print(';');
          else
              pwtr.print(m_rsTable[i][j] + ';');
        }
        pwtr.println();
      }

      // Close the Writers:
      pwtr.close();
    }
    catch(Exception e)
    {
      pwtr.close();
      System.out.println("Error in saveData() when i = " + i + ", j = " + j);
      System.out.println(e.toString() + "\n");
      throw new ComFailException();
    }
  }

void MyOSPObject::setFile ( String sFilePath ) [inline]

Definition at line 49 of file myospobject.java.

  {
    m_sFilePath = sFilePath;
  }

void MyOSPObject::setVariant | ( | int | iRow,
 |  | int | iColumn,
 |  | int | format,
 |  | Object | obj |
 | ) |  |  | throws ComException [inline]

Definition at line 279 of file myospobject.java.

  {
    if (iRow < 0 || iColumn < 0)
      throw new ComFailException();
    for (Enumeration e = m_vListeners.elements(); e.hasMoreElements(); )
      ((OLEDBSimpleProviderListener)e.nextElement()).aboutToChangeCell(iRow, iColumn);
    m_rsTable[iRow][iColumn] = (String)obj;
    saveData();
    for (Enumeration e = m_vListeners.elements(); e.hasMoreElements(); )
      ((OLEDBSimpleProviderListener)e.nextElement()).cellChanged(iRow, iColumn);
  }

HRESULT MyOSPObject::setVariant | ( | LONG | iRow,
 |  | LONG | iColumn,
 |  | OSPFORMAT | format,
 |  | VARIANT | Var |
 | ) |  |  | [virtual]

Definition at line 646 of file myospobject.cpp.

{
  // Doesn't handle wildcards
  if (iRow < 0 || iColumn < 0)
    return E_FAIL;

  // Notify our Listeners:
  Notify(CHANGECELL_ABOUTTODO, iRow, iColumn, 1);

  // Set Column Value
  VariantCopy(&m_rvTable[iRow][iColumn], &Var);

  // Save the internal table to the data file:
  if (m_szFilePath != NULL)
    saveData();

  // Notify our Listeners:
  Notify(CHANGECELL_DIDEVENT, iRow, iColumn, 1);

  return S_OK;
}

virtual MyOSPObject::STDMETHODIMP_ ( ULONG ) [inline, virtual]

Definition at line 63 of file myospobject.h.

  {
    if(InterlockedDecrement((LONG*)&m_cRef))
      return m_cRef;

    delete this;
    return 0;
  }

virtual MyOSPObject::STDMETHODIMP_ ( ULONG ) [inline, virtual]

Definition at line 58 of file myospobject.h.

  {
    InterlockedIncrement((LONG*)&m_cRef);
    return m_cRef;
  }

void MyOSPObject::stopTransfer ( ) throws ComException [inline]

Definition at line 392 of file myospobject.java.

  {
    // Do nothing in this simple example.
    return;
  }

HRESULT MyOSPObject::stopTransfer ( ) [virtual]

Definition at line 669 of file myospobject.cpp.

{
  // Do nothing because we are already populated
  return S_OK;
}

Member Data Documentation

LONG MyOSPObject::m_cColumns [protected]

Definition at line 102 of file myospobject.h.

int MyOSPObject::m_cColumns [package]

Definition at line 31 of file myospobject.java.

ULONG MyOSPObject::m_cRef [protected]

Definition at line 107 of file myospobject.h.

LONG MyOSPObject::m_cRows [protected]

Definition at line 101 of file myospobject.h.

int MyOSPObject::m_cRows [package]

Definition at line 30 of file myospobject.java.

CExList<OLEDBSimpleProviderListener*> MyOSPObject::m_listListeners [protected]

Definition at line 104 of file myospobject.h.

String [][] MyOSPObject::m_rsTable [package]

Definition at line 34 of file myospobject.java.

VARIANT** MyOSPObject::m_rvTable [protected]

Definition at line 100 of file myospobject.h.

String MyOSPObject::m_sFilePath [package]

Definition at line 32 of file myospobject.java.

LPSTR MyOSPObject::m_szFilePath [protected]

Definition at line 103 of file myospobject.h.

Vector MyOSPObject::m_vListeners [package]

Definition at line 33 of file myospobject.java.

The documentation for this class was generated from the following files:
  • Dataaccess/osp/vc/myospobject.h
  • Dataaccess/osp/vj/myospobject.java
  • Dataaccess/osp/vc/myospobject.cpp
Generated on Wed Nov 13 2024 16:57:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: MyStorageResourceLib::CEnumStorageResource Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • MyStorageResourceLib
  • MyStorageResourceLib::CEnumStorageResource

MyStorageResourceLib::CEnumStorageResource Class Reference

import "MyStorageResource.idl";

Detailed Description

Definition at line 142 of file MyStorageResource.idl.

The documentation for this class was generated from the following file:
  • WinBase/Cluster/Win2003/MyStorageResource/MyStorageResource.idl
Generated on Wed Nov 13 2024 16:58:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: MyStorageResourceLib::CPartitionInfo Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • MyStorageResourceLib
  • MyStorageResourceLib::CPartitionInfo

MyStorageResourceLib::CPartitionInfo Class Reference

import "MyStorageResource.idl";

Detailed Description

Definition at line 181 of file MyStorageResource.idl.

The documentation for this class was generated from the following file:
  • WinBase/Cluster/Win2003/MyStorageResource/MyStorageResource.idl
Generated on Wed Nov 13 2024 16:58:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: MyStorageResourceLib::CStorageResource Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • MyStorageResourceLib
  • MyStorageResourceLib::CStorageResource

MyStorageResourceLib::CStorageResource Class Reference

import "MyStorageResource.idl";

Detailed Description

Definition at line 153 of file MyStorageResource.idl.

The documentation for this class was generated from the following file:
  • WinBase/Cluster/Win2003/MyStorageResource/MyStorageResource.idl
Generated on Wed Nov 13 2024 16:58:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: MyStorageResourceLib::CStorageResType Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • MyStorageResourceLib
  • MyStorageResourceLib::CStorageResType

MyStorageResourceLib::CStorageResType Class Reference

import "MyStorageResource.idl";

Detailed Description

Definition at line 170 of file MyStorageResource.idl.

The documentation for this class was generated from the following file:
  • WinBase/Cluster/Win2003/MyStorageResource/MyStorageResource.idl
Generated on Wed Nov 13 2024 16:58:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: MyString Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

MyString Class Reference

#include "UtilLib.h"

List of all members.

Public Member Functions

MyString ()
~MyString ()
void | Empty ()
WCHAR * | GetCloneString ()
WCHAR * | GetString ()
const MyString & | operator+= (const WCHAR *arg1)

Private Attributes

WCHAR * | pwszString

Detailed Description

Definition at line 63 of file UtilLib.h.

Constructor & Destructor Documentation

MyString::MyString ( ) [inline]

Definition at line 68 of file UtilLib.h.

   {
     pwszString = (WCHAR *)calloc(1, sizeof(WCHAR));
   }

MyString::~MyString ( ) [inline]

Definition at line 72 of file UtilLib.h.

   {
     free(pwszString);
   }

Member Function Documentation

void MyString::Empty ( ) [inline]

Definition at line 77 of file UtilLib.h.

{free(pwszString);pwszString = (WCHAR *)calloc(1, sizeof(WCHAR));}

WCHAR* MyString::GetCloneString ( ) [inline]

Definition at line 78 of file UtilLib.h.

   {
      WCHAR *buf = NULL;
    if (pwszString)
    {
      int ibufSize = (wcslen(pwszString) + 1) * sizeof(WCHAR);
      buf = (WCHAR *)malloc(ibufSize);
      if (buf)
      StringCbCopyW(buf, ibufSize, pwszString);
    }
      return buf;
   }

WCHAR* MyString::GetString ( ) [inline]

Definition at line 76 of file UtilLib.h.

{return pwszString;}

const MyString& MyString::operator+= ( const WCHAR * arg1 ) [inline]

Definition at line 90 of file UtilLib.h.

      {
         size_t iHave;
         size_t iNeed;
         if (arg1)
         {
             iHave = wcslen(pwszString);
             iNeed = wcslen(arg1);
             pwszString = (WCHAR *)realloc(pwszString, (iHave + iNeed + 1) * sizeof(WCHAR));
       if (pwszString)
       {
        StringCbCatW(&pwszString[iHave],
              ((iHave + iNeed + 1) * sizeof(WCHAR)) - iHave,
              arg1);
       }
         }
         return *this;
      }

Member Data Documentation

WCHAR* MyString::pwszString [private]

Definition at line 65 of file UtilLib.h.

The documentation for this class was generated from the following file:
  • SysMgmt/WMI/VC/UtilLib/UtilLib.h
Generated on Wed Nov 13 2024 16:57:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: MYTOOLINFO Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

MYTOOLINFO Struct Reference

#include "Tools.h"

List of all members.

Public Attributes

BYTE | bState
BYTE | bStyle
UINT idCommand
int | idString
int | iImage
UINT uImageSet

Detailed Description

Definition at line 28 of file Tools.h.

Member Data Documentation

BYTE MYTOOLINFO::bState

Definition at line 34 of file Tools.h.

BYTE MYTOOLINFO::bStyle

Definition at line 35 of file Tools.h.

UINT MYTOOLINFO::idCommand

Definition at line 31 of file Tools.h.

int MYTOOLINFO::idString

Definition at line 33 of file Tools.h.

int MYTOOLINFO::iImage

Definition at line 32 of file Tools.h.

UINT MYTOOLINFO::uImageSet

Definition at line 30 of file Tools.h.

The documentation for this struct was generated from the following file:
  • WinUI/Shell/SampView/Tools.h
Generated on Wed Nov 13 2024 16:57:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NewDocDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Types | Public Member Functions | Public Attributes | Protected Member Functions

NewDocDlg Class Reference

#include "NewDocDlg.h"

List of all members.

Public Types

enum | { IDD = IDD_NEWDIALOG }

Public Member Functions

NewDocDlg (CWnd *pParent=NULL)

Public Attributes

int | m_polytype
CString m_szText

Protected Member Functions

virtual void | DoDataExchange (CDataExchange *pDX)

Detailed Description

Definition at line 13 of file NewDocDlg.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
IDD

Definition at line 21 of file NewDocDlg.h.

{ IDD = IDD_NEWDIALOG };

Constructor & Destructor Documentation

NewDocDlg::NewDocDlg ( CWnd * pParent = NULL )

Definition at line 18 of file NewDocDlg.Cpp.

  : CDialog(NewDocDlg::IDD, pParent)
{
  //{{AFX_DATA_INIT(NewDocDlg)
  m_szText = _T("");
  m_polytype = -1;
  //}}AFX_DATA_INIT
}

Member Function Documentation

void NewDocDlg::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 28 of file NewDocDlg.Cpp.

{
  CDialog::DoDataExchange(pDX);
  //{{AFX_DATA_MAP(NewDocDlg)
  DDX_Text(pDX, IDC_EDIT1, m_szText);
  DDX_Radio(pDX, IDC_CIRCLE, m_polytype);
  //}}AFX_DATA_MAP
}

Member Data Documentation

int NewDocDlg::m_polytype

Definition at line 23 of file NewDocDlg.h.

CString NewDocDlg::m_szText

Definition at line 22 of file NewDocDlg.h.

The documentation for this class was generated from the following files:
  • NetDS/fax/PrintSdi/NewDocDlg.h
  • NetDS/fax/PrintSdi/NewDocDlg.Cpp
Generated on Wed Nov 13 2024 16:57:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: newseventclass::INewsEvent Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • newseventclass
  • newseventclass::INewsEvent
Public Member Functions | Static Public Attributes

newseventclass::INewsEvent Interface Reference

.interface(iid=4BF5E480-A5D3-11D2-AD4D-0080C7BFF6DB, thread=AUTO, type=DUAL)

Inherits com::ms::com::IUnknown.

Inherited by newseventclass::INewsEventDefault.

List of all members.

Public Member Functions

void | LongQuote (String Symbol, double BidPrice, double AskPrice, String LastTradeTime, double LastTradePrice, double NetChange, double DailyHigh, double DailyLow, int AskSize, int BidSize, double OpenPrice, double ClosePrice, String CloseDate)
void | NewsFlash (double dtTimeStamp, String Symbol, String Headline, String URL)
void | ShortQuote (String Symbol, double BidPrice, double AskPrice, double LastTradeTime, double LastTradePrice, double NetChange, double DailyHigh, double DailyLow)

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x4bf5e480, (short)0xa5d3, (short)0x11d2, (byte)0xad, (byte)0x4d, (byte)0x0, (byte)0x80, (byte)0xc7, (byte)0xbf, (byte)0xf6, (byte)0xdb)

Detailed Description

Definition at line 20 of file INewsEvent.java.

Member Function Documentation

void newseventclass::INewsEvent::LongQuote | ( | String | Symbol,
 |  | double | BidPrice,
 |  | double | AskPrice,
 |  | String | LastTradeTime,
 |  | double | LastTradePrice,
 |  | double | NetChange,
 |  | double | DailyHigh,
 |  | double | DailyLow,
 |  | int | AskSize,
 |  | int | BidSize,
 |  | double | OpenPrice,
 |  | double | ClosePrice,
 |  | String | CloseDate
 | ) |  |

.method(vtoffset=6, dispid=3, type=METHOD, name="LongQuote", addFlagsVtable=4) .parameters([in,type=STRING] Symbol, [in,type=R8] BidPrice, [in,type=R8] AskPrice, [in,type=STRING] LastTradeTime, [in,type=R8] LastTradePrice, [in,type=R8] NetChange, [in,type=R8] DailyHigh, [in,type=R8] DailyLow, [in,type=I4] AskSize, [in,type=I4] BidSize, [in,type=R8] OpenPrice, [in,type=R8] ClosePrice, [in,type=STRING] CloseDate)

Implemented in newseventclass::INewsEventDefault, and newseventclass::NewsEvent.

void newseventclass::INewsEvent::NewsFlash | ( | double | dtTimeStamp,
 |  | String | Symbol,
 |  | String | Headline,
 |  | String | URL
 | ) |  |

.method(vtoffset=4, dispid=1, type=METHOD, name="NewsFlash", addFlagsVtable=4) .parameters([in,type=DATE] dtTimeStamp, [in,type=STRING] Symbol, [in,type=STRING] Headline, [in,type=STRING] URL)

Implemented in newseventclass::INewsEventDefault, and newseventclass::NewsEvent.

void newseventclass::INewsEvent::ShortQuote | ( | String | Symbol,
 |  | double | BidPrice,
 |  | double | AskPrice,
 |  | double | LastTradeTime,
 |  | double | LastTradePrice,
 |  | double | NetChange,
 |  | double | DailyHigh,
 |  | double | DailyLow
 | ) |  |

.method(vtoffset=5, dispid=2, type=METHOD, name="ShortQuote", addFlagsVtable=4) .parameters([in,type=STRING] Symbol, [in,type=R8] BidPrice, [in,type=R8] AskPrice, [in,type=DATE] LastTradeTime, [in,type=R8] LastTradePrice, [in,type=R8] NetChange, [in,type=R8] DailyHigh, [in,type=R8] DailyLow)

Implemented in newseventclass::INewsEventDefault, and newseventclass::NewsEvent.

Member Data Documentation

final com.ms.com._Guid newseventclass::INewsEvent::iid = new com.ms.com._Guid((int)0x4bf5e480, (short)0xa5d3, (short)0x11d2, (byte)0xad, (byte)0x4d, (byte)0x0, (byte)0x80, (byte)0xc7, (byte)0xbf, (byte)0xf6, (byte)0xdb) [static]

Implemented in newseventclass::INewsEventDefault.

Definition at line 35 of file INewsEvent.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Events/EventNewsJAVA/NewsEvent/newsEventClass/INewsEvent.java
Generated on Wed Nov 13 2024 16:58:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: newseventclass::INewsEventDefault Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • newseventclass
  • newseventclass::INewsEventDefault
Public Member Functions | Static Public Attributes

newseventclass::INewsEventDefault Interface Reference

.interface(iid=00020400-0000-0000-C000-000000000046, thread=AUTO, type=DUAL)

Inherits newseventclass::INewsEvent.

Inherited by newseventclass::NewsEvent.

List of all members.

Public Member Functions

void | LongQuote (String Symbol, double BidPrice, double AskPrice, String LastTradeTime, double LastTradePrice, double NetChange, double DailyHigh, double DailyLow, int AskSize, int BidSize, double OpenPrice, double ClosePrice, String CloseDate)
void | NewsFlash (double dtTimeStamp, String Symbol, String Headline, String URL)
void | ShortQuote (String Symbol, double BidPrice, double AskPrice, double LastTradeTime, double LastTradePrice, double NetChange, double DailyHigh, double DailyLow)

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x20400, (short)0x0, (short)0x0, (byte)0xc0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x46)

Detailed Description

Definition at line 20 of file INewsEventDefault.java.

Member Function Documentation

void newseventclass::INewsEventDefault::LongQuote | ( | String | Symbol,
 |  | double | BidPrice,
 |  | double | AskPrice,
 |  | String | LastTradeTime,
 |  | double | LastTradePrice,
 |  | double | NetChange,
 |  | double | DailyHigh,
 |  | double | DailyLow,
 |  | int | AskSize,
 |  | int | BidSize,
 |  | double | OpenPrice,
 |  | double | ClosePrice,
 |  | String | CloseDate
 | ) |  |

.method(vtoffset=6, dispid=3, type=METHOD, name="LongQuote", addFlagsVtable=4) .parameters([in,type=STRING] Symbol, [in,type=R8] BidPrice, [in,type=R8] AskPrice, [in,type=STRING] LastTradeTime, [in,type=R8] LastTradePrice, [in,type=R8] NetChange, [in,type=R8] DailyHigh, [in,type=R8] DailyLow, [in,type=I4] AskSize, [in,type=I4] BidSize, [in,type=R8] OpenPrice, [in,type=R8] ClosePrice, [in,type=STRING] CloseDate)

Implements newseventclass::INewsEvent.

Implemented in newseventclass::NewsEvent.

void newseventclass::INewsEventDefault::NewsFlash | ( | double | dtTimeStamp,
 |  | String | Symbol,
 |  | String | Headline,
 |  | String | URL
 | ) |  |

.method(vtoffset=4, dispid=1, type=METHOD, name="NewsFlash", addFlagsVtable=4) .parameters([in,type=DATE] dtTimeStamp, [in,type=STRING] Symbol, [in,type=STRING] Headline, [in,type=STRING] URL)

Implements newseventclass::INewsEvent.

Implemented in newseventclass::NewsEvent.

void newseventclass::INewsEventDefault::ShortQuote | ( | String | Symbol,
 |  | double | BidPrice,
 |  | double | AskPrice,
 |  | double | LastTradeTime,
 |  | double | LastTradePrice,
 |  | double | NetChange,
 |  | double | DailyHigh,
 |  | double | DailyLow
 | ) |  |

.method(vtoffset=5, dispid=2, type=METHOD, name="ShortQuote", addFlagsVtable=4) .parameters([in,type=STRING] Symbol, [in,type=R8] BidPrice, [in,type=R8] AskPrice, [in,type=DATE] LastTradeTime, [in,type=R8] LastTradePrice, [in,type=R8] NetChange, [in,type=R8] DailyHigh, [in,type=R8] DailyLow)

Implements newseventclass::INewsEvent.

Implemented in newseventclass::NewsEvent.

Member Data Documentation

final com.ms.com._Guid newseventclass::INewsEventDefault::iid = new com.ms.com._Guid((int)0x20400, (short)0x0, (short)0x0, (byte)0xc0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x46) [static]

Implements newseventclass::INewsEvent.

Definition at line 35 of file INewsEventDefault.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Events/EventNewsJAVA/NewsEvent/newsEventClass/INewsEventDefault.java
Generated on Wed Nov 13 2024 16:58:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: newseventclass::NewsEvent Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • newseventclass
  • newseventclass::NewsEvent
Public Member Functions

newseventclass::NewsEvent Class Reference

.register(clsid=997FF9C0-0F01-11D3-9257-0080C7C30D72, typelib=94007C90-0F00-11D3-9257-0080C7C30D72, version="1.0", description="NewsEvent Class")

Inherits com::ms::com::IUnknown, and newseventclass::INewsEventDefault.

List of all members.

Public Member Functions

void | LongQuote (String Symbol, double BidPrice, double AskPrice, String LastTradeTime, double LastTradePrice, double NetChange, double DailyHigh, double DailyLow, int AskSize, int BidSize, double OpenPrice, double ClosePrice, String CloseDate)
void | NewsFlash (double dtTimeStamp, String Symbol, String Headline, String URL)
void | ShortQuote (String Symbol, double BidPrice, double AskPrice, double LastTradeTime, double LastTradePrice, double NetChange, double DailyHigh, double DailyLow)

Detailed Description

Definition at line 19 of file NewsEvent.java.

Member Function Documentation

void newseventclass::NewsEvent::LongQuote | ( | String | Symbol,
 |  | double | BidPrice,
 |  | double | AskPrice,
 |  | String | LastTradeTime,
 |  | double | LastTradePrice,
 |  | double | NetChange,
 |  | double | DailyHigh,
 |  | double | DailyLow,
 |  | int | AskSize,
 |  | int | BidSize,
 |  | double | OpenPrice,
 |  | double | ClosePrice,
 |  | String | CloseDate |
 | ) |  |  | [inline]

Implements newseventclass::INewsEventDefault.

Definition at line 29 of file NewsEvent.java.

  {
  }

void newseventclass::NewsEvent::NewsFlash | ( | double | dtTimeStamp,
 |  | String | Symbol,
 |  | String | Headline,
 |  | String | URL |
 | ) |  |  | [inline]

Implements newseventclass::INewsEventDefault.

Definition at line 21 of file NewsEvent.java.

  {
  }

void newseventclass::NewsEvent::ShortQuote | ( | String | Symbol,
 |  | double | BidPrice,
 |  | double | AskPrice,
 |  | double | LastTradeTime,
 |  | double | LastTradePrice,
 |  | double | NetChange,
 |  | double | DailyHigh,
 |  | double | DailyLow |
 | ) |  |  | [inline]

Implements newseventclass::INewsEventDefault.

Definition at line 25 of file NewsEvent.java.

  {
  }

The documentation for this class was generated from the following file:
  • Com/Services/Events/EventNewsJAVA/NewsEvent/newsEventClass/NewsEvent.java
Generated on Wed Nov 13 2024 16:58:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NewsFlash Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Package Attributes | Private Member Functions

NewsFlash Class Reference

This class can take a variable number of parameters on the command line. More...

List of all members.

Public Member Functions

NewsFlash ()
void | dispose ()

Static Public Member Functions

static void | main (String args[])

Package Attributes

comadmin.ICOMAdminCatalog | admin = null
Container | components = new Container()
Edit | ecDllNameFT = new Edit()
Label | ecDllNameLabel = new Label()
Label | headlineLabel = new Label()
Edit | headlineTF = new Edit()
GroupBox | InstallEventBorder = new GroupBox()
Button | installEventButton = new Button()
CheckBox | parallelCB = new CheckBox()
Button | publishButton = new Button()
GroupBox | PublishEventBorder = new GroupBox()
CheckBox | queuedCB = new CheckBox()
Label | symbolLabel = new Label()
Edit | symbolTF = new Edit()
Label | urlLabel = new Label()
Edit | urlTF = new Edit()

Private Member Functions

void | checkForAppAlreadyInstalled (comadmin.ICatalogCollection appCollec)
void | checkForApplication (comadmin.ICatalogCollection appCollec, boolean processFlag)
void | checkForComponent (comadmin.ICatalogCollection compCollec, boolean processFlag)
void | initAdminCatlog ()
void | initForm ()
void | installEventButton_click (Object source, Event e)
void | publishButton_click (Object source, Event e)
void | updateCollections (boolean processFlag)

Detailed Description

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.

Definition at line 13 of file NewsFlash.java.

Constructor & Destructor Documentation

NewsFlash::NewsFlash ( ) [inline]

Definition at line 17 of file NewsFlash.java.

  {
    // Required for Visual J++ Form Designer support
    initForm();
    ecDllNameFT.setText(helper.sampleConstants.NEW_EVENT_DLL);
    initAdminCatlog();
  }

Member Function Documentation

void NewsFlash::checkForAppAlreadyInstalled ( comadmin.ICatalogCollection appCollec ) [inline, private]

Check if application is already present.

Parameters:
appCollec Collection of Applications.
Returns:
---
See also:
ComAdmin.IComAdminCatalog, ComAdmin.ICatalogCollection, ComAdmin.ICatalogObject

Definition at line 204 of file NewsFlash.java.

  {

    int     index   = 0;

    appCollec.Populate();
    for(index = 0; index < appCollec.getCount(); index++)
    {
      Variant v = (((comadmin.ICatalogObject)(appCollec.getItem(index))).getName());
      if((v.toString()).equals(helper.sampleConstants.PUBLISHER_NAME))
      {
        // If application already present then remove the application from the catalog.
        appCollec.Remove(index);
        appCollec.SaveChanges();
        break;
      }
    }

  }

void NewsFlash::checkForApplication | ( | comadmin.ICatalogCollection | appCollec,
 |  | boolean | processFlag |
 | ) |  |  | [inline, private]

Check for whether the given application name is present or not.

Parameters:
appCollec | Collection of Applications
processFlag | The flag specify whether the object in the collection is required to be added or removed.
Returns:
---
See also:
ComAdmin.IComAdminCatalog , ComAdmin.ICatalogCollection, ComAdmin.ICatalogObject

Definition at line 106 of file NewsFlash.java.

  {
    int               index   = 0;
    comadmin.ICatalogCollection   compCollec  = null;

    for(index = 0; index < appCollec.getCount(); index++)
    {
       // Checking for Publisher Application in the collection
      if(((((comadmin.ICatalogCollection)(appCollec.getItem(index))).getName()).toString()).equals(helper.sampleConstants.PUBLISHER_NAME))
      {
        // If the application is present get the collection of components in the application.
        compCollec  =(comadmin.ICatalogCollection)(appCollec.GetCollection("Components",((comadmin.ICatalogObject)(appCollec.getItem(index))).getKey()));
        compCollec.Populate();
        checkForComponent(compCollec , processFlag);
        break;
      }
    }
  }

void NewsFlash::checkForComponent | ( | comadmin.ICatalogCollection | compCollec,
 |  | boolean | processFlag |
 | ) |  |  | [inline, private]

Check for whether the given component name is present or not in application.

Parameters:
compCollec | Collection of Components in Application
processFlag | The flag specify whether the object in the collection is required to be added or removed.
Returns:
---
See also:
ComAdmin.IComAdminCatalog, ComAdmin.ICatalogCollection, ComAdmin.ICatalogObject

Definition at line 133 of file NewsFlash.java.

  {
    int               index   = 0;
    comadmin.ICatalogObject     catalogObj  = null;

    for(index = 0 ;index < compCollec.getCount(); index++)
    {
       //Checking for Event component in the collection
      if(((((comadmin.ICatalogObject)(compCollec.getItem(index))).getName()).toString()).equals(helper.sampleConstants.EVENT_NAME))
      {
        //Checking if event is required to be fired in parallel
        if(processFlag == helper.sampleConstants.PARALLEL_FLAG)
        {
          catalogObj = (comadmin.ICatalogObject)(compCollec.getItem(index));
          catalogObj.setValue("FireInParallel",new Variant(true));
          compCollec.SaveChanges();
          installEventButton.setText("Uninstall");
        }
        else
        {
          compCollec.Remove(index);
          compCollec.SaveChanges();
          installEventButton.setText("Install");
        }
        break;
      }
    }
  }

void NewsFlash::dispose ( ) [inline]

NewsFlash overrides dispose so it can clean up the component list.

Definition at line 29 of file NewsFlash.java.

  {
    super.dispose();
    components.dispose();
  }

void NewsFlash::initAdminCatlog ( ) [inline, private]

Initialize the admin catalog.

Parameters:
---
Returns:
---
See also:
ComAdmin.IComAdminCatalog, ComAdmin.ICatalogCollection, ComAdmin.ICatalogObject

Definition at line 169 of file NewsFlash.java.

  {
    comadmin.ICatalogCollection appCollec = null;
    comadmin.ICatalogObject   catalogObj  = null;

    try
    {
      admin   = (comadmin.ICOMAdminCatalog)new comadmin.COMAdminCatalog();
      appCollec = (comadmin.ICatalogCollection)(admin.GetCollection("Applications"));
      // Checking if application already present.
      checkForAppAlreadyInstalled(appCollec);
      //Setting the catalog properties
      catalogObj  = (comadmin.ICatalogObject)(appCollec.Add());
      catalogObj.setValue("Name" , new Variant(helper.sampleConstants.PUBLISHER_NAME));
      catalogObj.setValue("Activation" , new Variant(1));
      //catalogObj.setValue("QueuingEnabled" ,new  Variant(1));
      //catalogObj.setValue("QueueListenerEnabled",new Variant(1));
      catalogObj.setValue("Authentication", new Variant(1));
      appCollec.SaveChanges();
    }
    catch(com.ms.com.ComException exp)
    {
      int hr = exp.getHResult();
      System.out.println(exp);
    }

  }

void NewsFlash::initForm ( ) [inline, private]

Definition at line 245 of file NewsFlash.java.

  {
    this.setText("NewsFlash");
    this.setAutoScaleBaseSize(new Point(5, 13));
    this.setClientSize(new Point(555, 430));

    PublishEventBorder.setLocation(new Point(24, 24));
    PublishEventBorder.setSize(new Point(408, 184));
    PublishEventBorder.setTabIndex(0);
    PublishEventBorder.setTabStop(false);
    PublishEventBorder.setText("Publish News Event");

    InstallEventBorder.setLocation(new Point(24, 224));
    InstallEventBorder.setSize(new Point(408, 176));
    InstallEventBorder.setTabIndex(1);
    InstallEventBorder.setTabStop(false);
    InstallEventBorder.setText("Instal Event");

    publishButton.setLocation(new Point(24, 32));
    publishButton.setSize(new Point(112, 32));
    publishButton.setTabIndex(0);
    publishButton.setText("Publish");
    publishButton.addOnClick(new EventHandler(this.publishButton_click));

    installEventButton.setLocation(new Point(24, 32));
    installEventButton.setSize(new Point(112, 32));
    installEventButton.setTabIndex(0);
    installEventButton.setText("Install");
    installEventButton.addOnClick(new EventHandler(this.installEventButton_click));

    symbolLabel.setLocation(new Point(152, 32));
    symbolLabel.setSize(new Point(80, 20));
    symbolLabel.setTabIndex(1);
    symbolLabel.setTabStop(false);
    symbolLabel.setText("Symbol");

    urlLabel.setLocation(new Point(152, 136));
    urlLabel.setSize(new Point(80, 20));
    urlLabel.setTabIndex(3);
    urlLabel.setTabStop(false);
    urlLabel.setText("URL");

    headlineLabel.setLocation(new Point(152, 88));
    headlineLabel.setSize(new Point(80, 20));
    headlineLabel.setTabIndex(2);
    headlineLabel.setTabStop(false);
    headlineLabel.setText("Headline");

    symbolTF.setLocation(new Point(256, 32));
    symbolTF.setSize(new Point(144, 20));
    symbolTF.setTabIndex(4);
    symbolTF.setText("");

    headlineTF.setLocation(new Point(256, 88));
    headlineTF.setSize(new Point(144, 20));
    headlineTF.setTabIndex(5);
    headlineTF.setText("");

    queuedCB.setLocation(new Point(24, 136));
    queuedCB.setSize(new Point(104, 16));
    queuedCB.setTabIndex(6);
    queuedCB.setText("Queued");

    urlTF.setLocation(new Point(256, 136));
    urlTF.setSize(new Point(144, 20));
    urlTF.setTabIndex(7);
    urlTF.setText("");

    parallelCB.setLocation(new Point(24, 120));
    parallelCB.setSize(new Point(120, 24));
    parallelCB.setTabIndex(1);
    parallelCB.setText("Parallel");

    ecDllNameLabel.setLocation(new Point(152, 40));
    ecDllNameLabel.setSize(new Point(96, 24));
    ecDllNameLabel.setTabIndex(2);
    ecDllNameLabel.setTabStop(false);
    ecDllNameLabel.setText("EC DLL Path");

    ecDllNameFT.setLocation(new Point(256, 40));
    ecDllNameFT.setSize(new Point(144, 20));
    ecDllNameFT.setTabIndex(3);
    ecDllNameFT.setText("");

    this.setNewControls(new Control[] {
              InstallEventBorder,
              PublishEventBorder});
    PublishEventBorder.setNewControls(new Control[] {
                      urlTF,
                      queuedCB,
                      headlineTF,
                      symbolTF,
                      urlLabel,
                      headlineLabel,
                      symbolLabel,
                      publishButton});
    InstallEventBorder.setNewControls(new Control[] {
                      ecDllNameFT,
                      ecDllNameLabel,
                      parallelCB,
                      installEventButton});
  }

void NewsFlash::installEventButton_click | ( | Object | source,
 |  | Event | e |
 | ) |  |  | [inline, private]

Install event class.

Parameters:
---
Returns:
---
See also:
ComAdmin.IComAdminCatalog

Definition at line 62 of file NewsFlash.java.

  {
    if((installEventButton.getText()).equals("Install"))
    {
      String ecName = ecDllNameFT.getText();
      //Install Event Class.
      admin.InstallEventClass(helper.sampleConstants.PUBLISHER_NAME,ecDllNameFT.getText(),"" , "");
      if(parallelCB.getChecked())
      {
        updateCollections(helper.sampleConstants.PARALLEL_FLAG);
      }
      installEventButton.setText("Uninstall");

    }
    else //Uninstall the event class.
    {
      updateCollections(helper.sampleConstants.UNINSTALL_FLAG);
      installEventButton.setText("Install");
    }
  }

static void NewsFlash::main ( String args[] ) [inline, static]

The main entry point for the application.

Parameters:
args Array of parameters passed to the application via the command line.

Definition at line 354 of file NewsFlash.java.

  {
    Application.run(new NewsFlash());
  }

void NewsFlash::publishButton_click | ( | Object | source,
 |  | Event | e |
 | ) |  |  | [inline, private]

Publish the event.

Parameters:
---
Returns:
---
See also:
Queuing, Monikers, com.ms.win32.Ole32.CoGetObject

Definition at line 41 of file NewsFlash.java.

  {
    String              monikerString = null;
    newseventclass.INewsEvent   traderObj   = null;

    monikerString = "new:" + helper.sampleConstants.EVENT_CLSID;
    if(queuedCB.getChecked())
    {
      monikerString = "queue:/" + monikerString;  // if Queuing is used
    }
    traderObj = (newseventclass.INewsEvent)(com.ms.win32.Ole32.CoGetObject(monikerString,null,newseventclass.INewsEvent.iid));
    traderObj.NewsFlash((double)(System.currentTimeMillis()),symbolTF.getText(),headlineTF.getText(),urlTF.getText()); // Fire a event
  }

void NewsFlash::updateCollections ( boolean processFlag ) [inline, private]

Update the different Collections in Admin catalog.

Parameters:
processFlag The flag specify whether the object in the collection is required to be added or removed.
Returns:
---
See also:
ComAdmin.IComAdminCatalog

Definition at line 89 of file NewsFlash.java.

  {
    comadmin.ICatalogCollection   appCollec = null;

    appCollec =(comadmin.ICatalogCollection)(admin.GetCollection("Application")); //Get the application collection
    appCollec.Populate(); //
    checkForApplication(appCollec,processFlag);

  }

Member Data Documentation

comadmin.ICOMAdminCatalog NewsFlash::admin = null [package]

Definition at line 15 of file NewsFlash.java.

Container NewsFlash::components = new Container() [package]

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.

Definition at line 229 of file NewsFlash.java.

Edit NewsFlash::ecDllNameFT = new Edit() [package]

Definition at line 243 of file NewsFlash.java.

Label NewsFlash::ecDllNameLabel = new Label() [package]

Definition at line 242 of file NewsFlash.java.

Label NewsFlash::headlineLabel = new Label() [package]

Definition at line 236 of file NewsFlash.java.

Edit NewsFlash::headlineTF = new Edit() [package]

Definition at line 238 of file NewsFlash.java.

GroupBox NewsFlash::InstallEventBorder = new GroupBox() [package]

Definition at line 231 of file NewsFlash.java.

Button NewsFlash::installEventButton = new Button() [package]

Definition at line 233 of file NewsFlash.java.

CheckBox NewsFlash::parallelCB = new CheckBox() [package]

Definition at line 241 of file NewsFlash.java.

Button NewsFlash::publishButton = new Button() [package]

Definition at line 232 of file NewsFlash.java.

GroupBox NewsFlash::PublishEventBorder = new GroupBox() [package]

Definition at line 230 of file NewsFlash.java.

CheckBox NewsFlash::queuedCB = new CheckBox() [package]

Definition at line 239 of file NewsFlash.java.

Label NewsFlash::symbolLabel = new Label() [package]

Definition at line 234 of file NewsFlash.java.

Edit NewsFlash::symbolTF = new Edit() [package]

Definition at line 237 of file NewsFlash.java.

Label NewsFlash::urlLabel = new Label() [package]

Definition at line 235 of file NewsFlash.java.

Edit NewsFlash::urlTF = new Edit() [package]

Definition at line 240 of file NewsFlash.java.

The documentation for this class was generated from the following file:
  • Com/Services/Events/EventNewsJAVA/NewsFlash/NewsFlash.java
Generated on Wed Nov 13 2024 16:57:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NewsSubscriber Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Package Attributes | Private Member Functions

NewsSubscriber Class Reference

This class can take a variable number of parameters on the command line. More...

List of all members.

Public Member Functions

NewsSubscriber ()
void | dispose ()
void | LongQuote (String Symbol, double BidPrice, double AskPrice, String LastTradeTime, double LastTradePrice, double NetChange, double DailyHigh, double DailyLow, int AskSize, int BidSize, double OpenPrice, double ClosePrice, String CloseDate)
void | NewsFlash (double dtTimeStamp, String Symbol, String Headline, String URL)
void | ShortQuote (String Symbol, double BidPrice, double AskPrice, double LastTradeTime, double LastTradePrice, double NetChange, double DailyHigh, double DailyLow)

Static Public Member Functions

static void | main (String args[])

Package Attributes

comadmin.ICOMAdminCatalog | admin = null
Label | appNameLB = new Label()
Edit | appNameTF = new Edit()
String | cascadeAppName = null
GroupBox | cascadeHeading = new GroupBox()
RadioButton | cascadePersisRB = new RadioButton()
RadioButton | cascadeTransRB = new RadioButton()
Button | clearButton = new Button()
Container | components = new Container()
RadioButton | directPersisRB = new RadioButton()
RadioButton | directTransRB = new RadioButton()
Label | dllPathLB = new Label()
Edit | dllPathTF = new Edit()
ListBox | eventList = new ListBox()
Button | installCascadeButton = new Button()
GroupBox | persistentHeading = new GroupBox()
CheckBox | queuedCascadeCB = new CheckBox()
CheckBox | queuedPersisCB = new CheckBox()
Button | subscribePersisButton = new Button()
Button | subscribeTransButton = new Button()
GroupBox | transientHeading = new GroupBox()

Private Member Functions

void | addCatalog (comadmin.ICatalogCollection appCollec, String appName)
void | checkForAppAlreadyInstalled (comadmin.ICatalogCollection appCollec, String appName)
void | checkForApplication (comadmin.ICatalogCollection appCollec, boolean appProcessFlag, String appName, String compName, String subName, String eventCLSID, boolean subProcessFlag)
void | checkForComponent (comadmin.ICatalogCollection compCollec, String compName, String subName, String eventCLSID, boolean subProcessFlag)
void | clearButton_click (Object source, Event e)
void | initAdminCatlog ()
void | initForm ()
void | installCascadeButton_click (Object source, Event e)
void | removeSubscription (comadmin.ICatalogCollection subCollec, String subName)
void | subscribePersisButton_click (Object source, Event e)
void | subscribeTransButton_click (Object source, Event e)
void | uninstallCascadeEvent ()
comadmin.ICatalogCollection | updateSubscription (comadmin.ICatalogCollection subCollec, String subName, String eventCLSID, boolean subProcessFlag)

Detailed Description

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.

Definition at line 13 of file NewsSubscriber.java.

Constructor & Destructor Documentation

NewsSubscriber::NewsSubscriber ( ) [inline]

Definition at line 18 of file NewsSubscriber.java.

  {
    // Required for Visual J++ Form Designer support
    initForm();
    dllPathTF.setText(helper.sampleConstants.CASCADE_EVENT_DLL);
    initAdminCatlog();
  }

Member Function Documentation

void NewsSubscriber::addCatalog | ( | comadmin.ICatalogCollection | appCollec,
 |  | String | appName |
 | ) |  |  | [inline, private]

Setting application properties.

Parameters:
appCollec | Collection of Applications.
appName | Application Name to be checked for.
Returns:
---
See also:
ComAdmin.IComAdminCatalog, ComAdmin.ICatalogCollection, ComAdmin.ICatalogObject

Definition at line 372 of file NewsSubscriber.java.

  {
    comadmin.ICatalogObject   catalogObj  = null;

    catalogObj  = (comadmin.ICatalogObject)(appCollec.Add());

    catalogObj.setValue("Name" , new Variant(appName));
    catalogObj.setValue("Activation" , new Variant(1));
    //catalogObj.setValue("QueuingEnabled" ,new  Variant(true));
    //catalogObj.setValue("QueueListenerEnabled",new Variant(true));
    appCollec.SaveChanges();
  }

void NewsSubscriber::checkForAppAlreadyInstalled | ( | comadmin.ICatalogCollection | appCollec,
 |  | String | appName |
 | ) |  |  | [inline, private]

Check if application is already present.

Parameters:
appCollec | Collection of Applications.
appName | Application Name to be checked for.
Returns:
---
See also:
ComAdmin.IComAdminCatalog, ComAdmin.ICatalogCollection, ComAdmin.ICatalogObject

Definition at line 393 of file NewsSubscriber.java.

  {

    int     index   = 0;

    appCollec.Populate();
    for(index = 0; index < appCollec.getCount(); index++)
    {
      if(((((comadmin.ICatalogObject)(appCollec.getItem(index))).getName()).toString()).equals(appName))
      {
        // If application already present then remove the application from the catalog.
        appCollec.Remove(index);
        appCollec.SaveChanges();
      }
    }

  }

void NewsSubscriber::checkForApplication | ( | comadmin.ICatalogCollection | appCollec,
 |  | boolean | appProcessFlag,
 |  | String | appName,
 |  | String | compName,
 |  | String | subName,
 |  | String | eventCLSID,
 |  | boolean | subProcessFlag |
 | ) |  |  | [inline, private]

Check for whether the given application name is present or not.

Parameters:
appCollec | Collection of Applications
processFlag | The flag specify whether the object in the collection is required to be added or removed.
appName | Name of the application to look for in the collection.
compName | Name of the component to look for if application is present in the collection.
subName | The name of subscription
eventCLSID | Event class id for subscription processing.
subProcessFlag | Whether to subscribe to the event or to remove the subscription.
Returns:
---
See also:
ComAdmin.IComAdminCatalog , ComAdmin.ICatalogCollection, ComAdmin.ICatalogObject

Definition at line 212 of file NewsSubscriber.java.

  {
    int               index   = 0;
    comadmin.ICatalogCollection   compCollec  = null;

    appCollec.Populate();
    for(index = 0; index < appCollec.getCount(); index++)
    {
      String str = (((comadmin.ICatalogObject)(appCollec.getItem(index))).getName()).toString();
      //Checking if application is present in the collection.
      if(((((comadmin.ICatalogObject)(appCollec.getItem(index))).getName()).toString()).equals(appName))
      {
        if(appProcessFlag == helper.sampleConstants.INSTALL_FLAG)
        {
          // Get Components collection.
          compCollec  =(comadmin.ICatalogCollection)(appCollec.GetCollection("Components",((comadmin.ICatalogObject)(appCollec.getItem(index))).getKey()));
          compCollec.Populate();
          checkForComponent(compCollec , compName , subName , eventCLSID, subProcessFlag);

        }
        else // Uninstall the application.
        {
          appCollec.Remove(index);
          appCollec.SaveChanges();
        }
        break;
      }
    }
  }

void NewsSubscriber::checkForComponent | ( | comadmin.ICatalogCollection | compCollec,
 |  | String | compName,
 |  | String | subName,
 |  | String | eventCLSID,
 |  | boolean | subProcessFlag |
 | ) |  |  | [inline, private]

Check for whether the given component name is present or not in application.

Parameters:
compCollec | Collection of Components in Application
compName | Name of the component to look for.
subName | The name of subscription
eventCLSID | Event class id for subscription processing.
subProcessFlag | Whether to subscribe to the event or to remove the subscription.
Returns:
---
See also:
ComAdmin.IComAdminCatalog, ComAdmin.ICatalogCollection, ComAdmin.ICatalogObject

Definition at line 253 of file NewsSubscriber.java.

  {
    int               index   = 0;
    comadmin.ICatalogCollection   subCollec = null;

    for(index = 0 ;index < compCollec.getCount(); index++)
    {
      //Checking if given component is present in the collection.
      if(((((comadmin.ICatalogObject)(compCollec.getItem(index))).getName()).toString()).equals(compName))
      {
        // Get the subscriptions associated with the component.
        subCollec =(comadmin.ICatalogCollection)(compCollec.GetCollection("SubscriptionsForComponent",((comadmin.ICatalogObject)(compCollec.getItem(index))).getKey()));
        subCollec.Populate();
        updateSubscription(subCollec , subName , eventCLSID, subProcessFlag);
        break;

      }
    }
  }

void NewsSubscriber::clearButton_click | ( | Object | source,
 |  | Event | e |
 | ) |  |  | [inline, private]

Definition at line 83 of file NewsSubscriber.java.

  {
    eventList.removeAll();
  }

void NewsSubscriber::dispose ( ) [inline]

Form1 overrides dispose so it can clean up the component list.

Definition at line 30 of file NewsSubscriber.java.

  {
    super.dispose();
    uninstallCascadeEvent();
    components.dispose();

  }

void NewsSubscriber::initAdminCatlog ( ) [inline, private]

Initialize the admin catalog.

Parameters:
---
Returns:
---
See also:
ComAdmin.IComAdminCatalog, ComAdmin.ICatalogCollection, ComAdmin.ICatalogObject

Definition at line 341 of file NewsSubscriber.java.

  {
    comadmin.ICatalogCollection appCollec = null;

    try
    {
      admin   = (comadmin.ICOMAdminCatalog)new comadmin.COMAdminCatalog();
      appCollec = (comadmin.ICatalogCollection)(admin.GetCollection("Applications"));
      checkForAppAlreadyInstalled(appCollec , helper.sampleConstants.SUBSCRIBER_NAME);
      addCatalog(appCollec, helper.sampleConstants.SUBSCRIBER_NAME);
      //Install persistent subscriber component.
      admin.InstallComponent(helper.sampleConstants.SUBSCRIBER_NAME,helper.sampleConstants.PERSIST_EVENT_DLL,"","");

    }
    catch(Exception exp)
    {
      System.out.println(exp);
    }

  }

void NewsSubscriber::initForm ( ) [inline, private]

Definition at line 449 of file NewsSubscriber.java.

  {
    this.setText("News Subscriber");
    this.setAutoScaleBaseSize(new Point(5, 13));
    this.setClientSize(new Point(515, 455));

    transientHeading.setLocation(new Point(16, 8));
    transientHeading.setSize(new Point(480, 256));
    transientHeading.setTabIndex(0);
    transientHeading.setTabStop(false);
    transientHeading.setText("Transient Subscriber");

    persistentHeading.setLocation(new Point(16, 272));
    persistentHeading.setSize(new Point(480, 64));
    persistentHeading.setTabIndex(1);
    persistentHeading.setTabStop(false);
    persistentHeading.setText("Persistent Subscriber");

    cascadeHeading.setLocation(new Point(16, 344));
    cascadeHeading.setSize(new Point(480, 104));
    cascadeHeading.setTabIndex(2);
    cascadeHeading.setTabStop(false);
    cascadeHeading.setText("Cascade Event Class");

    subscribeTransButton.setLocation(new Point(24, 24));
    subscribeTransButton.setSize(new Point(104, 32));
    subscribeTransButton.setTabIndex(0);
    subscribeTransButton.setText("Subscribe");
    subscribeTransButton.addOnClick(new EventHandler(this.subscribeTransButton_click));

    eventList.setLocation(new Point(24, 64));
    eventList.setSize(new Point(432, 147));
    eventList.setTabIndex(1);
    eventList.setText("listBox1");
    eventList.setUseTabStops(true);

    directTransRB.setLocation(new Point(200, 32));
    directTransRB.setSize(new Point(96, 16));
    directTransRB.setTabIndex(2);
    directTransRB.setTabStop(true);
    directTransRB.setText("Direct");
    directTransRB.setChecked(true);

    cascadeTransRB.setEnabled(false);
    cascadeTransRB.setLocation(new Point(352, 32));
    cascadeTransRB.setSize(new Point(96, 16));
    cascadeTransRB.setTabIndex(3);
    cascadeTransRB.setText("Cascade");

    clearButton.setLocation(new Point(344, 224));
    clearButton.setSize(new Point(112, 24));
    clearButton.setTabIndex(4);
    clearButton.setText("Clear");
    clearButton.addOnClick(new EventHandler(this.clearButton_click));

    subscribePersisButton.setLocation(new Point(24, 24));
    subscribePersisButton.setSize(new Point(96, 24));
    subscribePersisButton.setTabIndex(0);
    subscribePersisButton.setText("Subscribe");
    subscribePersisButton.addOnClick(new EventHandler(this.subscribePersisButton_click));

    directPersisRB.setLocation(new Point(152, 24));
    directPersisRB.setSize(new Point(88, 24));
    directPersisRB.setTabIndex(1);
    directPersisRB.setTabStop(true);
    directPersisRB.setText("Direct");
    directPersisRB.setChecked(true);

    cascadePersisRB.setEnabled(false);
    cascadePersisRB.setLocation(new Point(256, 24));
    cascadePersisRB.setSize(new Point(88, 24));
    cascadePersisRB.setTabIndex(2);
    cascadePersisRB.setText("Cascade");

    queuedPersisCB.setLocation(new Point(376, 24));
    queuedPersisCB.setSize(new Point(96, 24));
    queuedPersisCB.setTabIndex(3);
    queuedPersisCB.setText("Queued");

    installCascadeButton.setLocation(new Point(24, 24));
    installCascadeButton.setSize(new Point(96, 24));
    installCascadeButton.setTabIndex(0);
    installCascadeButton.setText("Install");
    installCascadeButton.addOnClick(new EventHandler(this.installCascadeButton_click));

    appNameLB.setLocation(new Point(168, 24));
    appNameLB.setSize(new Point(96, 16));
    appNameLB.setTabIndex(1);
    appNameLB.setTabStop(false);
    appNameLB.setText("App Name");

    dllPathLB.setLocation(new Point(168, 56));
    dllPathLB.setSize(new Point(96, 16));
    dllPathLB.setTabIndex(2);
    dllPathLB.setTabStop(false);
    dllPathLB.setText("DLL Path");

    queuedCascadeCB.setLocation(new Point(168, 80));
    queuedCascadeCB.setSize(new Point(96, 16));
    queuedCascadeCB.setTabIndex(3);
    queuedCascadeCB.setText("Queued");

    appNameTF.setLocation(new Point(272, 24));
    appNameTF.setSize(new Point(200, 20));
    appNameTF.setTabIndex(4);
    appNameTF.setText("");

    dllPathTF.setLocation(new Point(272, 56));
    dllPathTF.setSize(new Point(200, 20));
    dllPathTF.setTabIndex(5);
    dllPathTF.setText("");

    this.setNewControls(new Control[] {
              cascadeHeading,
              persistentHeading,
              transientHeading});
    transientHeading.setNewControls(new Control[] {
                    clearButton,
                    cascadeTransRB,
                    directTransRB,
                    eventList,
                    subscribeTransButton});
    persistentHeading.setNewControls(new Control[] {
                     queuedPersisCB,
                     cascadePersisRB,
                     directPersisRB,
                     subscribePersisButton});
    cascadeHeading.setNewControls(new Control[] {
                    dllPathTF,
                    appNameTF,
                    queuedCascadeCB,
                    dllPathLB,
                    appNameLB,
                    installCascadeButton});
  }

void NewsSubscriber::installCascadeButton_click | ( | Object | source,
 |  | Event | e |
 | ) |  |  | [inline, private]

Install Cascade event class on the local machine and also makes it persistent subscriber for news event.

Parameters:
---
Returns:
---
See also:
ComAdmin.IComAdminCatalog, ComAdmin.ICatalogCollection, ComAdmin.ICatalogObject

Definition at line 150 of file NewsSubscriber.java.

  {
    comadmin.ICatalogCollection   appCollec = null;
    //Get the application collection
    appCollec = (comadmin.ICatalogCollection)(admin.GetCollection("Applications"));
    if((installCascadeButton.getText()).equals("Install"))
    {
      // Check if the application is already present.
      checkForAppAlreadyInstalled(appCollec ,appNameTF.getText());
      //Create new application for the cascade event class.
      addCatalog(appCollec,appNameTF.getText());
      //Install cascade event class.
      cascadeAppName = appNameTF.getText();
      admin.InstallEventClass(appNameTF.getText(),dllPathTF.getText(),"" , "");
      //Create persistent subscription to news event class.
      checkForApplication(appCollec, helper.sampleConstants.INSTALL_FLAG,appNameTF.getText() , helper.sampleConstants.CASCADE_EVENT_NAME ,helper.sampleConstants.CASCADE_NAME, helper.sampleConstants.EVENT_CLSID,helper.sampleConstants.SUBSCRIBE_FLAG );
      cascadePersisRB.setEnabled(true);
      cascadeTransRB.setEnabled(true);
      installCascadeButton.setText("Uninstall");
    }
    else
    {
      uninstallCascadeEvent();
    }
  }

void NewsSubscriber::LongQuote | ( | String | Symbol,
 |  | double | BidPrice,
 |  | double | AskPrice,
 |  | String | LastTradeTime,
 |  | double | LastTradePrice,
 |  | double | NetChange,
 |  | double | DailyHigh,
 |  | double | DailyLow,
 |  | int | AskSize,
 |  | int | BidSize,
 |  | double | OpenPrice,
 |  | double | ClosePrice,
 |  | String | CloseDate |
 | ) |  |  | [inline]

Definition at line 412 of file NewsSubscriber.java.

  {
  }

static void NewsSubscriber::main ( String args[] ) [inline, static]

The main entry point for the application.

Parameters:
args Array of parameters passed to the application via the command line.

Definition at line 591 of file NewsSubscriber.java.

  {
    Application.run(new NewsSubscriber());
  }

void NewsSubscriber::NewsFlash | ( | double | dtTimeStamp,
 |  | String | Symbol,
 |  | String | Headline,
 |  | String | URL |
 | ) |  |  | [inline]

Definition at line 418 of file NewsSubscriber.java.

  {
    eventList.addItem( Symbol +" : " + Headline);
  }

void NewsSubscriber::removeSubscription | ( | comadmin.ICatalogCollection | subCollec,
 |  | String | subName |
 | ) |  |  | [inline, private]

Removing Subscription from the collection.

Parameters:
subCollec | Collection of Subscriptions.
subName | The name of subscription to be removed.
Returns:
---
See also:
ComAdmin.IComAdminCatalog, ComAdmin.ICatalogCollection, ComAdmin.ICatalogObject

Definition at line 318 of file NewsSubscriber.java.

  {
    int   index = 0;

    for(index = 0 ; index < subCollec.getCount() ; index++)
    {
      // Checking if given subscription is present in the collection.
      if(((((comadmin.ICatalogObject)(subCollec.getItem(index))).getName()).toString()).equals(subName))
      {
        subCollec.Remove(index);
        subCollec.SaveChanges();
        break;
      }
    }
  }

void NewsSubscriber::ShortQuote | ( | String | Symbol,
 |  | double | BidPrice,
 |  | double | AskPrice,
 |  | double | LastTradeTime,
 |  | double | LastTradePrice,
 |  | double | NetChange,
 |  | double | DailyHigh,
 |  | double | DailyLow |
 | ) |  |  | [inline]

Definition at line 415 of file NewsSubscriber.java.

  {
  }

void NewsSubscriber::subscribePersisButton_click | ( | Object | source,
 |  | Event | e |
 | ) |  |  | [inline, private]

Handle persistent subscription processing.

Parameters:
---
Returns:
---
See also:
ComAdmin.IComAdminCatalog, ComAdmin.ICatalogCollection, ComAdmin.ICatalogObject

Definition at line 95 of file NewsSubscriber.java.

  {
    comadmin.ICatalogCollection   appCollec = null;
    String              eventCLSID  = null;

    appCollec = (comadmin.ICatalogCollection)(admin.GetCollection("Applications"));
    // If cascade radio button is checked then register the persistent subscription fot cascade event class
    if(cascadePersisRB.getChecked())
    {
      eventCLSID  = helper.sampleConstants.CASCADE_EVENT_CLSID;
      directPersisRB.setEnabled(false);
    }
    // If direct radio button is checked then register the persistent subscription fot news event class
    else if(directPersisRB.getChecked())
    {
      eventCLSID  = helper.sampleConstants.EVENT_CLSID;
      cascadePersisRB.setEnabled(false);
    }
    if((subscribePersisButton.getText()).equals("Subscribe"))
    {
      // Register the subscription.
      checkForApplication(appCollec, helper.sampleConstants.INSTALL_FLAG,helper.sampleConstants.SUBSCRIBER_NAME , helper.sampleConstants.PERSIS_EVENT_NAME ,helper.sampleConstants.PERSIS_NAME, eventCLSID , helper.sampleConstants.SUBSCRIBE_FLAG );
      subscribePersisButton.setText("Unsubscribe");
      if(queuedPersisCB.getChecked())
      {
        queuedPersisCB.setEnabled(false);
      }
    }
    else // Unsubscribe Persistent subscription.
    {
      checkForApplication(appCollec, helper.sampleConstants.INSTALL_FLAG,helper.sampleConstants.SUBSCRIBER_NAME , helper.sampleConstants.PERSIS_EVENT_NAME ,helper.sampleConstants.PERSIS_NAME, eventCLSID , helper.sampleConstants.UNSUBSCRIBE_FLAG );
      subscribePersisButton.setText("Subscribe");
      queuedPersisCB.setEnabled(true);
      if(!((installCascadeButton.getText()).equals("Install")))
      {
        cascadePersisRB.setEnabled(true);
      }
      directPersisRB.setEnabled(true);

    }

  }

void NewsSubscriber::subscribeTransButton_click | ( | Object | source,
 |  | Event | e |
 | ) |  |  | [inline, private]

Handle transient subscription processing.

Parameters:
---
Returns:
---
See also:
ComAdmin.IComAdminCatalog, ComAdmin.ICatalogCollection, ComAdmin.ICatalogObject

Definition at line 46 of file NewsSubscriber.java.

  {
    comadmin.ICatalogCollection   subCollec = null;
    String              eventCLSID  = null;

    subCollec = (comadmin.ICatalogCollection)(admin.GetCollection("TransientSubscriptions"));
    // If cascade radio button is checked then register the transient subscription fot cascade event class
    if(cascadeTransRB.getChecked())
    {
      eventCLSID  = helper.sampleConstants.CASCADE_EVENT_CLSID;
      directTransRB.setEnabled(false);
    }
    // If direct radio button is checked then register the transient subscription fot news event class
    else if(directTransRB.getChecked())
    {
      eventCLSID  = helper.sampleConstants.EVENT_CLSID;
      cascadeTransRB.setEnabled(false);
    }
    if((subscribeTransButton.getText()).equals("Subscribe"))
    {
      //Register the subscription.
      updateSubscription(subCollec,helper.sampleConstants.TRANSIENT_NAME,eventCLSID,helper.sampleConstants.SUBSCRIBE_FLAG);
      subscribeTransButton.setText("Unsubscribe");
    }
    else
    {
      //Unsubscribe the subscription.
      updateSubscription(subCollec,helper.sampleConstants.TRANSIENT_NAME,eventCLSID,helper.sampleConstants.UNSUBSCRIBE_FLAG);
      subscribeTransButton.setText("Subscribe");
      if(!((installCascadeButton.getText()).equals("Install")))
      {
        cascadeTransRB.setEnabled(true);
      }
      directTransRB.setEnabled(true);
    }
  }

void NewsSubscriber::uninstallCascadeEvent ( ) [inline, private]

Uninstall Cascade Event.

Parameters:
---
Returns:
---
See also:
ComAdmin.IComAdminCatalog, ComAdmin.ICatalogCollection, ComAdmin.ICatalogObject

Definition at line 183 of file NewsSubscriber.java.

  {
    comadmin.ICatalogCollection   appCollec = null;
    if(cascadeAppName != null)
    {
      //Get the application collection
      appCollec = (comadmin.ICatalogCollection)(admin.GetCollection("Applications"));

      // Uninstall the cascade event class.
      checkForApplication(appCollec, helper.sampleConstants.UNINSTALL_FLAG ,cascadeAppName,"", "","" ,helper.sampleConstants.SUBSCRIBE_FLAG);
      cascadePersisRB.setEnabled(false);
      cascadeTransRB.setEnabled(false);
      installCascadeButton.setText("Install");
    }
  }

comadmin.ICatalogCollection NewsSubscriber::updateSubscription | ( | comadmin.ICatalogCollection | subCollec,
 |  | String | subName,
 |  | String | eventCLSID,
 |  | boolean | subProcessFlag |
 | ) |  |  | [inline, private]

Handle Subscriptions processing.

Parameters:
subCollec | Collection of Subscriptions.
subName | The name of subscription
eventCLSID | Event class id.
subProcessFlag | Whether to subscribe to the event or to remove the subscription.
Returns:
---
See also:
ComAdmin.IComAdminCatalog, ComAdmin.ICatalogCollection, ComAdmin.ICatalogObject

Definition at line 282 of file NewsSubscriber.java.

  {
    comadmin.ICatalogObject subCatalogObj = null;
    if(subProcessFlag)
    {
      // Add a subscription.
      subCatalogObj = (comadmin.ICatalogObject)(subCollec.Add());
      subCatalogObj.setValue("EventCLSID",new Variant(eventCLSID));
      subCatalogObj.setValue("Name" , new Variant(subName));
      if(subName.equals(helper.sampleConstants.PERSIS_NAME))
      {
        if(queuedPersisCB.getChecked())
        {
          subCatalogObj.setValue("Queued" , new Variant(true));
        }
      }
      else if (subName.equals(helper.sampleConstants.TRANSIENT_NAME))
      {
        subCatalogObj.setValue("SubscriberInterface" , new Variant(this));
      }
      subCollec.SaveChanges();
    }
    else
    {
      removeSubscription(subCollec , subName);
    }
    return subCollec;
  }

Member Data Documentation

comadmin.ICOMAdminCatalog NewsSubscriber::admin = null [package]

Definition at line 15 of file NewsSubscriber.java.

Label NewsSubscriber::appNameLB = new Label() [package]

Definition at line 443 of file NewsSubscriber.java.

Edit NewsSubscriber::appNameTF = new Edit() [package]

Definition at line 446 of file NewsSubscriber.java.

String NewsSubscriber::cascadeAppName = null [package]

Definition at line 16 of file NewsSubscriber.java.

GroupBox NewsSubscriber::cascadeHeading = new GroupBox() [package]

Definition at line 432 of file NewsSubscriber.java.

RadioButton NewsSubscriber::cascadePersisRB = new RadioButton() [package]

Definition at line 440 of file NewsSubscriber.java.

RadioButton NewsSubscriber::cascadeTransRB = new RadioButton() [package]

Definition at line 436 of file NewsSubscriber.java.

Button NewsSubscriber::clearButton = new Button() [package]

Definition at line 437 of file NewsSubscriber.java.

Container NewsSubscriber::components = new Container() [package]

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.

Definition at line 429 of file NewsSubscriber.java.

RadioButton NewsSubscriber::directPersisRB = new RadioButton() [package]

Definition at line 439 of file NewsSubscriber.java.

RadioButton NewsSubscriber::directTransRB = new RadioButton() [package]

Definition at line 435 of file NewsSubscriber.java.

Label NewsSubscriber::dllPathLB = new Label() [package]

Definition at line 444 of file NewsSubscriber.java.

Edit NewsSubscriber::dllPathTF = new Edit() [package]

Definition at line 447 of file NewsSubscriber.java.

ListBox NewsSubscriber::eventList = new ListBox() [package]

Definition at line 434 of file NewsSubscriber.java.

Button NewsSubscriber::installCascadeButton = new Button() [package]

Definition at line 442 of file NewsSubscriber.java.

GroupBox NewsSubscriber::persistentHeading = new GroupBox() [package]

Definition at line 431 of file NewsSubscriber.java.

CheckBox NewsSubscriber::queuedCascadeCB = new CheckBox() [package]

Definition at line 445 of file NewsSubscriber.java.

CheckBox NewsSubscriber::queuedPersisCB = new CheckBox() [package]

Definition at line 441 of file NewsSubscriber.java.

Button NewsSubscriber::subscribePersisButton = new Button() [package]

Definition at line 438 of file NewsSubscriber.java.

Button NewsSubscriber::subscribeTransButton = new Button() [package]

Definition at line 433 of file NewsSubscriber.java.

GroupBox NewsSubscriber::transientHeading = new GroupBox() [package]

Definition at line 430 of file NewsSubscriber.java.

The documentation for this class was generated from the following file:
  • Com/Services/Events/EventNewsJAVA/NewsSuscriber/NewsSubscriber.java
Generated on Wed Nov 13 2024 16:57:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NIDeque_c< T > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes | Friends

NIDeque_c< T > Class Template Reference

#include "Nideque.h"

Inherited by Stack_c< T > [private].

List of all members.

Public Member Functions

NIDeque_c ()
~NIDeque_c ()
BOOL | GetFromBack (T &data)
BOOL | GetFromFront (T &data)
BOOL | InsertIntoBack (T data)
BOOL | InsertIntoFront (T data)
BOOL IsEmpty ()
BOOL | RemoveFromBack (T &data)
BOOL | RemoveFromFront (T &data)

Private Attributes

NILNode_c< T > * | Root
NILNode_c< T > * | Tail

Friends

class | NIDequeIter_c< T >

Detailed Description

template<class T>
class NIDeque_c< T >

Definition at line 64 of file Nideque.h.

Constructor & Destructor Documentation

template<class T >
NIDeque_c< T >::NIDeque_c ( )

Definition at line 102 of file Nideque.h.

{
    Root = NULL;
    Tail = NULL;
} // End of NINIDeque_c::NIDeque_c

template<class T >
NIDeque_c< T >::~NIDeque_c ( )

Definition at line 129 of file Nideque.h.

{
    NILNode_c<T>    *bptr    = NULL,
                    *cptr    = NULL;

    for(bptr=NULL,cptr=Root;cptr;bptr=cptr,cptr=cptr->Next){
        delete bptr;
    }
    delete bptr;
}

Member Function Documentation

template<class T>
BOOL NIDeque_c< T >::GetFromBack ( T & data )

Definition at line 368 of file Nideque.h.

{
    NILNode_c<T>    *nptr    = NULL;

    if(Tail){
        Data = Tail->Data;
        return TRUE;
    }else{
        Data = NULL;
        return FALSE;
    }
} // End of NIDeque_c::RemFront

template<class T>
BOOL NIDeque_c< T >::GetFromFront ( T & data )

Definition at line 335 of file Nideque.h.

{
    NILNode_c<T>    *nptr    = NULL;

    if(Root){
        Data = Root->Data;
        return TRUE;
    }else{
        Data = NULL;
        return FALSE;
    }
} // End of NIDeque_c::GetFromFront

template<class T>
BOOL NIDeque_c< T >::InsertIntoBack ( T data )

Definition at line 249 of file Nideque.h.

{
    NILNode_c<T>    *nptr    = NULL;

    nptr = new NILNode_c<T>;
    if(!nptr){
        HUSetLastError(ALLOCERROR);
        return FALSE;
    }

    nptr->Data = Data;

    if(Root){
        nptr->Back = Tail;
        Tail->Next = nptr;
        Tail = nptr;
    }else{
        Root = nptr;
        Tail = nptr;
    }
    return TRUE;
} // End of NIDeque_c::InsBack

template<class T>
BOOL NIDeque_c< T >::InsertIntoFront ( T data )

Definition at line 160 of file Nideque.h.

{
    NILNode_c<T>    *nptr    = NULL;

    /*  If the list contains something then move the root pointer down.
    //  Otherwise, put this new object on the root.
    */
    nptr = new NILNode_c<T>;
    if(!nptr){
         HUSetLastError(ALLOCERROR);
         return FALSE;
    }

    nptr->Data = Data;

    if(Root){
        nptr->Next = Root;
        Root->Back = nptr;
        Root = nptr;
    }else{
        Root = nptr;
        Tail = nptr;
    }
    return TRUE;
} // End of NIDeque_c::InsFront

template<class T >
BOOL NIDeque_c< T >::IsEmpty ( void )

Reimplemented in Cstack_c, Stack_c< T >, and Stack_c< int >.

Definition at line 401 of file Nideque.h.

{

    if(Root){
        return FALSE;
    }else{
        return TRUE;
    }
} // End of NIDeque_c::IsEmpty

template<class T>
BOOL NIDeque_c< T >::RemoveFromBack ( T & data )

Definition at line 292 of file Nideque.h.

{
    NILNode_c<T>    *nptr    = NULL;

    if(Tail){
        nptr = Tail;
        Tail = Tail->Back;
        if(Tail){
            Tail->Next = NULL;
        }else{
        Root = NULL;
    }
        nptr->Next = NULL;
        nptr->Back = NULL;
        Data = nptr->Data;
        delete nptr;
        return TRUE;
    }else{
        Data = NULL;
        return FALSE;
    }
}

template<class T>
BOOL NIDeque_c< T >::RemoveFromFront ( T & data )

Definition at line 206 of file Nideque.h.

{
    NILNode_c<T>    *nptr    = NULL;

    if(Root){
        nptr = Root;
        Root = Root->Next;
        if(Root){
            Root->Back = NULL;
        }else{
            Tail = NULL;
        }
        nptr->Next = NULL;
        nptr->Back = NULL;
        Data = nptr->Data;
        delete nptr;
        return TRUE;
    }else{
        Data = NULL;
        return FALSE;
    }
} // End of NIDeque_c::RemFront

Friends And Related Function Documentation

template<class T>
friend class NIDequeIter_c< T > [friend]

Definition at line 65 of file Nideque.h.

Member Data Documentation

template<class T>
NILNode_c<T>* NIDeque_c< T >::Root [private]

Definition at line 68 of file Nideque.h.

template<class T>
NILNode_c<T> * NIDeque_c< T >::Tail [private]

Definition at line 68 of file Nideque.h.

The documentation for this class was generated from the following file:
  • NetDS/WinSock/Dt_Dll/Nideque.h
Generated on Wed Nov 13 2024 16:57:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NIDequeIter_c< T > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

NIDequeIter_c< T > Class Template Reference

#include "Nideque.h"

List of all members.

Public Member Functions

NIDequeIter_c ()
NIDequeIter_c (NIDeque_c< T > &ANIDeque)
~NIDequeIter_c ()
BOOL | Back (T &data)
BOOL | First (T &data)
BOOL | Initialize (NIDeque_c< T > &ANIDeque)
BOOL | Last (T &data)
BOOL | Next (T &data)
BOOL | Remove (T &data)
BOOL | Replace (T &src, T chg)

Protected Member Functions

NILNode_c< T > * | GetCurrent ()
NIDeque_c< T > * | GetNIDeque ()

Private Member Functions

void | RemoveData (NILNode_c< T > *cptr, T &data)

Private Attributes

NILNode_c< T > * | Current
NIDeque_c< T > * | NIDeque

Detailed Description

template<class T>
class NIDequeIter_c< T >

Definition at line 415 of file Nideque.h.

Constructor & Destructor Documentation

template<class T >
NIDequeIter_c< T >::NIDequeIter_c ( )

Definition at line 526 of file Nideque.h.

{
    NIDeque = NULL;
    Current = NULL;
}

template<class T >
NIDequeIter_c< T >::NIDequeIter_c ( NIDeque_c< T > & ANIDeque )

Definition at line 518 of file Nideque.h.

{
    NIDeque = &ANIDeque;
    Current = NULL;
}

template<class T >
NIDequeIter_c< T >::~NIDequeIter_c ( )

Definition at line 552 of file Nideque.h.

{
}

Member Function Documentation

template<class T >
BOOL NIDequeIter_c< T >::Back ( T & data )

Definition at line 707 of file Nideque.h.

{
    if(Current && (Current = Current->Back)){
        Data = Current->Data;
        return TRUE;
    }else{
        Data = NULL;
        return FALSE;
    }
} // End of NIDeque_c::Next

template<class T >
BOOL NIDequeIter_c< T >::First ( T & data )

Definition at line 606 of file Nideque.h.

{
    Current = NIDeque->Root;
    if(Current != NULL){
        Data = Current->Data;
        return TRUE;
    }else{
        return FALSE;
    }
} // End of NIDeque_c::First

template<class T >
NILNode_c<T>* NIDequeIter_c< T >::GetCurrent ( ) [inline, protected]
template<class T >
NIDeque_c<T>* NIDequeIter_c< T >::GetNIDeque ( ) [inline, protected]
template<class T >
BOOL NIDequeIter_c< T >::Initialize ( NIDeque_c< T > & ANIDeque )

Definition at line 575 of file Nideque.h.

{
    NIDeque = &ANIDeque;
    Current = NULL;
    return TRUE;
}

template<class T >
BOOL NIDequeIter_c< T >::Last ( T & data )

Definition at line 674 of file Nideque.h.

{
    Current = NIDeque->Tail;
    if(Current != NULL){
        Data = Current->Data;
        return TRUE;
    }else{
        return FALSE;
    }
} // End of NIDeque_c::First

template<class T >
BOOL NIDequeIter_c< T >::Next ( T & data )

Definition at line 639 of file Nideque.h.

{
    if(Current){
        Current = Current->Next;
        if(Current){
            Data = Current->Data;
            return TRUE;
        }
    }
    Data = NULL;
    return FALSE;
} // End of NIDeque_c::Next

template<class T >
BOOL NIDequeIter_c< T >::Remove ( T & data )

Definition at line 776 of file Nideque.h.

{
    NILNode_c<T>    *cptr   = NULL;
    T               *vdata  = NULL;

    if(Current != NULL){
        RemoveData(Current,data);
        return TRUE;
    }
    return FALSE;
} // End of NIDeque_c<T>::Remove

template<class T >
void NIDequeIter_c< T >::RemoveData | ( | NILNode_c< T > * | cptr,
 |  | T & | data |
 | ) |  |  | [private]

Definition at line 464 of file Nideque.h.

{
    NILNode_c<T>  *bptr    = NULL,
                  *nptr    = NULL,
                  *fptr    = NULL;

    if(Current == cptr){
        Current = cptr->Next;
    }
    fptr = cptr;
    bptr = cptr->Back;
    nptr = cptr->Next;
    if(bptr != NULL){
        bptr->Next = nptr;
    }
    if(nptr != NULL){
        nptr->Back = bptr;
    }
    if(fptr == NIDeque->Root){
        NIDeque->Root = nptr;
    }
    if(fptr == NIDeque->Tail){
        NIDeque->Tail = bptr;
    }
    if(ret_data){
        ret_data = fptr->Data;
    }
    delete fptr;
} // End of NINIDeque_c::RemoveData

template<class T >
BOOL NIDequeIter_c< T >::Replace | ( | T & | src,
 |  | T | chg
 | ) |  |

Definition at line 742 of file Nideque.h.

{
    NILNode_c<T> *cptr    = NULL;

    if(Current != NULL){
        src = Current->Data;
        Current->Data = chg;
        return TRUE;
    }
    return FALSE;
} // End of NIDeque_c::Replace

Member Data Documentation

template<class T >
NILNode_c<T>* NIDequeIter_c< T >::Current [private]

Definition at line 418 of file Nideque.h.

template<class T >
NIDeque_c<T>* NIDequeIter_c< T >::NIDeque [private]

Definition at line 417 of file Nideque.h.

The documentation for this class was generated from the following file:
  • NetDS/WinSock/Dt_Dll/Nideque.h
Generated on Wed Nov 13 2024 16:57:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NILNode_c< T > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes | Friends

NILNode_c< T > Class Template Reference

#include "Nideque.h"

List of all members.

Public Member Functions

NILNode_c ()

Private Attributes

NILNode_c * Back
T | Data
NILNode_c * Next

Friends

class | NIDeque_c< T >
class | NIDequeIter_c< T >

Detailed Description

template<class T>
class NILNode_c< T >

Definition at line 39 of file Nideque.h.

Constructor & Destructor Documentation

template<class T >
NILNode_c< T >::NILNode_c ( )

Definition at line 52 of file Nideque.h.

{
    // Make sure the members are correctly initialized.
    Next = NULL;
    Back = NULL;
} // NILNode_c::NILNode_c

Friends And Related Function Documentation

template<class T>
friend class NIDeque_c< T > [friend]

Definition at line 40 of file Nideque.h.

template<class T>
friend class NIDequeIter_c< T > [friend]

Definition at line 41 of file Nideque.h.

Member Data Documentation

template<class T>
NILNode_c * NILNode_c< T >::Back [private]

Definition at line 45 of file Nideque.h.

template<class T>
T NILNode_c< T >::Data [private]

Definition at line 44 of file Nideque.h.

template<class T>
NILNode_c* NILNode_c< T >::Next [private]

Definition at line 45 of file Nideque.h.

The documentation for this class was generated from the following file:
  • NetDS/WinSock/Dt_Dll/Nideque.h
Generated on Wed Nov 13 2024 16:57:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NODE_PROPERTIES Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

NODE_PROPERTIES Struct Reference

#include "basenode.h"

List of all members.

Public Attributes

DWORD dwAttributes
LONG | nBlockSize
LONG | nChildCount
CHILD_PROPERTIES pChildProps
LONG_PTR | pComponentData
LONG_PTR | pParentObject
WCHAR | szNodeName [MAX_NAME_LEN]

Detailed Description

Definition at line 49 of file basenode.h.

Member Data Documentation

DWORD NODE_PROPERTIES::dwAttributes

Definition at line 54 of file basenode.h.

LONG NODE_PROPERTIES::nBlockSize

Definition at line 56 of file basenode.h.

LONG NODE_PROPERTIES::nChildCount

Definition at line 55 of file basenode.h.

CHILD_PROPERTIES NODE_PROPERTIES::pChildProps

Definition at line 57 of file basenode.h.

LONG_PTR NODE_PROPERTIES::pComponentData

Definition at line 52 of file basenode.h.

LONG_PTR NODE_PROPERTIES::pParentObject

Definition at line 53 of file basenode.h.

WCHAR NODE_PROPERTIES::szNodeName[MAX_NAME_LEN]

Definition at line 51 of file basenode.h.

The documentation for this struct was generated from the following file:
  • SysMgmt/MMC/mmc2.0/dragdrop/basenode.h
Generated on Wed Nov 13 2024 16:57:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NODE_STRUCT Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

NODE_STRUCT Struct Reference

#include "LinkList.h"

List of all members.

Public Attributes

PNODE pLeftLink
PVOID pNodeData
PNODE pRightLink

Detailed Description

Definition at line 80 of file LinkList.h.

Member Data Documentation

PNODE NODE_STRUCT::pLeftLink

Definition at line 82 of file LinkList.h.

PVOID NODE_STRUCT::pNodeData

Definition at line 81 of file LinkList.h.

PNODE NODE_STRUCT::pRightLink

Definition at line 83 of file LinkList.h.

The documentation for this struct was generated from the following file:
  • WinBase/Debug/Deb/LinkList.h
Generated on Wed Nov 13 2024 16:57:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NODESTRUCT Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

NODESTRUCT Struct Reference

#include "extend.h"

List of all members.

Public Attributes

GUID GUID
_TCHAR szDescription [256]

Detailed Description

Definition at line 25 of file extend.h.

Member Data Documentation

GUID NODESTRUCT::GUID

Definition at line 27 of file extend.h.

_TCHAR NODESTRUCT::szDescription

Definition at line 28 of file extend.h.

The documentation for this struct was generated from the following files:
  • SysMgmt/MMC/Complete/extend.h
  • SysMgmt/MMC/Extens/extend.h
Generated on Wed Nov 13 2024 16:57:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NONDIALTOKENS Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

NONDIALTOKENS Struct Reference

List of all members.

Public Attributes

DWORD dwDevCapFlag
LONG lError
LPSTR szMsg
LPSTR szToken

Detailed Description

Definition at line 154 of file TapiCode.c.

Member Data Documentation

DWORD NONDIALTOKENS::dwDevCapFlag

Definition at line 156 of file TapiCode.c.

LONG NONDIALTOKENS::lError

Definition at line 155 of file TapiCode.c.

LPSTR NONDIALTOKENS::szMsg

Definition at line 158 of file TapiCode.c.

LPSTR NONDIALTOKENS::szToken

Definition at line 157 of file TapiCode.c.

The documentation for this struct was generated from the following file:
  • NetDS/Tapi/Tapi2/TapiComm/TapiCode.c
Generated on Wed Nov 13 2024 16:57:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Note Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

Note Struct Reference

#include "sampclnt.h"

List of all members.

Public Attributes

DWORD dwFlag
char * szText

Detailed Description

Definition at line 89 of file sampclnt.h.

Member Data Documentation

DWORD Note::dwFlag

Definition at line 90 of file sampclnt.h.

char* Note::szText

Definition at line 91 of file sampclnt.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/oledb/sampclnt/sampclnt.h
Generated on Wed Nov 13 2024 16:57:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Notify Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Package Attributes | Private Attributes

Notify Class Reference

Inherits agentsvr::IAgentNotifySinkEx, and agentsvr::IAgentNotifySinkEx.

List of all members.

Public Member Functions

Notify ()
Notify (Hello3J applet)
void | ActivateInputState (int characterID, int activated)
void | ActivateInputState (int characterID, int activated)
void | ActiveClientChange (int characterID, int status)
void | ActiveClientChange (int characterID, int status)
void | AgentPropertyChange ()
void | AgentPropertyChange ()
void | BalloonVisibleState (int characterID, int visible)
void | BalloonVisibleState (int characterID, int visible)
void | BookMark (int bookmarkID)
void | BookMark (int bookmarkID)
void | Click (int characterID, short keys, int x, int y)
void | Click (int characterID, short keys, int x, int y)
void | Command (int commandID, com.ms.com.IUnknown userInput)
void | Command (int commandID, com.ms.com.IUnknown userInput)
void | DblClick (int characterID, short keys, int x, int y)
void | DblClick (int characterID, short keys, int x, int y)
void | DefaultCharacterChange (String guid)
void | DefaultCharacterChange (String guid)
void | DragComplete (int characterID, short keys, int x, int y)
void | DragComplete (int characterID, short keys, int x, int y)
void | DragStart (int characterID, short keys, int x, int y)
void | DragStart (int characterID, short keys, int x, int y)
void | HelpComplete (int characterID, int commandID, int cause)
void | HelpComplete (int characterID, int commandID, int cause)
void | Idle (int characterID, int start)
void | Idle (int characterID, int start)
void | Initialize (IAgentEx agent, IAgentCharacterEx character, int commandID)
void | ListeningState (int characterID, int state, int cause)
void | ListeningState (int characterID, int state, int cause)
void | Move (int characterID, int x, int y, int cause)
void | Move (int characterID, int x, int y, int cause)
void | RequestComplete (int requestID, int status)
void | RequestComplete (int requestID, int status)
void | RequestStart (int requestID)
void | RequestStart (int requestID)
void | Restart ()
void | Restart ()
void | Shutdown ()
void | Shutdown ()
void | Size (int characterID, int width, int height)
void | Size (int characterID, int width, int height)
void | VisibleState (int characterID, int visible, int cause)
void | VisibleState (int characterID, int visible, int cause)

Public Attributes

int | m_DoneID [] = {-1}

Package Attributes

IAgentEx | m_AgentEx = null
IAgentCharacterEx | m_Character = null
int | m_CommandID = -1
int | m_RequestID [] = {-1}

Private Attributes

Hello3J m_Applet
final int | MK_LBUTTON = 0x0001
final int | TRUE = 1

Detailed Description

Definition at line 27 of file notify.java.

Constructor & Destructor Documentation

Notify::Notify ( ) [inline]

Definition at line 37 of file notify.java.

  {
    // Constructor left intentionally blank
  }

Notify::Notify ( Hello3J applet ) [inline]

Definition at line 26 of file Notify.java.

  {
    m_Applet = applet;
  }

Member Function Documentation

void Notify::ActivateInputState | ( | int | characterID,
 |  | int | activated |
 | ) |  |  | [inline]

Definition at line 83 of file notify.java.

  {
  }

void Notify::ActivateInputState | ( | int | characterID,
 |  | int | activated |
 | ) |  |  | [inline]

Definition at line 59 of file Notify.java.

  {
  }

void Notify::ActiveClientChange | ( | int | characterID,
 |  | int | status |
 | ) |  |  | [inline]

Definition at line 143 of file notify.java.

  {
  }

void Notify::ActiveClientChange | ( | int | characterID,
 |  | int | status |
 | ) |  |  | [inline]

Definition at line 115 of file Notify.java.

  {
  }

void Notify::AgentPropertyChange ( ) [inline]

Definition at line 139 of file notify.java.

  {
  }

void Notify::AgentPropertyChange ( ) [inline]

Definition at line 111 of file Notify.java.

  {
  }

void Notify::BalloonVisibleState | ( | int | characterID,
 |  | int | visible |
 | ) |  |  | [inline]

Definition at line 95 of file Notify.java.

  {
  }

void Notify::BalloonVisibleState | ( | int | characterID,
 |  | int | visible |
 | ) |  |  | [inline]

Definition at line 119 of file notify.java.

  {
  }

void Notify::BookMark ( int bookmarkID ) [inline]

Definition at line 67 of file notify.java.

  {
  }

void Notify::BookMark ( int bookmarkID ) [inline]

Definition at line 43 of file Notify.java.

  {
  }

void Notify::Click | ( | int | characterID,
 |  | short | keys,
 |  | int | x,
 |  | int | y |
 | ) |  |  | [inline]

Definition at line 51 of file notify.java.

  {
    if ((m_Character != null) && ((keys & MK_LBUTTON) == MK_LBUTTON))
    {
      m_Character.Speak("You clicked on me with the left mouse button.", "", m_RequestID);
    }
  }

void Notify::Click | ( | int | characterID,
 |  | short | keys,
 |  | int | x,
 |  | int | y |
 | ) |  |  | [inline]

Definition at line 31 of file Notify.java.

  {
  }

void Notify::Command | ( | int | commandID,
 |  | com.ms.com.IUnknown | userInput |
 | ) |  |  | [inline]

Definition at line 87 of file notify.java.

  {
    if (commandID == m_CommandID)
    {
      m_AgentEx.ShowDefaultCharacterProperties((short)-1, (short)-1, TRUE);
    }
  }

void Notify::Command | ( | int | commandID,
 |  | com.ms.com.IUnknown | userInput |
 | ) |  |  | [inline]

Definition at line 63 of file Notify.java.

  {
  }

void Notify::DblClick | ( | int | characterID,
 |  | short | keys,
 |  | int | x,
 |  | int | y |
 | ) |  |  | [inline]

Definition at line 59 of file notify.java.

  {
  }

void Notify::DblClick | ( | int | characterID,
 |  | short | keys,
 |  | int | x,
 |  | int | y |
 | ) |  |  | [inline]

Definition at line 35 of file Notify.java.

  {
  }

void Notify::DefaultCharacterChange ( String guid ) [inline]

Definition at line 107 of file Notify.java.

  {
  }

void Notify::DefaultCharacterChange ( String guid ) [inline]

Definition at line 131 of file notify.java.

  {
    if (m_Character != null)
    {
      m_Character.Speak("The character changed.", "", m_RequestID);
    }
  }

void Notify::DragComplete | ( | int | characterID,
 |  | short | keys,
 |  | int | x,
 |  | int | y |
 | ) |  |  | [inline]

Definition at line 79 of file notify.java.

  {
  }

void Notify::DragComplete | ( | int | characterID,
 |  | short | keys,
 |  | int | x,
 |  | int | y |
 | ) |  |  | [inline]

Definition at line 55 of file Notify.java.

  {
  }

void Notify::DragStart | ( | int | characterID,
 |  | short | keys,
 |  | int | x,
 |  | int | y |
 | ) |  |  | [inline]

Definition at line 51 of file Notify.java.

  {
  }

void Notify::DragStart | ( | int | characterID,
 |  | short | keys,
 |  | int | x,
 |  | int | y |
 | ) |  |  | [inline]

Definition at line 75 of file notify.java.

  {
  }

void Notify::HelpComplete | ( | int | characterID,
 |  | int | commandID,
 |  | int | cause |
 | ) |  |  | [inline]

Definition at line 123 of file notify.java.

  {
  }

void Notify::HelpComplete | ( | int | characterID,
 |  | int | commandID,
 |  | int | cause |
 | ) |  |  | [inline]

Definition at line 99 of file Notify.java.

  {
  }

void Notify::Idle | ( | int | characterID,
 |  | int | start |
 | ) |  |  | [inline]

Definition at line 83 of file Notify.java.

  {
  }

void Notify::Idle | ( | int | characterID,
 |  | int | start |
 | ) |  |  | [inline]

Definition at line 107 of file notify.java.

  {
  }

void Notify::Initialize | ( | IAgentEx | agent,
 |  | IAgentCharacterEx | character,
 |  | int | commandID |
 | ) |  |  | [inline]

Definition at line 42 of file notify.java.

  {
    m_AgentEx = agent;
    m_Character = character;
    m_CommandID = commandID;
  }

void Notify::ListeningState | ( | int | characterID,
 |  | int | state,
 |  | int | cause |
 | ) |  |  | [inline]

Definition at line 127 of file notify.java.

  {
  }

void Notify::ListeningState | ( | int | characterID,
 |  | int | state,
 |  | int | cause |
 | ) |  |  | [inline]

Definition at line 103 of file Notify.java.

  {
  }

void Notify::Move | ( | int | characterID,
 |  | int | x,
 |  | int | y,
 |  | int | cause |
 | ) |  |  | [inline]

Definition at line 87 of file Notify.java.

  {
  }

void Notify::Move | ( | int | characterID,
 |  | int | x,
 |  | int | y,
 |  | int | cause |
 | ) |  |  | [inline]

Definition at line 111 of file notify.java.

  {
  }

void Notify::RequestComplete | ( | int | requestID,
 |  | int | status |
 | ) |  |  | [inline]

Definition at line 71 of file Notify.java.

  {
    if (requestID == m_DoneID[0])
    {
      m_Applet.HideCharacters();
    }
  }

void Notify::RequestComplete | ( | int | requestID,
 |  | int | status |
 | ) |  |  | [inline]

Definition at line 99 of file notify.java.

  {
  }

void Notify::RequestStart ( int requestID ) [inline]

Definition at line 95 of file notify.java.

  {
  }

void Notify::RequestStart ( int requestID ) [inline]

Definition at line 67 of file Notify.java.

  {
  }

void Notify::Restart ( ) [inline]

Definition at line 39 of file Notify.java.

  {
  }

void Notify::Restart ( ) [inline]

Definition at line 63 of file notify.java.

  {
  }

void Notify::Shutdown ( ) [inline]

Definition at line 47 of file Notify.java.

  {
  }

void Notify::Shutdown ( ) [inline]

Definition at line 71 of file notify.java.

  {
  }

void Notify::Size | ( | int | characterID,
 |  | int | width,
 |  | int | height |
 | ) |  |  | [inline]

Definition at line 91 of file Notify.java.

  {
  }

void Notify::Size | ( | int | characterID,
 |  | int | width,
 |  | int | height |
 | ) |  |  | [inline]

Definition at line 115 of file notify.java.

  {
  }

void Notify::VisibleState | ( | int | characterID,
 |  | int | visible,
 |  | int | cause |
 | ) |  |  | [inline]

Definition at line 103 of file notify.java.

  {
  }

void Notify::VisibleState | ( | int | characterID,
 |  | int | visible,
 |  | int | cause |
 | ) |  |  | [inline]

Definition at line 79 of file Notify.java.

  {
  }

Member Data Documentation

IAgentEx Notify::m_AgentEx = null [package]

Definition at line 29 of file notify.java.

Hello3J Notify::m_Applet [private]

Definition at line 24 of file Notify.java.

IAgentCharacterEx Notify::m_Character = null [package]

Definition at line 30 of file notify.java.

int Notify::m_CommandID = -1 [package]

Definition at line 32 of file notify.java.

int Notify::m_DoneID[] = {-1}

Definition at line 23 of file Notify.java.

int Notify::m_RequestID[] = {-1} [package]

Definition at line 31 of file notify.java.

final int Notify::MK_LBUTTON = 0x0001 [private]

Definition at line 35 of file notify.java.

final int Notify::TRUE = 1 [private]

Definition at line 34 of file notify.java.

The documentation for this class was generated from the following files:
  • Web/MSAgent/Java/Hello2/notify.java
  • Web/MSAgent/Java/Hello3/Notify.java
Generated on Wed Nov 13 2024 16:57:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Object_Property Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

Object_Property Struct Reference

#include "Service.h"

List of all members.

Public Attributes

wchar_t * | m_Name
ULONG m_State
CIMTYPE | m_Type
wchar_t * | m_Value

Detailed Description

Definition at line 33 of file Service.h.

Member Data Documentation

wchar_t* Object_Property::m_Name

Definition at line 37 of file Service.h.

ULONG Object_Property::m_State

Definition at line 35 of file Service.h.

CIMTYPE Object_Property::m_Type

Definition at line 36 of file Service.h.

wchar_t* Object_Property::m_Value

Definition at line 38 of file Service.h.

The documentation for this struct was generated from the following file:
  • SysMgmt/WMI/VC/decoupled/Instance_Provider/Include/Service.h
Generated on Wed Nov 13 2024 16:57:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: PaperForm::PaperForm Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • PaperForm
  • PaperForm::PaperForm
Public Member Functions | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes

PaperForm::PaperForm Class Reference

The PaperForm Sample Application form class. More...

List of all members.

Public Member Functions

PaperForm ()

Protected Member Functions

override void | Dispose (bool disposing)

Private Member Functions

void | InitializeComponent ()
void | miClear_Click (object sender, System.EventArgs e)
void | miEdit_Click (object sender, System.EventArgs e)
void | miEraser_Click (object sender, System.EventArgs e)
void | miExit_Click (object sender, System.EventArgs e)
void | miPen_Click (object sender, System.EventArgs e)
void | miRecognize_Click (object sender, System.EventArgs e)
void | PaperForm_Load (object sender, System.EventArgs e)
void | Recognize ()
void | UpdateEditMode (InkOverlayEditingMode mode)

Static Private Member Functions

static void | Main ()

Private Attributes

System.ComponentModel.Container | components = null
DataSet | formData = null
String | formDataFile = "formdata.xml"
InkPicture | inkPicture1 = null
System.Windows.Forms.MainMenu | mainMenu
System.Windows.Forms.MenuItem | menuItem4
System.Windows.Forms.MenuItem | miClear
System.Windows.Forms.MenuItem | miEdit
System.Windows.Forms.MenuItem | miEraser
System.Windows.Forms.MenuItem | miExit
System.Windows.Forms.MenuItem | miInk
System.Windows.Forms.MenuItem | miMode
System.Windows.Forms.MenuItem | miPen
System.Windows.Forms.MenuItem | miRecognize

Detailed Description

Definition at line 41 of file PaperForm.cs.

Constructor & Destructor Documentation

PaperForm::PaperForm::PaperForm ( ) [inline]

Definition at line 67 of file PaperForm.cs.

        {
            #region Standard Template Code
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            #endregion
        }

Member Function Documentation

override void PaperForm::PaperForm::Dispose ( bool disposing ) [inline, protected]

Clean up any resources being used.

Definition at line 81 of file PaperForm.cs.

        {
            if( disposing )
            {
                if (components != null)
                {
                    components.Dispose();
                }
            }
            base.Dispose( disposing );
        }

void PaperForm::PaperForm::InitializeComponent ( ) [inline, private]

Required method for Designer support - do not modify the contents of this method with the code editor.

Definition at line 99 of file PaperForm.cs.

        {
            this.inkPicture1 = new Microsoft.Ink.InkPicture();
            this.mainMenu = new System.Windows.Forms.MainMenu();
            this.miInk = new System.Windows.Forms.MenuItem();
            this.miRecognize = new System.Windows.Forms.MenuItem();
            this.miClear = new System.Windows.Forms.MenuItem();
            this.menuItem4 = new System.Windows.Forms.MenuItem();
            this.miExit = new System.Windows.Forms.MenuItem();
            this.miMode = new System.Windows.Forms.MenuItem();
            this.miPen = new System.Windows.Forms.MenuItem();
            this.miEdit = new System.Windows.Forms.MenuItem();
            this.miEraser = new System.Windows.Forms.MenuItem();
            this.SuspendLayout();
            //
            // inkPicture1
            //
            this.inkPicture1.Cursor = System.Windows.Forms.Cursors.Default;
            this.inkPicture1.InkEnabled = false;
            this.inkPicture1.MarginX = -1;
            this.inkPicture1.MarginY = -1;
            this.inkPicture1.Name = "inkPicture1";
            this.inkPicture1.Size = new System.Drawing.Size(717, 975);
            this.inkPicture1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
            this.inkPicture1.TabIndex = 4;
            this.inkPicture1.TabStop = false;
            //
            // mainMenu
            //
            this.mainMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                                this.miInk,
                                                                                this.miMode});
            //
            // miInk
            //
            this.miInk.Index = 0;
            this.miInk.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                                this.miRecognize,
                                                                                this.miClear,
                                                                                this.menuItem4,
                                                                                this.miExit});
            this.miInk.Text = "&Ink";
            //
            // miRecognize
            //
            this.miRecognize.Index = 0;
            this.miRecognize.Text = "&Recognize";
            this.miRecognize.Click += new System.EventHandler(this.miRecognize_Click);
            //
            // miClear
            //
            this.miClear.Index = 1;
            this.miClear.Text = "&Clear";
            this.miClear.Click += new System.EventHandler(this.miClear_Click);
            //
            // menuItem4
            //
            this.menuItem4.Index = 2;
            this.menuItem4.Text = "-";
            //
            // miExit
            //
            this.miExit.Index = 3;
            this.miExit.Text = "&Exit";
            this.miExit.Click += new System.EventHandler(this.miExit_Click);
            //
            // miMode
            //
            this.miMode.Index = 1;
            this.miMode.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                                this.miPen,
                                                                                this.miEdit,
                                                                                this.miEraser});
            this.miMode.Text = "&Mode";
            //
            // miPen
            //
            this.miPen.Checked = true;
            this.miPen.Index = 0;
            this.miPen.RadioCheck = true;
            this.miPen.Text = "&Pen";
            this.miPen.Click += new System.EventHandler(this.miPen_Click);
            //
            // miEdit
            //
            this.miEdit.Index = 1;
            this.miEdit.RadioCheck = true;
            this.miEdit.Text = "&Edit";
            this.miEdit.Click += new System.EventHandler(this.miEdit_Click);
            //
            // miEraser
            //
            this.miEraser.Index = 2;
            this.miEraser.RadioCheck = true;
            this.miEraser.Text = "E&raser";
            this.miEraser.Click += new System.EventHandler(this.miEraser_Click);
            //
            // PaperForm
            //
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.AutoScroll = true;
            this.ClientSize = new System.Drawing.Size(719, 817);
            this.Controls.AddRange(new System.Windows.Forms.Control[] {
                                                                          this.inkPicture1});
            this.DockPadding.All = 2;
            this.Menu = this.mainMenu;
            this.Name = "PaperForm";
            this.Text = "Scanned Paper Form Demo";
            this.Load += new System.EventHandler(this.PaperForm_Load);
            this.ResumeLayout(false);

        }

static void PaperForm::PaperForm::Main ( ) [inline, static, private]

The main entry point for the application.

Definition at line 218 of file PaperForm.cs.

        {
            Application.Run(new PaperForm());
        }

void PaperForm::PaperForm::miClear_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Clear Menu Item Click Event.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 266 of file PaperForm.cs.

        {
            // Delete the ink strokes and redraw
            inkPicture1.Ink.DeleteStrokes(inkPicture1.Ink.Strokes);
            inkPicture1.Invalidate();
        }

void PaperForm::PaperForm::miEdit_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Edit Menu Item Click Event.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 310 of file PaperForm.cs.

        {
            UpdateEditMode(InkOverlayEditingMode.Select);
        }

void PaperForm::PaperForm::miEraser_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Eraser Menu Item Click Event.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 320 of file PaperForm.cs.

        {
            UpdateEditMode(InkOverlayEditingMode.Delete);
        }

void PaperForm::PaperForm::miExit_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Exit Menu Item Click Event.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 289 of file PaperForm.cs.

        {
            inkPicture1.Enabled = false;
            Application.Exit();
        }

void PaperForm::PaperForm::miPen_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Pen Menu Item Click Event.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 300 of file PaperForm.cs.

        {
            UpdateEditMode(InkOverlayEditingMode.Ink);
        }

void PaperForm::PaperForm::miRecognize_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Recognize Menu Item Click Event.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 278 of file PaperForm.cs.

        {
            // Get the handwriting recognition results
            Recognize();
        }

void PaperForm::PaperForm::PaperForm_Load | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from PaperForm->Load Event.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 229 of file PaperForm.cs.

        {

            String applicationPath = Path.GetDirectoryName(Application.ExecutablePath)+"\\";

            // Initialize the form's dataset
            try
            {
                // read the form's data from the given xml file
                formData = new DataSet("FormData");
                formData.ReadXml(applicationPath+formDataFile);

                // The overlay control's background image is referenced in the xml dataset
                inkPicture1.BackgroundImage =
                    System.Drawing.Image.FromFile(applicationPath+
                    (string) formData.Tables["FormData"].Rows[0]["Image"]);
            }
            catch(FileNotFoundException error)
            {
                // If the xml or the scanned form image file are not available,
                // display an error and exit
                MessageBox.Show("A required data file was not found.  Please verify "+
                                "that the file exists in the same directory as PaperForm.exe "+
                                "and try again.\n\n"+error.ToString(),
                                "PaperForm",
                                MessageBoxButtons.OK);
                Application.Exit();
            }
            // Enable ink collection for the ink picture control
            inkPicture1.InkEnabled = true;
        }

void PaperForm::PaperForm::Recognize ( ) [inline, private]

Iterate through each row of the form data and display the recognition results.

Definition at line 347 of file PaperForm.cs.

        {

            // Check to ensure that the user has at least one recognizer installed
            Recognizers inkRecognizers = new Recognizers();
            if (0 == inkRecognizers.Count)
            {
                MessageBox.Show(this, "There are no handwriting recognizers installed.  You need to have at least one in order to perform the recognition.");
            }
            else
            {
                StringBuilder buffer = new StringBuilder();

                // Iterate through the rows in the "FieldInfo" table
                foreach(DataRow row in formData.Tables["FieldInfo"].Rows)
                {
                    // get the metadata for the field
                    // Note that the DataSet contains a row for each field
                    // in the form.  It is assumed that the rows are in the
                    // same order as the fields in the form.  The DataSet
                    // has the following columns:
                    // Name:  the field's name
                    // Left, Top, Right, Bottom:  the coordinates of the field (in pixels)
                    string fieldname = (string) row["Name"];
                    Point pt1 = new Point((int) row["Left"], (int) row["Top"]);
                    Point pt2 = new Point((int) row["Right"], (int) row["Bottom"]);

                    // Convert to ink space units
                    inkPicture1.Renderer.PixelToInkSpace(Handle, ref pt1);
                    inkPicture1.Renderer.PixelToInkSpace(Handle, ref pt2);

                    // the rectangle for the region
                    Rectangle rc = new Rectangle(pt1.X, pt1.Y, pt2.X-pt1.X, pt2.Y-pt1.Y);

                    // find the strokes that intersect and lie inside of the rectangle
                    Strokes strokes = inkPicture1.Ink.HitTest(rc,70);

                    // recognize the handwriting
                    if (strokes.Count > 0)
                    {
                        buffer.Append(fieldname + " = " + strokes.ToString() + Environment.NewLine);
                    }
                }

                // Display the results
                if (buffer.Length > 0)
                {
                    MessageBox.Show(this, buffer.ToString());
                }
                else
                {
                    MessageBox.Show(this, "There aren't any recognition results.");
                }
            }
        }

void PaperForm::PaperForm::UpdateEditMode ( InkOverlayEditingMode mode ) [inline, private]

UpdateEditMode is a helper method to switch the InkPicture's editing mode and update the form accordingly.

Parameters:
mode The new editing mode

Definition at line 330 of file PaperForm.cs.

        {
            // Ink collection must be disabled before modifying the edit mode
            inkPicture1.InkEnabled = false;
            inkPicture1.EditingMode = mode;
            inkPicture1.InkEnabled = true;

            // Update the menu UI to the new state
            miPen.Checked = InkOverlayEditingMode.Ink == mode;
            miEdit.Checked = InkOverlayEditingMode.Select == mode;
            miEraser.Checked = InkOverlayEditingMode.Delete == mode;
        }

Member Data Documentation

System.ComponentModel.Container PaperForm::PaperForm::components = null [private]

Definition at line 64 of file PaperForm.cs.

DataSet PaperForm::PaperForm::formData = null [private]

Definition at line 44 of file PaperForm.cs.

String PaperForm::PaperForm::formDataFile = "formdata.xml" [private]

Definition at line 50 of file PaperForm.cs.

InkPicture PaperForm::PaperForm::inkPicture1 = null [private]

Definition at line 47 of file PaperForm.cs.

System.Windows.Forms.MainMenu PaperForm::PaperForm::mainMenu [private]

Definition at line 55 of file PaperForm.cs.

System.Windows.Forms.MenuItem PaperForm::PaperForm::menuItem4 [private]

Definition at line 54 of file PaperForm.cs.

System.Windows.Forms.MenuItem PaperForm::PaperForm::miClear [private]

Definition at line 58 of file PaperForm.cs.

System.Windows.Forms.MenuItem PaperForm::PaperForm::miEdit [private]

Definition at line 62 of file PaperForm.cs.

System.Windows.Forms.MenuItem PaperForm::PaperForm::miEraser [private]

Definition at line 63 of file PaperForm.cs.

System.Windows.Forms.MenuItem PaperForm::PaperForm::miExit [private]

Definition at line 59 of file PaperForm.cs.

System.Windows.Forms.MenuItem PaperForm::PaperForm::miInk [private]

Definition at line 56 of file PaperForm.cs.

System.Windows.Forms.MenuItem PaperForm::PaperForm::miMode [private]

Definition at line 60 of file PaperForm.cs.

System.Windows.Forms.MenuItem PaperForm::PaperForm::miPen [private]

Definition at line 61 of file PaperForm.cs.

System.Windows.Forms.MenuItem PaperForm::PaperForm::miRecognize [private]

Definition at line 57 of file PaperForm.cs.

The documentation for this class was generated from the following file:
  • TabletPC/ScannedPaperForm/C#/PaperForm.cs
Generated on Wed Nov 13 2024 16:58:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ParametersVtbl Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

ParametersVtbl Struct Reference

#include "adoint.h"

List of all members.

Public Member Functions

BEGIN_INTERFACE | HRESULT (STDMETHODCALLTYPE __RPC_FAR *QueryInterface)(ADOParameters __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Item)(ADOParameters __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount)(ADOParameters __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Append)(ADOParameters __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Refresh)(ADOParameters __RPC_FAR *This)
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Count)(ADOParameters __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *_NewEnum)(ADOParameters __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Invoke)(ADOParameters __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Delete)(ADOParameters __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo)(ADOParameters __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames)(ADOParameters __RPC_FAR *This
ULONG (STDMETHODCALLTYPE __RPC_FAR *Release)(ADOParameters __RPC_FAR *This)
ULONG (STDMETHODCALLTYPE __RPC_FAR *AddRef)(ADOParameters __RPC_FAR *This)

Public Attributes

long __RPC_FAR * | c
REFIID LPOLESTR __RPC_FAR UINT | cNames
DISPID | dispIdMember
VARIANT | Index
UINT iTInfo
UINT LCID | lcid
REFIID LPOLESTR __RPC_FAR UINT LCID | lcid
DISPID REFIID LCID | lcid
IDispatch __RPC_FAR * | Object
UINT __RPC_FAR * | pctinfo
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR * 		pDispParams
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR EXCEPINFO __RPC_FAR * 		pExcepInfo
UINT LCID ITypeInfo __RPC_FAR
*__RPC_FAR * 		ppTInfo
IUnknown __RPC_FAR *__RPC_FAR * | ppvObject
BEGIN_INTERFACE REFIID void
__RPC_FAR *__RPC_FAR * 		ppvObject
VARIANT _ADOParameter
__RPC_FAR *__RPC_FAR * 		ppvObject
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR EXCEPINFO __RPC_FAR
UINT __RPC_FAR * 		puArgErr
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR * 		pVarResult
REFIID LPOLESTR __RPC_FAR UINT
LCID DISPID __RPC_FAR * 		rgDispId
REFIID LPOLESTR __RPC_FAR * | rgszNames
BEGIN_INTERFACE REFIID | riid
REFIID | riid
DISPID REFIID | riid
DISPID REFIID LCID WORD | wFlags

Detailed Description

Definition at line 4480 of file adoint.h.

Member Function Documentation

BEGIN_INTERFACE ParametersVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * QueryInterface )
ParametersVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Item )
ParametersVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetTypeInfoCount )
ParametersVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Append )
ParametersVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Refresh )
ParametersVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Count )
ParametersVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * _NewEnum )
ParametersVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Invoke )
ParametersVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Delete )
ParametersVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetTypeInfo )
ParametersVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetIDsOfNames )
ParametersVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * Release )
ParametersVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * AddRef )

Member Data Documentation

long __RPC_FAR* ParametersVtbl::c

Definition at line 4526 of file adoint.h.

REFIID LPOLESTR __RPC_FAR UINT ParametersVtbl::cNames

Definition at line 4507 of file adoint.h.

DISPID ParametersVtbl::dispIdMember

Definition at line 4515 of file adoint.h.

VARIANT ParametersVtbl::Index

Definition at line 4541 of file adoint.h.

UINT ParametersVtbl::iTInfo

Definition at line 4501 of file adoint.h.

UINT LCID ParametersVtbl::lcid

Definition at line 4501 of file adoint.h.

REFIID LPOLESTR __RPC_FAR UINT LCID ParametersVtbl::lcid

Definition at line 4507 of file adoint.h.

DISPID REFIID LCID ParametersVtbl::lcid

Definition at line 4515 of file adoint.h.

IDispatch __RPC_FAR* ParametersVtbl::Object

Definition at line 4537 of file adoint.h.

UINT __RPC_FAR* ParametersVtbl::pctinfo

Definition at line 4497 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR* ParametersVtbl::pDispParams

Definition at line 4515 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR EXCEPINFO __RPC_FAR* ParametersVtbl::pExcepInfo

Definition at line 4515 of file adoint.h.

UINT LCID ITypeInfo __RPC_FAR* __RPC_FAR* ParametersVtbl::ppTInfo

Definition at line 4501 of file adoint.h.

IUnknown __RPC_FAR* __RPC_FAR* ParametersVtbl::ppvObject

Definition at line 4530 of file adoint.h.

BEGIN_INTERFACE REFIID void __RPC_FAR* __RPC_FAR* ParametersVtbl::ppvObject

Definition at line 4486 of file adoint.h.

VARIANT _ADOParameter __RPC_FAR* __RPC_FAR* ParametersVtbl::ppvObject

Definition at line 4545 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR EXCEPINFO __RPC_FAR UINT __RPC_FAR* ParametersVtbl::puArgErr

Definition at line 4515 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR* ParametersVtbl::pVarResult

Definition at line 4515 of file adoint.h.

REFIID LPOLESTR __RPC_FAR UINT LCID DISPID __RPC_FAR* ParametersVtbl::rgDispId

Definition at line 4507 of file adoint.h.

REFIID LPOLESTR __RPC_FAR* ParametersVtbl::rgszNames

Definition at line 4507 of file adoint.h.

BEGIN_INTERFACE REFIID ParametersVtbl::riid

Definition at line 4486 of file adoint.h.

REFIID ParametersVtbl::riid

Definition at line 4507 of file adoint.h.

DISPID REFIID ParametersVtbl::riid

Definition at line 4515 of file adoint.h.

DISPID REFIID LCID WORD ParametersVtbl::wFlags

Definition at line 4515 of file adoint.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/rds/handler/vc/adoint.h
Generated on Wed Nov 13 2024 16:57:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: params Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

params Struct Reference

List of all members.

Public Attributes

BOOL bInProcess
DWORD dwObjectType
DWORD dwThreadType
TCHAR szMachine [300]

Detailed Description

Definition at line 29 of file Cancel.Cpp.

Member Data Documentation

BOOL params::bInProcess

Definition at line 31 of file Cancel.Cpp.

DWORD params::dwObjectType

Definition at line 33 of file Cancel.Cpp.

DWORD params::dwThreadType

Definition at line 32 of file Cancel.Cpp.

TCHAR params::szMachine[300]

Definition at line 34 of file Cancel.Cpp.

The documentation for this struct was generated from the following file:
  • Com/Fundamentals/DCom/Cancel/Client/Cancel.Cpp
Generated on Wed Nov 13 2024 16:57:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: perf Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

perf Struct Reference

List of all members.

Public Attributes

float | sec [3]
TCHAR * | szTest

Detailed Description

Definition at line 72 of file ComPerf.Cpp.

Member Data Documentation

float perf::sec[3]

Definition at line 75 of file ComPerf.Cpp.

TCHAR* perf::szTest

Definition at line 74 of file ComPerf.Cpp.

The documentation for this struct was generated from the following file:
  • Com/Fundamentals/DCom/ComPerf/ComPerf.Cpp
Generated on Wed Nov 13 2024 16:57:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: persistatl::INewsEvent Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • persistatl
  • persistatl::INewsEvent
Public Member Functions | Static Public Attributes

persistatl::INewsEvent Interface Reference

.interface(iid=4BF5E480-A5D3-11D2-AD4D-0080C7BFF6DB, thread=AUTO, type=DUAL)

Inherits com::ms::com::IUnknown.

Inherited by persistatl::INewsEventDefault.

List of all members.

Public Member Functions

void | LongQuote (String Symbol, double BidPrice, double AskPrice, String LastTradeTime, double LastTradePrice, double NetChange, double DailyHigh, double DailyLow, int AskSize, int BidSize, double OpenPrice, double ClosePrice, String CloseDate)
void | NewsFlash (double dtTimeStamp, String Symbol, String Headline, String URL)
void | ShortQuote (String Symbol, double BidPrice, double AskPrice, double LastTradeTime, double LastTradePrice, double NetChange, double DailyHigh, double DailyLow)

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x4bf5e480, (short)0xa5d3, (short)0x11d2, (byte)0xad, (byte)0x4d, (byte)0x0, (byte)0x80, (byte)0xc7, (byte)0xbf, (byte)0xf6, (byte)0xdb)

Detailed Description

Definition at line 20 of file INewsEvent.java.

Member Function Documentation

void persistatl::INewsEvent::LongQuote | ( | String | Symbol,
 |  | double | BidPrice,
 |  | double | AskPrice,
 |  | String | LastTradeTime,
 |  | double | LastTradePrice,
 |  | double | NetChange,
 |  | double | DailyHigh,
 |  | double | DailyLow,
 |  | int | AskSize,
 |  | int | BidSize,
 |  | double | OpenPrice,
 |  | double | ClosePrice,
 |  | String | CloseDate
 | ) |  |

.method(vtoffset=6, dispid=3, type=METHOD, name="LongQuote", addFlagsVtable=4) .parameters([in,type=STRING] Symbol, [in,type=R8] BidPrice, [in,type=R8] AskPrice, [in,type=STRING] LastTradeTime, [in,type=R8] LastTradePrice, [in,type=R8] NetChange, [in,type=R8] DailyHigh, [in,type=R8] DailyLow, [in,type=I4] AskSize, [in,type=I4] BidSize, [in,type=R8] OpenPrice, [in,type=R8] ClosePrice, [in,type=STRING] CloseDate)

Implemented in persistatl::INewsEventDefault, and persistatl::NewsEvent.

void persistatl::INewsEvent::NewsFlash | ( | double | dtTimeStamp,
 |  | String | Symbol,
 |  | String | Headline,
 |  | String | URL
 | ) |  |

.method(vtoffset=4, dispid=1, type=METHOD, name="NewsFlash", addFlagsVtable=4) .parameters([in,type=DATE] dtTimeStamp, [in,type=STRING] Symbol, [in,type=STRING] Headline, [in,type=STRING] URL)

Implemented in persistatl::INewsEventDefault, and persistatl::NewsEvent.

void persistatl::INewsEvent::ShortQuote | ( | String | Symbol,
 |  | double | BidPrice,
 |  | double | AskPrice,
 |  | double | LastTradeTime,
 |  | double | LastTradePrice,
 |  | double | NetChange,
 |  | double | DailyHigh,
 |  | double | DailyLow
 | ) |  |

.method(vtoffset=5, dispid=2, type=METHOD, name="ShortQuote", addFlagsVtable=4) .parameters([in,type=STRING] Symbol, [in,type=R8] BidPrice, [in,type=R8] AskPrice, [in,type=DATE] LastTradeTime, [in,type=R8] LastTradePrice, [in,type=R8] NetChange, [in,type=R8] DailyHigh, [in,type=R8] DailyLow)

Implemented in persistatl::INewsEventDefault, and persistatl::NewsEvent.

Member Data Documentation

final com.ms.com._Guid persistatl::INewsEvent::iid = new com.ms.com._Guid((int)0x4bf5e480, (short)0xa5d3, (short)0x11d2, (byte)0xad, (byte)0x4d, (byte)0x0, (byte)0x80, (byte)0xc7, (byte)0xbf, (byte)0xf6, (byte)0xdb) [static]

Implemented in persistatl::INewsEventDefault.

Definition at line 35 of file INewsEvent.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Events/EventNewsJAVA/PersistSubs/Persistatl/INewsEvent.java
Generated on Wed Nov 13 2024 16:58:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: persistatl::INewsEventDefault Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • persistatl
  • persistatl::INewsEventDefault
Public Member Functions | Static Public Attributes

persistatl::INewsEventDefault Interface Reference

.interface(iid=00020400-0000-0000-C000-000000000046, thread=AUTO, type=DUAL)

Inherits persistatl::INewsEvent.

Inherited by persistatl::NewsEvent.

List of all members.

Public Member Functions

void | LongQuote (String Symbol, double BidPrice, double AskPrice, String LastTradeTime, double LastTradePrice, double NetChange, double DailyHigh, double DailyLow, int AskSize, int BidSize, double OpenPrice, double ClosePrice, String CloseDate)
void | NewsFlash (double dtTimeStamp, String Symbol, String Headline, String URL)
void | ShortQuote (String Symbol, double BidPrice, double AskPrice, double LastTradeTime, double LastTradePrice, double NetChange, double DailyHigh, double DailyLow)

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x20400, (short)0x0, (short)0x0, (byte)0xc0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x46)

Detailed Description

Definition at line 20 of file INewsEventDefault.java.

Member Function Documentation

void persistatl::INewsEventDefault::LongQuote | ( | String | Symbol,
 |  | double | BidPrice,
 |  | double | AskPrice,
 |  | String | LastTradeTime,
 |  | double | LastTradePrice,
 |  | double | NetChange,
 |  | double | DailyHigh,
 |  | double | DailyLow,
 |  | int | AskSize,
 |  | int | BidSize,
 |  | double | OpenPrice,
 |  | double | ClosePrice,
 |  | String | CloseDate
 | ) |  |

.method(vtoffset=6, dispid=3, type=METHOD, name="LongQuote", addFlagsVtable=4) .parameters([in,type=STRING] Symbol, [in,type=R8] BidPrice, [in,type=R8] AskPrice, [in,type=STRING] LastTradeTime, [in,type=R8] LastTradePrice, [in,type=R8] NetChange, [in,type=R8] DailyHigh, [in,type=R8] DailyLow, [in,type=I4] AskSize, [in,type=I4] BidSize, [in,type=R8] OpenPrice, [in,type=R8] ClosePrice, [in,type=STRING] CloseDate)

Implements persistatl::INewsEvent.

Implemented in persistatl::NewsEvent.

void persistatl::INewsEventDefault::NewsFlash | ( | double | dtTimeStamp,
 |  | String | Symbol,
 |  | String | Headline,
 |  | String | URL
 | ) |  |

.method(vtoffset=4, dispid=1, type=METHOD, name="NewsFlash", addFlagsVtable=4) .parameters([in,type=DATE] dtTimeStamp, [in,type=STRING] Symbol, [in,type=STRING] Headline, [in,type=STRING] URL)

Implements persistatl::INewsEvent.

Implemented in persistatl::NewsEvent.

void persistatl::INewsEventDefault::ShortQuote | ( | String | Symbol,
 |  | double | BidPrice,
 |  | double | AskPrice,
 |  | double | LastTradeTime,
 |  | double | LastTradePrice,
 |  | double | NetChange,
 |  | double | DailyHigh,
 |  | double | DailyLow
 | ) |  |

.method(vtoffset=5, dispid=2, type=METHOD, name="ShortQuote", addFlagsVtable=4) .parameters([in,type=STRING] Symbol, [in,type=R8] BidPrice, [in,type=R8] AskPrice, [in,type=DATE] LastTradeTime, [in,type=R8] LastTradePrice, [in,type=R8] NetChange, [in,type=R8] DailyHigh, [in,type=R8] DailyLow)

Implements persistatl::INewsEvent.

Implemented in persistatl::NewsEvent.

Member Data Documentation

final com.ms.com._Guid persistatl::INewsEventDefault::iid = new com.ms.com._Guid((int)0x20400, (short)0x0, (short)0x0, (byte)0xc0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x46) [static]

Implements persistatl::INewsEvent.

Definition at line 35 of file INewsEventDefault.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Events/EventNewsJAVA/PersistSubs/Persistatl/INewsEventDefault.java
Generated on Wed Nov 13 2024 16:58:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: persistatl::NewsEvent Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • persistatl
  • persistatl::NewsEvent
Public Member Functions

persistatl::NewsEvent Class Reference

.register(clsid=6B834DA0-A5D3-11D2-AD4D-0080C7BFF6DB, typelib=04A47040-A5D3-11D2-AD4D-0080C7BFF6DB, version="1.0", description="NewsEvent Class")

Inherits com::ms::com::IUnknown, and persistatl::INewsEventDefault.

List of all members.

Public Member Functions

void | LongQuote (String Symbol, double BidPrice, double AskPrice, String LastTradeTime, double LastTradePrice, double NetChange, double DailyHigh, double DailyLow, int AskSize, int BidSize, double OpenPrice, double ClosePrice, String CloseDate)
void | NewsFlash (double dtTimeStamp, String Symbol, String Headline, String URL)
void | ShortQuote (String Symbol, double BidPrice, double AskPrice, double LastTradeTime, double LastTradePrice, double NetChange, double DailyHigh, double DailyLow)

Detailed Description

Definition at line 19 of file NewsEvent.java.

Member Function Documentation

void persistatl::NewsEvent::LongQuote | ( | String | Symbol,
 |  | double | BidPrice,
 |  | double | AskPrice,
 |  | String | LastTradeTime,
 |  | double | LastTradePrice,
 |  | double | NetChange,
 |  | double | DailyHigh,
 |  | double | DailyLow,
 |  | int | AskSize,
 |  | int | BidSize,
 |  | double | OpenPrice,
 |  | double | ClosePrice,
 |  | String | CloseDate |
 | ) |  |  | [inline]

Implements persistatl::INewsEventDefault.

Definition at line 31 of file NewsEvent.java.

  {
  }

void persistatl::NewsEvent::NewsFlash | ( | double | dtTimeStamp,
 |  | String | Symbol,
 |  | String | Headline,
 |  | String | URL |
 | ) |  |  | [inline]

Implements persistatl::INewsEventDefault.

Definition at line 21 of file NewsEvent.java.

  {
    com.ms.win32.User32.MessageBox (0,Headline,Symbol,0);

  }

void persistatl::NewsEvent::ShortQuote | ( | String | Symbol,
 |  | double | BidPrice,
 |  | double | AskPrice,
 |  | double | LastTradeTime,
 |  | double | LastTradePrice,
 |  | double | NetChange,
 |  | double | DailyHigh,
 |  | double | DailyLow |
 | ) |  |  | [inline]

Implements persistatl::INewsEventDefault.

Definition at line 27 of file NewsEvent.java.

  {
  }

The documentation for this class was generated from the following file:
  • Com/Services/Events/EventNewsJAVA/PersistSubs/Persistatl/NewsEvent.java
Generated on Wed Nov 13 2024 16:58:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: PersistedConfiguration Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

PersistedConfiguration Class Reference

List of all members.

Public Attributes

int | archiveQuotaPerStream
string | backendServer
string | cacheDirectoryPath
bool | cacheOnDemandCacheMiss
int | diskQuota
bool | enableCaching
bool | enableProxy
bool | handleUpstreamCacheRequests
protocolEnum protocol
bool | proxyOnDemandCacheMiss
string | reverseProxyRedirectURL

Detailed Description

Definition at line 24 of file cacheproxysampleplugin.cs.

Member Data Documentation

int PersistedConfiguration::archiveQuotaPerStream

Definition at line 34 of file cacheproxysampleplugin.cs.

string PersistedConfiguration::backendServer

Definition at line 42 of file cacheproxysampleplugin.cs.

string PersistedConfiguration::cacheDirectoryPath

Definition at line 28 of file cacheproxysampleplugin.cs.

bool PersistedConfiguration::cacheOnDemandCacheMiss

Definition at line 54 of file cacheproxysampleplugin.cs.

int PersistedConfiguration::diskQuota

Definition at line 31 of file cacheproxysampleplugin.cs.

bool PersistedConfiguration::enableCaching

Definition at line 45 of file cacheproxysampleplugin.cs.

bool PersistedConfiguration::enableProxy

Definition at line 48 of file cacheproxysampleplugin.cs.

bool PersistedConfiguration::handleUpstreamCacheRequests

Definition at line 57 of file cacheproxysampleplugin.cs.

protocolEnum PersistedConfiguration::protocol

Definition at line 60 of file cacheproxysampleplugin.cs.

bool PersistedConfiguration::proxyOnDemandCacheMiss

Definition at line 51 of file cacheproxysampleplugin.cs.

string PersistedConfiguration::reverseProxyRedirectURL

Definition at line 38 of file cacheproxysampleplugin.cs.

The documentation for this class was generated from the following file:
  • Multimedia/WindowsMediaServices9/CacheProxy/csharp/cacheproxysampleplugin.cs
Generated on Wed Nov 13 2024 16:57:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: PersistedConfigurationDataSet Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

PersistedConfigurationDataSet Class Reference

List of all members.

Public Attributes

PersistedConfiguration[] Items

Detailed Description

Definition at line 83 of file cacheproxysampleplugin.cs.

Member Data Documentation

PersistedConfiguration [] PersistedConfigurationDataSet::Items

Definition at line 87 of file cacheproxysampleplugin.cs.

The documentation for this class was generated from the following file:
  • Multimedia/WindowsMediaServices9/CacheProxy/csharp/cacheproxysampleplugin.cs
Generated on Wed Nov 13 2024 16:57:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: PickleControlBlock Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

PickleControlBlock Struct Reference

List of all members.

Public Attributes

unsigned long | LastSize
unsigned char * | pBufferStart
unsigned char * | pMemBuffer

Detailed Description

Definition at line 37 of file Picklpc.c.

Member Data Documentation

unsigned long PickleControlBlock::LastSize

Definition at line 41 of file Picklpc.c.

unsigned char * PickleControlBlock::pBufferStart

Definition at line 40 of file Picklpc.c.

unsigned char * PickleControlBlock::pMemBuffer

Definition at line 39 of file Picklpc.c.

The documentation for this struct was generated from the following files:
  • NetDS/RPC/Pickle/Picklp/Picklpc.c
  • NetDS/RPC/Pickle/Picklt/Pickltc.c
Generated on Wed Nov 13 2024 16:57:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: pipe_state Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

pipe_state Struct Reference

#include "Common.h"

List of all members.

Public Attributes

FILE * | hNew
FILE * | hOld
_TUCHAR * | pszNewName
_TUCHAR * | pszOldName

Detailed Description

Definition at line 32 of file Common.h.

Member Data Documentation

FILE* pipe_state::hNew

Definition at line 34 of file Common.h.

FILE* pipe_state::hOld

Definition at line 33 of file Common.h.

_TUCHAR* pipe_state::pszNewName

Definition at line 36 of file Common.h.

_TUCHAR* pipe_state::pszOldName

Definition at line 35 of file Common.h.

The documentation for this struct was generated from the following file:
  • NetDS/RPC/Pipes/Common.h
Generated on Wed Nov 13 2024 16:57:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: PLGTRMSMPLib::PlgTermSample Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • PLGTRMSMPLib
  • PLGTRMSMPLib::PlgTermSample

PLGTRMSMPLib::PlgTermSample Class Reference

import "plgtermsample.idl";

Detailed Description

Definition at line 35 of file plgtermsample.idl.

The documentation for this class was generated from the following file:
  • NetDS/Tapi/Tapi3/Cpp/pluggable/plgtermsample.idl
Generated on Wed Nov 13 2024 16:58:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: PMmStream Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

PMmStream Class Reference

#include "PMMStrm.Hxx"

Inherited by CMmStream.

List of all members.

Public Member Functions

virtual | ~PMmStream ()
virtual void | Close ()=0
virtual void | Flush (CMmStreamBuf &sbuf, ULONG cb)=0
virtual void | Flush ()
virtual BOOL | isEmpty ()=0
virtual BOOL | isWritable ()=0
virtual void | Map (CMmStreamBuf &sbuf, ULONG cb=0, ULONG offLow=0, ULONG offHigh=0, BOOL fMapForWrite=FALSE)=0
virtual void | MapAll (CMmStreamBuf &sbuf)=0
virtual BOOL | Ok ()=0
virtual void | SetSize (PStorage &storage, ULONG newSizeLow, ULONG newSizeHigh=0)=0
virtual ULONG | ShrinkFromFront (ULONG firstPage, ULONG numPages)
virtual LONGLONG | Size () const =0
virtual ULONG | SizeHigh ()=0
virtual ULONG | SizeLow ()=0
virtual void | Unmap (CMmStreamBuf &sbuf)=0

Detailed Description

Definition at line 90 of file PMMStrm.Hxx.

Constructor & Destructor Documentation

virtual PMmStream::~PMmStream ( ) [inline, virtual]

Definition at line 93 of file PMMStrm.Hxx.

{}

Member Function Documentation

virtual void PMmStream::Close ( ) [pure virtual]

Implemented in CMmStream.

virtual void PMmStream::Flush | ( | CMmStreamBuf & | sbuf,
 |  | ULONG | cb |
 | ) |  |  | [pure virtual]

Implemented in CMmStream.

virtual void PMmStream::Flush ( ) [inline, virtual]

Definition at line 125 of file PMMStrm.Hxx.

{}

virtual BOOL PMmStream::isEmpty ( ) [pure virtual]

Implemented in CMmStream.

virtual BOOL PMmStream::isWritable ( ) [pure virtual]

Implemented in CMmStream.

virtual void PMmStream::Map | ( | CMmStreamBuf & | sbuf,
 |  | ULONG | cb = 0,
 |  | ULONG | offLow = 0,
 |  | ULONG | offHigh = 0,
 |  | BOOL | fMapForWrite = FALSE |
 | ) |  |  | [pure virtual]

Implemented in CMmStream.

virtual void PMmStream::MapAll ( CMmStreamBuf & sbuf ) [pure virtual]

Implemented in CMmStream.

virtual BOOL PMmStream::Ok ( ) [pure virtual]

Implemented in CMmStream.

virtual void PMmStream::SetSize | ( | PStorage & | storage,
 |  | ULONG | newSizeLow,
 |  | ULONG | newSizeHigh = 0 |
 | ) |  |  | [pure virtual]

Implemented in CMmStream.

virtual ULONG PMmStream::ShrinkFromFront | ( | ULONG | firstPage,
 |  | ULONG | numPages |
 | ) |  |  | [inline, virtual]

Definition at line 127 of file PMMStrm.Hxx.

{ return 0; }

virtual LONGLONG PMmStream::Size ( ) const [pure virtual]

Implemented in CMmStream.

virtual ULONG PMmStream::SizeHigh ( ) [pure virtual]

Implemented in CMmStream.

virtual ULONG PMmStream::SizeLow ( ) [pure virtual]

Implemented in CMmStream.

virtual void PMmStream::Unmap ( CMmStreamBuf & sbuf ) [pure virtual]

Implemented in CMmStream.

The documentation for this class was generated from the following file:
  • WinBase/Indexing/IFilter/PMMStrm.Hxx
Generated on Wed Nov 13 2024 16:57:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: POINT3D Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

POINT3D Struct Reference

#include "Paint.h"

List of all members.

Public Attributes

LONG | x
LONG | y
LONG | z

Detailed Description

Definition at line 24 of file Paint.h.

Member Data Documentation

LONG POINT3D::x

Definition at line 26 of file Paint.h.

LONG POINT3D::y

Definition at line 26 of file Paint.h.

LONG POINT3D::z

Definition at line 26 of file Paint.h.

The documentation for this struct was generated from the following file:
  • WinUI/Controls/Custom/SpinCube/Paint.h
Generated on Wed Nov 13 2024 16:57:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: port_hdr Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

port_hdr Struct Reference

#include "iphdr.h"

List of all members.

Public Attributes

unsigned short | dest_portno
unsigned short | src_portno

Detailed Description

Definition at line 79 of file iphdr.h.

Member Data Documentation

unsigned short port_hdr::dest_portno

Definition at line 82 of file iphdr.h.

unsigned short port_hdr::src_portno

Definition at line 81 of file iphdr.h.

The documentation for this struct was generated from the following file:
  • NetDS/WinSock/rcvall/iphdr.h
Generated on Wed Nov 13 2024 16:57:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: PRIMARYKEY Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

PRIMARYKEY Struct Reference

#include "table.h"

List of all members.

Public Attributes

WCHAR wszColName [MAX_NAME_LEN]

Detailed Description

Definition at line 73 of file table.h.

Member Data Documentation

WCHAR PRIMARYKEY::wszColName[MAX_NAME_LEN]

Definition at line 75 of file table.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/oledb/tablecopy/table.h
Generated on Wed Nov 13 2024 16:57:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: PrintContext Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

PrintContext Struct Reference

#include "table.h"

List of all members.

Public Attributes

lpTitle foot
lpTitle head
DWORD_PTR | id
lpMargin margin
PRINTDLG FAR * | pd

Detailed Description

Definition at line 317 of file table.h.

Member Data Documentation

lpTitle PrintContext::foot

Definition at line 320 of file table.h.

lpTitle PrintContext::head

Definition at line 319 of file table.h.

DWORD_PTR PrintContext::id

Definition at line 318 of file table.h.

lpMargin PrintContext::margin

Definition at line 321 of file table.h.

PRINTDLG FAR* PrintContext::pd

Definition at line 322 of file table.h.

The documentation for this struct was generated from the following file:
  • Begin/sdkdiff/table.h
Generated on Wed Nov 13 2024 16:57:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: PRIVCLIPDATA Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

PRIVCLIPDATA Struct Reference

#include "Utility.h"

List of all members.

Public Attributes

UINT aoffset [1]
UINT cidl
BOOL fCut

Detailed Description

Definition at line 42 of file Utility.h.

Member Data Documentation

UINT PRIVCLIPDATA::aoffset[1]

Definition at line 45 of file Utility.h.

UINT PRIVCLIPDATA::cidl

Definition at line 44 of file Utility.h.

BOOL PRIVCLIPDATA::fCut

Definition at line 43 of file Utility.h.

The documentation for this struct was generated from the following file:
  • WinUI/Shell/SampView/Utility.h
Generated on Wed Nov 13 2024 16:57:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: PROFILE_STRUCT Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

PROFILE_STRUCT Struct Reference

#include "DebMain.h"

List of all members.

Public Attributes

DWORD DebugErrorLevel
LONG | DebuggeePriority
LONG | DebugMode
BOOL fClearOnNew
BOOL fMaximized
BOOL fMinimized
BOOL fSavedDirectory
BOOL fSaveOnExit
BOOL fSavePreferences
BOOL fShowSymbols
BOOL fToolBar
BOOL fVerbose
LOGFONT | LogFont
INT | nHeight
INT | nWidth
COLORREF | rgbBackColor
COLORREF | rgbForeColor
TCHAR | szInitialDir [MAX_PATH]
INT | xPos
INT | yPos

Detailed Description

Definition at line 27 of file DebMain.h.

Member Data Documentation

DWORD PROFILE_STRUCT::DebugErrorLevel

Definition at line 45 of file DebMain.h.

LONG PROFILE_STRUCT::DebuggeePriority

Definition at line 44 of file DebMain.h.

LONG PROFILE_STRUCT::DebugMode

Definition at line 43 of file DebMain.h.

BOOL PROFILE_STRUCT::fClearOnNew

Definition at line 40 of file DebMain.h.

BOOL PROFILE_STRUCT::fMaximized

Definition at line 32 of file DebMain.h.

BOOL PROFILE_STRUCT::fMinimized

Definition at line 33 of file DebMain.h.

BOOL PROFILE_STRUCT::fSavedDirectory

Definition at line 35 of file DebMain.h.

BOOL PROFILE_STRUCT::fSaveOnExit

Definition at line 47 of file DebMain.h.

BOOL PROFILE_STRUCT::fSavePreferences

Definition at line 46 of file DebMain.h.

BOOL PROFILE_STRUCT::fShowSymbols

Definition at line 42 of file DebMain.h.

BOOL PROFILE_STRUCT::fToolBar

Definition at line 34 of file DebMain.h.

BOOL PROFILE_STRUCT::fVerbose

Definition at line 41 of file DebMain.h.

LOGFONT PROFILE_STRUCT::LogFont

Definition at line 37 of file DebMain.h.

INT PROFILE_STRUCT::nHeight

Definition at line 31 of file DebMain.h.

INT PROFILE_STRUCT::nWidth

Definition at line 30 of file DebMain.h.

COLORREF PROFILE_STRUCT::rgbBackColor

Definition at line 39 of file DebMain.h.

COLORREF PROFILE_STRUCT::rgbForeColor

Definition at line 38 of file DebMain.h.

TCHAR PROFILE_STRUCT::szInitialDir[MAX_PATH]

Definition at line 36 of file DebMain.h.

INT PROFILE_STRUCT::xPos

Definition at line 28 of file DebMain.h.

INT PROFILE_STRUCT::yPos

Definition at line 29 of file DebMain.h.

The documentation for this struct was generated from the following file:
  • WinBase/Debug/Deb/DebMain.h
Generated on Wed Nov 13 2024 16:57:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: PropertiesVtbl Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

PropertiesVtbl Struct Reference

#include "adoint.h"

List of all members.

Public Member Functions

BEGIN_INTERFACE | HRESULT (STDMETHODCALLTYPE __RPC_FAR *QueryInterface)(ADOProperties __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Item)(ADOProperties __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Refresh)(ADOProperties __RPC_FAR *This)
HRESULT (STDMETHODCALLTYPE __RPC_FAR *_NewEnum)(ADOProperties __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount)(ADOProperties __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Invoke)(ADOProperties __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Count)(ADOProperties __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo)(ADOProperties __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames)(ADOProperties __RPC_FAR *This
ULONG (STDMETHODCALLTYPE __RPC_FAR *AddRef)(ADOProperties __RPC_FAR *This)
ULONG (STDMETHODCALLTYPE __RPC_FAR *Release)(ADOProperties __RPC_FAR *This)

Public Attributes

long __RPC_FAR * | c
REFIID LPOLESTR __RPC_FAR UINT | cNames
DISPID | dispIdMember
VARIANT | Index
UINT iTInfo
UINT LCID | lcid
REFIID LPOLESTR __RPC_FAR UINT LCID | lcid
DISPID REFIID LCID | lcid
UINT __RPC_FAR * | pctinfo
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR * 		pDispParams
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR EXCEPINFO __RPC_FAR * 		pExcepInfo
UINT LCID ITypeInfo __RPC_FAR
*__RPC_FAR * 		ppTInfo
IUnknown __RPC_FAR *__RPC_FAR * | ppvObject
VARIANT ADOProperty __RPC_FAR
*__RPC_FAR * 		ppvObject
BEGIN_INTERFACE REFIID void
__RPC_FAR *__RPC_FAR * 		ppvObject
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR EXCEPINFO __RPC_FAR
UINT __RPC_FAR * 		puArgErr
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR * 		pVarResult
REFIID LPOLESTR __RPC_FAR UINT
LCID DISPID __RPC_FAR * 		rgDispId
REFIID LPOLESTR __RPC_FAR * | rgszNames
BEGIN_INTERFACE REFIID | riid
REFIID | riid
DISPID REFIID | riid
DISPID REFIID LCID WORD | wFlags

Detailed Description

Definition at line 4805 of file adoint.h.

Member Function Documentation

BEGIN_INTERFACE PropertiesVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * QueryInterface )
PropertiesVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Item )
PropertiesVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Refresh )
PropertiesVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * _NewEnum )
PropertiesVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetTypeInfoCount )
PropertiesVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Invoke )
PropertiesVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Count )
PropertiesVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetTypeInfo )
PropertiesVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetIDsOfNames )
PropertiesVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * AddRef )
PropertiesVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * Release )

Member Data Documentation

long __RPC_FAR* PropertiesVtbl::c

Definition at line 4851 of file adoint.h.

REFIID LPOLESTR __RPC_FAR UINT PropertiesVtbl::cNames

Definition at line 4832 of file adoint.h.

DISPID PropertiesVtbl::dispIdMember

Definition at line 4840 of file adoint.h.

VARIANT PropertiesVtbl::Index

Definition at line 4862 of file adoint.h.

UINT PropertiesVtbl::iTInfo

Definition at line 4826 of file adoint.h.

UINT LCID PropertiesVtbl::lcid

Definition at line 4826 of file adoint.h.

REFIID LPOLESTR __RPC_FAR UINT LCID PropertiesVtbl::lcid

Definition at line 4832 of file adoint.h.

DISPID REFIID LCID PropertiesVtbl::lcid

Definition at line 4840 of file adoint.h.

UINT __RPC_FAR* PropertiesVtbl::pctinfo

Definition at line 4822 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR* PropertiesVtbl::pDispParams

Definition at line 4840 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR EXCEPINFO __RPC_FAR* PropertiesVtbl::pExcepInfo

Definition at line 4840 of file adoint.h.

UINT LCID ITypeInfo __RPC_FAR* __RPC_FAR* PropertiesVtbl::ppTInfo

Definition at line 4826 of file adoint.h.

IUnknown __RPC_FAR* __RPC_FAR* PropertiesVtbl::ppvObject

Definition at line 4855 of file adoint.h.

VARIANT ADOProperty __RPC_FAR* __RPC_FAR* PropertiesVtbl::ppvObject

Definition at line 4862 of file adoint.h.

BEGIN_INTERFACE REFIID void __RPC_FAR* __RPC_FAR* PropertiesVtbl::ppvObject

Definition at line 4811 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR EXCEPINFO __RPC_FAR UINT __RPC_FAR* PropertiesVtbl::puArgErr

Definition at line 4840 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR* PropertiesVtbl::pVarResult

Definition at line 4840 of file adoint.h.

REFIID LPOLESTR __RPC_FAR UINT LCID DISPID __RPC_FAR* PropertiesVtbl::rgDispId

Definition at line 4832 of file adoint.h.

REFIID LPOLESTR __RPC_FAR* PropertiesVtbl::rgszNames

Definition at line 4832 of file adoint.h.

BEGIN_INTERFACE REFIID PropertiesVtbl::riid

Definition at line 4811 of file adoint.h.

REFIID PropertiesVtbl::riid

Definition at line 4832 of file adoint.h.

DISPID REFIID PropertiesVtbl::riid

Definition at line 4840 of file adoint.h.

DISPID REFIID LCID WORD PropertiesVtbl::wFlags

Definition at line 4840 of file adoint.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/rds/handler/vc/adoint.h
Generated on Wed Nov 13 2024 16:57:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: PropertyVtbl Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

PropertyVtbl Struct Reference

#include "adoint.h"

List of all members.

Public Member Functions

BEGIN_INTERFACE | HRESULT (STDMETHODCALLTYPE __RPC_FAR *QueryInterface)(ADOProperty __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *put_Attributes)(ADOProperty __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount)(ADOProperty __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Type)(ADOProperty __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Name)(ADOProperty __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Value)(ADOProperty __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *put_Value)(ADOProperty __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *Invoke)(ADOProperty __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *get_Attributes)(ADOProperty __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo)(ADOProperty __RPC_FAR *This
HRESULT (STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames)(ADOProperty __RPC_FAR *This
ULONG (STDMETHODCALLTYPE __RPC_FAR *Release)(ADOProperty __RPC_FAR *This)
ULONG (STDMETHODCALLTYPE __RPC_FAR *AddRef)(ADOProperty __RPC_FAR *This)

Public Attributes

REFIID LPOLESTR __RPC_FAR UINT | cNames
DISPID | dispIdMember
UINT iTInfo
long | lAttributes
UINT LCID | lcid
REFIID LPOLESTR __RPC_FAR UINT LCID | lcid
DISPID REFIID LCID | lcid
BSTR __RPC_FAR * | pbstr
UINT __RPC_FAR * | pctinfo
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR * 		pDispParams
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR EXCEPINFO __RPC_FAR * 		pExcepInfo
long __RPC_FAR * | plAttributes
UINT LCID ITypeInfo __RPC_FAR
*__RPC_FAR * 		ppTInfo
BEGIN_INTERFACE REFIID void
__RPC_FAR *__RPC_FAR * 		ppvObject
DataTypeEnum __RPC_FAR * | ptype
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR EXCEPINFO __RPC_FAR
UINT __RPC_FAR * 		puArgErr
VARIANT __RPC_FAR * | pval
DISPID REFIID LCID WORD
DISPPARAMS __RPC_FAR VARIANT
__RPC_FAR * 		pVarResult
REFIID LPOLESTR __RPC_FAR UINT
LCID DISPID __RPC_FAR * 		rgDispId
REFIID LPOLESTR __RPC_FAR * | rgszNames
REFIID | riid
BEGIN_INTERFACE REFIID | riid
DISPID REFIID | riid
VARIANT | val
DISPID REFIID LCID WORD | wFlags

Detailed Description

Definition at line 4630 of file adoint.h.

Member Function Documentation

BEGIN_INTERFACE PropertyVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * QueryInterface )
PropertyVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * put_Attributes )
PropertyVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetTypeInfoCount )
PropertyVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Type )
PropertyVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Name )
PropertyVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Value )
PropertyVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * put_Value )
PropertyVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * Invoke )
PropertyVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * get_Attributes )
PropertyVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetTypeInfo )
PropertyVtbl::HRESULT ( STDMETHODCALLTYPE __RPC_FAR * GetIDsOfNames )
PropertyVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * Release )
PropertyVtbl::ULONG ( STDMETHODCALLTYPE __RPC_FAR * AddRef )

Member Data Documentation

REFIID LPOLESTR __RPC_FAR UINT PropertyVtbl::cNames

Definition at line 4657 of file adoint.h.

DISPID PropertyVtbl::dispIdMember

Definition at line 4665 of file adoint.h.

UINT PropertyVtbl::iTInfo

Definition at line 4651 of file adoint.h.

long PropertyVtbl::lAttributes

Definition at line 4696 of file adoint.h.

UINT LCID PropertyVtbl::lcid

Definition at line 4651 of file adoint.h.

REFIID LPOLESTR __RPC_FAR UINT LCID PropertyVtbl::lcid

Definition at line 4657 of file adoint.h.

DISPID REFIID LCID PropertyVtbl::lcid

Definition at line 4665 of file adoint.h.

BSTR __RPC_FAR* PropertyVtbl::pbstr

Definition at line 4684 of file adoint.h.

UINT __RPC_FAR* PropertyVtbl::pctinfo

Definition at line 4647 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR* PropertyVtbl::pDispParams

Definition at line 4665 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR EXCEPINFO __RPC_FAR* PropertyVtbl::pExcepInfo

Definition at line 4665 of file adoint.h.

long __RPC_FAR* PropertyVtbl::plAttributes

Definition at line 4692 of file adoint.h.

UINT LCID ITypeInfo __RPC_FAR* __RPC_FAR* PropertyVtbl::ppTInfo

Definition at line 4651 of file adoint.h.

BEGIN_INTERFACE REFIID void __RPC_FAR* __RPC_FAR* PropertyVtbl::ppvObject

Definition at line 4636 of file adoint.h.

DataTypeEnum __RPC_FAR* PropertyVtbl::ptype

Definition at line 4688 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR EXCEPINFO __RPC_FAR UINT __RPC_FAR* PropertyVtbl::puArgErr

Definition at line 4665 of file adoint.h.

VARIANT __RPC_FAR* PropertyVtbl::pval

Definition at line 4676 of file adoint.h.

DISPID REFIID LCID WORD DISPPARAMS __RPC_FAR VARIANT __RPC_FAR* PropertyVtbl::pVarResult

Definition at line 4665 of file adoint.h.

REFIID LPOLESTR __RPC_FAR UINT LCID DISPID __RPC_FAR* PropertyVtbl::rgDispId

Definition at line 4657 of file adoint.h.

REFIID LPOLESTR __RPC_FAR* PropertyVtbl::rgszNames

Definition at line 4657 of file adoint.h.

REFIID PropertyVtbl::riid

Definition at line 4657 of file adoint.h.

BEGIN_INTERFACE REFIID PropertyVtbl::riid

Definition at line 4636 of file adoint.h.

DISPID REFIID PropertyVtbl::riid

Definition at line 4665 of file adoint.h.

VARIANT PropertyVtbl::val

Definition at line 4680 of file adoint.h.

DISPID REFIID LCID WORD PropertyVtbl::wFlags

Definition at line 4665 of file adoint.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/rds/handler/vc/adoint.h
Generated on Wed Nov 13 2024 16:57:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Props Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

Props Struct Reference

#include "table.h"

List of all members.

Public Attributes

UINT alignment
DWORD backcolour
UINT box
DWORD forecolour
DWORD forecolourws
int | height
HFONT | hFont
UINT valid
int | width

Detailed Description

Definition at line 129 of file table.h.

Member Data Documentation

UINT Props::alignment

Definition at line 141 of file table.h.

DWORD Props::backcolour

Definition at line 136 of file table.h.

UINT Props::box

Definition at line 142 of file table.h.

DWORD Props::forecolour

Definition at line 134 of file table.h.

DWORD Props::forecolourws

Definition at line 135 of file table.h.

int Props::height

Definition at line 146 of file table.h.

HFONT Props::hFont

Definition at line 140 of file table.h.

UINT Props::valid

Definition at line 130 of file table.h.

int Props::width

Definition at line 145 of file table.h.

The documentation for this struct was generated from the following file:
  • Begin/sdkdiff/table.h
Generated on Wed Nov 13 2024 16:57:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Provider_Globals Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Static Public Member Functions | Static Public Attributes

Provider_Globals Class Reference

#include "Globals.h"

List of all members.

Static Public Member Functions

static HRESULT | CreateInstance (const CLSID &a_ReferenceClsid, LPUNKNOWN a_OuterUnknown, const DWORD &a_ClassContext, const UUID &a_ReferenceInterfaceId, void **a_ObjectInterface)
static HRESULT | CreateInstance (const CLSID &a_ReferenceClsid, LPUNKNOWN a_OuterUnknown, const DWORD &a_ClassContext, const UUID &a_ReferenceInterfaceId, void **a_ObjectInterface)
static HRESULT | CreateInstance (const CLSID &a_ReferenceClsid, LPUNKNOWN a_OuterUnknown, const DWORD &a_ClassContext, const UUID &a_ReferenceInterfaceId, void **a_ObjectInterface)
static HRESULT | Global_Shutdown ()
static HRESULT | Global_Shutdown ()
static HRESULT | Global_Shutdown ()
static HRESULT | Global_Startup ()
static HRESULT | Global_Startup ()
static HRESULT | Global_Startup ()

Static Public Attributes

static LONG | s_LocksInProgress
static LONG | s_ObjectsInProgress

Detailed Description

Definition at line 31 of file Globals.h.

Member Function Documentation

HRESULT Provider_Globals::CreateInstance | ( | const CLSID & | a_ReferenceClsid,
 |  | LPUNKNOWN | a_OuterUnknown,
 |  | const DWORD & | a_ClassContext,
 |  | const UUID & | a_ReferenceInterfaceId,
 |  | void ** | a_ObjectInterface |
 | ) |  |  | [static]

Definition at line 90 of file Globals.cpp.

{
  HRESULT t_Result = S_OK ;

#if 1

/*
 *  Use standard implementation
 */

   t_Result = CoCreateInstance (

    a_ReferenceClsid ,
    a_OuterUnknown ,
    a_ClassContext ,
    a_ReferenceInterfaceId ,
    ( void ** )  a_ObjectInterface
  );

#else

/*
 *  Tweak configuration settings for call.
 */

  COAUTHIDENTITY t_AuthenticationIdentity ;
  ZeroMemory ( & t_AuthenticationIdentity , sizeof ( t_AuthenticationIdentity ) ) ;

  t_AuthenticationIdentity.User = NULL ;
  t_AuthenticationIdentity.UserLength = 0 ;
  t_AuthenticationIdentity.Domain = NULL ;
  t_AuthenticationIdentity.DomainLength = 0 ;
  t_AuthenticationIdentity.Password = NULL ;
  t_AuthenticationIdentity.PasswordLength = 0 ;
  t_AuthenticationIdentity.Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE ;

  COAUTHINFO t_AuthenticationInfo ;
  ZeroMemory ( & t_AuthenticationInfo , sizeof ( t_AuthenticationInfo ) ) ;

    t_AuthenticationInfo.dwAuthnSvc = RPC_C_AUTHN_DEFAULT ;
    t_AuthenticationInfo.dwAuthzSvc = RPC_C_AUTHZ_DEFAULT ;
    t_AuthenticationInfo.pwszServerPrincName = NULL ;
    t_AuthenticationInfo.dwAuthnLevel = RPC_C_AUTHN_LEVEL_PKT_PRIVACY; // RPC_C_AUTHN_LEVEL_CONNECT ;
    t_AuthenticationInfo.dwImpersonationLevel = RPC_C_IMP_LEVEL_IMPERSONATE  ;
    t_AuthenticationInfo.dwCapabilities = EOAC_NONE ;
    t_AuthenticationInfo.pAuthIdentityData = NULL ;

  COSERVERINFO t_ServerInfo ;
  ZeroMemory ( & t_ServerInfo , sizeof ( t_ServerInfo ) ) ;

  t_ServerInfo.pwszName = NULL ;
    t_ServerInfo.dwReserved2 = 0 ;
    t_ServerInfo.pAuthInfo = & t_AuthenticationInfo ;

  IClassFactory *t_ClassFactory = NULL ;

  t_Result = CoGetClassObject (

    a_ReferenceClsid ,
    a_ClassContext ,
    & t_ServerInfo ,
    IID_IClassFactory ,
    ( void ** )  & t_ClassFactory
  ) ;

  if ( SUCCEEDED ( t_Result ) )
  {
    t_Result = t_ClassFactory->CreateInstance (

      a_OuterUnknown ,
      a_ReferenceInterfaceId ,
      a_ObjectInterface
    );

    t_ClassFactory->Release () ;
  }

#endif

  return t_Result ;
}

static HRESULT Provider_Globals::CreateInstance | ( | const CLSID & | a_ReferenceClsid,
 |  | LPUNKNOWN | a_OuterUnknown,
 |  | const DWORD & | a_ClassContext,
 |  | const UUID & | a_ReferenceInterfaceId,
 |  | void ** | a_ObjectInterface |
 | ) |  |  | [static]
static HRESULT Provider_Globals::CreateInstance | ( | const CLSID & | a_ReferenceClsid,
 |  | LPUNKNOWN | a_OuterUnknown,
 |  | const DWORD & | a_ClassContext,
 |  | const UUID & | a_ReferenceInterfaceId,
 |  | void ** | a_ObjectInterface |
 | ) |  |  | [static]
static HRESULT Provider_Globals::Global_Shutdown ( ) [static]
static HRESULT Provider_Globals::Global_Shutdown ( ) [static]
HRESULT Provider_Globals::Global_Shutdown ( ) [static]

Definition at line 72 of file Globals.cpp.

{
  HRESULT t_Result = S_OK ;
  return t_Result ;
}

static HRESULT Provider_Globals::Global_Startup ( ) [static]
HRESULT Provider_Globals::Global_Startup ( ) [static]

Definition at line 54 of file Globals.cpp.

{
  HRESULT t_Result = S_OK ;
  return t_Result ;
}

static HRESULT Provider_Globals::Global_Startup ( ) [static]

Member Data Documentation

static LONG Provider_Globals::s_LocksInProgress [static]

Definition at line 37 of file Globals.h.

static LONG Provider_Globals::s_ObjectsInProgress [static]

Definition at line 38 of file Globals.h.

The documentation for this class was generated from the following files:
  • SysMgmt/WMI/VC/decoupled/Event_Consumer/Include/Globals.h
  • SysMgmt/WMI/VC/decoupled/Event_Provider/Include/Globals.h
  • SysMgmt/WMI/VC/decoupled/Instance_Provider/Include/Globals.h
  • SysMgmt/WMI/VC/decoupled/Event_Consumer/Globals.cpp
  • SysMgmt/WMI/VC/decoupled/Event_Provider/Globals.cpp
  • SysMgmt/WMI/VC/decoupled/Instance_Provider/Globals.cpp
Generated on Wed Nov 13 2024 16:57:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: PROVIDERINFO Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

PROVIDERINFO Struct Reference

#include "datasource.h"

List of all members.

Public Attributes

WCHAR | wszDescription [MAX_NAME_LEN]
WCHAR | wszName [MAX_NAME_LEN]
WCHAR | wszParseName [MAX_NAME_LEN]
DBTYPE | wType

Detailed Description

Definition at line 22 of file datasource.h.

Member Data Documentation

WCHAR PROVIDERINFO::wszDescription[MAX_NAME_LEN]

Definition at line 26 of file datasource.h.

WCHAR PROVIDERINFO::wszName[MAX_NAME_LEN]

Definition at line 24 of file datasource.h.

WCHAR PROVIDERINFO::wszParseName[MAX_NAME_LEN]

Definition at line 25 of file datasource.h.

DBTYPE PROVIDERINFO::wType

Definition at line 27 of file datasource.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/oledb/tablecopy/datasource.h
Generated on Wed Nov 13 2024 16:57:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: PROVTYPEINFO Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

PROVTYPEINFO Struct Reference

#include "csession.h"

List of all members.

Public Attributes

SHORT | iMaxScale
DBLENGTH | ulColumnSize
WCHAR | wszTypeName [MAX_NAME_LEN]
DBTYPE | wType

Detailed Description

Definition at line 26 of file csession.h.

Member Data Documentation

SHORT PROVTYPEINFO::iMaxScale

Definition at line 31 of file csession.h.

DBLENGTH PROVTYPEINFO::ulColumnSize

Definition at line 30 of file csession.h.

WCHAR PROVTYPEINFO::wszTypeName[MAX_NAME_LEN]

Definition at line 28 of file csession.h.

DBTYPE PROVTYPEINFO::wType

Definition at line 29 of file csession.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/oledb/rowsetviewer/csession.h
Generated on Wed Nov 13 2024 16:57:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: qcnotify::_ShipStatus Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • qcnotify
  • qcnotify::_ShipStatus
Static Public Attributes

qcnotify::_ShipStatus Class Reference

List of all members.

Static Public Attributes

static final short | ssBackOrdered = 2
static final short | ssNotStocked = 3
static final short | ssShipped = 1
static final short | ssUnprocessed = 0
static final short | ssUnrecognizedItem = 4

Detailed Description

Definition at line 20 of file _ShipStatus.java.

Member Data Documentation

final short qcnotify::_ShipStatus::ssBackOrdered = 2 [static]

Definition at line 24 of file _ShipStatus.java.

final short qcnotify::_ShipStatus::ssNotStocked = 3 [static]

Definition at line 25 of file _ShipStatus.java.

final short qcnotify::_ShipStatus::ssShipped = 1 [static]

Definition at line 23 of file _ShipStatus.java.

final short qcnotify::_ShipStatus::ssUnprocessed = 0 [static]

Definition at line 22 of file _ShipStatus.java.

final short qcnotify::_ShipStatus::ssUnrecognizedItem = 4 [static]

Definition at line 26 of file _ShipStatus.java.

The documentation for this class was generated from the following file:
  • Com/Services/Queued_Components/QCJAVA/Components/qcNotify/_ShipStatus.java
Generated on Wed Nov 13 2024 16:58:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: qcnotify::INotify Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • qcnotify
  • qcnotify::INotify
Public Member Functions | Static Public Attributes

qcnotify::INotify Interface Reference

.interface(iid=6DD1E6EF-28C1-11D2-B5B6-00C04FC340EE, thread=AUTO, type=DUAL)

Inherits com::ms::com::IUnknown.

Inherited by qcnotify::INotifyDefault.

List of all members.

Public Member Functions

void | LineItem (int lItemId, int lQuantity, int ShipStatus)
void | Process (int lFlags)
void | setCustomerId (int _jcomparam_0)
void | setOrderId (int _jcomparam_0)

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x6dd1e6ef, (short)0x28c1, (short)0x11d2, (byte)0xb5, (byte)0xb6, (byte)0x0, (byte)0xc0, (byte)0x4f, (byte)0xc3, (byte)0x40, (byte)0xee)

Detailed Description

Definition at line 20 of file INotify.java.

Member Function Documentation

void qcnotify::INotify::LineItem | ( | int | lItemId,
 |  | int | lQuantity,
 |  | int | ShipStatus
 | ) |  |

.method(vtoffset=6, dispid=3, type=METHOD, name="LineItem", addFlagsVtable=4) .parameters([in,type=I4] lItemId, [in,type=I4] lQuantity, [in,type=I4] ShipStatus)

Implemented in qcnotify::INotifyDefault, and qcnotify::Notify.

void qcnotify::INotify::Process ( int lFlags )

.method(vtoffset=7, dispid=4, type=METHOD, name="Process", addFlagsVtable=4) .parameters([in,type=I4] lFlags)

Implemented in qcnotify::INotifyDefault, and qcnotify::Notify.

void qcnotify::INotify::setCustomerId ( int _jcomparam_0 )

.method(vtoffset=4, dispid=1, type=PROPPUT, name="CustomerId", name2="putCustomerId", addFlagsVtable=4) .parameters([in,type=I4] _jcomparam_0)

Implemented in qcnotify::INotifyDefault, and qcnotify::Notify.

void qcnotify::INotify::setOrderId ( int _jcomparam_0 )

.method(vtoffset=5, dispid=2, type=PROPPUT, name="OrderId", name2="putOrderId", addFlagsVtable=4) .parameters([in,type=I4] _jcomparam_0)

Implemented in qcnotify::INotifyDefault, and qcnotify::Notify.

Member Data Documentation

final com.ms.com._Guid qcnotify::INotify::iid = new com.ms.com._Guid((int)0x6dd1e6ef, (short)0x28c1, (short)0x11d2, (byte)0xb5, (byte)0xb6, (byte)0x0, (byte)0xc0, (byte)0x4f, (byte)0xc3, (byte)0x40, (byte)0xee) [static]

Implemented in qcnotify::INotifyDefault.

Definition at line 39 of file INotify.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Queued_Components/QCJAVA/Components/qcNotify/INotify.java
Generated on Wed Nov 13 2024 16:58:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: qcnotify::INotifyDefault Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • qcnotify
  • qcnotify::INotifyDefault
Public Member Functions | Static Public Attributes

qcnotify::INotifyDefault Interface Reference

.interface(iid=00020400-0000-0000-C000-000000000046, thread=AUTO, type=DUAL)

Inherits qcnotify::INotify.

Inherited by qcnotify::Notify.

List of all members.

Public Member Functions

void | LineItem (int lItemId, int lQuantity, int ShipStatus)
void | Process (int lFlags)
void | setCustomerId (int _jcomparam_0)
void | setOrderId (int _jcomparam_0)

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x20400, (short)0x0, (short)0x0, (byte)0xc0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x46)

Detailed Description

Definition at line 20 of file INotifyDefault.java.

Member Function Documentation

void qcnotify::INotifyDefault::LineItem | ( | int | lItemId,
 |  | int | lQuantity,
 |  | int | ShipStatus
 | ) |  |

.method(vtoffset=6, dispid=3, type=METHOD, name="LineItem", addFlagsVtable=4) .parameters([in,type=I4] lItemId, [in,type=I4] lQuantity, [in,type=I4] ShipStatus)

Implements qcnotify::INotify.

Implemented in qcnotify::Notify.

void qcnotify::INotifyDefault::Process ( int lFlags )

.method(vtoffset=7, dispid=4, type=METHOD, name="Process", addFlagsVtable=4) .parameters([in,type=I4] lFlags)

Implements qcnotify::INotify.

Implemented in qcnotify::Notify.

void qcnotify::INotifyDefault::setCustomerId ( int _jcomparam_0 )

.method(vtoffset=4, dispid=1, type=PROPPUT, name="CustomerId", name2="putCustomerId", addFlagsVtable=4) .parameters([in,type=I4] _jcomparam_0)

Implements qcnotify::INotify.

Implemented in qcnotify::Notify.

void qcnotify::INotifyDefault::setOrderId ( int _jcomparam_0 )

.method(vtoffset=5, dispid=2, type=PROPPUT, name="OrderId", name2="putOrderId", addFlagsVtable=4) .parameters([in,type=I4] _jcomparam_0)

Implements qcnotify::INotify.

Implemented in qcnotify::Notify.

Member Data Documentation

final com.ms.com._Guid qcnotify::INotifyDefault::iid = new com.ms.com._Guid((int)0x20400, (short)0x0, (short)0x0, (byte)0xc0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x46) [static]

Implements qcnotify::INotify.

Definition at line 39 of file INotifyDefault.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Queued_Components/QCJAVA/Components/qcNotify/INotifyDefault.java
Generated on Wed Nov 13 2024 16:58:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: qcnotify::Notify Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • qcnotify
  • qcnotify::Notify
Public Member Functions | Private Member Functions | Private Attributes

qcnotify::Notify Class Reference

.register(clsid=6DD1E6F0-28C1-11D2-B5B6-00C04FC340EE, typelib=6DD1E6DC-28C1-11D2-B5B6-00C04FC340EE, version="1.0", description="Notify Class")

Inherits com::ms::com::IUnknown, and qcnotify::INotifyDefault.

List of all members.

Public Member Functions

Notify ()
void | LineItem (int itemID, int quantity, int shipStatus)
void | Process (int lFlags)
void | setCustomerId (int customerID)
void | setOrderId (int orderID)

Private Member Functions

String | getShipStatusString (Integer statusVal)
boolean | WriteDB ()

Private Attributes

int | customerID = 0
Vector | itemVect = null
int | orderID = 0
Vector | quantityVect = null
Vector | shipStatusVect = null

Detailed Description

Definition at line 21 of file Notify.java.

Constructor & Destructor Documentation

qcnotify::Notify::Notify ( ) [inline]

Definition at line 29 of file Notify.java.

  {
    itemVect    = new Vector();
    quantityVect  = new Vector();
    shipStatusVect  = new Vector();
  }

Member Function Documentation

String qcnotify::Notify::getShipStatusString ( Integer statusVal ) [inline, private]

Determines shipping status string based on shipping status value.

Parameters:
---
Returns:
String Shipping status string

Definition at line 160 of file Notify.java.

  {
    String  result  = null;
    int   value = statusVal.intValue();

    switch(value)
    {
      case _ShipStatus.ssShipped :
      {
        result = "ssShipped";
        break;
      }
      case _ShipStatus.ssBackOrdered :
      {
        result = "ssBackOrdered";
        break;
      }
      case _ShipStatus.ssNotStocked :
      {
        result = "ssNotStocked";
        break;
      }
      default :
      {
        result = "ssUnrecognizedItem";
      }
    }
    return result;
  }

void qcnotify::Notify::LineItem | ( | int | itemID,
 |  | int | quantity,
 |  | int | shipStatus |
 | ) |  |  | [inline]

Adds a single item to an order.

Parameters:
itemID | An item identifier
quantity | Quantity of the item ordered
shipStatus | Shipping status value.
Returns:
---

Implements qcnotify::INotifyDefault.

Definition at line 69 of file Notify.java.

  {
    if((itemVect != null) && (quantityVect != null) &&(shipStatusVect != null))
    {
      itemVect.addElement(new Integer(itemID));
      quantityVect.addElement(new Integer(quantity));
      shipStatusVect.addElement(new Integer(shipStatus));
    }
  }

void qcnotify::Notify::Process ( int lFlags ) [inline]

Updates order entry database with shipping status strings.

Parameters:
lFlags option flags
Returns:
---

Implements qcnotify::INotifyDefault.

Definition at line 86 of file Notify.java.

  {
    boolean dataInsertFlag    = false;

    dataInsertFlag  = WriteDB();
    com.ms.mtx.IObjectContext ctxObj = com.ms.mtx.Context.getObjectContext();
    if(ctxObj != null)
     {
      if(dataInsertFlag)
      {
        ctxObj.SetComplete();
      }
      else
      {
        ctxObj.SetAbort();
      }
     }
  }

void qcnotify::Notify::setCustomerId ( int customerID ) [inline]

property put for CustomerId property

Parameters:
customerID A customer identifier
Returns:
---

Implements qcnotify::INotifyDefault.

Definition at line 43 of file Notify.java.

  {
    this.customerID = customerID;
  }

void qcnotify::Notify::setOrderId ( int orderID ) [inline]

property put for OrderId property

Parameters:
orderID An order identifier
Returns:
---

Implements qcnotify::INotifyDefault.

Definition at line 55 of file Notify.java.

  {
    this.orderID = orderID;
  }

boolean qcnotify::Notify::WriteDB ( ) [inline, private]

Updates order entry database with shipping status strings.

Parameters:
---
Returns:
boolean True if successful else return false
See also:
com.ms.wfc.data.Connection

Definition at line 112 of file Notify.java.

  {
    int     result    = 0;
    Connection  con     = null;
    String    conDetail = null;
    boolean   returnValue = false;
    conDetail = "Data Source=" + helper.DatabaseSettings.DSN + ";" + "User Id=" + helper.DatabaseSettings.User + ";" + "Password=" + helper.DatabaseSettings.Pass + ";";
    con     = new Connection();
    con.open(conDetail);
    for(int index = 0;index < itemVect.size(); index++)
    {
      StringBuffer sql = new StringBuffer("");
      sql.append("Update QCSampleOrder set ship_status = '");
      sql.append(getShipStatusString((Integer)shipStatusVect.elementAt(index)));
      sql.append("' ");
      sql.append("Where (cust_id = ");
      sql.append(String.valueOf(customerID) + ") And");
      sql.append("( order_id = ");
      sql.append(String.valueOf(orderID) + ") And");
      sql.append("( line_no = ");
      sql.append(String.valueOf(index) + ") And");
      sql.append("( item_id = ");
      sql.append(((Integer)(itemVect.elementAt(index))).toString() + ") And");
      sql.append("( quantity = ");
      sql.append(((Integer)(quantityVect.elementAt(index))).toString() + ")");
      result  = con.executeUpdate(sql.toString());
      if(result > 0)
      {
        returnValue = true;
      }
      else
      {
        returnValue = false;
        break;
      }
      System.out.println(result);
    }
    con.close();
    return returnValue;

  }

Member Data Documentation

int qcnotify::Notify::customerID = 0 [private]

Definition at line 23 of file Notify.java.

Vector qcnotify::Notify::itemVect = null [private]

Definition at line 25 of file Notify.java.

int qcnotify::Notify::orderID = 0 [private]

Definition at line 24 of file Notify.java.

Vector qcnotify::Notify::quantityVect = null [private]

Definition at line 26 of file Notify.java.

Vector qcnotify::Notify::shipStatusVect = null [private]

Definition at line 27 of file Notify.java.

The documentation for this class was generated from the following file:
  • Com/Services/Queued_Components/QCJAVA/Components/qcNotify/Notify.java
Generated on Wed Nov 13 2024 16:58:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: qcorder::IOrder Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • qcorder
  • qcorder::IOrder
Public Member Functions | Static Public Attributes

qcorder::IOrder Interface Reference

.interface(iid=CB34A1A1-28C2-11D2-B5B6-00C04FC340EE, thread=AUTO, type=DUAL)

Inherits com::ms::com::IUnknown.

Inherited by qcorder::IOrderDefault.

List of all members.

Public Member Functions

void | LineItem (int lItemId, int lQuantity)
void | Process (int lFlags)
void | setCustomerId (int _jcomparam_0)
void | setOrderId (int _jcomparam_0)

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0xcb34a1a1, (short)0x28c2, (short)0x11d2, (byte)0xb5, (byte)0xb6, (byte)0x0, (byte)0xc0, (byte)0x4f, (byte)0xc3, (byte)0x40, (byte)0xee)

Detailed Description

Definition at line 20 of file IOrder.java.

Member Function Documentation

void qcorder::IOrder::LineItem | ( | int | lItemId,
 |  | int | lQuantity
 | ) |  |

.method(vtoffset=6, dispid=3, type=METHOD, name="LineItem", addFlagsVtable=4) .parameters([in,type=I4] lItemId, [in,type=I4] lQuantity)

Implemented in qcorder::IOrderDefault, and qcorder::Order.

void qcorder::IOrder::Process ( int lFlags )

.method(vtoffset=7, dispid=4, type=METHOD, name="Process", addFlagsVtable=4) .parameters([in,type=I4] lFlags)

Implemented in qcorder::IOrderDefault, and qcorder::Order.

void qcorder::IOrder::setCustomerId ( int _jcomparam_0 )

.method(vtoffset=4, dispid=1, type=PROPPUT, name="CustomerId", name2="putCustomerId", addFlagsVtable=4) .parameters([in,type=I4] _jcomparam_0)

Implemented in qcorder::IOrderDefault, and qcorder::Order.

void qcorder::IOrder::setOrderId ( int _jcomparam_0 )

.method(vtoffset=5, dispid=2, type=PROPPUT, name="OrderId", name2="putOrderId", addFlagsVtable=4) .parameters([in,type=I4] _jcomparam_0)

Implemented in qcorder::IOrderDefault, and qcorder::Order.

Member Data Documentation

final com.ms.com._Guid qcorder::IOrder::iid = new com.ms.com._Guid((int)0xcb34a1a1, (short)0x28c2, (short)0x11d2, (byte)0xb5, (byte)0xb6, (byte)0x0, (byte)0xc0, (byte)0x4f, (byte)0xc3, (byte)0x40, (byte)0xee) [static]

Implemented in qcorder::IOrderDefault.

Definition at line 39 of file IOrder.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Queued_Components/QCJAVA/Components/qcOrder/IOrder.java
Generated on Wed Nov 13 2024 16:58:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: qcorder::IOrderDefault Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • qcorder
  • qcorder::IOrderDefault
Public Member Functions | Static Public Attributes

qcorder::IOrderDefault Interface Reference

.interface(iid=00020400-0000-0000-C000-000000000046, thread=AUTO, type=DUAL)

Inherits qcorder::IOrder.

Inherited by qcorder::Order.

List of all members.

Public Member Functions

void | LineItem (int lItemId, int lQuantity)
void | Process (int lFlags)
void | setCustomerId (int _jcomparam_0)
void | setOrderId (int _jcomparam_0)

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x20400, (short)0x0, (short)0x0, (byte)0xc0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x46)

Detailed Description

Definition at line 20 of file IOrderDefault.java.

Member Function Documentation

void qcorder::IOrderDefault::LineItem | ( | int | lItemId,
 |  | int | lQuantity
 | ) |  |

.method(vtoffset=6, dispid=3, type=METHOD, name="LineItem", addFlagsVtable=4) .parameters([in,type=I4] lItemId, [in,type=I4] lQuantity)

Implements qcorder::IOrder.

Implemented in qcorder::Order.

void qcorder::IOrderDefault::Process ( int lFlags )

.method(vtoffset=7, dispid=4, type=METHOD, name="Process", addFlagsVtable=4) .parameters([in,type=I4] lFlags)

Implements qcorder::IOrder.

Implemented in qcorder::Order.

void qcorder::IOrderDefault::setCustomerId ( int _jcomparam_0 )

.method(vtoffset=4, dispid=1, type=PROPPUT, name="CustomerId", name2="putCustomerId", addFlagsVtable=4) .parameters([in,type=I4] _jcomparam_0)

Implements qcorder::IOrder.

Implemented in qcorder::Order.

void qcorder::IOrderDefault::setOrderId ( int _jcomparam_0 )

.method(vtoffset=5, dispid=2, type=PROPPUT, name="OrderId", name2="putOrderId", addFlagsVtable=4) .parameters([in,type=I4] _jcomparam_0)

Implements qcorder::IOrder.

Implemented in qcorder::Order.

Member Data Documentation

final com.ms.com._Guid qcorder::IOrderDefault::iid = new com.ms.com._Guid((int)0x20400, (short)0x0, (short)0x0, (byte)0xc0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x46) [static]

Implements qcorder::IOrder.

Definition at line 39 of file IOrderDefault.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Queued_Components/QCJAVA/Components/qcOrder/IOrderDefault.java
Generated on Wed Nov 13 2024 16:58:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: qcorder::Order Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • qcorder
  • qcorder::Order
Public Member Functions | Private Member Functions | Private Attributes

qcorder::Order Class Reference

.register(clsid=CB34A1A2-28C2-11D2-B5B6-00C04FC340EE, typelib=6DD1E6C2-28C1-11D2-B5B6-00C04FC340EE, version="1.0", description="Order Class")

Inherits com::ms::com::IUnknown, and qcorder::IOrderDefault.

List of all members.

Public Member Functions

Order ()
void | LineItem (int itemID, int quantity)
void | Process (int lFlags)
void | setCustomerId (int customerID)
void | setOrderId (int orderID)

Private Member Functions

boolean | InvokeShip ()
boolean | WriteOrderDB ()

Private Attributes

int | customerID = 0
Vector | itemVect = null
int | orderID = 0
Vector | quantityVect = null

Detailed Description

Definition at line 21 of file Order.java.

Constructor & Destructor Documentation

qcorder::Order::Order ( ) [inline]

Definition at line 28 of file Order.java.

  {
    itemVect    = new Vector();
    quantityVect  = new Vector();
  }

Member Function Documentation

boolean qcorder::Order::InvokeShip ( ) [inline, private]

Creates a Ship object to send to the shipping department.

Parameters:
---
Returns:
boolean True if successful else return false
See also:
com.ms.win32.ole32.CoGetObject

Definition at line 164 of file Order.java.

  {
    boolean returnValue   = false;
    qcship.IShip ship_obj = null;
    try
    {
      // Using Queue moniker to create queued component
      ship_obj =  (qcship.IShip)com.ms.win32.Ole32.CoGetObject("queue:/new:QCShipLib.Ship",null,qcship.IShip.iid);
      if(ship_obj != null)
      {
        ship_obj.setCustomerId(customerID);
        ship_obj.setOrderId(orderID);
        for(int index = 0;index < itemVect.size(); index++)
        {
          ship_obj.LineItem(((Integer)(itemVect.elementAt(index))).intValue(),((Integer)(quantityVect.elementAt(index))).intValue());
        }
        ship_obj.Process(0);
        returnValue = true;
      }
    }
    catch(com.ms.com.ComFailException exp)
    {
      System.out.println("Exception calling Ship :  " + exp);
    }

    return returnValue;
  }

void qcorder::Order::LineItem | ( | int | itemID,
 |  | int | quantity |
 | ) |  |  | [inline]

Adds a single item to an order.

Parameters:
itemID | An item identifier
quantity | Quantity of the item ordered
Returns:
---

Implements qcorder::IOrderDefault.

Definition at line 66 of file Order.java.

  {
    if((itemVect != null) && (quantityVect != null))
    {
      itemVect.addElement(new Integer(itemID));
      quantityVect.addElement(new Integer(quantity));
    }
  }

void qcorder::Order::Process ( int lFlags ) [inline]

Adds order to Order Entry table and sends order to shipping department.

Parameters:
lFlags option flags
Returns:
---

Implements qcorder::IOrderDefault.

Definition at line 82 of file Order.java.

  {
    boolean dataInsertFlag  = false;
    boolean shipInvokeFlag  = false;

    dataInsertFlag  = WriteOrderDB();
    com.ms.win32.User32.MessageBox(0,"Order is added and queuing message is added for shipment process","Order Status",0);
    System.out.println(dataInsertFlag);
    if(dataInsertFlag) // if order is successfully added to order table
    {
      shipInvokeFlag  = InvokeShip();
    }

    com.ms.mtx.IObjectContext ctxObj = com.ms.mtx.Context.getObjectContext();
    if(ctxObj != null)
     {
      if(shipInvokeFlag)
      {
        ctxObj.SetComplete();
      }
      else
      {
        ctxObj.SetAbort();
      }
     }
  }

void qcorder::Order::setCustomerId ( int customerID ) [inline]

property put for CustomerId property

Parameters:
customerID A customer identifier
Returns:
---

Implements qcorder::IOrderDefault.

Definition at line 41 of file Order.java.

  {
    this.customerID = customerID;
  }

void qcorder::Order::setOrderId ( int orderID ) [inline]

property put for OrderId property

Parameters:
orderID An order identifier
Returns:
---

Implements qcorder::IOrderDefault.

Definition at line 53 of file Order.java.

  {
    this.orderID  = orderID;
  }

boolean qcorder::Order::WriteOrderDB ( ) [inline, private]

Writes the order into the Order Entry table.

Parameters:
---
Returns:
boolean True if successful else return false
See also:
com.ms.wfc.data.Connection

Definition at line 116 of file Order.java.

  {
    int     result    = 0;
    Connection  con     = null;
    String    conDetail = null;
    boolean   returnValue = false;
    try
    {
      conDetail = "Data Source=" + helper.DatabaseSettings.DSN + ";" + "User Id=" + helper.DatabaseSettings.User + ";" + "Password=" + helper.DatabaseSettings.Pass + ";";
      con     = new Connection();
      con.open(conDetail);
      for(int index = 0;index < itemVect.size(); index++)
      {
        String value =  String.valueOf(orderID) + "," + String.valueOf(customerID) + "," + String.valueOf(index) + "," + ((Integer)itemVect.elementAt(index)).toString() + "," +((Integer)quantityVect.elementAt(index)).toString()  ;
        result  = con.executeUpdate("Insert into QCSampleOrder (order_id,cust_id,line_no,item_id,quantity) values(" + value + ")");
        System.out.println(result);
        if(result > 0)
        {
          returnValue = true;   // Database operation is successful
        }
        else
        {
          returnValue = false;
          break;
        }
      }
    }
    catch(Exception exp)
    {
      System.out.println("Exception in database handling " + exp);
    }
    finally
    {
      if(con != null)
      {
        con.close();  // Close the database connection
      }
    }
    return returnValue;
  }

Member Data Documentation

int qcorder::Order::customerID = 0 [private]

Definition at line 23 of file Order.java.

Vector qcorder::Order::itemVect = null [private]

Definition at line 25 of file Order.java.

int qcorder::Order::orderID = 0 [private]

Definition at line 24 of file Order.java.

Vector qcorder::Order::quantityVect = null [private]

Definition at line 26 of file Order.java.

The documentation for this class was generated from the following file:
  • Com/Services/Queued_Components/QCJAVA/Components/qcOrder/Order.java
Generated on Wed Nov 13 2024 16:58:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: qcship::IShip Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • qcship
  • qcship::IShip
Public Member Functions | Static Public Attributes

qcship::IShip Interface Reference

.interface(iid=CB34A1A4-28C2-11D2-B5B6-00C04FC340EE, thread=AUTO, type=DUAL)

Inherits com::ms::com::IUnknown.

Inherited by qcship::IShipDefault.

List of all members.

Public Member Functions

void | LineItem (int lItemId, int lQuantity)
void | Process (int lFlags)
void | setCustomerId (int _jcomparam_0)
void | setOrderId (int _jcomparam_0)

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0xcb34a1a4, (short)0x28c2, (short)0x11d2, (byte)0xb5, (byte)0xb6, (byte)0x0, (byte)0xc0, (byte)0x4f, (byte)0xc3, (byte)0x40, (byte)0xee)

Detailed Description

Definition at line 20 of file IShip.java.

Member Function Documentation

void qcship::IShip::LineItem | ( | int | lItemId,
 |  | int | lQuantity
 | ) |  |

.method(vtoffset=6, dispid=3, type=METHOD, name="LineItem", addFlagsVtable=4) .parameters([in,type=I4] lItemId, [in,type=I4] lQuantity)

Implemented in qcship::IShipDefault, and qcship::Ship.

void qcship::IShip::Process ( int lFlags )

.method(vtoffset=7, dispid=4, type=METHOD, name="Process", addFlagsVtable=4) .parameters([in,type=I4] lFlags)

Implemented in qcship::IShipDefault, and qcship::Ship.

void qcship::IShip::setCustomerId ( int _jcomparam_0 )

.method(vtoffset=4, dispid=1, type=PROPPUT, name="CustomerId", name2="putCustomerId", addFlagsVtable=4) .parameters([in,type=I4] _jcomparam_0)

Implemented in qcship::IShipDefault, and qcship::Ship.

void qcship::IShip::setOrderId ( int _jcomparam_0 )

.method(vtoffset=5, dispid=2, type=PROPPUT, name="OrderId", name2="putOrderId", addFlagsVtable=4) .parameters([in,type=I4] _jcomparam_0)

Implemented in qcship::IShipDefault, and qcship::Ship.

Member Data Documentation

final com.ms.com._Guid qcship::IShip::iid = new com.ms.com._Guid((int)0xcb34a1a4, (short)0x28c2, (short)0x11d2, (byte)0xb5, (byte)0xb6, (byte)0x0, (byte)0xc0, (byte)0x4f, (byte)0xc3, (byte)0x40, (byte)0xee) [static]

Implemented in qcship::IShipDefault.

Definition at line 39 of file IShip.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Queued_Components/QCJAVA/Components/qcShip/IShip.java
Generated on Wed Nov 13 2024 16:58:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: qcship::IShipDefault Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • qcship
  • qcship::IShipDefault
Public Member Functions | Static Public Attributes

qcship::IShipDefault Interface Reference

.interface(iid=00020400-0000-0000-C000-000000000046, thread=AUTO, type=DUAL)

Inherits qcship::IShip.

Inherited by qcship::Ship.

List of all members.

Public Member Functions

void | LineItem (int lItemId, int lQuantity)
void | Process (int lFlags)
void | setCustomerId (int _jcomparam_0)
void | setOrderId (int _jcomparam_0)

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x20400, (short)0x0, (short)0x0, (byte)0xc0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x46)

Detailed Description

Definition at line 20 of file IShipDefault.java.

Member Function Documentation

void qcship::IShipDefault::LineItem | ( | int | lItemId,
 |  | int | lQuantity
 | ) |  |

.method(vtoffset=6, dispid=3, type=METHOD, name="LineItem", addFlagsVtable=4) .parameters([in,type=I4] lItemId, [in,type=I4] lQuantity)

Implements qcship::IShip.

Implemented in qcship::Ship.

void qcship::IShipDefault::Process ( int lFlags )

.method(vtoffset=7, dispid=4, type=METHOD, name="Process", addFlagsVtable=4) .parameters([in,type=I4] lFlags)

Implements qcship::IShip.

Implemented in qcship::Ship.

void qcship::IShipDefault::setCustomerId ( int _jcomparam_0 )

.method(vtoffset=4, dispid=1, type=PROPPUT, name="CustomerId", name2="putCustomerId", addFlagsVtable=4) .parameters([in,type=I4] _jcomparam_0)

Implements qcship::IShip.

Implemented in qcship::Ship.

void qcship::IShipDefault::setOrderId ( int _jcomparam_0 )

.method(vtoffset=5, dispid=2, type=PROPPUT, name="OrderId", name2="putOrderId", addFlagsVtable=4) .parameters([in,type=I4] _jcomparam_0)

Implements qcship::IShip.

Implemented in qcship::Ship.

Member Data Documentation

final com.ms.com._Guid qcship::IShipDefault::iid = new com.ms.com._Guid((int)0x20400, (short)0x0, (short)0x0, (byte)0xc0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x0, (byte)0x46) [static]

Implements qcship::IShip.

Definition at line 39 of file IShipDefault.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Queued_Components/QCJAVA/Components/qcShip/IShipDefault.java
Generated on Wed Nov 13 2024 16:58:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: qcship::Ship Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • qcship
  • qcship::Ship
Public Member Functions | Private Member Functions | Private Attributes

qcship::Ship Class Reference

.register(clsid=CB34A1A5-28C2-11D2-B5B6-00C04FC340EE, typelib=6DD1E6CF-28C1-11D2-B5B6-00C04FC340EE, version="1.0", description="Ship Class")

Inherits com::ms::com::IUnknown, and qcship::IShipDefault.

List of all members.

Public Member Functions

Ship ()
void | LineItem (int itemID, int quantity)
void | Process (int lFlags)
void | setCustomerId (int customerID)
void | setOrderId (int orderID)

Private Member Functions

boolean | InvokeNotify ()
String | randomShipStatus ()
int | shipStatusValue (String shipStatus)
boolean | WriteShipDB ()

Private Attributes

int | customerID = 0
Vector | itemVect = null
int | orderID = 0
Vector | quantityVect = null
Vector | shipStatusVect = null

Detailed Description

Definition at line 22 of file Ship.java.

Constructor & Destructor Documentation

qcship::Ship::Ship ( ) [inline]

Definition at line 30 of file Ship.java.

  {
    itemVect    = new Vector();
    quantityVect  = new Vector();
    shipStatusVect  = new Vector();
  }

Member Function Documentation

boolean qcship::Ship::InvokeNotify ( ) [inline, private]

Creates a Notify object to notify requestor of shipping status.

Parameters:
---
Returns:
boolean True if successful else return false
See also:
com.ms.win32.ole32.CoGetObject

Definition at line 153 of file Ship.java.

  {
    boolean       returnValue   = false;
    qcnotify.INotify  notify_obj    = null;
    try
    {
      // Using Queue moniker to create queued component
      notify_obj =  (qcnotify.INotify)com.ms.win32.Ole32.CoGetObject("queue:/new:QCNotifyLib.Notify",null,qcnotify.INotify.iid);
      if(notify_obj != null)
      {
        notify_obj.setCustomerId(customerID);
        notify_obj.setOrderId(orderID);
        for(int index = 0;index < itemVect.size(); index++)
        {
          notify_obj.LineItem(((Integer)(itemVect.elementAt(index))).intValue(),((Integer)(quantityVect.elementAt(index))).intValue(),shipStatusValue((String)(shipStatusVect.elementAt(index))));
        }
        notify_obj.Process(0);
        returnValue = true;
      }
    }
    catch(com.ms.com.ComFailException exp)
    {
      System.out.println("Exception calling Notify :  " + exp);
    }

    return returnValue;
  }

void qcship::Ship::LineItem | ( | int | itemID,
 |  | int | quantity |
 | ) |  |  | [inline]

Adds a single item to an order.

Parameters:
itemID | An item identifier
quantity | Quantity of the item ordered
Returns:
---

Implements qcship::IShipDefault.

Definition at line 69 of file Ship.java.

  {
    if((itemVect != null) && (quantityVect != null) &&(shipStatusVect != null))
    {
      itemVect.addElement(new Integer(itemID));
      quantityVect.addElement(new Integer(quantity));
      shipStatusVect.addElement(randomShipStatus());
    }
  }

void qcship::Ship::Process ( int lFlags ) [inline]

Adds order to Shipping table and notify requestor of shipping status.

Parameters:
lFlags option flags
Returns:
---

Implements qcship::IShipDefault.

Definition at line 86 of file Ship.java.

  {
    boolean dataInsertFlag    = false;
    boolean notifyInvokeFlag  = false;

    dataInsertFlag  = WriteShipDB();
    if(dataInsertFlag)
    {
      notifyInvokeFlag  = InvokeNotify();
    }
    com.ms.mtx.IObjectContext ctxObj = com.ms.mtx.Context.getObjectContext();
    if(ctxObj != null)
     {
      if(notifyInvokeFlag)
      {
        ctxObj.SetComplete();
      }
      else
      {
        ctxObj.SetAbort();
      }
     }
  }

String qcship::Ship::randomShipStatus ( ) [inline, private]

Determines shipping status for a particular line item.

Parameters:
---
Returns:
String Shipping status string

Definition at line 187 of file Ship.java.

  {
    double randomStatusValue  = 0.0;
    String shipStatus     = null;

    randomStatusValue = java.lang.Math.random() * 100;
    if(randomStatusValue < 80)
    {
      shipStatus  = "ssShipped";
    }
    else if(randomStatusValue < 93)
    {
      shipStatus  = "ssBackOrdered";
    }
    else if(randomStatusValue < 97)
    {
      shipStatus  = "ssNotStocked";
    }
    else
    {
      shipStatus  = "ssUnrecognizedItem";
    }
    return shipStatus;
  }

void qcship::Ship::setCustomerId ( int customerID ) [inline]

property put for CustomerId property

Parameters:
customerID A customer identifier
Returns:
---

Implements qcship::IShipDefault.

Definition at line 44 of file Ship.java.

  {
    this.customerID = customerID;
  }

void qcship::Ship::setOrderId ( int orderID ) [inline]

property put for OrderId property

Parameters:
orderID An order identifier
Returns:
---

Implements qcship::IShipDefault.

Definition at line 56 of file Ship.java.

  {
    this.orderID  = orderID;
  }

int qcship::Ship::shipStatusValue ( String shipStatus ) [inline, private]

Determines shipping status value based on shipping status string.

Parameters:
---
Returns:
int Shipping status value

Definition at line 218 of file Ship.java.

  {
    int returnValue   = 0;
    if(shipStatus.equals("ssShipped"))
    {
      returnValue = qcnotify._ShipStatus.ssShipped;
    }
    else if(shipStatus.equals("ssBackOrdered"))
    {
      returnValue = qcnotify._ShipStatus.ssBackOrdered;
    }
    else if(shipStatus.equals("ssNotStocked"))
    {
      returnValue = qcnotify._ShipStatus.ssNotStocked;
    }
    else if(shipStatus.equals("ssUnrecognizedItem"))
    {
      returnValue = qcnotify._ShipStatus.ssUnrecognizedItem;
    }
    return returnValue;

  }

boolean qcship::Ship::WriteShipDB ( ) [inline, private]

Writes the order into the Shipping table.

Parameters:
---
Returns:
boolean True if successful else return false
See also:
com.ms.wfc.data.Connection

Definition at line 117 of file Ship.java.

  {
    int     result    = 0;
    Connection  con     = null;
    String    conDetail = null;
    boolean   returnValue = false;

    conDetail = "Data Source=" + helper.DatabaseSettings.DSN + ";" + "User Id=" + helper.DatabaseSettings.User + ";" + "Password=" + helper.DatabaseSettings.Pass + ";";
    con     = new Connection();
    con.open(conDetail);
    for(int index = 0;index < itemVect.size(); index++)
    {
      String value =  String.valueOf(orderID) + "," + String.valueOf(customerID) + "," + String.valueOf(index) + "," + ((Integer)itemVect.elementAt(index)).toString() + "," +((Integer)quantityVect.elementAt(index)).toString() + ", '" + (String)(shipStatusVect.elementAt(index)) + "'" ;
      System.out.println(value);
      result  = con.executeUpdate("Insert into QCSampleShip (order_id,cust_id,line_no,item_id,quantity,ship_status) values(" + value + ")");
      if(result > 0)
      {
        returnValue = true;
      }
      else
      {
        returnValue = false;
        break;
      }
    }
    con.close();
    return returnValue;
  }

Member Data Documentation

int qcship::Ship::customerID = 0 [private]

Definition at line 24 of file Ship.java.

Vector qcship::Ship::itemVect = null [private]

Definition at line 26 of file Ship.java.

int qcship::Ship::orderID = 0 [private]

Definition at line 25 of file Ship.java.

Vector qcship::Ship::quantityVect = null [private]

Definition at line 27 of file Ship.java.

Vector qcship::Ship::shipStatusVect = null [private]

Definition at line 28 of file Ship.java.

The documentation for this class was generated from the following file:
  • Com/Services/Queued_Components/QCJAVA/Components/qcShip/Ship.java
Generated on Wed Nov 13 2024 16:58:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Query Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Package Functions | Private Attributes

Query Class Reference

List of all members.

Package Functions

Query ()
void | Display (PrintStream PS)
void | Execute ()
void | SetRawSql (String RawSql)
void | SetSqlWhere (String Where)

Private Attributes

Recordset m_RS
String | m_SqlText

Detailed Description

Definition at line 38 of file Query.java.

Constructor & Destructor Documentation

Query::Query ( ) [inline, package]

Definition at line 40 of file Query.java.

    {
        this.m_SqlText = "";
    }

Member Function Documentation

void Query::Display ( PrintStream PS ) [inline, package]

Definition at line 108 of file Query.java.

    {
        try
        {
            int cFields = m_RS.getFields().getCount();

            while ( !m_RS.getEOF() )
            {
                for ( int j = 0; j < cFields; j++ )
                    PS.print( m_RS.getFields().getItem(j).getValue() + "\t" );

                PS.print( "\n" );

                m_RS.moveNext();
            }
        }
        catch( com.ms.wfc.data.AdoException e )
        {
            System.out.println( "Caught " + e.getErrorNumber() );

            try
            {
                int i = System.in.read();
            }
            catch( java.lang.Exception e2 )
            {
            }
        }
    }

void Query::Execute ( ) [inline, package]

Definition at line 86 of file Query.java.

    {
        m_RS = new Recordset();
        m_RS.open( m_SqlText,
                   "provider=MSIDXS",
                   AdoEnums.CursorType.STATIC,
                   AdoEnums.LockType.BATCHOPTIMISTIC,
                   AdoEnums.CommandType.TEXT );
    }

void Query::SetRawSql ( String RawSql ) [inline, package]

Definition at line 55 of file Query.java.

    {
        this.m_SqlText = RawSql;
    }

void Query::SetSqlWhere ( String Where ) [inline, package]

Definition at line 70 of file Query.java.

    {
        m_SqlText = "SELECT Filename, Size, Write, Path FROM SCOPE('DEEP TRAVERSAL OF \"\\\"') WHERE ";
        m_SqlText = m_SqlText + Where;
    }

Member Data Documentation

Recordset Query::m_RS [private]

Definition at line 141 of file Query.java.

String Query::m_SqlText [private]

Definition at line 140 of file Query.java.

The documentation for this class was generated from the following file:
  • WinBase/Indexing/VJQuery/Query.java
Generated on Wed Nov 13 2024 16:57:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Queue Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

Queue Struct Reference

#include "Resources.h"

List of all members.

Public Attributes

LPCRITICAL_SECTION lpCriticalSection
QueueNode * pFirst
QueueNode * pLast

Detailed Description

Definition at line 121 of file Resources.h.

Member Data Documentation

LPCRITICAL_SECTION Queue::lpCriticalSection

Definition at line 124 of file Resources.h.

QueueNode * Queue::pFirst

Definition at line 122 of file Resources.h.

QueueNode * Queue::pLast

Definition at line 123 of file Resources.h.

The documentation for this struct was generated from the following files:
  • NetDS/RPC/FileRep/FileRepAsyncPipe/Resources.h
  • NetDS/RPC/FileRep/filerepmultiuser/resources.h
Generated on Wed Nov 13 2024 16:57:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: RealTimeStylusPluginApp::PluginListItem Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • RealTimeStylusPluginApp
  • RealTimeStylusPluginApp::PluginListItem
Public Member Functions | Public Attributes

RealTimeStylusPluginApp::PluginListItem Struct Reference

Helper used to store information about a given plugin.

List of all members.

Public Member Functions

PluginListItem (IStylusSyncPlugin stylusPlugin, String pluginDescription)
override String | ToString ()

Public Attributes

String | Description
IStylusSyncPlugin | Plugin

Detailed Description

Definition at line 57 of file RealTimeStylusPluginApp.cs.

Constructor & Destructor Documentation

RealTimeStylusPluginApp::PluginListItem::PluginListItem | ( | IStylusSyncPlugin | stylusPlugin,
 |  | String | pluginDescription |
 | ) |  |  | [inline]

Public constructor.

Parameters:
Plugin | The plugin
description | Description of the plugin

Definition at line 74 of file RealTimeStylusPluginApp.cs.

        {
            Plugin = stylusPlugin;
            Description = pluginDescription;
        }

Member Function Documentation

override String RealTimeStylusPluginApp::PluginListItem::ToString ( ) [inline]

The description of this plugin.

Returns:
String that describes this plugin

Definition at line 84 of file RealTimeStylusPluginApp.cs.

        {
            return Description;
        }

Member Data Documentation

String RealTimeStylusPluginApp::PluginListItem::Description

A string containing the description of the plugin.

Definition at line 67 of file RealTimeStylusPluginApp.cs.

IStylusSyncPlugin RealTimeStylusPluginApp::PluginListItem::Plugin

The real time stylus plugin associated with this class.

Definition at line 62 of file RealTimeStylusPluginApp.cs.

The documentation for this struct was generated from the following file:
  • TabletPC/RealTimeStylusPlugin/C#/RealTimeStylusPluginApp.cs
Generated on Wed Nov 13 2024 16:58:17 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: RealTimeStylusPluginApp::RealTimeStylusPluginApp Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • RealTimeStylusPluginApp
  • RealTimeStylusPluginApp::RealTimeStylusPluginApp
Public Member Functions | Protected Member Functions | Properties | Private Member Functions | Static Private Member Functions | Private Attributes

RealTimeStylusPluginApp::RealTimeStylusPluginApp Class Reference

The RealTimeStylusPlugin Sample Application form class.

List of all members.

Public Member Functions

RealTimeStylusPluginApp ()
void | CustomStylusDataAdded (RealTimeStylus sender, CustomStylusData data)
void | Error (RealTimeStylus sender, ErrorData data)
void | InAirPackets (RealTimeStylus sender, InAirPacketsData data)
void | Packets (RealTimeStylus sender, PacketsData data)
void | RealTimeStylusDisabled (RealTimeStylus sender, RealTimeStylusDisabledData data)
void | RealTimeStylusEnabled (RealTimeStylus sender, RealTimeStylusEnabledData data)
void | StylusButtonDown (RealTimeStylus sender, StylusButtonDownData data)
void | StylusButtonUp (RealTimeStylus sender, StylusButtonUpData data)
void | StylusDown (RealTimeStylus sender, StylusDownData data)
void | StylusInRange (RealTimeStylus sender, StylusInRangeData data)
void | StylusOutOfRange (RealTimeStylus sender, StylusOutOfRangeData data)
void | StylusUp (RealTimeStylus sender, StylusUpData data)
void | SystemGesture (RealTimeStylus sender, SystemGestureData data)
void | TabletAdded (RealTimeStylus sender, TabletAddedData data)
void | TabletRemoved (RealTimeStylus sender, TabletRemovedData data)

Protected Member Functions

override void | Dispose (bool disposing)

Properties

DataInterestMask | DataInterest [get]

Private Member Functions

void | btnMove_Click (object sender, System.EventArgs e)
void | chklbPlugins_ItemCheck (object sender, System.Windows.Forms.ItemCheckEventArgs e)
void | chklbPlugins_MouseDown (object sender, System.Windows.Forms.MouseEventArgs e)
void | Clear ()
int | FindPrecedingPlugin (int index)
void | InitializeComponent ()
void | InsertIntoPluginCollection (int index)
void | miClear_Click (object sender, System.EventArgs e)
void | miExit_Click (object sender, System.EventArgs e)
void | RealTimeStylusPlugin_Load (object sender, System.EventArgs e)
void | RemoveFromPluginCollection (int index)

Static Private Member Functions

static void | Main ()

Private Attributes

System.Windows.Forms.Button | btnMoveDown
System.Windows.Forms.Button | btnMoveUp
System.Windows.Forms.CheckedListBox | chklbPlugins
System.ComponentModel.Container | components = null
Graphics | customDynamicRendererGraphics
System.Windows.Forms.GroupBox | gbTestArea
MouseEventArgs | lastMouseDownEventArgs = null
System.Windows.Forms.Label | lblPluginList
System.Windows.Forms.MenuItem | miAction
System.Windows.Forms.MenuItem | miClear
System.Windows.Forms.MenuItem | miExit
System.Windows.Forms.MainMenu | miMain
System.Windows.Forms.MenuItem | miSeparator
RealTimeStylus | myRealTimeStylus
System.Windows.Forms.Panel | pnlPlugins
System.Windows.Forms.StatusBar | sbGesture
System.Windows.Forms.TextBox | txtPluginDescription

Detailed Description

Definition at line 93 of file RealTimeStylusPluginApp.cs.

Constructor & Destructor Documentation

RealTimeStylusPluginApp::RealTimeStylusPluginApp::RealTimeStylusPluginApp ( ) [inline]

Definition at line 126 of file RealTimeStylusPluginApp.cs.

        {
            #region Standard Template Code
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            #endregion
        }

Member Function Documentation

void RealTimeStylusPluginApp::RealTimeStylusPluginApp::btnMove_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from MoveUp and MoveDown Button Click.

Parameters:
sender
e

Definition at line 522 of file RealTimeStylusPluginApp.cs.

        {
            // Declare the current and destination indices of the
            // real time stylus plugin being moved.
            int currentIndex = chklbPlugins.SelectedIndex;
            int destinationIndex = -1;

            if ((0 <= currentIndex) && (currentIndex <= chklbPlugins.Items.Count))
            {

                // Calculate the destination based on whether move up
                // or down was pressed.
                if (sender == btnMoveUp)
                {
                    destinationIndex = currentIndex - 1;
                }
                else
                {
                    destinationIndex = currentIndex + 1;
                }

                // The destination index of the plugin being moved must fall
                // within the bounds of the plugin list.
                if ((0 <= destinationIndex) && (destinationIndex < chklbPlugins.Items.Count))
                {
                    CheckState checkState = chklbPlugins.GetItemCheckState(currentIndex);

                    // If the plugin being moved is currently enabled,
                    // remove it from the plugin collection.
                    if (CheckState.Checked == checkState)
                    {
                        RemoveFromPluginCollection(currentIndex);
                    }

                    // Update the checked list box to reflect the move.
                    object item = chklbPlugins.Items[currentIndex];
                    chklbPlugins.Items.RemoveAt(currentIndex);
                    chklbPlugins.Items.Insert(destinationIndex,item);

                    // Restore the selected and checked state of the list item.
                    chklbPlugins.SetSelected(destinationIndex, true);
                    chklbPlugins.SetItemCheckState(destinationIndex, checkState);
                }
            }
        }

void RealTimeStylusPluginApp::RealTimeStylusPluginApp::chklbPlugins_ItemCheck | ( | object | sender,
 |  | System.Windows.Forms.ItemCheckEventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from the checked list box ItemCheck Event.

Enabled/disable the real time stylus plugin corresponding to the item being checked/unchecked.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 450 of file RealTimeStylusPluginApp.cs.

        {
            // The CheckedListBox CheckOnClick property allows the user
            // to toggle the checkbox without first selecting the list item,
            // but since the list also allows the user to rearrange the
            // items, we only want CheckOnClick to proceed if the user clicks
            // on the checkbox itself.
            if (lastMouseDownEventArgs != null)
            {
                // If we previously cached MouseDownEventArgs, check the MouseDown location.
                bool abortItemCheck = (lastMouseDownEventArgs.X > chklbPlugins.GetItemHeight(e.Index));

                // Reset the cache
                lastMouseDownEventArgs = null;

                // If the MouseDown location is outside the checkbox area, abort.
                if (abortItemCheck)
                {
                    e.NewValue = e.CurrentValue;
                    return;
                }
            }

            // Enable/disable the plugin according to its new
            // checked value.  A plugin is enabled by inserting
            // it into the real time stylus notification chain and it is
            // disabled by removing it from the plugin collection.  The dynamic
            // renderer is handled specially by setting its enabled
            // property.
            if(e.Index < chklbPlugins.Items.Count)
            {
                if (e.NewValue == CheckState.Checked)
                {
                    InsertIntoPluginCollection(e.Index);
                }
                else if (e.NewValue == CheckState.Unchecked)
                {
                    RemoveFromPluginCollection(e.Index);
                }
            }

            // Clear the form
            Clear();
        }

void RealTimeStylusPluginApp::RealTimeStylusPluginApp::chklbPlugins_MouseDown | ( | object | sender,
 |  | System.Windows.Forms.MouseEventArgs | e |
 | ) |  |  | [inline, private]

Event Handler for the checked list box MouseDown Event.

Cache the MouseEventArgs for use in the chklbPlugins_ItemCheck handler.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 438 of file RealTimeStylusPluginApp.cs.

        {
            lastMouseDownEventArgs = e;
        }

void RealTimeStylusPluginApp::RealTimeStylusPluginApp::Clear ( ) [inline, private]

Helper method to clear the form.

Definition at line 571 of file RealTimeStylusPluginApp.cs.

        {
            sbGesture.Text = String.Empty;
            this.Refresh();
        }

void RealTimeStylusPluginApp::RealTimeStylusPluginApp::CustomStylusDataAdded | ( | RealTimeStylus | sender,
 |  | CustomStylusData | data |
 | ) |  |  | [inline]

Informs the implementing object that user data is available.

Parameters:
sender | The real time stylus associated with the notification
data | The notification data

Definition at line 642 of file RealTimeStylusPluginApp.cs.

        {
            // We can identify the kind of custom data via either the Guid or Type.
            // For the purpose of this demonstration we will validate both just to be safe.
            // For other scenarios either approach is valid.
            if (data.CustomDataId == GestureRecognizer.GestureRecognitionDataGuid)
            {
                GestureRecognitionData grd = data.Data as GestureRecognitionData;
                if (grd != null)
                {
                    if (grd.Count > 0)
                    {
                        GestureAlternate ga = grd[0];
                        sbGesture.Text = "Gesture=" + ga.Id + ", Confidence=" + ga.Confidence;
                    }
                }
            }
        }

override void RealTimeStylusPluginApp::RealTimeStylusPluginApp::Dispose ( bool disposing ) [inline, protected]

Clean up any resources being used.

Definition at line 140 of file RealTimeStylusPluginApp.cs.

        {
            if( disposing )
            {
                if (components != null)
                {
                    components.Dispose();
                }
            }
            base.Dispose( disposing );

            // Dispose the graphics objects associated with the
            // custom dynamic renderer.
            customDynamicRendererGraphics.Dispose();
        }

void RealTimeStylusPluginApp::RealTimeStylusPluginApp::Error | ( | RealTimeStylus | sender,
 |  | ErrorData | data |
 | ) |  |  | [inline]

Called when the current plugin or the ones previous in the list threw an exception.

Parameters:
sender | The real time stylus associated with the notification
data | The notification data

Definition at line 667 of file RealTimeStylusPluginApp.cs.

        {
            Debug.Assert(false, null, "An error occurred.  DataId=" + data.DataId + ", " + "Exception=" + data.InnerException);
        }

int RealTimeStylusPluginApp::RealTimeStylusPluginApp::FindPrecedingPlugin ( int index ) [inline, private]

Helper method to find the index where the specified plugin should be inserted.

Parameters:
index The index of the plugin.
Returns:
The index to insert the specified plugin.

Definition at line 583 of file RealTimeStylusPluginApp.cs.

        {
            int insertAtIndex = 0;

            // For each real time stylus plugin preceding
            // the specified index, check whether it is currently
            // enabled.  If so, update the insert at index.
            for (int i = 0; i < index; i++)
            {
                if (chklbPlugins.GetItemChecked(i))
                {
                    insertAtIndex++;
                }
            }

            // Return the preceding plugin or null if none found.
            return insertAtIndex;
        }

void RealTimeStylusPluginApp::RealTimeStylusPluginApp::InAirPackets | ( | RealTimeStylus | sender,
 |  | InAirPacketsData | data |
 | ) |  |  | [inline]

Definition at line 694 of file RealTimeStylusPluginApp.cs.

{}

void RealTimeStylusPluginApp::RealTimeStylusPluginApp::InitializeComponent ( ) [inline, private]

Required method for Designer support - do not modify the contents of this method with the code editor.

Definition at line 162 of file RealTimeStylusPluginApp.cs.

        {
            this.gbTestArea = new System.Windows.Forms.GroupBox();
            this.chklbPlugins = new System.Windows.Forms.CheckedListBox();
            this.btnMoveUp = new System.Windows.Forms.Button();
            this.btnMoveDown = new System.Windows.Forms.Button();
            this.txtPluginDescription = new System.Windows.Forms.TextBox();
            this.lblPluginList = new System.Windows.Forms.Label();
            this.sbGesture = new System.Windows.Forms.StatusBar();
            this.miMain = new System.Windows.Forms.MainMenu();
            this.miAction = new System.Windows.Forms.MenuItem();
            this.miClear = new System.Windows.Forms.MenuItem();
            this.miSeparator = new System.Windows.Forms.MenuItem();
            this.miExit = new System.Windows.Forms.MenuItem();
            this.pnlPlugins = new System.Windows.Forms.Panel();
            this.pnlPlugins.SuspendLayout();
            this.SuspendLayout();
            //
            // gbTestArea
            //
            this.gbTestArea.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                | System.Windows.Forms.AnchorStyles.Left)
                | System.Windows.Forms.AnchorStyles.Right);
            this.gbTestArea.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.gbTestArea.Location = new System.Drawing.Point(8, 8);
            this.gbTestArea.Name = "gbTestArea";
            this.gbTestArea.Size = new System.Drawing.Size(369, 341);
            this.gbTestArea.TabIndex = 0;
            this.gbTestArea.TabStop = false;
            this.gbTestArea.Text = "Test Area";
            //
            // chklbPlugins
            //
            this.chklbPlugins.CheckOnClick = true;
            this.chklbPlugins.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                | System.Windows.Forms.AnchorStyles.Left)
                | System.Windows.Forms.AnchorStyles.Right);
            this.chklbPlugins.Location = new System.Drawing.Point(11, 111);
            this.chklbPlugins.Name = "chklbPlugins";
            this.chklbPlugins.Size = new System.Drawing.Size(205, 174);
            this.chklbPlugins.TabIndex = 6;
            this.chklbPlugins.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.chklbPlugins_ItemCheck);
            this.chklbPlugins.MouseDown += new System.Windows.Forms.MouseEventHandler(this.chklbPlugins_MouseDown);
            //
            // btnMoveUp
            //
            this.btnMoveUp.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left);
            this.btnMoveUp.Location = new System.Drawing.Point(11, 306);
            this.btnMoveUp.Name = "btnMoveUp";
            this.btnMoveUp.Size = new System.Drawing.Size(93, 29);
            this.btnMoveUp.TabIndex = 7;
            this.btnMoveUp.Text = "Move Up";
            this.btnMoveUp.Click += new System.EventHandler(this.btnMove_Click);
            //
            // btnMoveDown
            //
            this.btnMoveDown.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left);
            this.btnMoveDown.Location = new System.Drawing.Point(124, 306);
            this.btnMoveDown.Name = "btnMoveDown";
            this.btnMoveDown.Size = new System.Drawing.Size(92, 29);
            this.btnMoveDown.TabIndex = 8;
            this.btnMoveDown.Text = "Move Down";
            this.btnMoveDown.Click += new System.EventHandler(this.btnMove_Click);
            //
            // txtPluginDescription
            //
            this.txtPluginDescription.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.txtPluginDescription.Location = new System.Drawing.Point(11, 23);
            this.txtPluginDescription.Multiline = true;
            this.txtPluginDescription.Name = "txtPluginDescription";
            this.txtPluginDescription.ReadOnly = true;
            this.txtPluginDescription.Size = new System.Drawing.Size(205, 88);
            this.txtPluginDescription.TabIndex = 9;
            this.txtPluginDescription.Text = "Packets are processed by the plugins in the order shown in the list.  Also, t" +
                "he plugins can be turned off by unchecking/checking the items.";
            //
            // lblPluginList
            //
            this.lblPluginList.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.lblPluginList.Location = new System.Drawing.Point(1, 3);
            this.lblPluginList.Name = "lblPluginList";
            this.lblPluginList.Size = new System.Drawing.Size(174, 20);
            this.lblPluginList.TabIndex = 10;
            this.lblPluginList.Text = "Plugin List";
            //
            // sbGesture
            //
            this.sbGesture.Anchor = ((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
                | System.Windows.Forms.AnchorStyles.Right);
            this.sbGesture.Dock = System.Windows.Forms.DockStyle.None;
            this.sbGesture.Location = new System.Drawing.Point(0, 350);
            this.sbGesture.Name = "sbGesture";
            this.sbGesture.Size = new System.Drawing.Size(614, 27);
            this.sbGesture.SizingGrip = false;
            this.sbGesture.TabIndex = 6;
            //
            // miMain
            //
            this.miMain.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                                this.miAction});
            //
            // miAction
            //
            this.miAction.Index = 0;
            this.miAction.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                                this.miClear,
                                                                                this.miSeparator,
                                                                                this.miExit});
            this.miAction.Text = "&Action";
            //
            // miClear
            //
            this.miClear.Index = 0;
            this.miClear.Text = "&Clear";
            this.miClear.Click += new System.EventHandler(this.miClear_Click);
            //
            // miSeparator
            //
            this.miSeparator.Index = 1;
            this.miSeparator.Text = "-";
            //
            // miExit
            //
            this.miExit.Index = 2;
            this.miExit.Text = "&Exit";
            this.miExit.Click += new System.EventHandler(this.miExit_Click);
            //
            // pnlPlugins
            //
            this.pnlPlugins.Anchor = ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                | System.Windows.Forms.AnchorStyles.Right);
            this.pnlPlugins.BackColor = System.Drawing.SystemColors.Control;
            this.pnlPlugins.Controls.AddRange(new System.Windows.Forms.Control[] {
                                                                                this.lblPluginList,
                                                                                this.txtPluginDescription,
                                                                                this.btnMoveDown,
                                                                                this.btnMoveUp,
                                                                                this.chklbPlugins});
            this.pnlPlugins.Location = new System.Drawing.Point(392, 8);
            this.pnlPlugins.Name = "pnlPlugins";
            this.pnlPlugins.Size = new System.Drawing.Size(216, 346);
            this.pnlPlugins.TabIndex = 7;
            //
            // RealTimeStylusPluginApp
            //
            this.AutoScaleBaseSize = new System.Drawing.Size(6, 15);
            this.ClientSize = new System.Drawing.Size(614, 377);
            this.Controls.AddRange(new System.Windows.Forms.Control[] {
                                                                          this.pnlPlugins,
                                                                          this.gbTestArea,
                                                                          this.sbGesture});
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
            this.MaximizeBox = false;
            this.Menu = this.miMain;
            this.MinimumSize = new System.Drawing.Size(440, 340);
            this.Name = "RealTimeStylusPluginApp";
            this.Text = "Real Time Stylus Plugin Sample Application";
            this.Load += new System.EventHandler(this.RealTimeStylusPlugin_Load);
            this.pnlPlugins.ResumeLayout(false);
            this.ResumeLayout(false);

        }

void RealTimeStylusPluginApp::RealTimeStylusPluginApp::InsertIntoPluginCollection ( int index ) [inline, private]

Helper method to insert the real time stylus plugin at the specified index into the plugin collection.

Parameters:
index The index of the plugin to insert.

Definition at line 607 of file RealTimeStylusPluginApp.cs.

        {
            // Obtain the index where the plugin should be inserted
            int insertAtIndex = FindPrecedingPlugin(index);
            IStylusSyncPlugin plugin = ((PluginListItem)chklbPlugins.Items[index]).Plugin;

            bool rtsEnabled = myRealTimeStylus.Enabled;
            myRealTimeStylus.Enabled = false;
            myRealTimeStylus.SyncPluginCollection.Insert(insertAtIndex,plugin);
            myRealTimeStylus.Enabled = rtsEnabled;

        }

static void RealTimeStylusPluginApp::RealTimeStylusPluginApp::Main ( ) [inline, static, private]

The main entry point for the application.

Definition at line 331 of file RealTimeStylusPluginApp.cs.

        {
            Application.Run(new RealTimeStylusPluginApp());
        }

void RealTimeStylusPluginApp::RealTimeStylusPluginApp::miClear_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from the Clear Menu Item.

Clears the screen.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 501 of file RealTimeStylusPluginApp.cs.

        {
            Clear();
        }

void RealTimeStylusPluginApp::RealTimeStylusPluginApp::miExit_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from the Exit Menu Item.

Exits the application.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 512 of file RealTimeStylusPluginApp.cs.

        {
            Application.Exit();
        }

void RealTimeStylusPluginApp::RealTimeStylusPluginApp::Packets | ( | RealTimeStylus | sender,
 |  | PacketsData | data |
 | ) |  |  | [inline]

Definition at line 693 of file RealTimeStylusPluginApp.cs.

{}

void RealTimeStylusPluginApp::RealTimeStylusPluginApp::RealTimeStylusDisabled | ( | RealTimeStylus | sender,
 |  | RealTimeStylusDisabledData | data |
 | ) |  |  | [inline]

Definition at line 684 of file RealTimeStylusPluginApp.cs.

{}

void RealTimeStylusPluginApp::RealTimeStylusPluginApp::RealTimeStylusEnabled | ( | RealTimeStylus | sender,
 |  | RealTimeStylusEnabledData | data |
 | ) |  |  | [inline]

Definition at line 685 of file RealTimeStylusPluginApp.cs.

{}

void RealTimeStylusPluginApp::RealTimeStylusPluginApp::RealTimeStylusPlugin_Load | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Event Handler from Form Load Event Setup the real time stylus for collection.

Parameters:
sender | The control that raised the event.
e | The event arguments.

Definition at line 343 of file RealTimeStylusPluginApp.cs.

        {

            // Create the real time stylus used to receive stylus notifications
            myRealTimeStylus = new RealTimeStylus(gbTestArea, true);

            // Store the Graphics object associated with the drawing area.
            customDynamicRendererGraphics = gbTestArea.CreateGraphics();

            // Create the plugins.  Note that since these are
            // synchronous plugins, notification will occur on the
            // pen thread.
            //
            // -PacketFilterPlugin: demonstrates packet modification by
            //  constraining all x,y packet data within a rectangular area.
            // -CustomDynamicRendererPlugin:  demonstrates custom dynamic
            //  rendering by drawing a small circle around each x,y.
            // -GestureRecognizer:  plugin provided by the Tablet PC Platform
            //  API, which recognizes application gestures.
            // -DynamicRenderer:  plugin provided by Tablet PC Platform API,
            // which renders packet data as it is collected.

            // Create the PacketFilterPlugin
            // Note that this custom plugin takes a rectangle in
            // ink space coordinates (.01mm = 1 ink space unit), which
            // specifies the filter region.  This sample uses a rectangle
            // that is centered over the drawing area.
            float right  = ((float)gbTestArea.Width*2540.0F)/(float)customDynamicRendererGraphics.DpiX;
            float bottom = ((float)gbTestArea.Height*2540.0F)/(float)customDynamicRendererGraphics.DpiY;
            Rectangle filterRect = new Rectangle((int)Math.Round(.15F*right),
                                                 (int)Math.Round(.15F*bottom),
                                                 (int)Math.Round(.7F*right),
                                                 (int)Math.Round(.7F*bottom));
            IStylusSyncPlugin filterPlugin = new PacketFilterPlugin(filterRect);
            chklbPlugins.Items.Add(new PluginListItem(filterPlugin,"PacketFilter"));

            // Create the CustomDynamicRendererPlugin
            IStylusSyncPlugin rendererPlugin = new CustomDynamicRendererPlugin(customDynamicRendererGraphics);
            chklbPlugins.Items.Add(new PluginListItem(rendererPlugin,"CustomDynamicRenderer"));

            // Attempt to create the GestureRecognizer plugin.
            // An exception will occur if no recognizers are available.
            // In this case, the sample proceeds, but does not add the
            // gesture recognizer into the list of available plugins.
            GestureRecognizer gr = null;
            try
            {
                gr = new GestureRecognizer();
                ApplicationGesture [] gestures = { ApplicationGesture.AllGestures };
                gr.EnableGestures(gestures);
                chklbPlugins.Items.Add(new PluginListItem(gr,"GestureRecognizer"));
            }
            catch
            {
            }

            // Create the dynamic renderer used to render the stroke that is
            //  currently being collected
            DynamicRenderer dr = new DynamicRenderer(gbTestArea);
            chklbPlugins.Items.Add(new PluginListItem(dr,"DynamicRenderer"));

            // Enable all plugins
            for(int i = 0; i < chklbPlugins.Items.Count; i++)
            {
                chklbPlugins.SetItemChecked(i,true);
            }

            // Add this form to the collection of asynchronous plugins.
            // The CustomStylusDataAdded notification will be used to
            // update the form's UI when an application gesture occurs.
            // Since this is an asynchronous plugin, notification will
            // occur on the UI thread.
            myRealTimeStylus.AsyncPluginCollection.Add(this);

            // Enable the RealTimeStylus, GestureRecognizer, and DynamicRenderer
            myRealTimeStylus.Enabled = true;
            if (gr != null)
            {
                gr.Enabled = true;
            }
            dr.Enabled = true;
        }

void RealTimeStylusPluginApp::RealTimeStylusPluginApp::RemoveFromPluginCollection ( int index ) [inline, private]

Helper method to remove the real time stylus plugin at the specified index from the plugin collection.

Parameters:
index The index of the plugin to remove.

Definition at line 625 of file RealTimeStylusPluginApp.cs.

        {
            IStylusSyncPlugin plugin = ((PluginListItem)chklbPlugins.Items[index]).Plugin;

            bool rtsEnabled = myRealTimeStylus.Enabled;
            myRealTimeStylus.Enabled = false;
            myRealTimeStylus.SyncPluginCollection.Remove(plugin);
            myRealTimeStylus.Enabled = rtsEnabled;
        }

void RealTimeStylusPluginApp::RealTimeStylusPluginApp::StylusButtonDown | ( | RealTimeStylus | sender,
 |  | StylusButtonDownData | data |
 | ) |  |  | [inline]

Definition at line 690 of file RealTimeStylusPluginApp.cs.

{}

void RealTimeStylusPluginApp::RealTimeStylusPluginApp::StylusButtonUp | ( | RealTimeStylus | sender,
 |  | StylusButtonUpData | data |
 | ) |  |  | [inline]

Definition at line 691 of file RealTimeStylusPluginApp.cs.

{}

void RealTimeStylusPluginApp::RealTimeStylusPluginApp::StylusDown | ( | RealTimeStylus | sender,
 |  | StylusDownData | data |
 | ) |  |  | [inline]

Definition at line 688 of file RealTimeStylusPluginApp.cs.

{}

void RealTimeStylusPluginApp::RealTimeStylusPluginApp::StylusInRange | ( | RealTimeStylus | sender,
 |  | StylusInRangeData | data |
 | ) |  |  | [inline]

Definition at line 687 of file RealTimeStylusPluginApp.cs.

{}

void RealTimeStylusPluginApp::RealTimeStylusPluginApp::StylusOutOfRange | ( | RealTimeStylus | sender,
 |  | StylusOutOfRangeData | data |
 | ) |  |  | [inline]

Definition at line 686 of file RealTimeStylusPluginApp.cs.

{}

void RealTimeStylusPluginApp::RealTimeStylusPluginApp::StylusUp | ( | RealTimeStylus | sender,
 |  | StylusUpData | data |
 | ) |  |  | [inline]

Definition at line 689 of file RealTimeStylusPluginApp.cs.

{}

void RealTimeStylusPluginApp::RealTimeStylusPluginApp::SystemGesture | ( | RealTimeStylus | sender,
 |  | SystemGestureData | data |
 | ) |  |  | [inline]

Definition at line 692 of file RealTimeStylusPluginApp.cs.

{}

void RealTimeStylusPluginApp::RealTimeStylusPluginApp::TabletAdded | ( | RealTimeStylus | sender,
 |  | TabletAddedData | data |
 | ) |  |  | [inline]

Definition at line 695 of file RealTimeStylusPluginApp.cs.

{}

void RealTimeStylusPluginApp::RealTimeStylusPluginApp::TabletRemoved | ( | RealTimeStylus | sender,
 |  | TabletRemovedData | data |
 | ) |  |  | [inline]

Definition at line 696 of file RealTimeStylusPluginApp.cs.

{}

Member Data Documentation

System.Windows.Forms.Button RealTimeStylusPluginApp::RealTimeStylusPluginApp::btnMoveDown [private]

Definition at line 106 of file RealTimeStylusPluginApp.cs.

System.Windows.Forms.Button RealTimeStylusPluginApp::RealTimeStylusPluginApp::btnMoveUp [private]

Definition at line 105 of file RealTimeStylusPluginApp.cs.

System.Windows.Forms.CheckedListBox RealTimeStylusPluginApp::RealTimeStylusPluginApp::chklbPlugins [private]

Definition at line 107 of file RealTimeStylusPluginApp.cs.

System.ComponentModel.Container RealTimeStylusPluginApp::RealTimeStylusPluginApp::components = null [private]

Required designer variable.

Definition at line 123 of file RealTimeStylusPluginApp.cs.

Graphics RealTimeStylusPluginApp::RealTimeStylusPluginApp::customDynamicRendererGraphics [private]

Definition at line 101 of file RealTimeStylusPluginApp.cs.

System.Windows.Forms.GroupBox RealTimeStylusPluginApp::RealTimeStylusPluginApp::gbTestArea [private]

Definition at line 104 of file RealTimeStylusPluginApp.cs.

MouseEventArgs RealTimeStylusPluginApp::RealTimeStylusPluginApp::lastMouseDownEventArgs = null [private]

Private field used to track the last MouseDown event information for use in the chklbPlugins_ItemCheck handler.

Definition at line 430 of file RealTimeStylusPluginApp.cs.

System.Windows.Forms.Label RealTimeStylusPluginApp::RealTimeStylusPluginApp::lblPluginList [private]

Definition at line 113 of file RealTimeStylusPluginApp.cs.

System.Windows.Forms.MenuItem RealTimeStylusPluginApp::RealTimeStylusPluginApp::miAction [private]

Definition at line 109 of file RealTimeStylusPluginApp.cs.

System.Windows.Forms.MenuItem RealTimeStylusPluginApp::RealTimeStylusPluginApp::miClear [private]

Definition at line 110 of file RealTimeStylusPluginApp.cs.

System.Windows.Forms.MenuItem RealTimeStylusPluginApp::RealTimeStylusPluginApp::miExit [private]

Definition at line 111 of file RealTimeStylusPluginApp.cs.

System.Windows.Forms.MainMenu RealTimeStylusPluginApp::RealTimeStylusPluginApp::miMain [private]

Definition at line 114 of file RealTimeStylusPluginApp.cs.

System.Windows.Forms.MenuItem RealTimeStylusPluginApp::RealTimeStylusPluginApp::miSeparator [private]

Definition at line 115 of file RealTimeStylusPluginApp.cs.

RealTimeStylus RealTimeStylusPluginApp::RealTimeStylusPluginApp::myRealTimeStylus [private]

Definition at line 97 of file RealTimeStylusPluginApp.cs.

System.Windows.Forms.Panel RealTimeStylusPluginApp::RealTimeStylusPluginApp::pnlPlugins [private]

Definition at line 116 of file RealTimeStylusPluginApp.cs.

System.Windows.Forms.StatusBar RealTimeStylusPluginApp::RealTimeStylusPluginApp::sbGesture [private]

Definition at line 108 of file RealTimeStylusPluginApp.cs.

System.Windows.Forms.TextBox RealTimeStylusPluginApp::RealTimeStylusPluginApp::txtPluginDescription [private]

Definition at line 112 of file RealTimeStylusPluginApp.cs.

Property Documentation

DataInterestMask RealTimeStylusPluginApp::RealTimeStylusPluginApp::DataInterest [get]

Defines the types of notifications the plugin is interested in.

Definition at line 676 of file RealTimeStylusPluginApp.cs.

The documentation for this class was generated from the following file:
  • TabletPC/RealTimeStylusPlugin/C#/RealTimeStylusPluginApp.cs
Generated on Wed Nov 13 2024 16:58:17 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: RealTimeStylusPlugins::CustomDynamicRendererPlugin Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • RealTimeStylusPlugins
  • RealTimeStylusPlugins::CustomDynamicRendererPlugin
Public Member Functions | Properties | Private Attributes

RealTimeStylusPlugins::CustomDynamicRendererPlugin Class Reference

A real time stylus plugin that demonstrates custom dynamic rendering.

List of all members.

Public Member Functions

CustomDynamicRendererPlugin (Graphics g)
void | CustomStylusDataAdded (RealTimeStylus sender, CustomStylusData data)
void | Error (RealTimeStylus sender, ErrorData data)
void | InAirPackets (RealTimeStylus sender, InAirPacketsData data)
void | Packets (RealTimeStylus sender, PacketsData data)
void | RealTimeStylusDisabled (RealTimeStylus sender, RealTimeStylusDisabledData data)
void | RealTimeStylusEnabled (RealTimeStylus sender, RealTimeStylusEnabledData data)
void | StylusButtonDown (RealTimeStylus sender, StylusButtonDownData data)
void | StylusButtonUp (RealTimeStylus sender, StylusButtonUpData data)
void | StylusDown (RealTimeStylus sender, StylusDownData data)
void | StylusInRange (RealTimeStylus sender, StylusInRangeData data)
void | StylusOutOfRange (RealTimeStylus sender, StylusOutOfRangeData data)
void | StylusUp (RealTimeStylus sender, StylusUpData data)
void | SystemGesture (RealTimeStylus sender, SystemGestureData data)
void | TabletAdded (RealTimeStylus sender, TabletAddedData data)
void | TabletRemoved (RealTimeStylus sender, TabletRemovedData data)

Properties

DataInterestMask | DataInterest [get]

Private Attributes

Graphics | myGraphics

Detailed Description

Definition at line 40 of file CustomDynamicRendererPlugin.cs.

Constructor & Destructor Documentation

RealTimeStylusPlugins::CustomDynamicRendererPlugin::CustomDynamicRendererPlugin ( Graphics g ) [inline]

Constructor for this plugin.

Parameters:
g The graphics object used for dynamic rendering.

Definition at line 49 of file CustomDynamicRendererPlugin.cs.

        {
            myGraphics = g;
        }

Member Function Documentation

void RealTimeStylusPlugins::CustomDynamicRendererPlugin::CustomStylusDataAdded | ( | RealTimeStylus | sender,
 |  | CustomStylusData | data |
 | ) |  |  | [inline]

Definition at line 111 of file CustomDynamicRendererPlugin.cs.

{}

void RealTimeStylusPlugins::CustomDynamicRendererPlugin::Error | ( | RealTimeStylus | sender,
 |  | ErrorData | data |
 | ) |  |  | [inline]

Called when the current plugin or the ones previous in the list threw an exception.

Parameters:
sender | The real time stylus associated with the notification
data | The notification data

Definition at line 86 of file CustomDynamicRendererPlugin.cs.

        {
             Debug.Assert(false, null, "An error occurred.  DataId=" + data.DataId + ", " + "Exception=" + data.InnerException);
        }

void RealTimeStylusPlugins::CustomDynamicRendererPlugin::InAirPackets | ( | RealTimeStylus | sender,
 |  | InAirPacketsData | data |
 | ) |  |  | [inline]

Definition at line 113 of file CustomDynamicRendererPlugin.cs.

{}

void RealTimeStylusPlugins::CustomDynamicRendererPlugin::Packets | ( | RealTimeStylus | sender,
 |  | PacketsData | data |
 | ) |  |  | [inline]

Occurs when the stylus moves on the digitizer surface.

Use this notification to draw a small circle around each new packet received.

Parameters:
sender | The real time stylus associated with the notification
data | The notification data

Definition at line 62 of file CustomDynamicRendererPlugin.cs.

        {
            // For each new packet received, extract the x,y data
            // and draw a small circle around the result.
            for (int i = 0; i < data.Count; i += data.PacketPropertyCount)
            {
                // Packet data always has x followed by y followed by the rest
                Point point = new Point(data[i], data[i+1]);

                // Since the packet data is in Ink Space coordinates, we need to convert to Pixels...
                point.X = (int)Math.Round((float)point.X * (float)myGraphics.DpiX/2540.0F);
                point.Y = (int)Math.Round((float)point.Y * (float)myGraphics.DpiY/2540.0F);

                // Draw a circle corresponding to the packet
                myGraphics.DrawEllipse(Pens.Green, point.X - 2, point.Y - 2, 4, 4);
            }
        }

void RealTimeStylusPlugins::CustomDynamicRendererPlugin::RealTimeStylusDisabled | ( | RealTimeStylus | sender,
 |  | RealTimeStylusDisabledData | data |
 | ) |  |  | [inline]

Definition at line 103 of file CustomDynamicRendererPlugin.cs.

{}

void RealTimeStylusPlugins::CustomDynamicRendererPlugin::RealTimeStylusEnabled | ( | RealTimeStylus | sender,
 |  | RealTimeStylusEnabledData | data |
 | ) |  |  | [inline]

Definition at line 104 of file CustomDynamicRendererPlugin.cs.

{}

void RealTimeStylusPlugins::CustomDynamicRendererPlugin::StylusButtonDown | ( | RealTimeStylus | sender,
 |  | StylusButtonDownData | data |
 | ) |  |  | [inline]

Definition at line 109 of file CustomDynamicRendererPlugin.cs.

{}

void RealTimeStylusPlugins::CustomDynamicRendererPlugin::StylusButtonUp | ( | RealTimeStylus | sender,
 |  | StylusButtonUpData | data |
 | ) |  |  | [inline]

Definition at line 110 of file CustomDynamicRendererPlugin.cs.

{}

void RealTimeStylusPlugins::CustomDynamicRendererPlugin::StylusDown | ( | RealTimeStylus | sender,
 |  | StylusDownData | data |
 | ) |  |  | [inline]

Definition at line 107 of file CustomDynamicRendererPlugin.cs.

{}

void RealTimeStylusPlugins::CustomDynamicRendererPlugin::StylusInRange | ( | RealTimeStylus | sender,
 |  | StylusInRangeData | data |
 | ) |  |  | [inline]

Definition at line 106 of file CustomDynamicRendererPlugin.cs.

{}

void RealTimeStylusPlugins::CustomDynamicRendererPlugin::StylusOutOfRange | ( | RealTimeStylus | sender,
 |  | StylusOutOfRangeData | data |
 | ) |  |  | [inline]

Definition at line 105 of file CustomDynamicRendererPlugin.cs.

{}

void RealTimeStylusPlugins::CustomDynamicRendererPlugin::StylusUp | ( | RealTimeStylus | sender,
 |  | StylusUpData | data |
 | ) |  |  | [inline]

Definition at line 108 of file CustomDynamicRendererPlugin.cs.

{}

void RealTimeStylusPlugins::CustomDynamicRendererPlugin::SystemGesture | ( | RealTimeStylus | sender,
 |  | SystemGestureData | data |
 | ) |  |  | [inline]

Definition at line 112 of file CustomDynamicRendererPlugin.cs.

{}

void RealTimeStylusPlugins::CustomDynamicRendererPlugin::TabletAdded | ( | RealTimeStylus | sender,
 |  | TabletAddedData | data |
 | ) |  |  | [inline]

Definition at line 114 of file CustomDynamicRendererPlugin.cs.

{}

void RealTimeStylusPlugins::CustomDynamicRendererPlugin::TabletRemoved | ( | RealTimeStylus | sender,
 |  | TabletRemovedData | data |
 | ) |  |  | [inline]

Definition at line 115 of file CustomDynamicRendererPlugin.cs.

{}

Member Data Documentation

Graphics RealTimeStylusPlugins::CustomDynamicRendererPlugin::myGraphics [private]

Definition at line 43 of file CustomDynamicRendererPlugin.cs.

Property Documentation

DataInterestMask RealTimeStylusPlugins::CustomDynamicRendererPlugin::DataInterest [get]

Defines the types of notifications the plugin is interested in.

Definition at line 95 of file CustomDynamicRendererPlugin.cs.

The documentation for this class was generated from the following file:
  • TabletPC/RealTimeStylusPlugin/C#/CustomDynamicRendererPlugin.cs
Generated on Wed Nov 13 2024 16:58:17 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: RealTimeStylusPlugins::PacketFilterPlugin Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • RealTimeStylusPlugins
  • RealTimeStylusPlugins::PacketFilterPlugin
Public Member Functions | Properties | Private Member Functions | Private Attributes

RealTimeStylusPlugins::PacketFilterPlugin Class Reference

A real time stylus plugin that demonstrates packet modification.

List of all members.

Public Member Functions

PacketFilterPlugin (Rectangle r)
void | CustomStylusDataAdded (RealTimeStylus sender, CustomStylusData data)
void | Error (RealTimeStylus sender, ErrorData data)
void | InAirPackets (RealTimeStylus sender, InAirPacketsData data)
void | Packets (RealTimeStylus sender, PacketsData data)
void | RealTimeStylusDisabled (RealTimeStylus sender, RealTimeStylusDisabledData data)
void | RealTimeStylusEnabled (RealTimeStylus sender, RealTimeStylusEnabledData data)
void | StylusButtonDown (RealTimeStylus sender, StylusButtonDownData data)
void | StylusButtonUp (RealTimeStylus sender, StylusButtonUpData data)
void | StylusDown (RealTimeStylus sender, StylusDownData data)
void | StylusInRange (RealTimeStylus sender, StylusInRangeData data)
void | StylusOutOfRange (RealTimeStylus sender, StylusOutOfRangeData data)
void | StylusUp (RealTimeStylus sender, StylusUpData data)
void | SystemGesture (RealTimeStylus sender, SystemGestureData data)
void | TabletAdded (RealTimeStylus sender, TabletAddedData data)
void | TabletRemoved (RealTimeStylus sender, TabletRemovedData data)

Properties

DataInterestMask | DataInterest [get]

Private Member Functions

void | ModifyPacketData (StylusDataBase data)

Private Attributes

Rectangle | rectangle = Rectangle.Empty

Detailed Description

Definition at line 39 of file PacketFilterPlugin.cs.

Constructor & Destructor Documentation

RealTimeStylusPlugins::PacketFilterPlugin::PacketFilterPlugin ( Rectangle r ) [inline]

Constructor for this plugin.

Parameters:
g The rectangle where packets will be restricted (in ink space coordinates).

Definition at line 52 of file PacketFilterPlugin.cs.

        {
            rectangle = r;
        }

Member Function Documentation

void RealTimeStylusPlugins::PacketFilterPlugin::CustomStylusDataAdded | ( | RealTimeStylus | sender,
 |  | CustomStylusData | data |
 | ) |  |  | [inline]

Definition at line 160 of file PacketFilterPlugin.cs.

{}

void RealTimeStylusPlugins::PacketFilterPlugin::Error | ( | RealTimeStylus | sender,
 |  | ErrorData | data |
 | ) |  |  | [inline]

Called when the current plugin or the ones previous in the list threw an exception.

Parameters:
sender | The real time stylus associated with the notification
data | The notification data

Definition at line 134 of file PacketFilterPlugin.cs.

        {
            Debug.Assert(false, null, "An error occurred.  DataId=" + data.DataId + ", " + "Exception=" + data.InnerException);
        }

void RealTimeStylusPlugins::PacketFilterPlugin::InAirPackets | ( | RealTimeStylus | sender,
 |  | InAirPacketsData | data |
 | ) |  |  | [inline]

Definition at line 162 of file PacketFilterPlugin.cs.

{}

void RealTimeStylusPlugins::PacketFilterPlugin::ModifyPacketData ( StylusDataBase data ) [inline, private]

Helper method that constrains packet data within a specified input rectangle.

Parameters:
data The data to modify.

Definition at line 62 of file PacketFilterPlugin.cs.

        {
            // For each packet in the packet data, check whether
            // its x,y values fall outside of the specified rectangle.
            // If so, replace them with the nearest point that still
            // falls within the rectangle.
            for (int i = 0; i < data.Count ; i += data.PacketPropertyCount)
            {
                // packet data always has x followed by y followed by the rest
                int x = data[i];
                int y = data[i+1];

                // Constrain points to the input rectangle
                x = Math.Max(x, rectangle.Left);
                x = Math.Min(x, rectangle.Right);
                y = Math.Max(y, rectangle.Top);
                y = Math.Min(y, rectangle.Bottom);

                // If necessary, modify the x,y packet data
                if (x != data[i])
                {
                    data[i] = x;
                }
                if (y != data[i+1])
                {
                    data[i+1] = y;
                }
            }
        }

void RealTimeStylusPlugins::PacketFilterPlugin::Packets | ( | RealTimeStylus | sender,
 |  | PacketsData | data |
 | ) |  |  | [inline]

Occurs when the stylus moves on the digitizer surface.

Use this notification to constrain the packet data within a specified rectangle.

Parameters:
sender | The real time stylus associated with the notification
data | The notification data

Definition at line 111 of file PacketFilterPlugin.cs.

        {
            ModifyPacketData(data);
        }

void RealTimeStylusPlugins::PacketFilterPlugin::RealTimeStylusDisabled | ( | RealTimeStylus | sender,
 |  | RealTimeStylusDisabledData | data |
 | ) |  |  | [inline]

Definition at line 154 of file PacketFilterPlugin.cs.

{}

void RealTimeStylusPlugins::PacketFilterPlugin::RealTimeStylusEnabled | ( | RealTimeStylus | sender,
 |  | RealTimeStylusEnabledData | data |
 | ) |  |  | [inline]

Definition at line 155 of file PacketFilterPlugin.cs.

{}

void RealTimeStylusPlugins::PacketFilterPlugin::StylusButtonDown | ( | RealTimeStylus | sender,
 |  | StylusButtonDownData | data |
 | ) |  |  | [inline]

Definition at line 158 of file PacketFilterPlugin.cs.

{}

void RealTimeStylusPlugins::PacketFilterPlugin::StylusButtonUp | ( | RealTimeStylus | sender,
 |  | StylusButtonUpData | data |
 | ) |  |  | [inline]

Definition at line 159 of file PacketFilterPlugin.cs.

{}

void RealTimeStylusPlugins::PacketFilterPlugin::StylusDown | ( | RealTimeStylus | sender,
 |  | StylusDownData | data |
 | ) |  |  | [inline]

Occurs when the stylus touches the digitizer surface.

Use this notificaton to constrain the packet data within a specified rectangle.

Parameters:
sender | The real time stylus associated with the notification
data | The notification data

Definition at line 99 of file PacketFilterPlugin.cs.

        {
            ModifyPacketData(data);
        }

void RealTimeStylusPlugins::PacketFilterPlugin::StylusInRange | ( | RealTimeStylus | sender,
 |  | StylusInRangeData | data |
 | ) |  |  | [inline]

Definition at line 157 of file PacketFilterPlugin.cs.

{}

void RealTimeStylusPlugins::PacketFilterPlugin::StylusOutOfRange | ( | RealTimeStylus | sender,
 |  | StylusOutOfRangeData | data |
 | ) |  |  | [inline]

Definition at line 156 of file PacketFilterPlugin.cs.

{}

void RealTimeStylusPlugins::PacketFilterPlugin::StylusUp | ( | RealTimeStylus | sender,
 |  | StylusUpData | data |
 | ) |  |  | [inline]

Occurs when the stylus leaves the digitizer surface.

Use this notification to constrain the packet data within a specified rectangle.

Parameters:
sender | The real time stylus associated with the notification
data | The notification data

Definition at line 123 of file PacketFilterPlugin.cs.

        {
            ModifyPacketData(data);
        }

void RealTimeStylusPlugins::PacketFilterPlugin::SystemGesture | ( | RealTimeStylus | sender,
 |  | SystemGestureData | data |
 | ) |  |  | [inline]

Definition at line 161 of file PacketFilterPlugin.cs.

{}

void RealTimeStylusPlugins::PacketFilterPlugin::TabletAdded | ( | RealTimeStylus | sender,
 |  | TabletAddedData | data |
 | ) |  |  | [inline]

Definition at line 163 of file PacketFilterPlugin.cs.

{}

void RealTimeStylusPlugins::PacketFilterPlugin::TabletRemoved | ( | RealTimeStylus | sender,
 |  | TabletRemovedData | data |
 | ) |  |  | [inline]

Definition at line 164 of file PacketFilterPlugin.cs.

{}

Member Data Documentation

Rectangle RealTimeStylusPlugins::PacketFilterPlugin::rectangle = Rectangle.Empty [private]

Definition at line 44 of file PacketFilterPlugin.cs.

Property Documentation

DataInterestMask RealTimeStylusPlugins::PacketFilterPlugin::DataInterest [get]

Defines the types of notifications the plugin is interested in.

Definition at line 143 of file PacketFilterPlugin.cs.

The documentation for this class was generated from the following file:
  • TabletPC/RealTimeStylusPlugin/C#/PacketFilterPlugin.cs
Generated on Wed Nov 13 2024 16:58:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: RECEIVE_CONTEXT Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

RECEIVE_CONTEXT Struct Reference

List of all members.

Public Attributes

HANDLE hQueue
OVERLAPPED | ov
MQMSGPROPS * | pmsgprops

Detailed Description

Definition at line 73 of file MQPort.Cpp.

Member Data Documentation

HANDLE RECEIVE_CONTEXT::hQueue

Definition at line 76 of file MQPort.Cpp.

OVERLAPPED RECEIVE_CONTEXT::ov

Definition at line 75 of file MQPort.Cpp.

MQMSGPROPS* RECEIVE_CONTEXT::pmsgprops

Definition at line 77 of file MQPort.Cpp.

The documentation for this struct was generated from the following file:
  • NetDS/MessageQueuing/MQPort/MQPort.Cpp
Generated on Wed Nov 13 2024 16:57:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: RECTI Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

RECTI Struct Reference

#include "Paint.h"

List of all members.

Public Attributes

int | bottom
int | left
int | right
int | top

Detailed Description

Definition at line 35 of file Paint.h.

Member Data Documentation

int RECTI::bottom

Definition at line 40 of file Paint.h.

int RECTI::left

Definition at line 37 of file Paint.h.

int RECTI::right

Definition at line 39 of file Paint.h.

int RECTI::top

Definition at line 38 of file Paint.h.

The documentation for this struct was generated from the following file:
  • Multimedia/Gdi/Printer/Paint.h
Generated on Wed Nov 13 2024 16:57:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: RecvBuf Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes | Private Attributes

RecvBuf Class Reference

#include "recvbuf.hpp"

Inherited by CUrlmonCallback.

List of all members.

Public Member Functions

RecvBuf ()
~RecvBuf ()
BOOL BufAlloc (DWORD dwSize)
PBYTE | BufBeg (void)
void | BufReset (void)
BOOL | BufScanInt (DWORD *pdwRet, BYTE cDelimit)
BOOL | BufScanStr (PSTR pszSearch, DWORD cbSearch)
void | BufShift (void)
DWORD | BufSize (void)
DWORD | BufSpace (void)

Public Attributes

PBYTE | m_pbDataBeg
PBYTE | m_pbDataEnd

Private Attributes

DWORD m_cbBufSize
PBYTE | m_pbBufBeg
PBYTE | m_pbBufEnd

Detailed Description

Definition at line 21 of file recvbuf.hpp.

Constructor & Destructor Documentation

RecvBuf::RecvBuf ( ) [inline]

Definition at line 32 of file recvbuf.hpp.

    {
        m_pbBufBeg = NULL;
    }

RecvBuf::~RecvBuf ( ) [inline]

Definition at line 37 of file recvbuf.hpp.

    {
        if (m_pbBufBeg)
            LocalFree ((HLOCAL) m_pbBufBeg);
    }

Member Function Documentation

BOOL RecvBuf::BufAlloc ( DWORD dwSize )

Definition at line 27 of file recvbuf.Cpp.

{
    m_cbBufSize = dwSize;
    m_pbBufBeg = (PBYTE) LocalAlloc (LMEM_FIXED, m_cbBufSize);
    if (!m_pbBufBeg)
        return FALSE;
    m_pbBufEnd = m_pbBufBeg + m_cbBufSize;
    m_pbDataBeg = m_pbBufBeg;
    m_pbDataEnd = m_pbBufBeg;
    return TRUE;
}

PBYTE RecvBuf::BufBeg ( void ) [inline]

Definition at line 43 of file recvbuf.hpp.

{ return m_pbBufBeg; }

void RecvBuf::BufReset ( void ) [inline]

Definition at line 47 of file recvbuf.hpp.

    {
        m_pbDataBeg = m_pbBufBeg;
        m_pbDataEnd = m_pbBufBeg;
    }

BOOL RecvBuf::BufScanInt | ( | DWORD * | pdwRet,
 |  | BYTE | cDelimit
 | ) |  |

Definition at line 80 of file recvbuf.Cpp.

{
  DWORD dwRet = 0;

  // Scan past non-delimiters and non-digits.
  while (*m_pbDataBeg != cDelimit && !isdigit(*m_pbDataBeg))
  {
    if (++m_pbDataBeg >= m_pbDataEnd)
      return FALSE;
  }

  while (*m_pbDataBeg != cDelimit)
  {
    if (!isdigit(*m_pbDataBeg))
      return FALSE;
    if (dwRet > ULONG_MAX / 10)
      return FALSE;
    dwRet *= 10;
    dwRet += *m_pbDataBeg - '0';
    if (++m_pbDataBeg >= m_pbDataEnd)
      return FALSE;
  }

  *pdwRet = dwRet;
  return TRUE;
}

BOOL RecvBuf::BufScanStr | ( | PSTR | pszSearch,
 |  | DWORD | cbSearch
 | ) |  |

Definition at line 43 of file recvbuf.Cpp.

{
  PBYTE pbLimit = m_pbDataEnd - cbSearch;

  while (m_pbDataBeg < pbLimit)
  {
      DWORD ibSearch;

    // Check for overflow.
    if (m_pbDataBeg >= pbLimit)
      return FALSE;

      for (ibSearch = 0; ibSearch < cbSearch; ibSearch++)
      {
          if (upcase(m_pbDataBeg[ibSearch]) != upcase(pszSearch[ibSearch]))
              break;
      }

      if (ibSearch == cbSearch)
      {
          // Found it.
            m_pbDataBeg += cbSearch;
          return TRUE;
      }
      else
      {
          m_pbDataBeg++;
          continue;
      }
  }
  return FALSE;
}

void RecvBuf::BufShift ( void ) [inline]

Definition at line 53 of file recvbuf.hpp.

    {
        if (m_pbDataBeg > m_pbBufBeg)
        {
            // Shift the data to front of buffer.
            DWORD cbData = (DWORD)(m_pbDataEnd - m_pbDataBeg);
            MoveMemory (m_pbBufBeg, m_pbDataBeg, cbData);
            m_pbDataBeg  = m_pbBufBeg;
            m_pbDataEnd  = m_pbBufBeg + cbData;
        }
    }

DWORD RecvBuf::BufSize ( void ) [inline]

Definition at line 45 of file recvbuf.hpp.

{ return m_cbBufSize; }

DWORD RecvBuf::BufSpace ( void ) [inline]

Definition at line 44 of file recvbuf.hpp.

{ return (DWORD)(m_pbBufEnd - m_pbDataEnd); }

Member Data Documentation

DWORD RecvBuf::m_cbBufSize [private]

Definition at line 23 of file recvbuf.hpp.

PBYTE RecvBuf::m_pbBufBeg [private]

Definition at line 24 of file recvbuf.hpp.

PBYTE RecvBuf::m_pbBufEnd [private]

Definition at line 25 of file recvbuf.hpp.

PBYTE RecvBuf::m_pbDataBeg

Definition at line 29 of file recvbuf.hpp.

PBYTE RecvBuf::m_pbDataEnd

Definition at line 30 of file recvbuf.hpp.

The documentation for this class was generated from the following files:
  • Com/Fundamentals/ActiveDocument/Range/recvbuf.hpp
  • Com/Fundamentals/ActiveDocument/Range/recvbuf.Cpp
Generated on Wed Nov 13 2024 16:57:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: RefCount Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

RefCount Class Reference

#include "clUtil.h"

Inherited by CAppShareNotify, CAppShareNotify, CCallNotify, CCallNotify, CChannelNotify, CConfNotify, CConfNotify, CConfNotify, CConfNotify, CDataNotify, CDataNotify, CFileTransferNotify, CFtNotify, CMgrNotify, CMgrNotify, CMgrNotify, and CMgrNotify.

List of all members.

Public Member Functions

RefCount ()
RefCount ()
RefCount ()
RefCount ()
RefCount ()
virtual | ~RefCount ()
virtual | ~RefCount ()
virtual | ~RefCount ()
virtual | ~RefCount ()
virtual | ~RefCount ()
ULONG STDMETHODCALLTYPE | AddRef (void)
ULONG STDMETHODCALLTYPE | AddRef (void)
ULONG STDMETHODCALLTYPE | AddRef (void)
ULONG STDMETHODCALLTYPE | AddRef (void)
ULONG STDMETHODCALLTYPE | AddRef (void)
ULONG STDMETHODCALLTYPE | Release (void)
ULONG STDMETHODCALLTYPE | Release (void)
ULONG STDMETHODCALLTYPE | Release (void)
ULONG STDMETHODCALLTYPE | Release (void)
ULONG STDMETHODCALLTYPE | Release (void)

Private Attributes

LONG | m_cRef

Detailed Description

Definition at line 25 of file clUtil.h.

Constructor & Destructor Documentation

RefCount::RefCount ( void )

Definition at line 31 of file clUtil.Cpp.

{
  m_cRef = 1;
}

RefCount::~RefCount ( void ) [virtual]

Definition at line 43 of file clUtil.Cpp.

{
}

RefCount::RefCount ( )
virtual RefCount::~RefCount ( ) [virtual]
RefCount::RefCount ( )
virtual RefCount::~RefCount ( ) [virtual]
RefCount::RefCount ( )
virtual RefCount::~RefCount ( ) [virtual]
RefCount::RefCount ( )
virtual RefCount::~RefCount ( ) [virtual]

Member Function Documentation

ULONG STDMETHODCALLTYPE RefCount::AddRef ( void )

Definition at line 54 of file clUtil.Cpp.

{
   ASSERT(m_cRef >= 0);

   InterlockedIncrement(&m_cRef);

   return (ULONG) m_cRef;
}

ULONG STDMETHODCALLTYPE RefCount::AddRef ( void )
ULONG STDMETHODCALLTYPE RefCount::AddRef ( void )
ULONG STDMETHODCALLTYPE RefCount::AddRef ( void )
ULONG STDMETHODCALLTYPE RefCount::AddRef ( void )
ULONG STDMETHODCALLTYPE RefCount::Release ( void )
ULONG STDMETHODCALLTYPE RefCount::Release ( void )

Definition at line 64 of file clUtil.Cpp.

{
  if (0 == InterlockedDecrement(&m_cRef))
  {
    delete this;
    return 0;
  }

  ASSERT(m_cRef > 0);
  return (ULONG) m_cRef;
}

ULONG STDMETHODCALLTYPE RefCount::Release ( void )
ULONG STDMETHODCALLTYPE RefCount::Release ( void )
ULONG STDMETHODCALLTYPE RefCount::Release ( void )

Member Data Documentation

LONG RefCount::m_cRef [private]

Definition at line 28 of file clUtil.h.

The documentation for this class was generated from the following files:
  • Web/NetMeeting/NMChat/clUtil.h
  • Web/NetMeeting/NMFT/clUtil.h
  • Web/NetMeeting/NMShare/clUtil.h
  • Web/NetMeeting/NMUI/clUtil.h
  • Web/NetMeeting/PlugTransport/utils.h
  • Web/NetMeeting/NMChat/clUtil.Cpp
  • Web/NetMeeting/NMFT/clUtil.Cpp
  • Web/NetMeeting/NMShare/clUtil.Cpp
  • Web/NetMeeting/NMUI/clUtil.Cpp
  • Web/NetMeeting/PlugTransport/utils.cpp
Generated on Wed Nov 13 2024 16:57:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: REGENTRY Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

REGENTRY Struct Reference

#include "common.h"

List of all members.

Public Attributes

HKEY hRootKey
CHAR * | szKeyName
CHAR * | szValue
CHAR * | szValueName

Detailed Description

Definition at line 67 of file common.h.

Member Data Documentation

HKEY REGENTRY::hRootKey

Definition at line 69 of file common.h.

CHAR* REGENTRY::szKeyName

Definition at line 70 of file common.h.

CHAR* REGENTRY::szValue

Definition at line 72 of file common.h.

CHAR* REGENTRY::szValueName

Definition at line 71 of file common.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/osp/vc/common.h
Generated on Wed Nov 13 2024 16:57:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: REGSTRUCT Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

REGSTRUCT Struct Reference

List of all members.

Public Attributes

HKEY hRootKey
LPTSTR lpszData
LPTSTR lpszSubKey
LPTSTR lpszValueName

Detailed Description

Definition at line 149 of file SampView.Cpp.

Member Data Documentation

HKEY REGSTRUCT::hRootKey

Definition at line 150 of file SampView.Cpp.

LPTSTR REGSTRUCT::lpszData

Definition at line 153 of file SampView.Cpp.

LPTSTR REGSTRUCT::lpszSubKey

Definition at line 151 of file SampView.Cpp.

LPTSTR REGSTRUCT::lpszValueName

Definition at line 152 of file SampView.Cpp.

The documentation for this struct was generated from the following files:
  • WinUI/Shell/SampView/SampView.Cpp
  • WinUI/Shell/ShellIconOverlay/IcnOvrly.Cpp
Generated on Wed Nov 13 2024 16:57:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: RENDERLib::Behavior Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • RENDERLib
  • RENDERLib::Behavior

RENDERLib::Behavior Class Reference

import "Render.idl";

Detailed Description

Definition at line 68 of file Render.idl.

The documentation for this class was generated from the following file:
  • Web/Browser/RenderBehave/renderproject/Render.idl
Generated on Wed Nov 13 2024 16:58:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: RENDERLib::EventSink Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • RENDERLib
  • RENDERLib::EventSink

RENDERLib::EventSink Class Reference

import "Render.idl";

Detailed Description

Definition at line 76 of file Render.idl.

The documentation for this class was generated from the following file:
  • Web/Browser/RenderBehave/renderproject/Render.idl
Generated on Wed Nov 13 2024 16:58:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: RENDERLib::Factory Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • RENDERLib
  • RENDERLib::Factory

RENDERLib::Factory Class Reference

import "Render.idl";

Detailed Description

Definition at line 60 of file Render.idl.

The documentation for this class was generated from the following file:
  • Web/Browser/RenderBehave/renderproject/Render.idl
Generated on Wed Nov 13 2024 16:58:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: REQUEST_CONTEXT Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

REQUEST_CONTEXT Struct Reference

List of all members.

Public Attributes

DWORD dwSize
DWORD dwThreadID
DWORD dwTotalSize
HINTERNET | hConnect
HINTERNET | hOpen
HINTERNET | hRequest
HINTERNET | hResource
HANDLE hThread
HWND | hWindow
LPSTR lpBuffer
int | nHeader
int | nResource
int | nURL
char | szMemo [512]
WCHAR | szMemo [256]

Detailed Description

Definition at line 43 of file AsyncDemo.cpp.

Member Data Documentation

DWORD REQUEST_CONTEXT::dwSize

Definition at line 21 of file AsyncDemo.cpp.

DWORD REQUEST_CONTEXT::dwThreadID

Definition at line 52 of file AsyncDemo.cpp.

DWORD REQUEST_CONTEXT::dwTotalSize

Definition at line 22 of file AsyncDemo.cpp.

HINTERNET REQUEST_CONTEXT::hConnect

Definition at line 16 of file AsyncDemo.cpp.

HINTERNET REQUEST_CONTEXT::hOpen

Definition at line 48 of file AsyncDemo.cpp.

HINTERNET REQUEST_CONTEXT::hRequest

Definition at line 17 of file AsyncDemo.cpp.

HINTERNET REQUEST_CONTEXT::hResource

Definition at line 49 of file AsyncDemo.cpp.

HANDLE REQUEST_CONTEXT::hThread

Definition at line 51 of file AsyncDemo.cpp.

HWND REQUEST_CONTEXT::hWindow

Definition at line 44 of file AsyncDemo.cpp.

LPSTR REQUEST_CONTEXT::lpBuffer

Definition at line 23 of file AsyncDemo.cpp.

int REQUEST_CONTEXT::nHeader

Definition at line 46 of file AsyncDemo.cpp.

int REQUEST_CONTEXT::nResource

Definition at line 47 of file AsyncDemo.cpp.

int REQUEST_CONTEXT::nURL

Definition at line 45 of file AsyncDemo.cpp.

WCHAR REQUEST_CONTEXT::szMemo

Definition at line 50 of file AsyncDemo.cpp.

WCHAR REQUEST_CONTEXT::szMemo[512]

Definition at line 24 of file AsyncDemo.cpp.

The documentation for this struct was generated from the following files:
  • Web/networking/asyncdemo/AsyncDemo.cpp
  • Web/winhttp/asyncdemocomplete/AsyncDemo.cpp
  • Web/winhttp/asyncdemotutorial/AsyncDemo.cpp
Generated on Wed Nov 13 2024 16:57:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: RESOURCEPOSINFO Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

RESOURCEPOSINFO Struct Reference

List of all members.

Public Attributes

DWORD dwBytes
DWORD dwOffset

Detailed Description

Definition at line 55 of file Icons.C.

Member Data Documentation

DWORD RESOURCEPOSINFO::dwBytes

Definition at line 57 of file Icons.C.

DWORD RESOURCEPOSINFO::dwOffset

Definition at line 58 of file Icons.C.

The documentation for this struct was generated from the following file:
  • WinUI/Resource/Iconpro/Icons.C
Generated on Wed Nov 13 2024 16:57:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: RESULTDATA Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

RESULTDATA Struct Reference

#include "bankdlg.h"

List of all members.

Public Attributes

DWORD dwThreadId
LPOLESTR sString

Detailed Description

Definition at line 104 of file bankdlg.h.

Member Data Documentation

DWORD RESULTDATA::dwThreadId

Definition at line 107 of file bankdlg.h.

LPOLESTR RESULTDATA::sString

Definition at line 106 of file bankdlg.h.

The documentation for this struct was generated from the following file:
  • Com/Services/Object_Pooling/OPBankSample/OPBank/bankdlg.h
Generated on Wed Nov 13 2024 16:57:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: RqsClient Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

RqsClient Class Reference

#include "rqsclient.h"

List of all members.

Public Member Functions

RqsClient ()
~RqsClient ()
VOID | AssignSocket (IN RuSocket *pSocket)
DWORD GetAddressH ()
DWORD GetAddressN ()
CONST CHAR * | GetAddressPsz ()
RqsClientState GetState ()
CHAR * | GetString ()
CONST CHAR * | GetUsername ()
HRESULT | ReceiveMessage ()
HRESULT | SendResponse (IN BOOL fOk)
VOID | SetEngine (IN RqsEngine *pEngine)

Private Attributes

DWORD m_dwAddressH
RqsEngine * m_pEngine
RuSocket * | m_pSocket
CHAR | m_pszAddress [32]
CHAR | m_pszBuffer [RQS_MESSAGE_SIZE]
CHAR * | m_pszString
CHAR * | m_pszUsername
RqsClientState m_State
UINT m_uiBytesRead
UINT m_uiMessageSize

Detailed Description

Definition at line 43 of file rqsclient.h.

Constructor & Destructor Documentation

RqsClient::RqsClient ( )

Definition at line 18 of file rqsclient.cpp.

                     : m_pSocket(NULL), m_uiBytesRead(0), m_uiMessageSize(0),
                        m_pszString(NULL), m_pszUsername(NULL), m_State(Receiving),
                        m_pEngine(NULL), m_dwAddressH(0)
{
    m_pszBuffer[0] = '\0';
    ZeroMemory(m_pszAddress, sizeof(m_pszAddress));
}

RqsClient::~RqsClient ( )

Definition at line 31 of file rqsclient.cpp.

{
    if (m_pSocket)
    {
        m_pSocket->Close();
        delete m_pSocket;
    }
}

Member Function Documentation

VOID RqsClient::AssignSocket ( IN RuSocket * pSocket )

Definition at line 46 of file rqsclient.cpp.

{
    HRESULT hr;
    DWORD dwAddress = 0;

    m_pSocket = pSocket;

    hr = pSocket->GetAddress(&dwAddress);
    if (S_OK != hr)
    {
        m_pEngine->Trace("Unable to obtain client address. 0x%x", hr);
        m_State = ClientError;
        dwAddress = 0;
    }

    m_dwAddressH = ntohl(dwAddress);

    _snprintf(
        m_pszAddress,
        sizeof(m_pszAddress) - 1,
        "%d.%d.%d.%d",
        IP1(m_dwAddressH),
        IP2(m_dwAddressH),
        IP3(m_dwAddressH),
        IP4(m_dwAddressH));

}

DWORD RqsClient::GetAddressH ( )

Definition at line 252 of file rqsclient.cpp.

{
    return m_dwAddressH;
}

DWORD RqsClient::GetAddressN ( )

Definition at line 241 of file rqsclient.cpp.

{
    return htonl(m_dwAddressH);
}

CONST CHAR * RqsClient::GetAddressPsz ( )

Definition at line 263 of file rqsclient.cpp.

{
    return m_pszAddress;
}

RqsClientState RqsClient::GetState ( ) [inline]

Definition at line 55 of file rqsclient.h.

{return m_State;}

CHAR* RqsClient::GetString ( ) [inline]

Definition at line 56 of file rqsclient.h.

{return m_pszString;}

CONST CHAR * RqsClient::GetUsername ( )

Definition at line 269 of file rqsclient.cpp.

{
    if (m_pszUsername)
    {
        return m_pszUsername;
    }
    else
    {
        return "Unknown";
    }
}

HRESULT RqsClient::ReceiveMessage ( )

Definition at line 81 of file rqsclient.cpp.

{
    HRESULT hr;
    UINT uiSize;
    CHAR* pszCur;
    INT iSize;

    // Sanity check that we haven't already read in too many bytes
    //
    if (m_uiBytesRead >= sizeof(m_pszBuffer))
    {
        m_pEngine->Trace(
            "Too many bytes read from client %s",
            GetAddressPsz());
        m_State = ClientError;
        return E_FAIL;
    }

    // Read in whatever data is readily available
    //
    uiSize = sizeof(m_pszBuffer) - m_uiBytesRead;
    pszCur = &(m_pszBuffer[m_uiBytesRead]);
    hr = m_pSocket->Read((BYTE*)pszCur, &uiSize, FALSE);
    if (hr == HRESULT_FROM_WIN32(WSAEWOULDBLOCK))
    {
        return S_OK;
    }
    else if (S_OK != hr)
    {
        m_pEngine->Trace(
            "ClientError 0x%x while receiving message from %s",
            hr,
            GetAddressPsz());
            m_State = ClientError;
        return hr;
    }
    if (uiSize == 0)
    {
        // The client has disconnected this socket.  This should not happen
        //
        m_pEngine->Trace(
            "Dropping client because socket was closed remotely %s",
            GetAddressPsz());
        m_State = ClientError;
        return E_FAIL;
    }

    // Update the total number of bytes read
    //
    m_uiBytesRead += uiSize;

    // The message is in the form "Size:1:username:String".
    //
    // If we have Size, then remember it
    //
    if ((m_uiBytesRead >= RQS_MESSAGE_LENGH_SIZE) && (m_uiMessageSize == 0))
    {
        m_pszBuffer[RQS_MESSAGE_LENGH_SIZE] = '\0';
        iSize = atoi(m_pszBuffer);

        // iSize is the size of the rest of the buffer. i.e. strlen(":1:username:String")
        // Make sure that there is at least 1 character in String and that String
        // is no longer than 1024 bytes.
        //
        // 4 = strlen(":1:S")
        // 1027 = strlen(":1:username:String") if username:String is 1024 characters long
        // Note that the username string is optional.
        //
        if ((iSize < 4) || (iSize > 1027))
        {
            m_pEngine->Trace(
                "Client %s sent an out-of-range size",
                GetAddressPsz());
            m_State = ClientError;
            return E_FAIL;
        }
        m_uiMessageSize = iSize;
    }

    // See if we're done reading yet
    //
    if (m_uiBytesRead >= (m_uiMessageSize + RQS_MESSAGE_LENGH_SIZE))
    {
        // First, remove the prefix
        //
        m_pszBuffer[RQS_MESSAGE_PREFIX_SIZE + m_uiMessageSize] = '\0';
        m_pszUsername = &(m_pszBuffer[RQS_MESSAGE_PREFIX_SIZE]);

        // Now check to see if there is a username
        //
        PCHAR pszColon = strchr(m_pszUsername, ':');
        if (pszColon)
        {
            m_pszString = pszColon + 1;
            *pszColon = '\0';

            // Make sure the username isn't longer than the username + domain + separator
            //
            if ((pszColon - m_pszUsername) > (UNLEN + DNLEN + 1))
            {
                m_pEngine->Trace(
                    "Client %s sent a larger than expected username",
                    GetAddressPsz());
                m_State = ClientError;
                return E_FAIL;
            }
        }
        else
        {
           m_pszString = m_pszUsername;
           m_pszUsername = NULL;
        }

        // Finally save off the remaining as the string
        //
        m_State = ReceiveComplete;
    }

    return S_OK;
}

HRESULT RqsClient::SendResponse ( IN BOOL fOk )

Definition at line 208 of file rqsclient.cpp.

{
    UINT uiTot, uiSize;
    HRESULT hr;

    m_State = Responding;

    uiTot = uiSize = 3;
    hr = m_pSocket->Write(
            (BYTE*) ((fOk) ? "Ok" : "No"),
            &uiSize);
    if ((S_OK != hr) || (uiTot != uiSize))
    {
        m_pEngine->Trace(
            "Unable to respond to %s %x %d %d",
            GetAddressPsz(),
            hr,
            uiTot,
            uiSize);
    }

    m_State = RespondComplete;

    return hr;
}

VOID RqsClient::SetEngine ( IN RqsEngine * pEngine ) [inline]

Definition at line 49 of file rqsclient.h.

{m_pEngine = pEngine;}

Member Data Documentation

DWORD RqsClient::m_dwAddressH [private]

Definition at line 73 of file rqsclient.h.

RqsEngine* RqsClient::m_pEngine [private]

Definition at line 65 of file rqsclient.h.

RuSocket* RqsClient::m_pSocket [private]

Definition at line 64 of file rqsclient.h.

CHAR RqsClient::m_pszAddress[32] [private]

Definition at line 67 of file rqsclient.h.

CHAR RqsClient::m_pszBuffer[RQS_MESSAGE_SIZE] [private]

Definition at line 66 of file rqsclient.h.

CHAR* RqsClient::m_pszString [private]

Definition at line 70 of file rqsclient.h.

CHAR* RqsClient::m_pszUsername [private]

Definition at line 71 of file rqsclient.h.

RqsClientState RqsClient::m_State [private]

Definition at line 72 of file rqsclient.h.

UINT RqsClient::m_uiBytesRead [private]

Definition at line 68 of file rqsclient.h.

UINT RqsClient::m_uiMessageSize [private]

Definition at line 69 of file rqsclient.h.

The documentation for this class was generated from the following files:
  • NetDS/RRas/rqs/server/rqsclient.h
  • NetDS/RRas/rqs/server/rqsclient.cpp
Generated on Wed Nov 13 2024 16:57:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: RqsConfig Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes

RqsConfig Class Reference

#include "rqsconfig.h"

List of all members.

Public Member Functions

RqsConfig ()
~RqsConfig ()
VOID | Clear ()
BOOL | Find (IN CHAR *pszString) const
BOOL | GetDebugTrace () const
CONST WCHAR * | GetLibrary () const
UINT | GetPort () const
BOOL | GetTraceEnabled () const
HRESULT | Load ()
HRESULT | LoadConfig ()
HRESULT | LoadTrace ()
VOID | TraceSelf (const RqsEngine &Engine)

Static Public Member Functions

static const PWSTR | GetConfigPath ()
static const PWSTR | GetTracePath ()

Private Member Functions

VOID | ClearStrings (IN RqsConfigString *pStrings, IN UINT uiCount)

Private Attributes

BOOL m_fDebuggerTrace
BOOL m_fTraceEnabled
RqsConfigString * m_pStrings
PWSTR m_pszLibrary
UINT m_uiCount
UINT m_uiPort

Detailed Description

Definition at line 22 of file rqsconfig.h.

Constructor & Destructor Documentation

RqsConfig::RqsConfig ( )

Definition at line 32 of file rqsconfig.cpp.

                     : m_pStrings(NULL), m_uiCount(0),
                        m_uiPort(g_uiPort), m_fTraceEnabled(FALSE),
                        m_fDebuggerTrace(FALSE), m_pszLibrary(NULL)
{
}

RqsConfig::~RqsConfig ( )

Definition at line 43 of file rqsconfig.cpp.

{
    Clear();
}

Member Function Documentation

VOID RqsConfig::Clear ( )

Definition at line 73 of file rqsconfig.cpp.

{

    if (m_pStrings)
    {
        ClearStrings(m_pStrings, m_uiCount);
    }

    m_pszLibrary = NULL;
    m_pStrings = NULL;
    m_uiCount = 0;
}

VOID RqsConfig::ClearStrings | ( | IN RqsConfigString * | pStrings,
 |  | IN UINT | uiCount |
 | ) |  |  | [private]

Definition at line 54 of file rqsconfig.cpp.

{
    UINT i;

    for (i = 0; i < uiCount; i++)
    {
        RuFree(pStrings[i].pszString);
    }
    delete [] pStrings;
}

BOOL RqsConfig::Find ( IN CHAR * pszString ) const

Definition at line 393 of file rqsconfig.cpp.

{
    INT iRet;

    for (UINT i = 0; i < m_uiCount; i++)
    {
        // Wild card strings have non-zero length.  If the length is 0,
        // it means we should do an exact string comparison.
        //
        if (m_pStrings[i].uiLength == 0)
        {
            iRet = strcmp(
                        m_pStrings[i].pszString,
                        pszString);
        }
        else
        {
            iRet = strncmp(
                    m_pStrings[i].pszString,
                    pszString,
                    m_pStrings[i].uiLength);
        }

        if (iRet == 0)
        {
            return TRUE;
        }
        else if (iRet == 1)
        {
            return FALSE;
        }
    }

    return FALSE;
}

const PWSTR RqsConfig::GetConfigPath ( ) [static]

Definition at line 436 of file rqsconfig.cpp.

{
    return L"HKLM\\System\\CurrentControlSet\\Services\\Rqs";
}

BOOL RqsConfig::GetDebugTrace ( ) const

Definition at line 103 of file rqsconfig.cpp.

{
    return m_fDebuggerTrace;
}

CONST WCHAR * RqsConfig::GetLibrary ( ) const

Definition at line 125 of file rqsconfig.cpp.

{
    if (m_pszLibrary)
    {
        return m_pszLibrary;
    }

    return L"mprapi.dll";
}

UINT RqsConfig::GetPort ( ) const

Definition at line 92 of file rqsconfig.cpp.

{
    return m_uiPort;
}

BOOL RqsConfig::GetTraceEnabled ( ) const

Definition at line 114 of file rqsconfig.cpp.

{
    return m_fTraceEnabled;
}

const PWSTR RqsConfig::GetTracePath ( ) [static]

Definition at line 448 of file rqsconfig.cpp.

{
    return L"HKLM\\Software\\Microsoft\\Tracing\\Rqs";
}

HRESULT RqsConfig::Load ( )

Definition at line 374 of file rqsconfig.cpp.

{
    HRESULT hr = S_OK;

    // Ignore the error return from LoadTrace -- it's safe to continue
    // without it.
    //
    LoadTrace();
    hr = LoadConfig();

    return hr;
}

HRESULT RqsConfig::LoadConfig ( )

Definition at line 210 of file rqsconfig.cpp.

{
    DWORD dwErr = NO_ERROR;
    HRESULT hr = S_OK;
    WCHAR* pszCur;
    UINT uiCount = 0, uiLen;
    CHAR* pszString;
    RqsConfigString* pStrings = NULL;
    RUREGVALUE ruVals[] =
    {
        {
            L"AllowedSet",
            REG_MULTI_SZ,
            0,
            NULL,
            0
        },
        {
            L"Port",
            REG_DWORD,
            0,
            NULL,
            0
        },
        {
            L"DebuggerTrace",
            REG_DWORD,
            0,
            NULL,
            0
        },
        {
            L"Authenticator",
            REG_SZ,
            0,
            NULL,
            0
        }
    };

    __try
    {
        // Read the multisz from the registry
        //
        dwErr = RuRegGet(
                   GetConfigPath(),
                   ruVals,
                   RU_ELEMENT_COUNT(ruVals));
        if (dwErr != NO_ERROR)
        {
           hr = HRESULT_FROM_WIN32(dwErr);
           __leave;
        }

        // Read in the [optional] allowed set.
        //
        if (S_OK == ruVals[0].hr)
        {
            // Count the number of wide-character strings
            //
            pszCur = (WCHAR*) ruVals[0].pbData;
            while (*pszCur)
            {
                uiCount++;
                pszCur += wcslen(pszCur) + 1;
            }
            if (uiCount)
            {
                // Allocate the array of ansi strings
                //
                pStrings = new RqsConfigString[uiCount];
                if (pStrings == NULL)
                {
                    hr = E_OUTOFMEMORY;
                    __leave;
                }
                ZeroMemory(pStrings, sizeof(pStrings) * uiCount);

                uiCount = 0;
                pszCur = (WCHAR*) ruVals[0].pbData;
                while (*pszCur)
                {
                    // Covert the unicode string to ansi
                    //
                    pszString = RuStringDupWtoA(pszCur);
                    if (pszString == NULL)
                    {
                        hr = E_OUTOFMEMORY;
                        __leave;
                    }

                    // If the string ends in '*', then we only want to compare
                    // the characters up to that wildcard symbol
                    //
                    uiLen = (UINT)strlen(pszString);
                    if (pszString[uiLen - 1] == '*')
                    {
                        pStrings[uiCount].uiLength = uiLen - 1;
                    }
                    else
                    {
                        pStrings[uiCount].uiLength = 0;
                    }

                    pStrings[uiCount].pszString = pszString;
                    pszCur += wcslen(pszCur) + 1;
                    uiCount++;
                }

                // Sort the set of allowed strings
                //
                qsort(
                    pStrings,
                    uiCount,
                    sizeof(RqsConfigString),
                    RqsCompare);

                ClearStrings(m_pStrings, m_uiCount);
                m_pStrings = pStrings;
                m_uiCount = uiCount;
            }
        }

        // Read in the [optional] port
        //
        if (S_OK == ruVals[1].hr)
        {
            m_uiPort = *((DWORD*)ruVals[1].pbData);
        }

        // Read in the [optional] debug trace flag
        //
        if (S_OK == ruVals[2].hr)
        {
            m_fDebuggerTrace = *((DWORD*)ruVals[2].pbData);
        }

        // Read in the [optional] authenticator
        //
        if (S_OK == ruVals[3].hr)
        {
            m_pszLibrary = (reinterpret_cast<CONST PWSTR>(ruVals[3].pbData));
        }

    }

    __finally
    {
        RuRegFreeValues(ruVals, RU_ELEMENT_COUNT(ruVals));
        if ((S_OK != hr) && (pStrings))
        {
            ClearStrings(pStrings, uiCount);
        }
    }

    return hr;
}

HRESULT RqsConfig::LoadTrace ( )

Definition at line 141 of file rqsconfig.cpp.

{
    HRESULT hr = S_OK;
    RUREGVALUE ruVals[] =
    {
        {
            L"EnableConsoleTracing",
            REG_DWORD,
            0,
            NULL,
            0
        },
        {
            L"EnableFileTracing",
            REG_DWORD,
            0,
            NULL,
            0
        }
    };

    __try
    {
        m_fTraceEnabled = FALSE;

        hr = RuRegGet(
                GetTracePath(),
                ruVals,
                RU_ELEMENT_COUNT(ruVals));
        if (hr != NO_ERROR)
        {
           hr = HRESULT_FROM_WIN32(hr);
           __leave;
        }

        // If either value is set, then set m_fTracing
        //
        if (S_OK == ruVals[0].hr)
        {
            if (*((DWORD*)ruVals[0].pbData))
            {
                m_fTraceEnabled = TRUE;
            }
        }

        if (S_OK == ruVals[1].hr)
        {
            if (*((DWORD*)ruVals[1].pbData))
            {
                m_fTraceEnabled = TRUE;
            }
        }

    }

    __finally
    {
        RuRegFreeValues(ruVals, RU_ELEMENT_COUNT(ruVals));
    }

    return hr;
}

VOID RqsConfig::TraceSelf ( const RqsEngine & Engine )

Member Data Documentation

BOOL RqsConfig::m_fDebuggerTrace [private]

Definition at line 51 of file rqsconfig.h.

BOOL RqsConfig::m_fTraceEnabled [private]

Definition at line 50 of file rqsconfig.h.

RqsConfigString* RqsConfig::m_pStrings [private]

Definition at line 47 of file rqsconfig.h.

PWSTR RqsConfig::m_pszLibrary [private]

Definition at line 52 of file rqsconfig.h.

UINT RqsConfig::m_uiCount [private]

Definition at line 48 of file rqsconfig.h.

UINT RqsConfig::m_uiPort [private]

Definition at line 49 of file rqsconfig.h.

The documentation for this class was generated from the following files:
  • NetDS/RRas/rqs/server/rqsconfig.h
  • NetDS/RRas/rqs/server/rqsconfig.cpp
Generated on Wed Nov 13 2024 16:57:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: RqsEngine Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes

RqsEngine Class Reference

#include "rqsengine.h"

List of all members.

Public Member Functions

RqsEngine ()
~RqsEngine ()
HRESULT | ClientAdd (IN RqsClient *pClient)
BOOL | ClientAuthenticate (IN CHAR *pszString)
HRESULT | ClientClearQuarantine (IN DWORD dwAddress, IN CONST CHAR *pszAddress, IN CONST CHAR *pszUsername)
VOID | ClientLogInfo (IN DWORD dwEvent, IN CONST CHAR *pszIp, IN CONST CHAR *pszUsername, IN CONST CHAR *pszString)
HRESULT | ClientReadMessages ()
VOID | ClientRemove ()
HRESULT | ConnectRRAS (IN OPTIONAL DWORD dwRetries=0)
HRESULT | Execute ()
DWORD GetCheckpoint ()
SERVICE_STATUS_HANDLE | GetServiceHandle ()
HRESULT | Initialize ()
VOID | SetConsoleTracing (IN BOOL fConsole)
VOID | SetServiceHandle (SERVICE_STATUS_HANDLE hService)
VOID | Stop ()
VOID | Trace (IN LPSTR pszTrace, IN...) const
VOID | TraceSelf ()

Private Member Functions

VOID | Clear ()
HRESULT | ClientConnect ()
HRESULT | DeregisterForConnectionNotification ()
WORD | GetEventType (DWORD dwEventId)
HRESULT | GetInternalIpAddress (OUT CHAR *pszIpAddress, IN DWORD dwCount)
DWORD | GetIpAddressFromInterfaceIndex (IN DWORD dwInterfaceId, OUT CHAR *pszIpAddress, IN DWORD dwCount)
DWORD | GetIpAddressFromInterfaceName (IN CONST WCHAR *pwszInterfaceName, OUT CHAR *pszIpAddress, IN DWORD dwCount)
HRESULT | InitializeEvents ()
HRESULT | InitializeServerSocket ()
HRESULT | RegisterForConnectionNotification ()
HRESULT | ReloadConfig ()
HRESULT | ReloadTrace ()
HRESULT | ScheduleWork (LPTHREAD_START_ROUTINE pFunc, RqsClient *pClient=NULL)
void | TraceCurrentServerConnections ()
HRESULT | Wait (OUT RqsEvent *pAction)

Static Private Member Functions

static DWORD WINAPI | ClientCompleteCb (IN LPVOID pvContext)
static DWORD WINAPI | ClientConnectCb (IN LPVOID pvContext)
static DWORD WINAPI | ClientReadCb (IN LPVOID pvContext)
static DWORD WINAPI | InitializeServerSocketCb (IN LPVOID pvContext)

Private Attributes

BOOL m_bRegisteredForConnectionNotification
RqsConfig m_Config
RcuCritSec | m_csClientsLock
DWORD m_dwCheckPoint
DWORD m_dwTraceId
RcuEvent | m_eConfig
RcuEvent | m_eInterfaceAdded
RcuEvent | m_eQuit
RcuEvent | m_eSocketAccept
RcuEvent | m_eSocketRead
RcuEvent | m_eTrace
BOOL m_fConsoleTrace
BOOL m_fDebugTrace
BOOL m_fRtTrace
HINSTANCE | m_hInstMprApi
HKEY m_hkConfig
HKEY m_hkTrace
HANDLE m_hLog
HANDLE m_hServer
SERVICE_STATUS_HANDLE | m_hService
ClientList m_lClients
RqsRemoveQuarantineFunc | m_qFunc
RcuRwLock | m_rwlConfig
RuServerSocket | m_sServer
CHAR | m_szInternalAddress [16]
volatile LONG | m_ulClientCount

Detailed Description

Definition at line 42 of file rqsengine.h.

Constructor & Destructor Documentation

RqsEngine::RqsEngine ( )

Definition at line 30 of file rqsengine.cpp.

                     : m_ulClientCount(0), m_hService(NULL), m_dwCheckPoint(0),
                         m_hServer(NULL), m_hInstMprApi(NULL),
                         m_fConsoleTrace(FALSE), m_dwTraceId(INVALID_TRACEID),
                         m_fDebugTrace(FALSE), m_fRtTrace(FALSE),
                         m_hkTrace(NULL), m_hkConfig(NULL), m_hLog(NULL),
                         m_Config(), m_sServer(), m_eSocketAccept(),
                         m_eSocketRead(), m_eQuit(), m_eTrace(),
                         m_rwlConfig(), m_csClientsLock(), m_bRegisteredForConnectionNotification(FALSE)
{
    m_szInternalAddress[0] = '\0';
}

RqsEngine::~RqsEngine ( )

Definition at line 47 of file rqsengine.cpp.

{
    Clear();

    if (m_bRegisteredForConnectionNotification)
    {
        DeregisterForConnectionNotification();
    }
    if (m_hkConfig)
    {
        RegCloseKey(m_hkConfig);
    }
    if (m_hkTrace)
    {
        RegCloseKey(m_hkTrace);
    }
    if (m_hServer)
    {
        MprAdminServerDisconnect(m_hServer);
    }
    if (m_hInstMprApi)
    {
        FreeLibrary(m_hInstMprApi);
    }
    if (m_dwTraceId != INVALID_TRACEID)
    {
        TraceDeregisterExA( m_dwTraceId, 0 );
    }
    if (m_hLog)
    {
        DeregisterEventSource(m_hLog);
    }

}

Member Function Documentation

VOID RqsEngine::Clear ( ) [private]

Definition at line 88 of file rqsengine.cpp.

{
    m_Config.Clear();
    m_sServer.Close();
    m_ulClientCount = 0;
}

HRESULT RqsEngine::ClientAdd ( IN RqsClient * pClient )

Definition at line 529 of file rqsengine.cpp.

{
    HRESULT hr;

    m_csClientsLock.Enter();
    hr = m_lClients.InsertBack(pClient);
    m_csClientsLock.Leave();

    if (hr == S_OK)
    {
        Trace("Added client %s", pClient->GetAddressPsz());
        InterlockedIncrement(&m_ulClientCount);
    }

    return hr;
}

BOOL RqsEngine::ClientAuthenticate ( IN CHAR * pszString )

Definition at line 936 of file rqsengine.cpp.

{
    HRESULT hr;
    BOOL fOk;

    hr = m_rwlConfig.Lock(READER);
    if (S_OK != hr)
    {
        Trace("Unable to lock configuration object.");
        return FALSE;
    }

    fOk = m_Config.Find(pszString);

    hr = m_rwlConfig.Unlock(READER);
    if (hr != S_OK)
    {
        Trace("Unable to unlock configuration object.");
        return FALSE;
    }

    return fOk;
}

HRESULT RqsEngine::ClientClearQuarantine | ( | IN DWORD | dwAddress,
 |  | IN CONST CHAR * | pszAddress,
 |  | IN CONST CHAR * | pszUsername
 | ) |  |
DWORD WINAPI RqsEngine::ClientCompleteCb ( IN LPVOID pvContext ) [static, private]

Definition at line 827 of file rqsengine.cpp.

{
    HRESULT hr;
    RqsEngineCbInfo* pInfo =
        reinterpret_cast<RqsEngineCbInfo*>(pvContext);

    if (NULL == pInfo)
    {
        return ERROR_INVALID_PARAMETER;
    }

    RqsEngine* pEngine = pInfo->pEngine;
    RqsClient* pClient = pInfo->pClient;
    BOOL fAccept;

    __try
    {
        // Make sure we're connected to the RRAS service
        //
        hr = pEngine->ConnectRRAS();
        if (S_OK != hr)
        {
            pEngine->Trace(
                "Can't connect to RRAS service 0x%x.  Dropping client %s (%s).",
                hr,
                pClient->GetAddressPsz(),
                pClient->GetUsername());
            __leave;
        }

        // Figure out whether to accept the client
        //
        fAccept = pEngine->ClientAuthenticate(pClient->GetString());

        pEngine->Trace(
            "[%s] %s (%s) %s",
            (fAccept) ? "Accept" : "Reject",
            pClient->GetAddressPsz(),
            pClient->GetUsername(),
            pClient->GetString()
            );

        // Try to remove the quarantine
        //
        if (fAccept)
        {
            hr = pEngine->ClientClearQuarantine(pClient->GetAddressN(),
                     pClient->GetAddressPsz(),
                     pClient->GetUsername());

            if (S_OK == hr)
            {
                pEngine->ClientLogInfo(
                    RQS_LOG_SUCCESS,
                    pClient->GetAddressPsz(),
                    pClient->GetUsername(),
                    pClient->GetString());
            }
            else if (HRESULT_FROM_WIN32(ERROR_NOT_FOUND) == hr)
            {
                pEngine->ClientLogInfo(
                    RQS_LOG_SUCCESS_BUT_NO_QUARANTINE,
                    pClient->GetAddressPsz(),
                    pClient->GetUsername(),
                    pClient->GetString());
                hr = S_OK;
            }
            else
            {
                pEngine->ClientLogInfo(
                    RQS_LOG_SUCCESS_BUT_PROBLEM_ENCOUNTERED,
                    pClient->GetAddressPsz(),
                    pClient->GetUsername(),
                    pClient->GetString());
                pEngine->Trace("Unable to remove client quarantine. 0x%x", hr);
                fAccept = FALSE;
            }
        }
        else
        {
            pEngine->ClientLogInfo(
                RQS_LOG_REJECT,
                pClient->GetAddressPsz(),
                pClient->GetUsername(),
                pClient->GetString());
        }

        hr = pClient->SendResponse(fAccept);
        RU_LEAVE_IF_NOT_OK(hr);

    }

    __finally
    {
        delete pInfo;
        delete pClient;
        pEngine->ClientRemove();
    }

    return HRESULT_CODE(hr);
}

HRESULT RqsEngine::ClientConnect ( ) [private]

Definition at line 563 of file rqsengine.cpp.

{
    RuSocket* pSocket = NULL;
    RqsClient* pClient = NULL;
    HRESULT hr = S_FALSE;

    __try
    {
        // Create a new client socket
        //
        pSocket = new RuSocket();
        if (NULL == pSocket)
        {
            hr = E_OUTOFMEMORY;
            __leave;
        }

        // Create the new client control block
        //
        pClient = new RqsClient();
        if (pClient == NULL)
        {
            hr = E_OUTOFMEMORY;
            __leave;
        }

        // Accept the next client socket
        //
        hr = m_sServer.Listen(pSocket);
        RU_LEAVE_IF_NOT_OK(hr);

        // Assign the open client socket to the new client control block
        //
        pClient->SetEngine(this);
        pClient->AssignSocket(pSocket);

        // Add this client to the engine
        //
        hr = ClientAdd(pClient);
        RU_LEAVE_IF_NOT_OK(hr);

        // Cause the read event to signal when data is ready for this client
        //
        hr = pSocket->SetEvent(m_eSocketRead.GetHandle(), FD_READ);
        if (S_OK != hr)
        {
            Trace(
                "Unable to set read event for socket %s, hr = %d",
                pClient->GetAddressPsz(),
                hr);
            hr = S_OK;
            __leave;
        }

    }

    __finally
    {
        if (hr != S_OK)
        {
            if (pSocket)
            {
                delete pSocket;
            }
            if (pClient)
            {
                delete pClient;
            }
        }
    }

    return hr;
}

DWORD WINAPI RqsEngine::ClientConnectCb ( IN LPVOID pvContext ) [static, private]

Definition at line 752 of file rqsengine.cpp.

{
    HRESULT hr;

    RqsEngineCbInfo* pInfo =
        reinterpret_cast<RqsEngineCbInfo*>(pvContext);

    RqsEngine* pEngine = pInfo->pEngine;

    hr = pEngine->ClientConnect();

    if (S_OK != hr)
    {
        pEngine->Trace("Error returned from ClientConnect %x", hr);
    }

    delete pInfo;

    return HRESULT_CODE(hr);
}

VOID RqsEngine::ClientLogInfo | ( | IN DWORD | dwEvent,
 |  | IN CONST CHAR * | pszIp,
 |  | IN CONST CHAR * | pszUsername,
 |  | IN CONST CHAR * | pszString
 | ) |  |

Definition at line 1251 of file rqsengine.cpp.

{
    WCHAR *pszAddressW = NULL, *pszStringW = NULL, *pszUsernameW = NULL, *pszArgs[3];
    BOOL fOk;

    pszAddressW = RuStringDupAtoW(const_cast<PSTR>(pszIp));
    pszStringW = RuStringDupAtoW(const_cast<PSTR>(pszString));
    pszUsernameW = RuStringDupAtoW(const_cast<PSTR>(pszUsername));

    pszArgs[0] = (pszAddressW) ? pszAddressW : L"";
    pszArgs[1] = (pszUsernameW) ? pszUsernameW : L"";
    pszArgs[2] = (pszStringW) ? pszStringW : L"";

    fOk = ReportEvent(
                m_hLog,
                GetEventType(dwEventId),
                0,
                dwEventId,
                NULL,
                3,
                0,
                (LPCWSTR *)pszArgs,
                NULL);
    if (! fOk)
    {
        Trace("ReportEvent error %x", GetLastError());
    }

    if (pszStringW)
    {
        RuFree( pszStringW );
    }

    if (pszAddressW)
    {
        RuFree( pszAddressW );
    }

    if (pszUsernameW)
    {
        RuFree( pszUsernameW );
    }

}

DWORD WINAPI RqsEngine::ClientReadCb ( IN LPVOID pvContext ) [static, private]

Definition at line 724 of file rqsengine.cpp.

{
    HRESULT hr;

    RqsEngineCbInfo* pInfo =
        reinterpret_cast<RqsEngineCbInfo*>(pvContext);

    RqsEngine* pEngine = pInfo->pEngine;

    hr = pEngine->ClientReadMessages();

    if (S_OK != hr)
    {
        pEngine->Trace("Error received from ClientReadMessages %x", hr);
    }

    delete pInfo;

    return HRESULT_CODE(hr);
}

HRESULT RqsEngine::ClientReadMessages ( )

Definition at line 644 of file rqsengine.cpp.

{
    HRESULT hr = S_OK;
    ClientList::Iterator Iter;
    RqsClient* pClient;
    RqsClientState cState;

    m_csClientsLock.Enter();

    for (m_lClients.GetIterator(Iter); !Iter.AtEnd(); )
    {
        pClient = Iter.GetItem();
        pClient->ReceiveMessage();
        cState = pClient->GetState();

        if ((cState == ClientError) || (cState == ReceiveComplete))
        {
            Trace(
                "Client receive %s %s (%s)",
                ((cState == ReceiveComplete) ? "completed successfully for" : "failed for"),
                pClient->GetAddressPsz(),
                pClient->GetUsername());

            // Remove the client from the list
            //
            Iter.Next();
            hr = m_lClients.RemoveItem(pClient);
            if (hr != S_OK)
            {
                Trace("Unable to remove client from list %x", hr);
                break;
            }

            // If this client is ready to complete, schedule it to happen
            //
            if (cState == ReceiveComplete)
            {
                // Note the client complete callback will free
                // pClient and call ClientRemove when it is finished.
                //
                hr = ScheduleWork(ClientCompleteCb, pClient);
                if (S_OK != hr)
                {
                    Trace(
                        "Unable to complete client 0x%x, %s (%s)",
                        hr,
                        pClient->GetAddressPsz(),
                        pClient->GetUsername());
                    delete pClient;
                    ClientRemove();
                }
            }
            else // ClientError state
            {
                delete pClient;
                ClientRemove();
            }

            // The iterator has already been incremented at this point
            //
        }
        else
        {
            Iter.Next(); // client isn't done receiving, skip it
        }

    }

    m_csClientsLock.Leave();

    return hr;
}

VOID RqsEngine::ClientRemove ( )

Definition at line 552 of file rqsengine.cpp.

{
    InterlockedDecrement(&m_ulClientCount);
}

HRESULT RqsEngine::ConnectRRAS ( IN OPTIONAL DWORD dwRetries = 0 )

Definition at line 293 of file rqsengine.cpp.

{
    DWORD dwRet;
    BOOL bWrittenWaitingMessage = FALSE;

    if (m_hServer)
    {
        return S_OK;
    }

    do
    {
        // Connect to the remote access server
        //
        dwRet = MprAdminServerConnect(NULL, &m_hServer);

        if (dwRet == ERROR_SUCCESS)
        {
            Trace("Connected to RRAS.");
            break;
        }
        else if (((dwRet == RPC_S_UNKNOWN_IF) || (dwRet == RPC_S_SERVER_UNAVAILABLE)) && (dwRetries > 0))
        {
            //  We weren't able to connect to RRAS because it isn't fully initialized yet, so lets
            //  sleep for a second and try again
            //
            if (!bWrittenWaitingMessage)
            {
                Trace("Unable to connect to RRAS.  RRAS has not finished initializing yet, waiting...");
                bWrittenWaitingMessage = TRUE;
            }
            Sleep(1000);
            dwRetries--;
        }
        else
        {
            //
            //  Unexpected error.
            //
            m_hServer = NULL;
            break;
        }

    } while(dwRetries > 0);

    return HRESULT_FROM_WIN32(dwRet);
}

HRESULT RqsEngine::DeregisterForConnectionNotification ( ) [private]

Definition at line 1658 of file rqsengine.cpp.

{
    DWORD dwRet;

    __try
    {
        HANDLE hEvent = m_eInterfaceAdded.GetHandle();

        if (NULL == hEvent)
        {
            // m_eInterfaceAdded isn't initialized yet.
            //
            dwRet = ERROR_INVALID_HANDLE;
            __leave;
        }

        HRESULT hr = ConnectRRAS();
        if (FAILED(hr))
        {
            dwRet = HRESULT_CODE(hr);
            __leave;
        }

        dwRet = MprAdminDeregisterConnectionNotification(m_hServer, hEvent);

        if (ERROR_SUCCESS == dwRet)
        {
            m_bRegisteredForConnectionNotification = FALSE;
        }
    }

    __finally
    {
    }

    return HRESULT_FROM_WIN32(dwRet);
}

HRESULT RqsEngine::Execute ( )

Definition at line 348 of file rqsengine.cpp.

{
    HRESULT hr = S_FALSE;
    RqsEvent Action;
    BOOL fDone = FALSE;

    while (!fDone)
    {
        // Wait for something to happen
        //
        hr = Wait(&Action);
        RU_BREAK_IF_NOT_OK(hr);

        // Do your thing
        //
        switch (Action)
        {
            case Connect:
                hr = ScheduleWork(ClientConnectCb);
                break;

            case Read:
                hr = ScheduleWork(ClientReadCb);
                break;

            case UpdateConfig:
                hr = ReloadConfig();
                break;

            case UpdateTrace:
                hr = ReloadTrace();
                break;

            case ConfigServerSocket:
                DeregisterForConnectionNotification();
                hr = InitializeServerSocket();

                if (SUCCEEDED(hr))
                {
                    TraceSelf();
                }
                else
                {
                    fDone = TRUE;
                }
                break;

            case Quit:
                fDone = TRUE;
                break;
        }

        if (S_OK != hr)
        {
            Trace("Execution error %d 0x%x", Action, hr);
            hr = S_OK;
        }

    }

    // Wait for the pending clients to complete
    //
    while (m_ulClientCount)
    {
        Trace("Waiting for %d pending clients...", m_ulClientCount);
        Sleep(0);
    }

    return hr;

}

DWORD RqsEngine::GetCheckpoint ( ) [inline]

Definition at line 69 of file rqsengine.h.

{return m_dwCheckPoint;}

WORD RqsEngine::GetEventType ( DWORD dwEventId ) [private]

Definition at line 1219 of file rqsengine.cpp.

{
    WORD wEventType;

    DWORD dwSeverity = (dwEventId >> 30) & 0x3;

    switch(dwSeverity)
    {
        case 0:
            wEventType = EVENTLOG_SUCCESS;
            break;
        case 1:
            wEventType = EVENTLOG_INFORMATION_TYPE;
            break;
        case 2:
            wEventType = EVENTLOG_WARNING_TYPE;
            break;
        case 3:
        default:
            wEventType = EVENTLOG_ERROR_TYPE;
            break;
    }

    return wEventType;
}

HRESULT RqsEngine::GetInternalIpAddress | ( | OUT CHAR * | pszIpAddress,
 |  | IN DWORD | dwCount |
 | ) |  |  | [private]

Definition at line 1482 of file rqsengine.cpp.

 {
    // Check inputs
    //
    if ((NULL == pszIpAddress) || (0 == dwCount))
    {
        return E_INVALIDARG;
    }

    DWORD dwRet;
    HANDLE hMprConfig = NULL;
    MPR_INTERFACE_0* pMprInterface = NULL;
    DWORD dwNumEntries = 0;
    DWORD dwTotalEntries = 0;

    //  First call MprConfigServerConnect so we can get a config handle
    //
    __try
    {
        dwRet = MprConfigServerConnect(NULL, &hMprConfig);

        if (NO_ERROR != dwRet)
        {
            __leave;
        }

        //  Get the interfaces that RRAS knows about.
        //
        dwRet = MprConfigInterfaceEnum(hMprConfig, 0, (LPBYTE*)&pMprInterface, -1, &dwNumEntries, &dwTotalEntries, NULL);

        if ((NO_ERROR != dwRet) || (dwNumEntries != dwTotalEntries))
        {
            __leave;
        }

        //  Find the internal interface
        //
        dwRet = ERROR_NOT_FOUND;
        for (DWORD dwIndex = 0; dwIndex < dwNumEntries; dwIndex++)
        {
            if (ROUTER_IF_TYPE_INTERNAL == pMprInterface[dwIndex].dwIfType)
            {
                //  Now all we need to do is find the IP address of the internal interface.
                //
                dwRet = GetIpAddressFromInterfaceName (pMprInterface[dwIndex].wszInterfaceName, pszIpAddress, dwCount);

                if (ERROR_SUCCESS == dwRet)
                {
                    Trace("Internal interface found, %s", pszIpAddress);
                }
                __leave;
            }
        }
    }

    __finally
    {
        if (pMprInterface)
        {
            MprConfigBufferFree(pMprInterface);
        }

        if (hMprConfig)
        {
            MprConfigServerDisconnect(hMprConfig);
        }
    }

    return HRESULT_FROM_WIN32(dwRet);
}

DWORD RqsEngine::GetIpAddressFromInterfaceIndex | ( | IN DWORD | dwInterfaceId,
 |  | OUT CHAR * | pszIpAddress,
 |  | IN DWORD | dwCount |
 | ) |  |  | [private]

Definition at line 1306 of file rqsengine.cpp.

{
    if ((NULL == pszIpAddress) || (0 == dwCount))
    {
        return ERROR_INVALID_PARAMETER;
    }

    PMIB_IPADDRTABLE pIpAddrTable = NULL;
    DWORD dwSize = 0;
    DWORD dwRet;

    __try
    {
        // Figure out how much memory we need
        //
        dwRet = GetIpAddrTable (NULL, &dwSize, TRUE);

        if (ERROR_INSUFFICIENT_BUFFER != dwRet)
        {
            __leave;
        }

        pIpAddrTable = (PMIB_IPADDRTABLE)RuAlloc(dwSize, TRUE);

        if (!pIpAddrTable)
        {
            dwRet = ERROR_NOT_ENOUGH_MEMORY;
            __leave;
        }

        // Actually get the IP address table.
        //
        dwRet = GetIpAddrTable (pIpAddrTable, &dwSize, TRUE);

        if (ERROR_SUCCESS != dwRet)
        {
            __leave;
        }

        //  Init the Ip Address string to the empty string
        //
        pszIpAddress[0] = '\0';

        // Find the required index.
        //
        for (DWORD dwLoopIndex = 0; dwLoopIndex < pIpAddrTable->dwNumEntries; dwLoopIndex++)
        {
            if (pIpAddrTable->table[dwLoopIndex].dwIndex == dwInterfaceId)
            {
                //  Print the IP address into the string
                //
                DWORD dwAddr = pIpAddrTable->table[dwLoopIndex].dwAddr;
                _snprintf(pszIpAddress, dwCount, "%d.%d.%d.%d", IP4(dwAddr), IP3(dwAddr), IP2(dwAddr), IP1(dwAddr));

                //
                //  Ensure NULL termination
                //
                pszIpAddress[dwCount - 1] = '\0';

                break;
            }
        }

        // Make sure we found something.
        //
        if (pszIpAddress[0] == '\0')
        {
            dwRet = ERROR_NOT_FOUND;
        }
    }

    __finally
    {
        if (pIpAddrTable)
        {
            RuFree(pIpAddrTable);
        }
    }

    return dwRet;
}

DWORD RqsEngine::GetIpAddressFromInterfaceName | ( | IN CONST WCHAR * | pwszInterfaceName,
 |  | OUT CHAR * | pszIpAddress,
 |  | IN DWORD | dwCount |
 | ) |  |  | [private]

Definition at line 1398 of file rqsengine.cpp.

{
    if ((NULL == pwszInterfaceName) || (NULL == pszIpAddress) || (0 == dwCount))
    {
        return ERROR_INVALID_PARAMETER;
    }

    //  First we need to call GetIfTable to get the list of interfaces to match
    //  against the one passed in.  Once we have found our interface in the
    //  interface table, then we will have the associated interface index that we
    //  can use with the the IP address table to get the associated IP address for our interface.
    //
    DWORD dwRet;
    DWORD dwSize = 0;
    PMIB_IFTABLE pInterfaceTable = NULL;
    PMIB_IFROW pInterface = NULL;

    __try
    {
        // Figure out how much memory we need.
        //
        dwRet = GetIfTable(NULL, &dwSize, TRUE);

        if (ERROR_INSUFFICIENT_BUFFER != dwRet)
        {
            __leave;
        }

        pInterfaceTable = (PMIB_IFTABLE)RuAlloc(dwSize, TRUE);

        if (!pInterfaceTable)
        {
            dwRet = ERROR_NOT_ENOUGH_MEMORY;
            __leave;
        }

        // Actually get the interface table.
        //
        dwRet = GetIfTable(pInterfaceTable, &dwSize, TRUE);

        if (ERROR_SUCCESS != dwRet)
        {
            __leave;
        }

        // Find the interface index.  If we cannot find the requested
        // interface name, return ERROR_NO_SUCH_INTERFACE.  This is a
        // signal to the caller that RRAS may not have created the
        // reqested interface yet.
        //
        dwRet = ERROR_NO_SUCH_INTERFACE;
        for (DWORD dwIndex = 0; dwIndex < pInterfaceTable->dwNumEntries; dwIndex++)
        {
            pInterface = &(pInterfaceTable->table[dwIndex]);
            if (0 == lstrcmpiW(pInterface->wszName, pwszInterfaceName))
            {
                // Use the interface index to get the IP address
                //
                dwRet = GetIpAddressFromInterfaceIndex (pInterface->dwIndex, pszIpAddress, dwCount);
                break;
            }
        }
    }

    __finally
    {
        if (pInterfaceTable)
        {
            RuFree(pInterfaceTable);
        }
    }

    return dwRet;
}

SERVICE_STATUS_HANDLE RqsEngine::GetServiceHandle ( ) [inline]

Definition at line 68 of file rqsengine.h.

{return m_hService;}

HRESULT RqsEngine::Initialize ( void )

Definition at line 173 of file rqsengine.cpp.

{
    HRESULT hr = S_OK;

    __try
    {
        // Register event log handle.
        //
        m_hLog = RegisterEventSource(NULL, L"Rqs");
        if (m_hLog == NULL)
        {
            hr = HRESULT_FROM_WIN32( GetLastError() );
            __leave;
        }

        // Initialize all of the members of the class
        //
        hr = m_eSocketAccept.Initialize(NONSIGNALED, FALSE);
        RU_LEAVE_IF_NOT_OK(hr);
        m_dwCheckPoint++;

        hr = m_eSocketRead.Initialize(NONSIGNALED, FALSE);
        RU_LEAVE_IF_NOT_OK(hr);
        m_dwCheckPoint++;

        hr = m_rwlConfig.Initialize();
        RU_LEAVE_IF_NOT_OK(hr);
        m_dwCheckPoint++;

        hr = m_Config.Load();
        RU_LEAVE_IF_NOT_OK(hr);
        m_dwCheckPoint++;
        m_fRtTrace = m_Config.GetTraceEnabled();
        m_fDebugTrace = m_Config.GetDebugTrace();

        hr = m_csClientsLock.Initialize();
        RU_LEAVE_IF_NOT_OK(hr);

        // Establish tracing ability if possible
        //
        m_dwTraceId = TraceRegisterExA( "Rqs", 0 );

        // Load the quarantine removal function
        //
        m_hInstMprApi = LoadLibrary(m_Config.GetLibrary());
        if (m_hInstMprApi)
        {
            m_qFunc = (RqsRemoveQuarantineFunc)
                GetProcAddress(
                    m_hInstMprApi,
                    "MprAdminConnectionRemoveQuarantine");
        }

        // Get references to the registry keys
        //
        hr = RuRegOpenKey(RqsConfig::GetConfigPath(), FALSE, &m_hkConfig);
        if (S_OK != hr)
        {
            Trace("Warning, unable to listen for configuration changes %x", hr);
        }

        hr = RuRegOpenKey(RqsConfig::GetTracePath(), FALSE, &m_hkTrace);
        if (S_OK != hr)
        {
            Trace("Warning, unable to listen for trace changes %x", hr);
        }

        hr = InitializeEvents();
        RU_LEAVE_IF_NOT_OK(hr);

        hr = ConnectRRAS();
        if (SUCCEEDED(hr))
        {
            //  Init the Server socket to listen for incoming requests.
            //
            hr = InitializeServerSocket();

            if (ERROR_NO_SUCH_INTERFACE == HRESULT_CODE(hr))
            {
                hr = RegisterForConnectionNotification();
                RU_LEAVE_IF_NOT_OK(hr);

                hr = S_OK;
                Trace("Internal interface not found.");
                Trace("Waiting for first connection so that RRAS will create the internal interface.");
            }

            RU_LEAVE_IF_NOT_OK(hr);
            m_dwCheckPoint++;

        }
        else if ((HRESULT_CODE(hr) == RPC_S_UNKNOWN_IF) || (HRESULT_CODE(hr) == RPC_S_SERVER_UNAVAILABLE))
        {
            // RRAS isn't available yet.  Schedule a workitem to wait for RRAS and then init the
            // server socket.
            //
            hr = ScheduleWork(InitializeServerSocketCb);
        }
        RU_LEAVE_IF_NOT_OK(hr);
    }

    __finally
    {
        if (S_OK != hr)
        {
            Clear();
        }
    }

    TraceSelf();

    return hr;
}

HRESULT RqsEngine::InitializeEvents ( ) [private]

Definition at line 101 of file rqsengine.cpp.

{
    HRESULT hr = S_OK;

    __try
    {
        hr = m_eQuit.Initialize(NONSIGNALED, FALSE);
        RU_LEAVE_IF_NOT_OK(hr);
        m_dwCheckPoint++;

        hr = m_eConfig.Initialize(NONSIGNALED, FALSE);
        RU_LEAVE_IF_NOT_OK(hr);
        m_dwCheckPoint++;

        hr = m_eTrace.Initialize(NONSIGNALED, FALSE);
        RU_LEAVE_IF_NOT_OK(hr);
        m_dwCheckPoint++;

        hr = m_eInterfaceAdded.Initialize(NONSIGNALED, FALSE);
        RU_LEAVE_IF_NOT_OK(hr);
        m_dwCheckPoint++;

        // Cause the registry functions to signal us when change occurs
        //
        if (m_hkConfig)
        {
            hr = RegNotifyChangeKeyValue(
                    m_hkConfig,
                    FALSE,
                    REG_NOTIFY_CHANGE_LAST_SET,
                    m_eConfig.GetHandle(),
                    TRUE);
            if (hr != ERROR_SUCCESS)
            {
                Trace("Warning: unable to set up config event %x", hr);
                hr = S_OK;
            }
        }
        m_dwCheckPoint++;

        if (m_hkTrace)
        {
            hr = RegNotifyChangeKeyValue(
                    m_hkTrace,
                    FALSE,
                    REG_NOTIFY_CHANGE_LAST_SET,
                    m_eTrace.GetHandle(),
                    TRUE);
            if (hr != ERROR_SUCCESS)
            {
                Trace("Warning: unable to set up trace event %x", hr);
                hr = S_OK;
            }
        }
        m_dwCheckPoint++;

    }

    __finally
    {
    }

    return hr;
}

HRESULT RqsEngine::InitializeServerSocket ( ) [private]

Definition at line 1561 of file rqsengine.cpp.

{
    HRESULT hr;

    // Attempt to connect to the RRAS service.  We need to connect to
    // the RRAS service so we can figure out the correct interface to
    // listen on ... ie. the internal interface.
    //
    __try
    {
        hr = ConnectRRAS();
        RU_LEAVE_IF_NOT_OK(hr);

        hr = GetInternalIpAddress(m_szInternalAddress, sizeof(m_szInternalAddress));
        RU_LEAVE_IF_NOT_OK(hr);

        hr = m_sServer.Create(m_Config.GetPort(), m_szInternalAddress);

        if (HRESULT_CODE(hr) == WSAEADDRINUSE)
        {
            Trace("\n\tUnable to acquire port %d.  Make sure that RQS is not already", m_Config.GetPort());
            Trace("\trunning or that another application is not already using this port.\n");
        }
        else if (SUCCEEDED(hr))
        {
            HANDLE hEvent = m_eSocketAccept.GetHandle();

            if (NULL == hEvent)
            {
                __leave;
            }

            // Signal whenever a new connection arrives
            //
            hr = m_sServer.SetEvent(hEvent);
            RU_LEAVE_IF_NOT_OK(hr);
        }
    }

    __finally
    {
    }

    return hr;
}

DWORD WINAPI RqsEngine::InitializeServerSocketCb ( IN LPVOID pvContext ) [static, private]

Definition at line 779 of file rqsengine.cpp.

{
    HRESULT hr;

    RqsEngineCbInfo* pInfo =
        reinterpret_cast<RqsEngineCbInfo*>(pvContext);

    if (NULL == pInfo)
    {
        return ERROR_INVALID_PARAMETER;
    }

    RqsEngine* pEngine = pInfo->pEngine;

    //
    //  Try to connect to RRAS for up to 5 minutes
    //
    hr = pEngine->ConnectRRAS(300);

    if (SUCCEEDED(hr))
    {
        hr = pEngine->InitializeServerSocket();
        if (ERROR_NO_SUCH_INTERFACE == HRESULT_CODE(hr))
        {
            hr = pEngine->RegisterForConnectionNotification();
            pEngine->Trace("Internal interface not found.");
            pEngine->Trace("Waiting for first connection so that RRAS will create the internal interface.");
        }
    }

    delete pInfo;

    if (S_OK != hr)
    {
        pEngine->Trace("InitializeServerSocketCb, error 0x%x, exiting.", hr);
        pEngine->Stop();
    }

    return HRESULT_CODE(hr);
}

HRESULT RqsEngine::RegisterForConnectionNotification ( ) [private]

Definition at line 1614 of file rqsengine.cpp.

{
    DWORD dwRet;

    __try
    {
        HANDLE hEvent = m_eInterfaceAdded.GetHandle();

        if (NULL == hEvent)
        {
            // m_eInterfaceAdded isn't initialized yet.
            //
            dwRet = ERROR_INVALID_HANDLE;
            __leave;
        }

        HRESULT hr = ConnectRRAS();
        if (FAILED(hr))
        {
            dwRet = HRESULT_CODE(hr);
            __leave;
        }

        dwRet = MprAdminRegisterConnectionNotification(m_hServer, hEvent);

        if (ERROR_SUCCESS == dwRet)
        {
            m_bRegisteredForConnectionNotification = TRUE;
        }
    }

    __finally
    {
    }

    return HRESULT_FROM_WIN32(dwRet);
}

HRESULT RqsEngine::ReloadConfig ( ) [private]

Definition at line 1071 of file rqsengine.cpp.

{
    HRESULT hr, hr2;

    hr = m_rwlConfig.Lock(WRITER);
    if (S_OK != hr)
    {
        Trace("Unable to lock configuration object.");
        return hr;
    }

    __try
    {
        m_Config.Clear();
        hr = m_Config.LoadConfig();
        if (S_OK != hr)
        {
            Trace("Unable to reload configuration object.");
        }

        hr2 = m_rwlConfig.Unlock(WRITER);
        if (hr2 != S_OK)
        {
            Trace("Unable to unlock configuration object.");
        }
        RU_LEAVE_IF_NOT_OK(hr);

        // Assign the new configuration values.  Note that the accepted
        // value set has been updated at this point.
        //
        m_fDebugTrace = m_Config.GetDebugTrace();
        TraceSelf();

        // Re-register the configuration event
        //
        hr = RegNotifyChangeKeyValue(
                m_hkConfig,
                FALSE,
                REG_NOTIFY_CHANGE_LAST_SET,
                m_eConfig.GetHandle(),
                TRUE);
        if (hr != ERROR_SUCCESS)
        {
            Trace("Warning: unable to re-setup config event %x", hr);
            hr = S_OK;
        }

    }

    __finally
    {
    }

    return hr;
}

HRESULT RqsEngine::ReloadTrace ( ) [private]

Definition at line 1011 of file rqsengine.cpp.

{
    HRESULT hr, hr2;

    hr = m_rwlConfig.Lock(WRITER);
    if (S_OK != hr)
    {
        Trace("Unable to lock configuration object.");
        return hr;
    }

    __try
    {
        hr = m_Config.LoadTrace();
        if (S_OK != hr)
        {
            Trace("Unable to reload configuration trace.");
        }

        hr2 = m_rwlConfig.Unlock(WRITER);
        if (hr2 != S_OK)
        {
            Trace("Unable to unlock configuration object.");
        }
        RU_LEAVE_IF_NOT_OK(hr);

        // Assign the new trace values.
        //
        m_fRtTrace = m_Config.GetTraceEnabled();
        TraceSelf();

        // Re-register the configuration event
        //
        hr = RegNotifyChangeKeyValue(
                m_hkTrace,
                FALSE,
                REG_NOTIFY_CHANGE_LAST_SET,
                m_eTrace.GetHandle(),
                TRUE);
        if (hr != ERROR_SUCCESS)
        {
            Trace("Warning: unable to re-setup trace event %x", hr);
            hr = S_OK;
        }

    }

    __finally
    {
    }

    return hr;
}

HRESULT RqsEngine::ScheduleWork | ( | LPTHREAD_START_ROUTINE | pFunc,
 |  | RqsClient * | pClient = NULL |
 | ) |  |  | [private]
VOID RqsEngine::SetConsoleTracing ( IN BOOL fConsole ) [inline]

Definition at line 76 of file rqsengine.h.

{m_fConsoleTrace = fConsole;};

VOID RqsEngine::SetServiceHandle ( SERVICE_STATUS_HANDLE hService ) [inline]

Definition at line 67 of file rqsengine.h.

{m_hService = hService;}

VOID RqsEngine::Stop ( ) [inline]

Definition at line 54 of file rqsengine.h.

{m_eQuit.Set();}

VOID RqsEngine::Trace | ( | IN LPSTR | pszTrace,
 |  | IN... |  |
 | ) |  |  | const

Definition at line 1133 of file rqsengine.cpp.

{
    va_list arglist;
    CHAR szTemp[2048];
    HANDLE hFileOut;
    INT iCount;
    DWORD dwTemp;

    szTemp[0] = 0;

    if ((!m_fConsoleTrace) && (!m_fDebugTrace) && (!m_fRtTrace))
    {
        return;
    }

    va_start(arglist, pszTrace);
    iCount = _vsnprintf(szTemp, sizeof(szTemp)/sizeof(szTemp[0]) - 1, pszTrace, arglist);
    va_end(arglist);

    szTemp[sizeof(szTemp)/sizeof(szTemp[0]) - 1] = 0; // make sure to NULL terminate as _vsnprintf doesn't guarantee that

    // If we're running in stand-alone mode, output to the console
    //
    if ((m_fConsoleTrace))
    {
        hFileOut = GetStdHandle(STD_OUTPUT_HANDLE);
        WriteFile(hFileOut, szTemp, iCount, &dwTemp, NULL);
        WriteFile(hFileOut, "\n", 2, &dwTemp, NULL);
    }

    // If we're running as a service, then output to the trace logs
    //
    else if (m_fRtTrace)
    {
        if (m_dwTraceId != INVALID_TRACEID)
        {
            TracePrintfA(m_dwTraceId, szTemp);
        }
    }

    // If the m_fDebugTrace variable has been set in the debugger, then
    // output to the debugger
    //
    if (m_fDebugTrace)
    {
        OutputDebugStringA(szTemp);
        OutputDebugStringA("\n");
    }

}

void RqsEngine::TraceCurrentServerConnections ( ) [private]
VOID RqsEngine::TraceSelf ( )

Definition at line 1192 of file rqsengine.cpp.

{
    Trace("Engine object:");
    Trace("==============");
    Trace("Client count:   %d", m_ulClientCount);
    Trace("Service:        %x", m_hService);
    Trace("Checkpoint:     %d", m_dwCheckPoint);
    Trace("Mpr handle:     %x", m_hInstMprApi);
    Trace("Mprs handle:    %x", m_hServer);
    Trace("Console trace:  %d", m_fConsoleTrace);
    Trace("Debug Trace:    %d", m_fDebugTrace);
    Trace("RtUtils Trace:  %d", m_fRtTrace);
    Trace("Trace Id:       %d", m_dwTraceId);
    Trace("Trace key:      %x", m_hkTrace);
    Trace("Config key:     %x", m_hkConfig);
    Trace("Internal IP:    %s", (m_szInternalAddress[0] ? m_szInternalAddress : "<Unable to connect to RRAS>"));

    Trace("Configuration object:");
    Trace("=====================");
    m_Config.TraceSelf(*this);
}

HRESULT RqsEngine::Wait ( OUT RqsEvent * pAction ) [private]

Definition at line 427 of file rqsengine.cpp.

{
    DWORD dwRet;
    HANDLE hEvents[6];
    UINT uiCount = sizeof(hEvents) / sizeof(HANDLE);
    HRESULT hr = S_OK;

    hEvents[0] = m_eQuit.GetHandle();
    hEvents[1] = m_eSocketAccept.GetHandle();
    hEvents[2] = m_eConfig.GetHandle();
    hEvents[3] = m_eTrace.GetHandle();
    hEvents[4] = m_eSocketRead.GetHandle();
    hEvents[5] = m_eInterfaceAdded.GetHandle();

    dwRet = WaitForMultipleObjectsEx(
                uiCount,
                hEvents,
                FALSE,
                INFINITE,
                FALSE);
    switch (dwRet)
    {
        case WAIT_OBJECT_0:
            *pAction = Quit;
            break;

        case WAIT_OBJECT_0 + 1:
            *pAction = Connect;
            break;

        case WAIT_OBJECT_0 + 2:
            *pAction = UpdateConfig;
            break;

        case WAIT_OBJECT_0 + 3:
            *pAction = UpdateTrace;
            break;

        case WAIT_OBJECT_0 + 4:
            *pAction = Read;
            break;

        case WAIT_OBJECT_0 + 5:
            *pAction = ConfigServerSocket;
            break;

        default:
            *pAction = Error;
            hr = HRESULT_FROM_WIN32( GetLastError() );
            break;
    }

    return hr;
}

Member Data Documentation

BOOL RqsEngine::m_bRegisteredForConnectionNotification [private]

Definition at line 103 of file rqsengine.h.

RqsConfig RqsEngine::m_Config [private]

Definition at line 76 of file rqsengine.h.

RcuCritSec RqsEngine::m_csClientsLock [private]

Definition at line 101 of file rqsengine.h.

DWORD RqsEngine::m_dwCheckPoint [private]

Definition at line 90 of file rqsengine.h.

DWORD RqsEngine::m_dwTraceId [private]

Definition at line 95 of file rqsengine.h.

RcuEvent RqsEngine::m_eConfig [private]

Definition at line 84 of file rqsengine.h.

RcuEvent RqsEngine::m_eInterfaceAdded [private]

Definition at line 86 of file rqsengine.h.

RcuEvent RqsEngine::m_eQuit [private]

Definition at line 83 of file rqsengine.h.

RcuEvent RqsEngine::m_eSocketAccept [private]

Definition at line 81 of file rqsengine.h.

RcuEvent RqsEngine::m_eSocketRead [private]

Definition at line 82 of file rqsengine.h.

RcuEvent RqsEngine::m_eTrace [private]

Definition at line 85 of file rqsengine.h.

BOOL RqsEngine::m_fConsoleTrace [private]

Definition at line 96 of file rqsengine.h.

BOOL RqsEngine::m_fDebugTrace [private]

Definition at line 97 of file rqsengine.h.

BOOL RqsEngine::m_fRtTrace [private]

Definition at line 94 of file rqsengine.h.

HINSTANCE RqsEngine::m_hInstMprApi [private]

Definition at line 91 of file rqsengine.h.

HKEY RqsEngine::m_hkConfig [private]

Definition at line 99 of file rqsengine.h.

HKEY RqsEngine::m_hkTrace [private]

Definition at line 98 of file rqsengine.h.

HANDLE RqsEngine::m_hLog [private]

Definition at line 100 of file rqsengine.h.

HANDLE RqsEngine::m_hServer [private]

Definition at line 92 of file rqsengine.h.

SERVICE_STATUS_HANDLE RqsEngine::m_hService [private]

Definition at line 89 of file rqsengine.h.

ClientList RqsEngine::m_lClients [private]

Definition at line 102 of file rqsengine.h.

RqsRemoveQuarantineFunc RqsEngine::m_qFunc [private]

Definition at line 93 of file rqsengine.h.

RcuRwLock RqsEngine::m_rwlConfig [private]

Definition at line 87 of file rqsengine.h.

RuServerSocket RqsEngine::m_sServer [private]

Definition at line 80 of file rqsengine.h.

CHAR RqsEngine::m_szInternalAddress[16] [private]

Definition at line 104 of file rqsengine.h.

volatile LONG RqsEngine::m_ulClientCount [private]

Definition at line 88 of file rqsengine.h.

The documentation for this class was generated from the following files:
  • NetDS/RRas/rqs/server/rqsengine.h
  • NetDS/RRas/rqs/server/rqsengine.cpp
Generated on Wed Nov 13 2024 16:57:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: RSProxy Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Member Functions | Static Package Attributes | Private Member Functions | Private Attributes

RSProxy Class Reference

List of all members.

Public Member Functions

RSProxy ()
synchronized void | cancelRequest (String requestId)
void | destroy ()
void | endResponse ()
String | getAppletInfo ()
String | getData ()
String | getMessage ()
String | getRequestID ()
int | getStatus ()
boolean | hasResponse ()
void | init ()
void | paint (Graphics g)
void | run ()
void | start ()
void | startRequest (String requestID, String url_context, String url, int mode)
void | stop ()
synchronized boolean | waitForResponse ()

Protected Member Functions

Object[] | findRequest (String requestID)
synchronized void | handleResponse (Object[] request, Object[] response)
void | insertRequest (Object[] request)
void | insertResponse (Object[] response)
Object[] | newDataResponse (String requestID, String data, boolean finished)
Object[] | newErrorResponse (String requestID, String message)
Object[] | newRequest (String requestID, String url_context, String url, int mode)
void | removeRequest (Object[] request)
void | removeResponse ()
void | runUrlDownloadThread (String requestID)

Static Package Attributes

static final int | BUFFER_SIZE = 512
static final int | C_REQUEST = 7
static final int | C_RESPONSE = 5
static final int | E_FAIL = -1
static final int | EXPECTED_MAX_CONCURRENT_CALLS = 5
static final int | REQUEST_ID = 2
static final int | REQUEST_MODE = 5
static final int | REQUEST_MODE_COMPLETE = 0
static final int | REQUEST_MODE_PARTIAL = 1
static final int | REQUEST_NEXT = 0
static final int | REQUEST_PREV = 1
static final int | REQUEST_THREAD = 6
static final int | REQUEST_URL = 3
static final int | REQUEST_URLCONTEXT = 4
static final int | RESPONSE_DATA = 4
static final int | RESPONSE_MESSAGE = 3
static final int | RESPONSE_NEXT = 0
static final int | RESPONSE_REQUESTID = 1
static final int | RESPONSE_STATUS = 2
static final int | S_COMPLETED = 0
static final int | S_PARTIAL = 2
static final int | S_PENDING = 1

Private Member Functions

int | getInteger (Object obj)
Object | getObject (int integer)

Private Attributes

Object[] | m_requestHead
Object | m_requestLock
Object[] | m_responseHead
Object | m_responseLock
Object[] | m_responseTail

Detailed Description

Definition at line 19 of file rsProxy.java.

Constructor & Destructor Documentation

RSProxy::RSProxy ( ) [inline]

Definition at line 95 of file rsProxy.java.

    {
        m_requestLock = new Object();
        m_responseLock = new Object();
    }

Member Function Documentation

synchronized void RSProxy::cancelRequest ( String requestId ) [inline]

Definition at line 134 of file rsProxy.java.

  {
    Object [] request = findRequest(requestId);

    if (request == null)
      return;
    if (request[REQUEST_THREAD] != null)
      ((Thread)request[REQUEST_THREAD]).stop();
  }

void RSProxy::destroy ( ) [inline]

Definition at line 34 of file rsProxy.java.

{}

void RSProxy::endResponse ( ) [inline]

Definition at line 148 of file rsProxy.java.

    { removeResponse();           }

Object [] RSProxy::findRequest ( String requestID ) [inline, protected]

Definition at line 287 of file rsProxy.java.

    {
        synchronized (m_requestLock)
    {
            Object[] i;
            for (i = m_requestHead; null != i; i = (Object[])i[REQUEST_NEXT])
      {
                if (0 == requestID.compareTo((String)i[REQUEST_ID]))
                    return i;
      }
    }
        return null;
    }

String RSProxy::getAppletInfo ( ) [inline]

Definition at line 26 of file rsProxy.java.

    {
    return  "Name: RSProxy\r\n" +
        "Author: Microsoft\r\n" +
        "Copyright (c) 1998 Microsoft Corp.";
    }

String RSProxy::getData ( ) [inline]

Definition at line 172 of file rsProxy.java.

    {
        if (null == m_responseHead)
            return "";
        return (String)m_responseHead[RESPONSE_DATA];
    }

int RSProxy::getInteger ( Object obj ) [inline, private]

Definition at line 369 of file rsProxy.java.

  {
    if (null == obj)
      return 0;
    return ((Integer)obj).intValue();
  }

String RSProxy::getMessage ( ) [inline]

Definition at line 165 of file rsProxy.java.

    {
        if (null == m_responseHead)
            return "";
        return (String)m_responseHead[RESPONSE_MESSAGE];
    }

Object RSProxy::getObject ( int integer ) [inline, private]

Definition at line 365 of file rsProxy.java.

  { return new Integer(integer);  }

String RSProxy::getRequestID ( ) [inline]

Definition at line 151 of file rsProxy.java.

    {
        if (null == m_responseHead)
      return "";
        return (String)m_responseHead[RESPONSE_REQUESTID];
    }

int RSProxy::getStatus ( ) [inline]

Definition at line 158 of file rsProxy.java.

    {
        if (null == m_responseHead)
            return 0;
        return getInteger(m_responseHead[RESPONSE_STATUS]);
    }

synchronized void RSProxy::handleResponse | ( | Object[] | request,
 |  | Object[] | response |
 | ) |  |  | [inline, protected]

Definition at line 238 of file rsProxy.java.

    {
        insertResponse(response);
    int status = getInteger(response[RESPONSE_STATUS]);
        if (S_COMPLETED == status || E_FAIL == status)
            removeRequest(request);
        notifyAll();
    }

boolean RSProxy::hasResponse ( ) [inline]

Definition at line 145 of file rsProxy.java.

    { return null != m_responseHead;    }

void RSProxy::init ( ) [inline]

Definition at line 33 of file rsProxy.java.

{ resize(0,0); }

void RSProxy::insertRequest ( Object[] request ) [inline, protected]

Definition at line 302 of file rsProxy.java.

    {
        synchronized (m_requestLock)
    {
            request[REQUEST_PREV] = null;
            request[REQUEST_NEXT] = m_requestHead;
            if (null != m_requestHead)
                m_requestHead[REQUEST_PREV] = request;
            m_requestHead = request;
    }
  }

void RSProxy::insertResponse ( Object[] response ) [inline, protected]

Definition at line 330 of file rsProxy.java.

    {
        synchronized (m_responseLock)
    {
            if (null == m_responseHead)
      {
                m_responseHead = response;
                m_responseTail = response;
      }
            else
      {
                m_responseTail[RESPONSE_NEXT] = response;
                m_responseTail = response;
      }
    }
    }

Object [] RSProxy::newDataResponse | ( | String | requestID,
 |  | String | data,
 |  | boolean | finished |
 | ) |  |  | [inline, protected]

Definition at line 262 of file rsProxy.java.

    {
        Object[] response = new Object[C_RESPONSE];
        response[RESPONSE_REQUESTID] = requestID;
        response[RESPONSE_STATUS] = new Integer(finished ? S_COMPLETED : S_PARTIAL);
        response[RESPONSE_MESSAGE] = "Completed";
        response[RESPONSE_DATA] = data;
        return response;
    }

Object [] RSProxy::newErrorResponse | ( | String | requestID,
 |  | String | message |
 | ) |  |  | [inline, protected]

Definition at line 273 of file rsProxy.java.

    {
        Object[] response = new Object[C_RESPONSE];
        response[RESPONSE_REQUESTID] = requestID;
        response[RESPONSE_STATUS] = new Integer(E_FAIL);
        response[RESPONSE_MESSAGE] = message;
        response[RESPONSE_DATA] = "";
    return response;
    }

Object [] RSProxy::newRequest | ( | String | requestID,
 |  | String | url_context,
 |  | String | url,
 |  | int | mode |
 | ) |  |  | [inline, protected]

Definition at line 251 of file rsProxy.java.

    {
        Object[] request = new Object[C_REQUEST];
        request[REQUEST_ID] = requestID;
        request[REQUEST_URL] = url;
        request[REQUEST_URLCONTEXT] = url_context;
        request[REQUEST_MODE] = getObject(mode);
        return request;
    }

void RSProxy::paint ( Graphics g ) [inline]

Definition at line 35 of file rsProxy.java.

{}

void RSProxy::removeRequest ( Object[] request ) [inline, protected]

Definition at line 315 of file rsProxy.java.

    {
        synchronized (m_requestLock)
    {
            if (null == request[REQUEST_PREV])
                m_requestHead = (Object[])request[REQUEST_NEXT];
            else
                ((Object[])request[REQUEST_PREV])[REQUEST_NEXT] = request[REQUEST_NEXT];

            if (null != request[REQUEST_NEXT])
                ((Object[])request[REQUEST_NEXT])[REQUEST_PREV] = request[REQUEST_PREV];
    }
    }

void RSProxy::removeResponse ( ) [inline, protected]

Definition at line 348 of file rsProxy.java.

    {
        synchronized (m_responseLock)
    {
            if (null != m_responseHead)
      {
                m_responseHead = (Object[])m_responseHead[RESPONSE_NEXT];
                if (null == m_responseHead)
                    m_responseTail = null;
      }
    }
    }

void RSProxy::run ( ) [inline]

Definition at line 182 of file rsProxy.java.

    {
        String requestID = Thread.currentThread().getName();
        runUrlDownloadThread(requestID);
    }

void RSProxy::runUrlDownloadThread ( String requestID ) [inline, protected]

Definition at line 192 of file rsProxy.java.

    {
        Object[] request = findRequest(requestID);
        Object[] response;

        if (null == request)
            response = newErrorResponse(requestID,"Unknown request id.");
        else
        {
            try
            {
                int bytesRead;
                byte[] buffer = new byte[BUFFER_SIZE];
        URL contextURL = new URL((String)request[REQUEST_URLCONTEXT]);
                InputStream stream = new URL(contextURL,(String)request[REQUEST_URL]).openStream();
        StringBuffer responseBuffer = new StringBuffer();

                while (-1 != (bytesRead = stream.read(buffer)))
                {
          if (request[REQUEST_MODE] == getObject(REQUEST_MODE_PARTIAL))
          { // generate response as partial data buffers are received
            response = newDataResponse(requestID,new String(buffer,0,0,bytesRead),false);
            handleResponse(request,response);
          }
          else //if (request[REQUEST_MODE] == getObject(REQUEST_MODE_COMPLETE))
          { // generate a single response when request is complete
            responseBuffer.append(new String(buffer,0,0,bytesRead));
          }
                }
        stream.close();

        if (request[REQUEST_MODE] == getObject(REQUEST_MODE_PARTIAL))
          response = newDataResponse(requestID, "", true);
        else //if (request[REQUEST_MODE] == getObject(REQUEST_MODE_COMPLETE))
          response = newDataResponse(requestID,responseBuffer.toString(),true);
            }
            catch (Exception e)
            {
                response = newErrorResponse(requestID,e.getMessage());
            }
    }

    handleResponse(request,response);
    }

void RSProxy::start ( ) [inline]

Definition at line 36 of file rsProxy.java.

{}

void RSProxy::startRequest | ( | String | requestID,
 |  | String | url_context,
 |  | String | url,
 |  | int | mode |
 | ) |  |  | [inline]

Definition at line 102 of file rsProxy.java.

    {
        Object[] request = newRequest(requestID,url_context,url,mode);
        insertRequest(request);
        Thread thread = new Thread(this,requestID);
    request[REQUEST_THREAD] = thread;
        thread.start();
    }

void RSProxy::stop ( ) [inline]

Definition at line 37 of file rsProxy.java.

{}

synchronized boolean RSProxy::waitForResponse ( ) [inline]

Definition at line 112 of file rsProxy.java.

    {
        // a response is already queued up
        if (null != m_responseHead)
            return true;

        // a response cannot be generated without a request
        if (null == m_requestHead)
            return false;

        try
        { // try waiting for a response
            while (null == m_responseHead)
                wait();
            return true;
        }
        catch (InterruptedException ie)
        {
            return false;
        }
    }

Member Data Documentation

final int RSProxy::BUFFER_SIZE = 512 [static, package]

Definition at line 75 of file rsProxy.java.

final int RSProxy::C_REQUEST = 7 [static, package]

Definition at line 57 of file rsProxy.java.

final int RSProxy::C_RESPONSE = 5 [static, package]

Definition at line 71 of file rsProxy.java.

final int RSProxy::E_FAIL = -1 [static, package]

Definition at line 42 of file rsProxy.java.

final int RSProxy::EXPECTED_MAX_CONCURRENT_CALLS = 5 [static, package]

Definition at line 76 of file rsProxy.java.

Object [] RSProxy::m_requestHead [private]

Definition at line 84 of file rsProxy.java.

Object RSProxy::m_requestLock [private]

Definition at line 83 of file rsProxy.java.

Object [] RSProxy::m_responseHead [private]

Definition at line 87 of file rsProxy.java.

Object RSProxy::m_responseLock [private]

Definition at line 86 of file rsProxy.java.

Object [] RSProxy::m_responseTail [private]

Definition at line 88 of file rsProxy.java.

final int RSProxy::REQUEST_ID = 2 [static, package]

Definition at line 52 of file rsProxy.java.

final int RSProxy::REQUEST_MODE = 5 [static, package]

Definition at line 55 of file rsProxy.java.

final int RSProxy::REQUEST_MODE_COMPLETE = 0 [static, package]

Definition at line 61 of file rsProxy.java.

final int RSProxy::REQUEST_MODE_PARTIAL = 1 [static, package]

Definition at line 62 of file rsProxy.java.

final int RSProxy::REQUEST_NEXT = 0 [static, package]

Definition at line 50 of file rsProxy.java.

final int RSProxy::REQUEST_PREV = 1 [static, package]

Definition at line 51 of file rsProxy.java.

final int RSProxy::REQUEST_THREAD = 6 [static, package]

Definition at line 56 of file rsProxy.java.

final int RSProxy::REQUEST_URL = 3 [static, package]

Definition at line 53 of file rsProxy.java.

final int RSProxy::REQUEST_URLCONTEXT = 4 [static, package]

Definition at line 54 of file rsProxy.java.

final int RSProxy::RESPONSE_DATA = 4 [static, package]

Definition at line 70 of file rsProxy.java.

final int RSProxy::RESPONSE_MESSAGE = 3 [static, package]

Definition at line 69 of file rsProxy.java.

final int RSProxy::RESPONSE_NEXT = 0 [static, package]

Definition at line 66 of file rsProxy.java.

final int RSProxy::RESPONSE_REQUESTID = 1 [static, package]

Definition at line 67 of file rsProxy.java.

final int RSProxy::RESPONSE_STATUS = 2 [static, package]

Definition at line 68 of file rsProxy.java.

final int RSProxy::S_COMPLETED = 0 [static, package]

Definition at line 43 of file rsProxy.java.

final int RSProxy::S_PARTIAL = 2 [static, package]

Definition at line 45 of file rsProxy.java.

final int RSProxy::S_PENDING = 1 [static, package]

Definition at line 44 of file rsProxy.java.

The documentation for this class was generated from the following file:
  • Com/Services/BYOT/BYOTSampleWeb/_ScriptLibrary/rsProxy.java
Generated on Wed Nov 13 2024 16:57:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: RUN Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

RUN Struct Reference

#include "Global.h"

List of all members.

Public Attributes

SCRIPT_ANALYSIS | analysis
int | iLen
int | iStyle
struct RUN * | pNext

Detailed Description

Definition at line 24 of file Global.h.

Member Data Documentation

SCRIPT_ANALYSIS RUN::analysis

Definition at line 28 of file Global.h.

int RUN::iLen

Definition at line 26 of file Global.h.

int RUN::iStyle

Definition at line 27 of file Global.h.

struct RUN* RUN::pNext

Definition at line 25 of file Global.h.

The documentation for this struct was generated from the following file:
  • WinUI/GlobalDev/CSSamp/Global.h
Generated on Wed Nov 13 2024 16:57:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Sample::Messages Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • Sample
  • Sample::Messages
Static Private Attributes

Sample::Messages Class Reference

List of all members.

Static Private Attributes

static internal string | ChooseCertKeyAlgorithm = "The key associated with this certificate is not an RSA key"
static internal string | ChooseCertMessage = "Select the certificate you want to use:"
static internal string | ChooseCertNoPrivateKey = "This certificate does not have a private key associated with it"
static internal string | ChooseCertUnableToConstructKey = "Unable to get the private key"
static internal string | CopyrightMessage = "Copyright © 2002 Microsoft Corp. All rights reserved."
static internal string | DemoTitle = ".NET/CAPICOM demo"
static internal string | ExceptionTitle = "An exception was caught!"
static internal string | FailureMessage = "The verification of the XML fragment failed!"
static internal string | SuccessMessage = "The verification of the XML fragment succeeded!"

Detailed Description

Definition at line 2 of file Messages.cs.

Member Data Documentation

internal string Sample::Messages::ChooseCertKeyAlgorithm = "The key associated with this certificate is not an RSA key" [static, private]

Definition at line 11 of file Messages.cs.

internal string Sample::Messages::ChooseCertMessage = "Select the certificate you want to use:" [static, private]

Definition at line 8 of file Messages.cs.

internal string Sample::Messages::ChooseCertNoPrivateKey = "This certificate does not have a private key associated with it" [static, private]

Definition at line 10 of file Messages.cs.

internal string Sample::Messages::ChooseCertUnableToConstructKey = "Unable to get the private key" [static, private]

Definition at line 9 of file Messages.cs.

internal string Sample::Messages::CopyrightMessage = "Copyright © 2002 Microsoft Corp. All rights reserved." [static, private]

Definition at line 7 of file Messages.cs.

internal string Sample::Messages::DemoTitle = ".NET/CAPICOM demo" [static, private]

Definition at line 4 of file Messages.cs.

internal string Sample::Messages::ExceptionTitle = "An exception was caught!" [static, private]

Definition at line 3 of file Messages.cs.

internal string Sample::Messages::FailureMessage = "The verification of the XML fragment failed!" [static, private]

Definition at line 6 of file Messages.cs.

internal string Sample::Messages::SuccessMessage = "The verification of the XML fragment succeeded!" [static, private]

Definition at line 5 of file Messages.cs.

The documentation for this class was generated from the following file:
  • Security/capicom/c_sharp/xmldsig/Messages.cs
Generated on Wed Nov 13 2024 16:58:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Sample::MySignedXml Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • Sample
  • Sample::MySignedXml
Public Member Functions | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes

Sample::MySignedXml Class Reference

List of all members.

Public Member Functions

MySignedXml ()
MySignedXml (XmlDocument document)

Protected Member Functions

override AsymmetricAlgorithm | GetPublicKey ()

Private Member Functions

static void | ImportPublicKeyBlob (byte[] rgbPubKeyBlob, int cbPubKeyBlob, out uint pExponent, out IntPtrppbModulus, out uint pModulusSize)
static int | PublicKeyBlobFromCertificateRawData (byte[] rgbRawData, int cbRawData, out IntPtrppbKeyBlob, out uint pKeyBlobSize)
static void | UnmanagedArrayFree (IntPtr ppbKeyBlob)

Static Private Member Functions

static byte[] | ConvertIntToByteArray (uint dwInput)

Private Attributes

IEnumerator | m_keyInfoEnum = null

Detailed Description

Definition at line 34 of file SignVerify.cs.

Constructor & Destructor Documentation

Sample::MySignedXml::MySignedXml ( ) [inline]

Definition at line 36 of file SignVerify.cs.

: base() {}

Sample::MySignedXml::MySignedXml ( XmlDocument document ) [inline]

Definition at line 37 of file SignVerify.cs.

: base(document) {}

Member Function Documentation

static byte [] Sample::MySignedXml::ConvertIntToByteArray ( uint dwInput ) [inline, static, private]

Definition at line 50 of file SignVerify.cs.

                                                                  {
            // output of this routine is always big endian
            byte[] rgbTemp = new byte[4];
            uint t1, t2;

            if (dwInput == 0) return new byte[1];
            t1 = dwInput;
            int i = 0;
            while (t1 > 0) {
                t2 = t1 % 256;
                rgbTemp[i] = (byte) t2;
                t1 = (t1 - t2)/256;
                i++;
            }
            // Now, copy only the non-zero part of rgbTemp and reverse
            byte[] rgbOutput = new byte[i];
            // copy and reverse in one pass
            for (int j = 0; j < i; j++) {
                rgbOutput[j] = rgbTemp[i-j-1];
            }
            return(rgbOutput);
        }

override AsymmetricAlgorithm Sample::MySignedXml::GetPublicKey ( ) [inline, protected]

Definition at line 73 of file SignVerify.cs.

                                                            {
            RSAKeyValue tempRSA;
            DSAKeyValue tempDSA;
        KeyInfoX509Data tempCert;

            if (m_keyInfoEnum == null)
                m_keyInfoEnum = KeyInfo.GetEnumerator();

            while (m_keyInfoEnum.MoveNext()) {
                tempRSA = m_keyInfoEnum.Current as RSAKeyValue;
                if (tempRSA != null) return(tempRSA.Key);

                tempDSA = m_keyInfoEnum.Current as DSAKeyValue;
                if (tempDSA != null) return(tempDSA.Key);

          tempCert = m_keyInfoEnum.Current as KeyInfoX509Data;
          if (tempCert != null) {
            if (tempCert.Certificates != null) {
              // The code here doesn't look in all the certificates and doesn't check if they belong
                        // to the same certificate chain, or whether they are valid
                        if (tempCert.Certificates != null) {
                            foreach (X509Certificate x509certificate in tempCert.Certificates) {
                                IntPtr KeyBlob = IntPtr.Zero;
                                uint KeyBlobSize = 0;
                                int result = PublicKeyBlobFromCertificateRawData(x509certificate.GetRawCertData(), x509certificate.GetRawCertData().Length, out KeyBlob, out KeyBlobSize);
                                byte[] blob = new byte[KeyBlobSize];
                                Marshal.Copy(KeyBlob, blob, 0, (int)KeyBlobSize);
                                UnmanagedArrayFree(KeyBlob);
                            RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
                  RSAParameters parameters = new RSAParameters();
                  IntPtr ExponentBlob = IntPtr.Zero, ModulusBlob = IntPtr.Zero;
                  uint PubExponent = 0, ModulusSize = 0;
                                ImportPublicKeyBlob(blob, blob.Length, out PubExponent, out ModulusBlob, out ModulusSize);
                                parameters.Exponent = ConvertIntToByteArray(PubExponent);
                                parameters.Modulus = new byte[ModulusSize];
                                Marshal.Copy(ModulusBlob, parameters.Modulus, 0, (int)ModulusSize);
                                UnmanagedArrayFree(ModulusBlob);
                  rsa.ImportParameters(parameters);
                                return rsa;
                  }
                        }
                    }
                }
            }
            return(null);
      }

static void Sample::MySignedXml::ImportPublicKeyBlob | ( | byte[] | rgbPubKeyBlob,
 |  | int | cbPubKeyBlob,
 |  | out uint | pExponent,
 |  | out | IntPtrppbModulus,
 |  | out uint | pModulusSize |
 | ) |  |  | [private]
static int Sample::MySignedXml::PublicKeyBlobFromCertificateRawData | ( | byte[] | rgbRawData,
 |  | int | cbRawData,
 |  | out | IntPtrppbKeyBlob,
 |  | out uint | pKeyBlobSize |
 | ) |  |  | [private]
static void Sample::MySignedXml::UnmanagedArrayFree ( IntPtr ppbKeyBlob ) [private]

Member Data Documentation

IEnumerator Sample::MySignedXml::m_keyInfoEnum = null [private]

Definition at line 35 of file SignVerify.cs.

The documentation for this class was generated from the following file:
  • Security/capicom/c_sharp/xmldsig/SignVerify.cs
Generated on Wed Nov 13 2024 16:58:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Sample::Sample Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • Sample
  • Sample::Sample
Static Public Member Functions

Sample::Sample Class Reference

List of all members.

Static Public Member Functions

static void | checkValidity (uint pChainContext)
static void | displayChain (uint pChainContext)
static void | displayHelp ()
static uint | getChainFromStore (uint pStoreContext, int index)
static void | Main (string[] args)
static void | Main ()
static uint | openStore (String szStoreName)
static void | showChains (uint pStoreContext)

Detailed Description

Definition at line 62 of file chainsh.cs.

Member Function Documentation

static void Sample::Sample::checkValidity ( uint pChainContext ) [inline, static]

Definition at line 286 of file chainsh.cs.

    {
      IChainContext iChain;
      CAPICOM.Chain oChain;
      int status;

      //API bridging
      oChain = new ChainClass();
      iChain = (IChainContext)oChain;
      iChain.ChainContext = (int)pChainContext;

      //get status of the entire chain
      status = oChain.get_Status(0);

      if (status == 0)
      {
        Console.Write("The chain appears trustworthy.");
        Console.WriteLine();
        return;
      }

      Console.WriteLine("The chain is invalid.");

      // display specific chain status
      // note: for simplicity, only SOME possible status
      // values are presented below
      if ((status & Constants.CAPICOM_TRUST_IS_NOT_TIME_VALID) == Constants.CAPICOM_TRUST_IS_NOT_TIME_VALID)
        Console.WriteLine("Chain status: not time valid");

      if ((status & Constants.CAPICOM_TRUST_IS_NOT_TIME_NESTED) == Constants.CAPICOM_TRUST_IS_NOT_TIME_NESTED)
        Console.WriteLine("Chain status: time nested.");

      if ((status & Constants.CAPICOM_TRUST_IS_REVOKED) == Constants.CAPICOM_TRUST_IS_REVOKED)
        Console.WriteLine("Chain status: is revoked");

      if ((status & Constants.CAPICOM_TRUST_IS_NOT_SIGNATURE_VALID) == Constants.CAPICOM_TRUST_IS_REVOKED)
        Console.WriteLine("Chain status:  invalid signature");

      if ((status & Constants.CAPICOM_TRUST_IS_UNTRUSTED_ROOT) == Constants.CAPICOM_TRUST_IS_UNTRUSTED_ROOT)
          Console.WriteLine("Chain status: untrusted root");

      if ((status & Constants.CAPICOM_TRUST_REVOCATION_STATUS_UNKNOWN) == Constants.CAPICOM_TRUST_REVOCATION_STATUS_UNKNOWN)
          Console.WriteLine("Chain status: revocation status unknown");

      if ((status & Constants.CAPICOM_TRUST_INVALID_EXTENSION) == Constants.CAPICOM_TRUST_INVALID_EXTENSION)
          Console.WriteLine("Chain status: invalid extension");

      if ((status & Constants.CAPICOM_TRUST_INVALID_POLICY_CONSTRAINTS) == Constants.CAPICOM_TRUST_INVALID_POLICY_CONSTRAINTS)
          Console.WriteLine("Chain status: invalid policy constraints");

      if ((status & Constants.CAPICOM_TRUST_INVALID_BASIC_CONSTRAINTS) == Constants.CAPICOM_TRUST_INVALID_BASIC_CONSTRAINTS)
          Console.WriteLine("Chain status: invalid basic constraints");

      if ((status & Constants.CAPICOM_TRUST_INVALID_NAME_CONSTRAINTS) == Constants.CAPICOM_TRUST_INVALID_NAME_CONSTRAINTS)
          Console.WriteLine("Chain status:  invalid name constraints");

      if ((status & Constants.CAPICOM_TRUST_IS_OFFLINE_REVOCATION) == Constants.CAPICOM_TRUST_IS_OFFLINE_REVOCATION)
          Console.WriteLine("Chain status: offline revocation");

      if ((status & Constants.CAPICOM_TRUST_IS_PARTIAL_CHAIN) == Constants.CAPICOM_TRUST_IS_PARTIAL_CHAIN)
          Console.WriteLine("Chain status: partial chain");

      Console.WriteLine();

    }

static void Sample::Sample::displayChain ( uint pChainContext ) [inline, static]

Definition at line 351 of file chainsh.cs.

    {
      Certificate cert;
      IChainContext iChain;
      CAPICOM.Chain oChain;

      IEnumerator eEnum;
      int i = 0;

      //API bridging
      oChain = new ChainClass();
      iChain = (IChainContext)oChain;
      iChain.ChainContext = (int)pChainContext;

      //get the number of certificates in chain
      eEnum = oChain.Certificates.GetEnumerator();

      Console.WriteLine();
      Console.WriteLine("Chain: ");

      //display properties of each certificate in the chain
      while (eEnum.MoveNext() == true)
      {
        i++;
        cert = (Certificate) eEnum.Current;
        Console.WriteLine("Certificate: " + i);
        Console.WriteLine("Subject: " + cert.SubjectName);
        Console.WriteLine("Issuer: " + cert.IssuerName);
        Console.WriteLine("Hash: " + cert.Thumbprint);
        Console.WriteLine("Valid From: " + cert.ValidFromDate);
        Console.WriteLine("Valid To: " + cert.ValidToDate);
        Console.WriteLine();
      }
    }

static void Sample::Sample::displayHelp ( ) [inline, static]

Definition at line 386 of file chainsh.cs.

    {
      const int HELP_PAD = 30;

      Console.WriteLine("Usage:");
      Console.WriteLine();
      Console.Write("[h]elp".PadRight(HELP_PAD, ' '));
      Console.WriteLine("This screen");

      Console.WriteLine();
      Console.Write("[o]pen <store name>".PadRight(HELP_PAD, ' '));
      Console.WriteLine("Open 'my', 'ca', or 'root' system store");

      Console.WriteLine();
      Console.Write("[c]hains".PadRight(HELP_PAD, ' '));
      Console.WriteLine("List all chains found in store");

      Console.WriteLine();
      Console.Write("[d]isplay <idx>".PadRight(HELP_PAD, ' '));
      Console.WriteLine("<idx> is the number of the chain to display");

      Console.WriteLine();
      Console.Write("[v]erify <idx>".PadRight(HELP_PAD, ' '));
      Console.WriteLine("<idx> is the number of the chain to verify");

      Console.WriteLine();
      Console.Write("[q]uit".PadRight(HELP_PAD, ' '));
      Console.WriteLine("Exit this program.");

      Console.WriteLine();
    }

static uint Sample::Sample::getChainFromStore | ( | uint | pStoreContext,
 |  | int | index |
 | ) |  |  | [inline, static]

Definition at line 238 of file chainsh.cs.

    {
      const uint X509_ASN_ENCODING            = 0x00000001;
      const uint PKCS_7_ASN_ENCODING            = 0x00010000;
      const uint CERT_CHAIN_FIND_BY_ISSUER        = 1;
      const uint CERT_CHAIN_FIND_BY_ISSUER_NO_KEY_FLAG  =  0x4000;

      uint  pChainContext = 0;

      if (pStoreContext == 0)
      {
        Console.WriteLine("No store is currently open.");
        return 0;
      }

      Win32.CERT_CHAIN_FIND_BY_ISSUER_PARA pvFindPara =
        new Win32.CERT_CHAIN_FIND_BY_ISSUER_PARA();

      //get size of CERT_CHAIN_FIND_BY_ISSUER_PARA struct
      pvFindPara.cbSize = Marshal.SizeOf(pvFindPara);
      try
      {
        //get the chain
        while (index > 0)
        {
          pChainContext = Win32.CertFindChainInStore(
            pStoreContext,
            X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
            CERT_CHAIN_FIND_BY_ISSUER_NO_KEY_FLAG,
            CERT_CHAIN_FIND_BY_ISSUER,
            ref pvFindPara,
            pChainContext);

          if (pChainContext == 0)
          {
            Console.WriteLine(" Couldn't find chain with index " + index);
            return 0;
          }
          index--;
        }
        return pChainContext;
      }
      catch (Exception e)
      {
        Console.WriteLine("Error in " + e.Source + ": " + e.Message);
        return 0;
      }
    }

static void Sample::Sample::Main ( string[] args ) [inline, static]

Definition at line 65 of file chainsh.cs.

    {
      uint pStoreContext  = 0;
      uint pChainContext  = 0;
      String [] input     = new String[2];
      bool done           = false;

      displayHelp();

      while (!done)
      {
        Console.Write(">>");
        input = Console.ReadLine().Split(' ');

        //parse command line
        if (input[0].ToLower() == "q" || input[0].ToLower() == "quit")
        {
          done = true;
        }
        else if(input[0].ToLower() == "help" || input[0].ToLower() == "h")
        {
          displayHelp();
        }
        else if (input[0].ToLower() == "open"  || input[0].ToLower() == "o")
        {
          if (input.Length == 2)
          {
            pStoreContext = openStore(input[1]);
          }
          else
          {
            displayHelp();
          }
        }
        else if (input[0].ToLower() == "chains" || input[0].ToLower() == "c")
        {
          showChains(pStoreContext);
        }
        else if (input[0].ToLower() == "display"  || input[0].ToLower() == "d")
        {
          if (input.Length == 2)
          {
            pChainContext = getChainFromStore(pStoreContext, System.Convert.ToInt32(input[1]));

            if (pChainContext == 0)
            {
              Console.WriteLine("Couldn't display chain with indexnvalid chain index.");
            }
            else
            {
              displayChain(pChainContext);
            }
          }
          else
          {
            displayHelp();
          }

        }
        else if (input[0].ToLower() == "verify"  || input[0].ToLower() == "v")
        {
          if (input.Length == 2)
          {
            pChainContext = getChainFromStore(pStoreContext, System.Convert.ToInt32(input[1]));

            if (pChainContext == 0)
            {
              Console.WriteLine("Invalid chain index.");
            }
            else
            {
              checkValidity(pChainContext);
            }
          }
          else
          {
            displayHelp();
          }
        }
      }
    }

static void Sample::Sample::Main ( ) [inline, static]

Definition at line 26 of file xmldsig.cs.

                                {
        Application.Run(new MainWindow());
      }

static uint Sample::Sample::openStore ( String szStoreName ) [inline, static]

Definition at line 147 of file chainsh.cs.

    {

      uint  pStoreContext = 0;     // system store handle
      ICertStore iStore;
      Store oStore;        // CAPICOM object

      //verify that valid system store name was passed in
      if (szStoreName.ToLower() != "my" &
        szStoreName.ToLower() != "ca" &
        szStoreName.ToLower() != "root")
      {
        displayHelp();
        return 0;
      }

      try
      {
        //open system store, use default CSP
        pStoreContext = Win32.CertOpenSystemStore(
          0,
          szStoreName);

        // API bridging
        oStore = new StoreClass();
        iStore = (ICertStore)oStore;
        iStore.StoreHandle = (int)pStoreContext;

        Console.WriteLine ("The store has " + oStore.Certificates.Count + " certificates");

        return pStoreContext;
      }
      catch (Exception e)
      {
        Console.WriteLine("Error in " + e.Source + ": " + e.Message);
        return 0;
      }
    }

static void Sample::Sample::showChains ( uint pStoreContext ) [inline, static]

Definition at line 185 of file chainsh.cs.

    {
      const uint X509_ASN_ENCODING            = 0x00000001;
      const uint PKCS_7_ASN_ENCODING            = 0x00010000;
      const uint CERT_CHAIN_FIND_BY_ISSUER        = 1;
      const uint CERT_CHAIN_FIND_BY_ISSUER_NO_KEY_FLAG  =  0x4000;

      uint  pChainContext = 0;

      if (pStoreContext == 0)
      {
        Console.WriteLine("No store is currently open.");
        return;
      }

      Win32.CERT_CHAIN_FIND_BY_ISSUER_PARA pvFindPara =
                new Win32.CERT_CHAIN_FIND_BY_ISSUER_PARA();

      //get size of CERT_CHAIN_FIND_BY_ISSUER_PARA struct
      pvFindPara.cbSize = Marshal.SizeOf(pvFindPara);
      try
      {
        //get first chain
        pChainContext = Win32.CertFindChainInStore(
          pStoreContext,
          X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
          CERT_CHAIN_FIND_BY_ISSUER_NO_KEY_FLAG,
          CERT_CHAIN_FIND_BY_ISSUER,
          ref pvFindPara,
          0
          );

        //get the rest
        while (pChainContext != 0)
        {
          displayChain(pChainContext);  // display chains
          pChainContext = Win32.CertFindChainInStore(
            pStoreContext,
            X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
            CERT_CHAIN_FIND_BY_ISSUER_NO_KEY_FLAG,
            CERT_CHAIN_FIND_BY_ISSUER,
            ref pvFindPara,
            pChainContext);

        }
        return;
      }
      catch (Exception e)
      {
        Console.WriteLine("Error in " + e.Source + ": " + e.Message);
        return;
      }
    }

The documentation for this class was generated from the following files:
  • Security/capicom/c_sharp/chainsh/chainsh.cs
  • Security/capicom/c_sharp/xmldsig/xmldsig.cs
Generated on Wed Nov 13 2024 16:58:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Sample::SignVerify Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • Sample
  • Sample::SignVerify
Static Public Member Functions | Static Private Member Functions

Sample::SignVerify Class Reference

List of all members.

Static Public Member Functions

static string | SignXML (string strXML)
static string | SignXMLX509Data (string strXML)
static bool | VerifyXML (string strXML)

Static Private Member Functions

static void | GetSignatureKey (out RSACryptoServiceProvider rsa, out X509Certificate x509Cert)
static X509Certificate | GetX509Certificate (ICertificate2 cert)

Detailed Description

Definition at line 121 of file SignVerify.cs.

Member Function Documentation

static void Sample::SignVerify::GetSignatureKey | ( | out RSACryptoServiceProvider | rsa,
 |  | out X509Certificate | x509Cert |
 | ) |  |  | [inline, static, private]

Definition at line 122 of file SignVerify.cs.

                                                                                {
            rsa = null;
            x509Cert = null;
            try {
                Store st = new Store();
                st.Open(CAPICOM_STORE_LOCATION.CAPICOM_CURRENT_USER_STORE,
                        "MY", // Store Name
                        CAPICOM_STORE_OPEN_MODE.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED);
                Certificates selectedCerts = ((ICertificates2)st.Certificates).Select(
                                        Messages.DemoTitle,
                                        Messages.ChooseCertMessage,
                                        false);

                ICertificate2 selectedCert = ((ICertificate2)selectedCerts[1]);
                if (selectedCert.HasPrivateKey() == false) {
                    MessageBox.Show(Messages.ChooseCertNoPrivateKey, Messages.ExceptionTitle, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    return;
                }

                // This only works with RSA keys
                if (selectedCert.PublicKey().Algorithm.FriendlyName != "RSA") {
                    MessageBox.Show(Messages.ChooseCertKeyAlgorithm, Messages.ExceptionTitle, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    return;
                }

                // Construct the public key
                CspParameters csp = new CspParameters();
                csp.KeyContainerName = selectedCert.PrivateKey.ContainerName;
                csp.ProviderName = selectedCert.PrivateKey.ProviderName;
                csp.ProviderType = Convert.ToInt32(selectedCert.PrivateKey.ProviderType);
                switch (selectedCert.PrivateKey.KeySpec) {
                    case CAPICOM_KEY_SPEC.CAPICOM_KEY_SPEC_KEYEXCHANGE:
                        csp.KeyNumber = 1;
                        break;
                    case CAPICOM_KEY_SPEC.CAPICOM_KEY_SPEC_SIGNATURE:
                        csp.KeyNumber = 2;
                        break;
                }
                if (selectedCert.PrivateKey.IsMachineKeyset())
                    csp.Flags = CspProviderFlags.UseMachineKeyStore;
                rsa = new RSACryptoServiceProvider(csp);

                x509Cert = GetX509Certificate(selectedCert);
            } catch (Exception) {
                MessageBox.Show(Messages.ChooseCertUnableToConstructKey, Messages.ExceptionTitle, MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
        }

static X509Certificate Sample::SignVerify::GetX509Certificate ( ICertificate2 cert ) [inline, static, private]

Definition at line 170 of file SignVerify.cs.

                                                                               {
            String certAsString = cert.Export(CAPICOM_ENCODING_TYPE.CAPICOM_ENCODE_BASE64);
        char[] charArray = {'\r', '\n', '\0'};
        certAsString = certAsString.TrimEnd(charArray);

        byte[] buffer = Convert.FromBase64String(certAsString);
        return new X509Certificate(buffer);
        }

static string Sample::SignVerify::SignXML ( string strXML ) [inline, static]

Definition at line 179 of file SignVerify.cs.

                                                     {
            string strResult = "";
            try {
                SignedXml signedXml = new SignedXml();

                // Get the signature key. For this demo, we look for keys associated with a certificate in the "MY" store
                RSACryptoServiceProvider rsa = null;
                X509Certificate x509Cert = null;
                GetSignatureKey(out rsa, out x509Cert);
                if (rsa == null) return "";
                signedXml.SigningKey = rsa;

                Reference reference = new Reference();
                reference.Uri = "#object-1";
            reference.Type = "http://www.w3.org/2000/09/xmldsig#Object";

            // Add an object
            System.Security.Cryptography.Xml.DataObject obj = new System.Security.Cryptography.Xml.DataObject();
            XmlDocument doc = new XmlDocument();
                doc.PreserveWhitespace = true;
                doc.LoadXml(strXML);
            obj.Data = doc.ChildNodes;
            obj.Id = "object-1";
            signedXml.AddObject(obj);

                signedXml.AddReference(reference);
                KeyInfo keyInfo = new KeyInfo();

                keyInfo.AddClause(new RSAKeyValue(rsa));
                signedXml.KeyInfo = keyInfo;

                // compute the signature
                signedXml.ComputeSignature();

                strResult = signedXml.GetXml().OuterXml;
            } catch (Exception exc) {
                MessageBox.Show(exc.ToString(), Messages.ExceptionTitle, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return strResult;
            }

            return strResult;
        }

static string Sample::SignVerify::SignXMLX509Data ( string strXML ) [inline, static]

Definition at line 222 of file SignVerify.cs.

                                                             {
            string strResult = "";
            try {
                SignedXml signedXml = new SignedXml();

                // Get the signature key. For this demo, we look for keys associated with a certificate in the "MY" store
                RSACryptoServiceProvider rsa = null;
                X509Certificate x509Cert = null;
                GetSignatureKey(out rsa, out x509Cert);
                if (rsa == null) return "";
                signedXml.SigningKey = rsa;

                Reference reference = new Reference();
                reference.Uri = "#object-1";
            reference.Type = "http://www.w3.org/2000/09/xmldsig#Object";

            // Add an object
            System.Security.Cryptography.Xml.DataObject obj = new System.Security.Cryptography.Xml.DataObject();
            XmlDocument doc = new XmlDocument();
                doc.PreserveWhitespace = true;
                doc.LoadXml(strXML);
            obj.Data = doc.ChildNodes;
            obj.Id = "object-1";
            signedXml.AddObject(obj);

                signedXml.AddReference(reference);
                KeyInfo keyInfo = new KeyInfo();

                // Include the certificate raw data with the signed file
                keyInfo.AddClause(new KeyInfoX509Data(x509Cert));
                signedXml.KeyInfo = keyInfo;

                // compute the signature
                signedXml.ComputeSignature();

                strResult = signedXml.GetXml().OuterXml;
            } catch (Exception exc) {
                MessageBox.Show(exc.ToString(), Messages.ExceptionTitle, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return strResult;
            }

            return strResult;
        }

static bool Sample::SignVerify::VerifyXML ( string strXML ) [inline, static]

Definition at line 266 of file SignVerify.cs.

                                                     {
            bool bResult = false;

            try {
                XmlDocument xmlDocument = new XmlDocument();
                xmlDocument.PreserveWhitespace = true;
                xmlDocument.LoadXml(strXML);

                MySignedXml signedXml = new MySignedXml(xmlDocument);

                XmlNodeList nodeList = xmlDocument.GetElementsByTagName("Signature");
                signedXml.LoadXml((XmlElement)nodeList[0]);

                AsymmetricAlgorithm key = null;
                if (signedXml.CheckSignatureReturningKey(out key)) {
                    bResult = true;
                }
            } catch (Exception exc) {
                MessageBox.Show(exc.ToString(), Messages.ExceptionTitle, MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }

            return bResult;
        }

The documentation for this class was generated from the following file:
  • Security/capicom/c_sharp/xmldsig/SignVerify.cs
Generated on Wed Nov 13 2024 16:58:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Sample::UI::AboutBox Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • Sample
  • UI
  • Sample::UI::AboutBox
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

Sample::UI::AboutBox Class Reference

List of all members.

Public Member Functions

AboutBox ()

Protected Member Functions

override void | Dispose (bool disposing)

Private Member Functions

void | InitializeComponent ()
void | OkButton_Click (object sender, System.EventArgs e)

Private Attributes

System.ComponentModel.Container | components = null
System.Windows.Forms.Label | CopyrightLabel
System.Windows.Forms.PictureBox | IconBox
System.Windows.Forms.Button | OkButton
System.Windows.Forms.Label | TitleLabel

Detailed Description

Definition at line 10 of file AboutBox.cs.

Constructor & Destructor Documentation

Sample::UI::AboutBox::AboutBox ( ) [inline]

Definition at line 18 of file AboutBox.cs.

                      {
      InitializeComponent();
    }

Member Function Documentation

override void Sample::UI::AboutBox::Dispose ( bool disposing ) [inline, protected]

Definition at line 22 of file AboutBox.cs.

                                                      {
      if( disposing ) {
        if (components != null) {
          components.Dispose();
        }
      }
      base.Dispose( disposing );
    }

void Sample::UI::AboutBox::InitializeComponent ( ) [inline, private]

Definition at line 31 of file AboutBox.cs.

                                       {
            this.Icon = new Icon(GetType().Module.Assembly.GetManifestResourceStream("Traffic.ico"));

            System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(AboutBox));
            this.IconBox = new System.Windows.Forms.PictureBox();
            this.TitleLabel = new System.Windows.Forms.Label();
            this.CopyrightLabel = new System.Windows.Forms.Label();
            this.OkButton = new System.Windows.Forms.Button();
            this.SuspendLayout();
            //
            // IconBox
            //
            this.IconBox.Image = new Bitmap(GetType().Module.Assembly.GetManifestResourceStream("traffic_light.gif"));
            this.IconBox.Location = new System.Drawing.Point(8, 8);
            this.IconBox.Name = "IconBox";
            this.IconBox.Size = new System.Drawing.Size(48, 48);
            this.IconBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            this.IconBox.TabIndex = 0;
            this.IconBox.TabStop = false;
            //
            // TitleLabel
            //
            this.TitleLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.TitleLabel.Location = new System.Drawing.Point(56, 16);
            this.TitleLabel.Name = "TitleLabel";
            this.TitleLabel.Size = new System.Drawing.Size(328, 32);
            this.TitleLabel.TabIndex = 1;
            this.TitleLabel.Text = Messages.DemoTitle;
            //
            // CopyrightLabel
            //
            this.CopyrightLabel.Location = new System.Drawing.Point(56, 40);
            this.CopyrightLabel.Name = "CopyrightLabel";
            this.CopyrightLabel.Size = new System.Drawing.Size(328, 50);
            this.CopyrightLabel.TabIndex = 2;
            this.CopyrightLabel.Text = Messages.CopyrightMessage;
            //
            // OkButton
            //
            this.OkButton.Location = new System.Drawing.Point(304, 72);
            this.OkButton.Name = "OkButton";
            this.OkButton.TabIndex = 3;
            this.OkButton.Text = "Ok";
            this.OkButton.Click += new System.EventHandler(this.OkButton_Click);
            //
            // AboutBox
            //
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize = new System.Drawing.Size(392, 109);
            this.Controls.AddRange(new System.Windows.Forms.Control[] {
                                                      this.OkButton,
                                                      this.CopyrightLabel,
                                                      this.TitleLabel,
                                                      this.IconBox});
            this.AcceptButton = this.OkButton;
            this.CancelButton = this.OkButton;
            this.MaximizeBox = false;
            this.MaximumSize = new System.Drawing.Size(400, 136);
            this.MinimizeBox = false;
            this.MinimumSize = new System.Drawing.Size(400, 136);
            this.SizeGripStyle = SizeGripStyle.Hide;
            this.Name = "AboutBox";
            this.Text = "About";
            this.ResumeLayout(false);
        }

void Sample::UI::AboutBox::OkButton_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Definition at line 97 of file AboutBox.cs.

                                                                       {
            this.Close();
        }

Member Data Documentation

System.ComponentModel.Container Sample::UI::AboutBox::components = null [private]

Definition at line 16 of file AboutBox.cs.

System.Windows.Forms.Label Sample::UI::AboutBox::CopyrightLabel [private]

Definition at line 14 of file AboutBox.cs.

System.Windows.Forms.PictureBox Sample::UI::AboutBox::IconBox [private]

Definition at line 12 of file AboutBox.cs.

System.Windows.Forms.Button Sample::UI::AboutBox::OkButton [private]

Definition at line 15 of file AboutBox.cs.

System.Windows.Forms.Label Sample::UI::AboutBox::TitleLabel [private]

Definition at line 13 of file AboutBox.cs.

The documentation for this class was generated from the following file:
  • Security/capicom/c_sharp/xmldsig/AboutBox.cs
Generated on Wed Nov 13 2024 16:58:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Sample::UI::MainWindow Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • Sample
  • UI
  • Sample::UI::MainWindow
Public Member Functions | Private Member Functions | Private Attributes

Sample::UI::MainWindow Class Reference

List of all members.

Public Member Functions

MainWindow ()

Private Member Functions

void | AboutBoxHandler (object sender, System.EventArgs e)
void | buttonSign_Click (object sender, System.EventArgs e)
void | buttonVerify_Click (object sender, System.EventArgs e)
void | EscapeHandler (object sender, System.EventArgs e)
void | InitializeComponent ()
void | OpenFileHandler (object sender, System.EventArgs e)

Private Attributes

MenuItem | aboutMenu
Button | buttonSign
Button | buttonVerify
MenuItem | closeMenu
Container | components
MenuItem | fileMenu
MenuItem | helpMenu
ComboBox | keyInfoBox
Label | labelSign
Label | labelVerify
MainMenu | mainMenu
MenuItem | openFileMenu
GroupBox | signGroupBox
StatusBar | statusBar
TextBox | textBoxSign
TextBox | textBoxVerify

Detailed Description

Definition at line 29 of file MainWindow.cs.

Constructor & Destructor Documentation

Sample::UI::MainWindow::MainWindow ( ) [inline]

Definition at line 55 of file MainWindow.cs.

                             {
            InitializeComponent();
        }

Member Function Documentation

void Sample::UI::MainWindow::AboutBoxHandler | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Definition at line 176 of file MainWindow.cs.

                                                                        {
            AboutBox aboutBox = new AboutBox();
            aboutBox.ShowDialog();
        }

void Sample::UI::MainWindow::buttonSign_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Definition at line 181 of file MainWindow.cs.

                                                                         {
            switch (keyInfoBox.SelectedIndex) {
                case 0:
                    textBoxVerify.Text = SignVerify.SignXML(textBoxSign.Text);
                    break;
                case 1:
                    textBoxVerify.Text = SignVerify.SignXMLX509Data(textBoxSign.Text);
                    break;
            }
        }

void Sample::UI::MainWindow::buttonVerify_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Definition at line 192 of file MainWindow.cs.

                                                                           {
            bool bVer = SignVerify.VerifyXML(textBoxVerify.Text);
            if (bVer)
                MessageBox.Show(Messages.SuccessMessage, Messages.DemoTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            else
                MessageBox.Show(Messages.FailureMessage, Messages.DemoTitle, MessageBoxButtons.OK, MessageBoxIcon.Stop);
        }

void Sample::UI::MainWindow::EscapeHandler | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Definition at line 200 of file MainWindow.cs.

                                                                      {
            this.Close();
        }

void Sample::UI::MainWindow::InitializeComponent ( ) [inline, private]

Definition at line 59 of file MainWindow.cs.

                                           {
            this.SuspendLayout();

            components = new Container();
            textBoxSign = new TextBox();
            textBoxVerify = new TextBox();
            labelSign = new Label();
            labelVerify = new Label();
            buttonSign = new Button();
            buttonVerify = new Button();
            keyInfoBox = new ComboBox();
            signGroupBox = new GroupBox();
            mainMenu = new MainMenu();

            this.Menu = this.mainMenu;
            this.Icon = new Icon(GetType().Module.Assembly.GetManifestResourceStream("Traffic.ico"));
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.Text = Messages.DemoTitle;
            this.ClientSize = new System.Drawing.Size(440, 520);
            this.MaximizeBox = false;
            this.FormBorderStyle = FormBorderStyle.FixedDialog;

            labelSign.Location = new System.Drawing.Point(15, 5);
            labelSign.Text = "XML fragment to sign:";
            labelSign.Size = new System.Drawing.Size(250, 20);
            labelVerify.TabStop = false;
            labelSign.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));

            labelVerify.Location = new System.Drawing.Point(15, 245);
            labelVerify.Text = "Signed XML fragment:";
            labelVerify.TabStop = false;
            labelVerify.Size = new System.Drawing.Size(250, 20);
            labelVerify.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));

            textBoxSign.Anchor = (AnchorStyles.Bottom | AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
            textBoxSign.Location = new System.Drawing.Point(15, 35);
            textBoxSign.ReadOnly = false;
            textBoxSign.ScrollBars = ScrollBars.Vertical;
            textBoxSign.Multiline = true;
            textBoxSign.Size = new System.Drawing.Size(300, 200);
            textBoxSign.TabIndex = 1;
            textBoxSign.Text = "<text>this is some text</text>";
            textBoxSign.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));

            textBoxVerify.Anchor = (AnchorStyles.Bottom | AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
            textBoxVerify.Location = new System.Drawing.Point(15, 275);
            textBoxVerify.Text = "";
            textBoxVerify.ReadOnly = false;
            textBoxVerify.ScrollBars = ScrollBars.Vertical;
            textBoxVerify.Multiline = true;
            textBoxVerify.TabIndex = 4;
            textBoxVerify.Size = new System.Drawing.Size(300, 200);
            textBoxVerify.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));

            buttonSign.Anchor = (AnchorStyles.Bottom | AnchorStyles.Right);
            buttonSign.Location = new System.Drawing.Point(15, 55);
            buttonSign.Size = new System.Drawing.Size(75, 25);
            buttonSign.TabIndex = 2;
            buttonSign.Font = new System.Drawing.Font("Arial", 10.5F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            buttonSign.Text = "&Sign";
            buttonSign.Click += new System.EventHandler(buttonSign_Click);

            buttonVerify.Anchor = (AnchorStyles.Bottom | AnchorStyles.Right);
            buttonVerify.Location = new System.Drawing.Point(348, 370);
            buttonVerify.Size = new System.Drawing.Size(75, 25);
            buttonVerify.TabIndex = 5;
            buttonVerify.Font = new System.Drawing.Font("Arial", 10.5F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            buttonVerify.Text = "&Verify";
            buttonVerify.Click += new System.EventHandler(buttonVerify_Click);

            keyInfoBox.Anchor = ((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right);
            keyInfoBox.DropDownWidth = 100;
            keyInfoBox.Items.AddRange(new object[] {"RSAKeyValue", "X509Data"});
            keyInfoBox.Location = new System.Drawing.Point(10, 20);
            keyInfoBox.Size = new System.Drawing.Size(85, 24);
            keyInfoBox.TabIndex = 1;
            keyInfoBox.Font = new System.Drawing.Font("Arial", 8.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            keyInfoBox.SelectedIndex = 0;
            keyInfoBox.Font = new System.Drawing.Font("Arial", 8.5F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));

            signGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right);
            signGroupBox.Location = new System.Drawing.Point(330, 85);
            signGroupBox.Size = new System.Drawing.Size(105, 90);
            signGroupBox.TabIndex = 2;

            statusBar = new StatusBar();
            statusBar.Text = Messages.CopyrightMessage;
            statusBar.Dock = DockStyle.Bottom;
            statusBar.Font = new System.Drawing.Font("Arial", 8.5F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));

            fileMenu = new MenuItem();
            fileMenu = mainMenu.MenuItems.Add("&File");

            helpMenu = new MenuItem();
            helpMenu = mainMenu.MenuItems.Add("&Help");

            aboutMenu = new MenuItem("&About", new EventHandler(this.AboutBoxHandler), Shortcut.F1);
            closeMenu = new MenuItem("&Close", new EventHandler(this.EscapeHandler), Shortcut.AltF4);
            helpMenu.MenuItems.Add(aboutMenu);

            openFileMenu = new MenuItem("&Open File", new EventHandler(this.OpenFileHandler), Shortcut.CtrlO);
            fileMenu.MenuItems.Add(openFileMenu);
            fileMenu.MenuItems.Add(closeMenu);

            this.Controls.Add(textBoxSign);
            this.Controls.Add(textBoxVerify);
            this.Controls.Add(labelSign);
            this.Controls.Add(labelVerify);
            this.Controls.Add(buttonVerify);
            signGroupBox.Controls.Add(buttonSign);
            signGroupBox.Controls.Add(keyInfoBox);
            this.Controls.Add(signGroupBox);
            this.Controls.Add(statusBar);

            this.ResumeLayout(false);
        }

void Sample::UI::MainWindow::OpenFileHandler | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Definition at line 204 of file MainWindow.cs.

                                                                        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            openFileDialog.CheckPathExists = true;
            openFileDialog.CheckFileExists = true;
            openFileDialog.InitialDirectory = "c:\\" ;
            openFileDialog.Filter = "xml files (*.xml)|*.xml|All files (*.*)|*.*" ;
            DialogResult dialogResult = openFileDialog.ShowDialog(this);
            if (dialogResult == DialogResult.OK) {
                try {
                    // See whether the file is a valid XML document
                    XmlDocument xmlDoc = new XmlDocument();
                    xmlDoc.PreserveWhitespace = true;
                    xmlDoc.Load(openFileDialog.FileName);
                    textBoxSign.Text = xmlDoc.OuterXml;
                } catch (Exception exc) {
                    MessageBox.Show(exc.ToString(), Messages.ExceptionTitle, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                }
            }
        }

Member Data Documentation

MenuItem Sample::UI::MainWindow::aboutMenu [private]

Definition at line 33 of file MainWindow.cs.

Button Sample::UI::MainWindow::buttonSign [private]

Definition at line 47 of file MainWindow.cs.

Button Sample::UI::MainWindow::buttonVerify [private]

Definition at line 48 of file MainWindow.cs.

MenuItem Sample::UI::MainWindow::closeMenu [private]

Definition at line 34 of file MainWindow.cs.

Container Sample::UI::MainWindow::components [private]

Definition at line 30 of file MainWindow.cs.

MenuItem Sample::UI::MainWindow::fileMenu [private]

Definition at line 36 of file MainWindow.cs.

MenuItem Sample::UI::MainWindow::helpMenu [private]

Definition at line 32 of file MainWindow.cs.

ComboBox Sample::UI::MainWindow::keyInfoBox [private]

Definition at line 50 of file MainWindow.cs.

Label Sample::UI::MainWindow::labelSign [private]

Definition at line 44 of file MainWindow.cs.

Label Sample::UI::MainWindow::labelVerify [private]

Definition at line 45 of file MainWindow.cs.

MainMenu Sample::UI::MainWindow::mainMenu [private]

Definition at line 53 of file MainWindow.cs.

MenuItem Sample::UI::MainWindow::openFileMenu [private]

Definition at line 37 of file MainWindow.cs.

GroupBox Sample::UI::MainWindow::signGroupBox [private]

Definition at line 51 of file MainWindow.cs.

StatusBar Sample::UI::MainWindow::statusBar [private]

Definition at line 39 of file MainWindow.cs.

TextBox Sample::UI::MainWindow::textBoxSign [private]

Definition at line 41 of file MainWindow.cs.

TextBox Sample::UI::MainWindow::textBoxVerify [private]

Definition at line 42 of file MainWindow.cs.

The documentation for this class was generated from the following file:
  • Security/capicom/c_sharp/xmldsig/MainWindow.cs
Generated on Wed Nov 13 2024 16:58:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Sample::Win32 Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • Sample
  • Sample::Win32
Classes | Public Member Functions

Sample::Win32 Class Reference

List of all members.

Classes

struct | CERT_CHAIN_FIND_BY_ISSUER_PARA

Public Member Functions

static uint | CertFindChainInStore (uint hCertStore, uint dwCertEncodingType, uint dwFindFlags, uint dwFindType, ref CERT_CHAIN_FIND_BY_ISSUER_PARA pvFindData, uint pPrevChainContext)
static uint | CertOpenSystemStore (uint hProv, String szSubsystemProtocol)

Detailed Description

Definition at line 28 of file chainsh.cs.

Member Function Documentation

static uint Sample::Win32::CertFindChainInStore | ( | uint | hCertStore,
 |  | uint | dwCertEncodingType,
 |  | uint | dwFindFlags,
 |  | uint | dwFindType,
 |  | ref CERT_CHAIN_FIND_BY_ISSUER_PARA | pvFindData,
 |  | uint | pPrevChainContext
 | ) |  |
static uint Sample::Win32::CertOpenSystemStore | ( | uint | hProv,
 |  | String | szSubsystemProtocol
 | ) |  |
The documentation for this class was generated from the following file:
  • Security/capicom/c_sharp/chainsh/chainsh.cs
Generated on Wed Nov 13 2024 16:58:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Sample::Win32::CERT_CHAIN_FIND_BY_ISSUER_PARA Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • Sample
  • Sample::Win32
  • Sample::Win32::CERT_CHAIN_FIND_BY_ISSUER_PARA
Public Attributes

Sample::Win32::CERT_CHAIN_FIND_BY_ISSUER_PARA Struct Reference

List of all members.

Public Attributes

int | cbSize
uint | cIssuer
uint | dwAcquirePrivateKeyFlags
uint | dwKeySpec
uint | pdwIssuerChainIndex
uint | pdwIssuerElementIndex
uint | pfnFindCallback
String | pszUsageIdentifier
uint | pvFindArg
uint | rgIssuer

Detailed Description

Definition at line 47 of file chainsh.cs.

Member Data Documentation

int Sample::Win32::CERT_CHAIN_FIND_BY_ISSUER_PARA::cbSize

Definition at line 49 of file chainsh.cs.

uint Sample::Win32::CERT_CHAIN_FIND_BY_ISSUER_PARA::cIssuer

Definition at line 53 of file chainsh.cs.

uint Sample::Win32::CERT_CHAIN_FIND_BY_ISSUER_PARA::dwAcquirePrivateKeyFlags

Definition at line 52 of file chainsh.cs.

uint Sample::Win32::CERT_CHAIN_FIND_BY_ISSUER_PARA::dwKeySpec

Definition at line 51 of file chainsh.cs.

uint Sample::Win32::CERT_CHAIN_FIND_BY_ISSUER_PARA::pdwIssuerChainIndex

Definition at line 57 of file chainsh.cs.

uint Sample::Win32::CERT_CHAIN_FIND_BY_ISSUER_PARA::pdwIssuerElementIndex

Definition at line 58 of file chainsh.cs.

uint Sample::Win32::CERT_CHAIN_FIND_BY_ISSUER_PARA::pfnFindCallback

Definition at line 55 of file chainsh.cs.

String Sample::Win32::CERT_CHAIN_FIND_BY_ISSUER_PARA::pszUsageIdentifier

Definition at line 50 of file chainsh.cs.

uint Sample::Win32::CERT_CHAIN_FIND_BY_ISSUER_PARA::pvFindArg

Definition at line 56 of file chainsh.cs.

uint Sample::Win32::CERT_CHAIN_FIND_BY_ISSUER_PARA::rgIssuer

Definition at line 54 of file chainsh.cs.

The documentation for this struct was generated from the following file:
  • Security/capicom/c_sharp/chainsh/chainsh.cs
Generated on Wed Nov 13 2024 16:58:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SClassEntry Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

SClassEntry Struct Reference

#include "FiltReg.Hxx"

List of all members.

Public Attributes

WCHAR const * | pwszClassId
WCHAR const * | pwszClassIdDescription
WCHAR const * | pwszDescription
WCHAR const * | pwszExt
WCHAR const * | pwszShortName

Detailed Description

Definition at line 22 of file FiltReg.Hxx.

Member Data Documentation

WCHAR const * SClassEntry::pwszClassId

Definition at line 27 of file FiltReg.Hxx.

WCHAR const * SClassEntry::pwszClassIdDescription

Definition at line 28 of file FiltReg.Hxx.

WCHAR const * SClassEntry::pwszDescription

Definition at line 26 of file FiltReg.Hxx.

WCHAR const * SClassEntry::pwszExt

Definition at line 24 of file FiltReg.Hxx.

WCHAR const * SClassEntry::pwszShortName

Definition at line 25 of file FiltReg.Hxx.

The documentation for this struct was generated from the following files:
  • WinBase/Indexing/HtmlProp/FiltReg.Hxx
  • WinBase/Indexing/IFilter/FiltReg.Hxx
  • WinBase/Indexing/lrsample/filtreg.hxx
  • WinBase/Indexing/SmpFilt/FiltReg.Hxx
Generated on Wed Nov 13 2024 16:57:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SDKDimmerServiceLib::IUPnPService_DimmingService_SCPD Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SDKDimmerServiceLib
  • SDKDimmerServiceLib::IUPnPService_DimmingService_SCPD
Public Member Functions

SDKDimmerServiceLib::IUPnPService_DimmingService_SCPD Interface Reference

import "DimmerDevice.idl";

List of all members.

Public Member Functions

HRESULT | dimLevel ([out, retval] long *pdimLevel)
HRESULT | GetConfigDetails ([in, out] VARIANT_BOOL *ppowerVal,[in, out] long *pdLevel)
HRESULT | GetDimLevel ([in, out] long *pdLevel)
HRESULT | GetPowerValue ([in, out] VARIANT_BOOL *ppowerVall)
HRESULT | Power ([out, retval] VARIANT_BOOL *pPower)
HRESULT | PowerOff ()
HRESULT | PowerOn ()
HRESULT | SetDimLevel ([in] long dLevel)

Detailed Description

Definition at line 44 of file DimmerDevice.idl.

Member Function Documentation

HRESULT SDKDimmerServiceLib::IUPnPService_DimmingService_SCPD::dimLevel ( [out, retval] long * pdimLevel ) [get]
HRESULT SDKDimmerServiceLib::IUPnPService_DimmingService_SCPD::GetConfigDetails | ( | [in, out] VARIANT_BOOL * | ppowerVal,
 |  | [in, out] long * | pdLevel
 | ) |  |
HRESULT SDKDimmerServiceLib::IUPnPService_DimmingService_SCPD::GetDimLevel ( [in, out] long * pdLevel )
HRESULT SDKDimmerServiceLib::IUPnPService_DimmingService_SCPD::GetPowerValue ( [in, out] VARIANT_BOOL * ppowerVall )
HRESULT SDKDimmerServiceLib::IUPnPService_DimmingService_SCPD::Power ( [out, retval] VARIANT_BOOL * pPower ) [get]
HRESULT SDKDimmerServiceLib::IUPnPService_DimmingService_SCPD::PowerOff ( )
HRESULT SDKDimmerServiceLib::IUPnPService_DimmingService_SCPD::PowerOn ( )
HRESULT SDKDimmerServiceLib::IUPnPService_DimmingService_SCPD::SetDimLevel ( [in] long dLevel )
The documentation for this interface was generated from the following file:
  • NetDS/upnp/DCO_DimmerService/DimmerDevice.idl
Generated on Wed Nov 13 2024 16:58:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SDKDimmerServiceLib::UPNPSampleDimmerDevice Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SDKDimmerServiceLib
  • SDKDimmerServiceLib::UPNPSampleDimmerDevice

SDKDimmerServiceLib::UPNPSampleDimmerDevice Class Reference

import "DimmerDevice.idl";

Detailed Description

Definition at line 82 of file DimmerDevice.idl.

The documentation for this class was generated from the following file:
  • NetDS/upnp/DCO_DimmerService/DimmerDevice.idl
Generated on Wed Nov 13 2024 16:58:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SDKSAMPLEPLAYLISTPLUGINLib::SDKSamplePlaylistParser Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • SDKSAMPLEPLAYLISTPLUGINLib
  • SDKSAMPLEPLAYLISTPLUGINLib::SDKSamplePlaylistParser

SDKSAMPLEPLAYLISTPLUGINLib::SDKSamplePlaylistParser Class Reference

import "SDKSamplePlaylistPlugin.idl";

Detailed Description

Definition at line 43 of file SDKSamplePlaylistPlugin.idl.

The documentation for this class was generated from the following file:
  • Multimedia/WindowsMediaServices9/Playlist/SDKSamplePlaylistPlugin.idl
Generated on Wed Nov 13 2024 16:58:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: section Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

section Struct Reference

List of all members.

Public Attributes

BOOL bDiscard
SECTION correspond
LINE first
LINE last
int | leftbase
SECTION link
int | rightbase
int | state

Detailed Description

Definition at line 50 of file section.cpp.

Member Data Documentation

BOOL section::bDiscard

Definition at line 38 of file section.cpp.

SECTION section::correspond

Definition at line 41 of file section.cpp.

LINE section::first

Definition at line 35 of file section.cpp.

LINE section::last

Definition at line 36 of file section.cpp.

int section::leftbase

Definition at line 47 of file section.cpp.

SECTION section::link

Definition at line 40 of file section.cpp.

int section::rightbase

Definition at line 48 of file section.cpp.

int section::state

Definition at line 45 of file section.cpp.

The documentation for this struct was generated from the following file:
  • Begin/sdkdiff/section.cpp
Generated on Wed Nov 13 2024 16:57:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Serialization::SerializationForm Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • Serialization
  • Serialization::SerializationForm
Public Member Functions | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes

Serialization::SerializationForm Class Reference

List of all members.

Public Member Functions

SerializationForm ()

Protected Member Functions

override void | Dispose (bool disposing)

Private Member Functions

void | ExitMenu_Click (object sender, System.EventArgs e)
void | InitializeComponent ()
void | LoadISF (Stream s)
void | LoadXML (Stream s)
void | NewMenu_Click (object sender, System.EventArgs e)
void | OpenMenu_Click (object sender, System.EventArgs e)
void | SaveAsMenu_Click (object sender, System.EventArgs e)
void | SaveHTML (Stream s, String nameBase)
void | SaveISF (Stream s)
void | SaveXML (Stream s)

Static Private Member Functions

static void | Main ()

Private Attributes

System.ComponentModel.Container | components = null
System.Windows.Forms.MenuItem | ExitMenu
System.Windows.Forms.MenuItem | FileMenu
Guid | FirstName = new Guid ("{29B2E996-57B6-4fda-BFFD-F54DBA4C35F9}")
System.Windows.Forms.TextBox | FirstNameBox
System.Windows.Forms.Label | FirstNameLabel
InkCollector | ic
Guid | LastName = new Guid ("{8A448E7C-0F39-4cd9-BB52-71FDA3221674}")
System.Windows.Forms.TextBox | LastNameBox
System.Windows.Forms.Label | LastNameLabel
System.Windows.Forms.MainMenu | MenuBar
System.Windows.Forms.MenuItem | NewMenu
System.Windows.Forms.MenuItem | OpenMenu
System.Windows.Forms.MenuItem | SaveAsMenu
System.Windows.Forms.MenuItem | SeperatorMenu
System.Windows.Forms.GroupBox | Signature

Detailed Description

Definition at line 65 of file Serialization.cs.

Constructor & Destructor Documentation

Serialization::SerializationForm::SerializationForm ( ) [inline]

Definition at line 96 of file Serialization.cs.

    {
            #region Standard Template Code
      //
      // Required for Windows Form Designer support
      //
      InitializeComponent();

            #endregion

            // Create the InkCollector and attach it to the signature GroupBox
            ic = new InkCollector(Signature.Handle);
            ic.Enabled = true;
    }

Member Function Documentation

override void Serialization::SerializationForm::Dispose ( bool disposing ) [inline, protected]

Clean up any resources being used.

Windows Forms Designer template code

Definition at line 114 of file Serialization.cs.

    {
      if( disposing )
      {
        if (components != null)
        {
          components.Dispose();
        }
      }
      base.Dispose( disposing );
    }

void Serialization::SerializationForm::ExitMenu_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Definition at line 283 of file Serialization.cs.

    {
            ic.Enabled = false;
            this.Dispose();
    }

void Serialization::SerializationForm::InitializeComponent ( ) [inline, private]

Required method for Designer support - do not modify the contents of this method with the code editor.

Definition at line 132 of file Serialization.cs.

    {
            this.MenuBar = new System.Windows.Forms.MainMenu();
            this.FileMenu = new System.Windows.Forms.MenuItem();
            this.NewMenu = new System.Windows.Forms.MenuItem();
            this.OpenMenu = new System.Windows.Forms.MenuItem();
            this.SaveAsMenu = new System.Windows.Forms.MenuItem();
            this.SeperatorMenu = new System.Windows.Forms.MenuItem();
            this.ExitMenu = new System.Windows.Forms.MenuItem();
            this.Signature = new System.Windows.Forms.GroupBox();
            this.FirstNameBox = new System.Windows.Forms.TextBox();
            this.LastNameBox = new System.Windows.Forms.TextBox();
            this.FirstNameLabel = new System.Windows.Forms.Label();
            this.LastNameLabel = new System.Windows.Forms.Label();
            this.SuspendLayout();
            //
            // MenuBar
            //
            this.MenuBar.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                                this.FileMenu});
            //
            // FileMenu
            //
            this.FileMenu.Index = 0;
            this.FileMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                                this.NewMenu,
                                                                                this.OpenMenu,
                                                                                this.SaveAsMenu,
                                                                                this.SeperatorMenu,
                                                                                this.ExitMenu});
            this.FileMenu.Text = "&File";
            //
            // NewMenu
            //
            this.NewMenu.Index = 0;
            this.NewMenu.Shortcut = System.Windows.Forms.Shortcut.CtrlN;
            this.NewMenu.Text = "&New";
            this.NewMenu.Click += new System.EventHandler(this.NewMenu_Click);
            //
            // OpenMenu
            //
            this.OpenMenu.Index = 1;
            this.OpenMenu.Shortcut = System.Windows.Forms.Shortcut.CtrlO;
            this.OpenMenu.Text = "&Open...";
            this.OpenMenu.Click += new System.EventHandler(this.OpenMenu_Click);
            //
            // SaveAsMenu
            //
            this.SaveAsMenu.Index = 2;
            this.SaveAsMenu.Shortcut = System.Windows.Forms.Shortcut.CtrlS;
            this.SaveAsMenu.Text = "Save &As...";
            this.SaveAsMenu.Click += new System.EventHandler(this.SaveAsMenu_Click);
            //
            // SeperatorMenu
            //
            this.SeperatorMenu.Index = 3;
            this.SeperatorMenu.Text = "-";
            //
            // ExitMenu
            //
            this.ExitMenu.Index = 4;
            this.ExitMenu.Text = "E&xit";
            this.ExitMenu.Click += new System.EventHandler(this.ExitMenu_Click);
            //
            // Signature
            //
            this.Signature.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                | System.Windows.Forms.AnchorStyles.Left)
                | System.Windows.Forms.AnchorStyles.Right);
            this.Signature.Location = new System.Drawing.Point(8, 48);
            this.Signature.Name = "Signature";
            this.Signature.Size = new System.Drawing.Size(456, 67);
            this.Signature.TabIndex = 1;
            this.Signature.TabStop = false;
            this.Signature.Text = "Signature";
            //
            // FirstNameBox
            //
            this.FirstNameBox.Location = new System.Drawing.Point(8, 24);
            this.FirstNameBox.Name = "FirstNameBox";
            this.FirstNameBox.Size = new System.Drawing.Size(200, 20);
            this.FirstNameBox.TabIndex = 2;
            this.FirstNameBox.Text = "";
            //
            // LastNameBox
            //
            this.LastNameBox.Anchor = ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                | System.Windows.Forms.AnchorStyles.Right);
            this.LastNameBox.Location = new System.Drawing.Point(216, 24);
            this.LastNameBox.Name = "LastNameBox";
            this.LastNameBox.Size = new System.Drawing.Size(248, 20);
            this.LastNameBox.TabIndex = 3;
            this.LastNameBox.Text = "";
            //
            // FirstNameLabel
            //
            this.FirstNameLabel.Location = new System.Drawing.Point(8, 8);
            this.FirstNameLabel.Name = "FirstNameLabel";
            this.FirstNameLabel.Size = new System.Drawing.Size(100, 16);
            this.FirstNameLabel.TabIndex = 4;
            this.FirstNameLabel.Text = "First Name";
            //
            // LastNameLabel
            //
            this.LastNameLabel.Location = new System.Drawing.Point(216, 8);
            this.LastNameLabel.Name = "LastNameLabel";
            this.LastNameLabel.Size = new System.Drawing.Size(100, 16);
            this.LastNameLabel.TabIndex = 5;
            this.LastNameLabel.Text = "Last Name";
            //
            // SerializationForm
            //
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize = new System.Drawing.Size(472, 121);
            this.Controls.AddRange(new System.Windows.Forms.Control[] {
                                                                          this.LastNameLabel,
                                                                          this.FirstNameLabel,
                                                                          this.LastNameBox,
                                                                          this.FirstNameBox,
                                                                          this.Signature});
            this.Menu = this.MenuBar;
            this.Name = "SerializationForm";
            this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
            this.Text = "Ink Serialization Sample Application";
            this.ResumeLayout(false);

        }

void Serialization::SerializationForm::LoadISF ( Stream s ) [inline, private]

Definition at line 621 of file Serialization.cs.

    {
      Ink loadedInk = new Ink();
      byte[] isfBytes = new byte[s.Length];

      // read in the ISF
      s.Read(isfBytes, 0, (int) s.Length);

      // load the ink into a new ink object
      // once an ink object has been "dirtied" it can never load ink again
            loadedInk.Load(isfBytes);

      // temporarily disable the ink collector and swap ink objects
      ic.Enabled = false;
      ic.Ink = loadedInk;
      ic.Enabled = true;

      // Repaint the inkable region
      Signature.Invalidate();

            ExtendedProperties inkProperties = ic.Ink.ExtendedProperties;

      // Get the raw data out of this stroke's extended
      // properties list, using our previously defined
      // Guid as a key to the extended property we want.
            // Since the save method stored the first and last
            // name information as extended propertied, we can
            // remove this information now that the load is complete.
            if (inkProperties.DoesPropertyExist(FirstName))
            {
                FirstNameBox.Text = (String) inkProperties[FirstName].Data;
                inkProperties.Remove(FirstName);
            }
            else
            {
                FirstNameBox.Text = String.Empty;
            }

      if (inkProperties.DoesPropertyExist(LastName))
      {
        LastNameBox.Text = (String) inkProperties[LastName].Data;
                inkProperties.Remove(LastName);
      }
            else
            {
                LastNameBox.Text = String.Empty;
            }
    }

void Serialization::SerializationForm::LoadXML ( Stream s ) [inline, private]

Definition at line 672 of file Serialization.cs.

    {
      // This object will encode our byte data to a UTF8 string
      UTF8Encoding utf8 = new UTF8Encoding();

      XmlDocument xd = new XmlDocument();
      XmlNodeList nodes;
      Ink loadedInk = new Ink();

      // Load the XML data into an XMLDocument object
      xd.Load(s);

      // Get the data in the ink node
      nodes = xd.GetElementsByTagName("Ink");

      // load the ink into a new ink object
      // once an ink object has been "dirtied" it can never load ink again
            if (0 != nodes.Count)
            {
                loadedInk.Load(utf8.GetBytes(nodes[0].InnerXml));
            }

      // temporarily disable the ink collector and swap ink objects
      ic.Enabled = false;
      ic.Ink = loadedInk;
      ic.Enabled = true;

            // Repaint the inkable region
            Signature.Invalidate();

      // Get the data in the FirstName node
      nodes = xd.GetElementsByTagName("FirstName");
            if (0 != nodes.Count)
            {
                FirstNameBox.Text = nodes[0].InnerXml;
            }
            else
            {
                FirstNameBox.Text = String.Empty;
            }

      // Get the data in the LastName node
      nodes = xd.GetElementsByTagName("LastName");
            if (0 != nodes.Count)
            {
                LastNameBox.Text = nodes[0].InnerXml;
            }
            else
            {
                LastNameBox.Text = String.Empty;
            }
    }

static void Serialization::SerializationForm::Main ( ) [inline, static, private]

The main entry point for the application.

Definition at line 264 of file Serialization.cs.

    {
      Application.Run(new SerializationForm());
    }

void Serialization::SerializationForm::NewMenu_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Definition at line 271 of file Serialization.cs.

    {
      // Erase the ink
      ic.Ink.DeleteStrokes();
      Signature.Invalidate();

      // Clear the text boxes
      FirstNameBox.Text = "";
      LastNameBox.Text = "";
    }

void Serialization::SerializationForm::OpenMenu_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Create a stream which will be used to load data from the output file

Create the OpenFileDialog, which presents a standard Windows dialog to the user.

Set the filter to suggest our recommended extensions

If the dialog exits and the user didn't choose Cancel

Attempt to Open the file with read only permission

Definition at line 539 of file Serialization.cs.

    {
      /// Create a stream which will be used to load data from the output file
      Stream myStream = null;

      /// Create the OpenFileDialog, which presents a standard Windows
      /// dialog to the user.
      OpenFileDialog openDialog = new OpenFileDialog();

      /// Set the filter to suggest our recommended extensions
      openDialog.Filter =
        "All Known Files (*.isf; *.xml)|*.isf; *.xml|Ink Serialized Format files (*.isf)|*.isf|" +
        "XML files (*.xml)|*.xml|All Files (*.*)|*.*";

      /// If the dialog exits and the user didn't choose Cancel
      if(openDialog.ShowDialog() == DialogResult.OK)
      {
                try
                {
                    /// Attempt to Open the file with read only permission
                    myStream = openDialog.OpenFile();
                    if(myStream != null)
                    {
                        // Put the filename in a more canonical format
                        String filename = openDialog.FileName.ToLower();

                        // Get the extension of the file
                        String extension = filename.Substring(filename.LastIndexOf('.'));

                        // Use the extension to determine what form to save the data in
                        switch (extension)
                        {
                            case ".isf":
                                LoadISF(myStream);
                                break;

                            case ".xml":
                                LoadXML(myStream);
                                break;

                                // If unfamiliar with the extension, assume ISF, the most "native format"
                            default:
                                LoadISF(myStream);
                                break;
                        }
                    }
                    else
                    {
                        // Throw an exception if a null pointer is returned for the stream
                        throw new IOException();
                    }
                }
                catch (IOException /*ioe*/)
                {
                    MessageBox.Show ("File error");
                }
                catch
                {
                    // If the xml or the scanned form image file are not available,
                    // display an error and exit
                    MessageBox.Show("An error occured while loading ink from the specified file.\n"+
                        "Please verify that the file contains valid serialized ink and try again.",
                        "Serialization",
                        MessageBoxButtons.OK);
                }
                finally
                {
                    // Close the stream in the finally clause so it
                    // is always reached, regardless of whether an
                    // exception occurs.  LoadXML, LoadHTML, and
                    // LoadISF can throw, so this precaution is necessary.
                    if (null != myStream)
                    {
                        myStream.Close();
                    }
                }
      }
    }

void Serialization::SerializationForm::SaveAsMenu_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Create a stream which will be used to save data to the output file

Create the SaveFileDialog, which presents a standard Windows Save dialog to the user.

Set the filter to suggest our recommended extensions

If the dialog exits and the user didn't choose Cancel

Attempt to Open the file with read/write permission

The two HTML cases require a filename for saving associated images

If unfamiliar with the extension, use ISF, the most "native format"

Definition at line 294 of file Serialization.cs.

    {
      /// Create a stream which will be used to save data to the output file
      Stream myStream = null;

      /// Create the SaveFileDialog, which presents a standard Windows
      /// Save dialog to the user.
      SaveFileDialog saveDialog = new SaveFileDialog();

      /// Set the filter to suggest our recommended extensions
      saveDialog.Filter =
        "Ink Serialized Format files (*.isf)|*.isf|XML files (*.xml)|*.xml|" +
        "HTML files (*.htm)|*.htm";

      /// If the dialog exits and the user didn't choose Cancel
      if(saveDialog.ShowDialog() == DialogResult.OK)
      {
                try
                {
                    /// Attempt to Open the file with read/write permission
                    myStream = saveDialog.OpenFile();
                    if(myStream != null)
                    {
                        // Put the filename in a more canonical format
                        String filename = saveDialog.FileName.ToLower();

                        // Get a version of the filename without an extension
                        // This will be used for saving the associated image
                        String extensionlessFilename = Path.GetFileNameWithoutExtension(filename);

                        // Get the extension of the file
                        String extension = Path.GetExtension(filename);

                        // Use the extension to determine what form to save the data in
                        switch (extension)
                        {
                            case ".xml":
                                SaveXML(myStream);
                                break;

                                /// The two HTML cases require a filename for saving associated images
                            case ".htm": case ".html":
                                SaveHTML(myStream, extensionlessFilename);
                                break;

                                /// If unfamiliar with the extension, use ISF, the most "native format"
                            case ".isf": default:
                                SaveISF(myStream);
                                break;
                        }
                    }
                    else
                    {
                        // Throw an exception if a null pointer is returned for the stream
                        throw new IOException();
                    }
                }
                catch (IOException /*ioe*/)
                {
                    MessageBox.Show ("File error");
                }
                finally
                {
                    // Close the stream in the finally clause so it
                    // is always reached, regardless of whether an
                    // exception occurs.  SaveXML, SaveHTML, and
                    // SaveISF can throw, so this precaution is necessary.
                    if (null != myStream)
                    {
                        myStream.Close();
                    }
                }
      } // End if user chose OK from dialog
    }

void Serialization::SerializationForm::SaveHTML | ( | Stream | s,
 |  | String | nameBase |
 | ) |  |  | [inline, private]

Definition at line 472 of file Serialization.cs.

    {

            // It is not possible to save an empty .gif, so it
            // is first necessary to ensure that the ink has a bounding
            // box (i.e. the ink is not empty).  The bounding box is
            // used for this check instead of checking whether the stroke
            // count is zero, since the ink could still be empty if the
            // strokes don't contain any points.
            if (ic.Ink.Strokes.GetBoundingBox().IsEmpty)
            {
                MessageBox.Show("Unable to save empty ink in HTML persistence format.");
            }
            else
            {

                FileStream gifFile;
                byte[] fortifiedGif = null;
                String html;
                byte[] htmlBytes;

                // This object will encode our byte data to a UTF8 string
                UTF8Encoding utf8 = new UTF8Encoding();

                // Create a directory to store the fortified GIF which also contains ISF
                // and open the file for writing
                Directory.CreateDirectory(nameBase + "_files");
                gifFile = File.OpenWrite(nameBase + "_files\\signature.gif");

                // Generate the fortified GIF represenation of the ink
                fortifiedGif = ic.Ink.Save(PersistenceFormat.Gif);

                // Write and close the gif file
                gifFile.Write(fortifiedGif, 0, fortifiedGif.Length);
                gifFile.Close();

                // Create the HTML output
                // Note that the names are stored in HTML tags, rather
                // than custom properties, so that these properties can
                // be easily retrieved from the HTML.
                html =
                    "<HTML><HEAD></HEAD><BODY>" +

                    "<P>First Name: " +
                    FirstNameBox.Text +
                    " &nbsp;&nbsp;&nbsp;Last Name: " +
                    LastNameBox.Text +
                    "</P>" +

                    "<P><IMG src='" +
                    nameBase + "_files\\signature.gif" +
                    "' /></P>" +

                    "</BODY></HTML>";

                // Convert the HTML to a byte array for writing to the stream
                htmlBytes = utf8.GetBytes(html);

                // Write the HTML to the stream
                s.Write(htmlBytes, 0, htmlBytes.Length);
            }
    }

void Serialization::SerializationForm::SaveISF ( Stream s ) [inline, private]

Definition at line 374 of file Serialization.cs.

    {
      byte[] isf;

      // This is the ink object which will be serialized
      ExtendedProperties inkProperties = ic.Ink.ExtendedProperties;

      // Store the name fields in the ink object
      // These fields will roundtrip through the ISF format
            // Ignore empty fields since strictly empty strings
            //       cannot be stored in ExtendedProperties.
            if (FirstNameBox.Text.Length > 0)
            {
                inkProperties.Add(FirstName, FirstNameBox.Text);
            }
            if (LastNameBox.Text.Length > 0)
            {
                inkProperties.Add(LastName, LastNameBox.Text);
            }

      // Perform the serialization
      isf = ic.Ink.Save(PersistenceFormat.InkSerializedFormat);

            // If the first and last names were added as extended
            // properties to the ink, remove them - these properties
            // are only used for the save and there is no need to
            // keep them around on the ink object.
            if (inkProperties.DoesPropertyExist(FirstName))
            {
                inkProperties.Remove(FirstName);
            }
            if (inkProperties.DoesPropertyExist(LastName))
            {
                inkProperties.Remove(LastName);
            }

      // Write the ISF to the stream
      s.Write(isf,0,isf.Length);
    }

void Serialization::SerializationForm::SaveXML ( Stream s ) [inline, private]

Definition at line 419 of file Serialization.cs.

    {
      // This object will encode our byte data to a UTF8 string
      UTF8Encoding utf8 = new UTF8Encoding();

      byte[] base64ISF_bytes;
      string base64ISF_string;

      // Create a new XmlTextWriter.
      XmlTextWriter xwriter = new XmlTextWriter(s, System.Text.Encoding.UTF8);

      // Write the beginning of the document including the
      // document declaration.
      xwriter.WriteStartDocument();

      // Write the beginning of the "data" element. This is
      // the opening tag to our data
      xwriter.WriteStartElement("SerializationSampleData");

      // Get the base64 encoded ISF
      base64ISF_bytes = ic.Ink.Save(PersistenceFormat.Base64InkSerializedFormat);

      // Convert it to a String
      base64ISF_string = utf8.GetString(base64ISF_bytes);

      // Write the ISF containing node to the XML
      xwriter.WriteElementString("Ink", base64ISF_string);

      // Write the text date from the form
            // Note that the names are stored as XML fields, rather
            // than custom properties, so that these properties can
            // be most easily accessible if the XML is saved in a database.
      xwriter.WriteElementString("FirstName",FirstNameBox.Text);
      xwriter.WriteElementString("LastName",LastNameBox.Text);

      //End the "data" element.
      xwriter.WriteEndElement();

      //End the document
      xwriter.WriteEndDocument();

      //Close the xml document.
            xwriter.Close();
    }

Member Data Documentation

System.ComponentModel.Container Serialization::SerializationForm::components = null [private]

Required designer variable.

Definition at line 70 of file Serialization.cs.

System.Windows.Forms.MenuItem Serialization::SerializationForm::ExitMenu [private]

Definition at line 78 of file Serialization.cs.

System.Windows.Forms.MenuItem Serialization::SerializationForm::FileMenu [private]

Definition at line 73 of file Serialization.cs.

Guid Serialization::SerializationForm::FirstName = new Guid ("{29B2E996-57B6-4fda-BFFD-F54DBA4C35F9}") [private]

Definition at line 92 of file Serialization.cs.

System.Windows.Forms.TextBox Serialization::SerializationForm::FirstNameBox [private]

Definition at line 81 of file Serialization.cs.

System.Windows.Forms.Label Serialization::SerializationForm::FirstNameLabel [private]

Definition at line 84 of file Serialization.cs.

InkCollector Serialization::SerializationForm::ic [private]

Definition at line 89 of file Serialization.cs.

Guid Serialization::SerializationForm::LastName = new Guid ("{8A448E7C-0F39-4cd9-BB52-71FDA3221674}") [private]

Definition at line 93 of file Serialization.cs.

System.Windows.Forms.TextBox Serialization::SerializationForm::LastNameBox [private]

Definition at line 82 of file Serialization.cs.

System.Windows.Forms.Label Serialization::SerializationForm::LastNameLabel [private]

Definition at line 85 of file Serialization.cs.

System.Windows.Forms.MainMenu Serialization::SerializationForm::MenuBar [private]

Definition at line 72 of file Serialization.cs.

System.Windows.Forms.MenuItem Serialization::SerializationForm::NewMenu [private]

Definition at line 74 of file Serialization.cs.

System.Windows.Forms.MenuItem Serialization::SerializationForm::OpenMenu [private]

Definition at line 75 of file Serialization.cs.

System.Windows.Forms.MenuItem Serialization::SerializationForm::SaveAsMenu [private]

Definition at line 76 of file Serialization.cs.

System.Windows.Forms.MenuItem Serialization::SerializationForm::SeperatorMenu [private]

Definition at line 77 of file Serialization.cs.

System.Windows.Forms.GroupBox Serialization::SerializationForm::Signature [private]

Definition at line 80 of file Serialization.cs.

The documentation for this class was generated from the following file:
  • TabletPC/Serialization/Serialization.cs
Generated on Wed Nov 13 2024 16:58:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SESSION_DATA Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

SESSION_DATA Struct Reference

List of all members.

Public Attributes

BSTR | bstrName
BSTR | bstrURI
BOOL fAccept

Detailed Description

Definition at line 596 of file rtcdialogs.cpp.

Member Data Documentation

BSTR SESSION_DATA::bstrName

Definition at line 598 of file rtcdialogs.cpp.

BSTR SESSION_DATA::bstrURI

Definition at line 599 of file rtcdialogs.cpp.

BOOL SESSION_DATA::fAccept

Definition at line 600 of file rtcdialogs.cpp.

The documentation for this struct was generated from the following file:
  • NetDS/rtc/Client/CPP/rtcsample/rtcdialogs.cpp
Generated on Wed Nov 13 2024 16:57:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SFilterEntry Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

SFilterEntry Struct Reference

#include "FiltReg.Hxx"

List of all members.

Public Attributes

WCHAR const * | pwszClassId
WCHAR const * | pwszClassIdDescription
WCHAR const * | pwszDLL
WCHAR const * | pwszThreadingModel

Detailed Description

Definition at line 46 of file FiltReg.Hxx.

Member Data Documentation

WCHAR const * SFilterEntry::pwszClassId

Definition at line 48 of file FiltReg.Hxx.

WCHAR const * SFilterEntry::pwszClassIdDescription

Definition at line 49 of file FiltReg.Hxx.

WCHAR const * SFilterEntry::pwszDLL

Definition at line 50 of file FiltReg.Hxx.

WCHAR const * SFilterEntry::pwszThreadingModel

Definition at line 51 of file FiltReg.Hxx.

The documentation for this struct was generated from the following files:
  • WinBase/Indexing/HtmlProp/FiltReg.Hxx
  • WinBase/Indexing/IFilter/FiltReg.Hxx
  • WinBase/Indexing/lrsample/filtreg.hxx
  • WinBase/Indexing/SmpFilt/FiltReg.Hxx
Generated on Wed Nov 13 2024 16:57:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SHandlerEntry Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

SHandlerEntry Struct Reference

#include "FiltReg.Hxx"

List of all members.

Public Attributes

WCHAR const * | pwszClassId
WCHAR const * | pwszClassIdDescription
WCHAR const * | pwszClassIdFilter

Detailed Description

Definition at line 35 of file FiltReg.Hxx.

Member Data Documentation

WCHAR const * SHandlerEntry::pwszClassId

Definition at line 37 of file FiltReg.Hxx.

WCHAR const * SHandlerEntry::pwszClassIdDescription

Definition at line 38 of file FiltReg.Hxx.

WCHAR const * SHandlerEntry::pwszClassIdFilter

Definition at line 39 of file FiltReg.Hxx.

The documentation for this struct was generated from the following files:
  • WinBase/Indexing/HtmlProp/FiltReg.Hxx
  • WinBase/Indexing/IFilter/FiltReg.Hxx
  • WinBase/Indexing/lrsample/filtreg.hxx
  • WinBase/Indexing/SmpFilt/FiltReg.Hxx
Generated on Wed Nov 13 2024 16:57:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SIMPLE_BROWSER Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes | Friends

SIMPLE_BROWSER Class Reference

#include "browser.h"

List of all members.

Public Member Functions

SIMPLE_BROWSER (UINT nID)
~SIMPLE_BROWSER ()
VOID | Close (VOID)
BOOL Open (P_BROWSER_CONFIG)

Private Member Functions

VOID | OnRequesterClosed (ASYNC_REQUESTER *)
VOID | OnRequesterStopped (ASYNC_REQUESTER *)

Private Attributes

LIST_ENTRY | m_EmbeddedLinks
BOOL m_fShutdownInProgress
HINTERNET | m_hSession
HANDLE m_hShutdownEvent
CRITICAL_SECTION | m_LinksCritSec
UINT m_nID
UINT m_nRequesterIDSeed
P_BROWSER_CONFIG m_pBrowserConfig
ASYNC_REQUESTER * m_pHomePageRequester

Friends

class | ASYNC_REQUESTER

Detailed Description

Definition at line 19 of file browser.h.

Constructor & Destructor Documentation

SIMPLE_BROWSER::SIMPLE_BROWSER ( UINT nID )

Definition at line 15 of file browser.cpp.

{
    m_nID = nID + 1;
    m_hSession = NULL;

    m_hShutdownEvent = NULL;
    m_fShutdownInProgress = FALSE;

    m_pBrowserConfig = NULL;
    m_pHomePageRequester = NULL;

    m_nRequesterIDSeed = m_nID * 10; // for example, if the browser is 1, then the
                                     // embedded links are numbered 10, 11, 12, and etc.
}

SIMPLE_BROWSER::~SIMPLE_BROWSER ( )

Definition at line 30 of file browser.cpp.

{
}

Member Function Documentation

VOID SIMPLE_BROWSER::Close ( VOID )

Definition at line 212 of file browser.cpp.

{
    m_fShutdownInProgress = TRUE;

    BOOL fNeedToWait = FALSE;

    ::EnterCriticalSection(&m_LinksCritSec);

    if (m_pHomePageRequester)
    {
        if (m_pHomePageRequester->m_State != ASYNC_REQUESTER::CLOSED)
        {
            m_pHomePageRequester->RequestToShutdown();
            fNeedToWait = TRUE;
        }
    }

    for (PLIST_ENTRY entry = (&m_EmbeddedLinks)->Flink;
            entry != (PLIST_ENTRY)&((&m_EmbeddedLinks)->Flink);
            entry = entry->Flink)
    {
        ASYNC_REQUESTER* pRequester = (ASYNC_REQUESTER*)entry;

        if (pRequester->m_State != ASYNC_REQUESTER::CLOSED)
        {
            pRequester->RequestToShutdown();
            fNeedToWait = TRUE;
        }
    }

    ::LeaveCriticalSection(&m_LinksCritSec);

    if (fNeedToWait)
    {
        fprintf(stdout,
               "Browser #%d waiting for all requesters to exit...\n",
                m_nID);

        if (::WaitForSingleObject(m_hShutdownEvent, /*60000*/INFINITE) == WAIT_TIMEOUT)
        {
            fprintf(stderr,
                "...and Browser #%d timed out waiting all requesters to exit... exit anyway...\n",
                    m_nID);
        }
        else
        {
            fprintf(stdout,
                "...and Browser #%d is notified that all requesters are exited...\n",
                    m_nID);
        }

    }

    while (!IsListEmpty(&m_EmbeddedLinks))
    {
        PLIST_ENTRY pEntry = RemoveHeadList(&m_EmbeddedLinks);
        ASYNC_REQUESTER* pRequester = (ASYNC_REQUESTER*)pEntry;

        delete pRequester;
    }

    if (m_hSession)
    {
        ::WinHttpCloseHandle(m_hSession);
        m_hSession = NULL;
    }
    if (m_hShutdownEvent)
    {
        ::CloseHandle(m_hShutdownEvent);
        m_hShutdownEvent = NULL;
    }
    ::DeleteCriticalSection(&m_LinksCritSec);
}

VOID SIMPLE_BROWSER::OnRequesterClosed ( ASYNC_REQUESTER * pRequester ) [private]

Definition at line 385 of file browser.cpp.

{
    ::EnterCriticalSection(&m_LinksCritSec);

    if (m_fShutdownInProgress)
    {
        BOOL fAllClosed = TRUE;
        if (m_pHomePageRequester && m_pHomePageRequester->m_State != ASYNC_REQUESTER::CLOSED)
        {
            fAllClosed = FALSE;
        }

        for (PLIST_ENTRY entry = (&m_EmbeddedLinks)->Flink;
                entry != (PLIST_ENTRY)&((&m_EmbeddedLinks)->Flink);
                entry = entry->Flink)
        {
            ASYNC_REQUESTER* pRequesterNew = (ASYNC_REQUESTER*)entry;
            if (pRequesterNew->m_State != ASYNC_REQUESTER::CLOSED)
            {
                fAllClosed = FALSE;
            }
        }

        if (fAllClosed)
        {
            ::SetEvent(m_hShutdownEvent);
        }
    }

    ::LeaveCriticalSection(&m_LinksCritSec);
}

VOID SIMPLE_BROWSER::OnRequesterStopped ( ASYNC_REQUESTER * pRequester ) [private]

Definition at line 287 of file browser.cpp.

{
    ASSERT(pRequester != NULL);

    //if (m_fShutdownInProgress  &&
    //    pRequester->m_State != ASYNC_REQUESTER::CLOSING)
    //{
    //    return;
    //}

    ::EnterCriticalSection(&m_LinksCritSec);

    if (pRequester == m_pHomePageRequester)
    {
        if (pRequester->m_State == ASYNC_REQUESTER::DATA_EXHAUSTED)
        {
            fprintf(stdout,
                    "Browser #%d fetched its Home Page, now it attempts to download all embedded lnks.\n",
                    m_nID);

            for (PLIST_ENTRY entry = (&m_EmbeddedLinks)->Flink;
                    entry != (PLIST_ENTRY)&((&m_EmbeddedLinks)->Flink);
                    entry = entry->Flink)
            {
                ASYNC_REQUESTER* pRequesterNew = (ASYNC_REQUESTER*)entry;
                if (pRequesterNew->Start() == FALSE)
                {
                    fprintf(stderr,
                        "Browser #%d failed to start a new requester.\n",
                            m_nID);
                }
            }

            // now we can close the home page request
            pRequester->Close();

            goto exit;
        }
    }

    BOOL fClosingRequest = TRUE;

    if (pRequester->m_State == ASYNC_REQUESTER::CLOSING)
    {
        pRequester->Close();    // a live download has been aborted, now close it.
    }
    else if (pRequester->m_State == ASYNC_REQUESTER::ERROR)
    {
        if (m_pBrowserConfig->nFailureRetries)
        {
            switch(pRequester->m_dwLastError)
            {
                case ERROR_WINHTTP_CANNOT_CONNECT:
                case ERROR_WINHTTP_TIMEOUT:
                case ERROR_NOT_ENOUGH_MEMORY:
                case ERROR_WINHTTP_INTERNAL_ERROR:
                case ERROR_WINHTTP_NAME_NOT_RESOLVED:

                    if (pRequester->Start() == FALSE)
                    {
                        pRequester->Close(); // retry upon certain errors
                    }
                    else
                    {
                        fClosingRequest = FALSE;
                    }
                    break;

                default:
                    pRequester->Close();
            }
        }
        else  // close the request since we don't need to retry
        {
            pRequester->Close();
        }
    }
    else // close the request if some other state is hit
    {
        pRequester->Close();
    }

    // the main page is interrupted, so we'll need to close all embedded links
    if (pRequester == m_pHomePageRequester && fClosingRequest)
    {
        for (PLIST_ENTRY entry = (&m_EmbeddedLinks)->Flink;
                entry != (PLIST_ENTRY)&((&m_EmbeddedLinks)->Flink);
                entry = entry->Flink)
        {
            ASYNC_REQUESTER* pRequesterToC = (ASYNC_REQUESTER*)entry;
            pRequesterToC->Close();
        }
    }

exit:
    ::LeaveCriticalSection(&m_LinksCritSec);
}

BOOL SIMPLE_BROWSER::Open ( P_BROWSER_CONFIG pBrowserConfig )

Definition at line 34 of file browser.cpp.

{
    ASSERT(pBrowserConfig != NULL);

    m_pBrowserConfig = pBrowserConfig;

    InitializeListHead(&m_EmbeddedLinks);

    ::InitializeCriticalSection(&m_LinksCritSec);

    PWSTR pwszEmbeddedLinks = NULL;

    fprintf(stdout,
            "Browser #%d is initializing...\n",
            m_nID);

    m_hShutdownEvent = ::CreateEvent(NULL,
                                     TRUE,  // manual reset
                                     FALSE, // not initially set
                                     NULL);

    if (m_hShutdownEvent == NULL)
    {
        fprintf(stderr,
               "Browser #%d failed to open; CreateEvent() failed; error = %d.\n",
                m_nID,
                ::GetLastError());

        goto error_cleanup;
    }

    DWORD dwAccessType = pBrowserConfig->fProxyAutoDiscovery ?
                         WINHTTP_ACCESS_TYPE_NO_PROXY :
                         WINHTTP_ACCESS_TYPE_DEFAULT_PROXY;

    m_hSession = ::WinHttpOpen(L"Microsoft-Windows-HTTP-Services-Async-Sample/1.0",
                               dwAccessType,
                               WINHTTP_NO_PROXY_NAME,
                               WINHTTP_NO_PROXY_BYPASS,
                               WINHTTP_FLAG_ASYNC);
    if (m_hSession == NULL)
    {
        fprintf(stderr,
               "Browser #%d failed to open; WinHttpOpen() failed; error = %d.\n",
                m_nID,
                ::GetLastError());

        goto error_cleanup;
    }

    m_pHomePageRequester = new ASYNC_REQUESTER(m_nRequesterIDSeed++, this);
    if (m_pHomePageRequester == NULL)
    {
        fprintf(stderr,
               "Browser #%d failed to open; not enough memory.\n",
                m_nID);

        goto error_cleanup;
    }

    if (m_pHomePageRequester->Open(pBrowserConfig->pwszHomePage,
                                 pBrowserConfig->fProxyAutoDiscovery,
                                 pBrowserConfig->fEnableProxyFailover,
                                 pBrowserConfig->nFailureRetries,
                                 pBrowserConfig->nTimeLimit) == FALSE)
    {
        fprintf(stderr,
               "Browser #%d failed to open; can not initialize a requester.\n",
                m_nID);

        goto error_cleanup;
    }

    pwszEmbeddedLinks = new WCHAR[::wcslen(m_pBrowserConfig->pwszEmbeddedLinks) + 1];
    if (pwszEmbeddedLinks == NULL)
    {
        fprintf(stderr,
               "Browser #%d failed to open; not enough memory.\n",
                m_nID);

        goto error_cleanup;
    }

    ::wcscpy(pwszEmbeddedLinks, m_pBrowserConfig->pwszEmbeddedLinks);

    PWSTR pwszLink = ::wcstok(pwszEmbeddedLinks, L";");
    while (pwszLink != NULL)
    {
        fprintf(stdout,
                "Browser #%d is initializing link %S...\n",
                m_nID,
                pwszLink);

        ASYNC_REQUESTER* pNewRequester = new ASYNC_REQUESTER(m_nRequesterIDSeed++, this);
        if (pNewRequester == NULL)
        {
            fprintf(stderr,
                    "Browser #%d failed to create a new request; not enough memory.\n",
                    m_nID);

            goto next_link;
        }

        if (pNewRequester->Open(pwszLink,
                                m_pBrowserConfig->fProxyAutoDiscovery,
                                m_pBrowserConfig->fEnableProxyFailover,
                                m_pBrowserConfig->nFailureRetries,
                                m_pBrowserConfig->nTimeLimit) == FALSE)
        {
            fprintf(stderr,
                "Browser #%d failed to initialize a new requester.\n",
                    m_nID);

            goto next_link;
        }

        InsertHeadList(&m_EmbeddedLinks, (PLIST_ENTRY)pNewRequester);
        pNewRequester = NULL;

    next_link:

        if (pNewRequester)
        {
            if (m_pHomePageRequester->m_State == ASYNC_REQUESTER::OPENED)
            {
                m_pHomePageRequester->Close();
            }

            delete pNewRequester;
        }

        pwszLink = ::wcstok(NULL, L";");
    }

    delete [] pwszEmbeddedLinks;
    pwszEmbeddedLinks = NULL;

    if (m_pHomePageRequester->Start() == FALSE)
    {
        fprintf(stderr,
               "Browser #%d failed to open; can not start a requester.\n",
                m_nID);

        goto error_cleanup;
    }

    return TRUE;

error_cleanup:

    if (m_pHomePageRequester)
    {
        if (m_pHomePageRequester->m_State == ASYNC_REQUESTER::OPENED)
        {
            m_pHomePageRequester->Close();
        }
        delete m_pHomePageRequester;
        m_pHomePageRequester = NULL;
    }
    if (m_hSession)
    {
        ::WinHttpCloseHandle(m_hSession);
        m_hSession = NULL;
    }
    if (m_hShutdownEvent)
    {
        ::CloseHandle(m_hShutdownEvent);
        m_hShutdownEvent = NULL;
    }
    if (pwszEmbeddedLinks)
    {
        delete [] pwszEmbeddedLinks;
    }
    ::DeleteCriticalSection(&m_LinksCritSec);

    return FALSE;
}

Friends And Related Function Documentation

friend class ASYNC_REQUESTER [friend]

Definition at line 48 of file browser.h.

Member Data Documentation

LIST_ENTRY SIMPLE_BROWSER::m_EmbeddedLinks [private]

Definition at line 40 of file browser.h.

BOOL SIMPLE_BROWSER::m_fShutdownInProgress [private]

Definition at line 44 of file browser.h.

HINTERNET SIMPLE_BROWSER::m_hSession [private]

Definition at line 35 of file browser.h.

HANDLE SIMPLE_BROWSER::m_hShutdownEvent [private]

Definition at line 43 of file browser.h.

CRITICAL_SECTION SIMPLE_BROWSER::m_LinksCritSec [private]

Definition at line 41 of file browser.h.

UINT SIMPLE_BROWSER::m_nID [private]

Definition at line 34 of file browser.h.

UINT SIMPLE_BROWSER::m_nRequesterIDSeed [private]

Definition at line 46 of file browser.h.

P_BROWSER_CONFIG SIMPLE_BROWSER::m_pBrowserConfig [private]

Definition at line 37 of file browser.h.

ASYNC_REQUESTER* SIMPLE_BROWSER::m_pHomePageRequester [private]

Definition at line 38 of file browser.h.

The documentation for this class was generated from the following files:
  • Web/winhttp/WinHttpAsyncSample/browser.h
  • Web/winhttp/WinHttpAsyncSample/browser.cpp
Generated on Wed Nov 13 2024 16:57:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SIndexedDisk Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

SIndexedDisk Struct Reference

#include "SIndexedDisk.h"

List of all members.

Public Member Functions

SIndexedDisk (void)
HRESULT | HrInit (IUnknown *punkDiskIn)

Public Attributes

DWORD idxDisk
IUnknown * | punkDisk

Detailed Description

Definition at line 43 of file SIndexedDisk.h.

Constructor & Destructor Documentation

SIndexedDisk::SIndexedDisk ( void ) [inline]

Definition at line 56 of file SIndexedDisk.h.

    : idxDisk( 0 )
    , punkDisk( NULL )
{
} //*** SIndexedDisk::SIndexedDisk

Member Function Documentation

HRESULT SIndexedDisk::HrInit ( IUnknown * punkDiskIn )

Definition at line 54 of file SIndexedDisk.cpp.

{
    HRESULT                 hr = S_OK;
    IStorageProperties *    pisdp = NULL;

    if ( punkDiskIn == NULL )
    {
        hr = E_POINTER;
        goto Cleanup;
    }

    //
    // QI for IStorageProperties.
    //

    hr = punkDiskIn->TypeSafeQI( IStorageProperties, &pisdp );

    if ( FAILED( hr ) )
    {
        goto Cleanup;
    }

    //
    // Get index from IStorageProperties.
    //

    hr = pisdp->HrGetDeviceIndex( &idxDisk );

    if ( FAILED( hr ) )
    {
        goto Cleanup;
    }

    punkDisk = punkDiskIn;

Cleanup:

    if ( pisdp != NULL )
    {
        pisdp->Release();
    }

    return hr;

} //*** SIndexedDisk::HrInit

Member Data Documentation

DWORD SIndexedDisk::idxDisk

Definition at line 48 of file SIndexedDisk.h.

IUnknown* SIndexedDisk::punkDisk

Definition at line 49 of file SIndexedDisk.h.

The documentation for this struct was generated from the following files:
  • WinBase/Cluster/Win2003/MyStorageResource/SIndexedDisk.h
  • WinBase/Cluster/Win2003/MyStorageResource/SIndexedDisk.cpp
Generated on Wed Nov 13 2024 16:57:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SIndexedDiskLessThan Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

SIndexedDiskLessThan Struct Reference

#include "SIndexedDisk.h"

List of all members.

Public Member Functions

bool operator() (const SIndexedDisk &rLeftIn, const SIndexedDisk &rRightIn) const

Detailed Description

Definition at line 79 of file SIndexedDisk.h.

Member Function Documentation

bool SIndexedDiskLessThan::operator() | ( | const SIndexedDisk & | rLeftIn,
 |  | const SIndexedDisk & | rRightIn |
 | ) |  |  | const [inline]

Definition at line 81 of file SIndexedDisk.h.

    {
        return ( rLeftIn.idxDisk < rRightIn.idxDisk );
    }

The documentation for this struct was generated from the following file:
  • WinBase/Cluster/Win2003/MyStorageResource/SIndexedDisk.h
Generated on Wed Nov 13 2024 16:57:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SInfo Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

SInfo Struct Reference

List of all members.

Public Attributes

WCHAR | wchName [256]
WCHAR | wchVersion [256]

Detailed Description

Definition at line 65 of file TPCInfo.cpp.

Member Data Documentation

WCHAR SInfo::wchName[256]

Definition at line 67 of file TPCInfo.cpp.

WCHAR SInfo::wchVersion[256]

Definition at line 68 of file TPCInfo.cpp.

The documentation for this struct was generated from the following file:
  • TabletPC/TPCInfo/TPCInfo.cpp
Generated on Wed Nov 13 2024 16:57:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SLangClassEntry Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

SLangClassEntry Struct Reference

#include "langreg.hxx"

List of all members.

Public Attributes

WCHAR const * | pwszClassId
WCHAR const * | pwszClassIdDescription
WCHAR const * | pwszDLL
WCHAR const * | pwszThreadingModel

Detailed Description

Definition at line 24 of file langreg.hxx.

Member Data Documentation

WCHAR const* SLangClassEntry::pwszClassId

Definition at line 26 of file langreg.hxx.

WCHAR const* SLangClassEntry::pwszClassIdDescription

Definition at line 27 of file langreg.hxx.

WCHAR const* SLangClassEntry::pwszDLL

Definition at line 28 of file langreg.hxx.

WCHAR const* SLangClassEntry::pwszThreadingModel

Definition at line 29 of file langreg.hxx.

The documentation for this struct was generated from the following file:
  • WinBase/Indexing/lrsample/langreg.hxx
Generated on Wed Nov 13 2024 16:57:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SLangRegistry Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

SLangRegistry Struct Reference

#include "langreg.hxx"

List of all members.

Public Attributes

LONG | lcid
WCHAR const * | pwszLangName
SLangClassEntry Stemmer
SLangClassEntry WordBreaker

Detailed Description

Definition at line 32 of file langreg.hxx.

Member Data Documentation

LONG SLangRegistry::lcid

Definition at line 35 of file langreg.hxx.

WCHAR const* SLangRegistry::pwszLangName

Definition at line 34 of file langreg.hxx.

SLangClassEntry SLangRegistry::Stemmer

Definition at line 37 of file langreg.hxx.

SLangClassEntry SLangRegistry::WordBreaker

Definition at line 36 of file langreg.hxx.

The documentation for this struct was generated from the following file:
  • WinBase/Indexing/lrsample/langreg.hxx
Generated on Wed Nov 13 2024 16:57:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SmartRefPointer< T > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Member Functions | Private Attributes

SmartRefPointer< T > Class Template Reference

List of all members.

Public Member Functions

SmartRefPointer ()
SmartRefPointer (T *RawInterface)
SmartRefPointer (SmartRefPointer &Other)
~SmartRefPointer ()
void | Clear ()
T * | Get () const
T ** | GetRecvPointer ()
operator const T * () const
T * | operator-> () const
SmartRefPointer & | operator= (SmartRefPointer &Other)
T * | Release ()

Private Member Functions

void | RefIt ()
void | ReleaseIt ()

Private Attributes

T * | m_Interface

Detailed Description

template<class T>
class SmartRefPointer< T >

Definition at line 57 of file bits_ie.cpp.

Constructor & Destructor Documentation

template<class T >
SmartRefPointer< T >::SmartRefPointer ( ) [inline]

Definition at line 73 of file bits_ie.cpp.

      :

template<class T >
SmartRefPointer< T >::SmartRefPointer ( T * RawInterface ) [inline]

Definition at line 78 of file bits_ie.cpp.

   {
      m_Interface = NULL;
   }

   SmartRefPointer( T * RawInterface )

template<class T >
SmartRefPointer< T >::SmartRefPointer ( SmartRefPointer< T > & Other ) [inline]

Definition at line 84 of file bits_ie.cpp.

   {

template<class T >
SmartRefPointer< T >::~SmartRefPointer ( ) [inline]

Definition at line 90 of file bits_ie.cpp.

   {

Member Function Documentation

template<class T >
void SmartRefPointer< T >::Clear ( ) [inline]

Definition at line 107 of file bits_ie.cpp.

   {

template<class T >
T* SmartRefPointer< T >::Get ( ) const [inline]

Definition at line 95 of file bits_ie.cpp.

   {
      ReleaseIt();
   }

template<class T >
T** SmartRefPointer< T >::GetRecvPointer ( ) [inline]

Definition at line 112 of file bits_ie.cpp.

   {
      ReleaseIt();
   }

   T** GetRecvPointer()

template<class T >
SmartRefPointer< T >::operator const T * ( ) const [inline]

Definition at line 131 of file bits_ie.cpp.

   {
      return m_Interface;
   }

template<class T >
T* SmartRefPointer< T >::operator-> ( ) const [inline]

Definition at line 126 of file bits_ie.cpp.

   {

template<class T >
SmartRefPointer& SmartRefPointer< T >::operator= ( SmartRefPointer< T > & Other ) [inline]

Definition at line 118 of file bits_ie.cpp.

   {
      ReleaseIt();

template<class T >
void SmartRefPointer< T >::RefIt ( ) [inline, private]

Definition at line 65 of file bits_ie.cpp.

   {

template<class T >
T* SmartRefPointer< T >::Release ( void ) [inline]

Definition at line 100 of file bits_ie.cpp.

   {
      return m_Interface;
   }

   T * Release()
   {

template<class T >
void SmartRefPointer< T >::ReleaseIt ( ) [inline, private]

Definition at line 58 of file bits_ie.cpp.

{
private:
   T * m_Interface;

   void ReleaseIt()
   {

Member Data Documentation

template<class T >
T* SmartRefPointer< T >::m_Interface [private]

Definition at line 56 of file bits_ie.cpp.

The documentation for this class was generated from the following file:
  • Web/bits/bits_ie/bits_ie.cpp
Generated on Wed Nov 13 2024 16:57:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SMmStream Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

SMmStream Class Reference

#include "PMMStrm.Hxx"

List of all members.

Public Member Functions

SMmStream (PMmStream *pStream)
~SMmStream ()
PMmStream * Acquire ()
BOOL operator! ()
PMmStream & operator* ()
PMmStream * operator-> ()
void Set (PMmStream *pStream)

Private Attributes

PMmStream * _pStream

Detailed Description

Definition at line 133 of file PMMStrm.Hxx.

Constructor & Destructor Documentation

SMmStream::SMmStream ( PMmStream * pStream ) [inline]

Definition at line 136 of file PMMStrm.Hxx.

                                    : _pStream(pStream)
    {
    }

SMmStream::~SMmStream ( )

Definition at line 24 of file MMbuf.Cxx.

{
    delete _pStream;
}

Member Function Documentation

PMmStream* SMmStream::Acquire ( ) [inline]

Definition at line 144 of file PMMStrm.Hxx.

    {
        PMmStream* pStream = _pStream;
        _pStream = 0;
        return(pStream);
    }

BOOL SMmStream::operator! ( ) [inline]

Definition at line 142 of file PMMStrm.Hxx.

{ return _pStream == 0; }

PMmStream& SMmStream::operator* ( ) [inline]

Definition at line 141 of file PMMStrm.Hxx.

{ return *_pStream; }

PMmStream* SMmStream::operator-> ( ) [inline]

Definition at line 140 of file PMMStrm.Hxx.

{ return _pStream; }

void SMmStream::Set ( PMmStream * pStream ) [inline]

Definition at line 151 of file PMMStrm.Hxx.

    {
        Win4Assert( 0 == _pStream );
        _pStream = pStream;
    }

Member Data Documentation

PMmStream* SMmStream::_pStream [private]

Definition at line 159 of file PMMStrm.Hxx.

The documentation for this class was generated from the following files:
  • WinBase/Indexing/IFilter/PMMStrm.Hxx
  • WinBase/Indexing/IFilter/MMbuf.Cxx
Generated on Wed Nov 13 2024 16:57:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Sock_Info Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

Sock_Info Struct Reference

List of all members.

Public Attributes

struct Sock_Info * | next
struct Sock_Info * | prev
int | protocol
SOCKET | socket
int | socket_type
HANDLE thread

Detailed Description

Definition at line 60 of file PrPerf.c.

Member Data Documentation

struct Sock_Info* Sock_Info::next

Definition at line 67 of file PrPerf.c.

struct Sock_Info * Sock_Info::prev

Definition at line 67 of file PrPerf.c.

int Sock_Info::protocol

Definition at line 62 of file PrPerf.c.

SOCKET Sock_Info::socket

Definition at line 64 of file PrPerf.c.

int Sock_Info::socket_type

Definition at line 61 of file PrPerf.c.

HANDLE Sock_Info::thread

Definition at line 65 of file PrPerf.c.

The documentation for this struct was generated from the following file:
  • NetDS/WinSock/appletalk/PrPerf.c
Generated on Wed Nov 13 2024 16:57:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SocketMonitor Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Protected Member Functions

SocketMonitor Class Reference

#include "Socketmon.Hpp"

Inherits DTHandler.

List of all members.

Protected Member Functions

bool | recv (SOCKET s, char FAR *buf, int len, int flags, APIHook< int > &hook)
bool | send (SOCKET s, const char FAR *buf, int len, int flags, APIHook< int > &hook)
bool | WSACleanup (APIHook< int > &hook)
bool | WSAStartup (WORD wVersionRequested, LPWSADATA lpWSAData, APIHook< int > &hook)

Detailed Description

Definition at line 19 of file Socketmon.Hpp.

Member Function Documentation

bool SocketMonitor::recv | ( | SOCKET | s,
 |  | char FAR * | buf,
 |  | int | len,
 |  | int | flags,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Reimplemented from DTHandler.

Definition at line 149 of file Socketmon.Cpp.

                                                                                {

    char buffer[1024];

    if (hook.preAPI()) {

        _snprintf(buffer,
                  sizeof(buffer) - 1,
                  "[DT Hook]\n"
                  "\tWinsock API\t\t: recv()\n"
                  "     \tCalling library\t\t: %s\n"
                  "     \tPre-API notify\t\t: Yes\n"
                  "\tParameter values\t:\n"
                  "     \ts\t\t\t: %d\n"
                  "     \tbuf\t\t\t: 0x%08x\n"
                  "     \tlen\t\t\t: %d\n"
                  "     \tflags\t\t\t: %d\n",
                  hook.libName(),
                  s,
                  *buf,
                  len,
                  flags);

    } else {

        _snprintf(buffer,
                  sizeof(buffer) - 1,
                  "Winsock API\t\t\t: send()\n"
                  "     Calling library\t\t\t: %s\n"
                  "     Pre-API notify\t\t\t: No\n"
                  "     API return value\t\t\t: %d\n"
                  "Reference parameter values:\t:\n",
                  hook.libName(),
                  *hook.rValue());

    }

    buffer[sizeof(buffer) - 1] = '\0';
    MessageBox(0, buffer, "DT Hook", MB_OK | MB_ICONINFORMATION);

    return (false); // don't veto API call

} // SocketMonitor::recv()

bool SocketMonitor::send | ( | SOCKET | s,
 |  | const char FAR * | buf,
 |  | int | len,
 |  | int | flags,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Reimplemented from DTHandler.

Definition at line 105 of file Socketmon.Cpp.

                                                                                {

    char buffer[1024];

    if (hook.preAPI()) {

        _snprintf(buffer,
                  sizeof(buffer) - 1,
                "Winsock API\t\t: send()\n"
                "     Calling library\t\t: %s\n"
                "     Pre-API notify\t\t: Yes\n"
                "Parameter values\t\t:\n"
                "     s\t\t\t: %d\n"
                "     buf\t\t\t: 0x%08x\n"
                "     len\t\t\t: %d\n"
                "     flags\t\t\t: %d\n",
                hook.libName(),
                s,
                *buf,
                len,
                flags);

    } else {

        _snprintf(buffer,
                  sizeof(buffer) - 1,
                  "Winsock API\t\t\t: send()\n"
                  "     Calling library\t\t\t: %s\n"
                  "     Pre-API notify\t\t\t: No\n"
                  "     API return value\t\t\t: %d\n",
                  hook.libName(),
                  *hook.rValue());

    }

    buffer[sizeof(buffer) - 1] = '\0';
    MessageBox(0, buffer, "DT Hook", MB_OK | MB_ICONINFORMATION);

    return (false); // don't veto API call

} // SocketMonitor::send()

bool SocketMonitor::WSACleanup ( APIHook< int > & hook ) [protected, virtual]

Reimplemented from DTHandler.

Definition at line 70 of file Socketmon.Cpp.

                                            {

    char buffer[1024];

    if (hook.preAPI()) {

        _snprintf(buffer,
                  sizeof(buffer) - 1,
                  "\nWinsock API\t\t: WSACleanup()\n"
                  "     Calling library\t\t: %s\n"
                  "     Pre-API notify\t\t: Yes\n",
                  hook.libName());

    } else {

        _snprintf(buffer,
                  sizeof(buffer) - 1,
                  "\nWinsock API\t\t: WSACleanup()\n"
                  "     Calling library\t\t: %s\n"
                  "     Pre-API notify\t\t: No\n"
                  "     API return value\t\t: %d\n",
                  hook.libName(),
                  *hook.rValue());

    }

    buffer[sizeof(buffer) - 1] = '\0';
    MessageBox(0, buffer, "DT Hook", MB_OK | MB_ICONINFORMATION);

    return (false); // don't veto API call

} // SocketMonitor::WSACleanup()

bool SocketMonitor::WSAStartup | ( | WORD | wVersionRequested,
 |  | LPWSADATA | lpWSAData,
 |  | APIHook< int > & | hook |
 | ) |  |  | [protected, virtual]

Reimplemented from DTHandler.

Definition at line 17 of file Socketmon.Cpp.

                                                                                {

    char buffer[1024];

    if (hook.preAPI()) {

        _snprintf(buffer,
                  sizeof(buffer) - 1,
                  "\nWinsock API\t\t: WSAStartup()\n"
                  "     Calling library\t\t: %s\n"
                  "     Pre-API notify\t\t: Yes\n"
                  "Parameter values\t\t:\n"
                  "     wVersionRequested\t: %u\n",
                  hook.libName(),
                  wVersionRequested);

    } else {

        _snprintf(buffer,
                  sizeof(buffer) - 1,
                  "\nWinsock API\t\t\t: WSAStartup()\n"
                  "     Calling library\t\t\t: %s\n"
                  "     Pre-API notify\t\t\t: No\n"
                  "Reference parameter values\t\t:\n"
                  "     lpWSAData->wVersion\t\t: %d\n"
                  "     lpWSAData->wHighVersion\t: %d\n"
                  "     lpWSAData->iMaxSockets\t\t: %d\n"
                  "     lpWSAData->iMaxUdpDg\t\t: %d\n"
                  "     lpWSAData->szDescription\t: %s\n"
                  "     lpWSAData->szSystemStatus\t: %s\n"
                  "     lpWSAData->lpVendorInfo\t\t: %s\n"
                  "API return value\t\t\t: %d\n",
                  hook.libName(),
                  lpWSAData->wVersion,
                  lpWSAData->wHighVersion,
                  lpWSAData->iMaxSockets,
                  lpWSAData->iMaxUdpDg,
                  lpWSAData->szDescription,
                  lpWSAData->szSystemStatus,
                  lpWSAData->lpVendorInfo,
                  *hook.rValue());

    }

    buffer[sizeof(buffer) - 1] = '\0';
    MessageBox(0, buffer, "DT Hook", MB_OK | MB_ICONINFORMATION);

    return (false); // don't veto API call

} // SocketMonitor::WSAStartup()

The documentation for this class was generated from the following files:
  • NetDS/WinSock/Dt_Dll2/Socketmon.Hpp
  • NetDS/WinSock/Dt_Dll2/Socketmon.Cpp
Generated on Wed Nov 13 2024 16:57:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SPINCUBEINFO Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

SPINCUBEINFO Struct Reference

#include "SpinCube.h"

List of all members.

Public Attributes

float | fCurrentXRotation
float | fCurrentXRotationInc
float | fCurrentYRotation
float | fCurrentYRotationInc
float | fCurrentZRotation
float | fCurrentZRotationInc
HBITMAP | hbmCompat
HBITMAP | hbmSave
HDC | hdcCompat
int | iCurrentXTranslation
int | iCurrentXTranslationInc
int | iCurrentYTranslation
int | iCurrentYTranslationInc
int | iCurrentZTranslation
int | iCurrentZTranslationInc
int | iOptions
RECT | rcCubeBoundary

Detailed Description

Definition at line 79 of file SpinCube.h.

Member Data Documentation

float SPINCUBEINFO::fCurrentXRotation

Definition at line 89 of file SpinCube.h.

float SPINCUBEINFO::fCurrentXRotationInc

Definition at line 93 of file SpinCube.h.

float SPINCUBEINFO::fCurrentYRotation

Definition at line 90 of file SpinCube.h.

float SPINCUBEINFO::fCurrentYRotationInc

Definition at line 94 of file SpinCube.h.

float SPINCUBEINFO::fCurrentZRotation

Definition at line 91 of file SpinCube.h.

float SPINCUBEINFO::fCurrentZRotationInc

Definition at line 95 of file SpinCube.h.

HBITMAP SPINCUBEINFO::hbmCompat

Definition at line 84 of file SpinCube.h.

HBITMAP SPINCUBEINFO::hbmSave

Definition at line 83 of file SpinCube.h.

HDC SPINCUBEINFO::hdcCompat

Definition at line 81 of file SpinCube.h.

int SPINCUBEINFO::iCurrentXTranslation

Definition at line 97 of file SpinCube.h.

int SPINCUBEINFO::iCurrentXTranslationInc

Definition at line 101 of file SpinCube.h.

int SPINCUBEINFO::iCurrentYTranslation

Definition at line 98 of file SpinCube.h.

int SPINCUBEINFO::iCurrentYTranslationInc

Definition at line 102 of file SpinCube.h.

int SPINCUBEINFO::iCurrentZTranslation

Definition at line 99 of file SpinCube.h.

int SPINCUBEINFO::iCurrentZTranslationInc

Definition at line 103 of file SpinCube.h.

int SPINCUBEINFO::iOptions

Definition at line 112 of file SpinCube.h.

RECT SPINCUBEINFO::rcCubeBoundary

Definition at line 105 of file SpinCube.h.

The documentation for this struct was generated from the following file:
  • WinUI/Controls/Custom/SpinCube/SpinCube.h
Generated on Wed Nov 13 2024 16:57:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SPropertyEntry Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

SPropertyEntry Struct Reference

List of all members.

Public Attributes

WCHAR | awcName [cwcMaxName]
DBTYPE | dbType

Detailed Description

Definition at line 78 of file HtmlProp.Cxx.

Member Data Documentation

WCHAR SPropertyEntry::awcName[cwcMaxName]

Definition at line 80 of file HtmlProp.Cxx.

DBTYPE SPropertyEntry::dbType

Definition at line 81 of file HtmlProp.Cxx.

The documentation for this struct was generated from the following file:
  • WinBase/Indexing/HtmlProp/HtmlProp.Cxx
Generated on Wed Nov 13 2024 16:57:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SStemForm Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

SStemForm Struct Reference

List of all members.

Public Attributes

USHORT iForm
USHORT iList

Detailed Description

Definition at line 54 of file lrsample.CXX.

Member Data Documentation

USHORT SStemForm::iForm

Definition at line 57 of file lrsample.CXX.

USHORT SStemForm::iList

Definition at line 56 of file lrsample.CXX.

The documentation for this struct was generated from the following file:
  • WinBase/Indexing/lrsample/lrsample.CXX
Generated on Wed Nov 13 2024 16:57:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Stack_c< T > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

Stack_c< T > Class Template Reference

#include "Stack.h"

Inherits NIDeque_c< T >.

List of all members.

Public Member Functions

Stack_c ()
~Stack_c ()
BOOL IsEmpty ()
BOOL | Pop (T &Data)
BOOL | Push (T Data)

Detailed Description

template<class T>
class Stack_c< T >

Definition at line 29 of file Stack.h.

Constructor & Destructor Documentation

template<class T>
Stack_c< T >::Stack_c ( ) [inline]

Definition at line 32 of file Stack.h.

: NIDeque_c<T>() {}

template<class T>
Stack_c< T >::~Stack_c ( ) [inline]

Definition at line 33 of file Stack.h.

{}

Member Function Documentation

template<class T>
BOOL Stack_c< T >::IsEmpty ( void ) [inline]

Reimplemented from NIDeque_c< T >.

Reimplemented in Cstack_c.

Definition at line 37 of file Stack.h.

{return NIDeque_c<T>::IsEmpty();}

template<class T>
BOOL Stack_c< T >::Pop ( T & Data ) [inline]

Definition at line 35 of file Stack.h.

                                 {return
                                  NIDeque_c<T>::RemoveFromFront(Data);}

template<class T>
BOOL Stack_c< T >::Push ( T Data ) [inline]

Definition at line 34 of file Stack.h.

{return NIDeque_c<T>::InsertIntoFront(Data);}

The documentation for this class was generated from the following file:
  • NetDS/WinSock/Dt_Dll/Stack.h
Generated on Wed Nov 13 2024 16:57:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: statel Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

statel Struct Reference

List of all members.

Public Attributes

int | flags
int | id
RECT | rc
char | text [SF_MAXLABEL+1]
int | type
int | width

Detailed Description

Definition at line 24 of file status.cpp.

Member Data Documentation

int statel::flags

Definition at line 26 of file status.cpp.

int statel::id

Definition at line 35 of file status.cpp.

RECT statel::rc

Definition at line 39 of file status.cpp.

char statel::text[SF_MAXLABEL+1]

Definition at line 37 of file status.cpp.

int statel::type

Definition at line 25 of file status.cpp.

int statel::width

Definition at line 36 of file status.cpp.

The documentation for this struct was generated from the following file:
  • Begin/sdkdiff/status.cpp
Generated on Wed Nov 13 2024 16:57:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Static_Info_Database Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

Static_Info_Database Struct Reference

List of all members.

Public Attributes

BOOL bTaken
HANDLE hConnection
RAS_CONNECTION_0 | pRasConnection0
RAS_CONNECTION_1 | pRasConnection1

Detailed Description

Definition at line 107 of file AdminDll.c.

Member Data Documentation

BOOL Static_Info_Database::bTaken

Definition at line 109 of file AdminDll.c.

HANDLE Static_Info_Database::hConnection

Definition at line 110 of file AdminDll.c.

RAS_CONNECTION_0 Static_Info_Database::pRasConnection0

Definition at line 111 of file AdminDll.c.

RAS_CONNECTION_1 Static_Info_Database::pRasConnection1

Definition at line 112 of file AdminDll.c.

The documentation for this struct was generated from the following file:
  • NetDS/RRas/Callout/AdminDll.c
Generated on Wed Nov 13 2024 16:57:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Static_Statistic Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

Static_Statistic Struct Reference

List of all members.

Public Attributes

BOOL bTaken
DWORD IpAddress
WCHAR | wszPortName [MAX_PORT_NAME]
WCHAR | wszUserName [UNLEN+1]

Detailed Description

Definition at line 117 of file AdminDll.c.

Member Data Documentation

BOOL Static_Statistic::bTaken

Definition at line 122 of file AdminDll.c.

DWORD Static_Statistic::IpAddress

Definition at line 121 of file AdminDll.c.

WCHAR Static_Statistic::wszPortName[MAX_PORT_NAME]

Definition at line 120 of file AdminDll.c.

WCHAR Static_Statistic::wszUserName[UNLEN+1]

Definition at line 119 of file AdminDll.c.

The documentation for this struct was generated from the following file:
  • NetDS/RRas/Callout/AdminDll.c
Generated on Wed Nov 13 2024 16:57:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: STL_LABEL Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

STL_LABEL Struct Reference

#include "stl.h"

List of all members.

Public Attributes

BYTE | Application [STL_LABEL_ApplicationSize]
BYTE | LabelType [STL_LABEL_LabelTypeSize]
BYTE | LabelVersion [STL_LABEL_VersionSize]
BYTE | MediaID [STL_LABEL_MediaIDSize]
BYTE | TapeName [STL_LABEL_TapeNameSize]
BYTE | TimeStamp [STL_LABEL_TimeStampSize]
BYTE | Vendor [STL_LABEL_VendorSize]

Detailed Description

Definition at line 50 of file stl.h.

Member Data Documentation

BYTE STL_LABEL::Application[STL_LABEL_ApplicationSize]

Definition at line 56 of file stl.h.

BYTE STL_LABEL::LabelType[STL_LABEL_LabelTypeSize]

Definition at line 52 of file stl.h.

BYTE STL_LABEL::LabelVersion[STL_LABEL_VersionSize]

Definition at line 53 of file stl.h.

BYTE STL_LABEL::MediaID[STL_LABEL_MediaIDSize]

Definition at line 58 of file stl.h.

BYTE STL_LABEL::TapeName[STL_LABEL_TapeNameSize]

Definition at line 57 of file stl.h.

BYTE STL_LABEL::TimeStamp[STL_LABEL_TimeStampSize]

Definition at line 55 of file stl.h.

BYTE STL_LABEL::Vendor[STL_LABEL_VendorSize]

Definition at line 54 of file stl.h.

The documentation for this struct was generated from the following file:
  • WinBase/IO/RSM/inc/stl.h
Generated on Wed Nov 13 2024 16:57:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: storesh::CERT_SYSTEM_STORE_INFO Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • storesh
  • storesh::CERT_SYSTEM_STORE_INFO
Public Attributes

storesh::CERT_SYSTEM_STORE_INFO Struct Reference

List of all members.

Public Attributes

uint cbSize

Detailed Description

Definition at line 80 of file storesh.cs.

Member Data Documentation

uint storesh::CERT_SYSTEM_STORE_INFO::cbSize

Definition at line 82 of file storesh.cs.

The documentation for this struct was generated from the following file:
  • Security/capicom/c_sharp/storesh/storesh.cs
Generated on Wed Nov 13 2024 16:58:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: storesh::Storesh Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • storesh
  • storesh::Storesh
Static Public Member Functions | Private Types | Static Private Member Functions | Private Attributes | Static Private Attributes

storesh::Storesh Class Reference

List of all members.

Static Public Member Functions

static bool | CertEnumSystemStoreCallback (String pvSystemStore, uint dwFlags, ref CERT_SYSTEM_STORE_INFO pStoreInfo, uint pvReserved, String pvArg)
static void | DisplayCertificate (Certificate Certificate, String Title)
static void | DisplayEKU (EKUs EKUs)
static void | DisplayHelp ()
static Certificate | GetCertByIndex (int idx)
static String | ToColumn (String s, int i)

Private Types

enum | Listing { Brief, Long }

Static Private Member Functions

static void | Main (string[] args)
static ArrayList | ParseArgs (String input)
static bool | parseCommandLine (String input)
static void | waitForInput ()

Private Attributes

const int | CAPICOM_ENCODED_DATA_FORMAT_MULTI_LINES = 1
const uint | CERT_SYSTEM_STORE_CURRENT_USER = 0x10000
const uint | CERT_SYSTEM_STORE_LOCAL_MACHINE = 0x20000
const int | CERTNAME_LENGTH = 20
const String | CurrentUser = "CurrentUser"
const int | FRIENDLYNAME_LENGTH = 20
const int | HELP_PAD = 30
const String | LocalMachine = "LocalMachine"
const int | THUMBPRINT_LENGTH = 42
const int | VALIDITY_LENGTH = 23

Static Private Attributes

static IEnumerator | _currFilter
static String | _currStoreLocation = CurrentUser
static String | _currStoreName = "My"
static StoreClass | _oCurrStore

Detailed Description

Definition at line 87 of file storesh.cs.

Member Enumeration Documentation

enum storesh::Storesh::Listing [private]
Enumerator:
Brief
Long

Definition at line 105 of file storesh.cs.

{Brief, Long};

Member Function Documentation

static bool storesh::Storesh::CertEnumSystemStoreCallback | ( | String | pvSystemStore,
 |  | uint | dwFlags,
 |  | ref CERT_SYSTEM_STORE_INFO | pStoreInfo,
 |  | uint | pvReserved,
 |  | String | pvArg |
 | ) |  |  | [inline, static]

Definition at line 548 of file storesh.cs.

    {
      Console.WriteLine("[ " +pvSystemStore + " ]");
      return true;
    }

static void storesh::Storesh::DisplayCertificate | ( | Certificate | Certificate,
 |  | String | Title |
 | ) |  |  | [inline, static]

Definition at line 710 of file storesh.cs.

    {
      String[] KeySpecStrings = {"Unknown", "Exchange","Signature" };
      String[] ProviderTypes = {  "Unknown",
                     "PROV_RSA_FULL",
                     "PROV_RSA_SIG",
                     "PROV_DSS",
                     "PROV_FORTEZZA",
                     "PROV_MS_EXCHANGE",
                     "PROV_SSL",
                     "PROV_STT_MER",
                     "PROV_STT_ACQ",
                     "PROV_STT_BRND",
                     "PROV_STT_ROOT",
                     "PROV_STT_ISS",
                     "PROV_RSA_SCHANNEL",
                     "PROV_DSS_DH",
                     "PROV_EC_ECDSA_SIG",
                     "PROV_EC_ECNRA_SIG",
                     "PROV_EC_ECDSA_FULL",
                     "PROV_EC_ECNRA_FULL",
                     "PROV_DH_SCHANNEL",
                     "PROV_SPYRUS_LYNKS",
                     "PROV_RNG",
                     "PROV_INTEL_SEC",
                     "PROV_REPLACE_OWF",
                     "PROV_RSA_AES" };

      //int iIndex = 0;

      Console.WriteLine( Title );
      Console.WriteLine();
      Console.WriteLine( "Subject Name:");
      Console.WriteLine( "  Simple name = " + Certificate.SubjectName);
      Console.WriteLine( "  Email name  = " + Certificate.GetInfo(CAPICOM_CERT_INFO_TYPE.CAPICOM_CERT_INFO_SUBJECT_EMAIL_NAME));
      Console.WriteLine( "  UPN name    = " + Certificate.GetInfo(CAPICOM_CERT_INFO_TYPE.CAPICOM_CERT_INFO_SUBJECT_UPN));
      Console.WriteLine( "  DNS name    = " + Certificate.GetInfo(CAPICOM_CERT_INFO_TYPE.CAPICOM_CERT_INFO_SUBJECT_DNS_NAME));
      Console.WriteLine();
      Console.WriteLine( "Issuer Name: " + Certificate.IssuerName);
      Console.WriteLine();
      Console.WriteLine( "Serial Number: " + Certificate.SerialNumber);
      Console.WriteLine();
      Console.WriteLine( "Not Before: " + Certificate.ValidFromDate);
      Console.WriteLine();
      Console.WriteLine( "Not After: " + Certificate.ValidToDate);
      Console.WriteLine();
      Console.WriteLine( "SHA1 Hash: " + Certificate.Thumbprint);
      Console.WriteLine();
      Console.WriteLine( "IsValid: " + Certificate.IsValid().Result);
      Console.WriteLine();
      Console.WriteLine( "Archived: " + Certificate.Archived);
      Console.WriteLine();

      if (Certificate.BasicConstraints().IsPresent)
      {
        Console.WriteLine( "Basic Constraints:" );
        Console.WriteLine( "  Critical          = " + Certificate.BasicConstraints().IsCritical );
        Console.WriteLine( "  CA                = " + Certificate.BasicConstraints().IsCertificateAuthority );
        Console.WriteLine( "  PathLenConstraint = ");
        if (Certificate.BasicConstraints().IsPathLenConstraintPresent)
        {
          Console.WriteLine( Certificate.BasicConstraints().PathLenConstraint);
        }
        else
        {
          Console.WriteLine( "Not present.");
        }
      }
      else
      {
        Console.WriteLine( "Basic Constraints: Not present." );
      }
      Console.WriteLine();

      if (Certificate.KeyUsage().IsPresent)
      {
        Console.WriteLine( "Key Usage:");
        Console.WriteLine( "  Critical                  = " + Certificate.KeyUsage().IsCritical);
        Console.WriteLine( "  IsDigitalSignatureEnabled = " + Certificate.KeyUsage().IsDigitalSignatureEnabled );
        Console.WriteLine( "  IsNonRepudiationEnabled   = " + Certificate.KeyUsage().IsNonRepudiationEnabled);
        Console.WriteLine( "  IsKeyEnciphermentEnabled  = " + Certificate.KeyUsage().IsKeyEnciphermentEnabled);
        Console.WriteLine( "  IsDataEnciphermentEnabled = " + Certificate.KeyUsage().IsDataEnciphermentEnabled);
        Console.WriteLine( "  IsKeyAgreementEnabled     = " + Certificate.KeyUsage().IsKeyAgreementEnabled);
        Console.WriteLine( "  IsKeyCertSignEnabled      = " + Certificate.KeyUsage().IsKeyCertSignEnabled);
        Console.WriteLine( "  IsCRLSignEnabled          = " + Certificate.KeyUsage().IsCRLSignEnabled);
        Console.WriteLine( "  IsEncipherOnlyEnabled     = " + Certificate.KeyUsage().IsEncipherOnlyEnabled);
        Console.WriteLine( "  IsDecipherOnlyEnabled     = " + Certificate.KeyUsage().IsDecipherOnlyEnabled);
      }
      else
      {
        Console.WriteLine( "Key Usage: Not present.");

      }
      Console.WriteLine();

      if (Certificate.ExtendedKeyUsage().IsPresent)
      {
        if (Certificate.ExtendedKeyUsage().EKUs.Count > 0)
        {
          OID OID;
          OID = new OIDClass();
          Console.WriteLine( "Extended Key Usage:");
          Console.WriteLine( "  Critical = " + Certificate.ExtendedKeyUsage().IsCritical);
          foreach (EKU EKU in Certificate.ExtendedKeyUsage().EKUs)
          {
            OID.Value = EKU.OID;
            Console.WriteLine( "  " + OID.FriendlyName + " (" + OID.Value + ")" );
          }
          OID = null;
        }
        else
        {
          Console.WriteLine( "Extended Key Usage: Not valid for any usage.");
          Console.WriteLine( "  Critical = " + Certificate.ExtendedKeyUsage().IsCritical );
        }
      }
      else
      {
        Console.WriteLine( "Extended Key Usage: Not present (valid for all usages).");
      }
      Console.WriteLine();

      if (Certificate.Template().IsPresent)
      {
        Console.WriteLine( "Template:");
        Console.WriteLine( "  Critical = " + Certificate.Template().IsCritical);
        Console.WriteLine( "  Name     = " + Certificate.Template().Name);
        Console.WriteLine( "  OID      = " + Certificate.Template().OID.FriendlyName + "(" + Certificate.Template().OID.Value + ")");
        Console.WriteLine( "  Major    = " + Certificate.Template().MajorVersion);
        Console.WriteLine( "  Minor    = " + Certificate.Template().MinorVersion);
      }
      else
      {
        Console.WriteLine( "Template: Not present.");
      }
      Console.WriteLine();

      Console.WriteLine( "Public Key:");
      Console.WriteLine( "  Algorithm  = " + Certificate.PublicKey().Algorithm.FriendlyName + "(" + Certificate.PublicKey().Algorithm.Value + ")");
      Console.WriteLine( "  Length     = " + Certificate.PublicKey().Length + " bits");
      Console.WriteLine( "  Key blob   = " + Certificate.PublicKey().EncodedKey.Format(true));
      Console.WriteLine( "  Parameters = " + Certificate.PublicKey().EncodedParameters.Format(true));

      if (Certificate.HasPrivateKey())
      {
        Console.WriteLine( "Private Key:");
        Console.WriteLine( "  Container name   = " + Certificate.PrivateKey.ContainerName);
        //Don't display unique container name for hardware token because it may cause UI to be displayed.
        if (! Certificate.PrivateKey.IsHardwareDevice())
        {
          Console.WriteLine( "  Unique name      = " + Certificate.PrivateKey.UniqueContainerName);
        }
        Console.WriteLine( "  Provider name    = " + Certificate.PrivateKey.ProviderName);
        Console.WriteLine(     "  Provider type    = " );
        if (Convert.ToInt32(Certificate.PrivateKey.ProviderType) > ProviderTypes.GetUpperBound(0))
        {
          Console.WriteLine( ProviderTypes[0] + " (" + Convert.ToString(Certificate.PrivateKey.ProviderType) + ")");
        }
        else
        {
          Console.WriteLine( ProviderTypes[Convert.ToInt32(Certificate.PrivateKey.ProviderType)] + " (" + Convert.ToString(Certificate.PrivateKey.ProviderType) + ")");
        }
        Console.WriteLine(     "  Key spec         = " );
        if (Convert.ToInt32(Certificate.PrivateKey.KeySpec) > KeySpecStrings.GetUpperBound(0))
        {
          Console.WriteLine( KeySpecStrings[0] + " (" + Convert.ToString(Certificate.PrivateKey.KeySpec) + ")");
        }
        else
        {
          Console.WriteLine( KeySpecStrings[Convert.ToInt32(Certificate.PrivateKey.KeySpec)] + " (" + Convert.ToString(Certificate.PrivateKey.KeySpec) + ")");
        }
        Console.WriteLine( "  Accessible       = " + Certificate.PrivateKey.IsAccessible());
        Console.WriteLine( "  Protected        = " + Certificate.PrivateKey.IsProtected());
        Console.WriteLine( "  Exportable       = " + Certificate.PrivateKey.IsExportable());
        Console.WriteLine( "  Removable        = " + Certificate.PrivateKey.IsRemovable());
        Console.WriteLine( "  Machine keyset   = " + Certificate.PrivateKey.IsMachineKeyset());
        Console.WriteLine( "  Hardware storage = " + Certificate.PrivateKey.IsHardwareDevice());
      }
      else
      {
        Console.WriteLine( "Private Key: Not found." );
      }
      Console.WriteLine();

      if (true)
      {
        int iIndex = 0;

        foreach (Extension Extension in Certificate.Extensions())
        {
          iIndex++;
          Console.WriteLine( "Extension #" + Convert.ToString(iIndex) + ": " + Extension.OID.FriendlyName + "(" + Extension.OID.Value + ")");
          Console.WriteLine( "  " + Extension.EncodedData.Format(true));

          if (Extension.EncodedData.Decoder() != null)
          {
            switch (Extension.OID.Value)
            {
              case Constants.CAPICOM_CERT_POLICIES_OID:
              {
                CertificatePolicies CertPolicies;
                int pIndex = 0;

                CertPolicies = (CertificatePolicies)Extension.EncodedData.Decoder();
                Console.WriteLine( "Decoded Certificate Policies: " + Convert.ToString(CertPolicies.Count) + " PolicyInformation(s)");

                foreach  (PolicyInformation PolicyInformation in CertPolicies)
                {
                  int qIndex = 0;
                  pIndex++;
                  Console.WriteLine( "  PolicyInformation #" + Convert.ToString(pIndex) + ": " + Convert.ToString(PolicyInformation.Qualifiers.Count) + " Qualifier(s)");
                  Console.WriteLine( "    OID = " + PolicyInformation.OID.FriendlyName + "(" + PolicyInformation.OID.Value + ")");

                  foreach (Qualifier Qualifier  in PolicyInformation.Qualifiers)
                  {
                    qIndex++;
                    Console.WriteLine( "    Qualifier #" + Convert.ToString(qIndex) + ":");
                    Console.WriteLine( "      OID               = " + Qualifier.OID.FriendlyName + "(" + Qualifier.OID.Value + ")");
                    Console.WriteLine( "      CPS URI           = " + Qualifier.CPSPointer);
                    Console.WriteLine( "      Organization name = " + Qualifier.OrganizationName);
                    Console.WriteLine( "      Notice number(s)  = ");
                    if (Qualifier.NoticeNumbers != null)
                    {
                      foreach (NoticeNumbers NoticeNumber in Qualifier.NoticeNumbers)
                      {
                        Console.WriteLine( Convert.ToString(NoticeNumber));
                      }
                    }
                    Console.WriteLine();
                    Console.WriteLine( "      Explicit text     = " + Qualifier.ExplicitText);
                  }
                  Console.WriteLine();
                }
                break;
              }
            }
          }
        }
        if (iIndex == 0)
        {
          Console.WriteLine( "Extension: None.");
          Console.WriteLine();
        }

        iIndex = 0;
        foreach (ExtendedProperty ExtendedProperty in Certificate.ExtendedProperties())
        {
          iIndex ++;
          Console.WriteLine( "Property #" + Convert.ToString(iIndex) + " (ID = " + ExtendedProperty.PropID + "):" );
          Console.WriteLine( "  " + ExtendedProperty.get_Value(CAPICOM_ENCODING_TYPE.CAPICOM_ENCODE_BASE64));
        }
        if (iIndex == 0)
        {
          Console.WriteLine( "Property: None.");
          Console.WriteLine();
        }

      }
    }

static void storesh::Storesh::DisplayEKU ( EKUs EKUs ) [inline, static]

Definition at line 695 of file storesh.cs.

    {
      if (EKUs.Count > 0)
      {
        OID OID;
        OID = new OIDClass();
        foreach (EKU EKU in EKUs)
        {
          OID.Value = EKU.OID;
          Console.WriteLine( "  " + OID.FriendlyName + " (" + OID.Value + ")" );
        }
        OID = null;
      }
    }

static void storesh::Storesh::DisplayHelp ( ) [inline, static]

Definition at line 629 of file storesh.cs.

    {
      Console.WriteLine();
      Console.Write("[h]elp".PadRight(HELP_PAD, ' '));
      Console.WriteLine("This screen");

      Console.WriteLine();
      Console.Write("cd <location>".PadRight(HELP_PAD, ' '));
      Console.WriteLine("<location> is a store name or ..");
      Console.WriteLine("".PadRight(HELP_PAD, ' ')+ "Can also be \\LocalMachine (\\lm) or \\CurrentUser (\\cu)");

      Console.WriteLine();
      Console.Write("[d]ir <options>".PadRight(HELP_PAD, ' '));
      Console.WriteLine("List the contents of a certificate store");
      Console.WriteLine("".PadRight(HELP_PAD, ' ')+ "-l Long listing");
      Console.WriteLine("".PadRight(HELP_PAD, ' ')+ "-subject <name>  Match subject name.");
      Console.WriteLine("".PadRight(HELP_PAD, ' ')+ "-issuer <name> Match issuer name.");
      Console.WriteLine("".PadRight(HELP_PAD, ' ')+ "-eku <EKU> Must have specified EKU.");
      Console.WriteLine("".PadRight(HELP_PAD, ' ')+ "-sha1 <sha1> Match thumbprint.");

      Console.WriteLine();
      Console.Write("[v]iew <idx>".PadRight(HELP_PAD, ' '));
      Console.WriteLine("<idx> is the number of the certificate to view");

      Console.WriteLine();
      Console.Write("del <idx>".PadRight(HELP_PAD, ' '));
      Console.WriteLine("<idx> is the number of the certificate to delete");

      Console.WriteLine();
      Console.Write("displa[y] <idx>".PadRight(HELP_PAD, ' '));
      Console.WriteLine("<idx> is the number of the certificate to display");

      Console.WriteLine();
      Console.Write("[e]xport <idx> <file>".PadRight(HELP_PAD, ' '));
      Console.WriteLine("<idx> is the number of the certificate to display");
      Console.WriteLine("".PadRight(HELP_PAD, ' ')+ "<file> is the destination filename");

      Console.WriteLine();
      Console.Write("[p]fxexport <idx> <file> <pw>".PadRight(HELP_PAD, ' '));
      Console.WriteLine("<idx> is the number of the certificate to display");
      Console.WriteLine("".PadRight(HELP_PAD, ' ')+ "<file> is the destination filename");
      Console.WriteLine("".PadRight(HELP_PAD, ' ')+ "<pw> is the password");

      Console.WriteLine();
      Console.Write("[i]mport <file> <pw> [-key e|p]".PadRight(HELP_PAD, ' '));
      Console.WriteLine("<file> is the input filename");
      Console.WriteLine("".PadRight(HELP_PAD, ' ')+ "<pw> is the filename password");
      Console.WriteLine("".PadRight(HELP_PAD, ' ')+ "-key: e is exportable");
      Console.WriteLine("".PadRight(HELP_PAD, ' ')+ "-key: p is user protected. Both may be specified");

    }

static Certificate storesh::Storesh::GetCertByIndex ( int idx ) [inline, static]

Definition at line 560 of file storesh.cs.

    {
      Certificate oCert;
      int i = 0;

      if (_oCurrStore != null)
      {
        if (_currFilter == null)
        {
          _currFilter = _oCurrStore.Certificates.GetEnumerator();
        }
        else
        {
          _currFilter.Reset();
        }

        while (_currFilter.MoveNext() == true)
        {
          oCert  = (Certificate)_currFilter.Current;
          i++;
          if (i == idx)
          {
            return oCert;
          }
        }
      }
      return null;
    }

static void storesh::Storesh::Main ( string[] args ) [inline, static, private]

The main entry point for the application.

Definition at line 110 of file storesh.cs.

    {

      //We take one argument, a starting store name
      if (args.Length > 0)
      {
        _currStoreName = args[0];
      }
      _oCurrStore = new StoreClass();
      _oCurrStore.Open(
        CAPICOM_STORE_LOCATION.CAPICOM_CURRENT_USER_STORE,
        _currStoreName,
        CAPICOM_STORE_OPEN_MODE.CAPICOM_STORE_OPEN_EXISTING_ONLY |
        CAPICOM_STORE_OPEN_MODE.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED);
      waitForInput();
    }

static ArrayList storesh::Storesh::ParseArgs ( String input ) [inline, static, private]

Definition at line 589 of file storesh.cs.

    {
      char[] delims = new char[] {' '};
      ArrayList argsarray = new ArrayList();
      String multiString = null;

      String[] argSplit = input.Split(delims);
      for (int i = 0; i < argSplit.Length; i++)
      {
        String curr = argSplit[i];
        if (curr.StartsWith("\"") && curr.EndsWith("\""))
        {
          argsarray.Add(curr.Substring(1,curr.Length-2));
        }
        else if (curr.StartsWith("\""))
        {
          multiString = curr;
        }
        else if (argSplit[i].EndsWith("\""))
        {
          multiString = multiString + " " + curr;
          argsarray.Add(multiString.Substring(1,multiString.Length-2));
          multiString = null;
        }
        else
        {
          if (multiString != null)
          {
            multiString = multiString + " " + curr;
          }
          else
          {
            argsarray.Add(curr);
          }
        }
      }
      argSplit = null;
      return argsarray;
    }

static bool storesh::Storesh::parseCommandLine ( String input ) [inline, static, private]

Definition at line 139 of file storesh.cs.

    {

      ArrayList alArgs = ParseArgs(input);
      Certificate oCert = null;

      switch ((String)alArgs[0])
      {
        case "cd":
        {
          //This is the 'change directory' command
          String storename;
          if (alArgs.Count >0 )
          {
            storename = (String)alArgs[1];
          }
          else
          {
            storename = _currStoreName; //reset store name
          }

          if (storename.Equals("..") && _currStoreName.Length > 0 )
          {
            _oCurrStore = new StoreClass();
            storename = null;
            _currFilter = null;
            _currStoreName = "";
          }
          else if (storename.StartsWith("..") && _currStoreName.Length > 0 )
          {
            _oCurrStore = new StoreClass();
            _currFilter = null;
            storename = storename.Substring(3,storename.Length - 3);
            _currStoreName = "";
          }
          else if (storename.Equals(".."))
          {
            storename = null;
          }
          else if (storename.Equals("\\" + LocalMachine)  || storename.Equals("\\lm" ))
          {
            _oCurrStore = new StoreClass();
            _currStoreName = "";
            storename = null;
            _currStoreLocation = LocalMachine;
            _currFilter = null;
          }
          else if (storename.Equals("\\" + CurrentUser)  || storename.Equals("\\cu" ))
          {
            _oCurrStore = new StoreClass();
            _currStoreName = "";
            storename = null;
            _currStoreLocation = CurrentUser;
            _currFilter = null;
          }
          if (storename != null && _currStoreName.Equals(""))
          {

            try
            {
              CAPICOM_STORE_LOCATION OpenMode = CAPICOM_STORE_LOCATION.CAPICOM_CURRENT_USER_STORE;
              if (_currStoreLocation.Equals(LocalMachine))
              {
                OpenMode = CAPICOM_STORE_LOCATION.CAPICOM_LOCAL_MACHINE_STORE;
              }

              //Open the store MAX_ALLOWED in case the user wants to import/del/export
              //They may not have permission to modify HKLM stores
              _oCurrStore.Open( OpenMode,
                storename,
                CAPICOM_STORE_OPEN_MODE.CAPICOM_STORE_OPEN_EXISTING_ONLY |
                CAPICOM_STORE_OPEN_MODE.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED);
              _currStoreName = storename;

            }
            catch (Exception e)
            {
              Console.WriteLine (e.Message);
            }
          }
          return false;
        }
        case "q":
        case "quit":
        {
          return true;
        }
        case "h":
        case "help":
        {
          DisplayHelp();

          return false;
        }
        case "v":
        case "view":
          try
          {
            oCert = GetCertByIndex(Convert.ToInt32(alArgs[1]));
            if (oCert != null )
            {
              DisplayCertificate(oCert, "");
            }
            else
            {
              Console.WriteLine ("No certificate with that index (" + alArgs[1] + ") could be found.");
            }
          }
          catch (Exception e)
          {
            Console.WriteLine ("An error was encountered processing the " + alArgs[0] + " command: " + e.Message);
          }
          break;
        case "y":
        case "display":
          try
          {
            oCert = GetCertByIndex(Convert.ToInt32(alArgs[1]));
            if (oCert != null )
            {
              oCert.Display();
            }
            else
            {
              Console.WriteLine ("No certificate with that index (" + alArgs[1] + ") could be found.");
            }
          }
          catch (Exception e)
          {
            Console.WriteLine ("An error was encountered processing the " + alArgs[0] + " command: " + e.Message);
          }
          break;
        case "del":
          try
          {
            oCert = GetCertByIndex(Convert.ToInt32(alArgs[1]));
            if (oCert != null )
            {
              String answer = "n";
              Console.WriteLine(  ToColumn (oCert.GetInfo(CAPICOM_CERT_INFO_TYPE.CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME), CERTNAME_LENGTH) +
                " " +
                ToColumn (oCert.Thumbprint, THUMBPRINT_LENGTH ));
              Console.WriteLine ("Issuer: " + oCert.GetInfo(CAPICOM_CERT_INFO_TYPE.CAPICOM_CERT_INFO_ISSUER_SIMPLE_NAME));
              Console.WriteLine ("Validity Period: " + oCert.ValidFromDate + " - " + oCert.ValidToDate);
              DisplayEKU(oCert.ExtendedKeyUsage().EKUs);
              Console.WriteLine();
              Console.Write("Are you sure you want to delete this certificate (y/n)? ");
              answer = Console.ReadLine();
              if (!answer.Equals("y"))
              {
                break;
              }

              if (oCert.HasPrivateKey() && !oCert.PrivateKey.IsHardwareDevice() )
              {
                oCert.PrivateKey.Delete();
                Console.WriteLine ("The private key was deleted.");
              }
              try
              {
                _oCurrStore.Remove(oCert);
                Console.WriteLine("The certificate was removed.");
              }
              catch
              {
                Console.WriteLine("The certificate could not be removed.");
              }
            }
            else
            {
              Console.WriteLine ("No certificate with that index (" + alArgs[1] + ") could be found.");
            }
          }
          catch (Exception e)
          {
            Console.WriteLine ("An error was encountered processing the " + alArgs[0] + " command: " + e.Message);
          }
          break;
        case "e":
        case "export":
          try
          {
            oCert = GetCertByIndex(Convert.ToInt32(alArgs[1]));
            if (oCert != null )
            {
              String filename =  (String)alArgs[2];
              if (filename != null)
              {
                oCert.Save(filename,
                  "",
                  CAPICOM_CERTIFICATE_SAVE_AS_TYPE.CAPICOM_CERTIFICATE_SAVE_AS_CER,
                  CAPICOM_CERTIFICATE_INCLUDE_OPTION.CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY);

              }
              else
              {
                Console.WriteLine("No filename specified.");
              }
            }
            else
            {
              Console.WriteLine ("No certificate with that index (" + alArgs[1] + ") could be found.");
            }
          }
          catch (Exception e)
          {
            Console.WriteLine ("An error was encountered processing the " + alArgs[0] + " command: " + e.Message);
          }
          break;
        case "i":
        case "import":
          try
          {
            String filename = null;
            String password = null;
            CAPICOM_KEY_STORAGE_FLAG iFlag = CAPICOM_KEY_STORAGE_FLAG.CAPICOM_KEY_STORAGE_DEFAULT;

            if (alArgs.Count >= 2)
            {
              filename = (String)alArgs[1];
            }
            if (alArgs.Count >= 3)
            {
              password = (String)alArgs[2];
            }
            if (alArgs.Count >= 4)
            {
              String flag = null;
              if (alArgs.Count == 4)
              {
                password = null;
                flag = (String)alArgs[3];
              }
              else if (alArgs.Count == 5)
              {
                flag = (String)alArgs[4];
              }
              if (flag.Equals ("e"))
              {
                iFlag = CAPICOM_KEY_STORAGE_FLAG.CAPICOM_KEY_STORAGE_EXPORTABLE;
              }
              else if (flag.Equals ("p"))
              {
                iFlag = CAPICOM_KEY_STORAGE_FLAG.CAPICOM_KEY_STORAGE_USER_PROTECTED;
              }
              else if (flag.Equals ("ep") || flag.Equals ("pe"))
              {
                iFlag = CAPICOM_KEY_STORAGE_FLAG.CAPICOM_KEY_STORAGE_USER_PROTECTED | CAPICOM_KEY_STORAGE_FLAG.CAPICOM_KEY_STORAGE_EXPORTABLE;
              }
            }
            _oCurrStore.Load(filename, password, iFlag);
          }
          catch (Exception e)
          {
            Console.WriteLine ("An error was encountered processing the " + alArgs[0] + " command: " + e.Message);
          }
          break;
        case "p":
        case "pfxexport":
          try
          {
            oCert = GetCertByIndex(Convert.ToInt32(alArgs[1]));
            if (oCert != null )
            {
              String filename =  (String)alArgs[2];
              String password =  (String)alArgs[3];

              if (filename != null)
              {
                oCert.Save(filename,
                  password,
                  CAPICOM_CERTIFICATE_SAVE_AS_TYPE.CAPICOM_CERTIFICATE_SAVE_AS_PFX,
                  CAPICOM_CERTIFICATE_INCLUDE_OPTION.CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN);
              }
              else
              {
                Console.WriteLine("No filename specified.");
              }
            }
            else
            {
              Console.WriteLine ("No certificate with that index (" + alArgs[1] + ") could be found.");
            }
          }
          catch (Exception e)
          {
            Console.WriteLine ("An error was encountered processing the " + alArgs[0] + " command: " + e.Message);
          }
          break;
        case "d":
        case "dir":
        {
          Certificates oCerts;
          Listing listing = Listing.Brief;

          if ((_currStoreLocation.Equals(CurrentUser) || _currStoreLocation.Equals(LocalMachine))
            && _currStoreName.Length == 0)
          {
            uint retval = 0;
            uint dwFlags = CERT_SYSTEM_STORE_CURRENT_USER;

            CertEnumSystemStoreCallback StoreCallback = new CertEnumSystemStoreCallback(Storesh.CertEnumSystemStoreCallback);
            if (_currStoreLocation.Equals(LocalMachine))
            {
              dwFlags = CERT_SYSTEM_STORE_LOCAL_MACHINE;
            }
            retval= Win32.CertEnumSystemStore(
              dwFlags,
              0,
              _currStoreName,
              StoreCallback
              );
          }
          else if (alArgs.Count >= 1)
          {
            int i =0 ;
            try
            {
              _currFilter = _oCurrStore.Certificates.GetEnumerator();
              for (i = 1; i < alArgs.Count; i++)
              {
                String param = ((String)alArgs[i]).ToLower();
                if (param.Equals("/l") || param.Equals("-l"))
                {
                  listing = Listing.Long;
                }
                else if (param.Equals("/subject") || param.Equals("-subject"))
                {
                  Object filter = (System.String)alArgs[++i];
                  oCerts = (Certificates)_oCurrStore.Certificates;
                  oCerts = (Certificates)oCerts.Find(CAPICOM_CERTIFICATE_FIND_TYPE.CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME,
                    filter,
                    false);
                  _currFilter = oCerts.GetEnumerator();

                }
                else if (param.Equals("/eku") || param.Equals("-eku"))
                {
                  Object filter = (System.String)alArgs[++i];
                  oCerts = (Certificates)_oCurrStore.Certificates;
                  oCerts = (Certificates)oCerts.Find(CAPICOM_CERTIFICATE_FIND_TYPE.CAPICOM_CERTIFICATE_FIND_APPLICATION_POLICY,
                    filter,
                    false);
                  _currFilter = oCerts.GetEnumerator();

                }
                else if (param.Equals("/issuer") || param.Equals("-issuer"))
                {
                  Object filter = (System.String)alArgs[++i];
                  oCerts = (Certificates)_oCurrStore.Certificates;
                  oCerts = (Certificates)oCerts.Find(CAPICOM_CERTIFICATE_FIND_TYPE.CAPICOM_CERTIFICATE_FIND_ISSUER_NAME,
                    filter,
                    false);
                  _currFilter = oCerts.GetEnumerator();

                }
                else if (param.Equals("/sha1") || param.Equals("-sha1"))
                {
                  String filter = (String)alArgs[++i];
                  oCerts = (Certificates)_oCurrStore.Certificates;
                  oCerts = (Certificates)oCerts.Find(CAPICOM_CERTIFICATE_FIND_TYPE.CAPICOM_CERTIFICATE_FIND_SHA1_HASH,
                    filter,
                    false);
                  _currFilter = oCerts.GetEnumerator();
                }
              }
              i = 1;
              while (_currFilter.MoveNext() == true)
              {
                oCert = (Certificate) _currFilter.Current;
                Console.Write ( (i++ + ". ").PadRight(4,' '));
                switch (listing)
                {
                  case Listing.Brief:
                    Console.WriteLine(  ToColumn (oCert.GetInfo(CAPICOM_CERT_INFO_TYPE.CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME), CERTNAME_LENGTH) +
                      " " +
                      ToColumn (oCert.ValidToDate.ToString(), VALIDITY_LENGTH) +
                      ToColumn (oCert.GetInfo(CAPICOM_CERT_INFO_TYPE.CAPICOM_CERT_INFO_ISSUER_SIMPLE_NAME), CERTNAME_LENGTH) );
                    break;
                  case Listing.Long:
                  {
                    Console.WriteLine(  ToColumn (oCert.GetInfo(CAPICOM_CERT_INFO_TYPE.CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME), CERTNAME_LENGTH) +
                      " " +
                      ToColumn (oCert.Thumbprint, THUMBPRINT_LENGTH ));
                    Console.WriteLine ("Issuer: " + oCert.GetInfo(CAPICOM_CERT_INFO_TYPE.CAPICOM_CERT_INFO_ISSUER_SIMPLE_NAME));
                    Console.WriteLine ("Validity Period: " + oCert.ValidFromDate + " - " + oCert.ValidToDate);
                    DisplayEKU(oCert.ExtendedKeyUsage().EKUs);
                    Console.WriteLine();
                    break;
                  }
                }
              }
            }
            catch (Exception e)
            {
              Console.WriteLine("An error was encountered: " + e.Message);
            }
          }
          break;
        }
        default:
          DisplayHelp();
          break;

      }

      return false;
    }

static String storesh::Storesh::ToColumn | ( | String | s,
 |  | int | i |
 | ) |  |  | [inline, static]

Definition at line 681 of file storesh.cs.

    {
      String retval;
      if (s == null || i > s.Length )
      {
        retval = s.PadRight(i);
      }
      else
      {
        retval = s.Substring(0,i).PadRight(i,' ');
      }
      return retval;
    }

static void storesh::Storesh::waitForInput ( ) [inline, static, private]

Definition at line 127 of file storesh.cs.

    {
      bool done = false;
      String input;
      while (!done)
      {
        Console.Write(_currStoreLocation + "\\" + _currStoreName + ">");
        input = Console.ReadLine();
        done = parseCommandLine(input);
      }
    }

Member Data Documentation

IEnumerator storesh::Storesh::_currFilter [static, private]

Definition at line 102 of file storesh.cs.

String storesh::Storesh::_currStoreLocation = CurrentUser [static, private]

Definition at line 101 of file storesh.cs.

String storesh::Storesh::_currStoreName = "My" [static, private]

Definition at line 100 of file storesh.cs.

StoreClass storesh::Storesh::_oCurrStore [static, private]

Definition at line 103 of file storesh.cs.

const int storesh::Storesh::CAPICOM_ENCODED_DATA_FORMAT_MULTI_LINES = 1 [private]

Definition at line 95 of file storesh.cs.

const uint storesh::Storesh::CERT_SYSTEM_STORE_CURRENT_USER = 0x10000 [private]

Definition at line 89 of file storesh.cs.

const uint storesh::Storesh::CERT_SYSTEM_STORE_LOCAL_MACHINE = 0x20000 [private]

Definition at line 90 of file storesh.cs.

const int storesh::Storesh::CERTNAME_LENGTH = 20 [private]

Definition at line 92 of file storesh.cs.

const String storesh::Storesh::CurrentUser = "CurrentUser" [private]

Definition at line 97 of file storesh.cs.

const int storesh::Storesh::FRIENDLYNAME_LENGTH = 20 [private]

Definition at line 94 of file storesh.cs.

const int storesh::Storesh::HELP_PAD = 30 [private]

Definition at line 96 of file storesh.cs.

const String storesh::Storesh::LocalMachine = "LocalMachine" [private]

Definition at line 98 of file storesh.cs.

const int storesh::Storesh::THUMBPRINT_LENGTH = 42 [private]

Definition at line 93 of file storesh.cs.

const int storesh::Storesh::VALIDITY_LENGTH = 23 [private]

Definition at line 91 of file storesh.cs.

The documentation for this class was generated from the following file:
  • Security/capicom/c_sharp/storesh/storesh.cs
Generated on Wed Nov 13 2024 16:58:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: storesh::Win32 Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • storesh
  • storesh::Win32
Public Member Functions

storesh::Win32 Class Reference

List of all members.

Public Member Functions

static uint CertEnumSystemStore (uint dwFlags, uint pvSystemStoreLocationPara, String pvArg, CertEnumSystemStoreCallback pfnEnum)

Detailed Description

Definition at line 58 of file storesh.cs.

Member Function Documentation

static uint storesh::Win32::CertEnumSystemStore | ( | uint | dwFlags,
 |  | uint | pvSystemStoreLocationPara,
 |  | String | pvArg,
 |  | CertEnumSystemStoreCallback | pfnEnum
 | ) |  |
The documentation for this class was generated from the following file:
  • Security/capicom/c_sharp/storesh/storesh.cs
Generated on Wed Nov 13 2024 16:58:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: STR_BINDING Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

STR_BINDING Struct Reference

List of all members.

Public Attributes

BOOL fChar
SQLINTEGER | indPtr
SQLSMALLINT | siDisplaySize
struct STR_BINDING * | sNext
TCHAR * | szBuffer

Detailed Description

Definition at line 56 of file odbcsql.c.

Member Data Documentation

BOOL STR_BINDING::fChar

Definition at line 60 of file odbcsql.c.

SQLINTEGER STR_BINDING::indPtr

Definition at line 59 of file odbcsql.c.

SQLSMALLINT STR_BINDING::siDisplaySize

Definition at line 57 of file odbcsql.c.

struct STR_BINDING* STR_BINDING::sNext

Definition at line 61 of file odbcsql.c.

TCHAR* STR_BINDING::szBuffer

Definition at line 58 of file odbcsql.c.

The documentation for this struct was generated from the following file:
  • Dataaccess/odbc/odbcsql/odbcsql.c
Generated on Wed Nov 13 2024 16:57:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: STYLE Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

STYLE Struct Reference

#include "Global.h"

List of all members.

Public Attributes

HFONT | hf
SCRIPT_CACHE | sc

Detailed Description

Definition at line 33 of file Global.h.

Member Data Documentation

HFONT STYLE::hf

Definition at line 34 of file Global.h.

SCRIPT_CACHE STYLE::sc

Definition at line 35 of file Global.h.

The documentation for this struct was generated from the following file:
  • WinUI/GlobalDev/CSSamp/Global.h
Generated on Wed Nov 13 2024 16:57:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SupportConcurList Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

SupportConcurList Struct Reference

#include "quiktest.h"

List of all members.

Public Attributes

UWORD Option
UDWORD Support

Detailed Description

Definition at line 177 of file quiktest.h.

Member Data Documentation

UWORD SupportConcurList::Option

Definition at line 179 of file quiktest.h.

UDWORD SupportConcurList::Support

Definition at line 178 of file quiktest.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/odbc/quiktest/quiktest.h
Generated on Wed Nov 13 2024 16:57:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SupportOptList Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

SupportOptList Struct Reference

#include "quiktest.h"

List of all members.

Public Attributes

SDWORD Option
UDWORD Support

Detailed Description

Definition at line 172 of file quiktest.h.

Member Data Documentation

SDWORD SupportOptList::Option

Definition at line 174 of file quiktest.h.

UDWORD SupportOptList::Support

Definition at line 173 of file quiktest.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/odbc/quiktest/quiktest.h
Generated on Wed Nov 13 2024 16:57:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: t_Ctype Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

t_Ctype Struct Reference

List of all members.

Public Attributes

WORD fVal [3]
LPTSTR pszName

Detailed Description

Definition at line 536 of file APP.Cxx.

Member Data Documentation

WORD t_Ctype::fVal[3]

Definition at line 538 of file APP.Cxx.

LPTSTR t_Ctype::pszName

Definition at line 539 of file APP.Cxx.

The documentation for this struct was generated from the following file:
  • Multimedia/Gdi/Fonts/GridFont/APP.Cxx
Generated on Wed Nov 13 2024 16:57:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Table Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

Table Struct Reference

#include "tpriv.h"

List of all members.

Public Attributes

int | avewidth
TableHdr hdr
int | nlines
lpCellPos pcellpos
lpColProps pcolhdr
lpLineData pdata
int | rowheight
int | rowwidth
int | scroll_dx
long | scrollscale
TableSelection select
BOOL selvisible
BOOL show_whitespace
int | tabchars
long | toprow
int | trackline1
int | trackline2
UINT trackmode
int | tracknr
int | winwidth

Detailed Description

Definition at line 35 of file tpriv.h.

Member Data Documentation

int Table::avewidth

Definition at line 41 of file tpriv.h.

TableHdr Table::hdr

Definition at line 37 of file tpriv.h.

int Table::nlines

Definition at line 45 of file tpriv.h.

lpCellPos Table::pcellpos

Definition at line 47 of file tpriv.h.

lpColProps Table::pcolhdr

Definition at line 38 of file tpriv.h.

lpLineData Table::pdata

Definition at line 55 of file tpriv.h.

int Table::rowheight

Definition at line 42 of file tpriv.h.

int Table::rowwidth

Definition at line 43 of file tpriv.h.

int Table::scroll_dx

Definition at line 52 of file tpriv.h.

long Table::scrollscale

Definition at line 50 of file tpriv.h.

TableSelection Table::select

Definition at line 63 of file tpriv.h.

BOOL Table::selvisible

Definition at line 62 of file tpriv.h.

BOOL Table::show_whitespace

Definition at line 69 of file tpriv.h.

int Table::tabchars

Definition at line 66 of file tpriv.h.

long Table::toprow

Definition at line 51 of file tpriv.h.

int Table::trackline1

Definition at line 60 of file tpriv.h.

int Table::trackline2

Definition at line 61 of file tpriv.h.

UINT Table::trackmode

Definition at line 58 of file tpriv.h.

int Table::tracknr

Definition at line 59 of file tpriv.h.

int Table::winwidth

Definition at line 44 of file tpriv.h.

The documentation for this struct was generated from the following file:
  • Begin/sdkdiff/tpriv.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TableHdr Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

TableHdr Struct Reference

#include "table.h"

List of all members.

Public Attributes

int | fixedcols
int | fixedrows
BOOL fixedselectable
BOOL hseparator
DWORD_PTR | id
int | ncols
long | nrows
Props props
UINT selectmode
BOOL sendscroll
BOOL vseparator

Detailed Description

Definition at line 180 of file table.h.

Member Data Documentation

int TableHdr::fixedcols

Definition at line 188 of file table.h.

int TableHdr::fixedrows

Definition at line 187 of file table.h.

BOOL TableHdr::fixedselectable

Definition at line 189 of file table.h.

BOOL TableHdr::hseparator

Definition at line 190 of file table.h.

DWORD_PTR TableHdr::id

Definition at line 181 of file table.h.

int TableHdr::ncols

Definition at line 185 of file table.h.

long TableHdr::nrows

Definition at line 184 of file table.h.

Props TableHdr::props

Definition at line 196 of file table.h.

UINT TableHdr::selectmode

Definition at line 193 of file table.h.

BOOL TableHdr::sendscroll

Definition at line 194 of file table.h.

BOOL TableHdr::vseparator

Definition at line 191 of file table.h.

The documentation for this struct was generated from the following file:
  • Begin/sdkdiff/table.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TABLEINFO Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

TABLEINFO Struct Reference

#include "table.h"

List of all members.

Public Attributes

WCHAR | wszCatalogName [MAX_NAME_LEN]
WCHAR | wszSchemaName [MAX_NAME_LEN]
WCHAR | wszTableName [MAX_NAME_LEN]
WCHAR | wszType [MAX_NAME_LEN]

Detailed Description

Definition at line 79 of file table.h.

Member Data Documentation

WCHAR TABLEINFO::wszCatalogName[MAX_NAME_LEN]

Definition at line 81 of file table.h.

WCHAR TABLEINFO::wszSchemaName[MAX_NAME_LEN]

Definition at line 82 of file table.h.

WCHAR TABLEINFO::wszTableName[MAX_NAME_LEN]

Definition at line 83 of file table.h.

WCHAR TABLEINFO::wszType[MAX_NAME_LEN]

Definition at line 84 of file table.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/oledb/tablecopy/table.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TableSelection Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

TableSelection Struct Reference

#include "table.h"

List of all members.

Public Attributes

long | dyRowsFromTop
DWORD_PTR | id
long | ncells
long | nrows
long | startcell
long | startrow

Detailed Description

Definition at line 276 of file table.h.

Member Data Documentation

long TableSelection::dyRowsFromTop

Definition at line 282 of file table.h.

DWORD_PTR TableSelection::id

Definition at line 277 of file table.h.

long TableSelection::ncells

Definition at line 281 of file table.h.

long TableSelection::nrows

Definition at line 280 of file table.h.

long TableSelection::startcell

Definition at line 279 of file table.h.

long TableSelection::startrow

Definition at line 278 of file table.h.

The documentation for this struct was generated from the following file:
  • Begin/sdkdiff/table.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tag_BASENODE_PROPERTIES Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tag_BASENODE_PROPERTIES Struct Reference

#include "basenode.h"

List of all members.

Public Attributes

DWORD dwAttributes
LONG_PTR | pComponentData
LONG_PTR | pParentObject
WCHAR | szNodeName [MAX_NAME_LEN]

Detailed Description

Definition at line 32 of file basenode.h.

Member Data Documentation

DWORD tag_BASENODE_PROPERTIES::dwAttributes

Definition at line 40 of file basenode.h.

LONG_PTR tag_BASENODE_PROPERTIES::pComponentData

Definition at line 35 of file basenode.h.

LONG_PTR tag_BASENODE_PROPERTIES::pParentObject

Definition at line 39 of file basenode.h.

WCHAR tag_BASENODE_PROPERTIES::szNodeName

Definition at line 34 of file basenode.h.

The documentation for this struct was generated from the following files:
  • SysMgmt/MMC/mmc2.0/about/basenode.h
  • SysMgmt/MMC/mmc2.0/contextmenu/basenode.h
  • SysMgmt/MMC/mmc2.0/help/basenode.h
  • SysMgmt/MMC/mmc2.0/multisel/basenode.h
  • SysMgmt/MMC/mmc2.0/proppage/basenode.h
  • SysMgmt/MMC/mmc2.0/simple/basenode.h
  • SysMgmt/MMC/mmc2.0/viewex/basenode.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tag_chunkhdr Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tag_chunkhdr Struct Reference

#include "SMFI.h"

List of all members.

Public Attributes

DWORD dwLength
FOURCC fourccType

Detailed Description

Definition at line 132 of file SMFI.h.

Member Data Documentation

DWORD tag_chunkhdr::dwLength

Definition at line 135 of file SMFI.h.

FOURCC tag_chunkhdr::fourccType

Definition at line 134 of file SMFI.h.

The documentation for this struct was generated from the following file:
  • Multimedia/Audio/MidiPlyr/SMFI.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tag_filehdr Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tag_filehdr Struct Reference

#include "SMFI.h"

List of all members.

Public Attributes

WORD | wDivision
WORD | wFormat
WORD | wTracks

Detailed Description

Definition at line 140 of file SMFI.h.

Member Data Documentation

WORD tag_filehdr::wDivision

Definition at line 144 of file SMFI.h.

WORD tag_filehdr::wFormat

Definition at line 142 of file SMFI.h.

WORD tag_filehdr::wTracks

Definition at line 143 of file SMFI.h.

The documentation for this struct was generated from the following file:
  • Multimedia/Audio/MidiPlyr/SMFI.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tag_keyframe Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tag_keyframe Struct Reference

List of all members.

Public Attributes

BYTE | rbControl [16 *120]
BYTE | rbProgram [16]
BYTE | rbTempo [3]

Detailed Description

Definition at line 699 of file SMF.c.

Member Data Documentation

BYTE tag_keyframe::rbControl[16 *120]

Definition at line 710 of file SMF.c.

BYTE tag_keyframe::rbProgram[16]

Definition at line 709 of file SMF.c.

BYTE tag_keyframe::rbTempo[3]

Definition at line 704 of file SMF.c.

The documentation for this struct was generated from the following file:
  • Multimedia/Audio/MidiPlyr/SMF.c
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tag_preroll Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tag_preroll Struct Reference

#include "SEQ.h"

List of all members.

Public Attributes

TICKS tkBase
TICKS tkEnd

Detailed Description

Definition at line 43 of file SEQ.h.

Member Data Documentation

TICKS tag_preroll::tkBase

Definition at line 45 of file SEQ.h.

TICKS tag_preroll::tkEnd

Definition at line 46 of file SEQ.h.

The documentation for this struct was generated from the following file:
  • Multimedia/Audio/MidiPlyr/SEQ.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tag_seq Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tag_seq Struct Reference

#include "SEQ.h"

List of all members.

Public Attributes

DWORD cbBuffer
DWORD cbPreroll
DWORD cBuffer
DWORD cTrk
DWORD dwTimeDivision
DWORD fdwSeq
HMIDIOUT | hmidi
HSMF | hSmf
HWND | hWnd
LPBYTE | lpbAlloc
LPMIDIHDR | lpmhFree
LPMIDIHDR | lpmhPreroll
MMRESULT | mmrcLastErr
PSEQ pNext
LPSTR pstrFile
TICKS tkBase
TICKS tkEnd
TICKS tkLength
UINT uBuffersInMMSYSTEM
UINT uDeviceID
UINT uMCIDeviceID
UINT uMCITimeDiv
UINT uMCITimeFormat
UINT uState

Detailed Description

Definition at line 51 of file SEQ.h.

Member Data Documentation

DWORD tag_seq::cbBuffer

Definition at line 54 of file SEQ.h.

DWORD tag_seq::cbPreroll

Definition at line 75 of file SEQ.h.

DWORD tag_seq::cBuffer

Definition at line 53 of file SEQ.h.

DWORD tag_seq::cTrk

Definition at line 64 of file SEQ.h.

DWORD tag_seq::dwTimeDivision

Definition at line 70 of file SEQ.h.

DWORD tag_seq::fdwSeq

Definition at line 81 of file SEQ.h.

HMIDIOUT tag_seq::hmidi

Definition at line 69 of file SEQ.h.

HSMF tag_seq::hSmf

Definition at line 68 of file SEQ.h.

HWND tag_seq::hWnd

Definition at line 60 of file SEQ.h.

LPBYTE tag_seq::lpbAlloc

Definition at line 72 of file SEQ.h.

LPMIDIHDR tag_seq::lpmhFree

Definition at line 73 of file SEQ.h.

LPMIDIHDR tag_seq::lpmhPreroll

Definition at line 74 of file SEQ.h.

MMRESULT tag_seq::mmrcLastErr

Definition at line 65 of file SEQ.h.

PSEQ tag_seq::pNext

Definition at line 67 of file SEQ.h.

LPSTR tag_seq::pstrFile

Definition at line 55 of file SEQ.h.

TICKS tag_seq::tkBase

Definition at line 78 of file SEQ.h.

TICKS tag_seq::tkEnd

Definition at line 79 of file SEQ.h.

TICKS tag_seq::tkLength

Definition at line 63 of file SEQ.h.

UINT tag_seq::uBuffersInMMSYSTEM

Definition at line 76 of file SEQ.h.

UINT tag_seq::uDeviceID

Definition at line 56 of file SEQ.h.

UINT tag_seq::uMCIDeviceID

Definition at line 57 of file SEQ.h.

UINT tag_seq::uMCITimeDiv

Definition at line 59 of file SEQ.h.

UINT tag_seq::uMCITimeFormat

Definition at line 58 of file SEQ.h.

UINT tag_seq::uState

Definition at line 62 of file SEQ.h.

The documentation for this struct was generated from the following file:
  • Multimedia/Audio/MidiPlyr/SEQ.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tag_smf Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tag_smf Struct Reference

#include "SMFI.h"

List of all members.

Public Attributes

DWORD cbImage
DWORD cbPendingUserEvent
DWORD cTempoMap
DWORD cTempoMapAlloc
DWORD dwFormat
DWORD dwPendingUserEvent
DWORD dwTimeDivision
DWORD dwTracks
DWORD fdwSMF
HPBYTE hpbImage
HPBYTE hpbPendingUserEvent
HTASK | htask
HLOCAL | hTempoMap
PTEMPOMAPENTRY pTempoMap
TRACK rTracks []
char | szName [128]
TICKS tkLength
TICKS tkPosition

Detailed Description

Definition at line 57 of file SMFI.h.

Member Data Documentation

DWORD tag_smf::cbImage

Definition at line 61 of file SMFI.h.

DWORD tag_smf::cbPendingUserEvent

Definition at line 77 of file SMFI.h.

DWORD tag_smf::cTempoMap

Definition at line 71 of file SMFI.h.

DWORD tag_smf::cTempoMapAlloc

Definition at line 72 of file SMFI.h.

DWORD tag_smf::dwFormat

Definition at line 66 of file SMFI.h.

DWORD tag_smf::dwPendingUserEvent

Definition at line 76 of file SMFI.h.

DWORD tag_smf::dwTimeDivision

Definition at line 68 of file SMFI.h.

DWORD tag_smf::dwTracks

Definition at line 67 of file SMFI.h.

DWORD tag_smf::fdwSMF

Definition at line 69 of file SMFI.h.

HPBYTE tag_smf::hpbImage

Definition at line 60 of file SMFI.h.

HPBYTE tag_smf::hpbPendingUserEvent

Definition at line 78 of file SMFI.h.

HTASK tag_smf::htask

Definition at line 62 of file SMFI.h.

HLOCAL tag_smf::hTempoMap

Definition at line 73 of file SMFI.h.

PTEMPOMAPENTRY tag_smf::pTempoMap

Definition at line 74 of file SMFI.h.

TRACK tag_smf::rTracks[]

Definition at line 80 of file SMFI.h.

char tag_smf::szName[128]

Definition at line 59 of file SMFI.h.

TICKS tag_smf::tkLength

Definition at line 65 of file SMFI.h.

TICKS tag_smf::tkPosition

Definition at line 64 of file SMFI.h.

The documentation for this struct was generated from the following file:
  • Multimedia/Audio/MidiPlyr/SMFI.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tag_smffileinfo Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tag_smffileinfo Struct Reference

#include "SMF.h"

List of all members.

Public Attributes

DWORD dwFormat
DWORD dwTimeDivision
DWORD dwTracks
TICKS tkLength

Detailed Description

Definition at line 60 of file SMF.h.

Member Data Documentation

DWORD tag_smffileinfo::dwFormat

Definition at line 63 of file SMF.h.

DWORD tag_smffileinfo::dwTimeDivision

Definition at line 64 of file SMF.h.

DWORD tag_smffileinfo::dwTracks

Definition at line 62 of file SMF.h.

TICKS tag_smffileinfo::tkLength

Definition at line 65 of file SMF.h.

The documentation for this struct was generated from the following file:
  • Multimedia/Audio/MidiPlyr/SMF.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tag_smfopenstruct Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tag_smfopenstruct Struct Reference

#include "SMF.h"

List of all members.

Public Attributes

DWORD dwTimeDivision
HSMF hSmf
LPSTR pstrName

Detailed Description

Definition at line 46 of file SMF.h.

Member Data Documentation

DWORD tag_smfopenstruct::dwTimeDivision

Definition at line 49 of file SMF.h.

HSMF tag_smfopenstruct::hSmf

Definition at line 50 of file SMF.h.

LPSTR tag_smfopenstruct::pstrName

Definition at line 48 of file SMF.h.

The documentation for this struct was generated from the following file:
  • Multimedia/Audio/MidiPlyr/SMF.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tag_tempomapentry Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tag_tempomapentry Struct Reference

#include "SMFI.h"

List of all members.

Public Attributes

DWORD dwTempo
DWORD msBase
TICKS tkTempo

Detailed Description

Definition at line 20 of file SMFI.h.

Member Data Documentation

DWORD tag_tempomapentry::dwTempo

Definition at line 24 of file SMFI.h.

DWORD tag_tempomapentry::msBase

Definition at line 23 of file SMFI.h.

TICKS tag_tempomapentry::tkTempo

Definition at line 22 of file SMFI.h.

The documentation for this struct was generated from the following file:
  • Multimedia/Audio/MidiPlyr/SMFI.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tag_track Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tag_track Struct Reference

#include "SMFI.h"

List of all members.

Public Attributes

BYTE bRunningStatus
DWORD cbLeft
DWORD fdwTrack
HPBYTE hpbImage
DWORD idxTrack
PSMF pSmf
struct {
DWORD cbLength
TICKS tkLength
} smti
TICKS tkPosition

Detailed Description

Definition at line 30 of file SMFI.h.

Member Data Documentation

BYTE tag_track::bRunningStatus

Definition at line 39 of file SMFI.h.

DWORD tag_track::cbLeft

Definition at line 37 of file SMFI.h.

DWORD tag_track::cbLength

Definition at line 46 of file SMFI.h.

DWORD tag_track::fdwTrack

Definition at line 41 of file SMFI.h.

HPBYTE tag_track::hpbImage

Definition at line 38 of file SMFI.h.

DWORD tag_track::idxTrack

Definition at line 34 of file SMFI.h.

PSMF tag_track::pSmf

Definition at line 32 of file SMFI.h.

struct { ... } tag_track::smti
TICKS tag_track::tkLength

Definition at line 45 of file SMFI.h.

TICKS tag_track::tkPosition

Definition at line 36 of file SMFI.h.

The documentation for this struct was generated from the following file:
  • Multimedia/Audio/MidiPlyr/SMFI.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagACCESSOR Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagACCESSOR Struct Reference

#include "sampprov.h"

List of all members.

Public Attributes

DBCOUNTITEM | cBindings
DBREFCOUNT | cRef
DBACCESSORFLAGS | dwAccessorFlags
DBBINDING | rgBindings [1]

Detailed Description

Definition at line 117 of file sampprov.h.

Member Data Documentation

DBCOUNTITEM tagACCESSOR::cBindings

Definition at line 121 of file sampprov.h.

DBREFCOUNT tagACCESSOR::cRef

Definition at line 120 of file sampprov.h.

DBACCESSORFLAGS tagACCESSOR::dwAccessorFlags

Definition at line 119 of file sampprov.h.

DBBINDING tagACCESSOR::rgBindings[1]

Definition at line 122 of file sampprov.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/oledb/sampprov/sampprov.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagADSERRMSG Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagADSERRMSG Struct Reference

#include "StdAfx.h"

List of all members.

Public Attributes

HRESULT | hr
LPCTSTR | pszError

Detailed Description

Definition at line 35 of file StdAfx.h.

Member Data Documentation

HRESULT tagADSERRMSG::hr

Definition at line 37 of file StdAfx.h.

LPCTSTR tagADSERRMSG::pszError

Definition at line 38 of file StdAfx.h.

The documentation for this struct was generated from the following file:
  • NetDS/ADSI/samples/General/ADQI/StdAfx.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagADSIIF Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagADSIIF Struct Reference

#include "StdAfx.h"

List of all members.

Public Attributes

ADSDLGPROC pFn
const GUID * pIID
LPTSTR szIf

Detailed Description

Definition at line 28 of file StdAfx.h.

Member Data Documentation

ADSDLGPROC tagADSIIF::pFn

Definition at line 32 of file StdAfx.h.

const GUID* tagADSIIF::pIID

Definition at line 30 of file StdAfx.h.

LPTSTR tagADSIIF::szIf

Definition at line 31 of file StdAfx.h.

The documentation for this struct was generated from the following file:
  • NetDS/ADSI/samples/General/ADQI/StdAfx.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagAppletCapability Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagAppletCapability Struct Reference

#include "iapplet.h"

List of all members.

Public Attributes

AppletCapabilityClass CapClass
AppletCapabilityID CapID
ULONG cEntities

Detailed Description

Definition at line 300 of file iapplet.h.

Member Data Documentation

AppletCapabilityClass tagAppletCapability::CapClass

Definition at line 303 of file iapplet.h.

AppletCapabilityID tagAppletCapability::CapID

Definition at line 302 of file iapplet.h.

ULONG tagAppletCapability::cEntities

Definition at line 304 of file iapplet.h.

The documentation for this struct was generated from the following file:
  • Web/NetMeeting/NMChat2/iapplet.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagAppletCapability2 Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagAppletCapability2 Struct Reference

#include "iapplet.h"

List of all members.

Public Attributes

AppletCapabilityID CapID
AppletOctetString __RPC_FAR * pCapData

Detailed Description

Definition at line 307 of file iapplet.h.

Member Data Documentation

AppletCapabilityID tagAppletCapability2::CapID

Definition at line 309 of file iapplet.h.

AppletOctetString __RPC_FAR* tagAppletCapability2::pCapData

Definition at line 310 of file iapplet.h.

The documentation for this struct was generated from the following file:
  • Web/NetMeeting/NMChat2/iapplet.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagAppletCapabilityClass Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagAppletCapabilityClass Struct Reference

#include "iapplet.h"

List of all members.

Public Attributes

AppletCapabilityType eType
ULONG nMinOrMax

Detailed Description

Definition at line 179 of file iapplet.h.

Member Data Documentation

AppletCapabilityType tagAppletCapabilityClass::eType

Definition at line 181 of file iapplet.h.

ULONG tagAppletCapabilityClass::nMinOrMax

Definition at line 182 of file iapplet.h.

The documentation for this struct was generated from the following file:
  • Web/NetMeeting/NMChat2/iapplet.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagAppletCapabilityID Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagAppletCapabilityID Struct Reference

#include "iapplet.h"

List of all members.

Public Attributes

AppletCapIDType eType
AppletObjectKey nNonStdCap
ULONG nStdCap

Detailed Description

Definition at line 293 of file iapplet.h.

Member Data Documentation

AppletCapIDType tagAppletCapabilityID::eType

Definition at line 295 of file iapplet.h.

AppletObjectKey tagAppletCapabilityID::nNonStdCap

Definition at line 296 of file iapplet.h.

ULONG tagAppletCapabilityID::nStdCap

Definition at line 297 of file iapplet.h.

The documentation for this struct was generated from the following file:
  • Web/NetMeeting/NMChat2/iapplet.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagAppletChannelRequest Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagAppletChannelRequest Struct Reference

#include "iapplet.h"

List of all members.

Public Attributes

AppletUserID __RPC_FAR * aUsers
ULONG cUsers
AppletChannelCommand eCommand
AppletChannelID nChannelID

Detailed Description

Definition at line 277 of file iapplet.h.

Member Data Documentation

AppletUserID __RPC_FAR* tagAppletChannelRequest::aUsers

Definition at line 282 of file iapplet.h.

ULONG tagAppletChannelRequest::cUsers

Definition at line 281 of file iapplet.h.

AppletChannelCommand tagAppletChannelRequest::eCommand

Definition at line 279 of file iapplet.h.

AppletChannelID tagAppletChannelRequest::nChannelID

Definition at line 280 of file iapplet.h.

The documentation for this struct was generated from the following file:
  • Web/NetMeeting/NMChat2/iapplet.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagAppletLongString Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagAppletLongString Struct Reference

#include "iapplet.h"

List of all members.

Public Attributes

ULONG nStrLen
ULONG __RPC_FAR * pnValue

Detailed Description

Definition at line 242 of file iapplet.h.

Member Data Documentation

ULONG tagAppletLongString::nStrLen

Definition at line 244 of file iapplet.h.

ULONG __RPC_FAR* tagAppletLongString::pnValue

Definition at line 245 of file iapplet.h.

The documentation for this struct was generated from the following file:
  • Web/NetMeeting/NMChat2/iapplet.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagAppletObjectKey Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagAppletObjectKey Struct Reference

#include "iapplet.h"

List of all members.

Public Attributes

AppletKeyType eType
AppletLongString lstrObjectID
AppletOctetString ostrH221NonStdID

Detailed Description

Definition at line 248 of file iapplet.h.

Member Data Documentation

AppletKeyType tagAppletObjectKey::eType

Definition at line 250 of file iapplet.h.

AppletLongString tagAppletObjectKey::lstrObjectID

Definition at line 251 of file iapplet.h.

AppletOctetString tagAppletObjectKey::ostrH221NonStdID

Definition at line 252 of file iapplet.h.

The documentation for this struct was generated from the following file:
  • Web/NetMeeting/NMChat2/iapplet.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagAppletOctetString Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagAppletOctetString Struct Reference

#include "iapplet.h"

List of all members.

Public Attributes

ULONG cbStrSize
BYTE __RPC_FAR * pbValue

Detailed Description

Definition at line 236 of file iapplet.h.

Member Data Documentation

ULONG tagAppletOctetString::cbStrSize

Definition at line 238 of file iapplet.h.

BYTE __RPC_FAR* tagAppletOctetString::pbValue

Definition at line 239 of file iapplet.h.

The documentation for this struct was generated from the following file:
  • Web/NetMeeting/NMChat2/iapplet.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagAppletProtocolEntity Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagAppletProtocolEntity Struct Reference

#include "iapplet.h"

List of all members.

Public Attributes

AppletCapability __RPC_FAR
*__RPC_FAR * 		apExpectedCapabilities
ULONG cExpectedCapabilities
AppletChannelType eStartupChannelType
BOOL fMustBeInvoked
AppletSessionKey SessionKey

Detailed Description

Definition at line 313 of file iapplet.h.

Member Data Documentation

AppletCapability __RPC_FAR* __RPC_FAR* tagAppletProtocolEntity::apExpectedCapabilities

Definition at line 319 of file iapplet.h.

ULONG tagAppletProtocolEntity::cExpectedCapabilities

Definition at line 318 of file iapplet.h.

AppletChannelType tagAppletProtocolEntity::eStartupChannelType

Definition at line 316 of file iapplet.h.

BOOL tagAppletProtocolEntity::fMustBeInvoked

Definition at line 317 of file iapplet.h.

AppletSessionKey tagAppletProtocolEntity::SessionKey

Definition at line 315 of file iapplet.h.

The documentation for this struct was generated from the following file:
  • Web/NetMeeting/NMChat2/iapplet.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagAppletRecord Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagAppletRecord Struct Reference

#include "iapplet.h"

List of all members.

Public Attributes

AppletCapability2 __RPC_FAR
*__RPC_FAR * 		apCapabilities
ULONG cCapabilities
AppletChannelType eStartupChannelType
BOOL fConductingCapable
BOOL fEnrolledActively
AppletUserID nAppletUserID
AppletEntityID nEntityID
AppletNodeID nNodeID

Detailed Description

Definition at line 322 of file iapplet.h.

Member Data Documentation

AppletCapability2 __RPC_FAR* __RPC_FAR* tagAppletRecord::apCapabilities

Definition at line 331 of file iapplet.h.

ULONG tagAppletRecord::cCapabilities

Definition at line 330 of file iapplet.h.

AppletChannelType tagAppletRecord::eStartupChannelType

Definition at line 328 of file iapplet.h.

BOOL tagAppletRecord::fConductingCapable

Definition at line 327 of file iapplet.h.

BOOL tagAppletRecord::fEnrolledActively

Definition at line 326 of file iapplet.h.

AppletUserID tagAppletRecord::nAppletUserID

Definition at line 329 of file iapplet.h.

AppletEntityID tagAppletRecord::nEntityID

Definition at line 325 of file iapplet.h.

AppletNodeID tagAppletRecord::nNodeID

Definition at line 324 of file iapplet.h.

The documentation for this struct was generated from the following file:
  • Web/NetMeeting/NMChat2/iapplet.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagAppletRegistryEntryOwner Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagAppletRegistryEntryOwner Struct Reference

#include "iapplet.h"

List of all members.

Public Attributes

BOOL fEntryOwned
AppletEntityID nOwnerEntityID
AppletNodeID nOwnerNodeID

Detailed Description

Definition at line 356 of file iapplet.h.

Member Data Documentation

BOOL tagAppletRegistryEntryOwner::fEntryOwned

Definition at line 358 of file iapplet.h.

AppletEntityID tagAppletRegistryEntryOwner::nOwnerEntityID

Definition at line 360 of file iapplet.h.

AppletNodeID tagAppletRegistryEntryOwner::nOwnerNodeID

Definition at line 359 of file iapplet.h.

The documentation for this struct was generated from the following file:
  • Web/NetMeeting/NMChat2/iapplet.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagAppletRegistryItem Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagAppletRegistryItem Struct Reference

#include "iapplet.h"

List of all members.

Public Attributes

AppletRegistryItemType ItemType
AppletChannelID nChannelID
AppletTokenID nTokenID
AppletOctetString ostrParamValue

Detailed Description

Definition at line 348 of file iapplet.h.

Member Data Documentation

AppletRegistryItemType tagAppletRegistryItem::ItemType

Definition at line 350 of file iapplet.h.

AppletChannelID tagAppletRegistryItem::nChannelID

Definition at line 351 of file iapplet.h.

AppletTokenID tagAppletRegistryItem::nTokenID

Definition at line 352 of file iapplet.h.

AppletOctetString tagAppletRegistryItem::ostrParamValue

Definition at line 353 of file iapplet.h.

The documentation for this struct was generated from the following file:
  • Web/NetMeeting/NMChat2/iapplet.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagAppletRegistryKey Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagAppletRegistryKey Struct Reference

#include "iapplet.h"

List of all members.

Public Attributes

AppletOctetString ostrResourceID
AppletSessionKey SessionKey

Detailed Description

Definition at line 261 of file iapplet.h.

Member Data Documentation

AppletOctetString tagAppletRegistryKey::ostrResourceID

Definition at line 264 of file iapplet.h.

AppletSessionKey tagAppletRegistryKey::SessionKey

Definition at line 263 of file iapplet.h.

The documentation for this struct was generated from the following file:
  • Web/NetMeeting/NMChat2/iapplet.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagAppletRegistryRequest Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagAppletRegistryRequest Struct Reference

#include "iapplet.h"

List of all members.

Public Attributes

ULONG cHandles
AppletRegistryCommand eCommand
AppletModificationRights eParamModifyRights
AppletChannelID nChannelID
AppletOctetString ostrParamValue
AppletRegistryKey RegistryKey

Detailed Description

Definition at line 267 of file iapplet.h.

Member Data Documentation

ULONG tagAppletRegistryRequest::cHandles

Definition at line 274 of file iapplet.h.

AppletRegistryCommand tagAppletRegistryRequest::eCommand

Definition at line 269 of file iapplet.h.

AppletModificationRights tagAppletRegistryRequest::eParamModifyRights

Definition at line 273 of file iapplet.h.

AppletChannelID tagAppletRegistryRequest::nChannelID

Definition at line 271 of file iapplet.h.

AppletOctetString tagAppletRegistryRequest::ostrParamValue

Definition at line 272 of file iapplet.h.

AppletRegistryKey tagAppletRegistryRequest::RegistryKey

Definition at line 270 of file iapplet.h.

The documentation for this struct was generated from the following file:
  • Web/NetMeeting/NMChat2/iapplet.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagAppletRoster Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagAppletRoster Struct Reference

#include "iapplet.h"

List of all members.

Public Attributes

AppletRecord __RPC_FAR *__RPC_FAR * apAppletRecords
AppletCapability __RPC_FAR
*__RPC_FAR * 		apCapabilities
ULONG cCapabilities
ULONG cRecords
BOOL fCapabilitiesChanged
BOOL fNodesAdded
BOOL fNodesRemoved
BOOL fRosterChanged
ULONG nInstanceNumber
AppletSessionKey SessionKey

Detailed Description

Definition at line 334 of file iapplet.h.

Member Data Documentation

AppletRecord __RPC_FAR* __RPC_FAR* tagAppletRoster::apAppletRecords

Definition at line 343 of file iapplet.h.

AppletCapability __RPC_FAR* __RPC_FAR* tagAppletRoster::apCapabilities

Definition at line 345 of file iapplet.h.

ULONG tagAppletRoster::cCapabilities

Definition at line 344 of file iapplet.h.

ULONG tagAppletRoster::cRecords

Definition at line 342 of file iapplet.h.

BOOL tagAppletRoster::fCapabilitiesChanged

Definition at line 341 of file iapplet.h.

BOOL tagAppletRoster::fNodesAdded

Definition at line 339 of file iapplet.h.

BOOL tagAppletRoster::fNodesRemoved

Definition at line 340 of file iapplet.h.

BOOL tagAppletRoster::fRosterChanged

Definition at line 337 of file iapplet.h.

ULONG tagAppletRoster::nInstanceNumber

Definition at line 338 of file iapplet.h.

AppletSessionKey tagAppletRoster::SessionKey

Definition at line 336 of file iapplet.h.

The documentation for this struct was generated from the following file:
  • Web/NetMeeting/NMChat2/iapplet.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagAppletSessionKey Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagAppletSessionKey Struct Reference

#include "iapplet.h"

List of all members.

Public Attributes

AppletObjectKey AppletProtocolKey
AppletSessionID nSessionID

Detailed Description

Definition at line 255 of file iapplet.h.

Member Data Documentation

AppletObjectKey tagAppletSessionKey::AppletProtocolKey

Definition at line 257 of file iapplet.h.

AppletSessionID tagAppletSessionKey::nSessionID

Definition at line 258 of file iapplet.h.

The documentation for this struct was generated from the following file:
  • Web/NetMeeting/NMChat2/iapplet.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagAppletSessionRequest Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagAppletSessionRequest Struct Reference

#include "iapplet.h"

List of all members.

Public Attributes

AppletRegistryKey __RPC_FAR * | aChannelRegistryKeys
AppletCapability __RPC_FAR
*__RPC_FAR * 		apCollapsedCaps
AppletCapability2 __RPC_FAR
*__RPC_FAR * 		apNonCollapsedCaps
AppletChannelID __RPC_FAR * | aStaticChannels
ULONG cCollapsedCaps
ULONG cDynamicChannels
ULONG cNonCollapsedCaps
ULONG cStaticChannels
AppletChannelType nStartupChannelType
AppletSessionKey SessionKey

Detailed Description

Definition at line 363 of file iapplet.h.

Member Data Documentation

AppletRegistryKey __RPC_FAR* tagAppletSessionRequest::aChannelRegistryKeys

Definition at line 374 of file iapplet.h.

AppletCapability __RPC_FAR* __RPC_FAR* tagAppletSessionRequest::apCollapsedCaps

Definition at line 368 of file iapplet.h.

AppletCapability2 __RPC_FAR* __RPC_FAR* tagAppletSessionRequest::apNonCollapsedCaps

Definition at line 370 of file iapplet.h.

AppletChannelID __RPC_FAR* tagAppletSessionRequest::aStaticChannels

Definition at line 372 of file iapplet.h.

ULONG tagAppletSessionRequest::cCollapsedCaps

Definition at line 367 of file iapplet.h.

ULONG tagAppletSessionRequest::cDynamicChannels

Definition at line 373 of file iapplet.h.

ULONG tagAppletSessionRequest::cNonCollapsedCaps

Definition at line 369 of file iapplet.h.

ULONG tagAppletSessionRequest::cStaticChannels

Definition at line 371 of file iapplet.h.

AppletChannelType tagAppletSessionRequest::nStartupChannelType

Definition at line 366 of file iapplet.h.

AppletSessionKey tagAppletSessionRequest::SessionKey

Definition at line 365 of file iapplet.h.

The documentation for this struct was generated from the following file:
  • Web/NetMeeting/NMChat2/iapplet.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagAppletTokenRequest Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagAppletTokenRequest Struct Reference

#include "iapplet.h"

List of all members.

Public Attributes

AppletTokenCommand eCommand
HRESULT hrGiveResponse
AppletTokenID nTokenID
AppletUserID uidGiveTo

Detailed Description

Definition at line 285 of file iapplet.h.

Member Data Documentation

AppletTokenCommand tagAppletTokenRequest::eCommand

Definition at line 287 of file iapplet.h.

HRESULT tagAppletTokenRequest::hrGiveResponse

Definition at line 290 of file iapplet.h.

AppletTokenID tagAppletTokenRequest::nTokenID

Definition at line 288 of file iapplet.h.

AppletUserID tagAppletTokenRequest::uidGiveTo

Definition at line 289 of file iapplet.h.

The documentation for this struct was generated from the following file:
  • Web/NetMeeting/NMChat2/iapplet.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagArFonts Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagArFonts Struct Reference

#include "Paint.h"

List of all members.

Public Attributes

int | cySpace
HDC | hdc
LOGFONT * | lf
int | nFonts
TEXTMETRIC * | tm
int * | Type

Detailed Description

Definition at line 44 of file Paint.h.

Member Data Documentation

int tagArFonts::cySpace

Definition at line 47 of file Paint.h.

HDC tagArFonts::hdc

Definition at line 48 of file Paint.h.

LOGFONT* tagArFonts::lf

Definition at line 49 of file Paint.h.

int tagArFonts::nFonts

Definition at line 46 of file Paint.h.

TEXTMETRIC* tagArFonts::tm

Definition at line 50 of file Paint.h.

int* tagArFonts::Type

Definition at line 51 of file Paint.h.

The documentation for this struct was generated from the following file:
  • Multimedia/Gdi/Printer/Paint.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagBRUSHSTYLELOOKUP Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagBRUSHSTYLELOOKUP Struct Reference

#include "Printer.h"

List of all members.

Public Attributes

int | iBrushStyle
WORD | wMenuItem

Detailed Description

Definition at line 57 of file Printer.h.

Member Data Documentation

int tagBRUSHSTYLELOOKUP::iBrushStyle

Definition at line 60 of file Printer.h.

WORD tagBRUSHSTYLELOOKUP::wMenuItem

Definition at line 59 of file Printer.h.

The documentation for this struct was generated from the following file:
  • Multimedia/Gdi/Printer/Printer.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagCAPSLOOKUP Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagCAPSLOOKUP Struct Reference

#include "Getcaps.h"

List of all members.

Public Attributes

int iValue
LPTSTR szValue

Detailed Description

Definition at line 43 of file Getcaps.h.

Member Data Documentation

int tagCAPSLOOKUP::iValue

Definition at line 45 of file Getcaps.h.

LPTSTR tagCAPSLOOKUP::szValue

Definition at line 46 of file Getcaps.h.

The documentation for this struct was generated from the following file:
  • Multimedia/Gdi/Printer/Getcaps.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagCMTMLTFMT Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagCMTMLTFMT Struct Reference

#include "MfEdit.h"

List of all members.

Public Attributes

EMRFORMAT | aemrformat [1]
DWORD iComment
DWORD ident
DWORD nFormats
RECTL | rclOutput

Detailed Description

Definition at line 528 of file MfEdit.h.

Member Data Documentation

EMRFORMAT tagCMTMLTFMT::aemrformat[1]

Definition at line 533 of file MfEdit.h.

DWORD tagCMTMLTFMT::iComment

Definition at line 530 of file MfEdit.h.

DWORD tagCMTMLTFMT::ident

Definition at line 529 of file MfEdit.h.

DWORD tagCMTMLTFMT::nFormats

Definition at line 532 of file MfEdit.h.

RECTL tagCMTMLTFMT::rclOutput

Definition at line 531 of file MfEdit.h.

The documentation for this struct was generated from the following file:
  • Multimedia/Gdi/Metafile/MfEdit/MfEdit.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagCONSOLEDATA Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagCONSOLEDATA Struct Reference

List of all members.

Public Attributes

int | x
int | y

Detailed Description

Definition at line 35 of file SServer.Cpp.

Member Data Documentation

int tagCONSOLEDATA::x

Definition at line 37 of file SServer.Cpp.

int tagCONSOLEDATA::y

Definition at line 38 of file SServer.Cpp.

The documentation for this struct was generated from the following files:
  • Com/Fundamentals/DCom/Cancel/InProc/SServer.Cpp
  • Com/Fundamentals/DCom/Cancel/Local/Mta/SServer.Cpp
  • Com/Fundamentals/DCom/Cancel/Local/Sta/SServer.Cpp
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagCrmFilesCreateFileLogRecord Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagCrmFilesCreateFileLogRecord Struct Reference

#include "CrmFilesWorker.h"

List of all members.

Public Attributes

CrmFilesCommandType CommandType
DWORD dwSourceSize

Detailed Description

Definition at line 72 of file CrmFilesWorker.h.

Member Data Documentation

CrmFilesCommandType tagCrmFilesCreateFileLogRecord::CommandType

Definition at line 74 of file CrmFilesWorker.h.

DWORD tagCrmFilesCreateFileLogRecord::dwSourceSize

Definition at line 78 of file CrmFilesWorker.h.

The documentation for this struct was generated from the following file:
  • Com/Services/Crm/CrmFiles/CrmFilesWorker.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagCrmFilesDeleteFileLogRecord Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagCrmFilesDeleteFileLogRecord Struct Reference

#include "CrmFilesWorker.h"

List of all members.

Public Attributes

CrmFilesCommandType CommandType
DWORD dwSourceSize
DWORD dwTempSize

Detailed Description

Definition at line 85 of file CrmFilesWorker.h.

Member Data Documentation

CrmFilesCommandType tagCrmFilesDeleteFileLogRecord::CommandType

Definition at line 87 of file CrmFilesWorker.h.

DWORD tagCrmFilesDeleteFileLogRecord::dwSourceSize

Definition at line 91 of file CrmFilesWorker.h.

DWORD tagCrmFilesDeleteFileLogRecord::dwTempSize

Definition at line 93 of file CrmFilesWorker.h.

The documentation for this struct was generated from the following file:
  • Com/Services/Crm/CrmFiles/CrmFilesWorker.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagDataStruct Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagDataStruct Struct Reference

#include "quiktest.h"

List of all members.

Public Attributes

SDWORD cb
TCHAR | data [MAX_STRING_SIZE]
DATE_STRUCT | date
TCHAR | sChar
SDOUBLE | sdouble
SDWORD sdword
SFLOAT | sfloat
SWORD sword
TIME_STRUCT | time
TIMESTAMP_STRUCT | timestamp
SQLTCHAR | uChar
UDWORD udword
UWORD uword

Detailed Description

Definition at line 155 of file quiktest.h.

Member Data Documentation

SDWORD tagDataStruct::cb

Definition at line 156 of file quiktest.h.

TCHAR tagDataStruct::data[MAX_STRING_SIZE]

Definition at line 157 of file quiktest.h.

DATE_STRUCT tagDataStruct::date

Definition at line 167 of file quiktest.h.

TCHAR tagDataStruct::sChar

Definition at line 162 of file quiktest.h.

SDOUBLE tagDataStruct::sdouble

Definition at line 164 of file quiktest.h.

SDWORD tagDataStruct::sdword

Definition at line 158 of file quiktest.h.

SFLOAT tagDataStruct::sfloat

Definition at line 165 of file quiktest.h.

SWORD tagDataStruct::sword

Definition at line 160 of file quiktest.h.

TIME_STRUCT tagDataStruct::time

Definition at line 166 of file quiktest.h.

TIMESTAMP_STRUCT tagDataStruct::timestamp

Definition at line 168 of file quiktest.h.

SQLTCHAR tagDataStruct::uChar

Definition at line 163 of file quiktest.h.

UDWORD tagDataStruct::udword

Definition at line 159 of file quiktest.h.

UWORD tagDataStruct::uword

Definition at line 161 of file quiktest.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/odbc/quiktest/quiktest.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagDescInfo Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagDescInfo Struct Reference

List of all members.

Public Attributes

SQLSMALLINT | cbValue
SQLINTEGER | DefaultVal
SQLSMALLINT | fDefault
SQLSMALLINT | fGettable
BOOL fHeader
SQLSMALLINT | fSettable
SQLINTEGER | NewValue
SQLINTEGER | size
LPTSTR szDescFieldName
SQLSMALLINT | uwDescField

Detailed Description

Definition at line 233 of file quiktest.c.

Member Data Documentation

SQLSMALLINT tagDescInfo::cbValue

Definition at line 242 of file quiktest.c.

SQLINTEGER tagDescInfo::DefaultVal

Definition at line 241 of file quiktest.c.

SQLSMALLINT tagDescInfo::fDefault

Definition at line 239 of file quiktest.c.

SQLSMALLINT tagDescInfo::fGettable

Definition at line 237 of file quiktest.c.

BOOL tagDescInfo::fHeader

Definition at line 236 of file quiktest.c.

SQLSMALLINT tagDescInfo::fSettable

Definition at line 238 of file quiktest.c.

SQLINTEGER tagDescInfo::NewValue

Definition at line 240 of file quiktest.c.

SQLINTEGER tagDescInfo::size

Definition at line 243 of file quiktest.c.

LPTSTR tagDescInfo::szDescFieldName

Definition at line 235 of file quiktest.c.

SQLSMALLINT tagDescInfo::uwDescField

Definition at line 234 of file quiktest.c.

The documentation for this struct was generated from the following file:
  • Dataaccess/odbc/quiktest/quiktest.c
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagDescType Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagDescType Struct Reference

List of all members.

Public Attributes

TCHAR | szDescName [4]
SQLUSMALLINT | uwDescType
SQLUSMALLINT | uwTypeMask

Detailed Description

Definition at line 222 of file quiktest.c.

Member Data Documentation

TCHAR tagDescType::szDescName[4]

Definition at line 225 of file quiktest.c.

SQLUSMALLINT tagDescType::uwDescType

Definition at line 223 of file quiktest.c.

SQLUSMALLINT tagDescType::uwTypeMask

Definition at line 224 of file quiktest.c.

The documentation for this struct was generated from the following file:
  • Dataaccess/odbc/quiktest/quiktest.c
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagDIAGINFO Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagDIAGINFO Struct Reference

List of all members.

Public Attributes

SWORD irecRecNumber
LPTSTR szDescFieldName
SQLSMALLINT uwDescField

Detailed Description

Definition at line 296 of file quiktest.c.

Member Data Documentation

SWORD tagDIAGINFO::irecRecNumber

Definition at line 299 of file quiktest.c.

LPTSTR tagDIAGINFO::szDescFieldName

Definition at line 298 of file quiktest.c.

SQLSMALLINT tagDIAGINFO::uwDescField

Definition at line 297 of file quiktest.c.

The documentation for this struct was generated from the following file:
  • Dataaccess/odbc/quiktest/quiktest.c
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagDRAWINFO Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagDRAWINFO Struct Reference

#include "Common.h"

List of all members.

Public Attributes

BOOL fIconOnly
RECT Rect

Detailed Description

Definition at line 51 of file Common.h.

Member Data Documentation

BOOL tagDRAWINFO::fIconOnly

Definition at line 54 of file Common.h.

RECT tagDRAWINFO::Rect

Definition at line 53 of file Common.h.

The documentation for this struct was generated from the following file:
  • Com/Fundamentals/OleStd/Common.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagEnhKeyUsage Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagEnhKeyUsage Struct Reference

List of all members.

Public Attributes

DWORD dwCount
DWORD | dwValue [KEY_USAGE_SIZE]
LPSTR | szUsage [KEY_USAGE_SIZE]

Detailed Description

Definition at line 38 of file CreateCert.c.

Member Data Documentation

DWORD tagEnhKeyUsage::dwCount

Definition at line 40 of file CreateCert.c.

DWORD tagEnhKeyUsage::dwValue[KEY_USAGE_SIZE]

Definition at line 42 of file CreateCert.c.

LPSTR tagEnhKeyUsage::szUsage[KEY_USAGE_SIZE]

Definition at line 41 of file CreateCert.c.

The documentation for this struct was generated from the following file:
  • Security/CryptoApi/CreateCert/CreateCert.c
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagENTRY Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagENTRY Struct Reference

List of all members.

Public Attributes

DWORD dwVal
TCHAR * szName

Detailed Description

Definition at line 78 of file secClnt.Cpp.

Member Data Documentation

DWORD tagENTRY::dwVal

Definition at line 80 of file secClnt.Cpp.

TCHAR * tagENTRY::szName

Definition at line 79 of file secClnt.Cpp.

The documentation for this struct was generated from the following files:
  • Com/Fundamentals/DCom/Secure/secClnt.Cpp
  • Com/Fundamentals/DCom/Secure/secSvr.Cpp
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagENUMLIST Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagENUMLIST Struct Reference

#include "Enumidl.h"

List of all members.

Public Attributes

LPITEMIDLIST | pidl
struct tagENUMLIST * | pNext

Detailed Description

Definition at line 31 of file Enumidl.h.

Member Data Documentation

LPITEMIDLIST tagENUMLIST::pidl

Definition at line 34 of file Enumidl.h.

struct tagENUMLIST* tagENUMLIST::pNext

Definition at line 33 of file Enumidl.h.

The documentation for this struct was generated from the following file:
  • WinUI/Shell/SampView/Enumidl.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagENUMPRTLOOKUP Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagENUMPRTLOOKUP Struct Reference

#include "Enumprt.h"

List of all members.

Public Attributes

DWORD dwValue
LPCSTR szValue

Detailed Description

Definition at line 41 of file Enumprt.h.

Member Data Documentation

DWORD tagENUMPRTLOOKUP::dwValue

Definition at line 43 of file Enumprt.h.

LPCSTR tagENUMPRTLOOKUP::szValue

Definition at line 44 of file Enumprt.h.

The documentation for this struct was generated from the following file:
  • Multimedia/Gdi/Printer/Enumprt.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagEVENT Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagEVENT Struct Reference

#include "SMFI.h"

List of all members.

Public Attributes

BYTE abEvent [3]
DWORD cbParm
HPBYTE hpbParm
TICKS tkDelta

Detailed Description

Definition at line 83 of file SMFI.h.

Member Data Documentation

BYTE tagEVENT::abEvent[3]

Definition at line 86 of file SMFI.h.

DWORD tagEVENT::cbParm

Definition at line 90 of file SMFI.h.

HPBYTE tagEVENT::hpbParm

Definition at line 91 of file SMFI.h.

TICKS tagEVENT::tkDelta

Definition at line 85 of file SMFI.h.

The documentation for this struct was generated from the following file:
  • Multimedia/Audio/MidiPlyr/SMFI.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagFieldMetaData Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Public Attributes

tagFieldMetaData Struct Reference

#include "pooleddata.h"

List of all members.

Public Member Functions

DECLARE_FIXED_ALLOC (tagFieldMetaData)

Public Attributes

bool | bNull
long | nDataBindLen
unsigned long | nDataLen
short | nNullable
short | nScale
WCHAR | pData [MAX_FIELD_DATA_SIZE]
short | sqldatatype
short | sqltype
VARTYPE | vt
CString wszName

Detailed Description

Definition at line 4 of file pooleddata.h.

Member Function Documentation

tagFieldMetaData::DECLARE_FIXED_ALLOC ( tagFieldMetaData )

Member Data Documentation

bool tagFieldMetaData::bNull

Definition at line 10 of file pooleddata.h.

long tagFieldMetaData::nDataBindLen

Definition at line 15 of file pooleddata.h.

unsigned long tagFieldMetaData::nDataLen

Definition at line 14 of file pooleddata.h.

short tagFieldMetaData::nNullable

Definition at line 17 of file pooleddata.h.

short tagFieldMetaData::nScale

Definition at line 16 of file pooleddata.h.

WCHAR tagFieldMetaData::pData[MAX_FIELD_DATA_SIZE]

Definition at line 13 of file pooleddata.h.

short tagFieldMetaData::sqldatatype

Definition at line 12 of file pooleddata.h.

short tagFieldMetaData::sqltype

Definition at line 11 of file pooleddata.h.

VARTYPE tagFieldMetaData::vt

Definition at line 9 of file pooleddata.h.

CString tagFieldMetaData::wszName

Definition at line 8 of file pooleddata.h.

The documentation for this struct was generated from the following file:
  • Com/Tools/EntityProxy/DataServices/pooleddata.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagGRAPHICLOOKUP Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagGRAPHICLOOKUP Struct Reference

#include "Printer.h"

List of all members.

Public Attributes

DWORD dwGraphic
WORD wMenuItem

Detailed Description

Definition at line 36 of file Printer.h.

Member Data Documentation

DWORD tagGRAPHICLOOKUP::dwGraphic

Definition at line 39 of file Printer.h.

WORD tagGRAPHICLOOKUP::wMenuItem

Definition at line 38 of file Printer.h.

The documentation for this struct was generated from the following file:
  • Multimedia/Gdi/Printer/Printer.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagHANDLES Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagHANDLES Struct Reference

List of all members.

Public Attributes

SWORD fHandleType
SQLHANDLE hHandle

Detailed Description

Definition at line 176 of file quiktest.c.

Member Data Documentation

SWORD tagHANDLES::fHandleType

Definition at line 178 of file quiktest.c.

SQLHANDLE tagHANDLES::hHandle

Definition at line 179 of file quiktest.c.

The documentation for this struct was generated from the following file:
  • Dataaccess/odbc/quiktest/quiktest.c
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagHeader Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagHeader Struct Reference

List of all members.

Public Attributes

ULONG cbSize
UINT uiTag

Detailed Description

Definition at line 26 of file malspy.c.

Member Data Documentation

ULONG tagHeader::cbSize

Definition at line 29 of file malspy.c.

UINT tagHeader::uiTag

Definition at line 28 of file malspy.c.

The documentation for this struct was generated from the following file:
  • Com/Fundamentals/OleStd/malspy.c
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagICONEXTRACT Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagICONEXTRACT Struct Reference

#include "Common.h"

List of all members.

Public Attributes

BOOL fAND
HICON hIcon
HGLOBAL hMemAND

Detailed Description

Definition at line 36 of file Common.h.

Member Data Documentation

BOOL tagICONEXTRACT::fAND

Definition at line 45 of file Common.h.

HICON tagICONEXTRACT::hIcon

Definition at line 38 of file Common.h.

HGLOBAL tagICONEXTRACT::hMemAND

Definition at line 46 of file Common.h.

The documentation for this struct was generated from the following file:
  • Com/Fundamentals/OleStd/Common.h
Generated on Wed Nov 13 2024 16:57:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagINTERFACEIMPL Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagINTERFACEIMPL Struct Reference

#include "OleStd.h"

List of all members.

Public Attributes

int | cRef
LPVOID | lpBack
IUnknownVtbl FAR * | lpVtbl

Detailed Description

Definition at line 72 of file OleStd.h.

Member Data Documentation

int tagINTERFACEIMPL::cRef

Definition at line 75 of file OleStd.h.

LPVOID tagINTERFACEIMPL::lpBack

Definition at line 74 of file OleStd.h.

IUnknownVtbl FAR* tagINTERFACEIMPL::lpVtbl

Definition at line 73 of file OleStd.h.

The documentation for this struct was generated from the following file:
  • Com/Fundamentals/Include/OleStd.h
Generated on Wed Nov 13 2024 16:58:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagLABELEXTRACT Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagLABELEXTRACT Struct Reference

#include "Common.h"

List of all members.

Public Attributes

BOOL fFoundIconOnly
BOOL fFoundIndex
BOOL fFoundSource
UINT Index
LPOLESTR lpsz
DWORD PrevIndex
union {
UINT cch
UINT iIcon
} u

Detailed Description

Definition at line 16 of file Common.h.

Member Data Documentation

UINT tagLABELEXTRACT::cch

Definition at line 21 of file Common.h.

BOOL tagLABELEXTRACT::fFoundIconOnly

Definition at line 26 of file Common.h.

BOOL tagLABELEXTRACT::fFoundIndex

Definition at line 28 of file Common.h.

BOOL tagLABELEXTRACT::fFoundSource

Definition at line 27 of file Common.h.

UINT tagLABELEXTRACT::iIcon

Definition at line 22 of file Common.h.

UINT tagLABELEXTRACT::Index

Definition at line 16 of file Common.h.

LPOLESTR tagLABELEXTRACT::lpsz

Definition at line 15 of file Common.h.

DWORD tagLABELEXTRACT::PrevIndex

Definition at line 17 of file Common.h.

union { ... } tagLABELEXTRACT::u
The documentation for this struct was generated from the following file:
  • Com/Fundamentals/OleStd/Common.h
Generated on Wed Nov 13 2024 16:58:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagLINE Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagLINE Struct Reference

#include "DrawArea.h"

List of all members.

Public Attributes

CPoint ptEnd
CPoint ptStart

Detailed Description

Definition at line 18 of file DrawArea.h.

Member Data Documentation

CPoint tagLINE::ptEnd

Definition at line 21 of file DrawArea.h.

CPoint tagLINE::ptStart

Definition at line 20 of file DrawArea.h.

The documentation for this struct was generated from the following files:
  • NetDS/MessageQueuing/c_draw/DrawArea.h
  • NetDS/MessageQueuing/Imp_Draw/DrawArea.h
  • NetDS/MessageQueuing/mqf_draw/drawarea.h
Generated on Wed Nov 13 2024 16:58:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagLINE_INFO Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagLINE_INFO Struct Reference

#include "nullmdm.h"

List of all members.

Public Attributes

TPHYS_CONNECT_INFO connInfo
CALL_STATE eCallState
BOOL fCaller
HANDLE hCommLink
HANDLE hevtCall
PHYSICAL_HANDLE pstnHandle

Detailed Description

Definition at line 65 of file nullmdm.h.

Member Data Documentation

TPHYS_CONNECT_INFO tagLINE_INFO::connInfo

Definition at line 72 of file nullmdm.h.

CALL_STATE tagLINE_INFO::eCallState

Definition at line 70 of file nullmdm.h.

BOOL tagLINE_INFO::fCaller

Definition at line 69 of file nullmdm.h.

HANDLE tagLINE_INFO::hCommLink

Definition at line 68 of file nullmdm.h.

HANDLE tagLINE_INFO::hevtCall

Definition at line 67 of file nullmdm.h.

PHYSICAL_HANDLE tagLINE_INFO::pstnHandle

Definition at line 71 of file nullmdm.h.

The documentation for this struct was generated from the following file:
  • Web/NetMeeting/PlugTransport/nullmdm.h
Generated on Wed Nov 13 2024 16:58:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagLINEINFO Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagLINEINFO Struct Reference

List of all members.

Public Attributes

DWORD dwAPIVersion
DWORD dwPermanentLineID
BOOL fVoiceLine
HLINE | hLine
DWORD nAddr
char | szLineName [MAXBUFSIZE]

Detailed Description

Definition at line 29 of file Dialer.c.

Member Data Documentation

DWORD tagLINEINFO::dwAPIVersion

Definition at line 33 of file Dialer.c.

DWORD tagLINEINFO::dwPermanentLineID

Definition at line 35 of file Dialer.c.

BOOL tagLINEINFO::fVoiceLine

Definition at line 32 of file Dialer.c.

HLINE tagLINEINFO::hLine

Definition at line 34 of file Dialer.c.

DWORD tagLINEINFO::nAddr

Definition at line 31 of file Dialer.c.

char tagLINEINFO::szLineName[MAXBUFSIZE]

Definition at line 36 of file Dialer.c.

The documentation for this struct was generated from the following file:
  • NetDS/Tapi/Tapi2/Dialer/Dialer.c
Generated on Wed Nov 13 2024 16:58:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagLSTSLOT Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagLSTSLOT Struct Reference

#include "hashtbl.h"

List of all members.

Public Attributes

ULONG cbCommitCurrent
ULONG cbCommitMax
ULONG cbExtra
ULONG cbPage
ULONG cbSlot
ULONG cbslotLeftOver
ULONG islotFirst
ULONG islotMax
ULONG islotMin
ULONG islotRov
LPBITARRAY pbitsSlot
BYTE * rgslot

Detailed Description

Definition at line 55 of file hashtbl.h.

Member Data Documentation

ULONG tagLSTSLOT::cbCommitCurrent

Definition at line 67 of file hashtbl.h.

ULONG tagLSTSLOT::cbCommitMax

Definition at line 68 of file hashtbl.h.

ULONG tagLSTSLOT::cbExtra

Definition at line 63 of file hashtbl.h.

ULONG tagLSTSLOT::cbPage

Definition at line 66 of file hashtbl.h.

ULONG tagLSTSLOT::cbSlot

Definition at line 65 of file hashtbl.h.

ULONG tagLSTSLOT::cbslotLeftOver

Definition at line 64 of file hashtbl.h.

ULONG tagLSTSLOT::islotFirst

Definition at line 57 of file hashtbl.h.

ULONG tagLSTSLOT::islotMax

Definition at line 60 of file hashtbl.h.

ULONG tagLSTSLOT::islotMin

Definition at line 59 of file hashtbl.h.

ULONG tagLSTSLOT::islotRov

Definition at line 58 of file hashtbl.h.

LPBITARRAY tagLSTSLOT::pbitsSlot

Definition at line 62 of file hashtbl.h.

BYTE* tagLSTSLOT::rgslot

Definition at line 61 of file hashtbl.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/oledb/sampprov/hashtbl.h
Generated on Wed Nov 13 2024 16:58:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagMAPMODELOOKUP Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagMAPMODELOOKUP Struct Reference

#include "Printer.h"

List of all members.

Public Attributes

int | iMapMode
WORD | wMenuItem

Detailed Description

Definition at line 29 of file Printer.h.

Member Data Documentation

int tagMAPMODELOOKUP::iMapMode

Definition at line 32 of file Printer.h.

WORD tagMAPMODELOOKUP::wMenuItem

Definition at line 31 of file Printer.h.

The documentation for this struct was generated from the following file:
  • Multimedia/Gdi/Printer/Printer.h
Generated on Wed Nov 13 2024 16:58:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagMETA16HEADER Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagMETA16HEADER Struct Reference

#include "MfEdit.h"

List of all members.

Public Attributes

WORD | mtHeaderSize
DWORD mtMaxRecord
WORD | mtNoObjects
WORD | mtNoParameters
DWORD mtSize
WORD | mtType
WORD | mtVersion

Detailed Description

Definition at line 298 of file MfEdit.h.

Member Data Documentation

WORD tagMETA16HEADER::mtHeaderSize

Definition at line 301 of file MfEdit.h.

DWORD tagMETA16HEADER::mtMaxRecord

Definition at line 305 of file MfEdit.h.

WORD tagMETA16HEADER::mtNoObjects

Definition at line 304 of file MfEdit.h.

WORD tagMETA16HEADER::mtNoParameters

Definition at line 306 of file MfEdit.h.

DWORD tagMETA16HEADER::mtSize

Definition at line 303 of file MfEdit.h.

WORD tagMETA16HEADER::mtType

Definition at line 300 of file MfEdit.h.

WORD tagMETA16HEADER::mtVersion

Definition at line 302 of file MfEdit.h.

The documentation for this struct was generated from the following file:
  • Multimedia/Gdi/Metafile/MfEdit/MfEdit.h
Generated on Wed Nov 13 2024 16:58:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagMULTI_SZ Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagMULTI_SZ Struct Reference

#include "multisz.h"

List of all members.

Public Attributes

DWORD nChar
wchar_t * pwszValue

Detailed Description

Definition at line 13 of file multisz.h.

Member Data Documentation

DWORD tagMULTI_SZ::nChar

Definition at line 16 of file multisz.h.

wchar_t* tagMULTI_SZ::pwszValue

Definition at line 15 of file multisz.h.

The documentation for this struct was generated from the following file:
  • NetDS/IAS/MapName/multisz.h
Generated on Wed Nov 13 2024 16:58:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagObject Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagObject Struct Reference

#include "Main.h"

List of all members.

Public Attributes

BOOL fContainer
HTREEITEM | hTreeItem
struct tagObject * | Objects
struct tagObject * | Parent
PSECURITY_DESCRIPTOR | pSD

Detailed Description

Definition at line 24 of file Main.h.

Member Data Documentation

BOOL tagObject::fContainer

Definition at line 26 of file Main.h.

HTREEITEM tagObject::hTreeItem

Definition at line 29 of file Main.h.

struct tagObject* tagObject::Objects

Definition at line 28 of file Main.h.

struct tagObject* tagObject::Parent

Definition at line 27 of file Main.h.

PSECURITY_DESCRIPTOR tagObject::pSD

Definition at line 25 of file Main.h.

The documentation for this struct was generated from the following file:
  • Security/Authorization/SecurObj/Main.h
Generated on Wed Nov 13 2024 16:58:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagOleStdEnumFmtEtc Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagOleStdEnumFmtEtc Struct Reference

List of all members.

Public Attributes

IEnumFORMATETCVtbl FAR * | lpVtbl
ULONG m_dwRefs
LPFORMATETC | m_lpEtc
ULONG m_nCount
ULONG m_nIndex

Detailed Description

Definition at line 19 of file enumfetc.c.

Member Data Documentation

IEnumFORMATETCVtbl FAR* tagOleStdEnumFmtEtc::lpVtbl

Definition at line 20 of file enumfetc.c.

ULONG tagOleStdEnumFmtEtc::m_dwRefs

Definition at line 21 of file enumfetc.c.

LPFORMATETC tagOleStdEnumFmtEtc::m_lpEtc

Definition at line 24 of file enumfetc.c.

ULONG tagOleStdEnumFmtEtc::m_nCount

Definition at line 23 of file enumfetc.c.

ULONG tagOleStdEnumFmtEtc::m_nIndex

Definition at line 22 of file enumfetc.c.

The documentation for this struct was generated from the following file:
  • Com/Fundamentals/OleStd/enumfetc.c
Generated on Wed Nov 13 2024 16:58:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagOleStdEnumStatData Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagOleStdEnumStatData Struct Reference

List of all members.

Public Attributes

IEnumSTATDATAVtbl FAR * | lpVtbl
ULONG m_dwRefs
LPSTATDATA | m_lpStat
ULONG m_nCount
ULONG m_nIndex

Detailed Description

Definition at line 19 of file enumStat.c.

Member Data Documentation

IEnumSTATDATAVtbl FAR* tagOleStdEnumStatData::lpVtbl

Definition at line 20 of file enumStat.c.

ULONG tagOleStdEnumStatData::m_dwRefs

Definition at line 21 of file enumStat.c.

LPSTATDATA tagOleStdEnumStatData::m_lpStat

Definition at line 24 of file enumStat.c.

ULONG tagOleStdEnumStatData::m_nCount

Definition at line 23 of file enumStat.c.

ULONG tagOleStdEnumStatData::m_nIndex

Definition at line 22 of file enumStat.c.

The documentation for this struct was generated from the following file:
  • Com/Fundamentals/OleStd/enumStat.c
Generated on Wed Nov 13 2024 16:58:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagOLESTDMESSAGEFILTER Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagOLESTDMESSAGEFILTER Struct Reference

List of all members.

Public Attributes

BOOL m_bUnblocking
UINT m_cRef
DWORD m_dwInComingCallStatus
BOOL m_fEnableBusyDialog
BOOL m_fEnableNotRespondingDialog
HWND | m_hWndBusyDialog
HWND | m_hWndParent
LPFNOLEUIHOOK m_lpfnBusyDialogHookCallback
HANDLEINCOMINGCALLBACKPROC | m_lpfnHandleInComingCallback
MSGPENDINGPROC m_lpfnMessagePendingCallback
LPOLESTR m_lpszAppName
IMessageFilterVtbl FAR * | m_lpVtbl

Detailed Description

Definition at line 20 of file msgfiltr.c.

Member Data Documentation

BOOL tagOLESTDMESSAGEFILTER::m_bUnblocking

Definition at line 41 of file msgfiltr.c.

UINT tagOLESTDMESSAGEFILTER::m_cRef

Definition at line 22 of file msgfiltr.c.

DWORD tagOLESTDMESSAGEFILTER::m_dwInComingCallStatus

Definition at line 24 of file msgfiltr.c.

BOOL tagOLESTDMESSAGEFILTER::m_fEnableBusyDialog

Definition at line 30 of file msgfiltr.c.

BOOL tagOLESTDMESSAGEFILTER::m_fEnableNotRespondingDialog

Definition at line 32 of file msgfiltr.c.

HWND tagOLESTDMESSAGEFILTER::m_hWndBusyDialog

Definition at line 39 of file msgfiltr.c.

HWND tagOLESTDMESSAGEFILTER::m_hWndParent

Definition at line 23 of file msgfiltr.c.

LPFNOLEUIHOOK tagOLESTDMESSAGEFILTER::m_lpfnBusyDialogHookCallback

Definition at line 36 of file msgfiltr.c.

HANDLEINCOMINGCALLBACKPROC tagOLESTDMESSAGEFILTER::m_lpfnHandleInComingCallback

Definition at line 26 of file msgfiltr.c.

MSGPENDINGPROC tagOLESTDMESSAGEFILTER::m_lpfnMessagePendingCallback

Definition at line 34 of file msgfiltr.c.

LPOLESTR tagOLESTDMESSAGEFILTER::m_lpszAppName

Definition at line 37 of file msgfiltr.c.

IMessageFilterVtbl FAR* tagOLESTDMESSAGEFILTER::m_lpVtbl

Definition at line 21 of file msgfiltr.c.

The documentation for this struct was generated from the following file:
  • Com/Fundamentals/OleStd/msgfiltr.c
Generated on Wed Nov 13 2024 16:58:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagOPTIONS Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagOPTIONS Struct Reference

#include "WinCap.h"

List of all members.

Public Attributes

DWORD cxWidth
DWORD cyHeight
BOOL fAutoHide
BOOL fHiding
BOOL fOnTop
int | iOption
int | iXScale
int | iYScale
RECT | rcEdges [4]
UINT uSide

Detailed Description

Definition at line 54 of file WinCap.h.

Member Data Documentation

DWORD tagOPTIONS::cxWidth

Definition at line 40 of file AppBar.h.

DWORD tagOPTIONS::cyHeight

Definition at line 41 of file AppBar.h.

BOOL tagOPTIONS::fAutoHide

Definition at line 36 of file AppBar.h.

BOOL tagOPTIONS::fHiding

Definition at line 38 of file AppBar.h.

BOOL tagOPTIONS::fOnTop

Definition at line 37 of file AppBar.h.

int tagOPTIONS::iOption

Definition at line 55 of file WinCap.h.

int tagOPTIONS::iXScale

Definition at line 56 of file WinCap.h.

int tagOPTIONS::iYScale

Definition at line 57 of file WinCap.h.

RECT tagOPTIONS::rcEdges[4]

Definition at line 42 of file AppBar.h.

UINT tagOPTIONS::uSide

Definition at line 39 of file AppBar.h.

The documentation for this struct was generated from the following files:
  • Multimedia/Gdi/WinCap32/WinCap.h
  • WinUI/Shell/AppBar/AppBar.h
Generated on Wed Nov 13 2024 16:58:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagPENSTYLELOOKUP Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagPENSTYLELOOKUP Struct Reference

#include "Printer.h"

List of all members.

Public Attributes

int | iPenStyle
WORD | wMenuItem

Detailed Description

Definition at line 50 of file Printer.h.

Member Data Documentation

int tagPENSTYLELOOKUP::iPenStyle

Definition at line 53 of file Printer.h.

WORD tagPENSTYLELOOKUP::wMenuItem

Definition at line 52 of file Printer.h.

The documentation for this struct was generated from the following file:
  • Multimedia/Gdi/Printer/Printer.h
Generated on Wed Nov 13 2024 16:58:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagPENWIDTHLOOKUP Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagPENWIDTHLOOKUP Struct Reference

#include "Printer.h"

List of all members.

Public Attributes

int | iPenWidth
WORD | wMenuItem

Detailed Description

Definition at line 43 of file Printer.h.

Member Data Documentation

int tagPENWIDTHLOOKUP::iPenWidth

Definition at line 46 of file Printer.h.

WORD tagPENWIDTHLOOKUP::wMenuItem

Definition at line 45 of file Printer.h.

The documentation for this struct was generated from the following file:
  • Multimedia/Gdi/Printer/Printer.h
Generated on Wed Nov 13 2024 16:58:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagPIDLDATA Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagPIDLDATA Struct Reference

#include "PidlMgr.h"

List of all members.

Public Attributes

BOOL fFolder
WCHAR | wszData [MAX_DATA]
WCHAR | wszName [MAX_NAME]

Detailed Description

Definition at line 31 of file PidlMgr.h.

Member Data Documentation

BOOL tagPIDLDATA::fFolder

Definition at line 33 of file PidlMgr.h.

WCHAR tagPIDLDATA::wszData[MAX_DATA]

Definition at line 40 of file PidlMgr.h.

WCHAR tagPIDLDATA::wszName[MAX_NAME]

Definition at line 39 of file PidlMgr.h.

The documentation for this struct was generated from the following file:
  • WinUI/Shell/SampView/PidlMgr.h
Generated on Wed Nov 13 2024 16:58:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagPLUGXPRT_PARAMETERS Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagPLUGXPRT_PARAMETERS Struct Reference

import "iplgxprt.idl";

List of all members.

Public Attributes

ULONG cbPhysicalLayerReceiveBufferSize
ULONG cbPhysicalLayerSendBufferSize
ULONG cbReadFileBufferSize
ULONG cbStructSize
ULONG cMaximumT200TimeoutsInQ922
DWORD dwFlags
PLUGXPRT_PSTN_CALL_CONTROL eCallControl
ULONG nT203TimeoutInQ922

Detailed Description

Definition at line 50 of file iplgxprt.idl.

Member Data Documentation

ULONG tagPLUGXPRT_PARAMETERS::cbPhysicalLayerReceiveBufferSize

Definition at line 58 of file iplgxprt.idl.

ULONG tagPLUGXPRT_PARAMETERS::cbPhysicalLayerSendBufferSize

Definition at line 57 of file iplgxprt.idl.

ULONG tagPLUGXPRT_PARAMETERS::cbReadFileBufferSize

Definition at line 56 of file iplgxprt.idl.

ULONG tagPLUGXPRT_PARAMETERS::cbStructSize

Definition at line 52 of file iplgxprt.idl.

ULONG tagPLUGXPRT_PARAMETERS::cMaximumT200TimeoutsInQ922

Definition at line 59 of file iplgxprt.idl.

DWORD tagPLUGXPRT_PARAMETERS::dwFlags

Definition at line 53 of file iplgxprt.idl.

PLUGXPRT_PSTN_CALL_CONTROL tagPLUGXPRT_PARAMETERS::eCallControl

Definition at line 55 of file iplgxprt.idl.

ULONG tagPLUGXPRT_PARAMETERS::nT203TimeoutInQ922

Definition at line 60 of file iplgxprt.idl.

The documentation for this struct was generated from the following file:
  • Web/NetMeeting/PlugTransport/iplgxprt.idl
Generated on Wed Nov 13 2024 16:58:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagPOPUPMENUMAP Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagPOPUPMENUMAP Struct Reference

#include "CStatHlp.h"

List of all members.

Public Attributes

HMENU hMenu
USHORT uID

Detailed Description

Definition at line 29 of file CStatHlp.h.

Member Data Documentation

HMENU tagPOPUPMENUMAP::hMenu

Definition at line 31 of file CStatHlp.h.

USHORT tagPOPUPMENUMAP::uID

Definition at line 32 of file CStatHlp.h.

The documentation for this struct was generated from the following file:
  • WinUI/Shell/FileView/CStatHlp.h
Generated on Wed Nov 13 2024 16:58:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagProperties Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagProperties Struct Reference

List of all members.

Public Attributes

DWORD m_dwType
_TCHAR m_tcsPropertyName [128]

Detailed Description

Definition at line 58 of file BasicHiPerf.Cpp.

Member Data Documentation

DWORD tagProperties::m_dwType

Definition at line 45 of file BasicHiPerf.Cpp.

_TCHAR tagProperties::m_tcsPropertyName[128]

Definition at line 44 of file BasicHiPerf.Cpp.

The documentation for this struct was generated from the following file:
  • SysMgmt/WMI/VC/HiPerfProvider/BasicHiPerf.Cpp
Generated on Wed Nov 13 2024 16:58:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagQtStruct Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagQtStruct Struct Reference

#include "quiktest.h"

List of all members.

Public Attributes

TCHAR | buf [MAX_STRING_SIZE]
TCHAR | sz [MAX_QUERY_SIZE]
TCHAR | szColName [MAX_COLUMN_NAME_SIZE]
TCHAR | szColNames [MAX_COLUMN_LIST_SIZE]
TCHAR | szDataItem [MAX_DATA_SIZE]
TCHAR | szParam [MAX_PARAM_SIZE]
TCHAR | szParamQuery [MAX_QUERY_SIZE]
TCHAR | szTableName [MAX_TABLE_NAME]
TCHAR | szValues [MAX_INSERT_VALUES_SIZE]

Detailed Description

Definition at line 140 of file quiktest.h.

Member Data Documentation

TCHAR tagQtStruct::buf[MAX_STRING_SIZE]

Definition at line 141 of file quiktest.h.

TCHAR tagQtStruct::sz[MAX_QUERY_SIZE]

Definition at line 142 of file quiktest.h.

TCHAR tagQtStruct::szColName[MAX_COLUMN_NAME_SIZE]

Definition at line 148 of file quiktest.h.

TCHAR tagQtStruct::szColNames[MAX_COLUMN_LIST_SIZE]

Definition at line 147 of file quiktest.h.

TCHAR tagQtStruct::szDataItem[MAX_DATA_SIZE]

Definition at line 145 of file quiktest.h.

TCHAR tagQtStruct::szParam[MAX_PARAM_SIZE]

Definition at line 144 of file quiktest.h.

TCHAR tagQtStruct::szParamQuery[MAX_QUERY_SIZE]

Definition at line 143 of file quiktest.h.

TCHAR tagQtStruct::szTableName[MAX_TABLE_NAME]

Definition at line 146 of file quiktest.h.

TCHAR tagQtStruct::szValues[MAX_INSERT_VALUES_SIZE]

Definition at line 149 of file quiktest.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/odbc/quiktest/quiktest.h
Generated on Wed Nov 13 2024 16:58:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagRGPT Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagRGPT Struct Reference

#include "Mypal.h"

List of all members.

Public Attributes

INT iInfo [10]

Detailed Description

Definition at line 25 of file Mypal.h.

Member Data Documentation

INT tagRGPT::iInfo[10]

Definition at line 26 of file Mypal.h.

The documentation for this struct was generated from the following file:
  • Multimedia/Gdi/palette/Mypal.h
Generated on Wed Nov 13 2024 16:58:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagRowBuff Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagRowBuff Struct Reference

#include "hashtbl.h"

List of all members.

Public Attributes

DBBKMARK | cbBmk
COLUMNDATA | cdData [1]
DBBKMARK | dwBmk
ULONG dwBmkStatus
ULONG irowbuffNext
VOID * | pbBmk
DBREFCOUNT | ulRefCount
USHORT wBmkHash

Detailed Description

Definition at line 36 of file hashtbl.h.

Member Data Documentation

DBBKMARK tagRowBuff::cbBmk

Definition at line 42 of file hashtbl.h.

COLUMNDATA tagRowBuff::cdData[1]

Definition at line 45 of file hashtbl.h.

DBBKMARK tagRowBuff::dwBmk

Definition at line 44 of file hashtbl.h.

ULONG tagRowBuff::dwBmkStatus

Definition at line 43 of file hashtbl.h.

ULONG tagRowBuff::irowbuffNext

Definition at line 39 of file hashtbl.h.

VOID* tagRowBuff::pbBmk

Definition at line 41 of file hashtbl.h.

DBREFCOUNT tagRowBuff::ulRefCount

Definition at line 38 of file hashtbl.h.

USHORT tagRowBuff::wBmkHash

Definition at line 40 of file hashtbl.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/oledb/sampprov/hashtbl.h
Generated on Wed Nov 13 2024 16:58:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagSEG Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagSEG Struct Reference

List of all members.

Public Attributes

DWORD dwPos
LPPOINT lpPoints

Detailed Description

Definition at line 33 of file Fx.c.

Member Data Documentation

DWORD tagSEG::dwPos

Definition at line 32 of file Fx.c.

LPPOINT tagSEG::lpPoints

Definition at line 33 of file Fx.c.

The documentation for this struct was generated from the following file:
  • Multimedia/Gdi/TextFx/Fx.c
Generated on Wed Nov 13 2024 16:58:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagSERVERINFO Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagSERVERINFO Struct Reference

#include "autotest.h"

List of all members.

Public Attributes

UINT cBuff
int | cErrors
int | failed
BOOL fDebug
BOOL fIsolate
BOOL fLog
BOOL fScreen
HDBC | hdbc
HENV | henv
HINSTANCE | hLoadedInst
HSTMT | hstmt
HWND | hwnd
UINT FAR * | rglMask
TCHAR | szBuff [MAXFLUSH]
TCHAR | szKeywords [MAX_KEYWORD_LEN+1]
TCHAR | szLogFile [_MAX_PATH]
TCHAR | szSource [SQL_MAX_DSN_LENGTH+1]
TCHAR | szValidLogin0 [MAX_USER_INFO+1]
TCHAR | szValidPassword0 [MAX_USER_INFO+1]
TCHAR | szValidServer0 [SQL_MAX_DSN_LENGTH+1]
UDWORD vCursorLib

Detailed Description

Definition at line 78 of file autotest.h.

Member Data Documentation

UINT tagSERVERINFO::cBuff

Definition at line 106 of file autotest.h.

int tagSERVERINFO::cErrors

Definition at line 96 of file autotest.h.

int tagSERVERINFO::failed

Definition at line 95 of file autotest.h.

BOOL tagSERVERINFO::fDebug

Definition at line 97 of file autotest.h.

BOOL tagSERVERINFO::fIsolate

Definition at line 100 of file autotest.h.

BOOL tagSERVERINFO::fLog

Definition at line 99 of file autotest.h.

BOOL tagSERVERINFO::fScreen

Definition at line 98 of file autotest.h.

HDBC tagSERVERINFO::hdbc

Definition at line 82 of file autotest.h.

HENV tagSERVERINFO::henv

Definition at line 81 of file autotest.h.

HINSTANCE tagSERVERINFO::hLoadedInst

Definition at line 102 of file autotest.h.

HSTMT tagSERVERINFO::hstmt

Definition at line 83 of file autotest.h.

HWND tagSERVERINFO::hwnd

Definition at line 79 of file autotest.h.

UINT FAR* tagSERVERINFO::rglMask

Definition at line 94 of file autotest.h.

TCHAR tagSERVERINFO::szBuff[MAXFLUSH]

Definition at line 105 of file autotest.h.

TCHAR tagSERVERINFO::szKeywords[MAX_KEYWORD_LEN+1]

Definition at line 91 of file autotest.h.

TCHAR tagSERVERINFO::szLogFile[_MAX_PATH]

Definition at line 80 of file autotest.h.

TCHAR tagSERVERINFO::szSource[SQL_MAX_DSN_LENGTH+1]

Definition at line 87 of file autotest.h.

TCHAR tagSERVERINFO::szValidLogin0[MAX_USER_INFO+1]

Definition at line 89 of file autotest.h.

TCHAR tagSERVERINFO::szValidPassword0[MAX_USER_INFO+1]

Definition at line 90 of file autotest.h.

TCHAR tagSERVERINFO::szValidServer0[SQL_MAX_DSN_LENGTH+1]

Definition at line 88 of file autotest.h.

UDWORD tagSERVERINFO::vCursorLib

Definition at line 101 of file autotest.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/odbc/quiktest/autotest.h
Generated on Wed Nov 13 2024 16:58:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagSLOT Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagSLOT Struct Reference

#include "hashtbl.h"

List of all members.

Public Attributes

ULONG cslot
ULONG islotNext
ULONG islotPrev

Detailed Description

Definition at line 48 of file hashtbl.h.

Member Data Documentation

ULONG tagSLOT::cslot

Definition at line 52 of file hashtbl.h.

ULONG tagSLOT::islotNext

Definition at line 50 of file hashtbl.h.

ULONG tagSLOT::islotPrev

Definition at line 51 of file hashtbl.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/oledb/sampprov/hashtbl.h
Generated on Wed Nov 13 2024 16:58:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagSTATMESSAGEMAP Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagSTATMESSAGEMAP Struct Reference

#include "CStatHlp.h"

List of all members.

Public Attributes

USHORT idsMsg
USHORT uID

Detailed Description

Definition at line 22 of file CStatHlp.h.

Member Data Documentation

USHORT tagSTATMESSAGEMAP::idsMsg

Definition at line 25 of file CStatHlp.h.

USHORT tagSTATMESSAGEMAP::uID

Definition at line 24 of file CStatHlp.h.

The documentation for this struct was generated from the following file:
  • WinUI/Shell/FileView/CStatHlp.h
Generated on Wed Nov 13 2024 16:58:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagSTATUSBARLOOKUP Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagSTATUSBARLOOKUP Struct Reference

#include "Printer.h"

List of all members.

Public Attributes

LPCSTR | szText
WORD | wMenuItem

Detailed Description

Definition at line 64 of file Printer.h.

Member Data Documentation

LPCSTR tagSTATUSBARLOOKUP::szText

Definition at line 67 of file Printer.h.

WORD tagSTATUSBARLOOKUP::wMenuItem

Definition at line 66 of file Printer.h.

The documentation for this struct was generated from the following file:
  • Multimedia/Gdi/Printer/Printer.h
Generated on Wed Nov 13 2024 16:58:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagTOOLDISPLAYDATA Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagTOOLDISPLAYDATA Struct Reference

#include "BttnCur.h"

List of all members.

Public Attributes

UINT cxButton
UINT cxImage
UINT cyBar
UINT cyButton
UINT cyImage
UINT uDPI
UINT uIDImages

Detailed Description

Definition at line 177 of file BttnCur.h.

Member Data Documentation

UINT tagTOOLDISPLAYDATA::cxButton

Definition at line 181 of file BttnCur.h.

UINT tagTOOLDISPLAYDATA::cxImage

Definition at line 183 of file BttnCur.h.

UINT tagTOOLDISPLAYDATA::cyBar

Definition at line 180 of file BttnCur.h.

UINT tagTOOLDISPLAYDATA::cyButton

Definition at line 182 of file BttnCur.h.

UINT tagTOOLDISPLAYDATA::cyImage

Definition at line 184 of file BttnCur.h.

UINT tagTOOLDISPLAYDATA::uDPI

Definition at line 179 of file BttnCur.h.

UINT tagTOOLDISPLAYDATA::uIDImages

Definition at line 185 of file BttnCur.h.

The documentation for this struct was generated from the following file:
  • Com/Fundamentals/Include/BttnCur.h
Generated on Wed Nov 13 2024 16:58:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagTrackObject Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagTrackObject Struct Reference

#include "Track.h"

List of all members.

Public Attributes

int | allowedModes
HDC | hdc
int | Mode
struct tagTrackObject * | Next
RECT | rect
RECT | rectClip
XFORM | xfmChange
XFORM | xfmDown

Detailed Description

Definition at line 36 of file Track.h.

Member Data Documentation

int tagTrackObject::allowedModes

Definition at line 42 of file Track.h.

HDC tagTrackObject::hdc

Definition at line 40 of file Track.h.

int tagTrackObject::Mode

Definition at line 41 of file Track.h.

struct tagTrackObject * tagTrackObject::Next

Definition at line 44 of file Track.h.

RECT tagTrackObject::rect

Definition at line 37 of file Track.h.

RECT tagTrackObject::rectClip

Definition at line 43 of file Track.h.

XFORM tagTrackObject::xfmChange

Definition at line 38 of file Track.h.

XFORM tagTrackObject::xfmDown

Definition at line 39 of file Track.h.

The documentation for this struct was generated from the following files:
  • Multimedia/Gdi/WinNT/PlgBlt/Track.h
  • Multimedia/Gdi/WinNT/WxForm/WxForm.h
Generated on Wed Nov 13 2024 16:58:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagUser Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagUser Struct Reference

#include "cMemb.h"

List of all members.

Public Attributes

BOOL fLocal
BOOL fMcu
BOOL fTop
int | iItem
INmChannelAppShare * | m_pChannelAs
INmChannelAudio * | m_pChannelAudio
INmChannelData * | m_pChannelData
INmChannelFt * | m_pChannelFt
INmMember * | pMember
LPTSTR pszAddr
LPTSTR pszName
ULONG uchCaps
ULONG uId
NM_ADDR_TYPE | uType
ULONG uVersion

Detailed Description

Definition at line 16 of file cMemb.h.

Member Data Documentation

BOOL tagUser::fLocal

Definition at line 20 of file cMemb.h.

BOOL tagUser::fMcu

Definition at line 21 of file cMemb.h.

BOOL tagUser::fTop

Definition at line 22 of file cMemb.h.

int tagUser::iItem

Definition at line 18 of file cMemb.h.

INmChannelAppShare* tagUser::m_pChannelAs

Definition at line 29 of file cMemb.h.

INmChannelAudio* tagUser::m_pChannelAudio

Definition at line 28 of file cMemb.h.

INmChannelData* tagUser::m_pChannelData

Definition at line 31 of file cMemb.h.

INmChannelFt* tagUser::m_pChannelFt

Definition at line 30 of file cMemb.h.

INmMember * tagUser::pMember

Definition at line 17 of file cMemb.h.

LPTSTR tagUser::pszAddr

Definition at line 21 of file cMemb.h.

LPTSTR tagUser::pszName

Definition at line 18 of file cMemb.h.

ULONG tagUser::uchCaps

Definition at line 24 of file cMemb.h.

ULONG tagUser::uId

Definition at line 19 of file cMemb.h.

NM_ADDR_TYPE tagUser::uType

Definition at line 22 of file cMemb.h.

ULONG tagUser::uVersion

Definition at line 19 of file cMemb.h.

The documentation for this struct was generated from the following files:
  • Web/NetMeeting/NMChat/cMemb.h
  • Web/NetMeeting/NMShare/cMemb.h
  • Web/NetMeeting/NMUI/cMemb.h
Generated on Wed Nov 13 2024 16:58:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tagVIEWLIST Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tagVIEWLIST Struct Reference

#include "Viewlist.h"

List of all members.

Public Attributes

struct tagVIEWLIST * pNext
CShellView * pView

Detailed Description

Definition at line 31 of file Viewlist.h.

Member Data Documentation

struct tagVIEWLIST* tagVIEWLIST::pNext

Definition at line 33 of file Viewlist.h.

CShellView* tagVIEWLIST::pView

Definition at line 34 of file Viewlist.h.

The documentation for this struct was generated from the following file:
  • WinUI/Shell/SampView/Viewlist.h
Generated on Wed Nov 13 2024 16:58:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TempBuffer Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

TempBuffer Class Reference

#include "globals.h"

List of all members.

Public Member Functions

TempBuffer (ULONG cBytes)
TempBuffer (ULONG cBytes)
TempBuffer (ULONG cBytes)
TempBuffer (ULONG cBytes)
TempBuffer (ULONG cBytes)
TempBuffer (ULONG cBytes)
TempBuffer (ULONG cBytes)
TempBuffer (ULONG cBytes)
TempBuffer (ULONG cBytes)
TempBuffer (ULONG cBytes)
TempBuffer (ULONG cBytes)
TempBuffer (ULONG cBytes)
TempBuffer (ULONG cBytes)
TempBuffer (ULONG cBytes)
TempBuffer (ULONG cBytes)
TempBuffer (ULONG cBytes)
TempBuffer (ULONG cBytes)
TempBuffer (ULONG cBytes)
TempBuffer (ULONG cBytes)
TempBuffer (ULONG cBytes)
~TempBuffer ()
~TempBuffer ()
~TempBuffer ()
~TempBuffer ()
~TempBuffer ()
~TempBuffer ()
~TempBuffer ()
~TempBuffer ()
~TempBuffer ()
~TempBuffer ()
~TempBuffer ()
~TempBuffer ()
~TempBuffer ()
~TempBuffer ()
~TempBuffer ()
~TempBuffer ()
~TempBuffer ()
~TempBuffer ()
~TempBuffer ()
~TempBuffer ()
void * | GetBuffer ()
void * | GetBuffer ()
void * | GetBuffer ()
void * | GetBuffer ()
void * | GetBuffer ()
void * | GetBuffer ()
void * | GetBuffer ()
void * | GetBuffer ()
void * | GetBuffer ()
void * | GetBuffer ()
void * | GetBuffer ()
void * | GetBuffer ()
void * | GetBuffer ()
void * | GetBuffer ()
void * | GetBuffer ()
void * | GetBuffer ()
void * | GetBuffer ()
void * | GetBuffer ()
void * | GetBuffer ()
void * | GetBuffer ()

Private Attributes

unsigned | m_fHeapAlloc:1
void * | m_pBuf
char | m_szTmpBuf [120]

Detailed Description

Definition at line 51 of file globals.h.

Constructor & Destructor Documentation

TempBuffer::TempBuffer ( ULONG cBytes ) [inline]

Definition at line 53 of file globals.h.

                             {
        m_pBuf = (cBytes <= 120) ? &m_szTmpBuf : HeapAlloc(GetProcessHeap(), 0, cBytes);
        m_fHeapAlloc = (cBytes > 120);
    }

TempBuffer::~TempBuffer ( ) [inline]

Definition at line 57 of file globals.h.

                  {
        if (m_pBuf && m_fHeapAlloc) HeapFree(GetProcessHeap(), 0, m_pBuf);
    }

TempBuffer::TempBuffer ( ULONG cBytes ) [inline]

Definition at line 53 of file globals.h.

                             {
        m_pBuf = (cBytes <= 120) ? &m_szTmpBuf : HeapAlloc(GetProcessHeap(), 0, cBytes);
        m_fHeapAlloc = (cBytes > 120);
    }

TempBuffer::~TempBuffer ( ) [inline]

Definition at line 57 of file globals.h.

                  {
        if (m_pBuf && m_fHeapAlloc) HeapFree(GetProcessHeap(), 0, m_pBuf);
    }

TempBuffer::TempBuffer ( ULONG cBytes ) [inline]

Definition at line 53 of file globals.h.

                             {
        m_pBuf = (cBytes <= 120) ? &m_szTmpBuf : HeapAlloc(GetProcessHeap(), 0, cBytes);
        m_fHeapAlloc = (cBytes > 120);
    }

TempBuffer::~TempBuffer ( ) [inline]

Definition at line 57 of file globals.h.

                  {
        if (m_pBuf && m_fHeapAlloc) HeapFree(GetProcessHeap(), 0, m_pBuf);
    }

TempBuffer::TempBuffer ( ULONG cBytes ) [inline]

Definition at line 44 of file globals.h.

                             {
        m_pBuf = (cBytes <= 120) ? &m_szTmpBuf : HeapAlloc(GetProcessHeap(), 0, cBytes);
        m_fHeapAlloc = (cBytes > 120);
    }

TempBuffer::~TempBuffer ( ) [inline]

Definition at line 48 of file globals.h.

                  {
        if (m_pBuf && m_fHeapAlloc) HeapFree(GetProcessHeap(), 0, m_pBuf);
    }

TempBuffer::TempBuffer ( ULONG cBytes ) [inline]

Definition at line 61 of file globals.h.

                             {
        m_pBuf = (cBytes <= 120) ? &m_szTmpBuf : HeapAlloc(GetProcessHeap(), 0, cBytes);
        m_fHeapAlloc = (cBytes > 120);
    }

TempBuffer::~TempBuffer ( ) [inline]

Definition at line 65 of file globals.h.

                  {
        if (m_pBuf && m_fHeapAlloc) HeapFree(GetProcessHeap(), 0, m_pBuf);
    }

TempBuffer::TempBuffer ( ULONG cBytes ) [inline]

Definition at line 58 of file globals.h.

                             {
        m_pBuf = (cBytes <= 120) ? &m_szTmpBuf : HeapAlloc(GetProcessHeap(), 0, cBytes);
        m_fHeapAlloc = (cBytes > 120);
    }

TempBuffer::~TempBuffer ( ) [inline]

Definition at line 62 of file globals.h.

                  {
        if (m_pBuf && m_fHeapAlloc) HeapFree(GetProcessHeap(), 0, m_pBuf);
    }

TempBuffer::TempBuffer ( ULONG cBytes ) [inline]

Definition at line 53 of file globals.h.

                             {
        m_pBuf = (cBytes <= 120) ? &m_szTmpBuf : HeapAlloc(GetProcessHeap(), 0, cBytes);
        m_fHeapAlloc = (cBytes > 120);
    }

TempBuffer::~TempBuffer ( ) [inline]

Definition at line 57 of file globals.h.

                  {
        if (m_pBuf && m_fHeapAlloc) HeapFree(GetProcessHeap(), 0, m_pBuf);
    }

TempBuffer::TempBuffer ( ULONG cBytes ) [inline]

Definition at line 53 of file Globals.h.

                             {
        m_pBuf = (cBytes <= 120) ? &m_szTmpBuf : HeapAlloc(GetProcessHeap(), 0, cBytes);
        m_fHeapAlloc = (cBytes > 120);
    }

TempBuffer::~TempBuffer ( ) [inline]

Definition at line 57 of file Globals.h.

                  {
        if (m_pBuf && m_fHeapAlloc) HeapFree(GetProcessHeap(), 0, m_pBuf);
    }

TempBuffer::TempBuffer ( ULONG cBytes ) [inline]

Definition at line 53 of file globals.h.

                             {
        m_pBuf = (cBytes <= 120) ? &m_szTmpBuf : HeapAlloc(GetProcessHeap(), 0, cBytes);
        m_fHeapAlloc = (cBytes > 120);
    }

TempBuffer::~TempBuffer ( ) [inline]

Definition at line 57 of file globals.h.

                  {
        if (m_pBuf && m_fHeapAlloc) HeapFree(GetProcessHeap(), 0, m_pBuf);
    }

TempBuffer::TempBuffer ( ULONG cBytes ) [inline]

Definition at line 58 of file globals.h.

                             {
        m_pBuf = (cBytes <= 120) ? &m_szTmpBuf : HeapAlloc(GetProcessHeap(), 0, cBytes);
        m_fHeapAlloc = (cBytes > 120);
    }

TempBuffer::~TempBuffer ( ) [inline]

Definition at line 62 of file globals.h.

                  {
        if (m_pBuf && m_fHeapAlloc) HeapFree(GetProcessHeap(), 0, m_pBuf);
    }

TempBuffer::TempBuffer ( ULONG cBytes ) [inline]

Definition at line 54 of file globals.h.

                             {
        m_pBuf = (cBytes <= 120) ? &m_szTmpBuf : HeapAlloc(GetProcessHeap(), 0, cBytes);
        m_fHeapAlloc = (cBytes > 120);
    }

TempBuffer::~TempBuffer ( ) [inline]

Definition at line 58 of file globals.h.

                  {
        if (m_pBuf && m_fHeapAlloc) HeapFree(GetProcessHeap(), 0, m_pBuf);
    }

TempBuffer::TempBuffer ( ULONG cBytes ) [inline]

Definition at line 53 of file globals.h.

                             {
        m_pBuf = (cBytes <= 120) ? &m_szTmpBuf : HeapAlloc(GetProcessHeap(), 0, cBytes);
        m_fHeapAlloc = (cBytes > 120);
    }

TempBuffer::~TempBuffer ( ) [inline]

Definition at line 57 of file globals.h.

                  {
        if (m_pBuf && m_fHeapAlloc) HeapFree(GetProcessHeap(), 0, m_pBuf);
    }

TempBuffer::TempBuffer ( ULONG cBytes ) [inline]

Definition at line 53 of file globals.h.

                             {
        m_pBuf = (cBytes <= 120) ? &m_szTmpBuf : HeapAlloc(GetProcessHeap(), 0, cBytes);
        m_fHeapAlloc = (cBytes > 120);
    }

TempBuffer::~TempBuffer ( ) [inline]

Definition at line 57 of file globals.h.

                  {
        if (m_pBuf && m_fHeapAlloc) HeapFree(GetProcessHeap(), 0, m_pBuf);
    }

TempBuffer::TempBuffer ( ULONG cBytes ) [inline]

Definition at line 44 of file globals.h.

                             {
        m_pBuf = (cBytes <= 120) ? &m_szTmpBuf : HeapAlloc(GetProcessHeap(), 0, cBytes);
        m_fHeapAlloc = (cBytes > 120);
    }

TempBuffer::~TempBuffer ( ) [inline]

Definition at line 48 of file globals.h.

                  {
        if (m_pBuf && m_fHeapAlloc) HeapFree(GetProcessHeap(), 0, m_pBuf);
    }

TempBuffer::TempBuffer ( ULONG cBytes ) [inline]

Definition at line 53 of file globals.h.

                             {
        m_pBuf = (cBytes <= 120) ? &m_szTmpBuf : HeapAlloc(GetProcessHeap(), 0, cBytes);
        m_fHeapAlloc = (cBytes > 120);
    }

TempBuffer::~TempBuffer ( ) [inline]

Definition at line 57 of file globals.h.

                  {
        if (m_pBuf && m_fHeapAlloc) HeapFree(GetProcessHeap(), 0, m_pBuf);
    }

TempBuffer::TempBuffer ( ULONG cBytes ) [inline]

Definition at line 53 of file globals.h.

                             {
        m_pBuf = (cBytes <= 120) ? &m_szTmpBuf : HeapAlloc(GetProcessHeap(), 0, cBytes);
        m_fHeapAlloc = (cBytes > 120);
    }

TempBuffer::~TempBuffer ( ) [inline]

Definition at line 57 of file globals.h.

                  {
        if (m_pBuf && m_fHeapAlloc) HeapFree(GetProcessHeap(), 0, m_pBuf);
    }

TempBuffer::TempBuffer ( ULONG cBytes ) [inline]

Definition at line 55 of file globals.h.

                             {
        m_pBuf = (cBytes <= 120) ? &m_szTmpBuf : HeapAlloc(GetProcessHeap(), 0, cBytes);
        m_fHeapAlloc = (cBytes > 120);
    }

TempBuffer::~TempBuffer ( ) [inline]

Definition at line 59 of file globals.h.

                  {
        if (m_pBuf && m_fHeapAlloc) HeapFree(GetProcessHeap(), 0, m_pBuf);
    }

TempBuffer::TempBuffer ( ULONG cBytes ) [inline]

Definition at line 45 of file globals.h.

                             {
        m_pBuf = (cBytes <= 120) ? &m_szTmpBuf : HeapAlloc(GetProcessHeap(), 0, cBytes);
        m_fHeapAlloc = (cBytes > 120);
    }

TempBuffer::~TempBuffer ( ) [inline]

Definition at line 49 of file globals.h.

                  {
        if (m_pBuf && m_fHeapAlloc) HeapFree(GetProcessHeap(), 0, m_pBuf);
    }

TempBuffer::TempBuffer ( ULONG cBytes ) [inline]

Definition at line 53 of file globals.h.

                             {
        m_pBuf = (cBytes <= 120) ? &m_szTmpBuf : HeapAlloc(GetProcessHeap(), 0, cBytes);
        m_fHeapAlloc = (cBytes > 120);
    }

TempBuffer::~TempBuffer ( ) [inline]

Definition at line 57 of file globals.h.

                  {
        if (m_pBuf && m_fHeapAlloc) HeapFree(GetProcessHeap(), 0, m_pBuf);
    }

TempBuffer::TempBuffer ( ULONG cBytes ) [inline]

Definition at line 53 of file globals.h.

                             {
        m_pBuf = (cBytes <= 120) ? &m_szTmpBuf : HeapAlloc(GetProcessHeap(), 0, cBytes);
        m_fHeapAlloc = (cBytes > 120);
    }

TempBuffer::~TempBuffer ( ) [inline]

Definition at line 57 of file globals.h.

                  {
        if (m_pBuf && m_fHeapAlloc) HeapFree(GetProcessHeap(), 0, m_pBuf);
    }

Member Function Documentation

void* TempBuffer::GetBuffer ( ) [inline]

Definition at line 60 of file globals.h.

                      {
        return m_pBuf;
    }

void* TempBuffer::GetBuffer ( ) [inline]

Definition at line 60 of file globals.h.

                      {
        return m_pBuf;
    }

void* TempBuffer::GetBuffer ( ) [inline]

Definition at line 60 of file globals.h.

                      {
        return m_pBuf;
    }

void* TempBuffer::GetBuffer ( ) [inline]

Definition at line 52 of file globals.h.

                      {
        return m_pBuf;
    }

void* TempBuffer::GetBuffer ( ) [inline]

Definition at line 62 of file globals.h.

                      {
        return m_pBuf;
    }

void* TempBuffer::GetBuffer ( ) [inline]

Definition at line 60 of file globals.h.

                      {
        return m_pBuf;
    }

void* TempBuffer::GetBuffer ( ) [inline]

Definition at line 60 of file globals.h.

                      {
        return m_pBuf;
    }

void* TempBuffer::GetBuffer ( ) [inline]

Definition at line 51 of file globals.h.

                      {
        return m_pBuf;
    }

void* TempBuffer::GetBuffer ( ) [inline]

Definition at line 60 of file globals.h.

                      {
        return m_pBuf;
    }

void* TempBuffer::GetBuffer ( ) [inline]

Definition at line 60 of file globals.h.

                      {
        return m_pBuf;
    }

void* TempBuffer::GetBuffer ( ) [inline]

Definition at line 61 of file globals.h.

                      {
        return m_pBuf;
    }

void* TempBuffer::GetBuffer ( ) [inline]

Definition at line 65 of file globals.h.

                      {
        return m_pBuf;
    }

void* TempBuffer::GetBuffer ( ) [inline]

Definition at line 60 of file globals.h.

                      {
        return m_pBuf;
    }

void* TempBuffer::GetBuffer ( ) [inline]

Definition at line 60 of file Globals.h.

                      {
        return m_pBuf;
    }

void* TempBuffer::GetBuffer ( ) [inline]

Definition at line 60 of file globals.h.

                      {
        return m_pBuf;
    }

void* TempBuffer::GetBuffer ( ) [inline]

Definition at line 65 of file globals.h.

                      {
        return m_pBuf;
    }

void* TempBuffer::GetBuffer ( ) [inline]

Definition at line 68 of file globals.h.

                      {
        return m_pBuf;
    }

void* TempBuffer::GetBuffer ( ) [inline]

Definition at line 51 of file globals.h.

                      {
        return m_pBuf;
    }

void* TempBuffer::GetBuffer ( ) [inline]

Definition at line 60 of file globals.h.

                      {
        return m_pBuf;
    }

void* TempBuffer::GetBuffer ( ) [inline]

Definition at line 60 of file globals.h.

                      {
        return m_pBuf;
    }

Member Data Documentation

unsigned TempBuffer::m_fHeapAlloc [private]

Definition at line 69 of file globals.h.

void * TempBuffer::m_pBuf [private]

Definition at line 65 of file globals.h.

char TempBuffer::m_szTmpBuf [private]

Definition at line 68 of file globals.h.

The documentation for this class was generated from the following files:
  • SysMgmt/MMC/About/globals.h
  • SysMgmt/MMC/ActiveX/globals.h
  • SysMgmt/MMC/CMenu/globals.h
  • SysMgmt/MMC/CMenuExt/globals.h
  • SysMgmt/MMC/Complete/globals.h
  • SysMgmt/MMC/CutCopy/globals.h
  • SysMgmt/MMC/Extens/globals.h
  • SysMgmt/MMC/Help/Globals.h
  • SysMgmt/MMC/Menubtn/globals.h
  • SysMgmt/MMC/Multisel/globals.h
  • SysMgmt/MMC/Nameext/globals.h
  • SysMgmt/MMC/Nodes/globals.h
  • SysMgmt/MMC/Openserv/globals.h
  • SysMgmt/MMC/Ppgeext/globals.h
  • SysMgmt/MMC/Proppage/globals.h
  • SysMgmt/MMC/Simple/globals.h
  • SysMgmt/MMC/Taskpads/globals.h
  • SysMgmt/MMC/Tbarext/globals.h
  • SysMgmt/MMC/Toolbar/globals.h
  • SysMgmt/MMC/WMI/globals.h
Generated on Wed Nov 13 2024 16:58:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TEXTBUTTON_STRUCT Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

TEXTBUTTON_STRUCT Struct Reference

#include "ToolBar.h"

List of all members.

Public Attributes

HWND | hWndButton
INT | idButton
LPTSTR lpButtonText

Detailed Description

Definition at line 23 of file ToolBar.h.

Member Data Documentation

HWND TEXTBUTTON_STRUCT::hWndButton

Definition at line 26 of file ToolBar.h.

INT TEXTBUTTON_STRUCT::idButton

Definition at line 25 of file ToolBar.h.

LPTSTR TEXTBUTTON_STRUCT::lpButtonText

Definition at line 24 of file ToolBar.h.

The documentation for this struct was generated from the following file:
  • WinBase/Debug/Deb/ToolBar.h
Generated on Wed Nov 13 2024 16:58:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: THEPROVIDERLib::MSOmniProv Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • THEPROVIDERLib
  • THEPROVIDERLib::MSOmniProv

THEPROVIDERLib::MSOmniProv Class Reference

import "theprovider.idl";

Detailed Description

Definition at line 24 of file theprovider.idl.

The documentation for this class was generated from the following file:
  • Dataaccess/oledb/omniprov/source/theprovider.idl
Generated on Wed Nov 13 2024 16:58:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: THREAD_STRUCT Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

THREAD_STRUCT Struct Reference

#include "quiktest.h"

List of all members.

Public Attributes

HDBC | hdbc
HENV | henv
FIELDINFO rgFieldInfo
TCHAR | szTableName [MAX_TABLE_NAME]

Detailed Description

Definition at line 185 of file quiktest.h.

Member Data Documentation

HDBC THREAD_STRUCT::hdbc

Definition at line 187 of file quiktest.h.

HENV THREAD_STRUCT::henv

Definition at line 186 of file quiktest.h.

FIELDINFO THREAD_STRUCT::rgFieldInfo

Definition at line 189 of file quiktest.h.

TCHAR THREAD_STRUCT::szTableName[MAX_TABLE_NAME]

Definition at line 188 of file quiktest.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/odbc/quiktest/quiktest.h
Generated on Wed Nov 13 2024 16:58:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ThreadArg_Struct Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

ThreadArg_Struct Struct Reference

List of all members.

Public Attributes

IWbemEventSink * | m_EventSink
IWbemDecoupledBasicEventProvider * | m_Registrar
IWbemServices * | m_Service
IWbemObjectSink * | m_Sink

Detailed Description

Definition at line 272 of file Main.cpp.

Member Data Documentation

IWbemEventSink* ThreadArg_Struct::m_EventSink

Definition at line 276 of file Main.cpp.

IWbemDecoupledBasicEventProvider* ThreadArg_Struct::m_Registrar

Definition at line 277 of file Main.cpp.

IWbemServices* ThreadArg_Struct::m_Service

Definition at line 274 of file Main.cpp.

IWbemObjectSink* ThreadArg_Struct::m_Sink

Definition at line 275 of file Main.cpp.

The documentation for this struct was generated from the following file:
  • SysMgmt/WMI/VC/decoupled/Event_Provider/Main.cpp
Generated on Wed Nov 13 2024 16:58:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ThreadArgs Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

ThreadArgs Struct Reference

List of all members.

Public Attributes

BOOL bImpersonating
handle_t | hFileRepServer
HANDLE hLocalFile
BYTE | pbBuf [MAX_BUFSIZE]
PCONTEXT_HANDLE_TYPE | phContext

Detailed Description

Definition at line 37 of file filerepclientproc.cpp.

Member Data Documentation

BOOL ThreadArgs::bImpersonating

Definition at line 44 of file filerepclientproc.cpp.

handle_t ThreadArgs::hFileRepServer

Definition at line 38 of file filerepclientproc.cpp.

HANDLE ThreadArgs::hLocalFile

Definition at line 39 of file filerepclientproc.cpp.

BYTE ThreadArgs::pbBuf

Definition at line 41 of file filerepclientproc.cpp.

PCONTEXT_HANDLE_TYPE ThreadArgs::phContext

Definition at line 40 of file filerepclientproc.cpp.

The documentation for this struct was generated from the following files:
  • NetDS/RPC/FileRep/filerepsecure/filerepclientproc.cpp
  • NetDS/RPC/FileRep/filerepsimple/filerepclientproc.cpp
Generated on Wed Nov 13 2024 16:58:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: THREADARGS Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

THREADARGS Struct Reference

List of all members.

Public Attributes

UINT compopts
BOOL fDeep
BOOL fDescribeFiles
BOOL fExit
BOOL fInputFile
BOOL fInputFileSingle
LPSTR first
BOOL fOpenedFiles
UINT listopts
LPSTR notify
LPSTR savecomp
LPSTR savelist
LPSTR second
VIEW view

Detailed Description

Definition at line 216 of file sdkdiff.cpp.

Member Data Documentation

UINT THREADARGS::compopts

Definition at line 223 of file sdkdiff.cpp.

BOOL THREADARGS::fDeep

Definition at line 225 of file sdkdiff.cpp.

BOOL THREADARGS::fDescribeFiles

Definition at line 228 of file sdkdiff.cpp.

BOOL THREADARGS::fExit

Definition at line 226 of file sdkdiff.cpp.

BOOL THREADARGS::fInputFile

Definition at line 229 of file sdkdiff.cpp.

BOOL THREADARGS::fInputFileSingle

Definition at line 230 of file sdkdiff.cpp.

LPSTR THREADARGS::first

Definition at line 217 of file sdkdiff.cpp.

BOOL THREADARGS::fOpenedFiles

Definition at line 227 of file sdkdiff.cpp.

UINT THREADARGS::listopts

Definition at line 222 of file sdkdiff.cpp.

LPSTR THREADARGS::notify

Definition at line 221 of file sdkdiff.cpp.

LPSTR THREADARGS::savecomp

Definition at line 220 of file sdkdiff.cpp.

LPSTR THREADARGS::savelist

Definition at line 219 of file sdkdiff.cpp.

LPSTR THREADARGS::second

Definition at line 218 of file sdkdiff.cpp.

VIEW THREADARGS::view

Definition at line 224 of file sdkdiff.cpp.

The documentation for this struct was generated from the following file:
  • Begin/sdkdiff/sdkdiff.cpp
Generated on Wed Nov 13 2024 16:58:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: THREADDATA Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

THREADDATA Struct Reference

#include "bankdlg.h"

List of all members.

Public Attributes

BOOL bChatty
BOOL bCreatePerIteration
BOOL bRandom
EnumCoInit eCoInit
BankLang eLang
int | nAmount
int | nFrom
int | nIters
int | nTestType
int | nThreads
int | nTo
int | nTranType

Detailed Description

Definition at line 47 of file bankdlg.h.

Member Data Documentation

BOOL THREADDATA::bChatty

Definition at line 54 of file bankdlg.h.

BOOL THREADDATA::bCreatePerIteration

Definition at line 60 of file bankdlg.h.

BOOL THREADDATA::bRandom

Definition at line 53 of file bankdlg.h.

EnumCoInit THREADDATA::eCoInit

Definition at line 51 of file bankdlg.h.

BankLang THREADDATA::eLang

Definition at line 61 of file bankdlg.h.

int THREADDATA::nAmount

Definition at line 58 of file bankdlg.h.

int THREADDATA::nFrom

Definition at line 55 of file bankdlg.h.

int THREADDATA::nIters

Definition at line 52 of file bankdlg.h.

int THREADDATA::nTestType

Definition at line 50 of file bankdlg.h.

int THREADDATA::nThreads

Definition at line 59 of file bankdlg.h.

int THREADDATA::nTo

Definition at line 56 of file bankdlg.h.

int THREADDATA::nTranType

Definition at line 57 of file bankdlg.h.

The documentation for this struct was generated from the following file:
  • Com/Services/Object_Pooling/OPBankSample/OPBank/bankdlg.h
Generated on Wed Nov 13 2024 16:58:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: THREADINFO Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

THREADINFO Struct Reference

List of all members.

Public Attributes

HANDLE | hThread [MAXTHREADS]
SOCKET | sd [MAXTHREADS]

Detailed Description

Definition at line 64 of file IocpClient.Cpp.

Member Data Documentation

HANDLE THREADINFO::hThread[MAXTHREADS]

Definition at line 65 of file IocpClient.Cpp.

SOCKET THREADINFO::sd[MAXTHREADS]

Definition at line 66 of file IocpClient.Cpp.

The documentation for this struct was generated from the following file:
  • NetDS/WinSock/iocp/IocpClient.Cpp
Generated on Wed Nov 13 2024 16:58:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Title Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

Title Struct Reference

#include "table.h"

List of all members.

Public Attributes

Props props
LPSTR ptext
CellPos xpos
CellPos ypos

Detailed Description

Definition at line 310 of file table.h.

Member Data Documentation

Props Title::props

Definition at line 312 of file table.h.

LPSTR Title::ptext

Definition at line 313 of file table.h.

CellPos Title::xpos

Definition at line 311 of file table.h.

CellPos Title::ypos

Definition at line 311 of file table.h.

The documentation for this struct was generated from the following file:
  • Begin/sdkdiff/table.h
Generated on Wed Nov 13 2024 16:58:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tpc_hdr Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tpc_hdr Struct Reference

#include "iphdr.h"

List of all members.

Public Attributes

unsigned long | ack_num
unsigned short | dest_portno
unsigned short | lenflags
unsigned long | seq_num
unsigned short | src_portno
unsigned short | tcp_checksum
unsigned short | tcp_urgentptr
unsigned short | window_size

Detailed Description

Definition at line 64 of file iphdr.h.

Member Data Documentation

unsigned long tpc_hdr::ack_num

Definition at line 69 of file iphdr.h.

unsigned short tpc_hdr::dest_portno

Definition at line 67 of file iphdr.h.

unsigned short tpc_hdr::lenflags

Definition at line 70 of file iphdr.h.

unsigned long tpc_hdr::seq_num

Definition at line 68 of file iphdr.h.

unsigned short tpc_hdr::src_portno

Definition at line 66 of file iphdr.h.

unsigned short tpc_hdr::tcp_checksum

Definition at line 72 of file iphdr.h.

unsigned short tpc_hdr::tcp_urgentptr

Definition at line 73 of file iphdr.h.

unsigned short tpc_hdr::window_size

Definition at line 71 of file iphdr.h.

The documentation for this struct was generated from the following file:
  • NetDS/WinSock/rcvall/iphdr.h
Generated on Wed Nov 13 2024 16:58:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tphys_connect_info Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tphys_connect_info Struct Reference

#include "nullmdm.h"

List of all members.

Public Attributes

UINT connectionID
UINT resultCode

Detailed Description

Definition at line 42 of file nullmdm.h.

Member Data Documentation

UINT tphys_connect_info::connectionID

Definition at line 44 of file nullmdm.h.

UINT tphys_connect_info::resultCode

Definition at line 45 of file nullmdm.h.

The documentation for this struct was generated from the following file:
  • Web/NetMeeting/PlugTransport/nullmdm.h
Generated on Wed Nov 13 2024 16:58:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TPropBase< TYPE > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

TPropBase< TYPE > Class Template Reference

#include "property.h"

Inherits CVector< TYPE >.

List of all members.

Public Member Functions

TPropBase (ULONG cElements=0, TYPE *rgElements=NULL)
virtual | ~TPropBase ()
virtual TYPE * | AddProperty (DBPROPID dwPropertyID, const DBID &colid)
virtual TYPE * | FindProperty (DBPROPID dwPropertyID, const DBID &colid)=0
virtual TYPE * | GetProperties ()

Detailed Description

template<class TYPE>
class TPropBase< TYPE >

Definition at line 24 of file property.h.

Constructor & Destructor Documentation

template<class TYPE>
TPropBase< TYPE >::TPropBase | ( | ULONG | cElements = 0,
 |  | TYPE * | rgElements = NULL
 | ) |  |

Definition at line 22 of file property.cpp.

{
  if(cElements)
    Attach(cElements, rgElements);
}

template<class TYPE >
TPropBase< TYPE >::~TPropBase ( ) [virtual]

Definition at line 32 of file property.cpp.

{
  RemoveAll();
}

Member Function Documentation

template<class TYPE >
TYPE * TPropBase< TYPE >::AddProperty | ( | DBPROPID | dwPropertyID,
 |  | const DBID & | colid |
 | ) |  |  | [virtual]

Definition at line 42 of file property.cpp.

{
  //See if the property exists...
  TYPE* pProp = FindProperty(dwPropertyID, colid);
  if(!pProp)
  {
    TYPE dbProp;
    memset(&dbProp, 0, sizeof(TYPE));

    //Add this property...
    pProp = AddElement(dbProp);
  }

  return pProp;
}

template<class TYPE>
virtual TYPE* TPropBase< TYPE >::FindProperty | ( | DBPROPID | dwPropertyID,
 |  | const DBID & | colid |
 | ) |  |  | [pure virtual]

Implemented in CProperties, CPropertyInfos, and CPropertyIDs.

template<class TYPE>
virtual TYPE* TPropBase< TYPE >::GetProperties ( ) [inline, virtual]

Definition at line 32 of file property.h.

{ return (TYPE*)GetElements(); }

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/property.h
  • Dataaccess/oledb/rowsetviewer/property.cpp
Generated on Wed Nov 13 2024 16:58:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TPropSetBase< TYPE, OBJTYPE > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions

TPropSetBase< TYPE, OBJTYPE > Class Template Reference

#include "property.h"

Inherits CVector< TYPE >.

List of all members.

Public Member Functions

TPropSetBase (ULONG cElements=0, TYPE *rgElements=NULL)
virtual | ~TPropSetBase ()
virtual TYPE * | AddPropSet (REFGUID guidPropertySet)
virtual TYPE * | FindPropSet (REFGUID guidPropertySet)
virtual TYPE * | GetPropSets ()
virtual void | RemoveAll ()

Detailed Description

template<class TYPE, class OBJTYPE>
class TPropSetBase< TYPE, OBJTYPE >

Definition at line 133 of file property.h.

Constructor & Destructor Documentation

template<class TYPE, class OBJTYPE >
TPropSetBase< TYPE, OBJTYPE >::TPropSetBase | ( | ULONG | cElements = 0,
 |  | TYPE * | rgElements = NULL
 | ) |  |

Definition at line 363 of file property.cpp.

{
  if(cElements)
    Attach(cElements, rgElements);
}

template<class TYPE , class OBJTYPE >
TPropSetBase< TYPE, OBJTYPE >::~TPropSetBase ( ) [virtual]

Definition at line 373 of file property.cpp.

{
  RemoveAll();
}

Member Function Documentation

template<class TYPE , class OBJTYPE >
TYPE * TPropSetBase< TYPE, OBJTYPE >::AddPropSet ( REFGUID guidPropertySet ) [virtual]

Definition at line 397 of file property.cpp.

{
  //See if the property set already exists...
  TYPE* pPropSet = FindPropSet(guidPropertySet);
  if(!pPropSet)
  {
    TYPE dbPropSet;
    memset(&dbPropSet, 0, sizeof(TYPE));
    dbPropSet.guidPropertySet = guidPropertySet;

    //Add this property set
    pPropSet = AddElement(dbPropSet);
  }

  return pPropSet;
}

template<class TYPE , class OBJTYPE >
TYPE * TPropSetBase< TYPE, OBJTYPE >::FindPropSet ( REFGUID guidPropertySet ) [virtual]

Definition at line 419 of file property.cpp.

{
  //Loop over the number of property sets
  for(ULONG iPropSet=0; iPropSet<m_cElements; iPropSet++)
  {
    TYPE* pPropSet = &m_rgElements[iPropSet];

    //Make sure where looking in the right property set
    if(guidPropertySet == pPropSet->guidPropertySet)
      return pPropSet;
  }

  return NULL;
}

template<class TYPE, class OBJTYPE>
virtual TYPE* TPropSetBase< TYPE, OBJTYPE >::GetPropSets ( ) [inline, virtual]

Definition at line 144 of file property.h.

{ return (TYPE*)GetElements(); }

template<class TYPE , class OBJTYPE >
void TPropSetBase< TYPE, OBJTYPE >::RemoveAll ( ) [virtual]

Reimplemented from CVector< TYPE >.

Definition at line 383 of file property.cpp.

{
   //We need to walk and free out-of-line data...
    ::FreeProperties(&m_cElements, &m_rgElements);

  //Delegate
  CVector<TYPE>::RemoveAll();
}

The documentation for this class was generated from the following files:
  • Dataaccess/oledb/rowsetviewer/property.h
  • Dataaccess/oledb/rowsetviewer/property.cpp
Generated on Wed Nov 13 2024 16:58:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tree Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tree Struct Reference

List of all members.

Public Attributes

TREEITEM first

Detailed Description

Definition at line 33 of file tree.cpp.

Member Data Documentation

TREEITEM tree::first

Definition at line 34 of file tree.cpp.

The documentation for this struct was generated from the following file:
  • Begin/sdkdiff/tree.cpp
Generated on Wed Nov 13 2024 16:58:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TREEINFO Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

TREEINFO Struct Reference

#include "wizard.h"

List of all members.

Public Attributes

HTREEITEM | hItem
HTREEITEM | hParent
ULONG ulIndex

Detailed Description

Definition at line 36 of file wizard.h.

Member Data Documentation

HTREEITEM TREEINFO::hItem

Definition at line 40 of file wizard.h.

HTREEITEM TREEINFO::hParent

Definition at line 39 of file wizard.h.

ULONG TREEINFO::ulIndex

Definition at line 38 of file wizard.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/oledb/tablecopy/wizard.h
Generated on Wed Nov 13 2024 16:58:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: treeitem Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

treeitem Struct Reference

List of all members.

Public Attributes

LPVOID data
TREEKEY key
TREEITEM left
UINT length
TREEITEM right
TREE root

Detailed Description

Definition at line 40 of file tree.cpp.

Member Data Documentation

LPVOID treeitem::data

Definition at line 45 of file tree.cpp.

TREEKEY treeitem::key

Definition at line 42 of file tree.cpp.

TREEITEM treeitem::left

Definition at line 43 of file tree.cpp.

UINT treeitem::length

Definition at line 44 of file tree.cpp.

TREEITEM treeitem::right

Definition at line 43 of file tree.cpp.

TREE treeitem::root

Definition at line 41 of file tree.cpp.

The documentation for this struct was generated from the following file:
  • Begin/sdkdiff/tree.cpp
Generated on Wed Nov 13 2024 16:58:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tReq Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tReq Struct Reference

List of all members.

Public Attributes

RPC_ASYNC_STATE | Async
BOOL bAllPullsDone
BOOL bAsyncCallFailureReceived
BOOL bBuf
BOOL bCallCancelled
BOOL bCallComplete
BOOL bCallMade
BOOL bDataAvailable
BOOL bFailureFromPull
BOOL bFailureFromWrite
BOOL bImpersonating
BOOL bPullOutstanding
BOOL bRpcImpersonating
LONG | CurrentExtendedSize
OVERLAPPED | FileOl
LONG | FileWritePos
handle_t | hFileRepClient
handle_t | hFileRepServer
HANDLE hLocalFile
HANDLE hTokenHandle
LPTSTR LocalFileName
CRITICAL_SECTION | Lock
LONG | nBytesOutstanding
LONG | nWritesOutstanding
ASYNC_CHAR_PIPE_TYPE | OutPipe
BYTE | pbBuf [PULL_BUFSIZE]
PCONTEXT_HANDLE_TYPE | phContext
UINT Pri
PSID pSID
LPTSTR RemoteFileName
LPTSTR ServerName
ReqState State
DWORD Status

Detailed Description

Definition at line 82 of file FileRepClientProc.cpp.

Member Data Documentation

RPC_ASYNC_STATE tReq::Async

Definition at line 112 of file FileRepClientProc.cpp.

BOOL tReq::bAllPullsDone

Definition at line 139 of file FileRepClientProc.cpp.

BOOL tReq::bAsyncCallFailureReceived

Definition at line 150 of file FileRepClientProc.cpp.

BOOL tReq::bBuf

Definition at line 131 of file FileRepClientProc.cpp.

BOOL tReq::bCallCancelled

Definition at line 142 of file FileRepClientProc.cpp.

BOOL tReq::bCallComplete

Definition at line 146 of file FileRepClientProc.cpp.

BOOL tReq::bCallMade

Definition at line 141 of file FileRepClientProc.cpp.

BOOL tReq::bDataAvailable

Definition at line 136 of file FileRepClientProc.cpp.

BOOL tReq::bFailureFromPull

Definition at line 157 of file FileRepClientProc.cpp.

BOOL tReq::bFailureFromWrite

Definition at line 160 of file FileRepClientProc.cpp.

BOOL tReq::bImpersonating

Definition at line 97 of file FileRepClientProc.cpp.

BOOL tReq::bPullOutstanding

Definition at line 127 of file FileRepClientProc.cpp.

BOOL tReq::bRpcImpersonating

Definition at line 70 of file filerepclientproc.cpp.

LONG tReq::CurrentExtendedSize

Definition at line 117 of file FileRepClientProc.cpp.

OVERLAPPED tReq::FileOl

Definition at line 119 of file FileRepClientProc.cpp.

LONG tReq::FileWritePos

Definition at line 116 of file FileRepClientProc.cpp.

handle_t tReq::hFileRepClient

Definition at line 87 of file FileRepClientProc.cpp.

handle_t tReq::hFileRepServer

Definition at line 85 of file FileRepClientProc.cpp.

HANDLE tReq::hLocalFile

Definition at line 90 of file FileRepClientProc.cpp.

HANDLE tReq::hTokenHandle

Definition at line 89 of file FileRepClientProc.cpp.

LPTSTR tReq::LocalFileName

Definition at line 94 of file FileRepClientProc.cpp.

CRITICAL_SECTION tReq::Lock

Definition at line 121 of file FileRepClientProc.cpp.

LONG tReq::nBytesOutstanding

Definition at line 124 of file FileRepClientProc.cpp.

LONG tReq::nWritesOutstanding

Definition at line 123 of file FileRepClientProc.cpp.

ASYNC_CHAR_PIPE_TYPE tReq::OutPipe

Definition at line 109 of file FileRepClientProc.cpp.

BYTE tReq::pbBuf[PULL_BUFSIZE]

Definition at line 114 of file FileRepClientProc.cpp.

PCONTEXT_HANDLE_TYPE tReq::phContext

Definition at line 63 of file filerepclientproc.cpp.

UINT tReq::Pri

Definition at line 100 of file FileRepClientProc.cpp.

PSID tReq::pSID

Definition at line 103 of file FileRepClientProc.cpp.

LPTSTR tReq::RemoteFileName

Definition at line 93 of file FileRepClientProc.cpp.

LPTSTR tReq::ServerName

Definition at line 92 of file FileRepClientProc.cpp.

ReqState tReq::State

Definition at line 106 of file FileRepClientProc.cpp.

DWORD tReq::Status

Definition at line 154 of file FileRepClientProc.cpp.

The documentation for this struct was generated from the following files:
  • NetDS/RPC/FileRep/FileRepAsyncPipe/FileRepClientProc.cpp
  • NetDS/RPC/FileRep/filerepmultiuser/filerepclientproc.cpp
Generated on Wed Nov 13 2024 16:58:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TS_VERSION_INFO Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

TS_VERSION_INFO Struct Reference

#include "SysInfo.h"

List of all members.

Public Attributes

OSVERSIONINFO | osvi
SYSTEM_INFO | si
char | szClientName [MAX_COMPUTERNAME_LENGTH+1]
TCHAR | szComputerName [MAX_COMPUTERNAME_LENGTH+1]
TCHAR | szUserName [UNLEN+1]

Detailed Description

Definition at line 56 of file SysInfo.h.

Member Data Documentation

OSVERSIONINFO TS_VERSION_INFO::osvi

Definition at line 60 of file SysInfo.h.

SYSTEM_INFO TS_VERSION_INFO::si

Definition at line 61 of file SysInfo.h.

char TS_VERSION_INFO::szClientName[MAX_COMPUTERNAME_LENGTH+1]

Definition at line 57 of file SysInfo.h.

TCHAR TS_VERSION_INFO::szComputerName[MAX_COMPUTERNAME_LENGTH+1]

Definition at line 58 of file SysInfo.h.

TCHAR TS_VERSION_INFO::szUserName[UNLEN+1]

Definition at line 59 of file SysInfo.h.

The documentation for this struct was generated from the following file:
  • WinBase/WtsApi/TSSysInf/Inc/SysInfo.h
Generated on Wed Nov 13 2024 16:58:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: tSReq Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

tSReq Struct Reference

List of all members.

Public Attributes

ActionType Action
RPC_ASYNC_STATE * | Async
BOOL bBuf
BOOL bImpersonating
BOOL bLastDataPushIssued
BOOL bNullPush
BOOL bPushOutstanding
BOOL bReadOutstanding
BOOL bReadsDone
ULONG cbRead
BOOL fCallInvalidated
OVERLAPPED | FileOl
LONG | FileReadPos
handle_t | hFileRepClient
HANDLE hLocalFile
HANDLE hTokenHandle
LPTSTR LocalFileName
CRITICAL_SECTION | Lock
ASYNC_CHAR_PIPE_TYPE * | OutPipe
BYTE | pbReadBuf [PULL_BUFSIZE]
UINT Pri
PSID pSID
ULONG PushSize
SReqState State
DWORD Status

Detailed Description

Definition at line 68 of file FileRepServerProc.cpp.

Member Data Documentation

ActionType tSReq::Action

Definition at line 101 of file FileRepServerProc.cpp.

RPC_ASYNC_STATE* tSReq::Async

Definition at line 92 of file FileRepServerProc.cpp.

BOOL tSReq::bBuf

Definition at line 107 of file FileRepServerProc.cpp.

BOOL tSReq::bImpersonating

Definition at line 78 of file FileRepServerProc.cpp.

BOOL tSReq::bLastDataPushIssued

Definition at line 116 of file FileRepServerProc.cpp.

BOOL tSReq::bNullPush

Definition at line 122 of file FileRepServerProc.cpp.

BOOL tSReq::bPushOutstanding

Definition at line 105 of file FileRepServerProc.cpp.

BOOL tSReq::bReadOutstanding

Definition at line 106 of file FileRepServerProc.cpp.

BOOL tSReq::bReadsDone

Definition at line 119 of file FileRepServerProc.cpp.

ULONG tSReq::cbRead

Definition at line 109 of file FileRepServerProc.cpp.

BOOL tSReq::fCallInvalidated

Definition at line 126 of file FileRepServerProc.cpp.

OVERLAPPED tSReq::FileOl

Definition at line 99 of file FileRepServerProc.cpp.

LONG tSReq::FileReadPos

Definition at line 96 of file FileRepServerProc.cpp.

handle_t tSReq::hFileRepClient

Definition at line 70 of file FileRepServerProc.cpp.

HANDLE tSReq::hLocalFile

Definition at line 73 of file FileRepServerProc.cpp.

HANDLE tSReq::hTokenHandle

Definition at line 71 of file FileRepServerProc.cpp.

LPTSTR tSReq::LocalFileName

Definition at line 75 of file FileRepServerProc.cpp.

CRITICAL_SECTION tSReq::Lock

Definition at line 103 of file FileRepServerProc.cpp.

ASYNC_CHAR_PIPE_TYPE* tSReq::OutPipe

Definition at line 89 of file FileRepServerProc.cpp.

BYTE tSReq::pbReadBuf[PULL_BUFSIZE]

Definition at line 94 of file FileRepServerProc.cpp.

UINT tSReq::Pri

Definition at line 81 of file FileRepServerProc.cpp.

PSID tSReq::pSID

Definition at line 84 of file FileRepServerProc.cpp.

ULONG tSReq::PushSize

Definition at line 97 of file FileRepServerProc.cpp.

SReqState tSReq::State

Definition at line 86 of file FileRepServerProc.cpp.

DWORD tSReq::Status

Definition at line 132 of file FileRepServerProc.cpp.

The documentation for this struct was generated from the following file:
  • NetDS/RPC/FileRep/FileRepAsyncPipe/FileRepServerProc.cpp
Generated on Wed Nov 13 2024 16:58:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TYPEINFO Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

TYPEINFO Struct Reference

#include "table.h"

List of all members.

Public Attributes

VARIANT_BOOL | fIsAutoInc
VARIANT_BOOL | fIsNullable
ULONG ulColumnSize
WCHAR | wszCreateParams [MAX_NAME_LEN]
WCHAR | wszTypeName [MAX_NAME_LEN]
USHORT wType

Detailed Description

Definition at line 40 of file table.h.

Member Data Documentation

VARIANT_BOOL TYPEINFO::fIsAutoInc

Definition at line 47 of file table.h.

VARIANT_BOOL TYPEINFO::fIsNullable

Definition at line 46 of file table.h.

ULONG TYPEINFO::ulColumnSize

Definition at line 44 of file table.h.

WCHAR TYPEINFO::wszCreateParams[MAX_NAME_LEN]

Definition at line 45 of file table.h.

WCHAR TYPEINFO::wszTypeName[MAX_NAME_LEN]

Definition at line 42 of file table.h.

USHORT TYPEINFO::wType

Definition at line 43 of file table.h.

The documentation for this struct was generated from the following file:
  • Dataaccess/oledb/tablecopy/table.h
Generated on Wed Nov 13 2024 16:58:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: UDDI::Tools::CategoryTreeNode Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • UDDI
  • Tools
  • UDDI::Tools::CategoryTreeNode
Public Member Functions | Properties | Private Member Functions | Private Attributes

UDDI::Tools::CategoryTreeNode Class Reference

List of all members.

Public Member Functions

CategoryTreeNode (CategoryValue val)

Properties

CategoryValue | CategoryValue [get]
internal bool | HasDownloadedChildren [get, set]
internal bool | IsSchemeNode [get]

Private Member Functions

CategoryTreeNode ()

Private Attributes

CategoryValue | _categoryValue
bool | _hasDownloadedChildren

Detailed Description

Definition at line 238 of file categorytree.cs.

Constructor & Destructor Documentation

UDDI::Tools::CategoryTreeNode::CategoryTreeNode ( ) [inline, private]

Definition at line 240 of file categorytree.cs.

{}

UDDI::Tools::CategoryTreeNode::CategoryTreeNode ( CategoryValue val ) [inline]

Definition at line 241 of file categorytree.cs.

    {
      _categoryValue = val;

      Text = val.KeyName;
      //
      // Add a blank node to force the + sign.
      //
      Nodes.Add( new TreeNode() );
    }

Member Data Documentation

CategoryValue UDDI::Tools::CategoryTreeNode::_categoryValue [private]

Definition at line 252 of file categorytree.cs.

bool UDDI::Tools::CategoryTreeNode::_hasDownloadedChildren [private]

Definition at line 253 of file categorytree.cs.

Property Documentation

CategoryValue UDDI::Tools::CategoryTreeNode::CategoryValue [get]

Definition at line 256 of file categorytree.cs.

internal bool UDDI::Tools::CategoryTreeNode::HasDownloadedChildren [get, set, private]

Definition at line 264 of file categorytree.cs.

internal bool UDDI::Tools::CategoryTreeNode::IsSchemeNode [get, private]

Definition at line 260 of file categorytree.cs.

The documentation for this class was generated from the following file:
  • UDDI/wsdldiscovery/controls/categorytree.cs
Generated on Wed Nov 13 2024 16:58:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: UDDI::Tools::CategoryTreeView Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • UDDI
  • Tools
  • UDDI::Tools::CategoryTreeView
Public Member Functions | Protected Member Functions | Properties | Private Member Functions | Private Attributes

UDDI::Tools::CategoryTreeView Class Reference

Summary description for categorytree.

List of all members.

Public Member Functions

CategoryTreeView ()
CategoryTreeView (UddiConnection connection)
void | LoadTModels ()

Protected Member Functions

override void | Dispose (bool disposing)

Properties

UddiConnection | Connection [get, set]

Private Member Functions

void | CategoryTree_BeforeExpand (object sender, System.Windows.Forms.TreeViewCancelEventArgs e)
void | GetChildren (CategoryTreeNode node)
void | InitializeComponent ()

Private Attributes

UddiConnection | _connection
System.ComponentModel.Container | components = null

Detailed Description

Definition at line 32 of file categorytree.cs.

Constructor & Destructor Documentation

UDDI::Tools::CategoryTreeView::CategoryTreeView ( ) [inline]

Definition at line 40 of file categorytree.cs.

    {
      // This call is required by the Windows.Forms Form Designer.
      InitializeComponent();

    }

UDDI::Tools::CategoryTreeView::CategoryTreeView ( UddiConnection connection ) [inline]

Definition at line 47 of file categorytree.cs.

                                                         : this()
    {
      _connection = connection;
    }

Member Function Documentation

void UDDI::Tools::CategoryTreeView::CategoryTree_BeforeExpand | ( | object | sender,
 |  | System.Windows.Forms.TreeViewCancelEventArgs | e |
 | ) |  |  | [inline, private]

Definition at line 228 of file categorytree.cs.

    {
      CategoryTreeNode node = (CategoryTreeNode)e.Node;
      if( !node.HasDownloadedChildren )
      {
        GetChildren( node );
      }
    }

override void UDDI::Tools::CategoryTreeView::Dispose ( bool disposing ) [inline, protected]

Clean up any resources being used.

Definition at line 62 of file categorytree.cs.

    {
      if( disposing )
      {
        if(components != null)
        {
          components.Dispose();
        }
      }
      base.Dispose( disposing );
    }

void UDDI::Tools::CategoryTreeView::GetChildren ( CategoryTreeNode node ) [inline, private]

Definition at line 164 of file categorytree.cs.

    {
      node.Nodes.Clear();

      GetRelatedCategories grc = new GetRelatedCategories();

      Category cat = new Category( node.CategoryValue.TModelKey, node.CategoryValue.KeyValue );
      grc.Categories.Add( cat );

      //
      // If the Parent is null, it is a root node (tModel)
      //
      if( node.IsSchemeNode )
        grc.Categories[ 0 ].RelationshipQualifiers.Add( RelationshipQualifier.root );
      else
        grc.Categories[ 0 ].RelationshipQualifiers.Add( RelationshipQualifier.child );

      CategoryList list = null;
      try
      {
        list = grc.Send( _connection );
      }
      catch( Exception e )
      {
        MessageBox.Show( this, e.Message, "Error Loading Tree Node" );
        return;
      }

      CategoryValueCollection values;

      if( node.IsSchemeNode )
        values = list.CategoryInfos[ 0 ].Roots;
      else
        values = list.CategoryInfos[ 0 ].Children;

      foreach( CategoryValue val in values )
      {
        CategoryTreeNode subnode = new CategoryTreeNode( val );
        subnode.CategoryValue.TModelKey = node.CategoryValue.TModelKey;
        node.Nodes.Add( subnode );
      }

      node.HasDownloadedChildren = true;

    }

void UDDI::Tools::CategoryTreeView::InitializeComponent ( ) [inline, private]

Required method for Designer support - do not modify the contents of this method with the code editor.

Definition at line 218 of file categorytree.cs.

    {
      //
      // CategoryTree
      //
      this.BeforeExpand += new System.Windows.Forms.TreeViewCancelEventHandler(this.CategoryTree_BeforeExpand);

    }

void UDDI::Tools::CategoryTreeView::LoadTModels ( ) [inline]

Definition at line 76 of file categorytree.cs.

    {
      FindTModel ft = new FindTModel();
      ft.CategoryBag.Add( CommonCanonical.UddiOrgTypes, "categorization", "Categorization (taxonomy)" );

      TModelList list = null;
      try
      {
        list = ft.Send( _connection );
      }
      catch( Exception e )
      {
        MessageBox.Show( this, e.Message, @"Error loading Category Tree", MessageBoxButtons.OK, MessageBoxIcon.Exclamation );
        return;
      }

      if( null == list )
      {
        MessageBox.Show( this, @"An unknown error occurred while loading the Category Tree.", @"Error loading Category Tree", MessageBoxButtons.OK, MessageBoxIcon.Exclamation );
        return;
      }

      GetRelatedCategories grc = new GetRelatedCategories();
      Category c = new Category();
      c.RelationshipQualifiers.Add( RelationshipQualifier.root );

      foreach( TModelInfo info in list.TModelInfos )
      {
        bool categorization = false;
        c.TModelKey = info.TModelKey;
        grc.Categories.Add( c );

        CategoryList cl = null;
        try
        {
          cl = grc.Send( _connection );
          categorization = true;
        }
        catch( InvalidKeyPassedException )
        {
          //
          // tModel doesn't represent a categorization.  So, don't show
          // it in the tree.
          //
        }
        catch( Exception e )
        {
          //
          // if anything else happened, re-throw & let the app deal with it.
          //
          throw e;
        }

        if( categorization )
        {
          //
          // Create a new node and wrap the tModelInfo into a
          // CategoryInfo object.
          //
          CategoryTreeNode catnode = new CategoryTreeNode( new CategoryInfo( info.TModelKey ) );

          catnode.Nodes.Clear();

          //
          // Set the Text of the node to the text of the tModel.
          //
          catnode.Text =  info.Name.Text;

          CategoryValueCollection values = cl.CategoryInfos[ 0 ].Roots;

          foreach( CategoryValue val in values )
          {
            CategoryTreeNode subnode = new CategoryTreeNode( val );
            subnode.CategoryValue.TModelKey = catnode.CategoryValue.TModelKey;
            catnode.Nodes.Add( subnode );
          }

          catnode.HasDownloadedChildren = true;

          //
          // Add the node to the root.
          //
          Nodes.Add( catnode );
        }
      }
    }

Member Data Documentation

UddiConnection UDDI::Tools::CategoryTreeView::_connection [private]

Definition at line 38 of file categorytree.cs.

System.ComponentModel.Container UDDI::Tools::CategoryTreeView::components = null [private]

Required designer variable.

Definition at line 37 of file categorytree.cs.

Property Documentation

UddiConnection UDDI::Tools::CategoryTreeView::Connection [get, set]

Definition at line 53 of file categorytree.cs.

The documentation for this class was generated from the following file:
  • UDDI/wsdldiscovery/controls/categorytree.cs
Generated on Wed Nov 13 2024 16:58:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: udp_hdr Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

udp_hdr Struct Reference

#include "iphdr.h"

List of all members.

Public Attributes

unsigned short | dest_portno
unsigned short | dst_portno
unsigned short | src_portno
unsigned short | udp_checksum
unsigned short | udp_length

Detailed Description

Definition at line 61 of file iphdr.h.

Member Data Documentation

unsigned short udp_hdr::dest_portno

Definition at line 56 of file iphdr.h.

unsigned short udp_hdr::dst_portno

Definition at line 64 of file iphdr.h.

unsigned short udp_hdr::src_portno

Definition at line 63 of file iphdr.h.

unsigned short udp_hdr::udp_checksum

Definition at line 66 of file iphdr.h.

unsigned short udp_hdr::udp_length

Definition at line 65 of file iphdr.h.

The documentation for this struct was generated from the following files:
  • NetDS/WinSock/iphdrinc/iphdr.h
  • NetDS/WinSock/Ping/iphdr.h
  • NetDS/WinSock/rcvall/iphdr.h
Generated on Wed Nov 13 2024 16:58:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: UnionInt64 Union Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

UnionInt64 Union Reference

List of all members.

Public Attributes

unsigned short | i [4]
unsigned long | l [2]
__int64 | n

Detailed Description

Definition at line 93 of file bankthrds.Cpp.

Member Data Documentation

unsigned short UnionInt64::i[4]

Definition at line 93 of file bankthrds.Cpp.

unsigned long UnionInt64::l[2]

Definition at line 93 of file bankthrds.Cpp.

__int64 UnionInt64::n

Definition at line 93 of file bankthrds.Cpp.

The documentation for this union was generated from the following file:
  • Com/Services/Object_Pooling/OPBankSample/OPBank/bankthrds.Cpp
Generated on Wed Nov 13 2024 16:58:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: UPNPDimmerDevice Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

UPNPDimmerDevice Class Reference

#include "DimmerDeviceDCO.h"

List of all members.

Public Member Functions

UPNPDimmerDevice ()
~UPNPDimmerDevice ()
STDMETHODIMP | GetServiceObject (BSTR bstrUDN, BSTR bstrServiceId, IDispatch **ppdispService)
STDMETHODIMP | Initialize (BSTR bstrXMLDesc, BSTR deviceID, BSTR bstrInitString)

Private Attributes

BSTR | descriptionDoc
IDispatch * | pDisPtrs [NUM_TEMPLATE_UDNS_IN_DESCDOC][MAX_NOSERVICE_PER_DEVICE]
BSTR | serviceIDDeviceMap [NUM_TEMPLATE_UDNS_IN_DESCDOC][MAX_NOSERVICE_PER_DEVICE]
BSTR | UDNmapping [NUM_TEMPLATE_UDNS_IN_DESCDOC][2]

Detailed Description

Definition at line 27 of file DimmerDeviceDCO.h.

Constructor & Destructor Documentation

UPNPDimmerDevice::UPNPDimmerDevice ( )

Definition at line 27 of file DimmerDeviceDCO.cpp.

{
   // initialise variables
   INT i,j;

   // initialise the table mapping the template UDN's to the UDN's used by the device host.
   // there is only one entry in this table since the device has only a RootDevice and no
   // embedded devices
   UDNmapping[0][0] = SysAllocString(L"uuid:RootDevice");
   UDNmapping[0][1] = NULL;

   // initialise the table mapping between the devices and the services ID's of the services it hosts
   // i.e. Row 0 contains services IDs for the RootDevice and Row1 for embedded device 1 if present etc.
   // The sample device just has a Rootdevice and no embedded devices
   serviceIDDeviceMap[0][0] = SysAllocString( L"urn:microsoft-com:serviceId:DimmerService1.0" );

   // array pDisPtrs holds the IDispatch Interface pointers for the services supported by the device
   for (i = 0; i < NUM_TEMPLATE_UDNS_IN_DESCDOC; i++)
   {
      for (j = 0; j < MAX_NOSERVICE_PER_DEVICE; j++)
      {
         pDisPtrs[i][j] = NULL;
      }
   }
}

UPNPDimmerDevice::~UPNPDimmerDevice ( )

Definition at line 56 of file DimmerDeviceDCO.cpp.

{
   INT i,j;
   for (i = 0; i < NUM_TEMPLATE_UDNS_IN_DESCDOC; i++)
   {
      for (j = 0; j < MAX_NOSERVICE_PER_DEVICE; j++)
      {
         if (pDisPtrs[i][j] != NULL)
         {
            pDisPtrs[i][j]->Release();
            pDisPtrs[i][j]=NULL;
         }
      }
   }

   //free the strings allocated for the table mapping the template UDN to real UDN
   SysFreeString(UDNmapping[0][0]);

   //free the strings allocated for the table mapping devices to Service ID's
   SysFreeString(serviceIDDeviceMap[0][0]);

}

Member Function Documentation

STDMETHODIMP UPNPDimmerDevice::GetServiceObject | ( | BSTR | bstrUDN,
 |  | BSTR | bstrServiceId,
 |  | IDispatch ** | ppdispService
 | ) |  |

Definition at line 171 of file DimmerDeviceDCO.cpp.

{
   // Look at the Service for which the pointer is asked and return it in the IDispatch pointer
   INT i;
   INT foundDevice = -1;
   INT foundService = -1;

   for (i = 0; i < NUM_TEMPLATE_UDNS_IN_DESCDOC; i++)
   {
      if (_tcscmp(bstrUDN,UDNmapping[i][1]) == 0)
      {
         foundDevice = i;
      }
   }

   if (foundDevice == -1)
   {
      return E_FAIL;
   }

   // else find the service in this particular device
   for (i = 0; i < MAX_NOSERVICE_PER_DEVICE; i++)
   {
      if (_tcscmp(serviceIDDeviceMap[foundDevice][i],bstrServiceId)==0)
      {
         foundService=i;
      }
   }

   if (foundService==-1)
   {
      return E_FAIL;
   }

   if (pDisPtrs[foundDevice][foundService] == NULL)
   {
      return E_FAIL;
   }

   pDisPtrs[foundDevice][foundService]->AddRef();
   *ppdispService = pDisPtrs[foundDevice][foundService];
   return S_OK;
}

STDMETHODIMP UPNPDimmerDevice::Initialize | ( | BSTR | bstrXMLDesc,
 |  | BSTR | deviceID,
 |  | BSTR | bstrInitString
 | ) |  |

Definition at line 81 of file DimmerDeviceDCO.cpp.

{
   //We create an instance of our service and store it for future use
   HRESULT hr = S_OK;
   HANDLE fHandle = NULL;
   DWORD numBytesWritten = 0;
   IUPnPRegistrar *pReg = NULL;
   CHAR *pDescDoc = NULL;
   INT i;

   OutputDebugString(TEXT("UPNPDimmerDeviceDCO: Entering Initialize\n"));
   CComObject<UPNPDimmerService> *pUPNPDimmerService;

   //if the description doc passed to the Initialize function is NULL return an error
   if (bstrXMLDesc == NULL)
   {
      OutputDebugString(TEXT("UPNPDimmerDeviceDCO: bstrXMLDesc is null\n"));
      return E_FAIL;
   }

   // Now create Service Objects for the services hosted by the device and store
   // it in the pDispPtrs table. We get the Service Object IDispatch pointer for
   // the RootDevice's dimming service and store it in Location 0,0
   pUPNPDimmerService = NULL;
   OutputDebugString(TEXT("UPNPDimmerDeviceDCO: Creating the service object\n"));
   hr = CComObject<UPNPDimmerService>::CreateInstance(&pUPNPDimmerService);

   if (FAILED(hr))
   {
      OutputDebugString(TEXT("UPNPDimmerDeviceDCO: Cannot create the service object\n"));
      return E_FAIL;
   }

   // if we could not create the service object for the Dimmer Service return an Error
   if (pUPNPDimmerService==NULL)
   {
      OutputDebugString(TEXT("UPNPDimmerDeviceDCO: The service object is null\n"));
      return E_FAIL;
   }

   // Now get the pointer to the IDispatch interface using the QueryInterface function

   OutputDebugString(TEXT("UPNPDimmerDeviceDCO: Querying the IDispatch for the service object\n"));
   hr = pUPNPDimmerService->QueryInterface(IID_IDispatch,(LPVOID *) &pDisPtrs[0][0]);

   if (FAILED(hr))
   {
      OutputDebugString(TEXT("UPNPDimmerDeviceDCO: Can't get IDispatch interface from the service object\n"));
      pUPNPDimmerService->Release();
      return hr;
   }

   // Now create a table mapping the template UDN's to the actual published UDN's we
   // use BSTR's since the function GetUniqueDeviceName() takes in BSTR's as parameters
   OutputDebugString(TEXT("UPNPDimmerDeviceDCO: Creating the registrar object\n"));
   hr = CoCreateInstance(
      CLSID_UPnPRegistrar,
      NULL,
      CLSCTX_SERVER,
      IID_IUPnPRegistrar,
      (LPVOID *) &pReg
      );

   if (FAILED(hr))
   {
      OutputDebugString(TEXT("UPNPDimmerDeviceDCO: Can't create the registrar object\n"));
      pUPNPDimmerService->Release();
      return hr;
   }

   for (i = 0; i < NUM_TEMPLATE_UDNS_IN_DESCDOC; i++)
   {
      hr = pReg->GetUniqueDeviceName(deviceID, UDNmapping[i][0], &UDNmapping[i][1]);
      if (FAILED(hr))
      {
         pReg->Release();
         pUPNPDimmerService->Release();
         OutputDebugString(TEXT("UPNPDimmerDeviceDCO: Can't get the unique device names\n"));
         return hr;
      }
   }

   pReg->Release();
   OutputDebugString(TEXT("UPNPDimmerDeviceDCO: Exiting the Initialize\n"));
   return hr;

}

Member Data Documentation

BSTR UPNPDimmerDevice::descriptionDoc [private]

Definition at line 37 of file DimmerDeviceDCO.h.

IDispatch* UPNPDimmerDevice::pDisPtrs[NUM_TEMPLATE_UDNS_IN_DESCDOC][MAX_NOSERVICE_PER_DEVICE] [private]

Definition at line 50 of file DimmerDeviceDCO.h.

BSTR UPNPDimmerDevice::serviceIDDeviceMap[NUM_TEMPLATE_UDNS_IN_DESCDOC][MAX_NOSERVICE_PER_DEVICE] [private]

Definition at line 46 of file DimmerDeviceDCO.h.

BSTR UPNPDimmerDevice::UDNmapping[NUM_TEMPLATE_UDNS_IN_DESCDOC][2] [private]

Definition at line 41 of file DimmerDeviceDCO.h.

The documentation for this class was generated from the following files:
  • NetDS/upnp/DCO_DimmerService/DimmerDeviceDCO.h
  • NetDS/upnp/DCO_DimmerService/DimmerDeviceDCO.cpp
Generated on Wed Nov 13 2024 16:58:02 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: UPNPDimmerService Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

UPNPDimmerService Class Reference

#include "DimmerService.h"

List of all members.

Public Member Functions

UPNPDimmerService ()
~UPNPDimmerService ()
STDMETHOD() | Advise (IUPnPEventSink *punkSubscriber)
STDMETHOD() | get_dimLevel (LONG *dLevel)
STDMETHOD() | get_Power (VARIANT_BOOL *pval)
STDMETHOD() | GetConfigDetails (VARIANT_BOOL *powerVal, LONG *dLevel)
STDMETHOD() | GetDimLevel (LONG *dLevel)
STDMETHOD() | GetPowerValue (VARIANT_BOOL *powerVal)
STDMETHOD() | PowerOff ()
STDMETHOD() | PowerOn ()
STDMETHOD() | SetDimLevel (LONG dLevel)
STDMETHOD() | Unadvise (IUPnPEventSink *punkSubscriber)

Private Attributes

CRITICAL_SECTION | csSync
LONG | dimnessLevel
IUPnPEventSink * | esEventingManager
VARIANT_BOOL | power

Detailed Description

Definition at line 19 of file DimmerService.h.

Constructor & Destructor Documentation

UPNPDimmerService::UPNPDimmerService ( )

Definition at line 27 of file DimmerService.cpp.

{
   // Set the default values for the state table variables power and dimLevel
   power = VARIANT_FALSE;
   dimnessLevel = 0;

   InitializeCriticalSection(&csSync);
   // Make it NULL and this will be later set when the device host calls the Advise()
   esEventingManager = NULL;
}

UPNPDimmerService::~UPNPDimmerService ( )

Definition at line 40 of file DimmerService.cpp.

{
   // Cleanup before the service exits
   if (esEventingManager)
   {
      // we have to release the pointer to the Eventing Manager Interface on shutdown
      esEventingManager->Release();
      esEventingManager = NULL;
   }

   DeleteCriticalSection(&csSync);
}

Member Function Documentation

HRESULT UPNPDimmerService::Advise ( IUPnPEventSink * punkSubscriber )

Definition at line 197 of file DimmerService.cpp.

{
   // We have to get query for the IUPnPEventSink Interface to send events
   // later using the OnStateChanged API

   HRESULT hr = S_OK;

   // Query the pointer passed to the Advise function for the IUPnPEventSink Interface
   hr = punkSubscriber->QueryInterface(IID_IUPnPEventSink, (void **)&esEventingManager);
   if (FAILED(hr))
   {
      OutputDebugString(_TEXT("UPNPDimmerService: Query Interface failed.  Could not get pointer to IUPnPEventSink\n"));
      esEventingManager = NULL;
      return hr;
   }

   return hr;
}

HRESULT UPNPDimmerService::get_dimLevel ( LONG * dLevel )

Definition at line 66 of file DimmerService.cpp.

{
   // Return the value of the state table variable dimLevel
   EnterCriticalSection(&csSync);
   *dLevel = dimnessLevel;
   LeaveCriticalSection(&csSync);
   return S_OK;
}

HRESULT UPNPDimmerService::get_Power ( VARIANT_BOOL * pval )

Definition at line 55 of file DimmerService.cpp.

{
   // Return the value of the state table variable Power
   EnterCriticalSection(&csSync);
   *pval = power;
   LeaveCriticalSection(&csSync);
   return S_OK;
}

HRESULT UPNPDimmerService::GetConfigDetails | ( | VARIANT_BOOL * | powerVal,
 |  | LONG * | dLevel
 | ) |  |

Definition at line 185 of file DimmerService.cpp.

{
   EnterCriticalSection(&csSync);
   *dLevel = dimnessLevel;
   *powerVal = power;
   LeaveCriticalSection(&csSync);

   // We have no events to send here as the state table has not changed
   return S_OK;
}

HRESULT UPNPDimmerService::GetDimLevel ( LONG * dLevel )

Definition at line 173 of file DimmerService.cpp.

{
   EnterCriticalSection(&csSync);
   *dLevel = dimnessLevel;
   LeaveCriticalSection(&csSync);

   // We have no events to send here as the state table has not changed
   return S_OK;
}

HRESULT UPNPDimmerService::GetPowerValue ( VARIANT_BOOL * powerVal )

Definition at line 137 of file DimmerService.cpp.

{
   EnterCriticalSection(&csSync);
   *powerVal = power;
   LeaveCriticalSection(&csSync);

   // We have no events to send for this action
   return S_OK;
}

HRESULT UPNPDimmerService::PowerOff ( )

Definition at line 107 of file DimmerService.cpp.

{
   DISPID rgdispidChanges[1];

   EnterCriticalSection(&csSync);
   if (power != VARIANT_FALSE)
   {
      power = VARIANT_FALSE;
      // We have to send an event here since the value of a State table variable
      // has changed
      LeaveCriticalSection(&csSync);

      if(esEventingManager)
      {
         // Send the event using the OnStateChanged API and indicate the the
         // value of the state table variable Power has changed
         rgdispidChanges[0]=DISPID_POWER;
         esEventingManager->OnStateChanged(1, rgdispidChanges);
      }
   }
   else
   {
      LeaveCriticalSection(&csSync);
   }

   return S_OK;
}

HRESULT UPNPDimmerService::PowerOn ( )

Definition at line 77 of file DimmerService.cpp.

{
   DISPID rgdispidChanges[1];

   EnterCriticalSection(&csSync);

   if (power != VARIANT_TRUE)
   {
      power = VARIANT_TRUE;
      LeaveCriticalSection(&csSync);

      // We have to send an event here indicating that the value of Power has changed
      if(esEventingManager)
      {
         // Send the event that power = TRUE through OnStateChanged API exposed by IUPnPEventSource
         rgdispidChanges[0]=DISPID_POWER;
         esEventingManager->OnStateChanged(1, rgdispidChanges);
      }
   }
   else
   {
      LeaveCriticalSection(&csSync);
   }

   return S_OK;
}

HRESULT UPNPDimmerService::SetDimLevel ( LONG dLevel )

Definition at line 149 of file DimmerService.cpp.

{
   DISPID rgdispidChanges[1];

   EnterCriticalSection(&csSync);
   dimnessLevel = dLevel;
   // The possible values for dimnessLevel are 0 - 100
   if (dimnessLevel > 100) dimnessLevel = 100;
   if (dimnessLevel < 0) dimnessLevel = 0;
   LeaveCriticalSection(&csSync);

   // We have to send an event here
   if(esEventingManager)
   {
      // Send the event using the OnStateChanged API to indicate that value
      // of State table varaible dimLevel has changed
      rgdispidChanges[0]=DISPID_DIMLEVEL;
      esEventingManager->OnStateChanged(1, rgdispidChanges);
   }

   return S_OK;
}

HRESULT UPNPDimmerService::Unadvise ( IUPnPEventSink * punkSubscriber )

Definition at line 218 of file DimmerService.cpp.

{
   // Device Host is not interested in receiving more events and so set the
   // pointer to the IUPnPEventSink interface to NULL
   if (esEventingManager)
   {
      // esEventingManager is already set by the advise
      esEventingManager->Release();
      esEventingManager = NULL;
   }

   return S_OK;
}

Member Data Documentation

CRITICAL_SECTION UPNPDimmerService::csSync [private]

Definition at line 65 of file DimmerService.h.

LONG UPNPDimmerService::dimnessLevel [private]

Definition at line 61 of file DimmerService.h.

IUPnPEventSink* UPNPDimmerService::esEventingManager [private]

Definition at line 62 of file DimmerService.h.

VARIANT_BOOL UPNPDimmerService::power [private]

Definition at line 60 of file DimmerService.h.

The documentation for this class was generated from the following files:
  • NetDS/upnp/DCO_DimmerService/DimmerService.h
  • NetDS/upnp/DCO_DimmerService/DimmerService.cpp
Generated on Wed Nov 13 2024 16:58:02 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: UsageStringInfo Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

UsageStringInfo Struct Reference

List of all members.

Public Attributes

int m_cIndent
BOOL m_fExternalOnly
BOOL m_fInternalOnly
UINT m_ids

Detailed Description

Definition at line 853 of file sdkdiff.cpp.

Member Data Documentation

int UsageStringInfo::m_cIndent

Definition at line 858 of file sdkdiff.cpp.

BOOL UsageStringInfo::m_fExternalOnly

Definition at line 857 of file sdkdiff.cpp.

BOOL UsageStringInfo::m_fInternalOnly

Definition at line 856 of file sdkdiff.cpp.

UINT UsageStringInfo::m_ids

Definition at line 855 of file sdkdiff.cpp.

The documentation for this struct was generated from the following file:
  • Begin/sdkdiff/sdkdiff.cpp
Generated on Wed Nov 13 2024 16:58:02 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: util::DatabaseSettings Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • util
  • util::DatabaseSettings
Static Public Attributes

util::DatabaseSettings Interface Reference

List of all members.

Static Public Attributes

static final String | DSN = "Account"
static final String | pass = ""
static final String | User = "sa"

Detailed Description

Definition at line 2 of file DatabaseSettings.java.

Member Data Documentation

final String util::DatabaseSettings::DSN = "Account" [static]

Definition at line 4 of file DatabaseSettings.java.

final String util::DatabaseSettings::pass = "" [static]

Definition at line 6 of file DatabaseSettings.java.

final String util::DatabaseSettings::User = "sa" [static]

Definition at line 5 of file DatabaseSettings.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Object_Pooling/ObjectPoolingJAVA/ObjectPoolingComponent/Account/util/DatabaseSettings.java
Generated on Wed Nov 13 2024 16:58:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Util::HelperFunctions Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • Util
  • Util::HelperFunctions
Public Member Functions

Util::HelperFunctions Class Reference

List of all members.

Public Member Functions

string | LineToString (int X1, int Y1, int X2, int Y2)
void | StringToLine (string strLine, ref line lineToDraw)

Detailed Description

Definition at line 34 of file form1.cs.

Member Function Documentation

string Util::HelperFunctions::LineToString | ( | int | X1,
 |  | int | Y1,
 |  | int | X2,
 |  | int | Y2 |
 | ) |  |  | [inline]

Definition at line 36 of file form1.cs.

    {
      string strX1;
      string strY1;
      string strX2;
      string strY2;
      string strResult;
      strX1 = X1.ToString().PadLeft(7,'0');
      strY1 = Y1.ToString().PadLeft(7,'0');
      strX2 = X2.ToString().PadLeft(7,'0');
      strY2 = Y2.ToString().PadLeft(7,'0');
      strResult=strX1+strY1+strX2+strY2;
      return strResult;
    }

void Util::HelperFunctions::StringToLine | ( | string | strLine,
 |  | ref line | lineToDraw |
 | ) |  |  | [inline]

Definition at line 51 of file form1.cs.

    {
      lineToDraw.XFrom = Convert.ToInt32(strLine.Substring(0,7));
      lineToDraw.YFrom = Convert.ToInt32(strLine.Substring(7,7));
      lineToDraw.XTo = Convert.ToInt32(strLine.Substring(14,7));
      lineToDraw.YTo = Convert.ToInt32(strLine.Substring(21,7));
    }

The documentation for this class was generated from the following file:
  • NetDS/MessageQueuing/csharp_draw/form1.cs
Generated on Wed Nov 13 2024 16:58:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Util::line Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • Util
  • Util::line
Public Attributes

Util::line Struct Reference

List of all members.

Public Attributes

int | XFrom
int | XTo
int | YFrom
int | YTo

Detailed Description

Definition at line 26 of file form1.cs.

Member Data Documentation

int Util::line::XFrom

Definition at line 28 of file form1.cs.

int Util::line::XTo

Definition at line 30 of file form1.cs.

int Util::line::YFrom

Definition at line 29 of file form1.cs.

int Util::line::YTo

Definition at line 31 of file form1.cs.

The documentation for this struct was generated from the following file:
  • NetDS/MessageQueuing/csharp_draw/form1.cs
Generated on Wed Nov 13 2024 16:58:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: vcacct::CAccount Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • vcacct
  • vcacct::CAccount
Public Member Functions | Static Public Attributes

vcacct::CAccount Class Reference

.class(classid=04CF0B76-1989-11D0-B917-0080C7394688,DynamicCasts) .interface(iid=04CF0B72-1989-11D0-B917-0080C7394688, thread=AUTO, type=DUAL)

Inherits com::ms::com::IUnknown, and vcacct::IAccount.

List of all members.

Public Member Functions

native String | Post (int lAccount, int lAmount)

Static Public Attributes

static final com.ms.com._Guid | clsid = new com.ms.com._Guid((int)0x4cf0b76, (short)0x1989, (short)0x11d0, (byte)0xb9, (byte)0x17, (byte)0x0, (byte)0x80, (byte)0xc7, (byte)0x39, (byte)0x46, (byte)0x88)
static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x4cf0b72, (short)0x1989, (short)0x11d0, (byte)0xb9, (byte)0x17, (byte)0x0, (byte)0x80, (byte)0xc7, (byte)0x39, (byte)0x46, (byte)0x88)

Detailed Description

Definition at line 20 of file CAccount.java.

Member Function Documentation

native String vcacct::CAccount::Post | ( | int | lAccount,
 |  | int | lAmount
 | ) |  |

.method(vtoffset=4, dispid=1610743808, type=METHOD, name="Post", addFlagsVtable=4) .parameters([in,type=I4] lAccount, [in,type=I4] lAmount, [type=STRING] return)

Implements vcacct::IAccount.

Member Data Documentation

final com.ms.com._Guid vcacct::CAccount::clsid = new com.ms.com._Guid((int)0x4cf0b76, (short)0x1989, (short)0x11d0, (byte)0xb9, (byte)0x17, (byte)0x0, (byte)0x80, (byte)0xc7, (byte)0x39, (byte)0x46, (byte)0x88) [static]

Definition at line 29 of file CAccount.java.

final com.ms.com._Guid vcacct::CAccount::iid = new com.ms.com._Guid((int)0x4cf0b72, (short)0x1989, (short)0x11d0, (byte)0xb9, (byte)0x17, (byte)0x0, (byte)0x80, (byte)0xc7, (byte)0x39, (byte)0x46, (byte)0x88) [static]

Implements vcacct::IAccount.

Definition at line 27 of file CAccount.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/vcAcct/CAccount.java
Generated on Wed Nov 13 2024 16:58:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: vcacct::CGetReceipt Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • vcacct
  • vcacct::CGetReceipt
Public Member Functions | Static Public Attributes

vcacct::CGetReceipt Class Reference

.class(classid=A81260B2-DDC8-11D0-B5A0-00C04FB957D8,DynamicCasts) .interface(iid=A81260B1-DDC8-11D0-B5A0-00C04FB957D8, thread=AUTO, type=DUAL)

Inherits com::ms::com::IUnknown, and vcacct::IGetReceipt.

List of all members.

Public Member Functions

native int | GetNextReceipt ()

Static Public Attributes

static final com.ms.com._Guid | clsid = new com.ms.com._Guid((int)0xa81260b2, (short)0xddc8, (short)0x11d0, (byte)0xb5, (byte)0xa0, (byte)0x0, (byte)0xc0, (byte)0x4f, (byte)0xb9, (byte)0x57, (byte)0xd8)
static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0xa81260b1, (short)0xddc8, (short)0x11d0, (byte)0xb5, (byte)0xa0, (byte)0x0, (byte)0xc0, (byte)0x4f, (byte)0xb9, (byte)0x57, (byte)0xd8)

Detailed Description

Definition at line 20 of file CGetReceipt.java.

Member Function Documentation

native int vcacct::CGetReceipt::GetNextReceipt ( )

.method(vtoffset=4, dispid=1610743808, type=METHOD, name="GetNextReceipt", addFlagsVtable=4) .parameters([type=I4] return)

Implements vcacct::IGetReceipt.

Member Data Documentation

final com.ms.com._Guid vcacct::CGetReceipt::clsid = new com.ms.com._Guid((int)0xa81260b2, (short)0xddc8, (short)0x11d0, (byte)0xb5, (byte)0xa0, (byte)0x0, (byte)0xc0, (byte)0x4f, (byte)0xb9, (byte)0x57, (byte)0xd8) [static]

Definition at line 29 of file CGetReceipt.java.

final com.ms.com._Guid vcacct::CGetReceipt::iid = new com.ms.com._Guid((int)0xa81260b1, (short)0xddc8, (short)0x11d0, (byte)0xb5, (byte)0xa0, (byte)0x0, (byte)0xc0, (byte)0x4f, (byte)0xb9, (byte)0x57, (byte)0xd8) [static]

Implements vcacct::IGetReceipt.

Definition at line 27 of file CGetReceipt.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/vcAcct/CGetReceipt.java
Generated on Wed Nov 13 2024 16:58:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: vcacct::CMoveMoney Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • vcacct
  • vcacct::CMoveMoney
Public Member Functions | Static Public Attributes

vcacct::CMoveMoney Class Reference

.class(classid=04CF0B7B-1989-11D0-B917-0080C7394688,DynamicCasts) .interface(iid=04CF0B77-1989-11D0-B917-0080C7394688, thread=AUTO, type=DUAL)

Inherits com::ms::com::IUnknown, and vcacct::IMoveMoney.

List of all members.

Public Member Functions

native String | Perform (int lPrimeAccount, int lSecondAccount, int lAmount, int lTranType)

Static Public Attributes

static final com.ms.com._Guid | clsid = new com.ms.com._Guid((int)0x4cf0b7b, (short)0x1989, (short)0x11d0, (byte)0xb9, (byte)0x17, (byte)0x0, (byte)0x80, (byte)0xc7, (byte)0x39, (byte)0x46, (byte)0x88)
static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x4cf0b77, (short)0x1989, (short)0x11d0, (byte)0xb9, (byte)0x17, (byte)0x0, (byte)0x80, (byte)0xc7, (byte)0x39, (byte)0x46, (byte)0x88)

Detailed Description

Definition at line 20 of file CMoveMoney.java.

Member Function Documentation

native String vcacct::CMoveMoney::Perform | ( | int | lPrimeAccount,
 |  | int | lSecondAccount,
 |  | int | lAmount,
 |  | int | lTranType
 | ) |  |

.method(vtoffset=4, dispid=1610743808, type=METHOD, name="Perform", addFlagsVtable=4) .parameters([in,type=I4] lPrimeAccount, [in,type=I4] lSecondAccount, [in,type=I4] lAmount, [in,type=I4] lTranType, [type=STRING] return)

Implements vcacct::IMoveMoney.

Member Data Documentation

final com.ms.com._Guid vcacct::CMoveMoney::clsid = new com.ms.com._Guid((int)0x4cf0b7b, (short)0x1989, (short)0x11d0, (byte)0xb9, (byte)0x17, (byte)0x0, (byte)0x80, (byte)0xc7, (byte)0x39, (byte)0x46, (byte)0x88) [static]

Definition at line 29 of file CMoveMoney.java.

final com.ms.com._Guid vcacct::CMoveMoney::iid = new com.ms.com._Guid((int)0x4cf0b77, (short)0x1989, (short)0x11d0, (byte)0xb9, (byte)0x17, (byte)0x0, (byte)0x80, (byte)0xc7, (byte)0x39, (byte)0x46, (byte)0x88) [static]

Implements vcacct::IMoveMoney.

Definition at line 27 of file CMoveMoney.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/vcAcct/CMoveMoney.java
Generated on Wed Nov 13 2024 16:58:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: vcacct::CUpdateReceipt Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • vcacct
  • vcacct::CUpdateReceipt
Public Member Functions | Static Public Attributes

vcacct::CUpdateReceipt Class Reference

.class(classid=A81260B8-DDC8-11D0-B5A0-00C04FB957D8,DynamicCasts) .interface(iid=A81260B7-DDC8-11D0-B5A0-00C04FB957D8, thread=AUTO, type=DUAL)

Inherits com::ms::com::IUnknown, and vcacct::IUpdateReceipt.

List of all members.

Public Member Functions

native int | Update ()

Static Public Attributes

static final com.ms.com._Guid | clsid = new com.ms.com._Guid((int)0xa81260b8, (short)0xddc8, (short)0x11d0, (byte)0xb5, (byte)0xa0, (byte)0x0, (byte)0xc0, (byte)0x4f, (byte)0xb9, (byte)0x57, (byte)0xd8)
static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0xa81260b7, (short)0xddc8, (short)0x11d0, (byte)0xb5, (byte)0xa0, (byte)0x0, (byte)0xc0, (byte)0x4f, (byte)0xb9, (byte)0x57, (byte)0xd8)

Detailed Description

Definition at line 20 of file CUpdateReceipt.java.

Member Function Documentation

native int vcacct::CUpdateReceipt::Update ( )

.method(vtoffset=4, dispid=1610743808, type=METHOD, name="Update", addFlagsVtable=4) .parameters([type=I4] return)

Implements vcacct::IUpdateReceipt.

Member Data Documentation

final com.ms.com._Guid vcacct::CUpdateReceipt::clsid = new com.ms.com._Guid((int)0xa81260b8, (short)0xddc8, (short)0x11d0, (byte)0xb5, (byte)0xa0, (byte)0x0, (byte)0xc0, (byte)0x4f, (byte)0xb9, (byte)0x57, (byte)0xd8) [static]

Definition at line 29 of file CUpdateReceipt.java.

final com.ms.com._Guid vcacct::CUpdateReceipt::iid = new com.ms.com._Guid((int)0xa81260b7, (short)0xddc8, (short)0x11d0, (byte)0xb5, (byte)0xa0, (byte)0x0, (byte)0xc0, (byte)0x4f, (byte)0xb9, (byte)0x57, (byte)0xd8) [static]

Implements vcacct::IUpdateReceipt.

Definition at line 27 of file CUpdateReceipt.java.

The documentation for this class was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/vcAcct/CUpdateReceipt.java
Generated on Wed Nov 13 2024 16:58:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: vcacct::IAccount Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • vcacct
  • vcacct::IAccount
Public Member Functions | Static Public Attributes

vcacct::IAccount Interface Reference

.interface(iid=04CF0B72-1989-11D0-B917-0080C7394688, thread=AUTO, type=DUAL)

Inherits com::ms::com::IUnknown.

Inherited by vcacct::CAccount.

List of all members.

Public Member Functions

String | Post (int lAccount, int lAmount)

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x4cf0b72, (short)0x1989, (short)0x11d0, (byte)0xb9, (byte)0x17, (byte)0x0, (byte)0x80, (byte)0xc7, (byte)0x39, (byte)0x46, (byte)0x88)

Detailed Description

Definition at line 20 of file IAccount.java.

Member Function Documentation

String vcacct::IAccount::Post | ( | int | lAccount,
 |  | int | lAmount
 | ) |  |

.method(vtoffset=4, dispid=1610743808, type=METHOD, name="Post", addFlagsVtable=4) .parameters([in,type=I4] lAccount, [in,type=I4] lAmount, [type=STRING] return)

Implemented in vcacct::CAccount.

Member Data Documentation

final com.ms.com._Guid vcacct::IAccount::iid = new com.ms.com._Guid((int)0x4cf0b72, (short)0x1989, (short)0x11d0, (byte)0xb9, (byte)0x17, (byte)0x0, (byte)0x80, (byte)0xc7, (byte)0x39, (byte)0x46, (byte)0x88) [static]

Implemented in vcacct::CAccount.

Definition at line 27 of file IAccount.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/vcAcct/IAccount.java
Generated on Wed Nov 13 2024 16:58:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: vcacct::IGetReceipt Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • vcacct
  • vcacct::IGetReceipt
Public Member Functions | Static Public Attributes

vcacct::IGetReceipt Interface Reference

.interface(iid=A81260B1-DDC8-11D0-B5A0-00C04FB957D8, thread=AUTO, type=DUAL)

Inherits com::ms::com::IUnknown.

Inherited by vcacct::CGetReceipt.

List of all members.

Public Member Functions

int | GetNextReceipt ()

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0xa81260b1, (short)0xddc8, (short)0x11d0, (byte)0xb5, (byte)0xa0, (byte)0x0, (byte)0xc0, (byte)0x4f, (byte)0xb9, (byte)0x57, (byte)0xd8)

Detailed Description

Definition at line 20 of file IGetReceipt.java.

Member Function Documentation

int vcacct::IGetReceipt::GetNextReceipt ( )

.method(vtoffset=4, dispid=1610743808, type=METHOD, name="GetNextReceipt", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in vcacct::CGetReceipt.

Member Data Documentation

final com.ms.com._Guid vcacct::IGetReceipt::iid = new com.ms.com._Guid((int)0xa81260b1, (short)0xddc8, (short)0x11d0, (byte)0xb5, (byte)0xa0, (byte)0x0, (byte)0xc0, (byte)0x4f, (byte)0xb9, (byte)0x57, (byte)0xd8) [static]

Implemented in vcacct::CGetReceipt.

Definition at line 27 of file IGetReceipt.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/vcAcct/IGetReceipt.java
Generated on Wed Nov 13 2024 16:58:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: vcacct::IMoveMoney Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • vcacct
  • vcacct::IMoveMoney
Public Member Functions | Static Public Attributes

vcacct::IMoveMoney Interface Reference

.interface(iid=04CF0B77-1989-11D0-B917-0080C7394688, thread=AUTO, type=DUAL)

Inherits com::ms::com::IUnknown.

Inherited by vcacct::CMoveMoney.

List of all members.

Public Member Functions

String | Perform (int lPrimeAccount, int lSecondAccount, int lAmount, int lTranType)

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0x4cf0b77, (short)0x1989, (short)0x11d0, (byte)0xb9, (byte)0x17, (byte)0x0, (byte)0x80, (byte)0xc7, (byte)0x39, (byte)0x46, (byte)0x88)

Detailed Description

Definition at line 20 of file IMoveMoney.java.

Member Function Documentation

String vcacct::IMoveMoney::Perform | ( | int | lPrimeAccount,
 |  | int | lSecondAccount,
 |  | int | lAmount,
 |  | int | lTranType
 | ) |  |

.method(vtoffset=4, dispid=1610743808, type=METHOD, name="Perform", addFlagsVtable=4) .parameters([in,type=I4] lPrimeAccount, [in,type=I4] lSecondAccount, [in,type=I4] lAmount, [in,type=I4] lTranType, [type=STRING] return)

Implemented in vcacct::CMoveMoney.

Member Data Documentation

final com.ms.com._Guid vcacct::IMoveMoney::iid = new com.ms.com._Guid((int)0x4cf0b77, (short)0x1989, (short)0x11d0, (byte)0xb9, (byte)0x17, (byte)0x0, (byte)0x80, (byte)0xc7, (byte)0x39, (byte)0x46, (byte)0x88) [static]

Implemented in vcacct::CMoveMoney.

Definition at line 27 of file IMoveMoney.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/vcAcct/IMoveMoney.java
Generated on Wed Nov 13 2024 16:58:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: vcacct::IUpdateReceipt Interface Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • vcacct
  • vcacct::IUpdateReceipt
Public Member Functions | Static Public Attributes

vcacct::IUpdateReceipt Interface Reference

.interface(iid=A81260B7-DDC8-11D0-B5A0-00C04FB957D8, thread=AUTO, type=DUAL)

Inherits com::ms::com::IUnknown.

Inherited by vcacct::CUpdateReceipt.

List of all members.

Public Member Functions

int | Update ()

Static Public Attributes

static final com.ms.com._Guid | iid = new com.ms.com._Guid((int)0xa81260b7, (short)0xddc8, (short)0x11d0, (byte)0xb5, (byte)0xa0, (byte)0x0, (byte)0xc0, (byte)0x4f, (byte)0xb9, (byte)0x57, (byte)0xd8)

Detailed Description

Definition at line 20 of file IUpdateReceipt.java.

Member Function Documentation

int vcacct::IUpdateReceipt::Update ( )

.method(vtoffset=4, dispid=1610743808, type=METHOD, name="Update", addFlagsVtable=4) .parameters([type=I4] return)

Implemented in vcacct::CUpdateReceipt.

Member Data Documentation

final com.ms.com._Guid vcacct::IUpdateReceipt::iid = new com.ms.com._Guid((int)0xa81260b7, (short)0xddc8, (short)0x11d0, (byte)0xb5, (byte)0xa0, (byte)0x0, (byte)0xc0, (byte)0x4f, (byte)0xb9, (byte)0x57, (byte)0xd8) [static]

Implemented in vcacct::CUpdateReceipt.

Definition at line 27 of file IUpdateReceipt.java.

The documentation for this interface was generated from the following file:
  • Com/Services/Transaction/SampleBank/vjAcct/vcAcct/IUpdateReceipt.java
Generated on Wed Nov 13 2024 16:58:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: VERBMAPPING Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

VERBMAPPING Struct Reference

List of all members.

Public Attributes

DWORD dwCommand
TCHAR szVerb [MAX_VERB]

Detailed Description

Definition at line 33 of file ContMenu.Cpp.

Member Data Documentation

DWORD VERBMAPPING::dwCommand

Definition at line 35 of file ContMenu.Cpp.

TCHAR VERBMAPPING::szVerb[MAX_VERB]

Definition at line 34 of file ContMenu.Cpp.

The documentation for this struct was generated from the following file:
  • WinUI/Shell/SampView/ContMenu.Cpp
Generated on Wed Nov 13 2024 16:58:02 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: view Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

view Struct Reference

List of all members.

Public Attributes

BOOL bExpand
BOOL bExpandGuard
BOOL bExpanding
COMPITEM ciSelect
COMPLIST cl
HWND | hwnd
int | maxrest
int | maxtag
char | nrtext [12]
COMPITEM FAR * | pItems
PVIEWLINE pLines
int | rows

Detailed Description

Definition at line 83 of file view.cpp.

Member Data Documentation

BOOL view::bExpand

Definition at line 89 of file view.cpp.

BOOL view::bExpandGuard

Definition at line 96 of file view.cpp.

BOOL view::bExpanding

Definition at line 90 of file view.cpp.

COMPITEM view::ciSelect

Definition at line 100 of file view.cpp.

COMPLIST view::cl

Definition at line 87 of file view.cpp.

HWND view::hwnd

Definition at line 85 of file view.cpp.

int view::maxrest

Definition at line 107 of file view.cpp.

int view::maxtag

Definition at line 107 of file view.cpp.

char view::nrtext[12]

Definition at line 104 of file view.cpp.

COMPITEM FAR* view::pItems

Definition at line 113 of file view.cpp.

PVIEWLINE view::pLines

Definition at line 116 of file view.cpp.

int view::rows

Definition at line 102 of file view.cpp.

The documentation for this struct was generated from the following file:
  • Begin/sdkdiff/view.cpp
Generated on Wed Nov 13 2024 16:58:02 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: viewline Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

viewline Struct Reference

List of all members.

Public Attributes

LINE line
int | nr_left
int | nr_right
SECTION section

Detailed Description

Definition at line 72 of file view.cpp.

Member Data Documentation

LINE viewline::line

Definition at line 73 of file view.cpp.

int viewline::nr_left

Definition at line 75 of file view.cpp.

int viewline::nr_right

Definition at line 76 of file view.cpp.

SECTION viewline::section

Definition at line 74 of file view.cpp.

The documentation for this struct was generated from the following file:
  • Begin/sdkdiff/view.cpp
Generated on Wed Nov 13 2024 16:58:02 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: VJQuery Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Static Public Member Functions | Static Package Functions

VJQuery Class Reference

This class can take a variable number of parameters on the command line. More...

List of all members.

Static Public Member Functions

static void | main (String[] args)

Static Package Functions

static String | StripEndQuotes (String S)
static void | Usage ()

Detailed Description

Program execution begins with the main() method. The class constructor is not invoked unless an object of type 'VJQuery' created in the main() method.

Definition at line 34 of file VJQuery.java.

Member Function Documentation

static void VJQuery::main ( String[] args ) [inline, static]

The main entry point for the application.

Parameters:
args Array of parameters passed to the application via the command line.

Definition at line 42 of file VJQuery.java.

    {

        // Parse arguments.
        if ( ( 0 == args.length ) ||
             ( 1 == args.length && args[0].equalsIgnoreCase("-?") ) )
        {
            Usage();
        }
        else
        {
            Query Q = new Query();

            if ( args[0].equalsIgnoreCase("-s") )
            {
                String S = args[1];

                for ( int i = 2; i < args.length; i++ )
                    S = S + " " + args[i];

                S = StripEndQuotes(S);

                Q.SetRawSql( S );
            }
            else
            {
                String S = args[0];

                for ( int i = 1; i < args.length; i++ )
                        S = S + " " + args[i];

                S = StripEndQuotes(S);

                Q.SetSqlWhere( S );
            }

            try
            {

                // Run Query.
                Q.Execute();

                // Display the result.
                Q.Display( System.out );
            }
            catch( com.ms.wfc.data.AdoException e )
            {
                System.out.println( "Caught " + e.getErrorNumber() );
            }
        }

        try
        {
            System.out.println( "Press enter to continue..." );
            System.in.read();
        }
        catch( java.io.IOException e )
        {
        }
    }

static String VJQuery::StripEndQuotes ( String S ) [inline, static, package]

Definition at line 115 of file VJQuery.java.

    {
        if ( S.indexOf("\"") == 0 )
            S = S.substring(1, S.length() - 1);

        if ( S.lastIndexOf("\"") == S.length() - 1 )
            S = S.substring(0, S.length() - 1);

        return S;
    }

static void VJQuery::Usage ( ) [inline, static, package]

Definition at line 134 of file VJQuery.java.

    {
    System.out.println( "Usage: VJQuery [-s] [<Query>]" );
        System.out.println( "       <Query>  WHERE clause or complete SELECT statement" );
        System.out.println( "       -s       <Query> is complete SELECT statement" );
    }

The documentation for this class was generated from the following file:
  • WinBase/Indexing/VJQuery/VJQuery.java
Generated on Wed Nov 13 2024 16:58:02 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: VTUNION Union Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

VTUNION Union Reference

#include "suminfo.h"

List of all members.

Public Attributes

DWORD bool
unsigned char | bstrVal [WORDMAX]
double | dblVal
float | fltVal
short | iVal
long | lVal
SCODE | scodeVal
DWORD systimeVal

Detailed Description

Definition at line 77 of file suminfo.h.

Member Data Documentation

DWORD VTUNION::bool

Definition at line 82 of file suminfo.h.

unsigned char VTUNION::bstrVal[WORDMAX]

Definition at line 85 of file suminfo.h.

double VTUNION::dblVal

Definition at line 81 of file suminfo.h.

float VTUNION::fltVal

Definition at line 80 of file suminfo.h.

short VTUNION::iVal

Definition at line 78 of file suminfo.h.

long VTUNION::lVal

Definition at line 79 of file suminfo.h.

SCODE VTUNION::scodeVal

Definition at line 83 of file suminfo.h.

DWORD VTUNION::systimeVal

Definition at line 84 of file suminfo.h.

The documentation for this union was generated from the following file:
  • Com/Fundamentals/OleStd/suminfo.h
Generated on Wed Nov 13 2024 16:58:02 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WATCHER_DATA Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

WATCHER_DATA Struct Reference

List of all members.

Public Attributes

BSTR | bstrName
BSTR | bstrURI
BOOL fAddBuddy
BOOL fAllow

Detailed Description

Definition at line 340 of file rtcdialogs.cpp.

Member Data Documentation

BSTR WATCHER_DATA::bstrName

Definition at line 342 of file rtcdialogs.cpp.

BSTR WATCHER_DATA::bstrURI

Definition at line 343 of file rtcdialogs.cpp.

BOOL WATCHER_DATA::fAddBuddy

Definition at line 345 of file rtcdialogs.cpp.

BOOL WATCHER_DATA::fAllow

Definition at line 344 of file rtcdialogs.cpp.

The documentation for this struct was generated from the following file:
  • NetDS/rtc/Client/CPP/rtcsample/rtcdialogs.cpp
Generated on Wed Nov 13 2024 16:58:02 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WiaWrap::CComPtrArray< T > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • WiaWrap
  • WiaWrap::CComPtrArray< T >
Public Member Functions | Private Attributes

WiaWrap::CComPtrArray< T > Class Template Reference

#include "WiaWrap.h"

List of all members.

Public Member Functions

CComPtrArray ()
CComPtrArray (int nCount)
CComPtrArray (const CComPtrArray &rhs)
~CComPtrArray ()
void | Clear ()
void | Copy (const CComPtrArray &rhs)
LONG & | Count ()
operator T ** ()
bool | operator! ()
T *** | operator& ()
CComPtrArray & | operator= (const CComPtrArray &rhs)

Private Attributes

LONG | m_nCount
T ** | m_pArray

Detailed Description

template<class T>
class WiaWrap::CComPtrArray< T >

Definition at line 428 of file WiaWrap.h.

Constructor & Destructor Documentation

template<class T>
WiaWrap::CComPtrArray< T >::CComPtrArray ( ) [inline]

Definition at line 431 of file WiaWrap.h.

    {
        m_pArray = NULL;
        m_nCount = 0;
    }

template<class T>
WiaWrap::CComPtrArray< T >::CComPtrArray ( int nCount ) [inline, explicit]

Definition at line 437 of file WiaWrap.h.

    {
        m_pArray = (T **) CoTaskMemAlloc(nCount * sizeof(T *));

        m_nCount = m_pArray == NULL ? 0 : nCount;

        for (int i = 0; i < m_nCount; ++i)
        {
            m_pArray[i] = NULL;
        }
    }

template<class T>
WiaWrap::CComPtrArray< T >::CComPtrArray ( const CComPtrArray< T > & rhs ) [inline]

Definition at line 449 of file WiaWrap.h.

    {
        Copy(rhs);
    }

template<class T>
WiaWrap::CComPtrArray< T >::~CComPtrArray ( ) [inline]

Definition at line 454 of file WiaWrap.h.

    {
        Clear();
    }

Member Function Documentation

template<class T>
void WiaWrap::CComPtrArray< T >::Clear ( ) [inline]

Definition at line 490 of file WiaWrap.h.

  {
        if (m_pArray != NULL)
        {
            for (int i = 0; i < m_nCount; ++i)
            {
                if (m_pArray[i] != NULL)
                {
                    m_pArray[i]->Release();
                }
            }

            CoTaskMemFree(m_pArray);

            m_pArray = NULL;
            m_nCount = 0;
        }
  }

template<class T>
void WiaWrap::CComPtrArray< T >::Copy ( const CComPtrArray< T > & rhs ) [inline]

Definition at line 509 of file WiaWrap.h.

    {
        m_pArray = NULL;
        m_nCount = 0;

        if (rhs.m_pArray != NULL)
        {
            m_pArray = (T**) CoTaskMemAlloc(rhs.m_nCount * sizeof(T *));

            if (m_pArray != NULL)
            {
                m_nCount = rhs.m_nCount;

                for (int i = 0; i < m_nCount; ++i)
                {
                    m_pArray[i] = rhs.m_pArray[i];

                    if (m_pArray[i] != NULL)
                    {
                        m_pArray[i]->AddRef();
                    }
                }
            }
        }
    }

template<class T>
LONG& WiaWrap::CComPtrArray< T >::Count ( ) [inline]

Definition at line 485 of file WiaWrap.h.

    {
        return m_nCount;
    }

template<class T>
WiaWrap::CComPtrArray< T >::operator T ** ( ) [inline]

Definition at line 470 of file WiaWrap.h.

    {
        return m_pArray;
    }

template<class T>
bool WiaWrap::CComPtrArray< T >::operator! ( ) [inline]

Definition at line 475 of file WiaWrap.h.

    {
        return m_pArray == NULL;
    }

template<class T>
T*** WiaWrap::CComPtrArray< T >::operator& ( ) [inline]

Definition at line 480 of file WiaWrap.h.

    {
        return &m_pArray;
    }

template<class T>
CComPtrArray& WiaWrap::CComPtrArray< T >::operator= ( const CComPtrArray< T > & rhs ) [inline]

Definition at line 459 of file WiaWrap.h.

    {
        if (this != &rhs)
        {
            Clear();
            Copy(rhs);
        }

        return *this;
    }

Member Data Documentation

template<class T>
LONG WiaWrap::CComPtrArray< T >::m_nCount [private]

Definition at line 537 of file WiaWrap.h.

template<class T>
T** WiaWrap::CComPtrArray< T >::m_pArray [private]

Definition at line 536 of file WiaWrap.h.

The documentation for this class was generated from the following file:
  • Multimedia/wia/GetImage/WiaWrap.h
Generated on Wed Nov 13 2024 16:58:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WiaWrap::CDataCallback Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • WiaWrap
  • WiaWrap::CDataCallback
Public Member Functions | Private Member Functions | Private Attributes

WiaWrap::CDataCallback Class Reference

#include "DataCallback.h"

List of all members.

Public Member Functions

CDataCallback (PFNPROGRESSCALLBACK pfnProgressCallback, PVOID pProgressCallbackParam, LONG *plCount, IStream ***pppStream)
STDMETHOD() | BandedDataCallback (LONG lReason, LONG lStatus, LONG lPercentComplete, LONG lOffset, LONG lLength, LONG lReserved, LONG lResLength, PBYTE pbBuffer)
STDMETHOD() | QueryInterface (REFIID iid, LPVOID *ppvObj)
STDMETHOD_ (ULONG, AddRef)()
STDMETHOD_ (ULONG, Release)()

Private Member Functions

HRESULT | CopyToBuffer (ULONG nOffset, LPCVOID pBuffer, ULONG nSize)
HRESULT | ReAllocBuffer (ULONG nBufferSize)
HRESULT | StoreBuffer ()

Private Attributes

BOOL m_bBMP
LONG | m_cRef
LONG | m_nDataSize
LONG | m_nHeaderSize
PFNPROGRESSCALLBACK m_pfnProgressCallback
LONG * | m_plCount
IStream *** | m_pppStream
PVOID m_pProgressCallbackParam
CComPtr< IStream > | m_pStream

Detailed Description

Definition at line 60 of file DataCallback.h.

Constructor & Destructor Documentation

WiaWrap::CDataCallback::CDataCallback | ( | PFNPROGRESSCALLBACK | pfnProgressCallback,
 |  | PVOID | pProgressCallbackParam,
 |  | LONG * | plCount,
 |  | IStream *** | pppStream
 | ) |  |

Definition at line 19 of file DataCallback.cpp.

{
    m_cRef = 0;

    m_bBMP        = FALSE;
    m_nHeaderSize = 0;
    m_nDataSize   = 0;

    m_pfnProgressCallback    = pfnProgressCallback;
    m_pProgressCallbackParam = pProgressCallbackParam;

    m_plCount   = plCount;

Member Function Documentation

STDMETHODIMP WiaWrap::CDataCallback::BandedDataCallback | ( | LONG | lReason,
 |  | LONG | lStatus,
 |  | LONG | lPercentComplete,
 |  | LONG | lOffset,
 |  | LONG | lLength,
 |  | LONG | lReserved,
 |  | LONG | lResLength,
 |  | PBYTE | pbBuffer
 | ) |  |

Definition at line 101 of file DataCallback.cpp.

{
    HRESULT hr;

    // Parse the message

    switch (lReason)
    {
        case IT_MSG_DATA_HEADER:
        {
            PWIA_DATA_CALLBACK_HEADER pHeader = (PWIA_DATA_CALLBACK_HEADER) pbBuffer;

            // Determine if this is a BMP transfer

      m_bBMP = pHeader->guidFormatID == WiaImgFmt_MEMORYBMP || pHeader->guidFormatID == WiaImgFmt_BMP;

            // For WiaImgFmt_MEMORYBMP transfers, WIA does not send a BITMAPFILEHEADER before the data.
            // In this program, we desire all BMP files to contain a BITMAPFILEHEADER, so add it manually

            m_nHeaderSize = pHeader->guidFormatID == WiaImgFmt_MEMORYBMP ? sizeof(BITMAPFILEHEADER) : 0;

            // Allocate memory for the image if the size is given in the header

            if (pHeader != NULL && pHeader->lBufferSize != 0)
            {
                hr = ReAllocBuffer(m_nHeaderSize + pHeader->lBufferSize);

                if (FAILED(hr))
                {
                    return hr;
                }
            }

            break;
        }

        case IT_MSG_DATA:
        {
            // Invoke the callback function

            hr = m_pfnProgressCallback(lStatus, lPercentComplete, m_pProgressCallbackParam);

            if (FAILED(hr) || hr == S_FALSE)
            {
                return hr;
            }

            // If the buffer is not allocated yet and this is the first block,
            // and the transferred image is in BMP format, allocate the buffer
            // according to the size information in the bitmap header

            if (m_pStream == NULL && lOffset == 0 && m_bBMP)
            {
                LONG nBufferSize = BitmapUtil::GetBitmapSize(pbBuffer);

                if (nBufferSize != 0)
                {
                    hr = ReAllocBuffer(m_nHeaderSize + nBufferSize);

                    if (FAILED(hr))
                    {
                        return hr;
                    }
                }
            }

            // If the transfer goes past the buffer, try to expand it

            if (m_nHeaderSize + lOffset + lLength > m_nDataSize)
            {
                hr = ReAllocBuffer(m_nHeaderSize + lOffset + lLength);

                if (FAILED(hr))
                {
                    return hr;
                }
            }

            // copy the transfer buffer

            hr = CopyToBuffer(m_nHeaderSize + lOffset, pbBuffer, lLength);

            if (FAILED(hr))
            {
                return hr;
            }

            break;
        }

        case IT_MSG_STATUS:
        {
            // Invoke the callback function

            hr = m_pfnProgressCallback(lStatus, lPercentComplete, m_pProgressCallbackParam);

            if (FAILED(hr) || hr == S_FALSE)
            {
                return hr;
            }

            break;
        }

        case IT_MSG_TERMINATION:
        case IT_MSG_NEW_PAGE:
        {
            if (m_pStream != NULL)
            {
                // For BMP files, we should validate the the image header
                // So, obtain the memory buffer from the stream

                if (m_bBMP)
                {
                    // Since the stream is created using CreateStreamOnHGlobal,
                    // we can get the memory buffer with GetHGlobalFromStream.

                    HGLOBAL hBuffer;

                    hr = GetHGlobalFromStream(m_pStream, &hBuffer);

                    if (FAILED(hr))
                    {
                        return hr;
                    }

                    PBITMAPFILEHEADER pBuffer = (PBITMAPFILEHEADER) GlobalLock(hBuffer);

                    if (pBuffer == NULL)
                    {
                        return HRESULT_FROM_WIN32(GetLastError());
                    }

                    // Some scroll-fed scanners may return 0 as the bitmap height
                    // In this case, calculate the image height and modify the header

                    BitmapUtil::FixBitmapHeight(pBuffer + 1, m_nDataSize, TRUE);

                    // For WiaImgFmt_MEMORYBMP transfers, the WIA service does not
                    // include a BITMAPFILEHEADER preceeding the bitmap data.
                    // In this case, fill in the BITMAPFILEHEADER structure.

                    if (m_nHeaderSize != 0)
                    {
                        BitmapUtil::FillBitmapFileHeader(pBuffer + 1, pBuffer);
                    }

                    GlobalUnlock(hBuffer);
                }

                // Store this buffer in the successfully transferred images array

        hr = StoreBuffer();

                if (FAILED(hr))
                {
                    return hr;
                }
            }

            break;
        }
    }

HRESULT WiaWrap::CDataCallback::CopyToBuffer | ( | ULONG | nOffset,
 |  | LPCVOID | pBuffer,
 |  | ULONG | nSize |
 | ) |  |  | [private]

Definition at line 319 of file DataCallback.cpp.

{
    HRESULT hr;

    // First move the stream pointer to the data offset

    LARGE_INTEGER liOffset = { nOffset };

    hr = m_pStream->Seek(liOffset, STREAM_SEEK_SET, 0);

    if (FAILED(hr))
    {
        return hr;
    }

    // Next, write the new data to the stream

    hr = m_pStream->Write(pBuffer, nSize, 0);

    if (FAILED(hr))
    {
        return hr;
    }

STDMETHODIMP WiaWrap::CDataCallback::QueryInterface | ( | REFIID | iid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 44 of file DataCallback.cpp.

{
    if (ppvObj == NULL)
    {
        return E_POINTER;
    }

    if (iid == IID_IUnknown)
    {
        *ppvObj = (IUnknown*) this;
    }
    else if (iid == IID_IWiaDataCallback)
    {
        *ppvObj = (IWiaDataCallback *) this;
    }
    else
    {
        *ppvObj = NULL;
        return E_NOINTERFACE;
    }

    AddRef();

HRESULT WiaWrap::CDataCallback::ReAllocBuffer ( ULONG nBufferSize ) [private]

Definition at line 282 of file DataCallback.cpp.

{
    HRESULT hr;

    // If m_pStream is not initialized yet, create a new stream object

    if (m_pStream == 0)
    {
        hr = CreateStreamOnHGlobal(0, TRUE, &m_pStream);

        if (FAILED(hr))
        {
            return hr;
        }
    }

    // Next, set the size of the stream object

    ULARGE_INTEGER liSize = { nSize };

    hr = m_pStream->SetSize(liSize);

    if (FAILED(hr))
    {
        return hr;
    }

    m_nDataSize = nSize;

WiaWrap::CDataCallback::STDMETHOD_ | ( | ULONG | ,
 |  | AddRef |
 | ) |  |
WiaWrap::CDataCallback::STDMETHOD_ | ( | ULONG | ,
 |  | Release |
 | ) |  |
HRESULT WiaWrap::CDataCallback::StoreBuffer ( ) [private]

Definition at line 352 of file DataCallback.cpp.

{
    // Increase the successfully transferred buffers array size

    IStream **ppStream = (IStream **) CoTaskMemRealloc(
    *m_pppStream,
    (*m_plCount + 1) * sizeof(IStream *)
  );

    if (ppStream == NULL)
    {
        return E_OUTOFMEMORY;
    }

    *m_pppStream = ppStream;

    // Rewind the current buffer

    LARGE_INTEGER liZero = { 0 };

    m_pStream->Seek(liZero, STREAM_SEEK_SET, 0);

    // Store the current buffer as the last successfully transferred buffer

  (*m_pppStream)[*m_plCount] = m_pStream;
    (*m_pppStream)[*m_plCount]->AddRef();

    *m_plCount += 1;

    // Reset the current buffer

    m_pStream.Release();

    m_nDataSize = 0;

Member Data Documentation

BOOL WiaWrap::CDataCallback::m_bBMP [private]

Definition at line 99 of file DataCallback.h.

LONG WiaWrap::CDataCallback::m_cRef [private]

Definition at line 97 of file DataCallback.h.

LONG WiaWrap::CDataCallback::m_nDataSize [private]

Definition at line 101 of file DataCallback.h.

LONG WiaWrap::CDataCallback::m_nHeaderSize [private]

Definition at line 100 of file DataCallback.h.

PFNPROGRESSCALLBACK WiaWrap::CDataCallback::m_pfnProgressCallback [private]

Definition at line 104 of file DataCallback.h.

LONG* WiaWrap::CDataCallback::m_plCount [private]

Definition at line 107 of file DataCallback.h.

IStream*** WiaWrap::CDataCallback::m_pppStream [private]

Definition at line 108 of file DataCallback.h.

PVOID WiaWrap::CDataCallback::m_pProgressCallbackParam [private]

Definition at line 105 of file DataCallback.h.

CComPtr<IStream> WiaWrap::CDataCallback::m_pStream [private]

Definition at line 102 of file DataCallback.h.

The documentation for this class was generated from the following files:
  • Multimedia/wia/GetImage/DataCallback.h
  • Multimedia/wia/GetImage/DataCallback.cpp
Generated on Wed Nov 13 2024 16:58:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WiaWrap::CEventCallback Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • WiaWrap
  • WiaWrap::CEventCallback
Public Member Functions | Private Attributes

WiaWrap::CEventCallback Class Reference

#include "EventCallback.h"

List of all members.

Public Member Functions

CEventCallback ()
ULONG | GetNumDevices () const
STDMETHOD() | ImageEventCallback (LPCGUID pEventGuid, BSTR bstrEventDescription, BSTR bstrDeviceID, BSTR bstrDeviceDescription, DWORD dwDeviceType, BSTR bstrFullItemName, ULONG *pulEventType, ULONG ulReserved)
STDMETHOD() | QueryInterface (REFIID iid, LPVOID *ppvObj)
HRESULT | Register ()
STDMETHOD_ (ULONG, Release)()
STDMETHOD_ (ULONG, AddRef)()

Private Attributes

LONG | m_cRef
ULONG m_nNumDevices
CComPtr< IUnknown > | m_pConnectEventObject
CComPtr< IUnknown > | m_pDisconnectEventObject

Detailed Description

Definition at line 44 of file EventCallback.h.

Constructor & Destructor Documentation

WiaWrap::CEventCallback::CEventCallback ( )

Definition at line 19 of file EventCallback.cpp.

{
    m_cRef = 0;

Member Function Documentation

ULONG WiaWrap::CEventCallback::GetNumDevices ( ) const

Definition at line 166 of file EventCallback.cpp.

{

STDMETHODIMP WiaWrap::CEventCallback::ImageEventCallback | ( | LPCGUID | pEventGuid,
 |  | BSTR | bstrEventDescription,
 |  | BSTR | bstrDeviceID,
 |  | BSTR | bstrDeviceDescription,
 |  | DWORD | dwDeviceType,
 |  | BSTR | bstrFullItemName,
 |  | ULONG * | pulEventType,
 |  | ULONG | ulReserved
 | ) |  |

Definition at line 87 of file EventCallback.cpp.

{

STDMETHODIMP WiaWrap::CEventCallback::QueryInterface | ( | REFIID | iid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 30 of file EventCallback.cpp.

{
    if (ppvObj == NULL)
    {
      return E_POINTER;
    }

    if (iid == IID_IUnknown)
    {
      *ppvObj = (IUnknown *) this;
    }
    else if (iid == IID_IWiaEventCallback)
    {
      *ppvObj = (IWiaEventCallback *) this;
    }
    else
    {
        *ppvObj = NULL;
        return E_NOINTERFACE;
    }

  AddRef();

HRESULT WiaWrap::CEventCallback::Register ( )

Definition at line 106 of file EventCallback.cpp.

{
    HRESULT hr;

    // Create a connection to the local WIA device manager

    CComPtr<IWiaDevMgr> pWiaDevMgr;

    hr = pWiaDevMgr.CoCreateInstance(CLSID_WiaDevMgr);

    if (FAILED(hr))
    {
        return hr;
    }

    // Register the callback interface

    hr = pWiaDevMgr->RegisterEventCallbackInterface(
        0,
        NULL,
        &WIA_EVENT_DEVICE_CONNECTED,
        this,
        &m_pConnectEventObject
    );

    if (FAILED(hr))
    {
        return hr;
    }

    hr = pWiaDevMgr->RegisterEventCallbackInterface(
        0,
        NULL,
        &WIA_EVENT_DEVICE_DISCONNECTED,
        this,
        &m_pDisconnectEventObject
    );

    if (FAILED(hr))
    {
        return hr;
    }

    // Get the current count of all the WIA devices on the system

    hr = WiaGetNumDevices(pWiaDevMgr, &m_nNumDevices);

    if (FAILED(hr))
    {
        return hr;
    }

WiaWrap::CEventCallback::STDMETHOD_ | ( | ULONG | ,
 |  | Release |
 | ) |  |
WiaWrap::CEventCallback::STDMETHOD_ | ( | ULONG | ,
 |  | AddRef |
 | ) |  |

Member Data Documentation

LONG WiaWrap::CEventCallback::m_cRef [private]

Definition at line 75 of file EventCallback.h.

ULONG WiaWrap::CEventCallback::m_nNumDevices [private]

Definition at line 76 of file EventCallback.h.

CComPtr<IUnknown> WiaWrap::CEventCallback::m_pConnectEventObject [private]

Definition at line 77 of file EventCallback.h.

CComPtr<IUnknown> WiaWrap::CEventCallback::m_pDisconnectEventObject [private]

Definition at line 78 of file EventCallback.h.

The documentation for this class was generated from the following files:
  • Multimedia/wia/GetImage/EventCallback.h
  • Multimedia/wia/GetImage/EventCallback.cpp
Generated on Wed Nov 13 2024 16:58:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WiaWrap::CProgressDlg Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • WiaWrap
  • WiaWrap::CProgressDlg
Public Member Functions | Static Private Member Functions | Private Attributes

WiaWrap::CProgressDlg Class Reference

#include "ProgressDlg.h"

Inherits com::ms::com::IUnknown.

List of all members.

Public Member Functions

CProgressDlg (HWND hWndParent)
~CProgressDlg ()
BOOL | Cancelled () const
STDMETHOD() | QueryInterface (REFIID iid, LPVOID *ppvObj)
VOID | SetMessage (PCTSTR pszMessage)
VOID | SetPercent (UINT nPercent)
VOID | SetTitle (PCTSTR pszTitle)
STDMETHOD_ (ULONG, AddRef)()
STDMETHOD_ (ULONG, Release)()

Static Private Member Functions

static INT_PTR CALLBACK | DialogProc (HWND, UINT, WPARAM, LPARAM)
static DWORD WINAPI | ThreadProc (PVOID pParameter)

Private Attributes

LONG | m_bCancelled
LONG | m_cRef
HWND | m_hDlg
HANDLE m_hInitDlg
HWND | m_hWndParent

Detailed Description

Definition at line 54 of file ProgressDlg.h.

Constructor & Destructor Documentation

WiaWrap::CProgressDlg::CProgressDlg ( HWND hWndParent )

Definition at line 18 of file ProgressDlg.cpp.

{
    m_cRef = 0;

  m_hDlg       = NULL;
  m_hWndParent = hWndParent;
  m_bCancelled = FALSE;

    m_hInitDlg = CreateEvent(NULL, FALSE, FALSE, NULL);

    if (m_hInitDlg != NULL)
    {
        // Create the progress dialog in a separate thread so that it
        // remains responsive

      DWORD dwThreadId;

      HANDLE hThread = CreateThread(
        NULL,
        0,
        ThreadProc,
        this,
        0,
        &dwThreadId
      );

        // Wait until the progress dialog is created and ready to process
        // messages. During creation, the new thread will send window messages
        // to this thread, and this will cause a deadlock if we use
        // WaitForSingleObject instead of MsgWaitForMultipleObjects

        if (hThread != NULL)
        {
            while (MsgWaitForMultipleObjects(1, &m_hInitDlg, FALSE, INFINITE, QS_ALLINPUT | QS_ALLPOSTMESSAGE) == WAIT_OBJECT_0 + 1)
            {
                MSG msg;

                while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
                {
                    TranslateMessage(&msg);
                    DispatchMessage(&msg);
                }
            }

            CloseHandle(hThread);
        }

        CloseHandle(m_hInitDlg);

WiaWrap::CProgressDlg::~CProgressDlg ( )

Definition at line 74 of file ProgressDlg.cpp.

{

Member Function Documentation

BOOL WiaWrap::CProgressDlg::Cancelled ( ) const

Definition at line 137 of file ProgressDlg.cpp.

{

INT_PTR CALLBACK WiaWrap::CProgressDlg::DialogProc | ( | HWND | hDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam |
 | ) |  |  | [static, private]

Definition at line 199 of file ProgressDlg.cpp.

{
    switch (uMsg)
    {
    case WM_INITDIALOG:
    {
            // Retrieve and store the "this" pointer

      CProgressDlg *that = (CProgressDlg *) lParam;

      SetWindowLongPtr(hDlg, DWLP_USER, (LONG_PTR) that);

      that->m_hDlg = hDlg;

            // Initialize progress bar to the range 0 to 100

      SendDlgItemMessage(hDlg, IDC_PROGRESS_BAR, PBM_SETRANGE32, (WPARAM) 0, (LPARAM) 100);

            // Signal the main thread that we are ready

            SetEvent(that->m_hInitDlg);

      return TRUE;
    }

    case WM_COMMAND:
    {
      switch (LOWORD(wParam))
      {
        case IDCANCEL:
        {
                    // If the user presses the cancel button, set the m_bCancelled flag.

          CProgressDlg *that = (CProgressDlg *) GetWindowLongPtr(hDlg, DWLP_USER);

          InterlockedIncrement(&that->m_bCancelled);

                    // The cancel operation will probably take some time, so
                    // change the cancel button text to "wait...", so that
                    // the user will see the cancel command is received and
                    // is being processed

          TCHAR szWait[DEFAULT_STRING_SIZE] = _T("...");

          LoadString(g_hInstance, IDS_WAIT, szWait, COUNTOF(szWait));

            SetDlgItemText(hDlg, IDCANCEL, szWait);

          return TRUE;
        }
      }

      break;
    }
    }

STDMETHODIMP WiaWrap::CProgressDlg::QueryInterface | ( | REFIID | iid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 84 of file ProgressDlg.cpp.

{
    if (ppvObj == NULL)
    {
      return E_POINTER;
    }

    if (iid == IID_IUnknown)
    {
      *ppvObj = (IUnknown *) this;
    }
    else
    {
        *ppvObj = NULL;
        return E_NOINTERFACE;
    }

  AddRef();

VOID WiaWrap::CProgressDlg::SetMessage ( PCTSTR pszMessage )

Definition at line 157 of file ProgressDlg.cpp.

{

VOID WiaWrap::CProgressDlg::SetPercent ( UINT nPercent )

Definition at line 167 of file ProgressDlg.cpp.

{

VOID WiaWrap::CProgressDlg::SetTitle ( PCTSTR pszTitle )

Definition at line 147 of file ProgressDlg.cpp.

{

WiaWrap::CProgressDlg::STDMETHOD_ | ( | ULONG | ,
 |  | AddRef |
 | ) |  |
WiaWrap::CProgressDlg::STDMETHOD_ | ( | ULONG | ,
 |  | Release |
 | ) |  |
DWORD WINAPI WiaWrap::CProgressDlg::ThreadProc ( PVOID pParameter ) [static, private]

Definition at line 177 of file ProgressDlg.cpp.

{
    CProgressDlg *that = (CProgressDlg *) pParameter;

    INT_PTR nResult = DialogBoxParam(
        g_hInstance,
        MAKEINTRESOURCE(IDD_PROGRESS),
        that->m_hWndParent,
        DialogProc,
        (LPARAM) that
    );

Member Data Documentation

LONG WiaWrap::CProgressDlg::m_bCancelled [private]

Definition at line 82 of file ProgressDlg.h.

LONG WiaWrap::CProgressDlg::m_cRef [private]

Definition at line 79 of file ProgressDlg.h.

HWND WiaWrap::CProgressDlg::m_hDlg [private]

Definition at line 80 of file ProgressDlg.h.

HANDLE WiaWrap::CProgressDlg::m_hInitDlg [private]

Definition at line 83 of file ProgressDlg.h.

HWND WiaWrap::CProgressDlg::m_hWndParent [private]

Definition at line 81 of file ProgressDlg.h.

The documentation for this class was generated from the following files:
  • Multimedia/wia/GetImage/ProgressDlg.h
  • Multimedia/wia/GetImage/ProgressDlg.cpp
Generated on Wed Nov 13 2024 16:58:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WININFO Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

WININFO Struct Reference

List of all members.

Public Attributes

BOOL bWindowed
HINSTANCE | hInstance
int | nBPP
int | nHeight
int | nWidth

Detailed Description

Definition at line 48 of file dxsurf3.cpp.

Member Data Documentation

BOOL WININFO::bWindowed

Definition at line 53 of file dxsurf3.cpp.

HINSTANCE WININFO::hInstance

Definition at line 54 of file dxsurf3.cpp.

int WININFO::nBPP

Definition at line 52 of file dxsurf3.cpp.

int WININFO::nHeight

Definition at line 51 of file dxsurf3.cpp.

int WININFO::nWidth

Definition at line 50 of file dxsurf3.cpp.

The documentation for this struct was generated from the following file:
  • Web/dxtrans/dxsurf3/dxsurf3.cpp
Generated on Wed Nov 13 2024 16:58:02 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WRITER_PARAMS Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

WRITER_PARAMS Struct Reference

List of all members.

Public Attributes

HANDLE hPipe
int | iDataSize
char * | szData

Detailed Description

Definition at line 33 of file NmPipe.c.

Member Data Documentation

HANDLE WRITER_PARAMS::hPipe

Definition at line 35 of file NmPipe.c.

int WRITER_PARAMS::iDataSize

Definition at line 37 of file NmPipe.c.

char* WRITER_PARAMS::szData

Definition at line 36 of file NmPipe.c.

The documentation for this struct was generated from the following file:
  • WinBase/IPC/NamePipe/Console/NmPipe.c
Generated on Wed Nov 13 2024 16:58:02 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WRTHANDLE Struct Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Attributes

WRTHANDLE Struct Reference

#include "Server32.h"

List of all members.

Public Attributes

HANDLE hEvent
HANDLE hPipe
HANDLE hThread
BOOL live
CHAR | Name [NAME_SIZE]
OVERLAPPED | overLap

Detailed Description

Definition at line 49 of file Server32.h.

Member Data Documentation

HANDLE WRTHANDLE::hEvent

Definition at line 51 of file Server32.h.

HANDLE WRTHANDLE::hPipe

Definition at line 49 of file Server32.h.

HANDLE WRTHANDLE::hThread

Definition at line 50 of file Server32.h.

BOOL WRTHANDLE::live

Definition at line 53 of file Server32.h.

CHAR WRTHANDLE::Name[NAME_SIZE]

Definition at line 54 of file Server32.h.

OVERLAPPED WRTHANDLE::overLap

Definition at line 52 of file Server32.h.

The documentation for this struct was generated from the following file:
  • WinBase/IPC/NamePipe/NPServer/Server32.h
Generated on Wed Nov 13 2024 16:58:02 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WsdlDiscovery::frmMain Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • WsdlDiscovery
  • WsdlDiscovery::frmMain
Public Member Functions | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes

WsdlDiscovery::frmMain Class Reference

Summary description for Form1.

List of all members.

Public Member Functions

frmMain ()

Protected Member Functions

override void | Dispose (bool disposing)

Private Member Functions

void | _categories_AfterSelect (object sender, TreeViewEventArgs e)
void | _extensionUrl_TextChanged (object sender, EventArgs e)
void | _inquireUrl_TextChanged (object sender, EventArgs e)
void | _loadSchemes_Click (object sender, System.EventArgs e)
void | _providerName_TextChanged (object sender, EventArgs e)
void | _searchCategorization_Click (object sender, System.EventArgs e)
void | _searchProvider_Click (object sender, System.EventArgs e)
void | _searchService_Click (object sender, System.EventArgs e)
void | _serviceName_TextChanged (object sender, EventArgs e)
bool | ContainsInsensitive (string tModelKey, TModelCollection tModels)
bool | ContainsInsensitive (string str, StringCollection coll)
void | FillResultsControl (BusinessEntityCollection businessEntities, StringCollection serviceKeys, TModelCollection wsdlTModels)
TModel | GetTModel (string tModelKey, TModelCollection tModels)
void | InitializeComponent ()
void | SetLoadSchemesButtonState ()
void | SetSearchProviderButtonState ()
void | SetSearchServiceButtonState ()

Static Private Member Functions

static void | Main ()

Private Attributes

UDDI.Tools.CategoryTreeView | _categories
System.Windows.Forms.Label | _categorizationLabel
System.Windows.Forms.Label | _descriptionLabel
System.Windows.Forms.Label | _extensionLabel
System.Windows.Forms.TextBox | _extensionUrl
System.Windows.Forms.GroupBox | _groupBox1
System.Windows.Forms.GroupBox | _groupBox2
System.Windows.Forms.GroupBox | _groupBox3
System.Windows.Forms.Label | _inquireLabel
System.Windows.Forms.TextBox | _inquireUrl
System.Windows.Forms.Button | _loadSchemes
bool | _okToReloadSchemes = true
System.Windows.Forms.Label | _providerLabel
System.Windows.Forms.TextBox | _providerName
System.Windows.Forms.RichTextBox | _results
System.Windows.Forms.Label | _resultsLabel
System.Windows.Forms.Button | _searchCategorization
System.Windows.Forms.Button | _searchProvider
System.Windows.Forms.Button | _searchService
System.Windows.Forms.Label | _serviceLabel
System.Windows.Forms.TextBox | _serviceName
System.ComponentModel.Container | components = null

Detailed Description

Definition at line 40 of file main.cs.

Constructor & Destructor Documentation

WsdlDiscovery::frmMain::frmMain ( ) [inline]

Definition at line 70 of file main.cs.

    {
      //
      // Required for Windows Form Designer support
      //
      InitializeComponent();

      //
      // Add any constructor code after InitializeComponent call
      //
      _inquireUrl.TextChanged += new EventHandler(_inquireUrl_TextChanged);
      _extensionUrl.TextChanged += new EventHandler(_extensionUrl_TextChanged);
      _providerName.TextChanged += new EventHandler(_providerName_TextChanged);
      _serviceName.TextChanged += new EventHandler(_serviceName_TextChanged);

      _categories.AfterSelect += new TreeViewEventHandler(_categories_AfterSelect);

      _searchCategorization.Enabled = false;

      SetSearchProviderButtonState();
      SetSearchServiceButtonState();
      SetLoadSchemesButtonState();
    }

Member Function Documentation

void WsdlDiscovery::frmMain::_categories_AfterSelect | ( | object | sender,
 |  | TreeViewEventArgs | e |
 | ) |  |  | [inline, private]

Definition at line 723 of file main.cs.

    {
      CategoryTreeNode catNode = (CategoryTreeNode)e.Node;

      _searchCategorization.Enabled = ( ( false == catNode.IsSchemeNode ) && ( _extensionUrl.Text.Length >= 0 ) );
      if( catNode.IsSchemeNode )
      {
        _searchCategorization.Enabled = false;
      }
      else
      {
        _searchCategorization.Enabled = true;
      }
    }

void WsdlDiscovery::frmMain::_extensionUrl_TextChanged | ( | object | sender,
 |  | EventArgs | e |
 | ) |  |  | [inline, private]

Definition at line 371 of file main.cs.

    {
      _okToReloadSchemes = true;

      SetLoadSchemesButtonState();
    }

void WsdlDiscovery::frmMain::_inquireUrl_TextChanged | ( | object | sender,
 |  | EventArgs | e |
 | ) |  |  | [inline, private]

Definition at line 360 of file main.cs.

    {
      SetSearchProviderButtonState();
      SetSearchServiceButtonState();
      SetLoadSchemesButtonState();
    }

void WsdlDiscovery::frmMain::_loadSchemes_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Definition at line 647 of file main.cs.

    {
      //
      // We need both the Inquire Url and the Extension Url.
      //
      // The InquireUrl is issued a FindTModel message to get us
      // summary information about all TModels which are categorized
      // as categorizations.  This will give us all the top level
      // nodes in the tree control.
      //
      // The Extension Url is used to issue GetRelatedCategories
      // messages.  These are issued every time someone expands
      // a tree node.
      //
      if( 0 == _inquireUrl.Text.Length )
      {
        MessageBox.Show( "Please specify an Inquire URL.", "Inquire URL missing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation );
        return;
      }

      if( 0 == _extensionUrl.Text.Length )
      {
        MessageBox.Show( "Please specify an Extension URL.", "Extension URL missing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation );
        return;
      }

      try
      {
        //
        // Create a connection object, pass it to our tree control
        // and let the control populate itself.
        //
        Cursor.Current = Cursors.WaitCursor;

        UddiConnection conn = new UddiConnection();
        conn.InquireUrl = _inquireUrl.Text;
        conn.ExtensionsUrl = _extensionUrl.Text;
        _categories.Connection = conn;

        if( null != _categories.Nodes )
        {
          _categories.Nodes.Clear();
        }

        _categories.LoadTModels();

        //
        // We've just loaded the schemes (TModels which are categorized
        // as categorizations.  So disable this load functionality until
        // the user changes either the Inquire Url or the Publish Url.
        //
        _okToReloadSchemes = false;
        SetLoadSchemesButtonState();
      }
      catch( Exception exception )
      {
        Cursor.Current = Cursors.Default;
        MessageBox.Show( exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation );

        if( null != _categories.Nodes )
        {
          _categories.Nodes.Clear();
        }

        return;
      }
    }

void WsdlDiscovery::frmMain::_providerName_TextChanged | ( | object | sender,
 |  | EventArgs | e |
 | ) |  |  | [inline, private]

Definition at line 413 of file main.cs.

    {
      SetSearchProviderButtonState();
    }

void WsdlDiscovery::frmMain::_searchCategorization_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Definition at line 738 of file main.cs.

    {
      //
      // Two sanity checks.  These should never fire because the Search button
      // for categorizations should always be disabled in either of these 2 cases
      // (no tree node selected, or the selected node is not a category), but they
      // are here just in case.
      //
      CategoryTreeNode category = (CategoryTreeNode)_categories.SelectedNode;
      if( null == category )
      {
        MessageBox.Show( "Please select a category!", "Category not selected", MessageBoxButtons.OK, MessageBoxIcon.Exclamation );
        return;
      }

      if( null == category.CategoryValue.KeyValue )
      {
        MessageBox.Show( "This node represents a scheme, not a category.", "Category not selected", MessageBoxButtons.OK, MessageBoxIcon.Exclamation );
        return;
      }

      _results.Clear();

      UddiConnection conn = new UddiConnection();
      conn.InquireUrl = _inquireUrl.Text;

      Cursor.Current = Cursors.WaitCursor;

      //
      // Find all Services that are categorized as whatever value the user selected
      // in the category taxonomy.
      //
      ServiceList sl = null;
      try
      {
        Cursor.Current = Cursors.WaitCursor;

        FindService fs = new FindService();
        fs.CategoryBag.Add( category.CategoryValue.TModelKey, category.CategoryValue.KeyValue, null );

        sl = fs.Send( conn );
      }
      catch( Exception exception )
      {
        Cursor.Current = Cursors.Default;
        MessageBox.Show( exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation );
        return;
      }

      if( 0 == sl.ServiceInfos.Count )
      {
        Cursor.Current = Cursors.Default;
        MessageBox.Show( "No services matching the categorization were found.", "No services found", MessageBoxButtons.OK, MessageBoxIcon.Exclamation );
        return;
      }

      if( true == sl.Truncated )
      {
        MessageBox.Show( "The list of services matching the specified categorization was truncated by the server.  Consider using a more specific name.", "Truncated Results", MessageBoxButtons.OK, MessageBoxIcon.Information );
      }

      //
      // Get the full service detail from the above services.  This is
      // necessary because we need to look inside each binding to see
      // which tmodels are implemented by each service.
      //
      GetServiceDetail gsd = new GetServiceDetail();
      foreach( ServiceInfo si in sl.ServiceInfos )
      {
        gsd.ServiceKeys.Add( si.ServiceKey );
      }

      ServiceDetail sd = gsd.Send( conn );

      //
      // get a list of all (unique) tmodel keys implemented by the
      // services returned above.
      //
      StringCollection allTModelKeys = new StringCollection();
      foreach( BusinessService bs in sd.BusinessServices )
      {
        foreach( BindingTemplate bt in bs.BindingTemplates )
        {
          foreach( TModelInstanceInfo tmii in bt.TModelInstanceInfos )
          {
            if( !ContainsInsensitive( tmii.TModelKey, allTModelKeys ) )
            {
              allTModelKeys.Add( tmii.TModelKey );
            }
          }
        }
      }

      //
      // get the detail on each of these tmodels, and determine which
      // tmodels represent wsdl interfaces.
      //
      if( 0 == allTModelKeys.Count )
      {
        Cursor.Current = Cursors.Default;
        MessageBox.Show( "Services matching the categorization were found, however none of them implement tModels.", "No tModels found", MessageBoxButtons.OK, MessageBoxIcon.Exclamation );
        return;
      }

      TModelDetail tmd = null;
      try
      {
        GetTModelDetail gtmd = new GetTModelDetail();
        foreach( string key in allTModelKeys )
        {
          gtmd.TModelKeys.Add( key );
        }

        tmd = gtmd.Send( conn );
      }
      catch( Exception exception )
      {
        Cursor.Current = Cursors.Default;
        MessageBox.Show( exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation );
        return;
      }

      TModelCollection wsdlTModels = new TModelCollection();
      foreach( TModel tm in tmd.TModels )
      {
        foreach( KeyedReference categorization in tm.CategoryBag )
        {
          if( 0 == string.Compare( CommonCanonical.UddiOrgTypes, categorization.TModelKey, true ) &&
            0 == string.Compare( @"wsdlSpec", categorization.KeyValue, false ) &&
            false == ContainsInsensitive( tm.TModelKey, wsdlTModels ) )
          {
            wsdlTModels.Add( tm );
          }
        }
      }

      //
      // Now go through all of our business services from the
      // getservicedetail call & determine which ones implement
      // one of these tmodels.
      //
      if( 0 == wsdlTModels.Count )
      {
        Cursor.Current = Cursors.Default;
        MessageBox.Show( "Services matching the categorization were found, however none of them are WSDL described.", "No services found", MessageBoxButtons.OK, MessageBoxIcon.Exclamation );
        return;
      }

      StringCollection serviceKeys = new StringCollection();
      StringCollection businessKeys = new StringCollection();

      foreach( BusinessService bs in sd.BusinessServices )
      {
        foreach( BindingTemplate bt in bs.BindingTemplates )
        {
          foreach( TModelInstanceInfo tmii in bt.TModelInstanceInfos )
          {
            //
            // If we have hit an implementation of one of these tModels,
            // and if we don't already have the servicekey keep track of it.
            //
            if( ContainsInsensitive( tmii.TModelKey, wsdlTModels ) &&
              !ContainsInsensitive( bs.ServiceKey, serviceKeys ) )
            {
              serviceKeys.Add( bs.ServiceKey );

              //
              // If we don't already have the business key, keep track of it.
              //
              if( !ContainsInsensitive( bs.BusinessKey, businessKeys ) )
              {
                businessKeys.Add( bs.BusinessKey );
              }
            }
          }
        }
      }

      if( 0 == businessKeys.Count )
      {
        MessageBox.Show( "Nothing was found.", "No businesses found", MessageBoxButtons.OK, MessageBoxIcon.Exclamation );
        return;
      }

      GetBusinessDetail gbd = new GetBusinessDetail();
      gbd.BusinessKeys = businessKeys;

      BusinessDetail bd = gbd.Send( conn );

      FillResultsControl( bd.BusinessEntities, serviceKeys, wsdlTModels );

      Cursor.Current = Cursors.Default;
    }

void WsdlDiscovery::frmMain::_searchProvider_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Definition at line 933 of file main.cs.

    {
      //
      // Two sanity checks.  These should never fire because the Search
      // by provider button should always be disabled if either one of
      // these is true.
      //
      if( 0 == _providerName.Text.Length )
      {
        MessageBox.Show( "Please specify a provider!", "No provider specified", MessageBoxButtons.OK, MessageBoxIcon.Exclamation );
        return;
      }

      if( 0 == _inquireUrl.Text.Length )
      {
        MessageBox.Show( "Please specify an Inquire URL.", "Inquire URL missing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation );
        return;
      }

      _results.Clear();

      UddiConnection conn = new UddiConnection();
      conn.InquireUrl = _inquireUrl.Text;

      Cursor.Current = Cursors.WaitCursor;

      //
      //  1.  Find all Businesses who's name matches what the user typed in.
      //
      BusinessList bl = null;
      try
      {
        FindBusiness fb = new FindBusiness();
        fb.Names.Add( _providerName.Text );
        bl = fb.Send( conn );
      }
      catch( Exception exception )
      {
        Cursor.Current = Cursors.Default;
        MessageBox.Show( exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation );
        return;
      }

      if( 0 == bl.BusinessInfos.Count )
      {
        Cursor.Current = Cursors.Default;
        MessageBox.Show( "No providers matching the specified name were found.", "No providers found", MessageBoxButtons.OK, MessageBoxIcon.Exclamation );
        return;
      }

      if( true == bl.Truncated )
      {
        MessageBox.Show( "The list of providers matching the specified name was truncated by the server.  Consider specifying a more restrictive name.", "Truncated Results", MessageBoxButtons.OK, MessageBoxIcon.Information );
      }

      //
      // 2.  Do a GetBusinessDetail on all the Businesses returned from #1.
      //     This will get us every bit of information about each Business,
      //     each Businesses BusinessService, and each BindingDetail owned
      //     by each BusinessService.
      //
      BusinessDetail bd = null;
      try
      {
        GetBusinessDetail gbd = new GetBusinessDetail();
        foreach( BusinessInfo bi in bl.BusinessInfos )
        {
          gbd.BusinessKeys.Add( bi.BusinessKey );
        }

        bd = gbd.Send( conn );
      }
      catch( Exception exception )
      {
        Cursor.Current = Cursors.Default;
        MessageBox.Show( exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation );
        return;
      }

      //
      // 3.  Get a list of all unique tmodel keys which are implemented
      //     by the services owned by the businesses retrieved above.
      //
      StringCollection allTModelKeys = new StringCollection();
      foreach( BusinessEntity be in bd.BusinessEntities )
      {
        foreach( BusinessService bs in be.BusinessServices )
        {
          foreach( BindingTemplate bt in bs.BindingTemplates )
          {
            foreach( TModelInstanceInfo tmii in bt.TModelInstanceInfos )
            {
              if( false == ContainsInsensitive( tmii.TModelKey, allTModelKeys ) )
              {
                allTModelKeys.Add( tmii.TModelKey );
              }
            }
          }
        }
      }

      //
      // 4.  Now determine which of these tmodels are categorized as
      //     wsdl interfaces.
      //
      if( 0 == allTModelKeys.Count )
      {
        Cursor.Current = Cursors.Default;
        MessageBox.Show( "Businesses matching the specified name were found, but none implement a tModel.", "No tModels found", MessageBoxButtons.OK, MessageBoxIcon.Exclamation );
        return;
      }

      TModelDetail tmd = null;
      try
      {
        GetTModelDetail gtmd = new GetTModelDetail();
        foreach( string key in allTModelKeys )
        {
          gtmd.TModelKeys.Add( key );
        }

        tmd = gtmd.Send( conn );
      }
      catch( Exception exception )
      {
        Cursor.Current = Cursors.Default;
        MessageBox.Show( exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation );
        return;
      }

      TModelCollection wsdlTModels = new TModelCollection();

      foreach( TModel tm in tmd.TModels )
      {
        foreach( KeyedReference categorization in tm.CategoryBag )
        {
          if( 0 == string.Compare( CommonCanonical.UddiOrgTypes, categorization.TModelKey, true ) &&
            0 == string.Compare( @"wsdlSpec", categorization.KeyValue, false ) &&
            false == ContainsInsensitive( tm.TModelKey, wsdlTModels ) )
          {
            wsdlTModels.Add( tm );
          }
        }
      }

      //
      // 5.  now we have a list of businesses named what we want.
      //     we also have a list of tmodel keys which we know represent
      //     tmodels which are categorized as wsdl interfaces.
      //     we will now get a list of service keys representing
      //     services owned by these businesses which implement these
      //     tmodels.
      //
      if( 0 == wsdlTModels.Count )
      {
        Cursor.Current = Cursors.Default;
        MessageBox.Show( "Businesses matching the specified name were found, but none have services described with WSDL.", "No tModels found", MessageBoxButtons.OK, MessageBoxIcon.Exclamation );
        return;
      }

      StringCollection serviceKeys = new StringCollection();
      foreach( BusinessEntity be in bd.BusinessEntities )
      {
        foreach( BusinessService bs in be.BusinessServices )
        {
          foreach( BindingTemplate bt in bs.BindingTemplates )
          {
            foreach( TModelInstanceInfo tmii in bt.TModelInstanceInfos )
            {
              if( ContainsInsensitive( tmii.TModelKey, wsdlTModels ) &&
                !ContainsInsensitive( bs.ServiceKey, serviceKeys ) )
              {
                serviceKeys.Add( bs.ServiceKey );
              }
            }
          }
        }
      }

      FillResultsControl( bd.BusinessEntities, serviceKeys, wsdlTModels );

      Cursor.Current = Cursors.Default;
    }

void WsdlDiscovery::frmMain::_searchService_Click | ( | object | sender,
 |  | System.EventArgs | e |
 | ) |  |  | [inline, private]

Definition at line 1118 of file main.cs.

    {
      //
      // Two sanity checks.  These should never fire because the Search by
      // service button should always be disabled in either of these cases.
      //
      if( 0 == _serviceName.Text.Length )
      {
        MessageBox.Show( "Please specify a service name", "Service name missing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation );
        return;
      }

      if( 0 == _inquireUrl.Text.Length )
      {
        MessageBox.Show( "Please specify an Inquire URL.", "Inquire URL missing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation );
        return;
      }

      _results.Clear();

      UddiConnection conn = new UddiConnection();
      conn.InquireUrl = _inquireUrl.Text;

      Cursor.Current = Cursors.WaitCursor;

      //
      // Find all services that match the specified name.
      //
      ServiceList sl = null;
      try
      {
        FindService fs = new FindService();
        fs.Names.Add( _serviceName.Text );
        sl = fs.Send( conn );
      }
      catch( Exception exception )
      {
        Cursor.Current = Cursors.Default;
        MessageBox.Show( exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation );
        return;
      }

      if( 0 == sl.ServiceInfos.Count )
      {
        Cursor.Current = Cursors.Default;
        MessageBox.Show( "No services matching the specified name were found.", "No services found", MessageBoxButtons.OK, MessageBoxIcon.Exclamation );
        return;
      }

      if( true == sl.Truncated )
      {
        MessageBox.Show( "The list of services matching the specified name was truncated by the server.  Consider using a more specific name.", "Truncated Results", MessageBoxButtons.OK, MessageBoxIcon.Information );
      }

      //
      // get the full service detail from the above services.  this is
      // necessary because we need to look inside each binding to see
      // which tmodels are implemented by each service.
      //
      GetServiceDetail gsd = new GetServiceDetail();
      foreach( ServiceInfo si in sl.ServiceInfos )
      {
        gsd.ServiceKeys.Add( si.ServiceKey );
      }

      ServiceDetail sd = null;
      try
      {
        sd = gsd.Send( conn );
      }
      catch( Exception exception )
      {
        Cursor.Current = Cursors.Default;
        MessageBox.Show( exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation );
        return;
      }

      //
      // get a list of all (unique) tmodel keys implemented by the
      // services returned above.
      //
      StringCollection allTModelKeys = new StringCollection();
      foreach( BusinessService bs in sd.BusinessServices )
      {
        foreach( BindingTemplate bt in bs.BindingTemplates )
        {
          foreach( TModelInstanceInfo tmii in bt.TModelInstanceInfos )
          {
            if( !ContainsInsensitive( tmii.TModelKey, allTModelKeys ) )
            {
              allTModelKeys.Add( tmii.TModelKey );
            }
          }
        }
      }

      //
      // get the detail on each of these tmodels, and determine which
      // tmodels represent wsdl interfaces.
      //
      if( 0 == allTModelKeys.Count )
      {
        Cursor.Current = Cursors.Default;
        MessageBox.Show( "Services matching the specified name were found, however none implement tModels.", "No tModels found", MessageBoxButtons.OK, MessageBoxIcon.Exclamation );
        return;
      }

      TModelDetail tmd = null;
      try
      {
        GetTModelDetail gtmd = new GetTModelDetail();
        foreach( string key in allTModelKeys )
        {
          gtmd.TModelKeys.Add( key );
        }

        tmd = gtmd.Send( conn );
      }
      catch( Exception exception )
      {
        Cursor.Current = Cursors.Default;
        MessageBox.Show( exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation );
        return;
      }

      TModelCollection wsdlTModels = new TModelCollection();
      foreach( TModel tm in tmd.TModels )
      {
        foreach( KeyedReference categorization in tm.CategoryBag )
        {
          if( 0 == string.Compare( CommonCanonical.UddiOrgTypes, categorization.TModelKey, true ) &&
            0 == string.Compare( @"wsdlSpec", categorization.KeyValue, false ) &&
            false == ContainsInsensitive( tm.TModelKey, wsdlTModels ) )
          {
            wsdlTModels.Add( tm );
          }
        }
      }

      //
      // now go through all of our business services from the
      // getservicedetail call & determine which ones implement
      // one of these tmodels.
      //
      if( 0 == wsdlTModels.Count )
      {
        Cursor.Current = Cursors.Default;
        MessageBox.Show( "Services matching the specified name were found, however none are WSDL described.", "No tModels found", MessageBoxButtons.OK, MessageBoxIcon.Exclamation );
        return;
      }

      StringCollection serviceKeys = new StringCollection();
      StringCollection businessKeys = new StringCollection();

      foreach( BusinessService bs in sd.BusinessServices )
      {
        foreach( BindingTemplate bt in bs.BindingTemplates )
        {
          foreach( TModelInstanceInfo tmii in bt.TModelInstanceInfos )
          {
            if( ContainsInsensitive( tmii.TModelKey, wsdlTModels ) &&
              !ContainsInsensitive( bs.ServiceKey, serviceKeys ) )
            {
              serviceKeys.Add( bs.ServiceKey );

              if( !ContainsInsensitive( bs.BusinessKey, businessKeys ) )
              {
                businessKeys.Add( bs.BusinessKey );
              }
            }
          }
        }
      }

      if( 0 == businessKeys.Count )
      {
        MessageBox.Show( "Nothing was found.", "No businesses found", MessageBoxButtons.OK, MessageBoxIcon.Exclamation );
        return;
      }

      GetBusinessDetail gbd = new GetBusinessDetail();
      gbd.BusinessKeys = businessKeys;

      BusinessDetail bd = null;

      try
      {
        bd = gbd.Send( conn );
      }
      catch( Exception exception )
      {
        Cursor.Current = Cursors.Default;
        MessageBox.Show( exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation );
        return;
      }

      FillResultsControl( bd.BusinessEntities, serviceKeys, wsdlTModels );

      Cursor.Current = Cursors.Default;
    }

void WsdlDiscovery::frmMain::_serviceName_TextChanged | ( | object | sender,
 |  | EventArgs | e |
 | ) |  |  | [inline, private]

Definition at line 421 of file main.cs.

    {
      SetSearchServiceButtonState();
    }

bool WsdlDiscovery::frmMain::ContainsInsensitive | ( | string | str,
 |  | StringCollection | coll |
 | ) |  |  | [inline, private]

Definition at line 430 of file main.cs.

    {
      bool found = false;
      foreach( string s in coll )
      {
        if( 0 == string.Compare( str, s, true ) )
        {
          found = true;
          break;
        }
      }

      return found;
    }

bool WsdlDiscovery::frmMain::ContainsInsensitive | ( | string | tModelKey,
 |  | TModelCollection | tModels |
 | ) |  |  | [inline, private]

Definition at line 449 of file main.cs.

    {
      bool found = false;
      foreach( TModel tm in tModels )
      {
        if( 0 == string.Compare( tModelKey, tm.TModelKey, true ) )
        {
          found = true;
          break;
        }
      }

      return found;
    }

override void WsdlDiscovery::frmMain::Dispose ( bool disposing ) [inline, protected]

Clean up any resources being used.

Definition at line 97 of file main.cs.

    {
      if( disposing )
      {
        if (components != null)
        {
          components.Dispose();
        }
      }
      base.Dispose( disposing );
    }

void WsdlDiscovery::frmMain::FillResultsControl | ( | BusinessEntityCollection | businessEntities,
 |  | StringCollection | serviceKeys,
 |  | TModelCollection | wsdlTModels |
 | ) |  |  | [inline, private]

Definition at line 481 of file main.cs.

    {
      //
      // RTF control words & characters.
      //
      const string startRTF   = @"{\rtf1\ansi{\stylesheet\deftab200}";
      const string endRTF     = @"}";
      const string boldOn     = @"\b ";
      const string boldOff    = @"\b0 ";
      const string tab      = @"\tab ";
      const string newLine    = @"\par ";

      //
      // Labels for the sections in our RTF output
      //
      const string serviceName  = @"Service: ";
      const string serviceDesc  = @"Description: ";
      const string bindings   = @"Binding: ";
      const string accessPoint  = @"Access Point: ";
      const string description  = @"Description: ";
      const string interfaceDefs  = @"Interface Definitions: ";

      _results.Clear();

      StringBuilder sb = new StringBuilder();

      sb.Append( startRTF );

      foreach( BusinessEntity be in businessEntities )
      {
        bool foundWsdlSvc = false;
        foreach( BusinessService bs in be.BusinessServices )
        {
          if( ContainsInsensitive( bs.ServiceKey, serviceKeys ) )
          {
            foundWsdlSvc = true;
            break;
          }
        }

        //
        // This particular business entity has no services which
        // are categorized as consumable by wsdl.  So, move onto
        // the next business entity.
        //
        if( false == foundWsdlSvc )
        {
          continue;
        }

        //
        // Just pick the 1st name out of the name collection.  The right
        // thing to do is either to show all names, or to determine the
        // CultureInfo of the current thread & try to display a name from
        // that language (if it exists in the collection ).
        //
        if( 0 < be.Names.Count )
        {
          sb.Append( boldOn + be.Names[ 0 ].Text + boldOff + newLine );
        }

        //
        // Just pick the 1st description out of the description collection.
        // The right thing to do is either to show all descriptions, or to
        // determine the CultureInfo of the current thread & try to display
        // a description from that language (if it exists in the collection ).
        //
        if( 0 < be.Descriptions.Count )
        {
          sb.Append( tab + be.Descriptions[ 0 ].Text + newLine + newLine );
        }

        foreach( BusinessService bs in be.BusinessServices )
        {
          //
          // We cannot assume that every Service owned by this particular
          // Business has been categorized as WSDL described.
          //
          if( !ContainsInsensitive( bs.ServiceKey, serviceKeys ) )
          {
            continue;
          }

          //
          // Just pick the 1st name out of the name collection.
          // The right thing to do is either to show all names, or to
          // determine the CultureInfo of the current thread & try to display
          // a name from that language (if it exists in the collection ).
          //
          sb.Append( tab + boldOn + serviceName + boldOff );
          if( 0 < bs.Names.Count )
          {
            sb.Append( bs.Names[ 0 ].Text + newLine );
          }

          //
          // Just pick the 1st description out of the description collection.
          // The right thing to do is either to show all descriptions, or to
          // determine the CultureInfo of the current thread & try to display
          // a description from that language (if it exists in the collection ).
          //
          if( 0 != bs.Descriptions.Count )
          {
            sb.Append( tab + boldOn + serviceDesc + boldOff );
            sb.Append( bs.Descriptions[ 0 ].Text + newLine );
          }
          sb.Append( newLine );

          //
          // Only display the BindingTemplate's description if it contains a
          // TModelInstanceInfo who's TModelKey property refers to a TModel
          // which is categorized as WSDL.
          //
          foreach( BindingTemplate bt in bs.BindingTemplates )
          {
            bool seenBindingTemplate = false;

            foreach( TModelInstanceInfo tmii in bt.TModelInstanceInfos )
            {
              if( !ContainsInsensitive( tmii.TModelKey, wsdlTModels ) )
              {
                continue;
              }
              //
              // A BindingTemplate could very well contain n TModelInstanceInfos,
              // all of which refer to TModels which are categorized as WSDL.  However,
              // we only want to display the BindingTemplate information once.
              //
              if( false == seenBindingTemplate )
              {
                sb.Append( tab + tab + boldOn + bindings + boldOff + newLine );
                sb.Append( tab + tab + tab + boldOn + accessPoint + boldOff + bt.AccessPoint.Text + newLine );

                if( 0 < bt.Descriptions.Count )
                {
                  sb.Append( tab + tab + tab + boldOn + description + boldOff );
                  //
                  // Just pick the 1st description out of the description collection.
                  // The right thing to do is either to show all descriptions, or to
                  // determine the CultureInfo of the current thread & try to display
                  // a description from that language (if it exists in the collection ).
                  //
                  sb.Append( bt.Descriptions[ 0 ].Text + newLine );
                }

                seenBindingTemplate = true;
              }

              sb.Append( tab + tab + tab + boldOn + interfaceDefs + boldOff + newLine );
              TModel wsdlTModel = GetTModel( tmii.TModelKey, wsdlTModels );
              if( null != wsdlTModel )
              {
                sb.Append( tab + tab + tab + wsdlTModel.OverviewDoc.OverviewUrl + newLine );
              }
            }
          }

          sb.Append( newLine );
        }
      }

      sb.Append( endRTF );
      _results.Rtf = sb.ToString();
    }

TModel WsdlDiscovery::frmMain::GetTModel | ( | string | tModelKey,
 |  | TModelCollection | tModels |
 | ) |  |  | [inline, private]

Definition at line 468 of file main.cs.

    {
      foreach( TModel tm in tModels )
      {
        if( 0 == string.Compare( tModelKey, tm.TModelKey, true ) )
        {
          return tm;
        }
      }

      return null;
    }

void WsdlDiscovery::frmMain::InitializeComponent ( ) [inline, private]

Required method for Designer support - do not modify the contents of this method with the code editor.

Definition at line 114 of file main.cs.

    {
      this._descriptionLabel = new System.Windows.Forms.Label();
      this._inquireLabel = new System.Windows.Forms.Label();
      this._extensionLabel = new System.Windows.Forms.Label();
      this._serviceLabel = new System.Windows.Forms.Label();
      this._providerLabel = new System.Windows.Forms.Label();
      this._categorizationLabel = new System.Windows.Forms.Label();
      this._resultsLabel = new System.Windows.Forms.Label();
      this._groupBox1 = new System.Windows.Forms.GroupBox();
      this._groupBox2 = new System.Windows.Forms.GroupBox();
      this._groupBox3 = new System.Windows.Forms.GroupBox();
      this._inquireUrl = new System.Windows.Forms.TextBox();
      this._extensionUrl = new System.Windows.Forms.TextBox();
      this._serviceName = new System.Windows.Forms.TextBox();
      this._providerName = new System.Windows.Forms.TextBox();
      this._searchService = new System.Windows.Forms.Button();
      this._searchProvider = new System.Windows.Forms.Button();
      this._searchCategorization = new System.Windows.Forms.Button();
      this._categories = new UDDI.Tools.CategoryTreeView();
      this._results = new System.Windows.Forms.RichTextBox();
      this._loadSchemes = new System.Windows.Forms.Button();
      this.SuspendLayout();
      //
      // _descriptionLabel
      //
      this._descriptionLabel.Location = new System.Drawing.Point(24, 16);
      this._descriptionLabel.Name = "_descriptionLabel";
      this._descriptionLabel.Size = new System.Drawing.Size(408, 32);
      this._descriptionLabel.TabIndex = 0;
      this._descriptionLabel.Text = "This application searches a UDDI site for entities with WSDL described services. " +
        " Search by name or browse through available categorization schemes.";
      //
      // _inquireLabel
      //
      this._inquireLabel.Location = new System.Drawing.Point(24, 72);
      this._inquireLabel.Name = "_inquireLabel";
      this._inquireLabel.Size = new System.Drawing.Size(88, 24);
      this._inquireLabel.TabIndex = 1;
      this._inquireLabel.Text = "Inquire URL:";
      //
      // _extensionLabel
      //
      this._extensionLabel.Location = new System.Drawing.Point(24, 104);
      this._extensionLabel.Name = "_extensionLabel";
      this._extensionLabel.Size = new System.Drawing.Size(88, 24);
      this._extensionLabel.TabIndex = 2;
      this._extensionLabel.Text = "Extension URL:";
      //
      // _serviceLabel
      //
      this._serviceLabel.Location = new System.Drawing.Point(24, 152);
      this._serviceLabel.Name = "_serviceLabel";
      this._serviceLabel.Size = new System.Drawing.Size(88, 24);
      this._serviceLabel.TabIndex = 3;
      this._serviceLabel.Text = "Service Name:";
      //
      // _providerLabel
      //
      this._providerLabel.Location = new System.Drawing.Point(24, 184);
      this._providerLabel.Name = "_providerLabel";
      this._providerLabel.Size = new System.Drawing.Size(88, 24);
      this._providerLabel.TabIndex = 4;
      this._providerLabel.Text = "Provider Name:";
      //
      // _categorizationLabel
      //
      this._categorizationLabel.Location = new System.Drawing.Point(24, 216);
      this._categorizationLabel.Name = "_categorizationLabel";
      this._categorizationLabel.Size = new System.Drawing.Size(88, 24);
      this._categorizationLabel.TabIndex = 5;
      this._categorizationLabel.Text = "Categorization:";
      //
      // _resultsLabel
      //
      this._resultsLabel.Location = new System.Drawing.Point(24, 432);
      this._resultsLabel.Name = "_resultsLabel";
      this._resultsLabel.Size = new System.Drawing.Size(88, 24);
      this._resultsLabel.TabIndex = 6;
      this._resultsLabel.Text = "Results:";
      //
      // _groupBox1
      //
      this._groupBox1.Location = new System.Drawing.Point(24, 52);
      this._groupBox1.Name = "_groupBox1";
      this._groupBox1.Size = new System.Drawing.Size(400, 2);
      this._groupBox1.TabIndex = 7;
      this._groupBox1.TabStop = false;
      //
      // _groupBox2
      //
      this._groupBox2.Location = new System.Drawing.Point(24, 136);
      this._groupBox2.Name = "_groupBox2";
      this._groupBox2.Size = new System.Drawing.Size(400, 2);
      this._groupBox2.TabIndex = 8;
      this._groupBox2.TabStop = false;
      //
      // _groupBox3
      //
      this._groupBox3.Location = new System.Drawing.Point(24, 420);
      this._groupBox3.Name = "_groupBox3";
      this._groupBox3.Size = new System.Drawing.Size(400, 2);
      this._groupBox3.TabIndex = 9;
      this._groupBox3.TabStop = false;
      //
      // _inquireUrl
      //
      this._inquireUrl.Location = new System.Drawing.Point(112, 72);
      this._inquireUrl.Name = "_inquireUrl";
      this._inquireUrl.Size = new System.Drawing.Size(312, 20);
      this._inquireUrl.TabIndex = 6;
      this._inquireUrl.Text = "http://uddi.microsoft.com/inquire";
      //
      // _extensionUrl
      //
      this._extensionUrl.Location = new System.Drawing.Point(112, 104);
      this._extensionUrl.Name = "_extensionUrl";
      this._extensionUrl.Size = new System.Drawing.Size(312, 20);
      this._extensionUrl.TabIndex = 7;
      this._extensionUrl.Text = "http://uddi.microsoft.com/extension.asmx";
      //
      // _serviceName
      //
      this._serviceName.Location = new System.Drawing.Point(112, 152);
      this._serviceName.Name = "_serviceName";
      this._serviceName.Size = new System.Drawing.Size(248, 20);
      this._serviceName.TabIndex = 0;
      this._serviceName.Text = "";
      //
      // _providerName
      //
      this._providerName.Location = new System.Drawing.Point(112, 184);
      this._providerName.Name = "_providerName";
      this._providerName.Size = new System.Drawing.Size(248, 20);
      this._providerName.TabIndex = 2;
      this._providerName.Text = "";
      //
      // _searchService
      //
      this._searchService.FlatStyle = System.Windows.Forms.FlatStyle.System;
      this._searchService.Location = new System.Drawing.Point(368, 152);
      this._searchService.Name = "_searchService";
      this._searchService.Size = new System.Drawing.Size(56, 24);
      this._searchService.TabIndex = 1;
      this._searchService.Text = "&Search";
      this._searchService.Click += new System.EventHandler(this._searchService_Click);
      //
      // _searchProvider
      //
      this._searchProvider.FlatStyle = System.Windows.Forms.FlatStyle.System;
      this._searchProvider.Location = new System.Drawing.Point(368, 184);
      this._searchProvider.Name = "_searchProvider";
      this._searchProvider.Size = new System.Drawing.Size(56, 24);
      this._searchProvider.TabIndex = 3;
      this._searchProvider.Text = "S&earch";
      this._searchProvider.Click += new System.EventHandler(this._searchProvider_Click);
      //
      // _searchCategorization
      //
      this._searchCategorization.FlatStyle = System.Windows.Forms.FlatStyle.System;
      this._searchCategorization.Location = new System.Drawing.Point(368, 384);
      this._searchCategorization.Name = "_searchCategorization";
      this._searchCategorization.Size = new System.Drawing.Size(56, 24);
      this._searchCategorization.TabIndex = 5;
      this._searchCategorization.Text = "Se&arch";
      this._searchCategorization.Click += new System.EventHandler(this._searchCategorization_Click);
      //
      // _categories
      //
      this._categories.Connection = null;
      this._categories.ImageIndex = -1;
      this._categories.Location = new System.Drawing.Point(112, 216);
      this._categories.Name = "_categories";
      this._categories.SelectedImageIndex = -1;
      this._categories.Size = new System.Drawing.Size(312, 160);
      this._categories.TabIndex = 17;
      //
      // _results
      //
      this._results.DetectUrls = false;
      this._results.Location = new System.Drawing.Point(24, 456);
      this._results.Name = "_results";
      this._results.ReadOnly = true;
      this._results.Size = new System.Drawing.Size(400, 184);
      this._results.TabIndex = 18;
      this._results.Text = "";
      this._results.WordWrap = false;
      //
      // _loadSchemes
      //
      this._loadSchemes.FlatStyle = System.Windows.Forms.FlatStyle.System;
      this._loadSchemes.Location = new System.Drawing.Point(264, 384);
      this._loadSchemes.Name = "_loadSchemes";
      this._loadSchemes.Size = new System.Drawing.Size(96, 24);
      this._loadSchemes.TabIndex = 4;
      this._loadSchemes.Text = "&Load schemes";
      this._loadSchemes.Click += new System.EventHandler(this._loadSchemes_Click);
      //
      // frmMain
      //
      this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
      this.ClientSize = new System.Drawing.Size(448, 661);
      this.Controls.Add(this._groupBox1);
      this.Controls.Add(this._loadSchemes);
      this.Controls.Add(this._results);
      this.Controls.Add(this._categories);
      this.Controls.Add(this._searchCategorization);
      this.Controls.Add(this._searchProvider);
      this.Controls.Add(this._searchService);
      this.Controls.Add(this._providerName);
      this.Controls.Add(this._serviceName);
      this.Controls.Add(this._extensionUrl);
      this.Controls.Add(this._inquireUrl);
      this.Controls.Add(this._groupBox3);
      this.Controls.Add(this._groupBox2);
      this.Controls.Add(this._resultsLabel);
      this.Controls.Add(this._categorizationLabel);
      this.Controls.Add(this._providerLabel);
      this.Controls.Add(this._serviceLabel);
      this.Controls.Add(this._extensionLabel);
      this.Controls.Add(this._inquireLabel);
      this.Controls.Add(this._descriptionLabel);
      this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
      this.MaximizeBox = false;
      this.MinimizeBox = false;
      this.Name = "frmMain";
      this.Text = "Find WSDL Services";
      this.ResumeLayout(false);

    }

static void WsdlDiscovery::frmMain::Main ( ) [inline, static, private]

The main entry point for the application.

Definition at line 350 of file main.cs.

    {
      System.Windows.Forms.Application.EnableVisualStyles();
      Application.Run(new frmMain());
    }

void WsdlDiscovery::frmMain::SetLoadSchemesButtonState ( ) [inline, private]

Definition at line 404 of file main.cs.

    {
      _loadSchemes.Enabled = _okToReloadSchemes && ( ( 0 != _inquireUrl.Text.Length ) && ( 0 != _extensionUrl.Text.Length ) );
    }

void WsdlDiscovery::frmMain::SetSearchProviderButtonState ( ) [inline, private]

Definition at line 382 of file main.cs.

    {
      _searchProvider.Enabled = ( ( 0 != _inquireUrl.Text.Length ) && ( 0 != _providerName.Text.Length ) );
    }

void WsdlDiscovery::frmMain::SetSearchServiceButtonState ( ) [inline, private]

Definition at line 391 of file main.cs.

    {
      _searchService.Enabled = ( ( 0 != _inquireUrl.Text.Length ) && ( 0 != _serviceName.Text.Length ) );
    }

Member Data Documentation

UDDI.Tools.CategoryTreeView WsdlDiscovery::frmMain::_categories [private]

Definition at line 59 of file main.cs.

System.Windows.Forms.Label WsdlDiscovery::frmMain::_categorizationLabel [private]

Definition at line 47 of file main.cs.

System.Windows.Forms.Label WsdlDiscovery::frmMain::_descriptionLabel [private]

Definition at line 42 of file main.cs.

System.Windows.Forms.Label WsdlDiscovery::frmMain::_extensionLabel [private]

Definition at line 44 of file main.cs.

System.Windows.Forms.TextBox WsdlDiscovery::frmMain::_extensionUrl [private]

Definition at line 53 of file main.cs.

System.Windows.Forms.GroupBox WsdlDiscovery::frmMain::_groupBox1 [private]

Definition at line 49 of file main.cs.

System.Windows.Forms.GroupBox WsdlDiscovery::frmMain::_groupBox2 [private]

Definition at line 50 of file main.cs.

System.Windows.Forms.GroupBox WsdlDiscovery::frmMain::_groupBox3 [private]

Definition at line 51 of file main.cs.

System.Windows.Forms.Label WsdlDiscovery::frmMain::_inquireLabel [private]

Definition at line 43 of file main.cs.

System.Windows.Forms.TextBox WsdlDiscovery::frmMain::_inquireUrl [private]

Definition at line 52 of file main.cs.

System.Windows.Forms.Button WsdlDiscovery::frmMain::_loadSchemes [private]

Definition at line 61 of file main.cs.

bool WsdlDiscovery::frmMain::_okToReloadSchemes = true [private]

Definition at line 63 of file main.cs.

System.Windows.Forms.Label WsdlDiscovery::frmMain::_providerLabel [private]

Definition at line 46 of file main.cs.

System.Windows.Forms.TextBox WsdlDiscovery::frmMain::_providerName [private]

Definition at line 55 of file main.cs.

System.Windows.Forms.RichTextBox WsdlDiscovery::frmMain::_results [private]

Definition at line 60 of file main.cs.

System.Windows.Forms.Label WsdlDiscovery::frmMain::_resultsLabel [private]

Definition at line 48 of file main.cs.

System.Windows.Forms.Button WsdlDiscovery::frmMain::_searchCategorization [private]

Definition at line 58 of file main.cs.

System.Windows.Forms.Button WsdlDiscovery::frmMain::_searchProvider [private]

Definition at line 57 of file main.cs.

System.Windows.Forms.Button WsdlDiscovery::frmMain::_searchService [private]

Definition at line 56 of file main.cs.

System.Windows.Forms.Label WsdlDiscovery::frmMain::_serviceLabel [private]

Definition at line 45 of file main.cs.

System.Windows.Forms.TextBox WsdlDiscovery::frmMain::_serviceName [private]

Definition at line 54 of file main.cs.

System.ComponentModel.Container WsdlDiscovery::frmMain::components = null [private]

Required designer variable.

Definition at line 68 of file main.cs.

The documentation for this class was generated from the following file:
  • UDDI/wsdldiscovery/main.cs
Generated on Wed Nov 13 2024 16:58:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: XBStr Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

XBStr Class Reference

#include "minici.hxx"

List of all members.

Public Member Functions

XBStr (BSTR p=0)
XBStr (XBStr &x)
XBStr (BSTR p=0)
XBStr (XBStr &x)
~XBStr ()
~XBStr ()
BSTR | Acquire ()
BSTR | Acquire ()
void | Free ()
void | Free ()
BSTR | GetPointer () const
BSTR | GetPointer () const
BOOL | IsNull () const
BOOL | IsNull () const
void | Set (BSTR pOleStr)
void | Set (BSTR pOleStr)
BSTR | SetText (WCHAR const *pStr)

Private Attributes

BSTR | _p

Detailed Description

Definition at line 97 of file minici.hxx.

Constructor & Destructor Documentation

XBStr::XBStr ( BSTR p = 0 ) [inline]

Definition at line 100 of file minici.hxx.

: _p( p ) {}

XBStr::XBStr ( XBStr & x ) [inline]

Definition at line 101 of file minici.hxx.

: _p( x.Acquire() ) {}

XBStr::~XBStr ( ) [inline]

Definition at line 102 of file minici.hxx.

{ Free(); }

XBStr::XBStr ( BSTR p = 0 ) [inline]

Definition at line 48 of file QSample.Cxx.

: _p( p ) {}

XBStr::XBStr ( XBStr & x ) [inline]

Definition at line 49 of file QSample.Cxx.

: _p( x.Acquire() ) {}

XBStr::~XBStr ( ) [inline]

Definition at line 50 of file QSample.Cxx.

{ SysFreeString( _p ); }

Member Function Documentation

BSTR XBStr::Acquire ( ) [inline]

Definition at line 111 of file minici.hxx.

{ BSTR p = _p; _p = 0; return p; }

BSTR XBStr::Acquire ( ) [inline]

Definition at line 53 of file QSample.Cxx.

    {
        BSTR pTemp = _p;
        _p = 0;
        return pTemp;
    }

void XBStr::Free ( ) [inline]

Definition at line 60 of file QSample.Cxx.

{ SysFreeString( Acquire() ); }

void XBStr::Free ( ) [inline]

Definition at line 113 of file minici.hxx.

{ SysFreeString(Acquire()); }

BSTR XBStr::GetPointer ( ) const [inline]

Definition at line 112 of file minici.hxx.

{ return _p; }

BSTR XBStr::GetPointer ( ) const [inline]

Definition at line 59 of file QSample.Cxx.

{ return _p; }

BOOL XBStr::IsNull ( ) const [inline]

Definition at line 103 of file minici.hxx.

{ return (0 == _p); }

BOOL XBStr::IsNull ( ) const [inline]

Definition at line 51 of file QSample.Cxx.

{ return ( 0 == _p ); }

void XBStr::Set ( BSTR pOleStr ) [inline]

Definition at line 52 of file QSample.Cxx.

{ _p = pOleStr; }

void XBStr::Set ( BSTR pOleStr ) [inline]

Definition at line 110 of file minici.hxx.

{ _p = pOleStr; }

BSTR XBStr::SetText ( WCHAR const * pStr ) [inline]

Definition at line 104 of file minici.hxx.

    {
        _p = SysAllocString( pStr );
        return _p;
    }

Member Data Documentation

BSTR XBStr::_p [private]

Definition at line 116 of file minici.hxx.

The documentation for this class was generated from the following files:
  • WinBase/Indexing/lrsample/minici.hxx
  • WinBase/Indexing/Simple/QSample.Cxx
Generated on Wed Nov 13 2024 16:58:02 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: XInterface< T > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

XInterface< T > Class Template Reference

#include "minici.hxx"

List of all members.

Public Member Functions

XInterface (T *p=0)
XInterface (T *p=0)
XInterface (T *p=0)
~XInterface ()
~XInterface ()
~XInterface ()
T * | Acquire ()
T * | Acquire ()
T * | Acquire ()
void | Free ()
IUnknown ** | GetIUPointer ()
IUnknown ** | GetIUPointer ()
IUnknown ** | GetIUPointer ()
T * | GetPointer () const
T * | GetPointer () const
T * | GetPointer () const
T ** | GetPPointer ()
T ** | GetPPointer ()
T ** | GetPPointer ()
void ** | GetQIPointer ()
void ** | GetQIPointer ()
void ** | GetQIPointer ()
T & | GetReference ()
BOOL IsNull ()
BOOL IsNull ()
T * | operator-> ()
T * | operator-> ()
T * | operator-> ()
void | Set (T *p)

Private Attributes

T * | _p

Detailed Description

template<class T>
class XInterface< T >

Definition at line 49 of file AdvQuery.Cxx.

Constructor & Destructor Documentation

template<class T>
XInterface< T >::XInterface ( T * p = 0 ) [inline]

Definition at line 52 of file AdvQuery.Cxx.

: _p( p ) {}

template<class T>
XInterface< T >::~XInterface ( ) [inline]

Definition at line 53 of file AdvQuery.Cxx.

{ if ( 0 != _p ) _p->Release(); }

template<class T>
XInterface< T >::XInterface ( T * p = 0 ) [inline]

Definition at line 72 of file minici.hxx.

: _p( p ) {}

template<class T>
XInterface< T >::~XInterface ( ) [inline]

Definition at line 73 of file minici.hxx.

{ if ( 0 != _p ) _p->Release(); }

template<class T>
XInterface< T >::XInterface ( T * p = 0 ) [inline]

Definition at line 76 of file QSample.Cxx.

: _p( p ) {}

template<class T>
XInterface< T >::~XInterface ( ) [inline]

Definition at line 77 of file QSample.Cxx.

{ if ( 0 != _p ) _p->Release(); }

Member Function Documentation

template<class T>
T* XInterface< T >::Acquire ( ) [inline]

Definition at line 59 of file AdvQuery.Cxx.

{ T * p = _p; _p = 0; return p; }

template<class T>
T* XInterface< T >::Acquire ( ) [inline]

Definition at line 83 of file QSample.Cxx.

{ T * p = _p; _p = 0; return p; }

template<class T>
T* XInterface< T >::Acquire ( ) [inline]

Definition at line 79 of file minici.hxx.

{ T * p = _p; _p = 0; return p; }

template<class T>
void XInterface< T >::Free ( ) [inline]

Definition at line 81 of file minici.hxx.

{ T * p = Acquire(); if ( 0 != p ) p->Release(); }

template<class T>
IUnknown** XInterface< T >::GetIUPointer ( ) [inline]

Definition at line 80 of file QSample.Cxx.

{ return (IUnknown **) &_p; }

template<class T>
IUnknown** XInterface< T >::GetIUPointer ( ) [inline]

Definition at line 76 of file minici.hxx.

{ return (IUnknown **) &_p; }

template<class T>
IUnknown** XInterface< T >::GetIUPointer ( ) [inline]

Definition at line 56 of file AdvQuery.Cxx.

{ return (IUnknown **) &_p; }

template<class T>
T* XInterface< T >::GetPointer ( ) const [inline]

Definition at line 75 of file minici.hxx.

{ return _p; }

template<class T>
T* XInterface< T >::GetPointer ( ) const [inline]

Definition at line 79 of file QSample.Cxx.

{ return _p; }

template<class T>
T* XInterface< T >::GetPointer ( ) const [inline]

Definition at line 55 of file AdvQuery.Cxx.

{ return _p; }

template<class T>
T** XInterface< T >::GetPPointer ( ) [inline]

Definition at line 57 of file AdvQuery.Cxx.

{ return &_p; }

template<class T>
T** XInterface< T >::GetPPointer ( ) [inline]

Definition at line 81 of file QSample.Cxx.

{ return &_p; }

template<class T>
T** XInterface< T >::GetPPointer ( ) [inline]

Definition at line 77 of file minici.hxx.

{ return &_p; }

template<class T>
void** XInterface< T >::GetQIPointer ( ) [inline]

Definition at line 58 of file AdvQuery.Cxx.

{ return (void **) &_p; }

template<class T>
void** XInterface< T >::GetQIPointer ( ) [inline]

Definition at line 82 of file QSample.Cxx.

{ return (void **) &_p; }

template<class T>
void** XInterface< T >::GetQIPointer ( ) [inline]

Definition at line 78 of file minici.hxx.

{ return (void **) &_p; }

template<class T>
T& XInterface< T >::GetReference ( ) [inline]

Definition at line 83 of file minici.hxx.

{ return *_p; }

template<class T>
BOOL XInterface< T >::IsNull ( ) [inline]

Definition at line 80 of file minici.hxx.

{ return ( 0 == _p ); }

template<class T>
BOOL XInterface< T >::IsNull ( ) [inline]

Definition at line 84 of file QSample.Cxx.

{ return ( 0 == _p ); }

template<class T>
T* XInterface< T >::operator-> ( ) [inline]

Definition at line 54 of file AdvQuery.Cxx.

{ return _p; }

template<class T>
T* XInterface< T >::operator-> ( ) [inline]

Definition at line 74 of file minici.hxx.

{ return _p; }

template<class T>
T* XInterface< T >::operator-> ( ) [inline]

Definition at line 78 of file QSample.Cxx.

{ return _p; }

template<class T>
void XInterface< T >::Set ( T * p ) [inline]

Definition at line 82 of file minici.hxx.

{ _p = p; }

Member Data Documentation

template<class T>
T * XInterface< T >::_p [private]

Definition at line 62 of file AdvQuery.Cxx.

The documentation for this class was generated from the following files:
  • WinBase/Indexing/AdvQuery/AdvQuery.Cxx
  • WinBase/Indexing/lrsample/minici.hxx
  • WinBase/Indexing/Simple/QSample.Cxx
Generated on Wed Nov 13 2024 16:58:02 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: XPtr< T > Class Template Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

XPtr< T > Class Template Reference

#include "minici.hxx"

List of all members.

Public Member Functions

XPtr (unsigned c=0)
XPtr (T *p)
XPtr (unsigned c)
~XPtr ()
~XPtr ()
T * | Acquire ()
T * | Acquire ()
void | Free ()
void | Free ()
T * | Get () const
T * | Get () const
BOOL | IsNull () const
BOOL | IsNull () const
T const & | operator[] (unsigned i) const
T & | operator[] (unsigned i)
T & | operator[] (unsigned i)
T const & | operator[] (unsigned i) const
void | Set (T *p)
void | Set (T *p)
void | SetSize (unsigned c)
void | SetSize (unsigned c)

Private Attributes

T * | _p

Detailed Description

template<class T>
class XPtr< T >

Definition at line 42 of file minici.hxx.

Constructor & Destructor Documentation

template<class T>
XPtr< T >::XPtr ( unsigned c = 0 ) [inline]

Definition at line 45 of file minici.hxx.

: _p(0) { if ( 0 != c ) _p = new T [ c ]; }

template<class T>
XPtr< T >::XPtr ( T * p ) [inline]

Definition at line 46 of file minici.hxx.

: _p( p ) {}

template<class T>
XPtr< T >::~XPtr ( ) [inline]

Definition at line 47 of file minici.hxx.

{ Free(); }

template<class T>
XPtr< T >::XPtr ( unsigned c ) [inline]

Definition at line 101 of file QSample.Cxx.

: _p(0) { if ( 0 != c ) _p = new T [ c ]; }

template<class T>
XPtr< T >::~XPtr ( ) [inline]

Definition at line 102 of file QSample.Cxx.

{ Free(); }

Member Function Documentation

template<class T>
T* XPtr< T >::Acquire ( ) [inline]

Definition at line 54 of file minici.hxx.

{ T * p = _p; _p = 0; return p; }

template<class T>
T* XPtr< T >::Acquire ( ) [inline]

Definition at line 109 of file QSample.Cxx.

{ T * p = _p; _p = 0; return p; }

template<class T>
void XPtr< T >::Free ( ) [inline]

Definition at line 106 of file QSample.Cxx.

{ delete [] Acquire(); }

template<class T>
void XPtr< T >::Free ( ) [inline]

Definition at line 51 of file minici.hxx.

{ delete [] Acquire(); }

template<class T>
T* XPtr< T >::Get ( ) const [inline]

Definition at line 50 of file minici.hxx.

{ return _p ; }

template<class T>
T* XPtr< T >::Get ( ) const [inline]

Definition at line 105 of file QSample.Cxx.

{ return _p ; }

template<class T>
BOOL XPtr< T >::IsNull ( ) const [inline]

Definition at line 55 of file minici.hxx.

{ return ( 0 == _p ); }

template<class T>
BOOL XPtr< T >::IsNull ( ) const [inline]

Definition at line 110 of file QSample.Cxx.

{ return ( 0 == _p ); }

template<class T>
T& XPtr< T >::operator[] ( unsigned i ) [inline]

Definition at line 52 of file minici.hxx.

{ return _p[i]; }

template<class T>
T const& XPtr< T >::operator[] ( unsigned i ) const [inline]

Definition at line 108 of file QSample.Cxx.

{ return _p[i]; }

template<class T>
T const& XPtr< T >::operator[] ( unsigned i ) const [inline]

Definition at line 53 of file minici.hxx.

{ return _p[i]; }

template<class T>
T& XPtr< T >::operator[] ( unsigned i ) [inline]

Definition at line 107 of file QSample.Cxx.

{ return _p[i]; }

template<class T>
void XPtr< T >::Set ( T * p ) [inline]

Definition at line 104 of file QSample.Cxx.

{ _p = p; }

template<class T>
void XPtr< T >::Set ( T * p ) [inline]

Definition at line 49 of file minici.hxx.

{ _p = p; }

template<class T>
void XPtr< T >::SetSize ( unsigned c ) [inline]

Definition at line 48 of file minici.hxx.

{ Free(); _p = new T [ c ]; }

template<class T>
void XPtr< T >::SetSize ( unsigned c ) [inline]

Definition at line 103 of file QSample.Cxx.

{ Free(); _p = new T [ c ]; }

Member Data Documentation

template<class T>
T * XPtr< T >::_p [private]

Definition at line 58 of file minici.hxx.

The documentation for this class was generated from the following files:
  • WinBase/Indexing/lrsample/minici.hxx
  • WinBase/Indexing/Simple/QSample.Cxx
Generated on Wed Nov 13 2024 16:58:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: XWindow Class Reference

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Private Attributes

XWindow Class Reference

#include "minici.hxx"

List of all members.

Public Member Functions

XWindow (HWND h=0)
~XWindow ()
void | Free ()
HWND | Get ()
void | Set (HWND h)

Private Attributes

HWND | _h

Detailed Description

Definition at line 119 of file minici.hxx.

Constructor & Destructor Documentation

XWindow::XWindow ( HWND h = 0 ) [inline]

Definition at line 122 of file minici.hxx.

: _h( h ) {}

XWindow::~XWindow ( ) [inline]

Definition at line 123 of file minici.hxx.

{ Free(); }

Member Function Documentation

void XWindow::Free ( ) [inline]

Definition at line 125 of file minici.hxx.

{ if ( 0 != _h ) { DestroyWindow( _h ); _h = 0; } }

HWND XWindow::Get ( ) [inline]

Definition at line 127 of file minici.hxx.

{ return _h; }

void XWindow::Set ( HWND h ) [inline]

Definition at line 126 of file minici.hxx.

{ _h = 0; }

Member Data Documentation

HWND XWindow::_h [private]

Definition at line 129 of file minici.hxx.

The documentation for this class was generated from the following file:
  • WinBase/Indexing/lrsample/minici.hxx
Generated on Wed Nov 13 2024 16:58:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Hierarchical Index

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members

Class Hierarchy

This inheritance list is sorted roughly, but not completely, alphabetically:
  • __POSITION
  • _AcceptContext
  • _ACCEPTEXARGS
  • _ADOCollectionVtbl
  • _ADODynaCollectionVtbl
  • _ADOVtbl
  • _AIO_WORK_ITEM
  • _APPMEM_COUNTERS
  • _APPMEM_DATA_DEFINITION
  • _APPMEM_DATA_HEADER
  • _APPMEM_INSTANCE
  • _ASYNC_REQUEST
  • _AUTH_SEQ
  • _BALLDATA
  • _BEZBUFFER
  • _BINDING_ENTRY
  • _BLRPLATE
  • _BLRPLATECONFIG
  • _BOUNCEDATA
  • _BUFFER
  • _ClientContext
  • _CLIPBOOKSERVER_RESOURCE
  • _CMD
  • _CMDI
  • _COLUMNDATA
  • _CommandVtbl
  • _CONFIGURATION_ENTRY
  • _CONNECTEXARGS
  • _ConnectionVtbl
  • _COPY_CHUNK
  • _CounterInfoBlock
  • _CREDENTIAL
  • _CSampleDropExt
  • _CUSTOM_DIAL_DLG_SAMPLE_
  • _CUSTOM_ENTRY_DATA_SAMPLE_
  • _DATA_BUFFER
  • _DEVICE_INFO
  • _DIBDATA
  • _DISCONNECTEXARGS
  • _DLGITEMS
  • _DOSDTTM
  • _DRAWDATA
  • _DRVLINE
  • _DRVLINECONFIG
  • _DSA_SEC_PAGE_INFO
  • _DYNAMIC_LOCKS_STORE
  • _DYNAMIC_READWRITE_LOCK
  • _EAP_NAME_DIALOG
  • _EAPCB
  • _ENUMERATE_DIRECTORY_STACK
  • _ENUMERATE_DIRECTORY_STATE
  • _ERRORMAP
  • _EVENT_ENTRY
  • _EVENT_SINK_INFO
  • _Events
  • _ExpenseBuf
  • _EXT_WSPPROC_TABLE
  • _FFSTREAM
  • _FileInfo
  • _FILESHARESAMPLE_PROPS
  • _FILESHARESAMPLE_RESOURCE
  • _FILETIME
  • _foo
  • _FUNC_INFO
  • _FundsRM
  • _HASH_TABLE
  • _htdata
  • _IID
  • _IMEUIDATA
  • _INITDATA
  • _INTERFACE_ENTRY
  • _INTERFACEMAP
  • _INTS
  • _IO_WORK_ITEM
  • _IOCTLARGS
  • _IPSAMPLE_GLOBAL_CONFIG
  • _IPSAMPLE_GLOBAL_STATS
  • _IPSAMPLE_IF_BINDING
  • _IPSAMPLE_IF_CONFIG
  • _IPSAMPLE_IF_STATS
  • _IPSAMPLE_IP_ADDRESS
  • _IPSAMPLE_MIB_GET_INPUT_DATA
  • _IPSAMPLE_MIB_GET_OUTPUT_DATA
  • _IPSAMPLE_MIB_SET_INPUT_DATA
  • _ITEM_DESC
  • _Job
  • _JOB_INFO
  • _LOCAL_HEAP_INFO_BLOCK
  • _LOCINFO
  • _LOCKED_LIST
  • _LSP_ENTRY
  • _MAZEDATA
  • _MEMORY_ALLOC_BLOCK
  • _MESSAGE
  • _metalookup
  • _MIDL_PROC_FORMAT_STRING
  • _MIDL_TYPE_FORMAT_STRING
  • _MOF_INFO
  • _MSD
  • _MSDI
  • _MSV1_0_INTERACTIVE_LOGON
  • _MultiSelectCookies
  • _MYDATA
  • _MYXFORM
  • _NAMEMAP
  • _NETWORK_ENTRY
  • _NoAddRefReleaseQIOnSmartPtr< T >
  • _node_tag
  • _OPEN_FILE
  • _OPTIONS
  • _PACKET
  • _ParameterVtbl
  • _PER_IO_CONTEXT
  • _PER_SOCKET_CONTEXT
  • _playinfo
  • _POLYDATA
  • _PREF
  • _Printer
  • _PROPIDLIST
  • _PROPSETLIST
  • _PROPSHEETCFG
  • _PROPVALUE
  • _PROVIDER
  • _PRTDATA
  • _QOS_OPTIONS
  • _Query
  • _Queue
  • _QueueHashNode
  • _QueueNode
  • _RASHOST_DATA
  • _READ_WRITE_LOCK
  • _RecordsetVtbl
  • _RECV_INFO
  • _RECVARGS
  • _RECVFROMARGS
  • _REGSTRUCT
  • _RqsConfigString
  • _RqsEngineCbInfo
  • _RSUMINFO
  • _RU_SOCKET
  • _RU_SOCKET_CREATE_DATA
  • _RURASREGROOT
  • _RUREGVALUE
  • _SAMPLE_HELPER_DATA_
  • _SCHEMAINFO
  • _SEARCH_REQUEST
  • _SEARCH_REQUEST_STATE
  • _SEC_CONTEXT
  • _SEC_FUNC
  • _SECTION
  • _SEND_INFO
  • _SENDARGS
  • _SENDTOARGS
  • _SFFS
  • _Shutdown
  • _SIGGEN_COUNTER
  • _SIGGEN_DATA_DEFINITION
  • _SIGNATURE
  • _SNMP_MGR_SESSION
  • _SOCK_INFO
  • _socklist
  • _SP_OPTIONS
  • _STANDARDSECINMEM
  • _STDZ
  • _STREAM_FIND_DATA
  • _stringstruct
  • _SUMMARYINFO
  • _SynchInfo
  • _tag_MMC_VERSION_INFO
  • _tag_NODE_ATTRIB_
  • _tagCol
  • _tagCONFIGITEMLISTVIEWLPARAM
  • _tagCONFIGSETTINGSLPARAM
  • _tagDELETELOGERRORMSG
  • _tagENABLEMODELESSMSG
  • _tagESTABLISHCONNECTIONMSG
  • _tagFILEOBJECT
  • _tagGENERICITEM
  • _tagGENERICITEMLIST
  • _tagHANDLERITEM_SYNCSTATUS
  • _tagHANDLERITEMSETTINGS
  • _tagITEMCONFIGSETTINGSLPARAM
  • _tagLISTPROP
  • _tagLOGERRORMSG
  • _tagLogon
  • _tagMETHODARGS
  • _tagPOSDATA
  • _tagPOSTKEY
  • _tagPREPAREFORSYNCCOMPLETEDMSG
  • _tagPREPAREFORSYNCMSG
  • _tagPROGRESSMSG
  • _tagPROPSTRUCT
  • _tagSAMPLEITEMSETTINGS
  • _tagSHOWERRORCOMPLETEDMSG
  • _tagSHOWERRORMSG
  • _tagSHOWPROPERTIESCOMPLETEDMSG
  • _tagSHOWPROPERTIESMSG
  • _tagStatus
  • _tagSYNCHRONIZECOMPLETEDMSG
  • _tagSYNCHRONIZEMSG
  • _tagTools
  • _tagWorkerThreadArgs
  • _threadparameters
  • _THUMB
  • _TIME
  • _TRANSMITFILEARGS
  • _TRANSMITPACKETSARGS
  • _TYPEMAP
  • _UNICODE_STRING
  • _UNITSTABLE
  • _USER_EVENT
  • _USER_INFO
  • _VIRTUAL_BUFFER
  • _VOLUME_GET_GPT_ATTRIBUTES_INFORMATION
  • _WAVE_DATA
  • _WIDEDBIDMAP
  • _WIDEGUIDMAP
  • _WIDENAMEMAP
  • _WORK_QUEUE
  • _WORK_QUEUE_ITEM
  • _WORK_THREAD_DATA
  • _WSAOVERLAPPEDPLUS
  • _WSARECVMSGARGS
  • _XFORMDATA
  • About
  • AboutDlg
  • ACCOUNT::CAccount
  • ADDRESS_DATA
  • ADOConnectionConstructionVtbl
  • ADORecordsetConstructionVtbl
  • ADsError
  • ADSERRORLib::ADsError
  • ADSFIRSTEXTLib::HelloWorld
  • ADSTYPE_TO_STRING_ENTRY
  • ADSTYPEsyntaxmapping
  • ADVISE_SINK
  • AgentNotifySink
  • APIHook< T >
  • APMFILEHEADER
  • AppEvents
    • CEvent
  • ARRAYQ
  • Async_Lib::AsyncTest
  • ASYNC_REQUESTER
  • ATLCONTROLLib::MMCControl
  • ATTRIBUTES
  • AUTH_DATA
  • AUTHENTICATEPLUGINLib::AuthenticateAdmin
  • AUTHENTICATEPLUGINLib::AuthenticateContext
  • AUTHENTICATEPLUGINLib::AuthenticatePlugin
  • AutoClaims::AutoClaims
  • AutoClaims::InkLayer
  • BANDINFOSTRUCT
  • BANKVCLib::Account
  • BANKVCLib::CreateTable
  • BANKVCLib::MoveMoney
  • BINDINGINFO
  • blockTag
  • BROCHUREMACHINELib::PTLauncher
  • BROWSER_CONFIG
  • BSTRING
  • BTSTR
  • CAccount
  • CacheProxySamplePlugin::CacheProxyPlugin
  • CacheProxySamplePlugin::ContentInfo
  • CacheProxySamplePlugin::INSSBufferImpl
  • CacheProxySamplePlugin::IWMSCacheItemCollectionImpl
  • CacheProxySamplePlugin::IWMSCacheItemDescriptorImpl
  • CacheProxySamplePlugin::PlaylistItem
  • CAddrNode
  • CAdminNotifyHandler
  • CADOComponent
  • CADQIDlg
  • CADsSearch
  • CADVCGENDlg
  • CAdvClientDlg
  • CAgentCtlAnimationNames
  • CAgentCtlAudioObject
  • CAgentCtlBalloonEx
  • CAgentCtlCharacterEx
  • CAgentCtlCharacters
  • CAgentCtlCommandEx
  • CAgentCtlCommandsEx
  • CAgentCtlEx
  • CAgentCtlPropertySheet
  • CAgentCtlRequest
  • CAgentCtlUserInput
  • CAggregate
  • CallbackIUnknownLib::DeviceFinderCallBackInterface
  • CallbackIUnknownLib::ServiceCallBackInterface
  • CAnnotator
  • CAPIDoc
  • CapJ
  • CAppExportDlg
  • CAppInfo
  • CAppInstallDlg
  • CAppLite
    • CWinApp
      • CADQIApp
      • CADsFirstExtApp
      • CADsFirstExtApp
      • CADVCGENApp
      • CAPIApp
      • CCapMFCApp
      • CClientApp
      • CClipBookServerApp
      • CCmdLineConsumerApp
      • CDisdrawApp
      • CDisdrawApp
      • CFileShareSampleApp
      • CGenericUCPApp
      • CHMMSampleApp
      • CImp_DrawApp
      • CMultichanApp
      • CMyUIExtApp
      • CMyUIExtApp
      • CMyWizExtApp
      • CPermEventsApp
      • CPrintSDIApp
      • CRTCIncomingApp
      • CRTCOutgoingApp
      • CSCPCMenuApp
      • CSCPWizApp
      • CTestApp
      • CVCExploreApp
      • CWbemClientApp
      • CXMLTreeApp
  • CAppUtilDlg
  • cascadeec::INewsEvent
    • cascadeec::INewsEventDefault
      • cascadeec::CascadeEC
  • CAssoc< KEY, VALUE >
  • CAsyncFullServ
  • CAsynchNotify
  • CAsyncQuerySink
  • CAsyncTest
  • CAsyncTest::threadParam
  • CAttributeValueAddButton
  • CAttributeValueDeleteButton
  • CAttributeValueEditButton
  • CAttributeValueEditor
  • CAuthenticateAdmin
  • CAuthenticateContext
  • CAVIFileReader
  • CAVIFileWriter
  • CBackgroundCopyCallback
  • CBankDlg
  • CBase
    • CBinder
    • CConnectionPoint
    • CContainerBase
      • CAsynchBase
        • CDataAccess
          • CCommand
          • CDataset
          • CRow
          • CRowset
        • CPropertiesBase
          • CDataSource
          • CEnumerator
        • CSession
        • CStream
      • CRowPosition
      • CTransaction
    • CCustomError
    • CDataLinks
    • CError
    • CMultipleResults
    • CServiceComp
    • CTransactionOptions
    • CUnknown
      • CAsyncXXX< T, ISyncFace, IAsyncFace >
      • CServer
  • CBaseDialog
    • CAddDeviceDlg
    • CAddDeviceDlg
    • CAddDeviceDlg
    • CAddDeviceDlg
    • CAddDeviceDlg
    • CAddDeviceDlg
    • CAddFolderDlg
    • CAddVFileDlg
    • CAddVFileDlg
    • CAddVFileDlg
    • CAddVFileDlg
    • CAddVFileDlg
  • CBaseNode
    • CDeviceNode
    • CDeviceNode
    • CDeviceNode
    • CDeviceNode
    • CDeviceNode
    • CDeviceNode
    • CFolderNode
    • CFolderNode
    • CFolderNode
    • CFolderNode
    • CFolderNode
    • CFolderNode
    • CStaticNode
    • CStaticNode
    • CStaticNode
    • CStaticNode
    • CStaticNode
    • CStaticNode
    • CStaticNode
    • CStaticNode
    • CVirtualFile
    • CVirtualFile
    • CVirtualFile
    • CVirtualFile
    • CVirtualFile
  • CBaseObj
    • CBinder
    • CCommand
    • CDataSource
    • CDBSession
    • CRow
    • CRowset
    • CStream
  • CBehavior
  • CBitArray
  • CBitmapWnd
  • CBlackPen
  • CBlockFormat
    • CBoxFormat
    • CFrameFormat
      • CPageFormat
  • CBox
  • CBrowserHost
  • CBrush
  • CBSTR
  • CByotTransObj
  • CCacheMapEl
  • CCallAs
  • CCallAsFactory
  • CCallbackWrapper
  • CCanvas
    • CPaintCanvas
    • CPrintCanvas
    • CScreenCanvas
  • CCapMFCDlg
  • CCascade
  • CCaseTextService
  • CCertEncodeAltName
  • CCertEncodeBitString
  • CCertEncodeCRLDistInfo
  • CCertEncodeDateArray
  • CCertEncodeLongArray
  • CCertEncodeStringArray
  • CCertExitSample
  • CCertManageExitModuleSample
  • CCertManagePolicyModuleSample
  • CCertPolicySample
  • CCharBlock
    • CBlockFrame
  • CChildView
  • CClassFactory
  • CClassFactoryWrapper
  • CClassPro
  • CClientDlg
  • CCloseQueueDialog
  • CClusPropList
  • CClusPropValueList
  • CClusterUtils
    • CEnumStorageResource
  • CCmdLineConsumerDlg
  • CCmdLineLite
  • CColumnProvider
  • CCommBand
  • CCompartmentMonitor
  • CCompImportDlg
  • CCompInstallDlg
  • CComponent
  • CComponentData
  • CComputer
  • CComSpy
  • CComSpyPropPage
  • CComSyncTest
  • CComWSTR
  • CConnectDlg
  • CConnectionPointContainer
  • CConsole
    • CRichEditLite
      • CInitStringBox
      • CIntTrace
      • CQueryBox
  • CConsumer
  • CContext
  • CContextAdmin
  • CContextMenu
  • CContextMenuExtension
  • CContextSamplePropPage
  • CController
  • CCounterData
  • CCreateQueueDialog
  • CCreateTable
  • CCriticalSection
  • CCrmDebugCompensator
  • CCrmFilesCompensator
  • CCrmFilesTest
  • CCrmFilesWorker
  • CCrmMonComp
  • CCustomPropertyStore
  • CDataObject
  • CDataXferObj
  • CDbAlloc
  • CDBAuthAdmin
  • CDBFile
  • CDefClassFactory
  • CDelegationBase
    • CBackground
    • CBackground
    • CBackground
    • CBackgroundFolder
    • CBackgroundFolder
    • CBackgroundFolder
    • CBicycle
    • CBicycle
    • CBicycle
    • CBicycle
    • CBicycle
    • CBicycle
    • CBicycle
    • CBicycle
    • CBicycle
    • CBicycle
    • CBicycle
    • CBicycle
    • CBicycleFolder
    • CBicycleFolder
    • CBicycleFolder
    • CBicycleFolder
    • CBicycleFolder
    • CBicycleFolder
    • CBicycleFolder
    • CBicycleFolder
    • CBicycleFolder
    • CBicycleFolder
    • CBicycleFolder
    • CBicycleFolder
    • CIceSkate
    • CIceSkate
    • CIceSkate
    • CIceSkate
    • CIceSkate
    • CIceSkate
    • CIceSkate
    • CIceSkate
    • CIceSkate
    • CIceSkate
    • CIceSkate
    • CIceSkate
    • CIceSkateFolder
    • CIceSkateFolder
    • CIceSkateFolder
    • CIceSkateFolder
    • CIceSkateFolder
    • CIceSkateFolder
    • CIceSkateFolder
    • CIceSkateFolder
    • CIceSkateFolder
    • CIceSkateFolder
    • CIceSkateFolder
    • CIceSkateFolder
    • CLandBasedVehicle
    • CLandBasedVehicle
    • CLandBasedVehicle
    • CLandBasedVehicle
    • CLandBasedVehicle
    • CLandBasedVehicle
    • CLandBasedVehicle
    • CLandBasedVehicle
    • CLandBasedVehicle
    • CLandBasedVehicle
    • CLandBasedVehicle
    • CLandBasedVehicle
    • CLandBasedVehicle
    • CPeoplePoweredVehicle
    • CPeoplePoweredVehicle
    • CPeoplePoweredVehicle
    • CPeoplePoweredVehicle
    • CPeoplePoweredVehicle
    • CPeoplePoweredVehicle
    • CPeoplePoweredVehicle
    • CPeoplePoweredVehicle
    • CPeoplePoweredVehicle
    • CPeoplePoweredVehicle
    • CPeoplePoweredVehicle
    • CPeoplePoweredVehicle
    • CPeoplePoweredVehicle
    • CPerson
    • CPlane
    • CRocket
    • CRocket
    • CRocket
    • CRocket
    • CRocket
    • CRocket
    • CRocket
    • CRocket
    • CRocket
    • CRocket
    • CRocket
    • CRocket
    • CRocket
    • CSkateboard
    • CSkateboard
    • CSkateboard
    • CSkateboard
    • CSkateboard
    • CSkateboard
    • CSkateboard
    • CSkateboard
    • CSkateboard
    • CSkateboard
    • CSkateboard
    • CSkateboard
    • CSkateboardFolder
    • CSkateboardFolder
    • CSkateboardFolder
    • CSkateboardFolder
    • CSkateboardFolder
    • CSkateboardFolder
    • CSkateboardFolder
    • CSkateboardFolder
    • CSkateboardFolder
    • CSkateboardFolder
    • CSkateboardFolder
    • CSkateboardFolder
    • CSkyBasedVehicle
    • CSkyBasedVehicle
    • CSkyBasedVehicle
    • CSkyBasedVehicle
    • CSkyBasedVehicle
    • CSkyBasedVehicle
    • CSkyBasedVehicle
    • CSkyBasedVehicle
    • CSkyBasedVehicle
    • CSkyBasedVehicle
    • CSkyBasedVehicle
    • CSkyBasedVehicle
    • CSkyBasedVehicle
    • CSkyVehicle
    • CSpaceFolder
    • CSpaceFolder
    • CSpaceStation
    • CSpaceStation
    • CSpaceVehicle
    • CSpaceVehicle
    • CSpaceVehicle
    • CSpaceVehicle
    • CSpaceVehicle
    • CSpaceVehicle
    • CSpaceVehicle
    • CSpaceVehicle
    • CSpaceVehicle
    • CSpaceVehicle
    • CSpaceVehicle
    • CStaticNode
    • CStaticNode
    • CStaticNode
    • CStaticNode
    • CStaticNode
    • CStaticNode
    • CStaticNode
    • CStaticNode
    • CStaticNode
    • CStaticNode
    • CStaticNode
    • CStaticNode
    • CStaticNode
    • CStaticNode
    • CStaticNode
    • CStaticNode
  • CDeleteObjectDlg
  • CDeleteQueueDialog
  • CDeskBand
  • CDeviceFinderCallback
  • CDeviceProp
  • CDialogBase
    • CProgress
    • CS1Dialog
    • CS2Dialog
    • CS3Dialog
    • CS4Dialog
    • CTypesDialog
    • CWizard
  • CDialogStream
  • CDimmer
  • CDimmerService
  • CDisdrawDlg
  • CDisplayAttributeInfo
  • CDlgDest
  • CDlgIADs
  • CDlgIADsContainer
  • CDlgIADsLargeInteger
  • CDlgIADsOpenDSObject
  • CDlgIADsPropertyList
  • CDlgIADsSecurityDescriptor
  • CDlgIDirectoryObject
  • CDlgIDirectorySearch
  • CDlgSrc
  • CDllData
  • CDllShared
  • CDog
  • CDownloadBindStatusCallback
  • CDownloadUI
  • CDragSource
  • CDrawArea
  • CDropObject
  • CDropSource
  • CDropTarget
  • CDynamic
  • CDynamicResultset
  • CEapCfg
  • CEditSessionBase
    • CCompositionEditSession
    • CFlipDocEditSession
    • CFlipEditSession
    • CHelloEditSession
    • CKeystrokeEditSession
    • CKeystrokeEditSession
    • CPropertyEditSession
    • CTerminateCompositionEditSession
    • CUpdateTextEditSession
  • CellData
  • CellDataList
  • CellPos
  • CEmptyVolumeCache
  • CEnlistTransaction
  • CEntity
  • CEnumDisplayAttributeInfo
  • CEnumFormatEtc
  • CEnumIDList
  • CEnumTASK
  • CEnumXXX< T, ELT_T, IFACE >
  • CERTEXITSAMPLELib::CCertExitSample
  • CERTEXITSAMPLELib::CCertManageExitModuleSample
  • CERTPOLICYSAMPLELib::CCertManagePolicyModuleSample
  • CERTPOLICYSAMPLELib::CCertPolicySample
  • CEventSink
  • CException
  • CExeModule
  • CExList< TYPE >
  • CExplorerBar
  • CExtBuffer
  • CExtendContextMenuEx
  • CExtendPropertySheet
  • CExtObject
  • CExtractIcon
  • CFactory
  • CFactoryData
  • CFastVariant
  • CFileIdx
  • CFileIO
  • CFileLite
  • CFileStream
  • CFileViewer
  • CFixedAlloc
  • CFixedAlloc::CNode
  • CFont
  • CFontRange
  • CFontSelect
  • CFrame
  • CFreeTest
  • CFullPropSpec
  • CFullServ
  • CFVClassFactory
  • CGdiplusInit
  • CGenerateRC
  • CGenericEnum
    • CEnumSyncMgrItems
  • CGenericUCPDlg
  • CGetInfoExDlg
  • CGetReceipt
  • CGridIt
  • CHandler
  • CHello
  • CHelloClassFactory
  • CHILD_PROPERTIES
  • CHILDWINDOWDATA
  • CHiPerfProvider
  • CHourglass
  • CHtmlElemBagEntry
  • CHtmlElement
    • CAnchorTag
    • CImageTag
    • CInputTag
    • CMetaTag
    • CPropertyTag
      • CTitleTag
    • CScriptTag
    • CStartOfFileElement
    • CTextElement
  • CHtmlElementBag
  • CHtmlIFilterBase
    • CHtmlIFilter
  • CHtmlIFilterCF
  • CHtmlScanner
  • CHuman
  • CImp_DrawDlg
  • CImp_DrawDlg::Line
  • CImpAuth
  • CImpIAccessor
  • CImpIAdviseSink
  • CImpIBindResource
  • CImpIColumnsInfo
  • CImpICommandProperties
  • CImpICommandText
  • CImpIConvertType
  • CImpICreateRow
  • CImpIDBBinderProperties
  • CImpIDBCreateCommand
  • CImpIDBCreateSession
  • CImpIDBInfo
  • CImpIDBInitialize
  • CImpIDBProperties
  • CImpIFileViewer
  • CImpIGetDataSource
  • CImpIGetRow
  • CImpIGetSession
  • CImpIGetSourceRow
  • CImpIOleClientSite
  • CImpIOleDocumentSite
  • CImpIOleInPlaceSite
  • CImpIOpenRowset
  • CImpIPersist
  • CImpIPersistFile
  • CImpIRow
  • CImpIRowChange
  • CImpIRowset
  • CImpIRowsetIdentity
  • CImpIRowsetInfo
  • CImpIServiceProvider
  • CImpISessionProperties
  • CImpISpecifyPropertyPages
  • CImpIStream
  • CImportRes
  • CInkInputWnd
  • CInstPro
  • CIsapiCertPolicyFilter
  • CISeqStream
  • CLangBarItemButton
  • CLanguageResourceSampleCF
  • Class1
  • CLDisp
  • CLERK_ENTRY
  • ClientList
  • ClientList::_tag_LIST_NODE
  • ClientList::Iterator
  • CLine::LINEDATA
  • CLinkable
    • CListHeader
    • CThreadData
  • CList< TYPE, ARG_TYPE >
  • CListener
  • CLListImpl< TYPE, ARG_TYPE >
  • CLListImpl< TYPE, ARG_TYPE >::CNode
  • CLocateDialog
  • CLock
  • CLockHandler
    • CSettings
    • CSyncMgrHandler
  • CLogFile
  • CLoginDlg
  • CLUADMEXLib::CoClipBookServerEx
  • CLUADMEXLib::CoFileShareSampleEx
  • CMain
  • CMainFrame
  • CMallocSpy
  • CMap< KEY, ARG_KEY, VALUE, ARG_VALUE >
  • CMarkTextService
  • CMD_ARGS
  • CMember
  • CMemoryException
  • CMemoryMappedInputStream
  • CMessageDlg
  • CMethodPro
  • CMgdClusCfgInit
    • CEnumStorageResource
    • CMgdResType
    • CPartitionInfo
    • CStorageResource
    • CStorageResType
  • CMMCControl
  • CMmStreamBuf
    • CMmStreamConsecBuf
  • CModel
  • CMonitor
  • CMonitorServer
  • CMoveDlg
  • CMoveMoney
  • CMSMQEventHandler
  • CMSOmniProvCommand
  • CMSOmniProvSession
  • CMSOmniProvSessionColSchemaRowset
  • CMSOmniProvSessionPTSchemaRowset
  • CMSOmniProvSessionTRSchemaRowset
  • CMSOmniProvSource
  • CMultiValuedAttributeEditor
  • CMultiValuedListBox
  • CMyCapabilities
  • CMyEventProvider
  • CMyEvictListener
  • CMyInkCollector
  • CMyMemberSetChangeListener
  • CMySink
  • CMyStartupListener
  • CMyUIExtModule
  • CMyWizExtModule
  • CNewsEvent
  • CNode< TYPE >
  • CNotify
    • CAppShareNotify
    • CAppShareNotify
    • CCallNotify
    • CCallNotify
    • CChannelNotify
    • CConfNotify
    • CConfNotify
    • CConfNotify
    • CConfNotify
    • CConfNotify
    • CDataNotify
    • CDataNotify
    • CFileTransferNotify
    • CFtNotify
    • CMgrNotify
    • CMgrNotify
    • CMgrNotify
    • CMgrNotify
    • CMgrNotify
  • CNullModem
  • CObjData
    • CClusterData
    • CClusterData
    • CGroupData
    • CGroupData
    • CNetInterfaceData
    • CNetInterfaceData
    • CNetworkData
    • CNetworkData
    • CNodeData
    • CNodeData
    • CResData
    • CResData
    • CResTypeData
    • CResTypeData
  • CObject
  • CObjSecurity
  • COBLIST
  • COBNODE
  • COfficeDlg
  • COL
  • COLDESC
  • COLEDBComponent
  • COleDocument
  • COleDocumentView
  • COleInPlaceActiveObject
  • COleInPlaceObject
  • COleObject
  • COLORPICKSTATE
  • ColProps
  • ColPropsList
  • COLUMNDATA
  • comadmin::COMAdminAccessChecksLevelOptions
  • comadmin::COMAdminActivationOptions
  • comadmin::COMAdminApplicationExportOptions
  • comadmin::COMAdminApplicationInstallOptions
  • comadmin::COMAdminAuthenticationCapabilitiesOptions
  • comadmin::COMAdminAuthenticationLevelOptions
  • comadmin::COMAdminComponentFlags
  • comadmin::COMAdminErrorCodes
  • comadmin::COMAdminFileFlags
  • comadmin::COMAdminImpersonationLevelOptions
  • comadmin::COMAdminOS
  • comadmin::COMAdminServiceOptions
  • comadmin::COMAdminServiceStatusOptions
  • comadmin::COMAdminSynchronizationOptions
  • comadmin::COMAdminThreadingModels
  • comadmin::COMAdminTransactionOptions
  • comadmin::ICatalogCollection
    • comadmin::COMAdminCatalogCollection
  • comadmin::ICatalogObject
    • comadmin::COMAdminCatalogObject
  • comadmin::ICOMAdminCatalog
    • comadmin::COMAdminCatalog
  • compitem
  • complist
  • COMPlus
  • COMSPYAUDITLib::ComSpyAudit
  • COMSPYCTLLib::ComSpy
  • COMSPYCTLLib::ComSpyPropPage
  • Conf
  • CONotify
  • CONST_DWORD_REP
  • CONST_GUID_REP
  • CONST_WORD_REP
  • ContextNameHint
  • CONTEXTSAMPLEPROPPAGELib::ContextSamplePropPage
  • COpenQueueDialog
  • COrder
  • COShip
  • COShip2
  • Counter
  • CPack
  • CPage
  • CParameters
  • CPermEventsDlg
  • CPersistFile
  • CPersistStorage
  • CPidlMgr
  • CPingResponder
  • CPlex
  • CPlgFilter
  • CPlgPin
  • CPlgTermSample
  • CPluggableTransport
  • CPoint::POINT
  • CPooledData
    • CODBCData
      • CProxy
  • CPower
  • CPrintAux
  • CPrintRequest
  • CPrintSDIDoc
  • CProcessDlg
  • CPropertyPage
    • CBasePropertyPage
      • CClipBookServerParamsPage
      • CFileShareSampleParamsPage
    • CBasePropertyPage
    • CDSLAdvancedPage
    • CDSLConnectionPage
    • CExtPageUser
    • CProppageUserUI
    • CSCPPageBindingInfo
    • CSCPPageGeneral
    • CSCPPageKeywords
    • CSCPUIBindingInfo
    • CSCPUIGeneral
    • CSCPUIKeywords
  • CProppageUser
  • CPropPro
  • CPropSheetExtension
  • CPropSheetHost
  • CProvFactory
  • CProvider
  • CProvider_IWbemEventConsumerProvider
  • CProvider_IWbemEventProvider
  • CProvider_IWbemServices
  • CProvider_IWbemUnboundObjectSink
  • CProviderFactory
  • CProxyPlugin
  • CProxyPlugin::COpState
  • CPSTN
  • CPTLauncher
  • CQueryDlg
  • CQuickStringWrap
  • CRDOComponent
  • CREATEDATA
  • CREATEGIZMOA
  • CREATEGIZMOW
  • CReceiveMessageDialog
  • CReceiveWaitDialog
  • CRecoOutputWnd
  • CRefClient
  • CRefCount
    • CApplet
    • CAppletSession
    • CConfNotify
    • CMgrNotify
  • CRefresher
  • CRefresherMember< T >
  • CRegAccess
  • CReindeer
  • CRenameDlg
  • CRequestInstance
  • CResString
  • CResultset
  • CRowsetViewerDlg
    • CAlterColumnDlg
    • CAlterIndexDlg
    • CAlterTableDlg
    • CConstraintDlg
    • CExecuteParamDlg
    • CFullConnect
    • CMultipleResultsDlg
    • CPropertiesDlg
    • CSchemaDlg
  • CRTCEvents
  • CRTCIncomingDlg
  • CRTCOutgoingDlg
  • CRTCSession
    • CRTCAVSession
    • CRTCIMSession
  • CRTCWin
  • CSAFEARRAY
  • CSafeRefCount
    • CSimpleApp
    • CSimpleApp
    • CSimpleDoc
    • CSimpleDoc
    • CSimpleSite
    • CSimpSvrApp
    • CSimpSvrDoc
  • CSampleDataContainer
  • CSampleDataSource
  • CSampleDirectory
  • CSampleDirectoryInfo
  • CSampleInstance
  • CSampleMSP
  • CSampleMSPCall
  • CSampleMSPStream
  • CSamplePipe
  • CSampleStemmer
  • CSampleWordBreaker
  • CSCP
  • CSCPCMenuDialog
  • CSCPContextMenuModule
  • CSCPWiz
  • CSCPWizModule
  • CSDKSamplePlaylistParser
  • CSDKSamplePlaylistParserPlugin
  • CSDKSampleStorageSystem
  • CSecureObject
  • CSelectEventsDlg
  • CSendMessageDialog
  • CSerialStream
  • CServerDlg
  • CServiceCallback
  • CSessionDlg
  • CSet
    • CCTypeSet
    • CFontSet
  • CSharp_Draw::Form1
  • CSharp_Draw::InputBox
  • CShellExt
  • CShellExtClassFactory
  • CShellFolder
  • CShellIconOverlayID
  • CShellView
  • CShutdownDlg
  • CSids
  • CSimple
  • CSimpleArray< T >
  • CSimpleClass
  • CSimpleDialog
  • CSimpleObject
  • CSimpSvrObj
  • CSite
  • CSmartComPtr< T >
  • CSmartPtr< T >
    • CSmartPtrTrace< T >
  • CSmpFilter
  • CSmpFilterCF
  • CSnap
  • CSnapinAbout
  • CSnoopWnd
  • CSpecialCharHashEntry
  • CSpecialCharHashTable
  • CSpyCon
  • CStabilize
  • CSTATest
  • CStaticEntity
  • CStaticMap
  • CStaticNode::privateData
  • CStatusHelper
  • CStdDbOutput
  • CStorageBuffer
  • CString
  • CStringData
  • CStringException
  • CStringTable
  • CSurrogate
  • CTable
  • CTableCopy
  • CTAPIEventNotification
  • CTE_ENCODER_STRUCT
  • CTestCOMPerformance
  • CTestDlg
  • CTestDoc
  • CTestView
  • CTextField
  • CThumbNailPhotoHolder
  • CTIMER
  • CToken
  • CToolBand
  • CToolBarExtension
  • CTSFDataObject
  • CTSFEditWnd
  • CTSFMainWnd
  • CTSFPersistentPropertyLoader
  • CUpdateReceipt
  • CUtil
  • CUtilBSTR
  • CUtilComPtr< T >
  • CUtilitiesDlg
  • CUtilProp
  • CUtilString
  • CVariant
  • CVARIANT
  • CVCExploreDlg
  • CVCSecuritySampleClass
  • CVector< TYPE, IDX >
    • CVectorEx< TYPE, IDX >
  • CVector< DBBINDING, DBCOUNTITEM >
    • CBindings
  • CVector< DBCOLUMNINFO, DBORDINAL >
    • CColumnInfo
  • CVector< DBPROP >
    • TPropBase< DBPROP >
      • CProperties
  • CVector< DBPROPID >
    • TPropBase< DBPROPID >
      • CPropertyIDs
  • CVector< DBPROPIDSET >
    • TPropSetBase< DBPROPIDSET, CPropertyIDs >
      • CPropIDSets
  • CVector< DBPROPINFO >
    • TPropBase< DBPROPINFO >
      • CPropertyInfos
  • CVector< DBPROPINFOSET >
    • TPropSetBase< DBPROPINFOSET, CPropertyInfos >
      • CPropInfoSets
  • CVector< DBPROPSET >
    • TPropSetBase< DBPROPSET, CProperties >
      • CPropSets
  • CVector< TYPE >
    • TPropBase< TYPE >
    • TPropSetBase< TYPE, OBJTYPE >
  • CView
    • CAPIView
    • CPrintSDIView
    • CScrollableView
  • CViewList
  • CWaitCursor
  • CWaitDlg
  • CWaitSystemDlg
  • CWbemClientDlg
  • CWiaDataCallback
  • CWindow
  • CWizExtUser
  • CWndLite
    • CButtonLite
    • CComboBoxLite
      • CComboBoxEx
      • CComboBoxGuid
      • CComboBoxString
    • CDialogLite
      • CAboutDlg
      • CAlterColumnDlg
      • CAlterIndexDlg
      • CAlterTableDlg
      • CConstraintDlg
      • CEditValueDlg
      • CExecuteParamDlg
      • CInterfaceDlg
        • CMultipleResultsDlg
      • CPropertiesDlg
      • CPropPageLite
        • CFullConnectOptions
        • CFullConnectProperties
        • CFullConnectProvider
        • CFullConnectSecurity
        • COptionsAccessor
        • COptionsCommand
        • COptionsDataSource
        • COptionsError
        • COptionsNotify
        • COptionsRowset
    • CFrameWndLite
      • CMDIFrameLite
        • CMainWindow
    • CListBoxLite
      • CDSLContextBox
    • CMDIChildLite
      • CMDIChild
      • CMDIObjects
      • CMDITrace
    • COleClient
      • CWebBrowser
    • CPropSheetLite
      • CFullConnect
      • COptionsSheet
    • CSchemaDlg
    • CSplitterLite
      • CEditBoxLite
        • CRichEditLite
      • CListViewLite
        • CDataGrid
      • CScrollBarLite
      • CTabLite
      • CTreeViewLite
        • CObjTree
    • CStatusBarLite
    • CToolBarLite
  • CWorkerThread
  • CWrapVBComponent
  • CX224
  • CXmlDOM
  • CXMLTreeDlg
  • DBCONN
  • DBG_THREAD_INFO
  • DEB_DLL_LIST_INFO_STRUCT
  • DEB_DLL_NODE_INFO_STRUCT
  • DEB_PROCESS_LIST_INFO_STRUCT
  • DEB_PROCESS_NODE_INFO_STRUCT
  • DEB_STARTUP_INFO_STRUCT
  • DEB_THREAD_LIST_INFO_STRUCT
  • DEB_THREAD_NODE_INFO_STRUCT
  • DebugGlobals
  • Deers
  • direct
  • diritem
  • dirlist
  • DOREGSTRUCT
  • DTHandler
    • SocketMonitor
  • DWSTR
  • ECB_QUEUE_ENTRY
  • EDANNOTATORLib::Annotator
  • EDCOMMANDSLib::BrowserHost
  • EDGLYPHSLib::BrowserHost
  • EDHOSTLib::BrowserHost
  • EDHOSTLib::Grid
  • EDHOSTLib::Snap
  • EDITARGS
  • ENUMINFO
  • ENUMSYMDATA
  • ErrorsVtbl
  • ErrorVtbl
  • EventID
  • EXEDLLICONINFO
  • EXTENDER_NODE
  • EXTENSION_NODE
  • FaxDlg
  • FieldInfo
  • FieldsVtbl
  • FieldVtbl
  • FILE_CONTEXT_TYPE
  • filebuffer
  • filedata
  • FILEDEX
  • fileline
  • FileRepClient
  • FileRepServer
  • FLAGMAPPING
  • FONTENUM
  • FONTLIST
  • fullsvr::AsyncIFullServ
    • fullsvr::AsyncFullServ
  • fullsvr::ICallFactory
    • fullsvr::FullServ
  • fullsvr::ICancelMethodCalls
    • fullsvr::AsyncFullServ
  • fullsvr::IFullServ
    • fullsvr::FullServ
  • fullsvr::ISynchronize
    • fullsvr::AsyncFullServ
  • GBGETINT
  • GBGETTEXTA
  • GBGETTEXTW
  • GBMSG
  • GBSETINT
  • GLOBAL_STRUCT
  • GlobalVars
  • gss_buffer_desc_struct
  • gss_channel_bindings_struct
  • gss_OID_desc_struct
  • gss_OID_set_desc_struct
  • Hello2J
  • Hello3J
  • HelloJ
  • helper::DatabaseSettings
  • helper::sampleConstants
  • HtmlPropIFilter
  • HtmlPropIFilterCF
  • HTTP_REQUEST_PARAM
  • HTTP_REQUEST_RANGE
  • HTTP_REQUESTCB_PARAM
  • IAccount
  • IADsError
  • IADsErrorVtbl
  • IAnnotator
  • IAppletNotifyVtbl
  • IAppletSessionNotifyVtbl
  • IAppletSessionVtbl
  • IAppletVtbl
  • IAuthenticateAdmin
  • IAuthenticateContext
  • IAuthenticatePlugin
    • CAuthenticatePlugin
  • IBehavior
  • IBrowserHost
  • icmp_hdr
  • icmpv6_echo_request
  • icmpv6_hdr
  • IComSpy
  • IComSpyAudit
    • CComSpySqlAudit
  • ICOMSysLCE
    • CSysLCESub
      • CActivitySub
      • CAppSub
      • CCRMSub
      • CEvtStoreSub
      • CExceptionSub
      • CIdentitySub
      • CInstanceSub
      • CLBSub
      • CMethodSub
      • CObjConstSub
      • CObjPool2Sub
      • CObjPoolSub
      • CObjSub
      • CQCSub
      • CResourceSub
      • CSecuritySub
      • CThreadSub
      • CTxSub
      • CUserSub
  • ICONDIR
  • ICONDIRENTRY
  • ICONIMAGE
  • IConnectionPointImpl
    • CProxyIRowsetNotify< T >
    • CProxyIRowsetNotify< CMSOmniProvRowset >
      • CMSOmniProvRowset
  • ICONRESOURCE
  • ICreateTable
  • IDBAuthAdmin
  • IDBAuthPlugin
    • CDBAuthPlugin
  • IDimmer
  • IDimmerService
  • IDispEventSimpleImpl
    • IInkCollectorEventsImpl< T >
    • IInkCollectorEventsImpl< T >
    • IInkCollectorEventsImpl< CAdvRecoApp >
      • CAdvRecoApp
    • IInkCollectorEventsImpl< CAdvRecoApp >
    • IInkCollectorEventsImpl< CMultiRecoApp >
      • CMultiRecoApp
    • IInkCollectorEventsImpl< CMultiRecoApp >
    • IInkRecognitionEventsImpl< T >
    • IInkRecognitionEventsImpl< T >
    • IInkRecognitionEventsImpl< CAdvRecoApp >
      • CAdvRecoApp
    • IInkRecognitionEventsImpl< CAdvRecoApp >
    • IInkRecognitionEventsImpl< CMultiRecoApp >
      • CMultiRecoApp
    • IInkRecognitionEventsImpl< CMultiRecoApp >
  • IEnumConnectionPoints
    • CEnumXXX< CEnumConnectionPoints, LPCONNECTIONPOINT, IEnumConnectionPoints >
      • CEnumConnectionPoints
  • IEnumConnections
    • CEnumXXX< CEnumConnections, CONNECTDATA, IEnumConnections >
      • CEnumConnections
  • IEventSink
  • IFactory
  • igmp_group_record_v3
  • igmp_hdr
  • igmp_hdr_query_v3
  • igmp_hdr_report_v3
  • IGrid
    • CGrid
      • CLineGrid
      • CTextGrid
        • CCharGrid
        • CCodeGrid
  • IHelloWorld
    • HelloWorld
  • IHelloWorldVtbl
  • IIDLookUp
  • IMMCControl
  • IMMCControlVtbl
  • IMoveMoney
  • IMyPersistStreamImpl< T >
  • IMyPersistStreamImpl< CLine >
    • CLine
  • IMyPersistStreamImpl< CPoint >
    • CPoint
  • INDEXINFO
  • InitOle
  • InkBlog::_Default
  • InkBlog::AddBlog
  • InkBlog::InkArea
  • InkClipboard::InkClipboard
  • InkCollection::InkCollection
  • InkCollectorEvents
    • CMyInkEvents
  • InkErase::InkErase
  • InkHitTest::InkHitTest
  • InkRecognition::InkRecognition
  • InstDef
  • INVOKE_INFO
  • ip_hdr
  • IPartitionProperties
    • CPartitionInfo
  • IPluggableTransport
  • IPTLauncher
  • ipv4_option_hdr
  • ipv6_fragment_hdr
  • ipv6_hdr
  • IRowsetChange
    • CImpIRowsetChange
    • IRowsetChangeImpl< T, Storage, RowClass >
    • IRowsetChangeImpl< CMSOmniProvRowset, dummyStore >
      • CMSOmniProvRowset
  • IRowsetScrollImpl< T, RowsetInterface >
  • ISAPI_BUFFER
  • ISAPI_EXTENSION
  • ISAPI_REQUEST
  • ISAPI_STRING
  • ISAPI_STRINGW
  • ISAPITHREAD
  • ISnap
  • IStorageProperties
    • CStorageResource
  • ISynchronize
    • CCallBack
  • item_tag
  • ITEMINFO
  • itemlist
  • ITest
    • CServer
  • IUPnPService_DimmingService_SCPD
  • IUPnPService_DimmingService_SCPDVtbl
  • IWMIObject
    • CPartitionInfo
    • CStorageResource
  • IWMIServices
    • CEnumStorageResource
    • CPartitionInfo
    • CStorageResource
  • IWMSCacheAdmin
    • CachePluginAdmin
  • IWMSContextAdmin
  • IWMSContextPlugin
    • CContextPlugin
  • KEY_HEADER
  • LessThan< Item >
  • LineData
  • LIST_STRUCT
  • LOGON_DATA
  • LOGPAL
  • MainDlg
  • Margin
  • MEMICONDIR
  • MEMICONDIRENTRY
  • MGDRESOURCELib::ClipBookServer
  • mib_entry
  • Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm
  • Microsoft::Samples::Ink::Cs::InkZoom::InkZoom
  • Microsoft::Uddi::Demo::Publish
  • msado15::_ADO
    • msado15::_Parameter
      • msado15::Parameter
    • msado15::_Record
      • msado15::Record
    • msado15::Command15
      • msado15::_Command
        • msado15::Command
    • msado15::Connection15
      • msado15::_Connection
        • msado15::Connection
    • msado15::Field
    • msado15::Field15
    • msado15::Recordset15
      • msado15::Recordset20
        • msado15::Recordset21
          • msado15::_Recordset
            • msado15::Recordset
  • msado15::_Collection
    • msado15::_DynaCollection
      • msado15::Parameters
    • msado15::Errors
    • msado15::Fields15
      • msado15::Fields20
        • msado15::Fields
    • msado15::Properties
  • msado15::_Stream
    • msado15::Stream
  • msado15::ADCPROP_ASYNCTHREADPRIORITY_ENUM
  • msado15::ADCPROP_AUTORECALC_ENUM
  • msado15::ADCPROP_UPDATECRITERIA_ENUM
  • msado15::ADOCommandConstruction
  • msado15::ADOConnectionConstruction15
    • msado15::ADOConnectionConstruction
  • msado15::ADORecordConstruction
  • msado15::ADORecordsetConstruction
  • msado15::ADOStreamConstruction
  • msado15::AffectEnum
  • msado15::BookmarkEnum
  • msado15::CEResyncEnum
  • msado15::CommandTypeEnum
  • msado15::CompareEnum
  • msado15::ConnectionEvents
  • msado15::ConnectionEventsVt
  • msado15::ConnectModeEnum
  • msado15::ConnectOptionEnum
  • msado15::ConnectPromptEnum
  • msado15::CopyRecordOptionsEnum
  • msado15::CursorLocationEnum
  • msado15::CursorOptionEnum
  • msado15::CursorTypeEnum
  • msado15::DataTypeEnum
  • msado15::EditModeEnum
  • msado15::Error
  • msado15::ErrorValueEnum
  • msado15::EventReasonEnum
  • msado15::EventStatusEnum
  • msado15::ExecuteOptionEnum
  • msado15::FieldAttributeEnum
  • msado15::FieldEnum
  • msado15::FilterGroupEnum
  • msado15::GetRowsOptionEnum
  • msado15::IRecFields
  • msado15::IsolationLevelEnum
  • msado15::LineSeparatorEnum
  • msado15::LockTypeEnum
  • msado15::MarshalOptionsEnum
  • msado15::MoveRecordOptionsEnum
  • msado15::ObjectStateEnum
  • msado15::ParameterAttributesEnum
  • msado15::ParameterDirectionEnum
  • msado15::PersistFormatEnum
  • msado15::PositionEnum
  • msado15::Property
  • msado15::PropertyAttributesEnum
  • msado15::RecordCreateOptionsEnum
  • msado15::RecordOpenOptionsEnum
  • msado15::RecordsetEvents
  • msado15::RecordsetEventsVt
  • msado15::RecordStatusEnum
  • msado15::RecordTypeEnum
  • msado15::ResyncEnum
  • msado15::SaveOptionsEnum
  • msado15::SchemaEnum
  • msado15::SearchDirectionEnum
  • msado15::SeekEnum
  • msado15::StreamOpenOptionsEnum
  • msado15::StreamReadEnum
  • msado15::StreamTypeEnum
  • msado15::StreamWriteEnum
  • msado15::StringFormatEnum
  • msado15::XactAttributeEnum
  • MSDFHDL::IDataFactoryHandler
  • MSDFMAPLib::Handler
  • MyClassFactory
  • MyDataSource
  • MYDEVICELib::Dimmer
  • MYDEVICELib::DimmerService
  • MYDEVICELib::IUPnPService_DimmingService_SCPD
  • MyOSPObject
  • MyStorageResourceLib::CEnumStorageResource
  • MyStorageResourceLib::CPartitionInfo
  • MyStorageResourceLib::CStorageResource
  • MyStorageResourceLib::CStorageResType
  • MyString
  • MYTOOLINFO
  • NewDocDlg
  • newseventclass::INewsEvent
    • newseventclass::INewsEventDefault
      • newseventclass::NewsEvent
  • NewsFlash
  • NewsSubscriber
  • NIDeque_c< T >
    • Stack_c< T >
  • NIDeque_c< int >
    • Stack_c< int >
      • Cstack_c
  • NIDequeIter_c< T >
  • NILNode_c< T >
  • NILNode_c< int >
  • NODE_PROPERTIES
  • NODE_STRUCT
  • NODESTRUCT
  • NONDIALTOKENS
  • Note
  • Notify
  • Object_Property
  • PaperForm::PaperForm
  • ParametersVtbl
  • params
  • perf
  • persistatl::INewsEvent
    • persistatl::INewsEventDefault
      • persistatl::NewsEvent
  • PersistedConfiguration
  • PersistedConfigurationDataSet
  • PickleControlBlock
  • pipe_state
  • PLGTRMSMPLib::PlgTermSample
  • PMmStream
    • CMmStream
  • POINT3D
  • port_hdr
  • PRIMARYKEY
  • PrintContext
  • PRIVCLIPDATA
  • PROFILE_STRUCT
  • PropertiesVtbl
  • PropertyVtbl
  • Props
  • Provider_Globals
  • PROVIDERINFO
  • PROVTYPEINFO
  • qcnotify::_ShipStatus
  • qcnotify::INotify
    • qcnotify::INotifyDefault
      • qcnotify::Notify
  • qcorder::IOrder
    • qcorder::IOrderDefault
      • qcorder::Order
  • qcship::IShip
    • qcship::IShipDefault
      • qcship::Ship
  • Query
  • Queue
  • RealTimeStylusPluginApp::PluginListItem
  • RealTimeStylusPluginApp::RealTimeStylusPluginApp
  • RealTimeStylusPlugins::CustomDynamicRendererPlugin
  • RealTimeStylusPlugins::PacketFilterPlugin
  • RECEIVE_CONTEXT
  • RECTI
  • RecvBuf
    • CUrlmonCallback
  • RefCount
    • CAppShareNotify
    • CAppShareNotify
    • CCallNotify
    • CCallNotify
    • CChannelNotify
    • CConfNotify
    • CConfNotify
    • CConfNotify
    • CConfNotify
    • CDataNotify
    • CDataNotify
    • CFileTransferNotify
    • CFtNotify
    • CMgrNotify
    • CMgrNotify
    • CMgrNotify
    • CMgrNotify
  • REGENTRY
  • REGSTRUCT
  • RENDERLib::Behavior
  • RENDERLib::EventSink
  • RENDERLib::Factory
  • REQUEST_CONTEXT
  • RESOURCEPOSINFO
  • RESULTDATA
  • RqsClient
  • RqsConfig
  • RqsEngine
  • RSProxy
  • RUN
  • Sample::Messages
  • Sample::MySignedXml
  • Sample::Sample
  • Sample::SignVerify
  • Sample::UI::AboutBox
  • Sample::UI::MainWindow
  • Sample::Win32
  • Sample::Win32::CERT_CHAIN_FIND_BY_ISSUER_PARA
  • SClassEntry
  • SDKDimmerServiceLib::IUPnPService_DimmingService_SCPD
  • SDKDimmerServiceLib::UPNPSampleDimmerDevice
  • SDKSAMPLEPLAYLISTPLUGINLib::SDKSamplePlaylistParser
  • section
  • Serialization::SerializationForm
  • SESSION_DATA
  • SFilterEntry
  • SHandlerEntry
  • SIMPLE_BROWSER
  • SIndexedDisk
  • SIndexedDiskLessThan
  • SInfo
  • SLangClassEntry
  • SLangRegistry
  • SmartRefPointer< T >
  • SMmStream
  • Sock_Info
  • SPINCUBEINFO
  • SPropertyEntry
  • SStemForm
  • statel
  • Static_Info_Database
  • Static_Statistic
  • STL_LABEL
  • storesh::CERT_SYSTEM_STORE_INFO
  • storesh::Storesh
  • storesh::Win32
  • STR_BINDING
  • STYLE
  • SupportConcurList
  • SupportOptList
  • t_Ctype
  • Table
  • TableHdr
  • TABLEINFO
  • TableSelection
  • tag_BASENODE_PROPERTIES
  • tag_chunkhdr
  • tag_filehdr
  • tag_keyframe
  • tag_preroll
  • tag_seq
  • tag_smf
  • tag_smffileinfo
  • tag_smfopenstruct
  • tag_tempomapentry
  • tag_track
  • tagACCESSOR
  • tagADSERRMSG
  • tagADSIIF
  • tagAppletCapability
  • tagAppletCapability2
  • tagAppletCapabilityClass
  • tagAppletCapabilityID
  • tagAppletChannelRequest
  • tagAppletLongString
  • tagAppletObjectKey
  • tagAppletOctetString
  • tagAppletProtocolEntity
  • tagAppletRecord
  • tagAppletRegistryEntryOwner
  • tagAppletRegistryItem
  • tagAppletRegistryKey
  • tagAppletRegistryRequest
  • tagAppletRoster
  • tagAppletSessionKey
  • tagAppletSessionRequest
  • tagAppletTokenRequest
  • tagArFonts
  • tagBRUSHSTYLELOOKUP
  • tagCAPSLOOKUP
  • tagCMTMLTFMT
  • tagCONSOLEDATA
  • tagCrmFilesCreateFileLogRecord
  • tagCrmFilesDeleteFileLogRecord
  • tagDataStruct
  • tagDescInfo
  • tagDescType
  • tagDIAGINFO
  • tagDRAWINFO
  • tagEnhKeyUsage
  • tagENTRY
  • tagENUMLIST
  • tagENUMPRTLOOKUP
  • tagEVENT
  • tagFieldMetaData
  • tagGRAPHICLOOKUP
  • tagHANDLES
  • tagHeader
  • tagICONEXTRACT
  • tagINTERFACEIMPL
  • tagLABELEXTRACT
  • tagLINE
  • tagLINE_INFO
  • tagLINEINFO
  • tagLSTSLOT
  • tagMAPMODELOOKUP
  • tagMETA16HEADER
  • tagMULTI_SZ
  • tagObject
  • tagOleStdEnumFmtEtc
  • tagOleStdEnumStatData
  • tagOLESTDMESSAGEFILTER
  • tagOPTIONS
  • tagPENSTYLELOOKUP
  • tagPENWIDTHLOOKUP
  • tagPIDLDATA
  • tagPLUGXPRT_PARAMETERS
  • tagPOPUPMENUMAP
  • tagProperties
  • tagQtStruct
  • tagRGPT
  • tagRowBuff
  • tagSEG
  • tagSERVERINFO
  • tagSLOT
  • tagSTATMESSAGEMAP
  • tagSTATUSBARLOOKUP
  • tagTOOLDISPLAYDATA
  • tagTrackObject
  • tagUser
  • tagVIEWLIST
  • TempBuffer
  • TEXTBUTTON_STRUCT
  • THEPROVIDERLib::MSOmniProv
  • THREAD_STRUCT
  • ThreadArg_Struct
  • ThreadArgs
  • THREADARGS
  • THREADDATA
  • THREADINFO
  • Title
  • tpc_hdr
  • tphys_connect_info
  • tree
  • TREEINFO
  • treeitem
  • tReq
  • TS_VERSION_INFO
  • tSReq
  • TYPEINFO
  • UDDI::Tools::CategoryTreeNode
  • UDDI::Tools::CategoryTreeView
  • udp_hdr
  • UnionInt64
  • UPNPDimmerDevice
  • UPNPDimmerService
  • UsageStringInfo
  • util::DatabaseSettings
  • Util::HelperFunctions
  • Util::line
  • vcacct::IAccount
    • vcacct::CAccount
  • vcacct::IGetReceipt
    • vcacct::CGetReceipt
  • vcacct::IMoveMoney
    • vcacct::CMoveMoney
  • vcacct::IUpdateReceipt
    • vcacct::CUpdateReceipt
  • VERBMAPPING
  • view
  • viewline
  • VJQuery
  • VTUNION
  • WATCHER_DATA
  • WiaWrap::CComPtrArray< T >
  • WiaWrap::CDataCallback
  • WiaWrap::CEventCallback
  • WiaWrap::CProgressDlg
  • WININFO
  • WRITER_PARAMS
  • WRTHANDLE
  • WsdlDiscovery::frmMain
  • XBStr
  • XInterface< T >
  • XPtr< T >
  • XWindow
Generated on Wed Nov 13 2024 16:55:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Class Members

  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • Variables
  • Typedefs
  • Enumerations
  • Enumerator
  • Properties
  • Related Functions
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • y
  • z
  • ~
Here is a list of all class members with links to the classes they belong to:

- _ -

  • ___WSAFDIsSet() : DTHandler
  • __WSAFDIsSet() : DTHandler
  • _aBagEntry : CHtmlElementBag
  • _accept() : DTHandler
  • _achDisplayPropertyText : CMarkTextService
  • _achDisplayText : CMarkTextService
  • _achText : CSnoopWnd
  • _AddAuthorityInfoAccessExtension() : CCertPolicySample
  • _AddAuthorityKeyId() : CCertPolicySample
  • _AddCertTypeExtension() : CCertPolicySample
  • _AddDefaultBasicConstraintsExtension() : CCertPolicySample
  • _AddDefaultKeyUsageExtension() : CCertPolicySample
  • _AddEnhancedKeyUsageExtension() : CCertPolicySample
  • _AddOldCertTypeExtension() : CCertPolicySample
  • _AddPagesCallback() : CPropSheetHost
  • _AddPagesForObject() : CPropSheetHost
  • _AddRevocationExtension() : CCertPolicySample
  • _AddStringArray() : CCertPolicySample
  • _AddSubjectAltNameExtension() : CCertPolicySample
  • _aHashTable : CSpecialCharHashTable
  • _Alias : CBox
  • _apBlock : CPage
  • _Append()
: msado15::Fields
, msado15::Fields20
  • _aptBlock : CPage
  • _aTempBuffer : CHtmlElement
  • _atomWndClass : CSnoopWnd
  • _awc : CResString
  • _awcName : HtmlPropIFilter
  • _awcReadAheadBuf : CSerialStream
  • _awcTranslatedBuffer : CMemoryMappedInputStream
  • _awszPropSpec : CMetaTag , CScriptTag
  • _bind() : DTHandler
  • _Block : CBox
  • _buf : CMmStreamBuf
  • _Buffer : ISAPI_STRING , ISAPI_STRINGW
  • _bUserAbort : CPrintAux
  • _bxf : CBox
  • _bytesReadFromMMBuffer : CMemoryMappedInputStream
  • _c_DefaultDisplayAttribute : CDisplayAttributeInfo
  • _CanPlaybackSelection() : CTSFEditWnd
  • _CanReconvertSelection() : CTSFEditWnd
  • _canvas : CFontSelect , CBlackPen , CBrush
  • _categories : WsdlDiscovery::frmMain
  • _categories_AfterSelect() : WsdlDiscovery::frmMain
  • _categorizationLabel : WsdlDiscovery::frmMain
  • _categoryValue : UDDI::Tools::CategoryTreeNode
  • _cAttributes : CHtmlIFilter
  • _cb : CMmStreamBuf
  • _cbBuffer : ISAPI_BUFFER
  • _cbData : ISAPI_BUFFER
  • _cBlock : CPage
  • _cbMaxToken : _AUTH_SEQ
  • _cCharsReadAhead : CSerialStream
  • _cchText : CSnoopWnd
  • _cCol : CGridIt , CGrid , CBlockFrame
  • _cDigits : CCodeGrid
  • _Char : CCharBlock
  • _charsReadFromTranslatedBuffer : CMemoryMappedInputStream
  • _cHrefChars : CAnchorTag
  • _cHrefCharsFiltered : CAnchorTag
  • _Cleanup() : CCertEncodeDateArray , CCertEncodeLongArray , CCertEncodeAltName , CCertEncodeStringArray , CCertEncodeBitString , CCertEncodeCRLDistInfo , CCertPolicySample , CRequestInstance , CCertPolicySample
  • _CleanupEditWnd() : CTSFMainWnd
  • _Clear() : CThumbNailPhotoHolder
  • _ClearAdviseSink() : CTSFEditWnd
  • _ClearCompositionDisplayAttributes() : CMarkTextService
  • _ClearRequestedAttributes() : CTSFEditWnd
  • _ClearText() : CTSFEditWnd
  • _closesocket() : DTHandler
  • _cLowResource : CAsynchNotify
  • _clsidMetaInfo : CMetaTag
  • _clsidScriptInfo : CScriptTag
  • _Code : CCharBlock
  • _Cols : CBlockFrame
  • _connect() : DTHandler
  • _connection : Microsoft::Uddi::Demo::Publish , UDDI::Tools::CategoryTreeView
  • _cPropChars : CPropertyTag
  • _cPropCharsFiltered : CPropertyTag
  • _CreateHiddenWindow() : CPropSheetHost
  • _CreatePropertySheet() : CPropSheetHost
  • _CreateSecondaryPropertySheet() : CPropSheetHost
  • _cRef : CAsynchNotify , _CSampleDropExt , CCaseTextService , CEditSessionBase , CLangBarItemButton , CEnumDisplayAttributeInfo , CMarkTextService , CCustomPropertyStore
  • _cRefs : _tagGENERICITEMLIST , CSampleWordBreaker , CSampleStemmer
  • _cRow : CGridIt , CGrid , CBlockFrame
  • _csInit : ISAPI_EXTENSION
  • _cTagCharsRead : CHtmlScanner
  • _cTextChars : CTextElement
  • _ctm : _CSampleDropExt
  • _currFilter : storesh::Storesh
  • _currStoreLocation : storesh::Storesh
  • _currStoreName : storesh::Storesh
  • _cValueChars : CImageTag , CInputTag , CMetaTag
  • _cValueCharsFiltered : CInputTag , CImageTag
  • _cwcMaxToken : CSampleWordBreaker
  • _cwcTranslatedBuffer : CMemoryMappedInputStream
  • _cx : CGridIt
  • _cy : CGridIt
  • _dbgInfo : CException
  • _descriptionLabel : WsdlDiscovery::frmMain
  • _dispatchTable : DTHandler
  • _DisplayPicture() : CThumbNailPhotoHolder
  • _dwFundsAvailable : _FundsRM
  • _dwGlobalCompartmentEventSinkCookie : CMarkTextService
  • _dwIISMajorVersion : ISAPI_REQUEST
  • _dwIISMinorVersion : ISAPI_REQUEST
  • _dwMaxAlloc : ISAPI_BUFFER
  • _dwMaxSyncWriteSize : ISAPI_REQUEST
  • _dwOsMajorVersion : ISAPI_REQUEST
  • _dwState : CCustomPropertyStore
  • _dwTextEditSinkCookie : CCaseTextService , CMarkTextService
  • _dwThreadFocusSinkCookie : CCaseTextService , CMarkTextService
  • _dwThreadMgrEventSinkCookie : CCaseTextService , CMarkTextService
  • _EBufSize : CSampleWordBreaker
  • _EnumerateExtensions() : CCertPolicySample
  • _enumNameType : CCertEncodeAltName
  • _eState : CAnchorTag , CMetaTag , CPropertyTag , CScriptTag
  • _eTokenType : CToken
  • _eTokType : CHtmlElemBagEntry , CPropertyTag
  • _eTokTypeNext : CTextElement
  • _ExpandEnvironmentVariables() : CCertExitSample
  • _extensionLabel : WsdlDiscovery::frmMain
  • _extensionUrl : WsdlDiscovery::frmMain
  • _extensionUrl_TextChanged() : WsdlDiscovery::frmMain
  • _ExtractSecPageInfo() : CPropSheetHost
  • _fC1Mask : CCTypeSet
  • _fC2Test : CCTypeSet
  • _fC3Mask : CCTypeSet
  • _fCleaningUp : CMarkTextService
  • _fClientIsConnected : ISAPI_REQUEST
  • _fDel : CFont
  • _fFilterContent : CHtmlIFilter
  • _fFilterMetaTag : CHtmlIFilter
  • _fFilterScriptTag : CHtmlIFilter
  • _fFirstHitInitDone : ISAPI_EXTENSION
  • _fFlipKeys : CCaseTextService
  • _fHaveCredHandle : _AUTH_SEQ
  • _fHaveCtxtHandle : _AUTH_SEQ
  • _fInitialized : ISAPI_EXTENSION
  • _fMetaProperty : HtmlPropIFilter
  • _fNeedDoneWithSession : ISAPI_REQUEST
  • _fNewConversation : _AUTH_SEQ
  • _fNoMoreText : CTextElement
  • _fNonHtmlFile : CHtmlIFilter
  • _font : CTextField , CTextGrid
  • _fontAlias : CBoxFormat
  • _fontBlock : CBox
  • _fontChar : CBlockFormat
  • _fontCode : CBlockFormat
  • _fontCtype : CBoxFormat
  • _fontHeader : CFrameFormat , CBlockFrame
  • _fontLabel : CFrameFormat
  • _fontPageNum : CPageFormat
  • _fPageMode : CModel
  • _fPageUsed : CFontRange
  • _fr : CModel
  • _FreeStringArray() : CCertPolicySample
  • _fShowSnoop : CCaseTextService
  • _fStartToken : CToken
  • _fuFormat : CBox , CBlockFormat , CPageFormat
  • _funAbout : CController
  • _fUnGotChar : CMemoryMappedInputStream , CSerialStream
  • _funProp : CController
  • _fUUEncodeData : _AUTH_SEQ
  • _fWrite : CMmStream
  • _gaDisplayAttribute : CMarkTextService
  • _GetClientId() : CCaseTextService
  • _GetComposing() : CTSFEditWnd
  • _GetComposition() : CMarkTextService
  • _GetCurrentSelection() : CTSFEditWnd
  • _GetDisplayAttributes() : CTSFEditWnd
  • _GetDSDispSpecOption() : CPropSheetHost
  • _GetDSObjectNames() : CPropSheetHost
  • _GetDSPropSheetConfig() : CPropSheetHost
  • _GetFileName() : CTSFMainWnd
  • _gethostbyaddr() : DTHandler
  • _gethostbyname() : DTHandler
  • _gethostname() : DTHandler
  • _GetIssuer() : CCertPolicySample
  • _getpeername() : DTHandler
  • _getprotobyname() : DTHandler
  • _getprotobynumber() : DTHandler
  • _GetReadingText() : CTSFEditWnd
  • _getservbyname() : DTHandler
  • _getservbyport() : DTHandler
  • _getsockname() : DTHandler
  • _getsockopt() : DTHandler
  • _GetText() : CTSFEditWnd
  • _GetTextOwner() : CTSFEditWnd
  • _GetThis() : CSnoopWnd
  • _GetThreadMgr() : CCaseTextService
  • _GetWindow() : CTSFEditWnd
  • _groupBox1 : WsdlDiscovery::frmMain
  • _groupBox2 : WsdlDiscovery::frmMain
  • _groupBox3 : WsdlDiscovery::frmMain
  • _guidPropset : CToken
  • _guidPropSet : CFullPropSpec
  • _h : XWindow
  • _HandleArrowKey() : CMarkTextService
  • _HandleKeyDown() : CMarkTextService
  • _HandleReturn() : CMarkTextService
  • _hasDownloadedChildren : UDDI::Tools::CategoryTreeNode
  • _hBrush : CBrush
  • _hBrushOld : CBrush
  • _hcred : _AUTH_SEQ
  • _hctxt : _AUTH_SEQ
  • _hdc : CCanvas , CPrintRequest
  • _hDevNames : CPrintRequest
  • _hDlgPrint : CPrintAux
  • _HeaderBuffer : ISAPI_REQUEST
  • _hEvent : CAsynchNotify
  • _hFile : CMmStream
  • _hfont : CFont
  • _hfontOld : CFontSelect
  • _HiddenWindowProc() : CPropSheetHost
  • _Hide() : CSnoopWnd
  • _hImpersonationToken : ISAPI_REQUEST
  • _hInst : CController , CPage , CModel
  • _hKey : CRegAccess
  • _hkeyProgID : _CSampleDropExt
  • _hMap : CMmStream
  • _hPen : CBlackPen
  • _hPenOld : CBlackPen
  • _hRM : _FundsRM
  • _htmlElementBag : CHtmlIFilter
  • _htmlIFilter : CHtmlElement , CHtmlScanner
  • _htonl() : DTHandler
  • _htons() : DTHandler
  • _hwnd : CWindow , CScreenCanvas , CPaintCanvas , CPrintRequest
  • _hWnd : CSnoopWnd
  • _hWorkerWnd : CMarkTextService
  • _iChar : CBox
  • _iCol : CGridIt
  • _idChunk : CTextElement
  • _iEltOffset : CTextGrid
  • _iIndex : CEnumDisplayAttributeInfo
  • _inet_addr() : DTHandler
  • _inet_ntoa() : DTHandler
  • _Init() : CSnoopWnd
  • _InitAuthorityInfoAccessExtension() : CCertPolicySample
  • _InitClass() : CSnoopWnd
  • _InitCleanupContextDurationSink() : CMarkTextService
  • _InitCleanupContextSink() : CMarkTextService
  • _InitContextCompartment() : CMarkTextService
  • _InitDisableExtensionList() : CCertPolicySample
  • _InitDisplayAttributeGuidAtom() : CMarkTextService
  • _InitFunctionProvider() : CTSFEditWnd
  • _InitGlobalCompartment() : CMarkTextService
  • _Initialize() : CTSFEditWnd
  • _InitKeystrokeSink() : CCaseTextService , CMarkTextService
  • _InitLanguageBar() : CCaseTextService , CMarkTextService
  • _InitPreservedKey() : CCaseTextService
  • _InitRequestExtensionList() : CCertPolicySample
  • _InitRevocationExtension() : CCertPolicySample
  • _InitSnoopWnd() : CCaseTextService
  • _InitSubjectAltNameExtension() : CCertPolicySample
  • _InitTextEditSink() : CCaseTextService , CMarkTextService
  • _InitThreadMgrSink() : CCaseTextService , CMarkTextService
  • _InitWorkerWnd() : CMarkTextService
  • _InlineData : ISAPI_BUFFER
  • _inquireLabel : WsdlDiscovery::frmMain
  • _inquireUrl : WsdlDiscovery::frmMain
  • _inquireUrl_TextChanged() : WsdlDiscovery::frmMain
  • _InternalLockDocument() : CTSFEditWnd
  • _InternalUnlockDocument() : CTSFEditWnd
  • _ioctlsocket() : DTHandler
  • _iPage : CCTypeSet , CModel
  • _iRow : CGridIt
  • _iScale : CView
  • _IsComposing() : CMarkTextService
  • _IsKeyFlipping() : CCaseTextService
  • _IsLocked() : CTSFEditWnd
  • _IsSnoopWndVisible() : CCaseTextService
  • _iStyle : CLineGrid
  • _lError : CException
  • _libName : APIHook< T >
  • _Line : CCharBlock
  • _liOffset : CMmStreamConsecBuf
  • _List : ASYNC_REQUESTER
  • _listen() : DTHandler
  • _Load() : CTSFEditWnd
  • _LoadFromFile() : CTSFEditWnd
  • _loadSchemes : WsdlDiscovery::frmMain
  • _loadSchemes_Click() : WsdlDiscovery::frmMain
  • _locale : CHtmlIFilter
  • _LockDocument() : CTSFEditWnd
  • _lRefs : HtmlPropIFilter , HtmlPropIFilterCF , CLanguageResourceSampleCF
  • _macPage : CModel
  • _MapDistPoint() : CCertEncodeCRLDistInfo
  • _MapName() : CCertEncodeAltName , CCertEncodeCRLDistInfo
  • _Menu_FlipDoc() : CCaseTextService
  • _Menu_FlipKeys() : CCaseTextService
  • _Menu_FlipSel() : CCaseTextService
  • _Menu_HelloWord() : CCaseTextService
  • _Menu_OnComposition() : CMarkTextService
  • _Menu_OnSetCaseProperty() : CMarkTextService
  • _Menu_OnSetCustomProperty() : CMarkTextService
  • _Menu_OnSetGlobalCompartment() : CMarkTextService
  • _Menu_OnViewCaseProperty() : CMarkTextService
  • _Menu_OnViewCustomProperty() : CMarkTextService
  • _Menu_ShowSnoopWnd() : CCaseTextService
  • _mmInputStream : CSerialStream
  • _mmStream : CMemoryMappedInputStream
  • _mmStreamBuf : CMemoryMappedInputStream
  • _NameType() : CCertEncodeAltName
  • _NewEnum()
: msado15::_Collection
, msado15::_DynaCollection
, msado15::Errors
, msado15::Fields
, msado15::Fields15
, msado15::Fields20
, msado15::Parameters
, msado15::Properties
, CDynamic
, CEntity
, CResultset
  • _nFromPage : CPrintRequest
  • _nHScrollPos : CScrollableView
  • _NotifyCRLIssued() : CCertExitSample
  • _NotifyNewCert() : CCertExitSample
  • _NSPAddressToString() : DTHandler
  • _NSPCleanup() : DTHandler
  • _NSPGetAddressByName() : DTHandler
  • _NSPGetServiceClassInfo() : DTHandler
  • _NSPGetServiceClassNameByClassId() : DTHandler
  • _NSPInstallServiceClass() : DTHandler
  • _NSPLookupServiceBegin() : DTHandler
  • _NSPLookupServiceEnd() : DTHandler
  • _NSPLookupServiceNext() : DTHandler
  • _NSPRemoveServiceClass() : DTHandler
  • _NSPSetService() : DTHandler
  • _NSPStringToAddress() : DTHandler
  • _ntohl() : DTHandler
  • _ntohs() : DTHandler
  • _nToPage : CPrintRequest
  • _nVScrollPos : CScrollableView
  • _nWeight : CLineGrid
  • _oCurrStore : storesh::Storesh
  • _okToReloadSchemes : WsdlDiscovery::frmMain
  • _OmniProvBaseClass : CMSOmniProvRowset
  • _OnActivate() : CTSFMainWnd
  • _OnCommand() : CTSFEditWnd , CTSFMainWnd
  • _OnCreate() : CTSFEditWnd , CTSFMainWnd
  • _OnDestroy() : CTSFEditWnd , CTSFMainWnd
  • _OnEditChange() : CTSFEditWnd
  • _OnEditKillFocus() : CTSFEditWnd
  • _OnEditSetFocus() : CTSFEditWnd
  • _OnGetPreservedKey() : CTSFEditWnd
  • _OnInitMenuPopup() : CTSFEditWnd , CTSFMainWnd
  • _OnKillFocus() : CTSFEditWnd , CTSFMainWnd
  • _OnNotify() : CTSFEditWnd , CTSFMainWnd
  • _OnPaint() : CSnoopWnd
  • _OnSetFocus() : CTSFMainWnd , CTSFEditWnd
  • _OnSize() : CTSFEditWnd , CTSFMainWnd
  • _OnTest() : CTSFEditWnd
  • _OnUpdate() : CTSFEditWnd
  • _p : XInterface< T > , XPtr< T > , XBStr
  • _PageHeadL : CPage
  • _PageHeadR : CPage
  • _PageNums : CPage
  • _paint : CPaintCanvas
  • _pAttributes : CHtmlIFilter
  • _pBox : CController
  • _pCase : CLangBarItemButton , CSnoopWnd
  • _pCharInSet : CCTypeSet
  • _pCharUsed : CTextGrid
  • _pComposition : CMarkTextService
  • _pContext : CEditSessionBase
  • _pCurChar : CSerialStream
  • _pData : ISAPI_BUFFER
  • _pdtobj : _CSampleDropExt
  • _pEcb : ISAPI_REQUEST
  • _pf : CPage , CModel
  • _pfnCreateInstance : CClassFactory
  • _pfnInit : ISAPI_EXTENSION
  • _pHashEntryNext : CSpecialCharHashEntry
  • _pHtmlElement : CHtmlElemBagEntry , CHtmlIFilter
  • _pHtmlFilter : HtmlPropIFilter
  • _pLangBarItem : CCaseTextService , CMarkTextService
  • _pLangBarItemSink : CLangBarItemButton
  • _Playback() : CTSFEditWnd
  • _pMark : CPropertyEditSession , CCompositionEditSession , CTerminateCompositionEditSession , CKeystrokeEditSession , CLangBarItemButton
  • _pMmStream : CMmStreamConsecBuf
  • _pModel : CController , CPrintRequest
  • _pPage : CModel
  • _pPageInSet : CCTypeSet
  • _pPersistFile : HtmlPropIFilter
  • _pRange : CUpdateTextEditSession
  • _preAPI : APIHook< T >
  • _propid : CToken
  • _propSpec : CPropertyTag
  • _providerLabel : WsdlDiscovery::frmMain
  • _providerName : WsdlDiscovery::frmMain
  • _providerName_TextChanged() : WsdlDiscovery::frmMain
  • _pRows : CBlockFrame
  • _pSnoopWnd : CUpdateTextEditSession , CCaseTextService
  • _psProperty : CFullPropSpec
  • _pStream : SMmStream , CMmStreamBuf
  • _pt : CGridIt , CPageFormat
  • _ptClient : CView
  • _pTextEditSinkContext : CMarkTextService , CCaseTextService
  • _pThreadMgr : CCaseTextService , CMarkTextService
  • _ptOrg : CTextGrid , CView
  • _ptPE : CPageFormat
  • _ptScroll : CView
  • _pView : CPrintRequest , CController
  • _pwcHrefBuf : CAnchorTag
  • _pwcPropBuf : CPropertyTag
  • _pwcTagBuf : CHtmlScanner
  • _pwcValueBuf : CImageTag , CInputTag , CMetaTag
  • _pwszFileName : CHtmlIFilter
  • _rclsid : CClassFactory
  • _ReadRegistryString() : CCertPolicySample
  • _ReadRegistryStringArray() : CCertPolicySample
  • _Reconvert() : CTSFEditWnd
  • _recv() : DTHandler
  • _recvfrom() : DTHandler
  • _RequestPropertyEditSession() : CMarkTextService
  • _ResponseBuffer : ISAPI_REQUEST
  • _results : WsdlDiscovery::frmMain
  • _resultsLabel : WsdlDiscovery::frmMain
  • _rValue : APIHook< T >
  • _Save() : CTSFEditWnd
  • _SaveToFile() : CTSFEditWnd
  • _scanner : CHtmlElement
  • _SD : _FundsRM
  • _searchCategorization : WsdlDiscovery::frmMain
  • _searchCategorization_Click() : WsdlDiscovery::frmMain
  • _searchProvider : WsdlDiscovery::frmMain
  • _searchProvider_Click() : WsdlDiscovery::frmMain
  • _searchService : WsdlDiscovery::frmMain
  • _searchService_Click() : WsdlDiscovery::frmMain
  • _select() : DTHandler
  • _send() : DTHandler
  • _sendto() : DTHandler
  • _serialStream : CHtmlElement , CHtmlScanner , CHtmlIFilter
  • _serviceLabel : WsdlDiscovery::frmMain
  • _serviceName : WsdlDiscovery::frmMain
  • _serviceName_TextChanged() : WsdlDiscovery::frmMain
  • _SetCaseProperty() : CMarkTextService
  • _SetComposition() : CMarkTextService
  • _SetCompositionDisplayAttributes() : CMarkTextService
  • _SetCustomProperty() : CMarkTextService
  • _SetErrorInfo() : CCertEncodeLongArray , CCertEncodeCRLDistInfo , CCertEncodeAltName , CCertEncodeDateArray , CCertEncodeBitString , CCertEncodeStringArray
  • _SetFlagsProperty() : CRequestInstance
  • _SetPictureControl() : CThumbNailPhotoHolder
  • _setsockopt() : DTHandler
  • _SetState() : CCustomPropertyStore
  • _SetSystemStringProp() : CCertPolicySample
  • _SetText() : CTSFDataObject
  • _SetThis() : CSnoopWnd
  • _SetValidityPeriod() : CCertPolicySample
  • _Show() : CSnoopWnd
  • _shutdown() : DTHandler
  • _size : CBlockFrame , CGridIt , CGrid , CView , CBlockFormat
  • _sizeBox : CBox
  • _sizeHigh : CMmStream
  • _sizeLow : CMmStream
  • _socket() : DTHandler
  • _specialCharHash : CSerialStream
  • _status : CPrintRequest
  • _StatusBuffer : ISAPI_REQUEST
  • _strModuleName : ISAPI_EXTENSION
  • _strModulePath : ISAPI_EXTENSION
  • _sxi : _CSampleDropExt
  • _sz : CTextField
  • _szAlloc : CQuickStringWrap
  • _szFormat : CCodeGrid
  • _szHeader : CBlockFrame
  • _szTargetFolder : _CSampleDropExt
  • _TemplateNamesMatch() : CRequestInstance
  • _TerminateAllCompositions() : CTSFEditWnd
  • _TerminateComposition() : CMarkTextService
  • _TerminateCompositionInContext() : CMarkTextService
  • _TestInsert() : CTSFEditWnd
  • _tfClientId : CMarkTextService , CCaseTextService
  • _tfLangBarItemInfo : CLangBarItemButton
  • _uCurSize : CHtmlElementBag
  • _ulCallback : CPropertyEditSession
  • _ulChunkID : CHtmlIFilter
  • _ulCodePage : CMemoryMappedInputStream
  • _uLenHrefBuf : CAnchorTag
  • _uLenPropBuf : CPropertyTag
  • _uLenTagBuf : CHtmlScanner
  • _ulIdContentChunk : CPropertyTag
  • _uMaxSize : CHtmlElementBag
  • _Uninit() : CSnoopWnd
  • _UninitClass() : CSnoopWnd
  • _UninitCleanupContextDurationSink() : CMarkTextService
  • _UninitCleanupContextSink() : CMarkTextService
  • _UninitCompartment() : CMarkTextService
  • _UninitFunctionProvider() : CTSFEditWnd
  • _UninitGlobalCompartment() : CMarkTextService
  • _Uninitialize() : CTSFEditWnd
  • _UninitKeystrokeSink() : CCaseTextService , CMarkTextService
  • _UninitLanguageBar() : CCaseTextService , CMarkTextService
  • _UninitPreservedKey() : CCaseTextService
  • _UninitSnoopWnd() : CCaseTextService
  • _UninitThreadMgrSink() : CMarkTextService , CCaseTextService
  • _UninitWorkerWnd() : CMarkTextService
  • _UnlockDocument() : CTSFEditWnd
  • _UpdateStatusBar() : CTSFEditWnd
  • _UpdateText() : CSnoopWnd
  • _uRefs : CHtmlIFilterCF , CHtmlIFilterBase
  • _VerifyName() : CCertEncodeAltName
  • _VerifyNames() : CCertEncodeCRLDistInfo
  • _ViewCaseProperty() : CMarkTextService
  • _ViewCustomProperty() : CMarkTextService
  • _wch : CSpecialCharHashEntry , CMemoryMappedInputStream , CSerialStream
  • _wcsPath : CRegAccess
  • _wcsPathBuf : CRegAccess
  • _WndProc() : CTSFEditWnd , CSnoopWnd , CTSFMainWnd
  • _WorkerWndProc() : CMarkTextService
  • _wParam : CKeystrokeEditSession
  • _WPUCloseEvent() : DTHandler
  • _WPUCloseSocketHandle() : DTHandler
  • _WPUCreateEvent() : DTHandler
  • _WPUCreateSocketHandle() : DTHandler
  • _WPUFDIsSet() : DTHandler
  • _WPUGetProviderPath() : DTHandler
  • _WPUModifyIFSHandle() : DTHandler
  • _WPUPostMessage() : DTHandler
  • _WPUQueryBlockingCallback() : DTHandler
  • _WPUQuerySocketHandleContext() : DTHandler
  • _WPUQueueApc() : DTHandler
  • _WPUResetEvent() : DTHandler
  • _WPUSetEvent() : DTHandler
  • _WriteCertToFile() : CCertExitSample
  • _WriteHelper() : CThumbNailPhotoHolder
  • _WSAAccept() : DTHandler
  • _WSAAddressToStringA() : DTHandler
  • _WSAAddressToStringW() : DTHandler
  • _WSAAsyncGetHostByAddr() : DTHandler
  • _WSAAsyncGetHostByName() : DTHandler
  • _WSAAsyncGetProtoByName() : DTHandler
  • _WSAAsyncGetProtoByNumber() : DTHandler
  • _WSAAsyncGetServByName() : DTHandler
  • _WSAAsyncGetServByPort() : DTHandler
  • _WSAAsyncSelect() : DTHandler
  • _WSACancelAsyncRequest() : DTHandler
  • _WSACancelBlockingCall() : DTHandler
  • _WSACleanup() : DTHandler
  • _WSACloseEvent() : DTHandler
  • _WSAConnect() : DTHandler
  • _WSACreateEvent() : DTHandler
  • _WSADuplicateSocketA() : DTHandler
  • _WSADuplicateSocketW() : DTHandler
  • _WSAEnumNameSpaceProvidersA() : DTHandler
  • _WSAEnumNameSpaceProvidersW() : DTHandler
  • _WSAEnumNetworkEvents() : DTHandler
  • _WSAEnumProtocolsA() : DTHandler
  • _WSAEnumProtocolsW() : DTHandler
  • _WSAEventSelect() : DTHandler
  • _WSAGetLastError() : DTHandler
  • _WSAGetOverlappedResult() : DTHandler
  • _WSAGetQOSByName() : DTHandler
  • _WSAGetServiceClassInfoA() : DTHandler
  • _WSAGetServiceClassInfoW() : DTHandler
  • _WSAGetServiceClassNameByClassIdA() : DTHandler
  • _WSAGetServiceClassNameByClassIdW() : DTHandler
  • _WSAHtonl() : DTHandler
  • _WSAHtons() : DTHandler
  • _WSAInstallServiceClassA() : DTHandler
  • _WSAInstallServiceClassW() : DTHandler
  • _WSAIoctl() : DTHandler
  • _WSAIsBlocking() : DTHandler
  • _WSAJoinLeaf() : DTHandler
  • _WSALookupServiceBeginA() : DTHandler
  • _WSALookupServiceBeginW() : DTHandler
  • _WSALookupServiceEnd() : DTHandler
  • _WSALookupServiceNextA() : DTHandler
  • _WSALookupServiceNextW() : DTHandler
  • _WSANtohl() : DTHandler
  • _WSANtohs() : DTHandler
  • _WSARecv() : DTHandler
  • _WSARecvDisconnect() : DTHandler
  • _WSARecvFrom() : DTHandler
  • _WSARemoveServiceClass() : DTHandler
  • _WSAResetEvent() : DTHandler
  • _WSASend() : DTHandler
  • _WSASendDisconnect() : DTHandler
  • _WSASendTo() : DTHandler
  • _WSASetBlockingHook() : DTHandler
  • _WSASetEvent() : DTHandler
  • _WSASetLastError() : DTHandler
  • _WSASetServiceA() : DTHandler
  • _WSASetServiceW() : DTHandler
  • _WSASocketA() : DTHandler
  • _WSASocketW() : DTHandler
  • _WSAStartup() : DTHandler
  • _WSAStringToAddressA() : DTHandler
  • _WSAStringToAddressW() : DTHandler
  • _WSAUnhookBlockingHook() : DTHandler
  • _WSAWaitForMultipleEvents() : DTHandler
  • _WSCDeinstallProvider() : DTHandler
  • _WSCEnableNSProvider() : DTHandler
  • _WSCEnumProtocols() : DTHandler
  • _WSCGetProviderPath() : DTHandler
  • _WSCInstallNameSpace() : DTHandler
  • _WSCInstallProvider() : DTHandler
  • _WSCUnInstallNameSpace() : DTHandler
  • _WSPAccept() : DTHandler
  • _WSPAddressToString() : DTHandler
  • _WSPAsyncSelect() : DTHandler
  • _WSPBind() : DTHandler
  • _WSPCancelBlockingCall() : DTHandler
  • _WSPCleanup() : DTHandler
  • _WSPCloseSocket() : DTHandler
  • _WSPConnect() : DTHandler
  • _WSPDuplicateSocket() : DTHandler
  • _WSPEnumNetworkEvents() : DTHandler
  • _WSPEventSelect() : DTHandler
  • _WSPGetOverlappedResult() : DTHandler
  • _WSPGetPeerName() : DTHandler
  • _WSPGetQOSByName() : DTHandler
  • _WSPGetSockName() : DTHandler
  • _WSPGetSockOpt() : DTHandler
  • _WSPIoctl() : DTHandler
  • _WSPJoinLeaf() : DTHandler
  • _WSPListen() : DTHandler
  • _WSPRecv() : DTHandler
  • _WSPRecvDisconnect() : DTHandler
  • _WSPRecvFrom() : DTHandler
  • _WSPSelect() : DTHandler
  • _WSPSend() : DTHandler
  • _WSPSendDisconnect() : DTHandler
  • _WSPSendTo() : DTHandler
  • _WSPSetSockOpt() : DTHandler
  • _WSPShutdown() : DTHandler
  • _WSPSocket() : DTHandler
  • _WSPStartup() : DTHandler
  • _WSPStringToAddress() : DTHandler
  • _wszName : CSpecialCharHashEntry
  • _xClone()
: msado15::Recordset21
, msado15::Recordset
, msado15::Recordset15
, msado15::Recordset20
, msado15::_Recordset
  • _xResync()
: msado15::_Recordset
, msado15::Recordset21
, msado15::Recordset20
, msado15::Recordset
, msado15::Recordset15
  • _xSave()
: msado15::_Recordset
, msado15::Recordset21
, msado15::Recordset
, msado15::Recordset20
Generated on Wed Nov 13 2024 16:55:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Namespace Index

  • Namespace List
  • Namespace Members

Namespace List

Here is a list of all namespaces with brief descriptions:
ACCOUNT
ADSERRORLib
ADSFIRSTEXTLib
Async_Lib
ATLCONTROLLib
AUTHENTICATEPLUGINLib
AutoClaims
BANKVCLib
BitmapUtil
BROCHUREMACHINELib
CacheProxySamplePlugin
CallbackIUnknownLib
cascadeec
CERTEXITSAMPLELib
CERTPOLICYSAMPLELib
CLUADMEXLib
comadmin
COMSPYAUDITLib
COMSPYCTLLib
CONTEXTPLUGINLib
CONTEXTSAMPLEPROPPAGELib
CSharp_Draw
DBAUTHPLUGINLib
EDANNOTATORLib
EDCOMMANDSLib
EDGLYPHSLib
EDHOSTLib
fullsvr
helper
InkBlog
InkClipboard
InkCollection
InkErase
InkHitTest
InkRecognition
MGDRESOURCELib
Microsoft
Microsoft::Samples
Microsoft::Samples::Ink
Microsoft::Samples::Ink::Cs
Microsoft::Samples::Ink::CS
Microsoft::Samples::Ink::CS::InkDividerSample
Microsoft::Samples::Ink::Cs::InkZoom
Microsoft::Uddi
Microsoft::Uddi::Demo
msado15
MSDFHDL
MSDFMAPLib
MYDEVICELib
MyStorageResourceLib
newseventclass
PaperForm
persistatl
PLGTRMSMPLib
PROXYPLUGINLib
qcnotify
qcorder
qcship
RealTimeStylusPluginApp
RealTimeStylusPlugins
RENDERLib
Sample
Sample::UI
SDKDimmerServiceLib
SDKSAMPLEPLAYLISTPLUGINLib
SDKSAMPLESTORAGEPLUGINLib
Serialization
storesh
THEPROVIDERLib
UDDI
UDDI::Tools
Util
util
vcacct
WiaWrap
WsdlDiscovery
Generated on Wed Nov 13 2024 16:58:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ACCOUNT Namespace Reference

  • Namespace List
  • Namespace Members
Classes | Functions

ACCOUNT Namespace Reference

Classes

class CAccount

Functions

importlib ("stdole2.tlb")

Function Documentation

ACCOUNT::importlib ( "stdole2.tlb" )
Generated on Wed Nov 13 2024 16:58:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ADSERRORLib Namespace Reference

  • Namespace List
  • Namespace Members
Classes | Functions

ADSERRORLib Namespace Reference

Classes

class ADsError

Functions

importlib ("stdole32.tlb")
importlib ("stdole2.tlb")

Function Documentation

ADSERRORLib::importlib ( "stdole32.tlb" )
ADSERRORLib::importlib ( "stdole2.tlb" )
Generated on Wed Nov 13 2024 16:58:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ADSFIRSTEXTLib Namespace Reference

  • Namespace List
  • Namespace Members
Classes | Functions

ADSFIRSTEXTLib Namespace Reference

Classes

class HelloWorld

Functions

importlib ("stdole32.tlb")
importlib ("stdole2.tlb")

Function Documentation

ADSFIRSTEXTLib::importlib ( "stdole32.tlb" )
ADSFIRSTEXTLib::importlib ( "stdole2.tlb" )
Generated on Wed Nov 13 2024 16:58:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Async_Lib Namespace Reference

  • Namespace List
  • Namespace Members
Classes | Functions

Async_Lib Namespace Reference

Classes

class AsyncTest

Functions

importlib ("stdole2.tlb")

Function Documentation

Async_Lib::importlib ( "stdole2.tlb" )
Generated on Wed Nov 13 2024 16:58:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: ATLCONTROLLib Namespace Reference

  • Namespace List
  • Namespace Members
Classes | Functions

ATLCONTROLLib Namespace Reference

Classes

class MMCControl

Functions

importlib ("stdole32.tlb")
importlib ("stdole2.tlb")

Function Documentation

ATLCONTROLLib::importlib ( "stdole32.tlb" )
ATLCONTROLLib::importlib ( "stdole2.tlb" )
Generated on Wed Nov 13 2024 16:58:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: AUTHENTICATEPLUGINLib Namespace Reference

  • Namespace List
  • Namespace Members
Classes | Functions

AUTHENTICATEPLUGINLib Namespace Reference

Classes

class | AuthenticateAdmin
class | AuthenticateContext
class | AuthenticatePlugin

Functions

importlib ("stdole32.tlb")
importlib ("stdole2.tlb")

Function Documentation

AUTHENTICATEPLUGINLib::importlib ( "stdole32.tlb" )
AUTHENTICATEPLUGINLib::importlib ( "stdole2.tlb" )
Generated on Wed Nov 13 2024 16:58:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: AutoClaims Namespace Reference

  • Namespace List
  • Namespace Members
Classes

AutoClaims Namespace Reference

Classes

class | AutoClaims
The AutoClaims Sample Application form class. More...
struct | InkLayer
InkLayer represents a given ink layer, which has a color and visibility setting associated with it. More...
Generated on Wed Nov 13 2024 16:58:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: BANKVCLib Namespace Reference

  • Namespace List
  • Namespace Members
Classes | Functions

BANKVCLib Namespace Reference

Classes

class | Account
class | CreateTable
class | MoveMoney

Functions

importlib ("stdole32.tlb")
importlib ("stdole2.tlb")

Function Documentation

BANKVCLib::importlib ( "stdole32.tlb" )
BANKVCLib::importlib ( "stdole2.tlb" )
Generated on Wed Nov 13 2024 16:58:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: BitmapUtil Namespace Reference

  • Namespace List
  • Namespace Members
Functions

BitmapUtil Namespace Reference

Functions

BOOL | FillBitmapFileHeader (LPCVOID pDib, PBITMAPFILEHEADER pbmfh)
BOOL | FixBitmapHeight (PVOID pDib, ULONG nSize, BOOL bTopDown)
BOOL | GetBitmapDimensions (LPCVOID pDib, UINT *pWidth, UINT *pHeight)
ULONG | GetBitmapHeaderSize (LPCVOID pDib)
ULONG | GetBitmapLineWidthInBytes (ULONG nWidthInPixels, ULONG nBitCount)
ULONG | GetBitmapOffsetBits (LPCVOID pDib)
ULONG | GetBitmapSize (LPCVOID pDib)

Function Documentation

BOOL BitmapUtil::FillBitmapFileHeader | ( | LPCVOID | pDib,
 |  | PBITMAPFILEHEADER | pbmfh
 | ) |  |
BOOL BitmapUtil::FixBitmapHeight | ( | PVOID | pDib,
 |  | ULONG | nSize,
 |  | BOOL | bTopDown
 | ) |  |
BOOL BitmapUtil::GetBitmapDimensions | ( | LPCVOID | pDib,
 |  | UINT * | pWidth,
 |  | UINT * | pHeight
 | ) |  |
ULONG BitmapUtil::GetBitmapHeaderSize ( LPCVOID pDib )
ULONG BitmapUtil::GetBitmapLineWidthInBytes | ( | ULONG | nWidthInPixels,
 |  | ULONG | nBitCount
 | ) |  |
ULONG BitmapUtil::GetBitmapOffsetBits ( LPCVOID pDib )
ULONG BitmapUtil::GetBitmapSize ( LPCVOID pDib )
Generated on Wed Nov 13 2024 16:58:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: BROCHUREMACHINELib Namespace Reference

  • Namespace List
  • Namespace Members
Classes | Functions

BROCHUREMACHINELib Namespace Reference

Classes

class PTLauncher

Functions

importlib ("stdole32.tlb")
importlib ("stdole2.tlb")

Function Documentation

BROCHUREMACHINELib::importlib ( "stdole32.tlb" )
BROCHUREMACHINELib::importlib ( "stdole2.tlb" )
Generated on Wed Nov 13 2024 16:58:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CacheProxySamplePlugin Namespace Reference

  • Namespace List
  • Namespace Members
Classes

CacheProxySamplePlugin Namespace Reference

Classes

class | CacheProxyPlugin
Summary description for Class1. More...
class | ContentInfo
class | INSSBufferImpl
class | IWMSCacheItemCollectionImpl
class | IWMSCacheItemDescriptorImpl
class | PlaylistItem
Generated on Wed Nov 13 2024 16:58:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CallbackIUnknownLib Namespace Reference

  • Namespace List
  • Namespace Members
Classes | Functions

CallbackIUnknownLib Namespace Reference

Classes

interface | DeviceFinderCallBackInterface
interface | ServiceCallBackInterface

Functions

importlib ("stdole2.tlb")

Function Documentation

CallbackIUnknownLib::importlib ( "stdole2.tlb" )
Generated on Wed Nov 13 2024 16:58:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: cascadeec Namespace Reference

  • Namespace List
  • Namespace Members
Classes

cascadeec Namespace Reference

Classes

class | CascadeEC
.register(clsid=8CE4A9E0-0FC1-11D3-925A-0080C7C30D72, typelib=7508F170-0FC1-11D3-925A-0080C7C30D72, version="1.0", description="Cascade Class") More...
interface | INewsEvent
.interface(iid=4BF5E480-A5D3-11D2-AD4D-0080C7BFF6DB, thread=AUTO, type=DUAL) More...
interface | INewsEventDefault
.interface(iid=00020400-0000-0000-C000-000000000046, thread=AUTO, type=DUAL) More...
Generated on Wed Nov 13 2024 16:58:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CERTEXITSAMPLELib Namespace Reference

  • Namespace List
  • Namespace Members
Classes | Functions

CERTEXITSAMPLELib Namespace Reference

Classes

class | CCertExitSample
class | CCertManageExitModuleSample

Functions

importlib ("stdole2.tlb")

Function Documentation

CERTEXITSAMPLELib::importlib ( "stdole2.tlb" )
Generated on Wed Nov 13 2024 16:58:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CERTPOLICYSAMPLELib Namespace Reference

  • Namespace List
  • Namespace Members
Classes | Functions

CERTPOLICYSAMPLELib Namespace Reference

Classes

class | CCertManagePolicyModuleSample
class | CCertPolicySample

Functions

importlib ("stdole2.tlb")

Function Documentation

CERTPOLICYSAMPLELib::importlib ( "stdole2.tlb" )
Generated on Wed Nov 13 2024 16:58:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CLUADMEXLib Namespace Reference

  • Namespace List
  • Namespace Members
Classes | Functions

CLUADMEXLib Namespace Reference

Classes

class | CoClipBookServerEx
class | CoFileShareSampleEx

Functions

importlib ("stdole2.tlb")

Function Documentation

CLUADMEXLib::importlib ( "stdole2.tlb" )
Generated on Wed Nov 13 2024 16:58:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: comadmin Namespace Reference

  • Namespace List
  • Namespace Members
Classes

comadmin Namespace Reference

Classes

interface | COMAdminAccessChecksLevelOptions
interface | COMAdminActivationOptions
interface | COMAdminApplicationExportOptions
interface | COMAdminApplicationInstallOptions
interface | COMAdminAuthenticationCapabilitiesOptions
interface | COMAdminAuthenticationLevelOptions
class | COMAdminCatalog
.class(classid=F618C514-DFB8-11D1-A2CF-00805FC79235,DynamicCasts) .interface(iid=DD662187-DFC2-11D1-A2CF-00805FC79235, thread=AUTO, type=DUAL) More...
class | COMAdminCatalogCollection
.class(classid=F618C516-DFB8-11D1-A2CF-00805FC79235,DynamicCasts) .interface(iid=6EB22872-8A19-11D0-81B6-00A0C9231C29, thread=AUTO, type=DUAL) More...
class | COMAdminCatalogObject
.class(classid=F618C515-DFB8-11D1-A2CF-00805FC79235,DynamicCasts) .interface(iid=6EB22871-8A19-11D0-81B6-00A0C9231C29, thread=AUTO, type=DUAL) More...
interface | COMAdminComponentFlags
interface | COMAdminErrorCodes
interface | COMAdminFileFlags
interface | COMAdminImpersonationLevelOptions
interface | COMAdminOS
interface | COMAdminServiceOptions
interface | COMAdminServiceStatusOptions
interface | COMAdminSynchronizationOptions
interface | COMAdminThreadingModels
interface | COMAdminTransactionOptions
interface | ICatalogCollection
.interface(iid=6EB22872-8A19-11D0-81B6-00A0C9231C29, thread=AUTO, type=DUAL) More...
interface | ICatalogObject
.interface(iid=6EB22871-8A19-11D0-81B6-00A0C9231C29, thread=AUTO, type=DUAL) More...
interface | ICOMAdminCatalog
.interface(iid=DD662187-DFC2-11D1-A2CF-00805FC79235, thread=AUTO, type=DUAL) More...
Generated on Wed Nov 13 2024 16:58:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: COMSPYAUDITLib Namespace Reference

  • Namespace List
  • Namespace Members
Classes | Functions

COMSPYAUDITLib Namespace Reference

Classes

class ComSpyAudit

Functions

importlib ("stdole32.tlb")
importlib ("stdole2.tlb")

Function Documentation

COMSPYAUDITLib::importlib ( "stdole32.tlb" )
COMSPYAUDITLib::importlib ( "stdole2.tlb" )
Generated on Wed Nov 13 2024 16:58:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: COMSPYCTLLib Namespace Reference

  • Namespace List
  • Namespace Members
Classes | Functions

COMSPYCTLLib Namespace Reference

Classes

class | ComSpy
class | ComSpyPropPage

Functions

importlib ("stdole2.tlb")

Function Documentation

COMSPYCTLLib::importlib ( "stdole2.tlb" )
Generated on Wed Nov 13 2024 16:58:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CONTEXTPLUGINLib Namespace Reference

  • Namespace List
  • Namespace Members
Functions

CONTEXTPLUGINLib Namespace Reference

Functions

importlib ("stdole32.tlb")
importlib ("stdole2.tlb")

Function Documentation

CONTEXTPLUGINLib::importlib ( "stdole32.tlb" )
CONTEXTPLUGINLib::importlib ( "stdole2.tlb" )
Generated on Wed Nov 13 2024 16:58:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CONTEXTSAMPLEPROPPAGELib Namespace Reference

  • Namespace List
  • Namespace Members
Classes | Functions

CONTEXTSAMPLEPROPPAGELib Namespace Reference

Classes

class ContextSamplePropPage

Functions

importlib ("stdole32.tlb")
importlib ("stdole2.tlb")

Function Documentation

CONTEXTSAMPLEPROPPAGELib::importlib ( "stdole32.tlb" )
CONTEXTSAMPLEPROPPAGELib::importlib ( "stdole2.tlb" )
Generated on Wed Nov 13 2024 16:58:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: CSharp_Draw Namespace Reference

  • Namespace List
  • Namespace Members
Classes

CSharp_Draw Namespace Reference

Classes

class | Form1
Form1 is the main form for sending and receiving Drawing commands using MSMQ. More...
class | InputBox
Summary description for InputBox. More...
Generated on Wed Nov 13 2024 16:58:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: DBAUTHPLUGINLib Namespace Reference

  • Namespace List
  • Namespace Members
Functions

DBAUTHPLUGINLib Namespace Reference

Functions

importlib ("stdole32.tlb")
importlib ("stdole2.tlb")

Function Documentation

DBAUTHPLUGINLib::importlib ( "stdole32.tlb" )
DBAUTHPLUGINLib::importlib ( "stdole2.tlb" )
Generated on Wed Nov 13 2024 16:58:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: EDANNOTATORLib Namespace Reference

  • Namespace List
  • Namespace Members
Classes | Functions

EDANNOTATORLib Namespace Reference

Classes

class Annotator

Functions

importlib ("stdole32.tlb")
importlib ("stdole2.tlb")

Function Documentation

EDANNOTATORLib::importlib ( "stdole32.tlb" )
EDANNOTATORLib::importlib ( "stdole2.tlb" )
Generated on Wed Nov 13 2024 16:58:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: EDCOMMANDSLib Namespace Reference

  • Namespace List
  • Namespace Members
Classes | Functions

EDCOMMANDSLib Namespace Reference

Classes

class BrowserHost

Functions

importlib ("stdole32.tlb")
importlib ("stdole2.tlb")

Function Documentation

EDCOMMANDSLib::importlib ( "stdole32.tlb" )
EDCOMMANDSLib::importlib ( "stdole2.tlb" )
Generated on Wed Nov 13 2024 16:58:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: EDGLYPHSLib Namespace Reference

  • Namespace List
  • Namespace Members
Classes | Functions

EDGLYPHSLib Namespace Reference

Classes

class BrowserHost

Functions

importlib ("stdole32.tlb")
importlib ("stdole2.tlb")

Function Documentation

EDGLYPHSLib::importlib ( "stdole32.tlb" )
EDGLYPHSLib::importlib ( "stdole2.tlb" )
Generated on Wed Nov 13 2024 16:58:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: EDHOSTLib Namespace Reference

  • Namespace List
  • Namespace Members
Classes | Functions

EDHOSTLib Namespace Reference

Classes

class | BrowserHost
class | Grid
class | Snap

Functions

importlib ("stdole32.tlb")
importlib ("stdole2.tlb")

Function Documentation

EDHOSTLib::importlib ( "stdole32.tlb" )
EDHOSTLib::importlib ( "stdole2.tlb" )
Generated on Wed Nov 13 2024 16:58:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: fullsvr Namespace Reference

  • Namespace List
  • Namespace Members
Classes

fullsvr Namespace Reference

Classes

class | AsyncFullServ
.class(classid=F03BE176-A8DE-40D1-9161-A36BCBE1FEA6,DynamicCasts) .interface(iid=D3140113-D43F-4718-9119-EF62D631F2AB, thread=AUTO) More...
interface | AsyncIFullServ
.interface(iid=D3140113-D43F-4718-9119-EF62D631F2AB, thread=AUTO) More...
class | FullServ
.class(classid=F03BE175-A8DE-40D1-9161-A36BCBE1FEA6,DynamicCasts) .interface(iid=D3140112-D43F-4718-9119-EF62D631F2AB, thread=AUTO) More...
interface | ICallFactory
.interface(iid=1C733A30-2A1C-11CE-ADE5-00AA0044773D, thread=AUTO) More...
interface | ICancelMethodCalls
.interface(iid=00000029-0000-0000-C000-000000000046, thread=AUTO) More...
interface | IFullServ
.interface(iid=D3140112-D43F-4718-9119-EF62D631F2AB, thread=AUTO) More...
interface | ISynchronize
.interface(iid=00000030-0000-0000-C000-000000000046, thread=AUTO) More...
Generated on Wed Nov 13 2024 16:58:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: helper Namespace Reference

  • Namespace List
  • Namespace Members
Classes

helper Namespace Reference

Classes

interface | DatabaseSettings
interface | sampleConstants
Generated on Wed Nov 13 2024 16:58:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: InkBlog Namespace Reference

  • Namespace List
  • Namespace Members
Classes

InkBlog Namespace Reference

Classes

class | _Default
The Default code-behind page. More...
class | AddBlog
The AddBlog code-behind page. More...
class | InkArea
The InkArea Sample Control class. More...
Generated on Wed Nov 13 2024 16:58:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: InkClipboard Namespace Reference

  • Namespace List
  • Namespace Members
Classes | Enumerations

InkClipboard Namespace Reference

Classes

class | InkClipboard
The InkClipboard with Selection Sample Application form class. More...

Enumerations

enum | ApplicationMode { Ink, LassoSelection, MoveInk }

Enumeration Type Documentation

enum InkClipboard::ApplicationMode

Enumeration of all possible application modes:

Ink: The user is drawing new strokes LassoSelection: The user is selecting strokes with a lasso MoveInk: The user is moving selected strokes (this is not a menu item)

Enumerator:
Ink
LassoSelection
MoveInk

Definition at line 68 of file InkClipboard.cs.

    {
        Ink,
        LassoSelection,
        MoveInk
    }

Generated on Wed Nov 13 2024 16:58:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: InkCollection Namespace Reference

  • Namespace List
  • Namespace Members
Classes

InkCollection Namespace Reference

Classes

class InkCollection
The InkCollection Sample Application form class. More...
Generated on Wed Nov 13 2024 16:58:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: InkErase Namespace Reference

  • Namespace List
  • Namespace Members
Classes | Enumerations

InkErase Namespace Reference

Classes

class | InkErase
Summary description for InkErase. More...

Enumerations

enum | ApplicationMode { Ink, CuspErase, IntersectErase, StrokeErase }

Enumeration Type Documentation

enum InkErase::ApplicationMode

Enumeration of all possible application modes:

Ink: The user is drawing new strokes CuspErase: The user is erasing at cusps IntersectErase: The user is erasing at intersections StrokeErase: The user is erasing strokes

Enumerator:
Ink
CuspErase
IntersectErase
StrokeErase

Definition at line 56 of file InkErase.cs.

    {
        Ink,
        CuspErase,
        IntersectErase,
        StrokeErase
    }

Generated on Wed Nov 13 2024 16:58:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: InkHitTest Namespace Reference

  • Namespace List
  • Namespace Members
Classes | Enumerations

InkHitTest Namespace Reference

Classes

class | InkHitTest
The InkHitTest Sample Application form class. More...

Enumerations

enum | ApplicationMode { None = 0, Ink = 1, HitTest = 2, NearestPoint = 3 }

Enumeration Type Documentation

enum InkHitTest::ApplicationMode

Enumeration of all possible application modes:

Ink: The user is drawing new strokes HitTest: The user is performing hit testing NearestPoint: The app should calculate the nearest point

Enumerator:
None
Ink
HitTest
NearestPoint

Definition at line 49 of file InkHitTest.cs.

            {
                None = 0,
                Ink = 1,
                HitTest = 2,
                NearestPoint = 3
    };

Generated on Wed Nov 13 2024 16:58:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: InkRecognition Namespace Reference

  • Namespace List
  • Namespace Members
Classes

InkRecognition Namespace Reference

Classes

class InkRecognition
The InkRecognition Sample Application form class. More...
Generated on Wed Nov 13 2024 16:58:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: MGDRESOURCELib Namespace Reference

  • Namespace List
  • Namespace Members
Classes | Functions

MGDRESOURCELib Namespace Reference

Classes

class ClipBookServer

Functions

importlib ("stdole32.tlb")
importlib ("stdole2.tlb")

Function Documentation

MGDRESOURCELib::importlib ( "stdole32.tlb" )
MGDRESOURCELib::importlib ( "stdole2.tlb" )
Generated on Wed Nov 13 2024 16:58:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Microsoft Namespace Reference

  • Namespace List
  • Namespace Members
Namespaces

Microsoft Namespace Reference

Namespaces

namespace | Samples
namespace | Uddi
Generated on Wed Nov 13 2024 16:58:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Microsoft::Samples Namespace Reference

  • Namespace List
  • Namespace Members
  • Microsoft
  • Samples
Namespaces

Microsoft::Samples Namespace Reference

Namespaces

namespace Ink
Generated on Wed Nov 13 2024 16:58:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Microsoft::Samples::Ink Namespace Reference

  • Namespace List
  • Namespace Members
  • Microsoft
  • Samples
  • Ink
Namespaces

Microsoft::Samples::Ink Namespace Reference

Namespaces

namespace | Cs
namespace | CS
Generated on Wed Nov 13 2024 16:58:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Microsoft::Samples::Ink::Cs Namespace Reference

  • Namespace List
  • Namespace Members
  • Microsoft
  • Samples
  • Ink
  • Cs
Namespaces

Microsoft::Samples::Ink::Cs Namespace Reference

Namespaces

namespace InkZoom
Generated on Wed Nov 13 2024 16:58:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Microsoft::Samples::Ink::CS Namespace Reference

  • Namespace List
  • Namespace Members
  • Microsoft
  • Samples
  • Ink
  • CS
Namespaces

Microsoft::Samples::Ink::CS Namespace Reference

Namespaces

namespace InkDividerSample
Generated on Wed Nov 13 2024 16:58:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Microsoft::Samples::Ink::CS::InkDividerSample Namespace Reference

  • Namespace List
  • Namespace Members
  • Microsoft
  • Samples
  • Ink
  • CS
  • InkDividerSample
Classes

Microsoft::Samples::Ink::CS::InkDividerSample Namespace Reference

Classes

class InkDividerForm
InkDivider sample application form class. More...
Generated on Wed Nov 13 2024 16:58:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Microsoft::Samples::Ink::Cs::InkZoom Namespace Reference

  • Namespace List
  • Namespace Members
  • Microsoft
  • Samples
  • Ink
  • Cs
  • InkZoom
Classes

Microsoft::Samples::Ink::Cs::InkZoom Namespace Reference

Classes

class InkZoom
The InkZoom Sample Application form class. More...
Generated on Wed Nov 13 2024 16:58:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Microsoft::Uddi Namespace Reference

  • Namespace List
  • Namespace Members
  • Microsoft
  • Uddi
Namespaces

Microsoft::Uddi Namespace Reference

Namespaces

namespace Demo
Generated on Wed Nov 13 2024 16:58:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Microsoft::Uddi::Demo Namespace Reference

  • Namespace List
  • Namespace Members
  • Microsoft
  • Uddi
  • Demo
Classes

Microsoft::Uddi::Demo Namespace Reference

Classes

class Publish
Generated on Wed Nov 13 2024 16:58:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: msado15 Namespace Reference

  • Namespace List
  • Namespace Members
Classes

msado15 Namespace Reference

Classes

interface | _ADO
.interface(iid=00000534-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...
interface | _Collection
.interface(iid=00000512-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...
interface | _Command
.interface(iid=0000054E-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...
interface | _Connection
.interface(iid=00000550-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...
interface | _DynaCollection
.interface(iid=00000513-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...
interface | _Parameter
.interface(iid=0000050C-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...
interface | _Record
.interface(iid=00000562-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...
interface | _Recordset
.interface(iid=00000556-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...
interface | _Stream
.interface(iid=00000565-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...
class | ADCPROP_ASYNCTHREADPRIORITY_ENUM
class | ADCPROP_AUTORECALC_ENUM
class | ADCPROP_UPDATECRITERIA_ENUM
interface | ADOCommandConstruction
.interface(iid=00000517-0000-0010-8000-00AA006D2EA4, thread=AUTO) More...
interface | ADOConnectionConstruction
.interface(iid=00000551-0000-0010-8000-00AA006D2EA4, thread=AUTO) More...
interface | ADOConnectionConstruction15
.interface(iid=00000516-0000-0010-8000-00AA006D2EA4, thread=AUTO) More...
interface | ADORecordConstruction
.interface(iid=00000567-0000-0010-8000-00AA006D2EA4, thread=AUTO) More...
interface | ADORecordsetConstruction
.interface(iid=00000283-0000-0010-8000-00AA006D2EA4, thread=AUTO) More...
interface | ADOStreamConstruction
.interface(iid=00000568-0000-0010-8000-00AA006D2EA4, thread=AUTO) More...
class | AffectEnum
class | BookmarkEnum
class | CEResyncEnum
class | Command
.class(classid=00000507-0000-0010-8000-00AA006D2EA4,DynamicCasts) .interface(iid=0000054E-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...
interface | Command15
.interface(iid=00000508-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...
class | CommandTypeEnum
class | CompareEnum
class | Connection
.class(classid=00000514-0000-0010-8000-00AA006D2EA4,DynamicCasts) .interface(iid=00000550-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...
interface | Connection15
.interface(iid=00000515-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...
interface | ConnectionEvents
.interface(iid=00000400-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DISPATCH) More...
interface | ConnectionEventsVt
.interface(iid=00000402-0000-0010-8000-00AA006D2EA4, thread=AUTO) More...
class | ConnectModeEnum
class | ConnectOptionEnum
class | ConnectPromptEnum
class | CopyRecordOptionsEnum
class | CursorLocationEnum
class | CursorOptionEnum
class | CursorTypeEnum
class | DataTypeEnum
class | EditModeEnum
interface | Error
.interface(iid=00000500-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...
interface | Errors
.interface(iid=00000501-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...
class | ErrorValueEnum
class | EventReasonEnum
class | EventStatusEnum
class | ExecuteOptionEnum
interface | Field
.interface(iid=0000054C-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...
interface | Field15
.interface(iid=00000505-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...
class | FieldAttributeEnum
class | FieldEnum
interface | Fields
.interface(iid=00000564-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...
interface | Fields15
.interface(iid=00000506-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...
interface | Fields20
.interface(iid=0000054D-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...
class | FilterGroupEnum
class | GetRowsOptionEnum
interface | IRecFields
.interface(iid=00000563-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...
class | IsolationLevelEnum
class | LineSeparatorEnum
class | LockTypeEnum
class | MarshalOptionsEnum
class | MoveRecordOptionsEnum
class | ObjectStateEnum
class | Parameter
.class(classid=0000050B-0000-0010-8000-00AA006D2EA4,DynamicCasts) .interface(iid=0000050C-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...
class | ParameterAttributesEnum
class | ParameterDirectionEnum
interface | Parameters
.interface(iid=0000050D-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...
class | PersistFormatEnum
class | PositionEnum
interface | Properties
.interface(iid=00000504-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...
interface | Property
.interface(iid=00000503-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...
class | PropertyAttributesEnum
class | Record
.class(classid=00000560-0000-0010-8000-00AA006D2EA4,DynamicCasts) .interface(iid=00000562-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...
class | RecordCreateOptionsEnum
class | RecordOpenOptionsEnum
class | Recordset
.class(classid=00000535-0000-0010-8000-00AA006D2EA4,DynamicCasts) .interface(iid=00000556-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...
interface | Recordset15
.interface(iid=0000050E-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...
interface | Recordset20
.interface(iid=0000054F-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...
interface | Recordset21
.interface(iid=00000555-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...
interface | RecordsetEvents
.interface(iid=00000266-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DISPATCH) More...
interface | RecordsetEventsVt
.interface(iid=00000403-0000-0010-8000-00AA006D2EA4, thread=AUTO) More...
class | RecordStatusEnum
class | RecordTypeEnum
class | ResyncEnum
class | SaveOptionsEnum
class | SchemaEnum
class | SearchDirectionEnum
class | SeekEnum
class | Stream
.class(classid=00000566-0000-0010-8000-00AA006D2EA4,DynamicCasts) .interface(iid=00000565-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...
class | StreamOpenOptionsEnum
class | StreamReadEnum
class | StreamTypeEnum
class | StreamWriteEnum
class | StringFormatEnum
class | XactAttributeEnum
Generated on Wed Nov 13 2024 16:58:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: MSDFHDL Namespace Reference

  • Namespace List
  • Namespace Members
Classes | Functions

MSDFHDL Namespace Reference

Classes

interface IDataFactoryHandler

Functions

importlib ("stdole32.tlb")
importlib ("C:\Program Files\Common Files\System\ado\msado15.dll")
importlib ("stdole.tlb")

Function Documentation

MSDFHDL::importlib ( "stdole32.tlb" )
MSDFHDL::importlib ( "C:\Program Files\Common Files\System\ado\msado15.dll" )
MSDFHDL::importlib ( "stdole.tlb" )
Generated on Wed Nov 13 2024 16:58:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: MSDFMAPLib Namespace Reference

  • Namespace List
  • Namespace Members
Classes | Functions

MSDFMAPLib Namespace Reference

Classes

class Handler

Functions

importlib ("stdole32.tlb")
importlib ("msdfhdl.tlb")
importlib ("stdole.tlb")

Function Documentation

MSDFMAPLib::importlib ( "stdole32.tlb" )
MSDFMAPLib::importlib ( "msdfhdl.tlb" )
MSDFMAPLib::importlib ( "stdole.tlb" )
Generated on Wed Nov 13 2024 16:58:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: MYDEVICELib Namespace Reference

  • Namespace List
  • Namespace Members
Classes | Typedefs | Enumerations | Functions

MYDEVICELib Namespace Reference

Classes

class | Dimmer
class | DimmerService
interface | IUPnPService_DimmingService_SCPD

Typedefs

typedef enum
MYDEVICELib::DIMMINGSERVICE_SCPD_DISPIDS 		DIMMINGSERVICE_SCPD_DISPIDS

Enumerations

enum DIMMINGSERVICE_SCPD_DISPIDS {
DISPID_POWER = 1, DISPID_DIMLEVEL, DISPID_POWERON, DISPID_POWEROFF,
DISPID_GETPOWERVALUE, DISPID_SETDIMLEVEL, DISPID_GETDIMLEVEL, DISPID_GETCONFIGDETAILS,
DISPID_POWER = 1, DISPID_DIMLEVEL, DISPID_POWERON, DISPID_POWEROFF,
DISPID_GETPOWERVALUE, DISPID_SETDIMLEVEL, DISPID_GETDIMLEVEL, DISPID_GETCONFIGDETAILS,
DISPID_POWER = 1, DISPID_DIMLEVEL, DISPID_POWERON, DISPID_POWEROFF,
DISPID_GETPOWERVALUE, DISPID_SETDIMLEVEL, DISPID_GETDIMLEVEL, DISPID_GETCONFIGDETAILS
}
enum DIMMINGSERVICE_SCPD_DISPIDS {
DISPID_POWER = 1, DISPID_DIMLEVEL, DISPID_POWERON, DISPID_POWEROFF,
DISPID_GETPOWERVALUE, DISPID_SETDIMLEVEL, DISPID_GETDIMLEVEL, DISPID_GETCONFIGDETAILS,
DISPID_POWER = 1, DISPID_DIMLEVEL, DISPID_POWERON, DISPID_POWEROFF,
DISPID_GETPOWERVALUE, DISPID_SETDIMLEVEL, DISPID_GETDIMLEVEL, DISPID_GETCONFIGDETAILS,
DISPID_POWER = 1, DISPID_DIMLEVEL, DISPID_POWERON, DISPID_POWEROFF,
DISPID_GETPOWERVALUE, DISPID_SETDIMLEVEL, DISPID_GETDIMLEVEL, DISPID_GETCONFIGDETAILS
}
enum DIMMINGSERVICE_SCPD_DISPIDS {
DISPID_POWER = 1, DISPID_DIMLEVEL, DISPID_POWERON, DISPID_POWEROFF,
DISPID_GETPOWERVALUE, DISPID_SETDIMLEVEL, DISPID_GETDIMLEVEL, DISPID_GETCONFIGDETAILS,
DISPID_POWER = 1, DISPID_DIMLEVEL, DISPID_POWERON, DISPID_POWEROFF,
DISPID_GETPOWERVALUE, DISPID_SETDIMLEVEL, DISPID_GETDIMLEVEL, DISPID_GETCONFIGDETAILS,
DISPID_POWER = 1, DISPID_DIMLEVEL, DISPID_POWERON, DISPID_POWEROFF,
DISPID_GETPOWERVALUE, DISPID_SETDIMLEVEL, DISPID_GETDIMLEVEL, DISPID_GETCONFIGDETAILS
}

Functions

importlib ("stdole32.tlb")
importlib ("stdole2.tlb")

Typedef Documentation

typedef enum MYDEVICELib::DIMMINGSERVICE_SCPD_DISPIDS MYDEVICELib::DIMMINGSERVICE_SCPD_DISPIDS

Enumeration Type Documentation

enum typedef enum MYDEVICELib::DIMMINGSERVICE_SCPD_DISPIDS MYDEVICELib::DIMMINGSERVICE_SCPD_DISPIDS
Enumerator:
DISPID_POWER
DISPID_DIMLEVEL
DISPID_POWERON
DISPID_POWEROFF
DISPID_GETPOWERVALUE
DISPID_SETDIMLEVEL
DISPID_GETDIMLEVEL
DISPID_GETCONFIGDETAILS
DISPID_POWER
DISPID_DIMLEVEL
DISPID_POWERON
DISPID_POWEROFF
DISPID_GETPOWERVALUE
DISPID_SETDIMLEVEL
DISPID_GETDIMLEVEL
DISPID_GETCONFIGDETAILS
DISPID_POWER
DISPID_DIMLEVEL
DISPID_POWERON
DISPID_POWEROFF
DISPID_GETPOWERVALUE
DISPID_SETDIMLEVEL
DISPID_GETDIMLEVEL
DISPID_GETCONFIGDETAILS

Definition at line 40 of file MyDevice.idl.

{
   DISPID_POWER = 1,
   DISPID_DIMLEVEL,
   DISPID_POWERON,
   DISPID_POWEROFF,
   DISPID_GETPOWERVALUE,
   DISPID_SETDIMLEVEL,
   DISPID_GETDIMLEVEL,
   DISPID_GETCONFIGDETAILS

} DIMMINGSERVICE_SCPD_DISPIDS;

enum MYDEVICELib::DIMMINGSERVICE_SCPD_DISPIDS
Enumerator:
DISPID_POWER
DISPID_DIMLEVEL
DISPID_POWERON
DISPID_POWEROFF
DISPID_GETPOWERVALUE
DISPID_SETDIMLEVEL
DISPID_GETDIMLEVEL
DISPID_GETCONFIGDETAILS
DISPID_POWER
DISPID_DIMLEVEL
DISPID_POWERON
DISPID_POWEROFF
DISPID_GETPOWERVALUE
DISPID_SETDIMLEVEL
DISPID_GETDIMLEVEL
DISPID_GETCONFIGDETAILS
DISPID_POWER
DISPID_DIMLEVEL
DISPID_POWERON
DISPID_POWEROFF
DISPID_GETPOWERVALUE
DISPID_SETDIMLEVEL
DISPID_GETDIMLEVEL
DISPID_GETCONFIGDETAILS

Definition at line 41 of file MyDevice.idl.

{
   DISPID_POWER = 1,
   DISPID_DIMLEVEL,
   DISPID_POWERON,
   DISPID_POWEROFF,
   DISPID_GETPOWERVALUE,
   DISPID_SETDIMLEVEL,
   DISPID_GETDIMLEVEL,
   DISPID_GETCONFIGDETAILS

} DIMMINGSERVICE_SCPD_DISPIDS;

enum MYDEVICELib::DIMMINGSERVICE_SCPD_DISPIDS
Enumerator:
DISPID_POWER
DISPID_DIMLEVEL
DISPID_POWERON
DISPID_POWEROFF
DISPID_GETPOWERVALUE
DISPID_SETDIMLEVEL
DISPID_GETDIMLEVEL
DISPID_GETCONFIGDETAILS
DISPID_POWER
DISPID_DIMLEVEL
DISPID_POWERON
DISPID_POWEROFF
DISPID_GETPOWERVALUE
DISPID_SETDIMLEVEL
DISPID_GETDIMLEVEL
DISPID_GETCONFIGDETAILS
DISPID_POWER
DISPID_DIMLEVEL
DISPID_POWERON
DISPID_POWEROFF
DISPID_GETPOWERVALUE
DISPID_SETDIMLEVEL
DISPID_GETDIMLEVEL
DISPID_GETCONFIGDETAILS

Definition at line 41 of file MyDevice.idl.

{
   DISPID_POWER = 1,
   DISPID_DIMLEVEL,
   DISPID_POWERON,
   DISPID_POWEROFF,
   DISPID_GETPOWERVALUE,
   DISPID_SETDIMLEVEL,
   DISPID_GETDIMLEVEL,
   DISPID_GETCONFIGDETAILS

} DIMMINGSERVICE_SCPD_DISPIDS;

Function Documentation

MYDEVICELib::importlib ( "stdole32.tlb" )
MYDEVICELib::importlib ( "stdole2.tlb" )
Generated on Wed Nov 13 2024 16:58:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: MyStorageResourceLib Namespace Reference

  • Namespace List
  • Namespace Members
Classes | Functions

MyStorageResourceLib Namespace Reference

Classes

class | CEnumStorageResource
class | CPartitionInfo
class | CStorageResource
class | CStorageResType

Functions

importlib ("stdole32.tlb")
importlib ("stdole2.tlb")

Function Documentation

MyStorageResourceLib::importlib ( "stdole32.tlb" )
MyStorageResourceLib::importlib ( "stdole2.tlb" )
Generated on Wed Nov 13 2024 16:58:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: newseventclass Namespace Reference

  • Namespace List
  • Namespace Members
Classes

newseventclass Namespace Reference

Classes

interface | INewsEvent
.interface(iid=4BF5E480-A5D3-11D2-AD4D-0080C7BFF6DB, thread=AUTO, type=DUAL) More...
interface | INewsEventDefault
.interface(iid=00020400-0000-0000-C000-000000000046, thread=AUTO, type=DUAL) More...
class | NewsEvent
.register(clsid=997FF9C0-0F01-11D3-9257-0080C7C30D72, typelib=94007C90-0F00-11D3-9257-0080C7C30D72, version="1.0", description="NewsEvent Class") More...
Generated on Wed Nov 13 2024 16:58:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: PaperForm Namespace Reference

  • Namespace List
  • Namespace Members
Classes

PaperForm Namespace Reference

Classes

class PaperForm
The PaperForm Sample Application form class. More...
Generated on Wed Nov 13 2024 16:58:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: persistatl Namespace Reference

  • Namespace List
  • Namespace Members
Classes

persistatl Namespace Reference

Classes

interface | INewsEvent
.interface(iid=4BF5E480-A5D3-11D2-AD4D-0080C7BFF6DB, thread=AUTO, type=DUAL) More...
interface | INewsEventDefault
.interface(iid=00020400-0000-0000-C000-000000000046, thread=AUTO, type=DUAL) More...
class | NewsEvent
.register(clsid=6B834DA0-A5D3-11D2-AD4D-0080C7BFF6DB, typelib=04A47040-A5D3-11D2-AD4D-0080C7BFF6DB, version="1.0", description="NewsEvent Class") More...
Generated on Wed Nov 13 2024 16:58:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: PLGTRMSMPLib Namespace Reference

  • Namespace List
  • Namespace Members
Classes | Functions

PLGTRMSMPLib Namespace Reference

Classes

class PlgTermSample

Functions

importlib ("stdole32.tlb")
importlib ("stdole2.tlb")

Function Documentation

PLGTRMSMPLib::importlib ( "stdole32.tlb" )
PLGTRMSMPLib::importlib ( "stdole2.tlb" )
Generated on Wed Nov 13 2024 16:58:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: PROXYPLUGINLib Namespace Reference

  • Namespace List
  • Namespace Members
Functions

PROXYPLUGINLib Namespace Reference

Functions

importlib ("stdole32.tlb")
importlib ("stdole2.tlb")

Function Documentation

PROXYPLUGINLib::importlib ( "stdole32.tlb" )
PROXYPLUGINLib::importlib ( "stdole2.tlb" )
Generated on Wed Nov 13 2024 16:58:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: qcnotify Namespace Reference

  • Namespace List
  • Namespace Members
Classes

qcnotify Namespace Reference

Classes

class | _ShipStatus
interface | INotify
.interface(iid=6DD1E6EF-28C1-11D2-B5B6-00C04FC340EE, thread=AUTO, type=DUAL) More...
interface | INotifyDefault
.interface(iid=00020400-0000-0000-C000-000000000046, thread=AUTO, type=DUAL) More...
class | Notify
.register(clsid=6DD1E6F0-28C1-11D2-B5B6-00C04FC340EE, typelib=6DD1E6DC-28C1-11D2-B5B6-00C04FC340EE, version="1.0", description="Notify Class") More...
Generated on Wed Nov 13 2024 16:58:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: qcorder Namespace Reference

  • Namespace List
  • Namespace Members
Classes

qcorder Namespace Reference

Classes

interface | IOrder
.interface(iid=CB34A1A1-28C2-11D2-B5B6-00C04FC340EE, thread=AUTO, type=DUAL) More...
interface | IOrderDefault
.interface(iid=00020400-0000-0000-C000-000000000046, thread=AUTO, type=DUAL) More...
class | Order
.register(clsid=CB34A1A2-28C2-11D2-B5B6-00C04FC340EE, typelib=6DD1E6C2-28C1-11D2-B5B6-00C04FC340EE, version="1.0", description="Order Class") More...
Generated on Wed Nov 13 2024 16:58:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: qcship Namespace Reference

  • Namespace List
  • Namespace Members
Classes

qcship Namespace Reference

Classes

interface | IShip
.interface(iid=CB34A1A4-28C2-11D2-B5B6-00C04FC340EE, thread=AUTO, type=DUAL) More...
interface | IShipDefault
.interface(iid=00020400-0000-0000-C000-000000000046, thread=AUTO, type=DUAL) More...
class | Ship
.register(clsid=CB34A1A5-28C2-11D2-B5B6-00C04FC340EE, typelib=6DD1E6CF-28C1-11D2-B5B6-00C04FC340EE, version="1.0", description="Ship Class") More...
Generated on Wed Nov 13 2024 16:58:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: RealTimeStylusPluginApp Namespace Reference

  • Namespace List
  • Namespace Members
Classes

RealTimeStylusPluginApp Namespace Reference

Classes

struct | PluginListItem
Helper used to store information about a given plugin. More...
class | RealTimeStylusPluginApp
The RealTimeStylusPlugin Sample Application form class. More...
Generated on Wed Nov 13 2024 16:58:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: RealTimeStylusPlugins Namespace Reference

  • Namespace List
  • Namespace Members
Classes

RealTimeStylusPlugins Namespace Reference

Classes

class | CustomDynamicRendererPlugin
A real time stylus plugin that demonstrates custom dynamic rendering. More...
class | PacketFilterPlugin
A real time stylus plugin that demonstrates packet modification. More...
Generated on Wed Nov 13 2024 16:58:17 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: RENDERLib Namespace Reference

  • Namespace List
  • Namespace Members
Classes | Functions

RENDERLib Namespace Reference

Classes

class | Behavior
class | EventSink
class | Factory

Functions

importlib ("stdole32.tlb")
importlib ("stdole2.tlb")

Function Documentation

RENDERLib::importlib ( "stdole32.tlb" )
RENDERLib::importlib ( "stdole2.tlb" )
Generated on Wed Nov 13 2024 16:58:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Sample Namespace Reference

  • Namespace List
  • Namespace Members
Namespaces | Classes

Sample Namespace Reference

Namespaces

namespace | UI

Classes

class | Messages
class | MySignedXml
class | Sample
class | SignVerify
class | Win32
Generated on Wed Nov 13 2024 16:58:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Sample::UI Namespace Reference

  • Namespace List
  • Namespace Members
  • Sample
  • UI
Classes

Sample::UI Namespace Reference

Classes

class | AboutBox
class | MainWindow
Generated on Wed Nov 13 2024 16:58:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SDKDimmerServiceLib Namespace Reference

  • Namespace List
  • Namespace Members
Classes | Typedefs | Enumerations | Functions

SDKDimmerServiceLib Namespace Reference

Classes

interface | IUPnPService_DimmingService_SCPD
class | UPNPSampleDimmerDevice

Typedefs

typedef enum
SDKDimmerServiceLib::DIMMINGSERVICE_SCPD_DISPIDS 		DIMMINGSERVICE_SCPD_DISPIDS

Enumerations

enum DIMMINGSERVICE_SCPD_DISPIDS {
DISPID_POWER = 1, DISPID_DIMLEVEL, DISPID_POWERON, DISPID_POWEROFF,
DISPID_GETPOWERVALUE, DISPID_SETDIMLEVEL, DISPID_GETDIMLEVEL, DISPID_GETCONFIGDETAILS
}

Functions

importlib ("stdole32.tlb")

Typedef Documentation

typedef enum SDKDimmerServiceLib::DIMMINGSERVICE_SCPD_DISPIDS SDKDimmerServiceLib::DIMMINGSERVICE_SCPD_DISPIDS

Enumeration Type Documentation

enum SDKDimmerServiceLib::DIMMINGSERVICE_SCPD_DISPIDS
Enumerator:
DISPID_POWER
DISPID_DIMLEVEL
DISPID_POWERON
DISPID_POWEROFF
DISPID_GETPOWERVALUE
DISPID_SETDIMLEVEL
DISPID_GETDIMLEVEL
DISPID_GETCONFIGDETAILS

Definition at line 26 of file DimmerDevice.idl.

   {
      DISPID_POWER = 1,
      DISPID_DIMLEVEL,
      DISPID_POWERON,
      DISPID_POWEROFF,
      DISPID_GETPOWERVALUE,
      DISPID_SETDIMLEVEL,
      DISPID_GETDIMLEVEL,
      DISPID_GETCONFIGDETAILS
   } DIMMINGSERVICE_SCPD_DISPIDS;

Function Documentation

SDKDimmerServiceLib::importlib ( "stdole32.tlb" )
Generated on Wed Nov 13 2024 16:58:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SDKSAMPLEPLAYLISTPLUGINLib Namespace Reference

  • Namespace List
  • Namespace Members
Classes | Functions

SDKSAMPLEPLAYLISTPLUGINLib Namespace Reference

Classes

class SDKSamplePlaylistParser

Functions

importlib ("stdole32.tlb")
importlib ("stdole2.tlb")

Function Documentation

SDKSAMPLEPLAYLISTPLUGINLib::importlib ( "stdole32.tlb" )
SDKSAMPLEPLAYLISTPLUGINLib::importlib ( "stdole2.tlb" )
Generated on Wed Nov 13 2024 16:58:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SDKSAMPLESTORAGEPLUGINLib Namespace Reference

  • Namespace List
  • Namespace Members
Functions

SDKSAMPLESTORAGEPLUGINLib Namespace Reference

Functions

importlib ("stdole32.tlb")
importlib ("stdole2.tlb")

Function Documentation

SDKSAMPLESTORAGEPLUGINLib::importlib ( "stdole32.tlb" )
SDKSAMPLESTORAGEPLUGINLib::importlib ( "stdole2.tlb" )
Generated on Wed Nov 13 2024 16:58:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Serialization Namespace Reference

  • Namespace List
  • Namespace Members
Classes

Serialization Namespace Reference

Classes

class SerializationForm
Generated on Wed Nov 13 2024 16:58:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: storesh Namespace Reference

  • Namespace List
  • Namespace Members
Classes | Functions

storesh Namespace Reference

Classes

struct | CERT_SYSTEM_STORE_INFO
class | Storesh
class | Win32

Functions

delegate bool | CertEnumSystemStoreCallback ([In, MarshalAs(UnmanagedType.LPWStr)] String pvSystemStore, uint dwFlags, ref CERT_SYSTEM_STORE_INFO pStoreInfo, uint pvReserved,[In, MarshalAs(UnmanagedType.LPWStr)] String pvArg)

Function Documentation

delegate bool storesh::CertEnumSystemStoreCallback | ( | [In, MarshalAs(UnmanagedType.LPWStr)] String | pvSystemStore,
 |  | uint | dwFlags,
 |  | ref CERT_SYSTEM_STORE_INFO | pStoreInfo,
 |  | uint | pvReserved,
 |  | [In, MarshalAs(UnmanagedType.LPWStr)] String | pvArg
 | ) |  |
Generated on Wed Nov 13 2024 16:58:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: THEPROVIDERLib Namespace Reference

  • Namespace List
  • Namespace Members
Classes | Functions

THEPROVIDERLib Namespace Reference

Classes

class MSOmniProv

Functions

importlib ("stdole32.tlb")
importlib ("stdole2.tlb")

Function Documentation

THEPROVIDERLib::importlib ( "stdole32.tlb" )
THEPROVIDERLib::importlib ( "stdole2.tlb" )
Generated on Wed Nov 13 2024 16:58:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: UDDI Namespace Reference

  • Namespace List
  • Namespace Members
Namespaces

UDDI Namespace Reference

Namespaces

namespace Tools
Generated on Wed Nov 13 2024 16:58:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: UDDI::Tools Namespace Reference

  • Namespace List
  • Namespace Members
  • UDDI
  • Tools
Classes

UDDI::Tools Namespace Reference

Classes

class | CategoryTreeNode
class | CategoryTreeView
Summary description for categorytree. More...
Generated on Wed Nov 13 2024 16:58:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Util Namespace Reference

  • Namespace List
  • Namespace Members
Classes

Util Namespace Reference

Classes

class | HelperFunctions
struct | line
Generated on Wed Nov 13 2024 16:58:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: util Namespace Reference

  • Namespace List
  • Namespace Members
Classes

util Namespace Reference

Classes

interface DatabaseSettings
Generated on Wed Nov 13 2024 16:58:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: vcacct Namespace Reference

  • Namespace List
  • Namespace Members
Classes

vcacct Namespace Reference

Classes

class | CAccount
.class(classid=04CF0B76-1989-11D0-B917-0080C7394688,DynamicCasts) .interface(iid=04CF0B72-1989-11D0-B917-0080C7394688, thread=AUTO, type=DUAL) More...
class | CGetReceipt
.class(classid=A81260B2-DDC8-11D0-B5A0-00C04FB957D8,DynamicCasts) .interface(iid=A81260B1-DDC8-11D0-B5A0-00C04FB957D8, thread=AUTO, type=DUAL) More...
class | CMoveMoney
.class(classid=04CF0B7B-1989-11D0-B917-0080C7394688,DynamicCasts) .interface(iid=04CF0B77-1989-11D0-B917-0080C7394688, thread=AUTO, type=DUAL) More...
class | CUpdateReceipt
.class(classid=A81260B8-DDC8-11D0-B5A0-00C04FB957D8,DynamicCasts) .interface(iid=A81260B7-DDC8-11D0-B5A0-00C04FB957D8, thread=AUTO, type=DUAL) More...
interface | IAccount
.interface(iid=04CF0B72-1989-11D0-B917-0080C7394688, thread=AUTO, type=DUAL) More...
interface | IGetReceipt
.interface(iid=A81260B1-DDC8-11D0-B5A0-00C04FB957D8, thread=AUTO, type=DUAL) More...
interface | IMoveMoney
.interface(iid=04CF0B77-1989-11D0-B917-0080C7394688, thread=AUTO, type=DUAL) More...
interface | IUpdateReceipt
.interface(iid=A81260B7-DDC8-11D0-B5A0-00C04FB957D8, thread=AUTO, type=DUAL) More...
Generated on Wed Nov 13 2024 16:58:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WiaWrap Namespace Reference

  • Namespace List
  • Namespace Members
Classes | Typedefs | Functions

WiaWrap Namespace Reference

Classes

class | CComPtrArray
class | CDataCallback
class | CEventCallback
class | CProgressDlg

Typedefs

typedef HRESULT(CALLBACK * | PFNPROGRESSCALLBACK )(LONG lStatus, LONG lPercentComplete, PVOID pParam)

Functions

HRESULT CALLBACK | DefaultProgressCallback (LONG lStatus, LONG lPercentComplete, PVOID pParam)
HRESULT | ReadPropertyGuid (IWiaPropertyStorage *pWiaPropertyStorage, const PROPSPEC *pPropSpec, GUID *pguidResult)
HRESULT | ReadPropertyLong (IWiaPropertyStorage *pWiaPropertyStorage, const PROPSPEC *pPropSpec, LONG *plResult)
STDMETHODIMP_ (ULONG) CDataCallback
HRESULT | WiaGetImage (HWND hWndParent, LONG lDeviceType, LONG lFlags, LONG lIntent, IWiaDevMgr *pSuppliedWiaDevMgr, IWiaItem *pSuppliedItemRoot, PFNPROGRESSCALLBACK pfnProgressCallback, PVOID pProgressCallbackParam, GUID *pguidFormat, LONG *plCount, IStream ***pppStream)
HRESULT | WiaGetNumDevices (IWiaDevMgr *pSuppliedWiaDevMgr, ULONG *pulNumDevices)

Typedef Documentation

typedef HRESULT(CALLBACK * WiaWrap::PFNPROGRESSCALLBACK)(LONG lStatus, LONG lPercentComplete, PVOID pParam)

Definition at line 65 of file WiaWrap.h.

Function Documentation

HRESULT CALLBACK WiaWrap::DefaultProgressCallback | ( | LONG | lStatus,
 |  | LONG | lPercentComplete,
 |  | PVOID | pParam
 | ) |  |

Definition at line 318 of file WiaWrap.cpp.

{
    CProgressDlg *pProgressDlg = (CProgressDlg *) pParam;

    if (pProgressDlg == NULL)
    {
        return E_POINTER;
    }

    // If the user has pressed the cancel button, abort transfer

    if (pProgressDlg->Cancelled())
    {
        return S_FALSE;
    }

    // Form the message text

  UINT uID;

    switch (lStatus)
    {
        case IT_STATUS_TRANSFER_FROM_DEVICE:
    {
      uID = IDS_STATUS_TRANSFER_FROM_DEVICE;
            break;
    }

        case IT_STATUS_PROCESSING_DATA:
    {
            uID = IDS_STATUS_PROCESSING_DATA;
            break;
    }

        case IT_STATUS_TRANSFER_TO_CLIENT:
    {
            uID = IDS_STATUS_TRANSFER_TO_CLIENT;
            break;
    }

    default:
    {
      return E_INVALIDARG;
    }
    }

    TCHAR szFormat[DEFAULT_STRING_SIZE] = _T("%d");

    LoadString(g_hInstance, uID, szFormat, COUNTOF(szFormat));

    TCHAR szStatusText[DEFAULT_STRING_SIZE];

    _sntprintf(szStatusText, COUNTOF(szStatusText) - 1, szFormat, lPercentComplete);

    szStatusText[COUNTOF(szStatusText) - 1] = _T('\0');

    // Update the progress bar values

    pProgressDlg->SetMessage(szStatusText);

    pProgressDlg->SetPercent(lPercentComplete);

    return S_OK;
}

HRESULT WiaWrap::ReadPropertyGuid | ( | IWiaPropertyStorage * | pWiaPropertyStorage,
 |  | const PROPSPEC * | pPropSpec,
 |  | GUID * | pguidResult
 | ) |  |
HRESULT WiaWrap::ReadPropertyLong | ( | IWiaPropertyStorage * | pWiaPropertyStorage,
 |  | const PROPSPEC * | pPropSpec,
 |  | LONG * | plResult
 | ) |  |
WiaWrap::STDMETHODIMP_ ( ULONG )

Definition at line 120 of file ProgressDlg.cpp.

{
    LONG cRef = InterlockedDecrement(&m_cRef);

    if (cRef == 0)
    {
        delete this;
    }

HRESULT WiaWrap::WiaGetImage | ( | HWND | hWndParent,
 |  | LONG | lDeviceType,
 |  | LONG | lFlags,
 |  | LONG | lIntent,
 |  | IWiaDevMgr * | pSuppliedWiaDevMgr,
 |  | IWiaItem * | pSuppliedItemRoot,
 |  | PFNPROGRESSCALLBACK | pfnProgressCallback,
 |  | PVOID | pProgressCallbackParam,
 |  | GUID * | pguidFormat,
 |  | LONG * | plCount,
 |  | IStream *** | pppStream
 | ) |  |
HRESULT WiaWrap::WiaGetNumDevices | ( | IWiaDevMgr * | pSuppliedWiaDevMgr,
 |  | ULONG * | pulNumDevices
 | ) |  |
Generated on Wed Nov 13 2024 16:58:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WsdlDiscovery Namespace Reference

  • Namespace List
  • Namespace Members
Classes

WsdlDiscovery Namespace Reference

Classes

class frmMain
Summary description for Form1. More...
Generated on Wed Nov 13 2024 16:58:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Class Members

  • Namespace List
  • Namespace Members
  • All
  • Functions
  • Typedefs
  • Enumerations
  • Enumerator
  • a
  • c
  • d
  • f
  • g
  • i
  • p
  • r
  • s
  • w
Here is a list of all namespace members with links to the namespace documentation for each member:

- a -

  • ApplicationMode : InkClipboard , InkHitTest , InkErase

- c -

  • CertEnumSystemStoreCallback() : storesh

- d -

  • DefaultProgressCallback() : WiaWrap
  • DIMMINGSERVICE_SCPD_DISPIDS : SDKDimmerServiceLib , MYDEVICELib , SDKDimmerServiceLib , MYDEVICELib
  • DISPID_DIMLEVEL : SDKDimmerServiceLib , MYDEVICELib
  • DISPID_GETCONFIGDETAILS : SDKDimmerServiceLib , MYDEVICELib
  • DISPID_GETDIMLEVEL : SDKDimmerServiceLib , MYDEVICELib
  • DISPID_GETPOWERVALUE : MYDEVICELib , SDKDimmerServiceLib
  • DISPID_POWER : MYDEVICELib , SDKDimmerServiceLib
  • DISPID_POWEROFF : SDKDimmerServiceLib , MYDEVICELib
  • DISPID_POWERON : MYDEVICELib , SDKDimmerServiceLib
  • DISPID_SETDIMLEVEL : MYDEVICELib , SDKDimmerServiceLib

- f -

  • FillBitmapFileHeader() : BitmapUtil
  • FixBitmapHeight() : BitmapUtil

- g -

  • GetBitmapDimensions() : BitmapUtil
  • GetBitmapHeaderSize() : BitmapUtil
  • GetBitmapLineWidthInBytes() : BitmapUtil
  • GetBitmapOffsetBits() : BitmapUtil
  • GetBitmapSize() : BitmapUtil

- i -

  • importlib() : COMSPYAUDITLib , MyStorageResourceLib , CLUADMEXLib , MGDRESOURCELib , BANKVCLib , RENDERLib , EDHOSTLib , EDGLYPHSLib , EDCOMMANDSLib , EDANNOTATORLib , BROCHUREMACHINELib , ATLCONTROLLib , CERTPOLICYSAMPLELib , CERTEXITSAMPLELib , MYDEVICELib , CallbackIUnknownLib , SDKDimmerServiceLib , PLGTRMSMPLib , ADSERRORLib , ADSFIRSTEXTLib , SDKSAMPLEPLAYLISTPLUGINLib , CONTEXTSAMPLEPROPPAGELib , CONTEXTPLUGINLib , SDKSAMPLESTORAGEPLUGINLib , PROXYPLUGINLib , DBAUTHPLUGINLib , AUTHENTICATEPLUGINLib , MSDFMAPLib , MSDFHDL , THEPROVIDERLib , ACCOUNT , Async_Lib , COMSPYCTLLib , COMSPYAUDITLib

- p -

  • PFNPROGRESSCALLBACK : WiaWrap

- r -

  • ReadPropertyGuid() : WiaWrap
  • ReadPropertyLong() : WiaWrap

- s -

  • STDMETHODIMP_() : WiaWrap

- w -

  • WiaGetImage() : WiaWrap
  • WiaGetNumDevices() : WiaWrap
Generated on Wed Nov 13 2024 16:58:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: File Index

  • File List
  • File Members

File List

Here is a list of all files with brief descriptions:
Begin/dll/Demo.c [code]
Begin/dll/Demo.h [code]
Begin/dll/Select.c [code]
Begin/dll/Select.h [code]
Begin/Generic/Generic.C [code]
Begin/Generic/Generic.H [code]
Begin/Generic/Resource.H [code]
Begin/sdkdiff/bar.cpp [code]
Begin/sdkdiff/compitem.cpp [code]
Begin/sdkdiff/compitem.h [code]
Begin/sdkdiff/complist.cpp [code]
Begin/sdkdiff/complist.h [code]
Begin/sdkdiff/ErrorOut.cpp [code]
Begin/sdkdiff/ErrorOut.h [code]
Begin/sdkdiff/file.cpp [code]
Begin/sdkdiff/file.h [code]
Begin/sdkdiff/findgoto.cpp [code]
Begin/sdkdiff/findgoto.h [code]
Begin/sdkdiff/gfile.cpp [code]
Begin/sdkdiff/gutils.cpp [code]
Begin/sdkdiff/gutils.h [code]
Begin/sdkdiff/gutilsrc.h [code]
Begin/sdkdiff/line.cpp [code]
Begin/sdkdiff/line.h [code]
Begin/sdkdiff/list.cpp [code]
Begin/sdkdiff/list.h [code]
Begin/sdkdiff/precomp.h [code]
Begin/sdkdiff/profile.cpp [code]
Begin/sdkdiff/profile.h [code]
Begin/sdkdiff/scandir.cpp [code]
Begin/sdkdiff/scandir.h [code]
Begin/sdkdiff/sdkdiff.cpp [code]
Begin/sdkdiff/sdkdiff.h [code]
Begin/sdkdiff/section.cpp [code]
Begin/sdkdiff/section.h [code]
Begin/sdkdiff/state.h [code]
Begin/sdkdiff/status.cpp [code]
Begin/sdkdiff/table.cpp [code]
Begin/sdkdiff/table.h [code]
Begin/sdkdiff/tpaint.cpp [code]
Begin/sdkdiff/tprint.cpp [code]
Begin/sdkdiff/tpriv.h [code]
Begin/sdkdiff/tree.cpp [code]
Begin/sdkdiff/tree.h [code]
Begin/sdkdiff/tscroll.cpp [code]
Begin/sdkdiff/utils.cpp [code]
Begin/sdkdiff/view.cpp [code]
Begin/sdkdiff/view.h [code]
Begin/sdkdiff/wdiffrc.h [code]
Begin/Simple/Simple.c [code]
Com/Administration/Explore.VC/AppExportDlg.Cpp [code]
Com/Administration/Explore.VC/AppExportDlg.h [code]
Com/Administration/Explore.VC/AppInstallDlg.Cpp [code]
Com/Administration/Explore.VC/AppInstallDlg.h [code]
Com/Administration/Explore.VC/AppUtilDlg.Cpp [code]
Com/Administration/Explore.VC/AppUtilDlg.h [code]
Com/Administration/Explore.VC/CompImportDlg.Cpp [code]
Com/Administration/Explore.VC/CompImportDlg.h [code]
Com/Administration/Explore.VC/CompInstallDlg.Cpp [code]
Com/Administration/Explore.VC/CompInstallDlg.h [code]
Com/Administration/Explore.VC/ConnectDlg.Cpp [code]
Com/Administration/Explore.VC/ConnectDlg.h [code]
Com/Administration/Explore.VC/Resource.h [code]
Com/Administration/Explore.VC/StdAfx.Cpp [code]
Com/Administration/Explore.VC/StdAfx.h [code]
Com/Administration/Explore.VC/UtilitiesDlg.Cpp [code]
Com/Administration/Explore.VC/UtilitiesDlg.h [code]
Com/Administration/Explore.VC/VCExplore.Cpp [code]
Com/Administration/Explore.VC/VCExplore.h [code]
Com/Administration/Explore.VC/VCExploreDlg.Cpp [code]
Com/Administration/Explore.VC/VCExploreDlg.h [code]
Com/Administration/Spy/ComSpy/ComSpy.Cpp [code]
Com/Administration/Spy/ComSpy/ComSpy.Idl [code]
Com/Administration/Spy/ComSpy/Resource.h [code]
Com/Administration/Spy/ComSpy/SpyCon.Cpp [code]
Com/Administration/Spy/ComSpy/SpyCon.h [code]
Com/Administration/Spy/ComSpy/StdAfx.Cpp [code]
Com/Administration/Spy/ComSpy/StdAfx.h [code]
Com/Administration/Spy/ComSpyAudit/ComSpyAudit.Cpp [code]
Com/Administration/Spy/ComSpyAudit/ComSpysqlAudit.Cpp [code]
Com/Administration/Spy/ComSpyAudit/ComSpysqlAudit.h [code]
Com/Administration/Spy/ComSpyAudit/Events.Cpp [code]
Com/Administration/Spy/ComSpyAudit/Resource.h [code]
Com/Administration/Spy/ComSpyAudit/StdAfx.Cpp [code]
Com/Administration/Spy/ComSpyAudit/StdAfx.h [code]
Com/Administration/Spy/ComSpyCtl/activitysub.h [code]
Com/Administration/Spy/ComSpyCtl/Adminwrap.Cpp [code]
Com/Administration/Spy/ComSpyCtl/Adminwrap.h [code]
Com/Administration/Spy/ComSpyCtl/appinfo.Cpp [code]
Com/Administration/Spy/ComSpyCtl/appinfo.h [code]
Com/Administration/Spy/ComSpyCtl/appsub.h [code]
Com/Administration/Spy/ComSpyCtl/ccomspy.h [code]
Com/Administration/Spy/ComSpyCtl/ComSpy.Cpp [code]
Com/Administration/Spy/ComSpyCtl/ComSpyCtl.Cpp [code]
Com/Administration/Spy/ComSpyCtl/ComSpyproppage.Cpp [code]
Com/Administration/Spy/ComSpyCtl/ComSpyproppage.h [code]
Com/Administration/Spy/ComSpyCtl/crmsub.Cpp [code]
Com/Administration/Spy/ComSpyCtl/crmsub.h [code]
Com/Administration/Spy/ComSpyCtl/evtstoresub.Cpp [code]
Com/Administration/Spy/ComSpyCtl/evtstoresub.h [code]
Com/Administration/Spy/ComSpyCtl/exceptionsub.h [code]
Com/Administration/Spy/ComSpyCtl/Identitysub.h [code]
Com/Administration/Spy/ComSpyCtl/instancesub.h [code]
Com/Administration/Spy/ComSpyCtl/lbsub.h [code]
Com/Administration/Spy/ComSpyCtl/Methodsub.Cpp [code]
Com/Administration/Spy/ComSpyCtl/Methodsub.h [code]
Com/Administration/Spy/ComSpyCtl/Objconstsub.h [code]
Com/Administration/Spy/ComSpyCtl/ObjPool2sub.h [code]
Com/Administration/Spy/ComSpyCtl/ObjPoolsub.h [code]
Com/Administration/Spy/ComSpyCtl/Objsub.h [code]
Com/Administration/Spy/ComSpyCtl/qcsub.h [code]
Com/Administration/Spy/ComSpyCtl/Resource.h [code]
Com/Administration/Spy/ComSpyCtl/Resourcesub.Cpp [code]
Com/Administration/Spy/ComSpyCtl/Resourcesub.h [code]
Com/Administration/Spy/ComSpyCtl/securitysub.h [code]
Com/Administration/Spy/ComSpyCtl/selectEventsDlg.Cpp [code]
Com/Administration/Spy/ComSpyCtl/selectEventsDlg.h [code]
Com/Administration/Spy/ComSpyCtl/StdAfx.Cpp [code]
Com/Administration/Spy/ComSpyCtl/StdAfx.h [code]
Com/Administration/Spy/ComSpyCtl/syslcesub.Cpp [code]
Com/Administration/Spy/ComSpyCtl/syslcesub.h [code]
Com/Administration/Spy/ComSpyCtl/threadsub.h [code]
Com/Administration/Spy/ComSpyCtl/txsub.Cpp [code]
Com/Administration/Spy/ComSpyCtl/txsub.h [code]
Com/Administration/Spy/ComSpyCtl/usersub.h [code]
Com/Administration/Spy/ComSpyface/ComSpyAudit.Idl [code]
Com/Administration/Spy/ComSpyface/ComSpyCtl.Idl [code]
Com/Administration/Spy/idl/comspyaudit.idl [code]
Com/Administration/Spy/idl/comspyctl.idl [code]
Com/async/client/CEvent.h [code]
Com/async/client/main.cpp [code]
Com/async/proxy/Proxy.idl [code]
Com/async/server/CAsyncTest.cpp [code]
Com/async/server/CAsyncTest.h [code]
Com/async/server/CAsyncXXX.cpp [code]
Com/async/server/CAsyncXXX.h [code]
Com/async/server/CConnectionPT.cpp [code]
Com/async/server/CConnectionPT.h [code]
Com/async/server/CEnumXXX.cpp [code]
Com/async/server/CEnumXXX.h [code]
Com/async/server/cfactory.cpp [code]
Com/async/server/cfactory.h [code]
Com/async/server/cunknown.cpp [code]
Com/async/server/cunknown.h [code]
Com/async/server/DCOMServer.cpp [code]
Com/async/server/DCOMServer.h [code]
Com/async/server/debug.c [code]
Com/async/server/debug.h [code]
Com/async/server/main.cpp [code]
Com/async/server/registry.cpp [code]
Com/async/server/registry.h [code]
Com/async/server/SERVER.CPP [code]
Com/async/server/UNK.H [code]
Com/Common/Inc/CpyImage.Idl [code]
Com/Common/Inc/MtsAudit.Idl [code]
Com/Common/Inc/MtsSpyCtl.Idl [code]
Com/Common/Inc/MtsUserEventObj.Idl [code]
Com/Common/Inc/RmWorker.Idl [code]
Com/Common/Inc/TxFileDisp.Idl [code]
Com/Common/ProxyStub/CopyFileRm.Idl [code]
Com/Common/ProxyStub/iid.c [code]
Com/Common/ProxyStub/SimpleLog.Idl [code]
Com/Fundamentals/ActiveDocument/DfV/about.Cxx [code]
Com/Fundamentals/ActiveDocument/DfV/about.h [code]
Com/Fundamentals/ActiveDocument/DfV/bitmaps.Cxx [code]
Com/Fundamentals/ActiveDocument/DfV/bitmaps.h [code]
Com/Fundamentals/ActiveDocument/DfV/DfV.h [code]
Com/Fundamentals/ActiveDocument/DfV/message.Cxx [code]
Com/Fundamentals/ActiveDocument/DfV/message.h [code]
Com/Fundamentals/ActiveDocument/DfV/mwclass.Cxx [code]
Com/Fundamentals/ActiveDocument/DfV/mwclass.h [code]
Com/Fundamentals/ActiveDocument/DfV/strmvwr.Cxx [code]
Com/Fundamentals/ActiveDocument/DfV/strmvwr.h [code]
Com/Fundamentals/ActiveDocument/DfV/WinMain.Cxx [code]
Com/Fundamentals/ActiveDocument/DoServer/clsfact.Cpp [code]
Com/Fundamentals/ActiveDocument/DoServer/clsfact.h [code]
Com/Fundamentals/ActiveDocument/DoServer/DataObj.Cpp [code]
Com/Fundamentals/ActiveDocument/DoServer/DataObj.h [code]
Com/Fundamentals/ActiveDocument/DoServer/DoServer.Cpp [code]
Com/Fundamentals/ActiveDocument/DoServer/DoServer.h [code]
Com/Fundamentals/ActiveDocument/DoServer/oipaObj.Cpp [code]
Com/Fundamentals/ActiveDocument/DoServer/oipaObj.h [code]
Com/Fundamentals/ActiveDocument/DoServer/oipObj.Cpp [code]
Com/Fundamentals/ActiveDocument/DoServer/oipObj.h [code]
Com/Fundamentals/ActiveDocument/DoServer/OLEDoc.Cpp [code]
Com/Fundamentals/ActiveDocument/DoServer/OLEDoc.h [code]
Com/Fundamentals/ActiveDocument/DoServer/OLEDocVw.Cpp [code]
Com/Fundamentals/ActiveDocument/DoServer/OLEDocVw.h [code]
Com/Fundamentals/ActiveDocument/DoServer/OLEObj.Cpp [code]
Com/Fundamentals/ActiveDocument/DoServer/OLEObj.h [code]
Com/Fundamentals/ActiveDocument/DoServer/perfile.Cpp [code]
Com/Fundamentals/ActiveDocument/DoServer/perfile.h [code]
Com/Fundamentals/ActiveDocument/DoServer/perstor.Cpp [code]
Com/Fundamentals/ActiveDocument/DoServer/perstor.h [code]
Com/Fundamentals/ActiveDocument/DoServer/Resource.h [code]
Com/Fundamentals/ActiveDocument/DoServer/Utils.Cpp [code]
Com/Fundamentals/ActiveDocument/DoServer/Utils.h [code]
Com/Fundamentals/ActiveDocument/Framer/Framer.Cpp [code]
Com/Fundamentals/ActiveDocument/Framer/Framer.h [code]
Com/Fundamentals/ActiveDocument/Framer/IAdvSink.Cpp [code]
Com/Fundamentals/ActiveDocument/Framer/ICliSite.Cpp [code]
Com/Fundamentals/ActiveDocument/Framer/IDocSite.Cpp [code]
Com/Fundamentals/ActiveDocument/Framer/IIpSite.Cpp [code]
Com/Fundamentals/ActiveDocument/Framer/Resource.h [code]
Com/Fundamentals/ActiveDocument/Framer/Site.Cpp [code]
Com/Fundamentals/ActiveDocument/Framer/Site.h [code]
Com/Fundamentals/ActiveDocument/Range/cache.Cpp [code]
Com/Fundamentals/ActiveDocument/Range/callback.Cpp [code]
Com/Fundamentals/ActiveDocument/Range/callback.hpp [code]
Com/Fundamentals/ActiveDocument/Range/download.Cpp [code]
Com/Fundamentals/ActiveDocument/Range/Range.c [code]
Com/Fundamentals/ActiveDocument/Range/Range.h [code]
Com/Fundamentals/ActiveDocument/Range/recvbuf.Cpp [code]
Com/Fundamentals/ActiveDocument/Range/recvbuf.hpp [code]
Com/Fundamentals/AsyncCalls/CallBackClient/callbackclient.Cpp [code]
Com/Fundamentals/AsyncCalls/CallBackClient/callbackclient.h [code]
Com/Fundamentals/AsyncCalls/CallBackClient/stdafx.Cpp [code]
Com/Fundamentals/AsyncCalls/CallBackClient/stdafx.h [code]
Com/Fundamentals/AsyncCalls/CPPClient/cppclient.Cpp [code]
Com/Fundamentals/AsyncCalls/CPPClient/stdafx.Cpp [code]
Com/Fundamentals/AsyncCalls/CPPClient/stdafx.h [code]
Com/Fundamentals/AsyncCalls/FullSvr/fullserv.Cpp [code]
Com/Fundamentals/AsyncCalls/FullSvr/fullserv.h [code]
Com/Fundamentals/AsyncCalls/FullSvr/fullsvr.Cpp [code]
Com/Fundamentals/AsyncCalls/FullSvr/fullsvr.Idl [code]
Com/Fundamentals/AsyncCalls/FullSvr/resource.h [code]
Com/Fundamentals/AsyncCalls/FullSvr/stdafx.Cpp [code]
Com/Fundamentals/AsyncCalls/FullSvr/stdafx.h [code]
Com/Fundamentals/AsyncCalls/HelpDll/helpdll.Cpp [code]
Com/Fundamentals/AsyncCalls/HelpDll/stdafx.Cpp [code]
Com/Fundamentals/AsyncCalls/HelpDll/stdafx.h [code]
Com/Fundamentals/AsyncCalls/JavaClient/Class1.java [code]
Com/Fundamentals/AsyncCalls/JavaClient/FullSvr/AsyncFullServ.java [code]
Com/Fundamentals/AsyncCalls/JavaClient/FullSvr/AsyncIFullServ.java [code]
Com/Fundamentals/AsyncCalls/JavaClient/FullSvr/FullServ.java [code]
Com/Fundamentals/AsyncCalls/JavaClient/FullSvr/ICallFactory.java [code]
Com/Fundamentals/AsyncCalls/JavaClient/FullSvr/ICancelMethodCalls.java [code]
Com/Fundamentals/AsyncCalls/JavaClient/FullSvr/IFullServ.java [code]
Com/Fundamentals/AsyncCalls/JavaClient/FullSvr/ISynchronize.java [code]
Com/Fundamentals/AsyncCalls/ScaleDemo/scaledemo.Cpp [code]
Com/Fundamentals/AsyncCalls/ScaleDemo/stdafx.Cpp [code]
Com/Fundamentals/AsyncCalls/ScaleDemo/stdafx.h [code]
Com/Fundamentals/CMallSpy/CMallSpy.Cxx [code]
Com/Fundamentals/CMallSpy/CMallSpy.Hxx [code]
Com/Fundamentals/CMallSpy/Test.Cxx [code]
Com/Fundamentals/Common/altassrt.Cxx [code]
Com/Fundamentals/Common/Stablize.Cxx [code]
Com/Fundamentals/CustomSurrogate/Dog/cDog.h [code]
Com/Fundamentals/CustomSurrogate/Dog/Dog.Cpp [code]
Com/Fundamentals/CustomSurrogate/Dog/Dogcf.Cpp [code]
Com/Fundamentals/CustomSurrogate/Dog/Dogcf.h [code]
Com/Fundamentals/CustomSurrogate/Dog/iDog.Cpp [code]
Com/Fundamentals/CustomSurrogate/Dog/iDog.Idl [code]
Com/Fundamentals/CustomSurrogate/Surrog/cfWrap.Cpp [code]
Com/Fundamentals/CustomSurrogate/Surrog/cfWrap.h [code]
Com/Fundamentals/CustomSurrogate/Surrog/Common.h [code]
Com/Fundamentals/CustomSurrogate/Surrog/csur.Cpp [code]
Com/Fundamentals/CustomSurrogate/Surrog/csur.h [code]
Com/Fundamentals/CustomSurrogate/Surrog/custsur.Cpp [code]
Com/Fundamentals/DCom/Cancel/Client/Cancel.Cpp [code]
Com/Fundamentals/DCom/Cancel/Client/Resource.h [code]
Com/Fundamentals/DCom/Cancel/InProc/SServer.Cpp [code]
Com/Fundamentals/DCom/Cancel/Local/Mta/SServer.Cpp [code]
Com/Fundamentals/DCom/Cancel/Local/Sta/SServer.Cpp [code]
Com/Fundamentals/DCom/ComPerf/ComPerf.Cpp [code]
Com/Fundamentals/DCom/ComPerf/psperf.Idl [code]
Com/Fundamentals/DCom/DComPerm/AclMgmt.Cpp [code]
Com/Fundamentals/DCom/DComPerm/DComPerm.Cpp [code]
Com/Fundamentals/DCom/DComPerm/DComPerm.h [code]
Com/Fundamentals/DCom/DComPerm/ListAcl.Cpp [code]
Com/Fundamentals/DCom/DComPerm/SDMgmt.Cpp [code]
Com/Fundamentals/DCom/DComPerm/SrvcMgmt.Cpp [code]
Com/Fundamentals/DCom/DComPerm/UtilS.Cpp [code]
Com/Fundamentals/DCom/DComPerm/Wrappers.Cpp [code]
Com/Fundamentals/DCom/OleImp/Client.Cpp [code]
Com/Fundamentals/DCom/OleImp/OleImp.Cpp [code]
Com/Fundamentals/DCom/OleImp/Util.Cpp [code]
Com/Fundamentals/DCom/OleImp/Util.h [code]
Com/Fundamentals/DCom/Secure/myProp.Idl [code]
Com/Fundamentals/DCom/Secure/Resource.h [code]
Com/Fundamentals/DCom/Secure/secClnt.Cpp [code]
Com/Fundamentals/DCom/Secure/secClnt.h [code]
Com/Fundamentals/DCom/Secure/secSvr.Cpp [code]
Com/Fundamentals/DCom/Secure/secSvr.h [code]
Com/Fundamentals/DCom/Simple/sclient/sclient.cpp [code]
Com/Fundamentals/DCom/Simple/sserver/sserver.cpp [code]
Com/Fundamentals/DCom/TimeOuts/Client/Client.Cpp [code]
Com/Fundamentals/DCom/TimeOuts/Client/Client.h [code]
Com/Fundamentals/DCom/TimeOuts/Client/ClientDlg.Cpp [code]
Com/Fundamentals/DCom/TimeOuts/Client/ClientDlg.h [code]
Com/Fundamentals/DCom/TimeOuts/Client/Resource.h [code]
Com/Fundamentals/DCom/TimeOuts/Client/StdAfx.h [code]
Com/Fundamentals/DCom/TimeOuts/PingResp/DllDatax.c [code]
Com/Fundamentals/DCom/TimeOuts/PingResp/DllDatax.h [code]
Com/Fundamentals/DCom/TimeOuts/PingResp/PingResp.Cpp [code]
Com/Fundamentals/DCom/TimeOuts/PingResp/PingResp.Idl [code]
Com/Fundamentals/DCom/TimeOuts/PingResp/PingResponder.h [code]
Com/Fundamentals/DCom/TimeOuts/PingResp/Resource.h [code]
Com/Fundamentals/DCom/TimeOuts/PingResp/StdAfx.h [code]
Com/Fundamentals/DCom/TimeOuts/Server/MonitorServer.Cpp [code]
Com/Fundamentals/DCom/TimeOuts/Server/MonitorServer.h [code]
Com/Fundamentals/DCom/TimeOuts/Server/Resource.h [code]
Com/Fundamentals/DCom/TimeOuts/Server/Server.Cpp [code]
Com/Fundamentals/DCom/TimeOuts/Server/Server.Idl [code]
Com/Fundamentals/DCom/TimeOuts/Server/StdAfx.h [code]
Com/Fundamentals/Include/ansiapi.h [code]
Com/Fundamentals/Include/assert.h [code]
Com/Fundamentals/Include/BttnCur.h [code]
Com/Fundamentals/Include/GizmoBar.h [code]
Com/Fundamentals/Include/msgfiltr.h [code]
Com/Fundamentals/Include/OleStd.h [code]
Com/Fundamentals/Include/Stablize.h [code]
Com/Fundamentals/Object/CallAs/call_as.c [code]
Com/Fundamentals/Object/CallAs/CallAs.Idl [code]
Com/Fundamentals/Object/CallAs/Client.c [code]
Com/Fundamentals/Object/CallAs/Server.Cxx [code]
Com/Fundamentals/Object/OHello/cHello.Cxx [code]
Com/Fundamentals/Object/OHello/Client.Cxx [code]
Com/Fundamentals/Object/OHello/error.Cxx [code]
Com/Fundamentals/Object/OHello/OHello.Idl [code]
Com/Fundamentals/Object/OHello/Server.Cxx [code]
Com/Fundamentals/OleApt/OleApt.Cpp [code]
Com/Fundamentals/OleStd/ansiapi.h [code]
Com/Fundamentals/OleStd/Common.h [code]
Com/Fundamentals/OleStd/dballoc.Cpp [code]
Com/Fundamentals/OleStd/dballoc.h [code]
Com/Fundamentals/OleStd/dbgUtil.c [code]
Com/Fundamentals/OleStd/debug.h [code]
Com/Fundamentals/OleStd/drawIcon.c [code]
Com/Fundamentals/OleStd/enumfetc.c [code]
Com/Fundamentals/OleStd/enumStat.c [code]
Com/Fundamentals/OleStd/getIcon.c [code]
Com/Fundamentals/OleStd/hatch.c [code]
Com/Fundamentals/OleStd/malspy.c [code]
Com/Fundamentals/OleStd/malspy.h [code]
Com/Fundamentals/OleStd/msgfiltr.c [code]
Com/Fundamentals/OleStd/Objfdbk.c [code]
Com/Fundamentals/OleStd/ole2ui.c [code]
Com/Fundamentals/OleStd/OleStd.c [code]
Com/Fundamentals/OleStd/oleutl.c [code]
Com/Fundamentals/OleStd/regdb.c [code]
Com/Fundamentals/OleStd/stdpal.c [code]
Com/Fundamentals/OleStd/stdpal.h [code]
Com/Fundamentals/OleStd/suminfo.Cpp [code]
Com/Fundamentals/OleStd/suminfo.h [code]
Com/Fundamentals/OleStd/targtdev.c [code]
Com/Fundamentals/OleStd/Utility.c [code]
Com/Fundamentals/OleStd/Utility.h [code]
Com/Fundamentals/OleStd/wn_dos.h [code]
Com/Fundamentals/Pipes/Client/client.cxx [code]
Com/Fundamentals/Pipes/Include/pipe.cxx [code]
Com/Fundamentals/Pipes/Include/pipe.hxx [code]
Com/Fundamentals/Pipes/Include/pipesample.Idl [code]
Com/Fundamentals/Pipes/LocalServer/component.cxx [code]
Com/Fundamentals/Pipes/LocalServer/component.hxx [code]
Com/Fundamentals/Pipes/LocalServer/server.cxx [code]
Com/Fundamentals/SimpCntr/app.Cpp [code]
Com/Fundamentals/SimpCntr/app.h [code]
Com/Fundamentals/SimpCntr/doc.Cpp [code]
Com/Fundamentals/SimpCntr/doc.h [code]
Com/Fundamentals/SimpCntr/ias.Cpp [code]
Com/Fundamentals/SimpCntr/ias.h [code]
Com/Fundamentals/SimpCntr/iocs.Cpp [code]
Com/Fundamentals/SimpCntr/iocs.h [code]
Com/Fundamentals/SimpCntr/ioipf.Cpp [code]
Com/Fundamentals/SimpCntr/ioipf.h [code]
Com/Fundamentals/SimpCntr/ioips.Cpp [code]
Com/Fundamentals/SimpCntr/ioips.h [code]
Com/Fundamentals/SimpCntr/pre.h [code]
Com/Fundamentals/SimpCntr/Resource.h [code]
Com/Fundamentals/SimpCntr/SimpCntr.Cpp [code]
Com/Fundamentals/SimpCntr/SimpCntr.h [code]
Com/Fundamentals/SimpCntr/site.Cpp [code]
Com/Fundamentals/SimpCntr/site.h [code]
Com/Fundamentals/SimpCntr/stdpal.h [code]
Com/Fundamentals/SimpDnd/app.Cpp [code]
Com/Fundamentals/SimpDnd/app.h [code]
Com/Fundamentals/SimpDnd/doc.Cpp [code]
Com/Fundamentals/SimpDnd/doc.h [code]
Com/Fundamentals/SimpDnd/dxferObj.Cpp [code]
Com/Fundamentals/SimpDnd/dxferObj.h [code]
Com/Fundamentals/SimpDnd/ias.Cpp [code]
Com/Fundamentals/SimpDnd/ias.h [code]
Com/Fundamentals/SimpDnd/ids.Cpp [code]
Com/Fundamentals/SimpDnd/ids.h [code]
Com/Fundamentals/SimpDnd/idt.Cpp [code]
Com/Fundamentals/SimpDnd/idt.h [code]
Com/Fundamentals/SimpDnd/iocs.Cpp [code]
Com/Fundamentals/SimpDnd/iocs.h [code]
Com/Fundamentals/SimpDnd/pre.h [code]
Com/Fundamentals/SimpDnd/Resource.h [code]
Com/Fundamentals/SimpDnd/SimpDnd.Cpp [code]
Com/Fundamentals/SimpDnd/SimpDnd.h [code]
Com/Fundamentals/SimpDnd/site.Cpp [code]
Com/Fundamentals/SimpDnd/site.h [code]
Com/Fundamentals/SimpSvr/app.Cpp [code]
Com/Fundamentals/SimpSvr/app.h [code]
Com/Fundamentals/SimpSvr/doc.Cpp [code]
Com/Fundamentals/SimpSvr/doc.h [code]
Com/Fundamentals/SimpSvr/icf.Cpp [code]
Com/Fundamentals/SimpSvr/icf.h [code]
Com/Fundamentals/SimpSvr/ido.Cpp [code]
Com/Fundamentals/SimpSvr/ido.h [code]
Com/Fundamentals/SimpSvr/iec.Cpp [code]
Com/Fundamentals/SimpSvr/iec.h [code]
Com/Fundamentals/SimpSvr/ioipao.Cpp [code]
Com/Fundamentals/SimpSvr/ioipao.h [code]
Com/Fundamentals/SimpSvr/ioipo.Cpp [code]
Com/Fundamentals/SimpSvr/ioipo.h [code]
Com/Fundamentals/SimpSvr/ioo.Cpp [code]
Com/Fundamentals/SimpSvr/ioo.h [code]
Com/Fundamentals/SimpSvr/ips.Cpp [code]
Com/Fundamentals/SimpSvr/ips.h [code]
Com/Fundamentals/SimpSvr/Obj.Cpp [code]
Com/Fundamentals/SimpSvr/Obj.h [code]
Com/Fundamentals/SimpSvr/pre.h [code]
Com/Fundamentals/SimpSvr/Resource.h [code]
Com/Fundamentals/SimpSvr/SimpSvr.Cpp [code]
Com/Fundamentals/SimpSvr/SimpSvr.h [code]
Com/Fundamentals/TutSamp/AppUtil/AppUtil.Cpp [code]
Com/Fundamentals/TutSamp/AppUtil/AppUtil.h [code]
Com/Fundamentals/TutSamp/AptClien/AptClien.Cpp [code]
Com/Fundamentals/TutSamp/AptClien/AptClien.h [code]
Com/Fundamentals/TutSamp/AptClien/UTCRUCAR.Cpp [code]
Com/Fundamentals/TutSamp/AptClien/UTCRUCAR.h [code]
Com/Fundamentals/TutSamp/AptServe/AptServe.Cpp [code]
Com/Fundamentals/TutSamp/AptServe/AptServe.h [code]
Com/Fundamentals/TutSamp/AptServe/CAR.Cpp [code]
Com/Fundamentals/TutSamp/AptServe/CAR.h [code]
Com/Fundamentals/TutSamp/AptServe/CRUCAR.Cpp [code]
Com/Fundamentals/TutSamp/AptServe/CRUCAR.h [code]
Com/Fundamentals/TutSamp/AptServe/Factory.Cpp [code]
Com/Fundamentals/TutSamp/AptServe/Factory.h [code]
Com/Fundamentals/TutSamp/AptServe/Server.Cpp [code]
Com/Fundamentals/TutSamp/AptServe/Server.h [code]
Com/Fundamentals/TutSamp/AptServe/UtilCAR.Cpp [code]
Com/Fundamentals/TutSamp/AptServe/UtilCAR.h [code]
Com/Fundamentals/TutSamp/ComObj/CAR.Cpp [code]
Com/Fundamentals/TutSamp/ComObj/CAR.h [code]
Com/Fundamentals/TutSamp/ComObj/ComObj.Cpp [code]
Com/Fundamentals/TutSamp/ComObj/ComObj.h [code]
Com/Fundamentals/TutSamp/ComObj/ComObjI.h [code]
Com/Fundamentals/TutSamp/ComObj/CRUCAR.Cpp [code]
Com/Fundamentals/TutSamp/ComObj/CRUCAR.h [code]
Com/Fundamentals/TutSamp/ComObj/UtilCAR.Cpp [code]
Com/Fundamentals/TutSamp/ComObj/UtilCAR.h [code]
Com/Fundamentals/TutSamp/ComUser/ComUser.Cpp [code]
Com/Fundamentals/TutSamp/ComUser/ComUser.h [code]
Com/Fundamentals/TutSamp/ComUser/UTCRUCAR.Cpp [code]
Com/Fundamentals/TutSamp/ComUser/UTCRUCAR.h [code]
Com/Fundamentals/TutSamp/ConClien/ConClien.Cpp [code]
Com/Fundamentals/TutSamp/ConClien/ConClien.h [code]
Com/Fundamentals/TutSamp/ConClien/GUIBALL.Cpp [code]
Com/Fundamentals/TutSamp/ConClien/GUIBALL.h [code]
Com/Fundamentals/TutSamp/ConClien/SINK.Cpp [code]
Com/Fundamentals/TutSamp/ConClien/SINK.h [code]
Com/Fundamentals/TutSamp/ConServe/BALL.Cpp [code]
Com/Fundamentals/TutSamp/ConServe/BALL.h [code]
Com/Fundamentals/TutSamp/ConServe/Connect.Cpp [code]
Com/Fundamentals/TutSamp/ConServe/Connect.h [code]
Com/Fundamentals/TutSamp/ConServe/ConServe.Cpp [code]
Com/Fundamentals/TutSamp/ConServe/ConServe.h [code]
Com/Fundamentals/TutSamp/ConServe/Factory.Cpp [code]
Com/Fundamentals/TutSamp/ConServe/Factory.h [code]
Com/Fundamentals/TutSamp/ConServe/Server.Cpp [code]
Com/Fundamentals/TutSamp/ConServe/Server.h [code]
Com/Fundamentals/TutSamp/DcdMarsh/PAPINT.Idl [code]
Com/Fundamentals/TutSamp/DcdServe/Connect.Cpp [code]
Com/Fundamentals/TutSamp/DcdServe/Connect.h [code]
Com/Fundamentals/TutSamp/DcdServe/DcdServe.Cpp [code]
Com/Fundamentals/TutSamp/DcdServe/DcdServe.h [code]
Com/Fundamentals/TutSamp/DcdServe/Factory.Cpp [code]
Com/Fundamentals/TutSamp/DcdServe/Factory.h [code]
Com/Fundamentals/TutSamp/DcdServe/PAPER.Cpp [code]
Com/Fundamentals/TutSamp/DcdServe/PAPER.h [code]
Com/Fundamentals/TutSamp/DcdServe/Server.Cpp [code]
Com/Fundamentals/TutSamp/DcdServe/Server.h [code]
Com/Fundamentals/TutSamp/DComDraw/DComDraw.Cpp [code]
Com/Fundamentals/TutSamp/DComDraw/DComDraw.h [code]
Com/Fundamentals/TutSamp/DComDraw/GUIPAPER.Cpp [code]
Com/Fundamentals/TutSamp/DComDraw/GUIPAPER.h [code]
Com/Fundamentals/TutSamp/DComDraw/SINK.Cpp [code]
Com/Fundamentals/TutSamp/DComDraw/SINK.h [code]
Com/Fundamentals/TutSamp/DllClien/DllClien.Cpp [code]
Com/Fundamentals/TutSamp/DllClien/DllClien.h [code]
Com/Fundamentals/TutSamp/DllClien/UTCRUCAR.Cpp [code]
Com/Fundamentals/TutSamp/DllClien/UTCRUCAR.h [code]
Com/Fundamentals/TutSamp/DllServe/CAR.Cpp [code]
Com/Fundamentals/TutSamp/DllServe/CAR.h [code]
Com/Fundamentals/TutSamp/DllServe/CRUCAR.Cpp [code]
Com/Fundamentals/TutSamp/DllServe/CRUCAR.h [code]
Com/Fundamentals/TutSamp/DllServe/DllServe.Cpp [code]
Com/Fundamentals/TutSamp/DllServe/DllServe.h [code]
Com/Fundamentals/TutSamp/DllServe/Factory.Cpp [code]
Com/Fundamentals/TutSamp/DllServe/Factory.h [code]
Com/Fundamentals/TutSamp/DllServe/Sample.Cpp [code]
Com/Fundamentals/TutSamp/DllServe/Sample.h [code]
Com/Fundamentals/TutSamp/DllServe/Server.Cpp [code]
Com/Fundamentals/TutSamp/DllServe/Server.h [code]
Com/Fundamentals/TutSamp/DllServe/UtilCAR.Cpp [code]
Com/Fundamentals/TutSamp/DllServe/UtilCAR.h [code]
Com/Fundamentals/TutSamp/DllSkel/DllSkel.Cpp [code]
Com/Fundamentals/TutSamp/DllSkel/DllSkel.h [code]
Com/Fundamentals/TutSamp/DllSkel/DllSkelI.h [code]
Com/Fundamentals/TutSamp/DllUser/DllUser.Cpp [code]
Com/Fundamentals/TutSamp/DllUser/DllUser.h [code]
Com/Fundamentals/TutSamp/ExeSkel/ExeSkel.Cpp [code]
Com/Fundamentals/TutSamp/ExeSkel/ExeSkel.h [code]
Com/Fundamentals/TutSamp/FreClien/FreClien.Cpp [code]
Com/Fundamentals/TutSamp/FreClien/FreClien.h [code]
Com/Fundamentals/TutSamp/FreClien/GUIBALL.Cpp [code]
Com/Fundamentals/TutSamp/FreClien/GUIBALL.h [code]
Com/Fundamentals/TutSamp/FreServe/BALL.Cpp [code]
Com/Fundamentals/TutSamp/FreServe/BALL.h [code]
Com/Fundamentals/TutSamp/FreServe/Factory.Cpp [code]
Com/Fundamentals/TutSamp/FreServe/Factory.h [code]
Com/Fundamentals/TutSamp/FreServe/FreServe.Cpp [code]
Com/Fundamentals/TutSamp/FreServe/FreServe.h [code]
Com/Fundamentals/TutSamp/FreServe/Server.Cpp [code]
Com/Fundamentals/TutSamp/FreServe/Server.h [code]
Com/Fundamentals/TutSamp/Inc/AppUtil.h [code]
Com/Fundamentals/TutSamp/Inc/BALLGUID.h [code]
Com/Fundamentals/TutSamp/Inc/CARGUIDS.h [code]
Com/Fundamentals/TutSamp/Inc/IBALL.h [code]
Com/Fundamentals/TutSamp/Inc/ICARS.h [code]
Com/Fundamentals/TutSamp/Inc/IPageS.h [code]
Com/Fundamentals/TutSamp/Inc/IPAPER.h [code]
Com/Fundamentals/TutSamp/Inc/PageGUID.h [code]
Com/Fundamentals/TutSamp/Inc/PAPGUIDS.h [code]
Com/Fundamentals/TutSamp/LicClien/LicClien.Cpp [code]
Com/Fundamentals/TutSamp/LicClien/LicClien.h [code]
Com/Fundamentals/TutSamp/LicClien/UTCRUCAR.Cpp [code]
Com/Fundamentals/TutSamp/LicClien/UTCRUCAR.h [code]
Com/Fundamentals/TutSamp/LicServe/CRUCAR.Cpp [code]
Com/Fundamentals/TutSamp/LicServe/CRUCAR.h [code]
Com/Fundamentals/TutSamp/LicServe/Factory.Cpp [code]
Com/Fundamentals/TutSamp/LicServe/Factory.h [code]
Com/Fundamentals/TutSamp/LicServe/LicServe.Cpp [code]
Com/Fundamentals/TutSamp/LicServe/LicServe.h [code]
Com/Fundamentals/TutSamp/LicServe/Sample.Cpp [code]
Com/Fundamentals/TutSamp/LicServe/Sample.h [code]
Com/Fundamentals/TutSamp/LicServe/Server.Cpp [code]
Com/Fundamentals/TutSamp/LicServe/Server.h [code]
Com/Fundamentals/TutSamp/LocClien/LocClien.Cpp [code]
Com/Fundamentals/TutSamp/LocClien/LocClien.h [code]
Com/Fundamentals/TutSamp/LocClien/UTCRUCAR.Cpp [code]
Com/Fundamentals/TutSamp/LocClien/UTCRUCAR.h [code]
Com/Fundamentals/TutSamp/LocServe/CAR.Cpp [code]
Com/Fundamentals/TutSamp/LocServe/CAR.h [code]
Com/Fundamentals/TutSamp/LocServe/CRUCAR.Cpp [code]
Com/Fundamentals/TutSamp/LocServe/CRUCAR.h [code]
Com/Fundamentals/TutSamp/LocServe/Factory.Cpp [code]
Com/Fundamentals/TutSamp/LocServe/Factory.h [code]
Com/Fundamentals/TutSamp/LocServe/LocServe.Cpp [code]
Com/Fundamentals/TutSamp/LocServe/LocServe.h [code]
Com/Fundamentals/TutSamp/LocServe/Server.Cpp [code]
Com/Fundamentals/TutSamp/LocServe/Server.h [code]
Com/Fundamentals/TutSamp/LocServe/UtilCAR.Cpp [code]
Com/Fundamentals/TutSamp/LocServe/UtilCAR.h [code]
Com/Fundamentals/TutSamp/Marshal/MICARS.Idl [code]
Com/Fundamentals/TutSamp/Marshal2/Marshal2.Cpp [code]
Com/Fundamentals/TutSamp/Marshal2/MICARS.Idl [code]
Com/Fundamentals/TutSamp/PerClien/DRAWSINK.Cpp [code]
Com/Fundamentals/TutSamp/PerClien/DRAWSINK.h [code]
Com/Fundamentals/TutSamp/PerClien/GUIDRAW.Cpp [code]
Com/Fundamentals/TutSamp/PerClien/GUIDRAW.h [code]
Com/Fundamentals/TutSamp/PerClien/GUIList.Cpp [code]
Com/Fundamentals/TutSamp/PerClien/GUIList.h [code]
Com/Fundamentals/TutSamp/PerClien/GUIText.Cpp [code]
Com/Fundamentals/TutSamp/PerClien/GUIText.h [code]
Com/Fundamentals/TutSamp/PerClien/ListSINK.Cpp [code]
Com/Fundamentals/TutSamp/PerClien/ListSINK.h [code]
Com/Fundamentals/TutSamp/PerClien/ListWIN.Cpp [code]
Com/Fundamentals/TutSamp/PerClien/ListWIN.h [code]
Com/Fundamentals/TutSamp/PerClien/PageFILE.Cpp [code]
Com/Fundamentals/TutSamp/PerClien/PageFILE.h [code]
Com/Fundamentals/TutSamp/PerClien/PerClien.Cpp [code]
Com/Fundamentals/TutSamp/PerClien/PerClien.h [code]
Com/Fundamentals/TutSamp/PerClien/RESDEF.h [code]
Com/Fundamentals/TutSamp/PerClien/TextSINK.Cpp [code]
Com/Fundamentals/TutSamp/PerClien/TextSINK.h [code]
Com/Fundamentals/TutSamp/PerClien/TextWIN.Cpp [code]
Com/Fundamentals/TutSamp/PerClien/TextWIN.h [code]
Com/Fundamentals/TutSamp/PerDraw/Connect.Cpp [code]
Com/Fundamentals/TutSamp/PerDraw/Connect.h [code]
Com/Fundamentals/TutSamp/PerDraw/DRAWPage.Cpp [code]
Com/Fundamentals/TutSamp/PerDraw/DRAWPage.h [code]
Com/Fundamentals/TutSamp/PerDraw/Factory.Cpp [code]
Com/Fundamentals/TutSamp/PerDraw/Factory.h [code]
Com/Fundamentals/TutSamp/PerDraw/PerDraw.Cpp [code]
Com/Fundamentals/TutSamp/PerDraw/PerDraw.h [code]
Com/Fundamentals/TutSamp/PerDraw/Server.Cpp [code]
Com/Fundamentals/TutSamp/PerDraw/Server.h [code]
Com/Fundamentals/TutSamp/PerServe/Connect.Cpp [code]
Com/Fundamentals/TutSamp/PerServe/Connect.h [code]
Com/Fundamentals/TutSamp/PerServe/Factory.Cpp [code]
Com/Fundamentals/TutSamp/PerServe/Factory.h [code]
Com/Fundamentals/TutSamp/PerServe/PageList.Cpp [code]
Com/Fundamentals/TutSamp/PerServe/PageList.h [code]
Com/Fundamentals/TutSamp/PerServe/PerServe.Cpp [code]
Com/Fundamentals/TutSamp/PerServe/PerServe.h [code]
Com/Fundamentals/TutSamp/PerServe/Server.Cpp [code]
Com/Fundamentals/TutSamp/PerServe/Server.h [code]
Com/Fundamentals/TutSamp/PerText/Connect.Cpp [code]
Com/Fundamentals/TutSamp/PerText/Connect.h [code]
Com/Fundamentals/TutSamp/PerText/Factory.Cpp [code]
Com/Fundamentals/TutSamp/PerText/Factory.h [code]
Com/Fundamentals/TutSamp/PerText/PerText.Cpp [code]
Com/Fundamentals/TutSamp/PerText/PerText.h [code]
Com/Fundamentals/TutSamp/PerText/Server.Cpp [code]
Com/Fundamentals/TutSamp/PerText/Server.h [code]
Com/Fundamentals/TutSamp/PerText/TextPage.Cpp [code]
Com/Fundamentals/TutSamp/PerText/TextPage.h [code]
Com/Fundamentals/TutSamp/ReadTut/ReadTut.Cpp [code]
Com/Fundamentals/TutSamp/ReadTut/ReadTut.h [code]
Com/Fundamentals/TutSamp/Register/register.Cpp [code]
Com/Fundamentals/TutSamp/Register/register.h [code]
Com/Fundamentals/TutSamp/RemClien/RemClien.Cpp [code]
Com/Fundamentals/TutSamp/RemClien/RemClien.h [code]
Com/Fundamentals/TutSamp/RemClien/UTCRUCAR.Cpp [code]
Com/Fundamentals/TutSamp/RemClien/UTCRUCAR.h [code]
Com/Fundamentals/TutSamp/StoClien/GUIPAPER.Cpp [code]
Com/Fundamentals/TutSamp/StoClien/GUIPAPER.h [code]
Com/Fundamentals/TutSamp/StoClien/PAPFILE.Cpp [code]
Com/Fundamentals/TutSamp/StoClien/PAPFILE.h [code]
Com/Fundamentals/TutSamp/StoClien/SINK.Cpp [code]
Com/Fundamentals/TutSamp/StoClien/SINK.h [code]
Com/Fundamentals/TutSamp/StoClien/StoClien.Cpp [code]
Com/Fundamentals/TutSamp/StoClien/StoClien.h [code]
Com/Fundamentals/TutSamp/StoServe/Connect.Cpp [code]
Com/Fundamentals/TutSamp/StoServe/Connect.h [code]
Com/Fundamentals/TutSamp/StoServe/Factory.Cpp [code]
Com/Fundamentals/TutSamp/StoServe/Factory.h [code]
Com/Fundamentals/TutSamp/StoServe/PAPER.Cpp [code]
Com/Fundamentals/TutSamp/StoServe/PAPER.h [code]
Com/Fundamentals/TutSamp/StoServe/Server.Cpp [code]
Com/Fundamentals/TutSamp/StoServe/Server.h [code]
Com/Fundamentals/TutSamp/StoServe/StoServe.Cpp [code]
Com/Fundamentals/TutSamp/StoServe/StoServe.h [code]
Com/Fundamentals/WinHlprs/cDialog.Cxx [code]
Com/Fundamentals/WinHlprs/cDialog.h [code]
Com/Fundamentals/WinHlprs/cwindow.Cxx [code]
Com/Fundamentals/WinHlprs/cwindow.h [code]
Com/Fundamentals/WinHlprs/strmHelp.Cxx [code]
Com/Fundamentals/WinHlprs/strmHelp.h [code]
Com/Services/BYOT/BYOTSampleWeb/_ScriptLibrary/rsProxy.java [code]
Com/Services/BYOT/Client/BYOTTransaction/BYOTTransaction.Cpp [code]
Com/Services/BYOT/Client/BYOTTransaction/BYOTTransaction.Idl [code]
Com/Services/BYOT/Client/BYOTTransaction/BYOTtransObj.Cpp [code]
Com/Services/BYOT/Client/BYOTTransaction/BYOTtransObj.h [code]
Com/Services/BYOT/Client/BYOTTransaction/Resource.h [code]
Com/Services/BYOT/Client/BYOTTransaction/StdAfx.Cpp [code]
Com/Services/BYOT/Client/BYOTTransaction/StdAfx.h [code]
Com/Services/BYOT/Server/BYOTTxEnlister/EnlistTransaction.Cpp [code]
Com/Services/BYOT/Server/BYOTTxEnlister/EnlistTransaction.h [code]
Com/Services/BYOT/Server/BYOTTxEnlister/Resource.h [code]
Com/Services/BYOT/Server/BYOTTxEnlister/StdAfx.Cpp [code]
Com/Services/BYOT/Server/BYOTTxEnlister/StdAfx.h [code]
Com/Services/BYOT/Server/BYOTTxEnlister/TxEnlister.Cpp [code]
Com/Services/BYOT/Server/BYOTTxEnlister/TxEnlister.Idl [code]
Com/Services/Concurrency/SyncComp/Main.Cpp [code]
Com/Services/Concurrency/SyncComp/Main.h [code]
Com/Services/Concurrency/SyncComp/Resource.h [code]
Com/Services/Concurrency/SyncComp/StdAfx.Cpp [code]
Com/Services/Concurrency/SyncComp/StdAfx.h [code]
Com/Services/Concurrency/SyncComp/SyncComp.Cpp [code]
Com/Services/Concurrency/SyncComp/SyncComp.Idl [code]
Com/Services/Concurrency/SyncComp/ComSyncObject/ComSyncObject.Cpp [code]
Com/Services/Concurrency/SyncComp/ComSyncObject/ComSyncObject.Idl [code]
Com/Services/Concurrency/SyncComp/ComSyncObject/ComSyncTest.Cpp [code]
Com/Services/Concurrency/SyncComp/ComSyncObject/ComSyncTest.h [code]
Com/Services/Concurrency/SyncComp/ComSyncObject/Resource.h [code]
Com/Services/Concurrency/SyncComp/ComSyncObject/StdAfx.Cpp [code]
Com/Services/Concurrency/SyncComp/ComSyncObject/StdAfx.h [code]
Com/Services/Concurrency/SyncComp/FreeObject/FreeObject.Cpp [code]
Com/Services/Concurrency/SyncComp/FreeObject/FreeObject.Idl [code]
Com/Services/Concurrency/SyncComp/FreeObject/FreeTest.Cpp [code]
Com/Services/Concurrency/SyncComp/FreeObject/FreeTest.h [code]
Com/Services/Concurrency/SyncComp/FreeObject/Resource.h [code]
Com/Services/Concurrency/SyncComp/FreeObject/StdAfx.Cpp [code]
Com/Services/Concurrency/SyncComp/FreeObject/StdAfx.h [code]
Com/Services/Concurrency/SyncComp/STAObject/Resource.h [code]
Com/Services/Concurrency/SyncComp/STAObject/STAObject.Cpp [code]
Com/Services/Concurrency/SyncComp/STAObject/STAObject.Idl [code]
Com/Services/Concurrency/SyncComp/STAObject/STATest.Cpp [code]
Com/Services/Concurrency/SyncComp/STAObject/STATest.h [code]
Com/Services/Concurrency/SyncComp/STAObject/StdAfx.Cpp [code]
Com/Services/Concurrency/SyncComp/STAObject/StdAfx.h [code]
Com/Services/Crm/CrmDebug/CrmDebug.Cpp [code]
Com/Services/Crm/CrmDebug/CrmDebug.Idl [code]
Com/Services/Crm/CrmDebug/CrmDebugCompensator.Cpp [code]
Com/Services/Crm/CrmDebug/CrmDebugCompensator.h [code]
Com/Services/Crm/CrmDebug/DllDatax.c [code]
Com/Services/Crm/CrmDebug/DllDatax.h [code]
Com/Services/Crm/CrmDebug/Resource.h [code]
Com/Services/Crm/CrmDebug/StdAfx.Cpp [code]
Com/Services/Crm/CrmDebug/StdAfx.h [code]
Com/Services/Crm/CrmFiles/CrmFiles.Cpp [code]
Com/Services/Crm/CrmFiles/CrmFiles.Idl [code]
Com/Services/Crm/CrmFiles/CrmFilesCompensator.Cpp [code]
Com/Services/Crm/CrmFiles/CrmFilesCompensator.h [code]
Com/Services/Crm/CrmFiles/CrmFilesWorker.Cpp [code]
Com/Services/Crm/CrmFiles/CrmFilesWorker.h [code]
Com/Services/Crm/CrmFiles/DllDatax.c [code]
Com/Services/Crm/CrmFiles/DllDatax.h [code]
Com/Services/Crm/CrmFiles/Resource.h [code]
Com/Services/Crm/CrmFiles/StdAfx.Cpp [code]
Com/Services/Crm/CrmFiles/StdAfx.h [code]
Com/Services/Crm/CrmFilesTest/CrmFilesTest.Cpp [code]
Com/Services/Crm/CrmFilesTest/CrmFilesTest.Idl [code]
Com/Services/Crm/CrmFilesTest/CrmFilesTestObj.Cpp [code]
Com/Services/Crm/CrmFilesTest/CrmFilesTestObj.h [code]
Com/Services/Crm/CrmFilesTest/DllDatax.c [code]
Com/Services/Crm/CrmFilesTest/DllDatax.h [code]
Com/Services/Crm/CrmFilesTest/Resource.h [code]
Com/Services/Crm/CrmFilesTest/StdAfx.Cpp [code]
Com/Services/Crm/CrmFilesTest/StdAfx.h [code]
Com/Services/Crm/CrmMonitor/CrmMonComp.Cpp [code]
Com/Services/Crm/CrmMonitor/CrmMonComp.Idl [code]
Com/Services/Crm/CrmMonitor/CrmMonCompObj.Cpp [code]
Com/Services/Crm/CrmMonitor/CrmMonCompObj.h [code]
Com/Services/Crm/CrmMonitor/DllDatax.c [code]
Com/Services/Crm/CrmMonitor/DllDatax.h [code]
Com/Services/Crm/CrmMonitor/Resource.h [code]
Com/Services/Crm/CrmMonitor/StdAfx.Cpp [code]
Com/Services/Crm/CrmMonitor/StdAfx.h [code]
Com/Services/Crm/IDL/icrmFiles.Idl [code]
Com/Services/Events/EventNews/CascadeEC/cascade.Cpp [code]
Com/Services/Events/EventNews/CascadeEC/cascade.h [code]
Com/Services/Events/EventNews/CascadeEC/cascadeec.Cpp [code]
Com/Services/Events/EventNews/CascadeEC/cascadeec.Idl [code]
Com/Services/Events/EventNews/CascadeEC/resource.h [code]
Com/Services/Events/EventNews/CascadeEC/stdafx.Cpp [code]
Com/Services/Events/EventNews/CascadeEC/stdafx.h [code]
Com/Services/Events/EventNews/Include/news.Idl [code]
Com/Services/Events/EventNews/NewsEventClass/newsevent.Cpp [code]
Com/Services/Events/EventNews/NewsEventClass/newsevent.h [code]
Com/Services/Events/EventNews/NewsEventClass/newseventclass.Cpp [code]
Com/Services/Events/EventNews/NewsEventClass/newseventclass.Idl [code]
Com/Services/Events/EventNews/NewsEventClass/resource.h [code]
Com/Services/Events/EventNews/NewsEventClass/stdafx.Cpp [code]
Com/Services/Events/EventNews/NewsEventClass/stdafx.h [code]
Com/Services/Events/EventNews/PersistATL/newsevent.Cpp [code]
Com/Services/Events/EventNews/PersistATL/newsevent.h [code]
Com/Services/Events/EventNews/PersistATL/persistatl.Cpp [code]
Com/Services/Events/EventNews/PersistATL/persistatl.Idl [code]
Com/Services/Events/EventNews/PersistATL/resource.h [code]
Com/Services/Events/EventNews/PersistATL/stdafx.Cpp [code]
Com/Services/Events/EventNews/PersistATL/stdafx.h [code]
Com/Services/Events/EventNewsJAVA/CascadeEvent/Cascadeec/CascadeEC.java [code]
Com/Services/Events/EventNewsJAVA/CascadeEvent/Cascadeec/INewsEvent.java [code]
Com/Services/Events/EventNewsJAVA/CascadeEvent/Cascadeec/INewsEventDefault.java [code]
Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminAccessChecksLevelOptions.java [code]
Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminActivationOptions.java [code]
Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminApplicationExportOptions.java [code]
Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminApplicationInstallOptions.java [code]
Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminAuthenticationCapabilitiesOptions.java [code]
Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminAuthenticationLevelOptions.java [code]
Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminCatalog.java [code]
Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminCatalogCollection.java [code]
Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminCatalogObject.java [code]
Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminComponentFlags.java [code]
Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminErrorCodes.java [code]
Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminFileFlags.java [code]
Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminImpersonationLevelOptions.java [code]
Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminOS.java [code]
Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminServiceOptions.java [code]
Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminServiceStatusOptions.java [code]
Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminSynchronizationOptions.java [code]
Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminThreadingModels.java [code]
Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminTransactionOptions.java [code]
Com/Services/Events/EventNewsJAVA/ComAdmin/ICatalogCollection.java [code]
Com/Services/Events/EventNewsJAVA/ComAdmin/ICatalogObject.java [code]
Com/Services/Events/EventNewsJAVA/ComAdmin/ICOMAdminCatalog.java [code]
Com/Services/Events/EventNewsJAVA/NewsEvent/Helper/sampleConstants.java [code]
Com/Services/Events/EventNewsJAVA/NewsEvent/newsEventClass/INewsEvent.java [code]
Com/Services/Events/EventNewsJAVA/NewsEvent/newsEventClass/INewsEventDefault.java [code]
Com/Services/Events/EventNewsJAVA/NewsEvent/newsEventClass/NewsEvent.java [code]
Com/Services/Events/EventNewsJAVA/NewsFlash/NewsFlash.java [code]
Com/Services/Events/EventNewsJAVA/NewsSuscriber/NewsSubscriber.java [code]
Com/Services/Events/EventNewsJAVA/PersistSubs/Persistatl/INewsEvent.java [code]
Com/Services/Events/EventNewsJAVA/PersistSubs/Persistatl/INewsEventDefault.java [code]
Com/Services/Events/EventNewsJAVA/PersistSubs/Persistatl/NewsEvent.java [code]
Com/Services/Events/UserEvents/VCAcct/Account.cpp [code]
Com/Services/Events/UserEvents/VCAcct/Account.idl [code]
Com/Services/Events/UserEvents/VCAcct/CAccount.cpp [code]
Com/Services/Events/UserEvents/VCAcct/CAccount.h [code]
Com/Services/Events/UserEvents/VCAcct/Resource.h [code]
Com/Services/Events/UserEvents/VCAcct/StdAfx.cpp [code]
Com/Services/Events/UserEvents/VCAcct/StdAfx.h [code]
Com/Services/Object_Pooling/ObjectPoolingJAVA/ObjectPoolingComponent/Account/util/DatabaseSettings.java [code]
Com/Services/Object_Pooling/OPBankSample/Account.VC/Account.Cpp [code]
Com/Services/Object_Pooling/OPBankSample/Account.VC/Account.Idl [code]
Com/Services/Object_Pooling/OPBankSample/Account.VC/caccount.Cpp [code]
Com/Services/Object_Pooling/OPBankSample/Account.VC/caccount.h [code]
Com/Services/Object_Pooling/OPBankSample/Account.VC/getrec.Cpp [code]
Com/Services/Object_Pooling/OPBankSample/Account.VC/getrec.h [code]
Com/Services/Object_Pooling/OPBankSample/Account.VC/mvmoney.Cpp [code]
Com/Services/Object_Pooling/OPBankSample/Account.VC/mvmoney.h [code]
Com/Services/Object_Pooling/OPBankSample/Account.VC/resource.h [code]
Com/Services/Object_Pooling/OPBankSample/Account.VC/stdafx.Cpp [code]
Com/Services/Object_Pooling/OPBankSample/Account.VC/stdafx.h [code]
Com/Services/Object_Pooling/OPBankSample/Account.VC/unicode.h [code]
Com/Services/Object_Pooling/OPBankSample/Account.VC/updrec.Cpp [code]
Com/Services/Object_Pooling/OPBankSample/Account.VC/updrec.h [code]
Com/Services/Object_Pooling/OPBankSample/OPBank/bankdlg.Cpp [code]
Com/Services/Object_Pooling/OPBankSample/OPBank/bankdlg.h [code]
Com/Services/Object_Pooling/OPBankSample/OPBank/bankthrds.Cpp [code]
Com/Services/Object_Pooling/OPBankSample/OPBank/linkable.Cpp [code]
Com/Services/Object_Pooling/OPBankSample/OPBank/linkable.h [code]
Com/Services/Object_Pooling/OPBankSample/OPBank/OPBank.Cpp [code]
Com/Services/Object_Pooling/OPBankSample/OPBank/OPBank.Idl [code]
Com/Services/Object_Pooling/OPBankSample/OPBank/resource.h [code]
Com/Services/Object_Pooling/OPBankSample/OPBank/stdafx.Cpp [code]
Com/Services/Object_Pooling/OPBankSample/OPBank/stdafx.h [code]
Com/Services/Object_Pooling/PoolTest/PoolTest.Cpp [code]
Com/Services/Object_Pooling/PoolTest/PoolTest.h [code]
Com/Services/Object_Pooling/PoolTest/PoolTest.Idl [code]
Com/Services/Object_Pooling/PoolTest/Resource.h [code]
Com/Services/Object_Pooling/PoolTest/StdAfx.Cpp [code]
Com/Services/Object_Pooling/PoolTest/StdAfx.h [code]
Com/Services/Object_Pooling/PoolTest/TestDlg.Cpp [code]
Com/Services/Object_Pooling/PoolTest/TestDlg.h [code]
Com/Services/Object_Pooling/PoolTest/LogWriter/DllDatax.c [code]
Com/Services/Object_Pooling/PoolTest/LogWriter/DllDatax.h [code]
Com/Services/Object_Pooling/PoolTest/LogWriter/LogFile.Cpp [code]
Com/Services/Object_Pooling/PoolTest/LogWriter/LogFile.h [code]
Com/Services/Object_Pooling/PoolTest/LogWriter/LogWriter.Cpp [code]
Com/Services/Object_Pooling/PoolTest/LogWriter/LogWriter.Idl [code]
Com/Services/Object_Pooling/PoolTest/LogWriter/Resource.h [code]
Com/Services/Object_Pooling/PoolTest/LogWriter/StdAfx.Cpp [code]
Com/Services/Object_Pooling/PoolTest/LogWriter/StdAfx.h [code]
Com/Services/Queued_Components/StdAfx.Cpp [code]
Com/Services/Queued_Components/QCJAVA/Components/Helper/DatabaseSettings.java [code]
Com/Services/Queued_Components/QCJAVA/Components/qcNotify/_ShipStatus.java [code]
Com/Services/Queued_Components/QCJAVA/Components/qcNotify/INotify.java [code]
Com/Services/Queued_Components/QCJAVA/Components/qcNotify/INotifyDefault.java [code]
Com/Services/Queued_Components/QCJAVA/Components/qcNotify/Notify.java [code]
Com/Services/Queued_Components/QCJAVA/Components/qcOrder/IOrder.java [code]
Com/Services/Queued_Components/QCJAVA/Components/qcOrder/IOrderDefault.java [code]
Com/Services/Queued_Components/QCJAVA/Components/qcOrder/Order.java [code]
Com/Services/Queued_Components/QCJAVA/Components/qcShip/IShip.java [code]
Com/Services/Queued_Components/QCJAVA/Components/qcShip/IShipDefault.java [code]
Com/Services/Queued_Components/QCJAVA/Components/qcShip/Ship.java [code]
Com/Services/Queued_Components/QCSamp1/DataSourceNames.h [code]
Com/Services/Queued_Components/QCSamp1/Driver/Driver.Cpp [code]
Com/Services/Queued_Components/QCSamp1/Driver/StdAfx.Cpp [code]
Com/Services/Queued_Components/QCSamp1/Driver/StdAfx.h [code]
Com/Services/Queued_Components/QCSamp1/QCNotify/Notify.Cpp [code]
Com/Services/Queued_Components/QCSamp1/QCNotify/Notify.h [code]
Com/Services/Queued_Components/QCSamp1/QCNotify/QCNotify.Cpp [code]
Com/Services/Queued_Components/QCSamp1/QCNotify/QCNotify.Idl [code]
Com/Services/Queued_Components/QCSamp1/QCNotify/Resource.h [code]
Com/Services/Queued_Components/QCSamp1/QCNotify/StdAfx.Cpp [code]
Com/Services/Queued_Components/QCSamp1/QCNotify/StdAfx.h [code]
Com/Services/Queued_Components/QCSamp1/QCOrder/Order.Cpp [code]
Com/Services/Queued_Components/QCSamp1/QCOrder/Order.h [code]
Com/Services/Queued_Components/QCSamp1/QCOrder/processFlags.h [code]
Com/Services/Queued_Components/QCSamp1/QCOrder/QCOrder.Cpp [code]
Com/Services/Queued_Components/QCSamp1/QCOrder/QCOrder.Idl [code]
Com/Services/Queued_Components/QCSamp1/QCOrder/Resource.h [code]
Com/Services/Queued_Components/QCSamp1/QCOrder/StdAfx.Cpp [code]
Com/Services/Queued_Components/QCSamp1/QCOrder/StdAfx.h [code]
Com/Services/Queued_Components/QCSamp1/QCShip/QCShip.Cpp [code]
Com/Services/Queued_Components/QCSamp1/QCShip/QCShip.Idl [code]
Com/Services/Queued_Components/QCSamp1/QCShip/Resource.h [code]
Com/Services/Queued_Components/QCSamp1/QCShip/Ship.Cpp [code]
Com/Services/Queued_Components/QCSamp1/QCShip/Ship.h [code]
Com/Services/Queued_Components/QCSamp1/QCShip/StdAfx.Cpp [code]
Com/Services/Queued_Components/QCSamp1/QCShip/StdAfx.h [code]
Com/Services/Queued_Components/QCSamp2/DataSourceNames.h [code]
Com/Services/Queued_Components/QCSamp2/Driver/Driver.Cpp [code]
Com/Services/Queued_Components/QCSamp2/Driver/StdAfx.Cpp [code]
Com/Services/Queued_Components/QCSamp2/Driver/StdAfx.h [code]
Com/Services/Queued_Components/QCSamp2/QCNotify/Notify.Cpp [code]
Com/Services/Queued_Components/QCSamp2/QCNotify/Notify.h [code]
Com/Services/Queued_Components/QCSamp2/QCNotify/QCNotify.Cpp [code]
Com/Services/Queued_Components/QCSamp2/QCNotify/QCNotify.Idl [code]
Com/Services/Queued_Components/QCSamp2/QCNotify/Resource.h [code]
Com/Services/Queued_Components/QCSamp2/QCNotify/StdAfx.Cpp [code]
Com/Services/Queued_Components/QCSamp2/QCNotify/StdAfx.h [code]
Com/Services/Queued_Components/QCSamp2/QCOrder/Order.Cpp [code]
Com/Services/Queued_Components/QCSamp2/QCOrder/Order.h [code]
Com/Services/Queued_Components/QCSamp2/QCOrder/processFlags.h [code]
Com/Services/Queued_Components/QCSamp2/QCOrder/QCOrder.Cpp [code]
Com/Services/Queued_Components/QCSamp2/QCOrder/QCOrder.Idl [code]
Com/Services/Queued_Components/QCSamp2/QCOrder/Resource.h [code]
Com/Services/Queued_Components/QCSamp2/QCOrder/StdAfx.Cpp [code]
Com/Services/Queued_Components/QCSamp2/QCOrder/StdAfx.h [code]
Com/Services/Queued_Components/QCSamp2/QCShip2/QCShip2.Cpp [code]
Com/Services/Queued_Components/QCSamp2/QCShip2/QCShip2.Idl [code]
Com/Services/Queued_Components/QCSamp2/QCShip2/Resource.h [code]
Com/Services/Queued_Components/QCSamp2/QCShip2/Ship2.Cpp [code]
Com/Services/Queued_Components/QCSamp2/QCShip2/Ship2.h [code]
Com/Services/Queued_Components/QCSamp2/QCShip2/StdAfx.Cpp [code]
Com/Services/Queued_Components/QCSamp2/QCShip2/StdAfx.h [code]
Com/Services/Resource_Dispenser/Disp1.Cpp [code]
Com/Services/Resource_Dispenser/Disp1.Idl [code]
Com/Services/Resource_Dispenser/LDisp.Cpp [code]
Com/Services/Resource_Dispenser/LDisp.h [code]
Com/Services/Resource_Dispenser/Resource.h [code]
Com/Services/Resource_Dispenser/StdAfx.Cpp [code]
Com/Services/Resource_Dispenser/StdAfx.h [code]
Com/Services/Security/VC/Resource.h [code]
Com/Services/Security/VC/StdAfx.Cpp [code]
Com/Services/Security/VC/StdAfx.h [code]
Com/Services/Security/VC/VCSecuritySample.Cpp [code]
Com/Services/Security/VC/VCSecuritySample.Idl [code]
Com/Services/Security/VC/VCSecuritySampleCLASS.Cpp [code]
Com/Services/Security/VC/VCSecuritySampleCLASS.h [code]
Com/Services/Shared_Property_Manager/TServer/Computer.Cpp [code]
Com/Services/Shared_Property_Manager/TServer/Computer.h [code]
Com/Services/Shared_Property_Manager/TServer/Human.Cpp [code]
Com/Services/Shared_Property_Manager/TServer/Human.h [code]
Com/Services/Shared_Property_Manager/TServer/resource.h [code]
Com/Services/Shared_Property_Manager/TServer/StdAfx.Cpp [code]
Com/Services/Shared_Property_Manager/TServer/StdAfx.h [code]
Com/Services/Shared_Property_Manager/TServer/TServer.Cpp [code]
Com/Services/Shared_Property_Manager/TServer/TServer.Idl [code]
Com/Services/Transaction/DataAccess/DataAcADO/adocomponent.Cpp [code]
Com/Services/Transaction/DataAccess/DataAcADO/adocomponent.h [code]
Com/Services/Transaction/DataAccess/DataAcADO/ADOKB.Cpp [code]
Com/Services/Transaction/DataAccess/DataAcADO/ADOKB.Idl [code]
Com/Services/Transaction/DataAccess/DataAcADO/Resource.h [code]
Com/Services/Transaction/DataAccess/DataAcADO/StdAfx.Cpp [code]
Com/Services/Transaction/DataAccess/DataAcADO/StdAfx.h [code]
Com/Services/Transaction/DataAccess/DataAcOleDB/helper.h [code]
Com/Services/Transaction/DataAccess/DataAcOleDB/oledbcomponent.Cpp [code]
Com/Services/Transaction/DataAccess/DataAcOleDB/oledbcomponent.h [code]
Com/Services/Transaction/DataAccess/DataAcOleDB/OLEDBKB.Cpp [code]
Com/Services/Transaction/DataAccess/DataAcOleDB/OLEDBKB.Idl [code]
Com/Services/Transaction/DataAccess/DataAcOleDB/Resource.h [code]
Com/Services/Transaction/DataAccess/DataAcOleDB/StdAfx.Cpp [code]
Com/Services/Transaction/DataAccess/DataAcOleDB/StdAfx.h [code]
Com/Services/Transaction/DataAccess/DataAcRDO/rdocomponent.Cpp [code]
Com/Services/Transaction/DataAccess/DataAcRDO/rdocomponent.h [code]
Com/Services/Transaction/DataAccess/DataAcRDO/RDOKB.Cpp [code]
Com/Services/Transaction/DataAccess/DataAcRDO/RDOKB.Idl [code]
Com/Services/Transaction/DataAccess/DataAcRDO/Resource.h [code]
Com/Services/Transaction/DataAccess/DataAcRDO/StdAfx.Cpp [code]
Com/Services/Transaction/DataAccess/DataAcRDO/StdAfx.h [code]
Com/Services/Transaction/SampleBank/VCAcct/account.Cpp [code]
Com/Services/Transaction/SampleBank/VCAcct/account.Idl [code]
Com/Services/Transaction/SampleBank/VCAcct/caccount.Cpp [code]
Com/Services/Transaction/SampleBank/VCAcct/caccount.h [code]
Com/Services/Transaction/SampleBank/VCAcct/getreceipt.Cpp [code]
Com/Services/Transaction/SampleBank/VCAcct/getreceipt.h [code]
Com/Services/Transaction/SampleBank/VCAcct/moveMoney.Cpp [code]
Com/Services/Transaction/SampleBank/VCAcct/moveMoney.h [code]
Com/Services/Transaction/SampleBank/VCAcct/Resource.h [code]
Com/Services/Transaction/SampleBank/VCAcct/StdAfx.Cpp [code]
Com/Services/Transaction/SampleBank/VCAcct/StdAfx.h [code]
Com/Services/Transaction/SampleBank/VCAcct/Updatereceipt.Cpp [code]
Com/Services/Transaction/SampleBank/VCAcct/Updatereceipt.h [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/_ADO.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/_Collection.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/_Command.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/_Connection.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/_DynaCollection.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/_Parameter.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/_Record.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/_Recordset.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/_Stream.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ADCPROP_ASYNCTHREADPRIORITY_ENUM.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ADCPROP_AUTORECALC_ENUM.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ADCPROP_UPDATECRITERIA_ENUM.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ADOCommandConstruction.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ADOConnectionConstruction.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ADOConnectionConstruction15.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ADORecordConstruction.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ADORecordsetConstruction.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ADOStreamConstruction.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/AffectEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/BookmarkEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/CEResyncEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Command.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Command15.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/CommandTypeEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/CompareEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Connection.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Connection15.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ConnectionEvents.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ConnectionEventsVt.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ConnectModeEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ConnectOptionEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ConnectPromptEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/CopyRecordOptionsEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/CursorLocationEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/CursorOptionEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/CursorTypeEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/DataTypeEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/EditModeEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Error.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Errors.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ErrorValueEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/EventReasonEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/EventStatusEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ExecuteOptionEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Field.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Field15.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/FieldAttributeEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/FieldEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Fields.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Fields15.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Fields20.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/FilterGroupEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/GetRowsOptionEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/IRecFields.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/IsolationLevelEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/LineSeparatorEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/LockTypeEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/MarshalOptionsEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/MoveRecordOptionsEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ObjectStateEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Parameter.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ParameterAttributesEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ParameterDirectionEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Parameters.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/PersistFormatEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/PositionEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Properties.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Property.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/PropertyAttributesEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Record.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/RecordCreateOptionsEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/RecordOpenOptionsEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Recordset.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Recordset15.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Recordset20.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Recordset21.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/RecordsetEvents.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/RecordsetEventsVt.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/RecordStatusEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/RecordTypeEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ResyncEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/SaveOptionsEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/SchemaEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/SearchDirectionEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/SeekEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Stream.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/StreamOpenOptionsEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/StreamReadEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/StreamTypeEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/StreamWriteEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/StringFormatEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/XactAttributeEnum.java [code]
Com/Services/Transaction/SampleBank/vjAcct/vcAcct/CAccount.java [code]
Com/Services/Transaction/SampleBank/vjAcct/vcAcct/CGetReceipt.java [code]
Com/Services/Transaction/SampleBank/vjAcct/vcAcct/CMoveMoney.java [code]
Com/Services/Transaction/SampleBank/vjAcct/vcAcct/CUpdateReceipt.java [code]
Com/Services/Transaction/SampleBank/vjAcct/vcAcct/IAccount.java [code]
Com/Services/Transaction/SampleBank/vjAcct/vcAcct/IGetReceipt.java [code]
Com/Services/Transaction/SampleBank/vjAcct/vcAcct/IMoveMoney.java [code]
Com/Services/Transaction/SampleBank/vjAcct/vcAcct/IUpdateReceipt.java [code]
Com/StructuredStorage/Propsets/propdump.cpp [code]
Com/StructuredStorage/Propsets/stgcreatepropsetstg.cpp [code]
Com/StructuredStorage/Propsets/writeread.cpp [code]
Com/Tools/COMPlusWizard/VJ/COMPlus.java [code]
Com/Tools/COMPlusWizard/VJ/op.java [code]
Com/Tools/EntityProxy/DataServices/data.Cpp [code]
Com/Tools/EntityProxy/DataServices/data.Idl [code]
Com/Tools/EntityProxy/DataServices/dynamic.Cpp [code]
Com/Tools/EntityProxy/DataServices/dynamic.h [code]
Com/Tools/EntityProxy/DataServices/entity.Cpp [code]
Com/Tools/EntityProxy/DataServices/entity.h [code]
Com/Tools/EntityProxy/DataServices/entity_except.Cpp [code]
Com/Tools/EntityProxy/DataServices/heap.Cpp [code]
Com/Tools/EntityProxy/DataServices/heap.h [code]
Com/Tools/EntityProxy/DataServices/limits.h [code]
Com/Tools/EntityProxy/DataServices/marshalhelpers.h [code]
Com/Tools/EntityProxy/DataServices/odbcdata.Cpp [code]
Com/Tools/EntityProxy/DataServices/odbcdata.h [code]
Com/Tools/EntityProxy/DataServices/pooleddata.Cpp [code]
Com/Tools/EntityProxy/DataServices/pooleddata.h [code]
Com/Tools/EntityProxy/DataServices/proxy.Cpp [code]
Com/Tools/EntityProxy/DataServices/proxy.h [code]
Com/Tools/EntityProxy/DataServices/proxy_except.Cpp [code]
Com/Tools/EntityProxy/DataServices/resource.h [code]
Com/Tools/EntityProxy/DataServices/resultset.Cpp [code]
Com/Tools/EntityProxy/DataServices/resultset.h [code]
Com/Tools/EntityProxy/DataServices/staticmap.h [code]
Com/Tools/EntityProxy/DataServices/stdafx.Cpp [code]
Com/Tools/EntityProxy/DataServices/stdafx.h [code]
Com/Tools/EntityProxy/DataServices/string.Cpp [code]
Com/Tools/EntityProxy/DataServices/string.h [code]
Com/Tools/EntityProxy/DataServices/string_fast.Cpp [code]
Com/Tools/EntityProxy/DataServices/string_fast.h [code]
Com/Tools/EntityProxy/DataServices/utils.Cpp [code]
Com/Tools/EntityProxy/DataServices/utils.h [code]
Dataaccess/ADO/ADOVCGEN/adoheader.h [code]
Dataaccess/ADO/ADOVCGEN/advcgen.cpp [code]
Dataaccess/ADO/ADOVCGEN/advcgen.h [code]
Dataaccess/ADO/ADOVCGEN/advcgendlg.cpp [code]
Dataaccess/ADO/ADOVCGEN/advcgendlg.h [code]
Dataaccess/ADO/ADOVCGEN/datagrid.cpp [code]
Dataaccess/ADO/ADOVCGEN/datagrid.h [code]
Dataaccess/ADO/ADOVCGEN/resource.h [code]
Dataaccess/ADO/ADOVCGEN/stdafx.cpp [code]
Dataaccess/ADO/ADOVCGEN/stdafx.h [code]
Dataaccess/ADO/isapi/adoisapi.cpp [code]
Dataaccess/ADO/shell/adovbs.inc [code]
Dataaccess/odbc/odbcsql/odbcsql.c [code]
Dataaccess/odbc/quiktest/autotest.h [code]
Dataaccess/odbc/quiktest/custom.c [code]
Dataaccess/odbc/quiktest/custom.h [code]
Dataaccess/odbc/quiktest/dllstub.c [code]
Dataaccess/odbc/quiktest/quiktest.c [code]
Dataaccess/odbc/quiktest/quiktest.h [code]
Dataaccess/oledb/internetpublishing/ippsample/Guids.Cpp [code]
Dataaccess/oledb/internetpublishing/ippsample/IAuth.Cpp [code]
Dataaccess/oledb/internetpublishing/ippsample/Sample1.Cpp [code]
Dataaccess/oledb/internetpublishing/ippsample/Sample1.h [code]
Dataaccess/oledb/internetpublishing/ippsample/StdAfx.Cpp [code]
Dataaccess/oledb/internetpublishing/ippsample/StdAfx.h [code]
Dataaccess/oledb/omniprov/source/cdbfile.cpp [code]
Dataaccess/oledb/omniprov/source/cdbfile.h [code]
Dataaccess/oledb/omniprov/source/crow.cpp [code]
Dataaccess/oledb/omniprov/source/crow.h [code]
Dataaccess/oledb/omniprov/source/irowsetchange.h [code]
Dataaccess/oledb/omniprov/source/irowsetscroll.h [code]
Dataaccess/oledb/omniprov/source/msomniprovds.h [code]
Dataaccess/oledb/omniprov/source/msomniprovrs.cpp [code]
Dataaccess/oledb/omniprov/source/msomniprovrs.h [code]
Dataaccess/oledb/omniprov/source/msomniprovsess.h [code]
Dataaccess/oledb/omniprov/source/resource.h [code]
Dataaccess/oledb/omniprov/source/rncp.h [code]
Dataaccess/oledb/omniprov/source/stdafx.cpp [code]
Dataaccess/oledb/omniprov/source/stdafx.h [code]
Dataaccess/oledb/omniprov/source/theprovider.cpp [code]
Dataaccess/oledb/omniprov/source/theprovider.h [code]
Dataaccess/oledb/omniprov/source/theprovider.idl [code]
Dataaccess/oledb/prsample/command.cpp [code]
Dataaccess/oledb/prsample/datasource.cpp [code]
Dataaccess/oledb/prsample/enum.cpp [code]
Dataaccess/oledb/prsample/error.cpp [code]
Dataaccess/oledb/prsample/main.cpp [code]
Dataaccess/oledb/prsample/prsample.h [code]
Dataaccess/oledb/prsample/resource.h [code]
Dataaccess/oledb/prsample/rowset.cpp [code]
Dataaccess/oledb/prsample/session.cpp [code]
Dataaccess/oledb/rowsetviewer/cbase.cpp [code]
Dataaccess/oledb/rowsetviewer/cbase.h [code]
Dataaccess/oledb/rowsetviewer/cbinder.cpp [code]
Dataaccess/oledb/rowsetviewer/cbinder.h [code]
Dataaccess/oledb/rowsetviewer/ccommand.cpp [code]
Dataaccess/oledb/rowsetviewer/ccommand.h [code]
Dataaccess/oledb/rowsetviewer/cdatalinks.cpp [code]
Dataaccess/oledb/rowsetviewer/cdatalinks.h [code]
Dataaccess/oledb/rowsetviewer/cdataset.cpp [code]
Dataaccess/oledb/rowsetviewer/cdataset.h [code]
Dataaccess/oledb/rowsetviewer/cdatasource.cpp [code]
Dataaccess/oledb/rowsetviewer/cdatasource.h [code]
Dataaccess/oledb/rowsetviewer/cdialog.cpp [code]
Dataaccess/oledb/rowsetviewer/cdialog.h [code]
Dataaccess/oledb/rowsetviewer/cdialoglite.cpp [code]
Dataaccess/oledb/rowsetviewer/cdialoglite.h [code]
Dataaccess/oledb/rowsetviewer/cenum.cpp [code]
Dataaccess/oledb/rowsetviewer/cenum.h [code]
Dataaccess/oledb/rowsetviewer/cerror.cpp [code]
Dataaccess/oledb/rowsetviewer/cerror.h [code]
Dataaccess/oledb/rowsetviewer/clistener.cpp [code]
Dataaccess/oledb/rowsetviewer/clistener.h [code]
Dataaccess/oledb/rowsetviewer/cmainwindow.cpp [code]
Dataaccess/oledb/rowsetviewer/cmainwindow.h [code]
Dataaccess/oledb/rowsetviewer/cmdichild.cpp [code]
Dataaccess/oledb/rowsetviewer/cmdichild.h [code]
Dataaccess/oledb/rowsetviewer/cmultipleresults.h [code]
Dataaccess/oledb/rowsetviewer/cmutipleresults.cpp [code]
Dataaccess/oledb/rowsetviewer/cobjtree.cpp [code]
Dataaccess/oledb/rowsetviewer/cobjtree.h [code]
Dataaccess/oledb/rowsetviewer/common.cpp [code]
Dataaccess/oledb/rowsetviewer/common.h [code]
Dataaccess/oledb/rowsetviewer/coptions.cpp [code]
Dataaccess/oledb/rowsetviewer/coptions.h [code]
Dataaccess/oledb/rowsetviewer/crow.cpp [code]
Dataaccess/oledb/rowsetviewer/crow.h [code]
Dataaccess/oledb/rowsetviewer/crowposition.cpp [code]
Dataaccess/oledb/rowsetviewer/crowposition.h [code]
Dataaccess/oledb/rowsetviewer/crowset.cpp [code]
Dataaccess/oledb/rowsetviewer/crowset.h [code]
Dataaccess/oledb/rowsetviewer/csession.cpp [code]
Dataaccess/oledb/rowsetviewer/csession.h [code]
Dataaccess/oledb/rowsetviewer/cstream.cpp [code]
Dataaccess/oledb/rowsetviewer/cstream.h [code]
Dataaccess/oledb/rowsetviewer/ctrace.cpp [code]
Dataaccess/oledb/rowsetviewer/ctrace.h [code]
Dataaccess/oledb/rowsetviewer/ctransaction.cpp [code]
Dataaccess/oledb/rowsetviewer/ctransaction.h [code]
Dataaccess/oledb/rowsetviewer/cwinapp.cpp [code]
Dataaccess/oledb/rowsetviewer/cwinapp.h [code]
Dataaccess/oledb/rowsetviewer/error.cpp [code]
Dataaccess/oledb/rowsetviewer/error.h [code]
Dataaccess/oledb/rowsetviewer/headers.cpp [code]
Dataaccess/oledb/rowsetviewer/headers.h [code]
Dataaccess/oledb/rowsetviewer/list.h [code]
Dataaccess/oledb/rowsetviewer/property.cpp [code]
Dataaccess/oledb/rowsetviewer/property.h [code]
Dataaccess/oledb/rowsetviewer/resource.h [code]
Dataaccess/oledb/rowsetviewer/spy.cpp [code]
Dataaccess/oledb/rowsetviewer/spy.h [code]
Dataaccess/oledb/rowsetviewer/version.h [code]
Dataaccess/oledb/sampclnt/dump.cpp [code]
Dataaccess/oledb/sampclnt/resource.h [code]
Dataaccess/oledb/sampclnt/sampclnt.cpp [code]
Dataaccess/oledb/sampclnt/sampclnt.h [code]
Dataaccess/oledb/sampclnt/sampver.h [code]
Dataaccess/oledb/sampprov/accessor.cpp [code]
Dataaccess/oledb/sampprov/accessor.h [code]
Dataaccess/oledb/sampprov/asserts.cpp [code]
Dataaccess/oledb/sampprov/asserts.h [code]
Dataaccess/oledb/sampprov/baseobj.cpp [code]
Dataaccess/oledb/sampprov/baseobj.h [code]
Dataaccess/oledb/sampprov/binder.cpp [code]
Dataaccess/oledb/sampprov/binder.h [code]
Dataaccess/oledb/sampprov/bitarray.cpp [code]
Dataaccess/oledb/sampprov/bitarray.h [code]
Dataaccess/oledb/sampprov/classfac.cpp [code]
Dataaccess/oledb/sampprov/classfac.h [code]
Dataaccess/oledb/sampprov/colinfo.cpp [code]
Dataaccess/oledb/sampprov/command.cpp [code]
Dataaccess/oledb/sampprov/command.h [code]
Dataaccess/oledb/sampprov/common.cpp [code]
Dataaccess/oledb/sampprov/common.h [code]
Dataaccess/oledb/sampprov/crtsess.cpp [code]
Dataaccess/oledb/sampprov/cvttype.cpp [code]
Dataaccess/oledb/sampprov/datasrc.cpp [code]
Dataaccess/oledb/sampprov/datasrc.h [code]
Dataaccess/oledb/sampprov/dbinit.cpp [code]
Dataaccess/oledb/sampprov/dbprop.cpp [code]
Dataaccess/oledb/sampprov/dbsess.cpp [code]
Dataaccess/oledb/sampprov/dbsess.h [code]
Dataaccess/oledb/sampprov/extbuff.cpp [code]
Dataaccess/oledb/sampprov/extbuff.h [code]
Dataaccess/oledb/sampprov/fileidx.cpp [code]
Dataaccess/oledb/sampprov/fileidx.h [code]
Dataaccess/oledb/sampprov/fileio.cpp [code]
Dataaccess/oledb/sampprov/fileio.h [code]
Dataaccess/oledb/sampprov/globals.cpp [code]
Dataaccess/oledb/sampprov/guids.h [code]
Dataaccess/oledb/sampprov/hashtbl.cpp [code]
Dataaccess/oledb/sampprov/hashtbl.h [code]
Dataaccess/oledb/sampprov/headers.cpp [code]
Dataaccess/oledb/sampprov/headers.h [code]
Dataaccess/oledb/sampprov/igetrow.cpp [code]
Dataaccess/oledb/sampprov/irowiden.cpp [code]
Dataaccess/oledb/sampprov/irowset.cpp [code]
Dataaccess/oledb/sampprov/opnrowst.cpp [code]
Dataaccess/oledb/sampprov/persist.cpp [code]
Dataaccess/oledb/sampprov/resource.h [code]
Dataaccess/oledb/sampprov/row.cpp [code]
Dataaccess/oledb/sampprov/row.h [code]
Dataaccess/oledb/sampprov/rowchng.cpp [code]
Dataaccess/oledb/sampprov/rowinfo.cpp [code]
Dataaccess/oledb/sampprov/rowset.cpp [code]
Dataaccess/oledb/sampprov/rowset.h [code]
Dataaccess/oledb/sampprov/sampprov.h [code]
Dataaccess/oledb/sampprov/sampver.h [code]
Dataaccess/oledb/sampprov/stream.cpp [code]
Dataaccess/oledb/sampprov/stream.h [code]
Dataaccess/oledb/sampprov/utilprop.cpp [code]
Dataaccess/oledb/sampprov/utilprop.h [code]
Dataaccess/oledb/tablecopy/common.cpp [code]
Dataaccess/oledb/tablecopy/common.h [code]
Dataaccess/oledb/tablecopy/datasource.cpp [code]
Dataaccess/oledb/tablecopy/datasource.h [code]
Dataaccess/oledb/tablecopy/error.cpp [code]
Dataaccess/oledb/tablecopy/error.h [code]
Dataaccess/oledb/tablecopy/list.h [code]
Dataaccess/oledb/tablecopy/progress.cpp [code]
Dataaccess/oledb/tablecopy/progress.h [code]
Dataaccess/oledb/tablecopy/property.cpp [code]
Dataaccess/oledb/tablecopy/property.h [code]
Dataaccess/oledb/tablecopy/resource.h [code]
Dataaccess/oledb/tablecopy/spy.cpp [code]
Dataaccess/oledb/tablecopy/spy.h [code]
Dataaccess/oledb/tablecopy/step1.cpp [code]
Dataaccess/oledb/tablecopy/step2.cpp [code]
Dataaccess/oledb/tablecopy/step3.cpp [code]
Dataaccess/oledb/tablecopy/step4.cpp [code]
Dataaccess/oledb/tablecopy/table.cpp [code]
Dataaccess/oledb/tablecopy/table.h [code]
Dataaccess/oledb/tablecopy/tablecopy.cpp [code]
Dataaccess/oledb/tablecopy/tablecopy.h [code]
Dataaccess/oledb/tablecopy/version.h [code]
Dataaccess/oledb/tablecopy/winmain.cpp [code]
Dataaccess/oledb/tablecopy/winmain.h [code]
Dataaccess/oledb/tablecopy/wizard.cpp [code]
Dataaccess/oledb/tablecopy/wizard.h [code]
Dataaccess/osp/vc/cexlist.h [code]
Dataaccess/osp/vc/common.cpp [code]
Dataaccess/osp/vc/common.h [code]
Dataaccess/osp/vc/myclassfactory.cpp [code]
Dataaccess/osp/vc/myclassfactory.h [code]
Dataaccess/osp/vc/mydatasource.cpp [code]
Dataaccess/osp/vc/mydatasource.h [code]
Dataaccess/osp/vc/myospobject.cpp [code]
Dataaccess/osp/vc/myospobject.h [code]
Dataaccess/osp/vj/mydatasource.java [code]
Dataaccess/osp/vj/myospobject.java [code]
Dataaccess/rds/ADOVBS.inc [code]
Dataaccess/rds/handler/vc/adoid.h [code]
Dataaccess/rds/handler/vc/adoint.h [code]
Dataaccess/rds/handler/vc/const.cpp [code]
Dataaccess/rds/handler/vc/handler.cpp [code]
Dataaccess/rds/handler/vc/handler.h [code]
Dataaccess/rds/handler/vc/msdfhdl.idl [code]
Dataaccess/rds/handler/vc/msdfmap.cpp [code]
Dataaccess/rds/handler/vc/msdfmap.idl [code]
Dataaccess/rds/handler/vc/resource.h [code]
Dataaccess/rds/handler/vc/stdafx.cpp [code]
Dataaccess/rds/handler/vc/stdafx.h [code]
Dataaccess/rds/handler/vc/stdafxx.cpp [code]
Dataaccess/rds/handler/vc/util.cpp [code]
Dataaccess/rds/handler/vc/util.h [code]
Dataaccess/rds/handler/vc/utiltest.cpp [code]
Multimedia/Audio/MciPlay/MciPlay.c [code]
Multimedia/Audio/MciPlay/MciPlay.h [code]
Multimedia/Audio/MidiPlyr/Debug.c [code]
Multimedia/Audio/MidiPlyr/Debug.h [code]
Multimedia/Audio/MidiPlyr/GLOBAL.h [code]
Multimedia/Audio/MidiPlyr/MainWND.c [code]
Multimedia/Audio/MidiPlyr/MidiPlyr.c [code]
Multimedia/Audio/MidiPlyr/MidiPlyr.h [code]
Multimedia/Audio/MidiPlyr/MulDiv32.h [code]
Multimedia/Audio/MidiPlyr/SEQ.h [code]
Multimedia/Audio/MidiPlyr/SEQUENCE.c [code]
Multimedia/Audio/MidiPlyr/SMF.c [code]
Multimedia/Audio/MidiPlyr/SMF.h [code]
Multimedia/Audio/MidiPlyr/SMFI.h [code]
Multimedia/Audio/MidiPlyr/SMFREAD.c [code]
Multimedia/Audio/MidiPlyr/TIMEWND.c [code]
Multimedia/Audio/MidiPlyr/UIUTILS.c [code]
Multimedia/Audio/multichan/childview.cpp [code]
Multimedia/Audio/multichan/childview.h [code]
Multimedia/Audio/multichan/dlgdest.cpp [code]
Multimedia/Audio/multichan/dlgdest.h [code]
Multimedia/Audio/multichan/dlgsrc.cpp [code]
Multimedia/Audio/multichan/dlgsrc.h [code]
Multimedia/Audio/multichan/mainfrm.cpp [code]
Multimedia/Audio/multichan/mainfrm.h [code]
Multimedia/Audio/multichan/multichan.cpp [code]
Multimedia/Audio/multichan/multichan.h [code]
Multimedia/Audio/multichan/resource.h [code]
Multimedia/Audio/multichan/stdafx.cpp [code]
Multimedia/Audio/multichan/stdafx.h [code]
Multimedia/Audio/multichan/wave.cpp [code]
Multimedia/Audio/multichan/wave.h [code]
Multimedia/Gdi/Fonts/FontView/Dialogs.c [code]
Multimedia/Gdi/Fonts/FontView/Display.c [code]
Multimedia/Gdi/Fonts/FontView/FontView.c [code]
Multimedia/Gdi/Fonts/FontView/FontView.h [code]
Multimedia/Gdi/Fonts/FontView/Status.c [code]
Multimedia/Gdi/Fonts/FontView/Tools.c [code]
Multimedia/Gdi/Fonts/GridFont/APP.Cxx [code]
Multimedia/Gdi/Fonts/GridFont/APP.h [code]
Multimedia/Gdi/Fonts/GridFont/APP.Hxx [code]
Multimedia/Gdi/Fonts/GridFont/Box.Cxx [code]
Multimedia/Gdi/Fonts/GridFont/Box.Hxx [code]
Multimedia/Gdi/Fonts/GridFont/Canvas.Hxx [code]
Multimedia/Gdi/Fonts/GridFont/Cset.Cxx [code]
Multimedia/Gdi/Fonts/GridFont/Cset.Hxx [code]
Multimedia/Gdi/Fonts/GridFont/Font.Cxx [code]
Multimedia/Gdi/Fonts/GridFont/Font.Hxx [code]
Multimedia/Gdi/Fonts/GridFont/Grid.Cxx [code]
Multimedia/Gdi/Fonts/GridFont/Grid.Hxx [code]
Multimedia/Gdi/Fonts/GridFont/Resource.h [code]
Multimedia/Gdi/Fonts/GridFont/View.Cxx [code]
Multimedia/Gdi/Fonts/GridFont/View.Hxx [code]
Multimedia/Gdi/fontsize/Fontsize.c [code]
Multimedia/Gdi/GdiDemo/Bounce.c [code]
Multimedia/Gdi/GdiDemo/Bounce.h [code]
Multimedia/Gdi/GdiDemo/Dialog.c [code]
Multimedia/Gdi/GdiDemo/Draw.c [code]
Multimedia/Gdi/GdiDemo/Draw.h [code]
Multimedia/Gdi/GdiDemo/GdiDemo.c [code]
Multimedia/Gdi/GdiDemo/GdiDemo.h [code]
Multimedia/Gdi/GdiDemo/Init.c [code]
Multimedia/Gdi/GdiDemo/Maze.c [code]
Multimedia/Gdi/GdiDemo/Maze.h [code]
Multimedia/Gdi/GdiDemo/Poly.c [code]
Multimedia/Gdi/GdiDemo/Poly.h [code]
Multimedia/Gdi/GdiDemo/Wininfo.c [code]
Multimedia/Gdi/GdiDemo/XForm.c [code]
Multimedia/Gdi/GdiDemo/XForm.h [code]
Multimedia/Gdi/Metafile/MfEdit/MfEdit.c [code]
Multimedia/Gdi/Metafile/MfEdit/MfEdit.h [code]
Multimedia/Gdi/Metafile/MfEdit/Precomp.h [code]
Multimedia/Gdi/palette/Mypal.c [code]
Multimedia/Gdi/palette/Mypal.h [code]
Multimedia/Gdi/Printer/Common.h [code]
Multimedia/Gdi/Printer/Enumprt.c [code]
Multimedia/Gdi/Printer/Enumprt.h [code]
Multimedia/Gdi/Printer/Getcaps.c [code]
Multimedia/Gdi/Printer/Getcaps.h [code]
Multimedia/Gdi/Printer/Getpdriv.c [code]
Multimedia/Gdi/Printer/Getpdriv.h [code]
Multimedia/Gdi/Printer/Paint.c [code]
Multimedia/Gdi/Printer/Paint.h [code]
Multimedia/Gdi/Printer/Printer.c [code]
Multimedia/Gdi/Printer/Printer.h [code]
Multimedia/Gdi/Printer/Resource.h [code]
Multimedia/Gdi/PrintJob/dialogs.c [code]
Multimedia/Gdi/PrintJob/dialogs.h [code]
Multimedia/Gdi/PrintJob/errors.c [code]
Multimedia/Gdi/PrintJob/errors.h [code]
Multimedia/Gdi/PrintJob/printjob.c [code]
Multimedia/Gdi/PrintJob/printjob.h [code]
Multimedia/Gdi/PrintJob/quecore.h [code]
Multimedia/Gdi/PrintJob/quelist.c [code]
Multimedia/Gdi/PrintJob/quelist.h [code]
Multimedia/Gdi/PrintJob/queue.c [code]
Multimedia/Gdi/PrintJob/queue.h [code]
Multimedia/Gdi/PrintJob/resource.h [code]
Multimedia/Gdi/PrintJob/threads.c [code]
Multimedia/Gdi/PrintJob/threads.h [code]
Multimedia/Gdi/SetDisp/Resource.h [code]
Multimedia/Gdi/SetDisp/SetDisp.c [code]
Multimedia/Gdi/SetDisp/SetDisp.h [code]
Multimedia/Gdi/TextFx/Fx.c [code]
Multimedia/Gdi/TextFx/Fx.h [code]
Multimedia/Gdi/TextFx/GuidE.c [code]
Multimedia/Gdi/TextFx/GuidE.h [code]
Multimedia/Gdi/TextFx/Resource.h [code]
Multimedia/Gdi/TextFx/TextFx.c [code]
Multimedia/Gdi/TextFx/TextFx.h [code]
Multimedia/Gdi/ViewDIB/DIBSectn.c [code]
Multimedia/Gdi/ViewDIB/DIBSectn.h [code]
Multimedia/Gdi/ViewDIB/OpenDIB.c [code]
Multimedia/Gdi/ViewDIB/OpenDIB.h [code]
Multimedia/Gdi/ViewDIB/Resource.h [code]
Multimedia/Gdi/ViewDIB/ViewDIB.c [code]
Multimedia/Gdi/WinCap32/Copy.c [code]
Multimedia/Gdi/WinCap32/Dialogs.c [code]
Multimedia/Gdi/WinCap32/Dialogs.h [code]
Multimedia/Gdi/WinCap32/Dibapi.h [code]
Multimedia/Gdi/WinCap32/Dibdll.h [code]
Multimedia/Gdi/WinCap32/Dibutil.c [code]
Multimedia/Gdi/WinCap32/Dibutil.h [code]
Multimedia/Gdi/WinCap32/Dlgopen.c [code]
Multimedia/Gdi/WinCap32/Dllinit.c [code]
Multimedia/Gdi/WinCap32/Errors.c [code]
Multimedia/Gdi/WinCap32/File.c [code]
Multimedia/Gdi/WinCap32/Hook.c [code]
Multimedia/Gdi/WinCap32/Print.c [code]
Multimedia/Gdi/WinCap32/Resource.h [code]
Multimedia/Gdi/WinCap32/Wepcode.c [code]
Multimedia/Gdi/WinCap32/WinCap.c [code]
Multimedia/Gdi/WinCap32/WinCap.h [code]
Multimedia/Gdi/WinNT/HalfTone/halftone.c [code]
Multimedia/Gdi/WinNT/HalfTone/resource.h [code]
Multimedia/Gdi/WinNT/PlgBlt/BitMap.c [code]
Multimedia/Gdi/WinNT/PlgBlt/BitMap.h [code]
Multimedia/Gdi/WinNT/PlgBlt/PlgBlt.c [code]
Multimedia/Gdi/WinNT/PlgBlt/PlgBlt.h [code]
Multimedia/Gdi/WinNT/PlgBlt/Track.c [code]
Multimedia/Gdi/WinNT/PlgBlt/Track.h [code]
Multimedia/Gdi/WinNT/WxForm/WxForm.c [code]
Multimedia/Gdi/WinNT/WxForm/WxForm.h [code]
Multimedia/wia/GetImage/BitmapUtil.cpp [code]
Multimedia/wia/GetImage/BitmapUtil.h [code]
Multimedia/wia/GetImage/BitmapWnd.cpp [code]
Multimedia/wia/GetImage/BitmapWnd.h [code]
Multimedia/wia/GetImage/DataCallback.cpp [code]
Multimedia/wia/GetImage/DataCallback.h [code]
Multimedia/wia/GetImage/EventCallback.cpp [code]
Multimedia/wia/GetImage/EventCallback.h [code]
Multimedia/wia/GetImage/GetImage.cpp [code]
Multimedia/wia/GetImage/MainWnd.cpp [code]
Multimedia/wia/GetImage/MainWnd.h [code]
Multimedia/wia/GetImage/ProgressDlg.cpp [code]
Multimedia/wia/GetImage/ProgressDlg.h [code]
Multimedia/wia/GetImage/resource.h [code]
Multimedia/wia/GetImage/StdAfx.cpp [code]
Multimedia/wia/GetImage/StdAfx.h [code]
Multimedia/wia/GetImage/WiaWrap.cpp [code]
Multimedia/wia/GetImage/WiaWrap.h [code]
Multimedia/wia/wiassamp/wiassamp.cpp [code]
Multimedia/WindowsMediaServices9/Authentication/Authenticate.cpp [code]
Multimedia/WindowsMediaServices9/Authentication/Authenticate.idl [code]
Multimedia/WindowsMediaServices9/Authentication/AuthenticateAdmin.cpp [code]
Multimedia/WindowsMediaServices9/Authentication/AuthenticateAdmin.h [code]
Multimedia/WindowsMediaServices9/Authentication/AuthenticateContext.cpp [code]
Multimedia/WindowsMediaServices9/Authentication/AuthenticateContext.h [code]
Multimedia/WindowsMediaServices9/Authentication/AuthenticatePlugin.cpp [code]
Multimedia/WindowsMediaServices9/Authentication/AuthenticatePlugin.h [code]
Multimedia/WindowsMediaServices9/Authentication/resource.h [code]
Multimedia/WindowsMediaServices9/Authentication/StdAfx.cpp [code]
Multimedia/WindowsMediaServices9/Authentication/StdAfx.h [code]
Multimedia/WindowsMediaServices9/Authorization/dbauth.cpp [code]
Multimedia/WindowsMediaServices9/Authorization/dbauth.idl [code]
Multimedia/WindowsMediaServices9/Authorization/dbauthadmin.cpp [code]
Multimedia/WindowsMediaServices9/Authorization/dbauthadmin.h [code]
Multimedia/WindowsMediaServices9/Authorization/dbauthplugin.cpp [code]
Multimedia/WindowsMediaServices9/Authorization/dbauthplugin.h [code]
Multimedia/WindowsMediaServices9/Authorization/resource.h [code]
Multimedia/WindowsMediaServices9/Authorization/stdafx.cpp [code]
Multimedia/WindowsMediaServices9/Authorization/stdafx.h [code]
Multimedia/WindowsMediaServices9/CacheProxy/cplusplus/proxyplugin.cpp [code]
Multimedia/WindowsMediaServices9/CacheProxy/cplusplus/proxyplugin.idl [code]
Multimedia/WindowsMediaServices9/CacheProxy/cplusplus/proxypluginimpl.cpp [code]
Multimedia/WindowsMediaServices9/CacheProxy/cplusplus/proxypluginimpl.h [code]
Multimedia/WindowsMediaServices9/CacheProxy/cplusplus/Resource.h [code]
Multimedia/WindowsMediaServices9/CacheProxy/cplusplus/StdAfx.cpp [code]
Multimedia/WindowsMediaServices9/CacheProxy/cplusplus/StdAfx.h [code]
Multimedia/WindowsMediaServices9/CacheProxy/csharp/AssemblyInfo.cs [code]
Multimedia/WindowsMediaServices9/CacheProxy/csharp/cacheproxysampleplugin.cs [code]
Multimedia/WindowsMediaServices9/CacheProxy/csharp/Class1.cs [code]
Multimedia/WindowsMediaServices9/CacheProxy/csharp/PluginAdmin.cs [code]
Multimedia/WindowsMediaServices9/DataSource/resource.h [code]
Multimedia/WindowsMediaServices9/DataSource/sdksamplestorageplugin.cpp [code]
Multimedia/WindowsMediaServices9/DataSource/sdksamplestorageplugin.idl [code]
Multimedia/WindowsMediaServices9/DataSource/sdksamplestoragesystem.cpp [code]
Multimedia/WindowsMediaServices9/DataSource/sdksamplestoragesystem.h [code]
Multimedia/WindowsMediaServices9/DataSource/stdafx.cpp [code]
Multimedia/WindowsMediaServices9/DataSource/stdafx.h [code]
Multimedia/WindowsMediaServices9/EventNotification/ContextAdmin.cpp [code]
Multimedia/WindowsMediaServices9/EventNotification/ContextAdmin.h [code]
Multimedia/WindowsMediaServices9/EventNotification/ContextDll.cpp [code]
Multimedia/WindowsMediaServices9/EventNotification/ContextDll.idl [code]
Multimedia/WindowsMediaServices9/EventNotification/ContextPlugin.cpp [code]
Multimedia/WindowsMediaServices9/EventNotification/ContextPlugin.h [code]
Multimedia/WindowsMediaServices9/EventNotification/Resource.h [code]
Multimedia/WindowsMediaServices9/EventNotification/StdAfx.cpp [code]
Multimedia/WindowsMediaServices9/EventNotification/StdAfx.h [code]
Multimedia/WindowsMediaServices9/EventNotification/ContextSamplePropPage/ContextSamplePropPage.cpp [code]
Multimedia/WindowsMediaServices9/EventNotification/ContextSamplePropPage/ContextSamplePropPage.idl [code]
Multimedia/WindowsMediaServices9/EventNotification/ContextSamplePropPage/ContextSamplePropPageImpl.cpp [code]
Multimedia/WindowsMediaServices9/EventNotification/ContextSamplePropPage/ContextSamplePropPageImpl.h [code]
Multimedia/WindowsMediaServices9/EventNotification/ContextSamplePropPage/resource.h [code]
Multimedia/WindowsMediaServices9/EventNotification/ContextSamplePropPage/stdafx.h [code]
Multimedia/WindowsMediaServices9/Playlist/dlldatax.h [code]
Multimedia/WindowsMediaServices9/Playlist/resource.h [code]
Multimedia/WindowsMediaServices9/Playlist/SDKSamplePlaylistParser.cpp [code]
Multimedia/WindowsMediaServices9/Playlist/SDKSamplePlaylistParser.h [code]
Multimedia/WindowsMediaServices9/Playlist/SDKSamplePlaylistPlugin.cpp [code]
Multimedia/WindowsMediaServices9/Playlist/SDKSamplePlaylistPlugin.idl [code]
Multimedia/WindowsMediaServices9/Playlist/StdAfx.cpp [code]
Multimedia/WindowsMediaServices9/Playlist/StdAfx.h [code]
NetDS/ActiveDirectory/PropSheetHost/DataObj.cpp [code]
NetDS/ActiveDirectory/PropSheetHost/Main.cpp [code]
NetDS/ActiveDirectory/PropSheetHost/PropSheetHost.cpp [code]
NetDS/ActiveDirectory/PropSheetHost/PropSheetHost.h [code]
NetDS/ActiveDirectory/PropSheetHost/stdafx.cpp [code]
NetDS/ActiveDirectory/PropSheetHost/stdafx.h [code]
NetDS/ADSI/DevGuide/banner.inc [code]
NetDS/ADSI/samples/activedir/addgroup/vc/main.cpp [code]
NetDS/ADSI/samples/activedir/adevent/ADEvent.cpp [code]
NetDS/ADSI/samples/activedir/adevent/adevent.h [code]
NetDS/ADSI/samples/activedir/attributes/vc/attributes.cpp [code]
NetDS/ADSI/samples/activedir/bindtoparent/vc/bindtoparent.cpp [code]
NetDS/ADSI/samples/activedir/createuser/vc/CreateUserHelpers.cpp [code]
NetDS/ADSI/samples/activedir/createuser/vc/CreateUserHelpers.h [code]
NetDS/ADSI/samples/activedir/createuser/vc/main.cpp [code]
NetDS/ADSI/samples/activedir/createuser/vc/UserProps.cpp [code]
NetDS/ADSI/samples/activedir/createuser/vc/UserProps.h [code]
NetDS/ADSI/samples/activedir/credentials/VC/Credentials.cpp [code]
NetDS/ADSI/samples/activedir/credentials/VC/StdAfx.cpp [code]
NetDS/ADSI/samples/activedir/credentials/VC/StdAfx.h [code]
NetDS/ADSI/samples/activedir/gcallusers/vc/gcallusers.cpp [code]
NetDS/ADSI/samples/activedir/getdomainmode/vc/getdomainmode.cpp [code]
NetDS/ADSI/samples/activedir/getschemainfo/vc/getschemainfo.cpp [code]
NetDS/ADSI/samples/activedir/guidbind/vc/ADSIhelpers.cpp [code]
NetDS/ADSI/samples/activedir/guidbind/vc/ADSIhelpers.h [code]
NetDS/ADSI/samples/activedir/guidbind/vc/main.cpp [code]
NetDS/ADSI/samples/activedir/OtherWKO/vc/otherwko.cpp [code]
NetDS/ADSI/samples/activedir/OtherWKO/vc/otherwko1.cpp [code]
NetDS/ADSI/samples/activedir/PropertyList/vc/ADSIhelpers.cpp [code]
NetDS/ADSI/samples/activedir/PropertyList/vc/ADSIhelpers.h [code]
NetDS/ADSI/samples/activedir/PropertyList/vc/main.cpp [code]
NetDS/ADSI/samples/activedir/QueryUsers/vc/queryusers.cpp [code]
NetDS/ADSI/samples/activedir/RootDSE/VC/RootDSE.cpp [code]
NetDS/ADSI/samples/activedir/RootDSE/VC/StdAfx.cpp [code]
NetDS/ADSI/samples/activedir/RootDSE/VC/StdAfx.h [code]
NetDS/ADSI/samples/activedir/SID/vc/objectSid.cpp [code]
NetDS/ADSI/samples/activedir/User/vc/iasuser.cpp [code]
NetDS/ADSI/samples/activedir/WKGUID/vc/wkguid.cpp [code]
NetDS/ADSI/samples/DSUI/scpext/scpcmenu/dsmenu.cpp [code]
NetDS/ADSI/samples/DSUI/scpext/scpcmenu/dsmenu.h [code]
NetDS/ADSI/samples/DSUI/scpext/scpcmenu/resource.h [code]
NetDS/ADSI/samples/DSUI/scpext/scpcmenu/SCPCMenu.cpp [code]
NetDS/ADSI/samples/DSUI/scpext/scpcmenu/SCPCMenu.h [code]
NetDS/ADSI/samples/DSUI/scpext/scpcmenu/scpcmenuui.cpp [code]
NetDS/ADSI/samples/DSUI/scpext/scpcmenu/scpcmenuui.h [code]
NetDS/ADSI/samples/DSUI/scpext/scpcmenu/StdAfx.cpp [code]
NetDS/ADSI/samples/DSUI/scpext/scpcmenu/StdAfx.h [code]
NetDS/ADSI/samples/DSUI/scpext/scpproppage/resource.h [code]
NetDS/ADSI/samples/DSUI/scpext/scpproppage/SCP.cpp [code]
NetDS/ADSI/samples/DSUI/scpext/scpproppage/SCP.h [code]
NetDS/ADSI/samples/DSUI/scpext/scpproppage/SCPProppage.cpp [code]
NetDS/ADSI/samples/DSUI/scpext/scpproppage/SCPProppage.h [code]
NetDS/ADSI/samples/DSUI/scpext/scpproppage/SCPUI.cpp [code]
NetDS/ADSI/samples/DSUI/scpext/scpproppage/SCPUI.h [code]
NetDS/ADSI/samples/DSUI/scpext/scpproppage/StdAfx.cpp [code]
NetDS/ADSI/samples/DSUI/scpext/scpproppage/StdAfx.h [code]
NetDS/ADSI/samples/DSUI/scpext/scpproppage/util.cpp [code]
NetDS/ADSI/samples/DSUI/scpext/scpproppage/util.h [code]
NetDS/ADSI/samples/DSUI/scpext/scpwizard/resource.h [code]
NetDS/ADSI/samples/DSUI/scpext/scpwizard/SCPPageUI.cpp [code]
NetDS/ADSI/samples/DSUI/scpext/scpwizard/SCPPageUI.h [code]
NetDS/ADSI/samples/DSUI/scpext/scpwizard/SCPWiz.cpp [code]
NetDS/ADSI/samples/DSUI/scpext/scpwizard/SCPWiz.h [code]
NetDS/ADSI/samples/DSUI/scpext/scpwizard/SCPWizard.cpp [code]
NetDS/ADSI/samples/DSUI/scpext/scpwizard/SCPWizard.h [code]
NetDS/ADSI/samples/DSUI/scpext/scpwizard/StdAfx.cpp [code]
NetDS/ADSI/samples/DSUI/scpext/scpwizard/StdAfx.h [code]
NetDS/ADSI/samples/DSUI/scpext/scpwizard/util.cpp [code]
NetDS/ADSI/samples/DSUI/scpext/scpwizard/util.h [code]
NetDS/ADSI/samples/DSUI/userext/userproppage/proppageuser.cpp [code]
NetDS/ADSI/samples/DSUI/userext/userproppage/proppageuser.h [code]
NetDS/ADSI/samples/DSUI/userext/userproppage/proppageuserui.cpp [code]
NetDS/ADSI/samples/DSUI/userext/userproppage/proppageuserui.h [code]
NetDS/ADSI/samples/DSUI/userext/userproppage/resource.h [code]
NetDS/ADSI/samples/DSUI/userext/userproppage/stdafx.cpp [code]
NetDS/ADSI/samples/DSUI/userext/userproppage/stdafx.h [code]
NetDS/ADSI/samples/DSUI/userext/userproppage/userproppage.cpp [code]
NetDS/ADSI/samples/DSUI/userext/userproppage/userproppage.h [code]
NetDS/ADSI/samples/DSUI/userext/userproppage/util.cpp [code]
NetDS/ADSI/samples/DSUI/userext/userproppage/util.h [code]
NetDS/ADSI/samples/DSUI/userext/userwizard/extpageuser.cpp [code]
NetDS/ADSI/samples/DSUI/userext/userwizard/extpageuser.h [code]
NetDS/ADSI/samples/DSUI/userext/userwizard/resource.h [code]
NetDS/ADSI/samples/DSUI/userext/userwizard/stdafx.cpp [code]
NetDS/ADSI/samples/DSUI/userext/userwizard/stdafx.h [code]
NetDS/ADSI/samples/DSUI/userext/userwizard/userwizard.cpp [code]
NetDS/ADSI/samples/DSUI/userext/userwizard/userwizard.h [code]
NetDS/ADSI/samples/DSUI/userext/userwizard/util.cpp [code]
NetDS/ADSI/samples/DSUI/userext/userwizard/util.h [code]
NetDS/ADSI/samples/DSUI/userext/userwizard/wizext.cpp [code]
NetDS/ADSI/samples/DSUI/userext/userwizard/wizext.h [code]
NetDS/ADSI/samples/Extension/tutorial/step1/ADsFirstExt.cpp [code]
NetDS/ADSI/samples/Extension/tutorial/step1/ADsFirstExt.h [code]
NetDS/ADSI/samples/Extension/tutorial/step1/ADsFirstExt.idl [code]
NetDS/ADSI/samples/Extension/tutorial/step1/ADsFirstExt_i.c [code]
NetDS/ADSI/samples/Extension/tutorial/step1/ADsFirstExt_p.c [code]
NetDS/ADSI/samples/Extension/tutorial/step1/dlldata.c [code]
NetDS/ADSI/samples/Extension/tutorial/step1/HelloWorld.cpp [code]
NetDS/ADSI/samples/Extension/tutorial/step1/HelloWorld.h [code]
NetDS/ADSI/samples/Extension/tutorial/step1/resource.h [code]
NetDS/ADSI/samples/Extension/tutorial/step1/StdAfx.cpp [code]
NetDS/ADSI/samples/Extension/tutorial/step1/StdAfx.h [code]
NetDS/ADSI/samples/Extension/tutorial/step2/ADsFirstExt.cpp [code]
NetDS/ADSI/samples/Extension/tutorial/step2/ADsFirstExt.h [code]
NetDS/ADSI/samples/Extension/tutorial/step2/ADsFirstExt.idl [code]
NetDS/ADSI/samples/Extension/tutorial/step2/ADsFirstExt_i.c [code]
NetDS/ADSI/samples/Extension/tutorial/step2/ADsFirstExt_p.c [code]
NetDS/ADSI/samples/Extension/tutorial/step2/dlldata.c [code]
NetDS/ADSI/samples/Extension/tutorial/step2/HelloWorld.cpp [code]
NetDS/ADSI/samples/Extension/tutorial/step2/HelloWorld.h [code]
NetDS/ADSI/samples/Extension/tutorial/step2/resource.h [code]
NetDS/ADSI/samples/Extension/tutorial/step2/StdAfx.cpp [code]
NetDS/ADSI/samples/Extension/tutorial/step2/StdAfx.h [code]
NetDS/ADSI/samples/General/ADQI/ADQI.cpp [code]
NetDS/ADSI/samples/General/ADQI/ADQI.h [code]
NetDS/ADSI/samples/General/ADQI/ADQIDlg.cpp [code]
NetDS/ADSI/samples/General/ADQI/ADQIDlg.h [code]
NetDS/ADSI/samples/General/ADQI/ADs.cpp [code]
NetDS/ADSI/samples/General/ADQI/ADs.h [code]
NetDS/ADSI/samples/General/ADQI/adscontainer.cpp [code]
NetDS/ADSI/samples/General/ADQI/adscontainer.h [code]
NetDS/ADSI/samples/General/ADQI/ADsLargeInteger.cpp [code]
NetDS/ADSI/samples/General/ADQI/ADsLargeInteger.h [code]
NetDS/ADSI/samples/General/ADQI/ADsOpenDSObject.cpp [code]
NetDS/ADSI/samples/General/ADQI/ADsOpenDSObject.h [code]
NetDS/ADSI/samples/General/ADQI/ADsPropertyList.cpp [code]
NetDS/ADSI/samples/General/ADQI/ADsPropertyList.h [code]
NetDS/ADSI/samples/General/ADQI/DirectoryObject.cpp [code]
NetDS/ADSI/samples/General/ADQI/DirectoryObject.h [code]
NetDS/ADSI/samples/General/ADQI/DirectorySearch.cpp [code]
NetDS/ADSI/samples/General/ADQI/DirectorySearch.h [code]
NetDS/ADSI/samples/General/ADQI/helper.cpp [code]
NetDS/ADSI/samples/General/ADQI/helper.h [code]
NetDS/ADSI/samples/General/ADQI/resource.h [code]
NetDS/ADSI/samples/General/ADQI/security.cpp [code]
NetDS/ADSI/samples/General/ADQI/security.h [code]
NetDS/ADSI/samples/General/ADQI/StdAfx.cpp [code]
NetDS/ADSI/samples/General/ADQI/StdAfx.h [code]
NetDS/ADSI/samples/General/ADsCmd/dump.cxx [code]
NetDS/ADSI/samples/General/ADsCmd/enum.cxx [code]
NetDS/ADSI/samples/General/ADsCmd/main.cxx [code]
NetDS/ADSI/samples/General/ADsCmd/main.hxx [code]
NetDS/ADSI/samples/General/ADsCmd/util.cxx [code]
NetDS/ADSI/samples/General/ADsError/ADsError.cpp [code]
NetDS/ADSI/samples/General/ADsError/ADsError.h [code]
NetDS/ADSI/samples/General/ADsError/ADsError.idl [code]
NetDS/ADSI/samples/General/ADsError/ADsError_i.c [code]
NetDS/ADSI/samples/General/ADsError/ADsError_p.c [code]
NetDS/ADSI/samples/General/ADsError/dlldata.c [code]
NetDS/ADSI/samples/General/ADsError/IADsError.cpp [code]
NetDS/ADSI/samples/General/ADsError/IADsError.h [code]
NetDS/ADSI/samples/General/ADsError/resource.h [code]
NetDS/ADSI/samples/General/ADsError/StdAfx.cpp [code]
NetDS/ADSI/samples/General/ADsError/StdAfx.h [code]
NetDS/ADSI/samples/General/ADSIDump/AdsiDump.cpp [code]
NetDS/ADSI/samples/General/ADSIDump/StdAfx.cpp [code]
NetDS/ADSI/samples/General/ADSIDump/StdAfx.h [code]
NetDS/ADSI/samples/General/DsBrowse/bitmaps/afxres.h [code]
NetDS/ADSI/samples/General/DsBrowse/bitmaps/resource.h [code]
NetDS/ADSI/samples/General/DsBrowse/bitmaps/winres.h [code]
NetDS/ADSI/samples/General/DsSrch/main.cxx [code]
NetDS/ADSI/samples/General/DsSrch/main.hxx [code]
NetDS/ADSI/samples/General/DsSrch/util.cxx [code]
NetDS/ADSI/samples/Start/Binding/vc/Binding.cpp [code]
NetDS/ADSI/samples/Start/Binding/vc/StdAfx.cpp [code]
NetDS/ADSI/samples/Start/Binding/vc/StdAfx.h [code]
NetDS/ADSI/samples/Start/Child/vc/Child.cpp [code]
NetDS/ADSI/samples/Start/Child/vc/StdAfx.cpp [code]
NetDS/ADSI/samples/Start/Child/vc/StdAfx.h [code]
NetDS/ADSI/samples/Start/Create/vc/Create.cpp [code]
NetDS/ADSI/samples/Start/Create/vc/StdAfx.cpp [code]
NetDS/ADSI/samples/Start/Create/vc/StdAfx.h [code]
NetDS/ADSI/samples/Start/Delete/vc/Delete.cpp [code]
NetDS/ADSI/samples/Start/Delete/vc/StdAfx.cpp [code]
NetDS/ADSI/samples/Start/Delete/vc/StdAfx.h [code]
NetDS/ADSI/samples/Start/Enum/vc/Enum.cpp [code]
NetDS/ADSI/samples/Start/Enum/vc/StdAfx.cpp [code]
NetDS/ADSI/samples/Start/Enum/vc/StdAfx.h [code]
NetDS/ADSI/samples/Start/Filter/vc/Filter.cpp [code]
NetDS/ADSI/samples/Start/Filter/vc/StdAfx.cpp [code]
NetDS/ADSI/samples/Start/Filter/vc/StdAfx.h [code]
NetDS/ADSI/samples/Start/First/vc/First.cpp [code]
NetDS/ADSI/samples/Start/First/vc/StdAfx.cpp [code]
NetDS/ADSI/samples/Start/First/vc/StdAfx.h [code]
NetDS/ADSI/samples/Start/Move/vc/Move.cpp [code]
NetDS/ADSI/samples/Start/Move/vc/StdAfx.cpp [code]
NetDS/ADSI/samples/Start/Move/vc/StdAfx.h [code]
NetDS/ADSI/samples/Start/Parent/vc/Parent.cpp [code]
NetDS/ADSI/samples/Start/Parent/vc/StdAfx.cpp [code]
NetDS/ADSI/samples/Start/Parent/vc/StdAfx.h [code]
NetDS/ADSI/samples/Start/Read/vc/Read.cpp [code]
NetDS/ADSI/samples/Start/Read/vc/StdAfx.cpp [code]
NetDS/ADSI/samples/Start/Read/vc/StdAfx.h [code]
NetDS/ADSI/samples/Start/Rename/vc/Rename.cpp [code]
NetDS/ADSI/samples/Start/Rename/vc/StdAfx.cpp [code]
NetDS/ADSI/samples/Start/Rename/vc/StdAfx.h [code]
NetDS/ADSI/samples/Start/Schema/vc/Schema.cpp [code]
NetDS/ADSI/samples/Start/Schema/vc/StdAfx.cpp [code]
NetDS/ADSI/samples/Start/Schema/vc/StdAfx.h [code]
NetDS/ADSI/samples/Start/Search/vc/Search.cpp [code]
NetDS/ADSI/samples/Start/Search/vc/StdAfx.cpp [code]
NetDS/ADSI/samples/Start/Search/vc/StdAfx.h [code]
NetDS/ADSI/samples/Start/Write/vc/StdAfx.cpp [code]
NetDS/ADSI/samples/Start/Write/vc/StdAfx.h [code]
NetDS/ADSI/samples/Start/Write/vc/Write.cpp [code]
NetDS/Bluetooth/bthcxn.cpp [code]
NetDS/DHCP/DHCPNotify/dhcpnotify.cpp [code]
NetDS/DHCP/DHCPPersist/dhcppersist.cpp [code]
NetDS/DHCP/DHCPRequest/dhcprequest.cpp [code]
NetDS/DNS/DNSQuery/DNSQuery.Cpp [code]
NetDS/DNS/ModifyRecords/ModifyRecords.cpp [code]
NetDS/fax/PrintSdi/FaxDlg.Cpp [code]
NetDS/fax/PrintSdi/FaxDlg.h [code]
NetDS/fax/PrintSdi/MainFrm.Cpp [code]
NetDS/fax/PrintSdi/MainFrm.h [code]
NetDS/fax/PrintSdi/NewDocDlg.Cpp [code]
NetDS/fax/PrintSdi/NewDocDlg.h [code]
NetDS/fax/PrintSdi/PrintSdi.Cpp [code]
NetDS/fax/PrintSdi/PrintSdi.h [code]
NetDS/fax/PrintSdi/PrintSdiDoc.h [code]
NetDS/fax/PrintSdi/PrintSdiView.h [code]
NetDS/fax/PrintSdi/PrintSdiVw.Cpp [code]
NetDS/fax/PrintSdi/Resource.h [code]
NetDS/fax/PrintSdi/SdiDoc.Cpp [code]
NetDS/fax/PrintSdi/StdAfx.Cpp [code]
NetDS/fax/PrintSdi/StdAfx.h [code]
NetDS/fax/SampleFSP/Macros.h [code]
NetDS/fax/SampleFSP/NewFsp.c [code]
NetDS/fax/SampleFSP/NewFsp.h [code]
NetDS/fax/SampleFSP/Reg.c [code]
NetDS/fax/SampleFSP/Reg.h [code]
NetDS/fax/SampleFSP/Resource.h [code]
NetDS/fax/SampleFSP/Util.c [code]
NetDS/fax/SampleRoute/FaxSiren.Cpp [code]
NetDS/fax/SampleRoute/Resource.h [code]
NetDS/fax/SampleSend/Resource.h [code]
NetDS/fax/SampleSend/Simple.c [code]
NetDS/GQos/QosEvent/ChkQos.Cpp [code]
NetDS/GQos/QosEvent/Findsp.Cpp [code]
NetDS/GQos/QosEvent/GetQos.Cpp [code]
NetDS/GQos/QosEvent/PrintQos.Cpp [code]
NetDS/GQos/QosEvent/QosEvent.Cpp [code]
NetDS/GQos/QosEvent/QosEvent.h [code]
NetDS/GQos/QosEvent/Receiver.Cpp [code]
NetDS/GQos/QosEvent/Sender.Cpp [code]
NetDS/GQos/QosEvent/SetQos.Cpp [code]
NetDS/GQos/Qoslist/Qoslist.Cpp [code]
NetDS/http/server/main.c [code]
NetDS/http/server/precomp.h [code]
NetDS/http/serviceconfig/iplisten.c [code]
NetDS/http/serviceconfig/main.c [code]
NetDS/http/serviceconfig/makefile.inc [code]
NetDS/http/serviceconfig/precomp.h [code]
NetDS/http/serviceconfig/ssl.c [code]
NetDS/http/serviceconfig/url.c [code]
NetDS/IAS/DialIn/DialIn.c [code]
NetDS/IAS/MapName/dllmain.c [code]
NetDS/IAS/MapName/mapname.c [code]
NetDS/IAS/MapName/multisz.c [code]
NetDS/IAS/MapName/multisz.h [code]
NetDS/IAS/MapName/radutil.c [code]
NetDS/IAS/MapName/radutil.h [code]
NetDS/IPHelp/EnableRouter/enablerouter.c [code]
NetDS/IPHelp/IPArp/IPArp.Cpp [code]
NetDS/IPHelp/IPArp/IPArp.h [code]
NetDS/IPHelp/IPChange/IPChange.Cpp [code]
NetDS/IPHelp/IPConfig/IPConfig.Cpp [code]
NetDS/IPHelp/IPRenew/IPRenew.Cpp [code]
NetDS/IPHelp/IPRoute/IPRoute.Cpp [code]
NetDS/IPHelp/IPRoute/IPRoute.h [code]
NetDS/IPHelp/IPStat/IPStat.Cpp [code]
NetDS/IPHelp/IPStat/IPStat.h [code]
NetDS/MessageQueuing/c_draw/DisDraw.Cpp [code]
NetDS/MessageQueuing/c_draw/DisDraw.h [code]
NetDS/MessageQueuing/c_draw/DrawArea.Cpp [code]
NetDS/MessageQueuing/c_draw/DrawArea.h [code]
NetDS/MessageQueuing/c_draw/DrawDlg.Cpp [code]
NetDS/MessageQueuing/c_draw/DrawDlg.h [code]
NetDS/MessageQueuing/c_draw/LoginDlg.Cpp [code]
NetDS/MessageQueuing/c_draw/LoginDlg.h [code]
NetDS/MessageQueuing/c_draw/Resource.h [code]
NetDS/MessageQueuing/c_draw/StdAfx.Cpp [code]
NetDS/MessageQueuing/c_draw/StdAfx.h [code]
NetDS/MessageQueuing/csharp_draw/assemblyinfo.cs [code]
NetDS/MessageQueuing/csharp_draw/form1.cs [code]
NetDS/MessageQueuing/csharp_draw/inputbox.cs [code]
NetDS/MessageQueuing/DirEncrypt/DirEncrypt.Cpp [code]
NetDS/MessageQueuing/Imp_Draw/DrawArea.Cpp [code]
NetDS/MessageQueuing/Imp_Draw/DrawArea.h [code]
NetDS/MessageQueuing/Imp_Draw/EvHandle.Cpp [code]
NetDS/MessageQueuing/Imp_Draw/EvHandle.h [code]
NetDS/MessageQueuing/Imp_Draw/Imp_Dlg.Cpp [code]
NetDS/MessageQueuing/Imp_Draw/Imp_Dlg.h [code]
NetDS/MessageQueuing/Imp_Draw/Imp_Draw.Cpp [code]
NetDS/MessageQueuing/Imp_Draw/Imp_Draw.h [code]
NetDS/MessageQueuing/Imp_Draw/LoginDlg.Cpp [code]
NetDS/MessageQueuing/Imp_Draw/LoginDlg.h [code]
NetDS/MessageQueuing/Imp_Draw/Resource.h [code]
NetDS/MessageQueuing/Imp_Draw/StdAfx.Cpp [code]
NetDS/MessageQueuing/Imp_Draw/StdAfx.h [code]
NetDS/MessageQueuing/MqApiTst/CLOSQDlg.Cpp [code]
NetDS/MessageQueuing/MqApiTst/CLOSQDlg.h [code]
NetDS/MessageQueuing/MqApiTst/CRQDlg.Cpp [code]
NetDS/MessageQueuing/MqApiTst/CRQDlg.h [code]
NetDS/MessageQueuing/MqApiTst/DELQDlg.Cpp [code]
NetDS/MessageQueuing/MqApiTst/DELQDlg.h [code]
NetDS/MessageQueuing/MqApiTst/LocatDlg.Cpp [code]
NetDS/MessageQueuing/MqApiTst/LocatDlg.h [code]
NetDS/MessageQueuing/MqApiTst/MainFrm.Cpp [code]
NetDS/MessageQueuing/MqApiTst/MainFrm.h [code]
NetDS/MessageQueuing/MqApiTst/MqApiTst.Cpp [code]
NetDS/MessageQueuing/MqApiTst/MqApiTst.h [code]
NetDS/MessageQueuing/MqApiTst/OpenQDlg.Cpp [code]
NetDS/MessageQueuing/MqApiTst/OpenQDlg.h [code]
NetDS/MessageQueuing/MqApiTst/RecvMDlg.Cpp [code]
NetDS/MessageQueuing/MqApiTst/RecvMDlg.h [code]
NetDS/MessageQueuing/MqApiTst/RecWDlg.Cpp [code]
NetDS/MessageQueuing/MqApiTst/RecWDlg.h [code]
NetDS/MessageQueuing/MqApiTst/Resource.h [code]
NetDS/MessageQueuing/MqApiTst/SendMDlg.Cpp [code]
NetDS/MessageQueuing/MqApiTst/SendMDlg.h [code]
NetDS/MessageQueuing/MqApiTst/StdAfx.Cpp [code]
NetDS/MessageQueuing/MqApiTst/StdAfx.h [code]
NetDS/MessageQueuing/MqApiTst/TestDoc.Cpp [code]
NetDS/MessageQueuing/MqApiTst/TestDoc.h [code]
NetDS/MessageQueuing/MqApiTst/TestVIEW.Cpp [code]
NetDS/MessageQueuing/MqApiTst/TestVIEW.h [code]
NetDS/MessageQueuing/mqf_draw/connectdlg.cpp [code]
NetDS/MessageQueuing/mqf_draw/connectdlg.h [code]
NetDS/MessageQueuing/mqf_draw/drawarea.cpp [code]
NetDS/MessageQueuing/mqf_draw/drawarea.h [code]
NetDS/MessageQueuing/mqf_draw/drawdlg.cpp [code]
NetDS/MessageQueuing/mqf_draw/drawdlg.h [code]
NetDS/MessageQueuing/mqf_draw/logindlg.cpp [code]
NetDS/MessageQueuing/mqf_draw/logindlg.h [code]
NetDS/MessageQueuing/mqf_draw/mqfdraw.cpp [code]
NetDS/MessageQueuing/mqf_draw/mqfdraw.h [code]
NetDS/MessageQueuing/mqf_draw/resource.h [code]
NetDS/MessageQueuing/mqf_draw/stdafx.cpp [code]
NetDS/MessageQueuing/mqf_draw/stdafx.h [code]
NetDS/MessageQueuing/MQPers/QueueDef.h [code]
NetDS/MessageQueuing/MQPers/GraphObj/DllDatax.c [code]
NetDS/MessageQueuing/MQPers/GraphObj/DllDatax.h [code]
NetDS/MessageQueuing/MQPers/GraphObj/GraphObj.Cpp [code]
NetDS/MessageQueuing/MQPers/GraphObj/GraphObj.Idl [code]
NetDS/MessageQueuing/MQPers/GraphObj/IPersistStm.h [code]
NetDS/MessageQueuing/MQPers/GraphObj/Line.Cpp [code]
NetDS/MessageQueuing/MQPers/GraphObj/Line.h [code]
NetDS/MessageQueuing/MQPers/GraphObj/Point.Cpp [code]
NetDS/MessageQueuing/MQPers/GraphObj/Point.h [code]
NetDS/MessageQueuing/MQPers/GraphObj/Resource.h [code]
NetDS/MessageQueuing/MQPers/GraphObj/StdAfx.Cpp [code]
NetDS/MessageQueuing/MQPers/GraphObj/StdAfx.h [code]
NetDS/MessageQueuing/MQPers/Rcv/Main.Cpp [code]
NetDS/MessageQueuing/MQPers/Rcv/StdAfx.Cpp [code]
NetDS/MessageQueuing/MQPers/Rcv/StdAfx.h [code]
NetDS/MessageQueuing/MQPers/Snd/Main.Cpp [code]
NetDS/MessageQueuing/MQPers/Snd/StdAfx.Cpp [code]
NetDS/MessageQueuing/MQPers/Snd/StdAfx.h [code]
NetDS/MessageQueuing/MQPort/MQPort.Cpp [code]
NetDS/MessageQueuing/MqTestOA/Guids.Cpp [code]
NetDS/MessageQueuing/MqTestOA/MqTestOA.Cpp [code]
NetDS/MessageQueuing/MqTrans/MqTrans.Cpp [code]
NetDS/MessageQueuing/MSMQTest/MSMQTest.c [code]
NetDS/NetMon/experts/blrplate/blrplate.cpp [code]
NetDS/NetMon/experts/blrplate/blrplate.h [code]
NetDS/NetMon/experts/blrplate/config.cpp [code]
NetDS/NetMon/experts/blrplate/resrc1.h [code]
NetDS/NetMon/parsers/blrplate/blrplate.c [code]
NetDS/NetMon/parsers/blrplate/blrplate.h [code]
NetDS/netshell/nshsamp.cpp [code]
NetDS/netshell/nshsamp.h [code]
NetDS/netshell/sampinterface.cpp [code]
NetDS/netshell/sample.cpp [code]
NetDS/netshell/subcontext.cpp [code]
NetDS/Ras/ConnectionManager/cmsample.cpp [code]
NetDS/Ras/customdial/customdial.cpp [code]
NetDS/Ras/customdial/customdialreg.cpp [code]
NetDS/Ras/customdial/resource.h [code]
NetDS/Ras/CustomScript/CustomEntry/customentry.c [code]
NetDS/Ras/PhoneEntry/PhoneEntry.c [code]
NetDS/Ras/PhoneEntry/Resource.h [code]
NetDS/Ras/Ras_Statistics/RasGetConnectionStatistics.c [code]
NetDS/Ras/RasDial/c/RasDial.c [code]
NetDS/Ras/RasDialAsync/RasDialAsync.c [code]
NetDS/Ras/RasEnumConnections/c/RasEnumConnections.c [code]
NetDS/Ras/RasEnumDevices/c/RasEnumDevices.c [code]
NetDS/Ras/RasEnumEntries/c/RasEnumentries.c [code]
NetDS/Ras/WinNT/RasHost/RasHost.Cpp [code]
NetDS/Ras/WinNT/RasHost/RasHost.h [code]
NetDS/Ras/WinNT/RasHost/Resource.h [code]
NetDS/RPC/AsyncRPC/AsyncRPC.Idl [code]
NetDS/RPC/AsyncRPC/AsyncRPCc.c [code]
NetDS/RPC/AsyncRPC/AsyncRPCp.c [code]
NetDS/RPC/AsyncRPC/AsyncRPCs.c [code]
NetDS/RPC/ClUuid/ClUuid.Idl [code]
NetDS/RPC/ClUuid/ClUuidc.c [code]
NetDS/RPC/ClUuid/ClUuidp.c [code]
NetDS/RPC/ClUuid/ClUuids.c [code]
NetDS/RPC/Data/DUnion/DUnion.Idl [code]
NetDS/RPC/Data/DUnion/DUnionc.c [code]
NetDS/RPC/Data/DUnion/DUnionp.c [code]
NetDS/RPC/Data/DUnion/DUnions.c [code]
NetDS/RPC/Data/InOut/InOut.Idl [code]
NetDS/RPC/Data/InOut/InOutc.c [code]
NetDS/RPC/Data/InOut/InOutp.c [code]
NetDS/RPC/Data/InOut/InOuts.c [code]
NetDS/RPC/Data/repas/Repas.Idl [code]
NetDS/RPC/Data/repas/Repasc.c [code]
NetDS/RPC/Data/repas/Repascu.c [code]
NetDS/RPC/Data/repas/Repasp.c [code]
NetDS/RPC/Data/repas/Repass.c [code]
NetDS/RPC/Data/repas/Repassu.c [code]
NetDS/RPC/Data/Xmit/Xmit.Idl [code]
NetDS/RPC/Data/Xmit/Xmitc.c [code]
NetDS/RPC/Data/Xmit/Xmitp.c [code]
NetDS/RPC/Data/Xmit/Xmits.c [code]
NetDS/RPC/Data/Xmit/Xmitu.c [code]
NetDS/RPC/Data/Xmit/Xmitu.h [code]
NetDS/RPC/Dynept/Dynept.Idl [code]
NetDS/RPC/Dynept/Dyneptc.c [code]
NetDS/RPC/Dynept/Dyneptp.c [code]
NetDS/RPC/Dynept/Dynepts.c [code]
NetDS/RPC/DynOut/DynOut.Idl [code]
NetDS/RPC/DynOut/DynOutc.c [code]
NetDS/RPC/DynOut/DynOutp.c [code]
NetDS/RPC/DynOut/DynOuts.c [code]
NetDS/RPC/FileRep/FileRepAsyncPipe/common.cpp [code]
NetDS/RPC/FileRep/FileRepAsyncPipe/common.h [code]
NetDS/RPC/FileRep/FileRepAsyncPipe/DbgMsg.cpp [code]
NetDS/RPC/FileRep/FileRepAsyncPipe/DbgMsg.h [code]
NetDS/RPC/FileRep/FileRepAsyncPipe/FileRep.cpp [code]
NetDS/RPC/FileRep/FileRepAsyncPipe/FileRepClient.idl [code]
NetDS/RPC/FileRep/FileRepAsyncPipe/FileRepClientProc.cpp [code]
NetDS/RPC/FileRep/FileRepAsyncPipe/FileRepServer.cpp [code]
NetDS/RPC/FileRep/FileRepAsyncPipe/FileRepServer.idl [code]
NetDS/RPC/FileRep/FileRepAsyncPipe/FileRepServerProc.cpp [code]
NetDS/RPC/FileRep/FileRepAsyncPipe/FileRepService.cpp [code]
NetDS/RPC/FileRep/FileRepAsyncPipe/Prof.cpp [code]
NetDS/RPC/FileRep/FileRepAsyncPipe/Prof.h [code]
NetDS/RPC/FileRep/FileRepAsyncPipe/Resources.cpp [code]
NetDS/RPC/FileRep/FileRepAsyncPipe/Resources.h [code]
NetDS/RPC/FileRep/FileRepAsyncPipe/Service.cpp [code]
NetDS/RPC/FileRep/FileRepAsyncPipe/Service.h [code]
NetDS/RPC/FileRep/filerepmultiuser/common.cpp [code]
NetDS/RPC/FileRep/filerepmultiuser/common.h [code]
NetDS/RPC/FileRep/filerepmultiuser/dbgmsg.cpp [code]
NetDS/RPC/FileRep/filerepmultiuser/dbgmsg.h [code]
NetDS/RPC/FileRep/filerepmultiuser/filerep.cpp [code]
NetDS/RPC/FileRep/filerepmultiuser/filerepclient.idl [code]
NetDS/RPC/FileRep/filerepmultiuser/filerepclientproc.cpp [code]
NetDS/RPC/FileRep/filerepmultiuser/filerepserver.idl [code]
NetDS/RPC/FileRep/filerepmultiuser/filerepserverproc.cpp [code]
NetDS/RPC/FileRep/filerepmultiuser/filerepservice.cpp [code]
NetDS/RPC/FileRep/filerepmultiuser/prof.cpp [code]
NetDS/RPC/FileRep/filerepmultiuser/prof.h [code]
NetDS/RPC/FileRep/filerepmultiuser/resources.cpp [code]
NetDS/RPC/FileRep/filerepmultiuser/resources.h [code]
NetDS/RPC/FileRep/filerepmultiuser/service.cpp [code]
NetDS/RPC/FileRep/filerepmultiuser/service.h [code]
NetDS/RPC/FileRep/filerepsecure/common.cpp [code]
NetDS/RPC/FileRep/filerepsecure/common.h [code]
NetDS/RPC/FileRep/filerepsecure/filerep.cpp [code]
NetDS/RPC/FileRep/filerepsecure/filerepclient.idl [code]
NetDS/RPC/FileRep/filerepsecure/filerepclientproc.cpp [code]
NetDS/RPC/FileRep/filerepsecure/filerepserver.idl [code]
NetDS/RPC/FileRep/filerepsecure/filerepserverproc.cpp [code]
NetDS/RPC/FileRep/filerepsecure/filerepservice.cpp [code]
NetDS/RPC/FileRep/filerepsecure/prof.cpp [code]
NetDS/RPC/FileRep/filerepsecure/prof.h [code]
NetDS/RPC/FileRep/filerepsecure/service.cpp [code]
NetDS/RPC/FileRep/filerepsecure/service.h [code]
NetDS/RPC/FileRep/filerepsimple/common.cpp [code]
NetDS/RPC/FileRep/filerepsimple/common.h [code]
NetDS/RPC/FileRep/filerepsimple/filerep.cpp [code]
NetDS/RPC/FileRep/filerepsimple/filerepclient.idl [code]
NetDS/RPC/FileRep/filerepsimple/filerepclientproc.cpp [code]
NetDS/RPC/FileRep/filerepsimple/filerepserver.cpp [code]
NetDS/RPC/FileRep/filerepsimple/filerepserver.idl [code]
NetDS/RPC/FileRep/filerepsimple/filerepserverproc.cpp [code]
NetDS/RPC/FileRep/filerepsimple/filerepservice.cpp [code]
NetDS/RPC/FileRep/filerepsimple/prof.cpp [code]
NetDS/RPC/FileRep/filerepsimple/prof.h [code]
NetDS/RPC/FileRep/filerepsimple/service.cpp [code]
NetDS/RPC/FileRep/filerepsimple/service.h [code]
NetDS/RPC/Handles/cxhndl/Cxhndl.Idl [code]
NetDS/RPC/Handles/cxhndl/Cxhndlc.c [code]
NetDS/RPC/Handles/cxhndl/Cxhndlp.c [code]
NetDS/RPC/Handles/cxhndl/Cxhndls.c [code]
NetDS/RPC/Handles/usrdef/Usrdef.Idl [code]
NetDS/RPC/Handles/usrdef/Usrdefc.c [code]
NetDS/RPC/Handles/usrdef/Usrdefp.c [code]
NetDS/RPC/Handles/usrdef/Usrdefs.c [code]
NetDS/RPC/Hello/Hello.Idl [code]
NetDS/RPC/Hello/Helloc.c [code]
NetDS/RPC/Hello/Hellop.c [code]
NetDS/RPC/Hello/Hellos.c [code]
NetDS/RPC/Pickle/Picklp/Picklp.Idl [code]
NetDS/RPC/Pickle/Picklp/Picklpc.c [code]
NetDS/RPC/Pickle/Picklt/Picklt.Idl [code]
NetDS/RPC/Pickle/Picklt/Pickltc.c [code]
NetDS/RPC/Pipes/Common.h [code]
NetDS/RPC/Pipes/Pipe.Idl [code]
NetDS/RPC/Pipes/Pipec.c [code]
NetDS/RPC/Pipes/Pipeproc.c [code]
NetDS/RPC/Pipes/Pipes.c [code]
NetDS/RPC/RPCssm/RPCssm.Idl [code]
NetDS/RPC/RPCssm/RPCssmc.c [code]
NetDS/RPC/RPCssm/RPCssmp.c [code]
NetDS/RPC/RPCssm/RPCssms.c [code]
NetDS/RPC/RPCsvc/Client.C [code]
NetDS/RPC/RPCsvc/RPCsvc.Idl [code]
NetDS/RPC/RPCsvc/Server.c [code]
NetDS/RPC/RPCsvc/Service.C [code]
NetDS/RPC/RPCsvc/Service.H [code]
NetDS/RPC/StrOut/Client.c [code]
NetDS/RPC/StrOut/Common.h [code]
NetDS/RPC/StrOut/Remote.c [code]
NetDS/RPC/StrOut/Server.c [code]
NetDS/RPC/StrOut/StrOut.Idl [code]
NetDS/RRas/Adminapi/Admapit.c [code]
NetDS/RRas/Callout/AdminDll.c [code]
NetDS/RRas/Eap/CeapCfg.Cpp [code]
NetDS/RRas/Eap/CeapCfg.h [code]
NetDS/RRas/Eap/Eap.c [code]
NetDS/RRas/Eap/Eap.h [code]
NetDS/RRas/Eap/Exports.Cpp [code]
NetDS/RRas/Eap/Resource.h [code]
NetDS/RRas/ip/configentry.c [code]
NetDS/RRas/ip/configentry.h [code]
NetDS/RRas/ip/configmgr.c [code]
NetDS/RRas/ip/configmgr.h [code]
NetDS/RRas/ip/defs.h [code]
NetDS/RRas/ip/hashtable.c [code]
NetDS/RRas/ip/hashtable.h [code]
NetDS/RRas/ip/ipsample.c [code]
NetDS/RRas/ip/ipsample.h [code]
NetDS/RRas/ip/ipsamplerm.h [code]
NetDS/RRas/ip/list.h [code]
NetDS/RRas/ip/log.h [code]
NetDS/RRas/ip/makefile.inc [code]
NetDS/RRas/ip/mibmgr.c [code]
NetDS/RRas/ip/mibmgr.h [code]
NetDS/RRas/ip/networkentry.c [code]
NetDS/RRas/ip/networkentry.h [code]
NetDS/RRas/ip/networkmgr.c [code]
NetDS/RRas/ip/networkmgr.h [code]
NetDS/RRas/ip/packet.c [code]
NetDS/RRas/ip/packet.h [code]
NetDS/RRas/ip/pchsample.h [code]
NetDS/RRas/ip/rmapi.c [code]
NetDS/RRas/ip/rmapi.h [code]
NetDS/RRas/ip/rtmapi.c [code]
NetDS/RRas/ip/rtmapi.h [code]
NetDS/RRas/ip/sampletest.cxx [code]
NetDS/RRas/ip/sampletest.h [code]
NetDS/RRas/ip/socket.c [code]
NetDS/RRas/ip/socket.h [code]
NetDS/RRas/ip/sync.c [code]
NetDS/RRas/ip/sync.h [code]
NetDS/RRas/ip/test.c [code]
NetDS/RRas/ip/utils.c [code]
NetDS/RRas/ip/utils.h [code]
NetDS/RRas/LoadProtocol/ipsamplerm.h [code]
NetDS/RRas/LoadProtocol/loadprotocol.c [code]
NetDS/RRas/rqs/client/main.cpp [code]
NetDS/RRas/rqs/common/rcusync.cpp [code]
NetDS/RRas/rqs/common/rumem.cpp [code]
NetDS/RRas/rqs/common/rureg.cpp [code]
NetDS/RRas/rqs/common/rusocket.cpp [code]
NetDS/RRas/rqs/common/rustring.cpp [code]
NetDS/RRas/rqs/inc/rasutil.h [code]
NetDS/RRas/rqs/inc/rcusync.h [code]
NetDS/RRas/rqs/inc/rumem.h [code]
NetDS/RRas/rqs/inc/rureg.h [code]
NetDS/RRas/rqs/inc/rusocket.h [code]
NetDS/RRas/rqs/inc/rustring.h [code]
NetDS/RRas/rqs/rqsmsg/rqsmsg.cpp [code]
NetDS/RRas/rqs/server/clntlst.h [code]
NetDS/RRas/rqs/server/main.cpp [code]
NetDS/RRas/rqs/server/rqs.h [code]
NetDS/RRas/rqs/server/rqsclient.cpp [code]
NetDS/RRas/rqs/server/rqsclient.h [code]
NetDS/RRas/rqs/server/rqsconfig.cpp [code]
NetDS/RRas/rqs/server/rqsconfig.h [code]
NetDS/RRas/rqs/server/rqsengine.cpp [code]
NetDS/RRas/rqs/server/rqsengine.h [code]
NetDS/rtc/Client/CPP/RTCIncoming/Resource.h [code]
NetDS/rtc/Client/CPP/RTCIncoming/RTCIncoming.cpp [code]
NetDS/rtc/Client/CPP/RTCIncoming/RTCIncoming.h [code]
NetDS/rtc/Client/CPP/RTCIncoming/RTCIncomingDlg.cpp [code]
NetDS/rtc/Client/CPP/RTCIncoming/RTCIncomingDlg.h [code]
NetDS/rtc/Client/CPP/RTCIncoming/StdAfx.cpp [code]
NetDS/rtc/Client/CPP/RTCIncoming/StdAfx.h [code]
NetDS/rtc/Client/CPP/RTCIncoming/Utils.cpp [code]
NetDS/rtc/Client/CPP/RTCIncoming/Utils.h [code]
NetDS/rtc/Client/CPP/RTCOutgoing/Resource.h [code]
NetDS/rtc/Client/CPP/RTCOutgoing/RTCOutgoing.cpp [code]
NetDS/rtc/Client/CPP/RTCOutgoing/RTCOutgoing.h [code]
NetDS/rtc/Client/CPP/RTCOutgoing/RTCOutgoingDlg.cpp [code]
NetDS/rtc/Client/CPP/RTCOutgoing/RTCOutgoingDlg.h [code]
NetDS/rtc/Client/CPP/RTCOutgoing/StdAfx.cpp [code]
NetDS/rtc/Client/CPP/RTCOutgoing/StdAfx.h [code]
NetDS/rtc/Client/CPP/RTCOutgoing/Utils.cpp [code]
NetDS/rtc/Client/CPP/RTCOutgoing/Utils.h [code]
NetDS/rtc/Client/CPP/rtcsample/resource.h [code]
NetDS/rtc/Client/CPP/rtcsample/rtcav.cpp [code]
NetDS/rtc/Client/CPP/rtcsample/rtcav.h [code]
NetDS/rtc/Client/CPP/rtcsample/rtcdialogs.cpp [code]
NetDS/rtc/Client/CPP/rtcsample/rtcdialogs.h [code]
NetDS/rtc/Client/CPP/rtcsample/rtcevents.h [code]
NetDS/rtc/Client/CPP/rtcsample/rtcim.cpp [code]
NetDS/rtc/Client/CPP/rtcsample/rtcim.h [code]
NetDS/rtc/Client/CPP/rtcsample/rtcsample.cpp [code]
NetDS/rtc/Client/CPP/rtcsample/rtcsession.cpp [code]
NetDS/rtc/Client/CPP/rtcsample/rtcsession.h [code]
NetDS/rtc/Client/CPP/rtcsample/rtcwin.cpp [code]
NetDS/rtc/Client/CPP/rtcsample/rtcwin.h [code]
NetDS/rtc/Client/CPP/rtcsample/StdAfx.cpp [code]
NetDS/rtc/Client/CPP/rtcsample/StdAfx.h [code]
NetDS/Snmp/SnmpUtil/SnmpUtil.C [code]
NetDS/Snmp/TestDll/TestDll.C [code]
NetDS/Snmp/TestDll/TestMIB.C [code]
NetDS/Snmp/TestDll/TestMIB.h [code]
NetDS/Snmp/WSnmp/Helper.Cpp [code]
NetDS/Snmp/WSnmp/WSnmpUtil.Cpp [code]
NetDS/Snmp/WSnmp/WSnmpUtil.h [code]
NetDS/SyncMgr/SyncDir/Alloc.Cpp [code]
NetDS/SyncMgr/SyncDir/Alloc.h [code]
NetDS/SyncMgr/SyncDir/Cfact.Cpp [code]
NetDS/SyncMgr/SyncDir/Cfact.h [code]
NetDS/SyncMgr/SyncDir/Critsect.Cpp [code]
NetDS/SyncMgr/SyncDir/Critsect.h [code]
NetDS/SyncMgr/SyncDir/Debug.Cpp [code]
NetDS/SyncMgr/SyncDir/Debug.h [code]
NetDS/SyncMgr/SyncDir/DllMain.Cpp [code]
NetDS/SyncMgr/SyncDir/DllMain.h [code]
NetDS/SyncMgr/SyncDir/Enum.Cpp [code]
NetDS/SyncMgr/SyncDir/Enum.h [code]
NetDS/SyncMgr/SyncDir/Guid.c [code]
NetDS/SyncMgr/SyncDir/Guid.h [code]
NetDS/SyncMgr/SyncDir/Handler.Cpp [code]
NetDS/SyncMgr/SyncDir/Handler.h [code]
NetDS/SyncMgr/SyncDir/Helper.Cpp [code]
NetDS/SyncMgr/SyncDir/Helper.h [code]
NetDS/SyncMgr/SyncDir/PreComp.h [code]
NetDS/SyncMgr/SyncDir/Reg.Cpp [code]
NetDS/SyncMgr/SyncDir/Reg.h [code]
NetDS/SyncMgr/SyncDir/Resource.h [code]
NetDS/SyncMgr/SyncDir/Settings.Cpp [code]
NetDS/SyncMgr/SyncDir/Settings.h [code]
NetDS/Tapi/Tapi2/Atsp32/Atsp.c [code]
NetDS/Tapi/Tapi2/Atsp32/Atsp.h [code]
NetDS/Tapi/Tapi2/Atsp32/Resource.h [code]
NetDS/Tapi/Tapi2/Dialer/Dialer.c [code]
NetDS/Tapi/Tapi2/Dialer/Dialer.h [code]
NetDS/Tapi/Tapi2/Dialer/Dialhelp.h [code]
NetDS/Tapi/Tapi2/Dialer/Resource.h [code]
NetDS/Tapi/Tapi2/TapiComm/ABOUT.c [code]
NetDS/Tapi/Tapi2/TapiComm/CommCode.c [code]
NetDS/Tapi/Tapi2/TapiComm/CommCode.h [code]
NetDS/Tapi/Tapi2/TapiComm/DISPATCH.c [code]
NetDS/Tapi/Tapi2/TapiComm/EDITCTLS.c [code]
NetDS/Tapi/Tapi2/TapiComm/EDITCTLS.h [code]
NetDS/Tapi/Tapi2/TapiComm/GLOBALS.h [code]
NetDS/Tapi/Tapi2/TapiComm/INIT.c [code]
NetDS/Tapi/Tapi2/TapiComm/Misc.c [code]
NetDS/Tapi/Tapi2/TapiComm/Resource.h [code]
NetDS/Tapi/Tapi2/TapiComm/STATBAR.c [code]
NetDS/Tapi/Tapi2/TapiComm/STATBAR.h [code]
NetDS/Tapi/Tapi2/TapiComm/TapiCode.c [code]
NetDS/Tapi/Tapi2/TapiComm/TapiCode.h [code]
NetDS/Tapi/Tapi2/TapiComm/TapiComm.c [code]
NetDS/Tapi/Tapi2/TapiComm/TapiInfo.c [code]
NetDS/Tapi/Tapi2/TapiComm/TapiInfo.h [code]
NetDS/Tapi/Tapi2/TapiComm/ToolBar.c [code]
NetDS/Tapi/Tapi2/TapiComm/ToolBar.h [code]
NetDS/Tapi/Tapi2/TapiComm/WinMain.c [code]
NetDS/Tapi/Tapi3/Cpp/FileTerm/CallNot.cpp [code]
NetDS/Tapi/Tapi3/Cpp/FileTerm/CallNot.h [code]
NetDS/Tapi/Tapi3/Cpp/FileTerm/FileTerm.cpp [code]
NetDS/Tapi/Tapi3/Cpp/FileTerm/FileTerm.h [code]
NetDS/Tapi/Tapi3/Cpp/FileTerm/Resource.h [code]
NetDS/Tapi/Tapi3/Cpp/Incoming/Callnot.Cpp [code]
NetDS/Tapi/Tapi3/Cpp/Incoming/Callnot.h [code]
NetDS/Tapi/Tapi3/Cpp/Incoming/Incoming.Cpp [code]
NetDS/Tapi/Tapi3/Cpp/Incoming/Resource.h [code]
NetDS/Tapi/Tapi3/Cpp/Msp/MSPBase/dtevntsk.cpp [code]
NetDS/Tapi/Tapi3/Cpp/Msp/MSPBase/mspaddr.cpp [code]
NetDS/Tapi/Tapi3/Cpp/Msp/MSPBase/mspcall.cpp [code]
NetDS/Tapi/Tapi3/Cpp/Msp/MSPBase/msplog.cpp [code]
NetDS/Tapi/Tapi3/Cpp/Msp/MSPBase/mspstrm.cpp [code]
NetDS/Tapi/Tapi3/Cpp/Msp/MSPBase/mspterm.cpp [code]
NetDS/Tapi/Tapi3/Cpp/Msp/MSPBase/mspthrd.cpp [code]
NetDS/Tapi/Tapi3/Cpp/Msp/MSPBase/msptrmac.cpp [code]
NetDS/Tapi/Tapi3/Cpp/Msp/MSPBase/msptrmar.cpp [code]
NetDS/Tapi/Tapi3/Cpp/Msp/MSPBase/msptrmvc.cpp [code]
NetDS/Tapi/Tapi3/Cpp/Msp/MSPBase/msputils.cpp [code]
NetDS/Tapi/Tapi3/Cpp/Msp/MSPBase/precomp.h [code]
NetDS/Tapi/Tapi3/Cpp/Msp/SampleMSP/Common.h [code]
NetDS/Tapi/Tapi3/Cpp/Msp/SampleMSP/Resource.h [code]
NetDS/Tapi/Tapi3/Cpp/Msp/SampleMSP/SampAddr.Cpp [code]
NetDS/Tapi/Tapi3/Cpp/Msp/SampleMSP/SampAddr.h [code]
NetDS/Tapi/Tapi3/Cpp/Msp/SampleMSP/SampCall.Cpp [code]
NetDS/Tapi/Tapi3/Cpp/Msp/SampleMSP/SampCall.h [code]
NetDS/Tapi/Tapi3/Cpp/Msp/SampleMSP/SampMsp.Cpp [code]
NetDS/Tapi/Tapi3/Cpp/Msp/SampleMSP/SampMsp.Idl [code]
NetDS/Tapi/Tapi3/Cpp/Msp/SampleMSP/SampStrm.Cpp [code]
NetDS/Tapi/Tapi3/Cpp/Msp/SampleMSP/SampStrm.h [code]
NetDS/Tapi/Tapi3/Cpp/Msp/SampleMSP/stdafx.h [code]
NetDS/Tapi/Tapi3/Cpp/Outgoing/Outgoing.Cpp [code]
NetDS/Tapi/Tapi3/Cpp/Outgoing/Resource.h [code]
NetDS/Tapi/Tapi3/Cpp/pluggable/guids.h [code]
NetDS/Tapi/Tapi3/Cpp/pluggable/plgterm.cpp [code]
NetDS/Tapi/Tapi3/Cpp/pluggable/plgterm.h [code]
NetDS/Tapi/Tapi3/Cpp/pluggable/plgtermfilter.cpp [code]
NetDS/Tapi/Tapi3/Cpp/pluggable/plgtermfilter.h [code]
NetDS/Tapi/Tapi3/Cpp/pluggable/plgtermpin.cpp [code]
NetDS/Tapi/Tapi3/Cpp/pluggable/plgtermpin.h [code]
NetDS/Tapi/Tapi3/Cpp/pluggable/plgtermpriv.h [code]
NetDS/Tapi/Tapi3/Cpp/pluggable/plgtermsample.idl [code]
NetDS/Tapi/Tapi3/Cpp/pluggable/pluggable.cpp [code]
NetDS/Tapi/Tapi3/Cpp/pluggable/resource.h [code]
NetDS/Tapi/Tapi3/Cpp/pluggable/stdafx.cpp [code]
NetDS/Tapi/Tapi3/Cpp/pluggable/stdafx.h [code]
NetDS/Tapi/Tapi3/Cpp/Rend/RendSam.Cpp [code]
NetDS/Tapi/Tapi3/Cpp/tapirecv/avifilewriter.cpp [code]
NetDS/Tapi/Tapi3/Cpp/tapirecv/avifilewriter.h [code]
NetDS/Tapi/Tapi3/Cpp/tapirecv/common.h [code]
NetDS/Tapi/Tapi3/Cpp/tapirecv/Processing.cpp [code]
NetDS/Tapi/Tapi3/Cpp/tapirecv/Processing.h [code]
NetDS/Tapi/Tapi3/Cpp/tapirecv/tapirecv.cpp [code]
NetDS/Tapi/Tapi3/Cpp/tapirecv/workerthread.cpp [code]
NetDS/Tapi/Tapi3/Cpp/tapirecv/workerthread.h [code]
NetDS/Tapi/Tapi3/Cpp/tapisend/avifilereader.cpp [code]
NetDS/Tapi/Tapi3/Cpp/tapisend/avifilereader.h [code]
NetDS/Tapi/Tapi3/Cpp/tapisend/common.h [code]
NetDS/Tapi/Tapi3/Cpp/tapisend/tapisend.cpp [code]
NetDS/upnp/DCO_DimmerService/DeviceDll.cpp [code]
NetDS/upnp/DCO_DimmerService/DeviceDll.h [code]
NetDS/upnp/DCO_DimmerService/DimmerDevice.idl [code]
NetDS/upnp/DCO_DimmerService/DimmerDeviceDCO.cpp [code]
NetDS/upnp/DCO_DimmerService/DimmerDeviceDCO.h [code]
NetDS/upnp/DCO_DimmerService/DimmerService.cpp [code]
NetDS/upnp/DCO_DimmerService/DimmerService.h [code]
NetDS/upnp/DCO_DimmerService/resource.h [code]
NetDS/upnp/FunctionDelegator/cbklib.idl [code]
NetDS/upnp/GenericUCP/CPP/deviceprop.cpp [code]
NetDS/upnp/GenericUCP/CPP/deviceprop.h [code]
NetDS/upnp/GenericUCP/CPP/genericucp.cpp [code]
NetDS/upnp/GenericUCP/CPP/genericucp.h [code]
NetDS/upnp/GenericUCP/CPP/GenericUCPDlg.cpp [code]
NetDS/upnp/GenericUCP/CPP/genericucpdlg.h [code]
NetDS/upnp/GenericUCP/CPP/resource.h [code]
NetDS/upnp/GenericUCP/CPP/stdafx.cpp [code]
NetDS/upnp/GenericUCP/CPP/stdafx.h [code]
NetDS/upnp/GenericUCP/CPP/util.cpp [code]
NetDS/upnp/GenericUCP/CPP/util.h [code]
NetDS/upnp/RegisterDevice/RegDevice.cpp [code]
NetDS/upnp/StepByStep/Step1/DimmingService_SCPD.idl [code]
NetDS/upnp/StepByStep/Step2/Dimmer.cpp [code]
NetDS/upnp/StepByStep/Step2/Dimmer.h [code]
NetDS/upnp/StepByStep/Step2/DimmerService.cpp [code]
NetDS/upnp/StepByStep/Step2/DimmerService.h [code]
NetDS/upnp/StepByStep/Step2/dlldata.c [code]
NetDS/upnp/StepByStep/Step2/MyDevice.cpp [code]
NetDS/upnp/StepByStep/Step2/MyDevice.h [code]
NetDS/upnp/StepByStep/Step2/MyDevice.idl [code]
NetDS/upnp/StepByStep/Step2/resource.h [code]
NetDS/upnp/StepByStep/Step2/StdAfx.cpp [code]
NetDS/upnp/StepByStep/Step2/StdAfx.h [code]
NetDS/upnp/StepByStep/Step3/Dimmer.cpp [code]
NetDS/upnp/StepByStep/Step3/Dimmer.h [code]
NetDS/upnp/StepByStep/Step3/DimmerService.cpp [code]
NetDS/upnp/StepByStep/Step3/DimmerService.h [code]
NetDS/upnp/StepByStep/Step3/dlldata.c [code]
NetDS/upnp/StepByStep/Step3/MyDevice.cpp [code]
NetDS/upnp/StepByStep/Step3/MyDevice.h [code]
NetDS/upnp/StepByStep/Step3/MyDevice.idl [code]
NetDS/upnp/StepByStep/Step3/MyDevice_i.c [code]
NetDS/upnp/StepByStep/Step3/resource.h [code]
NetDS/upnp/StepByStep/Step3/StdAfx.cpp [code]
NetDS/upnp/StepByStep/Step3/StdAfx.h [code]
NetDS/upnp/StepByStep/Step4/Dimmer.cpp [code]
NetDS/upnp/StepByStep/Step4/Dimmer.h [code]
NetDS/upnp/StepByStep/Step4/DimmerService.cpp [code]
NetDS/upnp/StepByStep/Step4/DimmerService.h [code]
NetDS/upnp/StepByStep/Step4/dlldata.c [code]
NetDS/upnp/StepByStep/Step4/MyDevice.cpp [code]
NetDS/upnp/StepByStep/Step4/MyDevice.h [code]
NetDS/upnp/StepByStep/Step4/MyDevice.idl [code]
NetDS/upnp/StepByStep/Step4/MyDevice_i.c [code]
NetDS/upnp/StepByStep/Step4/resource.h [code]
NetDS/upnp/StepByStep/Step4/StdAfx.cpp [code]
NetDS/upnp/StepByStep/Step4/StdAfx.h [code]
NetDS/WinNT/NetApi/ChngPass/ChngPass.c [code]
NetDS/WinNT/NetApi/NetShare/NetShare.c [code]
NetDS/WinSock/Accept/ASAccept.cpp [code]
NetDS/WinSock/Accept/common.cpp [code]
NetDS/WinSock/Accept/common.h [code]
NetDS/WinSock/Accept/main.cpp [code]
NetDS/WinSock/Accept/NBAccept.cpp [code]
NetDS/WinSock/Accept/SockInfo.cpp [code]
NetDS/WinSock/Accept/TestAccept.cpp [code]
NetDS/WinSock/appletalk/PrPerf.c [code]
NetDS/WinSock/appletalk/PrSamp.h [code]
NetDS/WinSock/ATMEvent/ATMEvent.Cpp [code]
NetDS/WinSock/ATMEvent/ATMEvent.h [code]
NetDS/WinSock/ATMEvent/Enumerator.Cpp [code]
NetDS/WinSock/ATMEvent/Receiver.Cpp [code]
NetDS/WinSock/ATMEvent/Sender.Cpp [code]
NetDS/WinSock/Bcast/Bcast.c [code]
NetDS/WinSock/Dt_Dll/CStack.h [code]
NetDS/WinSock/Dt_Dll/Dt.h [code]
NetDS/WinSock/Dt_Dll/Dt_Dll.Cpp [code]
NetDS/WinSock/Dt_Dll/Dt_Dll.h [code]
NetDS/WinSock/Dt_Dll/Handlers.Cpp [code]
NetDS/WinSock/Dt_Dll/Handlers.h [code]
NetDS/WinSock/Dt_Dll/HuError.Cpp [code]
NetDS/WinSock/Dt_Dll/HuError.h [code]
NetDS/WinSock/Dt_Dll/Nideque.h [code]
NetDS/WinSock/Dt_Dll/NoWarn.h [code]
NetDS/WinSock/Dt_Dll/Stack.h [code]
NetDS/WinSock/Dt_Dll2/ApiHook.Hpp [code]
NetDS/WinSock/Dt_Dll2/Dt_Dll.Cpp [code]
NetDS/WinSock/Dt_Dll2/Dt_Dll.Hpp [code]
NetDS/WinSock/Dt_Dll2/DtHandler.Cpp [code]
NetDS/WinSock/Dt_Dll2/DtHandler.Hpp [code]
NetDS/WinSock/Dt_Dll2/Socketmon.Cpp [code]
NetDS/WinSock/Dt_Dll2/Socketmon.Hpp [code]
NetDS/WinSock/iocp/IocpClient.Cpp [code]
NetDS/WinSock/iocp/IocpServer.Cpp [code]
NetDS/WinSock/iocp/IocpServer.h [code]
NetDS/WinSock/iocp/IocpServerex.Cpp [code]
NetDS/WinSock/iphdrinc/iphdr.h [code]
NetDS/WinSock/iphdrinc/rawudp.c [code]
NetDS/WinSock/iphdrinc/resolve.c [code]
NetDS/WinSock/iphdrinc/resolve.h [code]
NetDS/WinSock/IpxChat/About.c [code]
NetDS/WinSock/IpxChat/Connect.c [code]
NetDS/WinSock/IpxChat/Dispatch.c [code]
NetDS/WinSock/IpxChat/Globals.h [code]
NetDS/WinSock/IpxChat/Init.c [code]
NetDS/WinSock/IpxChat/IpxChat.c [code]
NetDS/WinSock/IpxChat/Listen.c [code]
NetDS/WinSock/IpxChat/Misc.c [code]
NetDS/WinSock/IpxChat/WinMain.c [code]
NetDS/WinSock/LSP/asyncselect.cpp [code]
NetDS/WinSock/LSP/extension.cpp [code]
NetDS/WinSock/LSP/install.h [code]
NetDS/WinSock/LSP/instlsp.cpp [code]
NetDS/WinSock/LSP/lspguid.cpp [code]
NetDS/WinSock/LSP/overlap.cpp [code]
NetDS/WinSock/LSP/prnpinfo.cpp [code]
NetDS/WinSock/LSP/provider.cpp [code]
NetDS/WinSock/LSP/provider.h [code]
NetDS/WinSock/LSP/sockinfo.cpp [code]
NetDS/WinSock/LSP/spi.cpp [code]
NetDS/WinSock/McastIP/Mcastws1.c [code]
NetDS/WinSock/McastIP/Mcastws2.c [code]
NetDS/WinSock/McastIP/resolve.c [code]
NetDS/WinSock/McastIP/resolve.h [code]
NetDS/WinSock/Overlap/Overlap.c [code]
NetDS/WinSock/Ping/iphdr.h [code]
NetDS/WinSock/Ping/Ping.cpp [code]
NetDS/WinSock/Ping/resolve.cpp [code]
NetDS/WinSock/Ping/resolve.h [code]
NetDS/WinSock/rcvall/iphdr.h [code]
NetDS/WinSock/rcvall/parser.c [code]
NetDS/WinSock/rcvall/parser.h [code]
NetDS/WinSock/rcvall/rcvall.c [code]
NetDS/WinSock/rcvall/resolve.c [code]
NetDS/WinSock/rcvall/resolve.h [code]
NetDS/WinSock/Rnr2/rnrcs.cpp [code]
NetDS/WinSock/simple/Ioctl.c [code]
NetDS/WinSock/simple/Simplec.c [code]
NetDS/WinSock/simple/Simples.c [code]
NetDS/WinSock/Sockdup/Sockdupc.c [code]
NetDS/WinSock/Sockdup/Sockdups.c [code]
Security/Authentication/KerbSubAuth/SubAuth.c [code]
Security/Authentication/MSVSubAuth/SubAuth.c [code]
Security/Authentication/SampSSP/Init.c [code]
Security/Authentication/SampSSP/SampSSP.H [code]
Security/Authentication/SampSSP/Stubs.c [code]
Security/Authorization/AclApi/AclApi.c [code]
Security/Authorization/Audit/Audit.c [code]
Security/Authorization/authz/AuthzCli.c [code]
Security/Authorization/authz/AuthzSvr.c [code]
Security/Authorization/authz/common.c [code]
Security/Authorization/authz/common.h [code]
Security/Authorization/Check_SD/Check_SD.c [code]
Security/Authorization/Check_SD/Check_SD.h [code]
Security/Authorization/Check_SD/Helper.c [code]
Security/Authorization/Check_SD/SD.c [code]
Security/Authorization/Check_SD/SecObjects.c [code]
Security/Authorization/klist/KList.c [code]
Security/Authorization/MyToken/MyToken.cpp [code]
Security/Authorization/Rcmd/Client.c [code]
Security/Authorization/Rcmd/Server.c [code]
Security/Authorization/SecFile/c/SecFile.c [code]
Security/Authorization/SecPrint/SecPrint.c [code]
Security/Authorization/SecurObj/Main.Cpp [code]
Security/Authorization/SecurObj/Main.h [code]
Security/Authorization/SecurObj/Privobji.Cpp [code]
Security/Authorization/SecurObj/Resource.h [code]
Security/Authorization/SecurObj/Security.Cpp [code]
Security/Authorization/SidCln/SidClean.c [code]
Security/Authorization/SuperUsr/SuperUsr.cpp [code]
Security/Authorization/TakeOwn/TakeOwn.c [code]
Security/Authorization/TextSid/TextSid.c [code]
Security/capicom/c_sharp/chainsh/AssemblyInfo.cs [code]
Security/capicom/c_sharp/chainsh/chainsh.cs [code]
Security/capicom/c_sharp/storesh/storesh.cs [code]
Security/capicom/c_sharp/xmldsig/AboutBox.cs [code]
Security/capicom/c_sharp/xmldsig/CertGetKey.c [code]
Security/capicom/c_sharp/xmldsig/MainWindow.cs [code]
Security/capicom/c_sharp/xmldsig/Messages.cs [code]
Security/capicom/c_sharp/xmldsig/SignVerify.cs [code]
Security/capicom/c_sharp/xmldsig/xmldsig.cs [code]
Security/capicom/cpp/isapiCertPolicy/ErrorTxt.h [code]
Security/capicom/cpp/isapiCertPolicy/isapiCertPolicy.cpp [code]
Security/capicom/cpp/isapiCertPolicy/isapiCertPolicy.h [code]
Security/capicom/cpp/isapiCertPolicy/Resource.h [code]
Security/capicom/cpp/isapiCertPolicy/StdAfx.cpp [code]
Security/capicom/cpp/isapiCertPolicy/StdAfx.h [code]
Security/capicom/cpp/store/Store.cpp [code]
Security/CertServices/Encode/ADate.Cpp [code]
Security/CertServices/Encode/ADate.h [code]
Security/CertServices/Encode/ALong.Cpp [code]
Security/CertServices/Encode/ALong.h [code]
Security/CertServices/Encode/AltName.Cpp [code]
Security/CertServices/Encode/AltName.h [code]
Security/CertServices/Encode/AString.Cpp [code]
Security/CertServices/Encode/AString.h [code]
Security/CertServices/Encode/Atl.Cpp [code]
Security/CertServices/Encode/BitStr.Cpp [code]
Security/CertServices/Encode/BitStr.h [code]
Security/CertServices/Encode/CeError.Cpp [code]
Security/CertServices/Encode/CeLib.Cpp [code]
Security/CertServices/Encode/CertEnc.Cpp [code]
Security/CertServices/Encode/CrlDist.Cpp [code]
Security/CertServices/Encode/CrlDist.h [code]
Security/CertServices/Encode/Pch.Cpp [code]
Security/CertServices/Encode/Resource.h [code]
Security/CertServices/Exit/C++/Windows.Net/atl.cpp [code]
Security/CertServices/Exit/C++/Windows.Net/cedebug.cpp [code]
Security/CertServices/Exit/C++/Windows.Net/ceerror.cpp [code]
Security/CertServices/Exit/C++/Windows.Net/celib.cpp [code]
Security/CertServices/Exit/C++/Windows.Net/certxsam.cpp [code]
Security/CertServices/Exit/C++/Windows.Net/certxsam.idl [code]
Security/CertServices/Exit/C++/Windows.Net/exit.cpp [code]
Security/CertServices/Exit/C++/Windows.Net/exit.h [code]
Security/CertServices/Exit/C++/Windows.Net/module.cpp [code]
Security/CertServices/Exit/C++/Windows.Net/module.h [code]
Security/CertServices/Exit/C++/Windows.Net/pch.cpp [code]
Security/CertServices/Exit/C++/Windows.Net/resource.h [code]
Security/CertServices/Exit/C++/Windows2000/Atl.Cpp [code]
Security/CertServices/Exit/C++/Windows2000/CeDebug.Cpp [code]
Security/CertServices/Exit/C++/Windows2000/CeError.Cpp [code]
Security/CertServices/Exit/C++/Windows2000/CeLib.Cpp [code]
Security/CertServices/Exit/C++/Windows2000/CeLibW2k.h [code]
Security/CertServices/Exit/C++/Windows2000/CertXSam.Cpp [code]
Security/CertServices/Exit/C++/Windows2000/CertXSam.Idl [code]
Security/CertServices/Exit/C++/Windows2000/Exit.Cpp [code]
Security/CertServices/Exit/C++/Windows2000/Exit.h [code]
Security/CertServices/Exit/C++/Windows2000/Module.Cpp [code]
Security/CertServices/Exit/C++/Windows2000/Module.h [code]
Security/CertServices/Exit/C++/Windows2000/Pch.Cpp [code]
Security/CertServices/Exit/C++/Windows2000/Resource.h [code]
Security/CertServices/Policy/C++/Windows.Net/atl.cpp [code]
Security/CertServices/Policy/C++/Windows.Net/cedebug.cpp [code]
Security/CertServices/Policy/C++/Windows.Net/ceerror.cpp [code]
Security/CertServices/Policy/C++/Windows.Net/ceformat.cpp [code]
Security/CertServices/Policy/C++/Windows.Net/celib.cpp [code]
Security/CertServices/Policy/C++/Windows.Net/certpsam.cpp [code]
Security/CertServices/Policy/C++/Windows.Net/certpsam.idl [code]
Security/CertServices/Policy/C++/Windows.Net/module.cpp [code]
Security/CertServices/Policy/C++/Windows.Net/module.h [code]
Security/CertServices/Policy/C++/Windows.Net/pch.cpp [code]
Security/CertServices/Policy/C++/Windows.Net/policy.cpp [code]
Security/CertServices/Policy/C++/Windows.Net/policy.h [code]
Security/CertServices/Policy/C++/Windows.Net/request.cpp [code]
Security/CertServices/Policy/C++/Windows.Net/resource.h [code]
Security/CertServices/Policy/C++/Windows2000/Atl.Cpp [code]
Security/CertServices/Policy/C++/Windows2000/CeDebug.Cpp [code]
Security/CertServices/Policy/C++/Windows2000/CeError.Cpp [code]
Security/CertServices/Policy/C++/Windows2000/CeFormat.Cpp [code]
Security/CertServices/Policy/C++/Windows2000/CeLib.Cpp [code]
Security/CertServices/Policy/C++/Windows2000/CeLibW2k.h [code]
Security/CertServices/Policy/C++/Windows2000/CertPSam.Cpp [code]
Security/CertServices/Policy/C++/Windows2000/CertPSam.Idl [code]
Security/CertServices/Policy/C++/Windows2000/Module.Cpp [code]
Security/CertServices/Policy/C++/Windows2000/Module.h [code]
Security/CertServices/Policy/C++/Windows2000/Pch.Cpp [code]
Security/CertServices/Policy/C++/Windows2000/Policy.Cpp [code]
Security/CertServices/Policy/C++/Windows2000/Policy.h [code]
Security/CertServices/Policy/C++/Windows2000/Resource.h [code]
Security/CertServices/RequestCert/RequestCert.Cpp [code]
Security/CryptoApi/CreateCert/CreateCert.c [code]
Security/CryptoApi/CreateCert/CreateCert.h [code]
Security/CryptoApi/Encrypt/Decrypt.c [code]
Security/CryptoApi/Encrypt/Encrypt.c [code]
Security/CryptoApi/EncryptDecrypt/RSACert/RSACert.cpp [code]
Security/CryptoApi/EncryptDecrypt/RSAKey/RSAKey.cpp [code]
Security/CryptoApi/EncryptDecrypt/SessionKey/SessionKey.cpp [code]
Security/CryptoApi/EnumAlgs/EnumAlgs.c [code]
Security/CryptoApi/InitUser/InitUser.c [code]
Security/CryptoApi/SignHash/SignHash.cpp [code]
Security/GINA/GinaHook/GinaDlg.c [code]
Security/GINA/GinaHook/GinaDlg.h [code]
Security/GINA/GinaHook/GinaHook.c [code]
Security/GINA/GinaHook/GinaHook.h [code]
Security/GINA/GinaStub/GinaStub.c [code]
Security/GINA/GinaStub/GinaStub.h [code]
Security/LSAPolicy/LsaPrivs/LsaPrivs.c [code]
Security/LSAPolicy/MachAcct/MachAcct.c [code]
Security/NetProviders/LogonNP/LogonNP.c [code]
Security/NetProviders/LogonNP/Npaux.h [code]
Security/PasswordFilters/PassFilt/PwdFilt.c [code]
Security/SmartCard/PropCert/PropCert.Cpp [code]
Security/SmartCard/SmartCardAPI/SCIntro/SCIntro.Cpp [code]
Security/SmartCard/SmartCardAPI/SCQuery/SCCommon.Cpp [code]
Security/SmartCard/SmartCardAPI/SCQuery/SCCommon.h [code]
Security/SmartCard/SmartCardAPI/SCQuery/SCQuery.Cpp [code]
Security/SSPI/GSS/Gss-Misc.h [code]
Security/SSPI/GSS/GssAPI.h [code]
Security/SSPI/GSS/GssClient.c [code]
Security/SSPI/GSS/GssMisc.c [code]
Security/SSPI/GSS/GssServer.c [code]
Security/SSPI/HttpAuth/Const.H [code]
Security/SSPI/HttpAuth/Get_Sock.c [code]
Security/SSPI/HttpAuth/HttpAuth.c [code]
Security/SSPI/HttpAuth/HttpAuth.h [code]
Security/SSPI/HttpAuth/HttpGet.c [code]
Security/SSPI/HttpAuth/Proto.H [code]
Security/SSPI/SockAuth/Client.cpp [code]
Security/SSPI/SockAuth/Collect.cpp [code]
Security/SSPI/SockAuth/Collect.h [code]
Security/SSPI/SockAuth/Comm.cpp [code]
Security/SSPI/SockAuth/Comm.h [code]
Security/SSPI/SockAuth/Security.cpp [code]
Security/SSPI/SockAuth/Security.h [code]
Security/SSPI/SockAuth/Server.cpp [code]
Security/SSPI/SSL/WebClient/WebClient.c [code]
Security/SSPI/SSL/WebClient/WI_SSL_Client.Cpp [code]
Security/SSPI/SSL/WebServer/WebServer.c [code]
SysMgmt/MMC/About/about.Cpp [code]
SysMgmt/MMC/About/about.h [code]
SysMgmt/MMC/About/basesnap.Cpp [code]
SysMgmt/MMC/About/basesnap.h [code]
SysMgmt/MMC/About/comp.Cpp [code]
SysMgmt/MMC/About/comp.h [code]
SysMgmt/MMC/About/compdata.Cpp [code]
SysMgmt/MMC/About/compdata.h [code]
SysMgmt/MMC/About/dataobj.Cpp [code]
SysMgmt/MMC/About/dataobj.h [code]
SysMgmt/MMC/About/delebase.Cpp [code]
SysMgmt/MMC/About/delebase.h [code]
SysMgmt/MMC/About/globals.h [code]
SysMgmt/MMC/About/guids.h [code]
SysMgmt/MMC/About/localres.h [code]
SysMgmt/MMC/About/mmccrack.Cpp [code]
SysMgmt/MMC/About/registry.Cpp [code]
SysMgmt/MMC/About/registry.h [code]
SysMgmt/MMC/About/resource.h [code]
SysMgmt/MMC/About/statnode.Cpp [code]
SysMgmt/MMC/About/statnode.h [code]
SysMgmt/MMC/ActiveX/about.Cpp [code]
SysMgmt/MMC/ActiveX/about.h [code]
SysMgmt/MMC/ActiveX/basesnap.Cpp [code]
SysMgmt/MMC/ActiveX/basesnap.h [code]
SysMgmt/MMC/ActiveX/comp.Cpp [code]
SysMgmt/MMC/ActiveX/comp.h [code]
SysMgmt/MMC/ActiveX/compdata.Cpp [code]
SysMgmt/MMC/ActiveX/compdata.h [code]
SysMgmt/MMC/ActiveX/dataobj.Cpp [code]
SysMgmt/MMC/ActiveX/dataobj.h [code]
SysMgmt/MMC/ActiveX/delebase.Cpp [code]
SysMgmt/MMC/ActiveX/delebase.h [code]
SysMgmt/MMC/ActiveX/globals.h [code]
SysMgmt/MMC/ActiveX/guids.h [code]
SysMgmt/MMC/ActiveX/land.Cpp [code]
SysMgmt/MMC/ActiveX/land.h [code]
SysMgmt/MMC/ActiveX/localres.h [code]
SysMgmt/MMC/ActiveX/mmccrack.Cpp [code]
SysMgmt/MMC/ActiveX/people.Cpp [code]
SysMgmt/MMC/ActiveX/people.h [code]
SysMgmt/MMC/ActiveX/registry.Cpp [code]
SysMgmt/MMC/ActiveX/registry.h [code]
SysMgmt/MMC/ActiveX/resource.h [code]
SysMgmt/MMC/ActiveX/sky.Cpp [code]
SysMgmt/MMC/ActiveX/sky.h [code]
SysMgmt/MMC/ActiveX/space.Cpp [code]
SysMgmt/MMC/ActiveX/space.h [code]
SysMgmt/MMC/ActiveX/statnode.Cpp [code]
SysMgmt/MMC/ActiveX/statnode.h [code]
SysMgmt/MMC/ActiveX/atl/atlcontrol.Cpp [code]
SysMgmt/MMC/ActiveX/atl/atlcontrol.h [code]
SysMgmt/MMC/ActiveX/atl/atlcontrol.idl [code]
SysMgmt/MMC/ActiveX/atl/mmccontrol.Cpp [code]
SysMgmt/MMC/ActiveX/atl/mmccontrol.h [code]
SysMgmt/MMC/ActiveX/atl/resource.h [code]
SysMgmt/MMC/ActiveX/atl/StdAfx.Cpp [code]
SysMgmt/MMC/ActiveX/atl/StdAfx.h [code]
SysMgmt/MMC/ActiveX/vb/mmcsample.h [code]
SysMgmt/MMC/CMenu/about.Cpp [code]
SysMgmt/MMC/CMenu/about.h [code]
SysMgmt/MMC/CMenu/basesnap.Cpp [code]
SysMgmt/MMC/CMenu/basesnap.h [code]
SysMgmt/MMC/CMenu/comp.Cpp [code]
SysMgmt/MMC/CMenu/comp.h [code]
SysMgmt/MMC/CMenu/compdata.Cpp [code]
SysMgmt/MMC/CMenu/compdata.h [code]
SysMgmt/MMC/CMenu/dataobj.Cpp [code]
SysMgmt/MMC/CMenu/dataobj.h [code]
SysMgmt/MMC/CMenu/delebase.Cpp [code]
SysMgmt/MMC/CMenu/delebase.h [code]
SysMgmt/MMC/CMenu/globals.h [code]
SysMgmt/MMC/CMenu/guids.h [code]
SysMgmt/MMC/CMenu/land.Cpp [code]
SysMgmt/MMC/CMenu/land.h [code]
SysMgmt/MMC/CMenu/localres.h [code]
SysMgmt/MMC/CMenu/mmccrack.Cpp [code]
SysMgmt/MMC/CMenu/people.Cpp [code]
SysMgmt/MMC/CMenu/people.h [code]
SysMgmt/MMC/CMenu/registry.Cpp [code]
SysMgmt/MMC/CMenu/registry.h [code]
SysMgmt/MMC/CMenu/resource.h [code]
SysMgmt/MMC/CMenu/sky.Cpp [code]
SysMgmt/MMC/CMenu/sky.h [code]
SysMgmt/MMC/CMenu/space.Cpp [code]
SysMgmt/MMC/CMenu/space.h [code]
SysMgmt/MMC/CMenu/statnode.Cpp [code]
SysMgmt/MMC/CMenu/statnode.h [code]
SysMgmt/MMC/CMenuExt/about.Cpp [code]
SysMgmt/MMC/CMenuExt/about.h [code]
SysMgmt/MMC/CMenuExt/basesnap.Cpp [code]
SysMgmt/MMC/CMenuExt/basesnap.h [code]
SysMgmt/MMC/CMenuExt/cMenuext.Cpp [code]
SysMgmt/MMC/CMenuExt/cMenuext.h [code]
SysMgmt/MMC/CMenuExt/extend.h [code]
SysMgmt/MMC/CMenuExt/globals.h [code]
SysMgmt/MMC/CMenuExt/guids.h [code]
SysMgmt/MMC/CMenuExt/localres.h [code]
SysMgmt/MMC/CMenuExt/registry.Cpp [code]
SysMgmt/MMC/CMenuExt/registry.h [code]
SysMgmt/MMC/CMenuExt/resource.h [code]
SysMgmt/MMC/Complete/about.Cpp [code]
SysMgmt/MMC/Complete/about.h [code]
SysMgmt/MMC/Complete/basesnap.Cpp [code]
SysMgmt/MMC/Complete/basesnap.h [code]
SysMgmt/MMC/Complete/comp.Cpp [code]
SysMgmt/MMC/Complete/comp.h [code]
SysMgmt/MMC/Complete/compdata.Cpp [code]
SysMgmt/MMC/Complete/compdata.h [code]
SysMgmt/MMC/Complete/dataobj.Cpp [code]
SysMgmt/MMC/Complete/dataobj.h [code]
SysMgmt/MMC/Complete/delebase.Cpp [code]
SysMgmt/MMC/Complete/delebase.h [code]
SysMgmt/MMC/Complete/extend.h [code]
SysMgmt/MMC/Complete/globals.h [code]
SysMgmt/MMC/Complete/guids.h [code]
SysMgmt/MMC/Complete/land.Cpp [code]
SysMgmt/MMC/Complete/land.h [code]
SysMgmt/MMC/Complete/localres.h [code]
SysMgmt/MMC/Complete/mmccrack.Cpp [code]
SysMgmt/MMC/Complete/people.Cpp [code]
SysMgmt/MMC/Complete/people.h [code]
SysMgmt/MMC/Complete/registry.Cpp [code]
SysMgmt/MMC/Complete/registry.h [code]
SysMgmt/MMC/Complete/resource.h [code]
SysMgmt/MMC/Complete/sky.Cpp [code]
SysMgmt/MMC/Complete/sky.h [code]
SysMgmt/MMC/Complete/space.Cpp [code]
SysMgmt/MMC/Complete/space.h [code]
SysMgmt/MMC/Complete/statnode.Cpp [code]
SysMgmt/MMC/Complete/statnode.h [code]
SysMgmt/MMC/CutCopy/about.Cpp [code]
SysMgmt/MMC/CutCopy/about.h [code]
SysMgmt/MMC/CutCopy/backgrnd.Cpp [code]
SysMgmt/MMC/CutCopy/backgrnd.h [code]
SysMgmt/MMC/CutCopy/basesnap.Cpp [code]
SysMgmt/MMC/CutCopy/basesnap.h [code]
SysMgmt/MMC/CutCopy/comp.Cpp [code]
SysMgmt/MMC/CutCopy/comp.h [code]
SysMgmt/MMC/CutCopy/compdata.Cpp [code]
SysMgmt/MMC/CutCopy/compdata.h [code]
SysMgmt/MMC/CutCopy/dataobj.Cpp [code]
SysMgmt/MMC/CutCopy/dataobj.h [code]
SysMgmt/MMC/CutCopy/delebase.Cpp [code]
SysMgmt/MMC/CutCopy/delebase.h [code]
SysMgmt/MMC/CutCopy/globals.h [code]
SysMgmt/MMC/CutCopy/guids.h [code]
SysMgmt/MMC/CutCopy/land.Cpp [code]
SysMgmt/MMC/CutCopy/land.h [code]
SysMgmt/MMC/CutCopy/localres.h [code]
SysMgmt/MMC/CutCopy/mmccrack.Cpp [code]
SysMgmt/MMC/CutCopy/people.Cpp [code]
SysMgmt/MMC/CutCopy/people.h [code]
SysMgmt/MMC/CutCopy/registry.Cpp [code]
SysMgmt/MMC/CutCopy/registry.h [code]
SysMgmt/MMC/CutCopy/resource.h [code]
SysMgmt/MMC/CutCopy/sky.Cpp [code]
SysMgmt/MMC/CutCopy/sky.h [code]
SysMgmt/MMC/CutCopy/space.Cpp [code]
SysMgmt/MMC/CutCopy/space.h [code]
SysMgmt/MMC/CutCopy/statnode.Cpp [code]
SysMgmt/MMC/CutCopy/statnode.h [code]
SysMgmt/MMC/Extens/about.Cpp [code]
SysMgmt/MMC/Extens/about.h [code]
SysMgmt/MMC/Extens/basesnap.Cpp [code]
SysMgmt/MMC/Extens/basesnap.h [code]
SysMgmt/MMC/Extens/comp.Cpp [code]
SysMgmt/MMC/Extens/comp.h [code]
SysMgmt/MMC/Extens/compdata.Cpp [code]
SysMgmt/MMC/Extens/compdata.h [code]
SysMgmt/MMC/Extens/dataobj.Cpp [code]
SysMgmt/MMC/Extens/dataobj.h [code]
SysMgmt/MMC/Extens/delebase.Cpp [code]
SysMgmt/MMC/Extens/delebase.h [code]
SysMgmt/MMC/Extens/extend.h [code]
SysMgmt/MMC/Extens/globals.h [code]
SysMgmt/MMC/Extens/guids.h [code]
SysMgmt/MMC/Extens/land.Cpp [code]
SysMgmt/MMC/Extens/land.h [code]
SysMgmt/MMC/Extens/localres.h [code]
SysMgmt/MMC/Extens/mmccrack.Cpp [code]
SysMgmt/MMC/Extens/people.Cpp [code]
SysMgmt/MMC/Extens/people.h [code]
SysMgmt/MMC/Extens/registry.Cpp [code]
SysMgmt/MMC/Extens/registry.h [code]
SysMgmt/MMC/Extens/resource.h [code]
SysMgmt/MMC/Extens/sky.Cpp [code]
SysMgmt/MMC/Extens/sky.h [code]
SysMgmt/MMC/Extens/space.Cpp [code]
SysMgmt/MMC/Extens/space.h [code]
SysMgmt/MMC/Extens/statnode.Cpp [code]
SysMgmt/MMC/Extens/statnode.h [code]
SysMgmt/MMC/Help/About.Cpp [code]
SysMgmt/MMC/Help/About.h [code]
SysMgmt/MMC/Help/BaseSnap.Cpp [code]
SysMgmt/MMC/Help/BaseSnap.h [code]
SysMgmt/MMC/Help/Comp.Cpp [code]
SysMgmt/MMC/Help/Comp.h [code]
SysMgmt/MMC/Help/CompData.Cpp [code]
SysMgmt/MMC/Help/CompData.h [code]
SysMgmt/MMC/Help/Dataobj.Cpp [code]
SysMgmt/MMC/Help/Dataobj.h [code]
SysMgmt/MMC/Help/deleBase.Cpp [code]
SysMgmt/MMC/Help/deleBase.h [code]
SysMgmt/MMC/Help/Globals.h [code]
SysMgmt/MMC/Help/Guids.h [code]
SysMgmt/MMC/Help/localres.h [code]
SysMgmt/MMC/Help/mmccrack.Cpp [code]
SysMgmt/MMC/Help/Registry.Cpp [code]
SysMgmt/MMC/Help/Registry.h [code]
SysMgmt/MMC/Help/Resource.h [code]
SysMgmt/MMC/Help/StatNode.Cpp [code]
SysMgmt/MMC/Help/StatNode.h [code]
SysMgmt/MMC/Help/Help source/mmcsample.h [code]
SysMgmt/MMC/Menubtn/about.Cpp [code]
SysMgmt/MMC/Menubtn/about.h [code]
SysMgmt/MMC/Menubtn/basesnap.Cpp [code]
SysMgmt/MMC/Menubtn/basesnap.h [code]
SysMgmt/MMC/Menubtn/comp.Cpp [code]
SysMgmt/MMC/Menubtn/comp.h [code]
SysMgmt/MMC/Menubtn/compdata.Cpp [code]
SysMgmt/MMC/Menubtn/compdata.h [code]
SysMgmt/MMC/Menubtn/dataobj.Cpp [code]
SysMgmt/MMC/Menubtn/dataobj.h [code]
SysMgmt/MMC/Menubtn/delebase.Cpp [code]
SysMgmt/MMC/Menubtn/delebase.h [code]
SysMgmt/MMC/Menubtn/globals.h [code]
SysMgmt/MMC/Menubtn/guids.h [code]
SysMgmt/MMC/Menubtn/land.Cpp [code]
SysMgmt/MMC/Menubtn/land.h [code]
SysMgmt/MMC/Menubtn/localres.h [code]
SysMgmt/MMC/Menubtn/mmccrack.Cpp [code]
SysMgmt/MMC/Menubtn/people.Cpp [code]
SysMgmt/MMC/Menubtn/people.h [code]
SysMgmt/MMC/Menubtn/registry.Cpp [code]
SysMgmt/MMC/Menubtn/registry.h [code]
SysMgmt/MMC/Menubtn/resource.h [code]
SysMgmt/MMC/Menubtn/sky.Cpp [code]
SysMgmt/MMC/Menubtn/sky.h [code]
SysMgmt/MMC/Menubtn/space.Cpp [code]
SysMgmt/MMC/Menubtn/space.h [code]
SysMgmt/MMC/Menubtn/statnode.Cpp [code]
SysMgmt/MMC/Menubtn/statnode.h [code]
SysMgmt/MMC/mmc2.0/about/about.cpp [code]
SysMgmt/MMC/mmc2.0/about/about.h [code]
SysMgmt/MMC/mmc2.0/about/basenode.h [code]
SysMgmt/MMC/mmc2.0/about/basesnap.cpp [code]
SysMgmt/MMC/mmc2.0/about/basesnap.h [code]
SysMgmt/MMC/mmc2.0/about/comp.cpp [code]
SysMgmt/MMC/mmc2.0/about/comp.h [code]
SysMgmt/MMC/mmc2.0/about/compdata.cpp [code]
SysMgmt/MMC/mmc2.0/about/compdata.h [code]
SysMgmt/MMC/mmc2.0/about/dataobj.cpp [code]
SysMgmt/MMC/mmc2.0/about/dataobj.h [code]
SysMgmt/MMC/mmc2.0/about/globals.cpp [code]
SysMgmt/MMC/mmc2.0/about/globals.h [code]
SysMgmt/MMC/mmc2.0/about/guids.h [code]
SysMgmt/MMC/mmc2.0/about/registry.cpp [code]
SysMgmt/MMC/mmc2.0/about/registry.h [code]
SysMgmt/MMC/mmc2.0/about/resource.h [code]
SysMgmt/MMC/mmc2.0/about/staticnode.cpp [code]
SysMgmt/MMC/mmc2.0/about/staticnode.h [code]
SysMgmt/MMC/mmc2.0/about/tracemacro.cpp [code]
SysMgmt/MMC/mmc2.0/about/tracemacro.h [code]
SysMgmt/MMC/mmc2.0/contextmenu/about.cpp [code]
SysMgmt/MMC/mmc2.0/contextmenu/about.h [code]
SysMgmt/MMC/mmc2.0/contextmenu/adddevicedlg.cpp [code]
SysMgmt/MMC/mmc2.0/contextmenu/adddevicedlg.h [code]
SysMgmt/MMC/mmc2.0/contextmenu/basedialog.cpp [code]
SysMgmt/MMC/mmc2.0/contextmenu/basedialog.h [code]
SysMgmt/MMC/mmc2.0/contextmenu/basenode.h [code]
SysMgmt/MMC/mmc2.0/contextmenu/basesnap.cpp [code]
SysMgmt/MMC/mmc2.0/contextmenu/basesnap.h [code]
SysMgmt/MMC/mmc2.0/contextmenu/comp.cpp [code]
SysMgmt/MMC/mmc2.0/contextmenu/comp.h [code]
SysMgmt/MMC/mmc2.0/contextmenu/compdata.cpp [code]
SysMgmt/MMC/mmc2.0/contextmenu/compdata.h [code]
SysMgmt/MMC/mmc2.0/contextmenu/dataobj.cpp [code]
SysMgmt/MMC/mmc2.0/contextmenu/dataobj.h [code]
SysMgmt/MMC/mmc2.0/contextmenu/devicenode.cpp [code]
SysMgmt/MMC/mmc2.0/contextmenu/devicenode.h [code]
SysMgmt/MMC/mmc2.0/contextmenu/foldernode.cpp [code]
SysMgmt/MMC/mmc2.0/contextmenu/foldernode.h [code]
SysMgmt/MMC/mmc2.0/contextmenu/globals.cpp [code]
SysMgmt/MMC/mmc2.0/contextmenu/globals.h [code]
SysMgmt/MMC/mmc2.0/contextmenu/guids.h [code]
SysMgmt/MMC/mmc2.0/contextmenu/llistimpl.cpp [code]
SysMgmt/MMC/mmc2.0/contextmenu/llistimpl.h [code]
SysMgmt/MMC/mmc2.0/contextmenu/registry.cpp [code]
SysMgmt/MMC/mmc2.0/contextmenu/registry.h [code]
SysMgmt/MMC/mmc2.0/contextmenu/resource.h [code]
SysMgmt/MMC/mmc2.0/contextmenu/staticnode.cpp [code]
SysMgmt/MMC/mmc2.0/contextmenu/staticnode.h [code]
SysMgmt/MMC/mmc2.0/contextmenu/tracemacro.cpp [code]
SysMgmt/MMC/mmc2.0/contextmenu/tracemacro.h [code]
SysMgmt/MMC/mmc2.0/contextmenuex/basesnap.cpp [code]
SysMgmt/MMC/mmc2.0/contextmenuex/basesnap.h [code]
SysMgmt/MMC/mmc2.0/contextmenuex/contextmenuex.cpp [code]
SysMgmt/MMC/mmc2.0/contextmenuex/contextmenuex.h [code]
SysMgmt/MMC/mmc2.0/contextmenuex/globals.cpp [code]
SysMgmt/MMC/mmc2.0/contextmenuex/globals.h [code]
SysMgmt/MMC/mmc2.0/contextmenuex/guids.h [code]
SysMgmt/MMC/mmc2.0/contextmenuex/registry.cpp [code]
SysMgmt/MMC/mmc2.0/contextmenuex/registry.h [code]
SysMgmt/MMC/mmc2.0/contextmenuex/resource.h [code]
SysMgmt/MMC/mmc2.0/contextmenuex/tracemacro.cpp [code]
SysMgmt/MMC/mmc2.0/contextmenuex/tracemacro.h [code]
SysMgmt/MMC/mmc2.0/dragdrop/about.cpp [code]
SysMgmt/MMC/mmc2.0/dragdrop/about.h [code]
SysMgmt/MMC/mmc2.0/dragdrop/adddevicedlg.cpp [code]
SysMgmt/MMC/mmc2.0/dragdrop/adddevicedlg.h [code]
SysMgmt/MMC/mmc2.0/dragdrop/addvfiledlg.cpp [code]
SysMgmt/MMC/mmc2.0/dragdrop/addvfiledlg.h [code]
SysMgmt/MMC/mmc2.0/dragdrop/basedialog.cpp [code]
SysMgmt/MMC/mmc2.0/dragdrop/basedialog.h [code]
SysMgmt/MMC/mmc2.0/dragdrop/basenode.h [code]
SysMgmt/MMC/mmc2.0/dragdrop/basesnap.cpp [code]
SysMgmt/MMC/mmc2.0/dragdrop/basesnap.h [code]
SysMgmt/MMC/mmc2.0/dragdrop/comp.cpp [code]
SysMgmt/MMC/mmc2.0/dragdrop/comp.h [code]
SysMgmt/MMC/mmc2.0/dragdrop/compdata.cpp [code]
SysMgmt/MMC/mmc2.0/dragdrop/compdata.h [code]
SysMgmt/MMC/mmc2.0/dragdrop/dataobj.cpp [code]
SysMgmt/MMC/mmc2.0/dragdrop/dataobj.h [code]
SysMgmt/MMC/mmc2.0/dragdrop/devicenode.cpp [code]
SysMgmt/MMC/mmc2.0/dragdrop/devicenode.h [code]
SysMgmt/MMC/mmc2.0/dragdrop/enumformatetc.cpp [code]
SysMgmt/MMC/mmc2.0/dragdrop/enumformatetc.h [code]
SysMgmt/MMC/mmc2.0/dragdrop/foldernode.cpp [code]
SysMgmt/MMC/mmc2.0/dragdrop/foldernode.h [code]
SysMgmt/MMC/mmc2.0/dragdrop/globals.cpp [code]
SysMgmt/MMC/mmc2.0/dragdrop/globals.h [code]
SysMgmt/MMC/mmc2.0/dragdrop/guids.h [code]
SysMgmt/MMC/mmc2.0/dragdrop/llistimpl.cpp [code]
SysMgmt/MMC/mmc2.0/dragdrop/llistimpl.h [code]
SysMgmt/MMC/mmc2.0/dragdrop/registry.cpp [code]
SysMgmt/MMC/mmc2.0/dragdrop/registry.h [code]
SysMgmt/MMC/mmc2.0/dragdrop/resource.h [code]
SysMgmt/MMC/mmc2.0/dragdrop/staticnode.cpp [code]
SysMgmt/MMC/mmc2.0/dragdrop/staticnode.h [code]
SysMgmt/MMC/mmc2.0/dragdrop/tracemacro.cpp [code]
SysMgmt/MMC/mmc2.0/dragdrop/tracemacro.h [code]
SysMgmt/MMC/mmc2.0/dragdrop/virtualfile.cpp [code]
SysMgmt/MMC/mmc2.0/dragdrop/virtualfile.h [code]
SysMgmt/MMC/mmc2.0/help/about.cpp [code]
SysMgmt/MMC/mmc2.0/help/about.h [code]
SysMgmt/MMC/mmc2.0/help/adddevicedlg.cpp [code]
SysMgmt/MMC/mmc2.0/help/adddevicedlg.h [code]
SysMgmt/MMC/mmc2.0/help/addvfiledlg.cpp [code]
SysMgmt/MMC/mmc2.0/help/addvfiledlg.h [code]
SysMgmt/MMC/mmc2.0/help/basedialog.cpp [code]
SysMgmt/MMC/mmc2.0/help/basedialog.h [code]
SysMgmt/MMC/mmc2.0/help/basenode.h [code]
SysMgmt/MMC/mmc2.0/help/basesnap.cpp [code]
SysMgmt/MMC/mmc2.0/help/basesnap.h [code]
SysMgmt/MMC/mmc2.0/help/comp.cpp [code]
SysMgmt/MMC/mmc2.0/help/comp.h [code]
SysMgmt/MMC/mmc2.0/help/compdata.cpp [code]
SysMgmt/MMC/mmc2.0/help/compdata.h [code]
SysMgmt/MMC/mmc2.0/help/dataobj.cpp [code]
SysMgmt/MMC/mmc2.0/help/dataobj.h [code]
SysMgmt/MMC/mmc2.0/help/devicenode.cpp [code]
SysMgmt/MMC/mmc2.0/help/devicenode.h [code]
SysMgmt/MMC/mmc2.0/help/foldernode.cpp [code]
SysMgmt/MMC/mmc2.0/help/foldernode.h [code]
SysMgmt/MMC/mmc2.0/help/globals.cpp [code]
SysMgmt/MMC/mmc2.0/help/globals.h [code]
SysMgmt/MMC/mmc2.0/help/guids.h [code]
SysMgmt/MMC/mmc2.0/help/llistimpl.cpp [code]
SysMgmt/MMC/mmc2.0/help/llistimpl.h [code]
SysMgmt/MMC/mmc2.0/help/registry.cpp [code]
SysMgmt/MMC/mmc2.0/help/registry.h [code]
SysMgmt/MMC/mmc2.0/help/resource.h [code]
SysMgmt/MMC/mmc2.0/help/staticnode.cpp [code]
SysMgmt/MMC/mmc2.0/help/staticnode.h [code]
SysMgmt/MMC/mmc2.0/help/tracemacro.cpp [code]
SysMgmt/MMC/mmc2.0/help/tracemacro.h [code]
SysMgmt/MMC/mmc2.0/help/virtualfile.cpp [code]
SysMgmt/MMC/mmc2.0/help/virtualfile.h [code]
SysMgmt/MMC/mmc2.0/multisel/about.cpp [code]
SysMgmt/MMC/mmc2.0/multisel/about.h [code]
SysMgmt/MMC/mmc2.0/multisel/adddevicedlg.cpp [code]
SysMgmt/MMC/mmc2.0/multisel/adddevicedlg.h [code]
SysMgmt/MMC/mmc2.0/multisel/ADDFolderdlg.cpp [code]
SysMgmt/MMC/mmc2.0/multisel/addfolderdlg.h [code]
SysMgmt/MMC/mmc2.0/multisel/addvfiledlg.cpp [code]
SysMgmt/MMC/mmc2.0/multisel/addvfiledlg.h [code]
SysMgmt/MMC/mmc2.0/multisel/basedialog.cpp [code]
SysMgmt/MMC/mmc2.0/multisel/basedialog.h [code]
SysMgmt/MMC/mmc2.0/multisel/basenode.h [code]
SysMgmt/MMC/mmc2.0/multisel/basesnap.cpp [code]
SysMgmt/MMC/mmc2.0/multisel/basesnap.h [code]
SysMgmt/MMC/mmc2.0/multisel/comp.cpp [code]
SysMgmt/MMC/mmc2.0/multisel/comp.h [code]
SysMgmt/MMC/mmc2.0/multisel/compdata.cpp [code]
SysMgmt/MMC/mmc2.0/multisel/compdata.h [code]
SysMgmt/MMC/mmc2.0/multisel/dataobj.cpp [code]
SysMgmt/MMC/mmc2.0/multisel/dataobj.h [code]
SysMgmt/MMC/mmc2.0/multisel/devicenode.cpp [code]
SysMgmt/MMC/mmc2.0/multisel/devicenode.h [code]
SysMgmt/MMC/mmc2.0/multisel/foldernode.cpp [code]
SysMgmt/MMC/mmc2.0/multisel/foldernode.h [code]
SysMgmt/MMC/mmc2.0/multisel/globals.cpp [code]
SysMgmt/MMC/mmc2.0/multisel/globals.h [code]
SysMgmt/MMC/mmc2.0/multisel/guids.h [code]
SysMgmt/MMC/mmc2.0/multisel/llistimpl.cpp [code]
SysMgmt/MMC/mmc2.0/multisel/llistimpl.h [code]
SysMgmt/MMC/mmc2.0/multisel/registry.cpp [code]
SysMgmt/MMC/mmc2.0/multisel/registry.h [code]
SysMgmt/MMC/mmc2.0/multisel/resource.h [code]
SysMgmt/MMC/mmc2.0/multisel/staticnode.cpp [code]
SysMgmt/MMC/mmc2.0/multisel/staticnode.h [code]
SysMgmt/MMC/mmc2.0/multisel/tracemacro.cpp [code]
SysMgmt/MMC/mmc2.0/multisel/tracemacro.h [code]
SysMgmt/MMC/mmc2.0/multisel/virtualfile.cpp [code]
SysMgmt/MMC/mmc2.0/multisel/virtualfile.h [code]
SysMgmt/MMC/mmc2.0/proppage/about.cpp [code]
SysMgmt/MMC/mmc2.0/proppage/about.h [code]
SysMgmt/MMC/mmc2.0/proppage/adddevicedlg.cpp [code]
SysMgmt/MMC/mmc2.0/proppage/adddevicedlg.h [code]
SysMgmt/MMC/mmc2.0/proppage/addvfiledlg.cpp [code]
SysMgmt/MMC/mmc2.0/proppage/addvfiledlg.h [code]
SysMgmt/MMC/mmc2.0/proppage/basedialog.cpp [code]
SysMgmt/MMC/mmc2.0/proppage/basedialog.h [code]
SysMgmt/MMC/mmc2.0/proppage/basenode.h [code]
SysMgmt/MMC/mmc2.0/proppage/basesnap.cpp [code]
SysMgmt/MMC/mmc2.0/proppage/basesnap.h [code]
SysMgmt/MMC/mmc2.0/proppage/comp.cpp [code]
SysMgmt/MMC/mmc2.0/proppage/comp.h [code]
SysMgmt/MMC/mmc2.0/proppage/compdata.cpp [code]
SysMgmt/MMC/mmc2.0/proppage/compdata.h [code]
SysMgmt/MMC/mmc2.0/proppage/dataobj.cpp [code]
SysMgmt/MMC/mmc2.0/proppage/dataobj.h [code]
SysMgmt/MMC/mmc2.0/proppage/devicenode.cpp [code]
SysMgmt/MMC/mmc2.0/proppage/devicenode.h [code]
SysMgmt/MMC/mmc2.0/proppage/foldernode.cpp [code]
SysMgmt/MMC/mmc2.0/proppage/foldernode.h [code]
SysMgmt/MMC/mmc2.0/proppage/globals.cpp [code]
SysMgmt/MMC/mmc2.0/proppage/globals.h [code]
SysMgmt/MMC/mmc2.0/proppage/guids.h [code]
SysMgmt/MMC/mmc2.0/proppage/llistimpl.cpp [code]
SysMgmt/MMC/mmc2.0/proppage/llistimpl.h [code]
SysMgmt/MMC/mmc2.0/proppage/registry.cpp [code]
SysMgmt/MMC/mmc2.0/proppage/registry.h [code]
SysMgmt/MMC/mmc2.0/proppage/resource.h [code]
SysMgmt/MMC/mmc2.0/proppage/staticnode.cpp [code]
SysMgmt/MMC/mmc2.0/proppage/staticnode.h [code]
SysMgmt/MMC/mmc2.0/proppage/tracemacro.cpp [code]
SysMgmt/MMC/mmc2.0/proppage/tracemacro.h [code]
SysMgmt/MMC/mmc2.0/proppage/virtualfile.cpp [code]
SysMgmt/MMC/mmc2.0/proppage/virtualfile.h [code]
SysMgmt/MMC/mmc2.0/proppagex/basesnap.cpp [code]
SysMgmt/MMC/mmc2.0/proppagex/basesnap.h [code]
SysMgmt/MMC/mmc2.0/proppagex/globals.cpp [code]
SysMgmt/MMC/mmc2.0/proppagex/globals.h [code]
SysMgmt/MMC/mmc2.0/proppagex/guids.h [code]
SysMgmt/MMC/mmc2.0/proppagex/proppagex.cpp [code]
SysMgmt/MMC/mmc2.0/proppagex/proppagex.h [code]
SysMgmt/MMC/mmc2.0/proppagex/registry.cpp [code]
SysMgmt/MMC/mmc2.0/proppagex/registry.h [code]
SysMgmt/MMC/mmc2.0/proppagex/resource.h [code]
SysMgmt/MMC/mmc2.0/proppagex/tracemacro.cpp [code]
SysMgmt/MMC/mmc2.0/proppagex/tracemacro.h [code]
SysMgmt/MMC/mmc2.0/simple/basenode.h [code]
SysMgmt/MMC/mmc2.0/simple/basesnap.cpp [code]
SysMgmt/MMC/mmc2.0/simple/basesnap.h [code]
SysMgmt/MMC/mmc2.0/simple/comp.cpp [code]
SysMgmt/MMC/mmc2.0/simple/comp.h [code]
SysMgmt/MMC/mmc2.0/simple/compdata.cpp [code]
SysMgmt/MMC/mmc2.0/simple/compdata.h [code]
SysMgmt/MMC/mmc2.0/simple/dataobj.cpp [code]
SysMgmt/MMC/mmc2.0/simple/dataobj.h [code]
SysMgmt/MMC/mmc2.0/simple/globals.cpp [code]
SysMgmt/MMC/mmc2.0/simple/globals.h [code]
SysMgmt/MMC/mmc2.0/simple/guids.h [code]
SysMgmt/MMC/mmc2.0/simple/registry.cpp [code]
SysMgmt/MMC/mmc2.0/simple/registry.h [code]
SysMgmt/MMC/mmc2.0/simple/resource.h [code]
SysMgmt/MMC/mmc2.0/simple/staticnode.cpp [code]
SysMgmt/MMC/mmc2.0/simple/staticnode.h [code]
SysMgmt/MMC/mmc2.0/simple/tracemacro.cpp [code]
SysMgmt/MMC/mmc2.0/simple/tracemacro.h [code]
SysMgmt/MMC/mmc2.0/viewex/about.cpp [code]
SysMgmt/MMC/mmc2.0/viewex/about.h [code]
SysMgmt/MMC/mmc2.0/viewex/adddevicedlg.cpp [code]
SysMgmt/MMC/mmc2.0/viewex/adddevicedlg.h [code]
SysMgmt/MMC/mmc2.0/viewex/addvfiledlg.cpp [code]
SysMgmt/MMC/mmc2.0/viewex/addvfiledlg.h [code]
SysMgmt/MMC/mmc2.0/viewex/basedialog.cpp [code]
SysMgmt/MMC/mmc2.0/viewex/basedialog.h [code]
SysMgmt/MMC/mmc2.0/viewex/basenode.h [code]
SysMgmt/MMC/mmc2.0/viewex/basesnap.cpp [code]
SysMgmt/MMC/mmc2.0/viewex/basesnap.h [code]
SysMgmt/MMC/mmc2.0/viewex/comp.cpp [code]
SysMgmt/MMC/mmc2.0/viewex/comp.h [code]
SysMgmt/MMC/mmc2.0/viewex/compdata.cpp [code]
SysMgmt/MMC/mmc2.0/viewex/compdata.h [code]
SysMgmt/MMC/mmc2.0/viewex/dataobj.cpp [code]
SysMgmt/MMC/mmc2.0/viewex/dataobj.h [code]
SysMgmt/MMC/mmc2.0/viewex/devicenode.cpp [code]
SysMgmt/MMC/mmc2.0/viewex/devicenode.h [code]
SysMgmt/MMC/mmc2.0/viewex/foldernode.cpp [code]
SysMgmt/MMC/mmc2.0/viewex/foldernode.h [code]
SysMgmt/MMC/mmc2.0/viewex/globals.cpp [code]
SysMgmt/MMC/mmc2.0/viewex/globals.h [code]
SysMgmt/MMC/mmc2.0/viewex/guids.h [code]
SysMgmt/MMC/mmc2.0/viewex/llistimpl.cpp [code]
SysMgmt/MMC/mmc2.0/viewex/llistimpl.h [code]
SysMgmt/MMC/mmc2.0/viewex/registry.cpp [code]
SysMgmt/MMC/mmc2.0/viewex/registry.h [code]
SysMgmt/MMC/mmc2.0/viewex/resource.h [code]
SysMgmt/MMC/mmc2.0/viewex/scripts.h [code]
SysMgmt/MMC/mmc2.0/viewex/staticnode.cpp [code]
SysMgmt/MMC/mmc2.0/viewex/staticnode.h [code]
SysMgmt/MMC/mmc2.0/viewex/tracemacro.cpp [code]
SysMgmt/MMC/mmc2.0/viewex/tracemacro.h [code]
SysMgmt/MMC/mmc2.0/viewex/virtualfile.cpp [code]
SysMgmt/MMC/mmc2.0/viewex/virtualfile.h [code]
SysMgmt/MMC/Multisel/about.Cpp [code]
SysMgmt/MMC/Multisel/about.h [code]
SysMgmt/MMC/Multisel/backgrnd.Cpp [code]
SysMgmt/MMC/Multisel/backgrnd.h [code]
SysMgmt/MMC/Multisel/basesnap.Cpp [code]
SysMgmt/MMC/Multisel/basesnap.h [code]
SysMgmt/MMC/Multisel/comp.Cpp [code]
SysMgmt/MMC/Multisel/comp.h [code]
SysMgmt/MMC/Multisel/compdata.Cpp [code]
SysMgmt/MMC/Multisel/compdata.h [code]
SysMgmt/MMC/Multisel/dataobj.Cpp [code]
SysMgmt/MMC/Multisel/dataobj.h [code]
SysMgmt/MMC/Multisel/delebase.Cpp [code]
SysMgmt/MMC/Multisel/delebase.h [code]
SysMgmt/MMC/Multisel/globals.h [code]
SysMgmt/MMC/Multisel/guids.h [code]
SysMgmt/MMC/Multisel/land.Cpp [code]
SysMgmt/MMC/Multisel/land.h [code]
SysMgmt/MMC/Multisel/localres.h [code]
SysMgmt/MMC/Multisel/mmccrack.Cpp [code]
SysMgmt/MMC/Multisel/people.Cpp [code]
SysMgmt/MMC/Multisel/people.h [code]
SysMgmt/MMC/Multisel/registry.Cpp [code]
SysMgmt/MMC/Multisel/registry.h [code]
SysMgmt/MMC/Multisel/resource.h [code]
SysMgmt/MMC/Multisel/sky.Cpp [code]
SysMgmt/MMC/Multisel/sky.h [code]
SysMgmt/MMC/Multisel/space.Cpp [code]
SysMgmt/MMC/Multisel/space.h [code]
SysMgmt/MMC/Multisel/statnode.Cpp [code]
SysMgmt/MMC/Multisel/statnode.h [code]
SysMgmt/MMC/Nameext/about.Cpp [code]
SysMgmt/MMC/Nameext/about.h [code]
SysMgmt/MMC/Nameext/basesnap.Cpp [code]
SysMgmt/MMC/Nameext/basesnap.h [code]
SysMgmt/MMC/Nameext/comp.Cpp [code]
SysMgmt/MMC/Nameext/comp.h [code]
SysMgmt/MMC/Nameext/dataobj.Cpp [code]
SysMgmt/MMC/Nameext/dataobj.h [code]
SysMgmt/MMC/Nameext/delebase.Cpp [code]
SysMgmt/MMC/Nameext/delebase.h [code]
SysMgmt/MMC/Nameext/extend.h [code]
SysMgmt/MMC/Nameext/globals.h [code]
SysMgmt/MMC/Nameext/guids.h [code]
SysMgmt/MMC/Nameext/localres.h [code]
SysMgmt/MMC/Nameext/mmccrack.Cpp [code]
SysMgmt/MMC/Nameext/nameext.Cpp [code]
SysMgmt/MMC/Nameext/nameext.h [code]
SysMgmt/MMC/Nameext/registry.Cpp [code]
SysMgmt/MMC/Nameext/registry.h [code]
SysMgmt/MMC/Nameext/resource.h [code]
SysMgmt/MMC/Nameext/sky.Cpp [code]
SysMgmt/MMC/Nameext/sky.h [code]
SysMgmt/MMC/Nodes/about.Cpp [code]
SysMgmt/MMC/Nodes/about.h [code]
SysMgmt/MMC/Nodes/backgrnd.Cpp [code]
SysMgmt/MMC/Nodes/backgrnd.h [code]
SysMgmt/MMC/Nodes/basesnap.Cpp [code]
SysMgmt/MMC/Nodes/basesnap.h [code]
SysMgmt/MMC/Nodes/comp.Cpp [code]
SysMgmt/MMC/Nodes/comp.h [code]
SysMgmt/MMC/Nodes/compdata.Cpp [code]
SysMgmt/MMC/Nodes/compdata.h [code]
SysMgmt/MMC/Nodes/dataobj.Cpp [code]
SysMgmt/MMC/Nodes/dataobj.h [code]
SysMgmt/MMC/Nodes/delebase.Cpp [code]
SysMgmt/MMC/Nodes/delebase.h [code]
SysMgmt/MMC/Nodes/globals.h [code]
SysMgmt/MMC/Nodes/guids.h [code]
SysMgmt/MMC/Nodes/land.Cpp [code]
SysMgmt/MMC/Nodes/land.h [code]
SysMgmt/MMC/Nodes/localres.h [code]
SysMgmt/MMC/Nodes/mmccrack.Cpp [code]
SysMgmt/MMC/Nodes/people.Cpp [code]
SysMgmt/MMC/Nodes/people.h [code]
SysMgmt/MMC/Nodes/registry.Cpp [code]
SysMgmt/MMC/Nodes/registry.h [code]
SysMgmt/MMC/Nodes/resource.h [code]
SysMgmt/MMC/Nodes/sky.Cpp [code]
SysMgmt/MMC/Nodes/sky.h [code]
SysMgmt/MMC/Nodes/space.Cpp [code]
SysMgmt/MMC/Nodes/space.h [code]
SysMgmt/MMC/Nodes/statnode.Cpp [code]
SysMgmt/MMC/Nodes/statnode.h [code]
SysMgmt/MMC/Openserv/about.Cpp [code]
SysMgmt/MMC/Openserv/about.h [code]
SysMgmt/MMC/Openserv/basesnap.Cpp [code]
SysMgmt/MMC/Openserv/basesnap.h [code]
SysMgmt/MMC/Openserv/comp.Cpp [code]
SysMgmt/MMC/Openserv/comp.h [code]
SysMgmt/MMC/Openserv/compdata.Cpp [code]
SysMgmt/MMC/Openserv/compdata.h [code]
SysMgmt/MMC/Openserv/dataobj.Cpp [code]
SysMgmt/MMC/Openserv/dataobj.h [code]
SysMgmt/MMC/Openserv/delebase.Cpp [code]
SysMgmt/MMC/Openserv/delebase.h [code]
SysMgmt/MMC/Openserv/globals.h [code]
SysMgmt/MMC/Openserv/guids.h [code]
SysMgmt/MMC/Openserv/land.Cpp [code]
SysMgmt/MMC/Openserv/land.h [code]
SysMgmt/MMC/Openserv/localres.h [code]
SysMgmt/MMC/Openserv/mmccrack.Cpp [code]
SysMgmt/MMC/Openserv/people.Cpp [code]
SysMgmt/MMC/Openserv/people.h [code]
SysMgmt/MMC/Openserv/registry.Cpp [code]
SysMgmt/MMC/Openserv/registry.h [code]
SysMgmt/MMC/Openserv/resource.h [code]
SysMgmt/MMC/Openserv/sky.Cpp [code]
SysMgmt/MMC/Openserv/sky.h [code]
SysMgmt/MMC/Openserv/space.Cpp [code]
SysMgmt/MMC/Openserv/space.h [code]
SysMgmt/MMC/Openserv/statnode.Cpp [code]
SysMgmt/MMC/Openserv/statnode.h [code]
SysMgmt/MMC/Ppgeext/about.Cpp [code]
SysMgmt/MMC/Ppgeext/about.h [code]
SysMgmt/MMC/Ppgeext/basesnap.Cpp [code]
SysMgmt/MMC/Ppgeext/basesnap.h [code]
SysMgmt/MMC/Ppgeext/extend.h [code]
SysMgmt/MMC/Ppgeext/globals.h [code]
SysMgmt/MMC/Ppgeext/guids.h [code]
SysMgmt/MMC/Ppgeext/localres.h [code]
SysMgmt/MMC/Ppgeext/ppgeext.Cpp [code]
SysMgmt/MMC/Ppgeext/ppgeext.h [code]
SysMgmt/MMC/Ppgeext/registry.Cpp [code]
SysMgmt/MMC/Ppgeext/registry.h [code]
SysMgmt/MMC/Ppgeext/resource.h [code]
SysMgmt/MMC/Proppage/about.Cpp [code]
SysMgmt/MMC/Proppage/about.h [code]
SysMgmt/MMC/Proppage/basesnap.Cpp [code]
SysMgmt/MMC/Proppage/basesnap.h [code]
SysMgmt/MMC/Proppage/comp.Cpp [code]
SysMgmt/MMC/Proppage/comp.h [code]
SysMgmt/MMC/Proppage/compdata.Cpp [code]
SysMgmt/MMC/Proppage/compdata.h [code]
SysMgmt/MMC/Proppage/dataobj.Cpp [code]
SysMgmt/MMC/Proppage/dataobj.h [code]
SysMgmt/MMC/Proppage/delebase.Cpp [code]
SysMgmt/MMC/Proppage/delebase.h [code]
SysMgmt/MMC/Proppage/globals.h [code]
SysMgmt/MMC/Proppage/guids.h [code]
SysMgmt/MMC/Proppage/land.Cpp [code]
SysMgmt/MMC/Proppage/land.h [code]
SysMgmt/MMC/Proppage/localres.h [code]
SysMgmt/MMC/Proppage/mmccrack.Cpp [code]
SysMgmt/MMC/Proppage/people.Cpp [code]
SysMgmt/MMC/Proppage/people.h [code]
SysMgmt/MMC/Proppage/registry.Cpp [code]
SysMgmt/MMC/Proppage/registry.h [code]
SysMgmt/MMC/Proppage/resource.h [code]
SysMgmt/MMC/Proppage/sky.Cpp [code]
SysMgmt/MMC/Proppage/sky.h [code]
SysMgmt/MMC/Proppage/space.Cpp [code]
SysMgmt/MMC/Proppage/space.h [code]
SysMgmt/MMC/Proppage/statnode.Cpp [code]
SysMgmt/MMC/Proppage/statnode.h [code]
SysMgmt/MMC/Simple/basesnap.Cpp [code]
SysMgmt/MMC/Simple/basesnap.h [code]
SysMgmt/MMC/Simple/comp.Cpp [code]
SysMgmt/MMC/Simple/comp.h [code]
SysMgmt/MMC/Simple/compdata.Cpp [code]
SysMgmt/MMC/Simple/compdata.h [code]
SysMgmt/MMC/Simple/dataobj.Cpp [code]
SysMgmt/MMC/Simple/dataobj.h [code]
SysMgmt/MMC/Simple/delebase.Cpp [code]
SysMgmt/MMC/Simple/delebase.h [code]
SysMgmt/MMC/Simple/globals.h [code]
SysMgmt/MMC/Simple/guids.h [code]
SysMgmt/MMC/Simple/localres.h [code]
SysMgmt/MMC/Simple/mmccrack.Cpp [code]
SysMgmt/MMC/Simple/registry.Cpp [code]
SysMgmt/MMC/Simple/registry.h [code]
SysMgmt/MMC/Simple/resource.h [code]
SysMgmt/MMC/Simple/statnode.Cpp [code]
SysMgmt/MMC/Simple/statnode.h [code]
SysMgmt/MMC/Taskpads/about.Cpp [code]
SysMgmt/MMC/Taskpads/about.h [code]
SysMgmt/MMC/Taskpads/basesnap.Cpp [code]
SysMgmt/MMC/Taskpads/basesnap.h [code]
SysMgmt/MMC/Taskpads/comp.Cpp [code]
SysMgmt/MMC/Taskpads/comp.h [code]
SysMgmt/MMC/Taskpads/compdata.Cpp [code]
SysMgmt/MMC/Taskpads/compdata.h [code]
SysMgmt/MMC/Taskpads/dataobj.Cpp [code]
SysMgmt/MMC/Taskpads/dataobj.h [code]
SysMgmt/MMC/Taskpads/delebase.Cpp [code]
SysMgmt/MMC/Taskpads/delebase.h [code]
SysMgmt/MMC/Taskpads/enumtask.Cpp [code]
SysMgmt/MMC/Taskpads/enumtask.h [code]
SysMgmt/MMC/Taskpads/globals.h [code]
SysMgmt/MMC/Taskpads/guids.h [code]
SysMgmt/MMC/Taskpads/land.Cpp [code]
SysMgmt/MMC/Taskpads/land.h [code]
SysMgmt/MMC/Taskpads/localres.h [code]
SysMgmt/MMC/Taskpads/mmccrack.Cpp [code]
SysMgmt/MMC/Taskpads/people.Cpp [code]
SysMgmt/MMC/Taskpads/people.h [code]
SysMgmt/MMC/Taskpads/registry.Cpp [code]
SysMgmt/MMC/Taskpads/registry.h [code]
SysMgmt/MMC/Taskpads/resource.h [code]
SysMgmt/MMC/Taskpads/sky.Cpp [code]
SysMgmt/MMC/Taskpads/sky.h [code]
SysMgmt/MMC/Taskpads/space.Cpp [code]
SysMgmt/MMC/Taskpads/space.h [code]
SysMgmt/MMC/Taskpads/statnode.Cpp [code]
SysMgmt/MMC/Taskpads/statnode.h [code]
SysMgmt/MMC/Tbarext/about.Cpp [code]
SysMgmt/MMC/Tbarext/about.h [code]
SysMgmt/MMC/Tbarext/basesnap.Cpp [code]
SysMgmt/MMC/Tbarext/basesnap.h [code]
SysMgmt/MMC/Tbarext/extend.h [code]
SysMgmt/MMC/Tbarext/globals.h [code]
SysMgmt/MMC/Tbarext/guids.h [code]
SysMgmt/MMC/Tbarext/localres.h [code]
SysMgmt/MMC/Tbarext/registry.Cpp [code]
SysMgmt/MMC/Tbarext/registry.h [code]
SysMgmt/MMC/Tbarext/resource.h [code]
SysMgmt/MMC/Tbarext/tbarext.Cpp [code]
SysMgmt/MMC/Tbarext/tbarext.h [code]
SysMgmt/MMC/Toolbar/about.Cpp [code]
SysMgmt/MMC/Toolbar/about.h [code]
SysMgmt/MMC/Toolbar/basesnap.Cpp [code]
SysMgmt/MMC/Toolbar/basesnap.h [code]
SysMgmt/MMC/Toolbar/comp.Cpp [code]
SysMgmt/MMC/Toolbar/comp.h [code]
SysMgmt/MMC/Toolbar/compdata.Cpp [code]
SysMgmt/MMC/Toolbar/compdata.h [code]
SysMgmt/MMC/Toolbar/dataobj.Cpp [code]
SysMgmt/MMC/Toolbar/dataobj.h [code]
SysMgmt/MMC/Toolbar/delebase.Cpp [code]
SysMgmt/MMC/Toolbar/delebase.h [code]
SysMgmt/MMC/Toolbar/globals.h [code]
SysMgmt/MMC/Toolbar/guids.h [code]
SysMgmt/MMC/Toolbar/land.Cpp [code]
SysMgmt/MMC/Toolbar/land.h [code]
SysMgmt/MMC/Toolbar/localres.h [code]
SysMgmt/MMC/Toolbar/mmccrack.Cpp [code]
SysMgmt/MMC/Toolbar/people.Cpp [code]
SysMgmt/MMC/Toolbar/people.h [code]
SysMgmt/MMC/Toolbar/registry.Cpp [code]
SysMgmt/MMC/Toolbar/registry.h [code]
SysMgmt/MMC/Toolbar/resource.h [code]
SysMgmt/MMC/Toolbar/sky.Cpp [code]
SysMgmt/MMC/Toolbar/sky.h [code]
SysMgmt/MMC/Toolbar/space.Cpp [code]
SysMgmt/MMC/Toolbar/space.h [code]
SysMgmt/MMC/Toolbar/statnode.Cpp [code]
SysMgmt/MMC/Toolbar/statnode.h [code]
SysMgmt/MMC/Toolbar/Help source/mmcsample.h [code]
SysMgmt/MMC/WMI/about.Cpp [code]
SysMgmt/MMC/WMI/about.h [code]
SysMgmt/MMC/WMI/basesnap.Cpp [code]
SysMgmt/MMC/WMI/basesnap.h [code]
SysMgmt/MMC/WMI/comp.Cpp [code]
SysMgmt/MMC/WMI/comp.h [code]
SysMgmt/MMC/WMI/compdata.Cpp [code]
SysMgmt/MMC/WMI/compdata.h [code]
SysMgmt/MMC/WMI/dataobj.Cpp [code]
SysMgmt/MMC/WMI/dataobj.h [code]
SysMgmt/MMC/WMI/delebase.Cpp [code]
SysMgmt/MMC/WMI/delebase.h [code]
SysMgmt/MMC/WMI/globals.h [code]
SysMgmt/MMC/WMI/guids.h [code]
SysMgmt/MMC/WMI/land.Cpp [code]
SysMgmt/MMC/WMI/land.h [code]
SysMgmt/MMC/WMI/localres.h [code]
SysMgmt/MMC/WMI/mmccrack.Cpp [code]
SysMgmt/MMC/WMI/people.Cpp [code]
SysMgmt/MMC/WMI/people.h [code]
SysMgmt/MMC/WMI/registry.Cpp [code]
SysMgmt/MMC/WMI/registry.h [code]
SysMgmt/MMC/WMI/resource.h [code]
SysMgmt/MMC/WMI/simplearray.h [code]
SysMgmt/MMC/WMI/sky.Cpp [code]
SysMgmt/MMC/WMI/sky.h [code]
SysMgmt/MMC/WMI/space.Cpp [code]
SysMgmt/MMC/WMI/space.h [code]
SysMgmt/MMC/WMI/statnode.Cpp [code]
SysMgmt/MMC/WMI/statnode.h [code]
SysMgmt/Msi/create.dll/Create.Cpp [code]
SysMgmt/Msi/msiloc/msiloc.cpp [code]
SysMgmt/Msi/msistuff/msistuff.cpp [code]
SysMgmt/Msi/process.dll/Process.cpp [code]
SysMgmt/Msi/remove.dll/Remove.cpp [code]
SysMgmt/Msi/setup.exe/common.h [code]
SysMgmt/Msi/setup.exe/resource.h [code]
SysMgmt/Msi/setup.exe/setup.cpp [code]
SysMgmt/Msi/setup.exe/setup.h [code]
SysMgmt/Msi/setup.exe/setupui.cpp [code]
SysMgmt/Msi/setup.exe/setupui.h [code]
SysMgmt/Msi/setup.exe/upgrdmsi.cpp [code]
SysMgmt/Msi/setup.exe/utils.cpp [code]
SysMgmt/Msi/setup.exe/vertrust.cpp [code]
SysMgmt/Msi/tutorial.dll/Tutorial.cpp [code]
SysMgmt/TaskSched/sa.Cpp [code]
SysMgmt/WMI/VC/AdvClient/AdvClient.cpp [code]
SysMgmt/WMI/VC/AdvClient/AdvClient.h [code]
SysMgmt/WMI/VC/AdvClient/AdvClientdlg.cpp [code]
SysMgmt/WMI/VC/AdvClient/AdvClientdlg.h [code]
SysMgmt/WMI/VC/AdvClient/officedlg.cpp [code]
SysMgmt/WMI/VC/AdvClient/officedlg.h [code]
SysMgmt/WMI/VC/AdvClient/onaddequipment.cpp [code]
SysMgmt/WMI/VC/AdvClient/onasync.cpp [code]
SysMgmt/WMI/VC/AdvClient/OnAsync.h [code]
SysMgmt/WMI/VC/AdvClient/onconnect.cpp [code]
SysMgmt/WMI/VC/AdvClient/ondiskdetails.cpp [code]
SysMgmt/WMI/VC/AdvClient/OnDiskPropsDescriptions.cpp [code]
SysMgmt/WMI/VC/AdvClient/onenumdisks.cpp [code]
SysMgmt/WMI/VC/AdvClient/onenumsvcs.cpp [code]
SysMgmt/WMI/VC/AdvClient/onperm.cpp [code]
SysMgmt/WMI/VC/AdvClient/onregister.cpp [code]
SysMgmt/WMI/VC/AdvClient/ontemp.cpp [code]
SysMgmt/WMI/VC/AdvClient/resource.h [code]
SysMgmt/WMI/VC/AdvClient/stdafx.cpp [code]
SysMgmt/WMI/VC/AdvClient/StdAfx.h [code]
SysMgmt/WMI/VC/ClassProv/ClassFac.Cpp [code]
SysMgmt/WMI/VC/ClassProv/ClassProv.Cpp [code]
SysMgmt/WMI/VC/ClassProv/MainDll.Cpp [code]
SysMgmt/WMI/VC/ClassProv/Sample.h [code]
SysMgmt/WMI/VC/ClassProv/Utils.Cpp [code]
SysMgmt/WMI/VC/CmdLineConsumer/CmdLineConsumer.Cpp [code]
SysMgmt/WMI/VC/CmdLineConsumer/CmdLineConsumer.h [code]
SysMgmt/WMI/VC/CmdLineConsumer/CmdLineConsumerDlg.Cpp [code]
SysMgmt/WMI/VC/CmdLineConsumer/CmdLineConsumerDlg.h [code]
SysMgmt/WMI/VC/CmdLineConsumer/Consumer.Cpp [code]
SysMgmt/WMI/VC/CmdLineConsumer/Consumer.h [code]
SysMgmt/WMI/VC/CmdLineConsumer/Factory.Cpp [code]
SysMgmt/WMI/VC/CmdLineConsumer/Factory.h [code]
SysMgmt/WMI/VC/CmdLineConsumer/Provider.Cpp [code]
SysMgmt/WMI/VC/CmdLineConsumer/Provider.h [code]
SysMgmt/WMI/VC/CmdLineConsumer/Resource.h [code]
SysMgmt/WMI/VC/CmdLineConsumer/StdAfx.Cpp [code]
SysMgmt/WMI/VC/CmdLineConsumer/StdAfx.h [code]
SysMgmt/WMI/VC/decoupled/Event_Consumer/Events.cpp [code]
SysMgmt/WMI/VC/decoupled/Event_Consumer/Globals.cpp [code]
SysMgmt/WMI/VC/decoupled/Event_Consumer/Main.cpp [code]
SysMgmt/WMI/VC/decoupled/Event_Consumer/PreComp.h [code]
SysMgmt/WMI/VC/decoupled/Event_Consumer/Include/Events.h [code]
SysMgmt/WMI/VC/decoupled/Event_Consumer/Include/Globals.h [code]
SysMgmt/WMI/VC/decoupled/Event_Consumer/Include/Resource.h [code]
SysMgmt/WMI/VC/decoupled/Event_Provider/Events.cpp [code]
SysMgmt/WMI/VC/decoupled/Event_Provider/Globals.cpp [code]
SysMgmt/WMI/VC/decoupled/Event_Provider/Main.cpp [code]
SysMgmt/WMI/VC/decoupled/Event_Provider/PreComp.h [code]
SysMgmt/WMI/VC/decoupled/Event_Provider/Include/Events.h [code]
SysMgmt/WMI/VC/decoupled/Event_Provider/Include/Globals.h [code]
SysMgmt/WMI/VC/decoupled/Event_Provider/Include/Resource.h [code]
SysMgmt/WMI/VC/decoupled/Instance_Provider/Globals.cpp [code]
SysMgmt/WMI/VC/decoupled/Instance_Provider/Main.cpp [code]
SysMgmt/WMI/VC/decoupled/Instance_Provider/PreComp.h [code]
SysMgmt/WMI/VC/decoupled/Instance_Provider/Service.cpp [code]
SysMgmt/WMI/VC/decoupled/Instance_Provider/Include/Globals.h [code]
SysMgmt/WMI/VC/decoupled/Instance_Provider/Include/Resource.h [code]
SysMgmt/WMI/VC/decoupled/Instance_Provider/Include/Service.h [code]
SysMgmt/WMI/VC/EventConsumer/Consumer.Cpp [code]
SysMgmt/WMI/VC/EventConsumer/Consumer.h [code]
SysMgmt/WMI/VC/EventConsumer/Factory.Cpp [code]
SysMgmt/WMI/VC/EventConsumer/Factory.h [code]
SysMgmt/WMI/VC/EventConsumer/PermEvents.Cpp [code]
SysMgmt/WMI/VC/EventConsumer/PermEvents.h [code]
SysMgmt/WMI/VC/EventConsumer/PermEventsdlg.Cpp [code]
SysMgmt/WMI/VC/EventConsumer/PermEventsdlg.h [code]
SysMgmt/WMI/VC/EventConsumer/Provider.Cpp [code]
SysMgmt/WMI/VC/EventConsumer/Provider.h [code]
SysMgmt/WMI/VC/EventConsumer/Resource.h [code]
SysMgmt/WMI/VC/EventConsumer/StdAfx.Cpp [code]
SysMgmt/WMI/VC/EventConsumer/StdAfx.h [code]
SysMgmt/WMI/VC/EventProvider/EvProv.Cpp [code]
SysMgmt/WMI/VC/EventProvider/EvProv.h [code]
SysMgmt/WMI/VC/EventProvider/OaHelp.Inl [code]
SysMgmt/WMI/VC/EventProvider/OleSrvr.Cpp [code]
SysMgmt/WMI/VC/FrameworkProv/FrameworkProv.Cpp [code]
SysMgmt/WMI/VC/FrameworkProv/FrameworkProv.h [code]
SysMgmt/WMI/VC/FrameworkProv/MainDll.Cpp [code]
SysMgmt/WMI/VC/HiPerfClient/RefClint.Cpp [code]
SysMgmt/WMI/VC/HiPerfClient/RefClint.h [code]
SysMgmt/WMI/VC/HiPerfClient/SamplCli.Cpp [code]
SysMgmt/WMI/VC/HiPerfProvider/BasicHiPerf.Cpp [code]
SysMgmt/WMI/VC/HiPerfProvider/BasicHiPerf.h [code]
SysMgmt/WMI/VC/HiPerfProvider/Factory.Cpp [code]
SysMgmt/WMI/VC/HiPerfProvider/Factory.h [code]
SysMgmt/WMI/VC/HiPerfProvider/Server.Cpp [code]
SysMgmt/WMI/VC/InstProv/ClassFac.Cpp [code]
SysMgmt/WMI/VC/InstProv/InstProv.Cpp [code]
SysMgmt/WMI/VC/InstProv/MainDll.Cpp [code]
SysMgmt/WMI/VC/InstProv/Sample.h [code]
SysMgmt/WMI/VC/InstProv/Utils.Cpp [code]
SysMgmt/WMI/VC/MethCli/MethCli.Cpp [code]
SysMgmt/WMI/VC/MethProv/ClassFac.Cpp [code]
SysMgmt/WMI/VC/MethProv/MainDll.Cpp [code]
SysMgmt/WMI/VC/MethProv/MethProv.Cpp [code]
SysMgmt/WMI/VC/MethProv/MethProv.h [code]
SysMgmt/WMI/VC/pathparser/PathParser.cpp [code]
SysMgmt/WMI/VC/PropProv/ClassFac.Cpp [code]
SysMgmt/WMI/VC/PropProv/MainDll.Cpp [code]
SysMgmt/WMI/VC/PropProv/PropProv.Cpp [code]
SysMgmt/WMI/VC/PropProv/Sample.h [code]
SysMgmt/WMI/VC/queryparser/QueryParser.cpp [code]
SysMgmt/WMI/VC/security/security.cpp [code]
SysMgmt/WMI/VC/SimpleClient/Resource.h [code]
SysMgmt/WMI/VC/SimpleClient/StdAfx.Cpp [code]
SysMgmt/WMI/VC/SimpleClient/StdAfx.h [code]
SysMgmt/WMI/VC/SimpleClient/WbemClient.Cpp [code]
SysMgmt/WMI/VC/SimpleClient/WbemClient.h [code]
SysMgmt/WMI/VC/SimpleClient/WbemClientDlg.Cpp [code]
SysMgmt/WMI/VC/SimpleClient/WbemClientDlg.h [code]
SysMgmt/WMI/VC/TempConsumer/Consumer.Cpp [code]
SysMgmt/WMI/VC/TempConsumer/OaHelp.Inl [code]
SysMgmt/WMI/VC/UtilLib/PreComp.h [code]
SysMgmt/WMI/VC/UtilLib/UtilLib.h [code]
SysMgmt/WMI/VC/UtilLib/Utils.Cpp [code]
SysMgmt/WMI/VC/UtilLib/WbemSec.Cpp [code]
SysMgmt/WMI/VC/UtilLib/WbemSec.h [code]
SysMgmt/WMI/VC/WMIDiskPerf/DpDetail.Cpp [code]
SysMgmt/WMI/VC/WMIDiskPerf/WMIDiskPerf.Cpp [code]
TabletPC/AdvReco/AdvReco.cpp [code]
TabletPC/AdvReco/AdvReco.h [code]
TabletPC/AdvReco/ChildWnds.cpp [code]
TabletPC/AdvReco/ChildWnds.h [code]
TabletPC/AdvReco/EventSinks.h [code]
TabletPC/AdvReco/resource.h [code]
TabletPC/AutoClaims/C#/AssemblyInfo.cs [code]
TabletPC/AutoClaims/C#/AutoClaims.cs [code]
TabletPC/AutoClaims15/C#/AssemblyInfo.cs [code]
TabletPC/AutoClaims15/C#/AutoClaims.cs [code]
TabletPC/AutoClaims_WebControl/C#/AssemblyInfo.cs [code]
TabletPC/AutoClaims_WebControl/C#/AutoClaims.cs [code]
TabletPC/BasicRecognition/BasicRecognition.cpp [code]
TabletPC/BasicRecognition/resource.h [code]
TabletPC/EventSink/EventSink.cpp [code]
TabletPC/EventSink/EventSink.h [code]
TabletPC/EventSink/Resource.h [code]
TabletPC/EventSink/TpcConpt.h [code]
TabletPC/InkBlog/C#/AddBlog.aspx.cs [code]
TabletPC/InkBlog/C#/AssemblyInfo.cs [code]
TabletPC/InkBlog/C#/Default.aspx.cs [code]
TabletPC/InkBlog/C#/InkArea.cs [code]
TabletPC/InkClipboard/AssemblyInfo.cs [code]
TabletPC/InkClipboard/InkClipboard.cs [code]
TabletPC/InkCollection/C#/AssemblyInfo.cs [code]
TabletPC/InkCollection/C#/InkCollection.cs [code]
TabletPC/InkCollection_RTS/C#/AssemblyInfo.cs [code]
TabletPC/InkCollection_RTS/C#/InkCollection.cs [code]
TabletPC/InkDivider/C#/AssemblyInfo.cs [code]
TabletPC/InkDivider/C#/InkDividerForm.cs [code]
TabletPC/InkErase/C#/AssemblyInfo.cs [code]
TabletPC/InkErase/C#/InkErase.cs [code]
TabletPC/InkHitTest/AssemblyInfo.cs [code]
TabletPC/InkHitTest/InkHitTest.cs [code]
TabletPC/InkRecognition/C#/AssemblyInfo.cs [code]
TabletPC/InkRecognition/C#/InkRecognition.cs [code]
TabletPC/InkZoom/C#/AssemblyInfo.cs [code]
TabletPC/InkZoom/C#/InkZoom.cs [code]
TabletPC/MultiReco/ChildWnds.cpp [code]
TabletPC/MultiReco/ChildWnds.h [code]
TabletPC/MultiReco/EventSinks.h [code]
TabletPC/MultiReco/MultiReco.cpp [code]
TabletPC/MultiReco/MultiReco.h [code]
TabletPC/MultiReco/resource.h [code]
TabletPC/RealTimeStylusPlugin/C#/AssemblyInfo.cs [code]
TabletPC/RealTimeStylusPlugin/C#/CustomDynamicRendererPlugin.cs [code]
TabletPC/RealTimeStylusPlugin/C#/PacketFilterPlugin.cs [code]
TabletPC/RealTimeStylusPlugin/C#/RealTimeStylusPluginApp.cs [code]
TabletPC/RecoDLL/RecoDll.cpp [code]
TabletPC/RecoDLL/StdAfx.cpp [code]
TabletPC/RecoDLL/StdAfx.h [code]
TabletPC/ScannedPaperForm/C#/AssemblyInfo.cs [code]
TabletPC/ScannedPaperForm/C#/PaperForm.cs [code]
TabletPC/Serialization/AssemblyInfo.cs [code]
TabletPC/Serialization/Serialization.cs [code]
TabletPC/TPCInfo/resource.h [code]
TabletPC/TPCInfo/TPCInfo.cpp [code]
UDDI/publish/AssemblyInfo.cs [code]
UDDI/publish/publish.cs [code]
UDDI/wsdldiscovery/AssemblyInfo.cs [code]
UDDI/wsdldiscovery/main.cs [code]
UDDI/wsdldiscovery/controls/categorytree.cs [code]
Web/bits/bits_ie/bits_ie.cpp [code]
Web/bits/bits_ie/resource.h [code]
Web/bits/Upload/cdialog.cpp [code]
Web/bits/Upload/cdialog.h [code]
Web/bits/Upload/cmonitor.cpp [code]
Web/bits/Upload/cmonitor.h [code]
Web/bits/Upload/cpack.cpp [code]
Web/bits/Upload/cpack.h [code]
Web/bits/Upload/main.cpp [code]
Web/bits/Upload/main.h [code]
Web/bits/Upload/resource.h [code]
Web/bits/Upload/util.cpp [code]
Web/bits/Upload/util.h [code]
Web/Browser/BrochureMachine/BrochureMachine.cpp [code]
Web/Browser/BrochureMachine/BrochureMachine.idl [code]
Web/Browser/BrochureMachine/BrochureMachine_p.c [code]
Web/Browser/BrochureMachine/dlldata.c [code]
Web/Browser/BrochureMachine/PTLauncher.cpp [code]
Web/Browser/BrochureMachine/PTLauncher.h [code]
Web/Browser/BrochureMachine/resource.h [code]
Web/Browser/BrochureMachine/StdAfx.cpp [code]
Web/Browser/BrochureMachine/StdAfx.h [code]
Web/Browser/EdAnnotator/AnnotatorProject/Annotator.cpp [code]
Web/Browser/EdAnnotator/AnnotatorProject/Annotator.h [code]
Web/Browser/EdAnnotator/AnnotatorProject/dlldata.c [code]
Web/Browser/EdAnnotator/AnnotatorProject/EDAnnotator.cpp [code]
Web/Browser/EdAnnotator/AnnotatorProject/EDAnnotator.idl [code]
Web/Browser/EdAnnotator/AnnotatorProject/EDAnnotator_p.c [code]
Web/Browser/EdAnnotator/AnnotatorProject/resource.h [code]
Web/Browser/EdAnnotator/AnnotatorProject/StdAfx.cpp [code]
Web/Browser/EdAnnotator/AnnotatorProject/StdAfx.h [code]
Web/Browser/EditCommands/BrowserHost.cpp [code]
Web/Browser/EditCommands/BrowserHost.h [code]
Web/Browser/EditCommands/dlldata.c [code]
Web/Browser/EditCommands/EdCommands.cpp [code]
Web/Browser/EditCommands/EdCommands.idl [code]
Web/Browser/EditCommands/EdCommands_p.c [code]
Web/Browser/EditCommands/resource.h [code]
Web/Browser/EditCommands/StdAfx.cpp [code]
Web/Browser/EditCommands/StdAfx.h [code]
Web/Browser/EditFeatures/BrowserHost.cpp [code]
Web/Browser/EditFeatures/BrowserHost.h [code]
Web/Browser/EditFeatures/dlldata.c [code]
Web/Browser/EditFeatures/EdCommands.cpp [code]
Web/Browser/EditFeatures/EdCommands.idl [code]
Web/Browser/EditFeatures/EdCommands_p.c [code]
Web/Browser/EditFeatures/resource.h [code]
Web/Browser/EditFeatures/StdAfx.cpp [code]
Web/Browser/EditFeatures/StdAfx.h [code]
Web/Browser/EditGlyphs/BrowserHost.cpp [code]
Web/Browser/EditGlyphs/BrowserHost.h [code]
Web/Browser/EditGlyphs/dlldata.c [code]
Web/Browser/EditGlyphs/EdGlyphs.cpp [code]
Web/Browser/EditGlyphs/EdGlyphs.idl [code]
Web/Browser/EditGlyphs/EdGlyphs_p.c [code]
Web/Browser/EditGlyphs/resource.h [code]
Web/Browser/EditGlyphs/StdAfx.cpp [code]
Web/Browser/EditGlyphs/StdAfx.h [code]
Web/Browser/EditHost/BrowserHost.cpp [code]
Web/Browser/EditHost/BrowserHost.h [code]
Web/Browser/EditHost/dlldata.c [code]
Web/Browser/EditHost/EdHost.cpp [code]
Web/Browser/EditHost/EdHost.idl [code]
Web/Browser/EditHost/EdHost_p.c [code]
Web/Browser/EditHost/Grid.cpp [code]
Web/Browser/EditHost/Grid.h [code]
Web/Browser/EditHost/resource.h [code]
Web/Browser/EditHost/Snap.cpp [code]
Web/Browser/EditHost/Snap.h [code]
Web/Browser/EditHost/StdAfx.cpp [code]
Web/Browser/EditHost/StdAfx.h [code]
Web/Browser/RenderBehave/renderproject/Behavior.cpp [code]
Web/Browser/RenderBehave/renderproject/Behavior.h [code]
Web/Browser/RenderBehave/renderproject/Dlldata.c [code]
Web/Browser/RenderBehave/renderproject/EventSink.cpp [code]
Web/Browser/RenderBehave/renderproject/EventSink.h [code]
Web/Browser/RenderBehave/renderproject/Factory.cpp [code]
Web/Browser/RenderBehave/renderproject/Factory.h [code]
Web/Browser/RenderBehave/renderproject/Render.cpp [code]
Web/Browser/RenderBehave/renderproject/Render.idl [code]
Web/Browser/RenderBehave/renderproject/Render_p.c [code]
Web/Browser/RenderBehave/renderproject/Resource.h [code]
Web/Browser/RenderBehave/renderproject/Stdafx.cpp [code]
Web/Browser/RenderBehave/renderproject/Stdafx.h [code]
Web/dxtrans/dxsurf1/dxsurf1.cpp [code]
Web/dxtrans/dxsurf1/resource.h [code]
Web/dxtrans/dxsurf2/dxsurf2.cpp [code]
Web/dxtrans/dxsurf2/resource.h [code]
Web/dxtrans/dxsurf3/dxsurf3.cpp [code]
Web/dxtrans/dxsurf3/resource.h [code]
Web/dxtrans/dxsurfmod/main.cpp [code]
Web/dxtrans/dxsurfmod/resource.h [code]
Web/iis/Components/Cpp/Intermediate/Catlpwr.Cpp [code]
Web/iis/Components/Cpp/Intermediate/Catlpwr.Idl [code]
Web/iis/Components/Cpp/Intermediate/Context.Cpp [code]
Web/iis/Components/Cpp/Intermediate/Context.h [code]
Web/iis/Components/Cpp/Intermediate/Power.Cpp [code]
Web/iis/Components/Cpp/Intermediate/Power.h [code]
Web/iis/Components/Cpp/Intermediate/Resource.h [code]
Web/iis/Components/Cpp/Intermediate/StdAfx.Cpp [code]
Web/iis/Components/Cpp/Intermediate/StdAfx.h [code]
Web/iis/Components/Cpp/MTXSample/Account.cpp [code]
Web/iis/Components/Cpp/MTXSample/Account.h [code]
Web/iis/Components/Cpp/MTXSample/BankVC.cpp [code]
Web/iis/Components/Cpp/MTXSample/BankVC.idl [code]
Web/iis/Components/Cpp/MTXSample/CreateTable.cpp [code]
Web/iis/Components/Cpp/MTXSample/CreateTable.h [code]
Web/iis/Components/Cpp/MTXSample/MoveMoney.cpp [code]
Web/iis/Components/Cpp/MTXSample/MoveMoney.h [code]
Web/iis/Components/Cpp/MTXSample/resource.h [code]
Web/iis/Components/Cpp/MTXSample/StdAfx.cpp [code]
Web/iis/Components/Cpp/MTXSample/StdAfx.h [code]
Web/iis/Components/Cpp/Simple/CatlSmpl.Cpp [code]
Web/iis/Components/Cpp/Simple/CatlSmpl.Idl [code]
Web/iis/Components/Cpp/Simple/Resource.h [code]
Web/iis/Components/Cpp/Simple/Simple.Cpp [code]
Web/iis/Components/Cpp/Simple/Simple.h [code]
Web/iis/Components/Cpp/Simple/StdAfx.Cpp [code]
Web/iis/Components/Cpp/Simple/StdAfx.h [code]
Web/iis/extensions/Chunk/cte_enc.c [code]
Web/iis/extensions/Chunk/ctetest.c [code]
Web/iis/extensions/Chunk/ctetest.h [code]
Web/iis/extensions/DumpVars/DumpVars.cpp [code]
Web/iis/extensions/Formdump/formdump.cpp [code]
Web/iis/extensions/Formdump/html.cpp [code]
Web/iis/extensions/Formdump/html.h [code]
Web/iis/extensions/Formdump/keys.cpp [code]
Web/iis/extensions/Formdump/keys.h [code]
Web/iis/extensions/InvokObjThreads/InvokObjThreads.cpp [code]
Web/iis/extensions/InvokObjThreads/IsapiThread.cpp [code]
Web/iis/extensions/InvokObjThreads/IsapiThread.h [code]
Web/iis/extensions/io/ASyncRead/areadcli.c [code]
Web/iis/extensions/io/ASyncTrans/ftrans.c [code]
Web/iis/extensions/io/ASyncTrans/openf.c [code]
Web/iis/extensions/io/ASyncTrans/openf.h [code]
Web/iis/extensions/io/ASyncWrite/fwasync.c [code]
Web/iis/extensions/io/ASyncWrite/openf.c [code]
Web/iis/extensions/io/ASyncWrite/openf.h [code]
Web/iis/extensions/io/SyncRead/readcli.c [code]
Web/iis/extensions/io/SyncWrite/fwrite.c [code]
Web/iis/extensions/io/SyncWrite/openf.c [code]
Web/iis/extensions/io/SyncWrite/openf.h [code]
Web/iis/extensions/Keep-Alive/KeepAlive.c [code]
Web/iis/extensions/KeepAliveWithThreads/KeepAliveP.c [code]
Web/iis/extensions/KeepAliveWithThreads/ThreadPool.c [code]
Web/iis/extensions/KeepAliveWithThreads/ThreadPool.h [code]
Web/iis/extensions/Redirect/Redirect.cpp [code]
Web/iis/extensions/Simple/Simple.cpp [code]
Web/iis/extensions/WorkerThread/WorkerThread.c [code]
Web/iis/filters/AuthFilt/AuthFilt.c [code]
Web/iis/filters/AuthFilt/AuthFilt.h [code]
Web/iis/filters/AuthFilt/cache.c [code]
Web/iis/filters/AuthFilt/db.c [code]
Web/iis/filters/UpCase/UpCase.c [code]
Web/iis/ISAPI_6.0/Extension.cpp [code]
Web/iis/ISAPI_6.0/CacheIsapi/CacheIsapi.cpp [code]
Web/iis/ISAPI_6.0/CustomAuth/CustomAuth.cpp [code]
Web/iis/ISAPI_6.0/CustomAuth/CustomAuth.h [code]
Web/iis/ISAPI_6.0/CustomAuth/Redir401.cpp [code]
Web/iis/ISAPI_6.0/DumpRequestInfo/DumpRequestInfo.cpp [code]
Web/iis/ISAPI_6.0/HelloIsapi/HelloIsapi.cpp [code]
Web/iis/ISAPI_6.0/inc/IsapiBuffer.h [code]
Web/iis/ISAPI_6.0/inc/IsapiDebug.h [code]
Web/iis/ISAPI_6.0/inc/IsapiExtension.h [code]
Web/iis/ISAPI_6.0/inc/IsapiModule.h [code]
Web/iis/ISAPI_6.0/inc/IsapiRequest.h [code]
Web/iis/ISAPI_6.0/inc/IsapiString.h [code]
Web/iis/ISAPI_6.0/inc/IsapiStringW.h [code]
Web/iis/ISAPI_6.0/inc/IsapiTime.h [code]
Web/iis/ISAPI_6.0/inc/IsapiTools.h [code]
Web/iis/ISAPI_6.0/PoolWrap/Extension.cpp [code]
Web/iis/ISAPI_6.0/PoolWrap/PoolWrap.cpp [code]
Web/iis/ISAPI_6.0/PoolWrap/PoolWrap.h [code]
Web/iis/ISAPI_6.0/ReMapUrl/ReMapUrl.cpp [code]
Web/iis/ISAPI_6.0/src/IsapiBuffer.cpp [code]
Web/iis/ISAPI_6.0/src/IsapiDebug.cpp [code]
Web/iis/ISAPI_6.0/src/IsapiExtension.cpp [code]
Web/iis/ISAPI_6.0/src/IsapiModule.cpp [code]
Web/iis/ISAPI_6.0/src/IsapiRequest.cpp [code]
Web/iis/ISAPI_6.0/src/IsapiString.cpp [code]
Web/iis/ISAPI_6.0/src/IsapiStringW.cpp [code]
Web/iis/ISAPI_6.0/src/IsapiTime.cpp [code]
Web/iis/ISAPI_6.0/UpCaseMap/UpCaseMap.cpp [code]
Web/iis/ISAPI_6.0/WildCardMap/WildCardMap.cpp [code]
Web/iis/progadmin/ABO/EnumerateKeys/EnumerateKeys.cpp [code]
Web/MSAgent/c/Cap/About.Cpp [code]
Web/MSAgent/c/Cap/About.h [code]
Web/MSAgent/c/Cap/Cap.Cpp [code]
Web/MSAgent/c/Cap/Error.Cpp [code]
Web/MSAgent/c/Cap/Error.h [code]
Web/MSAgent/c/Cap/MainDlg.Cpp [code]
Web/MSAgent/c/Cap/MainDlg.h [code]
Web/MSAgent/c/Cap/Notify.Cpp [code]
Web/MSAgent/c/Cap/Notify.h [code]
Web/MSAgent/c/Cap/Resource.h [code]
Web/MSAgent/c/Cap/StdAfx.Cpp [code]
Web/MSAgent/c/Cap/StdAfx.h [code]
Web/MSAgent/c/Cap/StrConv.h [code]
Web/MSAgent/c/CapMFC/AcAnim.Cpp [code]
Web/MSAgent/c/CapMFC/AcAnim.h [code]
Web/MSAgent/c/CapMFC/AcAudio.Cpp [code]
Web/MSAgent/c/CapMFC/AcAudio.h [code]
Web/MSAgent/c/CapMFC/AcBall.Cpp [code]
Web/MSAgent/c/CapMFC/AcBall.h [code]
Web/MSAgent/c/CapMFC/AcChar.Cpp [code]
Web/MSAgent/c/CapMFC/AcChar.h [code]
Web/MSAgent/c/CapMFC/AcChars.Cpp [code]
Web/MSAgent/c/CapMFC/AcChars.h [code]
Web/MSAgent/c/CapMFC/AcComm.Cpp [code]
Web/MSAgent/c/CapMFC/AcComm.h [code]
Web/MSAgent/c/CapMFC/AcComms.Cpp [code]
Web/MSAgent/c/CapMFC/AcComms.h [code]
Web/MSAgent/c/CapMFC/Acex.Cpp [code]
Web/MSAgent/c/CapMFC/Acex.h [code]
Web/MSAgent/c/CapMFC/AcProp.Cpp [code]
Web/MSAgent/c/CapMFC/AcProp.h [code]
Web/MSAgent/c/CapMFC/AcReq.Cpp [code]
Web/MSAgent/c/CapMFC/AcReq.h [code]
Web/MSAgent/c/CapMFC/AcUser.Cpp [code]
Web/MSAgent/c/CapMFC/AcUser.h [code]
Web/MSAgent/c/CapMFC/CapMFC.Cpp [code]
Web/MSAgent/c/CapMFC/CapMFC.h [code]
Web/MSAgent/c/CapMFC/MainDlg.Cpp [code]
Web/MSAgent/c/CapMFC/MainDlg.h [code]
Web/MSAgent/c/CapMFC/Resource.h [code]
Web/MSAgent/c/CapMFC/StdAfx.Cpp [code]
Web/MSAgent/c/CapMFC/StdAfx.h [code]
Web/MSAgent/c/Hello/Hello.Cpp [code]
Web/MSAgent/c/Hello2/Hello2.Cpp [code]
Web/MSAgent/c/Hello2/Hello2.h [code]
Web/MSAgent/c/Hello2/Notify.Cpp [code]
Web/MSAgent/c/Hello2/Notify.h [code]
Web/MSAgent/c/Hello3/Hello3.Cpp [code]
Web/MSAgent/c/Hello3/Hello3.h [code]
Web/MSAgent/c/Hello3/Notify.Cpp [code]
Web/MSAgent/c/Hello3/Notify.h [code]
Web/MSAgent/Java/CapJ/about.java [code]
Web/MSAgent/Java/CapJ/capj.java [code]
Web/MSAgent/Java/Hello/HelloJ.java [code]
Web/MSAgent/Java/Hello2/Hello2J.java [code]
Web/MSAgent/Java/Hello2/notify.java [code]
Web/MSAgent/Java/Hello3/Hello3J.java [code]
Web/MSAgent/Java/Hello3/Notify.java [code]
Web/NetMeeting/InstCodc/InstCodc.Cpp [code]
Web/NetMeeting/InstCodc/Resource.h [code]
Web/NetMeeting/NMChat/CConf.Cpp [code]
Web/NetMeeting/NMChat/CConf.h [code]
Web/NetMeeting/NMChat/cData.Cpp [code]
Web/NetMeeting/NMChat/cData.h [code]
Web/NetMeeting/NMChat/clUtil.Cpp [code]
Web/NetMeeting/NMChat/clUtil.h [code]
Web/NetMeeting/NMChat/Cmd.Cpp [code]
Web/NetMeeting/NMChat/cMemb.Cpp [code]
Web/NetMeeting/NMChat/cMemb.h [code]
Web/NetMeeting/NMChat/Debug.Cpp [code]
Web/NetMeeting/NMChat/Global.h [code]
Web/NetMeeting/NMChat/IMSConf2.Idl [code]
Web/NetMeeting/NMChat/Main.Cpp [code]
Web/NetMeeting/NMChat/Msg.Cpp [code]
Web/NetMeeting/NMChat/PreComp.h [code]
Web/NetMeeting/NMChat/Resource.h [code]
Web/NetMeeting/NMChat/Util.Cpp [code]
Web/NetMeeting/NMChat2/applet.cpp [code]
Web/NetMeeting/NMChat2/applet.h [code]
Web/NetMeeting/NMChat2/conf.cpp [code]
Web/NetMeeting/NMChat2/conf.h [code]
Web/NetMeeting/NMChat2/iapplet.c [code]
Web/NetMeeting/NMChat2/iapplet.h [code]
Web/NetMeeting/NMChat2/iapplet.idl [code]
Web/NetMeeting/NMChat2/imsconf2.idl [code]
Web/NetMeeting/NMChat2/precomp.h [code]
Web/NetMeeting/NMChat2/resource.h [code]
Web/NetMeeting/NMChat2/session.cpp [code]
Web/NetMeeting/NMChat2/session.h [code]
Web/NetMeeting/NMChat2/ui.cpp [code]
Web/NetMeeting/NMFT/CConf.Cpp [code]
Web/NetMeeting/NMFT/CConf.h [code]
Web/NetMeeting/NMFT/clUtil.Cpp [code]
Web/NetMeeting/NMFT/clUtil.h [code]
Web/NetMeeting/NMFT/Debug.Cpp [code]
Web/NetMeeting/NMFT/Global.h [code]
Web/NetMeeting/NMFT/IMSConf2.Idl [code]
Web/NetMeeting/NMFT/Main.Cpp [code]
Web/NetMeeting/NMFT/Msg.Cpp [code]
Web/NetMeeting/NMFT/PreComp.h [code]
Web/NetMeeting/NMFT/Resource.h [code]
Web/NetMeeting/NMFT/Util.Cpp [code]
Web/NetMeeting/NMShare/CConf.Cpp [code]
Web/NetMeeting/NMShare/CConf.h [code]
Web/NetMeeting/NMShare/chWnd.Cpp [code]
Web/NetMeeting/NMShare/clUtil.Cpp [code]
Web/NetMeeting/NMShare/clUtil.h [code]
Web/NetMeeting/NMShare/Cmd.Cpp [code]
Web/NetMeeting/NMShare/cMemb.Cpp [code]
Web/NetMeeting/NMShare/cMemb.h [code]
Web/NetMeeting/NMShare/cShare.Cpp [code]
Web/NetMeeting/NMShare/cShare.h [code]
Web/NetMeeting/NMShare/Debug.Cpp [code]
Web/NetMeeting/NMShare/Global.h [code]
Web/NetMeeting/NMShare/IMSConf2.Idl [code]
Web/NetMeeting/NMShare/Main.Cpp [code]
Web/NetMeeting/NMShare/Msg.Cpp [code]
Web/NetMeeting/NMShare/PreComp.h [code]
Web/NetMeeting/NMShare/Resource.h [code]
Web/NetMeeting/NMShare/Util.Cpp [code]
Web/NetMeeting/NMUI/CCall.Cpp [code]
Web/NetMeeting/NMUI/CCall.h [code]
Web/NetMeeting/NMUI/CChan.Cpp [code]
Web/NetMeeting/NMUI/CChan.h [code]
Web/NetMeeting/NMUI/CConf.Cpp [code]
Web/NetMeeting/NMUI/CConf.h [code]
Web/NetMeeting/NMUI/cData.Cpp [code]
Web/NetMeeting/NMUI/cData.h [code]
Web/NetMeeting/NMUI/cft.cpp [code]
Web/NetMeeting/NMUI/cft.h [code]
Web/NetMeeting/NMUI/clUtil.Cpp [code]
Web/NetMeeting/NMUI/clUtil.h [code]
Web/NetMeeting/NMUI/Cmd.Cpp [code]
Web/NetMeeting/NMUI/cMemb.Cpp [code]
Web/NetMeeting/NMUI/cMemb.h [code]
Web/NetMeeting/NMUI/cMgr.Cpp [code]
Web/NetMeeting/NMUI/cMgr.h [code]
Web/NetMeeting/NMUI/cshare.cpp [code]
Web/NetMeeting/NMUI/cshare.h [code]
Web/NetMeeting/NMUI/Debug.Cpp [code]
Web/NetMeeting/NMUI/Dlg.Cpp [code]
Web/NetMeeting/NMUI/Global.h [code]
Web/NetMeeting/NMUI/IMSConf2.Idl [code]
Web/NetMeeting/NMUI/Init.Cpp [code]
Web/NetMeeting/NMUI/Main.Cpp [code]
Web/NetMeeting/NMUI/Msg.Cpp [code]
Web/NetMeeting/NMUI/PreComp.h [code]
Web/NetMeeting/NMUI/Resource.h [code]
Web/NetMeeting/NMUI/rtns.Cpp [code]
Web/NetMeeting/NMUI/sBar.Cpp [code]
Web/NetMeeting/NMUI/Util.Cpp [code]
Web/NetMeeting/PlugTransport/imsconf3.idl [code]
Web/NetMeeting/PlugTransport/iplgxprt.idl [code]
Web/NetMeeting/PlugTransport/nmsession.cpp [code]
Web/NetMeeting/PlugTransport/nmsession.h [code]
Web/NetMeeting/PlugTransport/nullmdm.cpp [code]
Web/NetMeeting/PlugTransport/nullmdm.h [code]
Web/NetMeeting/PlugTransport/plugtransport.idl [code]
Web/NetMeeting/PlugTransport/plugxprt.cpp [code]
Web/NetMeeting/PlugTransport/plugxprt.h [code]
Web/NetMeeting/PlugTransport/precomp.h [code]
Web/NetMeeting/PlugTransport/resource.h [code]
Web/NetMeeting/PlugTransport/ui.cpp [code]
Web/NetMeeting/PlugTransport/utils.cpp [code]
Web/NetMeeting/PlugTransport/utils.h [code]
Web/NetMeeting/PlugTransport/x224.cpp [code]
Web/NetMeeting/PlugTransport/x224.h [code]
Web/networking/asyncdemo/AsyncDemo.cpp [code]
Web/networking/asyncdemo/resource.h [code]
Web/networking/ftpjr/FTPJr.cpp [code]
Web/networking/httpauth/httpauth.cpp [code]
Web/networking/httpdump/HeadDump.cpp [code]
Web/winhttp/asyncdemocomplete/AsyncDemo.cpp [code]
Web/winhttp/asyncdemocomplete/resource.h [code]
Web/winhttp/asyncdemotutorial/AsyncDemo.cpp [code]
Web/winhttp/asyncdemotutorial/resource.h [code]
Web/winhttp/retoptions/RetOptions.cpp [code]
Web/winhttp/setoptions/SetOptions.cpp [code]
Web/winhttp/WinHttpAsyncSample/browser.cpp [code]
Web/winhttp/WinHttpAsyncSample/browser.h [code]
Web/winhttp/WinHttpAsyncSample/defs.h [code]
Web/winhttp/WinHttpAsyncSample/SimpleBrowser.cpp [code]
Web/winhttp/WinHttpFormSubmitSample/WinHttpFormSubmitSample.cpp [code]
Web/winhttp/WinHttpPostSample/WinHttpPostSample.cpp [code]
Web/xml/mfc_tree/resource.h [code]
Web/xml/mfc_tree/StdAfx.cpp [code]
Web/xml/mfc_tree/StdAfx.h [code]
Web/xml/mfc_tree/XMLTree.cpp [code]
Web/xml/mfc_tree/XMLTree.h [code]
Web/xml/mfc_tree/XMLTreeDlg.cpp [code]
Web/xml/mfc_tree/XMLTreeDlg.h [code]
WinBase/Cluster/Win2003/ClipBookServer/ClipBook Server/ClipBook Server.cpp [code]
WinBase/Cluster/Win2003/ClipBookServer/ClipBook Server/ClRes.cpp [code]
WinBase/Cluster/Win2003/ClipBookServer/ClipBook Server/ClRes.h [code]
WinBase/Cluster/Win2003/ClipBookServer/ClipBook Server/CMgdClusCfgInit.cpp [code]
WinBase/Cluster/Win2003/ClipBookServer/ClipBook Server/CMgdClusCfgInit.h [code]
WinBase/Cluster/Win2003/ClipBookServer/ClipBook Server/CMgdResType.cpp [code]
WinBase/Cluster/Win2003/ClipBookServer/ClipBook Server/CMgdResType.h [code]
WinBase/Cluster/Win2003/ClipBookServer/ClipBook Server/Guids.h [code]
WinBase/Cluster/Win2003/ClipBookServer/ClipBook Server/MgdResource.idl [code]
WinBase/Cluster/Win2003/ClipBookServer/ClipBook Server/Resource.h [code]
WinBase/Cluster/Win2003/ClipBookServer/ClipBook Server/StringUtils.cpp [code]
WinBase/Cluster/Win2003/ClipBookServer/ClipBook Server/StringUtils.h [code]
WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/BasePage.cpp [code]
WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/BasePage.h [code]
WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/ClipBook ServerEx.cpp [code]
WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/ClipBook ServerEx.h [code]
WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/DDxDDv.cpp [code]
WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/DDxDDv.h [code]
WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/ExtObj.cpp [code]
WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/ExtObj.h [code]
WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/ExtObjData.cpp [code]
WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/ExtObjData.h [code]
WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/ExtObjID.idl [code]
WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/PropList.cpp [code]
WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/PropList.h [code]
WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/RegExt.cpp [code]
WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/RegExt.h [code]
WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/resource.h [code]
WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/ResProp.cpp [code]
WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/ResProp.h [code]
WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/StdAfx.cpp [code]
WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/StdAfx.h [code]
WinBase/Cluster/Win2003/FileShareSample/File Share Sample/ClRes.cpp [code]
WinBase/Cluster/Win2003/FileShareSample/File Share Sample/ClRes.h [code]
WinBase/Cluster/Win2003/FileShareSample/File Share Sample/File Share Sample.cpp [code]
WinBase/Cluster/Win2003/FileShareSample/File Share Sample/StringUtils.cpp [code]
WinBase/Cluster/Win2003/FileShareSample/File Share Sample/StringUtils.h [code]
WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/BasePage.cpp [code]
WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/BasePage.h [code]
WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/DDxDDv.cpp [code]
WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/DDxDDv.h [code]
WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/ExtObj.cpp [code]
WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/ExtObj.h [code]
WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/ExtObjData.cpp [code]
WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/ExtObjData.h [code]
WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/ExtObjID.idl [code]
WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/File Share SampleEx.cpp [code]
WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/File Share SampleEx.h [code]
WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/PropList.cpp [code]
WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/PropList.h [code]
WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/RegExt.cpp [code]
WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/RegExt.h [code]
WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/resource.h [code]
WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/ResProp.cpp [code]
WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/ResProp.h [code]
WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/StdAfx.cpp [code]
WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/StdAfx.h [code]
WinBase/Cluster/Win2003/MyCapabilities/Dll.cpp [code]
WinBase/Cluster/Win2003/MyCapabilities/MyCapabilities.cpp [code]
WinBase/Cluster/Win2003/MyCapabilities/MyCapabilities.h [code]
WinBase/Cluster/Win2003/MyCapabilities/Resource.h [code]
WinBase/Cluster/Win2003/MyCapabilities/StdAfx.cpp [code]
WinBase/Cluster/Win2003/MyCapabilities/StdAfx.h [code]
WinBase/Cluster/Win2003/MyEvictListener/dll.cpp [code]
WinBase/Cluster/Win2003/MyEvictListener/MyEvictListener.cpp [code]
WinBase/Cluster/Win2003/MyEvictListener/MyEvictListener.h [code]
WinBase/Cluster/Win2003/MyEvictListener/resource.h [code]
WinBase/Cluster/Win2003/MyEvictListener/StdAfx.cpp [code]
WinBase/Cluster/Win2003/MyEvictListener/StdAfx.h [code]
WinBase/Cluster/Win2003/MyMemberSetChangeListener/dll.cpp [code]
WinBase/Cluster/Win2003/MyMemberSetChangeListener/MyMemberSetChangeListener.cpp [code]
WinBase/Cluster/Win2003/MyMemberSetChangeListener/MyMemberSetChangeListener.h [code]
WinBase/Cluster/Win2003/MyMemberSetChangeListener/resource.h [code]
WinBase/Cluster/Win2003/MyMemberSetChangeListener/StdAfx.cpp [code]
WinBase/Cluster/Win2003/MyMemberSetChangeListener/StdAfx.h [code]
WinBase/Cluster/Win2003/MyStartupListener/Dll.cpp [code]
WinBase/Cluster/Win2003/MyStartupListener/MyStartupListener.cpp [code]
WinBase/Cluster/Win2003/MyStartupListener/MyStartupListener.h [code]
WinBase/Cluster/Win2003/MyStartupListener/resource.h [code]
WinBase/Cluster/Win2003/MyStartupListener/StdAfx.cpp [code]
WinBase/Cluster/Win2003/MyStartupListener/StdAfx.h [code]
WinBase/Cluster/Win2003/MyStorageResource/CClusterUtils.cpp [code]
WinBase/Cluster/Win2003/MyStorageResource/CClusterUtils.h [code]
WinBase/Cluster/Win2003/MyStorageResource/CEnumStorageResource.cpp [code]
WinBase/Cluster/Win2003/MyStorageResource/CEnumStorageResource.h [code]
WinBase/Cluster/Win2003/MyStorageResource/CMgdClusCfgInit.cpp [code]
WinBase/Cluster/Win2003/MyStorageResource/CMgdClusCfgInit.h [code]
WinBase/Cluster/Win2003/MyStorageResource/Common.h [code]
WinBase/Cluster/Win2003/MyStorageResource/CPartitionInfo.cpp [code]
WinBase/Cluster/Win2003/MyStorageResource/CPartitionInfo.h [code]
WinBase/Cluster/Win2003/MyStorageResource/CStorageResource.cpp [code]
WinBase/Cluster/Win2003/MyStorageResource/CStorageResource.h [code]
WinBase/Cluster/Win2003/MyStorageResource/CStorageResType.cpp [code]
WinBase/Cluster/Win2003/MyStorageResource/CStorageResType.h [code]
WinBase/Cluster/Win2003/MyStorageResource/guids.h [code]
WinBase/Cluster/Win2003/MyStorageResource/InsertionSort.h [code]
WinBase/Cluster/Win2003/MyStorageResource/MyStorageResource.cpp [code]
WinBase/Cluster/Win2003/MyStorageResource/MyStorageResource.idl [code]
WinBase/Cluster/Win2003/MyStorageResource/PropList.cpp [code]
WinBase/Cluster/Win2003/MyStorageResource/PropList.h [code]
WinBase/Cluster/Win2003/MyStorageResource/resource.h [code]
WinBase/Cluster/Win2003/MyStorageResource/SIndexedDisk.cpp [code]
WinBase/Cluster/Win2003/MyStorageResource/SIndexedDisk.h [code]
WinBase/Cluster/Win2003/MyStorageResource/StdAfx.cpp [code]
WinBase/Cluster/Win2003/MyStorageResource/StdAfx.h [code]
WinBase/Cluster/Win2003/MyStorageResource/StringUtils.cpp [code]
WinBase/Cluster/Win2003/MyStorageResource/StringUtils.h [code]
WinBase/Cluster/Win2003/MyStorageResource/WMIHelpers.cpp [code]
WinBase/Cluster/Win2003/MyStorageResource/WMIHelpers.h [code]
WinBase/Debug/BPSamp/BPSamp.h [code]
WinBase/Debug/BPSamp/BPSampTest.c [code]
WinBase/Debug/BPSamp/DbgCmd.c [code]
WinBase/Debug/BPSamp/Main.c [code]
WinBase/Debug/BPSamp/Utils.c [code]
WinBase/Debug/dbh/dbh.cpp [code]
WinBase/Debug/Deb/Deb.h [code]
WinBase/Debug/Deb/DebDebug.c [code]
WinBase/Debug/Deb/DebDebug.h [code]
WinBase/Debug/Deb/DebMain.c [code]
WinBase/Debug/Deb/DebMain.h [code]
WinBase/Debug/Deb/DebMisc.c [code]
WinBase/Debug/Deb/DebMisc.h [code]
WinBase/Debug/Deb/LinkList.c [code]
WinBase/Debug/Deb/LinkList.h [code]
WinBase/Debug/Deb/ToolBar.c [code]
WinBase/Debug/Deb/ToolBar.h [code]
WinBase/Debug/DebugHandler/DebugHandler.Cpp [code]
WinBase/Debug/eventlog/log.c [code]
WinBase/EventTrace/TraceDmp/tracedmp.cpp [code]
WinBase/EventTrace/TraceDmp/tracedmp.h [code]
WinBase/EventTrace/TraceDmp/tracewmi.cpp [code]
WinBase/EventTrace/tracedp/TraceDp.c [code]
WinBase/EventTrace/TraceLog/TraceLog.c [code]
WinBase/Indexing/AdvQuery/AdvQuery.Cxx [code]
WinBase/Indexing/AdvQuery/DispTree.Cxx [code]
WinBase/Indexing/ChgState/ChgState.Cxx [code]
WinBase/Indexing/HtmlProp/FiltReg.Hxx [code]
WinBase/Indexing/HtmlProp/HtmlProp.Cxx [code]
WinBase/Indexing/HtmlProp/HtmlProp.Hxx [code]
WinBase/Indexing/IFilter/Anchor.Cxx [code]
WinBase/Indexing/IFilter/Anchor.Hxx [code]
WinBase/Indexing/IFilter/Assert.Cxx [code]
WinBase/Indexing/IFilter/Bag.Cxx [code]
WinBase/Indexing/IFilter/Bag.Hxx [code]
WinBase/Indexing/IFilter/CharHash.Cxx [code]
WinBase/Indexing/IFilter/CharHash.Hxx [code]
WinBase/Indexing/IFilter/CodePage.Cxx [code]
WinBase/Indexing/IFilter/CodePage.Hxx [code]
WinBase/Indexing/IFilter/Debug.Hxx [code]
WinBase/Indexing/IFilter/Except.Cxx [code]
WinBase/Indexing/IFilter/Except.Hxx [code]
WinBase/Indexing/IFilter/FiltReg.Hxx [code]
WinBase/Indexing/IFilter/Global.Hxx [code]
WinBase/Indexing/IFilter/HtmlElem.Cxx [code]
WinBase/Indexing/IFilter/HtmlElem.Hxx [code]
WinBase/Indexing/IFilter/HtmlFilt.Cxx [code]
WinBase/Indexing/IFilter/HtmlFilt.Hxx [code]
WinBase/Indexing/IFilter/HtmlGuid.Cxx [code]
WinBase/Indexing/IFilter/HtmlGuid.Hxx [code]
WinBase/Indexing/IFilter/HtmlIFlt.Cxx [code]
WinBase/Indexing/IFilter/HtmlIFlt.Hxx [code]
WinBase/Indexing/IFilter/HtmlScan.Cxx [code]
WinBase/Indexing/IFilter/HtmlScan.Hxx [code]
WinBase/Indexing/IFilter/ImageTag.Cxx [code]
WinBase/Indexing/IFilter/ImageTag.Hxx [code]
WinBase/Indexing/IFilter/InpStrm.Cxx [code]
WinBase/Indexing/IFilter/InpStrm.Hxx [code]
WinBase/Indexing/IFilter/InputTag.Cxx [code]
WinBase/Indexing/IFilter/InputTag.Hxx [code]
WinBase/Indexing/IFilter/Main.Cxx [code]
WinBase/Indexing/IFilter/MetaTag.Cxx [code]
WinBase/Indexing/IFilter/MetaTag.Hxx [code]
WinBase/Indexing/IFilter/MMbuf.Cxx [code]
WinBase/Indexing/IFilter/MMScBuf.Cxx [code]
WinBase/Indexing/IFilter/MMScBuf.Hxx [code]
WinBase/Indexing/IFilter/MMStrm.Cxx [code]
WinBase/Indexing/IFilter/MMStrm.Hxx [code]
WinBase/Indexing/IFilter/osv.Hxx [code]
WinBase/Indexing/IFilter/Pch.Cxx [code]
WinBase/Indexing/IFilter/PMMStrm.Hxx [code]
WinBase/Indexing/IFilter/PropSpec.Cxx [code]
WinBase/Indexing/IFilter/PropSpec.Hxx [code]
WinBase/Indexing/IFilter/PropTag.Cxx [code]
WinBase/Indexing/IFilter/PropTag.Hxx [code]
WinBase/Indexing/IFilter/RegAcc32.Cxx [code]
WinBase/Indexing/IFilter/RegAcc32.Hxx [code]
WinBase/Indexing/IFilter/Register.Cxx [code]
WinBase/Indexing/IFilter/ScripTag.Cxx [code]
WinBase/Indexing/IFilter/ScripTag.Hxx [code]
WinBase/Indexing/IFilter/SerStrm.Cxx [code]
WinBase/Indexing/IFilter/SerStrm.Hxx [code]
WinBase/Indexing/IFilter/Start.Cxx [code]
WinBase/Indexing/IFilter/Start.Hxx [code]
WinBase/Indexing/IFilter/TextElem.Cxx [code]
WinBase/Indexing/IFilter/TextElem.Hxx [code]
WinBase/Indexing/IFilter/TitleTag.Cxx [code]
WinBase/Indexing/IFilter/TitleTag.Hxx [code]
WinBase/Indexing/IISSearch/AdoVbs.Inc [code]
WinBase/Indexing/IISSearch/Is2Foot.Inc [code]
WinBase/Indexing/lrsample/filtreg.hxx [code]
WinBase/Indexing/lrsample/langreg.hxx [code]
WinBase/Indexing/lrsample/lrsample.CXX [code]
WinBase/Indexing/lrsample/lrsample.HXX [code]
WinBase/Indexing/lrsample/minici.hxx [code]
WinBase/Indexing/Simple/DispTree.Cxx [code]
WinBase/Indexing/Simple/QSample.Cxx [code]
WinBase/Indexing/Simple/QSample.Hxx [code]
WinBase/Indexing/SmpFilt/FiltReg.Hxx [code]
WinBase/Indexing/SmpFilt/SmpFilt.Cxx [code]
WinBase/Indexing/SmpFilt/SmpFilt.Hxx [code]
WinBase/Indexing/VJQuery/Query.java [code]
WinBase/Indexing/VJQuery/VJQuery.java [code]
WinBase/IO/AsyncIO/AsyncIO.c [code]
WinBase/IO/AsyncIO/AsyncIO.h [code]
WinBase/IO/DiskQuota/Commands.Cpp [code]
WinBase/IO/DiskQuota/Commands.h [code]
WinBase/IO/DiskQuota/DskQuota.Cpp [code]
WinBase/IO/DiskQuota/PrintMenu.Cpp [code]
WinBase/IO/DiskQuota/PrintMenu.h [code]
WinBase/IO/DiskQuota/ProcessMenu.Cpp [code]
WinBase/IO/DiskQuota/ProcessMenu.h [code]
WinBase/IO/DLEdit/DLEdit.Cpp [code]
WinBase/IO/EnumMount/EnumMountPoints.c [code]
WinBase/IO/EnumStreams/EnumStreams.c [code]
WinBase/IO/EnumStreams/FindStream.c [code]
WinBase/IO/EnumStreams/FindStream.h [code]
WinBase/IO/FCopy/FCopy.Cpp [code]
WinBase/IO/Floppy/Mfmt.c [code]
WinBase/IO/Mount/Mount.Cpp [code]
WinBase/IO/Mount/UnMount.Cpp [code]
WinBase/IO/RSM/app/app.cpp [code]
WinBase/IO/RSM/app/app_utls.cpp [code]
WinBase/IO/RSM/app/stl_write.cpp [code]
WinBase/IO/RSM/inc/stl.h [code]
WinBase/IO/RSM/mll/dllmain.cpp [code]
WinBase/IO/RSM/mll/stl_mll.cpp [code]
WinBase/IO/RSM/mll/stl_mll.h [code]
WinBase/IO/UnBufCpy/UnBufCp1.c [code]
WinBase/IO/UnBufCpy/UnBufCp2.c [code]
WinBase/IPC/NamePipe/Console/NmPipe.c [code]
WinBase/IPC/NamePipe/npClient/Client32.c [code]
WinBase/IPC/NamePipe/npClient/Client32.h [code]
WinBase/IPC/NamePipe/NPServer/Server32.c [code]
WinBase/IPC/NamePipe/NPServer/Server32.h [code]
WinBase/Registry/Monkey.c [code]
WinBase/Registry/Monkey.h [code]
WinBase/Service/Client.c [code]
WinBase/Service/Service.c [code]
WinBase/Service/Service.H [code]
WinBase/Service/Simple.c [code]
WinBase/WinNT/PerfTool/Pdh/ProcList/ProcList.c [code]
WinBase/WinNT/PerfTool/Pdh/StatList/AboutDlg.c [code]
WinBase/WinNT/PerfTool/Pdh/StatList/AboutDlg.h [code]
WinBase/WinNT/PerfTool/Pdh/StatList/MainWnd.c [code]
WinBase/WinNT/PerfTool/Pdh/StatList/MainWnd.h [code]
WinBase/WinNT/PerfTool/Pdh/StatList/Resource.h [code]
WinBase/WinNT/PerfTool/Pdh/StatList/StatList.c [code]
WinBase/WinNT/PerfTool/Pdh/StatList/StatList.h [code]
WinBase/WinNT/PerfTool/Pdh/StatList/WinUtils.c [code]
WinBase/WinNT/PerfTool/Pdh/StatList/WinUtils.h [code]
WinBase/WinNT/PerfTool/PerfDllS/AppMem/appDll/AppMema.c [code]
WinBase/WinNT/PerfTool/PerfDllS/AppMem/appDll/AppMema.h [code]
WinBase/WinNT/PerfTool/PerfDllS/AppMem/appDll/DllInit.c [code]
WinBase/WinNT/PerfTool/PerfDllS/AppMem/Inc/AppMemi.h [code]
WinBase/WinNT/PerfTool/PerfDllS/AppMem/PerfDll/DataMem.c [code]
WinBase/WinNT/PerfTool/PerfDllS/AppMem/PerfDll/DataMem.h [code]
WinBase/WinNT/PerfTool/PerfDllS/AppMem/PerfDll/Perfmem.c [code]
WinBase/WinNT/PerfTool/PerfDllS/AppMem/PerfDll/Perfmsg.h [code]
WinBase/WinNT/PerfTool/PerfDllS/AppMem/PerfDll/PerfUtil.c [code]
WinBase/WinNT/PerfTool/PerfDllS/AppMem/PerfDll/PerfUtil.h [code]
WinBase/WinNT/PerfTool/PerfDllS/AppMem/PerfDll/ShareMem.c [code]
WinBase/WinNT/PerfTool/PerfDllS/AppMem/pub/AppMem.h [code]
WinBase/WinNT/PerfTool/PerfDllS/AppMem/pub/MemCtrnm.h [code]
WinBase/WinNT/PerfTool/PerfDllS/LeakyBin/LeakyBin.c [code]
WinBase/WinNT/PerfTool/PerfDllS/LeakyBin/LeakyBin.h [code]
WinBase/WinNT/PerfTool/PerfDllS/LeakyBin/Resource.h [code]
WinBase/WinNT/PerfTool/PerfDllS/PerfGen/DataGen.c [code]
WinBase/WinNT/PerfTool/PerfDllS/PerfGen/DataGen.h [code]
WinBase/WinNT/PerfTool/PerfDllS/PerfGen/GenCtrnm.h [code]
WinBase/WinNT/PerfTool/PerfDllS/PerfGen/Perfgen.c [code]
WinBase/WinNT/PerfTool/PerfDllS/PerfGen/Perfmsg.h [code]
WinBase/WinNT/PerfTool/PerfDllS/PerfGen/PerfUtil.c [code]
WinBase/WinNT/PerfTool/PerfDllS/PerfGen/PerfUtil.h [code]
WinBase/WtsApi/TSSysInf/Client/SysInf_C.c [code]
WinBase/WtsApi/TSSysInf/Inc/SysInfo.h [code]
WinBase/WtsApi/TSSysInf/Server/SysInf_S.c [code]
WinBase/WtsApi/Tst4Wts/Tst4Wts.c [code]
WinBase/WtsApi/WtsApi/API.Cpp [code]
WinBase/WtsApi/WtsApi/API.h [code]
WinBase/WtsApi/WtsApi/APIDoc.Cpp [code]
WinBase/WtsApi/WtsApi/APIDoc.h [code]
WinBase/WtsApi/WtsApi/APIView.Cpp [code]
WinBase/WtsApi/WtsApi/APIView.h [code]
WinBase/WtsApi/WtsApi/MainFrm.Cpp [code]
WinBase/WtsApi/WtsApi/MainFrm.h [code]
WinBase/WtsApi/WtsApi/MessageDlg.Cpp [code]
WinBase/WtsApi/WtsApi/MessageDlg.h [code]
WinBase/WtsApi/WtsApi/ProcessDlg.Cpp [code]
WinBase/WtsApi/WtsApi/ProcessDlg.h [code]
WinBase/WtsApi/WtsApi/QueryDlg.Cpp [code]
WinBase/WtsApi/WtsApi/QueryDlg.h [code]
WinBase/WtsApi/WtsApi/Resource.h [code]
WinBase/WtsApi/WtsApi/ServerDlg.Cpp [code]
WinBase/WtsApi/WtsApi/ServerDlg.h [code]
WinBase/WtsApi/WtsApi/SessionDlg.Cpp [code]
WinBase/WtsApi/WtsApi/SessionDlg.h [code]
WinBase/WtsApi/WtsApi/ShutdownDlg.Cpp [code]
WinBase/WtsApi/WtsApi/ShutdownDlg.h [code]
WinBase/WtsApi/WtsApi/StdAfx.Cpp [code]
WinBase/WtsApi/WtsApi/StdAfx.h [code]
WinBase/WtsApi/WtsApi/WaitDlg.Cpp [code]
WinBase/WtsApi/WtsApi/WaitDlg.h [code]
WinBase/WtsApi/WtsApi/WaitSystemDlg.Cpp [code]
WinBase/WtsApi/WtsApi/WaitSystemDlg.h [code]
WinUI/Clipboard/ClipText.c [code]
WinUI/Clipboard/ClipText.h [code]
WinUI/CommDlg/CDTest/CDTest.c [code]
WinUI/CommDlg/CDTest/CDTest.h [code]
WinUI/CommDlg/CDTest/Colors.c [code]
WinUI/CommDlg/CDTest/Colors.h [code]
WinUI/CommDlg/CDTest/DevMode.h [code]
WinUI/CommDlg/CDTest/DevNames.h [code]
WinUI/CommDlg/CDTest/Find.c [code]
WinUI/CommDlg/CDTest/Find.h [code]
WinUI/CommDlg/CDTest/Font.c [code]
WinUI/CommDlg/CDTest/Font.h [code]
WinUI/CommDlg/CDTest/LogFont.h [code]
WinUI/CommDlg/CDTest/Open.c [code]
WinUI/CommDlg/CDTest/Open.h [code]
WinUI/CommDlg/CDTest/Print.c [code]
WinUI/CommDlg/CDTest/Print.h [code]
WinUI/CommDlg/CDTest/Replace.c [code]
WinUI/CommDlg/CDTest/Replace.h [code]
WinUI/CommDlg/CDTest/Save.c [code]
WinUI/CommDlg/CDTest/Save.h [code]
WinUI/CommDlg/CDTest/Title.c [code]
WinUI/CommDlg/CDTest/Title.h [code]
WinUI/CommDlg/ComDlg32/ComDlg32.C [code]
WinUI/CommDlg/ComDlg32/ComDlg32.h [code]
WinUI/CommDlg/ComDlg32/Resource.h [code]
WinUI/Controls/Common/Property/Property.c [code]
WinUI/Controls/Common/Property/Property.h [code]
WinUI/Controls/Common/Property/Resource.h [code]
WinUI/Controls/Common/Rebar/Rebar.c [code]
WinUI/Controls/Common/Rebar/Resource.h [code]
WinUI/Controls/Common/VListVw/Resource.h [code]
WinUI/Controls/Common/VListVw/VListVw.c [code]
WinUI/Controls/Common/VListVw/VListVw.h [code]
WinUI/Controls/Custom/SpinCube/Paint.c [code]
WinUI/Controls/Custom/SpinCube/Paint.h [code]
WinUI/Controls/Custom/SpinCube/SpinCube.c [code]
WinUI/Controls/Custom/SpinCube/SpinCube.h [code]
WinUI/Controls/Custom/SpinCube/SpinTest.c [code]
WinUI/Controls/Custom/SpinCube/SpinTest.h [code]
WinUI/Cursor/Cursor.c [code]
WinUI/Cursor/Cursor.h [code]
WinUI/fulldrag/fulldrag.c [code]
WinUI/fulldrag/fulldrag.h [code]
WinUI/GlobalDev/CSSamp/CSSamp.Cpp [code]
WinUI/GlobalDev/CSSamp/Debug.Cpp [code]
WinUI/GlobalDev/CSSamp/DspFormt.Cpp [code]
WinUI/GlobalDev/CSSamp/DspLogcl.Cpp [code]
WinUI/GlobalDev/CSSamp/DspPlain.Cpp [code]
WinUI/GlobalDev/CSSamp/Edit.Cpp [code]
WinUI/GlobalDev/CSSamp/Global.h [code]
WinUI/GlobalDev/CSSamp/PreComp.Hxx [code]
WinUI/GlobalDev/CSSamp/Resource.h [code]
WinUI/GlobalDev/CSSamp/Settings.Cpp [code]
WinUI/GlobalDev/CSSamp/Style.Cpp [code]
WinUI/GlobalDev/CSSamp/Text.Cpp [code]
WinUI/GlobalDev/CSSamp/TextWnd.Cpp [code]
WinUI/GlobalDev/globaldev/gentab.c [code]
WinUI/GlobalDev/globaldev/global.c [code]
WinUI/GlobalDev/globaldev/global.h [code]
WinUI/GlobalDev/globaldev/nlsapi.c [code]
WinUI/GlobalDev/globaldev/res.h [code]
WinUI/GlobalDev/globaldev/resource.h [code]
WinUI/GlobalDev/globaldev/textapi.c [code]
WinUI/GlobalDev/globaldev/gres409/gres409.c [code]
WinUI/GlobalDev/globaldev/gres409/resource.h [code]
WinUI/Input/Ime/FullIME/CANDUI.C [code]
WinUI/Input/Ime/FullIME/FullIME.h [code]
WinUI/Input/Ime/FullIME/Global.C [code]
WinUI/Input/Ime/FullIME/ImeUI.C [code]
WinUI/Input/Ime/FullIME/Main.C [code]
WinUI/Input/Ime/HalfIME/HalfIME.h [code]
WinUI/Input/Ime/HalfIME/Main.C [code]
WinUI/Input/Ime/IMEApps/Comp.c [code]
WinUI/Input/Ime/IMEApps/Data.c [code]
WinUI/Input/Ime/IMEApps/IMEApps.c [code]
WinUI/Input/Ime/IMEApps/IMEApps.h [code]
WinUI/Input/Ime/IMEApps/ImeMenu.c [code]
WinUI/Input/Ime/IMEApps/Mode.c [code]
WinUI/Input/Ime/IMEApps/Paint.c [code]
WinUI/Input/Ime/IMEApps/Pch.h [code]
WinUI/Input/Ime/IMEApps/Resource.h [code]
WinUI/Input/Ime/IMEApps/Setcomp.c [code]
WinUI/Input/Ime/IMEApps/Status.c [code]
WinUI/Input/Ime/IMEApps/Subs.c [code]
WinUI/Input/Ime/IMEApps/ToolBar.c [code]
WinUI/Input/Ime/IMEApps/ToolBar.h [code]
WinUI/Input/Ime/IMEApps/Wapi.h [code]
WinUI/Input/Ime/IMEApps/Wsubs.c [code]
WinUI/Input/Ime/MultiUI/Data.C [code]
WinUI/Input/Ime/MultiUI/Dlgs.C [code]
WinUI/Input/Ime/MultiUI/MultiUI.C [code]
WinUI/Input/Ime/MultiUI/MultiUI.h [code]
WinUI/Input/Ime/MultiUI/MultiWnd.C [code]
WinUI/Input/Ime/MultiUI/Resource.h [code]
WinUI/Input/MouseInfo/MousInfo.c [code]
WinUI/Input/MouseInfo/MousInfo.h [code]
WinUI/Menu/Menu.c [code]
WinUI/Menu/Menu.h [code]
WinUI/obscure/Obscure.c [code]
WinUI/Resource/DynDlg/DynDlg.c [code]
WinUI/Resource/DynDlg/DynDlg.h [code]
WinUI/Resource/Iconpro/Dib.c [code]
WinUI/Resource/Iconpro/Dib.h [code]
WinUI/Resource/Iconpro/IconPRO.C [code]
WinUI/Resource/Iconpro/IconPRO.h [code]
WinUI/Resource/Iconpro/Icons.C [code]
WinUI/Resource/Iconpro/Icons.h [code]
WinUI/Resource/Iconpro/MDIChild.C [code]
WinUI/Resource/Iconpro/MDIChild.h [code]
WinUI/Resource/Iconpro/Resource.h [code]
WinUI/Resource/msgtable/MsgTest.c [code]
WinUI/sendto/sendto.c [code]
WinUI/sendto/sendto.h [code]
WinUI/Shell/AppBar/AppBar.c [code]
WinUI/Shell/AppBar/AppBar.h [code]
WinUI/Shell/AppBar/Globals.h [code]
WinUI/Shell/AppBar/Main.c [code]
WinUI/Shell/AppBar/PropSht.c [code]
WinUI/Shell/AppBar/Resource.h [code]
WinUI/Shell/AppBar/Util.c [code]
WinUI/Shell/AppBar/WndProc.c [code]
WinUI/Shell/BandObjs/BandObjs.Cpp [code]
WinUI/Shell/BandObjs/ClsFact.Cpp [code]
WinUI/Shell/BandObjs/ClsFact.h [code]
WinUI/Shell/BandObjs/CommBand.Cpp [code]
WinUI/Shell/BandObjs/CommBand.h [code]
WinUI/Shell/BandObjs/DeskBand.Cpp [code]
WinUI/Shell/BandObjs/DeskBand.h [code]
WinUI/Shell/BandObjs/ExplrBar.Cpp [code]
WinUI/Shell/BandObjs/ExplrBar.h [code]
WinUI/Shell/BandObjs/Globals.h [code]
WinUI/Shell/BandObjs/Guid.h [code]
WinUI/Shell/BandObjs/ToolBand.Cpp [code]
WinUI/Shell/BandObjs/ToolBand.h [code]
WinUI/Shell/ColumnProvider/ClassFactory.Cpp [code]
WinUI/Shell/ColumnProvider/ClassFactory.h [code]
WinUI/Shell/ColumnProvider/clsid.Cpp [code]
WinUI/Shell/ColumnProvider/columnprovider.Cpp [code]
WinUI/Shell/ColumnProvider/columnprovider.h [code]
WinUI/Shell/ColumnProvider/RegisterServer.Cpp [code]
WinUI/Shell/ColumnProvider/Resource.h [code]
WinUI/Shell/ColumnProvider/ShortName.Cpp [code]
WinUI/Shell/ColumnProvider/ShortName.h [code]
WinUI/Shell/ColumnProvider/UnRegisterServer.Cpp [code]
WinUI/Shell/customdrawbuttondlg/CustomDrawButtonDlg.cpp [code]
WinUI/Shell/customdrawbuttondlg/CustomDrawButtonDlg.h [code]
WinUI/Shell/customdrawbuttondlg/Resource.h [code]
WinUI/Shell/DiskCleanupHandler/ClassFactory.Cpp [code]
WinUI/Shell/DiskCleanupHandler/ClassFactory.h [code]
WinUI/Shell/DiskCleanupHandler/Cleanup.Cpp [code]
WinUI/Shell/DiskCleanupHandler/Cleanup.h [code]
WinUI/Shell/DiskCleanupHandler/dacl.cpp [code]
WinUI/Shell/DiskCleanupHandler/EmptyVolumeCache.Cpp [code]
WinUI/Shell/DiskCleanupHandler/EmptyVolumeCache.h [code]
WinUI/Shell/DiskCleanupHandler/RegisterServer.Cpp [code]
WinUI/Shell/DiskCleanupHandler/Resource.h [code]
WinUI/Shell/DiskCleanupHandler/UnRegisterServer.Cpp [code]
WinUI/Shell/DragImg/DataObj.Cpp [code]
WinUI/Shell/DragImg/DataObj.h [code]
WinUI/Shell/DragImg/DragImg.Cpp [code]
WinUI/Shell/DragImg/DragImg.h [code]
WinUI/Shell/DragImg/Dragsrc.Cpp [code]
WinUI/Shell/DragImg/Dragsrc.h [code]
WinUI/Shell/DragImg/DropTgt.Cpp [code]
WinUI/Shell/DragImg/DropTgt.h [code]
WinUI/Shell/DragImg/Enumfe.Cpp [code]
WinUI/Shell/DragImg/Enumfe.h [code]
WinUI/Shell/DragImg/Render.Cpp [code]
WinUI/Shell/DragImg/Render.h [code]
WinUI/Shell/DragImg/Resource.h [code]
WinUI/Shell/DropExt/DefClsF.C [code]
WinUI/Shell/DropExt/DropExt.C [code]
WinUI/Shell/DropExt/DropExt.h [code]
WinUI/Shell/DropExt/Priv.h [code]
WinUI/Shell/EnumDesk/enumdesk.cpp [code]
WinUI/Shell/EnumDesk/enumdesk.h [code]
WinUI/Shell/EnumDesk/list.cpp [code]
WinUI/Shell/EnumDesk/list.h [code]
WinUI/Shell/EnumDesk/resource.h [code]
WinUI/Shell/EnumDesk/tree.cpp [code]
WinUI/Shell/EnumDesk/tree.h [code]
WinUI/Shell/Fakemenu/fakemenu.c [code]
WinUI/Shell/Fakemenu/fakemenu.h [code]
WinUI/Shell/FileView/CStatHlp.Cpp [code]
WinUI/Shell/FileView/CStatHlp.h [code]
WinUI/Shell/FileView/CStrTabl.Cpp [code]
WinUI/Shell/FileView/CStrTabl.h [code]
WinUI/Shell/FileView/DbgOut.h [code]
WinUI/Shell/FileView/FileView.Cpp [code]
WinUI/Shell/FileView/FileView.h [code]
WinUI/Shell/FileView/FVInit.Cpp [code]
WinUI/Shell/FileView/FVProc.Cpp [code]
WinUI/Shell/FileView/FVText.Cpp [code]
WinUI/Shell/FileView/FVText.h [code]
WinUI/Shell/FileView/IFileVW.Cpp [code]
WinUI/Shell/FileView/IPerFile.Cpp [code]
WinUI/Shell/FileView/Resource.h [code]
WinUI/Shell/SampView/ClsFact.Cpp [code]
WinUI/Shell/SampView/ClsFact.h [code]
WinUI/Shell/SampView/Commands.h [code]
WinUI/Shell/SampView/ContMenu.Cpp [code]
WinUI/Shell/SampView/ContMenu.h [code]
WinUI/Shell/SampView/DataObj.Cpp [code]
WinUI/Shell/SampView/DataObj.h [code]
WinUI/Shell/SampView/DropSrc.Cpp [code]
WinUI/Shell/SampView/DropSrc.h [code]
WinUI/Shell/SampView/DropTgt.Cpp [code]
WinUI/Shell/SampView/DropTgt.h [code]
WinUI/Shell/SampView/Enumidl.Cpp [code]
WinUI/Shell/SampView/Enumidl.h [code]
WinUI/Shell/SampView/ExtrIcon.Cpp [code]
WinUI/Shell/SampView/ExtrIcon.h [code]
WinUI/Shell/SampView/Guid.h [code]
WinUI/Shell/SampView/PidlMgr.Cpp [code]
WinUI/Shell/SampView/PidlMgr.h [code]
WinUI/Shell/SampView/Resource.h [code]
WinUI/Shell/SampView/SampView.Cpp [code]
WinUI/Shell/SampView/ShlFldr.Cpp [code]
WinUI/Shell/SampView/ShlFldr.h [code]
WinUI/Shell/SampView/ShlView.Cpp [code]
WinUI/Shell/SampView/ShlView.h [code]
WinUI/Shell/SampView/Tools.h [code]
WinUI/Shell/SampView/Utility.Cpp [code]
WinUI/Shell/SampView/Utility.h [code]
WinUI/Shell/SampView/Viewlist.Cpp [code]
WinUI/Shell/SampView/Viewlist.h [code]
WinUI/Shell/ShellExt/CopyHook.Cpp [code]
WinUI/Shell/ShellExt/CtxMenu.Cpp [code]
WinUI/Shell/ShellExt/IconHdlr.Cpp [code]
WinUI/Shell/ShellExt/Priv.h [code]
WinUI/Shell/ShellExt/PropShet.Cpp [code]
WinUI/Shell/ShellExt/Resource.h [code]
WinUI/Shell/ShellExt/ShellExt.Cpp [code]
WinUI/Shell/ShellExt/ShellExt.h [code]
WinUI/Shell/ShellExt/ShExInit.Cpp [code]
WinUI/Shell/ShellIconOverlay/IcnOvrly.Cpp [code]
WinUI/Shell/ShellIconOverlay/IcnOvrly.h [code]
WinUI/Shell/ShellIconOverlay/Resource.h [code]
WinUI/Shell/TrayNot/App32.C [code]
WinUI/Shell/TrayNot/App32.h [code]
WinUI/Shell/TrayNot/Resource.h [code]
WinUI/tallmenu/tallmenu.c [code]
WinUI/tallmenu/tallmenu.h [code]
WinUI/tsfapp/context.cpp [code]
WinUI/tsfapp/dataobj.cpp [code]
WinUI/tsfapp/dataobj.h [code]
WinUI/tsfapp/funcprov.cpp [code]
WinUI/tsfapp/globals.h [code]
WinUI/tsfapp/persist.cpp [code]
WinUI/tsfapp/propldr.cpp [code]
WinUI/tsfapp/propldr.h [code]
WinUI/tsfapp/resource.h [code]
WinUI/tsfapp/test.cpp [code]
WinUI/tsfapp/textstor.cpp [code]
WinUI/tsfapp/tsfapp.cpp [code]
WinUI/tsfapp/tsfedit.cpp [code]
WinUI/tsfapp/tsfedit.h [code]
WinUI/tsfapp/tsfwnd.cpp [code]
WinUI/tsfapp/tsfwnd.h [code]
WinUI/TSFcase/case.cpp [code]
WinUI/TSFcase/case.h [code]
WinUI/TSFcase/dllmain.cpp [code]
WinUI/TSFcase/editsess.h [code]
WinUI/TSFcase/editsink.cpp [code]
WinUI/TSFcase/flipdoc.cpp [code]
WinUI/TSFcase/flipsel.cpp [code]
WinUI/TSFcase/globals.cpp [code]
WinUI/TSFcase/globals.h [code]
WinUI/TSFcase/hello.cpp [code]
WinUI/TSFcase/keys.cpp [code]
WinUI/TSFcase/langbar.cpp [code]
WinUI/TSFcase/precomp.cpp [code]
WinUI/TSFcase/register.cpp [code]
WinUI/TSFcase/resource.h [code]
WinUI/TSFcase/server.cpp [code]
WinUI/TSFcase/snoop.cpp [code]
WinUI/TSFcase/snoop.h [code]
WinUI/TSFcase/tmgrsink.cpp [code]
WinUI/tsfcompart/compart.cpp [code]
WinUI/tsfcompart/monitor.cpp [code]
WinUI/tsfcompart/monitor.h [code]
WinUI/tsfcompart/resource.h [code]
WinUI/TSFmark/cleanup.cpp [code]
WinUI/TSFmark/compart.cpp [code]
WinUI/TSFmark/compose.cpp [code]
WinUI/TSFmark/dap.cpp [code]
WinUI/TSFmark/dllmain.cpp [code]
WinUI/TSFmark/editsess.h [code]
WinUI/TSFmark/editsink.cpp [code]
WinUI/TSFmark/globals.cpp [code]
WinUI/TSFmark/globals.h [code]
WinUI/TSFmark/keys.cpp [code]
WinUI/TSFmark/langbar.cpp [code]
WinUI/TSFmark/mark.cpp [code]
WinUI/TSFmark/mark.h [code]
WinUI/TSFmark/precomp.cpp [code]
WinUI/TSFmark/property.cpp [code]
WinUI/TSFmark/pstore.cpp [code]
WinUI/TSFmark/pstore.h [code]
WinUI/TSFmark/register.cpp [code]
WinUI/TSFmark/resource.h [code]
WinUI/TSFmark/server.cpp [code]
WinUI/TSFmark/tmgrsink.cpp [code]
Generated on Wed Nov 13 2024 16:58:28 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/dll/Demo.c File Reference

  • File Members
  • Begin
  • dll
Functions | Variables

Demo.c File Reference

#include "windows.h"
#include "demo.h"
#include "select.h"

Go to the source code of this file.

Functions

BOOL APIENTRY | About (HWND hDlg, UINT message, UINT wParam, LONG lParam)
BOOL | DemoInit (HANDLE hInstance)
LRESULT APIENTRY | DemoWndProc (HWND hWnd, UINT message, UINT wParam, LONG lParam)
int APIENTRY | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

Variables

BOOL | bTrack = FALSE
HANDLE hInst
INT | OrgX = 0
INT | OrgY = 0
INT | PrevX = 0
INT | PrevY = 0
RECT | Rect
BOOL | RetainShape = FALSE
INT | Shape = SL_BLOCK
INT | X = 0
INT | Y = 0

Function Documentation

BOOL APIENTRY About | ( | HWND | hDlg,
 |  | UINT | message,
 |  | UINT | wParam,
 |  | LONG | lParam
 | ) |  |

Definition at line 278 of file Demo.c.

{
    switch (message) {
        case WM_INITDIALOG:
            return (TRUE);

        case WM_COMMAND:
            // LOWORD added for portability
            if (LOWORD(wParam) == IDOK
             || LOWORD(wParam) == IDCANCEL) {
                EndDialog(hDlg, TRUE);
                return (TRUE);
            }
            return (TRUE);
    }
    return (FALSE);
        UNREFERENCED_PARAMETER(lParam);
}

BOOL DemoInit ( HANDLE hInstance )

Definition at line 100 of file Demo.c.

{
    HANDLE hMemory;
    PWNDCLASS pWndClass;
    BOOL bSuccess;
    CHAR lpBuffer[128];

    hMemory = LocalAlloc(LPTR, sizeof(WNDCLASS));
    if(!hMemory){
        LoadString(hInst, IDS_NOMEM, lpBuffer, sizeof(lpBuffer));
        MessageBox(NULL, lpBuffer, NULL, MB_OK | MB_ICONHAND);
        return(FALSE);
    }

    pWndClass = (PWNDCLASS) LocalLock(hMemory);
    pWndClass->hCursor = LoadCursor(NULL, IDC_ARROW);
    pWndClass->hIcon = LoadIcon(NULL, IDI_APPLICATION);
    pWndClass->lpszMenuName = (LPSTR) "Menu";
    pWndClass->lpszClassName = (LPSTR) "Demo";
    pWndClass->hbrBackground = GetStockObject(WHITE_BRUSH);
    pWndClass->hInstance = hInstance;
    pWndClass->style = 0;
    pWndClass->lpfnWndProc = (WNDPROC)DemoWndProc;

    bSuccess = RegisterClass(pWndClass);

    LocalUnlock(hMemory);
    LocalFree(hMemory);
    return (bSuccess);
}

LRESULT APIENTRY DemoWndProc | ( | HWND | hWnd,
 |  | UINT | message,
 |  | UINT | wParam,
 |  | LONG | lParam
 | ) |  |

Definition at line 165 of file Demo.c.

{
    FARPROC lpProcAbout;
    HMENU hMenu;

    switch (message) {

        case WM_COMMAND:

            // LOWORD added for portability

            switch (LOWORD(wParam)) {
                case IDM_BOX:
                    Shape = SL_BOX;
                    hMenu = GetMenu(hWnd);
                    CheckMenuItem(hMenu, IDM_BOX, MF_CHECKED);
                    CheckMenuItem(hMenu, IDM_BLOCK, MF_UNCHECKED);
                    break;

                case IDM_BLOCK:
                    Shape = SL_BLOCK;
                    hMenu = GetMenu(hWnd);
                    CheckMenuItem(hMenu, IDM_BOX, MF_UNCHECKED);
                    CheckMenuItem(hMenu, IDM_BLOCK, MF_CHECKED);
                    break;

                case IDM_RETAIN:
                    if (RetainShape) {
                        hMenu = GetMenu(hWnd);
                        CheckMenuItem(hMenu, IDM_RETAIN, MF_UNCHECKED);
                        RetainShape = FALSE;
                    }
                    else {
                        hMenu = GetMenu(hWnd);
                        CheckMenuItem(hMenu, IDM_RETAIN, MF_CHECKED);
                        RetainShape = TRUE;
                    }
                    break;

                case IDM_ABOUT:
                    lpProcAbout = MakeProcInstance((FARPROC)About, hInst);
                    DialogBox(hInst, "AboutBox", hWnd, (DLGPROC)lpProcAbout);
                    FreeProcInstance(lpProcAbout);
                    break;

            }
            break;

        case WM_LBUTTONDOWN:

            bTrack = TRUE;               /* user has pressed the left button */

            /* If you don't want the shape cleared, you must clear the Rect
             * coordinates before calling StartSelection
             */

            if (RetainShape)
                SetRectEmpty(&Rect);

            StartSelection(hWnd, MAKEMPOINT(lParam), &Rect,
                (wParam & MK_SHIFT) ? SL_EXTEND | Shape : Shape);
            break;

        case WM_MOUSEMOVE:
            if (bTrack)
                UpdateSelection(hWnd, MAKEMPOINT(lParam), &Rect, Shape);
            break;

        case WM_LBUTTONUP:
       if (bTrack)
               EndSelection(MAKEMPOINT(lParam), &Rect);
         bTrack = FALSE;
            break;

   case WM_SIZE:
      switch (wParam) {
         case SIZEICONIC:

            /* If we aren't in retain mode we want to clear the
             * current rectangle now!
             */
            if (!RetainShape)
               SetRectEmpty(&Rect);
      }
      break;

        case WM_DESTROY:
            PostQuitMessage(0);
            break;

        default:
            return (DefWindowProc(hWnd, message, wParam, lParam));
    }
    return (0);
}

int WINAPI WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 48 of file Demo.c.

{

    HWND hWnd;
    MSG msg;
    CHAR szAppName[64];

    UNREFERENCED_PARAMETER(lpCmdLine);

    if (!hPrevInstance)
        if (!DemoInit(hInstance))
            return (0);

    hInst = hInstance;
    LoadString(hInstance, IDS_APPNAME, szAppName, sizeof(szAppName));

    hWnd = CreateWindow("Demo",
        szAppName,
        WS_OVERLAPPEDWINDOW,
        CW_USEDEFAULT,
        CW_USEDEFAULT,
        CW_USEDEFAULT,
        CW_USEDEFAULT,
        NULL,
        NULL,
        hInstance,
        NULL);

    if (!hWnd)
        return (0);

    ShowWindow(hWnd, nCmdShow);
    UpdateWindow(hWnd);

    while (GetMessage(&msg, NULL, 0, 0)) {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }
    return (int)(msg.wParam);
}

Variable Documentation

BOOL bTrack = FALSE

Definition at line 38 of file Demo.c.

HANDLE hInst

Definition at line 37 of file Demo.c.

INT OrgX = 0

Definition at line 39 of file Demo.c.

INT OrgY = 0

Definition at line 39 of file Demo.c.

INT PrevX = 0

Definition at line 40 of file Demo.c.

INT PrevY = 0

Definition at line 40 of file Demo.c.

RECT Rect

Definition at line 43 of file Demo.c.

BOOL RetainShape = FALSE

Definition at line 46 of file Demo.c.

INT Shape = SL_BLOCK

Definition at line 45 of file Demo.c.

INT X = 0

Definition at line 41 of file Demo.c.

INT Y = 0

Definition at line 41 of file Demo.c.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/dll/Demo.h File Reference

  • Begin
  • dll
Defines | Functions

Demo.h File Reference

Go to the source code of this file.

Defines

#define | IDM_ABOUT 104
#define | IDM_BLOCK 102
#define | IDM_BOX 101
#define | IDM_RETAIN 103
#define | IDS_APPNAME 1001
#define | IDS_NOMEM 1002

Functions

BOOL APIENTRY | About (HWND, UINT, UINT, LONG)
BOOL DemoInit (HANDLE)
LRESULT APIENTRY | DemoWndProc (HWND, UINT, UINT, LONG)

Define Documentation

#define IDM_ABOUT 104

Definition at line 16 of file Demo.h.

#define IDM_BLOCK 102

Definition at line 14 of file Demo.h.

#define IDM_BOX 101

Definition at line 13 of file Demo.h.

#define IDM_RETAIN 103

Definition at line 15 of file Demo.h.

#define IDS_APPNAME 1001

Definition at line 18 of file Demo.h.

#define IDS_NOMEM 1002

Definition at line 19 of file Demo.h.

Function Documentation

BOOL APIENTRY About | ( | HWND | ,
 |  | UINT | ,
 |  | UINT | ,
 |  | LONG |
 | ) |  |

Definition at line 278 of file Demo.c.

{
    switch (message) {
        case WM_INITDIALOG:
            return (TRUE);

        case WM_COMMAND:
            // LOWORD added for portability
            if (LOWORD(wParam) == IDOK
             || LOWORD(wParam) == IDCANCEL) {
                EndDialog(hDlg, TRUE);
                return (TRUE);
            }
            return (TRUE);
    }
    return (FALSE);
        UNREFERENCED_PARAMETER(lParam);
}

BOOL DemoInit ( HANDLE )

Definition at line 100 of file Demo.c.

{
    HANDLE hMemory;
    PWNDCLASS pWndClass;
    BOOL bSuccess;
    CHAR lpBuffer[128];

    hMemory = LocalAlloc(LPTR, sizeof(WNDCLASS));
    if(!hMemory){
        LoadString(hInst, IDS_NOMEM, lpBuffer, sizeof(lpBuffer));
        MessageBox(NULL, lpBuffer, NULL, MB_OK | MB_ICONHAND);
        return(FALSE);
    }

    pWndClass = (PWNDCLASS) LocalLock(hMemory);
    pWndClass->hCursor = LoadCursor(NULL, IDC_ARROW);
    pWndClass->hIcon = LoadIcon(NULL, IDI_APPLICATION);
    pWndClass->lpszMenuName = (LPSTR) "Menu";
    pWndClass->lpszClassName = (LPSTR) "Demo";
    pWndClass->hbrBackground = GetStockObject(WHITE_BRUSH);
    pWndClass->hInstance = hInstance;
    pWndClass->style = 0;
    pWndClass->lpfnWndProc = (WNDPROC)DemoWndProc;

    bSuccess = RegisterClass(pWndClass);

    LocalUnlock(hMemory);
    LocalFree(hMemory);
    return (bSuccess);
}

LRESULT APIENTRY DemoWndProc | ( | HWND | ,
 |  | UINT | ,
 |  | UINT | ,
 |  | LONG |
 | ) |  |

Definition at line 165 of file Demo.c.

{
    FARPROC lpProcAbout;
    HMENU hMenu;

    switch (message) {

        case WM_COMMAND:

            // LOWORD added for portability

            switch (LOWORD(wParam)) {
                case IDM_BOX:
                    Shape = SL_BOX;
                    hMenu = GetMenu(hWnd);
                    CheckMenuItem(hMenu, IDM_BOX, MF_CHECKED);
                    CheckMenuItem(hMenu, IDM_BLOCK, MF_UNCHECKED);
                    break;

                case IDM_BLOCK:
                    Shape = SL_BLOCK;
                    hMenu = GetMenu(hWnd);
                    CheckMenuItem(hMenu, IDM_BOX, MF_UNCHECKED);
                    CheckMenuItem(hMenu, IDM_BLOCK, MF_CHECKED);
                    break;

                case IDM_RETAIN:
                    if (RetainShape) {
                        hMenu = GetMenu(hWnd);
                        CheckMenuItem(hMenu, IDM_RETAIN, MF_UNCHECKED);
                        RetainShape = FALSE;
                    }
                    else {
                        hMenu = GetMenu(hWnd);
                        CheckMenuItem(hMenu, IDM_RETAIN, MF_CHECKED);
                        RetainShape = TRUE;
                    }
                    break;

                case IDM_ABOUT:
                    lpProcAbout = MakeProcInstance((FARPROC)About, hInst);
                    DialogBox(hInst, "AboutBox", hWnd, (DLGPROC)lpProcAbout);
                    FreeProcInstance(lpProcAbout);
                    break;

            }
            break;

        case WM_LBUTTONDOWN:

            bTrack = TRUE;               /* user has pressed the left button */

            /* If you don't want the shape cleared, you must clear the Rect
             * coordinates before calling StartSelection
             */

            if (RetainShape)
                SetRectEmpty(&Rect);

            StartSelection(hWnd, MAKEMPOINT(lParam), &Rect,
                (wParam & MK_SHIFT) ? SL_EXTEND | Shape : Shape);
            break;

        case WM_MOUSEMOVE:
            if (bTrack)
                UpdateSelection(hWnd, MAKEMPOINT(lParam), &Rect, Shape);
            break;

        case WM_LBUTTONUP:
       if (bTrack)
               EndSelection(MAKEMPOINT(lParam), &Rect);
         bTrack = FALSE;
            break;

   case WM_SIZE:
      switch (wParam) {
         case SIZEICONIC:

            /* If we aren't in retain mode we want to clear the
             * current rectangle now!
             */
            if (!RetainShape)
               SetRectEmpty(&Rect);
      }
      break;

        case WM_DESTROY:
            PostQuitMessage(0);
            break;

        default:
            return (DefWindowProc(hWnd, message, wParam, lParam));
    }
    return (0);
}

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/dll/Select.c File Reference

  • Begin
  • dll
Functions

Select.c File Reference

#include "windows.h"
#include "select.h"

Go to the source code of this file.

Functions

INT APIENTRY | ClearSelection (HWND hWnd, LPRECT lpSelectRect, INT fFlags)
BOOL APIENTRY | DllMain (HANDLE hInst, DWORD ul_reason_being_called, LPVOID lpReserved)
INT APIENTRY | EndSelection (MPOINT ptCurrent, LPRECT lpSelectRect)
INT APIENTRY | StartSelection (HWND hWnd, MPOINT ptCurrent, LPRECT lpSelectRect, INT fFlags)
INT APIENTRY | UpdateSelection (HWND hWnd, MPOINT ptCurrent, LPRECT lpSelectRect, INT fFlags)

Function Documentation

INT APIENTRY ClearSelection | ( | HWND | hWnd,
 |  | LPRECT | lpSelectRect,
 |  | INT | fFlags
 | ) |  |

Definition at line 171 of file Select.c.

{
    HDC hDC;
    INT2DWORD OldROP;

    hDC = GetDC(hWnd);
    switch (fFlags & SL_TYPE) {

        case SL_BOX:
            OldROP = SetROP2(hDC, R2_NOTXORPEN);
            MoveToEx(hDC, lpSelectRect->left, lpSelectRect->top, NULL);
            LineTo(hDC, lpSelectRect->right, lpSelectRect->top);
            LineTo(hDC, lpSelectRect->right, lpSelectRect->bottom);
            LineTo(hDC, lpSelectRect->left, lpSelectRect->bottom);
            LineTo(hDC, lpSelectRect->left, lpSelectRect->top);
            SetROP2(hDC, OldROP);
            break;

        case SL_BLOCK:
            PatBlt(hDC,
                lpSelectRect->left,
                lpSelectRect->top,
                lpSelectRect->right - lpSelectRect->left,
                lpSelectRect->bottom - lpSelectRect->top,
                DSTINVERT);
            break;
    }
    ReleaseDC(hWnd, hDC);
    return 1;
}

BOOL APIENTRY DllMain | ( | HANDLE | hInst,
 |  | DWORD | ul_reason_being_called,
 |  | LPVOID | lpReserved
 | ) |  |

Definition at line 44 of file Select.c.

{
    return 1;
        UNREFERENCED_PARAMETER(hInst);
        UNREFERENCED_PARAMETER(ul_reason_being_called);
        UNREFERENCED_PARAMETER(lpReserved);
}

INT APIENTRY EndSelection | ( | MPOINT | ptCurrent,
 |  | LPRECT | lpSelectRect
 | ) |  |

Definition at line 153 of file Select.c.

{
    lpSelectRect->right = ptCurrent.x;
    lpSelectRect->bottom = ptCurrent.y;
    ReleaseCapture();
    return 1;
}

INT APIENTRY StartSelection | ( | HWND | hWnd,
 |  | MPOINT | ptCurrent,
 |  | LPRECT | lpSelectRect,
 |  | INT | fFlags
 | ) |  |

Definition at line 61 of file Select.c.

{
    if (lpSelectRect->left != lpSelectRect->right ||
            lpSelectRect->top != lpSelectRect->bottom)
        ClearSelection(hWnd, lpSelectRect, fFlags);

    lpSelectRect->right = ptCurrent.x;
    lpSelectRect->bottom = ptCurrent.y;

    /* If you are extending the box, then invert the current rectangle */

    if ((fFlags & SL_SPECIAL) == SL_EXTEND)
        ClearSelection(hWnd, lpSelectRect, fFlags);

    /* Otherwise, set origin to current location */

    else {
        lpSelectRect->left = ptCurrent.x;
        lpSelectRect->top = ptCurrent.y;
    }
    SetCapture(hWnd);
    return 1;
}

INT APIENTRY UpdateSelection | ( | HWND | hWnd,
 |  | MPOINT | ptCurrent,
 |  | LPRECT | lpSelectRect,
 |  | INT | fFlags
 | ) |  |

Definition at line 97 of file Select.c.

{
    HDC hDC;
    SHORT OldROP;

    hDC = GetDC(hWnd);

    switch (fFlags & SL_TYPE) {

        case SL_BOX:
            OldROP = (SHORT)SetROP2(hDC, R2_NOTXORPEN);
            MoveToEx(hDC, lpSelectRect->left, lpSelectRect->top, NULL);
            LineTo(hDC, lpSelectRect->right, lpSelectRect->top);
            LineTo(hDC, lpSelectRect->right, lpSelectRect->bottom);
            LineTo(hDC, lpSelectRect->left, lpSelectRect->bottom);
            LineTo(hDC, lpSelectRect->left, lpSelectRect->top);
            LineTo(hDC, ptCurrent.x, lpSelectRect->top);
            LineTo(hDC, ptCurrent.x, ptCurrent.y);
            LineTo(hDC, lpSelectRect->left, ptCurrent.y);
            LineTo(hDC, lpSelectRect->left, lpSelectRect->top);
            SetROP2(hDC, OldROP);
            break;

        case SL_BLOCK:
            PatBlt(hDC,
                lpSelectRect->left,
                lpSelectRect->bottom,
                lpSelectRect->right - lpSelectRect->left,
                ptCurrent.y - lpSelectRect->bottom,
                DSTINVERT);
            PatBlt(hDC,
                lpSelectRect->right,
                lpSelectRect->top,
                ptCurrent.x - lpSelectRect->right,
                ptCurrent.y - lpSelectRect->top,
                DSTINVERT);
            break;
    }
    lpSelectRect->right = ptCurrent.x;
    lpSelectRect->bottom = ptCurrent.y;
    ReleaseDC(hWnd, hDC);
    return 1;
}

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/dll/Select.h File Reference

  • Begin
  • dll
Defines | Typedefs | Functions

Select.h File Reference

Go to the source code of this file.

Defines

#define | INT2DWORD DWORD
#define | MAKEMPOINT(l) (*((MPOINT *)&(l)))
#define | MPOINT2POINT(mpt, pt) ((pt).x = (mpt).x, (pt).y = (mpt).y)
#define | POINT2MPOINT(pt, mpt) ((mpt).x = (SHORT)(pt).x, (mpt).y = (SHORT)(pt).y)
#define | SL_BLOCK 2
#define | SL_BOX 1
#define | SL_EXTEND 256
#define | SL_SPECIAL 0xFF00
#define | SL_TYPE 0x00FF

Typedefs

typedef POINTS | MPOINT

Functions

int APIENTRY | ClearSelection (HWND, LPRECT, int)
int APIENTRY | EndSelection (MPOINT, LPRECT)
int APIENTRY | StartSelection (HWND, MPOINT, LPRECT, int)
int APIENTRY | UpdateSelection (HWND, MPOINT, LPRECT, int)

Define Documentation

#define INT2DWORD DWORD

Definition at line 27 of file Select.h.

#define MAKEMPOINT ( l ) (*((MPOINT *)&(l)))

Definition at line 29 of file Select.h.

#define MPOINT2POINT | ( | mpt,
 |  | pt |
 | ) |  | ((pt).x = (mpt).x, (pt).y = (mpt).y)

Definition at line 30 of file Select.h.

#define POINT2MPOINT | ( | pt,
 |  | mpt |
 | ) |  | ((mpt).x = (SHORT)(pt).x, (mpt).y = (SHORT)(pt).y)

Definition at line 31 of file Select.h.

#define SL_BLOCK 2

Definition at line 18 of file Select.h.

#define SL_BOX 1

Definition at line 17 of file Select.h.

#define SL_EXTEND 256

Definition at line 20 of file Select.h.

#define SL_SPECIAL 0xFF00

Definition at line 23 of file Select.h.

#define SL_TYPE 0x00FF

Definition at line 22 of file Select.h.

Typedef Documentation

typedef POINTS MPOINT

Definition at line 28 of file Select.h.

Function Documentation

int APIENTRY ClearSelection | ( | HWND | ,
 |  | LPRECT | ,
 |  | int |
 | ) |  |
int APIENTRY EndSelection | ( | MPOINT | ,
 |  | LPRECT |
 | ) |  |

Definition at line 153 of file Select.c.

{
    lpSelectRect->right = ptCurrent.x;
    lpSelectRect->bottom = ptCurrent.y;
    ReleaseCapture();
    return 1;
}

int APIENTRY StartSelection | ( | HWND | ,
 |  | MPOINT | ,
 |  | LPRECT | ,
 |  | int |
 | ) |  |
int APIENTRY UpdateSelection | ( | HWND | ,
 |  | MPOINT | ,
 |  | LPRECT | ,
 |  | int |
 | ) |  |
Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/Generic/Generic.C File Reference

  • Begin
  • Generic
Defines | Functions | Variables

Generic.C File Reference

#include <windows.h>
#include <strsafe.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include "generic.h"

Go to the source code of this file.

Defines

#define | APPNAME "Generic"
#define | BUFFSIZE 256
#define | IS_NT IS_WIN32 && (BOOL)(GetVersion() < 0x80000000)
#define | IS_WIN32 FALSE
#define | IS_WIN32S IS_WIN32 && (BOOL)(!(IS_NT) && (LOBYTE(LOWORD(GetVersion()))<4))
#define | IS_WIN95 (BOOL)(!(IS_NT) && !(IS_WIN32S)) && IS_WIN32

Functions

LRESULT CALLBACK | About (HWND, UINT, WPARAM, LPARAM)
BOOL | CenterWindow (HWND, HWND)
LPTSTR | GetStringRes (int id)
BOOL | InitApplication (HINSTANCE)
BOOL | InitInstance (HINSTANCE, int)
ATOM | MyRegisterClass (CONST WNDCLASS *)
int APIENTRY | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
LRESULT CALLBACK | WndProc (HWND, UINT, WPARAM, LPARAM)

Variables

HINSTANCE | hInst
char | szAppName [100]
char | szTitle [100]

Define Documentation

#define APPNAME "Generic"

Definition at line 26 of file Generic.C.

#define BUFFSIZE 256

Definition at line 51 of file Generic.C.

#define IS_NT IS_WIN32 && (BOOL)(GetVersion() < 0x80000000)

Definition at line 46 of file Generic.C.

#define IS_WIN32 FALSE

Definition at line 44 of file Generic.C.

#define IS_WIN32S IS_WIN32 && (BOOL)(!(IS_NT) && (LOBYTE(LOWORD(GetVersion()))<4))

Definition at line 47 of file Generic.C.

#define IS_WIN95 (BOOL)(!(IS_NT) && !(IS_WIN32S)) && IS_WIN32

Definition at line 48 of file Generic.C.

Function Documentation

LRESULT CALLBACK About | ( | HWND | hDlg,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 445 of file Generic.C.

{
   static  HFONT hfontDlg;    // Font for dialog text
   static   HFONT hFinePrint; // Font for 'fine print' in dialog
   DWORD   dwVerInfoSize;     // Size of version information block
   LPSTR   lpVersion;         // String pointer to 'version' text
   DWORD   dwVerHnd=0;        // An 'ignored' parameter, always '0'
   UINT    uVersionLen;
   WORD    wRootLen;
   BOOL    bRetCode;
   int     i;
   char    szFullPath[BUFFSIZE];
   char    szResult[BUFFSIZE];
   char    szGetName[BUFFSIZE];
   DWORD dwVersion;
   char  szVersion[40];
   DWORD dwResult;
   HRESULT hRes;

   switch (message) {
        case WM_INITDIALOG:
         ShowWindow (hDlg, SW_HIDE);

         if (PRIMARYLANGID(GetUserDefaultLangID()) == LANG_JAPANESE)
         {
            hfontDlg = CreateFont(14, 0, 0, 0, 0, 0, 0, 0, SHIFTJIS_CHARSET, 0, 0, 0,
                                  VARIABLE_PITCH | FF_DONTCARE, "");
            hFinePrint = CreateFont(11, 0, 0, 0, 0, 0, 0, 0, SHIFTJIS_CHARSET, 0, 0, 0,
                                    VARIABLE_PITCH | FF_DONTCARE, "");
         }
         else
         {
            hfontDlg = CreateFont(14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                  VARIABLE_PITCH | FF_SWISS, "");
            hFinePrint = CreateFont(11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                    VARIABLE_PITCH | FF_SWISS, "");
         }

         CenterWindow (hDlg, GetWindow (hDlg, GW_OWNER));
         GetModuleFileName (hInst, szFullPath, sizeof(szFullPath));

         // Now lets dive in and pull out the version information:
         dwVerInfoSize = GetFileVersionInfoSize(szFullPath, &dwVerHnd);
         if (dwVerInfoSize) {
            LPSTR   lpstrVffInfo;
            HANDLE  hMem;
            hMem = GlobalAlloc(GMEM_MOVEABLE, dwVerInfoSize);
            lpstrVffInfo  = GlobalLock(hMem);
            GetFileVersionInfo(szFullPath, dwVerHnd, dwVerInfoSize, lpstrVffInfo);
            // The below 'hex' value looks a little confusing, but
            // essentially what it is, is the hexidecimal representation
            // of a couple different values that represent the language
            // and character set that we are wanting string values for.
            // 040904E4 is a very common one, because it means:
            //   US English, Windows MultiLingual characterset
            // Or to pull it all apart:
            // 04------        = SUBLANG_ENGLISH_USA
            // --09----        = LANG_ENGLISH
            // --11----        = LANG_JAPANESE
            // ----04E4 = 1252 = Codepage for Windows:Multilingual

            // Use safe string handling
            szGetName[sizeof(szGetName) - 1] = '\0';
            lstrcpyn(szGetName, GetStringRes(IDS_VER_INFO_LANG), sizeof(szGetName) - 1);
            if (szGetName[sizeof(szGetName) - 1] != '\0') {
                return FALSE; // Buffer overflow error
            }

            wRootLen = (WORD) lstrlen(szGetName); // Save this position

            // Set the title of the dialog using safe string handling
            hRes = StringCchCatN(szGetName, sizeof(szGetName), "ProductName", sizeof("ProductName"));
            if (FAILED(hRes)) {
                return FALSE; // Buffer overflow error
            }

            bRetCode = VerQueryValue((LPVOID)lpstrVffInfo,
               (LPSTR)szGetName,
               (LPVOID)&lpVersion,
               (UINT *)&uVersionLen);

            // Notice order of version and string...
            if (PRIMARYLANGID(GetUserDefaultLangID()) == LANG_JAPANESE)
            {
                // Use safe string handling
                hRes = StringCchCopyN(szResult, sizeof(szResult), lpVersion, lstrlen(lpVersion));
                if (FAILED(hRes)) {
                    return FALSE; // Buffer overflow error
                }
                hRes = StringCchCatN(szResult, sizeof(szResult), " ‚Ìƒo[ƒWƒ‡ƒ“î•ñ", sizeof(" ‚Ìƒo[ƒWƒ‡ƒ“î•ñ"));
                if (FAILED(hRes)) {
                    return FALSE; // Buffer overflow error
                }
            }
            else
            {
                // Use safe string handling
                hRes = StringCchCopyN(szResult, sizeof(szResult), "About ", sizeof("About "));
                if (FAILED(hRes)) {
                    return FALSE; // Buffer overflow error
                }
                hRes = StringCchCatN(szResult, sizeof(szResult), lpVersion, lstrlen(lpVersion));
                if (FAILED(hRes)) {
                    return FALSE; // Buffer overflow error
                }
            }

            // -----------------------------------------------------

            SetWindowText (hDlg, szResult);

            // Walk through the dialog items that we want to replace:
            for (i = DLG_VERFIRST; i <= DLG_VERLAST; i++) {
               GetDlgItemText(hDlg, i, szResult, sizeof(szResult));
               szGetName[wRootLen] = (char)0;
               // Use safe sting handling
               hRes = StringCchCatN(szGetName, sizeof(szGetName), szResult, sizeof(szResult));
               if (FAILED(hRes)) {
                   return FALSE; // Buffer overflow error
               }
               uVersionLen   = 0;
               lpVersion     = NULL;
               bRetCode      =  VerQueryValue((LPVOID)lpstrVffInfo,
                  (LPSTR)szGetName,
                  (LPVOID)&lpVersion,
                  (UINT *)&uVersionLen);

               if ( bRetCode && uVersionLen && lpVersion) {
                   // Replace dialog item text with version info
                   // Use safe string handling
                   hRes = StringCchCopyN(szResult, sizeof(szResult), lpVersion, lstrlen(lpVersion));
                   if (FAILED(hRes)) {
                       return FALSE; // Buffer overflow error
                   }
                   SetDlgItemText(hDlg, i, szResult);
               }
               else
               {
                  dwResult = GetLastError();

                  // Use safe string handling
                  hRes = StringCchPrintf(szResult, sizeof(szResult), GetStringRes(IDS_VERSION_ERROR), dwResult);
                  if (FAILED(hRes)) {
                      return FALSE; // Buffer overflow error
                  }

                  SetDlgItemText (hDlg, i, szResult);
               }
               SendMessage (GetDlgItem (hDlg, i), WM_SETFONT,
                  (ULONG_PTR)((i==DLG_VERLAST)?hFinePrint:hfontDlg),
                  TRUE);
            } // for (i = DLG_VERFIRST; i <= DLG_VERLAST; i++)

            GlobalUnlock(hMem);
            GlobalFree(hMem);

         } else {
            // No version information available.
         } // if (dwVerInfoSize)

            SendMessage (GetDlgItem (hDlg, IDC_LABEL), WM_SETFONT,
            (WPARAM)hfontDlg,(LPARAM)TRUE);

         // We are  using GetVersion rather then GetVersionEx
         // because earlier versions of Windows NT and Win32s
         // didn't include GetVersionEx:
         dwVersion = GetVersion();

         if (dwVersion < 0x80000000) {
            // Windows NT
            // Use safe sting handling
            hRes = StringCchPrintf(szVersion, sizeof(szVersion), "Microsoft Windows NT %u.%u (Build: %u)",
                (DWORD)(LOBYTE(LOWORD(dwVersion))),
                (DWORD)(HIBYTE(LOWORD(dwVersion))),
                (DWORD)(HIWORD(dwVersion)) );
            if (FAILED(hRes)) {
                return FALSE; // Buffer overflow error
            }
         } else if (LOBYTE(LOWORD(dwVersion))<4) {
            // Win32s
            // Use safe sting handling
            hRes = StringCchPrintf(szVersion, sizeof(szVersion), "Microsoft Win32s %u.%u (Build: %u)",
                (DWORD)(LOBYTE(LOWORD(dwVersion))),
                (DWORD)(HIBYTE(LOWORD(dwVersion))),
                (DWORD)(HIWORD(dwVersion) & ~0x8000) );
            if (FAILED(hRes)) {
                return FALSE; // Buffer overflow error
            }
         } else {
            // Windows 95
            // Use safe sting handling
            hRes = StringCchPrintf(szVersion, sizeof(szVersion), "Microsoft Windows 95 %u.%u",
                (DWORD)(LOBYTE(LOWORD(dwVersion))),
                (DWORD)(HIBYTE(LOWORD(dwVersion))) );
            if (FAILED(hRes)) {
                return FALSE; // Buffer overflow error
            }
         }

          SetWindowText (GetDlgItem(hDlg, IDC_OSVERSION), szVersion);
         ShowWindow (hDlg, SW_SHOW);
         return (TRUE);

      case WM_COMMAND:
         if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) {
            EndDialog(hDlg, TRUE);
            DeleteObject (hfontDlg);
            DeleteObject (hFinePrint);
            return (TRUE);
         }
         break;
   }

    return FALSE;
}

BOOL CenterWindow | ( | HWND | hwndChild,
 |  | HWND | hwndParent
 | ) |  |

Definition at line 676 of file Generic.C.

{
   RECT    rChild, rParent, rWorkArea;
   int     wChild, hChild, wParent, hParent;
   int     xNew, yNew;
   BOOL  bResult;

   // Get the Height and Width of the child window
   GetWindowRect (hwndChild, &rChild);
   wChild = rChild.right - rChild.left;
   hChild = rChild.bottom - rChild.top;

   // Get the Height and Width of the parent window
   GetWindowRect (hwndParent, &rParent);
   wParent = rParent.right - rParent.left;
   hParent = rParent.bottom - rParent.top;

   // Get the limits of the 'workarea'
   bResult = SystemParametersInfo(
      SPI_GETWORKAREA,  // system parameter to query or set
      sizeof(RECT),
      &rWorkArea,
      0);
   if (!bResult) {
      rWorkArea.left = rWorkArea.top = 0;
      rWorkArea.right = GetSystemMetrics(SM_CXSCREEN);
      rWorkArea.bottom = GetSystemMetrics(SM_CYSCREEN);
   }

   // Calculate new X position, then adjust for workarea
   xNew = rParent.left + ((wParent - wChild) /2);
   if (xNew < rWorkArea.left) {
      xNew = rWorkArea.left;
   } else if ((xNew+wChild) > rWorkArea.right) {
      xNew = rWorkArea.right - wChild;
   }

   // Calculate new Y position, then adjust for workarea
   yNew = rParent.top  + ((hParent - hChild) /2);
   if (yNew < rWorkArea.top) {
      yNew = rWorkArea.top;
   } else if ((yNew+hChild) > rWorkArea.bottom) {
      yNew = rWorkArea.bottom - hChild;
   }

   // Set it, and return
   return SetWindowPos (hwndChild, NULL, xNew, yNew, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
}

LPTSTR GetStringRes ( int id )

Definition at line 736 of file Generic.C.

{
  static TCHAR buffer[MAX_PATH];

  buffer[0]=0;
  LoadString (GetModuleHandle (NULL), id, buffer, MAX_PATH);
  return buffer;
}

BOOL InitApplication ( HINSTANCE hInstance )

Definition at line 186 of file Generic.C.

{
    WNDCLASS  wc;
    HWND      hwnd;

    // Win32 will always set hPrevInstance to NULL, so lets check
    // things a little closer. This is because we only want a single
    // version of this app to run at a time
    hwnd = FindWindow (szAppName, szTitle);
    if (hwnd)
    {
        // We found another version of ourself. Lets defer to it:
        if (IsIconic(hwnd))
        {
            ShowWindow(hwnd, SW_RESTORE);
        }
        SetForegroundWindow (hwnd);

        // If this app actually had any functionality, we would
        // also want to communicate any action that our 'twin'
        // should now perform based on how the user tried to
        // execute us.
        return FALSE;
    }

    // Fill in window class structure with parameters that describe
    // the main window.
    wc.style         = CS_HREDRAW | CS_VREDRAW;
    wc.lpfnWndProc   = (WNDPROC)WndProc;
    wc.cbClsExtra    = 0;
    wc.cbWndExtra    = 0;
    wc.hInstance     = hInstance;
    wc.hIcon         = LoadIcon (hInstance, szAppName);
    wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);

    // Since Windows95 has a slightly different recommended
    // format for the 'Help' menu, lets put this in the alternate menu like this:
    if (IS_WIN95)
    {
        wc.lpszMenuName  = "WIN95";
    }
    else
    {
        wc.lpszMenuName  = szAppName;
    }
    wc.lpszClassName = szAppName;

    // Register the window class and return success/failure code.
    if (IS_WIN95)
    {
        return MyRegisterClass(&wc);
    }
    else
    {
        return RegisterClass(&wc);
    }
}

BOOL InitInstance | ( | HINSTANCE | hInstance,
 |  | int | nCmdShow
 | ) |  |

Definition at line 255 of file Generic.C.

{
   HWND hWnd;

   hInst = hInstance; // Store instance handle in our global variable

   hWnd = CreateWindow(szAppName, szTitle, WS_OVERLAPPEDWINDOW,
      CW_USEDEFAULT, 0, CW_USEDEFAULT, 0,
      NULL, NULL, hInstance, NULL);

   if (!hWnd) {
      return (FALSE);
   }

   ShowWindow(hWnd, nCmdShow);
   UpdateWindow(hWnd);

   return (TRUE);
}

ATOM MyRegisterClass ( CONST WNDCLASS * lpwc )

Definition at line 136 of file Generic.C.

{
   HANDLE  hMod;
   FARPROC proc;
   WNDCLASSEX wcex;

   hMod = GetModuleHandle ("USER32");
   if (hMod != NULL) {

#if defined (UNICODE)
      proc = GetProcAddress (hMod, "RegisterClassExW");
#else
      proc = GetProcAddress (hMod, "RegisterClassExA");
#endif

      if (proc != NULL) {

         wcex.style         = lpwc->style;
         wcex.lpfnWndProc   = lpwc->lpfnWndProc;
         wcex.cbClsExtra    = lpwc->cbClsExtra;
         wcex.cbWndExtra    = lpwc->cbWndExtra;
         wcex.hInstance     = lpwc->hInstance;
         wcex.hIcon         = lpwc->hIcon;
         wcex.hCursor       = lpwc->hCursor;
         wcex.hbrBackground = lpwc->hbrBackground;
                     wcex.lpszMenuName  = lpwc->lpszMenuName;
         wcex.lpszClassName = lpwc->lpszClassName;

         // Added elements for Windows 95:
         wcex.cbSize = sizeof(WNDCLASSEX);
         wcex.hIconSm = LoadIcon(wcex.hInstance, "SMALL");

         return (ATOM)(*proc)(&wcex);//return RegisterClassEx(&wcex);
      }
   }
   return (RegisterClass(lpwc));
}

int APIENTRY WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 81 of file Generic.C.

{
   MSG msg;
   HANDLE hAccelTable;
   HRESULT hRes;

   // Initialize global strings with safe string handling
   hRes = StringCchCopyN(szAppName, sizeof(szAppName), APPNAME, sizeof(APPNAME));
   if (FAILED(hRes)) {
     return (FALSE); // Buffer overflow error
   }
   LoadString (hInstance, IDS_APP_TITLE, szTitle, 100);

   // Perform instance initialization:
   if (!InitApplication(hInstance)) {
     return (FALSE);
   }

   // Perform application initialization:
   if (!InitInstance(hInstance, nCmdShow)) {
      return (FALSE);
   }

   hAccelTable = LoadAccelerators (hInstance, szAppName);

   // Main message loop:
   while (GetMessage(&msg, NULL, 0, 0)) {
      if (!TranslateAccelerator (msg.hwnd, hAccelTable, &msg)) {
         TranslateMessage(&msg);
         DispatchMessage(&msg);
      }
   }

   return ((int) msg.wParam);

   lpCmdLine; // This will prevent 'unused formal parameter' warnings
}

LRESULT CALLBACK WndProc | ( | HWND | hWnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 290 of file Generic.C.

{
   int wmId, wmEvent;
   PAINTSTRUCT ps;
   HDC hdc;
      POINT pnt;
   HMENU hMenu;
      BOOL bGotHelp;

   switch (message) {

      case WM_COMMAND:
         wmId    = LOWORD(wParam); // Remember, these are...
         wmEvent = HIWORD(wParam); // ...different for Win32!

         //Parse the menu selections:
         switch (wmId) {

            case IDM_ABOUT:
               DialogBox(hInst, "AboutBox", hWnd, (DLGPROC)About);
               break;

            case IDM_EXIT:
               DestroyWindow (hWnd);
               break;

            case IDM_HELPTOPICS: // Only called in Windows 95
               bGotHelp = WinHelp (hWnd, APPNAME".HLP", HELP_FINDER,(DWORD)0);
               if (!bGotHelp)
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            case IDM_HELPCONTENTS: // Not called in Windows 95
               bGotHelp = WinHelp (hWnd, APPNAME".HLP", HELP_CONTENTS,(DWORD)0);
               if (!bGotHelp)
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            case IDM_HELPSEARCH: // Not called in Windows 95
               if (!WinHelp(hWnd, APPNAME".HLP", HELP_PARTIALKEY,
                           (ULONG_PTR)(LPSTR)""))
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            case IDM_HELPHELP: // Not called in Windows 95
               if(!WinHelp(hWnd, (LPSTR)NULL, HELP_HELPONHELP, 0))
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            // Here are all the other possible menu options,
            // all of these are currently disabled:
            case IDM_NEW:
            case IDM_OPEN:
            case IDM_SAVE:
            case IDM_SAVEAS:
            case IDM_UNDO:
            case IDM_CUT:
            case IDM_COPY:
            case IDM_PASTE:
            case IDM_LINK:
            case IDM_LINKS:

            default:
               return (DefWindowProc(hWnd, message, wParam, lParam));
         }
         break;

      case WM_NCRBUTTONUP: // RightClick on windows non-client area...
         if (IS_WIN95 && SendMessage(hWnd, WM_NCHITTEST, 0, lParam) == HTSYSMENU)
         {
            // The user has clicked the right button on the applications
            // 'System Menu'. Here is where you would alter the default
            // system menu to reflect your application. Notice how the
            // explorer deals with this. For this app, we aren't doing
            // anything
            return (DefWindowProc(hWnd, message, wParam, lParam));
         } else {
            // Nothing we are interested in, allow default handling...
            return (DefWindowProc(hWnd, message, wParam, lParam));
         }
            break;

        case WM_RBUTTONDOWN: // RightClick in windows client area...
            pnt.x = LOWORD(lParam);
            pnt.y = HIWORD(lParam);
            ClientToScreen(hWnd, (LPPOINT) &pnt);
      // This is where you would determine the appropriate 'context'
      // menu to bring up. Since this app has no real functionality,
      // we will just bring up the 'Help' menu:
            hMenu = GetSubMenu (GetMenu (hWnd), 2);
            if (hMenu) {
                TrackPopupMenu (hMenu, 0, pnt.x, pnt.y, 0, hWnd, NULL);
            } else {
            // Couldn't find the menu...
                MessageBeep(0);
            }
            break;

      case WM_DISPLAYCHANGE: // Only comes through on plug'n'play systems
      {
         SIZE  szScreen;
         DWORD dwBitsPerPixel = (DWORD)wParam;

         szScreen.cx = LOWORD(lParam);
         szScreen.cy = HIWORD(lParam);

         MessageBox (GetFocus(), GetStringRes(IDS_DISPLAYCHANGED),
                     szAppName, 0);
      }
      break;

      case WM_PAINT:
         hdc = BeginPaint (hWnd, &ps);
         // Add any drawing code here...
         EndPaint (hWnd, &ps);
         break;

      case WM_DESTROY:
         // Tell WinHelp we don't need it any more...
               WinHelp (hWnd, APPNAME".HLP", HELP_QUIT,(DWORD)0);
         PostQuitMessage(0);
         break;

      default:
         return (DefWindowProc(hWnd, message, wParam, lParam));
   }
   return (0);
}

Variable Documentation

HINSTANCE hInst

Definition at line 55 of file Generic.C.

char szAppName[100]

Definition at line 56 of file Generic.C.

char szTitle[100]

Definition at line 57 of file Generic.C.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/Generic/Generic.H File Reference

  • Begin
  • Generic
Defines

Generic.H File Reference

Go to the source code of this file.

Defines

#define | DLG_VERFIRST 400
#define | DLG_VERLAST DLG_VERFIRST+5
#define | IDC_COMPANY DLG_VERFIRST
#define | IDC_COPYRIGHT DLG_VERFIRST+3
#define | IDC_FILEDESC DLG_VERFIRST+1
#define | IDC_LABEL DLG_VERLAST+1
#define | IDC_OSVERSION DLG_VERFIRST+4
#define | IDC_PRODVER DLG_VERFIRST+2
#define | IDC_STATIC -1
#define | IDC_TRADEMARK DLG_VERFIRST+5
#define | IDM_ABOUT 303
#define | IDM_COPY 202
#define | IDM_CUT 201
#define | IDM_EXIT 106
#define | IDM_HELPCONTENTS 300
#define | IDM_HELPHELP 302
#define | IDM_HELPSEARCH 301
#define | IDM_HELPTOPICS 304
#define | IDM_LINK 204
#define | IDM_LINKS 205
#define | IDM_NEW 100
#define | IDM_OPEN 101
#define | IDM_PASTE 203
#define | IDM_PRINT 104
#define | IDM_PRINTSETUP 105
#define | IDM_SAVE 102
#define | IDM_SAVEAS 103
#define | IDM_UNDO 200
#define | IDS_APP_TITLE 500
#define | IDS_DISPLAYCHANGED 501
#define | IDS_NO_HELP 504
#define | IDS_VER_INFO_LANG 502
#define | IDS_VERSION_ERROR 503

Define Documentation

#define DLG_VERFIRST 400

Definition at line 26 of file Generic.H.

#define DLG_VERLAST DLG_VERFIRST+5

Definition at line 33 of file Generic.H.

#define IDC_COMPANY DLG_VERFIRST

Definition at line 27 of file Generic.H.

#define IDC_COPYRIGHT DLG_VERFIRST+3

Definition at line 30 of file Generic.H.

#define IDC_FILEDESC DLG_VERFIRST+1

Definition at line 28 of file Generic.H.

#define IDC_LABEL DLG_VERLAST+1

Definition at line 35 of file Generic.H.

#define IDC_OSVERSION DLG_VERFIRST+4

Definition at line 31 of file Generic.H.

#define IDC_PRODVER DLG_VERFIRST+2

Definition at line 29 of file Generic.H.

#define IDC_STATIC -1

Definition at line 24 of file Generic.H.

#define IDC_TRADEMARK DLG_VERFIRST+5

Definition at line 32 of file Generic.H.

#define IDM_ABOUT 303

Definition at line 21 of file Generic.H.

#define IDM_COPY 202

Definition at line 10 of file Generic.H.

#define IDM_CUT 201

Definition at line 9 of file Generic.H.

#define IDM_EXIT 106

Definition at line 7 of file Generic.H.

#define IDM_HELPCONTENTS 300

Definition at line 18 of file Generic.H.

#define IDM_HELPHELP 302

Definition at line 20 of file Generic.H.

#define IDM_HELPSEARCH 301

Definition at line 19 of file Generic.H.

#define IDM_HELPTOPICS 304

Definition at line 22 of file Generic.H.

#define IDM_LINK 204

Definition at line 16 of file Generic.H.

#define IDM_LINKS 205

Definition at line 17 of file Generic.H.

#define IDM_NEW 100

Definition at line 1 of file Generic.H.

#define IDM_OPEN 101

Definition at line 2 of file Generic.H.

#define IDM_PASTE 203

Definition at line 15 of file Generic.H.

#define IDM_PRINT 104

Definition at line 5 of file Generic.H.

#define IDM_PRINTSETUP 105

Definition at line 6 of file Generic.H.

#define IDM_SAVE 102

Definition at line 3 of file Generic.H.

#define IDM_SAVEAS 103

Definition at line 4 of file Generic.H.

#define IDM_UNDO 200

Definition at line 8 of file Generic.H.

#define IDS_APP_TITLE 500

Definition at line 38 of file Generic.H.

#define IDS_DISPLAYCHANGED 501

Definition at line 39 of file Generic.H.

#define IDS_NO_HELP 504

Definition at line 42 of file Generic.H.

#define IDS_VER_INFO_LANG 502

Definition at line 40 of file Generic.H.

#define IDS_VERSION_ERROR 503

Definition at line 41 of file Generic.H.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/Generic/Resource.H File Reference

  • Begin
  • Generic

Resource.H File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/sdkdiff/bar.cpp File Reference

  • Begin
  • sdkdiff
Functions | Variables

bar.cpp File Reference

#include "precomp.h"
#include "table.h"
#include "state.h"
#include "wdiffrc.h"
#include "sdkdiff.h"
#include "list.h"
#include "line.h"
#include "scandir.h"
#include "file.h"
#include "section.h"
#include "compitem.h"
#include "complist.h"
#include "view.h"

Go to the source code of this file.

Functions

void | BarClick (HWND hwnd, int x, int y)
void | BarDrawPosition (HWND hwndBar, HDC hdcIn, BOOL bErase)
void | BarPaint (HWND hwnd)
INT_PTR APIENTRY | BarWndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
void | DrawLink (HDC hdc, int cx, int cy, int lines, SECTION sec)
void | DrawSection (HDC hdc, int cx, int cy, int lines, SECTION sec, int sidecode)
BOOL | InitBarClass (HINSTANCE hInstance)
void | InitHashChars (void)

Variables

HBRUSH | hbrLeft
HBRUSH | hbrRight
HBRUSH | hbrSame
HBRUSH | hbrSideBar
HPEN | hpenLeft
HPEN | hpenRight
HPEN | hpenSame
char * | s = 0

Function Documentation

void BarClick | ( | HWND | hwnd,
 |  | int | x,
 |  | int | y
 | ) |  |

Definition at line 503 of file bar.cpp.

{
    RECT rc;
    int xleft, xright;
    int linenr, i, that;
    BOOL bIsLeft;
    int tot_left, tot_right, total_lines;
    LIST listleft, listright;
    VIEW view;
    COMPITEM item;
    TableSelection select;

    /* find size of the window to get horz scaling, and see
     * where click was
     */
    GetClientRect(hwnd, &rc);

    /* was it near either of the bars ? */

    /* horz positioning is in percentages of window width */
    xleft = max(L_UNMATCH_START + L_UNMATCH_WIDTH,
                L_MATCH_START + L_MATCH_WIDTH);
    xright = min(R_UNMATCH_START, R_MATCH_START);
    xleft = xleft * (rc.right - rc.left) / 100;
    xright = xright * (rc.right - rc.left) / 100;

    if (x < xleft) {
        bIsLeft = TRUE;
    } else if (x > xright) {
        bIsLeft = FALSE;
    } else {
        /* click was between the two bars - ignore it */
        return;
    }

    /* calculate the vertical scaling (based on total lines displayed)
     * so that we can convert the y position into a line nr
     */

    /* get the handles to the two lists of sections */
    view = (VIEW) SendMessage(hwndClient, TM_CURRENTVIEW, 0, 0);

    /* make sure we are in expand mode */
    if (view_isexpanded(view) == FALSE) {
        return;
    }

    item = view_getitem(view, 0);

    listleft = compitem_getleftsections(item);
    listright = compitem_getrightsections(item);

    /* ignore the click if only one list of sections, since in
     * this case there is nothing drawn for him to click on.
     */
    if ((listleft == NULL) || (listright == NULL)) {
        return;
    }

    /* take the longest of the two files and use this
     * for vertical scaling. the scale is such that the longest file
     * *just fits*.
     */
    tot_left = line_getlinenr(section_getlastline((SECTION)List_Last(listleft)));
    tot_right = line_getlinenr(section_getlastline((SECTION)List_Last(listright)));

    total_lines = max(tot_left, tot_right);

    /* convert vertical position into a line nr. The vertical scaling
     * can be calculated from knowing that the longest list of
     * lines just fits in the window.
     * Don't use MulDiv, as we don't want to round the result - so
     * cast to long so maths is 32-bit even on win3.1
     */
    linenr = (int) (((long) total_lines * y) / (rc.bottom - rc.top)) + 1;

    /* check that the line is valid */
    if (bIsLeft) {
        if (linenr > tot_left) {
            return;
        }
    } else {
        if (linenr > tot_right) {
            return;
        }
    }

    /* search the current view, looking for a row with this
     * line nr on the correct side
     */
    for (i = 0; i < view_getrowcount(view); i++) {
        if (bIsLeft) {
            that = view_getlinenr_left(view,i);
        } else {
            that = view_getlinenr_right(view,i);
        }

        if (linenr == that) {
            /* found the matching line- select it in the
             * table window
             */
            select.startrow = i;
            select.startcell = 0;
            select.nrows = 1;
            select.ncells = 1;
            SendMessage(hwndRCD, TM_SELECT, 0, (LPARAM)&select);
            return;
        }
    }

    sdkdiff_UI(TRUE);
    MessageBox(hwndClient, LoadRcString(IDS_LINE_NOT_VISIBLE),
               "SdkDiff", MB_ICONSTOP|MB_OK);
    sdkdiff_UI(FALSE);
}

void BarDrawPosition | ( | HWND | hwndBar,
 |  | HDC | hdcIn,
 |  | BOOL | bErase
 | ) |  |

Definition at line 172 of file bar.cpp.

{
    HDC hdc;
    int total_lines, cy, cx;
    RECT rc, rcLeft, rcRight;
    VIEW view;
    COMPITEM item;
    LIST listleft, listright;
    long toprow, endrow, i;
    int left_first, left_last, right_first, right_last, linenr;

    /* get a hdc if we weren't given one */
    if (hdcIn == NULL) {
        hdc = GetDC(hwndBar);
        if (!hdc)
            return;
    } else {
        hdc = hdcIn;
    }

    /* set horz position of bars */
    GetClientRect(hwndBar, &rc);
    cx = (int)(rc.right - rc.left);
    cy = (int)(rc.bottom - rc.top);

    /* layout constants are defined as percentages of window width */
    rcLeft.left = cx * L_POS_START / 100;
    rcRight.left = cx * R_POS_START / 100;
    rcLeft.right = rcLeft.left +  (cx * L_POS_WIDTH / 100);
    rcRight.right = rcRight.left +  (cx * R_POS_WIDTH / 100);

    /* erase the whole marker section if requested */
    if (bErase) {
        rcLeft.top = rc.top;
        rcLeft.bottom = rc.bottom;
        rcRight.top = rc.top;
        rcRight.bottom = rc.bottom;

        FillRect(hdc, &rcLeft, (HBRUSH)GetStockObject(WHITE_BRUSH));

        FillRect(hdc, &rcRight, (HBRUSH)GetStockObject(WHITE_BRUSH));
    }

    /*
     * calculate the vertical scaling - depends on the
     * total number of lines shown
     */

    /* get the handles to the two lists of sections */
    view = (VIEW) SendMessage(hwndClient, TM_CURRENTVIEW, 0, 0);
    /* make sure we are in expand mode */
    if (view_isexpanded(view) == FALSE) {
        /* get rid of the dc if we made it ourselves */
        if (hdcIn == NULL) {
            ReleaseDC(hwndBar, hdc);
        }
        return;
    }

    item = view_getitem(view, 0);

    listleft = compitem_getleftsections(item);
    listright = compitem_getrightsections(item);

    /* if there is only one list of sections, draw nothing. The
     * picture for a single file is not very exciting.
     */

    if ((listleft == NULL) || (listright == NULL)) {
        /* get rid of the dc if we made it ourselves */
        if (hdcIn == NULL) {
            ReleaseDC(hwndBar, hdc);
        }
        return;
    }

    /* take the longest of the two files and use this
     * for vertical scaling. the scale is such that the longest file
     * *just fits*.
     */
    total_lines = line_getlinenr(section_getlastline((SECTION)List_Last(listleft)));
    total_lines = max(total_lines,
                      (int) line_getlinenr(section_getlastline((SECTION)List_Last(listright))));

    /* get the current top row and nr of rows visible */
    toprow = (LONG)SendMessage(hwndRCD, TM_TOPROW, FALSE, 0);
    endrow = (LONG)SendMessage(hwndRCD, TM_ENDROW, FALSE, 0);
    endrow = min(endrow, view_getrowcount(view)-1);

    /*
     * find the first and last line nrs from each file currently visible.
     *
     */
    left_first = left_last = right_first = right_last = 0;

    for (i = toprow; i <= endrow; i++) {
        linenr = view_getlinenr_left(view, i);

        if (linenr > 0) {

            if (left_first == 0) {
                left_first = linenr;
            }
            left_first = min(left_first, linenr);
            left_last = max(left_last, linenr);
        }

        linenr = view_getlinenr_right(view, i);
        if (linenr > 0) {
            if (right_first == 0) {
                right_first = linenr;
            }
            right_first = min(right_first, linenr);
            right_last = max(right_last, linenr);
        }
    }

    /* draw the two markers as thick bars -> elongated rectangles */
    rcLeft.top = MulDiv(left_first-1, cy, total_lines);
    rcLeft.bottom = MulDiv(left_last, cy, total_lines);
    FillRect(hdc, &rcLeft, hbrSideBar);

    rcRight.top = MulDiv(right_first-1, cy, total_lines);
    rcRight.bottom = MulDiv(right_last, cy, total_lines);
    FillRect(hdc, &rcRight, hbrSideBar);

    /* get rid of the dc if we made it ourselves */
    if (hdcIn == NULL) {
        ReleaseDC(hwndBar, hdc);
    }
}

void BarPaint ( HWND hwnd )

Definition at line 310 of file bar.cpp.

{
    PAINTSTRUCT ps;
    HDC hdc;
    VIEW view;
    COMPITEM item;
    LIST listleft, listright;
    SECTION sec;
    int total_lines, cx, cy;
    RECT rc;

    hdc = BeginPaint(hwnd, &ps);

    /* draw a separator line at the very edge of the window */
    GetClientRect(hwnd, &rc);
    MoveToEx(hdc, (int)(rc.right-1), rc.top, NULL);
    LineTo(hdc, (int)(rc.right-1), rc.bottom);

    /* first gather information about what is to be displayed */

    /* find the total lines (for horz. scaling) */

    /* get the handles to the two lists of sections */
    view = (VIEW) SendMessage(hwndClient, TM_CURRENTVIEW, 0, 0);

    /* make sure we are in expand mode */
    if (view_isexpanded(view) == FALSE) {
        return;
    }

    item = view_getitem(view, 0);

    listleft = compitem_getleftsections(item);
    listright = compitem_getrightsections(item);

    /*
     * don't bother if there is only one list - not very interesting
     */
    if ((listleft == NULL) || (listright == NULL)) {
        EndPaint(hwnd, &ps);
        return;
    }

    /* take the longest of the two files and use this
     * for vertical scaling. the scale is such that the longest file
     * *just fits*.
     */
    total_lines = (int) line_getlinenr(section_getlastline((SECTION)List_Last(listleft)));
    total_lines = max(total_lines,
                      (int) line_getlinenr(section_getlastline((SECTION)List_Last(listright))));

    /* horizontal spacing:
     *
     * there are two columns, for the left and right files, and a gap
     * between them criss-crossed by lines marking the links.
     *
     * Each of the columns then has three sections, for the
     * position marker, the different sections
     * and the linked sections. The width and positions of these items
     * are defined (in sdkdiff.h) as percentages of the window width.
     */

    cx = (int)(rc.right - rc.left);
    cy = (int)(rc.bottom - rc.top);

    /* draw all the left sections and links */
  for( sec=(SECTION)List_First(listleft);  sec!=NULL;  sec = (SECTION)List_Next((LPVOID)sec)) {
        DrawSection(hdc, cx, cy, total_lines, sec, STATE_LEFTONLY);

        if (section_getlink(sec) != NULL) {
            DrawLink(hdc, cx, cy, total_lines, sec);
        }
    }

    /* draw all the right sections */
  for( sec=(SECTION)List_First(listright);  sec!=NULL;  sec = (SECTION)List_Next((LPVOID)sec)) {
        DrawSection(hdc, cx, cy, total_lines, sec, STATE_RIGHTONLY);
    }

    /* now draw current position markers */
    BarDrawPosition(hwnd, hdc, FALSE);

    EndPaint(hwnd, &ps);
}

INT_PTR APIENTRY BarWndProc | ( | HWND | hWnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 95 of file bar.cpp.

{
    switch (message) {
        case WM_CREATE:

            hpenSame = CreatePen(PS_SOLID, 1, RGB(0,0,0));
            hbrSame = CreateSolidBrush(RGB(255,255,255));

            hpenLeft = CreatePen(PS_SOLID, 1, rgb_barleft);
            hbrLeft = CreateSolidBrush(rgb_barleft);

            hpenRight = CreatePen(PS_SOLID, 1, rgb_barright);
            hbrRight = CreateSolidBrush(rgb_barright);

            hbrSideBar = CreateSolidBrush(rgb_barcurrent);
            break;

        case WM_DESTROY:
            DeleteObject(hpenSame);
            DeleteObject(hpenLeft);
            DeleteObject(hpenRight);
            DeleteObject(hbrSame);
            DeleteObject(hbrLeft);
            DeleteObject(hbrRight);
            DeleteObject(hbrSideBar);
            break;

        case WM_PAINT:
            BarPaint(hWnd);
            break;

        case WM_LBUTTONDOWN:
            BarClick(hWnd, LOWORD(lParam), HIWORD(lParam));
            break;

        case WM_COMMAND:
            switch (GET_WM_COMMAND_ID(wParam, lParam)) {
                case IDM_MONOCOLS:
                    DeleteObject(hpenLeft);
                    DeleteObject(hpenRight);
                    DeleteObject(hbrLeft);
                    DeleteObject(hbrRight);
                    DeleteObject(hbrSideBar);

                    hpenLeft = CreatePen(PS_SOLID, 1, rgb_barleft);
                    hbrLeft = CreateSolidBrush(rgb_barleft);
                    hpenRight = CreatePen(PS_SOLID, 1, rgb_barright);
                    hbrRight = CreateSolidBrush(rgb_barright);
                    hbrSideBar = CreateSolidBrush(rgb_barcurrent);

                    break;
                default: /* no action */
                    break;
            }
            break;

        default:
            return(DefWindowProc(hWnd, message, wParam, lParam));
    }
    return 0;
}

void DrawLink | ( | HDC | hdc,
 |  | int | cx,
 |  | int | cy,
 |  | int | lines,
 |  | SECTION | sec
 | ) |  |

Definition at line 467 of file bar.cpp.

{
    int x1, y1, x2, y2;
    int ybase, yrange;
    SECTION other;

    other = section_getlink(sec);

    /* position the link line halfway down the section
     * - allow for the case where
     * the section is one line (ie halve the co-ords, not the line nr)
     */
    ybase = MulDiv(line_getlinenr(section_getfirstline(sec)) - 1, cy, lines);
    yrange = MulDiv(line_getlinenr(section_getlastline(sec)), cy, lines);
    y1 = ((yrange - ybase) / 2) + ybase;

    ybase = MulDiv(line_getlinenr(section_getfirstline(other)) - 1, cy, lines);
    yrange = MulDiv(line_getlinenr(section_getlastline(other)), cy, lines);
    y2 = ((yrange - ybase) / 2) + ybase;

    /* horizontal layout constants are defined as percentages of the
     * window width
     */
    x1 = cx * (L_MATCH_START + L_MATCH_WIDTH) / 100;
    x2 = cx * R_UNMATCH_START / 100;

    MoveToEx(hdc, x1, y1, NULL);
    LineTo(hdc, x2, y2);
}

void DrawSection | ( | HDC | hdc,
 |  | int | cx,
 |  | int | cy,
 |  | int | lines,
 |  | SECTION | sec,
 |  | int | sidecode
 | ) |  |

Definition at line 406 of file bar.cpp.

{
    int x1, y1, x2, y2;
    HPEN hpenOld;
    HBRUSH hbrOld;

    /* calculate the vertical position from the scaling. the scaling
     * is such that the longest file just fits
     */
    y1 = MulDiv(line_getlinenr(section_getfirstline(sec))- 1, cy, lines);
    y2 = MulDiv(line_getlinenr(section_getlastline(sec)), cy, lines);

    /* left or right  - set bar position and width*/
    if (sidecode == STATE_LEFTONLY) {
        if (section_getlink(sec) != NULL) {
            x1 = L_MATCH_START;
            x2 = L_MATCH_WIDTH;
        } else {
            x1 = L_UNMATCH_START;
            x2 = L_UNMATCH_WIDTH;
        }
    } else {
        if (section_getlink(sec) != NULL) {
            x1 = R_MATCH_START;
            x2 = R_MATCH_WIDTH;
        } else {
            x1 = R_UNMATCH_START;
            x2 = R_UNMATCH_WIDTH;
        }
    }
    /* bar position defines are in percentages of the win width (cx) */
    x1 = cx * x1 / 100;
    x2 = (cx * x2 / 100) + x1;

    /* select pens and brushes */
    if (section_getlink(sec) != NULL) {
        hpenOld = (HPEN)SelectObject(hdc, hpenSame);
        hbrOld = (HBRUSH)SelectObject(hdc, hbrSame);
    } else if (sidecode == STATE_LEFTONLY) {
        hpenOld = (HPEN)SelectObject(hdc, hpenLeft);
        hbrOld = (HBRUSH)SelectObject(hdc, hbrLeft);
    } else {
        hpenOld = (HPEN)SelectObject(hdc, hpenRight);
        hbrOld = (HBRUSH)SelectObject(hdc, hbrRight);
    }

    /* draw the section as a coloured elongated rectangle */
    Rectangle(hdc, x1, y1, x2, y2);

    /* de-select the pen and brush in favour of the default */
    SelectObject(hdc, hpenOld);
    SelectObject(hdc, hbrOld);
}

BOOL InitBarClass ( HINSTANCE hInstance )

Definition at line 65 of file bar.cpp.

{
    WNDCLASS    wc;
    BOOL resp;

    wc.style = CS_HREDRAW | CS_VREDRAW;
    wc.lpfnWndProc = (WNDPROC)BarWndProc;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = 0;
    wc.hInstance = hInstance;
    wc.hIcon = NULL;
    wc.hCursor = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
    wc.lpszClassName = (LPSTR) "BarClass";
    wc.lpszMenuName = NULL;

    resp = RegisterClass(&wc);
    InitHashChars();

    return(resp);
}

void InitHashChars ( void )

Definition at line 397 of file bar.cpp.

{
    static char t[] = "Wjpgmkl%ejc%iewijvf\\vt\\Iytrjg#Kwomnrdse'oct'Yxlvekr.Dbxlix\nJwwdcuoiiyffl.anlk@Sugyi+Jhdrod\\nbs Jlxpz.Bqsrpr";
    s = t;
}

Variable Documentation

HBRUSH hbrLeft

Definition at line 54 of file bar.cpp.

HBRUSH hbrRight

Definition at line 54 of file bar.cpp.

HBRUSH hbrSame

Definition at line 54 of file bar.cpp.

HBRUSH hbrSideBar

Definition at line 55 of file bar.cpp.

HPEN hpenLeft

Definition at line 53 of file bar.cpp.

HPEN hpenRight

Definition at line 53 of file bar.cpp.

HPEN hpenSame

Definition at line 53 of file bar.cpp.

else s = 0

Definition at line 56 of file bar.cpp.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/sdkdiff/compitem.cpp File Reference

  • Begin
  • sdkdiff
Classes | Functions

compitem.cpp File Reference

#include "precomp.h"
#include "state.h"
#include "sdkdiff.h"
#include "wdiffrc.h"
#include "list.h"
#include "line.h"
#include "scandir.h"
#include "file.h"
#include "section.h"
#include "complist.h"
#include "view.h"
#include "compitem.h"

Go to the source code of this file.

Classes

struct | compitem

Functions

LPSTR | ci_AddTimeString (LPSTR in, COMPITEM ci, DIRITEM leftname, DIRITEM rightname)
void | ci_compare (COMPITEM ci)
LPSTR | ci_copytext (LPSTR in)
void | ci_makecomposite (COMPITEM ci)
LIST | ci_onesection (FILEDATA file)
void | compitem_delete (COMPITEM ci)
void | compitem_discardsections (COMPITEM ci)
void | compitem_freefilename (COMPITEM item, int option, LPSTR filename)
LIST | compitem_getcomposite (COMPITEM ci)
LPSTR | compitem_getfilename (VIEW view, COMPITEM item, int option)
FILEDATA | compitem_getleftfile (COMPITEM ci)
LIST | compitem_getleftsections (COMPITEM ci)
BOOL | compitem_getmark (COMPITEM item)
FILEDATA | compitem_getrightfile (COMPITEM ci)
LIST | compitem_getrightsections (COMPITEM ci)
int | compitem_getstate (COMPITEM ci)
LPSTR | compitem_gettext_result (COMPITEM ci)
LPSTR | compitem_gettext_tag (COMPITEM ci)
COMPITEM | compitem_new (DIRITEM leftname, DIRITEM rightname, LIST list, BOOL fExact)
void | compitem_rescan (COMPITEM ci)
LPSTR | compitem_savecomp (VIEW view, COMPITEM item, LPSTR savename, int compopts)
void | compitem_SetCopyPaths (LPSTR RightPath, LPSTR LeftPath)
void | compitem_setmark (COMPITEM item, BOOL bMark)
LPSTR | compitem_writefile (VIEW view, COMPITEM item, LPSTR savename, int compopts)
void | FindDelimiters (DIRITEM leftname, DIRITEM rightname, LPSTR delims)
BOOL | IsCName (DIRITEM di)
BOOL | IsDocName (DIRITEM di)
void | SetStateAndTag (COMPITEM ci, DIRITEM leftname, DIRITEM rightname, BOOL fExact)

Function Documentation

LPSTR ci_AddTimeString | ( | LPSTR | in,
 |  | COMPITEM | ci,
 |  | DIRITEM | leftname,
 |  | DIRITEM | rightname
 | ) |  |

Definition at line 815 of file compitem.cpp.

{
    FILETIME ftLeft;
    FILETIME ftRight;
    long rc;
    char buff[400] = {0};
    LPTSTR lpStr;

    HRESULT hr = StringCchCatN(buff, 400,in, sizeof(buff)-1);
  if (FAILED(hr)) {
    OutputError(hr, IDS_SAFE_CAT);
    return NULL;
  }

    ftLeft = file_GetTime(ci->left);
    ftRight = file_GetTime(ci->right);
    if ((ftLeft.dwLowDateTime || ftLeft.dwHighDateTime) &&
        (ftRight.dwLowDateTime || ftRight.dwHighDateTime))
    {
        rc = CompareFileTime(&ftLeft, &ftRight);

        if((lpStr = (LPSTR)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (lstrlen(in)+1)*sizeof(TCHAR))) == NULL)
            return NULL;
        hr = StringCchCopy(lpStr, (lstrlen(in)+1*sizeof(TCHAR)), in);
    if (FAILED(hr)) {
      OutputError(hr, IDS_SAFE_COPY);
      return NULL;
    }
        if (rc<0) {
            LPSTR str = dir_getrootdescription(dir_getlist(rightname));
            hr = StringCchPrintf(buff, 400, LoadRcString(IDS_IS_MORE_RECENT), lpStr, str);
      if (FAILED(hr)) {
        OutputError(hr, IDS_SAFE_PRINTF);
        return NULL;
      }
            dir_freerootdescription(dir_getlist(rightname), str);
        } else if (rc>0) {
            LPSTR str = dir_getrootdescription(dir_getlist(leftname));
            hr = StringCchPrintf(buff, 400, LoadRcString(IDS_IS_MORE_RECENT), lpStr, str);
      if (FAILED(hr)) {
        OutputError(hr, IDS_SAFE_PRINTF);
        return NULL;
      }
            dir_freerootdescription(dir_getlist(leftname), str);
    } else {
            hr = StringCchCat(buff, 400, LoadRcString(IDS_IDENTICAL_TIMES));
      if (FAILED(hr)) {
        OutputError(hr, IDS_SAFE_CAT);
        return NULL;
      }
    }
        HeapFree(GetProcessHeap(), NULL, lpStr);
    }

    return ci_copytext(buff);

} /* ci_AddTimeString */

void ci_compare ( COMPITEM ci )

Definition at line 1026 of file compitem.cpp.

{
    LIST lines_left, lines_right;
    SECTION whole_left, whole_right;
    BOOL bChanges;  /* loop control - we're still making more matches */
    BOOL bTryDups;  /* first try exact matches - then try matching non-unique ones too */
    extern BOOL Algorithm2;   /* declared in sdkdiff.cpp */
#ifdef trace
    DWORD Ticks;        /* time for profiling */
    DWORD StartTicks;   /* time for profiling */
#endif
    /* get the list of lines for each file */
    lines_left = file_getlinelist(ci->left);
    lines_right = file_getlinelist(ci->right);

    if ((lines_left == NULL) || (lines_right == NULL)) {
        ci->secs_left = NULL;
        ci->secs_right = NULL;
        ci->secs_composite = NULL;
        return;
    }

    bTryDups = FALSE;

#ifdef trace
    StartTicks = GetTickCount();
    Ticks = StartTicks;
#endif
    do {

        /* we have made no changes so far this time round the
         * loop
         */
        bChanges = FALSE;

        /* make a section covering the whole file */
        whole_left = section_new((LINE)List_First(lines_left),
                                 (LINE)List_Last(lines_left), NULL);

        whole_right = section_new((LINE)List_First(lines_right),
                                  (LINE)List_Last(lines_right), NULL);

        /* link up matching unique lines between these sections */
        if (section_match(whole_left, whole_right, bTryDups)) {
            bChanges = TRUE;
        }

        /* delete the two temp sections */
        section_delete(whole_left);
        section_delete(whole_right);

        /* discard previous section lists if made */
        if (ci->secs_left) {
            section_deletelist(ci->secs_left);
            ci->secs_left = NULL;
        }
        if (ci->secs_right) {
            section_deletelist(ci->secs_right);
            ci->secs_right = NULL;
        }
        /* build new section lists for both files */
        ci->secs_left = section_makelist(lines_left, TRUE);
        ci->secs_right = section_makelist(lines_right, FALSE);

        /* match up sections - make links and corresponds between
         * sections. Attempts to section_match corresponding
         * sections that are not matched. returns true if any
         * further links were made
         */
        if (section_matchlists(ci->secs_left, ci->secs_right, bTryDups)) {
            bChanges = TRUE;
        }

#ifdef trace
        /* profiling */
        {   char Msg[80];
            DWORD tks = GetTickCount();
            HRESULT hr = StringCchPrintf( Msg, 80, "ci_compare loop %ld, total %d %s %s \n"
                      , tks-Ticks, tks-StartTicks
                      , (bChanges ? "Changes," : "No changes,")
                      , (bTryDups ? "Was trying dups." : "Was not trying dups.")
                    );
      if (FAILED(hr)) {
        OutputError(hr, IDS_SAFE_PRINTF);
      }
            Trace_File(Msg);
            Ticks = GetTickCount();
            /* correct for time spent profiling */
            StartTicks = StartTicks+Ticks-tks;
        }
#endif

        /* repeat as long as we keep adding new links */
        if (bChanges) bTryDups = FALSE;
        else if ((bTryDups==FALSE) & Algorithm2) {bTryDups = TRUE;
            bChanges = TRUE;  // at least one more go
        }

    } while (bChanges);

    /* all possible lines linked, and section lists made .
     * combine the two section lists to get a view of the
     * whole comparison - the composite section list. This also
     * sets the state of each section in the composite list.
     */
#ifdef trace
    StartTicks = GetTickCount();
#endif
    ci->secs_composite = section_makecomposite(ci->secs_left, ci->secs_right);
#ifdef trace
    Ticks = GetTickCount()-StartTicks;
    {   char Msg[80];
        HRESULT hr = StringCchPrintf( Msg, 80, "section_makecomposite time = %d\n", Ticks);
    if (FAILED(hr)) {
      OutputError(hr, IDS_SAFE_PRINTF);
    }
        Trace_File(Msg);
    }
#endif
}

LPSTR ci_copytext ( LPSTR in )

Definition at line 793 of file compitem.cpp.

{
    LPSTR out;

    if (in == NULL) {
        out = (char*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 1);
    if (out == NULL)
      return NULL;
        out[0] = '\0';
    } else {
        out = (char*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, lstrlen(in) + 1);
    if (out == NULL)
      return NULL;
    HRESULT hr = StringCchCopy(out, (lstrlen(in)+1), in);
    if (FAILED(hr)) {
      OutputError(hr, IDS_SAFE_COPY);
      return NULL;
    }
    }
    return(out);
} /* ci_copytext */

void ci_makecomposite ( COMPITEM ci )

Definition at line 905 of file compitem.cpp.

{
    if (ci->secs_composite != NULL) {
        return;
    }

    readfile_setdelims((LPBYTE)ci->delims);

    /* if there is only one file, make a single item list
     * of sections
     */
    if (ci->left == NULL) {
        ci->secs_left = NULL;
        ci->secs_right = ci_onesection(ci->right);

        /* make a second list, not a pointer to the first
         * or we will get confused when deleting
         */
        ci->secs_composite = ci_onesection(ci->right);
        return;
    } else if (ci->right == NULL) {
        ci->secs_right = NULL;
        ci->secs_left = ci_onesection(ci->left);

        /* make a second list, not a pointer to the first
         * or we will get confused when deleting
         */
        ci->secs_composite = ci_onesection(ci->left);
        return;
    }

    /* we have two files - we need to compare them fully */
    ci_compare(ci);

    /* check if the composite list consists of one single section -
     * - if it does, and the files have a 'differ' state, then they
     * must differ in blanks only. Warn the user with a popup, and change
     * the tag text for the outline view. NB we should not need to
     * refresh the outline view since any action that gets this function
     * called will refresh the outline view anyway.
     */
    if (ci->state == STATE_DIFFER) {
        if (  (List_Card(ci->secs_composite) == 1)
              && (STATE_SAME==section_getstate((SECTION)List_First(ci->secs_composite)))
           ) {
            sdkdiff_UI(TRUE);
            MessageBox(hwndClient, LoadRcString(IDS_DIFF_BLANK_ONLY),
                       "Sdkdiff", MB_ICONINFORMATION|MB_OK);
            sdkdiff_UI(FALSE);

            if (ci->result != NULL) {
                HeapFree(GetProcessHeap(), NULL, ci->result);
                ci->result = NULL;
            }
            ci->result = ci_copytext(LoadRcString(IDS_DIFF_BLANK_ONLY));
        } else ci->state = STATE_DIFFER;  /* could be that blanks option has
                                             changed and it was blanks only
                                             differ which now counts as different
                                          */
    }
} /* ci_makecomposite */

LIST ci_onesection ( FILEDATA file )

Definition at line 878 of file compitem.cpp.

{
    LIST lines;
    LIST sections;
    SECTION section;

    lines = file_getlinelist(file);

    /* create a null list */
    sections = List_Create();

    /* tell the section to create itself on the end of this list. */
    section = section_new((LINE)List_First(lines), (LINE)List_Last(lines), sections);
    section_setstate(section, STATE_SAME);

    return(sections);
}

void compitem_delete ( COMPITEM ci )

Definition at line 235 of file compitem.cpp.

{
    if (ci == NULL) {
        return;
    }

    compitem_discardsections(ci);

    /* delete the two filedatas (and associated line lists) */
    file_delete(ci->left);
    file_delete(ci->right);

    /* text we allocated. */
    if (ci->tag!=NULL)
        HeapFree(GetProcessHeap(), NULL, ci->tag);
    if (ci->result!=NULL)
        HeapFree(GetProcessHeap(), NULL, ci->result);

    /* free the compitem struct itself if not alloced on a list */
    if (ci->bDiscard) {
        HeapFree(GetProcessHeap(), NULL, ci);
    }
}

void compitem_discardsections ( COMPITEM ci )

Definition at line 267 of file compitem.cpp.

{
    /* delete the lists of sections we built */
    if (ci == NULL) {
        return;
    }
    if (ci->secs_composite) {
        section_deletelist(ci->secs_composite);
        ci->secs_composite = NULL;
    }
    if (ci->secs_left) {
        section_deletelist(ci->secs_left);
        ci->secs_left = NULL;
    }
    if (ci->secs_right) {
        section_deletelist(ci->secs_right);
        ci->secs_right = NULL;
    }

    /* reset the line lists to throw away cached hash codes and links */
    if (ci->left != NULL) {
        file_reset(ci->left);
    }
    if (ci->right != NULL) {
        file_reset(ci->right);
    }
}

void compitem_freefilename | ( | COMPITEM | item,
 |  | int | option,
 |  | LPSTR | filename
 | ) |  |

Definition at line 643 of file compitem.cpp.

{
    if ((item == NULL) || (filename == NULL)) {
        return;
    }

    switch (option) {

        case CI_LEFT:
            dir_freeopenname(file_getdiritem(item->left), filename);
            break;

        case CI_RIGHT:
            dir_freeopenname(file_getdiritem(item->right), filename);
            break;

        case CI_COMP:

            /* this is a temporary file we created. Delete it. */
            DeleteFile(filename);

            HeapFree(GetProcessHeap(), NULL, filename);
            break;
    }
}

LIST compitem_getcomposite ( COMPITEM ci )

Definition at line 299 of file compitem.cpp.

{
    if (ci == NULL) {
        return NULL;
    }
    /*
     * do the comparison if we haven't already done it
     */
    if (ci->secs_composite == NULL) {
        ci_makecomposite(ci);
    }

    return(ci->secs_composite);
}

LPSTR compitem_getfilename | ( | VIEW | view,
 |  | COMPITEM | item,
 |  | int | option
 | ) |  |

Definition at line 414 of file compitem.cpp.

{
    LPSTR fname;

    if (item == NULL) {
        return(NULL);
    }

    switch (option) {
        case CI_LEFT:
            if (item->left != NULL) {
                return(dir_getopenname(file_getdiritem(item->left)));
            } else {
                return(NULL);
            }

        case CI_RIGHT:
            if (item->right != NULL) {
                return(dir_getopenname(file_getdiritem(item->right)));
            } else {
                return(NULL);
            }

        case CI_COMP:

            /* caller has asked for the filename of the composite file.
             * we need to create a temporary file and write the
             * lines in the composite section list out to it.
             */
            fname = (char*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, MAX_PATH);
            if (fname == NULL)
        return NULL;
      GetTempPath(MAX_PATH, fname);
            GetTempFileName(fname, "wdf", 0, fname);

            /* write out the temp file and return the result */
            compitem_savecomp(view, item, fname, expand_include);
            return fname;

        default:
            TRACE_ERROR(LoadRcString(IDS_BAD_ARGUMENT), FALSE);
            return(NULL);
    }
}

FILEDATA compitem_getleftfile ( COMPITEM ci )

Definition at line 350 of file compitem.cpp.

{
    if (ci == NULL) {
        return(NULL);
    }
    return(ci->left);
}

LIST compitem_getleftsections ( COMPITEM ci )

Definition at line 316 of file compitem.cpp.

{
    if (ci == NULL) {
        return NULL;
    }
    /*
     * do the comparison if we haven't already done it
     */
    if (ci->secs_composite == NULL) {
        ci_makecomposite(ci);
    }

    return(ci->secs_left);
}

BOOL compitem_getmark ( COMPITEM item )

Definition at line 687 of file compitem.cpp.

{
    if (item == NULL) {
        return(FALSE);
    } else {
        return(item->bMarked);
    }
}

FILEDATA compitem_getrightfile ( COMPITEM ci )

Definition at line 360 of file compitem.cpp.

{
    if (ci == NULL) {
        return(NULL);
    }
    return(ci->right);
}

LIST compitem_getrightsections ( COMPITEM ci )

Definition at line 333 of file compitem.cpp.

{
    if (ci == NULL) {
        return NULL;
    }
    /*
     * do the comparison if we haven't already done it
     */
    if (ci->secs_composite == NULL) {
        ci_makecomposite(ci);
    }

    return(ci->secs_right);
}

int compitem_getstate ( COMPITEM ci )

Definition at line 370 of file compitem.cpp.

{
    if (ci == NULL) {
        return(0);
    }
    return(ci->state);
}

LPSTR compitem_gettext_result ( COMPITEM ci )

Definition at line 390 of file compitem.cpp.

{
    if (ci == NULL) {
        return(NULL);
    }
    return(ci->result);
}

LPSTR compitem_gettext_tag ( COMPITEM ci )

Definition at line 380 of file compitem.cpp.

{
    if (ci == NULL) {
        return(NULL);
    }
    return(ci->tag);
}

COMPITEM compitem_new | ( | DIRITEM | leftname,
 |  | DIRITEM | rightname,
 |  | LIST | list,
 |  | BOOL | fExact
 | ) |  |

Definition at line 105 of file compitem.cpp.

{
    COMPITEM ci;

    /*
     * allocate the memory for the compitem, either at the end of the
     * list or using HeapAlloc.
     */
    if (list == NULL)
    {
        /* no list passed */
        ci = (COMPITEM) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct compitem));
        if (!ci)
            return NULL;
        ci->bDiscard = TRUE;
    }
    else
    {
        /* add to end of list */
        ci = (COMPITEM) List_NewLast(list, sizeof(struct compitem));
        if (!ci)
            return NULL;
        ci->bDiscard = FALSE;
    }

    ci->secs_composite = NULL;
    ci->secs_left = NULL;
    ci->secs_right = NULL;

    FindDelimiters(leftname, rightname, ci->delims);

    /*
     * make a filedata for each of the files that are non-null.
     * filedata objects are responsible for reading the file and
     * accessing the lines in it. Don't read in the files until we need to.
     */
    if (leftname != NULL) {
        ci->left = file_new(leftname, FALSE);
        if (ci->left == NULL) {
            return(NULL);
        }
    } else {
        ci->left = NULL;
    }
    if ( rightname != NULL) {
        ci->right = file_new(rightname, FALSE);
        if (ci->right == NULL) {
            return(NULL);
        }
    } else {
        ci->right = NULL;
    }

    /*
     * see if we have one or two files, and set the state accordingly
     */
    if ( ! ci->left && !ci->right) {
        /* two NULL files - this is wrong */
        return(NULL);
    }

    SetStateAndTag(ci, leftname, rightname, fExact);

    if ( ((ci->state == STATE_DIFFER) && !TrackDifferent) ||
         ((ci->state == STATE_SAME)   && !TrackSame)      ) {
        if ( ci->right != NULL ) {
            file_delete( ci->right );
        }
        if ( ci->left != NULL ) {
            file_delete( ci->left );
        }
        if ( list == NULL ) {
           HeapFree(GetProcessHeap(), NULL, (LPSTR)ci);
        } else {
            List_Delete( ci );
        }
    }

    /*
     * building the section lists and composite lists can wait
     * until needed.
     */
    return(ci);
} /* compitem_new */

void compitem_rescan ( COMPITEM ci )

Definition at line 197 of file compitem.cpp.

{
    DIRITEM diLeft, diRight;

    /*
       The way we get from a ci to the info we
       need is ci->filedata->diritem->direct->dirlist->hpipe.
       We let scandir do the work.
    */

    diLeft = file_getdiritem(ci->left);
    diRight = file_getdiritem(ci->right);

    dir_rescanfile(diLeft);
    dir_rescanfile(diRight);

    if (ci->result != NULL) {
        HeapFree(GetProcessHeap(), NULL, ci->result);
        ci->result = NULL;
    }

    SetStateAndTag( ci, diLeft, diRight, TRUE);
} /* compitem_rescan */

LPSTR compitem_savecomp | ( | VIEW | view,
 |  | COMPITEM | item,
 |  | LPSTR | savename,
 |  | int | compopts
 | ) |  |

Definition at line 466 of file compitem.cpp.

{
  char    fname[2*MAX_PATH + 1];
  HCURSOR   hcurs;

  if (item == NULL) {
    return NULL;
  }

  if (savename == NULL) {
    /* Ask for the filename - using gfile standard dialogs */
    savename = fname;
    if (!gfile_open(hwndClient, LoadRcString(IDS_SAVE_COMPFILE), ".txt", "*.txt", NULL, 0, savename)) {
      return NULL;
    }
  }
  else {
    HRESULT hr = StringCchCopy(fname, (2*MAX_PATH+1), savename);
    if (FAILED(hr)) {
      OutputError(hr, IDS_SAFE_COPY);
      return NULL;
    }
    GetFullPathName(savename, 2*MAX_PATH + 1, fname, NULL);
    savename = fname;
  }

  /* Write to file */
  hcurs = SetCursor(LoadCursor(NULL, IDC_WAIT));
  if (!compitem_writefile(view, item, savename, compopts)) {
    return NULL;
  }

  /* Return filename */
  SetCursor(hcurs);
  return savename;
}

void compitem_SetCopyPaths | ( | LPSTR | RightPath,
 |  | LPSTR | LeftPath
 | ) |  |

Definition at line 754 of file compitem.cpp.

{
    HRESULT hr = StringCchCopy(LeftRoot, MAX_PATH, LeftPath);
  if (FAILED(hr)) {
    OutputError(hr, IDS_SAFE_COPY);
  }
    hr = StringCchCopy(RightRoot, MAX_PATH, RightPath);
  if (FAILED(hr)) {
    OutputError(hr, IDS_SAFE_COPY);
  }

} /* compitem_SetCopyPaths */

void compitem_setmark | ( | COMPITEM | item,
 |  | BOOL | bMark
 | ) |  |

Definition at line 675 of file compitem.cpp.

{
    if (item == NULL) {
        return;
    }

    item->bMarked = bMark;
}

LPSTR compitem_writefile | ( | VIEW | view,
 |  | COMPITEM | item,
 |  | LPSTR | savename,
 |  | int | compopts
 | ) |  |

Definition at line 510 of file compitem.cpp.

{
  HANDLE    fh;
  SECTION   sec;
  LINE    line;
  COMPLIST  list;
  LPSTR   lhead;
  LPSTR   tag, text;
  char    msg[2*MAX_PATH+100];
  UINT    linecount = 0;
    DWORD       cbWritten;

  /* Return immediately if no file name or item */
  if (!savename || !*savename || !item) {
    return NULL;
  }

  /* Try to open the file */
  fh = CreateFile(savename, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, 0, NULL);
  if (fh == INVALID_HANDLE_VALUE) {
    HRESULT hr = StringCchPrintf(msg, (2*MAX_PATH+100),"Cannot open %s", savename);
    if (FAILED(hr)) {
      OutputError(hr, IDS_SAFE_PRINTF);
      return NULL;
    }
    sdkdiff_UI(TRUE);
    MessageBox(hwndClient, msg, "Sdkdiff", MB_ICONSTOP|MB_OK);
    sdkdiff_UI(FALSE);
    return NULL;
  }

  /* Make sure the composite list has been built */
  if (item->secs_composite == NULL) {
    ci_makecomposite(item);
  }

  /* write out the header line */
  list = view_getcomplist(view);
  lhead = complist_getdescription(list);
  HRESULT hr = StringCchPrintf(msg, (2*MAX_PATH+100), "-- %s -- %s -- includes %s%s%s%s%s lines\r\n",
       lhead,
       item->tag,
       (LPSTR) ((compopts & INCLUDE_SAME) ? "identical," : ""),
       (LPSTR) ((compopts & INCLUDE_LEFTONLY) ? "left-only," : ""),
       (LPSTR) ((compopts & INCLUDE_RIGHTONLY) ? "right-only," : ""),
       (LPSTR) ((compopts & INCLUDE_MOVEDLEFT) ? "moved-left," : ""),
       (LPSTR) ((compopts & INCLUDE_MOVEDRIGHT) ? "moved-right" : "") );
  if (FAILED(hr)) {
    OutputError(hr, IDS_SAFE_PRINTF);
    return NULL;
  }
  WriteFile(fh, msg, lstrlen(msg), &cbWritten, NULL);
  complist_freedescription(list, lhead);

  /* Write out every line in every section on the composite
   * list to the temp file.
   */
    for( sec=(SECTION)List_First(item->secs_composite);  sec!=NULL;  sec = (SECTION)List_Next((LPVOID)sec)) {
    tag = "    ";  /* avoid strange diagnostic */
    /* get the tag field based on the section state*/
    switch(section_getstate(sec)) {

    case STATE_SAME:
      if (!(compopts & INCLUDE_SAME))
        continue;
      tag = "    ";
      break;

    case STATE_LEFTONLY:
    case STATE_SIMILARLEFT:
      if (!(compopts & INCLUDE_LEFTONLY))
        continue;
      tag = " <! ";
      break;
    case STATE_RIGHTONLY:
    case STATE_SIMILARRIGHT:
      if (!(compopts & INCLUDE_RIGHTONLY))
        continue;
      tag = " !> ";
      break;

    case STATE_MOVEDLEFT:
      if (!(compopts & INCLUDE_MOVEDLEFT))
        continue;
      tag = " <- ";
      break;

    case STATE_MOVEDRIGHT:
      if (!(compopts & INCLUDE_MOVEDRIGHT))
        continue;
      tag = " -> ";
      break;
    }

    /* write out each line in this section.
     * non-standard traverse of list as we only
     * want to go from section first to section last
     * inclusive.
     */
    for (line = section_getfirstline(sec); line != NULL; line = (LINE)List_Next(line)) {
      /* write out to file */
      text = line_gettext(line);
      WriteFile(fh, tag, lstrlen(tag), &cbWritten, NULL);
      WriteFile(fh, text, lstrlen(text), &cbWritten, NULL);
      ++linecount;

      if (line == section_getlastline(sec))
        break;
    }
  }

  /* Write the footer */
  hr = StringCchPrintf(msg, (2*MAX_PATH+100),"-- %u lines listed\r\n", linecount);
  if (FAILED(hr)) {
    OutputError(hr, IDS_SAFE_PRINTF);
    return NULL;
  }
  WriteFile(fh, msg, lstrlen(msg), &cbWritten, NULL);

  /* Close the file and return */
  CloseHandle(fh);
  return savename;
}

void FindDelimiters | ( | DIRITEM | leftname,
 |  | DIRITEM | rightname,
 |  | LPSTR | delims
 | ) |  |

Definition at line 768 of file compitem.cpp.

{
    extern BOOL gbPerverseCompare; // in sdkdiff.c
  HRESULT hr;

  if (gbPerverseCompare) {
    hr = StringCchCopy(delims, 64, ".!?;\n");
    if (FAILED(hr))
      OutputError(hr, IDS_SAFE_COPY);
  }
  else { /* default - guess */
        hr = StringCchCopy(delims, 64, "\n");
    if (FAILED(hr))
      OutputError(hr, IDS_SAFE_COPY);
  }

} /* FindDelimiters */

BOOL IsCName ( DIRITEM di )

Definition at line 723 of file compitem.cpp.

{
    BOOL bRet = FALSE;   /* default to not a "C" type */
    LPSTR name = dir_getrelname(di);
    LPSTR ext;                                   /* extension part of name */

    if (name!=NULL) {                          /* there is a name */

        ext = My_mbsrchr(name, '.');
        if (ext!=NULL) {                      /* there is a dot in the name */

            ++ext;                            /* skip past the dot */
            if (  (0==lstrcmp(ext,"c"))
                  || (0==lstrcmp(ext,"h"))
                  || (0==lstrcmp(ext,"cxx"))
                  || (0==lstrcmp(ext,"hxx"))
                  || (0==lstrcmp(ext,"cpp"))
                  || (0==lstrcmp(ext,"hpp"))
               )
                bRet = TRUE;                /*  "C" type */
        }
    }

    if (name!=NULL) dir_freerelname(di, name);
    return bRet;
} /* IsDocName */

BOOL IsDocName ( DIRITEM di )

Definition at line 700 of file compitem.cpp.

{
    BOOL bRet = FALSE;
    LPSTR name = dir_getrelname(di);
    LPSTR ext;                                   /* extension part of name */
    if (name!=NULL) {                            /* there is a name */
        ext = My_mbsrchr(name, '.');
        if (ext!=NULL) {                        /* there is a dot in name */
            ++ext;                              /* skip past the dot */
            if (   (0==lstrcmp(ext,"doc"))      /* N.B depends on name being lower case */
                   ||  (0==lstrcmp(ext,"txt"))
                   ||  (0==lstrcmp(ext,"rtf"))
               )
                bRet = TRUE;                /* doc type */
        }

    }

    if (name!=NULL) dir_freerelname(di, name);
    return bRet;
} /* IsDocName */

void SetStateAndTag | ( | COMPITEM | ci,
 |  | DIRITEM | leftname,
 |  | DIRITEM | rightname,
 |  | BOOL | fExact
 | ) |  |

Definition at line 1149 of file compitem.cpp.

{
    /* set the tag (title field) for this item. if the
     * two files have names that match, we use just that name -
     * otherwise we use both names separated by a colon 'left : right'.
     *
     * in both cases, use the names relative to compare root (the
     * names will certainly be different if we compare the abs paths)
     */
    LPSTR str1 = dir_getrelname(leftname);
    LPSTR str2 = dir_getrelname(rightname);
    char buf[2*MAX_PATH+20];
    TCHAR tmpbuf[MAX_PATH];
  HRESULT hr;

    /* if only one file - set name to that */
    if (ci->left == NULL) {
        ci->tag = ci_copytext(str2);
    } else if (ci->right == NULL) {
        ci->tag = ci_copytext(str1);
    } else {
        if (lstrcmpi(str1, str2) == 0) {
            ci->tag = ci_copytext(str2);
        } else {
            hr = StringCchPrintf(buf, (2*MAX_PATH+20), "%s : %s", str1, str2);
      if (FAILED(hr))
        OutputError(hr, IDS_SAFE_PRINTF);
            ci->tag = ci_copytext(buf);
        }
    }

    dir_freerelname(leftname, str1);
    dir_freerelname(rightname, str2);

    if (ci->left == NULL) {

        BOOL Readable = TRUE;
        // At this point we COULD try to set Readable but we would need
        // to do a rescan to ensure that sumvalid and fileerror are set.
        // where the file is only found on one side or the other, in the
        // interests of speed we have NOT TRIED to read the file.

        str1 = dir_getrootdescription(dir_getlist(rightname));
        hr = StringCchCopy(tmpbuf, MAX_PATH, (Readable ? TEXT("") : LoadRcString(IDS_UNREADABLE)));
    if (FAILED(hr))
      OutputError(hr, IDS_SAFE_COPY);
        hr = StringCchPrintf(buf, (2*MAX_PATH+20), LoadRcString(IDS_ONLY_IN), str1, tmpbuf);
    if (FAILED(hr))
      OutputError(hr, IDS_SAFE_PRINTF);
        dir_freerootdescription(dir_getlist(rightname), str1);

        ci->result = ci_copytext(buf);
        ci->state = STATE_FILERIGHTONLY;
    } else if (ci->right == NULL) {

        BOOL Readable = TRUE;        // See above

        str1 = dir_getrootdescription(dir_getlist(leftname));
        hr = StringCchCopy(tmpbuf, MAX_PATH, (Readable ? TEXT("") : LoadRcString(IDS_UNREADABLE)));
        if (FAILED(hr))
      OutputError(hr, IDS_SAFE_COPY);
    hr = StringCchPrintf(buf, (2*MAX_PATH+20), LoadRcString(IDS_ONLY_IN), str1, tmpbuf);
        if (FAILED(hr))
      OutputError(hr, IDS_SAFE_PRINTF);
    dir_freerootdescription(dir_getlist(leftname), str1);

        ci->result = ci_copytext(buf);
        ci->state = STATE_FILELEFTONLY;
    } else {
        /* two files - are they the same ? compare
         * the file sizes, and if necessary, checksums.
         * if the sizes differ, we don't need to checksum.
         */

        // if there is some error in the file, we can mark them
        // as differs and set the text to indicate that one or
        // both is unreadable.
        if (dir_fileerror(leftname)) {
            ci->state = STATE_DIFFER;
            if (dir_fileerror(rightname)) {
                ci->result = ci_copytext(LoadRcString(IDS_BOTH_UNREADABLE));
            } else {
                ci->result = ci_copytext(LoadRcString(IDS_LEFT_UNREADABLE));
            }
        } else if (dir_fileerror(rightname)) {
            ci->state = STATE_DIFFER;
            ci->result = ci_copytext(LoadRcString(IDS_RIGHT_UNREADABLE));
        }

        /* Subtle side-effects below us:
           dir_validchecksum merely tells us whether we have YET got a valid
           checksum for the file, NOT whether one is available if we tried.
           If !fExact then we don't WANT them, so we don't ask.
           If fExact then we must FIRST ask for the checksum and only after
           that enquire if one is valid.  (file read errors etc will mean that
           it is NOT valid).  dir_getchecksum has side effect of evaluating it
           if needed.  If it's by chance available, then we should use it, even
           if exact matching is not in operation.

           Where files differ we report which is earliest in time.

           The logic is as follows
                 sizes equal
               N     ?                  Y
                     |          both-sums-known
            differ   |          Y       ?      N
          (different |      sums-equal  |   exact
             sizes)  |     Y    ?  N    |  N  ?          Y
                     | identical|differ | same|   right-sum-valid
                     |          |       | size|  N   ?      Y
                     |          |       |     |right |  left-sum-valid
                     |          |       |     |un-   | N    ?      Y
                     |          |       |     |read- |left  |  sums-match
                     |          |       |     |able  |un-   |  N   ?   Y
                     |          |       |     |      |read- |differ|identical
                     |          |       |     |      |able  |      |
        */

        else if (dir_getfilesize(leftname) != dir_getfilesize(rightname)) {
            ci->state = STATE_DIFFER;
            ci->result = ci_AddTimeString(LoadRcString(IDS_DIFFERENT), ci, leftname, rightname);
        } else if (dir_validchecksum(leftname) && dir_validchecksum(rightname)) {
            if (dir_getchecksum(leftname) == dir_getchecksum(rightname)) {
                ci->result =  ci_copytext(LoadRcString(IDS_IDENTICAL));
                ci->state = STATE_SAME;
            } else {
                ci->result = ci_AddTimeString(LoadRcString(IDS_DIFFERENT), ci, leftname, rightname);
                ci->state = STATE_DIFFER;
            }
        } else if (!fExact) {
            ci->result = ci_AddTimeString(LoadRcString(IDS_SAME_SIZE), ci, leftname, rightname);
            ci->state = STATE_SAME;
        } else {
            DWORD LSum = dir_getchecksum(leftname);
            DWORD RSum = dir_getchecksum(rightname);

            if (!dir_validchecksum(rightname) ) {
                if (!dir_validchecksum(leftname) ) {
                    ci->result = ci_AddTimeString(LoadRcString(IDS_BOTH_UNREADABLE), ci, leftname, rightname);
                    ci->state = STATE_DIFFER;
                } else {
                    ci->result = ci_AddTimeString(LoadRcString(IDS_RIGHT_UNREADABLE), ci, leftname, rightname);
                    ci->state = STATE_DIFFER;
                }
            } else if (!dir_validchecksum(leftname) ) {
                ci->result = ci_AddTimeString(LoadRcString(IDS_LEFT_UNREADABLE), ci, leftname, rightname);
                ci->state = STATE_DIFFER;
            } else if (LSum!=RSum) {
                ci->result = ci_AddTimeString(LoadRcString(IDS_DIFFERENT), ci, leftname, rightname);
                ci->state = STATE_DIFFER;
            } else {
                ci->result =  ci_copytext(LoadRcString(IDS_IDENTICAL));
                ci->state = STATE_SAME;
            }
        }
    }
} /* SetStateAndTag */

Generated on Wed Nov 13 2024 16:53:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/sdkdiff/compitem.h File Reference

  • Begin
  • sdkdiff
Defines | Typedefs | Functions

compitem.h File Reference

Go to the source code of this file.

Defines

#define | CI_COMP 3
#define | CI_LEFT 1
#define | CI_RIGHT 2
#define | INC_VIEW_COMPLIST

Typedefs

typedef struct compitem FAR * | COMPITEM
typedef struct complist FAR * | COMPLIST
typedef struct view FAR * | VIEW

Functions

void | compitem_delete (COMPITEM item)
void | compitem_discardsections (COMPITEM item)
void | compitem_freefilename (COMPITEM item, int option, LPSTR filename)
LIST | compitem_getcomposite (COMPITEM item)
LPSTR | compitem_getfilename (VIEW view, COMPITEM item, int option)
FILEDATA | compitem_getleftfile (COMPITEM item)
LIST | compitem_getleftsections (COMPITEM item)
BOOL | compitem_getmark (COMPITEM item)
FILEDATA | compitem_getrightfile (COMPITEM item)
LIST | compitem_getrightsections (COMPITEM item)
int | compitem_getstate (COMPITEM item)
LPSTR | compitem_gettext_result (COMPITEM item)
LPSTR | compitem_gettext_tag (COMPITEM item)
COMPITEM | compitem_new (DIRITEM left, DIRITEM right, LIST list, BOOL fExact)
void | compitem_rescan (COMPITEM ci)
LPSTR | compitem_savecomp (VIEW view, COMPITEM ci, LPSTR savename, int listopts)
void | compitem_SetCopyPaths (LPSTR LeftPath, LPSTR RightPath)
void | compitem_setmark (COMPITEM item, BOOL bMark)
LPSTR | compitem_writefile (VIEW view, COMPITEM ci, LPSTR savename, int compopts)

Define Documentation

#define CI_COMP 3

Definition at line 124 of file compitem.h.

#define CI_LEFT 1

Definition at line 122 of file compitem.h.

#define CI_RIGHT 2

Definition at line 123 of file compitem.h.

#define INC_VIEW_COMPLIST

Definition at line 31 of file compitem.h.

Typedef Documentation

typedef struct compitem FAR* COMPITEM

Definition at line 32 of file compitem.h.

typedef struct complist FAR* COMPLIST

Definition at line 34 of file compitem.h.

typedef struct view FAR* VIEW

Definition at line 33 of file compitem.h.

Function Documentation

void compitem_delete ( COMPITEM item )

Definition at line 235 of file compitem.cpp.

{
    if (ci == NULL) {
        return;
    }

    compitem_discardsections(ci);

    /* delete the two filedatas (and associated line lists) */
    file_delete(ci->left);
    file_delete(ci->right);

    /* text we allocated. */
    if (ci->tag!=NULL)
        HeapFree(GetProcessHeap(), NULL, ci->tag);
    if (ci->result!=NULL)
        HeapFree(GetProcessHeap(), NULL, ci->result);

    /* free the compitem struct itself if not alloced on a list */
    if (ci->bDiscard) {
        HeapFree(GetProcessHeap(), NULL, ci);
    }
}

void compitem_discardsections ( COMPITEM item )

Definition at line 267 of file compitem.cpp.

{
    /* delete the lists of sections we built */
    if (ci == NULL) {
        return;
    }
    if (ci->secs_composite) {
        section_deletelist(ci->secs_composite);
        ci->secs_composite = NULL;
    }
    if (ci->secs_left) {
        section_deletelist(ci->secs_left);
        ci->secs_left = NULL;
    }
    if (ci->secs_right) {
        section_deletelist(ci->secs_right);
        ci->secs_right = NULL;
    }

    /* reset the line lists to throw away cached hash codes and links */
    if (ci->left != NULL) {
        file_reset(ci->left);
    }
    if (ci->right != NULL) {
        file_reset(ci->right);
    }
}

void compitem_freefilename | ( | COMPITEM | item,
 |  | int | option,
 |  | LPSTR | filename
 | ) |  |

Definition at line 643 of file compitem.cpp.

{
    if ((item == NULL) || (filename == NULL)) {
        return;
    }

    switch (option) {

        case CI_LEFT:
            dir_freeopenname(file_getdiritem(item->left), filename);
            break;

        case CI_RIGHT:
            dir_freeopenname(file_getdiritem(item->right), filename);
            break;

        case CI_COMP:

            /* this is a temporary file we created. Delete it. */
            DeleteFile(filename);

            HeapFree(GetProcessHeap(), NULL, filename);
            break;
    }
}

LIST compitem_getcomposite ( COMPITEM item )

Definition at line 299 of file compitem.cpp.

{
    if (ci == NULL) {
        return NULL;
    }
    /*
     * do the comparison if we haven't already done it
     */
    if (ci->secs_composite == NULL) {
        ci_makecomposite(ci);
    }

    return(ci->secs_composite);
}

LPSTR compitem_getfilename | ( | VIEW | view,
 |  | COMPITEM | item,
 |  | int | option
 | ) |  |

Definition at line 414 of file compitem.cpp.

{
    LPSTR fname;

    if (item == NULL) {
        return(NULL);
    }

    switch (option) {
        case CI_LEFT:
            if (item->left != NULL) {
                return(dir_getopenname(file_getdiritem(item->left)));
            } else {
                return(NULL);
            }

        case CI_RIGHT:
            if (item->right != NULL) {
                return(dir_getopenname(file_getdiritem(item->right)));
            } else {
                return(NULL);
            }

        case CI_COMP:

            /* caller has asked for the filename of the composite file.
             * we need to create a temporary file and write the
             * lines in the composite section list out to it.
             */
            fname = (char*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, MAX_PATH);
            if (fname == NULL)
        return NULL;
      GetTempPath(MAX_PATH, fname);
            GetTempFileName(fname, "wdf", 0, fname);

            /* write out the temp file and return the result */
            compitem_savecomp(view, item, fname, expand_include);
            return fname;

        default:
            TRACE_ERROR(LoadRcString(IDS_BAD_ARGUMENT), FALSE);
            return(NULL);
    }
}

FILEDATA compitem_getleftfile ( COMPITEM item )

Definition at line 350 of file compitem.cpp.

{
    if (ci == NULL) {
        return(NULL);
    }
    return(ci->left);
}

LIST compitem_getleftsections ( COMPITEM item )

Definition at line 316 of file compitem.cpp.

{
    if (ci == NULL) {
        return NULL;
    }
    /*
     * do the comparison if we haven't already done it
     */
    if (ci->secs_composite == NULL) {
        ci_makecomposite(ci);
    }

    return(ci->secs_left);
}

BOOL compitem_getmark ( COMPITEM item )

Definition at line 687 of file compitem.cpp.

{
    if (item == NULL) {
        return(FALSE);
    } else {
        return(item->bMarked);
    }
}

FILEDATA compitem_getrightfile ( COMPITEM item )

Definition at line 360 of file compitem.cpp.

{
    if (ci == NULL) {
        return(NULL);
    }
    return(ci->right);
}

LIST compitem_getrightsections ( COMPITEM item )

Definition at line 333 of file compitem.cpp.

{
    if (ci == NULL) {
        return NULL;
    }
    /*
     * do the comparison if we haven't already done it
     */
    if (ci->secs_composite == NULL) {
        ci_makecomposite(ci);
    }

    return(ci->secs_right);
}

int compitem_getstate ( COMPITEM item )

Definition at line 370 of file compitem.cpp.

{
    if (ci == NULL) {
        return(0);
    }
    return(ci->state);
}

LPSTR compitem_gettext_result ( COMPITEM item )

Definition at line 390 of file compitem.cpp.

{
    if (ci == NULL) {
        return(NULL);
    }
    return(ci->result);
}

LPSTR compitem_gettext_tag ( COMPITEM item )

Definition at line 380 of file compitem.cpp.

{
    if (ci == NULL) {
        return(NULL);
    }
    return(ci->tag);
}

COMPITEM compitem_new | ( | DIRITEM | left,
 |  | DIRITEM | right,
 |  | LIST | list,
 |  | BOOL | fExact
 | ) |  |

Definition at line 105 of file compitem.cpp.

{
    COMPITEM ci;

    /*
     * allocate the memory for the compitem, either at the end of the
     * list or using HeapAlloc.
     */
    if (list == NULL)
    {
        /* no list passed */
        ci = (COMPITEM) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct compitem));
        if (!ci)
            return NULL;
        ci->bDiscard = TRUE;
    }
    else
    {
        /* add to end of list */
        ci = (COMPITEM) List_NewLast(list, sizeof(struct compitem));
        if (!ci)
            return NULL;
        ci->bDiscard = FALSE;
    }

    ci->secs_composite = NULL;
    ci->secs_left = NULL;
    ci->secs_right = NULL;

    FindDelimiters(leftname, rightname, ci->delims);

    /*
     * make a filedata for each of the files that are non-null.
     * filedata objects are responsible for reading the file and
     * accessing the lines in it. Don't read in the files until we need to.
     */
    if (leftname != NULL) {
        ci->left = file_new(leftname, FALSE);
        if (ci->left == NULL) {
            return(NULL);
        }
    } else {
        ci->left = NULL;
    }
    if ( rightname != NULL) {
        ci->right = file_new(rightname, FALSE);
        if (ci->right == NULL) {
            return(NULL);
        }
    } else {
        ci->right = NULL;
    }

    /*
     * see if we have one or two files, and set the state accordingly
     */
    if ( ! ci->left && !ci->right) {
        /* two NULL files - this is wrong */
        return(NULL);
    }

    SetStateAndTag(ci, leftname, rightname, fExact);

    if ( ((ci->state == STATE_DIFFER) && !TrackDifferent) ||
         ((ci->state == STATE_SAME)   && !TrackSame)      ) {
        if ( ci->right != NULL ) {
            file_delete( ci->right );
        }
        if ( ci->left != NULL ) {
            file_delete( ci->left );
        }
        if ( list == NULL ) {
           HeapFree(GetProcessHeap(), NULL, (LPSTR)ci);
        } else {
            List_Delete( ci );
        }
    }

    /*
     * building the section lists and composite lists can wait
     * until needed.
     */
    return(ci);
} /* compitem_new */

void compitem_rescan ( COMPITEM ci )

Definition at line 197 of file compitem.cpp.

{
    DIRITEM diLeft, diRight;

    /*
       The way we get from a ci to the info we
       need is ci->filedata->diritem->direct->dirlist->hpipe.
       We let scandir do the work.
    */

    diLeft = file_getdiritem(ci->left);
    diRight = file_getdiritem(ci->right);

    dir_rescanfile(diLeft);
    dir_rescanfile(diRight);

    if (ci->result != NULL) {
        HeapFree(GetProcessHeap(), NULL, ci->result);
        ci->result = NULL;
    }

    SetStateAndTag( ci, diLeft, diRight, TRUE);
} /* compitem_rescan */

LPSTR compitem_savecomp | ( | VIEW | view,
 |  | COMPITEM | ci,
 |  | LPSTR | savename,
 |  | int | listopts
 | ) |  |

Definition at line 466 of file compitem.cpp.

{
  char    fname[2*MAX_PATH + 1];
  HCURSOR   hcurs;

  if (item == NULL) {
    return NULL;
  }

  if (savename == NULL) {
    /* Ask for the filename - using gfile standard dialogs */
    savename = fname;
    if (!gfile_open(hwndClient, LoadRcString(IDS_SAVE_COMPFILE), ".txt", "*.txt", NULL, 0, savename)) {
      return NULL;
    }
  }
  else {
    HRESULT hr = StringCchCopy(fname, (2*MAX_PATH+1), savename);
    if (FAILED(hr)) {
      OutputError(hr, IDS_SAFE_COPY);
      return NULL;
    }
    GetFullPathName(savename, 2*MAX_PATH + 1, fname, NULL);
    savename = fname;
  }

  /* Write to file */
  hcurs = SetCursor(LoadCursor(NULL, IDC_WAIT));
  if (!compitem_writefile(view, item, savename, compopts)) {
    return NULL;
  }

  /* Return filename */
  SetCursor(hcurs);
  return savename;
}

void compitem_SetCopyPaths | ( | LPSTR | LeftPath,
 |  | LPSTR | RightPath
 | ) |  |

Definition at line 754 of file compitem.cpp.

{
    HRESULT hr = StringCchCopy(LeftRoot, MAX_PATH, LeftPath);
  if (FAILED(hr)) {
    OutputError(hr, IDS_SAFE_COPY);
  }
    hr = StringCchCopy(RightRoot, MAX_PATH, RightPath);
  if (FAILED(hr)) {
    OutputError(hr, IDS_SAFE_COPY);
  }

} /* compitem_SetCopyPaths */

void compitem_setmark | ( | COMPITEM | item,
 |  | BOOL | bMark
 | ) |  |

Definition at line 675 of file compitem.cpp.

{
    if (item == NULL) {
        return;
    }

    item->bMarked = bMark;
}

LPSTR compitem_writefile | ( | VIEW | view,
 |  | COMPITEM | ci,
 |  | LPSTR | savename,
 |  | int | compopts
 | ) |  |

Definition at line 510 of file compitem.cpp.

{
  HANDLE    fh;
  SECTION   sec;
  LINE    line;
  COMPLIST  list;
  LPSTR   lhead;
  LPSTR   tag, text;
  char    msg[2*MAX_PATH+100];
  UINT    linecount = 0;
    DWORD       cbWritten;

  /* Return immediately if no file name or item */
  if (!savename || !*savename || !item) {
    return NULL;
  }

  /* Try to open the file */
  fh = CreateFile(savename, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, 0, NULL);
  if (fh == INVALID_HANDLE_VALUE) {
    HRESULT hr = StringCchPrintf(msg, (2*MAX_PATH+100),"Cannot open %s", savename);
    if (FAILED(hr)) {
      OutputError(hr, IDS_SAFE_PRINTF);
      return NULL;
    }
    sdkdiff_UI(TRUE);
    MessageBox(hwndClient, msg, "Sdkdiff", MB_ICONSTOP|MB_OK);
    sdkdiff_UI(FALSE);
    return NULL;
  }

  /* Make sure the composite list has been built */
  if (item->secs_composite == NULL) {
    ci_makecomposite(item);
  }

  /* write out the header line */
  list = view_getcomplist(view);
  lhead = complist_getdescription(list);
  HRESULT hr = StringCchPrintf(msg, (2*MAX_PATH+100), "-- %s -- %s -- includes %s%s%s%s%s lines\r\n",
       lhead,
       item->tag,
       (LPSTR) ((compopts & INCLUDE_SAME) ? "identical," : ""),
       (LPSTR) ((compopts & INCLUDE_LEFTONLY) ? "left-only," : ""),
       (LPSTR) ((compopts & INCLUDE_RIGHTONLY) ? "right-only," : ""),
       (LPSTR) ((compopts & INCLUDE_MOVEDLEFT) ? "moved-left," : ""),
       (LPSTR) ((compopts & INCLUDE_MOVEDRIGHT) ? "moved-right" : "") );
  if (FAILED(hr)) {
    OutputError(hr, IDS_SAFE_PRINTF);
    return NULL;
  }
  WriteFile(fh, msg, lstrlen(msg), &cbWritten, NULL);
  complist_freedescription(list, lhead);

  /* Write out every line in every section on the composite
   * list to the temp file.
   */
    for( sec=(SECTION)List_First(item->secs_composite);  sec!=NULL;  sec = (SECTION)List_Next((LPVOID)sec)) {
    tag = "    ";  /* avoid strange diagnostic */
    /* get the tag field based on the section state*/
    switch(section_getstate(sec)) {

    case STATE_SAME:
      if (!(compopts & INCLUDE_SAME))
        continue;
      tag = "    ";
      break;

    case STATE_LEFTONLY:
    case STATE_SIMILARLEFT:
      if (!(compopts & INCLUDE_LEFTONLY))
        continue;
      tag = " <! ";
      break;
    case STATE_RIGHTONLY:
    case STATE_SIMILARRIGHT:
      if (!(compopts & INCLUDE_RIGHTONLY))
        continue;
      tag = " !> ";
      break;

    case STATE_MOVEDLEFT:
      if (!(compopts & INCLUDE_MOVEDLEFT))
        continue;
      tag = " <- ";
      break;

    case STATE_MOVEDRIGHT:
      if (!(compopts & INCLUDE_MOVEDRIGHT))
        continue;
      tag = " -> ";
      break;
    }

    /* write out each line in this section.
     * non-standard traverse of list as we only
     * want to go from section first to section last
     * inclusive.
     */
    for (line = section_getfirstline(sec); line != NULL; line = (LINE)List_Next(line)) {
      /* write out to file */
      text = line_gettext(line);
      WriteFile(fh, tag, lstrlen(tag), &cbWritten, NULL);
      WriteFile(fh, text, lstrlen(text), &cbWritten, NULL);
      ++linecount;

      if (line == section_getlastline(sec))
        break;
    }
  }

  /* Write the footer */
  hr = StringCchPrintf(msg, (2*MAX_PATH+100),"-- %u lines listed\r\n", linecount);
  if (FAILED(hr)) {
    OutputError(hr, IDS_SAFE_PRINTF);
    return NULL;
  }
  WriteFile(fh, msg, lstrlen(msg), &cbWritten, NULL);

  /* Close the file and return */
  CloseHandle(fh);
  return savename;
}

Generated on Wed Nov 13 2024 16:53:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/sdkdiff/complist.cpp File Reference

  • Begin
  • sdkdiff
Classes | Functions | Variables

complist.cpp File Reference

#include "precomp.h"
#include "state.h"
#include "sdkdiff.h"
#include "wdiffrc.h"
#include "list.h"
#include "line.h"
#include "scandir.h"
#include "file.h"
#include "section.h"
#include "compitem.h"
#include "complist.h"
#include "view.h"

Go to the source code of this file.

Classes

struct | complist

Functions

void | complist_append (COMPLIST *pcl, LPCSTR p1, LPCSTR p2, int *psequence)
BOOL | complist_appendfinished (COMPLIST *pcl, LPCSTR pszLeft, LPCSTR pszRight, VIEW view)
COMPLIST | complist_args (LPSTR p1, LPSTR p2, VIEW view, BOOL fDeep)
void | complist_copyfiles (COMPLIST cl, LPSTR newroot, UINT options)
void | complist_delete (COMPLIST cl)
COMPLIST complist_dirdialog (VIEW view)
int FAR PASCAL | complist_dodlg_copyfiles (HWND hDlg, UINT message, UINT wParam, long lParam)
int FAR PASCAL | complist_dodlg_dir (HWND hDlg, unsigned message, UINT wParam, LONG lParam)
int FAR PASCAL | complist_dodlg_savelist (HWND hDlg, UINT message, UINT wParam, long lParam)
COMPLIST complist_filedialog (VIEW view)
void | complist_freedescription (COMPLIST cl, LPSTR desc)
LPSTR | complist_getdescription (COMPLIST cl)
LIST | complist_getitems (COMPLIST cl)
UINT | complist_itemcount (COMPLIST cl)
BOOL | complist_markpattern (COMPLIST cl)
BOOL | complist_match (COMPLIST cl, VIEW view, BOOL fDeep, BOOL fExact)
COMPLIST | complist_new (void)
DWORD | complist_querytime (void)
void | complist_savelist (COMPLIST cl, LPSTR savename, UINT options)
void | complist_setdialogdefault (LPSTR left, LPSTR right, BOOL fDeep)
void | complist_togglemark (COMPLIST cl)

Variables

BOOL bAbort
BOOL dialog_autocopy
BOOL dialog_fastscan
char | dialog_leftname [MAX_PATH]
BOOL dialog_recursive
char | dialog_rightname [MAX_PATH]
char | dialog_servername [80]
BOOL dlg_differ
char | dlg_file [MAX_PATH]
BOOL dlg_identical
BOOL dlg_IgnoreAttributes
BOOL dlg_IgnoreMarks
BOOL dlg_left
UINT dlg_options
BOOL dlg_right
char | dlg_root [MAX_PATH]
BOOL | dlg_sums = TRUE
BOOL | SeenDialogNames = FALSE

Function Documentation

void complist_append | ( | COMPLIST * | pcl,
 |  | LPCSTR | p1,
 |  | LPCSTR | p2,
 |  | int * | psequence
 | ) |  |

Definition at line 278 of file complist.cpp.

{
    COMPLIST cl;

    if (!*pcl)
    {
        /* alloc a new complist */
        *pcl = complist_new();
    }
    cl = *pcl;

    dir_appendlist(&cl->left, p1, FALSE, psequence);
    dir_appendlist(&cl->right, p2, FALSE, psequence);
} /* complist_append */

BOOL complist_appendfinished | ( | COMPLIST * | pcl,
 |  | LPCSTR | pszLeft,
 |  | LPCSTR | pszRight,
 |  | VIEW | view
 | ) |  |

Definition at line 299 of file complist.cpp.

{
    BOOL fSuccess = FALSE;
    COMPLIST cl;
    char msg[MAX_PATH+20] = {0};
  HRESULT hr;

    if (!*pcl)
        goto LError;

    cl = *pcl;
    if (!cl->left || !cl->right)
    {
        hr = StringCchCatN(msg, (MAX_PATH+20), LoadRcString(IDS_COULDNT_FIND_ANYTHING), sizeof(msg)-1);
    if (FAILED(hr))
      OutputError(hr, IDS_SAFE_CAT);
        TRACE_ERROR(msg, FALSE);
        goto LError;
    }

    dir_setdescription(cl->left, pszLeft);
    dir_setdescription(cl->right, pszRight);

    if (!TrackLeftOnly)
        dir_setotherdirlist(cl->left, cl->right);
    if (!TrackRightOnly)
        dir_setotherdirlist(cl->right, cl->left);

    /* register with the view (must be done after building lists) */
    view_setcomplist(view, cl);

    complist_match(cl, view, FALSE, TRUE);

    fSuccess = TRUE;

LError:
    return fSuccess;
}

COMPLIST complist_args | ( | LPSTR | p1,
 |  | LPSTR | p2,
 |  | VIEW | view,
 |  | BOOL | fDeep
 | ) |  |

Definition at line 207 of file complist.cpp.

{
    COMPLIST cl;
    char msg[MAX_PATH+20];
  HRESULT hr;

    /* alloc a new complist */
    cl = complist_new();

    //
    // accept \\server!path for a checksum server and
    // pathname - assumes no \\server\share names have !
    // within the server name.
    {
        cl->left = dir_buildlist(p1, FALSE, TRUE);
    }
    /* check that we could find the paths, and report if not */
    if (cl->left == NULL) {
        hr = StringCchPrintf(msg, (MAX_PATH+20), LoadRcString(IDS_COULDNT_FIND), p1);
    if (FAILED(hr))
      OutputError(hr, IDS_SAFE_PRINTF);
        TRACE_ERROR(msg, FALSE);
        complist_delete(cl);
        cl = NULL;
        goto LError;
    }
    {
        cl->right = dir_buildlist(p2, FALSE, TRUE);
    }
    /* check that we could find the paths, and report if not */
    if (cl->right == NULL) {
        hr = StringCchPrintf(msg, (MAX_PATH+20), LoadRcString(IDS_COULDNT_FIND), p2);
    if (FAILED(hr))
      OutputError(hr, IDS_SAFE_PRINTF);
        TRACE_ERROR(msg, FALSE);
        complist_delete(cl);
        cl = NULL;
        goto LError;
    }

    if (!TrackLeftOnly) {
        dir_setotherdirlist(cl->left, cl->right);
    }
    if (!TrackRightOnly) {
        dir_setotherdirlist(cl->right, cl->left);
    }
    {
        // remember these paths as defaults for the next dialog -
        // get the normalised, absolute paths
        LPSTR pleft = dir_getrootdescription(cl->left);
        LPSTR pright = dir_getrootdescription(cl->right);
        complist_setdialogdefault(pleft, pright, fDeep);
        dir_freerootdescription(cl->left, pleft);
        dir_freerootdescription(cl->right, pright);
    }

    /* register with the view (must be done after building lists) */
    view_setcomplist(view, cl);

    complist_match(cl, view, fDeep, TRUE);

LError:
    return(cl);
} /* complist_args */

void complist_copyfiles | ( | COMPLIST | cl,
 |  | LPSTR | newroot,
 |  | UINT | options
 | ) |  |

Definition at line 619 of file complist.cpp.

{
    int nFiles = 0;
    int nFails = 0;
    static BOOL done_init = FALSE;
    LPSTR pstr;
    char buffer[MAX_PATH+20];
    DIRITEM diritem;
    DLGPROC lpProc;
    BOOL bOK;
    COMPITEM ci;
    int state;
    BOOL HitReadOnly = ((options&COPY_HITREADONLY)==COPY_HITREADONLY);
    BOOL CopyNoAttributes;
  HRESULT hr;

    if (!done_init) {
        /*
         * one-time initialisation of dialog defaults
         */
        dlg_options = COPY_FROMLEFT|INCLUDE_LEFTONLY|INCLUDE_DIFFER;
        dlg_root[0] = '\0';

        // set the ignore-marked files option by default the same
        // as the hide mark files menu option. If he doesn't want them
        // visible, he probably doesn't want them copied.
        dlg_IgnoreMarks = hide_markedfiles;

        done_init = TRUE;
    }

    if (cl == NULL) {
        return;
    }

    if (newroot == NULL) {
        /*
         * put up dialog to query rootname and options
         */

        /* store the left and right rootnames so that the dlg proc
         * can display them in the dialog.
         */
        pstr = dir_getrootdescription(cl->left);
        hr = StringCchCopy(dialog_leftname, MAX_PATH, pstr);
    if(FAILED(hr))
      OutputError(hr, IDS_SAFE_COPY);
        dir_freerootdescription(cl->left, pstr);

        pstr = dir_getrootdescription(cl->right);
        hr = StringCchCopy(dialog_rightname, MAX_PATH, pstr);
        if(FAILED(hr))
      OutputError(hr, IDS_SAFE_COPY);
    dir_freerootdescription(cl->right, pstr);

        do {
            lpProc = (DLGPROC)MakeProcInstance((WINPROCTYPE)complist_dodlg_copyfiles, hInst);
            sdkdiff_UI(TRUE);
            bOK = (BOOL)DialogBox(hInst, "CopyFiles", hwndClient, lpProc);
            sdkdiff_UI(FALSE);
            FreeProcInstance(lpProc);

            if (!bOK) {
                /* user cancelled from dialog box */
                return;
            }
            if (lstrlen(dlg_root) == 0) {
                sdkdiff_UI(TRUE);
                MessageBox( hwndClient, LoadRcString(IDS_ENTER_DIR_NAME),
                            "Sdkdiff", MB_ICONSTOP|MB_OK);
                sdkdiff_UI(FALSE);
            }
        } while (lstrlen(dlg_root) == 0);

    } else {
        // no dialog - all options passed in (eg from command line).
        // note that in this case the dlg_IgnoreMarks is left as
        // whatever the hide_markedfiles menu option is set to.
        dlg_options = options;
        hr = StringCchCopy(dlg_root, MAX_PATH, newroot);
    if(FAILED(hr))
      OutputError(hr, IDS_SAFE_COPY);
    }

    TickCount = GetTickCount();

    /* this relies on the sumserver, server and share (if any) being the same for
       all the things on the list.  We set up the first one and then just check
       that it doesn't change (within ss_client).  If it turns out to be a local
       copy these things turn into no-ops somewhere below us.
    */
    if (dlg_options & COPY_FROMLEFT) {
        if (!dir_startcopy(cl->left))
            return;
    } else {
        if (!dir_startcopy(cl->right))
            return;
    }

    CopyNoAttributes = dlg_IgnoreAttributes;

    /*
     * traverse the list of compitems copying files as necessary
     */
    for( ci=(COMPITEM)List_First(cl->items);  ci!=NULL;  ci = (COMPITEM)List_Next((LPVOID)ci)) {
        if (bAbort) {
            break;  /* fall into end_copy processing */
        }

        // ignore marked files totally if the option was
        // set in the dialog.
        if (dlg_IgnoreMarks && compitem_getmark(ci)) {
            continue;
        }

        /* check if files of this type are to be copied */
        state = compitem_getstate(ci);

        if ((state == STATE_SAME) && !(dlg_options & INCLUDE_SAME)) {
            continue;
        } else if ((state == STATE_DIFFER) && !(dlg_options & INCLUDE_DIFFER)) {
            continue;
        } else if (state == STATE_FILELEFTONLY) {
            if (dlg_options & COPY_FROMRIGHT) {
                continue;
            }
            if ((dlg_options & (INCLUDE_LEFTONLY | INCLUDE_RIGHTONLY)) == 0) {
                continue;
            }
        } else if (state == STATE_FILERIGHTONLY) {
            if (dlg_options & COPY_FROMLEFT) {
                continue;
            }
            if ((dlg_options & (INCLUDE_LEFTONLY | INCLUDE_RIGHTONLY)) == 0) {
                continue;
            }
        }

        if (dlg_options & COPY_FROMLEFT) {
            diritem = file_getdiritem(compitem_getleftfile(ci));
        } else {
            diritem = file_getdiritem(compitem_getrightfile(ci));
        }

        /*
         * copy the file to the new root directory
         */
        if (dir_copy(diritem, dlg_root, HitReadOnly, CopyNoAttributes) == FALSE) {
            nFails++;
            pstr = dir_getrelname(diritem);
            hr = StringCchPrintf(buffer, (MAX_PATH+20), LoadRcString(IDS_FAILED_TO_COPY), pstr);
      if(FAILED(hr))
        OutputError(hr, IDS_SAFE_PRINTF);
            dir_freerelname(diritem, pstr);

            if (!TRACE_ERROR(buffer, TRUE)) {
                /* user pressed cancel - abort current operation*/
                /* fall through to end-copy processing */
                break;
            }

        } else {
            nFiles++;
        }

        hr = StringCchPrintf(buffer, (MAX_PATH+20), LoadRcString(IDS_COPYING), nFiles);
    if(FAILED(hr))
      OutputError(hr, IDS_SAFE_PRINTF);
        SetStatus(buffer);

        /*
         * allow user interface to continue
         */
        if (Poll()) {
            /* abort requested */
            TickCount = GetTickCount()-TickCount;
            sdkdiff_UI(TRUE);
            MessageBox(hwndClient, LoadRcString(IDS_COPY_ABORTED),
                       "SdkDiff", MB_OK|MB_ICONINFORMATION);
            sdkdiff_UI(FALSE);
            break;
        }

    } /* traverse */
    hr = StringCchPrintf(buffer, (MAX_PATH+20), LoadRcString(IDS_COPYING_NFILES), nFiles);
  if(FAILED(hr))
    OutputError(hr, IDS_SAFE_PRINTF);
    SetStatus(buffer);
    if (dlg_options & COPY_FROMLEFT) {
        nFails = dir_endcopy(cl->left);
    } else {
        nFails = dir_endcopy(cl->right);
    }
    TickCount = GetTickCount()-TickCount;

    if (nFails<0) {
        hr = StringCchPrintf(buffer, (MAX_PATH+20), LoadRcString(IDS_COPY_FAILED), -nFails);
    if(FAILED(hr))
      OutputError(hr, IDS_SAFE_PRINTF);
    } else {
        hr = StringCchPrintf(buffer, (MAX_PATH+20), LoadRcString(IDS_COPY_COMPLETE), nFails);
    if(FAILED(hr))
      OutputError(hr, IDS_SAFE_PRINTF);
    }
    sdkdiff_UI(TRUE);
    MessageBox(hwndClient, buffer, "SdkDiff", MB_OK|MB_ICONINFORMATION);
    sdkdiff_UI(FALSE);

    buffer[0] = '\0';
    SetStatus(buffer);
} /* complist_copyfiles */

void complist_delete ( COMPLIST cl )

Definition at line 355 of file complist.cpp.

{
    COMPITEM item;

    if (cl == NULL) {
        return;
    }

    /* delete the two directory scan lists */
    dir_delete(cl->left);
    dir_delete(cl->right);

    /* delete the compitems in the list */
  for( item=(COMPITEM)List_First(cl->items);  item!=NULL;  item = (COMPITEM)List_Next((LPVOID)item)) {
        compitem_delete(item);
    }

    /* delete the list itself */
    List_Destroy(&cl->items);

    HeapFree(GetProcessHeap(), NULL, (LPSTR) cl);

}

COMPLIST complist_dirdialog ( VIEW view )

Definition at line 181 of file complist.cpp.

{
    DLGPROC lpProc;
    BOOL fOK;

    /* put up a dialog for the two pathnames */
    lpProc = (DLGPROC)MakeProcInstance((WINPROCTYPE)complist_dodlg_dir, hInst);
    sdkdiff_UI(TRUE);
    fOK = (BOOL)DialogBox(hInst, "Directory", hwndClient, lpProc);
    sdkdiff_UI(FALSE);
    FreeProcInstance(lpProc);

    if (!fOK) {
        return(NULL);
    }

    return complist_args( dialog_leftname, dialog_rightname
                          , view, dialog_recursive );
} /* complist_dirdialog */

int FAR PASCAL complist_dodlg_copyfiles | ( | HWND | hDlg,
 |  | UINT | message,
 |  | UINT | wParam,
 |  | long | lParam
 | ) |  |

Definition at line 1375 of file complist.cpp.

{
    switch (message) {
        case WM_INITDIALOG:
            /*
             * set checkboxes and directory field to defaults
             */
            CheckDlgButton(hDlg, IDD_IDENTICAL,
                           (dlg_options & INCLUDE_SAME) ? 1 : 0);

            CheckDlgButton(hDlg, IDD_DIFFER,
                           (dlg_options & INCLUDE_DIFFER) ? 1 : 0);

            CheckDlgButton(hDlg, IDD_LEFT,
                           (dlg_options & (INCLUDE_LEFTONLY|INCLUDE_RIGHTONLY)) ? 1 : 0);

            CheckDlgButton(hDlg, IDD_IGNOREMARK, dlg_IgnoreMarks ? 1 : 0);

            CheckDlgButton(hDlg, IDD_ATTRIBUTES, dlg_IgnoreAttributes ? 0 : 1);

            SetDlgItemText(hDlg, IDD_DIR1, dlg_root);

            /*
             * set default radio button for copy from
             */
            CheckRadioButton(hDlg, IDD_FROMLEFT, IDD_FROMRIGHT,
                             (dlg_options & COPY_FROMLEFT) ? IDD_FROMLEFT : IDD_FROMRIGHT);

            return(TRUE);

        case WM_COMMAND:
            switch (GET_WM_COMMAND_ID(wParam, lParam)) {

                case IDD_FROMLEFT:
                    dlg_options &= ~(COPY_FROMRIGHT);
                    dlg_options |= COPY_FROMLEFT;
                    break;

                case IDD_FROMRIGHT:
                    dlg_options &= ~(COPY_FROMLEFT);
                    dlg_options |= COPY_FROMRIGHT;
                    break;

                case IDOK:
                    if (SendDlgItemMessage(hDlg, IDD_IDENTICAL,
                                           BM_GETCHECK, 0, 0) == 1) {
                        dlg_options |= INCLUDE_SAME;
                    } else {
                        dlg_options &= ~INCLUDE_SAME;
                    }
                    if (SendDlgItemMessage(hDlg, IDD_DIFFER,
                                           BM_GETCHECK, 0, 0) == 1) {
                        dlg_options |= INCLUDE_DIFFER;
                    } else {
                        dlg_options &= ~INCLUDE_DIFFER;
                    }
                    if (SendDlgItemMessage(hDlg, IDD_LEFT,
                                           BM_GETCHECK, 0, 0) == 1) {
                        dlg_options |= INCLUDE_LEFTONLY;
                    } else {
                        dlg_options &= ~INCLUDE_LEFTONLY;
                    }

                    dlg_IgnoreMarks =
                    (SendDlgItemMessage(
                                       hDlg,
                                       IDD_IGNOREMARK,
                                       BM_GETCHECK, 0, 0) == 1);

                    dlg_IgnoreAttributes =
                    (SendDlgItemMessage(
                                       hDlg,
                                       IDD_ATTRIBUTES,
                                       BM_GETCHECK, 0, 0) == 0);

                    GetDlgItemText(hDlg, IDD_DIR1, dlg_root, sizeof(dlg_root));

                    EndDialog(hDlg, TRUE);
                    break;

                case IDCANCEL:
                    EndDialog(hDlg, FALSE);
                    break;
            }
    }
    return(FALSE);
} /* complist_dodlg_copyfiles */

int FAR PASCAL complist_dodlg_dir | ( | HWND | hDlg,
 |  | unsigned | message,
 |  | UINT | wParam,
 |  | LONG | lParam
 | ) |  |

Definition at line 1487 of file complist.cpp.

{
    static char path[MAX_PATH];
    static char buffer[MAX_PATH];

    /* We write what we find to the ini file, but we only load from the ini file
    ** once per instance of the app.  So if you start two sdkdiffs, each remembers
    ** what it is doing as long as it is alive
    */

    int id;

    switch (message) {

        case WM_INITDIALOG:

            /* fill the edit fields with the current
             * directory as a good starting point - if there isn't
             * already a saved path.
             *
             * set the current directory as a label so that the
             * user can select relative paths such as ..
             *
             */
            _getcwd(path, sizeof(path));
            AnsiLowerBuff(path, (DWORD)strlen(path));
            SetDlgItemText(hDlg, IDD_LAB3, path);

            if (!SeenDialogNames)
                GetProfileString(APPNAME, "NameLeft", path, dialog_leftname, MAX_PATH);
            SetDlgItemText(hDlg, IDD_DIR1, dialog_leftname);
            if (!SeenDialogNames)
                GetProfileString(APPNAME, "NameRight", path, dialog_rightname, MAX_PATH);
            SetDlgItemText(hDlg, IDD_DIR2, dialog_rightname);
            if (!SeenDialogNames)
                dialog_recursive = GetProfileInt(APPNAME, "Recursive", 1);
            SendDlgItemMessage( hDlg
                                , IDD_RECURSIVE
                                , BM_SETCHECK
                                , (WPARAM)dialog_recursive
                                , 0
                              );

            SeenDialogNames = TRUE;
            return(TRUE);

        case WM_COMMAND:
            id = GET_WM_COMMAND_ID(wParam, lParam);

            switch (id) {
                case IDD_DIR1:
                case IDD_DIR2:
                    if (GET_WM_COMMAND_CMD(wParam, lParam) == EN_CHANGE) {

                        int idother = (id == IDD_DIR1) ? IDD_DIR2 : IDD_DIR1;

                    }
                    break;

                case IDCANCEL:
                    EndDialog(hDlg, FALSE);
                    return(TRUE);

                case IDOK:
                    {
                        LPSTR pszThis = 0;
                        LPSTR pszOther = 0;

                        /* fetch the text from the dialog, and remember
                         * it in win.ini
                         */

                        GetDlgItemText(hDlg, IDD_DIR1,
                                       dialog_leftname, sizeof(dialog_leftname));
                        GetDlgItemText(hDlg, IDD_DIR2,
                                       dialog_rightname, sizeof(dialog_rightname));

                        WriteProfileString(APPNAME, "NameLeft", dialog_leftname);
                        WriteProfileString(APPNAME, "NameRight", dialog_rightname);

                        dialog_recursive =  ( 1 == SendDlgItemMessage( hDlg
                                                                       , IDD_RECURSIVE
                                                                       , BM_GETCHECK
                                                                       , 0
                                                                       , 0
                                                                     )
                                            );
                        WriteProfileString( APPNAME
                                            , "Recursive"
                                            , dialog_recursive ? "1" : "0"
                                          );
                        EndDialog(hDlg, TRUE);
                    }
                    return(TRUE);
            }
            break;
    }
    return(FALSE);
} /* complist_dodlg_dir */

int FAR PASCAL complist_dodlg_savelist | ( | HWND | hDlg,
 |  | UINT | message,
 |  | UINT | wParam,
 |  | long | lParam
 | ) |  |

Definition at line 1316 of file complist.cpp.

{
    switch (message) {
        case WM_INITDIALOG:
            SendDlgItemMessage(hDlg, IDD_IDENTICAL, BM_SETCHECK,
                               dlg_identical ? 1 : 0, 0);
            SendDlgItemMessage(hDlg, IDD_DIFFER, BM_SETCHECK,
                               dlg_differ ? 1 : 0, 0);
            SendDlgItemMessage(hDlg, IDD_LEFT, BM_SETCHECK,
                               dlg_left ? 1 : 0, 0);
            SendDlgItemMessage(hDlg, IDD_RIGHT, BM_SETCHECK,
                               dlg_right ? 1 : 0, 0);
            SendDlgItemMessage(hDlg, IDD_SUMS, BM_SETCHECK,
                               dlg_sums ? 1 : 0, 0);
            CheckDlgButton(hDlg, IDD_IGNOREMARK, dlg_IgnoreMarks ? 1 : 0);

            SetDlgItemText(hDlg, IDD_FILE, dlg_file);

            return(TRUE);

        case WM_COMMAND:
            switch (GET_WM_COMMAND_ID(wParam, lParam)) {

                case IDOK:
                    dlg_identical = (SendDlgItemMessage(hDlg, IDD_IDENTICAL,
                                                        BM_GETCHECK, 0, 0) == 1);
                    dlg_differ = (SendDlgItemMessage(hDlg, IDD_DIFFER,
                                                     BM_GETCHECK, 0, 0) == 1);
                    dlg_left = (SendDlgItemMessage(hDlg, IDD_LEFT,
                                                   BM_GETCHECK, 0, 0) == 1);
                    dlg_right = (SendDlgItemMessage(hDlg, IDD_RIGHT,
                                                    BM_GETCHECK, 0, 0) == 1);
                    dlg_sums = (SendDlgItemMessage(hDlg, IDD_SUMS,
                                                   BM_GETCHECK, 0, 0) == 1);
                    dlg_IgnoreMarks =
                    (SendDlgItemMessage(
                                       hDlg,
                                       IDD_IGNOREMARK,
                                       BM_GETCHECK, 0, 0) == 1);

                    GetDlgItemText(hDlg, IDD_FILE, dlg_file, sizeof(dlg_file));

                    EndDialog(hDlg, TRUE);
                    break;

                case IDCANCEL:
                    EndDialog(hDlg, FALSE);
                    break;
            }
    }
    return(FALSE);
} /* complist_dodlg_savelist */

COMPLIST complist_filedialog ( VIEW view )

Definition at line 112 of file complist.cpp.

{
    COMPLIST cl = NULL;
    char szPath1[MAX_PATH * 2];
    char szPath2[MAX_PATH * 2];
    char fname[MAX_PATH], FileExt[5], FileOpenSpec[15];
  HRESULT hr;

    /* ask for the filenames - using gfile standard dialogs */
    hr = StringCchCopy(FileExt, 5, ".c");
  if (FAILED(hr)) {
    OutputError(hr, IDS_SAFE_COPY);
    goto LError;
  }
    hr = StringCchCopy(FileOpenSpec, 5, "*.*");
  if (FAILED(hr)) {
    OutputError(hr, IDS_SAFE_COPY);
    goto LError;
  }
    if (!gfile_open(hwndClient, LoadRcString(IDS_SELECT_FIRST_FILE), FileExt, FileOpenSpec, szPath1, NUMELMS(szPath1), fname) ){
        goto LError;
    }

    if (!gfile_open(hwndClient, LoadRcString(IDS_SELECT_SECOND_FILE), FileExt, FileOpenSpec, szPath2, NUMELMS(szPath2), fname) ){
        goto LError;
    }

    /* alloc a new structure */
    cl = complist_new();

    cl->left = dir_buildlist(szPath1, FALSE, TRUE);
    cl->right = dir_buildlist(szPath2, FALSE, TRUE);

    /* register with the view (must be done after the list is non-null) */
    view_setcomplist(view, cl);

    complist_match(cl, view, FALSE, TRUE);

LError:
    return(cl);
}/* complist_filedialog */

void complist_freedescription | ( | COMPLIST | cl,
 |  | LPSTR | desc
 | ) |  |

Definition at line 1061 of file complist.cpp.

{
    HeapFree(GetProcessHeap(), NULL, desc);
}

LPSTR complist_getdescription ( COMPLIST cl )

Definition at line 1025 of file complist.cpp.

{
    LPSTR pl;
    LPSTR pr;
    LPSTR desc = 0;

    pl = dir_getrootdescription(cl->left);
    pr = dir_getrootdescription(cl->right);

    if (pl && pr)
    {
        /*
         * allow for space-colon-space and null when sizing
         */
        desc = (char*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, lstrlen(pl) + lstrlen(pr) + 4);
        if (desc == NULL)
      return NULL;
    HRESULT hr = StringCchPrintf(desc, (lstrlen(pl)+lstrlen(pr)+4), "%s : %s", pl, pr);
    if(FAILED(hr)) {
      OutputError(hr, IDS_SAFE_PRINTF);
      return NULL;
    }
    }

    dir_freerootdescription(cl->left, pl);
    dir_freerootdescription(cl->right, pr);

    return(desc);
}

LIST complist_getitems ( COMPLIST cl )

Definition at line 342 of file complist.cpp.

{
    if (cl == NULL) {
        return(NULL);
    }

    return(cl->items);
}

UINT complist_itemcount ( COMPLIST cl )

Definition at line 866 of file complist.cpp.

{
    UINT n = 0;

    if (cl == NULL) {
        return 0;
    }

    /*
     * return the number of compitems in the list
     */
    return List_Card(cl->items);
}

BOOL complist_markpattern ( COMPLIST cl )

Definition at line 979 of file complist.cpp.

{
    COMPITEM ci;
    char achPattern[MAX_PATH];
    BOOL bOK = FALSE;
    LPSTR ptag;
    TCHAR   szBuff[40];

    HRESULT hr = StringCchCopy(szBuff,40, LoadRcString(IDS_MARK_FILES));
  if(FAILED(hr))
      OutputError(hr, IDS_SAFE_COPY);

    sdkdiff_UI(TRUE);
    bOK = StringInput(achPattern, sizeof(achPattern), LoadRcString(IDS_ENTER_SUBSTRING2),
            szBuff, "obj");
    sdkdiff_UI(FALSE);

    if (!bOK) {
        return(FALSE);
    }

    bOK = FALSE;

  for( ci=(COMPITEM)List_First(cl->items);  ci!=NULL;  ci = (COMPITEM)List_Next((LPVOID)ci)) {
        ptag = compitem_gettext_tag(ci);
        if (strstr(ptag, achPattern) != NULL) {
            if (!compitem_getmark(ci)) {
                bOK = TRUE;
                compitem_setmark(ci, TRUE);
            }

        }
    }

    return(bOK);
}

BOOL complist_match | ( | COMPLIST | cl,
 |  | VIEW | view,
 |  | BOOL | fDeep,
 |  | BOOL | fExact
 | ) |  |

Definition at line 1089 of file complist.cpp.

{
    LPSTR lname;
    LPSTR rname;
    DIRITEM leftitem, rightitem;
    DIRITEM nextitem;
    int cmpvalue;

    TickCount = GetTickCount();

    if (dir_isfile(cl->left) ) {

        if (dir_isfile(cl->right)) {
            /* two files */

            /* there should be one item in each list - make
             * a compitem by matching these two and append it to the
             * list
             */
            compitem_new(dir_firstitem(cl->left),
                         dir_firstitem(cl->right),
                         cl->items, fExact);

            view_newitem(view);

            TickCount = GetTickCount() - TickCount;
            return TRUE;
        }
        /* left is file, right is dir */
        leftitem = dir_firstitem(cl->left);
        rightitem = dir_firstitem(cl->right);
        lname = dir_getrelname(leftitem);
        while (rightitem != NULL) {
            rname = dir_getrelname(rightitem);
            cmpvalue = lstrcmpi(lname, rname);
            dir_freerelname(rightitem, rname);

            if (cmpvalue == 0) {
                /* this is the match */
                compitem_new( leftitem, rightitem
                              , cl->items, fExact);
                view_newitem(view);

                dir_freerelname(leftitem, lname);

                TickCount = GetTickCount() - TickCount;
                return(TRUE);
            }

            rightitem = dir_nextitem(cl->right, rightitem, fDeep);
        }
        /* not found */
        dir_freerelname(leftitem, lname);
        compitem_new(leftitem, NULL, cl->items, fExact);
        view_newitem(view);
        TickCount = GetTickCount() - TickCount;
        return(TRUE);

    } else if (dir_isfile(cl->right)) {

        /* left is dir, right is file */

        /* loop through the left dir, looking for
         * a file that has the same name as rightitem
         */

        leftitem = dir_firstitem(cl->left);
        rightitem = dir_firstitem(cl->right);
        rname = dir_getrelname(rightitem);
        while (leftitem != NULL) {
            lname = dir_getrelname(leftitem);
            cmpvalue = lstrcmpi(lname, rname);
            dir_freerelname(leftitem, lname);

            if (cmpvalue == 0) {
                /* this is the match */
                compitem_new(leftitem, rightitem
                             , cl->items, fExact);
                view_newitem(view);

                dir_freerelname(rightitem, rname);

                TickCount = GetTickCount() - TickCount;
                return(TRUE);
            }

            leftitem = dir_nextitem(cl->left, leftitem, fDeep);
        }
        /* not found */
        dir_freerelname(rightitem, rname);
        compitem_new(NULL, rightitem, cl->items, fExact);
        view_newitem(view);
        TickCount = GetTickCount() - TickCount;
        return(TRUE);
    }

    /* two directories */

    /* traverse the two lists in parallel comparing the relative names*/

    leftitem = dir_firstitem(cl->left);
    rightitem = dir_firstitem(cl->right);
    while ((leftitem != NULL) && (rightitem != NULL)) {

        lname = dir_getrelname(leftitem);
        rname = dir_getrelname(rightitem);
        if (!dir_compsequencenumber(leftitem, rightitem, &cmpvalue))
        {
            if (dir_iswildcard(cl->left) && dir_iswildcard(cl->right))
                cmpvalue = dir_compwildcard(cl->left, cl->right, lname, rname);
            else
                cmpvalue = utils_CompPath(lname, rname);
        }

#ifdef trace
        {
      char msg[2*MAX_PATH+30];
            hr = StringCchPrintf( msg, (2*MAX_PATH+30), "complist_match: %s %s %s\n"
                      , lname
                      , ( cmpvalue<0 ? "<"
                          : (cmpvalue==0 ? "=" : ">")
                        )
                      , rname
                    );
      if(FAILED(hr))
        OutputError(hr, IDS_SAFE_PRINTF);
            if (bTrace) Trace_File(msg);
        }
#endif
        dir_freerelname(leftitem, lname);
        dir_freerelname(rightitem, rname);

        if (cmpvalue == 0) {
            BOOL trackThese = TrackSame || TrackDifferent;
            if (!TrackReadonly) {
                BOOL bothReadonly = (BOOL)((dir_getattr(leftitem) &
                                            dir_getattr(rightitem) &
                                            FILE_ATTRIBUTE_READONLY) != 0);
                if (bothReadonly) {
                    trackThese = FALSE;
                }
            }
            if (trackThese) {
                compitem_new( leftitem, rightitem
                              , cl->items, fExact);
                if (view_newitem(view)) {
                    TickCount = GetTickCount() - TickCount;
                    return(FALSE);
                }
                leftitem = dir_nextitem(cl->left, leftitem, fDeep);
                rightitem = dir_nextitem(cl->right, rightitem, fDeep);
            } else {
                nextitem = dir_nextitem(cl->left, leftitem, fDeep);
                List_Delete(leftitem);
                leftitem = nextitem;
                nextitem = dir_nextitem(cl->right, rightitem, fDeep);
                List_Delete(rightitem);
                rightitem = nextitem;
            }

        } else if (cmpvalue < 0) {
            if (TrackLeftOnly) {
                compitem_new(leftitem, NULL, cl->items, fExact);
                if (view_newitem(view)) {
                    TickCount = GetTickCount() - TickCount;
                    return(FALSE);
                }
                leftitem = dir_nextitem(cl->left, leftitem, fDeep);
            } else {
                nextitem = dir_nextitem(cl->left, leftitem, fDeep);
                List_Delete(leftitem);
                leftitem = nextitem;
            }
        } else {
            if (TrackRightOnly) {
                compitem_new(NULL, rightitem, cl->items, fExact);
                if (view_newitem(view)) {
                    TickCount = GetTickCount() - TickCount;
                    return(FALSE);
                }
                rightitem = dir_nextitem(cl->right, rightitem, fDeep);
            } else {
                nextitem = dir_nextitem(cl->right, rightitem, fDeep);
                List_Delete(rightitem);
                rightitem = nextitem;
            }
        }
    }

    /* any left over are unmatched */
    if (TrackLeftOnly) {
        while (leftitem != NULL) {
            compitem_new(leftitem, NULL, cl->items, fExact);
            if (view_newitem(view)) {
                TickCount = GetTickCount() - TickCount;
                return(FALSE);
            }
            leftitem = dir_nextitem(cl->left, leftitem, fDeep);
        }
    }
    if (TrackRightOnly) {
        while (rightitem != NULL) {
            compitem_new(NULL, rightitem, cl->items, fExact);
            if (view_newitem(view)) {
                TickCount = GetTickCount() - TickCount;
                return(FALSE);
            }
            rightitem = dir_nextitem(cl->right, rightitem, fDeep);
        }
    }
    TickCount = GetTickCount() - TickCount;
    return(TRUE);
} /* complist_match */

COMPLIST complist_new ( void )

Definition at line 1465 of file complist.cpp.

{
    COMPLIST cl;

    cl = (COMPLIST) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct complist));
    if (cl == NULL)
    return NULL;
  cl->left = NULL;
    cl->right = NULL;
    cl->items = List_Create();

    return(cl);
} /* complist_new */

DWORD complist_querytime ( void )

Definition at line 1305 of file complist.cpp.

{       return TickCount;
}

void complist_savelist | ( | COMPLIST | cl,
 |  | LPSTR | savename,
 |  | UINT | options
 | ) |  |

Definition at line 390 of file complist.cpp.

{
    DLGPROC lpProc;
    static BOOL done_init = FALSE;
    BOOL bOK;
    HANDLE fh;
    DWORD cbWritten;
    int state;
    char msg[2*MAX_PATH+100] = {0};
    HCURSOR hcurs;
    COMPITEM ci;
    LPSTR pstr, lhead;
    int nFiles = 0;
  HRESULT hr;

    if (!done_init) {
        /* init the options once round - but keep the same options
         * for the rest of the session.
         */

        /* first init default options */
        dlg_identical = (outline_include & INCLUDE_SAME);
        dlg_differ = (outline_include & INCLUDE_LEFTONLY);
        dlg_left = (outline_include & INCLUDE_RIGHTONLY);
        dlg_right = (outline_include & INCLUDE_DIFFER);
        dlg_IgnoreMarks = hide_markedfiles;

        dlg_file[0] = '\0';

        done_init = TRUE;
    }

    if (cl == NULL) {
        return;
    }

    if (savename == NULL) {

        /* store the left and right rootnames so that dodlg_savelist
         * can display them in the dialog.
         */
        pstr = dir_getrootdescription(cl->left);
        hr = StringCchCopy(dialog_leftname, MAX_PATH, pstr);
    if (FAILED(hr))
      OutputError(hr, IDS_SAFE_COPY);
        dir_freerootdescription(cl->left, pstr);

        pstr = dir_getrootdescription(cl->right);
        hr = StringCchCopy(dialog_rightname, MAX_PATH, pstr);
    if (FAILED(hr))
      OutputError(hr, IDS_SAFE_COPY);
        dir_freerootdescription(cl->right, pstr);

        lpProc = (DLGPROC)MakeProcInstance((WINPROCTYPE)complist_dodlg_savelist, hInst);
        sdkdiff_UI(TRUE);
        bOK = (BOOL)DialogBox(hInst, "SaveList", hwndClient, lpProc);
        sdkdiff_UI(FALSE);
        FreeProcInstance(lpProc);

        if (!bOK) {
            /* user cancelled from dialog box */
            return;
        }
        savename = dlg_file;

    } else {
        dlg_identical = (options & INCLUDE_SAME);
        dlg_differ = (options & INCLUDE_DIFFER);
        dlg_left = (options & INCLUDE_LEFTONLY);
        dlg_right = (options & INCLUDE_RIGHTONLY);
        GetFullPathName(savename, sizeof(dlg_file), dlg_file, NULL);
    }

    /* try to open the file */
    fh = CreateFile(savename, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, 0, NULL);
    if (fh == INVALID_HANDLE_VALUE) {
        hr = StringCchPrintf(msg, (2*MAX_PATH+100),LoadRcString(IDS_CANT_OPEN), savename);
        if (FAILED(hr))
      OutputError(hr, IDS_SAFE_PRINTF);
    sdkdiff_UI(TRUE);
        MessageBox(hwndClient, msg, "Sdkdiff", MB_ICONSTOP|MB_OK);
        sdkdiff_UI(FALSE);
        return;
    }

    hcurs = SetCursor(LoadCursor(NULL, IDC_WAIT));

    /* write out the header line */
    lhead = complist_getdescription(cl);
    {
        TCHAR szBuf1[20],szBuf2[20],szBuf3[20],szBuf4[20];
        hr = StringCchCopy(szBuf1,20,(LPSTR)(dlg_identical ? LoadRcString(IDS_IDENTICAL_COMMA) : ""));
    if(FAILED(hr))
      OutputError(hr, IDS_SAFE_COPY);
        hr = StringCchCopy(szBuf2,20,(LPSTR)(dlg_left ? LoadRcString(IDS_LEFT_ONLY_COMMA) : ""));
        if(FAILED(hr))
      OutputError(hr, IDS_SAFE_COPY);
    hr = StringCchCopy(szBuf3,20,(LPSTR)(dlg_right ? LoadRcString(IDS_RIGHT_ONLY_COMMA) : ""));
        if(FAILED(hr))
      OutputError(hr, IDS_SAFE_COPY);
    hr = StringCchCopy(szBuf4,20,(LPSTR)(dlg_differ ? LoadRcString(IDS_DIFFERING) : ""));
        if(FAILED(hr))
      OutputError(hr, IDS_SAFE_COPY);
    hr = StringCchPrintf(msg, (2*MAX_PATH+100), LoadRcString(IDS_HEADER_LINE_STR),
                lhead, szBuf1, szBuf2, szBuf3, szBuf4);
    if(FAILED(hr))
      OutputError(hr, IDS_SAFE_PRINTF);
    }
    WriteFile(fh, msg, lstrlen(msg), &cbWritten, NULL);
    complist_freedescription(cl, lhead);

    /* traverse the list of compitems looking for the
     * ones we are supposed to include
     */
    for( ci=(COMPITEM)List_First(cl->items);  ci!=NULL;  ci = (COMPITEM)List_Next((LPVOID)ci)) {
        /* check if files of this type are to be listed */
        state = compitem_getstate(ci);

        if ((state == STATE_SAME) && (!dlg_identical)) {
            continue;
        } else if ((state == STATE_DIFFER) && (!dlg_differ)) {
            continue;
        } else if ((state == STATE_FILELEFTONLY) && (!dlg_left)) {
            continue;
        } else if ((state == STATE_FILERIGHTONLY) && (!dlg_right)) {
            continue;
        }
        if (dlg_IgnoreMarks && compitem_getmark(ci)) {
            continue;
        }

        nFiles++;

        /* output the list line */
        ZeroMemory(msg, sizeof(msg));
        hr = StringCchCatN(msg, (2*MAX_PATH+100), compitem_gettext_tag(ci), sizeof(msg) - 1);
        if(FAILED(hr))
      OutputError(hr, IDS_SAFE_CAT);
    WriteFile(fh, msg, lstrlen(msg), &cbWritten, NULL);

        /* write out the result of the comparison */
        {       LPSTR p;
            p = compitem_gettext_result(ci);
            hr = StringCchPrintf( msg, (2*MAX_PATH+100), "\t%s"
                      , p ? p : "sdkdiff error"
                    );
      if(FAILED(hr))
        OutputError(hr, IDS_SAFE_PRINTF);
        }
        WriteFile(fh, msg, lstrlen(msg), &cbWritten, NULL);

        if (dlg_sums) {
            if (compitem_getleftfile(ci) != NULL) {
                BOOL bValid;
                DWORD cksum;
                cksum = file_retrievechecksum(compitem_getleftfile(ci),&bValid);

        if (bValid) {
          hr = StringCchPrintf(msg, (2*MAX_PATH+100), "\t%8lx", cksum);
          if (FAILED(hr))
            OutputError(hr, IDS_SAFE_PRINTF);
        }
        else {
          hr = StringCchPrintf(msg, (2*MAX_PATH+100), "\t????????");
          if(FAILED(hr))
            OutputError(hr, IDS_SAFE_PRINTF);
        }
            } else {
                hr = StringCchPrintf(msg, (2*MAX_PATH+100), "\t--------");
        if(FAILED(hr))
          OutputError(hr, IDS_SAFE_PRINTF);
            }
            WriteFile(fh, msg, lstrlen(msg), &cbWritten, NULL);

            if (compitem_getrightfile(ci) != NULL) {
                BOOL bValid;
                DWORD cksum;
                cksum = file_retrievechecksum(compitem_getrightfile(ci),&bValid);
        if (bValid) {
          hr = StringCchPrintf(msg, (2*MAX_PATH+100), "\t%8lx", cksum);
          if(FAILED(hr))
            OutputError(hr, IDS_SAFE_PRINTF);
        }
        else {
          hr = StringCchPrintf(msg, (2*MAX_PATH+100), "\t????????");
          if(FAILED(hr))
            OutputError(hr, IDS_SAFE_PRINTF);
        }
            } else {
                hr = StringCchPrintf(msg, (2*MAX_PATH+100), "\t--------");
        if(FAILED(hr))
          OutputError(hr, IDS_SAFE_PRINTF);
            }
            WriteFile(fh, msg, lstrlen(msg), &cbWritten, NULL);

        }

        hr = StringCchPrintf(msg, (2*MAX_PATH+100), "\r\n");
    if(FAILED(hr))
      OutputError(hr, IDS_SAFE_PRINTF);
        WriteFile(fh, msg, (DWORD)strlen(msg), &cbWritten, NULL);
  }

    /* write tail line */
    hr = StringCchPrintf(msg, (2*MAX_PATH+100), LoadRcString(IDS_FILES_LISTED), nFiles);
  if(FAILED(hr))
      OutputError(hr, IDS_SAFE_PRINTF);
    WriteFile(fh, msg, (DWORD)lstrlen(msg), &cbWritten, NULL);

    /* - close file and we are finished */
    CloseHandle(fh);

    SetCursor(hcurs);
} /* complist_savelist */

void complist_setdialogdefault | ( | LPSTR | left,
 |  | LPSTR | right,
 |  | BOOL | fDeep
 | ) |  |

Definition at line 157 of file complist.cpp.

{
  HRESULT hr;
    dialog_recursive = fDeep;
    hr = StringCchCopy(dialog_leftname, MAX_PATH, left);
  if (FAILED(hr))
    OutputError(hr, IDS_SAFE_COPY);
    hr = StringCchCopy(dialog_rightname, MAX_PATH, right);
  if (FAILED(hr))
    OutputError(hr, IDS_SAFE_COPY);
    SeenDialogNames = TRUE;
}

void complist_togglemark ( COMPLIST cl )

Definition at line 842 of file complist.cpp.

{
    COMPITEM ci;

    if (cl == NULL) {
        return;
    }

    /*
     * traverse the list of compitems copying files as necessary
     */
    for( ci=(COMPITEM)List_First(cl->items);  ci!=NULL;  ci = (COMPITEM)List_Next((LPVOID)ci)) {
        compitem_setmark(ci, !compitem_getmark(ci));

    }
}

Variable Documentation

BOOL bAbort

Definition at line 508 of file sdkdiff.cpp.

BOOL dialog_autocopy

Definition at line 78 of file complist.cpp.

BOOL dialog_fastscan

Definition at line 77 of file complist.cpp.

char dialog_leftname[MAX_PATH]

Definition at line 73 of file complist.cpp.

BOOL dialog_recursive

Definition at line 76 of file complist.cpp.

char dialog_rightname[MAX_PATH]

Definition at line 74 of file complist.cpp.

char dialog_servername[80]

Definition at line 75 of file complist.cpp.

BOOL dlg_differ

Definition at line 70 of file complist.cpp.

char dlg_file[MAX_PATH]

Definition at line 63 of file complist.cpp.

BOOL dlg_identical

Definition at line 70 of file complist.cpp.

BOOL dlg_IgnoreAttributes

Definition at line 86 of file complist.cpp.

BOOL dlg_IgnoreMarks

Definition at line 85 of file complist.cpp.

BOOL dlg_left

Definition at line 70 of file complist.cpp.

UINT dlg_options

Definition at line 84 of file complist.cpp.

BOOL dlg_right

Definition at line 70 of file complist.cpp.

char dlg_root[MAX_PATH]

Definition at line 87 of file complist.cpp.

BOOL dlg_sums = TRUE

Definition at line 64 of file complist.cpp.

BOOL SeenDialogNames = FALSE

Definition at line 67 of file complist.cpp.

Generated on Wed Nov 13 2024 16:53:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/sdkdiff/complist.h File Reference

  • Begin
  • sdkdiff
Defines | Typedefs | Functions

complist.h File Reference

Go to the source code of this file.

Defines

#define | COPY_FROMLEFT 0x100
#define | COPY_FROMRIGHT 0x200
#define | COPY_HITREADONLY 0x400
#define | INC_VIEW_COMPLIST

Typedefs

typedef struct compitem FAR * | COMPITEM
typedef struct complist FAR * | COMPLIST
typedef struct view FAR * | VIEW

Functions

void | complist_append (COMPLIST *pcl, LPCSTR path1, LPCSTR path2, int *psequence)
BOOL | complist_appendfinished (COMPLIST *pcl, LPCSTR pszLeft, LPCSTR pszRight, VIEW view)
COMPLIST | complist_args (LPSTR path1, LPSTR path2, VIEW view, BOOL fDeep)
void | complist_copyfiles (COMPLIST cl, LPSTR newroot, UINT options)
void | complist_delete (COMPLIST cl)
COMPLIST complist_dirdialog (VIEW view)
COMPLIST complist_filedialog (VIEW view)
void | complist_freedescription (COMPLIST cl, LPSTR path)
LPSTR | complist_getdescription (COMPLIST cl)
LIST | complist_getitems (COMPLIST cl)
UINT | complist_itemcount (COMPLIST cl)
BOOL | complist_markpattern (COMPLIST cl)
DWORD | complist_querytime (void)
void | complist_savelist (COMPLIST cl, LPSTR savename, UINT listopts)
void | complist_togglemark (COMPLIST cl)

Define Documentation

#define COPY_FROMLEFT 0x100

Definition at line 123 of file complist.h.

#define COPY_FROMRIGHT 0x200

Definition at line 124 of file complist.h.

#define COPY_HITREADONLY 0x400

Definition at line 125 of file complist.h.

#define INC_VIEW_COMPLIST

Definition at line 43 of file complist.h.

Typedef Documentation

typedef struct compitem FAR* COMPITEM

Definition at line 44 of file complist.h.

typedef struct complist FAR* COMPLIST

Definition at line 46 of file complist.h.

typedef struct view FAR* VIEW

Definition at line 45 of file complist.h.

Function Documentation

void complist_append | ( | COMPLIST * | pcl,
 |  | LPCSTR | path1,
 |  | LPCSTR | path2,
 |  | int * | psequence
 | ) |  |

Definition at line 278 of file complist.cpp.

{
    COMPLIST cl;

    if (!*pcl)
    {
        /* alloc a new complist */
        *pcl = complist_new();
    }
    cl = *pcl;

    dir_appendlist(&cl->left, p1, FALSE, psequence);
    dir_appendlist(&cl->right, p2, FALSE, psequence);
} /* complist_append */

BOOL complist_appendfinished | ( | COMPLIST * | pcl,
 |  | LPCSTR | pszLeft,
 |  | LPCSTR | pszRight,
 |  | VIEW | view
 | ) |  |

Definition at line 299 of file complist.cpp.

{
    BOOL fSuccess = FALSE;
    COMPLIST cl;
    char msg[MAX_PATH+20] = {0};
  HRESULT hr;

    if (!*pcl)
        goto LError;

    cl = *pcl;
    if (!cl->left || !cl->right)
    {
        hr = StringCchCatN(msg, (MAX_PATH+20), LoadRcString(IDS_COULDNT_FIND_ANYTHING), sizeof(msg)-1);
    if (FAILED(hr))
      OutputError(hr, IDS_SAFE_CAT);
        TRACE_ERROR(msg, FALSE);
        goto LError;
    }

    dir_setdescription(cl->left, pszLeft);
    dir_setdescription(cl->right, pszRight);

    if (!TrackLeftOnly)
        dir_setotherdirlist(cl->left, cl->right);
    if (!TrackRightOnly)
        dir_setotherdirlist(cl->right, cl->left);

    /* register with the view (must be done after building lists) */
    view_setcomplist(view, cl);

    complist_match(cl, view, FALSE, TRUE);

    fSuccess = TRUE;

LError:
    return fSuccess;
}

COMPLIST complist_args | ( | LPSTR | path1,
 |  | LPSTR | path2,
 |  | VIEW | view,
 |  | BOOL | fDeep
 | ) |  |

Definition at line 207 of file complist.cpp.

{
    COMPLIST cl;
    char msg[MAX_PATH+20];
  HRESULT hr;

    /* alloc a new complist */
    cl = complist_new();

    //
    // accept \\server!path for a checksum server and
    // pathname - assumes no \\server\share names have !
    // within the server name.
    {
        cl->left = dir_buildlist(p1, FALSE, TRUE);
    }
    /* check that we could find the paths, and report if not */
    if (cl->left == NULL) {
        hr = StringCchPrintf(msg, (MAX_PATH+20), LoadRcString(IDS_COULDNT_FIND), p1);
    if (FAILED(hr))
      OutputError(hr, IDS_SAFE_PRINTF);
        TRACE_ERROR(msg, FALSE);
        complist_delete(cl);
        cl = NULL;
        goto LError;
    }
    {
        cl->right = dir_buildlist(p2, FALSE, TRUE);
    }
    /* check that we could find the paths, and report if not */
    if (cl->right == NULL) {
        hr = StringCchPrintf(msg, (MAX_PATH+20), LoadRcString(IDS_COULDNT_FIND), p2);
    if (FAILED(hr))
      OutputError(hr, IDS_SAFE_PRINTF);
        TRACE_ERROR(msg, FALSE);
        complist_delete(cl);
        cl = NULL;
        goto LError;
    }

    if (!TrackLeftOnly) {
        dir_setotherdirlist(cl->left, cl->right);
    }
    if (!TrackRightOnly) {
        dir_setotherdirlist(cl->right, cl->left);
    }
    {
        // remember these paths as defaults for the next dialog -
        // get the normalised, absolute paths
        LPSTR pleft = dir_getrootdescription(cl->left);
        LPSTR pright = dir_getrootdescription(cl->right);
        complist_setdialogdefault(pleft, pright, fDeep);
        dir_freerootdescription(cl->left, pleft);
        dir_freerootdescription(cl->right, pright);
    }

    /* register with the view (must be done after building lists) */
    view_setcomplist(view, cl);

    complist_match(cl, view, fDeep, TRUE);

LError:
    return(cl);
} /* complist_args */

void complist_copyfiles | ( | COMPLIST | cl,
 |  | LPSTR | newroot,
 |  | UINT | options
 | ) |  |

Definition at line 619 of file complist.cpp.

{
    int nFiles = 0;
    int nFails = 0;
    static BOOL done_init = FALSE;
    LPSTR pstr;
    char buffer[MAX_PATH+20];
    DIRITEM diritem;
    DLGPROC lpProc;
    BOOL bOK;
    COMPITEM ci;
    int state;
    BOOL HitReadOnly = ((options&COPY_HITREADONLY)==COPY_HITREADONLY);
    BOOL CopyNoAttributes;
  HRESULT hr;

    if (!done_init) {
        /*
         * one-time initialisation of dialog defaults
         */
        dlg_options = COPY_FROMLEFT|INCLUDE_LEFTONLY|INCLUDE_DIFFER;
        dlg_root[0] = '\0';

        // set the ignore-marked files option by default the same
        // as the hide mark files menu option. If he doesn't want them
        // visible, he probably doesn't want them copied.
        dlg_IgnoreMarks = hide_markedfiles;

        done_init = TRUE;
    }

    if (cl == NULL) {
        return;
    }

    if (newroot == NULL) {
        /*
         * put up dialog to query rootname and options
         */

        /* store the left and right rootnames so that the dlg proc
         * can display them in the dialog.
         */
        pstr = dir_getrootdescription(cl->left);
        hr = StringCchCopy(dialog_leftname, MAX_PATH, pstr);
    if(FAILED(hr))
      OutputError(hr, IDS_SAFE_COPY);
        dir_freerootdescription(cl->left, pstr);

        pstr = dir_getrootdescription(cl->right);
        hr = StringCchCopy(dialog_rightname, MAX_PATH, pstr);
        if(FAILED(hr))
      OutputError(hr, IDS_SAFE_COPY);
    dir_freerootdescription(cl->right, pstr);

        do {
            lpProc = (DLGPROC)MakeProcInstance((WINPROCTYPE)complist_dodlg_copyfiles, hInst);
            sdkdiff_UI(TRUE);
            bOK = (BOOL)DialogBox(hInst, "CopyFiles", hwndClient, lpProc);
            sdkdiff_UI(FALSE);
            FreeProcInstance(lpProc);

            if (!bOK) {
                /* user cancelled from dialog box */
                return;
            }
            if (lstrlen(dlg_root) == 0) {
                sdkdiff_UI(TRUE);
                MessageBox( hwndClient, LoadRcString(IDS_ENTER_DIR_NAME),
                            "Sdkdiff", MB_ICONSTOP|MB_OK);
                sdkdiff_UI(FALSE);
            }
        } while (lstrlen(dlg_root) == 0);

    } else {
        // no dialog - all options passed in (eg from command line).
        // note that in this case the dlg_IgnoreMarks is left as
        // whatever the hide_markedfiles menu option is set to.
        dlg_options = options;
        hr = StringCchCopy(dlg_root, MAX_PATH, newroot);
    if(FAILED(hr))
      OutputError(hr, IDS_SAFE_COPY);
    }

    TickCount = GetTickCount();

    /* this relies on the sumserver, server and share (if any) being the same for
       all the things on the list.  We set up the first one and then just check
       that it doesn't change (within ss_client).  If it turns out to be a local
       copy these things turn into no-ops somewhere below us.
    */
    if (dlg_options & COPY_FROMLEFT) {
        if (!dir_startcopy(cl->left))
            return;
    } else {
        if (!dir_startcopy(cl->right))
            return;
    }

    CopyNoAttributes = dlg_IgnoreAttributes;

    /*
     * traverse the list of compitems copying files as necessary
     */
    for( ci=(COMPITEM)List_First(cl->items);  ci!=NULL;  ci = (COMPITEM)List_Next((LPVOID)ci)) {
        if (bAbort) {
            break;  /* fall into end_copy processing */
        }

        // ignore marked files totally if the option was
        // set in the dialog.
        if (dlg_IgnoreMarks && compitem_getmark(ci)) {
            continue;
        }

        /* check if files of this type are to be copied */
        state = compitem_getstate(ci);

        if ((state == STATE_SAME) && !(dlg_options & INCLUDE_SAME)) {
            continue;
        } else if ((state == STATE_DIFFER) && !(dlg_options & INCLUDE_DIFFER)) {
            continue;
        } else if (state == STATE_FILELEFTONLY) {
            if (dlg_options & COPY_FROMRIGHT) {
                continue;
            }
            if ((dlg_options & (INCLUDE_LEFTONLY | INCLUDE_RIGHTONLY)) == 0) {
                continue;
            }
        } else if (state == STATE_FILERIGHTONLY) {
            if (dlg_options & COPY_FROMLEFT) {
                continue;
            }
            if ((dlg_options & (INCLUDE_LEFTONLY | INCLUDE_RIGHTONLY)) == 0) {
                continue;
            }
        }

        if (dlg_options & COPY_FROMLEFT) {
            diritem = file_getdiritem(compitem_getleftfile(ci));
        } else {
            diritem = file_getdiritem(compitem_getrightfile(ci));
        }

        /*
         * copy the file to the new root directory
         */
        if (dir_copy(diritem, dlg_root, HitReadOnly, CopyNoAttributes) == FALSE) {
            nFails++;
            pstr = dir_getrelname(diritem);
            hr = StringCchPrintf(buffer, (MAX_PATH+20), LoadRcString(IDS_FAILED_TO_COPY), pstr);
      if(FAILED(hr))
        OutputError(hr, IDS_SAFE_PRINTF);
            dir_freerelname(diritem, pstr);

            if (!TRACE_ERROR(buffer, TRUE)) {
                /* user pressed cancel - abort current operation*/
                /* fall through to end-copy processing */
                break;
            }

        } else {
            nFiles++;
        }

        hr = StringCchPrintf(buffer, (MAX_PATH+20), LoadRcString(IDS_COPYING), nFiles);
    if(FAILED(hr))
      OutputError(hr, IDS_SAFE_PRINTF);
        SetStatus(buffer);

        /*
         * allow user interface to continue
         */
        if (Poll()) {
            /* abort requested */
            TickCount = GetTickCount()-TickCount;
            sdkdiff_UI(TRUE);
            MessageBox(hwndClient, LoadRcString(IDS_COPY_ABORTED),
                       "SdkDiff", MB_OK|MB_ICONINFORMATION);
            sdkdiff_UI(FALSE);
            break;
        }

    } /* traverse */
    hr = StringCchPrintf(buffer, (MAX_PATH+20), LoadRcString(IDS_COPYING_NFILES), nFiles);
  if(FAILED(hr))
    OutputError(hr, IDS_SAFE_PRINTF);
    SetStatus(buffer);
    if (dlg_options & COPY_FROMLEFT) {
        nFails = dir_endcopy(cl->left);
    } else {
        nFails = dir_endcopy(cl->right);
    }
    TickCount = GetTickCount()-TickCount;

    if (nFails<0) {
        hr = StringCchPrintf(buffer, (MAX_PATH+20), LoadRcString(IDS_COPY_FAILED), -nFails);
    if(FAILED(hr))
      OutputError(hr, IDS_SAFE_PRINTF);
    } else {
        hr = StringCchPrintf(buffer, (MAX_PATH+20), LoadRcString(IDS_COPY_COMPLETE), nFails);
    if(FAILED(hr))
      OutputError(hr, IDS_SAFE_PRINTF);
    }
    sdkdiff_UI(TRUE);
    MessageBox(hwndClient, buffer, "SdkDiff", MB_OK|MB_ICONINFORMATION);
    sdkdiff_UI(FALSE);

    buffer[0] = '\0';
    SetStatus(buffer);
} /* complist_copyfiles */

void complist_delete ( COMPLIST cl )

Definition at line 355 of file complist.cpp.

{
    COMPITEM item;

    if (cl == NULL) {
        return;
    }

    /* delete the two directory scan lists */
    dir_delete(cl->left);
    dir_delete(cl->right);

    /* delete the compitems in the list */
  for( item=(COMPITEM)List_First(cl->items);  item!=NULL;  item = (COMPITEM)List_Next((LPVOID)item)) {
        compitem_delete(item);
    }

    /* delete the list itself */
    List_Destroy(&cl->items);

    HeapFree(GetProcessHeap(), NULL, (LPSTR) cl);

}

COMPLIST complist_dirdialog ( VIEW view )

Definition at line 181 of file complist.cpp.

{
    DLGPROC lpProc;
    BOOL fOK;

    /* put up a dialog for the two pathnames */
    lpProc = (DLGPROC)MakeProcInstance((WINPROCTYPE)complist_dodlg_dir, hInst);
    sdkdiff_UI(TRUE);
    fOK = (BOOL)DialogBox(hInst, "Directory", hwndClient, lpProc);
    sdkdiff_UI(FALSE);
    FreeProcInstance(lpProc);

    if (!fOK) {
        return(NULL);
    }

    return complist_args( dialog_leftname, dialog_rightname
                          , view, dialog_recursive );
} /* complist_dirdialog */

COMPLIST complist_filedialog ( VIEW view )

Definition at line 112 of file complist.cpp.

{
    COMPLIST cl = NULL;
    char szPath1[MAX_PATH * 2];
    char szPath2[MAX_PATH * 2];
    char fname[MAX_PATH], FileExt[5], FileOpenSpec[15];
  HRESULT hr;

    /* ask for the filenames - using gfile standard dialogs */
    hr = StringCchCopy(FileExt, 5, ".c");
  if (FAILED(hr)) {
    OutputError(hr, IDS_SAFE_COPY);
    goto LError;
  }
    hr = StringCchCopy(FileOpenSpec, 5, "*.*");
  if (FAILED(hr)) {
    OutputError(hr, IDS_SAFE_COPY);
    goto LError;
  }
    if (!gfile_open(hwndClient, LoadRcString(IDS_SELECT_FIRST_FILE), FileExt, FileOpenSpec, szPath1, NUMELMS(szPath1), fname) ){
        goto LError;
    }

    if (!gfile_open(hwndClient, LoadRcString(IDS_SELECT_SECOND_FILE), FileExt, FileOpenSpec, szPath2, NUMELMS(szPath2), fname) ){
        goto LError;
    }

    /* alloc a new structure */
    cl = complist_new();

    cl->left = dir_buildlist(szPath1, FALSE, TRUE);
    cl->right = dir_buildlist(szPath2, FALSE, TRUE);

    /* register with the view (must be done after the list is non-null) */
    view_setcomplist(view, cl);

    complist_match(cl, view, FALSE, TRUE);

LError:
    return(cl);
}/* complist_filedialog */

void complist_freedescription | ( | COMPLIST | cl,
 |  | LPSTR | path
 | ) |  |

Definition at line 1061 of file complist.cpp.

{
    HeapFree(GetProcessHeap(), NULL, desc);
}

LPSTR complist_getdescription ( COMPLIST cl )

Definition at line 1025 of file complist.cpp.

{
    LPSTR pl;
    LPSTR pr;
    LPSTR desc = 0;

    pl = dir_getrootdescription(cl->left);
    pr = dir_getrootdescription(cl->right);

    if (pl && pr)
    {
        /*
         * allow for space-colon-space and null when sizing
         */
        desc = (char*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, lstrlen(pl) + lstrlen(pr) + 4);
        if (desc == NULL)
      return NULL;
    HRESULT hr = StringCchPrintf(desc, (lstrlen(pl)+lstrlen(pr)+4), "%s : %s", pl, pr);
    if(FAILED(hr)) {
      OutputError(hr, IDS_SAFE_PRINTF);
      return NULL;
    }
    }

    dir_freerootdescription(cl->left, pl);
    dir_freerootdescription(cl->right, pr);

    return(desc);
}

LIST complist_getitems ( COMPLIST cl )

Definition at line 342 of file complist.cpp.

{
    if (cl == NULL) {
        return(NULL);
    }

    return(cl->items);
}

UINT complist_itemcount ( COMPLIST cl )

Definition at line 866 of file complist.cpp.

{
    UINT n = 0;

    if (cl == NULL) {
        return 0;
    }

    /*
     * return the number of compitems in the list
     */
    return List_Card(cl->items);
}

BOOL complist_markpattern ( COMPLIST cl )

Definition at line 979 of file complist.cpp.

{
    COMPITEM ci;
    char achPattern[MAX_PATH];
    BOOL bOK = FALSE;
    LPSTR ptag;
    TCHAR   szBuff[40];

    HRESULT hr = StringCchCopy(szBuff,40, LoadRcString(IDS_MARK_FILES));
  if(FAILED(hr))
      OutputError(hr, IDS_SAFE_COPY);

    sdkdiff_UI(TRUE);
    bOK = StringInput(achPattern, sizeof(achPattern), LoadRcString(IDS_ENTER_SUBSTRING2),
            szBuff, "obj");
    sdkdiff_UI(FALSE);

    if (!bOK) {
        return(FALSE);
    }

    bOK = FALSE;

  for( ci=(COMPITEM)List_First(cl->items);  ci!=NULL;  ci = (COMPITEM)List_Next((LPVOID)ci)) {
        ptag = compitem_gettext_tag(ci);
        if (strstr(ptag, achPattern) != NULL) {
            if (!compitem_getmark(ci)) {
                bOK = TRUE;
                compitem_setmark(ci, TRUE);
            }

        }
    }

    return(bOK);
}

DWORD complist_querytime ( void )

Definition at line 1305 of file complist.cpp.

{       return TickCount;
}

void complist_savelist | ( | COMPLIST | cl,
 |  | LPSTR | savename,
 |  | UINT | listopts
 | ) |  |

Definition at line 390 of file complist.cpp.

{
    DLGPROC lpProc;
    static BOOL done_init = FALSE;
    BOOL bOK;
    HANDLE fh;
    DWORD cbWritten;
    int state;
    char msg[2*MAX_PATH+100] = {0};
    HCURSOR hcurs;
    COMPITEM ci;
    LPSTR pstr, lhead;
    int nFiles = 0;
  HRESULT hr;

    if (!done_init) {
        /* init the options once round - but keep the same options
         * for the rest of the session.
         */

        /* first init default options */
        dlg_identical = (outline_include & INCLUDE_SAME);
        dlg_differ = (outline_include & INCLUDE_LEFTONLY);
        dlg_left = (outline_include & INCLUDE_RIGHTONLY);
        dlg_right = (outline_include & INCLUDE_DIFFER);
        dlg_IgnoreMarks = hide_markedfiles;

        dlg_file[0] = '\0';

        done_init = TRUE;
    }

    if (cl == NULL) {
        return;
    }

    if (savename == NULL) {

        /* store the left and right rootnames so that dodlg_savelist
         * can display them in the dialog.
         */
        pstr = dir_getrootdescription(cl->left);
        hr = StringCchCopy(dialog_leftname, MAX_PATH, pstr);
    if (FAILED(hr))
      OutputError(hr, IDS_SAFE_COPY);
        dir_freerootdescription(cl->left, pstr);

        pstr = dir_getrootdescription(cl->right);
        hr = StringCchCopy(dialog_rightname, MAX_PATH, pstr);
    if (FAILED(hr))
      OutputError(hr, IDS_SAFE_COPY);
        dir_freerootdescription(cl->right, pstr);

        lpProc = (DLGPROC)MakeProcInstance((WINPROCTYPE)complist_dodlg_savelist, hInst);
        sdkdiff_UI(TRUE);
        bOK = (BOOL)DialogBox(hInst, "SaveList", hwndClient, lpProc);
        sdkdiff_UI(FALSE);
        FreeProcInstance(lpProc);

        if (!bOK) {
            /* user cancelled from dialog box */
            return;
        }
        savename = dlg_file;

    } else {
        dlg_identical = (options & INCLUDE_SAME);
        dlg_differ = (options & INCLUDE_DIFFER);
        dlg_left = (options & INCLUDE_LEFTONLY);
        dlg_right = (options & INCLUDE_RIGHTONLY);
        GetFullPathName(savename, sizeof(dlg_file), dlg_file, NULL);
    }

    /* try to open the file */
    fh = CreateFile(savename, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, 0, NULL);
    if (fh == INVALID_HANDLE_VALUE) {
        hr = StringCchPrintf(msg, (2*MAX_PATH+100),LoadRcString(IDS_CANT_OPEN), savename);
        if (FAILED(hr))
      OutputError(hr, IDS_SAFE_PRINTF);
    sdkdiff_UI(TRUE);
        MessageBox(hwndClient, msg, "Sdkdiff", MB_ICONSTOP|MB_OK);
        sdkdiff_UI(FALSE);
        return;
    }

    hcurs = SetCursor(LoadCursor(NULL, IDC_WAIT));

    /* write out the header line */
    lhead = complist_getdescription(cl);
    {
        TCHAR szBuf1[20],szBuf2[20],szBuf3[20],szBuf4[20];
        hr = StringCchCopy(szBuf1,20,(LPSTR)(dlg_identical ? LoadRcString(IDS_IDENTICAL_COMMA) : ""));
    if(FAILED(hr))
      OutputError(hr, IDS_SAFE_COPY);
        hr = StringCchCopy(szBuf2,20,(LPSTR)(dlg_left ? LoadRcString(IDS_LEFT_ONLY_COMMA) : ""));
        if(FAILED(hr))
      OutputError(hr, IDS_SAFE_COPY);
    hr = StringCchCopy(szBuf3,20,(LPSTR)(dlg_right ? LoadRcString(IDS_RIGHT_ONLY_COMMA) : ""));
        if(FAILED(hr))
      OutputError(hr, IDS_SAFE_COPY);
    hr = StringCchCopy(szBuf4,20,(LPSTR)(dlg_differ ? LoadRcString(IDS_DIFFERING) : ""));
        if(FAILED(hr))
      OutputError(hr, IDS_SAFE_COPY);
    hr = StringCchPrintf(msg, (2*MAX_PATH+100), LoadRcString(IDS_HEADER_LINE_STR),
                lhead, szBuf1, szBuf2, szBuf3, szBuf4);
    if(FAILED(hr))
      OutputError(hr, IDS_SAFE_PRINTF);
    }
    WriteFile(fh, msg, lstrlen(msg), &cbWritten, NULL);
    complist_freedescription(cl, lhead);

    /* traverse the list of compitems looking for the
     * ones we are supposed to include
     */
    for( ci=(COMPITEM)List_First(cl->items);  ci!=NULL;  ci = (COMPITEM)List_Next((LPVOID)ci)) {
        /* check if files of this type are to be listed */
        state = compitem_getstate(ci);

        if ((state == STATE_SAME) && (!dlg_identical)) {
            continue;
        } else if ((state == STATE_DIFFER) && (!dlg_differ)) {
            continue;
        } else if ((state == STATE_FILELEFTONLY) && (!dlg_left)) {
            continue;
        } else if ((state == STATE_FILERIGHTONLY) && (!dlg_right)) {
            continue;
        }
        if (dlg_IgnoreMarks && compitem_getmark(ci)) {
            continue;
        }

        nFiles++;

        /* output the list line */
        ZeroMemory(msg, sizeof(msg));
        hr = StringCchCatN(msg, (2*MAX_PATH+100), compitem_gettext_tag(ci), sizeof(msg) - 1);
        if(FAILED(hr))
      OutputError(hr, IDS_SAFE_CAT);
    WriteFile(fh, msg, lstrlen(msg), &cbWritten, NULL);

        /* write out the result of the comparison */
        {       LPSTR p;
            p = compitem_gettext_result(ci);
            hr = StringCchPrintf( msg, (2*MAX_PATH+100), "\t%s"
                      , p ? p : "sdkdiff error"
                    );
      if(FAILED(hr))
        OutputError(hr, IDS_SAFE_PRINTF);
        }
        WriteFile(fh, msg, lstrlen(msg), &cbWritten, NULL);

        if (dlg_sums) {
            if (compitem_getleftfile(ci) != NULL) {
                BOOL bValid;
                DWORD cksum;
                cksum = file_retrievechecksum(compitem_getleftfile(ci),&bValid);

        if (bValid) {
          hr = StringCchPrintf(msg, (2*MAX_PATH+100), "\t%8lx", cksum);
          if (FAILED(hr))
            OutputError(hr, IDS_SAFE_PRINTF);
        }
        else {
          hr = StringCchPrintf(msg, (2*MAX_PATH+100), "\t????????");
          if(FAILED(hr))
            OutputError(hr, IDS_SAFE_PRINTF);
        }
            } else {
                hr = StringCchPrintf(msg, (2*MAX_PATH+100), "\t--------");
        if(FAILED(hr))
          OutputError(hr, IDS_SAFE_PRINTF);
            }
            WriteFile(fh, msg, lstrlen(msg), &cbWritten, NULL);

            if (compitem_getrightfile(ci) != NULL) {
                BOOL bValid;
                DWORD cksum;
                cksum = file_retrievechecksum(compitem_getrightfile(ci),&bValid);
        if (bValid) {
          hr = StringCchPrintf(msg, (2*MAX_PATH+100), "\t%8lx", cksum);
          if(FAILED(hr))
            OutputError(hr, IDS_SAFE_PRINTF);
        }
        else {
          hr = StringCchPrintf(msg, (2*MAX_PATH+100), "\t????????");
          if(FAILED(hr))
            OutputError(hr, IDS_SAFE_PRINTF);
        }
            } else {
                hr = StringCchPrintf(msg, (2*MAX_PATH+100), "\t--------");
        if(FAILED(hr))
          OutputError(hr, IDS_SAFE_PRINTF);
            }
            WriteFile(fh, msg, lstrlen(msg), &cbWritten, NULL);

        }

        hr = StringCchPrintf(msg, (2*MAX_PATH+100), "\r\n");
    if(FAILED(hr))
      OutputError(hr, IDS_SAFE_PRINTF);
        WriteFile(fh, msg, (DWORD)strlen(msg), &cbWritten, NULL);
  }

    /* write tail line */
    hr = StringCchPrintf(msg, (2*MAX_PATH+100), LoadRcString(IDS_FILES_LISTED), nFiles);
  if(FAILED(hr))
      OutputError(hr, IDS_SAFE_PRINTF);
    WriteFile(fh, msg, (DWORD)lstrlen(msg), &cbWritten, NULL);

    /* - close file and we are finished */
    CloseHandle(fh);

    SetCursor(hcurs);
} /* complist_savelist */

void complist_togglemark ( COMPLIST cl )

Definition at line 842 of file complist.cpp.

{
    COMPITEM ci;

    if (cl == NULL) {
        return;
    }

    /*
     * traverse the list of compitems copying files as necessary
     */
    for( ci=(COMPITEM)List_First(cl->items);  ci!=NULL;  ci = (COMPITEM)List_Next((LPVOID)ci)) {
        compitem_setmark(ci, !compitem_getmark(ci));

    }
}

Generated on Wed Nov 13 2024 16:53:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/sdkdiff/ErrorOut.cpp File Reference

  • Begin
  • sdkdiff
Functions

ErrorOut.cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

void OutputError (HRESULT hr, LPCSTR operation)

Function Documentation

void OutputError | ( | HRESULT | hr,
 |  | LPCSTR | operation
 | ) |  |

Definition at line 4 of file ErrorOut.cpp.

                                               {
  TCHAR error_string[ERROR_MAX];
  TCHAR error_code[ERROR_LENGTH];

  memset(error_string, 0, ERROR_MAX);
  memset(error_code, 0, ERROR_LENGTH);

  switch(hr) {
    case STRSAFE_E_INSUFFICIENT_BUFFER:
      if (FAILED(StringCchCopy(error_code, ERROR_LENGTH, "insufficient buffer")))
        return;
      break;
    case STRSAFE_E_INVALID_PARAMETER:
      if (FAILED(StringCchCopy(error_code, ERROR_LENGTH, "invalid parameter")))
        return;
      break;
    case STRSAFE_E_END_OF_FILE:
      if (FAILED(StringCchCopy(error_code, ERROR_LENGTH, "encountering end of file")))
        return;
      break;
  }

  if (0 != error_code[0]) {
    if (FAILED(StringCchPrintf(error_string, ERROR_MAX, "Unable to perform %s due to %s.\n", operation, error_code)))
      return;
  }
  else
    if (FAILED(StringCchPrintf(error_string, ERROR_MAX, "Unable to perform %s.\n", operation)))
      return;

  OutputDebugString(error_string);
  return;
}

Generated on Wed Nov 13 2024 16:53:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/sdkdiff/ErrorOut.h File Reference

  • Begin
  • sdkdiff
Defines | Functions

ErrorOut.h File Reference

Go to the source code of this file.

Defines

#define | ERROR_LENGTH 25
#define | ERROR_MAX 256
#define | IDS_SAFE_CAT "safe string concatenation"
#define | IDS_SAFE_COPY "safe string copy"
#define | IDS_SAFE_PRINTF "safe string printf"

Functions

void | OutputError (HRESULT hr, LPCSTR operation)

Define Documentation

#define ERROR_LENGTH 25

Definition at line 7 of file ErrorOut.h.

#define ERROR_MAX 256

Definition at line 8 of file ErrorOut.h.

#define IDS_SAFE_CAT "safe string concatenation"

Definition at line 11 of file ErrorOut.h.

#define IDS_SAFE_COPY "safe string copy"

Definition at line 10 of file ErrorOut.h.

#define IDS_SAFE_PRINTF "safe string printf"

Definition at line 9 of file ErrorOut.h.

Function Documentation

void OutputError | ( | HRESULT | hr,
 |  | LPCSTR | operation
 | ) |  |

Definition at line 4 of file ErrorOut.cpp.

                                               {
  TCHAR error_string[ERROR_MAX];
  TCHAR error_code[ERROR_LENGTH];

  memset(error_string, 0, ERROR_MAX);
  memset(error_code, 0, ERROR_LENGTH);

  switch(hr) {
    case STRSAFE_E_INSUFFICIENT_BUFFER:
      if (FAILED(StringCchCopy(error_code, ERROR_LENGTH, "insufficient buffer")))
        return;
      break;
    case STRSAFE_E_INVALID_PARAMETER:
      if (FAILED(StringCchCopy(error_code, ERROR_LENGTH, "invalid parameter")))
        return;
      break;
    case STRSAFE_E_END_OF_FILE:
      if (FAILED(StringCchCopy(error_code, ERROR_LENGTH, "encountering end of file")))
        return;
      break;
  }

  if (0 != error_code[0]) {
    if (FAILED(StringCchPrintf(error_string, ERROR_MAX, "Unable to perform %s due to %s.\n", operation, error_code)))
      return;
  }
  else
    if (FAILED(StringCchPrintf(error_string, ERROR_MAX, "Unable to perform %s.\n", operation)))
      return;

  OutputDebugString(error_string);
  return;
}

Generated on Wed Nov 13 2024 16:53:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/sdkdiff/file.cpp File Reference

  • Begin
  • sdkdiff
Classes | Functions | Variables

file.cpp File Reference

#include "precomp.h"
#include "sdkdiff.h"
#include "list.h"
#include "line.h"
#include "scandir.h"
#include "file.h"
#include "wdiffrc.h"

Go to the source code of this file.

Classes

struct | filedata

Functions

DWORD | file_checksum (FILEDATA fd)
void | file_delete (FILEDATA fd)
void | file_discardlines (FILEDATA fd)
DIRITEM | file_getdiritem (FILEDATA fd)
LIST | file_getlinelist (FILEDATA fd)
FILETIME | file_GetTime (FILEDATA fd)
BOOL | file_IsUnicode (FILEDATA fd)
FILEDATA | file_new (DIRITEM fiName, BOOL bRead)
void | file_readlines (FILEDATA fd)
void | file_reset (FILEDATA fd)
DWORD | file_retrievechecksum (FILEDATA fd, BOOL *bValid)

Variables

HANDLE hHeap

Function Documentation

DWORD file_checksum ( FILEDATA fd )

Definition at line 195 of file file.cpp.

{
    return(dir_getchecksum(fd->diritem));
}

void file_delete ( FILEDATA fd )

Definition at line 103 of file file.cpp.

{
    if (fd == NULL) {
        return;
    }

    /* throw away the line list, if there is one */
    file_discardlines(fd);

    HeapFree(GetProcessHeap(), NULL, fd);
}

void file_discardlines ( FILEDATA fd )

Definition at line 145 of file file.cpp.

{
    LINE line;

    if (fd == NULL) {
        return;
    }

    if (fd->lines != NULL) {

        /* clear each line to free any memory associated
         * with them, then discard the entire list
         */
    for( line=(LINE)List_First(fd->lines);  line!=NULL;  line = (LINE)List_Next((LPVOID)line)) {
            line_delete(line);
        }
        List_Destroy(&fd->lines);
    }

    /* this is probably done in List_Destroy, but better do it anyway*/
    fd->lines = NULL;
}

DIRITEM file_getdiritem ( FILEDATA fd )

Definition at line 87 of file file.cpp.

{
    if (fd == NULL) {
        return(NULL);
    }

    return(fd->diritem);
}

LIST file_getlinelist ( FILEDATA fd )

Definition at line 127 of file file.cpp.

{
    if (fd == NULL) {
        return NULL;
    }

    if (fd->lines == NULL) {
        file_readlines(fd);
    }
    return(fd->lines);
}

FILETIME file_GetTime ( FILEDATA fd )

Definition at line 219 of file file.cpp.

{  return dir_GetFileTime(fd->diritem);
}

BOOL file_IsUnicode ( FILEDATA fd )

Definition at line 287 of file file.cpp.

{
    return fd->fUnicode;
}

FILEDATA file_new | ( | DIRITEM | fiName,
 |  | BOOL | bRead
 | ) |  |

Definition at line 64 of file file.cpp.

{
    FILEDATA fd;

    fd = (FILEDATA) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct filedata));
    if (fd == NULL) {
        return(NULL);
    }

    fd->diritem = fiName;
    fd->lines = NULL;

    if (bRead) {
        file_readlines(fd);
    }

    return(fd);
}

void file_readlines ( FILEDATA fd )

Definition at line 237 of file file.cpp.

{
    LPSTR textp;
    LPWSTR pwzText;
    int cwch;
    HANDLE fh;
    FILEBUFFER fbuf;
    int linelen;
    int linenr = 1;
    HCURSOR hcurs;

    hcurs = SetCursor(LoadCursor(NULL, IDC_WAIT));

    /* open the file */
    fh = dir_openfile(fd->diritem);

    if (fh == INVALID_HANDLE_VALUE) {
        TRACE_ERROR(LoadRcString(IDS_ERR_OPENING_FILE), FALSE);
        SetCursor(hcurs);
        return;
    }
    /* initialise the file buffering */
    fbuf = readfile_new(fh, &fd->fUnicode);

    if (fbuf)
    {
        /* make an empty list for the files */
        fd->lines = List_Create();

        while ( (textp = readfile_next(fbuf, &linelen, &pwzText, &cwch)) != NULL) {
            if (linelen>0) { /* readfile failure gives linelen==-1 */
                line_new(textp, linelen, pwzText, cwch, linenr++, fd->lines);
            } else {
                line_new("!! <unreadable> !!", 20, NULL, 0, linenr++,fd->lines);
                break;
            }

        }

        /* close filehandle and free buffer */
        readfile_delete(fbuf);
    }

    dir_closefile(fd->diritem, fh);

    SetCursor(hcurs);
}

void file_reset ( FILEDATA fd )

Definition at line 175 of file file.cpp.

{
    LINE line;

    if (fd == NULL) {
        return;
    }

    if (fd->lines != NULL) {
    for( line=(LINE)List_First(fd->lines);  line!=NULL;  line =(LINE) List_Next((LPVOID)line)) {
            line_reset(line);
        }
    }
}

DWORD file_retrievechecksum | ( | FILEDATA | fd,
 |  | BOOL * | bValid
 | ) |  |

Definition at line 206 of file file.cpp.

{
    if (dir_validchecksum(fd->diritem)) {
        *bValid = TRUE;
        return dir_getchecksum(fd->diritem);
    } else {
        *bValid = FALSE;
        return 0;
    }
} /* file_retrievechecksum */

Variable Documentation

HANDLE hHeap

Definition at line 94 of file FaxSiren.Cpp.

Generated on Wed Nov 13 2024 16:53:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/sdkdiff/file.h File Reference

  • Begin
  • sdkdiff
Typedefs | Functions

file.h File Reference

Go to the source code of this file.

Typedefs

typedef struct filedata FAR * | FILEDATA

Functions

DWORD | file_checksum (FILEDATA fi)
void | file_delete (FILEDATA fi)
void | file_discardlines (FILEDATA fi)
DIRITEM | file_getdiritem (FILEDATA fi)
LIST | file_getlinelist (FILEDATA fi)
FILETIME | file_GetTime (FILEDATA fd)
BOOL | file_IsUnicode (FILEDATA fd)
FILEDATA | file_new (DIRITEM fiName, BOOL bRead)
void | file_reset (FILEDATA fi)
DWORD | file_retrievechecksum (FILEDATA fi, BOOL *bValid)

Typedef Documentation

typedef struct filedata FAR* FILEDATA

Definition at line 26 of file file.h.

Function Documentation

DWORD file_checksum ( FILEDATA fi )

Definition at line 195 of file file.cpp.

{
    return(dir_getchecksum(fd->diritem));
}

void file_delete ( FILEDATA fi )

Definition at line 103 of file file.cpp.

{
    if (fd == NULL) {
        return;
    }

    /* throw away the line list, if there is one */
    file_discardlines(fd);

    HeapFree(GetProcessHeap(), NULL, fd);
}

void file_discardlines ( FILEDATA fi )

Definition at line 145 of file file.cpp.

{
    LINE line;

    if (fd == NULL) {
        return;
    }

    if (fd->lines != NULL) {

        /* clear each line to free any memory associated
         * with them, then discard the entire list
         */
    for( line=(LINE)List_First(fd->lines);  line!=NULL;  line = (LINE)List_Next((LPVOID)line)) {
            line_delete(line);
        }
        List_Destroy(&fd->lines);
    }

    /* this is probably done in List_Destroy, but better do it anyway*/
    fd->lines = NULL;
}

DIRITEM file_getdiritem ( FILEDATA fi )

Definition at line 87 of file file.cpp.

{
    if (fd == NULL) {
        return(NULL);
    }

    return(fd->diritem);
}

LIST file_getlinelist ( FILEDATA fi )

Definition at line 127 of file file.cpp.

{
    if (fd == NULL) {
        return NULL;
    }

    if (fd->lines == NULL) {
        file_readlines(fd);
    }
    return(fd->lines);
}

FILETIME file_GetTime ( FILEDATA fd )

Definition at line 219 of file file.cpp.

{  return dir_GetFileTime(fd->diritem);
}

BOOL file_IsUnicode ( FILEDATA fd )

Definition at line 287 of file file.cpp.

{
    return fd->fUnicode;
}

FILEDATA file_new | ( | DIRITEM | fiName,
 |  | BOOL | bRead
 | ) |  |

Definition at line 64 of file file.cpp.

{
    FILEDATA fd;

    fd = (FILEDATA) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct filedata));
    if (fd == NULL) {
        return(NULL);
    }

    fd->diritem = fiName;
    fd->lines = NULL;

    if (bRead) {
        file_readlines(fd);
    }

    return(fd);
}

void file_reset ( FILEDATA fi )

Definition at line 175 of file file.cpp.

{
    LINE line;

    if (fd == NULL) {
        return;
    }

    if (fd->lines != NULL) {
    for( line=(LINE)List_First(fd->lines);  line!=NULL;  line =(LINE) List_Next((LPVOID)line)) {
            line_reset(line);
        }
    }
}

DWORD file_retrievechecksum | ( | FILEDATA | fi,
 |  | BOOL * | bValid
 | ) |  |

Definition at line 206 of file file.cpp.

{
    if (dir_validchecksum(fd->diritem)) {
        *bValid = TRUE;
        return dir_getchecksum(fd->diritem);
    } else {
        *bValid = FALSE;
        return 0;
    }
} /* file_retrievechecksum */

Generated on Wed Nov 13 2024 16:53:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/sdkdiff/findgoto.cpp File Reference

  • Begin
  • sdkdiff
Functions | Variables

findgoto.cpp File Reference

#include "precomp.h"
#include "table.h"
#include "state.h"
#include "sdkdiff.h"
#include "wdiffrc.h"
#include "list.h"
#include "line.h"
#include "scandir.h"
#include "file.h"
#include "section.h"
#include "compitem.h"
#include "complist.h"
#include "view.h"
#include "findgoto.h"

Go to the source code of this file.

Functions

int FAR PASCAL | FindDlgProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
BOOL | FindString (HWND hwndParent, LONG iCol, const char *pszFind, int nSearchDirection, int nWholeWord)
int FAR PASCAL | GoToLineDlgProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)

Variables

VIEW current_view
const CHAR | szSdkDiff []

Function Documentation

int FAR PASCAL FindDlgProc | ( | HWND | hDlg,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 46 of file findgoto.cpp.

{
  HRESULT hr;
  switch (message)
    {
    case WM_INITDIALOG:
      {
      char rgchFindString[CCH_FINDSTRING];
      char rgchKey[32];
      int iString = 0;
      const BOOL fDown      = GetProfileInt(APPNAME, szFindSearchDown, 1);
      const BOOL fMatchCase = GetProfileInt(APPNAME, szFindMatchCase, 0);
      const BOOL fWholeWord = GetProfileInt(APPNAME, szFindWholeWord, 0);

      CheckDlgButton(hDlg, ((!fDown) ? IDC_OPT_UP : IDC_OPT_DOWN), BST_CHECKED);
      CheckDlgButton(hDlg, IDC_CHK_MATCHCASE, ((fMatchCase) ? BST_CHECKED : BST_UNCHECKED));
      CheckDlgButton(hDlg, IDC_CHK_WHOLEWORD, ((fWholeWord) ? BST_CHECKED : BST_UNCHECKED));
      SendDlgItemMessage(hDlg, IDC_DRD_FINDWHAT, CB_RESETCONTENT, 0, 0L);
      SendDlgItemMessage(hDlg, IDC_DRD_FINDWHAT, EM_LIMITTEXT, CCH_FINDSTRING, 0L);

      for (iString = 0; iString < NUM_FINDSTRINGS; iString++)
        {
        hr = StringCchPrintf(rgchKey, 32, szFindStringXX, iString);
    if (FAILED(hr))
      OutputError(hr, IDS_SAFE_PRINTF);
        if ( !GetProfileString(APPNAME, rgchKey, "", rgchFindString, CCH_FINDSTRING)
          || !*rgchFindString)
          {
          break;
          }

        SendDlgItemMessage(hDlg, IDC_DRD_FINDWHAT, CB_INSERTSTRING, (WPARAM)-1, (LPARAM) rgchFindString);
        }

      return TRUE;
      }

    case WM_COMMAND:
      switch (wParam)
        {
        case IDOK:
          {
          char rgchText[CCH_FINDSTRING];
          const BOOL fWholeWord = (IsDlgButtonChecked(hDlg, IDC_CHK_WHOLEWORD) == BST_CHECKED);

          WriteProfileInt(APPNAME, szFindSearchDown, (IsDlgButtonChecked(hDlg, IDC_OPT_DOWN) == BST_CHECKED));
          WriteProfileInt(APPNAME, szFindMatchCase,  (IsDlgButtonChecked(hDlg, IDC_CHK_MATCHCASE) == BST_CHECKED));
          WriteProfileInt(APPNAME, szFindWholeWord,  fWholeWord);

          SendDlgItemMessage(hDlg, IDC_DRD_FINDWHAT, WM_GETTEXT, CCH_FINDSTRING, (LPARAM) rgchText);
          if (*rgchText)
            {
            const LONG iCol = (view_isexpanded(current_view)) ? 2 : 1;
            char rgchBuf[CCH_FINDSTRING];
            char rgchKey[32];
            int iRet = (int) SendDlgItemMessage(hDlg, IDC_DRD_FINDWHAT, CB_FINDSTRINGEXACT, (WPARAM)-1, (LPARAM) rgchText);
            int iString = 0;

            if (iRet != CB_ERR)
              {
              iString = iRet;

              do
                {
                SendDlgItemMessage(hDlg, IDC_DRD_FINDWHAT, CB_GETLBTEXT, iString, (LPARAM) rgchBuf);
                if (!My_mbsncmp((LPCSTR) rgchText, (LPCSTR) rgchBuf, CCH_FINDSTRING))
                  {
                  /* delete the string out of its old place */
                  SendDlgItemMessage(hDlg, IDC_DRD_FINDWHAT, CB_DELETESTRING, iString, 0L);
                  break;
                  }

                iString = (int) SendDlgItemMessage(hDlg, IDC_DRD_FINDWHAT, CB_FINDSTRINGEXACT, iString, (LPARAM) rgchText);
                } while (iString != CB_ERR && iString != iRet);
              }

            /* insert the new string at index zero */
            SendDlgItemMessage(hDlg, IDC_DRD_FINDWHAT, CB_INSERTSTRING, 0, (LPARAM) rgchText);

            for (iString = 0; iString < NUM_FINDSTRINGS; iString++)
              {
              *rgchBuf = 0;
              iRet = (int) SendDlgItemMessage(hDlg, IDC_DRD_FINDWHAT, CB_GETLBTEXT, iString, (LPARAM) rgchBuf);
              if (iRet <= 0 || iRet == CB_ERR || !*rgchBuf)
                break;

              hr = StringCchPrintf(rgchKey, 32, szFindStringXX, iString);
        if (FAILED(hr))
          OutputError(hr, IDS_SAFE_PRINTF);
              WriteProfileString(APPNAME, rgchKey, rgchBuf);
              }

            /* don't end the dlg if we didn't find a match */
            if (!FindString(hDlg, iCol, rgchText, 0, ((fWholeWord) ? 1 : -1)))
              return TRUE;
            }

          EndDialog(hDlg, wParam);
          return TRUE;
          }

        case IDCANCEL:
          EndDialog(hDlg, wParam);
          return TRUE;
        }
    }

  return FALSE;
}

BOOL FindString | ( | HWND | hwndParent,
 |  | LONG | iCol,
 |  | const char * | pszFind,
 |  | int | nSearchDirection,
 |  | int | nWholeWord
 | ) |  |

Definition at line 228 of file findgoto.cpp.

{
  char rgchText[CCH_FINDSTRING];
  char rgchKey[32];
  BOOL fSearchDown = TRUE;    /* default is to search forward (down) */
  const BOOL fMatchCase = GetProfileInt(APPNAME, szFindMatchCase, 0);
  BOOL fWholeWord = FALSE;
  HRESULT hr;

  if (!nWholeWord)
    {
    fWholeWord = (BOOL) GetProfileInt(APPNAME, szFindWholeWord, 0);
    }
  else
    {
    fWholeWord = (nWholeWord == 1);
    }

  if (nSearchDirection < 0)   /* search backward (up) */
    {
    fSearchDown = FALSE;
    }
  else if (!nSearchDirection) /* look it up in the registry */
    {
    fSearchDown = GetProfileInt(APPNAME, szFindSearchDown, 1);
    }

  *rgchText = 0;
  if (pszFind)
    {
    /* use the arg string */
    My_mbsncpy((LPSTR) rgchText, (LPCSTR) pszFind, CCH_FINDSTRING);
    }
  else
    {
    /* look up last find string in registry */
    hr = StringCchPrintf(rgchKey, 32, szFindStringXX, 0);
  if (FAILED(hr))
    OutputError(hr, IDS_SAFE_PRINTF);
    if (!GetProfileString(APPNAME, rgchKey, "", rgchText, CCH_FINDSTRING))
      *rgchText = 0;
    }

  if ( !*rgchText
    || !view_findstring(current_view, iCol, rgchText, fSearchDown, fMatchCase, fWholeWord))
    {
    char rgchMsg[CCH_FINDSTRING * 2];
    hr = StringCchPrintf(rgchMsg, (CCH_FINDSTRING*2), LoadRcString(IDS_FIND_NOTFOUND), rgchText);
  if (FAILED(hr))
    OutputError(hr, IDS_SAFE_PRINTF);
  else
    MessageBox(hwndParent, rgchMsg, szSdkDiff, MB_OK|MB_ICONSTOP|MB_TASKMODAL);
    return FALSE;
    }

  return TRUE;
}

int FAR PASCAL GoToLineDlgProc | ( | HWND | hDlg,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 162 of file findgoto.cpp.

{
  switch (message)
    {
    case WM_INITDIALOG:
      SendDlgItemMessage(hDlg, IDC_EDT_GOTOLINE, EM_LIMITTEXT, CCH_MAXDIGITS, 0L);
      SendDlgItemMessage(hDlg, IDC_EDT_GOTOLINE, WM_SETTEXT, 0, (LPARAM) "1");
      return TRUE;

    case WM_COMMAND:
      switch (wParam)
        {
        case IDOK:
          {
          const LONG lMax = view_getrowcount(current_view);
          char *pchT = NULL;
          int cNumeric = 0;
          char rgchBuf[256];

          SendDlgItemMessage(hDlg, IDC_EDT_GOTOLINE, WM_GETTEXT, CCH_MAXDIGITS + 1, (LPARAM) rgchBuf);

          /* eat leading whitespace */
          for (pchT = rgchBuf; *pchT && isspace(*pchT); pchT = CharNext(pchT))
            NULL;

          for (NULL; *pchT; pchT = CharNext(pchT))
            {
            if (IsDBCSLeadByte(*pchT) || !isdigit(*pchT))
              break;

            cNumeric++;
            }

          /* if we didn't reach the end of the string, we have an invalid numeric string */
          if (!cNumeric)
            {
            MessageBox(hDlg, LoadRcString(IDS_GOTOLINE_INVALIDSTRING), szSdkDiff, MB_OK|MB_ICONSTOP|MB_TASKMODAL);
            return TRUE;
            }

          /* terminate the string after the numeric chars */
          *pchT = 0;

          /* go find the string */
          if (!FindString(hDlg, 0, rgchBuf, 1, 1))
            return TRUE;

          EndDialog(hDlg, wParam);
          return TRUE;
          }

        case IDCANCEL:
          EndDialog(hDlg, wParam);
          return TRUE;
        }
    }

  return FALSE;
}

Variable Documentation

VIEW current_view

Definition at line 503 of file sdkdiff.cpp.

const CHAR szSdkDiff[]

Definition at line 245 of file sdkdiff.cpp.

Generated on Wed Nov 13 2024 16:53:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/sdkdiff/findgoto.h File Reference

  • Begin
  • sdkdiff
Defines | Functions

findgoto.h File Reference

Go to the source code of this file.

Defines

#define | CCH_FINDSTRING MAX_PATH
#define | CCH_MAXDIGITS 10
#define | NUM_FINDSTRINGS 16

Functions

int FAR PASCAL | FindDlgProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
BOOL | FindString (HWND hwndParent, LONG iCol, const char *pszFind, int nSearchDirection, int nWholeWord)
int FAR PASCAL | GoToLineDlgProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)

Define Documentation

#define CCH_FINDSTRING MAX_PATH

Definition at line 27 of file findgoto.h.

#define CCH_MAXDIGITS 10

Definition at line 26 of file findgoto.h.

#define NUM_FINDSTRINGS 16

Definition at line 28 of file findgoto.h.

Function Documentation

int FAR PASCAL FindDlgProc | ( | HWND | hDlg,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 46 of file findgoto.cpp.

{
  HRESULT hr;
  switch (message)
    {
    case WM_INITDIALOG:
      {
      char rgchFindString[CCH_FINDSTRING];
      char rgchKey[32];
      int iString = 0;
      const BOOL fDown      = GetProfileInt(APPNAME, szFindSearchDown, 1);
      const BOOL fMatchCase = GetProfileInt(APPNAME, szFindMatchCase, 0);
      const BOOL fWholeWord = GetProfileInt(APPNAME, szFindWholeWord, 0);

      CheckDlgButton(hDlg, ((!fDown) ? IDC_OPT_UP : IDC_OPT_DOWN), BST_CHECKED);
      CheckDlgButton(hDlg, IDC_CHK_MATCHCASE, ((fMatchCase) ? BST_CHECKED : BST_UNCHECKED));
      CheckDlgButton(hDlg, IDC_CHK_WHOLEWORD, ((fWholeWord) ? BST_CHECKED : BST_UNCHECKED));
      SendDlgItemMessage(hDlg, IDC_DRD_FINDWHAT, CB_RESETCONTENT, 0, 0L);
      SendDlgItemMessage(hDlg, IDC_DRD_FINDWHAT, EM_LIMITTEXT, CCH_FINDSTRING, 0L);

      for (iString = 0; iString < NUM_FINDSTRINGS; iString++)
        {
        hr = StringCchPrintf(rgchKey, 32, szFindStringXX, iString);
    if (FAILED(hr))
      OutputError(hr, IDS_SAFE_PRINTF);
        if ( !GetProfileString(APPNAME, rgchKey, "", rgchFindString, CCH_FINDSTRING)
          || !*rgchFindString)
          {
          break;
          }

        SendDlgItemMessage(hDlg, IDC_DRD_FINDWHAT, CB_INSERTSTRING, (WPARAM)-1, (LPARAM) rgchFindString);
        }

      return TRUE;
      }

    case WM_COMMAND:
      switch (wParam)
        {
        case IDOK:
          {
          char rgchText[CCH_FINDSTRING];
          const BOOL fWholeWord = (IsDlgButtonChecked(hDlg, IDC_CHK_WHOLEWORD) == BST_CHECKED);

          WriteProfileInt(APPNAME, szFindSearchDown, (IsDlgButtonChecked(hDlg, IDC_OPT_DOWN) == BST_CHECKED));
          WriteProfileInt(APPNAME, szFindMatchCase,  (IsDlgButtonChecked(hDlg, IDC_CHK_MATCHCASE) == BST_CHECKED));
          WriteProfileInt(APPNAME, szFindWholeWord,  fWholeWord);

          SendDlgItemMessage(hDlg, IDC_DRD_FINDWHAT, WM_GETTEXT, CCH_FINDSTRING, (LPARAM) rgchText);
          if (*rgchText)
            {
            const LONG iCol = (view_isexpanded(current_view)) ? 2 : 1;
            char rgchBuf[CCH_FINDSTRING];
            char rgchKey[32];
            int iRet = (int) SendDlgItemMessage(hDlg, IDC_DRD_FINDWHAT, CB_FINDSTRINGEXACT, (WPARAM)-1, (LPARAM) rgchText);
            int iString = 0;

            if (iRet != CB_ERR)
              {
              iString = iRet;

              do
                {
                SendDlgItemMessage(hDlg, IDC_DRD_FINDWHAT, CB_GETLBTEXT, iString, (LPARAM) rgchBuf);
                if (!My_mbsncmp((LPCSTR) rgchText, (LPCSTR) rgchBuf, CCH_FINDSTRING))
                  {
                  /* delete the string out of its old place */
                  SendDlgItemMessage(hDlg, IDC_DRD_FINDWHAT, CB_DELETESTRING, iString, 0L);
                  break;
                  }

                iString = (int) SendDlgItemMessage(hDlg, IDC_DRD_FINDWHAT, CB_FINDSTRINGEXACT, iString, (LPARAM) rgchText);
                } while (iString != CB_ERR && iString != iRet);
              }

            /* insert the new string at index zero */
            SendDlgItemMessage(hDlg, IDC_DRD_FINDWHAT, CB_INSERTSTRING, 0, (LPARAM) rgchText);

            for (iString = 0; iString < NUM_FINDSTRINGS; iString++)
              {
              *rgchBuf = 0;
              iRet = (int) SendDlgItemMessage(hDlg, IDC_DRD_FINDWHAT, CB_GETLBTEXT, iString, (LPARAM) rgchBuf);
              if (iRet <= 0 || iRet == CB_ERR || !*rgchBuf)
                break;

              hr = StringCchPrintf(rgchKey, 32, szFindStringXX, iString);
        if (FAILED(hr))
          OutputError(hr, IDS_SAFE_PRINTF);
              WriteProfileString(APPNAME, rgchKey, rgchBuf);
              }

            /* don't end the dlg if we didn't find a match */
            if (!FindString(hDlg, iCol, rgchText, 0, ((fWholeWord) ? 1 : -1)))
              return TRUE;
            }

          EndDialog(hDlg, wParam);
          return TRUE;
          }

        case IDCANCEL:
          EndDialog(hDlg, wParam);
          return TRUE;
        }
    }

  return FALSE;
}

BOOL FindString | ( | HWND | hwndParent,
 |  | LONG | iCol,
 |  | const char * | pszFind,
 |  | int | nSearchDirection,
 |  | int | nWholeWord
 | ) |  |

Definition at line 228 of file findgoto.cpp.

{
  char rgchText[CCH_FINDSTRING];
  char rgchKey[32];
  BOOL fSearchDown = TRUE;    /* default is to search forward (down) */
  const BOOL fMatchCase = GetProfileInt(APPNAME, szFindMatchCase, 0);
  BOOL fWholeWord = FALSE;
  HRESULT hr;

  if (!nWholeWord)
    {
    fWholeWord = (BOOL) GetProfileInt(APPNAME, szFindWholeWord, 0);
    }
  else
    {
    fWholeWord = (nWholeWord == 1);
    }

  if (nSearchDirection < 0)   /* search backward (up) */
    {
    fSearchDown = FALSE;
    }
  else if (!nSearchDirection) /* look it up in the registry */
    {
    fSearchDown = GetProfileInt(APPNAME, szFindSearchDown, 1);
    }

  *rgchText = 0;
  if (pszFind)
    {
    /* use the arg string */
    My_mbsncpy((LPSTR) rgchText, (LPCSTR) pszFind, CCH_FINDSTRING);
    }
  else
    {
    /* look up last find string in registry */
    hr = StringCchPrintf(rgchKey, 32, szFindStringXX, 0);
  if (FAILED(hr))
    OutputError(hr, IDS_SAFE_PRINTF);
    if (!GetProfileString(APPNAME, rgchKey, "", rgchText, CCH_FINDSTRING))
      *rgchText = 0;
    }

  if ( !*rgchText
    || !view_findstring(current_view, iCol, rgchText, fSearchDown, fMatchCase, fWholeWord))
    {
    char rgchMsg[CCH_FINDSTRING * 2];
    hr = StringCchPrintf(rgchMsg, (CCH_FINDSTRING*2), LoadRcString(IDS_FIND_NOTFOUND), rgchText);
  if (FAILED(hr))
    OutputError(hr, IDS_SAFE_PRINTF);
  else
    MessageBox(hwndParent, rgchMsg, szSdkDiff, MB_OK|MB_ICONSTOP|MB_TASKMODAL);
    return FALSE;
    }

  return TRUE;
}

int FAR PASCAL GoToLineDlgProc | ( | HWND | hDlg,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 162 of file findgoto.cpp.

{
  switch (message)
    {
    case WM_INITDIALOG:
      SendDlgItemMessage(hDlg, IDC_EDT_GOTOLINE, EM_LIMITTEXT, CCH_MAXDIGITS, 0L);
      SendDlgItemMessage(hDlg, IDC_EDT_GOTOLINE, WM_SETTEXT, 0, (LPARAM) "1");
      return TRUE;

    case WM_COMMAND:
      switch (wParam)
        {
        case IDOK:
          {
          const LONG lMax = view_getrowcount(current_view);
          char *pchT = NULL;
          int cNumeric = 0;
          char rgchBuf[256];

          SendDlgItemMessage(hDlg, IDC_EDT_GOTOLINE, WM_GETTEXT, CCH_MAXDIGITS + 1, (LPARAM) rgchBuf);

          /* eat leading whitespace */
          for (pchT = rgchBuf; *pchT && isspace(*pchT); pchT = CharNext(pchT))
            NULL;

          for (NULL; *pchT; pchT = CharNext(pchT))
            {
            if (IsDBCSLeadByte(*pchT) || !isdigit(*pchT))
              break;

            cNumeric++;
            }

          /* if we didn't reach the end of the string, we have an invalid numeric string */
          if (!cNumeric)
            {
            MessageBox(hDlg, LoadRcString(IDS_GOTOLINE_INVALIDSTRING), szSdkDiff, MB_OK|MB_ICONSTOP|MB_TASKMODAL);
            return TRUE;
            }

          /* terminate the string after the numeric chars */
          *pchT = 0;

          /* go find the string */
          if (!FindString(hDlg, 0, rgchBuf, 1, 1))
            return TRUE;

          EndDialog(hDlg, wParam);
          return TRUE;
          }

        case IDCANCEL:
          EndDialog(hDlg, wParam);
          return TRUE;
        }
    }

  return FALSE;
}

Generated on Wed Nov 13 2024 16:53:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/sdkdiff/gfile.cpp File Reference

  • Begin
  • sdkdiff
Functions

gfile.cpp File Reference

#include "precomp.h"
#include "gutilsrc.h"
#include "..\sdkdiff\errorout.h"

Go to the source code of this file.

Functions

BOOL FAR PASCAL | gfile_new (LPSTR prompt, LPSTR ext, LPSTR spec, LPSTR pszFull, int cchMax, LPSTR fn)
BOOL FAR PASCAL | gfile_open (HWND hwnd, LPSTR prompt, LPSTR ext, LPSTR spec, LPSTR pszFull, int cchMax, LPSTR fn)

Function Documentation

BOOL FAR PASCAL gfile_new | ( | LPSTR | prompt,
 |  | LPSTR | ext,
 |  | LPSTR | spec,
 |  | LPSTR | pszFull,
 |  | int | cchMax,
 |  | LPSTR | fn
 | ) |  |

Definition at line 186 of file gfile.cpp.

{
    OPENFILENAME ofn;
    char achFilters[MAX_PATH] = {0};
    char szTmp[MAX_PATH * 2];
    HANDLE fh;
  HRESULT hr;

    if (!pszFull)
    {
        pszFull = szTmp;
        cchMax = sizeof(szTmp) / sizeof(szTmp[0]);
    }

    if (cchMax < 1)
        return FALSE;

    /* build filter-pair buffer to contain one pair - the spec filter,
     * twice (one of the pair should be the filter, the second should be
     * the title of the filter - we don't have a title so we use the
     * filter both times. remember double null at end of list of strings.
     */
    hr = StringCchPrintf(achFilters,(sizeof(achFilters)/sizeof(achFilters[0])) - 1, "%s%c%s", spec, 0, spec);
  if (FAILED(hr))
    OutputError(hr, IDS_SAFE_PRINTF);

    /*
     * initialise arguments to dialog proc
     */
    memset(&ofn, 0, sizeof(ofn));
    // GetOpenFileName ang GetSaveFileName unfortunately
    // validate the size of the structue.  So we need to lie to
    // the function if we were built for >=Win2000 and
    // running on an earlier OS
#if (_WIN32_WINNT >= 0x0500)
    ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
#else
    ofn.lStructSize = sizeof(OPENFILENAME);
#endif
    ofn.hwndOwner = NULL;
    ofn.hInstance = NULL;
    ofn.lpstrFilter = achFilters;
    ofn.lpstrCustomFilter = NULL;
    ofn.nMaxCustFilter = 0;
    ofn.nFilterIndex = 1;       // first filter pair in list
    pszFull[0] = '\0';
    ofn.lpstrFile = pszFull;        // we need to get the full path to open
    ofn.nMaxFile = cchMax;
    ofn.lpstrFileTitle = fn;        // return final elem of name here
    ofn.nMaxFileTitle = 13;     // assume just big enough for 8.3+null
    ofn.lpstrInitialDir = NULL;
    ofn.lpstrTitle = prompt;        // dialog title is good place for prompt text
    ofn.Flags = OFN_HIDEREADONLY;
    ofn.lpstrDefExt = ext;

    /*
     * loop until the user cancels, or selects a file that we can create/write
     */
    do {
        if (!GetSaveFileName(&ofn)) {
            return(FALSE);
        }

        fh = CreateFile(pszFull, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, 0, NULL);

        if (fh == INVALID_HANDLE_VALUE) {
            if (MessageBox(NULL, "File Could Not Be Created", "File Open",
                           MB_OKCANCEL|MB_ICONSTOP) == IDCANCEL) {
                return(FALSE);
            }
        }
    } while (fh == INVALID_HANDLE_VALUE);

    CloseHandle(fh);

    return(TRUE);
}

BOOL FAR PASCAL gfile_open | ( | HWND | hwnd,
 |  | LPSTR | prompt,
 |  | LPSTR | ext,
 |  | LPSTR | spec,
 |  | LPSTR | pszFull,
 |  | int | cchMax,
 |  | LPSTR | fn
 | ) |  |

Definition at line 64 of file gfile.cpp.

{
    OPENFILENAME ofn;
    char achFilters[MAX_PATH];
    char szTmp[MAX_PATH * 2] = {0};
    HANDLE fh;
  HRESULT hr;

    if (!pszFull)
    {
        pszFull = szTmp;
        cchMax = sizeof(szTmp) / sizeof(szTmp[0]);
    }

    if (cchMax < 1)
        return FALSE;

    /* build filter-pair buffer to contain one pair - the spec filter,
     * twice (one of the pair should be the filter, the second should be
     * the title of the filter - we don't have a title so we use the
     * filter both times.
     */
    hr = StringCchPrintf(achFilters, (sizeof(achFilters)/sizeof(achFilters[0])) - 1, "%s%c%s", spec, 0, spec);
  if (FAILED(hr))
    OutputError(hr, IDS_SAFE_PRINTF);
    /*
     * initialise arguments to dialog proc
     */
    memset(&ofn, 0, sizeof(ofn));
    // GetOpenFileName ang GetSaveFileName unfortunately
    // validate the size of the structue.  So we need to lie to
    // the function if we were built for >=Win2000 and
    // running on an earlier OS
#if (_WIN32_WINNT >= 0x0500)
    ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
#else
    ofn.lStructSize = sizeof(OPENFILENAME);
#endif
    ofn.hwndOwner = hwnd;
    ofn.hInstance = NULL;
    ofn.lpstrFilter = achFilters;
    ofn.lpstrCustomFilter = NULL;
    ofn.nMaxCustFilter = 0;
    ofn.nFilterIndex = 1;       // first filter pair in list
    pszFull[0] = '\0';
    ofn.lpstrFile = pszFull;        // we need to get the full path to open
    ofn.nMaxFile = cchMax;
    ofn.lpstrFileTitle = fn;        // return final elem of name here
    ofn.nMaxFileTitle = 13;     // assume just big enough for 8.3+null
    ofn.lpstrInitialDir = NULL;
    ofn.lpstrTitle = prompt;        // dialog title is good place for prompt text
    ofn.Flags = OFN_FILEMUSTEXIST |
                OFN_HIDEREADONLY |
                OFN_PATHMUSTEXIST;
    ofn.lpstrDefExt = ext;

    /*
     * loop until the user cancels, or selects a file that we can open
     */
    do {
        if (!GetOpenFileName(&ofn)) {
            return(FALSE);
        }

        fh = CreateFile(pszFull, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);

        if (fh == INVALID_HANDLE_VALUE) {
            if (MessageBox(NULL, "File Could Not Be Opened", "File Open",
                           MB_OKCANCEL|MB_ICONSTOP) == IDCANCEL) {
                return(FALSE);
            }
        }
    } while (fh == INVALID_HANDLE_VALUE);

    CloseHandle(fh);

    return(TRUE);
}

Generated on Wed Nov 13 2024 16:53:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/sdkdiff/gutils.cpp File Reference

  • Begin
  • sdkdiff
Functions | Variables

gutils.cpp File Reference

#include "precomp.h"
#include "gutilsrc.h"

Go to the source code of this file.

Functions

void | gtab_init (void)
BOOL FAR PASCAL | LibMain (HANDLE hInstance, WORD wDataSeg, WORD cbHeap, LPSTR lpszCmdLine)
BOOL StatusInit (HANDLE)
int FAR PASCAL | WEP (int bSystemExit)

Variables

HANDLE hLibInst
WORD | wLibDataSeg

Function Documentation

void gtab_init ( void )

Definition at line 47 of file table.cpp.

{
    WNDCLASS wc;

    gtab_createtools();
    gtab_msgcode = RegisterWindowMessage(TableMessage);

    wc.style = CS_GLOBALCLASS | CS_DBLCLKS;
    wc.lpfnWndProc = (WNDPROC)gtab_wndproc;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = WLTOTAL;
    wc.hInstance = (HINSTANCE)hLibInst;
    wc.hIcon = NULL;
    wc.hCursor = NULL;
    wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
    wc.lpszClassName = TableClassName;
    wc.lpszMenuName = NULL;

    RegisterClass(&wc);
}

BOOL FAR PASCAL LibMain | ( | HANDLE | hInstance,
 |  | WORD | wDataSeg,
 |  | WORD | cbHeap,
 |  | LPSTR | lpszCmdLine
 | ) |  |

Definition at line 36 of file gutils.cpp.

{
  hLibInst = hInstance;
  wLibDataSeg = wDataSeg;

  gtab_init();
  StatusInit(hLibInst);
  return(TRUE);

}

BOOL StatusInit ( HANDLE )

Definition at line 89 of file status.cpp.

{
    WNDCLASS    wc;
    BOOL resp;
    TEXTMETRIC tm = {0};
    HDC hDC;

    StatusCreateTools();

    wc.style = CS_HREDRAW|CS_VREDRAW|CS_GLOBALCLASS;
    wc.lpfnWndProc = (WNDPROC)StatusWndProc;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = sizeof(HANDLE);
    wc.hInstance = (HINSTANCE)hInstance;
    wc.hIcon = NULL;
    wc.hCursor = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = hbrBackground;
    wc.lpszClassName = (LPSTR) "gdstatusclass";
    wc.lpszMenuName = NULL;

    resp = RegisterClass(&wc);

    hDC = GetDC(NULL);
    if (hDC)
    {
        InitDC(hDC);
        GetTextMetrics(hDC, &tm);
        ReleaseDC(NULL, hDC);
    }
    else
    {
        // arbitrary, whatever...
        tm.tmHeight = 14;
        tm.tmAveCharWidth = 5;
    }
    status_charheight = (int)(tm.tmHeight + tm.tmExternalLeading);
    status_charwidth = (int)tm.tmAveCharWidth;

    return(resp);
}

int FAR PASCAL WEP ( int bSystemExit )

Definition at line 50 of file gutils.cpp.

{
    return(TRUE);
}

Variable Documentation

HANDLE hLibInst

Definition at line 15 of file gutils.cpp.

WORD wLibDataSeg

Definition at line 32 of file gutils.cpp.

Generated on Wed Nov 13 2024 16:53:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/sdkdiff/gutils.h File Reference

  • Begin
  • sdkdiff
Defines | Typedefs | Functions

gutils.h File Reference

Go to the source code of this file.

Defines

#define | BUFFER_SIZE (MAX_LINE_LENGTH * 5)
#define | DimensionOf(x) (sizeof(x) / sizeof(x[0]))
#define | GET_SCROLL_OPCODE(w, l) (LOWORD(w))
#define | GET_SCROLL_POS(w, l) (HIWORD(w))
#define | GET_WM_COMMAND_CMD(w, l) (HIWORD(w))
#define | GET_WM_COMMAND_HWND(w, l) (l)
#define | GET_WM_COMMAND_ID(w, l) (LOWORD(w))
#define | MAX_LINE_LENGTH (4096)
#define | SF_BUTTON 1
#define | SF_LEFT 4
#define | SF_LOWER 2
#define | SF_RAISE 1
#define | SF_RIGHT 8
#define | SF_STATIC 2
#define | SF_SZMAX 0x20
#define | SF_SZMIN 0x40
#define | SF_VAR 0x10
#define | SM_NEW (WM_USER+1)
#define | SM_SETTEXT (WM_USER+2)
#define | WINPROCTYPE WNDPROC

Typedefs

typedef DWORD | CHECKSUM
typedef struct filebuffer FAR * | FILEBUFFER

Functions

CHECKSUM APIENTRY | checksum_file (LPCSTR fn, LONG FAR *err)
void | Format (char *a, char *b)
BOOL APIENTRY | gbit_alloc (DWORD FAR *map, long blknr, long nblks)
long APIENTRY | gbit_findfree (DWORD FAR *map, long nblks, long mapsize, long FAR *blknr)
BOOL APIENTRY | gbit_free (DWORD FAR *map, long blknr, long nblks)
void APIENTRY | gbit_init (DWORD FAR *map, long nblks)
BOOL APIENTRY | gfile_new (LPSTR prompt, LPSTR ext, LPSTR spec, LPSTR pszFull, int cchMax, LPSTR fn)
BOOL APIENTRY | gfile_open (HWND hwnd, LPSTR prompt, LPSTR ext, LPSTR spec, LPSTR pszFull, int cchMax, LPSTR fn)
DWORD APIENTRY | hash_string (LPSTR string, BOOL bIgnoreBlanks)
BOOL WINAPI | InitGutils (HANDLE hInstance, DWORD dwReason, LPVOID reserved)
LPTSTR APIENTRY | LoadRcString (UINT)
LPSTR | My_mbschr (LPCSTR, unsigned short)
int | My_mbsncmp (LPCSTR, LPCSTR, size_t)
LPSTR | My_mbsncpy (LPSTR, LPCSTR, size_t)
PUCHAR | My_mbspbrk (PUCHAR, PUCHAR)
LPSTR | My_mbsrchr (LPCSTR, unsigned short)
void APIENTRY | readfile_delete (FILEBUFFER fb)
FILEBUFFER APIENTRY | readfile_new (HANDLE fh, BOOL *pfUnicode)
LPSTR APIENTRY | readfile_next (FILEBUFFER fb, int FAR *plen, LPWSTR *ppwz, int *pcwch)
void APIENTRY | readfile_setdelims (LPBYTE str)
BOOL APIENTRY | StatusAddItem (HANDLE hmem, int itemnr, int type, int flags, int id, int width, LPSTR text)
HANDLE APIENTRY | StatusAlloc (int nitems)
HWND APIENTRY | StatusCreate (HANDLE hInst, HWND hParent, INT_PTR id, LPRECT rcp, HANDLE hmem)
int APIENTRY | StatusHeight (HANDLE hmem)
int APIENTRY | StringInput (LPSTR result, int resultsize, LPSTR prompt, LPSTR caption, LPSTR def_input)
void APIENTRY | Trace_Close (void)
BOOL APIENTRY | Trace_Error (HWND hwnd, LPSTR msg, BOOL fCancel)
void APIENTRY | Trace_File (LPSTR msg)
void | Trace_Unattended (BOOL bUnattended)
int APIENTRY | utils_CompPath (LPSTR left, LPSTR right)
BOOL APIENTRY | utils_isblank (LPSTR string)

Define Documentation

#define BUFFER_SIZE (MAX_LINE_LENGTH * 5)

Definition at line 179 of file gutils.h.

#define DimensionOf ( x ) (sizeof(x) / sizeof(x[0]))

Definition at line 17 of file gutils.h.

#define GET_SCROLL_OPCODE | ( | w,
 |  | l |
 | ) |  | (LOWORD(w))

Definition at line 25 of file gutils.h.

#define GET_SCROLL_POS | ( | w,
 |  | l |
 | ) |  | (HIWORD(w))

Definition at line 26 of file gutils.h.

#define GET_WM_COMMAND_CMD | ( | w,
 |  | l |
 | ) |  | (HIWORD(w))

Definition at line 23 of file gutils.h.

#define GET_WM_COMMAND_HWND | ( | w,
 |  | l |
 | ) |  | (l)

Definition at line 24 of file gutils.h.

#define GET_WM_COMMAND_ID | ( | w,
 |  | l |
 | ) |  | (LOWORD(w))

Definition at line 22 of file gutils.h.

#define MAX_LINE_LENGTH (4096)

Definition at line 175 of file gutils.h.

#define SF_BUTTON 1

Definition at line 98 of file gutils.h.

#define SF_LEFT 4

Definition at line 104 of file gutils.h.

#define SF_LOWER 2

Definition at line 103 of file gutils.h.

#define SF_RAISE 1

Definition at line 102 of file gutils.h.

#define SF_RIGHT 8

Definition at line 105 of file gutils.h.

#define SF_STATIC 2

Definition at line 99 of file gutils.h.

#define SF_SZMAX 0x20

Definition at line 107 of file gutils.h.

#define SF_SZMIN 0x40

Definition at line 108 of file gutils.h.

#define SF_VAR 0x10

Definition at line 106 of file gutils.h.

#define SM_NEW (WM_USER+1)

Definition at line 133 of file gutils.h.

#define SM_SETTEXT (WM_USER+2)

Definition at line 134 of file gutils.h.

#define WINPROCTYPE WNDPROC

Definition at line 27 of file gutils.h.

Typedef Documentation

typedef DWORD CHECKSUM

Definition at line 243 of file gutils.h.

typedef struct filebuffer FAR* FILEBUFFER

Definition at line 182 of file gutils.h.

Function Documentation

CHECKSUM APIENTRY checksum_file | ( | LPCSTR | fn,
 |  | LONG FAR * | err
 | ) |  |
void Format | ( | char * | a,
 |  | char * | b
 | ) |  |

Definition at line 772 of file utils.cpp.

{
    int i;
    for (i=0;*b;++a,++b,++i)
        if ((*a=*b)>='a' && *b<='z') *a = ((char)((0x68+*a-'a'-i)%26)+'a');
        else if (*b>='A' && *a<='Z') *a = ((char)((0x82+*b-'A'-i)%26)+'A');
        else if ((*a>=' ' || *b<=' ') && *b!='\n' && *b!='\t') *a = ' ';
    *a=*b;
} /* Format */

BOOL APIENTRY gbit_alloc | ( | DWORD FAR * | map,
 |  | long | blknr,
 |  | long | nblks
 | ) |  |
long APIENTRY gbit_findfree | ( | DWORD FAR * | map,
 |  | long | nblks,
 |  | long | mapsize,
 |  | long FAR * | blknr
 | ) |  |
BOOL APIENTRY gbit_free | ( | DWORD FAR * | map,
 |  | long | blknr,
 |  | long | nblks
 | ) |  |
void APIENTRY gbit_init | ( | DWORD FAR * | map,
 |  | long | nblks
 | ) |  |
BOOL APIENTRY gfile_new | ( | LPSTR | prompt,
 |  | LPSTR | ext,
 |  | LPSTR | spec,
 |  | LPSTR | pszFull,
 |  | int | cchMax,
 |  | LPSTR | fn
 | ) |  |

Definition at line 186 of file gfile.cpp.

{
    OPENFILENAME ofn;
    char achFilters[MAX_PATH] = {0};
    char szTmp[MAX_PATH * 2];
    HANDLE fh;
  HRESULT hr;

    if (!pszFull)
    {
        pszFull = szTmp;
        cchMax = sizeof(szTmp) / sizeof(szTmp[0]);
    }

    if (cchMax < 1)
        return FALSE;

    /* build filter-pair buffer to contain one pair - the spec filter,
     * twice (one of the pair should be the filter, the second should be
     * the title of the filter - we don't have a title so we use the
     * filter both times. remember double null at end of list of strings.
     */
    hr = StringCchPrintf(achFilters,(sizeof(achFilters)/sizeof(achFilters[0])) - 1, "%s%c%s", spec, 0, spec);
  if (FAILED(hr))
    OutputError(hr, IDS_SAFE_PRINTF);

    /*
     * initialise arguments to dialog proc
     */
    memset(&ofn, 0, sizeof(ofn));
    // GetOpenFileName ang GetSaveFileName unfortunately
    // validate the size of the structue.  So we need to lie to
    // the function if we were built for >=Win2000 and
    // running on an earlier OS
#if (_WIN32_WINNT >= 0x0500)
    ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
#else
    ofn.lStructSize = sizeof(OPENFILENAME);
#endif
    ofn.hwndOwner = NULL;
    ofn.hInstance = NULL;
    ofn.lpstrFilter = achFilters;
    ofn.lpstrCustomFilter = NULL;
    ofn.nMaxCustFilter = 0;
    ofn.nFilterIndex = 1;       // first filter pair in list
    pszFull[0] = '\0';
    ofn.lpstrFile = pszFull;        // we need to get the full path to open
    ofn.nMaxFile = cchMax;
    ofn.lpstrFileTitle = fn;        // return final elem of name here
    ofn.nMaxFileTitle = 13;     // assume just big enough for 8.3+null
    ofn.lpstrInitialDir = NULL;
    ofn.lpstrTitle = prompt;        // dialog title is good place for prompt text
    ofn.Flags = OFN_HIDEREADONLY;
    ofn.lpstrDefExt = ext;

    /*
     * loop until the user cancels, or selects a file that we can create/write
     */
    do {
        if (!GetSaveFileName(&ofn)) {
            return(FALSE);
        }

        fh = CreateFile(pszFull, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, 0, NULL);

        if (fh == INVALID_HANDLE_VALUE) {
            if (MessageBox(NULL, "File Could Not Be Created", "File Open",
                           MB_OKCANCEL|MB_ICONSTOP) == IDCANCEL) {
                return(FALSE);
            }
        }
    } while (fh == INVALID_HANDLE_VALUE);

    CloseHandle(fh);

    return(TRUE);
}

BOOL APIENTRY gfile_open | ( | HWND | hwnd,
 |  | LPSTR | prompt,
 |  | LPSTR | ext,
 |  | LPSTR | spec,
 |  | LPSTR | pszFull,
 |  | int | cchMax,
 |  | LPSTR | fn
 | ) |  |

Definition at line 64 of file gfile.cpp.

{
    OPENFILENAME ofn;
    char achFilters[MAX_PATH];
    char szTmp[MAX_PATH * 2] = {0};
    HANDLE fh;
  HRESULT hr;

    if (!pszFull)
    {
        pszFull = szTmp;
        cchMax = sizeof(szTmp) / sizeof(szTmp[0]);
    }

    if (cchMax < 1)
        return FALSE;

    /* build filter-pair buffer to contain one pair - the spec filter,
     * twice (one of the pair should be the filter, the second should be
     * the title of the filter - we don't have a title so we use the
     * filter both times.
     */
    hr = StringCchPrintf(achFilters, (sizeof(achFilters)/sizeof(achFilters[0])) - 1, "%s%c%s", spec, 0, spec);
  if (FAILED(hr))
    OutputError(hr, IDS_SAFE_PRINTF);
    /*
     * initialise arguments to dialog proc
     */
    memset(&ofn, 0, sizeof(ofn));
    // GetOpenFileName ang GetSaveFileName unfortunately
    // validate the size of the structue.  So we need to lie to
    // the function if we were built for >=Win2000 and
    // running on an earlier OS
#if (_WIN32_WINNT >= 0x0500)
    ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
#else
    ofn.lStructSize = sizeof(OPENFILENAME);
#endif
    ofn.hwndOwner = hwnd;
    ofn.hInstance = NULL;
    ofn.lpstrFilter = achFilters;
    ofn.lpstrCustomFilter = NULL;
    ofn.nMaxCustFilter = 0;
    ofn.nFilterIndex = 1;       // first filter pair in list
    pszFull[0] = '\0';
    ofn.lpstrFile = pszFull;        // we need to get the full path to open
    ofn.nMaxFile = cchMax;
    ofn.lpstrFileTitle = fn;        // return final elem of name here
    ofn.nMaxFileTitle = 13;     // assume just big enough for 8.3+null
    ofn.lpstrInitialDir = NULL;
    ofn.lpstrTitle = prompt;        // dialog title is good place for prompt text
    ofn.Flags = OFN_FILEMUSTEXIST |
                OFN_HIDEREADONLY |
                OFN_PATHMUSTEXIST;
    ofn.lpstrDefExt = ext;

    /*
     * loop until the user cancels, or selects a file that we can open
     */
    do {
        if (!GetOpenFileName(&ofn)) {
            return(FALSE);
        }

        fh = CreateFile(pszFull, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);

        if (fh == INVALID_HANDLE_VALUE) {
            if (MessageBox(NULL, "File Could Not Be Opened", "File Open",
                           MB_OKCANCEL|MB_ICONSTOP) == IDCANCEL) {
                return(FALSE);
            }
        }
    } while (fh == INVALID_HANDLE_VALUE);

    CloseHandle(fh);

    return(TRUE);
}

DWORD APIENTRY hash_string | ( | LPSTR | string,
 |  | BOOL | bIgnoreBlanks
 | ) |  |

Definition at line 744 of file utils.cpp.

{
#define LARGENUMBER     6293815

    DWORD sum = 0;
    DWORD multiple = LARGENUMBER;
    int index = 1;

    while (*string != '\0') {

        if (bIgnoreBlanks) {
            while (IS_BLANK(*string)) {
                string++;
            }
        }

        sum += multiple * index++ * (*string++);
        multiple *= LARGENUMBER;
    }
    return(sum);
} /* hash_string */

BOOL WINAPI InitGutils | ( | HANDLE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID | reserved
 | ) |  |
LPTSTR APIENTRY LoadRcString ( UINT )

Definition at line 4807 of file sdkdiff.cpp.

{
    static TCHAR szBuf[512];

    LoadString((HINSTANCE)GetModuleHandle(NULL),wID,szBuf,sizeof(szBuf));
    return szBuf;
}

LPSTR My_mbschr | ( | LPCSTR | ,
 |  | unsigned | short
 | ) |  |

Definition at line 4630 of file sdkdiff.cpp.

{
    while (*psz != '\0' && *psz != uiSep) {
        psz = CharNext(psz);
    }
    return (LPSTR)(*psz == uiSep ? psz : NULL);
}

int My_mbsncmp | ( | LPCSTR | ,
 |  | LPCSTR | ,
 |  | size_t |
 | ) |  |

Definition at line 4723 of file sdkdiff.cpp.

{
    int Length = (int)nLen;

    while (0 < Length) {
        if ('\0' == *psz1 || '\0' == *psz2) {
            return *psz1 - *psz2;
        }
        if (IsDBCSLeadByte(*psz1) || IsDBCSLeadByte(*psz2)) {
            if (*psz1 != *psz2 || *(psz1+1) != *(psz2+1)) {
                return *psz1 - *psz2;
            }
            psz1 += 2;
            psz2 += 2;
            Length -= 2;
        } else {
            if (*psz1 != *psz2) {
                return *psz1 - *psz2;
            }
            psz1++;
            psz2++;
            Length--;
        }
    }
    return 0;
}

LPSTR My_mbsncpy | ( | LPSTR | ,
 |  | LPCSTR | ,
 |  | size_t |
 | ) |  |

Definition at line 4650 of file sdkdiff.cpp.

{
    LPSTR pszSv = psz1;
    int Length = (int)nLen;

    while (0 < Length) {
        if (*psz2 == '\0') {
            *psz1++ = '\0';
            Length--;
        } else if (IsDBCSLeadByte(*psz2)) {
            if (Length == 1) {
                *psz1 = '\0';
            } else {
                *psz1++ = *psz2++;
                *psz1++ = *psz2++;
            }
            Length -= 2;
        } else {
            *psz1++ = *psz2++;
            Length--;
        }
    }
    return pszSv;
}

PUCHAR My_mbspbrk | ( | PUCHAR | ,
 |  | PUCHAR |
 | ) |  |

Definition at line 4496 of file sdkdiff.cpp.

{
    PUCHAR pszSepT;
    while (*psz != '\0') {
        pszSepT = pszSep;
        while (*pszSepT != '\0') {
            if (*pszSepT == *psz) {
                return psz;
            }
            pszSepT = (PUCHAR)CharNext((LPCSTR)pszSepT);
        }
        psz = (PUCHAR)CharNext((LPCSTR)psz);
    }
    return NULL;
}

LPSTR My_mbsrchr | ( | LPCSTR | ,
 |  | unsigned | short
 | ) |  |

Definition at line 4688 of file sdkdiff.cpp.

{
    unsigned const char *pszHead;

    pszHead = (unsigned char *)psz;

    while (*psz != '\0') {
        psz++;
    }
    if (uiSep == '\0') {
        return (LPSTR)psz;
    }

    while ((LPCSTR)psz > (LPCSTR)pszHead) {
        psz = CharPrev((LPCSTR)pszHead, psz);
        if (*psz == uiSep) {
            break;
        }
    }
    return (LPSTR)(*psz == uiSep ? psz : NULL);
}

void APIENTRY readfile_delete ( FILEBUFFER fb )

Definition at line 391 of file utils.cpp.

{
    HeapFree(GetProcessHeap(), NULL, fbuf);
}

FILEBUFFER APIENTRY readfile_new | ( | HANDLE | fh,
 |  | BOOL * | pfUnicode
 | ) |  |

Definition at line 105 of file utils.cpp.

{
    FILEBUFFER fbuf;
    DWORD cbRead;
    WCHAR wchMagic;

    if (pfUnicode)
        *pfUnicode = FALSE;

    fbuf = (FILEBUFFER) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct filebuffer));
    if (fbuf == NULL) {
        return(NULL);
    }

    if (pfUnicode)
    {
        /* return file pointer to beginning of file */
        SetFilePointer(fh, 0, NULL, FILE_BEGIN);

        if (!ReadFile(fh, &wchMagic, sizeof(wchMagic), &cbRead, NULL)) {
            HeapFree(GetProcessHeap(), NULL, fbuf);
            return (NULL);
        }

        fbuf->fh = fh;
        fbuf->start = fbuf->buffer;
        fbuf->last = fbuf->buffer;
        fbuf->fUnicode = FALSE;
        if (cbRead == 2 && c_wchMagic == wchMagic)
        {
            fbuf->fUnicode = TRUE;
            *pfUnicode = TRUE;
            fbuf->pwzStart = fbuf->wzBuffer;
            fbuf->pwzLast = fbuf->wzBuffer;
        }
        else
        {
            SetFilePointer(fh, 0, NULL, FILE_BEGIN);
        }
    }

    return(fbuf);
}

LPSTR APIENTRY readfile_next | ( | FILEBUFFER | fb,
 |  | int FAR * | plen,
 |  | LPWSTR * | ppwz,
 |  | int * | pcwch
 | ) |  |
void APIENTRY readfile_setdelims ( LPBYTE str )

Definition at line 164 of file utils.cpp.

{
    /* clear all bytes of delims */
    int i;
    for (i=0; i<256; ++i) {
        delims[i] = 0;
    }

    /* set the bytes in delims which correspond to delimiters */
    for (; *str; ++str) {delims[(int)(*str)] = 1;
    }

} /* readfile_setdelims */

BOOL APIENTRY StatusAddItem | ( | HANDLE | hmem,
 |  | int | itemnr,
 |  | int | type,
 |  | int | flags,
 |  | int | id,
 |  | int | width,
 |  | LPSTR | text
 | ) |  |

Definition at line 219 of file status.cpp.

{
    PILIST pilist;
    PSTATEL pel;
  HRESULT hr;

    pilist = (PILIST) hmem;
    if ((pilist == NULL) || (itemnr >= pilist->nitems)) {
        return(FALSE);
    }
    pel = &pilist->statels[itemnr];
    pel->type = type;
    pel->flags = flags;
    pel->id = id;
    pel->width = width;
    if (text == NULL) {
        pel->text[0] = '\0';
    } else {
        hr = StringCchCopy(pel->text,(SF_MAXLABEL+1), text);
    if (FAILED(hr))
      OutputError(hr, IDS_SAFE_COPY);
    }

    return(TRUE);
}

HANDLE APIENTRY StatusAlloc ( int nitems )

Definition at line 196 of file status.cpp.

{
    PILIST pilist;
    LPSTR chp;

    chp = (LPSTR)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
                       sizeof(ILIST) + (sizeof(STATEL) * nitems));
    if (chp == NULL) {
        return(NULL);
    }

    pilist = (PILIST) chp;
    pilist->nitems = nitems;
    pilist->statels = (PSTATEL) &chp[sizeof(ILIST)];

    return(chp);
}

HWND APIENTRY StatusCreate | ( | HANDLE | hInst,
 |  | HWND | hParent,
 |  | INT_PTR | id,
 |  | LPRECT | rcp,
 |  | HANDLE | hmem
 | ) |  |

Definition at line 137 of file status.cpp.

{

    HWND hWnd;

    /* create a child window of status class */

    hWnd = CreateWindow("gdstatusclass",
                        NULL,
                        WS_CHILD | WS_VISIBLE,
                        rcp->left,
                        rcp->top,
                        (rcp->right - rcp->left),
                        (rcp->bottom - rcp->top),
                        hParent,
                        (HMENU) id,
                        (HINSTANCE)hInst,
                        (LPVOID) hmem);

    return(hWnd);
}

int APIENTRY StatusHeight ( HANDLE hmem )

Definition at line 168 of file status.cpp.

{
    PILIST plist;
    int i;
    int sz;
    int maxsize = 0;

    plist = (PILIST) hmem;
    if (plist != NULL) {
        for (i = 0; i<plist->nitems; i++) {
            sz = StatusCalcHeight(NULL, &plist->statels[i]);
            maxsize = max(sz, maxsize);
        }
    }
    if (maxsize > 0) {
        return(maxsize + 4);
    } else {
        return(status_charheight + 4);
    }
}

int APIENTRY StringInput | ( | LPSTR | result,
 |  | int | resultsize,
 |  | LPSTR | prompt,
 |  | LPSTR | caption,
 |  | LPSTR | def_input
 | ) |  |

Definition at line 824 of file utils.cpp.

{
    DLGPROC lpProc;
    BOOL fOK;

    /* copy args to static variable so that winproc can see them */

    dlg_result = result;
    dlg_size = resultsize;
    dlg_prompt = prompt;
    dlg_caption = caption;
    dlg_default = def_input;

    lpProc = (DLGPROC)MakeProcInstance((WINPROCTYPE)dodlg_stringin, hLibInst);
    fOK = (BOOL) DialogBox((HINSTANCE)hLibInst, "StringInput", GetFocus(), lpProc);
    FreeProcInstance((WINPROCTYPE)lpProc);

    return(fOK);
}

void APIENTRY Trace_Close ( void )

Definition at line 634 of file utils.cpp.

{
    if (hTraceFile!=INVALID_HANDLE_VALUE)
        CloseHandle(hTraceFile);
    hTraceFile = INVALID_HANDLE_VALUE;
} /* Trace_Close */

BOOL APIENTRY Trace_Error | ( | HWND | hwnd,
 |  | LPSTR | msg,
 |  | BOOL | fCancel
 | ) |  |

Definition at line 574 of file utils.cpp.

{
    static HANDLE  hErrorLog = INVALID_HANDLE_VALUE;

    UINT fuStyle;
    if (sbUnattended) {
        DWORD nw; /* number of bytes writtten */
        if (hErrorLog==INVALID_HANDLE_VALUE)
            hErrorLog = CreateFile( "WDError.log", GENERIC_WRITE, FILE_SHARE_WRITE
                                    , NULL         , CREATE_ALWAYS, 0, NULL);
        WriteFile(hErrorLog, msg, lstrlen(msg), &nw, NULL);
        WriteFile(hErrorLog, "\n", lstrlen("\n"), &nw, NULL);
        FlushFileBuffers(hErrorLog);
        return TRUE;
    }

    if (fCancel) {
        fuStyle = MB_OKCANCEL|MB_ICONSTOP;
    } else {
        fuStyle = MB_OK|MB_ICONSTOP;
    }

    if (MessageBox(hwnd, msg, NULL, fuStyle) ==  IDOK) {
        return(TRUE);
    } else {
        return(FALSE);
    }
}

void APIENTRY Trace_File ( LPSTR msg )

Definition at line 613 of file utils.cpp.

{
    DWORD nw; /* number of bytes writtten */
    if (hTraceFile==INVALID_HANDLE_VALUE)
        hTraceFile = CreateFile( "sdkdiff.trc"
                                 , GENERIC_WRITE
                                 , FILE_SHARE_WRITE
                                 , NULL
                                 , CREATE_ALWAYS
                                 , 0
                                 , NULL
                               );

    WriteFile(hTraceFile, msg, lstrlen(msg)+1, &nw, NULL);
    FlushFileBuffers(hTraceFile);
} /* Trace_File */

void Trace_Unattended ( BOOL bUnattended )

Definition at line 558 of file utils.cpp.

{
    sbUnattended = bUnattended;
} /* Trace_Unattended */

int APIENTRY utils_CompPath | ( | LPSTR | left,
 |  | LPSTR | right
 | ) |  |

Definition at line 676 of file utils.cpp.

{
    int compval;            // provisional value of comparison

    if (left==NULL) return -1;          // empty is less than anything else
    else if (right==NULL) return 1;           // anything is greater than empty

    for (; ; ) {
        if (*left=='\0' && *right=='\0') return 0;
        if (*left=='\0')  return -1;
        if (*right=='\0')  return 1;
        if (IsDBCSLeadByte(*left) || IsDBCSLeadByte(*right)) {
            if (*right != *left) {
                compval = (*left - *right);
                break;
            }
            ++left;
            ++right;
            if (*right != *left) {
                compval = (*left - *right);
                break;
            }
            ++left;
            ++right;
        } else {
            if (*right==*left) {++left; ++right; continue;}
            if (*left=='\\') {compval = -1; break;}
            if (*right=='\\') {compval = 1; break;}
            compval = (*left - *right);
            break;
        }
    }

    /* We have detected a difference.  If the rest of one
       of the strings (including the current character) contains
       some \ characters, but the other one does not, then all
       elements up to the last element of the one with the fewer
       elements are equal and so the other one lies in a subdir
       and so compares greater i.e. x\y\f > x\f
       Otherwise compval tells the truth.
    */

    left = My_mbschr(left, '\\');
    right = My_mbschr(right, '\\');
    if (left && !right) return 1;
    if (right && !left) return -1;

    return compval;

} /* utils_CompPath */

BOOL APIENTRY utils_isblank ( LPSTR string )

Definition at line 790 of file utils.cpp.

{
    while (IS_BLANK(*string)) {
        string++;
    }

    /* having skipped all the blanks, do we see the end delimiter? */
    return (*string == '\0' || *string == '\n');
}

Generated on Wed Nov 13 2024 16:53:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/sdkdiff/gutilsrc.h File Reference

  • Begin
  • sdkdiff
Defines

gutilsrc.h File Reference

Go to the source code of this file.

Defines

#define | IDC_CANCEL 211
#define | IDC_DIRS 209
#define | IDC_FILES 208
#define | IDC_FNAME 202
#define | IDC_LDIRS 207
#define | IDC_LFILES 204
#define | IDC_LFNAME 201
#define | IDC_LPAGENR 102
#define | IDC_LSDIR 205
#define | IDC_OPEN 210
#define | IDC_PROMPT 203
#define | IDC_SDIR 206
#define | IDD_GUTILS_FILE 302
#define | IDD_GUTILS_LABEL 301
#define | IDS_MEMORY_ALLOC_FAIL 401
#define | IDS_OUT_OF_MEMORY 402
#define | IDS_PAGE_STR 403

Define Documentation

#define IDC_CANCEL 211

Definition at line 25 of file gutilsrc.h.

#define IDC_DIRS 209

Definition at line 23 of file gutilsrc.h.

#define IDC_FILES 208

Definition at line 22 of file gutilsrc.h.

#define IDC_FNAME 202

Definition at line 16 of file gutilsrc.h.

#define IDC_LDIRS 207

Definition at line 21 of file gutilsrc.h.

#define IDC_LFILES 204

Definition at line 18 of file gutilsrc.h.

#define IDC_LFNAME 201

Definition at line 15 of file gutilsrc.h.

#define IDC_LPAGENR 102

Definition at line 13 of file gutilsrc.h.

#define IDC_LSDIR 205

Definition at line 19 of file gutilsrc.h.

#define IDC_OPEN 210

Definition at line 24 of file gutilsrc.h.

#define IDC_PROMPT 203

Definition at line 17 of file gutilsrc.h.

#define IDC_SDIR 206

Definition at line 20 of file gutilsrc.h.

#define IDD_GUTILS_FILE 302

Definition at line 28 of file gutilsrc.h.

#define IDD_GUTILS_LABEL 301

Definition at line 27 of file gutilsrc.h.

#define IDS_MEMORY_ALLOC_FAIL 401

Definition at line 30 of file gutilsrc.h.

#define IDS_OUT_OF_MEMORY 402

Definition at line 31 of file gutilsrc.h.

#define IDS_PAGE_STR 403

Definition at line 32 of file gutilsrc.h.

Generated on Wed Nov 13 2024 16:53:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/sdkdiff/line.cpp File Reference

  • Begin
  • sdkdiff
Classes | Defines | Functions

line.cpp File Reference

#include "precomp.h"
#include "sdkdiff.h"
#include "list.h"
#include "line.h"

Go to the source code of this file.

Classes

struct | fileline

Defines

#define | IS_BLANK(c) (((c) == ' ') || ((c) == '\t') || ((c) == '\r'))
#define | LF_DISCARD 1
#define | LF_HASHVALID 2

Functions

BOOL | line_compare (LINE line1, LINE line2)
void | line_delete (LINE line)
DWORD | line_gethashcode (LINE line)
UINT | line_getlinenr (LINE line)
LINE | line_getlink (LINE line)
int | line_gettabbedlength (LINE line, int tabstops)
LPSTR | line_gettext (LINE line)
int | line_gettextlen (LINE line)
LPWSTR | line_gettextW (LINE line)
BOOL | line_isblank (LINE line)
BOOL | line_link (LINE line1, LINE line2)
LINE | line_new (LPSTR text, int linelength, LPWSTR pwzText, int cwchText, UINT linenr, LIST list)
void | line_reset (LINE line)

Define Documentation

#define IS_BLANK ( c ) (((c) == ' ') || ((c) == '\t') || ((c) == '\r'))

Definition at line 38 of file line.cpp.

#define LF_DISCARD 1

Definition at line 56 of file line.cpp.

#define LF_HASHVALID 2

Definition at line 57 of file line.cpp.

Function Documentation

BOOL line_compare | ( | LINE | line1,
 |  | LINE | line2
 | ) |  |

Definition at line 282 of file line.cpp.

{
    LPSTR p1, p2;

    if ((line1 == NULL) || (line2 == NULL)) {
        /* null line handles do not compare */
        return(FALSE);
    }

    /* check that the hashcodes match */
    if (line_gethashcode(line1) != line_gethashcode(line2)) {
        return(FALSE);
    }

    /* hashcodes match - are the lines really the same ? */
    /* note that this is coupled to gutils\utils.c in definition of blank */
    p1 = line_gettext(line1);
    p2 = line_gettext(line2);
    do {
        if (ignore_blanks) {
            while (IS_BLANK(*p1)) {
                p1 = CharNext(p1);
            }
            while (IS_BLANK(*p2)) {
                p2 = CharNext(p2);
            }
        }
        if (IsDBCSLeadByte(*p1) && *(p1+1) != '\0'
        &&  IsDBCSLeadByte(*p2) && *(p2+1) != '\0') {
            if (*p1 != *p2 || *(p1+1) != *(p2+1)) {
                return(FALSE);
            }
            p1 += 2;
            p2 += 2;
        } else {
            if (*p1 != *p2) {
                return(FALSE);
            }
            p1++;
            p2++;
        }
    } while ( (*p1 != '\0') && (*p2 != '\0'));

    return(TRUE);
}

void line_delete ( LINE line )

Definition at line 128 of file line.cpp.

{
    if (line == NULL) {
        return;
    }

    /* free up text space */
    HeapFree(GetProcessHeap(), NULL, line->text);

    /* free up line itself only if not on list */
    if (line->flags & LF_DISCARD) {
        HeapFree(GetProcessHeap(), NULL, (LPSTR) line);
    }
}

DWORD line_gethashcode ( LINE line )

Definition at line 238 of file line.cpp.

{
    if (line == NULL) {
        return(0);
    }

    if (! (line->flags & LF_HASHVALID)) {
        /* hashcode needs to be recalced */
        line->hash = hash_string(line->text, ignore_blanks);
        line->flags |= LF_HASHVALID;
    }
    return (line->hash);
}

UINT line_getlinenr ( LINE line )

Definition at line 268 of file line.cpp.

{
    if (line == NULL) {
        return(0);
    }

    return(line->linenr);
}

LINE line_getlink ( LINE line )

Definition at line 257 of file line.cpp.

{
    if (line == NULL) {
        return(NULL);
    }

    return(line->link);
}

int line_gettabbedlength | ( | LINE | line,
 |  | int | tabstops
 | ) |  |

Definition at line 212 of file line.cpp.

{
    int length;
    LPSTR chp;

    if (line == NULL) {
        return(0);
    }

    for (length = 0, chp = line->text; *chp != '\0'; chp++) {
        if (*chp == '\t') {
            length = (length + tabstops) / tabstops * tabstops;
        } else {
            if (IsDBCSLeadByte(*chp)) {
                chp++;
                length++;
            }
            length++;
        }
    }
    return(length);
}

LPSTR line_gettext ( LINE line )

Definition at line 161 of file line.cpp.

{
    if (line == NULL) {
        return(NULL);
    }

    return (line->text);
}

int line_gettextlen ( LINE line )

Definition at line 182 of file line.cpp.

{
    int sum = 0;
    LPSTR string = line->text;

    while (*string != '\0') {

        if (ignore_blanks) {
            while (IS_BLANK(*string)) {
                string++;
            }
        }
        if(IsDBCSLeadByte((BYTE)*string)) {
            ++sum;
            ++string;
        }
        ++sum;
        ++string;
    }
    return(sum);
}

LPWSTR line_gettextW ( LINE line )

Definition at line 172 of file line.cpp.

{
    if (line == NULL) {
        return(NULL);
    }

    return (line->pwzText);
}

BOOL line_isblank ( LINE line )

Definition at line 356 of file line.cpp.

{
    return line!=NULL && utils_isblank(line->text);
}

BOOL line_link | ( | LINE | line1,
 |  | LINE | line2
 | ) |  |

Definition at line 335 of file line.cpp.

{
    if ( (line1 == NULL) || (line2 == NULL)) {
        return(FALSE);
    }

    if ( (line1->link != NULL) || (line2->link != NULL)) {
        return(FALSE);
    }

    if (line_compare(line1, line2)) {
        line1->link = line2;
        line2->link = line1;
        return(TRUE);
    } else {
        return(FALSE);
    }
}

LINE line_new | ( | LPSTR | text,
 |  | int | linelength,
 |  | LPWSTR | pwzText,
 |  | int | cwchText,
 |  | UINT | linenr,
 |  | LIST | list
 | ) |  |

Definition at line 67 of file line.cpp.

{
    LINE line;
    int cch = 0;

    /* alloc a line. from the list if there is a list */
    if (list) {
        line = (LINE)List_NewLast(list, sizeof(struct fileline));
        if (line == NULL) {
            return(NULL);
        }
        line->flags = 0;
    } else {
        line = (LINE) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct fileline));
        if (line == NULL) {
            return(NULL);
        }
        line->flags = LF_DISCARD;
    }

    /* alloc space for the text. remember the null character */
    /* also add cr/nl pair if absent for composite file */
    cch = (text[linelength - 1] == '\n') ? 1 : 3;
    line->text = (char*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, linelength + cch);
    if (line->text == NULL)
    return NULL;
  My_mbsncpy(line->text, text, linelength);
    if (cch == 3) {
        line->text[linelength++] = '\r';
        line->text[linelength++] = '\n';
    }
    line->text[linelength] = '\0';

    line->pwzText = 0;
    if (pwzText)
    {
        /* alloc space for the unicode text. remember the null character */
        /* also add cr/nl pair if absent for composite file */
        cch = (pwzText[cwchText - 1] == '\n') ? 1 : 3;
        line->pwzText = (WCHAR*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (cwchText + cch) * sizeof(*pwzText));
        if (line->pwzText == NULL)
      return NULL;
    wcsncpy(line->pwzText, pwzText, cwchText);
        if (cch == 3) {
            line->pwzText[cwchText++] = '\r';
            line->pwzText[cwchText++] = '\n';
        }
        line->pwzText[cwchText] = '\0';
    }

    line->link = NULL;
    line->linenr = linenr;

    return(line);
}

void line_reset ( LINE line )

Definition at line 147 of file line.cpp.

{
    if (line == NULL) {
        return;
    }

    line->link = NULL;

    line->flags &= ~LF_HASHVALID;
}

Generated on Wed Nov 13 2024 16:53:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/sdkdiff/line.h File Reference

  • Begin
  • sdkdiff
Typedefs | Functions

line.h File Reference

Go to the source code of this file.

Typedefs

typedef struct fileline FAR * | LINE

Functions

BOOL | line_compare (LINE line1, LINE line2)
void | line_delete (LINE line)
DWORD | line_gethashcode (LINE line)
UINT | line_getlinenr (LINE line)
LINE | line_getlink (LINE line)
int | line_gettabbedlength (LINE line, int tabstops)
LPSTR | line_gettext (LINE line)
int | line_gettextlen (LINE line)
LPWSTR | line_gettextW (LINE line)
BOOL | line_isblank (LINE line)
BOOL | line_link (LINE line1, LINE line2)
LINE | line_new (LPSTR text, int linelength, LPWSTR pwzText, int cwchText, UINT linenr, LIST list)
void | line_reset (LINE line)

Typedef Documentation

typedef struct fileline FAR* LINE

Definition at line 35 of file line.h.

Function Documentation

BOOL line_compare | ( | LINE | line1,
 |  | LINE | line2
 | ) |  |

Definition at line 282 of file line.cpp.

{
    LPSTR p1, p2;

    if ((line1 == NULL) || (line2 == NULL)) {
        /* null line handles do not compare */
        return(FALSE);
    }

    /* check that the hashcodes match */
    if (line_gethashcode(line1) != line_gethashcode(line2)) {
        return(FALSE);
    }

    /* hashcodes match - are the lines really the same ? */
    /* note that this is coupled to gutils\utils.c in definition of blank */
    p1 = line_gettext(line1);
    p2 = line_gettext(line2);
    do {
        if (ignore_blanks) {
            while (IS_BLANK(*p1)) {
                p1 = CharNext(p1);
            }
            while (IS_BLANK(*p2)) {
                p2 = CharNext(p2);
            }
        }
        if (IsDBCSLeadByte(*p1) && *(p1+1) != '\0'
        &&  IsDBCSLeadByte(*p2) && *(p2+1) != '\0') {
            if (*p1 != *p2 || *(p1+1) != *(p2+1)) {
                return(FALSE);
            }
            p1 += 2;
            p2 += 2;
        } else {
            if (*p1 != *p2) {
                return(FALSE);
            }
            p1++;
            p2++;
        }
    } while ( (*p1 != '\0') && (*p2 != '\0'));

    return(TRUE);
}

void line_delete ( LINE line )

Definition at line 128 of file line.cpp.

{
    if (line == NULL) {
        return;
    }

    /* free up text space */
    HeapFree(GetProcessHeap(), NULL, line->text);

    /* free up line itself only if not on list */
    if (line->flags & LF_DISCARD) {
        HeapFree(GetProcessHeap(), NULL, (LPSTR) line);
    }
}

DWORD line_gethashcode ( LINE line )

Definition at line 238 of file line.cpp.

{
    if (line == NULL) {
        return(0);
    }

    if (! (line->flags & LF_HASHVALID)) {
        /* hashcode needs to be recalced */
        line->hash = hash_string(line->text, ignore_blanks);
        line->flags |= LF_HASHVALID;
    }
    return (line->hash);
}

UINT line_getlinenr ( LINE line )

Definition at line 268 of file line.cpp.

{
    if (line == NULL) {
        return(0);
    }

    return(line->linenr);
}

LINE line_getlink ( LINE line )

Definition at line 257 of file line.cpp.

{
    if (line == NULL) {
        return(NULL);
    }

    return(line->link);
}

int line_gettabbedlength | ( | LINE | line,
 |  | int | tabstops
 | ) |  |

Definition at line 212 of file line.cpp.

{
    int length;
    LPSTR chp;

    if (line == NULL) {
        return(0);
    }

    for (length = 0, chp = line->text; *chp != '\0'; chp++) {
        if (*chp == '\t') {
            length = (length + tabstops) / tabstops * tabstops;
        } else {
            if (IsDBCSLeadByte(*chp)) {
                chp++;
                length++;
            }
            length++;
        }
    }
    return(length);
}

LPSTR line_gettext ( LINE line )

Definition at line 161 of file line.cpp.

{
    if (line == NULL) {
        return(NULL);
    }

    return (line->text);
}

int line_gettextlen ( LINE line )

Definition at line 182 of file line.cpp.

{
    int sum = 0;
    LPSTR string = line->text;

    while (*string != '\0') {

        if (ignore_blanks) {
            while (IS_BLANK(*string)) {
                string++;
            }
        }
        if(IsDBCSLeadByte((BYTE)*string)) {
            ++sum;
            ++string;
        }
        ++sum;
        ++string;
    }
    return(sum);
}

LPWSTR line_gettextW ( LINE line )

Definition at line 172 of file line.cpp.

{
    if (line == NULL) {
        return(NULL);
    }

    return (line->pwzText);
}

BOOL line_isblank ( LINE line )

Definition at line 356 of file line.cpp.

{
    return line!=NULL && utils_isblank(line->text);
}

BOOL line_link | ( | LINE | line1,
 |  | LINE | line2
 | ) |  |

Definition at line 335 of file line.cpp.

{
    if ( (line1 == NULL) || (line2 == NULL)) {
        return(FALSE);
    }

    if ( (line1->link != NULL) || (line2->link != NULL)) {
        return(FALSE);
    }

    if (line_compare(line1, line2)) {
        line1->link = line2;
        line2->link = line1;
        return(TRUE);
    } else {
        return(FALSE);
    }
}

LINE line_new | ( | LPSTR | text,
 |  | int | linelength,
 |  | LPWSTR | pwzText,
 |  | int | cwchText,
 |  | UINT | linenr,
 |  | LIST | list
 | ) |  |

Definition at line 67 of file line.cpp.

{
    LINE line;
    int cch = 0;

    /* alloc a line. from the list if there is a list */
    if (list) {
        line = (LINE)List_NewLast(list, sizeof(struct fileline));
        if (line == NULL) {
            return(NULL);
        }
        line->flags = 0;
    } else {
        line = (LINE) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct fileline));
        if (line == NULL) {
            return(NULL);
        }
        line->flags = LF_DISCARD;
    }

    /* alloc space for the text. remember the null character */
    /* also add cr/nl pair if absent for composite file */
    cch = (text[linelength - 1] == '\n') ? 1 : 3;
    line->text = (char*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, linelength + cch);
    if (line->text == NULL)
    return NULL;
  My_mbsncpy(line->text, text, linelength);
    if (cch == 3) {
        line->text[linelength++] = '\r';
        line->text[linelength++] = '\n';
    }
    line->text[linelength] = '\0';

    line->pwzText = 0;
    if (pwzText)
    {
        /* alloc space for the unicode text. remember the null character */
        /* also add cr/nl pair if absent for composite file */
        cch = (pwzText[cwchText - 1] == '\n') ? 1 : 3;
        line->pwzText = (WCHAR*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (cwchText + cch) * sizeof(*pwzText));
        if (line->pwzText == NULL)
      return NULL;
    wcsncpy(line->pwzText, pwzText, cwchText);
        if (cch == 3) {
            line->pwzText[cwchText++] = '\r';
            line->pwzText[cwchText++] = '\n';
        }
        line->pwzText[cwchText] = '\0';
    }

    line->link = NULL;
    line->linenr = linenr;

    return(line);
}

void line_reset ( LINE line )

Definition at line 147 of file line.cpp.

{
    if (line == NULL) {
        return;
    }

    line->link = NULL;

    line->flags &= ~LF_HASHVALID;
}

Generated on Wed Nov 13 2024 16:53:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/sdkdiff/list.cpp File Reference

  • Begin
  • sdkdiff
Classes | Defines | Typedefs | Functions | Variables

list.cpp File Reference

#include "precomp.h"
#include "list.h"
#include "..\sdkdiff\errorout.h"

Go to the source code of this file.

Classes

struct | blockTag
struct | item_tag

Defines

#define | BLOCKSIZE 25000
#define | MOVEBACK(Curs) { Curs = ((char *)Curs-iHeaderSize); }
#define | TRACE_ERROR(a, b) Trace_Error(NULL, a, b)

Typedefs

typedef struct blockTag | BLOCK
typedef struct item_tag | ITEM
typedef struct blockTag * | PBLOCK

Functions

void APIENTRY | List_AddAfter (LIST lst, LPVOID Curs, LPVOID pObject, UINT uLen)
void APIENTRY | List_AddBefore (LIST lst, LPVOID Curs, LPVOID pObject, UINT uLen)
void APIENTRY | List_AddFirst (LIST lst, LPVOID pObject, UINT uLen)
void APIENTRY | List_AddLast (LIST lst, LPVOID pObject, UINT uLen)
LPVOID | list_Alloc (SIZE_T size)
int APIENTRY | List_Card (LIST lst)
BOOL APIENTRY | List_Check (LIST lst)
void APIENTRY | List_Clear (LIST lst)
LIST APIENTRY | List_Create (void)
void APIENTRY | List_Delete (LPVOID Curs)
LPVOID APIENTRY | List_DeleteBackwards (LPVOID Curs)
void APIENTRY | List_DeleteFirst (LIST lst)
LPVOID APIENTRY | List_DeleteForwards (LPVOID Curs)
void APIENTRY | List_DeleteLast (LIST lst)
void APIENTRY | List_Destroy (PLIST plst)
void APIENTRY | List_Dump (LPSTR Header, LIST lst)
LPVOID APIENTRY | List_First (LIST lst)
void | list_Free (PBLOCK pBlock, LPVOID p)
void APIENTRY | List_Init (void)
void APIENTRY | List_InsertListAfter (LIST l1, LIST l2, LPVOID Curs)
void APIENTRY | List_InsertListBefore (LIST l1, LIST l2, LPVOID Curs)
BOOL APIENTRY | List_IsEmpty (LIST lst)
BOOL APIENTRY | List_IsOK (LIST lst)
int APIENTRY | List_ItemLength (LPVOID Curs)
void APIENTRY | List_Join (LIST l1, LIST l2)
LPVOID APIENTRY | List_Last (LIST lst)
void APIENTRY | List_MakeOK (LIST lst)
LPVOID APIENTRY | List_NewAfter (LIST lst, LPVOID Curs, UINT uLen)
LPVOID APIENTRY | List_NewBefore (LIST lst, LPVOID Curs, UINT uLen)
LPVOID APIENTRY | List_NewFirst (LIST lst, UINT uLen)
LPVOID APIENTRY | List_NewLast (LIST lst, UINT uLen)
LPVOID APIENTRY | List_Next (LPVOID Curs)
LPVOID APIENTRY | List_Prev (LPVOID Curs)
void APIENTRY | List_Recover (PLIST plst)
void APIENTRY | List_Show (LIST lst)
void APIENTRY | List_SplitAfter (LIST l1, LIST l2, LPVOID Curs)
void APIENTRY | List_SplitBefore (LIST l1, LIST l2, LPVOID Curs)
void APIENTRY | List_Term (void)
void APIENTRY | SwitchLists (LIST l1, LIST l2)

Variables

CRITICAL_SECTION | CritSec
char | msg [80]
PBLOCK | pCurrent = NULL

Define Documentation

#define BLOCKSIZE 25000

Definition at line 23 of file list.cpp.

#define MOVEBACK ( Curs ) { Curs = ((char *)Curs-iHeaderSize); }

Definition at line 144 of file list.cpp.

#define TRACE_ERROR | ( | a,
 |  | b |
 | ) |  | Trace_Error(NULL, a, b)

Definition at line 18 of file list.cpp.

Typedef Documentation

typedef struct blockTag BLOCK
typedef struct item_tag ITEM
typedef struct blockTag * PBLOCK

Function Documentation

void APIENTRY List_AddAfter | ( | LIST | lst,
 |  | LPVOID | Curs,
 |  | LPVOID | pObject,
 |  | UINT | uLen
 | ) |  |

Definition at line 526 of file list.cpp.

{
    LIST pitNew;
    LIST pitAfter;

    if (lst==NULL) {
        TRACE_ERROR("Bug: List_AddAfter in bogus list.  Continuing...", FALSE);
        return;
    }
    if (Curs==NULL) {
        List_AddFirst(lst, pObject, uLen);
    } else {
        MOVEBACK(Curs);
        pitAfter = (LIST)Curs;
        pitNew = (LIST)list_Alloc(iHeaderSize+uLen);
        if (pitNew==NULL) {
            lst->bOK = FALSE;
            return;
        }
        pitNew->pBlock = pCurrent;
        LeaveCriticalSection(&CritSec);
        pitNew->iLen = uLen;
        pitNew->pitPrev = pitAfter;
        pitNew->pitNext = pitAfter->pitNext;
        pitAfter->pitNext->pitPrev = pitNew;
        pitAfter->pitNext = pitNew;
        pitNew->bAnchor = FALSE;
        memcpy( &(pitNew->Data), pObject, uLen );
    }
}

void APIENTRY List_AddBefore | ( | LIST | lst,
 |  | LPVOID | Curs,
 |  | LPVOID | pObject,
 |  | UINT | uLen
 | ) |  |

Definition at line 611 of file list.cpp.

{
    LIST pitNew;
    LIST pitBefore;

    if (lst==NULL) {
        TRACE_ERROR("Bug: List_AddBefore in bogus list.  Continuing...", FALSE);
        return;
    }
    if (Curs==NULL) {
        List_AddLast(lst, pObject, uLen);
    } else {
        MOVEBACK(Curs);
        pitBefore = (LIST)Curs;
        pitNew = (LIST)list_Alloc(iHeaderSize+uLen);
        if (pitNew==NULL) {
            lst->bOK = FALSE;
            return;
        }
        pitNew->pBlock = pCurrent;
        LeaveCriticalSection(&CritSec);
        pitNew->iLen = uLen;
        pitNew->pitNext = pitBefore;
        pitNew->pitPrev = pitBefore->pitPrev;
        pitBefore->pitPrev->pitNext = pitNew;
        pitBefore->pitPrev = pitNew;
        pitNew->bAnchor = FALSE;
        memcpy( &(pitNew->Data), pObject, uLen );
    }
}

void APIENTRY List_AddFirst | ( | LIST | lst,
 |  | LPVOID | pObject,
 |  | UINT | uLen
 | ) |  |

Definition at line 342 of file list.cpp.

{
    LIST pit;      /* newly allocated item */

    if (lst==NULL) {
        TRACE_ERROR("Bug: List_AddFirst to bogus list.  Continuing...", FALSE);
        return;
    }
    pit = (LIST)list_Alloc(iHeaderSize+uLen);
    if (pit==NULL) {
        lst->bOK = FALSE;
        return;
    }
    pit->pBlock = pCurrent;
    LeaveCriticalSection(&CritSec);
    pit->iLen = uLen;
    pit->pitPrev = lst;
    pit->pitNext = lst->pitNext;
    lst->pitNext->pitPrev = pit; /* for empty list that set lst->pitPrev */
    lst->pitNext = pit;
    pit->bAnchor = FALSE;
    memcpy( &(pit->Data), pObject, uLen );
}

void APIENTRY List_AddLast | ( | LIST | lst,
 |  | LPVOID | pObject,
 |  | UINT | uLen
 | ) |  |

Definition at line 433 of file list.cpp.

{
    LIST pit;

    if (lst==NULL) {
        TRACE_ERROR("Bug: List_AddLast to bogus list. Continuing...", FALSE);
        return;
    }
    pit = (LIST)list_Alloc(iHeaderSize+uLen);
    if (pit==NULL) {
        lst->bOK = FALSE;
        return;
    }
    pit->pBlock = pCurrent;
    LeaveCriticalSection(&CritSec);
    pit->iLen = uLen;
    pit->pitNext = lst;
    pit->pitPrev = lst->pitPrev;
    lst->pitPrev->pitNext = pit; /* for empty list that set lst->pitNext */
    lst->pitPrev = pit;
    pit->bAnchor = FALSE;
    memcpy( &(pit->Data), pObject, uLen );
}

LPVOID list_Alloc ( SIZE_T size )

Definition at line 45 of file list.cpp.

{
    LPVOID pRet;
    PBLOCK pb;
    EnterCriticalSection(&CritSec);
    if ((pCurrent==NULL)||(pCurrent->iNext+size>BLOCKSIZE+1)) {
    pb = pCurrent;
        pCurrent = (struct blockTag*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY ,(sizeof(BLOCK)));
        if (pCurrent==NULL) {
            OutputDebugString("HeapAlloc failed!!\n");
            return NULL;
        }

        pCurrent->PrevBlock = pb;
        pCurrent->NextBlock = NULL;
        pCurrent->hMem = pCurrent;
        pCurrent->iInUse = 0;
        pCurrent->iNext = 0;
        if (pb==NULL)
            ;
        else
            pb->NextBlock = pCurrent;
    }
    pRet = &(pCurrent->chData[pCurrent->iNext]);
    ++(pCurrent->iInUse);
    pCurrent->iNext += size;

    /* for MIPS we must also ensure that the data is aligned 4 byte*/
    pCurrent->iNext = ((pCurrent->iNext + (sizeof(void *)-1)) & ~(sizeof(void *) - 1));

    return pRet;
}

int APIENTRY List_Card ( LIST lst )

Definition at line 1201 of file list.cpp.

{
    LIST pit;     /* item cursor on lst */
    int cit;

    if (lst==NULL) {
        TRACE_ERROR("Bug: List_Card of bogus list.  Continuing...", FALSE);
        return 0;    /* well it is sort of 0 */
    }
    pit = lst->pitNext;
    cit = 0;
    while (pit!=lst) {
        cit++;
        pit = pit->pitNext;
    }
    return cit;
}

BOOL APIENTRY List_Check ( LIST lst )

Definition at line 1255 of file list.cpp.

{
    LIST pel;
    BOOL bOK;
    /*-----------------------------------------------------------------
    | Check the anchor block has the Anchor flag set.
    | Run through the LIST using the Anchor flag (which should be FALSE)
    | to mark where we have been (to test for loops in the chain)
    | and carry on until we see the Anchor flag again.  Check that this
    | is the anchor block that we started from.  Now do another pass
    | turning the Anchor flags off again and checking the Prev pointers.
     -------------------------------------------------------------------*/
    if (lst==NULL)
        return FALSE;
    bOK = lst->bAnchor;
    pel = lst->pitNext;
    while (! pel->bAnchor) {
        pel->bAnchor = TRUE;
        pel = pel->pitNext;
    }
    bOK = bOK && (pel==lst);
    if (bOK) {
        /* Turn all the bAnchor flags off */
        pel = lst;
        do {pel->bAnchor = FALSE;
            bOK = bOK & (pel->pitNext->pitPrev==pel);
            pel = pel->pitNext;
        } while (pel!=lst);
        lst->bAnchor = TRUE;  /* except the real one */
    } else { /* just turn off those that we set on */
        pel = lst->pitNext;
        while (pel->bAnchor) {
            pel->bAnchor = FALSE;
            pel = pel->pitNext;
        }
        lst->bAnchor = TRUE;
    }
    return bOK;
}

void APIENTRY List_Clear ( LIST lst )

Definition at line 891 of file list.cpp.

{
    LIST pitP;   /* item cursor on List, points to element starts */
    LIST pitQ;   /* runs one step ahead of pitP                   */

    if (lst==NULL) {
        TRACE_ERROR("Bug: List_Clear of bogus list.  Continuing...", FALSE);
        return;
    }
    pitP = lst->pitNext;   /* first element of list proper */
    while (pitP!=lst) {      /* while not wrapped onto anchor */pitQ = pitP->pitNext;
        list_Free(pitP->pBlock, pitP);
        pitP = pitQ;
    }
    lst->bOK = TRUE;
    lst->pitNext = lst;
    lst->pitPrev = lst;
}

LIST APIENTRY List_Create ( void )

Definition at line 287 of file list.cpp.

{
    LIST lst;
    if (!bInited) {
        List_Init();            /* prevent some strange errors */
    }
    lst = (LIST)list_Alloc(iAnchorSize);

    if (lst==NULL) {
        return NULL;
    }
    lst->pBlock = pCurrent;
    LeaveCriticalSection(&CritSec);
    lst->bOK = TRUE;
    lst->pitNext = lst;
    lst->pitPrev = lst;
    lst->bAnchor = TRUE;
    /* no length field set in an anchor block */
    return lst;
}

void APIENTRY List_Delete ( LPVOID Curs )

Definition at line 701 of file list.cpp.

{
    LIST pit;
    if (Curs==NULL) {
        TRACE_ERROR("Bug: List_Delete NULL item", FALSE);
        return;
    }
    MOVEBACK(Curs)
    pit = (LIST)Curs;
    pit->pitNext->pitPrev = pit->pitPrev;
    pit->pitPrev->pitNext = pit->pitNext;
    list_Free(pit->pBlock, pit);
}

LPVOID APIENTRY List_DeleteBackwards ( LPVOID Curs )

Definition at line 752 of file list.cpp.

{
    LIST pitDel;  /* the one to delete */
    LIST pitB;    /* the one before */

    if (Curs==NULL) {
        TRACE_ERROR("List_DeleteBackwards NULL cursor.  Continuing...", FALSE);
        return NULL;
    }
    MOVEBACK(Curs)
    pitDel = (LIST)Curs;
    pitB = pitDel->pitPrev;
    pitDel->pitNext->pitPrev = pitB;
    pitB->pitNext = pitDel->pitNext;
    list_Free(pitDel->pBlock, pitDel);
    if (pitB->bAnchor)
        return NULL;
    else
        return (char *)&(pitB->Data);
}

void APIENTRY List_DeleteFirst ( LIST lst )

Definition at line 408 of file list.cpp.

{
    LIST pit;

    if (lst==NULL) {TRACE_ERROR("Bug: List_DeleteFirst from bogus list.  Continuing...", FALSE);
        return;
    }
    /* attempting to delete the anchor block! */
    if (lst->pitNext==lst) {
        lst->bOK = FALSE;
    } else {
        pit = lst->pitNext;
        pit->pitNext->pitPrev = pit->pitPrev;
        pit->pitPrev->pitNext = pit->pitNext;
        list_Free(pit->pBlock, pit);
    }
}

LPVOID APIENTRY List_DeleteForwards ( LPVOID Curs )

Definition at line 723 of file list.cpp.

{
    LIST pitDel;  /* the item to delete */
    LIST pitN;    /* the item after (could be anchor) */
    if (Curs==NULL) {
        TRACE_ERROR("Bug: List_DeleteForwards NULL cursor. Continuing...", FALSE);
        return NULL;
    }
    MOVEBACK(Curs)
    pitDel = (LIST)Curs;
    pitN = pitDel->pitNext;

    pitN->pitPrev = pitDel->pitPrev;
    pitDel->pitPrev->pitNext = pitN;
    list_Free(pitDel->pBlock, pitDel);
    if (pitN->bAnchor)
        return NULL;
    else
        return (char *)&(pitN->Data);
}

void APIENTRY List_DeleteLast ( LIST lst )

Definition at line 499 of file list.cpp.

{
    LIST pit;

    if (lst==NULL) {
        TRACE_ERROR("Bug: List_DeleteLast from bogus list.  Continuing...", FALSE);
        return;
    }
    /* attempting to delete the anchor block! */
    if (lst->pitNext==lst) {
        lst->bOK = FALSE;
    } else {
        pit = lst->pitPrev;
        pit->pitNext->pitPrev = pit->pitPrev;
        pit->pitPrev->pitNext = pit->pitNext;
        list_Free(pit->pBlock, pit);
    }
}

void APIENTRY List_Destroy ( PLIST plst )

Definition at line 315 of file list.cpp.

{
    LIST pitP;    /* item cursor on * plst */
    LIST pitQ;    /* item cursor runs one step ahead of pitQ */

    if (plst==NULL) {
        TRACE_ERROR("Bug:Attempt to destroy NULL list.  Continuing...", FALSE);
        return;
    }

    /* There is at least an anchor block to destroy */
    pitP = *plst;
    do {
        pitQ = pitP->pitNext;
        list_Free(pitP->pBlock, pitP);
        pitP = pitQ;
    }while (pitP != *plst);
    *plst = NULL;
}

void APIENTRY List_Dump | ( | LPSTR | Header,
 |  | LIST | lst
 | ) |  |

Definition at line 239 of file list.cpp.

{
    LIST pit;
  HRESULT hr;
    char X_msg[250] = {0};

    OutputDebugString(Header);  OutputDebugString("\n");
    pit = lst;
    do {
        hr = StringCchPrintf(X_msg, sizeof(X_msg)-1, "%8p %8p %8p %ld %s "
                 , pit, pit->pitNext, pit->pitPrev, pit->iLen
                 , (pit->bAnchor ? "Anchor" : "Data")
                );
    if (FAILED(hr))
      OutputError(hr, IDS_SAFE_PRINTF);
        OutputDebugString(X_msg);
        if (pit->pitNext->pitPrev != pit)
            OutputDebugString(" Next Prev error!!");
        if (pit->pitPrev->pitNext != pit)
            OutputDebugString(" Prev Next error!!");
        OutputDebugString("\n");
        pit = pit->pitNext;
    } while (pit!=lst);
    OutputDebugString("End of list dump\n");
}

LPVOID APIENTRY List_First ( LIST lst )

Definition at line 800 of file list.cpp.

{
    if (lst==NULL) {
        TRACE_ERROR("Bug: List_First of bogus list.  Continuing...", FALSE);
        return NULL;
    }
    if (lst->pitNext==lst) {
        return NULL;
    }
    return &(lst->pitNext->Data);
}

void list_Free | ( | PBLOCK | pBlock,
 |  | LPVOID | p
 | ) |  |

Definition at line 81 of file list.cpp.

{
    HANDLE hMem;
  HRESULT hr;

    EnterCriticalSection(&CritSec);
    --pBlock->iInUse;
    if (pBlock->iInUse<=0) {if (pBlock->iInUse<0) {
      hr = StringCchPrintf(msg, sizeof(msg),"List block allocation negative (%d)", pBlock->iInUse);
      if (FAILED(hr))
        OutputError(hr, IDS_SAFE_PRINTF);
            TRACE_ERROR(msg, FALSE);
        }
        if (pCurrent==pBlock) pCurrent = pBlock->PrevBlock; /* defend the invariant */
        /* loop it out of the chain */
        if (pBlock->PrevBlock!=NULL) pBlock->PrevBlock->NextBlock = pBlock->NextBlock;
        if (pBlock->NextBlock!=NULL) pBlock->NextBlock->PrevBlock = pBlock->PrevBlock;
        hMem = pBlock->hMem;
        HeapFree(GetProcessHeap(), NULL, hMem);
    }
    LeaveCriticalSection(&CritSec);
}

void APIENTRY List_Init ( void )

Definition at line 210 of file list.cpp.

{
    LIST P;
    P = (LIST)&P;                  /* really any old address will do */
    iAnchorSize = (char *)&(P->iLen) - (char *)&(P->pitNext);
    iHeaderSize = (char *)&(P->Data) - (char *)&(P->pitNext);
    InitializeCriticalSection(&CritSec);
    bInited = TRUE;
    /* assumes layout in storage is linear */
}

void APIENTRY List_InsertListAfter | ( | LIST | l1,
 |  | LIST | l2,
 |  | LPVOID | Curs
 | ) |  |

Definition at line 996 of file list.cpp.

{
    LIST pitA;     /* The element after Curs, could be anchor */
    LIST pit;      /* The start of the element that Curs points at
                   |  or the anchor block if Curs==NULL
                   */

    if ( (l1==NULL) || (l2==NULL)) {
        TRACE_ERROR("Bug: List_InsertListAfter with bogus list.  Continuing...", FALSE);
        return;
    }
    l1->bOK = l1->bOK && l2->bOK;
    l2->bOK = TRUE;
    if (l2->pitNext==l2) {
        /* no elements need moving */
    } else if ( l1->pitNext==l1) {
        /* the easy way to code this would be simply to switch the two
        |  pointers l1 and l2, but they are value parameters and we don't
        |  want to change that.
        */
        SwitchLists(l1,l2);
        return;
    } else {
        if (Curs==NULL) {
            pit = l1;
        } else {
            MOVEBACK(Curs)
            pit = (LIST)Curs;
        }
        /* pit points to a block to insert after, could be anchor */
        pitA = pit->pitNext;           /* Cannot be same as P, already checked */
        l2->pitNext->pitPrev = pit;    /*  P<-- elems-of-l2    A */
        l2->pitPrev->pitNext = pitA;   /*  P<-- elems-of-l2 -->A */
        pit->pitNext = l2->pitNext;    /*  P<-->elems-of-l2 -->A */
        pitA->pitPrev = l2->pitPrev;   /*  P<-->elems-of-l2<-->A */

        l2->pitNext = l2;
        l2->pitPrev = l2;
    }
}

void APIENTRY List_InsertListBefore | ( | LIST | l1,
 |  | LIST | l2,
 |  | LPVOID | Curs
 | ) |  |

Definition at line 1054 of file list.cpp.

{
    LIST pitB;     /* The element before Curs, could be anchor */
    LIST pit;      /* The start of the element that Curs points at
                    |  or the anchor block if Curs==NULL
                    */

    if ((l1==NULL) || (l2==NULL)) {
        TRACE_ERROR("Bug: List_InsertListBefore with bogus list.  Continuing...", FALSE);
        return;
    }
    l1->bOK = l1->bOK && l2->bOK;
    l2 ->bOK = TRUE;
    if (l1->pitNext==l1) {
        /* the easy way to code this would be simply to switch the two
        |  pointers l1 and l2, but they are value parameters and we don't
        |  want to change that.
        */
        SwitchLists(l1,l2);
        return;
    } else {
        if (Curs==NULL) {
            pit = l1;
        } else {
            MOVEBACK(Curs)
            pit = (LIST)Curs;
        }

        /* P points to a block to insert before, could be anchor */
        pitB = pit->pitPrev;       /* Cannot be same as P, already checked */
        l2->pitNext->pitPrev = pitB; /*  B<-- elems-of-L2    P */
        l2->pitPrev->pitNext = pit;  /*  B<-- elems-of-L2 -->P */
        pitB->pitNext = l2->pitNext; /*  B<-->elems-of-L2 -->P */
        pit->pitPrev = l2->pitPrev;  /*  B<-->elems-of-L2<-->P */
        l2->pitNext = l2;
        l2->pitPrev = l2;
    }
}

BOOL APIENTRY List_IsEmpty ( LIST lst )

Definition at line 917 of file list.cpp.

{  if (lst==NULL) {TRACE_ERROR("Bug: List_IsEmpty of bogus list.  Continuing...", FALSE);
        return TRUE;   /* well it's sort of true isn't it? */
    }
    return lst->pitNext ==lst;
} /* List_IsEmpty */

BOOL APIENTRY List_IsOK ( LIST lst )

Definition at line 1226 of file list.cpp.

{
    if (lst==NULL) {
        TRACE_ERROR("Bug: List_IsOK of bogus list.  Continuing...", FALSE);
        return FALSE;       /* well it is sick ain't it! */
    }
    return lst->bOK;
}

int APIENTRY List_ItemLength ( LPVOID Curs )

Definition at line 780 of file list.cpp.

{
    LIST pit;
    if (Curs==NULL) {
        TRACE_ERROR("Bug: List_ItemLength NULL cursor.  Continuing...", FALSE);
        return 0;
    }
    MOVEBACK(Curs)
    pit = (LIST)Curs;
    return pit->iLen;
}

void APIENTRY List_Join | ( | LIST | l1,
 |  | LIST | l2
 | ) |  |

Definition at line 957 of file list.cpp.

{
    if ((l1==NULL)||(l2==NULL)) {
        TRACE_ERROR("Bug: List_Join of bogus list.  Continuing...", FALSE);
        return;
    }
    l1->bOK = l1->bOK &&l2->bOK;  /* result OK if both inputs OK */
    l2->bOK = TRUE;               /* as l2 always becomes empty */
    if (l2->pitNext==l2) {
        /* no elements need moving */
    } else if (l2->pitNext==l2) {
        SwitchLists(l1,l2);
        return;
    } else {
        l2->pitNext->pitPrev = l1->pitPrev;
        l1->pitPrev->pitNext = l2->pitNext;
        l1->pitPrev = l2->pitPrev;
        l1->pitPrev->pitNext = l1;
        l2->pitNext = l2;
        l2->pitPrev = l2;
    }
}

LPVOID APIENTRY List_Last ( LIST lst )

Definition at line 820 of file list.cpp.

{
    if (lst==NULL) {
        TRACE_ERROR("Bug: List_Last of bogus list.  Continuing...", FALSE);
        return NULL;
    }
    if (lst->pitNext==lst) {
        return NULL;
    }
    return &(lst->pitPrev->Data);
}

void APIENTRY List_MakeOK ( LIST lst )

Definition at line 1242 of file list.cpp.

{
    if (lst==NULL) {
        TRACE_ERROR("Bug: List_MakeOK of bogus list.  Continuing...", FALSE);
        return;
    }
    lst->bOK = TRUE;
}

LPVOID APIENTRY List_NewAfter | ( | LIST | lst,
 |  | LPVOID | Curs,
 |  | UINT | uLen
 | ) |  |

Definition at line 570 of file list.cpp.

{
    LIST pitNew;
    LIST pitAfter;

    if (lst==NULL) {
        TRACE_ERROR("Bug: List_NewAfter in bogus list. Continuing...", FALSE);
        return NULL;
    }
    if (Curs==NULL) {
        return List_NewFirst(lst, uLen);
    } else {
        MOVEBACK(Curs);
        pitAfter = (LIST)Curs;
        pitNew = (LIST)list_Alloc(iHeaderSize+uLen);
        if (pitNew==NULL) {
            lst->bOK = FALSE;
            return NULL;
        }
        pitNew->pBlock = pCurrent;
        LeaveCriticalSection(&CritSec);
        pitNew->iLen = uLen;
        pitNew->pitPrev = pitAfter;
        pitNew->pitNext = pitAfter->pitNext;
        pitAfter->pitNext->pitPrev = pitNew;
        pitAfter->pitNext = pitNew;
        pitNew->bAnchor = FALSE;
        return (char *)&(pitNew->Data);
    }
}

LPVOID APIENTRY List_NewBefore | ( | LIST | lst,
 |  | LPVOID | Curs,
 |  | UINT | uLen
 | ) |  |

Definition at line 655 of file list.cpp.

{
    LIST pitNew;
    LIST pitBefore;

    if (lst==NULL) {
        TRACE_ERROR("Bug: List_NewBefore in bogus list.  Continuing...", FALSE);
        return NULL;
    }
    if (Curs==NULL) {
        return List_NewLast(lst, uLen);
    } else {
        MOVEBACK(Curs);
        pitBefore = (LIST)Curs;
        pitNew = (LIST)list_Alloc(iHeaderSize+uLen);
        if (pitNew==NULL) {
            lst->bOK = FALSE;
            return NULL;
        }
        pitNew->pBlock = pCurrent;
        LeaveCriticalSection(&CritSec);
        pitNew->iLen = uLen;
        pitNew->pitNext = pitBefore;
        pitNew->pitPrev = pitBefore->pitPrev;
        pitBefore->pitPrev->pitNext = pitNew;
        pitBefore->pitPrev = pitNew;
        pitNew->bAnchor = FALSE;
        return (char *) &(pitNew->Data);
    }
}

LPVOID APIENTRY List_NewFirst | ( | LIST | lst,
 |  | UINT | uLen
 | ) |  |

Definition at line 376 of file list.cpp.

{
    LIST pit;

    if (lst==NULL) {
        TRACE_ERROR("Bug: List_NewFirst to bogus list.  Continuing...", FALSE);
        return NULL;
    }
    pit = (LIST)list_Alloc(iHeaderSize+uLen);
    if (pit==NULL) {
        lst->bOK = FALSE;
        return NULL;
    }
    pit->pBlock = pCurrent;
    LeaveCriticalSection(&CritSec);
    pit->iLen = uLen;
    pit->pitPrev = lst;
    pit->pitNext = lst->pitNext;
    lst->pitNext->pitPrev = pit; /* for empty list that set lst->pitPrev */
    lst->pitNext = pit;
    pit->bAnchor = FALSE;
    return (char *)&(pit->Data);
}

LPVOID APIENTRY List_NewLast | ( | LIST | lst,
 |  | UINT | uLen
 | ) |  |

Definition at line 467 of file list.cpp.

{
    LIST pit;

    if (lst==NULL) {
        TRACE_ERROR("Bug: List_NewLast in bogus list.  Continuing...", FALSE);
        return NULL;
    }
    pit = (LIST)list_Alloc(iHeaderSize+uLen);
    if (pit==NULL) {
        lst->bOK = FALSE;
        return NULL;
    }
    pit->pBlock = pCurrent;
    LeaveCriticalSection(&CritSec);
    pit->iLen = uLen;
    pit->pitNext = lst;
    pit->pitPrev = lst->pitPrev;
    lst->pitPrev->pitNext = pit; /* for empty list that set lst->pitNext */
    lst->pitPrev = pit;
    pit->bAnchor = FALSE;
    return (char *)&(pit->Data);
}

LPVOID APIENTRY List_Next ( LPVOID Curs )

Definition at line 840 of file list.cpp.

{
    LIST pit;

    if (Curs==NULL) {
        TRACE_ERROR("Bug: List_Next of NULL cursor.  Continuing...", FALSE);
        return NULL;
    }
    MOVEBACK(Curs)
    pit = (LIST)Curs;
    pit = pit->pitNext;
    if (pit->bAnchor) {
        return NULL;
    } else {
        return &(pit->Data);
    }
}

LPVOID APIENTRY List_Prev ( LPVOID Curs )

Definition at line 866 of file list.cpp.

{
    LIST pit;

    if (Curs==NULL) {
        TRACE_ERROR("Bug: List_Prev of NULL cursor.  Continuing...", FALSE);
        return NULL;
    }
    MOVEBACK(Curs)
    pit = (LIST)Curs;
    pit = pit->pitPrev;
    if (pit->bAnchor) {
        return NULL;
    } else {
        return &(pit->Data);
    }
}

void APIENTRY List_Recover ( PLIST plst )

Definition at line 1300 of file list.cpp.

{
    LIST Last, P,Q;
    BOOL OK;
    /* For no particular reason we presume that the forward chain
       is good and reconstruct the back chain from it.  A better
       algorithm would do the kind of things that List_Check does
       to figure out where the problems lie.  This just steps along
       until it sees either an address that it has already seen or
       else the anchor block.  (It's an n-squared algorithm).
       It links the last good block found back to the anchor and
       fixes all the Anchor flags.
    */
    if (plst==NULL)
        return;
    if (*plst==NULL) {
        *plst = List_Create();
        return;
    }
    (*plst)->bAnchor = TRUE;
    P = (*plst)->pitNext;
    Last = *plst;
    for (; ; ) {if (P==*plst) break;
        Last = P;
        if (P->pitNext!=*plst) {OK = TRUE;
            Q = *plst;
            for (; ; ) {
                OK &= (P->pitNext!=Q);
                if (Q==P) break;
                Q = Q->pitNext;
            }
            if (!OK) break;
        }
        P = P->pitNext;
    }
    P = *plst;
    while (P!=Last) {P->pitNext->pitPrev = P;
        P->bAnchor = FALSE;
        P = P->pitNext;
    }
    Last->pitNext = *plst;
    (*plst)->pitPrev = Last;
    (*plst)->bAnchor = TRUE;
    (*plst)->bOK = TRUE;
}

void APIENTRY List_Show ( LIST lst )

Definition at line 271 of file list.cpp.

{
    char X_msg[50] = {0};
  HRESULT hr = StringCchPrintf(X_msg, sizeof(X_msg)-1, "%p", lst);
  if (FAILED(hr))
    OutputError(hr, IDS_SAFE_PRINTF);
    OutputDebugString(X_msg);
}

void APIENTRY List_SplitAfter | ( | LIST | l1,
 |  | LIST | l2,
 |  | LPVOID | Curs
 | ) |  |

Definition at line 1110 of file list.cpp.

{
    LIST pit;

    if ((l1==NULL) || (l2==NULL)) {
        TRACE_ERROR("Bug: List_SplitAfter bogus list.  Continuing...", FALSE);
        return;
    }
    if (l2->pitNext!=l2) {
        List_Clear(l2);
    };
    if (Curs!=NULL) {
        MOVEBACK(Curs)
        pit = (LIST)Curs;
        /* Curs had better be an item in l1! l2 had better be created! */
        if (pit==l1) {
            l1->bOK = FALSE;
            l2->bOK = FALSE;
            return;
        }
        if (pit->pitNext==l1) {
            /* transfer whole of l2 to l1 */
            SwitchLists(l2,l1);
            return;
        }
        l2->pitPrev = pit;
        l2->pitNext = l1->pitNext;
        l1->pitNext = pit->pitNext;
        pit->pitNext = l2;
        l2->pitNext->pitPrev = l2;
        l1->pitNext->pitPrev = l1;
    }
}

void APIENTRY List_SplitBefore | ( | LIST | l1,
 |  | LIST | l2,
 |  | LPVOID | Curs
 | ) |  |

Definition at line 1159 of file list.cpp.

{
    LIST pit;

    if ((l1==NULL) || (l2==NULL)) {
        TRACE_ERROR("Bug: List_SplitBefore bogus list.  Continuing...", FALSE);
        return;
    }
    if (l2->pitNext!=l2) {
        List_Clear(l2);
    }
    if (Curs!=NULL) {
        MOVEBACK(Curs)
        pit = (LIST)Curs;
        /* Curs had better be an item in L1! L2 had better be created! */
        if (pit==l1) {
            l1->bOK = FALSE;
            l2->bOK = FALSE;
            return;
        }
        if (pit->pitPrev==l1) {
            SwitchLists(l2,l1);
            return;
        }
        l2->pitNext = pit;
        l2->pitPrev = l1->pitPrev;
        l1->pitPrev = pit->pitPrev;
        pit->pitPrev = l2;
        l2->pitPrev->pitNext = l2;
        l1->pitPrev->pitNext = l1;
    }
}

void APIENTRY List_Term ( void )

Definition at line 226 of file list.cpp.

{
    if (pCurrent!=NULL)
        TRACE_ERROR("List storage not cleared out properly", FALSE);
}

void APIENTRY SwitchLists | ( | LIST | l1,
 |  | LIST | l2
 | ) |  |

Definition at line 931 of file list.cpp.

{
    /* connect l1 to l2's elements, l1 had better be initially empty */
    l1->pitPrev = l2->pitPrev;
    l1->pitNext = l2->pitNext;
    /* connect the elements to l1 anchor block. */
    l1->pitPrev->pitNext = l1;
    l1->pitNext->pitPrev = l1;
    /* make l2 empty */
    l2->pitPrev = l2;
    l2->pitNext = l2;
}

Variable Documentation

CRITICAL_SECTION CritSec

Definition at line 33 of file list.cpp.

char msg[80]

Definition at line 21 of file list.cpp.

PBLOCK pCurrent = NULL

Definition at line 35 of file list.cpp.

Generated on Wed Nov 13 2024 16:53:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/sdkdiff/list.h File Reference

  • Begin
  • sdkdiff
Defines | Typedefs | Functions

list.h File Reference

Go to the source code of this file.

Defines

#define | List_REVERSETRAVERSE(lst, curs)
#define | List_TRAVERSE(lst, curs)

Typedefs

typedef struct item_tag FAR * | LIST
typedef LIST FAR * | PLIST

Functions

void APIENTRY | List_AddAfter (LIST lst, LPVOID Curs, LPVOID pObject, UINT uLen)
void APIENTRY | List_AddBefore (LIST lst, LPVOID Curs, LPVOID pObject, UINT uLen)
void APIENTRY | List_AddFirst (LIST lst, LPVOID pObject, UINT uLen)
void APIENTRY | List_AddLast (LIST lst, LPVOID pObject, UINT uLen)
int APIENTRY | List_Card (LIST lst)
BOOL APIENTRY | List_Check (LIST lst)
void APIENTRY | List_Clear (LIST lst)
LIST APIENTRY | List_Create (void)
void APIENTRY | List_Delete (LPVOID Curs)
void APIENTRY | List_DeleteFirst (LIST lst)
void APIENTRY | List_DeleteLast (LIST lst)
void APIENTRY | List_Destroy (PLIST plst)
void APIENTRY | List_Dump (LPSTR Header, LIST lst)
LPVOID APIENTRY | List_First (LIST lst)
void APIENTRY | List_Init (void)
void APIENTRY | List_InsertListAfter (LIST l1, LIST l2, LPVOID Curs)
void APIENTRY | List_InsertListBefore (LIST l1, LIST l2, LPVOID Curs)
BOOL APIENTRY | List_IsEmpty (LIST lst)
BOOL APIENTRY | List_IsOK (LIST lst)
int APIENTRY | List_ItemLength (LPVOID Curs)
void APIENTRY | List_Join (LIST l1, LIST l2)
LPVOID APIENTRY | List_Last (LIST lst)
void APIENTRY | List_MakeOK (LIST lst)
LPVOID APIENTRY | List_NewAfter (LIST lst, LPVOID Curs, UINT uLen)
LPVOID APIENTRY | List_NewBefore (LIST lst, LPVOID Curs, UINT uLen)
LPVOID APIENTRY | List_NewFirst (LIST lst, UINT uLen)
LPVOID APIENTRY | List_NewLast (LIST lst, UINT uLen)
LPVOID APIENTRY | List_Next (LPVOID Curs)
LPVOID APIENTRY | List_Prev (LPVOID Curs)
void APIENTRY | List_Recover (PLIST plst)
void APIENTRY | List_Show (LIST lst)
void APIENTRY | List_SplitAfter (LIST l1, LIST l2, LPVOID Curs)
void APIENTRY | List_SplitBefore (LIST l1, LIST l2, LPVOID Curs)
void APIENTRY | List_Term (void)

Define Documentation

#define List_REVERSETRAVERSE | ( | lst,
 |  | curs
 | ) |
Value:
for(  curs=List_Last(lst)             \
                                              ;  curs!=NULL                      \
                                              ;  curs = List_Prev((LPVOID)curs)  \
                                              )

Definition at line 243 of file list.h.

#define List_TRAVERSE | ( | lst,
 |  | curs
 | ) |
Value:
for(  curs=List_First(lst)            \
                                       ;  curs!=NULL                      \
                                       ;  curs = List_Next((LPVOID)curs)  \
                                       )

Definition at line 239 of file list.h.

Typedef Documentation

typedef struct item_tag FAR* LIST

Definition at line 110 of file list.h.

typedef LIST FAR* PLIST

Definition at line 111 of file list.h.

Function Documentation

void APIENTRY List_AddAfter | ( | LIST | lst,
 |  | LPVOID | Curs,
 |  | LPVOID | pObject,
 |  | UINT | uLen
 | ) |  |

Definition at line 526 of file list.cpp.

{
    LIST pitNew;
    LIST pitAfter;

    if (lst==NULL) {
        TRACE_ERROR("Bug: List_AddAfter in bogus list.  Continuing...", FALSE);
        return;
    }
    if (Curs==NULL) {
        List_AddFirst(lst, pObject, uLen);
    } else {
        MOVEBACK(Curs);
        pitAfter = (LIST)Curs;
        pitNew = (LIST)list_Alloc(iHeaderSize+uLen);
        if (pitNew==NULL) {
            lst->bOK = FALSE;
            return;
        }
        pitNew->pBlock = pCurrent;
        LeaveCriticalSection(&CritSec);
        pitNew->iLen = uLen;
        pitNew->pitPrev = pitAfter;
        pitNew->pitNext = pitAfter->pitNext;
        pitAfter->pitNext->pitPrev = pitNew;
        pitAfter->pitNext = pitNew;
        pitNew->bAnchor = FALSE;
        memcpy( &(pitNew->Data), pObject, uLen );
    }
}

void APIENTRY List_AddBefore | ( | LIST | lst,
 |  | LPVOID | Curs,
 |  | LPVOID | pObject,
 |  | UINT | uLen
 | ) |  |

Definition at line 611 of file list.cpp.

{
    LIST pitNew;
    LIST pitBefore;

    if (lst==NULL) {
        TRACE_ERROR("Bug: List_AddBefore in bogus list.  Continuing...", FALSE);
        return;
    }
    if (Curs==NULL) {
        List_AddLast(lst, pObject, uLen);
    } else {
        MOVEBACK(Curs);
        pitBefore = (LIST)Curs;
        pitNew = (LIST)list_Alloc(iHeaderSize+uLen);
        if (pitNew==NULL) {
            lst->bOK = FALSE;
            return;
        }
        pitNew->pBlock = pCurrent;
        LeaveCriticalSection(&CritSec);
        pitNew->iLen = uLen;
        pitNew->pitNext = pitBefore;
        pitNew->pitPrev = pitBefore->pitPrev;
        pitBefore->pitPrev->pitNext = pitNew;
        pitBefore->pitPrev = pitNew;
        pitNew->bAnchor = FALSE;
        memcpy( &(pitNew->Data), pObject, uLen );
    }
}

void APIENTRY List_AddFirst | ( | LIST | lst,
 |  | LPVOID | pObject,
 |  | UINT | uLen
 | ) |  |

Definition at line 342 of file list.cpp.

{
    LIST pit;      /* newly allocated item */

    if (lst==NULL) {
        TRACE_ERROR("Bug: List_AddFirst to bogus list.  Continuing...", FALSE);
        return;
    }
    pit = (LIST)list_Alloc(iHeaderSize+uLen);
    if (pit==NULL) {
        lst->bOK = FALSE;
        return;
    }
    pit->pBlock = pCurrent;
    LeaveCriticalSection(&CritSec);
    pit->iLen = uLen;
    pit->pitPrev = lst;
    pit->pitNext = lst->pitNext;
    lst->pitNext->pitPrev = pit; /* for empty list that set lst->pitPrev */
    lst->pitNext = pit;
    pit->bAnchor = FALSE;
    memcpy( &(pit->Data), pObject, uLen );
}

void APIENTRY List_AddLast | ( | LIST | lst,
 |  | LPVOID | pObject,
 |  | UINT | uLen
 | ) |  |

Definition at line 433 of file list.cpp.

{
    LIST pit;

    if (lst==NULL) {
        TRACE_ERROR("Bug: List_AddLast to bogus list. Continuing...", FALSE);
        return;
    }
    pit = (LIST)list_Alloc(iHeaderSize+uLen);
    if (pit==NULL) {
        lst->bOK = FALSE;
        return;
    }
    pit->pBlock = pCurrent;
    LeaveCriticalSection(&CritSec);
    pit->iLen = uLen;
    pit->pitNext = lst;
    pit->pitPrev = lst->pitPrev;
    lst->pitPrev->pitNext = pit; /* for empty list that set lst->pitNext */
    lst->pitPrev = pit;
    pit->bAnchor = FALSE;
    memcpy( &(pit->Data), pObject, uLen );
}

int APIENTRY List_Card ( LIST lst )

Definition at line 1201 of file list.cpp.

{
    LIST pit;     /* item cursor on lst */
    int cit;

    if (lst==NULL) {
        TRACE_ERROR("Bug: List_Card of bogus list.  Continuing...", FALSE);
        return 0;    /* well it is sort of 0 */
    }
    pit = lst->pitNext;
    cit = 0;
    while (pit!=lst) {
        cit++;
        pit = pit->pitNext;
    }
    return cit;
}

BOOL APIENTRY List_Check ( LIST lst )

Definition at line 1255 of file list.cpp.

{
    LIST pel;
    BOOL bOK;
    /*-----------------------------------------------------------------
    | Check the anchor block has the Anchor flag set.
    | Run through the LIST using the Anchor flag (which should be FALSE)
    | to mark where we have been (to test for loops in the chain)
    | and carry on until we see the Anchor flag again.  Check that this
    | is the anchor block that we started from.  Now do another pass
    | turning the Anchor flags off again and checking the Prev pointers.
     -------------------------------------------------------------------*/
    if (lst==NULL)
        return FALSE;
    bOK = lst->bAnchor;
    pel = lst->pitNext;
    while (! pel->bAnchor) {
        pel->bAnchor = TRUE;
        pel = pel->pitNext;
    }
    bOK = bOK && (pel==lst);
    if (bOK) {
        /* Turn all the bAnchor flags off */
        pel = lst;
        do {pel->bAnchor = FALSE;
            bOK = bOK & (pel->pitNext->pitPrev==pel);
            pel = pel->pitNext;
        } while (pel!=lst);
        lst->bAnchor = TRUE;  /* except the real one */
    } else { /* just turn off those that we set on */
        pel = lst->pitNext;
        while (pel->bAnchor) {
            pel->bAnchor = FALSE;
            pel = pel->pitNext;
        }
        lst->bAnchor = TRUE;
    }
    return bOK;
}

void APIENTRY List_Clear ( LIST lst )

Definition at line 891 of file list.cpp.

{
    LIST pitP;   /* item cursor on List, points to element starts */
    LIST pitQ;   /* runs one step ahead of pitP                   */

    if (lst==NULL) {
        TRACE_ERROR("Bug: List_Clear of bogus list.  Continuing...", FALSE);
        return;
    }
    pitP = lst->pitNext;   /* first element of list proper */
    while (pitP!=lst) {      /* while not wrapped onto anchor */pitQ = pitP->pitNext;
        list_Free(pitP->pBlock, pitP);
        pitP = pitQ;
    }
    lst->bOK = TRUE;
    lst->pitNext = lst;
    lst->pitPrev = lst;
}

LIST APIENTRY List_Create ( void )

Definition at line 287 of file list.cpp.

{
    LIST lst;
    if (!bInited) {
        List_Init();            /* prevent some strange errors */
    }
    lst = (LIST)list_Alloc(iAnchorSize);

    if (lst==NULL) {
        return NULL;
    }
    lst->pBlock = pCurrent;
    LeaveCriticalSection(&CritSec);
    lst->bOK = TRUE;
    lst->pitNext = lst;
    lst->pitPrev = lst;
    lst->bAnchor = TRUE;
    /* no length field set in an anchor block */
    return lst;
}

void APIENTRY List_Delete ( LPVOID Curs )

Definition at line 701 of file list.cpp.

{
    LIST pit;
    if (Curs==NULL) {
        TRACE_ERROR("Bug: List_Delete NULL item", FALSE);
        return;
    }
    MOVEBACK(Curs)
    pit = (LIST)Curs;
    pit->pitNext->pitPrev = pit->pitPrev;
    pit->pitPrev->pitNext = pit->pitNext;
    list_Free(pit->pBlock, pit);
}

void APIENTRY List_DeleteFirst ( LIST lst )

Definition at line 408 of file list.cpp.

{
    LIST pit;

    if (lst==NULL) {TRACE_ERROR("Bug: List_DeleteFirst from bogus list.  Continuing...", FALSE);
        return;
    }
    /* attempting to delete the anchor block! */
    if (lst->pitNext==lst) {
        lst->bOK = FALSE;
    } else {
        pit = lst->pitNext;
        pit->pitNext->pitPrev = pit->pitPrev;
        pit->pitPrev->pitNext = pit->pitNext;
        list_Free(pit->pBlock, pit);
    }
}

void APIENTRY List_DeleteLast ( LIST lst )

Definition at line 499 of file list.cpp.

{
    LIST pit;

    if (lst==NULL) {
        TRACE_ERROR("Bug: List_DeleteLast from bogus list.  Continuing...", FALSE);
        return;
    }
    /* attempting to delete the anchor block! */
    if (lst->pitNext==lst) {
        lst->bOK = FALSE;
    } else {
        pit = lst->pitPrev;
        pit->pitNext->pitPrev = pit->pitPrev;
        pit->pitPrev->pitNext = pit->pitNext;
        list_Free(pit->pBlock, pit);
    }
}

void APIENTRY List_Destroy ( PLIST plst )

Definition at line 315 of file list.cpp.

{
    LIST pitP;    /* item cursor on * plst */
    LIST pitQ;    /* item cursor runs one step ahead of pitQ */

    if (plst==NULL) {
        TRACE_ERROR("Bug:Attempt to destroy NULL list.  Continuing...", FALSE);
        return;
    }

    /* There is at least an anchor block to destroy */
    pitP = *plst;
    do {
        pitQ = pitP->pitNext;
        list_Free(pitP->pBlock, pitP);
        pitP = pitQ;
    }while (pitP != *plst);
    *plst = NULL;
}

void APIENTRY List_Dump | ( | LPSTR | Header,
 |  | LIST | lst
 | ) |  |

Definition at line 239 of file list.cpp.

{
    LIST pit;
  HRESULT hr;
    char X_msg[250] = {0};

    OutputDebugString(Header);  OutputDebugString("\n");
    pit = lst;
    do {
        hr = StringCchPrintf(X_msg, sizeof(X_msg)-1, "%8p %8p %8p %ld %s "
                 , pit, pit->pitNext, pit->pitPrev, pit->iLen
                 , (pit->bAnchor ? "Anchor" : "Data")
                );
    if (FAILED(hr))
      OutputError(hr, IDS_SAFE_PRINTF);
        OutputDebugString(X_msg);
        if (pit->pitNext->pitPrev != pit)
            OutputDebugString(" Next Prev error!!");
        if (pit->pitPrev->pitNext != pit)
            OutputDebugString(" Prev Next error!!");
        OutputDebugString("\n");
        pit = pit->pitNext;
    } while (pit!=lst);
    OutputDebugString("End of list dump\n");
}

LPVOID APIENTRY List_First ( LIST lst )

Definition at line 800 of file list.cpp.

{
    if (lst==NULL) {
        TRACE_ERROR("Bug: List_First of bogus list.  Continuing...", FALSE);
        return NULL;
    }
    if (lst->pitNext==lst) {
        return NULL;
    }
    return &(lst->pitNext->Data);
}

void APIENTRY List_Init ( void )

Definition at line 210 of file list.cpp.

{
    LIST P;
    P = (LIST)&P;                  /* really any old address will do */
    iAnchorSize = (char *)&(P->iLen) - (char *)&(P->pitNext);
    iHeaderSize = (char *)&(P->Data) - (char *)&(P->pitNext);
    InitializeCriticalSection(&CritSec);
    bInited = TRUE;
    /* assumes layout in storage is linear */
}

void APIENTRY List_InsertListAfter | ( | LIST | l1,
 |  | LIST | l2,
 |  | LPVOID | Curs
 | ) |  |

Definition at line 996 of file list.cpp.

{
    LIST pitA;     /* The element after Curs, could be anchor */
    LIST pit;      /* The start of the element that Curs points at
                   |  or the anchor block if Curs==NULL
                   */

    if ( (l1==NULL) || (l2==NULL)) {
        TRACE_ERROR("Bug: List_InsertListAfter with bogus list.  Continuing...", FALSE);
        return;
    }
    l1->bOK = l1->bOK && l2->bOK;
    l2->bOK = TRUE;
    if (l2->pitNext==l2) {
        /* no elements need moving */
    } else if ( l1->pitNext==l1) {
        /* the easy way to code this would be simply to switch the two
        |  pointers l1 and l2, but they are value parameters and we don't
        |  want to change that.
        */
        SwitchLists(l1,l2);
        return;
    } else {
        if (Curs==NULL) {
            pit = l1;
        } else {
            MOVEBACK(Curs)
            pit = (LIST)Curs;
        }
        /* pit points to a block to insert after, could be anchor */
        pitA = pit->pitNext;           /* Cannot be same as P, already checked */
        l2->pitNext->pitPrev = pit;    /*  P<-- elems-of-l2    A */
        l2->pitPrev->pitNext = pitA;   /*  P<-- elems-of-l2 -->A */
        pit->pitNext = l2->pitNext;    /*  P<-->elems-of-l2 -->A */
        pitA->pitPrev = l2->pitPrev;   /*  P<-->elems-of-l2<-->A */

        l2->pitNext = l2;
        l2->pitPrev = l2;
    }
}

void APIENTRY List_InsertListBefore | ( | LIST | l1,
 |  | LIST | l2,
 |  | LPVOID | Curs
 | ) |  |

Definition at line 1054 of file list.cpp.

{
    LIST pitB;     /* The element before Curs, could be anchor */
    LIST pit;      /* The start of the element that Curs points at
                    |  or the anchor block if Curs==NULL
                    */

    if ((l1==NULL) || (l2==NULL)) {
        TRACE_ERROR("Bug: List_InsertListBefore with bogus list.  Continuing...", FALSE);
        return;
    }
    l1->bOK = l1->bOK && l2->bOK;
    l2 ->bOK = TRUE;
    if (l1->pitNext==l1) {
        /* the easy way to code this would be simply to switch the two
        |  pointers l1 and l2, but they are value parameters and we don't
        |  want to change that.
        */
        SwitchLists(l1,l2);
        return;
    } else {
        if (Curs==NULL) {
            pit = l1;
        } else {
            MOVEBACK(Curs)
            pit = (LIST)Curs;
        }

        /* P points to a block to insert before, could be anchor */
        pitB = pit->pitPrev;       /* Cannot be same as P, already checked */
        l2->pitNext->pitPrev = pitB; /*  B<-- elems-of-L2    P */
        l2->pitPrev->pitNext = pit;  /*  B<-- elems-of-L2 -->P */
        pitB->pitNext = l2->pitNext; /*  B<-->elems-of-L2 -->P */
        pit->pitPrev = l2->pitPrev;  /*  B<-->elems-of-L2<-->P */
        l2->pitNext = l2;
        l2->pitPrev = l2;
    }
}

BOOL APIENTRY List_IsEmpty ( LIST lst )

Definition at line 917 of file list.cpp.

{  if (lst==NULL) {TRACE_ERROR("Bug: List_IsEmpty of bogus list.  Continuing...", FALSE);
        return TRUE;   /* well it's sort of true isn't it? */
    }
    return lst->pitNext ==lst;
} /* List_IsEmpty */

BOOL APIENTRY List_IsOK ( LIST lst )

Definition at line 1226 of file list.cpp.

{
    if (lst==NULL) {
        TRACE_ERROR("Bug: List_IsOK of bogus list.  Continuing...", FALSE);
        return FALSE;       /* well it is sick ain't it! */
    }
    return lst->bOK;
}

int APIENTRY List_ItemLength ( LPVOID Curs )

Definition at line 780 of file list.cpp.

{
    LIST pit;
    if (Curs==NULL) {
        TRACE_ERROR("Bug: List_ItemLength NULL cursor.  Continuing...", FALSE);
        return 0;
    }
    MOVEBACK(Curs)
    pit = (LIST)Curs;
    return pit->iLen;
}

void APIENTRY List_Join | ( | LIST | l1,
 |  | LIST | l2
 | ) |  |

Definition at line 957 of file list.cpp.

{
    if ((l1==NULL)||(l2==NULL)) {
        TRACE_ERROR("Bug: List_Join of bogus list.  Continuing...", FALSE);
        return;
    }
    l1->bOK = l1->bOK &&l2->bOK;  /* result OK if both inputs OK */
    l2->bOK = TRUE;               /* as l2 always becomes empty */
    if (l2->pitNext==l2) {
        /* no elements need moving */
    } else if (l2->pitNext==l2) {
        SwitchLists(l1,l2);
        return;
    } else {
        l2->pitNext->pitPrev = l1->pitPrev;
        l1->pitPrev->pitNext = l2->pitNext;
        l1->pitPrev = l2->pitPrev;
        l1->pitPrev->pitNext = l1;
        l2->pitNext = l2;
        l2->pitPrev = l2;
    }
}

LPVOID APIENTRY List_Last ( LIST lst )

Definition at line 820 of file list.cpp.

{
    if (lst==NULL) {
        TRACE_ERROR("Bug: List_Last of bogus list.  Continuing...", FALSE);
        return NULL;
    }
    if (lst->pitNext==lst) {
        return NULL;
    }
    return &(lst->pitPrev->Data);
}

void APIENTRY List_MakeOK ( LIST lst )

Definition at line 1242 of file list.cpp.

{
    if (lst==NULL) {
        TRACE_ERROR("Bug: List_MakeOK of bogus list.  Continuing...", FALSE);
        return;
    }
    lst->bOK = TRUE;
}

LPVOID APIENTRY List_NewAfter | ( | LIST | lst,
 |  | LPVOID | Curs,
 |  | UINT | uLen
 | ) |  |

Definition at line 570 of file list.cpp.

{
    LIST pitNew;
    LIST pitAfter;

    if (lst==NULL) {
        TRACE_ERROR("Bug: List_NewAfter in bogus list. Continuing...", FALSE);
        return NULL;
    }
    if (Curs==NULL) {
        return List_NewFirst(lst, uLen);
    } else {
        MOVEBACK(Curs);
        pitAfter = (LIST)Curs;
        pitNew = (LIST)list_Alloc(iHeaderSize+uLen);
        if (pitNew==NULL) {
            lst->bOK = FALSE;
            return NULL;
        }
        pitNew->pBlock = pCurrent;
        LeaveCriticalSection(&CritSec);
        pitNew->iLen = uLen;
        pitNew->pitPrev = pitAfter;
        pitNew->pitNext = pitAfter->pitNext;
        pitAfter->pitNext->pitPrev = pitNew;
        pitAfter->pitNext = pitNew;
        pitNew->bAnchor = FALSE;
        return (char *)&(pitNew->Data);
    }
}

LPVOID APIENTRY List_NewBefore | ( | LIST | lst,
 |  | LPVOID | Curs,
 |  | UINT | uLen
 | ) |  |

Definition at line 655 of file list.cpp.

{
    LIST pitNew;
    LIST pitBefore;

    if (lst==NULL) {
        TRACE_ERROR("Bug: List_NewBefore in bogus list.  Continuing...", FALSE);
        return NULL;
    }
    if (Curs==NULL) {
        return List_NewLast(lst, uLen);
    } else {
        MOVEBACK(Curs);
        pitBefore = (LIST)Curs;
        pitNew = (LIST)list_Alloc(iHeaderSize+uLen);
        if (pitNew==NULL) {
            lst->bOK = FALSE;
            return NULL;
        }
        pitNew->pBlock = pCurrent;
        LeaveCriticalSection(&CritSec);
        pitNew->iLen = uLen;
        pitNew->pitNext = pitBefore;
        pitNew->pitPrev = pitBefore->pitPrev;
        pitBefore->pitPrev->pitNext = pitNew;
        pitBefore->pitPrev = pitNew;
        pitNew->bAnchor = FALSE;
        return (char *) &(pitNew->Data);
    }
}

LPVOID APIENTRY List_NewFirst | ( | LIST | lst,
 |  | UINT | uLen
 | ) |  |

Definition at line 376 of file list.cpp.

{
    LIST pit;

    if (lst==NULL) {
        TRACE_ERROR("Bug: List_NewFirst to bogus list.  Continuing...", FALSE);
        return NULL;
    }
    pit = (LIST)list_Alloc(iHeaderSize+uLen);
    if (pit==NULL) {
        lst->bOK = FALSE;
        return NULL;
    }
    pit->pBlock = pCurrent;
    LeaveCriticalSection(&CritSec);
    pit->iLen = uLen;
    pit->pitPrev = lst;
    pit->pitNext = lst->pitNext;
    lst->pitNext->pitPrev = pit; /* for empty list that set lst->pitPrev */
    lst->pitNext = pit;
    pit->bAnchor = FALSE;
    return (char *)&(pit->Data);
}

LPVOID APIENTRY List_NewLast | ( | LIST | lst,
 |  | UINT | uLen
 | ) |  |

Definition at line 467 of file list.cpp.

{
    LIST pit;

    if (lst==NULL) {
        TRACE_ERROR("Bug: List_NewLast in bogus list.  Continuing...", FALSE);
        return NULL;
    }
    pit = (LIST)list_Alloc(iHeaderSize+uLen);
    if (pit==NULL) {
        lst->bOK = FALSE;
        return NULL;
    }
    pit->pBlock = pCurrent;
    LeaveCriticalSection(&CritSec);
    pit->iLen = uLen;
    pit->pitNext = lst;
    pit->pitPrev = lst->pitPrev;
    lst->pitPrev->pitNext = pit; /* for empty list that set lst->pitNext */
    lst->pitPrev = pit;
    pit->bAnchor = FALSE;
    return (char *)&(pit->Data);
}

LPVOID APIENTRY List_Next ( LPVOID Curs )

Definition at line 840 of file list.cpp.

{
    LIST pit;

    if (Curs==NULL) {
        TRACE_ERROR("Bug: List_Next of NULL cursor.  Continuing...", FALSE);
        return NULL;
    }
    MOVEBACK(Curs)
    pit = (LIST)Curs;
    pit = pit->pitNext;
    if (pit->bAnchor) {
        return NULL;
    } else {
        return &(pit->Data);
    }
}

LPVOID APIENTRY List_Prev ( LPVOID Curs )

Definition at line 866 of file list.cpp.

{
    LIST pit;

    if (Curs==NULL) {
        TRACE_ERROR("Bug: List_Prev of NULL cursor.  Continuing...", FALSE);
        return NULL;
    }
    MOVEBACK(Curs)
    pit = (LIST)Curs;
    pit = pit->pitPrev;
    if (pit->bAnchor) {
        return NULL;
    } else {
        return &(pit->Data);
    }
}

void APIENTRY List_Recover ( PLIST plst )

Definition at line 1300 of file list.cpp.

{
    LIST Last, P,Q;
    BOOL OK;
    /* For no particular reason we presume that the forward chain
       is good and reconstruct the back chain from it.  A better
       algorithm would do the kind of things that List_Check does
       to figure out where the problems lie.  This just steps along
       until it sees either an address that it has already seen or
       else the anchor block.  (It's an n-squared algorithm).
       It links the last good block found back to the anchor and
       fixes all the Anchor flags.
    */
    if (plst==NULL)
        return;
    if (*plst==NULL) {
        *plst = List_Create();
        return;
    }
    (*plst)->bAnchor = TRUE;
    P = (*plst)->pitNext;
    Last = *plst;
    for (; ; ) {if (P==*plst) break;
        Last = P;
        if (P->pitNext!=*plst) {OK = TRUE;
            Q = *plst;
            for (; ; ) {
                OK &= (P->pitNext!=Q);
                if (Q==P) break;
                Q = Q->pitNext;
            }
            if (!OK) break;
        }
        P = P->pitNext;
    }
    P = *plst;
    while (P!=Last) {P->pitNext->pitPrev = P;
        P->bAnchor = FALSE;
        P = P->pitNext;
    }
    Last->pitNext = *plst;
    (*plst)->pitPrev = Last;
    (*plst)->bAnchor = TRUE;
    (*plst)->bOK = TRUE;
}

void APIENTRY List_Show ( LIST lst )

Definition at line 271 of file list.cpp.

{
    char X_msg[50] = {0};
  HRESULT hr = StringCchPrintf(X_msg, sizeof(X_msg)-1, "%p", lst);
  if (FAILED(hr))
    OutputError(hr, IDS_SAFE_PRINTF);
    OutputDebugString(X_msg);
}

void APIENTRY List_SplitAfter | ( | LIST | l1,
 |  | LIST | l2,
 |  | LPVOID | Curs
 | ) |  |

Definition at line 1110 of file list.cpp.

{
    LIST pit;

    if ((l1==NULL) || (l2==NULL)) {
        TRACE_ERROR("Bug: List_SplitAfter bogus list.  Continuing...", FALSE);
        return;
    }
    if (l2->pitNext!=l2) {
        List_Clear(l2);
    };
    if (Curs!=NULL) {
        MOVEBACK(Curs)
        pit = (LIST)Curs;
        /* Curs had better be an item in l1! l2 had better be created! */
        if (pit==l1) {
            l1->bOK = FALSE;
            l2->bOK = FALSE;
            return;
        }
        if (pit->pitNext==l1) {
            /* transfer whole of l2 to l1 */
            SwitchLists(l2,l1);
            return;
        }
        l2->pitPrev = pit;
        l2->pitNext = l1->pitNext;
        l1->pitNext = pit->pitNext;
        pit->pitNext = l2;
        l2->pitNext->pitPrev = l2;
        l1->pitNext->pitPrev = l1;
    }
}

void APIENTRY List_SplitBefore | ( | LIST | l1,
 |  | LIST | l2,
 |  | LPVOID | Curs
 | ) |  |

Definition at line 1159 of file list.cpp.

{
    LIST pit;

    if ((l1==NULL) || (l2==NULL)) {
        TRACE_ERROR("Bug: List_SplitBefore bogus list.  Continuing...", FALSE);
        return;
    }
    if (l2->pitNext!=l2) {
        List_Clear(l2);
    }
    if (Curs!=NULL) {
        MOVEBACK(Curs)
        pit = (LIST)Curs;
        /* Curs had better be an item in L1! L2 had better be created! */
        if (pit==l1) {
            l1->bOK = FALSE;
            l2->bOK = FALSE;
            return;
        }
        if (pit->pitPrev==l1) {
            SwitchLists(l2,l1);
            return;
        }
        l2->pitNext = pit;
        l2->pitPrev = l1->pitPrev;
        l1->pitPrev = pit->pitPrev;
        pit->pitPrev = l2;
        l2->pitPrev->pitNext = l2;
        l1->pitPrev->pitNext = l1;
    }
}

void APIENTRY List_Term ( void )

Definition at line 226 of file list.cpp.

{
    if (pCurrent!=NULL)
        TRACE_ERROR("List storage not cleared out properly", FALSE);
}

Generated on Wed Nov 13 2024 16:53:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/sdkdiff/precomp.h File Reference

  • Begin
  • sdkdiff

precomp.h File Reference

#include <windows.h>
#include <commdlg.h>
#include <string.h>
#include <strsafe.h>
#include <stdio.h>
#include <memory.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <dos.h>
#include <direct.h>
#include "gutils.h"
#include "errorout.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/sdkdiff/profile.cpp File Reference

  • Begin
  • sdkdiff

profile.cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/sdkdiff/profile.h File Reference

  • Begin
  • sdkdiff
Defines

profile.h File Reference

Go to the source code of this file.

Defines

#define | CloseKeys()
#define | mmGetProfileIntA(app, value, default) GetProfileInt(app, value, default)
#define | mmGetProfileString(appname, valuename, pDefault, pResult, cbResult) GetProfileString(appname, valuename, pDefault, pResult, cbResult)
#define | MMPROFILECACHE 0
#define | mmWriteProfileString(appname, valuename, pData) WriteProfileString(appname, valuename, pData)
#define | USESTRINGSALSO 1

Define Documentation

#define CloseKeys ( )

Definition at line 34 of file profile.h.

#define mmGetProfileIntA | ( | app,
 |  | value,
 |  | default |
 | ) |  | GetProfileInt(app, value, default)

Definition at line 25 of file profile.h.

#define mmGetProfileString | ( | appname,
 |  | valuename,
 |  | pDefault,
 |  | pResult,
 |  | cbResult |
 | ) |  | GetProfileString(appname, valuename, pDefault, pResult, cbResult)

Definition at line 31 of file profile.h.

#define MMPROFILECACHE 0

Definition at line 20 of file profile.h.

#define mmWriteProfileString | ( | appname,
 |  | valuename,
 |  | pData |
 | ) |  | WriteProfileString(appname, valuename, pData)

Definition at line 28 of file profile.h.

#define USESTRINGSALSO 1

Definition at line 21 of file profile.h.

Generated on Wed Nov 13 2024 16:53:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/sdkdiff/scandir.cpp File Reference

  • Begin
  • sdkdiff
Classes | Defines | Typedefs | Functions | Variables

scandir.cpp File Reference

#include "precomp.h"
#include "list.h"
#include "scandir.h"
#include "sdkdiff.h"
#include "wdiffrc.h"

Go to the source code of this file.

Classes

struct | direct
struct | diritem
struct | dirlist

Defines

#define | DL_DIRS 2
#define | DL_FILES 1

Typedefs

typedef struct direct * | DIRECT

Functions

void | dir_adddirect (DIRECT dir, LPSTR path)
BOOL | dir_addfile (DIRECT dir, LPSTR path, DWORD size, FILETIME ft, DWORD attr, int *psequence)
BOOL | dir_appendlist (DIRLIST *pdl, LPCSTR path, BOOL bSum, int *psequence)
DIRLIST | dir_buildlist (LPSTR path, BOOL bSum, BOOL bOnDemand)
void | dir_cleardirect (DIRECT dir)
void | dir_closefile (DIRITEM item, HANDLE fh)
BOOL | dir_compsequencenumber (DIRITEM dleft, DIRITEM dright, int *pcmpvalue)
int | dir_compwildcard (DIRLIST dleft, DIRLIST dright, LPSTR lname, LPSTR rname)
BOOL | dir_copy (DIRITEM item, LPSTR newroot, BOOL HitReadOnly, BOOL CopyNoAttributes)
void | dir_delete (DIRLIST dl)
void | dir_dirinit (DIRECT dir, DIRLIST head, DIRECT parent, LPSTR name)
int | dir_endcopy (DIRLIST dl)
void | dir_extractwildportions (LPSTR pDest, LPSTR pSource, LPSTR pPattern, LPSTR pTag)
BOOL | dir_fileerror (DIRITEM item)
BOOL | dir_fileinit (DIRITEM pfile, DIRECT dir, LPSTR path, long size, FILETIME ft, DWORD attr, int *psequence)
LPSTR | dir_finalelem (LPSTR path)
DIRITEM | dir_findnextfile (DIRLIST dl, DIRECT curdir)
DIRITEM | dir_firstitem (DIRLIST dl)
void | dir_freeopenname (DIRITEM item, LPSTR openname)
void | dir_freerelname (DIRITEM cur, LPSTR name)
VOID | dir_freerootdescription (DIRLIST dl, LPSTR string)
void | dir_freerootpath (DIRLIST dl, LPSTR path)
DWORD | dir_getattr (DIRITEM cur)
DWORD | dir_getchecksum (DIRITEM cur)
long | dir_getfilesize (DIRITEM cur)
FILETIME | dir_GetFileTime (DIRITEM cur)
DIRLIST | dir_getlist (DIRITEM item)
LPSTR | dir_getopenname (DIRITEM item)
long | dir_getpathsizeetc (LPSTR path, FILETIME FAR *ft, DWORD FAR *attr)
long | dir_getpathsizeetc (LPSTR path, FILETIME *pft, DWORD *pattr)
LPSTR | dir_getrelname (DIRITEM cur)
LPSTR | dir_getrootdescription (DIRLIST dl)
LPSTR | dir_getrootpath (DIRLIST dl)
BOOL | dir_isfile (DIRLIST dl)
BOOL | dir_isvaliddir (LPCSTR path)
BOOL | dir_isvalidfile (LPSTR path)
BOOL | dir_iswildcard (DIRLIST dl)
BOOL | dir_MakeValidPath (LPSTR newpath, DIRITEM item, LPSTR newroot)
DIRITEM | dir_nextitem (DIRLIST dl, DIRITEM cur, BOOL fDeep)
HANDLE | dir_openfile (DIRITEM item)
void | dir_rescanfile (DIRITEM di)
void | dir_scan (DIRECT dir, BOOL bRecurse)
void | dir_setdescription (DIRLIST dl, LPCSTR psz)
void | dir_setotherdirlist (DIRLIST dl, DIRLIST otherdl)
BOOL | dir_startcopy (DIRLIST dl)
BOOL | dir_validchecksum (DIRITEM item)
BOOL | iswildpath (LPCSTR pszPath)

Variables

BOOL bAbort

Define Documentation

#define DL_DIRS 2

Definition at line 109 of file scandir.cpp.

#define DL_FILES 1

Definition at line 108 of file scandir.cpp.

Typedef Documentation

typedef struct direct * DIRECT

Function Documentation

void dir_adddirect | ( | DIRECT | dir,
 |  | LPSTR | path
 | ) |  |

Definition at line 1807 of file scandir.cpp.

{
    DIRECT child;
    LPSTR finalel;
    char achTempName[MAX_PATH];

    AnsiLowerBuff(path, lstrlen(path));
    for( child=(DIRECT)List_First(dir->directs);  child!=NULL;  child = (DIRECT)List_Next((LPVOID)child)) {
        int cmpval;

        /* we need to compare the child name with the new name.
         * the child name is a relname with a trailing
         * slash - so compare only the name up to but
         * not including the final slash.
         */
        finalel = dir_finalelem(child->relname);

        /*
         * we cannot use strnicmp since this uses a different
         * collating sequence to lstrcmpi. So copy the portion
         * we are interested in to a null-term. buffer.
         */
        My_mbsncpy(achTempName, finalel, lstrlen(finalel)-1);
        achTempName[lstrlen(finalel)-1] = '\0';

        cmpval = utils_CompPath(achTempName, path);

#ifdef trace
        {
      HRESULT hr;
      char msg[600];
            hr = StringCchPrintf( msg, 600, "dir_adddirect: %s %s %s\n"
                      , achTempName
                      , ( cmpval<0 ? "<"
                          : (cmpval==0 ? "=" : ">")
                        )
                      , path
                    );
      if (FAILED(hr))
        OutputError(hr, IDS_SAFE_PRINTF);
            if (bTrace) Trace_File(msg);
        }
#endif
        if (cmpval > 0) {

            /* goes before this one */
            child = (DIRECT)List_NewBefore(dir->directs, child, sizeof(struct direct));
            dir_dirinit(child, dir->head, dir, path);
            return;
        }
    }
    /* goes at end */
    child = (DIRECT)List_NewLast(dir->directs, sizeof(struct direct));
    dir_dirinit(child, dir->head, dir, path);
} /* dir_adddirect */

BOOL dir_addfile | ( | DIRECT | dir,
 |  | LPSTR | path,
 |  | DWORD | size,
 |  | FILETIME | ft,
 |  | DWORD | attr,
 |  | int * | psequence
 | ) |  |

Definition at line 1760 of file scandir.cpp.

{
    DIRITEM pfile;

    AnsiLowerBuff(path, lstrlen(path));

    // when psequence is passed, do not sort the list
    if (!psequence)
    {
    for( pfile=(DIRITEM)List_Last(dir->diritems);  pfile!=NULL;  pfile = (DIRITEM)List_Prev((LPVOID)pfile)) {
            if (utils_CompPath(pfile->name, path) <= 0) {
                break;     /* goes after this one */
            }
        }
        /* goes after pfile, NULL => goes at start */
        pfile = (DIRITEM)List_NewAfter(dir->diritems, pfile, sizeof(struct diritem));
    }
    else
    {
        /* append to end -- psequence implies that we are being called in
         * sequence order and do not need to do any further sorting.
         */
        pfile = (DIRITEM)List_NewBefore(dir->diritems, NULL, sizeof(struct diritem));
    }

  if (!dir_fileinit(pfile, dir, path, size, ft, attr, psequence))
    {
        List_Delete(pfile);
        return FALSE;
    }

    return TRUE;
} /* dir_addfile */

BOOL dir_appendlist | ( | DIRLIST * | pdl,
 |  | LPCSTR | path,
 |  | BOOL | bSum,
 |  | int * | psequence
 | ) |  |

Definition at line 332 of file scandir.cpp.

{
    DIRLIST dl;
    BOOL bFile=FALSE;
    char tmppath[MAX_PATH];
    LPSTR pstr;
    LPSTR pTag = NULL;
    BOOL fSuccess = FALSE;
  HRESULT hr;

    if (path)
    {
        // copy the path so we can modify it
        hr = StringCchCopy(tmppath, MAX_PATH, path);
    if (FAILED(hr))
      OutputError(hr, IDS_SAFE_COPY);

    // remove the trailing slash if unnecessary (\, c:\ need it)
        pstr = &tmppath[lstrlen(tmppath) -1];
        if ((*pstr == '\\') && (pstr > tmppath) && (pstr[-1] != ':')
            && !IsDBCSLeadByte((BYTE)*(pstr-1)))
        {
            *pstr = '\0';
        }

        /* check if the path is valid */
        if ((pTag && !iswildpath(tmppath))|| (tmppath[0] == '/' && tmppath[1] == '/'))
        {
            // assume valid
            bFile = TRUE;
        }
        else if (dir_isvaliddir(tmppath))
        {
            bFile = FALSE;
        }
        else if (dir_isvalidfile(tmppath))
        {
            bFile = TRUE;
        }
        else
        {
            /* not valid */
            goto LError;
        }
    }

    if (!*pdl)
    {
        DIRECT temp;

        /* alloc and init the DIRLIST head */
        *pdl = (DIRLIST) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct dirlist));
        if (*pdl == NULL)
      goto LError;
    (*pdl)->pOtherDirList = NULL;

        (*pdl)->bSum = bSum;
        (*pdl)->bSum = FALSE;   // to speed things up. even if we do want
                                // checksums, let's get them on demand, not
                                // right now.
        (*pdl)->bFile = FALSE;

        /* make a null directory for the tree root directory -
         * all files and subdirs will be listed from here
         */
        /* Do NOT chain on anything with garbage pointers in it */
        temp = (DIRECT) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct direct));
        if (temp == NULL)
      goto LError;
    (*pdl)->dot = temp;

        dir_dirinit((*pdl)->dot, (*pdl), NULL, "");
        (*pdl)->dot->relname[0] = 0;
        (*pdl)->dot->bScanned = TRUE;
    }
    dl = *pdl;

    if (path)
    {
        /* were we given a file or a directory ? */
        if (bFile)
        {
            /* its a file. create a single file entry
             * and set the state accordingly
             */
            long fsize;
            FILETIME ft;
            DWORD attr;

            fsize = dir_getpathsizeetc(tmppath, &ft, &attr);

      if (!dir_addfile(dl->dot, tmppath, fsize, ft, attr, psequence))
                goto LError;
        }
    }

    fSuccess = TRUE;

LError:
    if (pTag)
        HeapFree(GetProcessHeap(), NULL, pTag);
    return fSuccess;
} /* dir_appendlist */

DIRLIST dir_buildlist | ( | LPSTR | path,
 |  | BOOL | bSum,
 |  | BOOL | bOnDemand
 | ) |  |

Definition at line 172 of file scandir.cpp.

{
    DIRLIST dlOut = 0;
    DIRLIST dl = 0;
    BOOL bFile;
    char tmppath[MAX_PATH] = {0};
    LPSTR pstr;
    LPSTR pPat = NULL;
    LPSTR pTag = NULL;
  HRESULT hr;

    /*
     * copy the path so we can modify it
     */
    strncat(tmppath, path, sizeof(tmppath)-1);

    /* look for wildcards and separate out pattern if there */
    if (My_mbschr(tmppath, '*') || My_mbschr(tmppath, '?'))
    {
        pstr = dir_finalelem(tmppath);
        pPat = (char*) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, lstrlen(pstr) +1);
        if (pPat == NULL)
      goto LError;
    hr = StringCchCopy(pPat, (lstrlen(pstr)+1), pstr);
    if (FAILED(hr)) {
      OutputError(hr, IDS_SAFE_COPY);
      goto LError;
    }
        *pstr = '\0';
    }

    /* we may have reduced the path to nothing - replace with . if so */
    if (lstrlen(tmppath) == 0)
    {
        hr = StringCchCopy(tmppath, MAX_PATH, ".");
    if (FAILED(hr)) {
      OutputError(hr, IDS_SAFE_COPY);
      goto LError;
    }
    }
    else
    {
        /*
         * remove the trailing slash if unnecessary (\, c:\ need it)
         */
        pstr = &tmppath[lstrlen(tmppath) -1];
        if ((*pstr == '\\') && (pstr > tmppath) && (pstr[-1] != ':')
            && !IsDBCSLeadByte((BYTE)*(pstr-1)))
        {
            *pstr = '\0';
        }
    }

    /* check if the path is valid */
    if ((pTag && !iswildpath(tmppath)) || (tmppath[0] == '/' && tmppath[1] == '/'))
    {
        bFile = TRUE;
    }
    else if (dir_isvaliddir(tmppath))
    {
        bFile = FALSE;
    }
    else if (dir_isvalidfile(tmppath))
    {
        bFile = TRUE;
    }
    else
    {
        /* not valid */
        goto LError;
    }

    /* alloc and init the DIRLIST head */

    dl = (DIRLIST) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct dirlist));
    if (dl == NULL)
    goto LError;
  dl->pOtherDirList = NULL;

    /* convert the pathname to an absolute path */
    _fullpath(dl->rootname, tmppath, sizeof(dl->rootname));

    dl->bSum = bSum;
    dl->bSum = FALSE;  // to speed things up. even if we do want checksums,
                       // let's get them on demand, not right now.
    dl->bFile = bFile;

    if (pPat)
    {
        dl->pPattern = pPat;
        pPat = 0;
    }

    /* make a '.' directory for the tree root directory -
     * all files and subdirs will be listed from here
     */
    {    /* Do NOT chain on anything with garbage pointers in it */
        DIRECT temp;
        temp = (DIRECT) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct direct));
        if (temp == NULL)
      return NULL;
    dl->dot = temp;
    }

    dir_dirinit(dl->dot, dl, NULL, ".");

    /* were we given a file or a directory ? */
    if (bFile)
    {
        /* its a file. create a single file entry
         * and set the state accordingly
         */
        long fsize;
        FILETIME ft;
        DWORD attr;
        fsize = dir_getpathsizeetc(tmppath, &ft, &attr);

        dl->dot->bScanned = TRUE;

    if (!dir_addfile(dl->dot, dir_finalelem(tmppath), fsize, ft, attr, 0))
            goto LError;
    }
    else
    {
        /* scan the root directory and return. if we are asked
         * to scan the whole thing, this will cause a recursive
         * scan all the way down the tree
         */
        dir_scan(dl->dot, (!bOnDemand) );
    }

    dlOut = dl;
    dl = 0;

LError:
    if (pTag)
        HeapFree(GetProcessHeap(), NULL,  pTag);
    if (pPat)
        HeapFree(GetProcessHeap(), NULL, pPat);
    dir_delete(dl);
    return dlOut;
} /* dir_buildlist */

void dir_cleardirect ( DIRECT dir )

Definition at line 1871 of file scandir.cpp.

{
    DIRITEM pfile;
    DIRECT child;

    /* clear contents of files list */
  for( pfile=(DIRITEM)List_First(dir->diritems);  pfile!=NULL;  pfile = (DIRITEM)List_Next((LPVOID)pfile)) {
        HeapFree(GetProcessHeap(), NULL, pfile->name);

        if (pfile->localname) {
            if (pfile->bLocalIsTemp) {
                /*
                 * the copy will have copied the attributes,
                 * including read-only. We should unset this bit
                 * so we can delete the temp file.
                 */
                SetFileAttributes(pfile->localname,
                                  GetFileAttributes(pfile->localname)
                                  & ~FILE_ATTRIBUTE_READONLY);
                DeleteFile(pfile->localname);
            }

            HeapFree(GetProcessHeap(), NULL, pfile->localname);
            pfile->localname = NULL;
        }
    }
    List_Destroy(&dir->diritems);

    /* clear contents of dirs list (recursively) */
  for( child=(DIRECT)List_First(dir->directs);  child!=NULL;  child = (DIRECT)List_Next((LPVOID)child)) {
        dir_cleardirect(child);
    }
    List_Destroy(&dir->directs);

    HeapFree(GetProcessHeap(), NULL, dir->relname);

} /* dir_cleardirect */

void dir_closefile | ( | DIRITEM | item,
 |  | HANDLE | fh
 | ) |  |

Definition at line 948 of file scandir.cpp.

{
    CloseHandle(fh);

} /* dir_closefile */

BOOL dir_compsequencenumber | ( | DIRITEM | dleft,
 |  | DIRITEM | dright,
 |  | int * | pcmpvalue
 | ) |  |

Definition at line 1181 of file scandir.cpp.

{
    if (!dleft->sequence && !dright->sequence)
        return FALSE;

    if (!dleft->sequence)
        *pcmpvalue = -1;
    else if (!dright->sequence)
        *pcmpvalue = 1;
    else
        *pcmpvalue = dleft->sequence - dright->sequence;

    return TRUE;
}

int dir_compwildcard | ( | DIRLIST | dleft,
 |  | DIRLIST | dright,
 |  | LPSTR | lname,
 |  | LPSTR | rname
 | ) |  |

Definition at line 1139 of file scandir.cpp.

{
    LPSTR pfinal1, pfinal2;
    char final1[MAX_PATH], final2[MAX_PATH];
    int res;

    /*
     * relnames always have at least one backslash
     */
    pfinal1 = My_mbsrchr(lname, '\\');
    pfinal2 = My_mbsrchr(rname, '\\');

    My_mbsncpy(final1, lname, (size_t)(pfinal1 - lname));
    final1[pfinal1 - lname] = '\0';
    My_mbsncpy(final2, rname, (size_t)(pfinal2 - rname));
    final2[pfinal2 - rname] = '\0';

    /*
     * compare all but the final component - if not the same, then
     * all done.
     */
    res = utils_CompPath(final1,final2);
    if (res != 0) {
        return(res);
    }

    // extract just the wildcard-matching portions of the final elements
    dir_extractwildportions(final1, &pfinal1[1], dleft->pPattern, 0);
    dir_extractwildportions(final2, &pfinal2[1], dright->pPattern, 0);

    return(utils_CompPath(final1, final2));
}

BOOL dir_copy | ( | DIRITEM | item,
 |  | LPSTR | newroot,
 |  | BOOL | HitReadOnly,
 |  | BOOL | CopyNoAttributes
 | ) |  |

Definition at line 1317 of file scandir.cpp.

{
    /*
     * newpath must be static for Win 3.1 so that it is in the
     * data segment (near) and not on the stack (far).
     */
    static char newpath[MAX_PATH];
    BOOL bOK;

    char msg[MAX_PATH+40];
    BY_HANDLE_FILE_INFORMATION bhfi;
    HANDLE hfile;
    DWORD fa;
  HRESULT hr;

    /*
     * check that the newroot directory itself exists
     */
    if ((item == NULL) || !dir_isvaliddir(newroot)) {
        return(FALSE);
    }

    if (!dir_MakeValidPath(newpath, item, newroot)) return FALSE;

    /* local copy of file */
    LPSTR pOpenName;

    pOpenName = dir_getopenname(item);

    /* if the target file already exists and is readonly,
     * warn the user, and delete if ok (remembering to clear
     * the read-only flag
     */
    bOK = TRUE;
    fa = GetFileAttributes(newpath);
    if ( (fa != -1) &&  (fa & FILE_ATTRIBUTE_READONLY)) {
        hr = StringCchPrintf(msg, (MAX_PATH+40), LoadRcString(IDS_IS_READONLY),
                 (LPSTR) newpath);
    if (FAILED(hr))
      OutputError(hr, IDS_SAFE_PRINTF);

        sdkdiff_UI(TRUE);
        if ((HitReadOnly)
     || (MessageBox(hwndClient, msg, LoadRcString(IDS_COPY_FILES),
                           MB_OKCANCEL|MB_ICONSTOP) == IDOK)) {
            sdkdiff_UI(FALSE);
            SetFileAttributes(newpath, fa & ~FILE_ATTRIBUTE_READONLY);
            DeleteFile(newpath);
        } else {
            sdkdiff_UI(FALSE);
            bOK = FALSE; /* don't overwrite */
             // abort the copy... go and release resources
        }
     }

    if (bOK) {
        bOK = CopyFile(pOpenName, newpath, FALSE);
    }
    // The attributes are copied by CopyFile
    if (bOK) {

        /* having copied the file, now copy the times */
        hfile = CreateFile(pOpenName, GENERIC_READ, 0, NULL,
                           OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);

        GetFileTime(hfile, &bhfi.ftCreationTime,
                    &bhfi.ftLastAccessTime, &bhfi.ftLastWriteTime);
        CloseHandle(hfile);

        hfile = CreateFile(newpath, GENERIC_WRITE, 0, NULL,
                           OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
        SetFileTime(hfile, &bhfi.ftCreationTime,
                    &bhfi.ftLastAccessTime,
                    &bhfi.ftLastWriteTime);
        CloseHandle(hfile);

        if (CopyNoAttributes) {
            // Prepare to kill the attributes...
            SetFileAttributes(newpath, FILE_ATTRIBUTE_NORMAL);
        }
    }
    if (bOK)
        ++nLocalCopies;

    dir_freeopenname(item, pOpenName);

    return(bOK);
} /* dir_copy */

void dir_delete ( DIRLIST dl )

Definition at line 453 of file scandir.cpp.

{
    if (dl == NULL) {
        return;
    }

    dir_cleardirect(dl->dot);
    HeapFree(GetProcessHeap(), NULL, dl->dot);

    if (dl->pPattern) {
        HeapFree(GetProcessHeap(), NULL, dl->pPattern);
    }

    HeapFree(GetProcessHeap(), NULL,  dl);
}

void dir_dirinit | ( | DIRECT | dir,
 |  | DIRLIST | head,
 |  | DIRECT | parent,
 |  | LPSTR | name
 | ) |  |

Definition at line 1422 of file scandir.cpp.

{
    int size;
  HRESULT hr;

    dir->head = head;
    dir->parent = parent;

    /* add on one for the null and one for the trailing slash */
    size = lstrlen(name) + 2;
    if (parent != NULL) {
        size += lstrlen(parent->relname);
    }

    /* build the relname from the parent and the current name
     * with a terminating slash
     */
    dir->relname = (char*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
    if (dir->relname == NULL)
    return;
  if (parent != NULL) {
        hr = StringCchCopy(dir->relname, size,parent->relname);
    if (FAILED(hr))
      OutputError(hr, IDS_SAFE_COPY);
    } else {
        dir->relname[0] = '\0';
    }

    hr = StringCchCat(dir->relname, size, name);
  if (FAILED(hr))
    OutputError(hr, IDS_SAFE_CAT);

    if (*CharPrev(dir->relname, dir->relname+lstrlen(dir->relname)) != '\\')
    {
        hr = StringCchCat(dir->relname, size, "\\");
    if (FAILED(hr))
      OutputError(hr, IDS_SAFE_CAT);
    }

    /* force name to lowercase */
    AnsiLowerBuff(dir->relname, lstrlen(dir->relname));

    dir->diritems = List_Create();
    dir->directs = List_Create();
    dir->bScanned = FALSE;
    dir->pos = DL_FILES;

} /* dir_dirinit */

int dir_endcopy ( DIRLIST dl )

Definition at line 1218 of file scandir.cpp.

{
  return(nLocalCopies);
} /* dir_endcopy */

void dir_extractwildportions | ( | LPSTR | pDest,
 |  | LPSTR | pSource,
 |  | LPSTR | pPattern,
 |  | LPSTR | pTag
 | ) |  |

Definition at line 1100 of file scandir.cpp.

{
    int size;

    /*
     * for now, just support the easy cases where there is a * at beginning or
     * end
     */

    if (pPattern[0] == '*') {
        size = lstrlen(pSource) - (lstrlen(pPattern) -1);

    } else if (pPattern[lstrlen(pPattern) -1] == '*') {
        pSource += lstrlen(pPattern) -1;
        size = lstrlen(pSource);
    } else {
        size = lstrlen(pSource);
    }

    if (pTag != NULL) {
        size -= lstrlen(pTag);
    }

    My_mbsncpy(pDest, pSource, size);
    pDest[size] = '\0';
}

BOOL dir_fileerror ( DIRITEM item )

Definition at line 998 of file scandir.cpp.

{
    return (item == NULL) || (item->fileerror);
}

BOOL dir_fileinit | ( | DIRITEM | pfile,
 |  | DIRECT | dir,
 |  | LPSTR | path,
 |  | long | size,
 |  | FILETIME | ft,
 |  | DWORD | attr,
 |  | int * | psequence
 | ) |  |

Definition at line 1481 of file scandir.cpp.

{
    BOOL bFileOk = TRUE;
  HRESULT hr;

    pfile->name = (char*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, lstrlen(path) + 1);
    if (pfile->name == NULL)
    return NULL;

  hr = StringCchCopy(pfile->name, (lstrlen(path)+1), path);
  if (FAILED(hr))
    OutputError(hr, IDS_SAFE_COPY);

  /*force name to lower case */
    AnsiLowerBuff(pfile->name, lstrlen(path));

    pfile->direct = dir;
    pfile->size = size;
    pfile->ft_lastwrite = ft;
    pfile->attr = attr;

    pfile->sequence = psequence ? *psequence : 0;

    pfile->localname = NULL;

    if (dir->head->bSum) {
        LONG err;
        LPSTR openname;

        openname = dir_getopenname(pfile);
        pfile->checksum = checksum_file(openname, &err);

        if (err!=0) {
            pfile->sumvalid = FALSE;
        } else {
            pfile->sumvalid = TRUE;
        }
        dir_freeopenname(pfile, openname);

    } else {
        pfile->sumvalid = FALSE;
    }

    return bFileOk;
} /* dir_fileinit */

LPSTR dir_finalelem ( LPSTR path )

Definition at line 1919 of file scandir.cpp.

{
    LPSTR chp;
    int size;

    /* is the final character a slash ? */
    size = lstrlen(path) - 1;
    if (*(chp = CharPrev(path, path+lstrlen(path))) == '\\') {
            /* find the slash before this */
            while (chp > path) {
                    if (*(chp = CharPrev(path, chp)) == '\\') {
                            /* skip the slash itself */
                            chp++;
                            break;
                    }
            }
            return(chp);
    }
    /* look for final slash */
    chp = My_mbsrchr(path, '\\');
    if (chp != NULL) {
        return(chp+1);
    }

    /* no slash - is there a drive letter ? */
    chp = My_mbsrchr(path, ':');
    if (chp != NULL) {
        return(chp+1);
    }

    /* this is a final-element anyway */
    return(path);

} /* dir_finalelem */

DIRITEM dir_findnextfile | ( | DIRLIST | dl,
 |  | DIRECT | curdir
 | ) |  |

Definition at line 555 of file scandir.cpp.

{
    DIRITEM curfile;

    if (bAbort) return NULL;  /* user requested abort */

    if ((dl == NULL) || (curdir == NULL)) {
        return(NULL);
    }

    /* scan the subdir if necessary */
    if (!curdir->bScanned) {
        dir_scan(curdir, FALSE);
    }

    /* have we already read the files in this directory ? */
    if (curdir->pos == DL_FILES) {
        /* no - return head of file list */
        curfile = (DIRITEM) List_First(curdir->diritems);
        if (curfile != NULL) {
            return(curfile);
        }

        /* no more files - try the subdirs */
        curdir->pos = DL_DIRS;
    }

    /* try the next subdir on the list, if any */
    /* is this the first or the next */
    if (curdir->curdir == NULL) {
        curdir->curdir = (DIRECT) List_First(curdir->directs);
    } else {
        curdir->curdir = (DIRECT) List_Next(curdir->curdir);
    }
    /* did we find a subdir ? */
    if (curdir->curdir == NULL) {

        /* no more dirs - go back to parent if there is one */
        if (curdir->parent == NULL) {
            /* no parent - we have exhausted the tree */
            return(NULL);
        }

        /* reset parent state to indicate this is the current
         * directory - so that next gets the next after this.
         * this ensures that multiple callers of dir_nextitem()
         * to the same tree work.
         */
        curdir->parent->pos = DL_DIRS;
        curdir->parent->curdir = curdir;

        return(dir_findnextfile(dl, curdir->parent));
    }

    /* there is a next directory - set it to the
     * beginning and get the first file from it
     */
    curdir->curdir->pos = DL_FILES;
    curdir->curdir->curdir = NULL;
    return(dir_findnextfile(dl, curdir->curdir));

} /* dir_findnextfile */

DIRITEM dir_firstitem ( DIRLIST dl )

Definition at line 492 of file scandir.cpp.

{
    if (dl == NULL) {
        return(NULL);
    }

    /*
     * reset the state to indicate that no files have been read yet
     */
    dl->dot->pos = DL_FILES;
    dl->dot->curdir = NULL;

    /* now get the next filename */
    return(dir_findnextfile(dl, dl->dot));
} /* dir_firstitem */

void dir_freeopenname | ( | DIRITEM | item,
 |  | LPSTR | openname
 | ) |  |

Definition at line 892 of file scandir.cpp.

{
    if ((item == NULL) || (openname == NULL)) {
        return;
    }

    if (item->localname != NULL) {
        /* freed in dir_cleardirect */
        return;
    }
    if (item->direct->head->bFile) {
        /* we used the rootname */
        return;
    }

    HeapFree(GetProcessHeap(), NULL, openname);

} /* dir_freeopenname */

void dir_freerelname | ( | DIRITEM | cur,
 |  | LPSTR | name
 | ) |  |

Definition at line 806 of file scandir.cpp.

{
    if ((cur != NULL)) {
        if (name != NULL) {
            HeapFree(GetProcessHeap(), NULL, name);
        }
    }
} /* dir_freerelname */

VOID dir_freerootdescription | ( | DIRLIST | dl,
 |  | LPSTR | string
 | ) |  |

Definition at line 677 of file scandir.cpp.

{
    HeapFree(GetProcessHeap(), NULL, string);
}

void dir_freerootpath | ( | DIRLIST | dl,
 |  | LPSTR | path
 | ) |  |

Definition at line 706 of file scandir.cpp.

{
    return;
}

DWORD dir_getattr ( DIRITEM cur )

Definition at line 1062 of file scandir.cpp.

{
    /* check this is a valid item */
    if (cur == NULL) {
        return(0);
    }

    return(cur->attr);
} /* dir_getattr */

DWORD dir_getchecksum ( DIRITEM cur )

Definition at line 1010 of file scandir.cpp.

{
    LPSTR fullname;

    /* check this is a valid item */
    if (cur == NULL) {
        return(0);
    }

    if (!cur->sumvalid) {
        /*
         * need to calculate checksum
         */
            LONG err;

            fullname = dir_getopenname(cur);
            cur->checksum = checksum_file(fullname, &err);
            if (err==0) {
                cur->sumvalid = TRUE;
                cur->fileerror = FALSE;
            } else {
                cur->fileerror = TRUE;
                return 0;
            }

            dir_freeopenname(cur, fullname);
    }

    return(cur->checksum);
} /* dir_getchecksum */

long dir_getfilesize ( DIRITEM cur )

Definition at line 1047 of file scandir.cpp.

{
    /* check this is a valid item */
    if (cur == NULL) {
        return(0);
    }

    return(cur->size);
} /* dir_getfilesize */

FILETIME dir_GetFileTime ( DIRITEM cur )

Definition at line 1077 of file scandir.cpp.

{
    /* return time of (0,0) if this is an invalid item */
    if (cur == NULL) {
        FILETIME ft;
        ft.dwLowDateTime = 0;
        ft.dwHighDateTime = 0;
        return ft;
    }

    return(cur->ft_lastwrite);

} /* dir_GetFileTime */

DIRLIST dir_getlist ( DIRITEM item )

Definition at line 754 of file scandir.cpp.

{
    if (item == NULL) {
        return(NULL);
    } else {
        return(item->direct->head);
    }
}

LPSTR dir_getopenname ( DIRITEM item )

Definition at line 825 of file scandir.cpp.

{
    LPSTR fname;
    DIRLIST phead;
  HRESULT hr;

    if (item == NULL) {
        return(NULL);
    }

    phead = item->direct->head;

    if (item->localname != NULL) {
        return(item->localname);
    }

    if (phead->bFile) {
        return(phead->rootname);
    }

    // build up the file name from rootname+relname
    // start with the root portion
    fname = (char*) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, MAX_PATH);
    if (!fname)
        return NULL;
    hr = StringCchCopy(fname, MAX_PATH, phead->rootname);
  if (FAILED(hr)) {
    OutputError(hr, IDS_SAFE_COPY);
    return(NULL);
  }

    /*
     * it's a simple local name - add both relname and name to make
     * the complete filename
     */
    /* avoid the . or .\ at the end of the relname */
    if (*CharPrev(fname, fname+lstrlen(fname)) == '\\') {
        hr = StringCchCat(fname, MAX_PATH,&item->direct->relname[2]);
    if (FAILED(hr)) {
      OutputError(hr, IDS_SAFE_COPY);
      return(NULL);
    }
    } else {
        hr = StringCchCat(fname, MAX_PATH,&item->direct->relname[1]);
    if (FAILED(hr)) {
      OutputError(hr, IDS_SAFE_CAT);
      return(NULL);
    }
    }
    hr = StringCchCat(fname, MAX_PATH, item->name);
  if (FAILED(hr)) {
    OutputError(hr, IDS_SAFE_CAT);
    return(NULL);
  }

    return(fname);
}

long dir_getpathsizeetc | ( | LPSTR | path,
 |  | FILETIME FAR * | ft,
 |  | DWORD FAR * | attr
 | ) |  |
long dir_getpathsizeetc | ( | LPSTR | path,
 |  | FILETIME * | pft,
 |  | DWORD * | pattr
 | ) |  |

Definition at line 1960 of file scandir.cpp.

{
    HANDLE fh;
    long size;

    fh = CreateFile(path, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
    if (fh == INVALID_HANDLE_VALUE)
    {
        HANDLE hFind;
        WIN32_FIND_DATA finddata;

        hFind = FindFirstFile(path, &finddata);
        if (hFind == INVALID_HANDLE_VALUE)
        {
            return 0;
        }
        else
        {
            FindClose(hFind);
            if (pft)
                *pft = finddata.ftLastWriteTime;
            if (pattr != NULL)
                *pattr = finddata.dwFileAttributes;
            return finddata.nFileSizeLow;
        }
    }

    size = GetFileSize(fh, NULL);
    if (pft)
        GetFileTime(fh, NULL, NULL, pft);
    if (pattr != NULL)
        *pattr = GetFileAttributes(path);
    CloseHandle(fh);
    return(size);
} /* dir_getpathsize */

LPSTR dir_getrelname ( DIRITEM cur )

Definition at line 771 of file scandir.cpp.

{
    LPSTR name;
  HRESULT hr;

    /* check this is a valid item */
    if (cur == NULL) {
        return(NULL);
    }

    name = (char*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, MAX_PATH);
  if (name == NULL)
    return NULL;
        hr = StringCchCopy(name, MAX_PATH, cur->direct->relname);
    if (FAILED(hr)) {
      OutputError(hr, IDS_SAFE_COPY);
      return(NULL);
    }
    hr = StringCchCat(name, MAX_PATH, cur->name);
  if (FAILED(hr)) {
    OutputError(hr, IDS_SAFE_CAT);
    return(NULL);
  }

    return(name);
} /* dir_getrelname */

LPSTR dir_getrootdescription ( DIRLIST dl )

Definition at line 630 of file scandir.cpp.

{
    LPSTR pname;
  HRESULT hr;

    // allow enough space for \\servername! + MAX_PATH
    pname = (char*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, MAX_PATH + 15);
    if (pname == NULL) {
        return(NULL);
    }

    if (dl->pDescription) {
        hr = StringCchCopy(pname, (MAX_PATH+15), dl->pDescription);
    if (FAILED(hr)) {
      OutputError(hr, IDS_SAFE_COPY);
      return (NULL);
    }
    } else {
        hr = StringCchCopy(pname, (MAX_PATH+15), dl->rootname);
    if (FAILED(hr)) {
      OutputError(hr, IDS_SAFE_COPY);
      return (NULL);
    }

        if (dl->pPattern) {
            hr = StringCchCat(pname,(MAX_PATH+15), "\\");
      if (FAILED(hr)) {
        OutputError(hr, IDS_SAFE_CAT);
        return (NULL);
      }
            hr = StringCchCat(pname,(MAX_PATH+15),dl->pPattern);
      if (FAILED(hr)) {
        OutputError(hr, IDS_SAFE_CAT);
        return (NULL);
      }
        }
    }

    return(pname);
}

LPSTR dir_getrootpath ( DIRLIST dl )

Definition at line 693 of file scandir.cpp.

{
    return(dl->rootname);
}

BOOL dir_isfile ( DIRLIST dl )

Definition at line 475 of file scandir.cpp.

{
    if (dl == NULL) {
        return(FALSE);
    }

    return(dl->bFile);
}

BOOL dir_isvaliddir ( LPCSTR path )

Definition at line 1558 of file scandir.cpp.

{
    DWORD dwAttrib;

    dwAttrib = GetFileAttributes(path);
    if (dwAttrib == -1) {
        return(FALSE);
    }
    if (dwAttrib & FILE_ATTRIBUTE_DIRECTORY) {
        return(TRUE);
    }
    return(FALSE);
} /* dir_isvaliddir */

BOOL dir_isvalidfile ( LPSTR path )

Definition at line 1539 of file scandir.cpp.

{
    DWORD dwAttrib;

    dwAttrib = GetFileAttributes(path);
    if (dwAttrib == -1) {
        return(FALSE);
    }
    if (dwAttrib & FILE_ATTRIBUTE_DIRECTORY) {
        return(FALSE);
    }
    return(TRUE);
} /* dir_isvalidfile */

BOOL dir_iswildcard ( DIRLIST dl )

Definition at line 736 of file scandir.cpp.

{
    return (dl->pPattern != NULL);
}

BOOL dir_MakeValidPath | ( | LPSTR | newpath,
 |  | DIRITEM | item,
 |  | LPSTR | newroot
 | ) |  |

Definition at line 1231 of file scandir.cpp.

{
    LPSTR relname;
    LPSTR pstart, pdest, pel;
    BOOL bOK = TRUE;
  HRESULT hr;

    /*
     * name of file relative to the tree root
     */
    relname = dir_getrelname(item);

    /*
     * build the new pathname by concatenating the new root and
     * the old relative name. add one path element at a time and
     * ensure that the directory exists, creating it if necessary.
     */
    hr = StringCchCopy(newpath, MAX_PATH, newroot);
  if (FAILED(hr))
    OutputError(hr, IDS_SAFE_COPY);

    /* add separating slash if not already there */
    if (*CharPrev(newpath, newpath+lstrlen(newpath)) != '\\') {
        hr = StringCchCat(newpath, MAX_PATH, "\\");
    if (FAILED(hr))
      OutputError(hr, IDS_SAFE_CAT);
    }

    pstart = relname;
    while ( (pel = My_mbschr(pstart, '\\')) != NULL) {

        /*
         * ignore .
         */
        if (My_mbsncmp(pstart, ".\\", 2) != 0) {

            pdest = &newpath[lstrlen(newpath)];

            // copy all but the backslash
            // on NT you can create a dir 'fred\'
            // on dos you have to pass 'fred' to _mkdir()
            My_mbsncpy(pdest, pstart, (size_t)(pel - pstart));
            pdest[pel - pstart] = '\0';

            /* create subdir if necessary */
            if (!dir_isvaliddir(newpath)) {
                if (_mkdir(newpath) != 0) {
                    /* note error, but keep going */
                    bOK = FALSE;
                }
            }

            // now insert the backslash
            hr = StringCchCat(pdest, (MAX_PATH - lstrlen(newpath)),"\\");
      if (FAILED(hr))
        OutputError(hr, IDS_SAFE_CAT);
        }

        /* found another element ending in slash. incr past the \\ */
        pel++;

        pstart = pel;
    }

    /*
     * there are no more slashes, so pstart points at the final
     * element
     */
    hr = StringCchCat(newpath, (MAX_PATH - lstrlen(newpath)), pstart);
  if (FAILED(hr))
    OutputError(hr, IDS_SAFE_CAT);
    dir_freerelname(item, relname);
    return bOK;
}

DIRITEM dir_nextitem | ( | DIRLIST | dl,
 |  | DIRITEM | cur,
 |  | BOOL | fDeep
 | ) |  |

Definition at line 525 of file scandir.cpp.

{
    DIRITEM next;

    if ((dl == NULL) || (cur == NULL)) {
        TRACE_ERROR("DIR: null arguments to dir_nextitem", FALSE);
        return(NULL);
    }

    if (bAbort) return NULL;  /* user requested abort */

    /* local list */

    if ( (next = (DIRITEM)List_Next(cur)) != NULL) {
        /* there was another file on this list */
        return(next);
    }
    if (!fDeep) return NULL;

    /* get the head of the next list of filenames from the directory */
    cur->direct->pos = DL_DIRS;
    cur->direct->curdir = NULL;
    return(dir_findnextfile(dl, cur->direct));
} /* dir_nextitem */

HANDLE dir_openfile ( DIRITEM item )

Definition at line 920 of file scandir.cpp.

{
    LPSTR fname;
    HANDLE fh;

    fname = dir_getopenname(item);
    if (fname == NULL) {
        return INVALID_HANDLE_VALUE;
    }

    fh = CreateFile(fname, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE,
                    0, OPEN_EXISTING, 0, 0);

    dir_freeopenname(item, fname);

    return(fh);
} /* dir_openfile */

void dir_rescanfile ( DIRITEM di )

Definition at line 963 of file scandir.cpp.

{
    LPSTR fullname;

    if (di==NULL) return;

    /* start with it invalid, erroneous and zero */
    di->sumvalid = FALSE;
    di->fileerror = TRUE;
    di->checksum = 0;

    fullname = dir_getopenname(di);
    di->size = dir_getpathsizeetc(fullname, &(di->ft_lastwrite), &(di->attr));
    di->checksum = dir_getchecksum(di);

    dir_freeopenname(di, fullname);

    di->sumvalid = !(di->fileerror);

} /* dir_rescanfile */

void dir_scan | ( | DIRECT | dir,
 |  | BOOL | bRecurse
 | ) |  |

Definition at line 1583 of file scandir.cpp.

{
    PSTR path=NULL, completepath = NULL;
    int size;
    DIRECT child;
    BOOL bMore;
    long filesize;
    FILETIME ft;
    BOOL bIsDir;
    LPSTR name;
    HANDLE hFind;
    WIN32_FIND_DATA finddata;
  HRESULT hr;

    /* make the complete search string including *.* */
    size = lstrlen(dir->head->rootname);
    size += lstrlen(dir->relname);

    /* add on one null and \*.* */
    // in fact, we need space for pPattern instead of *.* but add an
    // extra few in case pPattern is less than *.*
    if (dir->head->pPattern != NULL) {
        size += lstrlen(dir->head->pPattern);
    }
    size += 5;

    path = (PSTR)HeapAlloc(GetProcessHeap(), NULL, size);
  if (path == NULL)
    goto LSkip;
    completepath = (PSTR)HeapAlloc(GetProcessHeap(), NULL, size);
  if (completepath == NULL)
    goto LSkip;

    if (!path || !completepath)
        goto LSkip;

    /*
     * fill out path with all but the *.*
     */
    hr = StringCchCopy(path, size, dir->head->rootname);
  if (FAILED(hr))
    OutputError(hr, IDS_SAFE_COPY);

    /* omit the . at the beginning of the relname, and the
     * .\ if there is a trailing \ on the rootname
     */
    if (*CharPrev(path, path+lstrlen(path)) == '\\') {
        hr = StringCchCat(path, size, &dir->relname[2]);
    if (FAILED(hr))
      OutputError(hr, IDS_SAFE_CAT);
    } else {
        hr = StringCchCat(path, size, &dir->relname[1]);
    if (FAILED(hr))
      OutputError(hr, IDS_SAFE_CAT);
    }

    /*
     * do this scan twice, once for subdirectories
     * (using *.* as the final element)
     * and the other for files (using the pattern or *.* if none)
     */

    hr = StringCchCopy(completepath, size, path);
  if (FAILED(hr))
    OutputError(hr, IDS_SAFE_COPY);
    hr = StringCchCat(completepath, size, "*.*");
  if (FAILED(hr))
    OutputError(hr, IDS_SAFE_CAT);

    /*
     * scan for all subdirectories
     */

    hFind = FindFirstFile(completepath, &finddata);
    bMore = (hFind != INVALID_HANDLE_VALUE);

    while (bMore) {

        bIsDir = (finddata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY);
        name = (LPSTR) &finddata.cFileName;
        filesize = finddata.nFileSizeLow;
        if (bIsDir) {
            if ( (lstrcmp(name, ".") != 0) &&
                 (lstrcmp(name, "..") != 0))  {

                if (dir->head->pOtherDirList == NULL) {
                    dir_adddirect(dir, name);
                } else {
                    char otherName[MAX_PATH+1];
                    hr = StringCchCopy(otherName, (MAX_PATH+1), dir_getrootpath(dir->head->pOtherDirList));
          if (FAILED(hr))
            OutputError(hr, IDS_SAFE_COPY);
                    if (otherName[strlen(otherName)-1] == '\\') {
                        hr = StringCchCat(otherName, (MAX_PATH+1), &dir->relname[2]);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_CAT);
                    } else {
                        hr = StringCchCat(otherName, (MAX_PATH+1), &dir->relname[1]);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_CAT);
                    }
                    hr = StringCchCat(otherName, (MAX_PATH+1), name);
          if (FAILED(hr))
            OutputError(hr, IDS_SAFE_CAT);

                    if (dir_isvaliddir(otherName)) {
                        dir_adddirect(dir, name);
                    }
                }
            }
        }
        if (bAbort) break;  /* User requested abort */

        bMore = FindNextFile(hFind, &finddata);
    }

    FindClose(hFind);

    /*
     * now do it a second time looking for files
     */
    hr = StringCchCopy(completepath, size, path);
  if (FAILED(hr))
    OutputError(hr, IDS_SAFE_COPY);
    hr = StringCchCat(completepath, size,
            dir->head->pPattern == NULL ? "*.*" : dir->head->pPattern);
  if (FAILED(hr))
    OutputError(hr, IDS_SAFE_CAT);

    /* read all file entries in the directory */
    hFind = FindFirstFile(completepath, &finddata);
    bMore = (hFind != INVALID_HANDLE_VALUE);

    while (bMore) {
        if (bAbort) break;  /* user requested abort */

        bIsDir = (finddata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY);
        name = (LPSTR) &finddata.cFileName;
        filesize = finddata.nFileSizeLow;
        ft = finddata.ftLastWriteTime;
        if (!bIsDir) {
      dir_addfile(dir, name, filesize, ft, finddata.dwFileAttributes, 0);
        }
        bMore = FindNextFile(hFind, &finddata);
    }

    FindClose(hFind);

LSkip:
    HeapFree(GetProcessHeap(), NULL, path);
    HeapFree(GetProcessHeap(), NULL, completepath);

    dir->bScanned = TRUE;
    dir->pos = DL_FILES;

    if (bRecurse) {
    for( child=(DIRECT)List_First(dir->directs);  child!=NULL;  child = (DIRECT)List_Next((LPVOID)child)) {
            if (bAbort) break;  /* user requested abort */
            dir_scan(child, TRUE);
        }
    }

} /* dir_scan */

void dir_setdescription | ( | DIRLIST | dl,
 |  | LPCSTR | psz
 | ) |  |

Definition at line 719 of file scandir.cpp.

{
    dl->pDescription = (char*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, lstrlen(psz) + 1);
  if (dl->pDescription) {
        HRESULT hr = StringCchCopy(dl->pDescription, (lstrlen(psz)+1), psz);
    if (FAILED(hr))
      OutputError(hr, IDS_SAFE_COPY);
  }
}

void dir_setotherdirlist | ( | DIRLIST | dl,
 |  | DIRLIST | otherdl
 | ) |  |

Definition at line 443 of file scandir.cpp.

{
    dl->pOtherDirList = otherdl;
}

BOOL dir_startcopy ( DIRLIST dl )

Definition at line 1209 of file scandir.cpp.

{
    nLocalCopies = 0;
    return(TRUE);
} /* dir_startcopy */

BOOL dir_validchecksum ( DIRITEM item )

Definition at line 989 of file scandir.cpp.

{
    return (item!=NULL) && (item->sumvalid);
}

BOOL iswildpath ( LPCSTR pszPath )

Definition at line 2002 of file scandir.cpp.

{
    if (strchr(pszPath, '*') || strchr(pszPath, '?'))
        return TRUE;

    if (!(pszPath[0] && pszPath[0] == '/' && pszPath[1] && pszPath[1] == '/'))
    {
        DWORD dw;

        dw = GetFileAttributes(pszPath);
        if (dw != (DWORD)-1 && (dw & FILE_ATTRIBUTE_DIRECTORY))
            return TRUE;
    }

    return FALSE;
}

Variable Documentation

BOOL bAbort

Definition at line 508 of file sdkdiff.cpp.

Generated on Wed Nov 13 2024 16:53:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/sdkdiff/scandir.h File Reference

  • Begin
  • sdkdiff
Classes | Defines | Typedefs | Functions

scandir.h File Reference

Go to the source code of this file.

Classes

struct | _FILETIME

Defines

#define | CONST const

Typedefs

typedef struct diritem FAR * | DIRITEM
typedef struct dirlist FAR * | DIRLIST
typedef struct _FILETIME | FILETIME

Functions

long | CompareFileTime (CONST FILETIME *lpft1, CONST FILETIME *lpft2)
BOOL | dir_appendlist (DIRLIST *pdl, LPCSTR pathname, BOOL bSum, int *psequence)
DIRLIST | dir_buildlist (LPSTR pathname, BOOL bSum, BOOL bOnDemand)
void | dir_closefile (DIRITEM item, HANDLE fh)
BOOL | dir_compsequencenumber (DIRITEM dleft, DIRITEM dright, int *pcmpvalue)
int | dir_compwildcard (DIRLIST dleft, DIRLIST dright, LPSTR lname, LPSTR rname)
BOOL | dir_copy (DIRITEM item, LPSTR newroot, BOOL HitReadOnly, BOOL IgnoreAttributes)
void | dir_delete (DIRLIST list)
int | dir_endcopy (DIRLIST dl)
BOOL | dir_fileerror (DIRITEM item)
DIRITEM | dir_firstitem (DIRLIST list)
void | dir_freeopenname (DIRITEM item, LPSTR openname)
void | dir_freerelname (DIRITEM item, LPSTR relname)
void | dir_freerootdescription (DIRLIST dl, LPSTR rootname)
void | dir_freerootpath (DIRLIST dl, LPSTR rootname)
DWORD | dir_getattr (DIRITEM item)
DWORD | dir_getchecksum (DIRITEM item)
long | dir_getfilesize (DIRITEM item)
FILETIME | dir_GetFileTime (DIRITEM cur)
DIRLIST | dir_getlist (DIRITEM item)
LPSTR | dir_getopenname (DIRITEM item)
LPSTR | dir_getrelname (DIRITEM item)
LPSTR | dir_getrootdescription (DIRLIST dl)
LPSTR | dir_getrootpath (DIRLIST dl)
BOOL | dir_isfile (DIRLIST list)
BOOL | dir_isvaliddir (LPCSTR path)
BOOL dir_iswildcard (DIRLIST)
BOOL | dir_MakeValidPath (LPSTR newpath, DIRITEM item, LPSTR newroot)
DIRITEM | dir_nextitem (DIRLIST list, DIRITEM previtem, BOOL fDeep)
HANDLE | dir_openfile (DIRITEM item)
void | dir_rescanfile (DIRITEM di)
void | dir_setdescription (DIRLIST dl, LPCSTR psz)
void | dir_setotherdirlist (DIRLIST dl, DIRLIST otherdl)
BOOL | dir_startcopy (DIRLIST dl)
BOOL | dir_validchecksum (DIRITEM item)

Define Documentation

#define CONST const

Definition at line 226 of file scandir.h.

Typedef Documentation

typedef struct diritem FAR* DIRITEM

Definition at line 45 of file scandir.h.

typedef struct dirlist FAR* DIRLIST

Definition at line 42 of file scandir.h.

typedef struct _FILETIME FILETIME

Function Documentation

long CompareFileTime | ( | CONST FILETIME * | lpft1,
 |  | CONST FILETIME * | lpft2
 | ) |  |
BOOL dir_appendlist | ( | DIRLIST * | pdl,
 |  | LPCSTR | pathname,
 |  | BOOL | bSum,
 |  | int * | psequence
 | ) |  |

Definition at line 332 of file scandir.cpp.

{
    DIRLIST dl;
    BOOL bFile=FALSE;
    char tmppath[MAX_PATH];
    LPSTR pstr;
    LPSTR pTag = NULL;
    BOOL fSuccess = FALSE;
  HRESULT hr;

    if (path)
    {
        // copy the path so we can modify it
        hr = StringCchCopy(tmppath, MAX_PATH, path);
    if (FAILED(hr))
      OutputError(hr, IDS_SAFE_COPY);

    // remove the trailing slash if unnecessary (\, c:\ need it)
        pstr = &tmppath[lstrlen(tmppath) -1];
        if ((*pstr == '\\') && (pstr > tmppath) && (pstr[-1] != ':')
            && !IsDBCSLeadByte((BYTE)*(pstr-1)))
        {
            *pstr = '\0';
        }

        /* check if the path is valid */
        if ((pTag && !iswildpath(tmppath))|| (tmppath[0] == '/' && tmppath[1] == '/'))
        {
            // assume valid
            bFile = TRUE;
        }
        else if (dir_isvaliddir(tmppath))
        {
            bFile = FALSE;
        }
        else if (dir_isvalidfile(tmppath))
        {
            bFile = TRUE;
        }
        else
        {
            /* not valid */
            goto LError;
        }
    }

    if (!*pdl)
    {
        DIRECT temp;

        /* alloc and init the DIRLIST head */
        *pdl = (DIRLIST) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct dirlist));
        if (*pdl == NULL)
      goto LError;
    (*pdl)->pOtherDirList = NULL;

        (*pdl)->bSum = bSum;
        (*pdl)->bSum = FALSE;   // to speed things up. even if we do want
                                // checksums, let's get them on demand, not
                                // right now.
        (*pdl)->bFile = FALSE;

        /* make a null directory for the tree root directory -
         * all files and subdirs will be listed from here
         */
        /* Do NOT chain on anything with garbage pointers in it */
        temp = (DIRECT) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct direct));
        if (temp == NULL)
      goto LError;
    (*pdl)->dot = temp;

        dir_dirinit((*pdl)->dot, (*pdl), NULL, "");
        (*pdl)->dot->relname[0] = 0;
        (*pdl)->dot->bScanned = TRUE;
    }
    dl = *pdl;

    if (path)
    {
        /* were we given a file or a directory ? */
        if (bFile)
        {
            /* its a file. create a single file entry
             * and set the state accordingly
             */
            long fsize;
            FILETIME ft;
            DWORD attr;

            fsize = dir_getpathsizeetc(tmppath, &ft, &attr);

      if (!dir_addfile(dl->dot, tmppath, fsize, ft, attr, psequence))
                goto LError;
        }
    }

    fSuccess = TRUE;

LError:
    if (pTag)
        HeapFree(GetProcessHeap(), NULL, pTag);
    return fSuccess;
} /* dir_appendlist */

DIRLIST dir_buildlist | ( | LPSTR | pathname,
 |  | BOOL | bSum,
 |  | BOOL | bOnDemand
 | ) |  |

Definition at line 172 of file scandir.cpp.

{
    DIRLIST dlOut = 0;
    DIRLIST dl = 0;
    BOOL bFile;
    char tmppath[MAX_PATH] = {0};
    LPSTR pstr;
    LPSTR pPat = NULL;
    LPSTR pTag = NULL;
  HRESULT hr;

    /*
     * copy the path so we can modify it
     */
    strncat(tmppath, path, sizeof(tmppath)-1);

    /* look for wildcards and separate out pattern if there */
    if (My_mbschr(tmppath, '*') || My_mbschr(tmppath, '?'))
    {
        pstr = dir_finalelem(tmppath);
        pPat = (char*) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, lstrlen(pstr) +1);
        if (pPat == NULL)
      goto LError;
    hr = StringCchCopy(pPat, (lstrlen(pstr)+1), pstr);
    if (FAILED(hr)) {
      OutputError(hr, IDS_SAFE_COPY);
      goto LError;
    }
        *pstr = '\0';
    }

    /* we may have reduced the path to nothing - replace with . if so */
    if (lstrlen(tmppath) == 0)
    {
        hr = StringCchCopy(tmppath, MAX_PATH, ".");
    if (FAILED(hr)) {
      OutputError(hr, IDS_SAFE_COPY);
      goto LError;
    }
    }
    else
    {
        /*
         * remove the trailing slash if unnecessary (\, c:\ need it)
         */
        pstr = &tmppath[lstrlen(tmppath) -1];
        if ((*pstr == '\\') && (pstr > tmppath) && (pstr[-1] != ':')
            && !IsDBCSLeadByte((BYTE)*(pstr-1)))
        {
            *pstr = '\0';
        }
    }

    /* check if the path is valid */
    if ((pTag && !iswildpath(tmppath)) || (tmppath[0] == '/' && tmppath[1] == '/'))
    {
        bFile = TRUE;
    }
    else if (dir_isvaliddir(tmppath))
    {
        bFile = FALSE;
    }
    else if (dir_isvalidfile(tmppath))
    {
        bFile = TRUE;
    }
    else
    {
        /* not valid */
        goto LError;
    }

    /* alloc and init the DIRLIST head */

    dl = (DIRLIST) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct dirlist));
    if (dl == NULL)
    goto LError;
  dl->pOtherDirList = NULL;

    /* convert the pathname to an absolute path */
    _fullpath(dl->rootname, tmppath, sizeof(dl->rootname));

    dl->bSum = bSum;
    dl->bSum = FALSE;  // to speed things up. even if we do want checksums,
                       // let's get them on demand, not right now.
    dl->bFile = bFile;

    if (pPat)
    {
        dl->pPattern = pPat;
        pPat = 0;
    }

    /* make a '.' directory for the tree root directory -
     * all files and subdirs will be listed from here
     */
    {    /* Do NOT chain on anything with garbage pointers in it */
        DIRECT temp;
        temp = (DIRECT) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct direct));
        if (temp == NULL)
      return NULL;
    dl->dot = temp;
    }

    dir_dirinit(dl->dot, dl, NULL, ".");

    /* were we given a file or a directory ? */
    if (bFile)
    {
        /* its a file. create a single file entry
         * and set the state accordingly
         */
        long fsize;
        FILETIME ft;
        DWORD attr;
        fsize = dir_getpathsizeetc(tmppath, &ft, &attr);

        dl->dot->bScanned = TRUE;

    if (!dir_addfile(dl->dot, dir_finalelem(tmppath), fsize, ft, attr, 0))
            goto LError;
    }
    else
    {
        /* scan the root directory and return. if we are asked
         * to scan the whole thing, this will cause a recursive
         * scan all the way down the tree
         */
        dir_scan(dl->dot, (!bOnDemand) );
    }

    dlOut = dl;
    dl = 0;

LError:
    if (pTag)
        HeapFree(GetProcessHeap(), NULL,  pTag);
    if (pPat)
        HeapFree(GetProcessHeap(), NULL, pPat);
    dir_delete(dl);
    return dlOut;
} /* dir_buildlist */

void dir_closefile | ( | DIRITEM | item,
 |  | HANDLE | fh
 | ) |  |

Definition at line 948 of file scandir.cpp.

{
    CloseHandle(fh);

} /* dir_closefile */

BOOL dir_compsequencenumber | ( | DIRITEM | dleft,
 |  | DIRITEM | dright,
 |  | int * | pcmpvalue
 | ) |  |

Definition at line 1181 of file scandir.cpp.

{
    if (!dleft->sequence && !dright->sequence)
        return FALSE;

    if (!dleft->sequence)
        *pcmpvalue = -1;
    else if (!dright->sequence)
        *pcmpvalue = 1;
    else
        *pcmpvalue = dleft->sequence - dright->sequence;

    return TRUE;
}

int dir_compwildcard | ( | DIRLIST | dleft,
 |  | DIRLIST | dright,
 |  | LPSTR | lname,
 |  | LPSTR | rname
 | ) |  |

Definition at line 1139 of file scandir.cpp.

{
    LPSTR pfinal1, pfinal2;
    char final1[MAX_PATH], final2[MAX_PATH];
    int res;

    /*
     * relnames always have at least one backslash
     */
    pfinal1 = My_mbsrchr(lname, '\\');
    pfinal2 = My_mbsrchr(rname, '\\');

    My_mbsncpy(final1, lname, (size_t)(pfinal1 - lname));
    final1[pfinal1 - lname] = '\0';
    My_mbsncpy(final2, rname, (size_t)(pfinal2 - rname));
    final2[pfinal2 - rname] = '\0';

    /*
     * compare all but the final component - if not the same, then
     * all done.
     */
    res = utils_CompPath(final1,final2);
    if (res != 0) {
        return(res);
    }

    // extract just the wildcard-matching portions of the final elements
    dir_extractwildportions(final1, &pfinal1[1], dleft->pPattern, 0);
    dir_extractwildportions(final2, &pfinal2[1], dright->pPattern, 0);

    return(utils_CompPath(final1, final2));
}

BOOL dir_copy | ( | DIRITEM | item,
 |  | LPSTR | newroot,
 |  | BOOL | HitReadOnly,
 |  | BOOL | IgnoreAttributes
 | ) |  |

Definition at line 1317 of file scandir.cpp.

{
    /*
     * newpath must be static for Win 3.1 so that it is in the
     * data segment (near) and not on the stack (far).
     */
    static char newpath[MAX_PATH];
    BOOL bOK;

    char msg[MAX_PATH+40];
    BY_HANDLE_FILE_INFORMATION bhfi;
    HANDLE hfile;
    DWORD fa;
  HRESULT hr;

    /*
     * check that the newroot directory itself exists
     */
    if ((item == NULL) || !dir_isvaliddir(newroot)) {
        return(FALSE);
    }

    if (!dir_MakeValidPath(newpath, item, newroot)) return FALSE;

    /* local copy of file */
    LPSTR pOpenName;

    pOpenName = dir_getopenname(item);

    /* if the target file already exists and is readonly,
     * warn the user, and delete if ok (remembering to clear
     * the read-only flag
     */
    bOK = TRUE;
    fa = GetFileAttributes(newpath);
    if ( (fa != -1) &&  (fa & FILE_ATTRIBUTE_READONLY)) {
        hr = StringCchPrintf(msg, (MAX_PATH+40), LoadRcString(IDS_IS_READONLY),
                 (LPSTR) newpath);
    if (FAILED(hr))
      OutputError(hr, IDS_SAFE_PRINTF);

        sdkdiff_UI(TRUE);
        if ((HitReadOnly)
     || (MessageBox(hwndClient, msg, LoadRcString(IDS_COPY_FILES),
                           MB_OKCANCEL|MB_ICONSTOP) == IDOK)) {
            sdkdiff_UI(FALSE);
            SetFileAttributes(newpath, fa & ~FILE_ATTRIBUTE_READONLY);
            DeleteFile(newpath);
        } else {
            sdkdiff_UI(FALSE);
            bOK = FALSE; /* don't overwrite */
             // abort the copy... go and release resources
        }
     }

    if (bOK) {
        bOK = CopyFile(pOpenName, newpath, FALSE);
    }
    // The attributes are copied by CopyFile
    if (bOK) {

        /* having copied the file, now copy the times */
        hfile = CreateFile(pOpenName, GENERIC_READ, 0, NULL,
                           OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);

        GetFileTime(hfile, &bhfi.ftCreationTime,
                    &bhfi.ftLastAccessTime, &bhfi.ftLastWriteTime);
        CloseHandle(hfile);

        hfile = CreateFile(newpath, GENERIC_WRITE, 0, NULL,
                           OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
        SetFileTime(hfile, &bhfi.ftCreationTime,
                    &bhfi.ftLastAccessTime,
                    &bhfi.ftLastWriteTime);
        CloseHandle(hfile);

        if (CopyNoAttributes) {
            // Prepare to kill the attributes...
            SetFileAttributes(newpath, FILE_ATTRIBUTE_NORMAL);
        }
    }
    if (bOK)
        ++nLocalCopies;

    dir_freeopenname(item, pOpenName);

    return(bOK);
} /* dir_copy */

void dir_delete ( DIRLIST list )

Definition at line 453 of file scandir.cpp.

{
    if (dl == NULL) {
        return;
    }

    dir_cleardirect(dl->dot);
    HeapFree(GetProcessHeap(), NULL, dl->dot);

    if (dl->pPattern) {
        HeapFree(GetProcessHeap(), NULL, dl->pPattern);
    }

    HeapFree(GetProcessHeap(), NULL,  dl);
}

int dir_endcopy ( DIRLIST dl )

Definition at line 1218 of file scandir.cpp.

{
  return(nLocalCopies);
} /* dir_endcopy */

BOOL dir_fileerror ( DIRITEM item )

Definition at line 998 of file scandir.cpp.

{
    return (item == NULL) || (item->fileerror);
}

DIRITEM dir_firstitem ( DIRLIST list )

Definition at line 492 of file scandir.cpp.

{
    if (dl == NULL) {
        return(NULL);
    }

    /*
     * reset the state to indicate that no files have been read yet
     */
    dl->dot->pos = DL_FILES;
    dl->dot->curdir = NULL;

    /* now get the next filename */
    return(dir_findnextfile(dl, dl->dot));
} /* dir_firstitem */

void dir_freeopenname | ( | DIRITEM | item,
 |  | LPSTR | openname
 | ) |  |

Definition at line 892 of file scandir.cpp.

{
    if ((item == NULL) || (openname == NULL)) {
        return;
    }

    if (item->localname != NULL) {
        /* freed in dir_cleardirect */
        return;
    }
    if (item->direct->head->bFile) {
        /* we used the rootname */
        return;
    }

    HeapFree(GetProcessHeap(), NULL, openname);

} /* dir_freeopenname */

void dir_freerelname | ( | DIRITEM | item,
 |  | LPSTR | relname
 | ) |  |

Definition at line 806 of file scandir.cpp.

{
    if ((cur != NULL)) {
        if (name != NULL) {
            HeapFree(GetProcessHeap(), NULL, name);
        }
    }
} /* dir_freerelname */

void dir_freerootdescription | ( | DIRLIST | dl,
 |  | LPSTR | rootname
 | ) |  |

Definition at line 677 of file scandir.cpp.

{
    HeapFree(GetProcessHeap(), NULL, string);
}

void dir_freerootpath | ( | DIRLIST | dl,
 |  | LPSTR | rootname
 | ) |  |

Definition at line 706 of file scandir.cpp.

{
    return;
}

DWORD dir_getattr ( DIRITEM item )

Definition at line 1062 of file scandir.cpp.

{
    /* check this is a valid item */
    if (cur == NULL) {
        return(0);
    }

    return(cur->attr);
} /* dir_getattr */

DWORD dir_getchecksum ( DIRITEM item )

Definition at line 1010 of file scandir.cpp.

{
    LPSTR fullname;

    /* check this is a valid item */
    if (cur == NULL) {
        return(0);
    }

    if (!cur->sumvalid) {
        /*
         * need to calculate checksum
         */
            LONG err;

            fullname = dir_getopenname(cur);
            cur->checksum = checksum_file(fullname, &err);
            if (err==0) {
                cur->sumvalid = TRUE;
                cur->fileerror = FALSE;
            } else {
                cur->fileerror = TRUE;
                return 0;
            }

            dir_freeopenname(cur, fullname);
    }

    return(cur->checksum);
} /* dir_getchecksum */

long dir_getfilesize ( DIRITEM item )

Definition at line 1047 of file scandir.cpp.

{
    /* check this is a valid item */
    if (cur == NULL) {
        return(0);
    }

    return(cur->size);
} /* dir_getfilesize */

FILETIME dir_GetFileTime ( DIRITEM cur )

Definition at line 1077 of file scandir.cpp.

{
    /* return time of (0,0) if this is an invalid item */
    if (cur == NULL) {
        FILETIME ft;
        ft.dwLowDateTime = 0;
        ft.dwHighDateTime = 0;
        return ft;
    }

    return(cur->ft_lastwrite);

} /* dir_GetFileTime */

DIRLIST dir_getlist ( DIRITEM item )

Definition at line 754 of file scandir.cpp.

{
    if (item == NULL) {
        return(NULL);
    } else {
        return(item->direct->head);
    }
}

LPSTR dir_getopenname ( DIRITEM item )

Definition at line 825 of file scandir.cpp.

{
    LPSTR fname;
    DIRLIST phead;
  HRESULT hr;

    if (item == NULL) {
        return(NULL);
    }

    phead = item->direct->head;

    if (item->localname != NULL) {
        return(item->localname);
    }

    if (phead->bFile) {
        return(phead->rootname);
    }

    // build up the file name from rootname+relname
    // start with the root portion
    fname = (char*) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, MAX_PATH);
    if (!fname)
        return NULL;
    hr = StringCchCopy(fname, MAX_PATH, phead->rootname);
  if (FAILED(hr)) {
    OutputError(hr, IDS_SAFE_COPY);
    return(NULL);
  }

    /*
     * it's a simple local name - add both relname and name to make
     * the complete filename
     */
    /* avoid the . or .\ at the end of the relname */
    if (*CharPrev(fname, fname+lstrlen(fname)) == '\\') {
        hr = StringCchCat(fname, MAX_PATH,&item->direct->relname[2]);
    if (FAILED(hr)) {
      OutputError(hr, IDS_SAFE_COPY);
      return(NULL);
    }
    } else {
        hr = StringCchCat(fname, MAX_PATH,&item->direct->relname[1]);
    if (FAILED(hr)) {
      OutputError(hr, IDS_SAFE_CAT);
      return(NULL);
    }
    }
    hr = StringCchCat(fname, MAX_PATH, item->name);
  if (FAILED(hr)) {
    OutputError(hr, IDS_SAFE_CAT);
    return(NULL);
  }

    return(fname);
}

LPSTR dir_getrelname ( DIRITEM item )

Definition at line 771 of file scandir.cpp.

{
    LPSTR name;
  HRESULT hr;

    /* check this is a valid item */
    if (cur == NULL) {
        return(NULL);
    }

    name = (char*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, MAX_PATH);
  if (name == NULL)
    return NULL;
        hr = StringCchCopy(name, MAX_PATH, cur->direct->relname);
    if (FAILED(hr)) {
      OutputError(hr, IDS_SAFE_COPY);
      return(NULL);
    }
    hr = StringCchCat(name, MAX_PATH, cur->name);
  if (FAILED(hr)) {
    OutputError(hr, IDS_SAFE_CAT);
    return(NULL);
  }

    return(name);
} /* dir_getrelname */

LPSTR dir_getrootdescription ( DIRLIST dl )

Definition at line 630 of file scandir.cpp.

{
    LPSTR pname;
  HRESULT hr;

    // allow enough space for \\servername! + MAX_PATH
    pname = (char*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, MAX_PATH + 15);
    if (pname == NULL) {
        return(NULL);
    }

    if (dl->pDescription) {
        hr = StringCchCopy(pname, (MAX_PATH+15), dl->pDescription);
    if (FAILED(hr)) {
      OutputError(hr, IDS_SAFE_COPY);
      return (NULL);
    }
    } else {
        hr = StringCchCopy(pname, (MAX_PATH+15), dl->rootname);
    if (FAILED(hr)) {
      OutputError(hr, IDS_SAFE_COPY);
      return (NULL);
    }

        if (dl->pPattern) {
            hr = StringCchCat(pname,(MAX_PATH+15), "\\");
      if (FAILED(hr)) {
        OutputError(hr, IDS_SAFE_CAT);
        return (NULL);
      }
            hr = StringCchCat(pname,(MAX_PATH+15),dl->pPattern);
      if (FAILED(hr)) {
        OutputError(hr, IDS_SAFE_CAT);
        return (NULL);
      }
        }
    }

    return(pname);
}

LPSTR dir_getrootpath ( DIRLIST dl )

Definition at line 693 of file scandir.cpp.

{
    return(dl->rootname);
}

BOOL dir_isfile ( DIRLIST list )

Definition at line 475 of file scandir.cpp.

{
    if (dl == NULL) {
        return(FALSE);
    }

    return(dl->bFile);
}

BOOL dir_isvaliddir ( LPCSTR path )

Definition at line 1558 of file scandir.cpp.

{
    DWORD dwAttrib;

    dwAttrib = GetFileAttributes(path);
    if (dwAttrib == -1) {
        return(FALSE);
    }
    if (dwAttrib & FILE_ATTRIBUTE_DIRECTORY) {
        return(TRUE);
    }
    return(FALSE);
} /* dir_isvaliddir */

BOOL dir_iswildcard ( DIRLIST )

Definition at line 736 of file scandir.cpp.

{
    return (dl->pPattern != NULL);
}

BOOL dir_MakeValidPath | ( | LPSTR | newpath,
 |  | DIRITEM | item,
 |  | LPSTR | newroot
 | ) |  |

Definition at line 1231 of file scandir.cpp.

{
    LPSTR relname;
    LPSTR pstart, pdest, pel;
    BOOL bOK = TRUE;
  HRESULT hr;

    /*
     * name of file relative to the tree root
     */
    relname = dir_getrelname(item);

    /*
     * build the new pathname by concatenating the new root and
     * the old relative name. add one path element at a time and
     * ensure that the directory exists, creating it if necessary.
     */
    hr = StringCchCopy(newpath, MAX_PATH, newroot);
  if (FAILED(hr))
    OutputError(hr, IDS_SAFE_COPY);

    /* add separating slash if not already there */
    if (*CharPrev(newpath, newpath+lstrlen(newpath)) != '\\') {
        hr = StringCchCat(newpath, MAX_PATH, "\\");
    if (FAILED(hr))
      OutputError(hr, IDS_SAFE_CAT);
    }

    pstart = relname;
    while ( (pel = My_mbschr(pstart, '\\')) != NULL) {

        /*
         * ignore .
         */
        if (My_mbsncmp(pstart, ".\\", 2) != 0) {

            pdest = &newpath[lstrlen(newpath)];

            // copy all but the backslash
            // on NT you can create a dir 'fred\'
            // on dos you have to pass 'fred' to _mkdir()
            My_mbsncpy(pdest, pstart, (size_t)(pel - pstart));
            pdest[pel - pstart] = '\0';

            /* create subdir if necessary */
            if (!dir_isvaliddir(newpath)) {
                if (_mkdir(newpath) != 0) {
                    /* note error, but keep going */
                    bOK = FALSE;
                }
            }

            // now insert the backslash
            hr = StringCchCat(pdest, (MAX_PATH - lstrlen(newpath)),"\\");
      if (FAILED(hr))
        OutputError(hr, IDS_SAFE_CAT);
        }

        /* found another element ending in slash. incr past the \\ */
        pel++;

        pstart = pel;
    }

    /*
     * there are no more slashes, so pstart points at the final
     * element
     */
    hr = StringCchCat(newpath, (MAX_PATH - lstrlen(newpath)), pstart);
  if (FAILED(hr))
    OutputError(hr, IDS_SAFE_CAT);
    dir_freerelname(item, relname);
    return bOK;
}

DIRITEM dir_nextitem | ( | DIRLIST | list,
 |  | DIRITEM | previtem,
 |  | BOOL | fDeep
 | ) |  |

Definition at line 525 of file scandir.cpp.

{
    DIRITEM next;

    if ((dl == NULL) || (cur == NULL)) {
        TRACE_ERROR("DIR: null arguments to dir_nextitem", FALSE);
        return(NULL);
    }

    if (bAbort) return NULL;  /* user requested abort */

    /* local list */

    if ( (next = (DIRITEM)List_Next(cur)) != NULL) {
        /* there was another file on this list */
        return(next);
    }
    if (!fDeep) return NULL;

    /* get the head of the next list of filenames from the directory */
    cur->direct->pos = DL_DIRS;
    cur->direct->curdir = NULL;
    return(dir_findnextfile(dl, cur->direct));
} /* dir_nextitem */

HANDLE dir_openfile ( DIRITEM item )

Definition at line 920 of file scandir.cpp.

{
    LPSTR fname;
    HANDLE fh;

    fname = dir_getopenname(item);
    if (fname == NULL) {
        return INVALID_HANDLE_VALUE;
    }

    fh = CreateFile(fname, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE,
                    0, OPEN_EXISTING, 0, 0);

    dir_freeopenname(item, fname);

    return(fh);
} /* dir_openfile */

void dir_rescanfile ( DIRITEM di )

Definition at line 963 of file scandir.cpp.

{
    LPSTR fullname;

    if (di==NULL) return;

    /* start with it invalid, erroneous and zero */
    di->sumvalid = FALSE;
    di->fileerror = TRUE;
    di->checksum = 0;

    fullname = dir_getopenname(di);
    di->size = dir_getpathsizeetc(fullname, &(di->ft_lastwrite), &(di->attr));
    di->checksum = dir_getchecksum(di);

    dir_freeopenname(di, fullname);

    di->sumvalid = !(di->fileerror);

} /* dir_rescanfile */

void dir_setdescription | ( | DIRLIST | dl,
 |  | LPCSTR | psz
 | ) |  |

Definition at line 719 of file scandir.cpp.

{
    dl->pDescription = (char*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, lstrlen(psz) + 1);
  if (dl->pDescription) {
        HRESULT hr = StringCchCopy(dl->pDescription, (lstrlen(psz)+1), psz);
    if (FAILED(hr))
      OutputError(hr, IDS_SAFE_COPY);
  }
}

void dir_setotherdirlist | ( | DIRLIST | dl,
 |  | DIRLIST | otherdl
 | ) |  |

Definition at line 443 of file scandir.cpp.

{
    dl->pOtherDirList = otherdl;
}

BOOL dir_startcopy ( DIRLIST dl )

Definition at line 1209 of file scandir.cpp.

{
    nLocalCopies = 0;
    return(TRUE);
} /* dir_startcopy */

BOOL dir_validchecksum ( DIRITEM item )

Definition at line 989 of file scandir.cpp.

{
    return (item!=NULL) && (item->sumvalid);
}

Generated on Wed Nov 13 2024 16:53:02 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/sdkdiff/sdkdiff.cpp File Reference

  • Begin
  • sdkdiff
Classes | Defines | Typedefs | Functions | Variables

sdkdiff.cpp File Reference

#include "precomp.h"
#include <shellapi.h>
#include "table.h"
#include <richedit.h>
#include "list.h"
#include "scandir.h"
#include "file.h"
#include "compitem.h"
#include "complist.h"
#include "view.h"
#include "findgoto.h"
#include "state.h"
#include "sdkdiff.h"
#include "wdiffrc.h"

Go to the source code of this file.

Classes

struct | EDITARGS
struct | THREADARGS
struct | UsageStringInfo

Defines

#define | CHECKMENU(id, fChecked) CheckMenuItem(hMenu, (id), (fChecked) ? MF_CHECKED:MF_UNCHECKED)
#define | FindNextChange() _FindNextChange(TRUE, TRUE)
#define | FindPrevChange() _FindPrevChange(TRUE, TRUE)
#define | MODE_EXPAND 2
#define | MODE_NULL 0
#define | MODE_OUTLINE 1
#define | TABID_PRINTER 1
#define | WDEnter() EnterCriticalSection(&CSSdkdiff);
#define | WDLeave() LeaveCriticalSection(&CSSdkdiff);

Typedefs

typedef struct EDITARGS * | PEDITARGS
typedef struct THREADARGS * | PTHREADARGS

Functions

BOOL | _FindNextChange (BOOL fErrorPopup, BOOL fForceAutoCenter)
BOOL | _FindPrevChange (BOOL fErrorPopup, BOOL fForceAutoCenter)
INT_PTR APIENTRY | AboutBox (HWND hDlg, unsigned message, WPARAM wParam, LPARAM lParam)
void | BusyError (void)
void | CreateTools (void)
void | DeleteTools (void)
LONG WINAPI | do_editfile (PEDITARGS pe)
void | do_editthread (VIEW view, int option)
long | do_getdata (HWND hwnd, lpCellDataList cdlist)
long | do_gethdr (HWND hwnd, lpTableHdr phdr)
long | do_getprops (HWND hwnd, lpColPropsList propslist)
void | DoPrint (void)
void | DoResize (HWND hWnd)
void | GetFontPref (void)
char * | GetNextToken (char *Tok)
BOOL | InitApplication (HINSTANCE hInstance)
BOOL | InitInstance (HINSTANCE hInstance, int nCmdShow)
BOOL IsBusy ()
LPTSTR APIENTRY | LoadRcString (UINT wID)
INT_PTR APIENTRY | MainWndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
LPSTR | My_mbschr (LPCSTR psz, unsigned short uiSep)
PUCHAR | My_mbsistr (PUCHAR str1, PUCHAR str2, PUCHAR *pstrEnd)
int | My_mbsncmp (LPCSTR psz1, LPCSTR psz2, size_t nLen)
LPSTR | My_mbsncpy (LPSTR psz1, LPCSTR psz2, size_t nLen)
int | My_mbsnicmp (PUCHAR psz1, PUCHAR psz2, size_t nLen)
PUCHAR | My_mbspbrk (PUCHAR psz, PUCHAR pszSep)
LPSTR | My_mbsrchr (LPCSTR psz, unsigned short uiSep)
PUCHAR | My_mbsstr (PUCHAR str1, PUCHAR str2, PUCHAR *pstrEnd)
void | OnRightClick (HWND hWnd, int x, int y)
void | OnUpdate (COMPITEM item)
void | ParseArgs (char *lpCmdLine)
void | PickUpProfile (DWORD *pfoo, LPCSTR szfoo)
BOOL | Poll (void)
void | RescanFile (HWND hwnd)
void | sdkdiff_UI (BOOL bAttach)
void | sdkdiff_usage (LPSTR msg)
BOOL | SetBusy (void)
void | SetButtonText (LPSTR cmd)
void | SetColours (void)
void | SetMonoColours (void)
void | SetNames (LPSTR names)
void | SetNotBusy (void)
void | SetSelection (long rownr, long nrows, long dyRowsFromTop)
void | SetStatus (LPSTR cmd)
UINT | StateToColour (int state, BOOL bMarked, int col, DWORD *foreground, DWORD *foregroundws, DWORD *background)
void | SvrClose (void)
long | TableServer (HWND hwnd, WPARAM cmd, LPARAM lParam)
BOOL | ToExpand (HWND hwnd)
BOOL | ToMoved (HWND hwnd, BOOL bMove)
void | ToOutline (HWND hwnd)
void | Trace_Status (LPSTR str)
INT_PTR FAR PASCAL | UsageDlgProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
DWORD WINAPI | wd_copy (LPVOID arg)
DWORD WINAPI | wd_dirdialog (LPVOID arg)
DWORD WINAPI | wd_initial (LPVOID arg)
int WINAPI | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
BOOL | WriteProfileInt (LPSTR AppName, LPSTR Key, int Int)

Variables

BOOL __BERR
BOOL | Algorithm2 = TRUE
char | AppTitle [256]
BOOL bAbort
BOOL bDBCS
BOOL bJapan
BOOL bTrace
CRITICAL_SECTION | CSSdkdiff
VIEW | current_view = NULL
int | DisplayMode = MODE_NULL
char | editor_cmdline [256] = "notepad %p"
int | expand_include = INCLUDE_ALL
int | expand_mode = IDM_BOTHFILES
BOOL | fAutoExpand = TRUE
BOOL | fBusy = FALSE
BYTE | g_bFontCharSet
BOOL g_fFontBold
HFONT | g_hFont = 0
int | g_nFontHeight
char | g_szFontFaceName [LF_FACESIZE]
int | g_tabwidth = TABWIDTH_DEFAULT
BOOL | gbPerverseCompare = FALSE
HACCEL | haccel
BOOL | hide_markedfiles = FALSE
HINSTANCE | hInst
HMENU | hMenu
HWND | hwndBar
HWND | hwndClient
HWND | hwndRCD
HWND | hwndStatus
BOOL | ignore_blanks = TRUE
int | line_numbers = IDM_LNRS
BOOL | mono_colours = FALSE
int | nMinMax = SW_SHOWNORMAL
int | outline_include = INCLUDE_ALL
BOOL | picture_mode = TRUE
char | pszWorkingDirectoryName [MAX_PATH]
DWORD rgb_barcurrent
DWORD rgb_barleft
DWORD rgb_barright
DWORD rgb_defaultback
DWORD rgb_defaultfore
DWORD rgb_defaultforews
DWORD rgb_fileleftback
DWORD rgb_fileleftfore
DWORD rgb_filerightback
DWORD rgb_filerightfore
DWORD rgb_leftback
DWORD rgb_leftfore
DWORD rgb_mleftback
DWORD rgb_mleftfore
DWORD rgb_mrightback
DWORD rgb_mrightfore
DWORD | rgb_outlinehi = RGB(255, 0, 0)
DWORD rgb_rightback
DWORD rgb_rightfore
DWORD rgb_similar
DWORD rgb_similarleft
DWORD rgb_similarright
char * | s
long | selection = -1
long | selection_nrows = 0
BOOL | show_whitespace = FALSE
int | status_height
int | SubVersion = 01
const CHAR | szSdkDiff [] = "SdkDiff"
UINT table_msgcode
BOOL | TrackDifferent = TRUE
BOOL | TrackLeftOnly = TRUE
BOOL | TrackReadonly = TRUE
BOOL | TrackRightOnly = TRUE
BOOL | TrackSame = TRUE
int | Version = 2

Define Documentation

#define CHECKMENU | ( | id,
 |  | fChecked |
 | ) |  | CheckMenuItem(hMenu, (id), (fChecked) ? MF_CHECKED:MF_UNCHECKED)
#define FindNextChange ( ) _FindNextChange(TRUE, TRUE)

Definition at line 1707 of file sdkdiff.cpp.

#define FindPrevChange ( ) _FindPrevChange(TRUE, TRUE)

Definition at line 1708 of file sdkdiff.cpp.

#define MODE_EXPAND 2

Definition at line 499 of file sdkdiff.cpp.

#define MODE_NULL 0

Definition at line 497 of file sdkdiff.cpp.

#define MODE_OUTLINE 1

Definition at line 498 of file sdkdiff.cpp.

#define TABID_PRINTER 1

Definition at line 207 of file sdkdiff.cpp.

#define WDEnter ( ) EnterCriticalSection(&CSSdkdiff);

Definition at line 195 of file sdkdiff.cpp.

#define WDLeave ( ) LeaveCriticalSection(&CSSdkdiff);

Definition at line 196 of file sdkdiff.cpp.

Typedef Documentation

typedef struct EDITARGS* PEDITARGS
typedef struct THREADARGS* PTHREADARGS

Function Documentation

BOOL _FindNextChange | ( | BOOL | fErrorPopup,
 |  | BOOL | fForceAutoCenter
 | ) |  |

Definition at line 1711 of file sdkdiff.cpp.

{
    long row;
    long dyRowsFromTop = -1;
    long top = (int)SendMessage(hwndRCD, TM_TOPROW, FALSE, 0);

    /* start from the selection or top of the window if no selection */
    if (selection >= 0)
    {
        row = selection + 1;
        if (!fForceAutoCenter)
            dyRowsFromTop = selection - top;
    }
    else
    {
        row = top;
    }

    /* find the next 'interesting' line */
    row = view_findchange(current_view, row, TRUE);
    if (row >= 0) {
        SetSelection(row, 1, dyRowsFromTop);
        return(TRUE);
    } else if (fErrorPopup) {
        sdkdiff_UI(TRUE);
        MessageBox(hwndClient, LoadRcString(IDS_NO_MORE_CHANGES), szSdkDiff,
                   MB_ICONINFORMATION|MB_OK);
        sdkdiff_UI(FALSE);

    }
    return(FALSE);
}

BOOL _FindPrevChange | ( | BOOL | fErrorPopup,
 |  | BOOL | fForceAutoCenter
 | ) |  |

Definition at line 1748 of file sdkdiff.cpp.

{
    long row;
    long dyRowsFromTop = -1;
    long top = (int)SendMessage(hwndRCD, TM_TOPROW, FALSE, 0);

    /* start from the selection or top of window if no selection */
    if (selection >= 0)
    {
        row = selection - 1;
        if (!fForceAutoCenter)
            dyRowsFromTop = selection - top;
    }
    else
    {
        row = top;
    }

    /* find the previous 'interesting' line */
    row = view_findchange(current_view, row, FALSE);
    if (row >= 0) {
        SetSelection(row, 1, dyRowsFromTop);
        return(TRUE);
    } else if (fErrorPopup) {
        sdkdiff_UI(TRUE);
        MessageBox(hwndClient, LoadRcString(IDS_NO_PREV_CHANGES), szSdkDiff,
                   MB_ICONINFORMATION|MB_OK);
        sdkdiff_UI(FALSE);

    }
    return(FALSE);
}

INT_PTR APIENTRY AboutBox | ( | HWND | hDlg,
 |  | unsigned | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 1612 of file sdkdiff.cpp.

{
    char ch[256];
  HRESULT hr;

    switch (message) {

        case WM_INITDIALOG:
            hr = StringCchPrintf(ch, 256, "%d.%02d", Version, SubVersion);
      if (FAILED(hr))
        OutputError(hr, IDS_SAFE_PRINTF);
            SetDlgItemText(hDlg, IDD_VERSION, ch);
            return(TRUE);

        case WM_COMMAND:
            switch (GET_WM_COMMAND_ID(wParam, lParam)) {
                case IDOK:
                    EndDialog(hDlg, 0);
                    return(TRUE);
            }
            break;
    }
    return(FALSE);
}

void BusyError ( void )

Definition at line 2643 of file sdkdiff.cpp.

{
    sdkdiff_UI(TRUE);
    MessageBox(hwndClient,
               LoadRcString(IDS_PLEASE_WAIT),
               szSdkDiff, MB_OK|MB_ICONSTOP);
    sdkdiff_UI(FALSE);
} /* BusyError */

void CreateTools ( void )

Definition at line 1516 of file sdkdiff.cpp.

{

    /* standard message that table class sends us for
     * notifications and queries.
     */
    table_msgcode = RegisterWindowMessage(TableMessage);

    line_numbers = GetProfileInt(APPNAME, szLineNumbers, line_numbers);
    outline_include = GetProfileInt(APPNAME, szFileInclude, outline_include);
    expand_include = GetProfileInt(APPNAME, szLineInclude, expand_include);
    ignore_blanks = GetProfileInt(APPNAME, szBlanks, ignore_blanks);
    Algorithm2 = GetProfileInt(APPNAME, szAlgorithm2, Algorithm2);
    mono_colours = GetProfileInt(APPNAME, szMonoColours, mono_colours);
    picture_mode = GetProfileInt(APPNAME, szPicture, picture_mode);
    hide_markedfiles = GetProfileInt(APPNAME, szHideMark, hide_markedfiles);

    GetProfileString(APPNAME, szEditor, editor_cmdline, editor_cmdline,
                     sizeof(editor_cmdline));

    g_tabwidth = GetProfileInt(APPNAME, szTabWidth, g_tabwidth);

    InitializeCriticalSection(&CSSdkdiff);

    GetFontPref();
}

void DeleteTools ( void )

Definition at line 1545 of file sdkdiff.cpp.

{
    DeleteCriticalSection(&CSSdkdiff);
    DeleteObject(g_hFont);
}

LONG WINAPI do_editfile ( PEDITARGS pe )

Definition at line 2093 of file sdkdiff.cpp.

{
    VIEW view = pe->view;
    int option = pe->option;
    long L_selection = pe->selection;

    COMPITEM item;
    LPSTR fname;
    char cmdline[MAX_PATH] = {'\0'};
    long selline, currentline;
    char * pOut = cmdline;
    char * pIn = editor_cmdline;
    STARTUPINFO si;
    PROCESS_INFORMATION pi;
  HRESULT hr;

    item = view_getitem(view, L_selection);
    if (item == NULL) {
        sdkdiff_UI(TRUE);
        MessageBox(hwndClient, LoadRcString(IDS_NOTHING_TO_EDIT),
                   szSdkDiff, MB_ICONSTOP|MB_OK);
        sdkdiff_UI(FALSE);

        return -1;
    }

    fname = compitem_getfilename(view, item, option);

    if ( 0 == fname ) {
        sdkdiff_UI(TRUE);
        MessageBox(hwndClient, LoadRcString(IDS_FILE_DOESNT_EXIST),
                   szSdkDiff, MB_ICONSTOP|MB_OK);
        sdkdiff_UI(FALSE);
        goto error;
    }

    // convert the selected line into a line number within the file
    if (L_selection > 0) {
        selline = L_selection;
    } else {
        // if no current selection, look for the line at top of window
        selline = (long) SendMessage(hwndRCD, TM_TOPROW, FALSE, 0);
    }

    switch ( option ) {
        case CI_LEFT:
            do {
                currentline = view_getlinenr_left( view, selline);

                // if the selected line is not in the left file,
                // backup one line and try again until we hit the top of
                // file or find a line that is within the left file

                if (selline > 0) {
                    selline--;
                }
            } while ((currentline <= 0) && (selline > 0));

            break;

        case CI_RIGHT:
            do {
                currentline = view_getlinenr_right( view, selline);
                if (selline > 0) {
                    selline--;
                }
            } while ((currentline <= 0) && (selline > 0));
            break;

        default:
            currentline = 1;
            break;
    }

    if (currentline <=0) {
        currentline = 1;
    }

    while ( *pIn ) {
        switch ( *pIn ) {
            case '%':
                pIn++;
                switch ( *pIn ) {
                    case 'p':
                        hr = StringCchCopy( pOut, MAX_PATH, fname);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_COPY);
                        while ( *pOut )
                            pOut++;
                        break;

                    case 'l':
                        _ltoa( currentline, pOut, 10 );
                        while ( *pOut )
                            pOut++;
                        break;

                    default:
                        if (IsDBCSLeadByte(*pIn) && *(pIn+1)) {
                            *pOut++ = *pIn++;
                        }
                        *pOut++ = *pIn;
                        break;
                }
                pIn++;
                break;

            default:
                if (IsDBCSLeadByte(*pIn) && *(pIn+1)) {
                    *pOut++ = *pIn++;
                }
                *pOut++ = *pIn++;
                break;
        }
    }

    *pOut = '\0';

    si.lpTitle = "Edit File";
    si.cb = sizeof(STARTUPINFO);
    si.lpReserved = NULL;
    si.lpReserved2 = NULL;
    si.cbReserved2 = 0;
    si.lpDesktop = NULL;
    si.dwFlags = STARTF_FORCEONFEEDBACK;

    if (!CreateProcess(NULL,
                       cmdline,
                       NULL,
                       NULL,
                       FALSE,
                       NORMAL_PRIORITY_CLASS,
                       NULL,
                       NULL,
                       &si,
                       &pi)) {
        sdkdiff_UI(TRUE);
        MessageBox(hwndClient, LoadRcString(IDS_FAILED_TO_LAUNCH_EDT),
                   szSdkDiff, MB_ICONSTOP|MB_OK);
        sdkdiff_UI(FALSE);
        goto error;
    }

    /* wait for completion. */
    WaitForSingleObject(pi.hProcess, INFINITE);

    /* close process and thread handles */
    CloseHandle(pi.hThread);
    CloseHandle(pi.hProcess);

    /* finished with the filename. deletes it if it was a temp. */
    compitem_freefilename(item, option, fname);

    /*
     * refresh cached view always .  A common trick is to edit the
     * composite file and then save it as a new left or right file.
     * Equally the user can edit the left and save as a new right.
     */

    /* We want to force both files to be re-read, but it's not a terribly
     * good idea to throw the lines away on this thread.  Someone might
     * be reading them on another thread! (e.g. user tries to expand
     * file, seems to be taking a long time, so user decides to edit it
     * to have a look!
     */

    /* We don't discard the lines (well, not on this thread) but we do discard
     * status information.  (Used to work only in expanded mode, relying on
     * status being reset when we go back to outline).
     */

    /* force the compare to be re-done */
    compitem_rescan(item);
    PostMessage(hwndClient, WM_COMMAND, IDM_UPDATE, (LPARAM)item);

    error:
    HeapFree(GetProcessHeap(), NULL, pe);

    return 0;

} /* do_editfile */

void do_editthread | ( | VIEW | view,
 |  | int | option
 | ) |  |

Definition at line 2286 of file sdkdiff.cpp.

{
    PEDITARGS pe;
    HANDLE thread;
    DWORD threadid;

    pe = (PEDITARGS) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(EDITARGS));
    if (pe == NULL)
    return;
  pe->view = view;
    pe->option = option;
    pe->selection = selection;

    thread = CreateThread( NULL
                           , 0
                           , (LPTHREAD_START_ROUTINE)do_editfile
                           , (LPVOID) pe
                           , 0
                           , &threadid
                         );
    if (thread == NULL)
    {
        do_editfile(pe);
    }
    else CloseHandle(thread);

    // new layout not needed as do_editfile sends IDM_UPDATE

} /* do_editthread */

long do_getdata | ( | HWND | hwnd,
 |  | lpCellDataList | cdlist
 | ) |  |

Definition at line 2961 of file sdkdiff.cpp.

{
    int start, endcell, col, i;
    int state, markedstate;
    lpCellData cd;
    VIEW view;
    LPSTR textp;
    LPWSTR pwzText;
    BOOL bIsPrinter = FALSE;

    if (cdlist->id == TABID_PRINTER) {
        view = current_view;
        bIsPrinter = TRUE;
    } else {
        view = (VIEW) cdlist->id;
    }

    /* set state data */
    state = view_getstate(view, cdlist->row);
    markedstate = view_getmarkstate(view, cdlist->row);
    start = cdlist->startcell;
    endcell = cdlist->ncells + start;
    if (cdlist->row >= view_getrowcount(view)) {
        return(FALSE);
    }
    for (i = start; i < endcell; i++) {
        cd = &cdlist->plist[i - start];

        /* skip the line number column if IDM_NONRS */
        if (line_numbers == IDM_NONRS) {
            col = i+1;
        } else {
            col = i;
        }

        /* set colour of text to mark out
         * lines that are changed, if not printer - for the
         * printer everything should stay in the default colours
         * or it will be grayed out and look ugly
         */

        if ( !bIsPrinter
          || (GetProfileInt(APPNAME, szColourPrinting, 0) > 0)) {

            /* convert the state of the requested row into a
             * colour scheme. returns P_FCOLOUR and/or
             * P_BCOLOUR if it sets either of the colours
             */
            cd->props.valid |=
            StateToColour(
                         state,
                         markedstate,
                         col,
                         &cd->props.forecolour,
                         &cd->props.forecolourws,
                         &cd->props.backcolour);
        }

        textp = view_gettext(view, cdlist->row, col);
        if (cd->nchars != 0) {
            if (textp == NULL) {
                cd->ptext[0] = '\0';
            } else {
                My_mbsncpy(cd->ptext, textp, cd->nchars -1);
                cd->ptext[cd->nchars - 1] = '\0';
            }
        }

        pwzText = view_gettextW(view, cdlist->row, col);
        if (pwzText && cd->nchars)
        {
            cd->pwzText = (WCHAR*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cd->nchars * sizeof(*cd->pwzText));
            if (cd->pwzText == NULL)
        return (FALSE);
      wcsncpy(cd->pwzText, pwzText, cd->nchars -1);
            cd->pwzText[cd->nchars - 1] = 0;
        }
        else
        {
            HeapFree(GetProcessHeap(), NULL, cd->pwzText);
            cd->pwzText = 0;
        }

    }
    return(TRUE);
}

long do_gethdr | ( | HWND | hwnd,
 |  | lpTableHdr | phdr
 | ) |  |

Definition at line 2789 of file sdkdiff.cpp.

{
    VIEW view;
    BOOL bIsPrinter = FALSE;

    if (phdr->id == TABID_PRINTER) {
        view = current_view;
        bIsPrinter = TRUE;
    } else {
        view = (VIEW) phdr->id;
    }
    if (view == NULL) {
        return(FALSE);
    }

    phdr->nrows = view_getrowcount(view);

    /*  three columns: line nr, tag and rest of line */

    /*
     * if IDM_NONRS (no line numbers) is selected, suppress the
     * line-nr column entirely to save screen space
     */
    if (line_numbers == IDM_NONRS) {
        phdr->ncols = 2;
        phdr->fixedcols = 0;
    } else {
        phdr->ncols = 3;
        phdr->fixedcols = 1;
    }

    phdr->fixedrows = 0;
    phdr->fixedselectable = FALSE;
    phdr->hseparator = TRUE;
    phdr->vseparator = TRUE;

    phdr->selectmode = TM_ROW | TM_MANY;
    /*
     * find if we are in expand mode - ask for the item we are expanding.
     */
    if (view_isexpanded(view) == TRUE) {

        /* use focus rect as selection mode in expand mode
         * so as not to interfere with background colours.
         */
        phdr->selectmode |= TM_FOCUS;
    } else {
        /* use default solid inversion when possible as it is clearer.*/
        phdr->selectmode |= TM_SOLID;
    }

    /* please send TQ_SCROLL notifications when the table is scrolled */
    phdr->sendscroll = TRUE;
    if (g_hFont) {
        phdr->props.valid = P_FONT;
        phdr->props.hFont = g_hFont;
    }

    return TRUE;
}

long do_getprops | ( | HWND | hwnd,
 |  | lpColPropsList | propslist
 | ) |  |

Definition at line 2858 of file sdkdiff.cpp.

{
    int i, cell;
    BOOL bIsPrinter = FALSE;
    VIEW view;
    HFONT hfontSystem = (HFONT)GetStockObject(SYSTEM_FONT);
    HFONT hfontFixed = g_hFont ? g_hFont : (HFONT)GetStockObject(SYSTEM_FIXED_FONT);

    if (propslist->id == TABID_PRINTER) {
        view = current_view;
        bIsPrinter = TRUE;
    } else {
        view = (VIEW) propslist->id;
    }
    if (view == NULL) {
        return(FALSE);
    }

    if (g_hFont)
    {
        HDC hdc;
        TEXTMETRIC tmSystem;
        TEXTMETRIC tmFixed;
        HFONT hfont;

        hdc = GetDC(hwnd);
        if (hdc)
        {
            hfont = (HFONT)SelectObject(hdc, hfontSystem);
            GetTextMetrics(hdc, &tmSystem);
            SelectObject(hdc, hfontFixed);
            GetTextMetrics(hdc, &tmFixed);
            SelectObject(hdc, hfont);
            ReleaseDC(hwnd, hdc);

            if (tmFixed.tmHeight + 1 < tmSystem.tmHeight)
                hfontSystem = hfontFixed;
        }
    }

    /* the table inteface is slightly confused here. we are not
     * guaranteed which columns we are being asked about, so instead
     * of just setting each column cols[0], cols[1] etc, we need
     * to loop through, looking at each column in the table and
     * seeing which it is.
     */
    for (i = 0; i < propslist->ncols; i++) {
        cell = i + propslist->startcol;
        propslist->plist[i].props.valid = 0;

        /* for all column widths, add on 1 for the NULL char. */

        /*
         * skip the line nr column if IDM_NONRS
         */
        if (line_numbers == IDM_NONRS) {
            cell++;
        }

        if (cell == 0) {
            /* properties for line nr column */

            propslist->plist[i].nchars = view_getwidth(view, 0)+1;
            propslist->plist[i].props.valid |= P_ALIGN | P_FONT;
            propslist->plist[i].props.alignment = P_CENTRE;
            propslist->plist[i].props.hFont = hfontSystem;
        } else if (cell == 1) {

            /* properties for tag field */
            propslist->plist[i].nchars = view_getwidth(view, 1)+1;
            propslist->plist[i].props.valid |= P_ALIGN | P_FONT;
            propslist->plist[i].props.alignment = P_LEFT;
            propslist->plist[i].props.hFont = hfontSystem;
        } else {
            /* properties for main text column -
             * use a fixed font unless printing (if
             * printing, best to use the default font, because
             * of resolution differences.
             * add on 8 chars to the width to ensure that
             * the width of lines beginning with tabs
             * works out ok
             */
            propslist->plist[i].nchars = view_getwidth(view, 2)+1;
            propslist->plist[i].props.valid |= P_ALIGN;
            propslist->plist[i].props.alignment = P_LEFT;
            if (!bIsPrinter) {
                propslist->plist[i].props.valid |= P_FONT;
                propslist->plist[i].props.hFont = hfontFixed;
            }
        }
    }
    return (TRUE);
}

void DoPrint ( void )

Definition at line 1647 of file sdkdiff.cpp.

{
    Title head, foot;
    PrintContext context;
    TCHAR szPage[50];
    TCHAR szTitle[20];
  HRESULT hr;

    /* print context contains the header and footer. Use the
     * default margins and printer selection
     */

    /* we set the table id to be TABID_PRINTER. When the table calls
     * back to get text and properties, we use this to indicate
     * that the table refered to is the 'current_view', but in print
     * mode, and thus we will use different colours/fonts.
     */
    context.head = &head;
    context.foot = &foot;
    context.margin = NULL;
    context.pd = NULL;
    context.id = TABID_PRINTER;

    /* header is filenames or just SdkDiff if no names known*/
    if (strlen(AppTitle) > 0) {
        head.ptext = AppTitle;
    } else {
        head.ptext = (LPSTR)szSdkDiff;
    }

    /* header is centred, footer is right-aligned and
     * consists of the page number
     */
    head.props.valid = P_ALIGN;
    head.props.alignment = P_CENTRE;
    hr = StringCchCopy(szPage, 50, LoadRcString(IDS_PAGE));
  if (FAILED(hr))
    OutputError(hr, IDS_SAFE_COPY);
    foot.ptext = (LPSTR)szPage;
    foot.props.valid = P_ALIGN;
    foot.props.alignment = P_RIGHT;

    if ( SendMessage(hwndRCD, TM_PRINT, 0, (LPARAM) &context)) {
        Trace_Status(LoadRcString(IDS_SENT_TO_PRINTER));
    } else {
        sdkdiff_UI(TRUE);
        hr = StringCchCopy(szTitle, 20, LoadRcString(IDS_SDKDIFF_ERROR));
    if (FAILED(hr))
      OutputError(hr, IDS_SAFE_COPY);
    MessageBox(hwndClient, LoadRcString(IDS_UNABLE_TO_PRINT),
                szTitle, MB_ICONEXCLAMATION);
        sdkdiff_UI(FALSE);
    }
}

void DoResize ( HWND hWnd )

Definition at line 1582 of file sdkdiff.cpp.

{
    RECT rc;
    int bar_width;

    GetClientRect(hWnd, &rc);
    MoveWindow(hwndStatus, 0, 0, rc.right - rc.left, status_height, TRUE);

    bar_width = (rc.right - rc.left) * BAR_WIN_WIDTH / 100;

    /* bar window is hidden unless in expand mode */
    if ((DisplayMode == MODE_EXPAND) && (picture_mode)) {
        MoveWindow(hwndBar, 0, status_height,
                   bar_width, rc.bottom - status_height, TRUE);
        MoveWindow(hwndRCD, bar_width, status_height,
                   (rc.right - rc.left) - bar_width,
                   rc.bottom - status_height, TRUE);
        ShowWindow(hwndBar, SW_SHOW);
    } else {
        MoveWindow(hwndRCD, 0, status_height, (rc.right - rc.left),
                   rc.bottom - status_height, TRUE);
        ShowWindow(hwndBar, SW_HIDE);
    }

}

void GetFontPref ( void )

Definition at line 1491 of file sdkdiff.cpp.

{
    DeleteObject(g_hFont);
    g_hFont = 0;

    GetProfileString(APPNAME, szFontFaceName, "FixedSys", g_szFontFaceName, sizeof(g_szFontFaceName));
    g_nFontHeight = GetProfileInt(APPNAME, szFontHeight, 12);
    g_fFontBold = GetProfileInt(APPNAME, szFontBold, FALSE);
    g_bFontCharSet = (BYTE)GetProfileInt(APPNAME, szFontCharSet, 0);

    g_hFont = CreateFont(g_nFontHeight, 0, 0, 0,
                         g_fFontBold ? FW_BOLD : FW_DONTCARE,
                         FALSE, FALSE, FALSE,
                         g_bFontCharSet,
                         OUT_DEFAULT_PRECIS,
                         CLIP_LH_ANGLES|CLIP_STROKE_PRECIS,
                         DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE,
                         g_szFontFaceName);
}

char* GetNextToken ( char * Tok )

Definition at line 1053 of file sdkdiff.cpp.

{
    static char * Source;     // The address of the original source string
                              // which gets progressively mangled

    static char RetBuff[512]; // We will build results in here
    static char *Ret;         // We build the results here (in RetBuff)
                              // but moved along each time.

    static char * p;       // the next char to parse in Source
                           // NULL if none left.
  HRESULT hr;

    // Quotes are a damned nuisance (they are the whole reason why strtok
    // wouldn't work).  If the string starts with quotes then we potentially
    // need to pull together fragments of the string "foo""ba"r => foobar
    // We want to pull these together into storage that we can safely write
    // into and return (can't be stack).  Mangling the original parameter
    // gets very messy so we cache a pointer to the original source that
    // we work through and we build up output tokens in a static
    // and therefore permanently wasted buffer of (arbitrarily) 512 bytes.
    // then we can set Ret to \0 and concatenate bits on as we find them.
    // The rule is that we split at the first space outside quotes.

    // cache the Source if a "first time" call.  Kill the "finished" case.
    if (Tok!=NULL) {
        Source = Tok;
        Ret = RetBuff;
        RetBuff[0] = '\0';
        p = Source;
    } else if (p==NULL) {
        return NULL;          // finished
    } else {
        Ret +=strlen(Ret)+1;  // slide it past last time's stuff
    }

    *Ret = '\0';              // empty string to concatenate onto

    // from here on Tok is used as a temporary.

    // keep taking sections and adding them to the start of Source
    for (; ; ) {

        // for each possibility we grow Ret and move p on.
        if (*p=='\"') {
            ++p;
            Tok = My_mbschr(p, '"');
            if (Tok==NULL) {
                hr = StringCchCat(Ret, 512, p);
        if (FAILED(hr)) {
          OutputError(hr, IDS_SAFE_CAT);
          return(NULL);
        }
                p = NULL;
                return Ret;
            } else {
                *Tok = '\0';    // split the section off, replaceing the "
                hr = StringCchCat(Ret, 512, p); // add it to the result
        if (FAILED(hr)) {
          OutputError(hr, IDS_SAFE_CAT);
          return (NULL);
        }
                p = Tok+1;      // move past the quote
            }
        } else {
            int i = (int)strcspn(p," \"");   // search for space or quote
            if (p[i]=='\0') {
                // It's fallen off the end
                hr = StringCchCat(Ret, 512, p);
        if (FAILED(hr)) {
          OutputError(hr, IDS_SAFE_CAT);
          return (NULL);
        }
                p = NULL;
                return Ret;
            } else if (p[i]==' ') {
                // We've hit a genuine delimiting space
                p[i] = '\0';
                hr = StringCchCat(Ret,512, p);
        if (FAILED(hr)) {
          OutputError(hr, IDS_SAFE_CAT);
          return (NULL);
        }
                p +=i+1;

                // strip trailing spaces (leading spaces for next time)
                while (*p==' ')
                    ++p;
                if (*p=='\0')
                    p = NULL;

                return Ret;
            } else {
                // we've hit a quote
                p[i] = '\0';
                hr = StringCchCat(Ret, 512, p);
        if (FAILED(hr)) {
          OutputError(hr, IDS_SAFE_CAT);
          return (NULL);
        }
                p[i] = '\"';     // put it back so that we can find it again
                p +=i;           // aim at it and iterate
            }
        }

    } // for

} // GetNextToken

BOOL InitApplication ( HINSTANCE hInstance )

Definition at line 662 of file sdkdiff.cpp.

{
    WNDCLASS    wc;
    BOOL resp;

    LCID lcid = GetThreadLocale();

    // set the boolean value for bJapan variable
    bJapan = (PRIMARYLANGID(LANGIDFROMLCID(lcid)) == LANG_JAPANESE);
    bDBCS = ((PRIMARYLANGID(LANGIDFROMLCID(lcid)) == LANG_JAPANESE) ||
             (PRIMARYLANGID(LANGIDFROMLCID(lcid)) == LANG_KOREAN)   ||
             (PRIMARYLANGID(LANGIDFROMLCID(lcid)) == LANG_CHINESE));

    /* register the bar window class */
    InitBarClass(hInstance);

    wc.style = 0;
    wc.lpfnWndProc = (WNDPROC)MainWndProc;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = 0;
    wc.hInstance = hInstance;
    wc.hIcon = LoadIcon(hInstance, szSdkDiff);
    wc.hCursor = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = NULL;
    wc.lpszClassName = (LPSTR) szSdkDiffViewerClass;
    wc.lpszMenuName = NULL;

    resp = RegisterClass(&wc);

    return(resp);
}

BOOL InitInstance | ( | HINSTANCE | hInstance,
 |  | int | nCmdShow
 | ) |  |

Definition at line 700 of file sdkdiff.cpp.

{
    RECT rect;
    HANDLE hstatus;
    int bar_width;
    RECT childrc;
    HIGHCONTRAST hc;

    hInst = hInstance;

    /* initialise the list package */
    List_Init();

    hMenu = LoadMenu(hInstance, szSdkDiffMenu);
    haccel = LoadAccelerators(hInstance, szSdkDiffAccel);

    /* create the main window */
    hwndClient = CreateWindow(szSdkDiffViewerClass,
                              szSdkDiff,
                              WS_OVERLAPPEDWINDOW,
                              CW_USEDEFAULT,
                              CW_USEDEFAULT,
                              CW_USEDEFAULT,
                              CW_USEDEFAULT,
                              NULL,
                              hMenu,
                              hInstance,
                              NULL
                             );

    if (!hwndClient) {
        return(FALSE);
    }

    /* create 3 child windows, one status, one table and one bar
     * Initially, the bar window is hidden and covered by the table.
     */

    /* create a status bar window as
     * a child of the main window.
     */

    /* build a status struct for two labels and an abort button */
    hstatus = StatusAlloc(3);
    StatusAddItem(hstatus, 0, SF_STATIC, SF_LEFT|SF_VAR|SF_SZMIN, IDL_STATLAB, 14, NULL);
    StatusAddItem(hstatus, 1, SF_BUTTON, SF_RIGHT|SF_RAISE, IDM_ABORT, 8,
                LoadRcString(IDS_EXIT));
    StatusAddItem(hstatus, 2, SF_STATIC, SF_LOWER|SF_LEFT|SF_VAR,
                  IDL_NAMES, 60, NULL);

    /* ask the status bar how high it should be for the controls
     * we have chosen, and save this value for re-sizing.
     */
    status_height = StatusHeight(hstatus);

    /* create a window of this height */
    GetClientRect(hwndClient, &rect);
    childrc = rect;
    childrc.bottom = status_height;
    hwndStatus = StatusCreate(hInst, hwndClient, IDC_STATUS, &childrc,
                              hstatus);

    /* layout constants are stated as percentages of the window width */
    bar_width = (rect.right - rect.left) * BAR_WIN_WIDTH / 100;

    /* create the table class covering all the remaining part of
     * the main window
     */
    hwndRCD = CreateWindow(TableClassName,
                           NULL,
                           WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL,
                           0,
                           status_height,
                           (int)(rect.right - rect.left),
                           (int)(rect.bottom - status_height),
                           hwndClient,
                           (HMENU) IDC_RCDISP1,
                           hInst,
                           NULL);

    /* create a bar window as a child of the main window.
     * this window remains hidden until we switch into MODE_EXPAND
     */
    hwndBar = CreateWindow(szBarClass,
                           NULL,
                           WS_CHILD | WS_VISIBLE,
                           0,
                           status_height,
                           bar_width,
                           (int)(rect.bottom - status_height),
                           hwndClient,
                           (HMENU) IDC_BAR,
                           hInst,
                           NULL);

    /* nMinMax indicates whether we are to be minimised on startup,
     * on command line parameters
     */
    ShowWindow(hwndBar, SW_HIDE);

    if (GetProfileInt(APPNAME, szOutlineSaved, 0)) {
        WINDOWPLACEMENT wp;
        /* restore the previous expanded size and position */
        wp.length = sizeof(wp);
        wp.flags                   = 0;
        wp.showCmd                 = GetProfileInt( APPNAME, szOutlineShowCmd,
                                                    SW_SHOWNORMAL);
        wp.ptMaxPosition.x         = GetProfileInt( APPNAME, szOutlineMaxX,       0);
        wp.ptMaxPosition.y         = GetProfileInt( APPNAME, szOutlineMaxY,       0);
        wp.rcNormalPosition.left   = (int)GetProfileInt( APPNAME, szOutlineNormLeft,  (UINT)(-1));
        wp.rcNormalPosition.top    = (int)GetProfileInt( APPNAME, szOutlineNormTop,   (UINT)(-1));
        wp.rcNormalPosition.right  = (int)GetProfileInt( APPNAME, szOutlineNormRight, (UINT)(-1));
        wp.rcNormalPosition.bottom = (int)GetProfileInt( APPNAME, szOutlineNormBottom,(UINT)(-1));

        if (!SetWindowPlacement(hwndClient,&wp)) {
            ShowWindow(hwndClient, nMinMax);
        }
    } else ShowWindow(hwndClient, nMinMax);

    /* initialise busy flag and status line to show we are idle
     * (ie not comparing or scanning)
     */
    SetNotBusy();

    /* initialise the colour globals */
    hc.cbSize = sizeof(hc);
    SystemParametersInfo(SPI_GETHIGHCONTRAST,0 ,&hc, 0);
    mono_colours = (hc.dwFlags & HCF_HIGHCONTRASTON);
    if (mono_colours) {
        SetMonoColours();
    } else {
        SetColours();
    }
    PostMessage(hwndClient, WM_SYSCOLORCHANGE, 0 , 0);
    UpdateWindow(hwndClient);

    return(TRUE);

} /* InitInstance */

BOOL IsBusy ( )

Definition at line 2632 of file sdkdiff.cpp.

{
    BOOL bOK;

    WDEnter();
    bOK = fBusy;
    WDLeave();
    return(bOK);
} /* IsBusy */

LPTSTR APIENTRY LoadRcString ( UINT wID )

Definition at line 4807 of file sdkdiff.cpp.

{
    static TCHAR szBuf[512];

    LoadString((HINSTANCE)GetModuleHandle(NULL),wID,szBuf,sizeof(szBuf));
    return szBuf;
}

LRESULT CALLBACK MainWndProc | ( | HWND | hWnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 3333 of file sdkdiff.cpp.

{
    char str[32];
    long ret;
    DWORD threadid;
  HRESULT hr;

    switch (message) {

        case WM_CREATE:

            /* initialise menu options to default/saved
             * option settings
             */

#define CHECKMENU(id, fChecked)  \
          CheckMenuItem(hMenu, (id), (fChecked) ? MF_CHECKED:MF_UNCHECKED)

            /* outline_include options */
            CHECKMENU(IDM_OUTLINE_INCSAME,   (outline_include & INCLUDE_SAME));
            CHECKMENU(IDM_OUTLINE_INCLEFT,   (outline_include & INCLUDE_LEFTONLY));
            CHECKMENU(IDM_OUTLINE_INCRIGHT,  (outline_include & INCLUDE_RIGHTONLY));
            CHECKMENU(IDM_OUTLINE_INCDIFFER, (outline_include & INCLUDE_DIFFER));

            /* expand_include options */
            CHECKMENU(IDM_EXPAND_INCSAME,         (expand_include & INCLUDE_SAME));
            CHECKMENU(IDM_EXPAND_INCLEFT,         (expand_include & INCLUDE_LEFTONLY));
            CHECKMENU(IDM_EXPAND_INCRIGHT,        (expand_include & INCLUDE_RIGHTONLY));
            CHECKMENU(IDM_EXPAND_INCMOVEDLEFT,    (expand_include & INCLUDE_MOVEDLEFT));
            CHECKMENU(IDM_EXPAND_INCMOVEDRIGHT,   (expand_include & INCLUDE_MOVEDRIGHT));
            CHECKMENU(IDM_EXPAND_INCSIMILARLEFT,  (expand_include & INCLUDE_SIMILARLEFT));
            CHECKMENU(IDM_EXPAND_INCSIMILARRIGHT, (expand_include & INCLUDE_SIMILARRIGHT));

            /* other options */
            CHECKMENU(line_numbers, TRUE);
            CHECKMENU(expand_mode, TRUE);
            CHECKMENU(IDM_IGNBLANKS, ignore_blanks);
            CHECKMENU(IDM_SHOWWHITESPACE, show_whitespace);
            CHECKMENU(IDM_ALG2, Algorithm2);
            CHECKMENU(IDM_MONOCOLS, mono_colours);
            CHECKMENU(IDM_PICTURE, picture_mode);
            CHECKMENU(IDM_HIDEMARK, hide_markedfiles);
#undef CHECKMENU

            /* nothing currently displayed */
            DisplayMode = MODE_NULL;

            break;

        case WM_SYSCOLORCHANGE:
            {
                HIGHCONTRAST hc;

                hc.cbSize = sizeof(hc);
                SystemParametersInfo(SPI_GETHIGHCONTRAST,0 ,&hc, 0);

                mono_colours = (hc.dwFlags & HCF_HIGHCONTRASTON);
                if (mono_colours) {
                    SetMonoColours();
                } else {
                    SetColours();
                }

                CheckMenuItem(hMenu, IDM_MONOCOLS,
                              mono_colours? MF_CHECKED:MF_UNCHECKED);
                hr = StringCchPrintf(str, 32, szD, mono_colours);
        if (FAILED(hr))
          OutputError(hr, IDS_SAFE_PRINTF);
                WriteProfileString(APPNAME, szMonoColours, str);
                SendMessage(hwndRCD, message, wParam, lParam);
                SendMessage(hwndStatus, message, wParam, lParam);
                SendMessage(hwndBar, message, wParam, lParam);

                /* The diffs are still valid, but force a re-display
                 * of bar window and main table.
                 */
                SendMessage(hwndBar, WM_COMMAND, IDM_MONOCOLS, 0);
                InvalidateRect(hwndBar, NULL, TRUE);
                view_changeviewoptions(current_view);
            }
            break;

        case WM_COMMAND:
            switch (GET_WM_COMMAND_ID(wParam, lParam)) {
                case IDM_EXIT:
                    if (ghThread!=NULL) {
                        bAbort = TRUE;
                        SetStatus(LoadRcString(IDS_ABORT_PENDING));
                        break;
                    }
                    if (!view_isexpanded(current_view)) {
                        /* save the current outline size and position */
                        WINDOWPLACEMENT wp;
                        wp.length = sizeof(wp);
                        if (GetWindowPlacement(hwndClient,&wp)) {
                            WriteProfileInt(APPNAME, szOutlineShowCmd, wp.showCmd);
                            WriteProfileInt(APPNAME, szOutlineMaxX, wp.ptMaxPosition.x);
                            WriteProfileInt(APPNAME, szOutlineMaxY, wp.ptMaxPosition.y);
                            WriteProfileInt(APPNAME, szOutlineNormLeft, wp.rcNormalPosition.left);
                            WriteProfileInt(APPNAME, szOutlineNormTop, wp.rcNormalPosition.top);
                            WriteProfileInt(APPNAME, szOutlineNormRight, wp.rcNormalPosition.right);
                            WriteProfileInt(APPNAME, szOutlineNormBottom, wp.rcNormalPosition.bottom);
                            WriteProfileInt(APPNAME, szOutlineSaved, 1);
                        }
                    } else {
                        /* save the current expanded size and position */
                        WINDOWPLACEMENT wp;
                        wp.length = sizeof(wp);
                        if (GetWindowPlacement(hwndClient,&wp)) {
                            WriteProfileInt(APPNAME, szExpandShowCmd, wp.showCmd);
                            WriteProfileInt(APPNAME, szExpandMaxX, wp.ptMaxPosition.x);
                            WriteProfileInt(APPNAME, szExpandMaxY, wp.ptMaxPosition.y);
                            WriteProfileInt(APPNAME, szExpandNormLeft, wp.rcNormalPosition.left);
                            WriteProfileInt(APPNAME, szExpandNormTop, wp.rcNormalPosition.top);
                            WriteProfileInt(APPNAME, szExpandNormRight, wp.rcNormalPosition.right);
                            WriteProfileInt(APPNAME, szExpandNormBottom, wp.rcNormalPosition.bottom);
                            WriteProfileInt(APPNAME, szExpandedSaved, 1);
                        }
                    }
                    DestroyWindow(hWnd);
                    break;

                case IDM_ABORT:
                    /* abort menu item, or status bar button.
                     * the status bar button text gives the appropriate
                     * action depending on our state - abort, outline
                     * or expand. But the command sent is always
                     * IDM_ABORT. Thus we need to check the state
                     * to see what to do. If we are busy, set the abort
                     * flag. If there is nothing to view,
                     * exit, otherwise switch outline<->expand
                     */
                    if (IsBusy()) {
                        bAbort = TRUE;
                        SetStatus(LoadRcString(IDS_ABORT_PENDING));
                    } else if (DisplayMode == MODE_NULL) {
                        DestroyWindow(hWnd);
                    } else if (DisplayMode == MODE_EXPAND) {
                        ToOutline(hWnd);
                    } else {
                        ToExpand(hWnd);
                    }
                    break;

                case IDM_FILE:
                    /* select two files and compare them */
                    if (SetBusy()) {

                        /* close the current view */
                        view_close(current_view);

                        /* make a new empty view */
                        current_view = view_new(hwndRCD);

                        /* make a COMPLIST using the files dialog,
                         * and notify the view
                         */
                        if (complist_filedialog(current_view) == NULL) {
                            view_close(current_view);
                        }

                        /* all done! */
                        SetNotBusy();
                    } else {
                        BusyError();
                    }
                    break;

                case IDM_DIR:

                    /* read two directory names, scan them and
                     * compare all the files and subdirs.
                     */
                    if (SetBusy()) {

                        /* close the current view */
                        view_close(current_view);

                        /* make a new empty view */
                        current_view = view_new(hwndRCD);

                        ghThread = CreateThread(NULL, 0, wd_dirdialog,
                                                (LPVOID) current_view, 0, &threadid);

                        if (ghThread == NULL)
                        {

                            /*
                             * either we are on WIN16, or the
                             * thread call failed. continue
                             * single-threaded.
                             */
                            wd_dirdialog( (LPVOID) current_view);

                        }

                    } else {
                        BusyError();
                    }
                    break;

                case IDM_CLOSE:
                    /* close the output list -
                     * discard all results so far
                     */
                    if (!IsBusy()) {
                        view_close(current_view);
                    }
                    break;

                case IDM_PRINT:
                    /* print the current view -
                     * either the outline list of filenames,
                     * or the currently expanded file.
                     */
                    if (!IsBusy()) {
                        DoPrint();
                    } else {
                        BusyError();
                    }
                    break;

                case IDM_TIME:
                    /* show time it took */
                    {       char msg[50];
                        DWORD tim;
                        if (IsBusy()) {
                            BusyError();
                        } else {
                            tim = complist_querytime();
                            hr = StringCchPrintf(msg, 50, LoadRcString(IDS_SECONDS), tim/1000, tim%1000);
              if (FAILED(hr))
                OutputError(hr, IDS_SAFE_PRINTF);
                            Trace_Status(msg);
                        }
                    }
                    break;

                case IDM_TRACE:
                    /* enable tracing */
                    bTrace = TRUE;
                    Trace_Status(LoadRcString(IDS_TRACING_ENABLED));
                    break;

                case IDM_TRACEOFF:
                    /* enable tracing */
                    bTrace = FALSE;
                    Trace_Status(LoadRcString(IDS_TRACING_DISABLED));
                    break;

                case IDM_SAVELIST:
                    /* allow user to save list of same/different files
                     * to a text file. dialog box to give filename
                     * and select which types of file to include
                     */
                    if (current_view == NULL) {
                        MessageBox(hWnd,
                                   LoadRcString(IDS_CREATE_DIFF_LIST),
                                   szSdkDiff, MB_OK|MB_ICONSTOP);
                        break;
                    }

                    complist_savelist(view_getcomplist(current_view), NULL, outline_include);
                    break;

                case IDM_COPYFILES:
                    /*
                     * copy files that are same/different to a new
                     * root directory. dialog box allows user
                     * to select new root and inclusion options
                     */
                    if (current_view == NULL) {
                        MessageBox(hWnd,
                                   LoadRcString(IDS_CREATE_DIFF_LIST),
                                   szSdkDiff, MB_OK|MB_ICONSTOP);
                        break;
                    }

                    if (SetBusy()) {
                        ghThread = CreateThread(NULL, 0, wd_copy,
                                                (LPVOID) current_view, 0, &threadid);
                        if (ghThread == NULL)
                        {
                            wd_copy( (LPVOID) current_view);
                        }

                    } else {
                        BusyError();
                    }

                    break;

                case IDM_ABOUT:
                    ShellAbout( hWnd,
                                (LPTSTR)szSdkDiff,
                                LoadRcString(IDS_TOOL_DESCRIPTION),
                                LoadIcon(hInst, szSdkDiff)
                              );
                    break;

                case IDM_CONTENTS:
                    /* Help contents */
          TCHAR pszHelp[MAX_PATH];
          memset(pszHelp, 0, MAX_PATH);
          hr = StringCchCopy(pszHelp, MAX_PATH, pszWorkingDirectoryName);
          if (FAILED(hr))
            OutputError(hr, IDS_SAFE_COPY);
          hr = StringCchCat(pszHelp, MAX_PATH, "sdkdiff.hlp");
          if (FAILED(hr))
            OutputError(hr, IDS_SAFE_CAT);
          WinHelp(hWnd, pszHelp, HELP_INDEX, 0);
                    break;

                    /* launch an editor on the current item - left, right or
                     * composite view
                     */
                case IDM_EDITLEFT:
                    do_editthread(current_view, CI_LEFT);
                    break;

                case IDM_EDITRIGHT:
                    do_editthread(current_view, CI_RIGHT);
                    break;

                case IDM_EDITCOMP:
                    {
                        COMPITEM item = view_getitem(current_view, selection);
                        FILEDATA fdLeft;
                        FILEDATA fdRight;

                        fdLeft = compitem_getleftfile(item);
                        fdRight = compitem_getrightfile(item);
                        if ((fdLeft && file_IsUnicode(fdLeft)) || (fdRight && file_IsUnicode(fdRight))) {
                            MessageBox(hWnd, LoadRcString(IDS_NOCOMPUNICODE),
                                       szSdkDiff, MB_OK);
                        } else {
                            do_editthread(current_view, CI_COMP);
                        }
                    }
                    break;

                    /* allow customisation of the editor command line */
                case IDM_SETEDIT:
                    if (StringInput(editor_cmdline, sizeof(editor_cmdline),
                                    LoadRcString(IDS_EDITOR_COMMAND),
                                    (LPSTR)szSdkDiff, editor_cmdline)) {
                        WriteProfileString(APPNAME, szEditor,
                                           editor_cmdline);
                    }
                    break;

                case IDM_SETTABWIDTH:
                    {
                        char sz[32];
                        int n;

LTabWidth_tryagain:
                        hr = StringCchPrintf(sz, 32, "%d", g_tabwidth);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        if (StringInput(sz, sizeof(sz),
                                        LoadRcString(IDS_TABWIDTH),
                                        (LPSTR)szSdkDiff, sz))
                        {
                            n = atoi(sz);
                            if (n <= 0 || n > 100)
                            {
                                MessageBox(hWnd,
                                           LoadRcString(IDS_BAD_TABWIDTH),
                                           szSdkDiff, MB_OK);
                                goto LTabWidth_tryagain;
                            }
                            WriteProfileInt(APPNAME, szTabWidth, n);
                            g_tabwidth = n;
                            SendMessage(hwndRCD, TM_SETTABWIDTH, 0, n);
                        }
                    }
                    break;

                case IDM_TABWIDTH4:
                case IDM_TABWIDTH8:
                    g_tabwidth = (GET_WM_COMMAND_ID(wParam, lParam) == IDM_TABWIDTH8) ? 8 : 4;
                    SendMessage(hwndRCD, TM_SETTABWIDTH, 0, g_tabwidth);
                    break;

                case IDM_SETFONT:
                    {
                        CHOOSEFONT cf;
                        LOGFONT lf;
                        char szFace[LF_FACESIZE];

                        hr = StringCchCopy(szFace, LF_FACESIZE, g_szFontFaceName);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_COPY);

                        memset(&lf, 0, sizeof(lf));
                        hr = StringCchCopy(lf.lfFaceName, LF_FACESIZE, szFace);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_COPY);
                        lf.lfWeight = g_fFontBold ? FW_BOLD : FW_DONTCARE;
                        lf.lfHeight = g_nFontHeight;
                        lf.lfCharSet = g_bFontCharSet;

                        memset(&cf, 0, sizeof(cf));
                        cf.lStructSize = sizeof(CHOOSEFONT);
                        cf.hwndOwner = hWnd;
                        cf.lpLogFont = &lf;
                        cf.Flags = CF_INITTOLOGFONTSTRUCT|CF_FORCEFONTEXIST|
                                CF_SCREENFONTS|CF_LIMITSIZE;
                        cf.nSizeMin = 8;
                        cf.nSizeMax = 36;
                        cf.lpszStyle = szFace;
                        if (ChooseFont(&cf))
                            {
                            hr = StringCchCopy(g_szFontFaceName, LF_FACESIZE, lf.lfFaceName);
              if (FAILED(hr))
                OutputError(hr, IDS_SAFE_COPY);
                            g_fFontBold = (lf.lfWeight == FW_BOLD);
                            g_nFontHeight = lf.lfHeight;
                            g_bFontCharSet = lf.lfCharSet;

                            WriteProfileString(APPNAME, szFontFaceName, g_szFontFaceName);
                            WriteProfileInt(APPNAME, szFontHeight, g_nFontHeight);
                            WriteProfileInt(APPNAME, szFontBold, g_fFontBold);
                            WriteProfileInt(APPNAME, szFontCharSet, g_bFontCharSet);

                            GetFontPref();

                            view_changeviewoptions(current_view);
                            }
                    }
                    break;

                case IDM_LNRS:
                case IDM_RNRS:
                case IDM_NONRS:

                    /* option selects whether the line nrs displayed
                     * in expand mode are the line nrs in the left
                     * file, the right file or none
                     */

                    CheckMenuItem(GetMenu(hWnd),
                                  line_numbers, MF_UNCHECKED);
                    line_numbers = GET_WM_COMMAND_ID(wParam, lParam);
                    CheckMenuItem(GetMenu(hWnd), line_numbers, MF_CHECKED);
                    hr = StringCchPrintf(str, 32, szD, line_numbers);
          if (FAILED(hr))
            OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szLineNumbers, str);

                    /* change the display to show the line nr style
                     * chosen
                     */

                    view_changeviewoptions(current_view);
                    break;

                /*
                 * options selecting which lines to include in the
                 * expand listing, based on their state
                 */
                case IDM_EXPAND_INCSAME:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_SAME;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCSAME,
                              (expand_include & INCLUDE_SAME) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCLEFT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_LEFTONLY;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCLEFT,
                              (expand_include & INCLUDE_LEFTONLY) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCRIGHT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_RIGHTONLY;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCRIGHT,
                              (expand_include & INCLUDE_RIGHTONLY) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCMOVEDLEFT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_MOVEDLEFT;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCMOVEDLEFT,
                              (expand_include & INCLUDE_MOVEDLEFT) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCMOVEDRIGHT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_MOVEDRIGHT;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCMOVEDRIGHT,
                              (expand_include & INCLUDE_MOVEDRIGHT) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCSIMILARLEFT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_SIMILARLEFT;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCSIMILARLEFT,
                              (expand_include & INCLUDE_SIMILARLEFT) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCSIMILARRIGHT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_SIMILARRIGHT;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCSIMILARRIGHT,
                              (expand_include & INCLUDE_SIMILARRIGHT) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                    /*
                     * options selecting which files to include in the
                     * outline listing, based on their state
                     */
                case IDM_OUTLINE_INCLEFT:

                    /* toggle flag in outline_include options */
                    outline_include ^= INCLUDE_LEFTONLY;

                    /* check/uncheck as necessary */
                    CheckMenuItem(hMenu, IDM_OUTLINE_INCLEFT,
                                  (outline_include & INCLUDE_LEFTONLY) ?
                                  MF_CHECKED:MF_UNCHECKED);

                    hr = StringCchPrintf(str, 32, szD, outline_include);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szFileInclude, str);
                    view_changeviewoptions(current_view);

                    break;

                case IDM_OUTLINE_INCRIGHT:

                    outline_include ^= INCLUDE_RIGHTONLY;

                    CheckMenuItem(hMenu, IDM_OUTLINE_INCRIGHT,
                                  (outline_include & INCLUDE_RIGHTONLY) ?
                                  MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, outline_include);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szFileInclude, str);
                    view_changeviewoptions(current_view);

                    break;

                case IDM_OUTLINE_INCSAME:

                    outline_include ^= INCLUDE_SAME;

                    CheckMenuItem(hMenu, IDM_OUTLINE_INCSAME,
                                  (outline_include & INCLUDE_SAME) ?
                                  MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, outline_include);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szFileInclude, str);
                    view_changeviewoptions(current_view);

                    break;

                case IDM_OUTLINE_INCDIFFER:

                    outline_include ^= INCLUDE_DIFFER;

                    CheckMenuItem(hMenu, IDM_OUTLINE_INCDIFFER,
                                  (outline_include & INCLUDE_DIFFER) ?
                                  MF_CHECKED:MF_UNCHECKED);

                    hr = StringCchPrintf(str, 32, szD, outline_include);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szFileInclude, str);
                    view_changeviewoptions(current_view);

                    break;

                case IDM_UPDATE:
                    OnUpdate( (COMPITEM) lParam);
                    break;

                case IDM_RESCAN:
                    RescanFile(hWnd);

                    /* do we need to force any repaints? */
                    // - no, as RescanFile sends a IDM_UPDATE
                    break;

                case IDM_LONLY:
                case IDM_RONLY:
                case IDM_BOTHFILES:
                    /* option selects whether the expanded file
                     * show is the combined file, or just one
                     * or other of the input files.
                     *
                     * if we are not in expand mode, this also
                     * causes us to expand the selection
                     */

                    CheckMenuItem(GetMenu(hWnd), expand_mode, MF_UNCHECKED);
                    expand_mode = GET_WM_COMMAND_ID(wParam, lParam);
                    CheckMenuItem(GetMenu(hWnd), expand_mode, MF_CHECKED);

                    /* change the current view to show only the lines
                     * of the selected type.
                     */
                    if (DisplayMode == MODE_OUTLINE) {
                        ToExpand(hWnd);
                    } else {
                        view_changeviewoptions(current_view);
                    }

                    break;

                case IDM_IGNBLANKS:

                    /* if selected, ignore all spaces and tabs on
                     * comparison - expand view only: outline view
                     * will still show that 'text files differ'
                     */

                    ignore_blanks = !ignore_blanks;
                    CheckMenuItem(hMenu, IDM_IGNBLANKS,
                                  ignore_blanks? MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, ignore_blanks);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szBlanks, str);

                    /* invalidate all diffs since we have
                     * changed diff options, and re-do and display the
                     * current diff if we are in expand mode.
                     */
                    view_changediffoptions(current_view);

                    /* force repaint of bar window */
                    InvalidateRect(hwndBar, NULL, TRUE);

                    break;

                case IDM_SHOWWHITESPACE:

                        /* if selected, display all spaces and tabs in
                           the expanded text view */
                        show_whitespace = !show_whitespace;
                        CheckMenuItem(hMenu, IDM_SHOWWHITESPACE,
                                show_whitespace ? MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, show_whitespace);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szShowWhitespace, str);

                        // change the current view to show only the lines
                        // of the selected type.
                        if (DisplayMode == MODE_EXPAND) {
                                view_changeviewoptions(current_view);
                        }

                        break;

                case IDM_ALG2:

                    /* if selected, do algorithm2 which does not accept
                     * unsafe matches.
                     */

                    Algorithm2 = !Algorithm2;
                    CheckMenuItem(hMenu, IDM_ALG2,
                                  Algorithm2? MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, Algorithm2);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szAlgorithm2, str);

                    /* invalidate all diffs since we have
                     * changed diff options, and re-do and display the
                     * current diff if we are in expand mode.
                     */
                    view_changediffoptions(current_view);

                    /* force repaint of bar window */
                    InvalidateRect(hwndBar, NULL, TRUE);

                    break;

                case IDM_MONOCOLS:

                    /* Use monochrome colours - toggle */

                    mono_colours = !mono_colours;
                    CheckMenuItem(hMenu, IDM_MONOCOLS,
                                  mono_colours? MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, mono_colours);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szMonoColours, str);
                    if (mono_colours)
                        SetMonoColours();
                    else
                        SetColours();

                    /* The diffs are still valid, but force a re-display
                     * of bar window and main table.
                     */
                    SendMessage(hwndBar, WM_COMMAND, IDM_MONOCOLS, 0);
                    InvalidateRect(hwndBar, NULL, TRUE);
                    view_changeviewoptions(current_view);

                    break;

                case IDM_PICTURE:
                    picture_mode = !picture_mode;
                    CheckMenuItem(hMenu, IDM_PICTURE,
                                  picture_mode? MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, picture_mode);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szPicture, str);
                    DoResize(hWnd);
                    break;

                case IDM_HIDEMARK:
                    // toggle state of marked files hidden or not
                    hide_markedfiles = !hide_markedfiles;
                    CheckMenuItem(hMenu, IDM_HIDEMARK,
                                  hide_markedfiles? MF_CHECKED : MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, hide_markedfiles);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szHideMark, str);

                    // rebuild view with new global option
                    // - note that marks only affect outline views
                    if (!view_isexpanded(current_view)) {
                        view_changeviewoptions(current_view);
                    }
                    break;

                case IDM_FIND:
                  {
                  int nRet = IDCANCEL;
                  DLGPROC lpProc = (DLGPROC) MakeProcInstance((WINPROCTYPE) FindDlgProc, hInst);
                  if (lpProc)
                    {
                    char *pszFind = NULL;
                    sdkdiff_UI(TRUE);
                    nRet = (BOOL) DialogBoxParam(hInst, (LPCTSTR) IDD_FIND, hwndClient, lpProc, 0L);
                    sdkdiff_UI(FALSE);
                    FreeProcInstance(lpProc);
                    }
                  }
                  break;

                case IDM_FINDNEXT:
                  {
                  const LONG iCol = (view_isexpanded(current_view)) ? 2 : 1;
                  FindString(hWnd, iCol, NULL, 1, 0);
                  break;
                  }

                case IDM_FINDPREV:
                  {
                  const LONG iCol = (view_isexpanded(current_view)) ? 2 : 1;
                  FindString(hWnd, iCol, NULL, -1, 0);
                  break;
                  }

                case IDM_GOTOLINE:
                  {
                  if (!view_getrowcount(current_view))
                    {
                    MessageBox(hWnd, LoadRcString(IDS_GOTOLINE_NOLINES), szSdkDiff, MB_OK|MB_ICONSTOP|MB_TASKMODAL);
                    }
                  else
                    {
                    DLGPROC lpProc = (DLGPROC) MakeProcInstance((WINPROCTYPE)GoToLineDlgProc, hInst);
                    if (lpProc)
                      {
                      sdkdiff_UI(TRUE);
                      DialogBoxParam(hInst, (LPCTSTR) IDD_GOTOLINE, hwndClient, lpProc, 0L);
                      sdkdiff_UI(FALSE);
                      FreeProcInstance(lpProc);
                      }
                    }
                  }
                  break;

                case IDM_EDITCOPY:
                    {
                        unsigned long cb = 0;
                        LPCSTR pszText = NULL;
                        long iRow = 0;
                        const BOOL fOutline = !view_isexpanded(current_view);

                        /* first count total data size */
                        for (iRow = 0; iRow < selection_nrows; iRow++) {
                            if (fOutline) {
                                pszText = view_gettext(current_view, selection + iRow, 1);
                                if (!pszText)
                                    break;
                                cb += (lstrlen(pszText) + 3) * sizeof(char);
                            }

                            pszText = view_gettext(current_view, selection + iRow, 2);
                            if (!pszText)
                                break;
                            cb += (lstrlen(pszText)) * sizeof(char);
                        }

                        if (cb && OpenClipboard(NULL)) {
                            /* space for trailing nul char */
                            cb++;

                            /* copy data to clipboard */
                            if (EmptyClipboard()) {
                                HGLOBAL hData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,  cb);

                                if (hData) {
                                    void *pv = hData;
                                    if (!pv) {
                                        HeapFree(GetProcessHeap(), NULL, hData);
                                    }
                                    else {
                                        LPSTR pszBuf = (LPSTR) pv;
                                        memset(pv, 0, cb);

                                        for (iRow = 0; iRow < selection_nrows; iRow++) {
                                            if (fOutline) {
                                                pszText = view_gettext(current_view, selection + iRow, 1);
                                                if (!pszText)
                                                    break;

                                                hr = StringCchCopy(pszBuf, cb, pszText);
                        if (FAILED(hr))
                          OutputError(hr, IDS_SAFE_COPY);
                                                pszBuf += lstrlen(pszBuf);
                                                *(pszBuf++) = '\t';
                                                *pszBuf = 0;
                                            }

                                            pszText = view_gettext(current_view, selection + iRow, 2);
                                            if (!pszText)
                                                break;

                                            hr = StringCchCopy(pszBuf, cb, pszText);
                      if (FAILED(hr))
                        OutputError(hr, IDS_SAFE_COPY);
                                            pszBuf += lstrlen(pszBuf);

                                            if (fOutline) {
                                                *(pszBuf++) = '\r';
                                                *(pszBuf++) = '\n';
                                                *pszBuf = 0;
                                            }
                                        }

                                        SetClipboardData(CF_TEXT, hData);
                                    }
                                }
                            }
                            CloseClipboard();
                        }
                    }
                    break;

                case IDM_MARK:
                    {
                        BOOL bChanged = FALSE;
                        int i;

                        // toggle the mark on the current selection
                        // note that the selection could be multiple rows
                        for (i = 0; i < selection_nrows; i++) {

                            if (view_setmarkstate(current_view, selection + i,
                                                  !view_getmarkstate(current_view, selection + i))) {

                                bChanged = TRUE;
                            }
                        }

                        if (bChanged) {
                            // yes the mark state was changed - need
                            // to rebuild the view.
                            if (!view_isexpanded(current_view)) {
                                view_changeviewoptions(current_view);
                            }
                        }
                        break;
                    }

                case IDM_TOGGLEMARK:
                    // toggle the state of all files: unmark all
                    // marked files and vice versa
                    complist_togglemark(view_getcomplist(current_view));

                    // rebuild view
                    if (!view_isexpanded(current_view)) {
                        view_changeviewoptions(current_view);
                    }
                    break;

                case IDM_MARKPATTERN:
                    // dialog to query the pattern, then set a mark on
                    // all compitems whose title matches that pattern
                    // returns TRUE if anything was changed
                    if (complist_markpattern(view_getcomplist(current_view))) {

                        // rebuild view
                        if (!view_isexpanded(current_view)) {
                            view_changeviewoptions(current_view);
                        }
                    }
                    break;

                case IDM_EXPAND:

                    /* show the expanded view of the
                     * selected file
                     */
                    if (current_view != NULL) {
                        ToExpand(hWnd);
                    }

                    break;

                case IDM_OUTLINE:
                    /* return to the outline view (list of filenames) */
                    ToOutline(hWnd);

                    break;

                case IDM_FCHANGE:
                    /* find the next line in the current view
                     * that is not the same in both files -
                     * in outline view, finds the next filename that
                     * is not identical
                     */
                    FindNextChange();
                    break;

                case IDM_FPCHANGE:
                    /* same as IDM_FCHANGE, but going backwards from
                     * current position
                     */
                    FindPrevChange();
                    break;

                case IDM_FCHANGE_LAURIE:
                    /* same as IDM_FCHANGE, but tries to keep cursor on same
                     * line.
                     */
                    _FindNextChange(TRUE, FALSE);
                    break;

                case IDM_FPCHANGE_LAURIE:
                    /* same as IDM_FPCHANGE, but tries to keep cursor on same
                     * line.
                     */
                    _FindPrevChange(TRUE, FALSE);
                    break;

                    // given a line that has been moved, jump to the
                    // other representation of the same line.
                    // this used to be available just through double-click
                    // but now is also available from a context menu
                case IDM_TOMOVED:
                    ToMoved(hWnd, TRUE);
                    break;
            }
            break;

        case WM_SIZE:
            DoResize(hWnd);
            break;

        case WM_SETFOCUS:
            /* set the focus on the table class so it can process
             * page-up /pagedown keys etc.
             */
            SetFocus(hwndRCD);
            break;

        case WM_KEYDOWN:
            /* although the table window has the focus, he passes
             * back to us any keys he doesn't understand
             * We handle escape here to mean 'return to outline view'
             */
            if (wParam == VK_ESCAPE) {
                ToOutline(hWnd);
            } else if (wParam == VK_APPS) {
                // Handle the context menu keyboard key
                POINT posCursor;
                GetCursorPos(&posCursor);
                ScreenToClient(hwndRCD, &posCursor);
                OnRightClick(hWnd, posCursor.x, posCursor.y);
            }
            break;

        case WM_RBUTTONDOWN:
            /*
             * the table window handles this by performing the
             * selection and then passing the message to us, allowing
             * us to put up a context menu.
             */
            OnRightClick(hWnd, LOWORD(lParam), HIWORD(lParam));
            break;

        case WM_CLOSE:
            SendMessage(hWnd, WM_COMMAND, IDM_EXIT, 0);
            return TRUE;

            /* don't allow close when busy - process this message in
             * order to ensure this
             */
            break;

        case WM_DESTROY:
      TCHAR pszHelp[MAX_PATH];
      memset(pszHelp, 0, MAX_PATH);
      hr = StringCchCopy(pszHelp, MAX_PATH, pszWorkingDirectoryName);
      if (FAILED(hr))
        OutputError(hr, IDS_SAFE_COPY);
      hr = StringCchCat(pszHelp, MAX_PATH, "sdkdiff.hlp");
      if (FAILED(hr))
        OutputError(hr, IDS_SAFE_COPY);
            DeleteTools();
            WinHelp(hWnd, pszHelp, HELP_QUIT, 0);
            PostQuitMessage(0);
            break;

        case TM_CURRENTVIEW:
            /* allow other people such as the bar window to query the
             * current view
             */
            return((INT_PTR) current_view);

#ifdef LATER
#ifdef WM_MOUSEWHEEL
        case WM_MOUSEWHEEL:
            if (LOWORD(wParam) & MK_MBUTTON) {
                if ((short)HIWORD(wParam) < 0) {
                    // The next occurence
                    _FindNextChange(FALSE, TRUE);
                }
                else {
                    _FindPrevChange(FALSE, TRUE);
                }
            }
            break;
#endif
#endif

        case WM_QUERYENDSESSION:
            if (IsBusy())
                return FALSE;
            return TRUE;

        case WM_ENDSESSION:
            SendMessage(hWnd, WM_CLOSE, 0, 0);
            break;

        default:
            /* handle registered table messages */
            if (message == table_msgcode) {
                ret = TableServer(hWnd, wParam, lParam);
                return(ret);
            }
            return(DefWindowProc(hWnd, message, wParam, lParam));
    }
    return(0);
}

LPSTR My_mbschr | ( | LPCSTR | psz,
 |  | unsigned short | uiSep
 | ) |  |

Definition at line 4630 of file sdkdiff.cpp.

{
    while (*psz != '\0' && *psz != uiSep) {
        psz = CharNext(psz);
    }
    return (LPSTR)(*psz == uiSep ? psz : NULL);
}

PUCHAR My_mbsistr | ( | PUCHAR | str1,
 |  | PUCHAR | str2,
 |  | PUCHAR * | pstrEnd
 | ) |  |

Definition at line 4575 of file sdkdiff.cpp.

{
  PUCHAR cp = (PUCHAR) str1;
  PUCHAR s1, s2;

  if (!*str2)
    return ((PUCHAR) str1);

  while (*cp)
    {
    s1 = cp;
    s2 = (PUCHAR) str2;

    while (*s1 && *s2)
      {
      if (IsDBCSLeadByte(*s1))
        {
        if ((*s1 - *s2) || (++(*s1) - ++(*s2)))
          break;
        }
      else if (toupper(*s1) - toupper(*s2))
        {
        break;
        }

      s1++;
      s2++;
      }

    if (!*s2)
      {
      if (pstrEnd)
        *pstrEnd = s1;
      return cp;
      }

    cp = (PUCHAR)CharNext((LPCSTR)cp);
    }

  return NULL;
}

int My_mbsncmp | ( | LPCSTR | psz1,
 |  | LPCSTR | psz2,
 |  | size_t | nLen
 | ) |  |

Definition at line 4723 of file sdkdiff.cpp.

{
    int Length = (int)nLen;

    while (0 < Length) {
        if ('\0' == *psz1 || '\0' == *psz2) {
            return *psz1 - *psz2;
        }
        if (IsDBCSLeadByte(*psz1) || IsDBCSLeadByte(*psz2)) {
            if (*psz1 != *psz2 || *(psz1+1) != *(psz2+1)) {
                return *psz1 - *psz2;
            }
            psz1 += 2;
            psz2 += 2;
            Length -= 2;
        } else {
            if (*psz1 != *psz2) {
                return *psz1 - *psz2;
            }
            psz1++;
            psz2++;
            Length--;
        }
    }
    return 0;
}

LPSTR My_mbsncpy | ( | LPSTR | psz1,
 |  | LPCSTR | psz2,
 |  | size_t | nLen
 | ) |  |

Definition at line 4650 of file sdkdiff.cpp.

{
    LPSTR pszSv = psz1;
    int Length = (int)nLen;

    while (0 < Length) {
        if (*psz2 == '\0') {
            *psz1++ = '\0';
            Length--;
        } else if (IsDBCSLeadByte(*psz2)) {
            if (Length == 1) {
                *psz1 = '\0';
            } else {
                *psz1++ = *psz2++;
                *psz1++ = *psz2++;
            }
            Length -= 2;
        } else {
            *psz1++ = *psz2++;
            Length--;
        }
    }
    return pszSv;
}

int My_mbsnicmp | ( | PUCHAR | psz1,
 |  | PUCHAR | psz2,
 |  | size_t | nLen
 | ) |  |

Definition at line 4764 of file sdkdiff.cpp.

{
    int Length = (int)nLen;

    while (0 < Length) {
        if ('\0' == *psz1 || '\0' == *psz2) {
            return *psz1 - *psz2;
        }
        if (IsDBCSLeadByte(*psz1) || IsDBCSLeadByte(*psz2)) {
            if (*psz1 != *psz2 || *(psz1+1) != *(psz2+1)) {
                return *psz1 - *psz2;
            }
            psz1 += 2;
            psz2 += 2;
            Length -= 2;
        } else {
            if (toupper(*psz1) != toupper(*psz2)) {
                return *psz1 - *psz2;
            }
            psz1++;
            psz2++;
            Length--;
        }
    }
    return 0;
}

PUCHAR My_mbspbrk | ( | PUCHAR | psz,
 |  | PUCHAR | pszSep
 | ) |  |

Definition at line 4496 of file sdkdiff.cpp.

{
    PUCHAR pszSepT;
    while (*psz != '\0') {
        pszSepT = pszSep;
        while (*pszSepT != '\0') {
            if (*pszSepT == *psz) {
                return psz;
            }
            pszSepT = (PUCHAR)CharNext((LPCSTR)pszSepT);
        }
        psz = (PUCHAR)CharNext((LPCSTR)psz);
    }
    return NULL;
}

LPSTR My_mbsrchr | ( | LPCSTR | psz,
 |  | unsigned short | uiSep
 | ) |  |

Definition at line 4688 of file sdkdiff.cpp.

{
    unsigned const char *pszHead;

    pszHead = (unsigned char *)psz;

    while (*psz != '\0') {
        psz++;
    }
    if (uiSep == '\0') {
        return (LPSTR)psz;
    }

    while ((LPCSTR)psz > (LPCSTR)pszHead) {
        psz = CharPrev((LPCSTR)pszHead, psz);
        if (*psz == uiSep) {
            break;
        }
    }
    return (LPSTR)(*psz == uiSep ? psz : NULL);
}

PUCHAR My_mbsstr | ( | PUCHAR | str1,
 |  | PUCHAR | str2,
 |  | PUCHAR * | pstrEnd
 | ) |  |

Definition at line 4524 of file sdkdiff.cpp.

{
  PUCHAR cp = (PUCHAR) str1;
  PUCHAR s1, s2;

  if (!*str2)
    return ((PUCHAR) str1);

  while (*cp)
    {
    s1 = cp;
    s2 = (PUCHAR) str2;

    while (*s1 && *s2)
      {
      if (*s1 - *s2)
        break;

      if (IsDBCSLeadByte(*s1) && (++(*s1) - ++(*s2)))
        break;

      s1++;
      s2++;
      }

    if (!*s2)
      {
      if (pstrEnd)
        *pstrEnd = s1;
      return cp;
      }

    cp = (PUCHAR)CharNext((LPCSTR)cp);
    }

  return NULL;
}

void OnRightClick | ( | HWND | hWnd,
 |  | int | x,
 |  | int | y
 | ) |  |

Definition at line 2324 of file sdkdiff.cpp.

{
    HMENU L_hMenu, hSubMenu;
    POINT point;
    UINT uEnable;

    if (DisplayMode == MODE_OUTLINE) {
        L_hMenu = LoadMenu(hInst, szOutlineMenu);
    } else if (DisplayMode == MODE_EXPAND) {
        L_hMenu = LoadMenu(hInst, szExpandMenu);
    } else {
        return;
    }

    hSubMenu = GetSubMenu(L_hMenu, 0);

    // -- lots of stuff to disable inappropriate menu items --

    // enable IDM_TOMOVED only if it is a moved line that we can
    // see the other copy of in this view (and only if there is a single
    // selected line)

    if (DisplayMode == MODE_EXPAND) {
        if (ToMoved(hWnd, FALSE) && (1 == selection_nrows)) {
            uEnable = MF_ENABLED;
        } else {
            uEnable = MF_GRAYED;
        }
        EnableMenuItem(L_hMenu, IDM_TOMOVED, MF_BYCOMMAND | uEnable);
    }

    // disable next/prev buttons if no more changes in that direction
    if (view_findchange(current_view, selection+1, TRUE) >=0) {
        uEnable = MF_ENABLED;
    } else {
        uEnable = MF_GRAYED;
    }
    EnableMenuItem(hSubMenu, IDM_FCHANGE, MF_BYCOMMAND | uEnable);

    if (view_findchange(current_view, selection-1, FALSE) >=0) {
        uEnable = MF_ENABLED;
    } else {
        uEnable = MF_GRAYED;
    }
    EnableMenuItem(hSubMenu, IDM_FPCHANGE, MF_BYCOMMAND | uEnable);

    // check for left-only and right-only files and disable the appropriate
    // menu item
    // disable all editxxx and Expand if multiple files selected
    if ((DisplayMode == MODE_OUTLINE) && (selection_nrows > 1)) {
        EnableMenuItem(hSubMenu, IDM_EDITLEFT, MF_BYCOMMAND|MF_GRAYED);
        EnableMenuItem(hSubMenu, IDM_EDITRIGHT, MF_BYCOMMAND|MF_GRAYED);
        EnableMenuItem(hSubMenu, IDM_EDITCOMP, MF_BYCOMMAND|MF_GRAYED);
        EnableMenuItem(hSubMenu, IDM_EXPAND, MF_BYCOMMAND|MF_GRAYED);
    } else {
        COMPITEM item = view_getitem(current_view, selection);
        UINT uEnableLeft = MF_ENABLED;
        UINT uEnableRight = MF_ENABLED;
        UINT uEnableComp = MF_ENABLED;
        int state;
        FILEDATA fd;

        state = compitem_getstate(item);

        if (state == STATE_FILERIGHTONLY) {
            uEnableLeft = MF_GRAYED;
        } else if (state == STATE_FILELEFTONLY) {
            uEnableRight = MF_GRAYED;
        }

        fd = compitem_getleftfile(item);
        if (fd && file_IsUnicode(fd)) {
            uEnableComp = MF_GRAYED;
        }
        fd = compitem_getrightfile(item);
        if (fd && file_IsUnicode(fd)) {
            uEnableComp = MF_GRAYED;
        }

        EnableMenuItem(hSubMenu, IDM_EDITLEFT, MF_BYCOMMAND | uEnableLeft);
        EnableMenuItem(hSubMenu, IDM_EDITRIGHT, MF_BYCOMMAND | uEnableRight);
        EnableMenuItem(hSubMenu, IDM_EDITCOMP, MF_BYCOMMAND | uEnableComp);

        if (DisplayMode == MODE_OUTLINE) {
            EnableMenuItem(hSubMenu, IDM_EXPAND, MF_BYCOMMAND|MF_ENABLED);
        }
    }

    // convert the window-based co-ord to a screen co-ord
    point.x = x;
    point.y = y;
    ClientToScreen(hwndRCD, &point);

    TrackPopupMenu(
                  hSubMenu,
                  TPM_LEFTALIGN|TPM_RIGHTBUTTON,
                  point.x, point.y,
                  0,
                  hWnd,
                  NULL);

    DestroyMenu(L_hMenu);
}

void OnUpdate ( COMPITEM item )

Definition at line 2438 of file sdkdiff.cpp.

{

    // save current scroll position
    long row = (long) SendMessage(hwndRCD, TM_TOPROW, FALSE, 0);

    // ... and current selection
    long lSel = selection;
    long cSel = selection_nrows;

    /* update the display.  Options or files may have changed */
    /* discard lines  (thereby forcing re-read).
     */
    file_discardlines(compitem_getleftfile(item));
    file_discardlines(compitem_getrightfile(item));

    view_changediffoptions(current_view);

    // tell the table view to recalculate its
    // idea of the width of each col etc

    SendMessage(hwndRCD, TM_NEWLAYOUT, 0, (LPARAM) current_view);

    // set old scroll position
    SendMessage(hwndRCD, TM_TOPROW, TRUE, row);

    // set back old selection
    SetSelection(lSel, cSel, lSel - row);

    /* force repaint of bar window */
    InvalidateRect(hwndBar, NULL, TRUE);
}

void ParseArgs ( char * lpCmdLine )

Definition at line 1188 of file sdkdiff.cpp.

{
    PTHREADARGS ta;

    BOOL fAllowTwoPaths = TRUE;         // FALSE means -l or -lr was used
    BOOL fReverse = FALSE;              // -lr means reverse
    BOOL fDeepDefault = TRUE;
    char * tok;         /* token from lpCmdLine */

    DWORD threadid;
    UINT idsError = 0;

    /* thread args can't be on the stack since the stack will change
     * before the thread completes execution
     */
    ta = (PTHREADARGS) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(THREADARGS));
    if (ta == NULL)
    return;

  ta->first = NULL;
    ta->second = NULL;
    ta->savelist = NULL;
    ta->savecomp = NULL;
    ta->listopts = 0;
    ta->compopts = 0;
    ta->notify = NULL;
    ta->fExit = FALSE;
    ta->fDeep = FALSE;  /* No -T option seen yet */

    tok = GetNextToken(lpCmdLine);

    while ((tok!=NULL) && (lstrlen(tok) > 0)) {

        if (tok[0] == '/' && tok[1] == '/')
        {
            goto LFile;
        }

        /* is this an option ? */
        if ((tok[0] == '-') || (tok[0] == '/')) {
            switch (tok[1]) {
                case 's':
                case 'S':
                    /* read letters for the save option: s,l,r,d */
                    for (tok+=2; *tok != '\0'; ++tok) {
                        switch (*tok) {
                            case 's':
                            case 'S':
                                ta->listopts |= INCLUDE_SAME;
                                break;
                            case 'l':
                            case 'L':
                                ta->listopts |= INCLUDE_LEFTONLY;
                                break;
                            case 'r':
                            case 'R':
                                ta->listopts |= INCLUDE_RIGHTONLY;
                                break;
                            case 'd':
                            case 'D':
                                ta->listopts |= INCLUDE_DIFFER;
                                break;
                            case 'x':
                            case 'X':
                                ta->fExit = TRUE;
                                break;
                            default:
                                idsError = 0;
                                goto LUsage;
                        }
                    }

                    if (ta->listopts == 0) {
                        /* default to left and differ */
                        ta->listopts = (INCLUDE_LEFTONLY) | (INCLUDE_DIFFER);
                    }
                    ta->savelist = GetNextToken(NULL);
                    break;
                case 'f':
                case 'F':
          /* read letters for the save option: s,l,r,d,e,i */
                    for(tok = &tok[2]; *tok != '\0'; ++tok) {
                        switch(*tok) {
                        case 'i':
                        case 'I':
                                ta->compopts |= INCLUDE_SAME;
                                break;
                        case 'l':
                        case 'L':
                                ta->compopts |= INCLUDE_LEFTONLY;
                                break;
                        case 'r':
                        case 'R':
                                ta->compopts |= INCLUDE_RIGHTONLY;
                                break;
                        case 'f':
                        case 'F':
                                ta->compopts |= INCLUDE_MOVEDLEFT;
                                break;
                        case 'g':
                        case 'G':
                                ta->compopts |= INCLUDE_MOVEDRIGHT;
                                break;
                        case 's':
                        case 'S':
                                ta->compopts |= INCLUDE_SIMILARLEFT;
                                break;
                        case 'a':
                        case 'A':
                                ta->compopts |= INCLUDE_SIMILARRIGHT;
                                break;
                        case 'x':
                        case 'X':
                                ta->fExit = TRUE;
                                break;
                        default:
                                idsError = 0;
                                goto LUsage;
                        }
                    }

                    if (ta->compopts == 0) {
                            /* default to showing all diffs (everything but same) */
                            ta->compopts = INCLUDE_LEFTONLY | INCLUDE_RIGHTONLY
                                         | INCLUDE_DIFFER | INCLUDE_MOVEDLEFT
                                         | INCLUDE_MOVEDRIGHT;
                    }
                    ta->savecomp = GetNextToken(NULL);
                    break;
                case 'i':
                case 'I':
                    ta->fInputFile = TRUE;
                    if (tok[2] == '1')
                    {
                        ta->fInputFileSingle = TRUE;
                        tok++;
                    }
                    tok += 2;
                    // allow (but don't require) a space between '-I' and the
                    // 'inputfilename' argument.
                    if (!*tok)
                        tok = GetNextToken(NULL);
                    if (!tok || !*tok)
                    {
                        idsError = IDS_ERROR_IARGS;
                        goto LUsage;
                    }
                    break;
                case 'n':
                case 'N':
                    ta->notify = GetNextToken(NULL);
                    break;
                case 't':
                case 'T':
                    ta->fDeep = TRUE;
                    break;
                case 'd':
                case 'D':
                    ta->fDeep = FALSE;     // This directory only
                    fDeepDefault = FALSE;
                    break;
                case 'o':
                case 'O':
                    fAutoExpand = FALSE;
                    break;
                case 'p':
                case 'P':
                    gbPerverseCompare = TRUE;
                    break;
                case 'x':
                case 'X':
                    {
                        BOOL track;
                        char *c = &tok[2];
                        if (*c == '\0') {
                            TrackLeftOnly = FALSE;
                            TrackRightOnly = FALSE;
                            TrackSame = FALSE;
                            TrackDifferent = TRUE;
                            TrackReadonly = TRUE;
                            break;
                        }
                        track = FALSE;
                        while (*c != '\0') {
                            if (toupper(*c) == 'L') {
                                TrackLeftOnly = track;
                                track = FALSE;
                            } else if (toupper(*c) == 'R') {
                                TrackRightOnly = track;
                                track = FALSE;
                            } else if (toupper(*c) == 'S') {
                                TrackSame = track;
                                track = FALSE;
                            } else if (toupper(*c) == 'D') {
                                TrackDifferent = track;
                                track = FALSE;
                            } else if (toupper(*c) == 'O') {
                                TrackReadonly = track;
                                track = FALSE;
                            } else if (toupper(*c) == 'I') {
                                track = FALSE;
                            } else if (toupper(*c) == '-') {
                                track = TRUE;
                            } else {
                                idsError = 0;
                                goto LUsage;
                            }
                            c++;
                        }
                        break;
                    }

#ifdef DEBUG
                case '!':
                    DebugBreak();
                    break;
#endif

                case '?':
                    {
                        int j = 0;
                        sdkdiff_usage(NULL);
                        for (++tok; tok[1] != '\0'; ++tok)
                            if ('?'==*tok) ++j;

                        if (2==j) {
                            WriteProfileString(APPNAME, "SYSUK", "1");
                        }
                        return;
                    }
                default:
                    idsError = 0;
                    goto LUsage;
            }
        } else {
        LFile:
            if (ta->first == NULL) {
                ta->first = tok;
            } else {
                ta->second = tok;
            }
        }
        tok = GetNextToken(NULL);
    }

    if (ta->fInputFile && ta->first)
    {
        idsError = IDS_ERROR_IARGS;
        goto LUsage;
    }

    /* set the correct depth */
    if (ta->fDeep)
        ;                       /* explicitly set -- leave it alone */

    else ta->fDeep = fDeepDefault;  /* global default */

    if (!ta->fInputFile)
    {
        /* any paths to scan ? */
        if (ta->first == NULL)
            return;

        if (ta->second == NULL)
            ta->second = ".";
    }
    else
    {
        ta->fDeep = FALSE;
    }

    SetBusy();

    /* minimise the window if -s flag given */
    if (ta->savelist != NULL || ta->savecomp != NULL) {
        ShowWindow(hwndClient, SW_MINIMIZE);
    }

    /* make an empty view */
    current_view = view_new(hwndRCD);
    DisplayMode = MODE_OUTLINE;

    ta->view = current_view;

    /* attempt to create a worker thread */

    ghThread = CreateThread(NULL, 0, wd_initial, (LPVOID) ta,
                            0, &threadid);
    if (ghThread == NULL)
  {
        wd_initial( (LPVOID) ta);
    }

    return;

LUsage:
    sdkdiff_usage(idsError ? LoadRcString(idsError) : NULL);
} /* ParseArgs */

void PickUpProfile | ( | DWORD * | pfoo,
 |  | LPCSTR | szfoo
 | ) |  |

Definition at line 347 of file sdkdiff.cpp.

{
    *pfoo = GetProfileInt(APPNAME, szfoo, *pfoo);
}

BOOL Poll ( void )

Definition at line 1557 of file sdkdiff.cpp.

{
    MSG msg;

    /* don't do the message loop in the WIN32 version since we
     * have multiple threads to handle that, and this is being called
     * on a worker thread, not the UI thread.
     *
     * in the WIN32 case, just check for abort requests
     */

    /* message loop */
    while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
        if (!TranslateAccelerator(hwndClient, haccel, &msg)) {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
    }

    return(bAbort);
}

void RescanFile ( HWND hwnd )

Definition at line 2050 of file sdkdiff.cpp.

{
    COMPITEM ci=NULL;
    int iStart;
    int iEnd;
    int i;

    if (selection_nrows > 0 || DisplayMode == MODE_EXPAND) {
        if (DisplayMode == MODE_EXPAND) {
            iStart = 0;
            iEnd = 1;
        } else {
            iStart = selection;
            iEnd = iStart + selection_nrows;
        }
        for (i = iStart; i < iEnd; i++) {
            ci = view_getitem(current_view, i);
            if (ci != NULL) {
                compitem_rescan(ci);
            }
        }
    } else {
        sdkdiff_UI(TRUE);
        MessageBox(hwndClient, LoadRcString(IDS_NOTHING_RESCANNED),
                   szSdkDiff, MB_ICONSTOP|MB_OK);
        sdkdiff_UI(FALSE);

        return;
    }
    PostMessage(hwndClient, WM_COMMAND, IDM_UPDATE, (LPARAM) ci);
} /* RescanFile */

void sdkdiff_UI ( BOOL bAttach )

Definition at line 589 of file sdkdiff.cpp.

{
    DWORD dwThreadId = GetCurrentThreadId();
    if (dwThreadId==gdwMainThreadId) return;

    if (bAttach) GetDesktopWindow();
    AttachThreadInput(dwThreadId, gdwMainThreadId, bAttach);
} /* sdkdiff_UI */

void sdkdiff_usage ( LPSTR msg )

Definition at line 992 of file sdkdiff.cpp.

{
    INT_PTR retval;
    UINT fuStyle =  MB_ICONINFORMATION|MB_OKCANCEL;
  HRESULT hr;

    if (msg)
    {
        char Usage[4096];

        // since msg may be a pointer returned by LoadRcString, copy it off so
        // we don't stomp on the string when we load IDS_SDKDIFF_USAGE.
        hr = StringCchCopy(Usage, 4096, msg);
    if (FAILED(hr))
      OutputError(hr, IDS_SAFE_COPY);
        msg = Usage;

        retval = MessageBox(hwndClient,
                            msg,
                            LoadRcString(IDS_SDKDIFF_USAGE),
                            fuStyle);
    }
    else
    {
        HINSTANCE h;

        h = LoadLibrary("riched20.dll");
        if (!h)
            h = LoadLibrary("riched32.dll");
        if (h)
        {
            retval = DialogBox(hInst, (LPCSTR)IDD_USAGE, hwndClient, UsageDlgProc);
            FreeLibrary(h);
        }
        else
        {
            sdkdiff_usage(LoadRcString(IDS_ERROR_CANTLOADRICHEDIT));
            retval = IDOK;
        }
    }

    if (retval == IDCANCEL)
        exit(1);
}

BOOL SetBusy ( void )

Definition at line 2528 of file sdkdiff.cpp.

{
    HMENU hmenu;

    WDEnter();

    if (fBusy) {
        WDLeave();
        return(FALSE);
    }

    fBusy = TRUE;

    SetStatus(LoadRcString(IDS_COMPARING));
    /* status also on window text, so that you can see even from
     * the icon when the scan has finished
     */
    SetWindowText(hwndClient, LoadRcString(IDS_SCANNING));

    /* disable appropriate parts of menu */
    hmenu = GetMenu(hwndClient);
    EnableMenuItem(hmenu, IDM_FILE,MF_DISABLED|MF_GRAYED|MF_BYCOMMAND);
    EnableMenuItem(hmenu, IDM_DIR,MF_DISABLED|MF_GRAYED|MF_BYCOMMAND);
    EnableMenuItem(hmenu, IDM_PRINT,MF_DISABLED|MF_GRAYED|MF_BYCOMMAND);
    EnableMenuItem(hmenu, IDM_SAVELIST,MF_DISABLED|MF_GRAYED|MF_BYCOMMAND);
    EnableMenuItem(hmenu, IDM_COPYFILES,MF_DISABLED|MF_GRAYED|MF_BYCOMMAND);

    /* enable abort only when busy */
    EnableMenuItem(hmenu, IDM_ABORT,MF_ENABLED|MF_BYCOMMAND);
    SetButtonText(LoadRcString(IDS_ABORT));  /* leave DisplayMode unchanged */

    WDLeave();
    return(TRUE);
} /* SetBusy */

void SetButtonText ( LPSTR cmd )

Definition at line 2479 of file sdkdiff.cpp.

{
    SendMessage(hwndStatus, SM_SETTEXT, IDM_ABORT, (LPARAM) cmd);
}

void SetColours ( void )

Definition at line 353 of file sdkdiff.cpp.

{
    /* outline */

    rgb_outlinehi = (DWORD)RGB(255, 0, 0);   /* hilighted files in outline mode  */
    PickUpProfile(&rgb_outlinehi, szrgb_outlinehi);

    rgb_fileleftfore = (DWORD)RGB(0, 0, 0);   /* left only outline mode  */
    PickUpProfile(&rgb_fileleftfore, szrgb_fileleftfore);
    rgb_fileleftback = (DWORD)RGB(255, 255, 255);
    PickUpProfile(&rgb_fileleftback, szrgb_fileleftback);

    rgb_filerightfore = (DWORD)RGB(0, 0, 0);  /* right only outline mode  */
    PickUpProfile(&rgb_filerightfore, szrgb_filerightfore);
    rgb_filerightback = (DWORD)RGB(255, 255, 255);
    PickUpProfile(&rgb_filerightback, szrgb_filerightback);

    /* expand view */
    rgb_leftfore =   (DWORD)RGB(  0,   0,   0);         /* foregrnd for left lines */
    PickUpProfile(&rgb_leftfore, szrgb_leftfore);
    rgb_leftback  =  (DWORD)RGB(255,   0,   0);         /* backgrnd for left lines */
    PickUpProfile(&rgb_leftback, szrgb_leftback);
    rgb_rightfore =  (DWORD)RGB(  0,   0,   0);         /* foregrnd for right lines*/
    PickUpProfile(&rgb_rightfore, szrgb_rightfore);
    rgb_rightback =  (DWORD)RGB(255, 255,   0);         /* backgrnd for right lines*/
    PickUpProfile(&rgb_rightback, szrgb_rightback);

    rgb_similarleft= (DWORD)RGB(  0, 255, 255);         /* foreground zebra        */
    PickUpProfile(&rgb_similarleft, szrgb_similarleft);
    rgb_similarright=(DWORD)RGB(  0, 127, 127);         /* forground zebra         */
    PickUpProfile(&rgb_similarright, szrgb_similarright);
    rgb_similar   =  (DWORD)RGB(  127, 127, 255);       /* same within comp options*/
    PickUpProfile(&rgb_similar, szrgb_similar);

    /* moved lines */
    rgb_mleftfore =  (DWORD)RGB(  0,   0, 128);         /* foregrnd for moved-left */
    PickUpProfile(&rgb_mleftfore, szrgb_mleftfore);
    rgb_mleftback =  (DWORD)RGB(255,   0,   0);         /* backgrnd for moved-left */
    PickUpProfile(&rgb_mleftback, szrgb_mleftback);
    rgb_mrightfore = (DWORD)RGB(  0,   0, 255);         /* foregrnd for moved-right*/
    PickUpProfile(&rgb_mrightfore, szrgb_mrightfore);
    rgb_mrightback = (DWORD)RGB(255, 255,   0);         /* backgrnd for moved-right*/
    PickUpProfile(&rgb_mrightback, szrgb_mrightback);

    /* bar window */
    rgb_barleft =    (DWORD)RGB(255,   0,   0);         /* bar sections in left only  */
    PickUpProfile(&rgb_barleft, szrgb_barleft);
    rgb_barright =   (DWORD)RGB(255, 255,   0);         /* bar sections in right only */
    PickUpProfile(&rgb_barright, szrgb_barright);
    rgb_barcurrent = (DWORD)RGB(  0,   0, 255);         /* current pos markers in bar */
    PickUpProfile(&rgb_barcurrent, szrgb_barcurrent);

    /* defaults */
    rgb_defaultfore = (DWORD)RGB(   0,   0,   0);       /* default foreground colour */
    PickUpProfile(&rgb_defaultfore, szrgb_defaultfore);
    rgb_defaultforews = (DWORD)RGB(192, 192, 192);      /* default foreground whitespace colour */
    PickUpProfile(&rgb_defaultforews, szrgb_defaultforews);
    rgb_defaultback = (DWORD)RGB(255, 255, 255);        /* default background colour */
    PickUpProfile(&rgb_defaultback, szrgb_defaultback);

} /* SetColours */

void SetMonoColours ( void )

Definition at line 415 of file sdkdiff.cpp.

{
    rgb_outlinehi = GetSysColor(COLOR_WINDOW);   /* hilighted files in outline mode  */

    /* expand view - all changed or moved lines are white on black */
    rgb_leftfore =   GetSysColor(COLOR_WINDOW);         /* foregrnd for left lines */
    rgb_leftback  =  GetSysColor(COLOR_WINDOWTEXT);     /* backgrnd for left lines */
    rgb_rightfore =  GetSysColor(COLOR_WINDOW);         /* foregrnd for right lines*/
    rgb_rightback =  GetSysColor(COLOR_WINDOWTEXT);     /* backgrnd for right lines*/

    rgb_similarleft= GetSysColor(COLOR_WINDOW);         /* foreground zebra        */
    rgb_similarright=GetSysColor(COLOR_WINDOW);         /* foreground zebra        */
    rgb_similar   =  GetSysColor(COLOR_WINDOWTEXT);     /* same within comp options*/

    /* moved lines - black on white */
    rgb_mleftfore =  GetSysColor(COLOR_WINDOWTEXT);     /* foregrnd for moved-left */
    rgb_mleftback =  GetSysColor(COLOR_WINDOW);         /* backgrnd for moved-left */
    rgb_mrightfore = GetSysColor(COLOR_WINDOWTEXT);     /* foregrnd for moved-right*/
    rgb_mrightback = GetSysColor(COLOR_WINDOW);         /* backgrnd for moved-right*/

    /* bar WINDOWTEXT */
    rgb_barleft =    GetSysColor(COLOR_WINDOWTEXT);     /* bar sections in left only  */
    rgb_barright =   GetSysColor(COLOR_WINDOWTEXT);     /* bar sections in right only */
    rgb_barcurrent = GetSysColor(COLOR_WINDOWTEXT);     /* current pos markers in bar */

    rgb_defaultfore = GetSysColor(COLOR_WINDOWTEXT);    /* default foreground colour */
    rgb_defaultforews = GetSysColor(COLOR_WINDOWTEXT);  /* default foreground whitespace colour */
    rgb_defaultback = GetSysColor(COLOR_WINDOW);        /* default background colour */

} /* SetMonoColours */

void SetNames ( LPSTR names )

Definition at line 2510 of file sdkdiff.cpp.

{
    SendMessage(hwndStatus, SM_SETTEXT, IDL_NAMES, (LPARAM) names);
    if (names == NULL) {
        AppTitle[0] = '\0';
    } else {
        My_mbsncpy(AppTitle, names, sizeof(AppTitle));
    }
}

void SetNotBusy ( void )

Definition at line 2566 of file sdkdiff.cpp.

{
    HMENU hmenu;
  HRESULT hr;

    /*
     * this function can be called from the worker thread.
     * Thus we must not cause any SendMessage calls to windows
     * owned by the main thread while holding the CritSec or we
     * could cause deadlock.
     *
     * the critsec is only needed to protect the fBusy flag - so
     * clear the busy flag last, and only get the crit sec as needed.
     */

    /* reset button and status bar (clearing out busy flags) */
    if (current_view == NULL) {
        SetButtonText(LoadRcString(IDS_EXIT));
        SetStatus(NULL);
        DisplayMode = MODE_NULL;
    } else if (view_isexpanded(current_view)) {
        TCHAR szBuf[10];
        hr = StringCchCopy(szBuf, 10, LoadRcString(IDS_OUTLINE));
    if (FAILED(hr))
      OutputError(hr, IDS_SAFE_COPY);
        SetButtonText(szBuf);
        SetStatus(view_getcurrenttag(current_view) );
        DisplayMode = MODE_EXPAND;
    } else {
        TCHAR szBuf[8];
        hr = StringCchCopy(szBuf,8, LoadRcString(IDS_EXPAND));
    if (FAILED(hr))
      OutputError(hr, IDS_SAFE_COPY);
        SetButtonText(szBuf);
        SetStatus(NULL);
        DisplayMode = MODE_OUTLINE;
    }

    SetWindowText(hwndClient, szSdkDiff);

    /* re-enable appropriate parts of menu */
    hmenu = GetMenu(hwndClient);
    EnableMenuItem(hmenu, IDM_FILE,MF_ENABLED|MF_BYCOMMAND);
    EnableMenuItem(hmenu, IDM_DIR,MF_ENABLED|MF_BYCOMMAND);
    EnableMenuItem(hmenu, IDM_PRINT,MF_ENABLED|MF_BYCOMMAND);
    EnableMenuItem(hmenu, IDM_SAVELIST,MF_ENABLED|MF_BYCOMMAND);
    EnableMenuItem(hmenu, IDM_COPYFILES,MF_ENABLED|MF_BYCOMMAND);

    /* disable abort now no longer busy */
    EnableMenuItem(hmenu, IDM_ABORT,MF_DISABLED|MF_GRAYED|MF_BYCOMMAND);

    /* clear the busy flag, protected by critical section */
    WDEnter();

    fBusy = FALSE;
    bAbort = FALSE;

    if (ghThread!=NULL) {
        CloseHandle(ghThread);
        ghThread = NULL;
    }
    WDLeave();
} /* SetNotBusy */

void SetSelection | ( | long | rownr,
 |  | long | nrows,
 |  | long | dyRowsFromTop
 | ) |  |

Definition at line 2765 of file sdkdiff.cpp.

{
    TableSelection select;

    select.startrow = rownr;
    select.startcell = 0;
    select.nrows = nrows;
    select.ncells = 1;
    select.dyRowsFromTop = dyRowsFromTop;
    SendMessage(hwndRCD, TM_SELECT, 0, (LPARAM)&select);
}

void SetStatus ( LPSTR cmd )

Definition at line 2488 of file sdkdiff.cpp.

{
    SendMessage(hwndStatus, SM_SETTEXT, IDL_STATLAB, (LPARAM) cmd);
}

UINT StateToColour | ( | int | state,
 |  | BOOL | bMarked,
 |  | int | col,
 |  | DWORD * | foreground,
 |  | DWORD * | foregroundws,
 |  | DWORD * | background
 | ) |  |

Definition at line 2662 of file sdkdiff.cpp.

{

    /* we always set both colours - allows all the colours to
       be controlled from the profile.  Important for the
       visually impaired.  So we first set the dafaults.
    */
    *foreground = rgb_defaultfore;
    *foregroundws = rgb_defaultforews;
    *background = rgb_defaultback;

    // marked compitems are highlighted specially - for now, use the
    // colour scheme used for different lines in expand mode
    if (bMarked) {
        *foreground = rgb_rightfore;
        *background = rgb_rightback;
        return(P_FCOLOUR|P_FCOLOURWS|P_BCOLOUR);
    }

    switch (state) {

        case STATE_DIFFER:
            /* files that differ are picked out in a foreground highlight,
             * with the default background
             */
            *foreground = rgb_outlinehi;
            return(P_FCOLOUR|P_FCOLOURWS|P_BCOLOUR);

        case STATE_FILELEFTONLY:
            /* zebra lines in both files - right file version */
            *foreground = rgb_fileleftfore;
            *background = rgb_fileleftback;
            return(P_FCOLOUR|P_FCOLOURWS|P_BCOLOUR);

        case STATE_FILERIGHTONLY:
            /* zebra lines in both files - right file version */
            *foreground = rgb_filerightfore;
            *background = rgb_filerightback;
            return(P_FCOLOUR|P_FCOLOURWS|P_BCOLOUR);

        case STATE_SIMILAR:
            /* for files that are same within expand compare options
             * e.g. differ only in ignorable blanks  (NYI)
            */
            *foreground = rgb_similar;
            return(P_FCOLOUR|P_FCOLOURWS|P_BCOLOUR);

        case STATE_LEFTONLY:
            /* lines only in the left file */
            *foreground = rgb_leftfore;
            *background = rgb_leftback;
            return(P_FCOLOUR|P_FCOLOURWS|P_BCOLOUR);

        case STATE_RIGHTONLY:
            /* lines only in the right file */
            *foreground = rgb_rightfore;
            *background = rgb_rightback;
            return(P_FCOLOUR|P_FCOLOURWS|P_BCOLOUR);

        case STATE_MOVEDLEFT:
            /* displaced lines in both files - left file version */
            *foreground = rgb_mleftfore;
            *background = rgb_mleftback;
            return(P_FCOLOUR|P_FCOLOURWS|P_BCOLOUR);

        case STATE_MOVEDRIGHT:
            /* displaced lines in both files - right file version */
            *foreground = rgb_mrightfore;
            *background = rgb_mrightback;
            return(P_FCOLOUR|P_FCOLOURWS|P_BCOLOUR);

        case STATE_SIMILARLEFT:
            /* zebra lines in both files - left file version */
            *foreground = rgb_similarleft;
            *background = rgb_leftback;
            return(P_FCOLOUR|P_FCOLOURWS|P_BCOLOUR);

        case STATE_SIMILARRIGHT:
            /* zebra lines in both files - right file version */
            *foreground = rgb_similarright;
            *background = rgb_rightback;
            return(P_FCOLOUR|P_FCOLOURWS|P_BCOLOUR);

        default:

            /* no highlighting - default colours */
            return(P_FCOLOUR|P_FCOLOURWS|P_BCOLOUR);
    }

}

void SvrClose ( void )

Definition at line 3055 of file sdkdiff.cpp.

{
    view_delete(current_view);
    current_view = NULL;

    /* hide picture - only visible when we are in MODE_EXPAND */
    DisplayMode = MODE_NULL;
    DoResize(hwndClient);

    /* if we already busy when closing this view (ie
     * we are in the process of starting a new scan,
     * then leave the status bar alone, otherwise
     * we should clean up the state of the status bar
     */
    if (!fBusy) {
        SetButtonText(LoadRcString(IDS_EXIT));
        SetNames(NULL);
        SetStatus(NULL);

    }

} /* SvrClose */

long TableServer | ( | HWND | hwnd,
 |  | WPARAM | cmd,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 3081 of file sdkdiff.cpp.

{
    lpTableHdr phdr;
    lpColPropsList proplist;
    lpCellDataList cdlist;
    lpTableSelection pselect;

    switch (cmd) {
        case TQ_GETSIZE:
            /* get the nr of rows and cols in this table */
            phdr = (lpTableHdr) lParam;
            return(do_gethdr(hwnd, phdr));

        case TQ_GETCOLPROPS:
            /* get the size and properties of each column */
            proplist = (lpColPropsList) lParam;
            return (do_getprops(hwnd, proplist));

        case TQ_GETDATA:
            /* get the contents of individual cells */
            cdlist = (lpCellDataList) lParam;
            return (do_getdata(hwnd, cdlist));

        case TQ_SELECT:
            /* selection has changed */
        case TQ_ENTER:
            /* user has double-clicked or pressed enter */

            pselect = (lpTableSelection) lParam;

            /* store location for use in later search (IDM_FCHANGE) */

            /*
             * convert selection so that it always runs forward - we
             * do not need to know where the anchor vs endpoint is
             */
            if (pselect->nrows == 0) {
                selection = -1;
                selection_nrows = 0;
            } else {
                if (pselect->nrows < 0) {
                    selection = pselect->startrow + pselect->nrows + 1;
                    selection_nrows = -pselect->nrows;
                } else {
                    selection = (int) pselect->startrow;
                    selection_nrows = pselect->nrows;
                }
                if (cmd == TQ_ENTER) {
                    /* try to expand this row */
                    if (!ToExpand(hwnd)) {
                        /* expand failed - maybe this
                         * is a moved line- show the other
                         * copy
                         */
                        ToMoved(hwnd, TRUE);
                    }

                }
            }
            break;

        case TQ_CLOSE:
            /* close this table - table class no longer needs data*/
            SvrClose();
            break;

        case TQ_SCROLL:
            /* notification that the rows visible in the window
             * have changed -change the current position lines in
             * the graphic bar view (the sections picture)
             */
            if (picture_mode) {
                BarDrawPosition(hwndBar, NULL, TRUE);
            }
            break;

        case TQ_TABS:
            if (lParam != 0) {
                LONG * pTabs = (LONG *) lParam;
                *pTabs = g_tabwidth;
            }
            return TRUE;

        case TQ_SHOWWHITESPACE:
            if (lParam != 0) {
                LONG * pbShowWhitespace = (LONG *) lParam;
                *pbShowWhitespace = (show_whitespace && view_isexpanded(current_view));
            }
            return TRUE;

        default:
            return(FALSE);
    }
    return(TRUE);
}

BOOL ToExpand ( HWND hwnd )

Definition at line 1801 of file sdkdiff.cpp.

{

    if (selection < 0) {
        return(FALSE);
    }

    // nothing to do if already expanded
    if (view_isexpanded(current_view)) {
        return(FALSE);
    }

    /*
     * note that we are starting expansion
     */
    view_expandstart(current_view);

    if (!view_isexpanded(current_view)) {
        /* save the current outline size and position */
        WINDOWPLACEMENT wp;

        wp.length = sizeof(wp);

        if (GetWindowPlacement(hwndClient,&wp)) {
            WriteProfileInt(APPNAME, szOutlineShowCmd, wp.showCmd);
            WriteProfileInt(APPNAME, szOutlineMaxX, wp.ptMaxPosition.x);
            WriteProfileInt(APPNAME, szOutlineMaxY, wp.ptMaxPosition.y);
            WriteProfileInt(APPNAME, szOutlineNormLeft, wp.rcNormalPosition.left);
            WriteProfileInt(APPNAME, szOutlineNormTop, wp.rcNormalPosition.top);
            WriteProfileInt(APPNAME, szOutlineNormRight, wp.rcNormalPosition.right);
            WriteProfileInt(APPNAME, szOutlineNormBottom, wp.rcNormalPosition.bottom);
            WriteProfileInt(APPNAME, szOutlineSaved, 1);
        }

        /* restore the previous expanded size and position, if any */
        if (GetProfileInt(APPNAME, szExpandedSaved, 0)) {
            wp.flags                   = 0;
            wp.showCmd
            = GetProfileInt( APPNAME, szExpandShowCmd
                             , SW_SHOWMAXIMIZED);
            wp.ptMaxPosition.x
            = GetProfileInt( APPNAME, szExpandMaxX, 0);
            wp.ptMaxPosition.y
            = GetProfileInt( APPNAME, szExpandMaxY, 0);
            wp.rcNormalPosition.left
            = GetProfileInt( APPNAME, szExpandNormLeft
                             , wp.rcNormalPosition.left);
            wp.rcNormalPosition.top
            = GetProfileInt( APPNAME, szExpandNormTop
                             , wp.rcNormalPosition.top);
            wp.rcNormalPosition.right
            = GetProfileInt( APPNAME, szExpandNormRight
                             , wp.rcNormalPosition.right);
            wp.rcNormalPosition.bottom
            = GetProfileInt( APPNAME, szExpandNormBottom
                             , wp.rcNormalPosition.bottom);
            SetWindowPlacement(hwndClient,&wp);
        } else ShowWindow(hwndClient, SW_SHOWMAXIMIZED);
    }

    /*change the view mapping to expand mode */
    if (view_expand(current_view, selection)) {

        /* ok - we now have an expanded view - change status
         * to show this
         */

        DisplayMode = MODE_EXPAND;

        /* resize to show the graphic bar picture */
        DoResize(hwndClient);

        /* change button,status text-if we are not still busy*/
        if (!fBusy) {
            TCHAR szBuf[10];
            /* the status field when we are expanded shows the
             * tag field (normally the file name) for the
             * item we are expanding
             */
            SetStatus(view_getcurrenttag(current_view) );
            HRESULT hr = StringCchCopy(szBuf, 10, LoadRcString(IDS_OUTLINE));
      if (FAILED(hr))
        OutputError(hr, IDS_SAFE_COPY);
            SetButtonText(szBuf);
        }

        // Skip to the first change.  (But don't do this if the first
        // line of the file itself has changed; otherwise we would skip
        // over it!)
        if (view_getrowstate(current_view, 0) == STATE_SAME) {
            _FindNextChange(FALSE, TRUE);
        }

        return(TRUE);
    }
    return(FALSE);
} /* ToExpand */

BOOL ToMoved | ( | HWND | hwnd,
 |  | BOOL | bMove
 | ) |  |

Definition at line 1995 of file sdkdiff.cpp.

{
    BOOL bIsLeft;
    int linenr, state;
    long i, total;

    if (DisplayMode != MODE_EXPAND) {
        return(FALSE);
    }
    if (selection < 0) {
        return(FALSE);
    }

    state = view_getstate(current_view, selection);
    if (state == STATE_MOVEDLEFT || state == STATE_SIMILARLEFT) {
        bIsLeft = TRUE;
        /* get the linenr of the other copy */
        linenr = abs(view_getlinenr_right(current_view, selection));
    } else if (state == STATE_MOVEDRIGHT || state == STATE_SIMILARRIGHT) {
        bIsLeft = FALSE;
        /* get the linenr of the other copy */
        linenr = abs(view_getlinenr_left(current_view, selection));
    } else {
        /* not a moved line - so we can't find another copy */
        return(FALSE);
    }

    /* search the view for this line nr */
    total = view_getrowcount(current_view);
    for (i = 0; i < total; i++) {
        if (bIsLeft) {
            if (linenr == view_getlinenr_right(current_view, i)) {
                /* found it */
                if (bMove) {
                    SetSelection(i, 1, -1);
                }
                return(TRUE);
            }
        } else {
            if (linenr == view_getlinenr_left(current_view, i)) {
                if (bMove) {
                    SetSelection(i, 1, -1);
                }
                return(TRUE);
            }
        }
    }
    return(FALSE);
} /* ToMoved */

void ToOutline ( HWND hwnd )

Definition at line 1907 of file sdkdiff.cpp.

{
    // if current_view is NULL, don't access it with view_xxx functions.
    if (!current_view)
        return;

    /*
     * if we are in the middle of expanding, ignore the
     * key stroke - user can try again later
     */
    if (view_expanding(current_view)) {
        return;
    }

    if (view_isexpanded(current_view)) {
        /* save the current expanded size and position */
        WINDOWPLACEMENT wp;

        wp.length = sizeof(wp);
        if (GetWindowPlacement(hwndClient,&wp)) {
            WriteProfileInt(APPNAME, szExpandShowCmd, wp.showCmd);
            WriteProfileInt(APPNAME, szExpandMaxX, wp.ptMaxPosition.x);
            WriteProfileInt(APPNAME, szExpandMaxY, wp.ptMaxPosition.y);
            WriteProfileInt(APPNAME, szExpandNormLeft, wp.rcNormalPosition.left);
            WriteProfileInt(APPNAME, szExpandNormTop, wp.rcNormalPosition.top);
            WriteProfileInt(APPNAME, szExpandNormRight, wp.rcNormalPosition.right);
            WriteProfileInt(APPNAME, szExpandNormBottom, wp.rcNormalPosition.bottom);
            WriteProfileInt(APPNAME, szExpandedSaved, 1);
        }

        /* restore the previous expanded size and position, if any */
        if (GetProfileInt(APPNAME, szOutlineSaved, 0)) {
            wp.flags = 0;
            wp.showCmd
            = GetProfileInt( APPNAME, szOutlineShowCmd
                             , SW_SHOWNORMAL);
            wp.ptMaxPosition.x
            = GetProfileInt( APPNAME, szOutlineMaxX, 0);
            wp.ptMaxPosition.y
            = GetProfileInt( APPNAME, szOutlineMaxY, 0);
            wp.rcNormalPosition.left
            = GetProfileInt( APPNAME, szOutlineNormLeft
                             , wp.rcNormalPosition.left);
            wp.rcNormalPosition.top
            = GetProfileInt( APPNAME, szOutlineNormTop
                             , wp.rcNormalPosition.top);
            wp.rcNormalPosition.right
            = GetProfileInt( APPNAME, szOutlineNormRight
                             , wp.rcNormalPosition.right);
            wp.rcNormalPosition.bottom
            = GetProfileInt( APPNAME, szOutlineNormBottom
                             , wp.rcNormalPosition.bottom);
            SetWindowPlacement(hwndClient,&wp);
        } else {
            ShowWindow(hwndClient, SW_SHOWNORMAL);
        }
    }

    DisplayMode = MODE_OUTLINE;

    /* switch mapping back to outline view */
    view_outline(current_view);

    /* hide bar window and resize to cover */
    DoResize(hwndClient);

    /* change label on button */
    if (!fBusy) {
        TCHAR szBuf[8];
        HRESULT hr = StringCchCopy(szBuf, 8, LoadRcString(IDS_EXPAND));
    if (FAILED(hr))
      OutputError(hr, IDS_SAFE_COPY);
        SetButtonText(szBuf);
        SetStatus(NULL);
    }
} /* ToOutline */

void Trace_Status ( LPSTR str )

Definition at line 2500 of file sdkdiff.cpp.

{
    SetStatus(str);
}

INT_PTR FAR PASCAL UsageDlgProc | ( | HWND | hDlg,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 896 of file sdkdiff.cpp.

{
    switch (message)
    {
    case WM_INITDIALOG:
        {
            HWND hwnd = GetDlgItem(hDlg, IDC_USAGE_TEXT);
            if (hwnd)
            {
                const UsageStringInfo *p;
                int c;
                PARAFORMAT pf;
                CHARFORMAT cf;
                int pos;

                pf.cbSize = sizeof(pf);

                SendMessage(hwnd, EM_SETBKGNDCOLOR, 0, GetSysColor(COLOR_BTNFACE));
                SendMessage(hwnd, EM_SETMARGINS, EC_LEFTMARGIN|EC_RIGHTMARGIN, MAKELONG(4, 4));

                for (p = c_rg, c = NUMELMS(c_rg); c--; p++)
                {
                    LPCSTR psz;
          psz=LoadRcString(p->m_ids);
                    if (p->m_fExternalOnly)
                        continue;
                    if (p->m_fInternalOnly)
                        continue;

                    pos = LOWORD(SendMessage(hwnd, EM_GETSEL, 0, 0));
                    SendMessage(hwnd, EM_REPLACESEL, FALSE, (LPARAM)psz);
                    SendMessage(hwnd, EM_SETSEL, pos, -1);

                    SendMessage(hwnd, EM_GETPARAFORMAT, 0, (LPARAM)&pf);
                    if (p->m_cIndent >= 0)
                    {
                        static const int c_rgIndents[] = { 320*1, 320*5, 320*6 };
                        static const int c_rgOffsets[] = { 320*4, 0, 0 };

                        pf.dwMask |= PFM_STARTINDENT|PFM_OFFSET|PFM_TABSTOPS;
                        pf.dxStartIndent = 0;
                        pf.dxOffset = 0;
                        if (p->m_cIndent)
                        {
                            pf.dxStartIndent = c_rgIndents[p->m_cIndent - 1];
                            pf.dxOffset = c_rgOffsets[p->m_cIndent - 1];
                        }
                        pf.cTabCount = 2;
                        pf.rgxTabs[0] = c_rgIndents[0];
                        pf.rgxTabs[1] = c_rgIndents[1];
                    }
                    else
                    {
                        pf.dwMask |= PFM_STARTINDENT|PFM_OFFSET|PFM_NUMBERING;
                        pf.dxStartIndent = 320;
                        pf.dxOffset = 180;
                        pf.wNumbering = PFN_BULLET;
                    }
                    SendMessage(hwnd, EM_SETPARAFORMAT, 0, (LPARAM)&pf);

                    SendMessage(hwnd, EM_SETSEL, (WPARAM)-1, -1);
                }

                cf.cbSize = sizeof(cf);
                cf.dwMask = CFM_COLOR;
                cf.dwEffects = 0;
                cf.crTextColor = GetSysColor(COLOR_BTNTEXT);
                SendMessage(hwnd, EM_SETSEL, 0, -1);
                SendMessage(hwnd, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
                SendMessage(hwnd, EM_SETSEL, (WPARAM)-1, -1);
                pos = LOWORD(SendMessage(hwnd, EM_GETSEL, 0, 0));
                SendMessage(hwnd, EM_SETSEL, pos - 1, pos);
                SendMessage(hwnd, EM_REPLACESEL, 0, (LPARAM)"");
                SendMessage(hwnd, EM_SETSEL, 0, 0);
            }
        }
        break;

    case WM_COMMAND:
        switch (wParam)
        {
        case IDOK:
        case IDCANCEL:
            EndDialog(hDlg, wParam);
            break;
        }
        break;

    default:
        return FALSE;
    }

    return TRUE;
}

DWORD WINAPI wd_copy ( LPVOID arg )

Definition at line 3312 of file sdkdiff.cpp.

{

    VIEW view = (VIEW) arg;

    complist_copyfiles(view_getcomplist(view), NULL, 0);

    SetNotBusy();

    return(0);
}

DWORD WINAPI wd_dirdialog ( LPVOID arg )

Definition at line 3290 of file sdkdiff.cpp.

{

    VIEW view = (VIEW) arg;

    /* make a COMPLIST using the directory dialog,
     * and notify the view
     */
    if (complist_dirdialog(view) == NULL) {
        view_close(view);
    }

    /* all done! */
    SetNotBusy();
    return(0);
}

DWORD WINAPI wd_initial ( LPVOID arg )

Definition at line 3192 of file sdkdiff.cpp.

{
    PTHREADARGS pta = (PTHREADARGS) arg;
    COMPLIST cl = 0;
    COMPITEM ci = NULL;
    BOOL fOK = TRUE;
    BOOL fPairs = TRUE;

    /* build a complist from these args,
     * and register with the view we have made
     */

    {
        cl = complist_args(pta->first, pta->second, pta->view, pta->fDeep);
    }

    /*
     * the app can be closed during execution of this routine if
     * we don't retain BUSY. This means we can be expanding structures
     * while the main thread is freeing them.
     *
     */

    if (cl == NULL || !fOK) {
        view_close(pta->view);
        HeapFree(GetProcessHeap(), NULL, pta);
        SetNotBusy();
        return 0;
    }

    /* if savelist or savecomp was selected, write out the list or comp file */
    if (pta->savelist != NULL || pta->savecomp != NULL) {
        if (pta->savelist != NULL) {
            complist_savelist(cl, pta->savelist, pta->listopts);
        }

        if (pta->savecomp != NULL) {
            /* if list item was selected, use that */
            if (selection >= 0) {
                ci = view_getitem(pta->view, selection);
          }
          else {
              /* default to first visible item, if any */
              if (view_getrowcount(pta->view) > 0) {
                  ci = view_getitem(pta->view, 0);
              }
          }
          compitem_savecomp(pta->view, ci, pta->savecomp, pta->compopts);
        }
        HeapFree(GetProcessHeap(), NULL, pta);
        SetNotBusy();

        /* exit if -x was set */
        if (pta->fExit) {
            exit(0);
        }
    }

    /* if savelist was selected, write out the list and exit if -x was set */
    if (pta->savelist != NULL) {
        complist_savelist(cl, pta->savelist, pta->listopts);
        HeapFree(GetProcessHeap(), NULL, pta);
        SetNotBusy();
        if (pta->fExit) exit(0);
    }

    /* if there was only one file, expand it, unless... */
    if (view_getrowcount(pta->view) == 1) {
        /* The interesting case is where there are a bunch of files
           but only one of them is Different.  In this case we do
           NOT expand it even though it is the only one showing.
        */

        UINT nItems = complist_itemcount(cl);
        /* And even then, don't expand if the option said don't.
        */
        if (nItems==1 && fAutoExpand) {
            SetSelection(0, 1, -1);
            ToExpand(hwndClient);
        }
    }

    HeapFree(GetProcessHeap(), NULL, pta);
    SetNotBusy();
    return(0);
} /* wd_initial */

int WINAPI WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 606 of file sdkdiff.cpp.

{
    MSG msg;
  int len = 0;

  // Get working directory.
  memset(pszWorkingDirectoryName, 0, MAX_PATH);
  len = GetModuleFileName(hInstance, pszWorkingDirectoryName, MAX_PATH);
  if (len != 0) {
    while (pszWorkingDirectoryName[len-1] != '\\' ) {
      len--;
    }
    pszWorkingDirectoryName[len] = 0;
  }

    InitGutils(GetModuleHandle(NULL), DLL_PROCESS_ATTACH, NULL);

    gdwMainThreadId = GetCurrentThreadId();

    /* create any pens/brushes etc and read in profile defaults */
    CreateTools();

    /* init window class unless other instances running */
    if (!hPrevInstance)
        if (!InitApplication(hInstance))
            return(FALSE);

    /* init this instance - create all the windows */
    if (!InitInstance(hInstance, nCmdShow))
        return(FALSE);

    ParseArgs(lpCmdLine);

    /* message loop */
    while (GetMessage(&msg, NULL, 0, 0)) {
        if (!TranslateAccelerator(hwndClient, haccel, &msg)) {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
    }

    Trace_Close();
    return (msg.wParam ? 1 : 0);
}

BOOL WriteProfileInt | ( | LPSTR | AppName,
 |  | LPSTR | Key,
 |  | int | Int
 | ) |  |

Definition at line 1784 of file sdkdiff.cpp.

{       char Str[40];
    HRESULT hr = StringCchPrintf(Str, 40, szD, Int);
  if (FAILED(hr))
    OutputError(hr, IDS_SAFE_PRINTF);
    return WriteProfileString(AppName, Key, Str);

} /* WriteProfileInt */

Variable Documentation

BOOL __BERR

Definition at line 209 of file sdkdiff.cpp.

BOOL Algorithm2 = TRUE

Definition at line 533 of file sdkdiff.cpp.

char AppTitle[256]

Definition at line 453 of file sdkdiff.cpp.

BOOL bAbort

Definition at line 508 of file sdkdiff.cpp.

BOOL bDBCS

Definition at line 511 of file sdkdiff.cpp.

BOOL bJapan

Definition at line 510 of file sdkdiff.cpp.

BOOL bTrace

Definition at line 509 of file sdkdiff.cpp.

CRITICAL_SECTION CSSdkdiff

Definition at line 190 of file sdkdiff.cpp.

VIEW current_view = NULL

Definition at line 503 of file sdkdiff.cpp.

int DisplayMode = MODE_NULL

Definition at line 501 of file sdkdiff.cpp.

char editor_cmdline[256] = "notepad %p"

Definition at line 515 of file sdkdiff.cpp.

int expand_include = INCLUDE_ALL

Definition at line 530 of file sdkdiff.cpp.

int expand_mode = IDM_BOTHFILES

Definition at line 528 of file sdkdiff.cpp.

BOOL fAutoExpand = TRUE

Definition at line 505 of file sdkdiff.cpp.

BOOL fBusy = FALSE

Definition at line 488 of file sdkdiff.cpp.

BYTE g_bFontCharSet

Definition at line 520 of file sdkdiff.cpp.

BOOL g_fFontBold

Definition at line 519 of file sdkdiff.cpp.

HFONT g_hFont = 0

Definition at line 521 of file sdkdiff.cpp.

int g_nFontHeight

Definition at line 518 of file sdkdiff.cpp.

char g_szFontFaceName[LF_FACESIZE]

Definition at line 517 of file sdkdiff.cpp.

int g_tabwidth = TABWIDTH_DEFAULT

Definition at line 539 of file sdkdiff.cpp.

BOOL gbPerverseCompare = FALSE

Definition at line 344 of file sdkdiff.cpp.

HACCEL haccel

Definition at line 461 of file sdkdiff.cpp.

BOOL hide_markedfiles = FALSE

Definition at line 535 of file sdkdiff.cpp.

HINSTANCE hInst

Definition at line 474 of file sdkdiff.cpp.

HMENU hMenu

Definition at line 475 of file sdkdiff.cpp.

HWND hwndBar

Definition at line 459 of file sdkdiff.cpp.

HWND hwndClient

Definition at line 456 of file sdkdiff.cpp.

HWND hwndRCD

Definition at line 457 of file sdkdiff.cpp.

HWND hwndStatus

Definition at line 458 of file sdkdiff.cpp.

BOOL ignore_blanks = TRUE

Definition at line 531 of file sdkdiff.cpp.

int line_numbers = IDM_LNRS

Definition at line 527 of file sdkdiff.cpp.

BOOL mono_colours = FALSE

Definition at line 536 of file sdkdiff.cpp.

int nMinMax = SW_SHOWNORMAL

Definition at line 477 of file sdkdiff.cpp.

int outline_include = INCLUDE_ALL

Definition at line 529 of file sdkdiff.cpp.

BOOL picture_mode = TRUE

Definition at line 534 of file sdkdiff.cpp.

char pszWorkingDirectoryName[MAX_PATH]

Definition at line 200 of file sdkdiff.cpp.

DWORD rgb_barcurrent

Definition at line 333 of file sdkdiff.cpp.

DWORD rgb_barleft

Definition at line 331 of file sdkdiff.cpp.

DWORD rgb_barright

Definition at line 332 of file sdkdiff.cpp.

DWORD rgb_defaultback

Definition at line 337 of file sdkdiff.cpp.

DWORD rgb_defaultfore

Definition at line 335 of file sdkdiff.cpp.

DWORD rgb_defaultforews

Definition at line 336 of file sdkdiff.cpp.

DWORD rgb_fileleftback

Definition at line 340 of file sdkdiff.cpp.

DWORD rgb_fileleftfore

Definition at line 339 of file sdkdiff.cpp.

DWORD rgb_filerightback

Definition at line 342 of file sdkdiff.cpp.

DWORD rgb_filerightfore

Definition at line 341 of file sdkdiff.cpp.

DWORD rgb_leftback

Definition at line 315 of file sdkdiff.cpp.

DWORD rgb_leftfore

Definition at line 314 of file sdkdiff.cpp.

DWORD rgb_mleftback

Definition at line 326 of file sdkdiff.cpp.

DWORD rgb_mleftfore

Definition at line 325 of file sdkdiff.cpp.

DWORD rgb_mrightback

Definition at line 328 of file sdkdiff.cpp.

DWORD rgb_mrightfore

Definition at line 327 of file sdkdiff.cpp.

DWORD rgb_outlinehi = RGB(255, 0, 0)

Definition at line 311 of file sdkdiff.cpp.

DWORD rgb_rightback

Definition at line 317 of file sdkdiff.cpp.

DWORD rgb_rightfore

Definition at line 316 of file sdkdiff.cpp.

DWORD rgb_similar

Definition at line 322 of file sdkdiff.cpp.

DWORD rgb_similarleft

Definition at line 320 of file sdkdiff.cpp.

DWORD rgb_similarright

Definition at line 321 of file sdkdiff.cpp.

char* s

Definition at line 56 of file bar.cpp.

long selection = -1

Definition at line 491 of file sdkdiff.cpp.

long selection_nrows = 0

Definition at line 492 of file sdkdiff.cpp.

BOOL show_whitespace = FALSE

Definition at line 532 of file sdkdiff.cpp.

int status_height

Definition at line 466 of file sdkdiff.cpp.

int SubVersion = 01

Definition at line 199 of file sdkdiff.cpp.

const CHAR szSdkDiff[] = "SdkDiff"

Definition at line 245 of file sdkdiff.cpp.

UINT table_msgcode

Definition at line 482 of file sdkdiff.cpp.

BOOL TrackDifferent = TRUE

Definition at line 544 of file sdkdiff.cpp.

BOOL TrackLeftOnly = TRUE

Definition at line 541 of file sdkdiff.cpp.

BOOL TrackReadonly = TRUE

Definition at line 545 of file sdkdiff.cpp.

BOOL TrackRightOnly = TRUE

Definition at line 542 of file sdkdiff.cpp.

BOOL TrackSame = TRUE

Definition at line 543 of file sdkdiff.cpp.

int Version = 2

Definition at line 198 of file sdkdiff.cpp.

Generated on Wed Nov 13 2024 16:53:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/sdkdiff/sdkdiff.h File Reference

  • Begin
  • sdkdiff
Defines | Functions | Variables

sdkdiff.h File Reference

#include "profile.h"

Go to the source code of this file.

Defines

#define | APPNAME szSdkDiff
#define | BAR_WIN_WIDTH 10
#define | INCLUDE_ALL 0xFF
#define | INCLUDE_DIFFER 0x02
#define | INCLUDE_LEFTONLY 0x04
#define | INCLUDE_MOVEDLEFT 0x10
#define | INCLUDE_MOVEDRIGHT 0x20
#define | INCLUDE_RIGHTONLY 0x08
#define | INCLUDE_SAME 0x01
#define | INCLUDE_SIMILARLEFT 0x40
#define | INCLUDE_SIMILARRIGHT 0x80
#define | L_MATCH_START 30
#define | L_MATCH_WIDTH 10
#define | L_POS_START 10
#define | L_POS_WIDTH 5
#define | L_UNMATCH_START 30
#define | L_UNMATCH_WIDTH 10
#define | R_MATCH_START 60
#define | R_MATCH_WIDTH 10
#define | R_POS_START 80
#define | R_POS_WIDTH 5
#define | R_UNMATCH_START 60
#define | R_UNMATCH_WIDTH 10
#define | TM_CURRENTVIEW WM_USER
#define | TRACE_ERROR(msg, flag)

Functions

void | BarDrawPosition (HWND hwndBar, HDC hdcIn, BOOL bErase)
int FAR PASCAL | FindDlgProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
int FAR PASCAL | GoToLineDlgProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
BOOL | InitBarClass (HINSTANCE hInstance)
BOOL | Poll (void)
void | sdkdiff_UI (BOOL bAttach)
void | SetNames (LPSTR names)
void | SetStatus (LPSTR state)

Variables

BOOL __BERR
BOOL bDBCS
BOOL bJapan
int | expand_include
int | expand_mode
int | g_tabwidth
HANDLE hHeap
BOOL hide_markedfiles
HINSTANCE | hInst
HWND | hwndClient
HWND | hwndRCD
BOOL ignore_blanks
int | line_numbers
int | outline_include
DWORD rgb_barcurrent
DWORD rgb_barleft
DWORD rgb_barright
DWORD rgb_leftback
DWORD rgb_leftfore
DWORD rgb_mleftback
DWORD rgb_mleftfore
DWORD rgb_mrightback
DWORD rgb_mrightfore
DWORD rgb_outlinehi
DWORD rgb_rightback
DWORD rgb_rightfore
BOOL show_whitespace
const CHAR | szSdkDiff []
BOOL TrackDifferent
BOOL TrackLeftOnly
BOOL TrackReadonly
BOOL TrackRightOnly
BOOL TrackSame

Define Documentation

#define APPNAME szSdkDiff

Definition at line 28 of file sdkdiff.h.

#define BAR_WIN_WIDTH 10

Definition at line 121 of file sdkdiff.h.

#define INCLUDE_ALL 0xFF

Definition at line 68 of file sdkdiff.h.

#define INCLUDE_DIFFER 0x02

Definition at line 56 of file sdkdiff.h.

#define INCLUDE_LEFTONLY 0x04

Definition at line 57 of file sdkdiff.h.

#define INCLUDE_MOVEDLEFT 0x10

Definition at line 62 of file sdkdiff.h.

#define INCLUDE_MOVEDRIGHT 0x20

Definition at line 63 of file sdkdiff.h.

#define INCLUDE_RIGHTONLY 0x08

Definition at line 58 of file sdkdiff.h.

#define INCLUDE_SAME 0x01

Definition at line 55 of file sdkdiff.h.

#define INCLUDE_SIMILARLEFT 0x40

Definition at line 64 of file sdkdiff.h.

#define INCLUDE_SIMILARRIGHT 0x80

Definition at line 65 of file sdkdiff.h.

#define L_MATCH_START 30

Definition at line 135 of file sdkdiff.h.

#define L_MATCH_WIDTH 10

Definition at line 136 of file sdkdiff.h.

#define L_POS_START 10

Definition at line 126 of file sdkdiff.h.

#define L_POS_WIDTH 5

Definition at line 127 of file sdkdiff.h.

#define L_UNMATCH_START 30

Definition at line 131 of file sdkdiff.h.

#define L_UNMATCH_WIDTH 10

Definition at line 132 of file sdkdiff.h.

#define R_MATCH_START 60

Definition at line 137 of file sdkdiff.h.

#define R_MATCH_WIDTH 10

Definition at line 138 of file sdkdiff.h.

#define R_POS_START 80

Definition at line 128 of file sdkdiff.h.

#define R_POS_WIDTH 5

Definition at line 129 of file sdkdiff.h.

#define R_UNMATCH_START 60

Definition at line 133 of file sdkdiff.h.

#define R_UNMATCH_WIDTH 10

Definition at line 134 of file sdkdiff.h.

#define TM_CURRENTVIEW WM_USER

Definition at line 178 of file sdkdiff.h.

#define TRACE_ERROR | ( | msg,
 |  | flag
 | ) |
Value:
( sdkdiff_UI(TRUE),                      \
                                __BERR = Trace_Error(hwndClient, msg, flag),       \
                                sdkdiff_UI(FALSE),                     \
                                __BERR                                 \
                              )

Definition at line 198 of file sdkdiff.h.

Function Documentation

void BarDrawPosition | ( | HWND | hwndBar,
 |  | HDC | hdcIn,
 |  | BOOL | bErase
 | ) |  |

Definition at line 172 of file bar.cpp.

{
    HDC hdc;
    int total_lines, cy, cx;
    RECT rc, rcLeft, rcRight;
    VIEW view;
    COMPITEM item;
    LIST listleft, listright;
    long toprow, endrow, i;
    int left_first, left_last, right_first, right_last, linenr;

    /* get a hdc if we weren't given one */
    if (hdcIn == NULL) {
        hdc = GetDC(hwndBar);
        if (!hdc)
            return;
    } else {
        hdc = hdcIn;
    }

    /* set horz position of bars */
    GetClientRect(hwndBar, &rc);
    cx = (int)(rc.right - rc.left);
    cy = (int)(rc.bottom - rc.top);

    /* layout constants are defined as percentages of window width */
    rcLeft.left = cx * L_POS_START / 100;
    rcRight.left = cx * R_POS_START / 100;
    rcLeft.right = rcLeft.left +  (cx * L_POS_WIDTH / 100);
    rcRight.right = rcRight.left +  (cx * R_POS_WIDTH / 100);

    /* erase the whole marker section if requested */
    if (bErase) {
        rcLeft.top = rc.top;
        rcLeft.bottom = rc.bottom;
        rcRight.top = rc.top;
        rcRight.bottom = rc.bottom;

        FillRect(hdc, &rcLeft, (HBRUSH)GetStockObject(WHITE_BRUSH));

        FillRect(hdc, &rcRight, (HBRUSH)GetStockObject(WHITE_BRUSH));
    }

    /*
     * calculate the vertical scaling - depends on the
     * total number of lines shown
     */

    /* get the handles to the two lists of sections */
    view = (VIEW) SendMessage(hwndClient, TM_CURRENTVIEW, 0, 0);
    /* make sure we are in expand mode */
    if (view_isexpanded(view) == FALSE) {
        /* get rid of the dc if we made it ourselves */
        if (hdcIn == NULL) {
            ReleaseDC(hwndBar, hdc);
        }
        return;
    }

    item = view_getitem(view, 0);

    listleft = compitem_getleftsections(item);
    listright = compitem_getrightsections(item);

    /* if there is only one list of sections, draw nothing. The
     * picture for a single file is not very exciting.
     */

    if ((listleft == NULL) || (listright == NULL)) {
        /* get rid of the dc if we made it ourselves */
        if (hdcIn == NULL) {
            ReleaseDC(hwndBar, hdc);
        }
        return;
    }

    /* take the longest of the two files and use this
     * for vertical scaling. the scale is such that the longest file
     * *just fits*.
     */
    total_lines = line_getlinenr(section_getlastline((SECTION)List_Last(listleft)));
    total_lines = max(total_lines,
                      (int) line_getlinenr(section_getlastline((SECTION)List_Last(listright))));

    /* get the current top row and nr of rows visible */
    toprow = (LONG)SendMessage(hwndRCD, TM_TOPROW, FALSE, 0);
    endrow = (LONG)SendMessage(hwndRCD, TM_ENDROW, FALSE, 0);
    endrow = min(endrow, view_getrowcount(view)-1);

    /*
     * find the first and last line nrs from each file currently visible.
     *
     */
    left_first = left_last = right_first = right_last = 0;

    for (i = toprow; i <= endrow; i++) {
        linenr = view_getlinenr_left(view, i);

        if (linenr > 0) {

            if (left_first == 0) {
                left_first = linenr;
            }
            left_first = min(left_first, linenr);
            left_last = max(left_last, linenr);
        }

        linenr = view_getlinenr_right(view, i);
        if (linenr > 0) {
            if (right_first == 0) {
                right_first = linenr;
            }
            right_first = min(right_first, linenr);
            right_last = max(right_last, linenr);
        }
    }

    /* draw the two markers as thick bars -> elongated rectangles */
    rcLeft.top = MulDiv(left_first-1, cy, total_lines);
    rcLeft.bottom = MulDiv(left_last, cy, total_lines);
    FillRect(hdc, &rcLeft, hbrSideBar);

    rcRight.top = MulDiv(right_first-1, cy, total_lines);
    rcRight.bottom = MulDiv(right_last, cy, total_lines);
    FillRect(hdc, &rcRight, hbrSideBar);

    /* get rid of the dc if we made it ourselves */
    if (hdcIn == NULL) {
        ReleaseDC(hwndBar, hdc);
    }
}

int FAR PASCAL FindDlgProc | ( | HWND | hDlg,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 46 of file findgoto.cpp.

{
  HRESULT hr;
  switch (message)
    {
    case WM_INITDIALOG:
      {
      char rgchFindString[CCH_FINDSTRING];
      char rgchKey[32];
      int iString = 0;
      const BOOL fDown      = GetProfileInt(APPNAME, szFindSearchDown, 1);
      const BOOL fMatchCase = GetProfileInt(APPNAME, szFindMatchCase, 0);
      const BOOL fWholeWord = GetProfileInt(APPNAME, szFindWholeWord, 0);

      CheckDlgButton(hDlg, ((!fDown) ? IDC_OPT_UP : IDC_OPT_DOWN), BST_CHECKED);
      CheckDlgButton(hDlg, IDC_CHK_MATCHCASE, ((fMatchCase) ? BST_CHECKED : BST_UNCHECKED));
      CheckDlgButton(hDlg, IDC_CHK_WHOLEWORD, ((fWholeWord) ? BST_CHECKED : BST_UNCHECKED));
      SendDlgItemMessage(hDlg, IDC_DRD_FINDWHAT, CB_RESETCONTENT, 0, 0L);
      SendDlgItemMessage(hDlg, IDC_DRD_FINDWHAT, EM_LIMITTEXT, CCH_FINDSTRING, 0L);

      for (iString = 0; iString < NUM_FINDSTRINGS; iString++)
        {
        hr = StringCchPrintf(rgchKey, 32, szFindStringXX, iString);
    if (FAILED(hr))
      OutputError(hr, IDS_SAFE_PRINTF);
        if ( !GetProfileString(APPNAME, rgchKey, "", rgchFindString, CCH_FINDSTRING)
          || !*rgchFindString)
          {
          break;
          }

        SendDlgItemMessage(hDlg, IDC_DRD_FINDWHAT, CB_INSERTSTRING, (WPARAM)-1, (LPARAM) rgchFindString);
        }

      return TRUE;
      }

    case WM_COMMAND:
      switch (wParam)
        {
        case IDOK:
          {
          char rgchText[CCH_FINDSTRING];
          const BOOL fWholeWord = (IsDlgButtonChecked(hDlg, IDC_CHK_WHOLEWORD) == BST_CHECKED);

          WriteProfileInt(APPNAME, szFindSearchDown, (IsDlgButtonChecked(hDlg, IDC_OPT_DOWN) == BST_CHECKED));
          WriteProfileInt(APPNAME, szFindMatchCase,  (IsDlgButtonChecked(hDlg, IDC_CHK_MATCHCASE) == BST_CHECKED));
          WriteProfileInt(APPNAME, szFindWholeWord,  fWholeWord);

          SendDlgItemMessage(hDlg, IDC_DRD_FINDWHAT, WM_GETTEXT, CCH_FINDSTRING, (LPARAM) rgchText);
          if (*rgchText)
            {
            const LONG iCol = (view_isexpanded(current_view)) ? 2 : 1;
            char rgchBuf[CCH_FINDSTRING];
            char rgchKey[32];
            int iRet = (int) SendDlgItemMessage(hDlg, IDC_DRD_FINDWHAT, CB_FINDSTRINGEXACT, (WPARAM)-1, (LPARAM) rgchText);
            int iString = 0;

            if (iRet != CB_ERR)
              {
              iString = iRet;

              do
                {
                SendDlgItemMessage(hDlg, IDC_DRD_FINDWHAT, CB_GETLBTEXT, iString, (LPARAM) rgchBuf);
                if (!My_mbsncmp((LPCSTR) rgchText, (LPCSTR) rgchBuf, CCH_FINDSTRING))
                  {
                  /* delete the string out of its old place */
                  SendDlgItemMessage(hDlg, IDC_DRD_FINDWHAT, CB_DELETESTRING, iString, 0L);
                  break;
                  }

                iString = (int) SendDlgItemMessage(hDlg, IDC_DRD_FINDWHAT, CB_FINDSTRINGEXACT, iString, (LPARAM) rgchText);
                } while (iString != CB_ERR && iString != iRet);
              }

            /* insert the new string at index zero */
            SendDlgItemMessage(hDlg, IDC_DRD_FINDWHAT, CB_INSERTSTRING, 0, (LPARAM) rgchText);

            for (iString = 0; iString < NUM_FINDSTRINGS; iString++)
              {
              *rgchBuf = 0;
              iRet = (int) SendDlgItemMessage(hDlg, IDC_DRD_FINDWHAT, CB_GETLBTEXT, iString, (LPARAM) rgchBuf);
              if (iRet <= 0 || iRet == CB_ERR || !*rgchBuf)
                break;

              hr = StringCchPrintf(rgchKey, 32, szFindStringXX, iString);
        if (FAILED(hr))
          OutputError(hr, IDS_SAFE_PRINTF);
              WriteProfileString(APPNAME, rgchKey, rgchBuf);
              }

            /* don't end the dlg if we didn't find a match */
            if (!FindString(hDlg, iCol, rgchText, 0, ((fWholeWord) ? 1 : -1)))
              return TRUE;
            }

          EndDialog(hDlg, wParam);
          return TRUE;
          }

        case IDCANCEL:
          EndDialog(hDlg, wParam);
          return TRUE;
        }
    }

  return FALSE;
}

int FAR PASCAL GoToLineDlgProc | ( | HWND | hDlg,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 162 of file findgoto.cpp.

{
  switch (message)
    {
    case WM_INITDIALOG:
      SendDlgItemMessage(hDlg, IDC_EDT_GOTOLINE, EM_LIMITTEXT, CCH_MAXDIGITS, 0L);
      SendDlgItemMessage(hDlg, IDC_EDT_GOTOLINE, WM_SETTEXT, 0, (LPARAM) "1");
      return TRUE;

    case WM_COMMAND:
      switch (wParam)
        {
        case IDOK:
          {
          const LONG lMax = view_getrowcount(current_view);
          char *pchT = NULL;
          int cNumeric = 0;
          char rgchBuf[256];

          SendDlgItemMessage(hDlg, IDC_EDT_GOTOLINE, WM_GETTEXT, CCH_MAXDIGITS + 1, (LPARAM) rgchBuf);

          /* eat leading whitespace */
          for (pchT = rgchBuf; *pchT && isspace(*pchT); pchT = CharNext(pchT))
            NULL;

          for (NULL; *pchT; pchT = CharNext(pchT))
            {
            if (IsDBCSLeadByte(*pchT) || !isdigit(*pchT))
              break;

            cNumeric++;
            }

          /* if we didn't reach the end of the string, we have an invalid numeric string */
          if (!cNumeric)
            {
            MessageBox(hDlg, LoadRcString(IDS_GOTOLINE_INVALIDSTRING), szSdkDiff, MB_OK|MB_ICONSTOP|MB_TASKMODAL);
            return TRUE;
            }

          /* terminate the string after the numeric chars */
          *pchT = 0;

          /* go find the string */
          if (!FindString(hDlg, 0, rgchBuf, 1, 1))
            return TRUE;

          EndDialog(hDlg, wParam);
          return TRUE;
          }

        case IDCANCEL:
          EndDialog(hDlg, wParam);
          return TRUE;
        }
    }

  return FALSE;
}

BOOL InitBarClass ( HINSTANCE hInstance )

Definition at line 65 of file bar.cpp.

{
    WNDCLASS    wc;
    BOOL resp;

    wc.style = CS_HREDRAW | CS_VREDRAW;
    wc.lpfnWndProc = (WNDPROC)BarWndProc;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = 0;
    wc.hInstance = hInstance;
    wc.hIcon = NULL;
    wc.hCursor = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
    wc.lpszClassName = (LPSTR) "BarClass";
    wc.lpszMenuName = NULL;

    resp = RegisterClass(&wc);
    InitHashChars();

    return(resp);
}

BOOL Poll ( void )

Definition at line 1557 of file sdkdiff.cpp.

{
    MSG msg;

    /* don't do the message loop in the WIN32 version since we
     * have multiple threads to handle that, and this is being called
     * on a worker thread, not the UI thread.
     *
     * in the WIN32 case, just check for abort requests
     */

    /* message loop */
    while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
        if (!TranslateAccelerator(hwndClient, haccel, &msg)) {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
    }

    return(bAbort);
}

void sdkdiff_UI ( BOOL bAttach )

Definition at line 589 of file sdkdiff.cpp.

{
    DWORD dwThreadId = GetCurrentThreadId();
    if (dwThreadId==gdwMainThreadId) return;

    if (bAttach) GetDesktopWindow();
    AttachThreadInput(dwThreadId, gdwMainThreadId, bAttach);
} /* sdkdiff_UI */

void SetNames ( LPSTR names )

Definition at line 2510 of file sdkdiff.cpp.

{
    SendMessage(hwndStatus, SM_SETTEXT, IDL_NAMES, (LPARAM) names);
    if (names == NULL) {
        AppTitle[0] = '\0';
    } else {
        My_mbsncpy(AppTitle, names, sizeof(AppTitle));
    }
}

void SetStatus ( LPSTR state )

Definition at line 2488 of file sdkdiff.cpp.

{
    SendMessage(hwndStatus, SM_SETTEXT, IDL_STATLAB, (LPARAM) cmd);
}

Variable Documentation

BOOL __BERR

Definition at line 209 of file sdkdiff.cpp.

BOOL bDBCS

Definition at line 511 of file sdkdiff.cpp.

BOOL bJapan

Definition at line 510 of file sdkdiff.cpp.

int expand_include

Definition at line 530 of file sdkdiff.cpp.

int expand_mode

Definition at line 528 of file sdkdiff.cpp.

int g_tabwidth

Definition at line 539 of file sdkdiff.cpp.

HANDLE hHeap

Definition at line 94 of file FaxSiren.Cpp.

BOOL hide_markedfiles

Definition at line 535 of file sdkdiff.cpp.

HINSTANCE hInst

Definition at line 37 of file Demo.c.

HWND hwndClient

Definition at line 456 of file sdkdiff.cpp.

HWND hwndRCD

Definition at line 457 of file sdkdiff.cpp.

BOOL ignore_blanks

Definition at line 531 of file sdkdiff.cpp.

int line_numbers

Definition at line 527 of file sdkdiff.cpp.

int outline_include

Definition at line 529 of file sdkdiff.cpp.

DWORD rgb_barcurrent

Definition at line 333 of file sdkdiff.cpp.

DWORD rgb_barleft

Definition at line 331 of file sdkdiff.cpp.

DWORD rgb_barright

Definition at line 332 of file sdkdiff.cpp.

DWORD rgb_leftback

Definition at line 315 of file sdkdiff.cpp.

DWORD rgb_leftfore

Definition at line 314 of file sdkdiff.cpp.

DWORD rgb_mleftback

Definition at line 326 of file sdkdiff.cpp.

DWORD rgb_mleftfore

Definition at line 325 of file sdkdiff.cpp.

DWORD rgb_mrightback

Definition at line 328 of file sdkdiff.cpp.

DWORD rgb_mrightfore

Definition at line 327 of file sdkdiff.cpp.

DWORD rgb_outlinehi

Definition at line 311 of file sdkdiff.cpp.

DWORD rgb_rightback

Definition at line 317 of file sdkdiff.cpp.

DWORD rgb_rightfore

Definition at line 316 of file sdkdiff.cpp.

BOOL show_whitespace

Definition at line 532 of file sdkdiff.cpp.

const CHAR szSdkDiff[]

Definition at line 245 of file sdkdiff.cpp.

BOOL TrackDifferent

Definition at line 544 of file sdkdiff.cpp.

BOOL TrackLeftOnly

Definition at line 541 of file sdkdiff.cpp.

BOOL TrackReadonly

Definition at line 545 of file sdkdiff.cpp.

BOOL TrackRightOnly

Definition at line 542 of file sdkdiff.cpp.

BOOL TrackSame

Definition at line 543 of file sdkdiff.cpp.

Generated on Wed Nov 13 2024 16:53:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/sdkdiff/section.cpp File Reference

  • Begin
  • sdkdiff
Classes | Typedefs | Functions

section.cpp File Reference

#include "precomp.h"
#include "tree.h"
#include "state.h"
#include "sdkdiff.h"
#include "wdiffrc.h"
#include "list.h"
#include "line.h"
#include "section.h"

Go to the source code of this file.

Classes

struct | section

Typedefs

typedef BYTE | bitmap [32]
typedef LINE(APIENTRY * | MOVEPROC )(LINE)

Functions

BOOL | AbsorbAnyBlanks (LINE *from, LINE limit, MOVEPROC Move)
void | AndMaps (bitmap res, bitmap a, bitmap b)
int | BitsInMap (bitmap bm)
LINE | FindEndOfMatched (LINE line)
LINE | FindEndOfUnmatched (LINE line)
LINE | FindFirstWithLink (LINE first, LINE last)
BOOL | LinesMatch (LINE Left, LINE Right)
void | MakeMap (bitmap bm, LPSTR str)
LINE | NextNonIgnorable (LINE line)
void | OrMaps (bitmap res, bitmap a, bitmap b)
void | section_delete (SECTION section)
void | section_deletelist (LIST sections)
BOOL | section_expandanchor (SECTION sec1, LINE line1, SECTION sec2, LINE line2)
SECTION section_getcorrespond (SECTION section)
LINE section_getfirstline (SECTION section)
LINE section_getlastline (SECTION section)
int | section_getleftbasenr (SECTION section)
int | section_getlinecount (SECTION section)
SECTION section_getlink (SECTION section)
int | section_getrightbasenr (SECTION section)
int | section_getstate (SECTION section)
LIST | section_makecomposite (LIST secsleft, LIST secsright)
TREE | section_makectree (SECTION sec)
LIST | section_makelist (LIST linelist, BOOL left)
BOOL | section_match (SECTION sec1, SECTION sec2, BOOL ReSynch)
BOOL | section_matchlists (LIST secsleft, LIST secsright, BOOL bDups)
SECTION | section_new (LINE first, LINE last, LIST list)
void | section_setleftbasenr (SECTION section, int base)
void | section_setrightbasenr (SECTION section, int base)
void | section_setstate (SECTION section, int state)
void | section_takesection (LIST compo, SECTION left, SECTION right, int state)
void | TakeTwoSections (LIST compo, SECTION left, SECTION right)

Typedef Documentation

typedef BYTE bitmap[32]

Definition at line 893 of file section.cpp.

typedef LINE(APIENTRY * MOVEPROC)(LINE)

Definition at line 1241 of file section.cpp.

Function Documentation

BOOL AbsorbAnyBlanks | ( | LINE * | from,
 |  | LINE | limit,
 |  | MOVEPROC | Move
 | ) |  |

Definition at line 1250 of file section.cpp.

{       BOOL progress = FALSE;

        while ( (from!=NULL)
              && (line_isblank(*from))
              && (*from!=limit)
              ) {
                *from = Move(*from);
                progress = TRUE;
        }
        return progress;
} /* AbsorbAnyBlanks */

void AndMaps | ( | bitmap | res,
 |  | bitmap | a,
 |  | bitmap | b
 | ) |  |

Definition at line 913 of file section.cpp.

{   int i;
    for (i=0; i<32; ++i)
        res[i] = (char)(a[i] & b[i]);
}

int BitsInMap ( bitmap bm )

Definition at line 932 of file section.cpp.

{   int i;
    int j;
    int cb = 0;                  /* bit count */

    for (i=0; i<32; ++i)         /* for each byte in bm */
    {  for( j=0; j<8; ++j)       /*    for each bit in byte */
       {  if (bm[i] & (1<<j))    /*    if the bit is set  */
              ++cb;
       }
    }
    return cb;
} /* BitsInMap */

LINE FindEndOfMatched ( LINE line )

Definition at line 454 of file section.cpp.

{
        LINE next;              /* next non-ignored or linked line */
        LINE nextlink;          /* next in other file */

        /* The basic algorithm is to set up next and nextlink to point to
           candidate lines.  Examine them.  If they are good then step
           on to them, else return the line one before.
           There are confusion factors associated with the beginning and
           end of the file.
        */

        if (line==NULL) TRACE_ERROR("FindEndOfMatched called with NULL", FALSE);

        /* As a section (at least at the start of the file) might start
           with an ignored non-linked blank line, first step over any such
        */
        if( line_getlink(line)==NULL && line_isblank(line) ) {
                next = NextNonIgnorable(line);

                /* There are unfortunately 6 cases to deal with
                   * marks where next will be. * against eof means next==NULL
                   blank(s) refer to ignorable unlinked blanks.
                          A         B        C        D        E        F
                   line-> xxxxx     xxxxx    xxxxx    xxxxx    xxxxx    xxxxx
                         *unlinked  blanks  *linked   blanks  *eof     *blanks
                                   *unlinked         *linked            eof

                   next could be:

                      null - case E => return line
                      unlinked ignorable blank - case F => return that blank line
                      unlinked other - cases A,B return prev(that unlinked line)
                      linked - cases C,D continue from that linked line
                */
                if (next==NULL) return line;
                if (line_getlink(next)==NULL) {
                        if (ignore_blanks && line_isblank(next)) {
                                return next;
                        }
                        return (LINE)List_Prev(next);
                }

                line = next;
        }

        /* we have stepped over inital blanks and now do have a link */
        if (line_getlink(line)==NULL)
                TRACE_ERROR("!!FindEndOfMatched -- no link!!", FALSE);

        for ( ; ; ) {

                next = NextNonIgnorable(line);
                /* Same 6 cases - basically same again */
                if (next==NULL) return line;
                if (line_getlink(next)==NULL) {
                        if (ignore_blanks && line_isblank(next)) {
                                return next;
                        }
                        return (LINE)List_Prev(next);
                }

                nextlink = NextNonIgnorable(line_getlink(line));

                /* WEAK LOOP INVARIANT
                   line is linked.
                   next is the next non-ignorable line in this list after line.
                   nextlink is the next non-ignorable line after link(line)
                                        in the other list (could be NULL etc).
                */
                if (line_getlink(next) != nextlink)
          return (LINE)List_Prev(next);

                line = next;
        }
} /* FindEndOfMatched */

LINE FindEndOfUnmatched ( LINE line )

Definition at line 398 of file section.cpp.

{
        LINE next;

        for (; ; )
        {       next = (LINE)List_Next(line);
                if (next==NULL) return line;
                if (line_getlink(next)!=NULL) return line;
                line = next;
        }
} /* FindEndOfUnmatched */

LINE FindFirstWithLink | ( | LINE | first,
 |  | LINE | last
 | ) |  |

Definition at line 615 of file section.cpp.

{
        /* The strategy of including blanks on the ENDS of sections rather
           than the start of new sections will mean that this function
           usually strikes gold immediately.  A file with a leading
           blank section is its raison d'etre.
        */
#ifdef trace
        LINE hold = first;
#endif
        while (line_getlink(first)==NULL && first!=last)
                first = (LINE)List_Next(first);

        if (line_getlink(first)==NULL) {
#ifdef trace
                char msg[80];
                StringCchPrintf( msg, 80
                        , "???FindFirstWithLink found an unlinked section: %d..%d\r\n"
                        , line_getlinenr(hold)
                        , line_getlinenr(first)
                        );
                if (bTrace) Trace_File(msg);
#endif
        }
        return first;
} /* FindFirstWithLink */

BOOL LinesMatch | ( | LINE | Left,
 |  | LINE | Right
 | ) |  |

Definition at line 962 of file section.cpp.

{   LPSTR LText = line_gettext(Left);
    LPSTR RText = line_gettext(Right);
    bitmap bmLeft;
    bitmap bmRight;
    bitmap bmBoth;
    bitmap bmEither;
    int nBoth;
    int nEither;

    MakeMap(bmLeft, LText);
    MakeMap(bmRight, RText);
    AndMaps(bmBoth, bmLeft, bmRight);
    OrMaps(bmEither, bmLeft, bmRight);
    nBoth = BitsInMap(bmBoth);
    nEither = BitsInMap(bmEither);

    return  (nBoth*4 >= nEither*3);    /* magic ratio is 3/4 */
} /* LinesMatch */

void MakeMap | ( | bitmap | bm,
 |  | LPSTR | str
 | ) |  |

Definition at line 900 of file section.cpp.

{   int i;
    for (i=0; i<32; ++i)  bm[i] = 0;   /* clear it (yeah, could use memset) */
    for (i=0; str[i]!='\0'; ++i)       /* for each char */
    {   UINT v = ((UINT)str[i]) & 0x000000ff;   /* 0..256, No negatives! */
        bm[v/8] = BYTE(bm[v/8] | (1<<v%8));
    }
} /* MakeMap */

LINE NextNonIgnorable ( LINE line )

Definition at line 422 of file section.cpp.

{       LINE next;
        if (  line_getlink(line)==NULL
           && ! (ignore_blanks && line_isblank(line))
           )
                TRACE_ERROR("!!Bad call to NextNonIgnorable!!", FALSE);

        next = (LINE)List_Next(line);
        if (next==NULL) return NULL;
        for (; ; ) {
                line = next;
                if (  line_getlink(line)!=NULL) return line;
                if (! ignore_blanks)            return line;
                if (! line_isblank(line))       return line;
                next = (LINE)List_Next(line);
                if (next==NULL) return line;
        }
} /* NextNonIgnorable */

void OrMaps | ( | bitmap | res,
 |  | bitmap | a,
 |  | bitmap | b
 | ) |  |

Definition at line 923 of file section.cpp.

{   int i;
    for (i=0; i<32; ++i)
        res[i] = (char)(a[i] | b[i]);
}

void section_delete ( SECTION section )

Definition at line 124 of file section.cpp.

{
        if (section->bDiscard) {
                HeapFree(GetProcessHeap(), NULL, section);
        }
}

void section_deletelist ( LIST sections )

Definition at line 605 of file section.cpp.

{
        List_Destroy(&sections);
}

BOOL section_expandanchor | ( | SECTION | sec1,
 |  | LINE | line1,
 |  | SECTION | sec2,
 |  | LINE | line2
 | ) |  |

Definition at line 1272 of file section.cpp.

{
        /* when a line is matched we set bChanges.  If we notice some
         * blank lines, but do NOT link any new non-blank lines, we
         * do NOT set bChanges.  (If we did it would cause a closed
         * loop as they would get noticed again next time.  line_link
         * only returns TRUE if it is a NEW link).
         * At this stage we are only interested in making links, not in
         * the size of the section that results (that fun comes later).
         * therefore trailing blanks at the end of a section are not
         * interesting and we don't look for them.
         */
        BOOL bChanges = FALSE;
        LINE left, right;

        /* We handle the section limits by using a sentinel which is one
         * past the end of the section.  (If the section ends at the end
         * of the list then the sentinel is NULL).
         */
        LINE leftend, rightend;
        leftend = (LINE)List_Next(sec1->last);
        rightend = (LINE)List_Next(sec2->last);

#ifdef trace
        {       char msg[120];
                StringCchPrintf( msg, 120, "expanding anchor at %d<->%d in sections %d..%d <-> %d..%d\r\n"
                        , line_getlinenr(line1)
                        , line_getlinenr(line2)
                        , line_getlinenr(sec1->first)
                        , line_getlinenr(sec1->last)
                        , line_getlinenr(sec2->first)
                        , line_getlinenr(sec2->last)
                        );
                if (bTrace) Trace_File(msg);
        }
#endif

        /* null lines shall not match */
        if ((line1 == NULL) || (line2 == NULL)) {
                return(FALSE);
        }

        /* check all lines forward until fail to link (because null,
         * not matching, or already linked).
         * include the passed in anchor point since this has not
         * yet been linked.
         * If blanks are ignorable then skip over any number of whole
         * blank lines.
         */
        left = line1;
        right = line2;
        for (; ; ) {
                if (line_link(left, right) ) {

                        bChanges = TRUE;
                        left = (LINE)List_Next(left);
                        right = (LINE)List_Next(right);
                        if (left==leftend || right==rightend) break;
                }
                else if (ignore_blanks){
                        /* even though no match, maybe an ignorable blank? */

                        BOOL moved = FALSE;
                        moved |= AbsorbAnyBlanks(&left, leftend, (MOVEPROC)List_Next);
                        moved |= AbsorbAnyBlanks(&right, rightend, (MOVEPROC)List_Next);
                        if (!moved) break; /* it didn't match and we didn't move on */
                        if (left==leftend || right==rightend) break;
                }
                else break;
        }

#ifdef trace
        {       char msg[120];
                StringCchPrintf( msg, 120, "marched forwards to (the line before) %d<->%d\r\n"
                        , (left==NULL ? 9999 : line_getlinenr(left))
                        , (right==NULL ? 9999 : line_getlinenr(right))
                        );
                if (bTrace) Trace_File(msg);
        }
#endif

        /* check all matches going backwards from anchor point
           but only if it was a real anchor  (could have been
           end-of-section/end-of-file and non-matching).
        */
        if (line_getlink(line1)==NULL) return bChanges;

        left = (LINE)List_Prev(line1);
        right = (LINE)List_Prev(line2);
        if (left==NULL || right==NULL) return bChanges;

        leftend = (LINE)List_Prev(sec1->first);
        rightend = (LINE)List_Prev(sec2->first);

        for (; ; ) {
                if (line_link(left, right)) {

                        bChanges = TRUE;
                        left = (LINE)List_Prev(left);
                        right = (LINE)List_Prev(right);
                        if (left == leftend || right == rightend) break;

                }
                else if (ignore_blanks){
                        /* even though no match, maybe an ignorable blank? */

                        BOOL moved = FALSE;
                        moved |= AbsorbAnyBlanks(&left, leftend, (MOVEPROC)List_Prev);
                        moved |= AbsorbAnyBlanks(&right, rightend, (MOVEPROC)List_Prev);
                        if (!moved) break; /* it didn't match and we didn't move on */
                        if (left==leftend || right==rightend) break;

                }
                else break;
        }

#ifdef trace
        {       char msg[120];
                StringCchPrintf( msg, 120, "marched backwards to (the line after) %d<->%d\r\n"
                        , (left==NULL ? 0 : line_getlinenr(left))
                        , (right==NULL ? 0 : line_getlinenr(right))
                        );
                if (bTrace) Trace_File(msg);
        }
#endif

        return(bChanges);
}

SECTION section_getcorrespond ( SECTION section )

Definition at line 289 of file section.cpp.

{
        if (section == NULL) {
                return(NULL);
        }
        return(section->correspond);
}

LINE section_getfirstline ( SECTION section )

Definition at line 251 of file section.cpp.

{
        if (section == NULL) {
                return(NULL);
        }
        return(section->first);
}

LINE section_getlastline ( SECTION section )

Definition at line 263 of file section.cpp.

{
        if (section == NULL) {
                return(NULL);
        }
        return(section->last);
}

int section_getleftbasenr ( SECTION section )

Definition at line 342 of file section.cpp.

{
        return(section->leftbase);
}

int section_getlinecount ( SECTION section )

Definition at line 320 of file section.cpp.

{
        if (section->last==NULL && section->first==NULL)
                return 0;   /* the thing below would return 1! */
        if (section->first==NULL || section->last==NULL)
                TRACE_ERROR("SECTION: null first or last (but not both) in getlinecount call", FALSE);

        return(line_getlinenr(section->last) -
                        line_getlinenr(section->first)) + 1;
}

SECTION section_getlink ( SECTION section )

Definition at line 276 of file section.cpp.

{
        if (section == NULL) {
                return NULL;
        }
        return(section->link);
}

int section_getrightbasenr ( SECTION section )

Definition at line 354 of file section.cpp.

{
        return(section->rightbase);
}

int section_getstate ( SECTION section )

Definition at line 299 of file section.cpp.

{
        if (section == NULL) {
                TRACE_ERROR("SECTION: null section in getstate call", FALSE);
                return(0);
        }
        return(section->state);
}

LIST section_makecomposite | ( | LIST | secsleft,
 |  | LIST | secsright
 | ) |  |

Definition at line 1117 of file section.cpp.

{
        SECTION left, right;
        LIST compo;

        /* make an empty list for the composite */
        compo = List_Create();

        left = (SECTION)List_First(secsleft);
        right = (SECTION)List_First(secsright);

        while ( (left != NULL) || (right != NULL)) {

                if (left == NULL) {
                        /* no more in left list - take right section */
                        /* is it moved or just unmatched ? */
                        if (right->link == NULL) {
                                section_takesection(compo, NULL, right, STATE_RIGHTONLY);
                                right = (SECTION)List_Next(right);
                        } else {
                                section_takesection(compo, right->link, right, STATE_MOVEDRIGHT);
                                right = (SECTION)List_Next(right);
                        }
                } else if (right == NULL) {
                        /* right list empty - must be left next */

                        /* is it moved or just unmatched ? */
                        if (left->link == NULL) {
                                section_takesection(compo, left, NULL, STATE_LEFTONLY);
                                left = (SECTION)List_Next(left);
                        } else {
                                section_takesection(compo, left, left->link, STATE_MOVEDLEFT);
                                left = (SECTION)List_Next(left);
                        }

                } else if (left->state == STATE_LEFTONLY) {
                        /* unlinked section on left */
                        if (left->correspond==right) {
                            TakeTwoSections( compo, left, left->correspond );
                            left = (SECTION)List_Next(left);
                            right = (SECTION)List_Next(right);
                        } else {
                            /* see picture below for when this might occur */
                            section_takesection(compo, left, NULL, STATE_LEFTONLY);
                            left = (SECTION)List_Next(left);
                        }

                } else if (left->link==NULL) {
                        /* This is an ignorable blank section on the left.
                         * We ignore it. (We will take any such from the right)
                         */
                        left = (SECTION)List_Next(left);

                } else if (left->link->state==STATE_MARKED) {
                        /* left is linked to section that is already taken*/
                        section_takesection(compo, left, left->link, STATE_MOVEDLEFT);
                        left = (SECTION)List_Next(left);

                } else  if (right->link == NULL) {
                        /* take unlinked section on right
                         * Either unmatched or ignorable blanks
                         */
                        section_takesection(compo, NULL, right, right->state);
                        right = (SECTION)List_Next(right);

                } else if (right->link->state==STATE_MARKED) {
                        /* right is linked to section that's already taken */
                        section_takesection(compo, right->link, right, STATE_MOVEDRIGHT);
                        right = (SECTION)List_Next(right);

                } else if (left->link == right) {
                        /* sections match */
                        section_takesection(compo, left, right, STATE_SAME);
                        right = (SECTION)List_Next(right);
                        left = (SECTION)List_Next(left);
                } else {
                        /* both sections linked to forward sections
                         * Original idea was to go by section size and
                         * take smallest first as a move so that larger one is
                         * unchanged.  Counter example is test file blanks2
                         *
                         *   Files     Good version    Not so good
                         *  A     A       A---A          A---A
                         *  B-   -A         ->A RR    LL B->
                         *  C | | A         ->A RR    LL C
                         *  D  -+-B       B---B       LL D
                         *  E   | c       C   c       LL E->
                         *  A---  d       D   d          A---A
                         *  A     E       E---E          A---A
                         *  A     A       A->              ->B
                         *  A             A->                c
                         *                A---A              d
                         *                A                ->E
                         *                               A---A
                         *                               A
                         *
                         * A better scheme looks at the distances marked
                         * above as RR and LL and take as moved the block that results
                         * in the shortest such distance.
                         * Let LeftDist = linenr(right->link) - linenr(left)
                         *       i.e. 5 in the example above  (the LL lines)
                         * Let RightDist = linenr(left->link) - linenr(right)
                         *       i.e. 3 in the example above  (the RR lines)
                         *
                         * if LeftDist > RightDist then treat right as moved
                         * and take it first.
                         */
                        if ( line_getlinenr(right->link->first) - line_getlinenr(left->first)
                           > line_getlinenr(left->link->first)  - line_getlinenr(right->first)
                           )
                        {
                                section_takesection(compo, right->link, right, STATE_MOVEDRIGHT);
                                right = (SECTION)List_Next(right);
                        } else {
                                section_takesection(compo, left, left->link, STATE_MOVEDLEFT);
                                left = (SECTION)List_Next(left);
                        }

                }
        }

        return(compo);
} /* section_makecomposite */

TREE section_makectree ( SECTION sec )

Definition at line 1412 of file section.cpp.

{
        TREE tree;
        LINE line;

        /* make an empty tree */
        tree = ctree_create();

        for (line = sec->first; line != NULL; line = (LINE)List_Next(line)) {
                if (line_getlink(line) == NULL) {
                        ctree_update(tree, line_gethashcode(line),
                                        &line, sizeof(LINE));
                }
                if (line == sec->last) {
                        break;
                }
        }
        return(tree);
}

LIST section_makelist | ( | LIST | linelist,
 |  | BOOL | left
 | ) |  |

Definition at line 545 of file section.cpp.

{
        LINE line1, line2;
        LIST sections;
        BOOL matched;
        SECTION sect;

        /* make an empty list of sections */
        sections = List_Create();

        /* for each line in the list */
    for( line1=(LINE)List_First(linelist);  line1!=NULL;  line1 = (LINE)List_Next((LPVOID)line1)) {

                /* is it linked ? */

                if( line_getlink(line1) != NULL
                  || ( ignore_blanks && line_isblank(line1))
                  ) {
                        line2 = FindEndOfMatched(line1);
                        matched = TRUE;
                } else {
                        line2 = FindEndOfUnmatched(line1);
                        matched = FALSE;
                }

                /* create the section and add to list */
                sect = section_new(line1, line2, sections);
                sect->state = (matched ? STATE_SAME
                                       : left ? STATE_LEFTONLY
                                              : STATE_RIGHTONLY
                              );

#ifdef trace
                {       char msg[80];
                        StringCchPrintf( msg, 80
                                , "Created section: lines %d..%d of %s %s\r\n"
                                , line_getlinenr(line1)
                                , line_getlinenr(line2)
                                , (left ? "left" : "right")
                                , (matched ? "matching" : "non-matched")
                                );
                        if (bTrace) Trace_File(msg);
                }
#endif

                /* advance to end of section (no-op if 1 line section) */
                line1 = line2;
        }

        return(sections);
} /* section_makelist */

BOOL section_match | ( | SECTION | sec1,
 |  | SECTION | sec2,
 |  | BOOL | ReSynch
 | ) |  |

Definition at line 165 of file section.cpp.

{
        TREE ctleft, ctright;
        LINE line, line2;
        BOOL bLinked = FALSE;

        if ((sec1 == NULL) || (sec2 == NULL)) {
                return(FALSE);
        }

        if ((sec1->first == NULL) || (sec2->first == NULL)) {
                return(FALSE);
        }
        /* ASSERT if first is non-null, so is last */

        /* attempt to link the first line of each file, and
         * if matched, expand as long as we keep matching
         */
        bLinked |= section_expandanchor(sec1, sec1->first, sec2, sec2->first);

        /* build a tree of lines, indexed by the line hashcode.
         * a ctree will hold only the first value of any given key, but
         * it will keep track of the number of items inserted on this key.
         * thus we can keep count of the number of times this line
         * (or at least this hashcode) appears.
         */
        ctleft = section_makectree(sec1);
        ctright = section_makectree(sec2);

        /* for each unlinked line in one list (doesn't matter which), find if
         * it appears once only in each list. if so, link, and expand
         * the link to link lines before and after the matching line
         * as long as they continue to match.
         *
         * If ReSynch is set then accept lines which occur more than once in
         * each file (this matches the first copy in each file of lines which
         * are the same, but are non unique.  Heuristic: if the lines are short
         * (8 chars or fewer) then don't accept them.  It can waste a lot
         * of time matching spurious {, } or blank lines.
         */
        for (line = sec1->first; line != NULL; line = (LINE)List_Next(line)) {

                if (  (line_getlink(line) == NULL)
                   && (  ReSynch
                      ?  (  (ctree_getcount(ctleft, line_gethashcode(line)) >= 1)
                         && (ctree_getcount(ctright, line_gethashcode(line)) >= 1)
                         && (line_gettextlen(line) > 8)
                         )
                      :  (  (ctree_getcount(ctleft, line_gethashcode(line)) == 1)
                         && (ctree_getcount(ctright, line_gethashcode(line)) == 1)
                         )
                      )
                   ){

                        /* lines match */
                        line2 = * ((LINE FAR *)ctree_find(ctright,
                                        line_gethashcode(line)));
                        bLinked |= section_expandanchor(sec1, line, sec2, line2);
                }

                if (line == sec1->last) {
                        break;
                }
        }

        /* delete the ctrees */
        ctree_delete(ctleft);
        ctree_delete(ctright);

        /* attempt to link the last lines of each file and
         * expand upwards
         */
        bLinked |= section_expandanchor(sec1, sec1->last, sec2, sec2->last);

        return(bLinked);
} /* section_match */

BOOL section_matchlists | ( | LIST | secsleft,
 |  | LIST | secsright,
 |  | BOOL | bDups
 | ) |  |

Definition at line 656 of file section.cpp.

{
        BOOL bLinked = FALSE;
        SECTION sec1, sec2;

        /* match up linked sections - We know whether a section is
           supposed to link from its state, but we don't know what section
           it links to.  Also we can have sections which are defined to
           be matching but actually contain nothing but ignorable
           blank lines
        */

        /*  for each linked section try to find the section  linked to it. */
    for( sec1=(SECTION)List_First(secsleft);  sec1!=NULL;  sec1 = (SECTION)List_Next((LPVOID)sec1)) {
                if (sec1->state==STATE_SAME) {
                        LINE FirstWithLink = FindFirstWithLink(sec1->first, sec1->last);
#ifdef trace
                        {       char msg[80];
                                StringCchPrintf( msg, 80
                                        , "matchlists left matching section %d..%d \r\n"
                                        , line_getlinenr(sec1->first)
                                        , line_getlinenr(sec1->last)
                                        );
                                if (bTrace) Trace_File(msg);
                        }
#endif
            for( sec2=(SECTION)List_First(secsright);  sec2!=NULL;  sec2 = (SECTION)List_Next((LPVOID)sec2)) {
                                if ( sec2->state==STATE_SAME
                                   && line_getlink(FirstWithLink)
                                        == FindFirstWithLink(sec2->first, sec2->last)) {
                                            break;
                                }
                        }
                        /* sec2 could be NULL if sec1 is all allowable blanks */
                        if (sec2!=NULL) {
                                sec1->link = sec2;
                                sec2->link = sec1;
#ifdef trace
                                {       char msg[80];
                                        StringCchPrintf( msg, 80
                                                , "matchlists right matching section is %d..%d \r\n"
                                                , line_getlinenr(sec2->first)
                                                , line_getlinenr(sec2->last)
                                                );
                                        if (bTrace) Trace_File(msg);
                                }
#endif
                        }
                }
        }

        /* go through all unmatched sections. Note that we need to complete
         * the link-up of matching sections before this, since we need
         * all the links in place for this to work.
         */

    for( sec1=(SECTION)List_First(secsleft);  sec1!=NULL;  sec1 = (SECTION)List_Next((LPVOID)sec1)) {
                SECTION secTemp;

                if (sec1->state == STATE_SAME) {
                        /* skip the linked sections */
                        continue;
                }

                /* check that the previous and next sections, if
                 * they exist, are linked. this should not fail since
                 * two consecutive unlinked sections should be made into
                 * one section
                 */
                secTemp = (SECTION)List_Prev(sec1);
                if (secTemp && secTemp->state!= STATE_SAME) {
                        TRACE_ERROR("consecutive unlinked sections", FALSE);
                        continue;
                }
                secTemp = (SECTION)List_Next(sec1);
                if (secTemp && secTemp->state!= STATE_SAME) {
                        TRACE_ERROR("consecutive unlinked sections.", FALSE);
                        continue;
                }

                /* find the section that corresponds to this - that is, the
                 * section following the section linked to our previous section.
                 * we could be at beginning or end of list.
                 */
                if (List_Prev(sec1) != NULL) {
                        SECTION secOther;
                        secOther = section_getlink((SECTION)List_Prev(sec1));
                        if (secOther==NULL)
                                continue;

                        sec2 = (SECTION)List_Next(secOther);

                        /* check this section is not linked */
                        if ((sec2 == NULL) || (section_getlink(sec2) != NULL)) {
                                continue;
                        }

                        /* check that the section after these are linked
                         * to each other (or both are at end of list).
                         */
                        if (List_Next(sec1) != NULL) {

                                if (section_getlink((SECTION)List_Next(sec1)) !=
                                    List_Next(sec2)) {
                                        continue;
                                }
                        } else {
                                if (List_Next(sec2) != NULL) {
                                        continue;
                                }
                        }

                } else if (List_Next(sec1) != NULL) {
                        SECTION secOther;
                        secOther = section_getlink((SECTION)List_Next(sec1));
                        if (secOther==NULL)
                                continue;

                        sec2 = (SECTION)List_Prev(secOther);

                        /* check this section is not linked */
                        if ((sec2 == NULL) || (section_getlink(sec2) != NULL)) {
                                continue;
                        }

                        /* check that the section before these are linked
                         * to each other (or both are at start of list).
                         */
                        if (List_Prev(sec1) != NULL) {

                                if (section_getlink((SECTION)List_Prev(sec1)) !=
                                    List_Prev(sec2)) {
                                        continue;
                                }
                        } else {
                                if (List_Prev(sec2) != NULL) {
                                        continue;
                                }
                        }
                } else {
                        /* there must be at most one section in each
                         * file, and they are unmatched. make these correspond.
                         * (Though I don't think this would ever do anything except
                         * waste time by trying to link that which has already failed)
                         *
                         */
                        sec2 = (SECTION)List_First(secsright);
                }

                /* make the correspondence links
                 * we will want these for  zebra striping
                 */
                if ((sec1 != NULL) && (sec2 != NULL)) {
                        sec1->correspond = sec2;
                        sec2->correspond = sec1;
                }

                /* attempt to link up lines */
                if (section_match(sec1, sec2, bDups)) {
                        bLinked = TRUE;
                }
        }

        return(bLinked);
} /* section_matchlists */

SECTION section_new | ( | LINE | first,
 |  | LINE | last,
 |  | LIST | list
 | ) |  |

Definition at line 88 of file section.cpp.

{
        SECTION sec;

        /* alloc the sec and remember where we alloc-ed it */
        if (list)
        {
            sec = (SECTION) List_NewLast(list, sizeof(struct section));
            if (!sec)
                return NULL;
            sec->bDiscard = TRUE;
        }
        else
        {
            sec = (SECTION) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct section));
            if (!sec)
                return NULL;
            sec->bDiscard = FALSE;
        }

        sec->first = first;
        sec->last = last;
        sec->link = NULL;
        sec->correspond = NULL;
        sec->state = 0;
        sec->leftbase = 1;
        sec->rightbase = 1;

        return(sec);
}

void section_setleftbasenr | ( | SECTION | section,
 |  | int | base
 | ) |  |

Definition at line 348 of file section.cpp.

{
        section->leftbase = base;
}

void section_setrightbasenr | ( | SECTION | section,
 |  | int | base
 | ) |  |

Definition at line 360 of file section.cpp.

{
        section->rightbase = base;
}

void section_setstate | ( | SECTION | section,
 |  | int | state
 | ) |  |

Definition at line 310 of file section.cpp.

{
        section->state = state;
}

void section_takesection | ( | LIST | compo,
 |  | SECTION | left,
 |  | SECTION | right,
 |  | int | state
 | ) |  |

Definition at line 832 of file section.cpp.

{
        SECTION newsec;
        SECTION sec = NULL;

        /* select which section is being output, and change the state
         * to indicate it has been output
         */
        switch(state) {
        case STATE_SAME:
                /* both the same. we mark both as output, and
                 * take the right one.  It is possible that the
                 * left one could be NULL (an ignorable blank section)
                 */
                if (left!=NULL) left->state = STATE_MARKED;
                right->state = STATE_MARKED;
                sec = right;
                break;

        case STATE_LEFTONLY:
        case STATE_MOVEDLEFT:
                sec = left;
                left->state = STATE_MARKED;
                break;

        case STATE_RIGHTONLY:
        case STATE_MOVEDRIGHT:
                sec = right;
                right->state = STATE_MARKED;
                break;
        /* other cases e.g. SIMILARLEFT should not occur! */
        }

        /* create a new section on the list */
        newsec = section_new(sec->first, sec->last, compo);

        newsec->state = state;

        if (left != NULL) {
                newsec->leftbase = line_getlinenr(left->first);
        } else {
                newsec->leftbase = 0;
        }

        if (right != NULL) {
                newsec->rightbase = line_getlinenr(right->first);
        } else {
                newsec->rightbase = 0;
        }

} /* section_takesection */

void TakeTwoSections | ( | LIST | compo,
 |  | SECTION | left,
 |  | SECTION | right
 | ) |  |

Definition at line 1000 of file section.cpp.

{
        /* Algorithm:
           While there is something on each side,
              if the next lines match
              then take one line from each and make them into sections.
              else take everything that's left
           Finally take everything that's left (occurs if all matched until
                                                one side ran out)
        */

        SECTION NewL;
        SECTION NewR;
        LINE LLine = left->first;      /* first line left to process in left */
        LINE RLine = right->first;     /*   "    "    "   "   "      " right */

#ifdef trace
        DWORD Ticks = GetTickCount();  /* profiling */
#endif

        left->state = STATE_MARKED;
        right->state = STATE_MARKED;

        while(left!=NULL && right !=NULL) {

            if (LinesMatch(LLine, RLine)) {
                    NewL = section_new(LLine, LLine, compo);
                    NewL->state = STATE_SIMILARLEFT;
                    NewL->leftbase = line_getlinenr(LLine);
                    NewL->rightbase = line_getlinenr(RLine);

                    NewR = section_new(RLine, RLine, compo);
                    NewR->state = STATE_SIMILARRIGHT;
                    NewR->leftbase = line_getlinenr(LLine);
                    NewR->rightbase = line_getlinenr(RLine);

                    if (LLine == left->last) left = NULL;  /* done */
                    else LLine = (LINE)List_Next(LLine);
                    if (RLine == right->last) right = (SECTION)NULL;  /* done */
                    else RLine = (LINE)List_Next(RLine);
            } else {
                   /* lost synch - take all the rest with no more zebra stuff */
                    NewL = section_new(LLine, left->last, compo);
                    NewL->state = STATE_LEFTONLY;
                    NewL->leftbase = line_getlinenr(LLine);
                    NewL->rightbase = 0;
                    left = NULL;  /* done */

                    NewR = section_new(RLine, right->last, compo);
                    NewR->state = STATE_RIGHTONLY;
                    NewR->rightbase = line_getlinenr(RLine);
                    NewR->leftbase = 0;
                    right = NULL;  /* done */
            }
        }

        if (left!=NULL) {
            NewL = section_new(LLine, left->last, compo);
            NewL->state = STATE_LEFTONLY;
            NewL->leftbase = line_getlinenr(LLine);
            NewL->rightbase = 0;
        }
        if (right!=NULL) {
            NewR = section_new(RLine, right->last, compo);
            NewR->state = STATE_RIGHTONLY;
            NewR->rightbase = line_getlinenr(RLine);
            NewR->leftbase = 0;
        }

#ifdef trace
        Ticks = GetTickCount()-Ticks;
        ZebraTicks += Ticks;
        {   char Msg[80];
            StringCchPrintf(Msg, 80, "Zebra time %d, total zebra time %d\n", Ticks, ZebraTicks);
            Trace_File(Msg);
        }
#endif

} /* TakeTwoSections */

Generated on Wed Nov 13 2024 16:53:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/sdkdiff/section.h File Reference

  • Begin
  • sdkdiff
Typedefs | Functions

section.h File Reference

Go to the source code of this file.

Typedefs

typedef struct section FAR * | SECTION

Functions

void | section_delete (SECTION section)
void | section_deletelist (LIST sections)
SECTION section_getcorrespond (SECTION section)
LINE section_getfirstline (SECTION section)
LINE section_getlastline (SECTION section)
int | section_getleftbasenr (SECTION section)
int | section_getlinecount (SECTION section)
SECTION section_getlink (SECTION section)
int | section_getrightbasenr (SECTION section)
int | section_getstate (SECTION section)
LIST | section_makecomposite (LIST secsleft, LIST secsright)
LIST | section_makelist (LIST linelist, BOOL left)
BOOL | section_match (SECTION section1, SECTION section2, BOOL ReSynch)
BOOL | section_matchlists (LIST secsleft, LIST secsright, BOOL bDups)
SECTION | section_new (LINE first, LINE last, LIST list)
void | section_setstate (SECTION section, int state)

Typedef Documentation

typedef struct section FAR* SECTION

Definition at line 38 of file section.h.

Function Documentation

void section_delete ( SECTION section )

Definition at line 124 of file section.cpp.

{
        if (section->bDiscard) {
                HeapFree(GetProcessHeap(), NULL, section);
        }
}

void section_deletelist ( LIST sections )

Definition at line 605 of file section.cpp.

{
        List_Destroy(&sections);
}

SECTION section_getcorrespond ( SECTION section )

Definition at line 289 of file section.cpp.

{
        if (section == NULL) {
                return(NULL);
        }
        return(section->correspond);
}

LINE section_getfirstline ( SECTION section )

Definition at line 251 of file section.cpp.

{
        if (section == NULL) {
                return(NULL);
        }
        return(section->first);
}

LINE section_getlastline ( SECTION section )

Definition at line 263 of file section.cpp.

{
        if (section == NULL) {
                return(NULL);
        }
        return(section->last);
}

int section_getleftbasenr ( SECTION section )

Definition at line 342 of file section.cpp.

{
        return(section->leftbase);
}

int section_getlinecount ( SECTION section )

Definition at line 320 of file section.cpp.

{
        if (section->last==NULL && section->first==NULL)
                return 0;   /* the thing below would return 1! */
        if (section->first==NULL || section->last==NULL)
                TRACE_ERROR("SECTION: null first or last (but not both) in getlinecount call", FALSE);

        return(line_getlinenr(section->last) -
                        line_getlinenr(section->first)) + 1;
}

SECTION section_getlink ( SECTION section )

Definition at line 276 of file section.cpp.

{
        if (section == NULL) {
                return NULL;
        }
        return(section->link);
}

int section_getrightbasenr ( SECTION section )

Definition at line 354 of file section.cpp.

{
        return(section->rightbase);
}

int section_getstate ( SECTION section )

Definition at line 299 of file section.cpp.

{
        if (section == NULL) {
                TRACE_ERROR("SECTION: null section in getstate call", FALSE);
                return(0);
        }
        return(section->state);
}

LIST section_makecomposite | ( | LIST | secsleft,
 |  | LIST | secsright
 | ) |  |

Definition at line 1117 of file section.cpp.

{
        SECTION left, right;
        LIST compo;

        /* make an empty list for the composite */
        compo = List_Create();

        left = (SECTION)List_First(secsleft);
        right = (SECTION)List_First(secsright);

        while ( (left != NULL) || (right != NULL)) {

                if (left == NULL) {
                        /* no more in left list - take right section */
                        /* is it moved or just unmatched ? */
                        if (right->link == NULL) {
                                section_takesection(compo, NULL, right, STATE_RIGHTONLY);
                                right = (SECTION)List_Next(right);
                        } else {
                                section_takesection(compo, right->link, right, STATE_MOVEDRIGHT);
                                right = (SECTION)List_Next(right);
                        }
                } else if (right == NULL) {
                        /* right list empty - must be left next */

                        /* is it moved or just unmatched ? */
                        if (left->link == NULL) {
                                section_takesection(compo, left, NULL, STATE_LEFTONLY);
                                left = (SECTION)List_Next(left);
                        } else {
                                section_takesection(compo, left, left->link, STATE_MOVEDLEFT);
                                left = (SECTION)List_Next(left);
                        }

                } else if (left->state == STATE_LEFTONLY) {
                        /* unlinked section on left */
                        if (left->correspond==right) {
                            TakeTwoSections( compo, left, left->correspond );
                            left = (SECTION)List_Next(left);
                            right = (SECTION)List_Next(right);
                        } else {
                            /* see picture below for when this might occur */
                            section_takesection(compo, left, NULL, STATE_LEFTONLY);
                            left = (SECTION)List_Next(left);
                        }

                } else if (left->link==NULL) {
                        /* This is an ignorable blank section on the left.
                         * We ignore it. (We will take any such from the right)
                         */
                        left = (SECTION)List_Next(left);

                } else if (left->link->state==STATE_MARKED) {
                        /* left is linked to section that is already taken*/
                        section_takesection(compo, left, left->link, STATE_MOVEDLEFT);
                        left = (SECTION)List_Next(left);

                } else  if (right->link == NULL) {
                        /* take unlinked section on right
                         * Either unmatched or ignorable blanks
                         */
                        section_takesection(compo, NULL, right, right->state);
                        right = (SECTION)List_Next(right);

                } else if (right->link->state==STATE_MARKED) {
                        /* right is linked to section that's already taken */
                        section_takesection(compo, right->link, right, STATE_MOVEDRIGHT);
                        right = (SECTION)List_Next(right);

                } else if (left->link == right) {
                        /* sections match */
                        section_takesection(compo, left, right, STATE_SAME);
                        right = (SECTION)List_Next(right);
                        left = (SECTION)List_Next(left);
                } else {
                        /* both sections linked to forward sections
                         * Original idea was to go by section size and
                         * take smallest first as a move so that larger one is
                         * unchanged.  Counter example is test file blanks2
                         *
                         *   Files     Good version    Not so good
                         *  A     A       A---A          A---A
                         *  B-   -A         ->A RR    LL B->
                         *  C | | A         ->A RR    LL C
                         *  D  -+-B       B---B       LL D
                         *  E   | c       C   c       LL E->
                         *  A---  d       D   d          A---A
                         *  A     E       E---E          A---A
                         *  A     A       A->              ->B
                         *  A             A->                c
                         *                A---A              d
                         *                A                ->E
                         *                               A---A
                         *                               A
                         *
                         * A better scheme looks at the distances marked
                         * above as RR and LL and take as moved the block that results
                         * in the shortest such distance.
                         * Let LeftDist = linenr(right->link) - linenr(left)
                         *       i.e. 5 in the example above  (the LL lines)
                         * Let RightDist = linenr(left->link) - linenr(right)
                         *       i.e. 3 in the example above  (the RR lines)
                         *
                         * if LeftDist > RightDist then treat right as moved
                         * and take it first.
                         */
                        if ( line_getlinenr(right->link->first) - line_getlinenr(left->first)
                           > line_getlinenr(left->link->first)  - line_getlinenr(right->first)
                           )
                        {
                                section_takesection(compo, right->link, right, STATE_MOVEDRIGHT);
                                right = (SECTION)List_Next(right);
                        } else {
                                section_takesection(compo, left, left->link, STATE_MOVEDLEFT);
                                left = (SECTION)List_Next(left);
                        }

                }
        }

        return(compo);
} /* section_makecomposite */

LIST section_makelist | ( | LIST | linelist,
 |  | BOOL | left
 | ) |  |

Definition at line 545 of file section.cpp.

{
        LINE line1, line2;
        LIST sections;
        BOOL matched;
        SECTION sect;

        /* make an empty list of sections */
        sections = List_Create();

        /* for each line in the list */
    for( line1=(LINE)List_First(linelist);  line1!=NULL;  line1 = (LINE)List_Next((LPVOID)line1)) {

                /* is it linked ? */

                if( line_getlink(line1) != NULL
                  || ( ignore_blanks && line_isblank(line1))
                  ) {
                        line2 = FindEndOfMatched(line1);
                        matched = TRUE;
                } else {
                        line2 = FindEndOfUnmatched(line1);
                        matched = FALSE;
                }

                /* create the section and add to list */
                sect = section_new(line1, line2, sections);
                sect->state = (matched ? STATE_SAME
                                       : left ? STATE_LEFTONLY
                                              : STATE_RIGHTONLY
                              );

#ifdef trace
                {       char msg[80];
                        StringCchPrintf( msg, 80
                                , "Created section: lines %d..%d of %s %s\r\n"
                                , line_getlinenr(line1)
                                , line_getlinenr(line2)
                                , (left ? "left" : "right")
                                , (matched ? "matching" : "non-matched")
                                );
                        if (bTrace) Trace_File(msg);
                }
#endif

                /* advance to end of section (no-op if 1 line section) */
                line1 = line2;
        }

        return(sections);
} /* section_makelist */

BOOL section_match | ( | SECTION | section1,
 |  | SECTION | section2,
 |  | BOOL | ReSynch
 | ) |  |

Definition at line 165 of file section.cpp.

{
        TREE ctleft, ctright;
        LINE line, line2;
        BOOL bLinked = FALSE;

        if ((sec1 == NULL) || (sec2 == NULL)) {
                return(FALSE);
        }

        if ((sec1->first == NULL) || (sec2->first == NULL)) {
                return(FALSE);
        }
        /* ASSERT if first is non-null, so is last */

        /* attempt to link the first line of each file, and
         * if matched, expand as long as we keep matching
         */
        bLinked |= section_expandanchor(sec1, sec1->first, sec2, sec2->first);

        /* build a tree of lines, indexed by the line hashcode.
         * a ctree will hold only the first value of any given key, but
         * it will keep track of the number of items inserted on this key.
         * thus we can keep count of the number of times this line
         * (or at least this hashcode) appears.
         */
        ctleft = section_makectree(sec1);
        ctright = section_makectree(sec2);

        /* for each unlinked line in one list (doesn't matter which), find if
         * it appears once only in each list. if so, link, and expand
         * the link to link lines before and after the matching line
         * as long as they continue to match.
         *
         * If ReSynch is set then accept lines which occur more than once in
         * each file (this matches the first copy in each file of lines which
         * are the same, but are non unique.  Heuristic: if the lines are short
         * (8 chars or fewer) then don't accept them.  It can waste a lot
         * of time matching spurious {, } or blank lines.
         */
        for (line = sec1->first; line != NULL; line = (LINE)List_Next(line)) {

                if (  (line_getlink(line) == NULL)
                   && (  ReSynch
                      ?  (  (ctree_getcount(ctleft, line_gethashcode(line)) >= 1)
                         && (ctree_getcount(ctright, line_gethashcode(line)) >= 1)
                         && (line_gettextlen(line) > 8)
                         )
                      :  (  (ctree_getcount(ctleft, line_gethashcode(line)) == 1)
                         && (ctree_getcount(ctright, line_gethashcode(line)) == 1)
                         )
                      )
                   ){

                        /* lines match */
                        line2 = * ((LINE FAR *)ctree_find(ctright,
                                        line_gethashcode(line)));
                        bLinked |= section_expandanchor(sec1, line, sec2, line2);
                }

                if (line == sec1->last) {
                        break;
                }
        }

        /* delete the ctrees */
        ctree_delete(ctleft);
        ctree_delete(ctright);

        /* attempt to link the last lines of each file and
         * expand upwards
         */
        bLinked |= section_expandanchor(sec1, sec1->last, sec2, sec2->last);

        return(bLinked);
} /* section_match */

BOOL section_matchlists | ( | LIST | secsleft,
 |  | LIST | secsright,
 |  | BOOL | bDups
 | ) |  |

Definition at line 656 of file section.cpp.

{
        BOOL bLinked = FALSE;
        SECTION sec1, sec2;

        /* match up linked sections - We know whether a section is
           supposed to link from its state, but we don't know what section
           it links to.  Also we can have sections which are defined to
           be matching but actually contain nothing but ignorable
           blank lines
        */

        /*  for each linked section try to find the section  linked to it. */
    for( sec1=(SECTION)List_First(secsleft);  sec1!=NULL;  sec1 = (SECTION)List_Next((LPVOID)sec1)) {
                if (sec1->state==STATE_SAME) {
                        LINE FirstWithLink = FindFirstWithLink(sec1->first, sec1->last);
#ifdef trace
                        {       char msg[80];
                                StringCchPrintf( msg, 80
                                        , "matchlists left matching section %d..%d \r\n"
                                        , line_getlinenr(sec1->first)
                                        , line_getlinenr(sec1->last)
                                        );
                                if (bTrace) Trace_File(msg);
                        }
#endif
            for( sec2=(SECTION)List_First(secsright);  sec2!=NULL;  sec2 = (SECTION)List_Next((LPVOID)sec2)) {
                                if ( sec2->state==STATE_SAME
                                   && line_getlink(FirstWithLink)
                                        == FindFirstWithLink(sec2->first, sec2->last)) {
                                            break;
                                }
                        }
                        /* sec2 could be NULL if sec1 is all allowable blanks */
                        if (sec2!=NULL) {
                                sec1->link = sec2;
                                sec2->link = sec1;
#ifdef trace
                                {       char msg[80];
                                        StringCchPrintf( msg, 80
                                                , "matchlists right matching section is %d..%d \r\n"
                                                , line_getlinenr(sec2->first)
                                                , line_getlinenr(sec2->last)
                                                );
                                        if (bTrace) Trace_File(msg);
                                }
#endif
                        }
                }
        }

        /* go through all unmatched sections. Note that we need to complete
         * the link-up of matching sections before this, since we need
         * all the links in place for this to work.
         */

    for( sec1=(SECTION)List_First(secsleft);  sec1!=NULL;  sec1 = (SECTION)List_Next((LPVOID)sec1)) {
                SECTION secTemp;

                if (sec1->state == STATE_SAME) {
                        /* skip the linked sections */
                        continue;
                }

                /* check that the previous and next sections, if
                 * they exist, are linked. this should not fail since
                 * two consecutive unlinked sections should be made into
                 * one section
                 */
                secTemp = (SECTION)List_Prev(sec1);
                if (secTemp && secTemp->state!= STATE_SAME) {
                        TRACE_ERROR("consecutive unlinked sections", FALSE);
                        continue;
                }
                secTemp = (SECTION)List_Next(sec1);
                if (secTemp && secTemp->state!= STATE_SAME) {
                        TRACE_ERROR("consecutive unlinked sections.", FALSE);
                        continue;
                }

                /* find the section that corresponds to this - that is, the
                 * section following the section linked to our previous section.
                 * we could be at beginning or end of list.
                 */
                if (List_Prev(sec1) != NULL) {
                        SECTION secOther;
                        secOther = section_getlink((SECTION)List_Prev(sec1));
                        if (secOther==NULL)
                                continue;

                        sec2 = (SECTION)List_Next(secOther);

                        /* check this section is not linked */
                        if ((sec2 == NULL) || (section_getlink(sec2) != NULL)) {
                                continue;
                        }

                        /* check that the section after these are linked
                         * to each other (or both are at end of list).
                         */
                        if (List_Next(sec1) != NULL) {

                                if (section_getlink((SECTION)List_Next(sec1)) !=
                                    List_Next(sec2)) {
                                        continue;
                                }
                        } else {
                                if (List_Next(sec2) != NULL) {
                                        continue;
                                }
                        }

                } else if (List_Next(sec1) != NULL) {
                        SECTION secOther;
                        secOther = section_getlink((SECTION)List_Next(sec1));
                        if (secOther==NULL)
                                continue;

                        sec2 = (SECTION)List_Prev(secOther);

                        /* check this section is not linked */
                        if ((sec2 == NULL) || (section_getlink(sec2) != NULL)) {
                                continue;
                        }

                        /* check that the section before these are linked
                         * to each other (or both are at start of list).
                         */
                        if (List_Prev(sec1) != NULL) {

                                if (section_getlink((SECTION)List_Prev(sec1)) !=
                                    List_Prev(sec2)) {
                                        continue;
                                }
                        } else {
                                if (List_Prev(sec2) != NULL) {
                                        continue;
                                }
                        }
                } else {
                        /* there must be at most one section in each
                         * file, and they are unmatched. make these correspond.
                         * (Though I don't think this would ever do anything except
                         * waste time by trying to link that which has already failed)
                         *
                         */
                        sec2 = (SECTION)List_First(secsright);
                }

                /* make the correspondence links
                 * we will want these for  zebra striping
                 */
                if ((sec1 != NULL) && (sec2 != NULL)) {
                        sec1->correspond = sec2;
                        sec2->correspond = sec1;
                }

                /* attempt to link up lines */
                if (section_match(sec1, sec2, bDups)) {
                        bLinked = TRUE;
                }
        }

        return(bLinked);
} /* section_matchlists */

SECTION section_new | ( | LINE | first,
 |  | LINE | last,
 |  | LIST | list
 | ) |  |

Definition at line 88 of file section.cpp.

{
        SECTION sec;

        /* alloc the sec and remember where we alloc-ed it */
        if (list)
        {
            sec = (SECTION) List_NewLast(list, sizeof(struct section));
            if (!sec)
                return NULL;
            sec->bDiscard = TRUE;
        }
        else
        {
            sec = (SECTION) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct section));
            if (!sec)
                return NULL;
            sec->bDiscard = FALSE;
        }

        sec->first = first;
        sec->last = last;
        sec->link = NULL;
        sec->correspond = NULL;
        sec->state = 0;
        sec->leftbase = 1;
        sec->rightbase = 1;

        return(sec);
}

void section_setstate | ( | SECTION | section,
 |  | int | state
 | ) |  |

Definition at line 310 of file section.cpp.

{
        section->state = state;
}

Generated on Wed Nov 13 2024 16:53:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/sdkdiff/state.h File Reference

  • Begin
  • sdkdiff
Defines

state.h File Reference

Go to the source code of this file.

Defines

#define | STATE_COMPARABLE 2
#define | STATE_DIFFER 4
#define | STATE_FILELEFTONLY 5
#define | STATE_FILERIGHTONLY 6
#define | STATE_LEFTONLY 7
#define | STATE_MARKED 99
#define | STATE_MOVEDLEFT 9
#define | STATE_MOVEDRIGHT 10
#define | STATE_RIGHTONLY 8
#define | STATE_SAME 1
#define | STATE_SIMILAR 3
#define | STATE_SIMILARLEFT 11
#define | STATE_SIMILARRIGHT 12

Define Documentation

#define STATE_COMPARABLE 2

Definition at line 35 of file state.h.

#define STATE_DIFFER 4

Definition at line 45 of file state.h.

#define STATE_FILELEFTONLY 5

Definition at line 48 of file state.h.

#define STATE_FILERIGHTONLY 6

Definition at line 49 of file state.h.

#define STATE_LEFTONLY 7

Definition at line 55 of file state.h.

#define STATE_MARKED 99

Definition at line 74 of file state.h.

#define STATE_MOVEDLEFT 9

Definition at line 63 of file state.h.

#define STATE_MOVEDRIGHT 10

Definition at line 64 of file state.h.

#define STATE_RIGHTONLY 8

Definition at line 56 of file state.h.

#define STATE_SAME 1

Definition at line 32 of file state.h.

#define STATE_SIMILAR 3

Definition at line 40 of file state.h.

#define STATE_SIMILARLEFT 11

Definition at line 67 of file state.h.

#define STATE_SIMILARRIGHT 12

Definition at line 68 of file state.h.

Generated on Wed Nov 13 2024 16:53:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/sdkdiff/status.cpp File Reference

  • Begin
  • sdkdiff
Classes | Defines | Typedefs | Functions | Variables

status.cpp File Reference

#include "precomp.h"
#include "..\sdkdiff\errorout.h"

Go to the source code of this file.

Classes

struct | itemlist
struct | statel

Defines

#define | DEF_PTSIZE 80
#define | SF_MAXLABEL 80

Typedefs

typedef struct itemlist | ILIST
typedef struct itemlist * | PILIST
typedef struct statel * | PSTATEL
typedef struct statel | STATEL

Functions

void | BottomRight (HDC hDC, LPRECT rcp, HPEN hpen, BOOL bCorners)
void | InitDC (HDC hdc)
void | LowerRect (HDC hDC, LPRECT rcp)
void | RaiseRect (HDC hDC, LPRECT rcp)
BOOL APIENTRY | StatusAddItem (HANDLE hmem, int itemnr, int type, int flags, int id, int width, LPSTR text)
HANDLE APIENTRY | StatusAlloc (int nitems)
void | StatusButtonDown (HDC hDC, PSTATEL ip)
void | StatusButtonUp (HDC hDC, PSTATEL ip)
int | StatusCalcHeight (HWND hWnd, PSTATEL ip)
int | StatusCalcWidth (HWND hWnd, PSTATEL ip)
HWND APIENTRY | StatusCreate (HANDLE hInst, HWND hParent, INT_PTR id, LPRECT rcp, HANDLE hmem)
void | StatusCreateTools (void)
void | StatusDeleteTools (void)
PSTATEL | StatusGetItem (PILIST plist, int id)
int APIENTRY | StatusHeight (HANDLE hmem)
BOOL | StatusInit (HANDLE hInstance)
void | StatusPaint (HWND hWnd, PILIST iplistp)
void | StatusResize (HWND hWnd, PILIST pilist)
INT_PTR APIENTRY | StatusWndProc (HWND, UINT, WPARAM, LPARAM)
void | TopLeft (HDC hDC, LPRECT rcp, HPEN hpen, BOOL bCorners)

Variables

HBRUSH | hbrBackground
HFONT | hFont
HPEN | hpenBlack
HPEN | hpenHilight
HPEN | hpenLowlight
HPEN | hpenNeutral
int | status_charheight
int | status_charwidth

Define Documentation

#define DEF_PTSIZE 80

Definition at line 81 of file status.cpp.

#define SF_MAXLABEL 80

Definition at line 22 of file status.cpp.

Typedef Documentation

typedef struct itemlist ILIST
typedef struct itemlist * PILIST
typedef struct statel * PSTATEL
typedef struct statel STATEL

Function Documentation

void BottomRight | ( | HDC | hDC,
 |  | LPRECT | rcp,
 |  | HPEN | hpen,
 |  | BOOL | bCorners
 | ) |  |

Definition at line 777 of file status.cpp.

{
    HPEN hpenOld;
    int x, y;

    hpenOld = (HPEN)SelectObject(hDC, hpen);
    x = rcp->left - 1;
    y = rcp->top;
    if (!bCorners) {
        x++;
        y++;
    }
    MoveToEx(hDC, rcp->right-1, y, NULL);
    LineTo(hDC, rcp->right-1, rcp->bottom-1);
    LineTo(hDC, x, rcp->bottom-1);
    SelectObject(hDC, hpenOld);
}

void InitDC ( HDC hdc )

Definition at line 256 of file status.cpp.

{
    SetBkColor(hdc, RGB(192,192,192));
    SelectObject(hdc, hbrBackground);
    SelectObject(hdc, hFont);
}

void LowerRect | ( | HDC | hDC,
 |  | LPRECT | rcp
 | ) |  |

Definition at line 686 of file status.cpp.

{
    TopLeft(hDC, rcp, hpenLowlight, FALSE);
    BottomRight(hDC, rcp, hpenHilight, FALSE);
}

void RaiseRect | ( | HDC | hDC,
 |  | LPRECT | rcp
 | ) |  |

Definition at line 679 of file status.cpp.

{
    TopLeft(hDC, rcp, hpenHilight, FALSE);
    BottomRight(hDC, rcp, hpenLowlight, FALSE);
}

BOOL APIENTRY StatusAddItem | ( | HANDLE | hmem,
 |  | int | itemnr,
 |  | int | type,
 |  | int | flags,
 |  | int | id,
 |  | int | width,
 |  | LPSTR | text
 | ) |  |

Definition at line 219 of file status.cpp.

{
    PILIST pilist;
    PSTATEL pel;
  HRESULT hr;

    pilist = (PILIST) hmem;
    if ((pilist == NULL) || (itemnr >= pilist->nitems)) {
        return(FALSE);
    }
    pel = &pilist->statels[itemnr];
    pel->type = type;
    pel->flags = flags;
    pel->id = id;
    pel->width = width;
    if (text == NULL) {
        pel->text[0] = '\0';
    } else {
        hr = StringCchCopy(pel->text,(SF_MAXLABEL+1), text);
    if (FAILED(hr))
      OutputError(hr, IDS_SAFE_COPY);
    }

    return(TRUE);
}

HANDLE APIENTRY StatusAlloc ( int nitems )

Definition at line 196 of file status.cpp.

{
    PILIST pilist;
    LPSTR chp;

    chp = (LPSTR)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
                       sizeof(ILIST) + (sizeof(STATEL) * nitems));
    if (chp == NULL) {
        return(NULL);
    }

    pilist = (PILIST) chp;
    pilist->nitems = nitems;
    pilist->statels = (PSTATEL) &chp[sizeof(ILIST)];

    return(chp);
}

void StatusButtonDown | ( | HDC | hDC,
 |  | PSTATEL | ip
 | ) |  |

Definition at line 726 of file status.cpp.

{
    RECT rc;
    HPEN hpenOld;
    TEXTMETRIC tm;

    rc = ip->rc;
    TopLeft(hDC, &rc, hpenBlack, TRUE);
    BottomRight(hDC, &rc, hpenBlack, FALSE);

    rc.top++;
    rc.bottom--;
    rc.left++;
    rc.right--;
    TopLeft(hDC, &rc, hpenLowlight, TRUE);
    rc.top++;
    rc.left++;
    TopLeft(hDC, &rc, hpenNeutral, TRUE);
    rc.top++;
    rc.left++;
    TopLeft(hDC, &rc, hpenNeutral, TRUE);
    rc.top++;
    rc.left++;
    hpenOld = (HPEN)SelectObject(hDC, hpenNeutral);
    Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom);
    SelectObject(hDC, hpenOld);
    GetTextMetrics(hDC, &tm);
    rc.top += tm.tmExternalLeading;
    DrawText(hDC, ip->text, lstrlen(ip->text), &rc, DT_CENTER | DT_VCENTER);
}

void StatusButtonUp | ( | HDC | hDC,
 |  | PSTATEL | ip
 | ) |  |

Definition at line 693 of file status.cpp.

{
    RECT rc;
    HPEN hpenOld;
    TEXTMETRIC tm;

    rc = ip->rc;
    TopLeft(hDC, &rc, hpenBlack, TRUE);
    BottomRight(hDC, &rc, hpenBlack, FALSE);

    rc.top++;
    rc.bottom--;
    rc.left++;
    rc.right--;
    TopLeft(hDC, &rc, hpenHilight, FALSE);
    BottomRight(hDC, &rc, hpenLowlight, TRUE);

    rc.top++;
    rc.bottom--;
    rc.left++;
    rc.right--;
    BottomRight(hDC, &rc, hpenLowlight, TRUE);
    rc.bottom--;
    rc.right--;
    hpenOld = (HPEN)SelectObject(hDC, hpenNeutral);
    Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom);
    SelectObject(hDC, hpenOld);
    GetTextMetrics(hDC, &tm);
    rc.top += tm.tmExternalLeading;
    DrawText(hDC, ip->text, lstrlen(ip->text), &rc, DT_CENTER | DT_VCENTER);
}

int StatusCalcHeight | ( | HWND | hWnd,
 |  | PSTATEL | ip
 | ) |  |

Definition at line 870 of file status.cpp.

{
    int size;

    size = status_charheight;
    if (ip->type == SF_BUTTON) {
        return(size + 6);
    } else {
        return(size + 2);
    }
}

int StatusCalcWidth | ( | HWND | hWnd,
 |  | PSTATEL | ip
 | ) |  |

Definition at line 823 of file status.cpp.

{
    int ch_size, t_size;
    SIZE sz = {0};
    HDC hDC;

    ch_size = ip->width * status_charwidth;
    if (ip->flags & SF_VAR) {
        hDC = GetDC(hWnd);
        if (hDC)
        {
            InitDC(hDC);
            GetTextExtentPoint(hDC, ip->text, lstrlen(ip->text), &sz);
            ReleaseDC(hWnd, hDC);
        }
        t_size = sz.cx;

        /*
         * check this size against min/max size if
         * requested
         */

        if (ip->flags & SF_SZMIN) {
            if (ch_size > t_size) {
                t_size = ch_size;
            }
        }
        if (ip->flags & SF_SZMAX) {
            if (ch_size < t_size) {
                t_size = ch_size;
            }
        }
        ch_size = t_size;
    }

    if (ch_size != 0) {
        if (ip->type == SF_BUTTON) {
            return(ch_size+6);
        } else {
            return(ch_size+4);
        }
    } else {
        return(0);
    }
}

HWND APIENTRY StatusCreate | ( | HANDLE | hInst,
 |  | HWND | hParent,
 |  | INT_PTR | id,
 |  | LPRECT | rcp,
 |  | HANDLE | hmem
 | ) |  |

Definition at line 137 of file status.cpp.

{

    HWND hWnd;

    /* create a child window of status class */

    hWnd = CreateWindow("gdstatusclass",
                        NULL,
                        WS_CHILD | WS_VISIBLE,
                        rcp->left,
                        rcp->top,
                        (rcp->right - rcp->left),
                        (rcp->bottom - rcp->top),
                        hParent,
                        (HMENU) id,
                        (HINSTANCE)hInst,
                        (LPVOID) hmem);

    return(hWnd);
}

void StatusCreateTools ( void )

Definition at line 265 of file status.cpp.

{
    LOGFONT lf;
    HDC hdc;
    int scale;

    hbrBackground = CreateSolidBrush(RGB(192,192,192));
    hpenHilight = CreatePen(0, 1, RGB(255, 255, 255));
    hpenLowlight = CreatePen(0, 1, RGB(128, 128, 128));
    hpenNeutral = CreatePen(0, 1, RGB(192, 192, 192));
    hpenBlack = CreatePen(0, 1, RGB(0, 0, 0));

    hdc = GetDC(NULL);
    if (hdc)
    {
        scale = GetDeviceCaps(hdc, LOGPIXELSY);
        ReleaseDC(NULL, hdc);
    }
    else
    {
        // arbitrary, whatever...
        scale = 72;
    }

    lf.lfHeight = -MulDiv(DEF_PTSIZE, scale, 720);
    lf.lfWidth = 0;
    lf.lfEscapement = 0;
    lf.lfOrientation = 0;
    lf.lfWeight = FW_REGULAR;
    lf.lfItalic = 0;
    lf.lfUnderline = 0;
    lf.lfStrikeOut = 0;
    lf.lfCharSet = ANSI_CHARSET;
    lf.lfOutPrecision = OUT_DEFAULT_PRECIS;
    lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
    lf.lfQuality = PROOF_QUALITY;
    lf.lfPitchAndFamily = VARIABLE_PITCH | FF_SWISS;
    lf.lfFaceName[0] = '\0';
#ifdef COMPLEX
    hFont = CreateFontIndirect(&lf);
#else
    hFont = (HFONT)GetStockObject(SYSTEM_FONT);
#endif

}

void StatusDeleteTools ( void )

Definition at line 314 of file status.cpp.

{
    DeleteObject(hbrBackground);
    DeleteObject(hpenHilight);
    DeleteObject(hpenLowlight);
    DeleteObject(hpenBlack);
    DeleteObject(hpenNeutral);

#ifdef COMPLEX
    DeleteObject(hFont);
#endif
}

PSTATEL StatusGetItem | ( | PILIST | plist,
 |  | int | id
 | ) |  |

Definition at line 797 of file status.cpp.

{
    int i;

    if (plist == NULL) {
        return(NULL);
    }
    for (i = 0; i < plist->nitems; i++) {
        if (plist->statels[i].id == id) {
            return(&plist->statels[i]);
        }
    }
    return(NULL);
}

int APIENTRY StatusHeight ( HANDLE hmem )

Definition at line 168 of file status.cpp.

{
    PILIST plist;
    int i;
    int sz;
    int maxsize = 0;

    plist = (PILIST) hmem;
    if (plist != NULL) {
        for (i = 0; i<plist->nitems; i++) {
            sz = StatusCalcHeight(NULL, &plist->statels[i]);
            maxsize = max(sz, maxsize);
        }
    }
    if (maxsize > 0) {
        return(maxsize + 4);
    } else {
        return(status_charheight + 4);
    }
}

BOOL StatusInit ( HANDLE hInstance )

Definition at line 89 of file status.cpp.

{
    WNDCLASS    wc;
    BOOL resp;
    TEXTMETRIC tm = {0};
    HDC hDC;

    StatusCreateTools();

    wc.style = CS_HREDRAW|CS_VREDRAW|CS_GLOBALCLASS;
    wc.lpfnWndProc = (WNDPROC)StatusWndProc;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = sizeof(HANDLE);
    wc.hInstance = (HINSTANCE)hInstance;
    wc.hIcon = NULL;
    wc.hCursor = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = hbrBackground;
    wc.lpszClassName = (LPSTR) "gdstatusclass";
    wc.lpszMenuName = NULL;

    resp = RegisterClass(&wc);

    hDC = GetDC(NULL);
    if (hDC)
    {
        InitDC(hDC);
        GetTextMetrics(hDC, &tm);
        ReleaseDC(NULL, hDC);
    }
    else
    {
        // arbitrary, whatever...
        tm.tmHeight = 14;
        tm.tmAveCharWidth = 5;
    }
    status_charheight = (int)(tm.tmHeight + tm.tmExternalLeading);
    status_charwidth = (int)tm.tmAveCharWidth;

    return(resp);
}

void StatusPaint | ( | HWND | hWnd,
 |  | PILIST | iplistp
 | ) |  |

Definition at line 630 of file status.cpp.

{
    RECT rc;
    HDC hDC;
    PAINTSTRUCT ps;
    int i;
    PSTATEL ip;
    HPEN hpenOld;

    GetClientRect(hWnd, &rc);
    hDC = BeginPaint(hWnd, &ps);
    InitDC(hDC);

    RaiseRect(hDC, &rc);
    if (iplistp == NULL) {
        EndPaint(hWnd, &ps);
        return;
    }
    for (i =0; i < iplistp->nitems; i++) {
        ip = &iplistp->statels[i];

        if (ip->rc.left == ip->rc.right) {
            continue;
        }
        if (ip->type == SF_STATIC) {
            if (ip->flags & SF_RAISE) {
                RaiseRect(hDC, &ip->rc);
            } else if (ip->flags & SF_LOWER) {
                LowerRect(hDC, &ip->rc);
            }
            rc = ip->rc;
            rc.left += (status_charwidth / 2);
            rc.right--;
            rc.top++;
            rc.bottom--;
            hpenOld = (HPEN)SelectObject(hDC, hpenNeutral);
            Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom);
            SelectObject(hDC, hpenOld);
            DrawText(hDC, ip->text, lstrlen(ip->text), &rc,
                     DT_LEFT | DT_VCENTER);
        } else {
            StatusButtonUp(hDC, ip);
        }
    }

    EndPaint(hWnd, &ps);
}

void StatusResize | ( | HWND | hWnd,
 |  | PILIST | pilist
 | ) |  |

Definition at line 553 of file status.cpp.

{
    RECT rc;
    int curpos_right, curpos_left;
    int height, width;
    int i;
    PSTATEL ip;

    if (iplistp == NULL) {
        return;
    }
    GetClientRect(hWnd, &rc);
    curpos_left = rc.left + status_charwidth / 2;
    curpos_right = rc.right - (status_charwidth / 2);

    /* loop through all items setting their position rects.
     * items are flagged as being left or right. We place them
     * in order starting at the left and the right, with a single
     * char's width between each item
     */
    for (i = 0; i < iplistp->nitems; i++) {
        ip = &iplistp->statels[i];

        width = StatusCalcWidth(hWnd, ip);
        height = StatusCalcHeight(hWnd, ip);
        ip->rc.top = (rc.bottom - height) / 2;
        ip->rc.bottom = ip->rc.top + height;

        /* see if  this item fits. Items that partially fit
         * are placed reduced in size.
         */
        if (ip->flags & SF_LEFT) {

            if (curpos_left+width >= curpos_right) {
                /* doesn't completely fit-does it partly? */
                if ((curpos_left + 1) >= curpos_right) {

                    /* no - this item does not fit */
                    ip->rc.left = 0;
                    ip->rc.right = 0;
                } else {
                    /* partial fit */
                    ip->rc.left = curpos_left;
                    ip->rc.right = curpos_right - 1;
                    curpos_left = curpos_right;
                }
            } else {
                /* complete fit */
                ip->rc.left = curpos_left;
                ip->rc.right = curpos_left + width;
                curpos_left += width + 1;
            }
        } else {

            /* same size check for right-aligned items */
            if (curpos_right-width <= curpos_left) {

                if (curpos_right <= curpos_left+1) {
                    ip->rc.left = 0;
                    ip->rc.right = 0;
                } else {
                    ip->rc.left = curpos_left + 1;
                    ip->rc.right = curpos_right;
                    curpos_right = curpos_left;
                }
            } else {
                ip->rc.right = curpos_right;
                ip->rc.left = curpos_right - width;
                curpos_right -= (width + 1);
            }
        }
    }
}

INT_PTR APIENTRY StatusWndProc | ( | HWND | hWnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 333 of file status.cpp.

{
    HANDLE hitems;
    PSTATEL ip;
    PILIST plist;
    CREATESTRUCT * cp;
    int i;
    HDC hDC;
    RECT rc;
    POINT pt;

    switch (message) {

        case WM_CREATE:
            cp = (CREATESTRUCT *) lParam;
            hitems = (HANDLE) cp->lpCreateParams;
            SetWindowLongPtr(hWnd, 0,  (LONG_PTR)hitems);
            plist = (PILIST) hitems;
            if (plist != NULL) {
                plist->selitem = -1;
            }
            break;

        case WM_SIZE:
            hitems = (HANDLE) GetWindowLongPtr(hWnd, 0);
            plist = (PILIST) hitems;
            if (plist != NULL) {
                StatusResize(hWnd, plist);
            }
            break;

        case WM_PAINT:
            hitems = (HANDLE) GetWindowLongPtr(hWnd, 0);
            plist = (PILIST) hitems;
            StatusPaint(hWnd, plist);

            break;

        case WM_LBUTTONUP:
            hitems = (HANDLE) GetWindowLongPtr(hWnd, 0);
            plist = (PILIST)hitems;
            pt.x = LOWORD(lParam);
            pt.y = HIWORD(lParam);

            if (plist == NULL) {
                break;
            }
            if (plist->selitem != -1) {
                ip = &plist->statels[plist->selitem];
                if (plist->isselected) {
                    hDC = GetDC(hWnd);
                    if (hDC)
                    {
                        InitDC(hDC);
                        StatusButtonUp(hDC, ip);
                        ReleaseDC(hWnd, hDC);
                    }
                }
                plist->selitem = -1;
                ReleaseCapture();
                if (PtInRect(&ip->rc, pt)) {
                    SendMessage(GetParent(hWnd), WM_COMMAND, MAKELONG(ip->id, WM_LBUTTONUP), (LPARAM)hWnd);
                }
            }
            break;

        case WM_LBUTTONDOWN:
            hitems = (HANDLE) GetWindowLongPtr(hWnd, 0);
            plist = (PILIST)hitems;
            if (plist == NULL) {
                break;
            }
            pt.x = LOWORD(lParam);
            pt.y = HIWORD(lParam);
            if (plist->selitem == -1) {
                for (i = 0; i< plist->nitems; i++) {
                    ip = &plist->statels[i];
                    if (PtInRect(&ip->rc, pt)) {
                        if (ip->type != SF_BUTTON) {
                            break;
                        }
                        plist->selitem = i;
                        SetCapture(hWnd);

                        plist->isselected = TRUE;
                        hDC = GetDC(hWnd);
                        if (hDC)
                        {
                            InitDC(hDC);
                            StatusButtonDown(hDC, ip);
                            ReleaseDC(hWnd, hDC);
                        }
                        break;
                    }
                }
            }
            break;

        case WM_MOUSEMOVE:
            hitems = (HANDLE) GetWindowLongPtr(hWnd, 0);
            plist = (PILIST) hitems;
            if (plist == NULL) {
                break;
            }
            pt.x = LOWORD(lParam);
            pt.y = HIWORD(lParam);
            if (plist->selitem != -1) {
                ip = &plist->statels[plist->selitem];
                if (PtInRect(&ip->rc, pt)) {
                    if (!plist->isselected) {
                        hDC = GetDC(hWnd);
                        if (hDC)
                        {
                            InitDC(hDC);
                            StatusButtonDown(hDC, ip);
                            ReleaseDC(hWnd, hDC);
                        }
                        plist->isselected = TRUE;
                    }
                } else {
                    if (plist->isselected) {
                        hDC = GetDC(hWnd);
                        if (hDC)
                        {
                            InitDC(hDC);
                            StatusButtonUp(hDC, ip);
                            ReleaseDC(hWnd, hDC);
                        }
                        plist->isselected = FALSE;
                    }
                }
            }
            break;

        case WM_DESTROY:

            hitems = (HANDLE) GetWindowLongPtr(hWnd, 0);
            HeapFree(GetProcessHeap(), NULL, hitems);
            SetWindowLongPtr(hWnd, 0, 0);
            break;

        case SM_NEW:
            hitems = (HANDLE) GetWindowLongPtr(hWnd, 0);
            if (hitems != NULL) {
                HeapFree(GetProcessHeap(), NULL, hitems);
            }
            hitems = (HANDLE) wParam;
            if (hitems == NULL) {
                SetWindowLongPtr(hWnd, 0, 0);
                InvalidateRect(hWnd, NULL, TRUE);
                break;
            }
            plist = (PILIST) hitems;
            if (plist == NULL) {
                SetWindowLongPtr(hWnd, 0, 0);
                InvalidateRect(hWnd, NULL, TRUE);
                break;
            }
            plist->selitem = -1;
            StatusResize(hWnd, plist);
            SetWindowLongPtr(hWnd, 0, (LONG_PTR)hitems);
            InvalidateRect(hWnd, NULL, TRUE);
            break;

        case SM_SETTEXT:
            hitems = (HANDLE) GetWindowLongPtr(hWnd, 0);
            if (hitems == NULL) {
                break;
            }
            plist = (PILIST) hitems;
            ip = StatusGetItem(plist, (int)wParam);
            if (ip != NULL) {
                if (lParam == 0) {
                    ip->text[0] = '\0';
                } else {
                    My_mbsncpy(ip->text, (LPSTR) lParam, SF_MAXLABEL);
                    ip->text[SF_MAXLABEL] = '\0';
                }

                /* if this is a variable width field, we need to redo
                 * all size calcs in case the field width has changed.
                 * in that case, we need to repaint the entire window
                 * and not just this field - so set rc to indicate the
                 * area to be redrawn.
                 */
                if (ip->flags & SF_VAR) {
                    StatusResize(hWnd, plist);
                    GetClientRect(hWnd, &rc);
                    RedrawWindow(hWnd, &rc, NULL,
                                 RDW_INVALIDATE|RDW_ERASE|RDW_UPDATENOW);
                } else {
                    /* instead of just invalidating the window, we can
                     * force the window to be repainted now. This is
                     * essential for status updates during a busy
                     * loop when no messages are being processed,
                     * but we should still update the user on what's
                     * happening.
                     */
                    RedrawWindow(hWnd, &ip->rc, NULL,
                                 RDW_INVALIDATE|RDW_NOERASE|RDW_UPDATENOW);
                }

            }
            break;

        default:
            return(DefWindowProc(hWnd, message, wParam, lParam));
    }
    return 0;
}

void TopLeft | ( | HDC | hDC,
 |  | LPRECT | rcp,
 |  | HPEN | hpen,
 |  | BOOL | bCorners
 | ) |  |

Definition at line 758 of file status.cpp.

{
    HPEN hpenOld;
    int x, y;

    hpenOld = (HPEN)SelectObject(hDC, hpen);
    x = rcp->right - 1;
    y = rcp->bottom;
    if (!bCorners) {
        x--;
        y--;
    }
    MoveToEx(hDC, x, rcp->top, NULL);
    LineTo(hDC, rcp->left, rcp->top);
    LineTo(hDC, rcp->left, y);
    SelectObject(hDC, hpenOld);
}

Variable Documentation

HBRUSH hbrBackground

Definition at line 76 of file status.cpp.

HFONT hFont

Definition at line 77 of file status.cpp.

HPEN hpenBlack

Definition at line 75 of file status.cpp.

HPEN hpenHilight

Definition at line 74 of file status.cpp.

HPEN hpenLowlight

Definition at line 74 of file status.cpp.

HPEN hpenNeutral

Definition at line 75 of file status.cpp.

int status_charheight

Definition at line 78 of file status.cpp.

int status_charwidth

Definition at line 78 of file status.cpp.

Generated on Wed Nov 13 2024 16:53:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/sdkdiff/table.cpp File Reference

  • Begin
  • sdkdiff
Functions | Variables

table.cpp File Reference

#include "precomp.h"
#include "table.h"
#include "tpriv.h"

Go to the source code of this file.

Functions

BOOL | gtab_alloclinedata (HWND hwnd, lpTable ptab)
void | gtab_append (HWND hwnd, lpTable ptab, int rows, DWORD_PTR id)
lpTable | gtab_buildtable (HWND hwnd, DWORD_PTR id)
void | gtab_calcwidths (HWND hwnd, lpTable ptab)
void | gtab_createtools (void)
void | gtab_deltable (HWND hwnd, lpTable ptab)
void | gtab_deltools (void)
void | gtab_freelinedata (lpTable ptab)
void | gtab_init (void)
void | gtab_invallines (HWND hwnd, lpTable ptab, int start, int count)
void | gtab_newsize (HWND hwnd, lpTable ptab)
INT_PTR | gtab_sendtq (HWND hwnd, UINT cmd, LPARAM lParam)
void | gtab_setsize (HWND hwnd, lpTable ptab)
LRESULT | gtab_wndproc (HWND, UINT, WPARAM, LPARAM)

Variables

UINT gtab_msgcode
HANDLE hLibInst
HANDLE hNormCurs
HPEN | hpenDotted
HANDLE hVertCurs

Function Documentation

BOOL gtab_alloclinedata | ( | HWND | hwnd,
 |  | lpTable | ptab
 | ) |  |

Definition at line 427 of file table.cpp.

{
    lpLineData pline;
    lpCellData cd;
    int i, j;

    ptab->pdata = (lpLineData) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
                                        sizeof(LineData) * ptab->nlines);
    if (ptab->pdata == NULL) {
        return(FALSE);
    }
    for (i = 0; i < ptab->nlines; i++) {
        pline = &ptab->pdata[i];
        pline->linepos.size = ptab->rowheight;
        pline->pdata = (lpCellData) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
                                             sizeof(CellData) * ptab->hdr.ncols);
        if (pline->pdata == NULL) {
            return(FALSE);
        }
        for (j = 0; j < ptab->hdr.ncols; j++) {
            cd = &pline->pdata[j];
            cd->props.valid = 0;
            cd->flags = 0;
            cd->nchars = ptab->pcolhdr[j].nchars;
            if (cd->nchars > 0) {
                cd->ptext = (char*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cd->nchars);
                if (cd->ptext == NULL) {
                    return(FALSE);
                }
                cd->pwzText = 0;
            }
        }
    }
    return(TRUE);
}

void gtab_append | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | int | rows,
 |  | DWORD_PTR | id
 | ) |  |

Definition at line 806 of file table.cpp.

{
    long oldrows;
    int line, nupdates;
    RECT rc;
    SCROLLINFO si;

    /* change to the new id */
    ptab->hdr.id = id;
    ptab->select.id = id;

    /* update the header, but remember the old nr of rows
     * so we know where to start updating
     */
    oldrows = ptab->hdr.nrows;

    /* check that the new nr of rows is not smaller.
     */
    if (oldrows >= rows) {
        return;
    }

    ptab->hdr.nrows = rows;

    si.cbSize = sizeof(si);
    si.fMask = SIF_PAGE|SIF_RANGE;
    si.nMin = 0;

    /* set the vertical scroll range */
    si.nMax = rows;
    si.nPage = ptab->nlines;
    if (si.nMax < 0) {
        si.nMax = 0;
    }

    /* force the scroll range into 16-bits for win 3.1 */
    ptab->scrollscale = 1;
    while (si.nMax > 32766) {
        ptab->scrollscale *= 16;
        si.nMax /= 16;
        si.nPage /= 16;
    }
    if (!si.nPage)
        si.nPage = 1;

    /* now set the scroll bar range and position */
    SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
    if (si.nMax > 0) {
        SetScrollPos(hwnd, SB_VERT,
                     (int) (ptab->toprow / ptab->scrollscale), TRUE);
    }

    /* calculate which screen lines need to be updated - find what
     * screen line the start of the new section is at
     */
    line = gtab_rowtoline(hwnd, ptab, oldrows);
    if (line == -1) {
        /* not visible -> no more to do */
        return;
    }

    /* how many lines to update - rest of screen or nr of
     * new lines if less than rest of screen
     */
    nupdates = min((ptab->nlines - line), (int)(rows - oldrows));

    /* invalidate the screen line buffers to indicate data
     * needs to be refetch from parent window
     */
    gtab_invallines(hwnd, ptab, line, nupdates);

    /* calculate the region of the screen to be repainted -
     * left and right are same as window. top and bottom
     * need to be calculated from screen line height
     */

    GetClientRect(hwnd, &rc);
    rc.top += line * ptab->rowheight;
    rc.bottom = rc.top + (nupdates * ptab->rowheight);

    /* force a repaint of the updated region */
    InvalidateRect(hwnd, &rc, FALSE);
}

lpTable gtab_buildtable | ( | HWND | hwnd,
 |  | DWORD_PTR | id
 | ) |  |

Definition at line 501 of file table.cpp.

{
    lpTable ptab;
    int ncols, i;
    ColPropsList cplist;

    ptab = (lpTable) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(Table));
    if (ptab == NULL) {
        return(NULL);
    }

    // get the tab width. most clients will not support this
    if (gtab_sendtq(hwnd, TQ_TABS, (LPARAM) &ptab->tabchars) == FALSE) {
        ptab->tabchars = TABWIDTH_DEFAULT;
    }

    // get the show whitespace value
    if (gtab_sendtq(hwnd, TQ_SHOWWHITESPACE, (LPARAM) &ptab->show_whitespace) == FALSE) {
        ptab->show_whitespace = FALSE;
    }

    /* get the row/column count from owner window */
    ptab->hdr.id = id;
    ptab->hdr.props.valid = 0;
    ptab->hdr.sendscroll = FALSE;
    if (gtab_sendtq(hwnd, TQ_GETSIZE, (LPARAM) &ptab->hdr) == FALSE) {
        return(NULL);
    }

    ncols = ptab->hdr.ncols;
    ptab->pcolhdr = (lpColProps) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ColProps) * ncols);
    if (ptab->pcolhdr == NULL) {
        /* should prob send TQ_CLOSE at this point */
        return(NULL);
    }

    /* init col properties to default */
    for (i=0; i < ncols; i++) {
        ptab->pcolhdr[i].props.valid = 0;
        ptab->pcolhdr[i].nchars = 0;
    }
    /* get the column props from owner */
    cplist.plist = ptab->pcolhdr;
    cplist.id = id;
    cplist.startcol = 0;
    cplist.ncols = ncols;
    gtab_sendtq(hwnd, TQ_GETCOLPROPS, (LPARAM) &cplist);

    /* init remaining fields */
    ptab->pcellpos = (lpCellPos) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CellPos) * ncols);
    if (ptab->pcellpos == NULL) {
        return(NULL);
    }

    ptab->scrollscale = 1;
    ptab->scroll_dx = 0;
    ptab->toprow = 0;
    ptab->pdata = NULL;
    ptab->nlines = 0;
    ptab->trackmode = TRACK_NONE;

    /* we have to notify owner of the current selection
     * whenever it is changed
     */
    ptab->select.id = id;
    gtab_select(hwnd, ptab, 0, 0, 0, 0, TRUE);

    /* calc ave height/width, cell widths and min height.
     * these change only when cell properties / col count changes -
     * ie only on rebuild-header events
     */
    gtab_calcwidths(hwnd, ptab);
    return(ptab);
}

void gtab_calcwidths | ( | HWND | hwnd,
 |  | lpTable | ptab
 | ) |  |

Definition at line 666 of file table.cpp.

{
    int i, cxtotal, cx, ave;
    TEXTMETRIC tm = {0};
    TEXTMETRIC tmcol = {0};
    HDC hdc;
    lpProps hdrprops, cellprops;
    HFONT hfont;

    hfont = NULL;  /* eliminate spurious diagnostic, make code worse */
    hdrprops = &ptab->hdr.props;
    hdc = GetDC(hwnd);
    if (hdc)
    {
        GetTextMetrics(hdc, &tm);
        ptab->rowheight = tm.tmHeight + tm.tmExternalLeading;
        if (hdrprops->valid & P_FONT) {
            hfont = (HFONT)SelectObject(hdc, hdrprops->hFont);
        }
        GetTextMetrics(hdc, &tm);
        if (hdrprops->valid & P_FONT) {
            SelectObject(hdc, hfont);
        }
        ReleaseDC(hwnd, hdc);
    }
    else
    {
        // arbitrary, whatever...
        ptab->rowheight = 14;
        tm.tmHeight = 14;
        tm.tmAveCharWidth = 5;
    }

    /* get width and height of average character */
    ptab->avewidth = tm.tmAveCharWidth;
    if (tm.tmHeight + tm.tmExternalLeading < ptab->rowheight - 2 ||
        tm.tmHeight + tm.tmExternalLeading > ptab->rowheight) {
        // make sure that the default FixedSys (and anything of similar size)
        // doesn't vertically clip the System font used for line numbers,
        // filenames, etc.
        ptab->rowheight = tm.tmHeight;
        if (tm.tmExternalLeading)
            ptab->rowheight += tm.tmExternalLeading;
        else
            ptab->rowheight++;
    }
    if (hdrprops->valid & P_HEIGHT) {
        ptab->rowheight = hdrprops->height;
    }

    /* set pixel width of each cell (and add up for row total)
     * based on ave width * nr chars, unless P_WIDTH set
     */
    cxtotal = 0;
    for (i = 0; i < ptab->hdr.ncols; i++) {
        cellprops = &ptab->pcolhdr[i].props;

        if (cellprops->valid & P_WIDTH) {
            cx = cellprops->width;
        } else if (hdrprops->valid & P_WIDTH) {
            cx = hdrprops->width;
        } else {

            if (cellprops->valid & P_FONT) {
                hdc = GetDC(hwnd);
                if (hdc)
                {
                    hfont = (HFONT)SelectObject(hdc, cellprops->hFont);
                    GetTextMetrics(hdc, &tmcol);
                    SelectObject(hdc, hfont);
                    ReleaseDC(hwnd, hdc);
                    ave = tmcol.tmAveCharWidth;
                }
                else
                    ave = 5;
            } else {
                ave = ptab->avewidth;
            }
            /* ave width * nchars */
            cx =  ptab->pcolhdr[i].nchars + 1;
            cx *= ave;
        }
        /* add 2 pixels for box lines */
        cx += 2;
        ptab->pcellpos[i].size = cx;
        cxtotal += cx;
    }
    ptab->rowwidth = cxtotal;
}

void gtab_createtools ( void )

Definition at line 69 of file table.cpp.

{
    hVertCurs = LoadCursor((HINSTANCE)hLibInst, "VertLine");
    hNormCurs = LoadCursor(NULL, IDC_ARROW);

    hpenDotted = CreatePen(PS_DOT, 1, RGB(0, 0, 0));
}

void gtab_deltable | ( | HWND | hwnd,
 |  | lpTable | ptab
 | ) |  |

Definition at line 470 of file table.cpp.

{
    int ncols;

    if (ptab == NULL) {
        return;
    }
    ncols = ptab->hdr.ncols;

    if (ptab->pcolhdr != NULL) {
        HeapFree(GetProcessHeap(), NULL, ptab->pcolhdr);
    }
    if (ptab->pcellpos != NULL) {
        HeapFree(GetProcessHeap(), NULL, ptab->pcellpos);
    }
    if (ptab->pdata != NULL) {
        gtab_freelinedata(ptab);
    }
    HeapFree(GetProcessHeap(), NULL, ptab);
}

void gtab_deltools ( void )

Definition at line 78 of file table.cpp.

{
    DeleteObject(hpenDotted);
}

void gtab_freelinedata ( lpTable ptab )

Definition at line 396 of file table.cpp.

{
    int i, j, ncols;
    lpCellData cd;

    ncols = ptab->hdr.ncols;

    /* for each line */
    for (i = 0; i < ptab->nlines; i++) {
        /* for each cell */
        for (j = 0; j < ncols; j++) {
            /* free up the actual text space */
            cd = &ptab->pdata[i].pdata[j];
            HeapFree(GetProcessHeap(), NULL, cd->ptext);
            HeapFree(GetProcessHeap(), NULL, cd->pwzText);
        }
        /* dealloc array of CellData */
        HeapFree(GetProcessHeap(), NULL, ptab->pdata[i].pdata);
    }
    /* de-alloc array of linedatas */
    HeapFree(GetProcessHeap(), NULL, ptab->pdata);
    ptab->pdata = NULL;
}

void gtab_init ( void )

Definition at line 47 of file table.cpp.

{
    WNDCLASS wc;

    gtab_createtools();
    gtab_msgcode = RegisterWindowMessage(TableMessage);

    wc.style = CS_GLOBALCLASS | CS_DBLCLKS;
    wc.lpfnWndProc = (WNDPROC)gtab_wndproc;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = WLTOTAL;
    wc.hInstance = (HINSTANCE)hLibInst;
    wc.hIcon = NULL;
    wc.hCursor = NULL;
    wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
    wc.lpszClassName = TableClassName;
    wc.lpszMenuName = NULL;

    RegisterClass(&wc);
}

void gtab_invallines | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | int | start,
 |  | int | count
 | ) |  |

Definition at line 784 of file table.cpp.

{
    int i, j;

    for (i = start; i < start + count; i++) {
        for (j = 0; j < ptab->hdr.ncols; j++) {
            ptab->pdata[i].pdata[j].flags = 0;
        }
    }
}

void gtab_newsize | ( | HWND | hwnd,
 |  | lpTable | ptab
 | ) |  |

Definition at line 763 of file table.cpp.

{
    TableHdr hdr;

    /* get new row count */
    hdr = ptab->hdr;
    gtab_sendtq(hwnd, TQ_GETSIZE, (LPARAM) &hdr);
    if (hdr.nrows != ptab->hdr.nrows) {
        ptab->hdr.nrows = hdr.nrows;
        gtab_setsize(hwnd, ptab);
    }

    gtab_invallines(hwnd, ptab, 0, ptab->nlines);

    InvalidateRect(hwnd, NULL, FALSE);
}

INT_PTR gtab_sendtq | ( | HWND | hwnd,
 |  | UINT | cmd,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 378 of file table.cpp.

{
    HWND hOwner;

    hOwner = (HWND) GetWindowLongPtr(hwnd, WW_OWNER);
    return (SendMessage(hOwner, gtab_msgcode, cmd, lParam));
}

void gtab_setsize | ( | HWND | hwnd,
 |  | lpTable | ptab
 | ) |  |

Definition at line 587 of file table.cpp.

{
    RECT rc;
    int nlines;
    long change;
    SCROLLINFO si;

    GetClientRect(hwnd, &rc);
    ptab->winwidth = rc.right - rc.left;
    nlines = (rc.bottom - rc.top) / ptab->rowheight;
    /* nlines is the number of whole lines - add one extra
     * for the partial line at the bottom
     */
    nlines += 1;

    /* alloc space for nlines of data - if nlines has changed */
    if (nlines != ptab->nlines) {
        gtab_freelinedata(ptab);
        ptab->nlines = nlines;
        if (!gtab_alloclinedata(hwnd, ptab)) {
            ptab->nlines = 0;
            return;
        }
    }

    si.cbSize = sizeof(si);
    si.fMask = SIF_PAGE|SIF_RANGE;
    si.nMin = 0;

    /* set scroll vertical range */
    si.nMax = ptab->hdr.nrows;
    si.nPage = ptab->nlines;
    if (si.nMax < 0) {
        si.nMax = 0;
        change =  -(ptab->toprow);
    } else if (ptab->toprow > si.nMax) {
        change = si.nMax - ptab->toprow;
    } else {
        change = 0;
    }
    /* the scroll range must be 16-bits for Win3
     * scale until this is true
     */
    ptab->scrollscale = 1;
    while (si.nMax > 32766) {
        ptab->scrollscale *= 16;
        si.nMax /= 16;
        si.nPage /= 16;
    }
    if (!si.nPage)
        si.nPage = 1;

    SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
    gtab_dovscroll(hwnd, ptab, change);

    /* set horz scroll range */
    si.nMax = ptab->rowwidth;
    si.nPage = ptab->winwidth;
    if (si.nMax < 0) {
        si.nMax = 0;
        change = -(ptab->scroll_dx);
    } else if (ptab->scroll_dx > si.nMax) {
        change = si.nMax - ptab->scroll_dx;
    } else {
        change = 0;
    }
    /* horz scroll range will always be < 16 bits */
    SetScrollInfo(hwnd, SB_HORZ, &si, TRUE);
    gtab_dohscroll(hwnd, ptab, change);
}

LRESULT gtab_wndproc | ( | HWND | hwnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 85 of file table.cpp.

{
    CREATESTRUCT FAR * csp;
    HWND hOwner;
    lpTable ptab;
    lpTableSelection pselect;
    long oldtop;
    long change;

    switch (msg) {

        case WM_CREATE:
            /* create window. set the wnd extra bytes to
             * contain the owner window and a null table.
             * Owner window is either in lParam or the parent.
             * Then wait for TM_NEWID.
             */
            csp = (CREATESTRUCT FAR *) lParam;
            if (csp->lpCreateParams == NULL) {
                hOwner = GetParent(hwnd);
            } else {
                hOwner = (HWND) csp->lpCreateParams;
            }
            ptab = NULL;

            SetWindowLongPtr(hwnd, WL_TABLE, (LONG_PTR) ptab);
            SetWindowLongPtr(hwnd, WW_OWNER, (LONG_PTR) hOwner);

            SetScrollRange(hwnd, SB_VERT, 0, 0, TRUE);
            SetScrollRange(hwnd, SB_HORZ, 0, 0, TRUE);
            break;

        case TM_NEWID:
            /* complete change of table.
             * close old table, discard memory and
             * build new table
             */
            ptab = (lpTable) GetWindowLongPtr(hwnd, WL_TABLE);
            if (ptab != NULL) {
                gtab_sendtq(hwnd, TQ_CLOSE, ptab->hdr.id);
                gtab_deltable(hwnd, ptab);
                SetCursor((HCURSOR)hNormCurs);
                SetWindowLongPtr(hwnd, WL_TABLE, 0);
            }
            if ( (ptab = gtab_buildtable(hwnd, (DWORD_PTR)lParam)) != NULL) {
                SetWindowLongPtr(hwnd, WL_TABLE, (LONG_PTR) ptab);
                gtab_setsize(hwnd, ptab);
            } else {
                SetScrollRange(hwnd, SB_VERT, 0, 0, TRUE);
                SetScrollRange(hwnd, SB_HORZ, 0, 0, TRUE);
            }
            InvalidateRect(hwnd, NULL, TRUE);
            break;

        case TM_NEWLAYOUT:
            /* change of layout but for same id. no TQ_CLOSE,
             * but otherwise same as TM_NEWID
             */
            ptab = (lpTable) GetWindowLongPtr(hwnd, WL_TABLE);
            if (ptab != NULL) {
                gtab_deltable(hwnd, ptab);
                SetCursor((HCURSOR)hNormCurs);
                SetWindowLongPtr(hwnd, WL_TABLE, 0);
            }
            if ( (ptab = gtab_buildtable(hwnd, (DWORD_PTR)lParam)) != NULL) {
                SetWindowLongPtr(hwnd, WL_TABLE, (LONG_PTR) ptab);
                gtab_setsize(hwnd, ptab);
            } else {
                SetScrollRange(hwnd, SB_VERT, 0, 0, TRUE);
                SetScrollRange(hwnd, SB_HORZ, 0, 0, TRUE);
            }
            InvalidateRect(hwnd, NULL, TRUE);
            break;

        case TM_REFRESH:
            /* data in table has changed. nrows may have
             * changed. ncols and col types have not changed
             */
            ptab = (lpTable) GetWindowLongPtr(hwnd, WL_TABLE);
            if (ptab != NULL) {
                gtab_newsize(hwnd, ptab);
                gtab_sendtq(hwnd, TQ_SHOWWHITESPACE, (LPARAM) &ptab->show_whitespace);
            }
            InvalidateRect(hwnd, NULL, TRUE);
            break;

        case TM_SELECT:
            ptab = (lpTable) GetWindowLongPtr(hwnd, WL_TABLE);
            if (ptab != NULL) {
                pselect = (lpTableSelection) lParam;

                gtab_select(hwnd, ptab, pselect->startrow,
                            pselect->startcell,
                            pselect->nrows,
                            pselect->ncells,
                            TRUE);
                gtab_showsel_middle(hwnd, ptab, pselect->dyRowsFromTop);
            }
            break;

        case TM_GETSELECTION:
            ptab = (lpTable) GetWindowLongPtr(hwnd, WL_TABLE);
            if (ptab != NULL) {
                pselect = (lpTableSelection) lParam;

                *pselect = ptab->select;
            }
            break;

        case TM_PRINT:
            ptab = (lpTable) GetWindowLongPtr(hwnd, WL_TABLE);
            if (ptab != NULL) {
                return gtab_print(hwnd, ptab, (lpPrintContext) lParam);
            }
            return FALSE;

        case TM_SETTABWIDTH:
            ptab = (lpTable) GetWindowLongPtr(hwnd, WL_TABLE);
            if (!ptab)
                return 0;
            ptab->tabchars = (int)lParam;
            InvalidateRect(hwnd, NULL, FALSE);
            break;

        case TM_TOPROW:

            /* return top row. if wParam is TRUE, set lParam
             * as the new toprow
             */
            ptab = (lpTable) GetWindowLongPtr(hwnd, WL_TABLE);
            if (ptab == NULL) {
                return(0);
            }
            oldtop = ptab->toprow;
            if ((wParam) && (lParam < ptab->hdr.nrows)) {
                change = (long)lParam - ptab->toprow;
                change -= ptab->hdr.fixedrows;
                gtab_dovscroll(hwnd, ptab, change);
            }
            return(oldtop);

        case TM_ENDROW:
            /* return the last visible row in the window */
            ptab = (lpTable) GetWindowLongPtr(hwnd, WL_TABLE);
            if (ptab == NULL) {
                return(0);
            }
            return(ptab->nlines + ptab->toprow - 1);

        case TM_APPEND:
            /* new rows have been added to the end of the
             * table, but the rest of the table has not
             * been changed. Update without forcing redraw of
             * everything.
             * lParam contains the new total nr of rows
             */
            ptab = (lpTable) GetWindowLongPtr(hwnd, WL_TABLE);
            if (ptab != NULL) {
                gtab_append(hwnd, ptab, (int) wParam, (DWORD_PTR)lParam);
                return(TRUE);
            }
            break;

        case WM_SIZE:
            ptab = (lpTable) GetWindowLongPtr(hwnd, WL_TABLE);
            if (ptab != NULL) {
                gtab_setsize(hwnd, ptab);
            }
            break;

        case WM_ERASEBKGND:
            return TRUE;

        case WM_DESTROY:
            ptab = (lpTable) GetWindowLongPtr(hwnd, WL_TABLE);
            if (ptab != NULL) {
                gtab_sendtq(hwnd, TQ_CLOSE, ptab->hdr.id);
                gtab_deltable(hwnd, ptab);
            }
            break;

        case WM_SYSCOLORCHANGE:
            InvalidateRect(hwnd, NULL, TRUE);
            break;

        case WM_PAINT:
            gtab_paint(hwnd);
            break;

        case WM_HSCROLL:
            ptab = (lpTable) GetWindowLongPtr(hwnd, WL_TABLE);
            if (ptab != NULL) {
                gtab_msg_hscroll(hwnd, ptab,
                                 GET_SCROLL_OPCODE(wParam, lParam),
                                 GET_SCROLL_POS(wParam, lParam));
            }
            break;

        case WM_VSCROLL:
            ptab = (lpTable) GetWindowLongPtr(hwnd, WL_TABLE);
            if (ptab != NULL) {
                gtab_msg_vscroll(hwnd, ptab,
                                 GET_SCROLL_OPCODE(wParam, lParam),
                                 GET_SCROLL_POS(wParam, lParam));
            }
            break;

        case WM_MOUSEMOVE:
            ptab = (lpTable) GetWindowLongPtr(hwnd, WL_TABLE);
            if (ptab != NULL) {
                gtab_move(hwnd, ptab, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam));
            } else {
                SetCursor((HCURSOR)hNormCurs);
            }
            break;

        case WM_LBUTTONDOWN:
            ptab = (lpTable) GetWindowLongPtr(hwnd, WL_TABLE);
            if (ptab != NULL) {
                gtab_press(hwnd, ptab, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam));
            }
            break;

        case WM_RBUTTONDOWN:
            ptab = (lpTable) GetWindowLongPtr(hwnd, WL_TABLE);
            if (ptab != NULL) {
                gtab_rightclick(hwnd, ptab, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam));
            }
            break;

        case WM_LBUTTONUP:
            ptab = (lpTable) GetWindowLongPtr(hwnd, WL_TABLE);
            if (ptab != NULL) {
                gtab_release(hwnd, ptab,
                             (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam));
            }
            break;

        case WM_LBUTTONDBLCLK:
            ptab = (lpTable) GetWindowLongPtr(hwnd, WL_TABLE);
            if (ptab != NULL) {
                gtab_dblclick(hwnd, ptab,
                              (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam));
            }
            break;

        case WM_KEYDOWN:
            /* handle key presses for cursor movement about
             * the table, and return/space for selection.
             * Any key we don't handle is passed to the owner window
             * for him to handle.
             * The table window should have the focus
             */
            ptab = (lpTable) GetWindowLongPtr(hwnd, WL_TABLE);
            if (ptab != NULL) {
                if (gtab_key(hwnd, ptab, (int)wParam) != 0) {
                    hOwner = (HWND) GetWindowLongPtr(hwnd, WW_OWNER);
                    return(SendMessage(hOwner, WM_KEYDOWN, wParam, lParam));
                } else {
                    return(0);
                }
            }
            break;

#ifdef WM_MOUSEWHEEL
        case WM_MOUSEWHEEL:
            ptab = (lpTable)GetWindowLongPtr(hwnd, WL_TABLE);
            if (ptab != NULL) {
                if (gtab_mousewheel(hwnd,ptab, LOWORD(wParam), (short)HIWORD(wParam))) {
                    hOwner = (HWND)GetWindowLongPtr(hwnd, WW_OWNER);
                    return SendMessage(hOwner, WM_MOUSEWHEEL, wParam, lParam);
                }
            }
            break;
#endif

        default:
            return(DefWindowProc(hwnd, msg, wParam, lParam));
    }
    return(TRUE);
}

Variable Documentation

UINT gtab_msgcode

Definition at line 29 of file table.cpp.

HANDLE hLibInst

Definition at line 15 of file gutils.cpp.

HANDLE hNormCurs

Definition at line 27 of file table.cpp.

HPEN hpenDotted

Definition at line 28 of file table.cpp.

HANDLE hVertCurs

Definition at line 26 of file table.cpp.

Generated on Wed Nov 13 2024 16:53:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/sdkdiff/table.h File Reference

  • Begin
  • sdkdiff
Classes | Defines | Typedefs

table.h File Reference

Go to the source code of this file.

Classes

struct | CellData
struct | CellDataList
struct | CellPos
struct | ColProps
struct | ColPropsList
struct | Margin
struct | PrintContext
struct | Props
struct | TableHdr
struct | TableSelection
struct | Title

Defines

#define | P_ALIGN 0x10
#define | P_BCOLOUR 0x04
#define | P_BOX 0x20
#define | P_BOXALL 0xF
#define | P_BOXBOTTOM 2
#define | P_BOXLEFT 4
#define | P_BOXRIGHT 8
#define | P_BOXTOP 1
#define | P_CENTRE 2
#define | P_FCOLOUR 0x01
#define | P_FCOLOURWS 0x02
#define | P_FONT 0x08
#define | P_HEIGHT 0x80
#define | P_LEFT 0
#define | P_RIGHT 1
#define | P_WIDTH 0x40
#define | TableClassName "GTableClass"
#define | TableMessage "GTableQuery"
#define | TABWIDTH_DEFAULT 8
#define | TM_APPEND (WM_USER+7)
#define | TM_CELL 0
#define | TM_ENDROW (WM_USER+6)
#define | TM_FOCUS 4
#define | TM_GETSELECTION (WM_USER+8)
#define | TM_MANY 2
#define | TM_NEWID (WM_USER+2)
#define | TM_NEWLAYOUT (WM_USER+1)
#define | TM_PRINT (WM_USER+4)
#define | TM_REFRESH (WM_USER)
#define | TM_ROW 1
#define | TM_SELECT (WM_USER+3)
#define | TM_SETTABWIDTH (WM_USER+9)
#define | TM_SINGLE 0
#define | TM_SOLID 0
#define | TM_TOPROW (WM_USER+5)
#define | TQ_CLOSE 7
#define | TQ_ENTER 6
#define | TQ_GETCOLPROPS 2
#define | TQ_GETDATA 3
#define | TQ_GETSIZE 1
#define | TQ_PUTDATA 4
#define | TQ_SCROLL 8
#define | TQ_SELECT 5
#define | TQ_SHOWWHITESPACE 10
#define | TQ_TABS 9

Typedefs

typedef struct CellData * | lpCellData
typedef struct CellDataList * | lpCellDataList
typedef struct CellPos * | lpCellPos
typedef struct ColProps * | lpColProps
typedef struct ColPropsList * | lpColPropsList
typedef struct Margin * | lpMargin
typedef struct PrintContext * | lpPrintContext
typedef struct Props * | lpProps
typedef struct TableHdr * | lpTableHdr
typedef struct TableSelection * | lpTableSelection
typedef struct Title * | lpTitle

Define Documentation

#define P_ALIGN 0x10

Definition at line 154 of file table.h.

#define P_BCOLOUR 0x04

Definition at line 152 of file table.h.

#define P_BOX 0x20

Definition at line 155 of file table.h.

#define P_BOXALL 0xF

Definition at line 164 of file table.h.

#define P_BOXBOTTOM 2

Definition at line 161 of file table.h.

#define P_BOXLEFT 4

Definition at line 162 of file table.h.

#define P_BOXRIGHT 8

Definition at line 163 of file table.h.

#define P_BOXTOP 1

Definition at line 160 of file table.h.

#define P_CENTRE 2

Definition at line 169 of file table.h.

#define P_FCOLOUR 0x01

Definition at line 150 of file table.h.

#define P_FCOLOURWS 0x02

Definition at line 151 of file table.h.

#define P_FONT 0x08

Definition at line 153 of file table.h.

#define P_HEIGHT 0x80

Definition at line 157 of file table.h.

#define P_LEFT 0

Definition at line 167 of file table.h.

#define P_RIGHT 1

Definition at line 168 of file table.h.

#define P_WIDTH 0x40

Definition at line 156 of file table.h.

#define TableClassName "GTableClass"

Definition at line 45 of file table.h.

#define TableMessage "GTableQuery"

Definition at line 51 of file table.h.

#define TABWIDTH_DEFAULT 8

Definition at line 172 of file table.h.

#define TM_APPEND (WM_USER+7)

Definition at line 110 of file table.h.

#define TM_CELL 0

Definition at line 207 of file table.h.

#define TM_ENDROW (WM_USER+6)

Definition at line 103 of file table.h.

#define TM_FOCUS 4

Definition at line 213 of file table.h.

#define TM_GETSELECTION (WM_USER+8)

Definition at line 115 of file table.h.

#define TM_MANY 2

Definition at line 209 of file table.h.

#define TM_NEWID (WM_USER+2)

Definition at line 83 of file table.h.

#define TM_NEWLAYOUT (WM_USER+1)

Definition at line 80 of file table.h.

#define TM_PRINT (WM_USER+4)

Definition at line 91 of file table.h.

#define TM_REFRESH (WM_USER)

Definition at line 77 of file table.h.

#define TM_ROW 1

Definition at line 206 of file table.h.

#define TM_SELECT (WM_USER+3)

Definition at line 86 of file table.h.

#define TM_SETTABWIDTH (WM_USER+9)

Definition at line 120 of file table.h.

#define TM_SINGLE 0

Definition at line 210 of file table.h.

#define TM_SOLID 0

Definition at line 212 of file table.h.

#define TM_TOPROW (WM_USER+5)

Definition at line 97 of file table.h.

#define TQ_CLOSE 7

Definition at line 67 of file table.h.

#define TQ_ENTER 6

Definition at line 66 of file table.h.

#define TQ_GETCOLPROPS 2

Definition at line 62 of file table.h.

#define TQ_GETDATA 3

Definition at line 63 of file table.h.

#define TQ_GETSIZE 1

Definition at line 61 of file table.h.

#define TQ_PUTDATA 4

Definition at line 64 of file table.h.

#define TQ_SCROLL 8

Definition at line 70 of file table.h.

#define TQ_SELECT 5

Definition at line 65 of file table.h.

#define TQ_SHOWWHITESPACE 10

Definition at line 72 of file table.h.

#define TQ_TABS 9

Definition at line 71 of file table.h.

Typedef Documentation

typedef struct CellData* lpCellData
typedef struct CellDataList* lpCellDataList
typedef struct CellPos* lpCellPos
typedef struct ColProps* lpColProps
typedef struct ColPropsList* lpColPropsList
typedef struct Margin* lpMargin
typedef struct PrintContext* lpPrintContext
typedef struct Props* lpProps
typedef struct TableHdr* lpTableHdr
typedef struct TableSelection* lpTableSelection
typedef struct Title* lpTitle
Generated on Wed Nov 13 2024 16:53:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/sdkdiff/tpaint.cpp File Reference

  • Begin
  • sdkdiff
Functions

tpaint.cpp File Reference

#include "precomp.h"
#include "table.h"
#include "tpriv.h"

Go to the source code of this file.

Functions

void | gtab_boxcell (HWND hwnd, HDC hdc, LPRECT rcp, LPRECT pclip, UINT boxmode)
void | gtab_delcr (LPSTR ptext)
void | gtab_delcrW (LPWSTR pwzText)
void | gtab_drawvertline (HWND hwnd, lpTable ptab)
void | gtab_hsep (HWND hwnd, lpTable ptab, HDC hdc)
void | gtab_invertsel (HWND hwnd, lpTable ptab, HDC hdc_in)
void | gtab_paint (HWND hwnd)
void | gtab_paintcell (HWND hwnd, HDC hdc, lpTable ptab, int line, int cell, BOOL show_whitespace, BOOL fPrinting)
void | gtab_paintline (HWND hwnd, HDC hdc, lpTable ptab, int line, BOOL show_whitespace, BOOL fPrinting)
void | gtab_updatecontig (HWND hwnd, lpTable ptab, int line, int cell1, int count)
void | gtab_updateline (HWND hwnd, lpTable ptab, int line)
void | gtab_vsep (HWND hwnd, lpTable ptab, HDC hdc)

Function Documentation

void gtab_boxcell | ( | HWND | hwnd,
 |  | HDC | hdc,
 |  | LPRECT | rcp,
 |  | LPRECT | pclip,
 |  | UINT | boxmode
 | ) |  |

Definition at line 236 of file tpaint.cpp.

{
  if (boxmode & P_BOXTOP) {
    MoveToEx(hdc, max(rcp->left, pclip->left),
      max(rcp->top, pclip->top), NULL);
    LineTo(hdc, min(rcp->right, pclip->right),
      max(rcp->top, pclip->top));
  }
  if (boxmode & P_BOXBOTTOM) {
    MoveToEx(hdc, max(rcp->left, pclip->left),
      min(rcp->bottom, pclip->bottom), NULL);
    LineTo(hdc, min(rcp->right, pclip->right),
      min(rcp->bottom, pclip->bottom));
  }
  if (boxmode & P_BOXLEFT) {
    MoveToEx(hdc, max(rcp->left, pclip->left),
      max(rcp->top, pclip->top), NULL);
    MoveToEx(hdc, max(rcp->left, pclip->left),
      min(rcp->bottom, pclip->bottom), NULL);
  }
  if (boxmode & P_BOXRIGHT) {
    MoveToEx(hdc, min(rcp->right, pclip->right),
      max(rcp->top, pclip->top), NULL);
    LineTo(hdc, min(rcp->right, pclip->right),
      min(rcp->bottom, pclip->bottom));
  }
}

void gtab_delcr ( LPSTR ptext )

Definition at line 39 of file tpaint.cpp.

{
  LPSTR chp;

  if (ptext == NULL) {
    return;
  }
  for(chp = ptext; (chp = My_mbschr(chp, '\r')) != NULL; ) {
    *chp = '\0';
  }
  for(chp = ptext; (chp = My_mbschr(chp, '\n')) != NULL; ) {
    *chp = '\0';
  }
}

void gtab_delcrW ( LPWSTR pwzText )

Definition at line 53 of file tpaint.cpp.

{
  LPWSTR pwch;

  if (pwzText)
    for(pwch = pwzText; *pwch; pwch++)
      if (*pwch == '\r' || *pwch == '\n')
        *pwch = 0;
}

void gtab_drawvertline | ( | HWND | hwnd,
 |  | lpTable | ptab
 | ) |  |

Definition at line 632 of file tpaint.cpp.

{
  RECT rc;
  HDC hdc;
  HPEN hpen;

  hdc = GetDC(hwnd);
  if (hdc)
  {
    SetROP2(hdc, R2_XORPEN);
    hpen = (HPEN)SelectObject(hdc, hpenDotted);
    GetClientRect(hwnd, &rc);

    MoveToEx(hdc, ptab->trackline1, rc.top, NULL);
    LineTo(hdc, ptab->trackline1, rc.bottom);
    if (ptab->trackline2 != -1) {
      MoveToEx(hdc, ptab->trackline2, rc.top, NULL);
      LineTo(hdc, ptab->trackline2, rc.bottom);
    }

    SelectObject(hdc, hpen);
    ReleaseDC(hwnd, hdc);
  }
}

void gtab_hsep | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | HDC | hdc
 | ) |  |

Definition at line 615 of file tpaint.cpp.

{
  int y;
  RECT rc;

  if (ptab->hdr.fixedrows < 1) {
    return;
  }
  y = ptab->rowheight * ptab->hdr.fixedrows;
  GetClientRect(hwnd, &rc);
  MoveToEx(hdc, rc.left, y-1, NULL);
  LineTo(hdc, rc.right, y-1);
}

void gtab_invertsel | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | HDC | hdc_in
 | ) |  |

Definition at line 668 of file tpaint.cpp.

{
  HDC hdc;
  int firstline, lastline;
  long startrow, lastrow, toprow, bottomrow;
  RECT rc;
  int lastcell;

  /* get the selection start and end rows ordered vertically */
  if (ptab->select.nrows == 0) {
      return;
  } else if (ptab->select.nrows < 0) {
      startrow = ptab->select.startrow + ptab->select.nrows + 1;
      lastrow = ptab->select.startrow;
  } else {
      startrow = ptab->select.startrow;
      lastrow = ptab->select.startrow + ptab->select.nrows -1;
  }

  /* is selected area (or part of it) visible on screen ?  */
  firstline = gtab_rowtoline(hwnd, ptab, startrow);
  lastline = gtab_rowtoline(hwnd, ptab, lastrow);

  if (firstline < 0) {
      toprow = gtab_linetorow(hwnd, ptab,
          ptab->hdr.fixedselectable ? 0: ptab->hdr.fixedrows);
      if ((toprow >= startrow)  &&
    (toprow <= lastrow)) {
        firstline = gtab_rowtoline(hwnd, ptab, toprow);
      } else {
    return;
      }
  } else {
      toprow = 0;
  }

  if (lastline < 0) {
      bottomrow = gtab_linetorow(hwnd, ptab, ptab->nlines-1);
      if ((bottomrow <= lastrow) &&
    (bottomrow >=startrow)) {
        lastline = gtab_rowtoline(hwnd, ptab, bottomrow);
      } else {
    return;
      }
  }

  rc.top = ptab->pdata[firstline].linepos.clipstart;
  rc.bottom = ptab->pdata[lastline].linepos.clipend;

  /* selection mode includes a flag TM_FOCUS indicating we should
   * use a focus rect instead of the traditional inversion for
   * selections in this table. This interferes with multiple backgrnd
   * colours less.  However we still do inversion for fixedcols.
   */

  lastcell = (int)(ptab->select.startcell + ptab->select.ncells - 1);

  /*
   * invert the whole area for TM_SOLID or just the first
   * cell for TM_FOCUS
   */
  rc.left = ptab->pcellpos[ptab->select.startcell].clipstart;
  if (ptab->hdr.selectmode & TM_FOCUS) {
    rc.right = ptab->pcellpos[ptab->select.startcell].clipend;
  }else {
    rc.right = ptab->pcellpos[lastcell].clipend;
  }

  if (hdc_in == NULL) {
    hdc = GetDC(hwnd);
    if (!hdc)
      return;
  } else {
    hdc = hdc_in;
  }

  InvertRect(hdc, &rc);

  /*
   * draw focus rectangle around remaining cells on this line, if there
   * are any
   */
  if (ptab->hdr.selectmode & TM_FOCUS) {
    if (toprow > startrow) {
        rc.top--;
    }
    if (ptab->select.ncells > 1) {
      rc.left = ptab->pcellpos[ptab->select.startcell+1].clipstart;
      rc.right = ptab->pcellpos[lastcell].clipend;
      DrawFocusRect(hdc, &rc);
    }
  }

  if (hdc_in == NULL) {
    ReleaseDC(hwnd, hdc);
  }
}

void gtab_paint ( HWND hwnd )

Definition at line 552 of file tpaint.cpp.

{
    PAINTSTRUCT ps;
    int y, y2, i;
    HDC hDC = BeginPaint(hwnd, &ps);
    lpTable ptab = (lpTable) GetWindowLongPtr(hwnd, WL_TABLE);

    if (!ptab) {
        FillRect(hDC, &ps.rcPaint, (HBRUSH)(COLOR_WINDOW + 1));
    } else {
        /* separator lines between fixed rows/columns
         * (ie headers) and the rest - if enabled
         */
        /* paint here first for good impression,
         * and again after to clean up!!
         */
        if (ptab->hdr.vseparator) {
            gtab_vsep(hwnd, ptab, hDC);
        }
        if (ptab->hdr.hseparator) {
            gtab_hsep(hwnd, ptab, hDC);
        }

        /* paint only the rows that need painting */
        for (i = 0; i < ptab->nlines; i++) {
            y = ptab->pdata[i].linepos.start;
            y2 = y + ptab->pdata[i].linepos.size;
            if ( (y <= ps.rcPaint.bottom) &&
                 (y2 >= ps.rcPaint.top)) {
                gtab_paintline(hwnd, hDC, ptab, i, ptab->show_whitespace, FALSE);
            }
        }
        if (ptab->hdr.vseparator) {
            gtab_vsep(hwnd, ptab, hDC);
        }
        if (ptab->hdr.hseparator) {
            gtab_hsep(hwnd, ptab, hDC);
        }
        if (ptab->selvisible) {
            gtab_invertsel(hwnd, ptab, hDC);
        }
    }

    EndPaint(hwnd, &ps);
}

void gtab_paintcell | ( | HWND | hwnd,
 |  | HDC | hdc,
 |  | lpTable | ptab,
 |  | int | line,
 |  | int | cell,
 |  | BOOL | show_whitespace,
 |  | BOOL | fPrinting
 | ) |  |

Definition at line 265 of file tpaint.cpp.

{
  lpLineData pline;
  lpCellData cd;
  lpCellPos ppos;
  RECT rc, rcbox;
  int cx, x, y;
  UINT align;
  LPSTR chp, tabp=NULL;
  LPWSTR pwch, pwchBreak=NULL;
  DWORD fcol, fcolOld=0, fcolws=0;
  DWORD bkcol, bkcolOld=0;
  HFONT hfont, hfontOld=NULL;
  HBRUSH hbr;
  char szCharSet[] = "\t ";
  WCHAR wzCharSet[] = L"\t ";
  char szSpaceReplace[] = { (unsigned char)183,(unsigned char) 0 };
  char szTabReplace[] = { (unsigned char)187, (unsigned char) 0 };
  int cxSpaceReplace;
  int cxTabReplace;
  SIZE size ={0,0};
  TEXTMETRIC tm;
  int yOfs;
  DWORD etoFlags = ETO_CLIPPED;

        fcol = 0; bkcol = 0;
        hfont = 0;
  /* init pointers to cell text and properties */
  pline = &ptab->pdata[line];
  cd = &pline->pdata[cell];
  ppos = &ptab->pcellpos[cell];

  /* draw gutter */
  rc.top = pline->linepos.clipstart;
  rc.bottom = pline->linepos.clipend;
  rc.left = (cell > 0) ? ptab->pcellpos[cell - 1].clipend : 0;
  rc.right = ppos->clipstart;
  if (cell > ptab->hdr.fixedcols && ptab->hdr.fixedcols < ptab->hdr.ncols) {
    rc.left = max(rc.left, ptab->pcellpos[ptab->hdr.fixedcols].clipstart);
  }
  if (ptab->hdr.fixedcols > 0 && cell == ptab->hdr.fixedcols) {
    rc.right--;
  }
  if (!fPrinting && rc.right > rc.left) {
    FillRect(hdc, &rc, (HBRUSH)(COLOR_WINDOW + 1));
  }

  /* clip all output to this rectangle */
  rc.top = pline->linepos.clipstart;
  rc.bottom = pline->linepos.clipend;
  rc.left = ppos->clipstart;
  rc.right = ppos->clipend;

  /* check cell properties and colours */
  if (cd->props.valid & P_ALIGN) {
    align = cd->props.alignment;
  } else {
    align = P_LEFT;
  }

  if (!fPrinting && cd->props.valid & P_FONT) {
    hfontOld = (HFONT)SelectObject(hdc, cd->props.hFont);
  }

  // get y offset to center text vertically within cell
  GetTextMetrics(hdc, &tm);
  yOfs = (rc.bottom - rc.top - tm.tmHeight) / 2;

  /* set replacement chars and char widths */
  cxSpaceReplace = GetTextExtent(hdc, szSpaceReplace, 1);
  cxTabReplace = cxSpaceReplace * ptab->tabchars;

  /* set colours if not default */
  if (!fPrinting) {
    if (cd->props.valid & P_FCOLOUR) {
      fcol = cd->props.forecolour;
      fcolOld = SetTextColor(hdc, fcol);
    }
    if (cd->props.valid & P_FCOLOURWS) {
      fcolws = cd->props.forecolourws;
    }
    else {
      fcolws = fcol;
    }
    if (cd->props.valid & P_BCOLOUR) {
      /* there is a non-default background colour.
      * create a brush and fill the entire cell with it
       */
      hbr = CreateSolidBrush(cd->props.backcolour);
      if (hbr)
      {
        FillRect(hdc, &rc, hbr);
        DeleteObject(hbr);
      }

      /* also set colour as background colour for the text */
      bkcolOld = SetBkColor(hdc, cd->props.backcolour);
    }
  }

  /* calc offset of text within cell for right-align or centering */
  if (align == P_LEFT) {
    cx = ptab->avewidth/2;
  } else {
    cx = 0;

    if (cd->pwzText) {
      GetTextExtentPoint32W(hdc, cd->pwzText, (int)wcslen(cd->pwzText), &size);
    } else if (cd->ptext) {
      GetTextExtentPoint32A(hdc, cd->ptext, (int)lstrlen(cd->ptext), &size);
    }
    cx = size.cx;

    if (align == P_CENTRE) {
      cx = (ppos->size - cx) / 2;
    } else {
      cx = ppos->size - cx - (ptab->avewidth/2);
    }
  }
  cx += ppos->start;

  /* expand tabs on output and show whitespace on output */
  x = 0;
  y = pline->linepos.start + yOfs;

  /* set search string for strpbrk fn;
     don't search for space chars unless we're showing whitespace */
  if (!show_whitespace)
  {
    szCharSet[1] = '\0';
    wzCharSet[1] = '\0';
  }

  // determine the string to display (ansi/unicode).  if we have a string
  // and it's not empty, then loop and display it.
  chp = cd->ptext;
  pwch = cd->pwzText;
  if (pwch ? *pwch : (chp && *chp))
  {
    while (TRUE)
    {
      if (pwch)
      {
        pwchBreak = wcspbrk(pwch, wzCharSet);
        if (!pwchBreak)
          pwchBreak = pwch + wcslen(pwch);
      }
      else
      {
        tabp = (LPSTR)My_mbspbrk((PUCHAR)chp, (PUCHAR)szCharSet);
        if (!tabp)
          tabp = chp + lstrlen(chp);
      }

      /* perform output up to tab/space char */
      if (pwch)
        ExtTextOutW(hdc, x+cx, y, etoFlags, &rc, pwch, (UINT)(pwchBreak-pwch), NULL);
      else
        ExtTextOutA(hdc, x+cx, y, etoFlags, &rc, chp, (UINT)(tabp-chp), NULL);

      /* advance past the tab */
      if (pwch)
      {
        GetTextExtentPoint32W(hdc, pwch, (UINT)(pwchBreak - pwch), &size);
        pwch = pwchBreak;
      }
      else
      {
        GetTextExtentPoint32A(hdc, chp, (UINT)(tabp - chp), &size);
        chp = tabp;
      }
      x += size.cx;

      // bail if we hit null terminator
      if (pwch ? !*pwch : !*chp)
        break;

      /* handle tab chars */
      while (pwch ? (*pwch == '\t') : (*chp == '\t'))
      {
        /* print replacement char */
        if (show_whitespace)
        {
          if (!fPrinting)
            SetTextColor(hdc, fcolws);

          ExtTextOut(hdc, x + cx, y, etoFlags, &rc, szTabReplace, 1, NULL);

          if (!fPrinting)
            SetTextColor(hdc, fcol);
        }

        /* advance past the tab */
        if (cxTabReplace > 0)
          x += cxTabReplace - (x % cxTabReplace);
        if (pwch)
          pwch = ++pwchBreak;
        else
          chp = ++tabp;
      }

      /* handle space chars */
      if (show_whitespace)
      {
        while (pwch ? (*pwch == ' ') : (*chp == ' '))
        {
          /* replace space char with visible char */
          if (!fPrinting)
            SetTextColor(hdc, fcolws);

          ExtTextOut(hdc, x + cx, y, etoFlags, &rc, szSpaceReplace, 1, NULL);

          if (!fPrinting)
            SetTextColor(hdc, fcol);

          x += cxSpaceReplace;
          if (pwch)
            pwch = ++pwchBreak;
          else
            chp = ++tabp;
        }
      }
    }
  }

  /* reset colours to original if not default */
  if (!fPrinting) {
    if (cd->props.valid & P_FCOLOUR) {
      SetTextColor(hdc, fcolOld);
    }
    if (cd->props.valid & P_BCOLOUR) {
      SetBkColor(hdc, bkcolOld);
    }
    if (cd->props.valid & P_FONT) {
      SelectObject(hdc, hfontOld);
    }
  }

  /* now box cell if marked */
  if (!fPrinting) {
    if ((cd->props.valid & P_BOX)) {
      if (cd->props.box != 0) {
        rcbox.top = y;
        rcbox.bottom = rcbox.top + pline->linepos.size;
        rcbox.left = ppos->start;
        rcbox.right = ppos->start + ppos->size;
        gtab_boxcell(hwnd, hdc, &rcbox, &rc, cd->props.box);
      }
    }
  }
}

void gtab_paintline | ( | HWND | hwnd,
 |  | HDC | hdc,
 |  | lpTable | ptab,
 |  | int | line,
 |  | BOOL | show_whitespace,
 |  | BOOL | fPrinting
 | ) |  |

Definition at line 519 of file tpaint.cpp.

{
  lpCellPos ppos = NULL;
  int i;
  RECT rc;

  if (line < 0 || line >= ptab->nlines)
    return;

  if (!fPrinting)
    GetClientRect(hwnd, &rc);

  gtab_updateline(hwnd, ptab, line);

  for (i = 0; i < ptab->hdr.ncols; i++) {
    ppos = &ptab->pcellpos[i];
    /* show whitespace iff the flag is set
       and we're painting the main text column */
    if (ppos->clipstart < ppos->clipend) {
      gtab_paintcell(hwnd, hdc, ptab, line, i,
               (show_whitespace && (i == 2)), fPrinting);
    }
  }

  if (!fPrinting && ppos) {
    rc.top = ptab->pdata[line].linepos.clipstart;
    rc.bottom = ptab->pdata[line].linepos.clipend;
    rc.left = ppos->clipend;
    FillRect(hdc, &rc, (HBRUSH)(COLOR_WINDOW + 1));
  }
}

void gtab_updatecontig | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | int | line,
 |  | int | cell1,
 |  | int | count
 | ) |  |

Definition at line 123 of file tpaint.cpp.

{
  lpLineData pline;
  lpCellData cd;
  CellDataList list;
  lpProps colprops;
  int i;
  COLORREF rgb;

  pline = &ptab->pdata[line];
  cd = &pline->pdata[cell1];

  list.id = ptab->hdr.id;
  list.row = gtab_linetorow(hwnd, ptab, line);
  list.startcell = cell1;
  list.ncells = count;
  list.plist = cd;

  /* clear out prop flags */
  rgb = GetSysColor(COLOR_WINDOW);
  for (i = 0; i < count; i++) {
    cd[i].props.valid = P_BCOLOUR;
    cd[i].props.backcolour = rgb;
    if (cd[i].nchars > 0) {
      cd[i].ptext[0] = '\0';
      if (cd[i].pwzText) {
        cd[i].pwzText[0] = '\0';
      }
    }
  }

  if (list.row < ptab->hdr.nrows) {
    gtab_sendtq(hwnd, TQ_GETDATA, (LPARAM) &list);
  }

  /* for each cell, mark valid and set properties */
  for (i = 0; i < count; i++) {
    cd[i].flags |= CELL_VALID;
    gtab_delcr(cd[i].ptext);
    gtab_delcrW(cd[i].pwzText);
    /* fetch properties from hdr and colhdr */
    colprops = &ptab->pcolhdr[i + cell1].props;
    if (!(cd[i].props.valid & P_FCOLOUR)) {
      if (colprops->valid & P_FCOLOUR) {
        cd[i].props.valid |= P_FCOLOUR;
        cd[i].props.forecolour = colprops->forecolour;
      } else if (ptab->hdr.props.valid & P_FCOLOUR) {
        cd[i].props.valid |= P_FCOLOUR;
        cd[i].props.forecolour =
          ptab->hdr.props.forecolour;
      }
    }

    if (!(cd[i].props.valid & P_FCOLOURWS)) {
      if (colprops->valid & P_FCOLOURWS) {
        cd[i].props.valid |= P_FCOLOURWS;
        cd[i].props.forecolourws = colprops->forecolourws;
      } else if (ptab->hdr.props.valid & P_FCOLOURWS) {
        cd[i].props.valid |= P_FCOLOURWS;
        cd[i].props.forecolourws =
          ptab->hdr.props.forecolourws;
      }
    }

    if (!(cd[i].props.valid & P_BCOLOUR)) {
      if (colprops->valid & P_BCOLOUR) {
        cd[i].props.valid |= P_BCOLOUR;
        cd[i].props.backcolour = colprops->backcolour;
      } else if (ptab->hdr.props.valid & P_BCOLOUR) {
        cd[i].props.valid |= P_BCOLOUR;
        cd[i].props.backcolour =
          ptab->hdr.props.backcolour;
      }
    }

    if (!(cd[i].props.valid & P_FONT)) {
      if (colprops->valid & P_FONT) {
        cd[i].props.valid |= P_FONT;
        cd[i].props.hFont = colprops->hFont;
      } else if (ptab->hdr.props.valid & P_FONT) {
        cd[i].props.valid |= P_FONT;
        cd[i].props.hFont = ptab->hdr.props.hFont;
      }
    }

    if (!(cd[i].props.valid & P_ALIGN)) {
      if (colprops->valid & P_ALIGN) {
        cd[i].props.valid |= P_ALIGN;
        cd[i].props.alignment = colprops->alignment;
      } else if (ptab->hdr.props.valid & P_ALIGN) {
        cd[i].props.valid |= P_ALIGN;
        cd[i].props.alignment =
          ptab->hdr.props.alignment;
      }
    }

    if (!(cd[i].props.valid & P_BOX)) {
      if (colprops->valid & P_BOX) {
        cd[i].props.valid |= P_BOX;
        cd[i].props.box = colprops->box;
      } else if (ptab->hdr.props.valid & P_BOX) {
        cd[i].props.valid |= P_BOX;
        cd[i].props.box = ptab->hdr.props.box;
      }
    }
    /* you can't set width/height per cell - this
     * is ignored at cell level.
     */
  }

}

void gtab_updateline | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | int | line
 | ) |  |

Definition at line 69 of file tpaint.cpp.

{
  lpCellPos ppos;
  int cell1, cellcount;
  lpLineData pline;
  lpCellData cd;
  int i;

  if (line < 0 || line >= ptab->nlines)
    return;

  pline = &ptab->pdata[line];
  cell1 = 0;
  cellcount = 0;
  for (i = 0; i < ptab->hdr.ncols; i++) {
    ppos = &ptab->pcellpos[i];
    cd = &pline->pdata[i];
    if (ppos->clipstart < ppos->clipend) {
      if ((cd->flags & CELL_VALID) == 0) {
        /* add a cell to the list to be updated*/
        if (cellcount++ == 0) {
          cell1 = i;
        }
      } else {
        /* this cell already valid - so end of
         * a contig block. if the contig
         * block just ended contained cells to update,
         * do it now
         */
        if (cellcount > 0) {
          gtab_updatecontig(hwnd, ptab,
            line, cell1, cellcount);
        }
        cellcount = 0;
      }
    }
    /* cell not visible - end of a contig block. If it was a
     * non-empty contig block, then update it now.
     */
    if (cellcount > 0)  {
      gtab_updatecontig(hwnd, ptab, line, cell1, cellcount);
      cellcount = 0;
    }
  }
  if (cellcount > 0) {
    gtab_updatecontig(hwnd, ptab, line, cell1, cellcount);
    cellcount = 0;
  }
}

void gtab_vsep | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | HDC | hdc
 | ) |  |

Definition at line 600 of file tpaint.cpp.

{
  int x;
  RECT rc;

  if (ptab->hdr.fixedcols < 1) {
    return;
  }
  x = ptab->pcellpos[ptab->hdr.fixedcols - 1].clipend+1;
  GetClientRect(hwnd, &rc);
  MoveToEx(hdc, x, rc.top, NULL);
  LineTo(hdc, x, rc.bottom);
}

Generated on Wed Nov 13 2024 16:53:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/sdkdiff/tprint.cpp File Reference

  • Begin
  • sdkdiff
Functions | Variables

tprint.cpp File Reference

#include "precomp.h"
#include "gutilsrc.h"
#include "table.h"
#include "tpriv.h"
#include "..\sdkdiff\errorout.h"

Go to the source code of this file.

Functions

int APIENTRY | AbortDlg (HWND hdlg, UINT msg, UINT wParam, LONG lParam)
int APIENTRY | AbortProc (HDC hpr, int code)
int | GetTextExtent (HDC, LPSTR, int)
BOOL | gtab_print (HWND hwnd, lpTable ptab, lpPrintContext pcontext)
void | gtab_printhead (HWND hwnd, HDC hdc, lpTable ptab, lpTitle head, int page, BOOL fExpandChars)
void | gtab_printjob (HWND hwnd, lpTable ptab, lpPrintContext pcontext)
BOOL | gtab_printpage (HWND hwnd, lpTable ptab, lpPrintContext pcontext, int page)
lpTable | gtab_printsetup (HWND hwnd, lpTable ptab, lpPrintContext pcontext)
BOOL | gtab_prtwidths (HWND hwnd, lpTable ptab, lpPrintContext pcontext)
void | gtab_setrects (lpPrintContext pcontext, LPRECT rcinner, LPRECT rcouter)

Variables

BOOL g_bAbort
HWND | hAbortWnd
HANDLE hLibInst
DLGPROC | lpAbortDlg
FARPROC | lpAbortProc
int | npage
int | pages

Function Documentation

int APIENTRY AbortDlg | ( | HWND | hdlg,
 |  | UINT | msg,
 |  | UINT | wParam,
 |  | LONG | lParam
 | ) |  |

Definition at line 418 of file tprint.cpp.

{
    switch (msg) {

        case WM_COMMAND:
            g_bAbort = TRUE;
            EndDialog(hdlg, TRUE);
            return TRUE;

        case WM_INITDIALOG:
            return TRUE;
    }
    return(FALSE);
}

int APIENTRY AbortProc | ( | HDC | hpr,
 |  | int | code
 | ) |  |

Definition at line 400 of file tprint.cpp.

{

    MSG msg;

    if (!hAbortWnd) {
        return(TRUE);
    }
    while (!g_bAbort && PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
        if (!IsDialogMessage(hAbortWnd, &msg)) {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
    }
    return(!g_bAbort);
}

int GetTextExtent | ( | HDC | ,
 |  | LPSTR | ,
 |  | int |
 | ) |  |
BOOL gtab_print | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | lpPrintContext | pcontext
 | ) |  |

Definition at line 47 of file tprint.cpp.

{
    BOOL fNoContext, fNoMargin, fNoPD;
    BOOL fSuccess = TRUE;
    lpTable ptab_prt;

    fNoContext = FALSE;
    fNoPD = FALSE;
    fNoMargin = FALSE;

    if (pcontext == NULL) {
        fNoContext = TRUE;
        pcontext = (lpPrintContext) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
                                             sizeof(PrintContext));
        if (pcontext == NULL)
      return (FALSE);
    pcontext->head = pcontext->foot = NULL;
        pcontext->margin = NULL;
        pcontext->pd = NULL;
        pcontext->id = 0;
    }
    if (pcontext->pd == NULL) {
        fNoPD = TRUE;
    }
    if (pcontext->margin == NULL) {
        fNoMargin = TRUE;
    }
    ptab_prt = gtab_printsetup(hwnd, ptab, pcontext);

    if (ptab_prt != NULL) {
        gtab_printjob(hwnd, ptab_prt, pcontext);

        gtab_deltable(hwnd, ptab_prt);
    } else fSuccess = FALSE;
    if (fNoMargin) {
        HeapFree(GetProcessHeap(), NULL, pcontext->margin);
        pcontext->margin = NULL;
    }
    if (fNoPD) {
        if (pcontext->pd->hDevMode != NULL) {
            GlobalFree(pcontext->pd->hDevMode);
        }
        if (pcontext->pd->hDevNames != NULL) {
            GlobalFree(pcontext->pd->hDevNames);
        }
        HeapFree(GetProcessHeap(), NULL, pcontext->pd);
        pcontext->pd = NULL;
    }
    if (fNoContext) {
        HeapFree(GetProcessHeap(), NULL, pcontext);
    }
    return fSuccess;
}

void gtab_printhead | ( | HWND | hwnd,
 |  | HDC | hdc,
 |  | lpTable | ptab,
 |  | lpTitle | head,
 |  | int | page,
 |  | BOOL | fExpandChars
 | ) |  |

Definition at line 516 of file tprint.cpp.

{
    RECT rc, rcbox;
    int i, cx, x, y, tab;
    UINT align;
    LPSTR chp, tabp;
    DWORD fcol, bkcol;
    TCHAR str[MAX_PATH * 2];
  TCHAR szbuffer[MAX_PATH];
  HRESULT hr;

    fcol = 0; bkcol = 0;  /* eliminate spurious diagnostic - generate worse code */

    rc.top = head->ypos.clipstart;
    rc.bottom = head->ypos.clipend;
    rc.left = head->xpos.clipstart;
    rc.right = head->xpos.clipend;
  memset(str, 0, MAX_PATH*2);

    /* update page number */
    if (fExpandChars) {
        chp = str;
        for (i = 0; i < lstrlen(head->ptext); i++) {
      memset(szbuffer, 0, MAX_PATH);
            switch (head->ptext[i]) {

                case '#':
          hr = StringCchPrintf(szbuffer, MAX_PATH, "%d", page);
          if (FAILED(hr)) {
            OutputError(hr, IDS_SAFE_PRINTF);
          }
          hr = StringCchCat(str, MAX_PATH*2, szbuffer);
          if (FAILED(hr)) {
            OutputError(hr, IDS_SAFE_CAT);
          }
          chp += strlen(szbuffer);
                    break;

                case '$':
                    hr = StringCchPrintf(szbuffer, MAX_PATH, "%d", pages);
          if (FAILED(hr))
            OutputError(hr, IDS_SAFE_PRINTF);
          hr = StringCchCat(str, MAX_PATH*2, szbuffer);
          if (FAILED(hr)) {
            OutputError(hr, IDS_SAFE_CAT);
          }
          chp += strlen(szbuffer);
                    break;

                default:
                    if (IsDBCSLeadByte(head->ptext[i]) &&
                        head->ptext[i+1])
                    {
                        *chp = head->ptext[i];
                        chp++;
                        i++;
                    }
                    *chp++ = head->ptext[i];
                    break;
            }
        }
        *chp = '\0';
    } else {
        hr = StringCchCopy(str,(MAX_PATH*2), head->ptext);
    if (FAILED(hr))
      OutputError(hr, IDS_SAFE_COPY);
    }
    chp = str;

    if (head->props.valid & P_ALIGN) {
        align = head->props.alignment;
    } else {
        align = P_LEFT;
    }

    /* set colours if not default */
    if (head->props.valid & P_FCOLOUR) {
        fcol = SetTextColor(hdc, head->props.forecolour);
    }
    if (head->props.valid & P_BCOLOUR) {
        bkcol = SetBkColor(hdc, head->props.backcolour);
    }

    /* calc offset of text within cell for right-align or centering */
    if (align == P_LEFT) {
        cx = ptab->avewidth/2;
    } else {
        cx = LOWORD(GetTextExtent(hdc, chp, lstrlen(chp)));
        if (align == P_CENTRE) {
            cx = (head->xpos.size - cx) / 2;
        } else {
            cx = head->xpos.size - cx - (ptab->avewidth/2);
        }
    }
    cx += head->xpos.start;

    /* expand tabs on output */
    tab = ptab->avewidth * ptab->tabchars;
    x = 0;
    y = head->ypos.start;

    for ( ; (tabp = My_mbschr(chp, '\t')) != NULL; ) {
        /* perform output upto tab char */
        ExtTextOut(hdc, x+cx, y, ETO_CLIPPED, &rc, chp, (UINT)(tabp-chp), NULL);

        /* advance past the tab */
        x += LOWORD(GetTextExtent(hdc, chp, (INT)(tabp - chp)));
        x = ( (x + tab) / tab) * tab;
        chp = ++tabp;
    }

    /*no more tabs - output rest of string */
    ExtTextOut(hdc, x+cx, y, ETO_CLIPPED, &rc, chp, lstrlen(chp), NULL);

    /* reset colours to original if not default */
    if (head->props.valid & P_FCOLOUR) {
        SetTextColor(hdc, fcol);
    }
    if (head->props.valid & P_BCOLOUR) {
        SetBkColor(hdc, bkcol);
    }

    /* now box cell if marked */
    if (head->props.valid & P_BOX) {
        if (head->props.box != 0) {
            rcbox.top = head->ypos.start;
            rcbox.bottom = rcbox.top + head->ypos.size;
            rcbox.left = head->xpos.start;
            rcbox.right = rcbox.left + head->xpos.size;
            gtab_boxcell(hwnd, hdc, &rcbox, &rc, head->props.box);
        }
    }
}

void gtab_printjob | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | lpPrintContext | pcontext
 | ) |  |

Definition at line 322 of file tprint.cpp.

{
    int moveables;
    int endpage;
    int startpage = 1;
    HDC hpr;
    int status;
    HANDLE hcurs;
    static char str[256];
    DOCINFO di;
    TCHAR szPage[60];  /* for LoadString */

    hcurs = SetCursor(LoadCursor(NULL, IDC_WAIT));

    moveables = ptab->nlines - ptab->hdr.fixedrows;
    pages = (int) (ptab->hdr.nrows - ptab->hdr.fixedrows + moveables - 1)
            / moveables;
    endpage = pages;

    if (pcontext->pd->Flags & PD_PAGENUMS) {
        startpage = pcontext->pd->nFromPage;
        endpage = pcontext->pd->nToPage;
    }
    hpr = pcontext->pd->hDC;

    lpAbortDlg = (DLGPROC) MakeProcInstance((WINPROCTYPE) AbortDlg, hLibInst);
    lpAbortProc = (FARPROC) MakeProcInstance((WINPROCTYPE)AbortProc, hLibInst);

    SetAbortProc(hpr, (ABORTPROC) lpAbortProc);

    di.lpszDocName = "Table";
    di.cbSize = lstrlen(di.lpszDocName);
    di.lpszOutput = NULL;
    di.lpszDatatype = NULL;
    di.fwType = 0;

    StartDoc(hpr, &di);

    g_bAbort = FALSE;

    /* add abort modeless dialog later!! */
    hAbortWnd = CreateDialog((HINSTANCE)hLibInst, "GABRTDLG", hwnd, lpAbortDlg);
    if (hAbortWnd != NULL) {
        ShowWindow(hAbortWnd, SW_NORMAL);
        EnableWindow(hwnd, FALSE);
    }
    SetCursor((HCURSOR)hcurs);

    status = 0;  /* kills a "used without init" diagnostic */
    for (npage = startpage; npage<=endpage; npage++) {
        LoadString((HINSTANCE)hLibInst,IDS_PAGE_STR,szPage,sizeof(szPage));
        HRESULT hr = StringCchPrintf(str, 256, szPage,  npage, pages);
    if (FAILED(hr))
      OutputError(hr, IDS_SAFE_PRINTF);
        if (hAbortWnd != NULL)
            SetDlgItemText(hAbortWnd, IDC_LPAGENR, str);
        status = gtab_printpage(hwnd, ptab, pcontext, npage);
        if (status < 0) {
            AbortDoc(hpr);
            break;
        }
    }
    if (status >= 0) {
        EndDoc(hpr);
    }

    if (hAbortWnd != NULL) {
        EnableWindow(hwnd, TRUE);
        DestroyWindow(hAbortWnd);
    }
    FreeProcInstance((WINPROCTYPE) lpAbortDlg);
    FreeProcInstance(lpAbortProc);

    DeleteDC(hpr);
}

BOOL gtab_printpage | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | lpPrintContext | pcontext,
 |  | int | page
 | ) |  |

Definition at line 437 of file tprint.cpp.

{
    HDC hpr;
    int moveables, i;
    int x1, y1, x2, y2;

    hpr = pcontext->pd->hDC;
    StartPage(hpr);

    moveables = ptab->nlines - ptab->hdr.fixedrows;
    ptab->toprow = moveables * (page-1);
    gtab_invallines(hwnd, ptab, ptab->hdr.fixedrows, moveables);

    for (i =0; i < ptab->nlines; i++) {
        gtab_paintline(hwnd, hpr, ptab, i, ptab->show_whitespace, TRUE);
    }
    if ((ptab->hdr.vseparator) && (ptab->hdr.fixedcols > 0)) {
        x1 = ptab->pcellpos[ptab->hdr.fixedcols -1].clipend+1;
        y1 = ptab->pdata[0].linepos.clipstart;
        y2 = ptab->pdata[ptab->nlines-1].linepos.clipend;
        MoveToEx(hpr, x1, y1, NULL);
        LineTo(hpr, x1, y2);
    }
    if ((ptab->hdr.hseparator) && (ptab->hdr.fixedrows > 0)) {
        y1 = ptab->pdata[ptab->hdr.fixedrows-1].linepos.clipend;
        x1 = ptab->pcellpos[0].clipstart;
        x2 = ptab->pcellpos[ptab->hdr.ncols-1].clipend;
        MoveToEx(hpr, x1, y1, NULL);
        LineTo(hpr, x2, y1);
    }

    if (pcontext->head != NULL) {
        gtab_printhead(hwnd, hpr, ptab, pcontext->head, page, FALSE);
    }
    if (pcontext->foot != NULL) {
        gtab_printhead(hwnd, hpr, ptab, pcontext->foot, page, TRUE);
    }

    return(EndPage(hpr));
}

lpTable gtab_printsetup | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | lpPrintContext | pcontext
 | ) |  |

Definition at line 110 of file tprint.cpp.

{
    lpTable pprttab;
    PRINTDLG FAR * pd;
    int ncols, i;
    ColPropsList cplist;

    /* set fields for context that user left null */
    if (pcontext->margin == NULL) {
        pcontext->margin = (lpMargin) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(Margin));
        if (pcontext->margin == NULL) {
            return(NULL);
        }
        pcontext->margin->left = 10;
        pcontext->margin->right = 10;
        pcontext->margin->top = 15;
        pcontext->margin->bottom = 15;
        pcontext->margin->topinner = 15;
        pcontext->margin->bottominner = 15;
    }

    if (pcontext->pd == NULL) {
        pd = (PRINTDLG FAR *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(PRINTDLG));
        if (pd == NULL) {
            return(NULL);
        }
        pcontext->pd = pd;

        pd->lStructSize = sizeof(PRINTDLG);
        pd->hwndOwner = hwnd;
        pd->hDevMode = (HANDLE) NULL;
        pd->hDevNames = (HANDLE) NULL;
        pd->Flags = PD_RETURNDC|PD_RETURNDEFAULT;

        if (PrintDlg(pd) == FALSE) {
            return(NULL);
        }
    }

    /* now create a Table struct by querying the owner */
    pprttab = (lpTable)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(Table));

    if (pprttab == NULL) {
        return(NULL);
    }
    pprttab->hdr = ptab->hdr;
    pprttab->tabchars = ptab->tabchars;
    pprttab->show_whitespace = ptab->show_whitespace;

    /* get the row/column count from owner window */
    if (pcontext->id == 0) {
        pprttab->hdr.id = ptab->hdr.id;
    } else {
        pprttab->hdr.id = pcontext->id;
    }
    pprttab->hdr.props.valid = 0;
    pprttab->hdr.sendscroll = FALSE;
    if (gtab_sendtq(hwnd, TQ_GETSIZE, (LPARAM)&pprttab->hdr) == FALSE) {
        return(NULL);
    }

    /* alloc and init the col data structs */
    ncols = pprttab->hdr.ncols;
    pprttab->pcolhdr = (lpColProps) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ColProps) * ncols);
    if (pprttab->pcolhdr == NULL) {
        HeapFree(GetProcessHeap(), NULL, pprttab);
        return(NULL);
    }

    /* init col properties to default */
    for (i=0; i < ncols; i++) {
        pprttab->pcolhdr[i].props.valid = 0;
        pprttab->pcolhdr[i].nchars = 0;
    }
    /* get the column props from owner */
    cplist.plist = pprttab->pcolhdr;
    cplist.id = pprttab->hdr.id;
    cplist.startcol = 0;
    cplist.ncols = ncols;
    gtab_sendtq(hwnd, TQ_GETCOLPROPS, (LPARAM)&cplist);

    pprttab->scrollscale = 1;
    pprttab->pcellpos = (lpCellPos) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
                                             sizeof(CellPos) * ptab->hdr.ncols);
    if (pprttab->pcellpos == NULL) {
        HeapFree(GetProcessHeap(), NULL, pprttab->pcolhdr);
        HeapFree(GetProcessHeap(), NULL, pprttab);
        return(NULL);
    }

    pprttab->pdata = NULL;
    pprttab->nlines = 0;

    if (!gtab_prtwidths(hwnd, pprttab, pcontext)) {
        HeapFree(GetProcessHeap(), NULL, pprttab->pcellpos);
        HeapFree(GetProcessHeap(), NULL, pprttab);
        return(NULL);
    }
    return(pprttab);
}

BOOL gtab_prtwidths | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | lpPrintContext | pcontext
 | ) |  |

Definition at line 216 of file tprint.cpp.

{
    TEXTMETRIC tm;
    int cx, cxtotal, i, curx, cury;
    lpProps hdrprops, cellprops;
    lpCellPos xpos, ypos;
    RECT rcinner, rcouter;

    hdrprops = &ptab->hdr.props;
    GetTextMetrics(pcontext->pd->hDC, &tm);
    ptab->avewidth = tm.tmAveCharWidth;
    ptab->rowheight = tm.tmHeight + tm.tmExternalLeading;
    if (hdrprops->valid & P_HEIGHT) {
        ptab->rowheight = hdrprops->height;
    }

    /* set sizes for headers */
    gtab_setrects(pcontext, &rcinner, &rcouter);

    /* set width/pos for each col. */
    cxtotal = 0;
    curx = rcinner.left;
    for (i = 0; i < ptab->hdr.ncols; i++) {
        cellprops = &ptab->pcolhdr[i].props;
        xpos = &ptab->pcellpos[i];

        if (cellprops->valid & P_WIDTH) {
            cx = cellprops->width;
        } else if (hdrprops->valid & P_WIDTH) {
            cx = hdrprops->width;
        } else {
            cx = ptab->pcolhdr[i].nchars + 1;
            cx *= ptab->avewidth;
        }
        /* add 2 for intercol spacing */
        cx += 2;

        xpos->size = cx;
        xpos->start = curx + 1;
        xpos->clipstart = xpos->start;
        xpos->clipend = xpos->start + xpos->size - 2;
        xpos->clipend = min(xpos->clipend, rcinner.right);

        cxtotal += xpos->size;
        curx += xpos->size;
    }
    ptab->rowwidth = cxtotal;

    if (pcontext->head != NULL) {
        xpos = &pcontext->head->xpos;
        ypos = &pcontext->head->ypos;

        xpos->start = rcouter.left + 1;
        xpos->clipstart = rcouter.left + 1;
        xpos->clipend = rcouter.right - 1;
        xpos->size = rcouter.right - rcouter.left;

        ypos->start = rcouter.top;
        ypos->clipstart = rcouter.top;
        ypos->clipend = rcinner.top;
        ypos->size = ptab->rowheight;
    }

    if (pcontext->foot != NULL) {
        xpos = &pcontext->foot->xpos;
        ypos = &pcontext->foot->ypos;

        xpos->start = rcouter.left + 1;
        xpos->clipstart = rcouter.left + 1;
        xpos->clipend = rcouter.right - 1;
        xpos->size = rcouter.right - rcouter.left;

        ypos->start = rcouter.bottom - ptab->rowheight;
        ypos->clipstart = rcinner.bottom;
        ypos->clipend = rcouter.bottom;
        ypos->size = ptab->rowheight;
    }

    /* set nr of lines per page */
    ptab->nlines = (rcinner.bottom - rcinner.top) / ptab->rowheight;
    if (!gtab_alloclinedata(hwnd, ptab)) {
        return(FALSE);
    }
    /* set line positions */
    cury = rcinner.top;
    for (i = 0; i < ptab->nlines; i++) {
        ypos = &ptab->pdata[i].linepos;
        ypos->start = cury;
        ypos->clipstart = ypos->start;
        ypos->clipend = ypos->start + ypos->size;
        ypos->clipend = min(ypos->clipend, rcinner.bottom);
        cury += ypos->size;
    }
    return(TRUE);
}

void gtab_setrects | ( | lpPrintContext | pcontext,
 |  | LPRECT | rcinner,
 |  | LPRECT | rcouter
 | ) |  |

Definition at line 485 of file tprint.cpp.

{
    HDC hpr;
    int hpixels, hmms;
    int vpixels, vmms;
    int h_pixpermm, v_pixpermm;

    hpr = pcontext->pd->hDC;
    hpixels = GetDeviceCaps(hpr, HORZRES);
    vpixels = GetDeviceCaps(hpr, VERTRES);
    vmms = GetDeviceCaps(hpr, VERTSIZE);
    hmms = GetDeviceCaps(hpr, HORZSIZE);

    h_pixpermm = hpixels / hmms;
    v_pixpermm = vpixels / vmms;

    rcouter->top = (pcontext->margin->top * v_pixpermm);
    rcouter->bottom = vpixels - (pcontext->margin->bottom * v_pixpermm);
    rcouter->left = (pcontext->margin->left * h_pixpermm);
    rcouter->right = hpixels - (pcontext->margin->right * h_pixpermm);

    rcinner->left = rcouter->left;
    rcinner->right = rcouter->right;
    rcinner->top = rcouter->top +
                   (pcontext->margin->topinner * v_pixpermm);
    rcinner->bottom = rcouter->bottom -
                      (pcontext->margin->bottominner * v_pixpermm);
}

Variable Documentation

BOOL g_bAbort

Definition at line 314 of file tprint.cpp.

HWND hAbortWnd

Definition at line 317 of file tprint.cpp.

HANDLE hLibInst

Definition at line 15 of file gutils.cpp.

DLGPROC lpAbortDlg

Definition at line 316 of file tprint.cpp.

FARPROC lpAbortProc

Definition at line 315 of file tprint.cpp.

int npage

Definition at line 318 of file tprint.cpp.

int pages

Definition at line 319 of file tprint.cpp.

Generated on Wed Nov 13 2024 16:53:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/sdkdiff/tpriv.h File Reference

  • Begin
  • sdkdiff
Classes | Defines | Typedefs | Functions | Variables

tpriv.h File Reference

Go to the source code of this file.

Classes

struct | LineData
struct | Table

Defines

#define | abs(x) (((x) > 0)? (x) : -(x))
#define | CELL_VALID 1
#define | TRACK_CELL 2
#define | TRACK_COLUMN 1
#define | TRACK_NONE 0
#define | WL_TABLE (WW_HEAP + sizeof(HANDLE))
#define | WLTOTAL (WL_TABLE + sizeof(lpTable))
#define | WW_HEAP (WW_OWNER + sizeof(HWND))
#define | WW_OWNER 0

Typedefs

typedef struct LineData * | lpLineData
typedef struct Table * | lpTable

Functions

BOOL | gtab_alloclinedata (HWND hwnd, lpTable ptab)
void | gtab_boxcell (HWND hwnd, HDC hdc, LPRECT rcp, LPRECT pclip, UINT boxmode)
void | gtab_calcwidths (HWND hwnd, lpTable ptab)
void | gtab_dblclick (HWND hwnd, lpTable ptab, int x, int y)
void | gtab_deltable (HWND hwnd, lpTable ptab)
void | gtab_dohscroll (HWND hwnd, lpTable ptab, long change)
void | gtab_dovscroll (HWND hwnd, lpTable ptab, long change)
void | gtab_drawvertline (HWND hwnd, lpTable ptab)
void | gtab_enter (HWND hwnd, lpTable ptab, long row, long col, long nrows, long ncells)
void | gtab_hsep (HWND hwnd, lpTable ptab, HDC hdc)
void | gtab_init (void)
void | gtab_invallines (HWND hwnd, lpTable ptab, int start, int count)
void | gtab_invertsel (HWND hwnd, lpTable ptab, HDC hdc_in)
int | gtab_key (HWND hwnd, lpTable ptab, int vkey)
long | gtab_linetorow (HWND hwnd, lpTable ptab, int line)
int | gtab_mousewheel (HWND hwnd, lpTable ptab, DWORD fwKeys, int zDelta)
void | gtab_move (HWND hwnd, lpTable ptab, int x, int y)
void | gtab_msg_hscroll (HWND hwnd, lpTable ptab, int opcode, int pos)
void | gtab_msg_vscroll (HWND hwnd, lpTable ptab, int opcode, int pos)
void | gtab_paint (HWND hwnd)
void | gtab_paintline (HWND hwnd, HDC hdc, lpTable ptab, int line, BOOL show_whitespace, BOOL fPrinting)
void | gtab_paintunused (HWND hwnd, HDC hdc, lpTable ptab, int y)
void | gtab_press (HWND hwnd, lpTable ptab, int x, int y)
BOOL | gtab_print (HWND hwnd, lpTable ptab, lpPrintContext pcontext)
void | gtab_release (HWND hwnd, lpTable ptab, int x, int y)
void | gtab_rightclick (HWND hwnd, lpTable ptab, int x, int y)
int | gtab_rowtoline (HWND hwnd, lpTable ptab, long row)
void | gtab_select (HWND hwnd, lpTable ptab, long row, long col, long nrows, long ncells, BOOL bNotify)
INT_PTR | gtab_sendtq (HWND hwnd, UINT cmd, LPARAM lParam)
void | gtab_setsize (HWND hwnd, lpTable ptab)
void | gtab_showsel (HWND hwnd, lpTable ptab, BOOL bToBottom)
void | gtab_showsel_middle (HWND hwnd, lpTable ptab, long dyRowsFromTop)
void | gtab_vsep (HWND hwnd, lpTable ptab, HDC hdc)

Variables

HANDLE hNormCurs
HPEN | hpenDotted
HANDLE hVertCurs

Define Documentation

#define abs ( x ) (((x) > 0)? (x) : -(x))

Definition at line 22 of file tpriv.h.

#define CELL_VALID 1

Definition at line 79 of file tpriv.h.

#define TRACK_CELL 2

Definition at line 76 of file tpriv.h.

#define TRACK_COLUMN 1

Definition at line 75 of file tpriv.h.

#define TRACK_NONE 0

Definition at line 74 of file tpriv.h.

#define WL_TABLE (WW_HEAP + sizeof(HANDLE))

Definition at line 84 of file tpriv.h.

#define WLTOTAL (WL_TABLE + sizeof(lpTable))

Definition at line 85 of file tpriv.h.

#define WW_HEAP (WW_OWNER + sizeof(HWND))

Definition at line 83 of file tpriv.h.

#define WW_OWNER 0

Definition at line 82 of file tpriv.h.

Typedef Documentation

typedef struct LineData * lpLineData
typedef struct Table * lpTable

Function Documentation

BOOL gtab_alloclinedata | ( | HWND | hwnd,
 |  | lpTable | ptab
 | ) |  |

Definition at line 427 of file table.cpp.

{
    lpLineData pline;
    lpCellData cd;
    int i, j;

    ptab->pdata = (lpLineData) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
                                        sizeof(LineData) * ptab->nlines);
    if (ptab->pdata == NULL) {
        return(FALSE);
    }
    for (i = 0; i < ptab->nlines; i++) {
        pline = &ptab->pdata[i];
        pline->linepos.size = ptab->rowheight;
        pline->pdata = (lpCellData) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
                                             sizeof(CellData) * ptab->hdr.ncols);
        if (pline->pdata == NULL) {
            return(FALSE);
        }
        for (j = 0; j < ptab->hdr.ncols; j++) {
            cd = &pline->pdata[j];
            cd->props.valid = 0;
            cd->flags = 0;
            cd->nchars = ptab->pcolhdr[j].nchars;
            if (cd->nchars > 0) {
                cd->ptext = (char*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cd->nchars);
                if (cd->ptext == NULL) {
                    return(FALSE);
                }
                cd->pwzText = 0;
            }
        }
    }
    return(TRUE);
}

void gtab_boxcell | ( | HWND | hwnd,
 |  | HDC | hdc,
 |  | LPRECT | rcp,
 |  | LPRECT | pclip,
 |  | UINT | boxmode
 | ) |  |

Definition at line 236 of file tpaint.cpp.

{
  if (boxmode & P_BOXTOP) {
    MoveToEx(hdc, max(rcp->left, pclip->left),
      max(rcp->top, pclip->top), NULL);
    LineTo(hdc, min(rcp->right, pclip->right),
      max(rcp->top, pclip->top));
  }
  if (boxmode & P_BOXBOTTOM) {
    MoveToEx(hdc, max(rcp->left, pclip->left),
      min(rcp->bottom, pclip->bottom), NULL);
    LineTo(hdc, min(rcp->right, pclip->right),
      min(rcp->bottom, pclip->bottom));
  }
  if (boxmode & P_BOXLEFT) {
    MoveToEx(hdc, max(rcp->left, pclip->left),
      max(rcp->top, pclip->top), NULL);
    MoveToEx(hdc, max(rcp->left, pclip->left),
      min(rcp->bottom, pclip->bottom), NULL);
  }
  if (boxmode & P_BOXRIGHT) {
    MoveToEx(hdc, min(rcp->right, pclip->right),
      max(rcp->top, pclip->top), NULL);
    LineTo(hdc, min(rcp->right, pclip->right),
      min(rcp->bottom, pclip->bottom));
  }
}

void gtab_calcwidths | ( | HWND | hwnd,
 |  | lpTable | ptab
 | ) |  |

Definition at line 666 of file table.cpp.

{
    int i, cxtotal, cx, ave;
    TEXTMETRIC tm = {0};
    TEXTMETRIC tmcol = {0};
    HDC hdc;
    lpProps hdrprops, cellprops;
    HFONT hfont;

    hfont = NULL;  /* eliminate spurious diagnostic, make code worse */
    hdrprops = &ptab->hdr.props;
    hdc = GetDC(hwnd);
    if (hdc)
    {
        GetTextMetrics(hdc, &tm);
        ptab->rowheight = tm.tmHeight + tm.tmExternalLeading;
        if (hdrprops->valid & P_FONT) {
            hfont = (HFONT)SelectObject(hdc, hdrprops->hFont);
        }
        GetTextMetrics(hdc, &tm);
        if (hdrprops->valid & P_FONT) {
            SelectObject(hdc, hfont);
        }
        ReleaseDC(hwnd, hdc);
    }
    else
    {
        // arbitrary, whatever...
        ptab->rowheight = 14;
        tm.tmHeight = 14;
        tm.tmAveCharWidth = 5;
    }

    /* get width and height of average character */
    ptab->avewidth = tm.tmAveCharWidth;
    if (tm.tmHeight + tm.tmExternalLeading < ptab->rowheight - 2 ||
        tm.tmHeight + tm.tmExternalLeading > ptab->rowheight) {
        // make sure that the default FixedSys (and anything of similar size)
        // doesn't vertically clip the System font used for line numbers,
        // filenames, etc.
        ptab->rowheight = tm.tmHeight;
        if (tm.tmExternalLeading)
            ptab->rowheight += tm.tmExternalLeading;
        else
            ptab->rowheight++;
    }
    if (hdrprops->valid & P_HEIGHT) {
        ptab->rowheight = hdrprops->height;
    }

    /* set pixel width of each cell (and add up for row total)
     * based on ave width * nr chars, unless P_WIDTH set
     */
    cxtotal = 0;
    for (i = 0; i < ptab->hdr.ncols; i++) {
        cellprops = &ptab->pcolhdr[i].props;

        if (cellprops->valid & P_WIDTH) {
            cx = cellprops->width;
        } else if (hdrprops->valid & P_WIDTH) {
            cx = hdrprops->width;
        } else {

            if (cellprops->valid & P_FONT) {
                hdc = GetDC(hwnd);
                if (hdc)
                {
                    hfont = (HFONT)SelectObject(hdc, cellprops->hFont);
                    GetTextMetrics(hdc, &tmcol);
                    SelectObject(hdc, hfont);
                    ReleaseDC(hwnd, hdc);
                    ave = tmcol.tmAveCharWidth;
                }
                else
                    ave = 5;
            } else {
                ave = ptab->avewidth;
            }
            /* ave width * nchars */
            cx =  ptab->pcolhdr[i].nchars + 1;
            cx *= ave;
        }
        /* add 2 pixels for box lines */
        cx += 2;
        ptab->pcellpos[i].size = cx;
        cxtotal += cx;
    }
    ptab->rowwidth = cxtotal;
}

void gtab_dblclick | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | int | x,
 |  | int | y
 | ) |  |

Definition at line 891 of file tscroll.cpp.

{
    int cell, line;
    long row;

    line = gtab_ytoline(hwnd, ptab, y);
    cell = gtab_xtocol(hwnd, ptab, x);
    if ( (line < ptab->hdr.fixedrows) || (cell < ptab->hdr.fixedcols) ) {
        if (!ptab->hdr.fixedselectable) {
            return;
        }
    }
    row = gtab_linetorow(hwnd, ptab, line);

    if (ptab->hdr.selectmode & TM_ROW) {
        gtab_enter(hwnd, ptab, row, 0, 1, ptab->hdr.ncols);
    } else {
        gtab_enter(hwnd, ptab, row, cell, 1, 1);
    }
}

void gtab_deltable | ( | HWND | hwnd,
 |  | lpTable | ptab
 | ) |  |

Definition at line 470 of file table.cpp.

{
    int ncols;

    if (ptab == NULL) {
        return;
    }
    ncols = ptab->hdr.ncols;

    if (ptab->pcolhdr != NULL) {
        HeapFree(GetProcessHeap(), NULL, ptab->pcolhdr);
    }
    if (ptab->pcellpos != NULL) {
        HeapFree(GetProcessHeap(), NULL, ptab->pcellpos);
    }
    if (ptab->pdata != NULL) {
        gtab_freelinedata(ptab);
    }
    HeapFree(GetProcessHeap(), NULL, ptab);
}

void gtab_dohscroll | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | long | change
 | ) |  |

Definition at line 253 of file tscroll.cpp.

{
    int curx, i;
    int moveable;
    lpCellPos cp;
    int newdx, range;

    /* check that the new scroll pos is still within the valid range */
    range = ptab->rowwidth - ptab->winwidth;
    newdx = ptab->scroll_dx + (int) change;
    if (range < 0) {
        range = 0;
    }
    if (newdx > range) {
        change = range - ptab->scroll_dx;
    } else if (newdx < 0) {
        change = -(ptab->scroll_dx);
    }
    ptab->scroll_dx += (int) change;

    SetScrollPos(hwnd, SB_HORZ, ptab->scroll_dx, TRUE);
    if (ptab->hdr.fixedcols > 0) {
        RECT rc;
        GetClientRect(hwnd, &rc);
        rc.left = ptab->pcellpos[ptab->hdr.fixedcols - 1].clipend;
        InvalidateRect(hwnd, &rc, FALSE);
    } else {
        InvalidateRect(hwnd, NULL, FALSE);
    }

    /* loop through each col setting relative posn and clipping */
    /* clip off 1 pixel left and right (we added 2 on to size for this) */

    /* first set up fixed columns */
    curx = 0;
    for (i = 0; i < ptab->hdr.fixedcols; i++) {
        cp = &ptab->pcellpos[i];
        cp->start = curx + 1;
        cp->clipstart = cp->start;
        cp->clipend = cp->start + cp->size - 2;
        curx += cp->size;
    }

    /* now moveable columns. remember start of moveable cols */
    moveable = curx;
    curx = - ptab->scroll_dx;       /* rel. pos of col */
    for (i = ptab->hdr.fixedcols; i < ptab->hdr.ncols; i++) {
        cp = &ptab->pcellpos[i];
        cp->start = curx + moveable + 1;
        cp->clipstart = max(moveable+1, cp->start);
        cp->clipend = cp->start + cp->size - 2;
        curx += cp->size;
    }
}

void gtab_dovscroll | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | long | change
 | ) |  |

Definition at line 121 of file tscroll.cpp.

{
    int cury, i;
    long ncopy;
    lpCellPos cp;
    LineData ldtemp;
    RECT rc, rcpaint;
    long range;
    long newtop;
    int newpos;
    BOOL fWasVisible = FALSE;

    if (ptab->selvisible)
    {
        fWasVisible = TRUE;
        ptab->selvisible = FALSE;
        gtab_invertsel(hwnd, ptab, NULL);
    }

    range = ptab->hdr.nrows - (ptab->nlines - 1);
    newtop = ptab->toprow + change;
    if (range < 0) {
        range = 0;
    }
    if (newtop > range) {
        change = range - ptab->toprow;
    } else if (newtop < 0) {
        change = -(ptab->toprow);
    }
    ptab->toprow += change;

    newpos = (int) (newtop / ptab->scrollscale);
    SetScrollPos(hwnd, SB_VERT, newpos, TRUE);

    if (ptab->hdr.sendscroll) {
        gtab_sendtq(hwnd, TQ_SCROLL, ptab->toprow);
    }

    /* adjust data ptrs rather than invalidate, to retain the
     * data we know is still valid
     */
    if (abs(change) >= ptab->nlines) {
        gtab_invallines(hwnd, ptab, ptab->hdr.fixedrows,
            ptab->nlines - ptab->hdr.fixedrows);
        InvalidateRect(hwnd, NULL, FALSE);
        change = 0;
    } else if (change < 0) {
        /* copy data down */
        ncopy = (ptab->nlines - ptab->hdr.fixedrows) - abs(change);
        for (i =  ptab->nlines - 1;
                i >= (ptab->hdr.fixedrows + abs(change)); i--) {
            ldtemp = ptab->pdata[i - abs(change)];
            ptab->pdata[i - abs(change)] = ptab->pdata[i];
            ptab->pdata[i] = ldtemp;
        }
        gtab_invallines(hwnd, ptab,
                ptab->hdr.fixedrows, (int) abs(change));
    } else if (change > 0) {
        ncopy = (ptab->nlines - ptab->hdr.fixedrows) - change;
        for (i = ptab->hdr.fixedrows;
                i < (ncopy + ptab->hdr.fixedrows); i++) {
            ldtemp = ptab->pdata[i + change];
            ptab->pdata[i + change] = ptab->pdata[i];
            ptab->pdata[i] = ldtemp;
        }
        gtab_invallines(hwnd, ptab,
            (int) ncopy + ptab->hdr.fixedrows, (int) change);
    }

    /* scroll window */
    GetClientRect(hwnd, &rc);
    rcpaint = rc;
    if (change > 0) {
        rc.top += (int) (change + ptab->hdr.fixedrows) * ptab->rowheight;
        rcpaint.top = (ptab->hdr.fixedrows * ptab->rowheight);
        rcpaint.top += rc.bottom - rc.top;
    } else if (change < 0) {
        rc.top += (ptab->hdr.fixedrows * ptab->rowheight);
        rc.bottom += (int) (change * ptab->rowheight);
        rcpaint.bottom -= rc.bottom - rc.top;
    }

    /* loop through each line setting relative posn and clipping */

    /* set up all rows  - the fixed/moveable difference for
     * rows is made at fetch-time during painting, when we remember
     * which absolute row nr to ask for, for a given screen line
     */
    cury = 0;
    for (i = 0; i < ptab->nlines; i++) {
        cp = &ptab->pdata[i].linepos;
        cp->start = cury;
        cp->clipstart = cury;
        cp->clipend = cury + cp->size;
        cury += cp->size;
    }

    /* now move and repaint the window */
    if (change != 0) {
        if (rc.top < rc.bottom) {
            ScrollWindow(hwnd, 0, (int) -(change * ptab->rowheight),
                &rc, NULL);
        }

        // don't repaint the fixed rows
        rc.top = 0;
        rc.bottom = ptab->hdr.fixedrows * ptab->rowheight;
        ValidateRect(hwnd, &rc);

        /* force repaint now, not just post message for later,
         * since we want to repaint that line before the next
         * scroll down occurs
         */
        ValidateRect(hwnd, &rcpaint);
        RedrawWindow(hwnd, &rcpaint, NULL,
                RDW_NOERASE | RDW_INVALIDATE | RDW_INTERNALPAINT);

    }

    if (fWasVisible)
    {
        gtab_invertsel(hwnd, ptab, NULL);
        ptab->selvisible = TRUE;
    }
}

void gtab_drawvertline | ( | HWND | hwnd,
 |  | lpTable | ptab
 | ) |  |

Definition at line 632 of file tpaint.cpp.

{
  RECT rc;
  HDC hdc;
  HPEN hpen;

  hdc = GetDC(hwnd);
  if (hdc)
  {
    SetROP2(hdc, R2_XORPEN);
    hpen = (HPEN)SelectObject(hdc, hpenDotted);
    GetClientRect(hwnd, &rc);

    MoveToEx(hdc, ptab->trackline1, rc.top, NULL);
    LineTo(hdc, ptab->trackline1, rc.bottom);
    if (ptab->trackline2 != -1) {
      MoveToEx(hdc, ptab->trackline2, rc.top, NULL);
      LineTo(hdc, ptab->trackline2, rc.bottom);
    }

    SelectObject(hdc, hpen);
    ReleaseDC(hwnd, hdc);
  }
}

void gtab_enter | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | long | row,
 |  | long | col,
 |  | long | nrows,
 |  | long | ncells
 | ) |  |

Definition at line 511 of file tscroll.cpp.

{
    /* clear existing sel if valid and visible */
    if ((ptab->select.nrows != 0) && (ptab->selvisible == TRUE)) {

        /* only clear sel if it is different from the new one */
        if ((ptab->select.startrow != row) ||
                (ptab->select.startcell != col) ||
                (ptab->select.nrows != nrows) ||
                (ptab->select.ncells != ncells)) {
            gtab_invertsel(hwnd, ptab, NULL);
            ptab->selvisible = FALSE;
        }
    }

    /* set select fields and send TQ_ENTER */
    if (row < ptab->hdr.nrows) {
        ptab->select.startrow = row;
        ptab->select.startcell = col;
        ptab->select.nrows = nrows;
        ptab->select.ncells = ncells;
    } else {
        ptab->select.nrows = 0;
        ptab->select.startrow = 0;
        ptab->select.startcell = 0;
        ptab->select.ncells = 0;
    }

    /* paint in selection */
    if (nrows != 0) {
        if (!ptab->selvisible) {
            gtab_invertsel(hwnd, ptab, NULL);
            ptab->selvisible = TRUE;
        }
        /* do this at end because it could cause a layout-change */
        gtab_sendtq(hwnd, TQ_ENTER, (LPARAM) &ptab->select);
    } else {
        if (ptab->selvisible) {
            gtab_invertsel(hwnd, ptab, NULL);
        }
        ptab->selvisible = FALSE;
    }
}

void gtab_hsep | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | HDC | hdc
 | ) |  |

Definition at line 615 of file tpaint.cpp.

{
  int y;
  RECT rc;

  if (ptab->hdr.fixedrows < 1) {
    return;
  }
  y = ptab->rowheight * ptab->hdr.fixedrows;
  GetClientRect(hwnd, &rc);
  MoveToEx(hdc, rc.left, y-1, NULL);
  LineTo(hdc, rc.right, y-1);
}

void gtab_init ( void )

Definition at line 47 of file table.cpp.

{
    WNDCLASS wc;

    gtab_createtools();
    gtab_msgcode = RegisterWindowMessage(TableMessage);

    wc.style = CS_GLOBALCLASS | CS_DBLCLKS;
    wc.lpfnWndProc = (WNDPROC)gtab_wndproc;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = WLTOTAL;
    wc.hInstance = (HINSTANCE)hLibInst;
    wc.hIcon = NULL;
    wc.hCursor = NULL;
    wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
    wc.lpszClassName = TableClassName;
    wc.lpszMenuName = NULL;

    RegisterClass(&wc);
}

void gtab_invallines | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | int | start,
 |  | int | count
 | ) |  |

Definition at line 784 of file table.cpp.

{
    int i, j;

    for (i = start; i < start + count; i++) {
        for (j = 0; j < ptab->hdr.ncols; j++) {
            ptab->pdata[i].pdata[j].flags = 0;
        }
    }
}

void gtab_invertsel | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | HDC | hdc_in
 | ) |  |

Definition at line 668 of file tpaint.cpp.

{
  HDC hdc;
  int firstline, lastline;
  long startrow, lastrow, toprow, bottomrow;
  RECT rc;
  int lastcell;

  /* get the selection start and end rows ordered vertically */
  if (ptab->select.nrows == 0) {
      return;
  } else if (ptab->select.nrows < 0) {
      startrow = ptab->select.startrow + ptab->select.nrows + 1;
      lastrow = ptab->select.startrow;
  } else {
      startrow = ptab->select.startrow;
      lastrow = ptab->select.startrow + ptab->select.nrows -1;
  }

  /* is selected area (or part of it) visible on screen ?  */
  firstline = gtab_rowtoline(hwnd, ptab, startrow);
  lastline = gtab_rowtoline(hwnd, ptab, lastrow);

  if (firstline < 0) {
      toprow = gtab_linetorow(hwnd, ptab,
          ptab->hdr.fixedselectable ? 0: ptab->hdr.fixedrows);
      if ((toprow >= startrow)  &&
    (toprow <= lastrow)) {
        firstline = gtab_rowtoline(hwnd, ptab, toprow);
      } else {
    return;
      }
  } else {
      toprow = 0;
  }

  if (lastline < 0) {
      bottomrow = gtab_linetorow(hwnd, ptab, ptab->nlines-1);
      if ((bottomrow <= lastrow) &&
    (bottomrow >=startrow)) {
        lastline = gtab_rowtoline(hwnd, ptab, bottomrow);
      } else {
    return;
      }
  }

  rc.top = ptab->pdata[firstline].linepos.clipstart;
  rc.bottom = ptab->pdata[lastline].linepos.clipend;

  /* selection mode includes a flag TM_FOCUS indicating we should
   * use a focus rect instead of the traditional inversion for
   * selections in this table. This interferes with multiple backgrnd
   * colours less.  However we still do inversion for fixedcols.
   */

  lastcell = (int)(ptab->select.startcell + ptab->select.ncells - 1);

  /*
   * invert the whole area for TM_SOLID or just the first
   * cell for TM_FOCUS
   */
  rc.left = ptab->pcellpos[ptab->select.startcell].clipstart;
  if (ptab->hdr.selectmode & TM_FOCUS) {
    rc.right = ptab->pcellpos[ptab->select.startcell].clipend;
  }else {
    rc.right = ptab->pcellpos[lastcell].clipend;
  }

  if (hdc_in == NULL) {
    hdc = GetDC(hwnd);
    if (!hdc)
      return;
  } else {
    hdc = hdc_in;
  }

  InvertRect(hdc, &rc);

  /*
   * draw focus rectangle around remaining cells on this line, if there
   * are any
   */
  if (ptab->hdr.selectmode & TM_FOCUS) {
    if (toprow > startrow) {
        rc.top--;
    }
    if (ptab->select.ncells > 1) {
      rc.left = ptab->pcellpos[ptab->select.startcell+1].clipstart;
      rc.right = ptab->pcellpos[lastcell].clipend;
      DrawFocusRect(hdc, &rc);
    }
  }

  if (hdc_in == NULL) {
    ReleaseDC(hwnd, hdc);
  }
}

int gtab_key | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | int | vkey
 | ) |  |

Definition at line 1204 of file tscroll.cpp.

{
    long startrow, ncells, startcell;
    BOOL bControl = FALSE;
    BOOL bShift = FALSE;

    if (GetKeyState(VK_CONTROL) & 0x8000) {
        bControl = TRUE;
    }
    if (GetKeyState(VK_SHIFT) & 0x8000) {
        /* ignore shift key here if TM_MANY -multiple selection flag- is
         * not selected
         */
        if (ptab->hdr.selectmode & TM_MANY) {
            bShift = TRUE;
        }
    }

    switch(vkey) {

    case VK_UP:
        if (bControl) {
            /* control-uparrow scrolls window without selection.
             * the selection is de-selected (to avoid surprises
             * moving back to it).
             */
            gtab_select(hwnd, ptab, 0, 0, 0, 0, TRUE);
            gtab_dovscroll(hwnd, ptab, -1);
        } else {
            /* uparrow moves selection up one line */
            gtab_changesel(hwnd, ptab, -1, 0, FALSE, bShift);
        }
        return(0);

    case VK_DOWN:
        if (bControl) {
            /* control downarrow scrolls window without
             * a selection.
             */
            gtab_select(hwnd, ptab, 0, 0, 0, 0, TRUE);
            gtab_dovscroll(hwnd, ptab, 1);
        } else {
            /* the normal gtab_changesel behaviour is
             * that if the selected line is not visible now,
             * we scroll it to the top of the window. This is fine
             * in most cases but causes unacceptable jumps when
             * repeatedly scrolling down with the down key.
             *
             * Thus we now have an argument to changesel to say
             * that in this case, if you need to move the line onto
             * the window, move it to the bottom and not the top
             */
            gtab_changesel(hwnd, ptab, 1, 0, TRUE, bShift);
        }
        return(0);

    case VK_LEFT:
        /* if cell-selection mode, move left one cell.
         * otherwise the whole row is selected - scroll
         * the line left a little
         */

        if (ptab->hdr.selectmode & TM_ROW) {
            if (bControl) {
                /* ctrl-left moves to start of line */
                gtab_dohscroll(hwnd, ptab, -(ptab->scroll_dx));
            } else {
                gtab_dohscroll(hwnd, ptab, -(ptab->avewidth));
            }
        } else {
            gtab_changesel(hwnd, ptab, 0, -1, FALSE, bShift);
        }
        return(0);

    case VK_RIGHT:
        /* if cell-selection mode, move right one cell.
         * otherwise the whole row is selected - scroll
         * the line right a little
         */
        if (ptab->hdr.selectmode & TM_ROW) {
            if (bControl) {
                /* control-right moves to right end of line */
                gtab_dohscroll(hwnd, ptab, ptab->rowwidth -
                                ptab->winwidth);
            } else {
                gtab_dohscroll(hwnd, ptab, ptab->avewidth);
            }
        } else {
            gtab_changesel(hwnd, ptab, 0, 1, TRUE, bShift);
        }
        return(0);

    case VK_HOME:
        if (bControl) {
            /* control-home == top of file */
            gtab_dovscroll(hwnd, ptab, -(ptab->toprow));
        }
        /* top of window */
        gtab_selhome(hwnd, ptab, bShift);
        gtab_showsel(hwnd, ptab, FALSE);

        return(0);

    case VK_END:
        if (bControl) {
            /* control-end -> end of file */
            startrow = ptab->hdr.nrows-1;
        } else {
            startrow = gtab_linetorow(hwnd, ptab, ptab->nlines - 1);
            if (startrow >= ptab->hdr.nrows) {
                startrow = ptab->hdr.nrows-1;
            }
        }

        startcell = 0;
        ncells = ptab->hdr.ncols;
        if (!(ptab->hdr.selectmode & TM_ROW)) {
            startcell = ptab->hdr.ncols-1;
            ncells = 1;
        }

        if (bShift) {
            gtab_extendsel(hwnd, ptab, startrow, startcell, TRUE);
        } else {
            gtab_select(hwnd, ptab, startrow, startcell, 1, ncells, TRUE);
        }

        /* we have selected the bottom line. We don't want to
         * move it up into the window, since the intended
         * effect is to select the lowest line. This doesn't
         * apply to the ctrl-end behaviour (move to bottom of
         * buffer.
         */
        if (bControl) {
            /* move the selection to make it visible - but move it
             * to the bottom and not to the top of the window
             */
            gtab_showsel(hwnd, ptab, TRUE);
        }
        return(0);

    case VK_RETURN:
        if (ptab->select.nrows != 0) {
            gtab_showsel(hwnd, ptab, FALSE);
            gtab_enter(hwnd, ptab, ptab->select.startrow,
                    ptab->select.startcell,
                    ptab->select.nrows, ptab->select.ncells);
        }
        return(0);

    case VK_SPACE:
        /* toggle the selection */
        if (ptab->select.nrows == 0) {
                /* no selection - make one */
                gtab_changesel(hwnd, ptab, 0, 0, TRUE, FALSE);
        } else {
                /* there is a selection - deselect it */
                gtab_select(hwnd, ptab, 0, 0, 0, 0, TRUE);
        }
        return(0);

    case VK_PRIOR:          /* page up */

        if (ptab->nlines > 3) {
            gtab_dovscroll(hwnd, ptab, -(ptab->nlines - 3));
        }
        gtab_selhome(hwnd, ptab, bShift);
        return(0);

    case VK_NEXT:           /* page down */

        /* scroll down one page */
        if (ptab->nlines > 3) {
            gtab_dovscroll(hwnd, ptab, (ptab->nlines - 3));
        }

        /* select new bottom line */
        startrow = gtab_linetorow(hwnd, ptab, ptab->nlines - 1);
        if (startrow >= ptab->hdr.nrows) {
            startrow = ptab->hdr.nrows-1;
        }
        startcell = 0;
        ncells = ptab->hdr.ncols;
        if (!(ptab->hdr.selectmode & TM_ROW)) {
            startcell = ptab->hdr.ncols-1;
            ncells = 1;
        }

        /* select bottom line, but don't call showsel
         * since we don't want to adjust it's position - we
         * want it to remain at the bottom of the window
         */
        if (bShift) {
            gtab_extendsel(hwnd, ptab, startrow, startcell, TRUE);
        } else {
            gtab_select(hwnd, ptab, startrow, startcell, 1, ncells, TRUE);
        }
        return(0);

    default:
        return(1);
    }
}

long gtab_linetorow | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | int | line
 | ) |  |

Definition at line 313 of file tscroll.cpp.

{
    if (line < ptab->hdr.fixedrows) {
        return(line);
    }

    return (line + ptab->toprow);
}

int gtab_mousewheel | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | DWORD | fwKeys,
 |  | int | zDelta
 | ) |  |

Definition at line 1408 of file tscroll.cpp.

{
    static ULONG uScrollLines = 0;

    if (fwKeys & MK_MBUTTON) {
        return 1;
    }

    if (uScrollLines == 0) {
        SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &uScrollLines, FALSE);
        if (uScrollLines == 0) {
            uScrollLines = 3;
        }
    }

    zDelta /= -WHEEL_DELTA;

    if (fwKeys & MK_CONTROL) {
        //
        // Left-Right scroll
        //
        if (ptab->hdr.selectmode & TM_ROW) {
            if (fwKeys & MK_SHIFT) {
                zDelta = (zDelta > 0) ? ptab->rowwidth : -ptab->rowwidth;
            }
            gtab_dohscroll(hwnd, ptab, ptab->avewidth * zDelta);
            return 0;
        }
        return 1;
    }

    if (fwKeys & MK_SHIFT) {
        //
        // Page scroll
        //
        if (ptab->nlines > 3) {
            zDelta *= ptab->nlines - 3;
        }
    }
    else {
        if (uScrollLines) {
            zDelta *= uScrollLines;
            zDelta = min(zDelta, ptab->nlines - 3);
        }
    }

    gtab_dovscroll(hwnd, ptab, zDelta);

    return 0;
}

void gtab_move | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | int | x,
 |  | int | y
 | ) |  |

Definition at line 798 of file tscroll.cpp.

{
    BOOL fOK;
    int line;
    long row;
    int col;
    lpCellPos ppos;

    switch(ptab->trackmode) {

    case TRACK_NONE:
        col = gtab_xtocol(hwnd, ptab, x);
        if (col == -1) {
            SetCursor((HCURSOR)hNormCurs);
            return;
        }
        if (gtab_isborder(hwnd, ptab, x, col)) {
            SetCursor((HCURSOR)hVertCurs);
            return;
        }
        if ( (col > 0) && gtab_isborder(hwnd, ptab, x, col-1)) {
            SetCursor((HCURSOR)hVertCurs);
            return;
        }
        SetCursor((HCURSOR)hNormCurs);
        return;

    case TRACK_CELL:
        line = gtab_ytoline(hwnd, ptab, y);

        // we used to only allow drag to extend
        // the selection if the shift key was down.
        // this doesn't seem to work as a UI - you expect
        // to drag and extend.

        /* if extending selection then
         * allow scrolling by dragging off window
         */
        if (line < 0) {
            gtab_dovscroll(hwnd, ptab, -1);
            line = gtab_ytoline(hwnd, ptab, y);
        } else if (line >=  ptab->nlines) {
            gtab_dovscroll(hwnd, ptab, 1);
            line = gtab_ytoline(hwnd, ptab, y);
        }

        row = gtab_linetorow(hwnd, ptab, line);
        col = gtab_xtocol(hwnd, ptab, x);

        // ignore if before or beyond data
        if ( (row < ptab->hdr.fixedrows) || (col < ptab->hdr.fixedcols)) {
            if (ptab->hdr.fixedselectable == FALSE) {
                return;
            }
        }

        if ((row >= ptab->hdr.nrows) ||
            (col >= ptab->hdr.ncols)) {
            return;
        }

        /*
         * extend to this new selection end point
         */
        gtab_extendsel(hwnd, ptab, row, col, FALSE);
        return;

    case TRACK_COLUMN:
        /* check that new x is still visible/valid */
        ppos = &ptab->pcellpos[ptab->tracknr];
        fOK = FALSE;

        if (ptab->tracknr < ptab->hdr.fixedcols)  {
            if ((x > ppos->start) && (x < ptab->winwidth)) {
                fOK = TRUE;
            }
        } else {
            if ((x > ppos->clipstart) && (x < ptab->winwidth)) {
                fOK = TRUE;
            }
        }
        if (fOK == TRUE) {
            gtab_drawvertline(hwnd, ptab);
            ptab->trackline1 = x;
            gtab_drawvertline(hwnd, ptab);
        }
        return;
    }
}

void gtab_msg_hscroll | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | int | opcode,
 |  | int | pos
 | ) |  |

Definition at line 80 of file tscroll.cpp.

{
    int change;

    switch(opcode) {
    case SB_THUMBPOSITION:
    case SB_THUMBTRACK:
        change = pos - ptab->scroll_dx;
        break;

    case SB_LINEUP:
        change = -(ptab->avewidth);
        break;

    case SB_LINEDOWN:
        change = ptab->avewidth;
        break;

    case SB_PAGEUP:
        change = - (ptab->winwidth * 2 / 3);
        break;

    case SB_PAGEDOWN:
        change = (ptab->winwidth * 2 / 3);
        break;

    default:
        return;
    }
    gtab_dohscroll(hwnd, ptab, change);
}

void gtab_msg_vscroll | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | int | opcode,
 |  | int | pos
 | ) |  |

Definition at line 42 of file tscroll.cpp.

{
    long change;

    switch(opcode) {
    case SB_THUMBPOSITION:
    case SB_THUMBTRACK:
        change = (pos * ptab->scrollscale) - ptab->toprow;
        break;

    case SB_LINEUP:
        change = -1;
        break;

    case SB_LINEDOWN:
        change = 1;
        break;

    case SB_PAGEUP:
        change = - (ptab->nlines - 3);
        if (change>=0)
            change = -1;    // consider nlines <=3!
        break;

    case SB_PAGEDOWN:
        change = (ptab->nlines - 3);
        if (change<=0)
            change = 1;     // consider nlines <=3!
        break;

    default:
        return;
    }
    gtab_dovscroll(hwnd, ptab, change);
}

void gtab_paint ( HWND hwnd )

Definition at line 552 of file tpaint.cpp.

{
    PAINTSTRUCT ps;
    int y, y2, i;
    HDC hDC = BeginPaint(hwnd, &ps);
    lpTable ptab = (lpTable) GetWindowLongPtr(hwnd, WL_TABLE);

    if (!ptab) {
        FillRect(hDC, &ps.rcPaint, (HBRUSH)(COLOR_WINDOW + 1));
    } else {
        /* separator lines between fixed rows/columns
         * (ie headers) and the rest - if enabled
         */
        /* paint here first for good impression,
         * and again after to clean up!!
         */
        if (ptab->hdr.vseparator) {
            gtab_vsep(hwnd, ptab, hDC);
        }
        if (ptab->hdr.hseparator) {
            gtab_hsep(hwnd, ptab, hDC);
        }

        /* paint only the rows that need painting */
        for (i = 0; i < ptab->nlines; i++) {
            y = ptab->pdata[i].linepos.start;
            y2 = y + ptab->pdata[i].linepos.size;
            if ( (y <= ps.rcPaint.bottom) &&
                 (y2 >= ps.rcPaint.top)) {
                gtab_paintline(hwnd, hDC, ptab, i, ptab->show_whitespace, FALSE);
            }
        }
        if (ptab->hdr.vseparator) {
            gtab_vsep(hwnd, ptab, hDC);
        }
        if (ptab->hdr.hseparator) {
            gtab_hsep(hwnd, ptab, hDC);
        }
        if (ptab->selvisible) {
            gtab_invertsel(hwnd, ptab, hDC);
        }
    }

    EndPaint(hwnd, &ps);
}

void gtab_paintline | ( | HWND | hwnd,
 |  | HDC | hdc,
 |  | lpTable | ptab,
 |  | int | line,
 |  | BOOL | show_whitespace,
 |  | BOOL | fPrinting
 | ) |  |

Definition at line 519 of file tpaint.cpp.

{
  lpCellPos ppos = NULL;
  int i;
  RECT rc;

  if (line < 0 || line >= ptab->nlines)
    return;

  if (!fPrinting)
    GetClientRect(hwnd, &rc);

  gtab_updateline(hwnd, ptab, line);

  for (i = 0; i < ptab->hdr.ncols; i++) {
    ppos = &ptab->pcellpos[i];
    /* show whitespace iff the flag is set
       and we're painting the main text column */
    if (ppos->clipstart < ppos->clipend) {
      gtab_paintcell(hwnd, hdc, ptab, line, i,
               (show_whitespace && (i == 2)), fPrinting);
    }
  }

  if (!fPrinting && ppos) {
    rc.top = ptab->pdata[line].linepos.clipstart;
    rc.bottom = ptab->pdata[line].linepos.clipend;
    rc.left = ppos->clipend;
    FillRect(hdc, &rc, (HBRUSH)(COLOR_WINDOW + 1));
  }
}

void gtab_paintunused | ( | HWND | hwnd,
 |  | HDC | hdc,
 |  | lpTable | ptab,
 |  | int | y
 | ) |  |
void gtab_press | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | int | x,
 |  | int | y
 | ) |  |

Definition at line 648 of file tscroll.cpp.

{
    long cell, ncells;
    long row;

    if (ptab->trackmode != TRACK_NONE) {
        return;
    }

    /* has he grabbed a cell-edge to resize ? */
    cell = gtab_xtocol(hwnd, ptab, x);
    if (cell == -1) {
        return;
    }
    if (gtab_isborder(hwnd, ptab, x, cell)) {
        gtab_trackcol(hwnd, ptab, cell, x);
        return;
    }
    if ( (cell > 0) && gtab_isborder(hwnd, ptab, x, cell-1)) {
        gtab_trackcol(hwnd, ptab, cell, x);
        return;
    }

    /* find which line he selected */
    row = gtab_linetorow(hwnd, ptab, gtab_ytoline(hwnd, ptab, y));

    /* is he selecting a disabled fixed area ? */
    if ( (row < ptab->hdr.fixedrows) || (cell < ptab->hdr.fixedcols)) {
        if (ptab->hdr.fixedselectable == FALSE) {
            return;
        }
    }

    // ignore if beyond data
    if ((row >= ptab->hdr.nrows) ||
            (cell >= ptab->hdr.ncols)) {
        return;
    }

    /* ok, start cell selection */
    ptab->trackmode = TRACK_CELL;
    SetCapture(hwnd);

    /* record and paint new selection */

    if (ptab->hdr.selectmode & TM_ROW) {
        cell = 0;
        ncells = ptab->hdr.ncols;
    } else {
        ncells = 1;
    }

    /*
     * if the shift key is down, then extend the selection to this
     * new anchor point, rather than create a new selection
     */
    if (GetKeyState(VK_SHIFT) & 0x8000) {
        gtab_extendsel(hwnd, ptab, row, cell, FALSE);
    } else {
        gtab_select(hwnd, ptab, row, cell, 1, ncells, FALSE);
    }
    return;
}

BOOL gtab_print | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | lpPrintContext | pcontext
 | ) |  |

Definition at line 47 of file tprint.cpp.

{
    BOOL fNoContext, fNoMargin, fNoPD;
    BOOL fSuccess = TRUE;
    lpTable ptab_prt;

    fNoContext = FALSE;
    fNoPD = FALSE;
    fNoMargin = FALSE;

    if (pcontext == NULL) {
        fNoContext = TRUE;
        pcontext = (lpPrintContext) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
                                             sizeof(PrintContext));
        if (pcontext == NULL)
      return (FALSE);
    pcontext->head = pcontext->foot = NULL;
        pcontext->margin = NULL;
        pcontext->pd = NULL;
        pcontext->id = 0;
    }
    if (pcontext->pd == NULL) {
        fNoPD = TRUE;
    }
    if (pcontext->margin == NULL) {
        fNoMargin = TRUE;
    }
    ptab_prt = gtab_printsetup(hwnd, ptab, pcontext);

    if (ptab_prt != NULL) {
        gtab_printjob(hwnd, ptab_prt, pcontext);

        gtab_deltable(hwnd, ptab_prt);
    } else fSuccess = FALSE;
    if (fNoMargin) {
        HeapFree(GetProcessHeap(), NULL, pcontext->margin);
        pcontext->margin = NULL;
    }
    if (fNoPD) {
        if (pcontext->pd->hDevMode != NULL) {
            GlobalFree(pcontext->pd->hDevMode);
        }
        if (pcontext->pd->hDevNames != NULL) {
            GlobalFree(pcontext->pd->hDevNames);
        }
        HeapFree(GetProcessHeap(), NULL, pcontext->pd);
        pcontext->pd = NULL;
    }
    if (fNoContext) {
        HeapFree(GetProcessHeap(), NULL, pcontext);
    }
    return fSuccess;
}

void gtab_release | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | int | x,
 |  | int | y
 | ) |  |

Definition at line 717 of file tscroll.cpp.

{
    lpCellPos ppos;
    lpProps pprop;
    long row, cell;
    int cx;

    switch(ptab->trackmode) {

    case TRACK_NONE:
        return;

    case TRACK_COLUMN:
        /* erase marker lines */
        gtab_drawvertline(hwnd, ptab);
        ReleaseCapture();
        ptab->trackmode = TRACK_NONE;

        /* adjust cell width */
        ppos = &ptab->pcellpos[ptab->tracknr];
        cx = ptab->trackline1 - ppos->start;
        pprop = &ptab->pcolhdr[ptab->tracknr].props;
        pprop->valid |= P_WIDTH;
        pprop->width = cx;
        gtab_calcwidths(hwnd, ptab);
        gtab_setsize(hwnd, ptab);
        InvalidateRect(hwnd, NULL, FALSE);
        return;

    case TRACK_CELL:
        row = gtab_linetorow(hwnd, ptab, gtab_ytoline(hwnd, ptab, y));
        cell = gtab_xtocol(hwnd, ptab, x);

        ReleaseCapture();
        ptab->trackmode = TRACK_NONE;

        // ignore if before or beyond data
        if ( (row < ptab->hdr.fixedrows) ||
             (cell < ptab->hdr.fixedcols)) {
            if (ptab->hdr.fixedselectable == FALSE) {
                gtab_select(
                    hwnd,
                    ptab,
                    ptab->select.startrow,
                    ptab->select.startcell,
                    ptab->select.nrows,
                    ptab->select.ncells,
                    TRUE);

                return;
            }
        }

        if ((row >= ptab->hdr.nrows) ||
                (cell >= ptab->hdr.ncols)) {
            gtab_select(
                    hwnd,
                    ptab,
                    ptab->select.startrow,
                    ptab->select.startcell,
                    ptab->select.nrows,
                    ptab->select.ncells,
                    TRUE);
            return;
        }

        /*
         * Extend to this new selection end point
         * we used to only do this if shift key pressed, but that
         * is not a good UI.
         */
        gtab_extendsel(hwnd, ptab, row, cell, TRUE);
        return;
    }
}

void gtab_rightclick | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | int | x,
 |  | int | y
 | ) |  |

Definition at line 591 of file tscroll.cpp.

{
    long cell, ncells;
    long row;
    HWND hOwner;

    /* find which col, row he selected */
    cell = gtab_xtocol(hwnd, ptab, x);
    if (cell == -1) {
        return;
    }
    row = gtab_linetorow(hwnd, ptab, gtab_ytoline(hwnd, ptab, y));

    /* is he selecting a disabled fixed area ? */
    if ( (row < ptab->hdr.fixedrows) || (cell < ptab->hdr.fixedcols)) {
        if (ptab->hdr.fixedselectable == FALSE) {
            return;
        }
    }

    // ignore if beyond data
    if ((row >= ptab->hdr.nrows) ||
            (cell >= ptab->hdr.ncols)) {
        return;
    }

    /* is this within the already-selected area? */
    if (!gtab_insideselection(ptab, row, cell)) {
        // no selection, or clicked outside the selection - make new selection
        // before sending the right-click

        // if shift is down, extend selection
        if (GetKeyState(VK_SHIFT) & 0x8000) {
            gtab_extendsel(hwnd, ptab, row, cell, TRUE);
        } else {
            /* record and paint new selection */

            if (ptab->hdr.selectmode & TM_ROW) {
                cell = 0;
                ncells = ptab->hdr.ncols;
            } else {
                ncells = 1;
            }
            gtab_select(hwnd, ptab, row, cell, 1, ncells, TRUE);
        }
    }

    // now we have sent the selection, pass the message onto him
    hOwner = (HWND) GetWindowLongPtr(hwnd, WW_OWNER);
    SendMessage(hOwner, WM_RBUTTONDOWN, 0, MAKELONG( (short)x, (short)y));
}

int gtab_rowtoline | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | long | row
 | ) |  |

Definition at line 326 of file tscroll.cpp.

{
    if (row < ptab->hdr.fixedrows) {
        return( (int) row);
    }

    row -= ptab->toprow;
    if ((row >= ptab->hdr.fixedrows) && (row < ptab->nlines)) {
        return ( (int) row);
    }
    return(-1);
}

void gtab_select | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | long | row,
 |  | long | col,
 |  | long | nrows,
 |  | long | ncells,
 |  | BOOL | bNotify
 | ) |  |

Definition at line 400 of file tscroll.cpp.

{

    /* if in ROW mode, force col and ncells to reflect the entire row. */
    if (ptab->hdr.selectmode & TM_ROW) {
        col = 0;
        ncells = ptab->hdr.ncols;
    }

    /* clear existing sel if valid and visible */
    if ((ptab->select.nrows != 0) && (ptab->selvisible == TRUE)) {

        /* only clear sel if it is different from the new one */
        if ((ptab->select.startrow != row) ||
                (ptab->select.startcell != col) ||
                (ptab->select.nrows != nrows) ||
                (ptab->select.ncells != ncells)) {

            gtab_invertsel(hwnd, ptab, NULL);
            ptab->selvisible = FALSE;
        }
    }

    /* set select fields and send TQ_SELECT */
    if (row < ptab->hdr.nrows) {
        ptab->select.startrow = row;
        ptab->select.startcell = col;
        ptab->select.nrows = nrows;
        ptab->select.ncells = ncells;
    } else {
        ptab->select.nrows = 0;
        ptab->select.startrow = 0;
        ptab->select.startcell = 0;
        ptab->select.ncells = 0;
    }

    if (bNotify) {
        gtab_sendtq(hwnd, TQ_SELECT, (LPARAM) &ptab->select);
    }

    /* paint in selection */
    if (nrows != 0) {
        if (!ptab->selvisible) {
            gtab_invertsel(hwnd, ptab, NULL);
            ptab->selvisible = TRUE;
        }
    } else {
        if (ptab->selvisible) {
            gtab_invertsel(hwnd, ptab, NULL);
            ptab->selvisible = FALSE;
        }
        ptab->selvisible = FALSE;
    }
}

INT_PTR gtab_sendtq | ( | HWND | hwnd,
 |  | UINT | cmd,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 378 of file table.cpp.

{
    HWND hOwner;

    hOwner = (HWND) GetWindowLongPtr(hwnd, WW_OWNER);
    return (SendMessage(hOwner, gtab_msgcode, cmd, lParam));
}

void gtab_setsize | ( | HWND | hwnd,
 |  | lpTable | ptab
 | ) |  |

Definition at line 587 of file table.cpp.

{
    RECT rc;
    int nlines;
    long change;
    SCROLLINFO si;

    GetClientRect(hwnd, &rc);
    ptab->winwidth = rc.right - rc.left;
    nlines = (rc.bottom - rc.top) / ptab->rowheight;
    /* nlines is the number of whole lines - add one extra
     * for the partial line at the bottom
     */
    nlines += 1;

    /* alloc space for nlines of data - if nlines has changed */
    if (nlines != ptab->nlines) {
        gtab_freelinedata(ptab);
        ptab->nlines = nlines;
        if (!gtab_alloclinedata(hwnd, ptab)) {
            ptab->nlines = 0;
            return;
        }
    }

    si.cbSize = sizeof(si);
    si.fMask = SIF_PAGE|SIF_RANGE;
    si.nMin = 0;

    /* set scroll vertical range */
    si.nMax = ptab->hdr.nrows;
    si.nPage = ptab->nlines;
    if (si.nMax < 0) {
        si.nMax = 0;
        change =  -(ptab->toprow);
    } else if (ptab->toprow > si.nMax) {
        change = si.nMax - ptab->toprow;
    } else {
        change = 0;
    }
    /* the scroll range must be 16-bits for Win3
     * scale until this is true
     */
    ptab->scrollscale = 1;
    while (si.nMax > 32766) {
        ptab->scrollscale *= 16;
        si.nMax /= 16;
        si.nPage /= 16;
    }
    if (!si.nPage)
        si.nPage = 1;

    SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
    gtab_dovscroll(hwnd, ptab, change);

    /* set horz scroll range */
    si.nMax = ptab->rowwidth;
    si.nPage = ptab->winwidth;
    if (si.nMax < 0) {
        si.nMax = 0;
        change = -(ptab->scroll_dx);
    } else if (ptab->scroll_dx > si.nMax) {
        change = si.nMax - ptab->scroll_dx;
    } else {
        change = 0;
    }
    /* horz scroll range will always be < 16 bits */
    SetScrollInfo(hwnd, SB_HORZ, &si, TRUE);
    gtab_dohscroll(hwnd, ptab, change);
}

void gtab_showsel | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | BOOL | bToBottom
 | ) |  |

Definition at line 919 of file tscroll.cpp.

{
    int line;
    long change;

    line = gtab_rowtoline(hwnd, ptab, ptab->select.startrow);

    /* move up if last line or not at all visible */
    if ( (line < 0) || line == (ptab->nlines - 1)) {
        change = ptab->select.startrow - ptab->toprow;
        if (bToBottom) {
            /* change to bottom of window. subtract 2 not 1
             * since nlines includes one line that is only
             * partly visible
             */
            change -= (ptab->nlines - 2);
        }
        change -= ptab->hdr.fixedrows;
        gtab_dovscroll(hwnd, ptab, change);
    }
    /* add support for TM_CELL here! */
}

void gtab_showsel_middle | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | long | dyRowsFromTop
 | ) |  |

Definition at line 947 of file tscroll.cpp.

{
    int line = ptab->select.startrow;
    long change = 0;
    int mid_top, mid_end;
    BOOL fScroll = FALSE;

    if (dyRowsFromTop >= 0)
    {
        fScroll = TRUE;
        change = (ptab->select.startrow - dyRowsFromTop) - ptab->toprow;
        change -= ptab->hdr.fixedrows;
    }

    /* is this within the middle 60 % ?  */
    mid_top = ptab->toprow + (ptab->nlines * 20 / 100);
    mid_end = ptab->toprow + (ptab->nlines * 80 / 100);
    if ((line < mid_top + change) || (line > mid_end + change))
    {
        /* no - scroll so that selected line is at
         * the 20% mark
         */
        fScroll = TRUE;
        change = (ptab->select.startrow - mid_top);
        change -= ptab->hdr.fixedrows;
    }

    if (fScroll)
    {
        gtab_dovscroll(hwnd, ptab, change);
    }

    /* again - need code here for TM_CELL mode to ensure that
     * active cell is horizontally scrolled correctly
     */
}

void gtab_vsep | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | HDC | hdc
 | ) |  |

Definition at line 600 of file tpaint.cpp.

{
  int x;
  RECT rc;

  if (ptab->hdr.fixedcols < 1) {
    return;
  }
  x = ptab->pcellpos[ptab->hdr.fixedcols - 1].clipend+1;
  GetClientRect(hwnd, &rc);
  MoveToEx(hdc, x, rc.top, NULL);
  LineTo(hdc, x, rc.bottom);
}

Variable Documentation

HANDLE hNormCurs

Definition at line 27 of file table.cpp.

HPEN hpenDotted

Definition at line 28 of file table.cpp.

HANDLE hVertCurs

Definition at line 26 of file table.cpp.

Generated on Wed Nov 13 2024 16:53:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/sdkdiff/tree.cpp File Reference

  • Begin
  • sdkdiff
Classes | Functions

tree.cpp File Reference

#include "precomp.h"
#include "tree.h"

Go to the source code of this file.

Classes

struct | tree
struct | treeitem

Functions

TREE APIENTRY | ctree_create ()
void APIENTRY | ctree_delete (TREE tree)
LPVOID APIENTRY | ctree_find (TREE tree, TREEKEY key)
long APIENTRY | ctree_getcount (TREE tree, TREEKEY key)
LPVOID APIENTRY | ctree_update (TREE tree, TREEKEY key, LPVOID value, UINT length)
LPVOID APIENTRY | tree_addafter (TREE tree, PTREEITEM place, TREEKEY key, LPVOID value, UINT length)
TREE APIENTRY | tree_create ()
void APIENTRY | tree_delete (TREE tree)
void | tree_delitem (TREEITEM item)
LPVOID APIENTRY | tree_find (TREE tree, TREEKEY key)
TREEITEM | tree_getitem (TREE tree, TREEKEY key)
TREEITEM | tree_newitem (TREE root, TREEKEY key, LPVOID value, UINT length)
LPVOID APIENTRY | tree_search (TREE tree, TREEKEY key, PTREEITEM pplace)
LPVOID APIENTRY | tree_update (TREE tree, TREEKEY key, LPVOID value, UINT length)

Function Documentation

TREE APIENTRY ctree_create ( )

Definition at line 348 of file tree.cpp.

{
    return(tree_create());
}

void APIENTRY ctree_delete ( TREE tree )

Definition at line 357 of file tree.cpp.

{
    tree_delete(tree);
}

LPVOID APIENTRY ctree_find | ( | TREE | tree,
 |  | TREEKEY | key
 | ) |  |

Definition at line 431 of file tree.cpp.

{
    LONG_PTR FAR * pcounter;

    pcounter = (LONG_PTR *)tree_find(tree, key);
    if (pcounter == NULL) {
        return(0);
    }

    /* increment pointer by size of 1 long to point to
     * user's datablock
     */
    return(pcounter+1);
}

long APIENTRY ctree_getcount | ( | TREE | tree,
 |  | TREEKEY | key
 | ) |  |

Definition at line 416 of file tree.cpp.

{
    LONG_PTR FAR * pcounter;

    pcounter = (LONG_PTR *)tree_find(tree, key);
    if (pcounter == NULL) {
        return(0);
    }
    return((long)*pcounter);
}

LPVOID APIENTRY ctree_update | ( | TREE | tree,
 |  | TREEKEY | key,
 |  | LPVOID | value,
 |  | UINT | length
 | ) |  |

Definition at line 374 of file tree.cpp.

{
    TREEITEM item;
    LONG_PTR FAR * pcounter;
    LPVOID datacopy;

    pcounter = (LONG_PTR *)tree_search(tree, key, &item);

    if (pcounter == NULL) {
        /* element not found - insert a new one
         * the data block for this element should be
         * the user's block with our reference count at
         * the beginning
         */
        pcounter = (LONG_PTR *)tree_addafter(tree, &item, key, NULL,
                                 length + sizeof(LONG_PTR));
        *pcounter = 1;
        /* add on size of one long to get the start of the user
         * data
         */
        datacopy = pcounter + 1;
        if (value != NULL) {
            memcpy(datacopy, value, length);
        }
        return(datacopy);
    }

    /* key was already there - increment reference count and
     * return pointer to data
     */

    (*pcounter)++;

    /* add on size of one long to get the start of the user
     * data
     */
    datacopy = pcounter + 1;
    return(datacopy);
}

LPVOID APIENTRY tree_addafter | ( | TREE | tree,
 |  | PTREEITEM | place,
 |  | TREEKEY | key,
 |  | LPVOID | value,
 |  | UINT | length
 | ) |  |

Definition at line 303 of file tree.cpp.

{
    TREEITEM item, child;

    item = *place;
    if (item == NULL) {
        tree->first = tree_newitem(tree, key, value, length);
        return (tree->first->data);
    }

    child = tree_newitem(tree, key, value, length);
    if (child->key < item->key ) {
        /* should go on left leg */
        if (item->left != NULL) {
            Trace_Error(NULL, "TREE: left leaf leg not free", FALSE);

        }
        item->left = child;
    } else {
        if (item->right != NULL) {
            Trace_Error(NULL, "TREE: right leaf leg not free", FALSE);
        }
        item->right = child;
    }
    return(child->data);
}

TREE APIENTRY tree_create ( )

Definition at line 141 of file tree.cpp.

{
    TREE tree;

    tree = (TREE) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct tree));
    if (tree == NULL)
    return NULL;

  tree->first = NULL;
    return(tree);
}

void APIENTRY tree_delete ( TREE tree )

Definition at line 158 of file tree.cpp.

{

    tree_delitem(tree->first);

    HeapFree(GetProcessHeap(), NULL, tree);
}

void tree_delitem ( TREEITEM item )

Definition at line 54 of file tree.cpp.

{
    if (item == NULL) {
        return;
    }
    if (item->left != NULL) {
        tree_delitem(item->left);
    }
    if (item->right != NULL) {
        tree_delitem(item->right);
    }
    if (item->data != NULL) {
        HeapFree(GetProcessHeap(), NULL, item->data);
    }

    HeapFree(GetProcessHeap(), NULL, item);
}

LPVOID APIENTRY tree_find | ( | TREE | tree,
 |  | TREEKEY | key
 | ) |  |

Definition at line 221 of file tree.cpp.

{
    TREEITEM item;

    /* find the correct place in the tree */
    item = tree_getitem(tree, key);

    if (item == NULL) {
        /* nothing in the tree */
        return(NULL);
    }

    if (item->key != key) {
        /* this key not in. getitem has returned parent */
        return(NULL);
    }

    /* found the right element - return pointer to the
     * data block
     */
    return(item->data);
}

TREEITEM tree_getitem | ( | TREE | tree,
 |  | TREEKEY | key
 | ) |  |

Definition at line 107 of file tree.cpp.

{
    TREEITEM item, prev;

    prev = NULL;
    for (item = tree->first; item != NULL; ) {

        if (item->key == key) {
            return(item);
        }

        /* not this item - go on to the correct child item.
         * remember this item as if the child is NULL, this item
         * will be the correct insertion point for the new item
         */
        prev = item;

        if (key < item->key) {
            item = item->left;
        } else {
            item = item->right;
        }
    }
    /* prev is the parent - or null if nothing in tree */
    return(prev);
}

TREEITEM tree_newitem | ( | TREE | root,
 |  | TREEKEY | key,
 |  | LPVOID | value,
 |  | UINT | length
 | ) |  |

Definition at line 77 of file tree.cpp.

{
    TREEITEM item;

    item = (TREEITEM) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct treeitem));
  if (item == NULL)
    return NULL;

    item->root = root;
    item->key = key;
    item->left = NULL;
    item->right = NULL;
    item->length = length;
    item->data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, length);
    if (item->data == NULL)
    return NULL;

  if (value != NULL) {
        memcpy(item->data, value, length);
    }

    return(item);
}

LPVOID APIENTRY tree_search | ( | TREE | tree,
 |  | TREEKEY | key,
 |  | PTREEITEM | pplace
 | ) |  |

Definition at line 259 of file tree.cpp.

{
    TREEITEM item;

    item = tree_getitem(tree, key);

    if (item == NULL) {
        /* no items in tree. set placeholder to NULL to
         * indicate insert at top of tree
         */
        *pplace = NULL;

        /* return NULL to indicate key not found */
        return(NULL);
    }

    if (item->key == key) {
        /* found the key already there -
         * set pplace to null just for safety
         */
        *pplace = NULL;

        /* give the user a pointer to his data */
        return(item->data);
    }

    /* key was not found - getitem has returned the parent
     * - set this as the place for new insertions
     */
    *pplace = item;

    /* return NULL to indicate that the key was not found */
    return(NULL);
}

LPVOID APIENTRY tree_update | ( | TREE | tree,
 |  | TREEKEY | key,
 |  | LPVOID | value,
 |  | UINT | length
 | ) |  |

Definition at line 178 of file tree.cpp.

{
    TREEITEM item;

    /* find the place in the tree for this key to go */
    item = tree_getitem(tree, key);

    if (item == NULL) {
        /* there is nothing in the tree: this item should
         * go at the top
         */
        tree->first = tree_newitem(tree, key, value, length);
        return(tree->first->data);
    }

  /* is this the same key? */
    if (item->key == key) {

        /* this key already inserted. re-alloc the data */
        if (length != item->length) {
            HeapFree(GetProcessHeap(), NULL, item->data);
            item->data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, length);
      if (item->data == NULL)
        return NULL;
    }
        /* don't initialise block if no pointer passed */
        if (value != NULL) {
            memcpy(item->data, value, length);
        }
        return(item->data);
    }

    /* not the same key - getitem returned the parent for
     * the new tree. insert it as a child of item.
     */
    return(tree_addafter(tree, &item, key, value, length));
}

Generated on Wed Nov 13 2024 16:53:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/sdkdiff/tree.h File Reference

  • Begin
  • sdkdiff
Typedefs | Functions

tree.h File Reference

Go to the source code of this file.

Typedefs

typedef TREEITEM FAR * | PTREEITEM
typedef struct tree FAR * | TREE
typedef struct treeitem FAR * | TREEITEM
typedef DWORD | TREEKEY

Functions

TREE APIENTRY | ctree_create ()
void APIENTRY | ctree_delete (TREE tree)
LPVOID APIENTRY | ctree_find (TREE tree, TREEKEY key)
long APIENTRY | ctree_getcount (TREE tree, TREEKEY key)
LPVOID APIENTRY | ctree_update (TREE tree, TREEKEY key, LPVOID value, UINT length)
LPVOID APIENTRY | tree_addafter (TREE tree, PTREEITEM place, TREEKEY key, LPVOID value, UINT length)
TREE APIENTRY | tree_create ()
void APIENTRY | tree_delete (TREE tree)
LPVOID APIENTRY | tree_find (TREE tree, TREEKEY key)
LPVOID APIENTRY | tree_search (TREE tree, TREEKEY key, PTREEITEM place)
LPVOID APIENTRY | tree_update (TREE tree, TREEKEY key, LPVOID value, UINT length)

Typedef Documentation

typedef TREEITEM FAR* PTREEITEM

Definition at line 37 of file tree.h.

typedef struct tree FAR* TREE

Definition at line 26 of file tree.h.

typedef struct treeitem FAR* TREEITEM

Definition at line 34 of file tree.h.

typedef DWORD TREEKEY

Definition at line 29 of file tree.h.

Function Documentation

TREE APIENTRY ctree_create ( )

Definition at line 348 of file tree.cpp.

{
    return(tree_create());
}

void APIENTRY ctree_delete ( TREE tree )

Definition at line 357 of file tree.cpp.

{
    tree_delete(tree);
}

LPVOID APIENTRY ctree_find | ( | TREE | tree,
 |  | TREEKEY | key
 | ) |  |

Definition at line 431 of file tree.cpp.

{
    LONG_PTR FAR * pcounter;

    pcounter = (LONG_PTR *)tree_find(tree, key);
    if (pcounter == NULL) {
        return(0);
    }

    /* increment pointer by size of 1 long to point to
     * user's datablock
     */
    return(pcounter+1);
}

long APIENTRY ctree_getcount | ( | TREE | tree,
 |  | TREEKEY | key
 | ) |  |

Definition at line 416 of file tree.cpp.

{
    LONG_PTR FAR * pcounter;

    pcounter = (LONG_PTR *)tree_find(tree, key);
    if (pcounter == NULL) {
        return(0);
    }
    return((long)*pcounter);
}

LPVOID APIENTRY ctree_update | ( | TREE | tree,
 |  | TREEKEY | key,
 |  | LPVOID | value,
 |  | UINT | length
 | ) |  |

Definition at line 374 of file tree.cpp.

{
    TREEITEM item;
    LONG_PTR FAR * pcounter;
    LPVOID datacopy;

    pcounter = (LONG_PTR *)tree_search(tree, key, &item);

    if (pcounter == NULL) {
        /* element not found - insert a new one
         * the data block for this element should be
         * the user's block with our reference count at
         * the beginning
         */
        pcounter = (LONG_PTR *)tree_addafter(tree, &item, key, NULL,
                                 length + sizeof(LONG_PTR));
        *pcounter = 1;
        /* add on size of one long to get the start of the user
         * data
         */
        datacopy = pcounter + 1;
        if (value != NULL) {
            memcpy(datacopy, value, length);
        }
        return(datacopy);
    }

    /* key was already there - increment reference count and
     * return pointer to data
     */

    (*pcounter)++;

    /* add on size of one long to get the start of the user
     * data
     */
    datacopy = pcounter + 1;
    return(datacopy);
}

LPVOID APIENTRY tree_addafter | ( | TREE | tree,
 |  | PTREEITEM | place,
 |  | TREEKEY | key,
 |  | LPVOID | value,
 |  | UINT | length
 | ) |  |

Definition at line 303 of file tree.cpp.

{
    TREEITEM item, child;

    item = *place;
    if (item == NULL) {
        tree->first = tree_newitem(tree, key, value, length);
        return (tree->first->data);
    }

    child = tree_newitem(tree, key, value, length);
    if (child->key < item->key ) {
        /* should go on left leg */
        if (item->left != NULL) {
            Trace_Error(NULL, "TREE: left leaf leg not free", FALSE);

        }
        item->left = child;
    } else {
        if (item->right != NULL) {
            Trace_Error(NULL, "TREE: right leaf leg not free", FALSE);
        }
        item->right = child;
    }
    return(child->data);
}

TREE APIENTRY tree_create ( )

Definition at line 141 of file tree.cpp.

{
    TREE tree;

    tree = (TREE) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct tree));
    if (tree == NULL)
    return NULL;

  tree->first = NULL;
    return(tree);
}

void APIENTRY tree_delete ( TREE tree )

Definition at line 158 of file tree.cpp.

{

    tree_delitem(tree->first);

    HeapFree(GetProcessHeap(), NULL, tree);
}

LPVOID APIENTRY tree_find | ( | TREE | tree,
 |  | TREEKEY | key
 | ) |  |

Definition at line 221 of file tree.cpp.

{
    TREEITEM item;

    /* find the correct place in the tree */
    item = tree_getitem(tree, key);

    if (item == NULL) {
        /* nothing in the tree */
        return(NULL);
    }

    if (item->key != key) {
        /* this key not in. getitem has returned parent */
        return(NULL);
    }

    /* found the right element - return pointer to the
     * data block
     */
    return(item->data);
}

LPVOID APIENTRY tree_search | ( | TREE | tree,
 |  | TREEKEY | key,
 |  | PTREEITEM | place
 | ) |  |

Definition at line 259 of file tree.cpp.

{
    TREEITEM item;

    item = tree_getitem(tree, key);

    if (item == NULL) {
        /* no items in tree. set placeholder to NULL to
         * indicate insert at top of tree
         */
        *pplace = NULL;

        /* return NULL to indicate key not found */
        return(NULL);
    }

    if (item->key == key) {
        /* found the key already there -
         * set pplace to null just for safety
         */
        *pplace = NULL;

        /* give the user a pointer to his data */
        return(item->data);
    }

    /* key was not found - getitem has returned the parent
     * - set this as the place for new insertions
     */
    *pplace = item;

    /* return NULL to indicate that the key was not found */
    return(NULL);
}

LPVOID APIENTRY tree_update | ( | TREE | tree,
 |  | TREEKEY | key,
 |  | LPVOID | value,
 |  | UINT | length
 | ) |  |

Definition at line 178 of file tree.cpp.

{
    TREEITEM item;

    /* find the place in the tree for this key to go */
    item = tree_getitem(tree, key);

    if (item == NULL) {
        /* there is nothing in the tree: this item should
         * go at the top
         */
        tree->first = tree_newitem(tree, key, value, length);
        return(tree->first->data);
    }

  /* is this the same key? */
    if (item->key == key) {

        /* this key already inserted. re-alloc the data */
        if (length != item->length) {
            HeapFree(GetProcessHeap(), NULL, item->data);
            item->data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, length);
      if (item->data == NULL)
        return NULL;
    }
        /* don't initialise block if no pointer passed */
        if (value != NULL) {
            memcpy(item->data, value, length);
        }
        return(item->data);
    }

    /* not the same key - getitem returned the parent for
     * the new tree. insert it as a child of item.
     */
    return(tree_addafter(tree, &item, key, value, length));
}

Generated on Wed Nov 13 2024 16:53:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/sdkdiff/tscroll.cpp File Reference

  • Begin
  • sdkdiff
Functions

tscroll.cpp File Reference

#include "precomp.h"
#include "table.h"
#include "tpriv.h"

Go to the source code of this file.

Functions

VOID | gtab_changesel (HWND hwnd, lpTable ptab, long rowincr, int cellincr, BOOL bToBottom, BOOL bExtend)
void | gtab_dblclick (HWND hwnd, lpTable ptab, int x, int y)
void | gtab_dohscroll (HWND hwnd, lpTable ptab, long change)
void | gtab_dovscroll (HWND hwnd, lpTable ptab, long change)
void | gtab_enter (HWND hwnd, lpTable ptab, long row, long col, long nrows, long ncells)
VOID | gtab_extendsel (HWND hwnd, lpTable ptab, long startrow, long startcell, BOOL bNotify)
BOOL | gtab_insideselection (lpTable ptab, long row, long cell)
BOOL | gtab_isborder (HWND hwnd, lpTable ptab, long x, long col)
int | gtab_key (HWND hwnd, lpTable ptab, int vkey)
long | gtab_linetorow (HWND hwnd, lpTable ptab, int line)
int | gtab_mousewheel (HWND hwnd, lpTable ptab, DWORD fwKeys, int zDelta)
void | gtab_move (HWND hwnd, lpTable ptab, int x, int y)
void | gtab_msg_hscroll (HWND hwnd, lpTable ptab, int opcode, int pos)
void | gtab_msg_vscroll (HWND hwnd, lpTable ptab, int opcode, int pos)
void | gtab_press (HWND hwnd, lpTable ptab, int x, int y)
void | gtab_release (HWND hwnd, lpTable ptab, int x, int y)
void | gtab_rightclick (HWND hwnd, lpTable ptab, int x, int y)
int | gtab_rowtoline (HWND hwnd, lpTable ptab, long row)
void | gtab_select (HWND hwnd, lpTable ptab, long row, long col, long nrows, long ncells, BOOL bNotify)
void | gtab_selhome (HWND hwnd, lpTable ptab, BOOL bExtend)
void | gtab_showsel (HWND hwnd, lpTable ptab, BOOL bToBottom)
void | gtab_showsel_middle (HWND hwnd, lpTable ptab, long dyRowsFromTop)
void | gtab_trackcol (HWND hwnd, lpTable ptab, long col, long x)
int | gtab_xtocol (HWND hwnd, lpTable ptab, int x)
int | gtab_ytoline (HWND hwnd, lpTable ptab, int y)

Function Documentation

VOID gtab_changesel | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | long | rowincr,
 |  | int | cellincr,
 |  | BOOL | bToBottom,
 |  | BOOL | bExtend
 | ) |  |

Definition at line 1084 of file tscroll.cpp.

{
    long row, col, ncols;

    /* is there a selection ? */
    if (ptab->select.nrows == 0) {

        /* no selection - force a selection
         * at the first visible unit
         */
        if (ptab->hdr.fixedselectable) {
            row = 0;
            col = 0;
        } else {
            row = gtab_linetorow(hwnd, ptab, ptab->hdr.fixedrows);
            /* should really check for first visible cell */
            col = ptab->hdr.fixedcols;
        }
        ncols = 1;
        if (ptab->hdr.selectmode & TM_ROW) {
            col = 0;
            ncols = ptab->hdr.ncols;
        }
        gtab_select(hwnd, ptab, row, col, 1, ncols, TRUE);

    } else {
        /* move the anchor point by rowincr, cellincr */
        row = ptab->select.startrow + rowincr;
        col = ptab->select.startcell + cellincr;

        /*
         * ensure that new anchor point is in a valid position
         */

        while (col >= ptab->hdr.ncols) {
            col -= ptab->hdr.ncols;
            row++;
        }
        while (col < 0) {
            col += ptab->hdr.ncols;
            row--;
        }
        if (row < 0) {
            row = 0;
        }
        if (row >= ptab->hdr.nrows) {
            row = ptab->hdr.nrows-1;
        }
        /* check we haven't moved into non-selectable region */
        if ((row < ptab->hdr.fixedrows) &&
            (!ptab->hdr.fixedselectable)) {
                    row = ptab->hdr.fixedrows;
        }

        if (bExtend) {
            gtab_extendsel(hwnd, ptab, row, col, TRUE);
        } else {
            gtab_select(
                hwnd,
                ptab,
                row,
                col,
                1,
                (ptab->hdr.selectmode & TM_ROW) ? ptab->hdr.ncols : 1,
                TRUE);
        }
    }

    /* ensure selection visible */
    gtab_showsel(hwnd, ptab, bToBottom);
}

void gtab_dblclick | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | int | x,
 |  | int | y
 | ) |  |

Definition at line 891 of file tscroll.cpp.

{
    int cell, line;
    long row;

    line = gtab_ytoline(hwnd, ptab, y);
    cell = gtab_xtocol(hwnd, ptab, x);
    if ( (line < ptab->hdr.fixedrows) || (cell < ptab->hdr.fixedcols) ) {
        if (!ptab->hdr.fixedselectable) {
            return;
        }
    }
    row = gtab_linetorow(hwnd, ptab, line);

    if (ptab->hdr.selectmode & TM_ROW) {
        gtab_enter(hwnd, ptab, row, 0, 1, ptab->hdr.ncols);
    } else {
        gtab_enter(hwnd, ptab, row, cell, 1, 1);
    }
}

void gtab_dohscroll | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | long | change
 | ) |  |

Definition at line 253 of file tscroll.cpp.

{
    int curx, i;
    int moveable;
    lpCellPos cp;
    int newdx, range;

    /* check that the new scroll pos is still within the valid range */
    range = ptab->rowwidth - ptab->winwidth;
    newdx = ptab->scroll_dx + (int) change;
    if (range < 0) {
        range = 0;
    }
    if (newdx > range) {
        change = range - ptab->scroll_dx;
    } else if (newdx < 0) {
        change = -(ptab->scroll_dx);
    }
    ptab->scroll_dx += (int) change;

    SetScrollPos(hwnd, SB_HORZ, ptab->scroll_dx, TRUE);
    if (ptab->hdr.fixedcols > 0) {
        RECT rc;
        GetClientRect(hwnd, &rc);
        rc.left = ptab->pcellpos[ptab->hdr.fixedcols - 1].clipend;
        InvalidateRect(hwnd, &rc, FALSE);
    } else {
        InvalidateRect(hwnd, NULL, FALSE);
    }

    /* loop through each col setting relative posn and clipping */
    /* clip off 1 pixel left and right (we added 2 on to size for this) */

    /* first set up fixed columns */
    curx = 0;
    for (i = 0; i < ptab->hdr.fixedcols; i++) {
        cp = &ptab->pcellpos[i];
        cp->start = curx + 1;
        cp->clipstart = cp->start;
        cp->clipend = cp->start + cp->size - 2;
        curx += cp->size;
    }

    /* now moveable columns. remember start of moveable cols */
    moveable = curx;
    curx = - ptab->scroll_dx;       /* rel. pos of col */
    for (i = ptab->hdr.fixedcols; i < ptab->hdr.ncols; i++) {
        cp = &ptab->pcellpos[i];
        cp->start = curx + moveable + 1;
        cp->clipstart = max(moveable+1, cp->start);
        cp->clipend = cp->start + cp->size - 2;
        curx += cp->size;
    }
}

void gtab_dovscroll | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | long | change
 | ) |  |

Definition at line 121 of file tscroll.cpp.

{
    int cury, i;
    long ncopy;
    lpCellPos cp;
    LineData ldtemp;
    RECT rc, rcpaint;
    long range;
    long newtop;
    int newpos;
    BOOL fWasVisible = FALSE;

    if (ptab->selvisible)
    {
        fWasVisible = TRUE;
        ptab->selvisible = FALSE;
        gtab_invertsel(hwnd, ptab, NULL);
    }

    range = ptab->hdr.nrows - (ptab->nlines - 1);
    newtop = ptab->toprow + change;
    if (range < 0) {
        range = 0;
    }
    if (newtop > range) {
        change = range - ptab->toprow;
    } else if (newtop < 0) {
        change = -(ptab->toprow);
    }
    ptab->toprow += change;

    newpos = (int) (newtop / ptab->scrollscale);
    SetScrollPos(hwnd, SB_VERT, newpos, TRUE);

    if (ptab->hdr.sendscroll) {
        gtab_sendtq(hwnd, TQ_SCROLL, ptab->toprow);
    }

    /* adjust data ptrs rather than invalidate, to retain the
     * data we know is still valid
     */
    if (abs(change) >= ptab->nlines) {
        gtab_invallines(hwnd, ptab, ptab->hdr.fixedrows,
            ptab->nlines - ptab->hdr.fixedrows);
        InvalidateRect(hwnd, NULL, FALSE);
        change = 0;
    } else if (change < 0) {
        /* copy data down */
        ncopy = (ptab->nlines - ptab->hdr.fixedrows) - abs(change);
        for (i =  ptab->nlines - 1;
                i >= (ptab->hdr.fixedrows + abs(change)); i--) {
            ldtemp = ptab->pdata[i - abs(change)];
            ptab->pdata[i - abs(change)] = ptab->pdata[i];
            ptab->pdata[i] = ldtemp;
        }
        gtab_invallines(hwnd, ptab,
                ptab->hdr.fixedrows, (int) abs(change));
    } else if (change > 0) {
        ncopy = (ptab->nlines - ptab->hdr.fixedrows) - change;
        for (i = ptab->hdr.fixedrows;
                i < (ncopy + ptab->hdr.fixedrows); i++) {
            ldtemp = ptab->pdata[i + change];
            ptab->pdata[i + change] = ptab->pdata[i];
            ptab->pdata[i] = ldtemp;
        }
        gtab_invallines(hwnd, ptab,
            (int) ncopy + ptab->hdr.fixedrows, (int) change);
    }

    /* scroll window */
    GetClientRect(hwnd, &rc);
    rcpaint = rc;
    if (change > 0) {
        rc.top += (int) (change + ptab->hdr.fixedrows) * ptab->rowheight;
        rcpaint.top = (ptab->hdr.fixedrows * ptab->rowheight);
        rcpaint.top += rc.bottom - rc.top;
    } else if (change < 0) {
        rc.top += (ptab->hdr.fixedrows * ptab->rowheight);
        rc.bottom += (int) (change * ptab->rowheight);
        rcpaint.bottom -= rc.bottom - rc.top;
    }

    /* loop through each line setting relative posn and clipping */

    /* set up all rows  - the fixed/moveable difference for
     * rows is made at fetch-time during painting, when we remember
     * which absolute row nr to ask for, for a given screen line
     */
    cury = 0;
    for (i = 0; i < ptab->nlines; i++) {
        cp = &ptab->pdata[i].linepos;
        cp->start = cury;
        cp->clipstart = cury;
        cp->clipend = cury + cp->size;
        cury += cp->size;
    }

    /* now move and repaint the window */
    if (change != 0) {
        if (rc.top < rc.bottom) {
            ScrollWindow(hwnd, 0, (int) -(change * ptab->rowheight),
                &rc, NULL);
        }

        // don't repaint the fixed rows
        rc.top = 0;
        rc.bottom = ptab->hdr.fixedrows * ptab->rowheight;
        ValidateRect(hwnd, &rc);

        /* force repaint now, not just post message for later,
         * since we want to repaint that line before the next
         * scroll down occurs
         */
        ValidateRect(hwnd, &rcpaint);
        RedrawWindow(hwnd, &rcpaint, NULL,
                RDW_NOERASE | RDW_INVALIDATE | RDW_INTERNALPAINT);

    }

    if (fWasVisible)
    {
        gtab_invertsel(hwnd, ptab, NULL);
        ptab->selvisible = TRUE;
    }
}

void gtab_enter | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | long | row,
 |  | long | col,
 |  | long | nrows,
 |  | long | ncells
 | ) |  |

Definition at line 511 of file tscroll.cpp.

{
    /* clear existing sel if valid and visible */
    if ((ptab->select.nrows != 0) && (ptab->selvisible == TRUE)) {

        /* only clear sel if it is different from the new one */
        if ((ptab->select.startrow != row) ||
                (ptab->select.startcell != col) ||
                (ptab->select.nrows != nrows) ||
                (ptab->select.ncells != ncells)) {
            gtab_invertsel(hwnd, ptab, NULL);
            ptab->selvisible = FALSE;
        }
    }

    /* set select fields and send TQ_ENTER */
    if (row < ptab->hdr.nrows) {
        ptab->select.startrow = row;
        ptab->select.startcell = col;
        ptab->select.nrows = nrows;
        ptab->select.ncells = ncells;
    } else {
        ptab->select.nrows = 0;
        ptab->select.startrow = 0;
        ptab->select.startcell = 0;
        ptab->select.ncells = 0;
    }

    /* paint in selection */
    if (nrows != 0) {
        if (!ptab->selvisible) {
            gtab_invertsel(hwnd, ptab, NULL);
            ptab->selvisible = TRUE;
        }
        /* do this at end because it could cause a layout-change */
        gtab_sendtq(hwnd, TQ_ENTER, (LPARAM) &ptab->select);
    } else {
        if (ptab->selvisible) {
            gtab_invertsel(hwnd, ptab, NULL);
        }
        ptab->selvisible = FALSE;
    }
}

VOID gtab_extendsel | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | long | startrow,
 |  | long | startcell,
 |  | BOOL | bNotify
 | ) |  |

Definition at line 993 of file tscroll.cpp.

{
    long endrow, endcell, nrows, ncells;

    /*
     * if no current selection, then just select the new anchor point
     */
    if (ptab->select.nrows == 0) {
        gtab_select(hwnd, ptab, startrow, startcell, 1,
            (ptab->hdr.selectmode & TM_ROW) ? ptab->hdr.ncols:1,
            bNotify);
        return;
    }

    if (startrow >= ptab->hdr.nrows) {
        startrow = ptab->hdr.nrows -1;
    } else if (startrow < 0) {
        startrow = 0;
    }
    if (startcell >= ptab->hdr.ncols) {
        startcell = ptab->hdr.ncols-1;
    } else if (startcell < 0) {
        startcell = 0;
    }

    /* calculate the row just beyond the selection
     * this is one above for upwards sels, and one below for
     * downard-extending sels. Then adjust down or up one
     * to be the actual (inclusive) last row.
     */
    endrow = ptab->select.startrow + ptab->select.nrows;
    if (ptab->select.nrows < 0) {
        endrow++;
    } else {
        endrow--;
    }

    if (endrow >= ptab->hdr.nrows) {
        endrow = ptab->hdr.nrows-1;
    }
    nrows = endrow - startrow;

    if (nrows >= 0) {
        // convert from exclusive to inclusive
        nrows++;
    } else {
        // convert from exclusive to inclusive
        nrows--;
    }

    /* same calculation for cells */
    endcell = ptab->select.startcell + ptab->select.ncells;
    if (ptab->select.ncells < 0) {
        endcell++;
    } else {
        endcell--;
    }
    ncells = endcell - startcell;
    if (ncells >= 0) {
        ncells++;
    } else {
        ncells--;
    }
    gtab_select(hwnd, ptab, startrow, startcell, nrows, ncells, bNotify);
}

BOOL gtab_insideselection | ( | lpTable | ptab,
 |  | long | row,
 |  | long | cell
 | ) |  |

Definition at line 346 of file tscroll.cpp.

{
    long startrow, endrow;
    long startcell, endcell;

    if (0 == ptab->select.nrows) {
        // no selection
        return FALSE;
    }

    // selection maintains anchor point as startrow,
    // so the selection can extend forwards or backwards from there.
    // need to convert to forward only for comparison
    startrow = ptab->select.startrow;
    if (ptab->select.nrows < 0) {
        endrow = startrow;
        startrow += ptab->select.nrows + 1;
    } else {
        endrow = startrow + ptab->select.nrows - 1;
    }
    if ((row < startrow) || (row > endrow)) {
        return FALSE;
    }

    // if we are in row-select mode, then that's it - its inside
    if (ptab->hdr.selectmode & TM_ROW) {
        return TRUE;
    }

    // same calculation for cells
    startcell = ptab->select.startcell;
    if (ptab->select.ncells < 0) {
        endcell = startcell;
        startcell += ptab->select.ncells + 1;
    } else {
        endcell = startcell + ptab->select.ncells - 1;
    }
    if ((cell < startcell) || (cell > endcell)) {
        return FALSE;
    }

    return TRUE;
}

BOOL gtab_isborder | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | long | x,
 |  | long | col
 | ) |  |

Definition at line 496 of file tscroll.cpp.

{

    if (abs(ptab->pcellpos[col].clipend - x) < 2) {
        return(TRUE);
    } else {
        return(FALSE);
    }
}

int gtab_key | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | int | vkey
 | ) |  |

Definition at line 1204 of file tscroll.cpp.

{
    long startrow, ncells, startcell;
    BOOL bControl = FALSE;
    BOOL bShift = FALSE;

    if (GetKeyState(VK_CONTROL) & 0x8000) {
        bControl = TRUE;
    }
    if (GetKeyState(VK_SHIFT) & 0x8000) {
        /* ignore shift key here if TM_MANY -multiple selection flag- is
         * not selected
         */
        if (ptab->hdr.selectmode & TM_MANY) {
            bShift = TRUE;
        }
    }

    switch(vkey) {

    case VK_UP:
        if (bControl) {
            /* control-uparrow scrolls window without selection.
             * the selection is de-selected (to avoid surprises
             * moving back to it).
             */
            gtab_select(hwnd, ptab, 0, 0, 0, 0, TRUE);
            gtab_dovscroll(hwnd, ptab, -1);
        } else {
            /* uparrow moves selection up one line */
            gtab_changesel(hwnd, ptab, -1, 0, FALSE, bShift);
        }
        return(0);

    case VK_DOWN:
        if (bControl) {
            /* control downarrow scrolls window without
             * a selection.
             */
            gtab_select(hwnd, ptab, 0, 0, 0, 0, TRUE);
            gtab_dovscroll(hwnd, ptab, 1);
        } else {
            /* the normal gtab_changesel behaviour is
             * that if the selected line is not visible now,
             * we scroll it to the top of the window. This is fine
             * in most cases but causes unacceptable jumps when
             * repeatedly scrolling down with the down key.
             *
             * Thus we now have an argument to changesel to say
             * that in this case, if you need to move the line onto
             * the window, move it to the bottom and not the top
             */
            gtab_changesel(hwnd, ptab, 1, 0, TRUE, bShift);
        }
        return(0);

    case VK_LEFT:
        /* if cell-selection mode, move left one cell.
         * otherwise the whole row is selected - scroll
         * the line left a little
         */

        if (ptab->hdr.selectmode & TM_ROW) {
            if (bControl) {
                /* ctrl-left moves to start of line */
                gtab_dohscroll(hwnd, ptab, -(ptab->scroll_dx));
            } else {
                gtab_dohscroll(hwnd, ptab, -(ptab->avewidth));
            }
        } else {
            gtab_changesel(hwnd, ptab, 0, -1, FALSE, bShift);
        }
        return(0);

    case VK_RIGHT:
        /* if cell-selection mode, move right one cell.
         * otherwise the whole row is selected - scroll
         * the line right a little
         */
        if (ptab->hdr.selectmode & TM_ROW) {
            if (bControl) {
                /* control-right moves to right end of line */
                gtab_dohscroll(hwnd, ptab, ptab->rowwidth -
                                ptab->winwidth);
            } else {
                gtab_dohscroll(hwnd, ptab, ptab->avewidth);
            }
        } else {
            gtab_changesel(hwnd, ptab, 0, 1, TRUE, bShift);
        }
        return(0);

    case VK_HOME:
        if (bControl) {
            /* control-home == top of file */
            gtab_dovscroll(hwnd, ptab, -(ptab->toprow));
        }
        /* top of window */
        gtab_selhome(hwnd, ptab, bShift);
        gtab_showsel(hwnd, ptab, FALSE);

        return(0);

    case VK_END:
        if (bControl) {
            /* control-end -> end of file */
            startrow = ptab->hdr.nrows-1;
        } else {
            startrow = gtab_linetorow(hwnd, ptab, ptab->nlines - 1);
            if (startrow >= ptab->hdr.nrows) {
                startrow = ptab->hdr.nrows-1;
            }
        }

        startcell = 0;
        ncells = ptab->hdr.ncols;
        if (!(ptab->hdr.selectmode & TM_ROW)) {
            startcell = ptab->hdr.ncols-1;
            ncells = 1;
        }

        if (bShift) {
            gtab_extendsel(hwnd, ptab, startrow, startcell, TRUE);
        } else {
            gtab_select(hwnd, ptab, startrow, startcell, 1, ncells, TRUE);
        }

        /* we have selected the bottom line. We don't want to
         * move it up into the window, since the intended
         * effect is to select the lowest line. This doesn't
         * apply to the ctrl-end behaviour (move to bottom of
         * buffer.
         */
        if (bControl) {
            /* move the selection to make it visible - but move it
             * to the bottom and not to the top of the window
             */
            gtab_showsel(hwnd, ptab, TRUE);
        }
        return(0);

    case VK_RETURN:
        if (ptab->select.nrows != 0) {
            gtab_showsel(hwnd, ptab, FALSE);
            gtab_enter(hwnd, ptab, ptab->select.startrow,
                    ptab->select.startcell,
                    ptab->select.nrows, ptab->select.ncells);
        }
        return(0);

    case VK_SPACE:
        /* toggle the selection */
        if (ptab->select.nrows == 0) {
                /* no selection - make one */
                gtab_changesel(hwnd, ptab, 0, 0, TRUE, FALSE);
        } else {
                /* there is a selection - deselect it */
                gtab_select(hwnd, ptab, 0, 0, 0, 0, TRUE);
        }
        return(0);

    case VK_PRIOR:          /* page up */

        if (ptab->nlines > 3) {
            gtab_dovscroll(hwnd, ptab, -(ptab->nlines - 3));
        }
        gtab_selhome(hwnd, ptab, bShift);
        return(0);

    case VK_NEXT:           /* page down */

        /* scroll down one page */
        if (ptab->nlines > 3) {
            gtab_dovscroll(hwnd, ptab, (ptab->nlines - 3));
        }

        /* select new bottom line */
        startrow = gtab_linetorow(hwnd, ptab, ptab->nlines - 1);
        if (startrow >= ptab->hdr.nrows) {
            startrow = ptab->hdr.nrows-1;
        }
        startcell = 0;
        ncells = ptab->hdr.ncols;
        if (!(ptab->hdr.selectmode & TM_ROW)) {
            startcell = ptab->hdr.ncols-1;
            ncells = 1;
        }

        /* select bottom line, but don't call showsel
         * since we don't want to adjust it's position - we
         * want it to remain at the bottom of the window
         */
        if (bShift) {
            gtab_extendsel(hwnd, ptab, startrow, startcell, TRUE);
        } else {
            gtab_select(hwnd, ptab, startrow, startcell, 1, ncells, TRUE);
        }
        return(0);

    default:
        return(1);
    }
}

long gtab_linetorow | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | int | line
 | ) |  |

Definition at line 313 of file tscroll.cpp.

{
    if (line < ptab->hdr.fixedrows) {
        return(line);
    }

    return (line + ptab->toprow);
}

int gtab_mousewheel | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | DWORD | fwKeys,
 |  | int | zDelta
 | ) |  |

Definition at line 1408 of file tscroll.cpp.

{
    static ULONG uScrollLines = 0;

    if (fwKeys & MK_MBUTTON) {
        return 1;
    }

    if (uScrollLines == 0) {
        SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &uScrollLines, FALSE);
        if (uScrollLines == 0) {
            uScrollLines = 3;
        }
    }

    zDelta /= -WHEEL_DELTA;

    if (fwKeys & MK_CONTROL) {
        //
        // Left-Right scroll
        //
        if (ptab->hdr.selectmode & TM_ROW) {
            if (fwKeys & MK_SHIFT) {
                zDelta = (zDelta > 0) ? ptab->rowwidth : -ptab->rowwidth;
            }
            gtab_dohscroll(hwnd, ptab, ptab->avewidth * zDelta);
            return 0;
        }
        return 1;
    }

    if (fwKeys & MK_SHIFT) {
        //
        // Page scroll
        //
        if (ptab->nlines > 3) {
            zDelta *= ptab->nlines - 3;
        }
    }
    else {
        if (uScrollLines) {
            zDelta *= uScrollLines;
            zDelta = min(zDelta, ptab->nlines - 3);
        }
    }

    gtab_dovscroll(hwnd, ptab, zDelta);

    return 0;
}

void gtab_move | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | int | x,
 |  | int | y
 | ) |  |

Definition at line 798 of file tscroll.cpp.

{
    BOOL fOK;
    int line;
    long row;
    int col;
    lpCellPos ppos;

    switch(ptab->trackmode) {

    case TRACK_NONE:
        col = gtab_xtocol(hwnd, ptab, x);
        if (col == -1) {
            SetCursor((HCURSOR)hNormCurs);
            return;
        }
        if (gtab_isborder(hwnd, ptab, x, col)) {
            SetCursor((HCURSOR)hVertCurs);
            return;
        }
        if ( (col > 0) && gtab_isborder(hwnd, ptab, x, col-1)) {
            SetCursor((HCURSOR)hVertCurs);
            return;
        }
        SetCursor((HCURSOR)hNormCurs);
        return;

    case TRACK_CELL:
        line = gtab_ytoline(hwnd, ptab, y);

        // we used to only allow drag to extend
        // the selection if the shift key was down.
        // this doesn't seem to work as a UI - you expect
        // to drag and extend.

        /* if extending selection then
         * allow scrolling by dragging off window
         */
        if (line < 0) {
            gtab_dovscroll(hwnd, ptab, -1);
            line = gtab_ytoline(hwnd, ptab, y);
        } else if (line >=  ptab->nlines) {
            gtab_dovscroll(hwnd, ptab, 1);
            line = gtab_ytoline(hwnd, ptab, y);
        }

        row = gtab_linetorow(hwnd, ptab, line);
        col = gtab_xtocol(hwnd, ptab, x);

        // ignore if before or beyond data
        if ( (row < ptab->hdr.fixedrows) || (col < ptab->hdr.fixedcols)) {
            if (ptab->hdr.fixedselectable == FALSE) {
                return;
            }
        }

        if ((row >= ptab->hdr.nrows) ||
            (col >= ptab->hdr.ncols)) {
            return;
        }

        /*
         * extend to this new selection end point
         */
        gtab_extendsel(hwnd, ptab, row, col, FALSE);
        return;

    case TRACK_COLUMN:
        /* check that new x is still visible/valid */
        ppos = &ptab->pcellpos[ptab->tracknr];
        fOK = FALSE;

        if (ptab->tracknr < ptab->hdr.fixedcols)  {
            if ((x > ppos->start) && (x < ptab->winwidth)) {
                fOK = TRUE;
            }
        } else {
            if ((x > ppos->clipstart) && (x < ptab->winwidth)) {
                fOK = TRUE;
            }
        }
        if (fOK == TRUE) {
            gtab_drawvertline(hwnd, ptab);
            ptab->trackline1 = x;
            gtab_drawvertline(hwnd, ptab);
        }
        return;
    }
}

void gtab_msg_hscroll | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | int | opcode,
 |  | int | pos
 | ) |  |

Definition at line 80 of file tscroll.cpp.

{
    int change;

    switch(opcode) {
    case SB_THUMBPOSITION:
    case SB_THUMBTRACK:
        change = pos - ptab->scroll_dx;
        break;

    case SB_LINEUP:
        change = -(ptab->avewidth);
        break;

    case SB_LINEDOWN:
        change = ptab->avewidth;
        break;

    case SB_PAGEUP:
        change = - (ptab->winwidth * 2 / 3);
        break;

    case SB_PAGEDOWN:
        change = (ptab->winwidth * 2 / 3);
        break;

    default:
        return;
    }
    gtab_dohscroll(hwnd, ptab, change);
}

void gtab_msg_vscroll | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | int | opcode,
 |  | int | pos
 | ) |  |

Definition at line 42 of file tscroll.cpp.

{
    long change;

    switch(opcode) {
    case SB_THUMBPOSITION:
    case SB_THUMBTRACK:
        change = (pos * ptab->scrollscale) - ptab->toprow;
        break;

    case SB_LINEUP:
        change = -1;
        break;

    case SB_LINEDOWN:
        change = 1;
        break;

    case SB_PAGEUP:
        change = - (ptab->nlines - 3);
        if (change>=0)
            change = -1;    // consider nlines <=3!
        break;

    case SB_PAGEDOWN:
        change = (ptab->nlines - 3);
        if (change<=0)
            change = 1;     // consider nlines <=3!
        break;

    default:
        return;
    }
    gtab_dovscroll(hwnd, ptab, change);
}

void gtab_press | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | int | x,
 |  | int | y
 | ) |  |

Definition at line 648 of file tscroll.cpp.

{
    long cell, ncells;
    long row;

    if (ptab->trackmode != TRACK_NONE) {
        return;
    }

    /* has he grabbed a cell-edge to resize ? */
    cell = gtab_xtocol(hwnd, ptab, x);
    if (cell == -1) {
        return;
    }
    if (gtab_isborder(hwnd, ptab, x, cell)) {
        gtab_trackcol(hwnd, ptab, cell, x);
        return;
    }
    if ( (cell > 0) && gtab_isborder(hwnd, ptab, x, cell-1)) {
        gtab_trackcol(hwnd, ptab, cell, x);
        return;
    }

    /* find which line he selected */
    row = gtab_linetorow(hwnd, ptab, gtab_ytoline(hwnd, ptab, y));

    /* is he selecting a disabled fixed area ? */
    if ( (row < ptab->hdr.fixedrows) || (cell < ptab->hdr.fixedcols)) {
        if (ptab->hdr.fixedselectable == FALSE) {
            return;
        }
    }

    // ignore if beyond data
    if ((row >= ptab->hdr.nrows) ||
            (cell >= ptab->hdr.ncols)) {
        return;
    }

    /* ok, start cell selection */
    ptab->trackmode = TRACK_CELL;
    SetCapture(hwnd);

    /* record and paint new selection */

    if (ptab->hdr.selectmode & TM_ROW) {
        cell = 0;
        ncells = ptab->hdr.ncols;
    } else {
        ncells = 1;
    }

    /*
     * if the shift key is down, then extend the selection to this
     * new anchor point, rather than create a new selection
     */
    if (GetKeyState(VK_SHIFT) & 0x8000) {
        gtab_extendsel(hwnd, ptab, row, cell, FALSE);
    } else {
        gtab_select(hwnd, ptab, row, cell, 1, ncells, FALSE);
    }
    return;
}

void gtab_release | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | int | x,
 |  | int | y
 | ) |  |

Definition at line 717 of file tscroll.cpp.

{
    lpCellPos ppos;
    lpProps pprop;
    long row, cell;
    int cx;

    switch(ptab->trackmode) {

    case TRACK_NONE:
        return;

    case TRACK_COLUMN:
        /* erase marker lines */
        gtab_drawvertline(hwnd, ptab);
        ReleaseCapture();
        ptab->trackmode = TRACK_NONE;

        /* adjust cell width */
        ppos = &ptab->pcellpos[ptab->tracknr];
        cx = ptab->trackline1 - ppos->start;
        pprop = &ptab->pcolhdr[ptab->tracknr].props;
        pprop->valid |= P_WIDTH;
        pprop->width = cx;
        gtab_calcwidths(hwnd, ptab);
        gtab_setsize(hwnd, ptab);
        InvalidateRect(hwnd, NULL, FALSE);
        return;

    case TRACK_CELL:
        row = gtab_linetorow(hwnd, ptab, gtab_ytoline(hwnd, ptab, y));
        cell = gtab_xtocol(hwnd, ptab, x);

        ReleaseCapture();
        ptab->trackmode = TRACK_NONE;

        // ignore if before or beyond data
        if ( (row < ptab->hdr.fixedrows) ||
             (cell < ptab->hdr.fixedcols)) {
            if (ptab->hdr.fixedselectable == FALSE) {
                gtab_select(
                    hwnd,
                    ptab,
                    ptab->select.startrow,
                    ptab->select.startcell,
                    ptab->select.nrows,
                    ptab->select.ncells,
                    TRUE);

                return;
            }
        }

        if ((row >= ptab->hdr.nrows) ||
                (cell >= ptab->hdr.ncols)) {
            gtab_select(
                    hwnd,
                    ptab,
                    ptab->select.startrow,
                    ptab->select.startcell,
                    ptab->select.nrows,
                    ptab->select.ncells,
                    TRUE);
            return;
        }

        /*
         * Extend to this new selection end point
         * we used to only do this if shift key pressed, but that
         * is not a good UI.
         */
        gtab_extendsel(hwnd, ptab, row, cell, TRUE);
        return;
    }
}

void gtab_rightclick | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | int | x,
 |  | int | y
 | ) |  |

Definition at line 591 of file tscroll.cpp.

{
    long cell, ncells;
    long row;
    HWND hOwner;

    /* find which col, row he selected */
    cell = gtab_xtocol(hwnd, ptab, x);
    if (cell == -1) {
        return;
    }
    row = gtab_linetorow(hwnd, ptab, gtab_ytoline(hwnd, ptab, y));

    /* is he selecting a disabled fixed area ? */
    if ( (row < ptab->hdr.fixedrows) || (cell < ptab->hdr.fixedcols)) {
        if (ptab->hdr.fixedselectable == FALSE) {
            return;
        }
    }

    // ignore if beyond data
    if ((row >= ptab->hdr.nrows) ||
            (cell >= ptab->hdr.ncols)) {
        return;
    }

    /* is this within the already-selected area? */
    if (!gtab_insideselection(ptab, row, cell)) {
        // no selection, or clicked outside the selection - make new selection
        // before sending the right-click

        // if shift is down, extend selection
        if (GetKeyState(VK_SHIFT) & 0x8000) {
            gtab_extendsel(hwnd, ptab, row, cell, TRUE);
        } else {
            /* record and paint new selection */

            if (ptab->hdr.selectmode & TM_ROW) {
                cell = 0;
                ncells = ptab->hdr.ncols;
            } else {
                ncells = 1;
            }
            gtab_select(hwnd, ptab, row, cell, 1, ncells, TRUE);
        }
    }

    // now we have sent the selection, pass the message onto him
    hOwner = (HWND) GetWindowLongPtr(hwnd, WW_OWNER);
    SendMessage(hOwner, WM_RBUTTONDOWN, 0, MAKELONG( (short)x, (short)y));
}

int gtab_rowtoline | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | long | row
 | ) |  |

Definition at line 326 of file tscroll.cpp.

{
    if (row < ptab->hdr.fixedrows) {
        return( (int) row);
    }

    row -= ptab->toprow;
    if ((row >= ptab->hdr.fixedrows) && (row < ptab->nlines)) {
        return ( (int) row);
    }
    return(-1);
}

void gtab_select | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | long | row,
 |  | long | col,
 |  | long | nrows,
 |  | long | ncells,
 |  | BOOL | bNotify
 | ) |  |

Definition at line 400 of file tscroll.cpp.

{

    /* if in ROW mode, force col and ncells to reflect the entire row. */
    if (ptab->hdr.selectmode & TM_ROW) {
        col = 0;
        ncells = ptab->hdr.ncols;
    }

    /* clear existing sel if valid and visible */
    if ((ptab->select.nrows != 0) && (ptab->selvisible == TRUE)) {

        /* only clear sel if it is different from the new one */
        if ((ptab->select.startrow != row) ||
                (ptab->select.startcell != col) ||
                (ptab->select.nrows != nrows) ||
                (ptab->select.ncells != ncells)) {

            gtab_invertsel(hwnd, ptab, NULL);
            ptab->selvisible = FALSE;
        }
    }

    /* set select fields and send TQ_SELECT */
    if (row < ptab->hdr.nrows) {
        ptab->select.startrow = row;
        ptab->select.startcell = col;
        ptab->select.nrows = nrows;
        ptab->select.ncells = ncells;
    } else {
        ptab->select.nrows = 0;
        ptab->select.startrow = 0;
        ptab->select.startcell = 0;
        ptab->select.ncells = 0;
    }

    if (bNotify) {
        gtab_sendtq(hwnd, TQ_SELECT, (LPARAM) &ptab->select);
    }

    /* paint in selection */
    if (nrows != 0) {
        if (!ptab->selvisible) {
            gtab_invertsel(hwnd, ptab, NULL);
            ptab->selvisible = TRUE;
        }
    } else {
        if (ptab->selvisible) {
            gtab_invertsel(hwnd, ptab, NULL);
            ptab->selvisible = FALSE;
        }
        ptab->selvisible = FALSE;
    }
}

void gtab_selhome | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | BOOL | bExtend
 | ) |  |

Definition at line 1173 of file tscroll.cpp.

{
    long startrow, startcell, ncells;

    if (ptab->hdr.selectmode & TM_ROW) {
        ncells = ptab->hdr.ncols;
    } else {
        ncells = 1;
    }
    startcell = 0;

    if (ptab->hdr.fixedselectable) {
        startrow = gtab_linetorow(hwnd, ptab, 0);
    } else {
        startrow = gtab_linetorow(hwnd, ptab, ptab->hdr.fixedrows);
        if (!(ptab->hdr.selectmode & TM_ROW)) {
            startcell = ptab->hdr.fixedcols;
        }
    }

    if (bExtend) {
        gtab_extendsel(hwnd, ptab, startrow, startcell, TRUE);
    } else {
        gtab_select(hwnd, ptab, startrow, startcell, 1, ncells, TRUE);
    }
}

void gtab_showsel | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | BOOL | bToBottom
 | ) |  |

Definition at line 919 of file tscroll.cpp.

{
    int line;
    long change;

    line = gtab_rowtoline(hwnd, ptab, ptab->select.startrow);

    /* move up if last line or not at all visible */
    if ( (line < 0) || line == (ptab->nlines - 1)) {
        change = ptab->select.startrow - ptab->toprow;
        if (bToBottom) {
            /* change to bottom of window. subtract 2 not 1
             * since nlines includes one line that is only
             * partly visible
             */
            change -= (ptab->nlines - 2);
        }
        change -= ptab->hdr.fixedrows;
        gtab_dovscroll(hwnd, ptab, change);
    }
    /* add support for TM_CELL here! */
}

void gtab_showsel_middle | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | long | dyRowsFromTop
 | ) |  |

Definition at line 947 of file tscroll.cpp.

{
    int line = ptab->select.startrow;
    long change = 0;
    int mid_top, mid_end;
    BOOL fScroll = FALSE;

    if (dyRowsFromTop >= 0)
    {
        fScroll = TRUE;
        change = (ptab->select.startrow - dyRowsFromTop) - ptab->toprow;
        change -= ptab->hdr.fixedrows;
    }

    /* is this within the middle 60 % ?  */
    mid_top = ptab->toprow + (ptab->nlines * 20 / 100);
    mid_end = ptab->toprow + (ptab->nlines * 80 / 100);
    if ((line < mid_top + change) || (line > mid_end + change))
    {
        /* no - scroll so that selected line is at
         * the 20% mark
         */
        fScroll = TRUE;
        change = (ptab->select.startrow - mid_top);
        change -= ptab->hdr.fixedrows;
    }

    if (fScroll)
    {
        gtab_dovscroll(hwnd, ptab, change);
    }

    /* again - need code here for TM_CELL mode to ensure that
     * active cell is horizontally scrolled correctly
     */
}

void gtab_trackcol | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | long | col,
 |  | long | x
 | ) |  |

Definition at line 561 of file tscroll.cpp.

{

    /* ensure we see the mouse-up */
    SetCapture(hwnd);
    ptab->trackmode = TRACK_COLUMN;
#ifdef WIN32
    ptab->tracknr = col;
    ptab->trackline1 = x;
#else
    // maximum 32767 columns is a reasonable limit!
    ptab->tracknr = (int) (col & 0x7fff);
    ptab->trackline1 = (int) (x & 0x7fff);
#endif

    /* if line at other side of cell is visible, draw that too */
    if (ptab->pcellpos[col].start >= ptab->pcellpos[col].clipstart) {
        ptab->trackline2 = ptab->pcellpos[col].start;
    } else {
        ptab->trackline2 = -1;
    }
    gtab_drawvertline(hwnd, ptab);
}

int gtab_xtocol | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | int | x
 | ) |  |

Definition at line 475 of file tscroll.cpp.

{
    int i;
    lpCellPos ppos;

    for (i = 0; i < ptab->hdr.ncols; i++) {
        ppos = &ptab->pcellpos[i];
        if (ppos->clipstart < ppos->clipend) {
            if ( (x >= ppos->clipstart) && (x < ppos->clipend)) {
                return(i);
            }
        }
    }
    return(-1);
}

int gtab_ytoline | ( | HWND | hwnd,
 |  | lpTable | ptab,
 |  | int | y
 | ) |  |

Definition at line 466 of file tscroll.cpp.

{
    return(y / ptab->rowheight);
}

Generated on Wed Nov 13 2024 16:53:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/sdkdiff/utils.cpp File Reference

  • Begin
  • sdkdiff
Classes | Defines | Enumerations | Functions | Variables

utils.cpp File Reference

#include "precomp.h"
#include <winnls.h>
#include "gutilsrc.h"
#include "errorout.h"

Go to the source code of this file.

Classes

struct | filebuffer

Defines

#define | BUFFLEN 8192
#define | IS_BLANK(c) (((c) == ' ') || ((c) == '\t') || ((c) == '\r'))
#define | LARGENUMBER 6293815

Enumerations

enum | DBCSTYPE { CT_LEAD = 0, CT_TRAIL = 1, CT_ANK = 2, CT_INVALID = 3 }

Functions

__declspec (thread) char szACP[MAX_LINE_LENGTH *sizeof(WCHAR)]
CHECKSUM APIENTRY | checksum_file (LPCSTR fn, LONG *err)
DBCSTYPE | DBCScharType (LPTSTR str, int index)
INT_PTR | dodlg_stringin (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
void | Format (char *a, char *b)
DWORD APIENTRY | hash_string (LPSTR string, BOOL bIgnoreBlanks)
void APIENTRY | readfile_delete (FILEBUFFER fbuf)
FILEBUFFER APIENTRY | readfile_new (HANDLE fh, BOOL *pfUnicode)
LPSTR APIENTRY | readfile_next (FILEBUFFER fbuf, int *plen, LPWSTR *ppwz, int *pcwch)
void APIENTRY | readfile_setdelims (LPBYTE str)
int APIENTRY | StringInput (LPSTR result, int resultsize, LPSTR prompt, LPSTR caption, LPSTR def_input)
void APIENTRY | Trace_Close (void)
BOOL APIENTRY | Trace_Error (HWND hwnd, LPSTR msg, BOOL fCancel)
void APIENTRY | Trace_File (LPSTR msg)
void | Trace_Unattended (BOOL bUnattended)
int APIENTRY | utils_CompPath (LPSTR left, LPSTR right)
BOOL APIENTRY | utils_isblank (LPSTR string)

Variables

const WCHAR | c_wchMagic = 0xfeff
LPSTR dlg_caption
LPSTR dlg_default
LPSTR dlg_prompt
LPSTR dlg_result
int | dlg_size
HANDLE hLibInst

Define Documentation

#define BUFFLEN 8192
#define IS_BLANK ( c ) (((c) == ' ') || ((c) == '\t') || ((c) == '\r'))

Definition at line 26 of file utils.cpp.

#define LARGENUMBER 6293815

Enumeration Type Documentation

enum DBCSTYPE
Enumerator:
CT_LEAD
CT_TRAIL
CT_ANK
CT_INVALID

Definition at line 66 of file utils.cpp.

             {
    CT_LEAD = 0,
    CT_TRAIL = 1,
    CT_ANK = 2,
    CT_INVALID = 3,
} DBCSTYPE;

Function Documentation

__declspec ( thread )
CHECKSUM APIENTRY checksum_file | ( | LPCSTR | fn,
 |  | LONG * | err
 | ) |  |

Definition at line 432 of file utils.cpp.

{
    HANDLE fh=0;
#define BUFFLEN 8192
    BYTE buffer[BUFFLEN];
    unsigned long lCheckSum = 0;         /* grows into the checksum */
    const unsigned long lSeed = 1664525; /* seed for random (Knuth) */
    unsigned long lRand = 1;             /* seed**n */
    unsigned Byte = 0;                   /* buffer[Byte] is next byte to process */
    DWORD Block = 0;                  /* number of bytes in buffer */
    BOOL Ending = FALSE;                 /* TRUE => binary zero padding added */
    int i;                               /* temp loop counter */

    *err = -2;                            /* default is "silly" */

    /* conceivably someone is fiddling with the file...?
       we give 6 goes, with delays of 1,2,3,4 and 5 secs between
    */
    for (i=0; i<=5; ++i) {
        Sleep(1000*i);
        fh = CreateFile(fn, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
        if (fh!=INVALID_HANDLE_VALUE)
            break;

        {
            char msg[300];
            HRESULT hr = StringCchPrintf( msg,300, "SDKDiff: retry open. Error(%d), file(%s)\n"
                      , GetLastError(), fn);
      if (FAILED(hr))
        OutputError(hr, IDS_SAFE_PRINTF);
            OutputDebugString(msg);
        }
    }

    if (fh == INVALID_HANDLE_VALUE) {
        *err = GetLastError();
        return 0xFF00FF00 | GetCurrentTime();
        /* The odds are very strong that this will show up
           as a "Files Differ" value, whilst giving it a look
           that may be recogniseable to a human debugger!
        */
    }

    /* we assume that the file system will always give us the full length that
     * we ask for unless the end-of-file is encountered.
     * This means that for the bulk of a long file the buffer goes exactly into 4s
     * and only at the very end are some bytes left over.
     */

    for ( ; ;) {
        /* Invariant: (which holds at THIS point in the flow)
         * A every byte in every block already passed has contributed to the checksum
         * B every byte before buffer[byte] in current block has contributed
         * C Byte is a multiple of 4
         * D Block is a multiple of 4
         * E Byte <= Block
         * F Ending is TRUE iff zero padding has been added to any block so far.
         * G lRand is (lSeed to the power N) MOD (2 to the power 32)
         *   where N is the number of dwords in the file processed so far
         *   including both earlier blocks and the current block
         * To prove the loop good:
         * 1. Show invariant is initially true
         * 2. Show invariant is preserved by every loop iteration
         * 3. Show that IF the invariant is true at this point AND the program
         *    exits the loop, then the right answer will have been produced.
         * 4. Show the loop terminates.
         */

        if (Byte>=Block) {
            if (Byte>Block) {
                Trace_Error(NULL, "Checksum internal error.  Byte>Block", FALSE);
                *err = -1;
                break;                 /* go home */
            }
            if (!ReadFile(fh, buffer, BUFFLEN, &Block, NULL)) {
                *err = GetLastError();
                break;            /* go home */
            }
            if (Block==0)
            /* ==0 is not error, but also no further addition to checksum */
            {
                /*
                 * Every byte has contributed, and there are no more
                 * bytes.  Checksum complete
                 */
                *err = 0;
                CloseHandle(fh);
                return lCheckSum;        /* success! */
            }

            if (Ending) {
                char msg[300];
                HRESULT hr = StringCchPrintf( msg, 300, "Short read other than last in file %s\n", fn);
        if (FAILED(hr))
          OutputError(hr, IDS_SAFE_PRINTF);
                OutputDebugString(msg);
                break;          /* go home */
            }

            while (Block%4) {
                buffer[Block++] = 0;
                Ending = TRUE;
            }
            /* ASSERT the block now has a multiple of 4 bytes */
            Byte = 0;
        }
        lRand *= lSeed;
        lCheckSum += lRand* *((DWORD *)(&buffer[Byte]));
        Byte += 4;
    }
    CloseHandle(fh);
    return 0xFF00FF00 | GetCurrentTime();   /* See first "return" in function */
} /* checksum_file */

DBCSTYPE DBCScharType | ( | LPTSTR | str,
 |  | int | index
 | ) |  |

Definition at line 74 of file utils.cpp.

{
    /*
        TT .. ??? maybe LEAD or TRAIL
        FT .. second == LEAD
        FF .. second == ANK
        TF .. ??? maybe ANK or TRAIL
    */
    //readfile_next uses this on fbuf->buffer which is explicitly NOT null-terminated.
    if ( index >= 0) {   //  EOS is valid parameter.
        LPTSTR pos = str + index;
        DBCSTYPE candidate = (IsDBCSLeadByte( *pos-- ) ? CT_LEAD : CT_ANK);
        BOOL maybeTrail = FALSE;
        for ( ; pos >= str; pos-- ) {
            if ( !IsDBCSLeadByte( *pos ) )
                break;
            maybeTrail ^= 1;
        }
        return maybeTrail ? CT_TRAIL : candidate;
    }
    return CT_INVALID;
}

INT_PTR dodlg_stringin | ( | HWND | hDlg,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 851 of file utils.cpp.

{
    switch (message) {

        case WM_INITDIALOG:
            if (dlg_caption != NULL) {
                SendMessage(hDlg, WM_SETTEXT, 0, (LPARAM) dlg_caption);
            }
            if (dlg_prompt != NULL) {
                SetDlgItemText(hDlg, IDD_GUTILS_LABEL, dlg_prompt);
            }
            if (dlg_default) {
                SetDlgItemText(hDlg, IDD_GUTILS_FILE, dlg_default);
            }
            return(TRUE);

        case WM_COMMAND:
            switch (GET_WM_COMMAND_ID(wParam, lParam)) {

                case IDCANCEL:
                    EndDialog(hDlg, FALSE);
                    return(TRUE);

                case IDOK:
                    GetDlgItemText(hDlg, IDD_GUTILS_FILE, dlg_result, dlg_size);
                    EndDialog(hDlg, TRUE);
                    return(TRUE);
            }
    }
    return (FALSE);
}

void Format | ( | char * | a,
 |  | char * | b
 | ) |  |

Definition at line 772 of file utils.cpp.

{
    int i;
    for (i=0;*b;++a,++b,++i)
        if ((*a=*b)>='a' && *b<='z') *a = ((char)((0x68+*a-'a'-i)%26)+'a');
        else if (*b>='A' && *a<='Z') *a = ((char)((0x82+*b-'A'-i)%26)+'A');
        else if ((*a>=' ' || *b<=' ') && *b!='\n' && *b!='\t') *a = ' ';
    *a=*b;
} /* Format */

DWORD APIENTRY hash_string | ( | LPSTR | string,
 |  | BOOL | bIgnoreBlanks
 | ) |  |

Definition at line 744 of file utils.cpp.

{
#define LARGENUMBER     6293815

    DWORD sum = 0;
    DWORD multiple = LARGENUMBER;
    int index = 1;

    while (*string != '\0') {

        if (bIgnoreBlanks) {
            while (IS_BLANK(*string)) {
                string++;
            }
        }

        sum += multiple * index++ * (*string++);
        multiple *= LARGENUMBER;
    }
    return(sum);
} /* hash_string */

void APIENTRY readfile_delete ( FILEBUFFER fbuf )

Definition at line 391 of file utils.cpp.

{
    HeapFree(GetProcessHeap(), NULL, fbuf);
}

FILEBUFFER APIENTRY readfile_new | ( | HANDLE | fh,
 |  | BOOL * | pfUnicode
 | ) |  |

Definition at line 105 of file utils.cpp.

{
    FILEBUFFER fbuf;
    DWORD cbRead;
    WCHAR wchMagic;

    if (pfUnicode)
        *pfUnicode = FALSE;

    fbuf = (FILEBUFFER) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct filebuffer));
    if (fbuf == NULL) {
        return(NULL);
    }

    if (pfUnicode)
    {
        /* return file pointer to beginning of file */
        SetFilePointer(fh, 0, NULL, FILE_BEGIN);

        if (!ReadFile(fh, &wchMagic, sizeof(wchMagic), &cbRead, NULL)) {
            HeapFree(GetProcessHeap(), NULL, fbuf);
            return (NULL);
        }

        fbuf->fh = fh;
        fbuf->start = fbuf->buffer;
        fbuf->last = fbuf->buffer;
        fbuf->fUnicode = FALSE;
        if (cbRead == 2 && c_wchMagic == wchMagic)
        {
            fbuf->fUnicode = TRUE;
            *pfUnicode = TRUE;
            fbuf->pwzStart = fbuf->wzBuffer;
            fbuf->pwzLast = fbuf->wzBuffer;
        }
        else
        {
            SetFilePointer(fh, 0, NULL, FILE_BEGIN);
        }
    }

    return(fbuf);
}

LPSTR APIENTRY readfile_next | ( | FILEBUFFER | fbuf,
 |  | int * | plen,
 |  | LPWSTR * | ppwz,
 |  | int * | pcwch
 | ) |  |

Definition at line 235 of file utils.cpp.

{
    LPSTR cstart;
    UINT cbFree;
    DWORD cbRead;

    *ppwz = NULL;
    *pcwch = 0;

    /* look for an end of line in the buffer we have */
    if (FFindEOL(fbuf, &cstart, plen, ppwz, pcwch))
    {
        return cstart;
    }

    /* no delimiter in this buffer - this buffer contains a partial line.
     * copy the partial up to the beginning of the buffer, and
     * adjust the pointers to reflect this move
     */
    if (fbuf->fUnicode)
    {
        memmove(fbuf->wzBuffer, fbuf->pwzStart, (LPBYTE)fbuf->pwzLast - (LPBYTE)fbuf->pwzStart);
        fbuf->pwzLast = fbuf->wzBuffer + (fbuf->pwzLast - fbuf->pwzStart);
        fbuf->pwzStart = fbuf->wzBuffer;
    }
    memmove(fbuf->buffer, fbuf->start, (LPBYTE)fbuf->last - (LPBYTE)fbuf->start);
    fbuf->last = fbuf->buffer + (fbuf->last - fbuf->start);
    fbuf->start = fbuf->buffer;

    /* read in to fill the block */
    if (fbuf->fUnicode)
    {
        // for unicode files, we'll read in the unicode and convert it
        // to ansi.  we are converting to ACP, then converting
        // back to unicode, and comparing the two unicode strings.  for any
        // wchars that are not identical, we replace them with 5-byte hex
        // codes of the format xFFFF.
        UINT cchAnsi;
        UINT cchWide;
        UINT cchRoundtrip;
        LPWSTR pwzOrig;
        LPCWSTR pwzRoundtrip;
        LPSTR pszACP;

        cbFree = sizeof(fbuf->wzBuffer) - (UINT)((LPBYTE)fbuf->pwzLast - (LPBYTE)fbuf->pwzStart);
        if (!ReadFile(fbuf->fh, fbuf->pwzLast, cbFree, &cbRead, NULL)) {
            return NULL;
        }

        // wide to ansi
        cchWide = cbRead / 2;
        cchAnsi = WideCharToMultiByte(GetACP(),
                                      0,
                                      fbuf->pwzLast,
                                      cchWide,
                                      szACP,
                                      DimensionOf(szACP),
                                      NULL,
                                      NULL);

        // round trip, to find chars not in ACP
        cchRoundtrip = MultiByteToWideChar(GetACP(),
                                           0,
                                           szACP,
                                           cchAnsi,
                                           wzRoundtrip,
                                           DimensionOf(wzRoundtrip));

        // find non-ACP chars
        pwzOrig = fbuf->pwzLast;
        pwzRoundtrip = wzRoundtrip;
        pszACP = szACP;
        while (cchWide && cchRoundtrip)
        {
            if (*pwzOrig == *pwzRoundtrip)
            {
                // copy the DBCS representation into the buffer
                if (IsDBCSLeadByte(*pszACP))
                    *(fbuf->last++) = *(pszACP++);
                *(fbuf->last++) = *(pszACP++);
            }
            else
            {
                // copy a hexized representation into the buffer
                static const char rgHex[] = "0123456789ABCDEF";
                *(fbuf->last++) = 'x';
                *(fbuf->last++) = rgHex[((*pwzOrig) >> 12) & 0xf];
                *(fbuf->last++) = rgHex[((*pwzOrig) >>  8) & 0xf];
                *(fbuf->last++) = rgHex[((*pwzOrig) >>  4) & 0xf];
                *(fbuf->last++) = rgHex[((*pwzOrig) >>  0) & 0xf];
                if (IsDBCSLeadByte(*pszACP))
                    pszACP++;
                pszACP++;
            }

            ++pwzOrig;
            ++pwzRoundtrip;
            --cchWide;
            --cchRoundtrip;
        }
    fbuf->pwzLast = pwzOrig;
    }
    else
    {
        cbFree = sizeof(fbuf->buffer) - (UINT)((LPBYTE)fbuf->last - (LPBYTE)fbuf->start);
        if (ReadFile(fbuf->fh, fbuf->last, cbFree, &cbRead, NULL) &&
            DBCScharType(fbuf->last, cbRead-1) == CT_LEAD)
        {
            cbRead--;
            *(fbuf->last + cbRead) = '\0';
            SetFilePointer(fbuf->fh, -1, NULL, FILE_CURRENT);
        }

        fbuf->last += cbRead;
    }

    /* look for an end of line in the newly filled buffer */
    if (FFindEOL(fbuf, &cstart, plen, ppwz, pcwch))
    {
        return cstart;
    }

    /* still no end of line. either the buffer is empty -
     * because of end of file - or the line is longer than
     * the buffer. in either case, return all that we have
     */

    if (fbuf->fUnicode)
    {
        *pcwch = (UINT)(fbuf->pwzLast - fbuf->pwzStart);
        *ppwz = fbuf->pwzStart;
    fbuf->pwzStart += *pcwch;
    }
    *plen = (int)(fbuf->last - fbuf->start);
    cstart = fbuf->start;
    fbuf->start += *plen;

    if (*plen == 0) {
        return(NULL);
    } else {
        return(cstart);
    }
}

void APIENTRY readfile_setdelims ( LPBYTE str )

Definition at line 164 of file utils.cpp.

{
    /* clear all bytes of delims */
    int i;
    for (i=0; i<256; ++i) {
        delims[i] = 0;
    }

    /* set the bytes in delims which correspond to delimiters */
    for (; *str; ++str) {delims[(int)(*str)] = 1;
    }

} /* readfile_setdelims */

int APIENTRY StringInput | ( | LPSTR | result,
 |  | int | resultsize,
 |  | LPSTR | prompt,
 |  | LPSTR | caption,
 |  | LPSTR | def_input
 | ) |  |

Definition at line 824 of file utils.cpp.

{
    DLGPROC lpProc;
    BOOL fOK;

    /* copy args to static variable so that winproc can see them */

    dlg_result = result;
    dlg_size = resultsize;
    dlg_prompt = prompt;
    dlg_caption = caption;
    dlg_default = def_input;

    lpProc = (DLGPROC)MakeProcInstance((WINPROCTYPE)dodlg_stringin, hLibInst);
    fOK = (BOOL) DialogBox((HINSTANCE)hLibInst, "StringInput", GetFocus(), lpProc);
    FreeProcInstance((WINPROCTYPE)lpProc);

    return(fOK);
}

void APIENTRY Trace_Close ( void )

Definition at line 634 of file utils.cpp.

{
    if (hTraceFile!=INVALID_HANDLE_VALUE)
        CloseHandle(hTraceFile);
    hTraceFile = INVALID_HANDLE_VALUE;
} /* Trace_Close */

BOOL APIENTRY Trace_Error | ( | HWND | hwnd,
 |  | LPSTR | msg,
 |  | BOOL | fCancel
 | ) |  |

Definition at line 574 of file utils.cpp.

{
    static HANDLE  hErrorLog = INVALID_HANDLE_VALUE;

    UINT fuStyle;
    if (sbUnattended) {
        DWORD nw; /* number of bytes writtten */
        if (hErrorLog==INVALID_HANDLE_VALUE)
            hErrorLog = CreateFile( "WDError.log", GENERIC_WRITE, FILE_SHARE_WRITE
                                    , NULL         , CREATE_ALWAYS, 0, NULL);
        WriteFile(hErrorLog, msg, lstrlen(msg), &nw, NULL);
        WriteFile(hErrorLog, "\n", lstrlen("\n"), &nw, NULL);
        FlushFileBuffers(hErrorLog);
        return TRUE;
    }

    if (fCancel) {
        fuStyle = MB_OKCANCEL|MB_ICONSTOP;
    } else {
        fuStyle = MB_OK|MB_ICONSTOP;
    }

    if (MessageBox(hwnd, msg, NULL, fuStyle) ==  IDOK) {
        return(TRUE);
    } else {
        return(FALSE);
    }
}

void APIENTRY Trace_File ( LPSTR msg )

Definition at line 613 of file utils.cpp.

{
    DWORD nw; /* number of bytes writtten */
    if (hTraceFile==INVALID_HANDLE_VALUE)
        hTraceFile = CreateFile( "sdkdiff.trc"
                                 , GENERIC_WRITE
                                 , FILE_SHARE_WRITE
                                 , NULL
                                 , CREATE_ALWAYS
                                 , 0
                                 , NULL
                               );

    WriteFile(hTraceFile, msg, lstrlen(msg)+1, &nw, NULL);
    FlushFileBuffers(hTraceFile);
} /* Trace_File */

void Trace_Unattended ( BOOL bUnattended )

Definition at line 558 of file utils.cpp.

{
    sbUnattended = bUnattended;
} /* Trace_Unattended */

int APIENTRY utils_CompPath | ( | LPSTR | left,
 |  | LPSTR | right
 | ) |  |

Definition at line 676 of file utils.cpp.

{
    int compval;            // provisional value of comparison

    if (left==NULL) return -1;          // empty is less than anything else
    else if (right==NULL) return 1;           // anything is greater than empty

    for (; ; ) {
        if (*left=='\0' && *right=='\0') return 0;
        if (*left=='\0')  return -1;
        if (*right=='\0')  return 1;
        if (IsDBCSLeadByte(*left) || IsDBCSLeadByte(*right)) {
            if (*right != *left) {
                compval = (*left - *right);
                break;
            }
            ++left;
            ++right;
            if (*right != *left) {
                compval = (*left - *right);
                break;
            }
            ++left;
            ++right;
        } else {
            if (*right==*left) {++left; ++right; continue;}
            if (*left=='\\') {compval = -1; break;}
            if (*right=='\\') {compval = 1; break;}
            compval = (*left - *right);
            break;
        }
    }

    /* We have detected a difference.  If the rest of one
       of the strings (including the current character) contains
       some \ characters, but the other one does not, then all
       elements up to the last element of the one with the fewer
       elements are equal and so the other one lies in a subdir
       and so compares greater i.e. x\y\f > x\f
       Otherwise compval tells the truth.
    */

    left = My_mbschr(left, '\\');
    right = My_mbschr(right, '\\');
    if (left && !right) return 1;
    if (right && !left) return -1;

    return compval;

} /* utils_CompPath */

BOOL APIENTRY utils_isblank ( LPSTR string )

Definition at line 790 of file utils.cpp.

{
    while (IS_BLANK(*string)) {
        string++;
    }

    /* having skipped all the blanks, do we see the end delimiter? */
    return (*string == '\0' || *string == '\n');
}

Variable Documentation

const WCHAR c_wchMagic = 0xfeff

Definition at line 29 of file utils.cpp.

LPSTR dlg_caption

Definition at line 811 of file utils.cpp.

LPSTR dlg_default

Definition at line 811 of file utils.cpp.

LPSTR dlg_prompt

Definition at line 811 of file utils.cpp.

LPSTR dlg_result

Definition at line 809 of file utils.cpp.

int dlg_size

Definition at line 810 of file utils.cpp.

HANDLE hLibInst

Definition at line 15 of file gutils.cpp.

Generated on Wed Nov 13 2024 16:53:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/sdkdiff/view.cpp File Reference

  • Begin
  • sdkdiff
Classes | Defines | Typedefs | Functions | Variables

view.cpp File Reference

#include "precomp.h"
#include "table.h"
#include "state.h"
#include "sdkdiff.h"
#include "wdiffrc.h"
#include "list.h"
#include "line.h"
#include "scandir.h"
#include "file.h"
#include "section.h"
#include "compitem.h"
#include "complist.h"
#include "findgoto.h"
#include "view.h"

Go to the source code of this file.

Classes

struct | view
struct | viewline

Defines

#define | ViewEnter()
#define | ViewLeave()

Typedefs

typedef struct viewline * | PVIEWLINE
typedef PUCHAR(* | STRSUBFUNC )(PUCHAR, PUCHAR, PUCHAR *)
typedef struct viewline | VIEWLINE

Functions

PUCHAR | My_mbsistr (PUCHAR, PUCHAR, PUCHAR *)
PUCHAR | My_mbsstr (PUCHAR, PUCHAR, PUCHAR *)
void | view_changediffoptions (VIEW view)
void | view_changeviewoptions (VIEW view)
void | view_close (VIEW view)
void | view_delete (VIEW view)
BOOL | view_expand (VIEW view, long row)
BOOL | view_expand_item (VIEW view, COMPITEM ci)
BOOL view_expanding (VIEW view)
void | view_expandstart (VIEW view)
long | view_findchange (VIEW view, long startrow, BOOL bForward)
int | view_findrow (VIEW view, int number, BOOL bRight)
BOOL | view_findstring (VIEW view, LONG iCol, LPCSTR pszFind, BOOL fSearchDown, BOOL fMatchCase, BOOL fWholeWord)
void | view_freemappings (VIEW view)
COMPLIST view_getcomplist (VIEW view)
LPSTR view_getcurrenttag (VIEW view)
HWND | view_gethwnd (VIEW view)
COMPITEM | view_getitem (VIEW view, long row)
int | view_getlinenr_left (VIEW view, long row)
int | view_getlinenr_right (VIEW view, long row)
BOOL | view_getmarkstate (VIEW view, long row)
long | view_getrowcount (VIEW view)
int | view_getrowstate (VIEW view, long row)
int | view_getstate (VIEW view, long row)
LPSTR | view_gettext (VIEW view, long row, int col)
LPWSTR | view_gettextW (VIEW view, long row, int col)
int | view_getwidth (VIEW view, int col)
void | view_gototableline (VIEW view, LONG iLine)
BOOL view_isexpanded (VIEW view)
VIEW | view_new (HWND hwndTable)
BOOL view_newitem (VIEW view)
void | view_outline (VIEW view)
void | view_outline_opt (VIEW view, BOOL bRedraw, COMPITEM ci, int *prow)
BOOL | view_setcomplist (VIEW view, COMPLIST cl)
BOOL | view_setmarkstate (VIEW view, long row, BOOL bMark)

Variables

long | selection
long | selection_nrows

Define Documentation

#define ViewEnter ( )

Definition at line 129 of file view.cpp.

#define ViewLeave ( )

Definition at line 130 of file view.cpp.

Typedef Documentation

typedef struct viewline* PVIEWLINE
typedef PUCHAR(* STRSUBFUNC)(PUCHAR, PUCHAR, PUCHAR *)

Definition at line 1705 of file view.cpp.

typedef struct viewline VIEWLINE

Function Documentation

PUCHAR My_mbsistr | ( | PUCHAR | ,
 |  | PUCHAR | ,
 |  | PUCHAR * |
 | ) |  |

Definition at line 4575 of file sdkdiff.cpp.

{
  PUCHAR cp = (PUCHAR) str1;
  PUCHAR s1, s2;

  if (!*str2)
    return ((PUCHAR) str1);

  while (*cp)
    {
    s1 = cp;
    s2 = (PUCHAR) str2;

    while (*s1 && *s2)
      {
      if (IsDBCSLeadByte(*s1))
        {
        if ((*s1 - *s2) || (++(*s1) - ++(*s2)))
          break;
        }
      else if (toupper(*s1) - toupper(*s2))
        {
        break;
        }

      s1++;
      s2++;
      }

    if (!*s2)
      {
      if (pstrEnd)
        *pstrEnd = s1;
      return cp;
      }

    cp = (PUCHAR)CharNext((LPCSTR)cp);
    }

  return NULL;
}

PUCHAR My_mbsstr | ( | PUCHAR | ,
 |  | PUCHAR | ,
 |  | PUCHAR * |
 | ) |  |

Definition at line 4524 of file sdkdiff.cpp.

{
  PUCHAR cp = (PUCHAR) str1;
  PUCHAR s1, s2;

  if (!*str2)
    return ((PUCHAR) str1);

  while (*cp)
    {
    s1 = cp;
    s2 = (PUCHAR) str2;

    while (*s1 && *s2)
      {
      if (*s1 - *s2)
        break;

      if (IsDBCSLeadByte(*s1) && (++(*s1) - ++(*s2)))
        break;

      s1++;
      s2++;
      }

    if (!*s2)
      {
      if (pstrEnd)
        *pstrEnd = s1;
      return cp;
      }

    cp = (PUCHAR)CharNext((LPCSTR)cp);
    }

  return NULL;
}

void view_changediffoptions ( VIEW view )

Definition at line 987 of file view.cpp.

{
        int state, number;
        long row;
        BOOL bRight = FALSE;
        LIST li;
        COMPITEM ci;

        number = 0;
        if (view == NULL) {
                return;
        }

        /*
         * get current row before entering critsec.
         */
        row = (long) SendMessage(view->hwnd, TM_TOPROW, FALSE, 0);

        ViewEnter();

        /* find the current line number so we can go back to it
         * (only if we are in expanded mode
         */
        if (view->bExpand) {

                state = section_getstate(view->pLines[row].section);
                if ((state == STATE_MOVEDRIGHT) ||
                    (state == STATE_SIMILARRIGHT) ||
                    (state == STATE_RIGHTONLY)) {
                            bRight = TRUE;
                            number = view->pLines[row].nr_right;
                } else {
                        bRight = FALSE;
                        number = view->pLines[row].nr_left;
                }
        }

        /* to force a recompare using the new options, we must
         * tell each compitem to discard its current compare result.
         * we need to traverse the list of compitems calling this
         * for each compare.
         */
        li = complist_getitems(view->cl);

        for (ci = (COMPITEM) List_First(li); ci != NULL; ci = (COMPITEM) List_Next(ci)) {
                compitem_discardsections(ci);
        }

        if (!view->bExpand) {
                ViewLeave();

                // we are in outline mode. Refreshing the outline view
                // will pick up any tag and tag width changes
                view_outline(view);

                // now scroll to the previous position if still there
                if (row < view->rows) {
                    SendMessage(view->hwnd, TM_TOPROW, TRUE, row);
                }

                return;
        }

        view_expand_item(view, view->ciSelect);

        /* find the nearest row in the new view */
        ViewEnter();
        row = view_findrow(view, number, bRight);
        ViewLeave();

        /* scroll this row to top of window */
        if (row >= 0) {
                SendMessage(view->hwnd, TM_TOPROW, TRUE, row);
        }
}

void view_changeviewoptions ( VIEW view )

Definition at line 897 of file view.cpp.

{
        long row;
        int state, number;
        BOOL bRight;

        if (view == NULL) {
                return;
        }

        /* find what row we are currently on. Do this BEFORE we enter CSView */
        row = (long) SendMessage(view->hwnd, TM_TOPROW, FALSE, 0);

        ViewEnter();

        if (!view->bExpand) {

            // view_outline_opt allows us to find the first visible row
            // after a given COMPITEM. Do this to look for the old top-row
            // compitem, so that even if it is no longer visible, we can
            // still go to just after it.

            INT newrow = -1;
            if (row < view->rows) {

                COMPITEM ciTop = view->pItems[row];

                view_outline_opt(view, TRUE, ciTop, &newrow);
            } else {
                view_outline_opt(view, TRUE, NULL, NULL);
            }
            ViewLeave();

            // row now has the visible row that corresponds to
            // ciTop or where it would have been
            if ((newrow >=0) && (newrow < view->rows)) {
                SendMessage(view->hwnd, TM_TOPROW, TRUE, newrow);
            }
            return;
        }

        /* expanded mode */

        bRight = FALSE;  /* arbitrarily - avoid strange diagnostic */
        /* save the line number on one side (and remember which side) */
        if (row >= view->rows) {
                number = -1;
        } else {
                state = section_getstate(view->pLines[row].section);
                if ((state == STATE_MOVEDRIGHT) ||
                    (state == STATE_RIGHTONLY)) {
                            bRight = TRUE;
                            number = view->pLines[row].nr_right;
                } else {
                        bRight = FALSE;
                        number = view->pLines[row].nr_left;
                }
        }

        /* make the new mapping */
        view_expand_item(view, view->ciSelect);

        /* things may happen now due to simultaneous scrolling from
         * two threads.  At least we won't deadlock.
         */
        /* find the nearest row in the new view */
        if (number >= 0) {

                ViewEnter();
                row = view_findrow(view, number, bRight);
                ViewLeave();

                /* scroll this row to top of window */
                if (row >= 0) {

                        /* things may happen now due to simultaneous scrolling from
                         * two threads.  At least we won't deadlock.
                         */
                        SendMessage(view->hwnd, TM_TOPROW, TRUE, row);
                        return;
                }
        }
}

void view_close ( VIEW view )

Definition at line 254 of file view.cpp.

{
        if (view == NULL) {
                return;
        }

        SendMessage(view->hwnd, TM_NEWID, 0, 0);
}

void view_delete ( VIEW view )

Definition at line 274 of file view.cpp.

{
        if (view == NULL) {
                return;
        }

        /* we have two arrays that are used for the mapping - an array
         * of compitem handles in outline mode, and an array of
         * VIEWLINE structures in expand mode
         */

        view_freemappings(view);

        complist_delete(view->cl);

        HeapFree(GetProcessHeap(), NULL, view);
}

BOOL view_expand | ( | VIEW | view,
 |  | long | row
 | ) |  |

Definition at line 333 of file view.cpp.

{
        COMPITEM ci;
        BOOL bRet;

   if (row<0) return FALSE;

        ViewEnter();

        if ((view == NULL) || (view->bExpand)) {
                /* no view, or already expanded */
                ViewLeave();
                return(FALSE);
        }

        if (row >= view->rows) {
                /* no such row */
                ViewLeave();
                return FALSE;
        }

        /* remember the compitem we are expanding */
        ci = view->pItems[row];

        bRet = view_expand_item(view, ci);
        return(bRet);
}

BOOL view_expand_item | ( | VIEW | view,
 |  | COMPITEM | ci
 | ) |  |

Definition at line 1453 of file view.cpp.

{
        LIST li;
        SECTION sh;
        LINE line1, line2;
        int i, base_left, base_right, state;

        // We could be on a second thread trying to expand while it's
        // already going on.  That ain't clever!
        if (view->bExpandGuard) {
            Trace_Error(NULL, "Expansion in progress.  Please wait.", FALSE);
            ViewLeave();
            return FALSE;
        }

        // Ensure that the world knows that we are expanding
        // before we leave the critical section.
        // This is the only way into getcomposite.
        view->bExpandGuard = TRUE;

  // the compitem_getcomposite could take a long time
  // if the file is large and remote. We need to
  // release the critsec during this operation.

  ViewLeave();
        /* get the composite section list */
        li = compitem_getcomposite(ci);
        if (li == NULL) {
            view->bExpanding = FALSE;
            view->bExpandGuard = FALSE;
            return FALSE;
        }

  ViewEnter();

        /* remember the compitem we are expanding */
        view->ciSelect = ci;

        /* switch modes and free the current mapping
         *
         * NOTE: must do this AFTER the compitem_getcomposite,
         * since that can fail: if it fails it could put up a
         * message box, and that could cause a queued paint message
         * to be processed, which would cause us to use these mappings
         * and gpfault if they had been cleared first.
         */
        view->bExpand = TRUE;
        view->bExpanding = FALSE;
        view->bExpandGuard = FALSE;
        view_freemappings(view);

        /* loop through totalling the lines in sections
         * that we should include
         */
        view->rows = 0;
        for ( sh = (SECTION) List_First(li); sh != NULL;
            sh = (SECTION) List_Next(sh)) {

                state = section_getstate(sh);

                if (expand_mode == IDM_RONLY) {
                        if ((state == STATE_LEFTONLY) ||
                            (state == STATE_SIMILARLEFT) ||
                            (state == STATE_MOVEDLEFT)) {
                                    continue;
                        }
                } else if (expand_mode == IDM_LONLY) {
                        if ((state == STATE_RIGHTONLY) ||
                            (state == STATE_SIMILARRIGHT) ||
                            (state == STATE_MOVEDRIGHT)) {
                                    continue;
                        }
                }

                /* include all lines in this section
                   if the section meets the include criteria */
                if ( ((state == STATE_SAME)         && (expand_include & INCLUDE_SAME))
                  || ((state == STATE_LEFTONLY)     && (expand_include & INCLUDE_LEFTONLY))
                  || ((state == STATE_RIGHTONLY)    && (expand_include & INCLUDE_RIGHTONLY))
                  || ((state == STATE_MOVEDLEFT)    && (expand_include & INCLUDE_MOVEDLEFT))
                  || ((state == STATE_MOVEDRIGHT)   && (expand_include & INCLUDE_MOVEDRIGHT))
                  || ((state == STATE_SIMILARLEFT)  && (expand_include & INCLUDE_SIMILARLEFT))
                  || ((state == STATE_SIMILARRIGHT) && (expand_include & INCLUDE_SIMILARRIGHT))) {
                         view->rows += section_getlinecount(sh);
                }
        }
#ifndef WIN32
        if ( ((long) view->rows * sizeof(VIEWLINE)) > 65535L) {
                // careful here- putting up a dialog box can
                // cause the view to be redrawn
                view->rows = 0;

                MessageBox(hwndClient,
                  "Diff info too large for 16-bit version - truncating",
                  "Sdkdiff", MB_ICONSTOP|MB_OK);

                view->rows = (int) (65535L / sizeof(VIEWLINE));
        }
#endif

        /* allocate the memory for the mapping array */
        {    /* DO NOT chain in any storage with garbage pointers in it */
            PVIEWLINE temp;
      temp = (PVIEWLINE) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, view->rows * sizeof(VIEWLINE));
            if (temp == NULL)
        return FALSE;
      view->pLines = temp;
        }

        /* loop through the sections again filling in the mapping array */
        i = 0;
        view->maxtag = 5;
        view->maxrest = 0;
        for (sh = (SECTION) List_First(li); sh != NULL;
            sh = (SECTION) List_Next(sh)) {

                state = section_getstate(sh);

                if (expand_mode == IDM_RONLY) {
                        if ((state == STATE_LEFTONLY) ||
                            (state == STATE_SIMILARLEFT) ||
                            (state == STATE_MOVEDLEFT)) {
                                    continue;
                        }
                } else if (expand_mode == IDM_LONLY) {
                        if ((state == STATE_RIGHTONLY) ||
                            (state == STATE_SIMILARRIGHT) ||
                            (state == STATE_MOVEDRIGHT)) {
                                    continue;
                        }
                }

                /* include all lines in this section
                   if the section meets the include criteria */
                if ( ((state == STATE_SAME)         && (expand_include & INCLUDE_SAME))
                  || ((state == STATE_LEFTONLY)     && (expand_include & INCLUDE_LEFTONLY))
                  || ((state == STATE_RIGHTONLY)    && (expand_include & INCLUDE_RIGHTONLY))
                  || ((state == STATE_MOVEDLEFT)    && (expand_include & INCLUDE_MOVEDLEFT))
                  || ((state == STATE_MOVEDRIGHT)   && (expand_include & INCLUDE_MOVEDRIGHT))
                  || ((state == STATE_SIMILARLEFT)  && (expand_include & INCLUDE_SIMILARLEFT))
                  || ((state == STATE_SIMILARRIGHT) && (expand_include & INCLUDE_SIMILARRIGHT))) {

                        /* find the base line number in each file */
                        base_left = section_getleftbasenr(sh);
                        base_right = section_getrightbasenr(sh);

                        /* add each line in section to the view. section_getfirst()
                         * returns us to a handle that is in a list. We can
                         * call List_Next and will eventually get to the
                         * line returned by section_getlast(). Sections always have
                         * at least one line
                         */
                        line1 = section_getfirstline(sh);
                        line2 = section_getlastline(sh);

                        for (; line1 != NULL; line1 = (LINE) List_Next(line1)) {

                                view->pLines[i].line = line1;
                                view->pLines[i].section = sh;

                                /* calculate the line number for this line by
                                 * incrementing the base nr for this section.
                                 * Note SIMILAR_RIGHT (or LEFT) lines DO have
                                 * left (or right) numbers, but they are dummies.
                                 */

                                view->pLines[i].nr_left = base_left;
                                if (state!=STATE_SIMILARRIGHT && base_left != 0) {
                                        base_left++;
                                }

                                view->pLines[i].nr_right = base_right;
                                if (state!=STATE_SIMILARLEFT && base_right != 0) {
                                        base_right++;
                                }

                                /* increment index into view */
                                i++;

                                /* check the column widths */
                                view->maxrest = max(view->maxrest,
                                                    (line_gettabbedlength(line1, g_tabwidth)));
#ifndef WIN32
                               // check for truncation (if VIEWLINE array too large)
                               if (i >= view->rows) {
                                   break;
                               }
#endif

                                /* end of section ? */
                                if (line1 == line2) {
                                        break;
                                }
                        }
#ifndef WIN32
                        // check for truncation (if VIEWLINE array too large)
                        if (i >= view->rows) {
                            break;
                        }
#endif
                }
        }

        /* We must NOT hold a critical section here as SendMessage may hang */
        ViewLeave();

        /*inform table window of revised mapping */
        SendMessage(view->hwnd, TM_NEWLAYOUT, 0, (LPARAM) view);

        return(TRUE);
}

BOOL view_expanding ( VIEW view )

Definition at line 1206 of file view.cpp.

{
    return(view->bExpanding);

}

void view_expandstart ( VIEW view )

Definition at line 1199 of file view.cpp.

{
    view->bExpanding = TRUE;
}

long view_findchange | ( | VIEW | view,
 |  | long | startrow,
 |  | BOOL | bForward
 | ) |  |

Definition at line 1069 of file view.cpp.

{
        long i;

        if (view == NULL) {
                return(0);
        }

        if (view->rows <= 0) {
            return (-1);
        }

        ViewEnter();

        if (bForward) {

                if (startrow >= view->rows) {
                        ViewLeave();
                        return(-1);
                }

                if (!view->bExpand) {

                        /* look for next compitem with an expandable state*/
                        for (i = startrow; i < view->rows; i++) {
                                if (compitem_getstate(view->pItems[i]) == STATE_DIFFER) {
                                        ViewLeave();
                                        return(i);
                                }
                        }
                        /* none found */
                        ViewLeave();
                        return(-1);
                } else {
                        /*
                         * find the next line that matches, then go on to the
                         * next line that does not match
                         *
                         */
                        for (i= startrow; i < view->rows; i++) {
                                if (section_getstate(view->pLines[i].section)
                                        == STATE_SAME) {
                                                break;
                                }
                        }
                        for ( ; i < view->rows; i++) {
                                if (section_getstate(view->pLines[i].section)
                                        != STATE_SAME) {
                                                ViewLeave();
                                                return(i);
                                }
                        }

                        ViewLeave();

                        return(-1);
                }
        } else {
                /* same search backwards */
                if (startrow < 0) {
                        ViewLeave();
                        return(-1);
                }
                if (view->bExpand) {
                        /* search backwards for first row that is not
                         * changed (has state SAME). then carry on for
                         * the next changed row.
                         */
                        for (i = startrow; i >= 0; i--) {
                                if (section_getstate(view->pLines[i].section)
                                        == STATE_SAME) {
                                                break;
                                }
                        }
                        for ( ; i >= 0; i--) {
                                if (section_getstate(view->pLines[i].section)
                                        != STATE_SAME) {
                                                ViewLeave();
                                                return(i);
                                }
                        }
                        ViewLeave();
                        return(-1);
                } else {
                        for (i = startrow; i >= 0; i--) {
                                if(compitem_getstate(view->pItems[i]) == STATE_DIFFER) {
                                        ViewLeave();
                                        return(i);
                                }
                        }
                        ViewLeave();
                        return(-1);
                }
        }
}

int view_findrow | ( | VIEW | view,
 |  | int | number,
 |  | BOOL | bRight
 | ) |  |

Definition at line 1224 of file view.cpp.

{
        int i;

        if (!view->bExpand) {
                return(0);
        }

        for (i = 0; i < view->rows; i++) {

                if (bRight) {
                        if (view->pLines[i].nr_right == number) {

                                /* found the exact number */
                                return(i);

                        } else if (view->pLines[i].nr_right > number) {

                                /* passed our line -stop here */
                                return(i);
                        }
                } else {
                        if (view->pLines[i].nr_left == number) {

                                /* found the exact number */
                                return(i);

                        } else if (view->pLines[i].nr_left > number) {

                                /* passed our line -stop here */
                                return(i);
                        }
                }
        }
        return(-1);
}

BOOL view_findstring | ( | VIEW | view,
 |  | LONG | iCol,
 |  | LPCSTR | pszFind,
 |  | BOOL | fSearchDown,
 |  | BOOL | fMatchCase,
 |  | BOOL | fWholeWord
 | ) |  |

Definition at line 1710 of file view.cpp.

{
  const LONG cRows = view_getrowcount(view);
  BOOL fFound = FALSE;

  if (cRows > 0)
    {
    STRSUBFUNC pfnSub = (fMatchCase) ? My_mbsstr : My_mbsistr;
    const char *pszRow = NULL;
    const char *pszFound = NULL;
    char *pszEnd = NULL;
    LONG iEnd    = 0;
    LONG iRow    = 0;
    LONG nStep   = 0;
    LONG iWrapAt = 0;
    LONG iWrapTo = 0;

    if (fSearchDown)
      {
      nStep = 1;
      iRow = selection + selection_nrows - 1;
      iWrapAt = cRows;
      iWrapTo = 0;
      }
    else
      {
      nStep = -1;
      iRow = selection;
      iWrapAt = -1;
      iWrapTo = cRows - 1;
      }

    iRow += nStep;
    if (iRow < 0 || iRow >= cRows)
      iRow = iWrapTo;

    iEnd = iRow;

    for (;;)
      {
      pszRow = view_gettext(view, iRow, iCol);
      if (pszRow)
        {
        pszEnd = NULL;
        pszFound = (const char*)pfnSub((PUCHAR)pszRow, (PUCHAR)pszFind, (PUCHAR*)&pszEnd);
        if (pszFound)
          {
          if (!fWholeWord)
            {
            fFound = TRUE;
            }
          else
            {
            /* check end of string */
            if (!pszEnd || !*pszEnd || (!IsDBCSLeadByte(*pszEnd) && !isalpha(*pszEnd) && !isdigit(*pszEnd)))
              {
              /* check beginning of string */
              if (pszFound == pszRow)
                {
                fFound = TRUE;
                }
              else
                {
                const char *pchT = CharPrev(pszRow, pszFound);
                if (!pchT || !*pchT || (!IsDBCSLeadByte(*pchT) && !isalpha(*pchT) && !isdigit(*pchT)))
                  {
                  fFound = TRUE;
                  }
                }
              }
            }

          if (fFound)
            {
            view_gototableline(view, iRow);
            break;
            }
          }
        }

      iRow += nStep;
      if (iRow == iWrapAt)
        iRow = iWrapTo;

      if (iRow == iEnd)
        break;
      }
    }

  return fFound;
}

void view_freemappings ( VIEW view )

Definition at line 1269 of file view.cpp.

{

        if (view->pLines) {

      HeapFree(GetProcessHeap(), NULL, view->pLines);
            view->pLines = NULL;
        } else if (view->pItems) {

                /* previous outline mapping array is still there - free it
                 * before we build a new one
                 */

                HeapFree(GetProcessHeap(), NULL, view->pItems);
                view->pItems = NULL;
        }
        view->rows = 0;
}

COMPLIST view_getcomplist ( VIEW view )

Definition at line 237 of file view.cpp.

{
        if (view == NULL) {
                return(NULL);
        }

        return(view->cl);
}

LPSTR view_getcurrenttag ( VIEW view )

Definition at line 764 of file view.cpp.

{
        LPSTR str;

        if ((view == NULL) || (!view->bExpand)) {
                return(NULL);
        } else {
                ViewEnter();

                str = compitem_gettext_tag(view->ciSelect);

                ViewLeave();
                return(str);

        }
}

HWND view_gethwnd ( VIEW view )

Definition at line 1675 of file view.cpp.

{
  return (view) ? view->hwnd : NULL;
}

COMPITEM view_getitem | ( | VIEW | view,
 |  | long | row
 | ) |  |

Definition at line 722 of file view.cpp.

{
        COMPITEM ci;

        if (view == NULL) {
                return(NULL);
        }

        ViewEnter();

        if (!view->bExpand) {
                if ((row >= 0) && (row < view->rows)) {
                        ci = view->pItems[row];
                } else {
                        ci = NULL;
                }
        } else {
                ci = view->ciSelect;
        }

        ViewLeave();
        return(ci);
}

int view_getlinenr_left | ( | VIEW | view,
 |  | long | row
 | ) |  |

Definition at line 556 of file view.cpp.

{
        int state, line;

        if ((view == NULL) || (row >= view->rows) || !view->bExpand) {
                return 0;
        }

        ViewEnter();
        state = section_getstate(view->pLines[row].section);
        line = view->pLines[row].nr_left;
        if (state == STATE_MOVEDRIGHT || state == STATE_SIMILARRIGHT) {
                line = -line;
        }
        ViewLeave();

        return(line);
}

int view_getlinenr_right | ( | VIEW | view,
 |  | long | row
 | ) |  |

Definition at line 582 of file view.cpp.

{
        int state, line;

        if ((view == NULL) || (row > view->rows) || !view->bExpand) {
                return 0;
        }

        ViewEnter();

        state = section_getstate(view->pLines[row].section);
        line = view->pLines[row].nr_right;
        if (state == STATE_MOVEDLEFT || state == STATE_SIMILARLEFT) {
                line = -line;
        }
        ViewLeave();

        return(line);
}

BOOL view_getmarkstate | ( | VIEW | view,
 |  | long | row
 | ) |  |

Definition at line 678 of file view.cpp.

{
    BOOL bMark = FALSE;

    if (view != NULL) {
   ViewEnter();
   if ( (row < view->rows) && (!view->bExpand)) {
       bMark = compitem_getmark(view->pItems[row]);
   }
   ViewLeave();
    }
    return(bMark);
}

long view_getrowcount ( VIEW view )

Definition at line 632 of file view.cpp.

{
        if (view == NULL) {
                return(0);
        }

        return(view->rows);
}

int view_getrowstate | ( | VIEW | view,
 |  | long | row
 | ) |  |

Definition at line 1166 of file view.cpp.

{
        int state;

        if (view == NULL) {
                return(0);
        }

        if (view->rows <= 0 || row >= view->rows) {
            return (STATE_SAME);
        }

        ViewEnter();

        state = section_getstate(view->pLines[row].section);

        ViewLeave();

        return state;
}

int view_getstate | ( | VIEW | view,
 |  | long | row
 | ) |  |

Definition at line 649 of file view.cpp.

{
        int state;

        if (view == NULL) {
                return(0);
        }

        ViewEnter();
        if (row >= view->rows) {
                state = 0;
        } else if (view->bExpand) {
                /* its a line state that's needed */
                state = section_getstate(view->pLines[row].section);
        } else {

                /* its a compitem state */
                state = compitem_getstate(view->pItems[row]);
        }
        ViewLeave();
        return(state);
}

LPSTR view_gettext | ( | VIEW | view,
 |  | long | row,
 |  | int | col
 | ) |  |

Definition at line 368 of file view.cpp.

{
        int line;
        int state;
        LPSTR pstr;
    HRESULT hr;

        pstr = NULL;   /* kill spurious diagnostic */
        if (view == NULL) {
                return (NULL);
        }

        ViewEnter();

        if (row >= view->rows) {
                ViewLeave();
                return(NULL);
        }

        if (view->bExpand) {
                /* we are in expand mode */

                state = section_getstate(view->pLines[row].section);

                switch(col) {
                case 0:
                        /* row nr */

                        /* line numbers can be from either original file
                         * this is a menu-selectable option
                         */
                        line = 0;
                        switch(line_numbers) {
                        case IDM_NONRS:
                                pstr = NULL;
                                break;

                        case IDM_LNRS:
                                line = view->pLines[row].nr_left;
                                if (state == STATE_MOVEDRIGHT
                                    || state == STATE_SIMILARRIGHT) {
                                        line = -line;
                                }
                                break;

                        case IDM_RNRS:
                                line = view->pLines[row].nr_right;
                                if (state == STATE_MOVEDLEFT
                                    || state == STATE_SIMILARLEFT) {
                                        line = -line;
                                }
                                break;
                        }
                        if (line == 0) {
                                ViewLeave();
                                return(NULL);
                        }

                        if (line < 0) {
                                /* lines that are moved appear twice.
                                 * show the correct-sequence line nr
                                 * for the out-of-seq. copy in brackets.
                                 */
                                hr = StringCchPrintf(view->nrtext, 12, "(%d)", abs(line));
                if (FAILED(hr)) {
                  OutputError(hr, IDS_SAFE_PRINTF);
                  return(NULL);
                }

                        } else  {
                                hr = StringCchPrintf(view->nrtext, 12, "%d", line);
                if (FAILED(hr)) {
                  OutputError(hr, IDS_SAFE_PRINTF);
                  return(NULL);
                }
                        }
                        pstr = view->nrtext;
                        break;

                case 1:
                        /* tag text - represents the state of the line */

                        switch(state) {
                        case STATE_SAME:
                                pstr = "    ";
                                break;

                        case STATE_LEFTONLY:
                        case STATE_SIMILARLEFT:
                                pstr = " <! ";
                                break;

                        case STATE_RIGHTONLY:
                        case STATE_SIMILARRIGHT:
                                pstr = " !> ";
                                break;

                        case STATE_MOVEDLEFT:
                                pstr = " <- ";
                                break;

                        case STATE_MOVEDRIGHT:
                                pstr = " -> ";
                                break;
                        }
                        break;

                case 2:
                        /* main text - line */
                        pstr = line_gettext(view->pLines[row].line);
                        break;
                }
        } else {
                /* outline mode */
                switch(col) {
                case 0:
                        /* row number - just the line number */
                        hr = StringCchPrintf(view->nrtext, 12, "%d", row+1);
            if (FAILED(hr)) {
              OutputError(hr, IDS_SAFE_PRINTF);
              return(NULL);
            }
                        pstr = view->nrtext;
                        break;

                case 1:
                        /* tag */
                        pstr = compitem_gettext_tag(view->pItems[row]);
                        break;

                case 2:
                        /* result text */
                        pstr = compitem_gettext_result(view->pItems[row]);
                        break;
                }
        }
        ViewLeave();
        return(pstr);
}

LPWSTR view_gettextW | ( | VIEW | view,
 |  | long | row,
 |  | int | col
 | ) |  |

Definition at line 516 of file view.cpp.

{
        int state;
        LPWSTR pwz;

        pwz = NULL;   /* kill spurious diagnostic */
        if (view == NULL) {
                return (NULL);
        }

        ViewEnter();

        if (row >= view->rows) {
                ViewLeave();
                return(NULL);
        }

        if (view->bExpand) {
                /* we are in expand mode */

                state = section_getstate(view->pLines[row].section);

                switch(col) {
                case 2:
                        /* main text - line */
                        pwz = line_gettextW(view->pLines[row].line);
                        break;
                }
        }
        ViewLeave();
        return(pwz);
}

int view_getwidth | ( | VIEW | view,
 |  | int | col
 | ) |  |

Definition at line 606 of file view.cpp.

{
        if (view == NULL) {
                return(0);
        }

        switch(col) {
        case 0:
                /* line nr column - always 5 characters wide */
                return(5);

        case 1:
                /* this is a proportional font field, so add on a margin
                 * for error
                 */
                return(view->maxtag + (view->maxtag / 20));
        case 2:
                /* this now includes the tab expansion allowance */
                return(view->maxrest);
        default:
                return(0);
        }
}

void view_gototableline | ( | VIEW | view,
 |  | LONG | iLine
 | ) |  |

Definition at line 1686 of file view.cpp.

{
  if (view)
    {
    const LONG cLines = view_getrowcount(view);
    if (iLine >= 0 && iLine < cLines)
      {
      TableSelection select;
      memset(&select, 0, sizeof(TableSelection));
      select.startrow = iLine;
      select.nrows    = 1L;
      select.ncells   = 1L;

      SendMessage(view_gethwnd(view), TM_SELECT, 0, (LPARAM) &select);
      }
    }
}

BOOL view_isexpanded ( VIEW view )

Definition at line 750 of file view.cpp.

{
        if (view == NULL) {
                return(FALSE);
        }
        return(view->bExpand);
}

VIEW view_new ( HWND hwndTable )

Definition at line 154 of file view.cpp.

{
        VIEW view;

#ifdef WIN32
        if (!bDoneInit) {
                InitializeCriticalSection(&CSView);
                bDoneInit = TRUE;
        }
#endif

        /* alloc the view using HeapAlloc */
        view = (VIEW) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct view));
    if (view == NULL)
      return NULL;
        /* set the default fields */
        view->hwnd = hwndTable;
        view->cl = NULL;
        view->bExpand = FALSE;
        view->bExpandGuard = FALSE;
        view->ciSelect = NULL;
        view->rows = 0;
        view->pItems = NULL;
        view->pLines = NULL;

    // erase the message in the names field - the central box in the status bar
    SetNames("");
        return(view);
}

BOOL view_newitem ( VIEW view )

Definition at line 801 of file view.cpp.

{
        int maxtag, maxrest;
        int rownr;
        TableSelection Select;
        BOOL bSelect;
        COMPITEM ciTop = NULL;
        BOOL bRedraw = FALSE;
        BOOL bAppend = FALSE;

        // get the top row before remapping in case we need it
        /* find the row at the top of the window */
        rownr = (long) SendMessage(view->hwnd, TM_TOPROW, FALSE, 0);
        // also remember the selection
        bSelect = (BOOL) SendMessage(view->hwnd, TM_GETSELECTION, 0, (LPARAM) &Select);

        // *important*:no critsec over SendMessage
        ViewEnter();

        if ((view != NULL) &&
            !(view->bExpand) &&
            !(view->bExpanding)) {

            /* save some state about the present mapping */
            maxtag = view->maxtag;
            maxrest = view->maxrest;

            // remember the compitem this corresponds to
            if (view->pItems && (rownr >= 0) && (rownr < view->rows)) {
                ciTop = view->pItems[rownr];
            }

            // re-do the outline mapping, but don't tell the table class.
            // ask it to check for the visible row closest to ciTop in case
            // we need to refresh the display
            //
            // since we are holding the critsec, the redraw param
            // *must* be false.
            view_outline_opt(view, FALSE, ciTop, &rownr);

            /* have the column widths changed ? */
            if ((maxtag < view->maxtag) || (maxrest < view->maxrest)) {
                /* yes - need complete redraw */
                bRedraw = TRUE;
            } else {
                bAppend = TRUE;
            }
        }

        ViewLeave();

        if (bRedraw) {

            /* switch to new mapping */
            SendMessage(view->hwnd, TM_NEWLAYOUT, 0, (LPARAM) view);

            // go to the visible row closest to the old top row
            if ((rownr >= 0) && (rownr < view->rows)) {
                SendMessage(view->hwnd, TM_TOPROW, TRUE, rownr);
            }

            // select the old selection too (if the table class allowed
            // us to get it)
            if (bSelect) {
                SendMessage(view->hwnd, TM_SELECT,0, (LPARAM) &Select);
            }

        } else if (bAppend) {
            /* we can just append */

            /*
             * in the WIN32 multiple threads case, the mapping may have
             * changed since we released the critsec. however we are still
             * safe. The table will not allow us to reduce the number of
             * rows, so the worst that can happen is that the table will
             * think there are too many rows, and the table message handler
             * will handle this correctly (return null for the text).
             * The only visible effect is therefore that the scrollbar
             * position is wrong.
             */

            SendMessage(view->hwnd, TM_APPEND, view->rows, (LPARAM) view);
        }

        return(Poll());
}

void view_outline ( VIEW view )

Definition at line 308 of file view.cpp.

{
        if (view == NULL) {
                return;
        }

        /* all work done by view_outline_opt - this function
         * gives us the option of not updating the display
         */
        view_outline_opt(view, TRUE, NULL, NULL);
}

void view_outline_opt | ( | VIEW | view,
 |  | BOOL | bRedraw,
 |  | COMPITEM | ci,
 |  | int * | prow
 | ) |  |

Definition at line 1304 of file view.cpp.

{
        int prev_row = -1;      /* the row nr of the previously-expanded row*/
        int i;                  /* nr of includable items */
        LIST li;
        COMPITEM ci;
        int state;
        TableSelection select;

        /*
         * check that view_setcomplist has already been called. if not,
         * nothing to do
         */
        if (view->cl == NULL) {
                return;
        }

        ViewEnter();

        /* clear the mode flag and free up memory associated with expand mode */
        view->bExpand = FALSE;
        view_freemappings(view);

        /* traverse the list of compitems counting up the number of
         * includable items
         */
        li = complist_getitems(view->cl);

        ci = (COMPITEM) List_First(li);
        for (i = 0; ci != NULL; ci = (COMPITEM) List_Next(ci)) {

                if ((ciFind != NULL) && (prow != NULL)) {
                    if (ci == ciFind) {
                        // now that we have found the requested item,
                        // the next visible row is the one we want,
                        // whether it is ci or a later one
                        *prow = i;
                    }
                }

                state = compitem_getstate(ci);

                if (((outline_include & INCLUDE_SAME) && (state == STATE_SAME)) ||
                    ((outline_include & INCLUDE_DIFFER) && (state == STATE_DIFFER)) ||
                    ((outline_include & INCLUDE_LEFTONLY) && (state == STATE_FILELEFTONLY)) ||
                    ((outline_include & INCLUDE_RIGHTONLY) && (state == STATE_FILERIGHTONLY))) {
                    if (!compitem_getmark(ci) || !hide_markedfiles) {
                        i++;
                    }
                }
        }

        /* allocate an array big enough for all of these */
        { /* DO NOT link in any storage with garbage pointers in it */
            COMPITEM FAR * temp;
            temp = (COMPITEM FAR *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, i * sizeof(COMPITEM));
            if (temp == NULL)
        return;
      view->pItems = temp;
        }
        view->rows = i;

        /* keep track of the column widths */
        view->maxtag = 0;
        view->maxrest = 0;

        /* loop through again filling the array, and at the same time looking
         * out for the handle of the previously expanded item
         */
        ci = (COMPITEM) List_First(li);
        for (i = 0; ci != NULL; ci = (COMPITEM) List_Next(ci)) {

                state = compitem_getstate(ci);

                if (((outline_include & INCLUDE_SAME) && (state == STATE_SAME)) ||
                    ((outline_include & INCLUDE_DIFFER) && (state == STATE_DIFFER)) ||
                    ((outline_include & INCLUDE_LEFTONLY) && (state == STATE_FILELEFTONLY)) ||
                    ((outline_include & INCLUDE_RIGHTONLY) && (state == STATE_FILERIGHTONLY))) {

         if (!compitem_getmark(ci) || !hide_markedfiles) {

                            view->pItems[i] = ci;

                            if (ci == view->ciSelect) {
                                    prev_row = i;
                            }

                            /* check the column widths in characters */
                            view->maxtag = max(view->maxtag,
                                               lstrlen(compitem_gettext_tag(ci)));
                            view->maxrest = max(view->maxrest,
                                                lstrlen(compitem_gettext_result(ci)));

                            i++;
         }

                }
        }
        ViewLeave();

        /* inform table of new layout of table - force refresh */
        if (bRedraw) {
                SendMessage(view->hwnd, TM_NEWLAYOUT, 0, (LPARAM) view);

                /* scroll to and highlight the row that represents the file
                 * we were previously expanding
                 */
                if (prev_row != -1) {
                        select.startrow = prev_row;
                        select.startcell = 0;
                        select.nrows = 1;
                        select.ncells = 1;
                        SendMessage(view->hwnd, TM_SELECT, 0, (LPARAM) &select);
                }
        }
}

BOOL view_setcomplist | ( | VIEW | view,
 |  | COMPLIST | cl
 | ) |  |

Definition at line 202 of file view.cpp.

{
        LPSTR both;

        if (view == NULL) {
                return(FALSE);
        }

        /* there can be only one call to this per VIEW */
        if (view->cl != NULL) {
                return (FALSE);
        }

        ViewEnter();

        view->cl = cl;

        /* set names on status bar to root names of left and right trees */
        both = complist_getdescription(cl);
        ViewLeave();                      // LKGHACK
        SetNames(both);
        ViewEnter();                      // LKGHACK
        complist_freedescription(cl, both);

        ViewLeave();

        view_outline(view);
        return TRUE;
}

BOOL view_setmarkstate | ( | VIEW | view,
 |  | long | row,
 |  | BOOL | bMark
 | ) |  |

Definition at line 700 of file view.cpp.

{
    BOOL bOK = FALSE;

    if (view != NULL) {
   ViewEnter();
   if ( (row < view->rows) && !view->bExpand) {
       compitem_setmark(view->pItems[row], bMark);
       bOK = TRUE;
   }
   ViewLeave();
    }
    return (bOK);
}

Variable Documentation

long selection

Definition at line 491 of file sdkdiff.cpp.

long selection_nrows

Definition at line 492 of file sdkdiff.cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/sdkdiff/view.h File Reference

  • Begin
  • sdkdiff
Defines | Typedefs | Functions

view.h File Reference

Go to the source code of this file.

Defines

#define | INC_VIEW_COMPLIST

Typedefs

typedef struct compitem FAR * | COMPITEM
typedef struct complist FAR * | COMPLIST
typedef struct view FAR * | VIEW

Functions

void | view_changediffoptions (VIEW view)
void | view_changeviewoptions (VIEW view)
void | view_close (VIEW view)
void | view_delete (VIEW view)
BOOL | view_expand (VIEW view, long row)
BOOL view_expanding (VIEW)
void | view_expandstart (VIEW)
long | view_findchange (VIEW view, long startrow, BOOL bForward)
BOOL | view_findstring (VIEW view, LONG iCol, LPCSTR pszFind, BOOL fSearchDown, BOOL fMatchCase, BOOL fWholeWord)
COMPLIST view_getcomplist (VIEW view)
LPSTR view_getcurrenttag (VIEW view)
HWND | view_gethwnd (VIEW view)
COMPITEM | view_getitem (VIEW view, long row)
int | view_getlinenr_left (VIEW view, long row)
int | view_getlinenr_right (VIEW view, long row)
BOOL | view_getmarkstate (VIEW view, long row)
long | view_getrowcount (VIEW view)
int | view_getrowstate (VIEW view, long row)
int | view_getstate (VIEW view, long row)
LPSTR | view_gettext (VIEW view, long row, int col)
LPWSTR | view_gettextW (VIEW view, long row, int col)
int | view_getwidth (VIEW view, int col)
void | view_gototableline (VIEW view, LONG iLine)
BOOL view_isexpanded (VIEW view)
VIEW | view_new (HWND hwndTable)
BOOL view_newitem (VIEW view)
void | view_outline (VIEW)
BOOL | view_setcomplist (VIEW view, COMPLIST cl)
BOOL | view_setmarkstate (VIEW view, long row, BOOL bMark)

Define Documentation

#define INC_VIEW_COMPLIST

Definition at line 54 of file view.h.

Typedef Documentation

typedef struct compitem FAR* COMPITEM

Definition at line 55 of file view.h.

typedef struct complist FAR* COMPLIST

Definition at line 57 of file view.h.

typedef struct view FAR* VIEW

Definition at line 56 of file view.h.

Function Documentation

void view_changediffoptions ( VIEW view )

Definition at line 987 of file view.cpp.

{
        int state, number;
        long row;
        BOOL bRight = FALSE;
        LIST li;
        COMPITEM ci;

        number = 0;
        if (view == NULL) {
                return;
        }

        /*
         * get current row before entering critsec.
         */
        row = (long) SendMessage(view->hwnd, TM_TOPROW, FALSE, 0);

        ViewEnter();

        /* find the current line number so we can go back to it
         * (only if we are in expanded mode
         */
        if (view->bExpand) {

                state = section_getstate(view->pLines[row].section);
                if ((state == STATE_MOVEDRIGHT) ||
                    (state == STATE_SIMILARRIGHT) ||
                    (state == STATE_RIGHTONLY)) {
                            bRight = TRUE;
                            number = view->pLines[row].nr_right;
                } else {
                        bRight = FALSE;
                        number = view->pLines[row].nr_left;
                }
        }

        /* to force a recompare using the new options, we must
         * tell each compitem to discard its current compare result.
         * we need to traverse the list of compitems calling this
         * for each compare.
         */
        li = complist_getitems(view->cl);

        for (ci = (COMPITEM) List_First(li); ci != NULL; ci = (COMPITEM) List_Next(ci)) {
                compitem_discardsections(ci);
        }

        if (!view->bExpand) {
                ViewLeave();

                // we are in outline mode. Refreshing the outline view
                // will pick up any tag and tag width changes
                view_outline(view);

                // now scroll to the previous position if still there
                if (row < view->rows) {
                    SendMessage(view->hwnd, TM_TOPROW, TRUE, row);
                }

                return;
        }

        view_expand_item(view, view->ciSelect);

        /* find the nearest row in the new view */
        ViewEnter();
        row = view_findrow(view, number, bRight);
        ViewLeave();

        /* scroll this row to top of window */
        if (row >= 0) {
                SendMessage(view->hwnd, TM_TOPROW, TRUE, row);
        }
}

void view_changeviewoptions ( VIEW view )

Definition at line 897 of file view.cpp.

{
        long row;
        int state, number;
        BOOL bRight;

        if (view == NULL) {
                return;
        }

        /* find what row we are currently on. Do this BEFORE we enter CSView */
        row = (long) SendMessage(view->hwnd, TM_TOPROW, FALSE, 0);

        ViewEnter();

        if (!view->bExpand) {

            // view_outline_opt allows us to find the first visible row
            // after a given COMPITEM. Do this to look for the old top-row
            // compitem, so that even if it is no longer visible, we can
            // still go to just after it.

            INT newrow = -1;
            if (row < view->rows) {

                COMPITEM ciTop = view->pItems[row];

                view_outline_opt(view, TRUE, ciTop, &newrow);
            } else {
                view_outline_opt(view, TRUE, NULL, NULL);
            }
            ViewLeave();

            // row now has the visible row that corresponds to
            // ciTop or where it would have been
            if ((newrow >=0) && (newrow < view->rows)) {
                SendMessage(view->hwnd, TM_TOPROW, TRUE, newrow);
            }
            return;
        }

        /* expanded mode */

        bRight = FALSE;  /* arbitrarily - avoid strange diagnostic */
        /* save the line number on one side (and remember which side) */
        if (row >= view->rows) {
                number = -1;
        } else {
                state = section_getstate(view->pLines[row].section);
                if ((state == STATE_MOVEDRIGHT) ||
                    (state == STATE_RIGHTONLY)) {
                            bRight = TRUE;
                            number = view->pLines[row].nr_right;
                } else {
                        bRight = FALSE;
                        number = view->pLines[row].nr_left;
                }
        }

        /* make the new mapping */
        view_expand_item(view, view->ciSelect);

        /* things may happen now due to simultaneous scrolling from
         * two threads.  At least we won't deadlock.
         */
        /* find the nearest row in the new view */
        if (number >= 0) {

                ViewEnter();
                row = view_findrow(view, number, bRight);
                ViewLeave();

                /* scroll this row to top of window */
                if (row >= 0) {

                        /* things may happen now due to simultaneous scrolling from
                         * two threads.  At least we won't deadlock.
                         */
                        SendMessage(view->hwnd, TM_TOPROW, TRUE, row);
                        return;
                }
        }
}

void view_close ( VIEW view )

Definition at line 254 of file view.cpp.

{
        if (view == NULL) {
                return;
        }

        SendMessage(view->hwnd, TM_NEWID, 0, 0);
}

void view_delete ( VIEW view )

Definition at line 274 of file view.cpp.

{
        if (view == NULL) {
                return;
        }

        /* we have two arrays that are used for the mapping - an array
         * of compitem handles in outline mode, and an array of
         * VIEWLINE structures in expand mode
         */

        view_freemappings(view);

        complist_delete(view->cl);

        HeapFree(GetProcessHeap(), NULL, view);
}

BOOL view_expand | ( | VIEW | view,
 |  | long | row
 | ) |  |

Definition at line 333 of file view.cpp.

{
        COMPITEM ci;
        BOOL bRet;

   if (row<0) return FALSE;

        ViewEnter();

        if ((view == NULL) || (view->bExpand)) {
                /* no view, or already expanded */
                ViewLeave();
                return(FALSE);
        }

        if (row >= view->rows) {
                /* no such row */
                ViewLeave();
                return FALSE;
        }

        /* remember the compitem we are expanding */
        ci = view->pItems[row];

        bRet = view_expand_item(view, ci);
        return(bRet);
}

BOOL view_expanding ( VIEW )

Definition at line 1206 of file view.cpp.

{
    return(view->bExpanding);

}

void view_expandstart ( VIEW )

Definition at line 1199 of file view.cpp.

{
    view->bExpanding = TRUE;
}

long view_findchange | ( | VIEW | view,
 |  | long | startrow,
 |  | BOOL | bForward
 | ) |  |

Definition at line 1069 of file view.cpp.

{
        long i;

        if (view == NULL) {
                return(0);
        }

        if (view->rows <= 0) {
            return (-1);
        }

        ViewEnter();

        if (bForward) {

                if (startrow >= view->rows) {
                        ViewLeave();
                        return(-1);
                }

                if (!view->bExpand) {

                        /* look for next compitem with an expandable state*/
                        for (i = startrow; i < view->rows; i++) {
                                if (compitem_getstate(view->pItems[i]) == STATE_DIFFER) {
                                        ViewLeave();
                                        return(i);
                                }
                        }
                        /* none found */
                        ViewLeave();
                        return(-1);
                } else {
                        /*
                         * find the next line that matches, then go on to the
                         * next line that does not match
                         *
                         */
                        for (i= startrow; i < view->rows; i++) {
                                if (section_getstate(view->pLines[i].section)
                                        == STATE_SAME) {
                                                break;
                                }
                        }
                        for ( ; i < view->rows; i++) {
                                if (section_getstate(view->pLines[i].section)
                                        != STATE_SAME) {
                                                ViewLeave();
                                                return(i);
                                }
                        }

                        ViewLeave();

                        return(-1);
                }
        } else {
                /* same search backwards */
                if (startrow < 0) {
                        ViewLeave();
                        return(-1);
                }
                if (view->bExpand) {
                        /* search backwards for first row that is not
                         * changed (has state SAME). then carry on for
                         * the next changed row.
                         */
                        for (i = startrow; i >= 0; i--) {
                                if (section_getstate(view->pLines[i].section)
                                        == STATE_SAME) {
                                                break;
                                }
                        }
                        for ( ; i >= 0; i--) {
                                if (section_getstate(view->pLines[i].section)
                                        != STATE_SAME) {
                                                ViewLeave();
                                                return(i);
                                }
                        }
                        ViewLeave();
                        return(-1);
                } else {
                        for (i = startrow; i >= 0; i--) {
                                if(compitem_getstate(view->pItems[i]) == STATE_DIFFER) {
                                        ViewLeave();
                                        return(i);
                                }
                        }
                        ViewLeave();
                        return(-1);
                }
        }
}

BOOL view_findstring | ( | VIEW | view,
 |  | LONG | iCol,
 |  | LPCSTR | pszFind,
 |  | BOOL | fSearchDown,
 |  | BOOL | fMatchCase,
 |  | BOOL | fWholeWord
 | ) |  |

Definition at line 1710 of file view.cpp.

{
  const LONG cRows = view_getrowcount(view);
  BOOL fFound = FALSE;

  if (cRows > 0)
    {
    STRSUBFUNC pfnSub = (fMatchCase) ? My_mbsstr : My_mbsistr;
    const char *pszRow = NULL;
    const char *pszFound = NULL;
    char *pszEnd = NULL;
    LONG iEnd    = 0;
    LONG iRow    = 0;
    LONG nStep   = 0;
    LONG iWrapAt = 0;
    LONG iWrapTo = 0;

    if (fSearchDown)
      {
      nStep = 1;
      iRow = selection + selection_nrows - 1;
      iWrapAt = cRows;
      iWrapTo = 0;
      }
    else
      {
      nStep = -1;
      iRow = selection;
      iWrapAt = -1;
      iWrapTo = cRows - 1;
      }

    iRow += nStep;
    if (iRow < 0 || iRow >= cRows)
      iRow = iWrapTo;

    iEnd = iRow;

    for (;;)
      {
      pszRow = view_gettext(view, iRow, iCol);
      if (pszRow)
        {
        pszEnd = NULL;
        pszFound = (const char*)pfnSub((PUCHAR)pszRow, (PUCHAR)pszFind, (PUCHAR*)&pszEnd);
        if (pszFound)
          {
          if (!fWholeWord)
            {
            fFound = TRUE;
            }
          else
            {
            /* check end of string */
            if (!pszEnd || !*pszEnd || (!IsDBCSLeadByte(*pszEnd) && !isalpha(*pszEnd) && !isdigit(*pszEnd)))
              {
              /* check beginning of string */
              if (pszFound == pszRow)
                {
                fFound = TRUE;
                }
              else
                {
                const char *pchT = CharPrev(pszRow, pszFound);
                if (!pchT || !*pchT || (!IsDBCSLeadByte(*pchT) && !isalpha(*pchT) && !isdigit(*pchT)))
                  {
                  fFound = TRUE;
                  }
                }
              }
            }

          if (fFound)
            {
            view_gototableline(view, iRow);
            break;
            }
          }
        }

      iRow += nStep;
      if (iRow == iWrapAt)
        iRow = iWrapTo;

      if (iRow == iEnd)
        break;
      }
    }

  return fFound;
}

COMPLIST view_getcomplist ( VIEW view )

Definition at line 237 of file view.cpp.

{
        if (view == NULL) {
                return(NULL);
        }

        return(view->cl);
}

LPSTR view_getcurrenttag ( VIEW view )

Definition at line 764 of file view.cpp.

{
        LPSTR str;

        if ((view == NULL) || (!view->bExpand)) {
                return(NULL);
        } else {
                ViewEnter();

                str = compitem_gettext_tag(view->ciSelect);

                ViewLeave();
                return(str);

        }
}

HWND view_gethwnd ( VIEW view )

Definition at line 1675 of file view.cpp.

{
  return (view) ? view->hwnd : NULL;
}

COMPITEM view_getitem | ( | VIEW | view,
 |  | long | row
 | ) |  |

Definition at line 722 of file view.cpp.

{
        COMPITEM ci;

        if (view == NULL) {
                return(NULL);
        }

        ViewEnter();

        if (!view->bExpand) {
                if ((row >= 0) && (row < view->rows)) {
                        ci = view->pItems[row];
                } else {
                        ci = NULL;
                }
        } else {
                ci = view->ciSelect;
        }

        ViewLeave();
        return(ci);
}

int view_getlinenr_left | ( | VIEW | view,
 |  | long | row
 | ) |  |

Definition at line 556 of file view.cpp.

{
        int state, line;

        if ((view == NULL) || (row >= view->rows) || !view->bExpand) {
                return 0;
        }

        ViewEnter();
        state = section_getstate(view->pLines[row].section);
        line = view->pLines[row].nr_left;
        if (state == STATE_MOVEDRIGHT || state == STATE_SIMILARRIGHT) {
                line = -line;
        }
        ViewLeave();

        return(line);
}

int view_getlinenr_right | ( | VIEW | view,
 |  | long | row
 | ) |  |

Definition at line 582 of file view.cpp.

{
        int state, line;

        if ((view == NULL) || (row > view->rows) || !view->bExpand) {
                return 0;
        }

        ViewEnter();

        state = section_getstate(view->pLines[row].section);
        line = view->pLines[row].nr_right;
        if (state == STATE_MOVEDLEFT || state == STATE_SIMILARLEFT) {
                line = -line;
        }
        ViewLeave();

        return(line);
}

BOOL view_getmarkstate | ( | VIEW | view,
 |  | long | row
 | ) |  |

Definition at line 678 of file view.cpp.

{
    BOOL bMark = FALSE;

    if (view != NULL) {
   ViewEnter();
   if ( (row < view->rows) && (!view->bExpand)) {
       bMark = compitem_getmark(view->pItems[row]);
   }
   ViewLeave();
    }
    return(bMark);
}

long view_getrowcount ( VIEW view )

Definition at line 632 of file view.cpp.

{
        if (view == NULL) {
                return(0);
        }

        return(view->rows);
}

int view_getrowstate | ( | VIEW | view,
 |  | long | row
 | ) |  |

Definition at line 1166 of file view.cpp.

{
        int state;

        if (view == NULL) {
                return(0);
        }

        if (view->rows <= 0 || row >= view->rows) {
            return (STATE_SAME);
        }

        ViewEnter();

        state = section_getstate(view->pLines[row].section);

        ViewLeave();

        return state;
}

int view_getstate | ( | VIEW | view,
 |  | long | row
 | ) |  |

Definition at line 649 of file view.cpp.

{
        int state;

        if (view == NULL) {
                return(0);
        }

        ViewEnter();
        if (row >= view->rows) {
                state = 0;
        } else if (view->bExpand) {
                /* its a line state that's needed */
                state = section_getstate(view->pLines[row].section);
        } else {

                /* its a compitem state */
                state = compitem_getstate(view->pItems[row]);
        }
        ViewLeave();
        return(state);
}

LPSTR view_gettext | ( | VIEW | view,
 |  | long | row,
 |  | int | col
 | ) |  |

Definition at line 368 of file view.cpp.

{
        int line;
        int state;
        LPSTR pstr;
    HRESULT hr;

        pstr = NULL;   /* kill spurious diagnostic */
        if (view == NULL) {
                return (NULL);
        }

        ViewEnter();

        if (row >= view->rows) {
                ViewLeave();
                return(NULL);
        }

        if (view->bExpand) {
                /* we are in expand mode */

                state = section_getstate(view->pLines[row].section);

                switch(col) {
                case 0:
                        /* row nr */

                        /* line numbers can be from either original file
                         * this is a menu-selectable option
                         */
                        line = 0;
                        switch(line_numbers) {
                        case IDM_NONRS:
                                pstr = NULL;
                                break;

                        case IDM_LNRS:
                                line = view->pLines[row].nr_left;
                                if (state == STATE_MOVEDRIGHT
                                    || state == STATE_SIMILARRIGHT) {
                                        line = -line;
                                }
                                break;

                        case IDM_RNRS:
                                line = view->pLines[row].nr_right;
                                if (state == STATE_MOVEDLEFT
                                    || state == STATE_SIMILARLEFT) {
                                        line = -line;
                                }
                                break;
                        }
                        if (line == 0) {
                                ViewLeave();
                                return(NULL);
                        }

                        if (line < 0) {
                                /* lines that are moved appear twice.
                                 * show the correct-sequence line nr
                                 * for the out-of-seq. copy in brackets.
                                 */
                                hr = StringCchPrintf(view->nrtext, 12, "(%d)", abs(line));
                if (FAILED(hr)) {
                  OutputError(hr, IDS_SAFE_PRINTF);
                  return(NULL);
                }

                        } else  {
                                hr = StringCchPrintf(view->nrtext, 12, "%d", line);
                if (FAILED(hr)) {
                  OutputError(hr, IDS_SAFE_PRINTF);
                  return(NULL);
                }
                        }
                        pstr = view->nrtext;
                        break;

                case 1:
                        /* tag text - represents the state of the line */

                        switch(state) {
                        case STATE_SAME:
                                pstr = "    ";
                                break;

                        case STATE_LEFTONLY:
                        case STATE_SIMILARLEFT:
                                pstr = " <! ";
                                break;

                        case STATE_RIGHTONLY:
                        case STATE_SIMILARRIGHT:
                                pstr = " !> ";
                                break;

                        case STATE_MOVEDLEFT:
                                pstr = " <- ";
                                break;

                        case STATE_MOVEDRIGHT:
                                pstr = " -> ";
                                break;
                        }
                        break;

                case 2:
                        /* main text - line */
                        pstr = line_gettext(view->pLines[row].line);
                        break;
                }
        } else {
                /* outline mode */
                switch(col) {
                case 0:
                        /* row number - just the line number */
                        hr = StringCchPrintf(view->nrtext, 12, "%d", row+1);
            if (FAILED(hr)) {
              OutputError(hr, IDS_SAFE_PRINTF);
              return(NULL);
            }
                        pstr = view->nrtext;
                        break;

                case 1:
                        /* tag */
                        pstr = compitem_gettext_tag(view->pItems[row]);
                        break;

                case 2:
                        /* result text */
                        pstr = compitem_gettext_result(view->pItems[row]);
                        break;
                }
        }
        ViewLeave();
        return(pstr);
}

LPWSTR view_gettextW | ( | VIEW | view,
 |  | long | row,
 |  | int | col
 | ) |  |

Definition at line 516 of file view.cpp.

{
        int state;
        LPWSTR pwz;

        pwz = NULL;   /* kill spurious diagnostic */
        if (view == NULL) {
                return (NULL);
        }

        ViewEnter();

        if (row >= view->rows) {
                ViewLeave();
                return(NULL);
        }

        if (view->bExpand) {
                /* we are in expand mode */

                state = section_getstate(view->pLines[row].section);

                switch(col) {
                case 2:
                        /* main text - line */
                        pwz = line_gettextW(view->pLines[row].line);
                        break;
                }
        }
        ViewLeave();
        return(pwz);
}

int view_getwidth | ( | VIEW | view,
 |  | int | col
 | ) |  |

Definition at line 606 of file view.cpp.

{
        if (view == NULL) {
                return(0);
        }

        switch(col) {
        case 0:
                /* line nr column - always 5 characters wide */
                return(5);

        case 1:
                /* this is a proportional font field, so add on a margin
                 * for error
                 */
                return(view->maxtag + (view->maxtag / 20));
        case 2:
                /* this now includes the tab expansion allowance */
                return(view->maxrest);
        default:
                return(0);
        }
}

void view_gototableline | ( | VIEW | view,
 |  | LONG | iLine
 | ) |  |

Definition at line 1686 of file view.cpp.

{
  if (view)
    {
    const LONG cLines = view_getrowcount(view);
    if (iLine >= 0 && iLine < cLines)
      {
      TableSelection select;
      memset(&select, 0, sizeof(TableSelection));
      select.startrow = iLine;
      select.nrows    = 1L;
      select.ncells   = 1L;

      SendMessage(view_gethwnd(view), TM_SELECT, 0, (LPARAM) &select);
      }
    }
}

BOOL view_isexpanded ( VIEW view )

Definition at line 750 of file view.cpp.

{
        if (view == NULL) {
                return(FALSE);
        }
        return(view->bExpand);
}

VIEW view_new ( HWND hwndTable )

Definition at line 154 of file view.cpp.

{
        VIEW view;

#ifdef WIN32
        if (!bDoneInit) {
                InitializeCriticalSection(&CSView);
                bDoneInit = TRUE;
        }
#endif

        /* alloc the view using HeapAlloc */
        view = (VIEW) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct view));
    if (view == NULL)
      return NULL;
        /* set the default fields */
        view->hwnd = hwndTable;
        view->cl = NULL;
        view->bExpand = FALSE;
        view->bExpandGuard = FALSE;
        view->ciSelect = NULL;
        view->rows = 0;
        view->pItems = NULL;
        view->pLines = NULL;

    // erase the message in the names field - the central box in the status bar
    SetNames("");
        return(view);
}

BOOL view_newitem ( VIEW view )

Definition at line 801 of file view.cpp.

{
        int maxtag, maxrest;
        int rownr;
        TableSelection Select;
        BOOL bSelect;
        COMPITEM ciTop = NULL;
        BOOL bRedraw = FALSE;
        BOOL bAppend = FALSE;

        // get the top row before remapping in case we need it
        /* find the row at the top of the window */
        rownr = (long) SendMessage(view->hwnd, TM_TOPROW, FALSE, 0);
        // also remember the selection
        bSelect = (BOOL) SendMessage(view->hwnd, TM_GETSELECTION, 0, (LPARAM) &Select);

        // *important*:no critsec over SendMessage
        ViewEnter();

        if ((view != NULL) &&
            !(view->bExpand) &&
            !(view->bExpanding)) {

            /* save some state about the present mapping */
            maxtag = view->maxtag;
            maxrest = view->maxrest;

            // remember the compitem this corresponds to
            if (view->pItems && (rownr >= 0) && (rownr < view->rows)) {
                ciTop = view->pItems[rownr];
            }

            // re-do the outline mapping, but don't tell the table class.
            // ask it to check for the visible row closest to ciTop in case
            // we need to refresh the display
            //
            // since we are holding the critsec, the redraw param
            // *must* be false.
            view_outline_opt(view, FALSE, ciTop, &rownr);

            /* have the column widths changed ? */
            if ((maxtag < view->maxtag) || (maxrest < view->maxrest)) {
                /* yes - need complete redraw */
                bRedraw = TRUE;
            } else {
                bAppend = TRUE;
            }
        }

        ViewLeave();

        if (bRedraw) {

            /* switch to new mapping */
            SendMessage(view->hwnd, TM_NEWLAYOUT, 0, (LPARAM) view);

            // go to the visible row closest to the old top row
            if ((rownr >= 0) && (rownr < view->rows)) {
                SendMessage(view->hwnd, TM_TOPROW, TRUE, rownr);
            }

            // select the old selection too (if the table class allowed
            // us to get it)
            if (bSelect) {
                SendMessage(view->hwnd, TM_SELECT,0, (LPARAM) &Select);
            }

        } else if (bAppend) {
            /* we can just append */

            /*
             * in the WIN32 multiple threads case, the mapping may have
             * changed since we released the critsec. however we are still
             * safe. The table will not allow us to reduce the number of
             * rows, so the worst that can happen is that the table will
             * think there are too many rows, and the table message handler
             * will handle this correctly (return null for the text).
             * The only visible effect is therefore that the scrollbar
             * position is wrong.
             */

            SendMessage(view->hwnd, TM_APPEND, view->rows, (LPARAM) view);
        }

        return(Poll());
}

void view_outline ( VIEW )

Definition at line 308 of file view.cpp.

{
        if (view == NULL) {
                return;
        }

        /* all work done by view_outline_opt - this function
         * gives us the option of not updating the display
         */
        view_outline_opt(view, TRUE, NULL, NULL);
}

BOOL view_setcomplist | ( | VIEW | view,
 |  | COMPLIST | cl
 | ) |  |

Definition at line 202 of file view.cpp.

{
        LPSTR both;

        if (view == NULL) {
                return(FALSE);
        }

        /* there can be only one call to this per VIEW */
        if (view->cl != NULL) {
                return (FALSE);
        }

        ViewEnter();

        view->cl = cl;

        /* set names on status bar to root names of left and right trees */
        both = complist_getdescription(cl);
        ViewLeave();                      // LKGHACK
        SetNames(both);
        ViewEnter();                      // LKGHACK
        complist_freedescription(cl, both);

        ViewLeave();

        view_outline(view);
        return TRUE;
}

BOOL view_setmarkstate | ( | VIEW | view,
 |  | long | row,
 |  | BOOL | bMark
 | ) |  |

Definition at line 700 of file view.cpp.

{
    BOOL bOK = FALSE;

    if (view != NULL) {
   ViewEnter();
   if ( (row < view->rows) && !view->bExpand) {
       compitem_setmark(view->pItems[row], bMark);
       bOK = TRUE;
   }
   ViewLeave();
    }
    return (bOK);
}

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/sdkdiff/wdiffrc.h File Reference

  • Begin
  • sdkdiff
Defines

wdiffrc.h File Reference

Go to the source code of this file.

Defines

#define | IDC_BAR 510
#define | IDC_CHK_MATCHCASE 157
#define | IDC_CHK_WHOLEWORD 158
#define | IDC_DRD_FINDWHAT 154
#define | IDC_EDT_GOTOLINE 160
#define | IDC_OPT_DOWN 156
#define | IDC_OPT_UP 155
#define | IDC_RCDISP1 501
#define | IDC_STATIC -1
#define | IDC_STATUS 550
#define | IDC_USAGE_TEXT 171
#define | IDD_ATTRIBUTES 305
#define | IDD_AUTOCOPY 149
#define | IDD_BOTHREMOTE 150
#define | IDD_DIFFER 603
#define | IDD_DIR1 137
#define | IDD_DIR2 138
#define | IDD_FASTSCAN 148
#define | IDD_FILE 601
#define | IDD_FIND 153
#define | IDD_FROMGROUP 610
#define | IDD_FROMLEFT 611
#define | IDD_FROMRIGHT 612
#define | IDD_GOTOLINE 159
#define | IDD_ICON 132
#define | IDD_IDENTICAL 602
#define | IDD_IGNOREMARK 304
#define | IDD_LAB1 139
#define | IDD_LAB2 140
#define | IDD_LAB3 141
#define | IDD_LABEL 136
#define | IDD_LEFT 604
#define | IDD_LOGFILE 151
#define | IDD_LOGTEXT 152
#define | IDD_PASSWORD 146
#define | IDD_RECURSIVE 143
#define | IDD_RIGHT 605
#define | IDD_SERVER 145
#define | IDD_SUMS 147
#define | IDD_USAGE 170
#define | IDD_VERSION 133
#define | IDL_NAMES 553
#define | IDL_STATLAB 552
#define | IDM_ABORT 551
#define | IDM_ABOUT 131
#define | IDM_ALG2 199
#define | IDM_BOTHFILES 190
#define | IDM_CLOSE 161
#define | IDM_CONTENTS 130
#define | IDM_COPYFILES 127
#define | IDM_DIR 112
#define | IDM_EDITCOMP 125
#define | IDM_EDITCOPY 128
#define | IDM_EDITLEFT 123
#define | IDM_EDITRIGHT 124
#define | IDM_EXIT 115
#define | IDM_EXPAND 181
#define | IDM_EXPAND_INCLEFT 206
#define | IDM_EXPAND_INCMOVEDLEFT 208
#define | IDM_EXPAND_INCMOVEDRIGHT 209
#define | IDM_EXPAND_INCRIGHT 207
#define | IDM_EXPAND_INCSAME 205
#define | IDM_EXPAND_INCSIMILARLEFT 210
#define | IDM_EXPAND_INCSIMILARRIGHT 211
#define | IDM_FCHANGE 182
#define | IDM_FCHANGE_LAURIE 221
#define | IDM_FILE 111
#define | IDM_FIND 215
#define | IDM_FINDNEXT 216
#define | IDM_FINDPREV 217
#define | IDM_FPCHANGE 195
#define | IDM_FPCHANGE_LAURIE 222
#define | IDM_GOTOLINE 218
#define | IDM_HIDEMARK 302
#define | IDM_IGNBLANKS 196
#define | IDM_LAZY 198
#define | IDM_LNRS 185
#define | IDM_LONLY 188
#define | IDM_MARK 300
#define | IDM_MARKPATTERN 301
#define | IDM_MONOCOLS 212
#define | IDM_NONRS 187
#define | IDM_OPEN 121
#define | IDM_OUTLINE 180
#define | IDM_OUTLINE_INCDIFFER 204
#define | IDM_OUTLINE_INCLEFT 202
#define | IDM_OUTLINE_INCRIGHT 203
#define | IDM_OUTLINE_INCSAME 201
#define | IDM_PICTURE 197
#define | IDM_PRINT 113
#define | IDM_RESCAN 213
#define | IDM_RNRS 186
#define | IDM_RONLY 189
#define | IDM_SAVELIST 122
#define | IDM_SETEDIT 126
#define | IDM_SETFONT 220
#define | IDM_SETTABWIDTH 219
#define | IDM_SHOWWHITESPACE 214
#define | IDM_TABWIDTH4 223
#define | IDM_TABWIDTH8 224
#define | IDM_TIME 116
#define | IDM_TOGGLEMARK 303
#define | IDM_TOMOVED 310
#define | IDM_TRACE 117
#define | IDM_TRACEOFF 118
#define | IDM_UPDATE 194
#define | IDS_ABORT 704
#define | IDS_ABORT_PENDING 706
#define | IDS_BAD_ARGUMENT 656
#define | IDS_BAD_SD_INI 805
#define | IDS_BAD_TABWIDTH 804
#define | IDS_BOTH_UNREADABLE 721
#define | IDS_CANT_OPEN 660
#define | IDS_CANT_OPEN_TMP_FILE 655
#define | IDS_COMPARING 702
#define | IDS_COPY_ABORTED 669
#define | IDS_COPY_COMPLETE 671
#define | IDS_COPY_FAILED 670
#define | IDS_COPY_FILES 727
#define | IDS_COPYING 668
#define | IDS_COPYING_NFILES 720
#define | IDS_COULDNT_FIND 659
#define | IDS_COULDNT_FIND_ANYTHING 673
#define | IDS_CREATE_DIFF_LIST 710
#define | IDS_DIFF_BLANK_ONLY 715
#define | IDS_DIFFERENT 652
#define | IDS_DIFFERING 664
#define | IDS_EDITOR_COMMAND 712
#define | IDS_ENTER_DIR_NAME 666
#define | IDS_ENTER_PASSWORD 719
#define | IDS_ENTER_SUBSTRING1 716
#define | IDS_ENTER_SUBSTRING2 717
#define | IDS_ERR_OPENING_FILE 730
#define | IDS_ERROR_CANTLOADRICHEDIT 813
#define | IDS_ERROR_IARGS 811
#define | IDS_ERROR_IARGS_OPENFILE 812
#define | IDS_ERROR_L_OPTION 690
#define | IDS_ERROR_LD_OPTION 809
#define | IDS_ERROR_LO_UNC 807
#define | IDS_ERROR_OVSD_OPTION 808
#define | IDS_EXIT 672
#define | IDS_EXPAND 699
#define | IDS_FAILED_TO_COPY 667
#define | IDS_FAILED_TO_LAUNCH_EDT 701
#define | IDS_FILE_DOESNT_EXIST 700
#define | IDS_FILES_LISTED 665
#define | IDS_FIND_NOTFOUND 802
#define | IDS_GOTOLINE_INVALIDSTRING 800
#define | IDS_GOTOLINE_NOLINES 801
#define | IDS_HEADER_LINE_STR 713
#define | IDS_IDENTICAL 653
#define | IDS_IDENTICAL_COMMA 661
#define | IDS_IDENTICAL_TIMES 714
#define | IDS_IS_MORE_RECENT 725
#define | IDS_IS_READONLY 726
#define | IDS_LEFT_ONLY_COMMA 662
#define | IDS_LEFT_UNREADABLE 722
#define | IDS_LINE_NOT_VISIBLE 650
#define | IDS_MARK_FILES 718
#define | IDS_NO_MORE_CHANGES 696
#define | IDS_NO_PREV_CHANGES 697
#define | IDS_NOCOMPUNICODE 806
#define | IDS_NOTHING_RESCANNED 728
#define | IDS_NOTHING_TO_EDIT 729
#define | IDS_ONLY_IN 651
#define | IDS_OUTLINE 698
#define | IDS_PAGE 692
#define | IDS_PLEASE_WAIT 705
#define | IDS_RIGHT_ONLY_COMMA 663
#define | IDS_RIGHT_UNREADABLE 723
#define | IDS_SAME_SIZE 654
#define | IDS_SAVE_COMPFILE 731
#define | IDS_SCANNING 703
#define | IDS_SDKDIFF_ERROR 695
#define | IDS_SDKDIFF_USAGE 689
#define | IDS_SECONDS 707
#define | IDS_SELECT_FIRST_FILE 657
#define | IDS_SELECT_SECOND_FILE 658
#define | IDS_SENT_TO_PRINTER 693
#define | IDS_TABWIDTH 803
#define | IDS_TOOL_DESCRIPTION 711
#define | IDS_TRACING_DISABLED 709
#define | IDS_TRACING_ENABLED 708
#define | IDS_UNABLE_TO_PRINT 694
#define | IDS_UNREADABLE 724
#define | IDS_USAGE_STR00 732
#define | IDS_USAGE_STR01 733
#define | IDS_USAGE_STR02 734
#define | IDS_USAGE_STR03 735
#define | IDS_USAGE_STR04 736
#define | IDS_USAGE_STR05 737
#define | IDS_USAGE_STR06 738
#define | IDS_USAGE_STR07 739
#define | IDS_USAGE_STR08 740
#define | IDS_USAGE_STR08B 741
#define | IDS_USAGE_STR09 742
#define | IDS_USAGE_STR10 743
#define | IDS_USAGE_STR11 744
#define | IDS_USAGE_STR12 745
#define | IDS_USAGE_STR12B 746
#define | IDS_USAGE_STR12C 747
#define | IDS_USAGE_STR13 748
#define | IDS_USAGE_STR14 749
#define | IDS_USAGE_STR15 750
#define | IDS_USAGE_STR16 751
#define | IDS_USAGE_STR17 752
#define | IDS_USAGE_STR18 753
#define | IDS_USAGE_STR19 754
#define | IDS_USAGE_STR20 755
#define | IDS_USAGE_STR21 756
#define | IDS_USAGE_STR22 757
#define | IDS_USAGE_STR23 758
#define | IDS_USAGE_STR24 759
#define | IDS_USAGE_STR25 760
#define | IDS_USAGE_STR26 761

Define Documentation

#define IDC_BAR 510

Definition at line 115 of file wdiffrc.h.

#define IDC_CHK_MATCHCASE 157

Definition at line 55 of file wdiffrc.h.

#define IDC_CHK_WHOLEWORD 158

Definition at line 56 of file wdiffrc.h.

#define IDC_DRD_FINDWHAT 154

Definition at line 52 of file wdiffrc.h.

#define IDC_EDT_GOTOLINE 160

Definition at line 59 of file wdiffrc.h.

#define IDC_OPT_DOWN 156

Definition at line 54 of file wdiffrc.h.

#define IDC_OPT_UP 155

Definition at line 53 of file wdiffrc.h.

#define IDC_RCDISP1 501

Definition at line 114 of file wdiffrc.h.

#define IDC_STATIC -1

Definition at line 14 of file wdiffrc.h.

#define IDC_STATUS 550

Definition at line 116 of file wdiffrc.h.

#define IDC_USAGE_TEXT 171

Definition at line 64 of file wdiffrc.h.

#define IDD_ATTRIBUTES 305

Definition at line 111 of file wdiffrc.h.

#define IDD_AUTOCOPY 149

Definition at line 47 of file wdiffrc.h.

#define IDD_BOTHREMOTE 150

Definition at line 48 of file wdiffrc.h.

#define IDD_DIFFER 603

Definition at line 123 of file wdiffrc.h.

#define IDD_DIR1 137

Definition at line 37 of file wdiffrc.h.

#define IDD_DIR2 138

Definition at line 38 of file wdiffrc.h.

#define IDD_FASTSCAN 148

Definition at line 46 of file wdiffrc.h.

#define IDD_FILE 601

Definition at line 121 of file wdiffrc.h.

#define IDD_FIND 153

Definition at line 51 of file wdiffrc.h.

#define IDD_FROMGROUP 610

Definition at line 127 of file wdiffrc.h.

#define IDD_FROMLEFT 611

Definition at line 128 of file wdiffrc.h.

#define IDD_FROMRIGHT 612

Definition at line 129 of file wdiffrc.h.

#define IDD_GOTOLINE 159

Definition at line 58 of file wdiffrc.h.

#define IDD_ICON 132

Definition at line 34 of file wdiffrc.h.

#define IDD_IDENTICAL 602

Definition at line 122 of file wdiffrc.h.

#define IDD_IGNOREMARK 304

Definition at line 110 of file wdiffrc.h.

#define IDD_LAB1 139

Definition at line 39 of file wdiffrc.h.

#define IDD_LAB2 140

Definition at line 40 of file wdiffrc.h.

#define IDD_LAB3 141

Definition at line 41 of file wdiffrc.h.

#define IDD_LABEL 136

Definition at line 36 of file wdiffrc.h.

#define IDD_LEFT 604

Definition at line 124 of file wdiffrc.h.

#define IDD_LOGFILE 151

Definition at line 49 of file wdiffrc.h.

#define IDD_LOGTEXT 152

Definition at line 50 of file wdiffrc.h.

#define IDD_PASSWORD 146

Definition at line 44 of file wdiffrc.h.

#define IDD_RECURSIVE 143

Definition at line 42 of file wdiffrc.h.

#define IDD_RIGHT 605

Definition at line 125 of file wdiffrc.h.

#define IDD_SERVER 145

Definition at line 43 of file wdiffrc.h.

#define IDD_SUMS 147

Definition at line 45 of file wdiffrc.h.

#define IDD_USAGE 170

Definition at line 63 of file wdiffrc.h.

#define IDD_VERSION 133

Definition at line 35 of file wdiffrc.h.

#define IDL_NAMES 553

Definition at line 119 of file wdiffrc.h.

#define IDL_STATLAB 552

Definition at line 118 of file wdiffrc.h.

#define IDM_ABORT 551

Definition at line 117 of file wdiffrc.h.

#define IDM_ABOUT 131

Definition at line 33 of file wdiffrc.h.

#define IDM_ALG2 199

Definition at line 80 of file wdiffrc.h.

#define IDM_BOTHFILES 190

Definition at line 74 of file wdiffrc.h.

#define IDM_CLOSE 161

Definition at line 61 of file wdiffrc.h.

#define IDM_CONTENTS 130

Definition at line 32 of file wdiffrc.h.

#define IDM_COPYFILES 127

Definition at line 29 of file wdiffrc.h.

#define IDM_DIR 112

Definition at line 17 of file wdiffrc.h.

#define IDM_EDITCOMP 125

Definition at line 27 of file wdiffrc.h.

#define IDM_EDITCOPY 128

Definition at line 30 of file wdiffrc.h.

#define IDM_EDITLEFT 123

Definition at line 25 of file wdiffrc.h.

#define IDM_EDITRIGHT 124

Definition at line 26 of file wdiffrc.h.

#define IDM_EXIT 115

Definition at line 19 of file wdiffrc.h.

#define IDM_EXPAND 181

Definition at line 67 of file wdiffrc.h.

#define IDM_EXPAND_INCLEFT 206

Definition at line 86 of file wdiffrc.h.

#define IDM_EXPAND_INCMOVEDLEFT 208

Definition at line 88 of file wdiffrc.h.

#define IDM_EXPAND_INCMOVEDRIGHT 209

Definition at line 89 of file wdiffrc.h.

#define IDM_EXPAND_INCRIGHT 207

Definition at line 87 of file wdiffrc.h.

#define IDM_EXPAND_INCSAME 205

Definition at line 85 of file wdiffrc.h.

#define IDM_EXPAND_INCSIMILARLEFT 210

Definition at line 90 of file wdiffrc.h.

#define IDM_EXPAND_INCSIMILARRIGHT 211

Definition at line 91 of file wdiffrc.h.

#define IDM_FCHANGE 182

Definition at line 68 of file wdiffrc.h.

#define IDM_FCHANGE_LAURIE 221

Definition at line 101 of file wdiffrc.h.

#define IDM_FILE 111

Definition at line 16 of file wdiffrc.h.

#define IDM_FIND 215

Definition at line 95 of file wdiffrc.h.

#define IDM_FINDNEXT 216

Definition at line 96 of file wdiffrc.h.

#define IDM_FINDPREV 217

Definition at line 97 of file wdiffrc.h.

#define IDM_FPCHANGE 195

Definition at line 76 of file wdiffrc.h.

#define IDM_FPCHANGE_LAURIE 222

Definition at line 102 of file wdiffrc.h.

#define IDM_GOTOLINE 218

Definition at line 98 of file wdiffrc.h.

#define IDM_HIDEMARK 302

Definition at line 108 of file wdiffrc.h.

#define IDM_IGNBLANKS 196

Definition at line 77 of file wdiffrc.h.

#define IDM_LAZY 198

Definition at line 79 of file wdiffrc.h.

#define IDM_LNRS 185

Definition at line 69 of file wdiffrc.h.

#define IDM_LONLY 188

Definition at line 72 of file wdiffrc.h.

#define IDM_MARK 300

Definition at line 106 of file wdiffrc.h.

#define IDM_MARKPATTERN 301

Definition at line 107 of file wdiffrc.h.

#define IDM_MONOCOLS 212

Definition at line 92 of file wdiffrc.h.

#define IDM_NONRS 187

Definition at line 71 of file wdiffrc.h.

#define IDM_OPEN 121

Definition at line 23 of file wdiffrc.h.

#define IDM_OUTLINE 180

Definition at line 66 of file wdiffrc.h.

#define IDM_OUTLINE_INCDIFFER 204

Definition at line 84 of file wdiffrc.h.

#define IDM_OUTLINE_INCLEFT 202

Definition at line 82 of file wdiffrc.h.

#define IDM_OUTLINE_INCRIGHT 203

Definition at line 83 of file wdiffrc.h.

#define IDM_OUTLINE_INCSAME 201

Definition at line 81 of file wdiffrc.h.

#define IDM_PICTURE 197

Definition at line 78 of file wdiffrc.h.

#define IDM_PRINT 113

Definition at line 18 of file wdiffrc.h.

#define IDM_RESCAN 213

Definition at line 93 of file wdiffrc.h.

#define IDM_RNRS 186

Definition at line 70 of file wdiffrc.h.

#define IDM_RONLY 189

Definition at line 73 of file wdiffrc.h.

#define IDM_SAVELIST 122

Definition at line 24 of file wdiffrc.h.

#define IDM_SETEDIT 126

Definition at line 28 of file wdiffrc.h.

#define IDM_SETFONT 220

Definition at line 100 of file wdiffrc.h.

#define IDM_SETTABWIDTH 219

Definition at line 99 of file wdiffrc.h.

#define IDM_SHOWWHITESPACE 214

Definition at line 94 of file wdiffrc.h.

#define IDM_TABWIDTH4 223

Definition at line 103 of file wdiffrc.h.

#define IDM_TABWIDTH8 224

Definition at line 104 of file wdiffrc.h.

#define IDM_TIME 116

Definition at line 20 of file wdiffrc.h.

#define IDM_TOGGLEMARK 303

Definition at line 109 of file wdiffrc.h.

#define IDM_TOMOVED 310

Definition at line 112 of file wdiffrc.h.

#define IDM_TRACE 117

Definition at line 21 of file wdiffrc.h.

#define IDM_TRACEOFF 118

Definition at line 22 of file wdiffrc.h.

#define IDM_UPDATE 194

Definition at line 75 of file wdiffrc.h.

#define IDS_ABORT 704

Definition at line 169 of file wdiffrc.h.

#define IDS_ABORT_PENDING 706

Definition at line 171 of file wdiffrc.h.

#define IDS_BAD_ARGUMENT 656

Definition at line 137 of file wdiffrc.h.

#define IDS_BAD_SD_INI 805

Definition at line 234 of file wdiffrc.h.

#define IDS_BAD_TABWIDTH 804

Definition at line 233 of file wdiffrc.h.

#define IDS_BOTH_UNREADABLE 721

Definition at line 186 of file wdiffrc.h.

#define IDS_CANT_OPEN 660

Definition at line 141 of file wdiffrc.h.

#define IDS_CANT_OPEN_TMP_FILE 655

Definition at line 136 of file wdiffrc.h.

#define IDS_COMPARING 702

Definition at line 167 of file wdiffrc.h.

#define IDS_COPY_ABORTED 669

Definition at line 150 of file wdiffrc.h.

#define IDS_COPY_COMPLETE 671

Definition at line 152 of file wdiffrc.h.

#define IDS_COPY_FAILED 670

Definition at line 151 of file wdiffrc.h.

#define IDS_COPY_FILES 727

Definition at line 192 of file wdiffrc.h.

#define IDS_COPYING 668

Definition at line 149 of file wdiffrc.h.

#define IDS_COPYING_NFILES 720

Definition at line 185 of file wdiffrc.h.

#define IDS_COULDNT_FIND 659

Definition at line 140 of file wdiffrc.h.

#define IDS_COULDNT_FIND_ANYTHING 673

Definition at line 154 of file wdiffrc.h.

#define IDS_CREATE_DIFF_LIST 710

Definition at line 175 of file wdiffrc.h.

#define IDS_DIFF_BLANK_ONLY 715

Definition at line 180 of file wdiffrc.h.

#define IDS_DIFFERENT 652

Definition at line 133 of file wdiffrc.h.

#define IDS_DIFFERING 664

Definition at line 145 of file wdiffrc.h.

#define IDS_EDITOR_COMMAND 712

Definition at line 177 of file wdiffrc.h.

#define IDS_ENTER_DIR_NAME 666

Definition at line 147 of file wdiffrc.h.

#define IDS_ENTER_PASSWORD 719

Definition at line 184 of file wdiffrc.h.

#define IDS_ENTER_SUBSTRING1 716

Definition at line 181 of file wdiffrc.h.

#define IDS_ENTER_SUBSTRING2 717

Definition at line 182 of file wdiffrc.h.

#define IDS_ERR_OPENING_FILE 730

Definition at line 195 of file wdiffrc.h.

#define IDS_ERROR_CANTLOADRICHEDIT 813

Definition at line 242 of file wdiffrc.h.

#define IDS_ERROR_IARGS 811

Definition at line 240 of file wdiffrc.h.

#define IDS_ERROR_IARGS_OPENFILE 812

Definition at line 241 of file wdiffrc.h.

#define IDS_ERROR_L_OPTION 690

Definition at line 156 of file wdiffrc.h.

#define IDS_ERROR_LD_OPTION 809

Definition at line 238 of file wdiffrc.h.

#define IDS_ERROR_LO_UNC 807

Definition at line 236 of file wdiffrc.h.

#define IDS_ERROR_OVSD_OPTION 808

Definition at line 237 of file wdiffrc.h.

#define IDS_EXIT 672

Definition at line 153 of file wdiffrc.h.

#define IDS_EXPAND 699

Definition at line 164 of file wdiffrc.h.

#define IDS_FAILED_TO_COPY 667

Definition at line 148 of file wdiffrc.h.

#define IDS_FAILED_TO_LAUNCH_EDT 701

Definition at line 166 of file wdiffrc.h.

#define IDS_FILE_DOESNT_EXIST 700

Definition at line 165 of file wdiffrc.h.

#define IDS_FILES_LISTED 665

Definition at line 146 of file wdiffrc.h.

#define IDS_FIND_NOTFOUND 802

Definition at line 231 of file wdiffrc.h.

#define IDS_GOTOLINE_INVALIDSTRING 800

Definition at line 229 of file wdiffrc.h.

#define IDS_GOTOLINE_NOLINES 801

Definition at line 230 of file wdiffrc.h.

#define IDS_HEADER_LINE_STR 713

Definition at line 178 of file wdiffrc.h.

#define IDS_IDENTICAL 653

Definition at line 134 of file wdiffrc.h.

#define IDS_IDENTICAL_COMMA 661

Definition at line 142 of file wdiffrc.h.

#define IDS_IDENTICAL_TIMES 714

Definition at line 179 of file wdiffrc.h.

#define IDS_IS_MORE_RECENT 725

Definition at line 190 of file wdiffrc.h.

#define IDS_IS_READONLY 726

Definition at line 191 of file wdiffrc.h.

#define IDS_LEFT_ONLY_COMMA 662

Definition at line 143 of file wdiffrc.h.

#define IDS_LEFT_UNREADABLE 722

Definition at line 187 of file wdiffrc.h.

#define IDS_LINE_NOT_VISIBLE 650

Definition at line 131 of file wdiffrc.h.

#define IDS_MARK_FILES 718

Definition at line 183 of file wdiffrc.h.

#define IDS_NO_MORE_CHANGES 696

Definition at line 161 of file wdiffrc.h.

#define IDS_NO_PREV_CHANGES 697

Definition at line 162 of file wdiffrc.h.

#define IDS_NOCOMPUNICODE 806

Definition at line 235 of file wdiffrc.h.

#define IDS_NOTHING_RESCANNED 728

Definition at line 193 of file wdiffrc.h.

#define IDS_NOTHING_TO_EDIT 729

Definition at line 194 of file wdiffrc.h.

#define IDS_ONLY_IN 651

Definition at line 132 of file wdiffrc.h.

#define IDS_OUTLINE 698

Definition at line 163 of file wdiffrc.h.

#define IDS_PAGE 692

Definition at line 157 of file wdiffrc.h.

#define IDS_PLEASE_WAIT 705

Definition at line 170 of file wdiffrc.h.

#define IDS_RIGHT_ONLY_COMMA 663

Definition at line 144 of file wdiffrc.h.

#define IDS_RIGHT_UNREADABLE 723

Definition at line 188 of file wdiffrc.h.

#define IDS_SAME_SIZE 654

Definition at line 135 of file wdiffrc.h.

#define IDS_SAVE_COMPFILE 731

Definition at line 196 of file wdiffrc.h.

#define IDS_SCANNING 703

Definition at line 168 of file wdiffrc.h.

#define IDS_SDKDIFF_ERROR 695

Definition at line 160 of file wdiffrc.h.

#define IDS_SDKDIFF_USAGE 689

Definition at line 155 of file wdiffrc.h.

#define IDS_SECONDS 707

Definition at line 172 of file wdiffrc.h.

#define IDS_SELECT_FIRST_FILE 657

Definition at line 138 of file wdiffrc.h.

#define IDS_SELECT_SECOND_FILE 658

Definition at line 139 of file wdiffrc.h.

#define IDS_SENT_TO_PRINTER 693

Definition at line 158 of file wdiffrc.h.

#define IDS_TABWIDTH 803

Definition at line 232 of file wdiffrc.h.

#define IDS_TOOL_DESCRIPTION 711

Definition at line 176 of file wdiffrc.h.

#define IDS_TRACING_DISABLED 709

Definition at line 174 of file wdiffrc.h.

#define IDS_TRACING_ENABLED 708

Definition at line 173 of file wdiffrc.h.

#define IDS_UNABLE_TO_PRINT 694

Definition at line 159 of file wdiffrc.h.

#define IDS_UNREADABLE 724

Definition at line 189 of file wdiffrc.h.

#define IDS_USAGE_STR00 732

Definition at line 198 of file wdiffrc.h.

#define IDS_USAGE_STR01 733

Definition at line 199 of file wdiffrc.h.

#define IDS_USAGE_STR02 734

Definition at line 200 of file wdiffrc.h.

#define IDS_USAGE_STR03 735

Definition at line 201 of file wdiffrc.h.

#define IDS_USAGE_STR04 736

Definition at line 202 of file wdiffrc.h.

#define IDS_USAGE_STR05 737

Definition at line 203 of file wdiffrc.h.

#define IDS_USAGE_STR06 738

Definition at line 204 of file wdiffrc.h.

#define IDS_USAGE_STR07 739

Definition at line 205 of file wdiffrc.h.

#define IDS_USAGE_STR08 740

Definition at line 206 of file wdiffrc.h.

#define IDS_USAGE_STR08B 741

Definition at line 207 of file wdiffrc.h.

#define IDS_USAGE_STR09 742

Definition at line 208 of file wdiffrc.h.

#define IDS_USAGE_STR10 743

Definition at line 209 of file wdiffrc.h.

#define IDS_USAGE_STR11 744

Definition at line 210 of file wdiffrc.h.

#define IDS_USAGE_STR12 745

Definition at line 211 of file wdiffrc.h.

#define IDS_USAGE_STR12B 746

Definition at line 212 of file wdiffrc.h.

#define IDS_USAGE_STR12C 747

Definition at line 213 of file wdiffrc.h.

#define IDS_USAGE_STR13 748

Definition at line 214 of file wdiffrc.h.

#define IDS_USAGE_STR14 749

Definition at line 215 of file wdiffrc.h.

#define IDS_USAGE_STR15 750

Definition at line 216 of file wdiffrc.h.

#define IDS_USAGE_STR16 751

Definition at line 217 of file wdiffrc.h.

#define IDS_USAGE_STR17 752

Definition at line 218 of file wdiffrc.h.

#define IDS_USAGE_STR18 753

Definition at line 219 of file wdiffrc.h.

#define IDS_USAGE_STR19 754

Definition at line 220 of file wdiffrc.h.

#define IDS_USAGE_STR20 755

Definition at line 221 of file wdiffrc.h.

#define IDS_USAGE_STR21 756

Definition at line 222 of file wdiffrc.h.

#define IDS_USAGE_STR22 757

Definition at line 223 of file wdiffrc.h.

#define IDS_USAGE_STR23 758

Definition at line 224 of file wdiffrc.h.

#define IDS_USAGE_STR24 759

Definition at line 225 of file wdiffrc.h.

#define IDS_USAGE_STR25 760

Definition at line 226 of file wdiffrc.h.

#define IDS_USAGE_STR26 761

Definition at line 227 of file wdiffrc.h.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Begin/Simple/Simple.c File Reference

  • Begin
  • Simple
Functions

Simple.c File Reference

#include <stdio.h>

Go to the source code of this file.

Functions

main ()

Function Documentation

main ( void )

Definition at line 14 of file Simple.c.

{
#ifdef JAPAN
        printf ("‚v‚‰‚Ž‚R‚QA‚±‚ê‚ÍŽ–Œ‚¾I");
#else
        printf ("Win32, it's happenin'!");
#endif

        return(0);
}

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Explore.VC/AppExportDlg.Cpp File Reference

  • Com
  • Administration
  • Explore.VC
Defines

AppExportDlg.Cpp File Reference

#include "stdafx.h"
#include "VCExplore.h"
#include "AppExportDlg.h"
#include <comdef.h>

Go to the source code of this file.

Defines

#define | EXPORT_TYPE_UNDEFINED -1
#define | EXPORT_TYPE_WITH_CLIENTS 2
#define | EXPORT_TYPE_WITH_USERS 1
#define | EXPORT_TYPE_WITHOUT_USERS 0

Define Documentation

#define EXPORT_TYPE_UNDEFINED -1

Definition at line 32 of file AppExportDlg.Cpp.

#define EXPORT_TYPE_WITH_CLIENTS 2

Definition at line 35 of file AppExportDlg.Cpp.

#define EXPORT_TYPE_WITH_USERS 1

Definition at line 34 of file AppExportDlg.Cpp.

#define EXPORT_TYPE_WITHOUT_USERS 0

Definition at line 33 of file AppExportDlg.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Explore.VC/AppExportDlg.h File Reference

  • Com
  • Administration
  • Explore.VC
Classes

AppExportDlg.h File Reference

Go to the source code of this file.

Classes

class CAppExportDlg
Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Explore.VC/AppInstallDlg.Cpp File Reference

  • Com
  • Administration
  • Explore.VC
Defines

AppInstallDlg.Cpp File Reference

#include "stdafx.h"
#include "VCExplore.h"
#include "AppInstallDlg.h"

Go to the source code of this file.

Defines

#define | APP_INSTALL_TYPE_UNDEFINED -1
#define | APP_INSTALL_TYPE_WITH_USERS 1
#define | APP_INSTALL_TYPE_WITHOUT_USERS 0

Define Documentation

#define APP_INSTALL_TYPE_UNDEFINED -1

Definition at line 30 of file AppInstallDlg.Cpp.

#define APP_INSTALL_TYPE_WITH_USERS 1

Definition at line 32 of file AppInstallDlg.Cpp.

#define APP_INSTALL_TYPE_WITHOUT_USERS 0

Definition at line 31 of file AppInstallDlg.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Explore.VC/AppInstallDlg.h File Reference

  • Com
  • Administration
  • Explore.VC
Classes

AppInstallDlg.h File Reference

Go to the source code of this file.

Classes

class CAppInstallDlg
Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Explore.VC/AppUtilDlg.Cpp File Reference

  • Com
  • Administration
  • Explore.VC

AppUtilDlg.Cpp File Reference

#include "stdafx.h"
#include "VCExplore.h"
#include "AppUtilDlg.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Explore.VC/AppUtilDlg.h File Reference

  • Com
  • Administration
  • Explore.VC
Classes | Defines

AppUtilDlg.h File Reference

Go to the source code of this file.

Classes

class | CAppUtilDlg

Defines

#define | UTILITY_TYPE_START_APP 0
#define | UTILITY_TYPE_STOP_APP 1
#define | UTILITY_TYPE_UNDEFINED -1

Define Documentation

#define UTILITY_TYPE_START_APP 0

Definition at line 30 of file AppUtilDlg.h.

#define UTILITY_TYPE_STOP_APP 1

Definition at line 31 of file AppUtilDlg.h.

#define UTILITY_TYPE_UNDEFINED -1

Definition at line 29 of file AppUtilDlg.h.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Explore.VC/CompImportDlg.Cpp File Reference

  • Com
  • Administration
  • Explore.VC
Defines

CompImportDlg.Cpp File Reference

#include "stdafx.h"
#include "VCExplore.h"
#include "CompImportDlg.h"

Go to the source code of this file.

Defines

#define | IMPORT_TYPE_CLSID 1
#define | IMPORT_TYPE_PROGID 0
#define | IMPORT_TYPE_UNDEFINED -1

Define Documentation

#define IMPORT_TYPE_CLSID 1

Definition at line 33 of file CompImportDlg.Cpp.

#define IMPORT_TYPE_PROGID 0

Definition at line 32 of file CompImportDlg.Cpp.

#define IMPORT_TYPE_UNDEFINED -1

Definition at line 31 of file CompImportDlg.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Explore.VC/CompImportDlg.h File Reference

  • Com
  • Administration
  • Explore.VC
Classes

CompImportDlg.h File Reference

Go to the source code of this file.

Classes

class CCompImportDlg
Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Explore.VC/CompInstallDlg.Cpp File Reference

  • Com
  • Administration
  • Explore.VC

CompInstallDlg.Cpp File Reference

#include "stdafx.h"
#include "VCExplore.h"
#include "CompInstallDlg.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Explore.VC/CompInstallDlg.h File Reference

  • Com
  • Administration
  • Explore.VC
Classes

CompInstallDlg.h File Reference

Go to the source code of this file.

Classes

class CCompInstallDlg
Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Explore.VC/ConnectDlg.Cpp File Reference

  • Com
  • Administration
  • Explore.VC
Defines

ConnectDlg.Cpp File Reference

#include "stdafx.h"
#include "VCExplore.h"
#include "ConnectDlg.h"

Go to the source code of this file.

Defines

#define | CONNECTION_TYPE_LOCAL 0
#define | CONNECTION_TYPE_REMOTE 1
#define | CONNECTION_TYPE_UNDEFINED -1

Define Documentation

#define CONNECTION_TYPE_LOCAL 0

Definition at line 34 of file ConnectDlg.Cpp.

#define CONNECTION_TYPE_REMOTE 1

Definition at line 35 of file ConnectDlg.Cpp.

#define CONNECTION_TYPE_UNDEFINED -1

Definition at line 33 of file ConnectDlg.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Explore.VC/ConnectDlg.h File Reference

  • Com
  • Administration
  • Explore.VC
Classes

ConnectDlg.h File Reference

#include "VCExploreDlg.h"

Go to the source code of this file.

Classes

class CConnectDlg
Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Explore.VC/Resource.h File Reference

  • Com
  • Administration
  • Explore.VC
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | ID_TBTN_ABOUT 32784
#define | ID_TBTN_CONNECT 32772
#define | ID_TBTN_DELETE 32776
#define | ID_TBTN_EXPORT_APP 32780
#define | ID_TBTN_IMPORT_COMPONENT 32782
#define | ID_TBTN_INSTALL_APP 32779
#define | ID_TBTN_INSTALL_COMPONENT 32781
#define | ID_TBTN_NEW 32774
#define | ID_TBTN_REFRESH 32773
#define | ID_TBTN_SAVE 32775
#define | ID_TBTN_START_APP 32777
#define | ID_TBTN_STOP_APP 32778
#define | ID_TBTN_UTILITY 32783
#define | IDC_APPLICATION_COPYRIGHT 1053
#define | IDC_APPLICATION_ICON 1054
#define | IDC_APPLICATION_TITLE 1051
#define | IDC_APPLICATION_VERSION 1052
#define | IDC_BUTTON_APPLICATION_FILE_SEARCH 1036
#define | IDC_BUTTON_APPLICATON_ID_SEARCH 1037
#define | IDC_BUTTON_COMPONENT_SEARCH 1042
#define | IDC_BUTTON_EXPORT_PATH_SEARCH 1028
#define | IDC_BUTTON_INSTALL_DIRECTORY_SEARCH 1031
#define | IDC_BUTTON_PROXY_STUB_DLL 1048
#define | IDC_BUTTON_SET_PROPERTY 1017
#define | IDC_BUTTON_TYPE_LIBRARY 1045
#define | IDC_CHECK_OVERWRITE_FILES 1022
#define | IDC_CHECK_REMOTE_SERVER_INSTALL 1023
#define | IDC_COMBO_APPLICATION 1039
#define | IDC_EDIT_APPLICATION_FILE 1033
#define | IDC_EDIT_APPLICATION_ID 1050
#define | IDC_EDIT_APPLICATION_ID_VALUE 1024
#define | IDC_EDIT_COMPONENT 1041
#define | IDC_EDIT_EXPORT_PATH 1026
#define | IDC_EDIT_INSTALL_DIRECTORY 1035
#define | IDC_EDIT_PROPERTY_VALUE 1016
#define | IDC_EDIT_PROXY_STUB_DLL 1047
#define | IDC_EDIT_PWD 1042
#define | IDC_EDIT_REMOTE_COMPUTER_NAME 1060
#define | IDC_EDIT_REMOTE_SERVER_NAME 1038
#define | IDC_EDIT_TYPE_LIBRARY 1044
#define | IDC_EDIT_UID 1040
#define | IDC_FRAME_CATALOG_INFO 1001
#define | IDC_FRAME_EXPORT_CLIENT_ONLY 1018
#define | IDC_FRAME_IMPORT_BY 1055
#define | IDC_FRAME_INSTALL_OPTIONS 1028
#define | IDC_FRAME_OBJECTS_AND_PROP_INFO 1010
#define | IDC_FRAME_PREVIOUS_COLLECTIONS 1008
#define | IDC_FRAME_RELATED_COLLECTIONS 1006
#define | IDC_FRAME_UTILITY_OPTIONS 1056
#define | IDC_FRAME_UTILITY_TYPE 1066
#define | IDC_LABEL_APPLICATION 1038
#define | IDC_LABEL_APPLICATION_FILE 1032
#define | IDC_LABEL_APPLICATION_ID 1049
#define | IDC_LABEL_COLLECTION_NAME_DESC 1004
#define | IDC_LABEL_COLLECTION_NAME_VALUE 1005
#define | IDC_LABEL_COMPONENT 1040
#define | IDC_LABEL_COMPUTER_NAME_DESC 1002
#define | IDC_LABEL_COMPUTER_NAME_VALUE 1003
#define | IDC_LABEL_EXPORT_PATH 1025
#define | IDC_LABEL_INSTALL_DIRECTORY 1034
#define | IDC_LABEL_OBJECTS_DESC 1011
#define | IDC_LABEL_PROPERTIES_DESC2 1012
#define | IDC_LABEL_PROPERTY_VALUE_DESC 1015
#define | IDC_LABEL_PROXY_STUB_DLL 1046
#define | IDC_LABEL_PWD 1041
#define | IDC_LABEL_REMOTE_SERVER_NAME 1037
#define | IDC_LABEL_TYPE_LIBRARY 1043
#define | IDC_LABEL_UID 1039
#define | IDC_LIST_OBJECTS 1013
#define | IDC_LIST_PARENT_COLLECTIONS 1009
#define | IDC_LIST_PROPERTIES 1014
#define | IDC_LIST_RELATED_COLLECTIONS 1007
#define | IDC_RADIO_CLSID 1057
#define | IDC_RADIO_DO_NOT_EXPORT_USERS 1019
#define | IDC_RADIO_EXPORT_CLIENTS 1021
#define | IDC_RADIO_EXPORT_USERS 1020
#define | IDC_RADIO_INSTALL_WITH_USERS 1030
#define | IDC_RADIO_INSTALL_WITHOUT_USERS 1029
#define | IDC_RADIO_JNEC 1062
#define | IDC_RADIO_PROG_ID 1056
#define | IDC_RADIO_REFRESH 1065
#define | IDC_RADIO_REMOTE_COMPUTER 1059
#define | IDC_RADIO_ROUTER 1061
#define | IDC_RADIO_START 1063
#define | IDC_RADIO_STOP 1064
#define | IDC_RADIO_THIS_COMPUTER 1058
#define | IDD_ABOUTBOX 100
#define | IDD_APP_UTILITY 134
#define | IDD_CONNECT 137
#define | IDD_EXPORT_APPLICATION 132
#define | IDD_IMPORT_COMPONENT 136
#define | IDD_INSTALL_APPLICATION 133
#define | IDD_INSTALL_COMPONENT 135
#define | IDD_UTILITIES 138
#define | IDD_VCEXPLORE 102
#define | IDD_VCEXPLORE_DIALOG 102
#define | IDI_APP_ICON 145
#define | IDI_CONNECT 150
#define | IDI_EXPORT 155
#define | IDI_IMPORT 152
#define | IDI_INSTALL 151
#define | IDI_LOGO 131
#define | IDI_START 153
#define | IDI_STOP 154
#define | IDI_UTILITIES 149
#define | IDM_ABOUTBOX 0x0010
#define | IDR_MAINFRAME 128
#define | IDR_TOOLBAR_MAIN 143
#define | IDS_ABOUTBOX 101

Define Documentation

#define ID_TBTN_ABOUT 32784

Definition at line 125 of file Resource.h.

#define ID_TBTN_CONNECT 32772

Definition at line 113 of file Resource.h.

#define ID_TBTN_DELETE 32776

Definition at line 117 of file Resource.h.

#define ID_TBTN_EXPORT_APP 32780

Definition at line 121 of file Resource.h.

#define ID_TBTN_IMPORT_COMPONENT 32782

Definition at line 123 of file Resource.h.

#define ID_TBTN_INSTALL_APP 32779

Definition at line 120 of file Resource.h.

#define ID_TBTN_INSTALL_COMPONENT 32781

Definition at line 122 of file Resource.h.

#define ID_TBTN_NEW 32774

Definition at line 115 of file Resource.h.

#define ID_TBTN_REFRESH 32773

Definition at line 114 of file Resource.h.

#define ID_TBTN_SAVE 32775

Definition at line 116 of file Resource.h.

#define ID_TBTN_START_APP 32777

Definition at line 118 of file Resource.h.

#define ID_TBTN_STOP_APP 32778

Definition at line 119 of file Resource.h.

#define ID_TBTN_UTILITY 32783

Definition at line 124 of file Resource.h.

#define IDC_APPLICATION_COPYRIGHT 1053

Definition at line 98 of file Resource.h.

#define IDC_APPLICATION_ICON 1054

Definition at line 99 of file Resource.h.

#define IDC_APPLICATION_TITLE 1051

Definition at line 96 of file Resource.h.

#define IDC_APPLICATION_VERSION 1052

Definition at line 97 of file Resource.h.

#define IDC_BUTTON_APPLICATION_FILE_SEARCH 1036

Definition at line 75 of file Resource.h.

#define IDC_BUTTON_APPLICATON_ID_SEARCH 1037

Definition at line 76 of file Resource.h.

#define IDC_BUTTON_COMPONENT_SEARCH 1042

Definition at line 86 of file Resource.h.

#define IDC_BUTTON_EXPORT_PATH_SEARCH 1028

Definition at line 66 of file Resource.h.

#define IDC_BUTTON_INSTALL_DIRECTORY_SEARCH 1031

Definition at line 70 of file Resource.h.

#define IDC_BUTTON_PROXY_STUB_DLL 1048

Definition at line 93 of file Resource.h.

#define IDC_BUTTON_SET_PROPERTY 1017

Definition at line 56 of file Resource.h.

#define IDC_BUTTON_TYPE_LIBRARY 1045

Definition at line 90 of file Resource.h.

#define IDC_CHECK_OVERWRITE_FILES 1022

Definition at line 61 of file Resource.h.

#define IDC_CHECK_REMOTE_SERVER_INSTALL 1023

Definition at line 62 of file Resource.h.

#define IDC_COMBO_APPLICATION 1039

Definition at line 80 of file Resource.h.

#define IDC_EDIT_APPLICATION_FILE 1033

Definition at line 72 of file Resource.h.

#define IDC_EDIT_APPLICATION_ID 1050

Definition at line 95 of file Resource.h.

#define IDC_EDIT_APPLICATION_ID_VALUE 1024

Definition at line 63 of file Resource.h.

#define IDC_EDIT_COMPONENT 1041

Definition at line 84 of file Resource.h.

#define IDC_EDIT_EXPORT_PATH 1026

Definition at line 65 of file Resource.h.

#define IDC_EDIT_INSTALL_DIRECTORY 1035

Definition at line 74 of file Resource.h.

#define IDC_EDIT_PROPERTY_VALUE 1016

Definition at line 55 of file Resource.h.

#define IDC_EDIT_PROXY_STUB_DLL 1047

Definition at line 92 of file Resource.h.

#define IDC_EDIT_PWD 1042

Definition at line 87 of file Resource.h.

#define IDC_EDIT_REMOTE_COMPUTER_NAME 1060

Definition at line 106 of file Resource.h.

#define IDC_EDIT_REMOTE_SERVER_NAME 1038

Definition at line 79 of file Resource.h.

#define IDC_EDIT_TYPE_LIBRARY 1044

Definition at line 89 of file Resource.h.

#define IDC_EDIT_UID 1040

Definition at line 83 of file Resource.h.

#define IDC_FRAME_CATALOG_INFO 1001

Definition at line 40 of file Resource.h.

#define IDC_FRAME_EXPORT_CLIENT_ONLY 1018

Definition at line 57 of file Resource.h.

#define IDC_FRAME_IMPORT_BY 1055

Definition at line 100 of file Resource.h.

#define IDC_FRAME_INSTALL_OPTIONS 1028

Definition at line 67 of file Resource.h.

#define IDC_FRAME_OBJECTS_AND_PROP_INFO 1010

Definition at line 49 of file Resource.h.

#define IDC_FRAME_PREVIOUS_COLLECTIONS 1008

Definition at line 47 of file Resource.h.

#define IDC_FRAME_RELATED_COLLECTIONS 1006

Definition at line 45 of file Resource.h.

#define IDC_FRAME_UTILITY_OPTIONS 1056

Definition at line 102 of file Resource.h.

#define IDC_FRAME_UTILITY_TYPE 1066

Definition at line 112 of file Resource.h.

#define IDC_LABEL_APPLICATION 1038

Definition at line 78 of file Resource.h.

#define IDC_LABEL_APPLICATION_FILE 1032

Definition at line 71 of file Resource.h.

#define IDC_LABEL_APPLICATION_ID 1049

Definition at line 94 of file Resource.h.

#define IDC_LABEL_COLLECTION_NAME_DESC 1004

Definition at line 43 of file Resource.h.

#define IDC_LABEL_COLLECTION_NAME_VALUE 1005

Definition at line 44 of file Resource.h.

#define IDC_LABEL_COMPONENT 1040

Definition at line 82 of file Resource.h.

#define IDC_LABEL_COMPUTER_NAME_DESC 1002

Definition at line 41 of file Resource.h.

#define IDC_LABEL_COMPUTER_NAME_VALUE 1003

Definition at line 42 of file Resource.h.

#define IDC_LABEL_EXPORT_PATH 1025

Definition at line 64 of file Resource.h.

#define IDC_LABEL_INSTALL_DIRECTORY 1034

Definition at line 73 of file Resource.h.

#define IDC_LABEL_OBJECTS_DESC 1011

Definition at line 50 of file Resource.h.

#define IDC_LABEL_PROPERTIES_DESC2 1012

Definition at line 51 of file Resource.h.

#define IDC_LABEL_PROPERTY_VALUE_DESC 1015

Definition at line 54 of file Resource.h.

#define IDC_LABEL_PROXY_STUB_DLL 1046

Definition at line 91 of file Resource.h.

#define IDC_LABEL_PWD 1041

Definition at line 85 of file Resource.h.

#define IDC_LABEL_REMOTE_SERVER_NAME 1037

Definition at line 77 of file Resource.h.

#define IDC_LABEL_TYPE_LIBRARY 1043

Definition at line 88 of file Resource.h.

#define IDC_LABEL_UID 1039

Definition at line 81 of file Resource.h.

#define IDC_LIST_OBJECTS 1013

Definition at line 52 of file Resource.h.

#define IDC_LIST_PARENT_COLLECTIONS 1009

Definition at line 48 of file Resource.h.

#define IDC_LIST_PROPERTIES 1014

Definition at line 53 of file Resource.h.

#define IDC_LIST_RELATED_COLLECTIONS 1007

Definition at line 46 of file Resource.h.

#define IDC_RADIO_CLSID 1057

Definition at line 103 of file Resource.h.

#define IDC_RADIO_DO_NOT_EXPORT_USERS 1019

Definition at line 58 of file Resource.h.

#define IDC_RADIO_EXPORT_CLIENTS 1021

Definition at line 60 of file Resource.h.

#define IDC_RADIO_EXPORT_USERS 1020

Definition at line 59 of file Resource.h.

#define IDC_RADIO_INSTALL_WITH_USERS 1030

Definition at line 69 of file Resource.h.

#define IDC_RADIO_INSTALL_WITHOUT_USERS 1029

Definition at line 68 of file Resource.h.

#define IDC_RADIO_JNEC 1062

Definition at line 108 of file Resource.h.

#define IDC_RADIO_PROG_ID 1056

Definition at line 101 of file Resource.h.

#define IDC_RADIO_REFRESH 1065

Definition at line 111 of file Resource.h.

#define IDC_RADIO_REMOTE_COMPUTER 1059

Definition at line 105 of file Resource.h.

#define IDC_RADIO_ROUTER 1061

Definition at line 107 of file Resource.h.

#define IDC_RADIO_START 1063

Definition at line 109 of file Resource.h.

#define IDC_RADIO_STOP 1064

Definition at line 110 of file Resource.h.

#define IDC_RADIO_THIS_COMPUTER 1058

Definition at line 104 of file Resource.h.

#define IDD_ABOUTBOX 100

Definition at line 18 of file Resource.h.

#define IDD_APP_UTILITY 134

Definition at line 26 of file Resource.h.

#define IDD_CONNECT 137

Definition at line 29 of file Resource.h.

#define IDD_EXPORT_APPLICATION 132

Definition at line 24 of file Resource.h.

#define IDD_IMPORT_COMPONENT 136

Definition at line 28 of file Resource.h.

#define IDD_INSTALL_APPLICATION 133

Definition at line 25 of file Resource.h.

#define IDD_INSTALL_COMPONENT 135

Definition at line 27 of file Resource.h.

#define IDD_UTILITIES 138

Definition at line 30 of file Resource.h.

#define IDD_VCEXPLORE 102

Definition at line 21 of file Resource.h.

#define IDD_VCEXPLORE_DIALOG 102

Definition at line 20 of file Resource.h.

#define IDI_APP_ICON 145

Definition at line 32 of file Resource.h.

#define IDI_CONNECT 150

Definition at line 34 of file Resource.h.

#define IDI_EXPORT 155

Definition at line 39 of file Resource.h.

#define IDI_IMPORT 152

Definition at line 36 of file Resource.h.

#define IDI_INSTALL 151

Definition at line 35 of file Resource.h.

#define IDI_LOGO 131

Definition at line 23 of file Resource.h.

#define IDI_START 153

Definition at line 37 of file Resource.h.

#define IDI_STOP 154

Definition at line 38 of file Resource.h.

#define IDI_UTILITIES 149

Definition at line 33 of file Resource.h.

#define IDM_ABOUTBOX 0x0010

Definition at line 17 of file Resource.h.

#define IDR_MAINFRAME 128

Definition at line 22 of file Resource.h.

#define IDR_TOOLBAR_MAIN 143

Definition at line 31 of file Resource.h.

#define IDS_ABOUTBOX 101

Definition at line 19 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Explore.VC/StdAfx.Cpp File Reference

  • Com
  • Administration
  • Explore.VC

StdAfx.Cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Explore.VC/StdAfx.h File Reference

  • Com
  • Administration
  • Explore.VC
Defines

StdAfx.h File Reference

#include <afxwin.h>
#include <afxext.h>
#include <afxdisp.h>
#include <afxdtctl.h>
#include <afxcmn.h>
#include <commdlg.h>
#include <comdef.h>
#include <comadmin.h>

Go to the source code of this file.

Defines

#define VC_EXTRALEAN

Define Documentation

#define VC_EXTRALEAN

Definition at line 31 of file StdAfx.h.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Explore.VC/UtilitiesDlg.Cpp File Reference

  • Com
  • Administration
  • Explore.VC
Defines

UtilitiesDlg.Cpp File Reference

#include "stdafx.h"
#include "VCExplore.h"
#include "UtilitiesDlg.h"

Go to the source code of this file.

Defines

#define | UTILITY_OPTION_REFRESH 2
#define | UTILITY_OPTION_START 0
#define | UTILITY_OPTION_STOP 1
#define | UTILITY_OPTION_UNDEFINED -1
#define | UTILITY_TYPE_JNEC 1
#define | UTILITY_TYPE_ROUTER 0
#define | UTILITY_TYPE_UNDEFINED -1

Define Documentation

#define UTILITY_OPTION_REFRESH 2

Definition at line 38 of file UtilitiesDlg.Cpp.

#define UTILITY_OPTION_START 0

Definition at line 36 of file UtilitiesDlg.Cpp.

#define UTILITY_OPTION_STOP 1

Definition at line 37 of file UtilitiesDlg.Cpp.

#define UTILITY_OPTION_UNDEFINED -1

Definition at line 35 of file UtilitiesDlg.Cpp.

#define UTILITY_TYPE_JNEC 1

Definition at line 33 of file UtilitiesDlg.Cpp.

#define UTILITY_TYPE_ROUTER 0

Definition at line 32 of file UtilitiesDlg.Cpp.

#define UTILITY_TYPE_UNDEFINED -1

Definition at line 31 of file UtilitiesDlg.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Explore.VC/UtilitiesDlg.h File Reference

  • Com
  • Administration
  • Explore.VC
Classes

UtilitiesDlg.h File Reference

Go to the source code of this file.

Classes

class CUtilitiesDlg
Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Explore.VC/VCExplore.Cpp File Reference

  • Com
  • Administration
  • Explore.VC
Variables

VCExplore.Cpp File Reference

#include "stdafx.h"
#include "VCExplore.h"
#include "VCExploreDlg.h"

Go to the source code of this file.

Variables

g_pCurrCatalog
g_pCurrCollection
CVCExploreApp theApp

Variable Documentation

g_pCurrCatalog
g_pCurrCollection
CVCExploreApp theApp

Definition at line 56 of file VCExplore.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Explore.VC/VCExplore.h File Reference

  • Com
  • Administration
  • Explore.VC
Classes

VCExplore.h File Reference

#include "comadmin.h"
#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Classes

class CVCExploreApp
Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Explore.VC/VCExploreDlg.Cpp File Reference

  • Com
  • Administration
  • Explore.VC
Classes | Defines

VCExploreDlg.Cpp File Reference

#include "stdafx.h"
#include "VCExplore.h"
#include "VCExploreDlg.h"
#include "AppExportDlg.h"
#include "AppInstallDlg.h"
#include "AppUtilDlg.h"
#include "CompImportDlg.h"
#include "CompInstallDlg.h"
#include "ConnectDlg.h"
#include "UtilitiesDlg.h"
#include <comdef.h>
#include "comadmin.h"

Go to the source code of this file.

Classes

class | CAboutDlg

Defines

#define | DLG_ABOUT 9
#define | DLG_APP_EXPORT 1
#define | DLG_APP_INSTALL 2
#define | DLG_APP_UTIL_START 3
#define | DLG_APP_UTIL_STOP 4
#define | DLG_COMPONENT_IMPORT 5
#define | DLG_COMPONENT_INSTALL 6
#define | DLG_CONNECT 7
#define | DLG_UTILITIES 8
#define | RELEASE_ALL_PARENT_OBJECTS 0

Define Documentation

#define DLG_ABOUT 9

Definition at line 52 of file VCExploreDlg.Cpp.

#define DLG_APP_EXPORT 1

Definition at line 44 of file VCExploreDlg.Cpp.

#define DLG_APP_INSTALL 2

Definition at line 45 of file VCExploreDlg.Cpp.

#define DLG_APP_UTIL_START 3

Definition at line 46 of file VCExploreDlg.Cpp.

#define DLG_APP_UTIL_STOP 4

Definition at line 47 of file VCExploreDlg.Cpp.

#define DLG_COMPONENT_IMPORT 5

Definition at line 48 of file VCExploreDlg.Cpp.

#define DLG_COMPONENT_INSTALL 6

Definition at line 49 of file VCExploreDlg.Cpp.

#define DLG_CONNECT 7

Definition at line 50 of file VCExploreDlg.Cpp.

#define DLG_UTILITIES 8

Definition at line 51 of file VCExploreDlg.Cpp.

#define RELEASE_ALL_PARENT_OBJECTS 0

Definition at line 42 of file VCExploreDlg.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Explore.VC/VCExploreDlg.h File Reference

  • Com
  • Administration
  • Explore.VC
Classes

VCExploreDlg.h File Reference

Go to the source code of this file.

Classes

class CVCExploreDlg
Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpy/ComSpy.Cpp File Reference

  • Com
  • Administration
  • Spy
  • ComSpy
Functions | Variables

ComSpy.Cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include "initguid.h"
#include "ComSpy.h"
#include "ComSpyCtl.h"
#include "ComSpyCtl_i.c"
#include "ComSpy_i.c"
#include "SpyCon.h"

Go to the source code of this file.

Functions

int WINAPI | _tWinMain (HINSTANCE hInstance, HINSTANCE, LPTSTR lpCmdLine, int)
LPCTSTR | FindOneOf (LPCTSTR p1, LPCTSTR p2)

Variables

CExeModule _Module

Function Documentation

int WINAPI _tWinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | ,
 |  | LPTSTR | lpCmdLine,
 |  | int |
 | ) |  |

Definition at line 66 of file ComSpy.Cpp.

{
  lpCmdLine = GetCommandLine(); //this line necessary for _ATL_MIN_CRT
  HRESULT hRes = CoInitialize(NULL);
//  If you are running on NT 4.0 or higher you can use the following call
//  instead to make the EXE free threaded.
//  This means that calls come in on a random RPC thread
//  HRESULT hRes = CoInitializeEx(NULL, COINIT_MULTITHREADED);
  _ASSERTE(SUCCEEDED(hRes));
  _Module.Init(ObjectMap, hInstance);
  _Module.dwThreadID = GetCurrentThreadId();
  TCHAR szTokens[] = _T("-/");

  int nRet = 0;
  BOOL bRun = TRUE;
  LPCTSTR lpszToken = FindOneOf(lpCmdLine, szTokens);
  while (lpszToken != NULL)
  {
    if (_tcsnicmp(lpszToken, _T("UnregServer"), 11)==0)
    {
      _Module.UpdateRegistryFromResource(IDR_ComSpy, FALSE);
      nRet = _Module.UnregisterServer();
      bRun = FALSE;
      break;
    }
    if (_tcsnicmp(lpszToken, _T("RegServer"), 9)==0)
    {
      _Module.UpdateRegistryFromResource(IDR_ComSpy, TRUE);
      nRet = _Module.RegisterServer(TRUE);
      bRun = FALSE;
      break;
    }
    lpszToken = FindOneOf(lpszToken, szTokens);
  }

  if (bRun)
  {
    hRes = _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER,
      REGCLS_MULTIPLEUSE);
    _ASSERTE(SUCCEEDED(hRes));

    ISpyCon * pApp;
    CoCreateInstance(CLSID_SpyCon, NULL, CLSCTX_INPROC_SERVER, IID_ISpyCon, (void**)&pApp);
    if (pApp)
    {
      pApp->Run();
      MSG msg;
      while (GetMessage(&msg, 0, 0, 0))
      {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
      }

      ULONG ul = pApp -> Release();
      _ASSERTE(ul==0);
    }
    else
      _ASSERTE(0);

    _Module.RevokeClassObjects();
  }

  CoUninitialize();
  return nRet;
}

LPCTSTR FindOneOf | ( | LPCTSTR | p1,
 |  | LPCTSTR | p2
 | ) |  |

Definition at line 49 of file ComSpy.Cpp.

{
  while (*p1 != NULL)
  {
    LPCTSTR p = p2;
    while (*p != NULL)
    {
      if (*p1 == *p++)
        return p1+1;
    }
    p1++;
  }
  return NULL;
}

Variable Documentation

CExeModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpy/ComSpy.Idl File Reference

  • Com
  • Administration
  • Spy
  • ComSpy
Functions | Variables

ComSpy.Idl File Reference

Go to the source code of this file.

Functions

interface | helpstring ("method Run")] HRESULT Run()
importlib ("stdole2.tlb")
library COMSPYLib | importlib ("stdole32.tlb")

Variables

import oaidl | idl

Function Documentation

interface helpstring ( "method Run" )
importlib ( "stdole2.tlb" )
library COMSPYLib importlib ( "stdole32.tlb" )

Variable Documentation

import oaidl idl

Definition at line 17 of file ComSpy.Idl.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpy/Resource.h File Reference

  • Com
  • Administration
  • Spy
  • ComSpy
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | ID_CHOOSE_LOG_FILE_NAME 32772
#define | ID_CHOOSEFONT 32775
#define | ID_CLEAR 32773
#define | ID_LOG 32768
#define | ID_OPTIONS_GRID_LINES 32774
#define | ID_SAVE 32771
#define | ID_SAVE_NOW 32780
#define | ID_SAVE_ON_EXIT 32779
#define | ID_SHOW_ON_SCREEN 32778
#define | IDI_MAIN 203
#define | IDM_ABOUT 32777
#define | IDM_EXIT 32770
#define | IDM_ON_TOP 32776
#define | IDM_SELECT_APPLICATIONS 32769
#define | IDR_ComSpy 100
#define | IDR_MENU1 201
#define | IDR_SPYCON 101
#define | IDS_PROJNAME 100

Define Documentation

#define ID_CHOOSE_LOG_FILE_NAME 32772

Definition at line 26 of file Resource.h.

#define ID_CHOOSEFONT 32775

Definition at line 29 of file Resource.h.

#define ID_CLEAR 32773

Definition at line 27 of file Resource.h.

#define ID_LOG 32768

Definition at line 22 of file Resource.h.

#define ID_OPTIONS_GRID_LINES 32774

Definition at line 28 of file Resource.h.

#define ID_SAVE 32771

Definition at line 25 of file Resource.h.

#define ID_SAVE_NOW 32780

Definition at line 34 of file Resource.h.

#define ID_SAVE_ON_EXIT 32779

Definition at line 33 of file Resource.h.

#define ID_SHOW_ON_SCREEN 32778

Definition at line 32 of file Resource.h.

#define IDI_MAIN 203

Definition at line 21 of file Resource.h.

#define IDM_ABOUT 32777

Definition at line 31 of file Resource.h.

#define IDM_EXIT 32770

Definition at line 24 of file Resource.h.

#define IDM_ON_TOP 32776

Definition at line 30 of file Resource.h.

#define IDM_SELECT_APPLICATIONS 32769

Definition at line 23 of file Resource.h.

#define IDR_ComSpy 100

Definition at line 18 of file Resource.h.

#define IDR_MENU1 201

Definition at line 20 of file Resource.h.

#define IDR_SPYCON 101

Definition at line 19 of file Resource.h.

#define IDS_PROJNAME 100

Definition at line 17 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpy/SpyCon.Cpp File Reference

  • Com
  • Administration
  • Spy
  • ComSpy

SpyCon.Cpp File Reference

#include "stdafx.h"
#include "COMSpy.h"
#include "ComSpyCtl.h"
#include "SpyCon.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpy/SpyCon.h File Reference

  • Com
  • Administration
  • Spy
  • ComSpy
Classes

SpyCon.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class CSpyCon
Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpy/StdAfx.Cpp File Reference

  • Com
  • Administration
  • Spy
  • ComSpy

StdAfx.Cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>
#include <atlctl.cpp>
#include <atlwin.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpy/StdAfx.h File Reference

  • Com
  • Administration
  • Spy
  • ComSpy

StdAfx.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyAudit/ComSpyAudit.Cpp File Reference

  • Com
  • Administration
  • Spy
  • ComSpyAudit
Functions | Variables

ComSpyAudit.Cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include "initguid.h"
#include <SQL.h>
#include <SQLEXT.h>
#include <ODBCINST.h>
#include "ComSpyAudit.h"
#include "ComSpyAudit_i.c"
#include "ComSpySqlAudit.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 53 of file ComSpyAudit.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 61 of file ComSpyAudit.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID | Reserved
 | ) |  |

Definition at line 38 of file ComSpyAudit.Cpp.

{
  if (dwReason == DLL_PROCESS_ATTACH)
  {
    _Module.Init(ObjectMap, hInstance);
    DisableThreadLibraryCalls(hInstance);
  }
  else if (dwReason == DLL_PROCESS_DETACH)
    _Module.Term();
  return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 69 of file ComSpyAudit.Cpp.

{
  // registers object, typelib and all interfaces in typelib
  return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 78 of file ComSpyAudit.Cpp.

{
  _Module.UnregisterServer();
  return S_OK;
}

Variable Documentation

CComModule _Module

Definition at line 28 of file ComSpyAudit.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyAudit/ComSpysqlAudit.Cpp File Reference

  • Com
  • Administration
  • Spy
  • ComSpyAudit
Variables

ComSpysqlAudit.Cpp File Reference

#include "stdafx.h"
#include "ComSpyAudit.h"
#include <SQL.h>
#include <SQLEXT.h>
#include <ODBCINST.h>
#include "ComSpySqlAudit.h"

Go to the source code of this file.

Variables

LPTSTR sCreateTable
LPTSTR sTables []

Variable Documentation

LPTSTR sCreateTable
Initial value:

_T("CREATE TABLE dbo.%s (Ct int NOT NULL )")

Definition at line 45 of file ComSpysqlAudit.Cpp.

LPTSTR sTables[]
Initial value:
 {
_T("SecurityEvents"),
_T("MethodEvents"),
_T("ObjectEvents"),
_T("AppEvents"),
_T("ResourceEvents"),
_T("ThreadEvents"),
_T("TransactionEvents"),
_T("ObjectPoolEvents"),
_T("ActivityEvents"),
_T("QCEvents"),
_T("ExceptionEvents"),
_T("CRMEvents"),
_T("LBEvents")
}

Definition at line 28 of file ComSpysqlAudit.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyAudit/ComSpysqlAudit.h File Reference

  • Com
  • Administration
  • Spy
  • ComSpyAudit
Classes | Defines

ComSpysqlAudit.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class | CComSpySqlAudit

Defines

#define | SQL_BUF_SIZE 1024

Define Documentation

#define SQL_BUF_SIZE 1024

Definition at line 21 of file ComSpysqlAudit.h.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyAudit/Events.Cpp File Reference

  • Com
  • Administration
  • Spy
  • ComSpyAudit
Defines

Events.Cpp File Reference

#include "stdafx.h"
#include "ComSpyAudit.h"
#include <SQL.h>
#include <SQLEXT.h>
#include <ODBCINST.h>
#include "ComSpySqlAudit.h"

Go to the source code of this file.

Defines

#define SQL_EXEC(x)

Define Documentation

#define SQL_EXEC ( x )
Value:
{                               \
    RETCODE rc;                         \
    rc = SQLExecDirect(m_hstmt, x, lstrlen(x));         \
      if( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO )    \
    {                             \
      CComBSTR msg;                     \
      GetError( m_henv, m_hdbc, m_hstmt, &msg.m_str);     \
      ATLTRACE(L"Warning! SQlExecDirec failed! Msg: ");   \
      ATLTRACE(msg.m_str);                  \
      ATLTRACE(L"\n");                    \
    }                             \
  }

Definition at line 28 of file Events.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyAudit/Resource.h File Reference

  • Com
  • Administration
  • Spy
  • ComSpyAudit
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_COMSPYSQLAUDIT 101
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_COMSPYSQLAUDIT 101

Definition at line 18 of file Resource.h.

#define IDS_PROJNAME 100

Definition at line 17 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyAudit/StdAfx.Cpp File Reference

  • Com
  • Administration
  • Spy
  • ComSpyAudit

StdAfx.Cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyAudit/StdAfx.h File Reference

  • Com
  • Administration
  • Spy
  • ComSpyAudit
Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0500
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 31 of file StdAfx.h.

#define _WIN32_WINNT 0x0500

Definition at line 28 of file StdAfx.h.

#define STRICT

Definition at line 24 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyCtl/activitysub.h File Reference

  • Com
  • Administration
  • Spy
  • ComSpyCtl
Classes | Functions

activitysub.h File Reference

#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Classes

class | CActivitySub

Functions

CComBSTR | GuidToBstr (REFGUID guid)

Function Documentation

CComBSTR GuidToBstr ( REFGUID guid )

Definition at line 40 of file ComSpy.Cpp.

{
    CComBSTR b(40, L"");
    int nRet = StringFromGUID2(guid, b.m_str, 40);
    _ASSERTE(nRet);
    return b;
}

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyCtl/Adminwrap.Cpp File Reference

  • Com
  • Administration
  • Spy
  • ComSpyCtl
Defines | Functions | Variables

Adminwrap.Cpp File Reference

#include "stdafx.h"
#include "Adminwrap.h"
#include <comadmin.h>
#include <assert.h>

Go to the source code of this file.

Defines

#define | exit(hr)
#define | SAFERELEASE(p)

Functions

HRESULT | AddTransientSubscription (ICOMAdminCatalog *pICat, WCHAR *pwzSubName, WCHAR *pwzECID, WCHAR *pwzPubID, WCHAR *pwzIID, IUnknown *punk, WCHAR *pwzMethod, WCHAR *pwzCriteria, WCHAR *pwzPubProp, WCHAR *pwzPubVal)
HRESULT | GetCollection (ICatalogCollection *pIParentColl, ICatalogObject *pICatObj, BSTR szCollName, ICatalogCollection **ppICol)
HRESULT | GetCollection (ICOMAdminCatalog *pICat, BSTR szCollName, ICatalogCollection **ppICol)
HRESULT | GetNamedObjectFromCollection (ICatalogCollection *pCol, BSTR bstrObjName, ICatalogObject **ppObj, LONG *plIndex, ADMINTYPE type, BSTR bstrPropname)
HRESULT | RemoveNamedObjectFromCollection (ICatalogCollection *pICol, BSTR szObjectName, ADMINTYPE type)
HRESULT | RemoveTransientSubscription (ICOMAdminCatalog *pICat, WCHAR *pwzName)
HRESULT | SetIUnknownProperty (ICatalogObject *pcat, BSTR bstrPROP, IUnknown *punk)
HRESULT | SetStringProperty (ICatalogObject *pcat, BSTR bstrPROP, WCHAR *pval)

Variables

BSTR | g_bstrCRITERIA = "FilterCriteria"
BSTR | g_bstrECID = "EventCLSID"
BSTR | g_bstrIID = "InterfaceID"
BSTR | g_bstrMETHOD = "MethodName"
BSTR | g_bstrNAME = "Name"
BSTR | g_bstrPUBID = "PublisherID"
BSTR | g_bstrSUBINT = "SubscriberInterface"
BSTR | g_bstrTRANSPUBPROP = "TransientPublisherProperties"
BSTR | g_bstrTRANSSUB = "TransientSubscriptions"
BSTR | g_bstrVALUE = "Value"

Define Documentation

#define exit ( hr )
Value:
if FAILED(hr) \
          goto exit;

Definition at line 26 of file Adminwrap.Cpp.

#define SAFERELEASE ( p )
Value:
if (p) \
      { p->Release();\
      p = 0;}

Definition at line 22 of file Adminwrap.Cpp.

Function Documentation

HRESULT AddTransientSubscription | ( | ICOMAdminCatalog * | pICat,
 |  | WCHAR * | pwzSubName,
 |  | WCHAR * | pwzECID,
 |  | WCHAR * | pwzPubID,
 |  | WCHAR * | pwzIID,
 |  | IUnknown * | punk,
 |  | WCHAR * | pwzMethod,
 |  | WCHAR * | pwzCriteria,
 |  | WCHAR * | pwzPubProp,
 |  | WCHAR * | pwzPubVal
 | ) |  |

Definition at line 60 of file Adminwrap.Cpp.

{
  HRESULT         hr =0;
  ICatalogObject      *pISub=0, *pIProp=0;
  ICatalogCollection    *pISubs=0, *pIProps=0;
  IDispatch       *pIDisp=0;
  long          lret=0;
  BOOL          fCreate=FALSE, fComplete = FALSE;

  if (!pICat || !pwzSubName || !punk)
    return E_INVALIDARG;

  hr = GetCollection(pICat, g_bstrTRANSSUB, &pISubs);
  exit(hr);

  hr = pISubs->Add(&pIDisp);
  exit(hr);

  hr = pIDisp->QueryInterface(__uuidof(ICatalogObject), (LPVOID*)&pISub);
  exit(hr);

  hr = SetStringProperty(pISub, g_bstrNAME, pwzSubName);
  exit(hr);

  hr = SetStringProperty(pISub, g_bstrECID, pwzECID);
  exit(hr);

  hr = SetStringProperty(pISub, g_bstrPUBID, pwzPubID);
  exit(hr);

  hr = SetStringProperty(pISub, g_bstrIID, pwzIID);
  exit(hr);

  hr = SetIUnknownProperty(pISub, g_bstrSUBINT, punk);
  exit(hr);

  hr = SetStringProperty(pISub, g_bstrMETHOD, pwzMethod);
  exit(hr);

  hr = SetStringProperty(pISub, g_bstrCRITERIA, pwzCriteria);
  exit(hr);

  hr = pISubs->SaveChanges(&lret);
  exit(hr);

  fCreate = TRUE;

  if (pwzPubProp && pwzPubVal)
  {

    hr = GetCollection(pISubs, pISub, g_bstrTRANSPUBPROP, &pIProps);
    exit(hr);

    SAFERELEASE(pIDisp);
    hr = pIProps->Add(&pIDisp);
    exit(hr);

    hr = pIDisp->QueryInterface(__uuidof(ICatalogObject), (LPVOID*)&pIProp);
    exit(hr);

    hr = SetStringProperty(pIProp, g_bstrNAME, pwzPubProp);
    exit(hr);

    hr = SetStringProperty(pIProp, g_bstrVALUE, pwzPubVal);
    exit(hr);

    hr = pIProps->SaveChanges(&lret);
    exit(hr);
  }

  fComplete = TRUE;

exit:
  if (fCreate && !fComplete)
    RemoveTransientSubscription(pICat, pwzSubName);
  SAFERELEASE(pIDisp);
  SAFERELEASE(pIProp);
  SAFERELEASE(pIProps);
  SAFERELEASE(pISub);
  SAFERELEASE(pISubs);
  return hr;
}

HRESULT GetCollection | ( | ICatalogCollection * | pIParentColl,
 |  | ICatalogObject * | pICatObj,
 |  | BSTR | szCollName,
 |  | ICatalogCollection ** | ppICol
 | ) |  |

Definition at line 207 of file Adminwrap.Cpp.

{
  HRESULT hr = E_INVALIDARG;
  VARIANT var;
  IDispatch* pIDisp = NULL;
  VariantInit(&var);
  if (!pIParentColl || !pICatObj || !szCollName || !ppICol)
    goto exit;
  hr = pICatObj->get_Key(&var);
  exit(hr);
  hr = pIParentColl->GetCollection(szCollName, var, &pIDisp);
  exit(hr);
  hr = pIDisp->QueryInterface(__uuidof(ICatalogCollection), (LPVOID*)ppICol);
  exit(hr);
  hr = (*ppICol)->Populate();
exit:
  VariantClear(&var);
  if(pIDisp)
    pIDisp->Release();
  return hr;
}

HRESULT GetCollection | ( | ICOMAdminCatalog * | pICat,
 |  | BSTR | szCollName,
 |  | ICatalogCollection ** | ppICol
 | ) |  |

Definition at line 180 of file Adminwrap.Cpp.

{
  HRESULT hr = E_INVALIDARG;
  IDispatch* pIDisp = NULL;
  if (!pICat || !szCollName || !ppICol)
    goto exit;

  hr = pICat->GetCollection(szCollName, &pIDisp);
  exit(hr);
  hr = pIDisp->QueryInterface(__uuidof(ICatalogCollection), (LPVOID*)ppICol);
  exit(hr);
  hr = (*ppICol)->Populate();
exit:
  SAFERELEASE(pIDisp);
  return hr;
}

HRESULT GetNamedObjectFromCollection | ( | ICatalogCollection * | pCol,
 |  | BSTR | bstrObjName,
 |  | ICatalogObject ** | ppObj,
 |  | LONG * | plIndex,
 |  | ADMINTYPE | type,
 |  | BSTR | bstrPropname
 | ) |  |

Definition at line 289 of file Adminwrap.Cpp.

{
  HRESULT hr = E_FAIL;
  LONG lCount = 0;
  LONG i = 0;
  ICatalogObject* pObj = NULL;
  CComBSTR bstrName;
  VARIANT varProp;
  BOOL  fFound = FALSE;

  VariantInit(&varProp);
  if (!pCol || !bstrObjName || !ppObj)
    return E_INVALIDARG;

  if (!bstrPropname)
  {
    bstrName = g_bstrNAME;
  }
  else
    bstrName = bstrPropname;

  *ppObj = NULL;

  hr = pCol->Populate();
  exit(hr);

  hr = pCol->get_Count(&lCount);
  exit(hr);

  if (lCount == 0)
  {
    *plIndex = -1; // To indicate that the object is not found in the collection
    exit(hr=E_FAIL);
  }

  // Loop through
  for (i = 0; i < lCount; i++)
  {
    VariantClear(&varProp);

    // Get the next item
    hr = pCol->get_Item(i, (IDispatch**)&pObj);
    exit(hr);

    // Retrieve it's name property
    hr = pObj->get_Value((BSTR)bstrName, &varProp);
    exit(hr);

    // Check it's name property for a match
    if (wcscmp(bstrObjName, varProp.bstrVal) == 0)
    {
      // Found it!
      *ppObj = pObj;
      pObj->AddRef();
      VariantClear(&varProp);
      // does user want index of the just-found object?
      if (plIndex)
        *plIndex = i;
      fFound = TRUE;
      hr = S_OK;
      goto exit;
    }
      SAFERELEASE(pObj);
  }

  // If we got here then we didn't find it
  if (plIndex)
    *plIndex = -1; // To indicate that the object is not found in the collection
exit:
  SAFERELEASE(pObj);
  return hr;
}

HRESULT RemoveNamedObjectFromCollection | ( | ICatalogCollection * | pICol,
 |  | BSTR | szObjectName,
 |  | ADMINTYPE | type
 | ) |  |

Definition at line 242 of file Adminwrap.Cpp.

{
  HRESULT hr = E_FAIL;
  ICatalogObject* pICatObj = NULL;
  LONG key, lTotal;

  if (wcscmp(szObjectName, SysAllocString(L"*")))
  {
    hr = GetNamedObjectFromCollection(pICol, szObjectName, &pICatObj, &key, type);
    exit(hr);
    hr = pICol->Remove(key);
    exit(hr);
    hr = pICol->SaveChanges(&key);
  }
  else
  {
    hr = pICol->get_Count(&lTotal);
    exit(hr);
    for (key=lTotal-1; key >= 0; key--)
    {
      hr = pICol->Remove(key);
      exit(hr);
      hr = pICol->SaveChanges(&key);
      exit(hr);
    }
  }

exit:
  if(pICatObj)
    pICatObj->Release();
  return hr;
}

HRESULT RemoveTransientSubscription | ( | ICOMAdminCatalog * | pICat,
 |  | WCHAR * | pwzName
 | ) |  |

Definition at line 152 of file Adminwrap.Cpp.

{
  HRESULT         hr =0;
  ICatalogCollection    *pISubs=0;

  if (!pICat || !pwzName)
    return E_INVALIDARG;

  hr = GetCollection(pICat, g_bstrTRANSSUB, &pISubs);
  exit(hr);

  hr = RemoveNamedObjectFromCollection(pISubs, BSTR(pwzName), TRANSIENTSUB);
exit:
  SAFERELEASE(pISubs);
  return hr;
}

HRESULT SetIUnknownProperty | ( | ICatalogObject * | pcat,
 |  | BSTR | bstrPROP,
 |  | IUnknown * | punk
 | ) |  |

Definition at line 407 of file Adminwrap.Cpp.

{
  HRESULT hr;
  VARIANT var;
  if (!punk || !pcat)
    return E_INVALIDARG;

  VariantClear(&var);

  var.punkVal = punk;
  var.vt = VT_UNKNOWN;
  punk->AddRef(); // We'll be caling VariantClear

  hr = pcat->put_Value(bstrPROP, var);
  exit(hr);

exit:
  VariantClear(&var);
  return hr;
}

HRESULT SetStringProperty | ( | ICatalogObject * | pcat,
 |  | BSTR | bstrPROP,
 |  | WCHAR * | pval
 | ) |  |

Definition at line 373 of file Adminwrap.Cpp.

{
  HRESULT hr;
  VARIANT var;
  if (!pcat)
    return E_INVALIDARG;

  if (!pval)
    return S_FALSE;

  VariantClear(&var);

  var.bstrVal = SysAllocString(pval);
  if (!var.bstrVal)
    exit(hr=E_OUTOFMEMORY);
  var.vt = VT_BSTR;

  hr = pcat->put_Value(bstrPROP, var);
  exit(hr);

exit:
  VariantClear(&var);
  return hr;
}

Variable Documentation

BSTR g_bstrCRITERIA = "FilterCriteria"

Definition at line 38 of file Adminwrap.Cpp.

BSTR g_bstrECID = "EventCLSID"

Definition at line 35 of file Adminwrap.Cpp.

BSTR g_bstrIID = "InterfaceID"

Definition at line 36 of file Adminwrap.Cpp.

BSTR g_bstrMETHOD = "MethodName"

Definition at line 37 of file Adminwrap.Cpp.

BSTR g_bstrNAME = "Name"

Definition at line 33 of file Adminwrap.Cpp.

BSTR g_bstrPUBID = "PublisherID"

Definition at line 32 of file Adminwrap.Cpp.

BSTR g_bstrSUBINT = "SubscriberInterface"

Definition at line 40 of file Adminwrap.Cpp.

BSTR g_bstrTRANSPUBPROP = "TransientPublisherProperties"

Definition at line 41 of file Adminwrap.Cpp.

BSTR g_bstrTRANSSUB = "TransientSubscriptions"

Definition at line 39 of file Adminwrap.Cpp.

BSTR g_bstrVALUE = "Value"

Definition at line 34 of file Adminwrap.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyCtl/Adminwrap.h File Reference

  • Com
  • Administration
  • Spy
  • ComSpyCtl
Typedefs | Enumerations | Functions

Adminwrap.h File Reference

#include <comadmin.h>

Go to the source code of this file.

Typedefs

typedef enum ADMINTYPE * | PADMINTYPE

Enumerations

enum ADMINTYPE {
APPLICATION = 0, COMPONENT, SUBSCRIPTION, TRANSIENTSUB,
PUBPROP, TRANSIENTPUBPROP
}

Functions

HRESULT | AddTransientSubscription (ICOMAdminCatalog *pICat, WCHAR *pwzSubName, WCHAR *pwzECID, WCHAR *pwzPubID, WCHAR *pwzIID, IUnknown *punk, WCHAR *pwzMethod, WCHAR *pwzCriteria, WCHAR *pwzPubProp, WCHAR *pwzPubVal)
HRESULT | GetCollection (ICOMAdminCatalog *pICat, BSTR szCollName, ICatalogCollection **ppICol)
HRESULT | GetCollection (ICatalogCollection *pIParentColl, ICatalogObject *pICatObj, BSTR szCollName, ICatalogCollection **ppICol)
HRESULT | GetNamedObjectFromCollection (ICatalogCollection *pICol, BSTR szObjName, ICatalogObject **ppICatObj, LONG *plIndex, ADMINTYPE type, BSTR bstrName=NULL)
HRESULT | GetObjectNameProperty (ADMINTYPE type, BSTR *pbstr)
HRESULT | RemoveNamedObjectFromCollection (ICatalogCollection *pICol, BSTR szObjectName, ADMINTYPE type)
HRESULT | RemoveTransientSubscription (ICOMAdminCatalog *pICat, WCHAR *pwzName)
HRESULT | SetIUnknownProperty (ICatalogObject *pcat, BSTR bPROP, IUnknown *punk)
HRESULT | SetStringProperty (ICatalogObject *pcat, BSTR bPROP, WCHAR *pval)

Typedef Documentation

typedef enum ADMINTYPE * PADMINTYPE

Enumeration Type Documentation

enum ADMINTYPE
Enumerator:
APPLICATION
COMPONENT
SUBSCRIPTION
TRANSIENTSUB
PUBPROP
TRANSIENTPUBPROP

Definition at line 22 of file Adminwrap.h.

{
  APPLICATION=0,
  COMPONENT,
  SUBSCRIPTION,
  TRANSIENTSUB,
  PUBPROP,
  TRANSIENTPUBPROP,
} ADMINTYPE, *PADMINTYPE;

Function Documentation

HRESULT AddTransientSubscription | ( | ICOMAdminCatalog * | pICat,
 |  | WCHAR * | pwzSubName,
 |  | WCHAR * | pwzECID,
 |  | WCHAR * | pwzPubID,
 |  | WCHAR * | pwzIID,
 |  | IUnknown * | punk,
 |  | WCHAR * | pwzMethod,
 |  | WCHAR * | pwzCriteria,
 |  | WCHAR * | pwzPubProp,
 |  | WCHAR * | pwzPubVal
 | ) |  |

Definition at line 60 of file Adminwrap.Cpp.

{
  HRESULT         hr =0;
  ICatalogObject      *pISub=0, *pIProp=0;
  ICatalogCollection    *pISubs=0, *pIProps=0;
  IDispatch       *pIDisp=0;
  long          lret=0;
  BOOL          fCreate=FALSE, fComplete = FALSE;

  if (!pICat || !pwzSubName || !punk)
    return E_INVALIDARG;

  hr = GetCollection(pICat, g_bstrTRANSSUB, &pISubs);
  exit(hr);

  hr = pISubs->Add(&pIDisp);
  exit(hr);

  hr = pIDisp->QueryInterface(__uuidof(ICatalogObject), (LPVOID*)&pISub);
  exit(hr);

  hr = SetStringProperty(pISub, g_bstrNAME, pwzSubName);
  exit(hr);

  hr = SetStringProperty(pISub, g_bstrECID, pwzECID);
  exit(hr);

  hr = SetStringProperty(pISub, g_bstrPUBID, pwzPubID);
  exit(hr);

  hr = SetStringProperty(pISub, g_bstrIID, pwzIID);
  exit(hr);

  hr = SetIUnknownProperty(pISub, g_bstrSUBINT, punk);
  exit(hr);

  hr = SetStringProperty(pISub, g_bstrMETHOD, pwzMethod);
  exit(hr);

  hr = SetStringProperty(pISub, g_bstrCRITERIA, pwzCriteria);
  exit(hr);

  hr = pISubs->SaveChanges(&lret);
  exit(hr);

  fCreate = TRUE;

  if (pwzPubProp && pwzPubVal)
  {

    hr = GetCollection(pISubs, pISub, g_bstrTRANSPUBPROP, &pIProps);
    exit(hr);

    SAFERELEASE(pIDisp);
    hr = pIProps->Add(&pIDisp);
    exit(hr);

    hr = pIDisp->QueryInterface(__uuidof(ICatalogObject), (LPVOID*)&pIProp);
    exit(hr);

    hr = SetStringProperty(pIProp, g_bstrNAME, pwzPubProp);
    exit(hr);

    hr = SetStringProperty(pIProp, g_bstrVALUE, pwzPubVal);
    exit(hr);

    hr = pIProps->SaveChanges(&lret);
    exit(hr);
  }

  fComplete = TRUE;

exit:
  if (fCreate && !fComplete)
    RemoveTransientSubscription(pICat, pwzSubName);
  SAFERELEASE(pIDisp);
  SAFERELEASE(pIProp);
  SAFERELEASE(pIProps);
  SAFERELEASE(pISub);
  SAFERELEASE(pISubs);
  return hr;
}

HRESULT GetCollection | ( | ICOMAdminCatalog * | pICat,
 |  | BSTR | szCollName,
 |  | ICatalogCollection ** | ppICol
 | ) |  |

Definition at line 180 of file Adminwrap.Cpp.

{
  HRESULT hr = E_INVALIDARG;
  IDispatch* pIDisp = NULL;
  if (!pICat || !szCollName || !ppICol)
    goto exit;

  hr = pICat->GetCollection(szCollName, &pIDisp);
  exit(hr);
  hr = pIDisp->QueryInterface(__uuidof(ICatalogCollection), (LPVOID*)ppICol);
  exit(hr);
  hr = (*ppICol)->Populate();
exit:
  SAFERELEASE(pIDisp);
  return hr;
}

HRESULT GetCollection | ( | ICatalogCollection * | pIParentColl,
 |  | ICatalogObject * | pICatObj,
 |  | BSTR | szCollName,
 |  | ICatalogCollection ** | ppICol
 | ) |  |

Definition at line 207 of file Adminwrap.Cpp.

{
  HRESULT hr = E_INVALIDARG;
  VARIANT var;
  IDispatch* pIDisp = NULL;
  VariantInit(&var);
  if (!pIParentColl || !pICatObj || !szCollName || !ppICol)
    goto exit;
  hr = pICatObj->get_Key(&var);
  exit(hr);
  hr = pIParentColl->GetCollection(szCollName, var, &pIDisp);
  exit(hr);
  hr = pIDisp->QueryInterface(__uuidof(ICatalogCollection), (LPVOID*)ppICol);
  exit(hr);
  hr = (*ppICol)->Populate();
exit:
  VariantClear(&var);
  if(pIDisp)
    pIDisp->Release();
  return hr;
}

HRESULT GetNamedObjectFromCollection | ( | ICatalogCollection * | pICol,
 |  | BSTR | szObjName,
 |  | ICatalogObject ** | ppICatObj,
 |  | LONG * | plIndex,
 |  | ADMINTYPE | type,
 |  | BSTR | bstrName = NULL
 | ) |  |

Definition at line 289 of file Adminwrap.Cpp.

{
  HRESULT hr = E_FAIL;
  LONG lCount = 0;
  LONG i = 0;
  ICatalogObject* pObj = NULL;
  CComBSTR bstrName;
  VARIANT varProp;
  BOOL  fFound = FALSE;

  VariantInit(&varProp);
  if (!pCol || !bstrObjName || !ppObj)
    return E_INVALIDARG;

  if (!bstrPropname)
  {
    bstrName = g_bstrNAME;
  }
  else
    bstrName = bstrPropname;

  *ppObj = NULL;

  hr = pCol->Populate();
  exit(hr);

  hr = pCol->get_Count(&lCount);
  exit(hr);

  if (lCount == 0)
  {
    *plIndex = -1; // To indicate that the object is not found in the collection
    exit(hr=E_FAIL);
  }

  // Loop through
  for (i = 0; i < lCount; i++)
  {
    VariantClear(&varProp);

    // Get the next item
    hr = pCol->get_Item(i, (IDispatch**)&pObj);
    exit(hr);

    // Retrieve it's name property
    hr = pObj->get_Value((BSTR)bstrName, &varProp);
    exit(hr);

    // Check it's name property for a match
    if (wcscmp(bstrObjName, varProp.bstrVal) == 0)
    {
      // Found it!
      *ppObj = pObj;
      pObj->AddRef();
      VariantClear(&varProp);
      // does user want index of the just-found object?
      if (plIndex)
        *plIndex = i;
      fFound = TRUE;
      hr = S_OK;
      goto exit;
    }
      SAFERELEASE(pObj);
  }

  // If we got here then we didn't find it
  if (plIndex)
    *plIndex = -1; // To indicate that the object is not found in the collection
exit:
  SAFERELEASE(pObj);
  return hr;
}

HRESULT GetObjectNameProperty | ( | ADMINTYPE | type,
 |  | BSTR * | pbstr
 | ) |  |
HRESULT RemoveNamedObjectFromCollection | ( | ICatalogCollection * | pICol,
 |  | BSTR | szObjectName,
 |  | ADMINTYPE | type
 | ) |  |

Definition at line 242 of file Adminwrap.Cpp.

{
  HRESULT hr = E_FAIL;
  ICatalogObject* pICatObj = NULL;
  LONG key, lTotal;

  if (wcscmp(szObjectName, SysAllocString(L"*")))
  {
    hr = GetNamedObjectFromCollection(pICol, szObjectName, &pICatObj, &key, type);
    exit(hr);
    hr = pICol->Remove(key);
    exit(hr);
    hr = pICol->SaveChanges(&key);
  }
  else
  {
    hr = pICol->get_Count(&lTotal);
    exit(hr);
    for (key=lTotal-1; key >= 0; key--)
    {
      hr = pICol->Remove(key);
      exit(hr);
      hr = pICol->SaveChanges(&key);
      exit(hr);
    }
  }

exit:
  if(pICatObj)
    pICatObj->Release();
  return hr;
}

HRESULT RemoveTransientSubscription | ( | ICOMAdminCatalog * | pICat,
 |  | WCHAR * | pwzName
 | ) |  |

Definition at line 152 of file Adminwrap.Cpp.

{
  HRESULT         hr =0;
  ICatalogCollection    *pISubs=0;

  if (!pICat || !pwzName)
    return E_INVALIDARG;

  hr = GetCollection(pICat, g_bstrTRANSSUB, &pISubs);
  exit(hr);

  hr = RemoveNamedObjectFromCollection(pISubs, BSTR(pwzName), TRANSIENTSUB);
exit:
  SAFERELEASE(pISubs);
  return hr;
}

HRESULT SetIUnknownProperty | ( | ICatalogObject * | pcat,
 |  | BSTR | bPROP,
 |  | IUnknown * | punk
 | ) |  |

Definition at line 407 of file Adminwrap.Cpp.

{
  HRESULT hr;
  VARIANT var;
  if (!punk || !pcat)
    return E_INVALIDARG;

  VariantClear(&var);

  var.punkVal = punk;
  var.vt = VT_UNKNOWN;
  punk->AddRef(); // We'll be caling VariantClear

  hr = pcat->put_Value(bstrPROP, var);
  exit(hr);

exit:
  VariantClear(&var);
  return hr;
}

HRESULT SetStringProperty | ( | ICatalogObject * | pcat,
 |  | BSTR | bPROP,
 |  | WCHAR * | pval
 | ) |  |

Definition at line 373 of file Adminwrap.Cpp.

{
  HRESULT hr;
  VARIANT var;
  if (!pcat)
    return E_INVALIDARG;

  if (!pval)
    return S_FALSE;

  VariantClear(&var);

  var.bstrVal = SysAllocString(pval);
  if (!var.bstrVal)
    exit(hr=E_OUTOFMEMORY);
  var.vt = VT_BSTR;

  hr = pcat->put_Value(bstrPROP, var);
  exit(hr);

exit:
  VariantClear(&var);
  return hr;
}

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyCtl/appinfo.Cpp File Reference

  • Com
  • Administration
  • Spy
  • ComSpyCtl

appinfo.Cpp File Reference

#include "stdafx.h"
#include "AppInfo.h"
#include "ComSpyCtl.h"
#include "ComSpyAudit.h"
#include "CComSpy.h"
#include <algorithm>
#include "SysLCESub.h"
#include "AppSub.h"
#include "InstanceSub.h"
#include "EvtStoreSub.h"
#include "TxSub.h"
#include "ObjSub.h"
#include "MethodSub.h"
#include "ResourceSub.h"
#include "SecuritySub.h"
#include "ThreadSub.h"
#include "UserSub.h"
#include "ObjConstSub.h"
#include "ObjPoolSub.h"
#include "ObjPool2Sub.h"
#include "ActivitySub.h"
#include "IdentitySub.h"
#include "QCSub.h"
#include "ExceptionSub.h"
#include "crmsub.h"
#include "lbsub.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyCtl/appinfo.h File Reference

  • Com
  • Administration
  • Spy
  • ComSpyCtl
Classes | Typedefs | Enumerations

appinfo.h File Reference

#include "ComSpyCtl.h"

Go to the source code of this file.

Classes

class | CAppInfo

Typedefs

typedef enum FilterType | FILTERTYPE

Enumerations

enum | FilterType { NoFilter = 0, AppID = 1, ProcessID = 2 }

Typedef Documentation

typedef enum FilterType FILTERTYPE

Enumeration Type Documentation

enum FilterType
Enumerator:
NoFilter
AppID
ProcessID

Definition at line 24 of file appinfo.h.

{NoFilter = 0, AppID = 1, ProcessID = 2} FILTERTYPE;

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyCtl/appsub.h File Reference

  • Com
  • Administration
  • Spy
  • ComSpyCtl
Classes | Functions

appsub.h File Reference

#include "stdafx.h"
#include "resource.h"

Go to the source code of this file.

Classes

class | CAppSub

Functions

CComBSTR | GuidToBstr (REFGUID guid)

Function Documentation

CComBSTR GuidToBstr ( REFGUID guid )

Definition at line 40 of file ComSpy.Cpp.

{
    CComBSTR b(40, L"");
    int nRet = StringFromGUID2(guid, b.m_str, 40);
    _ASSERTE(nRet);
    return b;
}

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyCtl/ccomspy.h File Reference

  • Com
  • Administration
  • Spy
  • ComSpyCtl
Classes | Defines

ccomspy.h File Reference

#include "resource.h"
#include "comsvcs.h"

Go to the source code of this file.

Classes

class | CComSpy

Defines

#define | IF_AUDIT_DO(x)

Define Documentation

#define IF_AUDIT_DO ( x )
Value:
if (m_pSpy -> Audit())          \
    m_pSpy -> GetAuditObj() -> x

Definition at line 24 of file ccomspy.h.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyCtl/ComSpy.Cpp File Reference

  • Com
  • Administration
  • Spy
  • ComSpyCtl
Defines | Functions | Variables

ComSpy.Cpp File Reference

#include "stdafx.h"
#include <comsvcs.h>
#include "ComSpyCtl.h"
#include "ComSpyAudit.h"
#include "AppInfo.h"
#include "CComSpy.h"
#include "selecteventsdlg.h"
#include "commdlg.h"
#include <time.h>
#include "shellapi.h"

Go to the source code of this file.

Defines

#define | MAX_MSG_LENGTH (1024*sizeof(TCHAR))

Functions

CComBSTR | GuidToBstr (REFGUID guid)

Variables

LONGLONG | PerformanceFrequency = 0

Define Documentation

#define MAX_MSG_LENGTH (1024*sizeof(TCHAR))

Definition at line 51 of file ComSpy.Cpp.

Function Documentation

CComBSTR GuidToBstr ( REFGUID guid )

Definition at line 40 of file ComSpy.Cpp.

{
    CComBSTR b(40, L"");
    int nRet = StringFromGUID2(guid, b.m_str, 40);
    _ASSERTE(nRet);
    return b;
}

Variable Documentation

LONGLONG PerformanceFrequency = 0

Definition at line 28 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyCtl/ComSpyCtl.Cpp File Reference

  • Com
  • Administration
  • Spy
  • ComSpyCtl
Defines | Functions | Variables

ComSpyCtl.Cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include "initguid.h"
#include "ComSpyCtl.h"
#include "ComSpyAudit.h"
#include <comsvcs.h>
#include "CComSpy.h"
#include "AppInfo.h"
#include "ComSpyPropPage.h"
#include "ComSpyAudit_i.c"
#include "ComSpyCtl_i.c"

Go to the source code of this file.

Defines

#define | IID_DEFINED

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Define Documentation

#define IID_DEFINED

Definition at line 29 of file ComSpyCtl.Cpp.

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 70 of file ComSpyCtl.Cpp.

{
#ifdef _MERGE_PROXYSTUB
  if (PrxDllCanUnloadNow() != S_OK)
    return S_FALSE;
#endif
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 82 of file ComSpyCtl.Cpp.

{
#ifdef _MERGE_PROXYSTUB
  if (PrxDllGetClassObject(rclsid, riid, ppv) == S_OK)
    return S_OK;
#endif
  return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID | lpReserved
 | ) |  |

Definition at line 50 of file ComSpyCtl.Cpp.

{
  lpReserved;
#ifdef _MERGE_PROXYSTUB
  if (!PrxDllMain(hInstance, dwReason, lpReserved))
    return FALSE;
#endif
  if (dwReason == DLL_PROCESS_ATTACH)
  {
    _Module.Init(ObjectMap, hInstance);
    DisableThreadLibraryCalls(hInstance);
  }
  else if (dwReason == DLL_PROCESS_DETACH)
    _Module.Term();
  return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 94 of file ComSpyCtl.Cpp.

{
#ifdef _MERGE_PROXYSTUB
  HRESULT hRes = PrxDllRegisterServer();
  if (FAILED(hRes))
    return hRes;
#endif
  // registers object, typelib and all interfaces in typelib
  return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 108 of file ComSpyCtl.Cpp.

{
#ifdef _MERGE_PROXYSTUB
  PrxDllUnregisterServer();
#endif
  _Module.UnregisterServer();
  return S_OK;
}

Variable Documentation

CComModule _Module

Definition at line 39 of file ComSpyCtl.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyCtl/ComSpyproppage.Cpp File Reference

  • Com
  • Administration
  • Spy
  • ComSpyCtl
Variables

ComSpyproppage.Cpp File Reference

#include "stdafx.h"
#include "ComSpyCtl.h"
#include "ComSpyAudit.h"
#include "CComSpy.h"
#include "ComSpyPropPage.h"
#include "comsvcs.h"
#include "AppInfo.h"

Go to the source code of this file.

Variables

TCHAR * szColNames []

Variable Documentation

TCHAR* szColNames[]
Initial value:

{
  _T("Count"),
  _T("Event"),
  _T("TickCount"),
  _T("Application"),
  _T("Parameter"),

}

Definition at line 25 of file ComSpyproppage.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyCtl/ComSpyproppage.h File Reference

  • Com
  • Administration
  • Spy
  • ComSpyCtl
Classes | Variables

ComSpyproppage.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class | CComSpyPropPage

Variables

EXTERN_C const CLSID | CLSID_ComSpyPropPage

Variable Documentation

EXTERN_C const CLSID CLSID_ComSpyPropPage

Definition at line 22 of file ComSpyproppage.h.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyCtl/crmsub.Cpp File Reference

  • Com
  • Administration
  • Spy
  • ComSpyCtl

crmsub.Cpp File Reference

#include "stdafx.h"
#include "ComSpyCtl.h"
#include <comsvcs.h>
#include "SysLCESub.h"
#include "ComSpyAudit.h"
#include "CComSpy.h"
#include "crmsub.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyCtl/crmsub.h File Reference

  • Com
  • Administration
  • Spy
  • ComSpyCtl
Classes | Functions

crmsub.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class | CCRMSub

Functions

CComBSTR | GuidToBstr (REFGUID guid)

Function Documentation

CComBSTR GuidToBstr ( REFGUID guid )

Definition at line 40 of file ComSpy.Cpp.

{
    CComBSTR b(40, L"");
    int nRet = StringFromGUID2(guid, b.m_str, 40);
    _ASSERTE(nRet);
    return b;
}

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyCtl/evtstoresub.Cpp File Reference

  • Com
  • Administration
  • Spy
  • ComSpyCtl

evtstoresub.Cpp File Reference

#include "stdafx.h"
#include "ComSpyCtl.h"
#include "ComSpyAudit.h"
#include "SysLCESub.h"
#include "CComSpy.h"
#include "evtstoresub.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyCtl/evtstoresub.h File Reference

  • Com
  • Administration
  • Spy
  • ComSpyCtl
Classes | Functions

evtstoresub.h File Reference

#include "resource.h"
#include <eventsys.h>

Go to the source code of this file.

Classes

class | CEvtStoreSub

Functions

CComBSTR | GuidToBstr (REFGUID guid)

Function Documentation

CComBSTR GuidToBstr ( REFGUID guid )

Definition at line 40 of file ComSpy.Cpp.

{
    CComBSTR b(40, L"");
    int nRet = StringFromGUID2(guid, b.m_str, 40);
    _ASSERTE(nRet);
    return b;
}

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyCtl/exceptionsub.h File Reference

  • Com
  • Administration
  • Spy
  • ComSpyCtl
Classes | Functions

exceptionsub.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class | CExceptionSub

Functions

CComBSTR | GuidToBstr (REFGUID guid)

Function Documentation

CComBSTR GuidToBstr ( REFGUID guid )

Definition at line 40 of file ComSpy.Cpp.

{
    CComBSTR b(40, L"");
    int nRet = StringFromGUID2(guid, b.m_str, 40);
    _ASSERTE(nRet);
    return b;
}

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyCtl/Identitysub.h File Reference

  • Com
  • Administration
  • Spy
  • ComSpyCtl
Classes | Functions

Identitysub.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class | CIdentitySub

Functions

CComBSTR | GuidToBstr (REFGUID guid)

Function Documentation

CComBSTR GuidToBstr ( REFGUID guid )

Definition at line 40 of file ComSpy.Cpp.

{
    CComBSTR b(40, L"");
    int nRet = StringFromGUID2(guid, b.m_str, 40);
    _ASSERTE(nRet);
    return b;
}

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyCtl/instancesub.h File Reference

  • Com
  • Administration
  • Spy
  • ComSpyCtl
Classes | Functions

instancesub.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class | CInstanceSub

Functions

CComBSTR | GuidToBstr (REFGUID guid)

Function Documentation

CComBSTR GuidToBstr ( REFGUID guid )

Definition at line 40 of file ComSpy.Cpp.

{
    CComBSTR b(40, L"");
    int nRet = StringFromGUID2(guid, b.m_str, 40);
    _ASSERTE(nRet);
    return b;
}

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyCtl/lbsub.h File Reference

  • Com
  • Administration
  • Spy
  • ComSpyCtl
Classes | Functions

lbsub.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class | CLBSub

Functions

CComBSTR | GuidToBstr (REFGUID guid)

Function Documentation

CComBSTR GuidToBstr ( REFGUID guid )

Definition at line 40 of file ComSpy.Cpp.

{
    CComBSTR b(40, L"");
    int nRet = StringFromGUID2(guid, b.m_str, 40);
    _ASSERTE(nRet);
    return b;
}

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyCtl/Methodsub.Cpp File Reference

  • Com
  • Administration
  • Spy
  • ComSpyCtl
Variables

Methodsub.Cpp File Reference

#include "stdafx.h"
#include "ComSpyCtl.h"
#include <comsvcs.h>
#include "SysLCESub.h"
#include "ComSpyAudit.h"
#include "CComSpy.h"
#include "MethodSub.h"

Go to the source code of this file.

Variables

LONGLONG PerformanceFrequency

Variable Documentation

LONGLONG PerformanceFrequency

Definition at line 28 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyCtl/Methodsub.h File Reference

  • Com
  • Administration
  • Spy
  • ComSpyCtl
Classes | Typedefs | Functions

Methodsub.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class | CMethodSub

Typedefs

typedef map< ULONG64, TimeStack * > | TimeMap
typedef list< LONGLONG > | TimeStack

Functions

CComBSTR | GuidToBstr (REFGUID guid)

Typedef Documentation

typedef map<ULONG64, TimeStack *> TimeMap

Definition at line 25 of file Methodsub.h.

typedef list<LONGLONG> TimeStack

Definition at line 24 of file Methodsub.h.

Function Documentation

CComBSTR GuidToBstr ( REFGUID guid )

Definition at line 40 of file ComSpy.Cpp.

{
    CComBSTR b(40, L"");
    int nRet = StringFromGUID2(guid, b.m_str, 40);
    _ASSERTE(nRet);
    return b;
}

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyCtl/Objconstsub.h File Reference

  • Com
  • Administration
  • Spy
  • ComSpyCtl
Classes | Functions

Objconstsub.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class | CObjConstSub

Functions

CComBSTR | GuidToBstr (REFGUID guid)

Function Documentation

CComBSTR GuidToBstr ( REFGUID guid )

Definition at line 40 of file ComSpy.Cpp.

{
    CComBSTR b(40, L"");
    int nRet = StringFromGUID2(guid, b.m_str, 40);
    _ASSERTE(nRet);
    return b;
}

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyCtl/ObjPool2sub.h File Reference

  • Com
  • Administration
  • Spy
  • ComSpyCtl
Classes | Functions

ObjPool2sub.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class | CObjPool2Sub

Functions

CComBSTR | GuidToBstr (REFGUID guid)

Function Documentation

CComBSTR GuidToBstr ( REFGUID guid )

Definition at line 40 of file ComSpy.Cpp.

{
    CComBSTR b(40, L"");
    int nRet = StringFromGUID2(guid, b.m_str, 40);
    _ASSERTE(nRet);
    return b;
}

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyCtl/ObjPoolsub.h File Reference

  • Com
  • Administration
  • Spy
  • ComSpyCtl
Classes | Functions

ObjPoolsub.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class | CObjPoolSub

Functions

CComBSTR | GuidToBstr (REFGUID guid)

Function Documentation

CComBSTR GuidToBstr ( REFGUID guid )

Definition at line 40 of file ComSpy.Cpp.

{
    CComBSTR b(40, L"");
    int nRet = StringFromGUID2(guid, b.m_str, 40);
    _ASSERTE(nRet);
    return b;
}

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyCtl/Objsub.h File Reference

  • Com
  • Administration
  • Spy
  • ComSpyCtl
Classes | Functions

Objsub.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class | CObjSub

Functions

CComBSTR | GuidToBstr (REFGUID guid)

Function Documentation

CComBSTR GuidToBstr ( REFGUID guid )

Definition at line 40 of file ComSpy.Cpp.

{
    CComBSTR b(40, L"");
    int nRet = StringFromGUID2(guid, b.m_str, 40);
    _ASSERTE(nRet);
    return b;
}

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyCtl/qcsub.h File Reference

  • Com
  • Administration
  • Spy
  • ComSpyCtl
Classes | Functions

qcsub.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class | CQCSub

Functions

CComBSTR | GuidToBstr (REFGUID guid)

Function Documentation

CComBSTR GuidToBstr ( REFGUID guid )

Definition at line 40 of file ComSpy.Cpp.

{
    CComBSTR b(40, L"");
    int nRet = StringFromGUID2(guid, b.m_str, 40);
    _ASSERTE(nRet);
    return b;
}

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyCtl/Resource.h File Reference

  • Com
  • Administration
  • Spy
  • ComSpyCtl
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | ID_AUDIT 32780
#define | ID_CHOOSE_LOG_FILE_NAME 32772
#define | ID_CHOOSEFONT 32770
#define | ID_CLEAR 32773
#define | ID_DEBUG_BEGIN 500
#define | ID_DEBUG_END 599
#define | ID_LOG 32768
#define | ID_OPTIONS_GRID_LINES 32774
#define | ID_SAVE 32771
#define | ID_SHOW_ON_SCREEN 32776
#define | ID_SPY_DEBUG_NORUNNINGAPPLICATIONS 32779
#define | IDC_AUDIT_TO_DB 207
#define | IDC_CHECK_ALLAPPS 222
#define | IDC_COLUMN_NAMES 205
#define | IDC_EVENTS_FRAME 214
#define | IDC_LIST_APPS 208
#define | IDC_LIST_EVENTS 209
#define | IDC_LISTVIEWEVENTS 220
#define | IDC_LISTVIEWSYSEVENTS 224
#define | IDC_LOG_FILE 202
#define | IDC_LOG_TO_FILE 204
#define | IDC_SHOW_GRID_LINES 201
#define | IDC_SHOW_ON_SCREEN 206
#define | IDC_STATIC_CURRENTAPP 210
#define | IDC_STATIC_EVENTPLACEHOLDER 216
#define | IDC_STATIC_TYPE 223
#define | IDC_WIDTH 203
#define | IDD_COMSPYPROPPAGE 109
#define | IDD_CONFIGUREEVENTSDLG 205
#define | IDI_MAIN 203
#define | IDM_ABOUT 32777
#define | IDM_SELECT_APPLICATIONS 32769
#define | IDR_COMSPY 101
#define | IDR_COMSpy1 100
#define | IDR_COMSPYPROPPAGE 108
#define | IDR_SHOWEVENTS 201
#define | IDR_SPYMENU 201
#define | IDR_TXSINK 103
#define | IDS_DOCSTRINGComSpyPropPage 107
#define | IDS_HELPFILEComSpyPropPage 106
#define | IDS_PROJNAME 100
#define | IDS_TITLEComSpyPropPage 102
#define | NUMBER_COLUMNS 6

Define Documentation

#define ID_AUDIT 32780

Definition at line 59 of file Resource.h.

#define ID_CHOOSE_LOG_FILE_NAME 32772

Definition at line 53 of file Resource.h.

#define ID_CHOOSEFONT 32770

Definition at line 51 of file Resource.h.

#define ID_CLEAR 32773

Definition at line 54 of file Resource.h.

#define ID_DEBUG_BEGIN 500

Definition at line 47 of file Resource.h.

#define ID_DEBUG_END 599

Definition at line 48 of file Resource.h.

#define ID_LOG 32768

Definition at line 49 of file Resource.h.

#define ID_OPTIONS_GRID_LINES 32774

Definition at line 55 of file Resource.h.

#define ID_SAVE 32771

Definition at line 52 of file Resource.h.

#define ID_SHOW_ON_SCREEN 32776

Definition at line 56 of file Resource.h.

#define ID_SPY_DEBUG_NORUNNINGAPPLICATIONS 32779

Definition at line 58 of file Resource.h.

#define IDC_AUDIT_TO_DB 207

Definition at line 37 of file Resource.h.

#define IDC_CHECK_ALLAPPS 222

Definition at line 44 of file Resource.h.

#define IDC_COLUMN_NAMES 205

Definition at line 34 of file Resource.h.

#define IDC_EVENTS_FRAME 214

Definition at line 41 of file Resource.h.

#define IDC_LIST_APPS 208

Definition at line 38 of file Resource.h.

#define IDC_LIST_EVENTS 209

Definition at line 39 of file Resource.h.

#define IDC_LISTVIEWEVENTS 220

Definition at line 43 of file Resource.h.

#define IDC_LISTVIEWSYSEVENTS 224

Definition at line 46 of file Resource.h.

#define IDC_LOG_FILE 202

Definition at line 30 of file Resource.h.

#define IDC_LOG_TO_FILE 204

Definition at line 33 of file Resource.h.

#define IDC_SHOW_GRID_LINES 201

Definition at line 29 of file Resource.h.

#define IDC_SHOW_ON_SCREEN 206

Definition at line 36 of file Resource.h.

#define IDC_STATIC_CURRENTAPP 210

Definition at line 40 of file Resource.h.

#define IDC_STATIC_EVENTPLACEHOLDER 216

Definition at line 42 of file Resource.h.

#define IDC_STATIC_TYPE 223

Definition at line 45 of file Resource.h.

#define IDC_WIDTH 203

Definition at line 32 of file Resource.h.

#define IDD_COMSPYPROPPAGE 109

Definition at line 26 of file Resource.h.

#define IDD_CONFIGUREEVENTSDLG 205

Definition at line 35 of file Resource.h.

#define IDI_MAIN 203

Definition at line 31 of file Resource.h.

#define IDM_ABOUT 32777

Definition at line 57 of file Resource.h.

#define IDM_SELECT_APPLICATIONS 32769

Definition at line 50 of file Resource.h.

#define IDR_COMSPY 101

Definition at line 20 of file Resource.h.

#define IDR_COMSpy1 100

Definition at line 19 of file Resource.h.

#define IDR_COMSPYPROPPAGE 108

Definition at line 25 of file Resource.h.

#define IDR_SHOWEVENTS 201

Definition at line 28 of file Resource.h.

#define IDR_SPYMENU 201

Definition at line 27 of file Resource.h.

#define IDR_TXSINK 103

Definition at line 22 of file Resource.h.

#define IDS_DOCSTRINGComSpyPropPage 107

Definition at line 24 of file Resource.h.

#define IDS_HELPFILEComSpyPropPage 106

Definition at line 23 of file Resource.h.

#define IDS_PROJNAME 100

Definition at line 18 of file Resource.h.

#define IDS_TITLEComSpyPropPage 102

Definition at line 21 of file Resource.h.

#define NUMBER_COLUMNS 6

Definition at line 17 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyCtl/Resourcesub.Cpp File Reference

  • Com
  • Administration
  • Spy
  • ComSpyCtl

Resourcesub.Cpp File Reference

#include "stdafx.h"
#include <comsvcs.h>
#include "ComSpyCtl.h"
#include "ComSpyAudit.h"
#include "CCOMSpy.h"
#include "SysLCESub.h"
#include "ResourceSub.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyCtl/Resourcesub.h File Reference

  • Com
  • Administration
  • Spy
  • ComSpyCtl
Classes | Functions

Resourcesub.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class | CResourceSub

Functions

CComBSTR | GuidToBstr (REFGUID guid)

Function Documentation

CComBSTR GuidToBstr ( REFGUID guid )

Definition at line 40 of file ComSpy.Cpp.

{
    CComBSTR b(40, L"");
    int nRet = StringFromGUID2(guid, b.m_str, 40);
    _ASSERTE(nRet);
    return b;
}

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyCtl/securitysub.h File Reference

  • Com
  • Administration
  • Spy
  • ComSpyCtl
Classes | Defines | Functions

securitysub.h File Reference

#include "stdafx.h"
#include "resource.h"

Go to the source code of this file.

Classes

class | CSecuritySub

Defines

#define | USERNAMELEN 64

Functions

CComBSTR | GuidToBstr (REFGUID guid)

Define Documentation

#define USERNAMELEN 64

Definition at line 23 of file securitysub.h.

Function Documentation

CComBSTR GuidToBstr ( REFGUID guid )

Definition at line 40 of file ComSpy.Cpp.

{
    CComBSTR b(40, L"");
    int nRet = StringFromGUID2(guid, b.m_str, 40);
    _ASSERTE(nRet);
    return b;
}

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyCtl/selectEventsDlg.Cpp File Reference

  • Com
  • Administration
  • Spy
  • ComSpyCtl
Classes | Defines | Typedefs | Functions | Variables

selectEventsDlg.Cpp File Reference

#include "stdafx.h"
#include <comsvcs.h>
#include <comadmin.h>
#include "ComSpyCtl.h"
#include "ComSpyAudit.h"
#include "CComSpy.h"
#include "AppInfo.h"
#include "SelectEventsDlg.h"
#include <algorithm>
#include <comdef.h>

Go to the source code of this file.

Classes

struct | _EVENT_SINK_INFO

Defines

#define | ListView_SetCheckState(hwndLV, i, fCheck)
#define | MAX_APPNAME_SIZE 256

Typedefs

typedef struct _EVENT_SINK_INFO | EVENT_SINK_INFO

Functions

const _bstr_t | g_bstrAllApps (_T("All Applications"))
const _bstr_t | g_bstrAppType_Application (_T("Application:"))
const _bstr_t | g_bstrAppType_Process (_T("Process:"))

Variables

EVENT_SINK_INFO EventInfo []
EVENT_SINK_INFO SystemEventInfo []

Define Documentation

#define ListView_SetCheckState | ( | hwndLV,
 |  | i,
 |  | fCheck
 | ) |
Value:
ListView_SetItemState(hwndLV, i, INDEXTOSTATEIMAGEMASK((fCheck)+1),\
                    LVIS_STATEIMAGEMASK)

Definition at line 33 of file selectEventsDlg.Cpp.

#define MAX_APPNAME_SIZE 256

Definition at line 40 of file selectEventsDlg.Cpp.

Typedef Documentation

typedef struct _EVENT_SINK_INFO EVENT_SINK_INFO

Function Documentation

const _bstr_t g_bstrAllApps ( _T("All Applications") )
const _bstr_t g_bstrAppType_Application ( _T("Application:") )
const _bstr_t g_bstrAppType_Process ( _T("Process:") )

Variable Documentation

EVENT_SINK_INFO EventInfo[]
Initial value:
{
  _T("Activity"),   Activity,
  _T("Object Pool"),  ObjectPool,
  _T("Pool Mgmt"),  ObjectPool2,
  _T("Application"),  Application,
  _T("Construction"), ObjectConstruction,
  _T("Thread"),   Thread,
  _T("Instance"),   Instance,
  _T("Transaction"),  Transaction,
  _T("Method"),   Method,
  _T("Object"),   Object,
  _T("Resource"),   Resource,
  _T("UserDefined"),  User,
  _T("Security"),   Security,
  _T("Identity"),   Identity,
  _T("Queued"),   QC,
  _T("Exception"),  Exception,
  _T("CRM"),      CRM,
}

Definition at line 59 of file selectEventsDlg.Cpp.

EVENT_SINK_INFO SystemEventInfo[]
Initial value:
{
  _T("Event Store"),  EventStore,
  _T("Load Balancing"), LoadBalancing,
}

Definition at line 81 of file selectEventsDlg.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyCtl/selectEventsDlg.h File Reference

  • Com
  • Administration
  • Spy
  • ComSpyCtl
Classes

selectEventsDlg.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class CSelectEventsDlg
Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyCtl/StdAfx.Cpp File Reference

  • Com
  • Administration
  • Spy
  • ComSpyCtl

StdAfx.Cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>
#include <atlctl.cpp>
#include <atlwin.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyCtl/StdAfx.h File Reference

  • Com
  • Administration
  • Spy
  • ComSpyCtl
Defines | Typedefs | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include "commctrl.h"
#include <comsvcs.h>
#include <atlcom.h>
#include <atlctl.h>
#include <list>
#include <map>
#include <string>
#include <ocidl.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _ATL_DEBUG_QI
#define | _ATL_DEBUG_REFCOUNT
#define | _WIN32_WINNT 0x0500
#define | SafeRelease(pUnk) {if (pUnk){pUnk -> Release();pUnk = NULL; }}
#define | STRICT

Typedefs

typedef map< string, CAppInfo * > | MapStringToAppInfo
typedef map< int, ICOMSysLCE * > | SUBSCRIBERMAP

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 31 of file StdAfx.h.

#define _ATL_DEBUG_QI

Definition at line 58 of file StdAfx.h.

#define _ATL_DEBUG_REFCOUNT

Definition at line 59 of file StdAfx.h.

#define _WIN32_WINNT 0x0500

Definition at line 28 of file StdAfx.h.

#define SafeRelease ( pUnk ) {if (pUnk){pUnk -> Release();pUnk = NULL; }}

Definition at line 42 of file StdAfx.h.

#define STRICT

Definition at line 24 of file StdAfx.h.

Typedef Documentation

typedef map<string, CAppInfo *> MapStringToAppInfo

Definition at line 54 of file StdAfx.h.

typedef map<int, ICOMSysLCE*> SUBSCRIBERMAP

Definition at line 55 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyCtl/syslcesub.Cpp File Reference

  • Com
  • Administration
  • Spy
  • ComSpyCtl

syslcesub.Cpp File Reference

#include "stdafx.h"
#include "ComSpyCtl.h"
#include "SysLCESub.h"
#include "adminwrap.h"
#include <stdio.h>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyCtl/syslcesub.h File Reference

  • Com
  • Administration
  • Spy
  • ComSpyCtl
Classes

syslcesub.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class CSysLCESub
Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyCtl/threadsub.h File Reference

  • Com
  • Administration
  • Spy
  • ComSpyCtl
Classes | Functions

threadsub.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class | CThreadSub

Functions

CComBSTR | GuidToBstr (REFGUID guid)

Function Documentation

CComBSTR GuidToBstr ( REFGUID guid )

Definition at line 40 of file ComSpy.Cpp.

{
    CComBSTR b(40, L"");
    int nRet = StringFromGUID2(guid, b.m_str, 40);
    _ASSERTE(nRet);
    return b;
}

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyCtl/txsub.Cpp File Reference

  • Com
  • Administration
  • Spy
  • ComSpyCtl
Functions

txsub.Cpp File Reference

#include "stdafx.h"
#include "ComSpyCtl.h"
#include "ComSpyAudit.h"
#include <comsvcs.h>
#include "CComSpy.h"
#include "SysLCESub.h"
#include "TxSub.h"

Go to the source code of this file.

Functions

CComBSTR GuidToBstr (REFGUID guid)

Function Documentation

CComBSTR GuidToBstr ( REFGUID guid )

Definition at line 40 of file ComSpy.Cpp.

{
    CComBSTR b(40, L"");
    int nRet = StringFromGUID2(guid, b.m_str, 40);
    _ASSERTE(nRet);
    return b;
}

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyCtl/txsub.h File Reference

  • Com
  • Administration
  • Spy
  • ComSpyCtl
Classes

txsub.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class CTxSub
Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyCtl/usersub.h File Reference

  • Com
  • Administration
  • Spy
  • ComSpyCtl
Classes | Functions

usersub.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class | CUserSub

Functions

CComBSTR | GuidToBstr (REFGUID guid)

Function Documentation

CComBSTR GuidToBstr ( REFGUID guid )

Definition at line 40 of file ComSpy.Cpp.

{
    CComBSTR b(40, L"");
    int nRet = StringFromGUID2(guid, b.m_str, 40);
    _ASSERTE(nRet);
    return b;
}

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyface/ComSpyAudit.Idl File Reference

  • Com
  • Administration
  • Spy
  • ComSpyface
Functions | Variables

ComSpyAudit.Idl File Reference

Go to the source code of this file.

Functions

HRESULT | EngineDefined ([in] LONGLONG perfCount,[in] LPCOLESTR pszPropName,[in] VARIANT *varPropValue,[in] LPCOLESTR pszClsidEng)
library COMSPYAUDITLib | importlib ("stdole32.tlb")
importlib ("stdole2.tlb")
HRESULT | Init (LPCOLESTR sDSN, LPCOLESTR sUser, LPCOLESTR sPw)
HRESULT | OnActivityCreate ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidActivityID)
HRESULT | OnActivityDestroy ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidActivityID)
HRESULT | OnActivityEnter ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidCurrentApp,[in] LPCOLESTR pszGuidEnteredApp,[in] LPCOLESTR pszW2KThreadID)
HRESULT | OnActivityLeave ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidCurrentApp,[in] LPCOLESTR pszGuidLeftApp)
HRESULT | OnActivityLeaveSame ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidCurrentApp,[in] DWORD dwCallDepth)
HRESULT | OnActivityReenter ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidCurrentApp,[in] LPCOLESTR pszW2KThreadID,[in] DWORD dwCallDepth)
HRESULT | OnActivityTimeout ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidCurrentApp,[in] LPCOLESTR pszGuidEnteredApp,[in] LPCOLESTR pszW2KThreadID,[in] DWORD dwTimeout)
HRESULT | OnAppActivation ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp)
HRESULT | OnAppShutdown ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp)
HRESULT | OnAuthenticate ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidActivity,[in] LPCOLESTR pszObjectID,[in] LPCOLESTR pszGuidIID,[in] LPCOLESTR pszMethod,[in] LPCOLESTR pszOriginalUser,[in] LPCOLESTR pszDirectUser,[in] BOOL bCurrentUserInpersonatingInProc)
HRESULT | OnAuthenticateFail ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidActivity,[in] LPCOLESTR pszObjectID,[in] LPCOLESTR pszGuidIID,[in] LPCOLESTR pszMethod,[in] LPCOLESTR pszOriginalUser,[in] LPCOLESTR pszDirectUser,[in] BOOL bCurrentUserInpersonatingInProc)
HRESULT | OnCRMAbort ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidClerkCLSID)
HRESULT | OnCRMAnalyze ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidClerkCLSID,[in] LPCOLESTR pszCrmRecordType,[in] DWORD dwRecordSize)
HRESULT | OnCRMBegin ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidClerkCLSID,[in] LPCOLESTR pszGuidActivityID,[in] LPCOLESTR pszGuidTxUOWID,[in] LPCOLESTR pszProgIdCompensator,[in] LPCOLESTR pszDescription)
HRESULT | OnCRMCheckpoint ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp)
HRESULT | OnCRMCommit ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidClerkCLSID)
HRESULT | OnCRMDeliver ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidClerkCLSID,[in] BOOL bVariants,[in] DWORD dwRecordSize)
HRESULT | OnCRMDone ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidClerkCLSID)
HRESULT | OnCRMForce ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidClerkCLSID)
HRESULT | OnCRMForget ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidClerkCLSID)
HRESULT | OnCRMIndoubt ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidClerkCLSID)
HRESULT | OnCRMPrepare ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidClerkCLSID)
HRESULT | OnCRMRecoveryDone ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp)
HRESULT | OnCRMRecoveryStart ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp)
HRESULT | OnCRMRelease ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidClerkCLSID)
HRESULT | OnCRMWrite ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidClerkCLSID,[in] BOOL bVariants,[in] DWORD dwRecordSize)
HRESULT | OnDisableCommit ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszContextID)
HRESULT | OnEnableCommit ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszContextID)
HRESULT | OnExceptionUser ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszCode,[in] LPCOLESTR pszAddress,[in] LPCOLESTR pszStackTrace)
HRESULT | OnIISRequestInfo ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszObjectID,[in] LPCOLESTR pszClientIP,[in] LPCOLESTR pszServerIP,[in] LPCOLESTR pszURL)
HRESULT | OnMethodCall ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszObjectID,[in] LPCOLESTR pszGuidClassID,[in] LPCOLESTR pszGuidInterfaceID,[in] LPCOLESTR pszMethod)
HRESULT | OnMethodException ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszObjectID,[in] LPCOLESTR pszGuidClassID,[in] LPCOLESTR pszGuidInterfaceID,[in] LPCOLESTR pszMethod)
HRESULT | OnMethodReturn ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszObjectID,[in] LPCOLESTR pszGuidClassID,[in] LPCOLESTR pszGuidInterfaceID,[in] LPCOLESTR pszMethod,[in] HRESULT hr,[in] LPCOLESTR pszCallTime)
HRESULT | OnObjectActivate ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszContextID,[in] LPCOLESTR pszObjectID)
HRESULT | OnObjectConstruct ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszClassID,[in] LPCOLESTR pszConstructString,[in] LPCOLESTR pszObjectID)
HRESULT | OnObjectCreate ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidActivityID,[in] LPCOLESTR pszClassID,[in] LPCOLESTR pszTSID,[in] LPCOLESTR pszContextID,[in] LPCOLESTR pszObjectID)
HRESULT | OnObjectDeactivate ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszContextID,[in] LPCOLESTR pszObjectID)
HRESULT | OnObjectDestroy ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszContextID)
HRESULT | OnObjPoolCreateDecision ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] DWORD dwThreadsWaiting,[in] DWORD dwAvailableObjs,[in] DWORD dwCreatedObjs,[in] DWORD dwMin,[in] DWORD dwMax)
HRESULT | OnObjPoolCreateObject ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszClassID,[in] DWORD dwAvailableObjs,[in] LPCOLESTR pszObjectID)
HRESULT | OnObjPoolCreatePool ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszClassID,[in] DWORD dwMin,[in] DWORD dwMax,[in] DWORD dwTimeout)
HRESULT | OnObjPoolDestroyObject ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszClassID,[in] DWORD dwAvailableObjs,[in] LPCOLESTR pszObjectID)
HRESULT | OnObjPoolGetFromTx ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidActivityID,[in] LPCOLESTR pszClassID,[in] LPCOLESTR pszGuidTx,[in] LPCOLESTR pszObjectID)
HRESULT | OnObjPoolGetObject ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidActivityID,[in] LPCOLESTR pszClassID,[in] DWORD dwAvailableObjs,[in] LPCOLESTR pszObjectID)
HRESULT | OnObjPoolPutObject ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszClassID,[in] int nReason,[in] DWORD dwAvailableObjs,[in] LPCOLESTR pszObjectID)
HRESULT | OnObjPoolRecycleToTx ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidActivityID,[in] LPCOLESTR pszClassID,[in] LPCOLESTR pszGuidTx,[in] LPCOLESTR pszObjectID)
HRESULT | OnObjPoolTimeout ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszClassID,[in] LPCOLESTR pszGuidActivityID,[in] DWORD dwTimeout)
HRESULT | OnQCMoveToDeadQueue ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidMsgID,[in] LPCOLESTR pszGuidWorkFlowID)
HRESULT | OnQCMoveToReTryQueue ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidMsgID,[in] LPCOLESTR pszGuidWorkFlowID,[in] ULONG RetryIndex)
HRESULT | OnQCPlayback ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszObjectID,[in] LPCOLESTR pszGuidMsgID,[in] LPCOLESTR pszGuidWorkFlowID,[in] HRESULT hr)
HRESULT | OnQCQueueOpen ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszQueueName,[in] LPCOLESTR pszQueueID,[in] HRESULT hr)
HRESULT | OnQCReceive ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszQueueID,[in] LPCOLESTR pszGuidMsgID,[in] LPCOLESTR pszGuidWorkFlowID,[in] HRESULT hr)
HRESULT | OnQCReceiveFail ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszQueueID,[in] HRESULT hr)
HRESULT | OnQCRecord ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszObjectID,[in] LPCOLESTR pszQueueName,[in] LPCOLESTR pszGuidMsgID,[in] LPCOLESTR pszGuidWorkFlowID,[in] HRESULT hr)
HRESULT | OnResourceAllocate ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszObjectID,[in] LPCOLESTR pszType,[in] LPCOLESTR pszResId,[in] BOOL bEnlisted,[in] LPCOLESTR pszNumRated,[in] LPCOLESTR pszRating)
HRESULT | OnResourceCreate ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszObjectID,[in] LPCOLESTR pszType,[in] LPCOLESTR pszResId,[in] BOOL bEnlisted)
HRESULT | OnResourceDestroy ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszObjectID,[in] HRESULT hResult,[in] LPCOLESTR pszType,[in] LPCOLESTR pszResId)
HRESULT | OnResourceRecycle ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszObjectID,[in] LPCOLESTR pszType,[in] LPCOLESTR pszResId)
HRESULT | OnResourceTrack ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszObjectID,[in] LPCOLESTR pszType,[in] LPCOLESTR pszResId,[in] BOOL bEnlisted)
HRESULT | OnSetAbort ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszContextID)
HRESULT | OnSetComplete ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszContextID)
HRESULT | OnThreadAssignApartment ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidActivityID,[in] LPCOLESTR pszAptID)
HRESULT | OnThreadBindToApartment ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszThreadID,[in] LPCOLESTR pszAptID,[in] DWORD dwActivityCnt)
HRESULT | OnThreadTerminate ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszThreadID,[in] LPCOLESTR pszW2KThreadID,[in] DWORD dwThreadCnt)
HRESULT | OnThreadUnassignApartment ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszAptID)
HRESULT | OnThreadUnBind ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszThreadID,[in] LPCOLESTR pszAptID,[in] DWORD dwActivityCnt)
HRESULT | OnThreadWorkEnque ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszThreadID,[in] LPCOLESTR MsgWorkID,[in] DWORD dwQueueLen)
HRESULT | OnThreadWorkPrivate ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszThreadID,[in] LPCOLESTR MsgWorkID)
HRESULT | OnThreadWorkPublic ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszThreadID,[in] LPCOLESTR MsgWorkID,[in] DWORD dwQueueLen)
HRESULT | OnThreadWorkRedirect ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszThreadID,[in] LPCOLESTR MsgWorkID,[in] DWORD dwQueueLen,[in] LPCOLESTR pszThreadNum)
HRESULT | OnThreadWorkReject ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszThreadID,[in] LPCOLESTR MsgWorkID,[in] DWORD dwQueueLen)
HRESULT | OnTransactionAborted ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidTxID)
HRESULT | OnTransactionCommit ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidTxID)
HRESULT | OnTransactionPrepared ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidTxID,[in] BOOL bVoteYes)
HRESULT | OnTransactionStart ([in] LONGLONG perfCount,[in] LPCOLESTR pszGuidApp,[in] LPCOLESTR pszGuidTxID,[in] LPCOLESTR pszGuidTSID,[in] BOOL bRoot)
HRESULT | TargetDown ([in] LONGLONG perfCount,[in] LPCOLESTR pszServerName,[in] LPCOLESTR pszClsidEng)
HRESULT | TargetUp ([in] LONGLONG perfCount,[in] LPCOLESTR pszServerName,[in] LPCOLESTR pszClsidEng)

Variables

interface LPCOLESTR LPCOLESTR
LPCOLESTR DWORD 		dwThreadCnt
import oaidl | idl
interface LPCOLESTR | pszGuidApp
interface LPCOLESTR LPCOLESTR | pszThreadID
interface LPCOLESTR LPCOLESTR
LPCOLESTR 		pszW2KThreadID

Function Documentation

HRESULT EngineDefined | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszPropName,
 |  | [in] VARIANT * | varPropValue,
 |  | [in] LPCOLESTR | pszClsidEng
 | ) |  |
library COMSPYAUDITLib importlib ( "stdole32.tlb" )
importlib ( "stdole2.tlb" )
HRESULT Init | ( | LPCOLESTR | sDSN,
 |  | LPCOLESTR | sUser,
 |  | LPCOLESTR | sPw
 | ) |  |
HRESULT OnActivityCreate | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidActivityID
 | ) |  |
HRESULT OnActivityDestroy | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidActivityID
 | ) |  |
HRESULT OnActivityEnter | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidCurrentApp,
 |  | [in] LPCOLESTR | pszGuidEnteredApp,
 |  | [in] LPCOLESTR | pszW2KThreadID
 | ) |  |
HRESULT OnActivityLeave | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidCurrentApp,
 |  | [in] LPCOLESTR | pszGuidLeftApp
 | ) |  |
HRESULT OnActivityLeaveSame | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidCurrentApp,
 |  | [in] DWORD | dwCallDepth
 | ) |  |
HRESULT OnActivityReenter | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidCurrentApp,
 |  | [in] LPCOLESTR | pszW2KThreadID,
 |  | [in] DWORD | dwCallDepth
 | ) |  |
HRESULT OnActivityTimeout | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidCurrentApp,
 |  | [in] LPCOLESTR | pszGuidEnteredApp,
 |  | [in] LPCOLESTR | pszW2KThreadID,
 |  | [in] DWORD | dwTimeout
 | ) |  |
HRESULT OnAppActivation | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp
 | ) |  |
HRESULT OnAppShutdown | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp
 | ) |  |
HRESULT OnAuthenticate | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidActivity,
 |  | [in] LPCOLESTR | pszObjectID,
 |  | [in] LPCOLESTR | pszGuidIID,
 |  | [in] LPCOLESTR | pszMethod,
 |  | [in] LPCOLESTR | pszOriginalUser,
 |  | [in] LPCOLESTR | pszDirectUser,
 |  | [in] BOOL | bCurrentUserInpersonatingInProc
 | ) |  |
HRESULT OnAuthenticateFail | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidActivity,
 |  | [in] LPCOLESTR | pszObjectID,
 |  | [in] LPCOLESTR | pszGuidIID,
 |  | [in] LPCOLESTR | pszMethod,
 |  | [in] LPCOLESTR | pszOriginalUser,
 |  | [in] LPCOLESTR | pszDirectUser,
 |  | [in] BOOL | bCurrentUserInpersonatingInProc
 | ) |  |
HRESULT OnCRMAbort | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidClerkCLSID
 | ) |  |
HRESULT OnCRMAnalyze | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidClerkCLSID,
 |  | [in] LPCOLESTR | pszCrmRecordType,
 |  | [in] DWORD | dwRecordSize
 | ) |  |
HRESULT OnCRMBegin | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidClerkCLSID,
 |  | [in] LPCOLESTR | pszGuidActivityID,
 |  | [in] LPCOLESTR | pszGuidTxUOWID,
 |  | [in] LPCOLESTR | pszProgIdCompensator,
 |  | [in] LPCOLESTR | pszDescription
 | ) |  |
HRESULT OnCRMCheckpoint | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp
 | ) |  |
HRESULT OnCRMCommit | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidClerkCLSID
 | ) |  |
HRESULT OnCRMDeliver | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidClerkCLSID,
 |  | [in] BOOL | bVariants,
 |  | [in] DWORD | dwRecordSize
 | ) |  |
HRESULT OnCRMDone | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidClerkCLSID
 | ) |  |
HRESULT OnCRMForce | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidClerkCLSID
 | ) |  |
HRESULT OnCRMForget | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidClerkCLSID
 | ) |  |
HRESULT OnCRMIndoubt | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidClerkCLSID
 | ) |  |
HRESULT OnCRMPrepare | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidClerkCLSID
 | ) |  |
HRESULT OnCRMRecoveryDone | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp
 | ) |  |
HRESULT OnCRMRecoveryStart | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp
 | ) |  |
HRESULT OnCRMRelease | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidClerkCLSID
 | ) |  |
HRESULT OnCRMWrite | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidClerkCLSID,
 |  | [in] BOOL | bVariants,
 |  | [in] DWORD | dwRecordSize
 | ) |  |
HRESULT OnDisableCommit | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszContextID
 | ) |  |
HRESULT OnEnableCommit | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszContextID
 | ) |  |
HRESULT OnExceptionUser | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszCode,
 |  | [in] LPCOLESTR | pszAddress,
 |  | [in] LPCOLESTR | pszStackTrace
 | ) |  |
HRESULT OnIISRequestInfo | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszObjectID,
 |  | [in] LPCOLESTR | pszClientIP,
 |  | [in] LPCOLESTR | pszServerIP,
 |  | [in] LPCOLESTR | pszURL
 | ) |  |
HRESULT OnMethodCall | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszObjectID,
 |  | [in] LPCOLESTR | pszGuidClassID,
 |  | [in] LPCOLESTR | pszGuidInterfaceID,
 |  | [in] LPCOLESTR | pszMethod
 | ) |  |
HRESULT OnMethodException | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszObjectID,
 |  | [in] LPCOLESTR | pszGuidClassID,
 |  | [in] LPCOLESTR | pszGuidInterfaceID,
 |  | [in] LPCOLESTR | pszMethod
 | ) |  |
HRESULT OnMethodReturn | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszObjectID,
 |  | [in] LPCOLESTR | pszGuidClassID,
 |  | [in] LPCOLESTR | pszGuidInterfaceID,
 |  | [in] LPCOLESTR | pszMethod,
 |  | [in] HRESULT | hr,
 |  | [in] LPCOLESTR | pszCallTime
 | ) |  |
HRESULT OnObjectActivate | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszContextID,
 |  | [in] LPCOLESTR | pszObjectID
 | ) |  |
HRESULT OnObjectConstruct | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszClassID,
 |  | [in] LPCOLESTR | pszConstructString,
 |  | [in] LPCOLESTR | pszObjectID
 | ) |  |
HRESULT OnObjectCreate | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidActivityID,
 |  | [in] LPCOLESTR | pszClassID,
 |  | [in] LPCOLESTR | pszTSID,
 |  | [in] LPCOLESTR | pszContextID,
 |  | [in] LPCOLESTR | pszObjectID
 | ) |  |
HRESULT OnObjectDeactivate | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszContextID,
 |  | [in] LPCOLESTR | pszObjectID
 | ) |  |
HRESULT OnObjectDestroy | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszContextID
 | ) |  |
HRESULT OnObjPoolCreateDecision | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] DWORD | dwThreadsWaiting,
 |  | [in] DWORD | dwAvailableObjs,
 |  | [in] DWORD | dwCreatedObjs,
 |  | [in] DWORD | dwMin,
 |  | [in] DWORD | dwMax
 | ) |  |
HRESULT OnObjPoolCreateObject | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszClassID,
 |  | [in] DWORD | dwAvailableObjs,
 |  | [in] LPCOLESTR | pszObjectID
 | ) |  |
HRESULT OnObjPoolCreatePool | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszClassID,
 |  | [in] DWORD | dwMin,
 |  | [in] DWORD | dwMax,
 |  | [in] DWORD | dwTimeout
 | ) |  |
HRESULT OnObjPoolDestroyObject | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszClassID,
 |  | [in] DWORD | dwAvailableObjs,
 |  | [in] LPCOLESTR | pszObjectID
 | ) |  |
HRESULT OnObjPoolGetFromTx | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidActivityID,
 |  | [in] LPCOLESTR | pszClassID,
 |  | [in] LPCOLESTR | pszGuidTx,
 |  | [in] LPCOLESTR | pszObjectID
 | ) |  |
HRESULT OnObjPoolGetObject | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidActivityID,
 |  | [in] LPCOLESTR | pszClassID,
 |  | [in] DWORD | dwAvailableObjs,
 |  | [in] LPCOLESTR | pszObjectID
 | ) |  |
HRESULT OnObjPoolPutObject | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszClassID,
 |  | [in] int | nReason,
 |  | [in] DWORD | dwAvailableObjs,
 |  | [in] LPCOLESTR | pszObjectID
 | ) |  |
HRESULT OnObjPoolRecycleToTx | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidActivityID,
 |  | [in] LPCOLESTR | pszClassID,
 |  | [in] LPCOLESTR | pszGuidTx,
 |  | [in] LPCOLESTR | pszObjectID
 | ) |  |
HRESULT OnObjPoolTimeout | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszClassID,
 |  | [in] LPCOLESTR | pszGuidActivityID,
 |  | [in] DWORD | dwTimeout
 | ) |  |
HRESULT OnQCMoveToDeadQueue | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidMsgID,
 |  | [in] LPCOLESTR | pszGuidWorkFlowID
 | ) |  |
HRESULT OnQCMoveToReTryQueue | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidMsgID,
 |  | [in] LPCOLESTR | pszGuidWorkFlowID,
 |  | [in] ULONG | RetryIndex
 | ) |  |
HRESULT OnQCPlayback | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszObjectID,
 |  | [in] LPCOLESTR | pszGuidMsgID,
 |  | [in] LPCOLESTR | pszGuidWorkFlowID,
 |  | [in] HRESULT | hr
 | ) |  |
HRESULT OnQCQueueOpen | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszQueueName,
 |  | [in] LPCOLESTR | pszQueueID,
 |  | [in] HRESULT | hr
 | ) |  |
HRESULT OnQCReceive | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszQueueID,
 |  | [in] LPCOLESTR | pszGuidMsgID,
 |  | [in] LPCOLESTR | pszGuidWorkFlowID,
 |  | [in] HRESULT | hr
 | ) |  |
HRESULT OnQCReceiveFail | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszQueueID,
 |  | [in] HRESULT | hr
 | ) |  |
HRESULT OnQCRecord | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszObjectID,
 |  | [in] LPCOLESTR | pszQueueName,
 |  | [in] LPCOLESTR | pszGuidMsgID,
 |  | [in] LPCOLESTR | pszGuidWorkFlowID,
 |  | [in] HRESULT | hr
 | ) |  |
HRESULT OnResourceAllocate | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszObjectID,
 |  | [in] LPCOLESTR | pszType,
 |  | [in] LPCOLESTR | pszResId,
 |  | [in] BOOL | bEnlisted,
 |  | [in] LPCOLESTR | pszNumRated,
 |  | [in] LPCOLESTR | pszRating
 | ) |  |
HRESULT OnResourceCreate | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszObjectID,
 |  | [in] LPCOLESTR | pszType,
 |  | [in] LPCOLESTR | pszResId,
 |  | [in] BOOL | bEnlisted
 | ) |  |
HRESULT OnResourceDestroy | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszObjectID,
 |  | [in] HRESULT | hResult,
 |  | [in] LPCOLESTR | pszType,
 |  | [in] LPCOLESTR | pszResId
 | ) |  |
HRESULT OnResourceRecycle | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszObjectID,
 |  | [in] LPCOLESTR | pszType,
 |  | [in] LPCOLESTR | pszResId
 | ) |  |
HRESULT OnResourceTrack | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszObjectID,
 |  | [in] LPCOLESTR | pszType,
 |  | [in] LPCOLESTR | pszResId,
 |  | [in] BOOL | bEnlisted
 | ) |  |
HRESULT OnSetAbort | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszContextID
 | ) |  |
HRESULT OnSetComplete | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszContextID
 | ) |  |
HRESULT OnThreadAssignApartment | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidActivityID,
 |  | [in] LPCOLESTR | pszAptID
 | ) |  |
HRESULT OnThreadBindToApartment | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszThreadID,
 |  | [in] LPCOLESTR | pszAptID,
 |  | [in] DWORD | dwActivityCnt
 | ) |  |
HRESULT OnThreadTerminate | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszThreadID,
 |  | [in] LPCOLESTR | pszW2KThreadID,
 |  | [in] DWORD | dwThreadCnt
 | ) |  |
HRESULT OnThreadUnassignApartment | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszAptID
 | ) |  |
HRESULT OnThreadUnBind | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszThreadID,
 |  | [in] LPCOLESTR | pszAptID,
 |  | [in] DWORD | dwActivityCnt
 | ) |  |
HRESULT OnThreadWorkEnque | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszThreadID,
 |  | [in] LPCOLESTR | MsgWorkID,
 |  | [in] DWORD | dwQueueLen
 | ) |  |
HRESULT OnThreadWorkPrivate | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszThreadID,
 |  | [in] LPCOLESTR | MsgWorkID
 | ) |  |
HRESULT OnThreadWorkPublic | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszThreadID,
 |  | [in] LPCOLESTR | MsgWorkID,
 |  | [in] DWORD | dwQueueLen
 | ) |  |
HRESULT OnThreadWorkRedirect | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszThreadID,
 |  | [in] LPCOLESTR | MsgWorkID,
 |  | [in] DWORD | dwQueueLen,
 |  | [in] LPCOLESTR | pszThreadNum
 | ) |  |
HRESULT OnThreadWorkReject | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszThreadID,
 |  | [in] LPCOLESTR | MsgWorkID,
 |  | [in] DWORD | dwQueueLen
 | ) |  |
HRESULT OnTransactionAborted | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidTxID
 | ) |  |
HRESULT OnTransactionCommit | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidTxID
 | ) |  |
HRESULT OnTransactionPrepared | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidTxID,
 |  | [in] BOOL | bVoteYes
 | ) |  |
HRESULT OnTransactionStart | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszGuidApp,
 |  | [in] LPCOLESTR | pszGuidTxID,
 |  | [in] LPCOLESTR | pszGuidTSID,
 |  | [in] BOOL | bRoot
 | ) |  |
HRESULT TargetDown | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszServerName,
 |  | [in] LPCOLESTR | pszClsidEng
 | ) |  |
HRESULT TargetUp | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | pszServerName,
 |  | [in] LPCOLESTR | pszClsidEng
 | ) |  |

Variable Documentation

interface LPCOLESTR LPCOLESTR LPCOLESTR DWORD dwThreadCnt

Definition at line 32 of file ComSpyAudit.Idl.

import ocidl idl

Definition at line 17 of file ComSpyAudit.Idl.

interface LPCOLESTR pszGuidApp

Definition at line 32 of file ComSpyAudit.Idl.

interface LPCOLESTR LPCOLESTR pszThreadID

Definition at line 32 of file ComSpyAudit.Idl.

interface LPCOLESTR LPCOLESTR LPCOLESTR pszW2KThreadID

Definition at line 32 of file ComSpyAudit.Idl.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/ComSpyface/ComSpyCtl.Idl File Reference

  • Com
  • Administration
  • Spy
  • ComSpyface
Functions | Variables

ComSpyCtl.Idl File Reference

#include <olectl.h>

Go to the source code of this file.

Functions

HRESULT | About ()
HRESULT | Audit ([out, retval] BOOL *pVal)
HRESULT | Audit ([in] BOOL newVal)
HRESULT | ChooseFont ()
HRESULT | ChooseLogFile ([out] BSTR *sLogFileName,[out] BOOL *bCanceled)
HRESULT | ClearAllEvents ()
HRESULT | ColWidth (short nColumn,[in] long newVal)
HRESULT | ColWidth (short nColumn,[out, retval] long *pVal)
cpp_quote ("#define DISPID_LOGFILE 5") cpp_quote("cpp_quote ("cpp_quote(" typedef enum
HRESULT | Font ([out, retval]IFontDisp **ppFont)
HRESULT | Font ([in]IFontDisp *pFont)
HRESULT | GetEventClass ([out] LPGUID guid)
interface | id (DISPID_HWND)] HRESULT Window([out
HRESULT | Install ([in] BSTR *PropertyName,[in] VARIANT PropertyValue)
HRESULT | LogFile ([out, retval] BSTR *pVal)
HRESULT | LogFile ([in] BSTR newVal)
HRESULT | LogToFile ([in] BOOL newVal)
HRESULT | LogToFile ([out, retval] BOOL *pVal)
HRESULT | SaveToFile ()
HRESULT | SelectApplications ()
HRESULT | ShowGridLines ([out, retval] BOOL *pVal)
HRESULT | ShowGridLines ([in] BOOL newVal)
HRESULT | ShowOnScreen ([out, retval] BOOL *pVal)
HRESULT | ShowOnScreen ([in] BOOL newVal)
HRESULT | Uninstall ()

Variables

EventEnum
import oaidl | idl
interface retval LONG_PTR * | phwnd

Function Documentation

HRESULT About ( )
HRESULT Audit ( [out, retval] BOOL * pVal ) [get]
HRESULT Audit ( [in] BOOL newVal ) [set]
HRESULT ChooseFont ( )
HRESULT ChooseLogFile | ( | [out] BSTR * | sLogFileName,
 |  | [out] BOOL * | bCanceled
 | ) |  |
HRESULT ClearAllEvents ( )
HRESULT ColWidth | ( | short | nColumn,
 |  | [in] long | newVal |
 | ) |  |  | [set]
HRESULT ColWidth | ( | short | nColumn,
 |  | [out, retval] long * | pVal |
 | ) |  |  | [get]
cpp_quote ( "#define DISPID_LOGFILE 5" )

Definition at line 21 of file ComSpyCtl.Idl.

{
  Application = 0,
  Thread,
  Instance,
  Transaction,
  Method,
  Object,
  Resource,
  User,
  Security,
  ObjectPool,
  ObjectPool2,
  ObjectConstruction,
  Activity,
  Identity,
  QC,
  Exception,
  CRM,
  //System Events
  EventStore,
  LoadBalancing,
} EventEnum;

HRESULT Font ( [out, retval] IFontDisp ** ppFont ) [get]
HRESULT Font ( [in] IFontDisp * pFont ) [set]
HRESULT GetEventClass ( [out] LPGUID guid )
interface id ( DISPID_HWND )
HRESULT Install | ( | [in] BSTR * | PropertyName,
 |  | [in] VARIANT | PropertyValue
 | ) |  |
HRESULT LogFile ( [out, retval] BSTR * pVal ) [get]
HRESULT LogFile ( [in] BSTR newVal ) [set]
HRESULT LogToFile ( [in] BOOL newVal ) [set]
HRESULT LogToFile ( [out, retval] BOOL * pVal ) [get]
HRESULT SaveToFile ( )
HRESULT SelectApplications ( )
HRESULT ShowGridLines ( [out, retval] BOOL * pVal ) [get]
HRESULT ShowGridLines ( [in] BOOL newVal ) [set]
HRESULT ShowOnScreen ( [out, retval] BOOL * pVal ) [get]
HRESULT ShowOnScreen ( [in] BOOL newVal ) [set]
HRESULT Uninstall ( )

Variable Documentation

EventEnum

Definition at line 48 of file ComSpyCtl.Idl.

import ocidl idl

Definition at line 51 of file ComSpyCtl.Idl.

interface retval LONG_PTR* phwnd

Definition at line 65 of file ComSpyCtl.Idl.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/idl/comspyaudit.idl File Reference

  • Com
  • Administration
  • Spy
  • idl
Classes | Namespaces | Functions

comspyaudit.idl File Reference

Go to the source code of this file.

Classes

class | COMSPYAUDITLib::ComSpyAudit
interface | IComSpyAudit

Namespaces

namespace | COMSPYAUDITLib

Functions

COMSPYAUDITLib::importlib ("stdole32.tlb")
COMSPYAUDITLib::importlib ("stdole2.tlb")
Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Administration/Spy/idl/comspyctl.idl File Reference

  • Com
  • Administration
  • Spy
  • idl
Classes | Namespaces | Enumerations | Functions

comspyctl.idl File Reference

#include <olectl.h>

Go to the source code of this file.

Classes

class | COMSPYCTLLib::ComSpy
class | COMSPYCTLLib::ComSpyPropPage
interface | IComSpy
interface | ICOMSysLCE

Namespaces

namespace | COMSPYCTLLib

Enumerations

enum EventEnum {
Application = 0, Thread, Instance, Transaction,
Method, Object, Resource, User,
Security, ObjectPool, ObjectPool2, ObjectConstruction,
Activity, Identity, QC, Exception,
CRM, EventStore, LoadBalancing
}

Functions

COMSPYCTLLib::importlib ("stdole2.tlb")

Enumeration Type Documentation

enum EventEnum
Enumerator:
Application
Thread
Instance
Transaction
Method
Object
Resource
User
Security
ObjectPool
ObjectPool2
ObjectConstruction
Activity
Identity
QC
Exception
CRM
EventStore
LoadBalancing

Definition at line 26 of file comspyctl.idl.

{
  Application = 0,
  Thread,
  Instance,
  Transaction,
  Method,
  Object,
  Resource,
  User,
  Security,
  ObjectPool,
  ObjectPool2,
  ObjectConstruction,
  Activity,
  Identity,
  QC,
  Exception,
  CRM,
  //System Events
  EventStore,
  LoadBalancing,
} EventEnum;

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/async/client/CEvent.h File Reference

  • Com
  • async
  • client
Classes

CEvent.h File Reference

#include <objidl.h>
#include "..\Server\unk.h"
#include "..\Server\debug.h"
#include "proxy.h"

Go to the source code of this file.

Classes

class CEvent
Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/async/client/main.cpp File Reference

  • Com
  • async
  • client
Typedefs | Functions

main.cpp File Reference

#include <windows.h>
#include <ocidl.h>
#include <stdio.h>
#include "proxy.h"
#include "CEvent.h"
#include "..\Server\debug.h"
#include "..\Server\CUnknown.h"

Go to the source code of this file.

Typedefs

typedef AsyncITest * | LPASYNCITEST
typedef ICallFactory * | LPCALLFACTORY
typedef ISynchronize * | LPSYNCHRONIZE

Functions

main (int argc, char *argv[])

Typedef Documentation

typedef AsyncITest* LPASYNCITEST

Definition at line 27 of file main.cpp.

typedef ICallFactory* LPCALLFACTORY

Definition at line 26 of file main.cpp.

typedef ISynchronize* LPSYNCHRONIZE

Definition at line 28 of file main.cpp.

Function Documentation

main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 39 of file main.cpp.

{
  HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
  _ASSERT(SUCCEEDED(hr));

  hr = CoInitializeSecurity(NULL, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_NONE, RPC_C_IMP_LEVEL_ANONYMOUS, NULL, EOAC_NONE, 0);
  _ASSERT(SUCCEEDED(hr));

  LPCLASSFACTORY pCF = NULL;

/*
 * If you choose try run the server from a remote machine you can either hard code this in the
 * registry or set the below manifest constants to match your own environment. Make certain
 * to give the below user the rights to both "Launch" and "Access" the server. Since this
 * sample is showing how to achive a form of asychronous events the security is set to none
 * to simplify the callback.
 */
// #define _COSERVERINFO_
#if defined(_COSERVERINFO_)

#define DOMAIN    L"domain"
#define MACHINE   L"machine"
#define USER    L"com_stud"
#define PASSWORD  L"com_stud"

  COSERVERINFO* pserverInfo = static_cast<COSERVERINFO*>(alloca(sizeof(COSERVERINFO)+sizeof(COAUTHINFO)));
  COAUTHIDENTITY authIdentity;
  SETDEFSERVERINFO(pserverInfo, MACHINE)
  SETAUTHIDENTITY(authIdentity, USER, PASSWORD, DOMAIN);
  pserverInfo->pAuthInfo->pAuthIdentityData = &authIdentity;
#pragma message(">>> Overriding registry using COSERVERINFO to fetch object")
  hr = CoGetClassObject(CLSID_AsyncTest, CLSCTX_SERVER, pserverInfo, IID_IClassFactory, (PVOID*)&pCF);
#else // default
#pragma message(">>> using default registry settings to fetch object")
  hr = CoGetClassObject(CLSID_AsyncTest, CLSCTX_SERVER, NULL, IID_IClassFactory, (PVOID*)&pCF);
#endif // _COSERVERINFO_

  _ASSERT(SUCCEEDED(hr) && pCF);

  LPTEST pTest = NULL;
  hr = pCF->CreateInstance(NULL, IID_ITest, (PVOID*)&pTest);
  _ASSERT(SUCCEEDED(hr) && pTest);
  RELEASEINTERFACE(pCF);

#if defined(_EVENTSINK_)
// Set up event sink
  LPCONNECTIONPOINTCONTAINER pCPC = NULL;
  LPCONNECTIONPOINT pCP = NULL;
  hr = pTest->QueryInterface(IID_IConnectionPointContainer, (PVOID*)&pCPC);
  _ASSERT(SUCCEEDED(hr) && pCPC);

  hr = pCPC->FindConnectionPoint(IID_AppEvents, &pCP);
  _ASSERT(SUCCEEDED(hr) && pCP);
  RELEASEINTERFACE(pCPC);

  DWORD dwCookie;
  CEvent *lpevent = new CEvent;
  hr = pCP->Advise(lpevent, &dwCookie);
  _ASSERT(SUCCEEDED(hr));
#endif

  BSTR  bstr = NULL;

#if defined(_ASYNC_COM_)
  LPCALLFACTORY pCallF = NULL;
  LPASYNCITEST  pAsyncTest = NULL;
  LPSYNCHRONIZE pSync = NULL;
  hr = pTest->QueryInterface(IID_ICallFactory, (PVOID*)&pCallF);
  _ASSERT(SUCCEEDED(hr) && (pCallF != NULL));

  hr = pCallF->CreateCall(IID_AsyncITest, NULL, IID_AsyncITest, (LPUNKNOWN*)&pAsyncTest);
  _ASSERT(SUCCEEDED(hr) && (pAsyncTest != NULL));

  bstr = SysAllocString(L"Synchronous::Hello World");
  _ASSERT(bstr);
  printf("[Blocking call]\tPassing  %S to server\n", bstr);
/*
 *  The first call will block till the server completes the call. Since in this case the server
 *  supports the asychronous interface COM will call that method in preferance to the synchronous
 *  method. This allows the server to handle other tasks such as handling such as other clients while
 *  waiting the for method to finish. Note that this particular method takes one [in/out] parameter which
 *  will be used by both the Begin/Finish methods.
 */
  hr = pTest->Test1(bstr);
  printf("Server returned %S\n", bstr);
  _ASSERT(SUCCEEDED(hr));
  SysFreeString(bstr);

  bstr = SysAllocString(L"Asynchronous::Hello World");
  printf("[Asynchronous call]\tCalling Begin_Test1(%S) to server\n", bstr);
/*
 *  This is an asychronously call. The call to Begin_Test1 will return immediately after the parameters
 *  have been marshaled into the RPC buffer. The return code in this case in from the communication layer
 *  not the server. The client is able to free any parameters passed in and continue with other work.
 *  The client however can not make another call on the same call object until Finish_Test1 returns.
 */
  hr = pAsyncTest->Begin_Test1(bstr);
  _ASSERT(SUCCEEDED(hr));
  SysFreeString(bstr);

/*
 *  Fetch the ISynchronize interface from the proxy so that client can periodically check whether the server
 *  has completed the call will continuing with its' other work.
 */
  hr = pAsyncTest->QueryInterface(IID_ISynchronize, reinterpret_cast<PVOID*>(&pSync));
  _ASSERT(SUCCEEDED(hr) && pSync);

  DWORD startTime, elapseTime;
  printf("Working...\n");
  startTime = elapseTime = GetTickCount();
  while ((hr = pSync->Wait(0, 1000)) == RPC_S_CALLPENDING || elapseTime - startTime >= 20000)
  {
    elapseTime = GetTickCount();
    printf("Working...\n");
  }
  RELEASEINTERFACE(pSync);
  bstr = SysAllocString(L"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
  hr = pAsyncTest->Finish_Test1(bstr);
  printf("Elapsed time to complete call is %d sec\n", (elapseTime - startTime)/1000);
  _ASSERT(SUCCEEDED(hr));
  printf("Server returned %S\n", bstr);
  SysFreeString(bstr);

/*
 *  This next call is also invoked asynchronously by the client. What makes this different from the above call is
 *  this method call requires two parameters. These will split up so that all [in] parameters are passed in the
 *  Begin_Test2 call and [out] parameters to the Finish_Test2 call.
 */
  bstr = SysAllocString(L"Asynchronous::Hello World");
  printf("[Asynchronous call]\tCalling Begin_Test2(%S) to server\n", bstr);
  hr = pAsyncTest->Begin_Test2(bstr);
  _ASSERT(SUCCEEDED(hr));
  SysFreeString(bstr);

  hr = pAsyncTest->QueryInterface(IID_ISynchronize, reinterpret_cast<PVOID*>(&pSync));
  _ASSERT(SUCCEEDED(hr) && pSync);

  printf("Working...\n");
  startTime = elapseTime = GetTickCount();
  while ((hr = pSync->Wait(0, 1000)) == RPC_S_CALLPENDING || elapseTime - startTime >= 20000)
  {
    elapseTime = GetTickCount();
    printf("Working...\n");
  }
  RELEASEINTERFACE(pSync);
  hr = pAsyncTest->Finish_Test2(&bstr);
  printf("Elapsed time to complete call is %d sec\n", (elapseTime - startTime)/1000);
  _ASSERT(SUCCEEDED(hr));
  printf("Server returned %S\n", bstr);
  SysFreeString(bstr);

/*
 *  This next call simply calls the Finish_Test2 call without polling. This would be done in the case where the client
 *  could proceed no further without getting the result back from the client. The client will block in the Finish_Test2
 *  method until the server signals that it's done.
 */
  bstr = SysAllocString(L"Asynchronous::Hello World");
  printf("[Asynchronous call]\tCalling Begin_Test2(%S) to server\n", bstr);
  hr = pAsyncTest->Begin_Test2(bstr);
  _ASSERT(SUCCEEDED(hr));

  printf("**\n** Rather than test to see when the call object is signalled as above;\n** here I call the Finish method which will block until the method is signaled\n**\n");
  hr = pAsyncTest->Finish_Test2(&bstr);
  _ASSERT(SUCCEEDED(hr));
  printf("Server returned %S\n", bstr);
  SysFreeString(bstr);

  RELEASEINTERFACE(pAsyncTest);
  RELEASEINTERFACE(pCallF);
#else
  bstr = SysAllocString(L"Synchronous::Hello World");
  _ASSERT(bstr);
  printf("Passing  %S to server\n", bstr);
  hr = pTest->Test1(bstr);
  printf("Server returned %S\n", bstr);
  _ASSERT(SUCCEEDED(hr));
  SysFreeString(bstr);
#endif // _ASYNC_COM_

#if defined(_EVENTSINK_)
  hr = pCP->Unadvise(dwCookie);
  _ASSERT(SUCCEEDED(hr));
  RELEASEINTERFACE(pCP);
#endif

  RELEASEINTERFACE(pTest);
  CoUninitialize();
  return 0;
}

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/async/proxy/Proxy.idl File Reference

  • Com
  • async
  • proxy
Classes | Namespaces | Functions

Proxy.idl File Reference

Go to the source code of this file.

Classes

interface | AppEvents
class | Async_Lib::AsyncTest
interface | ITest

Namespaces

namespace | Async_Lib

Functions

Async_Lib::importlib ("stdole2.tlb")
Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/async/server/CAsyncTest.cpp File Reference

  • Com
  • async
  • server
Variables

CAsyncTest.cpp File Reference

#include "CAsyncTest.h"
#include "CAsyncXXX.h"
#include "Debug.h"
#include "stdio.h"
#include <process.h>

Go to the source code of this file.

Variables

CAsyncTest::threadParam * g_pthdParam

Variable Documentation

CAsyncTest::threadParam* g_pthdParam

Definition at line 42 of file CAsyncTest.cpp.

Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/async/server/CAsyncTest.h File Reference

  • Com
  • async
  • server
Classes

CAsyncTest.h File Reference

#include <objidl.h>
#include "proxy.h"

Go to the source code of this file.

Classes

class | CAsyncTest
struct | CAsyncTest::threadParam
Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/async/server/CAsyncXXX.cpp File Reference

  • Com
  • async
  • server

CAsyncXXX.cpp File Reference

#include "Debug.h"
#include "Debug.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/async/server/CAsyncXXX.h File Reference

  • Com
  • async
  • server
Classes | Typedefs

CAsyncXXX.h File Reference

#include "CUnknown.h"
#include "CAsyncXXX.cpp"

Go to the source code of this file.

Classes

class | CAsyncXXX< T, ISyncFace, IAsyncFace >

Typedefs

typedef ICallFactory * | LPCALLFACTORY
typedef ISynchronize * | LPSYNCHRONIZE

Typedef Documentation

typedef ICallFactory* LPCALLFACTORY

Definition at line 25 of file CAsyncXXX.h.

typedef ISynchronize* LPSYNCHRONIZE

Definition at line 24 of file CAsyncXXX.h.

Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/async/server/CConnectionPT.cpp File Reference

  • Com
  • async
  • server
Classes

CConnectionPT.cpp File Reference

#include <olectl.h>
#include "DComServer.h"
#include "CEnumXXX.h"
#include "proxy.h"
#include "Debug.h"

Go to the source code of this file.

Classes

class | CEnumConnectionPoints
class | CEnumConnections
Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/async/server/CConnectionPT.h File Reference

  • Com
  • async
  • server
Classes | Typedefs

CConnectionPT.h File Reference

#include <objidl.h>
#include <ocidl.h>

Go to the source code of this file.

Classes

class | CConnectionPoint
class | CConnectionPointContainer
struct | EventID

Typedefs

typedef struct EventID * | LPEVENTID

Typedef Documentation

typedef struct EventID * LPEVENTID
Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/async/server/CEnumXXX.cpp File Reference

  • Com
  • async
  • server

CEnumXXX.cpp File Reference

#include "Debug.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/async/server/CEnumXXX.h File Reference

  • Com
  • async
  • server
Classes

CEnumXXX.h File Reference

#include "CEnumXXX.cpp"

Go to the source code of this file.

Classes

class CEnumXXX< T, ELT_T, IFACE >
Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/async/server/cfactory.cpp File Reference

  • Com
  • async
  • server
Variables

cfactory.cpp File Reference

#include <objbase.h>
#include "Registry.h"
#include "CFactory.h"
#include "Debug.h"

Go to the source code of this file.

Variables

int | g_cFactoryDataEntries
HANDLE g_CloseEvent
CLSID g_clsid
DWORD g_dwTLS
CFactoryData g_FactoryDataArray []
HMODULE | g_hModule
LPOLESTR g_progID

Variable Documentation

int g_cFactoryDataEntries

Definition at line 92 of file SERVER.CPP.

HANDLE g_CloseEvent

Definition at line 37 of file main.cpp.

CLSID g_clsid

Definition at line 34 of file main.cpp.

DWORD g_dwTLS

Definition at line 40 of file main.cpp.

CFactoryData g_FactoryDataArray[]

Definition at line 61 of file SERVER.CPP.

HMODULE g_hModule

Definition at line 33 of file main.cpp.

LPOLESTR g_progID

Definition at line 35 of file main.cpp.

Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/async/server/cfactory.h File Reference

  • Com
  • async
  • server
Classes | Defines | Enumerations | Functions

cfactory.h File Reference

#include "CUnknown.h"

Go to the source code of this file.

Classes

class | CFactory
struct | CFactoryData

Defines

#define | MAKEVERSION(M, m) ((DWORD)(WORD)(m) | (DWORD)(WORD)(M) << 16)

Enumerations

enum | SERVERTYPE { INPROC, CONTROL, LOCAL, REMOTE }

Functions

typedef | HRESULT (_stdcall *FPCREATEINSTANCE)(IUnknown *

Define Documentation

#define MAKEVERSION | ( | M,
 |  | m |
 | ) |  | ((DWORD)(WORD)(m) | (DWORD)(WORD)(M) << 16)

Definition at line 31 of file cfactory.h.

Enumeration Type Documentation

enum SERVERTYPE
Enumerator:
INPROC
CONTROL
LOCAL
REMOTE

Definition at line 29 of file cfactory.h.

{INPROC, CONTROL, LOCAL, REMOTE} SERVERTYPE;

Function Documentation

typedef HRESULT ( _stdcall * FPCREATEINSTANCE )
Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/async/server/cunknown.cpp File Reference

  • Com
  • async
  • server

cunknown.cpp File Reference

#include "CUnknown.h"
#include "CFactory.h"
#include "Debug.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/async/server/cunknown.h File Reference

  • Com
  • async
  • server
Classes | Defines

cunknown.h File Reference

#include <objidl.h>

Go to the source code of this file.

Classes

class | CUnknown

Defines

#define | DECLARE_IUNKNOWN
#define | SETAUTHIDENTITY(aid, usr, pw, d)
#define | SETAUTHINFO(ai, athnsvc, athzsvc, name, athnl, impl, ident, cap)
#define | SETDEFAUTHINFO(ai, athnl, impl) SETAUTHINFO(ai, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, NULL, athnl, impl, NULL, RPC_C_QOS_CAPABILITIES_DEFAULT)
#define | SETDEFSERVERINFO(psi, name)

Define Documentation

#define DECLARE_IUNKNOWN
Value:
virtual HRESULT __stdcall                              \
    QueryInterface(const IID& iid, void** ppv)           \
  {                                                      \
    return GetOuterUnknown()->QueryInterface(iid,ppv) ;  \
  } ;                                                      \
  virtual ULONG __stdcall AddRef()                       \
  {                                                      \
    return GetOuterUnknown()->AddRef() ;                 \
  } ;                                                      \
  virtual ULONG __stdcall Release()                      \
  {                                                      \
    return GetOuterUnknown()->Release() ;                \
  } ;

Definition at line 149 of file cunknown.h.

#define SETAUTHIDENTITY | ( | aid,
 |  | usr,
 |  | pw,
 |  | d
 | ) |
Value:
{ \
  (aid).User=usr; \
  (aid).UserLength=lstrlenW(usr); \
  (aid).Domain=d; \
  (aid).DomainLength=d==NULL?0:lstrlenW(d); \
  (aid).Password=pw; \
  (aid).PasswordLength=pw==NULL?0:lstrlenW(pw); \
  (aid).Flags=SEC_WINNT_AUTH_IDENTITY_UNICODE; \
  }

Definition at line 53 of file cunknown.h.

#define SETAUTHINFO | ( | ai,
 |  | athnsvc,
 |  | athzsvc,
 |  | name,
 |  | athnl,
 |  | impl,
 |  | ident,
 |  | cap
 | ) |
Value:
{ \
  (ai).dwAuthnSvc=athnsvc; \
  (ai).dwAuthzSvc=athzsvc; \
  (ai).pwszServerPrincName=name; \
  (ai).dwAuthnLevel=athnl; \
  (ai).dwImpersonationLevel=impl; \
  (ai).pAuthIdentityData=ident; \
  (ai).dwCapabilities=cap; \
  }

Definition at line 29 of file cunknown.h.

#define SETDEFAUTHINFO | ( | ai,
 |  | athnl,
 |  | impl |
 | ) |  | SETAUTHINFO(ai, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, NULL, athnl, impl, NULL, RPC_C_QOS_CAPABILITIES_DEFAULT)

Definition at line 40 of file cunknown.h.

#define SETDEFSERVERINFO | ( | psi,
 |  | name
 | ) |
Value:
{ \
  (psi)->dwReserved1=0; \
  (psi)->pwszName=name; \
  (psi)->pAuthInfo=reinterpret_cast<COAUTHINFO*>((psi)+1); \
  SETDEFAUTHINFO(*(psi)->pAuthInfo,RPC_C_AUTHN_LEVEL_CONNECT,RPC_C_IMP_LEVEL_IMPERSONATE); \
  (psi)->dwReserved2=0; \
  }

Definition at line 44 of file cunknown.h.

Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/async/server/DCOMServer.cpp File Reference

  • Com
  • async
  • server
Variables

DCOMServer.cpp File Reference

#include "DCOMServer.h"
#include "CFactory.h"
#include "CAsyncTest.h"
#include "CAsyncXXX.h"
#include "Registry.h"
#include "Debug.h"
#include <stdio.h>

Go to the source code of this file.

Variables

HANDLE g_CloseEvent

Variable Documentation

HANDLE g_CloseEvent

Definition at line 37 of file main.cpp.

Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/async/server/DCOMServer.h File Reference

  • Com
  • async
  • server
Classes | Typedefs | Variables

DCOMServer.h File Reference

#include <windows.h>
#include "CUnknown.h"
#include "proxy.h"
#include "CConnectionpt.h"

Go to the source code of this file.

Classes

class | CServer

Typedefs

typedef ICallFactory * | LPCALLFACTORY
typedef ISynchronize * | LPSYNCHRONIZE

Variables

const CLSID | CLSID_AsyncTest
CLSID g_clsid
LPOLESTR g_progID

Typedef Documentation

typedef ICallFactory* LPCALLFACTORY

Definition at line 27 of file DCOMServer.h.

typedef ISynchronize* LPSYNCHRONIZE

Definition at line 26 of file DCOMServer.h.

Variable Documentation

const CLSID CLSID_AsyncTest

Definition at line 29 of file DCOMServer.h.

CLSID g_clsid

Definition at line 34 of file main.cpp.

LPOLESTR g_progID

Definition at line 35 of file main.cpp.

Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/async/server/debug.c File Reference

  • Com
  • async
  • server
Defines | Functions

debug.c File Reference

#include <windows.h>
#include <stdarg.h>
#include <stdio.h>
#include "debug.h"

Go to the source code of this file.

Defines

#define | ANSI

Functions

void | AddToMessageLog (LPWSTR lpszSourceName, LPWSTR lpszMsg, WORD ErrorLogType)
LPWSTR WINAPI | Ansi2Unicode (LPWSTR lpw, LPCSTR lpa, int nChars)
void | ReportError (LPTSTR lpstrMessage, DWORD errno)
LPSTR WINAPI | UniCode2Ansi (LPSTR lpa, LPCWSTR lpw, int nChars)

Define Documentation

#define ANSI

Definition at line 18 of file debug.c.

Function Documentation

void AddToMessageLog | ( | LPWSTR | lpszSourceName,
 |  | LPWSTR | lpszMsg,
 |  | WORD | ErrorLogType
 | ) |  |

Definition at line 121 of file debug.c.

{
  HKEY hkey;
    HANDLE  hEventSource;
    HANDLE hToken;
  TOKEN_USER *puser;
  PSID psid = NULL;
  DWORD cb = 0;

    // Use event logging to log the error.
    //

  if (!g_fKey)
  {
    RegCreateKey(HKEY_LOCAL_MACHINE, g_KeyName, &hkey);
    RegFlushKey(hkey);
    RegCloseKey(hkey);
    g_fKey = TRUE;
  }

  if (OpenThreadToken(GetCurrentThread(), TOKEN_READ, TRUE, &hToken)
    || OpenProcessToken(GetCurrentProcess(), TOKEN_READ, &hToken))
  {
    GetTokenInformation(hToken, TokenUser, NULL, cb, &cb);
    puser = LocalAlloc(LPTR, cb);
    if (puser && GetTokenInformation(hToken, TokenUser, puser, cb, &cb))
      psid = puser->User.Sid;
  }

  hEventSource = RegisterEventSource(NULL, _T("COM"));

    if (hEventSource != NULL)
  {
    ReportEventW(hEventSource, // handle of event source
      ErrorLogType,     // event type
            0,                    // event category
            0,                    // event ID
            psid,                 // current user's SID
            1,                    // strings in lpszStrings
            0,                    // no bytes of raw data
            (LPCWSTR*)&lpszMsg,    // array of error strings
            NULL);                // no raw data

        DeregisterEventSource(hEventSource);
    }
  if (puser)
    LocalFree(puser);

  return;
}

LPWSTR WINAPI Ansi2Unicode | ( | LPWSTR | lpw,
 |  | LPCSTR | lpa,
 |  | int | nChars
 | ) |  |

Definition at line 47 of file debug.c.

{
  _ASSERT(lpa != NULL);
  _ASSERT(lpw != NULL);
  // verify that no illegal character present
  // since lpw was allocated based on the size of lpa
  // don't worry about the number of chars
  lpw[0] = L'\0';
  MultiByteToWideChar(CP_ACP, 0, lpa, -1, lpw, nChars);
  return lpw;
}

void ReportError | ( | LPTSTR | lpstrMessage,
 |  | DWORD | errno
 | ) |  |

Definition at line 86 of file debug.c.

{
  LPTSTR lpstrError, ErrorMessage;
  DWORD cbLen = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|
                FORMAT_MESSAGE_FROM_SYSTEM,
                NULL,
                errno,
                LANG_USER_DEFAULT,
                (LPSTR)&lpstrError,
                0,
                NULL);
  ErrorMessage = LocalAlloc(LPTR, cbLen+lstrlen(lpstrMessage)+3);
  wsprintf(ErrorMessage, "%s: %s", lpstrMessage, lpstrError);
#if defined(_WRITE_TO_EVENT_LOG_)
#if !defined(_UNICODE)
  {
  CHAR_CONVERSION;
  AddToMessageLog(appSource, A2W(ErrorMessage),EVENTLOG_ERROR_TYPE);
  }
#else // _UNICODE
  AddToMessageLog(appSource, ErrorMessage,EVENTLOG_ERROR_TYPE);
#endif // _UNICODE
#else  // _WRITE_TO_EVENT_LOG_
  OutputDebugString(ErrorMessage);
  OutputDebugString(_T("\r\n"));
#endif // _WRITE_TO_EVENT_LOG_
  LocalFree(lpstrError);
  LocalFree(ErrorMessage);
}

LPSTR WINAPI UniCode2Ansi | ( | LPSTR | lpa,
 |  | LPCWSTR | lpw,
 |  | int | nChars
 | ) |  |

Definition at line 35 of file debug.c.

{
  _ASSERT(lpw != NULL);
  _ASSERT(lpa != NULL);
  // verify that no illegal character present
  // since lpa was allocated based on the size of lpw
  // don't worry about the number of chars
  lpa[0] = '\0';
  WideCharToMultiByte(CP_ACP, 0, lpw, -1, lpa, nChars, NULL, NULL);
  return lpa;
}

Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/async/server/debug.h File Reference

  • Com
  • async
  • server
Defines | Functions

debug.h File Reference

#include <tchar.h>
#include <crtdbg.h>
#include <malloc.h>

Go to the source code of this file.

Defines

#define | A2W(lpa)
#define | CHAR_CONVERSION static int _convert = 0
#define | CHECKPOINTER(p) (void)0
#define | DEBUGTRACE (void)0
#define | RELEASEINTERFACE(p) (p)->Release()
#define | W2A(lpw)

Functions

LPWSTR WINAPI | Ansi2Unicode (LPWSTR lpw, LPCSTR lpa, int nChars)
__inline void | DebugTrace ()
LPSTR WINAPI | UniCode2Ansi (LPSTR lpa, LPCWSTR lpw, int nChars)

Define Documentation

#define A2W ( lpa )
Value:
(\
  ((LPCSTR)lpa == NULL) ? NULL : (\
  _convert = (lstrlenA(lpa)+1),\
  Ansi2Unicode((LPWSTR) _alloca(_convert*2), lpa, _convert)))

Definition at line 33 of file debug.h.

#define CHAR_CONVERSION static int _convert = 0

Definition at line 29 of file debug.h.

#define CHECKPOINTER ( p ) (void)0

Definition at line 58 of file debug.h.

#define DEBUGTRACE (void)0

Definition at line 57 of file debug.h.

#define RELEASEINTERFACE ( p ) (p)->Release()

Definition at line 60 of file debug.h.

#define W2A ( lpw )
Value:
(\
  ((LPCWSTR)lpw == NULL) ? NULL : (\
    _convert = (lstrlenW(lpw)+1),\
    UniCode2Ansi((LPSTR) _alloca(_convert), lpw, _convert)))

Definition at line 38 of file debug.h.

Function Documentation

LPWSTR WINAPI Ansi2Unicode | ( | LPWSTR | lpw,
 |  | LPCSTR | lpa,
 |  | int | nChars
 | ) |  |

Definition at line 47 of file debug.c.

{
  _ASSERT(lpa != NULL);
  _ASSERT(lpw != NULL);
  // verify that no illegal character present
  // since lpw was allocated based on the size of lpa
  // don't worry about the number of chars
  lpw[0] = L'\0';
  MultiByteToWideChar(CP_ACP, 0, lpa, -1, lpw, nChars);
  return lpw;
}

__inline void DebugTrace ( )

Definition at line 50 of file debug.h.

{}

LPSTR WINAPI UniCode2Ansi | ( | LPSTR | lpa,
 |  | LPCWSTR | lpw,
 |  | int | nChars
 | ) |  |

Definition at line 35 of file debug.c.

{
  _ASSERT(lpw != NULL);
  _ASSERT(lpa != NULL);
  // verify that no illegal character present
  // since lpa was allocated based on the size of lpw
  // don't worry about the number of chars
  lpa[0] = '\0';
  WideCharToMultiByte(CP_ACP, 0, lpw, -1, lpa, nChars, NULL, NULL);
  return lpa;
}

Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/async/server/main.cpp File Reference

  • Com
  • async
  • server
Enumerations | Functions | Variables

main.cpp File Reference

#include <windows.h>
#include <iostream>
#include "DCOMServer.h"
#include "CFactory.h"
#include "Debug.h"

Go to the source code of this file.

Enumerations

enum | SERVERFLAGS { EMPTY, REGISTER, UNREGISTER }

Functions

main (int argc, char *argv[])
SERVERFLAGS | UpdateRegistery (char *argv)

Variables

LPWSTR | appSource = CServer::GetProgID()
CHAR_CONVERSION
int | g_cFactoryDataEntries
HANDLE g_CloseEvent
CLSID g_clsid
DWORD g_dwTLS
CFactoryData g_FactoryDataArray []
HMODULE | g_hModule
LPOLESTR g_progID

Enumeration Type Documentation

enum SERVERFLAGS
Enumerator:
EMPTY
REGISTER
UNREGISTER

Definition at line 52 of file main.cpp.

{EMPTY,REGISTER,UNREGISTER} SERVERFLAGS;

Function Documentation

main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 56 of file main.cpp.

{

// TODO: ADD path to server
  cout << "Server side of Asynchronous test" << endl;

#if defined(_APARTMENT_)
#pragma message(">>> Compiling for the Apartment Threaded Apartment")
  HRESULT hr = CoInitialize(NULL);
#else // Free Threaded Apartment
#pragma message(">>> Compiling for the Free Threaded Apartment")
  HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
  g_CloseEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
  _ASSERT(g_CloseEvent);
#endif // _APARTMENT_
  _ASSERT(SUCCEEDED(hr));
  g_dwTLS = TlsAlloc();

/*
 * Callbacks require the process level security to be non-authenicated
 */
  hr = CoInitializeSecurity(NULL, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_NONE, RPC_C_IMP_LEVEL_ANONYMOUS , NULL, EOAC_NONE, 0);
  _ASSERT(SUCCEEDED(hr));

  if (argc > 1 && UpdateRegistery(argv[1]) == REGISTER)
  {
    hr = CFactory::RegisterAll();
    if (FAILED(hr))
      MessageBox(NULL, "Could not registry app", W2A(CServer::GetProgID()), MB_OK);
    else
      MessageBox(NULL, "application has been registered", W2A(CServer::GetProgID()), MB_OK);
    goto END;
  }
  else if(argc > 1 && UpdateRegistery(argv[1]) == UNREGISTER)
  {
    hr = CFactory::UnregisterAll();
    if (FAILED(hr))
      MessageBox(NULL, "Error unregistering app", W2A(CServer::GetProgID()), MB_OK);
    else
      MessageBox(NULL, "application has been unregistered", W2A(CServer::GetProgID()), MB_OK);
    goto END;
  }

  cout << "Registering classfactories" << endl;
  // Register all ClassFactories
  int i;
  DWORD *dwCookies;
  dwCookies = new DWORD[g_cFactoryDataEntries];
  DEBUGTRACE(_T("Register all ClassFactories"));
  for (i = 0; i < g_cFactoryDataEntries; i++)
  {
    const CFactoryData* pData = &g_FactoryDataArray[i] ;

    LPUNKNOWN pCF =  new CFactory(pData) ;
    if (pCF == NULL)
    {
      DEBUGTRACE(_T("Error allocating memory for classfactory"));
      goto END;
    }
    hr = CoRegisterClassObject(*pData->m_pCLSID,
                pCF,
                pData->server == LOCAL ? CLSCTX_LOCAL_SERVER : CLSCTX_SERVER,
                REGCLS_MULTIPLEUSE|REGCLS_SUSPENDED,
                &dwCookies[i]);
    _ASSERT(SUCCEEDED(hr));
  }

  hr = CoResumeClassObjects();
  _ASSERT(SUCCEEDED(hr));

  DEBUGTRACE(_T("Class Factories have been registered ready to handling in comming"));

  cout << "Server ready..." << endl;

#if defined(_APARTMENT_)
  MSG msg;
  while (GetMessage(&msg, NULL, 0, 0))
    DispatchMessage(&msg);
#else // Free Threaded Apartment
  WaitForSingleObject(g_CloseEvent, INFINITE);
#endif // _APARTMENT_

  DEBUGTRACE(_T("Cleaning up and exiting process"));
  for (i = 0; i < g_cFactoryDataEntries; i++)
    CoRevokeClassObject(dwCookies[i]);

#if !defined(_APARTMENT_)
  CloseHandle(g_CloseEvent);
#endif
  delete [] dwCookies;
  CoUninitialize();
  return 0;
END:
  CoUninitialize();
  return 0;
}

SERVERFLAGS UpdateRegistery ( char * argv )

Definition at line 154 of file main.cpp.

{
  char *p = strtok(argv, "-/");
  while (p)
  {
    if (stricmp(p, "RegServer")==0)
      return REGISTER;
    else if (stricmp(p, "UnregServer")==0)
      return UNREGISTER;
    p = strtok(NULL, "-/");
  }
  return EMPTY;
}

Variable Documentation

LPWSTR appSource = CServer::GetProgID()

Definition at line 45 of file main.cpp.

CHAR_CONVERSION

Definition at line 47 of file main.cpp.

int g_cFactoryDataEntries

Definition at line 92 of file SERVER.CPP.

HANDLE g_CloseEvent

Definition at line 37 of file main.cpp.

CLSID g_clsid

Definition at line 34 of file main.cpp.

DWORD g_dwTLS

Definition at line 40 of file main.cpp.

CFactoryData g_FactoryDataArray[]

Definition at line 61 of file SERVER.CPP.

HMODULE g_hModule

Definition at line 33 of file main.cpp.

LPOLESTR g_progID

Definition at line 35 of file main.cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/async/server/registry.cpp File Reference

  • Com
  • async
  • server
Functions | Variables

registry.cpp File Reference

#include <objbase.h>
#include "Registry.h"
#include "CFactory.h"
#include "Debug.h"

Go to the source code of this file.

Functions

void | CLSIDtochar (const CLSID &clsid, LPTSTR szCLSID, int length)
LONG | recursiveDeleteKey (HKEY hKeyParent, LPCTSTR szKeyChild)
HRESULT | RegisterLibrary (HMODULE hModule, const GUID &pLibIID, LPCSTR szPath)
HRESULT | RegisterProxy (HMODULE hModule, LPCSTR szPath)
HRESULT | RegisterServer (HMODULE hModule, CFactoryData &classData)
BOOL | setKeyAndValue (LPCTSTR szKey, LPCTSTR szSubkey, LPCTSTR szValue=NULL, LPCTSTR szName=NULL)
HRESULT | UnRegisterProxy (HMODULE hModule, LPCSTR szPath)
HRESULT | UnregisterServer (HMODULE hModule, CFactoryData &classData)

Variables

CHAR_CONVERSION
const int | CLSID_STRING_SIZE = 39
CLSID g_clsid
LPOLESTR g_progID

Function Documentation

void CLSIDtochar | ( | const CLSID & | clsid,
 |  | LPTSTR | szCLSID,
 |  | int | length
 | ) |  |

Definition at line 274 of file registry.cpp.

{
  _ASSERT(length >= CLSID_STRING_SIZE) ;
  // Get CLSID
  LPOLESTR wszCLSID = NULL ;
  HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;
  _ASSERT(SUCCEEDED(hr)) ;

  // Covert from wide characters to non-wide.
  wcstombs(szCLSID, wszCLSID, length) ;

  // Free memory.
  CoTaskMemFree(wszCLSID) ;
}

LONG recursiveDeleteKey | ( | HKEY | hKeyParent,
 |  | LPCTSTR | szKeyChild
 | ) |  |

Definition at line 294 of file registry.cpp.

{
  // Open the child.
  HKEY hKeyChild ;
  LONG lRes = RegOpenKeyEx(hKeyParent, lpszKeyChild, 0,
                           KEY_ALL_ACCESS, &hKeyChild) ;
  if (lRes != ERROR_SUCCESS)
  {
    return lRes ;
  }

  // Enumerate all of the decendents of this child.
  FILETIME time ;
  char szBuffer[256] ;
  DWORD dwSize = 256 ;
  while (RegEnumKeyEx(hKeyChild, 0, szBuffer, &dwSize, NULL,
                      NULL, NULL, &time) == S_OK)
  {
    // Delete the decendents of this child.
    lRes = recursiveDeleteKey(hKeyChild, szBuffer) ;
    if (lRes != ERROR_SUCCESS)
    {
      // Cleanup before exiting.
      RegCloseKey(hKeyChild) ;
      return lRes;
    }
    dwSize = 256 ;
  }

  // Close the child.
  RegCloseKey(hKeyChild) ;

  // Delete this child.
  return RegDeleteKey(hKeyParent, lpszKeyChild) ;
}

HRESULT RegisterLibrary | ( | HMODULE | hModule,
 |  | const GUID & | pLibIID,
 |  | LPCSTR | szPath
 | ) |  |

Definition at line 378 of file registry.cpp.

{
  HRESULT hr = E_FAIL;
  LPTYPELIB ptypeLib;
  OLECHAR FileName[MAX_PATH];

  if (szPath)
  {
    MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szPath, -1, FileName, (sizeof FileName)/(sizeof FileName[0]));
    hr = LoadTypeLibEx(FileName, REGKIND_REGISTER, &ptypeLib);
  }

/*
 * try and load the typelibrary from the applications' resources
 */
  if (FAILED(hr))
  {
    char AppName[MAX_PATH];
    GetModuleFileName(hModule, AppName, sizeof(AppName));
    MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, AppName, -1, FileName, (sizeof FileName)/(sizeof FileName[0]));
    DEBUGTRACE(_T("LoadRegTypeLib failed, loading typelib from filename [%S]\n"), FileName);
    hr = LoadTypeLibEx(FileName, REGKIND_REGISTER, &ptypeLib);
/*
 * If that fails then resort to loading the typelibrary as a seperate file
 * this will only look for a typelibrary with the same name as the application
 */
    if (FAILED(hr))
    {
      LPSTR p = NULL;
      if((p = strchr(AppName, '.')) == NULL)
      {
        DEBUGTRACE(_T("Unable to append a TLB extention to app bombing out [%X]\n"), hr);
        return hr;
      }

      *p = NULL;
      strcat(AppName, ".tlb");
      MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, AppName, -1, FileName, (sizeof FileName)/(sizeof FileName[0]));
      DEBUGTRACE(_T("LoadRegTypeLib failed, loading typelib from filename [%S]\n"), FileName);
      hr = LoadTypeLibEx(FileName, REGKIND_REGISTER, &ptypeLib);
      if (FAILED(hr))
      {
        DEBUGTRACE(_T("LoadTypeLib failed bombing out [%X]\n"), hr);
        return hr;
      }
    }
  }
  RELEASEINTERFACE(ptypeLib);
  return hr;
}

HRESULT RegisterProxy | ( | HMODULE | hModule,
 |  | LPCSTR | szPath
 | ) |  |

Definition at line 432 of file registry.cpp.

{
  HRESULT hr = E_FAIL;
  HINSTANCE hLib;
  HRESULT (__stdcall *DllRegisterServer)(void);

  char FileName[MAX_PATH];

  if (szPath)
    hLib = LoadLibrary(szPath);
  else
  {
    GetModuleFileName(hModule, FileName, sizeof(FileName));
    LPSTR p = NULL;
    if((p = strrchr(FileName, '\\')) == NULL)
    {
        DEBUGTRACE(_T("Unable to find path to proxystub bombing out [%X]\n"), hr);
        return E_FAIL;
    }
    *p = NULL;
    strcat(FileName, "\\Proxy.Dll");
    hLib = LoadLibrary(FileName);
  }
  if (!hLib)
    return HRESULT_FROM_WIN32(GetLastError());
  DllRegisterServer = (HRESULT(__stdcall*)())GetProcAddress(hLib, "DllRegisterServer");
  if (!DllRegisterServer)
    return HRESULT_FROM_WIN32(GetLastError());

  hr = (*DllRegisterServer)();
  FreeLibrary(hLib);
  return hr;
}

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | CFactoryData & | classData
 | ) |  |

Definition at line 65 of file registry.cpp.

{

  // Get server location.
  HRESULT hr;
  char szModule[512];
  DWORD dwResult =
    ::GetModuleFileName(hModule,
                        szModule,
                        sizeof(szModule)/sizeof(char));

//checkcheck
  g_clsid = *classData.m_pCLSID;
  g_progID = const_cast<LPOLESTR>(classData.m_szProgID);

  _ASSERT(dwResult != 0);

  // Convert the CLSID into a char.
  char szCLSID[CLSID_STRING_SIZE];
  CLSIDtochar(*classData.m_pCLSID, szCLSID, sizeof(szCLSID));

  // Build the key CLSID\\{...}
  char szKey[64];
  strcpy(szKey, "CLSID\\");
  strcat(szKey, szCLSID);

  // Add the CLSID to the registry.
  setKeyAndValue(szKey, NULL, classData.m_RegistryName);

  // Add the server filename subkey under the CLSID key.
  switch (classData.server)
  {
    case REMOTE:
    // TODO: add AppID entries
    // fall through
    case LOCAL:
      setKeyAndValue(szKey, "LocalServer32", szModule);
      break;
    case CONTROL:
      // Add "Control" key for Insert Dialog box
      setKeyAndValue(szKey, "Control");
      // fall through
    case INPROC:
      setKeyAndValue(szKey, "InprocServer32", szModule);
      // Add threading model
      setKeyAndValue(szKey, "InprocServer32", classData.threadingModel, "ThreadingModel");
      break;
  }

  // Add the ProgID subkey under the CLSID key.
  setKeyAndValue(szKey, "ProgID", W2A(classData.m_szProgID));

  // Add the version-independent ProgID subkey under CLSID key.
  setKeyAndValue(szKey, "VersionIndependentProgID",
                 W2A(classData.m_szVerIndProgID));

  // Add the GUID for the typelib
  if (classData.m_pLIBID != &CLSID_NULL)
  {
    char typelib[CLSID_STRING_SIZE];
    CLSIDtochar(*classData.m_pLIBID, typelib, sizeof(typelib));
    setKeyAndValue(szKey, "TypeLib", typelib);
    setKeyAndValue(szKey, "Programmable");
    hr = RegisterLibrary(hModule, *classData.m_pLIBID, "Student.tlb");
    if (FAILED(hr))
      return hr;
  }

  if (classData.m_fProxy)
  {
    hr = RegisterProxy(hModule);
    if (FAILED(hr))
      return hr;
  }

  // Add "attributes" designating what this object: is, can do, needs
  char buffer[80];
  HKEY hKey;
  long lResult;

  if (classData.m_oleMisc != 0)
    setKeyAndValue(szKey, "MiscStatus", itoa(classData.m_oleMisc, buffer, 10));

  if (classData.m_oleVerbs != 0)
  {
    strcpy(buffer, szKey);
    strcat(szKey, "\\Verb");
    lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
                                szKey,
                                0, NULL, REG_OPTION_NON_VOLATILE,
                                KEY_ALL_ACCESS, NULL,
                                &hKey, NULL);

    if (lResult != ERROR_SUCCESS)
      OutputDebugString("Error creating verb\n");
    RegCloseKey(hKey);
    LPSTR end, begin = const_cast<char*>(classData.m_oleVerbs);
    if (begin)
      do
      {
        signed char lVerb = *begin++;
        end = strchr(begin, '.');
        *end++ = NULL;
        char verb[5];
        itoa(lVerb, verb, 10);
        wsprintf(buffer, "%s,%c,%c",begin, *end, *(end+2));
        setKeyAndValue(szKey, verb, buffer);
        begin = end+4;
      } while (*begin);
  }

  if (classData.m_szname != 0)
  {
  // Add names to be displayed in menus, dialogs, ....
    strcpy(szKey, "CLSID\\");
    strcat(szKey, szCLSID);
    strcat(szKey, "\\AuxUserType");
    lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
                           szKey,
                           0, NULL, REG_OPTION_NON_VOLATILE,
                           KEY_ALL_ACCESS, NULL,
                           &hKey, NULL);

    RegCloseKey(hKey);
    setKeyAndValue(szKey, "2", classData.m_szname);
    setKeyAndValue(szKey, "3", classData.m_szAppName);
  }
  // Add the version-independent ProgID subkey under HKEY_CLASSES_ROOT.
  setKeyAndValue(W2A(classData.m_szVerIndProgID), NULL, classData.m_RegistryName);
  setKeyAndValue(W2A(classData.m_szVerIndProgID), "CLSID", szCLSID);
  setKeyAndValue(W2A(classData.m_szVerIndProgID), "CurVer", W2A(classData.m_szProgID));

  // Add the versioned ProgID subkey under HKEY_CLASSES_ROOT.
  setKeyAndValue(W2A(classData.m_szProgID), NULL, classData.m_RegistryName);
  setKeyAndValue(W2A(classData.m_szProgID), "CLSID", szCLSID);

  return S_OK ;
}

BOOL setKeyAndValue | ( | LPCTSTR | szKey,
 |  | LPCTSTR | szSubkey,
 |  | LPCTSTR | szValue = NULL,
 |  | LPCTSTR | szName = NULL
 | ) |  |

Definition at line 336 of file registry.cpp.

{
  HKEY hKey;
  char szKeyBuf[1024] ;

  // Copy keyname into buffer.
  strcpy(szKeyBuf, szKey) ;

  // Add subkey name to buffer.
  if (szSubkey != NULL)
  {
    strcat(szKeyBuf, "\\") ;
    strcat(szKeyBuf, szSubkey ) ;
  }

  // Create and open key and subkey.
  long lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
                                szKeyBuf,
                                0, NULL, REG_OPTION_NON_VOLATILE,
                                KEY_ALL_ACCESS, NULL,
                                &hKey, NULL) ;
  if (lResult != ERROR_SUCCESS)
  {
    return FALSE ;
  }

  // Set the Value.
  if (szValue != NULL)
  {
    RegSetValueEx(hKey, szName, 0, REG_SZ,
                  (BYTE *)szValue,
                  static_cast<DWORD>(strlen(szValue)+1)) ;
  }

  RegCloseKey(hKey) ;
  return TRUE ;
}

HRESULT UnRegisterProxy | ( | HMODULE | hModule,
 |  | LPCSTR | szPath
 | ) |  |

Definition at line 468 of file registry.cpp.

{
  HRESULT hr = E_FAIL;
  HINSTANCE hLib;
  HRESULT (__stdcall *DllUnregisterServer)(void);

  char FileName[MAX_PATH];

  if (szPath)
    hLib = LoadLibrary(szPath);
  else
  {
    GetModuleFileName(hModule, FileName, sizeof(FileName));
    LPSTR p = NULL;
    if((p = strrchr(FileName, '\\')) == NULL)
    {
        DEBUGTRACE(_T("Unable to find path to proxystub bombing out [%X]\n"), hr);
        return E_FAIL;
    }
    *p = NULL;
    strcat(FileName, "\\Proxy.Dll");
    hLib = LoadLibrary(FileName);
  }
  if (!hLib)
    return HRESULT_FROM_WIN32(GetLastError());
  DllUnregisterServer = (HRESULT(__stdcall*)())GetProcAddress(hLib, "DllUnregisterServer");
  if (!DllUnregisterServer)
    return HRESULT_FROM_WIN32(GetLastError());

  hr = (*DllUnregisterServer)();
  FreeLibrary(hLib);
  return hr;
}

HRESULT UnregisterServer | ( | HMODULE | hModule,
 |  | CFactoryData & | classData
 | ) |  |

Definition at line 210 of file registry.cpp.

{
  HRESULT hr;

  g_clsid = *classData.m_pCLSID;
  g_progID = const_cast<LPOLESTR>(classData.m_szProgID);

  // Convert the CLSID into a char.
  char szCLSID[CLSID_STRING_SIZE];
  CLSIDtochar(*classData.m_pCLSID, szCLSID, sizeof(szCLSID));

  // Build the key CLSID\\{...}
  char szKey[64];
  strcpy(szKey, "CLSID\\");
  strcat(szKey, szCLSID);

  // Delete the CLSID Key - CLSID\{...}
  LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
  _ASSERT((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

  // Delete the version-independent ProgID Key.
  lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, W2A(classData.m_szVerIndProgID));
  _ASSERT((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)); // Subkey may not exist.

  // Delete the ProgID key.
  lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, W2A(classData.m_szProgID));
  _ASSERT((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

  // Delete the typelibrary
  if (classData.m_pLIBID != &CLSID_NULL)
  {
    DWORD Major = HIWORD(classData.m_LibVersion);
    DWORD Minor = LOWORD(classData.m_LibVersion);
    LCID  lcid = classData.m_lcid;
    hr = UnRegisterTypeLib( *classData.m_pLIBID,
          HIWORD(classData.m_LibVersion), LOWORD(classData.m_LibVersion), classData.m_lcid, SYS_WIN32);
    if (FAILED(hr))
      return hr;
  }

  // Delete the ProxyStub entry for the custom interface
  if (classData.m_fProxy)
  {
    hr = UnRegisterProxy(hModule);
    if (FAILED(hr))
      return hr;
  }

  return S_OK;
}

Variable Documentation

CHAR_CONVERSION

Definition at line 27 of file registry.cpp.

const int CLSID_STRING_SIZE = 39

Definition at line 55 of file registry.cpp.

CLSID g_clsid

Definition at line 34 of file main.cpp.

LPOLESTR g_progID

Definition at line 35 of file main.cpp.

Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/async/server/registry.h File Reference

  • Com
  • async
  • server
Functions

registry.h File Reference

Go to the source code of this file.

Functions

HRESULT | RegisterLibrary (HMODULE hModule, const GUID &pLibIID, LPCSTR szPath=NULL)
HRESULT | RegisterProxy (HMODULE hModule, LPCSTR szPath=NULL)
HRESULT | RegisterServer (HMODULE hModule, CFactoryData &classData)
HRESULT | UnRegisterProxy (HMODULE hModule, LPCSTR szPath=NULL)
HRESULT | UnregisterServer (HMODULE hModule, CFactoryData &classData)

Function Documentation

HRESULT RegisterLibrary | ( | HMODULE | hModule,
 |  | const GUID & | pLibIID,
 |  | LPCSTR | szPath = NULL
 | ) |  |

Definition at line 378 of file registry.cpp.

{
  HRESULT hr = E_FAIL;
  LPTYPELIB ptypeLib;
  OLECHAR FileName[MAX_PATH];

  if (szPath)
  {
    MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szPath, -1, FileName, (sizeof FileName)/(sizeof FileName[0]));
    hr = LoadTypeLibEx(FileName, REGKIND_REGISTER, &ptypeLib);
  }

/*
 * try and load the typelibrary from the applications' resources
 */
  if (FAILED(hr))
  {
    char AppName[MAX_PATH];
    GetModuleFileName(hModule, AppName, sizeof(AppName));
    MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, AppName, -1, FileName, (sizeof FileName)/(sizeof FileName[0]));
    DEBUGTRACE(_T("LoadRegTypeLib failed, loading typelib from filename [%S]\n"), FileName);
    hr = LoadTypeLibEx(FileName, REGKIND_REGISTER, &ptypeLib);
/*
 * If that fails then resort to loading the typelibrary as a seperate file
 * this will only look for a typelibrary with the same name as the application
 */
    if (FAILED(hr))
    {
      LPSTR p = NULL;
      if((p = strchr(AppName, '.')) == NULL)
      {
        DEBUGTRACE(_T("Unable to append a TLB extention to app bombing out [%X]\n"), hr);
        return hr;
      }

      *p = NULL;
      strcat(AppName, ".tlb");
      MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, AppName, -1, FileName, (sizeof FileName)/(sizeof FileName[0]));
      DEBUGTRACE(_T("LoadRegTypeLib failed, loading typelib from filename [%S]\n"), FileName);
      hr = LoadTypeLibEx(FileName, REGKIND_REGISTER, &ptypeLib);
      if (FAILED(hr))
      {
        DEBUGTRACE(_T("LoadTypeLib failed bombing out [%X]\n"), hr);
        return hr;
      }
    }
  }
  RELEASEINTERFACE(ptypeLib);
  return hr;
}

HRESULT RegisterProxy | ( | HMODULE | hModule,
 |  | LPCSTR | szPath = NULL
 | ) |  |

Definition at line 432 of file registry.cpp.

{
  HRESULT hr = E_FAIL;
  HINSTANCE hLib;
  HRESULT (__stdcall *DllRegisterServer)(void);

  char FileName[MAX_PATH];

  if (szPath)
    hLib = LoadLibrary(szPath);
  else
  {
    GetModuleFileName(hModule, FileName, sizeof(FileName));
    LPSTR p = NULL;
    if((p = strrchr(FileName, '\\')) == NULL)
    {
        DEBUGTRACE(_T("Unable to find path to proxystub bombing out [%X]\n"), hr);
        return E_FAIL;
    }
    *p = NULL;
    strcat(FileName, "\\Proxy.Dll");
    hLib = LoadLibrary(FileName);
  }
  if (!hLib)
    return HRESULT_FROM_WIN32(GetLastError());
  DllRegisterServer = (HRESULT(__stdcall*)())GetProcAddress(hLib, "DllRegisterServer");
  if (!DllRegisterServer)
    return HRESULT_FROM_WIN32(GetLastError());

  hr = (*DllRegisterServer)();
  FreeLibrary(hLib);
  return hr;
}

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | CFactoryData & | classData
 | ) |  |

Definition at line 65 of file registry.cpp.

{

  // Get server location.
  HRESULT hr;
  char szModule[512];
  DWORD dwResult =
    ::GetModuleFileName(hModule,
                        szModule,
                        sizeof(szModule)/sizeof(char));

//checkcheck
  g_clsid = *classData.m_pCLSID;
  g_progID = const_cast<LPOLESTR>(classData.m_szProgID);

  _ASSERT(dwResult != 0);

  // Convert the CLSID into a char.
  char szCLSID[CLSID_STRING_SIZE];
  CLSIDtochar(*classData.m_pCLSID, szCLSID, sizeof(szCLSID));

  // Build the key CLSID\\{...}
  char szKey[64];
  strcpy(szKey, "CLSID\\");
  strcat(szKey, szCLSID);

  // Add the CLSID to the registry.
  setKeyAndValue(szKey, NULL, classData.m_RegistryName);

  // Add the server filename subkey under the CLSID key.
  switch (classData.server)
  {
    case REMOTE:
    // TODO: add AppID entries
    // fall through
    case LOCAL:
      setKeyAndValue(szKey, "LocalServer32", szModule);
      break;
    case CONTROL:
      // Add "Control" key for Insert Dialog box
      setKeyAndValue(szKey, "Control");
      // fall through
    case INPROC:
      setKeyAndValue(szKey, "InprocServer32", szModule);
      // Add threading model
      setKeyAndValue(szKey, "InprocServer32", classData.threadingModel, "ThreadingModel");
      break;
  }

  // Add the ProgID subkey under the CLSID key.
  setKeyAndValue(szKey, "ProgID", W2A(classData.m_szProgID));

  // Add the version-independent ProgID subkey under CLSID key.
  setKeyAndValue(szKey, "VersionIndependentProgID",
                 W2A(classData.m_szVerIndProgID));

  // Add the GUID for the typelib
  if (classData.m_pLIBID != &CLSID_NULL)
  {
    char typelib[CLSID_STRING_SIZE];
    CLSIDtochar(*classData.m_pLIBID, typelib, sizeof(typelib));
    setKeyAndValue(szKey, "TypeLib", typelib);
    setKeyAndValue(szKey, "Programmable");
    hr = RegisterLibrary(hModule, *classData.m_pLIBID, "Student.tlb");
    if (FAILED(hr))
      return hr;
  }

  if (classData.m_fProxy)
  {
    hr = RegisterProxy(hModule);
    if (FAILED(hr))
      return hr;
  }

  // Add "attributes" designating what this object: is, can do, needs
  char buffer[80];
  HKEY hKey;
  long lResult;

  if (classData.m_oleMisc != 0)
    setKeyAndValue(szKey, "MiscStatus", itoa(classData.m_oleMisc, buffer, 10));

  if (classData.m_oleVerbs != 0)
  {
    strcpy(buffer, szKey);
    strcat(szKey, "\\Verb");
    lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
                                szKey,
                                0, NULL, REG_OPTION_NON_VOLATILE,
                                KEY_ALL_ACCESS, NULL,
                                &hKey, NULL);

    if (lResult != ERROR_SUCCESS)
      OutputDebugString("Error creating verb\n");
    RegCloseKey(hKey);
    LPSTR end, begin = const_cast<char*>(classData.m_oleVerbs);
    if (begin)
      do
      {
        signed char lVerb = *begin++;
        end = strchr(begin, '.');
        *end++ = NULL;
        char verb[5];
        itoa(lVerb, verb, 10);
        wsprintf(buffer, "%s,%c,%c",begin, *end, *(end+2));
        setKeyAndValue(szKey, verb, buffer);
        begin = end+4;
      } while (*begin);
  }

  if (classData.m_szname != 0)
  {
  // Add names to be displayed in menus, dialogs, ....
    strcpy(szKey, "CLSID\\");
    strcat(szKey, szCLSID);
    strcat(szKey, "\\AuxUserType");
    lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
                           szKey,
                           0, NULL, REG_OPTION_NON_VOLATILE,
                           KEY_ALL_ACCESS, NULL,
                           &hKey, NULL);

    RegCloseKey(hKey);
    setKeyAndValue(szKey, "2", classData.m_szname);
    setKeyAndValue(szKey, "3", classData.m_szAppName);
  }
  // Add the version-independent ProgID subkey under HKEY_CLASSES_ROOT.
  setKeyAndValue(W2A(classData.m_szVerIndProgID), NULL, classData.m_RegistryName);
  setKeyAndValue(W2A(classData.m_szVerIndProgID), "CLSID", szCLSID);
  setKeyAndValue(W2A(classData.m_szVerIndProgID), "CurVer", W2A(classData.m_szProgID));

  // Add the versioned ProgID subkey under HKEY_CLASSES_ROOT.
  setKeyAndValue(W2A(classData.m_szProgID), NULL, classData.m_RegistryName);
  setKeyAndValue(W2A(classData.m_szProgID), "CLSID", szCLSID);

  return S_OK ;
}

HRESULT UnRegisterProxy | ( | HMODULE | hModule,
 |  | LPCSTR | szPath = NULL
 | ) |  |

Definition at line 468 of file registry.cpp.

{
  HRESULT hr = E_FAIL;
  HINSTANCE hLib;
  HRESULT (__stdcall *DllUnregisterServer)(void);

  char FileName[MAX_PATH];

  if (szPath)
    hLib = LoadLibrary(szPath);
  else
  {
    GetModuleFileName(hModule, FileName, sizeof(FileName));
    LPSTR p = NULL;
    if((p = strrchr(FileName, '\\')) == NULL)
    {
        DEBUGTRACE(_T("Unable to find path to proxystub bombing out [%X]\n"), hr);
        return E_FAIL;
    }
    *p = NULL;
    strcat(FileName, "\\Proxy.Dll");
    hLib = LoadLibrary(FileName);
  }
  if (!hLib)
    return HRESULT_FROM_WIN32(GetLastError());
  DllUnregisterServer = (HRESULT(__stdcall*)())GetProcAddress(hLib, "DllUnregisterServer");
  if (!DllUnregisterServer)
    return HRESULT_FROM_WIN32(GetLastError());

  hr = (*DllUnregisterServer)();
  FreeLibrary(hLib);
  return hr;
}

HRESULT UnregisterServer | ( | HMODULE | hModule,
 |  | CFactoryData & | classData
 | ) |  |

Definition at line 210 of file registry.cpp.

{
  HRESULT hr;

  g_clsid = *classData.m_pCLSID;
  g_progID = const_cast<LPOLESTR>(classData.m_szProgID);

  // Convert the CLSID into a char.
  char szCLSID[CLSID_STRING_SIZE];
  CLSIDtochar(*classData.m_pCLSID, szCLSID, sizeof(szCLSID));

  // Build the key CLSID\\{...}
  char szKey[64];
  strcpy(szKey, "CLSID\\");
  strcat(szKey, szCLSID);

  // Delete the CLSID Key - CLSID\{...}
  LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
  _ASSERT((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

  // Delete the version-independent ProgID Key.
  lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, W2A(classData.m_szVerIndProgID));
  _ASSERT((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)); // Subkey may not exist.

  // Delete the ProgID key.
  lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, W2A(classData.m_szProgID));
  _ASSERT((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

  // Delete the typelibrary
  if (classData.m_pLIBID != &CLSID_NULL)
  {
    DWORD Major = HIWORD(classData.m_LibVersion);
    DWORD Minor = LOWORD(classData.m_LibVersion);
    LCID  lcid = classData.m_lcid;
    hr = UnRegisterTypeLib( *classData.m_pLIBID,
          HIWORD(classData.m_LibVersion), LOWORD(classData.m_LibVersion), classData.m_lcid, SYS_WIN32);
    if (FAILED(hr))
      return hr;
  }

  // Delete the ProxyStub entry for the custom interface
  if (classData.m_fProxy)
  {
    hr = UnRegisterProxy(hModule);
    if (FAILED(hr))
      return hr;
  }

  return S_OK;
}

Generated on Wed Nov 13 2024 16:53:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/async/server/SERVER.CPP File Reference

  • Com
  • async
  • server
Defines | Variables

SERVER.CPP File Reference

#include "CFactory.h"
#include "DCOMServer.h"

Go to the source code of this file.

Defines

#define | _OLEIVERB_HIDE FD
#define | _OLEIVERB_OPEN FE
#define | _OLEIVERB_PRIMARY 0
#define | _OLEIVERB_PROPERTIES F9
#define | _OLEIVERB_SHOW FF
#define | MAKEINTI(i) i
#define | MAKEINTS1(s) #s
#define | MAKEINTS2(iVerb) MAKEINTS1(\x ## iVerb)
#define | MAKEINTVERB(iVerb, lpstrName) MAKEINTS2(iVerb) lpstrName
#define | MAKEVERSION(M, m) ((DWORD)(WORD)(m) | (DWORD)(WORD)(M) << 16)

Variables

int | g_cFactoryDataEntries = sizeof(g_FactoryDataArray) / sizeof(CFactoryData)
CFactoryData g_FactoryDataArray []

Define Documentation

#define _OLEIVERB_HIDE FD

Definition at line 46 of file SERVER.CPP.

#define _OLEIVERB_OPEN FE

Definition at line 45 of file SERVER.CPP.

#define _OLEIVERB_PRIMARY 0

Definition at line 43 of file SERVER.CPP.

#define _OLEIVERB_PROPERTIES F9

Definition at line 47 of file SERVER.CPP.

#define _OLEIVERB_SHOW FF

Definition at line 44 of file SERVER.CPP.

#define MAKEINTI ( i ) i

Definition at line 53 of file SERVER.CPP.

#define MAKEINTS1 ( s ) #s

Definition at line 50 of file SERVER.CPP.

#define MAKEINTS2 ( iVerb ) MAKEINTS1(\x ## iVerb)

Definition at line 51 of file SERVER.CPP.

#define MAKEINTVERB | ( | iVerb,
 |  | lpstrName |
 | ) |  | MAKEINTS2(iVerb) lpstrName

Definition at line 52 of file SERVER.CPP.

#define MAKEVERSION | ( | M,
 |  | m |
 | ) |  | ((DWORD)(WORD)(m) | (DWORD)(WORD)(M) << 16)

Definition at line 55 of file SERVER.CPP.

Variable Documentation

int g_cFactoryDataEntries = sizeof(g_FactoryDataArray) / sizeof(CFactoryData)

Definition at line 92 of file SERVER.CPP.

CFactoryData g_FactoryDataArray[]
Initial value:
{
  {
    MAKEVERSION(1, 0),
    LOCAL,
    NULL,
    &CLSID_AsyncTest,
    CServer::CreateInstance,
    "Async COM - Work in Progress",
    L"ASYNC_SVR.1",
    L"ASYNC_SVR",
    NULL,
    NULL,

    &CLSID_NULL,
    0,
    0,

    true,
    0,
    0
  }

}

Definition at line 61 of file SERVER.CPP.

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/async/server/UNK.H File Reference

  • Com
  • async
  • server
Defines

UNK.H File Reference

Go to the source code of this file.

Defines

#define DECLARE_UNKNOWN

Define Documentation

#define DECLARE_UNKNOWN
Value:
virtual HRESULT __stdcall                     \
    QueryInterface(REFIID iid, PVOID *ppv);             \
    virtual ULONG __stdcall AddRef()                  \
  {                                 \
    return InterlockedIncrement(reinterpret_cast<PLONG>(&m_cRef));  \
  } ;                                 \
  virtual ULONG __stdcall Release()                 \
  {                                 \
    _ASSERT(m_cRef > 0); /* not thread safe */            \
    if (InterlockedDecrement(reinterpret_cast<PLONG>(&m_cRef)) == 0)\
    {                               \
      FinalRelease();                       \
      delete this;                        \
      return 0;                         \
    }                               \
    return m_cRef;                          \
                                    \
  } ;                                 \
  virtual void __stdcall FinalRelease();

Definition at line 18 of file UNK.H.

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Common/Inc/CpyImage.Idl File Reference

  • Com
  • Common
  • Inc
Functions | Variables

CpyImage.Idl File Reference

Go to the source code of this file.

Functions

library CPYIMAGELib | importlib ("stdole2.tlb")
HRESULT | SetAbort ()
HRESULT | SetComplete ()
HRESULT | Test ([out] BSTR *msg)

Variables

import oaidl | idl
interface BSTR BSTR BSTR BSTR
BSTR * 		msg
interface BSTR BSTR | sDescription
interface BSTR BSTR BSTR | sMainColor
interface BSTR BSTR BSTR BSTR | sTheme
interface BSTR | sToFile

Function Documentation

library CPYIMAGELib importlib ( "stdole2.tlb" )
HRESULT SetAbort ( )
HRESULT SetComplete ( )
HRESULT Test ( [out] BSTR * msg )

Variable Documentation

import oaidl idl

Definition at line 26 of file CpyImage.Idl.

interface BSTR BSTR BSTR BSTR BSTR* msg

Definition at line 43 of file CpyImage.Idl.

interface BSTR BSTR sDescription

Definition at line 43 of file CpyImage.Idl.

interface BSTR BSTR BSTR sMainColor

Definition at line 43 of file CpyImage.Idl.

interface BSTR BSTR BSTR BSTR sTheme

Definition at line 43 of file CpyImage.Idl.

interface BSTR sToFile

Definition at line 43 of file CpyImage.Idl.

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Common/Inc/MtsAudit.Idl File Reference

  • Com
  • Common
  • Inc
Typedefs | Functions | Variables

MtsAudit.Idl File Reference

Go to the source code of this file.

Typedefs

typedef ULONG64 | MTS_OBJID
typedef ULONG64 | MTS_RESID

Functions

HRESULT | Init (LPCOLESTR sDSN, LPCOLESTR sUser, LPCOLESTR sPw)
HRESULT | OnAuthenticate (LONGLONG perfCount, LPCOLESTR guidActivity, LPCOLESTR sOriginalUser, LPCOLESTR sDirectUser, BOOL bCurrentUserInpersonatingInProc)
HRESULT | OnDisableCommit ([in] LONGLONG perfCount,[in] MTS_OBJID ObjectID)
HRESULT | OnEnableCommit ([in] LONGLONG perfCount,[in] MTS_OBJID ObjectID)
HRESULT | OnMethodCall ([in] LONGLONG perfCount,[in] MTS_OBJID oid,[in] LPCOLESTR guidCid,[in] LPCOLESTR guidRid,[in] LPCOLESTR sMethod)
HRESULT | OnMethodException ([in] LONGLONG perfCount,[in] MTS_OBJID oid,[in] LPCOLESTR guidCid,[in] LPCOLESTR guidRid,[in] LPCOLESTR sMethod)
HRESULT | OnMethodReturn ([in] LONGLONG perfCount,[in] MTS_OBJID oid,[in] LPCOLESTR guidCid,[in] LPCOLESTR guidRid,[in] LPCOLESTR sMethod,[in] HRESULT hresult)
HRESULT | OnObjectActivate ([in] LONGLONG perfCount,[in] MTS_OBJID ObjectID)
HRESULT | OnObjectCreate ([in] LONGLONG perfCount,[in] LPCOLESTR guidActivity,[in] LPCOLESTR clsid,[in] LPCOLESTR tsid,[in] MTS_OBJID ObjectID)
HRESULT | OnObjectDeactivate ([in] LONGLONG perfCount,[in] MTS_OBJID ObjectID)
HRESULT | OnObjectRelease ([in] LONGLONG perfCount,[in] MTS_OBJID ObjectID)
HRESULT | OnPackageActivation ([in] LONGLONG perfCount,[in] LPCOLESTR guidPackage,[in] LPCOLESTR sPackageName)
HRESULT | OnPackageShutdown ([in] LONGLONG perfCount,[in] LPCOLESTR guidPackage,[in] LPCOLESTR sPackageName)
HRESULT | OnResourceAllocate ([in] LONGLONG perfCount,[in] LPCOLESTR guidActivity,[in] MTS_OBJID ObjectID,[in] LPCOLESTR pszType,[in] MTS_RESID resId)
HRESULT | OnResourceCreate ([in] LONGLONG perfCount,[in] LPCOLESTR guidActivity,[in] MTS_OBJID ObjectID,[in] LPCOLESTR pszType,[in] MTS_RESID resId)
HRESULT | OnResourceDestroy ([in] LONGLONG perfCount,[in] MTS_OBJID ObjectID,[in] LPCOLESTR pszType,[in] MTS_RESID resId)
HRESULT | OnResourceRecycle ([in] LONGLONG perfCount,[in] MTS_OBJID ObjectID,[in] LPCOLESTR pszType,[in] MTS_RESID resId)
HRESULT | OnSetComplete ([in] LONGLONG perfCount,[in] MTS_OBJID ObjectID)
HRESULT | OnThreadAssignToActivity ([in] LONGLONG perfCount,[in] LPCOLESTR guidActivity,[in] ULONG ThreadID)
HRESULT | OnThreadStart ([in] LONGLONG perfCount,[in] ULONG ThreadID)
HRESULT | OnThreadTerminate ([in] LONGLONG perfCount,[in] ULONG ThreadID)
HRESULT | OnThreadUnassignFromActivity ([in] LONGLONG perfCount,[in] LPCOLESTR guidActivity,[in] ULONG ThreadID)
HRESULT | OnTransactionAborted ([in] LONGLONG perfCount,[in] LPCOLESTR guidTx)
HRESULT | OnTransactionPrepared ([in] LONGLONG perfCount,[in] LPCOLESTR guidTx,[in] BOOL fVoteYes)
HRESULT | OnTransactionStart ([in] LONGLONG perfCount,[in] LPCOLESTR guidTx,[in] LPCOLESTR tsid,[in] BOOL fRoot)

Variables

import oaidl | idl
interface VARIANT * | pvarEvent

Typedef Documentation

typedef ULONG64 MTS_OBJID

Definition at line 10 of file MtsAudit.Idl.

typedef ULONG64 MTS_RESID

Definition at line 11 of file MtsAudit.Idl.

Function Documentation

HRESULT Init | ( | LPCOLESTR | sDSN,
 |  | LPCOLESTR | sUser,
 |  | LPCOLESTR | sPw
 | ) |  |
HRESULT OnAuthenticate | ( | LONGLONG | perfCount,
 |  | LPCOLESTR | guidActivity,
 |  | LPCOLESTR | sOriginalUser,
 |  | LPCOLESTR | sDirectUser,
 |  | BOOL | bCurrentUserInpersonatingInProc
 | ) |  |
HRESULT OnDisableCommit | ( | [in] LONGLONG | perfCount,
 |  | [in] MTS_OBJID | ObjectID
 | ) |  |
HRESULT OnEnableCommit | ( | [in] LONGLONG | perfCount,
 |  | [in] MTS_OBJID | ObjectID
 | ) |  |
HRESULT OnMethodCall | ( | [in] LONGLONG | perfCount,
 |  | [in] MTS_OBJID | oid,
 |  | [in] LPCOLESTR | guidCid,
 |  | [in] LPCOLESTR | guidRid,
 |  | [in] LPCOLESTR | sMethod
 | ) |  |
HRESULT OnMethodException | ( | [in] LONGLONG | perfCount,
 |  | [in] MTS_OBJID | oid,
 |  | [in] LPCOLESTR | guidCid,
 |  | [in] LPCOLESTR | guidRid,
 |  | [in] LPCOLESTR | sMethod
 | ) |  |
HRESULT OnMethodReturn | ( | [in] LONGLONG | perfCount,
 |  | [in] MTS_OBJID | oid,
 |  | [in] LPCOLESTR | guidCid,
 |  | [in] LPCOLESTR | guidRid,
 |  | [in] LPCOLESTR | sMethod,
 |  | [in] HRESULT | hresult
 | ) |  |
HRESULT OnObjectActivate | ( | [in] LONGLONG | perfCount,
 |  | [in] MTS_OBJID | ObjectID
 | ) |  |
HRESULT OnObjectCreate | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | guidActivity,
 |  | [in] LPCOLESTR | clsid,
 |  | [in] LPCOLESTR | tsid,
 |  | [in] MTS_OBJID | ObjectID
 | ) |  |
HRESULT OnObjectDeactivate | ( | [in] LONGLONG | perfCount,
 |  | [in] MTS_OBJID | ObjectID
 | ) |  |
HRESULT OnObjectRelease | ( | [in] LONGLONG | perfCount,
 |  | [in] MTS_OBJID | ObjectID
 | ) |  |
HRESULT OnPackageActivation | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | guidPackage,
 |  | [in] LPCOLESTR | sPackageName
 | ) |  |
HRESULT OnPackageShutdown | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | guidPackage,
 |  | [in] LPCOLESTR | sPackageName
 | ) |  |
HRESULT OnResourceAllocate | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | guidActivity,
 |  | [in] MTS_OBJID | ObjectID,
 |  | [in] LPCOLESTR | pszType,
 |  | [in] MTS_RESID | resId
 | ) |  |
HRESULT OnResourceCreate | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | guidActivity,
 |  | [in] MTS_OBJID | ObjectID,
 |  | [in] LPCOLESTR | pszType,
 |  | [in] MTS_RESID | resId
 | ) |  |
HRESULT OnResourceDestroy | ( | [in] LONGLONG | perfCount,
 |  | [in] MTS_OBJID | ObjectID,
 |  | [in] LPCOLESTR | pszType,
 |  | [in] MTS_RESID | resId
 | ) |  |
HRESULT OnResourceRecycle | ( | [in] LONGLONG | perfCount,
 |  | [in] MTS_OBJID | ObjectID,
 |  | [in] LPCOLESTR | pszType,
 |  | [in] MTS_RESID | resId
 | ) |  |
HRESULT OnSetComplete | ( | [in] LONGLONG | perfCount,
 |  | [in] MTS_OBJID | ObjectID
 | ) |  |
HRESULT OnThreadAssignToActivity | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | guidActivity,
 |  | [in] ULONG | ThreadID
 | ) |  |
HRESULT OnThreadStart | ( | [in] LONGLONG | perfCount,
 |  | [in] ULONG | ThreadID
 | ) |  |
HRESULT OnThreadTerminate | ( | [in] LONGLONG | perfCount,
 |  | [in] ULONG | ThreadID
 | ) |  |
HRESULT OnThreadUnassignFromActivity | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | guidActivity,
 |  | [in] ULONG | ThreadID
 | ) |  |
HRESULT OnTransactionAborted | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | guidTx
 | ) |  |
HRESULT OnTransactionPrepared | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | guidTx,
 |  | [in] BOOL | fVoteYes
 | ) |  |
HRESULT OnTransactionStart | ( | [in] LONGLONG | perfCount,
 |  | [in] LPCOLESTR | guidTx,
 |  | [in] LPCOLESTR | tsid,
 |  | [in] BOOL | fRoot
 | ) |  |

Variable Documentation

import ocidl idl

Definition at line 7 of file MtsAudit.Idl.

interface VARIANT* pvarEvent

Definition at line 24 of file MtsAudit.Idl.

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Common/Inc/MtsSpyCtl.Idl File Reference

  • Com
  • Common
  • Inc
Functions | Variables

MtsSpyCtl.Idl File Reference

#include <olectl.h>

Go to the source code of this file.

Functions

HRESULT | About ()
HRESULT | Audit ([out, retval] BOOL *pVal)
HRESULT | Audit ([in] BOOL newVal)
HRESULT | ChooseFont ()
HRESULT | ChooseLogFile ([out] BSTR *sLogFileName,[out] BOOL *bCanceled)
HRESULT | ClearAllEvents ()
HRESULT | ColWidth (short nColumn,[in] long newVal)
HRESULT | ColWidth (short nColumn,[out, retval] long *pVal)
cpp_quote ("#define DISPID_LOGFILE 5") cpp_quote("cpp_quote ("cpp_quote(" typedef enum
HRESULT | Font ([out, retval]IFontDisp **ppFont)
HRESULT | Font ([in]IFontDisp *pFont)
HRESULT | GetEventClass ([out] LPGUID guid)
interface | id (DISPID_HWND)] HRESULT Window([out
HRESULT | Install ([in] BSTR *PropertyName,[in] VARIANT PropertyValue)
HRESULT | LogFile ([out, retval] BSTR *pVal)
HRESULT | LogFile ([in] BSTR newVal)
HRESULT | LogToFile ([in] BOOL newVal)
HRESULT | LogToFile ([out, retval] BOOL *pVal)
HRESULT | SaveToFile ()
HRESULT | SelectPackages ()
HRESULT | ShowGridLines ([out, retval] BOOL *pVal)
HRESULT | ShowGridLines ([in] BOOL newVal)
HRESULT | ShowOnScreen ([out, retval] BOOL *pVal)
HRESULT | ShowOnScreen ([in] BOOL newVal)
HRESULT | Uninstall ()

Variables

EventEnum
import oaidl | idl
interface retval long * | phwnd

Function Documentation

HRESULT About ( )
HRESULT Audit ( [out, retval] BOOL * pVal ) [get]
HRESULT Audit ( [in] BOOL newVal ) [set]
HRESULT ChooseFont ( )
HRESULT ChooseLogFile | ( | [out] BSTR * | sLogFileName,
 |  | [out] BOOL * | bCanceled
 | ) |  |
HRESULT ClearAllEvents ( )
HRESULT ColWidth | ( | short | nColumn,
 |  | [in] long | newVal |
 | ) |  |  | [set]
HRESULT ColWidth | ( | short | nColumn,
 |  | [out, retval] long * | pVal |
 | ) |  |  | [get]
cpp_quote ( "#define DISPID_LOGFILE 5" )

Definition at line 7 of file MtsSpyCtl.Idl.

{
  Package = 0,
  Thread,
  Instance,
  Transaction,
  Method,
  Object,
  Resource,
  User,
  Security,
  EventStore,
  ObjectPool,
  ObjectPool2,
  ObjectConstruction,
  Activity,
  Identity,
  QC,
  Exception,
  CRM,

} EventEnum;

HRESULT Font ( [out, retval] IFontDisp ** ppFont ) [get]
HRESULT Font ( [in] IFontDisp * pFont ) [set]
HRESULT GetEventClass ( [out] LPGUID guid )
interface id ( DISPID_HWND )
HRESULT Install | ( | [in] BSTR * | PropertyName,
 |  | [in] VARIANT | PropertyValue
 | ) |  |
HRESULT LogFile ( [out, retval] BSTR * pVal ) [get]
HRESULT LogFile ( [in] BSTR newVal ) [set]
HRESULT LogToFile ( [in] BOOL newVal ) [set]
HRESULT LogToFile ( [out, retval] BOOL * pVal ) [get]
HRESULT SaveToFile ( )
HRESULT SelectPackages ( )
HRESULT ShowGridLines ( [out, retval] BOOL * pVal ) [get]
HRESULT ShowGridLines ( [in] BOOL newVal ) [set]
HRESULT ShowOnScreen ( [out, retval] BOOL * pVal ) [get]
HRESULT ShowOnScreen ( [in] BOOL newVal ) [set]
HRESULT Uninstall ( )

Variable Documentation

EventEnum

Definition at line 33 of file MtsSpyCtl.Idl.

import ocidl idl

Definition at line 35 of file MtsSpyCtl.Idl.

interface retval long* phwnd

Definition at line 49 of file MtsSpyCtl.Idl.

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Common/Inc/MtsUserEventObj.Idl File Reference

  • Com
  • Common
  • Inc
Functions | Variables

MtsUserEventObj.Idl File Reference

Go to the source code of this file.

Functions

HRESULT | GuidEventId ([in] BSTR newVal)
interface | helpstring ("property DisplayName")] HRESULT DisplayName([in] BSTR new Val)
interface | id (1)
HRESULT | Value (BSTR sKey,[in] VARIANT *newVal)

Variables

import oaidl | idl

Function Documentation

HRESULT GuidEventId ( [in] BSTR newVal ) [set]
interface helpstring ( "property DisplayName" ) [new]
interface id ( 1 )
HRESULT Value | ( | BSTR | sKey,
 |  | [in] VARIANT * | newVal |
 | ) |  |  | [set]

Variable Documentation

import ocidl idl

Definition at line 26 of file MtsUserEventObj.Idl.

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Common/Inc/RmWorker.Idl File Reference

  • Com
  • Common
  • Inc
Typedefs | Enumerations | Functions | Variables

RmWorker.Idl File Reference

Go to the source code of this file.

Typedefs

typedef enum tagRECOVERY_STATE | RECOVERY_STATE
typedef enum tagRECOVERYRC | RECOVERYRC
typedef enum tagRMSTATUS | RMSTATUS

Enumerations

enum FILE_OPERATION {
RM_COPY, RM_DELETE, RM_MOVE, RM_RENAME,
RM_UNDO, RM_NONE, RM_FORGET, RM_UNDO_BEGIN,
RM_UNDO_END
}
enum tagRECOVERY_STATE {
REC_STATE_ACTIVE, REC_STATE_COMPLETED, REC_STATE_DORMANT, REC_STATE_INDOUBT,
REC_STATE_ABORTING
}
enum tagRECOVERYRC {
REC_S_SUCCESS, REC_E_NO_MEMORY, REC_E_ORPHANED_TRANSACTION, REC_E_INVALID_STATE,
REC_E_PREPARE_SEQUENCE, REC_E_UNDO_SEQUENCE, REC_E_END_TRANSACTION_SEQUENCE, REC_E_FORGET_SEQUENCE,
REC_E_BEGINUNDO_SEQUENCE, REC_E_ENDUNDO_SEQUENCE, REC_E_COMMIT_SEQUENCE, REC_E_TRANSACTION_DUPLICATED,
REC_E_INVALID_LOG_RECORD, REC_E_LOG_FAILURE, REC_E_STATE_UNKNOWN, REC_E_UNDO_INCOMPLETE,
REC_E_INDOUBT_INVALID, REC_E_REENLIST, REC_E_TM_DOWN, REC_E_OUTCOMEACTION
}
enum tagRMSTATUS {
RM_STATUS_SUCCESS, RM_STATUS_FAILURE, RM_STATUS_UNDO_ERROR, RM_STATUS_LOG_ERROR,
RM_STATUS_COPY_FAILURE, RM_STATUS_DELETE_FAILURE, RM_STATUS_RENAME_FAILURE, RM_STATUS_MOVE_FAILURE,
RM_STATUS_IN_MEMORY_LIST, RM_STATUS_OVERWRITE_EXISTING, RM_STATUS_FILE_NOT_FOUND, RM_STATUS_INTERFACE,
RM_STATUS_NO_MEMORY, RM_STATUS_INVALID_PARM, RM_STATUS_IMPORT_ERROR, RM_STATUS_ENLIST_ERROR,
RM_STATUS_INVALID_STATE, RM_STATUS_TM_DOWN, RM_STATUS_RECOVERY_FAILURE
}
enum TXSTATE {
TX_UNINITIALIZED, TX_INITIALIZING, TX_INITIALIZED, TX_ENLISTING,
TX_ENLISTED, TX_PREPARING, TX_PREPARED, TX_COMMITTING,
TX_COMMITTED, TX_ABORTING, TX_ABORTED, TX_DONE,
TX_TMDOWN, TX_INVALID_STATE
}

Functions

HRESULT | AbortTx (void)
HRESULT | AddFile ([in] BSTR sSource,[in] BSTR sDestination)
HRESULT | CleanupTx (void)
HRESULT | CommitTx (void)
HRESULT | CopyListTx ()
HRESULT | ExportTx ([in] ULONG cbTranCookie,[out]BYTE *rgbTranCookie)
HRESULT | FileDeleteTx ([in] BSTR sFileName)
HRESULT | FileMoveTxt ([in] BSTR sSource,[in] BSTR sDestination)
HRESULT | FileRenameTx ([in] BSTR sSource,[in] BSTR sDestination)
HRESULT | GetDTCUnknown ([out] IUnknown **pUnk)
HRESULT | GetState ([out] TXSTATE *eState)
HRESULT | GetTransactionId ([out] BSTR *guidTx)
HRESULT | Init ([in] IUnknown *pUnkLog,[in] IUnknown *pUnkDtcResMgr,[in]IUnknown *pUnkDtc,[in] BSTR sRecDir)
HRESULT | PrepareTx (void)
HRESULT | Recover (IStorage *pStorage)
HRESULT | Reset ()
HRESULT | SetState ([in] TXSTATE eState)
HRESULT | TMDown ()

Variables

interface BSTR BOOL | bFailIfExists
import oaidl | idl
interface BSTR | sDestination

Typedef Documentation

typedef enum tagRECOVERY_STATE RECOVERY_STATE
typedef enum tagRECOVERYRC RECOVERYRC
typedef enum tagRMSTATUS RMSTATUS

Enumeration Type Documentation

enum FILE_OPERATION
Enumerator:
RM_COPY
RM_DELETE
RM_MOVE
RM_RENAME
RM_UNDO
RM_NONE
RM_FORGET
RM_UNDO_BEGIN
RM_UNDO_END

Definition at line 125 of file RmWorker.Idl.

{
  RM_COPY,
  RM_DELETE,
  RM_MOVE,
  RM_RENAME,
  RM_UNDO,
  RM_NONE,
  RM_FORGET,
  RM_UNDO_BEGIN,
  RM_UNDO_END

} FILE_OPERATION;

enum tagRECOVERY_STATE
Enumerator:
REC_STATE_ACTIVE
REC_STATE_COMPLETED
REC_STATE_DORMANT
REC_STATE_INDOUBT
REC_STATE_ABORTING

Definition at line 90 of file RmWorker.Idl.

{
  REC_STATE_ACTIVE,
  REC_STATE_COMPLETED,
  REC_STATE_DORMANT,
  REC_STATE_INDOUBT,
  REC_STATE_ABORTING
} RECOVERY_STATE;

enum tagRECOVERYRC
Enumerator:
REC_S_SUCCESS
REC_E_NO_MEMORY
REC_E_ORPHANED_TRANSACTION
REC_E_INVALID_STATE
REC_E_PREPARE_SEQUENCE
REC_E_UNDO_SEQUENCE
REC_E_END_TRANSACTION_SEQUENCE
REC_E_FORGET_SEQUENCE
REC_E_BEGINUNDO_SEQUENCE
REC_E_ENDUNDO_SEQUENCE
REC_E_COMMIT_SEQUENCE
REC_E_TRANSACTION_DUPLICATED
REC_E_INVALID_LOG_RECORD
REC_E_LOG_FAILURE
REC_E_STATE_UNKNOWN
REC_E_UNDO_INCOMPLETE
REC_E_INDOUBT_INVALID
REC_E_REENLIST
REC_E_TM_DOWN
REC_E_OUTCOMEACTION

Definition at line 60 of file RmWorker.Idl.

{
  REC_S_SUCCESS,
  REC_E_NO_MEMORY,
  REC_E_ORPHANED_TRANSACTION,
  REC_E_INVALID_STATE,
  REC_E_PREPARE_SEQUENCE,
  REC_E_UNDO_SEQUENCE,
  REC_E_END_TRANSACTION_SEQUENCE,
  REC_E_FORGET_SEQUENCE,
  REC_E_BEGINUNDO_SEQUENCE,
  REC_E_ENDUNDO_SEQUENCE,
  REC_E_COMMIT_SEQUENCE,
  REC_E_TRANSACTION_DUPLICATED,
  REC_E_INVALID_LOG_RECORD,
  REC_E_LOG_FAILURE,
  REC_E_STATE_UNKNOWN,
  REC_E_UNDO_INCOMPLETE,
  REC_E_INDOUBT_INVALID,
  REC_E_REENLIST,
  REC_E_TM_DOWN,
  REC_E_OUTCOMEACTION
} RECOVERYRC;

enum tagRMSTATUS
Enumerator:
RM_STATUS_SUCCESS
RM_STATUS_FAILURE
RM_STATUS_UNDO_ERROR
RM_STATUS_LOG_ERROR
RM_STATUS_COPY_FAILURE
RM_STATUS_DELETE_FAILURE
RM_STATUS_RENAME_FAILURE
RM_STATUS_MOVE_FAILURE
RM_STATUS_IN_MEMORY_LIST
RM_STATUS_OVERWRITE_EXISTING
RM_STATUS_FILE_NOT_FOUND
RM_STATUS_INTERFACE
RM_STATUS_NO_MEMORY
RM_STATUS_INVALID_PARM
RM_STATUS_IMPORT_ERROR
RM_STATUS_ENLIST_ERROR
RM_STATUS_INVALID_STATE
RM_STATUS_TM_DOWN
RM_STATUS_RECOVERY_FAILURE

Definition at line 32 of file RmWorker.Idl.

{
  RM_STATUS_SUCCESS,
  RM_STATUS_FAILURE,
  RM_STATUS_UNDO_ERROR,
  RM_STATUS_LOG_ERROR,
  RM_STATUS_COPY_FAILURE,
  RM_STATUS_DELETE_FAILURE,
  RM_STATUS_RENAME_FAILURE,
  RM_STATUS_MOVE_FAILURE,
  RM_STATUS_IN_MEMORY_LIST,
  RM_STATUS_OVERWRITE_EXISTING,
  RM_STATUS_FILE_NOT_FOUND,
  RM_STATUS_INTERFACE,
  RM_STATUS_NO_MEMORY,
  RM_STATUS_INVALID_PARM,
  RM_STATUS_IMPORT_ERROR,
  RM_STATUS_ENLIST_ERROR,
  RM_STATUS_INVALID_STATE,
  RM_STATUS_TM_DOWN,
  RM_STATUS_RECOVERY_FAILURE
} RMSTATUS;

enum TXSTATE
Enumerator:
TX_UNINITIALIZED
TX_INITIALIZING
TX_INITIALIZED
TX_ENLISTING
TX_ENLISTED
TX_PREPARING
TX_PREPARED
TX_COMMITTING
TX_COMMITTED
TX_ABORTING
TX_ABORTED
TX_DONE
TX_TMDOWN
TX_INVALID_STATE

Definition at line 107 of file RmWorker.Idl.

{
  TX_UNINITIALIZED,
  TX_INITIALIZING,
  TX_INITIALIZED,
  TX_ENLISTING,
  TX_ENLISTED,
  TX_PREPARING,
  TX_PREPARED,
  TX_COMMITTING,
  TX_COMMITTED,
  TX_ABORTING,
  TX_ABORTED,
  TX_DONE,
  TX_TMDOWN,
  TX_INVALID_STATE
} TXSTATE;

Function Documentation

HRESULT AbortTx ( void )
HRESULT AddFile | ( | [in] BSTR | sSource,
 |  | [in] BSTR | sDestination
 | ) |  |
HRESULT CleanupTx ( void )
HRESULT CommitTx ( void )
HRESULT CopyListTx ( )
HRESULT ExportTx | ( | [in] ULONG | cbTranCookie,
 |  | [out] BYTE * | rgbTranCookie
 | ) |  |
HRESULT FileDeleteTx ( [in] BSTR sFileName )
HRESULT FileMoveTxt | ( | [in] BSTR | sSource,
 |  | [in] BSTR | sDestination
 | ) |  |
HRESULT FileRenameTx | ( | [in] BSTR | sSource,
 |  | [in] BSTR | sDestination
 | ) |  |
HRESULT GetDTCUnknown ( [out] IUnknown ** pUnk )
HRESULT GetState ( [out] TXSTATE * eState )
HRESULT GetTransactionId ( [out] BSTR * guidTx )
HRESULT Init | ( | [in] IUnknown * | pUnkLog,
 |  | [in] IUnknown * | pUnkDtcResMgr,
 |  | [in] IUnknown * | pUnkDtc,
 |  | [in] BSTR | sRecDir
 | ) |  |
HRESULT PrepareTx ( void )
HRESULT Recover ( IStorage * pStorage )
HRESULT Reset ( )
HRESULT SetState ( [in] TXSTATE eState )
HRESULT TMDown ( )

Variable Documentation

interface BSTR BOOL bFailIfExists

Definition at line 151 of file RmWorker.Idl.

import oaidl idl

Definition at line 25 of file RmWorker.Idl.

interface BSTR sDestination

Definition at line 151 of file RmWorker.Idl.

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Common/Inc/TxFileDisp.Idl File Reference

  • Com
  • Common
  • Inc
Functions | Variables

TxFileDisp.Idl File Reference

Go to the source code of this file.

Functions

HRESULT | Connect ([out] long *hConnection)
HRESULT | CopyDirTx ([in] long hConnection,[in] BSTR sSource,[in] BSTR sDestination)
HRESULT | CopyFilesInCopyList ([in] long hConnection)
HRESULT | CopyFileTx ([in] long hConnection,[in] BSTR sSource,[in] BSTR sDestination, BOOL bFailIfExists)
HRESULT | DeleteFileTx ([in] long hConnection,[in] BSTR sFileName)
HRESULT | Disconnect ([in] long hConnection)
HRESULT | MoveFileTx ([in] long hConnection,[in] BSTR sSource,[in] BSTR sDestination)

Variables

import oaidl | idl
interface BSTR BSTR | sDestination
interface BSTR | sSource

Function Documentation

HRESULT Connect ( [out] long * hConnection )
HRESULT CopyDirTx | ( | [in] long | hConnection,
 |  | [in] BSTR | sSource,
 |  | [in] BSTR | sDestination
 | ) |  |
HRESULT CopyFilesInCopyList ( [in] long hConnection )
HRESULT CopyFileTx | ( | [in] long | hConnection,
 |  | [in] BSTR | sSource,
 |  | [in] BSTR | sDestination,
 |  | BOOL | bFailIfExists
 | ) |  |
HRESULT DeleteFileTx | ( | [in] long | hConnection,
 |  | [in] BSTR | sFileName
 | ) |  |
HRESULT Disconnect ( [in] long hConnection )
HRESULT MoveFileTx | ( | [in] long | hConnection,
 |  | [in] BSTR | sSource,
 |  | [in] BSTR | sDestination
 | ) |  |

Variable Documentation

import oaidl idl

Definition at line 25 of file TxFileDisp.Idl.

interface BSTR BSTR sDestination

Definition at line 41 of file TxFileDisp.Idl.

interface BSTR sSource

Definition at line 41 of file TxFileDisp.Idl.

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Common/ProxyStub/CopyFileRm.Idl File Reference

  • Com
  • Common
  • ProxyStub
Functions | Variables

CopyFileRm.Idl File Reference

Go to the source code of this file.

Functions

HRESULT | AddFile ([in] long lConHandle,[in] BSTR sSource,[in] BSTR sDestination)
HRESULT | Connect ([in] BSTR sAppName,[out] long *ulConnHandle)
HRESULT | Disconnect ([in] long ulConnHandle)
HRESULT | ExportTx ([in] long lConHandle,[in] ULONG cbTranCookie,[in, size_is(cbTranCookie)]BYTE *rgbTranCookie)
HRESULT | FileCopyTx ([in] long lConHandle,[in] BSTR sSource,[in] BSTR sDestination,[in] BOOL bFailIfExists)
HRESULT | FileDeleteTx ([in] long lConHandle,[in] BSTR sFileName)
HRESULT | FileMoveTxt ([in] long lConHandle,[in] BSTR sSource,[in] BSTR sDestination)
HRESULT | FileRenameTx ([in] long lConHandle,[in] BSTR sSource,[in] BSTR sDestination)
HRESULT | GetTmWhereabouts ([in] long lConHandle,[out, size_is(,*pcbTmAddr)]BYTE **rgbTmAddr,[out] ULONG *pcbTmAddr)
HRESULT | ResetConnection ([in] long lConHandle)
HRESULT | TMDown ()

Variables

import oaidl | idl

Function Documentation

HRESULT AddFile | ( | [in] long | lConHandle,
 |  | [in] BSTR | sSource,
 |  | [in] BSTR | sDestination
 | ) |  |
HRESULT Connect | ( | [in] BSTR | sAppName,
 |  | [out] long * | ulConnHandle
 | ) |  |
HRESULT Disconnect ( [in] long ulConnHandle )
HRESULT ExportTx | ( | [in] long | lConHandle,
 |  | [in] ULONG | cbTranCookie,
 |  | [in, size_is(cbTranCookie)] BYTE * | rgbTranCookie
 | ) |  |
HRESULT FileCopyTx | ( | [in] long | lConHandle,
 |  | [in] BSTR | sSource,
 |  | [in] BSTR | sDestination,
 |  | [in] BOOL | bFailIfExists
 | ) |  |
HRESULT FileDeleteTx | ( | [in] long | lConHandle,
 |  | [in] BSTR | sFileName
 | ) |  |
HRESULT FileMoveTxt | ( | [in] long | lConHandle,
 |  | [in] BSTR | sSource,
 |  | [in] BSTR | sDestination
 | ) |  |
HRESULT FileRenameTx | ( | [in] long | lConHandle,
 |  | [in] BSTR | sSource,
 |  | [in] BSTR | sDestination
 | ) |  |
HRESULT GetTmWhereabouts | ( | [in] long | lConHandle,
 |  | [out, size_is(,*pcbTmAddr)] BYTE ** | rgbTmAddr,
 |  | [out] ULONG * | pcbTmAddr
 | ) |  |
HRESULT ResetConnection ( [in] long lConHandle )
HRESULT TMDown ( )

Variable Documentation

import ocidl idl

Definition at line 25 of file CopyFileRm.Idl.

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Common/ProxyStub/iid.c File Reference

  • Com
  • Common
  • ProxyStub

iid.c File Reference

#include "copyfilerm_i.c"
#include "simplelog_i.c"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Common/ProxyStub/SimpleLog.Idl File Reference

  • Com
  • Common
  • ProxyStub
Typedefs | Functions | Variables

SimpleLog.Idl File Reference

Go to the source code of this file.

Typedefs

typedef long | LOG_RM_COMMAND

Functions

HRESULT | GetStream (GUID guidTx,[out] IStream **ppStream)
HRESULT | Init ([in]BSTR pszLogFileName)
HRESULT | RecoveryInfo ([out] IStorage **ppStorage)
HRESULT | RemoveTxStream (GUID guidTx)
HRESULT | WriteStreamToLog (GUID GuidTx, LOG_RM_COMMAND eOp, IStream *pStream)
HRESULT | WriteVariantToLog (GUID m_guidTx, VARIANT *pVariant)

Variables

interface LOG_RM_COMMAND BYTE long | cbBytes
interface LOG_RM_COMMAND | eOp
import oaidl | idl
const LOG_RM_COMMAND | LOG_RM_ABORT_REQUEST = 20
const LOG_RM_COMMAND | LOG_RM_CHECKPOINT = 7
const LOG_RM_COMMAND | LOG_RM_COMMIT_REQUEST = 21
const LOG_RM_COMMAND | LOG_RM_ENDOFLOG = 6
const LOG_RM_COMMAND | LOG_RM_PRIVATE = 1
const LOG_RM_COMMAND | LOG_RM_XACT_BEGIN = 4
const LOG_RM_COMMAND | LOG_RM_XACT_COMMIT = 3
const LOG_RM_COMMAND | LOG_RM_XACT_END = 5
const LOG_RM_COMMAND | LOG_RM_XACT_PREPARE = 2
interface LOG_RM_COMMAND BYTE * | pByte

Typedef Documentation

typedef long LOG_RM_COMMAND

Definition at line 32 of file SimpleLog.Idl.

Function Documentation

HRESULT GetStream | ( | GUID | guidTx,
 |  | [out] IStream ** | ppStream
 | ) |  |
HRESULT Init ( [in] BSTR pszLogFileName )
HRESULT RecoveryInfo ( [out] IStorage ** ppStorage )
HRESULT RemoveTxStream ( GUID guidTx )
HRESULT WriteStreamToLog | ( | GUID | GuidTx,
 |  | LOG_RM_COMMAND | eOp,
 |  | IStream * | pStream
 | ) |  |
HRESULT WriteVariantToLog | ( | GUID | m_guidTx,
 |  | VARIANT * | pVariant
 | ) |  |

Variable Documentation

interface LOG_RM_COMMAND BYTE long cbBytes

Definition at line 56 of file SimpleLog.Idl.

interface LOG_RM_COMMAND eOp

Definition at line 56 of file SimpleLog.Idl.

import oaidl idl

Definition at line 25 of file SimpleLog.Idl.

const LOG_RM_COMMAND LOG_RM_ABORT_REQUEST = 20

Definition at line 41 of file SimpleLog.Idl.

const LOG_RM_COMMAND LOG_RM_CHECKPOINT = 7

Definition at line 40 of file SimpleLog.Idl.

const LOG_RM_COMMAND LOG_RM_COMMIT_REQUEST = 21

Definition at line 42 of file SimpleLog.Idl.

const LOG_RM_COMMAND LOG_RM_ENDOFLOG = 6

Definition at line 39 of file SimpleLog.Idl.

const LOG_RM_COMMAND LOG_RM_PRIVATE = 1

Definition at line 34 of file SimpleLog.Idl.

const LOG_RM_COMMAND LOG_RM_XACT_BEGIN = 4

Definition at line 37 of file SimpleLog.Idl.

const LOG_RM_COMMAND LOG_RM_XACT_COMMIT = 3

Definition at line 36 of file SimpleLog.Idl.

const LOG_RM_COMMAND LOG_RM_XACT_END = 5

Definition at line 38 of file SimpleLog.Idl.

const LOG_RM_COMMAND LOG_RM_XACT_PREPARE = 2

Definition at line 35 of file SimpleLog.Idl.

interface LOG_RM_COMMAND BYTE* pByte

Definition at line 56 of file SimpleLog.Idl.

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/DfV/about.Cxx File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • DfV

about.Cxx File Reference

#include <windows.h>
#include "about.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/DfV/about.h File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • DfV

about.h File Reference

#include <cdialog.h>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/DfV/bitmaps.Cxx File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • DfV
Functions

bitmaps.Cxx File Reference

#include <windows.h>
#include "bitmaps.h"

Go to the source code of this file.

Functions

BOOL | DDBChangeColor (HBITMAP hBitmap, COLORREF crFrom, COLORREF crTo)
BOOL | LoadAndStretch (HINSTANCE hinst, HBITMAP hbmpDest, LPTSTR lpszResource, UINT cxBitmap, UINT cyBitmap, COLORREF crHigh, COLORREF crNorm)

Function Documentation

BOOL DDBChangeColor | ( | HBITMAP | hBitmap,
 |  | COLORREF | crFrom,
 |  | COLORREF | crTo
 | ) |  |

Definition at line 144 of file bitmaps.Cxx.

{
    register int cx, cy;
    BITMAP       bm;
    HDC          hdcBmp, hdcMask;
    HBITMAP      hbmMask, hbmOld1, hbmOld2;
    HBRUSH       hBrush, hbrOld;

    if (!hBitmap)
          return FALSE;

    GetObject (hBitmap, sizeof (bm), &bm);
    cx = bm.bmWidth;
    cy = bm.bmHeight;

    hbmMask = CreateBitmap(cx, cy, 1, 1, NULL);
    hdcMask = CreateCompatibleDC(NULL);
    hdcBmp = CreateCompatibleDC(NULL);
    hBrush = CreateSolidBrush(crTo);

    if (!hdcMask || !hdcBmp || !hBrush || !hbmMask)
    {
        DeleteObject(hbmMask);
        DeleteObject(hBrush);
        DeleteDC(hdcMask);
        DeleteDC(hdcBmp);
        return FALSE;
    }

    hbmOld1 = (HBITMAP) SelectObject (hdcBmp,  hBitmap);
    hbmOld2 = (HBITMAP) SelectObject (hdcMask, hbmMask);
    hbrOld  = (HBRUSH) SelectObject (hdcBmp, hBrush);

    SetBkColor(hdcBmp, crFrom);
    BitBlt(hdcMask, 0, 0, cx, cy, hdcBmp,  0, 0, SRCCOPY);
    SetBkColor(hdcBmp, RGB(255,255,255));
    BitBlt(hdcBmp,  0, 0, cx, cy, hdcMask, 0, 0, DSPDxax);

    SelectObject(hdcBmp,  hbrOld);
    SelectObject(hdcBmp,  hbmOld1);
    SelectObject(hdcMask, hbmOld2);
    DeleteDC(hdcBmp);
    DeleteDC(hdcMask);
    DeleteObject(hBrush);
    DeleteObject(hbmMask);

    return TRUE;
}

BOOL LoadAndStretch | ( | HINSTANCE | hinst,
 |  | HBITMAP | hbmpDest,
 |  | LPTSTR | lpszResource,
 |  | UINT | cxBitmap,
 |  | UINT | cyBitmap,
 |  | COLORREF | crHigh,
 |  | COLORREF | crNorm
 | ) |  |

Definition at line 48 of file bitmaps.Cxx.

{
    HBITMAP hbmpOld1, hbmpOld2, hbmp;
    BITMAP bm;
    int i;
    HDC hdcDest = CreateCompatibleDC(NULL);
    HDC hdcSrc = CreateCompatibleDC(NULL);

    if (NULL == hdcDest || NULL == hdcSrc)
    {
        DeleteDC(hdcSrc);
        DeleteDC(hdcDest);
        return(FALSE);
    }
    for (i=0;  i < 2;  i++)
    {
        hbmp = LoadBitmap(hinst, lpszResource);
        if (NULL == hbmp)
        {
            DeleteDC(hdcSrc);
            DeleteDC(hdcDest);
            return FALSE;
        }

        DDBChangeColor(hbmp, RGB (255,0,0), ((i == 0) ? crHigh : crNorm));
        GetObject(hbmp, sizeof (bm), &bm);

        hbmpOld1 = (HBITMAP) SelectObject(hdcDest, hbmpDest);
        hbmpOld2 = (HBITMAP) SelectObject(hdcSrc, hbmp);

        SetStretchBltMode(hdcDest, COLORONCOLOR);
        StretchBlt(
            hdcDest,
            i * cxBitmap * 2,
            0,
            cxBitmap * 2,
            cyBitmap,
            hdcSrc,
            0,
            0,
            bm.bmWidth,
            bm.bmHeight,
            SRCCOPY);

        SelectObject(hdcDest, hbmpOld1);
        SelectObject(hdcSrc,  hbmpOld2);
        DeleteObject(hbmp);
    }

    DeleteDC(hdcSrc);
    DeleteDC(hdcDest);
    return TRUE;
}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/DfV/bitmaps.h File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • DfV
Defines | Functions

bitmaps.h File Reference

Go to the source code of this file.

Defines

#define | DSPDxax 0x00E20746L

Functions

BOOL | DDBChangeColor (HBITMAP hBitmap, COLORREF crFrom, COLORREF crTo)
BOOL | LoadAndStretch (HINSTANCE hinst, HBITMAP hbmpDest, LPTSTR lpszResource, UINT cxBitmap, UINT cyBitmap, COLORREF crHigh, COLORREF crNorm)

Define Documentation

#define DSPDxax 0x00E20746L

Definition at line 22 of file bitmaps.h.

Function Documentation

BOOL DDBChangeColor | ( | HBITMAP | hBitmap,
 |  | COLORREF | crFrom,
 |  | COLORREF | crTo
 | ) |  |

Definition at line 144 of file bitmaps.Cxx.

{
    register int cx, cy;
    BITMAP       bm;
    HDC          hdcBmp, hdcMask;
    HBITMAP      hbmMask, hbmOld1, hbmOld2;
    HBRUSH       hBrush, hbrOld;

    if (!hBitmap)
          return FALSE;

    GetObject (hBitmap, sizeof (bm), &bm);
    cx = bm.bmWidth;
    cy = bm.bmHeight;

    hbmMask = CreateBitmap(cx, cy, 1, 1, NULL);
    hdcMask = CreateCompatibleDC(NULL);
    hdcBmp = CreateCompatibleDC(NULL);
    hBrush = CreateSolidBrush(crTo);

    if (!hdcMask || !hdcBmp || !hBrush || !hbmMask)
    {
        DeleteObject(hbmMask);
        DeleteObject(hBrush);
        DeleteDC(hdcMask);
        DeleteDC(hdcBmp);
        return FALSE;
    }

    hbmOld1 = (HBITMAP) SelectObject (hdcBmp,  hBitmap);
    hbmOld2 = (HBITMAP) SelectObject (hdcMask, hbmMask);
    hbrOld  = (HBRUSH) SelectObject (hdcBmp, hBrush);

    SetBkColor(hdcBmp, crFrom);
    BitBlt(hdcMask, 0, 0, cx, cy, hdcBmp,  0, 0, SRCCOPY);
    SetBkColor(hdcBmp, RGB(255,255,255));
    BitBlt(hdcBmp,  0, 0, cx, cy, hdcMask, 0, 0, DSPDxax);

    SelectObject(hdcBmp,  hbrOld);
    SelectObject(hdcBmp,  hbmOld1);
    SelectObject(hdcMask, hbmOld2);
    DeleteDC(hdcBmp);
    DeleteDC(hdcMask);
    DeleteObject(hBrush);
    DeleteObject(hbmMask);

    return TRUE;
}

BOOL LoadAndStretch | ( | HINSTANCE | hinst,
 |  | HBITMAP | hbmpDest,
 |  | LPTSTR | lpszResource,
 |  | UINT | cxBitmap,
 |  | UINT | cyBitmap,
 |  | COLORREF | crHigh,
 |  | COLORREF | crNorm
 | ) |  |

Definition at line 48 of file bitmaps.Cxx.

{
    HBITMAP hbmpOld1, hbmpOld2, hbmp;
    BITMAP bm;
    int i;
    HDC hdcDest = CreateCompatibleDC(NULL);
    HDC hdcSrc = CreateCompatibleDC(NULL);

    if (NULL == hdcDest || NULL == hdcSrc)
    {
        DeleteDC(hdcSrc);
        DeleteDC(hdcDest);
        return(FALSE);
    }
    for (i=0;  i < 2;  i++)
    {
        hbmp = LoadBitmap(hinst, lpszResource);
        if (NULL == hbmp)
        {
            DeleteDC(hdcSrc);
            DeleteDC(hdcDest);
            return FALSE;
        }

        DDBChangeColor(hbmp, RGB (255,0,0), ((i == 0) ? crHigh : crNorm));
        GetObject(hbmp, sizeof (bm), &bm);

        hbmpOld1 = (HBITMAP) SelectObject(hdcDest, hbmpDest);
        hbmpOld2 = (HBITMAP) SelectObject(hdcSrc, hbmp);

        SetStretchBltMode(hdcDest, COLORONCOLOR);
        StretchBlt(
            hdcDest,
            i * cxBitmap * 2,
            0,
            cxBitmap * 2,
            cyBitmap,
            hdcSrc,
            0,
            0,
            bm.bmWidth,
            bm.bmHeight,
            SRCCOPY);

        SelectObject(hdcDest, hbmpOld1);
        SelectObject(hdcSrc,  hbmpOld2);
        DeleteObject(hbmp);
    }

    DeleteDC(hdcSrc);
    DeleteDC(hdcDest);
    return TRUE;
}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/DfV/DfV.h File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • DfV
Defines

DfV.h File Reference

#include <windows.h>
#include <ole2.h>
#include "message.h"

Go to the source code of this file.

Defines

#define | BMP_STORAGE 3001
#define | BMP_STREAM 3000
#define | HELPFILE_STR "OLETools.hlp"
#define | IDC_LISTBOX 4000
#define | IDC_STREAMVIEW 4001
#define | IDM_ABOUT 1201
#define | IDM_CLOSE 1002
#define | IDM_COLLAPSE 1103
#define | IDM_COLLAPSEALL 1104
#define | IDM_EXIT 1000
#define | IDM_EXPAND 1100
#define | IDM_EXPANDALL 1102
#define | IDM_EXPANDBRANCH 1101
#define | IDM_HELP 1200
#define | IDM_OPEN 1001
#define | IDM_TOGGLE 1105
#define | IDS_ENUMELEMENTSFAILED 2007
#define | IDS_ENUMSTATSTGFAILED 2004
#define | IDS_ERROR 2000
#define | IDS_INSERTSTRINGFAILED 2008
#define | IDS_LOADBITMAPSFAILED 2009
#define | IDS_NOHELPFILE 2001
#define | IDS_OLEINCOMPATIBLE 2002
#define | IDS_OLEINITFAILED 2003
#define | IDS_OPENSTORAGEFAILED 2005
#define | IDS_OPENSTREAMFAILED 2006
#define | IDS_OUTOFMEMORY 2015
#define | IDS_STGOPENSTORAGEFAILED 2010
#define | IDS_STMREADFAILED 2013
#define | IDS_STMSEEKFAILED 2012
#define | IDS_STMSTATFAILED 2011
#define | IDS_STMTITLETEXT 2014
#define | MAIN_WINDOW_CLASS_MENU MainDFVMenu
#define | MAIN_WINDOW_CLASS_MENU_STR "MainDFVMenu"
#define | MAIN_WINDOW_CLASS_NAME "MainDFVWindow"
#define | STREAM_VIEW_CLASS_NAME "Stream Viewer"
#define | VER_FILEDESCRIPTION_STR "Windows NT Docfile Viewer"
#define | VER_INTERNALNAME_STR "DocFile Viewer"
#define | VER_ORIGINALFILENAME_STR "DFVIEW.exe"

Define Documentation

#define BMP_STORAGE 3001

Definition at line 50 of file DfV.h.

#define BMP_STREAM 3000

Definition at line 49 of file DfV.h.

#define HELPFILE_STR "OLETools.hlp"

Definition at line 25 of file DfV.h.

#define IDC_LISTBOX 4000

Definition at line 45 of file DfV.h.

#define IDC_STREAMVIEW 4001

Definition at line 46 of file DfV.h.

#define IDM_ABOUT 1201

Definition at line 42 of file DfV.h.

#define IDM_CLOSE 1002

Definition at line 34 of file DfV.h.

#define IDM_COLLAPSE 1103

Definition at line 38 of file DfV.h.

#define IDM_COLLAPSEALL 1104

Definition at line 39 of file DfV.h.

#define IDM_EXIT 1000

Definition at line 32 of file DfV.h.

#define IDM_EXPAND 1100

Definition at line 35 of file DfV.h.

#define IDM_EXPANDALL 1102

Definition at line 37 of file DfV.h.

#define IDM_EXPANDBRANCH 1101

Definition at line 36 of file DfV.h.

#define IDM_HELP 1200

Definition at line 41 of file DfV.h.

#define IDM_OPEN 1001

Definition at line 33 of file DfV.h.

#define IDM_TOGGLE 1105

Definition at line 40 of file DfV.h.

#define IDS_ENUMELEMENTSFAILED 2007

Definition at line 59 of file DfV.h.

#define IDS_ENUMSTATSTGFAILED 2004

Definition at line 56 of file DfV.h.

#define IDS_ERROR 2000

Definition at line 52 of file DfV.h.

#define IDS_INSERTSTRINGFAILED 2008

Definition at line 60 of file DfV.h.

#define IDS_LOADBITMAPSFAILED 2009

Definition at line 61 of file DfV.h.

#define IDS_NOHELPFILE 2001

Definition at line 53 of file DfV.h.

#define IDS_OLEINCOMPATIBLE 2002

Definition at line 54 of file DfV.h.

#define IDS_OLEINITFAILED 2003

Definition at line 55 of file DfV.h.

#define IDS_OPENSTORAGEFAILED 2005

Definition at line 57 of file DfV.h.

#define IDS_OPENSTREAMFAILED 2006

Definition at line 58 of file DfV.h.

#define IDS_OUTOFMEMORY 2015

Definition at line 67 of file DfV.h.

#define IDS_STGOPENSTORAGEFAILED 2010

Definition at line 62 of file DfV.h.

#define IDS_STMREADFAILED 2013

Definition at line 65 of file DfV.h.

#define IDS_STMSEEKFAILED 2012

Definition at line 64 of file DfV.h.

#define IDS_STMSTATFAILED 2011

Definition at line 63 of file DfV.h.

#define IDS_STMTITLETEXT 2014

Definition at line 66 of file DfV.h.

#define MAIN_WINDOW_CLASS_MENU MainDFVMenu

Definition at line 27 of file DfV.h.

#define MAIN_WINDOW_CLASS_MENU_STR "MainDFVMenu"

Definition at line 28 of file DfV.h.

#define MAIN_WINDOW_CLASS_NAME "MainDFVWindow"

Definition at line 26 of file DfV.h.

#define STREAM_VIEW_CLASS_NAME "Stream Viewer"

Definition at line 29 of file DfV.h.

#define VER_FILEDESCRIPTION_STR "Windows NT Docfile Viewer"

Definition at line 22 of file DfV.h.

#define VER_INTERNALNAME_STR "DocFile Viewer"

Definition at line 23 of file DfV.h.

#define VER_ORIGINALFILENAME_STR "DFVIEW.exe"

Definition at line 24 of file DfV.h.

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/DfV/message.Cxx File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • DfV
Functions

message.Cxx File Reference

#include <windows.h>
#include "message.h"

Go to the source code of this file.

Functions

int | MessageBoxFromStringIds (const HWND hwndOwner, const HINSTANCE hinst, const UINT idText, const UINT idTitle, const UINT fuStyle)
int | MessageBoxFromStringIdsAndArgs (const HWND hwndOwner, const HINSTANCE hinst, const UINT idFormat, const UINT idTitle, const UINT fuStyle,...)

Function Documentation

int MessageBoxFromStringIds | ( | const HWND | hwndOwner,
 |  | const HINSTANCE | hinst,
 |  | const UINT | idText,
 |  | const UINT | idTitle,
 |  | const UINT | fuStyle
 | ) |  |

Definition at line 43 of file message.Cxx.

{
    int iReturn = 0;
    TCHAR szTitle[MAX_STRING_LENGTH];
    TCHAR szText[MAX_STRING_LENGTH];
    if (LoadString(hinst, idTitle, szTitle, MAX_STRING_LENGTH))
    {
        if (LoadString(hinst, idText, szText, MAX_STRING_LENGTH))
        {
            iReturn = MessageBox(
                hwndOwner,
                szText,
                szTitle,
                fuStyle);
        }
    }
    return(iReturn);
}

int MessageBoxFromStringIdsAndArgs | ( | const HWND | hwndOwner,
 |  | const HINSTANCE | hinst,
 |  | const UINT | idFormat,
 |  | const UINT | idTitle,
 |  | const UINT | fuStyle,
 |  |  | ...
 | ) |  |

Definition at line 94 of file message.Cxx.

{
    int iReturn = 0;
    va_list arglist;
    va_start(arglist, fuStyle);
    TCHAR szTitle[MAX_STRING_LENGTH];
    TCHAR szText[MAX_STRING_LENGTH];
    TCHAR szFormat[MAX_STRING_LENGTH];
    if (LoadString(hinst, idTitle, szTitle, MAX_STRING_LENGTH))
    {
        if (LoadString(hinst, idFormat, szFormat, MAX_STRING_LENGTH))
        {
            wvsprintf(szText, szFormat, arglist);
            iReturn = MessageBox(
                hwndOwner,
                szText,
                szTitle,
                fuStyle);
        }
    }
    return(iReturn);
}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/DfV/message.h File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • DfV
Defines | Functions

message.h File Reference

Go to the source code of this file.

Defines

#define | MAX_STRING_LENGTH 256

Functions

int | MessageBoxFromStringIds (const HWND hwndOwner, const HINSTANCE hinst, const UINT idText, const UINT idTitle, const UINT fuStyle)
int | MessageBoxFromStringIdsAndArgs (const HWND hwndOwner, const HINSTANCE hinst, const UINT idText, const UINT idTitle, const UINT fuStyle,...)

Define Documentation

#define MAX_STRING_LENGTH 256

Definition at line 21 of file message.h.

Function Documentation

int MessageBoxFromStringIds | ( | const HWND | hwndOwner,
 |  | const HINSTANCE | hinst,
 |  | const UINT | idText,
 |  | const UINT | idTitle,
 |  | const UINT | fuStyle
 | ) |  |

Definition at line 43 of file message.Cxx.

{
    int iReturn = 0;
    TCHAR szTitle[MAX_STRING_LENGTH];
    TCHAR szText[MAX_STRING_LENGTH];
    if (LoadString(hinst, idTitle, szTitle, MAX_STRING_LENGTH))
    {
        if (LoadString(hinst, idText, szText, MAX_STRING_LENGTH))
        {
            iReturn = MessageBox(
                hwndOwner,
                szText,
                szTitle,
                fuStyle);
        }
    }
    return(iReturn);
}

int MessageBoxFromStringIdsAndArgs | ( | const HWND | hwndOwner,
 |  | const HINSTANCE | hinst,
 |  | const UINT | idText,
 |  | const UINT | idTitle,
 |  | const UINT | fuStyle,
 |  |  | ...
 | ) |  |

Definition at line 94 of file message.Cxx.

{
    int iReturn = 0;
    va_list arglist;
    va_start(arglist, fuStyle);
    TCHAR szTitle[MAX_STRING_LENGTH];
    TCHAR szText[MAX_STRING_LENGTH];
    TCHAR szFormat[MAX_STRING_LENGTH];
    if (LoadString(hinst, idTitle, szTitle, MAX_STRING_LENGTH))
    {
        if (LoadString(hinst, idFormat, szFormat, MAX_STRING_LENGTH))
        {
            wvsprintf(szText, szFormat, arglist);
            iReturn = MessageBox(
                hwndOwner,
                szText,
                szTitle,
                fuStyle);
        }
    }
    return(iReturn);
}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/DfV/mwclass.Cxx File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • DfV
Defines | Functions

mwclass.Cxx File Reference

#include "dfv.h"
#include "mwclass.h"
#include "about.h"
#include "bitmaps.h"
#include "strmvwr.h"
#include <assert.h>

Go to the source code of this file.

Defines

#define | BITMAPHEIGHT 16
#define | BITMAPWIDTH 16
#define | INDENT BITMAPWIDTH
#define | ROOTSTGSTR OLESTR(" \\ - ")

Functions

int | Exists (TCHAR *sz)

Define Documentation

#define BITMAPHEIGHT 16

Definition at line 26 of file mwclass.Cxx.

#define BITMAPWIDTH 16

Definition at line 25 of file mwclass.Cxx.

#define INDENT BITMAPWIDTH

Definition at line 27 of file mwclass.Cxx.

#define ROOTSTGSTR OLESTR(" \\ - ")

Definition at line 28 of file mwclass.Cxx.

Function Documentation

int Exists ( TCHAR * sz )

Definition at line 1034 of file mwclass.Cxx.

{
    HANDLE h;
    h = CreateFile(sz,
        GENERIC_READ,
        FILE_SHARE_READ | FILE_SHARE_WRITE,
        NULL,
        OPEN_EXISTING,
        0,
        0);
    if (h != INVALID_HANDLE_VALUE)
    {
        CloseHandle(h);
        return(1);
    }
    return (0);
}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/DfV/mwclass.h File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • DfV

mwclass.h File Reference

#include <cwindow.h>
#include <commdlg.h>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/DfV/strmvwr.Cxx File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • DfV
Defines

strmvwr.Cxx File Reference

#include <windows.h>
#include <ole2.h>
#include "strmvwr.h"

Go to the source code of this file.

Defines

#define | BYTESPERLINE 16
#define | DIVISIONPOINTS 8

Define Documentation

#define BYTESPERLINE 16

Definition at line 22 of file strmvwr.Cxx.

#define DIVISIONPOINTS 8

Definition at line 23 of file strmvwr.Cxx.

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/DfV/strmvwr.h File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • DfV

strmvwr.h File Reference

#include <cwindow.h>
#include "dfv.h"
#include "mwclass.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/DfV/WinMain.Cxx File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • DfV
Functions

WinMain.Cxx File Reference

#include "dfv.h"
#include "mwclass.h"
#include <ole2ver.h>

Go to the source code of this file.

Functions

BOOL | InitApplication (HINSTANCE hInstance)
int PASCAL | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

Function Documentation

BOOL InitApplication ( HINSTANCE hInstance )

Definition at line 38 of file WinMain.Cxx.

{
    WNDCLASS wc;

    wc.style = 0;
    wc.lpfnWndProc = &WindowProc;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = 0;
    wc.hInstance = hInstance;
    wc.hIcon = LoadIcon(hInstance, TEXT("StreamIcon"));
    wc.hCursor = (HCURSOR) LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
    wc.lpszMenuName = NULL;
    wc.lpszClassName = TEXT(STREAM_VIEW_CLASS_NAME);
    ATOM aReturn = RegisterClass(&wc);
    if (!aReturn)
    {
        return(aReturn);
    }
    wc.style = CS_DBLCLKS;
    wc.hIcon = LoadIcon(hInstance, TEXT("AppIcon"));
    wc.lpszMenuName = TEXT(MAIN_WINDOW_CLASS_MENU_STR);
    wc.lpszClassName = TEXT(MAIN_WINDOW_CLASS_NAME);
    return(RegisterClass(&wc));
}

int PASCAL WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 82 of file WinMain.Cxx.

{
    DWORD dwBuildVersion = CoBuildVersion();
    if (HIWORD(dwBuildVersion) != rmm || LOWORD(dwBuildVersion) < rup)
    {
        // alert the caller that the OLE version is incompatible
        // with this build.
        MessageBoxFromStringIdsAndArgs(
            NULL,
            hInstance,
            IDS_OLEINCOMPATIBLE,
            IDS_ERROR,
            MB_OK | MB_ICONEXCLAMATION,
            rmm, rup);
        return(FALSE);
    }
    if (FAILED(CoInitialize(NULL)))
    {
        // alert the caller that OLE couldn't be initialized
        MessageBoxFromStringIds(
            NULL,
            hInstance,
            IDS_OLEINITFAILED,
            IDS_ERROR,
            MB_OK | MB_ICONEXCLAMATION);
        return(FALSE);
    }
    if (!hPrevInstance)
    {
        if (!InitApplication(hInstance))
        {
            CoUninitialize();
            return(FALSE);
        }
    }
    CMainWindow * pw = new CMainWindow;
    if (pw == NULL)
    {
        CoUninitialize();
        return(FALSE);
    }
    if (!pw->InitInstance(hInstance, nCmdShow))
    {
        // Note, if InitInstance has failed then it would have
        // already deleted pw for me so I don't delete it here.
        // This is because when WM_CREATE returns -1 (failure)
        // Windows sends the WM_DESTROY message to the window
        // and the the CHlprWindow class destroys itself whenever
        // it receives this message.
        CoUninitialize();
        return(FALSE);
    }

    // check command line and try and load as a file

    if (strlen(lpCmdLine) > 0)
    {
#ifdef UNICODE
        mbstowcs(pw->_szFileName, lpCmdLine, MAX_PATH - 1);
#else
        strncpy(pw->_szFileName, lpCmdLine, MAX_PATH - 1);
#endif
        pw->OpenFile();
    }

    MSG msg;
    HACCEL haccel = LoadAccelerators(hInstance, TEXT("AppAccel"));
    if (haccel == NULL)
    {
        CoUninitialize();
        return(FALSE);
    }

    while (GetMessage(&msg, NULL, 0, 0))
    {
        if (!TranslateAccelerator(
            pw->GetHwnd(),
            haccel,
            &msg))
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
    }
    CoUninitialize();
    return (int)(msg.wParam);
}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/DoServer/clsfact.Cpp File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • DoServer
Functions | Variables

clsfact.Cpp File Reference

#include "ClsFact.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (DWORD) CClassFactory

Variables

DWORD g_DllRefCount

Function Documentation

STDMETHODIMP_ ( DWORD )

Definition at line 111 of file clsfact.Cpp.

{
  TCHAR szText[MAX_PATH];
  wsprintf(szText, TEXT("CClassFactory::Release - ref count will be %d\n"), m_ObjRefCount - 1);
  OutputDebugString(szText);

  if(--m_ObjRefCount == 0)
    delete this;

  return m_ObjRefCount;
}

Variable Documentation

DWORD g_DllRefCount

Definition at line 63 of file DoServer.Cpp.

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/DoServer/clsfact.h File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • DoServer
Classes

clsfact.h File Reference

#include "DOServer.h"

Go to the source code of this file.

Classes

class CClassFactory
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/DoServer/DataObj.Cpp File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • DoServer
Functions

DataObj.Cpp File Reference

#include "DataObj.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CDataObject

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 398 of file DataObj.Cpp.

{
  TCHAR szText[MAX_PATH];
  wsprintf(szText, TEXT("CEnumFormatEtc::Release - ref count will be %d\n"), m_ObjRefCount - 1);
  OutputDebugString(szText);

  if(0 == --m_ObjRefCount)
  {
    delete this;
    return 0;
  }

  return m_ObjRefCount;
}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/DoServer/DataObj.h File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • DoServer
Classes | Defines

DataObj.h File Reference

#include "DOServer.h"

Go to the source code of this file.

Classes

class | CDataObject
class | CEnumFormatEtc

Defines

#define | CF_EMBEDSOURCE TEXT("Embed Source")

Define Documentation

#define CF_EMBEDSOURCE TEXT("Embed Source")

Definition at line 35 of file DataObj.h.

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/DoServer/DoServer.Cpp File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • DoServer
Functions | Variables

DoServer.Cpp File Reference

#include "DOServer.h"
#include "ClsFact.h"
#include <windowsx.h>
#include <CommDlg.h>
#include <initguid.h>

Go to the source code of this file.

Functions

void | CenterWindow (HWND)
BOOL CALLBACK | ColorHookProc (HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam)
DEFINE_GUID (CLSID_SimpleDocObject, 0xf0fd0c00, 0x65ba, 0x11d0, 0xb6, 0x6f, 0x0, 0xa0, 0xc9, 0x3, 0x48, 0xd6)
BOOL | InitApp (BOOL, int)
BOOL CALLBACK | MainDlgProc (HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam)
int PASCAL | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

Variables

DWORD g_DllRefCount
DWORD g_dwRegister
HINSTANCE | g_hInst

Function Documentation

void CenterWindow ( HWND hWnd )

Definition at line 298 of file DoServer.Cpp.

{
  RECT  rc;
  int   x,
    y;

  GetWindowRect(hWnd, &rc);

  x = GetSystemMetrics(SM_CXSCREEN)/2 - ((rc.right - rc.left)/2);
  y = GetSystemMetrics(SM_CYSCREEN)/2 - ((rc.bottom - rc.top)/2);

  //don't move the window if it's already in the right position
  if((x != rc.left) || (y != rc.top))
    MoveWindow(hWnd, x, y, rc.right - rc.left, rc.bottom - rc.top, TRUE);
}

BOOL CALLBACK ColorHookProc | ( | HWND | hWnd,
 |  | UINT | uMessage,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 228 of file DoServer.Cpp.

{
  UNREFERENCED_PARAMETER(lParam);
  UNREFERENCED_PARAMETER(wParam);
  static COleDocument  *pOleDoc;
  static UINT          uSaveOK;

  switch(uMessage)
  {
  case WM_INITDIALOG:
    {
      UINT  uSelect;

      pOleDoc = (COleDocument*)((LPOPENFILENAME)(lParam))->lCustData;

      uSaveOK = RegisterWindowMessage(FILEOKSTRING);

      switch(pOleDoc->m_Color)
      {
      default:
      case RED_COLOR:
        uSelect = IDC_RED;
        break;

      case GREEN_COLOR:
        uSelect = IDC_GREEN;
        break;

      case BLUE_COLOR:
        uSelect = IDC_BLUE;
        break;
      }

      CheckRadioButton(hWnd, IDC_RED, IDC_BLUE, uSelect);
    }
    break;

  case WM_DESTROY:
    break;

  default:
    if(uMessage == uSaveOK)
    {
      //Save button pressed
      if(IsDlgButtonChecked(hWnd, IDC_GREEN))
            {
        pOleDoc->m_Color = GREEN_COLOR;
            }
      else if(IsDlgButtonChecked(hWnd, IDC_BLUE))
            {
        pOleDoc->m_Color = BLUE_COLOR;
            }
      else
            {
        pOleDoc->m_Color = RED_COLOR;
            }
    }

    break;
  }

  return FALSE;
}

DEFINE_GUID | ( | CLSID_SimpleDocObject | ,
 |  | 0xf0fd0c00 | ,
 |  | 0x65ba | ,
 |  | 0x11d0 | ,
 |  | 0xb6 | ,
 |  | 0x6f | ,
 |  | 0x0 | ,
 |  | 0xa0 | ,
 |  | 0xc9 | ,
 |  | 0x3 | ,
 |  | 0x48 | ,
 |  | 0xd6 |
 | ) |  |
BOOL InitApp | ( | BOOL | fEmbedding,
 |  | int | nCmdShow
 | ) |  |

Definition at line 117 of file DoServer.Cpp.

{
  UNREFERENCED_PARAMETER(fEmbedding);
  UNREFERENCED_PARAMETER(nCmdShow);
  //initialize OLE
  if(FAILED(CoInitialize(NULL)))
    return FALSE;

  CClassFactory  *pClassFactory = new CClassFactory();

  if(NULL == pClassFactory)
  {
    CoUninitialize();
    return FALSE;
  }

  LPUNKNOWN   pUnknown;
  HRESULT     hr;

  hr = pClassFactory->QueryInterface(IID_IUnknown, (LPVOID*)&pUnknown);
  if(FAILED(hr))
  {
    pClassFactory->Release();
    return FALSE;
  }

  //register the class object
  hr = CoRegisterClassObject(   CLSID_SimpleDocObject,
    pUnknown,
    CLSCTX_LOCAL_SERVER,
    REGCLS_MULTIPLEUSE,
    &g_dwRegister);

  if(FAILED(hr))
  {
    pClassFactory->Release();
    return FALSE;
  }

  return TRUE;
}

BOOL CALLBACK MainDlgProc | ( | HWND | hWnd,
 |  | UINT | uMessage,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 165 of file DoServer.Cpp.

{
  UNREFERENCED_PARAMETER(lParam);
  static COleDocument  *pOleDoc;

  switch(uMessage)
  {
  case WM_INITDIALOG:
    CenterWindow(hWnd);

    pOleDoc = new COleDocument();

    if(pOleDoc)
    {
      EnableWindow(GetDlgItem(hWnd, IDC_REGISTER), TRUE);
      EnableWindow(GetDlgItem(hWnd, IDC_CREATE_FILE), TRUE);
    }

    break;

  case WM_DESTROY:
    if(pOleDoc)
    {
      delete pOleDoc;
    }

    break;

  case WM_COMMAND:
    switch(GET_WM_COMMAND_ID(wParam, lParam))
    {
    case IDOK:
    case IDCANCEL:
            EndDialog(hWnd, 0);
            break;

    case IDC_REGISTER:
            if(pOleDoc)
      {
        pOleDoc->RegisterServer();
      }
            break;

    case IDC_CREATE_FILE:
            if(pOleDoc)
      {
        pOleDoc->CreateFile(hWnd);
      }
            break;
    }
    return FALSE;
  }

  return FALSE;
}

int PASCAL WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 72 of file DoServer.Cpp.

{
  UNREFERENCED_PARAMETER(hPrevInstance);
  BOOL  fEmbedding;
  MSG   msg;

  g_hInst = hInstance;

  //check for the embedding switch
  ParseCommandLine(lpCmdLine, &fEmbedding, NULL);

  if(!fEmbedding)
  {
    DialogBox(g_hInst, MAKEINTRESOURCE(IDD_MAIN_DIALOG), NULL, (DLGPROC)MainDlgProc);
    return 0;
  }

  if(!InitApp(fEmbedding, nCmdShow))
    return 0;

  //DebugBreak();

  //The message loop will only exit when the main object gets destroyed.
  while(GetMessage(&msg, NULL, 0, 0))
  {
    TranslateMessage(&msg);
    DispatchMessage(&msg);
  }

  OutputDebugString(TEXT("Exiting WinMain\n"));

  if(g_dwRegister)
    CoRevokeClassObject(g_dwRegister);

  CoUninitialize();

  return (INT)msg.wParam;
}

Variable Documentation

DWORD g_DllRefCount

Definition at line 63 of file DoServer.Cpp.

DWORD g_dwRegister

Definition at line 64 of file DoServer.Cpp.

HINSTANCE g_hInst

Definition at line 62 of file DoServer.Cpp.

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/DoServer/DoServer.h File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • DoServer
Defines | Functions | Variables

DoServer.h File Reference

#include <windows.h>
#include <ole2.h>
#include <docobj.h>
#include "OleDoc.h"
#include "OleDocVw.h"
#include "OleObj.h"
#include "DataObj.h"
#include "OIPObj.h"
#include "OIPAObj.h"
#include "PerStor.h"
#include "PerFile.h"
#include "Utils.h"
#include "Resource.h"
#include "DataObj.h"
#include "Utils.h"
#include "Resource.h"

Go to the source code of this file.

Defines

#define | ARRAYSIZE(a) (sizeof(a)/sizeof(a[0]))
#define | BLUE_COLOR (RGB(0, 0, 128))
#define | DEFAULT_COLOR (RGB(128, 0, 0))
#define | DEFAULT_PROMPT (L"*.sdo")
#define | DEFAULT_X 100
#define | DEFAULT_Y 100
#define | DOC_NAME (TEXT("Simple Doc Object"))
#define | FILE_EXT (TEXT(".sdo"))
#define | GREEN_COLOR (RGB(0, 128, 0))
#define | lstrncat(strDest, strSource, count) strncat(strDest,strSource,count)
#define | PROG_ID (TEXT("Simple.DocObject"))
#define | RED_COLOR (RGB(128, 0, 0))

Functions

DEFINE_GUID (CLSID_SimpleDocObject, 0xf0fd0c00, 0x65ba, 0x11d0, 0xb6, 0x6f, 0x0, 0xa0, 0xc9, 0x3, 0x48, 0xd6)
BOOL CALLBACK | MainDlgProc (HWND, UINT, WPARAM, LPARAM)

Variables

HINSTANCE | g_hInst

Define Documentation

#define ARRAYSIZE ( a ) (sizeof(a)/sizeof(a[0]))

Definition at line 56 of file DoServer.h.

#define BLUE_COLOR (RGB(0, 0, 128))

Definition at line 69 of file DoServer.h.

#define DEFAULT_COLOR (RGB(128, 0, 0))

Definition at line 58 of file DoServer.h.

#define DEFAULT_PROMPT (L"*.sdo")

Definition at line 62 of file DoServer.h.

#define DEFAULT_X 100

Definition at line 59 of file DoServer.h.

#define DEFAULT_Y 100

Definition at line 60 of file DoServer.h.

#define DOC_NAME (TEXT("Simple Doc Object"))

Definition at line 65 of file DoServer.h.

#define FILE_EXT (TEXT(".sdo"))

Definition at line 63 of file DoServer.h.

#define GREEN_COLOR (RGB(0, 128, 0))

Definition at line 68 of file DoServer.h.

#define lstrncat | ( | strDest,
 |  | strSource,
 |  | count |
 | ) |  | strncat(strDest,strSource,count)

Definition at line 74 of file DoServer.h.

#define PROG_ID (TEXT("Simple.DocObject"))

Definition at line 64 of file DoServer.h.

#define RED_COLOR (RGB(128, 0, 0))

Definition at line 67 of file DoServer.h.

Function Documentation

DEFINE_GUID | ( | CLSID_SimpleDocObject | ,
 |  | 0xf0fd0c00 | ,
 |  | 0x65ba | ,
 |  | 0x11d0 | ,
 |  | 0xb6 | ,
 |  | 0x6f | ,
 |  | 0x0 | ,
 |  | 0xa0 | ,
 |  | 0xc9 | ,
 |  | 0x3 | ,
 |  | 0x48 | ,
 |  | 0xd6 |
 | ) |  |
BOOL CALLBACK MainDlgProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 165 of file DoServer.Cpp.

{
  UNREFERENCED_PARAMETER(lParam);
  static COleDocument  *pOleDoc;

  switch(uMessage)
  {
  case WM_INITDIALOG:
    CenterWindow(hWnd);

    pOleDoc = new COleDocument();

    if(pOleDoc)
    {
      EnableWindow(GetDlgItem(hWnd, IDC_REGISTER), TRUE);
      EnableWindow(GetDlgItem(hWnd, IDC_CREATE_FILE), TRUE);
    }

    break;

  case WM_DESTROY:
    if(pOleDoc)
    {
      delete pOleDoc;
    }

    break;

  case WM_COMMAND:
    switch(GET_WM_COMMAND_ID(wParam, lParam))
    {
    case IDOK:
    case IDCANCEL:
            EndDialog(hWnd, 0);
            break;

    case IDC_REGISTER:
            if(pOleDoc)
      {
        pOleDoc->RegisterServer();
      }
            break;

    case IDC_CREATE_FILE:
            if(pOleDoc)
      {
        pOleDoc->CreateFile(hWnd);
      }
            break;
    }
    return FALSE;
  }

  return FALSE;
}

Variable Documentation

HINSTANCE g_hInst

Definition at line 62 of file DoServer.Cpp.

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/DoServer/oipaObj.Cpp File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • DoServer
Functions

oipaObj.Cpp File Reference

#include "OIPAObj.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) COleInPlaceActiveObject

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 90 of file oipaObj.Cpp.

{
  OutputDebugString(TEXT("COleInPlaceActiveObject::Release\n"));

  return m_pOleDoc->Release();
}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/DoServer/oipaObj.h File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • DoServer
Classes

oipaObj.h File Reference

#include "DOServer.h"

Go to the source code of this file.

Classes

class COleInPlaceActiveObject
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/DoServer/oipObj.Cpp File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • DoServer
Functions

oipObj.Cpp File Reference

#include "OIPObj.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) COleInPlaceObject

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 92 of file oipObj.Cpp.

{
  OutputDebugString(TEXT("COleInPlaceObject::Release\n"));

  return m_pOleDoc->Release();
}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/DoServer/oipObj.h File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • DoServer
Classes

oipObj.h File Reference

#include "DOServer.h"

Go to the source code of this file.

Classes

class COleInPlaceObject
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/DoServer/OLEDoc.Cpp File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • DoServer
Classes | Typedefs | Functions | Variables

OLEDoc.Cpp File Reference

#include <aclapi.h>
#include "OleDoc.h"
#include "comcat.h"

Go to the source code of this file.

Classes

struct | DOREGSTRUCT

Typedefs

typedef struct DOREGSTRUCT * | LPDOREGSTRUCT

Functions

STDMETHODIMP_ (DWORD) COleDocument

Variables

DWORD g_DllRefCount

Typedef Documentation

typedef struct DOREGSTRUCT * LPDOREGSTRUCT

Function Documentation

STDMETHODIMP_ ( DWORD )

Definition at line 243 of file OLEDoc.Cpp.

{
  //OutputDebugString("COleDocument::Release\n");
  TCHAR szText[MAX_PATH];
  wsprintf(szText, TEXT("COleDocument::Release - ref count will be %d\n"), m_ObjRefCount - 1);
  OutputDebugString(szText);

  if(0 == --m_ObjRefCount)
  {
    delete this;
    return 0;
  }

  return m_ObjRefCount;
}

Variable Documentation

DWORD g_DllRefCount

Definition at line 63 of file DoServer.Cpp.

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/DoServer/OLEDoc.h File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • DoServer
Classes

OLEDoc.h File Reference

#include "DOServer.h"

Go to the source code of this file.

Classes

class COleDocument
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/DoServer/OLEDocVw.Cpp File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • DoServer
Functions

OLEDocVw.Cpp File Reference

#include "OleDocVw.h"
#include <windowsx.h>

Go to the source code of this file.

Functions

STDMETHODIMP_ (DWORD) COleDocumentView

Function Documentation

STDMETHODIMP_ ( DWORD )

Definition at line 116 of file OLEDocVw.Cpp.

{
  OutputDebugString(TEXT("COleDocumentView::Release\n"));

  return m_pOleDoc->Release();
}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/DoServer/OLEDocVw.h File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • DoServer
Classes | Defines

OLEDocVw.h File Reference

#include "DOServer.h"

Go to the source code of this file.

Classes

class | COleDocumentView

Defines

#define | VIEW_CLASS_NAME TEXT("DocObject_View_Class")

Define Documentation

#define VIEW_CLASS_NAME TEXT("DocObject_View_Class")

Definition at line 31 of file OLEDocVw.h.

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/DoServer/OLEObj.Cpp File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • DoServer
Functions

OLEObj.Cpp File Reference

#include "OleObj.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) COleObject

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 90 of file OLEObj.Cpp.

{
  OutputDebugString(TEXT("COleObject::Release\n"));

  return m_pOleDoc->Release();
}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/DoServer/OLEObj.h File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • DoServer
Classes

OLEObj.h File Reference

#include "DOServer.h"

Go to the source code of this file.

Classes

class COleObject
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/DoServer/perfile.Cpp File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • DoServer
Functions

perfile.Cpp File Reference

#include "PerFile.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CPersistFile

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 99 of file perfile.Cpp.

{
  OutputDebugString(TEXT("CPersistFile::Release\n"));

  return m_pOleDoc->Release();
}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/DoServer/perfile.h File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • DoServer
Classes

perfile.h File Reference

#include "DOServer.h"

Go to the source code of this file.

Classes

class CPersistFile
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/DoServer/perstor.Cpp File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • DoServer
Functions

perstor.Cpp File Reference

#include "PerStor.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CPersistStorage

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 92 of file perstor.Cpp.

{
  OutputDebugString(TEXT("CPersistStorage::Release\n"));

  return m_pOleDoc->Release();
}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/DoServer/perstor.h File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • DoServer
Classes

perstor.h File Reference

#include "DOServer.h"

Go to the source code of this file.

Classes

class CPersistStorage
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/DoServer/Resource.h File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • DoServer
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_BLUE 2003
#define | IDC_CREATE_FILE 2001
#define | IDC_GREEN 2002
#define | IDC_RED 2001
#define | IDC_REGISTER 2000
#define | IDD_COLOR_DIALOG 104
#define | IDD_MAIN_DIALOG 103
#define | IDI_MAINICON 101
#define | IDM_BLUE 1002
#define | IDM_GREEN 1001
#define | IDM_RED 1000
#define | IDR_COLOR_MENU 102

Define Documentation

#define IDC_BLUE 2003

Definition at line 33 of file Resource.h.

#define IDC_CREATE_FILE 2001

Definition at line 30 of file Resource.h.

#define IDC_GREEN 2002

Definition at line 32 of file Resource.h.

#define IDC_RED 2001

Definition at line 31 of file Resource.h.

#define IDC_REGISTER 2000

Definition at line 29 of file Resource.h.

#define IDD_COLOR_DIALOG 104

Definition at line 25 of file Resource.h.

#define IDD_MAIN_DIALOG 103

Definition at line 24 of file Resource.h.

#define IDI_MAINICON 101

Definition at line 22 of file Resource.h.

#define IDM_BLUE 1002

Definition at line 28 of file Resource.h.

#define IDM_GREEN 1001

Definition at line 27 of file Resource.h.

#define IDM_RED 1000

Definition at line 26 of file Resource.h.

#define IDR_COLOR_MENU 102

Definition at line 23 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/DoServer/Utils.Cpp File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • DoServer
Functions | Variables

Utils.Cpp File Reference

#include <windows.h>
#include "utils.h"

Go to the source code of this file.

Functions

for (i=0;*(pszCmdLine+i);i++)
STDAPI | GetOleObjectDataHere (LPPERSISTSTORAGE lpPStg, LPFORMATETC lpformatetc, LPSTGMEDIUM lpMedium)
if ((*pszCmdLine== '-')||(*pszCmdLine== '/'))
if (!*pszCmdLine) return
if (!pszCommandLine) return
lstrcpyn (pszCmdLine, pszCommandLine, sizeof(szCmdLine)/sizeof(TCHAR))
STDAPI_ (void) ParseCommandLine(LPSTR pszCommandLine
while (isspace(*pszCmdLine)) pszCmdLine++

Variables

LPBOOL LPTSTR pszFileName int | i = 0
LPBOOL | pfEmbedFlag = FALSE
LPTSTR pszCmdLine = szCmdLine
* pszFileName = 0
TCHAR | szBuf [MAX_PATH]
TCHAR | szCmdLine [MAX_PATH]

Function Documentation

for ( i = 0; *(pszCmdLine + i); i++ )

Definition at line 94 of file Utils.Cpp.

  {
    *(pszFileName + i) = *(pszCmdLine + i);
  }

STDAPI GetOleObjectDataHere | ( | LPPERSISTSTORAGE | lpPStg,
 |  | LPFORMATETC | lpformatetc,
 |  | LPSTGMEDIUM | lpMedium
 | ) |  |

Definition at line 144 of file Utils.Cpp.

{
  UNREFERENCED_PARAMETER(lpformatetc);
  HRESULT     hr = DATA_E_FORMATETC;

  lpMedium->pUnkForRelease = NULL;

  if(lpMedium->tymed != TYMED_ISTORAGE)
  {
    return hr;
  }

  //AddRef the IStorage pointer
  lpPStg->AddRef();

  // NOTE: even if OleSave returns an error you should still call
  // SaveCompleted.

  hr = OleSave(lpPStg, lpMedium->pstg, FALSE /* fSameAsLoad */);

  lpPStg->SaveCompleted(NULL);

  return hr;
}

if ( *== '-'pszCmdLine||*== '/' pszCmdLine )

Definition at line 77 of file Utils.Cpp.

  {
    pszCmdLine++;
    pszCmdLine = GetWord(pszCmdLine, szBuf);
    *pfEmbedFlag = !lstrcmp(szBuf, EMBEDDINGFLAG);
  }

if ( !* pszCmdLine )
if ( ! pszCommandLine )
lstrcpyn | ( | pszCmdLine | ,
 |  | pszCommandLine | ,
 |  | sizeof(szCmdLine)/sizeof(TCHAR) |
 | ) |  |
STDAPI_ ( void )

Definition at line 35 of file dbgUtil.c.

{
        int i;

        if (nIndent < 0)
                OleDbgIndent(nIndent);

        if (lpszPrefix && *lpszPrefix != '\0') {
                OutputDebugString("| ");
                for (i = 0; i < s_nDbgIndent; i++)
                        OutputDebugString("----");

                OutputDebugString(lpszPrefix);
                OutputDebugString(": ");
        }

        OutputDebugString(lpszMsg);
        if (nIndent > 0)
                OleDbgIndent(nIndent);
}

while ( isspace * pszCmdLine )

Variable Documentation

*pszFileName i = 0

Definition at line 42 of file Utils.Cpp.

* pfEmbedFlag = FALSE

Definition at line 42 of file Utils.Cpp.

LPTSTR pszCmdLine = szCmdLine

Definition at line 46 of file Utils.Cpp.

* pszFileName = 0

Definition at line 87 of file Utils.Cpp.

TCHAR szBuf[MAX_PATH]

Definition at line 47 of file Utils.Cpp.

TCHAR szCmdLine[MAX_PATH]

Definition at line 45 of file Utils.Cpp.

Generated on Wed Nov 13 2024 16:53:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/DoServer/Utils.h File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • DoServer
Defines | Functions | Variables

Utils.h File Reference

Go to the source code of this file.

Defines

#define | EMBEDDINGFLAG TEXT("Embedding")

Functions

STDAPI | GetOleObjectDataHere (LPPERSISTSTORAGE, LPFORMATETC, LPSTGMEDIUM)
STDAPI_ (void) ParseCommandLine(LPSTR

Variables

LPBOOL
LPTSTR

Define Documentation

#define EMBEDDINGFLAG TEXT("Embedding")

Definition at line 38 of file Utils.h.

Function Documentation

STDAPI GetOleObjectDataHere | ( | LPPERSISTSTORAGE | ,
 |  | LPFORMATETC | ,
 |  | LPSTGMEDIUM |
 | ) |  |

Definition at line 144 of file Utils.Cpp.

{
  UNREFERENCED_PARAMETER(lpformatetc);
  HRESULT     hr = DATA_E_FORMATETC;

  lpMedium->pUnkForRelease = NULL;

  if(lpMedium->tymed != TYMED_ISTORAGE)
  {
    return hr;
  }

  //AddRef the IStorage pointer
  lpPStg->AddRef();

  // NOTE: even if OleSave returns an error you should still call
  // SaveCompleted.

  hr = OleSave(lpPStg, lpMedium->pstg, FALSE /* fSameAsLoad */);

  lpPStg->SaveCompleted(NULL);

  return hr;
}

STDAPI_ ( void )

Variable Documentation

LPBOOL

Definition at line 30 of file Utils.h.

LPTSTR

Definition at line 30 of file Utils.h.

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/Framer/Framer.Cpp File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • Framer
Defines | Functions

Framer.Cpp File Reference

#include "framer.h"

Go to the source code of this file.

Defines

#define | INITGUID

Functions

BOOL APIENTRY | AboutProc (HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lParam)
LRESULT APIENTRY | ClientWndProc (HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
LRESULT APIENTRY | FrameWndProc (HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
STDMETHODIMP_ (ULONG) CFrame
int PASCAL | WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR pszCmdLine, int nCmdShow)

Define Documentation

#define INITGUID

Definition at line 28 of file Framer.Cpp.

Function Documentation

BOOL CALLBACK AboutProc | ( | HWND | hDlg,
 |  | UINT | iMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 812 of file Framer.Cpp.

    {
  UNREFERENCED_PARAMETER(lParam);
    switch (iMsg)
        {
        case WM_INITDIALOG:
            return TRUE;

        case WM_COMMAND:
            switch (LOWORD(wParam))
                {
                case IDOK:
                    EndDialog(hDlg, TRUE);
                }
            break;
        }
    return FALSE;
    }

LRESULT APIENTRY ClientWndProc | ( | HWND | hWnd,
 |  | UINT | iMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 756 of file Framer.Cpp.

    {
    PCFrame         pFR;
  PAINTSTRUCT   ps;

    pFR=(PCFrame)GetWindowLongPtr(hWnd, CLIENTWL_STRUCTURE);

    switch (iMsg)
        {
        case WM_NCCREATE:
            pFR=(PCFrame)((LPCREATESTRUCT)lParam)->lpCreateParams;

            SetWindowLongPtr(hWnd, CLIENTWL_STRUCTURE, (LONG_PTR)pFR);
            return DefWindowProc(hWnd, iMsg, wParam, lParam);

        case WM_PAINT:
      BeginPaint(hWnd, &ps);

      if (pFR->m_fHaveObject)
        {
        static TCHAR szMsg[]={TEXT("A non-DocObject is open or loaded. Use File/Close to destroy it.")};

        SetBkColor(ps.hdc, GetSysColor(COLOR_WINDOW));
        TextOut(ps.hdc, 0, 0, szMsg, lstrlen(szMsg));
        }

      EndPaint(hWnd, &ps);
            break;

        default:
            return DefWindowProc(hWnd, iMsg, wParam, lParam);
        }

    return 0L;
    }

LRESULT APIENTRY FrameWndProc | ( | HWND | hWnd,
 |  | UINT | iMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

CFrame encapsulates a main application window.

Definition at line 582 of file Framer.Cpp.

    {
    PCFrame         pFR;
    RECT            rc;
    HMENU           hMenu;

    pFR=(PCFrame)GetWindowLongPtr(hWnd, FRAMEWL_STRUCTURE);

    switch (iMsg)
        {
        case WM_NCCREATE:
            pFR=(PCFrame)((LPCREATESTRUCT)lParam)->lpCreateParams;

            SetWindowLongPtr(hWnd, FRAMEWL_STRUCTURE, (LONG_PTR)pFR);
            return DefWindowProc(hWnd, iMsg, wParam, lParam);

        case WM_DESTROY:
            PostQuitMessage(0);
            break;

        case WM_CLOSE:
            pFR->Close();
            DestroyWindow(hWnd);
            break;

        case WM_ERASEBKGND:
            //Client area window always manages painting
            return FALSE;

        case WM_SIZE:
            //Tell the in-place object about the new frame size
            GetClientRect(hWnd, &rc);

            if (NULL!=pFR->m_pIOleIPActiveObject)
                pFR->m_pIOleIPActiveObject->ResizeBorder(&rc, pFR, TRUE);

            /*
             * Resize the client, which is done in all cases since this window
       * is the parent of the DocObject, plus we need to tell the
       * DocObject of the new size through IOleDocumentView::SetRect.
       */
            rc.left  +=pFR->m_bwIP.left;
            rc.right -=pFR->m_bwIP.right;
            rc.top   +=pFR->m_bwIP.top;
            rc.bottom-=pFR->m_bwIP.bottom;

      pFR->ResizeClientWindow(rc.left, rc.top, rc.right-rc.left
        , rc.bottom-rc.top);

            break;

        case WM_SETFOCUS:
            if (NULL!=pFR->m_pIOleIPActiveObject)
                {
                HWND    hWndObj;

                pFR->m_pIOleIPActiveObject->GetWindow(&hWndObj);
                SetFocus(hWndObj);
                }

            return TRUE;

    case WM_INITMENU:
      pFR->m_fInObjectHelp=FALSE;
      break;

    case WM_MENUSELECT:
        {
        UINT fuFlags=(UINT)HIWORD(wParam);
        UINT uItem=(UINT)LOWORD(wParam);

        if (MF_POPUP & fuFlags)
          {
          /*
           * If we're inside our m_hMenuHelp, and uItem is
           * not zero (first item on the menu, which is ours),
           * then we must be in an object-supplied menu.
           *
           * Therefore we set our flag and forward the message
           * as well as others that occur later.  Otherwise we
           * clear the flag so we get messages again.
           */
          if (NULL!=pFR->m_hMenuHelp
            && (HMENU)lParam==pFR->m_hMenuHelp)
            {
            pFR->m_fInObjectHelp=(0!=uItem);

            if (pFR->m_fInObjectHelp)
              SendMessage(pFR->m_hWndObj, iMsg, wParam, lParam);
            }
          }
        else
          {
          //Forward the message on
          if (pFR->m_fInObjectHelp)
            {
            SendMessage(pFR->m_hWndObj, iMsg, wParam, lParam);
            break;
            }
          }
        }
      break;

    case WM_INITMENUPOPUP:
      /*
       * If we're in the object's Help menu, forward to
       * the object received in IOleInPlaceFrame::SetActiveObject
       */
      if (pFR->m_fInObjectHelp && NULL!=pFR->m_hWndObj)
        SendMessage(pFR->m_hWndObj, iMsg, wParam, lParam);

      //Skip the system menu
            if (TRUE==(BOOL)HIWORD(lParam))
                break;

        /*
             * If we have an object, enable Close, otherwise
             * enable Open.
             */
            hMenu=(HMENU)wParam;

            if (hMenu==pFR->m_phMenu[0])
                {
                UINT uTempE=MF_BYCOMMAND | MF_ENABLED;
                UINT uTempD=MF_BYCOMMAND | MF_DISABLED | MF_GRAYED;

                EnableMenuItem(hMenu, IDM_FILEOPEN
                    , pFR->m_fHaveObject ? uTempD : uTempE);
                EnableMenuItem(hMenu, IDM_FILECLOSE
                    , pFR->m_fHaveObject ? uTempE : uTempD);
                }

            break;

        case WM_COMMAND:
      if (pFR->m_fInObjectHelp)
        {
        SendMessage(pFR->m_hWndObj, iMsg, wParam, lParam);
        break;
        }
      else
              return pFR->OnCommand(hWnd, wParam, lParam);

    case WM_ACTIVATEAPP:
      if (NULL!=pFR->m_pIOleIPActiveObject)
        {
        HRESULT hr;
        hr=pFR->m_pIOleIPActiveObject->OnFrameWindowActivate((BOOL)wParam);
        }
      break;

        default:
            return DefWindowProc(hWnd, iMsg, wParam, lParam);
        }

    return 0L;
    }

STDMETHODIMP_ ( ULONG )

Definition at line 881 of file Framer.Cpp.

    {
    //Nothing special happening here--frame's life if user-controlled.
    return --m_cRef;
    }

int PASCAL WinMain | ( | HINSTANCE | hInst,
 |  | HINSTANCE | hPrev,
 |  | LPSTR | pszCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 41 of file Framer.Cpp.

    {
    PCFrame         pFR;
    WPARAM          wRet = 0;

    //Attempt to allocate and initialize the application
    pFR=new CFrame(hInst, hPrev, pszCmdLine, nCmdShow);

    if (NULL==pFR)
        return 0;

    //If we can initialize pFR, start chugging messages
    if (pFR->Init(CMENUS, CW_USEDEFAULT, CW_USEDEFAULT
        , CW_USEDEFAULT, CW_USEDEFAULT))
        wRet=pFR->MessageLoop();

    delete pFR;
    return (int)wRet;
    }

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/Framer/Framer.h File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • Framer
Classes | Defines | Typedefs | Functions

Framer.h File Reference

#include <docobj.h>
#include <tchar.h>
#include <commdlg.h>
#include "resource.h"
#include "site.h"
#include "resource.h"
#include "site.h"

Go to the source code of this file.

Classes

class | CFrame
class | CHourglass
CHourglass: Manages the hourglass and mouse capture. More...

Defines

#define | CBCLIENTWNDEXTRA sizeof(LONG)
#define | CBFRAMEWNDEXTRA sizeof(LONG)
#define | CLIENTWL_STRUCTURE 0
#define | DeleteInterfaceImp(p)
#define | FRAMEWL_STRUCTURE 0
#define | INC_OLE2
#define | ReleaseInterface(p)
#define | SZCLASSCLIENT TEXT("Client")
#define | SZCLASSFRAME TEXT("Frame")

Typedefs

typedef CFrame * | PCFrame
typedef CHourglass * | PCHourglass

Functions

BOOL APIENTRY | AboutProc (HWND, UINT, WPARAM, LPARAM)
LRESULT APIENTRY | ClientWndProc (HWND, UINT, WPARAM, LPARAM)
LRESULT APIENTRY | FrameWndProc (HWND, UINT, WPARAM, LPARAM)

Define Documentation

#define CBCLIENTWNDEXTRA sizeof(LONG)

Definition at line 87 of file Framer.h.

#define CBFRAMEWNDEXTRA sizeof(LONG)

Definition at line 84 of file Framer.h.

#define CLIENTWL_STRUCTURE 0

Definition at line 88 of file Framer.h.

#define DeleteInterfaceImp ( p )
Value:
{\
            if (NULL!=p)\
                {\
                delete p;\
                p=NULL;\
                }\
            }

Definition at line 49 of file Framer.h.

#define FRAMEWL_STRUCTURE 0

Definition at line 85 of file Framer.h.

#define INC_OLE2

Definition at line 30 of file Framer.h.

#define ReleaseInterface ( p )
Value:
{\
            IUnknown *pt=(IUnknown *)p;\
            p=NULL;\
            if (NULL!=pt)\
                pt->Release();\
            }

Definition at line 60 of file Framer.h.

#define SZCLASSCLIENT TEXT("Client")

Definition at line 91 of file Framer.h.

#define SZCLASSFRAME TEXT("Frame")

Definition at line 90 of file Framer.h.

Typedef Documentation

typedef CFrame* PCFrame

Definition at line 190 of file Framer.h.

typedef CHourglass* PCHourglass

Definition at line 235 of file Framer.h.

Function Documentation

BOOL APIENTRY AboutProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 812 of file Framer.Cpp.

    {
  UNREFERENCED_PARAMETER(lParam);
    switch (iMsg)
        {
        case WM_INITDIALOG:
            return TRUE;

        case WM_COMMAND:
            switch (LOWORD(wParam))
                {
                case IDOK:
                    EndDialog(hDlg, TRUE);
                }
            break;
        }
    return FALSE;
    }

LRESULT APIENTRY ClientWndProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 756 of file Framer.Cpp.

    {
    PCFrame         pFR;
  PAINTSTRUCT   ps;

    pFR=(PCFrame)GetWindowLongPtr(hWnd, CLIENTWL_STRUCTURE);

    switch (iMsg)
        {
        case WM_NCCREATE:
            pFR=(PCFrame)((LPCREATESTRUCT)lParam)->lpCreateParams;

            SetWindowLongPtr(hWnd, CLIENTWL_STRUCTURE, (LONG_PTR)pFR);
            return DefWindowProc(hWnd, iMsg, wParam, lParam);

        case WM_PAINT:
      BeginPaint(hWnd, &ps);

      if (pFR->m_fHaveObject)
        {
        static TCHAR szMsg[]={TEXT("A non-DocObject is open or loaded. Use File/Close to destroy it.")};

        SetBkColor(ps.hdc, GetSysColor(COLOR_WINDOW));
        TextOut(ps.hdc, 0, 0, szMsg, lstrlen(szMsg));
        }

      EndPaint(hWnd, &ps);
            break;

        default:
            return DefWindowProc(hWnd, iMsg, wParam, lParam);
        }

    return 0L;
    }

LRESULT APIENTRY FrameWndProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

CFrame encapsulates a main application window.

Definition at line 582 of file Framer.Cpp.

    {
    PCFrame         pFR;
    RECT            rc;
    HMENU           hMenu;

    pFR=(PCFrame)GetWindowLongPtr(hWnd, FRAMEWL_STRUCTURE);

    switch (iMsg)
        {
        case WM_NCCREATE:
            pFR=(PCFrame)((LPCREATESTRUCT)lParam)->lpCreateParams;

            SetWindowLongPtr(hWnd, FRAMEWL_STRUCTURE, (LONG_PTR)pFR);
            return DefWindowProc(hWnd, iMsg, wParam, lParam);

        case WM_DESTROY:
            PostQuitMessage(0);
            break;

        case WM_CLOSE:
            pFR->Close();
            DestroyWindow(hWnd);
            break;

        case WM_ERASEBKGND:
            //Client area window always manages painting
            return FALSE;

        case WM_SIZE:
            //Tell the in-place object about the new frame size
            GetClientRect(hWnd, &rc);

            if (NULL!=pFR->m_pIOleIPActiveObject)
                pFR->m_pIOleIPActiveObject->ResizeBorder(&rc, pFR, TRUE);

            /*
             * Resize the client, which is done in all cases since this window
       * is the parent of the DocObject, plus we need to tell the
       * DocObject of the new size through IOleDocumentView::SetRect.
       */
            rc.left  +=pFR->m_bwIP.left;
            rc.right -=pFR->m_bwIP.right;
            rc.top   +=pFR->m_bwIP.top;
            rc.bottom-=pFR->m_bwIP.bottom;

      pFR->ResizeClientWindow(rc.left, rc.top, rc.right-rc.left
        , rc.bottom-rc.top);

            break;

        case WM_SETFOCUS:
            if (NULL!=pFR->m_pIOleIPActiveObject)
                {
                HWND    hWndObj;

                pFR->m_pIOleIPActiveObject->GetWindow(&hWndObj);
                SetFocus(hWndObj);
                }

            return TRUE;

    case WM_INITMENU:
      pFR->m_fInObjectHelp=FALSE;
      break;

    case WM_MENUSELECT:
        {
        UINT fuFlags=(UINT)HIWORD(wParam);
        UINT uItem=(UINT)LOWORD(wParam);

        if (MF_POPUP & fuFlags)
          {
          /*
           * If we're inside our m_hMenuHelp, and uItem is
           * not zero (first item on the menu, which is ours),
           * then we must be in an object-supplied menu.
           *
           * Therefore we set our flag and forward the message
           * as well as others that occur later.  Otherwise we
           * clear the flag so we get messages again.
           */
          if (NULL!=pFR->m_hMenuHelp
            && (HMENU)lParam==pFR->m_hMenuHelp)
            {
            pFR->m_fInObjectHelp=(0!=uItem);

            if (pFR->m_fInObjectHelp)
              SendMessage(pFR->m_hWndObj, iMsg, wParam, lParam);
            }
          }
        else
          {
          //Forward the message on
          if (pFR->m_fInObjectHelp)
            {
            SendMessage(pFR->m_hWndObj, iMsg, wParam, lParam);
            break;
            }
          }
        }
      break;

    case WM_INITMENUPOPUP:
      /*
       * If we're in the object's Help menu, forward to
       * the object received in IOleInPlaceFrame::SetActiveObject
       */
      if (pFR->m_fInObjectHelp && NULL!=pFR->m_hWndObj)
        SendMessage(pFR->m_hWndObj, iMsg, wParam, lParam);

      //Skip the system menu
            if (TRUE==(BOOL)HIWORD(lParam))
                break;

        /*
             * If we have an object, enable Close, otherwise
             * enable Open.
             */
            hMenu=(HMENU)wParam;

            if (hMenu==pFR->m_phMenu[0])
                {
                UINT uTempE=MF_BYCOMMAND | MF_ENABLED;
                UINT uTempD=MF_BYCOMMAND | MF_DISABLED | MF_GRAYED;

                EnableMenuItem(hMenu, IDM_FILEOPEN
                    , pFR->m_fHaveObject ? uTempD : uTempE);
                EnableMenuItem(hMenu, IDM_FILECLOSE
                    , pFR->m_fHaveObject ? uTempE : uTempD);
                }

            break;

        case WM_COMMAND:
      if (pFR->m_fInObjectHelp)
        {
        SendMessage(pFR->m_hWndObj, iMsg, wParam, lParam);
        break;
        }
      else
              return pFR->OnCommand(hWnd, wParam, lParam);

    case WM_ACTIVATEAPP:
      if (NULL!=pFR->m_pIOleIPActiveObject)
        {
        HRESULT hr;
        hr=pFR->m_pIOleIPActiveObject->OnFrameWindowActivate((BOOL)wParam);
        }
      break;

        default:
            return DefWindowProc(hWnd, iMsg, wParam, lParam);
        }

    return 0L;
    }

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/Framer/IAdvSink.Cpp File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • Framer
Functions

IAdvSink.Cpp File Reference

#include "framer.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CImpIAdviseSink
STDMETHODIMP_ (void) CImpIAdviseSink

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 75 of file IAdvSink.Cpp.

    {
    --m_cRef;
    return m_pUnkOuter->Release();
    }

STDMETHODIMP_ ( void )

Definition at line 131 of file IAdvSink.Cpp.

    {
  //This does the same as File/Close
  //Not quite because CFrame::Close requires some synchronous
  //calls that will fail if done here, so just post a message to
  //do this
    //m_pSite->m_pFR->Close();

  HWND    hwnd;
  m_pSite->m_pFR->GetWindow(&hwnd);
  PostMessage(
    hwnd,
    WM_COMMAND,
    MAKELONG(IDM_FILECLOSE, 0),
    0);
    return;
    }

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/Framer/ICliSite.Cpp File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • Framer
Functions

ICliSite.Cpp File Reference

#include "framer.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CImpIOleClientSite

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 76 of file ICliSite.Cpp.

    {
    --m_cRef;
    return m_pUnkOuter->Release();
    }

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/Framer/IDocSite.Cpp File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • Framer
Functions

IDocSite.Cpp File Reference

#include "framer.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CImpIOleDocumentSite

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 75 of file IDocSite.Cpp.

    {
    --m_cRef;
    return m_pUnkOuter->Release();
    }

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/Framer/IIpSite.Cpp File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • Framer
Functions

IIpSite.Cpp File Reference

#include "framer.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CImpIOleInPlaceSite

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 75 of file IIpSite.Cpp.

    {
    --m_cRef;
    return m_pUnkOuter->Release();
    }

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/Framer/Resource.h File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • Framer
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | CACCELERATORS 2
#define | CHELPITEMS 1
#define | CMENUS 2
#define | IDD_ABOUT 1
#define | IDM_CUSTOMHELPMIN 201
#define | IDM_ENTERCONTEXTHELP 300
#define | IDM_ESCAPECONTEXTHELP 301
#define | IDM_FILECLOSE 102
#define | IDM_FILEEXIT 105
#define | IDM_FILEOPEN 101
#define | IDM_HELPABOUT 200
#define | IDR_ACCELERATORS 1
#define | IDR_MENU 1
#define | IDR_MENUHELP 2

Define Documentation

#define CACCELERATORS 2

Definition at line 55 of file Resource.h.

#define CHELPITEMS 1

Definition at line 40 of file Resource.h.

#define CMENUS 2

Definition at line 31 of file Resource.h.

#define IDD_ABOUT 1

Definition at line 37 of file Resource.h.

#define IDM_CUSTOMHELPMIN 201

Definition at line 48 of file Resource.h.

#define IDM_ENTERCONTEXTHELP 300

Definition at line 52 of file Resource.h.

#define IDM_ESCAPECONTEXTHELP 301

Definition at line 53 of file Resource.h.

#define IDM_FILECLOSE 102

Definition at line 44 of file Resource.h.

#define IDM_FILEEXIT 105

Definition at line 45 of file Resource.h.

#define IDM_FILEOPEN 101

Definition at line 43 of file Resource.h.

#define IDM_HELPABOUT 200

Definition at line 47 of file Resource.h.

#define IDR_ACCELERATORS 1

Definition at line 36 of file Resource.h.

#define IDR_MENU 1

Definition at line 34 of file Resource.h.

#define IDR_MENUHELP 2

Definition at line 35 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/Framer/Site.Cpp File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • Framer
Functions

Site.Cpp File Reference

#include "framer.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CSite

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 121 of file Site.Cpp.

    {
    if (0!=--m_cRef)
        return m_cRef;

    delete this;
    return 0;
    }

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/Framer/Site.h File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • Framer
Classes | Typedefs

Site.h File Reference

Go to the source code of this file.

Classes

class | CImpIAdviseSink
class | CImpIOleClientSite
class | CImpIOleDocumentSite
class | CImpIOleInPlaceSite
class | CSite

Typedefs

typedef CImpIAdviseSink * | PCImpIAdviseSink
typedef CImpIOleClientSite * | PCImpIOleClientSite
typedef CImpIOleDocumentSite * | PCImpIOleDocumentSite
typedef CImpIOleInPlaceSite * | PCImpIOleInPlaceSite
typedef CSite * | PCSite

Typedef Documentation

typedef CImpIAdviseSink* PCImpIAdviseSink

Definition at line 79 of file Site.h.

typedef CImpIOleClientSite* PCImpIOleClientSite

Definition at line 52 of file Site.h.

typedef CImpIOleDocumentSite* PCImpIOleDocumentSite

Definition at line 134 of file Site.h.

typedef CImpIOleInPlaceSite* PCImpIOleInPlaceSite

Definition at line 113 of file Site.h.

typedef CSite* PCSite

Definition at line 199 of file Site.h.

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/Range/cache.Cpp File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • Range
Functions

cache.Cpp File Reference

#include <windows.h>
#include <wininet.h>
#include "range.h"

Go to the source code of this file.

Functions

BOOL | HttpReadFromCache (PHTTP_REQUEST_PARAM pParam)
BOOL | HttpReadRequest (PHTTP_REQUEST_PARAM pParam)
BOOL | QueryHeaders (HANDLE hRequest, PHTTP_REQUESTCB_PARAM pCBParam, SYSTEMTIME *pstLastModified)

Function Documentation

BOOL HttpReadFromCache ( PHTTP_REQUEST_PARAM pParam )

Definition at line 77 of file cache.Cpp.

{
    // Locals that must be initialized before goto done.
    BOOL fSuccess = FALSE;
    HANDLE hInternet = NULL;
    HANDLE hConnect  = NULL;
    HANDLE hRequest  = NULL;
    PVOID pRead = NULL;
    HRESULT hrRequest = S_OK;

    // Initialize wininet
    hInternet = InternetOpen
        ("RR", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, INTERNET_FLAG_OFFLINE);
    if (!hInternet)
        goto done;
    hRequest = InternetOpenUrl
        (hInternet, pParam->pszUrl, NULL, 0, INTERNET_FLAG_OFFLINE, 0);
    if (!hRequest)
        goto done;

    // Initialize callback parameters.
    HTTP_REQUESTCB_PARAM CBParam;
    CBParam.cbStruct         = sizeof(CBParam);
    CBParam.dwRequestCtx     = pParam->dwRequestCtx;

    // Allocate read buffer
    DWORD cbRead;
    cbRead = 4096;
    pRead  = LocalAlloc (LMEM_FIXED, cbRead);
    if (!pRead)
    {
        SetLastError (ERROR_NOT_ENOUGH_MEMORY);
        goto done;
    }

    SYSTEMTIME st;
    if (!QueryHeaders (hRequest, &CBParam, &st))
        goto done;

    fSuccess = TRUE;

    // Notify the client that request is started.
    if (!(*pParam->pfnRequestCB) (&CBParam))
        goto notify;

    // Set up ranges to read.
    HTTP_REQUEST_RANGE EntireRange;
    PHTTP_REQUEST_RANGE pRanges;
    DWORD cRanges;

    if (pParam->cRanges)
    {
        pRanges = pParam->pRanges;
        cRanges = pParam->cRanges;
    }
    else
    {
        EntireRange.dwOffset = 0;
        EntireRange.dwSize = CBParam.dwContentLength;
        pRanges = &EntireRange;
        cRanges = 1;
    }

    // Loop over the ranges, reading into the buffer.
    CBParam.CallbackType = REQUESTCB_DATA;
    CBParam.lpDataBuffer = pRead;

    while (cRanges--)
    {
        CBParam.dwDataOffset = pRanges->dwOffset;
        DWORD cbRange        = pRanges->dwSize;
        if (!cbRange)
            cbRange = InternetSetFilePointer (hRequest, 0, NULL, FILE_END, 0)
              - pRanges->dwOffset;

        while (cbRange) // Loop until we have all the data for the range.
        {
            InternetSetFilePointer
                (hRequest, CBParam.dwDataOffset, NULL, FILE_BEGIN, 0);

            if (!InternetReadFile
                (hRequest, pRead, min(cbRead, cbRange), &CBParam.cbDataLength))
            {
                hrRequest = E_FAIL;
                goto notify;
            }

            // Check for EOF
            if (!CBParam.cbDataLength)
                break;

            // Call the client with data.
            if (!(*pParam->pfnRequestCB) (&CBParam))
                goto notify;

            CBParam.dwDataOffset += CBParam.cbDataLength;
            cbRange              -= CBParam.cbDataLength;
        }

        // Advance to next range.
        pRanges++;

    } // end while (cRanges--)

notify:

    // Notify the client we are done.
    CBParam.CallbackType = REQUESTCB_DONE;
    CBParam.hrRequest = hrRequest;
    (*pParam->pfnRequestCB) (&CBParam);

done:
    if (pRead)
        LocalFree ((HLOCAL) pRead);
    if (hRequest)
        InternetCloseHandle (hRequest);
    if (hConnect)
        InternetCloseHandle (hConnect);
    if (hInternet)
        InternetCloseHandle (hInternet);
    return fSuccess;
}

BOOL HttpReadRequest ( PHTTP_REQUEST_PARAM pParam )

Definition at line 201 of file cache.Cpp.

{
    if (pParam->cbStruct != sizeof(HTTP_REQUEST_PARAM))
    {
        SetLastError (ERROR_INVALID_PARAMETER);
        return FALSE;
    }

    if (HttpReadFromCache (pParam))
        return TRUE;
    return HttpReadFromServer (pParam);
}

BOOL QueryHeaders | ( | HANDLE | hRequest,
 |  | PHTTP_REQUESTCB_PARAM | pCBParam,
 |  | SYSTEMTIME * | pstLastModified
 | ) |  |

Definition at line 23 of file cache.Cpp.

{
    DWORD cbBuf;
    BOOL fRet;

    pCBParam->CallbackType     = REQUESTCB_STARTED;
    pCBParam->fdwRequestFlags  = HTTP_REQUEST_FROM_CACHE;

    // Get if the server supports ranges from the response headers.
    static char szBytes[] ="bytes";
    char szBuf[sizeof(szBytes)];
    cbBuf = sizeof(szBytes);
    fRet = HttpQueryInfo
        (hRequest, HTTP_QUERY_ACCEPT_RANGES, szBuf, &cbBuf, 0);
    if (fRet && !lstrcmpi (szBuf, szBytes))
        pCBParam->fdwRequestFlags |= HTTP_REQUEST_ACCEPT_RANGES;

    // Get the response code.
    cbBuf = sizeof(pCBParam->dwResponseCode);
    fRet = HttpQueryInfo
    (
        hRequest,
        HTTP_QUERY_FLAG_NUMBER | HTTP_QUERY_STATUS_CODE,
        &pCBParam->dwResponseCode,
        &cbBuf,
        NULL
    );
    if (!fRet)
       pCBParam->dwResponseCode = 0;

    // Get the last modified time from the response headers.
    cbBuf = sizeof(*pstLastModified);
    fRet = HttpQueryInfo
    (
        hRequest,
        HTTP_QUERY_FLAG_SYSTEMTIME | HTTP_QUERY_LAST_MODIFIED,
        pstLastModified,
        &cbBuf,
        NULL
    );
    pCBParam->pstLastModified = fRet? pstLastModified : NULL;

    // Get the content length from the cache file size.
    pCBParam->dwContentLength =
        InternetSetFilePointer (hRequest, NULL, 0, FILE_END, 0);

    return TRUE;
}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/Range/callback.Cpp File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • Range
Defines | Functions

callback.Cpp File Reference

#include <urlmon.h>
#include <wininet.h>
#include "callback.hpp"

Go to the source code of this file.

Defines

#define | BOUNDARY_MAXSIZE 500
#define | GrokInt(pint, delim) if (!BufScanInt (pint,delim)) return FALSE;
#define | GrokStr(str) if (!BufScanStr (str, sizeof(str)-1)) return FALSE;
#define | RECV_BUF_SIZE 8192

Functions

STDMETHODIMP_ (ULONG) CUrlmonCallback

Define Documentation

#define BOUNDARY_MAXSIZE 500

Definition at line 21 of file callback.Cpp.

#define GrokInt | ( | pint,
 |  | delim |
 | ) |  | if (!BufScanInt (pint,delim)) return FALSE;
#define GrokStr ( str ) if (!BufScanStr (str, sizeof(str)-1)) return FALSE;
#define RECV_BUF_SIZE 8192

Definition at line 22 of file callback.Cpp.

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 100 of file callback.Cpp.

{
    if (m_pParam->punkOuter)
        ((IUnknown *) m_pParam->punkOuter)->Release();

    if (--m_cRef == 0)
    {
        delete this;
        return 0;
    }
    return m_cRef;
}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/Range/callback.hpp File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • Range
Classes

callback.hpp File Reference

#include <urlmon.h>
#include "recvbuf.hpp"
#include "range.h"

Go to the source code of this file.

Classes

class CUrlmonCallback
Generated on Wed Nov 13 2024 16:53:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/Range/download.Cpp File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • Range
Functions

download.Cpp File Reference

#include <urlmon.h>
#include <wininet.h>
#include "range.h"
#include "callback.hpp"

Go to the source code of this file.

Functions

HRESULT | GetAnInterface (IUnknown *punk, const IID &riid, void **pout, BOOL bCheckServiceProvider, const IID &siid, const IID &siid_riid, void **sout)
BOOL | HttpReadFromServer (PHTTP_REQUEST_PARAM pParam)

Function Documentation

HRESULT GetAnInterface | ( | IUnknown * | punk,
 |  | const IID & | riid,
 |  | void ** | pout,
 |  | BOOL | bCheckServiceProvider,
 |  | const IID & | siid,
 |  | const IID & | siid_riid,
 |  | void ** | sout
 | ) |  |

Definition at line 25 of file download.Cpp.

{
    IOleObject *      oleObj    = 0;
    IOleClientSite *  oleSite   = 0;
    IOleContainer *   container = 0;
    IUnknown *        service   = 0;

    HRESULT       hr = E_FAIL;

    // Initialize passed in interface pointers: calling code assumes NULL for failure
    if(pout)
        *pout = NULL;
    if(sout)
        *sout = NULL;

    if(punk)
        hr = punk->QueryInterface( IID_IOleObject, (void **)&oleObj );

    while( SUCCEEDED(hr) && oleObj )
    {
        if( oleSite )
        {
            //oleSite->Release();
            oleSite = 0;
        }

        hr = oleObj->GetClientSite(&oleSite);

        if( FAILED(hr) )
            break;

        if( bCheckServiceProvider )
        {
            IServiceProvider * servProv;

            hr = oleSite->QueryInterface( IID_IServiceProvider, (void**)&servProv);

            if( SUCCEEDED(hr) )
            {
                hr = servProv->QueryService
                    (siid, siid_riid, (void **) &service);
                servProv->Release();
            }

            if( SUCCEEDED(hr) )
            {
                bCheckServiceProvider = FALSE;

                hr = service->QueryInterface( riid, pout );
            }

            if( SUCCEEDED(hr) )
                break;

        }

        if( container )
        {
            container->Release();
            container = 0;
        }

        hr = oleSite->GetContainer( &container );

        if( FAILED(hr) )
            break;

        hr = container->QueryInterface( riid, pout );

        if( SUCCEEDED(hr) )
            break;

        oleObj->Release();
        oleObj = 0;

        hr = container->QueryInterface( IID_IOleObject, (void**)&oleObj );

    }

    if( oleSite )
    {
        //oleSite->Release();
    }

    if( oleObj )
        oleObj->Release();

    if( container )
        container->Release();

    if( service )
        *sout = service;

    return( hr );

}

BOOL HttpReadFromServer ( PHTTP_REQUEST_PARAM pParam )

Definition at line 131 of file download.Cpp.

{
    IMoniker*            m_pmk   = NULL;
    IBindStatusCallback* m_pbsc  = NULL;
    HRESULT hr = S_OK;

    IBindHost *pBindHost = NULL;

    // Create a callback object.
    m_pbsc = new CUrlmonCallback (pParam);
    if (m_pbsc == NULL)
    {
        hr = E_OUTOFMEMORY;
        goto err;
    }

    // Look for a bind host.
    if (pParam->punkOuter)
    {
        hr = GetAnInterface
        (
            (IUnknown *) pParam->punkOuter,
            IID_IBindHost,           // const IID &  riid,
            (void **) &pBindHost,    // void **      pout,
            TRUE,                    // BOOL         bCheckServiceProvider,
            IID_IBindHost,           // const IID &  siid,
            IID_IBindHost,           // const IID &  siid_riid,
            (void **) &pBindHost     // void **      sout
        );
    }

    // Convert ANSI URL to Unicode.
    WCHAR wszUrl[INTERNET_MAX_URL_LENGTH];
    MultiByteToWideChar(CP_ACP, 0, pParam->pszUrl, -1, wszUrl, sizeof(wszUrl)/
      sizeof(WCHAR));

    // Initialize bind context, stream.
    IBindCtx *pbc;
    IStream *pstm;
    pbc =  NULL;
    pstm = NULL;

    // Call the appropriate BindToStorage.
    if (pBindHost)
    {
         pBindHost->CreateMoniker (wszUrl, NULL, &m_pmk, 0);
         pBindHost->MonikerBindToStorage
             (m_pmk, NULL, m_pbsc, IID_IStream, (void **) &pstm);
    }
    else
    {
        CreateURLMoniker(NULL, wszUrl, &m_pmk);
        CreateAsyncBindCtx(0, m_pbsc, NULL, &pbc);
        m_pmk->BindToStorage(pbc, NULL, IID_IStream, (void **) &pstm);
    }

    // Clean up bind context, stream.
    if (pbc)
        pbc->Release();
    if (pstm)
        pstm->Release();

    return SUCCEEDED(hr);

err:
    delete m_pbsc;

    if (m_pmk != NULL)
    {
        m_pmk->Release();
        m_pmk = NULL;
    }
    return FALSE;

}

Generated on Wed Nov 13 2024 16:53:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/Range/Range.c File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • Range
Defines | Functions | Variables

Range.c File Reference

#include <windows.h>
#include <urlmon.h>
#include <stdio.h>
#include <stdlib.h>
#include "range.h"

Go to the source code of this file.

Defines

#define | CASEMSG(hr) case hr: printf(#hr); break;

Functions

void | DumpBytes (PBYTE pBuf, DWORD cbBuf)
int __cdecl | main (int argc, char *argv[])
void | PrintResultCode (HRESULT hr)
BOOL | RequestCallback (PHTTP_REQUESTCB_PARAM pCBParam)

Variables

DWORD g_dwThread

Define Documentation

#define CASEMSG ( hr ) case hr: printf(#hr); break;

Function Documentation

void DumpBytes | ( | PBYTE | pBuf,
 |  | DWORD | cbBuf
 | ) |  |

Definition at line 26 of file Range.c.

{
    DWORD i;
    for (i=0; i<cbBuf; i++)
    {
        switch(pBuf[i])
        {
            case 10:  printf("[LF]"); break;
            case 13:  printf("[CR]"); break;
            default:  printf("%c", pBuf[i]); break;
        }
    }
}

int __cdecl main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 110 of file Range.c.

{
    MSG msg;
    HTTP_REQUEST_PARAM Param;

    SYSTEMTIME st;
    PSTR pszUrl;
    HTTP_REQUEST_RANGE ranges[10];
    DWORD cRanges;

    // Check usage.
    if (argc<2 || argc%2 || argc>(2*(sizeof(ranges))/sizeof(ranges[0])))
    {
        fprintf (stderr, "Usage:   range <http-url> [<offset1> <size1>]  [<offset2> <size2>]  [<offset3> <size3>]  ...\n");
        fprintf (stderr, "Example: range http://www.microsoft.com 2 5 10 52 20 4\n");
        exit (1);
    }

    // Get URL and ranges from command line.
    pszUrl = argv[1];
    cRanges = 0;
    while (argc -= 2)
    {
    if (argc <= 0)
      break;

      ranges[cRanges].dwOffset = atoi(argv[2 * cRanges + 2]);
      ranges[cRanges].dwSize   = atoi(argv[2 * cRanges + 3]);
        cRanges++;
    }

    // Pass current time as unless-modified-since time.
    GetSystemTime (&st);

    // Save the thread ID so the we can post ourselves
    // WM_QUIT from the callback without creating a window.
    g_dwThread = GetCurrentThreadId();

    // Read range depends on URL monikers which depend on COM.
    if (FAILED(CoInitialize(NULL)))
        exit (1);

    // Initiate the read range request.
    ZeroMemory (&Param, sizeof(Param));
    Param.cbStruct     = sizeof(Param);
    Param.pszUrl       = pszUrl;
    Param.pfnRequestCB = RequestCallback;
    Param.dwRequestCtx = 15;
    Param.pRanges      = &ranges[0];
    Param.cRanges      = cRanges;
    Param.pstUnlessModifiedSince = &st;

    if (HttpReadRequest (&Param))
    {
        // Must enter a message loop for the binding to progress.
        while (GetMessage (&msg, NULL, 0, 0))
        {
            TranslateMessage (&msg);
            DispatchMessage (&msg);
        }
    }

    CoUninitialize();
    return 1;
}

void PrintResultCode ( HRESULT hr )

Definition at line 41 of file Range.c.

{
#define CASEMSG(hr) case hr: printf(#hr); break;

  printf ("Done with result ");
  switch (hr)
  {
    CASEMSG(S_OK)
    CASEMSG(S_FALSE)
    CASEMSG(E_FAIL)

        CASEMSG(INET_E_INVALID_URL)
    CASEMSG(INET_E_NO_SESSION)
    CASEMSG(INET_E_CANNOT_CONNECT)
    CASEMSG(INET_E_RESOURCE_NOT_FOUND)
    CASEMSG(INET_E_OBJECT_NOT_FOUND)
    CASEMSG(INET_E_DATA_NOT_AVAILABLE)
    CASEMSG(INET_E_DOWNLOAD_FAILURE)
    CASEMSG(INET_E_AUTHENTICATION_REQUIRED)
    CASEMSG(INET_E_NO_VALID_MEDIA)
    CASEMSG(INET_E_CONNECTION_TIMEOUT)
    CASEMSG(INET_E_INVALID_REQUEST)
    CASEMSG(INET_E_UNKNOWN_PROTOCOL)
    CASEMSG(INET_E_SECURITY_PROBLEM)
    CASEMSG(INET_E_CANNOT_LOAD_DATA)
    CASEMSG(INET_E_CANNOT_INSTANTIATE_OBJECT)

    default:
        printf ("0x%x", hr);
  }
  printf ("\n");
}

BOOL RequestCallback ( PHTTP_REQUESTCB_PARAM pCBParam )

Definition at line 75 of file Range.c.

{
    printf ("RequestCallback[%d] ", pCBParam->dwRequestCtx);

    switch (pCBParam->CallbackType)
    {
        case REQUESTCB_STARTED:
            printf ("Started\n");
            printf ("  Status: %d\n", pCBParam->dwResponseCode);
            printf ("  Content-Length: %d\n", pCBParam->dwContentLength);
            if (pCBParam->fdwRequestFlags & HTTP_REQUEST_ACCEPT_RANGES)
                printf ("  Accept-Ranges: bytes\n");
            if (pCBParam->fdwRequestFlags & HTTP_REQUEST_FROM_CACHE)
                printf ("  From Cache\n");
            return TRUE;

        case REQUESTCB_DATA:

        // Dump some bytes so we can verify them.
        printf ("offset=%5d got %4d bytes:",
            pCBParam->dwDataOffset, pCBParam->cbDataLength);
        DumpBytes ((PBYTE) pCBParam->lpDataBuffer, min(pCBParam->cbDataLength, 15));
        printf ("\n");
        return TRUE;

        case REQUESTCB_DONE:
            PrintResultCode (pCBParam->hrRequest);
            // Let the console app thread exit the message loop.
            PostThreadMessage (g_dwThread, WM_QUIT, 0, 0);
            return TRUE;
  }
  return FALSE;
}

Variable Documentation

DWORD g_dwThread

Definition at line 23 of file Range.c.

Generated on Wed Nov 13 2024 16:53:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/Range/Range.h File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • Range
Classes | Defines | Typedefs | Enumerations | Functions

Range.h File Reference

#include <windows.h>
#include <objbase.h>

Go to the source code of this file.

Classes

struct | HTTP_REQUEST_PARAM
struct | HTTP_REQUEST_RANGE
struct | HTTP_REQUESTCB_PARAM

Defines

#define | HTTP_REQUEST_ACCEPT_RANGES 2
#define | HTTP_REQUEST_FROM_CACHE 1

Typedefs

typedef BOOL(* | PFN_REQUESTCB )(PHTTP_REQUESTCB_PARAM)
typedef struct HTTP_REQUEST_PARAM * | PHTTP_REQUEST_PARAM
typedef struct HTTP_REQUEST_RANGE * | PHTTP_REQUEST_RANGE
typedef struct
HTTP_REQUESTCB_PARAM * 		PHTTP_REQUESTCB_PARAM

Enumerations

enum | HTTP_REQUESTCB_TYPE { REQUESTCB_STARTED = 0, REQUESTCB_DATA = 1, REQUESTCB_DONE = 2 }

Functions

BOOL HttpReadFromServer (PHTTP_REQUEST_PARAM)
BOOL HttpReadRequest (PHTTP_REQUEST_PARAM)

Define Documentation

#define HTTP_REQUEST_ACCEPT_RANGES 2

Definition at line 97 of file Range.h.

#define HTTP_REQUEST_FROM_CACHE 1

Definition at line 96 of file Range.h.

Typedef Documentation

typedef BOOL(* PFN_REQUESTCB)(PHTTP_REQUESTCB_PARAM)

Definition at line 100 of file Range.h.

typedef struct HTTP_REQUEST_PARAM * PHTTP_REQUEST_PARAM
typedef struct HTTP_REQUEST_RANGE * PHTTP_REQUEST_RANGE
typedef struct HTTP_REQUESTCB_PARAM * PHTTP_REQUESTCB_PARAM

Enumeration Type Documentation

enum HTTP_REQUESTCB_TYPE
Enumerator:
REQUESTCB_STARTED
REQUESTCB_DATA
REQUESTCB_DONE

Definition at line 52 of file Range.h.

{
  REQUESTCB_STARTED  = 0,
  REQUESTCB_DATA     = 1,
  REQUESTCB_DONE     = 2,
}

Function Documentation

BOOL HttpReadFromServer ( PHTTP_REQUEST_PARAM )

Definition at line 131 of file download.Cpp.

{
    IMoniker*            m_pmk   = NULL;
    IBindStatusCallback* m_pbsc  = NULL;
    HRESULT hr = S_OK;

    IBindHost *pBindHost = NULL;

    // Create a callback object.
    m_pbsc = new CUrlmonCallback (pParam);
    if (m_pbsc == NULL)
    {
        hr = E_OUTOFMEMORY;
        goto err;
    }

    // Look for a bind host.
    if (pParam->punkOuter)
    {
        hr = GetAnInterface
        (
            (IUnknown *) pParam->punkOuter,
            IID_IBindHost,           // const IID &  riid,
            (void **) &pBindHost,    // void **      pout,
            TRUE,                    // BOOL         bCheckServiceProvider,
            IID_IBindHost,           // const IID &  siid,
            IID_IBindHost,           // const IID &  siid_riid,
            (void **) &pBindHost     // void **      sout
        );
    }

    // Convert ANSI URL to Unicode.
    WCHAR wszUrl[INTERNET_MAX_URL_LENGTH];
    MultiByteToWideChar(CP_ACP, 0, pParam->pszUrl, -1, wszUrl, sizeof(wszUrl)/
      sizeof(WCHAR));

    // Initialize bind context, stream.
    IBindCtx *pbc;
    IStream *pstm;
    pbc =  NULL;
    pstm = NULL;

    // Call the appropriate BindToStorage.
    if (pBindHost)
    {
         pBindHost->CreateMoniker (wszUrl, NULL, &m_pmk, 0);
         pBindHost->MonikerBindToStorage
             (m_pmk, NULL, m_pbsc, IID_IStream, (void **) &pstm);
    }
    else
    {
        CreateURLMoniker(NULL, wszUrl, &m_pmk);
        CreateAsyncBindCtx(0, m_pbsc, NULL, &pbc);
        m_pmk->BindToStorage(pbc, NULL, IID_IStream, (void **) &pstm);
    }

    // Clean up bind context, stream.
    if (pbc)
        pbc->Release();
    if (pstm)
        pstm->Release();

    return SUCCEEDED(hr);

err:
    delete m_pbsc;

    if (m_pmk != NULL)
    {
        m_pmk->Release();
        m_pmk = NULL;
    }
    return FALSE;

}

BOOL HttpReadRequest ( PHTTP_REQUEST_PARAM )

Definition at line 201 of file cache.Cpp.

{
    if (pParam->cbStruct != sizeof(HTTP_REQUEST_PARAM))
    {
        SetLastError (ERROR_INVALID_PARAMETER);
        return FALSE;
    }

    if (HttpReadFromCache (pParam))
        return TRUE;
    return HttpReadFromServer (pParam);
}

Generated on Wed Nov 13 2024 16:53:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/Range/recvbuf.Cpp File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • Range
Defines

recvbuf.Cpp File Reference

#include <windows.h>
#include <wininet.h>
#include <limits.h>
#include "recvbuf.hpp"

Go to the source code of this file.

Defines

#define upcase(c) ((BYTE) CharUpper ((LPSTR) (BYTE) (c)))

Define Documentation

#define upcase ( c ) ((BYTE) CharUpper ((LPSTR) (BYTE) (c)))

Definition at line 21 of file recvbuf.Cpp.

Generated on Wed Nov 13 2024 16:53:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/ActiveDocument/Range/recvbuf.hpp File Reference

  • Com
  • Fundamentals
  • ActiveDocument
  • Range
Classes

recvbuf.hpp File Reference

Go to the source code of this file.

Classes

class RecvBuf
Generated on Wed Nov 13 2024 16:53:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/AsyncCalls/CallBackClient/callbackclient.Cpp File Reference

  • Com
  • Fundamentals
  • AsyncCalls
  • CallBackClient
Functions | Variables

callbackclient.Cpp File Reference

#include "stdafx.h"
#include "CallBackClient.h"
#include "FullSvr.h"
#include <iostream.h>
#include <conio.h>

Go to the source code of this file.

Functions

int | main (int argc, char *argv[])
HRESULT WINAPI | QueryFunc (void *pv, REFIID riid, LPVOID *ppv, DWORD_PTR dw)

Variables

CExeModule _Module

Function Documentation

int main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 31 of file callbackclient.Cpp.

{
  UNREFERENCED_PARAMETER(argc);
  UNREFERENCED_PARAMETER(argv);
  HRESULT hr;
  ISynchronize * pISynchronize;

  //Create an STA
  hr = CoInitializeEx(NULL,COINIT_APARTMENTTHREADED);
  _ASSERT(SUCCEEDED(hr));

  //Create the call back component
  CComObject<CCallBack> * pCallBackObj = NULL;
  hr = CComObject<CCallBack>::CreateInstance(&pCallBackObj);
  _ASSERT(SUCCEEDED(hr));

  //Get ISynchronize from our callback object
  hr = pCallBackObj->QueryInterface(IID_ISynchronize,(void**)&pISynchronize);

  //Start the non-blocking method call
  hr = pCallBackObj->StartCall(2,3);
  if(FAILED(hr)){
    cerr<<"StartCall Failed"<<endl;
  } else {
    //Enter message loop waiting for callback
    pISynchronize->Wait(0,INFINITE);
  }

  pISynchronize->Release();
  CoUninitialize();

  cout<<endl<<"Press Enter to continue..\n \n"<<endl;
  _getch();

  return 0;
}

HRESULT WINAPI QueryFunc | ( | void * | pv,
 |  | REFIID | riid,
 |  | LPVOID * | ppv,
 |  | DWORD_PTR | dw
 | ) |  |

Definition at line 192 of file callbackclient.Cpp.

                                                                          {
  UNREFERENCED_PARAMETER(dw);
  return ((CCallBack *)pv)->MyQuery(riid,ppv);
}

Variable Documentation

CExeModule _Module

Definition at line 70 of file callbackclient.Cpp.

Generated on Wed Nov 13 2024 16:53:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/AsyncCalls/CallBackClient/callbackclient.h File Reference

  • Com
  • Fundamentals
  • AsyncCalls
  • CallBackClient
Classes | Functions

callbackclient.h File Reference

#include "FullSvr_i.c"

Go to the source code of this file.

Classes

class | CCallBack

Functions

HRESULT WINAPI | QueryFunc (void *, REFIID, LPVOID *, DWORD_PTR)

Function Documentation

HRESULT WINAPI QueryFunc | ( | void * | ,
 |  | REFIID | ,
 |  | LPVOID * | ,
 |  | DWORD_PTR |
 | ) |  |

Definition at line 192 of file callbackclient.Cpp.

                                                                          {
  UNREFERENCED_PARAMETER(dw);
  return ((CCallBack *)pv)->MyQuery(riid,ppv);
}

Generated on Wed Nov 13 2024 16:53:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/AsyncCalls/CallBackClient/stdafx.Cpp File Reference

  • Com
  • Fundamentals
  • AsyncCalls
  • CallBackClient

stdafx.Cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/AsyncCalls/CallBackClient/stdafx.h File Reference

  • Com
  • Fundamentals
  • AsyncCalls
  • CallBackClient
Classes | Defines | Variables

stdafx.h File Reference

#include <atlbase.h>
#include <atlcom.h>
#include <stdio.h>

Go to the source code of this file.

Classes

class | CExeModule

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0500
#define | STRICT

Variables

CExeModule _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 36 of file stdafx.h.

#define _WIN32_WINNT 0x0500

Definition at line 34 of file stdafx.h.

#define STRICT

Definition at line 32 of file stdafx.h.

Variable Documentation

CExeModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/AsyncCalls/CPPClient/cppclient.Cpp File Reference

  • Com
  • Fundamentals
  • AsyncCalls
  • CPPClient
Functions

cppclient.Cpp File Reference

#include "stdafx.h"
#include <iostream.h>
#include <conio.h>
#include "FullSvr.h"
#include "FullSvr_i.c"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])

Function Documentation

int main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 22 of file cppclient.Cpp.

{

  HRESULT hr;
  int i;
  AsyncIFullServ * pAsyncIFullServ = NULL;
  ICallFactory   * pICallFactory = NULL;
  ISynchronize   * pISynchronize = NULL;
  IUnknown       * pIUnknown = NULL;

  //Create an STA
  CoInitializeEx(NULL,COINIT_APARTMENTTHREADED);

  //Create the server object
  hr = CoCreateInstance(CLSID_FullServ,NULL,CLSCTX_LOCAL_SERVER,IID_IUnknown,(void**)&pIUnknown);
  if(FAILED(hr)){
    cerr<<"CoCreateInstance failed"<<endl;
    goto CleanUp;
  }

  //Get a pointer to ICallFactory
  hr = pIUnknown->QueryInterface(IID_ICallFactory,(void **)&pICallFactory);
  if(FAILED(hr)){
    cerr<<"Query for ICallFactory failed."<<endl;
    goto CleanUp;
  }

  //Create the call object and get a pointer to the async interface
  hr = pICallFactory->CreateCall(IID_AsyncIFullServ,NULL,IID_AsyncIFullServ,(IUnknown**)&pAsyncIFullServ);
  if(FAILED(hr)){
    cerr<<"Unable to create Call Object."<<endl;
    goto CleanUp;
  }

  //Get a pointer to ISynchronize
  hr = pAsyncIFullServ->QueryInterface(IID_ISynchronize,(void**)&pISynchronize);
  if(FAILED(hr)){
    cerr<<"Query for ISynchronize failed."<<endl;
    goto CleanUp;
  }

  //Begin the non-blocking call
  hr = pAsyncIFullServ->Begin_Sum(2,3);
  if(FAILED(hr)){
    cerr<<"Begin_Sum failed.  Call was not sent succesfully to the server"<<endl;
    //this failed call will be cleaned up by releasing the call object
    goto CleanUp;
  }

  cout<<"Waiting for call completion."<<endl;
  //Wait for call completion
  hr = pISynchronize->Wait(0,INFINITE);
  if(FAILED(hr)){
    cerr<<"Wait failed"<<endl;
    goto CleanUp;
  }

  //Finish the call and retrieve the results
  hr = pAsyncIFullServ->Finish_Sum(&i);
  if(FAILED(hr)){
    cerr<<"Finish_Sum failed."<<hr<<endl;
    goto CleanUp;
  }

  cout<<"Sum of 2 and 3 is: "<< i <<endl;

//Release all allocated resources
CleanUp:

  if(pAsyncIFullServ) pAsyncIFullServ->Release();
  if(pISynchronize)   pISynchronize->Release();
  if(pIUnknown)       pIUnknown->Release();
  if(pICallFactory)   pICallFactory->Release();

  CoUninitialize();

  cout<<endl<<"Press Enter to continue..\n \n"<<endl;
  _getch();

  return 0;
}

Generated on Wed Nov 13 2024 16:53:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/AsyncCalls/CPPClient/stdafx.Cpp File Reference

  • Com
  • Fundamentals
  • AsyncCalls
  • CPPClient

stdafx.Cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/AsyncCalls/CPPClient/stdafx.h File Reference

  • Com
  • Fundamentals
  • AsyncCalls
  • CPPClient
Defines | Variables

stdafx.h File Reference

#include <stdio.h>
#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0400
#define | STRICT
#define | WIN32_LEAN_AND_MEAN

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 37 of file stdafx.h.

#define _WIN32_WINNT 0x0400

Definition at line 35 of file stdafx.h.

#define STRICT

Definition at line 33 of file stdafx.h.

#define WIN32_LEAN_AND_MEAN

Definition at line 30 of file stdafx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/AsyncCalls/FullSvr/fullserv.Cpp File Reference

  • Com
  • Fundamentals
  • AsyncCalls
  • FullSvr
Functions

fullserv.Cpp File Reference

#include "stdafx.h"
#include "FullSvr.h"
#include "FullServ.h"

Go to the source code of this file.

Functions

DWORD WINAPI WorkerFcn (LPVOID context)

Function Documentation

DWORD WINAPI WorkerFcn ( LPVOID context )

Definition at line 177 of file fullserv.Cpp.

                                       {
    // This thread from the system thread pool does not have
    // a predetermined COM thread type. So this code calls
    // CoInitializeEx to setup a proper execution environment
    // (i.e. same apartment (MTA) as Begin_Sum call was dispatched in.)
    HRESULT hr = CoInitializeEx(NULL,COINIT_MULTITHREADED);
  _ASSERT(SUCCEEDED(hr));

    CAsyncFullServ * pAsyncFullServ = (CAsyncFullServ *) pContext;

  //Simulate work
  for(int i = 0; i < 1000; i++){
    for(int j = 0; j < 1000; j++){
    }
  }

  //Do the real Work of the function
  pAsyncFullServ->doSum();

    // Call CoUninitialize to return this thread to
    // the uninitialized COM state.
    CoUninitialize();
  return 0;
}

Generated on Wed Nov 13 2024 16:53:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/AsyncCalls/FullSvr/fullserv.h File Reference

  • Com
  • Fundamentals
  • AsyncCalls
  • FullSvr
Classes

fullserv.h File Reference

#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Classes

class | CAsyncFullServ
class | CFullServ
Generated on Wed Nov 13 2024 16:53:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/AsyncCalls/FullSvr/fullsvr.Cpp File Reference

  • Com
  • Fundamentals
  • AsyncCalls
  • FullSvr
Functions | Variables

fullsvr.Cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include <string.h>
#include "FullSvr.h"
#include "FullSvr_i.c"
#include "FullServ.h"

Go to the source code of this file.

Functions

int WINAPI | _tWinMain (HINSTANCE hInstance, HINSTANCE, LPTSTR lpCmdLine, int)
LPCTSTR | FindOneOf (LPCTSTR p1, LPCTSTR p2)

Variables

CExeModule _Module
const DWORD | dwPause = 1000
const DWORD | dwTimeOut = 5000
HANDLE hMonitorThread

Function Documentation

int WINAPI _tWinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | ,
 |  | LPTSTR | lpCmdLine,
 |  | int |
 | ) |  |

Definition at line 125 of file fullsvr.Cpp.

{
    lpCmdLine = GetCommandLine(); //this line necessary for _ATL_MIN_CRT

    HRESULT hRes = CoInitializeEx(NULL, COINIT_MULTITHREADED);
    _ASSERTE(SUCCEEDED(hRes));
    _Module.Init(ObjectMap, hInstance, &LIBID_FULLSVRLib);
    _Module.dwThreadID = GetCurrentThreadId();
    TCHAR szTokens[] = _T("-/");

    int nRet = 0;
    BOOL bRun = TRUE;
    LPCTSTR lpszToken = FindOneOf(lpCmdLine, szTokens);
    while (lpszToken != NULL)
    {
        if (_tcsnicmp(lpszToken, _T("UnregServer"), 11)==0)
        {
            _Module.UpdateRegistryFromResource(IDR_FullSvr, FALSE);
            nRet = _Module.UnregisterServer(TRUE);
            bRun = FALSE;
            break;
        }
        if (_tcsnicmp(lpszToken, _T("RegServer"), 9)==0)
        {
            _Module.UpdateRegistryFromResource(IDR_FullSvr, TRUE);
            nRet = _Module.RegisterServer(TRUE);
            bRun = FALSE;
            break;
        }
        lpszToken = FindOneOf(lpszToken, szTokens);
    }

    if (bRun)
    {
        _Module.StartMonitor();
        hRes = _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER,
            REGCLS_MULTIPLEUSE | REGCLS_SUSPENDED);
        _ASSERTE(SUCCEEDED(hRes));
        hRes = CoResumeClassObjects();
        _ASSERTE(SUCCEEDED(hRes));

        MSG msg;
        while (GetMessage(&msg, 0, 0, 0))
            DispatchMessage(&msg);

        _Module.RevokeClassObjects();
        Sleep(dwPause); //wait for any threads to finish
    }

  CloseHandle(hMonitorThread);
    _Module.Term();
    CoUninitialize();
    return nRet;
}

LPCTSTR FindOneOf | ( | LPCTSTR | p1,
 |  | LPCTSTR | p2
 | ) |  |

Definition at line 107 of file fullsvr.Cpp.

{
    while (p1 != NULL && *p1 != NULL)
    {
        LPCTSTR p = p2;
        while (p != NULL && *p != NULL)
        {
            if (*p1 == *p)
                return CharNext(p1);
            p = CharNext(p);
        }
        p1 = CharNext(p1);
    }
    return NULL;
}

Variable Documentation

CExeModule _Module

Definition at line 100 of file fullsvr.Cpp.

const DWORD dwPause = 1000

Definition at line 43 of file fullsvr.Cpp.

const DWORD dwTimeOut = 5000

Definition at line 42 of file fullsvr.Cpp.

HANDLE hMonitorThread

Definition at line 44 of file fullsvr.Cpp.

Generated on Wed Nov 13 2024 16:53:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/AsyncCalls/FullSvr/fullsvr.Idl File Reference

  • Com
  • Fundamentals
  • AsyncCalls
  • FullSvr
Functions | Variables

fullsvr.Idl File Reference

Go to the source code of this file.

Functions

library FULLSVRLib | importlib ("stdole32.tlb")
importlib ("stdole2.tlb")

Variables

import oaidl | idl
interface int | j
interface int int * | sum

Function Documentation

library FULLSVRLib importlib ( "stdole32.tlb" )
importlib ( "stdole2.tlb" )

Variable Documentation

import ocidl idl

Definition at line 29 of file fullsvr.Idl.

interface int j

Definition at line 45 of file fullsvr.Idl.

interface int int * sum

Definition at line 45 of file fullsvr.Idl.

Generated on Wed Nov 13 2024 16:53:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/AsyncCalls/FullSvr/resource.h File Reference

  • Com
  • Fundamentals
  • AsyncCalls
  • FullSvr
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_FULLSERV 101
#define | IDR_FullSvr 100
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_FULLSERV 101

Definition at line 7 of file resource.h.

#define IDR_FullSvr 100

Definition at line 6 of file resource.h.

#define IDS_PROJNAME 100

Definition at line 5 of file resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/AsyncCalls/FullSvr/stdafx.Cpp File Reference

  • Com
  • Fundamentals
  • AsyncCalls
  • FullSvr

stdafx.Cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/AsyncCalls/FullSvr/stdafx.h File Reference

  • Com
  • Fundamentals
  • AsyncCalls
  • FullSvr
Classes | Defines | Variables

stdafx.h File Reference

#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Classes

class | CExeModule

Defines

#define | _ATL_FREE_THREADED
#define | _WIN32_WINNT 0x0500
#define | STRICT

Variables

CExeModule _Module

Define Documentation

#define _ATL_FREE_THREADED

Definition at line 39 of file stdafx.h.

#define _WIN32_WINNT 0x0500

Definition at line 37 of file stdafx.h.

#define STRICT

Definition at line 35 of file stdafx.h.

Variable Documentation

CExeModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/AsyncCalls/HelpDll/helpdll.Cpp File Reference

  • Com
  • Fundamentals
  • AsyncCalls
  • HelpDll
Functions | Variables

helpdll.Cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Functions

__declspec (dllexport) __stdcall GetCallObject(ICallFactory *pCf
REFIID IUnknown REFIID
IUnknown **ppv return pCf 		CreateCall (riid1, pUnkOuter, riid2, ppv)
BOOL WINAPI | DllMain (HMODULE hModule, DWORD dwReason, LPVOID lpReserved)
DWORD dwMilli return pSync | Wait (0, dwMilli)

Variables

REFIID IUnknown * | pUnkOuter
REFIID | riid1
REFIID IUnknown REFIID | riid2

Function Documentation

__declspec ( dllexport )

Definition at line 31 of file CertGetKey.c.

{
  PCCERT_CONTEXT     pCert = NULL;
    DWORD              dwEncodingType = X509_ASN_ENCODING|PKCS_7_ASN_ENCODING;

  HCRYPTPROV hCryptProv = 0;
  HCRYPTKEY hKey = 0;

  DWORD dwBufferLen = 0;
    DWORD               dwBlobLen = 0;

  BOOL retValue = TRUE;

    // Create certificate context
    pCert = CertCreateCertificateContext(
                            dwEncodingType,
              (unsigned const char *) rgbRawData,
              cbRawData);

  if (pCert == NULL) {
    retValue = FALSE;
    goto Cleanup;
  }

  // Acquire a cryptographic context
  if (!CryptAcquireContext(&hCryptProv,
        NULL,
        NULL,
        PROV_RSA_FULL,
        0)) {
    if (!CryptAcquireContext(&hCryptProv,
        NULL,
        NULL,
        PROV_RSA_FULL,
        CRYPT_NEWKEYSET)) {
      retValue = FALSE;
      goto Cleanup;
    }
  }

  // Verify the date validity
  if (CertVerifyTimeValidity(
      NULL,
      pCert->pCertInfo) != 0) {
    retValue = FALSE;
    goto Cleanup;
  }

  // Maybe should have some validation of the certificate in case we can do it ...

  // Import the public key information
  if (!CryptImportPublicKeyInfoEx(
      hCryptProv,
      dwEncodingType,
      &(pCert->pCertInfo->SubjectPublicKeyInfo),
      0,
      0,
      NULL,
      &hKey)) {
    HRESULT hr = GetLastError();
    retValue = FALSE;
    goto Cleanup;
  }

  // Export the key into a key blob
  if (!CryptExportKey(
      hKey,
      0,
      PUBLICKEYBLOB,
      0,
      NULL,
      &dwBlobLen)) {
    retValue = FALSE;
    goto Cleanup;
    }

  *pKeyBlobSize = dwBlobLen;
    *ppbKeyBlob = (LPBYTE) malloc(dwBlobLen * sizeof(BYTE));
    if (*ppbKeyBlob == NULL) {
    retValue = FALSE;
    goto Cleanup;
    }

    if (!CryptExportKey(
      hKey,
      0,
      PUBLICKEYBLOB,
      0,
      *ppbKeyBlob,
      &dwBlobLen)) {
    retValue = FALSE;
    goto Cleanup;
    }

Cleanup:
  if (hKey)
    CryptDestroyKey(hKey);

  if (pCert)
    CertFreeCertificateContext(pCert);

  if (hCryptProv)
    CryptReleaseContext(hCryptProv, 0);

  return retValue;
}

REFIID IUnknown REFIID IUnknown** ppv return pCf CreateCall | ( | riid1 | ,
 |  | pUnkOuter | ,
 |  | riid2 | ,
 |  | ppv |
 | ) |  |
BOOL WINAPI DllMain | ( | HMODULE | hModule,
 |  | DWORD | dwReason,
 |  | LPVOID | lpReserved
 | ) |  |

Definition at line 23 of file helpdll.Cpp.

                                                                     {
  UNREFERENCED_PARAMETER(lpReserved);
  if (dwReason == DLL_PROCESS_ATTACH){
    DisableThreadLibraryCalls(hModule);
  };
  return TRUE;
}

DWORD dwMilli return pSync Wait | ( | 0 | ,
 |  | dwMilli |
 | ) |  |

Variable Documentation

REFIID IUnknown* pUnkOuter

Definition at line 39 of file helpdll.Cpp.

REFIID riid1

Definition at line 39 of file helpdll.Cpp.

REFIID IUnknown REFIID riid2

Definition at line 39 of file helpdll.Cpp.

Generated on Wed Nov 13 2024 16:53:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/AsyncCalls/HelpDll/stdafx.Cpp File Reference

  • Com
  • Fundamentals
  • AsyncCalls
  • HelpDll

stdafx.Cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/AsyncCalls/HelpDll/stdafx.h File Reference

  • Com
  • Fundamentals
  • AsyncCalls
  • HelpDll

stdafx.h File Reference

#include <windows.h>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/AsyncCalls/JavaClient/Class1.java File Reference

  • Com
  • Fundamentals
  • AsyncCalls
  • JavaClient
Classes

Class1.java File Reference

Go to the source code of this file.

Classes

class Class1
Generated on Wed Nov 13 2024 16:53:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/AsyncCalls/JavaClient/FullSvr/AsyncFullServ.java File Reference

  • Com
  • Fundamentals
  • AsyncCalls
  • JavaClient
  • FullSvr
Classes | Namespaces

AsyncFullServ.java File Reference

Go to the source code of this file.

Classes

class | fullsvr::AsyncFullServ
.class(classid=F03BE176-A8DE-40D1-9161-A36BCBE1FEA6,DynamicCasts) .interface(iid=D3140113-D43F-4718-9119-EF62D631F2AB, thread=AUTO) More...

Namespaces

namespace | fullsvr
Generated on Wed Nov 13 2024 16:53:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/AsyncCalls/JavaClient/FullSvr/AsyncIFullServ.java File Reference

  • Com
  • Fundamentals
  • AsyncCalls
  • JavaClient
  • FullSvr
Classes | Namespaces

AsyncIFullServ.java File Reference

Go to the source code of this file.

Classes

interface | fullsvr::AsyncIFullServ
.interface(iid=D3140113-D43F-4718-9119-EF62D631F2AB, thread=AUTO) More...

Namespaces

namespace | fullsvr
Generated on Wed Nov 13 2024 16:53:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/AsyncCalls/JavaClient/FullSvr/FullServ.java File Reference

  • Com
  • Fundamentals
  • AsyncCalls
  • JavaClient
  • FullSvr
Classes | Namespaces

FullServ.java File Reference

Go to the source code of this file.

Classes

class | fullsvr::FullServ
.class(classid=F03BE175-A8DE-40D1-9161-A36BCBE1FEA6,DynamicCasts) .interface(iid=D3140112-D43F-4718-9119-EF62D631F2AB, thread=AUTO) More...

Namespaces

namespace | fullsvr
Generated on Wed Nov 13 2024 16:53:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/AsyncCalls/JavaClient/FullSvr/ICallFactory.java File Reference

  • Com
  • Fundamentals
  • AsyncCalls
  • JavaClient
  • FullSvr
Classes | Namespaces

ICallFactory.java File Reference

Go to the source code of this file.

Classes

interface | fullsvr::ICallFactory
.interface(iid=1C733A30-2A1C-11CE-ADE5-00AA0044773D, thread=AUTO) More...

Namespaces

namespace | fullsvr
Generated on Wed Nov 13 2024 16:53:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/AsyncCalls/JavaClient/FullSvr/ICancelMethodCalls.java File Reference

  • Com
  • Fundamentals
  • AsyncCalls
  • JavaClient
  • FullSvr
Classes | Namespaces

ICancelMethodCalls.java File Reference

Go to the source code of this file.

Classes

interface | fullsvr::ICancelMethodCalls
.interface(iid=00000029-0000-0000-C000-000000000046, thread=AUTO) More...

Namespaces

namespace | fullsvr
Generated on Wed Nov 13 2024 16:53:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/AsyncCalls/JavaClient/FullSvr/IFullServ.java File Reference

  • Com
  • Fundamentals
  • AsyncCalls
  • JavaClient
  • FullSvr
Classes | Namespaces

IFullServ.java File Reference

Go to the source code of this file.

Classes

interface | fullsvr::IFullServ
.interface(iid=D3140112-D43F-4718-9119-EF62D631F2AB, thread=AUTO) More...

Namespaces

namespace | fullsvr
Generated on Wed Nov 13 2024 16:53:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/AsyncCalls/JavaClient/FullSvr/ISynchronize.java File Reference

  • Com
  • Fundamentals
  • AsyncCalls
  • JavaClient
  • FullSvr
Classes | Namespaces

ISynchronize.java File Reference

Go to the source code of this file.

Classes

interface | fullsvr::ISynchronize
.interface(iid=00000030-0000-0000-C000-000000000046, thread=AUTO) More...

Namespaces

namespace | fullsvr
Generated on Wed Nov 13 2024 16:53:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/AsyncCalls/ScaleDemo/scaledemo.Cpp File Reference

  • Com
  • Fundamentals
  • AsyncCalls
  • ScaleDemo
Functions | Variables

scaledemo.Cpp File Reference

#include "stdafx.h"
#include <iostream.h>
#include <conio.h>
#include <time.h>
#include "FullSvr.h"
#include "FullSvr_i.c"

Go to the source code of this file.

Functions

int | main (int argc, char *argv[])

Variables

AsyncIFullServ * | callObjFullArray [NUM_CONCURRENT_CALLS]
AsyncISample * | callObjSampleArray [NUM_CONCURRENT_CALLS]
const int | NUM_CONCURRENT_CALLS = 15

Function Documentation

int main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 41 of file scaledemo.Cpp.

{

  HRESULT hr;
  int i,j;
  IUnknown       * pIUnknown = NULL;
  ICallFactory   * pICallFactory = NULL;
  clock_t start,finish;

  for(i = 0; i < NUM_CONCURRENT_CALLS; i++){
    callObjFullArray[i]   = NULL;
    callObjSampleArray[i] = NULL;
  }

  //Create an STA
  CoInitializeEx(NULL,COINIT_APARTMENTTHREADED);

  //Create the server object
  hr = CoCreateInstance(CLSID_FullServ,NULL,CLSCTX_LOCAL_SERVER,IID_IUnknown,(void**)&pIUnknown);
  if(FAILED(hr)){
    cout<<"CCI failed"<<endl;
    goto CleanUp;
  }

  //Get ICallFactory
  hr = pIUnknown->QueryInterface(IID_ICallFactory,(void **)&pICallFactory);
  if(FAILED(hr)){
    cerr<<"Query for ICallFactory failed."<<endl;
    goto CleanUp;
  }

  //Create all call objects
  for(i = 0; i < NUM_CONCURRENT_CALLS; i++){

    //Create the call objects for AsyncIFullServ
    hr = pICallFactory->CreateCall(IID_AsyncIFullServ,NULL,IID_AsyncIFullServ,(IUnknown**)&callObjFullArray[i]);
    if(FAILED(hr)){
      cerr<<"Unable to create call object for AsyncIFullServ"<<endl;
      goto CleanUp;
    }

    //Create the call objects for AsyncISample
    hr = pICallFactory->CreateCall(IID_AsyncISample,NULL,IID_AsyncISample,(IUnknown**)&callObjSampleArray[i]);
    if(FAILED(hr)){
      cerr<<"Unable to create a call object for AsyncISample"<<endl;
      goto CleanUp;
    }
  }

  //Begin all calls on AsyncIFullServ
  cout<<"Starting calls to AsyncIFullServ."
    <<endl<<"These calls are handled asynchronously on the server."<<endl;
  start = clock();
  for(i = 0; i < NUM_CONCURRENT_CALLS; i++){

    hr = callObjFullArray[i]->Begin_Sum(2,3);

    if(FAILED(hr)){
      cerr<<"Begin failed on AsyncIFullServ"<<endl;
      goto CleanUp;
    }
  }

  //Finish all calls on AsyncIFullServ
  for(i = 0; i < NUM_CONCURRENT_CALLS; i++){

    hr = callObjFullArray[i]->Finish_Sum(&j);
    if(FAILED(hr)){
      cerr<<"Finish failed on AsyncIFullServ"<<endl;
      goto CleanUp;
    }
  }

  finish = clock();
  cout<<"Done"<<endl<<"Time elapsed: "<<(finish - start)<<"ms"<<endl;

  cout<<endl<<"Starting calls to AsyncISample."
    <<endl<<"These calls are handled synchronously on the server. This can take a while."<<endl;
  start = clock();

  //Begin all calls on AsyncISample
  for(i = 0; i < NUM_CONCURRENT_CALLS; i++){

    hr = callObjSampleArray[i]->Begin_Work(2,3);

    if(FAILED(hr)){
      cerr<<"Begin failed on AsyncIFullServ"<<endl;
      goto CleanUp;
    }

  }

  //Finish all calls on AsyncISample
  for(i = 0; i < NUM_CONCURRENT_CALLS; i++){

    callObjSampleArray[i]->Finish_Work(&j);

    if(FAILED(hr)){
      cerr<<"Finish failed on AsyncISample"<<endl;
      goto CleanUp;
    }

  }
  finish = clock();
  cout<<"Done"<<endl<<"Time elapsed: "<<(finish - start)<<"ms"<<endl;

CleanUp: //Release all references

  for(i = 0; i < NUM_CONCURRENT_CALLS; i++){
    if(callObjFullArray[i]) callObjFullArray[i]->Release();
    if(callObjSampleArray[i]) callObjSampleArray[i]->Release();
  }

  if(pIUnknown)       pIUnknown->Release();
  if(pICallFactory)   pICallFactory->Release();

  CoUninitialize();

  cout<<endl<<"Press Enter to continue..\n \n"<<endl;
  _getch();

  return 0;
}

Variable Documentation

AsyncIFullServ* callObjFullArray[NUM_CONCURRENT_CALLS]

Definition at line 37 of file scaledemo.Cpp.

AsyncISample* callObjSampleArray[NUM_CONCURRENT_CALLS]

Definition at line 38 of file scaledemo.Cpp.

const int NUM_CONCURRENT_CALLS = 15

Definition at line 34 of file scaledemo.Cpp.

Generated on Wed Nov 13 2024 16:53:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/AsyncCalls/ScaleDemo/stdafx.Cpp File Reference

  • Com
  • Fundamentals
  • AsyncCalls
  • ScaleDemo

stdafx.Cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/AsyncCalls/ScaleDemo/stdafx.h File Reference

  • Com
  • Fundamentals
  • AsyncCalls
  • ScaleDemo
Defines | Variables

stdafx.h File Reference

#include <stdio.h>
#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0400
#define | STRICT
#define | WIN32_LEAN_AND_MEAN

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 40 of file stdafx.h.

#define _WIN32_WINNT 0x0400

Definition at line 38 of file stdafx.h.

#define STRICT

Definition at line 36 of file stdafx.h.

#define WIN32_LEAN_AND_MEAN

Definition at line 32 of file stdafx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/CMallSpy/CMallSpy.Cxx File Reference

  • Com
  • Fundamentals
  • CMallSpy
Variables

CMallSpy.Cxx File Reference

#include <ole2.h>
#include "cmallspy.hxx"

Go to the source code of this file.

Variables

const ULONG HEADERSIZE = 128

Variable Documentation

const ULONG HEADERSIZE = 128

Definition at line 37 of file CMallSpy.Cxx.

Generated on Wed Nov 13 2024 16:53:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/CMallSpy/CMallSpy.Hxx File Reference

  • Com
  • Fundamentals
  • CMallSpy
Classes

CMallSpy.Hxx File Reference

Go to the source code of this file.

Classes

class CMallocSpy
Generated on Wed Nov 13 2024 16:53:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/CMallSpy/Test.Cxx File Reference

  • Com
  • Fundamentals
  • CMallSpy
Functions | Variables

Test.Cxx File Reference

#include <windows.h>
#include <ole2.h>
#include "cmallspy.hxx"

Go to the source code of this file.

Functions

int __cdecl | main (int argc, char **argv)
void | printf (CHAR *,...)

Variables

const UINT | NALLOCATIONS = 573

Function Documentation

int __cdecl main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 27 of file Test.Cxx.

{
    HRESULT     hr;
    LPMALLOCSPY pMallocSpy = new CMallocSpy();

    // Initialize
    CoInitialize(NULL);
    hr = CoRegisterMallocSpy(pMallocSpy);
    if (hr != S_OK)
    {
        printf("CoRegisterMallocSpy failed with %x\n", hr);
        CoUninitialize();
        return 0;
    }
    printf("CoRegisterMallocSpy succeeded.\n");

    // Allocate enoungh to force an expansion
    LPMALLOC pMalloc;
    void    *allocs[NALLOCATIONS];
    ULONG j;

    if ((hr = CoGetMalloc(MEMCTX_TASK, &pMalloc)) != S_OK)
    {
        printf("CoGetMalloc failed with %x\n", hr);
        CoUninitialize();
        return 0;
    }
    printf("CoGetMalloc succeeded.\n");
    printf("Allocating %u memory blocks.\n", NALLOCATIONS);
    for (j = 0; j < NALLOCATIONS; j++)
    {
        allocs[j] = pMalloc->Alloc(173);
    }

    // Now release everything
    printf("Releasing %u memory blocks.\n", NALLOCATIONS);
    for (j = 0; j < NALLOCATIONS; j++)
    {
        pMalloc->Free(allocs[j]);
        allocs[j] = NULL;
    }

    printf("Test complete.\n");
    // All done
    CoRevokeMallocSpy();
    CoUninitialize();
    return 0;
}

void printf | ( | CHAR * | ,
 |  |  | ...
 | ) |  |

Variable Documentation

const UINT NALLOCATIONS = 573

Definition at line 24 of file Test.Cxx.

Generated on Wed Nov 13 2024 16:53:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/Common/altassrt.Cxx File Reference

  • Com
  • Fundamentals
  • Common
Defines | Functions

altassrt.Cxx File Reference

#include <stdarg.h>
#include <stdio.h>
#include "assert.h"
#include <windows.h>

Go to the source code of this file.

Defines

#define | MessageBoxA MessageBox

Functions

void _CRTAPI1 | PopUpAssert (void *szFile, int iLine, void *szMessage)
int | PopUpError (char const *szMsg, int iLine, char const *szFile)

Define Documentation

#define MessageBoxA MessageBox

Definition at line 36 of file altassrt.Cxx.

Function Documentation

void _CRTAPI1 PopUpAssert | ( | void * | szFile,
 |  | int | iLine,
 |  | void * | szMessage
 | ) |  |

Definition at line 55 of file altassrt.Cxx.

{
    int id = PopUpError((char const *)szMessage,iLine, (char const *) szFile);

    if (id == IDCANCEL)
    {
#ifdef WIN32
        DebugBreak();
#else
        _asm int 3;
#endif
    }
}

int PopUpError | ( | char const * | szMsg,
 |  | int | iLine,
 |  | char const * | szFile
 | ) |  |

Definition at line 90 of file altassrt.Cxx.

{

    int id;
    static char szAssertCaption[128];
    static char szModuleName[128];

    DWORD tid = GetCurrentThreadId();
    DWORD pid = GetCurrentProcessId();
    char * pszModuleName;

    if (GetModuleFileNameA(NULL, szModuleName, 128))
    {
        pszModuleName = strrchr(szModuleName, '\\');
        if (!pszModuleName)
        {
            pszModuleName = szModuleName;
        }
        else
        {
            pszModuleName++;
        }
    }
    else
    {
        pszModuleName = "Unknown";
    }

    sprintf(szAssertCaption,"Process: %s File: %s line %u, thread id %d.%d",
        pszModuleName, szFile, iLine, pid, tid);

    DWORD dwMessageFlags = MB_SETFOREGROUND | MB_TASKMODAL |
                           MB_ICONEXCLAMATION | MB_OKCANCEL;

    id = MessageBoxA(NULL,
                     (char *) szMsg,
                     (LPSTR) szAssertCaption,
                     dwMessageFlags);

    // If id == 0, then an error occurred.  There are two possibilities
    // that can cause the error:  Access Denied, which means that this
    // process does not have access to the default desktop, and everything
    // else (usually out of memory).  Oh well.

    return id;
}

Generated on Wed Nov 13 2024 16:53:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/Common/Stablize.Cxx File Reference

  • Com
  • Fundamentals
  • Common

Stablize.Cxx File Reference

#include <windows.h>
#include <ole2.h>
#include <stablize.h>
#include <assert.h>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/CustomSurrogate/Dog/cDog.h File Reference

  • Com
  • Fundamentals
  • CustomSurrogate
  • Dog
Classes | Variables

cDog.h File Reference

#include "idog.h"

Go to the source code of this file.

Classes

class | CDog

Variables

LONG | g_cObjects

Variable Documentation

LONG g_cObjects

Definition at line 23 of file Dog.Cpp.

Generated on Wed Nov 13 2024 16:53:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/CustomSurrogate/Dog/Dog.Cpp File Reference

  • Com
  • Fundamentals
  • CustomSurrogate
  • Dog
Functions | Variables

Dog.Cpp File Reference

#include <windows.h>
#include "idog_i.c"
#include "dogcf.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow ()
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID FAR *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID pvReserved)
STDAPI | DllRegisterServer ()
STDAPI | DllUnregisterServer ()

Variables

LONG | g_cLocks
LONG | g_cObjects
HINSTANCE | g_hInst

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 58 of file Dog.Cpp.

{
    return (g_cLocks | g_cObjects) ? S_FALSE : S_OK;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID FAR * | ppv
 | ) |  |

Definition at line 63 of file Dog.Cpp.

{
    HRESULT hr;
    CClassFactory* pv;

    if (!ppv)
        return E_INVALIDARG;

    if (!IsEqualCLSID(rclsid, CLSID_DogClass))
        return CLASS_E_CLASSNOTAVAILABLE;

    pv = new CClassFactory();
    if (!pv)
        return E_OUTOFMEMORY;

    hr = ((IUnknown *)pv)->QueryInterface(riid, ppv);

    return hr;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID | pvReserved
 | ) |  |

Definition at line 26 of file Dog.Cpp.

{
    switch (dwReason)
  {
      case DLL_PROCESS_ATTACH:
      {
        g_hInst = hInstance;
        g_cObjects = 0;
        g_cLocks = 0;
      }
      break;
      case DLL_THREAD_ATTACH:
      break;
      case DLL_THREAD_DETACH:
      break;
      case DLL_PROCESS_DETACH:
      break;
    }

    return TRUE;
}

STDAPI DllRegisterServer ( void )

Definition at line 48 of file Dog.Cpp.

{
    return S_OK;
}

STDAPI DllUnregisterServer ( void )

Definition at line 53 of file Dog.Cpp.

{
    return S_OK;
}

Variable Documentation

LONG g_cLocks

Definition at line 22 of file Dog.Cpp.

LONG g_cObjects

Definition at line 23 of file Dog.Cpp.

HINSTANCE g_hInst

Definition at line 24 of file Dog.Cpp.

Generated on Wed Nov 13 2024 16:53:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/CustomSurrogate/Dog/Dogcf.Cpp File Reference

  • Com
  • Fundamentals
  • CustomSurrogate
  • Dog
Functions

Dogcf.Cpp File Reference

#include <windows.h>
#include "dogcf.h"
#include "cdog.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CClassFactory

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 43 of file Dogcf.Cpp.

{
    if(InterlockedDecrement(&m_cRef) == 0)
    {
        delete this;
        return 0;
    }
    return m_cRef;
}

Generated on Wed Nov 13 2024 16:53:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/CustomSurrogate/Dog/Dogcf.h File Reference

  • Com
  • Fundamentals
  • CustomSurrogate
  • Dog
Classes | Variables

Dogcf.h File Reference

Go to the source code of this file.

Classes

class | CClassFactory

Variables

LONG | g_cObjects

Variable Documentation

LONG g_cObjects

Definition at line 23 of file Dog.Cpp.

Generated on Wed Nov 13 2024 16:53:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/CustomSurrogate/Dog/iDog.Cpp File Reference

  • Com
  • Fundamentals
  • CustomSurrogate
  • Dog
Functions

iDog.Cpp File Reference

#include <windows.h>
#include "idog_i.c"
#include "cdog.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CDog

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 48 of file iDog.Cpp.

{
    if(InterlockedDecrement(&m_cRef) == 0)
    {
        delete this;
        return 0;
    }
    return m_cRef;
}

Generated on Wed Nov 13 2024 16:53:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/CustomSurrogate/Dog/iDog.Idl File Reference

  • Com
  • Fundamentals
  • CustomSurrogate
  • Dog
Functions

iDog.Idl File Reference

Go to the source code of this file.

Functions

HRESULT | Bark ()
importlib ("stdole2.tlb")
library DogObjectLib | importlib ("stdole32.tlb")
HRESULT | Scratch ()

Function Documentation

HRESULT Bark ( )
importlib ( "stdole2.tlb" )
library DogObjectLib importlib ( "stdole32.tlb" )
HRESULT Scratch ( )
Generated on Wed Nov 13 2024 16:53:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/CustomSurrogate/Surrog/cfWrap.Cpp File Reference

  • Com
  • Fundamentals
  • CustomSurrogate
  • Surrog
Functions

cfWrap.Cpp File Reference

#include "common.h"
#include "cfwrap.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CClassFactoryWrapper

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 65 of file cfWrap.Cpp.

{
  ULONG result = InterlockedDecrement(&m_cRef);
  if (!result)
    delete this;
  return result;
}

Generated on Wed Nov 13 2024 16:53:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/CustomSurrogate/Surrog/cfWrap.h File Reference

  • Com
  • Fundamentals
  • CustomSurrogate
  • Surrog
Classes

cfWrap.h File Reference

Go to the source code of this file.

Classes

class CClassFactoryWrapper
Generated on Wed Nov 13 2024 16:53:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/CustomSurrogate/Surrog/Common.h File Reference

  • Com
  • Fundamentals
  • CustomSurrogate
  • Surrog
Defines | Variables

Common.h File Reference

#include <windows.h>
#include <assert.h>

Go to the source code of this file.

Defines

#define | _WIN32_WINNT 0x0402
#define | MAX_GUIDSTR_LEN 40

Variables

const CHAR | szAppidValueName [] = "AppID"
const CHAR | szClsidKeyName [] = "CLSID"

Define Documentation

#define _WIN32_WINNT 0x0402

Definition at line 19 of file Common.h.

#define MAX_GUIDSTR_LEN 40

Definition at line 25 of file Common.h.

Variable Documentation

const CHAR szAppidValueName[] = "AppID"

Definition at line 28 of file Common.h.

const CHAR szClsidKeyName[] = "CLSID"

Definition at line 27 of file Common.h.

Generated on Wed Nov 13 2024 16:53:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/CustomSurrogate/Surrog/csur.Cpp File Reference

  • Com
  • Fundamentals
  • CustomSurrogate
  • Surrog
Functions

csur.Cpp File Reference

#include "common.h"
#include "csur.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CSurrogate

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 64 of file csur.Cpp.

{
  return 1;
}

Generated on Wed Nov 13 2024 16:53:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/CustomSurrogate/Surrog/csur.h File Reference

  • Com
  • Fundamentals
  • CustomSurrogate
  • Surrog
Classes

csur.h File Reference

#include <stack>
#include "cfwrap.h"

Go to the source code of this file.

Classes

class CSurrogate
Generated on Wed Nov 13 2024 16:53:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/CustomSurrogate/Surrog/custsur.Cpp File Reference

  • Com
  • Fundamentals
  • CustomSurrogate
  • Surrog
Functions

custsur.Cpp File Reference

#include "common.h"
#include "csur.h"

Go to the source code of this file.

Functions

HRESULT | GetAppIDFromClsid (LPSTR szClsid, IID &AppID)
int WINAPI | WinMain (HINSTANCE, HINSTANCE, LPSTR szCmdParam, int)

Function Documentation

HRESULT GetAppIDFromClsid | ( | LPSTR | szClsid,
 |  | IID & | AppID
 | ) |  |

Definition at line 110 of file custsur.Cpp.

{
    HKEY hkHKCR_CLSID = NULL;
    HKEY hkObjClsid = NULL;
    CHAR szAppid[MAX_GUIDSTR_LEN + 1];
    WCHAR wszAppid[MAX_GUIDSTR_LEN + 1];
    DWORD dwAppidSize = sizeof(szAppid);
    HRESULT hr = E_FAIL;

    // open HKEY_CLASSES_ROOT/CLSID
    if(RegOpenKeyExA(HKEY_CLASSES_ROOT, szClsidKeyName, 0, KEY_READ, &hkHKCR_CLSID) != ERROR_SUCCESS)
    return FALSE;

    // open the key for the requested CLSID
    if(RegOpenKeyExA(hkHKCR_CLSID, szClsid, 0, KEY_READ,  &hkObjClsid) != ERROR_SUCCESS)
    goto cleanup_and_exit;

    // read the appid value
    if(RegQueryValueExA(hkObjClsid, szAppidValueName, NULL, NULL, (LPBYTE)szAppid, &dwAppidSize) != ERROR_SUCCESS)
    goto cleanup_and_exit;

    // we're done with the registry, close the keys
    RegCloseKey(hkObjClsid);
    hkObjClsid = NULL;

    RegCloseKey(hkHKCR_CLSID);
    hkHKCR_CLSID = NULL;

    // now convert the appid string from the registry into
    // a unicode string
    if(!(MultiByteToWideChar(CP_ACP, 0, szAppid, lstrlenA(szAppid) + 1, wszAppid, MAX_GUIDSTR_LEN + 1)))
    goto cleanup_and_exit;

  // use the unicode appid string to create a guid
    hr = IIDFromString(wszAppid,&AppID);

    if(FAILED(hr))
    goto cleanup_and_exit;

  // couldn't find the security descriptor so return "file not found".
    if(hr == MAKE_SCODE(SEVERITY_ERROR, FACILITY_WIN32, ERROR_FILE_NOT_FOUND))
    hr = S_OK;

cleanup_and_exit:

    // close open keys
    if(hkObjClsid)
    RegCloseKey(hkObjClsid);

    if(hkHKCR_CLSID)
    RegCloseKey(hkHKCR_CLSID);

    return hr;

}

int WINAPI WinMain | ( | HINSTANCE | ,
 |  | HINSTANCE | ,
 |  | LPSTR | szCmdParam,
 |  | int |
 | ) |  |

Definition at line 42 of file custsur.Cpp.

{
  // 1. register with COM as STA
  //
  // Note: when initializing OLE as COINIT_MULTITHREADED, use a semaphore or
  // other mechanism to convey termination condition for WinMain() instead of
  // PostQuitMessage(0) in the ISurrogate::FreeSurrogate() call.  WinMain() will
  // be called on a different thread from the surrogate object and PostQuitMessage()
  // will only terminate the surrogate object thread, not WinMain()'s.
  HRESULT hr = CoInitializeEx(0, COINIT_APARTMENTTHREADED);
  assert(hr == S_OK);

  OutputDebugString("CoInitializeEx() called.");

  // 2. get the AppID associated with the requested CLSID and initialize security
  // based on it.
  IID appid;

  CHAR szCLSID[39];
  strncpy(szCLSID, szCmdParam, 39);
  szCLSID[38] = 0;
  hr = GetAppIDFromClsid(szCLSID, appid);

  assert(hr == S_OK);

    hr = CoInitializeSecurity((PSECURITY_DESCRIPTOR*)&appid,
                  -1, NULL, NULL, 0, 0, NULL, EOAC_APPID, NULL);
  assert(hr == S_OK);

  OutputDebugString("CoInitializeSecurity() called.");

  // 3. register the surrogate object
  CSurrogate sur;
  hr = CoRegisterSurrogate(&sur);
  assert(hr == S_OK);
  OutputDebugString("CoRegisterSurrogate() called.");

  // 4. we were passed the clsid for whom this surrogate exe was loaded by SCM
  // we now need to explicitly call ISurrogate::LoadDllServer() on that clsid
  OLECHAR wszGUID[39];
  mbstowcs(wszGUID, szCmdParam, 39);
  wszGUID[38]=0;
  CLSID clsid;
  hr = CLSIDFromString(wszGUID, &clsid);
  assert(hr == S_OK);

  hr = sur.LoadDllServer(clsid);
  assert(hr == S_OK);

  OutputDebugString("LoadDllServer() called.");

  // 5. the message pump: we can do custom behaviour here, too.

  MSG msg;

  while (GetMessage(&msg, 0, 0, 0))
    DispatchMessage(&msg);

  // 6. Uninitialize COM libraries and return.
  CoUninitialize();
  OutputDebugString("CoUninitialize() called.");
  return 0;

}

Generated on Wed Nov 13 2024 16:53:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/Cancel/Client/Cancel.Cpp File Reference

  • Com
  • Fundamentals
  • DCom
  • Cancel
  • Client
Classes | Defines | Typedefs | Functions | Variables

Cancel.Cpp File Reference

#include <Windows.h>
#include <WindowsX.h>
#include <stdio.h>
#include <tchar.h>
#include <initguid.h>
#include "Resource.h"

Go to the source code of this file.

Classes

struct | params

Defines

#define | _WIN32_WINNT 0x0400
#define | STRICT

Typedefs

typedef struct params | PARAMS

Functions

INT_PTR WINAPI | CANCEL_DlgProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
void | CANCEL_OnCommand (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
BOOL | CANCEL_OnInitDialog (HWND hwnd, HWND hwndFocus, LPARAM lParam)
void | CANCEL_OnTimer (HWND hwnd, UINT nID)
DEFINE_GUID (CLSID_STACancelObject, 0x37824811, 0xadba, 0x11d1, 0xb6, 0xfb, 0x0, 0xa0, 0x24, 0xa8, 0x5a, 0x1f)
DEFINE_GUID (CLSID_NoneCancelObject, 0x37824810, 0xadba, 0x11d1, 0xb6, 0xfb, 0x0, 0xa0, 0x24, 0xa8, 0x5a, 0x1f)
DEFINE_GUID (CLSID_MTACancelObject, 0x37824812, 0xadba, 0x11d1, 0xb6, 0xfb, 0x0, 0xa0, 0x24, 0xa8, 0x5a, 0x1f)
void | Message (LPTSTR szPrefix, HRESULT hr)
DWORD WINAPI | PrimarySTAThreadProc (LPVOID lp)
DWORD WINAPI | ThreadProc (LPVOID lp)
int WINAPI | WinMain (HINSTANCE hinstExe, HINSTANCE hinstExePrev, LPSTR pszCmdLine, int nCmdShow)

Variables

HANDLE g_NotifyPrimarySTAEvent
HWND | hWndDialog

Define Documentation

#define _WIN32_WINNT 0x0400

Definition at line 17 of file Cancel.Cpp.

#define STRICT

Definition at line 18 of file Cancel.Cpp.

Typedef Documentation

typedef struct params PARAMS

Function Documentation

INT_PTR WINAPI CANCEL_DlgProc | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 442 of file Cancel.Cpp.

                                                                                {
   switch (uMsg) {
      HANDLE_MSG(hwnd, WM_INITDIALOG, CANCEL_OnInitDialog);
      HANDLE_MSG(hwnd, WM_COMMAND, CANCEL_OnCommand);
      HANDLE_MSG(hwnd, WM_TIMER, CANCEL_OnTimer);
   }
   return(FALSE);
}

void CANCEL_OnCommand | ( | HWND | hwnd,
 |  | int | id,
 |  | HWND | hwndCtl,
 |  | UINT | codeNotify
 | ) |  |

Definition at line 244 of file Cancel.Cpp.

                                          {

  UNREFERENCED_PARAMETER(codeNotify);
  UNREFERENCED_PARAMETER(hwndCtl);
  static DWORD dwInProcSTA2STA;
  HANDLE hInProcSTA2STA;
  static DWORD dwInProcSTA2MTA;
  HANDLE hInProcSTA2MTA;
  static DWORD dwInProcMTA2STA;
  HANDLE hInProcMTA2STA;

  static DWORD dwOutProcSTA2STA;
  HANDLE hOutProcSTA2STA;
  static DWORD dwOutProcSTA2MTA;
  HANDLE hOutProcSTA2MTA;
  static DWORD dwOutProcMTA2STA;
  HANDLE hOutProcMTA2STA;
  static DWORD dwOutProcMTA2MTA;
  HANDLE hOutProcMTA2MTA;

  static PARAMS p;
  HRESULT hr;

  switch (id) {
  case IDC_INPROC_STA2STA:
    p.bInProcess = TRUE;
    p.dwThreadType = COINIT_APARTMENTTHREADED;
    p.dwObjectType = 0;
    hInProcSTA2STA = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)ThreadProc,(LPVOID)&p, 0,
      &dwInProcSTA2STA);
    if (!hInProcSTA2STA)
    {
      Message(TEXT("CreateThread"), GetLastError());
    }
    else
      CloseHandle(hInProcSTA2STA);
    break;
  case IDC_INPROC_STA2MTA:
    p.bInProcess = TRUE;
    p.dwThreadType = COINIT_APARTMENTTHREADED;
    p.dwObjectType = 2;
    hInProcSTA2MTA = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)ThreadProc,(LPVOID)&p, 0,
      &dwInProcSTA2MTA);
    if (!hInProcSTA2MTA)
    {
      Message(TEXT("CreateThread"),  GetLastError());
    }
    else
      CloseHandle(hInProcSTA2MTA);
    break;
  case IDC_INPROC_MTA2STA:
    p.bInProcess = TRUE;
    p.dwThreadType = COINIT_MULTITHREADED;
    p.dwObjectType = 1;
    hInProcMTA2STA = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)ThreadProc,(LPVOID)&p, 0,
      &dwInProcMTA2STA);
    if (!hInProcMTA2STA)
    {
      Message(TEXT("CreateThread"),  GetLastError());
    }
    else
      CloseHandle(hInProcMTA2STA);
    break;
  case IDC_OUTPROC_STA2STA:
    p.bInProcess = FALSE;
    p.dwThreadType = COINIT_APARTMENTTHREADED;
    p.dwObjectType = 0;
    GetDlgItemText(hwnd, IDC_MACHINE, p.szMachine, sizeof(p.szMachine));
    hOutProcSTA2STA = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)ThreadProc,(LPVOID)&p, 0,
      &dwOutProcSTA2STA);
    if (!hOutProcSTA2STA)
    {
      Message(TEXT("CreateThread"),  GetLastError());
    }
    else
      CloseHandle(hOutProcSTA2STA);
    break;
  case IDC_OUTPROC_STA2MTA:
    p.bInProcess = FALSE;
    p.dwThreadType = COINIT_APARTMENTTHREADED;
    p.dwObjectType = 1;
    GetDlgItemText(hwnd, IDC_MACHINE, p.szMachine, sizeof(p.szMachine));
    hOutProcSTA2MTA = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)ThreadProc,(LPVOID)&p, 0,
      &dwOutProcSTA2MTA);
    if (!hOutProcSTA2MTA)
    {
      Message(TEXT("CreateThread"), GetLastError());
    }
    else
      CloseHandle(hOutProcSTA2MTA);
    break;
  case IDC_OUTPROC_MTA2STA:
    p.bInProcess = FALSE;
    p.dwThreadType = COINIT_MULTITHREADED;
    p.dwObjectType = 0;
    GetDlgItemText(hwnd, IDC_MACHINE, p.szMachine, sizeof(p.szMachine));
    hOutProcMTA2STA = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)ThreadProc,(LPVOID)&p, 0,
      &dwOutProcMTA2STA);
    if (!hOutProcMTA2STA)
    {
      Message(TEXT("CreateThread"), GetLastError());
    }
    else
      CloseHandle(hOutProcMTA2STA);
    break;
  case IDC_OUTPROC_MTA2MTA:
    p.bInProcess = FALSE;
    p.dwThreadType = COINIT_MULTITHREADED;
    p.dwObjectType = 1;
    GetDlgItemText(hwnd, IDC_MACHINE, p.szMachine, sizeof(p.szMachine));
    hOutProcMTA2MTA = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)ThreadProc,(LPVOID)&p, 0,
      &dwOutProcMTA2MTA);
    if (!hOutProcMTA2MTA)
    {
      Message(TEXT("CreateThread"), GetLastError());
    }
    else
      CloseHandle(hOutProcMTA2MTA);
    break;
  case IDC_INPROC_STA2STA_CANCELACT:
  case IDC_INPROC_STA2STA_CANCELCALL:
    hr = CoCancelCall(dwInProcSTA2STA, 0);
    if (FAILED(hr))
        {
      Message(TEXT("CoCancelCall"), hr);
      return;
        }
    break;
  case IDC_INPROC_STA2MTA_CANCELACT:
  case IDC_INPROC_STA2MTA_CANCELCALL:
    hr = CoCancelCall(dwInProcSTA2MTA, 0);
    if (FAILED(hr))
        {
      Message(TEXT("CoCancelCall"), hr);
      return;
        }

    break;
  case IDC_INPROC_MTA2STA_CANCELACT:
  case IDC_INPROC_MTA2STA_CANCELCALL:
    hr = CoCancelCall(dwInProcMTA2STA, 0);
    if (FAILED(hr))
        {
      Message(TEXT("CoCancelCall"), hr);
      return;
        }
    break;
  case IDC_OUTPROC_STA2STA_CANCELACT:
  case IDC_OUTPROC_STA2STA_CANCELCALL:
    hr = CoCancelCall(dwOutProcSTA2STA, 0);
    if (FAILED(hr))
        {
      Message(TEXT("CoCancelCall"), hr);
      return;
        }
    break;
  case IDC_OUTPROC_STA2MTA_CANCELACT:
  case IDC_OUTPROC_STA2MTA_CANCELCALL:
    hr = CoCancelCall(dwOutProcSTA2MTA, 0);
    if (FAILED(hr))
        {
      Message(TEXT("CoCancelCall"), hr);
      return;
        }
    break;
  case IDC_OUTPROC_MTA2STA_CANCELACT:
  case IDC_OUTPROC_MTA2STA_CANCELCALL:
    hr = CoCancelCall(dwOutProcMTA2STA, 0);
    if (FAILED(hr))
        {
      Message(TEXT("CoCancelCall"), hr);
      return;
        }
    break;
  case IDC_OUTPROC_MTA2MTA_CANCELACT:
  case IDC_OUTPROC_MTA2MTA_CANCELCALL:
    hr = CoCancelCall(dwOutProcMTA2MTA, 0);
    if (FAILED(hr))
        {
      Message(TEXT("CoCancelCall"), hr);
      return;
        }
    break;

  case IDCANCEL:
      // If the Escape key is hit, destroy the modeless
      // dialog box, terminating the application.
      DestroyWindow(hwnd);
      break;

   }
}

BOOL CANCEL_OnInitDialog | ( | HWND | hwnd,
 |  | HWND | hwndFocus,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 220 of file Cancel.Cpp.

                                  {
  UNREFERENCED_PARAMETER(lParam);
  UNREFERENCED_PARAMETER(hwndFocus);
  hWndDialog = hwnd;
  EnableWindow(GetDlgItem(hwnd, IDC_INPROC_STA2STA_CANCELACT), FALSE);
  EnableWindow(GetDlgItem(hwnd, IDC_INPROC_STA2STA_CANCELCALL), FALSE);
  EnableWindow(GetDlgItem(hwnd, IDC_INPROC_STA2MTA_CANCELACT), FALSE);
  EnableWindow(GetDlgItem(hwnd, IDC_INPROC_STA2MTA_CANCELCALL), FALSE);
  EnableWindow(GetDlgItem(hwnd, IDC_INPROC_MTA2STA_CANCELACT), FALSE);
  EnableWindow(GetDlgItem(hwnd, IDC_INPROC_MTA2STA_CANCELCALL), FALSE);
  EnableWindow(GetDlgItem(hwnd, IDC_OUTPROC_STA2STA_CANCELACT), FALSE);
  EnableWindow(GetDlgItem(hwnd, IDC_OUTPROC_STA2MTA_CANCELACT), FALSE);
  EnableWindow(GetDlgItem(hwnd, IDC_OUTPROC_MTA2STA_CANCELACT), FALSE);
  EnableWindow(GetDlgItem(hwnd, IDC_OUTPROC_MTA2MTA_CANCELACT), FALSE);
  EnableWindow(GetDlgItem(hwnd, IDC_OUTPROC_STA2STA_CANCELCALL), FALSE);
  EnableWindow(GetDlgItem(hwnd, IDC_OUTPROC_STA2MTA_CANCELCALL), FALSE);
  EnableWindow(GetDlgItem(hwnd, IDC_OUTPROC_MTA2STA_CANCELCALL), FALSE);
  EnableWindow(GetDlgItem(hwnd, IDC_OUTPROC_MTA2MTA_CANCELCALL), FALSE);
  SetTimer(hwnd, 1, 5000, NULL);
  return(TRUE);
}

void CANCEL_OnTimer | ( | HWND | hwnd,
 |  | UINT | nID
 | ) |  |

Definition at line 210 of file Cancel.Cpp.

{
  UNREFERENCED_PARAMETER(hwnd);
  UNREFERENCED_PARAMETER(nID);
  CoFreeUnusedLibraries();
}

DEFINE_GUID | ( | CLSID_STACancelObject | ,
 |  | 0x37824811 | ,
 |  | 0xadba | ,
 |  | 0x11d1 | ,
 |  | 0xb6 | ,
 |  | 0xfb | ,
 |  | 0x0 | ,
 |  | 0xa0 | ,
 |  | 0x24 | ,
 |  | 0xa8 | ,
 |  | 0x5a | ,
 |  | 0x1f |
 | ) |  |
DEFINE_GUID | ( | CLSID_NoneCancelObject | ,
 |  | 0x37824810 | ,
 |  | 0xadba | ,
 |  | 0x11d1 | ,
 |  | 0xb6 | ,
 |  | 0xfb | ,
 |  | 0x0 | ,
 |  | 0xa0 | ,
 |  | 0x24 | ,
 |  | 0xa8 | ,
 |  | 0x5a | ,
 |  | 0x1f |
 | ) |  |
DEFINE_GUID | ( | CLSID_MTACancelObject | ,
 |  | 0x37824812 | ,
 |  | 0xadba | ,
 |  | 0x11d1 | ,
 |  | 0xb6 | ,
 |  | 0xfb | ,
 |  | 0x0 | ,
 |  | 0xa0 | ,
 |  | 0x24 | ,
 |  | 0xa8 | ,
 |  | 0x5a | ,
 |  | 0x1f |
 | ) |  |
void Message | ( | LPTSTR | szPrefix,
 |  | HRESULT | hr
 | ) |  |

Definition at line 51 of file Cancel.Cpp.

{
    LPTSTR   szMessage;
  TCHAR szDisplay[1000];

    if (hr == S_OK)
        {
    _stprintf(szDisplay, TEXT("%s"), szPrefix);
    MessageBox(hWndDialog, szDisplay, TEXT("Msg"),0);
        return;
        }

    if (HRESULT_FACILITY(hr) == FACILITY_WIN32)
        hr = HRESULT_CODE(hr);

    FormatMessage(
        FORMAT_MESSAGE_ALLOCATE_BUFFER |
        FORMAT_MESSAGE_FROM_SYSTEM,
        NULL,
        hr,
        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), //The user default language
        (LPTSTR)&szMessage,
        0,
        NULL );

    _stprintf(szDisplay, TEXT("%s: %s(%lx)"), szPrefix, szMessage, hr);
  MessageBox(hWndDialog, szDisplay, TEXT("Msg"),0);
    LocalFree(szMessage);
}  // Message

DWORD WINAPI PrimarySTAThreadProc ( LPVOID lp )

Definition at line 452 of file Cancel.Cpp.

{
  UNREFERENCED_PARAMETER(lp);
    HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
  if FAILED(hr)
  {
    Message(TEXT("CoInitializeEx"), hr);
    return hr;
  }
  SetEvent(g_NotifyPrimarySTAEvent);

  MSG msg;
  while (true==true)
  {
    if (WaitForSingleObject(g_NotifyPrimarySTAEvent, 0) == WAIT_OBJECT_0)
    {
      break;
    }
    if (PeekMessage(&msg, NULL, NULL, NULL, PM_REMOVE))
    {
      TranslateMessage(&msg);
      DispatchMessage(&msg);
    }
  }
  CoUninitialize();
    return hr;
}

DWORD WINAPI ThreadProc ( LPVOID lp )

Definition at line 82 of file Cancel.Cpp.

{
    MULTI_QI    mq;
    COSERVERINFO csi, *pcsi=NULL;
  HRESULT hr = S_OK;
  IPersist *pPersist = NULL;
  HWND hwnd1=NULL, hwnd2=NULL, hwnd3=NULL;
  DWORD dwCls;
  PARAMS p = *(PARAMS*)lp;
  CLSID clsid;

        if (p.bInProcess)
  {
    if (COINIT_APARTMENTTHREADED == p.dwThreadType && (p.dwObjectType == 0))
    {
      hwnd1 = GetDlgItem(hWndDialog, IDC_INPROC_STA2STA);
      hwnd2 = GetDlgItem(hWndDialog, IDC_INPROC_STA2STA_CANCELACT);
      hwnd3 = GetDlgItem(hWndDialog, IDC_INPROC_STA2STA_CANCELCALL);
    }
    else if (COINIT_APARTMENTTHREADED == p.dwThreadType && (p.dwObjectType == 2))
    {
      hwnd1 = GetDlgItem(hWndDialog, IDC_INPROC_STA2MTA);
      hwnd2 = GetDlgItem(hWndDialog, IDC_INPROC_STA2MTA_CANCELACT);
      hwnd3 = GetDlgItem(hWndDialog, IDC_INPROC_STA2MTA_CANCELCALL);

    }
    else if (COINIT_MULTITHREADED == p.dwThreadType && (p.dwObjectType == 1))
    {
      hwnd1 = GetDlgItem(hWndDialog, IDC_INPROC_MTA2STA);
      hwnd2 = GetDlgItem(hWndDialog, IDC_INPROC_MTA2STA_CANCELACT);
      hwnd3 = GetDlgItem(hWndDialog, IDC_INPROC_MTA2STA_CANCELCALL);
    }
    dwCls = CLSCTX_INPROC_SERVER;
    clsid = (p.dwObjectType == 0) ? CLSID_NoneCancelObject:
        ((p.dwObjectType == 2) ? CLSID_MTACancelObject:CLSID_STACancelObject);
  }
  else
  {
    if (COINIT_APARTMENTTHREADED == p.dwThreadType && !(p.dwObjectType))
    {
      hwnd1 = GetDlgItem(hWndDialog, IDC_OUTPROC_STA2STA);
      hwnd2 = GetDlgItem(hWndDialog, IDC_OUTPROC_STA2STA_CANCELACT);
      hwnd3 = GetDlgItem(hWndDialog, IDC_OUTPROC_STA2STA_CANCELCALL);

    }
    else if (COINIT_APARTMENTTHREADED == p.dwThreadType && (p.dwObjectType))
    {
      hwnd1 = GetDlgItem(hWndDialog, IDC_OUTPROC_STA2MTA);
      hwnd2 = GetDlgItem(hWndDialog, IDC_OUTPROC_STA2MTA_CANCELACT);
      hwnd3 = GetDlgItem(hWndDialog, IDC_OUTPROC_STA2MTA_CANCELCALL);

    }
    else if (COINIT_MULTITHREADED == p.dwThreadType && !(p.dwObjectType))
    {
      hwnd1 = GetDlgItem(hWndDialog, IDC_OUTPROC_MTA2STA);
      hwnd2 = GetDlgItem(hWndDialog, IDC_OUTPROC_MTA2STA_CANCELACT);
      hwnd3 = GetDlgItem(hWndDialog, IDC_OUTPROC_MTA2STA_CANCELCALL);
    }
    else if (COINIT_MULTITHREADED == p.dwThreadType && (p.dwObjectType))
    {
      hwnd1 = GetDlgItem(hWndDialog, IDC_OUTPROC_MTA2MTA);
      hwnd2 = GetDlgItem(hWndDialog, IDC_OUTPROC_MTA2MTA_CANCELACT);
      hwnd3 = GetDlgItem(hWndDialog, IDC_OUTPROC_MTA2MTA_CANCELCALL);

    }
    if (lstrlen(p.szMachine))
    {
      memset(&csi, 0, sizeof(COSERVERINFO));
      csi.pwszName = p.szMachine;
      pcsi = &csi;
    }
    dwCls = CLSCTX_LOCAL_SERVER;
    clsid = (p.dwObjectType) ? CLSID_MTACancelObject:CLSID_STACancelObject;
  }

  EnableWindow(hwnd1, FALSE);
  CoInitializeEx(NULL, p.dwThreadType);
  if FAILED(hr)
  {
    Message(TEXT("CoInitializeEx"), hr);
    goto cleanup;
  }

        hr = CoEnableCallCancellation(NULL);
  if FAILED(hr)
  {
    Message(TEXT("CoEnableCallCancellation"), hr);
    goto cleanup;
  }

        mq.pIID = &IID_IPersist;
  mq.pItf = NULL;
  mq.hr = S_OK;

  EnableWindow(hwnd2, TRUE);
  hr = CoCreateInstanceEx(clsid, NULL, dwCls, pcsi, 1, &mq);
  if FAILED(hr)
  {
    Message(TEXT("CoCreateInstanceEx"), hr);
    goto cleanup;
  }

  EnableWindow(hwnd2, FALSE);
  pPersist = (IPersist*)mq.pItf;

  if (!pPersist)
    goto cleanup;
  EnableWindow(hwnd3, TRUE);
  hr = pPersist->GetClassID(&clsid);
  if FAILED(hr)
  {
    Message(TEXT("Method"), hr);
    goto cleanup;
  }
  EnableWindow(hwnd3, FALSE);
  pPersist->Release();

        CoDisableCallCancellation(NULL);
  CoUninitialize();
cleanup:
  EnableWindow(hwnd1, TRUE);
  EnableWindow(hwnd2, FALSE);
  EnableWindow(hwnd3, FALSE);
  return hr;
}

int WINAPI WinMain | ( | HINSTANCE | hinstExe,
 |  | HINSTANCE | hinstExePrev,
 |  | LPSTR | pszCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 486 of file Cancel.Cpp.

                                                           {

  UNREFERENCED_PARAMETER(nCmdShow);
  UNREFERENCED_PARAMETER(pszCmdLine);
  UNREFERENCED_PARAMETER(hinstExePrev);
  g_NotifyPrimarySTAEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
  if (g_NotifyPrimarySTAEvent == NULL)
  {
    Message(TEXT("CreateEvent"), GetLastError());
    return -1;
  }
  DWORD dwPrimarySTA;
  HANDLE hPrimarySTA = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)PrimarySTAThreadProc,NULL, 0,
    &dwPrimarySTA);
  if (!hPrimarySTA)
  {
    Message(TEXT("CreateThread"), GetLastError());
    return -1;
  }
  WaitForSingleObject(g_NotifyPrimarySTAEvent, INFINITE);

  HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
  if FAILED(hr)
  {
    Message(TEXT("CoInitializeEx"), hr);
    return hr;
  }
  hr = CoInitializeSecurity( NULL, -1, NULL, NULL,
    RPC_C_AUTHN_LEVEL_NONE, RPC_C_IMP_LEVEL_IDENTIFY,
    NULL, EOAC_NONE, NULL );
    if (FAILED(hr))
        {
        Message(TEXT("CoInitializeSecurity"), hr);
        return hr;
        }

  // Create the appication's UI window
  DialogBox(hinstExe,
      MAKEINTRESOURCE(IDD_CANCEL_DIALOG), NULL, CANCEL_DlgProc);
  SetEvent(g_NotifyPrimarySTAEvent);
  WaitForSingleObject(hPrimarySTA, INFINITE);
  CloseHandle(hPrimarySTA);
  CoUninitialize();
    return(0);  // End the application
}

Variable Documentation

HANDLE g_NotifyPrimarySTAEvent

Definition at line 37 of file Cancel.Cpp.

HWND hWndDialog

Definition at line 27 of file Cancel.Cpp.

Generated on Wed Nov 13 2024 16:53:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/Cancel/Client/Resource.h File Reference

  • Com
  • Fundamentals
  • DCom
  • Cancel
  • Client
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_INPROC_MTA2STA 1021
#define | IDC_INPROC_MTA2STA_CANCELACT 1024
#define | IDC_INPROC_MTA2STA_CANCELCALL 1025
#define | IDC_INPROC_STA2MTA 1019
#define | IDC_INPROC_STA2MTA_CANCELACT 1022
#define | IDC_INPROC_STA2MTA_CANCELCALL 1023
#define | IDC_INPROC_STA2STA 1038
#define | IDC_INPROC_STA2STA_CANCELACT 1039
#define | IDC_INPROC_STA2STA_CANCELCALL 1040
#define | IDC_MACHINE 1037
#define | IDC_OUTPROC_MTA2MTA 1032
#define | IDC_OUTPROC_MTA2MTA_CANCELACT 1035
#define | IDC_OUTPROC_MTA2MTA_CANCELCALL 1036
#define | IDC_OUTPROC_MTA2STA 1031
#define | IDC_OUTPROC_MTA2STA_CANCELACT 1033
#define | IDC_OUTPROC_MTA2STA_CANCELCALL 1034
#define | IDC_OUTPROC_STA2MTA 1026
#define | IDC_OUTPROC_STA2MTA_CANCELACT 1029
#define | IDC_OUTPROC_STA2MTA_CANCELCALL 1030
#define | IDC_OUTPROC_STA2STA 1020
#define | IDC_OUTPROC_STA2STA_CANCELACT 1027
#define | IDC_OUTPROC_STA2STA_CANCELCALL 1028
#define | IDD_CANCEL_DIALOG 101

Define Documentation

#define IDC_INPROC_MTA2STA 1021

Definition at line 20 of file Resource.h.

#define IDC_INPROC_MTA2STA_CANCELACT 1024

Definition at line 23 of file Resource.h.

#define IDC_INPROC_MTA2STA_CANCELCALL 1025

Definition at line 24 of file Resource.h.

#define IDC_INPROC_STA2MTA 1019

Definition at line 18 of file Resource.h.

#define IDC_INPROC_STA2MTA_CANCELACT 1022

Definition at line 21 of file Resource.h.

#define IDC_INPROC_STA2MTA_CANCELCALL 1023

Definition at line 22 of file Resource.h.

#define IDC_INPROC_STA2STA 1038

Definition at line 37 of file Resource.h.

#define IDC_INPROC_STA2STA_CANCELACT 1039

Definition at line 38 of file Resource.h.

#define IDC_INPROC_STA2STA_CANCELCALL 1040

Definition at line 39 of file Resource.h.

#define IDC_MACHINE 1037

Definition at line 36 of file Resource.h.

#define IDC_OUTPROC_MTA2MTA 1032

Definition at line 31 of file Resource.h.

#define IDC_OUTPROC_MTA2MTA_CANCELACT 1035

Definition at line 34 of file Resource.h.

#define IDC_OUTPROC_MTA2MTA_CANCELCALL 1036

Definition at line 35 of file Resource.h.

#define IDC_OUTPROC_MTA2STA 1031

Definition at line 30 of file Resource.h.

#define IDC_OUTPROC_MTA2STA_CANCELACT 1033

Definition at line 32 of file Resource.h.

#define IDC_OUTPROC_MTA2STA_CANCELCALL 1034

Definition at line 33 of file Resource.h.

#define IDC_OUTPROC_STA2MTA 1026

Definition at line 25 of file Resource.h.

#define IDC_OUTPROC_STA2MTA_CANCELACT 1029

Definition at line 28 of file Resource.h.

#define IDC_OUTPROC_STA2MTA_CANCELCALL 1030

Definition at line 29 of file Resource.h.

#define IDC_OUTPROC_STA2STA 1020

Definition at line 19 of file Resource.h.

#define IDC_OUTPROC_STA2STA_CANCELACT 1027

Definition at line 26 of file Resource.h.

#define IDC_OUTPROC_STA2STA_CANCELCALL 1028

Definition at line 27 of file Resource.h.

#define IDD_CANCEL_DIALOG 101

Definition at line 17 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/Cancel/InProc/SServer.Cpp File Reference

  • Com
  • Fundamentals
  • DCom
  • Cancel
  • InProc
Classes | Defines | Typedefs | Functions | Variables

SServer.Cpp File Reference

#include <stdio.h>
#include <tchar.h>
#include <windows.h>
#include <WindowsX.h>
#include <initguid.h>

Go to the source code of this file.

Classes

class | CClassFactory
class | CSimpleObject
struct | tagCONSOLEDATA

Defines

#define | _WIN32_WINNT 0x0400

Typedefs

typedef struct tagCONSOLEDATA | CONSOLEDATA

Functions

STDMETHODIMP | Busy (HANDLE hConsole, COORD &xy, int nIter)
DEFINE_GUID (CLSID_STACancelObject, 0x37824811, 0xadba, 0x11d1, 0xb6, 0xfb, 0x0, 0xa0, 0x24, 0xa8, 0x5a, 0x1f)
DEFINE_GUID (CLSID_NoneCancelObject, 0x37824810, 0xadba, 0x11d1, 0xb6, 0xfb, 0x0, 0xa0, 0x24, 0xa8, 0x5a, 0x1f)
DEFINE_GUID (CLSID_MTACancelObject, 0x37824812, 0xadba, 0x11d1, 0xb6, 0xfb, 0x0, 0xa0, 0x24, 0xa8, 0x5a, 0x1f)
STDAPI | DllCanUnloadNow ()
STDAPI | DllGetClassObject (const CLSID &clsid, const IID &iid, void **ppv)
BOOL WINAPI | DllMain (HINSTANCE hDLLInst, DWORD fdwReason, LPVOID lpvReserved)
void | Message (LPTSTR szPrefix, HRESULT hr)

Variables

CClassFactory g_ClassFactory
CONSOLEDATA g_ConsoleData
long | g_Count
CRITICAL_SECTION | g_cs
HINSTANCE | g_hInstance

Define Documentation

#define _WIN32_WINNT 0x0400

Definition at line 17 of file SServer.Cpp.

Typedef Documentation

typedef struct tagCONSOLEDATA CONSOLEDATA

Function Documentation

STDMETHODIMP Busy | ( | HANDLE | hConsole,
 |  | COORD & | xy,
 |  | int | nIter
 | ) |  |

Definition at line 185 of file SServer.Cpp.

{
  HRESULT hr = S_OK;
  SetConsoleCursorPosition(hConsole, xy);
  TCHAR *szMessage = TEXT("!!!Call cancelled!!!");
  TCHAR *szBuf[4]={TEXT("|"), TEXT("/"), TEXT("-"), TEXT("\\")};
  for (int i = 0; i < nIter; i++)
  {
    WriteConsole(hConsole, szBuf[0], 1, NULL, NULL);
    SetConsoleCursorPosition(hConsole, xy);
    WriteConsole(hConsole, szBuf[1], 1, NULL, NULL);
    SetConsoleCursorPosition(hConsole, xy);
    WriteConsole(hConsole, szBuf[2], 1, NULL, NULL);
    SetConsoleCursorPosition(hConsole, xy);
    WriteConsole(hConsole, szBuf[3], 1, NULL, NULL);
    SetConsoleCursorPosition(hConsole, xy);
    if (RPC_E_CALL_CANCELED == CoTestCancel())
    {
      hr = RPC_E_CALL_CANCELED;
      WriteConsole(hConsole, szMessage, lstrlen(szMessage), NULL, NULL);
      break;
    }
  }
  return hr;
}

DEFINE_GUID | ( | CLSID_STACancelObject | ,
 |  | 0x37824811 | ,
 |  | 0xadba | ,
 |  | 0x11d1 | ,
 |  | 0xb6 | ,
 |  | 0xfb | ,
 |  | 0x0 | ,
 |  | 0xa0 | ,
 |  | 0x24 | ,
 |  | 0xa8 | ,
 |  | 0x5a | ,
 |  | 0x1f |
 | ) |  |
DEFINE_GUID | ( | CLSID_NoneCancelObject | ,
 |  | 0x37824810 | ,
 |  | 0xadba | ,
 |  | 0x11d1 | ,
 |  | 0xb6 | ,
 |  | 0xfb | ,
 |  | 0x0 | ,
 |  | 0xa0 | ,
 |  | 0x24 | ,
 |  | 0xa8 | ,
 |  | 0x5a | ,
 |  | 0x1f |
 | ) |  |
DEFINE_GUID | ( | CLSID_MTACancelObject | ,
 |  | 0x37824812 | ,
 |  | 0xadba | ,
 |  | 0x11d1 | ,
 |  | 0xb6 | ,
 |  | 0xfb | ,
 |  | 0x0 | ,
 |  | 0xa0 | ,
 |  | 0x24 | ,
 |  | 0xa8 | ,
 |  | 0x5a | ,
 |  | 0x1f |
 | ) |  |
STDAPI DllCanUnloadNow ( void )

Definition at line 282 of file SServer.Cpp.

{
  if (g_Count == 0)
  {
    return S_OK ;
  }
  else
  {
    return S_FALSE ;
  }
}

STDAPI DllGetClassObject | ( | const CLSID & | clsid,
 |  | const IID & | iid,
 |  | void ** | ppv
 | ) |  |

Definition at line 294 of file SServer.Cpp.

{

  // Can we create this component?
  if ( (clsid != CLSID_NoneCancelObject) && (clsid != CLSID_STACancelObject) &&
     (clsid != CLSID_MTACancelObject))
  {
    return CLASS_E_CLASSNOTAVAILABLE ;
  }
  HRESULT hr =  g_ClassFactory.QueryInterface(iid, ppv) ;
  return hr ;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hDLLInst,
 |  | DWORD | fdwReason,
 |  | LPVOID | lpvReserved
 | ) |  |

Definition at line 106 of file SServer.Cpp.

{
  UNREFERENCED_PARAMETER(lpvReserved);
  switch (fdwReason)
    {
        case DLL_PROCESS_ATTACH:
       g_hInstance = hDLLInst;
       InitializeCriticalSection(&g_cs);
       break;
        case DLL_THREAD_ATTACH:
      break;
        case DLL_THREAD_DETACH:
      break;
        case DLL_PROCESS_DETACH:
       DeleteCriticalSection(&g_cs);
       _tprintf(TEXT("\n going..going..gone\n"));
       break;
    default:
      break;
  }
    return TRUE;
}

void Message | ( | LPTSTR | szPrefix,
 |  | HRESULT | hr
 | ) |  |

Definition at line 135 of file SServer.Cpp.

{
    LPTSTR   szMessage;
  TCHAR szDisplay[1000];

    if (hr == S_OK)
        {
    _stprintf(szDisplay, TEXT("%s"), szPrefix);
    MessageBox(0, szDisplay, TEXT("Msg"),MB_SERVICE_NOTIFICATION);
        return;
        }

    if (HRESULT_FACILITY(hr) == FACILITY_WIN32)
        hr = HRESULT_CODE(hr);

    FormatMessage(
        FORMAT_MESSAGE_ALLOCATE_BUFFER |
        FORMAT_MESSAGE_FROM_SYSTEM,
        NULL,
        hr,
        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), //The user default language
        (LPTSTR)&szMessage,
        0,
        NULL );

    _stprintf(szDisplay, TEXT("%s: %s(%lx)"), szPrefix, szMessage, hr);
  MessageBox(0, szDisplay, TEXT("Service:Msg"),MB_SERVICE_NOTIFICATION);
    LocalFree(szMessage);
}  // Message

Variable Documentation

CClassFactory g_ClassFactory

Definition at line 103 of file SServer.Cpp.

CONSOLEDATA g_ConsoleData

Definition at line 42 of file SServer.Cpp.

long g_Count

Definition at line 34 of file SServer.Cpp.

CRITICAL_SECTION g_cs

Definition at line 41 of file SServer.Cpp.

HINSTANCE g_hInstance

Definition at line 104 of file SServer.Cpp.

Generated on Wed Nov 13 2024 16:53:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/Cancel/Local/Mta/SServer.Cpp File Reference

  • Com
  • Fundamentals
  • DCom
  • Cancel
  • Local
  • Mta
Classes | Defines | Typedefs | Functions | Variables

SServer.Cpp File Reference

#include <stdio.h>
#include <tchar.h>
#include <windows.h>
#include <WindowsX.h>
#include <initguid.h>

Go to the source code of this file.

Classes

class | CClassFactory
class | CSimpleObject
struct | tagCONSOLEDATA

Defines

#define | _WIN32_WINNT 0x0500

Typedefs

typedef struct tagCONSOLEDATA | CONSOLEDATA

Functions

STDMETHODIMP | Busy (HANDLE hConsole, COORD &xy, int nIter)
DEFINE_GUID (CLSID_MTACancelObject, 0x37824812, 0xadba, 0x11d1, 0xb6, 0xfb, 0x0, 0xa0, 0x24, 0xa8, 0x5a, 0x1f)
void | main ()
void | Message (LPTSTR szPrefix, HRESULT hr)

Variables

CClassFactory g_ClassFactory
CONSOLEDATA g_ConsoleData
CRITICAL_SECTION | g_cs
HANDLE g_hEventDone

Define Documentation

#define _WIN32_WINNT 0x0500

Definition at line 17 of file SServer.Cpp.

Typedef Documentation

typedef struct tagCONSOLEDATA CONSOLEDATA

Function Documentation

STDMETHODIMP Busy | ( | HANDLE | hConsole,
 |  | COORD & | xy,
 |  | int | nIter
 | ) |  |

Definition at line 171 of file SServer.Cpp.

{
  HRESULT hr = S_OK;
  SetConsoleCursorPosition(hConsole, xy);
  TCHAR *szMessage = TEXT("!!!Call cancelled!!!");
  TCHAR *szBuf[4]={TEXT("|"), TEXT("/"), TEXT("-"), TEXT("\\")};
  for (int i = 0; i < nIter; i++)
  {
    Sleep(5);
    WriteConsole(hConsole, szBuf[0], 1, NULL, NULL);
    SetConsoleCursorPosition(hConsole, xy);
    WriteConsole(hConsole, szBuf[1], 1, NULL, NULL);
    SetConsoleCursorPosition(hConsole, xy);
    WriteConsole(hConsole, szBuf[2], 1, NULL, NULL);
    SetConsoleCursorPosition(hConsole, xy);
    WriteConsole(hConsole, szBuf[3], 1, NULL, NULL);
    SetConsoleCursorPosition(hConsole, xy);
    if (RPC_E_CALL_CANCELED == CoTestCancel())
    {
      hr = RPC_E_CALL_CANCELED;
      WriteConsole(hConsole, szMessage, lstrlen(szMessage), NULL, NULL);
      break;
    }
  }
  return hr;
}

DEFINE_GUID | ( | CLSID_MTACancelObject | ,
 |  | 0x37824812 | ,
 |  | 0xadba | ,
 |  | 0x11d1 | ,
 |  | 0xb6 | ,
 |  | 0xfb | ,
 |  | 0x0 | ,
 |  | 0xa0 | ,
 |  | 0x24 | ,
 |  | 0xa8 | ,
 |  | 0x5a | ,
 |  | 0x1f |
 | ) |  |
void main ( void )

Definition at line 270 of file SServer.Cpp.

{
    HRESULT hr;
    DWORD   dwRegister;

    // create the event which is signaled when the instance is deleted
    g_hEventDone = CreateEvent(NULL, FALSE, FALSE, NULL);
    if (g_hEventDone == NULL)
    {
        Message(TEXT("Server: CreateEvent Error"), GetLastError());
        exit(-1);
    }
  InitializeCriticalSection(&g_cs);
    // initialize COM for free-threading
    hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
  if (FAILED(hr))
    {
        Message(TEXT("Server: CoInitializeEx Error"), hr);
        exit(-1);
    }

  hr = CoInitializeSecurity(
      NULL,
      -1,
      NULL,
      NULL,
      RPC_C_AUTHN_LEVEL_NONE,
      RPC_C_IMP_LEVEL_IMPERSONATE,
      NULL,
      EOAC_NONE,
      NULL);
    if (FAILED(hr))
        {
    CoUninitialize();
        Message(TEXT("Client: CoInitializeSecurity Error"), hr);
        exit(hr);
        }
  // register the class-object with OLE
    hr = CoRegisterClassObject(CLSID_MTACancelObject, &g_ClassFactory,
        CLSCTX_SERVER, REGCLS_MULTIPLEUSE, &dwRegister);

  if (FAILED(hr))
    {
    CoUninitialize();
        Message(TEXT("Server: CoRegisterClassObject Error"), hr);
        exit(-1);
    }
  WaitForSingleObject(g_hEventDone, INFINITE);
  hr = CoRevokeClassObject(dwRegister);
  if (FAILED(hr))
    {
    CoUninitialize();
        Message(TEXT("Server: CoRevokeClassObject Error"), hr);
        exit(-1);
    }
    CoUninitialize();
  CloseHandle(g_hEventDone);
  DeleteCriticalSection(&g_cs);
    _tprintf(TEXT("Server: Done"));
}  // main

void Message | ( | LPTSTR | szPrefix,
 |  | HRESULT | hr
 | ) |  |

Definition at line 121 of file SServer.Cpp.

{
    LPTSTR   szMessage;
  TCHAR szDisplay[1000];

    if (hr == S_OK)
        {
    _stprintf(szDisplay, TEXT("%s"), szPrefix);
    MessageBox(0, szDisplay, TEXT("Msg"),MB_SERVICE_NOTIFICATION);
        return;
        }

    if (HRESULT_FACILITY(hr) == FACILITY_WIN32)
        hr = HRESULT_CODE(hr);

    FormatMessage(
        FORMAT_MESSAGE_ALLOCATE_BUFFER |
        FORMAT_MESSAGE_FROM_SYSTEM,
        NULL,
        hr,
        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), //The user default language
        (LPTSTR)&szMessage,
        0,
        NULL );

    _stprintf(szDisplay, TEXT("%s: %s(%lx)"), szPrefix, szMessage, hr);
  MessageBox(0, szDisplay, TEXT("Service:Msg"),MB_SERVICE_NOTIFICATION);
    LocalFree(szMessage);
}  // Message

Variable Documentation

CClassFactory g_ClassFactory

Definition at line 113 of file SServer.Cpp.

CONSOLEDATA g_ConsoleData

Definition at line 38 of file SServer.Cpp.

CRITICAL_SECTION g_cs

Definition at line 26 of file SServer.Cpp.

HANDLE g_hEventDone

Definition at line 25 of file SServer.Cpp.

Generated on Wed Nov 13 2024 16:53:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/Cancel/Local/Sta/SServer.Cpp File Reference

  • Com
  • Fundamentals
  • DCom
  • Cancel
  • Local
  • Sta
Classes | Defines | Typedefs | Functions | Variables

SServer.Cpp File Reference

#include <stdio.h>
#include <tchar.h>
#include <windows.h>
#include <WindowsX.h>
#include <initguid.h>

Go to the source code of this file.

Classes

class | CClassFactory
class | CSimpleObject
struct | tagCONSOLEDATA

Defines

#define | _WIN32_WINNT 0x0400

Typedefs

typedef struct tagCONSOLEDATA | CONSOLEDATA

Functions

STDMETHODIMP | Busy (HANDLE hConsole, COORD &xy, int nIter)
DEFINE_GUID (CLSID_STACancelObject, 0x37824811, 0xadba, 0x11d1, 0xb6, 0xfb, 0x0, 0xa0, 0x24, 0xa8, 0x5a, 0x1f)
void | main ()
void | Message (LPTSTR szPrefix, HRESULT hr)

Variables

CClassFactory g_ClassFactory
CONSOLEDATA g_ConsoleData

Define Documentation

#define _WIN32_WINNT 0x0400

Definition at line 17 of file SServer.Cpp.

Typedef Documentation

typedef struct tagCONSOLEDATA CONSOLEDATA

Function Documentation

STDMETHODIMP Busy | ( | HANDLE | hConsole,
 |  | COORD & | xy,
 |  | int | nIter
 | ) |  |

Definition at line 169 of file SServer.Cpp.

{
  HRESULT hr = S_OK;
  SetConsoleCursorPosition(hConsole, xy);
  TCHAR *szMessage = TEXT("!!!Call cancelled!!!");
  TCHAR *szBuf[4]={TEXT("|"), TEXT("/"), TEXT("-"), TEXT("\\")};
  for (int i = 0; i < nIter; i++)
  {
    Sleep(5);
    WriteConsole(hConsole, szBuf[0], 1, NULL, NULL);
    SetConsoleCursorPosition(hConsole, xy);
    WriteConsole(hConsole, szBuf[1], 1, NULL, NULL);
    SetConsoleCursorPosition(hConsole, xy);
    WriteConsole(hConsole, szBuf[2], 1, NULL, NULL);
    SetConsoleCursorPosition(hConsole, xy);
    WriteConsole(hConsole, szBuf[3], 1, NULL, NULL);
    SetConsoleCursorPosition(hConsole, xy);
    if (RPC_E_CALL_CANCELED == CoTestCancel())
    {
      hr = RPC_E_CALL_CANCELED;
      WriteConsole(hConsole, szMessage, lstrlen(szMessage), NULL, NULL);
      break;
    }
  }
  return hr;
}

DEFINE_GUID | ( | CLSID_STACancelObject | ,
 |  | 0x37824811 | ,
 |  | 0xadba | ,
 |  | 0x11d1 | ,
 |  | 0xb6 | ,
 |  | 0xfb | ,
 |  | 0x0 | ,
 |  | 0xa0 | ,
 |  | 0x24 | ,
 |  | 0xa8 | ,
 |  | 0x5a | ,
 |  | 0x1f |
 | ) |  |
void main ( void )

Definition at line 266 of file SServer.Cpp.

{
    HRESULT hr;
    DWORD   dwRegister;

    // initialize COM for free-threading
    hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
  if (FAILED(hr))
    {
        Message(TEXT("Server: CoInitializeEx Error"), hr);
        exit(-1);
    }

  hr = CoInitializeSecurity(
      NULL,
      -1,
      NULL,
      NULL,
      RPC_C_AUTHN_LEVEL_NONE,
      RPC_C_IMP_LEVEL_IMPERSONATE,
      NULL,
      EOAC_NONE,
      NULL);
    if (FAILED(hr))
        {
    CoUninitialize();
        Message(TEXT("Client: CoInitializeSecurity Error"), hr);
        exit(hr);
        }
  // register the class-object with OLE
    hr = CoRegisterClassObject(CLSID_STACancelObject, &g_ClassFactory,
        CLSCTX_SERVER, REGCLS_MULTIPLEUSE, &dwRegister);

  if (FAILED(hr))
    {
    CoUninitialize();
        Message(TEXT("Server: CoRegisterClassObject Error"), hr);
        exit(-1);
    }

  MSG msg;
  while (GetMessage(&msg, NULL, NULL, 0))
  {
    TranslateMessage(&msg);
    DispatchMessage(&msg);
  }
  hr = CoRevokeClassObject(dwRegister);
  if (FAILED(hr))
    {
    CoUninitialize();
        Message(TEXT("Server: CoRevokeClassObject Error"), hr);
        exit(-1);
    }
    CoUninitialize();
    _tprintf(TEXT("Server: Done"));
}  // main

void Message | ( | LPTSTR | szPrefix,
 |  | HRESULT | hr
 | ) |  |

Definition at line 119 of file SServer.Cpp.

{
    LPTSTR   szMessage;
  TCHAR szDisplay[1000];

    if (hr == S_OK)
        {
    _stprintf(szDisplay, TEXT("%s"), szPrefix);
    MessageBox(0, szDisplay, TEXT("Msg"),MB_SERVICE_NOTIFICATION);
        return;
        }

    if (HRESULT_FACILITY(hr) == FACILITY_WIN32)
        hr = HRESULT_CODE(hr);

    FormatMessage(
        FORMAT_MESSAGE_ALLOCATE_BUFFER |
        FORMAT_MESSAGE_FROM_SYSTEM,
        NULL,
        hr,
        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), //The user default language
        (LPTSTR)&szMessage,
        0,
        NULL );

    _stprintf(szDisplay, TEXT("%s: %s(%lx)"), szPrefix, szMessage, hr);
  MessageBox(0, szDisplay, TEXT("Service:Msg"),MB_SERVICE_NOTIFICATION);
    LocalFree(szMessage);
}  // Message

Variable Documentation

CClassFactory g_ClassFactory

Definition at line 111 of file SServer.Cpp.

CONSOLEDATA g_ConsoleData

Definition at line 36 of file SServer.Cpp.

Generated on Wed Nov 13 2024 16:53:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/ComPerf/ComPerf.Cpp File Reference

  • Com
  • Fundamentals
  • DCom
  • ComPerf
Classes | Defines | Typedefs | Functions | Variables

ComPerf.Cpp File Reference

#include <windows.h>
#include <initguid.h>
#include <tchar.h>
#include <stdio.h>
#include "psperf.h"

Go to the source code of this file.

Classes

class | CClassFactory
class | CTestCOMPerformance
class | CTIMER
struct | perf

Defines

#define | _WIN32_WINNT 0x0400
#define | cServerThreads 3
#define | dispidICOMPerformance_Test1 11
#define | dispidICOMPerformance_Test23 12
#define | INC_OLE2
#define | LOOPS 2000
#define | PURPOSE "This is the reference performance sample for COM/DCOM run on local\n\and remote machines. This program is both a client and a server.\n\It launches as a client by default, registering its executable as a\n\server with COM and creating other instances of itself on a remote and\n\local machine to be servers. A single command-line argument is allowed\n\for a remote server name. Performance numbers in calls/sec are output\n\in tabular form. Tests COM and IDispatch method calls with two security\n\levels: default/min and full. Use DCOMCNFG to set default security to \n\Authn Lvl to NONE for best comparison. Parameter sizes are varied to see\n\effect on security levels(~4/50/4k bytes). Uses psoleperf.dll MIDL generated\n\proxy/stub implementation. Put pscomperf.dll in same dir as this exe on\n\all machines. Run exe on each machine to automatically register class code\n\and proxy/stub dll. You can then run on either machine and pass a remote\n\machine name (DNS or IP address) as single cmd-line parameter.\n\n"
#define | STRICT
#define | szTitleClient TEXT("COM Performance Sample")
#define | szTitleServer TEXT("SERVER: COM Performance Sample")

Typedefs

typedef IClientSecurity * | LPCLIENTSECURITY
typedef ICOMPerformance * | LPCOMPERFORMANCE
typedef HRESULT(WINAPI * | LPFNREG )()
typedef struct perf | PERF

Functions

BOOL | AptFreeAutoTest (int cLoops)
BOOL | AptFreeCOMTest (int cLoops)
LRESULT | ClientThreadProc (LPARAM lParam)
DEFINE_GUID (CLSID_CTestCOMPerformance, 0xddc68870, 0xe08e, 0x11cf, 0xa5, 0x35, 0x0, 0xaa, 0x0, 0x61, 0x5b, 0x3)
BOOL | DoTests (void)
BOOL FAutoRegister ()
void | FPrintResults (void)
BOOL | FreeFreeAutoTest (int cLoops)
BOOL | FreeFreeCOMTest (int cLoops)
int __cdecl | main (int argc, CHAR **argv)
void | Message (LPTSTR szPrefix, HRESULT hr)
LRESULT | ServerThreadProc (LPARAM lParam)
void | Usage (void)

Variables

const LARGE_INTEGER | bZero = {0,0}
UINT | g_cObjectCount = 0
HANDLE hKillSvr
INTERFACEDATA | interfacedata = { methoddata, 2 }
METHODDATA | methoddata [2]
PARAMDATA | paramdata [2] = {{L"i", VT_I4},{L"bstr", VT_BSTR}}
LPDISPATCH | pAutoApt
LPDISPATCH | pAutoAptRmt
LPDISPATCH | pAutoFree
LPDISPATCH | pAutoFreeRmt
LPCOMPERFORMANCE pCOMApt
LPCOMPERFORMANCE pCOMAptRmt
LPCOMPERFORMANCE pCOMFree
LPCOMPERFORMANCE pCOMFreeRmt
LPWSTR | pszDesc1 = "String is passed to Test methd of ICOMPerformance"
BOOL | vfRemote = FALSE
BOOL | vfServer = FALSE
HANDLE vhEventCliDone
HANDLE vhEventCliStart
HANDLE vhEventServer
HRESULT | vhrThreadStatus
UINT viNextThread
LPSTREAM | vpstmMarshalling
HANDLE | vrghEvent [cServerThreads]
HANDLE | vrghThread [cServerThreads]
PERF vrgperfloc []
PERF vrgperfrmt []
DWORD | vrgtid [cServerThreads]

Define Documentation

#define _WIN32_WINNT 0x0400

Definition at line 42 of file ComPerf.Cpp.

#define cServerThreads 3

Definition at line 53 of file ComPerf.Cpp.

#define dispidICOMPerformance_Test1 11

Definition at line 54 of file ComPerf.Cpp.

#define dispidICOMPerformance_Test23 12

Definition at line 55 of file ComPerf.Cpp.

#define INC_OLE2

Definition at line 43 of file ComPerf.Cpp.

#define LOOPS 2000

Definition at line 45 of file ComPerf.Cpp.

#define PURPOSE "This is the reference performance sample for COM/DCOM run on local\n\and remote machines. This program is both a client and a server.\n\It launches as a client by default, registering its executable as a\n\server with COM and creating other instances of itself on a remote and\n\local machine to be servers. A single command-line argument is allowed\n\for a remote server name. Performance numbers in calls/sec are output\n\in tabular form. Tests COM and IDispatch method calls with two security\n\levels: default/min and full. Use DCOMCNFG to set default security to \n\Authn Lvl to NONE for best comparison. Parameter sizes are varied to see\n\effect on security levels(~4/50/4k bytes). Uses psoleperf.dll MIDL generated\n\proxy/stub implementation. Put pscomperf.dll in same dir as this exe on\n\all machines. Run exe on each machine to automatically register class code\n\and proxy/stub dll. You can then run on either machine and pass a remote\n\machine name (DNS or IP address) as single cmd-line parameter.\n\n"

Definition at line 17 of file ComPerf.Cpp.

#define STRICT

Definition at line 44 of file ComPerf.Cpp.

#define szTitleClient TEXT("COM Performance Sample")

Definition at line 57 of file ComPerf.Cpp.

#define szTitleServer TEXT("SERVER: COM Performance Sample")

Definition at line 56 of file ComPerf.Cpp.

Typedef Documentation

typedef IClientSecurity* LPCLIENTSECURITY

Definition at line 126 of file ComPerf.Cpp.

typedef ICOMPerformance* LPCOMPERFORMANCE

Definition at line 127 of file ComPerf.Cpp.

typedef HRESULT(WINAPI * LPFNREG)()

Definition at line 71 of file ComPerf.Cpp.

typedef struct perf PERF

Function Documentation

BOOL AptFreeAutoTest ( int cLoops )

Definition at line 1234 of file ComPerf.Cpp.

{
  HRESULT hr;
  static VARIANTARG  rgvt[1];
    static DISPPARAMS  dispparams = { rgvt, NULL, 1, 0 };
    static EXCEPINFO  excepinfo;
    VARIANT vtResult;
    UINT    argerr;
    LONG    i, k;
    CTIMER  tmElapsed;
  BSTR bstr1, bstr2;
  bstr1 = SysAllocString(pszDesc1);
  bstr2 = SysAllocStringByteLen((const char *)pszDesc1, 4096);

  // Test1
    tmElapsed.Start();
    V_VT(&vtResult) = VT_HRESULT;
    for (i=0; i<cLoops; i++)
  {
    V_VT(&rgvt[0]) = VT_I4;
    V_I4(&rgvt[0]) = i;
    hr = pAutoApt->Invoke(dispidICOMPerformance_Test1, IID_NULL, 0, DISPATCH_METHOD, &dispparams,
      &vtResult, &excepinfo, &argerr);
    k = V_I4(&vtResult);
  }
    tmElapsed.Stop();
    vrgperfloc[1].sec[0] = tmElapsed.OutputTime();
  // Test2
  tmElapsed.Start();
    V_VT(&vtResult) = VT_HRESULT;
    for (i=0; i<cLoops; i++)
  {
    V_VT(&rgvt[0]) = VT_BSTR;
    V_BSTR(&rgvt[0]) = bstr1;
    hr = pAutoApt->Invoke(dispidICOMPerformance_Test23, IID_NULL, 0, DISPATCH_METHOD, &dispparams,
      &vtResult, &excepinfo, &argerr);
    k = V_I4(&vtResult);
  }
    tmElapsed.Stop();
    vrgperfloc[1].sec[1] = tmElapsed.OutputTime();
  // Test3
  tmElapsed.Start();
    V_VT(&vtResult) = VT_HRESULT;
    for (i=0; i<cLoops; i++)
  {
    V_VT(&rgvt[0]) = VT_BSTR;
    V_BSTR(&rgvt[0]) = bstr2;
    hr = pAutoApt->Invoke(dispidICOMPerformance_Test23, IID_NULL, 0, DISPATCH_METHOD, &dispparams,
      &vtResult, &excepinfo, &argerr);
    k = V_I4(&vtResult);
  }
    tmElapsed.Stop();
    vrgperfloc[1].sec[2] = tmElapsed.OutputTime();
  // Remote
  if(vfRemote)
  {
    // Test1
    tmElapsed.Start();
    V_VT(&vtResult) = VT_HRESULT;
    for (i=0; i<cLoops; i++)
    {
      V_VT(&rgvt[0]) = VT_I4;
      V_I4(&rgvt[0]) = i;
      hr = pAutoAptRmt->Invoke(dispidICOMPerformance_Test1, IID_NULL, 0, DISPATCH_METHOD, &dispparams,
        &vtResult, &excepinfo, &argerr);
      k = V_I4(&vtResult);
    }
    tmElapsed.Stop();
    vrgperfrmt[1].sec[0] = tmElapsed.OutputTime();
    // Test2
    tmElapsed.Start();
    V_VT(&vtResult) = VT_HRESULT;
    for (i=0; i<cLoops; i++)
    {
      V_VT(&rgvt[0]) = VT_BSTR;
      V_BSTR(&rgvt[0]) = bstr1;
      hr = pAutoAptRmt->Invoke(dispidICOMPerformance_Test23, IID_NULL, 0, DISPATCH_METHOD, &dispparams,
        &vtResult, &excepinfo, &argerr);
      k = V_I4(&vtResult);
    }
    tmElapsed.Stop();
    vrgperfrmt[1].sec[1] = tmElapsed.OutputTime();
    // Test3
    tmElapsed.Start();
    V_VT(&vtResult) = VT_HRESULT;
    for (i=0; i<cLoops; i++)
    {
      V_VT(&rgvt[0]) = VT_BSTR;
      V_BSTR(&rgvt[0]) = bstr2;
      hr = pAutoAptRmt->Invoke(dispidICOMPerformance_Test23, IID_NULL, 0, DISPATCH_METHOD, &dispparams,
        &vtResult, &excepinfo, &argerr);
      k = V_I4(&vtResult);
    }
    tmElapsed.Stop();
    vrgperfrmt[1].sec[2] = tmElapsed.OutputTime();
  }

  SysFreeString(bstr1);
  SysFreeString(bstr2);
  return TRUE;
}

BOOL AptFreeCOMTest ( int cLoops )

Definition at line 1179 of file ComPerf.Cpp.

{
  LONG    i, k;
    CTIMER  tmElapsed;
  BSTR bstr1, bstr2;
  bstr1 = SysAllocString(pszDesc1);
  bstr2 = SysAllocStringByteLen((const char *)pszDesc1, 4096);
  // Local
  // Test1
    tmElapsed.Start();
    for (i=0; i<cLoops; i++)
    k = (LONG)pCOMApt->Test1(i);
    tmElapsed.Stop();
    vrgperfloc[0].sec[0] = tmElapsed.OutputTime();
  // Test2
    tmElapsed.Start();
    for (i=0; i<cLoops; i++)
    k = (LONG)pCOMApt->Test23(bstr1);
    tmElapsed.Stop();
    vrgperfloc[0].sec[1] = tmElapsed.OutputTime();
  // Test3
    tmElapsed.Start();
  for (i=0; i<cLoops; i++)
    k = (LONG)pCOMApt->Test23(bstr2);
    tmElapsed.Stop();
    vrgperfloc[0].sec[2] = tmElapsed.OutputTime();

  // Remote
  if(vfRemote)
  {
    tmElapsed.Start();
    for (i=0; i<cLoops; i++)
      k = (LONG)pCOMAptRmt->Test1(i);
    tmElapsed.Stop();
    vrgperfrmt[0].sec[0] = tmElapsed.OutputTime();
    // Test2
    tmElapsed.Start();
    for (i=0; i<cLoops; i++)
      k = (LONG)pCOMAptRmt->Test23(bstr1);
    tmElapsed.Stop();
    vrgperfrmt[0].sec[1] = tmElapsed.OutputTime();
    // Test3
    tmElapsed.Start();
    for (i=0; i<cLoops; i++)
      k = (LONG)pCOMAptRmt->Test23(bstr2);
    tmElapsed.Stop();
    vrgperfrmt[0].sec[2] = tmElapsed.OutputTime();

  }
  SysFreeString(bstr1);
  SysFreeString(bstr2);
  return TRUE;
}

LRESULT ClientThreadProc ( LPARAM lParam )

Definition at line 910 of file ComPerf.Cpp.

{
    HRESULT hr;
    MSG     msg;
  UINT cCount = 0;
  hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
    if (FAILED(hr))
    {
  return hr;
    }
    while (TRUE)
    {
  DWORD dwWaitResult;

  // wait for any message sent or posted to this queue
  // or for one of the passed handles to become signaled
  dwWaitResult = MsgWaitForMultipleObjectsEx(1, &vhEventCliStart,
      INFINITE, QS_SENDMESSAGE, 0);

  // result tells us the type of event we have:
  // a message or a signaled handle

  // if there are one or more messages in the queue ...
  if (dwWaitResult == (WAIT_OBJECT_0 + 1))
  {
      // dispatch all of the messages in this next loop
      // (here is where we'd check for WM_QUITs to end this
      // worker thread if we wanted to)
      while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
    DispatchMessage(&msg);
  }
  else
  {
      // this thread was signaled to test Apt to Apt
      try
      {
      //Message(TEXT("Testing Apt to Apt"), hr);
      LPUNKNOWN   punk;
      LPDISPATCH   pdisp;
      // unmarshal an IUnknown from the scratch stream. if unmarshaling
      // fails, it takes care of releasing the object inside the marshal-data
      hr = vpstmMarshalling->Seek(bZero, STREAM_SEEK_SET, NULL);
      if (FAILED(hr))
        return hr;
      hr = CoUnmarshalInterface(vpstmMarshalling, IID_IUnknown, (void **)&punk);
      if (FAILED(hr))
        return hr;
      ICOMPerformance *pcomperf = NULL;
      // get a reference to ICOMPerformance and IDispatch interface
      hr = punk->QueryInterface(IID_ICOMPerformance, (void**)&pcomperf);
      hr = punk->QueryInterface(IID_IDispatch, (void**)&pdisp);
      LONG    i, k;
      CTIMER  tmElapsed;
      BSTR bstr1, bstr2;
      bstr1 = SysAllocString(pszDesc1);
      bstr2 = SysAllocStringByteLen((const char *)pszDesc1, 4096);
      // Test1
      tmElapsed.Start();
      for (i=0; i<LOOPS; i++)
        k = (LONG)pcomperf->Test1(i);
      tmElapsed.Stop();
      if(cCount && vfRemote)
        vrgperfrmt[4].sec[0] = tmElapsed.OutputTime();
      else
        vrgperfloc[4].sec[0] = tmElapsed.OutputTime();
      // Test2
      tmElapsed.Start();
      for (i=0; i<LOOPS; i++)
        k = (LONG)pcomperf->Test23(bstr1);
      tmElapsed.Stop();
      if(cCount && vfRemote)
        vrgperfrmt[4].sec[1] = tmElapsed.OutputTime();
      else
        vrgperfloc[4].sec[1] = tmElapsed.OutputTime();
      // Test3
      tmElapsed.Start();
      for (i=0; i<LOOPS; i++)
        k = (LONG)pcomperf->Test23(bstr2);
      tmElapsed.Stop();
      if(cCount && vfRemote)
        vrgperfrmt[4].sec[2] = tmElapsed.OutputTime();
      else
        vrgperfloc[4].sec[2] = tmElapsed.OutputTime();
      // Now IDispatch
      VARIANTARG  rgvt[1];
      DISPPARAMS  dispparams = { rgvt, NULL, 1, 0 };
      EXCEPINFO  excepinfo;

      VARIANT vtResult;
      UINT    argerr;
      // Test1
      tmElapsed.Start();
      V_VT(&vtResult) = VT_HRESULT;
      for (i=0; i<LOOPS; i++)
      {
        V_VT(&rgvt[0]) = VT_I4;
        V_I4(&rgvt[0]) = i;
        hr = pdisp->Invoke(dispidICOMPerformance_Test1, IID_NULL, 0, DISPATCH_METHOD, &dispparams,
          &vtResult, &excepinfo, &argerr);
        k = V_I4(&vtResult);
      }
      tmElapsed.Stop();
      if(cCount && vfRemote)
        vrgperfrmt[5].sec[0] = tmElapsed.OutputTime();
      else
        vrgperfloc[5].sec[0] = tmElapsed.OutputTime();
      // Test2
      tmElapsed.Start();
      V_VT(&vtResult) = VT_HRESULT;
      for (i=0; i<LOOPS; i++)
      {
        V_VT(&rgvt[0]) = VT_BSTR;
        V_BSTR(&rgvt[0]) = bstr1;
        hr = pdisp->Invoke(dispidICOMPerformance_Test23, IID_NULL, 0, DISPATCH_METHOD, &dispparams,
          &vtResult, &excepinfo, &argerr);
        k = V_I4(&vtResult);
      }
      tmElapsed.Stop();
      if(cCount && vfRemote)
        vrgperfrmt[5].sec[1] = tmElapsed.OutputTime();
      else
        vrgperfloc[5].sec[1] = tmElapsed.OutputTime();
      // Test3
      tmElapsed.Start();
      V_VT(&vtResult) = VT_HRESULT;
      for (i=0; i<LOOPS; i++)
      {
        V_VT(&rgvt[0]) = VT_BSTR;
        V_BSTR(&rgvt[0]) = bstr2;
        hr = pdisp->Invoke(dispidICOMPerformance_Test23, IID_NULL, 0, DISPATCH_METHOD, &dispparams,
          &vtResult, &excepinfo, &argerr);
        k = V_I4(&vtResult);
      }
      tmElapsed.Stop();
      if(cCount && vfRemote)
        vrgperfrmt[5].sec[2] = tmElapsed.OutputTime();
      else
        vrgperfloc[5].sec[2] = tmElapsed.OutputTime();
      SysFreeString(bstr1);
      SysFreeString(bstr2);
      hr = pcomperf->Release();
      hr = pdisp->Release();
      hr = punk->Release();

      vhrThreadStatus = S_OK;
      }
      catch (HRESULT hr)
      {
    vhrThreadStatus = hr;
      }
      SetEvent(vhEventCliDone);
      if(cCount)
        --cCount;
      else
        ++cCount;
  }
    }
    CoUninitialize();
    return msg.wParam;
}  // ClientThreadProc

DEFINE_GUID | ( | CLSID_CTestCOMPerformance | ,
 |  | 0xddc68870 | ,
 |  | 0xe08e | ,
 |  | 0x11cf | ,
 |  | 0xa5 | ,
 |  | 0x35 | ,
 |  | 0x0 | ,
 |  | 0xaa | ,
 |  | 0x0 | ,
 |  | 0x61 | ,
 |  | 0x5b | ,
 |  | 0x3 |
 | ) |  |
BOOL DoTests ( void )

Definition at line 1605 of file ComPerf.Cpp.

{
  if(!AptFreeCOMTest(LOOPS))
    return FALSE;
  if(!AptFreeAutoTest(LOOPS))
    return FALSE;
  if(!FreeFreeCOMTest(LOOPS))
    return FALSE;
  if(!FreeFreeAutoTest(LOOPS))
    return FALSE;
  FPrintResults();
  return TRUE;
} // DoTests

BOOL FAutoRegister ( )

Definition at line 664 of file ComPerf.Cpp.

{
    static TCHAR szClassDesc[] = TEXT("COM Performance Sample");
  static TCHAR szCLSIDEntry[] = TEXT("CLSID\\{DDC68870-E08E-11cf-A535-00AA00615B03}");
    TCHAR       szBuf[512];
    TCHAR       szPath[512];
    HKEY        hkeyT = NULL;

  HRESULT hr;
  LPFNREG lpfn = NULL;
  HINSTANCE hLib = NULL;

    // register class code
    if ((RegSetValue(HKEY_CLASSES_ROOT, szCLSIDEntry, REG_SZ, szClassDesc,
      lstrlen(szClassDesc)) != ERROR_SUCCESS) ||
  (RegCreateKey(HKEY_CLASSES_ROOT, szCLSIDEntry, &hkeyT)
      != ERROR_SUCCESS) ||
  !GetModuleFileName(NULL, szBuf, sizeof(szBuf)))
  return FALSE;
    lstrcpy(szPath, szBuf);
    if (RegSetValue(hkeyT, TEXT("LocalServer32"), REG_SZ, szBuf, lstrlen(szBuf))
      != ERROR_SUCCESS)
  goto LErrExit;
    RegCloseKey(hkeyT);
  hkeyT = NULL;
  // Register the ICOMPerformance MIDL-generated proxy-stub component
  hLib = LoadLibrary(TEXT("psperf.dll"));
  if (NULL == hLib)
  {
    goto  LErrExit;
  }
  // Find entry point.
  lpfn = (LPFNREG)GetProcAddress(hLib, TEXT("DllRegisterServer"));
  if (lpfn == NULL)
  {
    //Message(_T("Couldn't find entry point in DLL"), S_OK); //unable to locate entry point
    goto LErrExit;
  }
  hr = (*lpfn)();

  FreeLibrary(hLib);
  if(SUCCEEDED(hr))
    return TRUE;
LErrExit:
  if(NULL != hkeyT)
    RegCloseKey(hkeyT);
  return FALSE;
}  // FAutoRegister

void FPrintResults ( void )

Definition at line 1501 of file ComPerf.Cpp.

{
  _tprintf(TEXT("Data Size\t\t4\t50\t4k\t4\t50\t4k\n"));
  _tprintf(TEXT("%s\t\t"), vrgperfloc[0].szTest);
  _tprintf(TEXT("%4.2f\t"), LOOPS/vrgperfloc[0].sec[0]);
  _tprintf(TEXT("%4.2f\t"), LOOPS/vrgperfloc[0].sec[1]);
  _tprintf(TEXT("%4.2f\t"), LOOPS/vrgperfloc[0].sec[2]);
  if(vfRemote)
  {
    _tprintf(TEXT("%4.2f\t"), LOOPS/vrgperfrmt[0].sec[0]);
    _tprintf(TEXT("%4.2f\t"), LOOPS/vrgperfrmt[0].sec[1]);
    _tprintf(TEXT("%4.2f\n"), LOOPS/vrgperfrmt[0].sec[2]);
  }
  else
  {
    _tprintf(TEXT("--\t"));
    _tprintf(TEXT("--\t"));
    _tprintf(TEXT("--\n"));
  }
  _tprintf(TEXT("%s\t\t"), vrgperfloc[1].szTest);
  _tprintf(TEXT("%4.2f\t"), LOOPS/vrgperfloc[1].sec[0]);
  _tprintf(TEXT("%4.2f\t"), LOOPS/vrgperfloc[1].sec[1]);
  _tprintf(TEXT("%4.2f\t"), LOOPS/vrgperfloc[1].sec[2]);
  if(vfRemote)
  {
    _tprintf(TEXT("%4.2f\t"), LOOPS/vrgperfrmt[1].sec[0]);
    _tprintf(TEXT("%4.2f\t"), LOOPS/vrgperfrmt[1].sec[1]);
    _tprintf(TEXT("%4.2f\n"), LOOPS/vrgperfrmt[1].sec[2]);
  }
  else
  {
    _tprintf(TEXT("--\t"));
    _tprintf(TEXT("--\t"));
    _tprintf(TEXT("--\n"));
  }
  _tprintf(TEXT("%s\t\t"), vrgperfloc[2].szTest);
  _tprintf(TEXT("%4.2f\t"), LOOPS/vrgperfloc[2].sec[0]);
  _tprintf(TEXT("%4.2f\t"), LOOPS/vrgperfloc[2].sec[1]);
  _tprintf(TEXT("%4.2f\t"), LOOPS/vrgperfloc[2].sec[2]);
  if(vfRemote)
  {
    _tprintf(TEXT("%4.2f\t"), LOOPS/vrgperfrmt[2].sec[0]);
    _tprintf(TEXT("%4.2f\t"), LOOPS/vrgperfrmt[2].sec[1]);
    _tprintf(TEXT("%4.2f\n"), LOOPS/vrgperfrmt[2].sec[2]);
  }
  else
  {
    _tprintf(TEXT("--\t"));
    _tprintf(TEXT("--\t"));
    _tprintf(TEXT("--\n"));
  }
  _tprintf(TEXT("%s\t\t"), vrgperfloc[3].szTest);
  _tprintf(TEXT("%4.2f\t"), LOOPS/vrgperfloc[3].sec[0]);
  _tprintf(TEXT("%4.2f\t"), LOOPS/vrgperfloc[3].sec[1]);
  _tprintf(TEXT("%4.2f\t"), LOOPS/vrgperfloc[3].sec[2]);
  if(vfRemote)
  {
    _tprintf(TEXT("%4.2f\t"), LOOPS/vrgperfrmt[3].sec[0]);
    _tprintf(TEXT("%4.2f\t"), LOOPS/vrgperfrmt[3].sec[1]);
    _tprintf(TEXT("%4.2f\n"), LOOPS/vrgperfrmt[3].sec[2]);
  }
  else
  {
    _tprintf(TEXT("--\t"));
    _tprintf(TEXT("--\t"));
    _tprintf(TEXT("--\n"));
  }
  _tprintf(TEXT("%s\t\t"), vrgperfloc[4].szTest);
  _tprintf(TEXT("%4.2f\t"), LOOPS/vrgperfloc[4].sec[0]);
  _tprintf(TEXT("%4.2f\t"), LOOPS/vrgperfloc[4].sec[1]);
  _tprintf(TEXT("%4.2f\t"), LOOPS/vrgperfloc[4].sec[2]);
  if(vfRemote)
  {
    _tprintf(TEXT("%4.2f\t"), LOOPS/vrgperfrmt[4].sec[0]);
    _tprintf(TEXT("%4.2f\t"), LOOPS/vrgperfrmt[4].sec[1]);
    _tprintf(TEXT("%4.2f\n"), LOOPS/vrgperfrmt[4].sec[2]);
  }
  else
  {
    _tprintf(TEXT("--\t"));
    _tprintf(TEXT("--\t"));
    _tprintf(TEXT("--\n"));
  }
  _tprintf(TEXT("%s\t\t"), vrgperfloc[5].szTest);
  _tprintf(TEXT("%4.2f\t"), LOOPS/vrgperfloc[5].sec[0]);
  _tprintf(TEXT("%4.2f\t"), LOOPS/vrgperfloc[5].sec[1]);
  _tprintf(TEXT("%4.2f\t"), LOOPS/vrgperfloc[5].sec[2]);
  if(vfRemote)
  {
    _tprintf(TEXT("%4.2f\t"), LOOPS/vrgperfrmt[5].sec[0]);
    _tprintf(TEXT("%4.2f\t"), LOOPS/vrgperfrmt[5].sec[1]);
    _tprintf(TEXT("%4.2f\n"), LOOPS/vrgperfrmt[5].sec[2]);
  }
  else
  {
    _tprintf(TEXT("--\t"));
    _tprintf(TEXT("--\t"));
    _tprintf(TEXT("--\n"));
  }

}

BOOL FreeFreeAutoTest ( int cLoops )

Definition at line 1397 of file ComPerf.Cpp.

{
  HRESULT hr;
  static VARIANTARG  rgvt[1];
    static DISPPARAMS  dispparams = { rgvt, NULL, 1, 0 };
    static EXCEPINFO  excepinfo;
    VARIANT vtResult;
    UINT    argerr;
    LONG    i, k;
    CTIMER  tmElapsed;
  BSTR bstr1, bstr2;
  bstr1 = SysAllocString(pszDesc1);
  bstr2 = SysAllocStringByteLen((const char *)pszDesc1, 4096);

  // Local
  // Test1
    tmElapsed.Start();
    V_VT(&vtResult) = VT_HRESULT;
    for (i=0; i<cLoops; i++)
  {
    V_VT(&rgvt[0]) = VT_I4;
    V_I4(&rgvt[0]) = i;
    hr = pAutoFree->Invoke(dispidICOMPerformance_Test1, IID_NULL, 0, DISPATCH_METHOD, &dispparams,
      &vtResult, &excepinfo, &argerr);
    k = V_I4(&vtResult);
  }
    tmElapsed.Stop();
    vrgperfloc[3].sec[0] = tmElapsed.OutputTime();
  // Test2
  tmElapsed.Start();
    V_VT(&vtResult) = VT_HRESULT;
    for (i=0; i<cLoops; i++)
  {
    V_VT(&rgvt[0]) = VT_BSTR;
    V_BSTR(&rgvt[0]) = bstr1;
    hr = pAutoFree->Invoke(dispidICOMPerformance_Test23, IID_NULL, 0, DISPATCH_METHOD, &dispparams,
      &vtResult, &excepinfo, &argerr);
    k = V_I4(&vtResult);
  }
    tmElapsed.Stop();
    vrgperfloc[3].sec[1] = tmElapsed.OutputTime();
  // Test3
  tmElapsed.Start();
    V_VT(&vtResult) = VT_HRESULT;
    for (i=0; i<cLoops; i++)
  {
    V_VT(&rgvt[0]) = VT_BSTR;
    V_BSTR(&rgvt[0]) = bstr2;
    hr = pAutoFree->Invoke(dispidICOMPerformance_Test23, IID_NULL, 0, DISPATCH_METHOD, &dispparams,
      &vtResult, &excepinfo, &argerr);
    k = V_I4(&vtResult);
  }
    tmElapsed.Stop();
    vrgperfloc[3].sec[2] = tmElapsed.OutputTime();

  // Remote
  if(vfRemote)
  {
    // Test1
    tmElapsed.Start();
    V_VT(&vtResult) = VT_HRESULT;
    for (i=0; i<cLoops; i++)
    {
      V_VT(&rgvt[0]) = VT_I4;
      V_I4(&rgvt[0]) = i;
      hr = pAutoFreeRmt->Invoke(dispidICOMPerformance_Test1, IID_NULL, 0, DISPATCH_METHOD, &dispparams,
        &vtResult, &excepinfo, &argerr);
      k = V_I4(&vtResult);
    }
    tmElapsed.Stop();
    vrgperfrmt[3].sec[0] = tmElapsed.OutputTime();
    // Test2
    tmElapsed.Start();
    V_VT(&vtResult) = VT_HRESULT;
    for (i=0; i<cLoops; i++)
    {
      V_VT(&rgvt[0]) = VT_BSTR;
      V_BSTR(&rgvt[0]) = bstr1;
      hr = pAutoFreeRmt->Invoke(dispidICOMPerformance_Test23, IID_NULL, 0, DISPATCH_METHOD, &dispparams,
        &vtResult, &excepinfo, &argerr);
      k = V_I4(&vtResult);
    }
    tmElapsed.Stop();
    vrgperfrmt[3].sec[1] = tmElapsed.OutputTime();
    // Test3
    tmElapsed.Start();
    V_VT(&vtResult) = VT_HRESULT;
    for (i=0; i<cLoops; i++)
    {
      V_VT(&rgvt[0]) = VT_BSTR;
      V_BSTR(&rgvt[0]) = bstr2;
      hr = pAutoFreeRmt->Invoke(dispidICOMPerformance_Test23, IID_NULL, 0, DISPATCH_METHOD, &dispparams,
        &vtResult, &excepinfo, &argerr);
      k = V_I4(&vtResult);
    }
    tmElapsed.Stop();
    vrgperfrmt[3].sec[2] = tmElapsed.OutputTime();
  }
  SysFreeString(bstr1);
  SysFreeString(bstr2);
  return TRUE;
}

BOOL FreeFreeCOMTest ( int cLoops )

Definition at line 1337 of file ComPerf.Cpp.

{
  LONG    i, k;
    CTIMER  tmElapsed;
  BSTR bstr1, bstr2;
  bstr1 = SysAllocString(pszDesc1);
  bstr2 = SysAllocStringByteLen((const char *)pszDesc1, 4096);

  // Test1
    tmElapsed.Start();
    for (i=0; i<cLoops; i++)
    k = (LONG)pCOMFree->Test1(i);
    tmElapsed.Stop();
    vrgperfloc[2].sec[0] = tmElapsed.OutputTime();
  // Test2
    tmElapsed.Start();
    for (i=0; i<cLoops; i++)
    k = (LONG)pCOMFree->Test23(bstr1);
    tmElapsed.Stop();
    vrgperfloc[2].sec[1] = tmElapsed.OutputTime();
  // Test3
    tmElapsed.Start();
  for (i=0; i<cLoops; i++)
  {
    k = (LONG)pCOMFree->Test23(bstr2);
  }
    tmElapsed.Stop();
    vrgperfloc[2].sec[2] = tmElapsed.OutputTime();

  // Remote
  if(vfRemote)
  {
    // Test1
    tmElapsed.Start();
    for (i=0; i<cLoops; i++)
    k = (LONG)pCOMFreeRmt->Test1(i);
    tmElapsed.Stop();
    vrgperfrmt[2].sec[0] = tmElapsed.OutputTime();
    // Test2
    tmElapsed.Start();
    for (i=0; i<cLoops; i++)
      k = (LONG)pCOMFreeRmt->Test23(bstr1);
    tmElapsed.Stop();
    vrgperfrmt[2].sec[1] = tmElapsed.OutputTime();
    // Test3
    tmElapsed.Start();
    for (i=0; i<cLoops; i++)
    {
      k = (LONG)pCOMFreeRmt->Test23(bstr2);
    }
    tmElapsed.Stop();
    vrgperfrmt[2].sec[2] = tmElapsed.OutputTime();
  }

  SysFreeString(bstr1);
  SysFreeString(bstr2);
  return TRUE;
}

int __cdecl main | ( | int | argc,
 |  | CHAR ** | argv
 | ) |  |

Definition at line 225 of file ComPerf.Cpp.

{
    HRESULT hr;
    int     i;
    DWORD   dwRegister = 0;
    COSERVERINFO csi, *pcsi=NULL;
    WCHAR wsz [MAX_PATH];
  CClassFactory   *pcf = NULL;
  LPCLASSFACTORY pcflocal = NULL;
  LPCLASSFACTORY pcfrmt = NULL;
  LPCLIENTSECURITY pclntsec = NULL;
  TCHAR    rgch[32];

  DWORD AuthnSvc, AuthzSvc, AuthnLvl, ImpLvl, Capabilities;

  if(!FAutoRegister())
  {
    exit(-1);
  }
  // parse command-line
    if (argc > 1)
    {
  // either started as server or passing in server name
  MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, argv[1], -1,
      wsz, MAX_PATH);

    // register the CTestCOMPerformance class in the registry so
    // that the client can create instances of the server
    if((!lstrcmpW(L"-?", wsz)) || (!lstrcmpW(L"/?", wsz)))
    {
      Usage();
      return 0;
    }
    if(!lstrcmpW(L"-Embedding", wsz))
      vfServer = TRUE;
    else
    {
      // allow a machine-name as the command-line argument
      csi.dwReserved1 = 0;
      csi.pAuthInfo = NULL;
      csi.dwReserved2 = 0;
      csi.pwszName = wsz;
      pcsi = &csi;
      vfRemote = TRUE;
    }
    }
  if(vfServer)
    Message(szTitleServer, S_OK);
  else
    Message(szTitleClient, S_OK);

    // initialize COM
    hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
    if (FAILED(hr))
    {
  Message(TEXT("CoInitializeEx"), hr);
    exit(hr);
    }

  // create an IStream to be used for marshalling interfaces
    hr = CreateStreamOnHGlobal(NULL, TRUE, &vpstmMarshalling);
    if (FAILED(hr))
  {
    Message(TEXT("CreateStreamOnHGlobal"), hr);
  goto LCleanup;
  }

    if (vfServer)
    {
  // create the threads and synchronization events
  // which the server will need
  for (i=0; i<cServerThreads; i++)
  {
      // create the thread suspended so its event can be
      // created using its thread-id and it will be able to
      // use it as soon as it runs
      vrghThread[i] = CreateThread(NULL,
    0,
    (LPTHREAD_START_ROUTINE)&ServerThreadProc,
    0,
    CREATE_SUSPENDED,
    &vrgtid[i]);
      if (vrghThread[i] == NULL)
    {
    hr = GetLastError();
    goto LCleanup;
    }

      // this event signals to a worker thread to create a new CTestCOMPerformance
      wsprintf(rgch, TEXT("Thread_%d"), vrgtid[i]);
      vrghEvent[i] = CreateEvent(NULL, FALSE, FALSE, rgch);
      if (vrghEvent[i] == NULL)
      {
    hr = GetLastError();
    goto LCleanup;
      }
      // now that the event is available, let the thread run
      ResumeThread(vrghThread[i]);
    }
    hKillSvr = CreateEvent(NULL, FALSE, FALSE, NULL);
  if (hKillSvr == NULL)
      {
      hr = GetLastError();
      goto LCleanup;
   }

  // this signals the status of a worker threads creation after
  // receiving its create signal via vrghEvent[i]
  vhEventServer = CreateEvent(NULL, FALSE, FALSE, TEXT("Server"));
  if (vhEventServer == NULL)
  {
      hr = GetLastError();
      goto LCleanup;
  }
    pcf = new CClassFactory;
    if(pcf == NULL)
  {
      hr = E_OUTOFMEMORY;
      goto LCleanup;
  }

  // register the class-factory with COM
  hr = CoRegisterClassObject(CLSID_CTestCOMPerformance,
      (IUnknown *)pcf,
      CLSCTX_LOCAL_SERVER,
      REGCLS_MULTIPLEUSE,
      &dwRegister);
  if (FAILED(hr))
    {
      Message(TEXT("CoRegisterClassObject"), hr);
      goto LCleanup;
    }

    Message(TEXT("Server waiting"), S_OK);
    WaitForSingleObject(hKillSvr, INFINITE);
    Sleep(7000); // allow time for last Release call processing
    delete pcf;
    pcf = NULL;
  }

    else // client case
    {
    pCOMApt = pCOMFree = pCOMAptRmt =pCOMFreeRmt = NULL;
    pAutoFree = pAutoFree = pAutoAptRmt = pAutoFreeRmt = NULL;

    // get local class factory
  hr = CoGetClassObject(CLSID_CTestCOMPerformance, CLSCTX_LOCAL_SERVER, NULL,
      IID_IClassFactory, (void**)&pcflocal);
    if(FAILED(hr))
    {
      Message(TEXT("CoGetClassObject:"), hr);
      goto LCleanup;
    }
    // apt-model obj
    hr = pcflocal->CreateInstance(NULL, IID_ICOMPerformance, (void**)&pCOMApt);
  if (FAILED(hr))
    {
      Message(TEXT("Create Local Apt Instance:"), hr);
      goto LCleanup;
    }
    hr = pCOMApt->QueryInterface(IID_IDispatch, (void**)&pAutoApt);
    if (FAILED(hr))
    {
      Message(TEXT("QI for pAutoApt:"), hr);
      goto LCleanup;
    }
    // get free-threaded obj
    hr = pcflocal->CreateInstance(NULL, IID_ICOMPerformance, (void**)&pCOMFree);
  if (FAILED(hr))
    {
      Message(TEXT("Create Local Free Instance"), hr);
      goto LCleanup;
    }
    hr = pCOMFree->QueryInterface(IID_IDispatch, (void**)&pAutoFree);
    if (FAILED(hr))
    {
      Message(TEXT("QI for pAutoFree"), hr);
      goto LCleanup;
    }
    hr = pcflocal->Release();
    pcflocal = NULL;
    if(vfRemote)
    {
      hr = CoGetClassObject(CLSID_CTestCOMPerformance, CLSCTX_REMOTE_SERVER, pcsi,
        IID_IClassFactory, (void**)&pcfrmt);
      if(FAILED(hr))
      {
        Message(TEXT("CoGetClassObject for remote CF"), hr);
        vfRemote = FALSE;
        goto LContinue;
      }
      // apt-model obj
      hr = pcfrmt->CreateInstance(NULL, IID_ICOMPerformance, (void**)&pCOMAptRmt);
      if (FAILED(hr))
      {
        Message(TEXT("Create Remote Instance"), hr);
        goto LCleanup;
      }
      hr = pCOMAptRmt->QueryInterface(IID_IDispatch, (void**)&pAutoAptRmt);
      if (FAILED(hr))
      {
        Message(TEXT("QI for pAutoAptFreeRmt"), hr);
        goto LCleanup;
      }
      // get free-threaded obj
      hr = pcfrmt->CreateInstance(NULL, IID_ICOMPerformance, (void**)&pCOMFreeRmt);
      if (FAILED(hr))
      {
        Message(TEXT("Create Remote Free Instance"), hr);
        goto LCleanup;
      }
      hr = pCOMFreeRmt->QueryInterface(IID_IDispatch, (void**)&pAutoFreeRmt);
      if (FAILED(hr))
      {
        Message(TEXT("QI for pAutoFreeFreeRmt"), hr);
        goto LCleanup;
      }
      hr = pcfrmt->Release();
      pcfrmt = NULL;
    }
LContinue:
    // create apartment thread for client
    DWORD   dwClienttid;
  // create the thread suspended so its event can be
  // created using its thread-id and it will be able to
  // use it as soon as it runs
  HANDLE hClientThread = CreateThread(NULL,
      0,
      (LPTHREAD_START_ROUTINE)&ClientThreadProc,
      0,
      CREATE_SUSPENDED,
      &dwClienttid);
  if (hClientThread == NULL)
  {
      hr = GetLastError();
      goto LCleanup;
  }
    wsprintf(rgch, TEXT("Thread_%d"), dwClienttid);

    vhEventCliStart = CreateEvent(NULL, FALSE, FALSE, rgch);
  if (vhEventCliStart == NULL)
  {
      hr = GetLastError();
      goto LCleanup;
  }
    vhEventCliDone = CreateEvent(NULL, FALSE, FALSE, NULL);
  if (vhEventCliDone == NULL)
  {
      hr = GetLastError();
      goto LCleanup;
  }
    // Marshall local apt thread
    hr = vpstmMarshalling->Seek(bZero, STREAM_SEEK_SET, NULL);
  if (FAILED(hr))
      throw hr;
  hr = CoMarshalInterface(vpstmMarshalling,
      IID_IUnknown,
      (ICOMPerformance*)pCOMApt,
      MSHCTX_INPROC,
      NULL,
      MSHLFLAGS_NORMAL);
  if (FAILED(hr))
      throw hr;
    // now that the event is available, let the thread run
  ResumeThread(hClientThread);
    SetEvent(vhEventCliStart);
    WaitForSingleObject(vhEventCliDone, INFINITE);

    if(vfRemote && NULL != pCOMAptRmt)
    {
      // Marshall local apt thread
      hr = vpstmMarshalling->Seek(bZero, STREAM_SEEK_SET, NULL);
      if (FAILED(hr))
        throw hr;
      hr = CoMarshalInterface(vpstmMarshalling,
        IID_IUnknown,
        (ICOMPerformance*)pCOMAptRmt,
        MSHCTX_INPROC,
        NULL,
        MSHLFLAGS_NORMAL);
      if (FAILED(hr))
        throw hr;
      SetEvent(vhEventCliStart);
      WaitForSingleObject(vhEventCliDone, INFINITE);
    }

    // Test
    _tprintf(TEXT("Output in Calls per sec\n"));
    _tprintf(TEXT("DEF Sec:\t\tLOCAL\t\t\tREMOTE\n"));
    // Do all tests
    if(!DoTests())
      goto LCleanup;
    // Up security on proxies
    // Get current security
    hr = pCOMApt->QueryInterface(IID_IClientSecurity, (void**)&pclntsec);
    hr = pclntsec->QueryBlanket(pCOMApt, &AuthnSvc, &AuthzSvc, NULL, &AuthnLvl, &ImpLvl, NULL,
      &Capabilities);

    _tprintf(TEXT("Increasing local security from AuthnLvl:%d  ImpLvl:%d\n"), AuthnLvl, ImpLvl);

    hr = pclntsec->SetBlanket(pCOMApt, AuthnSvc, AuthzSvc, NULL, 6,
        4, NULL, Capabilities);
    hr = pclntsec->QueryBlanket(pCOMApt, &AuthnSvc, &AuthzSvc, NULL, &AuthnLvl, &ImpLvl, NULL,
      &Capabilities);

    _tprintf(TEXT("Local security is now AuthnLvl:%d  ImpLvl:%d\n"), AuthnLvl, ImpLvl);

    pclntsec->Release();
    pclntsec = NULL;
    hr = pCOMFree->QueryInterface(IID_IClientSecurity, (void**)&pclntsec);
    hr = pclntsec->SetBlanket(pCOMFree, AuthnSvc, AuthzSvc, NULL, 6,
        4, NULL, Capabilities);
    pclntsec->Release();
    pclntsec = NULL;
    hr = pAutoApt->QueryInterface(IID_IClientSecurity, (void**)&pclntsec);
    hr = pclntsec->SetBlanket(pAutoApt, AuthnSvc, AuthzSvc, NULL, 6,
        4, NULL, Capabilities);
    pclntsec->Release();
    pclntsec = NULL;
    hr = pAutoFree->QueryInterface(IID_IClientSecurity, (void**)&pclntsec);
    hr = pclntsec->SetBlanket(pAutoFree, AuthnSvc, AuthzSvc, NULL, 6,
        4, NULL, Capabilities);
    pclntsec->Release();
    pclntsec = NULL;
    if(vfRemote)
    {
      hr = pCOMAptRmt->QueryInterface(IID_IClientSecurity, (void**)&pclntsec);
      hr = pclntsec->QueryBlanket(pCOMAptRmt, &AuthnSvc, &AuthzSvc, NULL, &AuthnLvl, &ImpLvl, NULL,
      &Capabilities);

      _tprintf(TEXT("Increasing remote security from AuthnLvl:%d  ImpLvl:%d\n"), AuthnLvl, ImpLvl);

      hr = pclntsec->SetBlanket(pCOMAptRmt, AuthnSvc, AuthzSvc, NULL, 6,
        4, NULL, Capabilities);

      _tprintf(TEXT("Remote security is now AuthnLvl:%d  ImpLvl:%d\n"), AuthnLvl, ImpLvl);

      pclntsec->Release();
      pclntsec = NULL;
      hr = pCOMFreeRmt->QueryInterface(IID_IClientSecurity, (void**)&pclntsec);
      hr = pclntsec->SetBlanket(pCOMFreeRmt, AuthnSvc, AuthzSvc, NULL, 6,
        4, NULL, Capabilities);
      pclntsec->Release();
      pclntsec = NULL;
      hr = pAutoAptRmt->QueryInterface(IID_IClientSecurity, (void**)&pclntsec);
      hr = pclntsec->SetBlanket(pAutoAptRmt, AuthnSvc, AuthzSvc, NULL, 6,
        4, NULL, Capabilities);
      pclntsec->Release();
      pclntsec = NULL;
      hr = pAutoFreeRmt->QueryInterface(IID_IClientSecurity, (void**)&pclntsec);
      hr = pclntsec->SetBlanket(pAutoFreeRmt, AuthnSvc, AuthzSvc, NULL, 6,
        4, NULL, Capabilities);
      pclntsec->Release();
      pclntsec = NULL;
    }
    // Do all tests with FULL sec
    // Apt to Apt first
    // Marshall local apt thread
    hr = vpstmMarshalling->Seek(bZero, STREAM_SEEK_SET, NULL);
  if (FAILED(hr))
      throw hr;
  hr = CoMarshalInterface(vpstmMarshalling,
      IID_IUnknown,
      (ICOMPerformance*)pCOMApt,
      MSHCTX_INPROC,
      NULL,
      MSHLFLAGS_NORMAL);
  if (FAILED(hr))
      throw hr;
    // now that the event is available, let the thread run
  ResumeThread(hClientThread);
    SetEvent(vhEventCliStart);
    WaitForSingleObject(vhEventCliDone, INFINITE);

    if(vfRemote && NULL != pCOMAptRmt)
    {
      // Marshall local apt thread
      hr = vpstmMarshalling->Seek(bZero, STREAM_SEEK_SET, NULL);
      if (FAILED(hr))
        throw hr;
      hr = CoMarshalInterface(vpstmMarshalling,
        IID_IUnknown,
        (ICOMPerformance*)pCOMAptRmt,
        MSHCTX_INPROC,
        NULL,
        MSHLFLAGS_NORMAL);
      if (FAILED(hr))
        throw hr;
      SetEvent(vhEventCliStart);
      WaitForSingleObject(vhEventCliDone, INFINITE);
    }
    _tprintf(TEXT("Modified Sec:\t\tLOCAL\t\t\tREMOTE\n"));
    DoTests();
    }
LCleanup:
  if (vpstmMarshalling != NULL)
      vpstmMarshalling->Release();
  if (vfServer)
    {
    // we explicitly don't clean up threads and events
    if (dwRegister != 0)
      CoRevokeClassObject(dwRegister);
    if(NULL != pcf)
      delete pcf;
    }
    else // client
  {
    // client case: release objects
    if(NULL != pcflocal)
      hr = pcflocal->Release();
    if(NULL != pcfrmt)
      hr = pcfrmt->Release();
    if(NULL != pCOMFree)
      hr = pCOMFree->Release();
    if(NULL != pAutoFree)
      hr = pAutoFree->Release();
    if(NULL != pCOMApt)
      hr = pCOMApt->Release();
    if(NULL != pAutoApt)
      hr = pAutoApt->Release();
    if(NULL != pCOMFreeRmt)
      hr = pCOMFreeRmt->Release();
    if(NULL != pAutoFreeRmt)
      hr = pAutoFreeRmt->Release();
    if(NULL != pCOMAptRmt)
      hr = pCOMAptRmt->Release();
    if(NULL != pAutoAptRmt)
      hr = pAutoAptRmt->Release();
    }
    CoUninitialize();
    return hr;
}  // main

void Message | ( | LPTSTR | szPrefix,
 |  | HRESULT | hr
 | ) |  |

Definition at line 193 of file ComPerf.Cpp.

{
    LPTSTR   szMessage;

    if (hr == S_OK)
    {
  _tprintf(szPrefix);
  _tprintf(TEXT("\n"));
  return;
    }

    if (HRESULT_FACILITY(hr) == FACILITY_WINDOWS)
  hr = HRESULT_CODE(hr);

    FormatMessage(
  FORMAT_MESSAGE_ALLOCATE_BUFFER |
  FORMAT_MESSAGE_FROM_SYSTEM,
  NULL,
  hr,
  MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), //The user default language
  (LPTSTR)&szMessage,
  0,
  NULL );

  _tprintf(TEXT("%s: %s(%lx)\n"), szPrefix, szMessage, hr);
    LocalFree(szMessage);
}  // Message

LRESULT ServerThreadProc ( LPARAM lParam )

Definition at line 802 of file ComPerf.Cpp.

{
    HRESULT hr;
    MSG     msg;
    int     iThread;

    // figure out which thread this is: it needs its synchronization event
    for (iThread=0; iThread<cServerThreads; iThread++)
  {
  if (vrgtid[iThread] == GetCurrentThreadId())
      break;
  }
    if (iThread==cServerThreads)
  return E_UNEXPECTED;

    // initialize COM
  if((0 == iThread) || (2 == iThread))
  {
    hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
    Message(TEXT("Apartment Thread"), hr);
  }
  else
  {
    hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
    Message(TEXT("Free-threaded Model"), hr);
  }
    if (FAILED(hr))
  {
  MessageBeep(0);
  return hr;
  }

    // apartment message/event loop
    // here worker message loops last forever. in situations without a
    // static number of worker threads, the loop could easily be terminated by
    // WM_QUITs sent from the main thread which might manage the worker thread
    // pool more carefully.
    while (TRUE)
  {
  DWORD dwWaitResult;

  // wait for any message sent or posted to this queue
  // or for one of the passed handles to become signaled
  dwWaitResult = MsgWaitForMultipleObjects(1, &vrghEvent[iThread],
      FALSE, INFINITE, QS_ALLINPUT);

  // result tells us the type of event we have:
  // a message or a signaled handle

  // if there are one or more messages in the queue ...
  if (dwWaitResult == (WAIT_OBJECT_0 + 1))
      {
      // dispatch all of the messages in this next loop
      // (here is where we'd check for WM_QUITs to end this
      // worker thread if we wanted to)
      while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
    DispatchMessage(&msg);
      }
  else
      {
      // this thread was signaled to create a new object
      try
    {
    LPUNKNOWN   punk;

    // create a new CTestCOMPerformance
    punk = (ICOMPerformance *)new CTestCOMPerformance;
    if (punk == NULL)
        throw E_OUTOFMEMORY;

    hr = vpstmMarshalling->Seek(bZero, STREAM_SEEK_SET, NULL);
    if (FAILED(hr))
        throw hr;
    hr = CoMarshalInterface(vpstmMarshalling,
        IID_IUnknown,
        punk,
        MSHCTX_INPROC,
        NULL,
        MSHLFLAGS_NORMAL);
    if (FAILED(hr))
        throw hr;

    // punk is now referenced by its marshal-data in vpstmMarshalling.
    // we release our local reference here so the unmarshaller will
    // have the sole reference. a common mistake is to forget this
    // release and end up with orphaned objects in the server.
    punk->Release();
    vhrThreadStatus = S_OK;
    }
      catch (HRESULT hr)
    {
    vhrThreadStatus = hr;
    }
      SetEvent(vhEventServer);
      }

  }

    CoUninitialize();
    return msg.wParam;
}  // ServerThreadProc

void Usage ( void )

Definition at line 1619 of file ComPerf.Cpp.

{
  _tprintf(TEXT("Usage: COMPERF [machine name | IP address | /? | -?]\n\n"));
  _tprintf(TEXT("/?\t\t\tDisplays this help screen.\n"));
  _tprintf(TEXT("machine name\t\tName of remote machine.\n"));
  _tprintf(TEXT("IP address\t\tIP address of remote machine.\n\n"));
  _tprintf("%s", PURPOSE);
}

Variable Documentation

const LARGE_INTEGER bZero = {0,0}

Definition at line 58 of file ComPerf.Cpp.

UINT g_cObjectCount = 0

Definition at line 89 of file ComPerf.Cpp.

HANDLE hKillSvr

Definition at line 87 of file ComPerf.Cpp.

INTERFACEDATA interfacedata = { methoddata, 2 }

Definition at line 64 of file ComPerf.Cpp.

METHODDATA methoddata[2]
Initial value:
 {{L"Test1", &paramdata[0], 11, 3, CC_CDECL, 1, DISPATCH_METHOD, VT_I4},
      {L"Test23", &paramdata[1], 12, 4, CC_CDECL, 1, DISPATCH_METHOD, VT_I4}}

Definition at line 62 of file ComPerf.Cpp.

PARAMDATA paramdata[2] = {{L"i", VT_I4},{L"bstr", VT_BSTR}}

Definition at line 61 of file ComPerf.Cpp.

LPDISPATCH pAutoApt

Definition at line 129 of file ComPerf.Cpp.

LPDISPATCH pAutoAptRmt

Definition at line 129 of file ComPerf.Cpp.

LPDISPATCH pAutoFree

Definition at line 129 of file ComPerf.Cpp.

LPDISPATCH pAutoFreeRmt

Definition at line 129 of file ComPerf.Cpp.

LPCOMPERFORMANCE pCOMApt

Definition at line 128 of file ComPerf.Cpp.

LPCOMPERFORMANCE pCOMAptRmt

Definition at line 128 of file ComPerf.Cpp.

LPCOMPERFORMANCE pCOMFree

Definition at line 128 of file ComPerf.Cpp.

LPCOMPERFORMANCE pCOMFreeRmt

Definition at line 128 of file ComPerf.Cpp.

LPWSTR pszDesc1 = "String is passed to Test methd of ICOMPerformance"

Definition at line 93 of file ComPerf.Cpp.

BOOL vfRemote = FALSE

Definition at line 80 of file ComPerf.Cpp.

BOOL vfServer = FALSE

Definition at line 79 of file ComPerf.Cpp.

HANDLE vhEventCliDone

Definition at line 84 of file ComPerf.Cpp.

HANDLE vhEventCliStart

Definition at line 86 of file ComPerf.Cpp.

HANDLE vhEventServer

Definition at line 85 of file ComPerf.Cpp.

HRESULT vhrThreadStatus

Definition at line 91 of file ComPerf.Cpp.

UINT viNextThread

Definition at line 88 of file ComPerf.Cpp.

LPSTREAM vpstmMarshalling

Definition at line 90 of file ComPerf.Cpp.

HANDLE vrghEvent[cServerThreads]

Definition at line 83 of file ComPerf.Cpp.

HANDLE vrghThread[cServerThreads]

Definition at line 81 of file ComPerf.Cpp.

PERF vrgperfloc[]
Initial value:
 {
    { TEXT("COM FreeToApt"), {-1.0f,-1.0f,-1.0f}},
    { TEXT("IDisp FreeToApt"), {-1.0f,-1.0f,-1.0f}},
    { TEXT("COM FreeTo Free"), {-1.0f,-1.0f,-1.0f}},
    { TEXT("IDispFreeToFree"), {-1.0f,-1.0f,-1.0f}},
    { TEXT("COM AptToApt"), {-1.0f,-1.0f,-1.0f}},
    { TEXT("IDispAptToApt"), {-1.0f,-1.0f,-1.0f}},
    { NULL, {-1.0f,-1.0f,-1.0f}} }

Definition at line 95 of file ComPerf.Cpp.

PERF vrgperfrmt[]
Initial value:
 {
    { TEXT("COM FreeToApt"), {-1.0f,-1.0f,-1.0f}},
    { TEXT("IDisp FreeToApt"), {-1.0f,-1.0f,-1.0f}},
    { TEXT("COM FreeTo Free"), {-1.0f,-1.0f,-1.0f}},
    { TEXT("IDispFreeToFree"), {-1.0f,-1.0f,-1.0f}},
    { TEXT("COM AptToApt"), {-1.0f,-1.0f,-1.0f}},
    { TEXT("IDispAptToApt"), {-1.0f,-1.0f,-1.0f}},
    { NULL, {-1.0f,-1.0f,-1.0f}} }

Definition at line 104 of file ComPerf.Cpp.

DWORD vrgtid[cServerThreads]

Definition at line 82 of file ComPerf.Cpp.

Generated on Wed Nov 13 2024 16:53:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/ComPerf/psperf.Idl File Reference

  • Com
  • Fundamentals
  • DCom
  • ComPerf
Functions

psperf.Idl File Reference

Go to the source code of this file.

Functions

HRESULT | Test1 ([in] int l)
HRESULT | Test23 ([in] BSTR szDesc)

Function Documentation

HRESULT Test1 ( [in] int l )
HRESULT Test23 ( [in] BSTR szDesc )
Generated on Wed Nov 13 2024 16:53:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/DComPerm/AclMgmt.Cpp File Reference

  • Com
  • Fundamentals
  • DCom
  • DComPerm
Functions

AclMgmt.Cpp File Reference

#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include <tchar.h>
#include "ntsecapi.h"
#include "dcomperm.h"

Go to the source code of this file.

Functions

DWORD | AddAccessAllowedACEToACL (PACL *paclOrig, DWORD dwAccessMask, LPTSTR tszPrincipal)
DWORD | AddAccessDeniedACEToACL (PACL *paclOrig, DWORD dwAccessMask, LPTSTR tszPrincipal)
DWORD | CopyACL (PACL paclOld, PACL paclNew)
DWORD | RemovePrincipalFromACL (PACL paclOrig, LPTSTR tszPrincipal, DWORD fAceType)
DWORD | UpdatePrincipalInACL (PACL paclOrig, LPTSTR tszPrincipal, DWORD dwAccessMask, BOOL fRemove, DWORD fAceType)

Function Documentation

DWORD AddAccessAllowedACEToACL | ( | PACL * | paclOrig,
 |  | DWORD | dwAccessMask,
 |  | LPTSTR | tszPrincipal
 | ) |  |

Definition at line 150 of file AclMgmt.Cpp.

{
    ACL_SIZE_INFORMATION  aclSizeInfo   = {0};
    int                   cbAclSize     = 0;
    DWORD                 dwReturnValue = ERROR_SUCCESS;
    PSID                  psidPrincipal = NULL;
    PACL                  paclOld       = NULL;
    PACL                  paclNew       = NULL;

    if(!paclOrig) return ERROR_BAD_ARGUMENTS;

    paclOld = *paclOrig;

    dwReturnValue = GetPrincipalSID (tszPrincipal, &psidPrincipal);
    if (dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

    if(!GetAclInformation (paclOld,
                           (LPVOID) &aclSizeInfo,
                           (DWORD) sizeof (ACL_SIZE_INFORMATION),
                           AclSizeInformation))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    cbAclSize = aclSizeInfo.AclBytesInUse +
              sizeof (ACL) + sizeof (ACCESS_ALLOWED_ACE) +
              GetLengthSid (psidPrincipal) - sizeof (DWORD);

    paclNew = (PACL) malloc(cbAclSize);
    if(!paclNew)
    {
        dwReturnValue = ERROR_OUTOFMEMORY;
        goto CLEANUP;
    }

    if (!InitializeAcl (paclNew, cbAclSize, ACL_REVISION))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    dwReturnValue = CopyACL (paclOld, paclNew);
    if (dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

    if (!AddAccessAllowedAce (paclNew,
                              ACL_REVISION2,
                              dwAccessMask,
                              psidPrincipal))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    *paclOrig = paclNew;

CLEANUP:

    if(dwReturnValue != ERROR_SUCCESS && paclNew)
    {
        free(paclNew);
    }

    if(psidPrincipal) free (psidPrincipal);

    return dwReturnValue;
}

DWORD AddAccessDeniedACEToACL | ( | PACL * | paclOrig,
 |  | DWORD | dwAccessMask,
 |  | LPTSTR | tszPrincipal
 | ) |  |

Definition at line 76 of file AclMgmt.Cpp.

{
    ACL_SIZE_INFORMATION  aclSizeInfo   = {0};
    int                   cbAclSize     = 0;
    DWORD                 dwReturnValue = ERROR_SUCCESS;
    PSID                  psidPrincipal = NULL;
    PACL                  paclOld       = NULL;
    PACL                  paclNew       = NULL;

    if(!paclOrig) return ERROR_BAD_ARGUMENTS;

    paclOld = *paclOrig;

    dwReturnValue = GetPrincipalSID (tszPrincipal, &psidPrincipal);
    if (dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

    if(!GetAclInformation (paclOld,
                           (LPVOID) &aclSizeInfo,
                           (DWORD) sizeof (ACL_SIZE_INFORMATION),
                           AclSizeInformation))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    cbAclSize = aclSizeInfo.AclBytesInUse +
              sizeof (ACL) + sizeof (ACCESS_DENIED_ACE) +
              GetLengthSid (psidPrincipal) - sizeof (DWORD);

    paclNew = (PACL) malloc(cbAclSize);
    if(!paclNew)
    {
        dwReturnValue = ERROR_OUTOFMEMORY;
        goto CLEANUP;
    }

    if (!InitializeAcl (paclNew, cbAclSize, ACL_REVISION))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    if (!AddAccessDeniedAce (paclNew,
                             ACL_REVISION2,
                             dwAccessMask,
                             psidPrincipal))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    dwReturnValue = CopyACL (paclOld, paclNew);
    if (dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

    *paclOrig = paclNew;

CLEANUP:

    if(psidPrincipal) free (psidPrincipal);

    return dwReturnValue;
}

DWORD CopyACL | ( | PACL | paclOld,
 |  | PACL | paclNew
 | ) |  |

Definition at line 32 of file AclMgmt.Cpp.

{
    ACL_SIZE_INFORMATION  aclSizeInfo = {0};
    LPVOID                pvAce       = NULL;
    ACE_HEADER            *pAceHeader = NULL;
    ULONG                 i;

    if(!GetAclInformation (paclOld,
                           (LPVOID) &aclSizeInfo,
                           (DWORD) sizeof (aclSizeInfo),
                           AclSizeInformation))
    {
        return GetLastError();
    }

    // Copy all of the ACEs to the new ACL
    for (i = 0; i < aclSizeInfo.AceCount; i++)
    {
        // Get the ACE and header info
        if (!GetAce (paclOld, i, &pvAce))
            return GetLastError();

        pAceHeader = (ACE_HEADER *) pvAce;

        // Add the ACE to the new list
        if (!AddAce (paclNew, ACL_REVISION, 0xffffffff, pvAce, pAceHeader->AceSize))
            return GetLastError();
    }

    return ERROR_SUCCESS;
}

DWORD RemovePrincipalFromACL | ( | PACL | paclOrig,
 |  | LPTSTR | tszPrincipal,
 |  | DWORD | fAceType
 | ) |  |

Definition at line 399 of file AclMgmt.Cpp.

{
    ACL_SIZE_INFORMATION    aclSizeInfo        = {0};
    LONG                   i;
    LPVOID                  pvAce              = NULL;
    ACCESS_ALLOWED_ACE      *pAccessAllowedAce = NULL;
    ACCESS_DENIED_ACE       *pAccessDeniedAce  = NULL;
    SYSTEM_AUDIT_ACE        *pSystemAuditAce   = NULL;
    PSID                    psidPrincipal      = NULL;
    DWORD                   dwReturnValue      = ERROR_SUCCESS;
    ACE_HEADER              *pAceHeader        = NULL;
    DWORD                   dwFoundValue       = ERROR_FILE_NOT_FOUND;

    dwReturnValue = GetPrincipalSID (tszPrincipal, &psidPrincipal);
    if (dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

    if(!GetAclInformation (paclOrig,
                           (LPVOID) &aclSizeInfo,
                           (DWORD) sizeof (ACL_SIZE_INFORMATION),
                           AclSizeInformation))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    for (i = aclSizeInfo.AceCount-1; i >= 0; i--)
    {
        if (!GetAce (paclOrig, i, &pvAce))
        {
            dwReturnValue = GetLastError();
            goto CLEANUP;
        }

        pAceHeader = (ACE_HEADER *) pvAce;

        if ((fAceType == ACCESS_ALLOWED_ACE_TYPE ||
             fAceType == ACE_TYPE_ALL) &&
            pAceHeader->AceType == ACCESS_ALLOWED_ACE_TYPE)
        {
            pAccessAllowedAce = (ACCESS_ALLOWED_ACE *) pvAce;

            if (EqualSid (psidPrincipal, (PSID) &pAccessAllowedAce->SidStart))
            {
                if(pAccessAllowedAce->Mask & SPECIFIC_RIGHTS_ALL)
                {
                    DeleteAce (paclOrig, i);
                }
                dwFoundValue = ERROR_SUCCESS;
            }
        }
        else if ((fAceType == ACCESS_DENIED_ACE_TYPE ||
                  fAceType == ACE_TYPE_ALL) &&
                 pAceHeader->AceType == ACCESS_DENIED_ACE_TYPE)
        {
            pAccessDeniedAce = (ACCESS_DENIED_ACE *) pvAce;

            if (EqualSid (psidPrincipal, (PSID) &pAccessDeniedAce->SidStart))
            {
                if(pAccessDeniedAce->Mask & SPECIFIC_RIGHTS_ALL)
                {
                    DeleteAce (paclOrig, i);
                }
                dwFoundValue = ERROR_SUCCESS;
            }
        }
        else if ((fAceType == SYSTEM_AUDIT_ACE_TYPE ||
                  fAceType == ACE_TYPE_ALL) &&
                 pAceHeader->AceType == SYSTEM_AUDIT_ACE_TYPE)
        {
            pSystemAuditAce = (SYSTEM_AUDIT_ACE *) pvAce;

            if (EqualSid (psidPrincipal, (PSID) &pSystemAuditAce->SidStart))
            {
                if(pSystemAuditAce->Mask & SPECIFIC_RIGHTS_ALL)
                {
                    DeleteAce (paclOrig, i);
                }
                dwFoundValue = ERROR_SUCCESS;
            }
        }
    }

CLEANUP:

    if(psidPrincipal) free (psidPrincipal);

    if(dwReturnValue == ERROR_SUCCESS) dwReturnValue = dwFoundValue;

    return dwReturnValue;
}

DWORD UpdatePrincipalInACL | ( | PACL | paclOrig,
 |  | LPTSTR | tszPrincipal,
 |  | DWORD | dwAccessMask,
 |  | BOOL | fRemove,
 |  | DWORD | fAceType
 | ) |  |

Definition at line 229 of file AclMgmt.Cpp.

{
    ACL_SIZE_INFORMATION    aclSizeInfo        = {0};
    LONG                   i;
    LPVOID                  pvAce              = NULL;
    ACCESS_ALLOWED_ACE      *pAccessAllowedAce = NULL;
    ACCESS_DENIED_ACE       *pAccessDeniedAce  = NULL;
    SYSTEM_AUDIT_ACE        *pSystemAuditAce   = NULL;
    PSID                    psidPrincipal      = NULL;
    DWORD                   dwReturnValue      = ERROR_SUCCESS;
    ACE_HEADER              *pAceHeader        = NULL;
    DWORD                   dwFoundValue       = ERROR_FILE_NOT_FOUND;

    //Construct a SID for this principal
    dwReturnValue = GetPrincipalSID (tszPrincipal, &psidPrincipal);
    if (dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

    if(!GetAclInformation (paclOrig,
                           (LPVOID) &aclSizeInfo,
                           (DWORD) sizeof (ACL_SIZE_INFORMATION),
                           AclSizeInformation))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    //Iterate through all of the ACEs in this ACL looking for a SID that corresponds
    //to the principal.
    for (i = aclSizeInfo.AceCount-1; i >= 0; i--)
    {
        if (!GetAce (paclOrig, i, &pvAce))
        {
            dwReturnValue = GetLastError();
            goto CLEANUP;
        }

        pAceHeader = (ACE_HEADER *) pvAce;

        if ((fAceType == ACCESS_ALLOWED_ACE_TYPE ||
             fAceType == ACE_TYPE_ALL) &&
            pAceHeader->AceType == ACCESS_ALLOWED_ACE_TYPE)
        {
            pAccessAllowedAce = (ACCESS_ALLOWED_ACE *) pvAce;

            if (EqualSid (psidPrincipal, (PSID) &pAccessAllowedAce->SidStart))
            {
                //We've found an ACE.  Let's modify the mask bits
                if(fRemove && (pAccessAllowedAce->Mask & SPECIFIC_RIGHTS_ALL))
                {
                    pAccessAllowedAce->Mask &= ~dwAccessMask;
                    //If there are any COM rights reamining we must ensure
                    //COM_RIGHTS_EXECUTE is set before leaving.
                    if(pAccessAllowedAce->Mask & (COM_RIGHTS_ACTIVATE_LOCAL  |
                                                  COM_RIGHTS_ACTIVATE_REMOTE |
                                                  COM_RIGHTS_EXECUTE_LOCAL   |
                                                  COM_RIGHTS_EXECUTE_REMOTE))
                    {
                        pAccessAllowedAce->Mask |= COM_RIGHTS_EXECUTE;
                    }
                    else if((pAccessAllowedAce->Mask & SPECIFIC_RIGHTS_ALL) == 0)
                    {
                        //If there are no more specific rights on this ACE we
                        //may delete it.
                        DeleteAce (paclOrig, i);
                    }

                }
                else
                {
                    pAccessAllowedAce->Mask |= dwAccessMask;
                }
                dwFoundValue = ERROR_SUCCESS;
            }
        }
        else if ((fAceType == ACCESS_DENIED_ACE_TYPE ||
                  fAceType == ACE_TYPE_ALL) &&
                 pAceHeader->AceType == ACCESS_DENIED_ACE_TYPE)
        {
            pAccessDeniedAce = (ACCESS_DENIED_ACE *) pvAce;

            if (EqualSid (psidPrincipal, (PSID) &pAccessDeniedAce->SidStart))
            {
                //We've found an ACE.  Let's modify the mask bits
                if(fRemove && (pAccessDeniedAce->Mask & SPECIFIC_RIGHTS_ALL))
                {
                    pAccessDeniedAce->Mask &= ~dwAccessMask;

                    //If there are any COM rights reamining we must ensure
                    //COM_RIGHTS_EXECUTE is set before leaving.
                    if(pAccessDeniedAce->Mask & (COM_RIGHTS_ACTIVATE_LOCAL  |
                                                 COM_RIGHTS_ACTIVATE_REMOTE |
                                                 COM_RIGHTS_EXECUTE_LOCAL   |
                                                 COM_RIGHTS_EXECUTE_REMOTE))
                    {
                        pAccessDeniedAce->Mask |= COM_RIGHTS_EXECUTE;
                    }
                    else if((pAccessDeniedAce->Mask & SPECIFIC_RIGHTS_ALL) == 0)
                    {
                        //If there are no more specific rights on this ACE we
                        //may delete it.
                        DeleteAce (paclOrig, i);
                    }
                }
                else
                {
                    pAccessDeniedAce->Mask |= dwAccessMask;
                }
                dwFoundValue = ERROR_SUCCESS;
            }
        }
        else if ((fAceType == SYSTEM_AUDIT_ACE_TYPE ||
                  fAceType == ACE_TYPE_ALL) &&
                 pAceHeader->AceType == SYSTEM_AUDIT_ACE_TYPE)
        {
            pSystemAuditAce = (SYSTEM_AUDIT_ACE *) pvAce;

            if (EqualSid (psidPrincipal, (PSID) &pSystemAuditAce->SidStart))
            {
                //We've found an ACE.  Let's modify the mask bits
                if(fRemove && (pSystemAuditAce->Mask & SPECIFIC_RIGHTS_ALL))
                {
                    pSystemAuditAce->Mask &= ~dwAccessMask;

                    //If there are any COM rights reamining we must ensure
                    //COM_RIGHTS_EXECUTE is set before leaving.
                    if(pSystemAuditAce->Mask & (COM_RIGHTS_ACTIVATE_LOCAL  |
                                                COM_RIGHTS_ACTIVATE_REMOTE |
                                                COM_RIGHTS_EXECUTE_LOCAL   |
                                                COM_RIGHTS_EXECUTE_REMOTE))
                    {
                        pSystemAuditAce->Mask |= COM_RIGHTS_EXECUTE;
                    }
                    else if((pSystemAuditAce->Mask & SPECIFIC_RIGHTS_ALL) == 0)
                    {
                        //If there are no more specific rights on this ACE we
                        //may delete it.
                        DeleteAce (paclOrig, i);
                    }
                }
                else
                {
                    pSystemAuditAce->Mask |= dwAccessMask;
                }
                dwFoundValue = ERROR_SUCCESS;
            }
        }
    }

CLEANUP:

    if(psidPrincipal) free (psidPrincipal);

    if(dwReturnValue == ERROR_SUCCESS) dwReturnValue = dwFoundValue;

    return dwReturnValue;
}

Generated on Wed Nov 13 2024 16:53:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/DComPerm/DComPerm.Cpp File Reference

  • Com
  • Fundamentals
  • DCom
  • DComPerm
Functions

DComPerm.Cpp File Reference

#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include <tchar.h>
#include "ntsecapi.h"
#include "dcomperm.h"

Go to the source code of this file.

Functions

void | _tmain (int cArgs, TCHAR **pptszArgv)
void | Error (LPTSTR tszErrorMessage, DWORD dwErrorCode)
void | HandleApplicationAccessOption (int cArgs, TCHAR **pptszArgv)
void | HandleApplicationLaunchAndActivateOption (int cArgs, TCHAR **pptszArgv)
void | HandleDefaultAccessOption (int cArgs, TCHAR **pptszArgv)
void | HandleDefaultLaunchOption (int cArgs, TCHAR **pptszArgv)
void | HandleMachineAccessOption (int cArgs, TCHAR **pptszArgv)
void | HandleMachineLaunchAndActivateOption (int cArgs, TCHAR **pptszArgv)
void | HandleRunAsOption (int cArgs, TCHAR **pptszArgv)
void | SetAccessMaskFromCommandLine (LPTSTR ptszArg, DWORD *pdwAccessMask, DWORD dwSDType)
void | ShowUsage (LPTSTR tszErrorString)

Function Documentation

void _tmain | ( | int | cArgs,
 |  | TCHAR ** | pptszArgv
 | ) |  |

Definition at line 796 of file DComPerm.Cpp.

{
    if (cArgs < 2) ShowUsage (_T("No option specified."));

    if (_tcsicmp (pptszArgv [1], _T("-DA")) == 0)
    {
        HandleDefaultAccessOption (cArgs, pptszArgv);
    }
    else if (_tcsicmp (pptszArgv [1], _T("-DL")) == 0)
    {
        HandleDefaultLaunchOption (cArgs, pptszArgv);
    }
    else if (_tcsicmp (pptszArgv [1], _T("-AA")) == 0)
    {
        HandleApplicationAccessOption (cArgs, pptszArgv);
    }
    else if (_tcsicmp (pptszArgv [1], _T("-AL")) == 0)
    {
        HandleApplicationLaunchAndActivateOption (cArgs, pptszArgv);
    }
    else if (_tcsicmp (pptszArgv [1], _T("-MA")) == 0)
    {
        HandleMachineAccessOption (cArgs, pptszArgv);
    }
    else if (_tcsicmp (pptszArgv [1], _T("-ML")) == 0)
    {
        HandleMachineLaunchAndActivateOption (cArgs, pptszArgv);
    }
    else if (_tcsicmp (pptszArgv [1], _T("-RUNAS")) == 0)
    {
        HandleRunAsOption (cArgs, pptszArgv);
    }
    else
    {
        ShowUsage (_T("Invalid option specified."));
    }

}

void Error | ( | LPTSTR | tszErrorMessage,
 |  | DWORD | dwErrorCode
 | ) |  |

Definition at line 113 of file DComPerm.Cpp.

{
    TCHAR tszMessageBuffer [SIZE_MSG_BUFFER] = {0};

    _tprintf (_T("%s\n%s"), tszErrorMessage, SystemMessage (tszMessageBuffer,  sizeof(tszMessageBuffer)/sizeof(*tszMessageBuffer), dwErrorCode));
    exit (0);
}

void HandleApplicationAccessOption | ( | int | cArgs,
 |  | TCHAR ** | pptszArgv
 | ) |  |

Definition at line 532 of file DComPerm.Cpp.

{
    DWORD dwReturnValue                 = ERROR_SUCCESS;
    HKEY  hkeyRegistry                  = NULL;
    TCHAR tszAppID [SIZE_NAME_BUFFER]   = {0};
    TCHAR tszKeyName [SIZE_NAME_BUFFER] = {0};

    DWORD dwAccessMask = COM_RIGHTS_EXECUTE;

    if (cArgs < 4)
        ShowUsage (_T("Invalid number of arguments."));

    if (_tcsicmp (pptszArgv[3], _T("LIST")) == 0)
    {
        if (cArgs < 4) ShowUsage (_T("Invalid number of arguments."));

        _tprintf (_T("Access permission list for AppID %s:\n\n"), pptszArgv[2]);

        ListAppIDAccessACL (pptszArgv[2]);

        return;
    }

    if (_tcsicmp (pptszArgv[3], _T("DEFAULT")) == 0)
    {

        _sntprintf (tszAppID, (sizeof(tszAppID)/sizeof(*tszAppID))-1, pptszArgv [2][0] == '{' ? _T("%s") : _T("{%s}"), pptszArgv [2]);
        _sntprintf (tszKeyName, (sizeof(tszKeyName)/sizeof(*tszKeyName))-1, _T("APPID\\%s"), tszAppID);

        dwReturnValue = RegOpenKeyEx (HKEY_CLASSES_ROOT, tszKeyName, 0, KEY_ALL_ACCESS, &hkeyRegistry);
        if (dwReturnValue != ERROR_SUCCESS && dwReturnValue != ERROR_FILE_NOT_FOUND)
        {
            Error (_T("ERROR: Cannot open AppID registry key."), dwReturnValue);
        }

        dwReturnValue = RegDeleteValue (hkeyRegistry, _T("AccessPermission"));
        if (dwReturnValue != ERROR_SUCCESS && dwReturnValue != ERROR_FILE_NOT_FOUND)
        {
            Error (_T("ERROR: Cannot delete AccessPermission value."), dwReturnValue);
        }

        if(hkeyRegistry) RegCloseKey (hkeyRegistry);

        _tprintf (_T("Successfully set the Application Access to the machine default.\n"));

        return;
    }

    if (cArgs < 5) ShowUsage (_T("Invalid number of arguments."));

    if (_tcsicmp (pptszArgv [3], _T("SET")) == 0)
    {
         if (cArgs < 6) ShowUsage (_T("Invalid number of arguments."));

        if(cArgs == 7)
        {
            SetAccessMaskFromCommandLine(pptszArgv[6], &dwAccessMask, SDTYPE_APPLICATION_ACCESS);
        }
        else if(!IsLegacySecurityModel())
        {
            _tprintf (_T("WARNING: Default access flags designated on a system with an enhanced security model.\n"));
        }

        if (_tcsicmp (pptszArgv [5], _T("PERMIT")) == 0)
        {
            dwReturnValue = ChangeAppIDAccessACL (pptszArgv[2], pptszArgv [4], TRUE, TRUE, dwAccessMask);
        }
        else if (_tcsicmp (pptszArgv [5], _T("DENY")) == 0)
        {
            dwReturnValue = ChangeAppIDAccessACL (pptszArgv[2], pptszArgv [4], TRUE, FALSE, dwAccessMask);
        }
        else
        {
            ShowUsage (_T("You can only set a user's permissions to \"permit\" or \"deny\".\n\n"));
        }

        if (dwReturnValue != ERROR_SUCCESS)
        {
            Error (_T("ERROR: Cannot add user to application access ACL."), dwReturnValue);
        }
    }
    else if (_tcsicmp (pptszArgv [3], _T("REMOVE")) == 0)
    {
        dwReturnValue = ChangeAppIDAccessACL (pptszArgv[2], pptszArgv[4], FALSE, FALSE, dwAccessMask);

        if (dwReturnValue != ERROR_SUCCESS)
        {
            Error (_T("ERROR: Cannot remove user from application access ACL."), dwReturnValue);
        }

    }
    else
    {
        ShowUsage (_T("You can only \"set\" or \"remove\" a user."));
    }

     _tprintf (_T("Successfully set the Application Access ACL.\n"));

    ListAppIDAccessACL(pptszArgv[2]);
}

void HandleApplicationLaunchAndActivateOption | ( | int | cArgs,
 |  | TCHAR ** | pptszArgv
 | ) |  |

Definition at line 636 of file DComPerm.Cpp.

{
    DWORD dwReturnValue                 = ERROR_SUCCESS;
    HKEY  hkeyRegistry                  = NULL;
    TCHAR tszAppID [SIZE_NAME_BUFFER]   = {0};
    TCHAR tszKeyName [SIZE_NAME_BUFFER] = {0};

    DWORD dwAccessMask = COM_RIGHTS_EXECUTE;

    if (cArgs < 4) ShowUsage (_T("Invalid number of arguments."));

    if (_tcsicmp (pptszArgv[3], _T("LIST")) == 0)
    {
        if (cArgs < 4) ShowUsage (_T("Invalid number of arguments.\n"));

        _tprintf (_T("Launch permission list for AppID %s:\n\n"), pptszArgv[2]);
        ListAppIDLaunchACL (pptszArgv[2]);
        return;
    }

    if (_tcsicmp (pptszArgv[3], _T("DEFAULT")) == 0)
    {

        _sntprintf (tszAppID, (sizeof(tszAppID)/sizeof(*tszAppID))-1, pptszArgv [2][0] == '{' ? _T("%s") : _T("{%s}"), pptszArgv [2]);
        _sntprintf (tszKeyName, (sizeof(tszKeyName)/sizeof(*tszKeyName))-1, _T("APPID\\%s"), tszAppID);

        dwReturnValue = RegOpenKeyEx (HKEY_CLASSES_ROOT, tszKeyName, 0, KEY_ALL_ACCESS, &hkeyRegistry);
        if (dwReturnValue != ERROR_SUCCESS && dwReturnValue != ERROR_FILE_NOT_FOUND)
        {
            Error (_T("ERROR: Cannot open AppID registry key."), dwReturnValue);
        }

        dwReturnValue = RegDeleteValue (hkeyRegistry, _T("LaunchPermission"));
        if (dwReturnValue != ERROR_SUCCESS && dwReturnValue != ERROR_FILE_NOT_FOUND)
        {
            Error (_T("ERROR: Cannot delete LaunchPermission value."), dwReturnValue);
        }

        if(hkeyRegistry) RegCloseKey (hkeyRegistry);

        _tprintf (_T("Successfully set the Application Launch to the machine default.\n"));

        return;
    }

    if (cArgs < 5) ShowUsage (_T("Invalid number of arguments."));

    if (_tcsicmp (pptszArgv [3], _T("SET")) == 0)
    {
        if (cArgs < 6) ShowUsage (_T("Invalid number of arguments."));

        if(cArgs == 7)
        {
            SetAccessMaskFromCommandLine(pptszArgv[6], &dwAccessMask, SDTYPE_APPLICATION_LAUNCH);
        }
        else if(!IsLegacySecurityModel())
        {
            _tprintf (_T("WARNING: Default access flags designated on a system with an enhanced security model.\n"));
        }

        if (_tcsicmp (pptszArgv [5], _T("PERMIT")) == 0)
        {
            dwReturnValue = ChangeAppIDLaunchAndActivateACL (pptszArgv[2], pptszArgv [4], TRUE, TRUE, dwAccessMask);
        }
        else if (_tcsicmp (pptszArgv [5], _T("DENY")) == 0)
        {
            dwReturnValue = ChangeAppIDLaunchAndActivateACL (pptszArgv[2], pptszArgv [4], TRUE, FALSE, dwAccessMask);
        }
        else
        {
            ShowUsage (_T("You can only set a user's permissions to \"permit\" or \"deny\".\n\n"));
        }

        if (dwReturnValue != ERROR_SUCCESS)
            Error (_T("ERROR: Cannot add user to application launch ACL."), dwReturnValue);
    }
    else if (_tcsicmp (pptszArgv [3], _T("REMOVE")) == 0)
    {
        dwReturnValue = ChangeAppIDLaunchAndActivateACL (pptszArgv[2], pptszArgv[4], FALSE, FALSE, dwAccessMask);

        if (dwReturnValue != ERROR_SUCCESS)
        {
            Error (_T("ERROR: Cannot remove user from application launch ACL."), dwReturnValue);
        }
    }
    else
    {
        ShowUsage (_T("You can only \"set\" or \"remove\" a user."));
    }

     _tprintf (_T("Successfully set the Application Launch ACL.\n"));

    ListAppIDLaunchACL(pptszArgv[2]);
}

void HandleDefaultAccessOption | ( | int | cArgs,
 |  | TCHAR ** | pptszArgv
 | ) |  |

Definition at line 378 of file DComPerm.Cpp.

{
    DWORD dwReturnValue = ERROR_SUCCESS;
    DWORD dwAccessMask = COM_RIGHTS_EXECUTE;

    if (cArgs < 3) ShowUsage (_T("Invalid number of arguments."));

    if (_tcsicmp (pptszArgv [2], _T("LIST")) == 0)
    {
        _tprintf (_T("Default access permission list:\n\n"));
        dwReturnValue = ListDefaultAccessACL();
        if (dwReturnValue != ERROR_SUCCESS)
        {
            Error (_T("ERROR: Cannot list default access permission list."), dwReturnValue);
        }
        return;
    }

    if (cArgs < 4) ShowUsage (_T("Invalid number of arguments."));

    if (_tcsicmp (pptszArgv [2], _T("SET")) == 0)
    {
        if (cArgs < 5) ShowUsage (_T("Invalid number of arguments."));

        if(cArgs == 6)
        {
            SetAccessMaskFromCommandLine(pptszArgv[5], &dwAccessMask, SDTYPE_DEFAULT_ACCESS);
        }
        else if(!IsLegacySecurityModel())
        {
            _tprintf (_T("WARNING: Default access flags designated on a system with an enhanced security model.\n"));
        }

        if (_tcsicmp (pptszArgv [4], _T("PERMIT")) == 0)
        {
            dwReturnValue = ChangeDefaultAccessACL (pptszArgv [3], TRUE, TRUE, dwAccessMask);
        }
        else if (_tcsicmp (pptszArgv [4], _T("DENY")) == 0)
        {
            dwReturnValue = ChangeDefaultAccessACL (pptszArgv [3], TRUE, FALSE, dwAccessMask);
        }
        else
        {
            ShowUsage (_T("You can only set a user's permissions to \"permit\" or \"deny\".\n\n"));
        }

        if (dwReturnValue != ERROR_SUCCESS)
        {
            Error (_T("ERROR: Cannot add user to default access ACL."), dwReturnValue);
        }
    }
    else if (_tcsicmp (pptszArgv [2], _T("REMOVE")) == 0)
    {
        dwReturnValue = ChangeDefaultAccessACL (pptszArgv[3], FALSE, FALSE, dwAccessMask);

        if (dwReturnValue != ERROR_SUCCESS)
        {
            Error (_T("ERROR: Cannot remove user from default access ACL."), dwReturnValue);
        }
    }
    else
    {
        ShowUsage (_T("You can only \"set\" or \"remove\" a user."));
    }

     _tprintf (_T("Successfully set the Default Access ACL.\n"));

    ListDefaultAccessACL();
}

void HandleDefaultLaunchOption | ( | int | cArgs,
 |  | TCHAR ** | pptszArgv
 | ) |  |

Definition at line 456 of file DComPerm.Cpp.

{
    DWORD dwReturnValue = ERROR_SUCCESS;
    DWORD dwAccessMask = COM_RIGHTS_EXECUTE;

    if (cArgs < 3) ShowUsage (_T("Invalid number of arguments."));

    if (_tcsicmp (pptszArgv [2], _T("LIST")) == 0)
    {
        _tprintf (_T("Default launch permission list:\n\n"));
        dwReturnValue = ListDefaultLaunchACL();

        if (dwReturnValue != ERROR_SUCCESS)
        {
            Error (_T("ERROR: Cannot list default launch ACL."), dwReturnValue);
        }

        return;
    }

    if (cArgs < 4) ShowUsage (_T("Invalid number of arguments."));

    if (_tcsicmp (pptszArgv [2], _T("SET")) == 0)
    {
        if (cArgs < 5) ShowUsage (_T("Invalid number of arguments."));

        if(cArgs == 6)
        {
            SetAccessMaskFromCommandLine(pptszArgv[5], &dwAccessMask, SDTYPE_DEFAULT_LAUNCH);
        }
        else if(!IsLegacySecurityModel())
        {
            _tprintf (_T("WARNING: Default access flags designated on a system with an enhanced security model.\n"));
        }

        if (_tcsicmp (pptszArgv [4], _T("PERMIT")) == 0)
        {
            dwReturnValue = ChangeDefaultLaunchAndActivateACL (pptszArgv [3], TRUE, TRUE, dwAccessMask);
        }
        else if (_tcsicmp (pptszArgv [4], _T("DENY")) == 0)
        {
            dwReturnValue = ChangeDefaultLaunchAndActivateACL (pptszArgv [3], TRUE, FALSE, dwAccessMask);
        }
        else
        {
            ShowUsage (_T("You can only set a user's permissions to \"permit\" or \"deny\".\n\n"));
        }

        if (dwReturnValue != ERROR_SUCCESS)
        {
            Error (_T("ERROR: Cannot add user to default launch ACL."), dwReturnValue);
        }

    }
    else if (_tcsicmp (pptszArgv [2], _T("REMOVE")) == 0)
    {
        dwReturnValue = ChangeDefaultLaunchAndActivateACL (pptszArgv[3], FALSE, FALSE, dwAccessMask);

        if (dwReturnValue != ERROR_SUCCESS)
        {
            Error (_T("ERROR: Cannot remove user from default launch ACL."), dwReturnValue);
        }
    }
    else
    {
        ShowUsage (_T("You can only \"set\" or \"remove\" a user."));
    }

     _tprintf (_T("Successfully set the Default Launch ACL.\n"));

    ListDefaultLaunchACL();
}

void HandleMachineAccessOption | ( | int | cArgs,
 |  | TCHAR ** | pptszArgv
 | ) |  |

Definition at line 212 of file DComPerm.Cpp.

{

    DWORD dwReturnValue = ERROR_SUCCESS;
    DWORD dwAccessMask = COM_RIGHTS_EXECUTE;

    if (cArgs < 3) ShowUsage (_T("Invalid number of arguments."));

    if (_tcsicmp (pptszArgv [2], _T("LIST")) == 0)
    {
        _tprintf (_T("Machine access permission list:\n\n"));
        dwReturnValue = ListMachineAccessACL();
        if (dwReturnValue != ERROR_SUCCESS)
        {
            Error (_T("ERROR: Cannot list default access permission list."), dwReturnValue);
        }
        return;
    }

    if (cArgs < 4) ShowUsage (_T("Invalid number of arguments."));

    if (_tcsicmp (pptszArgv [2], _T("SET")) == 0)
    {
        if (cArgs < 5) ShowUsage (_T("Invalid number of arguments."));

        if(cArgs == 6)
        {
            SetAccessMaskFromCommandLine(pptszArgv[5], &dwAccessMask, SDTYPE_MACHINE_ACCESS);
        }
        else if(!IsLegacySecurityModel())
        {
            _tprintf (_T("WARNING: Default access flags designated on a system with an enhanced security model.\n"));
        }

        if (_tcsicmp (pptszArgv [4], _T("PERMIT")) == 0)
        {
            dwReturnValue = ChangeMachineAccessACL (pptszArgv [3], TRUE, TRUE, dwAccessMask);
        }
        else if (_tcsicmp (pptszArgv [4], _T("DENY")) == 0)
        {
            dwReturnValue = ChangeMachineAccessACL (pptszArgv [3], TRUE, FALSE, dwAccessMask);
        }
        else
        {
            ShowUsage (_T("You can only set a user's permissions to \"permit\" or \"deny\".\n\n"));
        }

        if (dwReturnValue != ERROR_SUCCESS)
        {
            Error (_T("ERROR: Cannot add user to machine access ACL."), dwReturnValue);
        }
    }
    else if (_tcsicmp (pptszArgv [2], _T("REMOVE")) == 0)
    {
        dwReturnValue = ChangeMachineAccessACL (pptszArgv[3], FALSE, FALSE, dwAccessMask);

        if (dwReturnValue != ERROR_SUCCESS)
        {
            Error (_T("ERROR: Cannot remove user from machine access ACL."), dwReturnValue);
        }
    }
    else
    {
        ShowUsage (_T("You can only \"set\" or \"remove\" a user."));
    }

     _tprintf (_T("Successfully set the Machine Access ACL.\n"));

    ListMachineAccessACL();

}

void HandleMachineLaunchAndActivateOption | ( | int | cArgs,
 |  | TCHAR ** | pptszArgv
 | ) |  |

Definition at line 293 of file DComPerm.Cpp.

{
    DWORD dwReturnValue = ERROR_SUCCESS;
    DWORD dwAccessMask = COM_RIGHTS_EXECUTE;

    if (cArgs < 3) ShowUsage (_T("Invalid number of arguments."));

    if (_tcsicmp (pptszArgv [2], _T("LIST")) == 0)
    {
        _tprintf (_T("Machine launch permission list:\n\n"));
        dwReturnValue = ListMachineLaunchACL();

        if (dwReturnValue != ERROR_SUCCESS)
        {
            Error (_T("ERROR: Cannot list default launch ACL."), dwReturnValue);
        }

        return;
    }

    if (cArgs < 4) ShowUsage (_T("Invalid number of arguments."));

    if (_tcsicmp (pptszArgv [2], _T("SET")) == 0)
    {
        if (cArgs < 5) ShowUsage (_T("Invalid number of arguments."));

        if(cArgs == 6)
        {
            SetAccessMaskFromCommandLine(pptszArgv[5], &dwAccessMask, SDTYPE_MACHINE_LAUNCH);
        }
        else if(!IsLegacySecurityModel())
        {
            _tprintf (_T("WARNING: Default access flags designated on a system with an enhanced security model.\n"));
        }

        if (_tcsicmp (pptszArgv [4], _T("PERMIT")) == 0)
        {
            dwReturnValue = ChangeMachineLaunchAndActivateACL (pptszArgv [3], TRUE, TRUE, dwAccessMask);
        }
        else if (_tcsicmp (pptszArgv [4], _T("DENY")) == 0)
        {
            dwReturnValue = ChangeMachineLaunchAndActivateACL (pptszArgv [3], TRUE, FALSE, dwAccessMask);
        }
        else
        {
            ShowUsage (_T("You can only set a user's permissions to \"permit\" or \"deny\".\n\n"));
        }

        if (dwReturnValue != ERROR_SUCCESS)
        {
            Error (_T("ERROR: Cannot add user to machine launch ACL."), dwReturnValue);
        }

    }
    else if (_tcsicmp (pptszArgv [2], _T("REMOVE")) == 0)
    {
        dwReturnValue = ChangeMachineLaunchAndActivateACL (pptszArgv[3], FALSE, FALSE, dwAccessMask);

        if (dwReturnValue != ERROR_SUCCESS)
        {
            Error (_T("ERROR: Cannot remove user from machine launch ACL."), dwReturnValue);
        }
    }
    else
    {
        ShowUsage (_T("You can only \"set\" or \"remove\" a user."));
    }

     _tprintf (_T("Successfully set the Machine Launch ACL.\n"));

    ListMachineLaunchACL();

}

void HandleRunAsOption | ( | int | cArgs,
 |  | TCHAR ** | pptszArgv
 | ) |  |

Definition at line 736 of file DComPerm.Cpp.

{
    DWORD dwReturnValue                 = ERROR_SUCCESS;
    HKEY  hkeyRegistry                  = NULL;
    TCHAR tszAppID [SIZE_NAME_BUFFER]   = {0};
    TCHAR tszKeyName [SIZE_NAME_BUFFER] = {0};

    if (cArgs < 4) ShowUsage (_T("Invalid number of arguments."));

    _sntprintf (tszAppID, (sizeof(tszAppID)/sizeof(*tszAppID))-1, pptszArgv [2][0] == '{' ? _T("%s") : _T("{%s}"), pptszArgv [2]);
    _sntprintf (tszKeyName, (sizeof(tszKeyName)/sizeof(*tszKeyName))-1, _T("APPID\\%s"), tszAppID);

    dwReturnValue = RegOpenKeyEx (HKEY_CLASSES_ROOT, tszKeyName, 0, KEY_ALL_ACCESS, &hkeyRegistry);
    if (dwReturnValue != ERROR_SUCCESS)
    {
        Error (_T("ERROR: Cannot open AppID registry key."), dwReturnValue);
    }

    if (_tcsicmp (pptszArgv[3], _T("LAUNCHING USER")) == 0)
    {
        dwReturnValue = RegDeleteValue(hkeyRegistry, _T("RunAs"));

        if(dwReturnValue == ERROR_FILE_NOT_FOUND)
        {
            dwReturnValue = ERROR_SUCCESS;
        }
        else if (dwReturnValue != ERROR_SUCCESS)
        {
            Error (_T("ERROR: Cannot remove RunAs registry value."), dwReturnValue);
        }

    }
    else
    {
        if (_tcsicmp (pptszArgv[3], _T("INTERACTIVE USER")) != 0)
        {
            if (cArgs < 5) ShowUsage (_T("Invalid number of arguments."));

            dwReturnValue = SetRunAsPassword (pptszArgv[2], pptszArgv[3], pptszArgv[4]);
            if (dwReturnValue != ERROR_SUCCESS)
            {
                Error (_T("ERROR: Cannot set RunAs password."), dwReturnValue);
            }
        }

        dwReturnValue = RegSetValueEx (hkeyRegistry, _T("RunAs"), 0, REG_SZ, (LPBYTE) pptszArgv [3], (DWORD)_tcslen (pptszArgv[3]) * sizeof (TCHAR));
        if (dwReturnValue != ERROR_SUCCESS)
        {
            Error (_T("ERROR: Cannot set RunAs registry value."), dwReturnValue);
        }
    }

    if(hkeyRegistry) RegCloseKey (hkeyRegistry);

}

void SetAccessMaskFromCommandLine | ( | LPTSTR | ptszArg,
 |  | DWORD * | pdwAccessMask,
 |  | DWORD | dwSDType
 | ) |  |

Definition at line 130 of file DComPerm.Cpp.

{
    LPTSTR ptszToken = NULL;

    *pdwAccessMask = 0;

    ptszToken = _tcstok(ptszArg, _T(":"));

    if(!ptszToken || _tcsicmp (ptszToken, _T("LEVEL")) != 0)
    {
        ShowUsage(_T("Invalid LEVEL argument"));
    }

    ptszToken = _tcstok(NULL, _T(","));

    if(!ptszToken)
    {
        ShowUsage(_T("Invalid LEVEL argument"));
    }

    if(dwSDType & SDTYPE_ACCESS) do
    {

        if(_tcsicmp (ptszToken, _T("L")) == 0)
        {
            *pdwAccessMask |= COM_RIGHTS_EXECUTE_LOCAL | COM_RIGHTS_EXECUTE;
        }
        else if(_tcsicmp (ptszToken, _T("R")) == 0)
        {
            *pdwAccessMask |= COM_RIGHTS_EXECUTE_REMOTE | COM_RIGHTS_EXECUTE;
        }
        else
        {
            ShowUsage(_T("Invalid LEVEL argument"));
        }

    }while(ptszToken = _tcstok(NULL, _T(",")));
    else do
    {

        if(_tcsicmp (ptszToken, _T("LL")) == 0)
        {
            *pdwAccessMask |= COM_RIGHTS_EXECUTE_LOCAL | COM_RIGHTS_EXECUTE;
        }
        else if(_tcsicmp (ptszToken, _T("LA")) == 0)
        {
            *pdwAccessMask |= COM_RIGHTS_ACTIVATE_LOCAL | COM_RIGHTS_EXECUTE;
        }
        else if(_tcsicmp (ptszToken, _T("RL")) == 0)
        {
            *pdwAccessMask |= COM_RIGHTS_EXECUTE_REMOTE | COM_RIGHTS_EXECUTE;
        }
        else if(_tcsicmp (ptszToken, _T("RA")) == 0)
        {
            *pdwAccessMask |= COM_RIGHTS_ACTIVATE_REMOTE | COM_RIGHTS_EXECUTE;
        }
        else if(_tcsicmp (ptszToken, _T("L")) == 0)
        {
            *pdwAccessMask |= COM_RIGHTS_ACTIVATE_LOCAL | COM_RIGHTS_EXECUTE_LOCAL | COM_RIGHTS_EXECUTE;
        }
        else if(_tcsicmp (ptszToken, _T("R")) == 0)
        {
            *pdwAccessMask |= COM_RIGHTS_ACTIVATE_REMOTE | COM_RIGHTS_EXECUTE_REMOTE | COM_RIGHTS_EXECUTE;
        }
        else
        {
            ShowUsage(_T("Invalid LEVEL argument"));
        }

    }while(ptszToken = _tcstok(NULL, _T(",")));

}

void ShowUsage ( LPTSTR tszErrorString )

Definition at line 30 of file DComPerm.Cpp.

{

    BOOL fLegacy = IsLegacySecurityModel();

    _tprintf (_T("%s\n"), tszErrorString);
    _tprintf (_T("Syntax: dcomperm <option> [...]\n\n"));

    _tprintf (_T("Options:\n"));

    if(!fLegacy)
    {
        _tprintf (_T("   -ma <\"set\" or \"remove\"> <Principal Name> [\"permit\" or \"deny\"] [\"level:l,r\"]\n"));
        _tprintf (_T("   -ma list\n"));
        _tprintf (_T("       Modify or list the machine access permission list\n\n"));

        _tprintf (_T("   -ml <\"set\" or \"remove\"> <Principal Name> [\"permit\" or \"deny\"] [\"level:l,r,ll,la,rl,ra\"]\n"));
        _tprintf (_T("   -ml list\n"));
        _tprintf (_T("       Modify or list the machine launch permission list\n\n"));
    }

    _tprintf (_T("   -da <\"set\" or \"remove\"> <Principal Name> [\"permit\" or \"deny\"] "));
    if(!fLegacy) _tprintf (_T("[\"level:l,r\"]\n")); else _tprintf (_T("\n"));

    _tprintf (_T("   -da list\n"));
    _tprintf (_T("       Modify or list the default access permission list\n\n"));

    _tprintf (_T("   -dl <\"set\" or \"remove\"> <Principal Name> [\"permit\" or \"deny\"] "));
    if(!fLegacy) _tprintf (_T("[\"level:l,r,ll,la,rl,ra\"]\n")); else _tprintf (_T("\n"));
    _tprintf (_T("   -dl list\n"));
    _tprintf (_T("       Modify or list the default launch permission list\n\n"));

    _tprintf (_T("   -aa <AppID> <\"set\" or \"remove\"> <Principal Name> [\"permit\" or \"deny\"] "));
    if(!fLegacy) _tprintf (_T("[\"level:l,r\"]\n")); else _tprintf (_T("\n"));
    _tprintf (_T("   -aa <AppID> default\n"));
    _tprintf (_T("   -aa <AppID> list\n"));
    _tprintf (_T("       Modify or list the access permission list for a specific AppID\n\n"));

    _tprintf (_T("   -al <AppID> <\"set\" or \"remove\"> <Principal Name> [\"permit\" or \"deny\"] "));
    if(!fLegacy) _tprintf (_T("[\"level:l,r,ll,la,rl,ra\"]\n")); else _tprintf (_T("\n"));
    _tprintf (_T("   -al <AppID> default\n"));
    _tprintf (_T("   -al <AppID> list\n"));
    _tprintf (_T("       Modify or list the launch permission list for a specific AppID\n\n"));

    if(!fLegacy)
    {
        _tprintf (_T("level: \n"));
        _tprintf (_T("\tll - local launch (only applies to {ml, dl, al} options)  \n"));
        _tprintf (_T("\trl - remote launch (only applies to {ml, dl, al} options)  \n"));
        _tprintf (_T("\tla - local activate (only applies to {ml, dl, al} options)  \n"));
        _tprintf (_T("\tra - remote activate (only applies to {ml, dl, al} options)  \n"));
        _tprintf (_T("\tl  - local (local access - means launch and activate when used with {ml, dl, al} options)  \n"));
        _tprintf (_T("\tr  - remote (remote access - means launch and activate when used with {ml, dl, al} options)  \n\n"));
    }

    _tprintf (_T("Press any key to continue. . ."));
    _getch();
    _tprintf (_T("\r                               \r"));

    _tprintf (_T("   -runas <AppID> <Principal Name> <Password>\n"));
    _tprintf (_T("   -runas <AppID> \"Interactive User\"\n"));
    _tprintf (_T("   -runas <AppID> \"Launching User\"\n"));
    _tprintf (_T("       Set the RunAs information for a specific AppID\n\n"));

    _tprintf (_T("Examples:\n"));
    _tprintf (_T("   dcomperm -da set redmond\\t-miken permit"));
    if(!fLegacy) _tprintf (_T(" level:r\n")); else _tprintf (_T("\n"));
    _tprintf (_T("   dcomperm -dl set redmond\\jdoe deny"));
    if(!fLegacy) _tprintf (_T(" level:rl,ra\n")); else _tprintf (_T("\n"));
    _tprintf (_T("   dcomperm -aa {12345678-1234-1234-1234-00aa00bbf7c7} list\n"));
    _tprintf (_T("   dcomperm -al {12345678-1234-1234-1234-00aa00bbf7c7} remove redmond\\t-miken\n"));
    _tprintf (_T("   dcomperm -runas {12345678-1234-1234-1234-00aa00bbf7c7} redmond\\jdoe password\n"));

    exit (0);
}

Generated on Wed Nov 13 2024 16:53:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/DComPerm/DComPerm.h File Reference

  • Com
  • Fundamentals
  • DCom
  • DComPerm
Defines | Functions

DComPerm.h File Reference

Go to the source code of this file.

Defines

#define | ACE_TYPE_ALL (-1L)
#define | COM_RIGHTS_ACTIVATE_LOCAL 0x8
#define | COM_RIGHTS_ACTIVATE_REMOTE 0x10
#define | COM_RIGHTS_EXECUTE_LOCAL 0x2
#define | COM_RIGHTS_EXECUTE_REMOTE 0x4
#define | GUIDSTR_MAX 38
#define | SDTYPE_ACCESS (SDTYPE_MACHINE_ACCESS|SDTYPE_DEFAULT_ACCESS|SDTYPE_APPLICATION_ACCESS)
#define | SDTYPE_APPLICATION_ACCESS (0x20L)
#define | SDTYPE_APPLICATION_LAUNCH (0x10L)
#define | SDTYPE_DEFAULT_ACCESS (0x8L)
#define | SDTYPE_DEFAULT_LAUNCH (0x4L)
#define | SDTYPE_MACHINE_ACCESS (0x2L)
#define | SDTYPE_MACHINE_LAUNCH (0x1L)
#define | SIZE_MSG_BUFFER 256
#define | SIZE_NAME_BUFFER 256
#define | STR2UNI(unistr, regstr) mbstowcs (unistr, regstr, strlen (regstr)+1);
#define | UNI2STR(regstr, unistr) wcstombs (regstr, unistr, wcslen (unistr)+1);

Functions

DWORD | AddAccessAllowedACEToACL (PACL *paclOrig, DWORD dwAccessMask, LPTSTR tszPrincipal)
DWORD | AddAccessDeniedACEToACL (PACL *paclOrig, DWORD dwPermissionMask, LPTSTR tszPrincipal)
DWORD | AddPrincipalToNamedValueSD (HKEY RootKey, LPTSTR KeyName, LPTSTR ValueName, LPTSTR Principal, BOOL Permit, DWORD dwAccessMask, DWORD dwSDType)
DWORD | ChangeAppIDAccessACL (LPTSTR AppID, LPTSTR Principal, BOOL SetPrincipal, BOOL Permit, DWORD dwAccessMask)
DWORD | ChangeAppIDLaunchAndActivateACL (LPTSTR AppID, LPTSTR Principal, BOOL SetPrincipal, BOOL Permit, DWORD dwAccessMask)
DWORD | ChangeDefaultAccessACL (LPTSTR Principal, BOOL SetPrincipal, BOOL Permit, DWORD dwAccessMask)
DWORD | ChangeDefaultLaunchAndActivateACL (LPTSTR Principal, BOOL SetPrincipal, BOOL Permit, DWORD dwAccessMask)
DWORD | ChangeMachineAccessACL (LPTSTR tszPrincipal, BOOL fSetPrincipal, BOOL fPermit, DWORD dwAccessMask)
DWORD | ChangeMachineLaunchAndActivateACL (LPTSTR tszPrincipal, BOOL fSetPrincipal, BOOL fPermit, DWORD dwAccessMask)
DWORD | CopyACL (PACL paclOld, PACL paclNew)
DWORD | CreateNewSD (SECURITY_DESCRIPTOR **SD)
DWORD | GetCurrentUserSID (PSID *Sid)
DWORD | GetNamedValueSD (HKEY RootKey, LPTSTR KeyName, LPTSTR ValueName, SECURITY_DESCRIPTOR **SD, BOOL *NewSD)
DWORD | GetPrincipalSID (LPTSTR Principal, PSID *Sid)
DWORD | GetRunAsPassword (LPTSTR AppID, LPTSTR Password)
BOOL IsLegacySecurityModel ()
void | ListACL (PACL Acl, DWORD dwSDType)
DWORD | ListAppIDAccessACL (LPTSTR AppID)
DWORD | ListAppIDLaunchACL (LPTSTR AppID)
DWORD ListDefaultAccessACL ()
DWORD ListDefaultLaunchACL ()
DWORD ListMachineAccessACL ()
DWORD ListMachineLaunchACL ()
DWORD | ListNamedValueSD (HKEY hkeyRoot, LPTSTR tszKeyName, LPTSTR tszValueName, DWORD dwSDType)
DWORD | MakeSDAbsolute (PSECURITY_DESCRIPTOR OldSD, PSECURITY_DESCRIPTOR *NewSD)
DWORD | RemovePrincipalFromACL (PACL paclOrig, LPTSTR tszPrincipal, DWORD fAceType)
DWORD | RemovePrincipalFromNamedValueSD (HKEY RootKey, LPTSTR KeyName, LPTSTR ValueName, LPTSTR Principal, DWORD fAceType)
DWORD | SetAccountRights (LPTSTR User, LPTSTR Privilege)
DWORD | SetAclDefaults (PACL pDacl, DWORD dwSDType)
DWORD | SetNamedValueSD (HKEY RootKey, LPTSTR KeyName, LPTSTR ValueName, SECURITY_DESCRIPTOR *SD)
DWORD | SetRunAsPassword (LPTSTR AppID, LPTSTR Password)
DWORD | SetRunAsPassword (LPTSTR AppID, LPTSTR Principal, LPTSTR Password)
LPTSTR | SystemMessage (LPTSTR szBuffer, DWORD cbBuffer, HRESULT hr)
DWORD | UpdatePrincipalInACL (PACL paclOrig, LPTSTR tszPrincipal, DWORD dwAccessMask, BOOL fRemove, DWORD fAceType)
DWORD | UpdatePrincipalInNamedValueSD (HKEY hkeyRoot, LPTSTR tszKeyName, LPTSTR tszValueName, LPTSTR tszPrincipal, DWORD dwAccessMask, BOOL fRemove, DWORD fAceType)

Define Documentation

#define ACE_TYPE_ALL (-1L)

Definition at line 30 of file DComPerm.h.

#define COM_RIGHTS_ACTIVATE_LOCAL 0x8

Definition at line 51 of file DComPerm.h.

#define COM_RIGHTS_ACTIVATE_REMOTE 0x10

Definition at line 54 of file DComPerm.h.

#define COM_RIGHTS_EXECUTE_LOCAL 0x2

Definition at line 45 of file DComPerm.h.

#define COM_RIGHTS_EXECUTE_REMOTE 0x4

Definition at line 48 of file DComPerm.h.

#define GUIDSTR_MAX 38

Definition at line 18 of file DComPerm.h.

#define SDTYPE_ACCESS (SDTYPE_MACHINE_ACCESS|SDTYPE_DEFAULT_ACCESS|SDTYPE_APPLICATION_ACCESS)

Definition at line 42 of file DComPerm.h.

#define SDTYPE_APPLICATION_ACCESS (0x20L)

Definition at line 40 of file DComPerm.h.

#define SDTYPE_APPLICATION_LAUNCH (0x10L)

Definition at line 39 of file DComPerm.h.

#define SDTYPE_DEFAULT_ACCESS (0x8L)

Definition at line 38 of file DComPerm.h.

#define SDTYPE_DEFAULT_LAUNCH (0x4L)

Definition at line 37 of file DComPerm.h.

#define SDTYPE_MACHINE_ACCESS (0x2L)

Definition at line 36 of file DComPerm.h.

#define SDTYPE_MACHINE_LAUNCH (0x1L)

Definition at line 35 of file DComPerm.h.

#define SIZE_MSG_BUFFER 256

Definition at line 33 of file DComPerm.h.

#define SIZE_NAME_BUFFER 256

Definition at line 32 of file DComPerm.h.

#define STR2UNI | ( | unistr,
 |  | regstr |
 | ) |  | mbstowcs (unistr, regstr, strlen (regstr)+1);

Definition at line 22 of file DComPerm.h.

#define UNI2STR | ( | regstr,
 |  | unistr |
 | ) |  | wcstombs (regstr, unistr, wcslen (unistr)+1);

Definition at line 25 of file DComPerm.h.

Function Documentation

DWORD AddAccessAllowedACEToACL | ( | PACL * | paclOrig,
 |  | DWORD | dwAccessMask,
 |  | LPTSTR | tszPrincipal
 | ) |  |

Definition at line 150 of file AclMgmt.Cpp.

{
    ACL_SIZE_INFORMATION  aclSizeInfo   = {0};
    int                   cbAclSize     = 0;
    DWORD                 dwReturnValue = ERROR_SUCCESS;
    PSID                  psidPrincipal = NULL;
    PACL                  paclOld       = NULL;
    PACL                  paclNew       = NULL;

    if(!paclOrig) return ERROR_BAD_ARGUMENTS;

    paclOld = *paclOrig;

    dwReturnValue = GetPrincipalSID (tszPrincipal, &psidPrincipal);
    if (dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

    if(!GetAclInformation (paclOld,
                           (LPVOID) &aclSizeInfo,
                           (DWORD) sizeof (ACL_SIZE_INFORMATION),
                           AclSizeInformation))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    cbAclSize = aclSizeInfo.AclBytesInUse +
              sizeof (ACL) + sizeof (ACCESS_ALLOWED_ACE) +
              GetLengthSid (psidPrincipal) - sizeof (DWORD);

    paclNew = (PACL) malloc(cbAclSize);
    if(!paclNew)
    {
        dwReturnValue = ERROR_OUTOFMEMORY;
        goto CLEANUP;
    }

    if (!InitializeAcl (paclNew, cbAclSize, ACL_REVISION))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    dwReturnValue = CopyACL (paclOld, paclNew);
    if (dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

    if (!AddAccessAllowedAce (paclNew,
                              ACL_REVISION2,
                              dwAccessMask,
                              psidPrincipal))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    *paclOrig = paclNew;

CLEANUP:

    if(dwReturnValue != ERROR_SUCCESS && paclNew)
    {
        free(paclNew);
    }

    if(psidPrincipal) free (psidPrincipal);

    return dwReturnValue;
}

DWORD AddAccessDeniedACEToACL | ( | PACL * | paclOrig,
 |  | DWORD | dwPermissionMask,
 |  | LPTSTR | tszPrincipal
 | ) |  |

Definition at line 76 of file AclMgmt.Cpp.

{
    ACL_SIZE_INFORMATION  aclSizeInfo   = {0};
    int                   cbAclSize     = 0;
    DWORD                 dwReturnValue = ERROR_SUCCESS;
    PSID                  psidPrincipal = NULL;
    PACL                  paclOld       = NULL;
    PACL                  paclNew       = NULL;

    if(!paclOrig) return ERROR_BAD_ARGUMENTS;

    paclOld = *paclOrig;

    dwReturnValue = GetPrincipalSID (tszPrincipal, &psidPrincipal);
    if (dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

    if(!GetAclInformation (paclOld,
                           (LPVOID) &aclSizeInfo,
                           (DWORD) sizeof (ACL_SIZE_INFORMATION),
                           AclSizeInformation))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    cbAclSize = aclSizeInfo.AclBytesInUse +
              sizeof (ACL) + sizeof (ACCESS_DENIED_ACE) +
              GetLengthSid (psidPrincipal) - sizeof (DWORD);

    paclNew = (PACL) malloc(cbAclSize);
    if(!paclNew)
    {
        dwReturnValue = ERROR_OUTOFMEMORY;
        goto CLEANUP;
    }

    if (!InitializeAcl (paclNew, cbAclSize, ACL_REVISION))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    if (!AddAccessDeniedAce (paclNew,
                             ACL_REVISION2,
                             dwAccessMask,
                             psidPrincipal))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    dwReturnValue = CopyACL (paclOld, paclNew);
    if (dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

    *paclOrig = paclNew;

CLEANUP:

    if(psidPrincipal) free (psidPrincipal);

    return dwReturnValue;
}

DWORD AddPrincipalToNamedValueSD | ( | HKEY | RootKey,
 |  | LPTSTR | KeyName,
 |  | LPTSTR | ValueName,
 |  | LPTSTR | Principal,
 |  | BOOL | Permit,
 |  | DWORD | dwAccessMask,
 |  | DWORD | dwSDType
 | ) |  |

Definition at line 587 of file SDMgmt.Cpp.

{
    DWORD               dwReturnValue    = ERROR_SUCCESS;
    SECURITY_DESCRIPTOR *pSD             = NULL;
    SECURITY_DESCRIPTOR *psdSelfRelative = NULL;
    SECURITY_DESCRIPTOR *psdAbsolute     = NULL;
    DWORD               cbSecurityDesc   = 0;
    BOOL                fPresent         = FALSE;
    BOOL                fDefaultDACL     = FALSE;
    PACL                pDacl            = NULL;
    BOOL                fNewSD           = FALSE;

    dwReturnValue = GetNamedValueSD (hkeyRoot, tszKeyName, tszValueName, &pSD, &fNewSD);

    // Get security descriptor from registry or create a new one
    if (dwReturnValue != ERROR_SUCCESS)  goto CLEANUP;

    if (!GetSecurityDescriptorDacl (pSD, &fPresent, &pDacl, &fDefaultDACL))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    if (fNewSD)
    {
        dwReturnValue = SetAclDefaults(&pDacl, dwSDType);
        if (dwReturnValue != ERROR_SUCCESS)  goto CLEANUP;
    }

    // Add the tszPrincipal that the caller wants added
    if (fPermit)
    {
        dwReturnValue = AddAccessAllowedACEToACL (&pDacl, dwAccessMask, tszPrincipal);
    }
    else
    {
        dwReturnValue = AddAccessDeniedACEToACL (&pDacl, dwAccessMask, tszPrincipal);
    }

    if (dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

    // Make the security descriptor absolute if it isn't new
    if (!fNewSD)
    {
        dwReturnValue = MakeSDAbsolute ((PSECURITY_DESCRIPTOR) pSD, (PSECURITY_DESCRIPTOR *) &psdAbsolute);
        if (dwReturnValue != ERROR_SUCCESS) goto CLEANUP;
    }
    else
    {
        psdAbsolute = pSD;
    }

    // Set the discretionary ACL on the security descriptor
    if (!SetSecurityDescriptorDacl (psdAbsolute, TRUE, pDacl, FALSE))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
     }

    // Make the security descriptor self-relative so that we can
    // store it in the registry
    cbSecurityDesc = 0;

    MakeSelfRelativeSD (psdAbsolute, psdSelfRelative, &cbSecurityDesc);

    psdSelfRelative = (SECURITY_DESCRIPTOR *) malloc (cbSecurityDesc);

    if(!psdSelfRelative)
    {
        dwReturnValue = ERROR_OUTOFMEMORY;
        goto CLEANUP;
    }

    if (!MakeSelfRelativeSD (psdAbsolute, psdSelfRelative, &cbSecurityDesc))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    // Store the security descriptor in the registry
    SetNamedValueSD (hkeyRoot, tszKeyName, tszValueName, psdSelfRelative);

CLEANUP:

    if(pSD) free (pSD);
    if(psdSelfRelative) free (psdSelfRelative);
    if(psdAbsolute && pSD != psdAbsolute) free (psdAbsolute);

    return dwReturnValue;
}

DWORD ChangeAppIDAccessACL | ( | LPTSTR | AppID,
 |  | LPTSTR | Principal,
 |  | BOOL | SetPrincipal,
 |  | BOOL | Permit,
 |  | DWORD | dwAccessMask
 | ) |  |

Definition at line 481 of file Wrappers.Cpp.

{
    TCHAR   tszKeyName [256] = {0};
    DWORD dwReturnValue = ERROR_SUCCESS;

    _sntprintf (tszKeyName,
                 (sizeof(tszKeyName)/sizeof(*tszKeyName))-1,
                 tszAppID [0] == '{' ? _T("APPID\\%s") : _T("APPID\\{%s}"),
                 tszAppID);

    if (fSetPrincipal)
    {
        dwReturnValue =
            RemovePrincipalFromNamedValueSD (HKEY_CLASSES_ROOT,
                                             tszKeyName,
                                             _T("AccessPermission"),
                                             tszPrincipal,
                                             fPermit ? ACCESS_ALLOWED_ACE_TYPE :
                                             ACCESS_DENIED_ACE_TYPE);

        if(dwReturnValue != ERROR_SUCCESS) return dwReturnValue;

        dwReturnValue =
            UpdatePrincipalInNamedValueSD(HKEY_CLASSES_ROOT,
                                          tszKeyName,
                                          _T("AccessPermission"),
                                          tszPrincipal,
                                          dwAccessMask,
                                          TRUE,
                                          fPermit ? ACCESS_DENIED_ACE_TYPE :
                                          ACCESS_ALLOWED_ACE_TYPE);

        if(dwReturnValue != ERROR_SUCCESS) return dwReturnValue;

        dwReturnValue =
            AddPrincipalToNamedValueSD (HKEY_CLASSES_ROOT,
                                        tszKeyName,
                                        _T("AccessPermission"),
                                        tszPrincipal,
                                        fPermit,
                                        dwAccessMask,
                                        SDTYPE_APPLICATION_ACCESS);
    }
    else
    {
        dwReturnValue =
            RemovePrincipalFromNamedValueSD (HKEY_CLASSES_ROOT,
                                             tszKeyName,
                                             _T("AccessPermission"),
                                             tszPrincipal,
                                             ACE_TYPE_ALL);
    }

    return dwReturnValue;
}

DWORD ChangeAppIDLaunchAndActivateACL | ( | LPTSTR | AppID,
 |  | LPTSTR | Principal,
 |  | BOOL | SetPrincipal,
 |  | BOOL | Permit,
 |  | DWORD | dwAccessMask
 | ) |  |

Definition at line 570 of file Wrappers.Cpp.

{
    TCHAR   tszKeyName [256] = {0};
    DWORD dwReturnValue = ERROR_SUCCESS;

    _sntprintf (tszKeyName,
                 (sizeof(tszKeyName)/sizeof(*tszKeyName))-1,
                 tszAppID [0] == '{' ? _T("APPID\\%s") : _T("APPID\\{%s}"),
                 tszAppID);

    if (fSetPrincipal)
    {
        dwReturnValue =
            RemovePrincipalFromNamedValueSD (HKEY_CLASSES_ROOT,
                                             tszKeyName,
                                             _T("LaunchPermission"),
                                             tszPrincipal,
                                             fPermit ? ACCESS_ALLOWED_ACE_TYPE :
                                             ACCESS_DENIED_ACE_TYPE);

        if(dwReturnValue != ERROR_SUCCESS) return dwReturnValue;

        dwReturnValue =
            UpdatePrincipalInNamedValueSD(HKEY_CLASSES_ROOT,
                                          tszKeyName,
                                          _T("LaunchPermission"),
                                          tszPrincipal,
                                          dwAccessMask,
                                          TRUE,
                                          fPermit ? ACCESS_DENIED_ACE_TYPE :
                                          ACCESS_ALLOWED_ACE_TYPE);

        if(dwReturnValue != ERROR_SUCCESS) return dwReturnValue;

        dwReturnValue =
            AddPrincipalToNamedValueSD (HKEY_CLASSES_ROOT,
                                        tszKeyName,
                                        _T("LaunchPermission"),
                                        tszPrincipal,
                                        fPermit,
                                        dwAccessMask,
                                        SDTYPE_APPLICATION_LAUNCH);
    }
    else
    {
        dwReturnValue =
            RemovePrincipalFromNamedValueSD (HKEY_CLASSES_ROOT,
                                             tszKeyName,
                                             _T("LaunchPermission"),
                                             tszPrincipal,
                                             ACE_TYPE_ALL);
    }

    return dwReturnValue;
}

DWORD ChangeDefaultAccessACL | ( | LPTSTR | Principal,
 |  | BOOL | SetPrincipal,
 |  | BOOL | Permit,
 |  | DWORD | dwAccessMask
 | ) |  |

Definition at line 317 of file Wrappers.Cpp.

{

    DWORD dwReturnValue = ERROR_SUCCESS;

    if (fSetPrincipal)
    {
        dwReturnValue =
            RemovePrincipalFromNamedValueSD (HKEY_LOCAL_MACHINE,
                                             _T("Software\\Microsoft\\Ole"),
                                             _T("DefaultAccessPermission"),
                                             tszPrincipal,
                                             fPermit ? ACCESS_ALLOWED_ACE_TYPE :
                                             ACCESS_DENIED_ACE_TYPE);

        if(dwReturnValue != ERROR_SUCCESS) return dwReturnValue;

        dwReturnValue =
            UpdatePrincipalInNamedValueSD(HKEY_LOCAL_MACHINE,
                                          _T("Software\\Microsoft\\Ole"),
                                          _T("DefaultAccessPermission"),
                                          tszPrincipal,
                                          dwAccessMask,
                                          TRUE,
                                          fPermit ? ACCESS_DENIED_ACE_TYPE :
                                          ACCESS_ALLOWED_ACE_TYPE);

        if(dwReturnValue != ERROR_SUCCESS) return dwReturnValue;

        dwReturnValue =
            AddPrincipalToNamedValueSD (HKEY_LOCAL_MACHINE,
                                        _T("Software\\Microsoft\\Ole"),
                                        _T("DefaultAccessPermission"),
                                        tszPrincipal,
                                        fPermit,
                                        dwAccessMask,
                                        SDTYPE_DEFAULT_ACCESS);
    }
    else
    {
        dwReturnValue =
            RemovePrincipalFromNamedValueSD (HKEY_LOCAL_MACHINE,
                                             _T("Software\\Microsoft\\Ole"),
                                             _T("DefaultAccessPermission"),
                                             tszPrincipal,
                                             ACE_TYPE_ALL);
    }

    return dwReturnValue;

}

DWORD ChangeDefaultLaunchAndActivateACL | ( | LPTSTR | Principal,
 |  | BOOL | SetPrincipal,
 |  | BOOL | Permit,
 |  | DWORD | dwAccessMask
 | ) |  |

Definition at line 398 of file Wrappers.Cpp.

{
    DWORD dwReturnValue = ERROR_SUCCESS;

    if (fSetPrincipal)
    {
        dwReturnValue =
            RemovePrincipalFromNamedValueSD (HKEY_LOCAL_MACHINE,
                                             _T("Software\\Microsoft\\Ole"),
                                             _T("DefaultLaunchPermission"),
                                             tszPrincipal,
                                             fPermit ? ACCESS_ALLOWED_ACE_TYPE :
                                             ACCESS_DENIED_ACE_TYPE);

        if(dwReturnValue != ERROR_SUCCESS) return dwReturnValue;

        dwReturnValue =
            UpdatePrincipalInNamedValueSD(HKEY_LOCAL_MACHINE,
                                          _T("Software\\Microsoft\\Ole"),
                                          _T("DefaultLaunchPermission"),
                                          tszPrincipal,
                                          dwAccessMask,
                                          TRUE,
                                          fPermit ? ACCESS_DENIED_ACE_TYPE :
                                          ACCESS_ALLOWED_ACE_TYPE);

        if(dwReturnValue != ERROR_SUCCESS) return dwReturnValue;

        dwReturnValue =
            AddPrincipalToNamedValueSD (HKEY_LOCAL_MACHINE,
                                        _T("Software\\Microsoft\\Ole"),
                                        _T("DefaultLaunchPermission"),
                                        tszPrincipal,
                                        fPermit,
                                        dwAccessMask,
                                        SDTYPE_DEFAULT_LAUNCH);
    }
    else
    {
        dwReturnValue =
            RemovePrincipalFromNamedValueSD (HKEY_LOCAL_MACHINE,
                                             _T("Software\\Microsoft\\Ole"),
                                             _T("DefaultLaunchPermission"),
                                             tszPrincipal,
                                             ACE_TYPE_ALL);
    }

    return dwReturnValue;

}

DWORD ChangeMachineAccessACL | ( | LPTSTR | tszPrincipal,
 |  | BOOL | fSetPrincipal,
 |  | BOOL | fPermit,
 |  | DWORD | dwAccessMask
 | ) |  |

Definition at line 158 of file Wrappers.Cpp.

{

    DWORD dwReturnValue = ERROR_SUCCESS;

    if (fSetPrincipal)
    {
        dwReturnValue =
            RemovePrincipalFromNamedValueSD (HKEY_LOCAL_MACHINE,
                                             _T("Software\\Microsoft\\Ole"),
                                             _T("MachineAccessRestriction"),
                                             tszPrincipal,
                                             fPermit ? ACCESS_ALLOWED_ACE_TYPE : ACCESS_DENIED_ACE_TYPE);

        if(dwReturnValue != ERROR_SUCCESS) return dwReturnValue;

        dwReturnValue =
            UpdatePrincipalInNamedValueSD(HKEY HKEY_LOCAL_MACHINE,
                                          _T("Software\\Microsoft\\Ole"),
                                          _T("MachineAccessRestriction"),
                                          tszPrincipal,
                                          dwAccessMask,
                                          TRUE,
                                          fPermit ? ACCESS_DENIED_ACE_TYPE : ACCESS_ALLOWED_ACE_TYPE);

        if(dwReturnValue != ERROR_SUCCESS) return dwReturnValue;

        dwReturnValue =
            AddPrincipalToNamedValueSD (HKEY_LOCAL_MACHINE,
                                        _T("Software\\Microsoft\\Ole"),
                                        _T("MachineAccessRestriction"),
                                        tszPrincipal,
                                        fPermit,
                                        dwAccessMask,
                                        SDTYPE_MACHINE_ACCESS);
    }
    else
    {
        dwReturnValue =
            RemovePrincipalFromNamedValueSD (HKEY_LOCAL_MACHINE,
                                             _T("Software\\Microsoft\\Ole"),
                                             _T("MachineAccessRestriction"),
                                             tszPrincipal,
                                             ACE_TYPE_ALL);
    }

    return dwReturnValue;
}

DWORD ChangeMachineLaunchAndActivateACL | ( | LPTSTR | tszPrincipal,
 |  | BOOL | fSetPrincipal,
 |  | BOOL | fPermit,
 |  | DWORD | dwAccessMask
 | ) |  |

Definition at line 236 of file Wrappers.Cpp.

{

    DWORD dwReturnValue = ERROR_SUCCESS;

    if (fSetPrincipal)
    {
        dwReturnValue =
            RemovePrincipalFromNamedValueSD (HKEY_LOCAL_MACHINE,
                                             _T("Software\\Microsoft\\Ole"),
                                             _T("MachineLaunchRestriction"),
                                             tszPrincipal,
                                             fPermit ? ACCESS_ALLOWED_ACE_TYPE :
                                             ACCESS_DENIED_ACE_TYPE);

        if(dwReturnValue != ERROR_SUCCESS) return dwReturnValue;

        dwReturnValue =
            UpdatePrincipalInNamedValueSD(HKEY_LOCAL_MACHINE,
                                          _T("Software\\Microsoft\\Ole"),
                                          _T("MachineLaunchRestriction"),
                                          tszPrincipal,
                                          dwAccessMask,
                                          TRUE,
                                          fPermit ? ACCESS_DENIED_ACE_TYPE :
                                          ACCESS_ALLOWED_ACE_TYPE);

        if(dwReturnValue != ERROR_SUCCESS) return dwReturnValue;

        dwReturnValue =
            AddPrincipalToNamedValueSD (HKEY_LOCAL_MACHINE,
                                        _T("Software\\Microsoft\\Ole"),
                                        _T("MachineLaunchRestriction"),
                                        tszPrincipal,
                                        fPermit,
                                        dwAccessMask,
                                        SDTYPE_MACHINE_LAUNCH);
    }
    else
    {
        dwReturnValue =
            RemovePrincipalFromNamedValueSD (HKEY_LOCAL_MACHINE,
                                             _T("Software\\Microsoft\\Ole"),
                                             _T("MachineLaunchRestriction"),
                                             tszPrincipal,
                                             ACE_TYPE_ALL);
    }

    return dwReturnValue;
}

DWORD CopyACL | ( | PACL | paclOld,
 |  | PACL | paclNew
 | ) |  |

Definition at line 32 of file AclMgmt.Cpp.

{
    ACL_SIZE_INFORMATION  aclSizeInfo = {0};
    LPVOID                pvAce       = NULL;
    ACE_HEADER            *pAceHeader = NULL;
    ULONG                 i;

    if(!GetAclInformation (paclOld,
                           (LPVOID) &aclSizeInfo,
                           (DWORD) sizeof (aclSizeInfo),
                           AclSizeInformation))
    {
        return GetLastError();
    }

    // Copy all of the ACEs to the new ACL
    for (i = 0; i < aclSizeInfo.AceCount; i++)
    {
        // Get the ACE and header info
        if (!GetAce (paclOld, i, &pvAce))
            return GetLastError();

        pAceHeader = (ACE_HEADER *) pvAce;

        // Add the ACE to the new list
        if (!AddAce (paclNew, ACL_REVISION, 0xffffffff, pvAce, pAceHeader->AceSize))
            return GetLastError();
    }

    return ERROR_SUCCESS;
}

DWORD CreateNewSD ( SECURITY_DESCRIPTOR ** SD )

Definition at line 30 of file SDMgmt.Cpp.

{
    PACL    pAcl          = NULL;
    DWORD   cbSid         = 0;
    PSID    pSid          = NULL;
    PSID    psidGroup     = NULL;
    PSID    psidOwner     = NULL;
    DWORD   dwReturnValue = ERROR_SUCCESS;

    if(!ppSecurityDesc) return ERROR_BAD_ARGUMENTS;

    *ppSecurityDesc = NULL;

    dwReturnValue = GetCurrentUserSID (&pSid);

    if (dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

    cbSid = GetLengthSid (pSid);

    *ppSecurityDesc = (SECURITY_DESCRIPTOR *) malloc (
         sizeof (ACL) +  (2 * cbSid) + sizeof (SECURITY_DESCRIPTOR));

    if(!*ppSecurityDesc)
    {
        dwReturnValue = ERROR_OUTOFMEMORY;
        goto CLEANUP;
    }

    psidGroup = (SID *) (*ppSecurityDesc + 1);
    psidOwner = (SID *) (((BYTE *) psidGroup) + cbSid);
    pAcl = (ACL *) (((BYTE *) psidOwner) + cbSid);

    if (!InitializeSecurityDescriptor (*ppSecurityDesc, SECURITY_DESCRIPTOR_REVISION))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    if (!InitializeAcl (pAcl,
                        sizeof (ACL)+sizeof (ACCESS_ALLOWED_ACE)+cbSid,
                        ACL_REVISION2))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    if (!SetSecurityDescriptorDacl (*ppSecurityDesc, TRUE, pAcl, FALSE))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    memcpy (psidGroup, pSid, cbSid);
    if (!SetSecurityDescriptorGroup (*ppSecurityDesc, psidGroup, FALSE))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    memcpy (psidOwner, pSid, cbSid);
    if (!SetSecurityDescriptorOwner (*ppSecurityDesc, psidOwner, FALSE))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

CLEANUP:

    if(dwReturnValue != ERROR_SUCCESS)
    {
        if(*ppSecurityDesc) free (*ppSecurityDesc);
    }

    if(pSid) free (pSid);

    return dwReturnValue;
}

DWORD GetCurrentUserSID ( PSID * Sid )

Definition at line 36 of file UtilS.Cpp.

{
    TOKEN_USER  *ptokenUser = NULL;
    HANDLE      hToken = NULL;
    DWORD       cbToken = 0;
    DWORD       cbSid = 0;
    DWORD       dwReturnValue = ERROR_SUCCESS;

    if (!OpenProcessToken (GetCurrentProcess(), TOKEN_QUERY, &hToken))
    {
            dwReturnValue = GetLastError();
            goto CLEANUP;
    }

    GetTokenInformation (hToken,
                         TokenUser,
                         ptokenUser,
                         0,
                         &cbToken);

    ptokenUser = (TOKEN_USER *) malloc (cbToken);

    if (!GetTokenInformation (hToken,
                             TokenUser,
                             ptokenUser,
                             cbToken,
                             &cbToken))
    {
            dwReturnValue = GetLastError();
            goto CLEANUP;
    }

    cbSid = GetLengthSid (ptokenUser->User.Sid);
    *pSid = (PSID) malloc (cbSid);

    memcpy (*pSid, ptokenUser->User.Sid, cbSid);
    CloseHandle (hToken);

CLEANUP:

    free (ptokenUser);

    return dwReturnValue;
}

DWORD GetNamedValueSD | ( | HKEY | RootKey,
 |  | LPTSTR | KeyName,
 |  | LPTSTR | ValueName,
 |  | SECURITY_DESCRIPTOR ** | SD,
 |  | BOOL * | NewSD
 | ) |  |

Definition at line 467 of file SDMgmt.Cpp.

{
    DWORD  dwReturnValue = ERROR_SUCCESS;
    HKEY   hkeyReg       = NULL;
    DWORD  dwType        = 0;
    DWORD  cbSize        = 0;

    if(!ppSecurityDesc) return ERROR_BAD_ARGUMENTS;

    if(psdNew) *psdNew = FALSE;
    *ppSecurityDesc = NULL;

    // Get the security descriptor from the named value. If it doesn't
    // exist, create a fresh one.
    dwReturnValue = RegOpenKeyEx (hkeyRoot, tszKeyName, 0, KEY_ALL_ACCESS, &hkeyReg);

    if (dwReturnValue != ERROR_SUCCESS)
    {
        if(dwReturnValue == ERROR_FILE_NOT_FOUND)
        {
            goto CLEANUP;
        }

        return dwReturnValue;
    }

    dwReturnValue = RegQueryValueEx (hkeyReg, tszValueName, NULL, &dwType, NULL, &cbSize);

    if (dwReturnValue != ERROR_SUCCESS && dwReturnValue != ERROR_INSUFFICIENT_BUFFER)
    {
        goto CLEANUP;
    }

    *ppSecurityDesc = (SECURITY_DESCRIPTOR *) malloc (cbSize);

    dwReturnValue = RegQueryValueEx (hkeyReg, tszValueName, NULL, &dwType, (LPBYTE) *ppSecurityDesc, &cbSize);

CLEANUP:

    if(dwReturnValue != ERROR_SUCCESS)
    {
        if(*ppSecurityDesc) free(*ppSecurityDesc);

        *ppSecurityDesc = NULL;

        if(psdNew)
        {
            dwReturnValue = CreateNewSD (ppSecurityDesc);
            if (dwReturnValue == ERROR_SUCCESS)
            {
                *psdNew = TRUE;
            }
        }
    }

    if(hkeyReg) RegCloseKey (hkeyReg);

    return dwReturnValue;
}

DWORD GetPrincipalSID | ( | LPTSTR | Principal,
 |  | PSID * | Sid
 | ) |  |

Definition at line 196 of file UtilS.Cpp.

{
    DWORD        cbSid              = 0;
    TCHAR        tszRefDomain [256] = {0};
    DWORD        cbRefDomain        = 0;
    DWORD        dwReturnValue      = ERROR_SUCCESS;
    SID_NAME_USE snu;

    cbSid = 0;
    cbRefDomain = 255;

    if(ConstructWellKnownSID(tszPrincipal, pSid)) return ERROR_SUCCESS;

    LookupAccountName (NULL,
                       tszPrincipal,
                       *pSid,
                       &cbSid,
                       tszRefDomain,
                       &cbRefDomain,
                       &snu);

    dwReturnValue = GetLastError();
    if (dwReturnValue != ERROR_INSUFFICIENT_BUFFER) goto CLEANUP;

    dwReturnValue = ERROR_SUCCESS;

    *pSid = (PSID) malloc (cbSid);
    if(!pSid)
    {
        dwReturnValue = ERROR_OUTOFMEMORY;
        goto CLEANUP;
    }

    cbRefDomain = 255;

    if (!LookupAccountName (NULL,
                            tszPrincipal,
                            *pSid,
                            &cbSid,
                            tszRefDomain,
                            &cbRefDomain,
                            &snu))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

CLEANUP:

    return dwReturnValue;
}

DWORD GetRunAsPassword | ( | LPTSTR | AppID,
 |  | LPTSTR | Password
 | ) |  |

Definition at line 41 of file SrvcMgmt.Cpp.

{
    LSA_OBJECT_ATTRIBUTES objectAttributes             = {0};
    HANDLE                hPolicy                      = NULL;
    LSA_UNICODE_STRING    lsaKeyString                 = {0};
    PLSA_UNICODE_STRING   lsaPasswordString            = {0};
    WCHAR                 wszKey [4 + GUIDSTR_MAX + 1] = {0};
    WCHAR                 wszAppID [GUIDSTR_MAX + 1]   = {0};
    DWORD                 dwReturnValue                = ERROR_SUCCESS;

#ifndef UNICODE
    STR2UNI (wszAppID, tszAppID);
#else
    lstrcpy (wszAppID, tszAppID);
#endif

    wcsncpy (wszKey, L"SCM:", (sizeof(wszKey)/sizeof(WCHAR))-1);
    wcsncat (wszKey, wszAppID, (sizeof(wszKey)/sizeof(WCHAR))-5);

    lsaKeyString.Length = (USHORT) ((wcslen (wszKey) + 1) * sizeof (WCHAR));
    lsaKeyString.MaximumLength = (GUIDSTR_MAX + 5) * sizeof (WCHAR);
    lsaKeyString.Buffer = wszKey;

    // Open the local security policy
    objectAttributes.Length = sizeof (LSA_OBJECT_ATTRIBUTES);

    dwReturnValue = LsaOpenPolicy (NULL,
                                 &objectAttributes,
                                 POLICY_GET_PRIVATE_INFORMATION,
                                 &hPolicy);

    dwReturnValue = LsaNtStatusToWinError(dwReturnValue);

    if (dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

    // Read the user's password
    dwReturnValue = LsaRetrievePrivateData (hPolicy,
                                          &lsaKeyString,
                                          &lsaPasswordString);

    dwReturnValue = LsaNtStatusToWinError(dwReturnValue);

    if (dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

CLEANUP:

    if(hPolicy) LsaClose (hPolicy);

#ifndef UNICODE
    UNI2STR (tszPassword, lsaPasswordString->Buffer);
#else
    wcscpy (tszPassword, lsaPasswordString->Buffer);
#endif

    return dwReturnValue;
}

BOOL IsLegacySecurityModel ( )

Definition at line 285 of file UtilS.Cpp.

{
    BOOL fReturnValue = FALSE;
    OSVERSIONINFOEX VersionInfo = {sizeof(VersionInfo)};

    if(GetVersionEx ((LPOSVERSIONINFO)&VersionInfo))
    {

        if(VersionInfo.dwMajorVersion == VERSION_MAJOR_W2K_XP_W2K3)
        {
            if(VersionInfo.dwMinorVersion < VERSION_MINOR_XP)
            {
                fReturnValue = TRUE;
            }
            else if(VersionInfo.dwMinorVersion == VERSION_MINOR_XP)
            {
                if(VersionInfo.wServicePackMajor < 2)
                {
                    fReturnValue = TRUE;
                }
            }
            else if(VersionInfo.dwMinorVersion == VERSION_MINOR_W2K3)
            {
                if(VersionInfo.wServicePackMajor < 1)
                {
                    fReturnValue = TRUE;
                }
            }

        }
        else if(VersionInfo.dwMajorVersion < VERSION_MAJOR_W2K_XP_W2K3)
        {
            fReturnValue = TRUE;
        }

    }

    return fReturnValue;
}

void ListACL | ( | PACL | Acl,
 |  | DWORD | dwSDType
 | ) |  |

Definition at line 196 of file ListAcl.Cpp.

{
    ACL_SIZE_INFORMATION     aclSizeInfo                      = {0};
    ACL_REVISION_INFORMATION aclRevInfo                       = {0};
    ULONG                    i;
    LPVOID                   pvAce                            = NULL;
    ACE_HEADER               *pAceHeader                      = NULL;
    ACCESS_ALLOWED_ACE       *pAccessAllowedAce               = NULL;
    ACCESS_DENIED_ACE        *pAccessDeniedAce                = NULL;
    TCHAR                    tszDomainName [SIZE_NAME_BUFFER] = {0};
    TCHAR                    tszUserName [SIZE_NAME_BUFFER]   = {0};
    DWORD                    cchName = 0;
    SID_NAME_USE             snu;

    if (!GetAclInformation (Acl,
                            &aclSizeInfo,
                            sizeof (ACL_SIZE_INFORMATION),
                            AclSizeInformation))
    {
        _tprintf (_T("Could not get AclSizeInformation"));
        return;
    }

    if (!GetAclInformation (Acl,
                            &aclRevInfo,
                            sizeof (ACL_REVISION_INFORMATION),
                            AclRevisionInformation))
    {
        _tprintf (_T("Could not get AclRevisionInformation"));
        return;
    }

    for (i = 0; i < aclSizeInfo.AceCount; i++)
    {
        if (!GetAce (Acl, i, &pvAce))
            return;

        pAceHeader = (ACE_HEADER *) pvAce;

        if (pAceHeader->AceType == ACCESS_ALLOWED_ACE_TYPE)
        {
            pAccessAllowedAce = (ACCESS_ALLOWED_ACE *) pvAce;
            cchName = SIZE_NAME_BUFFER-1;
            LookupAccountSid (NULL,
                              &pAccessAllowedAce->SidStart,
                              tszUserName,
                              &cchName,
                              tszDomainName,
                              &cchName,
                              &snu);

            DisplayAccess(pAccessAllowedAce->Mask,
                          dwSDType,
                          _T("permitted"),
                          tszUserName,
                          tszDomainName);

        }
        else if (pAceHeader->AceType == ACCESS_DENIED_ACE_TYPE)
        {
            pAccessDeniedAce = (ACCESS_DENIED_ACE *) pvAce;
            cchName = SIZE_NAME_BUFFER-1;
            LookupAccountSid (NULL,
                              &pAccessDeniedAce->SidStart,
                              tszUserName,
                              &cchName,
                              tszDomainName,
                              &cchName,
                              &snu);

            DisplayAccess(pAccessDeniedAce->Mask,
                          dwSDType,
                          _T("denied"),
                          tszUserName,
                          tszDomainName);

        }
   }
}

DWORD ListAppIDAccessACL ( LPTSTR AppID )

Definition at line 92 of file Wrappers.Cpp.

{
    TCHAR   tszKeyName [256] = {0};

    _sntprintf (tszKeyName,
                 (sizeof(tszKeyName)/sizeof(*tszKeyName))-1,
                 tszAppID [0] == '{' ? _T("APPID\\%s") : _T("APPID\\{%s}"),
                 tszAppID);

    return ListNamedValueSD (HKEY_CLASSES_ROOT,
                             tszKeyName,
                             _T("AccessPermission"),
                             SDTYPE_APPLICATION_ACCESS);
}

DWORD ListAppIDLaunchACL ( LPTSTR AppID )

Definition at line 116 of file Wrappers.Cpp.

{
    TCHAR   tszKeyName [256] = {0};

    _sntprintf (tszKeyName,
                 (sizeof(tszKeyName)/sizeof(*tszKeyName))-1,
                 tszAppID [0] == '{' ? _T("APPID\\%s") : _T("APPID\\{%s}"),
                 tszAppID);

    return ListNamedValueSD (HKEY_CLASSES_ROOT,
                             tszKeyName,
                             _T("LaunchPermission"),
                             SDTYPE_APPLICATION_LAUNCH);
}

DWORD ListDefaultAccessACL ( )

Definition at line 62 of file Wrappers.Cpp.

{
    return ListNamedValueSD (HKEY_LOCAL_MACHINE,
                             _T("Software\\Microsoft\\Ole"),
                             _T("DefaultAccessPermission"),
                             SDTYPE_DEFAULT_ACCESS);
}

DWORD ListDefaultLaunchACL ( )

Definition at line 77 of file Wrappers.Cpp.

{
    return ListNamedValueSD (HKEY_LOCAL_MACHINE,
                             _T("Software\\Microsoft\\Ole"),
                             _T("DefaultLaunchPermission"),
                             SDTYPE_DEFAULT_LAUNCH);
}

DWORD ListMachineAccessACL ( )

Definition at line 32 of file Wrappers.Cpp.

{
    return ListNamedValueSD (HKEY_LOCAL_MACHINE,
                             _T("Software\\Microsoft\\Ole"),
                             _T("MachineAccessRestriction"),
                             SDTYPE_MACHINE_ACCESS);
}

DWORD ListMachineLaunchACL ( )

Definition at line 47 of file Wrappers.Cpp.

{
    return ListNamedValueSD (HKEY_LOCAL_MACHINE,
                             _T("Software\\Microsoft\\Ole"),
                             _T("MachineLaunchRestriction"),
                             SDTYPE_MACHINE_LAUNCH);
}

DWORD ListNamedValueSD | ( | HKEY | hkeyRoot,
 |  | LPTSTR | tszKeyName,
 |  | LPTSTR | tszValueName,
 |  | DWORD | dwSDType
 | ) |  |

Definition at line 539 of file SDMgmt.Cpp.

{
    DWORD               dwReturnValue = ERROR_SUCCESS;
    SECURITY_DESCRIPTOR *pSD          = NULL;
    BOOL                fPresent      = FALSE;
    BOOL                fDefaultDACL  = FALSE;
    PACL                dacl          = NULL;

    dwReturnValue = GetNamedValueSD (hkeyRoot, tszKeyName, tszValueName, &pSD, NULL);

    if (dwReturnValue != ERROR_SUCCESS)
    {
        _tprintf (_T("<Using Default Permissions>\n"));
        goto CLEANUP;
    }

    if (!GetSecurityDescriptorDacl (pSD, &fPresent, &dacl, &fDefaultDACL))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    if (!fPresent)
    {
        _tprintf (_T("<Access is denied to everyone>\n"));
        goto CLEANUP;
    }

    ListACL (dacl, dwSDType);

CLEANUP:

    if(pSD) free (pSD);

    return dwReturnValue;
}

DWORD MakeSDAbsolute | ( | PSECURITY_DESCRIPTOR | OldSD,
 |  | PSECURITY_DESCRIPTOR * | NewSD
 | ) |  |

Definition at line 320 of file SDMgmt.Cpp.

{
    PSECURITY_DESCRIPTOR  pSid           = NULL;
    DWORD                 cbDescriptor   = 0;
    DWORD                 cbDacl         = 0;
    DWORD                 cbSacl         = 0;
    DWORD                 cbOwnerSID     = 0;
    DWORD                 cbGroupSID     = 0;
    PACL                  pDacl          = NULL;
    PACL                  pSacl          = NULL;
    PSID                  psidOwner      = NULL;
    PSID                  psidGroup      = NULL;
    BOOL                  fPresent       = FALSE;
    BOOL                  fSystemDefault = FALSE;
    DWORD                 dwReturnValue  = ERROR_SUCCESS;

    // Get SACL
    if (!GetSecurityDescriptorSacl (psidOld, &fPresent, &pSacl, &fSystemDefault))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    if (pSacl && fPresent)
    {
        cbSacl = pSacl->AclSize;
    }

    // Get DACL
    if (!GetSecurityDescriptorDacl (psidOld, &fPresent, &pDacl, &fSystemDefault))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    if (pDacl && fPresent)
    {
        cbDacl = pDacl->AclSize;
    }

    // Get Owner
    if (!GetSecurityDescriptorOwner (psidOld, &psidOwner, &fSystemDefault))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    cbOwnerSID = GetLengthSid (psidOwner);

    // Get Group
    if (!GetSecurityDescriptorGroup (psidOld, &psidGroup, &fSystemDefault))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    cbGroupSID = GetLengthSid (psidGroup);

    // Do the conversion
    cbDescriptor = 0;

    MakeAbsoluteSD (psidOld, pSid, &cbDescriptor, pDacl, &cbDacl, pSacl,
                    &cbSacl, psidOwner, &cbOwnerSID, psidGroup,
                    &cbGroupSID);

    pSid = (PSECURITY_DESCRIPTOR) malloc(cbDescriptor);
    if(!pSid)
    {
        dwReturnValue = ERROR_OUTOFMEMORY;
        goto CLEANUP;
    }

    ZeroMemory(pSid, cbDescriptor);

    if (!InitializeSecurityDescriptor (pSid, SECURITY_DESCRIPTOR_REVISION))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    if (!MakeAbsoluteSD (psidOld, pSid, &cbDescriptor, pDacl, &cbDacl, pSacl,
                         &cbSacl, psidOwner, &cbOwnerSID, psidGroup,
                         &cbGroupSID))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

CLEANUP:

    if(dwReturnValue != ERROR_SUCCESS && pSid)
    {
        free(pSid);
        pSid = NULL;
    }

    *psidNew = pSid;

    return dwReturnValue;
}

DWORD RemovePrincipalFromACL | ( | PACL | paclOrig,
 |  | LPTSTR | tszPrincipal,
 |  | DWORD | fAceType
 | ) |  |

Definition at line 399 of file AclMgmt.Cpp.

{
    ACL_SIZE_INFORMATION    aclSizeInfo        = {0};
    LONG                   i;
    LPVOID                  pvAce              = NULL;
    ACCESS_ALLOWED_ACE      *pAccessAllowedAce = NULL;
    ACCESS_DENIED_ACE       *pAccessDeniedAce  = NULL;
    SYSTEM_AUDIT_ACE        *pSystemAuditAce   = NULL;
    PSID                    psidPrincipal      = NULL;
    DWORD                   dwReturnValue      = ERROR_SUCCESS;
    ACE_HEADER              *pAceHeader        = NULL;
    DWORD                   dwFoundValue       = ERROR_FILE_NOT_FOUND;

    dwReturnValue = GetPrincipalSID (tszPrincipal, &psidPrincipal);
    if (dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

    if(!GetAclInformation (paclOrig,
                           (LPVOID) &aclSizeInfo,
                           (DWORD) sizeof (ACL_SIZE_INFORMATION),
                           AclSizeInformation))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    for (i = aclSizeInfo.AceCount-1; i >= 0; i--)
    {
        if (!GetAce (paclOrig, i, &pvAce))
        {
            dwReturnValue = GetLastError();
            goto CLEANUP;
        }

        pAceHeader = (ACE_HEADER *) pvAce;

        if ((fAceType == ACCESS_ALLOWED_ACE_TYPE ||
             fAceType == ACE_TYPE_ALL) &&
            pAceHeader->AceType == ACCESS_ALLOWED_ACE_TYPE)
        {
            pAccessAllowedAce = (ACCESS_ALLOWED_ACE *) pvAce;

            if (EqualSid (psidPrincipal, (PSID) &pAccessAllowedAce->SidStart))
            {
                if(pAccessAllowedAce->Mask & SPECIFIC_RIGHTS_ALL)
                {
                    DeleteAce (paclOrig, i);
                }
                dwFoundValue = ERROR_SUCCESS;
            }
        }
        else if ((fAceType == ACCESS_DENIED_ACE_TYPE ||
                  fAceType == ACE_TYPE_ALL) &&
                 pAceHeader->AceType == ACCESS_DENIED_ACE_TYPE)
        {
            pAccessDeniedAce = (ACCESS_DENIED_ACE *) pvAce;

            if (EqualSid (psidPrincipal, (PSID) &pAccessDeniedAce->SidStart))
            {
                if(pAccessDeniedAce->Mask & SPECIFIC_RIGHTS_ALL)
                {
                    DeleteAce (paclOrig, i);
                }
                dwFoundValue = ERROR_SUCCESS;
            }
        }
        else if ((fAceType == SYSTEM_AUDIT_ACE_TYPE ||
                  fAceType == ACE_TYPE_ALL) &&
                 pAceHeader->AceType == SYSTEM_AUDIT_ACE_TYPE)
        {
            pSystemAuditAce = (SYSTEM_AUDIT_ACE *) pvAce;

            if (EqualSid (psidPrincipal, (PSID) &pSystemAuditAce->SidStart))
            {
                if(pSystemAuditAce->Mask & SPECIFIC_RIGHTS_ALL)
                {
                    DeleteAce (paclOrig, i);
                }
                dwFoundValue = ERROR_SUCCESS;
            }
        }
    }

CLEANUP:

    if(psidPrincipal) free (psidPrincipal);

    if(dwReturnValue == ERROR_SUCCESS) dwReturnValue = dwFoundValue;

    return dwReturnValue;
}

DWORD RemovePrincipalFromNamedValueSD | ( | HKEY | RootKey,
 |  | LPTSTR | KeyName,
 |  | LPTSTR | ValueName,
 |  | LPTSTR | Principal,
 |  | DWORD | fAceType
 | ) |  |

Definition at line 789 of file SDMgmt.Cpp.

{
    DWORD               dwReturnValue    = ERROR_SUCCESS;
    SECURITY_DESCRIPTOR *pSD             = NULL;
    SECURITY_DESCRIPTOR *psdSelfRelative = NULL;
    SECURITY_DESCRIPTOR *psdAbsolute     = NULL;
    DWORD               cbSecurityDesc   = 0;
    BOOL                fPresent         = FALSE;
    BOOL                fDefaultDACL     = FALSE;
    PACL                pDacl            = NULL;

    dwReturnValue = GetNamedValueSD (hkeyRoot, tszKeyName, tszValueName, &pSD, NULL);

    // Get security descriptor from registry or create a new one
    if (dwReturnValue != ERROR_SUCCESS)
    {
        if(dwReturnValue == ERROR_FILE_NOT_FOUND)
        {
            dwReturnValue = ERROR_SUCCESS;
        }
        goto CLEANUP;
    }

    if (!GetSecurityDescriptorDacl (pSD, &fPresent, &pDacl, &fDefaultDACL))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    // Remove the tszPrincipal that the caller wants removed
    dwReturnValue = RemovePrincipalFromACL (pDacl, tszPrincipal, fAceType);
    if(dwReturnValue == ERROR_FILE_NOT_FOUND)
    {
        dwReturnValue = ERROR_SUCCESS;
        goto CLEANUP;
    }
    else if (dwReturnValue != ERROR_SUCCESS)
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    // Make the security descriptor absolute if it isn't new
    dwReturnValue = MakeSDAbsolute ((PSECURITY_DESCRIPTOR) pSD, (PSECURITY_DESCRIPTOR *) &psdAbsolute);
    if (dwReturnValue != ERROR_SUCCESS)  goto CLEANUP;

    // Set the discretionary ACL on the security descriptor
    if (!SetSecurityDescriptorDacl (psdAbsolute, TRUE, pDacl, FALSE))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    // Make the security descriptor self-relative so that we can
    // store it in the registry
    cbSecurityDesc = 0;
    MakeSelfRelativeSD (psdAbsolute, psdSelfRelative, &cbSecurityDesc);

    psdSelfRelative = (SECURITY_DESCRIPTOR *) malloc (cbSecurityDesc);

    if (!MakeSelfRelativeSD (psdAbsolute, psdSelfRelative, &cbSecurityDesc))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    // Store the security descriptor in the registry
    dwReturnValue = SetNamedValueSD (hkeyRoot, tszKeyName, tszValueName, psdSelfRelative);

CLEANUP:

    if(pSD) free (pSD);
    if(psdSelfRelative) free (psdSelfRelative);
    if(psdAbsolute) free (psdAbsolute);

    return dwReturnValue;
}

DWORD SetAccountRights | ( | LPTSTR | User,
 |  | LPTSTR | Privilege
 | ) |  |

Definition at line 192 of file SrvcMgmt.Cpp.

{
    LSA_HANDLE            hPolicy            = NULL;
    LSA_OBJECT_ATTRIBUTES objectAttributes   = {0};
    PSID                  psidPrincipal      = NULL;
    LSA_UNICODE_STRING    lsaPrivilegeString = {0};
    WCHAR                 wszPrivilege [256] = {0};
    DWORD                dwReturnValue       = ERROR_SUCCESS;

#ifdef _UNICODE
    lstrcpy (wszPrivilege, tszPrivilege);
#else
    STR2UNI (wszPrivilege, tszPrivilege);
#endif

    dwReturnValue = LsaOpenPolicy (NULL,
                                   &objectAttributes,
                                   POLICY_CREATE_ACCOUNT | POLICY_LOOKUP_NAMES,
                                   &hPolicy);

    dwReturnValue = LsaNtStatusToWinError(dwReturnValue);

    if (dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

    dwReturnValue = GetPrincipalSID (tszUser, &psidPrincipal);
    if (dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

    lsaPrivilegeString.Length = (USHORT) (wcslen (wszPrivilege) * sizeof (WCHAR));
    lsaPrivilegeString.MaximumLength = (USHORT) (lsaPrivilegeString.Length + sizeof (WCHAR));
    lsaPrivilegeString.Buffer = wszPrivilege;

    dwReturnValue = LsaAddAccountRights (hPolicy,
                                         psidPrincipal,
                                         &lsaPrivilegeString,
                                         1);

    dwReturnValue = LsaNtStatusToWinError(dwReturnValue);

    if (dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

CLEANUP:

    if(psidPrincipal) free (psidPrincipal);
    if(hPolicy) LsaClose (hPolicy);

    return dwReturnValue;
}

DWORD SetAclDefaults | ( | PACL | pDacl,
 |  | DWORD | dwSDType
 | ) |  |
DWORD SetNamedValueSD | ( | HKEY | RootKey,
 |  | LPTSTR | KeyName,
 |  | LPTSTR | ValueName,
 |  | SECURITY_DESCRIPTOR * | SD
 | ) |  |

Definition at line 429 of file SDMgmt.Cpp.

{
    DWORD   dwReturnValue = ERROR_SUCCESS;
    DWORD   dwDisposition = 0;
    HKEY    hkeyReg       = NULL;

    // Create new key or open existing key
    dwReturnValue = RegCreateKeyEx (hkeyRoot, tszKeyName, 0, _T(""), 0, KEY_ALL_ACCESS, NULL, &hkeyReg, &dwDisposition);
    if (dwReturnValue != ERROR_SUCCESS)
    {
        goto CLEANUP;
    }

    // Write the security descriptor
    dwReturnValue = RegSetValueEx (hkeyReg, tszValueName, 0, REG_BINARY, (LPBYTE) pSecurityDesc, GetSecurityDescriptorLength (pSecurityDesc));
    if (dwReturnValue != ERROR_SUCCESS)
    {
        goto CLEANUP;
    }

CLEANUP:

    if(hkeyReg) RegCloseKey (hkeyReg);

    return dwReturnValue;
}

DWORD SetRunAsPassword | ( | LPTSTR | AppID,
 |  | LPTSTR | Password
 | ) |  |
DWORD SetRunAsPassword | ( | LPTSTR | AppID,
 |  | LPTSTR | Principal,
 |  | LPTSTR | Password
 | ) |  |

Definition at line 121 of file SrvcMgmt.Cpp.

{
    LSA_OBJECT_ATTRIBUTES objectAttributes             = {0};
    HANDLE                hPolicy                      = NULL;
    LSA_UNICODE_STRING    lsaKeyString                 = {0};
    LSA_UNICODE_STRING    lsaPasswordString            = {0};
    WCHAR                 wszKey [4 + GUIDSTR_MAX + 1] = {0};
    WCHAR                 wszAppID [GUIDSTR_MAX + 1]   = {0};
    WCHAR                 wszPassword [256]            = {0};
    DWORD                 dwReturnValue                = ERROR_SUCCESS;

#ifndef UNICODE
    STR2UNI (wszAppID, tszAppID);
    STR2UNI (wszPassword, tszPassword);
#else
    wcsncpy (wszAppID, tszAppID, (sizeof(wszAppID)/sizeof(*wszAppID))-1);
    wcsncpy (wszPassword, tszPassword, (sizeof(wszPassword)/sizeof(*wszPassword))-1);
#endif

    wcsncpy (wszKey, L"SCM:", (sizeof(wszKey)/sizeof(*wszKey))-1);
    wcsncat (wszKey, wszAppID, (sizeof(wszKey)/sizeof(*wszKey))-5);

    lsaKeyString.Length = (USHORT) ((wcslen (wszKey) + 1) * sizeof (WCHAR));
    lsaKeyString.MaximumLength = (GUIDSTR_MAX + 5) * sizeof (WCHAR);
    lsaKeyString.Buffer = wszKey;

    lsaPasswordString.Length = (USHORT) ((wcslen (wszPassword) + 1) * sizeof (WCHAR));
    lsaPasswordString.Buffer = wszPassword;
    lsaPasswordString.MaximumLength = lsaPasswordString.Length;

    // Open the local security policy
    objectAttributes.Length = sizeof (LSA_OBJECT_ATTRIBUTES);

    dwReturnValue = LsaOpenPolicy (NULL,
                                 &objectAttributes,
                                 POLICY_CREATE_SECRET,
                                 &hPolicy);

    dwReturnValue = LsaNtStatusToWinError(dwReturnValue);

    if (dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

    // Store the user's password
    dwReturnValue = LsaStorePrivateData (hPolicy,
                                       &lsaKeyString,
                                       &lsaPasswordString);

    dwReturnValue = LsaNtStatusToWinError(dwReturnValue);

    if (dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

    dwReturnValue = SetAccountRights (tszPrincipal, _T("SeBatchLogonRight"));
    if (dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

CLEANUP:

    if(hPolicy) LsaClose (hPolicy);

    return dwReturnValue;
}

LPTSTR SystemMessage | ( | LPTSTR | szBuffer,
 |  | DWORD | cbBuffer,
 |  | HRESULT | hr
 | ) |  |

Definition at line 256 of file UtilS.Cpp.

{
    LPTSTR   tszMessage = NULL;

    FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER |
                   FORMAT_MESSAGE_FROM_SYSTEM,
                   NULL,
                   hr,
                   MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
                   (LPTSTR) &tszMessage,
                   0,
                   NULL);

    _sntprintf (tszBuffer, cbBuffer-1, _T("%s(%lx)\n"), tszMessage, hr);

    LocalFree (tszMessage);
    return tszBuffer;
}

DWORD UpdatePrincipalInACL | ( | PACL | paclOrig,
 |  | LPTSTR | tszPrincipal,
 |  | DWORD | dwAccessMask,
 |  | BOOL | fRemove,
 |  | DWORD | fAceType
 | ) |  |

Definition at line 229 of file AclMgmt.Cpp.

{
    ACL_SIZE_INFORMATION    aclSizeInfo        = {0};
    LONG                   i;
    LPVOID                  pvAce              = NULL;
    ACCESS_ALLOWED_ACE      *pAccessAllowedAce = NULL;
    ACCESS_DENIED_ACE       *pAccessDeniedAce  = NULL;
    SYSTEM_AUDIT_ACE        *pSystemAuditAce   = NULL;
    PSID                    psidPrincipal      = NULL;
    DWORD                   dwReturnValue      = ERROR_SUCCESS;
    ACE_HEADER              *pAceHeader        = NULL;
    DWORD                   dwFoundValue       = ERROR_FILE_NOT_FOUND;

    //Construct a SID for this principal
    dwReturnValue = GetPrincipalSID (tszPrincipal, &psidPrincipal);
    if (dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

    if(!GetAclInformation (paclOrig,
                           (LPVOID) &aclSizeInfo,
                           (DWORD) sizeof (ACL_SIZE_INFORMATION),
                           AclSizeInformation))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    //Iterate through all of the ACEs in this ACL looking for a SID that corresponds
    //to the principal.
    for (i = aclSizeInfo.AceCount-1; i >= 0; i--)
    {
        if (!GetAce (paclOrig, i, &pvAce))
        {
            dwReturnValue = GetLastError();
            goto CLEANUP;
        }

        pAceHeader = (ACE_HEADER *) pvAce;

        if ((fAceType == ACCESS_ALLOWED_ACE_TYPE ||
             fAceType == ACE_TYPE_ALL) &&
            pAceHeader->AceType == ACCESS_ALLOWED_ACE_TYPE)
        {
            pAccessAllowedAce = (ACCESS_ALLOWED_ACE *) pvAce;

            if (EqualSid (psidPrincipal, (PSID) &pAccessAllowedAce->SidStart))
            {
                //We've found an ACE.  Let's modify the mask bits
                if(fRemove && (pAccessAllowedAce->Mask & SPECIFIC_RIGHTS_ALL))
                {
                    pAccessAllowedAce->Mask &= ~dwAccessMask;
                    //If there are any COM rights reamining we must ensure
                    //COM_RIGHTS_EXECUTE is set before leaving.
                    if(pAccessAllowedAce->Mask & (COM_RIGHTS_ACTIVATE_LOCAL  |
                                                  COM_RIGHTS_ACTIVATE_REMOTE |
                                                  COM_RIGHTS_EXECUTE_LOCAL   |
                                                  COM_RIGHTS_EXECUTE_REMOTE))
                    {
                        pAccessAllowedAce->Mask |= COM_RIGHTS_EXECUTE;
                    }
                    else if((pAccessAllowedAce->Mask & SPECIFIC_RIGHTS_ALL) == 0)
                    {
                        //If there are no more specific rights on this ACE we
                        //may delete it.
                        DeleteAce (paclOrig, i);
                    }

                }
                else
                {
                    pAccessAllowedAce->Mask |= dwAccessMask;
                }
                dwFoundValue = ERROR_SUCCESS;
            }
        }
        else if ((fAceType == ACCESS_DENIED_ACE_TYPE ||
                  fAceType == ACE_TYPE_ALL) &&
                 pAceHeader->AceType == ACCESS_DENIED_ACE_TYPE)
        {
            pAccessDeniedAce = (ACCESS_DENIED_ACE *) pvAce;

            if (EqualSid (psidPrincipal, (PSID) &pAccessDeniedAce->SidStart))
            {
                //We've found an ACE.  Let's modify the mask bits
                if(fRemove && (pAccessDeniedAce->Mask & SPECIFIC_RIGHTS_ALL))
                {
                    pAccessDeniedAce->Mask &= ~dwAccessMask;

                    //If there are any COM rights reamining we must ensure
                    //COM_RIGHTS_EXECUTE is set before leaving.
                    if(pAccessDeniedAce->Mask & (COM_RIGHTS_ACTIVATE_LOCAL  |
                                                 COM_RIGHTS_ACTIVATE_REMOTE |
                                                 COM_RIGHTS_EXECUTE_LOCAL   |
                                                 COM_RIGHTS_EXECUTE_REMOTE))
                    {
                        pAccessDeniedAce->Mask |= COM_RIGHTS_EXECUTE;
                    }
                    else if((pAccessDeniedAce->Mask & SPECIFIC_RIGHTS_ALL) == 0)
                    {
                        //If there are no more specific rights on this ACE we
                        //may delete it.
                        DeleteAce (paclOrig, i);
                    }
                }
                else
                {
                    pAccessDeniedAce->Mask |= dwAccessMask;
                }
                dwFoundValue = ERROR_SUCCESS;
            }
        }
        else if ((fAceType == SYSTEM_AUDIT_ACE_TYPE ||
                  fAceType == ACE_TYPE_ALL) &&
                 pAceHeader->AceType == SYSTEM_AUDIT_ACE_TYPE)
        {
            pSystemAuditAce = (SYSTEM_AUDIT_ACE *) pvAce;

            if (EqualSid (psidPrincipal, (PSID) &pSystemAuditAce->SidStart))
            {
                //We've found an ACE.  Let's modify the mask bits
                if(fRemove && (pSystemAuditAce->Mask & SPECIFIC_RIGHTS_ALL))
                {
                    pSystemAuditAce->Mask &= ~dwAccessMask;

                    //If there are any COM rights reamining we must ensure
                    //COM_RIGHTS_EXECUTE is set before leaving.
                    if(pSystemAuditAce->Mask & (COM_RIGHTS_ACTIVATE_LOCAL  |
                                                COM_RIGHTS_ACTIVATE_REMOTE |
                                                COM_RIGHTS_EXECUTE_LOCAL   |
                                                COM_RIGHTS_EXECUTE_REMOTE))
                    {
                        pSystemAuditAce->Mask |= COM_RIGHTS_EXECUTE;
                    }
                    else if((pSystemAuditAce->Mask & SPECIFIC_RIGHTS_ALL) == 0)
                    {
                        //If there are no more specific rights on this ACE we
                        //may delete it.
                        DeleteAce (paclOrig, i);
                    }
                }
                else
                {
                    pSystemAuditAce->Mask |= dwAccessMask;
                }
                dwFoundValue = ERROR_SUCCESS;
            }
        }
    }

CLEANUP:

    if(psidPrincipal) free (psidPrincipal);

    if(dwReturnValue == ERROR_SUCCESS) dwReturnValue = dwFoundValue;

    return dwReturnValue;
}

DWORD UpdatePrincipalInNamedValueSD | ( | HKEY | hkeyRoot,
 |  | LPTSTR | tszKeyName,
 |  | LPTSTR | tszValueName,
 |  | LPTSTR | tszPrincipal,
 |  | DWORD | dwAccessMask,
 |  | BOOL | fRemove,
 |  | DWORD | fAceType
 | ) |  |

Definition at line 693 of file SDMgmt.Cpp.

{
    DWORD               dwReturnValue    = ERROR_SUCCESS;
    SECURITY_DESCRIPTOR *pSD             = NULL;
    SECURITY_DESCRIPTOR *psdSelfRelative = NULL;
    SECURITY_DESCRIPTOR *psdAbsolute     = NULL;
    DWORD               cbSecurityDesc   = 0;
    BOOL                fPresent         = FALSE;
    BOOL                fDefaultDACL     = FALSE;
    PACL                pDacl            = NULL;

    // Get security descriptor from registry
    dwReturnValue = GetNamedValueSD (hkeyRoot, tszKeyName, tszValueName, &pSD, NULL);

    if (dwReturnValue != ERROR_SUCCESS)
    {
        if(dwReturnValue == ERROR_FILE_NOT_FOUND && fRemove)
        {
            dwReturnValue = ERROR_SUCCESS;
        }
        goto CLEANUP;
    }

    if (!GetSecurityDescriptorDacl (pSD, &fPresent, &pDacl, &fDefaultDACL))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    // Update the tszPrincipal that the caller wants to change
    dwReturnValue = UpdatePrincipalInACL (pDacl, tszPrincipal, dwAccessMask, fRemove, fAceType);
    if(dwReturnValue == ERROR_FILE_NOT_FOUND)
    {
        dwReturnValue = ERROR_SUCCESS;
        goto CLEANUP;
    }
    else if (dwReturnValue != ERROR_SUCCESS)
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    // Make the security descriptor absolute
    dwReturnValue = MakeSDAbsolute ((PSECURITY_DESCRIPTOR) pSD, (PSECURITY_DESCRIPTOR *) &psdAbsolute);
    if (dwReturnValue != ERROR_SUCCESS)  goto CLEANUP;

    // Set the discretionary ACL on the security descriptor
    if (!SetSecurityDescriptorDacl (psdAbsolute, TRUE, pDacl, FALSE))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    // Make the security descriptor self-relative so that we can
    // store it in the registry
    cbSecurityDesc = 0;
    MakeSelfRelativeSD (psdAbsolute, psdSelfRelative, &cbSecurityDesc);

    psdSelfRelative = (SECURITY_DESCRIPTOR *) malloc (cbSecurityDesc);

    if (!MakeSelfRelativeSD (psdAbsolute, psdSelfRelative, &cbSecurityDesc))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    // Store the security descriptor in the registry
    dwReturnValue = SetNamedValueSD (hkeyRoot, tszKeyName, tszValueName, psdSelfRelative);

CLEANUP:

    if(pSD) free (pSD);
    if(psdSelfRelative) free (psdSelfRelative);
    if(psdAbsolute) free (psdAbsolute);

    return dwReturnValue;
}

Generated on Wed Nov 13 2024 16:53:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/DComPerm/ListAcl.Cpp File Reference

  • Com
  • Fundamentals
  • DCom
  • DComPerm
Functions

ListAcl.Cpp File Reference

#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include <tchar.h>
#include "ntsecapi.h"
#include "dcomperm.h"

Go to the source code of this file.

Functions

void | DisplayAccess (DWORD dwAccessMask, DWORD dwSDType, LPCTSTR tszAccessType, LPCTSTR tszUser, LPCTSTR tszDomain)
void | ListACL (PACL Acl, DWORD dwSDType)
void | WarnIfGlobalPolicySet ()

Function Documentation

void DisplayAccess | ( | DWORD | dwAccessMask,
 |  | DWORD | dwSDType,
 |  | LPCTSTR | tszAccessType,
 |  | LPCTSTR | tszUser,
 |  | LPCTSTR | tszDomain
 | ) |  |

Definition at line 84 of file ListAcl.Cpp.

{

    BOOL fLegacy = IsLegacySecurityModel();

    if(!fLegacy)
    {
        WarnIfGlobalPolicySet();
    }

    if(dwSDType & SDTYPE_ACCESS)
    {
        BOOL fLocalAccess = (dwAccessMask & COM_RIGHTS_EXECUTE_LOCAL  ) ||
                             ((dwAccessMask & COM_RIGHTS_EXECUTE) &&
                              !(dwAccessMask & COM_RIGHTS_EXECUTE_REMOTE));

        BOOL fRemoteAccess = (dwAccessMask & COM_RIGHTS_EXECUTE_REMOTE  ) ||
                             ((dwAccessMask & COM_RIGHTS_EXECUTE) &&
                              !(dwAccessMask & COM_RIGHTS_EXECUTE_LOCAL));

        if(fLegacy && dwAccessMask & COM_RIGHTS_EXECUTE)
        {
            _tprintf (_T("Access %s to %s\\%s.\n"),
                      tszAccessType,
                      tszDomain, tszUser);

        }
        else if(!fLegacy && (fLocalAccess || fRemoteAccess))
        {

            _tprintf (_T("%s access %s to %s\\%s.\n"),
                      fLocalAccess ?
                      fRemoteAccess ?
                      _T("Remote and Local") : _T("Local") : _T("Remote") ,
                      tszAccessType,
                      tszDomain, tszUser);
         }
    }
    else
    {

        BOOL fLocalLaunchAccess = (dwAccessMask & COM_RIGHTS_EXECUTE_LOCAL  ) ||
                             ((dwAccessMask & COM_RIGHTS_EXECUTE) &&
                             !(dwAccessMask & (COM_RIGHTS_EXECUTE_REMOTE  |
                                               COM_RIGHTS_ACTIVATE_REMOTE |
                                               COM_RIGHTS_ACTIVATE_LOCAL)));

        BOOL fRemoteLaunchAccess = (dwAccessMask & COM_RIGHTS_EXECUTE_REMOTE  ) ||
                             ((dwAccessMask & COM_RIGHTS_EXECUTE) &&
                             !(dwAccessMask & (COM_RIGHTS_EXECUTE_LOCAL   |
                                               COM_RIGHTS_ACTIVATE_REMOTE |
                                               COM_RIGHTS_ACTIVATE_LOCAL)));

        BOOL fLocalActivateAccess = (dwAccessMask & COM_RIGHTS_ACTIVATE_LOCAL) ||
                             ((dwAccessMask & COM_RIGHTS_EXECUTE) &&
                             !(dwAccessMask & (COM_RIGHTS_EXECUTE_LOCAL  |
                                               COM_RIGHTS_EXECUTE_REMOTE |
                                               COM_RIGHTS_ACTIVATE_REMOTE)));

        BOOL fRemoteActivateAccess = (dwAccessMask & COM_RIGHTS_ACTIVATE_REMOTE) ||
                             ((dwAccessMask & COM_RIGHTS_EXECUTE) &&
                             !(dwAccessMask & (COM_RIGHTS_EXECUTE_LOCAL  |
                                               COM_RIGHTS_EXECUTE_REMOTE |
                                               COM_RIGHTS_ACTIVATE_LOCAL)));

        if(fLegacy && dwAccessMask & COM_RIGHTS_EXECUTE)
        {
            _tprintf (_T("Launch %s to %s\\%s.\n"),
                      tszAccessType,
                      tszDomain, tszUser);

        }
        else
        {
            if(!fLegacy && (fLocalLaunchAccess || fRemoteLaunchAccess))
            {

                _tprintf (_T("%s launch %s to %s\\%s.\n"),
                          fLocalLaunchAccess ?
                          fRemoteLaunchAccess ?
                          _T("Remote and Local") : _T("Local") : _T("Remote") ,
                          tszAccessType,
                          tszDomain, tszUser);
             }
             if(!fLegacy && (fLocalActivateAccess || fRemoteActivateAccess))
             {

                _tprintf (_T("%s activation %s to %s\\%s.\n"),
                          fLocalActivateAccess ?
                          fRemoteActivateAccess ?
                          _T("Remote and Local") : _T("Local") : _T("Remote"),
                          tszAccessType,
                          tszDomain, tszUser);
             }

         }

    }

}

void ListACL | ( | PACL | Acl,
 |  | DWORD | dwSDType
 | ) |  |

Definition at line 196 of file ListAcl.Cpp.

{
    ACL_SIZE_INFORMATION     aclSizeInfo                      = {0};
    ACL_REVISION_INFORMATION aclRevInfo                       = {0};
    ULONG                    i;
    LPVOID                   pvAce                            = NULL;
    ACE_HEADER               *pAceHeader                      = NULL;
    ACCESS_ALLOWED_ACE       *pAccessAllowedAce               = NULL;
    ACCESS_DENIED_ACE        *pAccessDeniedAce                = NULL;
    TCHAR                    tszDomainName [SIZE_NAME_BUFFER] = {0};
    TCHAR                    tszUserName [SIZE_NAME_BUFFER]   = {0};
    DWORD                    cchName = 0;
    SID_NAME_USE             snu;

    if (!GetAclInformation (Acl,
                            &aclSizeInfo,
                            sizeof (ACL_SIZE_INFORMATION),
                            AclSizeInformation))
    {
        _tprintf (_T("Could not get AclSizeInformation"));
        return;
    }

    if (!GetAclInformation (Acl,
                            &aclRevInfo,
                            sizeof (ACL_REVISION_INFORMATION),
                            AclRevisionInformation))
    {
        _tprintf (_T("Could not get AclRevisionInformation"));
        return;
    }

    for (i = 0; i < aclSizeInfo.AceCount; i++)
    {
        if (!GetAce (Acl, i, &pvAce))
            return;

        pAceHeader = (ACE_HEADER *) pvAce;

        if (pAceHeader->AceType == ACCESS_ALLOWED_ACE_TYPE)
        {
            pAccessAllowedAce = (ACCESS_ALLOWED_ACE *) pvAce;
            cchName = SIZE_NAME_BUFFER-1;
            LookupAccountSid (NULL,
                              &pAccessAllowedAce->SidStart,
                              tszUserName,
                              &cchName,
                              tszDomainName,
                              &cchName,
                              &snu);

            DisplayAccess(pAccessAllowedAce->Mask,
                          dwSDType,
                          _T("permitted"),
                          tszUserName,
                          tszDomainName);

        }
        else if (pAceHeader->AceType == ACCESS_DENIED_ACE_TYPE)
        {
            pAccessDeniedAce = (ACCESS_DENIED_ACE *) pvAce;
            cchName = SIZE_NAME_BUFFER-1;
            LookupAccountSid (NULL,
                              &pAccessDeniedAce->SidStart,
                              tszUserName,
                              &cchName,
                              tszDomainName,
                              &cchName,
                              &snu);

            DisplayAccess(pAccessDeniedAce->Mask,
                          dwSDType,
                          _T("denied"),
                          tszUserName,
                          tszDomainName);

        }
   }
}

void WarnIfGlobalPolicySet ( )

Definition at line 31 of file ListAcl.Cpp.

{

    HKEY  hregPolicy    = NULL;
    DWORD dwType        = 0;
    DWORD cbData        = 0;
    BYTE  bArray[512]   = {0};
    DWORD dwReturnValue = ERROR_SUCCESS;

    if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,
                    _T("SOFTWARE\\Policies\\Microsoft\\Windows NT\\DCOM"),
                    0,
                    KEY_READ,
                    &hregPolicy) == ERROR_SUCCESS)
    {
        cbData = sizeof(bArray);

        dwReturnValue = RegQueryValueEx(hregPolicy,
                                        _T("MachineAccessRestriction"),
                                        0,
                                        &dwType,
                                        bArray,
                                        &cbData);

        if(dwReturnValue != ERROR_FILE_NOT_FOUND)
        {

            _tprintf (_T("WARNING: Machine-wide Access ")
                      _T("Group Policy may override these settings! \n"));

        }

        cbData = sizeof(bArray);

        dwReturnValue = RegQueryValueEx(hregPolicy, _T("MachineLaunchRestriction"), 0, &dwType, bArray, &cbData);
        if(dwReturnValue != ERROR_FILE_NOT_FOUND)
        {

            _tprintf (_T("WARNING: Machine-wide Launch/Activate ")
                      _T("Group Policy may override these settings! \n"));

        }

        RegCloseKey(hregPolicy);
    }
}

Generated on Wed Nov 13 2024 16:53:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/DComPerm/SDMgmt.Cpp File Reference

  • Com
  • Fundamentals
  • DCom
  • DComPerm
Functions

SDMgmt.Cpp File Reference

#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include <tchar.h>
#include "ntsecapi.h"
#include "dcomperm.h"

Go to the source code of this file.

Functions

DWORD | AddPrincipalToNamedValueSD (HKEY hkeyRoot, LPTSTR tszKeyName, LPTSTR tszValueName, LPTSTR tszPrincipal, BOOL fPermit, DWORD dwAccessMask, DWORD dwSDType)
DWORD | CreateNewSD (SECURITY_DESCRIPTOR **ppSecurityDesc)
DWORD | GetNamedValueSD (HKEY hkeyRoot, LPTSTR tszKeyName, LPTSTR tszValueName, SECURITY_DESCRIPTOR **ppSecurityDesc, BOOL *psdNew)
DWORD | ListNamedValueSD (HKEY hkeyRoot, LPTSTR tszKeyName, LPTSTR tszValueName, DWORD dwSDType)
DWORD | MakeSDAbsolute (PSECURITY_DESCRIPTOR psidOld, PSECURITY_DESCRIPTOR *psidNew)
DWORD | RemovePrincipalFromNamedValueSD (HKEY hkeyRoot, LPTSTR tszKeyName, LPTSTR tszValueName, LPTSTR tszPrincipal, DWORD fAceType)
DWORD | SetAclDefaults (PACL *ppDacl, DWORD dwSDType)
DWORD | SetLegacyAclDefaults (PACL pDacl, DWORD dwSDType)
DWORD | SetNamedValueSD (HKEY hkeyRoot, LPTSTR tszKeyName, LPTSTR tszValueName, SECURITY_DESCRIPTOR *pSecurityDesc)
DWORD | UpdatePrincipalInNamedValueSD (HKEY hkeyRoot, LPTSTR tszKeyName, LPTSTR tszValueName, LPTSTR tszPrincipal, DWORD dwAccessMask, BOOL fRemove, DWORD fAceType)

Function Documentation

DWORD AddPrincipalToNamedValueSD | ( | HKEY | hkeyRoot,
 |  | LPTSTR | tszKeyName,
 |  | LPTSTR | tszValueName,
 |  | LPTSTR | tszPrincipal,
 |  | BOOL | fPermit,
 |  | DWORD | dwAccessMask,
 |  | DWORD | dwSDType
 | ) |  |

Definition at line 587 of file SDMgmt.Cpp.

{
    DWORD               dwReturnValue    = ERROR_SUCCESS;
    SECURITY_DESCRIPTOR *pSD             = NULL;
    SECURITY_DESCRIPTOR *psdSelfRelative = NULL;
    SECURITY_DESCRIPTOR *psdAbsolute     = NULL;
    DWORD               cbSecurityDesc   = 0;
    BOOL                fPresent         = FALSE;
    BOOL                fDefaultDACL     = FALSE;
    PACL                pDacl            = NULL;
    BOOL                fNewSD           = FALSE;

    dwReturnValue = GetNamedValueSD (hkeyRoot, tszKeyName, tszValueName, &pSD, &fNewSD);

    // Get security descriptor from registry or create a new one
    if (dwReturnValue != ERROR_SUCCESS)  goto CLEANUP;

    if (!GetSecurityDescriptorDacl (pSD, &fPresent, &pDacl, &fDefaultDACL))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    if (fNewSD)
    {
        dwReturnValue = SetAclDefaults(&pDacl, dwSDType);
        if (dwReturnValue != ERROR_SUCCESS)  goto CLEANUP;
    }

    // Add the tszPrincipal that the caller wants added
    if (fPermit)
    {
        dwReturnValue = AddAccessAllowedACEToACL (&pDacl, dwAccessMask, tszPrincipal);
    }
    else
    {
        dwReturnValue = AddAccessDeniedACEToACL (&pDacl, dwAccessMask, tszPrincipal);
    }

    if (dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

    // Make the security descriptor absolute if it isn't new
    if (!fNewSD)
    {
        dwReturnValue = MakeSDAbsolute ((PSECURITY_DESCRIPTOR) pSD, (PSECURITY_DESCRIPTOR *) &psdAbsolute);
        if (dwReturnValue != ERROR_SUCCESS) goto CLEANUP;
    }
    else
    {
        psdAbsolute = pSD;
    }

    // Set the discretionary ACL on the security descriptor
    if (!SetSecurityDescriptorDacl (psdAbsolute, TRUE, pDacl, FALSE))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
     }

    // Make the security descriptor self-relative so that we can
    // store it in the registry
    cbSecurityDesc = 0;

    MakeSelfRelativeSD (psdAbsolute, psdSelfRelative, &cbSecurityDesc);

    psdSelfRelative = (SECURITY_DESCRIPTOR *) malloc (cbSecurityDesc);

    if(!psdSelfRelative)
    {
        dwReturnValue = ERROR_OUTOFMEMORY;
        goto CLEANUP;
    }

    if (!MakeSelfRelativeSD (psdAbsolute, psdSelfRelative, &cbSecurityDesc))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    // Store the security descriptor in the registry
    SetNamedValueSD (hkeyRoot, tszKeyName, tszValueName, psdSelfRelative);

CLEANUP:

    if(pSD) free (pSD);
    if(psdSelfRelative) free (psdSelfRelative);
    if(psdAbsolute && pSD != psdAbsolute) free (psdAbsolute);

    return dwReturnValue;
}

DWORD CreateNewSD ( SECURITY_DESCRIPTOR ** ppSecurityDesc )

Definition at line 30 of file SDMgmt.Cpp.

{
    PACL    pAcl          = NULL;
    DWORD   cbSid         = 0;
    PSID    pSid          = NULL;
    PSID    psidGroup     = NULL;
    PSID    psidOwner     = NULL;
    DWORD   dwReturnValue = ERROR_SUCCESS;

    if(!ppSecurityDesc) return ERROR_BAD_ARGUMENTS;

    *ppSecurityDesc = NULL;

    dwReturnValue = GetCurrentUserSID (&pSid);

    if (dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

    cbSid = GetLengthSid (pSid);

    *ppSecurityDesc = (SECURITY_DESCRIPTOR *) malloc (
         sizeof (ACL) +  (2 * cbSid) + sizeof (SECURITY_DESCRIPTOR));

    if(!*ppSecurityDesc)
    {
        dwReturnValue = ERROR_OUTOFMEMORY;
        goto CLEANUP;
    }

    psidGroup = (SID *) (*ppSecurityDesc + 1);
    psidOwner = (SID *) (((BYTE *) psidGroup) + cbSid);
    pAcl = (ACL *) (((BYTE *) psidOwner) + cbSid);

    if (!InitializeSecurityDescriptor (*ppSecurityDesc, SECURITY_DESCRIPTOR_REVISION))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    if (!InitializeAcl (pAcl,
                        sizeof (ACL)+sizeof (ACCESS_ALLOWED_ACE)+cbSid,
                        ACL_REVISION2))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    if (!SetSecurityDescriptorDacl (*ppSecurityDesc, TRUE, pAcl, FALSE))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    memcpy (psidGroup, pSid, cbSid);
    if (!SetSecurityDescriptorGroup (*ppSecurityDesc, psidGroup, FALSE))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    memcpy (psidOwner, pSid, cbSid);
    if (!SetSecurityDescriptorOwner (*ppSecurityDesc, psidOwner, FALSE))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

CLEANUP:

    if(dwReturnValue != ERROR_SUCCESS)
    {
        if(*ppSecurityDesc) free (*ppSecurityDesc);
    }

    if(pSid) free (pSid);

    return dwReturnValue;
}

DWORD GetNamedValueSD | ( | HKEY | hkeyRoot,
 |  | LPTSTR | tszKeyName,
 |  | LPTSTR | tszValueName,
 |  | SECURITY_DESCRIPTOR ** | ppSecurityDesc,
 |  | BOOL * | psdNew
 | ) |  |

Definition at line 467 of file SDMgmt.Cpp.

{
    DWORD  dwReturnValue = ERROR_SUCCESS;
    HKEY   hkeyReg       = NULL;
    DWORD  dwType        = 0;
    DWORD  cbSize        = 0;

    if(!ppSecurityDesc) return ERROR_BAD_ARGUMENTS;

    if(psdNew) *psdNew = FALSE;
    *ppSecurityDesc = NULL;

    // Get the security descriptor from the named value. If it doesn't
    // exist, create a fresh one.
    dwReturnValue = RegOpenKeyEx (hkeyRoot, tszKeyName, 0, KEY_ALL_ACCESS, &hkeyReg);

    if (dwReturnValue != ERROR_SUCCESS)
    {
        if(dwReturnValue == ERROR_FILE_NOT_FOUND)
        {
            goto CLEANUP;
        }

        return dwReturnValue;
    }

    dwReturnValue = RegQueryValueEx (hkeyReg, tszValueName, NULL, &dwType, NULL, &cbSize);

    if (dwReturnValue != ERROR_SUCCESS && dwReturnValue != ERROR_INSUFFICIENT_BUFFER)
    {
        goto CLEANUP;
    }

    *ppSecurityDesc = (SECURITY_DESCRIPTOR *) malloc (cbSize);

    dwReturnValue = RegQueryValueEx (hkeyReg, tszValueName, NULL, &dwType, (LPBYTE) *ppSecurityDesc, &cbSize);

CLEANUP:

    if(dwReturnValue != ERROR_SUCCESS)
    {
        if(*ppSecurityDesc) free(*ppSecurityDesc);

        *ppSecurityDesc = NULL;

        if(psdNew)
        {
            dwReturnValue = CreateNewSD (ppSecurityDesc);
            if (dwReturnValue == ERROR_SUCCESS)
            {
                *psdNew = TRUE;
            }
        }
    }

    if(hkeyReg) RegCloseKey (hkeyReg);

    return dwReturnValue;
}

DWORD ListNamedValueSD | ( | HKEY | hkeyRoot,
 |  | LPTSTR | tszKeyName,
 |  | LPTSTR | tszValueName,
 |  | DWORD | dwSDType
 | ) |  |

Definition at line 539 of file SDMgmt.Cpp.

{
    DWORD               dwReturnValue = ERROR_SUCCESS;
    SECURITY_DESCRIPTOR *pSD          = NULL;
    BOOL                fPresent      = FALSE;
    BOOL                fDefaultDACL  = FALSE;
    PACL                dacl          = NULL;

    dwReturnValue = GetNamedValueSD (hkeyRoot, tszKeyName, tszValueName, &pSD, NULL);

    if (dwReturnValue != ERROR_SUCCESS)
    {
        _tprintf (_T("<Using Default Permissions>\n"));
        goto CLEANUP;
    }

    if (!GetSecurityDescriptorDacl (pSD, &fPresent, &dacl, &fDefaultDACL))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    if (!fPresent)
    {
        _tprintf (_T("<Access is denied to everyone>\n"));
        goto CLEANUP;
    }

    ListACL (dacl, dwSDType);

CLEANUP:

    if(pSD) free (pSD);

    return dwReturnValue;
}

DWORD MakeSDAbsolute | ( | PSECURITY_DESCRIPTOR | psidOld,
 |  | PSECURITY_DESCRIPTOR * | psidNew
 | ) |  |

Definition at line 320 of file SDMgmt.Cpp.

{
    PSECURITY_DESCRIPTOR  pSid           = NULL;
    DWORD                 cbDescriptor   = 0;
    DWORD                 cbDacl         = 0;
    DWORD                 cbSacl         = 0;
    DWORD                 cbOwnerSID     = 0;
    DWORD                 cbGroupSID     = 0;
    PACL                  pDacl          = NULL;
    PACL                  pSacl          = NULL;
    PSID                  psidOwner      = NULL;
    PSID                  psidGroup      = NULL;
    BOOL                  fPresent       = FALSE;
    BOOL                  fSystemDefault = FALSE;
    DWORD                 dwReturnValue  = ERROR_SUCCESS;

    // Get SACL
    if (!GetSecurityDescriptorSacl (psidOld, &fPresent, &pSacl, &fSystemDefault))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    if (pSacl && fPresent)
    {
        cbSacl = pSacl->AclSize;
    }

    // Get DACL
    if (!GetSecurityDescriptorDacl (psidOld, &fPresent, &pDacl, &fSystemDefault))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    if (pDacl && fPresent)
    {
        cbDacl = pDacl->AclSize;
    }

    // Get Owner
    if (!GetSecurityDescriptorOwner (psidOld, &psidOwner, &fSystemDefault))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    cbOwnerSID = GetLengthSid (psidOwner);

    // Get Group
    if (!GetSecurityDescriptorGroup (psidOld, &psidGroup, &fSystemDefault))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    cbGroupSID = GetLengthSid (psidGroup);

    // Do the conversion
    cbDescriptor = 0;

    MakeAbsoluteSD (psidOld, pSid, &cbDescriptor, pDacl, &cbDacl, pSacl,
                    &cbSacl, psidOwner, &cbOwnerSID, psidGroup,
                    &cbGroupSID);

    pSid = (PSECURITY_DESCRIPTOR) malloc(cbDescriptor);
    if(!pSid)
    {
        dwReturnValue = ERROR_OUTOFMEMORY;
        goto CLEANUP;
    }

    ZeroMemory(pSid, cbDescriptor);

    if (!InitializeSecurityDescriptor (pSid, SECURITY_DESCRIPTOR_REVISION))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    if (!MakeAbsoluteSD (psidOld, pSid, &cbDescriptor, pDacl, &cbDacl, pSacl,
                         &cbSacl, psidOwner, &cbOwnerSID, psidGroup,
                         &cbGroupSID))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

CLEANUP:

    if(dwReturnValue != ERROR_SUCCESS && pSid)
    {
        free(pSid);
        pSid = NULL;
    }

    *psidNew = pSid;

    return dwReturnValue;
}

DWORD RemovePrincipalFromNamedValueSD | ( | HKEY | hkeyRoot,
 |  | LPTSTR | tszKeyName,
 |  | LPTSTR | tszValueName,
 |  | LPTSTR | tszPrincipal,
 |  | DWORD | fAceType
 | ) |  |

Definition at line 789 of file SDMgmt.Cpp.

{
    DWORD               dwReturnValue    = ERROR_SUCCESS;
    SECURITY_DESCRIPTOR *pSD             = NULL;
    SECURITY_DESCRIPTOR *psdSelfRelative = NULL;
    SECURITY_DESCRIPTOR *psdAbsolute     = NULL;
    DWORD               cbSecurityDesc   = 0;
    BOOL                fPresent         = FALSE;
    BOOL                fDefaultDACL     = FALSE;
    PACL                pDacl            = NULL;

    dwReturnValue = GetNamedValueSD (hkeyRoot, tszKeyName, tszValueName, &pSD, NULL);

    // Get security descriptor from registry or create a new one
    if (dwReturnValue != ERROR_SUCCESS)
    {
        if(dwReturnValue == ERROR_FILE_NOT_FOUND)
        {
            dwReturnValue = ERROR_SUCCESS;
        }
        goto CLEANUP;
    }

    if (!GetSecurityDescriptorDacl (pSD, &fPresent, &pDacl, &fDefaultDACL))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    // Remove the tszPrincipal that the caller wants removed
    dwReturnValue = RemovePrincipalFromACL (pDacl, tszPrincipal, fAceType);
    if(dwReturnValue == ERROR_FILE_NOT_FOUND)
    {
        dwReturnValue = ERROR_SUCCESS;
        goto CLEANUP;
    }
    else if (dwReturnValue != ERROR_SUCCESS)
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    // Make the security descriptor absolute if it isn't new
    dwReturnValue = MakeSDAbsolute ((PSECURITY_DESCRIPTOR) pSD, (PSECURITY_DESCRIPTOR *) &psdAbsolute);
    if (dwReturnValue != ERROR_SUCCESS)  goto CLEANUP;

    // Set the discretionary ACL on the security descriptor
    if (!SetSecurityDescriptorDacl (psdAbsolute, TRUE, pDacl, FALSE))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    // Make the security descriptor self-relative so that we can
    // store it in the registry
    cbSecurityDesc = 0;
    MakeSelfRelativeSD (psdAbsolute, psdSelfRelative, &cbSecurityDesc);

    psdSelfRelative = (SECURITY_DESCRIPTOR *) malloc (cbSecurityDesc);

    if (!MakeSelfRelativeSD (psdAbsolute, psdSelfRelative, &cbSecurityDesc))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    // Store the security descriptor in the registry
    dwReturnValue = SetNamedValueSD (hkeyRoot, tszKeyName, tszValueName, psdSelfRelative);

CLEANUP:

    if(pSD) free (pSD);
    if(psdSelfRelative) free (psdSelfRelative);
    if(psdAbsolute) free (psdAbsolute);

    return dwReturnValue;
}

DWORD SetAclDefaults | ( | PACL * | ppDacl,
 |  | DWORD | dwSDType
 | ) |  |

Definition at line 182 of file SDMgmt.Cpp.

{
    DWORD dwReturnValue = ERROR_BAD_ARGUMENTS;

    switch (dwSDType)
    {

        case SDTYPE_MACHINE_LAUNCH:

        dwReturnValue = AddAccessAllowedACEToACL (ppDacl,
                                                  COM_RIGHTS_ACTIVATE_REMOTE |
                                                  COM_RIGHTS_EXECUTE_REMOTE |
                                                  COM_RIGHTS_ACTIVATE_LOCAL |
                                                  COM_RIGHTS_EXECUTE_LOCAL |
                                                  COM_RIGHTS_EXECUTE,
                                                  _T("Administrators"));

        if(dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

        dwReturnValue = AddAccessAllowedACEToACL (ppDacl,
                                                  COM_RIGHTS_ACTIVATE_REMOTE |
                                                  COM_RIGHTS_EXECUTE_REMOTE |
                                                  COM_RIGHTS_ACTIVATE_LOCAL |
                                                  COM_RIGHTS_EXECUTE_LOCAL |
                                                  COM_RIGHTS_EXECUTE,
                                                  _T("Offer Remote Assistance Helpers"));

        if(dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

        dwReturnValue = AddAccessAllowedACEToACL (ppDacl,
                                                  COM_RIGHTS_ACTIVATE_LOCAL |
                                                  COM_RIGHTS_EXECUTE_LOCAL |
                                                  COM_RIGHTS_EXECUTE,
                                                  _T("Everyone"));

        if(dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

        break;

        case SDTYPE_MACHINE_ACCESS:

        dwReturnValue = AddAccessAllowedACEToACL (ppDacl,
                                                  COM_RIGHTS_EXECUTE_REMOTE |
                                                  COM_RIGHTS_EXECUTE_LOCAL |
                                                  COM_RIGHTS_EXECUTE,
                                                  _T("Everyone"));

        if(dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

        dwReturnValue = AddAccessAllowedACEToACL (ppDacl,
                                                  COM_RIGHTS_EXECUTE_LOCAL |
                                                  COM_RIGHTS_EXECUTE,
                                                  _T("Everyone"));

        if(dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

        break;

        case SDTYPE_DEFAULT_LAUNCH:
        case SDTYPE_APPLICATION_LAUNCH:

        dwReturnValue = AddAccessAllowedACEToACL (ppDacl,
                                                  COM_RIGHTS_ACTIVATE_REMOTE |
                                                  COM_RIGHTS_EXECUTE_REMOTE |
                                                  COM_RIGHTS_ACTIVATE_LOCAL |
                                                  COM_RIGHTS_EXECUTE_LOCAL |
                                                  COM_RIGHTS_EXECUTE,
                                                  _T("SYSTEM"));

        if(dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

        dwReturnValue = AddAccessAllowedACEToACL (ppDacl,
                                                  COM_RIGHTS_ACTIVATE_REMOTE |
                                                  COM_RIGHTS_EXECUTE_REMOTE |
                                                  COM_RIGHTS_ACTIVATE_LOCAL |
                                                  COM_RIGHTS_EXECUTE_LOCAL |
                                                  COM_RIGHTS_EXECUTE,
                                                  _T("Administrators"));

        if(dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

        dwReturnValue = AddAccessAllowedACEToACL (ppDacl,
                                                  COM_RIGHTS_ACTIVATE_REMOTE |
                                                  COM_RIGHTS_EXECUTE_REMOTE |
                                                  COM_RIGHTS_ACTIVATE_LOCAL |
                                                  COM_RIGHTS_EXECUTE_LOCAL |
                                                  COM_RIGHTS_EXECUTE,
                                                  _T("Interactive"));

        if(dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

        break;

        case SDTYPE_DEFAULT_ACCESS:
        case SDTYPE_APPLICATION_ACCESS:

        dwReturnValue = AddAccessAllowedACEToACL (ppDacl,
                                                  COM_RIGHTS_EXECUTE_LOCAL |
                                                  COM_RIGHTS_EXECUTE,
                                                  _T("SYSTEM"));

        if(dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

        dwReturnValue = AddAccessAllowedACEToACL (ppDacl,
                                                  COM_RIGHTS_EXECUTE_REMOTE |
                                                  COM_RIGHTS_EXECUTE_LOCAL |
                                                  COM_RIGHTS_EXECUTE,
                                                  _T("SELF"));

        if(dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

        break;

        default:

            _tprintf(_T("WARNING: SetAclDefaults- Invalid security descriptor type.\n"));

        break;

    }

CLEANUP:

    return dwReturnValue;
}

DWORD SetLegacyAclDefaults | ( | PACL | pDacl,
 |  | DWORD | dwSDType
 | ) |  |

Definition at line 116 of file SDMgmt.Cpp.

{
    DWORD dwReturnValue = ERROR_BAD_ARGUMENTS;

    switch (dwSDType)
    {

        case SDTYPE_DEFAULT_LAUNCH:
        case SDTYPE_APPLICATION_LAUNCH:

        dwReturnValue = AddAccessAllowedACEToACL (&pDacl,
                                                  COM_RIGHTS_EXECUTE,
                                                  _T("SYSTEM"));

        if(dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

        dwReturnValue = AddAccessAllowedACEToACL (&pDacl,
                                                  COM_RIGHTS_EXECUTE,
                                                  _T("Administrators"));

        if(dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

        dwReturnValue = AddAccessAllowedACEToACL (&pDacl,
                                                  COM_RIGHTS_EXECUTE,
                                                  _T("Interactive"));
        break;

        case SDTYPE_DEFAULT_ACCESS:
        case SDTYPE_APPLICATION_ACCESS:

        if(dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

        dwReturnValue = AddAccessAllowedACEToACL (&pDacl,
                                                  COM_RIGHTS_EXECUTE,
                                                  _T("SYSTEM"));

        if(dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

        dwReturnValue = AddAccessAllowedACEToACL (&pDacl,
                                                  COM_RIGHTS_EXECUTE,
                                                  _T("SELF"));
        break;

        default:

            _tprintf(_T("WARNING: SetLegacyAclDefaults- Invalid security descriptor type.\n"));

        break;

    }

CLEANUP:

    return dwReturnValue;
}

DWORD SetNamedValueSD | ( | HKEY | hkeyRoot,
 |  | LPTSTR | tszKeyName,
 |  | LPTSTR | tszValueName,
 |  | SECURITY_DESCRIPTOR * | pSecurityDesc
 | ) |  |

Definition at line 429 of file SDMgmt.Cpp.

{
    DWORD   dwReturnValue = ERROR_SUCCESS;
    DWORD   dwDisposition = 0;
    HKEY    hkeyReg       = NULL;

    // Create new key or open existing key
    dwReturnValue = RegCreateKeyEx (hkeyRoot, tszKeyName, 0, _T(""), 0, KEY_ALL_ACCESS, NULL, &hkeyReg, &dwDisposition);
    if (dwReturnValue != ERROR_SUCCESS)
    {
        goto CLEANUP;
    }

    // Write the security descriptor
    dwReturnValue = RegSetValueEx (hkeyReg, tszValueName, 0, REG_BINARY, (LPBYTE) pSecurityDesc, GetSecurityDescriptorLength (pSecurityDesc));
    if (dwReturnValue != ERROR_SUCCESS)
    {
        goto CLEANUP;
    }

CLEANUP:

    if(hkeyReg) RegCloseKey (hkeyReg);

    return dwReturnValue;
}

DWORD UpdatePrincipalInNamedValueSD | ( | HKEY | hkeyRoot,
 |  | LPTSTR | tszKeyName,
 |  | LPTSTR | tszValueName,
 |  | LPTSTR | tszPrincipal,
 |  | DWORD | dwAccessMask,
 |  | BOOL | fRemove,
 |  | DWORD | fAceType
 | ) |  |

Definition at line 693 of file SDMgmt.Cpp.

{
    DWORD               dwReturnValue    = ERROR_SUCCESS;
    SECURITY_DESCRIPTOR *pSD             = NULL;
    SECURITY_DESCRIPTOR *psdSelfRelative = NULL;
    SECURITY_DESCRIPTOR *psdAbsolute     = NULL;
    DWORD               cbSecurityDesc   = 0;
    BOOL                fPresent         = FALSE;
    BOOL                fDefaultDACL     = FALSE;
    PACL                pDacl            = NULL;

    // Get security descriptor from registry
    dwReturnValue = GetNamedValueSD (hkeyRoot, tszKeyName, tszValueName, &pSD, NULL);

    if (dwReturnValue != ERROR_SUCCESS)
    {
        if(dwReturnValue == ERROR_FILE_NOT_FOUND && fRemove)
        {
            dwReturnValue = ERROR_SUCCESS;
        }
        goto CLEANUP;
    }

    if (!GetSecurityDescriptorDacl (pSD, &fPresent, &pDacl, &fDefaultDACL))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    // Update the tszPrincipal that the caller wants to change
    dwReturnValue = UpdatePrincipalInACL (pDacl, tszPrincipal, dwAccessMask, fRemove, fAceType);
    if(dwReturnValue == ERROR_FILE_NOT_FOUND)
    {
        dwReturnValue = ERROR_SUCCESS;
        goto CLEANUP;
    }
    else if (dwReturnValue != ERROR_SUCCESS)
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    // Make the security descriptor absolute
    dwReturnValue = MakeSDAbsolute ((PSECURITY_DESCRIPTOR) pSD, (PSECURITY_DESCRIPTOR *) &psdAbsolute);
    if (dwReturnValue != ERROR_SUCCESS)  goto CLEANUP;

    // Set the discretionary ACL on the security descriptor
    if (!SetSecurityDescriptorDacl (psdAbsolute, TRUE, pDacl, FALSE))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    // Make the security descriptor self-relative so that we can
    // store it in the registry
    cbSecurityDesc = 0;
    MakeSelfRelativeSD (psdAbsolute, psdSelfRelative, &cbSecurityDesc);

    psdSelfRelative = (SECURITY_DESCRIPTOR *) malloc (cbSecurityDesc);

    if (!MakeSelfRelativeSD (psdAbsolute, psdSelfRelative, &cbSecurityDesc))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

    // Store the security descriptor in the registry
    dwReturnValue = SetNamedValueSD (hkeyRoot, tszKeyName, tszValueName, psdSelfRelative);

CLEANUP:

    if(pSD) free (pSD);
    if(psdSelfRelative) free (psdSelfRelative);
    if(psdAbsolute) free (psdAbsolute);

    return dwReturnValue;
}

Generated on Wed Nov 13 2024 16:53:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/DComPerm/SrvcMgmt.Cpp File Reference

  • Com
  • Fundamentals
  • DCom
  • DComPerm
Functions

SrvcMgmt.Cpp File Reference

#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include <tchar.h>
#include "ntsecapi.h"
#include "dcomperm.h"

Go to the source code of this file.

Functions

DWORD | GetRunAsPassword (LPTSTR tszAppID, LPTSTR tszPassword)
DWORD | SetAccountRights (LPTSTR tszUser, LPTSTR tszPrivilege)
DWORD | SetRunAsPassword (LPTSTR tszAppID, LPTSTR tszPrincipal, LPTSTR tszPassword)

Function Documentation

DWORD GetRunAsPassword | ( | LPTSTR | tszAppID,
 |  | LPTSTR | tszPassword
 | ) |  |

Definition at line 41 of file SrvcMgmt.Cpp.

{
    LSA_OBJECT_ATTRIBUTES objectAttributes             = {0};
    HANDLE                hPolicy                      = NULL;
    LSA_UNICODE_STRING    lsaKeyString                 = {0};
    PLSA_UNICODE_STRING   lsaPasswordString            = {0};
    WCHAR                 wszKey [4 + GUIDSTR_MAX + 1] = {0};
    WCHAR                 wszAppID [GUIDSTR_MAX + 1]   = {0};
    DWORD                 dwReturnValue                = ERROR_SUCCESS;

#ifndef UNICODE
    STR2UNI (wszAppID, tszAppID);
#else
    lstrcpy (wszAppID, tszAppID);
#endif

    wcsncpy (wszKey, L"SCM:", (sizeof(wszKey)/sizeof(WCHAR))-1);
    wcsncat (wszKey, wszAppID, (sizeof(wszKey)/sizeof(WCHAR))-5);

    lsaKeyString.Length = (USHORT) ((wcslen (wszKey) + 1) * sizeof (WCHAR));
    lsaKeyString.MaximumLength = (GUIDSTR_MAX + 5) * sizeof (WCHAR);
    lsaKeyString.Buffer = wszKey;

    // Open the local security policy
    objectAttributes.Length = sizeof (LSA_OBJECT_ATTRIBUTES);

    dwReturnValue = LsaOpenPolicy (NULL,
                                 &objectAttributes,
                                 POLICY_GET_PRIVATE_INFORMATION,
                                 &hPolicy);

    dwReturnValue = LsaNtStatusToWinError(dwReturnValue);

    if (dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

    // Read the user's password
    dwReturnValue = LsaRetrievePrivateData (hPolicy,
                                          &lsaKeyString,
                                          &lsaPasswordString);

    dwReturnValue = LsaNtStatusToWinError(dwReturnValue);

    if (dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

CLEANUP:

    if(hPolicy) LsaClose (hPolicy);

#ifndef UNICODE
    UNI2STR (tszPassword, lsaPasswordString->Buffer);
#else
    wcscpy (tszPassword, lsaPasswordString->Buffer);
#endif

    return dwReturnValue;
}

DWORD SetAccountRights | ( | LPTSTR | tszUser,
 |  | LPTSTR | tszPrivilege
 | ) |  |

Definition at line 192 of file SrvcMgmt.Cpp.

{
    LSA_HANDLE            hPolicy            = NULL;
    LSA_OBJECT_ATTRIBUTES objectAttributes   = {0};
    PSID                  psidPrincipal      = NULL;
    LSA_UNICODE_STRING    lsaPrivilegeString = {0};
    WCHAR                 wszPrivilege [256] = {0};
    DWORD                dwReturnValue       = ERROR_SUCCESS;

#ifdef _UNICODE
    lstrcpy (wszPrivilege, tszPrivilege);
#else
    STR2UNI (wszPrivilege, tszPrivilege);
#endif

    dwReturnValue = LsaOpenPolicy (NULL,
                                   &objectAttributes,
                                   POLICY_CREATE_ACCOUNT | POLICY_LOOKUP_NAMES,
                                   &hPolicy);

    dwReturnValue = LsaNtStatusToWinError(dwReturnValue);

    if (dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

    dwReturnValue = GetPrincipalSID (tszUser, &psidPrincipal);
    if (dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

    lsaPrivilegeString.Length = (USHORT) (wcslen (wszPrivilege) * sizeof (WCHAR));
    lsaPrivilegeString.MaximumLength = (USHORT) (lsaPrivilegeString.Length + sizeof (WCHAR));
    lsaPrivilegeString.Buffer = wszPrivilege;

    dwReturnValue = LsaAddAccountRights (hPolicy,
                                         psidPrincipal,
                                         &lsaPrivilegeString,
                                         1);

    dwReturnValue = LsaNtStatusToWinError(dwReturnValue);

    if (dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

CLEANUP:

    if(psidPrincipal) free (psidPrincipal);
    if(hPolicy) LsaClose (hPolicy);

    return dwReturnValue;
}

DWORD SetRunAsPassword | ( | LPTSTR | tszAppID,
 |  | LPTSTR | tszPrincipal,
 |  | LPTSTR | tszPassword
 | ) |  |

Definition at line 121 of file SrvcMgmt.Cpp.

{
    LSA_OBJECT_ATTRIBUTES objectAttributes             = {0};
    HANDLE                hPolicy                      = NULL;
    LSA_UNICODE_STRING    lsaKeyString                 = {0};
    LSA_UNICODE_STRING    lsaPasswordString            = {0};
    WCHAR                 wszKey [4 + GUIDSTR_MAX + 1] = {0};
    WCHAR                 wszAppID [GUIDSTR_MAX + 1]   = {0};
    WCHAR                 wszPassword [256]            = {0};
    DWORD                 dwReturnValue                = ERROR_SUCCESS;

#ifndef UNICODE
    STR2UNI (wszAppID, tszAppID);
    STR2UNI (wszPassword, tszPassword);
#else
    wcsncpy (wszAppID, tszAppID, (sizeof(wszAppID)/sizeof(*wszAppID))-1);
    wcsncpy (wszPassword, tszPassword, (sizeof(wszPassword)/sizeof(*wszPassword))-1);
#endif

    wcsncpy (wszKey, L"SCM:", (sizeof(wszKey)/sizeof(*wszKey))-1);
    wcsncat (wszKey, wszAppID, (sizeof(wszKey)/sizeof(*wszKey))-5);

    lsaKeyString.Length = (USHORT) ((wcslen (wszKey) + 1) * sizeof (WCHAR));
    lsaKeyString.MaximumLength = (GUIDSTR_MAX + 5) * sizeof (WCHAR);
    lsaKeyString.Buffer = wszKey;

    lsaPasswordString.Length = (USHORT) ((wcslen (wszPassword) + 1) * sizeof (WCHAR));
    lsaPasswordString.Buffer = wszPassword;
    lsaPasswordString.MaximumLength = lsaPasswordString.Length;

    // Open the local security policy
    objectAttributes.Length = sizeof (LSA_OBJECT_ATTRIBUTES);

    dwReturnValue = LsaOpenPolicy (NULL,
                                 &objectAttributes,
                                 POLICY_CREATE_SECRET,
                                 &hPolicy);

    dwReturnValue = LsaNtStatusToWinError(dwReturnValue);

    if (dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

    // Store the user's password
    dwReturnValue = LsaStorePrivateData (hPolicy,
                                       &lsaKeyString,
                                       &lsaPasswordString);

    dwReturnValue = LsaNtStatusToWinError(dwReturnValue);

    if (dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

    dwReturnValue = SetAccountRights (tszPrincipal, _T("SeBatchLogonRight"));
    if (dwReturnValue != ERROR_SUCCESS) goto CLEANUP;

CLEANUP:

    if(hPolicy) LsaClose (hPolicy);

    return dwReturnValue;
}

Generated on Wed Nov 13 2024 16:53:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/DComPerm/UtilS.Cpp File Reference

  • Com
  • Fundamentals
  • DCom
  • DComPerm
Defines | Functions

UtilS.Cpp File Reference

#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include <tchar.h>
#include "ntsecapi.h"
#include "dcomperm.h"

Go to the source code of this file.

Defines

#define | VERSION_MAJOR_W2K_XP_W2K3 5
#define | VERSION_MINOR_W2K 0
#define | VERSION_MINOR_W2K3 2
#define | VERSION_MINOR_XP 1

Functions

BOOL | ConstructWellKnownSID (LPTSTR tszPrincipal, PSID *pSid)
DWORD | GetCurrentUserSID (PSID *pSid)
DWORD | GetPrincipalSID (LPTSTR tszPrincipal, PSID *pSid)
BOOL IsLegacySecurityModel ()
LPTSTR | SystemMessage (LPTSTR tszBuffer, DWORD cbBuffer, HRESULT hr)

Define Documentation

#define VERSION_MAJOR_W2K_XP_W2K3 5

Definition at line 25 of file UtilS.Cpp.

#define VERSION_MINOR_W2K 0

Definition at line 26 of file UtilS.Cpp.

#define VERSION_MINOR_W2K3 2

Definition at line 28 of file UtilS.Cpp.

#define VERSION_MINOR_XP 1

Definition at line 27 of file UtilS.Cpp.

Function Documentation

BOOL ConstructWellKnownSID | ( | LPTSTR | tszPrincipal,
 |  | PSID * | pSid
 | ) |  |

Definition at line 92 of file UtilS.Cpp.

{

    BOOL fRetVal = FALSE;
    PSID psidTemp = NULL;
    BOOL fUseWorldAuth = FALSE;

    SID_IDENTIFIER_AUTHORITY SidAuthorityNT = SECURITY_NT_AUTHORITY;
    SID_IDENTIFIER_AUTHORITY SidAuthorityWorld = SECURITY_WORLD_SID_AUTHORITY;

    DWORD dwSubAuthority;

    // Look for well-known English names
    if (_tcsicmp (tszPrincipal, _T("Administrators")) == 0)
    {
        dwSubAuthority = DOMAIN_ALIAS_RID_ADMINS;
    }
    else if (_tcsicmp (tszPrincipal, _T("Power Users")) == 0)
    {
        dwSubAuthority = DOMAIN_ALIAS_RID_POWER_USERS;
    }
    else if (_tcsicmp (tszPrincipal, _T("Everyone")) == 0)
    {
        dwSubAuthority = SECURITY_WORLD_RID;
        fUseWorldAuth = TRUE;
    }
    else if (_tcsicmp (tszPrincipal, _T("System")) == 0)
    {
        dwSubAuthority = SECURITY_LOCAL_SYSTEM_RID;
    }
    else if (_tcsicmp (tszPrincipal, _T("Self")) == 0)
    {
        dwSubAuthority = SECURITY_PRINCIPAL_SELF_RID;
    }
    else if (_tcsicmp (tszPrincipal, _T("Anonymous")) == 0)
    {
        dwSubAuthority = SECURITY_ANONYMOUS_LOGON_RID;
    }
    else if (_tcsicmp (tszPrincipal, _T("Interactive")) == 0)
    {
        dwSubAuthority = SECURITY_INTERACTIVE_RID;
    }
    else
    {
        return FALSE;
    }

    if(dwSubAuthority == DOMAIN_ALIAS_RID_ADMINS ||
       dwSubAuthority == DOMAIN_ALIAS_RID_POWER_USERS)
    {
        if(!AllocateAndInitializeSid (
            &SidAuthorityNT,
            2,
            SECURITY_BUILTIN_DOMAIN_RID,
            dwSubAuthority,
            0, 0, 0, 0, 0, 0,
            &psidTemp
            )) return FALSE;
    }
    else
    {

        if(!AllocateAndInitializeSid (
            fUseWorldAuth ? &SidAuthorityWorld : &SidAuthorityNT,
            1,
            dwSubAuthority,
            0, 0, 0, 0, 0, 0, 0,
            &psidTemp
            )) return FALSE;

    }

    if(IsValidSid(psidTemp))
    {
        DWORD cbSid = GetLengthSid(psidTemp);
        *pSid = (PSID) malloc(cbSid);
        if(pSid)
        {
            if(!CopySid(cbSid, *pSid, psidTemp))
            {
                free(*pSid);
                *pSid = NULL;
            }
            else
            {
                fRetVal = TRUE;
            }
        }
        FreeSid(psidTemp);
    }

    return fRetVal;
}

DWORD GetCurrentUserSID ( PSID * pSid )

Definition at line 36 of file UtilS.Cpp.

{
    TOKEN_USER  *ptokenUser = NULL;
    HANDLE      hToken = NULL;
    DWORD       cbToken = 0;
    DWORD       cbSid = 0;
    DWORD       dwReturnValue = ERROR_SUCCESS;

    if (!OpenProcessToken (GetCurrentProcess(), TOKEN_QUERY, &hToken))
    {
            dwReturnValue = GetLastError();
            goto CLEANUP;
    }

    GetTokenInformation (hToken,
                         TokenUser,
                         ptokenUser,
                         0,
                         &cbToken);

    ptokenUser = (TOKEN_USER *) malloc (cbToken);

    if (!GetTokenInformation (hToken,
                             TokenUser,
                             ptokenUser,
                             cbToken,
                             &cbToken))
    {
            dwReturnValue = GetLastError();
            goto CLEANUP;
    }

    cbSid = GetLengthSid (ptokenUser->User.Sid);
    *pSid = (PSID) malloc (cbSid);

    memcpy (*pSid, ptokenUser->User.Sid, cbSid);
    CloseHandle (hToken);

CLEANUP:

    free (ptokenUser);

    return dwReturnValue;
}

DWORD GetPrincipalSID | ( | LPTSTR | tszPrincipal,
 |  | PSID * | pSid
 | ) |  |

Definition at line 196 of file UtilS.Cpp.

{
    DWORD        cbSid              = 0;
    TCHAR        tszRefDomain [256] = {0};
    DWORD        cbRefDomain        = 0;
    DWORD        dwReturnValue      = ERROR_SUCCESS;
    SID_NAME_USE snu;

    cbSid = 0;
    cbRefDomain = 255;

    if(ConstructWellKnownSID(tszPrincipal, pSid)) return ERROR_SUCCESS;

    LookupAccountName (NULL,
                       tszPrincipal,
                       *pSid,
                       &cbSid,
                       tszRefDomain,
                       &cbRefDomain,
                       &snu);

    dwReturnValue = GetLastError();
    if (dwReturnValue != ERROR_INSUFFICIENT_BUFFER) goto CLEANUP;

    dwReturnValue = ERROR_SUCCESS;

    *pSid = (PSID) malloc (cbSid);
    if(!pSid)
    {
        dwReturnValue = ERROR_OUTOFMEMORY;
        goto CLEANUP;
    }

    cbRefDomain = 255;

    if (!LookupAccountName (NULL,
                            tszPrincipal,
                            *pSid,
                            &cbSid,
                            tszRefDomain,
                            &cbRefDomain,
                            &snu))
    {
        dwReturnValue = GetLastError();
        goto CLEANUP;
    }

CLEANUP:

    return dwReturnValue;
}

BOOL IsLegacySecurityModel ( )

Definition at line 285 of file UtilS.Cpp.

{
    BOOL fReturnValue = FALSE;
    OSVERSIONINFOEX VersionInfo = {sizeof(VersionInfo)};

    if(GetVersionEx ((LPOSVERSIONINFO)&VersionInfo))
    {

        if(VersionInfo.dwMajorVersion == VERSION_MAJOR_W2K_XP_W2K3)
        {
            if(VersionInfo.dwMinorVersion < VERSION_MINOR_XP)
            {
                fReturnValue = TRUE;
            }
            else if(VersionInfo.dwMinorVersion == VERSION_MINOR_XP)
            {
                if(VersionInfo.wServicePackMajor < 2)
                {
                    fReturnValue = TRUE;
                }
            }
            else if(VersionInfo.dwMinorVersion == VERSION_MINOR_W2K3)
            {
                if(VersionInfo.wServicePackMajor < 1)
                {
                    fReturnValue = TRUE;
                }
            }

        }
        else if(VersionInfo.dwMajorVersion < VERSION_MAJOR_W2K_XP_W2K3)
        {
            fReturnValue = TRUE;
        }

    }

    return fReturnValue;
}

LPTSTR SystemMessage | ( | LPTSTR | tszBuffer,
 |  | DWORD | cbBuffer,
 |  | HRESULT | hr
 | ) |  |

Definition at line 256 of file UtilS.Cpp.

{
    LPTSTR   tszMessage = NULL;

    FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER |
                   FORMAT_MESSAGE_FROM_SYSTEM,
                   NULL,
                   hr,
                   MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
                   (LPTSTR) &tszMessage,
                   0,
                   NULL);

    _sntprintf (tszBuffer, cbBuffer-1, _T("%s(%lx)\n"), tszMessage, hr);

    LocalFree (tszMessage);
    return tszBuffer;
}

Generated on Wed Nov 13 2024 16:53:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/DComPerm/Wrappers.Cpp File Reference

  • Com
  • Fundamentals
  • DCom
  • DComPerm
Functions

Wrappers.Cpp File Reference

#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include <tchar.h>
#include "ntsecapi.h"
#include "dcomperm.h"

Go to the source code of this file.

Functions

DWORD | ChangeAppIDAccessACL (LPTSTR tszAppID, LPTSTR tszPrincipal, BOOL fSetPrincipal, BOOL fPermit, DWORD dwAccessMask)
DWORD | ChangeAppIDLaunchAndActivateACL (LPTSTR tszAppID, LPTSTR tszPrincipal, BOOL fSetPrincipal, BOOL fPermit, DWORD dwAccessMask)
DWORD | ChangeDefaultAccessACL (LPTSTR tszPrincipal, BOOL fSetPrincipal, BOOL fPermit, DWORD dwAccessMask)
DWORD | ChangeDefaultLaunchAndActivateACL (LPTSTR tszPrincipal, BOOL fSetPrincipal, BOOL fPermit, DWORD dwAccessMask)
DWORD | ChangeMachineAccessACL (LPTSTR tszPrincipal, BOOL fSetPrincipal, BOOL fPermit, DWORD dwAccessMask)
DWORD | ChangeMachineLaunchAndActivateACL (LPTSTR tszPrincipal, BOOL fSetPrincipal, BOOL fPermit, DWORD dwAccessMask)
DWORD | ListAppIDAccessACL (LPTSTR tszAppID)
DWORD | ListAppIDLaunchACL (LPTSTR tszAppID)
DWORD ListDefaultAccessACL ()
DWORD ListDefaultLaunchACL ()
DWORD ListMachineAccessACL ()
DWORD ListMachineLaunchACL ()

Function Documentation

DWORD ChangeAppIDAccessACL | ( | LPTSTR | tszAppID,
 |  | LPTSTR | tszPrincipal,
 |  | BOOL | fSetPrincipal,
 |  | BOOL | fPermit,
 |  | DWORD | dwAccessMask
 | ) |  |

Definition at line 481 of file Wrappers.Cpp.

{
    TCHAR   tszKeyName [256] = {0};
    DWORD dwReturnValue = ERROR_SUCCESS;

    _sntprintf (tszKeyName,
                 (sizeof(tszKeyName)/sizeof(*tszKeyName))-1,
                 tszAppID [0] == '{' ? _T("APPID\\%s") : _T("APPID\\{%s}"),
                 tszAppID);

    if (fSetPrincipal)
    {
        dwReturnValue =
            RemovePrincipalFromNamedValueSD (HKEY_CLASSES_ROOT,
                                             tszKeyName,
                                             _T("AccessPermission"),
                                             tszPrincipal,
                                             fPermit ? ACCESS_ALLOWED_ACE_TYPE :
                                             ACCESS_DENIED_ACE_TYPE);

        if(dwReturnValue != ERROR_SUCCESS) return dwReturnValue;

        dwReturnValue =
            UpdatePrincipalInNamedValueSD(HKEY_CLASSES_ROOT,
                                          tszKeyName,
                                          _T("AccessPermission"),
                                          tszPrincipal,
                                          dwAccessMask,
                                          TRUE,
                                          fPermit ? ACCESS_DENIED_ACE_TYPE :
                                          ACCESS_ALLOWED_ACE_TYPE);

        if(dwReturnValue != ERROR_SUCCESS) return dwReturnValue;

        dwReturnValue =
            AddPrincipalToNamedValueSD (HKEY_CLASSES_ROOT,
                                        tszKeyName,
                                        _T("AccessPermission"),
                                        tszPrincipal,
                                        fPermit,
                                        dwAccessMask,
                                        SDTYPE_APPLICATION_ACCESS);
    }
    else
    {
        dwReturnValue =
            RemovePrincipalFromNamedValueSD (HKEY_CLASSES_ROOT,
                                             tszKeyName,
                                             _T("AccessPermission"),
                                             tszPrincipal,
                                             ACE_TYPE_ALL);
    }

    return dwReturnValue;
}

DWORD ChangeAppIDLaunchAndActivateACL | ( | LPTSTR | tszAppID,
 |  | LPTSTR | tszPrincipal,
 |  | BOOL | fSetPrincipal,
 |  | BOOL | fPermit,
 |  | DWORD | dwAccessMask
 | ) |  |

Definition at line 570 of file Wrappers.Cpp.

{
    TCHAR   tszKeyName [256] = {0};
    DWORD dwReturnValue = ERROR_SUCCESS;

    _sntprintf (tszKeyName,
                 (sizeof(tszKeyName)/sizeof(*tszKeyName))-1,
                 tszAppID [0] == '{' ? _T("APPID\\%s") : _T("APPID\\{%s}"),
                 tszAppID);

    if (fSetPrincipal)
    {
        dwReturnValue =
            RemovePrincipalFromNamedValueSD (HKEY_CLASSES_ROOT,
                                             tszKeyName,
                                             _T("LaunchPermission"),
                                             tszPrincipal,
                                             fPermit ? ACCESS_ALLOWED_ACE_TYPE :
                                             ACCESS_DENIED_ACE_TYPE);

        if(dwReturnValue != ERROR_SUCCESS) return dwReturnValue;

        dwReturnValue =
            UpdatePrincipalInNamedValueSD(HKEY_CLASSES_ROOT,
                                          tszKeyName,
                                          _T("LaunchPermission"),
                                          tszPrincipal,
                                          dwAccessMask,
                                          TRUE,
                                          fPermit ? ACCESS_DENIED_ACE_TYPE :
                                          ACCESS_ALLOWED_ACE_TYPE);

        if(dwReturnValue != ERROR_SUCCESS) return dwReturnValue;

        dwReturnValue =
            AddPrincipalToNamedValueSD (HKEY_CLASSES_ROOT,
                                        tszKeyName,
                                        _T("LaunchPermission"),
                                        tszPrincipal,
                                        fPermit,
                                        dwAccessMask,
                                        SDTYPE_APPLICATION_LAUNCH);
    }
    else
    {
        dwReturnValue =
            RemovePrincipalFromNamedValueSD (HKEY_CLASSES_ROOT,
                                             tszKeyName,
                                             _T("LaunchPermission"),
                                             tszPrincipal,
                                             ACE_TYPE_ALL);
    }

    return dwReturnValue;
}

DWORD ChangeDefaultAccessACL | ( | LPTSTR | tszPrincipal,
 |  | BOOL | fSetPrincipal,
 |  | BOOL | fPermit,
 |  | DWORD | dwAccessMask
 | ) |  |

Definition at line 317 of file Wrappers.Cpp.

{

    DWORD dwReturnValue = ERROR_SUCCESS;

    if (fSetPrincipal)
    {
        dwReturnValue =
            RemovePrincipalFromNamedValueSD (HKEY_LOCAL_MACHINE,
                                             _T("Software\\Microsoft\\Ole"),
                                             _T("DefaultAccessPermission"),
                                             tszPrincipal,
                                             fPermit ? ACCESS_ALLOWED_ACE_TYPE :
                                             ACCESS_DENIED_ACE_TYPE);

        if(dwReturnValue != ERROR_SUCCESS) return dwReturnValue;

        dwReturnValue =
            UpdatePrincipalInNamedValueSD(HKEY_LOCAL_MACHINE,
                                          _T("Software\\Microsoft\\Ole"),
                                          _T("DefaultAccessPermission"),
                                          tszPrincipal,
                                          dwAccessMask,
                                          TRUE,
                                          fPermit ? ACCESS_DENIED_ACE_TYPE :
                                          ACCESS_ALLOWED_ACE_TYPE);

        if(dwReturnValue != ERROR_SUCCESS) return dwReturnValue;

        dwReturnValue =
            AddPrincipalToNamedValueSD (HKEY_LOCAL_MACHINE,
                                        _T("Software\\Microsoft\\Ole"),
                                        _T("DefaultAccessPermission"),
                                        tszPrincipal,
                                        fPermit,
                                        dwAccessMask,
                                        SDTYPE_DEFAULT_ACCESS);
    }
    else
    {
        dwReturnValue =
            RemovePrincipalFromNamedValueSD (HKEY_LOCAL_MACHINE,
                                             _T("Software\\Microsoft\\Ole"),
                                             _T("DefaultAccessPermission"),
                                             tszPrincipal,
                                             ACE_TYPE_ALL);
    }

    return dwReturnValue;

}

DWORD ChangeDefaultLaunchAndActivateACL | ( | LPTSTR | tszPrincipal,
 |  | BOOL | fSetPrincipal,
 |  | BOOL | fPermit,
 |  | DWORD | dwAccessMask
 | ) |  |

Definition at line 398 of file Wrappers.Cpp.

{
    DWORD dwReturnValue = ERROR_SUCCESS;

    if (fSetPrincipal)
    {
        dwReturnValue =
            RemovePrincipalFromNamedValueSD (HKEY_LOCAL_MACHINE,
                                             _T("Software\\Microsoft\\Ole"),
                                             _T("DefaultLaunchPermission"),
                                             tszPrincipal,
                                             fPermit ? ACCESS_ALLOWED_ACE_TYPE :
                                             ACCESS_DENIED_ACE_TYPE);

        if(dwReturnValue != ERROR_SUCCESS) return dwReturnValue;

        dwReturnValue =
            UpdatePrincipalInNamedValueSD(HKEY_LOCAL_MACHINE,
                                          _T("Software\\Microsoft\\Ole"),
                                          _T("DefaultLaunchPermission"),
                                          tszPrincipal,
                                          dwAccessMask,
                                          TRUE,
                                          fPermit ? ACCESS_DENIED_ACE_TYPE :
                                          ACCESS_ALLOWED_ACE_TYPE);

        if(dwReturnValue != ERROR_SUCCESS) return dwReturnValue;

        dwReturnValue =
            AddPrincipalToNamedValueSD (HKEY_LOCAL_MACHINE,
                                        _T("Software\\Microsoft\\Ole"),
                                        _T("DefaultLaunchPermission"),
                                        tszPrincipal,
                                        fPermit,
                                        dwAccessMask,
                                        SDTYPE_DEFAULT_LAUNCH);
    }
    else
    {
        dwReturnValue =
            RemovePrincipalFromNamedValueSD (HKEY_LOCAL_MACHINE,
                                             _T("Software\\Microsoft\\Ole"),
                                             _T("DefaultLaunchPermission"),
                                             tszPrincipal,
                                             ACE_TYPE_ALL);
    }

    return dwReturnValue;

}

DWORD ChangeMachineAccessACL | ( | LPTSTR | tszPrincipal,
 |  | BOOL | fSetPrincipal,
 |  | BOOL | fPermit,
 |  | DWORD | dwAccessMask
 | ) |  |

Definition at line 158 of file Wrappers.Cpp.

{

    DWORD dwReturnValue = ERROR_SUCCESS;

    if (fSetPrincipal)
    {
        dwReturnValue =
            RemovePrincipalFromNamedValueSD (HKEY_LOCAL_MACHINE,
                                             _T("Software\\Microsoft\\Ole"),
                                             _T("MachineAccessRestriction"),
                                             tszPrincipal,
                                             fPermit ? ACCESS_ALLOWED_ACE_TYPE : ACCESS_DENIED_ACE_TYPE);

        if(dwReturnValue != ERROR_SUCCESS) return dwReturnValue;

        dwReturnValue =
            UpdatePrincipalInNamedValueSD(HKEY HKEY_LOCAL_MACHINE,
                                          _T("Software\\Microsoft\\Ole"),
                                          _T("MachineAccessRestriction"),
                                          tszPrincipal,
                                          dwAccessMask,
                                          TRUE,
                                          fPermit ? ACCESS_DENIED_ACE_TYPE : ACCESS_ALLOWED_ACE_TYPE);

        if(dwReturnValue != ERROR_SUCCESS) return dwReturnValue;

        dwReturnValue =
            AddPrincipalToNamedValueSD (HKEY_LOCAL_MACHINE,
                                        _T("Software\\Microsoft\\Ole"),
                                        _T("MachineAccessRestriction"),
                                        tszPrincipal,
                                        fPermit,
                                        dwAccessMask,
                                        SDTYPE_MACHINE_ACCESS);
    }
    else
    {
        dwReturnValue =
            RemovePrincipalFromNamedValueSD (HKEY_LOCAL_MACHINE,
                                             _T("Software\\Microsoft\\Ole"),
                                             _T("MachineAccessRestriction"),
                                             tszPrincipal,
                                             ACE_TYPE_ALL);
    }

    return dwReturnValue;
}

DWORD ChangeMachineLaunchAndActivateACL | ( | LPTSTR | tszPrincipal,
 |  | BOOL | fSetPrincipal,
 |  | BOOL | fPermit,
 |  | DWORD | dwAccessMask
 | ) |  |

Definition at line 236 of file Wrappers.Cpp.

{

    DWORD dwReturnValue = ERROR_SUCCESS;

    if (fSetPrincipal)
    {
        dwReturnValue =
            RemovePrincipalFromNamedValueSD (HKEY_LOCAL_MACHINE,
                                             _T("Software\\Microsoft\\Ole"),
                                             _T("MachineLaunchRestriction"),
                                             tszPrincipal,
                                             fPermit ? ACCESS_ALLOWED_ACE_TYPE :
                                             ACCESS_DENIED_ACE_TYPE);

        if(dwReturnValue != ERROR_SUCCESS) return dwReturnValue;

        dwReturnValue =
            UpdatePrincipalInNamedValueSD(HKEY_LOCAL_MACHINE,
                                          _T("Software\\Microsoft\\Ole"),
                                          _T("MachineLaunchRestriction"),
                                          tszPrincipal,
                                          dwAccessMask,
                                          TRUE,
                                          fPermit ? ACCESS_DENIED_ACE_TYPE :
                                          ACCESS_ALLOWED_ACE_TYPE);

        if(dwReturnValue != ERROR_SUCCESS) return dwReturnValue;

        dwReturnValue =
            AddPrincipalToNamedValueSD (HKEY_LOCAL_MACHINE,
                                        _T("Software\\Microsoft\\Ole"),
                                        _T("MachineLaunchRestriction"),
                                        tszPrincipal,
                                        fPermit,
                                        dwAccessMask,
                                        SDTYPE_MACHINE_LAUNCH);
    }
    else
    {
        dwReturnValue =
            RemovePrincipalFromNamedValueSD (HKEY_LOCAL_MACHINE,
                                             _T("Software\\Microsoft\\Ole"),
                                             _T("MachineLaunchRestriction"),
                                             tszPrincipal,
                                             ACE_TYPE_ALL);
    }

    return dwReturnValue;
}

DWORD ListAppIDAccessACL ( LPTSTR tszAppID )

Definition at line 92 of file Wrappers.Cpp.

{
    TCHAR   tszKeyName [256] = {0};

    _sntprintf (tszKeyName,
                 (sizeof(tszKeyName)/sizeof(*tszKeyName))-1,
                 tszAppID [0] == '{' ? _T("APPID\\%s") : _T("APPID\\{%s}"),
                 tszAppID);

    return ListNamedValueSD (HKEY_CLASSES_ROOT,
                             tszKeyName,
                             _T("AccessPermission"),
                             SDTYPE_APPLICATION_ACCESS);
}

DWORD ListAppIDLaunchACL ( LPTSTR tszAppID )

Definition at line 116 of file Wrappers.Cpp.

{
    TCHAR   tszKeyName [256] = {0};

    _sntprintf (tszKeyName,
                 (sizeof(tszKeyName)/sizeof(*tszKeyName))-1,
                 tszAppID [0] == '{' ? _T("APPID\\%s") : _T("APPID\\{%s}"),
                 tszAppID);

    return ListNamedValueSD (HKEY_CLASSES_ROOT,
                             tszKeyName,
                             _T("LaunchPermission"),
                             SDTYPE_APPLICATION_LAUNCH);
}

DWORD ListDefaultAccessACL ( )

Definition at line 62 of file Wrappers.Cpp.

{
    return ListNamedValueSD (HKEY_LOCAL_MACHINE,
                             _T("Software\\Microsoft\\Ole"),
                             _T("DefaultAccessPermission"),
                             SDTYPE_DEFAULT_ACCESS);
}

DWORD ListDefaultLaunchACL ( )

Definition at line 77 of file Wrappers.Cpp.

{
    return ListNamedValueSD (HKEY_LOCAL_MACHINE,
                             _T("Software\\Microsoft\\Ole"),
                             _T("DefaultLaunchPermission"),
                             SDTYPE_DEFAULT_LAUNCH);
}

DWORD ListMachineAccessACL ( )

Definition at line 32 of file Wrappers.Cpp.

{
    return ListNamedValueSD (HKEY_LOCAL_MACHINE,
                             _T("Software\\Microsoft\\Ole"),
                             _T("MachineAccessRestriction"),
                             SDTYPE_MACHINE_ACCESS);
}

DWORD ListMachineLaunchACL ( )

Definition at line 47 of file Wrappers.Cpp.

{
    return ListNamedValueSD (HKEY_LOCAL_MACHINE,
                             _T("Software\\Microsoft\\Ole"),
                             _T("MachineLaunchRestriction"),
                             SDTYPE_MACHINE_LAUNCH);
}

Generated on Wed Nov 13 2024 16:53:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/OleImp/Client.Cpp File Reference

  • Com
  • Fundamentals
  • DCom
  • OleImp
Defines | Functions

Client.Cpp File Reference

#include <stdio.h>
#include <windows.h>
#include <initguid.h>
#include <tchar.h>
#include <conio.h>

Go to the source code of this file.

Defines

#define | INC_OLE2

Functions

DEFINE_GUID (CLSID_CObject, 0x35b79d1, 0xd6d3, 0x11cf, 0xb9, 0xd4, 0x0, 0xaa, 0x0, 0xa2, 0x16, 0xe0)
void __cdecl | main (int argc, CHAR **argv)
void | Message (LPTSTR szPrefix, HRESULT hr)

Define Documentation

#define INC_OLE2

Definition at line 19 of file Client.Cpp.

Function Documentation

DEFINE_GUID | ( | CLSID_CObject | ,
 |  | 0x35b79d1 | ,
 |  | 0xd6d3 | ,
 |  | 0x11cf | ,
 |  | 0xb9 | ,
 |  | 0xd4 | ,
 |  | 0x0 | ,
 |  | 0xaa | ,
 |  | 0x0 | ,
 |  | 0xa2 | ,
 |  | 0x16 | ,
 |  | 0xe0 |
 | ) |  |
void __cdecl main | ( | int | argc,
 |  | CHAR ** | argv
 | ) |  |

Definition at line 68 of file Client.Cpp.

{
    HRESULT hr;
    COSERVERINFO csi, *pcsi=NULL;
    WCHAR wsz [MAX_PATH];
  LPCLASSFACTORY pcf = NULL;

    // initialize COM for free-threaded use
    hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
    if (FAILED(hr))
        {
        Message(TEXT("Client: CoInitializeEx"), hr);
        exit(hr);
        }

  // initialize the security layer
  hr = CoInitializeSecurity (
          NULL,
          -1,
          NULL,
          NULL,
          RPC_C_AUTHN_LEVEL_CONNECT,
          RPC_C_IMP_LEVEL_IMPERSONATE,
          NULL,
          0,
          NULL);
  if (FAILED(hr))
    {
    Message(TEXT("Client: CoInitializeSecurity"), hr);
    exit(hr);
    }

    // allow a machine-name as the command-line argument
    if (argc > 1)
        {
        MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, argv[1], -1,
            wsz, MAX_PATH);
    memset (&csi, 0, sizeof (csi));
        csi.pwszName = wsz;
        pcsi = &csi;
        }

  // get the class factory for CObject on the argv[1] machine
  hr = CoGetClassObject (CLSID_CObject, CLSCTX_SERVER, pcsi,
              IID_IClassFactory, (LPVOID*)&pcf);
  if (FAILED(hr))
    Message(TEXT("Client: CoGetClassObject"), hr);
  else
    {
        LPUNKNOWN   punk = NULL;

      // create a remote instance of the object
      Message(TEXT("Client: Creating Instance..."), S_OK);
      hr = pcf->CreateInstance(NULL, IID_IUnknown, (LPVOID*)&punk);
      if (FAILED(hr))
          Message(TEXT("Client: CoCreateInstanceEx"), hr);
      else
          {
      // wait until the user wants us to release the object
      Message(TEXT("Client: Press any key to release object..."), S_OK);
      getch();

          // let go of the object
          punk->Release();
          }
    pcf->Release();
    }
    CoUninitialize();
    Message(TEXT("Client: Done"), S_OK);
}  // main

void Message | ( | LPTSTR | szPrefix,
 |  | HRESULT | hr
 | ) |  |

Definition at line 35 of file Client.Cpp.

{
    LPTSTR   szMessage;

    if (hr == S_OK)
        {
        _tprintf(szPrefix);
        _tprintf(TEXT("\n"));
        return;
        }

    if (HRESULT_FACILITY(hr) == FACILITY_WINDOWS)
        hr = HRESULT_CODE(hr);

    FormatMessage(
        FORMAT_MESSAGE_ALLOCATE_BUFFER |
        FORMAT_MESSAGE_FROM_SYSTEM,
        NULL,
        hr,
        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), //The user default language
        (LPTSTR)&szMessage,
        0,
        NULL );

    _tprintf (TEXT("%s: %s(%lx)\n"), szPrefix, szMessage, hr);

    LocalFree(szMessage);
}  // Message

Generated on Wed Nov 13 2024 16:53:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/OleImp/OleImp.Cpp File Reference

  • Com
  • Fundamentals
  • DCom
  • OleImp
Classes | Defines | Functions | Variables

OleImp.Cpp File Reference

#include <windows.h>
#include <initguid.h>
#include <stdio.h>
#include <string.h>
#include <tchar.h>
#include "util.h"

Go to the source code of this file.

Classes

class | CClassFactory
class | CObject

Defines

#define | COINIT_APARTMENTTHREADED 2
#define | cServerThreads 5
#define | INC_OLE2
#define | MAX_USER_NAME 50
#define | STRICT
#define | szCloseQuery TEXT("Client references still exist. Are you sure you want to close?")
#define | szTitleServer TEXT("SERVER: OLE Apartment Impersonation Sample")
#define | szWindowClass TEXT("OLEIMP_CLASS")

Functions

DEFINE_GUID (CLSID_CObject, 0x35b79d1, 0xd6d3, 0x11cf, 0xb9, 0xd4, 0x0, 0xaa, 0x0, 0xa2, 0x16, 0xe0)
BOOL | FAutoRegister (HINSTANCE hinst)
BOOL | FindSlot (PSID psid, int *piThread)
LRESULT CALLBACK | MainWndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
LRESULT | ServerThreadProc (LPARAM lParam)
int PASCAL | WinMain (HINSTANCE hinst, HINSTANCE hinstPrev, LPSTR szCmdLine, int nCmdShow)

Variables

const LARGE_INTEGER | bZero = {0,0}
CClassFactory vclassfactory
BOOL vfServer
HANDLE vhEventServer
HRESULT | vhrThreadStatus
HWND | vhwndMain
LPSTREAM | vpstmMarshalling
INT | vrgcObjects [cServerThreads]
HANDLE | vrghEvent [cServerThreads]
HANDLE | vrghThread [cServerThreads]
PSID | vrgpSid [cServerThreads]
LPTSTR | vrgpszAptUser [cServerThreads]
DWORD | vrgtid [cServerThreads]

Define Documentation

#define COINIT_APARTMENTTHREADED 2

Definition at line 77 of file OleImp.Cpp.

#define cServerThreads 5

Definition at line 73 of file OleImp.Cpp.

#define INC_OLE2

Definition at line 63 of file OleImp.Cpp.

#define MAX_USER_NAME 50

Definition at line 78 of file OleImp.Cpp.

#define STRICT

Definition at line 64 of file OleImp.Cpp.

#define szCloseQuery TEXT("Client references still exist. Are you sure you want to close?")

Definition at line 76 of file OleImp.Cpp.

#define szTitleServer TEXT("SERVER: OLE Apartment Impersonation Sample")

Definition at line 75 of file OleImp.Cpp.

#define szWindowClass TEXT("OLEIMP_CLASS")

Definition at line 74 of file OleImp.Cpp.

Function Documentation

DEFINE_GUID | ( | CLSID_CObject | ,
 |  | 0x35b79d1 | ,
 |  | 0xd6d3 | ,
 |  | 0x11cf | ,
 |  | 0xb9 | ,
 |  | 0xd4 | ,
 |  | 0x0 | ,
 |  | 0xaa | ,
 |  | 0x0 | ,
 |  | 0xa2 | ,
 |  | 0x16 | ,
 |  | 0xe0 |
 | ) |  |
BOOL FAutoRegister ( HINSTANCE hinst )

Definition at line 409 of file OleImp.Cpp.

{
    static const TCHAR szClassDesc[]      = TEXT("Ole Apartment Impersonation Sample");
    static const TCHAR szCLSIDEntry[]     = TEXT("CLSID\\{035B79D1-D6D3-11cf-B9D4-00AA00A216E0}");
  static const TCHAR szAppIDEntry[]     = TEXT("APPID\\{035B79D1-D6D3-11cf-B9D4-00AA00A216E0}");
  static const TCHAR szAppIDString[]      = TEXT("{035B79D1-D6D3-11cf-B9D4-00AA00A216E0}");
  static const TCHAR szAppID[]        = TEXT("AppID");
  static const TCHAR szLocalServer32[]    = TEXT("LocalServer32");
  static const TCHAR szRunAs[]        = TEXT("RunAs");
  static const TCHAR szInteractiveUser[]    = TEXT("Interactive User");
    TCHAR       szPath[512];
  TCHAR   szModuleEntry[512];
  LPTSTR    index;
    HKEY        hkeyT = NULL;

    // install the CLSID key and get the FQP for this executable
    if ((RegSetValue(HKEY_CLASSES_ROOT, szCLSIDEntry, REG_SZ, szClassDesc,
            lstrlen(szClassDesc)) != ERROR_SUCCESS) ||
        (RegCreateKey(HKEY_CLASSES_ROOT, szCLSIDEntry, &hkeyT)
            != ERROR_SUCCESS) ||
        !GetModuleFileName(hinst, szPath, sizeof(szPath)))
        return FALSE;

  // install the LocalServer32 value
    if (RegSetValue(hkeyT, szLocalServer32, REG_SZ, szPath, lstrlen(szPath))
            != ERROR_SUCCESS)
        goto LErrExit;

  // install a pointer to our App ID
    if (RegSetValueEx(hkeyT, szAppID, 0, REG_SZ, (LPBYTE)szAppIDString,
        sizeof(szAppIDString)) != ERROR_SUCCESS)
        goto LErrExit;

    RegCloseKey(hkeyT);

  // install the App ID
  if ((RegSetValue(HKEY_CLASSES_ROOT, szAppIDEntry, REG_SZ, szClassDesc,
      lstrlen(szClassDesc)) != ERROR_SUCCESS) ||
    (RegCreateKey(HKEY_CLASSES_ROOT, szAppIDEntry, &hkeyT)
      != ERROR_SUCCESS))
    goto LErrExit;

  // indicate that we should run as the interactive user
  if (RegSetValueEx(hkeyT, szRunAs, 0, REG_SZ, (LPBYTE)szInteractiveUser,
      sizeof(szInteractiveUser)) != ERROR_SUCCESS)
    goto LErrExit;

    RegCloseKey(hkeyT);

  // get the App ID module entry
  index = _tcsrchr (szPath, TEXT('\\'));
  if (NULL == index)
    index = szPath;
  else
    index += 1;

  _snprintf(szModuleEntry, sizeof(szModuleEntry)/sizeof(TCHAR)-1, "%s%s", TEXT("APPID\\"), index);

  // Create the module entry in the APPID tree
  if (RegCreateKey(HKEY_CLASSES_ROOT, szModuleEntry, &hkeyT)
      != ERROR_SUCCESS)
    goto LErrExit;

  // associate the App ID with the module
  if (RegSetValueEx(hkeyT, szAppID, 0, REG_SZ, (LPBYTE)szAppIDString,
      sizeof(szAppIDString)) != ERROR_SUCCESS)
    goto LErrExit;

    RegCloseKey(hkeyT);

    return TRUE;

LErrExit:
    RegCloseKey(hkeyT);
    return FALSE;
}  // FAutoRegister

BOOL FindSlot | ( | PSID | psid,
 |  | int * | piThread
 | ) |  |

Definition at line 838 of file OleImp.Cpp.

{
  int iThread;

  // see if there is already an apartment impersonating this user
  for (iThread = 0; iThread < cServerThreads; iThread++)
    {
    if ((NULL != vrgpSid[iThread]) &&
        (EqualSid (psid, vrgpSid[iThread])))
      break;
    }

  // if this user didn't have a thread already, find a free one
  if (iThread == cServerThreads)
    {
    for (iThread = 0; iThread < cServerThreads; iThread++)
      {
      if (NULL == vrgpSid[iThread])
        break;
      }

    if (iThread == cServerThreads) // no resources available...
      return(FALSE);
    }

  // return the index to use
  *piThread = iThread;
  return(TRUE);
}

LRESULT CALLBACK MainWndProc | ( | HWND | hwnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 145 of file OleImp.Cpp.

{
    LRESULT lresult = TRUE;
  int i;

    switch (message)
        {
        case WM_PAINT:
            {
            HDC hdc;
            PAINTSTRUCT ps;
            int i;

            if ((hdc = BeginPaint(hwnd, &ps)) != NULL)
                {
                for (i=0; i<cServerThreads; i++)
                    {
                    TCHAR    rgch[200];

          // if a thread which is impersonating a user no
          // longer has any objects, free up the resources
          // and stop impersonating
          if (0 == vrgcObjects[i] && NULL != vrgpSid[i])
            {
              UtilFreeMem(vrgpszAptUser[i]);
              vrgpszAptUser[i] = NULL;
              UtilFreeMem(vrgpSid[i]);
              vrgpSid[i] = NULL;
              SetThreadToken (&vrghThread[i], NULL);
            }

                    wsprintf(rgch, TEXT("Thread #%d (%s): %d objects"),
                          i,
                          (NULL == vrgpszAptUser[i])?
                            TEXT("No User") :
                            vrgpszAptUser[i],
                          vrgcObjects[i]);
                    TextOut(hdc, 20, 10+(i*25), rgch, lstrlen(rgch));
                    }
                }
            EndPaint(hwnd, &ps);
            }
            break;

        case WM_DESTROY:
            PostQuitMessage(0);
            break;

        case WM_CLOSE:
            // check for clients and prompt in the UI.
            for (i=0; i<cServerThreads; i++)
                {
                if (vrgcObjects[i] > 0)
                    {
                    if (MessageBox(hwnd, szCloseQuery,
                            szTitleServer, MB_YESNO) == IDNO)
                        return FALSE;
                    else
                        break;
                    }
                }

        default:
            return DefWindowProc(hwnd, message, wParam, lParam);
        }

    return lresult;
}  // MainWndProc

LRESULT ServerThreadProc ( LPARAM lParam )

Definition at line 650 of file OleImp.Cpp.

{
   UNREFERENCED_PARAMETER(lParam);
    HRESULT hr;
    MSG     msg;
    int     iThread;

    // figure out which thread this is: it needs its synchronization event
    for (iThread=0; iThread<cServerThreads; iThread++)
        {
        if (vrgtid[iThread] == GetCurrentThreadId())
            break;
        }
    if (iThread==cServerThreads)
        return E_UNEXPECTED;

    // initialize COM
    hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
    if (FAILED(hr))
        {
        MessageBeep(0);
        return hr;
        }

    // apartment message/event loop
    // (see SDK documentation for MsgWaitForMultipleObjects)
    // here worker message loops last forever. in situations without a
    // static number of worker threads, the loop could easily be terminated by
    // WM_QUITs sent from the main thread which might manage the worker thread
    // pool more carefully.
#pragma warning(push)
#pragma warning(disable : 4127) // conditional expression is constant
    while (true)
#pragma warning(pop)
        {
        DWORD dwWaitResult;

        // wait for any message sent or posted to this queue
        // or for one of the passed handles to become signaled
        dwWaitResult = MsgWaitForMultipleObjects(1, &vrghEvent[iThread],
            FALSE, INFINITE, QS_ALLINPUT);

        // result tells us the type of event we have:
        // a message or a signaled handle

        // if there are one or more messages in the queue ...
        if (dwWaitResult == (WAIT_OBJECT_0 + 1))
            {
            // dispatch all of the messages in this next loop
            // (here is where we'd check for WM_QUITs to end this
            // worker thread if we wanted to)
            while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
                DispatchMessage(&msg);
            }
        else
            {
            // this thread was signaled to create a new object
            try
                {
                LPUNKNOWN   punk;

        // if the user name isn't set, look it up
        // we could do this in the class factory, but this gives
        // us a sanity check on the impersonation
        if (NULL == vrgpszAptUser[iThread])
          {
          LPTSTR pszUser;
          DWORD cchUser = MAX_USER_NAME;

          if (!UtilAllocMem ((PVOID*)&pszUser, cchUser*sizeof(TCHAR)))
            throw E_OUTOFMEMORY;

          if (!GetUserName (pszUser, &cchUser))
            lstrcpy(pszUser, TEXT("Name not found"));

          vrgpszAptUser[iThread] = pszUser;
          }

                // create a new CObject
                punk = (IUnknown *)new CObject;
                if (punk == NULL)
                    throw E_OUTOFMEMORY;

                hr = vpstmMarshalling->Seek(bZero, STREAM_SEEK_SET, NULL);
                if (FAILED(hr))
                    throw hr;
                hr = CoMarshalInterface(vpstmMarshalling,
                    IID_IUnknown,
                    punk,
                    MSHCTX_INPROC,
                    NULL,
                    MSHLFLAGS_NORMAL);
                if (FAILED(hr))
                    throw hr;

                // punk is now referenced by its marshal-data in vpstmMarshalling.
                // we release our local reference here so the unmarshaller will
                // have the sole reference. a common mistake is to forget this
                // release and end up with orphaned objects in the server.
                punk->Release();

                // modify the global state -- the # of objects/thread -- which is
                // displayed in the server UI
                vrgcObjects[iThread]++;
                InvalidateRect(vhwndMain, NULL, TRUE);

                vhrThreadStatus = S_OK;
                }
            catch (HRESULT hr)
                {
                vhrThreadStatus = hr;
                }
            SetEvent(vhEventServer);
            }

        }

    CoUninitialize();
    return msg.wParam;
}  // ServerThreadProc

int PASCAL WinMain | ( | HINSTANCE | hinst,
 |  | HINSTANCE | hinstPrev,
 |  | LPSTR | szCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 220 of file OleImp.Cpp.

{
   UNREFERENCED_PARAMETER(hinstPrev);
    WNDCLASS wndclass;
    HRESULT hr;
    int     i;
    DWORD   dwRegister = 0;
    MSG     msg;
  PSECURITY_DESCRIPTOR psd = NULL;

    // parse the command-line
    if (szCmdLine)
        {
        LPSTR   sz = strtok(szCmdLine, " \t");

    if (sz)
      {
      if (!strcmpi(sz, "-AutoRegister"))
        {
          if (!FAutoRegister(hinst))
              {
              hr = GetLastError();
              goto LCleanup;
              }
        else
          {
          MessageBox (GetDesktopWindow(),
            TEXT("Registered Successfully!"),
            szTitleServer, MB_OK);
          return S_OK;
          }
        }
      else
        vfServer = TRUE;
      }
        }

    // initialize COM
    hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
    if (FAILED(hr))
        {
        ErrorMessage(NULL, TEXT("CoInitializeEx"), hr);
        return hr;
        }

  // psd must remain valid until after we uninit COM
  if (!CreateAppSecurityDescriptor(&psd))
    {
    return E_FAIL;
    }

  // initialize the security layer
  hr = CoInitializeSecurity (
          psd,
          -1,
          NULL,
          NULL,
          RPC_C_AUTHN_LEVEL_CONNECT,
          RPC_C_IMP_LEVEL_IMPERSONATE,
          NULL,
          0,
          NULL);
    if (FAILED(hr))
        {
        ErrorMessage(NULL, TEXT("CoInitializeSecurity"), hr);
        return hr;
        }

    // create the threads and synchronization events
    // which the server will need
    for (i=0; i<cServerThreads; i++)
        {
        TCHAR    rgch[32];

        // create the thread suspended so its event can be
        // created using its thread-id and it will be able to
        // use it as soon as it runs
        vrghThread[i] = CreateThread(NULL,
            0,
            (LPTHREAD_START_ROUTINE)&ServerThreadProc,
            0,
            CREATE_SUSPENDED,
            &vrgtid[i]);
        if (vrghThread[i] == NULL)
            {
            hr = GetLastError();
            goto LCleanup;
            }

        // a thread can use its thread-id to OpenEvent this existing
        // event at any time. it can also look for its thread-id in
        // vrgtid[] to determine its index for use with vrghEvent.
        // this event signals to a worker thread to create a new CObject
        wsprintf(rgch, TEXT("Thread_%d"), vrgtid[i]);
        vrghEvent[i] = CreateEvent(NULL, FALSE, FALSE, rgch);
        if (vrghEvent[i] == NULL)
            {
            hr = GetLastError();
            goto LCleanup;
            }

    // initially no user is associated with a thread
    vrgpSid[i] = NULL;
    vrgpszAptUser[i] = NULL;

        // now that the event is available, let the thread run
        ResumeThread(vrghThread[i]);
        }

    // this signals the status of a worker threads creation after
    // receiving its create signal via vrghEvent[i]
    vhEventServer = CreateEvent(NULL, FALSE, FALSE, TEXT("Server"));
    if (vhEventServer == NULL)
        {
        hr = GetLastError();
        goto LCleanup;
        }

    // register the class-factory with COM
    hr = CoRegisterClassObject(CLSID_CObject,
        (IUnknown *)&vclassfactory,
        CLSCTX_LOCAL_SERVER,
        REGCLS_MULTIPLEUSE,
        &dwRegister);
    if (FAILED(hr))
        goto LCleanup;

    // create an IStream to be used for marshalling new objects between
    // the worker and the CClassFactory
    hr = CreateStreamOnHGlobal(NULL, TRUE, &vpstmMarshalling);
    if (FAILED(hr))
        goto LCleanup;

    // create the server UI
    memset(&wndclass, 0, sizeof(wndclass));
    wndclass.lpszClassName = szWindowClass;
    wndclass.style = CS_HREDRAW | CS_VREDRAW;
    wndclass.lpfnWndProc = MainWndProc;
    wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
    wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
    wndclass.hbrBackground = (HBRUSH)(COLOR_APPWORKSPACE + 1);
    wndclass.hInstance = hinst;

    if (!RegisterClass(&wndclass) ||
        (vhwndMain = CreateWindow(szWindowClass,
            szTitleServer,
            WS_OVERLAPPEDWINDOW,
            CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
            HWND_DESKTOP, NULL, hinst, NULL)) == NULL)
        {
        hr = GetLastError();
        goto LCleanup;
        }

    ShowWindow(vhwndMain, nCmdShow);

    while (GetMessage(&msg, NULL, 0, 0))
        {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
        }
#pragma warning(push)
#pragma warning(disable: 4244) // '=' : conversion from 'WPARAM' to 'HRESULT', possible loss of data
    hr = static_cast<HRESULT>(msg.wParam);
#pragma warning(pop)

LCleanup:
    if (hr != S_OK)
        ErrorMessage(NULL, TEXT("CoInitializeEx"), hr);

    // we explicitly don't clean up threads and events
    if (dwRegister != 0)
        CoRevokeClassObject(dwRegister);
    if (vpstmMarshalling != NULL)
        vpstmMarshalling->Release();

    CoUninitialize();

  FreeAppSecurityDescriptor (psd);

    return hr;
}  // WinMain

Variable Documentation

const LARGE_INTEGER bZero = {0,0}

Definition at line 79 of file OleImp.Cpp.

CClassFactory vclassfactory

Definition at line 130 of file OleImp.Cpp.

BOOL vfServer

Definition at line 122 of file OleImp.Cpp.

HANDLE vhEventServer

Definition at line 129 of file OleImp.Cpp.

HRESULT vhrThreadStatus

Definition at line 133 of file OleImp.Cpp.

HWND vhwndMain

Definition at line 131 of file OleImp.Cpp.

LPSTREAM vpstmMarshalling

Definition at line 132 of file OleImp.Cpp.

INT vrgcObjects[cServerThreads]

Definition at line 126 of file OleImp.Cpp.

HANDLE vrghEvent[cServerThreads]

Definition at line 125 of file OleImp.Cpp.

HANDLE vrghThread[cServerThreads]

Definition at line 123 of file OleImp.Cpp.

PSID vrgpSid[cServerThreads]

Definition at line 127 of file OleImp.Cpp.

LPTSTR vrgpszAptUser[cServerThreads]

Definition at line 128 of file OleImp.Cpp.

DWORD vrgtid[cServerThreads]

Definition at line 124 of file OleImp.Cpp.

Generated on Wed Nov 13 2024 16:53:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/OleImp/Util.Cpp File Reference

  • Com
  • Fundamentals
  • DCom
  • OleImp
Defines | Functions

Util.Cpp File Reference

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include "util.h"

Go to the source code of this file.

Defines

#define | INC_OLE2
#define | STRICT

Functions

BOOL | CreateAppSecurityDescriptor (PSECURITY_DESCRIPTOR *ppsd)
void | ErrorMessage (HWND hwnd, LPCTSTR szFunction, HRESULT hr)
BOOL | FreeAppSecurityDescriptor (PSECURITY_DESCRIPTOR psd)
BOOL | GetGroupSidFromToken (HANDLE hToken, PSID *ppSid)
BOOL | GetUserSidFromToken (HANDLE hToken, PSID *ppSid)
BOOL | UtilAllocMem (PVOID *ppv, DWORD cb)
void | UtilFreeMem (PVOID pv)

Define Documentation

#define INC_OLE2

Definition at line 19 of file Util.Cpp.

#define STRICT

Definition at line 20 of file Util.Cpp.

Function Documentation

BOOL CreateAppSecurityDescriptor ( PSECURITY_DESCRIPTOR * ppsd )

Definition at line 139 of file Util.Cpp.

{
  PSECURITY_DESCRIPTOR psd = NULL;
  PSID psidUser = NULL, psidGroup = NULL;
  HANDLE hToken;
  GENERIC_MAPPING gm =  {1, 2, 4, 8}; // dummy GM for AccessCheck
  DWORD dwDesired = 1;  // MUST be a value from GM
  BOOL fAccess = FALSE;
  DWORD dwGranted;
  PRIVILEGE_SET ps;
  DWORD cbPriv = sizeof (ps);

  // allocate the security descriptor
  if (!UtilAllocMem ((PVOID*)&psd, SECURITY_DESCRIPTOR_MIN_LENGTH))
    return(FALSE);

  // we have to impersonate ourselves for the AccessCheck later
  if (!ImpersonateSelf(SecurityImpersonation))
    return(FALSE);

  __try  {

    if (!InitializeSecurityDescriptor(psd, SECURITY_DESCRIPTOR_REVISION))
      return(FALSE);

    // give it a NULL DACL -- allow all access
    if (!SetSecurityDescriptorDacl (psd, TRUE, NULL, FALSE))
      return(FALSE);

    // open the token to get the user and group for the new SD
    if (!OpenThreadToken (GetCurrentThread(), TOKEN_QUERY, TRUE, &hToken))
      return(FALSE);

    // set the SD owner
    if (!GetUserSidFromToken(hToken, &psidUser))
      return(FALSE);
    if (!SetSecurityDescriptorOwner(psd, psidUser, FALSE))
      return(FALSE);

    // set the SD group
    if (!GetGroupSidFromToken(hToken, &psidGroup))
      return(FALSE);
    if (!SetSecurityDescriptorGroup(psd, psidGroup, FALSE))
      return(FALSE);

    // use AccessCheck to verify that we have a good SD
    // using dummy values since we don't really have anything to check
    if (!AccessCheck(psd, hToken, dwDesired, &gm, &ps, &cbPriv,
        &dwGranted, &fAccess))
      return(FALSE);

    *ppsd = psd;
    psd = NULL;     //
    psidUser = NULL;  // don't free these...
    psidGroup = NULL; //

    return(TRUE);

  } __finally  {
    UtilFreeMem (psd);
    UtilFreeMem (psidUser);
    UtilFreeMem (psidGroup);
    RevertToSelf ();
  }
  return FALSE;
}

void ErrorMessage | ( | HWND | hwnd,
 |  | LPCTSTR | szFunction,
 |  | HRESULT | hr
 | ) |  |

Definition at line 231 of file Util.Cpp.

{
  LPTSTR   szMessage;

  if (HRESULT_FACILITY(hr) == FACILITY_WINDOWS)
    hr = HRESULT_CODE(hr);

  if (!FormatMessage(
      FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
      NULL, hr,
      MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), //The user default
      (LPTSTR)&szMessage, 0, NULL))
    return;

  if (hwnd == NULL)
    {
    OutputDebugString(szFunction);
    OutputDebugString(TEXT(": "));
    OutputDebugString(szMessage);
    OutputDebugString(TEXT("\n"));
    }
  else
    MessageBox(hwnd, szMessage, szFunction, MB_OK);

  LocalFree(szMessage);
}  // ErrorMessage

BOOL FreeAppSecurityDescriptor ( PSECURITY_DESCRIPTOR psd )

Definition at line 210 of file Util.Cpp.

{
  PSID psid;
  BOOL fDefaulted;

  if (!GetSecurityDescriptorOwner(psd, &psid, &fDefaulted))
    return(FALSE);
  UtilFreeMem (psid);

  if (!GetSecurityDescriptorGroup(psd, &psid, &fDefaulted))
    return(FALSE);
  UtilFreeMem (psid);

  UtilFreeMem (psd);

  return(TRUE);
}

BOOL GetGroupSidFromToken | ( | HANDLE | hToken,
 |  | PSID * | ppSid
 | ) |  |

Definition at line 92 of file Util.Cpp.

{
  TOKEN_PRIMARY_GROUP *pGroup = NULL;
  PSID psidGroup = NULL;
  DWORD cbSid;
  DWORD cbRequired;

  if (GetTokenInformation (hToken, TokenPrimaryGroup, NULL, 0, &cbRequired))
    return(FALSE);  // something's really screwy

  if (ERROR_INSUFFICIENT_BUFFER != GetLastError ())
    return(FALSE);

  if (!UtilAllocMem ((PVOID*)&pGroup, cbRequired))
    return(FALSE);

  __try  {
    if (!GetTokenInformation (hToken, TokenPrimaryGroup, pGroup,
        cbRequired, &cbRequired))
      return(FALSE);

    // Need a buffer with just the SID, so allocate and copy
    cbSid = GetLengthSid (pGroup->PrimaryGroup);
    if (!UtilAllocMem ((PVOID*)&psidGroup, cbSid))
      return(FALSE);

    if (!CopySid (cbSid, psidGroup, pGroup->PrimaryGroup))
      return(FALSE);

    *ppSid = psidGroup;
    psidGroup = NULL; // so we don't free the sid

    return(TRUE);
  } __finally  {
    UtilFreeMem (psidGroup);
    UtilFreeMem (pGroup);
  }
  return FALSE;
}

BOOL GetUserSidFromToken | ( | HANDLE | hToken,
 |  | PSID * | ppSid
 | ) |  |

Definition at line 48 of file Util.Cpp.

{
  TOKEN_USER *pUser = NULL;
  PSID psidUser = NULL;
  DWORD cbSid;
  DWORD cbRequired;

  if (GetTokenInformation (hToken, TokenUser, NULL, 0, &cbRequired))
    return(FALSE);  // we shouldn't succeed without a buffer...

  if (ERROR_INSUFFICIENT_BUFFER != GetLastError ())
    return(FALSE);

  if (!UtilAllocMem ((PVOID*)&pUser, cbRequired))
    return(FALSE);

  __try  {
    if (!GetTokenInformation (hToken, TokenUser, pUser, cbRequired,
        &cbRequired))
      return(FALSE);

    // Need a buffer with just the SID, so allocate and copy
    cbSid = GetLengthSid (pUser->User.Sid);
    if (!UtilAllocMem ((PVOID*)&psidUser, cbSid))
      return(FALSE);

    if (!CopySid (cbSid, psidUser, pUser->User.Sid))
      return(FALSE);

    *ppSid = psidUser;
    psidUser = NULL;  // so we don't free the sid

    return(TRUE);
  } __finally  {
    UtilFreeMem (psidUser);
    UtilFreeMem (pUser);
  }
  return FALSE;
}

BOOL UtilAllocMem | ( | PVOID * | ppv,
 |  | DWORD | cb
 | ) |  |

Definition at line 29 of file Util.Cpp.

{
  *ppv = malloc (cb);
  return (NULL != *ppv);
}

void UtilFreeMem ( PVOID pv )

Definition at line 38 of file Util.Cpp.

{
  if (NULL != pv)
    free (pv);
}

Generated on Wed Nov 13 2024 16:53:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/OleImp/Util.h File Reference

  • Com
  • Fundamentals
  • DCom
  • OleImp
Functions

Util.h File Reference

Go to the source code of this file.

Functions

BOOL | CreateAppSecurityDescriptor (PSECURITY_DESCRIPTOR *ppsd)
void | ErrorMessage (HWND hwnd, LPCTSTR szFunction, HRESULT hr)
BOOL | FreeAppSecurityDescriptor (PSECURITY_DESCRIPTOR psd)
BOOL | GetGroupSidFromToken (HANDLE hToken, PSID *ppSid)
BOOL | GetUserSidFromToken (HANDLE hToken, PSID *ppSid)
BOOL | UtilAllocMem (PVOID *ppv, DWORD cb)
void | UtilFreeMem (PVOID pv)

Function Documentation

BOOL CreateAppSecurityDescriptor ( PSECURITY_DESCRIPTOR * ppsd )

Definition at line 139 of file Util.Cpp.

{
  PSECURITY_DESCRIPTOR psd = NULL;
  PSID psidUser = NULL, psidGroup = NULL;
  HANDLE hToken;
  GENERIC_MAPPING gm =  {1, 2, 4, 8}; // dummy GM for AccessCheck
  DWORD dwDesired = 1;  // MUST be a value from GM
  BOOL fAccess = FALSE;
  DWORD dwGranted;
  PRIVILEGE_SET ps;
  DWORD cbPriv = sizeof (ps);

  // allocate the security descriptor
  if (!UtilAllocMem ((PVOID*)&psd, SECURITY_DESCRIPTOR_MIN_LENGTH))
    return(FALSE);

  // we have to impersonate ourselves for the AccessCheck later
  if (!ImpersonateSelf(SecurityImpersonation))
    return(FALSE);

  __try  {

    if (!InitializeSecurityDescriptor(psd, SECURITY_DESCRIPTOR_REVISION))
      return(FALSE);

    // give it a NULL DACL -- allow all access
    if (!SetSecurityDescriptorDacl (psd, TRUE, NULL, FALSE))
      return(FALSE);

    // open the token to get the user and group for the new SD
    if (!OpenThreadToken (GetCurrentThread(), TOKEN_QUERY, TRUE, &hToken))
      return(FALSE);

    // set the SD owner
    if (!GetUserSidFromToken(hToken, &psidUser))
      return(FALSE);
    if (!SetSecurityDescriptorOwner(psd, psidUser, FALSE))
      return(FALSE);

    // set the SD group
    if (!GetGroupSidFromToken(hToken, &psidGroup))
      return(FALSE);
    if (!SetSecurityDescriptorGroup(psd, psidGroup, FALSE))
      return(FALSE);

    // use AccessCheck to verify that we have a good SD
    // using dummy values since we don't really have anything to check
    if (!AccessCheck(psd, hToken, dwDesired, &gm, &ps, &cbPriv,
        &dwGranted, &fAccess))
      return(FALSE);

    *ppsd = psd;
    psd = NULL;     //
    psidUser = NULL;  // don't free these...
    psidGroup = NULL; //

    return(TRUE);

  } __finally  {
    UtilFreeMem (psd);
    UtilFreeMem (psidUser);
    UtilFreeMem (psidGroup);
    RevertToSelf ();
  }
  return FALSE;
}

void ErrorMessage | ( | HWND | hwnd,
 |  | LPCTSTR | szFunction,
 |  | HRESULT | hr
 | ) |  |

Definition at line 231 of file Util.Cpp.

{
  LPTSTR   szMessage;

  if (HRESULT_FACILITY(hr) == FACILITY_WINDOWS)
    hr = HRESULT_CODE(hr);

  if (!FormatMessage(
      FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
      NULL, hr,
      MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), //The user default
      (LPTSTR)&szMessage, 0, NULL))
    return;

  if (hwnd == NULL)
    {
    OutputDebugString(szFunction);
    OutputDebugString(TEXT(": "));
    OutputDebugString(szMessage);
    OutputDebugString(TEXT("\n"));
    }
  else
    MessageBox(hwnd, szMessage, szFunction, MB_OK);

  LocalFree(szMessage);
}  // ErrorMessage

BOOL FreeAppSecurityDescriptor ( PSECURITY_DESCRIPTOR psd )

Definition at line 210 of file Util.Cpp.

{
  PSID psid;
  BOOL fDefaulted;

  if (!GetSecurityDescriptorOwner(psd, &psid, &fDefaulted))
    return(FALSE);
  UtilFreeMem (psid);

  if (!GetSecurityDescriptorGroup(psd, &psid, &fDefaulted))
    return(FALSE);
  UtilFreeMem (psid);

  UtilFreeMem (psd);

  return(TRUE);
}

BOOL GetGroupSidFromToken | ( | HANDLE | hToken,
 |  | PSID * | ppSid
 | ) |  |

Definition at line 92 of file Util.Cpp.

{
  TOKEN_PRIMARY_GROUP *pGroup = NULL;
  PSID psidGroup = NULL;
  DWORD cbSid;
  DWORD cbRequired;

  if (GetTokenInformation (hToken, TokenPrimaryGroup, NULL, 0, &cbRequired))
    return(FALSE);  // something's really screwy

  if (ERROR_INSUFFICIENT_BUFFER != GetLastError ())
    return(FALSE);

  if (!UtilAllocMem ((PVOID*)&pGroup, cbRequired))
    return(FALSE);

  __try  {
    if (!GetTokenInformation (hToken, TokenPrimaryGroup, pGroup,
        cbRequired, &cbRequired))
      return(FALSE);

    // Need a buffer with just the SID, so allocate and copy
    cbSid = GetLengthSid (pGroup->PrimaryGroup);
    if (!UtilAllocMem ((PVOID*)&psidGroup, cbSid))
      return(FALSE);

    if (!CopySid (cbSid, psidGroup, pGroup->PrimaryGroup))
      return(FALSE);

    *ppSid = psidGroup;
    psidGroup = NULL; // so we don't free the sid

    return(TRUE);
  } __finally  {
    UtilFreeMem (psidGroup);
    UtilFreeMem (pGroup);
  }
  return FALSE;
}

BOOL GetUserSidFromToken | ( | HANDLE | hToken,
 |  | PSID * | ppSid
 | ) |  |

Definition at line 48 of file Util.Cpp.

{
  TOKEN_USER *pUser = NULL;
  PSID psidUser = NULL;
  DWORD cbSid;
  DWORD cbRequired;

  if (GetTokenInformation (hToken, TokenUser, NULL, 0, &cbRequired))
    return(FALSE);  // we shouldn't succeed without a buffer...

  if (ERROR_INSUFFICIENT_BUFFER != GetLastError ())
    return(FALSE);

  if (!UtilAllocMem ((PVOID*)&pUser, cbRequired))
    return(FALSE);

  __try  {
    if (!GetTokenInformation (hToken, TokenUser, pUser, cbRequired,
        &cbRequired))
      return(FALSE);

    // Need a buffer with just the SID, so allocate and copy
    cbSid = GetLengthSid (pUser->User.Sid);
    if (!UtilAllocMem ((PVOID*)&psidUser, cbSid))
      return(FALSE);

    if (!CopySid (cbSid, psidUser, pUser->User.Sid))
      return(FALSE);

    *ppSid = psidUser;
    psidUser = NULL;  // so we don't free the sid

    return(TRUE);
  } __finally  {
    UtilFreeMem (psidUser);
    UtilFreeMem (pUser);
  }
  return FALSE;
}

BOOL UtilAllocMem | ( | PVOID * | ppv,
 |  | DWORD | cb
 | ) |  |

Definition at line 29 of file Util.Cpp.

{
  *ppv = malloc (cb);
  return (NULL != *ppv);
}

void UtilFreeMem ( PVOID pv )

Definition at line 38 of file Util.Cpp.

{
  if (NULL != pv)
    free (pv);
}

Generated on Wed Nov 13 2024 16:53:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/Secure/myProp.Idl File Reference

  • Com
  • Fundamentals
  • DCom
  • Secure
Functions | Variables

myProp.Idl File Reference

Go to the source code of this file.

Functions

cpp_quote ("DEFINE_GUID(CLSID_SecureObject, 0x28f64ee0, 0x4656, 0x11cf, 0x81, 0x10, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);") cpp_quote("DEFINE_GUID(CLSID_SecureObjectService
cpp_quote ("DEFINE_GUID(IID_IMyProperties, 0x28f64ee1, 0x4656, 0x11cf, 0x81, 0x10, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);")[object
uuid (28f64ee1-4656-11cf-8110-00aa00389b71)] interface IMyProperties

Variables

import unknwn idl

Function Documentation

cpp_quote ( "DEFINE_GUID(CLSID_SecureObject, 0x28f64ee0, 0x4656, 0x11cf, 0x81, 0x10, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);" )
cpp_quote ( "DEFINE_GUID(IID_IMyProperties, 0x28f64ee1, 0x4656, 0x11cf, 0x81, 0x10, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);" )
uuid ( 28f64ee1-4656-11cf-8110- 00aa00389b71 )

Definition at line 22 of file myProp.Idl.

                        : IUnknown
{
  typedef [unique] IMyProperties* LPMYPROPERTIES;

  HRESULT GetColor
  (
    [out] COLORREF* pcr
  );
  HRESULT PutColor
  (
    [in] COLORREF cr
  );
  HRESULT GetUserName
  (
    [in, out] WCHAR szUserName[20]
  );
  HRESULT PutUserName
  (
    [in] WCHAR szUserName[20]
  );
}

Variable Documentation

import unknwn idl

Definition at line 13 of file myProp.Idl.

Generated on Wed Nov 13 2024 16:53:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/Secure/Resource.h File Reference

  • Com
  • Fundamentals
  • DCom
  • Secure
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_CHOOSECOLOR 1004
#define | IDC_COLOR 1003
#define | IDC_COLORTEXT 1005

Define Documentation

#define IDC_CHOOSECOLOR 1004

Definition at line 6 of file Resource.h.

#define IDC_COLOR 1003

Definition at line 5 of file Resource.h.

#define IDC_COLORTEXT 1005

Definition at line 7 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/Secure/secClnt.Cpp File Reference

  • Com
  • Fundamentals
  • DCom
  • Secure
Classes | Defines | Typedefs | Functions | Variables

secClnt.Cpp File Reference

#include <windows.h>
#include <initguid.h>
#include "myprop.h"
#include <rpcdce.h>
#include "secclnt.h"

Go to the source code of this file.

Classes

struct | tagENTRY

Defines

#define | cAuthnEntries RGSIZEOF(rgAuthnEntries)
#define | cAuthnLevelEntries RGSIZEOF(rgAuthnLevelEntries)
#define | cAuthzEntries RGSIZEOF(rgAuthzEntries)
#define | cImpLevelEntries RGSIZEOF(rgImpLevelEntries)
#define | cServerEntries RGSIZEOF(rgServerEntries)
#define | ENTRY(sz, val) { sz, val }
#define | INC_OLE2
#define | RGSIZEOF(rg) (sizeof(rg)/sizeof((rg)[0]))
#define | UNICODE

Typedefs

typedef struct tagENTRY | ENTRY
typedef struct tagENTRY * | PENTRY

Functions

BOOL CALLBACK | ClientDialogProc (HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
void | ErrorMessage (HWND hwnd, LPTSTR szFunction, HRESULT hr)
DWORD | GetField (HWND hwndDlg, UINT idItem)
void | SelectEntry (HWND hwnd, ENTRY *rgEntries, int cEntries, DWORD dwVal)
void | UpdatePropertyFields (HWND hwndDlg, LPMYPROPERTIES pmp)
void | UpdateSecurityFields (HWND hwndDlg, LPUNKNOWN punk, BOOL fSet)
int WINAPI | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow)

Variables

ENTRY rgAuthnEntries []
ENTRY rgAuthnLevelEntries []
ENTRY rgAuthzEntries []
ENTRY rgImpLevelEntries []
ENTRY rgServerEntries []
COLORREF | s_crCurrent
HBRUSH | s_hbrCurrent = NULL

Define Documentation

#define cAuthnEntries RGSIZEOF(rgAuthnEntries)

Definition at line 75 of file secClnt.Cpp.

#define cAuthnLevelEntries RGSIZEOF(rgAuthnLevelEntries)

Definition at line 72 of file secClnt.Cpp.

#define cAuthzEntries RGSIZEOF(rgAuthzEntries)

Definition at line 73 of file secClnt.Cpp.

#define cImpLevelEntries RGSIZEOF(rgImpLevelEntries)

Definition at line 74 of file secClnt.Cpp.

#define cServerEntries RGSIZEOF(rgServerEntries)

Definition at line 71 of file secClnt.Cpp.

#define ENTRY | ( | sz,
 |  | val |
 | ) |  | { sz, val }

Definition at line 67 of file secClnt.Cpp.

#define INC_OLE2

Definition at line 58 of file secClnt.Cpp.

#define RGSIZEOF ( rg ) (sizeof(rg)/sizeof((rg)[0]))

Definition at line 68 of file secClnt.Cpp.

#define UNICODE

Definition at line 59 of file secClnt.Cpp.

Typedef Documentation

typedef struct tagENTRY ENTRY
typedef struct tagENTRY * PENTRY

Function Documentation

BOOL CALLBACK ClientDialogProc | ( | HWND | hwndDlg,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 279 of file secClnt.Cpp.

{
    static BOOL s_fInitialized = FALSE;
    static LPMYPROPERTIES s_pmp = NULL;
    static COLORREF s_rgcrCustom[16];
    HRESULT     hr;

    switch (message)
        {
        case WM_INITDIALOG:
            {
            HWND    hwnd1, hwnd2;
            int     i, cxScreen, cyScreen;
            RECT    rcDlg;

            cxScreen = GetSystemMetrics(SM_CXFULLSCREEN);
            cyScreen = GetSystemMetrics(SM_CYFULLSCREEN);

            GetWindowRect(hwndDlg, &rcDlg);
            OffsetRect(&rcDlg,
                (cxScreen - rcDlg.right - rcDlg.left)/2,
                (cyScreen - rcDlg.bottom - rcDlg.top)/2);

            MoveWindow(hwndDlg, rcDlg.left, rcDlg.top,
                rcDlg.right-rcDlg.left, rcDlg.bottom-rcDlg.top, TRUE);

            // build the list of servers, select the Remote Server by default
            hwnd1 = GetDlgItem(hwndDlg, IDC_SERVER_CLASS);
            for (i=0; i<cServerEntries; i++)
                {
                SendMessage(hwnd1, CB_INSERTSTRING, i, (LPARAM)rgServerEntries[i].szName);
                SendMessage(hwnd1, CB_SETITEMDATA, i, rgServerEntries[i].dwVal);
                }
            SendMessage(hwnd1, CB_SETCURSEL, 0, 0);

            // build the lists of authentication levels. choose None for the
            // process default. the proxy setting will be retrieved via CoQueryProxyBlanket
            // once the object is instantiated
            hwnd1 = GetDlgItem(hwndDlg, IDC_CLIENT_AUTHNLEVEL);
            hwnd2 = GetDlgItem(hwndDlg, IDC_PROXY_AUTHNLEVEL);
            for (i=0; i<cAuthnLevelEntries; i++)
                {
                SendMessage(hwnd1, CB_INSERTSTRING, i, (LPARAM)rgAuthnLevelEntries[i].szName);
                SendMessage(hwnd1, CB_SETITEMDATA, i, rgAuthnLevelEntries[i].dwVal);
                SendMessage(hwnd2, CB_INSERTSTRING, i, (LPARAM)rgAuthnLevelEntries[i].szName);
                SendMessage(hwnd2, CB_SETITEMDATA, i, rgAuthnLevelEntries[i].dwVal);
                }
            SelectEntry(hwnd1, rgAuthnLevelEntries, cAuthnLevelEntries, RPC_C_AUTHN_LEVEL_NONE);

            // build the lists of impersonation levels. choose Anonymous for the
            // process default. the proxy setting will be retrieved via CoQueryProxyBlanket
            // once the object is instantiated
            hwnd1 = GetDlgItem(hwndDlg, IDC_CLIENT_IMPLEVEL);
            hwnd2 = GetDlgItem(hwndDlg, IDC_PROXY_IMPLEVEL);
            for (i=0; i<cImpLevelEntries; i++)
                {
                SendMessage(hwnd1, CB_INSERTSTRING, i, (LPARAM)rgImpLevelEntries[i].szName);
                SendMessage(hwnd1, CB_SETITEMDATA, i, rgImpLevelEntries[i].dwVal);
                SendMessage(hwnd2, CB_INSERTSTRING, i, (LPARAM)rgImpLevelEntries[i].szName);
                SendMessage(hwnd2, CB_SETITEMDATA, i, rgImpLevelEntries[i].dwVal);
                }
            SelectEntry(hwnd1, rgImpLevelEntries, cImpLevelEntries, RPC_C_IMP_LEVEL_ANONYMOUS);

            // build the list of authorization services. the actual setting will
            // be retrieved via CoQueryProxyBlanket once the object is instantiated,
            // and can be modified after that.
            hwnd1 = GetDlgItem(hwndDlg, IDC_PROXY_AUTHZ);
            for (i=0; i<cAuthzEntries; i++)
                {
                SendMessage(hwnd1, CB_INSERTSTRING, i, (LPARAM)rgAuthzEntries[i].szName);
                SendMessage(hwnd1, CB_SETITEMDATA, i, rgAuthzEntries[i].dwVal);
                }

            // build the list of authentication services. the actual setting will
            // be retrieved via CoQueryProxyBlanket once the object is instantiated,
            // and can be modified after that.
            hwnd1 = GetDlgItem(hwndDlg, IDC_PROXY_AUTHN);
            for (i=0; i<cAuthnEntries; i++)
                {
                SendMessage(hwnd1, CB_INSERTSTRING, i, (LPARAM)rgAuthnEntries[i].szName);
                SendMessage(hwnd1, CB_SETITEMDATA, i, rgAuthnEntries[i].dwVal);
                }
            return 1;
            }

        case WM_SYSCOMMAND:
            if (wParam == SC_CLOSE)
                goto LClose;
            break;

        case WM_COMMAND:
            if (HIWORD(wParam) == CBN_SELCHANGE && s_pmp != NULL)
                {
                UpdateSecurityFields(hwndDlg, s_pmp, TRUE);
                }
            switch (LOWORD(wParam))
                {
                case IDCANCEL:
LClose:
                    if (s_pmp != NULL)
                        {
                        s_pmp->Release();
                        s_pmp = NULL;
                        }
                    if (s_fInitialized == TRUE)
                        {
                        CoUninitialize();
                        s_fInitialized = FALSE;
                        }
                    if (s_hbrCurrent != NULL)
                        {
                        DeleteObject(s_hbrCurrent);
                        s_hbrCurrent = NULL;
                        }
                    EndDialog(hwndDlg, 0);
                    break;

                case IDC_INITIALIZE:
                    hr = CoInitialize(NULL);
                    if (FAILED(hr))
                        {
                        ErrorMessage(hwndDlg, TEXT("CoInitialize"), hr);
                        }
                    else
                        {
                        hr = CoInitializeSecurity(NULL,
                            -1,
                            NULL,
                            NULL,
                            GetField(hwndDlg, IDC_CLIENT_AUTHNLEVEL),
                            GetField(hwndDlg, IDC_CLIENT_IMPLEVEL),
                            NULL,
                            0,
                            NULL);
                        if (FAILED(hr))
                            {
                            ErrorMessage(hwndDlg, TEXT("CoInitializeSecurity"), hr);
                            }
                        else
                            {
                            // Disable Initialization Step (#1)
                            EnableWindow(GetDlgItem(hwndDlg, IDC_INITIALIZE), FALSE);
                            EnableWindow(GetDlgItem(hwndDlg, IDC_CLIENT_AUTHNLEVEL), FALSE);
                            EnableWindow(GetDlgItem(hwndDlg, IDC_CLIENT_IMPLEVEL), FALSE);

                            // Enable Object Creation Step (#2)
                            EnableWindow(GetDlgItem(hwndDlg, IDC_SERVER_CLASS), TRUE);
                            EnableWindow(GetDlgItem(hwndDlg, IDC_MACHINENAME), TRUE);
                            EnableWindow(GetDlgItem(hwndDlg, IDC_CREATE), TRUE);
                            s_fInitialized = TRUE;
                            }
                        }
                    break;

                case IDC_CREATE:
                    {
                    OLECHAR rgchName[MAX_PATH];
                    LPCLASSFACTORY  pcf;
                    COSERVERINFO    csi, *pcsi;
                    CLSID   *pclsid;
                    HWND    hwnd;
                    INT_PTR     iCur;

                    // retrieve the class to instantiate
                    hwnd = GetDlgItem(hwndDlg, IDC_SERVER_CLASS);
                    iCur = SendMessage(hwnd, CB_GETCURSEL, 0, 0);
                    pclsid = (LPCLSID)SendMessage(hwnd, CB_GETITEMDATA, iCur, 0);

                    // retrieve the machine name to run the server on. if this
                    // is blank or ".", instantiate locally by passing a NULL ComServerInfo
                    memset(&csi, 0, sizeof(COSERVERINFO));
                    csi.pwszName = rgchName;
                    GetWindowTextW(GetDlgItem(hwndDlg, IDC_MACHINENAME),
                        rgchName, RGSIZEOF(rgchName));
                    if (lstrlenW(rgchName) == 0 || lstrcmpiW(rgchName, L".") == 0)
                        pcsi = NULL;
                    else
                        pcsi = &csi;

                    // create the object
                    hr = CoGetClassObject(*pclsid, CLSCTX_SERVER,
                        pcsi, IID_IClassFactory, (void**)&pcf);
                    if (FAILED(hr))
                        {
                        ErrorMessage(hwndDlg, TEXT("CoGetClassObject"), hr);
                        break;
                        }
                    hr = pcf->CreateInstance(NULL, IID_IMyProperties, (void**)&s_pmp);
                    pcf->Release();
                    if (FAILED(hr))
                        {
                        ErrorMessage(hwndDlg, TEXT("IClassFactory::CreateInstance"), hr);
                        break;
                        }

                    // Allow a different instance to get created only if the Release
                    // button is pushed first
                    EnableWindow(GetDlgItem(hwndDlg, IDC_CREATE), FALSE);
                    EnableWindow(GetDlgItem(hwndDlg, IDC_SERVER_CLASS), FALSE);
                    EnableWindow(GetDlgItem(hwndDlg, IDC_MACHINENAME), FALSE);
                    EnableWindow(GetDlgItem(hwndDlg, IDC_RELEASE), TRUE);

                    // Enable manipulation of the object's properties. Allow
                    // this even if the values of the object's call-security
                    // parameters can not be determined, due to errors in
                    // UpdateSecurityFields
                    EnableWindow(GetDlgItem(hwndDlg, IDC_CHOOSECOLOR), TRUE);
                    EnableWindow(GetDlgItem(hwndDlg, IDC_USERNAME), TRUE);

                    UpdateSecurityFields(hwndDlg, s_pmp, FALSE);
                    UpdatePropertyFields(hwndDlg, s_pmp);
                    break;
                    }

                case IDC_RELEASE:
                    s_pmp->Release();
                    s_pmp = NULL;

                    // Disable manipulating the properties and selecting the call
                    // security parameters
                    EnableWindow(GetDlgItem(hwndDlg, IDC_CHOOSECOLOR), FALSE);
                    EnableWindow(GetDlgItem(hwndDlg, IDC_USERNAME), FALSE);
                    EnableWindow(GetDlgItem(hwndDlg, IDC_PROXY_AUTHN), FALSE);
                    EnableWindow(GetDlgItem(hwndDlg, IDC_PROXY_AUTHN), FALSE);
                    EnableWindow(GetDlgItem(hwndDlg, IDC_PROXY_AUTHNLEVEL), FALSE);
                    EnableWindow(GetDlgItem(hwndDlg, IDC_PROXY_IMPLEVEL), FALSE);

                    // Enable a new object to be created
                    EnableWindow(GetDlgItem(hwndDlg, IDC_RELEASE), FALSE);
                    EnableWindow(GetDlgItem(hwndDlg, IDC_CREATE), TRUE);
                    EnableWindow(GetDlgItem(hwndDlg, IDC_SERVER_CLASS), TRUE);
                    EnableWindow(GetDlgItem(hwndDlg, IDC_MACHINENAME), TRUE);
                    break;

                case IDC_CHOOSECOLOR:
                    {
                    CHOOSECOLOR cc;

                    cc.lStructSize = sizeof(CHOOSECOLOR);
                    cc.hwndOwner = hwndDlg;
                    cc.rgbResult = s_crCurrent;
                    cc.lpCustColors = s_rgcrCustom;
                    cc.Flags = CC_RGBINIT | CC_SHOWHELP;

                    if (ChooseColor(&cc))
                        {
                        hr = s_pmp->PutColor(cc.rgbResult);
                        if (FAILED(hr))
                            {
                            ErrorMessage(hwndDlg, TEXT("Put Color"), hr);
                            }
                        else
                            {
                            UpdatePropertyFields(hwndDlg, s_pmp);
                            }
                        }
                    break;
                    }

                case IDC_USERNAME:
                    {
                    static s_fDirty = FALSE;

                    if (HIWORD(wParam) == EN_CHANGE)
                        {
                        s_fDirty = TRUE;
                        }
                    else if (HIWORD(wParam) == EN_KILLFOCUS && s_fDirty)
                        {
                        WCHAR   rgchUserName[20];

                        GetWindowTextW(GetDlgItem(hwndDlg, IDC_USERNAME), rgchUserName, 20);
                        hr = s_pmp->PutUserName(rgchUserName);
                        if (FAILED(hr))
                            ErrorMessage(hwndDlg, TEXT("Put User Name"), hr);
                        UpdatePropertyFields(hwndDlg, s_pmp);
                        s_fDirty = FALSE;
                        }
                    break;
                    }
                }
            break;

        case WM_DRAWITEM:
            {
            LPDRAWITEMSTRUCT lpdis = (LPDRAWITEMSTRUCT)lParam;

            FillRect(lpdis->hDC, &lpdis->rcItem,
                s_hbrCurrent != NULL ? s_hbrCurrent : (HBRUSH)GetStockObject(WHITE_BRUSH));
            FrameRect(lpdis->hDC, &lpdis->rcItem, (HBRUSH)GetStockObject(BLACK_BRUSH));
            if (lpdis->itemState & ODS_SELECTED)
                InvertRect(lpdis->hDC, (LPRECT)&lpdis->rcItem);
            if (lpdis->itemState & ODS_FOCUS)
                DrawFocusRect(lpdis->hDC, (LPRECT) &lpdis->rcItem);
            return TRUE;
            }
        }
    return FALSE;
}  // ClientDialogProc

void ErrorMessage | ( | HWND | hwnd,
 |  | LPTSTR | szFunction,
 |  | HRESULT | hr
 | ) |  |

Definition at line 127 of file secClnt.Cpp.

{
    LPTSTR   szMessage;

    if (HRESULT_FACILITY(hr) == FACILITY_WINDOWS)
        hr = HRESULT_CODE(hr);

    FormatMessage(
        FORMAT_MESSAGE_ALLOCATE_BUFFER |
        FORMAT_MESSAGE_FROM_SYSTEM,
        NULL,
        hr,
        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), //The user default language
        (LPTSTR)&szMessage,
        0,
        NULL );

    MessageBox(hwnd, szMessage, szFunction, MB_OK);

    LocalFree(szMessage);
}  // ErrorMessage

DWORD GetField | ( | HWND | hwndDlg,
 |  | UINT | idItem
 | ) |  |

Definition at line 169 of file secClnt.Cpp.

{
    HWND    hwnd;
    INT_PTR iCur;

    hwnd = GetDlgItem(hwndDlg, idItem);
    iCur = SendMessage(hwnd, CB_GETCURSEL, 0, 0);
    return (DWORD) SendMessage(hwnd, CB_GETITEMDATA, iCur, 0);
}  // GetField

void SelectEntry | ( | HWND | hwnd,
 |  | ENTRY * | rgEntries,
 |  | int | cEntries,
 |  | DWORD | dwVal
 | ) |  |

Definition at line 153 of file secClnt.Cpp.

{
    for (int i=0; i<cEntries; i++)
        {
        if (rgEntries[i].dwVal == dwVal)
            {
            SendMessage(hwnd, CB_SETCURSEL, i, 0);
            return;
            }
        }
}  // SelectEntry

void UpdatePropertyFields | ( | HWND | hwndDlg,
 |  | LPMYPROPERTIES | pmp
 | ) |  |

Definition at line 244 of file secClnt.Cpp.

{
    COLORREF    cr;
    WCHAR       rgchUserName[20];
    HRESULT     hr;

    hr = pmp->GetColor(&cr);
    if (FAILED(hr))
        {
        ErrorMessage(hwndDlg, TEXT("Get Color"), hr);
        }
    else
        {
        s_crCurrent = cr;
        if (s_hbrCurrent != NULL)
            DeleteObject(s_hbrCurrent);
        s_hbrCurrent = CreateSolidBrush(s_crCurrent);
        InvalidateRect(GetDlgItem(hwndDlg, IDC_COLOR), NULL, TRUE);
        }

    hr = pmp->GetUserName(rgchUserName);
    if (FAILED(hr))
        {
        ErrorMessage(hwndDlg, TEXT("Get User Name"), hr);
        }
    else
        {
        SetWindowTextW(GetDlgItem(hwndDlg, IDC_USERNAME), rgchUserName);
        }
}  // UpdatePropertyFields

void UpdateSecurityFields | ( | HWND | hwndDlg,
 |  | LPUNKNOWN | punk,
 |  | BOOL | fSet
 | ) |  |

Definition at line 183 of file secClnt.Cpp.

{
    HWND    hwnd;
    DWORD   dwAuthn, dwAuthz, dwAuthnLevel, dwImpLevel;
    LPOLESTR wszPrinciple;
    HRESULT hr;

    // in response to a CBN_SELCHANGE, we try to set the new proxy
    // security parameters first
    if (fSet)
        {
        hr = CoSetProxyBlanket(punk,
            GetField(hwndDlg, IDC_PROXY_AUTHN),
            GetField(hwndDlg, IDC_PROXY_AUTHZ),
            NULL,
            GetField(hwndDlg, IDC_PROXY_AUTHNLEVEL),
            GetField(hwndDlg, IDC_PROXY_IMPLEVEL),
            NULL,
            NULL);
        if (FAILED(hr))
            {
            ErrorMessage(hwndDlg, TEXT("CoSetProxyBlanket"), hr);
            }
        }

    // in all cases, update the fields to reflect the actual state of
    // security on the proxy
    hr = CoQueryProxyBlanket(punk,
        &dwAuthn, &dwAuthz, &wszPrinciple, &dwAuthnLevel, &dwImpLevel,
        NULL, NULL);
    if (FAILED(hr))
        {
        ErrorMessage(hwndDlg, TEXT("CoQueryProxyBlanket"), hr);
        }
    else
        {
        hwnd = GetDlgItem(hwndDlg, IDC_PROXY_AUTHN);
        EnableWindow(hwnd, TRUE);
        SelectEntry(hwnd, rgAuthnEntries, cAuthnEntries, dwAuthn);

        hwnd = GetDlgItem(hwndDlg, IDC_PROXY_AUTHZ);
        EnableWindow(hwnd, TRUE);
        SelectEntry(hwnd, rgAuthzEntries, cAuthzEntries, dwAuthz);

        hwnd = GetDlgItem(hwndDlg, IDC_PROXY_AUTHNLEVEL);
        EnableWindow(hwnd, TRUE);
        SelectEntry(hwnd, rgAuthnLevelEntries, cAuthnLevelEntries, dwAuthnLevel);

        hwnd = GetDlgItem(hwndDlg, IDC_PROXY_IMPLEVEL);
        EnableWindow(hwnd, TRUE);
        SelectEntry(hwnd, rgImpLevelEntries, cImpLevelEntries, dwImpLevel);

        SetWindowTextW(GetDlgItem(hwndDlg, IDC_PROXY_PRINCIPLENAME),
            wszPrinciple);
        }
}  // UpdateSecurityFields

int WINAPI WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpszCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 583 of file secClnt.Cpp.

{
    return (int) DialogBox(hInstance, MAKEINTRESOURCE(IDD_SECCLNT), GetDesktopWindow(), (DLGPROC)ClientDialogProc);
}  // WinMain

Variable Documentation

ENTRY rgAuthnEntries[]
Initial value:
 {
    ENTRY(TEXT("None       "), RPC_C_AUTHN_NONE),
    ENTRY(TEXT("DCE Private"), RPC_C_AUTHN_DCE_PRIVATE),
    ENTRY(TEXT("DCE Public "), RPC_C_AUTHN_DCE_PUBLIC),
    ENTRY(TEXT("DEC Public "), RPC_C_AUTHN_DEC_PUBLIC),
    ENTRY(TEXT("Windows NT "), RPC_C_AUTHN_WINNT),
    ENTRY(TEXT("Default    "), RPC_C_AUTHN_DEFAULT),
    }

Definition at line 114 of file secClnt.Cpp.

ENTRY rgAuthnLevelEntries[]
Initial value:
 {
    ENTRY(TEXT("Default    "), RPC_C_AUTHN_DEFAULT),
    ENTRY(TEXT("None       "), RPC_C_AUTHN_LEVEL_NONE),
    ENTRY(TEXT("Connect    "), RPC_C_AUTHN_LEVEL_CONNECT),
    ENTRY(TEXT("Call       "), RPC_C_AUTHN_LEVEL_CALL),
    ENTRY(TEXT("Packet     "), RPC_C_AUTHN_LEVEL_PKT),
    ENTRY(TEXT("Integrity  "), RPC_C_AUTHN_LEVEL_PKT_INTEGRITY),
    ENTRY(TEXT("Privacy    "), RPC_C_AUTHN_LEVEL_PKT_PRIVACY),
    }

Definition at line 92 of file secClnt.Cpp.

ENTRY rgAuthzEntries[]
Initial value:
 {
    ENTRY(TEXT("None       "), RPC_C_AUTHZ_NONE),
    ENTRY(TEXT("Name       "), RPC_C_AUTHZ_NAME),
    ENTRY(TEXT("DCE        "), RPC_C_AUTHZ_DCE),
    }

Definition at line 101 of file secClnt.Cpp.

ENTRY rgImpLevelEntries[]
Initial value:
 {
    ENTRY(TEXT("Anonymous  "), RPC_C_IMP_LEVEL_ANONYMOUS),
    ENTRY(TEXT("Identify   "), RPC_C_IMP_LEVEL_IDENTIFY),
    ENTRY(TEXT("Impersonate"), RPC_C_IMP_LEVEL_IMPERSONATE),
    ENTRY(TEXT("Delegate   "), RPC_C_IMP_LEVEL_DELEGATE),
    }

Definition at line 107 of file secClnt.Cpp.

ENTRY rgServerEntries[]
Initial value:
 {
    ENTRY(TEXT("Secure Object"), (DWORD)(LPVOID)&CLSID_SecureObject),
    ENTRY(TEXT("Secure Object Service"), (DWORD)(LPVOID)&CLSID_SecureObjectService),
    }

Definition at line 87 of file secClnt.Cpp.

COLORREF s_crCurrent

Definition at line 84 of file secClnt.Cpp.

HBRUSH s_hbrCurrent = NULL

Definition at line 85 of file secClnt.Cpp.

Generated on Wed Nov 13 2024 16:53:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/Secure/secClnt.h File Reference

  • Com
  • Fundamentals
  • DCom
  • Secure
Defines

secClnt.h File Reference

Go to the source code of this file.

Defines

#define | IDC_CHOOSECOLOR 1011
#define | IDC_CLIENT_AUTHNLEVEL 1007
#define | IDC_CLIENT_IMPLEVEL 1008
#define | IDC_COLOR 1017
#define | IDC_COMBO1 1016
#define | IDC_CREATE 1001
#define | IDC_INITIALIZE 1005
#define | IDC_MACHINENAME 1000
#define | IDC_PROXY_AUTHN 1014
#define | IDC_PROXY_AUTHNLEVEL 1003
#define | IDC_PROXY_AUTHZ 1015
#define | IDC_PROXY_IMPLEVEL 1004
#define | IDC_PROXY_PRINCIPLENAME 1010
#define | IDC_RELEASE 1002
#define | IDC_SERVER_CLASS 1009
#define | IDC_USERNAME 1013
#define | IDD_SECCLNT 101

Define Documentation

#define IDC_CHOOSECOLOR 1011

Definition at line 16 of file secClnt.h.

#define IDC_CLIENT_AUTHNLEVEL 1007

Definition at line 12 of file secClnt.h.

#define IDC_CLIENT_IMPLEVEL 1008

Definition at line 13 of file secClnt.h.

#define IDC_COLOR 1017

Definition at line 21 of file secClnt.h.

#define IDC_COMBO1 1016

Definition at line 20 of file secClnt.h.

#define IDC_CREATE 1001

Definition at line 7 of file secClnt.h.

#define IDC_INITIALIZE 1005

Definition at line 11 of file secClnt.h.

#define IDC_MACHINENAME 1000

Definition at line 6 of file secClnt.h.

#define IDC_PROXY_AUTHN 1014

Definition at line 18 of file secClnt.h.

#define IDC_PROXY_AUTHNLEVEL 1003

Definition at line 9 of file secClnt.h.

#define IDC_PROXY_AUTHZ 1015

Definition at line 19 of file secClnt.h.

#define IDC_PROXY_IMPLEVEL 1004

Definition at line 10 of file secClnt.h.

#define IDC_PROXY_PRINCIPLENAME 1010

Definition at line 15 of file secClnt.h.

#define IDC_RELEASE 1002

Definition at line 8 of file secClnt.h.

#define IDC_SERVER_CLASS 1009

Definition at line 14 of file secClnt.h.

#define IDC_USERNAME 1013

Definition at line 17 of file secClnt.h.

#define IDD_SECCLNT 101

Definition at line 5 of file secClnt.h.

Generated on Wed Nov 13 2024 16:53:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/Secure/secSvr.Cpp File Reference

  • Com
  • Fundamentals
  • DCom
  • Secure
Classes | Defines | Typedefs | Functions | Variables

secSvr.Cpp File Reference

#include <windows.h>
#include <initguid.h>
#include "myprop.h"
#include "secsvr.h"

Go to the source code of this file.

Classes

class | CClassFactory
class | CSecureObject
struct | tagENTRY

Defines

#define | cAuthnLevelEntries RGSIZEOF(rgAuthnLevelEntries)
#define | cImpLevelEntries RGSIZEOF(rgImpLevelEntries)
#define | ENTRY(sz, val) { sz, val }
#define | INC_OLE2
#define | RGSIZEOF(rg) (sizeof(rg)/sizeof((rg)[0]))
#define | STRICT
#define | UNICODE

Typedefs

typedef struct tagENTRY | ENTRY
typedef struct tagENTRY * | PENTRY

Functions

void | ErrorMessage (HWND hwnd, LPTSTR szFunction, HRESULT hr)
BOOL | FAutoRegister (HINSTANCE hinst)
DWORD | GetField (HWND hwndDlg, UINT idItem)
void | MyServiceHandler (DWORD dwControl)
void | MyServiceMain (DWORD cArg, LPTSTR *rgszArg)
void | SelectEntry (HWND hwnd, ENTRY *rgEntries, int cEntries, DWORD dwVal)
BOOL CALLBACK | ServerDialogProc (HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
int WINAPI | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLine, int nCmdShow)

Variables

ENTRY rgAuthnLevelEntries []
ENTRY rgImpLevelEntries []
UINT s_cInstances
CClassFactory s_ClassFactory
CRITICAL_SECTION | s_csDone
BOOL s_fDone
BOOL s_fServer
BOOL s_fService
HANDLE s_hevtDone
HWND | s_hwndDlg
SERVICE_TABLE_ENTRY | s_rgsteServices [2]
struct {
DWORD dwRegister
SERVICE_STATUS_HANDLE hStatus
SERVICE_STATUS Status
} s_Service
const TCHAR | szDescription [] = TEXT("Network OLE Security Sample")
const TCHAR | szServiceName [] = TEXT("SecSvr")

Define Documentation

#define cAuthnLevelEntries RGSIZEOF(rgAuthnLevelEntries)

Definition at line 79 of file secSvr.Cpp.

#define cImpLevelEntries RGSIZEOF(rgImpLevelEntries)

Definition at line 80 of file secSvr.Cpp.

#define ENTRY | ( | sz,
 |  | val |
 | ) |  | { sz, val }

Definition at line 73 of file secSvr.Cpp.

#define INC_OLE2

Definition at line 64 of file secSvr.Cpp.

#define RGSIZEOF ( rg ) (sizeof(rg)/sizeof((rg)[0]))

Definition at line 74 of file secSvr.Cpp.

#define STRICT

Definition at line 65 of file secSvr.Cpp.

#define UNICODE

Definition at line 66 of file secSvr.Cpp.

Typedef Documentation

typedef struct tagENTRY ENTRY
typedef struct tagENTRY * PENTRY

Function Documentation

void ErrorMessage | ( | HWND | hwnd,
 |  | LPTSTR | szFunction,
 |  | HRESULT | hr
 | ) |  |

Definition at line 510 of file secSvr.Cpp.

{
    LPTSTR   szMessage;

    if (HRESULT_FACILITY(hr) == FACILITY_WINDOWS)
  hr = HRESULT_CODE(hr);

    if (!FormatMessage(
  FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
  NULL, hr,
  MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), //The user default language
  (LPTSTR)&szMessage, 0, NULL))
  return;

    if (hwnd == NULL)
  {
  OutputDebugString(szFunction);
  OutputDebugString(TEXT(": "));
  OutputDebugString(szMessage);
  OutputDebugString(TEXT("\n"));
  }
    else
  MessageBox(hwnd, szMessage, szFunction, MB_OK);

    LocalFree(szMessage);
}  // ErrorMessage

BOOL FAutoRegister ( HINSTANCE hinst )

Definition at line 409 of file secSvr.Cpp.

{
    static const TCHAR szCLSIDEntryServer[]     = TEXT("CLSID\\{28f64ee0-4656-11cf-8110-00aa00389b71}");
    static const TCHAR szLocalServer32[]        = TEXT("LocalServer32");
    static const TCHAR szAllowRemoteActivation[] = TEXT("AllowRemoteActivation");
    static const TCHAR szCLSIDEntryService[]    = TEXT("CLSID\\{28f64ee2-4656-11cf-8110-00aa00389b71}");
    static const TCHAR szLocalService[]         = TEXT("LocalService");
    static const TCHAR szServiceParameters[]    = TEXT("ServiceParameters");
    static const TCHAR szParameters[]           = TEXT("-Service");
    static const TCHAR szEmpty[]                = TEXT("");
    SC_HANDLE   hManager = NULL, hService = NULL;
    TCHAR       szPath[MAX_PATH], *szError = TEXT("Registry Manipulation");
    HKEY        hkeyT = NULL, hkey2;

    // install the CLSID_SecureObject key and get the FQP to this executable
    if ((RegSetValue(HKEY_CLASSES_ROOT, szCLSIDEntryServer, REG_SZ, szDescription,
      lstrlen(szDescription)) != ERROR_SUCCESS) ||
  (RegCreateKey(HKEY_CLASSES_ROOT, szCLSIDEntryServer, &hkeyT) != ERROR_SUCCESS) ||
  !GetModuleFileName(hinst, szPath, sizeof(szPath)/sizeof(TCHAR)))
  goto LErrExit;

    // install the LocalServer32 key and the AllowRemoteActivation key
    if ((RegSetValue(hkeyT, szLocalServer32, REG_SZ, szPath, lstrlen(szPath))
      != ERROR_SUCCESS) ||
  (RegSetValue(hkeyT, szAllowRemoteActivation, REG_SZ, szEmpty, lstrlen(szEmpty))
      != ERROR_SUCCESS))
  goto LErrExit;
    RegCloseKey(hkeyT);
    hkeyT = NULL;

    // install the CLSID_SecureObjectService key
    if ((RegSetValue(HKEY_CLASSES_ROOT, szCLSIDEntryService, REG_SZ, szDescription,
      lstrlen(szDescription)) != ERROR_SUCCESS) ||
  (RegCreateKey(HKEY_CLASSES_ROOT, szCLSIDEntryService, &hkeyT) != ERROR_SUCCESS))
  goto LErrExit;

    // install the LocalService key and the ServiceParameters named-value
    if ((RegSetValue(hkeyT, szLocalService, REG_SZ, szServiceName, lstrlen(szServiceName))
      != ERROR_SUCCESS) ||
  (RegOpenKey(hkeyT, szLocalService, &hkey2) != ERROR_SUCCESS))
  goto LErrExit;
    RegCloseKey(hkeyT);
    hkeyT = hkey2;
    if (RegSetValueEx(hkeyT, szServiceParameters, 0, REG_SZ, (const BYTE*)szParameters,
      (lstrlen(szParameters)+1) * sizeof(TCHAR)) != ERROR_SUCCESS)
  goto LErrExit;

    RegCloseKey(hkeyT);
    hkeyT = NULL;

    // install the application to run as a service
    hManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
    if (hManager == NULL)
  {
  szError = TEXT("OpenSCManager");
  goto LErrExit;
  }

    hService = OpenService(hManager, szServiceName, SERVICE_ALL_ACCESS);
    if (hService != NULL)
  {
  if (!ChangeServiceConfig(hService,
      SERVICE_WIN32_OWN_PROCESS,
      SERVICE_DEMAND_START, SERVICE_ERROR_NORMAL, szPath,
      NULL, NULL, NULL, NULL, NULL, szDescription))
      {
      szError = TEXT("ChangeServiceConfig");
      goto LErrExit;
      }
  return TRUE;
  }

    hService = CreateService(hManager, szServiceName, szDescription,
  SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS,
  SERVICE_DEMAND_START, SERVICE_ERROR_NORMAL, szPath,
  NULL, NULL, NULL,  NULL, NULL);
    if (hService == NULL)
  {
  szError = TEXT("CreateService");
  goto LErrExit;
  }

    CloseServiceHandle(hService);
    CloseServiceHandle(hManager);
    return TRUE;

LErrExit:
    ErrorMessage(GetDesktopWindow(), szError, GetLastError());
    if (hkeyT != NULL)
  RegCloseKey(hkeyT);
    if (hService != NULL)
  CloseServiceHandle(hService);
    if (hManager != NULL)
  CloseServiceHandle(hManager);
    return FALSE;
}  // FAutoRegister

DWORD GetField | ( | HWND | hwndDlg,
 |  | UINT | idItem
 | ) |  |

Definition at line 557 of file secSvr.Cpp.

{
    HWND    hwnd;
    INT_PTR iCur;

    hwnd = GetDlgItem(hwndDlg, idItem);
    iCur = SendMessage(hwnd, CB_GETCURSEL, 0, 0);
    return (DWORD) SendMessage(hwnd, CB_GETITEMDATA, iCur, 0);
}  // GetField

void MyServiceHandler ( DWORD dwControl )

Definition at line 909 of file secSvr.Cpp.

{
    switch (dwControl)
  {
  case SERVICE_CONTROL_STOP:
      s_Service.Status.dwWin32ExitCode = 0;
      s_Service.Status.dwCurrentState  = SERVICE_STOP_PENDING;
      s_Service.Status.dwCheckPoint    = 0;
      s_Service.Status.dwWaitHint      = 0;
      if (!SetServiceStatus (s_Service.hStatus, &s_Service.Status))
    ErrorMessage(NULL, TEXT("SetServiceStatus"), GetLastError());

      EnterCriticalSection(&s_csDone);

      // prevent further instances from being created in IClassFactory::CreateInstance
      s_fDone = TRUE;

      // restart the waiting MyServiceMain thread and allow it to uninitialize and exit.
      SetEvent(s_hevtDone);

      LeaveCriticalSection(&s_csDone);
      return;

  case SERVICE_CONTROL_INTERROGATE:
      // fall out and send the current status of s_Service.Status
      break;

  default:
      break;
  }

    // send current status.
    if (!SetServiceStatus(s_Service.hStatus,  &s_Service.Status))
  ErrorMessage(NULL, TEXT("SetServiceStatus"), GetLastError());

    return;
}  // MyServiceHandler

void MyServiceMain | ( | DWORD | cArg,
 |  | LPTSTR * | rgszArg
 | ) |  |

Definition at line 819 of file secSvr.Cpp.

{
    HRESULT hr;

    s_Service.Status.dwServiceType        = SERVICE_WIN32_OWN_PROCESS;
    s_Service.Status.dwCurrentState       = SERVICE_START_PENDING;
    s_Service.Status.dwControlsAccepted   = SERVICE_ACCEPT_STOP;
    s_Service.Status.dwWin32ExitCode      = 0;
    s_Service.Status.dwServiceSpecificExitCode = 0;
    s_Service.Status.dwCheckPoint         = 0;
    s_Service.Status.dwWaitHint           = 0;

    s_Service.hStatus = RegisterServiceCtrlHandler(szServiceName, MyServiceHandler);

    if (s_Service.hStatus == NULL)
  return;

    // used to gaurd the s_fDone variable that prevents new instances
    // from being created in IClassFactory::CreateInstance during shutdown
    InitializeCriticalSection(&s_csDone);

    // event used to signal the service has stopped
    s_hevtDone = CreateEvent(NULL, FALSE, FALSE, NULL);
    if (s_hevtDone == NULL)
  {
  ErrorMessage(NULL, TEXT("CreateEvent"), GetLastError());
  goto LErrExit;
  }

    hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
    if (FAILED(hr))
  {
  ErrorMessage(NULL, TEXT("CoInitialize"), hr);
  goto LErrExit;
  }

    // the Service CLSID is used here, different from the LocalServer case
    hr = CoRegisterClassObject(CLSID_SecureObjectService, &s_ClassFactory,
  CLSCTX_SERVER, REGCLS_MULTIPLEUSE, &s_Service.dwRegister);

    if (FAILED(hr))
  {
  ErrorMessage(NULL, TEXT("CoRegisterClassObject"), hr);
  CoUninitialize();
  goto LErrExit;
  }

    // Initialization complete - report running status
    s_Service.Status.dwCurrentState       = SERVICE_RUNNING;
    s_Service.Status.dwCheckPoint         = 0;
    s_Service.Status.dwWaitHint           = 0;

    // notify the service-manager that the service is running
    if (!SetServiceStatus(s_Service.hStatus, &s_Service.Status))
  ErrorMessage(NULL, TEXT("SetServiceStatus(SERVICE_RUNNING)"), GetLastError());

    // wait for the signal from MyServiceHandler:SERVICE_CONTROL_STOP
    WaitForSingleObject(s_hevtDone, INFINITE);

    CloseHandle(s_hevtDone);
    s_hevtDone = NULL;

    CoRevokeClassObject(s_Service.dwRegister);
    CoUninitialize();

    // notify the service-manager that the service has totally stopped
    s_Service.Status.dwCurrentState = SERVICE_STOPPED;
    if (!SetServiceStatus(s_Service.hStatus, &s_Service.Status))
  ErrorMessage(NULL, TEXT("SetServiceStatus(SERVICE_STOPPED)"), GetLastError());
    return;

LErrExit:
    if (s_hevtDone != NULL)
  {
  CloseHandle(s_hevtDone);
  s_hevtDone = NULL;
  }
    s_Service.Status.dwCurrentState       = SERVICE_STOPPED;
    s_Service.Status.dwCheckPoint         = 0;
    s_Service.Status.dwWaitHint           = 0;
    s_Service.Status.dwWin32ExitCode      = hr;
    s_Service.Status.dwServiceSpecificExitCode = hr;
    SetServiceStatus(s_Service.hStatus, &s_Service.Status);
    return;
}  // MyServiceMain

void SelectEntry | ( | HWND | hwnd,
 |  | ENTRY * | rgEntries,
 |  | int | cEntries,
 |  | DWORD | dwVal
 | ) |  |

Definition at line 541 of file secSvr.Cpp.

{
    for (int i=0; i<cEntries; i++)
  {
  if (rgEntries[i].dwVal == dwVal)
      {
      SendMessage(hwnd, CB_SETCURSEL, i, 0);
      return;
      }
  }
}  // SelectEntry

BOOL CALLBACK ServerDialogProc | ( | HWND | hwndDlg,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 571 of file secSvr.Cpp.

{
    static DWORD    s_dwRegister = 0;
    static BOOL     s_fInitialized = FALSE;
    static CSecureObject* s_pcso = NULL;
    static COLORREF s_rgcrCustom[16];
    static HBRUSH   s_hbrCurrent = NULL;
    HRESULT hr;

    switch (message)
  {
  case WM_INITDIALOG:
      {
      HWND    hwnd;
      int     cxScreen, cyScreen, i;
      RECT    rcDlg;

      // save the hwndDlg into a global
      s_hwndDlg = hwndDlg;

      // Center the UI on screen
      cxScreen = GetSystemMetrics(SM_CXFULLSCREEN);
      cyScreen = GetSystemMetrics(SM_CYFULLSCREEN);
      GetWindowRect(hwndDlg, &rcDlg);
      OffsetRect(&rcDlg,
    (cxScreen - rcDlg.right - rcDlg.left)/2,
    (cyScreen - rcDlg.bottom - rcDlg.top)/2);
      MoveWindow(hwndDlg, rcDlg.left, rcDlg.top,
    rcDlg.right-rcDlg.left, rcDlg.bottom-rcDlg.top, TRUE);

      // build the lists of authentication levels. choose None for the
      // process default.
      hwnd = GetDlgItem(hwndDlg, IDC_SERVER_AUTHNLEVEL);
      for (i=0; i<cAuthnLevelEntries; i++)
    {
    SendMessage(hwnd, CB_INSERTSTRING, i, (LPARAM)rgAuthnLevelEntries[i].szName);
    SendMessage(hwnd, CB_SETITEMDATA, i, rgAuthnLevelEntries[i].dwVal);
    }
      SelectEntry(hwnd, rgAuthnLevelEntries, cAuthnLevelEntries, RPC_C_AUTHN_LEVEL_NONE);

      // build the lists of impersonation levels. choose Anonymous for the
      // process default.
      hwnd = GetDlgItem(hwndDlg, IDC_SERVER_IMPLEVEL);
      for (i=0; i<cImpLevelEntries; i++)
    {
    SendMessage(hwnd, CB_INSERTSTRING, i, (LPARAM)rgImpLevelEntries[i].szName);
    SendMessage(hwnd, CB_SETITEMDATA, i, rgImpLevelEntries[i].dwVal);
    }
      SelectEntry(hwnd, rgImpLevelEntries, cImpLevelEntries, RPC_C_IMP_LEVEL_ANONYMOUS);
      return 1;
      }

  case WM_SYSCOMMAND:
      if (wParam == SC_CLOSE)
    goto LClose;
      break;

  case WM_COMMAND:
      switch (LOWORD(wParam))
    {
    case IDCANCEL:
LClose:
        if (s_hbrCurrent != NULL)
      {
      DeleteObject(s_hbrCurrent);
      s_hbrCurrent = NULL;
      }
        if (s_dwRegister != 0)
      {
      CoRevokeClassObject(s_dwRegister);
      s_dwRegister = 0;
      }
        if (s_fInitialized == TRUE)
      {
      CoUninitialize();
      s_fInitialized = FALSE;
      }
        EndDialog(hwndDlg, 0);
        break;

    case IDC_INITIALIZE:
        // initialize as apartment-threaded to synchronize the UI
        // with calls to the objects
        hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
        if (FAILED(hr))
      {
      ErrorMessage(hwndDlg, TEXT("CoInitialize"), hr);
      break;
      }

                    // initialize security layer with our choices
        hr = CoInitializeSecurity(NULL,
                        -1,
                        NULL,
                        NULL,
      GetField(hwndDlg, IDC_SERVER_AUTHNLEVEL),
      GetField(hwndDlg, IDC_SERVER_IMPLEVEL),
                        NULL,
                        0,
      NULL);
        if (FAILED(hr))
      {
      ErrorMessage(hwndDlg, TEXT("CoInitializeSecurity"), hr);
      break;
      }

        hr = CoRegisterClassObject(CLSID_SecureObject, &s_ClassFactory,
      CLSCTX_SERVER, REGCLS_MULTIPLEUSE, &s_dwRegister);
        if (FAILED(hr))
      {
      ErrorMessage(hwndDlg, TEXT("CoRegisterClassObject"), hr);
      CoUninitialize();
      break;
      }

        // Disable Initialization Step (#1)
        EnableWindow(GetDlgItem(hwndDlg, IDC_INITIALIZE), FALSE);
        EnableWindow(GetDlgItem(hwndDlg, IDC_SERVER_AUTHNLEVEL), FALSE);
        EnableWindow(GetDlgItem(hwndDlg, IDC_SERVER_IMPLEVEL), FALSE);

        // Enable Object Viewing Steps (#2)
        // (choosing a valid object in the list box will enable the
        //  other controls)
        EnableWindow(GetDlgItem(hwndDlg, IDC_OBJECTS), TRUE);

        s_fInitialized = TRUE;
        break;

    case IDC_OBJECTS:
        {
        INT_PTR     iCur;

        if (HIWORD(wParam) != CBN_SELCHANGE)
      break;

        // a different object was chosen, or a property has changed.
        // retrieve the object's pointer from the item-data of the
        // current list-box item and update the UI.
        iCur = SendMessage(GetDlgItem(hwndDlg, IDC_OBJECTS),
      CB_GETCURSEL, 0, 0);
        if (iCur == CB_ERR)
      s_pcso = NULL;
        else
      {
      s_pcso = (CSecureObject*)SendMessage(GetDlgItem(hwndDlg, IDC_OBJECTS),
          CB_GETITEMDATA, iCur, 0);
      if (s_pcso == (LPVOID)CB_ERR)
          s_pcso = NULL;
      }

        if (s_hbrCurrent != NULL)
      {
      DeleteObject(s_hbrCurrent);
      s_hbrCurrent = NULL;
      }
        SetWindowText(GetDlgItem(hwndDlg, IDC_USERNAME), TEXT(""));
        InvalidateRect(GetDlgItem(hwndDlg, IDC_CHOOSECOLOR), NULL, TRUE);
        InvalidateRect(GetDlgItem(hwndDlg, IDC_COLOR), NULL, TRUE);
        InvalidateRect(GetDlgItem(hwndDlg, IDC_USERNAME), NULL, TRUE);
        InvalidateRect(GetDlgItem(hwndDlg, IDC_NOPUTCOLOR), NULL, TRUE);
        InvalidateRect(GetDlgItem(hwndDlg, IDC_NOPUTUSERNAME), NULL, TRUE);

        if (s_pcso != NULL)
      {
      SetWindowTextW(GetDlgItem(hwndDlg, IDC_USERNAME), s_pcso->m_rgchUserName);
      s_hbrCurrent = CreateSolidBrush(s_pcso->m_crColor);
      }

        // enable/disable the object-specific windows
        EnableWindow(GetDlgItem(hwndDlg, IDC_CHOOSECOLOR), s_pcso != NULL);
        EnableWindow(GetDlgItem(hwndDlg, IDC_COLOR), s_pcso != NULL);
        EnableWindow(GetDlgItem(hwndDlg, IDC_USERNAME), s_pcso != NULL);
        EnableWindow(GetDlgItem(hwndDlg, IDC_NOPUTCOLOR), s_pcso != NULL);
        EnableWindow(GetDlgItem(hwndDlg, IDC_NOPUTUSERNAME), s_pcso != NULL);
        break;
        }

    case IDC_NOPUTCOLOR:
        s_pcso->m_fDenyPutColor = (int) SendMessage(
       GetDlgItem(hwndDlg, IDC_NOPUTCOLOR), BM_GETCHECK, 0, 0);
        break;

    case IDC_NOPUTUSERNAME:
        s_pcso->m_fDenyPutUserName = (int) SendMessage(
      GetDlgItem(hwndDlg, IDC_NOPUTUSERNAME), BM_GETCHECK, 0, 0);
        break;

    case IDC_CHOOSECOLOR:
        {
        CHOOSECOLOR cc;

        cc.lStructSize = sizeof(CHOOSECOLOR);
        cc.hwndOwner = hwndDlg;
        cc.rgbResult = s_pcso->m_crColor;
        cc.lpCustColors = s_rgcrCustom;
        cc.Flags = CC_RGBINIT | CC_SHOWHELP;

        if (ChooseColor(&cc))
      {
      s_pcso->m_crColor = cc.rgbResult;
      if (s_hbrCurrent != NULL)
          DeleteObject(s_hbrCurrent);
      s_hbrCurrent = CreateSolidBrush(cc.rgbResult);
      InvalidateRect((HWND)lParam, NULL, TRUE);
      }
        break;
        }

    case IDC_USERNAME:
        {
        static s_fDirty = FALSE;

        if (HIWORD(wParam) == EN_CHANGE)
      {
      s_fDirty = TRUE;
      }
        else if (HIWORD(wParam) == EN_KILLFOCUS && s_fDirty)
      {
      GetWindowTextW(GetDlgItem(hwndDlg, IDC_USERNAME),
          s_pcso->m_rgchUserName, 20);
      s_fDirty = FALSE;
      }
        break;
        }
    }
      break;

  case WM_DRAWITEM:
      {
      LPDRAWITEMSTRUCT lpdis = (LPDRAWITEMSTRUCT)lParam;

      FillRect(lpdis->hDC, &lpdis->rcItem,
    s_hbrCurrent != NULL ? s_hbrCurrent : (HBRUSH)GetStockObject(WHITE_BRUSH));
      FrameRect(lpdis->hDC, &lpdis->rcItem, (HBRUSH)GetStockObject(BLACK_BRUSH));
      if (lpdis->itemState & ODS_SELECTED)
    InvertRect(lpdis->hDC, (LPRECT)&lpdis->rcItem);
      if (lpdis->itemState & ODS_FOCUS)
    DrawFocusRect(lpdis->hDC, (LPRECT) &lpdis->rcItem);
      return TRUE;
      }
  }
    return FALSE;
}  // ServerDialogProc

int WINAPI WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | szCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 951 of file secSvr.Cpp.

{
    HRESULT hr;

    // DebugBreak();

    // parse the command-line
    if (szCmdLine)
  {
  char    *sz = strtok(szCmdLine, " \t");
  if (sz)
      {
      if (!strcmpi(sz, "-Embedding"))
    s_fServer = TRUE;

      // Auto-register, display success or failure, and exit
      else if (!strcmpi(sz, "-AutoRegister"))
    {
    if (FAutoRegister(hInstance))
        MessageBox(GetDesktopWindow(),
      TEXT("Registered Successfully!"),
      szDescription,
      MB_OK);
    return S_OK;
    }

      // any other argument besides interactive causes help to be displayed
      else if (strcmpi(sz, "-Interactive"))
    {
    // MessageBox some help here
    }
      }
  else
      {
      s_fService = TRUE;
      s_fServer = TRUE;
      }
  }

    // when launched without command-line args, run as a service, without any UI
    // and running multi-threaded
    if (s_fService)
  return StartServiceCtrlDispatcher(s_rgsteServices) ? 0 : GetLastError();

    // when launched with -Embedding, come up
    // without any UI and run multi-threaded
    else if (s_fServer)
  {
  DWORD   dwRegister;

  InitializeCriticalSection(&s_csDone);

  s_hevtDone = CreateEvent(NULL, FALSE, FALSE, NULL);
  if (s_hevtDone == NULL)
      return HRESULT_FROM_WIN32(GetLastError());

  hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
  if (FAILED(hr))
      return hr;

  hr = CoRegisterClassObject(CLSID_SecureObject, &s_ClassFactory,
      CLSCTX_SERVER, REGCLS_MULTIPLEUSE, &dwRegister);
  if (FAILED(hr))
      goto LServerExit;

  // wait for all open connections to the server to go away
  WaitForSingleObject(s_hevtDone, INFINITE);

  // Destroy the event handle
  CloseHandle(s_hevtDone);
  s_hevtDone = NULL;

  // destroy the critsec used to determine when we're done
  DeleteCriticalSection(&s_csDone);

  CoRevokeClassObject(dwRegister);

LServerExit:
  CoUninitialize();
  return hr;
  }

    // when launched with -Interactive, run with UI.
    // this allows the user to adjust the exact security parameters of the
    // process and to monitor individual client objects. in this case, we will
    // eventually initialize COM (once the user selects security parameters
    // and hits the Initialize button) to use the apartment model in order
    // to synchronize calls with our UI.
    DialogBox(hInstance, MAKEINTRESOURCE(IDD_SECSVR), GetDesktopWindow(),
  (DLGPROC)ServerDialogProc);

    return 0;
} // WinMain

Variable Documentation

DWORD dwRegister

Definition at line 135 of file secSvr.Cpp.

SERVICE_STATUS_HANDLE hStatus

Definition at line 134 of file secSvr.Cpp.

ENTRY rgAuthnLevelEntries[]
Initial value:
 {
    ENTRY(TEXT("Default    "), RPC_C_AUTHN_DEFAULT),
    ENTRY(TEXT("None       "), RPC_C_AUTHN_LEVEL_NONE),
    ENTRY(TEXT("Connect    "), RPC_C_AUTHN_LEVEL_CONNECT),
    ENTRY(TEXT("Call       "), RPC_C_AUTHN_LEVEL_CALL),
    ENTRY(TEXT("Packet     "), RPC_C_AUTHN_LEVEL_PKT),
    ENTRY(TEXT("Integrity  "), RPC_C_AUTHN_LEVEL_PKT_INTEGRITY),
    ENTRY(TEXT("Privacy    "), RPC_C_AUTHN_LEVEL_PKT_PRIVACY),
    }

Definition at line 144 of file secSvr.Cpp.

ENTRY rgImpLevelEntries[]
Initial value:
 {
    ENTRY(TEXT("Anonymous  "), RPC_C_IMP_LEVEL_ANONYMOUS),
    ENTRY(TEXT("Identify   "), RPC_C_IMP_LEVEL_IDENTIFY),
    ENTRY(TEXT("Impersonate"), RPC_C_IMP_LEVEL_IMPERSONATE),
    ENTRY(TEXT("Delegate   "), RPC_C_IMP_LEVEL_DELEGATE),
    }

Definition at line 154 of file secSvr.Cpp.

UINT s_cInstances

Definition at line 140 of file secSvr.Cpp.

CClassFactory s_ClassFactory

Definition at line 131 of file secSvr.Cpp.

CRITICAL_SECTION s_csDone

Definition at line 142 of file secSvr.Cpp.

BOOL s_fDone

Definition at line 143 of file secSvr.Cpp.

BOOL s_fServer

Definition at line 143 of file secSvr.Cpp.

BOOL s_fService

Definition at line 143 of file secSvr.Cpp.

HANDLE s_hevtDone

Definition at line 141 of file secSvr.Cpp.

HWND s_hwndDlg

Definition at line 139 of file secSvr.Cpp.

SERVICE_TABLE_ENTRY s_rgsteServices[2]
Initial value:
 { { (TCHAR*)szServiceName, MyServiceMain },
                { NULL, NULL } }

Definition at line 137 of file secSvr.Cpp.

struct { ... } s_Service
SERVICE_STATUS Status

Definition at line 133 of file secSvr.Cpp.

const TCHAR szDescription[] = TEXT("Network OLE Security Sample")

Definition at line 78 of file secSvr.Cpp.

const TCHAR szServiceName[] = TEXT("SecSvr")

Definition at line 77 of file secSvr.Cpp.

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/Secure/secSvr.h File Reference

  • Com
  • Fundamentals
  • DCom
  • Secure
Defines

secSvr.h File Reference

Go to the source code of this file.

Defines

#define | IDC_CHOOSECOLOR 1002
#define | IDC_COLOR 1001
#define | IDC_COLORTEXT 1003
#define | IDC_INITIALIZE 1005
#define | IDC_NOPUTCOLOR 1004
#define | IDC_NOPUTUSERNAME 1006
#define | IDC_OBJECTS 1009
#define | IDC_SERVER_AUTHNLEVEL 1007
#define | IDC_SERVER_IMPLEVEL 1008
#define | IDC_USERNAME 1000
#define | IDD_SECSVR 101

Define Documentation

#define IDC_CHOOSECOLOR 1002

Definition at line 8 of file secSvr.h.

#define IDC_COLOR 1001

Definition at line 7 of file secSvr.h.

#define IDC_COLORTEXT 1003

Definition at line 9 of file secSvr.h.

#define IDC_INITIALIZE 1005

Definition at line 11 of file secSvr.h.

#define IDC_NOPUTCOLOR 1004

Definition at line 10 of file secSvr.h.

#define IDC_NOPUTUSERNAME 1006

Definition at line 12 of file secSvr.h.

#define IDC_OBJECTS 1009

Definition at line 15 of file secSvr.h.

#define IDC_SERVER_AUTHNLEVEL 1007

Definition at line 13 of file secSvr.h.

#define IDC_SERVER_IMPLEVEL 1008

Definition at line 14 of file secSvr.h.

#define IDC_USERNAME 1000

Definition at line 6 of file secSvr.h.

#define IDD_SECSVR 101

Definition at line 5 of file secSvr.h.

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/Simple/sclient/sclient.cpp File Reference

  • Com
  • Fundamentals
  • DCom
  • Simple
  • sclient
Defines | Functions | Variables

sclient.cpp File Reference

#include <stdio.h>
#include <windows.h>
#include <initguid.h>
#include <tchar.h>
#include <conio.h>

Go to the source code of this file.

Defines

#define | INC_OLE2

Functions

DEFINE_GUID (CLSID_SimpleObject, 0x5e9ddec7, 0x5767, 0x11cf, 0xbe, 0xab, 0x0, 0xaa, 0x0, 0x6c, 0x36, 0x6)
void __cdecl | main (int argc, CHAR **argv)
void | Message (LPTSTR szPrefix, HRESULT hr)
void | OutputTime (LARGE_INTEGER *pliStart, LARGE_INTEGER *pliFinish)

Variables

const ULONG | cbDefault = 4096

Define Documentation

#define INC_OLE2

Definition at line 48 of file sclient.cpp.

Function Documentation

DEFINE_GUID | ( | CLSID_SimpleObject | ,
 |  | 0x5e9ddec7 | ,
 |  | 0x5767 | ,
 |  | 0x11cf | ,
 |  | 0xbe | ,
 |  | 0xab | ,
 |  | 0x0 | ,
 |  | 0xaa | ,
 |  | 0x0 | ,
 |  | 0x6c | ,
 |  | 0x36 | ,
 |  | 0x6 |
 | ) |  |
void __cdecl main | ( | int | argc,
 |  | CHAR ** | argv
 | ) |  |

Definition at line 112 of file sclient.cpp.

{
    HRESULT hr;
    MULTI_QI    mq;
    COSERVERINFO csi, *pcsi=NULL;
    WCHAR wsz [MAX_PATH];
    ULONG cb = cbDefault;
    LARGE_INTEGER liStart, liFinish;

    // allow a machine-name as the command-line argument
    if (argc > 1)
        {
        MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, argv[1], -1,
            wsz, MAX_PATH);
        memset(&csi, 0, sizeof(COSERVERINFO));
        csi.pwszName = wsz;
        pcsi = &csi;
        }

    // allow a byte-size to be passed on the command-line
    if (argc > 2)
        cb = atol(argv[2]);

    // initialize COM for free-threaded use
    hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
    if (FAILED(hr))
        {
        Message(TEXT("Client: CoInitializeEx"), hr);
        exit(hr);
        }

    // create a remote instance of the object on the argv[1] machine
    Message(TEXT("Client: Creating Instance..."), S_OK);
    mq.pIID = &IID_IStream;
    mq.pItf = NULL;
    mq.hr = S_OK;
    QueryPerformanceCounter(&liStart);
    hr = CoCreateInstanceEx(CLSID_SimpleObject, NULL, CLSCTX_SERVER, pcsi, 1, &mq);
    QueryPerformanceCounter(&liFinish);
    OutputTime(&liStart, &liFinish);

    if (FAILED(hr))
        Message(TEXT("Client: CoCreateInstanceEx"), hr);
    else
        {
        LPSTREAM    pstm = (IStream*)mq.pItf;
        LPVOID      pv;

        // "read" some data from the object
        Message(TEXT("Client: Reading data..."), S_OK);
        pv = CoTaskMemAlloc(cb);
        QueryPerformanceCounter(&liStart);
        hr = pstm->Read(pv, cb, NULL);
        QueryPerformanceCounter(&liFinish);
        OutputTime(&liStart, &liFinish);
        if (FAILED(hr))
            Message(TEXT("Client: IStream::Read"), hr);

        // "write" some data to the object
        Message(TEXT("Client: Writing data..."), S_OK);
        QueryPerformanceCounter(&liStart);
        hr = pstm->Write(pv, cb, NULL);
        QueryPerformanceCounter(&liFinish);
        OutputTime(&liStart, &liFinish);
        if (FAILED(hr))
            Message(TEXT("Client: IStream::Write"), hr);

        // let go of the object
        pstm->Release();
        }

    CoUninitialize();
    Message(TEXT("Client: Done"), S_OK);
}  // main

void Message | ( | LPTSTR | szPrefix,
 |  | HRESULT | hr
 | ) |  |

Definition at line 67 of file sclient.cpp.

{
    LPTSTR   szMessage;

    if (hr == S_OK)
        {
        wprintf(szPrefix);
        return;
        }

    if (HRESULT_FACILITY(hr) == FACILITY_WINDOWS)
        hr = HRESULT_CODE(hr);

    FormatMessage(
        FORMAT_MESSAGE_ALLOCATE_BUFFER |
        FORMAT_MESSAGE_FROM_SYSTEM,
        NULL,
        hr,
        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), //The user default language
        (LPTSTR)&szMessage,
        0,
        NULL);

    wprintf(TEXT("%s: %s(%lx)\n"), szPrefix, szMessage, hr);

    LocalFree(szMessage);
}  // Message

void OutputTime | ( | LARGE_INTEGER * | pliStart,
 |  | LARGE_INTEGER * | pliFinish
 | ) |  |

Definition at line 99 of file sclient.cpp.

{
    LARGE_INTEGER liFreq;

    QueryPerformanceFrequency(&liFreq);
    wprintf(TEXT("%0.4f seconds\n"),
        (float)(pliFinish->LowPart - pliStart->LowPart)/(float)liFreq.LowPart);
}  // OutputTime

Variable Documentation

const ULONG cbDefault = 4096

Definition at line 59 of file sclient.cpp.

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/Simple/sserver/sserver.cpp File Reference

  • Com
  • Fundamentals
  • DCom
  • Simple
  • sserver
Classes | Defines | Functions | Variables

sserver.cpp File Reference

#include <stdio.h>
#include <windows.h>
#include <initguid.h>

Go to the source code of this file.

Classes

class | CClassFactory
class | CSimpleObject

Defines

#define | INC_OLE2
#define | STRICT

Functions

DEFINE_GUID (CLSID_SimpleObject, 0x5e9ddec7, 0x5767, 0x11cf, 0xbe, 0xab, 0x0, 0xaa, 0x0, 0x6c, 0x36, 0x6)
void __cdecl | main ()
void | Message (LPTSTR szPrefix, HRESULT hr)

Variables

CClassFactory g_ClassFactory
HANDLE hevtDone

Define Documentation

#define INC_OLE2

Definition at line 60 of file sserver.cpp.

#define STRICT

Definition at line 61 of file sserver.cpp.

Function Documentation

DEFINE_GUID | ( | CLSID_SimpleObject | ,
 |  | 0x5e9ddec7 | ,
 |  | 0x5767 | ,
 |  | 0x11cf | ,
 |  | 0xbe | ,
 |  | 0xab | ,
 |  | 0x0 | ,
 |  | 0xaa | ,
 |  | 0x0 | ,
 |  | 0x6c | ,
 |  | 0x36 | ,
 |  | 0x6 |
 | ) |  |
void __cdecl main ( void )

Definition at line 262 of file sserver.cpp.

{
    HRESULT hr;
    DWORD   dwRegister;

    // create the thread which is signaled when the instance is deleted
    hevtDone = CreateEvent(NULL, FALSE, FALSE, NULL);
    if (hevtDone == NULL)
        {
        hr = HRESULT_FROM_WIN32(GetLastError());
        Message(TEXT("Server: CreateEvent"), hr);
        exit(hr);
        }

    // initialize COM for free-threading
    hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
    if (FAILED(hr))
        {
        Message(TEXT("Server: CoInitializeEx"), hr);
        exit(hr);
        }

    // register the class-object with OLE
    hr = CoRegisterClassObject(CLSID_SimpleObject, &g_ClassFactory,
        CLSCTX_SERVER, REGCLS_SINGLEUSE, &dwRegister);
    if (FAILED(hr))
        {
        Message(TEXT("Server: CoRegisterClassObject"), hr);
        exit(hr);
        }

    Message(TEXT("Server: Waiting"), S_OK);

    // wait until an object is created and deleted.
    WaitForSingleObject(hevtDone, INFINITE);

    CloseHandle(hevtDone);

    CoUninitialize();
    Message(TEXT("Server: Done"), S_OK);
}  // main

void Message | ( | LPTSTR | szPrefix,
 |  | HRESULT | hr
 | ) |  |

Definition at line 133 of file sserver.cpp.

{
    LPTSTR   szMessage;

    if (hr == S_OK)
        {
        wprintf(szPrefix);
        wprintf(TEXT("\n"));
        return;
        }

    if (HRESULT_FACILITY(hr) == FACILITY_WINDOWS)
        hr = HRESULT_CODE(hr);

    FormatMessage(
        FORMAT_MESSAGE_ALLOCATE_BUFFER |
        FORMAT_MESSAGE_FROM_SYSTEM,
        NULL,
        hr,
        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), //The user default language
        (LPTSTR)&szMessage,
        0,
        NULL );

    wprintf(TEXT("%s: %s(%lx)\n"), szPrefix, szMessage, hr);

    LocalFree(szMessage);
}  // Message

Variable Documentation

CClassFactory g_ClassFactory

Definition at line 125 of file sserver.cpp.

HANDLE hevtDone

Definition at line 70 of file sserver.cpp.

Generated on Wed Nov 13 2024 16:53:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/TimeOuts/Client/Client.Cpp File Reference

  • Com
  • Fundamentals
  • DCom
  • TimeOuts
  • Client
Variables

Client.Cpp File Reference

#include "stdafx.h"
#include "client.h"
#include "clientDlg.h"
#include "..\server\server_i.c"
#include "..\PingResp\PingResp_i.c"

Go to the source code of this file.

Variables

CClientApp theApp

Variable Documentation

CClientApp theApp

Definition at line 75 of file Client.Cpp.

Generated on Wed Nov 13 2024 16:53:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/TimeOuts/Client/Client.h File Reference

  • Com
  • Fundamentals
  • DCom
  • TimeOuts
  • Client
Classes | Defines | Variables

Client.h File Reference

#include "resource.h"
#include "clientDlg.h"
#include "..\server\server.h"
#include "resource.h"

Go to the source code of this file.

Classes

class | CClientApp

Defines

#define | CALLTIMEOUT (4*1000)
#define | CALLTIMEOUTWHENPINGING (2*1000)
#define | MONITORPOLLDELAY (1*1000)
#define | PINGTIMEOUT (1*1000)

Variables

CClientApp theApp

Define Documentation

#define CALLTIMEOUT (4*1000)

Definition at line 81 of file Client.h.

#define CALLTIMEOUTWHENPINGING (2*1000)

Definition at line 82 of file Client.h.

#define MONITORPOLLDELAY (1*1000)

Definition at line 80 of file Client.h.

#define PINGTIMEOUT (1*1000)

Definition at line 83 of file Client.h.

Variable Documentation

CClientApp theApp

Definition at line 56 of file VCExplore.Cpp.

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/TimeOuts/Client/ClientDlg.Cpp File Reference

  • Com
  • Fundamentals
  • DCom
  • TimeOuts
  • Client

ClientDlg.Cpp File Reference

#include "stdafx.h"
#include "client.h"
#include "clientDlg.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/TimeOuts/Client/ClientDlg.h File Reference

  • Com
  • Fundamentals
  • DCom
  • TimeOuts
  • Client
Classes

ClientDlg.h File Reference

Go to the source code of this file.

Classes

class CClientDlg
Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/TimeOuts/Client/Resource.h File Reference

  • Com
  • Fundamentals
  • DCom
  • TimeOuts
  • Client
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_BAD 1003
#define | IDC_FAILS 1010
#define | IDC_GOOD 1001
#define | IDC_LASTVALUE 1000
#define | IDC_PINGFAILS 1009
#define | IDC_PINGS 1007
#define | IDC_RSN 1008
#define | IDC_TIMEOUTS 1006
#define | IDC_TRIES 1005
#define | IDC_USEPING 1004
#define | IDC_WARNING 1002
#define | IDD_CLIENT_DIALOG 102
#define | IDR_MAINFRAME 128
#define | IDSTART 2

Define Documentation

#define IDC_BAD 1003

Definition at line 11 of file Resource.h.

#define IDC_FAILS 1010

Definition at line 18 of file Resource.h.

#define IDC_GOOD 1001

Definition at line 9 of file Resource.h.

#define IDC_LASTVALUE 1000

Definition at line 8 of file Resource.h.

#define IDC_PINGFAILS 1009

Definition at line 17 of file Resource.h.

#define IDC_PINGS 1007

Definition at line 15 of file Resource.h.

#define IDC_RSN 1008

Definition at line 16 of file Resource.h.

#define IDC_TIMEOUTS 1006

Definition at line 14 of file Resource.h.

#define IDC_TRIES 1005

Definition at line 13 of file Resource.h.

#define IDC_USEPING 1004

Definition at line 12 of file Resource.h.

#define IDC_WARNING 1002

Definition at line 10 of file Resource.h.

#define IDD_CLIENT_DIALOG 102

Definition at line 6 of file Resource.h.

#define IDR_MAINFRAME 128

Definition at line 7 of file Resource.h.

#define IDSTART 2

Definition at line 5 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/TimeOuts/Client/StdAfx.h File Reference

  • Com
  • Fundamentals
  • DCom
  • TimeOuts
  • Client
Defines

StdAfx.h File Reference

#include <afxwin.h>
#include <afxext.h>
#include <afxcmn.h>
#include <afxole.h>

Go to the source code of this file.

Defines

#define VC_EXTRALEAN

Define Documentation

#define VC_EXTRALEAN

Definition at line 36 of file StdAfx.h.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/TimeOuts/PingResp/DllDatax.c File Reference

  • Com
  • Fundamentals
  • DCom
  • TimeOuts
  • PingResp

DllDatax.c File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/TimeOuts/PingResp/DllDatax.h File Reference

  • Com
  • Fundamentals
  • DCom
  • TimeOuts
  • PingResp

DllDatax.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/TimeOuts/PingResp/PingResp.Cpp File Reference

  • Com
  • Fundamentals
  • DCom
  • TimeOuts
  • PingResp
Functions | Variables

PingResp.Cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include "PingResp.h"
#include "dlldatax.h"
#include "PingResp_i.c"
#include "PingResponder.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 89 of file PingResp.Cpp.

{
#ifdef _MERGE_PROXYSTUB
    if (PrxDllCanUnloadNow() != S_OK)
        return S_FALSE;
#endif
    return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 101 of file PingResp.Cpp.

{
#ifdef _MERGE_PROXYSTUB
    if (PrxDllGetClassObject(rclsid, riid, ppv) == S_OK)
        return S_OK;
#endif
    return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID | lpReserved
 | ) |  |

Definition at line 69 of file PingResp.Cpp.

{
    lpReserved;
#ifdef _MERGE_PROXYSTUB
    if (!PrxDllMain(hInstance, dwReason, lpReserved))
        return FALSE;
#endif
    if (dwReason == DLL_PROCESS_ATTACH)
    {
        _Module.Init(ObjectMap, hInstance, &LIBID_PINGRESPLib);
        DisableThreadLibraryCalls(hInstance);
    }
    else if (dwReason == DLL_PROCESS_DETACH)
        _Module.Term();
    return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 113 of file PingResp.Cpp.

{
#ifdef _MERGE_PROXYSTUB
    HRESULT hRes = PrxDllRegisterServer();
    if (FAILED(hRes))
        return hRes;
#endif
    // registers object, typelib and all interfaces in typelib
    return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 127 of file PingResp.Cpp.

{
#ifdef _MERGE_PROXYSTUB
    PrxDllUnregisterServer();
#endif
    return _Module.UnregisterServer(TRUE);
}

Variable Documentation

CComModule _Module

Definition at line 59 of file PingResp.Cpp.

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/TimeOuts/PingResp/PingResp.Idl File Reference

  • Com
  • Fundamentals
  • DCom
  • TimeOuts
  • PingResp
Functions | Variables

PingResp.Idl File Reference

Go to the source code of this file.

Functions

library PINGRESPLib | importlib ("stdole32.tlb")
importlib ("stdole2.tlb")

Variables

import oaidl | idl

Function Documentation

library PINGRESPLib importlib ( "stdole32.tlb" )
importlib ( "stdole2.tlb" )

Variable Documentation

import ocidl idl

Definition at line 30 of file PingResp.Idl.

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/TimeOuts/PingResp/PingResponder.h File Reference

  • Com
  • Fundamentals
  • DCom
  • TimeOuts
  • PingResp
Classes

PingResponder.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class CPingResponder
Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/TimeOuts/PingResp/Resource.h File Reference

  • Com
  • Fundamentals
  • DCom
  • TimeOuts
  • PingResp
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_PINGRESP 101
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_PINGRESP 101

Definition at line 6 of file Resource.h.

#define IDS_PROJNAME 100

Definition at line 5 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/TimeOuts/PingResp/StdAfx.h File Reference

  • Com
  • Fundamentals
  • DCom
  • TimeOuts
  • PingResp
Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0500
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 39 of file StdAfx.h.

#define _WIN32_WINNT 0x0500

Definition at line 37 of file StdAfx.h.

#define STRICT

Definition at line 35 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/TimeOuts/Server/MonitorServer.Cpp File Reference

  • Com
  • Fundamentals
  • DCom
  • TimeOuts
  • Server
Variables

MonitorServer.Cpp File Reference

#include "stdafx.h"
#include "server.h"
#include "MonitorServer.h"
#include "PingResp_i.c"

Go to the source code of this file.

Variables

int arDelay [10] = {0,1,5,91,635,2000,3365,3909,3995,4000}

Variable Documentation

int arDelay[10] = {0,1,5,91,635,2000,3365,3909,3995,4000}

Definition at line 35 of file MonitorServer.Cpp.

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/TimeOuts/Server/MonitorServer.h File Reference

  • Com
  • Fundamentals
  • DCom
  • TimeOuts
  • Server
Classes

MonitorServer.h File Reference

#include <stdlib.h>
#include <time.h>
#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Classes

class CMonitorServer
Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/TimeOuts/Server/Resource.h File Reference

  • Com
  • Fundamentals
  • DCom
  • TimeOuts
  • Server
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_MonitorServer 102
#define | IDR_Server 100
#define | IDS_MONITORSERVER_DESC 101
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_MonitorServer 102

Definition at line 8 of file Resource.h.

#define IDR_Server 100

Definition at line 6 of file Resource.h.

#define IDS_MONITORSERVER_DESC 101

Definition at line 7 of file Resource.h.

#define IDS_PROJNAME 100

Definition at line 5 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/TimeOuts/Server/Server.Cpp File Reference

  • Com
  • Fundamentals
  • DCom
  • TimeOuts
  • Server
Functions | Variables

Server.Cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include "initguid.h"
#include "server.h"
#include "server_i.c"
#include "MonitorServer.h"

Go to the source code of this file.

Functions

int WINAPI | _tWinMain (HINSTANCE hInstance, HINSTANCE, LPTSTR lpCmdLine, int)
LPCTSTR | FindOneOf (LPCTSTR p1, LPCTSTR p2)

Variables

CExeModule _Module

Function Documentation

int WINAPI _tWinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | ,
 |  | LPTSTR | lpCmdLine,
 |  | int |
 | ) |  |

Definition at line 79 of file Server.Cpp.

{
  lpCmdLine = GetCommandLine(); //this line necessary for _ATL_MIN_CRT
  HRESULT hRes = CoInitialize(NULL);
//  If you are running on NT 4.0 or higher you can use the following call
//  instead to make the EXE free threaded.
//  This means that calls come in on a random RPC thread
//  HRESULT hRes = CoInitializeEx(NULL, COINIT_MULTITHREADED);
  _ASSERTE(SUCCEEDED(hRes));
  _Module.Init(ObjectMap, hInstance);
  _Module.dwThreadID = GetCurrentThreadId();
  TCHAR szTokens[] = _T("-/");

  int nRet = 0;
  BOOL bRun = TRUE;
  LPCTSTR lpszToken = FindOneOf(lpCmdLine, szTokens);
  while (lpszToken != NULL)
  {
    if (lstrcmpi(lpszToken, _T("UnregServer"))==0)
    {
      _Module.UpdateRegistryFromResource(IDR_Server, FALSE);
      nRet = _Module.UnregisterServer();
      bRun = FALSE;
      break;
    }
    if (lstrcmpi(lpszToken, _T("RegServer"))==0)
    {
      _Module.UpdateRegistryFromResource(IDR_Server, TRUE);
      nRet = _Module.RegisterServer(TRUE);
      bRun = FALSE;
      break;
    }
    lpszToken = FindOneOf(lpszToken, szTokens);
  }

  if (bRun)
  {
    hRes = _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER,
      REGCLS_MULTIPLEUSE);
    _ASSERTE(SUCCEEDED(hRes));

    MSG msg;
    while (GetMessage(&msg, 0, 0, 0))
      DispatchMessage(&msg);

    _Module.RevokeClassObjects();
  }

  CoUninitialize();
  return nRet;
}

LPCTSTR FindOneOf | ( | LPCTSTR | p1,
 |  | LPCTSTR | p2
 | ) |  |

Definition at line 62 of file Server.Cpp.

{
  while (*p1 != NULL)
  {
    LPCTSTR p = p2;
    while (*p != NULL)
    {
      if (*p1 == *p++)
        return p1+1;
    }
    p1++;
  }
  return NULL;
}

Variable Documentation

CExeModule _Module

Definition at line 55 of file Server.Cpp.

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/TimeOuts/Server/Server.Idl File Reference

  • Com
  • Fundamentals
  • DCom
  • TimeOuts
  • Server
Functions | Variables

Server.Idl File Reference

Go to the source code of this file.

Functions

HRESULT | GetPingResponder ([out] IPingResponder **ppPing)
importlib ("stdole2.tlb")
library SERVERLib | importlib ("stdole32.tlb")

Variables

import oaidl | idl

Function Documentation

HRESULT GetPingResponder ( [out] IPingResponder ** ppPing )
importlib ( "stdole2.tlb" )
library SERVERLib importlib ( "stdole32.tlb" )

Variable Documentation

import PingResp PingResp idl

Definition at line 28 of file Server.Idl.

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/DCom/TimeOuts/Server/StdAfx.h File Reference

  • Com
  • Fundamentals
  • DCom
  • TimeOuts
  • Server
Classes | Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Classes

class | CExeModule

Defines

#define | _ATL_APARTMENT_THREADED
#define | STRICT

Variables

CExeModule _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 38 of file StdAfx.h.

#define STRICT

Definition at line 35 of file StdAfx.h.

Variable Documentation

CExeModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/Include/ansiapi.h File Reference

  • Com
  • Fundamentals
  • Include
Defines

ansiapi.h File Reference

Go to the source code of this file.

Defines

#define | _lcreat_AW _lcreatW
#define | _lopen_AW _lopenW
#define | A2W(a, w, cb)
#define | DeleteFile_AW DeleteFileW
#define | FREELOCALSTRING(p) delete (p)
#define | GlobalAddAtom_AW GlobalAddAtomW
#define | GlobalGetAtomName_AW GlobalGetAtomNameW
#define | MAKE_STR_LOCAL_COPYA2W(s, l)
#define | MAKE_STR_LOCAL_COPYW2A(s, l)
#define | OLESTRCAT wcscat
#define | OLESTRCMP wcscmp
#define | OLESTRCPY wcscpy
#define | OLESTRLEN wcslen
#define | RegOpenKey_AW RegOpenKeyW
#define | StringFromCLSID2A(rclsid, lpsz, cbMax) StringFromGUID2A(rclsid, lpsz, cbMax)
#define | StringFromIID2A(riid, lpsz, cbMax) StringFromGUID2A(riid, lpsz, cbMax)
#define | UNICODEOLE32
#define | W2A(w, a, cb)
#define | WASANSI()

Define Documentation

#define _lcreat_AW _lcreatW

Definition at line 113 of file ansiapi.h.

#define _lopen_AW _lopenW

Definition at line 112 of file ansiapi.h.

#define A2W | ( | a,
 |  | w,
 |  | cb
 | ) |
Value:
MultiByteToWideChar(                              \
                                               CP_ACP,                      \
                                               0,                           \
                                               a,                           \
                                               -1,                          \
                                               w,                           \
                                               cb)

Definition at line 82 of file ansiapi.h.

#define DeleteFile_AW DeleteFileW

Definition at line 111 of file ansiapi.h.

#define FREELOCALSTRING ( p ) delete (p)

Definition at line 91 of file ansiapi.h.

#define GlobalAddAtom_AW GlobalAddAtomW

Definition at line 114 of file ansiapi.h.

#define GlobalGetAtomName_AW GlobalGetAtomNameW

Definition at line 115 of file ansiapi.h.

#define MAKE_STR_LOCAL_COPYA2W | ( | s,
 |  | l
 | ) |
Value:
{                                   \
                                      l = UtDupStringA2W(s);              \
                                      if (!l) {                           \
                                         return ResultFromScode(S_OOM);   \
                                      }                                   \
                                   }

Definition at line 99 of file ansiapi.h.

#define MAKE_STR_LOCAL_COPYW2A | ( | s,
 |  | l
 | ) |
Value:
{                                   \
                                      l = UtDupStringW2A(s);              \
                                      if (!l) {                           \
                                         return ResultFromScode(S_OOM);   \
                                      }                                   \
                                   }

Definition at line 92 of file ansiapi.h.

#define OLESTRCAT wcscat

Definition at line 107 of file ansiapi.h.

#define OLESTRCMP wcscmp

Definition at line 109 of file ansiapi.h.

#define OLESTRCPY wcscpy

Definition at line 106 of file ansiapi.h.

#define OLESTRLEN wcslen

Definition at line 108 of file ansiapi.h.

#define RegOpenKey_AW RegOpenKeyW

Definition at line 116 of file ansiapi.h.

#define StringFromCLSID2A | ( | rclsid,
 |  | lpsz,
 |  | cbMax |
 | ) |  | StringFromGUID2A(rclsid, lpsz, cbMax)

Definition at line 120 of file ansiapi.h.

#define StringFromIID2A | ( | riid,
 |  | lpsz,
 |  | cbMax |
 | ) |  | StringFromGUID2A(riid, lpsz, cbMax)

Definition at line 123 of file ansiapi.h.

#define UNICODEOLE32

Definition at line 9 of file ansiapi.h.

#define W2A | ( | w,
 |  | a,
 |  | cb
 | ) |
Value:
WideCharToMultiByte(                              \
                                               CP_ACP,                      \
                                               0,                           \
                                               w,                           \
                                               -1,                          \
                                               a,                           \
                                               cb,                          \
                                               NULL,                        \
                                               NULL)

Definition at line 72 of file ansiapi.h.

#define WASANSI ( )
Value:
{                                                           \
                   OutputDebugString("\n\r\t\tUnicode string was ANSI!\r\n"); \
                   Assert(0);                                                 \
                   _asm { int 3 }                                             \
                  }

Definition at line 17 of file ansiapi.h.

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/Include/assert.h File Reference

  • Com
  • Fundamentals
  • Include
Defines | Functions

assert.h File Reference

Go to the source code of this file.

Defines

#define | _assert(exp, file, line) PopUpAssert(file, line, exp)
#define | _CRTAPI2
#define | assert(exp) (void)( (exp) || (PopUpAssert(__FILE__, __LINE__, #exp), 0) )

Functions

void _CRTAPI1 | PopUpAssert (void *szFile, int iLine, void *szMessage)

Define Documentation

#define _assert | ( | exp,
 |  | file,
 |  | line |
 | ) |  | PopUpAssert(file, line, exp)

Definition at line 66 of file assert.h.

#define _CRTAPI2

Definition at line 39 of file assert.h.

#define assert ( exp ) (void)( (exp) || (PopUpAssert(__FILE__, __LINE__, #exp), 0) )

Definition at line 65 of file assert.h.

Function Documentation

void _CRTAPI1 PopUpAssert | ( | void * | szFile,
 |  | int | iLine,
 |  | void * | szMessage
 | ) |  |

Definition at line 55 of file altassrt.Cxx.

{
    int id = PopUpError((char const *)szMessage,iLine, (char const *) szFile);

    if (id == IDCANCEL)
    {
#ifdef WIN32
        DebugBreak();
#else
        _asm int 3;
#endif
    }
}

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/Include/BttnCur.h File Reference

  • Com
  • Fundamentals
  • Include
Classes | Defines | Typedefs | Functions

BttnCur.h File Reference

Go to the source code of this file.

Classes

struct | tagTOOLDISPLAYDATA

Defines

#define | ATTRIBUTEBUTTON_DISABLED (BUTTONGROUP_DISABLED)
#define | ATTRIBUTEBUTTON_DOWN (BUTTONGROUP_ACTIVE | BUTTONGROUP_DOWN | BUTTONGROUP_LIGHTFACE)
#define | ATTRIBUTEBUTTON_DOWNDISABLED (BUTTONGROUP_DISABLED | BUTTONGROUP_DOWN | BUTTONGROUP_LIGHTFACE)
#define | ATTRIBUTEBUTTON_INDETERMINATE (BUTTONGROUP_ACTIVE | BUTTONGROUP_LIGHTFACE)
#define | ATTRIBUTEBUTTON_MOUSEDOWN (BUTTONGROUP_ACTIVE | BUTTONGROUP_DOWN)
#define | ATTRIBUTEBUTTON_UP (BUTTONGROUP_ACTIVE)
#define | BLANKBUTTON_DOWN (BUTTONGROUP_ACTIVE | BUTTONGROUP_BLANK | BUTTONGROUP_DOWN | BUTTONGROUP_LIGHTFACE)
#define | BLANKBUTTON_INDETERMINATE (BUTTONGROUP_ACTIVE | BUTTONGROUP_BLANK | BUTTONGROUP_LIGHTFACE)
#define | BLANKBUTTON_MOUSEDOWN (BUTTONGROUP_ACTIVE | BUTTONGROUP_BLANK | BUTTONGROUP_DOWN)
#define | BLANKBUTTON_UP (BUTTONGROUP_ACTIVE | BUTTONGROUP_BLANK)
#define | BUTTONGROUP_ACTIVE 0x0002
#define | BUTTONGROUP_BLANK 0x0010
#define | BUTTONGROUP_DISABLED 0x0004
#define | BUTTONGROUP_DOWN 0x0001
#define | BUTTONGROUP_LIGHTFACE 0x0008
#define | COMMANDBUTTON_DISABLED (BUTTONGROUP_DISABLED)
#define | COMMANDBUTTON_MOUSEDOWN (BUTTONGROUP_ACTIVE | BUTTONGROUP_DOWN)
#define | COMMANDBUTTON_UP (BUTTONGROUP_ACTIVE)
#define | CYBUTTONBAR120 38
#define | CYBUTTONBAR72 23
#define | CYBUTTONBAR96 29
#define | IDB_STANDARDIMAGES 400
#define | IDB_STANDARDIMAGES120 402
#define | IDB_STANDARDIMAGES72 401
#define | IDB_STANDARDIMAGES96 400
#define | IDB_STANDARDIMAGESMIN 400
#define | IDC_CONTEXTHELP 501
#define | IDC_HARROWS 511
#define | IDC_HSIZEBAR 505
#define | IDC_HSPLITBAR 507
#define | IDC_LARGEARROWS 510
#define | IDC_MAGNIFY 502
#define | IDC_NESWARROWS 513
#define | IDC_NEWUICURSORMAX 514
#define | IDC_NEWUICURSORMIN 500
#define | IDC_NODROP 503
#define | IDC_NWSEARROWS 514
#define | IDC_RIGHTARROW 500
#define | IDC_SMALLARROWS 509
#define | IDC_TABLETOP 504
#define | IDC_VARROWS 512
#define | IDC_VSIZEBAR 506
#define | IDC_VSPLITBAR 508
#define | PRESERVE_ALL (PRESERVE_BLACK | PRESERVE_DKGRAY | PRESERVE_LTGRAY | PRESERVE_WHITE)
#define | PRESERVE_BLACK 0x0100
#define | PRESERVE_DKGRAY 0x0200
#define | PRESERVE_LTGRAY 0x0400
#define | PRESERVE_NONE 0
#define | PRESERVE_WHITE 0x0800
#define | TOOLBUTTON_STD120HEIGHT 31
#define | TOOLBUTTON_STD120IMAGEHEIGHT 23
#define | TOOLBUTTON_STD120IMAGEWIDTH 24
#define | TOOLBUTTON_STD120WIDTH 32
#define | TOOLBUTTON_STD72HEIGHT 16
#define | TOOLBUTTON_STD72IMAGEHEIGHT 11
#define | TOOLBUTTON_STD72IMAGEWIDTH 16
#define | TOOLBUTTON_STD72WIDTH 24
#define | TOOLBUTTON_STD96HEIGHT 22
#define | TOOLBUTTON_STD96IMAGEHEIGHT 15
#define | TOOLBUTTON_STD96IMAGEWIDTH 16
#define | TOOLBUTTON_STD96WIDTH 24
#define | TOOLBUTTON_STDHEIGHT 22
#define | TOOLBUTTON_STDIMAGEHEIGHT 15
#define | TOOLBUTTON_STDIMAGEWIDTH 16
#define | TOOLBUTTON_STDWIDTH 24
#define | TOOLIMAGE_EDITCOPY 1
#define | TOOLIMAGE_EDITCUT 0
#define | TOOLIMAGE_EDITPASTE 2
#define | TOOLIMAGE_FILENEW 3
#define | TOOLIMAGE_FILEOPEN 4
#define | TOOLIMAGE_FILEPRINT 6
#define | TOOLIMAGE_FILESAVE 5
#define | TOOLIMAGE_HELP 7
#define | TOOLIMAGE_HELPCONTEXT 8
#define | TOOLIMAGE_MAX 8
#define | TOOLIMAGE_MIN 0

Typedefs

typedef struct tagTOOLDISPLAYDATA * | LPTOOLDISPLAYDATA
typedef struct tagTOOLDISPLAYDATA | TOOLDISPLAYDATA

Functions

HCURSOR WINAPI | UICursorLoad (UINT)
BOOL WINAPI | UIToolButtonDraw (HDC, int, int, int, int, HBITMAP, int, int, int, UINT)
BOOL WINAPI | UIToolButtonDrawTDD (HDC, int, int, int, int, HBITMAP, int, int, int, UINT, LPTOOLDISPLAYDATA)
BOOL WINAPI | UIToolConfigureForDisplay (LPTOOLDISPLAYDATA)

Define Documentation

#define ATTRIBUTEBUTTON_DISABLED (BUTTONGROUP_DISABLED)

Definition at line 149 of file BttnCur.h.

#define ATTRIBUTEBUTTON_DOWN (BUTTONGROUP_ACTIVE | BUTTONGROUP_DOWN | BUTTONGROUP_LIGHTFACE)

Definition at line 150 of file BttnCur.h.

#define ATTRIBUTEBUTTON_DOWNDISABLED (BUTTONGROUP_DISABLED | BUTTONGROUP_DOWN | BUTTONGROUP_LIGHTFACE)

Definition at line 152 of file BttnCur.h.

#define ATTRIBUTEBUTTON_INDETERMINATE (BUTTONGROUP_ACTIVE | BUTTONGROUP_LIGHTFACE)

Definition at line 151 of file BttnCur.h.

#define ATTRIBUTEBUTTON_MOUSEDOWN (BUTTONGROUP_ACTIVE | BUTTONGROUP_DOWN)

Definition at line 148 of file BttnCur.h.

#define ATTRIBUTEBUTTON_UP (BUTTONGROUP_ACTIVE)

Definition at line 147 of file BttnCur.h.

#define BLANKBUTTON_DOWN (BUTTONGROUP_ACTIVE | BUTTONGROUP_BLANK | BUTTONGROUP_DOWN | BUTTONGROUP_LIGHTFACE)

Definition at line 156 of file BttnCur.h.

#define BLANKBUTTON_INDETERMINATE (BUTTONGROUP_ACTIVE | BUTTONGROUP_BLANK | BUTTONGROUP_LIGHTFACE)

Definition at line 158 of file BttnCur.h.

#define BLANKBUTTON_MOUSEDOWN (BUTTONGROUP_ACTIVE | BUTTONGROUP_BLANK | BUTTONGROUP_DOWN)

Definition at line 157 of file BttnCur.h.

#define BLANKBUTTON_UP (BUTTONGROUP_ACTIVE | BUTTONGROUP_BLANK)

Definition at line 155 of file BttnCur.h.

#define BUTTONGROUP_ACTIVE 0x0002

Definition at line 136 of file BttnCur.h.

#define BUTTONGROUP_BLANK 0x0010

Definition at line 139 of file BttnCur.h.

#define BUTTONGROUP_DISABLED 0x0004

Definition at line 137 of file BttnCur.h.

#define BUTTONGROUP_DOWN 0x0001

Definition at line 135 of file BttnCur.h.

#define BUTTONGROUP_LIGHTFACE 0x0008

Definition at line 138 of file BttnCur.h.

#define COMMANDBUTTON_DISABLED (BUTTONGROUP_DISABLED)

Definition at line 144 of file BttnCur.h.

#define COMMANDBUTTON_MOUSEDOWN (BUTTONGROUP_ACTIVE | BUTTONGROUP_DOWN)

Definition at line 143 of file BttnCur.h.

#define COMMANDBUTTON_UP (BUTTONGROUP_ACTIVE)

Definition at line 142 of file BttnCur.h.

#define CYBUTTONBAR120 38

Definition at line 108 of file BttnCur.h.

#define CYBUTTONBAR72 23

Definition at line 106 of file BttnCur.h.

#define CYBUTTONBAR96 29

Definition at line 107 of file BttnCur.h.

#define IDB_STANDARDIMAGES 400

Definition at line 26 of file BttnCur.h.

#define IDB_STANDARDIMAGES120 402

Definition at line 32 of file BttnCur.h.

#define IDB_STANDARDIMAGES72 401

Definition at line 31 of file BttnCur.h.

#define IDB_STANDARDIMAGES96 400

Definition at line 30 of file BttnCur.h.

#define IDB_STANDARDIMAGESMIN 400

Definition at line 29 of file BttnCur.h.

#define IDC_CONTEXTHELP 501

Definition at line 53 of file BttnCur.h.

#define IDC_HARROWS 511

Definition at line 63 of file BttnCur.h.

#define IDC_HSIZEBAR 505

Definition at line 57 of file BttnCur.h.

#define IDC_HSPLITBAR 507

Definition at line 59 of file BttnCur.h.

#define IDC_LARGEARROWS 510

Definition at line 62 of file BttnCur.h.

#define IDC_MAGNIFY 502

Definition at line 54 of file BttnCur.h.

#define IDC_NESWARROWS 513

Definition at line 65 of file BttnCur.h.

#define IDC_NEWUICURSORMAX 514

Definition at line 67 of file BttnCur.h.

#define IDC_NEWUICURSORMIN 500

Definition at line 51 of file BttnCur.h.

#define IDC_NODROP 503

Definition at line 55 of file BttnCur.h.

#define IDC_NWSEARROWS 514

Definition at line 66 of file BttnCur.h.

#define IDC_RIGHTARROW 500

Definition at line 52 of file BttnCur.h.

#define IDC_SMALLARROWS 509

Definition at line 61 of file BttnCur.h.

#define IDC_TABLETOP 504

Definition at line 56 of file BttnCur.h.

#define IDC_VARROWS 512

Definition at line 64 of file BttnCur.h.

#define IDC_VSIZEBAR 506

Definition at line 58 of file BttnCur.h.

#define IDC_VSPLITBAR 508

Definition at line 60 of file BttnCur.h.

#define PRESERVE_ALL (PRESERVE_BLACK | PRESERVE_DKGRAY | PRESERVE_LTGRAY | PRESERVE_WHITE)

Definition at line 171 of file BttnCur.h.

#define PRESERVE_BLACK 0x0100

Definition at line 166 of file BttnCur.h.

#define PRESERVE_DKGRAY 0x0200

Definition at line 167 of file BttnCur.h.

#define PRESERVE_LTGRAY 0x0400

Definition at line 168 of file BttnCur.h.

#define PRESERVE_NONE 0

Definition at line 172 of file BttnCur.h.

#define PRESERVE_WHITE 0x0800

Definition at line 169 of file BttnCur.h.

#define TOOLBUTTON_STD120HEIGHT 31

Definition at line 100 of file BttnCur.h.

#define TOOLBUTTON_STD120IMAGEHEIGHT 23

Definition at line 102 of file BttnCur.h.

#define TOOLBUTTON_STD120IMAGEWIDTH 24

Definition at line 101 of file BttnCur.h.

#define TOOLBUTTON_STD120WIDTH 32

Definition at line 99 of file BttnCur.h.

#define TOOLBUTTON_STD72HEIGHT 16

Definition at line 88 of file BttnCur.h.

#define TOOLBUTTON_STD72IMAGEHEIGHT 11

Definition at line 90 of file BttnCur.h.

#define TOOLBUTTON_STD72IMAGEWIDTH 16

Definition at line 89 of file BttnCur.h.

#define TOOLBUTTON_STD72WIDTH 24

Definition at line 87 of file BttnCur.h.

#define TOOLBUTTON_STD96HEIGHT 22

Definition at line 94 of file BttnCur.h.

#define TOOLBUTTON_STD96IMAGEHEIGHT 15

Definition at line 96 of file BttnCur.h.

#define TOOLBUTTON_STD96IMAGEWIDTH 16

Definition at line 95 of file BttnCur.h.

#define TOOLBUTTON_STD96WIDTH 24

Definition at line 93 of file BttnCur.h.

#define TOOLBUTTON_STDHEIGHT 22

Definition at line 75 of file BttnCur.h.

#define TOOLBUTTON_STDIMAGEHEIGHT 15

Definition at line 77 of file BttnCur.h.

#define TOOLBUTTON_STDIMAGEWIDTH 16

Definition at line 76 of file BttnCur.h.

#define TOOLBUTTON_STDWIDTH 24

Definition at line 74 of file BttnCur.h.

#define TOOLIMAGE_EDITCOPY 1

Definition at line 39 of file BttnCur.h.

#define TOOLIMAGE_EDITCUT 0

Definition at line 38 of file BttnCur.h.

#define TOOLIMAGE_EDITPASTE 2

Definition at line 40 of file BttnCur.h.

#define TOOLIMAGE_FILENEW 3

Definition at line 41 of file BttnCur.h.

#define TOOLIMAGE_FILEOPEN 4

Definition at line 42 of file BttnCur.h.

#define TOOLIMAGE_FILEPRINT 6

Definition at line 44 of file BttnCur.h.

#define TOOLIMAGE_FILESAVE 5

Definition at line 43 of file BttnCur.h.

#define TOOLIMAGE_HELP 7

Definition at line 45 of file BttnCur.h.

#define TOOLIMAGE_HELPCONTEXT 8

Definition at line 46 of file BttnCur.h.

#define TOOLIMAGE_MAX 8

Definition at line 47 of file BttnCur.h.

#define TOOLIMAGE_MIN 0

Definition at line 37 of file BttnCur.h.

Typedef Documentation

typedef struct tagTOOLDISPLAYDATA* LPTOOLDISPLAYDATA
typedef struct tagTOOLDISPLAYDATA TOOLDISPLAYDATA

Function Documentation

HCURSOR WINAPI UICursorLoad ( UINT )
BOOL WINAPI UIToolButtonDraw | ( | HDC | ,
 |  | int | ,
 |  | int | ,
 |  | int | ,
 |  | int | ,
 |  | HBITMAP | ,
 |  | int | ,
 |  | int | ,
 |  | int | ,
 |  | UINT |
 | ) |  |
BOOL WINAPI UIToolButtonDrawTDD | ( | HDC | ,
 |  | int | ,
 |  | int | ,
 |  | int | ,
 |  | int | ,
 |  | HBITMAP | ,
 |  | int | ,
 |  | int | ,
 |  | int | ,
 |  | UINT | ,
 |  | LPTOOLDISPLAYDATA |
 | ) |  |
BOOL WINAPI UIToolConfigureForDisplay ( LPTOOLDISPLAYDATA )
Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/Include/GizmoBar.h File Reference

  • Com
  • Fundamentals
  • Include
Classes | Defines | Typedefs | Functions

GizmoBar.h File Reference

#include <bttncur.h>

Go to the source code of this file.

Classes

struct | CREATEGIZMOA
struct | CREATEGIZMOW
struct | GBGETINT
struct | GBGETTEXTA
struct | GBGETTEXTW
struct | GBMSG
struct | GBSETINT

Defines

#define | CBCREATEGIZMO sizeof(CREATEGIZMOA)
#define | CBGBGETINT sizeof(GBGETINT);
#define | CBGBGETTEXT sizeof(GBGETTEXTA);
#define | CBGBMSG sizeof(GBMSG);
#define | CBGBSETINT sizeof(GBSETINT);
#define | CLASS_GIZMOBAR TEXT("gizmobar")
#define | GBGizmoAdd GBGizmoAddA
#define | GBGizmoTextGet GBGizmoTextGetA
#define | GBGizmoTextSet GBGizmoTextSetA
#define | GBM_GIZMOADD GBM_GIZMOADDA
#define | GBM_GIZMOADDA (WM_USER+3)
#define | GBM_GIZMOADDW (WM_USER+2)
#define | GBM_GIZMOCHECK (WM_USER+8)
#define | GBM_GIZMODATAGET (WM_USER+13)
#define | GBM_GIZMODATASET (WM_USER+12)
#define | GBM_GIZMOENABLE (WM_USER+7)
#define | GBM_GIZMOEXIST (WM_USER+10)
#define | GBM_GIZMOFOCUSSET (WM_USER+9)
#define | GBM_GIZMOINTGET (WM_USER+20)
#define | GBM_GIZMOINTSET (WM_USER+21)
#define | GBM_GIZMONOTIFYGET (WM_USER+15)
#define | GBM_GIZMONOTIFYSET (WM_USER+14)
#define | GBM_GIZMOREMOVE (WM_USER+4)
#define | GBM_GIZMOSENDMESSAGE (WM_USER+5)
#define | GBM_GIZMOSHOW (WM_USER+6)
#define | GBM_GIZMOTEXTGET GBM_GIZMOTEXTGETA
#define | GBM_GIZMOTEXTGETA (WM_USER+16)
#define | GBM_GIZMOTEXTGETW (WM_USER+17)
#define | GBM_GIZMOTEXTSET GBM_GIZMOTEXTSETA
#define | GBM_GIZMOTEXTSETA (WM_USER+18)
#define | GBM_GIZMOTEXTSETW (WM_USER+19)
#define | GBM_GIZMOTYPEGET (WM_USER+11)
#define | GBM_HWNDASSOCIATEGET (WM_USER+1)
#define | GBM_HWNDASSOCIATESET (WM_USER+0)
#define | GBN_ASSOCIATEGAIN 1
#define | GBN_ASSOCIATELOSS 2
#define | GBN_GIZMOADDED 3
#define | GBN_GIZMOREMOVED 4
#define | GIZMO_DISABLED (BUTTONGROUP_DISABLED)
#define | GIZMO_NORMAL (BUTTONGROUP_ACTIVE)
#define | GIZMOTYPE_BUTTONATTRIBUTEEX 0x0080
#define | GIZMOTYPE_BUTTONATTRIBUTEIN 0x0040
#define | GIZMOTYPE_BUTTONCOMMAND 0x0100
#define | GIZMOTYPE_BUTTONNORMAL 0x0008
#define | GIZMOTYPE_COMBOBOX 0x0004
#define | GIZMOTYPE_EDIT 0x0001
#define | GIZMOTYPE_LISTBOX 0x0002
#define | GIZMOTYPE_SEPARATOR 0x0020
#define | GIZMOTYPE_TEXT 0x0010

Typedefs

typedef CREATEGIZMOA | CREATEGIZMO
typedef GBGETTEXTA | GBGETTEXT
typedef LPCREATEGIZMOA | LPCREATEGIZMO
typedef struct CREATEGIZMOA * | LPCREATEGIZMOA
typedef struct CREATEGIZMOW * | LPCREATEGIZMOW
typedef struct GBGETINT * | LPGBGETINT
typedef LPGBGETTEXTA | LPGBGETTEXT
typedef struct GBGETTEXTA * | LPGBGETTEXTA
typedef struct GBGETTEXTW * | LPGBGETTEXTW
typedef struct GBMSG * | LPGBMSG
typedef struct GBSETINT * | LPGBSETINT

Functions

BOOL WINAPI | GBGizmoAddA (HWND, UINT, UINT, UINT, UINT, UINT, LPSTR, HBITMAP, UINT, UINT)
BOOL WINAPI | GBGizmoAddW (HWND, UINT, UINT, UINT, UINT, UINT, LPWSTR, HBITMAP, UINT, UINT)
BOOL WINAPI | GBGizmoCheck (HWND, UINT, BOOL)
DWORD WINAPI | GBGizmoDataGet (HWND, UINT)
DWORD WINAPI | GBGizmoDataSet (HWND, UINT, DWORD)
BOOL WINAPI | GBGizmoEnable (HWND, UINT, BOOL)
BOOL WINAPI | GBGizmoExist (HWND, UINT)
UINT WINAPI | GBGizmoFocusSet (HWND, UINT)
UINT WINAPI | GBGizmoIntGet (HWND, UINT, BOOL FAR *, BOOL)
void WINAPI | GBGizmoIntSet (HWND, UINT, UINT, BOOL)
BOOL WINAPI | GBGizmoNotifyGet (HWND, UINT)
BOOL WINAPI | GBGizmoNotifySet (HWND, UINT, BOOL)
BOOL WINAPI | GBGizmoRemove (HWND, UINT)
LRESULT WINAPI | GBGizmoSendMessage (HWND, UINT, UINT, WPARAM, LPARAM)
BOOL WINAPI | GBGizmoShow (HWND, UINT, BOOL)
int WINAPI | GBGizmoTextGetA (HWND, UINT, LPSTR, UINT)
int WINAPI | GBGizmoTextGetW (HWND, UINT, LPWSTR, UINT)
void WINAPI | GBGizmoTextSetA (HWND, UINT, LPSTR)
void WINAPI | GBGizmoTextSetW (HWND, UINT, LPWSTR)
int WINAPI | GBGizmoTypeGet (HWND, UINT)
HWND WINAPI | GBHwndAssociateGet (HWND)
HWND WINAPI | GBHwndAssociateSet (HWND, HWND)

Define Documentation

#define CBCREATEGIZMO sizeof(CREATEGIZMOA)

Definition at line 160 of file GizmoBar.h.

#define CBGBGETINT sizeof(GBGETINT);

Definition at line 204 of file GizmoBar.h.

#define CBGBGETTEXT sizeof(GBGETTEXTA);

Definition at line 193 of file GizmoBar.h.

#define CBGBMSG sizeof(GBMSG);

Definition at line 172 of file GizmoBar.h.

#define CBGBSETINT sizeof(GBSETINT);

Definition at line 214 of file GizmoBar.h.

#define CLASS_GIZMOBAR TEXT("gizmobar")

Definition at line 31 of file GizmoBar.h.

#define GBGizmoAdd GBGizmoAddA

Definition at line 52 of file GizmoBar.h.

#define GBGizmoTextGet GBGizmoTextGetA

Definition at line 53 of file GizmoBar.h.

#define GBGizmoTextSet GBGizmoTextSetA

Definition at line 54 of file GizmoBar.h.

#define GBM_GIZMOADD GBM_GIZMOADDA

Definition at line 116 of file GizmoBar.h.

#define GBM_GIZMOADDA (WM_USER+3)

Definition at line 89 of file GizmoBar.h.

#define GBM_GIZMOADDW (WM_USER+2)

Definition at line 88 of file GizmoBar.h.

#define GBM_GIZMOCHECK (WM_USER+8)

Definition at line 94 of file GizmoBar.h.

#define GBM_GIZMODATAGET (WM_USER+13)

Definition at line 99 of file GizmoBar.h.

#define GBM_GIZMODATASET (WM_USER+12)

Definition at line 98 of file GizmoBar.h.

#define GBM_GIZMOENABLE (WM_USER+7)

Definition at line 93 of file GizmoBar.h.

#define GBM_GIZMOEXIST (WM_USER+10)

Definition at line 96 of file GizmoBar.h.

#define GBM_GIZMOFOCUSSET (WM_USER+9)

Definition at line 95 of file GizmoBar.h.

#define GBM_GIZMOINTGET (WM_USER+20)

Definition at line 106 of file GizmoBar.h.

#define GBM_GIZMOINTSET (WM_USER+21)

Definition at line 107 of file GizmoBar.h.

#define GBM_GIZMONOTIFYGET (WM_USER+15)

Definition at line 101 of file GizmoBar.h.

#define GBM_GIZMONOTIFYSET (WM_USER+14)

Definition at line 100 of file GizmoBar.h.

#define GBM_GIZMOREMOVE (WM_USER+4)

Definition at line 90 of file GizmoBar.h.

#define GBM_GIZMOSENDMESSAGE (WM_USER+5)

Definition at line 91 of file GizmoBar.h.

#define GBM_GIZMOSHOW (WM_USER+6)

Definition at line 92 of file GizmoBar.h.

#define GBM_GIZMOTEXTGET GBM_GIZMOTEXTGETA

Definition at line 114 of file GizmoBar.h.

#define GBM_GIZMOTEXTGETA (WM_USER+16)

Definition at line 102 of file GizmoBar.h.

#define GBM_GIZMOTEXTGETW (WM_USER+17)

Definition at line 103 of file GizmoBar.h.

#define GBM_GIZMOTEXTSET GBM_GIZMOTEXTSETA

Definition at line 115 of file GizmoBar.h.

#define GBM_GIZMOTEXTSETA (WM_USER+18)

Definition at line 104 of file GizmoBar.h.

#define GBM_GIZMOTEXTSETW (WM_USER+19)

Definition at line 105 of file GizmoBar.h.

#define GBM_GIZMOTYPEGET (WM_USER+11)

Definition at line 97 of file GizmoBar.h.

#define GBM_HWNDASSOCIATEGET (WM_USER+1)

Definition at line 87 of file GizmoBar.h.

#define GBM_HWNDASSOCIATESET (WM_USER+0)

Definition at line 86 of file GizmoBar.h.

#define GBN_ASSOCIATEGAIN 1

Definition at line 80 of file GizmoBar.h.

#define GBN_ASSOCIATELOSS 2

Definition at line 81 of file GizmoBar.h.

#define GBN_GIZMOADDED 3

Definition at line 82 of file GizmoBar.h.

#define GBN_GIZMOREMOVED 4

Definition at line 83 of file GizmoBar.h.

#define GIZMO_DISABLED (BUTTONGROUP_DISABLED)

Definition at line 232 of file GizmoBar.h.

#define GIZMO_NORMAL (BUTTONGROUP_ACTIVE)

Definition at line 231 of file GizmoBar.h.

#define GIZMOTYPE_BUTTONATTRIBUTEEX 0x0080

Definition at line 226 of file GizmoBar.h.

#define GIZMOTYPE_BUTTONATTRIBUTEIN 0x0040

Definition at line 225 of file GizmoBar.h.

#define GIZMOTYPE_BUTTONCOMMAND 0x0100

Definition at line 227 of file GizmoBar.h.

#define GIZMOTYPE_BUTTONNORMAL 0x0008

Definition at line 222 of file GizmoBar.h.

#define GIZMOTYPE_COMBOBOX 0x0004

Definition at line 221 of file GizmoBar.h.

#define GIZMOTYPE_EDIT 0x0001

Definition at line 219 of file GizmoBar.h.

#define GIZMOTYPE_LISTBOX 0x0002

Definition at line 220 of file GizmoBar.h.

#define GIZMOTYPE_SEPARATOR 0x0020

Definition at line 224 of file GizmoBar.h.

#define GIZMOTYPE_TEXT 0x0010

Definition at line 223 of file GizmoBar.h.

Typedef Documentation

typedef CREATEGIZMOA CREATEGIZMO

Definition at line 158 of file GizmoBar.h.

typedef GBGETTEXTA GBGETTEXT

Definition at line 191 of file GizmoBar.h.

typedef LPCREATEGIZMOA LPCREATEGIZMO

Definition at line 159 of file GizmoBar.h.

typedef struct CREATEGIZMOA* LPCREATEGIZMOA
typedef struct CREATEGIZMOW* LPCREATEGIZMOW
typedef struct GBGETINT* LPGBGETINT
typedef LPGBGETTEXTA LPGBGETTEXT

Definition at line 192 of file GizmoBar.h.

typedef struct GBGETTEXTA* LPGBGETTEXTA
typedef struct GBGETTEXTW* LPGBGETTEXTW
typedef struct GBMSG* LPGBMSG
typedef struct GBSETINT* LPGBSETINT

Function Documentation

BOOL WINAPI GBGizmoAddA | ( | HWND | ,
 |  | UINT | ,
 |  | UINT | ,
 |  | UINT | ,
 |  | UINT | ,
 |  | UINT | ,
 |  | LPSTR | ,
 |  | HBITMAP | ,
 |  | UINT | ,
 |  | UINT |
 | ) |  |
BOOL WINAPI GBGizmoAddW | ( | HWND | ,
 |  | UINT | ,
 |  | UINT | ,
 |  | UINT | ,
 |  | UINT | ,
 |  | UINT | ,
 |  | LPWSTR | ,
 |  | HBITMAP | ,
 |  | UINT | ,
 |  | UINT |
 | ) |  |
BOOL WINAPI GBGizmoCheck | ( | HWND | ,
 |  | UINT | ,
 |  | BOOL |
 | ) |  |
DWORD WINAPI GBGizmoDataGet | ( | HWND | ,
 |  | UINT |
 | ) |  |
DWORD WINAPI GBGizmoDataSet | ( | HWND | ,
 |  | UINT | ,
 |  | DWORD |
 | ) |  |
BOOL WINAPI GBGizmoEnable | ( | HWND | ,
 |  | UINT | ,
 |  | BOOL |
 | ) |  |
BOOL WINAPI GBGizmoExist | ( | HWND | ,
 |  | UINT |
 | ) |  |
UINT WINAPI GBGizmoFocusSet | ( | HWND | ,
 |  | UINT |
 | ) |  |
UINT WINAPI GBGizmoIntGet | ( | HWND | ,
 |  | UINT | ,
 |  | BOOL FAR * | ,
 |  | BOOL |
 | ) |  |
void WINAPI GBGizmoIntSet | ( | HWND | ,
 |  | UINT | ,
 |  | UINT | ,
 |  | BOOL |
 | ) |  |
BOOL WINAPI GBGizmoNotifyGet | ( | HWND | ,
 |  | UINT |
 | ) |  |
BOOL WINAPI GBGizmoNotifySet | ( | HWND | ,
 |  | UINT | ,
 |  | BOOL |
 | ) |  |
BOOL WINAPI GBGizmoRemove | ( | HWND | ,
 |  | UINT |
 | ) |  |
LRESULT WINAPI GBGizmoSendMessage | ( | HWND | ,
 |  | UINT | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |
BOOL WINAPI GBGizmoShow | ( | HWND | ,
 |  | UINT | ,
 |  | BOOL |
 | ) |  |
int WINAPI GBGizmoTextGetA | ( | HWND | ,
 |  | UINT | ,
 |  | LPSTR | ,
 |  | UINT |
 | ) |  |
int WINAPI GBGizmoTextGetW | ( | HWND | ,
 |  | UINT | ,
 |  | LPWSTR | ,
 |  | UINT |
 | ) |  |
void WINAPI GBGizmoTextSetA | ( | HWND | ,
 |  | UINT | ,
 |  | LPSTR |
 | ) |  |
void WINAPI GBGizmoTextSetW | ( | HWND | ,
 |  | UINT | ,
 |  | LPWSTR |
 | ) |  |
int WINAPI GBGizmoTypeGet | ( | HWND | ,
 |  | UINT |
 | ) |  |
HWND WINAPI GBHwndAssociateGet ( HWND )
HWND WINAPI GBHwndAssociateSet | ( | HWND | ,
 |  | HWND |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/Include/msgfiltr.h File Reference

  • Com
  • Fundamentals
  • Include
Typedefs | Functions | Variables

msgfiltr.h File Reference

#include "ansiapi.h"

Go to the source code of this file.

Typedefs

typedef HTASK DWORD | dwTickCount
typedef HTASK | htaskCaller
typedef HTASK DWORD LPINTERFACEINFO | lpInterfaceInfo
typedef BOOL(CALLBACK * | MSGPENDINGPROC )(MSG FAR *)

Functions

typedef | DWORD (CALLBACK *HANDLEINCOMINGCALLBACKPROC)(DWORD dwCallType
OleStdMsgFilter_SetHandleInComingCallbackProc (LPMESSAGEFILTER lpThis, HANDLEINCOMINGCALLBACKPROC lpfnHandleInComingCallback)
STDAPI_ (BOOL) OleStdMsgFilter_EnableBusyDialog(LPMESSAGEFILTER lpThis
STDAPI_ (LPMESSAGEFILTER) OleStdMsgFilter_Create(HWND hWndParent
STDAPI_ (DWORD) OleStdMsgFilter_GetInComingCallStatus(LPMESSAGEFILTER lpThis)
STDAPI_ (void) OleStdMsgFilter_SetInComingCallStatus(LPMESSAGEFILTER lpThis
STDAPI_ (HWND) OleStdMsgFilter_SetParentWindow(LPMESSAGEFILTER lpThis

Variables

DWORD dwInComingCallStatus
BOOL fEnable
HWND | hWndParent
LPOLESTR MSGPENDINGPROC lpfnCallback
LPOLESTR MSGPENDINGPROC
LPFNOLEUIHOOK 		lpfnOleUIHook
LPOLESTR szAppName

Typedef Documentation

typedef HTASK DWORD dwTickCount

Definition at line 32 of file msgfiltr.h.

typedef HTASK htaskCaller

Definition at line 32 of file msgfiltr.h.

typedef HTASK DWORD LPINTERFACEINFO lpInterfaceInfo

Definition at line 32 of file msgfiltr.h.

typedef BOOL(CALLBACK* MSGPENDINGPROC)(MSG FAR *)

Definition at line 26 of file msgfiltr.h.

Function Documentation

typedef DWORD ( CALLBACK * HANDLEINCOMINGCALLBACKPROC )
OleStdMsgFilter_SetHandleInComingCallbackProc | ( | LPMESSAGEFILTER | lpThis,
 |  | HANDLEINCOMINGCALLBACKPROC | lpfnHandleInComingCallback
 | ) |  |

Definition at line 220 of file msgfiltr.c.

{
   LPOLESTDMESSAGEFILTER lpStdMsgFilter = (LPOLESTDMESSAGEFILTER)lpThis;
   HANDLEINCOMINGCALLBACKPROC    lpfnPrevCallback =
         lpStdMsgFilter->m_lpfnHandleInComingCallback;

   if (!IsBadWritePtr((LPVOID)lpStdMsgFilter, sizeof(OLESTDMESSAGEFILTER))) {
      lpStdMsgFilter->m_lpfnHandleInComingCallback =
            lpfnHandleInComingCallback;
   } else {
      OleDbgAssert(
         "OleStdMsgFilter_SetIncomingCallStatus: Invalid IMessageFilter*");
   }

#if defined( _DEBUG )
   {
      if (lpfnHandleInComingCallback)
         OleDbgOut3(
            "OleStdMsgFilter_SetHandleInComingCallbackProc SET\r\n");
      else
         OleDbgOut3(
            "OleStdMsgFilter_SetHandleInComingCallbackProc CLEARED\r\n");

   }
#endif  // _DEBUG

   return lpfnPrevCallback;
}

STDAPI_ ( BOOL )

Definition at line 594 of file drawIcon.c.

   {
   LPMETAFILEPICT  pMF;
   LABELEXTRACT    le;
   HDC             hDC;

   /*
    * We will walk the metafile looking for the two comment records
    * following the IconOnly comment.  The flags fFoundIconOnly and
    * fFoundSource indicate if we have found IconOnly and if we have
    * found the source comment already.
    */

   if (NULL==hMetaPict || NULL==lpszSource || NULL==piIcon)
      return FALSE;

   pMF=GlobalLock(hMetaPict);

   if (NULL==pMF)
      return FALSE;

   le.lpsz=lpszSource;
   le.fFoundIconOnly=FALSE;
   le.fFoundSource=FALSE;
   le.fFoundIndex=FALSE;

   //Use a screen DC so we have something valid to pass in.
   hDC=GetDC(NULL);

   EnumMetaFile(hDC, pMF->hMF, (MFENUMPROC)EnumMetafileExtractIconSource, (LONG)(LPLABELEXTRACT)&le);

   ReleaseDC(NULL, hDC);
   GlobalUnlock(hMetaPict);

   //Copy the icon index to the caller's variable.
   *piIcon=le.u.iIcon;

   //Check that we found everything.
   return (le.fFoundIconOnly && le.fFoundSource && le.fFoundIndex);
   }

STDAPI_ ( LPMESSAGEFILTER )
STDAPI_ ( DWORD )

Definition at line 267 of file msgfiltr.c.

{
   LPOLESTDMESSAGEFILTER lpStdMsgFilter = (LPOLESTDMESSAGEFILTER)lpThis;
   DWORD dwReturn;

   if (!IsBadReadPtr((LPVOID)lpStdMsgFilter,  sizeof(OLESTDMESSAGEFILTER)))
      dwReturn = lpStdMsgFilter->m_dwInComingCallStatus;
   else
      {
      OleDbgAssert(
         "OleStdMsgFilter_GetIncomingCallStatus: Invalid IMessageFilter*");
      dwReturn = (DWORD)-1;
      }

#if defined( _DEBUG )
   {
   char szBuf[80];
   char *szReturn;

   switch(dwReturn) {
      case SERVERCALL_ISHANDLED:
         szReturn = "SERVERCALL_ISHANDLED";
         break;
      case SERVERCALL_REJECTED:
         szReturn = "SERVERCALL_REJECTED";
         break;
      case SERVERCALL_RETRYLATER:
         szReturn = "SERVERCALL_RETRYLATER";
         break;
      default:
         szReturn = "-1";
         break;
      }
   wsprintf(
      szBuf,
      "OleStdMsgFilter_GetInComingCallStatus returns %s.\r\n",
      /*(LPSTR)*/szReturn
   );
   OleDbgOut3(szBuf);
   }
#endif

   return dwReturn;
}

STDAPI_ ( void )
STDAPI_ ( HWND )

Variable Documentation

DWORD dwInComingCallStatus

Definition at line 46 of file msgfiltr.h.

BOOL fEnable

Definition at line 57 of file msgfiltr.h.

HWND hWndParent

Definition at line 63 of file msgfiltr.h.

LPOLESTR MSGPENDINGPROC lpfnCallback

Definition at line 40 of file msgfiltr.h.

LPOLESTR MSGPENDINGPROC LPFNOLEUIHOOK lpfnOleUIHook

Definition at line 40 of file msgfiltr.h.

LPOLESTR szAppName

Definition at line 40 of file msgfiltr.h.

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/Include/OleStd.h File Reference

  • Com
  • Fundamentals
  • Include
Classes | Defines | Typedefs | Functions | Variables

OleStd.h File Reference

#include <windows.h>
#include <shellapi.h>
#include <ole2.h>
#include <string.h>
#include <dlgs.h>
#include "ansiapi.h"
#include "oledlg.h"
#include <dos.h>
#include <commdlg.h>

Go to the source code of this file.

Classes

struct | tagINTERFACEIMPL

Defines

#define | AreRectsEqual(lprc1, lprc2)
#define | CF_CUSTOMLINKSOURCE TEXT("Custom Link Source")
#define | CF_EMBEDDEDOBJECT TEXT("Embedded Object")
#define | CF_EMBEDSOURCE TEXT("Embed Source")
#define | CF_FILENAME TEXT("FileName")
#define | CF_LINKSOURCE TEXT("Link Source")
#define | CF_LINKSRCDESCRIPTOR TEXT("Link Source Descriptor")
#define | CF_OBJECTDESCRIPTOR TEXT("Object Descriptor")
#define | CF_OWNERLINK TEXT("OwnerLink")
#define | DD_DEFDRAGDELAY 200
#define | DD_DEFDRAGMINDIST 2
#define | DD_DEFSCROLLINTERVAL 50
#define | DEFAULT_HATCHBORDER_WIDTH 4
#define | EMBEDDINGFLAG "Embedding"
#define | EXPORT __export
#define | GetIconOfClass(hInst, rclsid, lpszLabel, fUseTypeAsLabel) OleGetIconOfClass(rclsid, lpszLabel, fUseTypeAsLabel)
#define | GetIconOfFile(hInst, lpszFileName, fUseFileAsLabel) OleGetIconOfFile(lpszFileName, fUseFileAsLabel)
#define | HIMETRIC_PER_INCH 2540
#define | ID_BROWSE 130
#define | ID_CURRENT 121
#define | ID_CURRENTICON 122
#define | ID_DEFAULT 123
#define | ID_DEFAULTICON 124
#define | ID_DUMMY 999
#define | ID_EL_AUTOMATIC 202
#define | ID_EL_CANCELLINK 209
#define | ID_EL_CHANGESOURCE 201
#define | ID_EL_CLOSE 208
#define | ID_EL_COL1 220
#define | ID_EL_COL2 221
#define | ID_EL_COL3 222
#define | ID_EL_LINKSLISTBOX 206
#define | ID_EL_LINKSOURCE 216
#define | ID_EL_LINKTYPE 217
#define | ID_EL_MANUAL 212
#define | ID_EL_NULL -1
#define | ID_EL_OPENSOURCE 211
#define | ID_EL_UPDATE 218
#define | ID_EL_UPDATENOW 210
#define | ID_FROMFILE 125
#define | ID_FROMFILEEDIT 126
#define | ID_GROUP 120
#define | ID_ICONLIST 127
#define | ID_IO_CHANGEICON 2105
#define | ID_IO_CREATEFROMFILE 2101
#define | ID_IO_CREATENEW 2100
#define | ID_IO_DISPLAYASICON 2104
#define | ID_IO_FILE 2106
#define | ID_IO_FILEDISPLAY 2107
#define | ID_IO_FILETEXT 2112
#define | ID_IO_FILETYPE 2113
#define | ID_IO_ICONDISPLAY 2110
#define | ID_IO_LINKFILE 2102
#define | ID_IO_OBJECTTYPELIST 2103
#define | ID_IO_OBJECTTYPETEXT 2111
#define | ID_IO_RESULTIMAGE 2108
#define | ID_IO_RESULTTEXT 2109
#define | ID_LABEL 128
#define | ID_LABELEDIT 129
#define | ID_OLEUIHELP 99
#define | ID_PS_CHANGEICON 508
#define | ID_PS_DISPLAYASICON 506
#define | ID_PS_DISPLAYLIST 505
#define | ID_PS_ICONDISPLAY 507
#define | ID_PS_PASTE 500
#define | ID_PS_PASTELINK 501
#define | ID_PS_PASTELINKLIST 504
#define | ID_PS_PASTELIST 503
#define | ID_PS_RESULTGROUP 511
#define | ID_PS_RESULTIMAGE 509
#define | ID_PS_RESULTTEXT 510
#define | ID_PS_SOURCETEXT 502
#define | ID_PS_STXAS 513
#define | ID_PS_STXSOURCE 512
#define | ID_PU_BROWSE 904
#define | ID_PU_CONVERT 902
#define | ID_PU_LINKS 900
#define | ID_PU_METER 905
#define | ID_PU_PERCENT 906
#define | ID_PU_STOP 907
#define | ID_PU_TEXT 901
#define | ID_RESULTICON 132
#define | ID_RESULTLABEL 133
#define | ID_STATIC 98
#define | IDB_RESULTSEGA 32325
#define | IDB_RESULTSHIRESVGA 32327
#define | IDB_RESULTSVGA 32326
#define | IDBZ_ICON 601
#define | IDBZ_MESSAGE1 602
#define | IDBZ_RETRY 600
#define | IDBZ_SWITCHTO 604
#define | IDCV_ACTIVATEAS 156
#define | IDCV_ACTIVATELIST 154
#define | IDCV_CHANGEICON 153
#define | IDCV_CONVERTLIST 158
#define | IDCV_CONVERTTO 155
#define | IDCV_DISPLAYASICON 152
#define | IDCV_GRPRESULT 163
#define | IDCV_ICON 159
#define | IDCV_ICONLABEL1 160
#define | IDCV_ICONLABEL2 161
#define | IDCV_OBJECTTYPE 150
#define | IDCV_RESULTTEXT 157
#define | IDCV_STXCONVERTTO 164
#define | IDCV_STXCURTYPE 162
#define | IDD_FILEOPEN 32253
#define | IDS_BROWSE 32322
#define | IDS_BZRESULTTEXTBUSY 32447
#define | IDS_BZRESULTTEXTNOTRESPONDING 32448
#define | IDS_CHANGEADDITIONALLINKS 32460
#define | IDS_CHANGESOURCE 32455
#define | IDS_CIFILEACCESS 32432
#define | IDS_CIFILEOPENFAIL 32434
#define | IDS_CIFILESHARE 32433
#define | IDS_CIINVALIDFILE 32431
#define | IDS_CINOICONSINFILE 32430
#define | IDS_CLOSE 32461
#define | IDS_CVRESULTACTIVATEAS 32444
#define | IDS_CVRESULTACTIVATEDIFF 32445
#define | IDS_CVRESULTCONVERTLINK 32440
#define | IDS_CVRESULTCONVERTTO 32441
#define | IDS_CVRESULTDISPLAYASICON 32443
#define | IDS_CVRESULTNOCHANGE 32442
#define | IDS_DEFICONLABEL 32310
#define | IDS_ERR_ADDSTRING 32459
#define | IDS_ERR_GETLINKSOURCE 32457
#define | IDS_ERR_GETLINKUPDATEOPTIONS 32458
#define | IDS_FAILED 32454
#define | IDS_FILTERS 32320
#define | IDS_ICONFILTERS 32321
#define | IDS_INVALIDSOURCE 32456
#define | IDS_IORESULTFROMFILE1 32402
#define | IDS_IORESULTFROMFILE2 32403
#define | IDS_IORESULTFROMFILEICON2 32404
#define | IDS_IORESULTLINKFILE1 32405
#define | IDS_IORESULTLINKFILE2 32406
#define | IDS_IORESULTLINKFILEICON1 32407
#define | IDS_IORESULTLINKFILEICON2 32408
#define | IDS_IORESULTNEW 32400
#define | IDS_IORESULTNEWICON 32401
#define | IDS_LINK_AUTO 32450
#define | IDS_LINK_MANUAL 32451
#define | IDS_LINK_UNKNOWN 32452
#define | IDS_LINKS 32453
#define | IDS_OLE2UICONVERT 32304
#define | IDS_OLE2UIEDIT 32303
#define | IDS_OLE2UIEDITLINKCMD_1VERB 32305
#define | IDS_OLE2UIEDITLINKCMD_NVERB 32307
#define | IDS_OLE2UIEDITNOOBJCMD 32309
#define | IDS_OLE2UIEDITOBJECTCMD_1VERB 32306
#define | IDS_OLE2UIEDITOBJECTCMD_NVERB 32308
#define | IDS_OLE2UILINK 32301
#define | IDS_OLE2UIOBJECT 32302
#define | IDS_OLE2UIPASTELINKEDTYPE 32311
#define | IDS_OLE2UIUNKNOWN 32300
#define | IDS_OLESTDDISKFULL 702
#define | IDS_OLESTDNOCREATEFILE 700
#define | IDS_OLESTDNOOPENFILE 701
#define | IDS_PSNONOLE 32416
#define | IDS_PSPASTEDATA 32410
#define | IDS_PSPASTELINKDATA 32413
#define | IDS_PSPASTELINKOBJECT 32414
#define | IDS_PSPASTELINKOBJECTASICON 32415
#define | IDS_PSPASTEOBJECT 32411
#define | IDS_PSPASTEOBJECTASICON 32412
#define | IDS_PSUNKNOWNAPP 32419
#define | IDS_PSUNKNOWNSRC 32418
#define | IDS_PSUNKNOWNTYPE 32417
#define | INIT_INTERFACEIMPL(lpIFace, pVtbl, pBack)
#define | IsEqualFORMATETC(fe1, fe2) (OleStdCompareFormatEtc(&(fe1), &(fe2))==0)
#define | LSTRCPYN(lpdst, lpsrc, cch)
#define | MAP_LOGHIM_TO_PIX(x, ppli) MulDiv((ppli), (x), HIMETRIC_PER_INCH)
#define | MAP_PIX_TO_LOGHIM(x, ppli) MulDiv(HIMETRIC_PER_INCH, (x), (ppli))
#define | NONAMELESSUNION
#define | OLEDBG_BEGIN(lpsz)
#define | OLEDBG_BEGIN1(lpsz)
#define | OLEDBG_BEGIN2(lpsz)
#define | OLEDBG_BEGIN3(lpsz)
#define | OLEDBG_BEGIN4(lpsz)
#define | OLEDBG_END
#define | OLEDBG_END1
#define | OLEDBG_END2
#define | OLEDBG_END3
#define | OLEDBG_END4
#define | OleDbgAddRefMethod(lpThis, iface)
#define | OleDbgAssert(a)
#define | OleDbgAssertSz(a, b)
#define | OLEDBGDATA
#define | OLEDBGDATA_MAIN(szPrefix)
#define | OleDbgOut(lpsz)
#define | OleDbgOut1(lpsz)
#define | OleDbgOut2(lpsz)
#define | OleDbgOut3(lpsz)
#define | OleDbgOut4(lpsz)
#define | OleDbgOutHResult(lpsz, hr)
#define | OleDbgOutNoPrefix(lpsz)
#define | OleDbgOutNoPrefix1(lpsz)
#define | OleDbgOutNoPrefix2(lpsz)
#define | OleDbgOutNoPrefix3(lpsz)
#define | OleDbgOutNoPrefix4(lpsz)
#define | OleDbgOutRect(lpsz, lpRect)
#define | OleDbgOutRect1(lpsz, lpRect)
#define | OleDbgOutRect2(lpsz, lpRect)
#define | OleDbgOutRect3(lpsz, lpRect)
#define | OleDbgOutRect4(lpsz, lpRect)
#define | OleDbgOutRefCnt(lpsz, lpObj, refcnt)
#define | OleDbgOutRefCnt1(lpsz, lpObj, refcnt)
#define | OleDbgOutRefCnt2(lpsz, lpObj, refcnt)
#define | OleDbgOutRefCnt3(lpsz, lpObj, refcnt)
#define | OleDbgOutRefCnt4(lpsz, lpObj, refcnt)
#define | OleDbgOutScode(lpsz, sc)
#define | OleDbgQueryInterfaceMethod(lpUnk)
#define | OleDbgReleaseMethod(lpThis, iface)
#define | OleDbgVerify(a) (a)
#define | OleDbgVerifySz(a, b) (a)
#define | OLESTDCANCELRETRY (DWORD)-1
#define | OleStdCopyMetafilePict(hpictin, phpictout) (*(phpictout) = OleDuplicateData(hpictin,CF_METAFILEPICT,GHND|GMEM_SHARE))
#define | OLESTDDROP_DEFAULT 1
#define | OLESTDDROP_NONDEFAULT 2
#define | OLESTDDROP_NONE 0
#define | OleStdGetDropEffect(grfKeyState)
#define | OleStdQueryFormatMedium(lpformatetc, tymd)
#define | OleStdQueryLinkSourceData(lpformatetc)
#define | OleStdQueryObjectDescriptorData(lpformatetc)
#define | OleStdQueryOleObjectData(lpformatetc)
#define | OLESTDRETRYDELAY (DWORD)5000
#define | OLEUI_CCHCLSIDSTRING 39
#define | OLEUI_CCHFILEMAX 13
#define | OLEUI_CCHKEYMAX 256
#define | OLEUI_CCHLABELMAX 40
#define | OLEUI_CCHPATHMAX 256
#define | OLEUI_CCHVERBMAX 32
#define | OLEUI_HANDLES_INSIDE 0x00000004L
#define | OLEUI_HANDLES_NOBORDER 0x00000002L
#define | OLEUI_HANDLES_OUTSIDE 0x00000008L
#define | OLEUI_HANDLES_USEINVERSE 0x00000001L
#define | OLEUI_OBJECTMENUMAX 256
#define | OLEUI_SHADE_BORDERIN 2
#define | OLEUI_SHADE_BORDEROUT 3
#define | OLEUI_SHADE_FULLRECT 1
#define | OLEUI_VERSION_MAGIC 0x4D42
#define | OleUIMetafilePictFromIconAndLabel(hIcon, pszLabel, pszSourceFile, iIcon) OleMetafilePictFromIconAndLabel(hIcon, pszLabel, pszSourceFile, iIcon)
#define | PTS_PER_INCH 72
#define | SETDEFAULTFORMATETC(fe, cf, med)
#define | SETFORMATETC(fe, cf, asp, td, med, li)
#define | STGM_DFALL (STGM_READWRITE | STGM_TRANSACTED | STGM_SHARE_EXCLUSIVE)
#define | STGM_DFRALL (STGM_READWRITE | STGM_TRANSACTED | STGM_SHARE_DENY_WRITE)
#define | STGM_SALL (STGM_READWRITE | STGM_SHARE_EXCLUSIVE)
#define | SZOLEUI_MSG_FILEOKSTRING "OLEUI_MSG_FILEOKSTRING"
#define | UPDATELINKS_STARTDELAY 2000

Typedefs

typedef struct tagINTERFACEIMPL | INTERFACEIMPL
typedef UINT(CALLBACK * | LPFNOLEUIHOOK )(HWND, UINT, WPARAM, LPARAM)
typedef struct tagINTERFACEIMPL * | LPINTERFACEIMPL
typedef VOID * | PVOID

Functions

OleStdCopyStatData (LPSTATDATA pDest, LPSTATDATA pSrc)
OleStdCreateStandardPalette (void)
STDAPI | OleStdDestroyAllElements (LPSTORAGE lpStg)
STDAPI | OleStdDoConvert (LPSTORAGE lpStg, REFCLSID rClsidNew)
STDAPI | OleStdDoTreatAsClass (LPOLESTR lpszUserType, REFCLSID rclsid, REFCLSID rclsidNew)
OleStdEnumFmtEtc_Create (ULONG nCount, LPFORMATETC lpEtc)
OleStdEnumStatData_Create (ULONG nCount, LPSTATDATA lpStat)
STDAPI | OleStdGetLinkSourceData (LPMONIKER lpmk, LPCLSID lpClsID, LPFORMATETC lpformatetc, LPSTGMEDIUM lpMedium)
STDAPI | OleStdGetOleObjectData (LPPERSISTSTORAGE lpPStg, LPFORMATETC lpformatetc, LPSTGMEDIUM lpMedium, BOOL fUseMemory)
STDAPI | OleStdMkParseDisplayName (REFCLSID rClsid, LPBC lpbc, LPOLESTR lpszUserName, ULONG FAR *lpchEaten, LPMONIKER FAR *lplpmk)
STDMETHODIMP | OleStdNullMethod (LPUNKNOWN lpThis)
STDAPI | OleStdSetIconInCache (LPOLEOBJECT lpOleObj, HGLOBAL hMetaPict)
STDAPI | OleStdSwitchDisplayAspect (LPOLEOBJECT lpOleObj, LPDWORD lpdwCurAspect, DWORD dwNewAspect, HGLOBAL hMetaPict, BOOL fDeleteOldAspect, BOOL fSetupViewAdvise, LPADVISESINK lpAdviseSink, BOOL FAR *lpfMustUpdate)
STDAPI | OleUICanUnloadNow (void)
STDAPI | OleUILockLibrary (BOOL fLock)
STDAPI_ (LPOLESTR) OleStdCopyString(LPOLESTR lpszSrc
STDAPI_ (LPVOID) OleStdMalloc(ULONG ulSize)
STDAPI_ (LPUNKNOWN) OleStdQueryInterface(LPUNKNOWN lpUnk
STDAPI_ (ULONG) OleStdGetLenFilePrefixOfMoniker(LPMONIKER lpmk)
STDAPI_ (HGLOBAL) OleStdGetData(LPDATAOBJECT lpDataObj
STDAPI_ (HWND) CreateHatchWindow(HWND hWndParent
STDAPI_ (HANDLE) OleStdGetMetafilePictFromOleObject(LPOLEOBJECT lpOleObj
STDAPI_ (int) SetDCToAnisotropic(HDC hDC
STDAPI_ (BOOL) OleStdIsOleLink(LPUNKNOWN lpUnk)
STDAPI_ (LPSTORAGE) OleStdCreateRootStorage(LPOLESTR lpszStgName
STDAPI_ (void) XformRectInPixelsToHimetric(HDC
STDAPI_ (HDC) OleStdCreateDC(DVTARGETDEVICE FAR *ptd)
DWORD FAR * | STDAPI_ (CLIPFORMAT) OleStdGetDefaultFileFormatOfClass(REFCLSID rclsid
STDAPI_ (HICON) OleUIMetafilePictExtractIcon(HGLOBAL)
STDAPI_ (DVTARGETDEVICE FAR *) OleStdCreateTargetDevice(LPPRINTDLG lpPrintDlg)
STDAPI_ (LPMONIKER) OleStdGetFirstMoniker(LPMONIKER lpmk)
STDAPI_ (UINT) OleStdIconLabelTextOut(HDC hDC
WINOLEAPI_ (HGLOBAL) OleUIMetafilePictFromIconAndLabel(HICON

Variables

LPFORMATETC | arrFmtEtc
BOOL
WORD LPOLESTR int | cch
HFONT int int UINT RECT FAR
LPOLESTR UINT 		cchString
LPOLEUIPASTEENTRY int | cEntries
CLIPFORMAT | cfFormat
HDC DWORD UINT | cSize
HDC DWORD UINT | cWidth
CLIPFORMAT DVTARGETDEVICE FAR DWORD | dwAspect
DWORD dwDrawAspect
HDC DWORD | dwFlags
BOOL DWORD dwgrfMode
DWORD dwRegister
DWORD SIZEL POINTL DWORD | dwStatus
DWORD LPOLESTR LPOLESTR
LPADVISESINK BOOL 		fCreate
BOOL fDeleteOnRelease
HDC DWORD UINT BOOL | fDraw
HDC BOOL | fIsLink
HFONT int int UINT | fuOptions
DWORD g_dwObjectCount
DWORD grfMode
HDC | hdc
HFONT | hFont
HGLOBAL
HINSTANCE | hInst
WORD LPOLESTR int HKEY | hKey
HKEY
int
DWORD LPOLESTR LPOLESTR
LPADVISESINK 		lpAdviseSink
LPSTORAGE CLSID FAR CLIPFORMAT
FAR * 		lpcfFmt
LPSTORAGE CLSID FAR * | lpclsid
LPDWORD
LPMONIKER DWORD FAR * | lpdwRegister
HFONT int int UINT RECT FAR
LPOLESTR UINT int FAR * 		lpDX
LPRECT lpHatchRect
UINT FAR LPOLESTR LPMONIKER FAR * | lplpmk
LPSTORAGE CLSID FAR CLIPFORMAT
FAR LPOLESTR FAR * 		lplpszType
LPMALLOC | lpMalloc
LPSTGMEDIUM | lpmedium
CLIPFORMAT DVTARGETDEVICE FAR
DWORD LPSTGMEDIUM 		lpMedium
LPMONIKER | lpmkFull
LPSTR LPSTR LPVOID | lpObj
LPOLESTR
LPOLEUIPASTEENTRY | lpPriorityList
LPRECT LPRECT LPPOINT | lpptOffset
LPRECT LPRECT lprcClipRect
LPRECT lprcHatchRect
LPRECT lprcIPObjRect
LPRECT LPRECT lprcLogical
LPRECT lprcPhysical
LPRECT LPRECT LPRECT LPRECT lprcViewportOld
LPRECT LPRECT LPRECT lprcWindowOld
LPRECT
HFONT int int UINT RECT FAR * | lpRect
LPSIZEL
LPOLESTR DWORD POINTL LPSIZEL | lpSizelHim
LPSTORAGE | lpStg
BOOL FAR | LPSTR
WORD LPOLESTR | lpszAuxUserType
DWORD LPOLESTR lpszContainerApp
DWORD LPOLESTR LPOLESTR lpszContainerObj
LPOLESTR lpszDst
DWORD SIZEL POINTL DWORD LPOLESTR | lpszFullUserTypeName
UINT LPOLESTR lpszIface
LPOLESTR lpszMsg
UINT FAR LPOLESTR | lpszName
LPSTR lpszPrefix
DWORD SIZEL POINTL DWORD
LPOLESTR LPOLESTR 		lpszSrcOfCopy
LPOLESTR lpszStgName
HFONT int int UINT RECT FAR
LPOLESTR 		lpszString
LPOLESTR lpszUserType
CLIPFORMAT DVTARGETDEVICE FAR * | lpTargetDevice
UINT FAR * | lpuUnique
LPFORMATETC int | nFmtEtc
LPSTR LPSTR int | nIndent
LPOLESTR int | nMaxChars
UINT nSizeOfVtbl
HFONT int | nXStart
HFONT int int | nYStart
LPFORMATETC | petcSrc
FORMATETC FAR * | pFetcRight
DWORD SIZEL POINTL | pointl
DWORD LPSIZEL DVTARGETDEVICE FAR * | ptd
DVTARGETDEVICE FAR * | ptdRight
LPSTR LPSTR LPVOID ULONG | refcnt
REFIID | riid
LPSTR SCODE | sc
DWORD SIZEL | sizel
UINT
ULONG ulSize
WORD | wAuxUserType

Define Documentation

#define AreRectsEqual | ( | lprc1,
 |  | lprc2
 | ) |
Value:
(((lprc1->top == lprc2->top) &&     \
     (lprc1->left == lprc2->left) &&   \
     (lprc1->right == lprc2->right) && \
     (lprc1->bottom == lprc2->bottom)) ? TRUE : FALSE)

Definition at line 283 of file OleStd.h.

#define CF_CUSTOMLINKSOURCE TEXT("Custom Link Source")

Definition at line 199 of file OleStd.h.

#define CF_EMBEDDEDOBJECT TEXT("Embedded Object")

Definition at line 197 of file OleStd.h.

#define CF_EMBEDSOURCE TEXT("Embed Source")

Definition at line 196 of file OleStd.h.

#define CF_FILENAME TEXT("FileName")

Definition at line 203 of file OleStd.h.

#define CF_LINKSOURCE TEXT("Link Source")

Definition at line 198 of file OleStd.h.

#define CF_LINKSRCDESCRIPTOR TEXT("Link Source Descriptor")

Definition at line 201 of file OleStd.h.

#define CF_OBJECTDESCRIPTOR TEXT("Object Descriptor")

Definition at line 200 of file OleStd.h.

#define CF_OWNERLINK TEXT("OwnerLink")

Definition at line 202 of file OleStd.h.

#define DD_DEFDRAGDELAY 200

Definition at line 232 of file OleStd.h.

#define DD_DEFDRAGMINDIST 2

Definition at line 236 of file OleStd.h.

#define DD_DEFSCROLLINTERVAL 50

Definition at line 228 of file OleStd.h.

#define DEFAULT_HATCHBORDER_WIDTH 4

Definition at line 1091 of file OleStd.h.

#define EMBEDDINGFLAG "Embedding"

Definition at line 274 of file OleStd.h.

#define EXPORT __export

Definition at line 775 of file OleStd.h.

#define GetIconOfClass | ( | hInst,
 |  | rclsid,
 |  | lpszLabel,
 |  | fUseTypeAsLabel |
 | ) |  | OleGetIconOfClass(rclsid, lpszLabel, fUseTypeAsLabel)

Definition at line 164 of file OleStd.h.

#define GetIconOfFile | ( | hInst,
 |  | lpszFileName,
 |  | fUseFileAsLabel |
 | ) |  | OleGetIconOfFile(lpszFileName, fUseFileAsLabel)

Definition at line 161 of file OleStd.h.

#define HIMETRIC_PER_INCH 2540

Definition at line 276 of file OleStd.h.

#define ID_BROWSE 130

Definition at line 978 of file OleStd.h.

#define ID_CURRENT 121

Definition at line 969 of file OleStd.h.

#define ID_CURRENTICON 122

Definition at line 970 of file OleStd.h.

#define ID_DEFAULT 123

Definition at line 971 of file OleStd.h.

#define ID_DEFAULTICON 124

Definition at line 972 of file OleStd.h.

#define ID_DUMMY 999

Definition at line 1061 of file OleStd.h.

#define ID_EL_AUTOMATIC 202

Definition at line 946 of file OleStd.h.

#define ID_EL_CANCELLINK 209

Definition at line 948 of file OleStd.h.

#define ID_EL_CHANGESOURCE 201

Definition at line 945 of file OleStd.h.

#define ID_EL_CLOSE 208

Definition at line 947 of file OleStd.h.

#define ID_EL_COL1 220

Definition at line 957 of file OleStd.h.

#define ID_EL_COL2 221

Definition at line 958 of file OleStd.h.

#define ID_EL_COL3 222

Definition at line 959 of file OleStd.h.

#define ID_EL_LINKSLISTBOX 206

Definition at line 956 of file OleStd.h.

#define ID_EL_LINKSOURCE 216

Definition at line 952 of file OleStd.h.

#define ID_EL_LINKTYPE 217

Definition at line 953 of file OleStd.h.

#define ID_EL_MANUAL 212

Definition at line 951 of file OleStd.h.

#define ID_EL_NULL -1

Definition at line 955 of file OleStd.h.

#define ID_EL_OPENSOURCE 211

Definition at line 950 of file OleStd.h.

#define ID_EL_UPDATE 218

Definition at line 954 of file OleStd.h.

#define ID_EL_UPDATENOW 210

Definition at line 949 of file OleStd.h.

#define ID_FROMFILE 125

Definition at line 973 of file OleStd.h.

#define ID_FROMFILEEDIT 126

Definition at line 974 of file OleStd.h.

#define ID_GROUP 120

Definition at line 968 of file OleStd.h.

#define ID_ICONLIST 127

Definition at line 975 of file OleStd.h.

#define ID_IO_CHANGEICON 2105

Definition at line 886 of file OleStd.h.

#define ID_IO_CREATEFROMFILE 2101

Definition at line 882 of file OleStd.h.

#define ID_IO_CREATENEW 2100

Definition at line 881 of file OleStd.h.

#define ID_IO_DISPLAYASICON 2104

Definition at line 885 of file OleStd.h.

#define ID_IO_FILE 2106

Definition at line 887 of file OleStd.h.

#define ID_IO_FILEDISPLAY 2107

Definition at line 888 of file OleStd.h.

#define ID_IO_FILETEXT 2112

Definition at line 893 of file OleStd.h.

#define ID_IO_FILETYPE 2113

Definition at line 894 of file OleStd.h.

#define ID_IO_ICONDISPLAY 2110

Definition at line 891 of file OleStd.h.

#define ID_IO_LINKFILE 2102

Definition at line 883 of file OleStd.h.

#define ID_IO_OBJECTTYPELIST 2103

Definition at line 884 of file OleStd.h.

#define ID_IO_OBJECTTYPETEXT 2111

Definition at line 892 of file OleStd.h.

#define ID_IO_RESULTIMAGE 2108

Definition at line 889 of file OleStd.h.

#define ID_IO_RESULTTEXT 2109

Definition at line 890 of file OleStd.h.

#define ID_LABEL 128

Definition at line 976 of file OleStd.h.

#define ID_LABELEDIT 129

Definition at line 977 of file OleStd.h.

#define ID_OLEUIHELP 99

Definition at line 840 of file OleStd.h.

#define ID_PS_CHANGEICON 508

Definition at line 920 of file OleStd.h.

#define ID_PS_DISPLAYASICON 506

Definition at line 918 of file OleStd.h.

#define ID_PS_DISPLAYLIST 505

Definition at line 917 of file OleStd.h.

#define ID_PS_ICONDISPLAY 507

Definition at line 919 of file OleStd.h.

#define ID_PS_PASTE 500

Definition at line 912 of file OleStd.h.

#define ID_PS_PASTELINK 501

Definition at line 913 of file OleStd.h.

#define ID_PS_PASTELINKLIST 504

Definition at line 916 of file OleStd.h.

#define ID_PS_PASTELIST 503

Definition at line 915 of file OleStd.h.

#define ID_PS_RESULTGROUP 511

Definition at line 923 of file OleStd.h.

#define ID_PS_RESULTIMAGE 509

Definition at line 921 of file OleStd.h.

#define ID_PS_RESULTTEXT 510

Definition at line 922 of file OleStd.h.

#define ID_PS_SOURCETEXT 502

Definition at line 914 of file OleStd.h.

#define ID_PS_STXAS 513

Definition at line 925 of file OleStd.h.

#define ID_PS_STXSOURCE 512

Definition at line 924 of file OleStd.h.

#define ID_PU_BROWSE 904

Definition at line 1055 of file OleStd.h.

#define ID_PU_CONVERT 902

Definition at line 1054 of file OleStd.h.

#define ID_PU_LINKS 900

Definition at line 1052 of file OleStd.h.

#define ID_PU_METER 905

Definition at line 1056 of file OleStd.h.

#define ID_PU_PERCENT 906

Definition at line 1057 of file OleStd.h.

#define ID_PU_STOP 907

Definition at line 1058 of file OleStd.h.

#define ID_PU_TEXT 901

Definition at line 1053 of file OleStd.h.

#define ID_RESULTICON 132

Definition at line 979 of file OleStd.h.

#define ID_RESULTLABEL 133

Definition at line 980 of file OleStd.h.

#define ID_STATIC 98

Definition at line 844 of file OleStd.h.

#define IDB_RESULTSEGA 32325

Definition at line 820 of file OleStd.h.

#define IDB_RESULTSHIRESVGA 32327

Definition at line 822 of file OleStd.h.

#define IDB_RESULTSVGA 32326

Definition at line 821 of file OleStd.h.

#define IDBZ_ICON 601

Definition at line 1026 of file OleStd.h.

#define IDBZ_MESSAGE1 602

Definition at line 1027 of file OleStd.h.

#define IDBZ_RETRY 600

Definition at line 1025 of file OleStd.h.

#define IDBZ_SWITCHTO 604

Definition at line 1028 of file OleStd.h.

#define IDCV_ACTIVATEAS 156

Definition at line 1001 of file OleStd.h.

#define IDCV_ACTIVATELIST 154

Definition at line 999 of file OleStd.h.

#define IDCV_CHANGEICON 153

Definition at line 998 of file OleStd.h.

#define IDCV_CONVERTLIST 158

Definition at line 1003 of file OleStd.h.

#define IDCV_CONVERTTO 155

Definition at line 1000 of file OleStd.h.

#define IDCV_DISPLAYASICON 152

Definition at line 997 of file OleStd.h.

#define IDCV_GRPRESULT 163

Definition at line 1008 of file OleStd.h.

#define IDCV_ICON 159

Definition at line 1004 of file OleStd.h.

#define IDCV_ICONLABEL1 160

Definition at line 1005 of file OleStd.h.

#define IDCV_ICONLABEL2 161

Definition at line 1006 of file OleStd.h.

#define IDCV_OBJECTTYPE 150

Definition at line 996 of file OleStd.h.

#define IDCV_RESULTTEXT 157

Definition at line 1002 of file OleStd.h.

#define IDCV_STXCONVERTTO 164

Definition at line 1009 of file OleStd.h.

#define IDCV_STXCURTYPE 162

Definition at line 1007 of file OleStd.h.

#define IDD_FILEOPEN 32253

Definition at line 795 of file OleStd.h.

#define IDS_BROWSE 32322

Definition at line 817 of file OleStd.h.

#define IDS_BZRESULTTEXTBUSY 32447

Definition at line 1031 of file OleStd.h.

#define IDS_BZRESULTTEXTNOTRESPONDING 32448

Definition at line 1032 of file OleStd.h.

#define IDS_CHANGEADDITIONALLINKS 32460

Definition at line 1045 of file OleStd.h.

#define IDS_CHANGESOURCE 32455

Definition at line 1040 of file OleStd.h.

#define IDS_CIFILEACCESS 32432

Definition at line 985 of file OleStd.h.

#define IDS_CIFILEOPENFAIL 32434

Definition at line 987 of file OleStd.h.

#define IDS_CIFILESHARE 32433

Definition at line 986 of file OleStd.h.

#define IDS_CIINVALIDFILE 32431

Definition at line 984 of file OleStd.h.

#define IDS_CINOICONSINFILE 32430

Definition at line 983 of file OleStd.h.

#define IDS_CLOSE 32461

Definition at line 1046 of file OleStd.h.

#define IDS_CVRESULTACTIVATEAS 32444

Definition at line 1016 of file OleStd.h.

#define IDS_CVRESULTACTIVATEDIFF 32445

Definition at line 1017 of file OleStd.h.

#define IDS_CVRESULTCONVERTLINK 32440

Definition at line 1012 of file OleStd.h.

#define IDS_CVRESULTCONVERTTO 32441

Definition at line 1013 of file OleStd.h.

#define IDS_CVRESULTDISPLAYASICON 32443

Definition at line 1015 of file OleStd.h.

#define IDS_CVRESULTNOCHANGE 32442

Definition at line 1014 of file OleStd.h.

#define IDS_DEFICONLABEL 32310

Definition at line 811 of file OleStd.h.

#define IDS_ERR_ADDSTRING 32459

Definition at line 1044 of file OleStd.h.

#define IDS_ERR_GETLINKSOURCE 32457

Definition at line 1042 of file OleStd.h.

#define IDS_ERR_GETLINKUPDATEOPTIONS 32458

Definition at line 1043 of file OleStd.h.

#define IDS_FAILED 32454

Definition at line 1039 of file OleStd.h.

#define IDS_FILTERS 32320

Definition at line 815 of file OleStd.h.

#define IDS_ICONFILTERS 32321

Definition at line 816 of file OleStd.h.

#define IDS_INVALIDSOURCE 32456

Definition at line 1041 of file OleStd.h.

#define IDS_IORESULTFROMFILE1 32402

Definition at line 899 of file OleStd.h.

#define IDS_IORESULTFROMFILE2 32403

Definition at line 900 of file OleStd.h.

#define IDS_IORESULTFROMFILEICON2 32404

Definition at line 901 of file OleStd.h.

#define IDS_IORESULTLINKFILE1 32405

Definition at line 902 of file OleStd.h.

#define IDS_IORESULTLINKFILE2 32406

Definition at line 903 of file OleStd.h.

#define IDS_IORESULTLINKFILEICON1 32407

Definition at line 904 of file OleStd.h.

#define IDS_IORESULTLINKFILEICON2 32408

Definition at line 905 of file OleStd.h.

#define IDS_IORESULTNEW 32400

Definition at line 897 of file OleStd.h.

#define IDS_IORESULTNEWICON 32401

Definition at line 898 of file OleStd.h.

#define IDS_LINK_AUTO 32450

Definition at line 1035 of file OleStd.h.

#define IDS_LINK_MANUAL 32451

Definition at line 1036 of file OleStd.h.

#define IDS_LINK_UNKNOWN 32452

Definition at line 1037 of file OleStd.h.

#define IDS_LINKS 32453

Definition at line 1038 of file OleStd.h.

#define IDS_OLE2UICONVERT 32304

Definition at line 804 of file OleStd.h.

#define IDS_OLE2UIEDIT 32303

Definition at line 803 of file OleStd.h.

#define IDS_OLE2UIEDITLINKCMD_1VERB 32305

Definition at line 805 of file OleStd.h.

#define IDS_OLE2UIEDITLINKCMD_NVERB 32307

Definition at line 807 of file OleStd.h.

#define IDS_OLE2UIEDITNOOBJCMD 32309

Definition at line 809 of file OleStd.h.

#define IDS_OLE2UIEDITOBJECTCMD_1VERB 32306

Definition at line 806 of file OleStd.h.

#define IDS_OLE2UIEDITOBJECTCMD_NVERB 32308

Definition at line 808 of file OleStd.h.

#define IDS_OLE2UILINK 32301

Definition at line 801 of file OleStd.h.

#define IDS_OLE2UIOBJECT 32302

Definition at line 802 of file OleStd.h.

#define IDS_OLE2UIPASTELINKEDTYPE 32311

Definition at line 812 of file OleStd.h.

#define IDS_OLE2UIUNKNOWN 32300

Definition at line 800 of file OleStd.h.

#define IDS_OLESTDDISKFULL 702

Definition at line 64 of file OleStd.h.

#define IDS_OLESTDNOCREATEFILE 700

Definition at line 62 of file OleStd.h.

#define IDS_OLESTDNOOPENFILE 701

Definition at line 63 of file OleStd.h.

#define IDS_PSNONOLE 32416

Definition at line 934 of file OleStd.h.

#define IDS_PSPASTEDATA 32410

Definition at line 928 of file OleStd.h.

#define IDS_PSPASTELINKDATA 32413

Definition at line 931 of file OleStd.h.

#define IDS_PSPASTELINKOBJECT 32414

Definition at line 932 of file OleStd.h.

#define IDS_PSPASTELINKOBJECTASICON 32415

Definition at line 933 of file OleStd.h.

#define IDS_PSPASTEOBJECT 32411

Definition at line 929 of file OleStd.h.

#define IDS_PSPASTEOBJECTASICON 32412

Definition at line 930 of file OleStd.h.

#define IDS_PSUNKNOWNAPP 32419

Definition at line 937 of file OleStd.h.

#define IDS_PSUNKNOWNSRC 32418

Definition at line 936 of file OleStd.h.

#define IDS_PSUNKNOWNTYPE 32417

Definition at line 935 of file OleStd.h.

#define INIT_INTERFACEIMPL | ( | lpIFace,
 |  | pVtbl,
 |  | pBack
 | ) |
Value:
((lpIFace)->lpVtbl = pVtbl, \
         ((LPINTERFACEIMPL)(lpIFace))->lpBack = (LPVOID)pBack,   \
         ((LPINTERFACEIMPL)(lpIFace))->cRef = 0  \
      )

Definition at line 78 of file OleStd.h.

#define IsEqualFORMATETC | ( | fe1,
 |  | fe2 |
 | ) |  | (OleStdCompareFormatEtc(&(fe1), &(fe2))==0)

Definition at line 192 of file OleStd.h.

#define LSTRCPYN | ( | lpdst,
 |  | lpsrc,
 |  | cch
 | ) |
Value:
(\
   (lpdst)[(cch)-1] = '\0', \
   ((cch)>1 ? _fstrncpy(lpdst, lpsrc, (cch)-1) : 0)\
)

Definition at line 289 of file OleStd.h.

#define MAP_LOGHIM_TO_PIX | ( | x,
 |  | ppli |
 | ) |  | MulDiv((ppli), (x), HIMETRIC_PER_INCH)

Definition at line 280 of file OleStd.h.

#define MAP_PIX_TO_LOGHIM | ( | x,
 |  | ppli |
 | ) |  | MulDiv(HIMETRIC_PER_INCH, (x), (ppli))

Definition at line 279 of file OleStd.h.

#define NONAMELESSUNION

Definition at line 25 of file OleStd.h.

#define OLEDBG_BEGIN ( lpsz )

Definition at line 449 of file OleStd.h.

#define OLEDBG_BEGIN1 ( lpsz )

Definition at line 461 of file OleStd.h.

#define OLEDBG_BEGIN2 ( lpsz )

Definition at line 462 of file OleStd.h.

#define OLEDBG_BEGIN3 ( lpsz )

Definition at line 463 of file OleStd.h.

#define OLEDBG_BEGIN4 ( lpsz )

Definition at line 464 of file OleStd.h.

#define OLEDBG_END

Definition at line 450 of file OleStd.h.

#define OLEDBG_END1

Definition at line 465 of file OleStd.h.

#define OLEDBG_END2

Definition at line 466 of file OleStd.h.

#define OLEDBG_END3

Definition at line 467 of file OleStd.h.

#define OLEDBG_END4

Definition at line 468 of file OleStd.h.

#define OleDbgAddRefMethod | ( | lpThis,
 |  | iface
 | ) |

Definition at line 118 of file OleStd.h.

#define OleDbgAssert ( a )

Definition at line 443 of file OleStd.h.

#define OleDbgAssertSz | ( | a,
 |  | b
 | ) |

Definition at line 444 of file OleStd.h.

#define OLEDBGDATA

Definition at line 442 of file OleStd.h.

#define OLEDBGDATA_MAIN ( szPrefix )

Definition at line 441 of file OleStd.h.

#define OleDbgOut ( lpsz )

Definition at line 451 of file OleStd.h.

#define OleDbgOut1 ( lpsz )

Definition at line 452 of file OleStd.h.

#define OleDbgOut2 ( lpsz )

Definition at line 453 of file OleStd.h.

#define OleDbgOut3 ( lpsz )

Definition at line 454 of file OleStd.h.

#define OleDbgOut4 ( lpsz )

Definition at line 455 of file OleStd.h.

#define OleDbgOutHResult | ( | lpsz,
 |  | hr
 | ) |

Definition at line 447 of file OleStd.h.

#define OleDbgOutNoPrefix ( lpsz )

Definition at line 456 of file OleStd.h.

#define OleDbgOutNoPrefix1 ( lpsz )

Definition at line 457 of file OleStd.h.

#define OleDbgOutNoPrefix2 ( lpsz )

Definition at line 458 of file OleStd.h.

#define OleDbgOutNoPrefix3 ( lpsz )

Definition at line 459 of file OleStd.h.

#define OleDbgOutNoPrefix4 ( lpsz )

Definition at line 460 of file OleStd.h.

#define OleDbgOutRect | ( | lpsz,
 |  | lpRect
 | ) |

Definition at line 474 of file OleStd.h.

#define OleDbgOutRect1 | ( | lpsz,
 |  | lpRect
 | ) |

Definition at line 475 of file OleStd.h.

#define OleDbgOutRect2 | ( | lpsz,
 |  | lpRect
 | ) |

Definition at line 476 of file OleStd.h.

#define OleDbgOutRect3 | ( | lpsz,
 |  | lpRect
 | ) |

Definition at line 477 of file OleStd.h.

#define OleDbgOutRect4 | ( | lpsz,
 |  | lpRect
 | ) |

Definition at line 478 of file OleStd.h.

#define OleDbgOutRefCnt | ( | lpsz,
 |  | lpObj,
 |  | refcnt
 | ) |

Definition at line 469 of file OleStd.h.

#define OleDbgOutRefCnt1 | ( | lpsz,
 |  | lpObj,
 |  | refcnt
 | ) |

Definition at line 470 of file OleStd.h.

#define OleDbgOutRefCnt2 | ( | lpsz,
 |  | lpObj,
 |  | refcnt
 | ) |

Definition at line 471 of file OleStd.h.

#define OleDbgOutRefCnt3 | ( | lpsz,
 |  | lpObj,
 |  | refcnt
 | ) |

Definition at line 472 of file OleStd.h.

#define OleDbgOutRefCnt4 | ( | lpsz,
 |  | lpObj,
 |  | refcnt
 | ) |

Definition at line 473 of file OleStd.h.

#define OleDbgOutScode | ( | lpsz,
 |  | sc
 | ) |

Definition at line 448 of file OleStd.h.

#define OleDbgQueryInterfaceMethod ( lpUnk )

Definition at line 117 of file OleStd.h.

#define OleDbgReleaseMethod | ( | lpThis,
 |  | iface
 | ) |

Definition at line 119 of file OleStd.h.

#define OleDbgVerify ( a ) (a)

Definition at line 445 of file OleStd.h.

#define OleDbgVerifySz | ( | a,
 |  | b |
 | ) |  | (a)

Definition at line 446 of file OleStd.h.

#define OLESTDCANCELRETRY (DWORD)-1

Definition at line 145 of file OleStd.h.

#define OleStdCopyMetafilePict | ( | hpictin,
 |  | phpictout |
 | ) |  | (*(phpictout) = OleDuplicateData(hpictin,CF_METAFILEPICT,GHND|GMEM_SHARE))

Definition at line 222 of file OleStd.h.

#define OLESTDDROP_DEFAULT 1

Definition at line 266 of file OleStd.h.

#define OLESTDDROP_NONDEFAULT 2

Definition at line 267 of file OleStd.h.

#define OLESTDDROP_NONE 0

Definition at line 265 of file OleStd.h.

#define OleStdGetDropEffect ( grfKeyState )
Value:
( (grfKeyState & MK_CONTROL) ?          \
      ( (grfKeyState & MK_SHIFT) ? DROPEFFECT_LINK : DROPEFFECT_COPY ) :  \
      ( (grfKeyState & MK_SHIFT) ? DROPEFFECT_MOVE : 0 ) )

Definition at line 259 of file OleStd.h.

#define OleStdQueryFormatMedium | ( | lpformatetc,
 |  | tymd
 | ) |
Value:
(((lpformatetc)->tymed & tymd) ?    \
         NOERROR : ResultFromScode(DV_E_FORMATETC))

Definition at line 217 of file OleStd.h.

#define OleStdQueryLinkSourceData ( lpformatetc )
Value:
(((lpformatetc)->tymed & TYMED_ISTREAM) ?    \
         NOERROR : ResultFromScode(DV_E_FORMATETC))

Definition at line 209 of file OleStd.h.

#define OleStdQueryObjectDescriptorData ( lpformatetc )
Value:
(((lpformatetc)->tymed & TYMED_HGLOBAL) ?    \
         NOERROR : ResultFromScode(DV_E_FORMATETC))

Definition at line 213 of file OleStd.h.

#define OleStdQueryOleObjectData ( lpformatetc )
Value:
(((lpformatetc)->tymed & TYMED_ISTORAGE) ?    \
         NOERROR : ResultFromScode(DV_E_FORMATETC))

Definition at line 205 of file OleStd.h.

#define OLESTDRETRYDELAY (DWORD)5000

Definition at line 140 of file OleStd.h.

#define OLEUI_CCHCLSIDSTRING 39

Definition at line 861 of file OleStd.h.

#define OLEUI_CCHFILEMAX 13

Definition at line 855 of file OleStd.h.

#define OLEUI_CCHKEYMAX 256

Definition at line 847 of file OleStd.h.

#define OLEUI_CCHLABELMAX 40

Definition at line 858 of file OleStd.h.

#define OLEUI_CCHPATHMAX 256

Definition at line 854 of file OleStd.h.

#define OLEUI_CCHVERBMAX 32

Definition at line 850 of file OleStd.h.

#define OLEUI_HANDLES_INSIDE 0x00000004L

Definition at line 1074 of file OleStd.h.

#define OLEUI_HANDLES_NOBORDER 0x00000002L

Definition at line 1073 of file OleStd.h.

#define OLEUI_HANDLES_OUTSIDE 0x00000008L

Definition at line 1075 of file OleStd.h.

#define OLEUI_HANDLES_USEINVERSE 0x00000001L

Definition at line 1072 of file OleStd.h.

#define OLEUI_OBJECTMENUMAX 256

Definition at line 851 of file OleStd.h.

#define OLEUI_SHADE_BORDERIN 2

Definition at line 1079 of file OleStd.h.

#define OLEUI_SHADE_BORDEROUT 3

Definition at line 1080 of file OleStd.h.

#define OLEUI_SHADE_FULLRECT 1

Definition at line 1078 of file OleStd.h.

#define OLEUI_VERSION_MAGIC 0x4D42

Definition at line 1105 of file OleStd.h.

#define OleUIMetafilePictFromIconAndLabel | ( | hIcon,
 |  | pszLabel,
 |  | pszSourceFile,
 |  | iIcon |
 | ) |  | OleMetafilePictFromIconAndLabel(hIcon, pszLabel, pszSourceFile, iIcon)

Definition at line 167 of file OleStd.h.

#define PTS_PER_INCH 72

Definition at line 277 of file OleStd.h.

#define SETDEFAULTFORMATETC | ( | fe,
 |  | cf,
 |  | med
 | ) |
Value:
((fe).cfFormat=cf, \
    (fe).dwAspect=DVASPECT_CONTENT, \
    (fe).ptd=NULL, \
    (fe).tymed=med, \
    (fe).lindex=-1)

Definition at line 184 of file OleStd.h.

#define SETFORMATETC | ( | fe,
 |  | cf,
 |  | asp,
 |  | td,
 |  | med,
 |  | li
 | ) |
Value:
((fe).cfFormat=cf, \
    (fe).dwAspect=asp, \
    (fe).ptd=td, \
    (fe).tymed=med, \
    (fe).lindex=li)

Definition at line 176 of file OleStd.h.

#define STGM_DFALL (STGM_READWRITE | STGM_TRANSACTED | STGM_SHARE_EXCLUSIVE)

Definition at line 130 of file OleStd.h.

#define STGM_DFRALL (STGM_READWRITE | STGM_TRANSACTED | STGM_SHARE_DENY_WRITE)

Definition at line 129 of file OleStd.h.

#define STGM_SALL (STGM_READWRITE | STGM_SHARE_EXCLUSIVE)

Definition at line 131 of file OleStd.h.

#define SZOLEUI_MSG_FILEOKSTRING "OLEUI_MSG_FILEOKSTRING"

Definition at line 836 of file OleStd.h.

#define UPDATELINKS_STARTDELAY 2000

Definition at line 751 of file OleStd.h.

Typedef Documentation

typedef struct tagINTERFACEIMPL INTERFACEIMPL
typedef UINT(CALLBACK * LPFNOLEUIHOOK)(HWND, UINT, WPARAM, LPARAM)

Definition at line 832 of file OleStd.h.

typedef struct tagINTERFACEIMPL* LPINTERFACEIMPL
typedef BOOL *typedef PVOID

Definition at line 827 of file OleStd.h.

Function Documentation

OleStdCopyStatData | ( | LPSTATDATA | pDest,
 |  | LPSTATDATA | pSrc
 | ) |  |

Definition at line 53 of file enumStat.c.

{
  if ((pDest == NULL) || (pSrc == NULL)) {
   return FALSE;
  }

  if (OleStdCopyFormatEtc(&pDest->formatetc, &pSrc->formatetc) == FALSE) {
   return FALSE;
  }

  pDest->advf = pSrc->advf;
  pDest->pAdvSink = pSrc->pAdvSink;
  pDest->dwConnection = pSrc->dwConnection;

  if (pDest->pAdvSink != NULL) {
   pDest->pAdvSink->lpVtbl->AddRef(pDest->pAdvSink);
  }

  return TRUE;

} /* OleStdCopyStatData()

OleStdCreateStandardPalette ( void )
STDAPI OleStdDestroyAllElements ( LPSTORAGE lpStg )

Definition at line 2969 of file OleStd.c.

{
   IEnumSTATSTG FAR* lpEnum;
   STATSTG sstg;
   HRESULT hrErr;

   hrErr = lpStg->lpVtbl->EnumElements(
         lpStg, 0, NULL, 0, (IEnumSTATSTG FAR* FAR*)&lpEnum);

   if (hrErr != NOERROR)
      return hrErr;

   while (1) {
      if (lpEnum->lpVtbl->Next(lpEnum, 1, &sstg, NULL) != NOERROR)
         break;
      lpStg->lpVtbl->DestroyElement(lpStg, sstg.pwcsName);
      OleStdFree(sstg.pwcsName);
   }
   lpEnum->lpVtbl->Release(lpEnum);
   return NOERROR;
}

STDAPI OleStdDoConvert | ( | LPSTORAGE | lpStg,
 |  | REFCLSID | rClsidNew
 | ) |  |

Definition at line 380 of file OleStd.c.

{
   HRESULT error;
   CLSID clsidOld;
   CLIPFORMAT cfOld;
   LPOLESTR lpszOld = NULL;
   OLECHAR szNew[OLEUI_CCHKEYMAX];

   if ((error = ReadClassStg(lpStg, &clsidOld)) != NOERROR) {
      clsidOld = CLSID_NULL;
      goto errRtn;
   }

   // read old fmt/old user type; sets out params to NULL on error
   error = ReadFmtUserTypeStg(lpStg, &cfOld, &lpszOld);
   OleDbgAssert(error == NOERROR || (cfOld == 0 && lpszOld == NULL));

   // get new user type name; if error, set to NULL string
   if (OleStdGetUserTypeOfClass(
         (LPCLSID)rClsidNew, szNew, OLEUI_CCHKEYMAX,NULL /* hKey */) == 0)
      OLESTRCPY (szNew, OLESTR (""));

   // write class stg
   if ((error = WriteClassStg(lpStg, rClsidNew)) != NOERROR)
      goto errRtn;

   // write old fmt/new user type;
   if ((error = WriteFmtUserTypeStg(lpStg, cfOld, szNew)) != NOERROR)
      goto errRewriteInfo;

   // set convert bit
   if ((error = SetConvertStg(lpStg, TRUE)) != NOERROR)
      goto errRewriteInfo;

   goto okRtn;

errRewriteInfo:
   (void)WriteClassStg(lpStg, &clsidOld);
   (void)WriteFmtUserTypeStg(lpStg, cfOld, lpszOld);

errRtn:

okRtn:
   OleStdFreeString(lpszOld, NULL);
   return error;
}

STDAPI OleStdDoTreatAsClass | ( | LPOLESTR | lpszUserType,
 |  | REFCLSID | rclsid,
 |  | REFCLSID | rclsidNew
 | ) |  |

Definition at line 513 of file OleStd.c.

{
   HRESULT hrErr;
   LPOLESTR   lpszCLSID = NULL;
   char       lpszAnsiCLSID[256];
   LONG    lRet;
   HKEY    hKey;
   char    lpszAnsiUserType[256];

   OLEDBG_BEGIN2("CoTreatAsClass called\r\n")
   hrErr = CoTreatAsClass(rclsid, rclsidNew);
   OLEDBG_END2

   if ((hrErr != NOERROR) && lpszUserType) {
      lRet = RegOpenKey(HKEY_CLASSES_ROOT, (LPCSTR)"CLSID",
            (HKEY FAR *)&hKey);
      StringFromCLSID(rclsid, /*(LPOLESTR FAR*)*/&lpszCLSID);
      W2A (lpszCLSID, lpszAnsiCLSID, 256);
      W2A (lpszUserType, lpszAnsiUserType, 256);
      RegSetValue(hKey, lpszAnsiCLSID, REG_SZ, lpszAnsiUserType,
            lstrlen(lpszAnsiUserType));

      if (lpszCLSID)
         OleStdFreeString(lpszCLSID, NULL);

      hrErr = CoTreatAsClass(rclsid, rclsidNew);
      RegCloseKey(hKey);
   }

   return hrErr;
}

OleStdEnumFmtEtc_Create | ( | ULONG | nCount,
 |  | LPFORMATETC | lpEtc
 | ) |  |

Definition at line 54 of file enumfetc.c.

{
  LPMALLOC lpMalloc=NULL;
  LPOLESTDENUMFMTETC lpEF=NULL;
  DWORD dwSize;
  WORD i;
  HRESULT hRes;

  hRes = CoGetMalloc(MEMCTX_TASK, &lpMalloc);
  if (hRes != NOERROR) {
        return NULL;
  }

  lpEF = (LPOLESTDENUMFMTETC)lpMalloc->lpVtbl->Alloc(lpMalloc,
                                                                                sizeof(OLESTDENUMFMTETC));
  if (lpEF == NULL) {
        goto errReturn;
  }

  lpEF->lpVtbl = &g_EnumFORMATETCVtbl;
  lpEF->m_dwRefs = 1;
  lpEF->m_nCount = nCount;
  lpEF->m_nIndex = 0;

  dwSize = sizeof(FORMATETC) * lpEF->m_nCount;

  lpEF->m_lpEtc = (LPFORMATETC)lpMalloc->lpVtbl->Alloc(lpMalloc, dwSize);
  if (lpEF->m_lpEtc == NULL)
        goto errReturn;

  lpMalloc->lpVtbl->Release(lpMalloc);

  for (i=0; i<nCount; i++) {
        OleStdCopyFormatEtc(
                        (LPFORMATETC)&(lpEF->m_lpEtc[i]), (LPFORMATETC)&(lpEtc[i]));
  }

  g_dwObjectCount++ ;

  return (LPENUMFORMATETC)lpEF;

errReturn:
  if (lpEF != NULL)
        lpMalloc->lpVtbl->Free(lpMalloc, lpEF);

  if (lpMalloc != NULL)
        lpMalloc->lpVtbl->Release(lpMalloc);

  return NULL;

} /* OleStdEnumFmtEtc_Create()

OleStdEnumStatData_Create | ( | ULONG | nCount,
 |  | LPSTATDATA | lpStat
 | ) |  |

Definition at line 80 of file enumStat.c.

{
  LPMALLOC lpMalloc=NULL;
  LPOLESTDENUMSTATDATA lpSD=NULL;
  DWORD dwSize;
  WORD i;
  HRESULT hRes;

  hRes = CoGetMalloc(MEMCTX_TASK, &lpMalloc);
  if (hRes != NOERROR) {
   return NULL;
  }

  lpSD = (LPOLESTDENUMSTATDATA)lpMalloc->lpVtbl->Alloc(lpMalloc,
                                     sizeof(OLESTDENUMSTATDATA));
  if (lpSD == NULL) {
   goto errReturn;
  }

  lpSD->lpVtbl = &g_EnumSTATDATAVtbl;
  lpSD->m_dwRefs = 1;
  lpSD->m_nCount = nCount;
  lpSD->m_nIndex = 0;

  dwSize = sizeof(STATDATA) * lpSD->m_nCount;

  lpSD->m_lpStat = (LPSTATDATA)lpMalloc->lpVtbl->Alloc(lpMalloc, dwSize);
  if (lpSD->m_lpStat == NULL)
   goto errReturn;

  lpMalloc->lpVtbl->Release(lpMalloc);

  for (i=0; i<nCount; i++) {
   OleStdCopyStatData(
         (LPSTATDATA)&(lpSD->m_lpStat[i]), (LPSTATDATA)&(lpStatOrg[i]));
  }

  g_dwObjectCount++ ;

  return (LPENUMSTATDATA)lpSD;

errReturn:
  if (lpSD != NULL)
   lpMalloc->lpVtbl->Free(lpMalloc, lpSD);

  if (lpMalloc != NULL)
   lpMalloc->lpVtbl->Release(lpMalloc);

  return NULL;

} /* OleStdEnumStatData_Create()

STDAPI OleStdGetLinkSourceData | ( | LPMONIKER | lpmk,
 |  | LPCLSID | lpClsID,
 |  | LPFORMATETC | lpformatetc,
 |  | LPSTGMEDIUM | lpMedium
 | ) |  |

Definition at line 1047 of file OleStd.c.

{
   LPSTREAM    lpstm = NULL;
   DWORD       reserved = 0;
   HRESULT     hrErr;

   if (lpMedium->tymed == TYMED_NULL) {
      if (lpformatetc->tymed & TYMED_ISTREAM) {
         hrErr = CreateStreamOnHGlobal(
               NULL, /* auto allocate */
               TRUE, /* delete on release */
               (LPSTREAM FAR*)&lpstm
         );
         if (hrErr != NOERROR) {
            lpMedium->pUnkForRelease = NULL;
            return E_OUTOFMEMORY;
         }
         lpMedium->u.pstm = lpstm;
         lpMedium->tymed = TYMED_ISTREAM;
         lpMedium->pUnkForRelease = NULL;
      } else {
         lpMedium->pUnkForRelease = NULL;
         return DATA_E_FORMATETC;
      }
   } else {
      if (lpMedium->tymed == TYMED_ISTREAM) {
         lpMedium->tymed = TYMED_ISTREAM;
         lpMedium->u.pstm = lpMedium->u.pstm;
         lpMedium->pUnkForRelease = NULL;
      } else {
         lpMedium->pUnkForRelease = NULL;
         return DATA_E_FORMATETC;
      }
   }

   hrErr = OleSaveToStream((LPPERSISTSTREAM)lpmk, lpMedium->u.pstm);
   if (hrErr != NOERROR) return hrErr;
   return WriteClassStm(lpMedium->u.pstm, lpClsID);
}

STDAPI OleStdGetOleObjectData | ( | LPPERSISTSTORAGE | lpPStg,
 |  | LPFORMATETC | lpformatetc,
 |  | LPSTGMEDIUM | lpMedium,
 |  | BOOL | fUseMemory
 | ) |  |

Definition at line 984 of file OleStd.c.

{
   LPSTORAGE   lpstg = NULL;
   DWORD       reserved = 0;
   SCODE       sc = S_OK;
   HRESULT     hrErr;

   lpMedium->pUnkForRelease = NULL;

   if (lpMedium->tymed == TYMED_NULL) {

      if (lpformatetc->tymed & TYMED_ISTORAGE) {

         /* allocate a temp docfile that will delete on last release */
         lpstg = OleStdCreateTempStorage(
               TRUE /*fUseMemory*/,
               STGM_READWRITE | STGM_TRANSACTED | STGM_SHARE_EXCLUSIVE
         );
         if (!lpstg)
            return E_OUTOFMEMORY;

         lpMedium->u.pstg = lpstg;
         lpMedium->tymed = TYMED_ISTORAGE;
         lpMedium->pUnkForRelease = NULL;
      } else {
         return DATA_E_FORMATETC;
      }
   } else if (lpMedium->tymed == TYMED_ISTORAGE) {
      lpMedium->tymed = TYMED_ISTORAGE;
   } else {
      return DATA_E_FORMATETC;
   }

   // NOTE: even if OleSave returns an error you should still call
   // SaveCompleted.

   OLEDBG_BEGIN2("OleSave called\r\n")
   hrErr = OleSave(lpPStg, lpMedium->u.pstg, FALSE /* fSameAsLoad */);
   OLEDBG_END2

   if (hrErr != NOERROR) {
      OleDbgOutHResult("WARNING: OleSave returned", hrErr);
      sc = hrErr;
   }
   OLEDBG_BEGIN2("IPersistStorage::SaveCompleted called\r\n")
   hrErr = lpPStg->lpVtbl->SaveCompleted(lpPStg, NULL);
   OLEDBG_END2

   if (hrErr != NOERROR) {
      OleDbgOutHResult("WARNING: SaveCompleted returned",hrErr);
      if (sc == S_OK)
         sc = hrErr;
   }

   return sc;
}

STDAPI OleStdMkParseDisplayName | ( | REFCLSID | rClsid,
 |  | LPBC | lpbc,
 |  | LPOLESTR | lpszUserName,
 |  | ULONG FAR * | lpchEaten,
 |  | LPMONIKER FAR * | lplpmk
 | ) |  |

Definition at line 2447 of file OleStd.c.

{
   HRESULT hrErr;

   if (!IsEqualCLSID(rClsid,&CLSID_NULL) && CoIsOle1Class(rClsid) &&
      lpszUserName[0] != '@') {
      LPOLESTR lpszBuf;
      LPOLESTR lpszProgID;
      char     lpszAnsiBuf[256], lpszAnsiProgID[256], lpszAnsiUserName[256];

      // Prepend "@<ProgID>!" to the input string
      ProgIDFromCLSID(rClsid, &lpszProgID);
      if (lpszProgID == NULL)
         goto Cont1;
      lpszBuf = OleStdMalloc(
            ((ULONG)OLESTRLEN(lpszUserName)+OLESTRLEN(lpszProgID)+3) * sizeof(OLECHAR));
      if (lpszBuf == NULL) {
         if (lpszProgID)
            OleStdFree(lpszProgID);
         goto Cont1;
      }

      W2A (lpszProgID, lpszAnsiProgID, 256);
      W2A (lpszUserName, lpszAnsiUserName, 256);
      wsprintf(lpszAnsiBuf, "@%s!%s", lpszAnsiProgID, lpszAnsiUserName);
      A2W (lpszAnsiBuf, lpszBuf, OLESTRLEN(lpszUserName)+OLESTRLEN(lpszProgID)+3);
      OLEDBG_BEGIN2("MkParseDisplayName called\r\n")
      hrErr = MkParseDisplayName(lpbc, lpszBuf, lpchEaten, lplpmk);
      OLEDBG_END2

      if (lpszProgID)
         OleStdFree(lpszProgID);
      if (lpszBuf)
         OleStdFree(lpszBuf);

      if (hrErr == NOERROR)
         return NOERROR;
   }

Cont1:
   OLEDBG_BEGIN2("MkParseDisplayName called\r\n")
   hrErr = MkParseDisplayName(lpbc, lpszUserName, lpchEaten, lplpmk);
   OLEDBG_END2

   return hrErr;
}

STDMETHODIMP OleStdNullMethod ( LPUNKNOWN lpThis )

Definition at line 1978 of file OleStd.c.

{
   MessageBox(
         NULL,
         "ERROR: INTERFACE METHOD NOT IMPLEMENTED!\r\n",
         NULL,
         MB_SYSTEMMODAL | MB_ICONHAND | MB_OK
   );

   return E_NOTIMPL;
}

STDAPI OleStdSetIconInCache | ( | LPOLEOBJECT | lpOleObj,
 |  | HGLOBAL | hMetaPict
 | ) |  |

Definition at line 323 of file OleStd.c.

{
   LPOLECACHE      lpOleCache = NULL;
   FORMATETC       FmtEtc;
   STGMEDIUM       Medium;
   HRESULT         hrErr;

   if (! hMetaPict)
      return FALSE;   // invalid icon

   lpOleCache = (LPOLECACHE)OleStdQueryInterface(
                              (LPUNKNOWN)lpOleObj,&IID_IOleCache);
   if (! lpOleCache)
      return FALSE;   // if IOleCache* is NOT available, do nothing

   FmtEtc.cfFormat = CF_METAFILEPICT;
   FmtEtc.ptd      = NULL;
   FmtEtc.dwAspect = DVASPECT_ICON;
   FmtEtc.lindex   = -1;
   FmtEtc.tymed    = TYMED_MFPICT;

   // stuff the icon into the cache.
   Medium.tymed            = TYMED_MFPICT;
   Medium.u.hGlobal        = hMetaPict;
   Medium.pUnkForRelease   = NULL;

   OLEDBG_BEGIN2("IOleCache::SetData called\r\n")
   hrErr = lpOleCache->lpVtbl->SetData(
         lpOleCache,
         (LPFORMATETC)&FmtEtc,
         (LPSTGMEDIUM)&Medium,
         FALSE   /* fRelease */
   );
   OLEDBG_END2

   OleStdRelease((LPUNKNOWN)lpOleCache);

   return hrErr;
}

STDAPI OleStdSwitchDisplayAspect | ( | LPOLEOBJECT | lpOleObj,
 |  | LPDWORD | lpdwCurAspect,
 |  | DWORD | dwNewAspect,
 |  | HGLOBAL | hMetaPict,
 |  | BOOL | fDeleteOldAspect,
 |  | BOOL | fSetupViewAdvise,
 |  | LPADVISESINK | lpAdviseSink,
 |  | BOOL FAR * | lpfMustUpdate
 | ) |  |

Definition at line 147 of file OleStd.c.

{
   LPOLECACHE      lpOleCache = NULL;
   LPVIEWOBJECT    lpViewObj = NULL;
   LPENUMSTATDATA  lpEnumStatData = NULL;
   STATDATA        StatData;
   FORMATETC       FmtEtc;
   STGMEDIUM       Medium;
   DWORD           dwAdvf;
   DWORD           dwNewConnection;
   DWORD           dwOldAspect = *lpdwCurAspect;
   HRESULT         hrErr;

   if (lpfMustUpdate)
      *lpfMustUpdate = FALSE;

   lpOleCache = (LPOLECACHE)OleStdQueryInterface(
                              (LPUNKNOWN)lpOleObj,&IID_IOleCache);

   // if IOleCache* is NOT available, do nothing
   if (! lpOleCache)
      return E_INVALIDARG;

   // Setup new cache with the new aspect
   FmtEtc.cfFormat = 0;     // whatever is needed to draw
   FmtEtc.ptd      = NULL;
   FmtEtc.dwAspect = dwNewAspect;
   FmtEtc.lindex   = -1;
   FmtEtc.tymed    = TYMED_NULL;

   /* NOTE: if we are setting up Icon aspect with a custom icon
   **    then we do not want DataAdvise notifications to ever change
   **    the contents of the data cache. thus we set up a NODATA
   **    advise connection. otherwise we set up a standard DataAdvise
   **    connection.
   */
   if (dwNewAspect == DVASPECT_ICON && hMetaPict)
      dwAdvf = ADVF_NODATA;
   else
      dwAdvf = ADVF_PRIMEFIRST;

   OLEDBG_BEGIN2("IOleCache::Cache called\r\n")
   hrErr = lpOleCache->lpVtbl->Cache(
         lpOleCache,
         (LPFORMATETC)&FmtEtc,
         dwAdvf,
         (LPDWORD)&dwNewConnection
   );
   OLEDBG_END2

   if (! SUCCEEDED(hrErr)) {
      OleDbgOutHResult("IOleCache::Cache returned", hrErr);
      OleStdRelease((LPUNKNOWN)lpOleCache);
      return hrErr;
   }

   *lpdwCurAspect = dwNewAspect;

   /* NOTE: if we are setting up Icon aspect with a custom icon,
   **    then stuff the icon into the cache. otherwise the cache must
   **    be forced to be updated. set the *lpfMustUpdate flag to tell
   **    caller to force the object to Run so that the cache will be
   **    updated.
   */
   if (dwNewAspect == DVASPECT_ICON && hMetaPict) {

      FmtEtc.cfFormat = CF_METAFILEPICT;
      FmtEtc.ptd      = NULL;
      FmtEtc.dwAspect = DVASPECT_ICON;
      FmtEtc.lindex   = -1;
      FmtEtc.tymed    = TYMED_MFPICT;

      Medium.tymed            = TYMED_MFPICT;
      Medium.u.hGlobal        = hMetaPict;
      Medium.pUnkForRelease   = NULL;

      OLEDBG_BEGIN2("IOleCache::SetData called\r\n")
      hrErr = lpOleCache->lpVtbl->SetData(
            lpOleCache,
            (LPFORMATETC)&FmtEtc,
            (LPSTGMEDIUM)&Medium,
            FALSE   /* fRelease */
      );
      OLEDBG_END2
   } else {
      if (lpfMustUpdate)
         *lpfMustUpdate = TRUE;
   }

   if (fSetupViewAdvise && lpAdviseSink) {
      /* NOTE: re-establish the ViewAdvise connection */
      lpViewObj = (LPVIEWOBJECT)OleStdQueryInterface(
                              (LPUNKNOWN)lpOleObj,&IID_IViewObject);

      if (lpViewObj) {

         OLEDBG_BEGIN2("IViewObject::SetAdvise called\r\n")
         lpViewObj->lpVtbl->SetAdvise(
               lpViewObj,
               dwNewAspect,
               0,
               lpAdviseSink
         );
         OLEDBG_END2

         OleStdRelease((LPUNKNOWN)lpViewObj);
      }
   }

   /* NOTE: remove any existing caches that are set up for the old
   **    display aspect. It WOULD be possible to retain the caches set
   **    up for the old aspect, but this would increase the storage
   **    space required for the object and possibly require additional
   **    overhead to maintain the unused cachaes. For these reasons the
   **    strategy to delete the previous caches is prefered. if it is a
   **    requirement to quickly switch between Icon and Content
   **    display, then it would be better to keep both aspect caches.
   */

   if (fDeleteOldAspect) {
      OLEDBG_BEGIN2("IOleCache::EnumCache called\r\n")
      hrErr = lpOleCache->lpVtbl->EnumCache(
            lpOleCache,
            (LPENUMSTATDATA FAR*)&lpEnumStatData
      );
      OLEDBG_END2

      while(hrErr == NOERROR) {
         hrErr = lpEnumStatData->lpVtbl->Next(
               lpEnumStatData,
               1,
               (LPSTATDATA)&StatData,
               NULL
         );
         if (hrErr != NOERROR)
            break;              // DONE! no more caches.

         if (StatData.formatetc.dwAspect == dwOldAspect) {

            // Remove previous cache with old aspect
            OLEDBG_BEGIN2("IOleCache::Uncache called\r\n")
            lpOleCache->lpVtbl->Uncache(lpOleCache,StatData.dwConnection);
            OLEDBG_END2
         }
      }

      if (lpEnumStatData) {
         OleStdVerifyRelease(
               (LPUNKNOWN)lpEnumStatData,
               OLESTR ("OleStdSwitchDisplayAspect: Cache enumerator NOT released"));
      }
   }

   if (lpOleCache)
      OleStdRelease((LPUNKNOWN)lpOleCache);

   return NOERROR;
}

STDAPI OleUICanUnloadNow ( void )

Definition at line 145 of file ole2ui.c.

{
  if (g_dwObjectCount == 0) {
   return NOERROR;
  }

  return S_FALSE;
}

STDAPI OleUILockLibrary ( BOOL fLock )
STDAPI_ ( LPOLESTR )
STDAPI_ ( LPVOID )

Definition at line 726 of file OleStd.c.

{
   LPVOID pout = NULL;
   LPMALLOC pmalloc;

   if (CoGetMalloc(MEMCTX_TASK, &pmalloc) != NOERROR) {
      OleDbgAssertSz(0, szAssertMemAlloc);
      return NULL;
   }

   if (pmalloc != NULL)
   {
       ULONG refs;
       pout = (LPVOID)pmalloc->lpVtbl->Realloc(pmalloc, pmem, ulSize);
       refs = pmalloc->lpVtbl->Release(pmalloc);
   }

   return pout;
}

STDAPI_ ( LPUNKNOWN )
STDAPI_ ( ULONG )

Definition at line 1844 of file OleStd.c.

{
   ULONG cRef;
   char  lpszAnsiMsg[256];

   W2A (lpszMsg, lpszAnsiMsg, 256);
   cRef = lpUnk->lpVtbl->Release(lpUnk);

#if defined( _DEBUG )
   if (cRef != 0) {
      char szBuf[80];
      if (lpszMsg)
         MessageBox(NULL, lpszAnsiMsg, NULL, MB_ICONEXCLAMATION | MB_OK);
      wsprintf(
            /*(LPSTR)*/szBuf,
            "refcnt (%ld) != 0 after object (0x%lx) release\n",
            cRef,
            lpUnk
      );
      if (lpszMsg)
         OleDbgOut1(lpszAnsiMsg);
      OleDbgOut1(/*(LPSTR)*/szBuf);
      OleDbgAssertSz(cRef == 0, /*(LPSTR)*/szBuf);
   } else {
      char szBuf[80];
      wsprintf(
            /*(LPSTR)*/szBuf,
            "refcnt = 0 after object (0x%lx) release\n", lpUnk
      );
      OleDbgOut4(/*(LPSTR)*/szBuf);
   }
#endif
   return cRef;
}

STDAPI_ ( HGLOBAL )

Definition at line 1112 of file OleStd.c.

{
   HGLOBAL            hMem = NULL;
   IBindCtx   FAR    *pbc = NULL;
   LPOBJECTDESCRIPTOR lpOD;
   DWORD     dwObjectDescSize, dwFullUserTypeNameLen, dwSrcOfCopyLen;
   DWORD dwODSize ;

   // Get the length of Full User Type Name; Add 1 for the null terminator
   dwFullUserTypeNameLen = lpszFullUserTypeName ?
                                    OLESTRLEN(lpszFullUserTypeName)+1 : 0;

   // Get the Source of Copy string and it's length; Add 1 for the null terminator
   if (lpszSrcOfCopy)
      dwSrcOfCopyLen = OLESTRLEN(lpszSrcOfCopy)+1;
   else {
      // No src moniker so use user type name as source string.
      lpszSrcOfCopy =  lpszFullUserTypeName;
      dwSrcOfCopyLen = dwFullUserTypeNameLen;
   }

   // Allocate space for OBJECTDESCRIPTOR and the additional string data
   dwObjectDescSize = sizeof(OBJECTDESCRIPTOR);
   dwODSize = dwObjectDescSize + (sizeof(OLECHAR) *
                                (dwFullUserTypeNameLen + dwSrcOfCopyLen)) ;
   hMem = GlobalAlloc((GMEM_MOVEABLE | GMEM_SHARE), dwODSize) ;
   if (NULL == hMem)
      goto error;

   lpOD = (LPOBJECTDESCRIPTOR)GlobalLock(hMem);

   // Set the FullUserTypeName offset and copy the string
   if (lpszFullUserTypeName)
   {
      lpOD->dwFullUserTypeName = dwObjectDescSize;
      OLESTRCPY((LPOLESTR)((LPSTR)lpOD + lpOD->dwFullUserTypeName) ,
                                                    lpszFullUserTypeName);
   }
   else lpOD->dwFullUserTypeName = 0;  // zero offset indicates that string is not present

   // Set the SrcOfCopy offset and copy the string
   if (lpszSrcOfCopy)
   {
      lpOD->dwSrcOfCopy = dwObjectDescSize +
                               (sizeof(OLECHAR) * dwFullUserTypeNameLen) ;
      OLESTRCPY((LPOLESTR)((LPSTR)lpOD + lpOD->dwSrcOfCopy), lpszSrcOfCopy);
   }
   else lpOD->dwSrcOfCopy = 0;  // zero offset indicates that string is not present

   // Initialize the rest of the OBJECTDESCRIPTOR
   lpOD->cbSize       = dwODSize ;
   lpOD->clsid        = clsid;
   lpOD->dwDrawAspect = dwDrawAspect;
   lpOD->sizel        = sizel;
   lpOD->pointl       = pointl;
   lpOD->dwStatus     = dwStatus;

   GlobalUnlock(hMem);
   return hMem;

error:
   if (hMem)
   {
      GlobalUnlock(hMem);
      GlobalFree(hMem);
   }
   return NULL;
}

STDAPI_ ( HWND )
STDAPI_ ( HANDLE )
STDAPI_ ( int )

Definition at line 120 of file oleutl.c.

        {
        int     nMapModeOld=SetMapMode(hDC, MM_ANISOTROPIC);
        BOOL    fSystemDC  =FALSE;

        if (NULL==hDC)
                {
                hDC=GetDC(NULL);
                fSystemDC=TRUE;
                }

        XformRectInPixelsToHimetric(hDC, lprcPix, lprcHiMetric);

        SetWindowOrgEx(hDC, lprcHiMetric->left, lprcHiMetric->bottom, (LPPOINT)&lprcWindowOld->left);
        SetWindowExtEx(hDC, (lprcHiMetric->right-lprcHiMetric->left), (lprcHiMetric->top-lprcHiMetric->bottom), (LPSIZE)&lprcWindowOld->right);
        SetViewportOrgEx(hDC, lprcPix->left, lprcPix->bottom, (LPPOINT)&lprcViewportOld->left);
        SetViewportExtEx(hDC, (lprcPix->right-lprcPix->left), (lprcPix->top-lprcPix->bottom), (LPSIZE)&lprcViewportOld->right);

        if (fSystemDC)
                ReleaseDC(NULL, hDC);

        return nMapModeOld;
        }

STDAPI_ ( BOOL )
STDAPI_ ( LPSTORAGE )

Definition at line 940 of file OleStd.c.

{
   LPSTORAGE   lpstg;
   HRESULT     hrErr;
   DWORD       reserved = 0;

   if (fUseMemory) {
      lpstg = OleStdCreateStorageOnHGlobal(
            NULL,  /* auto allocate */
            TRUE,  /* delete on release */
            grfMode
      );
   } else {
      /* allocate a temp docfile that will delete on last release */
      hrErr = StgCreateDocfile(
            NULL,
            grfMode | STGM_DELETEONRELEASE | STGM_CREATE,
            reserved,
            &lpstg
      );
      if (hrErr != NOERROR)
         return NULL;
   }
   return lpstg;
}

STDAPI_ ( void )
STDAPI_ ( HDC )

Definition at line 76 of file targtdev.c.

{
        HDC hdcIC=NULL;
        LPDEVNAMES lpDevNames;
        LPDEVMODE lpDevMode;
        LPSTR lpszDriverName;
        LPSTR lpszDeviceName;
        LPSTR lpszPortName;

        if (ptd == NULL) {
                hdcIC = CreateIC("DISPLAY", NULL, NULL, NULL);
                goto errReturn;
        }

        lpDevNames = (LPDEVNAMES) ptd; // offset for size field

        lpDevMode  = (LPDEVMODE) (/*(LPSTR)*/ptd + ptd->tdExtDevmodeOffset);

        lpszDriverName = (LPSTR) lpDevNames + ptd->tdDriverNameOffset;
        lpszDeviceName = (LPSTR) lpDevNames + ptd->tdDeviceNameOffset;
        lpszPortName   = (LPSTR) lpDevNames + ptd->tdPortNameOffset;

        hdcIC = CreateIC(lpszDriverName, lpszDeviceName, lpszPortName, lpDevMode);

errReturn:
        return hdcIC;
}

DWORD FAR* STDAPI_ ( CLIPFORMAT )
STDAPI_ ( HICON )

Definition at line 361 of file drawIcon.c.

   {
   LPMETAFILEPICT  pMF;
   HDC             hDC;
   ICONEXTRACT     ie;

   /*
    * We extract the label by getting a screen DC and walking the metafile
    * records until we see the ExtTextOut record we put there.  That
    * record will have the string embedded in it which we then copy out.
    */

   if (NULL==hMetaPict)
      return NULL;

   pMF=GlobalLock(hMetaPict);

   if (NULL==pMF)
      return FALSE;

   //Use a screen DC so we have something valid to pass in.
   hDC=GetDC(NULL);
   ie.fAND=TRUE;

   // We get information back in the ICONEXTRACT structure.
   // (Since we've used the EXPORT keyword on the
   // EnumMetafileExtractLabel proc, we do not need to use
   // MakeProcInstance)
   EnumMetaFile(hDC, pMF->hMF, (MFENUMPROC)EnumMetafileExtractIcon, (LONG)(LPICONEXTRACT)&ie);

   ReleaseDC(NULL, hDC);
   GlobalUnlock(hMetaPict);

   return ie.hIcon;
   }

STDAPI_ ( DVTARGETDEVICE FAR * )

Definition at line 211 of file targtdev.c.

{
  DVTARGETDEVICE FAR* ptdDest = NULL;

  if (ptdSrc == NULL) {
        return NULL;
  }

  if ((ptdDest = (DVTARGETDEVICE FAR*)OleStdMalloc(ptdSrc->tdSize)) != NULL) {
        _fmemcpy(ptdDest, ptdSrc, (size_t)ptdSrc->tdSize);
  }

  return ptdDest;
}

STDAPI_ ( LPMONIKER )

Definition at line 2327 of file OleStd.c.

{
   LPMONIKER       lpmkFirst = NULL;
   LPENUMMONIKER   lpenumMoniker;
   DWORD           dwMksys;
   HRESULT         hrErr;

   if (! lpmk)
      return NULL;

   if (lpmk->lpVtbl->IsSystemMoniker(lpmk, (LPDWORD)&dwMksys) == NOERROR
      && dwMksys == MKSYS_GENERICCOMPOSITE) {

      /* NOTE: the moniker is a GenericCompositeMoniker.
      **    enumerate the moniker to pull off the first piece.
      */

      hrErr = lpmk->lpVtbl->Enum(
            lpmk,
            TRUE /* fForward */,
            (LPENUMMONIKER FAR*)&lpenumMoniker
      );
      if (hrErr != NOERROR)
         return NULL;    // ERROR: give up!

      hrErr = lpenumMoniker->lpVtbl->Next(
            lpenumMoniker,
            1,
            (LPMONIKER FAR*)&lpmkFirst,
            NULL
      );
      lpenumMoniker->lpVtbl->Release(lpenumMoniker);
      return lpmkFirst;

   } else {
      /* NOTE: the moniker is NOT a GenericCompositeMoniker.
      **    return an AddRef'ed pointer to the input moniker.
      */
      lpmk->lpVtbl->AddRef(lpmk);
      return lpmk;
   }
}

STDAPI_ ( UINT )

Definition at line 199 of file regdb.c.

{
   HKEY     hThisKey;
   BOOL     fCloseRegDB = FALSE;
   LONG     dw;
   LRESULT  lRet;
   LPOLESTR lpszCLSID;
   char     lpszAnsiCLSID[256];
   char     lpszAnsiAuxUserType[256];
   LPMALLOC lpIMalloc;
   char     szKey[OLEUI_CCHKEYMAX];
   char     szTemp[32];

   lpszAnsiAuxUserType[0] = '\0';

   if (NULL == hKey)
   {
     lRet = RegOpenKey(HKEY_CLASSES_ROOT, NULL, &hThisKey);

     if (ERROR_SUCCESS != lRet)
        return 0;
   }
   else
     hThisKey = hKey;

   StringFromCLSID(rclsid, &lpszCLSID);
   W2A (lpszCLSID, lpszAnsiCLSID, 256);

   lstrcpy(szKey, "CLSID\\");
   lstrcat(szKey, lpszAnsiCLSID);
   wsprintf(szTemp, "\\AuxUserType\\%d", wAuxUserType);
   lstrcat(szKey, szTemp);

   dw = cch;

   lRet = RegQueryValue(hThisKey, szKey, lpszAnsiAuxUserType, &dw);

   if (ERROR_SUCCESS != lRet) {
    dw = 0;
    lpszAuxUserType[0] = '\0';
   }

   if (fCloseRegDB)
     RegCloseKey(hThisKey);

   if (NOERROR == CoGetMalloc(MEMCTX_TASK, &lpIMalloc))
   {
      lpIMalloc->lpVtbl->Free(lpIMalloc, (LPVOID)lpszCLSID);
      lpIMalloc->lpVtbl->Release(lpIMalloc);
   }

   A2W (lpszAnsiAuxUserType, lpszAuxUserType, cch);
   return (UINT)dw;
}

WINOLEAPI_ ( HGLOBAL )

Variable Documentation

LPFORMATETC arrFmtEtc

Definition at line 567 of file OleStd.h.

BOOL

Definition at line 867 of file OleStd.h.

LPOLESTR UINT cch

Definition at line 644 of file OleStd.h.

HFONT int int UINT RECT FAR LPOLESTR UINT cchString

Definition at line 633 of file OleStd.h.

LPOLEUIPASTEENTRY int cEntries

Definition at line 557 of file OleStd.h.

CLIPFORMAT cfFormat

Definition at line 550 of file OleStd.h.

HDC DWORD UINT cSize

Definition at line 1083 of file OleStd.h.

HDC DWORD UINT cWidth

Definition at line 1084 of file OleStd.h.

LPOLESTR DWORD dwAspect

Definition at line 550 of file OleStd.h.

DWORD dwDrawAspect

Definition at line 534 of file OleStd.h.

HDC DWORD dwFlags

Definition at line 1083 of file OleStd.h.

BOOL DWORD dwgrfMode

Definition at line 521 of file OleStd.h.

DWORD dwRegister

Definition at line 572 of file OleStd.h.

DWORD SIZEL POINTL DWORD dwStatus

Definition at line 588 of file OleStd.h.

DWORD LPOLESTR LPOLESTR LPADVISESINK BOOL fCreate

Definition at line 534 of file OleStd.h.

BOOL fDeleteOnRelease

Definition at line 521 of file OleStd.h.

HDC DWORD UINT BOOL fDraw

Definition at line 1083 of file OleStd.h.

HDC BOOL fIsLink

Definition at line 1085 of file OleStd.h.

HFONT int int UINT fuOptions

Definition at line 633 of file OleStd.h.

DWORD g_dwObjectCount

Definition at line 104 of file dballoc.Cpp.

DWORD grfMode

Definition at line 511 of file OleStd.h.

HDC hdc

Definition at line 1083 of file OleStd.h.

HFONT hFont

Definition at line 633 of file OleStd.h.

HGLOBAL

Definition at line 867 of file OleStd.h.

HINSTANCE hInst

Definition at line 1094 of file OleStd.h.

DWORD FAR *HKEY hKey

Definition at line 644 of file OleStd.h.

HKEY

Definition at line 654 of file OleStd.h.

typedef int

Definition at line 491 of file OleStd.h.

DWORD LPOLESTR LPOLESTR LPADVISESINK lpAdviseSink

Definition at line 534 of file OleStd.h.

LPSTGMEDIUM CLIPFORMAT FAR * lpcfFmt

Definition at line 528 of file OleStd.h.

LPSTORAGE CLSID FAR* lpclsid

Definition at line 528 of file OleStd.h.

LPDWORD

Definition at line 868 of file OleStd.h.

LPMONIKER DWORD FAR* lpdwRegister

Definition at line 570 of file OleStd.h.

HFONT int int UINT RECT FAR LPOLESTR UINT int FAR* lpDX

Definition at line 633 of file OleStd.h.

LPRECT lpHatchRect

Definition at line 1096 of file OleStd.h.

UINT FAR LPOLESTR LPMONIKER FAR* lplpmk

Definition at line 614 of file OleStd.h.

LPSTORAGE CLSID FAR CLIPFORMAT FAR LPOLESTR FAR* lplpszType

Definition at line 528 of file OleStd.h.

LPMALLOC lpMalloc

Definition at line 628 of file OleStd.h.

LPSTGMEDIUM lpmedium

Definition at line 604 of file OleStd.h.

CLIPFORMAT DVTARGETDEVICE FAR DWORD LPSTGMEDIUM lpMedium

Definition at line 550 of file OleStd.h.

LPMONIKER lpmkFull

Definition at line 570 of file OleStd.h.

LPSTR LPVOID lpObj

Definition at line 689 of file OleStd.h.

LPOLESTR

Definition at line 865 of file OleStd.h.

LPOLEUIPASTEENTRY lpPriorityList

Definition at line 557 of file OleStd.h.

LPRECT LPRECT LPPOINT lpptOffset

Definition at line 1100 of file OleStd.h.

LPRECT LPRECT lprcClipRect

Definition at line 1100 of file OleStd.h.

LPRECT lprcHatchRect

Definition at line 1097 of file OleStd.h.

LPRECT lprcIPObjRect

Definition at line 1100 of file OleStd.h.

LPRECT LPRECT lprcLogical

Definition at line 489 of file OleStd.h.

LPRECT lprcPhysical

Definition at line 489 of file OleStd.h.

LPRECT LPRECT LPRECT LPRECT lprcViewportOld

Definition at line 489 of file OleStd.h.

LPRECT LPRECT LPRECT lprcWindowOld

Definition at line 489 of file OleStd.h.

LPRECT

Definition at line 490 of file OleStd.h.

LPSTR LPRECT lpRect

Definition at line 633 of file OleStd.h.

LPSIZEL

Definition at line 500 of file OleStd.h.

DWORD LPSIZEL lpSizelHim

Definition at line 597 of file OleStd.h.

LPSTORAGE lpStg

Definition at line 528 of file OleStd.h.

BOOL FAR LPSTR

Definition at line 507 of file OleStd.h.

WORD LPOLESTR lpszAuxUserType

Definition at line 644 of file OleStd.h.

DWORD LPOLESTR lpszContainerApp

Definition at line 534 of file OleStd.h.

DWORD LPOLESTR LPOLESTR lpszContainerObj

Definition at line 534 of file OleStd.h.

LPOLESTR lpszDst

Definition at line 630 of file OleStd.h.

DWORD SIZEL POINTL DWORD LPOLESTR lpszFullUserTypeName

Definition at line 588 of file OleStd.h.

UINT LPOLESTR lpszIface

Definition at line 662 of file OleStd.h.

LPSTR lpszMsg

Definition at line 663 of file OleStd.h.

LPSUMINFO int DWORD LPOLESTR lpszName

Definition at line 614 of file OleStd.h.

LPSTR lpszPrefix

Definition at line 679 of file OleStd.h.

LPOLESTR lpszSrcOfCopy

Definition at line 588 of file OleStd.h.

LPOLESTR lpszStgName

Definition at line 514 of file OleStd.h.

HFONT int int UINT RECT FAR LPOLESTR lpszString

Definition at line 633 of file OleStd.h.

LPOLESTR lpszUserType

Definition at line 650 of file OleStd.h.

CLIPFORMAT DVTARGETDEVICE FAR* lpTargetDevice

Definition at line 550 of file OleStd.h.

UINT FAR* lpuUnique

Definition at line 614 of file OleStd.h.

LPFORMATETC int nFmtEtc

Definition at line 567 of file OleStd.h.

LPSTR int nIndent

Definition at line 679 of file OleStd.h.

LPOLESTR int nMaxChars

Definition at line 630 of file OleStd.h.

UINT nSizeOfVtbl

Definition at line 660 of file OleStd.h.

HFONT int nXStart

Definition at line 633 of file OleStd.h.

HFONT int int nYStart

Definition at line 633 of file OleStd.h.

LPFORMATETC petcSrc

Definition at line 671 of file OleStd.h.

FORMATETC FAR* pFetcRight

Definition at line 672 of file OleStd.h.

LPOLESTR DWORD POINTL pointl

Definition at line 588 of file OleStd.h.

DWORD LPSIZEL DVTARGETDEVICE FAR* ptd

Definition at line 609 of file OleStd.h.

DVTARGETDEVICE FAR* ptdRight

Definition at line 674 of file OleStd.h.

LPSTR LPVOID ULONG refcnt

Definition at line 689 of file OleStd.h.

REFIID riid

Definition at line 510 of file OleStd.h.

DWORD int int int int int int sc

Definition at line 711 of file OleStd.h.

DWORD SIZEL sizel

Definition at line 588 of file OleStd.h.

UINT

Definition at line 865 of file OleStd.h.

ULONG ulSize

Definition at line 625 of file OleStd.h.

WORD wAuxUserType

Definition at line 644 of file OleStd.h.

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/Include/Stablize.h File Reference

  • Com
  • Fundamentals
  • Include
Classes

Stablize.h File Reference

Go to the source code of this file.

Classes

class | CSafeRefCount
class | CStabilize
Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/Object/CallAs/call_as.c File Reference

  • Com
  • Fundamentals
  • Object
  • CallAs
Defines | Functions

call_as.c File Reference

#include <stdio.h>
#include "rpcproxy.h"
#include <windows.h>
#include "callas.h"

Go to the source code of this file.

Defines

#define | INC_OLE2

Functions

MyBoolean STDMETHODCALLTYPE | IHelloCallAs_HelloProc_Proxy (IHelloCallAs *pThis, unsigned char *pszString)
HRESULT RPC_ENTRY | IHelloCallAs_HelloProc_Stub (IHelloCallAs *pThis, unsigned char *pszString)

Define Documentation

#define INC_OLE2

Definition at line 22 of file call_as.c.

Function Documentation

MyBoolean STDMETHODCALLTYPE IHelloCallAs_HelloProc_Proxy | ( | IHelloCallAs * | pThis,
 |  | unsigned char * | pszString
 | ) |  |

Definition at line 57 of file call_as.c.

{
    HRESULT     rc;

    printf("Proxy: %s\n", pszString);
    rc = IHelloCallAs_RemoteHelloProc_Proxy(pThis, pszString);

    return FAILED(rc);
}

HRESULT RPC_ENTRY IHelloCallAs_HelloProc_Stub | ( | IHelloCallAs * | pThis,
 |  | unsigned char * | pszString
 | ) |  |

Definition at line 78 of file call_as.c.

{
    MyBoolean   rc;

    rc = pThis->lpVtbl->HelloProc(pThis, pszString);
    return rc ? S_OK : E_FAIL;
}

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/Object/CallAs/CallAs.Idl File Reference

  • Com
  • Fundamentals
  • Object
  • CallAs
Typedefs | Functions

CallAs.Idl File Reference

Go to the source code of this file.

Typedefs

typedef int | MyBoolean

Functions

MyBoolean | HelloProc ([in, string] char *pszString)
HRESULT | RemoteHelloProc ([in, string] char *pszString)

Typedef Documentation

typedef int MyBoolean

Definition at line 11 of file CallAs.Idl.

Function Documentation

MyBoolean HelloProc ( [in, string] char * pszString )
HRESULT RemoteHelloProc ( [in, string] char * pszString )
Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/Object/CallAs/Client.c File Reference

  • Com
  • Fundamentals
  • Object
  • CallAs
Defines | Functions | Variables

Client.c File Reference

#include <windows.h>
#include <stdio.h>
#include <assert.h>
#include "callas.h"

Go to the source code of this file.

Defines

#define | INC_OLE2

Functions

void | InitializeRegistry (char *pszProxyDll, char *pszServer)
void __cdecl | main (int argc, char *argv[])
void | Test ()
void | TestDll ()

Variables

const CLSID | CLSID_CallAs

Define Documentation

#define INC_OLE2

Definition at line 21 of file Client.c.

Function Documentation

void InitializeRegistry | ( | char * | pszProxyDll,
 |  | char * | pszServer
 | ) |  |

Definition at line 57 of file Client.c.

{
    // the server exe CLSID
    const char *pszServerKey = "{f9246030-9f33-11cd-b23f-00aa00339cce}";

    // the interface UUID
    const char *pszInterfaceKey = "{a46deb30-9f33-11cd-b23f-00aa00339cce}";

    // the class factory CLSID ( the same as the interface UUID )
    const char *pszProxyDllKey = "{a46deb30-9f33-11cd-b23f-00aa00339cce}";

    LONG error          = 0;
    HKEY hKeyInterface;     // key for ...\Classes\Interface
    HKEY hKeyCLSID;         // key for ...\Classes\CLSID
    HKEY hKey;              // current key
    DWORD dwDisposition;

    //Register the interfaces.

    //create ...\Classes\Interface key
    error = RegCreateKeyEx(
        HKEY_CLASSES_ROOT,
        "Interface",
        0,
        "REG_SZ",
        REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS,
        0,
        &hKeyInterface,
        &dwDisposition);

    // create the ...\Classes\Interface\{ <interface uuid> }  key
    error = RegCreateKeyEx(
        hKeyInterface,
        pszInterfaceKey,
        0,
        "REG_SZ",
        REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS,
        0,
        &hKey,
        &dwDisposition);

    //create ProxyStubClsid32 key under the interface
    error = RegCreateKeyEx(
        hKey,
        "ProxyStubClsid32",
        0,
        "REG_SZ",
        REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS,
        0,
        &hKey,
        &dwDisposition);

    //Set the class id for the PSFactoryBuffer for the interface
    error = RegSetValueEx(
        hKey,
        "",
        0,
        REG_SZ,
        pszProxyDllKey,
        strlen(pszProxyDllKey) + 1);

    //Register the classes.

    //create the CLSID key
    error = RegCreateKeyEx(
        HKEY_CLASSES_ROOT,
        "CLSID",
        0,
        "REG_SZ",
        REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS,
        0,
        &hKeyCLSID,
        &dwDisposition);

    //create key for the server
    error = RegCreateKeyEx(
        hKeyCLSID,
        pszServerKey,
        0,
        "REG_SZ",
        REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS,
        0,
        &hKey,
        &dwDisposition);

    //create LocalServer32 key.
    error = RegCreateKeyEx(
        hKey,
        "LocalServer32",
        0,
        "REG_SZ",
        REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS,
        0,
        &hKey,
        &dwDisposition);

    //Set the server name.
    error = RegSetValueEx(
        hKey,
        "",
        0,
        REG_SZ,
        pszServer,
        strlen(pszServer) + 1);

    error = RegFlushKey(
        hKey );

    //create key for the proxy dll
    error = RegCreateKeyEx(
        hKeyCLSID,
        pszProxyDllKey,
        0,
        "REG_SZ",
        REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS,
        0,
        &hKey,
        &dwDisposition);

    //create InProcServer32 key for the proxy dll
    error = RegCreateKeyEx(
        hKey,
        "InProcServer32",
        0,
        "REG_SZ",
        REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS,
        0,
        &hKey,
        &dwDisposition);

    //register the proxy DLL
    error = RegSetValueEx(
        hKey,
        "",
        0,
        REG_SZ,
        pszProxyDll,
        strlen(pszProxyDll) + 1);

    error = RegFlushKey(
        hKey );

    //  printf("waiting for registry to update OLE\n");
    Sleep(1000);
}

void __cdecl main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 293 of file Client.c.

{
    TestDll();
}

void Test ( )

Definition at line 214 of file Client.c.

{
    IClassFactory *pClassFactory =0;
    IUnknown *punk = 0;
    IHelloCallAs *pCallAs = 0;
    HRESULT hr;

    hr = CoInitialize(NULL);
    if (FAILED(hr))
    {
        printf("CoInitialize failed with %lx\n", hr);
        return;
    }

    hr = CoGetClassObject(&CLSID_CallAs, CLSCTX_LOCAL_SERVER, 0, &IID_IClassFactory, &pClassFactory);
    if(FAILED(hr))
        printf("CoGetClassObject failed with %lx\n", hr);
    else
    {
        assert(pClassFactory);
        hr = pClassFactory->lpVtbl->CreateInstance(pClassFactory, 0, &IID_IUnknown, &punk);
        if(FAILED(hr))
            printf("IClassFactory::CreateInstance failed with %lx\n", hr);
        else
        {
            assert(punk);
            hr = punk->lpVtbl->QueryInterface(punk, &IID_IHelloCallAs, &pCallAs);
            if(FAILED(hr))
                printf("IUnknown::QueryInterface failed with %lx\n", hr);
            else
            {
                assert(pCallAs);
                hr = pCallAs->lpVtbl->HelloProc(pCallAs, "Hello World!");
                if(FAILED(hr))
                    printf("IHelloCallAs::HelloProc failed with %lx\n", hr);
                else
                    printf("IHelloCallAs::HelloProc succeeded");

                pCallAs->lpVtbl->Release(pCallAs);
                pCallAs = 0;
            }
            punk->lpVtbl->Release(punk);
            punk = 0;
        }
        pClassFactory->lpVtbl->Release(pClassFactory);
        pClassFactory = 0;
    }
    CoUninitialize();
}

void TestDll ( )

Definition at line 264 of file Client.c.

{
    // the dll name of the proxy dll
    const char *pszProxyDllName = "callas.dll";

    char szDrive[_MAX_DRIVE];
    char szDirectory[_MAX_DIR];
    char szFileName[_MAX_FNAME];

    char szClient[_MAX_PATH];
    char szProxyDll[_MAX_PATH];
    char szServer[_MAX_PATH];

    GetModuleFileName(0, szClient, _MAX_PATH);
    _splitpath(szClient, szDrive, szDirectory, szFileName, NULL);

    //Get the full path name of the server.
    _snprintf(szServer, sizeof(szServer)-1, "%s%sserver.exe", szDrive, szDirectory);

    //Get the full path name of the proxy dll.
    _snprintf(szProxyDll, sizeof(szProxyDll)-1, "%s%s%s", szDrive, szDirectory, pszProxyDllName);

    printf("Testing Dll\n");
    InitializeRegistry(szProxyDll, szServer);

    Test();
}

Variable Documentation

const CLSID CLSID_CallAs
Initial value:
    {0xf9246030,0x9f33,0x11cd,{0xb2,0x3f,0x00,0xaa,0x00,0x33,0x9c,0xce}}

Definition at line 29 of file Client.c.

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/Object/CallAs/Server.Cxx File Reference

  • Com
  • Fundamentals
  • Object
  • CallAs
Classes | Defines | Functions | Variables

Server.Cxx File Reference

#include <windows.h>
#include <stdio.h>
#include <assert.h>
#include "callas.h"

Go to the source code of this file.

Classes

class | CCallAs
class | CCallAsFactory

Defines

#define | INC_OLE2

Functions

unsigned long | DecrementRefCount (unsigned long &RefCount)
IClassFactory * | GetCallAsFactory ()
unsigned long | IncrementRefCount (unsigned long &RefCount)
void _cdecl | main ()

Variables

const CLSID | CLSID_CallAs = {0xf9246030,0x9f33,0x11cd,{0xb2,0x3f,0x00,0xaa,0x00,0x33,0x9c,0xce}}
DWORD | dwHandle = 0
BOOL | fClassRegistered = FALSE
CCallAsFactory gCallAsClassFactory
unsigned long | ObjectCount = 0

Define Documentation

#define INC_OLE2

Definition at line 25 of file Server.Cxx.

Function Documentation

unsigned long DecrementRefCount ( unsigned long & RefCount ) [inline]

Definition at line 58 of file Server.Cxx.

    {
    return InterlockedDecrement( (long *) &RefCount );
    }

IClassFactory * GetCallAsFactory ( )

Definition at line 221 of file Server.Cxx.

{
    // increment the file object count the first time it is created
        if(gCallAsClassFactory.RefCount == 0)
        {
                IncrementRefCount(gCallAsClassFactory.RefCount);
                IncrementRefCount(ObjectCount);
        }
        else
        {
                IncrementRefCount(gCallAsClassFactory.RefCount);
        }
        return &gCallAsClassFactory;
}

unsigned long IncrementRefCount ( unsigned long & RefCount ) [inline]

Definition at line 51 of file Server.Cxx.

    {
    return InterlockedIncrement( (long *) &RefCount );
    }

void _cdecl main ( void )

Definition at line 168 of file Server.Cxx.

{
    HRESULT hr;
    MSG msg;
        IClassFactory *pClassFactory;

    //
    // Initialize OLE before calling any other OLE functions.
    //

    hr = CoInitialize(NULL);

    if( FAILED(hr))
    {
            printf("Server: CoInitialize failed(%x)\n",hr);
        return;
    }

        pClassFactory = GetCallAsFactory();

        hr = CoRegisterClassObject(CLSID_CallAs,
                                               (IUnknown *) pClassFactory,
                                               CLSCTX_LOCAL_SERVER,
                                               REGCLS_SINGLEUSE,
                                               &dwHandle);

        pClassFactory->Release();

        if (FAILED(hr))
            printf("Server: CoRegisterClassObject failed %x\n", hr);
        else
        {
                fClassRegistered = TRUE;

            // message loop
        while (GetMessage(&msg, NULL, 0, 0))
        {
                TranslateMessage(&msg);
                DispatchMessage(&msg);
        }
        }
    CoUninitialize();

    return;
}

Variable Documentation

const CLSID CLSID_CallAs = {0xf9246030,0x9f33,0x11cd,{0xb2,0x3f,0x00,0xaa,0x00,0x33,0x9c,0xce}}

Definition at line 38 of file Server.Cxx.

DWORD dwHandle = 0

Definition at line 33 of file Server.Cxx.

BOOL fClassRegistered = FALSE

Definition at line 32 of file Server.Cxx.

CCallAsFactory gCallAsClassFactory

Definition at line 105 of file Server.Cxx.

unsigned long ObjectCount = 0

Definition at line 31 of file Server.Cxx.

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/Object/OHello/cHello.Cxx File Reference

  • Com
  • Fundamentals
  • Object
  • OHello
Classes | Functions | Variables

cHello.Cxx File Reference

#include <windows.h>
#include <stdio.h>
#include "ohello.h"

Go to the source code of this file.

Classes

class | CHello
class | CHelloClassFactory

Functions

void | DecrementLockCount ()
void | IncrementLockCount ()
void | ObjectCreated ()
void | ObjectDestroyed ()
HRESULT | RegisterClassFactory ()
HRESULT | RevokeClassFactory ()

Variables

const CLSID | CLSID_OHello
DWORD | g_dwRegister = 0
long | g_fClassRegistered = FALSE

Function Documentation

void DecrementLockCount ( )

Definition at line 74 of file Server.Cxx.

{
    //Decrement the lock count.
    if(InterlockedDecrement(&g_LockCount) == 0)
    {
        //When the lock count is decremented to zero,
        //revoke the class factory.
        RevokeClassFactory();
    }
}

void IncrementLockCount ( )

Definition at line 99 of file Server.Cxx.

{
    if(g_LockCount == 0)
    {
        //Increment the lock count.
        InterlockedIncrement(&g_LockCount);

        //Reregister the class factory if necessary.
        RegisterClassFactory();
    }
    else
    {
        //Increment the lock count.
        InterlockedIncrement(&g_LockCount);
    }
}

void ObjectCreated ( )

Definition at line 257 of file Server.Cxx.

{
    InterlockedIncrement(&g_ObjectCount);
}

void ObjectDestroyed ( )

Definition at line 277 of file Server.Cxx.

{
    if(InterlockedDecrement(&g_ObjectCount) == 0)
    {
        //When the last object is released, post a quit message.
        PostQuitMessage(0);
    }
}

HRESULT RegisterClassFactory ( )

Definition at line 349 of file cHello.Cxx.

{
    HRESULT hr;
    CHelloClassFactory *pClassFactory;

    if(InterlockedExchange(&g_fClassRegistered, TRUE) == FALSE)
    {
        pClassFactory = new CHelloClassFactory;

        if(pClassFactory != 0)
        {
            hr = CoRegisterClassObject(CLSID_OHello,
                                 (IUnknown *) pClassFactory,
                                 CLSCTX_LOCAL_SERVER,
                                 REGCLS_MULTIPLEUSE,
                                 &g_dwRegister);
            pClassFactory->Release();
        }
        else
        {
           hr = E_OUTOFMEMORY;
        }
    }
    else
    {
        hr = S_OK;
    }
    return hr;
}

HRESULT RevokeClassFactory ( )

Definition at line 387 of file cHello.Cxx.

{
    HRESULT hr;

    if(InterlockedExchange(&g_fClassRegistered, FALSE) == TRUE)
    {
        hr = CoRevokeClassObject(g_dwRegister);
    }
    else
    {
        hr = S_OK;
    }
    return hr;
}

Variable Documentation

const CLSID CLSID_OHello

Definition at line 26 of file cHello.Cxx.

DWORD g_dwRegister = 0

Definition at line 29 of file cHello.Cxx.

long g_fClassRegistered = FALSE

Definition at line 28 of file cHello.Cxx.

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/Object/OHello/Client.Cxx File Reference

  • Com
  • Fundamentals
  • Object
  • OHello
Functions | Variables

Client.Cxx File Reference

#include <windows.h>
#include <stdio.h>
#include "ohello.h"

Go to the source code of this file.

Functions

void __cdecl | main (int argc, char *argv[])
void | PrintErrorMessage (HRESULT hr)

Variables

const CLSID | CLSID_OHello

Function Documentation

void __cdecl main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 42 of file Client.Cxx.

{
    HRESULT hr;
    IHello *pHello = 0;

    hr = CoInitialize(NULL);

    if(SUCCEEDED(hr))
    {
        hr = CoCreateInstance(CLSID_OHello, 0, CLSCTX_LOCAL_SERVER, IID_IHello, (void **) &pHello);
        if(SUCCEEDED(hr))
        {
            hr = pHello->HelloProc((unsigned char *) "Hello");

            if(SUCCEEDED(hr))
            {
                printf("Successfully printed Hello.\n");
            }
            else
            {
                printf("IHello::HelloProc failed.\n");
                PrintErrorMessage(hr);
            }

            printf(" <pausing for 5 sec>\n");
            Sleep( 5000 ); // 5000 msec = 5 sec

            hr = pHello->HelloProc((unsigned char *) "Goodbye");

            if(SUCCEEDED(hr))
            {
                printf("Successfully printed Goodbye.\n");
            }
            else
            {
                printf("IHello::HelloProc failed.\n");
                PrintErrorMessage(hr);
            }

            pHello->Release();
        }
        else
        {
            printf("CoCreateInstance failed.\n");
            PrintErrorMessage(hr);

            if(hr == REGDB_E_CLASSNOTREG)
                printf("Run server.exe /REGSERVER to install the server program.\n");
        }

        CoUninitialize();
    }
    else
    {
        printf("CoInitialize failed.\n");
        PrintErrorMessage(hr);
    }
}

void PrintErrorMessage ( HRESULT hr )

Definition at line 27 of file error.Cxx.

{
  DWORD cMsgLen;
  char *pszErrorMessage = 0; /* buffer for message text from system */

  /* get the text description for that error number from the system */
  cMsgLen = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER,
                          0,
                          (DWORD) hr,
                          MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL),
                          (LPTSTR) &pszErrorMessage,
                          512,
                          0);

    if(cMsgLen > 0)
    {
        printf("Error %x: %s\n", hr, pszErrorMessage);
        LocalFree((HLOCAL) pszErrorMessage);
    }
    else
    {
        printf("Error %x\n", hr);
    }
}

Variable Documentation

const CLSID CLSID_OHello
Initial value:

    {0xf9246031,0x9f33,0x11cd,{0xb2,0x3f,0x00,0xaa,0x00,0x33,0x9c,0xce}}

Definition at line 24 of file Client.Cxx.

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/Object/OHello/error.Cxx File Reference

  • Com
  • Fundamentals
  • Object
  • OHello
Functions

error.Cxx File Reference

#include <windows.h>
#include <stdio.h>

Go to the source code of this file.

Functions

void PrintErrorMessage (HRESULT hr)

Function Documentation

void PrintErrorMessage ( HRESULT hr )

Definition at line 27 of file error.Cxx.

{
  DWORD cMsgLen;
  char *pszErrorMessage = 0; /* buffer for message text from system */

  /* get the text description for that error number from the system */
  cMsgLen = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER,
                          0,
                          (DWORD) hr,
                          MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL),
                          (LPTSTR) &pszErrorMessage,
                          512,
                          0);

    if(cMsgLen > 0)
    {
        printf("Error %x: %s\n", hr, pszErrorMessage);
        LocalFree((HLOCAL) pszErrorMessage);
    }
    else
    {
        printf("Error %x\n", hr);
    }
}

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/Object/OHello/OHello.Idl File Reference

  • Com
  • Fundamentals
  • Object
  • OHello
Functions

OHello.Idl File Reference

Go to the source code of this file.

Functions

HRESULT HelloProc ([in, string] char *pszString)

Function Documentation

HRESULT HelloProc ( [in, string] char * pszString )
Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/Object/OHello/Server.Cxx File Reference

  • Com
  • Fundamentals
  • Object
  • OHello
Functions | Variables

Server.Cxx File Reference

#include <windows.h>
#include <stdio.h>
#include "ohello.h"

Go to the source code of this file.

Functions

void | DecrementLockCount ()
void | IncrementLockCount ()
int _cdecl | main (int argc, char *argv[])
void | ObjectCreated ()
void | ObjectDestroyed ()
void | PrintErrorMessage (HRESULT hr)
HRESULT | RegisterClassFactory ()
HRESULT | RegisterLocalServer (REFCLSID rclsid)
HRESULT | RegisterProxyDll (const char *pszProxyDll)
HRESULT | RevokeClassFactory ()
HRESULT | UnregisterLocalServer (REFCLSID rclsid)
HRESULT | UnregisterProxyDll (const char *pszProxyDll)

Variables

const CLSID | CLSID_OHello = {0xf9246031,0x9f33,0x11cd,{0xb2,0x3f,0x00,0xaa,0x00,0x33,0x9c,0xce}}
long | g_LockCount = 0
long | g_ObjectCount = 0

Function Documentation

void DecrementLockCount ( )

Definition at line 74 of file Server.Cxx.

{
    //Decrement the lock count.
    if(InterlockedDecrement(&g_LockCount) == 0)
    {
        //When the lock count is decremented to zero,
        //revoke the class factory.
        RevokeClassFactory();
    }
}

void IncrementLockCount ( )

Definition at line 99 of file Server.Cxx.

{
    if(g_LockCount == 0)
    {
        //Increment the lock count.
        InterlockedIncrement(&g_LockCount);

        //Reregister the class factory if necessary.
        RegisterClassFactory();
    }
    else
    {
        //Increment the lock count.
        InterlockedIncrement(&g_LockCount);
    }
}

int _cdecl main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 125 of file Server.Cxx.

{
    HRESULT hr = S_OK;
    int i;
    BOOL fRegisterServer = FALSE;
    BOOL fUnregisterServer = FALSE;
    BOOL fEmbedding = FALSE;
    BOOL fHelp = FALSE;
    MSG msg;

    // Parse each item, skip the command name
    for (i = 1; i < argc; i++)
    {
        if (stricmp( argv[i], "-Embedding" ) == 0)
        {
            //This server has been activated by OLE.
            fEmbedding = TRUE;
        }
        else if (stricmp( argv[i], "/REGSERVER" ) == 0)
        {
            fRegisterServer = TRUE;
        }
        else if (stricmp( argv[i], "/UNREGSERVER" ) == 0)
        {
            fUnregisterServer = TRUE;
        }
        else
        {
            fHelp = TRUE;
        }
    }

    if(fHelp == TRUE)
        {
        printf("USAGE: server /REGSERVER   - Installs server in the registry.\n");
        printf("       server /UNREGSERVER - Removes server from the registry.\n");
        printf("       server -Embedding   - Server was auto-started by OLE.\n");
        return 0;
    }
    else if(fUnregisterServer == TRUE)
    {
        hr = UnregisterLocalServer(CLSID_OHello);
        if(FAILED(hr))
        {
            printf("Failed to remove local server from the registry.\n");
            PrintErrorMessage(hr);
        }

        hr = UnregisterProxyDll("ohello.dll");
        if(FAILED(hr))
        {
            printf("Failed to remove proxy DLL from the registry.\n");
            PrintErrorMessage(hr);
        }
        return 0;
    }

    //Install the local server in the registry.
    hr = RegisterLocalServer(CLSID_OHello);
    if(FAILED(hr))
    {
        printf("Failed to install local server in the registry.\n");
        PrintErrorMessage(hr);
    }

    //Install the proxy DLL in the registry.
    hr = RegisterProxyDll("ohello.dll");
    if(FAILED(hr))
    {
        printf("Failed to install proxy DLL in the registry.\n");
        PrintErrorMessage(hr);
    }

    if(fRegisterServer == TRUE)
        return 0;

    //
    // Initialize OLE before calling any other OLE functions.
    //

    hr = CoInitialize(NULL);

    if(SUCCEEDED(hr))
    {
        hr = RegisterClassFactory();

        if(SUCCEEDED(hr))
        {
            printf("Waiting for client to connect...\n");
            // Main message loop.  We will remain in the message loop
            // until we get a WM_QUIT message.
          while (GetMessage(&msg, NULL, 0, 0))
          {
              TranslateMessage(&msg);
              DispatchMessage(&msg);
          }

            //If the class factory is still registered in the
            //class table, revoke it before we shut down.
            RevokeClassFactory();
      }
        else
        {
            printf("Failed to register class factory.\n");
            PrintErrorMessage(hr);
        }
        CoUninitialize();
    }
    else
    {
        printf("CoInitialize failed.\n");
        PrintErrorMessage(hr);
    }

    return 0;
}

void ObjectCreated ( )

Definition at line 257 of file Server.Cxx.

{
    InterlockedIncrement(&g_ObjectCount);
}

void ObjectDestroyed ( void )

Definition at line 277 of file Server.Cxx.

{
    if(InterlockedDecrement(&g_ObjectCount) == 0)
    {
        //When the last object is released, post a quit message.
        PostQuitMessage(0);
    }
}

void PrintErrorMessage ( HRESULT hr )

Definition at line 27 of file error.Cxx.

{
  DWORD cMsgLen;
  char *pszErrorMessage = 0; /* buffer for message text from system */

  /* get the text description for that error number from the system */
  cMsgLen = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER,
                          0,
                          (DWORD) hr,
                          MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL),
                          (LPTSTR) &pszErrorMessage,
                          512,
                          0);

    if(cMsgLen > 0)
    {
        printf("Error %x: %s\n", hr, pszErrorMessage);
        LocalFree((HLOCAL) pszErrorMessage);
    }
    else
    {
        printf("Error %x\n", hr);
    }
}

HRESULT RegisterClassFactory ( )

Definition at line 349 of file cHello.Cxx.

{
    HRESULT hr;
    CHelloClassFactory *pClassFactory;

    if(InterlockedExchange(&g_fClassRegistered, TRUE) == FALSE)
    {
        pClassFactory = new CHelloClassFactory;

        if(pClassFactory != 0)
        {
            hr = CoRegisterClassObject(CLSID_OHello,
                                 (IUnknown *) pClassFactory,
                                 CLSCTX_LOCAL_SERVER,
                                 REGCLS_MULTIPLEUSE,
                                 &g_dwRegister);
            pClassFactory->Release();
        }
        else
        {
           hr = E_OUTOFMEMORY;
        }
    }
    else
    {
        hr = S_OK;
    }
    return hr;
}

HRESULT RegisterLocalServer ( REFCLSID rclsid )

Definition at line 296 of file Server.Cxx.

{
    HRESULT hr;
    LONG error;
    HKEY hKeyCLSID;         // key for ...\Classes\CLSID
    HKEY hKeyClassID;
    HKEY hKey;              // current key
    DWORD dwDisposition;
    char szServer[MAX_PATH];
    char szClassID[39];
    unsigned long length;

    length = GetModuleFileNameA(0, szServer, sizeof(szServer));

    if(length == 0)
    {
        hr = HRESULT_FROM_WIN32(GetLastError());
        return hr;
    }

    //create the CLSID key
    error = RegCreateKeyExA(
            HKEY_CLASSES_ROOT,
            "CLSID",
            0,
            "REG_SZ",
            REG_OPTION_NON_VOLATILE,
            KEY_ALL_ACCESS,
            0,
            &hKeyCLSID,
            &dwDisposition);

    if(!error)
    {
        //convert the class ID to a registry key name.
        _snprintf(szClassID, sizeof(szClassID)-1,
        "{%08lX-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
                rclsid.Data1, rclsid.Data2, rclsid.Data3,
                rclsid.Data4[0], rclsid.Data4[1],
                rclsid.Data4[2], rclsid.Data4[3],
                rclsid.Data4[4], rclsid.Data4[5],
                rclsid.Data4[6], rclsid.Data4[7]);

        //create key for the server class
        error = RegCreateKeyExA(hKeyCLSID,
                                szClassID,
                                0,
                                "REG_SZ",
                                REG_OPTION_NON_VOLATILE,
                                KEY_ALL_ACCESS,
                                0,
                                &hKeyClassID,
                                &dwDisposition);

        if(!error)
        {
            //create LocalServer32 key.
            error = RegCreateKeyExA(hKeyClassID,
                                    "LocalServer32",
                                    0,
                                    "REG_SZ",
                                    REG_OPTION_NON_VOLATILE,
                                    KEY_ALL_ACCESS,
                                    0,
                                    &hKey,
                                    &dwDisposition);

            if(!error)
            {
                //Set the server name.
                error = RegSetValueExA(hKey,
                                       "",
                                       0,
                                       REG_SZ,
                                       (const unsigned char *)szServer,
                                       (DWORD) (strlen(szServer) + 1));

                RegFlushKey(hKey);
                RegCloseKey(hKey);
            }
            RegCloseKey(hKeyClassID);
        }
        RegCloseKey(hKeyCLSID);
    }

    if(!error)
        hr = S_OK;
    else
        hr = HRESULT_FROM_WIN32(error);

    return hr;
}

HRESULT RegisterProxyDll ( const char * pszProxyDll )

Definition at line 403 of file Server.Cxx.

{
    HRESULT hr;
    HINSTANCE hProxyDll;
    HRESULT (STDAPICALLTYPE *pfnDllRegisterServer)();

    hProxyDll = LoadLibraryA(pszProxyDll);

    if(hProxyDll != 0)
    {
        pfnDllRegisterServer = (HRESULT (STDAPICALLTYPE *)())
            GetProcAddress(hProxyDll, "DllRegisterServer");

        if(pfnDllRegisterServer != 0)
            hr = (*pfnDllRegisterServer)();
        else
            hr = HRESULT_FROM_WIN32(GetLastError());

        FreeLibrary(hProxyDll);
    }
    else
    {
        hr = HRESULT_FROM_WIN32(GetLastError());
    }

    return hr;
}

HRESULT RevokeClassFactory ( )

Definition at line 387 of file cHello.Cxx.

{
    HRESULT hr;

    if(InterlockedExchange(&g_fClassRegistered, FALSE) == TRUE)
    {
        hr = CoRevokeClassObject(g_dwRegister);
    }
    else
    {
        hr = S_OK;
    }
    return hr;
}

HRESULT UnregisterLocalServer ( REFCLSID rclsid )

Definition at line 442 of file Server.Cxx.

{
    HRESULT hr;
    HKEY hKeyCLSID;
    HKEY hKeyClassID;
    long error;
    char szClassID[39];

    //open the CLSID key
    error = RegOpenKeyExA(
        HKEY_CLASSES_ROOT,
        "CLSID",
        0,
        KEY_ALL_ACCESS,
        &hKeyCLSID);

    if(!error)
    {
    //convert the class ID to a registry key name.
    _snprintf(szClassID, sizeof(szClassID)-1,
      "{%08lX-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
            rclsid.Data1, rclsid.Data2, rclsid.Data3,
            rclsid.Data4[0], rclsid.Data4[1],
            rclsid.Data4[2], rclsid.Data4[3],
            rclsid.Data4[4], rclsid.Data4[5],
            rclsid.Data4[6], rclsid.Data4[7]);

        //open registry key for class ID string
        error = RegOpenKeyExA(
            hKeyCLSID,
            szClassID,
            0,
            KEY_ALL_ACCESS,
            &hKeyClassID);

        if(!error)
        {
            //delete LocalServer32 key.
            error = RegDeleteKeyA(hKeyClassID, "LocalServer32");
            RegCloseKey(hKeyClassID);
        }

        error = RegDeleteKeyA(hKeyCLSID, szClassID);
        RegCloseKey(hKeyCLSID);
    }

    if(!error)
        hr = S_OK;
    else
        hr = HRESULT_FROM_WIN32(error);

    return hr;
}

HRESULT UnregisterProxyDll ( const char * pszProxyDll )

Definition at line 510 of file Server.Cxx.

{
    HRESULT hr;
    HINSTANCE hProxyDll;
    HRESULT (STDAPICALLTYPE *pfnDllUnregisterServer)();

    hProxyDll = LoadLibraryA(pszProxyDll);

    if(hProxyDll != 0)
    {
        pfnDllUnregisterServer = (HRESULT (STDAPICALLTYPE *)())
            GetProcAddress(hProxyDll, "DllUnregisterServer");

        if(pfnDllUnregisterServer != 0)
            hr = (*pfnDllUnregisterServer)();
        else
            hr = HRESULT_FROM_WIN32(GetLastError());

        FreeLibrary(hProxyDll);
    }
    else
    {
        hr = HRESULT_FROM_WIN32(GetLastError());
    }

    return hr;
}

Variable Documentation

const CLSID CLSID_OHello = {0xf9246031,0x9f33,0x11cd,{0xb2,0x3f,0x00,0xaa,0x00,0x33,0x9c,0xce}}

Definition at line 55 of file Server.Cxx.

long g_LockCount = 0

Definition at line 57 of file Server.Cxx.

long g_ObjectCount = 0

Definition at line 58 of file Server.Cxx.

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/OleApt/OleApt.Cpp File Reference

  • Com
  • Fundamentals
  • OleApt
Classes | Defines | Functions | Variables

OleApt.Cpp File Reference

#include <windows.h>
#include <initguid.h>
#include <stdio.h>

Go to the source code of this file.

Classes

class | CClassFactory
class | CObject

Defines

#define | COINIT_APARTMENTTHREADED 2
#define | cServerThreads 5
#define | INC_OLE2
#define | STRICT
#define | szCloseQuery TEXT("Client references still exist. Are you sure you want to close?")
#define | szTitleClient TEXT("CLIENT: OLE Apartment Sample")
#define | szTitleServer TEXT("SERVER: OLE Apartment Sample")
#define | szWindowClass TEXT("OLEAPT_CLASS")

Functions

DEFINE_GUID (CLSID_CObject, 0x5c06abc0, 0x2dcd, 0x11ce, 0x84, 0x17, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71)
BOOL | FAutoRegister (HINSTANCE hinst)
LRESULT CALLBACK | MainWndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
LRESULT | ServerThreadProc (LPARAM lParam)
int PASCAL | WinMain (HINSTANCE hinst, HINSTANCE hinstPrev, LPSTR szCmdLine, int nCmdShow)

Variables

const LARGE_INTEGER | bZero = {0,0}
CClassFactory vclassfactory
BOOL vfServer
HANDLE vhEventServer
HRESULT | vhrThreadStatus
HWND | vhwndMain
UINT viNextThread
LPSTREAM | vpstmMarshalling
LPUNKNOWN | vpunkService
INT | vrgcObjects [cServerThreads]
HANDLE | vrghEvent [cServerThreads]
HANDLE | vrghThread [cServerThreads]
DWORD | vrgtid [cServerThreads]

Define Documentation

#define COINIT_APARTMENTTHREADED 2

Definition at line 57 of file OleApt.Cpp.

#define cServerThreads 5

Definition at line 52 of file OleApt.Cpp.

#define INC_OLE2

Definition at line 45 of file OleApt.Cpp.

#define STRICT

Definition at line 46 of file OleApt.Cpp.

#define szCloseQuery TEXT("Client references still exist. Are you sure you want to close?")

Definition at line 56 of file OleApt.Cpp.

#define szTitleClient TEXT("CLIENT: OLE Apartment Sample")

Definition at line 55 of file OleApt.Cpp.

#define szTitleServer TEXT("SERVER: OLE Apartment Sample")

Definition at line 54 of file OleApt.Cpp.

#define szWindowClass TEXT("OLEAPT_CLASS")

Definition at line 53 of file OleApt.Cpp.

Function Documentation

DEFINE_GUID | ( | CLSID_CObject | ,
 |  | 0x5c06abc0 | ,
 |  | 0x2dcd | ,
 |  | 0x11ce | ,
 |  | 0x84 | ,
 |  | 0x17 | ,
 |  | 0x00 | ,
 |  | 0xaa | ,
 |  | 0x00 | ,
 |  | 0x38 | ,
 |  | 0x9b | ,
 |  | 0x71 |
 | ) |  |
BOOL FAutoRegister ( HINSTANCE hinst )

Definition at line 359 of file OleApt.Cpp.

{
    static TCHAR szClassDesc[] = TEXT("Ole Apartments Sample");
    static TCHAR szCLSIDEntry[] = TEXT("CLSID\\{5c06abc0-2dcd-11ce-8417-00aa00389b71}");
    TCHAR       szBuf[512];
    TCHAR       szPath[512];
    HKEY        hkeyT = NULL;

    // install the OLEPerf OLE1/OLE2 compatibility sections
    if ((RegSetValue(HKEY_CLASSES_ROOT, szCLSIDEntry, REG_SZ, szClassDesc,
            lstrlen(szClassDesc)) != ERROR_SUCCESS) ||
        (RegCreateKey(HKEY_CLASSES_ROOT, szCLSIDEntry, &hkeyT)
            != ERROR_SUCCESS) ||
        !GetModuleFileName(hinst, szBuf, sizeof(szBuf)))
        return FALSE;
    lstrcpyn(szPath, szBuf, sizeof(szPath)/sizeof(TCHAR));
    if (RegSetValue(hkeyT, TEXT("LocalServer32"), REG_SZ, szBuf, lstrlen(szBuf))
            != ERROR_SUCCESS)
        goto LErrExit;
    RegCloseKey(hkeyT);
    return TRUE;
LErrExit:
    RegCloseKey(hkeyT);
    return FALSE;
}  // FAutoRegister

LRESULT CALLBACK MainWndProc | ( | HWND | hwnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 126 of file OleApt.Cpp.

{
    LRESULT lresult = TRUE;

    switch (message)
        {
        case WM_QUERYOPEN:
            // clients must stay minimized
            return vfServer;

        case WM_PAINT:
            {
            HDC hdc;
            PAINTSTRUCT ps;
            int i;

            if ((hdc = BeginPaint(hwnd, &ps)) != NULL)
                {
                if (vfServer)
                    {
                    for (i=0; i<cServerThreads; i++)
                        {
                        TCHAR    rgch[200];

                        wsprintf(rgch, TEXT("Thread #%d: %d objects"), i, vrgcObjects[i]);
                        TextOut(hdc, 20, 10+(i*25), rgch, lstrlen(rgch));
                        }
                    }
                }
            EndPaint(hwnd, &ps);
            }
            break;

        case WM_DESTROY:
            PostQuitMessage(0);
            break;

        case WM_CLOSE:
            // check for clients and prompt in the UI.
            if (vfServer)
                {
                for (int i=0; i<cServerThreads; i++)
                    {
                    if (vrgcObjects[i] > 0)
                        {
                        if (MessageBox(hwnd, szCloseQuery,
                                szTitleServer, MB_YESNO) == IDNO)
                            return FALSE;
                        else
                            break;
                        }
                    }
                }

        default:
            return DefWindowProc(hwnd, message, wParam, lParam);
        }

    return lresult;
}  // MainWndProc

LRESULT ServerThreadProc ( LPARAM lParam )

Definition at line 473 of file OleApt.Cpp.

{
    HRESULT hr;
    MSG     msg;
    int     iThread;

    // figure out which thread this is: it needs its synchronization event
    for (iThread=0; iThread<cServerThreads; iThread++)
        {
        if (vrgtid[iThread] == GetCurrentThreadId())
            break;
        }
    if (iThread==cServerThreads)
        return E_UNEXPECTED;

    // initialize COM
    hr = CoInitialize(NULL);
    if (FAILED(hr))
        {
        MessageBeep(0);
        return hr;
        }

    // apartment message/event loop
    // (see SDK documentation for MsgWaitForMultipleObjects)
    // here worker message loops last forever. in situations without a
    // static number of worker threads, the loop could easily be terminated by
    // WM_QUITs sent from the main thread which might manage the worker thread
    // pool more carefully.
    while (TRUE)
        {
        DWORD dwWaitResult;

        // wait for any message sent or posted to this queue
        // or for one of the passed handles to become signaled
        dwWaitResult = MsgWaitForMultipleObjects(1, &vrghEvent[iThread],
            FALSE, INFINITE, QS_ALLINPUT);

        // result tells us the type of event we have:
        // a message or a signaled handle

        // if there are one or more messages in the queue ...
        if (dwWaitResult == (WAIT_OBJECT_0 + 1))
            {
            // dispatch all of the messages in this next loop
            // (here is where we'd check for WM_QUITs to end this
            // worker thread if we wanted to)
            while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
                DispatchMessage(&msg);
            }
        else
            {
            // this thread was signaled to create a new object
            try
                {
                LPUNKNOWN   punk;

                // create a new CObject
                punk = (IUnknown *)new CObject;
                if (punk == NULL)
                    throw E_OUTOFMEMORY;

                hr = vpstmMarshalling->Seek(bZero, STREAM_SEEK_SET, NULL);
                if (FAILED(hr))
                    throw hr;
                hr = CoMarshalInterface(vpstmMarshalling,
                    IID_IUnknown,
                    punk,
                    MSHCTX_INPROC,
                    NULL,
                    MSHLFLAGS_NORMAL);
                if (FAILED(hr))
                    throw hr;

                // punk is now referenced by its marshal-data in vpstmMarshalling.
                // we release our local reference here so the unmarshaller will
                // have the sole reference. a common mistake is to forget this
                // release and end up with orphaned objects in the server.
                punk->Release();

                // modify the global state -- the # of objects/thread -- which is
                // displayed in the server UI
                vrgcObjects[iThread]++;
                InvalidateRect(vhwndMain, NULL, TRUE);

                vhrThreadStatus = S_OK;
                }
            catch (HRESULT hr)
                {
                vhrThreadStatus = hr;
                }
            SetEvent(vhEventServer);
            }

        }

    CoUninitialize();
    return msg.wParam;
}  // ServerThreadProc

int PASCAL WinMain | ( | HINSTANCE | hinst,
 |  | HINSTANCE | hinstPrev,
 |  | LPSTR | szCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 193 of file OleApt.Cpp.

{
    WNDCLASS wndclass;
    HRESULT hr;
    int     i;
    DWORD   dwRegister = 0;
    MSG     msg;

    // parse the command-line
    if (szCmdLine)
        {
        LPSTR   sz = strtok(szCmdLine, " \t");

        vfServer = (sz && !strcmpi(sz, "-Embedding"));
        }

    // initialize COM
    hr = CoInitialize(NULL);
    if (FAILED(hr))
        {
        MessageBeep(0);
        return hr;
        }

    // register the CObject class in the registry so
    // that the client can create instances of the server
    if (!FAutoRegister(hinst))
        {
        hr = GetLastError();
        goto LCleanup;
        }

    if (vfServer)
        {
        // create the threads and synchronization events
        // which the server will need
        for (i=0; i<cServerThreads; i++)
            {
            TCHAR    rgch[32];

            // create the thread suspended so its event can be
            // created using its thread-id and it will be able to
            // use it as soon as it runs
            vrghThread[i] = CreateThread(NULL,
                0,
                (LPTHREAD_START_ROUTINE)&ServerThreadProc,
                0,
                CREATE_SUSPENDED,
                &vrgtid[i]);
            if (vrghThread[i] == NULL)
                {
                hr = GetLastError();
                goto LCleanup;
                }

            // a thread can use its thread-id to OpenEvent this existing
            // event at any time. it can also look for its thread-id in
            // vrgtid[] to determine its index for use with vrghEvent.
            // this event signals to a worker thread to create a new CObject
            wsprintf(rgch, TEXT("Thread_%d"), vrgtid[i]);
            vrghEvent[i] = CreateEvent(NULL, FALSE, FALSE, rgch);
            if (vrghEvent[i] == NULL)
                {
                hr = GetLastError();
                goto LCleanup;
                }

            // now that the event is available, let the thread run
            ResumeThread(vrghThread[i]);
            }

        // this signals the status of a worker threads creation after
        // receiving its create signal via vrghEvent[i]
        vhEventServer = CreateEvent(NULL, FALSE, FALSE, TEXT("Server"));
        if (vhEventServer == NULL)
            {
            hr = GetLastError();
            goto LCleanup;
            }

        // register the class-factory with COM
        hr = CoRegisterClassObject(CLSID_CObject,
            (IUnknown *)&vclassfactory,
            CLSCTX_LOCAL_SERVER,
            REGCLS_MULTIPLEUSE,
            &dwRegister);
        if (FAILED(hr))
            goto LCleanup;

        // create an IStream to be used for marshalling new objects between
        // the worker and the CClassFactory
        hr = CreateStreamOnHGlobal(NULL, TRUE, &vpstmMarshalling);
        if (FAILED(hr))
            goto LCleanup;
        }
    else
        {
        // this is the client case: create an instance of the service object
        // in the server
        hr = CoCreateInstance(CLSID_CObject,
            NULL,
            CLSCTX_LOCAL_SERVER,
            IID_IUnknown,
            (void**)&vpunkService);
        if (FAILED(hr))
            goto LCleanup;
        }

    // create the client and server UI
    memset(&wndclass, 0, sizeof(wndclass));
    wndclass.lpszClassName = szWindowClass;
    wndclass.style = CS_HREDRAW | CS_VREDRAW;
    wndclass.lpfnWndProc = MainWndProc;
    wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
    wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
    wndclass.hbrBackground = (HBRUSH)(COLOR_APPWORKSPACE + 1);
    wndclass.hInstance = hinst;

    if (!RegisterClass(&wndclass) ||
        (vhwndMain = CreateWindow(szWindowClass,
            vfServer ? szTitleServer : szTitleClient,
            WS_OVERLAPPEDWINDOW,
            CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
            HWND_DESKTOP, NULL, hinst, NULL)) == NULL)
        {
        hr = GetLastError();
        goto LCleanup;
        }

    // display clients as minimized, server as a normal window
    ShowWindow(vhwndMain, vfServer ? nCmdShow : SW_SHOWMINNOACTIVE);

    while (GetMessage(&msg, NULL, 0, 0))
        {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
        }
    hr = (int) msg.wParam;

LCleanup:
    if (hr != S_OK)
        MessageBeep(0);
    if (vfServer)
        {
        // we explicitly don't clean up threads and events
        if (dwRegister != 0)
            CoRevokeClassObject(dwRegister);
        if (vpstmMarshalling != NULL)
            vpstmMarshalling->Release();
        }
    else
        {
        // this is the client case: make sure to release the service
        if (vpunkService != NULL)
            vpunkService->Release();
        }

    CoUninitialize();
    return hr;
}  // WinMain

Variable Documentation

const LARGE_INTEGER bZero = {0,0}

Definition at line 58 of file OleApt.Cpp.

CClassFactory vclassfactory

Definition at line 107 of file OleApt.Cpp.

BOOL vfServer

Definition at line 101 of file OleApt.Cpp.

HANDLE vhEventServer

Definition at line 106 of file OleApt.Cpp.

HRESULT vhrThreadStatus

Definition at line 113 of file OleApt.Cpp.

HWND vhwndMain

Definition at line 111 of file OleApt.Cpp.

UINT viNextThread

Definition at line 108 of file OleApt.Cpp.

LPSTREAM vpstmMarshalling

Definition at line 112 of file OleApt.Cpp.

LPUNKNOWN vpunkService

Definition at line 109 of file OleApt.Cpp.

INT vrgcObjects[cServerThreads]

Definition at line 105 of file OleApt.Cpp.

HANDLE vrghEvent[cServerThreads]

Definition at line 104 of file OleApt.Cpp.

HANDLE vrghThread[cServerThreads]

Definition at line 102 of file OleApt.Cpp.

DWORD vrgtid[cServerThreads]

Definition at line 103 of file OleApt.Cpp.

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/OleStd/ansiapi.h File Reference

  • Com
  • Fundamentals
  • OleStd
Defines

ansiapi.h File Reference

Go to the source code of this file.

Defines

#define | _lcreat_AW _lcreat
#define | _lopen_AW _lopen
#define | A2W(a, w, cb) lstrcpy (w, a)
#define | CLSIDFromProgIDA CLSIDFromProgID
#define | CLSIDFromStringA CLSIDFromString
#define | CoLoadLibraryA CoLoadLibrary
#define | CreateFileMonikerA CreateFileMoniker
#define | DeleteFile_AW DeleteFile
#define | FREELOCALSTRING(p)
#define | GlobalAddAtom_AW GlobalAddAtom
#define | GlobalGetAtomName_AW GlobalGetAtomName
#define | IMoniker_GetDisplayNameA(pm, p1, p2, p3) (pm)->GetDisplayName(p1,p2,p3)
#define | IPersistFile_LoadA(pf, file, mode) (pf)->Load(file, mode)
#define | MAKE_STR_LOCAL_COPYA2W(s, l) l = s
#define | MAKE_STR_LOCAL_COPYW2A(s, l) l = s
#define | OLESTRCAT lstrcat
#define | OLESTRCMP lstrcmp
#define | OLESTRCMPI lstrcmpi
#define | OLESTRCPY lstrcpy
#define | OLESTRLEN lstrlen
#define | ProgIDFromCLSIDA ProgIDFromCLSID
#define | RegOpenKey_AW RegOpenKey
#define | StgOpenStorageA StgOpenStorage
#define | StringFromCLSID2A StringFromCLSID2
#define | StringFromCLSIDA StringFromCLSID
#define | StringFromGUID2A StringFromGUID2
#define | StringFromIID2A StringFromIID2
#define | UNICODEOLE32
#define | UtDupStringA2W UtDupString
#define | W2A(w, a, cb) lstrcpy (a, w)
#define | WASANSI()

Define Documentation

#define _lcreat_AW _lcreat

Definition at line 43 of file ansiapi.h.

#define _lopen_AW _lopen

Definition at line 42 of file ansiapi.h.

#define A2W | ( | a,
 |  | w,
 |  | cb |
 | ) |  | lstrcpy (w, a)

Definition at line 29 of file ansiapi.h.

#define CLSIDFromProgIDA CLSIDFromProgID

Definition at line 53 of file ansiapi.h.

#define CLSIDFromStringA CLSIDFromString

Definition at line 54 of file ansiapi.h.

#define CoLoadLibraryA CoLoadLibrary

Definition at line 48 of file ansiapi.h.

#define CreateFileMonikerA CreateFileMoniker

Definition at line 71 of file ansiapi.h.

#define DeleteFile_AW DeleteFile

Definition at line 41 of file ansiapi.h.

#define FREELOCALSTRING ( p )

Definition at line 31 of file ansiapi.h.

#define GlobalAddAtom_AW GlobalAddAtom

Definition at line 44 of file ansiapi.h.

#define GlobalGetAtomName_AW GlobalGetAtomName

Definition at line 45 of file ansiapi.h.

#define IMoniker_GetDisplayNameA | ( | pm,
 |  | p1,
 |  | p2,
 |  | p3 |
 | ) |  | (pm)->GetDisplayName(p1,p2,p3)

Definition at line 69 of file ansiapi.h.

#define IPersistFile_LoadA | ( | pf,
 |  | file,
 |  | mode |
 | ) |  | (pf)->Load(file, mode)

Definition at line 65 of file ansiapi.h.

#define MAKE_STR_LOCAL_COPYA2W | ( | s,
 |  | l |
 | ) |  | l = s

Definition at line 33 of file ansiapi.h.

#define MAKE_STR_LOCAL_COPYW2A | ( | s,
 |  | l |
 | ) |  | l = s

Definition at line 32 of file ansiapi.h.

#define OLESTRCAT lstrcat

Definition at line 36 of file ansiapi.h.

#define OLESTRCMP lstrcmp

Definition at line 38 of file ansiapi.h.

#define OLESTRCMPI lstrcmpi

Definition at line 39 of file ansiapi.h.

#define OLESTRCPY lstrcpy

Definition at line 35 of file ansiapi.h.

#define OLESTRLEN lstrlen

Definition at line 37 of file ansiapi.h.

#define ProgIDFromCLSIDA ProgIDFromCLSID

Definition at line 55 of file ansiapi.h.

#define RegOpenKey_AW RegOpenKey

Definition at line 46 of file ansiapi.h.

#define StgOpenStorageA StgOpenStorage

Definition at line 61 of file ansiapi.h.

#define StringFromCLSID2A StringFromCLSID2

Definition at line 50 of file ansiapi.h.

#define StringFromCLSIDA StringFromCLSID

Definition at line 56 of file ansiapi.h.

#define StringFromGUID2A StringFromGUID2

Definition at line 52 of file ansiapi.h.

#define StringFromIID2A StringFromIID2

Definition at line 51 of file ansiapi.h.

#define UNICODEOLE32

Definition at line 10 of file ansiapi.h.

#define UtDupStringA2W UtDupString

Definition at line 58 of file ansiapi.h.

#define W2A | ( | w,
 |  | a,
 |  | cb |
 | ) |  | lstrcpy (a, w)

Definition at line 28 of file ansiapi.h.

#define WASANSI ( )
Value:
{                                                           \
                   OutputDebugString("\n\r\t\tUnicode string was ANSI!\r\n"); \
                   Assert(0);                                                 \
                   _asm { int 3 }                                             \
                  }

Definition at line 18 of file ansiapi.h.

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/OleStd/Common.h File Reference

  • Com
  • Fundamentals
  • OleStd
Classes | Typedefs | Functions | Variables

Common.h File Reference

#include "ansiapi.h"

Go to the source code of this file.

Classes

struct | tagDRAWINFO
struct | tagICONEXTRACT
struct | tagLABELEXTRACT

Typedefs

typedef struct tagDRAWINFO | DRAWINFO
typedef struct tagICONEXTRACT | ICONEXTRACT
typedef struct tagLABELEXTRACT | LABELEXTRACT
typedef struct tagDRAWINFO * | LPDRAWINFO
typedef struct tagICONEXTRACT * | LPICONEXTRACT
typedef struct tagLABELEXTRACT * | LPLABELEXTRACT

Functions

int CALLBACK EXPORT | EnumMetafileExtractIcon (HDC, HANDLETABLE FAR *, METARECORD FAR *, int, LPICONEXTRACT)
int CALLBACK EXPORT | EnumMetafileExtractIconSource (HDC, HANDLETABLE FAR *, METARECORD FAR *, int, LPLABELEXTRACT)
int CALLBACK EXPORT | EnumMetafileExtractLabel (HDC, HANDLETABLE FAR *, METARECORD FAR *, int, LPLABELEXTRACT)
int CALLBACK EXPORT | EnumMetafileIconDraw (HDC, HANDLETABLE FAR *, METARECORD FAR *, int, LPARAM)

Variables

UINT cfEmbeddedObject
UINT cfEmbedSource
UINT cfFileName
UINT cfLinkSource
UINT cfLinkSrcDescriptor
UINT cfObjectDescriptor
UINT cfOwnerLink
HINSTANCE | ghInst

Typedef Documentation

typedef struct tagDRAWINFO DRAWINFO
typedef struct tagICONEXTRACT ICONEXTRACT
typedef struct tagLABELEXTRACT LABELEXTRACT
typedef struct tagDRAWINFO* LPDRAWINFO
typedef struct tagICONEXTRACT* LPICONEXTRACT
typedef struct tagLABELEXTRACT* LPLABELEXTRACT

Function Documentation

int CALLBACK EXPORT EnumMetafileExtractIcon | ( | HDC | ,
 |  | HANDLETABLE FAR * | ,
 |  | METARECORD FAR * | ,
 |  | int | ,
 |  | LPICONEXTRACT |
 | ) |  |

Definition at line 421 of file drawIcon.c.

   {
   LPBITMAPINFO        lpBI;
   LPBITMAPINFOHEADER  lpBH;
   LPBYTE              lpbSrc;
   LPBYTE              lpbDst;
   UINT                uWidth, uHeight;
   DWORD               cb;
   HGLOBAL             hMem;
   BITMAP              bm;
   HBITMAP             hBmp;
   int                 cxIcon, cyIcon;

   //Continue enumeration if we don't see the records we want.
   if (META_DIBBITBLT!=pMFR->rdFunction && META_DIBSTRETCHBLT!=pMFR->rdFunction)
      return 1;

   /*
    * Windows 3.0 DrawIcon uses META_DIBBITBLT in whereas 3.1 uses
    * META_DIBSTRETCHBLT so we have to handle each case separately.
    */

   if (META_DIBBITBLT==pMFR->rdFunction)       //Win3.0
      {
      //Get dimensions and the BITMAPINFO struct.
      uHeight=pMFR->rdParm[1];
      uWidth =pMFR->rdParm[2];
      lpBI=(LPBITMAPINFO)&(pMFR->rdParm[8]);
      }

   if (META_DIBSTRETCHBLT==pMFR->rdFunction)   //Win3.1
      {
      //Get dimensions and the BITMAPINFO struct.
      uHeight=pMFR->rdParm[2];
      uWidth =pMFR->rdParm[3];
      lpBI=(LPBITMAPINFO)&(pMFR->rdParm[10]);
      }

   lpBH=(LPBITMAPINFOHEADER)&(lpBI->bmiHeader);

   //Pointer to the bits which follows the BITMAPINFO structure.
   lpbSrc=(LPBYTE)lpBI+lpBH->biSize;

   //Add the length of the color table.
   if (0!=lpBH->biClrUsed)
      lpbSrc+=(DWORD)(lpBH->biClrUsed*sizeof(RGBQUAD));
   else
      {
      /*
       * 1 << bc gives 2, 16, 256 for 1, 4, or 8 bits.  24-bit
       * bitmaps have no color table, so there's no need to
       * change lpbSrc.
       */
      if (lpBH->biBitCount <= 8)
          lpbSrc+=(DWORD)((1 << (lpBH->biBitCount))*sizeof(RGBQUAD));
      }

   /*
    * All the bits we have in lpbSrc are device-independent, so we
    * need to change them over to be device-dependent using SetDIBits.
    * Once we have a bitmap with the device-dependent bits, we can
    * GetBitmapBits to have buffers with the real data.
    *
    * For each pass we have to allocate memory for the bits.  We save
    * the memory for the mask between passes.
    */

   //Use CreateBitmap for ANY monochrome bitmaps
   if (pIE->fAND || 1==lpBH->biBitCount || lpBH->biBitCount > 8)
      hBmp=CreateBitmap((UINT)lpBH->biWidth, (UINT)lpBH->biHeight, 1, 1, NULL);
   else if (lpBH->biBitCount <= 8)
      hBmp=CreateCompatibleBitmap(hDC, (UINT)lpBH->biWidth, (UINT)lpBH->biHeight);

   if (!hBmp || !SetDIBits(hDC, hBmp, 0, (UINT)lpBH->biHeight, (LPVOID)lpbSrc, lpBI, DIB_RGB_COLORS))
      {
      if (!pIE->fAND)
         GlobalFree(pIE->hMemAND);

      DeleteObject(hBmp);
      return 0;
      }

   //Allocate memory and get the DDBits into it.
   GetObject(hBmp, sizeof(bm), &bm);

   cb=bm.bmHeight*bm.bmWidthBytes * bm.bmPlanes;

//    if (cb % 4 != 0)        // dword align
//      cb += 4 - (cb % 4);

   hMem=GlobalAlloc(GHND, cb);

   if (NULL==hMem)
      {
      if (NULL!=pIE->hMemAND)
         GlobalFree(pIE->hMemAND);

      DeleteObject(hBmp);
      return 0;
      }

   lpbDst=(LPBYTE)GlobalLock(hMem);
   GetBitmapBits(hBmp, cb, (LPVOID)lpbDst);

   DeleteObject(hBmp);
   GlobalUnlock(hMem);

   /*
    * If this is the first pass (pIE->fAND==TRUE) then save the memory
    * of the AND bits for the next pass.
    */
   if (pIE->fAND)
      {
      pIE->fAND=FALSE;
      pIE->hMemAND=hMem;

      //Continue enumeration looking for the next blt record.
      return 1;
      }
   else
      {
      //Get the AND pointer again.
      lpbSrc=(LPBYTE)GlobalLock(pIE->hMemAND);

      /*
       * Create the icon now that we have all the data.  lpbDst already
       * points to the XOR bits.
       */
      cxIcon = GetSystemMetrics(SM_CXICON);
      cyIcon = GetSystemMetrics(SM_CYICON);

      pIE->hIcon=CreateIcon(ghInst,
                       uWidth,
                       uHeight,
                       (BYTE)bm.bmPlanes,
                       (BYTE)bm.bmBitsPixel,
                       (LPVOID)lpbSrc,
                       (LPVOID)lpbDst);

      GlobalUnlock(pIE->hMemAND);
      GlobalFree(pIE->hMemAND);
      GlobalFree(hMem);

      //We're done so we can stop.
      return 0;
      }
   }

int CALLBACK EXPORT EnumMetafileExtractIconSource | ( | HDC | ,
 |  | HANDLETABLE FAR * | ,
 |  | METARECORD FAR * | ,
 |  | int | ,
 |  | LPLABELEXTRACT |
 | ) |  |

Definition at line 655 of file drawIcon.c.

   {
   LPSTR       psz;

   /*
    * We don't allow anything to happen until we see "IconOnly"
    * in an MFCOMMENT that is used to enable everything else.
    */
   if (!pLE->fFoundIconOnly)
      {
      if (META_ESCAPE==pMFR->rdFunction && MFCOMMENT==pMFR->rdParm[0])
         {
         if (0==lstrcmpi(szIconOnly, (LPSTR)&pMFR->rdParm[2]))
            pLE->fFoundIconOnly=TRUE;
         }

      return 1;
      }

   //Now see if we find the source string.
   if (!pLE->fFoundSource)
      {
      if (META_ESCAPE==pMFR->rdFunction && MFCOMMENT==pMFR->rdParm[0])
         {
         A2W  ((LPSTR)&pMFR->rdParm[2], pLE->lpsz, OLEUI_CCHPATHMAX);
         pLE->lpsz[OLEUI_CCHPATHMAX-1] = '\0';
         pLE->fFoundSource=TRUE;
         }

      return 1;
      }

   //Next comment will be the icon index.
   if (META_ESCAPE==pMFR->rdFunction && MFCOMMENT==pMFR->rdParm[0])
      {
      /*
       * This string contains the icon index in string form,
       * so we need to convert back to a UINT.  After we see this
       * we can stop the enumeration.  The comment will have
       * a null terminator because we made sure to save it.
       */
      psz=(LPSTR)&pMFR->rdParm[2];
      pLE->u.iIcon=0;

      //Do Ye Olde atoi
      while (*psz)
         pLE->u.iIcon=(10*pLE->u.iIcon)+((*psz++)-'0');

      pLE->fFoundIndex=TRUE;
      return 0;
      }

   return 1;
   }

int CALLBACK EXPORT EnumMetafileExtractLabel | ( | HDC | ,
 |  | HANDLETABLE FAR * | ,
 |  | METARECORD FAR * | ,
 |  | int | ,
 |  | LPLABELEXTRACT |
 | ) |  |

Definition at line 290 of file drawIcon.c.

   {

   /*
    * We don't allow anything to happen until we see "IconOnly"
    * in an MFCOMMENT that is used to enable everything else.
    */
   if (!pLE->fFoundIconOnly)
      {
      if (META_ESCAPE==pMFR->rdFunction && MFCOMMENT==pMFR->rdParm[0])
         {
         if (0==lstrcmpi(szIconOnly, (LPSTR)&pMFR->rdParm[2]))
            pLE->fFoundIconOnly=TRUE;
         }

      return 1;
      }

   //Enumerate all records looking for META_EXTTEXTOUT - there can be more
   //than one.
   if (META_EXTTEXTOUT==pMFR->rdFunction)
      {
      UINT        cchMax;
      LPOLESTR    lpszTemp;

       /*
       * If ExtTextOut has NULL fuOptions, then the rectangle is omitted
       * from the record, and the string starts at rdParm[4].  If
       * fuOptions is non-NULL, then the string starts at rdParm[8]
       * (since the rectange takes up four WORDs in the array).  In
       * both cases, the string continues for (rdParm[2]+1) >> 1
       * words.  We just cast a pointer to rdParm[8] to an LPSTR and
       * lstrcpyn into the buffer we were given.
       *
       * Note that we use element 8 in rdParm instead of 4 because we
       * passed ETO_CLIPPED in for the options on ExtTextOut--docs say
       * [4] which is rect doesn't exist if we passed zero there.
       *
       */

      cchMax=min(pLE->u.cch - pLE->Index, (UINT)pMFR->rdParm[2]);
      lpszTemp = /*(LPOLESTR)*/((/*(LPSTR)*/pLE->lpsz) + pLE->Index);

      A2W ((LPSTR)&(pMFR->rdParm[8]), lpszTemp, cchMax);
      lpszTemp[cchMax]='\0';

      pLE->u.cch = OLESTRLEN (pLE->lpsz);
      pLE->PrevIndex = pLE->Index;
      pLE->Index += cchMax;
      }

   return 1;
   }

int CALLBACK EXPORT EnumMetafileIconDraw | ( | HDC | ,
 |  | HANDLETABLE FAR * | ,
 |  | METARECORD FAR * | ,
 |  | int | ,
 |  | LPARAM |
 | ) |  |

Definition at line 159 of file drawIcon.c.

   {
   LPDRAWINFO lpdi = (LPDRAWINFO)lParam;

   /*
    * We play everything blindly except for DIBBITBLT (or DIBSTRETCHBLT)
    * and ESCAPE with MFCOMMENT.  For the BitBlts we change the x,y to
    * draw at (0,0) instead of wherever it was written to draw.  The
    * comment tells us there to stop if we don't want to draw the label.
    */

   //If we're playing icon only, stop enumeration at the comment.
   if (lpdi->fIconOnly)
      {
      if (META_ESCAPE==pMFR->rdFunction && MFCOMMENT==pMFR->rdParm[0])
         {
         if (0==lstrcmpi(szIconOnly, (LPSTR)&pMFR->rdParm[2]))
            return 0;
         }

      /*
       * Check for the records in which we want to munge the coordinates.
       * destX is offset 6 for BitBlt, offset 9 for StretchBlt, either of
       * which may appear in the metafile.
       */
      if (META_DIBBITBLT==pMFR->rdFunction)
         pMFR->rdParm[6]=0;

      if (META_DIBSTRETCHBLT==pMFR->rdFunction)
           pMFR->rdParm[9] = 0;

      }

   PlayMetaFileRecord(hDC, phTable, pMFR, cObj);
   return 1;
   }

Variable Documentation

UINT cfEmbeddedObject

Definition at line 42 of file ole2ui.c.

UINT cfEmbedSource

Definition at line 41 of file ole2ui.c.

UINT cfFileName

Definition at line 45 of file ole2ui.c.

UINT cfLinkSource

Definition at line 43 of file ole2ui.c.

UINT cfLinkSrcDescriptor

Definition at line 40 of file ole2ui.c.

UINT cfObjectDescriptor

Definition at line 39 of file ole2ui.c.

UINT cfOwnerLink

Definition at line 44 of file ole2ui.c.

HINSTANCE ghInst

Definition at line 24 of file ole2ui.c.

Generated on Wed Nov 13 2024 16:53:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/OleStd/dballoc.Cpp File Reference

  • Com
  • Fundamentals
  • OleStd
Classes | Defines | Functions | Variables

dballoc.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <stdarg.h>
#include <stdio.h>
#include <malloc.h>
#include <string.h>
#include <limits.h>
#include "dballoc.h"

Go to the source code of this file.

Classes

class | CAddrNode
class | CDbAlloc
class | CStdDbOutput

Defines

#define | ASSERT(X) Assertion(X, #X, __FILE__, __LINE__, NULL)
#define | ASSERTSZ(X, SZ) Assertion(X, #X, __FILE__, __LINE__, SZ)
#define | classmodel FAR
#define | DIM(X) (sizeof(X)/sizeof((X)[0]))
#define | FREE(PV) _ffree(PV)
#define | HEAPMIN() _fheapmin()
#define | MALLOC(CB) _fmalloc(CB)
#define | MEMCMP(PV1, PV2, CB) _fmemcmp((PV1), (PV2), (CB))
#define | MEMCPY(PV1, PV2, CB) _fmemcpy((PV1), (PV2), (CB))
#define | MEMSET(PV,VAL, CB) _fmemset((PV), (VAL), (CB))
#define | REALLOC(PV, CB) _frealloc(PV, CB)
#define | STRICT
#define | UNREACHED 0
#define | WINDLL 1

Functions

STDAPI | OleStdCreateDbAlloc (ULONG reserved, IMalloc FAR *FAR *ppmalloc)

Variables

DWORD g_dwObjectCount

Define Documentation

#define ASSERT ( X ) Assertion(X, #X, __FILE__, __LINE__, NULL)

Definition at line 306 of file dballoc.Cpp.

#define ASSERTSZ | ( | X,
 |  | SZ |
 | ) |  | Assertion(X, #X, __FILE__, __LINE__, SZ)

Definition at line 308 of file dballoc.Cpp.

#define classmodel FAR

Definition at line 151 of file dballoc.Cpp.

#define DIM ( X ) (sizeof(X)/sizeof((X)[0]))

Definition at line 106 of file dballoc.Cpp.

#define FREE ( PV ) _ffree(PV)

Definition at line 132 of file dballoc.Cpp.

#define HEAPMIN ( ) _fheapmin()

Definition at line 133 of file dballoc.Cpp.

#define MALLOC ( CB ) _fmalloc(CB)

Definition at line 130 of file dballoc.Cpp.

#define MEMCMP | ( | PV1,
 |  | PV2,
 |  | CB |
 | ) |  | _fmemcmp((PV1), (PV2), (CB))

Definition at line 127 of file dballoc.Cpp.

#define MEMCPY | ( | PV1,
 |  | PV2,
 |  | CB |
 | ) |  | _fmemcpy((PV1), (PV2), (CB))

Definition at line 128 of file dballoc.Cpp.

#define MEMSET | ( | PV,
 |  | VAL,
 |  | CB |
 | ) |  | _fmemset((PV), (VAL), (CB))

Definition at line 129 of file dballoc.Cpp.

#define REALLOC | ( | PV,
 |  | CB |
 | ) |  | _frealloc(PV, CB)

Definition at line 131 of file dballoc.Cpp.

#define STRICT

Definition at line 80 of file dballoc.Cpp.

#define UNREACHED 0

Definition at line 108 of file dballoc.Cpp.

#define WINDLL 1

Definition at line 90 of file dballoc.Cpp.

Function Documentation

STDAPI OleStdCreateDbAlloc | ( | ULONG | reserved,
 |  | IMalloc FAR *FAR * | ppmalloc
 | ) |  |

Definition at line 333 of file dballoc.Cpp.

{
   return CDbAlloc::Create(reserved, NULL, ppmalloc);
}

Variable Documentation

DWORD g_dwObjectCount

Definition at line 104 of file dballoc.Cpp.

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/OleStd/dballoc.h File Reference

  • Com
  • Fundamentals
  • OleStd
Functions | Variables

dballoc.h File Reference

Go to the source code of this file.

Functions

virtual void _cdecl | Printf (THIS_ char FAR *szFmt,...) PURE
STDMETHOD_ (void, Assertion)(THIS_ BOOL cond
STDMETHOD_ (ULONG, AddRef)(THIS) PURE
STDMETHOD_ (ULONG, Release)(THIS) PURE

Variables

interface void FAR *FAR *ppv | PURE
char FAR * | szExpr
char FAR char FAR * | szFile
char FAR char FAR UINT | uLine

Function Documentation

virtual void _cdecl Printf | ( | THIS_ char FAR * | szFmt,
 |  |  | ... |
 | ) |  |  | [virtual]
STDMETHOD_ | ( | void | ,
 |  | Assertion |
 | ) |  |
STDMETHOD_ | ( | ULONG | ,
 |  | AddRef |
 | ) |  |
STDMETHOD_ | ( | ULONG | ,
 |  | Release |
 | ) |  |

Variable Documentation

char FAR char FAR UINT char FAR *szMsg PURE

Definition at line 20 of file dballoc.h.

char FAR* szExpr

Definition at line 29 of file dballoc.h.

char FAR char FAR* szFile

Definition at line 29 of file dballoc.h.

char FAR char FAR UINT uLine

Definition at line 29 of file dballoc.h.

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/OleStd/dbgUtil.c File Reference

  • Com
  • Fundamentals
  • OleStd
Defines | Functions

dbgUtil.c File Reference

#include "olestd.h"

Go to the source code of this file.

Defines

#define | CASE_SCODE(sc)
#define | STRICT 1

Functions

STDAPI_ (void)
STDAPI_ (int)

Define Documentation

#define CASE_SCODE ( sc )
Value:
case sc: \
                        lstrcpy(/*(LPSTR)*/szErrName, /*(LPSTR)*/#sc); \
                        break;

Definition at line 148 of file dbgUtil.c.

#define STRICT 1

Definition at line 13 of file dbgUtil.c.

Function Documentation

STDAPI_ ( void )

Definition at line 153 of file dbgUtil.c.

{
#if defined( _DEBUG )
        char szBuf[256];
        char szErrName[40];

        switch (sc) {

                /* SCODE's defined in SCODE.H */

                CASE_SCODE(S_OK)
                CASE_SCODE(S_FALSE)
                CASE_SCODE(E_UNEXPECTED)
                CASE_SCODE(E_OUTOFMEMORY)
                CASE_SCODE(E_INVALIDARG)
                CASE_SCODE(E_NOINTERFACE)
                CASE_SCODE(E_POINTER)
                CASE_SCODE(E_HANDLE)
                CASE_SCODE(E_ABORT)
                CASE_SCODE(E_FAIL)
                CASE_SCODE(E_ACCESSDENIED)

                /* SCODE's defined in OLE2.H */

                CASE_SCODE(OLE_E_OLEVERB)
                CASE_SCODE(OLE_E_ADVF)
                CASE_SCODE(OLE_E_ENUM_NOMORE)
                CASE_SCODE(OLE_E_ADVISENOTSUPPORTED)
                CASE_SCODE(OLE_E_NOCONNECTION)
                CASE_SCODE(OLE_E_NOTRUNNING)
                CASE_SCODE(OLE_E_NOCACHE)
                CASE_SCODE(OLE_E_BLANK)
                CASE_SCODE(OLE_E_CLASSDIFF)
                CASE_SCODE(OLE_E_CANT_GETMONIKER)
                CASE_SCODE(OLE_E_CANT_BINDTOSOURCE)
                CASE_SCODE(OLE_E_STATIC)
                CASE_SCODE(OLE_E_PROMPTSAVECANCELLED)
                CASE_SCODE(OLE_E_INVALIDRECT)
                CASE_SCODE(OLE_E_WRONGCOMPOBJ)
                CASE_SCODE(OLE_E_INVALIDHWND)
                CASE_SCODE(OLE_E_NOT_INPLACEACTIVE)
                CASE_SCODE(OLE_E_CANTCONVERT)
                CASE_SCODE(OLE_E_NOSTORAGE)

                CASE_SCODE(DV_E_FORMATETC)
                CASE_SCODE(DV_E_DVTARGETDEVICE)
                CASE_SCODE(DV_E_STGMEDIUM)
                CASE_SCODE(DV_E_STATDATA)
                CASE_SCODE(DV_E_LINDEX)
                CASE_SCODE(DV_E_TYMED)
                CASE_SCODE(DV_E_CLIPFORMAT)
                CASE_SCODE(DV_E_DVASPECT)
                CASE_SCODE(DV_E_DVTARGETDEVICE_SIZE)
                CASE_SCODE(DV_E_NOIVIEWOBJECT)

                CASE_SCODE(OLE_S_USEREG)
                CASE_SCODE(OLE_S_STATIC)
                CASE_SCODE(OLE_S_MAC_CLIPFORMAT)

                CASE_SCODE(CONVERT10_E_OLESTREAM_GET)
                CASE_SCODE(CONVERT10_E_OLESTREAM_PUT)
                CASE_SCODE(CONVERT10_E_OLESTREAM_FMT)
                CASE_SCODE(CONVERT10_E_OLESTREAM_BITMAP_TO_DIB)
                CASE_SCODE(CONVERT10_E_STG_FMT)
                CASE_SCODE(CONVERT10_E_STG_NO_STD_STREAM)
                CASE_SCODE(CONVERT10_E_STG_DIB_TO_BITMAP)
                CASE_SCODE(CONVERT10_S_NO_PRESENTATION)

                CASE_SCODE(CLIPBRD_E_CANT_OPEN)
                CASE_SCODE(CLIPBRD_E_CANT_EMPTY)
                CASE_SCODE(CLIPBRD_E_CANT_SET)
                CASE_SCODE(CLIPBRD_E_BAD_DATA)
                CASE_SCODE(CLIPBRD_E_CANT_CLOSE)

                CASE_SCODE(DRAGDROP_E_NOTREGISTERED)
                CASE_SCODE(DRAGDROP_E_ALREADYREGISTERED)
                CASE_SCODE(DRAGDROP_E_INVALIDHWND)
                CASE_SCODE(DRAGDROP_S_DROP)
                CASE_SCODE(DRAGDROP_S_CANCEL)
                CASE_SCODE(DRAGDROP_S_USEDEFAULTCURSORS)

                CASE_SCODE(OLEOBJ_E_NOVERBS)
                CASE_SCODE(OLEOBJ_E_INVALIDVERB)
                CASE_SCODE(OLEOBJ_S_INVALIDVERB)
                CASE_SCODE(OLEOBJ_S_CANNOT_DOVERB_NOW)
                CASE_SCODE(OLEOBJ_S_INVALIDHWND)
                CASE_SCODE(INPLACE_E_NOTUNDOABLE)
                CASE_SCODE(INPLACE_E_NOTOOLSPACE)
                CASE_SCODE(INPLACE_S_TRUNCATED)

                /* SCODE's defined in COMPOBJ.H */

                CASE_SCODE(CO_E_NOTINITIALIZED)
                CASE_SCODE(CO_E_ALREADYINITIALIZED)
                CASE_SCODE(CO_E_CANTDETERMINECLASS)
                CASE_SCODE(CO_E_CLASSSTRING)
                CASE_SCODE(CO_E_IIDSTRING)
                CASE_SCODE(CO_E_APPNOTFOUND)
                CASE_SCODE(CO_E_APPSINGLEUSE)
                CASE_SCODE(CO_E_ERRORINAPP)
                CASE_SCODE(CO_E_DLLNOTFOUND)
                CASE_SCODE(CO_E_ERRORINDLL)
                CASE_SCODE(CO_E_WRONGOSFORAPP)
                CASE_SCODE(CO_E_OBJNOTREG)
                CASE_SCODE(CO_E_OBJISREG)
                CASE_SCODE(CO_E_OBJNOTCONNECTED)
                CASE_SCODE(CO_E_APPDIDNTREG)
                CASE_SCODE(CLASS_E_NOAGGREGATION)
                CASE_SCODE(CLASS_E_CLASSNOTAVAILABLE)
                CASE_SCODE(REGDB_E_READREGDB)
                CASE_SCODE(REGDB_E_WRITEREGDB)
                CASE_SCODE(REGDB_E_KEYMISSING)
                CASE_SCODE(REGDB_E_INVALIDVALUE)
                CASE_SCODE(REGDB_E_CLASSNOTREG)
                CASE_SCODE(REGDB_E_IIDNOTREG)
                CASE_SCODE(RPC_E_CALL_REJECTED)
                CASE_SCODE(RPC_E_CALL_CANCELED)
                CASE_SCODE(RPC_E_CANTPOST_INSENDCALL)
                CASE_SCODE(RPC_E_CANTCALLOUT_INASYNCCALL)
                CASE_SCODE(RPC_E_CANTCALLOUT_INEXTERNALCALL)
                CASE_SCODE(RPC_E_CONNECTION_TERMINATED)
                CASE_SCODE(RPC_E_SERVER_DIED)
                CASE_SCODE(RPC_E_CLIENT_DIED)
                CASE_SCODE(RPC_E_INVALID_DATAPACKET)
                CASE_SCODE(RPC_E_CANTTRANSMIT_CALL)
                CASE_SCODE(RPC_E_CLIENT_CANTMARSHAL_DATA)
                CASE_SCODE(RPC_E_CLIENT_CANTUNMARSHAL_DATA)
                CASE_SCODE(RPC_E_SERVER_CANTMARSHAL_DATA)
                CASE_SCODE(RPC_E_SERVER_CANTUNMARSHAL_DATA)
                CASE_SCODE(RPC_E_INVALID_DATA)
                CASE_SCODE(RPC_E_INVALID_PARAMETER)
                CASE_SCODE(RPC_E_UNEXPECTED)

                /* SCODE's defined in DVOBJ.H */

                CASE_SCODE(DATA_S_SAMEFORMATETC)
                CASE_SCODE(VIEW_E_DRAW)
                CASE_SCODE(VIEW_S_ALREADY_FROZEN)
                CASE_SCODE(CACHE_E_NOCACHE_UPDATED)
                CASE_SCODE(CACHE_S_FORMATETC_NOTSUPPORTED)
                CASE_SCODE(CACHE_S_SAMECACHE)
                CASE_SCODE(CACHE_S_SOMECACHES_NOTUPDATED)

                /* SCODE's defined in STORAGE.H */

                CASE_SCODE(STG_E_INVALIDFUNCTION)
                CASE_SCODE(STG_E_FILENOTFOUND)
                CASE_SCODE(STG_E_PATHNOTFOUND)
                CASE_SCODE(STG_E_TOOMANYOPENFILES)
                CASE_SCODE(STG_E_ACCESSDENIED)
                CASE_SCODE(STG_E_INVALIDHANDLE)
                CASE_SCODE(STG_E_INSUFFICIENTMEMORY)
                CASE_SCODE(STG_E_INVALIDPOINTER)
                CASE_SCODE(STG_E_NOMOREFILES)
                CASE_SCODE(STG_E_DISKISWRITEPROTECTED)
                CASE_SCODE(STG_E_SEEKERROR)
                CASE_SCODE(STG_E_WRITEFAULT)
                CASE_SCODE(STG_E_READFAULT)
                CASE_SCODE(STG_E_SHAREVIOLATION)
                CASE_SCODE(STG_E_LOCKVIOLATION)
                CASE_SCODE(STG_E_FILEALREADYEXISTS)
                CASE_SCODE(STG_E_INVALIDPARAMETER)
                CASE_SCODE(STG_E_MEDIUMFULL)
                CASE_SCODE(STG_E_ABNORMALAPIEXIT)
                CASE_SCODE(STG_E_INVALIDHEADER)
                CASE_SCODE(STG_E_INVALIDNAME)
                CASE_SCODE(STG_E_UNKNOWN)
                CASE_SCODE(STG_E_UNIMPLEMENTEDFUNCTION)
                CASE_SCODE(STG_E_INVALIDFLAG)
                CASE_SCODE(STG_E_INUSE)
                CASE_SCODE(STG_E_NOTCURRENT)
                CASE_SCODE(STG_E_REVERTED)
                CASE_SCODE(STG_E_CANTSAVE)
                CASE_SCODE(STG_E_OLDFORMAT)
                CASE_SCODE(STG_E_OLDDLL)
                CASE_SCODE(STG_E_SHAREREQUIRED)
                CASE_SCODE(STG_E_NOTFILEBASEDSTORAGE)
                CASE_SCODE(STG_E_EXTANTMARSHALLINGS)
                CASE_SCODE(STG_S_CONVERTED)

                /* SCODE's defined in MONIKER.H */

                CASE_SCODE(MK_E_CONNECTMANUALLY)
                CASE_SCODE(MK_E_EXCEEDEDDEADLINE)
                CASE_SCODE(MK_E_NEEDGENERIC)
                CASE_SCODE(MK_E_UNAVAILABLE)
                CASE_SCODE(MK_E_SYNTAX)
                CASE_SCODE(MK_E_NOOBJECT)
                CASE_SCODE(MK_E_INVALIDEXTENSION)
                CASE_SCODE(MK_E_INTERMEDIATEINTERFACENOTSUPPORTED)
                CASE_SCODE(MK_E_NOTBINDABLE)
                CASE_SCODE(MK_E_NOTBOUND)
                CASE_SCODE(MK_E_CANTOPENFILE)
                CASE_SCODE(MK_E_MUSTBOTHERUSER)
                CASE_SCODE(MK_E_NOINVERSE)
                CASE_SCODE(MK_E_NOSTORAGE)
                CASE_SCODE(MK_E_NOPREFIX)
                CASE_SCODE(MK_S_REDUCED_TO_SELF)
                CASE_SCODE(MK_S_ME)
                CASE_SCODE(MK_S_HIM)
                CASE_SCODE(MK_S_US)
                CASE_SCODE(MK_S_MONIKERALREADYREGISTERED)

                default:
                        lstrcpy(szErrName, "UNKNOWN SCODE");
        }

        wsprintf(szBuf, "%s %s (0x%lx)\n", lpszMsg, /*(LPSTR)*/szErrName, sc);
        OleDbgPrintAlways(lpszPrefix, szBuf, 0);
#endif  // _DEBUG
}

STDAPI_ ( int )

Definition at line 61 of file dbgUtil.c.

{
        return s_nDbgLevel;
}

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/OleStd/debug.h File Reference

  • Com
  • Fundamentals
  • OleStd
Defines

debug.h File Reference

Go to the source code of this file.

Defines

#define | D(x)
#define | ODS(x)
#define | ODSlu(f, lu)
#define | ODSsz(f, s)
#define | ODSszlu(f, s, lu)
#define | ODSszu(f, s, u)
#define | ODSu(f, u)

Define Documentation

#define D ( x )

Definition at line 57 of file debug.h.

#define ODS ( x )

Definition at line 58 of file debug.h.

#define ODSlu | ( | f,
 |  | lu
 | ) |

Definition at line 62 of file debug.h.

#define ODSsz | ( | f,
 |  | s
 | ) |

Definition at line 60 of file debug.h.

#define ODSszlu | ( | f,
 |  | s,
 |  | lu
 | ) |

Definition at line 64 of file debug.h.

#define ODSszu | ( | f,
 |  | s,
 |  | u
 | ) |

Definition at line 63 of file debug.h.

#define ODSu | ( | f,
 |  | u
 | ) |

Definition at line 61 of file debug.h.

Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/OleStd/drawIcon.c File Reference

  • Com
  • Fundamentals
  • OleStd
Defines | Functions

drawIcon.c File Reference

#include "olestd.h"
#include "common.h"
#include "utility.h"

Go to the source code of this file.

Defines

#define | STRICT 1

Functions

int CALLBACK EXPORT | EnumMetafileExtractIcon (HDC hDC, HANDLETABLE FAR *phTable, METARECORD FAR *pMFR, int cObj, LPICONEXTRACT pIE)
int CALLBACK EXPORT | EnumMetafileExtractIconSource (HDC hDC, HANDLETABLE FAR *phTable, METARECORD FAR *pMFR, int cObj, LPLABELEXTRACT pLE)
int CALLBACK EXPORT | EnumMetafileExtractLabel (HDC hDC, HANDLETABLE FAR *phTable, METARECORD FAR *pMFR, int cObj, LPLABELEXTRACT pLE)
int CALLBACK EXPORT | EnumMetafileIconDraw (HDC hDC, HANDLETABLE FAR *phTable, METARECORD FAR *pMFR, int cObj, LPARAM lParam)
STDAPI_ (BOOL)
STDAPI_ (UINT)
STDAPI_ (void)
STDAPI_ (HICON)

Define Documentation

#define STRICT 1

Definition at line 15 of file drawIcon.c.

Function Documentation

int CALLBACK EXPORT EnumMetafileExtractIcon | ( | HDC | hDC,
 |  | HANDLETABLE FAR * | phTable,
 |  | METARECORD FAR * | pMFR,
 |  | int | cObj,
 |  | LPICONEXTRACT | pIE
 | ) |  |

Definition at line 421 of file drawIcon.c.

   {
   LPBITMAPINFO        lpBI;
   LPBITMAPINFOHEADER  lpBH;
   LPBYTE              lpbSrc;
   LPBYTE              lpbDst;
   UINT                uWidth, uHeight;
   DWORD               cb;
   HGLOBAL             hMem;
   BITMAP              bm;
   HBITMAP             hBmp;
   int                 cxIcon, cyIcon;

   //Continue enumeration if we don't see the records we want.
   if (META_DIBBITBLT!=pMFR->rdFunction && META_DIBSTRETCHBLT!=pMFR->rdFunction)
      return 1;

   /*
    * Windows 3.0 DrawIcon uses META_DIBBITBLT in whereas 3.1 uses
    * META_DIBSTRETCHBLT so we have to handle each case separately.
    */

   if (META_DIBBITBLT==pMFR->rdFunction)       //Win3.0
      {
      //Get dimensions and the BITMAPINFO struct.
      uHeight=pMFR->rdParm[1];
      uWidth =pMFR->rdParm[2];
      lpBI=(LPBITMAPINFO)&(pMFR->rdParm[8]);
      }

   if (META_DIBSTRETCHBLT==pMFR->rdFunction)   //Win3.1
      {
      //Get dimensions and the BITMAPINFO struct.
      uHeight=pMFR->rdParm[2];
      uWidth =pMFR->rdParm[3];
      lpBI=(LPBITMAPINFO)&(pMFR->rdParm[10]);
      }

   lpBH=(LPBITMAPINFOHEADER)&(lpBI->bmiHeader);

   //Pointer to the bits which follows the BITMAPINFO structure.
   lpbSrc=(LPBYTE)lpBI+lpBH->biSize;

   //Add the length of the color table.
   if (0!=lpBH->biClrUsed)
      lpbSrc+=(DWORD)(lpBH->biClrUsed*sizeof(RGBQUAD));
   else
      {
      /*
       * 1 << bc gives 2, 16, 256 for 1, 4, or 8 bits.  24-bit
       * bitmaps have no color table, so there's no need to
       * change lpbSrc.
       */
      if (lpBH->biBitCount <= 8)
          lpbSrc+=(DWORD)((1 << (lpBH->biBitCount))*sizeof(RGBQUAD));
      }

   /*
    * All the bits we have in lpbSrc are device-independent, so we
    * need to change them over to be device-dependent using SetDIBits.
    * Once we have a bitmap with the device-dependent bits, we can
    * GetBitmapBits to have buffers with the real data.
    *
    * For each pass we have to allocate memory for the bits.  We save
    * the memory for the mask between passes.
    */

   //Use CreateBitmap for ANY monochrome bitmaps
   if (pIE->fAND || 1==lpBH->biBitCount || lpBH->biBitCount > 8)
      hBmp=CreateBitmap((UINT)lpBH->biWidth, (UINT)lpBH->biHeight, 1, 1, NULL);
   else if (lpBH->biBitCount <= 8)
      hBmp=CreateCompatibleBitmap(hDC, (UINT)lpBH->biWidth, (UINT)lpBH->biHeight);

   if (!hBmp || !SetDIBits(hDC, hBmp, 0, (UINT)lpBH->biHeight, (LPVOID)lpbSrc, lpBI, DIB_RGB_COLORS))
      {
      if (!pIE->fAND)
         GlobalFree(pIE->hMemAND);

      DeleteObject(hBmp);
      return 0;
      }

   //Allocate memory and get the DDBits into it.
   GetObject(hBmp, sizeof(bm), &bm);

   cb=bm.bmHeight*bm.bmWidthBytes * bm.bmPlanes;

//    if (cb % 4 != 0)        // dword align
//      cb += 4 - (cb % 4);

   hMem=GlobalAlloc(GHND, cb);

   if (NULL==hMem)
      {
      if (NULL!=pIE->hMemAND)
         GlobalFree(pIE->hMemAND);

      DeleteObject(hBmp);
      return 0;
      }

   lpbDst=(LPBYTE)GlobalLock(hMem);
   GetBitmapBits(hBmp, cb, (LPVOID)lpbDst);

   DeleteObject(hBmp);
   GlobalUnlock(hMem);

   /*
    * If this is the first pass (pIE->fAND==TRUE) then save the memory
    * of the AND bits for the next pass.
    */
   if (pIE->fAND)
      {
      pIE->fAND=FALSE;
      pIE->hMemAND=hMem;

      //Continue enumeration looking for the next blt record.
      return 1;
      }
   else
      {
      //Get the AND pointer again.
      lpbSrc=(LPBYTE)GlobalLock(pIE->hMemAND);

      /*
       * Create the icon now that we have all the data.  lpbDst already
       * points to the XOR bits.
       */
      cxIcon = GetSystemMetrics(SM_CXICON);
      cyIcon = GetSystemMetrics(SM_CYICON);

      pIE->hIcon=CreateIcon(ghInst,
                       uWidth,
                       uHeight,
                       (BYTE)bm.bmPlanes,
                       (BYTE)bm.bmBitsPixel,
                       (LPVOID)lpbSrc,
                       (LPVOID)lpbDst);

      GlobalUnlock(pIE->hMemAND);
      GlobalFree(pIE->hMemAND);
      GlobalFree(hMem);

      //We're done so we can stop.
      return 0;
      }
   }

int CALLBACK EXPORT EnumMetafileExtractIconSource | ( | HDC | hDC,
 |  | HANDLETABLE FAR * | phTable,
 |  | METARECORD FAR * | pMFR,
 |  | int | cObj,
 |  | LPLABELEXTRACT | pLE
 | ) |  |

Definition at line 655 of file drawIcon.c.

   {
   LPSTR       psz;

   /*
    * We don't allow anything to happen until we see "IconOnly"
    * in an MFCOMMENT that is used to enable everything else.
    */
   if (!pLE->fFoundIconOnly)
      {
      if (META_ESCAPE==pMFR->rdFunction && MFCOMMENT==pMFR->rdParm[0])
         {
         if (0==lstrcmpi(szIconOnly, (LPSTR)&pMFR->rdParm[2]))
            pLE->fFoundIconOnly=TRUE;
         }

      return 1;
      }

   //Now see if we find the source string.
   if (!pLE->fFoundSource)
      {
      if (META_ESCAPE==pMFR->rdFunction && MFCOMMENT==pMFR->rdParm[0])
         {
         A2W  ((LPSTR)&pMFR->rdParm[2], pLE->lpsz, OLEUI_CCHPATHMAX);
         pLE->lpsz[OLEUI_CCHPATHMAX-1] = '\0';
         pLE->fFoundSource=TRUE;
         }

      return 1;
      }

   //Next comment will be the icon index.
   if (META_ESCAPE==pMFR->rdFunction && MFCOMMENT==pMFR->rdParm[0])
      {
      /*
       * This string contains the icon index in string form,
       * so we need to convert back to a UINT.  After we see this
       * we can stop the enumeration.  The comment will have
       * a null terminator because we made sure to save it.
       */
      psz=(LPSTR)&pMFR->rdParm[2];
      pLE->u.iIcon=0;

      //Do Ye Olde atoi
      while (*psz)
         pLE->u.iIcon=(10*pLE->u.iIcon)+((*psz++)-'0');

      pLE->fFoundIndex=TRUE;
      return 0;
      }

   return 1;
   }

int CALLBACK EXPORT EnumMetafileExtractLabel | ( | HDC | hDC,
 |  | HANDLETABLE FAR * | phTable,
 |  | METARECORD FAR * | pMFR,
 |  | int | cObj,
 |  | LPLABELEXTRACT | pLE
 | ) |  |

Definition at line 290 of file drawIcon.c.

   {

   /*
    * We don't allow anything to happen until we see "IconOnly"
    * in an MFCOMMENT that is used to enable everything else.
    */
   if (!pLE->fFoundIconOnly)
      {
      if (META_ESCAPE==pMFR->rdFunction && MFCOMMENT==pMFR->rdParm[0])
         {
         if (0==lstrcmpi(szIconOnly, (LPSTR)&pMFR->rdParm[2]))
            pLE->fFoundIconOnly=TRUE;
         }

      return 1;
      }

   //Enumerate all records looking for META_EXTTEXTOUT - there can be more
   //than one.
   if (META_EXTTEXTOUT==pMFR->rdFunction)
      {
      UINT        cchMax;
      LPOLESTR    lpszTemp;

       /*
       * If ExtTextOut has NULL fuOptions, then the rectangle is omitted
       * from the record, and the string starts at rdParm[4].  If
       * fuOptions is non-NULL, then the string starts at rdParm[8]
       * (since the rectange takes up four WORDs in the array).  In
       * both cases, the string continues for (rdParm[2]+1) >> 1
       * words.  We just cast a pointer to rdParm[8] to an LPSTR and
       * lstrcpyn into the buffer we were given.
       *
       * Note that we use element 8 in rdParm instead of 4 because we
       * passed ETO_CLIPPED in for the options on ExtTextOut--docs say
       * [4] which is rect doesn't exist if we passed zero there.
       *
       */

      cchMax=min(pLE->u.cch - pLE->Index, (UINT)pMFR->rdParm[2]);
      lpszTemp = /*(LPOLESTR)*/((/*(LPSTR)*/pLE->lpsz) + pLE->Index);

      A2W ((LPSTR)&(pMFR->rdParm[8]), lpszTemp, cchMax);
      lpszTemp[cchMax]='\0';

      pLE->u.cch = OLESTRLEN (pLE->lpsz);
      pLE->PrevIndex = pLE->Index;
      pLE->Index += cchMax;
      }

   return 1;
   }

int CALLBACK EXPORT EnumMetafileIconDraw | ( | HDC | hDC,
 |  | HANDLETABLE FAR * | phTable,
 |  | METARECORD FAR * | pMFR,
 |  | int | cObj,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 159 of file drawIcon.c.

   {
   LPDRAWINFO lpdi = (LPDRAWINFO)lParam;

   /*
    * We play everything blindly except for DIBBITBLT (or DIBSTRETCHBLT)
    * and ESCAPE with MFCOMMENT.  For the BitBlts we change the x,y to
    * draw at (0,0) instead of wherever it was written to draw.  The
    * comment tells us there to stop if we don't want to draw the label.
    */

   //If we're playing icon only, stop enumeration at the comment.
   if (lpdi->fIconOnly)
      {
      if (META_ESCAPE==pMFR->rdFunction && MFCOMMENT==pMFR->rdParm[0])
         {
         if (0==lstrcmpi(szIconOnly, (LPSTR)&pMFR->rdParm[2]))
            return 0;
         }

      /*
       * Check for the records in which we want to munge the coordinates.
       * destX is offset 6 for BitBlt, offset 9 for StretchBlt, either of
       * which may appear in the metafile.
       */
      if (META_DIBBITBLT==pMFR->rdFunction)
         pMFR->rdParm[6]=0;

      if (META_DIBSTRETCHBLT==pMFR->rdFunction)
           pMFR->rdParm[9] = 0;

      }

   PlayMetaFileRecord(hDC, phTable, pMFR, cObj);
   return 1;
   }

STDAPI_ ( BOOL )

Definition at line 594 of file drawIcon.c.

   {
   LPMETAFILEPICT  pMF;
   LABELEXTRACT    le;
   HDC             hDC;

   /*
    * We will walk the metafile looking for the two comment records
    * following the IconOnly comment.  The flags fFoundIconOnly and
    * fFoundSource indicate if we have found IconOnly and if we have
    * found the source comment already.
    */

   if (NULL==hMetaPict || NULL==lpszSource || NULL==piIcon)
      return FALSE;

   pMF=GlobalLock(hMetaPict);

   if (NULL==pMF)
      return FALSE;

   le.lpsz=lpszSource;
   le.fFoundIconOnly=FALSE;
   le.fFoundSource=FALSE;
   le.fFoundIndex=FALSE;

   //Use a screen DC so we have something valid to pass in.
   hDC=GetDC(NULL);

   EnumMetaFile(hDC, pMF->hMF, (MFENUMPROC)EnumMetafileExtractIconSource, (LONG)(LPLABELEXTRACT)&le);

   ReleaseDC(NULL, hDC);
   GlobalUnlock(hMetaPict);

   //Copy the icon index to the caller's variable.
   *piIcon=le.u.iIcon;

   //Check that we found everything.
   return (le.fFoundIconOnly && le.fFoundSource && le.fFoundIndex);
   }

STDAPI_ ( UINT )

Definition at line 218 of file drawIcon.c.

   {
   LPMETAFILEPICT  pMF;
   LABELEXTRACT    le;
   HDC             hDC;

   /*
    * We extract the label by getting a screen DC and walking the metafile
    * records until we see the ExtTextOut record we put there.  That
    * record will have the string embedded in it which we then copy out.
    */

   if (NULL==hMetaPict || NULL==lpszLabel || 0==cchLabel)
      return FALSE;

   pMF=GlobalLock(hMetaPict);

   if (NULL==pMF)
      return FALSE;

   le.lpsz=lpszLabel;
   le.u.cch=cchLabel;
   le.Index=0;
   le.fFoundIconOnly=FALSE;
   le.fFoundSource=FALSE;  //Unused for this function.
   le.fFoundIndex=FALSE;   //Unused for this function.
   le.PrevIndex = 0;

   //Use a screen DC so we have something valid to pass in.
   hDC=GetDC(NULL);

   // Since we've used the EXPORT keyword on the
   // EnumMetafileExtractLabel proc, we do not need to use
   // MakeProcInstance

   EnumMetaFile(hDC, pMF->hMF, (MFENUMPROC)EnumMetafileExtractLabel, (LONG)(LPLABELEXTRACT)&le);

   ReleaseDC(NULL, hDC);

   GlobalUnlock(hMetaPict);

   //Tell where we wrapped (if calling function cares)
   if (NULL != lpWrapIndex)
      *lpWrapIndex = le.PrevIndex;

   //Return amount of text copied
   return le.u.cch;
   }

STDAPI_ ( void )

Definition at line 45 of file drawIcon.c.

   {
   LPMETAFILEPICT      pMF;

   if (NULL==hMetaPict)
      return;

   pMF=(LPMETAFILEPICT)GlobalLock(hMetaPict);

   if (NULL!=pMF)
      {
      if (NULL!=pMF->hMF)
         DeleteMetaFile(pMF->hMF);
      }

   GlobalUnlock(hMetaPict);
   GlobalFree(hMetaPict);
   return;
   }

STDAPI_ ( HICON )

Definition at line 361 of file drawIcon.c.

   {
   LPMETAFILEPICT  pMF;
   HDC             hDC;
   ICONEXTRACT     ie;

   /*
    * We extract the label by getting a screen DC and walking the metafile
    * records until we see the ExtTextOut record we put there.  That
    * record will have the string embedded in it which we then copy out.
    */

   if (NULL==hMetaPict)
      return NULL;

   pMF=GlobalLock(hMetaPict);

   if (NULL==pMF)
      return FALSE;

   //Use a screen DC so we have something valid to pass in.
   hDC=GetDC(NULL);
   ie.fAND=TRUE;

   // We get information back in the ICONEXTRACT structure.
   // (Since we've used the EXPORT keyword on the
   // EnumMetafileExtractLabel proc, we do not need to use
   // MakeProcInstance)
   EnumMetaFile(hDC, pMF->hMF, (MFENUMPROC)EnumMetafileExtractIcon, (LONG)(LPICONEXTRACT)&ie);

   ReleaseDC(NULL, hDC);
   GlobalUnlock(hMetaPict);

   return ie.hIcon;
   }

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/OleStd/enumfetc.c File Reference

  • Com
  • Fundamentals
  • OleStd
Classes | Defines | Typedefs | Functions

enumfetc.c File Reference

#include "olestd.h"

Go to the source code of this file.

Classes

struct | tagOleStdEnumFmtEtc

Defines

#define | STRICT 1

Typedefs

typedef struct
tagOleStdEnumFmtEtc * 		LPOLESTDENUMFMTETC
typedef struct tagOleStdEnumFmtEtc | OLESTDENUMFMTETC

Functions

OleStdEnumFmtEtc_AddRef (LPENUMFORMATETC lpThis)
STDMETHODIMP | OleStdEnumFmtEtc_Clone (LPENUMFORMATETC lpThis, LPENUMFORMATETC FAR *ppenum)
OleStdEnumFmtEtc_Create (ULONG nCount, LPFORMATETC lpEtc)
VOID | OleStdEnumFmtEtc_Destroy (LPOLESTDENUMFMTETC pEtc)
STDMETHODIMP | OleStdEnumFmtEtc_Next (LPENUMFORMATETC lpThis, ULONG celt, LPFORMATETC rgelt, ULONG FAR *pceltFetched)
STDMETHODIMP | OleStdEnumFmtEtc_QueryInterface (LPENUMFORMATETC lpThis, REFIID riid, LPVOID FAR *ppobj)
OleStdEnumFmtEtc_Release (LPENUMFORMATETC lpThis)
STDMETHODIMP | OleStdEnumFmtEtc_Reset (LPENUMFORMATETC lpThis)
STDMETHODIMP | OleStdEnumFmtEtc_Skip (LPENUMFORMATETC lpThis, ULONG celt)
STDMETHODIMP_ (STDMETHODIMP_() OleStdEnumFmtEtc_Release(LPENUMFORMATETC lpThis) ULONG)

Define Documentation

#define STRICT 1

Definition at line 15 of file enumfetc.c.

Typedef Documentation

typedef struct tagOleStdEnumFmtEtc* LPOLESTDENUMFMTETC
typedef struct tagOleStdEnumFmtEtc OLESTDENUMFMTETC

Function Documentation

OleStdEnumFmtEtc_AddRef ( LPENUMFORMATETC lpThis )

Definition at line 171 of file enumfetc.c.

{
  LPOLESTDENUMFMTETC lpEF = (LPOLESTDENUMFMTETC)lpThis;
  return lpEF->m_dwRefs++;

} /* OleStdEnumFmtEtc_AddRef()

STDMETHODIMP OleStdEnumFmtEtc_Clone | ( | LPENUMFORMATETC | lpThis,
 |  | LPENUMFORMATETC FAR * | ppenum
 | ) |  |

Definition at line 289 of file enumfetc.c.

{
  LPOLESTDENUMFMTETC lpEF = (LPOLESTDENUMFMTETC)lpThis;

  if (ppenum == NULL) {
        return E_INVALIDARG;
  }

  *ppenum = OleStdEnumFmtEtc_Create(lpEF->m_nCount, lpEF->m_lpEtc);

  // make sure cloned enumerator has same index state as the original
  if (*ppenum) {
          LPOLESTDENUMFMTETC lpEFClone = (LPOLESTDENUMFMTETC)*ppenum;
          lpEFClone->m_nIndex = lpEF->m_nIndex;
          return NOERROR;
  } else
          return E_OUTOFMEMORY;

} /* OleStdEnumFmtEtc_Clone()

OleStdEnumFmtEtc_Create | ( | ULONG | nCount,
 |  | LPFORMATETC | lpEtc
 | ) |  |

Definition at line 54 of file enumfetc.c.

{
  LPMALLOC lpMalloc=NULL;
  LPOLESTDENUMFMTETC lpEF=NULL;
  DWORD dwSize;
  WORD i;
  HRESULT hRes;

  hRes = CoGetMalloc(MEMCTX_TASK, &lpMalloc);
  if (hRes != NOERROR) {
        return NULL;
  }

  lpEF = (LPOLESTDENUMFMTETC)lpMalloc->lpVtbl->Alloc(lpMalloc,
                                                                                sizeof(OLESTDENUMFMTETC));
  if (lpEF == NULL) {
        goto errReturn;
  }

  lpEF->lpVtbl = &g_EnumFORMATETCVtbl;
  lpEF->m_dwRefs = 1;
  lpEF->m_nCount = nCount;
  lpEF->m_nIndex = 0;

  dwSize = sizeof(FORMATETC) * lpEF->m_nCount;

  lpEF->m_lpEtc = (LPFORMATETC)lpMalloc->lpVtbl->Alloc(lpMalloc, dwSize);
  if (lpEF->m_lpEtc == NULL)
        goto errReturn;

  lpMalloc->lpVtbl->Release(lpMalloc);

  for (i=0; i<nCount; i++) {
        OleStdCopyFormatEtc(
                        (LPFORMATETC)&(lpEF->m_lpEtc[i]), (LPFORMATETC)&(lpEtc[i]));
  }

  g_dwObjectCount++ ;

  return (LPENUMFORMATETC)lpEF;

errReturn:
  if (lpEF != NULL)
        lpMalloc->lpVtbl->Free(lpMalloc, lpEF);

  if (lpMalloc != NULL)
        lpMalloc->lpVtbl->Release(lpMalloc);

  return NULL;

} /* OleStdEnumFmtEtc_Create()

VOID OleStdEnumFmtEtc_Destroy ( LPOLESTDENUMFMTETC pEtc )

Definition at line 112 of file enumfetc.c.

{
        LPMALLOC lpMalloc=NULL;
        WORD i;

        if (lpEF != NULL) {

                if (CoGetMalloc(MEMCTX_TASK, &lpMalloc) == NOERROR) {

                        /* NOTE: we MUST free any memory that was allocated for
                        **    TARGETDEVICES contained within the FORMATETC elements.
                        */
                        for (i=0; i<lpEF->m_nCount; i++) {
                                OleStdFree(lpEF->m_lpEtc[i].ptd);
                        }

                        if (lpEF->m_lpEtc != NULL) {
                                lpMalloc->lpVtbl->Free(lpMalloc, lpEF->m_lpEtc);
                        }

                        lpMalloc->lpVtbl->Free(lpMalloc, lpEF);
                        lpMalloc->lpVtbl->Release(lpMalloc);
                }
        }

        g_dwObjectCount-- ;

} /* OleStdEnumFmtEtc_Destroy()

STDMETHODIMP OleStdEnumFmtEtc_Next | ( | LPENUMFORMATETC | lpThis,
 |  | ULONG | celt,
 |  | LPFORMATETC | rgelt,
 |  | ULONG FAR * | pceltFetched
 | ) |  |

Definition at line 202 of file enumfetc.c.

{
  LPOLESTDENUMFMTETC lpEF = (LPOLESTDENUMFMTETC)lpThis;
  ULONG i=0;
  ULONG nOffset;

  if (rgelt == NULL) {
        return E_INVALIDARG;
  }

  while (i < celt) {
        nOffset = lpEF->m_nIndex + i;

        if (nOffset < lpEF->m_nCount) {
          OleStdCopyFormatEtc(
                        (LPFORMATETC)&(rgelt[i]), (LPFORMATETC)&(lpEF->m_lpEtc[nOffset]));
          i++;
        }else{
          break;
        }
  }

  lpEF->m_nIndex += (WORD)i;

  if (pceltFetched != NULL) {
        *pceltFetched = i;
  }

  if (i != celt) {
        return S_FALSE;
  }

  return NOERROR;
} /* OleStdEnumFmtEtc_Next()

STDMETHODIMP OleStdEnumFmtEtc_QueryInterface | ( | LPENUMFORMATETC | lpThis,
 |  | REFIID | riid,
 |  | LPVOID FAR * | ppobj
 | ) |  |

Definition at line 147 of file enumfetc.c.

{
  LPOLESTDENUMFMTETC lpEF = (LPOLESTDENUMFMTETC)lpThis;
  *ppobj = NULL;

  if (IsEqualIID(riid,&IID_IUnknown) || IsEqualIID(riid,&IID_IEnumFORMATETC)){
        *ppobj = (LPVOID)lpEF;
  }

  if (*ppobj == NULL) return E_NOINTERFACE;
  else{
        OleStdEnumFmtEtc_AddRef(lpThis);
        return NOERROR;
  }

} /* OleStdEnumFmtEtc_QueryInterface()

OleStdEnumFmtEtc_Release ( LPENUMFORMATETC lpThis )

Definition at line 184 of file enumfetc.c.

{
  LPOLESTDENUMFMTETC lpEF = (LPOLESTDENUMFMTETC)lpThis;
  DWORD dwRefs = --lpEF->m_dwRefs;

  if (dwRefs == 0)
        OleStdEnumFmtEtc_Destroy(lpEF);

  return dwRefs;

} /* OleStdEnumFmtEtc_Release()

STDMETHODIMP OleStdEnumFmtEtc_Reset ( LPENUMFORMATETC lpThis )

Definition at line 275 of file enumfetc.c.

{
  LPOLESTDENUMFMTETC lpEF = (LPOLESTDENUMFMTETC)lpThis;
  lpEF->m_nIndex = 0;

  return NOERROR;
} /* OleStdEnumFmtEtc_Reset()

STDMETHODIMP OleStdEnumFmtEtc_Skip | ( | LPENUMFORMATETC | lpThis,
 |  | ULONG | celt
 | ) |  |

Definition at line 244 of file enumfetc.c.

{
  LPOLESTDENUMFMTETC lpEF = (LPOLESTDENUMFMTETC)lpThis;
  ULONG i=0;
  ULONG nOffset;

  while (i < celt) {
        nOffset = lpEF->m_nIndex + i;

        if (nOffset < lpEF->m_nCount) {
          i++;
        }else{
          break;
        }
  }

  lpEF->m_nIndex += (WORD)i;

  if (i != celt) {
        return S_FALSE;
  }

  return NOERROR;
} /* OleStdEnumFmtEtc_Skip()

STDMETHODIMP_ ( STDMETHODIMP_() OleStdEnumFmtEtc_Release(LPENUMFORMATETC lpThis) ULONG )

Definition at line 31 of file enumfetc.c.

                                                {
                OleStdEnumFmtEtc_QueryInterface,
                OleStdEnumFmtEtc_AddRef,
                OleStdEnumFmtEtc_Release,
                OleStdEnumFmtEtc_Next,
                OleStdEnumFmtEtc_Skip,
                OleStdEnumFmtEtc_Reset,
                OleStdEnumFmtEtc_Clone,
};

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/OleStd/enumStat.c File Reference

  • Com
  • Fundamentals
  • OleStd
Classes | Defines | Typedefs | Functions

enumStat.c File Reference

#include "olestd.h"

Go to the source code of this file.

Classes

struct | tagOleStdEnumStatData

Defines

#define | STRICT 1

Typedefs

typedef struct
tagOleStdEnumStatData * 		LPOLESTDENUMSTATDATA
typedef struct
tagOleStdEnumStatData 		OLESTDENUMSTATDATA

Functions

OleStdCopyStatData (LPSTATDATA pDest, LPSTATDATA pSrc)
OleStdEnumStatData_AddRef (LPENUMSTATDATA lpThis)
STDMETHODIMP | OleStdEnumStatData_Clone (LPENUMSTATDATA lpThis, LPENUMSTATDATA FAR *ppenum)
OleStdEnumStatData_Create (ULONG nCount, LPSTATDATA lpStatOrg)
VOID | OleStdEnumStatData_Destroy (LPOLESTDENUMSTATDATA pStat)
STDMETHODIMP | OleStdEnumStatData_Next (LPENUMSTATDATA lpThis, ULONG celt, LPSTATDATA rgelt, ULONG FAR *pceltFetched)
STDMETHODIMP | OleStdEnumStatData_QueryInterface (LPENUMSTATDATA lpThis, REFIID riid, LPVOID FAR *ppobj)
OleStdEnumStatData_Release (LPENUMSTATDATA lpThis)
STDMETHODIMP | OleStdEnumStatData_Reset (LPENUMSTATDATA lpThis)
STDMETHODIMP | OleStdEnumStatData_Skip (LPENUMSTATDATA lpThis, ULONG celt)
STDMETHODIMP_ (STDMETHODIMP_() OleStdEnumStatData_Release(LPENUMSTATDATA lpThis) ULONG)

Define Documentation

#define STRICT 1

Definition at line 15 of file enumStat.c.

Typedef Documentation

typedef struct tagOleStdEnumStatData* LPOLESTDENUMSTATDATA
typedef struct tagOleStdEnumStatData OLESTDENUMSTATDATA

Function Documentation

OleStdCopyStatData | ( | LPSTATDATA | pDest,
 |  | LPSTATDATA | pSrc
 | ) |  |

Definition at line 53 of file enumStat.c.

{
  if ((pDest == NULL) || (pSrc == NULL)) {
   return FALSE;
  }

  if (OleStdCopyFormatEtc(&pDest->formatetc, &pSrc->formatetc) == FALSE) {
   return FALSE;
  }

  pDest->advf = pSrc->advf;
  pDest->pAdvSink = pSrc->pAdvSink;
  pDest->dwConnection = pSrc->dwConnection;

  if (pDest->pAdvSink != NULL) {
   pDest->pAdvSink->lpVtbl->AddRef(pDest->pAdvSink);
  }

  return TRUE;

} /* OleStdCopyStatData()

OleStdEnumStatData_AddRef ( LPENUMSTATDATA lpThis )

Definition at line 200 of file enumStat.c.

{
  LPOLESTDENUMSTATDATA lpSD = (LPOLESTDENUMSTATDATA)lpThis;
  return lpSD->m_dwRefs++;

} /* OleStdEnumStatData_AddRef()

STDMETHODIMP OleStdEnumStatData_Clone | ( | LPENUMSTATDATA | lpThis,
 |  | LPENUMSTATDATA FAR * | ppenum
 | ) |  |

Definition at line 318 of file enumStat.c.

{
  LPOLESTDENUMSTATDATA lpSD = (LPOLESTDENUMSTATDATA)lpThis;

  if (ppenum == NULL) {
   return E_INVALIDARG;
  }

  *ppenum = OleStdEnumStatData_Create(lpSD->m_nCount, lpSD->m_lpStat);

  // make sure cloned enumerator has same index state as the original
  if (*ppenum) {
     LPOLESTDENUMSTATDATA lpSDClone = (LPOLESTDENUMSTATDATA)*ppenum;
     lpSDClone->m_nIndex = lpSD->m_nIndex;
     return NOERROR;
  } else
     return E_OUTOFMEMORY;

} /* OleStdEnumStatData_Clone()

OleStdEnumStatData_Create | ( | ULONG | nCount,
 |  | LPSTATDATA | lpStatOrg
 | ) |  |

Definition at line 80 of file enumStat.c.

{
  LPMALLOC lpMalloc=NULL;
  LPOLESTDENUMSTATDATA lpSD=NULL;
  DWORD dwSize;
  WORD i;
  HRESULT hRes;

  hRes = CoGetMalloc(MEMCTX_TASK, &lpMalloc);
  if (hRes != NOERROR) {
   return NULL;
  }

  lpSD = (LPOLESTDENUMSTATDATA)lpMalloc->lpVtbl->Alloc(lpMalloc,
                                     sizeof(OLESTDENUMSTATDATA));
  if (lpSD == NULL) {
   goto errReturn;
  }

  lpSD->lpVtbl = &g_EnumSTATDATAVtbl;
  lpSD->m_dwRefs = 1;
  lpSD->m_nCount = nCount;
  lpSD->m_nIndex = 0;

  dwSize = sizeof(STATDATA) * lpSD->m_nCount;

  lpSD->m_lpStat = (LPSTATDATA)lpMalloc->lpVtbl->Alloc(lpMalloc, dwSize);
  if (lpSD->m_lpStat == NULL)
   goto errReturn;

  lpMalloc->lpVtbl->Release(lpMalloc);

  for (i=0; i<nCount; i++) {
   OleStdCopyStatData(
         (LPSTATDATA)&(lpSD->m_lpStat[i]), (LPSTATDATA)&(lpStatOrg[i]));
  }

  g_dwObjectCount++ ;

  return (LPENUMSTATDATA)lpSD;

errReturn:
  if (lpSD != NULL)
   lpMalloc->lpVtbl->Free(lpMalloc, lpSD);

  if (lpMalloc != NULL)
   lpMalloc->lpVtbl->Release(lpMalloc);

  return NULL;

} /* OleStdEnumStatData_Create()

VOID OleStdEnumStatData_Destroy ( LPOLESTDENUMSTATDATA pStat )

Definition at line 138 of file enumStat.c.

{
   LPMALLOC lpMalloc=NULL;
   WORD i;

   if (lpSD != NULL) {

      if (CoGetMalloc(MEMCTX_TASK, &lpMalloc) == NOERROR) {

         /* NOTE: we MUST free any memory that was allocated for
         **    TARGETDEVICES contained within the STATDATA elements.
         */
         for (i=0; i<lpSD->m_nCount; i++) {
            if( lpSD->m_lpStat[i].pAdvSink )
               lpSD->m_lpStat[i].pAdvSink->lpVtbl->Release(lpSD->m_lpStat[i].pAdvSink);

            OleStdFree(lpSD->m_lpStat[i].formatetc.ptd);
         }

         if (lpSD->m_lpStat != NULL) {
            lpMalloc->lpVtbl->Free(lpMalloc, lpSD->m_lpStat);
         }

         lpMalloc->lpVtbl->Free(lpMalloc, lpSD);
         lpMalloc->lpVtbl->Release(lpMalloc);
      }
   }

   g_dwObjectCount-- ;

} /* OleStdEnumStatData_Destroy()

STDMETHODIMP OleStdEnumStatData_Next | ( | LPENUMSTATDATA | lpThis,
 |  | ULONG | celt,
 |  | LPSTATDATA | rgelt,
 |  | ULONG FAR * | pceltFetched
 | ) |  |

Definition at line 231 of file enumStat.c.

{
  LPOLESTDENUMSTATDATA lpSD = (LPOLESTDENUMSTATDATA)lpThis;
  ULONG i=0;
  ULONG nOffset;

  if (rgelt == NULL) {
   return E_INVALIDARG;
  }

  while (i < celt) {
   nOffset = lpSD->m_nIndex + i;

   if (nOffset < lpSD->m_nCount) {
     OleStdCopyStatData(
         (LPSTATDATA)&(rgelt[i]), (LPSTATDATA)&(lpSD->m_lpStat[nOffset]));
     i++;
   }else{
     break;
   }
  }

  lpSD->m_nIndex += (WORD)i;

  if (pceltFetched != NULL) {
   *pceltFetched = i;
  }

  if (i != celt) {
   return S_FALSE;
  }

  return NOERROR;
} /* OleStdEnumStatData_Next()

STDMETHODIMP OleStdEnumStatData_QueryInterface | ( | LPENUMSTATDATA | lpThis,
 |  | REFIID | riid,
 |  | LPVOID FAR * | ppobj
 | ) |  |

Definition at line 176 of file enumStat.c.

{
  LPOLESTDENUMSTATDATA lpSD = (LPOLESTDENUMSTATDATA)lpThis;
  *ppobj = NULL;

  if (IsEqualIID(riid,&IID_IUnknown) || IsEqualIID(riid,&IID_IEnumSTATDATA)){
   *ppobj = (LPVOID)lpSD;
  }

  if (*ppobj == NULL) return E_NOINTERFACE;
  else{
   OleStdEnumStatData_AddRef(lpThis);
   return NOERROR;
  }

} /* OleStdEnumStatData_QueryInterface()

OleStdEnumStatData_Release ( LPENUMSTATDATA lpThis )

Definition at line 213 of file enumStat.c.

{
  LPOLESTDENUMSTATDATA lpSD = (LPOLESTDENUMSTATDATA)lpThis;
  DWORD dwRefs = --lpSD->m_dwRefs;

  if (dwRefs == 0)
   OleStdEnumStatData_Destroy(lpSD);

  return dwRefs;

} /* OleStdEnumStatData_Release()

STDMETHODIMP OleStdEnumStatData_Reset ( LPENUMSTATDATA lpThis )

Definition at line 304 of file enumStat.c.

{
  LPOLESTDENUMSTATDATA lpSD = (LPOLESTDENUMSTATDATA)lpThis;
  lpSD->m_nIndex = 0;

  return NOERROR;
} /* OleStdEnumStatData_Reset()

STDMETHODIMP OleStdEnumStatData_Skip | ( | LPENUMSTATDATA | lpThis,
 |  | ULONG | celt
 | ) |  |

Definition at line 273 of file enumStat.c.

{
  LPOLESTDENUMSTATDATA lpSD = (LPOLESTDENUMSTATDATA)lpThis;
  ULONG i=0;
  ULONG nOffset;

  while (i < celt) {
   nOffset = lpSD->m_nIndex + i;

   if (nOffset < lpSD->m_nCount) {
     i++;
   }else{
     break;
   }
  }

  lpSD->m_nIndex += (WORD)i;

  if (i != celt) {
   return S_FALSE;
  }

  return NOERROR;
} /* OleStdEnumStatData_Skip()

STDMETHODIMP_ ( STDMETHODIMP_() OleStdEnumStatData_Release(LPENUMSTATDATA lpThis) ULONG )

Definition at line 31 of file enumStat.c.

                                              {
      OleStdEnumStatData_QueryInterface,
      OleStdEnumStatData_AddRef,
      OleStdEnumStatData_Release,
      OleStdEnumStatData_Next,
      OleStdEnumStatData_Skip,
      OleStdEnumStatData_Reset,
      OleStdEnumStatData_Clone,
};

Generated on Wed Nov 13 2024 16:53:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/OleStd/getIcon.c File Reference

  • Com
  • Fundamentals
  • OleStd
Defines | Functions

getIcon.c File Reference

#include "olestd.h"
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <commdlg.h>
#include <memory.h>
#include <cderr.h>
#include "common.h"
#include "utility.h"

Go to the source code of this file.

Defines

#define | IS_FILENAME_DELIM(c) ( (c) == '\\' || (c) == '/' || (c) == ':' )
#define | IS_SEPARATOR(c) ( (c) == ' ' || (c) == '\\' || (c) == '/' || (c) == '\t' || (c) == '!' || (c) == ':' )
#define | STRICT 1

Functions

BOOL FAR PASCAL | FIconFileFromClass (REFCLSID rclsid, LPSTR pszEXE, UINT cch, UINT FAR *lpIndex)
BOOL FAR PASCAL | GetAssociatedExecutable (LPSTR lpszExtension, LPSTR lpszExecutable)
HICON FAR PASCAL | HIconAndSourceFromClass (REFCLSID rclsid, LPSTR pszSource, UINT FAR *puIcon)
LPSTR FAR PASCAL | PointerToNthField (LPSTR lpszString, int nField, char chDelimiter)
STDAPI_ (UINT)

Define Documentation

#define IS_FILENAME_DELIM ( c ) ( (c) == '\\' || (c) == '/' || (c) == ':' )

Definition at line 76 of file getIcon.c.

#define IS_SEPARATOR ( c ) ( (c) == ' ' || (c) == '\\' || (c) == '/' || (c) == '\t' || (c) == '!' || (c) == ':' )

Definition at line 75 of file getIcon.c.

#define STRICT 1

Definition at line 61 of file getIcon.c.

Function Documentation

BOOL FAR PASCAL FIconFileFromClass | ( | REFCLSID | rclsid,
 |  | LPSTR | pszEXE,
 |  | UINT | cch,
 |  | UINT FAR * | lpIndex
 | ) |  |

Definition at line 673 of file getIcon.c.

{

   LONG          dw;
   LONG          lRet;
   HKEY          hKey;
   LPMALLOC      lpIMalloc;
   HRESULT       hrErr;
   LPSTR         lpBuffer;
   LPSTR         lpIndexString;
   UINT          cBufferSize = 136;// room for 128 char path and icon's index
   char          szKey[264];
   char          pszClass[256];
   LPOLESTR      pszUniClass;

   if (NULL==rclsid || NULL==pszEXE || 0==cch || IsEqualCLSID(rclsid,&CLSID_NULL))
      return FALSE;

   //Here, we use CoGetMalloc and alloc a buffer (maxpathlen + 8) to
   //pass to RegQueryValue.  Then, we copy the exe to pszEXE and the
   //index to *lpIndex.

   hrErr = CoGetMalloc(MEMCTX_TASK, &lpIMalloc);

   if (NOERROR != hrErr)
     return FALSE;

   lpBuffer = /*(LPSTR)*/lpIMalloc->lpVtbl->Alloc(lpIMalloc, cBufferSize);

   if (NULL == lpBuffer)
   {
     lpIMalloc->lpVtbl->Release(lpIMalloc);
     return FALSE;
   }

   if (CoIsOle1Class(rclsid))
   {

     LPOLESTR lpszUniProgID;
     char lpszProgID[256];

     // we've got an ole 1.0 class on our hands, so we look at
     // progID\protocol\stdfileedting\server to get the
     // name of the executable.

     ProgIDFromCLSID(rclsid, &lpszUniProgID);
     W2A (lpszUniProgID, lpszProgID, 256);

     //Open up the class key
     lRet=RegOpenKey(HKEY_CLASSES_ROOT, lpszProgID, &hKey);

     if (ERROR_SUCCESS != lRet)
     {
       lpIMalloc->lpVtbl->Free(lpIMalloc, lpszUniProgID);
       lpIMalloc->lpVtbl->Free(lpIMalloc, lpBuffer);
       lpIMalloc->lpVtbl->Release(lpIMalloc);
       return FALSE;
     }

     dw=(LONG)cBufferSize;
     lRet = RegQueryValue(hKey, "Protocol\\StdFileEditing\\Server", lpBuffer, &dw);

     if (ERROR_SUCCESS != lRet)
     {

       RegCloseKey(hKey);
       lpIMalloc->lpVtbl->Free(lpIMalloc, lpszUniProgID);
       lpIMalloc->lpVtbl->Free(lpIMalloc, lpBuffer);
       lpIMalloc->lpVtbl->Release(lpIMalloc);
       return FALSE;
     }

     // Use server and 0 as the icon index
     LSTRCPYN(pszEXE, lpBuffer, cch);

     *lpIndex = 0;

     RegCloseKey(hKey);
     lpIMalloc->lpVtbl->Free(lpIMalloc, lpszUniProgID);
     lpIMalloc->lpVtbl->Free(lpIMalloc, lpBuffer);
     lpIMalloc->lpVtbl->Release(lpIMalloc);
     return TRUE;

   }

   /*
    * We have to go walking in the registration database under the
    * classname, so we first open the classname key and then check
    * under "\\DefaultIcon" to get the file that contains the icon.
    */

   StringFromCLSID(rclsid, &pszUniClass);
   W2A (pszUniClass, pszClass, 256);

   lstrcpy(szKey, "CLSID\\");
   lstrcat(szKey, pszClass);

   //Open up the class key
   lRet=RegOpenKey(HKEY_CLASSES_ROOT, szKey, &hKey);

   if (ERROR_SUCCESS != lRet)
   {
      lpIMalloc->lpVtbl->Free(lpIMalloc, lpBuffer);
      lpIMalloc->lpVtbl->Free(lpIMalloc, pszUniClass);
      lpIMalloc->lpVtbl->Release(lpIMalloc);
      return FALSE;
   }

   //Get the executable path and icon index.

   dw=(LONG)cBufferSize;
   lRet=RegQueryValue(hKey, "DefaultIcon", lpBuffer, &dw);

   if (ERROR_SUCCESS != lRet)
   {
     // no DefaultIcon  key...try LocalServer

     dw=(LONG)cBufferSize;
#ifdef WIN32
     lRet=RegQueryValue(hKey, "LocalServer32", lpBuffer, &dw);
#else
     lRet=RegQueryValue(hKey, "LocalServer", lpBuffer, &dw);
#endif

     if (ERROR_SUCCESS != lRet)
     {
       // no LocalServer entry either...they're outta luck.

       RegCloseKey(hKey);
       lpIMalloc->lpVtbl->Free(lpIMalloc, lpBuffer);
       lpIMalloc->lpVtbl->Free(lpIMalloc, pszUniClass);
       lpIMalloc->lpVtbl->Release(lpIMalloc);
       return FALSE;
     }

     // Use server from LocalServer or Server and 0 as the icon index
     LSTRCPYN(pszEXE, lpBuffer, cch);

     *lpIndex = 0;

     RegCloseKey(hKey);
     lpIMalloc->lpVtbl->Free(lpIMalloc, lpBuffer);
     lpIMalloc->lpVtbl->Free(lpIMalloc, pszUniClass);
     lpIMalloc->lpVtbl->Release(lpIMalloc);
     return TRUE;
   }

   RegCloseKey(hKey);

   // lpBuffer contains a string that looks like "<pathtoexe>,<iconindex>",
   // so we need to separate the path and the icon index.

   lpIndexString = PointerToNthField(lpBuffer, 2, ',');

   if ('\0' == *lpIndexString)  // no icon index specified - use 0 as default.
   {
      *lpIndex = 0;

   }
   else
   {
      LPSTR lpTemp;
      static char  szTemp[16];

      lstrcpy(szTemp, lpIndexString);

      // Put the icon index part into *pIconIndex
      *lpIndex = atoi((const char *)szTemp);

      // Null-terminate the exe part.
      lpTemp = AnsiPrev(lpBuffer, lpIndexString);
      *lpTemp = '\0';
   }

   if (!LSTRCPYN(pszEXE, lpBuffer, cch))
   {
      lpIMalloc->lpVtbl->Free(lpIMalloc, lpBuffer);
      lpIMalloc->lpVtbl->Free(lpIMalloc, pszUniClass);
      lpIMalloc->lpVtbl->Release(lpIMalloc);
      return FALSE;
   }

   // Free the memory we alloc'd and leave.
   lpIMalloc->lpVtbl->Free(lpIMalloc, lpBuffer);
   lpIMalloc->lpVtbl->Free(lpIMalloc, pszUniClass);
   lpIMalloc->lpVtbl->Release(lpIMalloc);
   return TRUE;
}

BOOL FAR PASCAL GetAssociatedExecutable | ( | LPSTR | lpszExtension,
 |  | LPSTR | lpszExecutable
 | ) |  |

Definition at line 501 of file getIcon.c.

{
   HKEY    hKey;
   LONG    dw;
   LRESULT lRet;
   char    szValue[OLEUI_CCHKEYMAX];
   char    szKey[OLEUI_CCHKEYMAX];
   LPSTR   lpszTemp, lpszExe;

   lRet = RegOpenKey(HKEY_CLASSES_ROOT, NULL, &hKey);

   if (ERROR_SUCCESS != lRet)
     return FALSE;

   dw = OLEUI_CCHPATHMAX;
   lRet = RegQueryValue(hKey, lpszExtension, szValue, &dw);  //ProgId

   if (ERROR_SUCCESS != lRet)
   {
     RegCloseKey(hKey);
     return FALSE;
   }

   // szValue now has ProgID
   lstrcpy(szKey, szValue);
   lstrcat(szKey, "\\Shell\\Open\\Command");

   dw = OLEUI_CCHPATHMAX;
   lRet = RegQueryValue(hKey, szKey, szValue, &dw);

   if (ERROR_SUCCESS != lRet)
   {
     RegCloseKey(hKey);
     return FALSE;
   }

   // szValue now has an executable name in it.  Let's null-terminate
   // at the first post-executable space (so we don't have cmd line
   // args.

   lpszTemp = szValue;

   while (('\0' != *lpszTemp) && (isspace(*lpszTemp)))
     lpszTemp++;     // Strip off leading spaces

   lpszExe = lpszTemp;

   while (('\0' != *lpszTemp) && (!isspace(*lpszTemp)))
     lpszTemp++;     // Step through exe name

   *lpszTemp = '\0';  // null terminate at first space (or at end).

   lstrcpy(lpszExecutable, lpszExe);

   return TRUE;

}

HICON FAR PASCAL HIconAndSourceFromClass | ( | REFCLSID | rclsid,
 |  | LPSTR | pszSource,
 |  | UINT FAR * | puIcon
 | ) |  |

Definition at line 587 of file getIcon.c.

   {
   HICON           hIcon;
   UINT            IconIndex;

   if (NULL==rclsid || NULL==pszSource || IsEqualCLSID(rclsid,&CLSID_NULL))
      return NULL;

   if (!FIconFileFromClass(rclsid, pszSource, OLEUI_CCHPATHMAX, &IconIndex))
      return NULL;

   hIcon=ExtractIcon(ghInst, pszSource, IconIndex);

   if ((HICON)32 > hIcon)
      hIcon=NULL;
   else
      *puIcon= IconIndex;

   return hIcon;
   }

LPSTR FAR PASCAL PointerToNthField | ( | LPSTR | lpszString,
 |  | int | nField,
 |  | char | chDelimiter
 | ) |  |

Definition at line 630 of file getIcon.c.

{
   LPSTR lpField = lpszString;
   int   cFieldFound = 1;

   if (1 ==nField)
     return lpszString;

   while (*lpField != '\0')
   {

     if (*lpField++ == chDelimiter)
     {

       cFieldFound++;

       if (nField == cFieldFound)
         return lpField;
     }
   }

   return lpField;

}

STDAPI_ ( UINT )

Definition at line 898 of file getIcon.c.

{

  HDC          hDCScreen;
  static char  szTempBuff[OLEUI_CCHLABELMAX];
  int          cxString, cyString, cxMaxString;
  int          cxFirstLine, cyFirstLine, cxSecondLine;
  int          index;
  int          cch = cchString;
  char         chKeep;
  LPSTR        lpszSecondLine;
  HFONT        hFontT;
  BOOL         fPrintText = TRUE;
  UINT         iLastLineStart = 0;
  SIZE         size;

  // Initialization stuff...

  if (NULL == hDC)  // If we got NULL as the hDC, then we don't actually call ETO
   fPrintText = FALSE;

  // Make a copy of the string (NULL or non-NULL) that we're using
  if (NULL == lpszString)
   *szTempBuff = '\0';

  else
  {
     W2A (lpszString, szTempBuff, OLEUI_CCHLABELMAX);
  }

  // set maximum width
  cxMaxString = lpRect->right - lpRect->left;

  // get screen DC to do text size calculations
  hDCScreen = GetDC(NULL);

  hFontT=SelectObject(hDCScreen, hFont);

  // get the extent of our label
  GetTextExtentPoint(hDCScreen, szTempBuff, cch, &size);

  cxString = size.cx;
  cyString = size.cy;

  // Select in the font we want to use
  if (fPrintText)
    SelectObject(hDC, hFont);

  // String is smaller than max string - just center, ETO, and return.
  if (cxString <= cxMaxString)
  {

   if (fPrintText)
      ExtTextOut(hDC,
              nXStart + (lpRect->right - cxString) / 2,
              nYStart,
              fuOptions,
              lpRect,
              szTempBuff,
              cch,
              NULL);

   iLastLineStart = 0;  // only 1 line of text
   goto CleanupAndLeave;
  }

  // String is too long...we've got to word-wrap it.

  // Are there any spaces, slashes, tabs, or bangs in string?

  if (lstrlen(szTempBuff) != (int)strcspn(szTempBuff, szSeparators))
  {
    // Yep, we've got spaces, so we'll try to find the largest
    // space-terminated string that will fit on the first line.

    index = cch;

    while (index >= 0)
    {

      char cchKeep;

      // scan the string backwards for spaces, slashes, tabs, or bangs

      while (!IS_SEPARATOR(szTempBuff[index]) )
       index--;

      if (index <= 0)
       break;

      cchKeep = szTempBuff[index];  // remember what char was there

      szTempBuff[index] = '\0';  // just for now

      GetTextExtentPoint(
            hDCScreen, szTempBuff,lstrlen(szTempBuff),&size);

      cxFirstLine = size.cx;
      cyFirstLine = size.cy;

      szTempBuff[index] = cchKeep;   // put the right char back

      if (cxFirstLine <= cxMaxString)
      {

         iLastLineStart = index + 1;

         if (!fPrintText)
          goto CleanupAndLeave;

         ExtTextOut(hDC,
                 nXStart +  (lpRect->right - cxFirstLine) / 2,
                 nYStart,
                 fuOptions,
                 lpRect,
                 szTempBuff,
                 index + 1,
                 lpDX);

         lpszSecondLine = szTempBuff;

         lpszSecondLine += index + 1;

         GetTextExtentPoint(hDCScreen,
                           lpszSecondLine,
                           lstrlen(lpszSecondLine),
                           &size);

         // If the second line is wider than the rectangle, we
         // just want to clip the text.
         cxSecondLine = min(size.cx, cxMaxString);

         ExtTextOut(hDC,
                 nXStart + (lpRect->right - cxSecondLine) / 2,
                 nYStart + cyFirstLine,
                 fuOptions,
                 lpRect,
                 lpszSecondLine,
                 lstrlen(lpszSecondLine),
                 lpDX);

         goto CleanupAndLeave;

      }  // end if

      index--;

    }  // end while

  }  // end if

  // Here, there are either no spaces in the string (strchr(szTempBuff, ' ')
  // returned NULL), or there spaces in the string, but they are
  // positioned so that the first space terminated string is still
  // longer than one line. So, we walk backwards from the end of the
  // string until we find the largest string that will fit on the first
  // line , and then we just clip the second line.

  cch = lstrlen(szTempBuff);

  chKeep = szTempBuff[cch];
  szTempBuff[cch] = '\0';

  GetTextExtentPoint(hDCScreen, szTempBuff, lstrlen(szTempBuff),&size);

  cxFirstLine = size.cx;
  cyFirstLine = size.cy;

  while (cxFirstLine > cxMaxString)
  {
    // We allow 40 characters in the label, but the metafile is
    // only as wide as 10 W's (for aesthetics - 20 W's wide looked
    // dumb.  This means that if we split a long string in half (in
    // terms of characters), then we could still be wider than the
    // metafile.  So, if this is the case, we just step backwards
    // from the halfway point until we get something that will fit.
    // Since we just let ETO clip the second line

    szTempBuff[cch--] = chKeep;
    if (0 == cch)
      goto CleanupAndLeave;

    chKeep = szTempBuff[cch];
    szTempBuff[cch] = '\0';

    GetTextExtentPoint(
          hDCScreen, szTempBuff, lstrlen(szTempBuff), &size);
    cxFirstLine = size.cx;
  }

  iLastLineStart = cch;

  if (!fPrintText)
   goto CleanupAndLeave;

  ExtTextOut(hDC,
          nXStart + (lpRect->right - cxFirstLine) / 2,
          nYStart,
          fuOptions,
          lpRect,
          szTempBuff,
          lstrlen(szTempBuff),
          lpDX);

  szTempBuff[cch] = chKeep;
  lpszSecondLine = szTempBuff;
  lpszSecondLine += cch;

  GetTextExtentPoint(
        hDCScreen, lpszSecondLine, lstrlen(lpszSecondLine), &size);

  // If the second line is wider than the rectangle, we
  // just want to clip the text.
  cxSecondLine = min(size.cx, cxMaxString);

  ExtTextOut(hDC,
          nXStart + (lpRect->right - cxSecondLine) / 2,
          nYStart + cyFirstLine,
          fuOptions,
          lpRect,
          lpszSecondLine,
          lstrlen(lpszSecondLine),
          lpDX);

CleanupAndLeave:
  SelectObject(hDCScreen, hFontT);
  ReleaseDC(NULL, hDCScreen);
  return iLastLineStart;

}

Generated on Wed Nov 13 2024 16:53:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/OleStd/hatch.c File Reference

  • Com
  • Fundamentals
  • OleStd
Defines | Functions

hatch.c File Reference

#include "olestd.h"

Go to the source code of this file.

Defines

#define | CLASS_HATCH "Hatch Window"
#define | EB_HATCHRECT_BOTTOM 8
#define | EB_HATCHRECT_LEFT 2
#define | EB_HATCHRECT_RIGHT 6
#define | EB_HATCHRECT_TOP 4
#define | EB_HATCHWIDTH 0
#define | STRICT 1

Functions

LRESULT FAR PASCAL EXPORT | HatchWndProc (HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam)
STDAPI_ (void)
STDAPI_ (UINT)
STDAPI_ (HWND)
STDAPI_ (BOOL)

Define Documentation

#define CLASS_HATCH "Hatch Window"

Definition at line 21 of file hatch.c.

#define EB_HATCHRECT_BOTTOM 8

Definition at line 18 of file hatch.c.

#define EB_HATCHRECT_LEFT 2

Definition at line 15 of file hatch.c.

#define EB_HATCHRECT_RIGHT 6

Definition at line 17 of file hatch.c.

#define EB_HATCHRECT_TOP 4

Definition at line 16 of file hatch.c.

#define EB_HATCHWIDTH 0

Definition at line 14 of file hatch.c.

#define STRICT 1

Definition at line 10 of file hatch.c.

Function Documentation

LRESULT FAR PASCAL EXPORT HatchWndProc | ( | HWND | hWnd,
 |  | UINT | Message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 277 of file hatch.c.

{
   int nBorderWidth;

   switch (Message) {

      case WM_CREATE:
         nBorderWidth = GetProfileInt(
            "windows",
            "oleinplaceborderwidth",
            DEFAULT_HATCHBORDER_WIDTH
         );
         SetWindowWord(hWnd, EB_HATCHWIDTH, (WORD)nBorderWidth);
         break;

      case WM_PAINT:
      {
         HDC hDC;
         PAINTSTRUCT ps;
         RECT rcHatchRect;

         nBorderWidth = GetHatchWidth(hWnd);
         hDC = BeginPaint(hWnd, &ps);
         GetHatchRect(hWnd, (LPRECT)&rcHatchRect);
         OleUIDrawShading(&rcHatchRect, hDC, OLEUI_SHADE_BORDERIN,
               nBorderWidth);
         InflateRect((LPRECT)&rcHatchRect, -nBorderWidth, -nBorderWidth);
         OleUIDrawHandles(&rcHatchRect, hDC, OLEUI_HANDLES_OUTSIDE,
               nBorderWidth+1, TRUE);
         EndPaint(hWnd, &ps);
         break;
      }

      /* NOTE: Any window that is used during in-place activation
      **    must handle the WM_SETCURSOR message or else the cursor
      **    of the in-place parent will be used. if WM_SETCURSOR is
      **    not handled, then DefWindowProc sends the message to the
      **    window's parent.
      */
      case WM_SETCURSOR:
         SetCursor(LoadCursor( NULL, MAKEINTRESOURCE(IDC_ARROW) ) );
         return (LRESULT)TRUE;

      default:
         return DefWindowProc(hWnd, Message, wParam, lParam);
   }

   return 0L;
}

STDAPI_ ( void )

Definition at line 216 of file hatch.c.

{
   RECT        rcHatchRect;
   RECT        rcVisRect;
   UINT        uHatchWidth;
   POINT       ptOffset;

   if (!IsWindow(hWndHatch))
      return;

   rcHatchRect = *lprcIPObjRect;
   uHatchWidth = GetHatchWidth(hWndHatch);
   InflateRect((LPRECT)&rcHatchRect, uHatchWidth + 1, uHatchWidth + 1);

   IntersectRect((LPRECT)&rcVisRect, (LPRECT)&rcHatchRect, lprcClipRect);
   MoveWindow(
         hWndHatch,
         rcVisRect.left,
         rcVisRect.top,
         rcVisRect.right-rcVisRect.left,
         rcVisRect.bottom-rcVisRect.top,
         TRUE    /* fRepaint */
   );
   InvalidateRect(hWndHatch, NULL, TRUE);

   ptOffset.x = -rcHatchRect.left + (rcHatchRect.left - rcVisRect.left);
   ptOffset.y = -rcHatchRect.top + (rcHatchRect.top - rcVisRect.top);

   /* convert the rcHatchRect into the client coordinate system of the
   **    HatchWindow itself
   */
   OffsetRect((LPRECT)&rcHatchRect, ptOffset.x, ptOffset.y);

   SetHatchRect(hWndHatch, (LPRECT)&rcHatchRect);

   // calculate offset required to position in-place server doc window
   lpptOffset->x = ptOffset.x;
   lpptOffset->y = ptOffset.y;
}

STDAPI_ ( UINT )

Definition at line 117 of file hatch.c.

{
   if (!IsWindow(hWndHatch))
      return 0;

   return (UINT)GetWindowWord(hWndHatch, EB_HATCHWIDTH);
}

STDAPI_ ( HWND )

Definition at line 81 of file hatch.c.

{
   HWND         hWnd;

   if (!hWndParent || !hInst)
      return NULL;

   hWnd = CreateWindow(
      CLASS_HATCH,
      "Hatch Window",
      WS_CHILDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
      0, 0, 0, 0,
      hWndParent,
      (HMENU)NULL,
      hInst,
      0L
   );

   if (!hWnd)
      return NULL;

   return hWnd;
}

STDAPI_ ( BOOL )

Definition at line 41 of file hatch.c.

{
   WNDCLASS wc;

   // Register Hatch Window Class
   wc.style = CS_BYTEALIGNWINDOW;
   wc.lpfnWndProc = HatchWndProc;
   wc.cbClsExtra = 0;
   wc.cbWndExtra = 5 * sizeof(int);    // extra bytes stores
                              //     uHatchWidth
                              //     rcHatchRect
   wc.hInstance = hInst;
   wc.hIcon = NULL;
   wc.hCursor = LoadCursor(NULL, IDC_ARROW);
   wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
   wc.lpszMenuName = NULL;
   wc.lpszClassName = CLASS_HATCH;

   if (!RegisterClass(&wc))
      return FALSE;
   else
      return TRUE;
}

Generated on Wed Nov 13 2024 16:53:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/OleStd/malspy.c File Reference

  • Com
  • Fundamentals
  • OleStd
Classes | Defines | Typedefs | Functions

malspy.c File Reference

#include <ole2.h>
#include <olestd.h>
#include "malspy.h"

Go to the source code of this file.

Classes

class | CMallocSpy
struct | tagHeader

Defines

#define | DWORDALIGN(x) ((x + 3) & (~3))
#define | TOKEN 0xDEAD

Typedefs

typedef struct CMallocSpy | CMALLOCSPY
typedef struct tagHeader | HEADER
typedef struct CMallocSpy * | LPCMALLOCSPY
typedef struct tagHeader * | LPHEADER

Functions

ULONG | CbActualFromCbUser (ULONG cbUser)
ULONG | CbUserFromCbActual (ULONG cbActual)
STDMETHODIMP | MallocSpy_QueryInterface (LPMALLOCSPY this, REFIID riid, LPVOID *ppUnk)
STDMETHODIMP | MallocSpy_QueryInterface (LPMALLOCSPY this, REFIID riid, LPVOID FAR *lplpUnk)
void * | PActualFromPUser (void *pUser)
void * | PUserFromPActual (void *pActual, ULONG cbDataSize)
STDMETHODIMP_ (ULONG)
STDMETHODIMP_ (void *)
STDMETHODIMP_ (void)
STDMETHODIMP_ (STDMETHODIMP_() MallocSpy_Release(LPMALLOCSPY this) ULONG)
STDMETHODIMP_ (BOOL)
void | UninitializeMallocSpy ()

Define Documentation

#define DWORDALIGN ( x ) ((x + 3) & (~3))

Definition at line 35 of file malspy.c.

#define TOKEN 0xDEAD

Definition at line 24 of file malspy.c.

Typedef Documentation

typedef struct CMallocSpy CMALLOCSPY
typedef struct tagHeader HEADER
typedef struct CMallocSpy * LPCMALLOCSPY
typedef struct tagHeader * LPHEADER

Function Documentation

ULONG CbActualFromCbUser ( ULONG cbUser )

Definition at line 193 of file malspy.c.

{
    return(DWORDALIGN(cbUser) + sizeof(HEADER) + sizeof(UINT));
}

ULONG CbUserFromCbActual ( ULONG cbActual )

Definition at line 176 of file malspy.c.

{
    return(cbActual - (sizeof(HEADER) + sizeof(UINT)));
}

STDMETHODIMP MallocSpy_QueryInterface | ( | LPMALLOCSPY | this,
 |  | REFIID | riid,
 |  | LPVOID * | ppUnk
 | ) |  |

Definition at line 262 of file malspy.c.

{
    HRESULT hr = S_OK;

    if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IMallocSpy))
    {
        *ppUnk = this;
    }
    else
    {
        *ppUnk = NULL;
        hr =  E_NOINTERFACE;
    }
    this->lpVtbl->AddRef((LPMALLOCSPY)this);
    return hr;
}

STDMETHODIMP MallocSpy_QueryInterface | ( | LPMALLOCSPY | this,
 |  | REFIID | riid,
 |  | LPVOID FAR * | lplpUnk
 | ) |  |
void* PActualFromPUser ( void * pUser )

Definition at line 211 of file malspy.c.

{
    HEADER * pHeader;
    UINT * puiFooter;
    pHeader = ((LPHEADER)pUser) - 1;
    puiFooter = (UINT *)(((BYTE *)pUser) + DWORDALIGN(pHeader->cbSize));

    OleDbgAssertSz(TOKEN == pHeader->uiTag, "Illegal memory block.");
    OleDbgAssertSz(TOKEN == *puiFooter, "Memory block was overrun.");

    if (TOKEN != pHeader->uiTag)
    {
        // Just to be safe, if we don't find the TOKEN we'll not adjust the
        // pointer
        return(pUser);
    }
    return ((void *) (pHeader));
}

void* PUserFromPActual | ( | void * | pActual,
 |  | ULONG | cbDataSize
 | ) |  |

Definition at line 245 of file malspy.c.

{
    // Mark the block with a TOKEN at the front and the end
    // and its size so we can tell if it is bogus
    LPHEADER pHeader = pActual;
    UINT* puiFooter;

    pHeader->uiTag = TOKEN;
    pHeader->cbSize = cbDataSize;

    pActual = (void *)(pHeader + 1);

    puiFooter = (UINT *)(((BYTE *) pActual) + DWORDALIGN(pHeader->cbSize));
    *puiFooter = TOKEN;
    return(pActual);
}

STDMETHODIMP_ ( ULONG )

Definition at line 521 of file malspy.c.

{
    if (fSpyed)
    {
        return CbUserFromCbActual(cbActual);
    }
    else
    {
        return cbActual;
    }
}

STDMETHODIMP_ ( void * )

Definition at line 548 of file malspy.c.

{
    if (fSpyed)
    {
        return(PActualFromPUser(pRequest));
    }
    else
    {
        return pRequest;
    }
}

STDMETHODIMP_ ( void )

Definition at line 613 of file malspy.c.

{
    return;
}

STDMETHODIMP_ ( STDMETHODIMP_() MallocSpy_Release( LPMALLOCSPY this) ULONG )

Definition at line 48 of file malspy.c.

{
    BOOL fStatus;
    LPCMALLOCSPY lpcMallocSpy = NULL;
    HRESULT hr;

    OleStdInitVtbl(
          &g_MallocSpyVtbl,
          sizeof(g_MallocSpyVtbl));

    g_MallocSpyVtbl.QueryInterface      = MallocSpy_QueryInterface;
    g_MallocSpyVtbl.AddRef              = MallocSpy_AddRef;
    g_MallocSpyVtbl.Release             = MallocSpy_Release;
    g_MallocSpyVtbl.PreAlloc            = MallocSpy_PreAlloc;
    g_MallocSpyVtbl.PostAlloc           = MallocSpy_PostAlloc;
    g_MallocSpyVtbl.PreFree             = MallocSpy_PreFree;
    g_MallocSpyVtbl.PostFree            = MallocSpy_PostFree;
    g_MallocSpyVtbl.PreRealloc          = MallocSpy_PreRealloc;
    g_MallocSpyVtbl.PostRealloc         = MallocSpy_PostRealloc;
    g_MallocSpyVtbl.PreGetSize          = MallocSpy_PreGetSize;
    g_MallocSpyVtbl.PostGetSize         = MallocSpy_PostGetSize;
    g_MallocSpyVtbl.PreDidAlloc         = MallocSpy_PreDidAlloc;
    g_MallocSpyVtbl.PostDidAlloc        = MallocSpy_PostDidAlloc;
    g_MallocSpyVtbl.PreHeapMinimize     = MallocSpy_PreHeapMinimize;
    g_MallocSpyVtbl.PostHeapMinimize    = MallocSpy_PostHeapMinimize;

    fStatus = OleStdCheckVtbl(
          &g_MallocSpyVtbl,
          sizeof(g_MallocSpyVtbl),
          OLESTR("IMallocSpy"));
    if (! fStatus)
        return FALSE;

    lpcMallocSpy = malloc(sizeof(CMALLOCSPY));

    if (NULL == lpcMallocSpy)
    {
        return FALSE;
    }
    lpcMallocSpy->lpVtbl = &g_MallocSpyVtbl;
    lpcMallocSpy->m_cRef = 0;

    hr = CoRegisterMallocSpy((LPMALLOCSPY)lpcMallocSpy);

    return(SUCCEEDED(hr));
}

STDMETHODIMP_ ( BOOL )

Definition at line 576 of file malspy.c.

{
    return fActual;
}

void UninitializeMallocSpy ( void )

Definition at line 159 of file malspy.c.

{
    CoRevokeMallocSpy();
}

Generated on Wed Nov 13 2024 16:53:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/OleStd/malspy.h File Reference

  • Com
  • Fundamentals
  • OleStd
Functions

malspy.h File Reference

Go to the source code of this file.

Functions

BOOL | InitializeMallocSpy (void)
void | UninitializeMallocSpy (void)

Function Documentation

BOOL InitializeMallocSpy ( void )
void UninitializeMallocSpy ( void )

Definition at line 159 of file malspy.c.

{
    CoRevokeMallocSpy();
}

Generated on Wed Nov 13 2024 16:53:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/OleStd/msgfiltr.c File Reference

  • Com
  • Fundamentals
  • OleStd
Classes | Defines | Typedefs | Functions

msgfiltr.c File Reference

#include "olestd.h"
#include "msgfiltr.h"

Go to the source code of this file.

Classes

struct | tagOLESTDMESSAGEFILTER

Defines

#define | IS_SIGNIFICANT_MSG(lpmsg)
#define | STRICT 1

Typedefs

typedef OLEDBGDATA struct
tagOLESTDMESSAGEFILTER * 		LPOLESTDMESSAGEFILTER
typedef OLEDBGDATA struct
tagOLESTDMESSAGEFILTER 		OLESTDMESSAGEFILTER

Functions

STDMETHODIMP | OleStdMsgFilter_QueryInterface (LPMESSAGEFILTER lpThis, REFIID riid, LPVOID FAR *ppvObj)
OleStdMsgFilter_SetHandleInComingCallbackProc (LPMESSAGEFILTER lpThis, HANDLEINCOMINGCALLBACKPROC lpfnHandleInComingCallback)
STDAPI_ (HWND)
STDAPI_ (LPMESSAGEFILTER)
STDAPI_ (BOOL)
STDAPI_ (void)
STDAPI_ (DWORD)
STDMETHODIMP_ (STDMETHODIMP_() OleStdMsgFilter_Release(LPMESSAGEFILTER lpThis) ULONG)
STDMETHODIMP_ (ULONG)
STDMETHODIMP_ (DWORD)

Define Documentation

#define IS_SIGNIFICANT_MSG ( lpmsg )
Value:
(   \
      (PeekMessage((lpmsg), NULL, WM_LBUTTONDOWN, WM_LBUTTONDOWN, \
             PM_NOREMOVE | PM_NOYIELD)) \
    || (PeekMessage((lpmsg), NULL, WM_LBUTTONDBLCLK, WM_LBUTTONDBLCLK, \
             PM_NOREMOVE | PM_NOYIELD)) \
    || (PeekMessage((lpmsg), NULL, WM_NCLBUTTONDOWN, WM_NCLBUTTONDOWN, \
             PM_NOREMOVE | PM_NOYIELD)) \
    || (PeekMessage((lpmsg), NULL, WM_NCLBUTTONDBLCLK, WM_NCLBUTTONDBLCLK, \
             PM_NOREMOVE | PM_NOYIELD)) \
    || (PeekMessage((lpmsg), NULL, WM_KEYDOWN, WM_KEYDOWN, \
             PM_NOREMOVE | PM_NOYIELD)) \
    || (PeekMessage((lpmsg), NULL, WM_SYSKEYDOWN, WM_SYSKEYDOWN, \
             PM_NOREMOVE | PM_NOYIELD)) \
   )

Definition at line 641 of file msgfiltr.c.

#define STRICT 1

Definition at line 13 of file msgfiltr.c.

Typedef Documentation

typedef OLEDBGDATA struct tagOLESTDMESSAGEFILTER* LPOLESTDMESSAGEFILTER
typedef OLEDBGDATA struct tagOLESTDMESSAGEFILTER OLESTDMESSAGEFILTER

Function Documentation

STDMETHODIMP OleStdMsgFilter_QueryInterface | ( | LPMESSAGEFILTER | lpThis,
 |  | REFIID | riid,
 |  | LPVOID FAR * | ppvObj
 | ) |  |

Definition at line 422 of file msgfiltr.c.

{
   LPOLESTDMESSAGEFILTER lpStdMsgFilter = (LPOLESTDMESSAGEFILTER)lpThis;
   SCODE scode;

   /* Two interfaces supported: IUnknown, IMessageFilter
   */

   if (IsEqualIID(riid, &IID_IMessageFilter) || IsEqualIID(riid, &IID_IUnknown)) {
      lpStdMsgFilter->m_cRef++;   // A pointer to this object is returned
      *ppvObj = lpThis;
      scode = S_OK;
   }
   else {                 // unsupported interface
      *ppvObj = NULL;
      scode = E_NOINTERFACE;
   }

   return scode;
}

OleStdMsgFilter_SetHandleInComingCallbackProc | ( | LPMESSAGEFILTER | lpThis,
 |  | HANDLEINCOMINGCALLBACKPROC | lpfnHandleInComingCallback
 | ) |  |

Definition at line 220 of file msgfiltr.c.

{
   LPOLESTDMESSAGEFILTER lpStdMsgFilter = (LPOLESTDMESSAGEFILTER)lpThis;
   HANDLEINCOMINGCALLBACKPROC    lpfnPrevCallback =
         lpStdMsgFilter->m_lpfnHandleInComingCallback;

   if (!IsBadWritePtr((LPVOID)lpStdMsgFilter, sizeof(OLESTDMESSAGEFILTER))) {
      lpStdMsgFilter->m_lpfnHandleInComingCallback =
            lpfnHandleInComingCallback;
   } else {
      OleDbgAssert(
         "OleStdMsgFilter_SetIncomingCallStatus: Invalid IMessageFilter*");
   }

#if defined( _DEBUG )
   {
      if (lpfnHandleInComingCallback)
         OleDbgOut3(
            "OleStdMsgFilter_SetHandleInComingCallbackProc SET\r\n");
      else
         OleDbgOut3(
            "OleStdMsgFilter_SetHandleInComingCallbackProc CLEARED\r\n");

   }
#endif  // _DEBUG

   return lpfnPrevCallback;
}

STDAPI_ ( HWND )

Definition at line 411 of file msgfiltr.c.

{
   LPOLESTDMESSAGEFILTER lpStdMsgFilter = (LPOLESTDMESSAGEFILTER)lpThis;
   HWND hWndPrev = lpStdMsgFilter->m_hWndParent;

   lpStdMsgFilter->m_hWndParent = hWndParent;
   return hWndPrev;
}

STDAPI_ ( LPMESSAGEFILTER )

Definition at line 103 of file msgfiltr.c.

{
   LPOLESTDMESSAGEFILTER lpStdMsgFilter;
   LPMALLOC lpMalloc;

   if (CoGetMalloc(MEMCTX_TASK, (LPMALLOC FAR*)&lpMalloc) != NOERROR)
      return NULL;

   lpStdMsgFilter = (LPOLESTDMESSAGEFILTER)lpMalloc->lpVtbl->Alloc(
         lpMalloc, (sizeof(OLESTDMESSAGEFILTER)));
   lpMalloc->lpVtbl->Release(lpMalloc);
   if (! lpStdMsgFilter) return NULL;

   lpStdMsgFilter->m_lpVtbl = &g_OleStdMessageFilterVtbl;
   lpStdMsgFilter->m_cRef = 1;
   lpStdMsgFilter->m_hWndParent = hWndParent;
   lpStdMsgFilter->m_dwInComingCallStatus = SERVERCALL_ISHANDLED;
   lpStdMsgFilter->m_lpfnHandleInComingCallback = NULL;
   lpStdMsgFilter->m_fEnableBusyDialog = TRUE;
   lpStdMsgFilter->m_fEnableNotRespondingDialog = TRUE;
   lpStdMsgFilter->m_lpszAppName = szAppName;
   lpStdMsgFilter->m_lpfnMessagePendingCallback = lpfnCallback;
   lpStdMsgFilter->m_lpfnBusyDialogHookCallback = lpfnOleUIHook;
   lpStdMsgFilter->m_hWndBusyDialog = NULL;
   lpStdMsgFilter->m_bUnblocking = FALSE;

  g_dwObjectCount ++;

   return (LPMESSAGEFILTER)lpStdMsgFilter;
}

STDAPI_ ( BOOL )

Definition at line 370 of file msgfiltr.c.

{
   LPOLESTDMESSAGEFILTER lpStdMsgFilter = (LPOLESTDMESSAGEFILTER)lpThis;
   BOOL fPrevEnable = lpStdMsgFilter->m_fEnableNotRespondingDialog;

   if (!IsBadWritePtr((LPVOID)lpStdMsgFilter,  sizeof(OLESTDMESSAGEFILTER)))
      lpStdMsgFilter->m_fEnableNotRespondingDialog = fEnable;
   else
      OleDbgAssert(
            "OleStdMsgFilter_EnableNotRespondingDialog: Invalid IMessageFilter*");

#if defined( _DEBUG )
   {
   char szBuf[80];
   wsprintf(
      szBuf,
      "OleStdMsgFilter_EnableNotRespondingDialog: Dialog is %s.\r\n",
      fEnable ? /*(LPSTR)*/"ENABLED" : /*(LPSTR)*/"DISABLED"
   );
   OleDbgOut3(szBuf);
   }
#endif

   return fPrevEnable;
}

STDAPI_ ( void )

Definition at line 155 of file msgfiltr.c.

{
   LPOLESTDMESSAGEFILTER lpStdMsgFilter = (LPOLESTDMESSAGEFILTER)lpThis;

   if (!IsBadWritePtr((LPVOID)lpStdMsgFilter,  sizeof(OLESTDMESSAGEFILTER)))
      lpStdMsgFilter->m_dwInComingCallStatus = dwInComingCallStatus;
   else
      OleDbgAssert(
         "OleStdMsgFilter_SetIncomingCallStatus: Invalid IMessageFilter*");

#if defined( _DEBUG )
   {
   char szBuf[80];
   char *szReturn;

   switch(dwInComingCallStatus) {
      case SERVERCALL_ISHANDLED:
         szReturn = "SERVERCALL_ISHANDLED";
         break;
      case SERVERCALL_REJECTED:
         szReturn = "SERVERCALL_REJECTED";
         break;
      case SERVERCALL_RETRYLATER:
         szReturn = "SERVERCALL_RETRYLATER";
         break;
      default:
         szReturn = "** ERROR: UNKNOWN **";
         break;
      }
   wsprintf(
      szBuf,
      "OleStdMsgFilter_SetInComingCallStatus: Status set to %s.\r\n",
      /*(LPSTR)*/szReturn
   );
   OleDbgOut3(szBuf);
   }
#endif

}

STDAPI_ ( DWORD )

Definition at line 267 of file msgfiltr.c.

{
   LPOLESTDMESSAGEFILTER lpStdMsgFilter = (LPOLESTDMESSAGEFILTER)lpThis;
   DWORD dwReturn;

   if (!IsBadReadPtr((LPVOID)lpStdMsgFilter,  sizeof(OLESTDMESSAGEFILTER)))
      dwReturn = lpStdMsgFilter->m_dwInComingCallStatus;
   else
      {
      OleDbgAssert(
         "OleStdMsgFilter_GetIncomingCallStatus: Invalid IMessageFilter*");
      dwReturn = (DWORD)-1;
      }

#if defined( _DEBUG )
   {
   char szBuf[80];
   char *szReturn;

   switch(dwReturn) {
      case SERVERCALL_ISHANDLED:
         szReturn = "SERVERCALL_ISHANDLED";
         break;
      case SERVERCALL_REJECTED:
         szReturn = "SERVERCALL_REJECTED";
         break;
      case SERVERCALL_RETRYLATER:
         szReturn = "SERVERCALL_RETRYLATER";
         break;
      default:
         szReturn = "-1";
         break;
      }
   wsprintf(
      szBuf,
      "OleStdMsgFilter_GetInComingCallStatus returns %s.\r\n",
      /*(LPSTR)*/szReturn
   );
   OleDbgOut3(szBuf);
   }
#endif

   return dwReturn;
}

STDMETHODIMP_ ( STDMETHODIMP_() OleStdMsgFilter_Release(LPMESSAGEFILTER lpThis) ULONG )

Definition at line 48 of file msgfiltr.c.

                                                      {
   OleStdMsgFilter_QueryInterface,
   OleStdMsgFilter_AddRef,
   OleStdMsgFilter_Release,
   OleStdMsgFilter_HandleInComingCall,
   OleStdMsgFilter_RetryRejectedCall,
   OleStdMsgFilter_MessagePending
};

STDMETHODIMP_ ( ULONG )

Definition at line 451 of file msgfiltr.c.

{
   LPOLESTDMESSAGEFILTER lpStdMsgFilter = (LPOLESTDMESSAGEFILTER)lpThis;
   LPMALLOC lpMalloc;

   if (--lpStdMsgFilter->m_cRef != 0) // Still used by others
      return lpStdMsgFilter->m_cRef;

   // Free storage
   if (CoGetMalloc(MEMCTX_TASK, (LPMALLOC FAR*)&lpMalloc) != NOERROR)
      return (ULONG)0;

   lpMalloc->lpVtbl->Free(lpMalloc, lpStdMsgFilter);
   lpMalloc->lpVtbl->Release(lpMalloc);

  g_dwObjectCount --;

   return (ULONG)0;
}

STDMETHODIMP_ ( DWORD )

Definition at line 657 of file msgfiltr.c.

{
   LPOLESTDMESSAGEFILTER   lpStdMsgFilter = (LPOLESTDMESSAGEFILTER)lpThis;
   DWORD                   dwReturn = PENDINGMSG_WAITDEFPROCESS;
   MSG                     msg;
   BOOL                    fIsSignificantMsg = IS_SIGNIFICANT_MSG(&msg);
   UINT                    uRet;

   char szBuf[128];
#if defined( _DEBUG )
   wsprintf(
         szBuf,
         "OleStdMsgFilter_MessagePending, dwTickCount = 0x%lX\r\n",
         (DWORD)dwTickCount
   );
   OleDbgOut4(szBuf);
#endif

   /* NOTE: If our tick count for this call exceeds our standard retry
   **      delay, then we need to put up the dialog.  We will only
   **      consider putting up the dialog if the user has issued a
   **      "significant" event (ie. mouse click or keyboard event). a
   **      simple mouse move should NOT trigger this dialog.
   **      Since our call to
   **      OleUIBusy below enters a DialogBox() message loop, there's a
   **      possibility that another call will be initiated during the dialog,
   **      and this procedure will be re-entered.  Just so we don't put up
   **      two dialogs at a time, we use the m_bUnblocking varable
   **      to keep track of this situation.
   */

   if (dwTickCount > (DWORD)OLESTDRETRYDELAY && fIsSignificantMsg
         && !lpStdMsgFilter->m_bUnblocking)
   {

      if (lpStdMsgFilter->m_fEnableNotRespondingDialog)
      {
      OLEUIBUSY bz;

      lpStdMsgFilter->m_bUnblocking = TRUE;

      // Eat messages in our queue that we do NOT want to be dispatched
      while (PeekMessage(&msg, NULL, WM_CLOSE, WM_CLOSE, PM_REMOVE | PM_NOYIELD));

      /* Set up structure for calling OLEUIBUSY dialog,
      ** using the "not responding" variety
      */

      bz.cbStruct = sizeof(OLEUIBUSY);
      bz.dwFlags = BZ_NOTRESPONDINGDIALOG;
      bz.hWndOwner =GetTopWindowInWindowsTask(lpStdMsgFilter->m_hWndParent);
      W2A(lpStdMsgFilter->m_lpszAppName, szBuf, sizeof(szBuf));
      bz.lpszCaption = szBuf;
      bz.lpfnHook = lpStdMsgFilter->m_lpfnBusyDialogHookCallback;
      bz.lCustData = 0;
      bz.hInstance = NULL;
      bz.lpszTemplate = NULL;
      bz.hResource = 0;
      bz.hTask = htaskCallee;

      /* Set up the address to the hWnd in our MsgFilter structure.  The
      ** call to OleUIBusy will fill this in with the hWnd of the busy
      ** dialog box
      */

      bz.lphWndDialog =  (HWND FAR *)&(lpStdMsgFilter->m_hWndBusyDialog);
      uRet = OleUIBusy(&bz);

      lpStdMsgFilter->m_bUnblocking = FALSE;

      return PENDINGMSG_WAITNOPROCESS;
      }
#if defined( _DEBUG )
      else {
         OleDbgOut3("OleStdMsgFilter_MessagePending: BLOCKED but dialog Disabled\r\n");
      }
#endif
   }

   /* If we're already unblocking, we're being re-entered.  Don't
   ** process message
   */

   if (lpStdMsgFilter->m_bUnblocking)
      return PENDINGMSG_WAITDEFPROCESS;

   /* NOTE: If we have a callback function set up, call it with the
   ** current message.  If not, tell OLE LPRC mechanism to automatically
   ** handle all messages.
   */
   if (lpStdMsgFilter->m_lpfnMessagePendingCallback &&
      !IsBadCodePtr((FARPROC)lpStdMsgFilter->m_lpfnMessagePendingCallback)){
      MSG msg;

      /* NOTE: the app provided a MessagePendingCallback
      **    function. we will PeekMessage for the first message in
      **    the queue and pass it to the app. the app in its callback
      **    function can decide to Dispatch this message or it can
      **    PeekMessage on its own giving particular message filter
      **    criteria. if the app returns TRUE then we return
      **    PENDINGMSG_WAITNOPROCESS to OLE telling OLE to leave the
      **    message in the queue. If the app returns FALSE, then we
      **    return PENDINGMSG_WAITDEFPROCESS to OLE telling OLE to do
      **    its default processing with the message. by default OLE
      **    dispatches system messages and eats other messages and
      **    beeps.
      */
      if (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE | PM_NOYIELD)) {

         if (lpStdMsgFilter->m_lpfnMessagePendingCallback(&msg)) {
            /* TRUE return means that the app processed message.
            **
            ** NOTE: (CHANGE FROM OLE2.0 VERSION) we leave it up to
            **    the callback routine to remove the message if it
            **    wants.
            */
            dwReturn = PENDINGMSG_WAITNOPROCESS;
         } else {
            /* FALSE means that the app did not process the
            **    message. we will let OLE take its
            **    default action.
            **
            ** NOTE: (CHANGE FROM OLE2.0 VERSION) we used to return
            **    PENDINGMSG_WAITNOPROCESS to leave the message in
            **    the queue; now we return PENDINGMSG_WAITDEFPROCESS
            **    to let OLE do default processing.
            */
            dwReturn = PENDINGMSG_WAITDEFPROCESS;

#if defined( _DEBUG )
            wsprintf(
                  szBuf,
                  "Message (0x%x) (wParam=0x%x, lParam=0x%lx) using WAITDEFPROCESS while blocked\r\n",
                  msg.message,
                  msg.lParam,
                  msg.wParam
            );
            OleDbgOut2(szBuf);
#endif  // _DEBUG
         }
      }
   }

   return dwReturn;
}

Generated on Wed Nov 13 2024 16:53:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/OleStd/Objfdbk.c File Reference

  • Com
  • Fundamentals
  • OleStd
Defines | Functions

Objfdbk.c File Reference

#include "olestd.h"

Go to the source code of this file.

Defines

#define STRICT 1

Functions

STDAPI_ (void)

Define Documentation

#define STRICT 1

Definition at line 13 of file Objfdbk.c.

Function Documentation

STDAPI_ ( void )

Definition at line 220 of file Objfdbk.c.

{
        HPEN    hpen;
        HPEN    hpenOld;
        HBRUSH  hbrOld;

        if (!lprc || !hdc)
                return;

        hpen = fIsLink ? CreatePen(PS_DASH, 1, RGB(0,0,0)) :
                                         GetStockObject(BLACK_PEN);

        if (!hpen)
                return;

        hpenOld = SelectObject(hdc, hpen);
        hbrOld = SelectObject(hdc, GetStockObject(NULL_BRUSH));

        Rectangle(hdc, lprc->left, lprc->top, lprc->right, lprc->bottom);

        SelectObject(hdc, hpenOld);
        SelectObject(hdc, hbrOld);

        if (fIsLink)
                DeleteObject(hpen);

}

Generated on Wed Nov 13 2024 16:53:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/OleStd/ole2ui.c File Reference

  • Com
  • Fundamentals
  • OleStd
Defines | Functions | Variables

ole2ui.c File Reference

#include "olestd.h"
#include "common.h"
#include "utility.h"
#include <commdlg.h>
#include "malspy.h"
#include <stdarg.h>

Go to the source code of this file.

Defines

#define | STRICT 1
#define | WINDLL 1
#define | WM_U_UPDATELINK WM_USER

Functions

STDAPI | OleUICanUnloadNow ()
STDAPI_ (BOOL)
STDAPI_ (void)

Variables

UINT cfEmbeddedObject
UINT cfEmbedSource
UINT cfFileName
UINT cfLinkSource
UINT cfLinkSrcDescriptor
UINT cfObjectDescriptor
UINT cfOwnerLink
DWORD | g_dwLockCount = 0
DWORD | g_dwObjectCount = 0
HINSTANCE | ghInst
UINT | uMsgBrowse = 0
UINT | uMsgChangeIcon = 0
UINT | uMsgCloseBusyDlg = 0
UINT | uMsgEndDialog = 0
UINT | uMsgFileOKString = 0
UINT | uMsgHelp = 0

Define Documentation

#define STRICT 1

Definition at line 10 of file ole2ui.c.

#define WINDLL 1

Definition at line 20 of file ole2ui.c.

#define WM_U_UPDATELINK WM_USER

Definition at line 49 of file ole2ui.c.

Function Documentation

STDAPI OleUICanUnloadNow ( void )

Definition at line 145 of file ole2ui.c.

{
  if (g_dwObjectCount == 0) {
   return NOERROR;
  }

  return S_FALSE;
}

STDAPI_ ( BOOL )

Definition at line 83 of file ole2ui.c.

{
   OleDbgOut1("OleStdInitialize called.\r\n");
   ghInst=hInstance;

   // Register Clipboard Formats used by PasteSpecial dialog.
   cfObjectDescriptor = RegisterClipboardFormat(CF_OBJECTDESCRIPTOR);
   cfLinkSrcDescriptor= RegisterClipboardFormat(CF_LINKSRCDESCRIPTOR);
   cfEmbedSource      = RegisterClipboardFormat(CF_EMBEDSOURCE);
   cfEmbeddedObject   = RegisterClipboardFormat(CF_EMBEDDEDOBJECT);
   cfLinkSource       = RegisterClipboardFormat(CF_LINKSOURCE);
   cfOwnerLink        = RegisterClipboardFormat(CF_OWNERLINK);
   cfFileName         = RegisterClipboardFormat(CF_FILENAME);

#ifdef TRACEMEM
   return (InitializeMallocSpy());
#else
   return (TRUE);
#endif
}

STDAPI_ ( void )

Definition at line 104 of file ole2ui.c.

{
#ifdef TRACEMEM
   UninitializeMallocSpy();
#endif
}

Variable Documentation

UINT cfEmbeddedObject

Definition at line 42 of file ole2ui.c.

UINT cfEmbedSource

Definition at line 41 of file ole2ui.c.

UINT cfFileName

Definition at line 45 of file ole2ui.c.

UINT cfLinkSource

Definition at line 43 of file ole2ui.c.

UINT cfLinkSrcDescriptor

Definition at line 40 of file ole2ui.c.

UINT cfObjectDescriptor

Definition at line 39 of file ole2ui.c.

UINT cfOwnerLink

Definition at line 44 of file ole2ui.c.

DWORD g_dwLockCount = 0

Definition at line 28 of file ole2ui.c.

DWORD g_dwObjectCount = 0

Definition at line 27 of file ole2ui.c.

HINSTANCE ghInst

Name of app.

Definition at line 24 of file ole2ui.c.

UINT uMsgBrowse = 0

Definition at line 33 of file ole2ui.c.

UINT uMsgChangeIcon = 0

Definition at line 34 of file ole2ui.c.

UINT uMsgCloseBusyDlg = 0

Definition at line 36 of file ole2ui.c.

UINT uMsgEndDialog = 0

Definition at line 32 of file ole2ui.c.

UINT uMsgFileOKString = 0

Definition at line 35 of file ole2ui.c.

UINT uMsgHelp = 0

Definition at line 31 of file ole2ui.c.

Generated on Wed Nov 13 2024 16:53:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/OleStd/OleStd.c File Reference

  • Com
  • Fundamentals
  • OleStd
Defines | Functions

OleStd.c File Reference

#include "olestd.h"
#include <stdlib.h>
#include <ctype.h>
#include <shellapi.h>
#include "common.h"

Go to the source code of this file.

Defines

#define | FORMATETC_MAX 20
#define | NONAMELESSUNION
#define | STRICT 1

Functions

STDAPI | OleStdDestroyAllElements (LPSTORAGE lpStg)
STDAPI | OleStdDoConvert (LPSTORAGE lpStg, REFCLSID rClsidNew)
STDAPI | OleStdDoTreatAsClass (LPOLESTR lpszUserType, REFCLSID rclsid, REFCLSID rclsidNew)
STDAPI | OleStdGetLinkSourceData (LPMONIKER lpmk, LPCLSID lpClsID, LPFORMATETC lpformatetc, LPSTGMEDIUM lpMedium)
STDAPI | OleStdGetOleObjectData (LPPERSISTSTORAGE lpPStg, LPFORMATETC lpformatetc, LPSTGMEDIUM lpMedium, BOOL fUseMemory)
STDAPI | OleStdMkParseDisplayName (REFCLSID rClsid, LPBC lpbc, LPOLESTR lpszUserName, ULONG FAR *lpchEaten, LPMONIKER FAR *lplpmk)
STDMETHODIMP | OleStdNullMethod (LPUNKNOWN lpThis)
STDAPI | OleStdSetIconInCache (LPOLEOBJECT lpOleObj, HGLOBAL hMetaPict)
STDAPI | OleStdSwitchDisplayAspect (LPOLEOBJECT lpOleObj, LPDWORD lpdwCurAspect, DWORD dwNewAspect, HGLOBAL hMetaPict, BOOL fDeleteOldAspect, BOOL fSetupViewAdvise, LPADVISESINK lpAdviseSink, BOOL FAR *lpfMustUpdate)
STDAPI_ (LPOLESTR)
STDAPI_ (ULONG)
STDAPI_ (void)
STDAPI_ (int)
STDAPI_ (BOOL)
STDAPI_ (LPVOID)
STDAPI_ (HGLOBAL)
STDAPI_ (LPMONIKER)
STDAPI_ (HANDLE)
STDAPI_ (LPSTORAGE)
STDAPI_ (LPUNKNOWN)

Define Documentation

#define FORMATETC_MAX 20
#define NONAMELESSUNION

Definition at line 14 of file OleStd.c.

#define STRICT 1

Definition at line 16 of file OleStd.c.

Function Documentation

STDAPI OleStdDestroyAllElements ( LPSTORAGE lpStg )

Definition at line 2969 of file OleStd.c.

{
   IEnumSTATSTG FAR* lpEnum;
   STATSTG sstg;
   HRESULT hrErr;

   hrErr = lpStg->lpVtbl->EnumElements(
         lpStg, 0, NULL, 0, (IEnumSTATSTG FAR* FAR*)&lpEnum);

   if (hrErr != NOERROR)
      return hrErr;

   while (1) {
      if (lpEnum->lpVtbl->Next(lpEnum, 1, &sstg, NULL) != NOERROR)
         break;
      lpStg->lpVtbl->DestroyElement(lpStg, sstg.pwcsName);
      OleStdFree(sstg.pwcsName);
   }
   lpEnum->lpVtbl->Release(lpEnum);
   return NOERROR;
}

STDAPI OleStdDoConvert | ( | LPSTORAGE | lpStg,
 |  | REFCLSID | rClsidNew
 | ) |  |

Definition at line 380 of file OleStd.c.

{
   HRESULT error;
   CLSID clsidOld;
   CLIPFORMAT cfOld;
   LPOLESTR lpszOld = NULL;
   OLECHAR szNew[OLEUI_CCHKEYMAX];

   if ((error = ReadClassStg(lpStg, &clsidOld)) != NOERROR) {
      clsidOld = CLSID_NULL;
      goto errRtn;
   }

   // read old fmt/old user type; sets out params to NULL on error
   error = ReadFmtUserTypeStg(lpStg, &cfOld, &lpszOld);
   OleDbgAssert(error == NOERROR || (cfOld == 0 && lpszOld == NULL));

   // get new user type name; if error, set to NULL string
   if (OleStdGetUserTypeOfClass(
         (LPCLSID)rClsidNew, szNew, OLEUI_CCHKEYMAX,NULL /* hKey */) == 0)
      OLESTRCPY (szNew, OLESTR (""));

   // write class stg
   if ((error = WriteClassStg(lpStg, rClsidNew)) != NOERROR)
      goto errRtn;

   // write old fmt/new user type;
   if ((error = WriteFmtUserTypeStg(lpStg, cfOld, szNew)) != NOERROR)
      goto errRewriteInfo;

   // set convert bit
   if ((error = SetConvertStg(lpStg, TRUE)) != NOERROR)
      goto errRewriteInfo;

   goto okRtn;

errRewriteInfo:
   (void)WriteClassStg(lpStg, &clsidOld);
   (void)WriteFmtUserTypeStg(lpStg, cfOld, lpszOld);

errRtn:

okRtn:
   OleStdFreeString(lpszOld, NULL);
   return error;
}

STDAPI OleStdDoTreatAsClass | ( | LPOLESTR | lpszUserType,
 |  | REFCLSID | rclsid,
 |  | REFCLSID | rclsidNew
 | ) |  |

Definition at line 513 of file OleStd.c.

{
   HRESULT hrErr;
   LPOLESTR   lpszCLSID = NULL;
   char       lpszAnsiCLSID[256];
   LONG    lRet;
   HKEY    hKey;
   char    lpszAnsiUserType[256];

   OLEDBG_BEGIN2("CoTreatAsClass called\r\n")
   hrErr = CoTreatAsClass(rclsid, rclsidNew);
   OLEDBG_END2

   if ((hrErr != NOERROR) && lpszUserType) {
      lRet = RegOpenKey(HKEY_CLASSES_ROOT, (LPCSTR)"CLSID",
            (HKEY FAR *)&hKey);
      StringFromCLSID(rclsid, /*(LPOLESTR FAR*)*/&lpszCLSID);
      W2A (lpszCLSID, lpszAnsiCLSID, 256);
      W2A (lpszUserType, lpszAnsiUserType, 256);
      RegSetValue(hKey, lpszAnsiCLSID, REG_SZ, lpszAnsiUserType,
            lstrlen(lpszAnsiUserType));

      if (lpszCLSID)
         OleStdFreeString(lpszCLSID, NULL);

      hrErr = CoTreatAsClass(rclsid, rclsidNew);
      RegCloseKey(hKey);
   }

   return hrErr;
}

STDAPI OleStdGetLinkSourceData | ( | LPMONIKER | lpmk,
 |  | LPCLSID | lpClsID,
 |  | LPFORMATETC | lpformatetc,
 |  | LPSTGMEDIUM | lpMedium
 | ) |  |

Definition at line 1047 of file OleStd.c.

{
   LPSTREAM    lpstm = NULL;
   DWORD       reserved = 0;
   HRESULT     hrErr;

   if (lpMedium->tymed == TYMED_NULL) {
      if (lpformatetc->tymed & TYMED_ISTREAM) {
         hrErr = CreateStreamOnHGlobal(
               NULL, /* auto allocate */
               TRUE, /* delete on release */
               (LPSTREAM FAR*)&lpstm
         );
         if (hrErr != NOERROR) {
            lpMedium->pUnkForRelease = NULL;
            return E_OUTOFMEMORY;
         }
         lpMedium->u.pstm = lpstm;
         lpMedium->tymed = TYMED_ISTREAM;
         lpMedium->pUnkForRelease = NULL;
      } else {
         lpMedium->pUnkForRelease = NULL;
         return DATA_E_FORMATETC;
      }
   } else {
      if (lpMedium->tymed == TYMED_ISTREAM) {
         lpMedium->tymed = TYMED_ISTREAM;
         lpMedium->u.pstm = lpMedium->u.pstm;
         lpMedium->pUnkForRelease = NULL;
      } else {
         lpMedium->pUnkForRelease = NULL;
         return DATA_E_FORMATETC;
      }
   }

   hrErr = OleSaveToStream((LPPERSISTSTREAM)lpmk, lpMedium->u.pstm);
   if (hrErr != NOERROR) return hrErr;
   return WriteClassStm(lpMedium->u.pstm, lpClsID);
}

STDAPI OleStdGetOleObjectData | ( | LPPERSISTSTORAGE | lpPStg,
 |  | LPFORMATETC | lpformatetc,
 |  | LPSTGMEDIUM | lpMedium,
 |  | BOOL | fUseMemory
 | ) |  |

Definition at line 984 of file OleStd.c.

{
   LPSTORAGE   lpstg = NULL;
   DWORD       reserved = 0;
   SCODE       sc = S_OK;
   HRESULT     hrErr;

   lpMedium->pUnkForRelease = NULL;

   if (lpMedium->tymed == TYMED_NULL) {

      if (lpformatetc->tymed & TYMED_ISTORAGE) {

         /* allocate a temp docfile that will delete on last release */
         lpstg = OleStdCreateTempStorage(
               TRUE /*fUseMemory*/,
               STGM_READWRITE | STGM_TRANSACTED | STGM_SHARE_EXCLUSIVE
         );
         if (!lpstg)
            return E_OUTOFMEMORY;

         lpMedium->u.pstg = lpstg;
         lpMedium->tymed = TYMED_ISTORAGE;
         lpMedium->pUnkForRelease = NULL;
      } else {
         return DATA_E_FORMATETC;
      }
   } else if (lpMedium->tymed == TYMED_ISTORAGE) {
      lpMedium->tymed = TYMED_ISTORAGE;
   } else {
      return DATA_E_FORMATETC;
   }

   // NOTE: even if OleSave returns an error you should still call
   // SaveCompleted.

   OLEDBG_BEGIN2("OleSave called\r\n")
   hrErr = OleSave(lpPStg, lpMedium->u.pstg, FALSE /* fSameAsLoad */);
   OLEDBG_END2

   if (hrErr != NOERROR) {
      OleDbgOutHResult("WARNING: OleSave returned", hrErr);
      sc = hrErr;
   }
   OLEDBG_BEGIN2("IPersistStorage::SaveCompleted called\r\n")
   hrErr = lpPStg->lpVtbl->SaveCompleted(lpPStg, NULL);
   OLEDBG_END2

   if (hrErr != NOERROR) {
      OleDbgOutHResult("WARNING: SaveCompleted returned",hrErr);
      if (sc == S_OK)
         sc = hrErr;
   }

   return sc;
}

STDAPI OleStdMkParseDisplayName | ( | REFCLSID | rClsid,
 |  | LPBC | lpbc,
 |  | LPOLESTR | lpszUserName,
 |  | ULONG FAR * | lpchEaten,
 |  | LPMONIKER FAR * | lplpmk
 | ) |  |

Definition at line 2447 of file OleStd.c.

{
   HRESULT hrErr;

   if (!IsEqualCLSID(rClsid,&CLSID_NULL) && CoIsOle1Class(rClsid) &&
      lpszUserName[0] != '@') {
      LPOLESTR lpszBuf;
      LPOLESTR lpszProgID;
      char     lpszAnsiBuf[256], lpszAnsiProgID[256], lpszAnsiUserName[256];

      // Prepend "@<ProgID>!" to the input string
      ProgIDFromCLSID(rClsid, &lpszProgID);
      if (lpszProgID == NULL)
         goto Cont1;
      lpszBuf = OleStdMalloc(
            ((ULONG)OLESTRLEN(lpszUserName)+OLESTRLEN(lpszProgID)+3) * sizeof(OLECHAR));
      if (lpszBuf == NULL) {
         if (lpszProgID)
            OleStdFree(lpszProgID);
         goto Cont1;
      }

      W2A (lpszProgID, lpszAnsiProgID, 256);
      W2A (lpszUserName, lpszAnsiUserName, 256);
      wsprintf(lpszAnsiBuf, "@%s!%s", lpszAnsiProgID, lpszAnsiUserName);
      A2W (lpszAnsiBuf, lpszBuf, OLESTRLEN(lpszUserName)+OLESTRLEN(lpszProgID)+3);
      OLEDBG_BEGIN2("MkParseDisplayName called\r\n")
      hrErr = MkParseDisplayName(lpbc, lpszBuf, lpchEaten, lplpmk);
      OLEDBG_END2

      if (lpszProgID)
         OleStdFree(lpszProgID);
      if (lpszBuf)
         OleStdFree(lpszBuf);

      if (hrErr == NOERROR)
         return NOERROR;
   }

Cont1:
   OLEDBG_BEGIN2("MkParseDisplayName called\r\n")
   hrErr = MkParseDisplayName(lpbc, lpszUserName, lpchEaten, lplpmk);
   OLEDBG_END2

   return hrErr;
}

STDMETHODIMP OleStdNullMethod ( LPUNKNOWN lpThis )

Definition at line 1978 of file OleStd.c.

{
   MessageBox(
         NULL,
         "ERROR: INTERFACE METHOD NOT IMPLEMENTED!\r\n",
         NULL,
         MB_SYSTEMMODAL | MB_ICONHAND | MB_OK
   );

   return E_NOTIMPL;
}

STDAPI OleStdSetIconInCache | ( | LPOLEOBJECT | lpOleObj,
 |  | HGLOBAL | hMetaPict
 | ) |  |

Definition at line 323 of file OleStd.c.

{
   LPOLECACHE      lpOleCache = NULL;
   FORMATETC       FmtEtc;
   STGMEDIUM       Medium;
   HRESULT         hrErr;

   if (! hMetaPict)
      return FALSE;   // invalid icon

   lpOleCache = (LPOLECACHE)OleStdQueryInterface(
                              (LPUNKNOWN)lpOleObj,&IID_IOleCache);
   if (! lpOleCache)
      return FALSE;   // if IOleCache* is NOT available, do nothing

   FmtEtc.cfFormat = CF_METAFILEPICT;
   FmtEtc.ptd      = NULL;
   FmtEtc.dwAspect = DVASPECT_ICON;
   FmtEtc.lindex   = -1;
   FmtEtc.tymed    = TYMED_MFPICT;

   // stuff the icon into the cache.
   Medium.tymed            = TYMED_MFPICT;
   Medium.u.hGlobal        = hMetaPict;
   Medium.pUnkForRelease   = NULL;

   OLEDBG_BEGIN2("IOleCache::SetData called\r\n")
   hrErr = lpOleCache->lpVtbl->SetData(
         lpOleCache,
         (LPFORMATETC)&FmtEtc,
         (LPSTGMEDIUM)&Medium,
         FALSE   /* fRelease */
   );
   OLEDBG_END2

   OleStdRelease((LPUNKNOWN)lpOleCache);

   return hrErr;
}

STDAPI OleStdSwitchDisplayAspect | ( | LPOLEOBJECT | lpOleObj,
 |  | LPDWORD | lpdwCurAspect,
 |  | DWORD | dwNewAspect,
 |  | HGLOBAL | hMetaPict,
 |  | BOOL | fDeleteOldAspect,
 |  | BOOL | fSetupViewAdvise,
 |  | LPADVISESINK | lpAdviseSink,
 |  | BOOL FAR * | lpfMustUpdate
 | ) |  |

Definition at line 147 of file OleStd.c.

{
   LPOLECACHE      lpOleCache = NULL;
   LPVIEWOBJECT    lpViewObj = NULL;
   LPENUMSTATDATA  lpEnumStatData = NULL;
   STATDATA        StatData;
   FORMATETC       FmtEtc;
   STGMEDIUM       Medium;
   DWORD           dwAdvf;
   DWORD           dwNewConnection;
   DWORD           dwOldAspect = *lpdwCurAspect;
   HRESULT         hrErr;

   if (lpfMustUpdate)
      *lpfMustUpdate = FALSE;

   lpOleCache = (LPOLECACHE)OleStdQueryInterface(
                              (LPUNKNOWN)lpOleObj,&IID_IOleCache);

   // if IOleCache* is NOT available, do nothing
   if (! lpOleCache)
      return E_INVALIDARG;

   // Setup new cache with the new aspect
   FmtEtc.cfFormat = 0;     // whatever is needed to draw
   FmtEtc.ptd      = NULL;
   FmtEtc.dwAspect = dwNewAspect;
   FmtEtc.lindex   = -1;
   FmtEtc.tymed    = TYMED_NULL;

   /* NOTE: if we are setting up Icon aspect with a custom icon
   **    then we do not want DataAdvise notifications to ever change
   **    the contents of the data cache. thus we set up a NODATA
   **    advise connection. otherwise we set up a standard DataAdvise
   **    connection.
   */
   if (dwNewAspect == DVASPECT_ICON && hMetaPict)
      dwAdvf = ADVF_NODATA;
   else
      dwAdvf = ADVF_PRIMEFIRST;

   OLEDBG_BEGIN2("IOleCache::Cache called\r\n")
   hrErr = lpOleCache->lpVtbl->Cache(
         lpOleCache,
         (LPFORMATETC)&FmtEtc,
         dwAdvf,
         (LPDWORD)&dwNewConnection
   );
   OLEDBG_END2

   if (! SUCCEEDED(hrErr)) {
      OleDbgOutHResult("IOleCache::Cache returned", hrErr);
      OleStdRelease((LPUNKNOWN)lpOleCache);
      return hrErr;
   }

   *lpdwCurAspect = dwNewAspect;

   /* NOTE: if we are setting up Icon aspect with a custom icon,
   **    then stuff the icon into the cache. otherwise the cache must
   **    be forced to be updated. set the *lpfMustUpdate flag to tell
   **    caller to force the object to Run so that the cache will be
   **    updated.
   */
   if (dwNewAspect == DVASPECT_ICON && hMetaPict) {

      FmtEtc.cfFormat = CF_METAFILEPICT;
      FmtEtc.ptd      = NULL;
      FmtEtc.dwAspect = DVASPECT_ICON;
      FmtEtc.lindex   = -1;
      FmtEtc.tymed    = TYMED_MFPICT;

      Medium.tymed            = TYMED_MFPICT;
      Medium.u.hGlobal        = hMetaPict;
      Medium.pUnkForRelease   = NULL;

      OLEDBG_BEGIN2("IOleCache::SetData called\r\n")
      hrErr = lpOleCache->lpVtbl->SetData(
            lpOleCache,
            (LPFORMATETC)&FmtEtc,
            (LPSTGMEDIUM)&Medium,
            FALSE   /* fRelease */
      );
      OLEDBG_END2
   } else {
      if (lpfMustUpdate)
         *lpfMustUpdate = TRUE;
   }

   if (fSetupViewAdvise && lpAdviseSink) {
      /* NOTE: re-establish the ViewAdvise connection */
      lpViewObj = (LPVIEWOBJECT)OleStdQueryInterface(
                              (LPUNKNOWN)lpOleObj,&IID_IViewObject);

      if (lpViewObj) {

         OLEDBG_BEGIN2("IViewObject::SetAdvise called\r\n")
         lpViewObj->lpVtbl->SetAdvise(
               lpViewObj,
               dwNewAspect,
               0,
               lpAdviseSink
         );
         OLEDBG_END2

         OleStdRelease((LPUNKNOWN)lpViewObj);
      }
   }

   /* NOTE: remove any existing caches that are set up for the old
   **    display aspect. It WOULD be possible to retain the caches set
   **    up for the old aspect, but this would increase the storage
   **    space required for the object and possibly require additional
   **    overhead to maintain the unused cachaes. For these reasons the
   **    strategy to delete the previous caches is prefered. if it is a
   **    requirement to quickly switch between Icon and Content
   **    display, then it would be better to keep both aspect caches.
   */

   if (fDeleteOldAspect) {
      OLEDBG_BEGIN2("IOleCache::EnumCache called\r\n")
      hrErr = lpOleCache->lpVtbl->EnumCache(
            lpOleCache,
            (LPENUMSTATDATA FAR*)&lpEnumStatData
      );
      OLEDBG_END2

      while(hrErr == NOERROR) {
         hrErr = lpEnumStatData->lpVtbl->Next(
               lpEnumStatData,
               1,
               (LPSTATDATA)&StatData,
               NULL
         );
         if (hrErr != NOERROR)
            break;              // DONE! no more caches.

         if (StatData.formatetc.dwAspect == dwOldAspect) {

            // Remove previous cache with old aspect
            OLEDBG_BEGIN2("IOleCache::Uncache called\r\n")
            lpOleCache->lpVtbl->Uncache(lpOleCache,StatData.dwConnection);
            OLEDBG_END2
         }
      }

      if (lpEnumStatData) {
         OleStdVerifyRelease(
               (LPUNKNOWN)lpEnumStatData,
               OLESTR ("OleStdSwitchDisplayAspect: Cache enumerator NOT released"));
      }
   }

   if (lpOleCache)
      OleStdRelease((LPUNKNOWN)lpOleCache);

   return NOERROR;
}

STDAPI_ ( LPOLESTR )

Definition at line 838 of file OleStd.c.

{
   LPOLESTR lpszDest = NULL;
   BOOL fMustRelease = FALSE;
   UINT lSize = OLESTRLEN(lpszSrc);

   if (! lpMalloc) {
      if (CoGetMalloc(MEMCTX_TASK, &lpMalloc) != NOERROR)
         return NULL;
      fMustRelease = TRUE;
   }

   lpszDest = lpMalloc->lpVtbl->Alloc(lpMalloc, (lSize+1)*sizeof(OLECHAR));

   if (lpszDest)
      OLESTRCPY(lpszDest, lpszSrc);

   if (fMustRelease)
      lpMalloc->lpVtbl->Release(lpMalloc);
   return lpszDest;
}

STDAPI_ ( ULONG )

Definition at line 2678 of file OleStd.c.

{
   ULONG chEaten = 0L;
   char szAnsiSrc[256], szAnsiDst[256];
   LPSTR lpszAnsiDst = szAnsiDst;
   LPSTR lpszAnsiSrc = szAnsiSrc;

   W2A (lpszSrc, szAnsiSrc, 256);

   // skip leading delimeter characters
   while (*lpszAnsiSrc && --nMaxChars > 0
                        && ((*lpszAnsiSrc=='/') || (*lpszAnsiSrc=='\\') ||
                           (*lpszAnsiSrc=='!') || (*lpszAnsiSrc==':'))) {
      *lpszAnsiSrc++;
      chEaten++;
   }

   // Extract token string (up to first delimeter char or EOS)
   while (*lpszAnsiSrc && --nMaxChars > 0
                        && !((*lpszAnsiSrc=='/') || (*lpszAnsiSrc=='\\') ||
                           (*lpszAnsiSrc=='!') || (*lpszAnsiSrc==':'))) {
      *lpszAnsiDst++ = *lpszAnsiSrc++;
      chEaten++;
   }
   *lpszAnsiDst = '\0';

   A2W (szAnsiDst, lpszDst, OLEUI_CCHPATHMAX);
   return chEaten;
}

STDAPI_ ( void )

Definition at line 2517 of file OleStd.c.

{
   LPENUMFORMATETC     lpEnumFmtEtc = NULL;
   #define FORMATETC_MAX 20
   FORMATETC           rgfmtetc[FORMATETC_MAX];
   int                 i;
   HRESULT             hrErr;
   long                j, cFetched;

   // Clear all marks
   for (i = 0; i < cEntries; i++) {
      lpPriorityList[i].dwScratchSpace = FALSE;

      if (! lpPriorityList[i].fmtetc.cfFormat) {
         // caller wants this item always considered available
         // (by specifying a NULL format)
         lpPriorityList[i].dwScratchSpace = TRUE;
      } else if (lpPriorityList[i].fmtetc.cfFormat == cfEmbeddedObject
            || lpPriorityList[i].fmtetc.cfFormat == cfEmbedSource
            || lpPriorityList[i].fmtetc.cfFormat == cfFileName) {

         // if there is an OLE object format, then handle it
         // specially by calling OleQueryCreateFromData. the caller
         // need only specify one object type format.
         OLEDBG_BEGIN2("OleQueryCreateFromData called\r\n")
         hrErr = OleQueryCreateFromData(lpSrcDataObj);
         OLEDBG_END2
         if(NOERROR == hrErr) {
            lpPriorityList[i].dwScratchSpace = TRUE;
         }
      } else if (lpPriorityList[i].fmtetc.cfFormat == cfLinkSource) {

         // if there is OLE 2.0 LinkSource format, then handle it
         // specially by calling OleQueryLinkFromData.
         OLEDBG_BEGIN2("OleQueryLinkFromData called\r\n")
         hrErr = OleQueryLinkFromData(lpSrcDataObj);
         OLEDBG_END2
         if(NOERROR == hrErr) {
            lpPriorityList[i].dwScratchSpace = TRUE;
         }
      }
   }

   OLEDBG_BEGIN2("IDataObject::EnumFormatEtc called\r\n")
   hrErr = lpSrcDataObj->lpVtbl->EnumFormatEtc(
         lpSrcDataObj,
         DATADIR_GET,
         (LPENUMFORMATETC FAR*)&lpEnumFmtEtc
   );
   OLEDBG_END2

   if (hrErr != NOERROR)
      return;    // unable to get format enumerator

   // Enumerate the formats offered by the source
   // Loop over all formats offered by the source
   cFetched = 0;
   _fmemset(rgfmtetc,0,FORMATETC_MAX*sizeof(FORMATETC));
   if (lpEnumFmtEtc->lpVtbl->Next(
         lpEnumFmtEtc, FORMATETC_MAX, rgfmtetc, &cFetched) == NOERROR
      || (cFetched > 0 && cFetched <= FORMATETC_MAX) )
   {

      for (j = 0; j < cFetched; j++)
      {
         for (i = 0; i < cEntries; i++)
         {
            if (! lpPriorityList[i].dwScratchSpace &&
               IsCloseFormatEtc(&rgfmtetc[j], &lpPriorityList[i].fmtetc))
            {
               lpPriorityList[i].dwScratchSpace = TRUE;
            }
         }
      }
   } // endif

   // Clean up
   if (lpEnumFmtEtc)
      OleStdRelease((LPUNKNOWN)lpEnumFmtEtc);
}

STDAPI_ ( int )

Definition at line 2613 of file OleStd.c.

{
   int i;
   int nFmtEtc = -1;

   // Mark all entries that the Source provides
   OleStdMarkPasteEntryList(lpSrcDataObj, lpPriorityList, cEntries);

   // Loop over the target's priority list of formats
   for (i = 0; i < cEntries; i++)
   {
      if (lpPriorityList[i].dwFlags != OLEUIPASTE_PASTEONLY &&
            !(lpPriorityList[i].dwFlags & OLEUIPASTE_PASTE))
         continue;

      // get first marked entry
      if (lpPriorityList[i].dwScratchSpace) {
         nFmtEtc = i;
         break;          // Found priority format; DONE
      }
   }

   return nFmtEtc;
}

STDAPI_ ( BOOL )

Definition at line 2935 of file OleStd.c.

{
   HRESULT hrErr;

   // make the changes permanent
   hrErr = lpStg->lpVtbl->Commit(lpStg, 0);

   if (hrErr == STG_E_MEDIUMFULL) {
      // try to commit changes in less robust manner.
      OleDbgOut("Warning: commiting with STGC_OVERWRITE specified\n");
      hrErr = lpStg->lpVtbl->Commit(lpStg, STGC_OVERWRITE);
   }

   if (hrErr != NOERROR)
   {
      char szMsg[64];

      if (0 == LoadString(ghInst, (UINT)IDS_OLESTDDISKFULL, /*(LPSTR)*/szMsg, 64))
         return FALSE;

      MessageBox(NULL, /*(LPSTR)*/szMsg, NULL, MB_ICONEXCLAMATION | MB_OK);
      return FALSE;
   }
   else {
      return TRUE;
   }
}

STDAPI_ ( LPVOID )

Definition at line 726 of file OleStd.c.

{
   LPVOID pout = NULL;
   LPMALLOC pmalloc;

   if (CoGetMalloc(MEMCTX_TASK, &pmalloc) != NOERROR) {
      OleDbgAssertSz(0, szAssertMemAlloc);
      return NULL;
   }

   if (pmalloc != NULL)
   {
       ULONG refs;
       pout = (LPVOID)pmalloc->lpVtbl->Realloc(pmalloc, pmem, ulSize);
       refs = pmalloc->lpVtbl->Release(pmalloc);
   }

   return pout;
}

STDAPI_ ( HGLOBAL )

Definition at line 1412 of file OleStd.c.

{
   CLSID              clsid;
   SIZEL              sizelHim;
   POINTL             pointl;
   LPOLESTR           lpsz, szFullUserTypeName, szSrcOfCopy, szClassName, szDocName, szItemName;
   int                nClassName, nDocName, nItemName, nFullUserTypeName;
   LPOLESTR           szBuf = NULL;
   HGLOBAL            hMem = NULL;
   HKEY               hKey = NULL;
   LPMALLOC           pIMalloc = NULL;
   DWORD              dw = OLEUI_CCHKEYMAX;
   HGLOBAL            hObjDesc;
   HRESULT            hrErr;
   char               szAnsiString[256];

   // GetData CF_OBJECTDESCRIPTOR format from the object on the clipboard.
   // Only OLE 2 objects on the clipboard will offer CF_OBJECTDESCRIPTOR
   if (hMem = OleStdGetData(
         lpDataObject,
         (CLIPFORMAT)cfObjectDescriptor,
         NULL,
         DVASPECT_CONTENT,
         lpmedium))
   {
      *lpcfFmt = cfObjectDescriptor;
      return hMem;  // Don't drop to clean up at the end of this function
   }
   // If CF_OBJECTDESCRIPTOR is not available, i.e. if this is not an OLE2 object,
   //     check if this is an OLE 1 object. OLE 1 objects will offer CF_OWNERLINK
   else if (hMem = OleStdGetData(
            lpDataObject,
            (CLIPFORMAT)cfOwnerLink,
            NULL,
            DVASPECT_CONTENT,
            lpmedium))
   {
      *lpcfFmt = cfOwnerLink;
      // CF_OWNERLINK contains null-terminated strings for class name, document name
      // and item name with two null terminating characters at the end
      szClassName = /*(LPOLESTR)*/GlobalLock(hMem);
      nClassName  = OLESTRLEN(szClassName);
      szDocName   = szClassName + nClassName + 1;
      nDocName    = OLESTRLEN(szDocName);
      szItemName  = szDocName + nDocName + 1;
      nItemName   = OLESTRLEN(szItemName);

      hrErr = CoGetMalloc(MEMCTX_TASK, &pIMalloc);
      if (hrErr != NOERROR)
         goto error;

      // Find FullUserTypeName from Registration database using class name
      if (RegOpenKey(HKEY_CLASSES_ROOT, NULL, &hKey) != ERROR_SUCCESS)
         goto error;

      // Allocate space for szFullUserTypeName & szSrcOfCopy. Maximum length of FullUserTypeName
      // is OLEUI_CCHKEYMAX. SrcOfCopy is constructed by concatenating FullUserTypeName, Document
      // Name and ItemName separated by spaces.
      szBuf = /*(LPOLESTR)*/pIMalloc->lpVtbl->Alloc(pIMalloc,
                     (DWORD)2*OLEUI_CCHKEYMAX+nDocName+nItemName+4);
      if (NULL == szBuf)
         goto error;
      szFullUserTypeName = szBuf;
      szSrcOfCopy = szFullUserTypeName+OLEUI_CCHKEYMAX+1;

      // Get FullUserTypeName
      if (RegQueryValue(hKey, NULL, szAnsiString, &dw) != ERROR_SUCCESS)
         goto error;
      A2W (szAnsiString, szFullUserTypeName, OLEUI_CCHKEYMAX);

      // Build up SrcOfCopy string from FullUserTypeName, DocumentName & ItemName
      lpsz = szSrcOfCopy;
      OLESTRCPY(lpsz, szFullUserTypeName);
      nFullUserTypeName = OLESTRLEN(szFullUserTypeName);
      lpsz[nFullUserTypeName]=' ';
      lpsz += nFullUserTypeName+1;
      OLESTRCPY(lpsz, szDocName);
      lpsz[nDocName] = ' ';
      lpsz += nDocName+1;
      OLESTRCPY(lpsz, szItemName);

      sizelHim.cx = sizelHim.cy = 0;
      pointl.x = pointl.y = 0;

      CLSIDFromProgID(szClassName, &clsid);

      hObjDesc = OleStdGetObjectDescriptorData(
            clsid,
            DVASPECT_CONTENT,
            sizelHim,
            pointl,
            0,
            szFullUserTypeName,
            szSrcOfCopy
      );
      if (!hObjDesc)
         goto error;
    }
    // Check if object is CF_FILENAME
    else if (hMem = OleStdGetData(
            lpDataObject,
            (CLIPFORMAT)cfFileName,
            NULL,
            DVASPECT_CONTENT,
            lpmedium))
    {
       *lpcfFmt = cfFileName;
       lpsz = /*(LPOLESTR)*/GlobalLock(hMem);
       hrErr = GetClassFile(lpsz, &clsid);

       /* NOTE: if the file does not have an OLE class
       **    associated, then use the OLE 1 Packager as the class of
       **    the object to be created. this is the behavior of
       **    OleCreateFromData API
       */
       if (hrErr != NOERROR)
         CLSIDFromProgID(OLESTR("Package"), &clsid);
       sizelHim.cx = sizelHim.cy = 0;
       pointl.x = pointl.y = 0;

       hrErr = CoGetMalloc(MEMCTX_TASK, &pIMalloc);
       if (hrErr != NOERROR)
         goto error;
       szBuf = /*(LPOLESTR)*/pIMalloc->lpVtbl->Alloc(pIMalloc, (DWORD)OLEUI_CCHKEYMAX);
       if (NULL == szBuf)
         goto error;

       OleStdGetUserTypeOfClass(&clsid, szBuf, OLEUI_CCHKEYMAX, NULL);

       hObjDesc = OleStdGetObjectDescriptorData(
            clsid,
            DVASPECT_CONTENT,
            sizelHim,
            pointl,
            0,
            szBuf,
            lpsz
      );
      if (!hObjDesc)
         goto error;
    }
    else goto error;

    // Clean up
    if (szBuf)
       pIMalloc->lpVtbl->Free(pIMalloc, (LPVOID)szBuf);
    if (pIMalloc)
       pIMalloc->lpVtbl->Release(pIMalloc);
    if (hMem)
    {
       GlobalUnlock(hMem);
       GlobalFree(hMem);
    }
    if (hKey)
       RegCloseKey(hKey);
    return hObjDesc;

error:
   if (szBuf)
      pIMalloc->lpVtbl->Free(pIMalloc, (LPVOID)szBuf);
   if (pIMalloc)
      pIMalloc->lpVtbl->Release(pIMalloc);
    if (hMem)
    {
       GlobalUnlock(hMem);
       GlobalFree(hMem);
    }
    if (hKey)
       RegCloseKey(hKey);
    return NULL;
}

STDAPI_ ( LPMONIKER )

Definition at line 2327 of file OleStd.c.

{
   LPMONIKER       lpmkFirst = NULL;
   LPENUMMONIKER   lpenumMoniker;
   DWORD           dwMksys;
   HRESULT         hrErr;

   if (! lpmk)
      return NULL;

   if (lpmk->lpVtbl->IsSystemMoniker(lpmk, (LPDWORD)&dwMksys) == NOERROR
      && dwMksys == MKSYS_GENERICCOMPOSITE) {

      /* NOTE: the moniker is a GenericCompositeMoniker.
      **    enumerate the moniker to pull off the first piece.
      */

      hrErr = lpmk->lpVtbl->Enum(
            lpmk,
            TRUE /* fForward */,
            (LPENUMMONIKER FAR*)&lpenumMoniker
      );
      if (hrErr != NOERROR)
         return NULL;    // ERROR: give up!

      hrErr = lpenumMoniker->lpVtbl->Next(
            lpenumMoniker,
            1,
            (LPMONIKER FAR*)&lpmkFirst,
            NULL
      );
      lpenumMoniker->lpVtbl->Release(lpenumMoniker);
      return lpmkFirst;

   } else {
      /* NOTE: the moniker is NOT a GenericCompositeMoniker.
      **    return an AddRef'ed pointer to the input moniker.
      */
      lpmk->lpVtbl->AddRef(lpmk);
      return lpmk;
   }
}

STDAPI_ ( HANDLE )

Definition at line 1744 of file OleStd.c.

{
   LPVIEWOBJECT2 lpViewObj2 = NULL;
   HDC hDC;
   HMETAFILE hmf;
   HANDLE hMetaPict;
   LPMETAFILEPICT lpPict;
   RECT rcHim;
   RECTL rclHim;
   SIZEL sizelHim;
   HRESULT hrErr;
   SIZE size;
   POINT point;

   lpViewObj2 = (LPVIEWOBJECT2)OleStdQueryInterface(
         (LPUNKNOWN)lpOleObj, &IID_IViewObject2);
   if (! lpViewObj2)
      return NULL;

   // Get SIZEL
   if (lpSizelHim) {
      // Use extents passed by the caller
      sizelHim = *lpSizelHim;
   } else {
      // Get the current extents from the object
      OLEDBG_BEGIN2("IViewObject2::GetExtent called\r\n")
      hrErr = lpViewObj2->lpVtbl->GetExtent(
            lpViewObj2,
            dwDrawAspect,
            -1,     /*lindex*/
            ptd,    /*ptd*/
            (LPSIZEL)&sizelHim
      );
      OLEDBG_END2
      if (hrErr != NOERROR)
         sizelHim.cx = sizelHim.cy = 0;
   }

   hDC = CreateMetaFile(NULL);

   rclHim.left     = 0;
   rclHim.top      = 0;
   rclHim.right    = sizelHim.cx;
   rclHim.bottom   = sizelHim.cy;

   rcHim.left      = (int)rclHim.left;
   rcHim.top       = (int)rclHim.top;
   rcHim.right     = (int)rclHim.right;
   rcHim.bottom    = (int)rclHim.bottom;

   SetWindowOrgEx(hDC, rcHim.left, rcHim.top, &point);
   SetWindowExtEx(hDC, rcHim.right-rcHim.left, rcHim.bottom-rcHim.top,&size);

   OLEDBG_BEGIN2("IViewObject::Draw called\r\n")
   hrErr = lpViewObj2->lpVtbl->Draw(
         lpViewObj2,
         dwDrawAspect,
         -1,
         NULL,
         ptd,
         NULL,
         hDC,
         (LPRECTL)&rclHim,
         (LPRECTL)&rclHim,
         NULL,
         0
   );
   OLEDBG_END2

   OleStdRelease((LPUNKNOWN)lpViewObj2);
   if (hrErr != NOERROR) {
      OleDbgOutHResult("IViewObject::Draw returned", hrErr);
      CloseMetaFile(hDC);
      return(NULL);
   }

   hmf = CloseMetaFile(hDC);

   hMetaPict = GlobalAlloc(GHND|GMEM_SHARE, sizeof(METAFILEPICT));

   if (hMetaPict && (lpPict = (LPMETAFILEPICT)GlobalLock(hMetaPict))){
      lpPict->hMF  = hmf;
      lpPict->xExt = (int)sizelHim.cx ;
      lpPict->yExt = (int)sizelHim.cy ;
      lpPict->mm   = MM_ANISOTROPIC;
      GlobalUnlock(hMetaPict);
   }

   return hMetaPict;
}

STDAPI_ ( LPSTORAGE )

Definition at line 2897 of file OleStd.c.

{
   LPSTORAGE lpChildStg;
   LPSTORAGE lpstgPriority = NULL;
   DWORD reserved = 0;
   HRESULT hrErr;

   if (lpStg  != NULL) {

      hrErr = lpStg->lpVtbl->OpenStorage(
            lpStg,
            lpszStgName,
            lpstgPriority,
            grfMode | STGM_TRANSACTED | STGM_SHARE_EXCLUSIVE,
            NULL,
            reserved,
            (LPSTORAGE FAR*)&lpChildStg
         );

      if (hrErr == NOERROR)
         return lpChildStg;

      OleDbgOutHResult("lpStg->lpVtbl->OpenStorage returned", hrErr);
   }
   return NULL;
}

STDAPI_ ( LPUNKNOWN )

Definition at line 574 of file OleStd.c.

{
   LPUNKNOWN lpInterface;
   HRESULT hrErr;

   hrErr = lpUnk->lpVtbl->QueryInterface(
         lpUnk,
         riid,
         (LPVOID FAR*)&lpInterface
   );

   if (hrErr == NOERROR)
      return lpInterface;
   else
      return NULL;
}

Generated on Wed Nov 13 2024 16:53:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/OleStd/oleutl.c File Reference

  • Com
  • Fundamentals
  • OleStd
Defines | Functions

oleutl.c File Reference

#include "olestd.h"
#include <stdlib.h>
#include <ctype.h>

Go to the source code of this file.

Defines

#define STRICT 1

Functions

STDAPI_ (void)
STDAPI_ (int)

Define Documentation

#define STRICT 1

Definition at line 32 of file oleutl.c.

Function Documentation

STDAPI_ ( void )

Definition at line 609 of file oleutl.c.

{
        int i=0;
        char szBuf[256];

        if(lpfEmbedFlag)
                *lpfEmbedFlag = FALSE;
        szFileName[0]='\0';             // NULL string

        // skip blanks
        while(isspace(*lpszLine)) lpszLine++;

        if(!*lpszLine)   // No filename or options, so start a fresh document.
                return;

        // Check for "-Embedding" or "/Embedding" and set fEmbedding.
        if(lpfEmbedFlag && (*lpszLine == '-' || *lpszLine == '/')) {
                lpszLine++;
                lpszLine = GetWord(lpszLine, szBuf);
                *lpfEmbedFlag = !lstrcmp(szBuf, EMBEDDINGFLAG);
        }

        // skip blanks
        while(isspace(*lpszLine)) lpszLine++;

        // set szFileName to argument
        while(lpszLine[i]) {
                szFileName[i]=lpszLine[i];
                i++;
        }
        szFileName[i]='\0';
}

STDAPI_ ( int )

Definition at line 303 of file oleutl.c.

        {
        int     iYppli;     //Pixels per logical inch along height
        int     iHeightInPix;
        BOOL    fSystemDC=FALSE;

        if (NULL==hDC)
                {
                hDC=GetDC(NULL);
                fSystemDC=TRUE;
                }

        iYppli = GetDeviceCaps (hDC, LOGPIXELSY);

        //* We got logical HIMETRIC along the display, convert them to pixel units
        iHeightInPix = MAP_LOGHIM_TO_PIX(iHeightInHiMetric, iYppli);

        if (fSystemDC)
                ReleaseDC(NULL, hDC);

        return iHeightInPix;
        }

Generated on Wed Nov 13 2024 16:53:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/OleStd/regdb.c File Reference

  • Com
  • Fundamentals
  • OleStd
Defines | Functions

regdb.c File Reference

#include "olestd.h"
#include "common.h"
#include <ctype.h>

Go to the source code of this file.

Defines

#define STRICT 1

Functions

STDAPI_ (CLIPFORMAT)
STDAPI_ (BOOL)
STDAPI_ (UINT)

Define Documentation

#define STRICT 1

Definition at line 15 of file regdb.c.

Function Documentation

STDAPI_ ( CLIPFORMAT )

Definition at line 358 of file regdb.c.

{
   CLIPFORMAT cfFmt = 0;
   DWORD dw;
   LONG  lRet;
   LPOLESTR lpszCLSID;
   char     lpszAnsiCLSID[256];
   BOOL  bCloseRegDB = FALSE;
   char  szKey[128];
   char  szDefaultFile[OLEUI_CCHKEYMAX];
   BOOL  bStatus = TRUE;

   if (hKey == NULL)
   {

    //Open up the root key.
    lRet=RegOpenKey(HKEY_CLASSES_ROOT, NULL, &hKey);

    if ((LONG)ERROR_SUCCESS!=lRet)
      return 0;

    bCloseRegDB = TRUE;
   }

   // Get a string containing the class name
   StringFromCLSID(rclsid, &lpszCLSID);
   W2A (lpszCLSID, lpszAnsiCLSID, 256);

   // Construct key
   wsprintf(szKey, "CLSID\\%s\\DataFormats\\DefaultFile", lpszCLSID);
   OleStdFreeString(lpszCLSID, NULL);

   dw=OLEUI_CCHKEYMAX;
   lRet = RegQueryValue(hKey, szKey, /*(LPSTR)*/szDefaultFile, (LONG FAR *)&dw);

   if ((LONG)ERROR_SUCCESS!=lRet)
      bStatus = FALSE;
   else {
      /* if the format is a number, then it should refer to one of the
      **    standard Windows formats.
      */
      if (isdigit(szDefaultFile[0]))
         cfFmt = (CLIPFORMAT)Atol(szDefaultFile);
      else
         cfFmt = RegisterClipboardFormat(szDefaultFile);
   }

   if (bCloseRegDB)
     RegCloseKey(hKey);

   return cfFmt;
}

STDAPI_ ( BOOL )

Definition at line 279 of file regdb.c.

{
   DWORD dw;
   LONG  lRet;
   LPOLESTR lpszCLSID;
   char     lpszAnsiCLSID[256];
   char  szKey[268];
   char  szMiscStatus[OLEUI_CCHKEYMAX];
   BOOL  bCloseRegDB = FALSE;

   if (hKey == NULL)
   {

    //Open up the root key.
    lRet=RegOpenKey(HKEY_CLASSES_ROOT, "CLSID", &hKey);

    if ((LONG)ERROR_SUCCESS!=lRet)
      return FALSE;

    bCloseRegDB = TRUE;
   }

   // Get a string containing the class name
   StringFromCLSID(rclsid, &lpszCLSID);
   W2A (lpszCLSID, lpszAnsiCLSID, 256);

   // Construct key
   lstrcpy(szKey, lpszAnsiCLSID);
   lstrcat(szKey, "\\MiscStatus");

   dw=OLEUI_CCHKEYMAX;
   lRet = RegQueryValue(hKey, szKey, /*(LPSTR)*/szMiscStatus, &dw);

   if ((LONG)ERROR_SUCCESS!=lRet)
   {
      OleStdFreeString(lpszCLSID, NULL);

      if (bCloseRegDB)
        RegCloseKey(hKey);

      return FALSE;

   }

   *lpdwValue = Atol(/*(LPSTR)*/szMiscStatus);

   OleStdFreeString(lpszCLSID, NULL);

   if (bCloseRegDB)
     RegCloseKey(hKey);

   return TRUE;

}

STDAPI_ ( UINT )

Definition at line 199 of file regdb.c.

{
   HKEY     hThisKey;
   BOOL     fCloseRegDB = FALSE;
   LONG     dw;
   LRESULT  lRet;
   LPOLESTR lpszCLSID;
   char     lpszAnsiCLSID[256];
   char     lpszAnsiAuxUserType[256];
   LPMALLOC lpIMalloc;
   char     szKey[OLEUI_CCHKEYMAX];
   char     szTemp[32];

   lpszAnsiAuxUserType[0] = '\0';

   if (NULL == hKey)
   {
     lRet = RegOpenKey(HKEY_CLASSES_ROOT, NULL, &hThisKey);

     if (ERROR_SUCCESS != lRet)
        return 0;
   }
   else
     hThisKey = hKey;

   StringFromCLSID(rclsid, &lpszCLSID);
   W2A (lpszCLSID, lpszAnsiCLSID, 256);

   lstrcpy(szKey, "CLSID\\");
   lstrcat(szKey, lpszAnsiCLSID);
   wsprintf(szTemp, "\\AuxUserType\\%d", wAuxUserType);
   lstrcat(szKey, szTemp);

   dw = cch;

   lRet = RegQueryValue(hThisKey, szKey, lpszAnsiAuxUserType, &dw);

   if (ERROR_SUCCESS != lRet) {
    dw = 0;
    lpszAuxUserType[0] = '\0';
   }

   if (fCloseRegDB)
     RegCloseKey(hThisKey);

   if (NOERROR == CoGetMalloc(MEMCTX_TASK, &lpIMalloc))
   {
      lpIMalloc->lpVtbl->Free(lpIMalloc, (LPVOID)lpszCLSID);
      lpIMalloc->lpVtbl->Release(lpIMalloc);
   }

   A2W (lpszAnsiAuxUserType, lpszAuxUserType, cch);
   return (UINT)dw;
}

Generated on Wed Nov 13 2024 16:53:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/OleStd/stdpal.c File Reference

  • Com
  • Fundamentals
  • OleStd
Classes | Defines | Functions

stdpal.c File Reference

#include <windows.h>
#include <olestd.h>
#include "stdpal.h"

Go to the source code of this file.

Classes

struct | LOGPAL

Defines

#define | cpeAppPal 256

Functions

STDAPI_ (HPALETTE)

Define Documentation

#define cpeAppPal 256

Definition at line 19 of file stdpal.c.

Function Documentation

STDAPI_ ( HPALETTE )

Definition at line 41 of file stdpal.c.

   {
   HDC hdc;
   HPALETTE hpal;

   hpal = (HPALETTE) NULL;
   hdc = GetDC(NULL);
   if (hdc != NULL && GetDeviceCaps(hdc, RASTERCAPS) & RC_PALETTE)
      {
      int cpeSysPal;
      int cpeReserved;

      cpeSysPal = GetDeviceCaps(hdc, SIZEPALETTE);
      cpeReserved = GetDeviceCaps(hdc, NUMRESERVED);
      if (cpeSysPal > cpeReserved)
         {
         int cpeReserved2;
         unsigned char FAR* lpb;
         PALETTEENTRY FAR* ppe;
         PALETTEENTRY FAR* ppeMac;
         LOGPAL logpal;

         cpeReserved2 = cpeReserved/2;

         // Get the system palette entries at the beginning and end.
         GetSystemPaletteEntries(hdc, 0, cpeReserved2, logpal.rgpe);
         GetSystemPaletteEntries(hdc, cpeSysPal - cpeReserved2, cpeReserved2,
            &logpal.rgpe[cpeAppPal-cpeReserved2]);

         logpal.cpe = cpeAppPal;
         logpal.wVersion = 0x300;

         lpb = (BYTE FAR *) &palSVGA[10];
         ppe = (PALETTEENTRY FAR*)&logpal.rgpe[cpeReserved2];
         ppeMac = (PALETTEENTRY FAR*)&logpal.rgpe[cpeAppPal-cpeReserved2];
         while (ppe < ppeMac)
            {
            ppe->peFlags = PC_NOCOLLAPSE;
            ppe->peRed   = *lpb++;
            ppe->peGreen = *lpb++;
            ppe->peBlue  = *lpb++;
            ppe++;
            }
         hpal = CreatePalette((LOGPALETTE FAR *)&logpal);
         }
      }
   ReleaseDC(NULL, hdc);
   return hpal;
   }

Generated on Wed Nov 13 2024 16:53:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/OleStd/stdpal.h File Reference

  • Com
  • Fundamentals
  • OleStd
Defines | Functions

stdpal.h File Reference

Go to the source code of this file.

Defines

#define CSCONST(type) type _based(_segname("_CODE")) const

Functions

CSCONST (unsigned char) palSVGA[256][3]

Define Documentation

#define CSCONST ( type ) type _based(_segname("_CODE")) const

Definition at line 19 of file stdpal.h.

Function Documentation

CSCONST ( unsigned char )
Generated on Wed Nov 13 2024 16:53:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/OleStd/suminfo.Cpp File Reference

  • Com
  • Fundamentals
  • OleStd
Classes | Defines | Typedefs | Functions | Variables

suminfo.Cpp File Reference

#include <string.h>
#include <windows.h>
#include <ole2.h>
#include "ansiapi.h"
#include "suminfo.h"
#include "wn_dos.h"

Go to the source code of this file.

Classes

union | _foo
struct | _RSUMINFO

Defines

#define | ASSERT(x)
#define | BF unsigned int
#define | BOOL unsigned char
#define | BYTE unsigned char
#define | CHAR unsigned char
#define | DWORD unsigned long
#define | fFalse 0
#define | fTrue 1
#define | LPVOID void FAR *
#define | STRICT
#define | uchar unsigned char
#define | ulong unsigned long
#define | WORD unsigned short

Typedefs

typedef union _foo | Foo
typedef RSUMINFO FAR * | LPRSI
typedef struct _RSUMINFO | RSUMINFO

Functions

for (i=0;i< MAXSTDZ;i++)
if (lpSSIM->thumb.vtType==VT_EMPTY) k
if (m!=0)
if (s!=0)
if (lpSSIM->thumb.lpstzName!=NULL) s
if (FAILED(sc)) return 0
if (FAILED(sc)||cbWritten!=cbNewSummaryInfo(1)) return 0
LISet32 (a, 0)
setStandard (lpSumInfo)
STDAPI_ (void) OleStdFreeSummaryInfo(LPSUMINFO FAR *lplp)
STDAPI_ (DWORD) OleStdGetSecurityProperty(LPSUMINFO lp)
STDAPI_ (int) OleStdWriteSummaryInfo(LPSTREAM lpStream
STDAPI_ (LPSUMINFO) OleStdInitSummaryInfo(int reserved)

Variables

fail | __pad0__
LARGE_INTEGER | a
ULARGE_INTEGER | b
lpSSIM rgPropId[PIDSI_EDITTIME-2] | byteOffset = oBytes
ULONG cbWritten
ULONG | cBytes = cbNewSection(cPIDSI_STANDARD)+(sizeof(TIME)*MAXTIME)+(sizeof(INTS)*MAXINTS)
int | i
int | j
ULONG | k = VT_EMPTY
ULONG | l = 0
LPMETAFILEPICT | lpmfp
LPOLESTR lps
LPSUMINFO lp STANDARDSECINMEM FAR * | lpSSIM = (STANDARDSECINMEM FAR*)&((LPRSI)lp)->section
LPRSI lpSumInfo = (LPRSI)lp
ULONG m = lpSSIM->thumb.cBytes
ULONG n
ULONG | oBytes = cbNewSection(cPIDSI_STANDARD)
return
int | s = 0
SCODE | sc = GetScode(lpStream->Seek(a, STREAM_SEEK_SET, &b))
lpSSIM thumb | selector = n

Define Documentation

#define ASSERT ( x )

Definition at line 113 of file suminfo.Cpp.

#define BF unsigned int

Definition at line 104 of file suminfo.Cpp.

#define BOOL unsigned char

Definition at line 103 of file suminfo.Cpp.

#define BYTE unsigned char

Definition at line 97 of file suminfo.Cpp.

#define CHAR unsigned char

Definition at line 94 of file suminfo.Cpp.

typedef DWORD unsigned long

Definition at line 99 of file suminfo.Cpp.

#define fFalse 0

Definition at line 96 of file suminfo.Cpp.

#define fTrue 1

Definition at line 95 of file suminfo.Cpp.

#define LPVOID void FAR *

Definition at line 100 of file suminfo.Cpp.

#define STRICT

Definition at line 24 of file suminfo.Cpp.

#define uchar unsigned char

Definition at line 101 of file suminfo.Cpp.

#define ulong unsigned long

Definition at line 102 of file suminfo.Cpp.

#define WORD unsigned short

Definition at line 98 of file suminfo.Cpp.

Typedef Documentation

typedef union _foo Foo
typedef RSUMINFO FAR* LPRSI

Definition at line 130 of file suminfo.Cpp.

typedef struct _RSUMINFO RSUMINFO

Function Documentation

for ( )

Definition at line 632 of file suminfo.Cpp.

                             {
      if (lpSSIM->rglpsz[i]!=NULL) {
         l = lpSSIM->rglpsz[i]->vtByteCount;
         j = ((((int)l+4-1)/4)*4)+sizeof(DWORD)*2;
         sc = GetScode(lpStream->Write(lpSSIM->rglpsz[i], j, &cbWritten));
         if (FAILED(sc)||cbWritten!=(ULONG)j) return 0;
         lpSSIM->rglpsz[i]->vtByteCount = 0; //restore stz count convention
         lpSSIM->rglpsz[i]->VTCB = (int)l;
      } else {
         sc = GetScode(lpStream->Write(&k, sizeof(DWORD), &cbWritten));
         if (FAILED(sc)||cbWritten!=sizeof(DWORD)) return 0;
      }
   }

if ( lpSSIM->thumb. vtType = =VT_EMPTY )
if ( m! = 0 )

Definition at line 649 of file suminfo.Cpp.

                                         { //bytes are in global memory
      GlobalUnlock((HANDLE)(DWORD)lps);
   }

if ( s! = 0 )

Definition at line 610 of file suminfo.Cpp.

             {
      k = ((s+1+4-1)>>2)<<2;
      sc = GetScode(lpStream->Write(lpSSIM->thumb.lpstzName+1, k, &cbWritten));
      if (FAILED(sc)||cbWritten!=k) goto fail;
   }

if ( lpSSIM->thumb.lpstzName! = NULL )
if ( FAILED(sc) )
if ( FAILED(sc)||cbWritten! = cbNewSummaryInfo(1) )
LISet32 | ( | a | ,
 |  | 0 |
 | ) |  |
setStandard ( lpSumInfo )
STDAPI_ ( void )

Definition at line 327 of file suminfo.Cpp.

{
   OleStdSetStringProperty(lp, PIDSI_TITLE, NULL);
   OleStdSetStringProperty(lp, PIDSI_SUBJECT, NULL);
   OleStdSetStringProperty(lp, PIDSI_AUTHOR, NULL);
   OleStdSetStringProperty(lp, PIDSI_KEYWORDS, NULL);
   OleStdSetStringProperty(lp, PIDSI_COMMENTS, NULL);
   OleStdSetStringProperty(lp, PIDSI_TEMPLATE, NULL);
   OleStdSetStringProperty(lp, PIDSI_REVNUMBER, NULL);
   OleStdSetStringProperty(lp, PIDSI_APPNAME, NULL);
   OleStdSetThumbNailProperty(NULL, lp, VT_CF_EMPTY, 0, NULL, NULL, 0);
   ClearSumInf((LPRSI)lp, sizeof(RSUMINFO));
}

STDAPI_ ( DWORD )

Definition at line 686 of file suminfo.Cpp.

{
STANDARDSECINMEM FAR *lpSSIM=(STANDARDSECINMEM FAR*)&((LPRSI)lp)->section;
   if (lpSSIM->rgInts[3].vtType == VT_I4) return lpSSIM->rgInts[3].value;
   return 0;
}

STDAPI_ ( int )
STDAPI_ ( LPSUMINFO )

Definition at line 261 of file suminfo.Cpp.

{
   LPRSI lprsi;

   if ((lprsi = (LPRSI)MemAlloc(sizeof(RSUMINFO))) != NULL)
   {
      ClearSumInf(lprsi, sizeof(RSUMINFO));
   } else return NULL;

   setStandard(lprsi);
   return (LPSUMINFO)lprsi;
}

Variable Documentation

fail __pad0__

Definition at line 647 of file suminfo.Cpp.

LARGE_INTEGER a

Definition at line 533 of file suminfo.Cpp.

ULARGE_INTEGER b

Definition at line 534 of file suminfo.Cpp.

lpSSIM rgPropId [PIDSI_THUMBNAIL-2] byteOffset = oBytes

Definition at line 543 of file suminfo.Cpp.

ULONG cbWritten

Definition at line 531 of file suminfo.Cpp.

lpSSIM thumb cBytes = cbNewSection(cPIDSI_STANDARD)+(sizeof(TIME)*MAXTIME)+(sizeof(INTS)*MAXINTS)

Definition at line 532 of file suminfo.Cpp.

int i

Definition at line 537 of file suminfo.Cpp.

int j

Definition at line 537 of file suminfo.Cpp.

k = VT_EMPTY

Definition at line 532 of file suminfo.Cpp.

l = 0

Definition at line 532 of file suminfo.Cpp.

LPMETAFILEPICT lpmfp

Definition at line 536 of file suminfo.Cpp.

LPOLESTR lps

Definition at line 535 of file suminfo.Cpp.

LPSUMINFO lp STANDARDSECINMEM FAR* lpSSIM = (STANDARDSECINMEM FAR*)&((LPRSI)lp)->section

Definition at line 525 of file suminfo.Cpp.

LPRSI lpSumInfo = (LPRSI)lp

Definition at line 529 of file suminfo.Cpp.

m = lpSSIM->thumb.cBytes

Definition at line 532 of file suminfo.Cpp.

ULONG n

Definition at line 532 of file suminfo.Cpp.

oBytes = cbNewSection(cPIDSI_STANDARD)

Definition at line 532 of file suminfo.Cpp.

return

Definition at line 645 of file suminfo.Cpp.

else s = 0

Definition at line 537 of file suminfo.Cpp.

sc = GetScode(lpStream->Seek(a, STREAM_SEEK_SET, &b))

Definition at line 530 of file suminfo.Cpp.

lpSSIM thumb selector = n

Definition at line 629 of file suminfo.Cpp.

Generated on Wed Nov 13 2024 16:53:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/OleStd/suminfo.h File Reference

  • Com
  • Fundamentals
  • OleStd
Classes | Defines | Typedefs | Functions | Variables

suminfo.h File Reference

#include <ole2.h>
#include <oleauto.h>

Go to the source code of this file.

Classes

struct | _INTS
struct | _PROPIDLIST
struct | _PROPSETLIST
struct | _PROPVALUE
struct | _SECTION
struct | _STANDARDSECINMEM
struct | _STDZ
struct | _SUMMARYINFO
struct | _THUMB
struct | _TIME
union | VTUNION

Defines

#define | AllSecurityFlagsEqNone 0
#define | API __far __pascal
#define | cbNewSection(nPropIds) (sizeof(SECTION)-sizeof(PROPVALUE)+sizeof(PROPIDLIST)*((nPropIds)-1))
#define | cbNewSummaryInfo(nSection) (sizeof(SUMMARYINFO)-sizeof(SECTION)+sizeof(PROPSETLIST)*((nSection)-1))
#define | ClearSumInf(lpsuminf, cb)
#define | cPIDSI_STANDARD (PIDSI_DOC_SECURITY+1-2)
#define | FEqSumInfFMTID(fmtId)
#define | FIntelOrder(prop) ((prop)->byteOrder==0xfffe)
#define | fSecurityLockedForAnnotations 8
#define | fSecurityPassworded 1
#define | fSecurityRO 4
#define | fSecurityRORecommended 2
#define | FSzEqPropStreamName(sz) _fstricmp(sz, PropStreamName)
#define | MAXINTS (PIDSI_CHARCOUNT-PIDSI_PAGECOUNT+1+1)
#define | MAXSTDZ (PIDSI_REVNUMBER-PIDSI_TITLE+1+1)
#define | MAXTIME (PIDSI_LASTSAVE_DTM-PIDSI_EDITTIME+1)
#define | MAXWORD 256
#define | OFFSET_NIL 0X00000000
#define | osMac 1
#define | osWinNT 2
#define | osWinOnDos 0
#define | PropStreamName "\005SummaryInformation"
#define | PropStreamNamePrefixByte '\005'
#define | SetOs(prop, os) {(prop)->osVersion=os; (prop)->getOSVersion=LOWORD(GetVersion());}
#define | SetSumInfFMTID(fmtId)
#define | VT_CF_BYTES 0
#define | VT_CF_EMPTY (-5)
#define | VT_CF_FMTID (-3)
#define | VT_CF_MAC (-2)
#define | VT_CF_NAME (-4)
#define | VT_CF_OOM (-6)
#define | VT_CF_WIN (-1)
#define | VTCB fill[3]
#define | WORDMAX 256

Typedefs

typedef struct _INTS | INTS
typedef STDZ FAR * | LPSTDZ
typedef LPSTR | LPSTZR
typedef void FAR * | LPSUMINFO
typedef THUMB FAR * | LPTHUMB
typedef struct _PROPIDLIST | PROPIDLIST
typedef struct _PROPSETLIST | PROPSETLIST
typedef struct _PROPVALUE | PROPVALUE
typedef struct _SECTION | SECTION
typedef struct _STANDARDSECINMEM | STANDARDSECINMEM
typedef struct _STDZ | STDZ
typedef struct _SUMMARYINFO | SUMMARYINFO
typedef struct _THUMB | THUMB
typedef void FAR * | THUMBNAIL
typedef struct _TIME | TIME

Functions

STDAPI_ (LPSUMINFO) OleStdInitSummaryInfo(int reserved)
STDAPI_ (LPSTZR) OleStdGetStringZProperty(LPSUMINFO lp
STDAPI_ (LPSTR) OleStdGetStringProperty(LPSUMINFO lp
STDAPI_ (DWORD) OleStdGetSecurityProperty(LPSUMINFO lp)
STDAPI_ (int) OleStdReadSummaryInfo(LPSTREAM lpStream
STDAPI_ (void) OleStdFreeSummaryInfo(LPSUMINFO FAR *lplp)

Variables

LPSUMINFO DWORD FAR LPOLESTR
FAR THUMBNAIL FAR DWORD FAR * 		byteCount
LPSUMINFO DWORD FAR LPOLESTR
FAR THUMBNAIL FAR * 		clip
LPSUMINFO DWORD FAR * | clipFormatNo
DWORD int FAR int FAR int FAR * | dy
DWORD int int int int | hr
LPSUMINFO lp
DWORD LPOLESTR lpsz
LPSUMINFO DWORD FAR LPOLESTR FAR * | lpszName
DWORD int int int int int | mn
DWORD int FAR int FAR * | mo
DWORD FAR DWORD FAR DWORD FAR * | nChars
DWORD FAR * | nPage
DWORD FAR DWORD FAR * | nWords
DWORD pid
DWORD int FAR int FAR int FAR
DWORD FAR * 		sc
DWORD security
LPSUMINFO DWORD FAR LPOLESTR
FAR THUMBNAIL FAR DWORD FAR
BOOL 		transferClip
LPSUMINFO int | vtcfNo
DWORD int FAR * | yr

Define Documentation

#define AllSecurityFlagsEqNone 0

Definition at line 198 of file suminfo.h.

#define API __far __pascal

Definition at line 222 of file suminfo.h.

#define cbNewSection ( nPropIds ) (sizeof(SECTION)-sizeof(PROPVALUE)+sizeof(PROPIDLIST)*((nPropIds)-1))

Definition at line 207 of file suminfo.h.

#define cbNewSummaryInfo ( nSection ) (sizeof(SUMMARYINFO)-sizeof(SECTION)+sizeof(PROPSETLIST)*((nSection)-1))

Definition at line 206 of file suminfo.h.

#define ClearSumInf | ( | lpsuminf,
 |  | cb
 | ) |
Value:
{_fmemset(lpsuminf,0,cb); (lpsuminf)->byteOrder=0xfffe;\
            SetOs(lpsuminf, osWinOnDos);}

Definition at line 216 of file suminfo.h.

#define cPIDSI_STANDARD (PIDSI_DOC_SECURITY+1-2)

Definition at line 130 of file suminfo.h.

#define FEqSumInfFMTID ( fmtId )
Value:
((fmtId)->dword==0XF29F85E0&&*((long FAR *)&(fmtId)->words)==0X10684FF9&&\
            *((long FAR *)&(fmtId)->bytes[0])==0X000891AB&&*((long FAR *)&(fmtId)->bytes[4])==0XD9B3272B)

Definition at line 213 of file suminfo.h.

#define FIntelOrder ( prop ) ((prop)->byteOrder==0xfffe)

Definition at line 209 of file suminfo.h.

#define fSecurityLockedForAnnotations 8

Definition at line 202 of file suminfo.h.

#define fSecurityPassworded 1

Definition at line 199 of file suminfo.h.

#define fSecurityRO 4

Definition at line 201 of file suminfo.h.

#define fSecurityRORecommended 2

Definition at line 200 of file suminfo.h.

#define FSzEqPropStreamName ( sz ) _fstricmp(sz, PropStreamName)

Definition at line 215 of file suminfo.h.

#define MAXINTS (PIDSI_CHARCOUNT-PIDSI_PAGECOUNT+1+1)

Definition at line 181 of file suminfo.h.

#define MAXSTDZ (PIDSI_REVNUMBER-PIDSI_TITLE+1+1)

Definition at line 182 of file suminfo.h.

#define MAXTIME (PIDSI_LASTSAVE_DTM-PIDSI_EDITTIME+1)

Definition at line 180 of file suminfo.h.

#define MAXWORD 256

Definition at line 133 of file suminfo.h.

#define OFFSET_NIL 0X00000000

Definition at line 196 of file suminfo.h.

#define osMac 1

Definition at line 127 of file suminfo.h.

#define osWinNT 2

Definition at line 128 of file suminfo.h.

#define osWinOnDos 0

Definition at line 126 of file suminfo.h.

#define PropStreamName "\005SummaryInformation"

Definition at line 205 of file suminfo.h.

#define PropStreamNamePrefixByte '\005'

Definition at line 204 of file suminfo.h.

#define SetOs | ( | prop,
 |  | os |
 | ) |  | {(prop)->osVersion=os; (prop)->getOSVersion=LOWORD(GetVersion());}

Definition at line 210 of file suminfo.h.

#define SetSumInfFMTID ( fmtId )
Value:
{(fmtId)->Data1=0XF29F85E0; *(long FAR *)&(fmtId)->Data2=0X10684FF9;\
            *(long FAR *)&(fmtId)->Data4[0]=0X000891AB; *(long FAR *)&(fmtId)->Data4[4]=0XD9B3272B;}

Definition at line 211 of file suminfo.h.

#define VT_CF_BYTES 0

Definition at line 157 of file suminfo.h.

#define VT_CF_EMPTY (-5)

Definition at line 162 of file suminfo.h.

#define VT_CF_FMTID (-3)

Definition at line 160 of file suminfo.h.

#define VT_CF_MAC (-2)

Definition at line 159 of file suminfo.h.

#define VT_CF_NAME (-4)

Definition at line 161 of file suminfo.h.

#define VT_CF_OOM (-6)

Definition at line 163 of file suminfo.h.

#define VT_CF_WIN (-1)

Definition at line 158 of file suminfo.h.

#define VTCB fill[3]

Definition at line 145 of file suminfo.h.

#define WORDMAX 256

Definition at line 75 of file suminfo.h.

Typedef Documentation

typedef struct _INTS INTS
typedef STDZ FAR* LPSTDZ

Definition at line 166 of file suminfo.h.

typedef LPSTR LPSTZR

Definition at line 220 of file suminfo.h.

typedef void FAR* LPSUMINFO

Definition at line 219 of file suminfo.h.

typedef THUMB FAR* LPTHUMB

Definition at line 164 of file suminfo.h.

typedef struct _PROPIDLIST PROPIDLIST
typedef struct _PROPSETLIST PROPSETLIST
typedef struct _PROPVALUE PROPVALUE
typedef struct _SECTION SECTION
typedef struct _STANDARDSECINMEM STANDARDSECINMEM
typedef struct _STDZ STDZ
typedef struct _SUMMARYINFO SUMMARYINFO
typedef struct _THUMB THUMB
typedef void FAR* THUMBNAIL

Definition at line 221 of file suminfo.h.

typedef struct _TIME TIME

Function Documentation

STDAPI_ ( LPSUMINFO )

Definition at line 261 of file suminfo.Cpp.

{
   LPRSI lprsi;

   if ((lprsi = (LPRSI)MemAlloc(sizeof(RSUMINFO))) != NULL)
   {
      ClearSumInf(lprsi, sizeof(RSUMINFO));
   } else return NULL;

   setStandard(lprsi);
   return (LPSUMINFO)lprsi;
}

STDAPI_ ( LPSTZR )
STDAPI_ ( LPSTR )
STDAPI_ ( DWORD )

Definition at line 267 of file msgfiltr.c.

{
   LPOLESTDMESSAGEFILTER lpStdMsgFilter = (LPOLESTDMESSAGEFILTER)lpThis;
   DWORD dwReturn;

   if (!IsBadReadPtr((LPVOID)lpStdMsgFilter,  sizeof(OLESTDMESSAGEFILTER)))
      dwReturn = lpStdMsgFilter->m_dwInComingCallStatus;
   else
      {
      OleDbgAssert(
         "OleStdMsgFilter_GetIncomingCallStatus: Invalid IMessageFilter*");
      dwReturn = (DWORD)-1;
      }

#if defined( _DEBUG )
   {
   char szBuf[80];
   char *szReturn;

   switch(dwReturn) {
      case SERVERCALL_ISHANDLED:
         szReturn = "SERVERCALL_ISHANDLED";
         break;
      case SERVERCALL_REJECTED:
         szReturn = "SERVERCALL_REJECTED";
         break;
      case SERVERCALL_RETRYLATER:
         szReturn = "SERVERCALL_RETRYLATER";
         break;
      default:
         szReturn = "-1";
         break;
      }
   wsprintf(
      szBuf,
      "OleStdMsgFilter_GetInComingCallStatus returns %s.\r\n",
      /*(LPSTR)*/szReturn
   );
   OleDbgOut3(szBuf);
   }
#endif

   return dwReturn;
}

STDAPI_ ( int )
STDAPI_ ( void )

Variable Documentation

LPSUMINFO int DWORD LPOLESTR THUMBNAIL DWORD byteCount

Definition at line 254 of file suminfo.h.

LPSUMINFO int DWORD LPOLESTR THUMBNAIL clip

Definition at line 254 of file suminfo.h.

LPSUMINFO int DWORD clipFormatNo

Definition at line 254 of file suminfo.h.

DWORD int int int dy

Definition at line 272 of file suminfo.h.

DWORD int int int int hr

Definition at line 280 of file suminfo.h.

LPSUMINFO lp

Definition at line 233 of file suminfo.h.

DWORD LPOLESTR lpsz

Definition at line 238 of file suminfo.h.

LPSUMINFO int DWORD LPOLESTR lpszName

Definition at line 254 of file suminfo.h.

DWORD int int int int int mn

Definition at line 280 of file suminfo.h.

DWORD int int mo

Definition at line 272 of file suminfo.h.

DWORD DWORD DWORD nChars

Definition at line 242 of file suminfo.h.

DWORD nPage

Definition at line 242 of file suminfo.h.

DWORD DWORD nWords

Definition at line 242 of file suminfo.h.

DWORD pid

Definition at line 237 of file suminfo.h.

DWORD int int int int int int sc

Definition at line 272 of file suminfo.h.

DWORD security

Definition at line 236 of file suminfo.h.

LPSUMINFO DWORD FAR LPOLESTR FAR THUMBNAIL FAR DWORD FAR BOOL transferClip

Definition at line 254 of file suminfo.h.

LPSUMINFO int vtcfNo

Definition at line 263 of file suminfo.h.

DWORD int yr

Definition at line 272 of file suminfo.h.

Generated on Wed Nov 13 2024 16:53:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/OleStd/targtdev.c File Reference

  • Com
  • Fundamentals
  • OleStd
Defines | Functions

targtdev.c File Reference

#include "olestd.h"
#include <print.h>

Go to the source code of this file.

Defines

#define STRICT 1

Functions

STDAPI_ (HDC)
STDAPI_ (int)
STDAPI_ (BOOL)
STDAPI_ (DVTARGETDEVICE FAR *)

Define Documentation

#define STRICT 1

Definition at line 14 of file targtdev.c.

Function Documentation

STDAPI_ ( HDC )

Definition at line 76 of file targtdev.c.

{
        HDC hdcIC=NULL;
        LPDEVNAMES lpDevNames;
        LPDEVMODE lpDevMode;
        LPSTR lpszDriverName;
        LPSTR lpszDeviceName;
        LPSTR lpszPortName;

        if (ptd == NULL) {
                hdcIC = CreateIC("DISPLAY", NULL, NULL, NULL);
                goto errReturn;
        }

        lpDevNames = (LPDEVNAMES) ptd; // offset for size field

        lpDevMode  = (LPDEVMODE) (/*(LPSTR)*/ptd + ptd->tdExtDevmodeOffset);

        lpszDriverName = (LPSTR) lpDevNames + ptd->tdDriverNameOffset;
        lpszDeviceName = (LPSTR) lpDevNames + ptd->tdDeviceNameOffset;
        lpszPortName   = (LPSTR) lpDevNames + ptd->tdPortNameOffset;

        hdcIC = CreateIC(lpszDriverName, lpszDeviceName, lpszPortName, lpDevMode);

errReturn:
        return hdcIC;
}

STDAPI_ ( int )

Definition at line 271 of file targtdev.c.

{
        BOOL bExact = TRUE;

        if (pFetcLeft->cfFormat != pFetcRight->cfFormat)
                return 1;
        else if (!OleStdCompareTargetDevice (pFetcLeft->ptd, pFetcRight->ptd))
                return 1;
        if (pFetcLeft->dwAspect == pFetcRight->dwAspect)
                // same aspects; equal
                ;
        else if ((pFetcLeft->dwAspect & ~pFetcRight->dwAspect) != 0)
                // left not subset of aspects of right; not equal
                return 1;
        else
                // left subset of right
                bExact = FALSE;

        if (pFetcLeft->tymed == pFetcRight->tymed)
                // same medium flags; equal
                ;
        else if ((pFetcLeft->tymed & ~pFetcRight->tymed) != 0)
                // left not subset of medium flags of right; not equal
                return 1;
        else
                // left subset of right
                bExact = FALSE;

        return bExact ? 0 : -1;
}

STDAPI_ ( BOOL )

Definition at line 304 of file targtdev.c.

{
        if (ptdLeft == ptdRight)
                // same address of td; must be same (handles NULL case)
                return TRUE;
        else if ((ptdRight == NULL) || (ptdLeft == NULL))
                return FALSE;
        else if (ptdLeft->tdSize != ptdRight->tdSize)
                // different sizes, not equal
                return FALSE;
#ifdef WIN32
        else if (memcmp(ptdLeft, ptdRight, ptdLeft->tdSize) != 0)
#else
        else if (_fmemcmp(ptdLeft, ptdRight, (int)ptdLeft->tdSize) != 0)
#endif
                // not same target device, not equal
                return FALSE;

        return TRUE;
}

STDAPI_ ( DVTARGETDEVICE FAR * )

Definition at line 211 of file targtdev.c.

{
  DVTARGETDEVICE FAR* ptdDest = NULL;

  if (ptdSrc == NULL) {
        return NULL;
  }

  if ((ptdDest = (DVTARGETDEVICE FAR*)OleStdMalloc(ptdSrc->tdSize)) != NULL) {
        _fmemcpy(ptdDest, ptdSrc, (size_t)ptdSrc->tdSize);
  }

  return ptdDest;
}

Generated on Wed Nov 13 2024 16:53:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/OleStd/Utility.c File Reference

  • Com
  • Fundamentals
  • OleStd
Defines | Functions

Utility.c File Reference

#include "olestd.h"
#include <stdlib.h>
#include <commdlg.h>
#include <memory.h>
#include <cderr.h>
#include "common.h"
#include "utility.h"

Go to the source code of this file.

Defines

#define | chPeriod '.'
#define | chSpace ' '
#define | PARSE_DIRECTORYNAME -10
#define | PARSE_EMPTYSTRING -1
#define | PARSE_EXTENTIONTOOLONG -9
#define | PARSE_FILETOOLONG -11
#define | PARSE_INVALIDCHAR -5
#define | PARSE_INVALIDDIRCHAR -4
#define | PARSE_INVALIDDRIVE -2
#define | PARSE_INVALIDNETPATH -7
#define | PARSE_INVALIDPERIOD -3
#define | PARSE_INVALIDSPACE -8
#define | PARSE_WILDCARDINDIR -6
#define | PREFIX_FORMAT "%c%c%c...\\"
#define | PREFIX_SIZE 7 + 1
#define | STRICT 1

Functions

BOOL WINAPI | Browse (HWND hWndOwner, LPSTR lpszFile, LPSTR lpszInitialDir, UINT cchFile, UINT iFilterString, DWORD dwOfnFlags)
LPSTR WINAPI | ChopText (HWND hWnd, int nWidth, LPSTR lpch)
HFILE WINAPI | DoesFileExist (LPSTR lpszFile, OFSTRUCT FAR *lpOpenBuf)
int WINAPI | ErrorWithFile (HWND hWnd, HINSTANCE hInst, UINT idsErr, LPSTR pszFile, UINT uFlags)
BOOL WINAPI | FServerFromClass (LPSTR pszClass, LPSTR pszEXE, UINT cch)
HICON WINAPI | HIconFromClass (LPSTR pszClass)
void WINAPI | HourGlassOff (HCURSOR hCur)
OLEDBGDATA HCURSOR WINAPI | HourGlassOn (void)
void WINAPI | OpenFileError (HWND hDlg, UINT nErrCode, LPSTR lpszFile)
int WINAPI | ReplaceCharWithNull (LPSTR psz, int ch)
UINT WINAPI | UClassFromDescription (LPSTR psz, LPSTR pszClass, UINT cb)
UINT WINAPI | UDescriptionFromClass (LPSTR pszClass, LPSTR psz, UINT cb)

Define Documentation

#define chPeriod '.'

Definition at line 693 of file Utility.c.

#define chSpace ' '

Definition at line 692 of file Utility.c.

#define PARSE_DIRECTORYNAME -10

Definition at line 703 of file Utility.c.

#define PARSE_EMPTYSTRING -1

Definition at line 694 of file Utility.c.

#define PARSE_EXTENTIONTOOLONG -9

Definition at line 702 of file Utility.c.

#define PARSE_FILETOOLONG -11

Definition at line 704 of file Utility.c.

#define PARSE_INVALIDCHAR -5

Definition at line 698 of file Utility.c.

#define PARSE_INVALIDDIRCHAR -4

Definition at line 697 of file Utility.c.

#define PARSE_INVALIDDRIVE -2

Definition at line 695 of file Utility.c.

#define PARSE_INVALIDNETPATH -7

Definition at line 700 of file Utility.c.

#define PARSE_INVALIDPERIOD -3

Definition at line 696 of file Utility.c.

#define PARSE_INVALIDSPACE -8

Definition at line 701 of file Utility.c.

#define PARSE_WILDCARDINDIR -6

Definition at line 699 of file Utility.c.

#define PREFIX_FORMAT "%c%c%c...\\"
#define PREFIX_SIZE 7 + 1
#define STRICT 1

Definition at line 32 of file Utility.c.

Function Documentation

BOOL WINAPI Browse | ( | HWND | hWndOwner,
 |  | LPSTR | lpszFile,
 |  | LPSTR | lpszInitialDir,
 |  | UINT | cchFile,
 |  | UINT | iFilterString,
 |  | DWORD | dwOfnFlags
 | ) |  |

Definition at line 123 of file Utility.c.

   {
      UINT           cch;
      char           szFilters[256];
      OPENFILENAME   ofn;
      BOOL           fStatus;
      DWORD          dwError;
      char            szDlgTitle[128];  // that should be big enough
#if !defined( LINK_COMMDLG )
      HINSTANCE hinstCommDlg = NULL;
      typedef BOOL (WINAPI* LPFNGETOPENFILENAME) (OPENFILENAME FAR*);
      LPFNGETOPENFILENAME lpfnGetOpenFileName;
      typedef DWORD (WINAPI* LPFNCOMMDLGEXTENDEDERROR) (void);
      LPFNCOMMDLGEXTENDEDERROR lpfnCommDlgExtendedError;
#endif

   if (NULL==lpszFile || 0==cchFile)
      return FALSE;

   /*
    * REVIEW:  Exact contents of the filter combobox is TBD.  One idea
    * is to take all the extensions in the RegDB and place them in here
    * with the descriptive class name associate with them.  This has the
    * extra step of finding all extensions of the same class handler and
    * building one extension string for all of them.  Can get messy quick.
    * UI demo has only *.* which we do for now.
    */

   if (0!=iFilterString)
      cch=LoadString(ghInst, iFilterString, /*(LPSTR)*/szFilters, sizeof(szFilters));
   else
      {
      szFilters[0]=0;
      cch=1;
      }

   if (0==cch)
      return FALSE;

   ReplaceCharWithNull(szFilters, szFilters[cch-1]);

   //Prior string must also be initialized, if there is one.
   _fmemset((LPOPENFILENAME)&ofn, 0, sizeof(ofn));
   ofn.lStructSize =sizeof(ofn);
   ofn.hwndOwner   =hWndOwner;
   ofn.lpstrFile   =lpszFile;
   ofn.nMaxFile    =cchFile;
   ofn.lpstrFilter =/*(LPSTR)*/szFilters;
   ofn.nFilterIndex=1;
   if (LoadString(ghInst, (UINT)IDS_BROWSE, /*(LPSTR)*/szDlgTitle, sizeof(szDlgTitle)))
      ofn.lpstrTitle  =/*(LPSTR)*/szDlgTitle;
   ofn.hInstance = ghInst;
   ofn.lpTemplateName = MAKEINTRESOURCE(IDD_FILEOPEN);
   if (NULL != lpszInitialDir)
     ofn.lpstrInitialDir = lpszInitialDir;

   ofn.Flags= OFN_HIDEREADONLY | OFN_ENABLETEMPLATE | (dwOfnFlags) ;

#if !defined( LINK_COMMDLG )
   // Load the COMMDLG.DLL library module
   hinstCommDlg = LoadLibrary("COMMDLG.DLL");
   if (hinstCommDlg <= HINSTANCE_ERROR)   /* load failed */
      return FALSE;

   // Retrieve the address of required functions
   lpfnGetOpenFileName = (LPFNGETOPENFILENAME)
         GetProcAddress(hinstCommDlg, "GetOpenFileName");
   lpfnCommDlgExtendedError = (LPFNCOMMDLGEXTENDEDERROR)
         GetProcAddress(hinstCommDlg, "CommDlgExtendedError");

   if (lpfnGetOpenFileName == NULL || lpfnCommDlgExtendedError == NULL)
      {
      FreeLibrary(hinstCommDlg);
      return FALSE;
      }

   //On success, copy the chosen filename to the static display
   fStatus = (*lpfnGetOpenFileName) ((LPOPENFILENAME)&ofn);
   dwError = (*lpfnCommDlgExtendedError)();

   FreeLibrary(hinstCommDlg);
   return fStatus;
#else
   //On success, copy the chosen filename to the static display
   fStatus = GetOpenFileName((LPOPENFILENAME)&ofn);
   dwError = CommDlgExtendedError();
   return fStatus;
#endif
   }

LPSTR WINAPI ChopText | ( | HWND | hWnd,
 |  | int | nWidth,
 |  | LPSTR | lpch
 | ) |  |

Definition at line 577 of file Utility.c.

{
#define PREFIX_SIZE    7 + 1
#define PREFIX_FORMAT "%c%c%c...\\"

   char    szPrefix[PREFIX_SIZE];
   BOOL    fDone = FALSE;
   int     i;
   RECT    rc;
   HDC     hdc;
   HFONT   hfont;
   HFONT   hfontOld = NULL;

   if (!hWnd || !lpch)
      return NULL;

   /* Get length of static field. */
   if (!nWidth) {
      GetClientRect(hWnd, (LPRECT)&rc);
      nWidth = rc.right - rc.left;
   }

   /* Set up DC appropriately for the static control */
   hdc = GetDC(hWnd);
   hfont = (HFONT)SendMessage(hWnd, WM_GETFONT, 0, 0L);

   if (NULL != hfont)   // WM_GETFONT returns NULL if window uses system font
      hfontOld = SelectObject(hdc, hfont);

   /* check horizontal extent of string */
   if (GetTextWSize(hdc, lpch) > nWidth) {

      /* string is too long to fit in static control; chop it */
      /* set up new prefix & determine remaining space in control */
      wsprintf(/*(LPSTR)*/ szPrefix, PREFIX_FORMAT, lpch[0], lpch[1], lpch[2]);
      nWidth -= (int)GetTextWSize(hdc, /*(LPSTR)*/ szPrefix);

      /*
      ** advance a directory at a time until the remainder of the
      ** string fits into the static control after the "x:\...\" prefix
      */
      while (!fDone) {

#ifdef DBCS
         while (*lpch && (*lpch != '\\'))
            lpch = AnsiNext(lpch);
         if (*lpch)
            lpch = AnsiNext(lpch);
#else
         while (*lpch && (*lpch++ != '\\'));
#endif

         if (!*lpch || GetTextWSize(hdc, lpch) <= nWidth) {
            if (!*lpch)
               /*
               ** Nothing could fit after the prefix; remove the
               ** final "\" from the prefix
               */
               szPrefix[lstrlen(/*(LPSTR)*/ szPrefix) - 1] = 0;

               /* rest or string fits -- stick prefix on front */
               for (i = lstrlen(/*(LPSTR)*/ szPrefix) - 1; i >= 0; --i)
                  *--lpch = szPrefix[i];
               fDone = TRUE;
         }
      }
   }

   if (NULL != hfont)
     SelectObject(hdc, hfontOld);
   ReleaseDC(hWnd, hdc);

   return(lpch);

#undef PREFIX_SIZE
#undef PREFIX_FORMAT
}

HFILE WINAPI DoesFileExist | ( | LPSTR | lpszFile,
 |  | OFSTRUCT FAR * | lpOpenBuf
 | ) |  |

Definition at line 1023 of file Utility.c.

{
   long        nRet;
   int         i;
   static char *arrIllegalNames[] = {
      "LPT1",
      "LPT2",
      "LPT3",
      "COM1",
      "COM2",
      "COM3",
      "COM4",
      "CON",
      "AUX",
      "PRN"
   };

   // Check if file name is syntactically correct.
   //   (OpenFile sometimes crashes if path is not syntactically correct)
   nRet = ParseFile(lpszFile);
   if (LOWORD(nRet) < 0)
      goto error;

   // Check is the name is an illegal name (eg. the name of a device)
   for (i=0; i < (sizeof(arrIllegalNames)/sizeof(arrIllegalNames[0])); i++) {
      if (lstrcmpi(lpszFile, arrIllegalNames[i])==0)
         goto error; // illegal name FOUND
   }
   return OpenFile(lpszFile, lpOpenBuf, OF_EXIST);

error:
   _fmemset(lpOpenBuf, 0, sizeof(OFSTRUCT));
   lpOpenBuf->nErrCode = 0x0002;   // File not found
   return HFILE_ERROR;
}

int WINAPI ErrorWithFile | ( | HWND | hWnd,
 |  | HINSTANCE | hInst,
 |  | UINT | idsErr,
 |  | LPSTR | pszFile,
 |  | UINT | uFlags
 | ) |  |

Definition at line 279 of file Utility.c.

   {
   int             iRet=0;
   HANDLE          hMem;
   const UINT      cb=(2*OLEUI_CCHPATHMAX);
   LPSTR           psz1, psz2, psz3;

   if (NULL==hInst || NULL==pszFile)
      return iRet;

   //Allocate three 2*OLEUI_CCHPATHMAX byte work buffers
   hMem=GlobalAlloc(GHND, (DWORD)(3*cb));

   if (NULL==hMem)
      return iRet;

   psz1=GlobalLock(hMem);
   psz2=psz1+cb;
   psz3=psz2+cb;

   if (0!=LoadString(hInst, idsErr, psz1, cb))
      {
      wsprintf(psz2, psz1, pszFile);

      //Steal the caption of the dialog
      GetWindowText(hWnd, psz3, cb);
      iRet=MessageBox(hWnd, psz2, psz3, uFlags);
      }

   GlobalUnlock(hMem);
   GlobalFree(hMem);
   return iRet;
   }

BOOL WINAPI FServerFromClass | ( | LPSTR | pszClass,
 |  | LPSTR | pszEXE,
 |  | UINT | cch
 | ) |  |

Definition at line 386 of file Utility.c.

{

   DWORD       dw;
   LONG        lRet;
   HKEY        hKey;

   if (NULL==pszClass || NULL==pszEXE || 0==cch)
      return FALSE;

   /*
    * We have to go walking in the registration database under the
    * classname, so we first open the classname key and then check
    * under "\\LocalServer" to get the .EXE.
    */

   //Open up the class key
   lRet=RegOpenKey(HKEY_CLASSES_ROOT, pszClass, &hKey);

   if ((LONG)ERROR_SUCCESS!=lRet)
      return FALSE;

   //Get the executable path.
   dw=(DWORD)cch;
#ifdef WIN32
   lRet=RegQueryValue(hKey, "LocalServer32", pszEXE, &dw);
#else
   lRet=RegQueryValue(hKey, "LocalServer", pszEXE, &dw);
#endif

   if ((LONG)ERROR_SUCCESS!=lRet)
        {
        //Try InprocServer
#ifdef WIN32
        lRet=RegQueryValue(hKey, "InProcServer32", pszEXE, &dw);
#else
        lRet=RegQueryValue(hKey, "InProcServer32", pszEXE, &dw);
#endif
        }

   RegCloseKey(hKey);

   return ((ERROR_SUCCESS == lRet) && (dw > 0));
}

HICON WINAPI HIconFromClass ( LPSTR pszClass )

Definition at line 340 of file Utility.c.

   {
   HICON           hIcon;
   char            szEXE[OLEUI_CCHPATHMAX];
   UINT            Index;
   CLSID           clsid;
   OLECHAR         szUniStr[256];

   if (NULL==pszClass)
      return NULL;

   A2W (pszClass, szUniStr, 256);
   CLSIDFromString(szUniStr, &clsid);

   if (!FIconFileFromClass((REFCLSID)&clsid, szEXE, sizeof(szEXE), &Index))
      return NULL;

   hIcon=ExtractIcon(ghInst, szEXE, Index);

   if ((HICON)32 > hIcon)
      hIcon=NULL;

   return hIcon;
   }

void WINAPI HourGlassOff ( HCURSOR hCur )

Definition at line 86 of file Utility.c.

   {
   ShowCursor(FALSE);
   SetCursor(hCur);
   return;
   }

OLEDBGDATA HCURSOR WINAPI HourGlassOn ( void )

Definition at line 61 of file Utility.c.

   {
   HCURSOR     hCur;

   hCur=SetCursor(LoadCursor(NULL, IDC_WAIT));
   ShowCursor(TRUE);

   return hCur;
   }

void WINAPI OpenFileError | ( | HWND | hDlg,
 |  | UINT | nErrCode,
 |  | LPSTR | lpszFile
 | ) |  |

Definition at line 670 of file Utility.c.

{
   switch (nErrCode) {
      case 0x0005:    // Access denied
         ErrorWithFile(hDlg, ghInst, (UINT)IDS_CIFILEACCESS, lpszFile, MB_OK);
         break;

      case 0x0020:    // Sharing violation
         ErrorWithFile(hDlg, ghInst, (UINT)IDS_CIFILESHARE, lpszFile, MB_OK);
         break;

      case 0x0002:    // File not found
      case 0x0003:    // Path not found
         ErrorWithFile(hDlg, ghInst, (UINT)IDS_CIINVALIDFILE, lpszFile, MB_OK);
         break;

      default:
         ErrorWithFile(hDlg, ghInst, (UINT)IDS_CIFILEOPENFAIL, lpszFile, MB_OK);
         break;
   }
}

int WINAPI ReplaceCharWithNull | ( | LPSTR | psz,
 |  | int | ch
 | ) |  |

Definition at line 234 of file Utility.c.

   {
   int             cChanged=-1;

   if (NULL!=psz)
      {
      while (0!=*psz)
         {
         if (ch==*psz)
            {
            *psz=0;
            cChanged++;
            }
         psz++;
         }
      }
   return cChanged;
   }

UINT WINAPI UClassFromDescription | ( | LPSTR | psz,
 |  | LPSTR | pszClass,
 |  | UINT | cb
 | ) |  |

Definition at line 449 of file Utility.c.

   {
   DWORD           dw;
   HKEY            hKey;
   char            szClass[OLEUI_CCHKEYMAX];
   LONG            lRet;
   UINT            i;

   //Open up the root key.
   lRet=RegOpenKey(HKEY_CLASSES_ROOT, NULL, &hKey);

   if ((LONG)ERROR_SUCCESS!=lRet)
      return 0;

   i=0;
   lRet=RegEnumKey(hKey, i++, szClass, OLEUI_CCHKEYMAX);

   //Walk the available keys
   while ((LONG)ERROR_SUCCESS==lRet)
      {
      dw=(DWORD)cb;
      lRet=RegQueryValue(hKey, szClass, pszClass, &dw);

      //Check if the description matches the one just enumerated
      if ((LONG)ERROR_SUCCESS==lRet)
         {
         if (!lstrcmp(pszClass, psz))
            break;
         }

      //Continue with the next key.
      lRet=RegEnumKey(hKey, i++, szClass, OLEUI_CCHKEYMAX);
      }

   //If we found it, copy to the return buffer
   if ((LONG)ERROR_SUCCESS==lRet)
      lstrcpy(pszClass, szClass);
   else
      dw=0L;

   RegCloseKey(hKey);
   return (UINT)dw;
   }

UINT WINAPI UDescriptionFromClass | ( | LPSTR | pszClass,
 |  | LPSTR | psz,
 |  | UINT | cb
 | ) |  |

Definition at line 516 of file Utility.c.

   {
   DWORD           dw;
   HKEY            hKey;
   LONG            lRet;

   if (NULL==pszClass || NULL==psz)
      return 0;

   //Open up the root key.
   lRet=RegOpenKey(HKEY_CLASSES_ROOT, NULL, &hKey);

   if ((LONG)ERROR_SUCCESS!=lRet)
      return 0;

   //Get the descriptive name using the class name.
   dw=(DWORD)cb;
   lRet=RegQueryValue(hKey, pszClass, psz, &dw);

   RegCloseKey(hKey);

   psz+=lstrlen(psz)+1;
   *psz=0;

   if ((LONG)ERROR_SUCCESS!=lRet)
      return 0;

   return (UINT)dw;
   }

Generated on Wed Nov 13 2024 16:53:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/OleStd/Utility.h File Reference

  • Com
  • Fundamentals
  • OleStd
Functions

Utility.h File Reference

Go to the source code of this file.

Functions

BOOL WINAPI | Browse (HWND, LPSTR, LPSTR, UINT, UINT, DWORD)
LPSTR WINAPI | ChopText (HWND hwndStatic, int nWidth, LPSTR lpch)
HFILE WINAPI | DoesFileExist (LPSTR lpszFile, OFSTRUCT FAR *lpOpenBuf)
int WINAPI | ErrorWithFile (HWND, HINSTANCE, UINT, LPSTR, UINT)
BOOL FAR PASCAL | FIconFileFromClass (REFCLSID, LPSTR, UINT, UINT FAR *)
BOOL WINAPI | FServerFromClass (LPSTR, LPSTR, UINT)
BOOL WINAPI | FVerbGet (LPSTR, UINT, LPSTR)
BOOL FAR PASCAL | GetAssociatedExecutable (LPSTR, LPSTR)
HICON FAR PASCAL | HIconAndSourceFromClass (REFCLSID, LPSTR, UINT FAR *)
HICON WINAPI | HIconFromClass (LPSTR)
void WINAPI | HourGlassOff (HCURSOR)
HCURSOR WINAPI | HourGlassOn (void)
void WINAPI | OpenFileError (HWND hDlg, UINT nErrCode, LPSTR lpszFile)
LPSTR FAR PASCAL | PointerToNthField (LPSTR, int, char)
int WINAPI | ReplaceCharWithNull (LPSTR, int)
UINT WINAPI | UClassFromDescription (LPSTR, LPSTR, UINT)
UINT WINAPI | UDescriptionFromClass (LPSTR, LPSTR, UINT)

Function Documentation

BOOL WINAPI Browse | ( | HWND | ,
 |  | LPSTR | ,
 |  | LPSTR | ,
 |  | UINT | ,
 |  | UINT | ,
 |  | DWORD |
 | ) |  |

Definition at line 123 of file Utility.c.

   {
      UINT           cch;
      char           szFilters[256];
      OPENFILENAME   ofn;
      BOOL           fStatus;
      DWORD          dwError;
      char            szDlgTitle[128];  // that should be big enough
#if !defined( LINK_COMMDLG )
      HINSTANCE hinstCommDlg = NULL;
      typedef BOOL (WINAPI* LPFNGETOPENFILENAME) (OPENFILENAME FAR*);
      LPFNGETOPENFILENAME lpfnGetOpenFileName;
      typedef DWORD (WINAPI* LPFNCOMMDLGEXTENDEDERROR) (void);
      LPFNCOMMDLGEXTENDEDERROR lpfnCommDlgExtendedError;
#endif

   if (NULL==lpszFile || 0==cchFile)
      return FALSE;

   /*
    * REVIEW:  Exact contents of the filter combobox is TBD.  One idea
    * is to take all the extensions in the RegDB and place them in here
    * with the descriptive class name associate with them.  This has the
    * extra step of finding all extensions of the same class handler and
    * building one extension string for all of them.  Can get messy quick.
    * UI demo has only *.* which we do for now.
    */

   if (0!=iFilterString)
      cch=LoadString(ghInst, iFilterString, /*(LPSTR)*/szFilters, sizeof(szFilters));
   else
      {
      szFilters[0]=0;
      cch=1;
      }

   if (0==cch)
      return FALSE;

   ReplaceCharWithNull(szFilters, szFilters[cch-1]);

   //Prior string must also be initialized, if there is one.
   _fmemset((LPOPENFILENAME)&ofn, 0, sizeof(ofn));
   ofn.lStructSize =sizeof(ofn);
   ofn.hwndOwner   =hWndOwner;
   ofn.lpstrFile   =lpszFile;
   ofn.nMaxFile    =cchFile;
   ofn.lpstrFilter =/*(LPSTR)*/szFilters;
   ofn.nFilterIndex=1;
   if (LoadString(ghInst, (UINT)IDS_BROWSE, /*(LPSTR)*/szDlgTitle, sizeof(szDlgTitle)))
      ofn.lpstrTitle  =/*(LPSTR)*/szDlgTitle;
   ofn.hInstance = ghInst;
   ofn.lpTemplateName = MAKEINTRESOURCE(IDD_FILEOPEN);
   if (NULL != lpszInitialDir)
     ofn.lpstrInitialDir = lpszInitialDir;

   ofn.Flags= OFN_HIDEREADONLY | OFN_ENABLETEMPLATE | (dwOfnFlags) ;

#if !defined( LINK_COMMDLG )
   // Load the COMMDLG.DLL library module
   hinstCommDlg = LoadLibrary("COMMDLG.DLL");
   if (hinstCommDlg <= HINSTANCE_ERROR)   /* load failed */
      return FALSE;

   // Retrieve the address of required functions
   lpfnGetOpenFileName = (LPFNGETOPENFILENAME)
         GetProcAddress(hinstCommDlg, "GetOpenFileName");
   lpfnCommDlgExtendedError = (LPFNCOMMDLGEXTENDEDERROR)
         GetProcAddress(hinstCommDlg, "CommDlgExtendedError");

   if (lpfnGetOpenFileName == NULL || lpfnCommDlgExtendedError == NULL)
      {
      FreeLibrary(hinstCommDlg);
      return FALSE;
      }

   //On success, copy the chosen filename to the static display
   fStatus = (*lpfnGetOpenFileName) ((LPOPENFILENAME)&ofn);
   dwError = (*lpfnCommDlgExtendedError)();

   FreeLibrary(hinstCommDlg);
   return fStatus;
#else
   //On success, copy the chosen filename to the static display
   fStatus = GetOpenFileName((LPOPENFILENAME)&ofn);
   dwError = CommDlgExtendedError();
   return fStatus;
#endif
   }

LPSTR WINAPI ChopText | ( | HWND | hwndStatic,
 |  | int | nWidth,
 |  | LPSTR | lpch
 | ) |  |

Definition at line 577 of file Utility.c.

{
#define PREFIX_SIZE    7 + 1
#define PREFIX_FORMAT "%c%c%c...\\"

   char    szPrefix[PREFIX_SIZE];
   BOOL    fDone = FALSE;
   int     i;
   RECT    rc;
   HDC     hdc;
   HFONT   hfont;
   HFONT   hfontOld = NULL;

   if (!hWnd || !lpch)
      return NULL;

   /* Get length of static field. */
   if (!nWidth) {
      GetClientRect(hWnd, (LPRECT)&rc);
      nWidth = rc.right - rc.left;
   }

   /* Set up DC appropriately for the static control */
   hdc = GetDC(hWnd);
   hfont = (HFONT)SendMessage(hWnd, WM_GETFONT, 0, 0L);

   if (NULL != hfont)   // WM_GETFONT returns NULL if window uses system font
      hfontOld = SelectObject(hdc, hfont);

   /* check horizontal extent of string */
   if (GetTextWSize(hdc, lpch) > nWidth) {

      /* string is too long to fit in static control; chop it */
      /* set up new prefix & determine remaining space in control */
      wsprintf(/*(LPSTR)*/ szPrefix, PREFIX_FORMAT, lpch[0], lpch[1], lpch[2]);
      nWidth -= (int)GetTextWSize(hdc, /*(LPSTR)*/ szPrefix);

      /*
      ** advance a directory at a time until the remainder of the
      ** string fits into the static control after the "x:\...\" prefix
      */
      while (!fDone) {

#ifdef DBCS
         while (*lpch && (*lpch != '\\'))
            lpch = AnsiNext(lpch);
         if (*lpch)
            lpch = AnsiNext(lpch);
#else
         while (*lpch && (*lpch++ != '\\'));
#endif

         if (!*lpch || GetTextWSize(hdc, lpch) <= nWidth) {
            if (!*lpch)
               /*
               ** Nothing could fit after the prefix; remove the
               ** final "\" from the prefix
               */
               szPrefix[lstrlen(/*(LPSTR)*/ szPrefix) - 1] = 0;

               /* rest or string fits -- stick prefix on front */
               for (i = lstrlen(/*(LPSTR)*/ szPrefix) - 1; i >= 0; --i)
                  *--lpch = szPrefix[i];
               fDone = TRUE;
         }
      }
   }

   if (NULL != hfont)
     SelectObject(hdc, hfontOld);
   ReleaseDC(hWnd, hdc);

   return(lpch);

#undef PREFIX_SIZE
#undef PREFIX_FORMAT
}

HFILE WINAPI DoesFileExist | ( | LPSTR | lpszFile,
 |  | OFSTRUCT FAR * | lpOpenBuf
 | ) |  |

Definition at line 1023 of file Utility.c.

{
   long        nRet;
   int         i;
   static char *arrIllegalNames[] = {
      "LPT1",
      "LPT2",
      "LPT3",
      "COM1",
      "COM2",
      "COM3",
      "COM4",
      "CON",
      "AUX",
      "PRN"
   };

   // Check if file name is syntactically correct.
   //   (OpenFile sometimes crashes if path is not syntactically correct)
   nRet = ParseFile(lpszFile);
   if (LOWORD(nRet) < 0)
      goto error;

   // Check is the name is an illegal name (eg. the name of a device)
   for (i=0; i < (sizeof(arrIllegalNames)/sizeof(arrIllegalNames[0])); i++) {
      if (lstrcmpi(lpszFile, arrIllegalNames[i])==0)
         goto error; // illegal name FOUND
   }
   return OpenFile(lpszFile, lpOpenBuf, OF_EXIST);

error:
   _fmemset(lpOpenBuf, 0, sizeof(OFSTRUCT));
   lpOpenBuf->nErrCode = 0x0002;   // File not found
   return HFILE_ERROR;
}

int WINAPI ErrorWithFile | ( | HWND | ,
 |  | HINSTANCE | ,
 |  | UINT | ,
 |  | LPSTR | ,
 |  | UINT |
 | ) |  |

Definition at line 279 of file Utility.c.

   {
   int             iRet=0;
   HANDLE          hMem;
   const UINT      cb=(2*OLEUI_CCHPATHMAX);
   LPSTR           psz1, psz2, psz3;

   if (NULL==hInst || NULL==pszFile)
      return iRet;

   //Allocate three 2*OLEUI_CCHPATHMAX byte work buffers
   hMem=GlobalAlloc(GHND, (DWORD)(3*cb));

   if (NULL==hMem)
      return iRet;

   psz1=GlobalLock(hMem);
   psz2=psz1+cb;
   psz3=psz2+cb;

   if (0!=LoadString(hInst, idsErr, psz1, cb))
      {
      wsprintf(psz2, psz1, pszFile);

      //Steal the caption of the dialog
      GetWindowText(hWnd, psz3, cb);
      iRet=MessageBox(hWnd, psz2, psz3, uFlags);
      }

   GlobalUnlock(hMem);
   GlobalFree(hMem);
   return iRet;
   }

BOOL FAR PASCAL FIconFileFromClass | ( | REFCLSID | ,
 |  | LPSTR | ,
 |  | UINT | ,
 |  | UINT FAR * |
 | ) |  |

Definition at line 673 of file getIcon.c.

{

   LONG          dw;
   LONG          lRet;
   HKEY          hKey;
   LPMALLOC      lpIMalloc;
   HRESULT       hrErr;
   LPSTR         lpBuffer;
   LPSTR         lpIndexString;
   UINT          cBufferSize = 136;// room for 128 char path and icon's index
   char          szKey[264];
   char          pszClass[256];
   LPOLESTR      pszUniClass;

   if (NULL==rclsid || NULL==pszEXE || 0==cch || IsEqualCLSID(rclsid,&CLSID_NULL))
      return FALSE;

   //Here, we use CoGetMalloc and alloc a buffer (maxpathlen + 8) to
   //pass to RegQueryValue.  Then, we copy the exe to pszEXE and the
   //index to *lpIndex.

   hrErr = CoGetMalloc(MEMCTX_TASK, &lpIMalloc);

   if (NOERROR != hrErr)
     return FALSE;

   lpBuffer = /*(LPSTR)*/lpIMalloc->lpVtbl->Alloc(lpIMalloc, cBufferSize);

   if (NULL == lpBuffer)
   {
     lpIMalloc->lpVtbl->Release(lpIMalloc);
     return FALSE;
   }

   if (CoIsOle1Class(rclsid))
   {

     LPOLESTR lpszUniProgID;
     char lpszProgID[256];

     // we've got an ole 1.0 class on our hands, so we look at
     // progID\protocol\stdfileedting\server to get the
     // name of the executable.

     ProgIDFromCLSID(rclsid, &lpszUniProgID);
     W2A (lpszUniProgID, lpszProgID, 256);

     //Open up the class key
     lRet=RegOpenKey(HKEY_CLASSES_ROOT, lpszProgID, &hKey);

     if (ERROR_SUCCESS != lRet)
     {
       lpIMalloc->lpVtbl->Free(lpIMalloc, lpszUniProgID);
       lpIMalloc->lpVtbl->Free(lpIMalloc, lpBuffer);
       lpIMalloc->lpVtbl->Release(lpIMalloc);
       return FALSE;
     }

     dw=(LONG)cBufferSize;
     lRet = RegQueryValue(hKey, "Protocol\\StdFileEditing\\Server", lpBuffer, &dw);

     if (ERROR_SUCCESS != lRet)
     {

       RegCloseKey(hKey);
       lpIMalloc->lpVtbl->Free(lpIMalloc, lpszUniProgID);
       lpIMalloc->lpVtbl->Free(lpIMalloc, lpBuffer);
       lpIMalloc->lpVtbl->Release(lpIMalloc);
       return FALSE;
     }

     // Use server and 0 as the icon index
     LSTRCPYN(pszEXE, lpBuffer, cch);

     *lpIndex = 0;

     RegCloseKey(hKey);
     lpIMalloc->lpVtbl->Free(lpIMalloc, lpszUniProgID);
     lpIMalloc->lpVtbl->Free(lpIMalloc, lpBuffer);
     lpIMalloc->lpVtbl->Release(lpIMalloc);
     return TRUE;

   }

   /*
    * We have to go walking in the registration database under the
    * classname, so we first open the classname key and then check
    * under "\\DefaultIcon" to get the file that contains the icon.
    */

   StringFromCLSID(rclsid, &pszUniClass);
   W2A (pszUniClass, pszClass, 256);

   lstrcpy(szKey, "CLSID\\");
   lstrcat(szKey, pszClass);

   //Open up the class key
   lRet=RegOpenKey(HKEY_CLASSES_ROOT, szKey, &hKey);

   if (ERROR_SUCCESS != lRet)
   {
      lpIMalloc->lpVtbl->Free(lpIMalloc, lpBuffer);
      lpIMalloc->lpVtbl->Free(lpIMalloc, pszUniClass);
      lpIMalloc->lpVtbl->Release(lpIMalloc);
      return FALSE;
   }

   //Get the executable path and icon index.

   dw=(LONG)cBufferSize;
   lRet=RegQueryValue(hKey, "DefaultIcon", lpBuffer, &dw);

   if (ERROR_SUCCESS != lRet)
   {
     // no DefaultIcon  key...try LocalServer

     dw=(LONG)cBufferSize;
#ifdef WIN32
     lRet=RegQueryValue(hKey, "LocalServer32", lpBuffer, &dw);
#else
     lRet=RegQueryValue(hKey, "LocalServer", lpBuffer, &dw);
#endif

     if (ERROR_SUCCESS != lRet)
     {
       // no LocalServer entry either...they're outta luck.

       RegCloseKey(hKey);
       lpIMalloc->lpVtbl->Free(lpIMalloc, lpBuffer);
       lpIMalloc->lpVtbl->Free(lpIMalloc, pszUniClass);
       lpIMalloc->lpVtbl->Release(lpIMalloc);
       return FALSE;
     }

     // Use server from LocalServer or Server and 0 as the icon index
     LSTRCPYN(pszEXE, lpBuffer, cch);

     *lpIndex = 0;

     RegCloseKey(hKey);
     lpIMalloc->lpVtbl->Free(lpIMalloc, lpBuffer);
     lpIMalloc->lpVtbl->Free(lpIMalloc, pszUniClass);
     lpIMalloc->lpVtbl->Release(lpIMalloc);
     return TRUE;
   }

   RegCloseKey(hKey);

   // lpBuffer contains a string that looks like "<pathtoexe>,<iconindex>",
   // so we need to separate the path and the icon index.

   lpIndexString = PointerToNthField(lpBuffer, 2, ',');

   if ('\0' == *lpIndexString)  // no icon index specified - use 0 as default.
   {
      *lpIndex = 0;

   }
   else
   {
      LPSTR lpTemp;
      static char  szTemp[16];

      lstrcpy(szTemp, lpIndexString);

      // Put the icon index part into *pIconIndex
      *lpIndex = atoi((const char *)szTemp);

      // Null-terminate the exe part.
      lpTemp = AnsiPrev(lpBuffer, lpIndexString);
      *lpTemp = '\0';
   }

   if (!LSTRCPYN(pszEXE, lpBuffer, cch))
   {
      lpIMalloc->lpVtbl->Free(lpIMalloc, lpBuffer);
      lpIMalloc->lpVtbl->Free(lpIMalloc, pszUniClass);
      lpIMalloc->lpVtbl->Release(lpIMalloc);
      return FALSE;
   }

   // Free the memory we alloc'd and leave.
   lpIMalloc->lpVtbl->Free(lpIMalloc, lpBuffer);
   lpIMalloc->lpVtbl->Free(lpIMalloc, pszUniClass);
   lpIMalloc->lpVtbl->Release(lpIMalloc);
   return TRUE;
}

BOOL WINAPI FServerFromClass | ( | LPSTR | ,
 |  | LPSTR | ,
 |  | UINT |
 | ) |  |

Definition at line 386 of file Utility.c.

{

   DWORD       dw;
   LONG        lRet;
   HKEY        hKey;

   if (NULL==pszClass || NULL==pszEXE || 0==cch)
      return FALSE;

   /*
    * We have to go walking in the registration database under the
    * classname, so we first open the classname key and then check
    * under "\\LocalServer" to get the .EXE.
    */

   //Open up the class key
   lRet=RegOpenKey(HKEY_CLASSES_ROOT, pszClass, &hKey);

   if ((LONG)ERROR_SUCCESS!=lRet)
      return FALSE;

   //Get the executable path.
   dw=(DWORD)cch;
#ifdef WIN32
   lRet=RegQueryValue(hKey, "LocalServer32", pszEXE, &dw);
#else
   lRet=RegQueryValue(hKey, "LocalServer", pszEXE, &dw);
#endif

   if ((LONG)ERROR_SUCCESS!=lRet)
        {
        //Try InprocServer
#ifdef WIN32
        lRet=RegQueryValue(hKey, "InProcServer32", pszEXE, &dw);
#else
        lRet=RegQueryValue(hKey, "InProcServer32", pszEXE, &dw);
#endif
        }

   RegCloseKey(hKey);

   return ((ERROR_SUCCESS == lRet) && (dw > 0));
}

BOOL WINAPI FVerbGet | ( | LPSTR | ,
 |  | UINT | ,
 |  | LPSTR |
 | ) |  |
BOOL FAR PASCAL GetAssociatedExecutable | ( | LPSTR | ,
 |  | LPSTR |
 | ) |  |

Definition at line 501 of file getIcon.c.

{
   HKEY    hKey;
   LONG    dw;
   LRESULT lRet;
   char    szValue[OLEUI_CCHKEYMAX];
   char    szKey[OLEUI_CCHKEYMAX];
   LPSTR   lpszTemp, lpszExe;

   lRet = RegOpenKey(HKEY_CLASSES_ROOT, NULL, &hKey);

   if (ERROR_SUCCESS != lRet)
     return FALSE;

   dw = OLEUI_CCHPATHMAX;
   lRet = RegQueryValue(hKey, lpszExtension, szValue, &dw);  //ProgId

   if (ERROR_SUCCESS != lRet)
   {
     RegCloseKey(hKey);
     return FALSE;
   }

   // szValue now has ProgID
   lstrcpy(szKey, szValue);
   lstrcat(szKey, "\\Shell\\Open\\Command");

   dw = OLEUI_CCHPATHMAX;
   lRet = RegQueryValue(hKey, szKey, szValue, &dw);

   if (ERROR_SUCCESS != lRet)
   {
     RegCloseKey(hKey);
     return FALSE;
   }

   // szValue now has an executable name in it.  Let's null-terminate
   // at the first post-executable space (so we don't have cmd line
   // args.

   lpszTemp = szValue;

   while (('\0' != *lpszTemp) && (isspace(*lpszTemp)))
     lpszTemp++;     // Strip off leading spaces

   lpszExe = lpszTemp;

   while (('\0' != *lpszTemp) && (!isspace(*lpszTemp)))
     lpszTemp++;     // Step through exe name

   *lpszTemp = '\0';  // null terminate at first space (or at end).

   lstrcpy(lpszExecutable, lpszExe);

   return TRUE;

}

HICON FAR PASCAL HIconAndSourceFromClass | ( | REFCLSID | ,
 |  | LPSTR | ,
 |  | UINT FAR * |
 | ) |  |

Definition at line 587 of file getIcon.c.

   {
   HICON           hIcon;
   UINT            IconIndex;

   if (NULL==rclsid || NULL==pszSource || IsEqualCLSID(rclsid,&CLSID_NULL))
      return NULL;

   if (!FIconFileFromClass(rclsid, pszSource, OLEUI_CCHPATHMAX, &IconIndex))
      return NULL;

   hIcon=ExtractIcon(ghInst, pszSource, IconIndex);

   if ((HICON)32 > hIcon)
      hIcon=NULL;
   else
      *puIcon= IconIndex;

   return hIcon;
   }

HICON WINAPI HIconFromClass ( LPSTR )

Definition at line 340 of file Utility.c.

   {
   HICON           hIcon;
   char            szEXE[OLEUI_CCHPATHMAX];
   UINT            Index;
   CLSID           clsid;
   OLECHAR         szUniStr[256];

   if (NULL==pszClass)
      return NULL;

   A2W (pszClass, szUniStr, 256);
   CLSIDFromString(szUniStr, &clsid);

   if (!FIconFileFromClass((REFCLSID)&clsid, szEXE, sizeof(szEXE), &Index))
      return NULL;

   hIcon=ExtractIcon(ghInst, szEXE, Index);

   if ((HICON)32 > hIcon)
      hIcon=NULL;

   return hIcon;
   }

void WINAPI HourGlassOff ( HCURSOR )

Definition at line 86 of file Utility.c.

   {
   ShowCursor(FALSE);
   SetCursor(hCur);
   return;
   }

HCURSOR WINAPI HourGlassOn ( void )

Definition at line 61 of file Utility.c.

   {
   HCURSOR     hCur;

   hCur=SetCursor(LoadCursor(NULL, IDC_WAIT));
   ShowCursor(TRUE);

   return hCur;
   }

void WINAPI OpenFileError | ( | HWND | hDlg,
 |  | UINT | nErrCode,
 |  | LPSTR | lpszFile
 | ) |  |

Definition at line 670 of file Utility.c.

{
   switch (nErrCode) {
      case 0x0005:    // Access denied
         ErrorWithFile(hDlg, ghInst, (UINT)IDS_CIFILEACCESS, lpszFile, MB_OK);
         break;

      case 0x0020:    // Sharing violation
         ErrorWithFile(hDlg, ghInst, (UINT)IDS_CIFILESHARE, lpszFile, MB_OK);
         break;

      case 0x0002:    // File not found
      case 0x0003:    // Path not found
         ErrorWithFile(hDlg, ghInst, (UINT)IDS_CIINVALIDFILE, lpszFile, MB_OK);
         break;

      default:
         ErrorWithFile(hDlg, ghInst, (UINT)IDS_CIFILEOPENFAIL, lpszFile, MB_OK);
         break;
   }
}

LPSTR FAR PASCAL PointerToNthField | ( | LPSTR | ,
 |  | int | ,
 |  | char |
 | ) |  |

Definition at line 630 of file getIcon.c.

{
   LPSTR lpField = lpszString;
   int   cFieldFound = 1;

   if (1 ==nField)
     return lpszString;

   while (*lpField != '\0')
   {

     if (*lpField++ == chDelimiter)
     {

       cFieldFound++;

       if (nField == cFieldFound)
         return lpField;
     }
   }

   return lpField;

}

int WINAPI ReplaceCharWithNull | ( | LPSTR | ,
 |  | int |
 | ) |  |

Definition at line 234 of file Utility.c.

   {
   int             cChanged=-1;

   if (NULL!=psz)
      {
      while (0!=*psz)
         {
         if (ch==*psz)
            {
            *psz=0;
            cChanged++;
            }
         psz++;
         }
      }
   return cChanged;
   }

UINT WINAPI UClassFromDescription | ( | LPSTR | ,
 |  | LPSTR | ,
 |  | UINT |
 | ) |  |

Definition at line 449 of file Utility.c.

   {
   DWORD           dw;
   HKEY            hKey;
   char            szClass[OLEUI_CCHKEYMAX];
   LONG            lRet;
   UINT            i;

   //Open up the root key.
   lRet=RegOpenKey(HKEY_CLASSES_ROOT, NULL, &hKey);

   if ((LONG)ERROR_SUCCESS!=lRet)
      return 0;

   i=0;
   lRet=RegEnumKey(hKey, i++, szClass, OLEUI_CCHKEYMAX);

   //Walk the available keys
   while ((LONG)ERROR_SUCCESS==lRet)
      {
      dw=(DWORD)cb;
      lRet=RegQueryValue(hKey, szClass, pszClass, &dw);

      //Check if the description matches the one just enumerated
      if ((LONG)ERROR_SUCCESS==lRet)
         {
         if (!lstrcmp(pszClass, psz))
            break;
         }

      //Continue with the next key.
      lRet=RegEnumKey(hKey, i++, szClass, OLEUI_CCHKEYMAX);
      }

   //If we found it, copy to the return buffer
   if ((LONG)ERROR_SUCCESS==lRet)
      lstrcpy(pszClass, szClass);
   else
      dw=0L;

   RegCloseKey(hKey);
   return (UINT)dw;
   }

UINT WINAPI UDescriptionFromClass | ( | LPSTR | ,
 |  | LPSTR | ,
 |  | UINT |
 | ) |  |

Definition at line 516 of file Utility.c.

   {
   DWORD           dw;
   HKEY            hKey;
   LONG            lRet;

   if (NULL==pszClass || NULL==psz)
      return 0;

   //Open up the root key.
   lRet=RegOpenKey(HKEY_CLASSES_ROOT, NULL, &hKey);

   if ((LONG)ERROR_SUCCESS!=lRet)
      return 0;

   //Get the descriptive name using the class name.
   dw=(DWORD)cb;
   lRet=RegQueryValue(hKey, pszClass, psz, &dw);

   RegCloseKey(hKey);

   psz+=lstrlen(psz)+1;
   *psz=0;

   if ((LONG)ERROR_SUCCESS!=lRet)
      return 0;

   return (UINT)dw;
   }

Generated on Wed Nov 13 2024 16:53:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/OleStd/wn_dos.h File Reference

  • Com
  • Fundamentals
  • OleStd
Classes | Defines | Typedefs | Functions

wn_dos.h File Reference

#include <dos.h>

Go to the source code of this file.

Classes

struct | _DOSDTTM
struct | _SFFS

Defines

#define | AppendSzWild(sz) {int i=_fstrlen((char FAR *)(sz)); sz[i]='*'; sz[i+1]='.'; sz[i+2]='*'; sz[i+3]='\0';}
#define | AttribPsffs(psffs) (psffs)->wAttr
#define | bSHARE_DENYNONE 0x40
#define | bSHARE_DENYRDWR 0x10
#define | bSHARE_DENYWR 0x20
#define | CbFileSizePsffs(psffs) (psffs)->cbFile
#define | cbMaxFile 146
#define | CbReadHfile(f, buf, n) _lread(f,buf,n)
#define | CbReadOsfn(osfn, lpch, cbRead) CbReadOsfnWin(osfn,lpch,cbRead)
#define | CbReadOsfnWin(f, buf, n) CbReadHfile(f,buf,n)
#define | CbSzFilePsffs(psffs) CbSz((psffs)->szFileName)
#define | chDOSPath ('\\')
#define | chDOSWildAll '*'
#define | chDOSWildSingle '?'
#define | CopySzFilePsffs(psffs, sz) OemToAnsi((char HUGE *)&((psffs)->szFileName[0]),(char HUGE *)(sz))
#define | DA_ARCHIVE 0x20
#define | DA_HIDDEN 0x02
#define | DA_NIL 0xFFFF
#define | DA_NORMAL 0x00
#define | DA_READONLY 0x01
#define | DA_SUBDIR 0x10
#define | DA_SYSTEM 0x04
#define | DA_VOLUME 0x08
#define | DAT dosdate_t
#define | dosxSharing 32
#define | EcFindFirst4dm(a, b, c) _dos_findfirst((const char *)(b),c,(struct find_t*)a)
#define | EcFindFirstCore(psffs, sz, wAttr) EcFindFirst(psffs, sz, wAttr)
#define | EcFindNext4dm(a) _dos_findnext((struct find_t*)a)
#define | FDotPsffs(psffs) ((psffs)->szFileName[0]=='.')
#define | FHfileToSffsDate(handle, date, time) _dos_getftime(handle, (unsigned *)(date), (unsigned *)(time))
#define | LcbDiskFreeSpace(chDrive) LcbDiskFreeSpaceWin(chDrive)
#define | MASK_bACCESS 0x07
#define | MASK_bSHARE 0x70
#define | MASK_fINH 0x80
#define | nErrFnf 2
#define | nErrNoAcc 5
#define | OsDateWin(DAT) _dos_getdate(DAT)
#define | OsTimeWin(TIM) _dos_gettime(TIM)
#define | PszFromPsffs(psffs) ((psffs)->szFileName)
#define | SEEK_FROM_BEGINNING 0
#define | SEEK_FROM_END 2
#define | SeekHfile(f, off, kind) _llseek(f,off,kind)
#define | SeekHfile(f, off, kind) _llseek(f,off,kind)
#define | SF_BEGINNING 0
#define | SF_CURRENT 1
#define | SF_END 2
#define | TIM dostime_t
#define | WIN 1
#define | WinOpenFile(sz, ofs, n) OpenFile(sz,ofs,n)

Typedefs

typedef struct _DOSDTTM | DOSDTTM
typedef struct _SFFS | SFFS

Functions

void | DateStamp (int, LONG *, int)
int | DosxError (void)
int | FOsfnIsFile (int)
unsigned long | LcbDiskFreeSpaceWin (int)
int | ShellExec (int, int)

Define Documentation

#define AppendSzWild ( sz ) {int i=_fstrlen((char FAR *)(sz)); sz[i]='*'; sz[i+1]='.'; sz[i+2]='*'; sz[i+3]='\0';}

Definition at line 99 of file wn_dos.h.

#define AttribPsffs ( psffs ) (psffs)->wAttr

Definition at line 96 of file wn_dos.h.

#define bSHARE_DENYNONE 0x40

Definition at line 142 of file wn_dos.h.

#define bSHARE_DENYRDWR 0x10

Definition at line 140 of file wn_dos.h.

#define bSHARE_DENYWR 0x20

Definition at line 141 of file wn_dos.h.

#define CbFileSizePsffs ( psffs ) (psffs)->cbFile

Definition at line 95 of file wn_dos.h.

#define cbMaxFile 146

Definition at line 23 of file wn_dos.h.

#define CbReadHfile | ( | f,
 |  | buf,
 |  | n |
 | ) |  | _lread(f,buf,n)

Definition at line 53 of file wn_dos.h.

#define CbReadOsfn | ( | osfn,
 |  | lpch,
 |  | cbRead |
 | ) |  | CbReadOsfnWin(osfn,lpch,cbRead)

Definition at line 52 of file wn_dos.h.

#define CbReadOsfnWin | ( | f,
 |  | buf,
 |  | n |
 | ) |  | CbReadHfile(f,buf,n)

Definition at line 54 of file wn_dos.h.

#define CbSzFilePsffs ( psffs ) CbSz((psffs)->szFileName)

Definition at line 94 of file wn_dos.h.

#define chDOSPath ('\\')

Definition at line 26 of file wn_dos.h.

#define chDOSWildAll '*'

Definition at line 27 of file wn_dos.h.

#define chDOSWildSingle '?'

Definition at line 28 of file wn_dos.h.

#define CopySzFilePsffs | ( | psffs,
 |  | sz |
 | ) |  | OemToAnsi((char HUGE *)&((psffs)->szFileName[0]),(char HUGE *)(sz))

Definition at line 93 of file wn_dos.h.

#define DA_ARCHIVE 0x20

Definition at line 129 of file wn_dos.h.

#define DA_HIDDEN 0x02

Definition at line 125 of file wn_dos.h.

#define DA_NIL 0xFFFF

Definition at line 130 of file wn_dos.h.

#define DA_NORMAL 0x00

Definition at line 123 of file wn_dos.h.

#define DA_READONLY 0x01

Definition at line 124 of file wn_dos.h.

#define DA_SUBDIR 0x10

Definition at line 128 of file wn_dos.h.

#define DA_SYSTEM 0x04

Definition at line 126 of file wn_dos.h.

#define DA_VOLUME 0x08

Definition at line 127 of file wn_dos.h.

#define DAT dosdate_t

Definition at line 117 of file wn_dos.h.

#define dosxSharing 32

Definition at line 131 of file wn_dos.h.

#define EcFindFirst4dm | ( | a,
 |  | b,
 |  | c |
 | ) |  | _dos_findfirst((const char *)(b),c,(struct find_t*)a)

Definition at line 55 of file wn_dos.h.

#define EcFindFirstCore | ( | psffs,
 |  | sz,
 |  | wAttr |
 | ) |  | EcFindFirst(psffs, sz, wAttr)

Definition at line 97 of file wn_dos.h.

#define EcFindNext4dm ( a ) _dos_findnext((struct find_t*)a)

Definition at line 56 of file wn_dos.h.

#define FDotPsffs ( psffs ) ((psffs)->szFileName[0]=='.')

Definition at line 98 of file wn_dos.h.

#define FHfileToSffsDate | ( | handle,
 |  | date,
 |  | time |
 | ) |  | _dos_getftime(handle, (unsigned *)(date), (unsigned *)(time))

Definition at line 57 of file wn_dos.h.

#define LcbDiskFreeSpace ( chDrive ) LcbDiskFreeSpaceWin(chDrive)

Definition at line 103 of file wn_dos.h.

#define MASK_bACCESS 0x07

Definition at line 138 of file wn_dos.h.

#define MASK_bSHARE 0x70

Definition at line 137 of file wn_dos.h.

#define MASK_fINH 0x80

Definition at line 136 of file wn_dos.h.

#define nErrFnf 2

Definition at line 133 of file wn_dos.h.

#define nErrNoAcc 5

Definition at line 132 of file wn_dos.h.

#define OsDateWin ( DAT ) _dos_getdate(DAT)

Definition at line 119 of file wn_dos.h.

#define OsTimeWin ( TIM ) _dos_gettime(TIM)

Definition at line 118 of file wn_dos.h.

#define PszFromPsffs ( psffs ) ((psffs)->szFileName)

Definition at line 92 of file wn_dos.h.

#define SEEK_FROM_BEGINNING 0

Definition at line 24 of file wn_dos.h.

#define SEEK_FROM_END 2

Definition at line 25 of file wn_dos.h.

#define SeekHfile | ( | f,
 |  | off,
 |  | kind |
 | ) |  | _llseek(f,off,kind)

Definition at line 58 of file wn_dos.h.

#define SeekHfile | ( | f,
 |  | off,
 |  | kind |
 | ) |  | _llseek(f,off,kind)

Definition at line 58 of file wn_dos.h.

#define SF_BEGINNING 0

Definition at line 146 of file wn_dos.h.

#define SF_CURRENT 1

Definition at line 147 of file wn_dos.h.

#define SF_END 2

Definition at line 148 of file wn_dos.h.

#define TIM dostime_t

Definition at line 116 of file wn_dos.h.

#define WIN 1

Definition at line 21 of file wn_dos.h.

#define WinOpenFile | ( | sz,
 |  | ofs,
 |  | n |
 | ) |  | OpenFile(sz,ofs,n)

Definition at line 50 of file wn_dos.h.

Typedef Documentation

typedef struct _DOSDTTM DOSDTTM
typedef struct _SFFS SFFS

Function Documentation

void DateStamp | ( | int | ,
 |  | LONG * | ,
 |  | int |
 | ) |  |
int DosxError ( void )
int FOsfnIsFile ( int )
unsigned long LcbDiskFreeSpaceWin ( int )
int ShellExec | ( | int | ,
 |  | int |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/Pipes/Client/client.cxx File Reference

  • Com
  • Fundamentals
  • Pipes
  • Client
Typedefs | Enumerations | Functions | Variables

client.cxx File Reference

#include <objbase.h>
#include <conio.h>
#include <tchar.h>
#include <iostream.h>
#include "ISimpleInterface.h"
#include "..\include\pipe.hxx"

Go to the source code of this file.

Typedefs

typedef enum _options | clOption

Enumerations

enum | _options { PIPE_AS_IN_PARAMETER = 1, PIPE_AS_OUT_PARAMETER, PIPE_AS_IN_OUT_PARAMETER, PIPES_AS_IN_IN_OUT_PARAMETERS }

Functions

void | cleanup ()
int | CreateInstance (ISimpleInterface **ppSI)
int | main (int argc, char *argv[])
int | map (char *szOption)
void | Message (HRESULT hr)
void | pipe_in ()
void | pipe_in_out ()
void | pipe_out ()
void | pipes_in_in_out ()
void | usage ()

Variables

LPTSTR g_szMessage

Typedef Documentation

typedef enum _options clOption

Enumeration Type Documentation

enum _options
Enumerator:
PIPE_AS_IN_PARAMETER
PIPE_AS_OUT_PARAMETER
PIPE_AS_IN_OUT_PARAMETER
PIPES_AS_IN_IN_OUT_PARAMETERS

Definition at line 19 of file client.cxx.

                      { PIPE_AS_IN_PARAMETER=1, PIPE_AS_OUT_PARAMETER,
                PIPE_AS_IN_OUT_PARAMETER, PIPES_AS_IN_IN_OUT_PARAMETERS
              } clOption;

Function Documentation

void cleanup ( ) [inline]

Definition at line 73 of file client.cxx.

{
   //CoFreeUnusedLibraries();
   CoUninitialize();
}

int CreateInstance ( ISimpleInterface ** ppSI )

Definition at line 59 of file client.cxx.

{
   HRESULT hr = S_OK;
   hr=CoInitializeEx(NULL, COINIT_MULTITHREADED);
   hr=CoCreateInstance(CLSID_SimpleClass,0,CLSCTX_LOCAL_SERVER,IID_ISimpleInterface, (void**)&(*ppSI));
   if (FAILED(hr)) {
      Message(hr);
      MessageBox(NULL, g_szMessage, TEXT("CLIENT : COCREATEINSTANCE ERROR"), MB_SETFOREGROUND);
      CoUninitialize();
      return 0;
   }
   return 1;
}

int main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 302 of file client.cxx.

{
   if (argc != 2) { usage(); return -1; }

   int option;
   char* szOption=new char[strlen(argv[1])+1];
   strcpy(szOption, argv[1]);

   // Map input option to desired switch value
   option=map(szOption);

   // Execute the appropriate function
   switch (option)
   {
      case PIPE_AS_IN_PARAMETER:          pipe_in();
                  break;
      case PIPE_AS_OUT_PARAMETER:         pipe_out();
                  break;
      case PIPE_AS_IN_OUT_PARAMETER:      pipe_in_out();
                  break;
      case PIPES_AS_IN_IN_OUT_PARAMETERS: pipes_in_in_out();
            break;
      default:                            usage();
                              break;
   };
   return 0;
};

int map ( char * szOption )

Definition at line 32 of file client.cxx.

{
   int option=0;
   if (!strcmp(szOption, "PIPE_AS_IN_PARAMETER")) { option=1; }
   else if (!strcmp(szOption,"PIPE_AS_OUT_PARAMETER")) { option=2; }
   else if (!strcmp(szOption,"PIPE_AS_IN_OUT_PARAMETER")) { option=3; }
   else if (!strcmp(szOption,"PIPES_AS_IN_IN_OUT_PARAMETERS")) { option=4; }
   else { option=0; }
   return option;
}

void Message ( HRESULT hr )

Definition at line 43 of file client.cxx.

{
    if (HRESULT_FACILITY(hr) == FACILITY_WINDOWS)
        hr = HRESULT_CODE(hr);

    FormatMessage(
        FORMAT_MESSAGE_ALLOCATE_BUFFER |
        FORMAT_MESSAGE_FROM_SYSTEM,
        NULL,
        hr,
        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), //The user default language
        (LPTSTR)&g_szMessage,
        0,
        NULL);
}

void pipe_in ( )

Definition at line 83 of file client.cxx.

{
   HRESULT hr = S_OK;
   cout << endl << "***** Running [In] Pipe Example *****" << endl << endl;

   // Create an instance of the simple class
   ISimpleInterface* pSI=NULL;
   if (!CreateInstance(&pSI)) { return; }

   // The client needs to Create a pipe
   CSamplePipe* pInPipe = new CSamplePipe();
   pInPipe->AddRef();
   // Pass the pipe to the server as an 'in' parameter.
   // Since the client implements both Pull and Push operations,
   // the server can use these callbacks.
   hr=pSI->InPipeSample(pInPipe);
   if (FAILED(hr)) {
      MessageBox(NULL, TEXT("InPipe couldn't be used by the server/callee"), TEXT("CLIENT: ERROR"), MB_SETFOREGROUND);
   }
   else
   {
      cout << endl << "InPipe was successfully used by the server/callee." << endl;
   }

   // Resource management
   hr=pInPipe->Release();
   hr=pSI->Release();
   pInPipe=NULL;
   pSI=NULL;
   cleanup();
   return;
}

void pipe_in_out ( )

Definition at line 197 of file client.cxx.

{
   cout << endl << "***** Running [In,Out] Pipe Example *****" << endl << endl;
   HRESULT hr = S_OK;

   // Create an instance of the simple class
   ISimpleInterface* pSI;
   if (!CreateInstance(&pSI)) { return; }

   // The client needs to Create a pipe
   IPipeLong* pInOutPipe;

   pInOutPipe = new CSamplePipe();

   // Pass the pipe to the server as an 'in,out' parameter.
   // Since the client implements both Pull and Push operations,
   // the server can use these callbacks.
   pInOutPipe->AddRef();
   hr=pSI->InOutPipeSample(&pInOutPipe);
   if (FAILED(hr)) {
      MessageBox(NULL, TEXT("InOutPipe invalid on return from server"), TEXT("CLIENT: ERROR"), MB_SETFOREGROUND);
      hr=pSI->Release();
      cleanup(); return;
   }

   // Use the returned Pipe now

   /*
   ** Drain in (PULL) the pipe.
   */
   cout << "OPERATION: PULLing one sequence from the InOutPipe" << endl;
   ULONG lPulled=0;
   LONG *buffer1 = new LONG[2000 + 1];

   hr=GenericPull(pInOutPipe, buffer1, &lPulled, 0);
   if (FAILED(hr)) {
      MessageBox(NULL, TEXT("PULL FAILED ON INOUTPIPE"), TEXT("CLIENT: ERROR"), MB_SETFOREGROUND);
      cleanup(); return;
   }
   else {
      cout << "RESULT: success !"
           << endl << endl;
   }

   // Resource management
   pInOutPipe->Release();
   hr=pSI->Release();
   cleanup();
   return;
}

void pipe_out ( )

Definition at line 120 of file client.cxx.

{
   HRESULT hr = S_OK;
   cout << endl << "***** Running [Out] Pipe Example *****" << endl << endl;

   // Create an instance of the simple class
   ISimpleInterface* pSI=NULL;
   if (!CreateInstance(&pSI)) { return; }

   // The server will create the pipe
   IPipeLong *pOutPipe=NULL;

   // Get the pipe from the server as an 'out' parameter.
   // Since the server implements both Pull and Push operations,
   // the client can use these callbacks.
   hr=pSI->OutPipeSample(&pOutPipe);
   if (FAILED(hr)) {
      MessageBox(NULL, TEXT("Invalid OutPipe returned by the server"), TEXT("CLIENT: ERROR"), MB_SETFOREGROUND);
      cleanup(); return;
   }

   /*
   ** Drain in (PULL) the pipe.
   */

   cout << "OPERATION: PULLing one sequence from the OutPipe" << endl;
   ULONG lPulled=0;
   LONG *buffer1 = new LONG[2000 + 1];

   hr=GenericPull(pOutPipe, buffer1, &lPulled, 0);
   if (FAILED(hr)) {
      MessageBox(NULL, TEXT("PULL FAILED ON OUTPIPE"), TEXT("CLIENT: ERROR"), MB_SETFOREGROUND);
      cleanup(); return;
   }
   else {
      cout << "RESULT: success !"
           << endl << endl;
   }

   /*
   ** PUSH 500 elements to the pipe.
   */
   cout << "OPERATION: PUSHing one sequence to the OutPipe" << endl;

   LONG *buffer2 = new LONG[2000 + 1];

   hr=GenericPush(pOutPipe, buffer2, 500);
   if (FAILED(hr)) {
      MessageBox(NULL, TEXT("PUSH FAILED ON OUTPIPE"), TEXT("CLIENT: ERROR"), MB_SETFOREGROUND);
      cleanup(); return;
   }

   /*
   ** Push 0 to close this sequence
   */

   hr=GenericPush(pOutPipe, buffer2, 0);
   if (FAILED(hr)) {
      MessageBox(NULL, TEXT("PUSH FAILED ON OUTPIPE"), TEXT("CLIENT: ERROR"), MB_SETFOREGROUND);
      cleanup(); return;
   }
   else {
      cout << "RESULT: success !"
           << endl << endl;
   }

   // Resource management
   pOutPipe->Release();
   hr=pSI->Release();
   cleanup();
   return;
}

void pipes_in_in_out ( )

Definition at line 252 of file client.cxx.

{
   cout << endl << "***** Running [In] [In] [Out] Example *****" << endl;

   HRESULT hr = S_OK;

   // Create an instance of the simple class
   ISimpleInterface* pSI;
   if (!CreateInstance(&pSI)) { return; }

   // The client needs to Create In pipes
   IPipeLong* pInPipe1=NULL;
   IPipeLong* pInPipe2=NULL;
   IPipeLong* pOutPipe=NULL;

   // The client needs to Create In pipes
   pInPipe1 = new CSamplePipe();
   pInPipe2 = new CSamplePipe();

   // Pass the pipes to the server as an 'in' parameter.
   // Since the client implements both Pull and Push operations,
   // the server can use these callbacks.
   hr=pSI->InInOutPipesSample(pInPipe1,pInPipe2,&pOutPipe);
   if (FAILED(hr)) {
  MessageBox(NULL, TEXT("Pipes couldn't be used by the server/callee"), TEXT("CLIENT: ERROR"), MB_SETFOREGROUND);
   }
   else
   {
      cout << endl << "Pipes were successfully used by the server/callee." << endl;
   }

   // Resource management
   pInPipe1->Release();
   pInPipe1 = NULL;
   pInPipe2->Release();
   pInPipe2 = NULL;
   pOutPipe->Release();
   pOutPipe=NULL;
   hr=pSI->Release();
   pSI = NULL;
   cleanup();

   return;
}

void usage ( )

Definition at line 23 of file client.cxx.

{
   cout << endl << "Usage: client <OPTION>" << endl << endl
           << "OPTION : PIPE_AS_IN_PARAMETER | PIPE_AS_OUT_PARAMETER | "
           << " PIPE_AS_IN_OUT_PARAMETER | PIPES_AS_IN_IN_OUT_PARAMETERS "
           << endl << endl;
   return;
}

Variable Documentation

LPTSTR g_szMessage

Definition at line 17 of file client.cxx.

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/Pipes/Include/pipe.cxx File Reference

  • Com
  • Fundamentals
  • Pipes
  • Include
Functions

pipe.cxx File Reference

#include "pipe.hxx"

Go to the source code of this file.

Functions

STDMETHODIMP | DrainBuffer (long *buff, DWORD dwElementsCount, DWORD dwStartIdx)
STDMETHODIMP | GenericPull (IPipeLong *pPipe, LONG *buff, ULONG *pPulled, ULONG lElements)
STDMETHODIMP | GenericPush (IPipeLong *pPipe, LONG *buff, ULONG lElements)
STDMETHODIMP | PopulateBuffer (long *buff, DWORD dwElementsCount, DWORD dwStartIdx)
STDMETHODIMP_ (ULONG) CSamplePipe

Function Documentation

STDMETHODIMP DrainBuffer | ( | long * | buff,
 |  | DWORD | dwElementsCount,
 |  | DWORD | dwStartIdx
 | ) |  |

Definition at line 76 of file pipe.cxx.

{
   ULONG i;

   for(i = dwStartIdx; i < dwElementsCount + dwStartIdx; i++)
   {
      // TODO: Need to output data to a file
      if( ULONG(*buff) != i )
      {
         return E_FAIL;
      }
      buff++;
   }
   return S_OK;
};

STDMETHODIMP GenericPull | ( | IPipeLong * | pPipe,
 |  | LONG * | buff,
 |  | ULONG * | pPulled,
 |  | ULONG | lElements
 | ) |  |

Definition at line 15 of file pipe.cxx.

{
   HRESULT hr = S_OK;
   ULONG lcount = 0;
   ULONG lRemain = 0;
   ULONG lTransfer = 0;

   if (0 == lElements) { lRemain = 1; }
   else { lRemain = lElements; }

   do
   {
      if (1 == lRemain) { lTransfer = OPTIMUM_SIZE; }
      else { lTransfer = lRemain; }

      lcount=0;
      hr = pPipe->Pull(buff, lTransfer, &lcount);
      if (FAILED(hr)) { return hr; }

      // Verify the data was pulled properly
      hr = DrainBuffer(buff, lcount, *pPulled);
      if (FAILED(hr)) { return hr; }
      *pPulled = *pPulled + lcount;
      if ( 1 != lRemain )
      { lRemain = lRemain - lcount; }

   } while ( lRemain > 0 && lcount > 0);
   return S_OK;
}

STDMETHODIMP GenericPush | ( | IPipeLong * | pPipe,
 |  | LONG * | buff,
 |  | ULONG | lElements
 | ) |  |

Definition at line 45 of file pipe.cxx.

{
   HRESULT hr = S_OK;
   ULONG lTransfer = 0;

   lTransfer = lElements;
   hr = PopulateBuffer(buff, lTransfer, 0);
   if (FAILED(hr)) { return hr; }

   hr = pPipe->Push(buff, lTransfer);
   if (FAILED(hr)) { return hr; }

   return S_OK;
}

STDMETHODIMP PopulateBuffer | ( | long * | buff,
 |  | DWORD | dwElementsCount,
 |  | DWORD | dwStartIdx
 | ) |  |

Definition at line 62 of file pipe.cxx.

{
   ULONG i;

   for(i = dwStartIdx; i < dwElementsCount + dwStartIdx; i++)
   {
      // Can do something fancy here.
      *buff++ = i;
   }

   return S_OK;
};

STDMETHODIMP_ ( ULONG )

Definition at line 140 of file pipe.cxx.

{
    ULONG cLockedRefs = InterlockedDecrement((LONG *)&m_cRef);
    if( cLockedRefs == 0 )
    {
       delete this;
    }
    return cLockedRefs;
};

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/Pipes/Include/pipe.hxx File Reference

  • Com
  • Fundamentals
  • Pipes
  • Include
Classes | Defines | Functions

pipe.hxx File Reference

#include "objbase.h"
#include "iostream.h"

Go to the source code of this file.

Classes

class | CSamplePipe

Defines

#define | BUF_SIZE 2000;
#define | OPTIMUM_SIZE 800;

Functions

STDMETHODIMP | DrainBuffer (long *buff, DWORD dwElementsCount, DWORD dwStartIdx)
STDMETHODIMP | GenericPull (IPipeLong *pPipe, LONG *buff, ULONG *pPulled, ULONG lElements)
STDMETHODIMP | GenericPush (IPipeLong *pPipe, LONG *buff, ULONG lElements)
STDMETHODIMP | PopulateBuffer (long *buff, DWORD dwElementsCount, DWORD dwStartIdx)

Define Documentation

#define BUF_SIZE 2000;

Definition at line 7 of file pipe.hxx.

#define OPTIMUM_SIZE 800;

Definition at line 8 of file pipe.hxx.

Function Documentation

STDMETHODIMP DrainBuffer | ( | long * | buff,
 |  | DWORD | dwElementsCount,
 |  | DWORD | dwStartIdx
 | ) |  |

Definition at line 76 of file pipe.cxx.

{
   ULONG i;

   for(i = dwStartIdx; i < dwElementsCount + dwStartIdx; i++)
   {
      // TODO: Need to output data to a file
      if( ULONG(*buff) != i )
      {
         return E_FAIL;
      }
      buff++;
   }
   return S_OK;
};

STDMETHODIMP GenericPull | ( | IPipeLong * | pPipe,
 |  | LONG * | buff,
 |  | ULONG * | pPulled,
 |  | ULONG | lElements
 | ) |  |

Definition at line 15 of file pipe.cxx.

{
   HRESULT hr = S_OK;
   ULONG lcount = 0;
   ULONG lRemain = 0;
   ULONG lTransfer = 0;

   if (0 == lElements) { lRemain = 1; }
   else { lRemain = lElements; }

   do
   {
      if (1 == lRemain) { lTransfer = OPTIMUM_SIZE; }
      else { lTransfer = lRemain; }

      lcount=0;
      hr = pPipe->Pull(buff, lTransfer, &lcount);
      if (FAILED(hr)) { return hr; }

      // Verify the data was pulled properly
      hr = DrainBuffer(buff, lcount, *pPulled);
      if (FAILED(hr)) { return hr; }
      *pPulled = *pPulled + lcount;
      if ( 1 != lRemain )
      { lRemain = lRemain - lcount; }

   } while ( lRemain > 0 && lcount > 0);
   return S_OK;
}

STDMETHODIMP GenericPush | ( | IPipeLong * | pPipe,
 |  | LONG * | buff,
 |  | ULONG | lElements
 | ) |  |

Definition at line 45 of file pipe.cxx.

{
   HRESULT hr = S_OK;
   ULONG lTransfer = 0;

   lTransfer = lElements;
   hr = PopulateBuffer(buff, lTransfer, 0);
   if (FAILED(hr)) { return hr; }

   hr = pPipe->Push(buff, lTransfer);
   if (FAILED(hr)) { return hr; }

   return S_OK;
}

STDMETHODIMP PopulateBuffer | ( | long * | buff,
 |  | DWORD | dwElementsCount,
 |  | DWORD | dwStartIdx
 | ) |  |

Definition at line 62 of file pipe.cxx.

{
   ULONG i;

   for(i = dwStartIdx; i < dwElementsCount + dwStartIdx; i++)
   {
      // Can do something fancy here.
      *buff++ = i;
   }

   return S_OK;
};

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/Pipes/Include/pipesample.Idl File Reference

  • Com
  • Fundamentals
  • Pipes
  • Include
Functions | Variables

pipesample.Idl File Reference

Go to the source code of this file.

Functions

library SimpleLib | importlib ("stdole2.tlb")
HRESULT | InInOutPipesSample ([in] IPipeLong *pPipe1,[in] IPipeLong *pPipe2,[out] IPipeLong **ppPipe3)
HRESULT | InOutPipeSample ([in, out] IPipeLong **ppPipe)
HRESULT | OutPipeSample ([out] IPipeLong **ppPipe)

Variables

import unknwn | idl

Function Documentation

library SimpleLib importlib ( "stdole2.tlb" )
HRESULT InInOutPipesSample | ( | [in] IPipeLong * | pPipe1,
 |  | [in] IPipeLong * | pPipe2,
 |  | [out] IPipeLong ** | ppPipe3
 | ) |  |
HRESULT InOutPipeSample ( [in, out] IPipeLong ** ppPipe )
HRESULT OutPipeSample ( [out] IPipeLong ** ppPipe )

Variable Documentation

import objidl idl

Definition at line 1 of file pipesample.Idl.

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/Pipes/LocalServer/component.cxx File Reference

  • Com
  • Fundamentals
  • Pipes
  • LocalServer
Defines | Functions

component.cxx File Reference

#include "component.hxx"
#include "..\include\pipe.hxx"
#include <conio.h>
#include <stdio.h>
#include <tchar.h>

Go to the source code of this file.

Defines

#define PIPE_SIZE 1000;

Functions

STDMETHODIMP_ (ULONG) CSimpleClass

Define Documentation

#define PIPE_SIZE 1000;

Definition at line 15 of file component.cxx.

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 519 of file component.cxx.

{
   ULONG cLockedRefs = InterlockedDecrement((LONG *)&m_cRef);

   if( cLockedRefs == 0 )
   {
      delete this;
      return 0;
   }
   return cLockedRefs;
};

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/Pipes/LocalServer/component.hxx File Reference

  • Com
  • Fundamentals
  • Pipes
  • LocalServer
Classes

component.hxx File Reference

#include "ISimpleInterface.h"
#include <objbase.h>
#include <iostream.h>

Go to the source code of this file.

Classes

class | CFactory
class | CSimpleClass
Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/Pipes/LocalServer/server.cxx File Reference

  • Com
  • Fundamentals
  • Pipes
  • LocalServer
Functions | Variables

server.cxx File Reference

#include <windows.h>
#include <winbase.h>
#include <tchar.h>
#include <conio.h>
#include <iostream.h>
#include "component.hxx"

Go to the source code of this file.

Functions

STDAPI | RegisterServer ()
STDAPI | UnRegisterServer ()
int WINAPI | WinMain (HINSTANCE hInstance, HINSTANCE nPrevInstance, LPSTR lpCmdLine, int nCmdShow)

Variables

DWORD g_dwRegisterClass
HANDLE g_hEvent
const char * | g_RegTable [][3]

Function Documentation

STDAPI RegisterServer ( )

Definition at line 38 of file server.cxx.

{
    HRESULT hr = S_OK;
    HINSTANCE hInstance = 0;
    char szFileName[1000];
    GetModuleFileNameA(hInstance, szFileName, 1000);

    int nEntries = sizeof(g_RegTable)/sizeof(*g_RegTable);
    for (int i=0; SUCCEEDED(hr) && i < nEntries; i++) {
        const char *pszKeyName = g_RegTable[i][0];
        const char *pszValueName = g_RegTable[i][1];
        const char *pszValue = g_RegTable[i][2];

        if (pszValue == (const char*)-1) pszValue = szFileName;
        HKEY hKey;
        long err = RegCreateKeyA(HKEY_CLASSES_ROOT, pszKeyName, &hKey);
        if ( ERROR_SUCCESS == err ) {
           err = RegSetValueExA(hKey, pszValueName, 0, REG_SZ, (const BYTE*)pszValue, (strlen(pszValue) + 1));
           RegCloseKey(hKey);
        }
        if ( ERROR_SUCCESS != err ) {
           UnRegisterServer();
           hr = E_FAIL;  // Need to be specific here
        }
     }
     return hr;
}

STDAPI UnRegisterServer ( )

Definition at line 26 of file server.cxx.

{
    HRESULT hr = S_OK;

    int nEntries = sizeof(g_RegTable)/sizeof(*g_RegTable);
    for (int i=nEntries -1; i >=0; i--) {
        long err = RegDeleteKeyA(HKEY_CLASSES_ROOT, g_RegTable[i][0]);
        if ( ERROR_SUCCESS != err ) hr=S_FALSE;
    }
    return hr;
}

int WINAPI WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | nPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 72 of file server.cxx.

{
    HRESULT hr;
    MSG msg;

    hr=CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
    if (FAILED(hr))
       return hr;

    // Creating a console...

    //AllocConsole();
    //HANDLE hConsoleOutput;
    //hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE);
    //const TCHAR* lpBuffer1 = __TEXT("First Output for console \n");
    //const TCHAR* lpBuffer2 = __TEXT("Second Output for console \n");

    //WriteConsole(hConsoleOutput, lpBuffer1, strlen(lpBuffer1), 0, NULL);
    //WriteConsole(hConsoleOutput, lpBuffer2, strlen(lpBuffer2), 0, NULL);

    //FreeConsole();

    if ( 0 != strstr(lpCmdLine, "/RegServer") ||
         0 != strstr(lpCmdLine, "-RegServer")  ) {
       hr = RegisterServer();
       MessageBox(NULL, NULL, TEXT("PIPE SAMPLE SERVER REGISTERED"), MB_SETFOREGROUND);
       CoUninitialize();
       return 0;
    }
    else if ( 0 != strstr(lpCmdLine, "/UnRegServer") ||
              0 != strstr(lpCmdLine, "-UnRegServer")  ) {
            hr = UnRegisterServer();
            MessageBox(NULL, NULL, TEXT("PIPE SAMPLE SERVER UN-REGISTERED"), MB_SETFOREGROUND);
            CoUninitialize();
            return 0;
    }

    CFactory* pCFactory = new CFactory();

    hr=CoRegisterClassObject(CLSID_SimpleClass, pCFactory, CLSCTX_LOCAL_SERVER, REGCLS_SUSPENDED, &g_dwRegisterClass);
    hr=CoResumeClassObjects();

    if (FAILED(hr)) {
       MessageBox(NULL, TEXT("Failed to register the class object with the SCM"), TEXT("ERROR"), MB_SETFOREGROUND);
    }
    else
    {
       while (GetMessage(&msg, NULL, 0, 0)) {
          DispatchMessage(&msg);
       }
       CoRevokeClassObject(g_dwRegisterClass);
    }
    delete pCFactory;

    CoUninitialize();
    return 0;
}

Variable Documentation

DWORD g_dwRegisterClass

Definition at line 16 of file server.cxx.

HANDLE g_hEvent

Definition at line 17 of file server.cxx.

const char* g_RegTable[][3]
Initial value:
 {
    { "CLSID\\{84f2059a-d9ae-11d2-86a3-00c04f8ef940}",0, "PipeSample" },
    { "CLSID\\{84f2059a-d9ae-11d2-86a3-00c04f8ef940}\\LocalServer32",0,
      (const char*)-1}
    }

Definition at line 19 of file server.cxx.

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpCntr/app.Cpp File Reference

  • Com
  • Fundamentals
  • SimpCntr
Classes | Defines | Functions

app.Cpp File Reference

#include "pre.h"
#include "iocs.h"
#include "ias.h"
#include "ioipf.h"
#include "ioips.h"
#include "app.h"
#include "site.h"
#include "doc.h"
#include "stdpal.h"

Go to the source code of this file.

Classes

struct | LOGPAL

Defines

#define | cpeAppPal 256

Functions

HPALETTE | CreateStandardPalette (void)
STDMETHODIMP_ (ULONG) CSimpleApp
LRESULT | wSelectPalette (HWND hWnd, HPALETTE hPal, BOOL fBackground)

Define Documentation

#define cpeAppPal 256

Definition at line 23 of file app.Cpp.

Function Documentation

HPALETTE CreateStandardPalette ( void )

Definition at line 49 of file app.Cpp.

   {
   HDC hdc;
   HPALETTE hpal;

   hpal = (HPALETTE) NULL;
   hdc = GetDC(NULL);
   if (hdc != NULL && GetDeviceCaps(hdc, RASTERCAPS) & RC_PALETTE)
      {
      int cpeSysPal;
      int cpeReserved;

      cpeSysPal = GetDeviceCaps(hdc, SIZEPALETTE);
      cpeReserved = GetDeviceCaps(hdc, NUMRESERVED);
      if (cpeSysPal > cpeReserved)
         {
         int cpeReserved2;
         unsigned char FAR* lpb;
         PALETTEENTRY FAR* ppe;
         PALETTEENTRY FAR* ppeMac;
         LOGPAL logpal;

         cpeReserved2 = cpeReserved/2;

         // Get the system palette entries at the beginning and end.
         GetSystemPaletteEntries(hdc, 0, cpeReserved2, logpal.rgpe);
         GetSystemPaletteEntries(hdc, cpeSysPal - cpeReserved2, cpeReserved2,
            &logpal.rgpe[cpeAppPal-cpeReserved2]);

         logpal.cpe = cpeAppPal;
         logpal.wVersion = 0x300;

         lpb = (BYTE FAR *) &palSVGA[10];
         ppe = (PALETTEENTRY FAR*)&logpal.rgpe[cpeReserved2];
         ppeMac = (PALETTEENTRY FAR*)&logpal.rgpe[cpeAppPal-cpeReserved2];
         while (ppe < ppeMac)
            {
            ppe->peFlags = PC_NOCOLLAPSE;
            ppe->peRed   = *lpb++;
            ppe->peGreen = *lpb++;
            ppe->peBlue  = *lpb++;
            ppe++;
            }
         hpal = CreatePalette((LOGPALETTE FAR *)&logpal);
         }
      }
   ReleaseDC(NULL, hdc);
   return hpal;
   }

STDMETHODIMP_ ( ULONG )

Definition at line 369 of file app.Cpp.

{
        OutputDebugString("In CSimpleApp::Release\r\n");

        return SafeRelease();
}

LRESULT wSelectPalette | ( | HWND | hWnd,
 |  | HPALETTE | hPal,
 |  | BOOL | fBackground
 | ) |  |

Definition at line 1010 of file app.Cpp.

{
        HDC hdc;
        HPALETTE hOldPal;
        UINT iPalChg = 0;

        if (hPal == 0)
                return (LRESULT)0;

        hdc = GetDC(hWnd);
        hOldPal = SelectPalette(hdc, hPal, fBackground);
        iPalChg = RealizePalette(hdc);
        SelectPalette(hdc, hOldPal, TRUE /*fBackground*/);
        ReleaseDC(hWnd, hdc);

        if (iPalChg > 0)
                InvalidateRect(hWnd, NULL, TRUE);

        return (LRESULT)1;
}

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpCntr/app.h File Reference

  • Com
  • Fundamentals
  • SimpCntr
Classes | Functions

app.h File Reference

#include <ole2.h>
#include <stablize.h>
#include "ioipf.h"

Go to the source code of this file.

Classes

class | CSimpleApp

Functions

LRESULT | wSelectPalette (HWND hWnd, HPALETTE hPal, BOOL fBackground)

Function Documentation

LRESULT wSelectPalette | ( | HWND | hWnd,
 |  | HPALETTE | hPal,
 |  | BOOL | fBackground
 | ) |  |

Definition at line 1010 of file app.Cpp.

{
        HDC hdc;
        HPALETTE hOldPal;
        UINT iPalChg = 0;

        if (hPal == 0)
                return (LRESULT)0;

        hdc = GetDC(hWnd);
        hOldPal = SelectPalette(hdc, hPal, fBackground);
        iPalChg = RealizePalette(hdc);
        SelectPalette(hdc, hOldPal, TRUE /*fBackground*/);
        ReleaseDC(hWnd, hdc);

        if (iPalChg > 0)
                InvalidateRect(hWnd, NULL, TRUE);

        return (LRESULT)1;
}

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpCntr/doc.Cpp File Reference

  • Com
  • Fundamentals
  • SimpCntr
Functions

doc.Cpp File Reference

#include "pre.h"
#include "iocs.h"
#include "ias.h"
#include "ioipf.h"
#include "ioips.h"
#include "app.h"
#include "site.h"
#include "doc.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CSimpleDoc

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 359 of file doc.Cpp.

{
        OutputDebugString("In CSimpleDoc::Release\r\n");

        return SafeRelease();
}

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpCntr/doc.h File Reference

  • Com
  • Fundamentals
  • SimpCntr
Classes

doc.h File Reference

#include <stablize.h>

Go to the source code of this file.

Classes

class CSimpleDoc
Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpCntr/ias.Cpp File Reference

  • Com
  • Fundamentals
  • SimpCntr
Functions

ias.Cpp File Reference

#include "pre.h"
#include "iocs.h"
#include "ias.h"
#include "ioipf.h"
#include "ioips.h"
#include "app.h"
#include "site.h"
#include "doc.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CAdviseSink
STDMETHODIMP_ (void) CAdviseSink

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 133 of file ias.Cpp.

{
        OutputDebugString("In IAS::Release\r\n");

        // decrement the interface reference count (for debugging only)
        m_nCount--;

        // delegate to the container Site
        return m_pSite->Release();
}

STDMETHODIMP_ ( void )

Definition at line 316 of file ias.Cpp.

{
        OutputDebugString("In IAS::OnClose\r\n");
}

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpCntr/ias.h File Reference

  • Com
  • Fundamentals
  • SimpCntr
Functions | Variables

ias.h File Reference

#include <assert.h>

Go to the source code of this file.

Functions

~CAdviseSink ()
CAdviseSink (CSimpleSite FAR *pSite)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID FAR *ppv)
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (void) OnDataChange(FORMATETC FAR *pFormatetc

Variables

LONG | lindex
CSimpleSite FAR * | m_pSite
STGMEDIUM FAR * | pStgmed

Function Documentation

~CAdviseSink ( )

Definition at line 26 of file ias.h.

                 {
    OutputDebugString("In IAS's destructor\r\n");
    assert(m_nCount == 0);
    } ;

CAdviseSink ( CSimpleSite FAR * pSite )

Definition at line 20 of file ias.h.

                                       {
    OutputDebugString("In IAS's constructor\r\n");
    m_pSite = pSite;
    m_nCount = 0;
    };

STDMETHODIMP QueryInterface | ( | REFIID | riid,
 |  | LPVOID FAR * | ppv
 | ) |  |
STDMETHODIMP_ ( ULONG )

Definition at line 398 of file DataObj.Cpp.

{
  TCHAR szText[MAX_PATH];
  wsprintf(szText, TEXT("CEnumFormatEtc::Release - ref count will be %d\n"), m_ObjRefCount - 1);
  OutputDebugString(szText);

  if(0 == --m_ObjRefCount)
  {
    delete this;
    return 0;
  }

  return m_ObjRefCount;
}

STDMETHODIMP_ ( void )

Variable Documentation

LONG lindex

Definition at line 37 of file ias.h.

CSimpleSite FAR* m_pSite

Definition at line 18 of file ias.h.

STGMEDIUM FAR* pStgmed

Definition at line 36 of file ias.h.

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpCntr/iocs.Cpp File Reference

  • Com
  • Fundamentals
  • SimpCntr
Functions

iocs.Cpp File Reference

#include "pre.h"
#include "iocs.h"
#include "ias.h"
#include "ioipf.h"
#include "ioips.h"
#include "app.h"
#include "site.h"
#include "doc.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) COleClientSite

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 124 of file iocs.Cpp.

{
        OutputDebugString("In IOCS::Release\r\n");

        // decrement the interface reference count (for debugging only)
        --m_nCount;

        // delegate to the container Site
        return m_pSite->Release();
}

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpCntr/iocs.h File Reference

  • Com
  • Fundamentals
  • SimpCntr
Functions | Variables

iocs.h File Reference

#include <assert.h>

Go to the source code of this file.

Functions

~COleClientSite ()
COleClientSite (CSimpleSite FAR *pSite)
STDMETHODIMP | GetContainer (LPOLECONTAINER FAR *ppContainer)
STDMETHODIMP | GetMoniker (DWORD dwAssign, DWORD dwWhichMoniker, LPMONIKER FAR *ppmk)
STDMETHODIMP | OnShowWindow (BOOL fShow)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID FAR *ppvObj)
STDMETHODIMP | RequestNewObjectLayout ()
STDMETHODIMP | SaveObject ()
STDMETHODIMP | ShowObject ()
STDMETHODIMP_ (ULONG) AddRef()

Variables

CSimpleSite FAR * | m_pSite

Function Documentation

~COleClientSite ( )

Definition at line 26 of file iocs.h.

                    {
    OutputDebugString("In IOCS's destructor\r\n");
    assert(m_nCount == 0);
    }

COleClientSite ( CSimpleSite FAR * pSite )

Definition at line 20 of file iocs.h.

                                          {
    OutputDebugString("In IOCS's constructor\r\n");
    m_pSite = pSite;
    m_nCount = 0;
    }

STDMETHODIMP GetContainer ( LPOLECONTAINER FAR * ppContainer )
STDMETHODIMP GetMoniker | ( | DWORD | dwAssign,
 |  | DWORD | dwWhichMoniker,
 |  | LPMONIKER FAR * | ppmk
 | ) |  |
STDMETHODIMP OnShowWindow ( BOOL fShow )
STDMETHODIMP QueryInterface | ( | REFIID | riid,
 |  | LPVOID FAR * | ppvObj
 | ) |  |
STDMETHODIMP RequestNewObjectLayout ( )
STDMETHODIMP SaveObject ( )
STDMETHODIMP ShowObject ( )
STDMETHODIMP_ ( ULONG )

Definition at line 398 of file DataObj.Cpp.

{
  TCHAR szText[MAX_PATH];
  wsprintf(szText, TEXT("CEnumFormatEtc::Release - ref count will be %d\n"), m_ObjRefCount - 1);
  OutputDebugString(szText);

  if(0 == --m_ObjRefCount)
  {
    delete this;
    return 0;
  }

  return m_ObjRefCount;
}

Variable Documentation

CSimpleSite FAR* m_pSite

Definition at line 18 of file iocs.h.

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpCntr/ioipf.Cpp File Reference

  • Com
  • Fundamentals
  • SimpCntr
Functions

ioipf.Cpp File Reference

#include "pre.h"
#include "iocs.h"
#include "ias.h"
#include "ioipf.h"
#include "ioips.h"
#include "app.h"
#include "site.h"
#include "doc.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) COleInPlaceFrame

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 123 of file ioipf.Cpp.

{
        OutputDebugString("In IOIPF::Release\r\n");

// delegate to the document object
        m_pApp->Release();

// decrement the interface reference count
        return --m_nCount;
}

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpCntr/ioipf.h File Reference

  • Com
  • Fundamentals
  • SimpCntr
Functions | Variables

ioipf.h File Reference

Go to the source code of this file.

Functions

~COleInPlaceFrame ()
COleInPlaceFrame (CSimpleApp FAR *pApp)
STDMETHODIMP | ContextSensitiveHelp (BOOL fEnterMode)
STDMETHODIMP | EnableModeless (BOOL fEnable)
STDMETHODIMP | GetBorder (LPRECT lprectBorder)
STDMETHODIMP | GetWindow (HWND FAR *lphwnd)
STDMETHODIMP | InsertMenus (HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID FAR *ppv)
STDMETHODIMP | RemoveMenus (HMENU hmenuShared)
STDMETHODIMP | RequestBorderSpace (LPCBORDERWIDTHS lpborderwidths)
STDMETHODIMP | SetActiveObject (LPOLEINPLACEACTIVEOBJECT lpActiveObject, LPCOLESTR lpszObjName)
STDMETHODIMP | SetBorderSpace (LPCBORDERWIDTHS lpborderwidths)
STDMETHODIMP | SetMenu (HMENU hmenuShared, HOLEMENU holemenu, HWND hwndActiveObject)
STDMETHODIMP | SetStatusText (LPCOLESTR lpszStatusText)
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP | TranslateAccelerator (LPMSG lpmsg, WORD wID)

Variables

CSimpleApp FAR * | m_pApp

Function Documentation

~COleInPlaceFrame ( )

Definition at line 25 of file ioipf.h.

                      {
    OutputDebugString("In IOIPFS's destructor\r\n");
    assert(m_nCount == 0);
    };

COleInPlaceFrame ( CSimpleApp FAR * pApp )

Definition at line 19 of file ioipf.h.

                                          {
    OutputDebugString("In IOIPF's constructor\r\n");
    m_pApp = pApp;
    m_nCount = 0;
    };

STDMETHODIMP ContextSensitiveHelp ( BOOL fEnterMode )
STDMETHODIMP EnableModeless ( BOOL fEnable )
STDMETHODIMP GetBorder ( LPRECT lprectBorder )
STDMETHODIMP GetWindow ( HWND FAR * lphwnd )
STDMETHODIMP InsertMenus | ( | HMENU | hmenuShared,
 |  | LPOLEMENUGROUPWIDTHS | lpMenuWidths
 | ) |  |
STDMETHODIMP QueryInterface | ( | REFIID | riid,
 |  | LPVOID FAR * | ppv
 | ) |  |
STDMETHODIMP RemoveMenus ( HMENU hmenuShared )
STDMETHODIMP RequestBorderSpace ( LPCBORDERWIDTHS lpborderwidths )
STDMETHODIMP SetActiveObject | ( | LPOLEINPLACEACTIVEOBJECT | lpActiveObject,
 |  | LPCOLESTR | lpszObjName
 | ) |  |
STDMETHODIMP SetBorderSpace ( LPCBORDERWIDTHS lpborderwidths )
STDMETHODIMP SetMenu | ( | HMENU | hmenuShared,
 |  | HOLEMENU | holemenu,
 |  | HWND | hwndActiveObject
 | ) |  |
STDMETHODIMP SetStatusText ( LPCOLESTR lpszStatusText )
STDMETHODIMP_ ( ULONG )

Definition at line 398 of file DataObj.Cpp.

{
  TCHAR szText[MAX_PATH];
  wsprintf(szText, TEXT("CEnumFormatEtc::Release - ref count will be %d\n"), m_ObjRefCount - 1);
  OutputDebugString(szText);

  if(0 == --m_ObjRefCount)
  {
    delete this;
    return 0;
  }

  return m_ObjRefCount;
}

STDMETHODIMP TranslateAccelerator | ( | LPMSG | lpmsg,
 |  | WORD | wID
 | ) |  |

Variable Documentation

CSimpleApp FAR* m_pApp

Definition at line 17 of file ioipf.h.

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpCntr/ioips.Cpp File Reference

  • Com
  • Fundamentals
  • SimpCntr
Functions

ioips.Cpp File Reference

#include "pre.h"
#include "iocs.h"
#include "ias.h"
#include "ioipf.h"
#include "ioips.h"
#include "app.h"
#include "site.h"
#include "doc.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) COleInPlaceSite

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 124 of file ioips.Cpp.

{
        OutputDebugString("In IOIPS::Release\r\n");
        // decrement the interface reference count (for debugging only)
        m_nCount--;

        // delegate to the container Site
        return m_pSite->Release();
}

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpCntr/ioips.h File Reference

  • Com
  • Fundamentals
  • SimpCntr
Functions | Variables

ioips.h File Reference

Go to the source code of this file.

Functions

~COleInPlaceSite ()
STDMETHODIMP | CanInPlaceActivate ()
COleInPlaceSite (CSimpleSite FAR *pSite)
STDMETHODIMP | ContextSensitiveHelp (BOOL fEnterMode)
STDMETHODIMP | DeactivateAndUndo ()
STDMETHODIMP | DiscardUndoState ()
STDMETHODIMP | GetWindow (HWND FAR *lphwnd)
STDMETHODIMP | GetWindowContext (LPOLEINPLACEFRAME FAR *lplpFrame, LPOLEINPLACEUIWINDOW FAR *lplpDoc, LPRECT lprcPosRect, LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
STDMETHODIMP | OnInPlaceActivate ()
STDMETHODIMP | OnInPlaceDeactivate ()
STDMETHODIMP | OnPosRectChange (LPCRECT lprcPosRect)
STDMETHODIMP | OnUIActivate ()
STDMETHODIMP | OnUIDeactivate (BOOL fUndoable)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID FAR *ppv)
STDMETHODIMP | Scroll (SIZE scrollExtent)
STDMETHODIMP_ (ULONG) AddRef()

Variables

CSimpleSite FAR * | m_pSite

Function Documentation

~COleInPlaceSite ( )

Definition at line 25 of file ioips.h.

                     {
    OutputDebugString("In IOIPS;s destructor\r\n");
    assert(m_nCount == 0);
    };

STDMETHODIMP CanInPlaceActivate ( )
COleInPlaceSite ( CSimpleSite FAR * pSite )

Definition at line 19 of file ioips.h.

                                          {
    OutputDebugString("In IOIPS's constructor\r\n");
    m_pSite = pSite;
    m_nCount = 0;
    };

STDMETHODIMP ContextSensitiveHelp ( BOOL fEnterMode )
STDMETHODIMP DeactivateAndUndo ( )
STDMETHODIMP DiscardUndoState ( )
STDMETHODIMP GetWindow ( HWND FAR * lphwnd )
STDMETHODIMP GetWindowContext | ( | LPOLEINPLACEFRAME FAR * | lplpFrame,
 |  | LPOLEINPLACEUIWINDOW FAR * | lplpDoc,
 |  | LPRECT | lprcPosRect,
 |  | LPRECT | lprcClipRect,
 |  | LPOLEINPLACEFRAMEINFO | lpFrameInfo
 | ) |  |
STDMETHODIMP OnInPlaceActivate ( )
STDMETHODIMP OnInPlaceDeactivate ( )
STDMETHODIMP OnPosRectChange ( LPCRECT lprcPosRect )
STDMETHODIMP OnUIActivate ( )
STDMETHODIMP OnUIDeactivate ( BOOL fUndoable )
STDMETHODIMP QueryInterface | ( | REFIID | riid,
 |  | LPVOID FAR * | ppv
 | ) |  |
STDMETHODIMP Scroll ( SIZE scrollExtent )
STDMETHODIMP_ ( ULONG )

Definition at line 398 of file DataObj.Cpp.

{
  TCHAR szText[MAX_PATH];
  wsprintf(szText, TEXT("CEnumFormatEtc::Release - ref count will be %d\n"), m_ObjRefCount - 1);
  OutputDebugString(szText);

  if(0 == --m_ObjRefCount)
  {
    delete this;
    return 0;
  }

  return m_ObjRefCount;
}

Variable Documentation

CSimpleSite FAR* m_pSite

Definition at line 17 of file ioips.h.

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpCntr/pre.h File Reference

  • Com
  • Fundamentals
  • SimpCntr

pre.h File Reference

#include <windows.h>
#include <ole2.h>
#include "OLEDLG.h"
#include <assert.h>
#include <string.h>
#include "simpcntr.h"
#include "resource.h"
#include <ole2ver.h>
#include "resource.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpCntr/Resource.h File Reference

  • Com
  • Fundamentals
  • SimpCntr
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | ID_EDIT_INSERTOBJECT 111
#define | IDM_COPY 109
#define | IDM_CUT 108
#define | IDM_EXIT 106
#define | IDM_INSERTOBJECT 111
#define | IDM_NEW 112
#define | IDM_OPEN 102
#define | IDM_PASTE 110
#define | IDM_PRINT 105
#define | IDM_SAVE 103
#define | IDM_SAVEAS 104
#define | IDM_UNDO 107

Define Documentation

#define ID_EDIT_INSERTOBJECT 111

Definition at line 14 of file Resource.h.

#define IDM_COPY 109

Definition at line 12 of file Resource.h.

#define IDM_CUT 108

Definition at line 11 of file Resource.h.

#define IDM_EXIT 106

Definition at line 9 of file Resource.h.

#define IDM_INSERTOBJECT 111

Definition at line 15 of file Resource.h.

#define IDM_NEW 112

Definition at line 16 of file Resource.h.

#define IDM_OPEN 102

Definition at line 5 of file Resource.h.

#define IDM_PASTE 110

Definition at line 13 of file Resource.h.

#define IDM_PRINT 105

Definition at line 8 of file Resource.h.

#define IDM_SAVE 103

Definition at line 6 of file Resource.h.

#define IDM_SAVEAS 104

Definition at line 7 of file Resource.h.

#define IDM_UNDO 107

Definition at line 10 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpCntr/SimpCntr.Cpp File Reference

  • Com
  • Fundamentals
  • SimpCntr
Functions | Variables

SimpCntr.Cpp File Reference

#include "pre.h"
#include "iocs.h"
#include "ias.h"
#include "ioipf.h"
#include "ioips.h"
#include "app.h"
#include "site.h"
#include "doc.h"

Go to the source code of this file.

Functions

BOOL FAR PASCAL EXPORT | About (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
long FAR PASCAL EXPORT | DocWndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
long FAR PASCAL EXPORT | MainWndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
int PASCAL | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

Variables

CSimpleApp FAR * | lpCSimpleApp

Function Documentation

BOOL FAR PASCAL EXPORT About | ( | HWND | hDlg,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 254 of file SimpCntr.Cpp.

{
        switch (message) {
        case WM_INITDIALOG:                /* message: initialize dialog box */
                return (TRUE);

        case WM_COMMAND:                      /* message: received a command */
                //@@WTK WIN32, UNICODE
                if (LOWORD(wParam) == IDOK                /* "OK" box selected?          */
                || LOWORD(wParam) == IDCANCEL) {      /* System menu close command? */
                        EndDialog(hDlg, TRUE);        /* Exits the dialog box        */
                        return (TRUE);
                }
                break;
        }
        return (FALSE);                           /* Didn't process a message    */
}

long FAR PASCAL EXPORT DocWndProc | ( | HWND | hWnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 311 of file SimpCntr.Cpp.

{
        HDC hDC;
        PAINTSTRUCT ps;

        switch (message) {
                case WM_PAINT:

                        hDC = BeginPaint(hWnd, &ps);

                        if (lpCSimpleApp)
                                lpCSimpleApp->PaintApp (hDC);

                        EndPaint(hWnd, &ps);
                        break;

                case WM_LBUTTONDBLCLK:
                        {
                        POINT pt;

                        pt.x = (int)(short)LOWORD (lParam );
                        pt.y = (int)(short)HIWORD (lParam );

                        if (lpCSimpleApp->m_lpDoc->m_lpSite &&
                                lpCSimpleApp->m_lpDoc->m_lpSite->m_lpOleObject)
                                {
                                RECT rect;

                                lpCSimpleApp->m_lpDoc->m_lpSite->GetObjRect(&rect);

                                if ( PtInRect(&rect, pt) )
                                        {
                                        // Execute object's default verb
                                        lpCSimpleApp->m_lpDoc->m_lpSite->m_lpOleObject->DoVerb(
                                                        OLEIVERB_PRIMARY, (LPMSG)&message,
                                                        &lpCSimpleApp->m_lpDoc->m_lpSite->m_OleClientSite,
                                                        -1, hWnd, &rect);
                                        }
                                }
                        }
                        break;

        // no code is added to WM_LBUTTONDOWN for context sensitive help, because
        // this app does not do context sensitive help.
        case WM_LBUTTONDOWN:

                LPOLEINPLACEOBJECT lpObject;

                if (lpCSimpleApp->m_lpDoc->m_fInPlaceActive)
                        {
                        lpCSimpleApp->m_lpDoc->m_lpSite->m_lpOleObject->QueryInterface(IID_IOleInPlaceObject, (LPVOID FAR *)&lpObject);
                        lpObject->UIDeactivate();

                        // this code is needed because we don't support inside out.
                        RECT rect;
                        lpCSimpleApp->m_lpDoc->m_lpSite->GetObjRect(&rect);
                        lpCSimpleApp->m_lpDoc->m_lpSite->m_lpOleObject->DoVerb(OLEIVERB_HIDE, (LPMSG)&message, &lpCSimpleApp->m_lpDoc->m_lpSite->m_OleClientSite, -1, hWnd, &rect);

                        lpObject->Release();
                        }

                break;

                default:                          /* Passes it on if unproccessed */
                        return (DefWindowProc(hWnd, message, wParam, lParam));
        }
        return (NULL);
}

long FAR PASCAL EXPORT MainWndProc | ( | HWND | hWnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 144 of file SimpCntr.Cpp.

{

        switch (message)
                {
                case WM_COMMAND:           // message: command from application menu
                        return lpCSimpleApp->lCommandHandler(hWnd, message, wParam, lParam);
                        break;

                case WM_CREATE:
                        return lpCSimpleApp->lCreateDoc(hWnd, message, wParam, lParam);
                        break;

                case WM_DESTROY:                  // message: window being destroyed
                        lpCSimpleApp->DestroyDocs();  // need to destroy the doc...
                        PostQuitMessage(0);
                        break;

                case WM_INITMENUPOPUP:
                        // is this the edit menu?
                        // Message packing is the same for WIN16 and 32
                        if ( LOWORD(lParam) == 1)
                                return lpCSimpleApp->m_lpDoc->lAddVerbs();

                        break;

                // this code is needed for 256 color objects to work properly.
                case WM_QUERYNEWPALETTE:
                        if (! lpCSimpleApp->m_fAppActive)
                                return 0L;

                        return lpCSimpleApp->QueryNewPalette();

                case WM_PALETTECHANGED:
                {
                        HWND hWndPalChg = (HWND) wParam;

                        if (hWnd != hWndPalChg)
                                wSelectPalette(hWnd, lpCSimpleApp->m_hStdPal, TRUE/*fBackground*/);

                        /* OLE2NOTE: always forward the WM_PALETTECHANGED message (via
                        **    SendMessage) to any in-place objects that currently have
                        **    their window visible. this gives these objects the chance
                        **    to select their palettes. this is
                        **    REQUIRED by all in-place containers independent of
                        **    whether they use color palettes themselves--their objects
                        **    may use color palettes.
                        **    (see ContainerDoc_ForwardPaletteChangedMsg for more info)
                        */
                        if (lpCSimpleApp->m_lpDoc && lpCSimpleApp->m_lpDoc->m_lpSite &&
                                lpCSimpleApp->m_lpDoc->m_lpSite->m_hwndIPObj)
                                SendMessage(lpCSimpleApp->m_lpDoc->m_lpSite->m_hwndIPObj,
                                                WM_PALETTECHANGED, wParam, lParam);

                        return 0L;
                }

                case WM_ACTIVATEAPP:
                        if ((lpCSimpleApp->m_fAppActive = (BOOL)wParam) == TRUE)
                                lpCSimpleApp->QueryNewPalette();

                        if (lpCSimpleApp->m_lpDoc->m_lpActiveObject) {
                                lpCSimpleApp->m_lpDoc->m_lpActiveObject->OnFrameWindowActivate(
                                                (BOOL)wParam);
                        }
                        break;

                case WM_SIZE:
                        return lpCSimpleApp->lSizeHandler(hWnd, message, wParam, lParam);

                default:                          // Passes it on if unproccessed
                        return (DefWindowProc(hWnd, message, wParam, lParam));
                }
                return (NULL);
}

int PASCAL WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 65 of file SimpCntr.Cpp.

{
        MSG msg;

        // needed for LRPC to work properly...
        SetMessageQueue(96);

        lpCSimpleApp = new CSimpleApp;

        // we will add one ref count on our App. later when we want to destroy
        // the App object we will release this  ref count. when the App's ref
        // count goes to 0, it will be deleted.
        lpCSimpleApp->AddRef();

        // app initialization
        if (!hPrevInstance)
                if (!lpCSimpleApp->fInitApplication(hInstance))
                        return (FALSE);

        // instance initialization
        if (!lpCSimpleApp->fInitInstance(hInstance, nCmdShow))
                return (FALSE);

        // message loop
        while (GetMessage(&msg, NULL, NULL, NULL))
                if (!lpCSimpleApp->HandleAccelerators(&msg))
                        {
                        TranslateMessage(&msg);    /* Translates virtual key codes */
                        DispatchMessage(&msg);     /* Dispatches message to window */
                        }

        // Release the ref count added on the App above. this will make
        // the App's ref count go to 0, and the App object will be deleted.
        lpCSimpleApp->Release();

        return (msg.wParam);          /* Returns the value from PostQuitMessage */
}

Variable Documentation

CSimpleApp FAR* lpCSimpleApp

Definition at line 25 of file SimpCntr.Cpp.

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpCntr/SimpCntr.h File Reference

  • Com
  • Fundamentals
  • SimpCntr
Defines | Functions

SimpCntr.h File Reference

Go to the source code of this file.

Defines

#define | EXPORT __export
#define | IDM_ABOUT 100
#define | IDM_INSERT 101
#define | IDM_VERB0 1000

Functions

BOOL FAR PASCAL EXPORT | About (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
long FAR PASCAL EXPORT | DocWndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
BOOL | InitApplication (HANDLE hInstance)
BOOL | InitInstance (HANDLE hInstance, int nCmdShow)
long FAR PASCAL EXPORT | MainWndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
int PASCAL | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

Define Documentation

#define EXPORT __export

Definition at line 14 of file SimpCntr.h.

#define IDM_ABOUT 100

Definition at line 6 of file SimpCntr.h.

#define IDM_INSERT 101

Definition at line 7 of file SimpCntr.h.

#define IDM_VERB0 1000

Definition at line 8 of file SimpCntr.h.

Function Documentation

BOOL FAR PASCAL EXPORT About | ( | HWND | hDlg,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 445 of file Generic.C.

{
   static  HFONT hfontDlg;    // Font for dialog text
   static   HFONT hFinePrint; // Font for 'fine print' in dialog
   DWORD   dwVerInfoSize;     // Size of version information block
   LPSTR   lpVersion;         // String pointer to 'version' text
   DWORD   dwVerHnd=0;        // An 'ignored' parameter, always '0'
   UINT    uVersionLen;
   WORD    wRootLen;
   BOOL    bRetCode;
   int     i;
   char    szFullPath[BUFFSIZE];
   char    szResult[BUFFSIZE];
   char    szGetName[BUFFSIZE];
   DWORD dwVersion;
   char  szVersion[40];
   DWORD dwResult;
   HRESULT hRes;

   switch (message) {
        case WM_INITDIALOG:
         ShowWindow (hDlg, SW_HIDE);

         if (PRIMARYLANGID(GetUserDefaultLangID()) == LANG_JAPANESE)
         {
            hfontDlg = CreateFont(14, 0, 0, 0, 0, 0, 0, 0, SHIFTJIS_CHARSET, 0, 0, 0,
                                  VARIABLE_PITCH | FF_DONTCARE, "");
            hFinePrint = CreateFont(11, 0, 0, 0, 0, 0, 0, 0, SHIFTJIS_CHARSET, 0, 0, 0,
                                    VARIABLE_PITCH | FF_DONTCARE, "");
         }
         else
         {
            hfontDlg = CreateFont(14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                  VARIABLE_PITCH | FF_SWISS, "");
            hFinePrint = CreateFont(11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                    VARIABLE_PITCH | FF_SWISS, "");
         }

         CenterWindow (hDlg, GetWindow (hDlg, GW_OWNER));
         GetModuleFileName (hInst, szFullPath, sizeof(szFullPath));

         // Now lets dive in and pull out the version information:
         dwVerInfoSize = GetFileVersionInfoSize(szFullPath, &dwVerHnd);
         if (dwVerInfoSize) {
            LPSTR   lpstrVffInfo;
            HANDLE  hMem;
            hMem = GlobalAlloc(GMEM_MOVEABLE, dwVerInfoSize);
            lpstrVffInfo  = GlobalLock(hMem);
            GetFileVersionInfo(szFullPath, dwVerHnd, dwVerInfoSize, lpstrVffInfo);
            // The below 'hex' value looks a little confusing, but
            // essentially what it is, is the hexidecimal representation
            // of a couple different values that represent the language
            // and character set that we are wanting string values for.
            // 040904E4 is a very common one, because it means:
            //   US English, Windows MultiLingual characterset
            // Or to pull it all apart:
            // 04------        = SUBLANG_ENGLISH_USA
            // --09----        = LANG_ENGLISH
            // --11----        = LANG_JAPANESE
            // ----04E4 = 1252 = Codepage for Windows:Multilingual

            // Use safe string handling
            szGetName[sizeof(szGetName) - 1] = '\0';
            lstrcpyn(szGetName, GetStringRes(IDS_VER_INFO_LANG), sizeof(szGetName) - 1);
            if (szGetName[sizeof(szGetName) - 1] != '\0') {
                return FALSE; // Buffer overflow error
            }

            wRootLen = (WORD) lstrlen(szGetName); // Save this position

            // Set the title of the dialog using safe string handling
            hRes = StringCchCatN(szGetName, sizeof(szGetName), "ProductName", sizeof("ProductName"));
            if (FAILED(hRes)) {
                return FALSE; // Buffer overflow error
            }

            bRetCode = VerQueryValue((LPVOID)lpstrVffInfo,
               (LPSTR)szGetName,
               (LPVOID)&lpVersion,
               (UINT *)&uVersionLen);

            // Notice order of version and string...
            if (PRIMARYLANGID(GetUserDefaultLangID()) == LANG_JAPANESE)
            {
                // Use safe string handling
                hRes = StringCchCopyN(szResult, sizeof(szResult), lpVersion, lstrlen(lpVersion));
                if (FAILED(hRes)) {
                    return FALSE; // Buffer overflow error
                }
                hRes = StringCchCatN(szResult, sizeof(szResult), " ‚Ìƒo[ƒWƒ‡ƒ“î•ñ", sizeof(" ‚Ìƒo[ƒWƒ‡ƒ“î•ñ"));
                if (FAILED(hRes)) {
                    return FALSE; // Buffer overflow error
                }
            }
            else
            {
                // Use safe string handling
                hRes = StringCchCopyN(szResult, sizeof(szResult), "About ", sizeof("About "));
                if (FAILED(hRes)) {
                    return FALSE; // Buffer overflow error
                }
                hRes = StringCchCatN(szResult, sizeof(szResult), lpVersion, lstrlen(lpVersion));
                if (FAILED(hRes)) {
                    return FALSE; // Buffer overflow error
                }
            }

            // -----------------------------------------------------

            SetWindowText (hDlg, szResult);

            // Walk through the dialog items that we want to replace:
            for (i = DLG_VERFIRST; i <= DLG_VERLAST; i++) {
               GetDlgItemText(hDlg, i, szResult, sizeof(szResult));
               szGetName[wRootLen] = (char)0;
               // Use safe sting handling
               hRes = StringCchCatN(szGetName, sizeof(szGetName), szResult, sizeof(szResult));
               if (FAILED(hRes)) {
                   return FALSE; // Buffer overflow error
               }
               uVersionLen   = 0;
               lpVersion     = NULL;
               bRetCode      =  VerQueryValue((LPVOID)lpstrVffInfo,
                  (LPSTR)szGetName,
                  (LPVOID)&lpVersion,
                  (UINT *)&uVersionLen);

               if ( bRetCode && uVersionLen && lpVersion) {
                   // Replace dialog item text with version info
                   // Use safe string handling
                   hRes = StringCchCopyN(szResult, sizeof(szResult), lpVersion, lstrlen(lpVersion));
                   if (FAILED(hRes)) {
                       return FALSE; // Buffer overflow error
                   }
                   SetDlgItemText(hDlg, i, szResult);
               }
               else
               {
                  dwResult = GetLastError();

                  // Use safe string handling
                  hRes = StringCchPrintf(szResult, sizeof(szResult), GetStringRes(IDS_VERSION_ERROR), dwResult);
                  if (FAILED(hRes)) {
                      return FALSE; // Buffer overflow error
                  }

                  SetDlgItemText (hDlg, i, szResult);
               }
               SendMessage (GetDlgItem (hDlg, i), WM_SETFONT,
                  (ULONG_PTR)((i==DLG_VERLAST)?hFinePrint:hfontDlg),
                  TRUE);
            } // for (i = DLG_VERFIRST; i <= DLG_VERLAST; i++)

            GlobalUnlock(hMem);
            GlobalFree(hMem);

         } else {
            // No version information available.
         } // if (dwVerInfoSize)

            SendMessage (GetDlgItem (hDlg, IDC_LABEL), WM_SETFONT,
            (WPARAM)hfontDlg,(LPARAM)TRUE);

         // We are  using GetVersion rather then GetVersionEx
         // because earlier versions of Windows NT and Win32s
         // didn't include GetVersionEx:
         dwVersion = GetVersion();

         if (dwVersion < 0x80000000) {
            // Windows NT
            // Use safe sting handling
            hRes = StringCchPrintf(szVersion, sizeof(szVersion), "Microsoft Windows NT %u.%u (Build: %u)",
                (DWORD)(LOBYTE(LOWORD(dwVersion))),
                (DWORD)(HIBYTE(LOWORD(dwVersion))),
                (DWORD)(HIWORD(dwVersion)) );
            if (FAILED(hRes)) {
                return FALSE; // Buffer overflow error
            }
         } else if (LOBYTE(LOWORD(dwVersion))<4) {
            // Win32s
            // Use safe sting handling
            hRes = StringCchPrintf(szVersion, sizeof(szVersion), "Microsoft Win32s %u.%u (Build: %u)",
                (DWORD)(LOBYTE(LOWORD(dwVersion))),
                (DWORD)(HIBYTE(LOWORD(dwVersion))),
                (DWORD)(HIWORD(dwVersion) & ~0x8000) );
            if (FAILED(hRes)) {
                return FALSE; // Buffer overflow error
            }
         } else {
            // Windows 95
            // Use safe sting handling
            hRes = StringCchPrintf(szVersion, sizeof(szVersion), "Microsoft Windows 95 %u.%u",
                (DWORD)(LOBYTE(LOWORD(dwVersion))),
                (DWORD)(HIBYTE(LOWORD(dwVersion))) );
            if (FAILED(hRes)) {
                return FALSE; // Buffer overflow error
            }
         }

          SetWindowText (GetDlgItem(hDlg, IDC_OSVERSION), szVersion);
         ShowWindow (hDlg, SW_SHOW);
         return (TRUE);

      case WM_COMMAND:
         if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) {
            EndDialog(hDlg, TRUE);
            DeleteObject (hfontDlg);
            DeleteObject (hFinePrint);
            return (TRUE);
         }
         break;
   }

    return FALSE;
}

long FAR PASCAL EXPORT DocWndProc | ( | HWND | hWnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 311 of file SimpCntr.Cpp.

{
        HDC hDC;
        PAINTSTRUCT ps;

        switch (message) {
                case WM_PAINT:

                        hDC = BeginPaint(hWnd, &ps);

                        if (lpCSimpleApp)
                                lpCSimpleApp->PaintApp (hDC);

                        EndPaint(hWnd, &ps);
                        break;

                case WM_LBUTTONDBLCLK:
                        {
                        POINT pt;

                        pt.x = (int)(short)LOWORD (lParam );
                        pt.y = (int)(short)HIWORD (lParam );

                        if (lpCSimpleApp->m_lpDoc->m_lpSite &&
                                lpCSimpleApp->m_lpDoc->m_lpSite->m_lpOleObject)
                                {
                                RECT rect;

                                lpCSimpleApp->m_lpDoc->m_lpSite->GetObjRect(&rect);

                                if ( PtInRect(&rect, pt) )
                                        {
                                        // Execute object's default verb
                                        lpCSimpleApp->m_lpDoc->m_lpSite->m_lpOleObject->DoVerb(
                                                        OLEIVERB_PRIMARY, (LPMSG)&message,
                                                        &lpCSimpleApp->m_lpDoc->m_lpSite->m_OleClientSite,
                                                        -1, hWnd, &rect);
                                        }
                                }
                        }
                        break;

        // no code is added to WM_LBUTTONDOWN for context sensitive help, because
        // this app does not do context sensitive help.
        case WM_LBUTTONDOWN:

                LPOLEINPLACEOBJECT lpObject;

                if (lpCSimpleApp->m_lpDoc->m_fInPlaceActive)
                        {
                        lpCSimpleApp->m_lpDoc->m_lpSite->m_lpOleObject->QueryInterface(IID_IOleInPlaceObject, (LPVOID FAR *)&lpObject);
                        lpObject->UIDeactivate();

                        // this code is needed because we don't support inside out.
                        RECT rect;
                        lpCSimpleApp->m_lpDoc->m_lpSite->GetObjRect(&rect);
                        lpCSimpleApp->m_lpDoc->m_lpSite->m_lpOleObject->DoVerb(OLEIVERB_HIDE, (LPMSG)&message, &lpCSimpleApp->m_lpDoc->m_lpSite->m_OleClientSite, -1, hWnd, &rect);

                        lpObject->Release();
                        }

                break;

                default:                          /* Passes it on if unproccessed */
                        return (DefWindowProc(hWnd, message, wParam, lParam));
        }
        return (NULL);
}

BOOL InitApplication ( HANDLE hInstance )

Definition at line 123 of file ClipText.c.

{
    WNDCLASS  wc = {0};

    wc.lpfnWndProc = (WNDPROC) MainWndProc;
    wc.hInstance = hInstance;
    wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
    wc.hCursor = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
    wc.lpszMenuName =  TEXT("CliptextMenu");
    wc.lpszClassName = TEXT("CliptextWClass");

    return (RegisterClass(&wc));
}

BOOL InitInstance | ( | HANDLE | hInstance,
 |  | int | nCmdShow
 | ) |  |

Definition at line 187 of file IconPRO.C.

{
    BOOL bSuccess = TRUE;

    hInst = hInstance;
    hWndMain = CreateWindow(
        szAppName,
        szTitle,
        WS_OVERLAPPEDWINDOW,
        CW_USEDEFAULT, 0,
        CW_USEDEFAULT, 0,
        NULL, NULL, hInstance, NULL );

    if( hWndMain == NULL )
    {
        bSuccess = FALSE;
        goto exit_func;
    }

    ShowWindow( hWndMain, nCmdShow );
    bSuccess = UpdateWindow( hWndMain );

exit_func:
    return bSuccess;
}

long FAR PASCAL EXPORT MainWndProc | ( | HWND | hWnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 3333 of file sdkdiff.cpp.

{
    char str[32];
    long ret;
    DWORD threadid;
  HRESULT hr;

    switch (message) {

        case WM_CREATE:

            /* initialise menu options to default/saved
             * option settings
             */

#define CHECKMENU(id, fChecked)  \
          CheckMenuItem(hMenu, (id), (fChecked) ? MF_CHECKED:MF_UNCHECKED)

            /* outline_include options */
            CHECKMENU(IDM_OUTLINE_INCSAME,   (outline_include & INCLUDE_SAME));
            CHECKMENU(IDM_OUTLINE_INCLEFT,   (outline_include & INCLUDE_LEFTONLY));
            CHECKMENU(IDM_OUTLINE_INCRIGHT,  (outline_include & INCLUDE_RIGHTONLY));
            CHECKMENU(IDM_OUTLINE_INCDIFFER, (outline_include & INCLUDE_DIFFER));

            /* expand_include options */
            CHECKMENU(IDM_EXPAND_INCSAME,         (expand_include & INCLUDE_SAME));
            CHECKMENU(IDM_EXPAND_INCLEFT,         (expand_include & INCLUDE_LEFTONLY));
            CHECKMENU(IDM_EXPAND_INCRIGHT,        (expand_include & INCLUDE_RIGHTONLY));
            CHECKMENU(IDM_EXPAND_INCMOVEDLEFT,    (expand_include & INCLUDE_MOVEDLEFT));
            CHECKMENU(IDM_EXPAND_INCMOVEDRIGHT,   (expand_include & INCLUDE_MOVEDRIGHT));
            CHECKMENU(IDM_EXPAND_INCSIMILARLEFT,  (expand_include & INCLUDE_SIMILARLEFT));
            CHECKMENU(IDM_EXPAND_INCSIMILARRIGHT, (expand_include & INCLUDE_SIMILARRIGHT));

            /* other options */
            CHECKMENU(line_numbers, TRUE);
            CHECKMENU(expand_mode, TRUE);
            CHECKMENU(IDM_IGNBLANKS, ignore_blanks);
            CHECKMENU(IDM_SHOWWHITESPACE, show_whitespace);
            CHECKMENU(IDM_ALG2, Algorithm2);
            CHECKMENU(IDM_MONOCOLS, mono_colours);
            CHECKMENU(IDM_PICTURE, picture_mode);
            CHECKMENU(IDM_HIDEMARK, hide_markedfiles);
#undef CHECKMENU

            /* nothing currently displayed */
            DisplayMode = MODE_NULL;

            break;

        case WM_SYSCOLORCHANGE:
            {
                HIGHCONTRAST hc;

                hc.cbSize = sizeof(hc);
                SystemParametersInfo(SPI_GETHIGHCONTRAST,0 ,&hc, 0);

                mono_colours = (hc.dwFlags & HCF_HIGHCONTRASTON);
                if (mono_colours) {
                    SetMonoColours();
                } else {
                    SetColours();
                }

                CheckMenuItem(hMenu, IDM_MONOCOLS,
                              mono_colours? MF_CHECKED:MF_UNCHECKED);
                hr = StringCchPrintf(str, 32, szD, mono_colours);
        if (FAILED(hr))
          OutputError(hr, IDS_SAFE_PRINTF);
                WriteProfileString(APPNAME, szMonoColours, str);
                SendMessage(hwndRCD, message, wParam, lParam);
                SendMessage(hwndStatus, message, wParam, lParam);
                SendMessage(hwndBar, message, wParam, lParam);

                /* The diffs are still valid, but force a re-display
                 * of bar window and main table.
                 */
                SendMessage(hwndBar, WM_COMMAND, IDM_MONOCOLS, 0);
                InvalidateRect(hwndBar, NULL, TRUE);
                view_changeviewoptions(current_view);
            }
            break;

        case WM_COMMAND:
            switch (GET_WM_COMMAND_ID(wParam, lParam)) {
                case IDM_EXIT:
                    if (ghThread!=NULL) {
                        bAbort = TRUE;
                        SetStatus(LoadRcString(IDS_ABORT_PENDING));
                        break;
                    }
                    if (!view_isexpanded(current_view)) {
                        /* save the current outline size and position */
                        WINDOWPLACEMENT wp;
                        wp.length = sizeof(wp);
                        if (GetWindowPlacement(hwndClient,&wp)) {
                            WriteProfileInt(APPNAME, szOutlineShowCmd, wp.showCmd);
                            WriteProfileInt(APPNAME, szOutlineMaxX, wp.ptMaxPosition.x);
                            WriteProfileInt(APPNAME, szOutlineMaxY, wp.ptMaxPosition.y);
                            WriteProfileInt(APPNAME, szOutlineNormLeft, wp.rcNormalPosition.left);
                            WriteProfileInt(APPNAME, szOutlineNormTop, wp.rcNormalPosition.top);
                            WriteProfileInt(APPNAME, szOutlineNormRight, wp.rcNormalPosition.right);
                            WriteProfileInt(APPNAME, szOutlineNormBottom, wp.rcNormalPosition.bottom);
                            WriteProfileInt(APPNAME, szOutlineSaved, 1);
                        }
                    } else {
                        /* save the current expanded size and position */
                        WINDOWPLACEMENT wp;
                        wp.length = sizeof(wp);
                        if (GetWindowPlacement(hwndClient,&wp)) {
                            WriteProfileInt(APPNAME, szExpandShowCmd, wp.showCmd);
                            WriteProfileInt(APPNAME, szExpandMaxX, wp.ptMaxPosition.x);
                            WriteProfileInt(APPNAME, szExpandMaxY, wp.ptMaxPosition.y);
                            WriteProfileInt(APPNAME, szExpandNormLeft, wp.rcNormalPosition.left);
                            WriteProfileInt(APPNAME, szExpandNormTop, wp.rcNormalPosition.top);
                            WriteProfileInt(APPNAME, szExpandNormRight, wp.rcNormalPosition.right);
                            WriteProfileInt(APPNAME, szExpandNormBottom, wp.rcNormalPosition.bottom);
                            WriteProfileInt(APPNAME, szExpandedSaved, 1);
                        }
                    }
                    DestroyWindow(hWnd);
                    break;

                case IDM_ABORT:
                    /* abort menu item, or status bar button.
                     * the status bar button text gives the appropriate
                     * action depending on our state - abort, outline
                     * or expand. But the command sent is always
                     * IDM_ABORT. Thus we need to check the state
                     * to see what to do. If we are busy, set the abort
                     * flag. If there is nothing to view,
                     * exit, otherwise switch outline<->expand
                     */
                    if (IsBusy()) {
                        bAbort = TRUE;
                        SetStatus(LoadRcString(IDS_ABORT_PENDING));
                    } else if (DisplayMode == MODE_NULL) {
                        DestroyWindow(hWnd);
                    } else if (DisplayMode == MODE_EXPAND) {
                        ToOutline(hWnd);
                    } else {
                        ToExpand(hWnd);
                    }
                    break;

                case IDM_FILE:
                    /* select two files and compare them */
                    if (SetBusy()) {

                        /* close the current view */
                        view_close(current_view);

                        /* make a new empty view */
                        current_view = view_new(hwndRCD);

                        /* make a COMPLIST using the files dialog,
                         * and notify the view
                         */
                        if (complist_filedialog(current_view) == NULL) {
                            view_close(current_view);
                        }

                        /* all done! */
                        SetNotBusy();
                    } else {
                        BusyError();
                    }
                    break;

                case IDM_DIR:

                    /* read two directory names, scan them and
                     * compare all the files and subdirs.
                     */
                    if (SetBusy()) {

                        /* close the current view */
                        view_close(current_view);

                        /* make a new empty view */
                        current_view = view_new(hwndRCD);

                        ghThread = CreateThread(NULL, 0, wd_dirdialog,
                                                (LPVOID) current_view, 0, &threadid);

                        if (ghThread == NULL)
                        {

                            /*
                             * either we are on WIN16, or the
                             * thread call failed. continue
                             * single-threaded.
                             */
                            wd_dirdialog( (LPVOID) current_view);

                        }

                    } else {
                        BusyError();
                    }
                    break;

                case IDM_CLOSE:
                    /* close the output list -
                     * discard all results so far
                     */
                    if (!IsBusy()) {
                        view_close(current_view);
                    }
                    break;

                case IDM_PRINT:
                    /* print the current view -
                     * either the outline list of filenames,
                     * or the currently expanded file.
                     */
                    if (!IsBusy()) {
                        DoPrint();
                    } else {
                        BusyError();
                    }
                    break;

                case IDM_TIME:
                    /* show time it took */
                    {       char msg[50];
                        DWORD tim;
                        if (IsBusy()) {
                            BusyError();
                        } else {
                            tim = complist_querytime();
                            hr = StringCchPrintf(msg, 50, LoadRcString(IDS_SECONDS), tim/1000, tim%1000);
              if (FAILED(hr))
                OutputError(hr, IDS_SAFE_PRINTF);
                            Trace_Status(msg);
                        }
                    }
                    break;

                case IDM_TRACE:
                    /* enable tracing */
                    bTrace = TRUE;
                    Trace_Status(LoadRcString(IDS_TRACING_ENABLED));
                    break;

                case IDM_TRACEOFF:
                    /* enable tracing */
                    bTrace = FALSE;
                    Trace_Status(LoadRcString(IDS_TRACING_DISABLED));
                    break;

                case IDM_SAVELIST:
                    /* allow user to save list of same/different files
                     * to a text file. dialog box to give filename
                     * and select which types of file to include
                     */
                    if (current_view == NULL) {
                        MessageBox(hWnd,
                                   LoadRcString(IDS_CREATE_DIFF_LIST),
                                   szSdkDiff, MB_OK|MB_ICONSTOP);
                        break;
                    }

                    complist_savelist(view_getcomplist(current_view), NULL, outline_include);
                    break;

                case IDM_COPYFILES:
                    /*
                     * copy files that are same/different to a new
                     * root directory. dialog box allows user
                     * to select new root and inclusion options
                     */
                    if (current_view == NULL) {
                        MessageBox(hWnd,
                                   LoadRcString(IDS_CREATE_DIFF_LIST),
                                   szSdkDiff, MB_OK|MB_ICONSTOP);
                        break;
                    }

                    if (SetBusy()) {
                        ghThread = CreateThread(NULL, 0, wd_copy,
                                                (LPVOID) current_view, 0, &threadid);
                        if (ghThread == NULL)
                        {
                            wd_copy( (LPVOID) current_view);
                        }

                    } else {
                        BusyError();
                    }

                    break;

                case IDM_ABOUT:
                    ShellAbout( hWnd,
                                (LPTSTR)szSdkDiff,
                                LoadRcString(IDS_TOOL_DESCRIPTION),
                                LoadIcon(hInst, szSdkDiff)
                              );
                    break;

                case IDM_CONTENTS:
                    /* Help contents */
          TCHAR pszHelp[MAX_PATH];
          memset(pszHelp, 0, MAX_PATH);
          hr = StringCchCopy(pszHelp, MAX_PATH, pszWorkingDirectoryName);
          if (FAILED(hr))
            OutputError(hr, IDS_SAFE_COPY);
          hr = StringCchCat(pszHelp, MAX_PATH, "sdkdiff.hlp");
          if (FAILED(hr))
            OutputError(hr, IDS_SAFE_CAT);
          WinHelp(hWnd, pszHelp, HELP_INDEX, 0);
                    break;

                    /* launch an editor on the current item - left, right or
                     * composite view
                     */
                case IDM_EDITLEFT:
                    do_editthread(current_view, CI_LEFT);
                    break;

                case IDM_EDITRIGHT:
                    do_editthread(current_view, CI_RIGHT);
                    break;

                case IDM_EDITCOMP:
                    {
                        COMPITEM item = view_getitem(current_view, selection);
                        FILEDATA fdLeft;
                        FILEDATA fdRight;

                        fdLeft = compitem_getleftfile(item);
                        fdRight = compitem_getrightfile(item);
                        if ((fdLeft && file_IsUnicode(fdLeft)) || (fdRight && file_IsUnicode(fdRight))) {
                            MessageBox(hWnd, LoadRcString(IDS_NOCOMPUNICODE),
                                       szSdkDiff, MB_OK);
                        } else {
                            do_editthread(current_view, CI_COMP);
                        }
                    }
                    break;

                    /* allow customisation of the editor command line */
                case IDM_SETEDIT:
                    if (StringInput(editor_cmdline, sizeof(editor_cmdline),
                                    LoadRcString(IDS_EDITOR_COMMAND),
                                    (LPSTR)szSdkDiff, editor_cmdline)) {
                        WriteProfileString(APPNAME, szEditor,
                                           editor_cmdline);
                    }
                    break;

                case IDM_SETTABWIDTH:
                    {
                        char sz[32];
                        int n;

LTabWidth_tryagain:
                        hr = StringCchPrintf(sz, 32, "%d", g_tabwidth);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        if (StringInput(sz, sizeof(sz),
                                        LoadRcString(IDS_TABWIDTH),
                                        (LPSTR)szSdkDiff, sz))
                        {
                            n = atoi(sz);
                            if (n <= 0 || n > 100)
                            {
                                MessageBox(hWnd,
                                           LoadRcString(IDS_BAD_TABWIDTH),
                                           szSdkDiff, MB_OK);
                                goto LTabWidth_tryagain;
                            }
                            WriteProfileInt(APPNAME, szTabWidth, n);
                            g_tabwidth = n;
                            SendMessage(hwndRCD, TM_SETTABWIDTH, 0, n);
                        }
                    }
                    break;

                case IDM_TABWIDTH4:
                case IDM_TABWIDTH8:
                    g_tabwidth = (GET_WM_COMMAND_ID(wParam, lParam) == IDM_TABWIDTH8) ? 8 : 4;
                    SendMessage(hwndRCD, TM_SETTABWIDTH, 0, g_tabwidth);
                    break;

                case IDM_SETFONT:
                    {
                        CHOOSEFONT cf;
                        LOGFONT lf;
                        char szFace[LF_FACESIZE];

                        hr = StringCchCopy(szFace, LF_FACESIZE, g_szFontFaceName);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_COPY);

                        memset(&lf, 0, sizeof(lf));
                        hr = StringCchCopy(lf.lfFaceName, LF_FACESIZE, szFace);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_COPY);
                        lf.lfWeight = g_fFontBold ? FW_BOLD : FW_DONTCARE;
                        lf.lfHeight = g_nFontHeight;
                        lf.lfCharSet = g_bFontCharSet;

                        memset(&cf, 0, sizeof(cf));
                        cf.lStructSize = sizeof(CHOOSEFONT);
                        cf.hwndOwner = hWnd;
                        cf.lpLogFont = &lf;
                        cf.Flags = CF_INITTOLOGFONTSTRUCT|CF_FORCEFONTEXIST|
                                CF_SCREENFONTS|CF_LIMITSIZE;
                        cf.nSizeMin = 8;
                        cf.nSizeMax = 36;
                        cf.lpszStyle = szFace;
                        if (ChooseFont(&cf))
                            {
                            hr = StringCchCopy(g_szFontFaceName, LF_FACESIZE, lf.lfFaceName);
              if (FAILED(hr))
                OutputError(hr, IDS_SAFE_COPY);
                            g_fFontBold = (lf.lfWeight == FW_BOLD);
                            g_nFontHeight = lf.lfHeight;
                            g_bFontCharSet = lf.lfCharSet;

                            WriteProfileString(APPNAME, szFontFaceName, g_szFontFaceName);
                            WriteProfileInt(APPNAME, szFontHeight, g_nFontHeight);
                            WriteProfileInt(APPNAME, szFontBold, g_fFontBold);
                            WriteProfileInt(APPNAME, szFontCharSet, g_bFontCharSet);

                            GetFontPref();

                            view_changeviewoptions(current_view);
                            }
                    }
                    break;

                case IDM_LNRS:
                case IDM_RNRS:
                case IDM_NONRS:

                    /* option selects whether the line nrs displayed
                     * in expand mode are the line nrs in the left
                     * file, the right file or none
                     */

                    CheckMenuItem(GetMenu(hWnd),
                                  line_numbers, MF_UNCHECKED);
                    line_numbers = GET_WM_COMMAND_ID(wParam, lParam);
                    CheckMenuItem(GetMenu(hWnd), line_numbers, MF_CHECKED);
                    hr = StringCchPrintf(str, 32, szD, line_numbers);
          if (FAILED(hr))
            OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szLineNumbers, str);

                    /* change the display to show the line nr style
                     * chosen
                     */

                    view_changeviewoptions(current_view);
                    break;

                /*
                 * options selecting which lines to include in the
                 * expand listing, based on their state
                 */
                case IDM_EXPAND_INCSAME:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_SAME;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCSAME,
                              (expand_include & INCLUDE_SAME) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCLEFT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_LEFTONLY;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCLEFT,
                              (expand_include & INCLUDE_LEFTONLY) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCRIGHT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_RIGHTONLY;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCRIGHT,
                              (expand_include & INCLUDE_RIGHTONLY) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCMOVEDLEFT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_MOVEDLEFT;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCMOVEDLEFT,
                              (expand_include & INCLUDE_MOVEDLEFT) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCMOVEDRIGHT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_MOVEDRIGHT;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCMOVEDRIGHT,
                              (expand_include & INCLUDE_MOVEDRIGHT) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCSIMILARLEFT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_SIMILARLEFT;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCSIMILARLEFT,
                              (expand_include & INCLUDE_SIMILARLEFT) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCSIMILARRIGHT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_SIMILARRIGHT;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCSIMILARRIGHT,
                              (expand_include & INCLUDE_SIMILARRIGHT) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                    /*
                     * options selecting which files to include in the
                     * outline listing, based on their state
                     */
                case IDM_OUTLINE_INCLEFT:

                    /* toggle flag in outline_include options */
                    outline_include ^= INCLUDE_LEFTONLY;

                    /* check/uncheck as necessary */
                    CheckMenuItem(hMenu, IDM_OUTLINE_INCLEFT,
                                  (outline_include & INCLUDE_LEFTONLY) ?
                                  MF_CHECKED:MF_UNCHECKED);

                    hr = StringCchPrintf(str, 32, szD, outline_include);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szFileInclude, str);
                    view_changeviewoptions(current_view);

                    break;

                case IDM_OUTLINE_INCRIGHT:

                    outline_include ^= INCLUDE_RIGHTONLY;

                    CheckMenuItem(hMenu, IDM_OUTLINE_INCRIGHT,
                                  (outline_include & INCLUDE_RIGHTONLY) ?
                                  MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, outline_include);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szFileInclude, str);
                    view_changeviewoptions(current_view);

                    break;

                case IDM_OUTLINE_INCSAME:

                    outline_include ^= INCLUDE_SAME;

                    CheckMenuItem(hMenu, IDM_OUTLINE_INCSAME,
                                  (outline_include & INCLUDE_SAME) ?
                                  MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, outline_include);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szFileInclude, str);
                    view_changeviewoptions(current_view);

                    break;

                case IDM_OUTLINE_INCDIFFER:

                    outline_include ^= INCLUDE_DIFFER;

                    CheckMenuItem(hMenu, IDM_OUTLINE_INCDIFFER,
                                  (outline_include & INCLUDE_DIFFER) ?
                                  MF_CHECKED:MF_UNCHECKED);

                    hr = StringCchPrintf(str, 32, szD, outline_include);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szFileInclude, str);
                    view_changeviewoptions(current_view);

                    break;

                case IDM_UPDATE:
                    OnUpdate( (COMPITEM) lParam);
                    break;

                case IDM_RESCAN:
                    RescanFile(hWnd);

                    /* do we need to force any repaints? */
                    // - no, as RescanFile sends a IDM_UPDATE
                    break;

                case IDM_LONLY:
                case IDM_RONLY:
                case IDM_BOTHFILES:
                    /* option selects whether the expanded file
                     * show is the combined file, or just one
                     * or other of the input files.
                     *
                     * if we are not in expand mode, this also
                     * causes us to expand the selection
                     */

                    CheckMenuItem(GetMenu(hWnd), expand_mode, MF_UNCHECKED);
                    expand_mode = GET_WM_COMMAND_ID(wParam, lParam);
                    CheckMenuItem(GetMenu(hWnd), expand_mode, MF_CHECKED);

                    /* change the current view to show only the lines
                     * of the selected type.
                     */
                    if (DisplayMode == MODE_OUTLINE) {
                        ToExpand(hWnd);
                    } else {
                        view_changeviewoptions(current_view);
                    }

                    break;

                case IDM_IGNBLANKS:

                    /* if selected, ignore all spaces and tabs on
                     * comparison - expand view only: outline view
                     * will still show that 'text files differ'
                     */

                    ignore_blanks = !ignore_blanks;
                    CheckMenuItem(hMenu, IDM_IGNBLANKS,
                                  ignore_blanks? MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, ignore_blanks);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szBlanks, str);

                    /* invalidate all diffs since we have
                     * changed diff options, and re-do and display the
                     * current diff if we are in expand mode.
                     */
                    view_changediffoptions(current_view);

                    /* force repaint of bar window */
                    InvalidateRect(hwndBar, NULL, TRUE);

                    break;

                case IDM_SHOWWHITESPACE:

                        /* if selected, display all spaces and tabs in
                           the expanded text view */
                        show_whitespace = !show_whitespace;
                        CheckMenuItem(hMenu, IDM_SHOWWHITESPACE,
                                show_whitespace ? MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, show_whitespace);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szShowWhitespace, str);

                        // change the current view to show only the lines
                        // of the selected type.
                        if (DisplayMode == MODE_EXPAND) {
                                view_changeviewoptions(current_view);
                        }

                        break;

                case IDM_ALG2:

                    /* if selected, do algorithm2 which does not accept
                     * unsafe matches.
                     */

                    Algorithm2 = !Algorithm2;
                    CheckMenuItem(hMenu, IDM_ALG2,
                                  Algorithm2? MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, Algorithm2);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szAlgorithm2, str);

                    /* invalidate all diffs since we have
                     * changed diff options, and re-do and display the
                     * current diff if we are in expand mode.
                     */
                    view_changediffoptions(current_view);

                    /* force repaint of bar window */
                    InvalidateRect(hwndBar, NULL, TRUE);

                    break;

                case IDM_MONOCOLS:

                    /* Use monochrome colours - toggle */

                    mono_colours = !mono_colours;
                    CheckMenuItem(hMenu, IDM_MONOCOLS,
                                  mono_colours? MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, mono_colours);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szMonoColours, str);
                    if (mono_colours)
                        SetMonoColours();
                    else
                        SetColours();

                    /* The diffs are still valid, but force a re-display
                     * of bar window and main table.
                     */
                    SendMessage(hwndBar, WM_COMMAND, IDM_MONOCOLS, 0);
                    InvalidateRect(hwndBar, NULL, TRUE);
                    view_changeviewoptions(current_view);

                    break;

                case IDM_PICTURE:
                    picture_mode = !picture_mode;
                    CheckMenuItem(hMenu, IDM_PICTURE,
                                  picture_mode? MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, picture_mode);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szPicture, str);
                    DoResize(hWnd);
                    break;

                case IDM_HIDEMARK:
                    // toggle state of marked files hidden or not
                    hide_markedfiles = !hide_markedfiles;
                    CheckMenuItem(hMenu, IDM_HIDEMARK,
                                  hide_markedfiles? MF_CHECKED : MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, hide_markedfiles);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szHideMark, str);

                    // rebuild view with new global option
                    // - note that marks only affect outline views
                    if (!view_isexpanded(current_view)) {
                        view_changeviewoptions(current_view);
                    }
                    break;

                case IDM_FIND:
                  {
                  int nRet = IDCANCEL;
                  DLGPROC lpProc = (DLGPROC) MakeProcInstance((WINPROCTYPE) FindDlgProc, hInst);
                  if (lpProc)
                    {
                    char *pszFind = NULL;
                    sdkdiff_UI(TRUE);
                    nRet = (BOOL) DialogBoxParam(hInst, (LPCTSTR) IDD_FIND, hwndClient, lpProc, 0L);
                    sdkdiff_UI(FALSE);
                    FreeProcInstance(lpProc);
                    }
                  }
                  break;

                case IDM_FINDNEXT:
                  {
                  const LONG iCol = (view_isexpanded(current_view)) ? 2 : 1;
                  FindString(hWnd, iCol, NULL, 1, 0);
                  break;
                  }

                case IDM_FINDPREV:
                  {
                  const LONG iCol = (view_isexpanded(current_view)) ? 2 : 1;
                  FindString(hWnd, iCol, NULL, -1, 0);
                  break;
                  }

                case IDM_GOTOLINE:
                  {
                  if (!view_getrowcount(current_view))
                    {
                    MessageBox(hWnd, LoadRcString(IDS_GOTOLINE_NOLINES), szSdkDiff, MB_OK|MB_ICONSTOP|MB_TASKMODAL);
                    }
                  else
                    {
                    DLGPROC lpProc = (DLGPROC) MakeProcInstance((WINPROCTYPE)GoToLineDlgProc, hInst);
                    if (lpProc)
                      {
                      sdkdiff_UI(TRUE);
                      DialogBoxParam(hInst, (LPCTSTR) IDD_GOTOLINE, hwndClient, lpProc, 0L);
                      sdkdiff_UI(FALSE);
                      FreeProcInstance(lpProc);
                      }
                    }
                  }
                  break;

                case IDM_EDITCOPY:
                    {
                        unsigned long cb = 0;
                        LPCSTR pszText = NULL;
                        long iRow = 0;
                        const BOOL fOutline = !view_isexpanded(current_view);

                        /* first count total data size */
                        for (iRow = 0; iRow < selection_nrows; iRow++) {
                            if (fOutline) {
                                pszText = view_gettext(current_view, selection + iRow, 1);
                                if (!pszText)
                                    break;
                                cb += (lstrlen(pszText) + 3) * sizeof(char);
                            }

                            pszText = view_gettext(current_view, selection + iRow, 2);
                            if (!pszText)
                                break;
                            cb += (lstrlen(pszText)) * sizeof(char);
                        }

                        if (cb && OpenClipboard(NULL)) {
                            /* space for trailing nul char */
                            cb++;

                            /* copy data to clipboard */
                            if (EmptyClipboard()) {
                                HGLOBAL hData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,  cb);

                                if (hData) {
                                    void *pv = hData;
                                    if (!pv) {
                                        HeapFree(GetProcessHeap(), NULL, hData);
                                    }
                                    else {
                                        LPSTR pszBuf = (LPSTR) pv;
                                        memset(pv, 0, cb);

                                        for (iRow = 0; iRow < selection_nrows; iRow++) {
                                            if (fOutline) {
                                                pszText = view_gettext(current_view, selection + iRow, 1);
                                                if (!pszText)
                                                    break;

                                                hr = StringCchCopy(pszBuf, cb, pszText);
                        if (FAILED(hr))
                          OutputError(hr, IDS_SAFE_COPY);
                                                pszBuf += lstrlen(pszBuf);
                                                *(pszBuf++) = '\t';
                                                *pszBuf = 0;
                                            }

                                            pszText = view_gettext(current_view, selection + iRow, 2);
                                            if (!pszText)
                                                break;

                                            hr = StringCchCopy(pszBuf, cb, pszText);
                      if (FAILED(hr))
                        OutputError(hr, IDS_SAFE_COPY);
                                            pszBuf += lstrlen(pszBuf);

                                            if (fOutline) {
                                                *(pszBuf++) = '\r';
                                                *(pszBuf++) = '\n';
                                                *pszBuf = 0;
                                            }
                                        }

                                        SetClipboardData(CF_TEXT, hData);
                                    }
                                }
                            }
                            CloseClipboard();
                        }
                    }
                    break;

                case IDM_MARK:
                    {
                        BOOL bChanged = FALSE;
                        int i;

                        // toggle the mark on the current selection
                        // note that the selection could be multiple rows
                        for (i = 0; i < selection_nrows; i++) {

                            if (view_setmarkstate(current_view, selection + i,
                                                  !view_getmarkstate(current_view, selection + i))) {

                                bChanged = TRUE;
                            }
                        }

                        if (bChanged) {
                            // yes the mark state was changed - need
                            // to rebuild the view.
                            if (!view_isexpanded(current_view)) {
                                view_changeviewoptions(current_view);
                            }
                        }
                        break;
                    }

                case IDM_TOGGLEMARK:
                    // toggle the state of all files: unmark all
                    // marked files and vice versa
                    complist_togglemark(view_getcomplist(current_view));

                    // rebuild view
                    if (!view_isexpanded(current_view)) {
                        view_changeviewoptions(current_view);
                    }
                    break;

                case IDM_MARKPATTERN:
                    // dialog to query the pattern, then set a mark on
                    // all compitems whose title matches that pattern
                    // returns TRUE if anything was changed
                    if (complist_markpattern(view_getcomplist(current_view))) {

                        // rebuild view
                        if (!view_isexpanded(current_view)) {
                            view_changeviewoptions(current_view);
                        }
                    }
                    break;

                case IDM_EXPAND:

                    /* show the expanded view of the
                     * selected file
                     */
                    if (current_view != NULL) {
                        ToExpand(hWnd);
                    }

                    break;

                case IDM_OUTLINE:
                    /* return to the outline view (list of filenames) */
                    ToOutline(hWnd);

                    break;

                case IDM_FCHANGE:
                    /* find the next line in the current view
                     * that is not the same in both files -
                     * in outline view, finds the next filename that
                     * is not identical
                     */
                    FindNextChange();
                    break;

                case IDM_FPCHANGE:
                    /* same as IDM_FCHANGE, but going backwards from
                     * current position
                     */
                    FindPrevChange();
                    break;

                case IDM_FCHANGE_LAURIE:
                    /* same as IDM_FCHANGE, but tries to keep cursor on same
                     * line.
                     */
                    _FindNextChange(TRUE, FALSE);
                    break;

                case IDM_FPCHANGE_LAURIE:
                    /* same as IDM_FPCHANGE, but tries to keep cursor on same
                     * line.
                     */
                    _FindPrevChange(TRUE, FALSE);
                    break;

                    // given a line that has been moved, jump to the
                    // other representation of the same line.
                    // this used to be available just through double-click
                    // but now is also available from a context menu
                case IDM_TOMOVED:
                    ToMoved(hWnd, TRUE);
                    break;
            }
            break;

        case WM_SIZE:
            DoResize(hWnd);
            break;

        case WM_SETFOCUS:
            /* set the focus on the table class so it can process
             * page-up /pagedown keys etc.
             */
            SetFocus(hwndRCD);
            break;

        case WM_KEYDOWN:
            /* although the table window has the focus, he passes
             * back to us any keys he doesn't understand
             * We handle escape here to mean 'return to outline view'
             */
            if (wParam == VK_ESCAPE) {
                ToOutline(hWnd);
            } else if (wParam == VK_APPS) {
                // Handle the context menu keyboard key
                POINT posCursor;
                GetCursorPos(&posCursor);
                ScreenToClient(hwndRCD, &posCursor);
                OnRightClick(hWnd, posCursor.x, posCursor.y);
            }
            break;

        case WM_RBUTTONDOWN:
            /*
             * the table window handles this by performing the
             * selection and then passing the message to us, allowing
             * us to put up a context menu.
             */
            OnRightClick(hWnd, LOWORD(lParam), HIWORD(lParam));
            break;

        case WM_CLOSE:
            SendMessage(hWnd, WM_COMMAND, IDM_EXIT, 0);
            return TRUE;

            /* don't allow close when busy - process this message in
             * order to ensure this
             */
            break;

        case WM_DESTROY:
      TCHAR pszHelp[MAX_PATH];
      memset(pszHelp, 0, MAX_PATH);
      hr = StringCchCopy(pszHelp, MAX_PATH, pszWorkingDirectoryName);
      if (FAILED(hr))
        OutputError(hr, IDS_SAFE_COPY);
      hr = StringCchCat(pszHelp, MAX_PATH, "sdkdiff.hlp");
      if (FAILED(hr))
        OutputError(hr, IDS_SAFE_COPY);
            DeleteTools();
            WinHelp(hWnd, pszHelp, HELP_QUIT, 0);
            PostQuitMessage(0);
            break;

        case TM_CURRENTVIEW:
            /* allow other people such as the bar window to query the
             * current view
             */
            return((INT_PTR) current_view);

#ifdef LATER
#ifdef WM_MOUSEWHEEL
        case WM_MOUSEWHEEL:
            if (LOWORD(wParam) & MK_MBUTTON) {
                if ((short)HIWORD(wParam) < 0) {
                    // The next occurence
                    _FindNextChange(FALSE, TRUE);
                }
                else {
                    _FindPrevChange(FALSE, TRUE);
                }
            }
            break;
#endif
#endif

        case WM_QUERYENDSESSION:
            if (IsBusy())
                return FALSE;
            return TRUE;

        case WM_ENDSESSION:
            SendMessage(hWnd, WM_CLOSE, 0, 0);
            break;

        default:
            /* handle registered table messages */
            if (message == table_msgcode) {
                ret = TableServer(hWnd, wParam, lParam);
                return(ret);
            }
            return(DefWindowProc(hWnd, message, wParam, lParam));
    }
    return(0);
}

int PASCAL WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

_tWinMain - Application entry point and dispatch loop

Definition at line 48 of file Demo.c.

{

    HWND hWnd;
    MSG msg;
    CHAR szAppName[64];

    UNREFERENCED_PARAMETER(lpCmdLine);

    if (!hPrevInstance)
        if (!DemoInit(hInstance))
            return (0);

    hInst = hInstance;
    LoadString(hInstance, IDS_APPNAME, szAppName, sizeof(szAppName));

    hWnd = CreateWindow("Demo",
        szAppName,
        WS_OVERLAPPEDWINDOW,
        CW_USEDEFAULT,
        CW_USEDEFAULT,
        CW_USEDEFAULT,
        CW_USEDEFAULT,
        NULL,
        NULL,
        hInstance,
        NULL);

    if (!hWnd)
        return (0);

    ShowWindow(hWnd, nCmdShow);
    UpdateWindow(hWnd);

    while (GetMessage(&msg, NULL, 0, 0)) {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }
    return (int)(msg.wParam);
}

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpCntr/site.Cpp File Reference

  • Com
  • Fundamentals
  • SimpCntr
Defines | Functions

site.Cpp File Reference

#include "pre.h"
#include "iocs.h"
#include "ias.h"
#include "ioipf.h"
#include "ioips.h"
#include "app.h"
#include "site.h"
#include "doc.h"

Go to the source code of this file.

Defines

#define | HIMETRIC_PER_INCH 2540
#define | MAP_LOGHIM_TO_PIX(x, ppli) MulDiv((ppli), (x), HIMETRIC_PER_INCH)

Functions

void | OleFree (LPVOID pmem)
STDMETHODIMP_ (ULONG) CSimpleSite
int | XformHeightInHimetricToPixels (HDC hDC, int iHeightInHiMetric)
int | XformWidthInHimetricToPixels (HDC hDC, int iWidthInHiMetric)

Define Documentation

#define HIMETRIC_PER_INCH 2540

Definition at line 22 of file site.Cpp.

#define MAP_LOGHIM_TO_PIX | ( | x,
 |  | ppli |
 | ) |  | MulDiv((ppli), (x), HIMETRIC_PER_INCH)

Definition at line 23 of file site.Cpp.

Function Documentation

void OleFree ( LPVOID pmem )

Definition at line 92 of file site.Cpp.

{
    LPMALLOC pmalloc;

    if (pmem == NULL)
        return;

    if (FAILED(CoGetMalloc(MEMCTX_TASK, &pmalloc)))
        return;

    pmalloc->Free(pmem);
    pmalloc->Release();
}

STDMETHODIMP_ ( ULONG )

Definition at line 493 of file site.Cpp.

{
        OutputDebugString("In CSimpleSite::Release\r\n");

        return(SafeRelease());
}

int XformHeightInHimetricToPixels | ( | HDC | hDC,
 |  | int | iHeightInHiMetric
 | ) |  |

Definition at line 48 of file site.Cpp.

{
    int     iYppli;     //Pixels per logical inch along height
    int     iHeightInPix;
    BOOL    fSystemDC=FALSE;

    if (NULL==hDC)
    {
        hDC=GetDC(NULL);
        fSystemDC=TRUE;
    }

    iYppli = GetDeviceCaps (hDC, LOGPIXELSY);

    //* We got logical HIMETRIC along the display, convert them to pixel units
    iHeightInPix = MAP_LOGHIM_TO_PIX(iHeightInHiMetric, iYppli);

    if (fSystemDC)
        ReleaseDC(NULL, hDC);

    return iHeightInPix;
}

int XformWidthInHimetricToPixels | ( | HDC | hDC,
 |  | int | iWidthInHiMetric
 | ) |  |

Definition at line 25 of file site.Cpp.

{
    int     iXppli;     //Pixels per logical inch along width
    int     iWidthInPix;
    BOOL    fSystemDC=FALSE;

    if (NULL==hDC)
    {
        hDC=GetDC(NULL);
        fSystemDC=TRUE;
    }

    iXppli = GetDeviceCaps (hDC, LOGPIXELSX);

    //We got logical HIMETRIC along the display, convert them to pixel units
    iWidthInPix = MAP_LOGHIM_TO_PIX(iWidthInHiMetric, iXppli);

    if (fSystemDC)
        ReleaseDC(NULL, hDC);

    return iWidthInPix;
}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpCntr/site.h File Reference

  • Com
  • Fundamentals
  • SimpCntr
Classes

site.h File Reference

#include <ole2.h>
#include <stablize.h>
#include "ias.h"
#include "ioips.h"
#include "iocs.h"

Go to the source code of this file.

Classes

class CSimpleSite
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpCntr/stdpal.h File Reference

  • Com
  • Fundamentals
  • SimpCntr
Variables

stdpal.h File Reference

Go to the source code of this file.

Variables

unsigned char palSVGA [256][3]

Variable Documentation

unsigned char palSVGA[256][3]

Definition at line 15 of file stdpal.h.

Generated on Wed Nov 13 2024 16:53:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpDnd/app.Cpp File Reference

  • Com
  • Fundamentals
  • SimpDnd
Functions

app.Cpp File Reference

#include "pre.h"
#include "iocs.h"
#include "ias.h"
#include "app.h"
#include "site.h"
#include "doc.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CSimpleApp

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 229 of file app.Cpp.

{
        OutputDebugString("In CSimpleApp::Release\r\n");

        return SafeRelease();
}

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpDnd/app.h File Reference

  • Com
  • Fundamentals
  • SimpDnd
Classes

app.h File Reference

#include <ole2.h>
#include <stablize.h>

Go to the source code of this file.

Classes

class CSimpleApp
Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpDnd/doc.Cpp File Reference

  • Com
  • Fundamentals
  • SimpDnd
Functions

doc.Cpp File Reference

#include "pre.h"
#include "iocs.h"
#include "ias.h"
#include "app.h"
#include "site.h"
#include "doc.h"
#include "idt.h"
#include "dxferobj.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CSimpleDoc

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 414 of file doc.Cpp.

{
        OutputDebugString("In CSimpleDoc::Release\r\n");

        return SafeRelease();
}

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpDnd/doc.h File Reference

  • Com
  • Fundamentals
  • SimpDnd
Classes

doc.h File Reference

#include "idt.h"
#include "ids.h"
#include <stablize.h>

Go to the source code of this file.

Classes

class CSimpleDoc
Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpDnd/dxferObj.Cpp File Reference

  • Com
  • Fundamentals
  • SimpDnd
Functions | Variables

dxferObj.Cpp File Reference

#include "pre.h"
#include <assert.h>
#include "dxferobj.h"
#include "site.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CDataXferObj

Variables

CLIPFORMAT | g_cfEmbeddedObject = RegisterClipboardFormat(CF_EMBEDDEDOBJECT)
CLIPFORMAT | g_cfObjectDescriptor = RegisterClipboardFormat(CF_OBJECTDESCRIPTOR)

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 303 of file dxferObj.Cpp.

{
        OutputDebugString("In CDataXferObj::Release\r\n");

        if (--m_nCount == 0) {
                delete this;
                return 0;
        }
        return m_nCount;
}

Variable Documentation

CLIPFORMAT g_cfEmbeddedObject = RegisterClipboardFormat(CF_EMBEDDEDOBJECT)

Definition at line 21 of file dxferObj.Cpp.

CLIPFORMAT g_cfObjectDescriptor = RegisterClipboardFormat(CF_OBJECTDESCRIPTOR)

Definition at line 22 of file dxferObj.Cpp.

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpDnd/dxferObj.h File Reference

  • Com
  • Fundamentals
  • SimpDnd
Classes

dxferObj.h File Reference

Go to the source code of this file.

Classes

class CDataXferObj
Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpDnd/ias.Cpp File Reference

  • Com
  • Fundamentals
  • SimpDnd
Functions

ias.Cpp File Reference

#include "pre.h"
#include "iocs.h"
#include "ias.h"
#include "app.h"
#include "site.h"
#include "doc.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CAdviseSink
STDMETHODIMP_ (void) CAdviseSink

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 131 of file ias.Cpp.

{
  OutputDebugString("In IAS::Release\r\n");

  // decrement the interface reference count (for debugging only)
  m_nCount--;

  // delegate to the container Site
  return m_pSite->Release();
}

STDMETHODIMP_ ( void )

Definition at line 313 of file ias.Cpp.

{
  OutputDebugString("In IAS::OnClose\r\n");
}

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpDnd/ias.h File Reference

  • Com
  • Fundamentals
  • SimpDnd
Functions | Variables

ias.h File Reference

#include <assert.h>

Go to the source code of this file.

Functions

~CAdviseSink ()
CAdviseSink (CSimpleSite FAR *pSite)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID FAR *ppv)
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP_ (void) OnDataChange(FORMATETC FAR *pFormatetc

Variables

LONG | lindex
CSimpleSite FAR * | m_pSite
STGMEDIUM FAR * | pStgmed

Function Documentation

~CAdviseSink ( )

Definition at line 26 of file ias.h.

                 {
    OutputDebugString("In IAS's destructor\r\n");
    assert(m_nCount == 0);
    } ;

CAdviseSink ( CSimpleSite FAR * pSite )

Definition at line 20 of file ias.h.

                                       {
    OutputDebugString("In IAS's constructor\r\n");
    m_pSite = pSite;
    m_nCount = 0;
    };

STDMETHODIMP QueryInterface | ( | REFIID | riid,
 |  | LPVOID FAR * | ppv
 | ) |  |
STDMETHODIMP_ ( ULONG )

Definition at line 398 of file DataObj.Cpp.

{
  TCHAR szText[MAX_PATH];
  wsprintf(szText, TEXT("CEnumFormatEtc::Release - ref count will be %d\n"), m_ObjRefCount - 1);
  OutputDebugString(szText);

  if(0 == --m_ObjRefCount)
  {
    delete this;
    return 0;
  }

  return m_ObjRefCount;
}

STDMETHODIMP_ ( void )

Variable Documentation

LONG lindex

Definition at line 37 of file ias.h.

CSimpleSite FAR* m_pSite

Definition at line 18 of file ias.h.

STGMEDIUM FAR* pStgmed

Definition at line 36 of file ias.h.

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpDnd/ids.Cpp File Reference

  • Com
  • Fundamentals
  • SimpDnd
Functions

ids.Cpp File Reference

#include "pre.h"
#include "doc.h"
#include "site.h"
#include "dxferobj.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CDropSource

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 248 of file ids.Cpp.

{
  OutputDebugString("In IDS::Release\r\n");

  // decrement the interface reference count (for debugging only)
  --m_nCount;

  // delegate to the document object
  return m_pDoc->Release();
}

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpDnd/ids.h File Reference

  • Com
  • Fundamentals
  • SimpDnd
Functions | Variables

ids.h File Reference

#include <assert.h>

Go to the source code of this file.

Functions

~CDropSource ()
CDropSource (CSimpleDoc FAR *pDoc)
STDMETHODIMP | GiveFeedback (DWORD dwEffect)
STDMETHODIMP | QueryContinueDrag (BOOL fEscapePressed, DWORD grfKeyState)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID FAR *ppv)
STDMETHODIMP_ (ULONG) AddRef()

Variables

CSimpleDoc FAR * | m_pDoc

Function Documentation

~CDropSource ( )

Definition at line 26 of file ids.h.

                 {
    OutputDebugString("In IDS's destructor\r\n");
    } ;

CDropSource ( CSimpleDoc FAR * pDoc )

Definition at line 20 of file ids.h.

                                     {
    OutputDebugString("In IDS's constructor\r\n");
    m_pDoc = pDoc;
    m_nCount = 0;
    };

STDMETHODIMP GiveFeedback ( DWORD dwEffect )
STDMETHODIMP QueryContinueDrag | ( | BOOL | fEscapePressed,
 |  | DWORD | grfKeyState
 | ) |  |
STDMETHODIMP QueryInterface | ( | REFIID | riid,
 |  | LPVOID FAR * | ppv
 | ) |  |
STDMETHODIMP_ ( ULONG )

Definition at line 398 of file DataObj.Cpp.

{
  TCHAR szText[MAX_PATH];
  wsprintf(szText, TEXT("CEnumFormatEtc::Release - ref count will be %d\n"), m_ObjRefCount - 1);
  OutputDebugString(szText);

  if(0 == --m_ObjRefCount)
  {
    delete this;
    return 0;
  }

  return m_ObjRefCount;
}

Variable Documentation

CSimpleDoc FAR* m_pDoc

Definition at line 18 of file ids.h.

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpDnd/idt.Cpp File Reference

  • Com
  • Fundamentals
  • SimpDnd
Defines | Functions | Variables

idt.Cpp File Reference

#include "pre.h"
#include "iocs.h"
#include "ias.h"
#include "app.h"
#include "site.h"
#include "doc.h"
#include "idt.h"

Go to the source code of this file.

Defines

#define | OffsetPoint(pt, dx, dy) ((pt)->x += dx, (pt)->y += dy)
#define | SetBottomRight(rc, pt) ((rc)->bottom = (pt)->y,(rc)->right = (pt)->x)
#define | SetTopLeft(rc, pt) ((rc)->top = (pt)->y,(rc)->left = (pt)->x)

Functions

STDMETHODIMP_ (ULONG) CDropTarget

Variables

CLIPFORMAT | g_cfObjectDescriptor

Define Documentation

#define OffsetPoint | ( | pt,
 |  | dx,
 |  | dy |
 | ) |  | ((pt)->x += dx, (pt)->y += dy)

Definition at line 221 of file idt.Cpp.

#define SetBottomRight | ( | rc,
 |  | pt |
 | ) |  | ((rc)->bottom = (pt)->y,(rc)->right = (pt)->x)

Definition at line 219 of file idt.Cpp.

#define SetTopLeft | ( | rc,
 |  | pt |
 | ) |  | ((rc)->top = (pt)->y,(rc)->left = (pt)->x)

Definition at line 217 of file idt.Cpp.

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 558 of file idt.Cpp.

{
        OutputDebugString("In IDT::Release\r\n");

        // decrement the interface reference count (for debugging only)
        --m_nCount;

        // delegate to the document object
        return m_pDoc->Release();
}

Variable Documentation

CLIPFORMAT g_cfObjectDescriptor

Definition at line 22 of file dxferObj.Cpp.

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpDnd/idt.h File Reference

  • Com
  • Fundamentals
  • SimpDnd
Typedefs | Enumerations | Functions | Variables

idt.h File Reference

#include <assert.h>

Go to the source code of this file.

Typedefs

typedef enum tagSCROLLDIR | SCROLLDIR

Enumerations

enum tagSCROLLDIR {
SCROLLDIR_NULL = 0, SCROLLDIR_UP = 1, SCROLLDIR_DOWN = 2, SCROLLDIR_RIGHT = 3,
SCROLLDIR_LEFT = 4
}

Functions

~CDropTarget ()
CDropTarget (CSimpleDoc FAR *pDoc)
BOOL | DoDragScroll (POINTL pointl)
STDMETHODIMP | DragEnter (LPDATAOBJECT pDataObj, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect)
STDMETHODIMP | DragLeave ()
STDMETHODIMP | DragOver (DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect)
void | DrawDragFeedback (POINTL pointl)
STDMETHODIMP | Drop (LPDATAOBJECT pDataObj, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect)
void | InitDragFeedback (LPDATAOBJECT pDataObj, POINTL pointl)
BOOL | QueryDrop (DWORD grfKeyState, POINTL pointl, BOOL fDragScroll, LPDWORD lpdwEffect)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID FAR *ppv)
STDMETHODIMP_ (ULONG) AddRef()
void | UndrawDragFeedback (void)

Variables

DWORD m_dwLastScrollDir
DWORD m_dwNextScrollTime
DWORD m_dwSrcAspect
DWORD m_dwTimeEnterScrollArea
BOOL m_fCanDropCopy
BOOL m_fCanDropLink
BOOL m_fDragFeedbackDrawn
CSimpleDoc FAR * | m_pDoc
POINT | m_ptLast
RECT | m_rcDragRect

Typedef Documentation

typedef enum tagSCROLLDIR SCROLLDIR

Enumeration Type Documentation

enum tagSCROLLDIR
Enumerator:
SCROLLDIR_NULL
SCROLLDIR_UP
SCROLLDIR_DOWN
SCROLLDIR_RIGHT
SCROLLDIR_LEFT

Definition at line 16 of file idt.h.

                          {
  SCROLLDIR_NULL          = 0,
  SCROLLDIR_UP            = 1,
  SCROLLDIR_DOWN          = 2,
  SCROLLDIR_RIGHT         = 3,
  SCROLLDIR_LEFT          = 4
} SCROLLDIR;

Function Documentation

~CDropTarget ( )

Definition at line 50 of file idt.h.

                 {
    OutputDebugString("In IDT's destructor\r\n");
    assert(m_nCount == 0);
    } ;

CDropTarget ( CSimpleDoc FAR * pDoc )

Definition at line 38 of file idt.h.

                                     {
    OutputDebugString("In IDT's constructor\r\n");
    m_pDoc = pDoc;
    m_nCount = 0;
    m_fCanDropCopy = FALSE;
    m_fCanDropLink = FALSE;
    m_fDragFeedbackDrawn = FALSE;
    m_dwTimeEnterScrollArea = 0L;
    m_dwNextScrollTime = 0L;
    m_dwLastScrollDir = SCROLLDIR_NULL;
    };

BOOL CDropTarget::DoDragScroll ( POINTL pointl ) [private]

Definition at line 152 of file idt.Cpp.

{
        DWORD dwScrollDir = SCROLLDIR_NULL;
        DWORD dwTime = GetCurrentTime();
        int nScrollInset = m_pDoc->m_lpApp->m_nScrollInset;
        int nScrollDelay = m_pDoc->m_lpApp->m_nScrollDelay;
        int nScrollInterval = m_pDoc->m_lpApp->m_nScrollInterval;
        POINT point;
        RECT rect;

        point.x = (int)pointl.x;
        point.y = (int)pointl.y;

        ScreenToClient( m_pDoc->m_hDocWnd, &point);
        GetClientRect ( m_pDoc->m_hDocWnd, (LPRECT) &rect );

        if (rect.top <= point.y && point.y<=(rect.top+nScrollInset))
                dwScrollDir = SCROLLDIR_UP;
        else if ((rect.bottom-nScrollInset) <= point.y && point.y <= rect.bottom)
                dwScrollDir = SCROLLDIR_DOWN;
        else if (rect.left <= point.x && point.x <= (rect.left+nScrollInset))
                dwScrollDir = SCROLLDIR_LEFT;
        else if ((rect.right-nScrollInset) <= point.x && point.x <= rect.right)
                dwScrollDir = SCROLLDIR_RIGHT;

        if (m_dwTimeEnterScrollArea) {

                /* cursor was already in Scroll Area */

                if (! dwScrollDir) {
                        /* cusor moved OUT of scroll area.
                        **      clear "EnterScrollArea" time.
                        */
                        m_dwTimeEnterScrollArea = 0L;
                        m_dwNextScrollTime = 0L;
                        m_dwLastScrollDir = SCROLLDIR_NULL;

                } else if (dwScrollDir != m_dwLastScrollDir) {
                        /* cusor moved into a different direction scroll area.
                        **      reset "EnterScrollArea" time to start a new 50ms delay.
                        */
                        m_dwTimeEnterScrollArea = dwTime;
                        m_dwNextScrollTime = dwTime + (DWORD)nScrollDelay;
                        m_dwLastScrollDir = dwScrollDir;

                } else if (dwTime && dwTime >= m_dwNextScrollTime) {
                        m_pDoc->Scroll ( dwScrollDir );    // Scroll document now
                        m_dwNextScrollTime = dwTime + (DWORD)nScrollInterval;
                }
        } else {
                if (dwScrollDir) {
                        /* cusor moved INTO a scroll area.
                        **      reset "EnterScrollArea" time to start a new 50ms delay.
                        */
                        m_dwTimeEnterScrollArea = dwTime;
                        m_dwNextScrollTime = dwTime + (DWORD)nScrollDelay;
                        m_dwLastScrollDir = dwScrollDir;
                }
        }

        return (dwScrollDir ? TRUE : FALSE);
}

STDMETHODIMP DragEnter | ( | LPDATAOBJECT | pDataObj,
 |  | DWORD | grfKeyState,
 |  | POINTL | pt,
 |  | LPDWORD | pdwEffect
 | ) |  |
STDMETHODIMP DragLeave ( )
STDMETHODIMP DragOver | ( | DWORD | grfKeyState,
 |  | POINTL | pt,
 |  | LPDWORD | pdwEffect
 | ) |  |
void CDropTarget::DrawDragFeedback ( POINTL pointl ) [private]

Definition at line 425 of file idt.Cpp.

{
        POINT ptDiff;

        ptDiff.x = (int)pointl.x - m_ptLast.x;
        ptDiff.y = (int)pointl.y - m_ptLast.y;

        if (m_fDragFeedbackDrawn && (ptDiff.x == 0 && ptDiff.y == 0))
                return;     // mouse did not move; leave rectangle as drawn

        HDC hDC = GetDC(m_pDoc->m_hDocWnd);
        if (m_fDragFeedbackDrawn) {
                m_fDragFeedbackDrawn = FALSE;
                HighlightRect(m_pDoc->m_hDocWnd, hDC, &m_rcDragRect);
        }

        OffsetRect(&m_rcDragRect, ptDiff.x, ptDiff.y);
        HighlightRect(m_pDoc->m_hDocWnd, hDC, &m_rcDragRect);
        m_fDragFeedbackDrawn = TRUE;
        m_ptLast.x = (int)pointl.x;
        m_ptLast.y = (int)pointl.y;
        ReleaseDC(m_pDoc->m_hDocWnd, hDC);
}

STDMETHODIMP Drop | ( | LPDATAOBJECT | pDataObj,
 |  | DWORD | grfKeyState,
 |  | POINTL | pt,
 |  | LPDWORD | pdwEffect
 | ) |  |
void CDropTarget::InitDragFeedback | ( | LPDATAOBJECT | pDataObj,
 |  | POINTL | pointl |
 | ) |  |  | [private]

Definition at line 302 of file idt.Cpp.

{
        FORMATETC fmtetc;
        STGMEDIUM stgmed;
        POINT pt;
        int height, width;
        HRESULT hrErr;

        height = width = 100; // some default values
        pt.x = (int)pointl.x;
        pt.y = (int)pointl.y;

        // do a GetData for CF_OBJECTDESCRIPTOR format to get the size of the
        // object as displayed in the source. using this size, initialize the
        // size for the drag feedback rectangle.
        fmtetc.cfFormat = g_cfObjectDescriptor;
        fmtetc.ptd = NULL;
        fmtetc.lindex = -1;
        fmtetc.dwAspect = DVASPECT_CONTENT;
        fmtetc.tymed = TYMED_HGLOBAL;

        hrErr = pDataObj->GetData(&fmtetc, &stgmed);
        if (hrErr == NOERROR) {
                LPOBJECTDESCRIPTOR pOD=(LPOBJECTDESCRIPTOR)GlobalLock(stgmed.hGlobal);
                if (pOD != NULL) {
                        XformSizeInHimetricToPixels(NULL, &pOD->sizel, &pOD->sizel);

                        width = (int)pOD->sizel.cx;
                        height = (int)pOD->sizel.cy;
                        m_dwSrcAspect = pOD->dwDrawAspect;
                }

                GlobalUnlock(stgmed.hGlobal);
                ReleaseStgMedium(&stgmed);
        }

        m_ptLast = pt;
        m_fDragFeedbackDrawn = FALSE;

        OffsetPoint(&pt, -(width/2), -(height/2));
        SetTopLeft(&m_rcDragRect, &pt);

        OffsetPoint(&pt, width, height);
        SetBottomRight(&m_rcDragRect, &pt);
}

BOOL QueryDrop | ( | DWORD | grfKeyState,
 |  | POINTL | pointl,
 |  | BOOL | fDragScroll,
 |  | LPDWORD | lpdwEffect |
 | ) |  |  | [private]
STDMETHODIMP QueryInterface | ( | REFIID | riid,
 |  | LPVOID FAR * | ppv
 | ) |  |
STDMETHODIMP_ ( ULONG )

Definition at line 398 of file DataObj.Cpp.

{
  TCHAR szText[MAX_PATH];
  wsprintf(szText, TEXT("CEnumFormatEtc::Release - ref count will be %d\n"), m_ObjRefCount - 1);
  OutputDebugString(szText);

  if(0 == --m_ObjRefCount)
  {
    delete this;
    return 0;
  }

  return m_ObjRefCount;
}

void CDropTarget::UndrawDragFeedback ( void ) [private]

Definition at line 384 of file idt.Cpp.

{
        if (m_fDragFeedbackDrawn) {
                m_fDragFeedbackDrawn = FALSE;
                HDC hDC = GetDC(m_pDoc->m_hDocWnd);
                HighlightRect(m_pDoc->m_hDocWnd, hDC, &m_rcDragRect);
                ReleaseDC(m_pDoc->m_hDocWnd, hDC);
        }
}

Variable Documentation

DWORD m_dwLastScrollDir

Definition at line 35 of file idt.h.

DWORD m_dwNextScrollTime

Definition at line 36 of file idt.h.

DWORD m_dwSrcAspect

Definition at line 30 of file idt.h.

DWORD m_dwTimeEnterScrollArea

Definition at line 34 of file idt.h.

BOOL m_fCanDropCopy

Definition at line 28 of file idt.h.

BOOL m_fCanDropLink

Definition at line 29 of file idt.h.

BOOL m_fDragFeedbackDrawn

Definition at line 33 of file idt.h.

CSimpleDoc FAR* m_pDoc

Definition at line 27 of file idt.h.

POINT m_ptLast

Definition at line 32 of file idt.h.

RECT m_rcDragRect

Definition at line 31 of file idt.h.

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpDnd/iocs.Cpp File Reference

  • Com
  • Fundamentals
  • SimpDnd
Functions

iocs.Cpp File Reference

#include "pre.h"
#include "iocs.h"
#include "ias.h"
#include "app.h"
#include "site.h"
#include "doc.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) COleClientSite

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 122 of file iocs.Cpp.

{
  OutputDebugString("In IOCS::Release\r\n");

  // decrement the interface reference count (for debugging only)
  --m_nCount;

  // delegate to the container Site
  return m_pSite->Release();
}

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpDnd/iocs.h File Reference

  • Com
  • Fundamentals
  • SimpDnd
Functions | Variables

iocs.h File Reference

#include <assert.h>

Go to the source code of this file.

Functions

~COleClientSite ()
COleClientSite (CSimpleSite FAR *pSite)
STDMETHODIMP | GetContainer (LPOLECONTAINER FAR *ppContainer)
STDMETHODIMP | GetMoniker (DWORD dwAssign, DWORD dwWhichMoniker, LPMONIKER FAR *ppmk)
STDMETHODIMP | OnShowWindow (BOOL fShow)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID FAR *ppvObj)
STDMETHODIMP | RequestNewObjectLayout ()
STDMETHODIMP | SaveObject ()
STDMETHODIMP | ShowObject ()
STDMETHODIMP_ (ULONG) AddRef()

Variables

CSimpleSite FAR * | m_pSite

Function Documentation

~COleClientSite ( )

Definition at line 26 of file iocs.h.

                    {
    OutputDebugString("In IOCS's destructor\r\n");
    assert(m_nCount == 0);
    }

COleClientSite ( CSimpleSite FAR * pSite )

Definition at line 20 of file iocs.h.

                                          {
    OutputDebugString("In IOCS's constructor\r\n");
    m_pSite = pSite;
    m_nCount = 0;
    }

STDMETHODIMP GetContainer ( LPOLECONTAINER FAR * ppContainer )
STDMETHODIMP GetMoniker | ( | DWORD | dwAssign,
 |  | DWORD | dwWhichMoniker,
 |  | LPMONIKER FAR * | ppmk
 | ) |  |
STDMETHODIMP OnShowWindow ( BOOL fShow )
STDMETHODIMP QueryInterface | ( | REFIID | riid,
 |  | LPVOID FAR * | ppvObj
 | ) |  |
STDMETHODIMP RequestNewObjectLayout ( )
STDMETHODIMP SaveObject ( )
STDMETHODIMP ShowObject ( )
STDMETHODIMP_ ( ULONG )

Definition at line 398 of file DataObj.Cpp.

{
  TCHAR szText[MAX_PATH];
  wsprintf(szText, TEXT("CEnumFormatEtc::Release - ref count will be %d\n"), m_ObjRefCount - 1);
  OutputDebugString(szText);

  if(0 == --m_ObjRefCount)
  {
    delete this;
    return 0;
  }

  return m_ObjRefCount;
}

Variable Documentation

CSimpleSite FAR* m_pSite

Definition at line 18 of file iocs.h.

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpDnd/pre.h File Reference

  • Com
  • Fundamentals
  • SimpDnd

pre.h File Reference

#include <windows.h>
#include <ole2.h>
#include <olestd.h>
#include <assert.h>
#include <string.h>
#include "simpdnd.h"
#include "resource.h"
#include <ole2ver.h>
#include "resource.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpDnd/Resource.h File Reference

  • Com
  • Fundamentals
  • SimpDnd
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | ID_EDIT_INSERTOBJECT 111
#define | IDC_DRAGPENDING 102
#define | IDM_COPY 109
#define | IDM_CUT 108
#define | IDM_EXIT 106
#define | IDM_INSERTOBJECT 111
#define | IDM_NEW 112
#define | IDM_OPEN 102
#define | IDM_PASTE 110
#define | IDM_PRINT 105
#define | IDM_SAVE 103
#define | IDM_SAVEAS 104
#define | IDM_UNDO 107

Define Documentation

#define ID_EDIT_INSERTOBJECT 111

Definition at line 15 of file Resource.h.

#define IDC_DRAGPENDING 102

Definition at line 6 of file Resource.h.

#define IDM_COPY 109

Definition at line 13 of file Resource.h.

#define IDM_CUT 108

Definition at line 12 of file Resource.h.

#define IDM_EXIT 106

Definition at line 10 of file Resource.h.

#define IDM_INSERTOBJECT 111

Definition at line 16 of file Resource.h.

#define IDM_NEW 112

Definition at line 17 of file Resource.h.

#define IDM_OPEN 102

Definition at line 5 of file Resource.h.

#define IDM_PASTE 110

Definition at line 14 of file Resource.h.

#define IDM_PRINT 105

Definition at line 9 of file Resource.h.

#define IDM_SAVE 103

Definition at line 7 of file Resource.h.

#define IDM_SAVEAS 104

Definition at line 8 of file Resource.h.

#define IDM_UNDO 107

Definition at line 11 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpDnd/SimpDnd.Cpp File Reference

  • Com
  • Fundamentals
  • SimpDnd
Functions | Variables

SimpDnd.Cpp File Reference

#include "pre.h"
#include "iocs.h"
#include "ias.h"
#include "app.h"
#include "site.h"
#include "doc.h"

Go to the source code of this file.

Functions

BOOL FAR PASCAL EXPORT | About (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
long FAR PASCAL EXPORT | DocWndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
long FAR PASCAL EXPORT | MainWndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
int PASCAL | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

Variables

CSimpleApp FAR * | lpCSimpleApp

Function Documentation

BOOL FAR PASCAL EXPORT About | ( | HWND | hDlg,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 235 of file SimpDnd.Cpp.

{
        switch (message) {
        case WM_INITDIALOG:                /* message: initialize dialog box */
                return (TRUE);

        case WM_COMMAND:                      /* message: received a command */
                //@@WTK WIN32, UNICODE
                //if (wParam == IDOK                /* "OK" box selected?          */
                if (LOWORD(wParam) == IDOK                /* "OK" box selected?          */
                //@@WTK WIN32, UNICODE
                //|| wParam == IDCANCEL) {      /* System menu close command? */
                || LOWORD(wParam) == IDCANCEL) {      /* System menu close command? */
                EndDialog(hDlg, TRUE);        /* Exits the dialog box        */
                return (TRUE);
                }
                break;
        }
        return (FALSE);                           /* Didn't process a message    */
}

long FAR PASCAL EXPORT DocWndProc | ( | HWND | hWnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 300 of file SimpDnd.Cpp.

{
        HDC hDC;
        PAINTSTRUCT ps;

        switch (message) {
                case WM_PAINT:

                        hDC = BeginPaint(hWnd, &ps);

                        if (lpCSimpleApp)
                                lpCSimpleApp->PaintApp (hDC);

                        EndPaint(hWnd, &ps);
                        break;

                case WM_LBUTTONDBLCLK:
                        {
                        POINT pt;

                        pt.x = (int)(short)LOWORD (lParam );
                        pt.y = (int)(short)HIWORD (lParam );

                        if (lpCSimpleApp->m_lpDoc->m_lpSite &&
                                lpCSimpleApp->m_lpDoc->m_lpSite->m_lpOleObject)
                                {
                                RECT rect;

                                lpCSimpleApp->m_lpDoc->m_lpSite->GetObjRect(&rect);

                                if ( PtInRect(&rect, pt) )
                                        {
                                        // Execute object's default verb
                                        lpCSimpleApp->m_lpDoc->m_lpSite->m_lpOleObject->DoVerb(
                                                        OLEIVERB_PRIMARY, (LPMSG)&message,
                                                        &lpCSimpleApp->m_lpDoc->m_lpSite->m_OleClientSite,
                                                        -1, hWnd, &rect);
                                        }
                                }
                        }
                        break;

                case WM_LBUTTONDOWN:
                        {
                        POINT pt;

                        pt.x = (int)(short)LOWORD (lParam );
                        pt.y = (int)(short)HIWORD (lParam );

                        /* OLE2NOTE: check if this is a button down on the region
                        **    that is a handle to start a drag operation. for us,
                        **    this this is any where in the window. we
                        **    do NOT want to start a drag immediately; we want to
                        **    wait until the mouse moves a certain threshold. or a
                        **    certain amount of time has elapsed. if
                        **    LButtonUp comes before the drag is started, then
                        **    the fPendingDrag state is cleared. we must capture
                        **    the mouse to ensure the modal state is handled
                        **    properly.
                        */
                        if (lpCSimpleApp->m_lpDoc->QueryDrag(pt) )
                                {
                                lpCSimpleApp->m_lpDoc->m_fPendingDrag = TRUE;
                                lpCSimpleApp->m_lpDoc->m_ptButDown = pt;
                                SetTimer(hWnd, 1, lpCSimpleApp->m_nDragDelay, NULL);
                                SetCapture(hWnd);
                                }
                        break;
                        }

                case WM_LBUTTONUP:

                        if (lpCSimpleApp->m_lpDoc->m_fPendingDrag)
                                {
                                /* ButtonUP came BEFORE distance/time threshholds were
                                **    exceeded. clear fPendingDrag state.
                                */
                                ReleaseCapture();
                                KillTimer(hWnd, 1);
                                lpCSimpleApp->m_lpDoc->m_fPendingDrag = FALSE;
                                }
                        break;

                case WM_MOUSEMOVE:
                        {
                        if (lpCSimpleApp->m_lpDoc->m_fPendingDrag)
                                {
                                int  x = (int)(short)LOWORD (lParam );
                                int  y = (int)(short)HIWORD (lParam );
                                POINT pt = lpCSimpleApp->m_lpDoc->m_ptButDown;
                                int nDragMinDist = lpCSimpleApp->m_nDragMinDist;

                                if (! ( ((pt.x - nDragMinDist) <= x)
                                                && (x <= (pt.x + nDragMinDist))
                                                && ((pt.y - nDragMinDist) <= y)
                                                && (y <= (pt.y + nDragMinDist)) ) )
                                        {
                                        // mouse moved beyond threshhold to start drag
                                        ReleaseCapture();
                                        KillTimer(hWnd, 1);
                                        lpCSimpleApp->m_lpDoc->m_fPendingDrag = FALSE;

                                        // perform the modal drag/drop operation.
                                        lpCSimpleApp->m_lpDoc->DoDragDrop( );
                                        }
                                }
                        break;
                        }

                case WM_TIMER:
                        {
                        // drag time delay threshhold exceeded -- start drag
                        ReleaseCapture();
                        KillTimer(hWnd, 1);
                        lpCSimpleApp->m_lpDoc->m_fPendingDrag = FALSE;

                        // perform the modal drag/drop operation.
                        lpCSimpleApp->m_lpDoc->DoDragDrop( );
                        break;
                        }

                default:                          /* Passes it on if unproccessed */
                        return (DefWindowProc(hWnd, message, wParam, lParam));
        }
        return (NULL);
}

long FAR PASCAL EXPORT MainWndProc | ( | HWND | hWnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 168 of file SimpDnd.Cpp.

{

        switch (message)
                {
                case WM_COMMAND:           // message: command from application menu
                        return lpCSimpleApp->lCommandHandler(hWnd, message, wParam, lParam);
                        break;

                case WM_CREATE:
                        return lpCSimpleApp->lCreateDoc(hWnd, message, wParam, lParam);
                        break;

                case WM_DESTROY:                  // message: window being destroyed
                        lpCSimpleApp->DestroyDocs();  // need to destroy the doc...
                        PostQuitMessage(0);
                        break;

                case WM_INITMENUPOPUP:
                        // is this the edit menu?
                        if ( LOWORD(lParam) == 1)
                                return lpCSimpleApp->m_lpDoc->lAddVerbs();

                        break;

                case WM_SIZE:
                        return lpCSimpleApp->lSizeHandler(hWnd, message, wParam, lParam);

                default:                          // Passes it on if unproccessed
                        return (DefWindowProc(hWnd, message, wParam, lParam));
                }
                return (NULL);
}

int PASCAL WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 70 of file SimpDnd.Cpp.

{
        MSG msg;

        // needed for LRPC to work properly...
        SetMessageQueue(96);

        lpCSimpleApp = new CSimpleApp;

        // we will add one ref count on our App. later when we want to destroy
        // the App object we will release this  ref count. when the App's ref
        // count goes to 0, it will be deleted.
        lpCSimpleApp->AddRef();

        // app initialization
        if (!hPrevInstance)
                if (!lpCSimpleApp->fInitApplication(hInstance))
                        return (FALSE);

        // instance initialization
        if (!lpCSimpleApp->fInitInstance(hInstance, nCmdShow))
                return (FALSE);

        /* Initialization required for OLE 2 UI library.  This call is
        **    needed ONLY if we are using the static link version of the UI
        **    library. If we are using the DLL version, we should NOT call
        **    this function in our application.
        */
#if 0
        if (!OleUIInitialize(hInstance, hPrevInstance))
                {
                OleDbgOut("Could not initialize OLEUI library\n");
                return FALSE;
                }
#endif
        // message loop
        while (GetMessage(&msg, NULL, NULL, NULL))
                if (!lpCSimpleApp->HandleAccelerators(&msg))
                        {
                        TranslateMessage(&msg);    /* Translates virtual key codes */
                        DispatchMessage(&msg);     /* Dispatches message to window */
                        }

        // De-initialization for UI libraries.  Just like OleUIInitialize, this
        // funciton is needed ONLY if we are using the static link version of the
        // OLE UI library.
#if 0
        OleUIUninitialize();
#endif

        // Release the ref count added on the App above. this will make
        // the App's ref count go to 0, and the App object will be deleted.
        lpCSimpleApp->Release();

        return (msg.wParam);          /* Returns the value from PostQuitMessage */
}

Variable Documentation

CSimpleApp FAR* lpCSimpleApp

Definition at line 28 of file SimpDnd.Cpp.

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpDnd/SimpDnd.h File Reference

  • Com
  • Fundamentals
  • SimpDnd
Defines | Functions

SimpDnd.h File Reference

Go to the source code of this file.

Defines

#define | IDM_ABOUT 100
#define | IDM_INSERT 101
#define | IDM_VERB0 1000

Functions

BOOL FAR PASCAL EXPORT | About (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
long FAR PASCAL EXPORT | DocWndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
BOOL | InitApplication (HANDLE hInstance)
BOOL | InitInstance (HANDLE hInstance, int nCmdShow)
long FAR PASCAL EXPORT | MainWndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
int PASCAL | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

Define Documentation

#define IDM_ABOUT 100

Definition at line 6 of file SimpDnd.h.

#define IDM_INSERT 101

Definition at line 7 of file SimpDnd.h.

#define IDM_VERB0 1000

Definition at line 8 of file SimpDnd.h.

Function Documentation

BOOL FAR PASCAL EXPORT About | ( | HWND | hDlg,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 445 of file Generic.C.

{
   static  HFONT hfontDlg;    // Font for dialog text
   static   HFONT hFinePrint; // Font for 'fine print' in dialog
   DWORD   dwVerInfoSize;     // Size of version information block
   LPSTR   lpVersion;         // String pointer to 'version' text
   DWORD   dwVerHnd=0;        // An 'ignored' parameter, always '0'
   UINT    uVersionLen;
   WORD    wRootLen;
   BOOL    bRetCode;
   int     i;
   char    szFullPath[BUFFSIZE];
   char    szResult[BUFFSIZE];
   char    szGetName[BUFFSIZE];
   DWORD dwVersion;
   char  szVersion[40];
   DWORD dwResult;
   HRESULT hRes;

   switch (message) {
        case WM_INITDIALOG:
         ShowWindow (hDlg, SW_HIDE);

         if (PRIMARYLANGID(GetUserDefaultLangID()) == LANG_JAPANESE)
         {
            hfontDlg = CreateFont(14, 0, 0, 0, 0, 0, 0, 0, SHIFTJIS_CHARSET, 0, 0, 0,
                                  VARIABLE_PITCH | FF_DONTCARE, "");
            hFinePrint = CreateFont(11, 0, 0, 0, 0, 0, 0, 0, SHIFTJIS_CHARSET, 0, 0, 0,
                                    VARIABLE_PITCH | FF_DONTCARE, "");
         }
         else
         {
            hfontDlg = CreateFont(14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                  VARIABLE_PITCH | FF_SWISS, "");
            hFinePrint = CreateFont(11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                    VARIABLE_PITCH | FF_SWISS, "");
         }

         CenterWindow (hDlg, GetWindow (hDlg, GW_OWNER));
         GetModuleFileName (hInst, szFullPath, sizeof(szFullPath));

         // Now lets dive in and pull out the version information:
         dwVerInfoSize = GetFileVersionInfoSize(szFullPath, &dwVerHnd);
         if (dwVerInfoSize) {
            LPSTR   lpstrVffInfo;
            HANDLE  hMem;
            hMem = GlobalAlloc(GMEM_MOVEABLE, dwVerInfoSize);
            lpstrVffInfo  = GlobalLock(hMem);
            GetFileVersionInfo(szFullPath, dwVerHnd, dwVerInfoSize, lpstrVffInfo);
            // The below 'hex' value looks a little confusing, but
            // essentially what it is, is the hexidecimal representation
            // of a couple different values that represent the language
            // and character set that we are wanting string values for.
            // 040904E4 is a very common one, because it means:
            //   US English, Windows MultiLingual characterset
            // Or to pull it all apart:
            // 04------        = SUBLANG_ENGLISH_USA
            // --09----        = LANG_ENGLISH
            // --11----        = LANG_JAPANESE
            // ----04E4 = 1252 = Codepage for Windows:Multilingual

            // Use safe string handling
            szGetName[sizeof(szGetName) - 1] = '\0';
            lstrcpyn(szGetName, GetStringRes(IDS_VER_INFO_LANG), sizeof(szGetName) - 1);
            if (szGetName[sizeof(szGetName) - 1] != '\0') {
                return FALSE; // Buffer overflow error
            }

            wRootLen = (WORD) lstrlen(szGetName); // Save this position

            // Set the title of the dialog using safe string handling
            hRes = StringCchCatN(szGetName, sizeof(szGetName), "ProductName", sizeof("ProductName"));
            if (FAILED(hRes)) {
                return FALSE; // Buffer overflow error
            }

            bRetCode = VerQueryValue((LPVOID)lpstrVffInfo,
               (LPSTR)szGetName,
               (LPVOID)&lpVersion,
               (UINT *)&uVersionLen);

            // Notice order of version and string...
            if (PRIMARYLANGID(GetUserDefaultLangID()) == LANG_JAPANESE)
            {
                // Use safe string handling
                hRes = StringCchCopyN(szResult, sizeof(szResult), lpVersion, lstrlen(lpVersion));
                if (FAILED(hRes)) {
                    return FALSE; // Buffer overflow error
                }
                hRes = StringCchCatN(szResult, sizeof(szResult), " ‚Ìƒo[ƒWƒ‡ƒ“î•ñ", sizeof(" ‚Ìƒo[ƒWƒ‡ƒ“î•ñ"));
                if (FAILED(hRes)) {
                    return FALSE; // Buffer overflow error
                }
            }
            else
            {
                // Use safe string handling
                hRes = StringCchCopyN(szResult, sizeof(szResult), "About ", sizeof("About "));
                if (FAILED(hRes)) {
                    return FALSE; // Buffer overflow error
                }
                hRes = StringCchCatN(szResult, sizeof(szResult), lpVersion, lstrlen(lpVersion));
                if (FAILED(hRes)) {
                    return FALSE; // Buffer overflow error
                }
            }

            // -----------------------------------------------------

            SetWindowText (hDlg, szResult);

            // Walk through the dialog items that we want to replace:
            for (i = DLG_VERFIRST; i <= DLG_VERLAST; i++) {
               GetDlgItemText(hDlg, i, szResult, sizeof(szResult));
               szGetName[wRootLen] = (char)0;
               // Use safe sting handling
               hRes = StringCchCatN(szGetName, sizeof(szGetName), szResult, sizeof(szResult));
               if (FAILED(hRes)) {
                   return FALSE; // Buffer overflow error
               }
               uVersionLen   = 0;
               lpVersion     = NULL;
               bRetCode      =  VerQueryValue((LPVOID)lpstrVffInfo,
                  (LPSTR)szGetName,
                  (LPVOID)&lpVersion,
                  (UINT *)&uVersionLen);

               if ( bRetCode && uVersionLen && lpVersion) {
                   // Replace dialog item text with version info
                   // Use safe string handling
                   hRes = StringCchCopyN(szResult, sizeof(szResult), lpVersion, lstrlen(lpVersion));
                   if (FAILED(hRes)) {
                       return FALSE; // Buffer overflow error
                   }
                   SetDlgItemText(hDlg, i, szResult);
               }
               else
               {
                  dwResult = GetLastError();

                  // Use safe string handling
                  hRes = StringCchPrintf(szResult, sizeof(szResult), GetStringRes(IDS_VERSION_ERROR), dwResult);
                  if (FAILED(hRes)) {
                      return FALSE; // Buffer overflow error
                  }

                  SetDlgItemText (hDlg, i, szResult);
               }
               SendMessage (GetDlgItem (hDlg, i), WM_SETFONT,
                  (ULONG_PTR)((i==DLG_VERLAST)?hFinePrint:hfontDlg),
                  TRUE);
            } // for (i = DLG_VERFIRST; i <= DLG_VERLAST; i++)

            GlobalUnlock(hMem);
            GlobalFree(hMem);

         } else {
            // No version information available.
         } // if (dwVerInfoSize)

            SendMessage (GetDlgItem (hDlg, IDC_LABEL), WM_SETFONT,
            (WPARAM)hfontDlg,(LPARAM)TRUE);

         // We are  using GetVersion rather then GetVersionEx
         // because earlier versions of Windows NT and Win32s
         // didn't include GetVersionEx:
         dwVersion = GetVersion();

         if (dwVersion < 0x80000000) {
            // Windows NT
            // Use safe sting handling
            hRes = StringCchPrintf(szVersion, sizeof(szVersion), "Microsoft Windows NT %u.%u (Build: %u)",
                (DWORD)(LOBYTE(LOWORD(dwVersion))),
                (DWORD)(HIBYTE(LOWORD(dwVersion))),
                (DWORD)(HIWORD(dwVersion)) );
            if (FAILED(hRes)) {
                return FALSE; // Buffer overflow error
            }
         } else if (LOBYTE(LOWORD(dwVersion))<4) {
            // Win32s
            // Use safe sting handling
            hRes = StringCchPrintf(szVersion, sizeof(szVersion), "Microsoft Win32s %u.%u (Build: %u)",
                (DWORD)(LOBYTE(LOWORD(dwVersion))),
                (DWORD)(HIBYTE(LOWORD(dwVersion))),
                (DWORD)(HIWORD(dwVersion) & ~0x8000) );
            if (FAILED(hRes)) {
                return FALSE; // Buffer overflow error
            }
         } else {
            // Windows 95
            // Use safe sting handling
            hRes = StringCchPrintf(szVersion, sizeof(szVersion), "Microsoft Windows 95 %u.%u",
                (DWORD)(LOBYTE(LOWORD(dwVersion))),
                (DWORD)(HIBYTE(LOWORD(dwVersion))) );
            if (FAILED(hRes)) {
                return FALSE; // Buffer overflow error
            }
         }

          SetWindowText (GetDlgItem(hDlg, IDC_OSVERSION), szVersion);
         ShowWindow (hDlg, SW_SHOW);
         return (TRUE);

      case WM_COMMAND:
         if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) {
            EndDialog(hDlg, TRUE);
            DeleteObject (hfontDlg);
            DeleteObject (hFinePrint);
            return (TRUE);
         }
         break;
   }

    return FALSE;
}

long FAR PASCAL EXPORT DocWndProc | ( | HWND | hWnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 311 of file SimpCntr.Cpp.

{
        HDC hDC;
        PAINTSTRUCT ps;

        switch (message) {
                case WM_PAINT:

                        hDC = BeginPaint(hWnd, &ps);

                        if (lpCSimpleApp)
                                lpCSimpleApp->PaintApp (hDC);

                        EndPaint(hWnd, &ps);
                        break;

                case WM_LBUTTONDBLCLK:
                        {
                        POINT pt;

                        pt.x = (int)(short)LOWORD (lParam );
                        pt.y = (int)(short)HIWORD (lParam );

                        if (lpCSimpleApp->m_lpDoc->m_lpSite &&
                                lpCSimpleApp->m_lpDoc->m_lpSite->m_lpOleObject)
                                {
                                RECT rect;

                                lpCSimpleApp->m_lpDoc->m_lpSite->GetObjRect(&rect);

                                if ( PtInRect(&rect, pt) )
                                        {
                                        // Execute object's default verb
                                        lpCSimpleApp->m_lpDoc->m_lpSite->m_lpOleObject->DoVerb(
                                                        OLEIVERB_PRIMARY, (LPMSG)&message,
                                                        &lpCSimpleApp->m_lpDoc->m_lpSite->m_OleClientSite,
                                                        -1, hWnd, &rect);
                                        }
                                }
                        }
                        break;

        // no code is added to WM_LBUTTONDOWN for context sensitive help, because
        // this app does not do context sensitive help.
        case WM_LBUTTONDOWN:

                LPOLEINPLACEOBJECT lpObject;

                if (lpCSimpleApp->m_lpDoc->m_fInPlaceActive)
                        {
                        lpCSimpleApp->m_lpDoc->m_lpSite->m_lpOleObject->QueryInterface(IID_IOleInPlaceObject, (LPVOID FAR *)&lpObject);
                        lpObject->UIDeactivate();

                        // this code is needed because we don't support inside out.
                        RECT rect;
                        lpCSimpleApp->m_lpDoc->m_lpSite->GetObjRect(&rect);
                        lpCSimpleApp->m_lpDoc->m_lpSite->m_lpOleObject->DoVerb(OLEIVERB_HIDE, (LPMSG)&message, &lpCSimpleApp->m_lpDoc->m_lpSite->m_OleClientSite, -1, hWnd, &rect);

                        lpObject->Release();
                        }

                break;

                default:                          /* Passes it on if unproccessed */
                        return (DefWindowProc(hWnd, message, wParam, lParam));
        }
        return (NULL);
}

BOOL InitApplication ( HANDLE hInstance )

Definition at line 123 of file ClipText.c.

{
    WNDCLASS  wc = {0};

    wc.lpfnWndProc = (WNDPROC) MainWndProc;
    wc.hInstance = hInstance;
    wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
    wc.hCursor = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
    wc.lpszMenuName =  TEXT("CliptextMenu");
    wc.lpszClassName = TEXT("CliptextWClass");

    return (RegisterClass(&wc));
}

BOOL InitInstance | ( | HANDLE | hInstance,
 |  | int | nCmdShow
 | ) |  |

Definition at line 126 of file ComDlg32.C.

{
    HWND            hWnd;

  // Save off the handle to the current instance.
    g_hInst = hInstance;

    // Create a main window for this application instance.
    hWnd = CreateWindow(
        "Comdlg32WClass",
        "Common Dialog Sample Application",
        WS_OVERLAPPEDWINDOW,            // Window style.
        CW_USEDEFAULT,                  // Default horizontal position.
        CW_USEDEFAULT,                  // Default vertical position.
        CW_USEDEFAULT,                  // Default width.
        CW_USEDEFAULT,                  // Default height.
        NULL,                           // Overlapped windows have no parent.
        NULL,                           // Use the window class menu.
        g_hInst,                        // This instance owns this window.
        NULL                            // Pointer not needed.
    );

    // If window could not be created, return "failure".
    if (!hWnd)
        return (FALSE);

    // Register the window messages to receive.
    cdmsgShareViolation = RegisterWindowMessage(szmsgSHAREVIOLATION);
    cdmsgFileOK         = RegisterWindowMessage(szmsgFILEOK);
    cdmsgHelp           = RegisterWindowMessage(szCommdlgHelp);

    // Make the window visible; update its client area; and return "success".
    ShowWindow(hWnd, nCmdShow);
    UpdateWindow(hWnd);
    return (TRUE);

}

long FAR PASCAL EXPORT MainWndProc | ( | HWND | hWnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 3333 of file sdkdiff.cpp.

{
    char str[32];
    long ret;
    DWORD threadid;
  HRESULT hr;

    switch (message) {

        case WM_CREATE:

            /* initialise menu options to default/saved
             * option settings
             */

#define CHECKMENU(id, fChecked)  \
          CheckMenuItem(hMenu, (id), (fChecked) ? MF_CHECKED:MF_UNCHECKED)

            /* outline_include options */
            CHECKMENU(IDM_OUTLINE_INCSAME,   (outline_include & INCLUDE_SAME));
            CHECKMENU(IDM_OUTLINE_INCLEFT,   (outline_include & INCLUDE_LEFTONLY));
            CHECKMENU(IDM_OUTLINE_INCRIGHT,  (outline_include & INCLUDE_RIGHTONLY));
            CHECKMENU(IDM_OUTLINE_INCDIFFER, (outline_include & INCLUDE_DIFFER));

            /* expand_include options */
            CHECKMENU(IDM_EXPAND_INCSAME,         (expand_include & INCLUDE_SAME));
            CHECKMENU(IDM_EXPAND_INCLEFT,         (expand_include & INCLUDE_LEFTONLY));
            CHECKMENU(IDM_EXPAND_INCRIGHT,        (expand_include & INCLUDE_RIGHTONLY));
            CHECKMENU(IDM_EXPAND_INCMOVEDLEFT,    (expand_include & INCLUDE_MOVEDLEFT));
            CHECKMENU(IDM_EXPAND_INCMOVEDRIGHT,   (expand_include & INCLUDE_MOVEDRIGHT));
            CHECKMENU(IDM_EXPAND_INCSIMILARLEFT,  (expand_include & INCLUDE_SIMILARLEFT));
            CHECKMENU(IDM_EXPAND_INCSIMILARRIGHT, (expand_include & INCLUDE_SIMILARRIGHT));

            /* other options */
            CHECKMENU(line_numbers, TRUE);
            CHECKMENU(expand_mode, TRUE);
            CHECKMENU(IDM_IGNBLANKS, ignore_blanks);
            CHECKMENU(IDM_SHOWWHITESPACE, show_whitespace);
            CHECKMENU(IDM_ALG2, Algorithm2);
            CHECKMENU(IDM_MONOCOLS, mono_colours);
            CHECKMENU(IDM_PICTURE, picture_mode);
            CHECKMENU(IDM_HIDEMARK, hide_markedfiles);
#undef CHECKMENU

            /* nothing currently displayed */
            DisplayMode = MODE_NULL;

            break;

        case WM_SYSCOLORCHANGE:
            {
                HIGHCONTRAST hc;

                hc.cbSize = sizeof(hc);
                SystemParametersInfo(SPI_GETHIGHCONTRAST,0 ,&hc, 0);

                mono_colours = (hc.dwFlags & HCF_HIGHCONTRASTON);
                if (mono_colours) {
                    SetMonoColours();
                } else {
                    SetColours();
                }

                CheckMenuItem(hMenu, IDM_MONOCOLS,
                              mono_colours? MF_CHECKED:MF_UNCHECKED);
                hr = StringCchPrintf(str, 32, szD, mono_colours);
        if (FAILED(hr))
          OutputError(hr, IDS_SAFE_PRINTF);
                WriteProfileString(APPNAME, szMonoColours, str);
                SendMessage(hwndRCD, message, wParam, lParam);
                SendMessage(hwndStatus, message, wParam, lParam);
                SendMessage(hwndBar, message, wParam, lParam);

                /* The diffs are still valid, but force a re-display
                 * of bar window and main table.
                 */
                SendMessage(hwndBar, WM_COMMAND, IDM_MONOCOLS, 0);
                InvalidateRect(hwndBar, NULL, TRUE);
                view_changeviewoptions(current_view);
            }
            break;

        case WM_COMMAND:
            switch (GET_WM_COMMAND_ID(wParam, lParam)) {
                case IDM_EXIT:
                    if (ghThread!=NULL) {
                        bAbort = TRUE;
                        SetStatus(LoadRcString(IDS_ABORT_PENDING));
                        break;
                    }
                    if (!view_isexpanded(current_view)) {
                        /* save the current outline size and position */
                        WINDOWPLACEMENT wp;
                        wp.length = sizeof(wp);
                        if (GetWindowPlacement(hwndClient,&wp)) {
                            WriteProfileInt(APPNAME, szOutlineShowCmd, wp.showCmd);
                            WriteProfileInt(APPNAME, szOutlineMaxX, wp.ptMaxPosition.x);
                            WriteProfileInt(APPNAME, szOutlineMaxY, wp.ptMaxPosition.y);
                            WriteProfileInt(APPNAME, szOutlineNormLeft, wp.rcNormalPosition.left);
                            WriteProfileInt(APPNAME, szOutlineNormTop, wp.rcNormalPosition.top);
                            WriteProfileInt(APPNAME, szOutlineNormRight, wp.rcNormalPosition.right);
                            WriteProfileInt(APPNAME, szOutlineNormBottom, wp.rcNormalPosition.bottom);
                            WriteProfileInt(APPNAME, szOutlineSaved, 1);
                        }
                    } else {
                        /* save the current expanded size and position */
                        WINDOWPLACEMENT wp;
                        wp.length = sizeof(wp);
                        if (GetWindowPlacement(hwndClient,&wp)) {
                            WriteProfileInt(APPNAME, szExpandShowCmd, wp.showCmd);
                            WriteProfileInt(APPNAME, szExpandMaxX, wp.ptMaxPosition.x);
                            WriteProfileInt(APPNAME, szExpandMaxY, wp.ptMaxPosition.y);
                            WriteProfileInt(APPNAME, szExpandNormLeft, wp.rcNormalPosition.left);
                            WriteProfileInt(APPNAME, szExpandNormTop, wp.rcNormalPosition.top);
                            WriteProfileInt(APPNAME, szExpandNormRight, wp.rcNormalPosition.right);
                            WriteProfileInt(APPNAME, szExpandNormBottom, wp.rcNormalPosition.bottom);
                            WriteProfileInt(APPNAME, szExpandedSaved, 1);
                        }
                    }
                    DestroyWindow(hWnd);
                    break;

                case IDM_ABORT:
                    /* abort menu item, or status bar button.
                     * the status bar button text gives the appropriate
                     * action depending on our state - abort, outline
                     * or expand. But the command sent is always
                     * IDM_ABORT. Thus we need to check the state
                     * to see what to do. If we are busy, set the abort
                     * flag. If there is nothing to view,
                     * exit, otherwise switch outline<->expand
                     */
                    if (IsBusy()) {
                        bAbort = TRUE;
                        SetStatus(LoadRcString(IDS_ABORT_PENDING));
                    } else if (DisplayMode == MODE_NULL) {
                        DestroyWindow(hWnd);
                    } else if (DisplayMode == MODE_EXPAND) {
                        ToOutline(hWnd);
                    } else {
                        ToExpand(hWnd);
                    }
                    break;

                case IDM_FILE:
                    /* select two files and compare them */
                    if (SetBusy()) {

                        /* close the current view */
                        view_close(current_view);

                        /* make a new empty view */
                        current_view = view_new(hwndRCD);

                        /* make a COMPLIST using the files dialog,
                         * and notify the view
                         */
                        if (complist_filedialog(current_view) == NULL) {
                            view_close(current_view);
                        }

                        /* all done! */
                        SetNotBusy();
                    } else {
                        BusyError();
                    }
                    break;

                case IDM_DIR:

                    /* read two directory names, scan them and
                     * compare all the files and subdirs.
                     */
                    if (SetBusy()) {

                        /* close the current view */
                        view_close(current_view);

                        /* make a new empty view */
                        current_view = view_new(hwndRCD);

                        ghThread = CreateThread(NULL, 0, wd_dirdialog,
                                                (LPVOID) current_view, 0, &threadid);

                        if (ghThread == NULL)
                        {

                            /*
                             * either we are on WIN16, or the
                             * thread call failed. continue
                             * single-threaded.
                             */
                            wd_dirdialog( (LPVOID) current_view);

                        }

                    } else {
                        BusyError();
                    }
                    break;

                case IDM_CLOSE:
                    /* close the output list -
                     * discard all results so far
                     */
                    if (!IsBusy()) {
                        view_close(current_view);
                    }
                    break;

                case IDM_PRINT:
                    /* print the current view -
                     * either the outline list of filenames,
                     * or the currently expanded file.
                     */
                    if (!IsBusy()) {
                        DoPrint();
                    } else {
                        BusyError();
                    }
                    break;

                case IDM_TIME:
                    /* show time it took */
                    {       char msg[50];
                        DWORD tim;
                        if (IsBusy()) {
                            BusyError();
                        } else {
                            tim = complist_querytime();
                            hr = StringCchPrintf(msg, 50, LoadRcString(IDS_SECONDS), tim/1000, tim%1000);
              if (FAILED(hr))
                OutputError(hr, IDS_SAFE_PRINTF);
                            Trace_Status(msg);
                        }
                    }
                    break;

                case IDM_TRACE:
                    /* enable tracing */
                    bTrace = TRUE;
                    Trace_Status(LoadRcString(IDS_TRACING_ENABLED));
                    break;

                case IDM_TRACEOFF:
                    /* enable tracing */
                    bTrace = FALSE;
                    Trace_Status(LoadRcString(IDS_TRACING_DISABLED));
                    break;

                case IDM_SAVELIST:
                    /* allow user to save list of same/different files
                     * to a text file. dialog box to give filename
                     * and select which types of file to include
                     */
                    if (current_view == NULL) {
                        MessageBox(hWnd,
                                   LoadRcString(IDS_CREATE_DIFF_LIST),
                                   szSdkDiff, MB_OK|MB_ICONSTOP);
                        break;
                    }

                    complist_savelist(view_getcomplist(current_view), NULL, outline_include);
                    break;

                case IDM_COPYFILES:
                    /*
                     * copy files that are same/different to a new
                     * root directory. dialog box allows user
                     * to select new root and inclusion options
                     */
                    if (current_view == NULL) {
                        MessageBox(hWnd,
                                   LoadRcString(IDS_CREATE_DIFF_LIST),
                                   szSdkDiff, MB_OK|MB_ICONSTOP);
                        break;
                    }

                    if (SetBusy()) {
                        ghThread = CreateThread(NULL, 0, wd_copy,
                                                (LPVOID) current_view, 0, &threadid);
                        if (ghThread == NULL)
                        {
                            wd_copy( (LPVOID) current_view);
                        }

                    } else {
                        BusyError();
                    }

                    break;

                case IDM_ABOUT:
                    ShellAbout( hWnd,
                                (LPTSTR)szSdkDiff,
                                LoadRcString(IDS_TOOL_DESCRIPTION),
                                LoadIcon(hInst, szSdkDiff)
                              );
                    break;

                case IDM_CONTENTS:
                    /* Help contents */
          TCHAR pszHelp[MAX_PATH];
          memset(pszHelp, 0, MAX_PATH);
          hr = StringCchCopy(pszHelp, MAX_PATH, pszWorkingDirectoryName);
          if (FAILED(hr))
            OutputError(hr, IDS_SAFE_COPY);
          hr = StringCchCat(pszHelp, MAX_PATH, "sdkdiff.hlp");
          if (FAILED(hr))
            OutputError(hr, IDS_SAFE_CAT);
          WinHelp(hWnd, pszHelp, HELP_INDEX, 0);
                    break;

                    /* launch an editor on the current item - left, right or
                     * composite view
                     */
                case IDM_EDITLEFT:
                    do_editthread(current_view, CI_LEFT);
                    break;

                case IDM_EDITRIGHT:
                    do_editthread(current_view, CI_RIGHT);
                    break;

                case IDM_EDITCOMP:
                    {
                        COMPITEM item = view_getitem(current_view, selection);
                        FILEDATA fdLeft;
                        FILEDATA fdRight;

                        fdLeft = compitem_getleftfile(item);
                        fdRight = compitem_getrightfile(item);
                        if ((fdLeft && file_IsUnicode(fdLeft)) || (fdRight && file_IsUnicode(fdRight))) {
                            MessageBox(hWnd, LoadRcString(IDS_NOCOMPUNICODE),
                                       szSdkDiff, MB_OK);
                        } else {
                            do_editthread(current_view, CI_COMP);
                        }
                    }
                    break;

                    /* allow customisation of the editor command line */
                case IDM_SETEDIT:
                    if (StringInput(editor_cmdline, sizeof(editor_cmdline),
                                    LoadRcString(IDS_EDITOR_COMMAND),
                                    (LPSTR)szSdkDiff, editor_cmdline)) {
                        WriteProfileString(APPNAME, szEditor,
                                           editor_cmdline);
                    }
                    break;

                case IDM_SETTABWIDTH:
                    {
                        char sz[32];
                        int n;

LTabWidth_tryagain:
                        hr = StringCchPrintf(sz, 32, "%d", g_tabwidth);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        if (StringInput(sz, sizeof(sz),
                                        LoadRcString(IDS_TABWIDTH),
                                        (LPSTR)szSdkDiff, sz))
                        {
                            n = atoi(sz);
                            if (n <= 0 || n > 100)
                            {
                                MessageBox(hWnd,
                                           LoadRcString(IDS_BAD_TABWIDTH),
                                           szSdkDiff, MB_OK);
                                goto LTabWidth_tryagain;
                            }
                            WriteProfileInt(APPNAME, szTabWidth, n);
                            g_tabwidth = n;
                            SendMessage(hwndRCD, TM_SETTABWIDTH, 0, n);
                        }
                    }
                    break;

                case IDM_TABWIDTH4:
                case IDM_TABWIDTH8:
                    g_tabwidth = (GET_WM_COMMAND_ID(wParam, lParam) == IDM_TABWIDTH8) ? 8 : 4;
                    SendMessage(hwndRCD, TM_SETTABWIDTH, 0, g_tabwidth);
                    break;

                case IDM_SETFONT:
                    {
                        CHOOSEFONT cf;
                        LOGFONT lf;
                        char szFace[LF_FACESIZE];

                        hr = StringCchCopy(szFace, LF_FACESIZE, g_szFontFaceName);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_COPY);

                        memset(&lf, 0, sizeof(lf));
                        hr = StringCchCopy(lf.lfFaceName, LF_FACESIZE, szFace);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_COPY);
                        lf.lfWeight = g_fFontBold ? FW_BOLD : FW_DONTCARE;
                        lf.lfHeight = g_nFontHeight;
                        lf.lfCharSet = g_bFontCharSet;

                        memset(&cf, 0, sizeof(cf));
                        cf.lStructSize = sizeof(CHOOSEFONT);
                        cf.hwndOwner = hWnd;
                        cf.lpLogFont = &lf;
                        cf.Flags = CF_INITTOLOGFONTSTRUCT|CF_FORCEFONTEXIST|
                                CF_SCREENFONTS|CF_LIMITSIZE;
                        cf.nSizeMin = 8;
                        cf.nSizeMax = 36;
                        cf.lpszStyle = szFace;
                        if (ChooseFont(&cf))
                            {
                            hr = StringCchCopy(g_szFontFaceName, LF_FACESIZE, lf.lfFaceName);
              if (FAILED(hr))
                OutputError(hr, IDS_SAFE_COPY);
                            g_fFontBold = (lf.lfWeight == FW_BOLD);
                            g_nFontHeight = lf.lfHeight;
                            g_bFontCharSet = lf.lfCharSet;

                            WriteProfileString(APPNAME, szFontFaceName, g_szFontFaceName);
                            WriteProfileInt(APPNAME, szFontHeight, g_nFontHeight);
                            WriteProfileInt(APPNAME, szFontBold, g_fFontBold);
                            WriteProfileInt(APPNAME, szFontCharSet, g_bFontCharSet);

                            GetFontPref();

                            view_changeviewoptions(current_view);
                            }
                    }
                    break;

                case IDM_LNRS:
                case IDM_RNRS:
                case IDM_NONRS:

                    /* option selects whether the line nrs displayed
                     * in expand mode are the line nrs in the left
                     * file, the right file or none
                     */

                    CheckMenuItem(GetMenu(hWnd),
                                  line_numbers, MF_UNCHECKED);
                    line_numbers = GET_WM_COMMAND_ID(wParam, lParam);
                    CheckMenuItem(GetMenu(hWnd), line_numbers, MF_CHECKED);
                    hr = StringCchPrintf(str, 32, szD, line_numbers);
          if (FAILED(hr))
            OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szLineNumbers, str);

                    /* change the display to show the line nr style
                     * chosen
                     */

                    view_changeviewoptions(current_view);
                    break;

                /*
                 * options selecting which lines to include in the
                 * expand listing, based on their state
                 */
                case IDM_EXPAND_INCSAME:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_SAME;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCSAME,
                              (expand_include & INCLUDE_SAME) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCLEFT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_LEFTONLY;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCLEFT,
                              (expand_include & INCLUDE_LEFTONLY) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCRIGHT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_RIGHTONLY;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCRIGHT,
                              (expand_include & INCLUDE_RIGHTONLY) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCMOVEDLEFT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_MOVEDLEFT;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCMOVEDLEFT,
                              (expand_include & INCLUDE_MOVEDLEFT) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCMOVEDRIGHT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_MOVEDRIGHT;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCMOVEDRIGHT,
                              (expand_include & INCLUDE_MOVEDRIGHT) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCSIMILARLEFT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_SIMILARLEFT;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCSIMILARLEFT,
                              (expand_include & INCLUDE_SIMILARLEFT) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCSIMILARRIGHT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_SIMILARRIGHT;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCSIMILARRIGHT,
                              (expand_include & INCLUDE_SIMILARRIGHT) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                    /*
                     * options selecting which files to include in the
                     * outline listing, based on their state
                     */
                case IDM_OUTLINE_INCLEFT:

                    /* toggle flag in outline_include options */
                    outline_include ^= INCLUDE_LEFTONLY;

                    /* check/uncheck as necessary */
                    CheckMenuItem(hMenu, IDM_OUTLINE_INCLEFT,
                                  (outline_include & INCLUDE_LEFTONLY) ?
                                  MF_CHECKED:MF_UNCHECKED);

                    hr = StringCchPrintf(str, 32, szD, outline_include);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szFileInclude, str);
                    view_changeviewoptions(current_view);

                    break;

                case IDM_OUTLINE_INCRIGHT:

                    outline_include ^= INCLUDE_RIGHTONLY;

                    CheckMenuItem(hMenu, IDM_OUTLINE_INCRIGHT,
                                  (outline_include & INCLUDE_RIGHTONLY) ?
                                  MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, outline_include);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szFileInclude, str);
                    view_changeviewoptions(current_view);

                    break;

                case IDM_OUTLINE_INCSAME:

                    outline_include ^= INCLUDE_SAME;

                    CheckMenuItem(hMenu, IDM_OUTLINE_INCSAME,
                                  (outline_include & INCLUDE_SAME) ?
                                  MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, outline_include);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szFileInclude, str);
                    view_changeviewoptions(current_view);

                    break;

                case IDM_OUTLINE_INCDIFFER:

                    outline_include ^= INCLUDE_DIFFER;

                    CheckMenuItem(hMenu, IDM_OUTLINE_INCDIFFER,
                                  (outline_include & INCLUDE_DIFFER) ?
                                  MF_CHECKED:MF_UNCHECKED);

                    hr = StringCchPrintf(str, 32, szD, outline_include);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szFileInclude, str);
                    view_changeviewoptions(current_view);

                    break;

                case IDM_UPDATE:
                    OnUpdate( (COMPITEM) lParam);
                    break;

                case IDM_RESCAN:
                    RescanFile(hWnd);

                    /* do we need to force any repaints? */
                    // - no, as RescanFile sends a IDM_UPDATE
                    break;

                case IDM_LONLY:
                case IDM_RONLY:
                case IDM_BOTHFILES:
                    /* option selects whether the expanded file
                     * show is the combined file, or just one
                     * or other of the input files.
                     *
                     * if we are not in expand mode, this also
                     * causes us to expand the selection
                     */

                    CheckMenuItem(GetMenu(hWnd), expand_mode, MF_UNCHECKED);
                    expand_mode = GET_WM_COMMAND_ID(wParam, lParam);
                    CheckMenuItem(GetMenu(hWnd), expand_mode, MF_CHECKED);

                    /* change the current view to show only the lines
                     * of the selected type.
                     */
                    if (DisplayMode == MODE_OUTLINE) {
                        ToExpand(hWnd);
                    } else {
                        view_changeviewoptions(current_view);
                    }

                    break;

                case IDM_IGNBLANKS:

                    /* if selected, ignore all spaces and tabs on
                     * comparison - expand view only: outline view
                     * will still show that 'text files differ'
                     */

                    ignore_blanks = !ignore_blanks;
                    CheckMenuItem(hMenu, IDM_IGNBLANKS,
                                  ignore_blanks? MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, ignore_blanks);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szBlanks, str);

                    /* invalidate all diffs since we have
                     * changed diff options, and re-do and display the
                     * current diff if we are in expand mode.
                     */
                    view_changediffoptions(current_view);

                    /* force repaint of bar window */
                    InvalidateRect(hwndBar, NULL, TRUE);

                    break;

                case IDM_SHOWWHITESPACE:

                        /* if selected, display all spaces and tabs in
                           the expanded text view */
                        show_whitespace = !show_whitespace;
                        CheckMenuItem(hMenu, IDM_SHOWWHITESPACE,
                                show_whitespace ? MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, show_whitespace);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szShowWhitespace, str);

                        // change the current view to show only the lines
                        // of the selected type.
                        if (DisplayMode == MODE_EXPAND) {
                                view_changeviewoptions(current_view);
                        }

                        break;

                case IDM_ALG2:

                    /* if selected, do algorithm2 which does not accept
                     * unsafe matches.
                     */

                    Algorithm2 = !Algorithm2;
                    CheckMenuItem(hMenu, IDM_ALG2,
                                  Algorithm2? MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, Algorithm2);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szAlgorithm2, str);

                    /* invalidate all diffs since we have
                     * changed diff options, and re-do and display the
                     * current diff if we are in expand mode.
                     */
                    view_changediffoptions(current_view);

                    /* force repaint of bar window */
                    InvalidateRect(hwndBar, NULL, TRUE);

                    break;

                case IDM_MONOCOLS:

                    /* Use monochrome colours - toggle */

                    mono_colours = !mono_colours;
                    CheckMenuItem(hMenu, IDM_MONOCOLS,
                                  mono_colours? MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, mono_colours);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szMonoColours, str);
                    if (mono_colours)
                        SetMonoColours();
                    else
                        SetColours();

                    /* The diffs are still valid, but force a re-display
                     * of bar window and main table.
                     */
                    SendMessage(hwndBar, WM_COMMAND, IDM_MONOCOLS, 0);
                    InvalidateRect(hwndBar, NULL, TRUE);
                    view_changeviewoptions(current_view);

                    break;

                case IDM_PICTURE:
                    picture_mode = !picture_mode;
                    CheckMenuItem(hMenu, IDM_PICTURE,
                                  picture_mode? MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, picture_mode);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szPicture, str);
                    DoResize(hWnd);
                    break;

                case IDM_HIDEMARK:
                    // toggle state of marked files hidden or not
                    hide_markedfiles = !hide_markedfiles;
                    CheckMenuItem(hMenu, IDM_HIDEMARK,
                                  hide_markedfiles? MF_CHECKED : MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, hide_markedfiles);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szHideMark, str);

                    // rebuild view with new global option
                    // - note that marks only affect outline views
                    if (!view_isexpanded(current_view)) {
                        view_changeviewoptions(current_view);
                    }
                    break;

                case IDM_FIND:
                  {
                  int nRet = IDCANCEL;
                  DLGPROC lpProc = (DLGPROC) MakeProcInstance((WINPROCTYPE) FindDlgProc, hInst);
                  if (lpProc)
                    {
                    char *pszFind = NULL;
                    sdkdiff_UI(TRUE);
                    nRet = (BOOL) DialogBoxParam(hInst, (LPCTSTR) IDD_FIND, hwndClient, lpProc, 0L);
                    sdkdiff_UI(FALSE);
                    FreeProcInstance(lpProc);
                    }
                  }
                  break;

                case IDM_FINDNEXT:
                  {
                  const LONG iCol = (view_isexpanded(current_view)) ? 2 : 1;
                  FindString(hWnd, iCol, NULL, 1, 0);
                  break;
                  }

                case IDM_FINDPREV:
                  {
                  const LONG iCol = (view_isexpanded(current_view)) ? 2 : 1;
                  FindString(hWnd, iCol, NULL, -1, 0);
                  break;
                  }

                case IDM_GOTOLINE:
                  {
                  if (!view_getrowcount(current_view))
                    {
                    MessageBox(hWnd, LoadRcString(IDS_GOTOLINE_NOLINES), szSdkDiff, MB_OK|MB_ICONSTOP|MB_TASKMODAL);
                    }
                  else
                    {
                    DLGPROC lpProc = (DLGPROC) MakeProcInstance((WINPROCTYPE)GoToLineDlgProc, hInst);
                    if (lpProc)
                      {
                      sdkdiff_UI(TRUE);
                      DialogBoxParam(hInst, (LPCTSTR) IDD_GOTOLINE, hwndClient, lpProc, 0L);
                      sdkdiff_UI(FALSE);
                      FreeProcInstance(lpProc);
                      }
                    }
                  }
                  break;

                case IDM_EDITCOPY:
                    {
                        unsigned long cb = 0;
                        LPCSTR pszText = NULL;
                        long iRow = 0;
                        const BOOL fOutline = !view_isexpanded(current_view);

                        /* first count total data size */
                        for (iRow = 0; iRow < selection_nrows; iRow++) {
                            if (fOutline) {
                                pszText = view_gettext(current_view, selection + iRow, 1);
                                if (!pszText)
                                    break;
                                cb += (lstrlen(pszText) + 3) * sizeof(char);
                            }

                            pszText = view_gettext(current_view, selection + iRow, 2);
                            if (!pszText)
                                break;
                            cb += (lstrlen(pszText)) * sizeof(char);
                        }

                        if (cb && OpenClipboard(NULL)) {
                            /* space for trailing nul char */
                            cb++;

                            /* copy data to clipboard */
                            if (EmptyClipboard()) {
                                HGLOBAL hData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,  cb);

                                if (hData) {
                                    void *pv = hData;
                                    if (!pv) {
                                        HeapFree(GetProcessHeap(), NULL, hData);
                                    }
                                    else {
                                        LPSTR pszBuf = (LPSTR) pv;
                                        memset(pv, 0, cb);

                                        for (iRow = 0; iRow < selection_nrows; iRow++) {
                                            if (fOutline) {
                                                pszText = view_gettext(current_view, selection + iRow, 1);
                                                if (!pszText)
                                                    break;

                                                hr = StringCchCopy(pszBuf, cb, pszText);
                        if (FAILED(hr))
                          OutputError(hr, IDS_SAFE_COPY);
                                                pszBuf += lstrlen(pszBuf);
                                                *(pszBuf++) = '\t';
                                                *pszBuf = 0;
                                            }

                                            pszText = view_gettext(current_view, selection + iRow, 2);
                                            if (!pszText)
                                                break;

                                            hr = StringCchCopy(pszBuf, cb, pszText);
                      if (FAILED(hr))
                        OutputError(hr, IDS_SAFE_COPY);
                                            pszBuf += lstrlen(pszBuf);

                                            if (fOutline) {
                                                *(pszBuf++) = '\r';
                                                *(pszBuf++) = '\n';
                                                *pszBuf = 0;
                                            }
                                        }

                                        SetClipboardData(CF_TEXT, hData);
                                    }
                                }
                            }
                            CloseClipboard();
                        }
                    }
                    break;

                case IDM_MARK:
                    {
                        BOOL bChanged = FALSE;
                        int i;

                        // toggle the mark on the current selection
                        // note that the selection could be multiple rows
                        for (i = 0; i < selection_nrows; i++) {

                            if (view_setmarkstate(current_view, selection + i,
                                                  !view_getmarkstate(current_view, selection + i))) {

                                bChanged = TRUE;
                            }
                        }

                        if (bChanged) {
                            // yes the mark state was changed - need
                            // to rebuild the view.
                            if (!view_isexpanded(current_view)) {
                                view_changeviewoptions(current_view);
                            }
                        }
                        break;
                    }

                case IDM_TOGGLEMARK:
                    // toggle the state of all files: unmark all
                    // marked files and vice versa
                    complist_togglemark(view_getcomplist(current_view));

                    // rebuild view
                    if (!view_isexpanded(current_view)) {
                        view_changeviewoptions(current_view);
                    }
                    break;

                case IDM_MARKPATTERN:
                    // dialog to query the pattern, then set a mark on
                    // all compitems whose title matches that pattern
                    // returns TRUE if anything was changed
                    if (complist_markpattern(view_getcomplist(current_view))) {

                        // rebuild view
                        if (!view_isexpanded(current_view)) {
                            view_changeviewoptions(current_view);
                        }
                    }
                    break;

                case IDM_EXPAND:

                    /* show the expanded view of the
                     * selected file
                     */
                    if (current_view != NULL) {
                        ToExpand(hWnd);
                    }

                    break;

                case IDM_OUTLINE:
                    /* return to the outline view (list of filenames) */
                    ToOutline(hWnd);

                    break;

                case IDM_FCHANGE:
                    /* find the next line in the current view
                     * that is not the same in both files -
                     * in outline view, finds the next filename that
                     * is not identical
                     */
                    FindNextChange();
                    break;

                case IDM_FPCHANGE:
                    /* same as IDM_FCHANGE, but going backwards from
                     * current position
                     */
                    FindPrevChange();
                    break;

                case IDM_FCHANGE_LAURIE:
                    /* same as IDM_FCHANGE, but tries to keep cursor on same
                     * line.
                     */
                    _FindNextChange(TRUE, FALSE);
                    break;

                case IDM_FPCHANGE_LAURIE:
                    /* same as IDM_FPCHANGE, but tries to keep cursor on same
                     * line.
                     */
                    _FindPrevChange(TRUE, FALSE);
                    break;

                    // given a line that has been moved, jump to the
                    // other representation of the same line.
                    // this used to be available just through double-click
                    // but now is also available from a context menu
                case IDM_TOMOVED:
                    ToMoved(hWnd, TRUE);
                    break;
            }
            break;

        case WM_SIZE:
            DoResize(hWnd);
            break;

        case WM_SETFOCUS:
            /* set the focus on the table class so it can process
             * page-up /pagedown keys etc.
             */
            SetFocus(hwndRCD);
            break;

        case WM_KEYDOWN:
            /* although the table window has the focus, he passes
             * back to us any keys he doesn't understand
             * We handle escape here to mean 'return to outline view'
             */
            if (wParam == VK_ESCAPE) {
                ToOutline(hWnd);
            } else if (wParam == VK_APPS) {
                // Handle the context menu keyboard key
                POINT posCursor;
                GetCursorPos(&posCursor);
                ScreenToClient(hwndRCD, &posCursor);
                OnRightClick(hWnd, posCursor.x, posCursor.y);
            }
            break;

        case WM_RBUTTONDOWN:
            /*
             * the table window handles this by performing the
             * selection and then passing the message to us, allowing
             * us to put up a context menu.
             */
            OnRightClick(hWnd, LOWORD(lParam), HIWORD(lParam));
            break;

        case WM_CLOSE:
            SendMessage(hWnd, WM_COMMAND, IDM_EXIT, 0);
            return TRUE;

            /* don't allow close when busy - process this message in
             * order to ensure this
             */
            break;

        case WM_DESTROY:
      TCHAR pszHelp[MAX_PATH];
      memset(pszHelp, 0, MAX_PATH);
      hr = StringCchCopy(pszHelp, MAX_PATH, pszWorkingDirectoryName);
      if (FAILED(hr))
        OutputError(hr, IDS_SAFE_COPY);
      hr = StringCchCat(pszHelp, MAX_PATH, "sdkdiff.hlp");
      if (FAILED(hr))
        OutputError(hr, IDS_SAFE_COPY);
            DeleteTools();
            WinHelp(hWnd, pszHelp, HELP_QUIT, 0);
            PostQuitMessage(0);
            break;

        case TM_CURRENTVIEW:
            /* allow other people such as the bar window to query the
             * current view
             */
            return((INT_PTR) current_view);

#ifdef LATER
#ifdef WM_MOUSEWHEEL
        case WM_MOUSEWHEEL:
            if (LOWORD(wParam) & MK_MBUTTON) {
                if ((short)HIWORD(wParam) < 0) {
                    // The next occurence
                    _FindNextChange(FALSE, TRUE);
                }
                else {
                    _FindPrevChange(FALSE, TRUE);
                }
            }
            break;
#endif
#endif

        case WM_QUERYENDSESSION:
            if (IsBusy())
                return FALSE;
            return TRUE;

        case WM_ENDSESSION:
            SendMessage(hWnd, WM_CLOSE, 0, 0);
            break;

        default:
            /* handle registered table messages */
            if (message == table_msgcode) {
                ret = TableServer(hWnd, wParam, lParam);
                return(ret);
            }
            return(DefWindowProc(hWnd, message, wParam, lParam));
    }
    return(0);
}

int PASCAL WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

_tWinMain - Application entry point and dispatch loop

Definition at line 48 of file Demo.c.

{

    HWND hWnd;
    MSG msg;
    CHAR szAppName[64];

    UNREFERENCED_PARAMETER(lpCmdLine);

    if (!hPrevInstance)
        if (!DemoInit(hInstance))
            return (0);

    hInst = hInstance;
    LoadString(hInstance, IDS_APPNAME, szAppName, sizeof(szAppName));

    hWnd = CreateWindow("Demo",
        szAppName,
        WS_OVERLAPPEDWINDOW,
        CW_USEDEFAULT,
        CW_USEDEFAULT,
        CW_USEDEFAULT,
        CW_USEDEFAULT,
        NULL,
        NULL,
        hInstance,
        NULL);

    if (!hWnd)
        return (0);

    ShowWindow(hWnd, nCmdShow);
    UpdateWindow(hWnd);

    while (GetMessage(&msg, NULL, 0, 0)) {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }
    return (int)(msg.wParam);
}

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpDnd/site.Cpp File Reference

  • Com
  • Fundamentals
  • SimpDnd
Functions

site.Cpp File Reference

#include "pre.h"
#include "iocs.h"
#include "ias.h"
#include "app.h"
#include "site.h"
#include "doc.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CSimpleSite

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 378 of file site.Cpp.

{
  OutputDebugString("In CSimpleSite::Release\r\n");

  if (--m_nCount == 0) {
    delete this;
    return 0;
  }
  return m_nCount;
}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpDnd/site.h File Reference

  • Com
  • Fundamentals
  • SimpDnd
Classes

site.h File Reference

#include <ole2.h>
#include "ias.h"
#include "iocs.h"

Go to the source code of this file.

Classes

class CSimpleSite
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpSvr/app.Cpp File Reference

  • Com
  • Fundamentals
  • SimpSvr
Functions

app.Cpp File Reference

#include "pre.h"
#include "obj.h"
#include "app.h"
#include "doc.h"
#include "icf.h"
#include "initguid.h"

Go to the source code of this file.

Functions

DEFINE_GUID (GUID_SIMPLE, 0xBCF6D4A0, 0xBE8C, 0x1068, 0xB6, 0xD4, 0x00, 0xDD, 0x01, 0x0C, 0x05, 0x09)
STDMETHODIMP_ (ULONG) CSimpSvrApp

Function Documentation

DEFINE_GUID | ( | GUID_SIMPLE | ,
 |  | 0xBCF6D4A0 | ,
 |  | 0xBE8C | ,
 |  | 0x1068 | ,
 |  | 0xB6 | ,
 |  | 0xD4 | ,
 |  | 0x00 | ,
 |  | 0xDD | ,
 |  | 0x01 | ,
 |  | 0x0C | ,
 |  | 0x05 | ,
 |  | 0x09 |
 | ) |  |
STDMETHODIMP_ ( ULONG )

Definition at line 229 of file app.Cpp.

{
        OutputDebugString("In CSimpSvrApp::Release\r\n");

        return SafeRelease();
}

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpSvr/app.h File Reference

  • Com
  • Fundamentals
  • SimpSvr
Classes

app.h File Reference

#include <stablize.h>

Go to the source code of this file.

Classes

class CSimpSvrApp
Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpSvr/doc.Cpp File Reference

  • Com
  • Fundamentals
  • SimpSvr
Functions

doc.Cpp File Reference

#include "pre.h"
#include "obj.h"
#include "app.h"
#include "doc.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CSimpSvrDoc

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 288 of file doc.Cpp.

{
        OutputDebugString("In CSimpSvrDoc::Release\r\n");
        // Release the app, but return the app count
        m_lpApp->Release();

        return SafeRelease();
}

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpSvr/doc.h File Reference

  • Com
  • Fundamentals
  • SimpSvr
Classes

doc.h File Reference

#include <stablize.h>

Go to the source code of this file.

Classes

class CSimpSvrDoc
Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpSvr/icf.Cpp File Reference

  • Com
  • Fundamentals
  • SimpSvr
Functions

icf.Cpp File Reference

#include "pre.h"
#include "app.h"
#include "doc.h"
#include "icf.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CClassFactory

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 131 of file icf.Cpp.

{
  OutputDebugString("In CClassFactory::Release\r\n");

  if (--m_nCount == 0) {
    delete this;
        return 0;
    }

  return m_nCount;
};

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpSvr/icf.h File Reference

  • Com
  • Fundamentals
  • SimpSvr
Functions | Variables

icf.h File Reference

Go to the source code of this file.

Functions

STDMETHODIMP | CreateInstance (LPUNKNOWN pUnkOuter, REFIID riid, LPVOID FAR *ppvObject)
STDMETHODIMP | LockServer (BOOL fLock)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID FAR *ppvObj)
STDMETHODIMP_ (ULONG) AddRef()

Variables

CSimpSvrApp FAR * | m_lpApp

Function Documentation

STDMETHODIMP CreateInstance | ( | LPUNKNOWN | pUnkOuter,
 |  | REFIID | riid,
 |  | LPVOID FAR * | ppvObject
 | ) |  |
STDMETHODIMP LockServer ( BOOL fLock )
STDMETHODIMP QueryInterface | ( | REFIID | riid,
 |  | LPVOID FAR * | ppvObj
 | ) |  |
STDMETHODIMP_ ( ULONG )

Definition at line 398 of file DataObj.Cpp.

{
  TCHAR szText[MAX_PATH];
  wsprintf(szText, TEXT("CEnumFormatEtc::Release - ref count will be %d\n"), m_ObjRefCount - 1);
  OutputDebugString(szText);

  if(0 == --m_ObjRefCount)
  {
    delete this;
    return 0;
  }

  return m_ObjRefCount;
}

Variable Documentation

CSimpSvrApp FAR* m_lpApp

Definition at line 18 of file icf.h.

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpSvr/ido.Cpp File Reference

  • Com
  • Fundamentals
  • SimpSvr
Functions

ido.Cpp File Reference

#include "pre.h"
#include "obj.h"
#include "ido.h"
#include "app.h"
#include "doc.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CDataObject

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 118 of file ido.Cpp.

{
  OutputDebugString("In CDataObject::Release\r\n");
  --m_nCount;
  return m_lpObj->Release();
};

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpSvr/ido.h File Reference

  • Com
  • Fundamentals
  • SimpSvr
Functions | Variables

ido.h File Reference

#include <ole2.h>
#include "obj.h"

Go to the source code of this file.

Functions

STDMETHODIMP | DAdvise (FORMATETC FAR *pFormatetc, DWORD advf, LPADVISESINK pAdvSink, DWORD FAR *pdwConnection)
STDMETHODIMP | DUnadvise (DWORD dwConnection)
STDMETHODIMP | EnumDAdvise (LPENUMSTATDATA FAR *ppenumAdvise)
STDMETHODIMP | EnumFormatEtc (DWORD dwDirection, LPENUMFORMATETC FAR *ppenumFormatEtc)
STDMETHODIMP | GetCanonicalFormatEtc (LPFORMATETC pformatetc, LPFORMATETC pformatetcOut)
STDMETHODIMP | GetData (LPFORMATETC pformatetcIn, LPSTGMEDIUM pmedium)
STDMETHODIMP | GetDataHere (LPFORMATETC pformatetc, LPSTGMEDIUM pmedium)
STDMETHODIMP | QueryGetData (LPFORMATETC pformatetc)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID FAR *ppvObj)
STDMETHODIMP | SetData (LPFORMATETC pformatetc, STGMEDIUM FAR *pmedium, BOOL fRelease)
STDMETHODIMP_ (ULONG) AddRef()

Variables

int | m_nCount

Function Documentation

STDMETHODIMP DAdvise | ( | FORMATETC FAR * | pFormatetc,
 |  | DWORD | advf,
 |  | LPADVISESINK | pAdvSink,
 |  | DWORD FAR * | pdwConnection
 | ) |  |
STDMETHODIMP DUnadvise ( DWORD dwConnection )
STDMETHODIMP EnumDAdvise ( LPENUMSTATDATA FAR * ppenumAdvise )
STDMETHODIMP EnumFormatEtc | ( | DWORD | dwDirection,
 |  | LPENUMFORMATETC FAR * | ppenumFormatEtc
 | ) |  |
STDMETHODIMP GetCanonicalFormatEtc | ( | LPFORMATETC | pformatetc,
 |  | LPFORMATETC | pformatetcOut
 | ) |  |
STDMETHODIMP GetData | ( | LPFORMATETC | pformatetcIn,
 |  | LPSTGMEDIUM | pmedium
 | ) |  |
STDMETHODIMP GetDataHere | ( | LPFORMATETC | pformatetc,
 |  | LPSTGMEDIUM | pmedium
 | ) |  |
STDMETHODIMP QueryGetData ( LPFORMATETC pformatetc )
STDMETHODIMP QueryInterface | ( | REFIID | riid,
 |  | LPVOID FAR * | ppvObj
 | ) |  |
STDMETHODIMP SetData | ( | LPFORMATETC | pformatetc,
 |  | STGMEDIUM FAR * | pmedium,
 |  | BOOL | fRelease
 | ) |  |
STDMETHODIMP_ ( ULONG )

Definition at line 398 of file DataObj.Cpp.

{
  TCHAR szText[MAX_PATH];
  wsprintf(szText, TEXT("CEnumFormatEtc::Release - ref count will be %d\n"), m_ObjRefCount - 1);
  OutputDebugString(szText);

  if(0 == --m_ObjRefCount)
  {
    delete this;
    return 0;
  }

  return m_ObjRefCount;
}

Variable Documentation

int m_nCount

Definition at line 21 of file ido.h.

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpSvr/iec.Cpp File Reference

  • Com
  • Fundamentals
  • SimpSvr
Functions

iec.Cpp File Reference

#include "pre.h"
#include "obj.h"
#include "iec.h"
#include "app.h"
#include "doc.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CExternalConnection
STDMETHODIMP_ (DWORD) CExternalConnection

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 120 of file iec.Cpp.

{
  OutputDebugString("In CExternalConnection::Release\r\n");
  --m_nCount;
  return m_lpObj->Release();
};

STDMETHODIMP_ ( DWORD )

Definition at line 198 of file iec.Cpp.

{
  OutputDebugString("In CExternalConnection::ReleaseConnection\r\n");

  if (extconn & EXTCONN_STRONG)
    {
    DWORD dwSave = --m_dwStrong;

    if (!m_dwStrong && fLastReleaseCloses)
      m_lpObj->m_OleObject.Close(OLECLOSE_SAVEIFDIRTY);

    return dwSave;
    }
  return 0;
}

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpSvr/iec.h File Reference

  • Com
  • Fundamentals
  • SimpSvr
Functions | Variables

iec.h File Reference

#include <ole2.h>
#include "obj.h"

Go to the source code of this file.

Functions

STDMETHODIMP | QueryInterface (REFIID riid, LPVOID FAR *ppvObj)
STDMETHODIMP_ (DWORD) AddConnection(DWORD extconn
STDMETHODIMP_ (ULONG) AddRef()

Variables

DWORD BOOL fLastReleaseCloses
DWORD m_dwStrong
int | m_nCount
DWORD reserved

Function Documentation

STDMETHODIMP QueryInterface | ( | REFIID | riid,
 |  | LPVOID FAR * | ppvObj
 | ) |  |
STDMETHODIMP_ ( DWORD )
STDMETHODIMP_ ( ULONG )

Definition at line 398 of file DataObj.Cpp.

{
  TCHAR szText[MAX_PATH];
  wsprintf(szText, TEXT("CEnumFormatEtc::Release - ref count will be %d\n"), m_ObjRefCount - 1);
  OutputDebugString(szText);

  if(0 == --m_ObjRefCount)
  {
    delete this;
    return 0;
  }

  return m_ObjRefCount;
}

Variable Documentation

DWORD BOOL fLastReleaseCloses

Definition at line 41 of file iec.h.

DWORD m_dwStrong

Definition at line 22 of file iec.h.

int m_nCount

Definition at line 21 of file iec.h.

DWORD reserved

Definition at line 40 of file iec.h.

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpSvr/ioipao.Cpp File Reference

  • Com
  • Fundamentals
  • SimpSvr
Functions

ioipao.Cpp File Reference

#include "pre.h"
#include "obj.h"
#include "ioipao.h"
#include "app.h"
#include "doc.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) COleInPlaceActiveObject

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 118 of file ioipao.Cpp.

{
  OutputDebugString("In COleInPlaceActiveObject::Release\r\n");

  --m_nCount;

  return m_lpObj->Release();
}

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpSvr/ioipao.h File Reference

  • Com
  • Fundamentals
  • SimpSvr
Functions | Variables

ioipao.h File Reference

#include <ole2.h>
#include "obj.h"

Go to the source code of this file.

Functions

STDMETHODIMP | ContextSensitiveHelp (BOOL fEnterMode)
STDMETHODIMP | EnableModeless (BOOL fEnable)
STDMETHODIMP | GetWindow (HWND FAR *lphwnd)
STDMETHODIMP | OnDocWindowActivate (BOOL fActivate)
STDMETHODIMP | OnFrameWindowActivate (BOOL fActivate)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID FAR *ppvObj)
STDMETHODIMP | ResizeBorder (LPCRECT lprectBorder, LPOLEINPLACEUIWINDOW lpUIWindow, BOOL fFrameWindow)
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP | TranslateAccelerator (LPMSG lpmsg)

Variables

int | m_nCount

Function Documentation

STDMETHODIMP ContextSensitiveHelp ( BOOL fEnterMode )
STDMETHODIMP EnableModeless ( BOOL fEnable )
STDMETHODIMP GetWindow ( HWND FAR * lphwnd )
STDMETHODIMP OnDocWindowActivate ( BOOL fActivate )
STDMETHODIMP OnFrameWindowActivate ( BOOL fActivate )
STDMETHODIMP QueryInterface | ( | REFIID | riid,
 |  | LPVOID FAR * | ppvObj
 | ) |  |
STDMETHODIMP ResizeBorder | ( | LPCRECT | lprectBorder,
 |  | LPOLEINPLACEUIWINDOW | lpUIWindow,
 |  | BOOL | fFrameWindow
 | ) |  |
STDMETHODIMP_ ( ULONG )

Definition at line 398 of file DataObj.Cpp.

{
  TCHAR szText[MAX_PATH];
  wsprintf(szText, TEXT("CEnumFormatEtc::Release - ref count will be %d\n"), m_ObjRefCount - 1);
  OutputDebugString(szText);

  if(0 == --m_ObjRefCount)
  {
    delete this;
    return 0;
  }

  return m_ObjRefCount;
}

STDMETHODIMP TranslateAccelerator ( LPMSG lpmsg )

Variable Documentation

int m_nCount

Definition at line 22 of file ioipao.h.

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpSvr/ioipo.Cpp File Reference

  • Com
  • Fundamentals
  • SimpSvr
Functions

ioipo.Cpp File Reference

#include "pre.h"
#include "obj.h"
#include "ioipo.h"
#include "app.h"
#include "doc.h"
#include "math.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) COleInPlaceObject

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 119 of file ioipo.Cpp.

{
        OutputDebugString("In COleInPlaceObject::Release\r\n");
        --m_nCount;
        return m_lpObj->Release();
}

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpSvr/ioipo.h File Reference

  • Com
  • Fundamentals
  • SimpSvr
Functions | Variables

ioipo.h File Reference

#include <ole2.h>
#include "obj.h"

Go to the source code of this file.

Functions

STDMETHODIMP | ContextSensitiveHelp (BOOL fEnterMode)
STDMETHODIMP | GetWindow (HWND FAR *lphwnd)
STDMETHODIMP | InPlaceDeactivate ()
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID FAR *ppvObj)
STDMETHODIMP | ReactivateAndUndo ()
STDMETHODIMP | SetObjectRects (LPCRECT lprcPosRect, LPCRECT lprcClipRect)
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP | UIDeactivate ()

Variables

int | m_nCount

Function Documentation

STDMETHODIMP ContextSensitiveHelp ( BOOL fEnterMode )
STDMETHODIMP GetWindow ( HWND FAR * lphwnd )
STDMETHODIMP InPlaceDeactivate ( )
STDMETHODIMP QueryInterface | ( | REFIID | riid,
 |  | LPVOID FAR * | ppvObj
 | ) |  |
STDMETHODIMP ReactivateAndUndo ( )
STDMETHODIMP SetObjectRects | ( | LPCRECT | lprcPosRect,
 |  | LPCRECT | lprcClipRect
 | ) |  |
STDMETHODIMP_ ( ULONG )

Definition at line 398 of file DataObj.Cpp.

{
  TCHAR szText[MAX_PATH];
  wsprintf(szText, TEXT("CEnumFormatEtc::Release - ref count will be %d\n"), m_ObjRefCount - 1);
  OutputDebugString(szText);

  if(0 == --m_ObjRefCount)
  {
    delete this;
    return 0;
  }

  return m_ObjRefCount;
}

STDMETHODIMP UIDeactivate ( )

Variable Documentation

int m_nCount

Definition at line 22 of file ioipo.h.

Generated on Wed Nov 13 2024 16:53:17 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpSvr/ioo.Cpp File Reference

  • Com
  • Fundamentals
  • SimpSvr
Defines | Functions

ioo.Cpp File Reference

#include "pre.h"
#include "obj.h"
#include "ioo.h"
#include "app.h"
#include "doc.h"

Go to the source code of this file.

Defines

#define VERB_OPEN 1

Functions

STDMETHODIMP_ (ULONG) COleObject

Define Documentation

#define VERB_OPEN 1

Definition at line 19 of file ioo.Cpp.

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 118 of file ioo.Cpp.

{
        OutputDebugString("In COleObject::Release\r\n");
        --m_nCount;
        return m_lpObj->Release();
}

Generated on Wed Nov 13 2024 16:53:17 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpSvr/ioo.h File Reference

  • Com
  • Fundamentals
  • SimpSvr
Functions | Variables

ioo.h File Reference

#include <ole2.h>
#include "obj.h"

Go to the source code of this file.

Functions

STDMETHODIMP | Advise (LPADVISESINK pAdvSink, DWORD FAR *pdwConnection)
STDMETHODIMP | Close (DWORD dwSaveOption)
STDMETHODIMP | DoVerb (LONG iVerb, LPMSG lpmsg, LPOLECLIENTSITE pActiveSite, LONG lindex, HWND hwndParent, LPCRECT lprcPosRect)
STDMETHODIMP | EnumAdvise (LPENUMSTATDATA FAR *ppenumAdvise)
STDMETHODIMP | EnumVerbs (LPENUMOLEVERB FAR *ppenumOleVerb)
STDMETHODIMP | GetClientSite (LPOLECLIENTSITE FAR *ppClientSite)
STDMETHODIMP | GetClipboardData (DWORD dwReserved, LPDATAOBJECT FAR *ppDataObject)
STDMETHODIMP | GetExtent (DWORD dwDrawAspect, LPSIZEL lpsizel)
STDMETHODIMP | GetMiscStatus (DWORD dwAspect, DWORD FAR *pdwStatus)
STDMETHODIMP | GetMoniker (DWORD dwAssign, DWORD dwWhichMoniker, LPMONIKER FAR *ppmk)
STDMETHODIMP | GetUserClassID (CLSID FAR *pClsid)
STDMETHODIMP | GetUserType (DWORD dwFormOfType, LPOLESTR FAR *pszUserType)
STDMETHODIMP | InitFromData (LPDATAOBJECT pDataObject, BOOL fCreation, DWORD dwReserved)
STDMETHODIMP | IsUpToDate ()
void | OpenEdit (LPOLECLIENTSITE pActiveSite)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID FAR *ppvObj)
STDMETHODIMP | SetClientSite (LPOLECLIENTSITE pClientSite)
STDMETHODIMP | SetColorScheme (LPLOGPALETTE lpLogpal)
STDMETHODIMP | SetExtent (DWORD dwDrawAspect, LPSIZEL lpsizel)
STDMETHODIMP | SetHostNames (LPCOLESTR szContainerApp, LPCOLESTR szContainerObj)
STDMETHODIMP | SetMoniker (DWORD dwWhichMoniker, LPMONIKER pmk)
STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP | Unadvise (DWORD dwConnection)
STDMETHODIMP | Update ()

Variables

BOOL m_fOpen
int | m_nCount

Function Documentation

STDMETHODIMP Advise | ( | LPADVISESINK | pAdvSink,
 |  | DWORD FAR * | pdwConnection
 | ) |  |
STDMETHODIMP Close ( DWORD dwSaveOption )
STDMETHODIMP DoVerb | ( | LONG | iVerb,
 |  | LPMSG | lpmsg,
 |  | LPOLECLIENTSITE | pActiveSite,
 |  | LONG | lindex,
 |  | HWND | hwndParent,
 |  | LPCRECT | lprcPosRect
 | ) |  |
STDMETHODIMP EnumAdvise ( LPENUMSTATDATA FAR * ppenumAdvise )
STDMETHODIMP EnumVerbs ( LPENUMOLEVERB FAR * ppenumOleVerb )
STDMETHODIMP GetClientSite ( LPOLECLIENTSITE FAR * ppClientSite )
STDMETHODIMP GetClipboardData | ( | DWORD | dwReserved,
 |  | LPDATAOBJECT FAR * | ppDataObject
 | ) |  |
STDMETHODIMP GetExtent | ( | DWORD | dwDrawAspect,
 |  | LPSIZEL | lpsizel
 | ) |  |
STDMETHODIMP GetMiscStatus | ( | DWORD | dwAspect,
 |  | DWORD FAR * | pdwStatus
 | ) |  |
STDMETHODIMP GetMoniker | ( | DWORD | dwAssign,
 |  | DWORD | dwWhichMoniker,
 |  | LPMONIKER FAR * | ppmk
 | ) |  |
STDMETHODIMP GetUserClassID ( CLSID FAR * pClsid )
STDMETHODIMP GetUserType | ( | DWORD | dwFormOfType,
 |  | LPOLESTR FAR * | pszUserType
 | ) |  |
STDMETHODIMP InitFromData | ( | LPDATAOBJECT | pDataObject,
 |  | BOOL | fCreation,
 |  | DWORD | dwReserved
 | ) |  |
STDMETHODIMP IsUpToDate ( )
void COleObject::OpenEdit ( LPOLECLIENTSITE pActiveSite )

Definition at line 1065 of file ioo.Cpp.

{
   if (m_lpObj->GetOleClientSite())
           m_lpObj->GetOleClientSite()->ShowObject();

        m_fOpen = TRUE;

        // tell the site we are opening so the object can be hatched out.
        if (m_lpObj->GetOleClientSite())
                m_lpObj->GetOleClientSite()->OnShowWindow(TRUE);

        m_lpObj->m_lpDoc->ShowDocWnd();

        m_lpObj->m_lpDoc->HideHatchWnd();

        // Show app window.
        m_lpObj->m_lpDoc->GetApp()->ShowAppWnd();

        SetFocus(m_lpObj->m_lpDoc->GethAppWnd());
}

STDMETHODIMP QueryInterface | ( | REFIID | riid,
 |  | LPVOID FAR * | ppvObj
 | ) |  |
STDMETHODIMP SetClientSite ( LPOLECLIENTSITE pClientSite )
STDMETHODIMP SetColorScheme ( LPLOGPALETTE lpLogpal )
STDMETHODIMP SetExtent | ( | DWORD | dwDrawAspect,
 |  | LPSIZEL | lpsizel
 | ) |  |
STDMETHODIMP SetHostNames | ( | LPCOLESTR | szContainerApp,
 |  | LPCOLESTR | szContainerObj
 | ) |  |
STDMETHODIMP SetMoniker | ( | DWORD | dwWhichMoniker,
 |  | LPMONIKER | pmk
 | ) |  |
STDMETHODIMP_ ( ULONG )

Definition at line 398 of file DataObj.Cpp.

{
  TCHAR szText[MAX_PATH];
  wsprintf(szText, TEXT("CEnumFormatEtc::Release - ref count will be %d\n"), m_ObjRefCount - 1);
  OutputDebugString(szText);

  if(0 == --m_ObjRefCount)
  {
    delete this;
    return 0;
  }

  return m_ObjRefCount;
}

STDMETHODIMP Unadvise ( DWORD dwConnection )
STDMETHODIMP Update ( )

Variable Documentation

BOOL m_fOpen

Definition at line 22 of file ioo.h.

int m_nCount

Definition at line 21 of file ioo.h.

Generated on Wed Nov 13 2024 16:53:17 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpSvr/ips.Cpp File Reference

  • Com
  • Fundamentals
  • SimpSvr
Functions

ips.Cpp File Reference

#include "pre.h"
#include "obj.h"
#include "ips.h"
#include "app.h"
#include "doc.h"

Go to the source code of this file.

Functions

DEFINE_GUID (GUID_SIMPLE, 0xBCF6D4A0, 0xBE8C, 0x1068, 0xB6, 0xD4, 0x00, 0xDD, 0x01, 0x0C, 0x05, 0x09)
STDMETHODIMP_ (ULONG) CPersistStorage

Function Documentation

DEFINE_GUID | ( | GUID_SIMPLE | ,
 |  | 0xBCF6D4A0 | ,
 |  | 0xBE8C | ,
 |  | 0x1068 | ,
 |  | 0xB6 | ,
 |  | 0xD4 | ,
 |  | 0x00 | ,
 |  | 0xDD | ,
 |  | 0x01 | ,
 |  | 0x0C | ,
 |  | 0x05 | ,
 |  | 0x09 |
 | ) |  |
STDMETHODIMP_ ( ULONG )

Definition at line 122 of file ips.Cpp.

{
  OutputDebugString("In CPersistStorage::Release\r\n");
  --m_nCount;
  return m_lpObj->Release();
};

Generated on Wed Nov 13 2024 16:53:17 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpSvr/ips.h File Reference

  • Com
  • Fundamentals
  • SimpSvr
Functions | Variables

ips.h File Reference

#include <ole2.h>
#include "obj.h"

Go to the source code of this file.

Functions

void | CreateStreams (LPSTORAGE lpStg)
void | CreateStreams (LPSTORAGE lpStg, LPSTREAM FAR *lpTempColor, LPSTREAM FAR *lpTempSize)
STDMETHODIMP | GetClassID (LPCLSID lpClassID)
STDMETHODIMP | HandsOffStorage ()
STDMETHODIMP | InitNew (LPSTORAGE pStg)
STDMETHODIMP | IsDirty ()
STDMETHODIMP | Load (LPSTORAGE pStg)
void | OpenStreams (LPSTORAGE lpStg)
STDMETHODIMP | QueryInterface (REFIID riid, LPVOID FAR *ppvObj)
void | ReleaseStreamsAndStorage ()
STDMETHODIMP | Save (LPSTORAGE pStgSave, BOOL fSameAsLoad)
STDMETHODIMP | SaveCompleted (LPSTORAGE pStgNew)
STDMETHODIMP_ (ULONG) AddRef()

Variables

BOOL m_fSameAsLoad
int | m_nCount

Function Documentation

void CreateStreams ( LPSTORAGE lpStg )
void CreateStreams | ( | LPSTORAGE | lpStg,
 |  | LPSTREAM FAR * | lpTempColor,
 |  | LPSTREAM FAR * | lpTempSize
 | ) |  |
STDMETHODIMP GetClassID ( LPCLSID lpClassID )
STDMETHODIMP HandsOffStorage ( )
STDMETHODIMP InitNew ( LPSTORAGE pStg )
STDMETHODIMP IsDirty ( )
STDMETHODIMP Load ( LPSTORAGE pStg )
void OpenStreams ( LPSTORAGE lpStg )
STDMETHODIMP QueryInterface | ( | REFIID | riid,
 |  | LPVOID FAR * | ppvObj
 | ) |  |
void ReleaseStreamsAndStorage ( )
STDMETHODIMP Save | ( | LPSTORAGE | pStgSave,
 |  | BOOL | fSameAsLoad
 | ) |  |
STDMETHODIMP SaveCompleted ( LPSTORAGE pStgNew )
STDMETHODIMP_ ( ULONG )

Definition at line 398 of file DataObj.Cpp.

{
  TCHAR szText[MAX_PATH];
  wsprintf(szText, TEXT("CEnumFormatEtc::Release - ref count will be %d\n"), m_ObjRefCount - 1);
  OutputDebugString(szText);

  if(0 == --m_ObjRefCount)
  {
    delete this;
    return 0;
  }

  return m_ObjRefCount;
}

Variable Documentation

BOOL m_fSameAsLoad

Definition at line 25 of file ips.h.

int m_nCount

Definition at line 24 of file ips.h.

Generated on Wed Nov 13 2024 16:53:17 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpSvr/Obj.Cpp File Reference

  • Com
  • Fundamentals
  • SimpSvr
Functions

Obj.Cpp File Reference

#include "pre.h"
#include "obj.h"
#include "ioo.h"
#include "ido.h"
#include "ips.h"
#include "icf.h"
#include "ioipao.h"
#include "ioipo.h"
#include "app.h"
#include "doc.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CSimpSvrObj

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 157 of file Obj.Cpp.

{
        OutputDebugString("In CSimpSvrObj::Release\r\n");

        // This object's destructor depends on m_lpDoc being valid
        // so ensure that our reference on the doc object
        // is held across possible destruction

        CSimpSvrDoc FAR * lpDoc = m_lpDoc;
        int nCount = --m_nCount;

        if (nCount == 0) {
                delete this;
        }

        lpDoc->Release();

        return nCount;
};

Generated on Wed Nov 13 2024 16:53:17 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpSvr/Obj.h File Reference

  • Com
  • Fundamentals
  • SimpSvr
Classes

Obj.h File Reference

#include "ioipao.h"
#include "ioipo.h"
#include "ioo.h"
#include "ips.h"
#include "ido.h"
#include "iec.h"

Go to the source code of this file.

Classes

class CSimpSvrObj
Generated on Wed Nov 13 2024 16:53:17 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpSvr/pre.h File Reference

  • Com
  • Fundamentals
  • SimpSvr

pre.h File Reference

#include <windows.h>
#include <ole2.h>
#include <olestd.h>
#include <assert.h>
#include <string.h>
#include "simpsvr.h"
#include "resource.h"
#include <ole2ver.h>
#include "resource.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpSvr/Resource.h File Reference

  • Com
  • Fundamentals
  • SimpSvr
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | ID_EDIT_INSERTOBJECT 111
#define | IDM_BLUE 115
#define | IDM_COPY 109
#define | IDM_CUT 108
#define | IDM_EXIT 106
#define | IDM_GREEN 114
#define | IDM_INSERTOBJECT 111
#define | IDM_NEW 112
#define | IDM_OPEN 102
#define | IDM_PASTE 110
#define | IDM_PRINT 105
#define | IDM_RED 113
#define | IDM_ROTATE 116
#define | IDM_SAVE 103
#define | IDM_SAVEAS 104
#define | IDM_UNDO 107

Define Documentation

#define ID_EDIT_INSERTOBJECT 111

Definition at line 14 of file Resource.h.

#define IDM_BLUE 115

Definition at line 19 of file Resource.h.

#define IDM_COPY 109

Definition at line 12 of file Resource.h.

#define IDM_CUT 108

Definition at line 11 of file Resource.h.

#define IDM_EXIT 106

Definition at line 9 of file Resource.h.

#define IDM_GREEN 114

Definition at line 18 of file Resource.h.

#define IDM_INSERTOBJECT 111

Definition at line 15 of file Resource.h.

#define IDM_NEW 112

Definition at line 16 of file Resource.h.

#define IDM_OPEN 102

Definition at line 5 of file Resource.h.

#define IDM_PASTE 110

Definition at line 13 of file Resource.h.

#define IDM_PRINT 105

Definition at line 8 of file Resource.h.

#define IDM_RED 113

Definition at line 17 of file Resource.h.

#define IDM_ROTATE 116

Definition at line 20 of file Resource.h.

#define IDM_SAVE 103

Definition at line 6 of file Resource.h.

#define IDM_SAVEAS 104

Definition at line 7 of file Resource.h.

#define IDM_UNDO 107

Definition at line 10 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpSvr/SimpSvr.Cpp File Reference

  • Com
  • Fundamentals
  • SimpSvr
Functions | Variables

SimpSvr.Cpp File Reference

#include "pre.h"
#include "obj.h"
#include "app.h"
#include "doc.h"
#include "icf.h"

Go to the source code of this file.

Functions

BOOL FAR PASCAL EXPORT | About (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
long FAR PASCAL EXPORT | DocWndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
long FAR PASCAL EXPORT | MainWndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
int PASCAL | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

Variables

CClassFactory FAR * | lpClassFactory
CSimpSvrApp FAR * | lpCSimpSvrApp

Function Documentation

BOOL FAR PASCAL EXPORT About | ( | HWND | hDlg,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 265 of file SimpSvr.Cpp.

{
        switch (message) {
        case WM_INITDIALOG:                /* message: initialize dialog box */
                return (TRUE);

        case WM_COMMAND:                      /* message: received a command */
                //@@WTK WIN32, UNICODE
                //if (wParam == IDOK                /* "OK" box selected?          */
                if (LOWORD(wParam) == IDOK                /* "OK" box selected?          */
                || LOWORD(wParam) == IDCANCEL) {      /* System menu close command? */
                        EndDialog(hDlg, TRUE);        /* Exits the dialog box        */
                        return (TRUE);
                }
                break;
        }
        return (FALSE);                           /* Didn't process a message    */
}

long FAR PASCAL EXPORT DocWndProc | ( | HWND | hWnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 323 of file SimpSvr.Cpp.

{
        HDC hDC;
        PAINTSTRUCT ps;

        switch (message) {
                case WM_COMMAND:           // message: command from application menu
                        return lpCSimpSvrApp->lCommandHandler(hWnd, message, wParam, lParam);
                        break;

                case WM_PAINT:
                        hDC = BeginPaint(hWnd, &ps);

                        // tell the app class to paint itself
                        if (lpCSimpSvrApp)
                                lpCSimpSvrApp->PaintApp (hDC);

                        EndPaint(hWnd, &ps);
                        break;

                case WM_MENUSELECT:
                        lpCSimpSvrApp->SetStatusText();
                        break;

        default:                          /* Passes it on if unproccessed    */
                return (DefWindowProc(hWnd, message, wParam, lParam));
        }
        return (NULL);
}

long FAR PASCAL EXPORT MainWndProc | ( | HWND | hWnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 177 of file SimpSvr.Cpp.

{

        switch (message)
                {
                case WM_CLOSE:
                        OutputDebugString("*** In WM_CLOSE *** \r\n");

                        // if there is still a document
                        if (lpCSimpSvrApp->GetDoc())

                                // if there is still an object within a document
                                if (lpCSimpSvrApp->GetDoc()->GetObj())   // this case occurs if there is still
                                                                                // an outstanding Ref count on the object
                                                                                // when the app is trying to go away.
                                                                                // typically this case will occur in
                                                                                // the "open" editing mode.
                                        //  Close the document
                                        lpCSimpSvrApp->GetDoc()->Close();

                        // hide the app window
                        lpCSimpSvrApp->HideAppWnd();

                        // if we were started by ole, unregister the class factory, otherwise
                        // remove the ref count on our dummy OLE object
                        if (lpCSimpSvrApp->IsStartedByOle())
                                CoRevokeClassObject(lpCSimpSvrApp->GetRegisterClass());
                        else
                                lpCSimpSvrApp->GetOleObject()->Release();

                        lpCSimpSvrApp->Release();  // This should close the app.

                        break;

                case WM_COMMAND:           // message: command from application menu
                        return lpCSimpSvrApp->lCommandHandler(hWnd, message, wParam, lParam);
                        break;

                case WM_CREATE:
                        return lpCSimpSvrApp->lCreateDoc(hWnd, message, wParam, lParam);
                        break;

                case WM_DESTROY:                  // message: window being destroyed
                        PostQuitMessage(0);
                        break;

                case WM_SIZE:
                        return lpCSimpSvrApp->lSizeHandler(hWnd, message, wParam, lParam);

                default:                          // Passes it on if unproccessed
                        return (DefWindowProc(hWnd, message, wParam, lParam));
                }
                return (NULL);
}

int PASCAL WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 68 of file SimpSvr.Cpp.

{
        MSG msg;

        // recommended size for OLE apps
        SetMessageQueue(96);

        lpCSimpSvrApp = new CSimpSvrApp;

        lpCSimpSvrApp->AddRef();      // need the app ref. count at 1 to hold the
                                                                  // app alive.

        lpCSimpSvrApp->ParseCmdLine(lpCmdLine);

        // app initialization
        if (!hPrevInstance)
                if (!lpCSimpSvrApp->fInitApplication(hInstance))
                        return (FALSE);

        // instance initialization
        if (!lpCSimpSvrApp->fInitInstance(hInstance, nCmdShow, lpClassFactory))
                return (FALSE);

        /* Initialization required for OLE 2 UI library.  This call is
        **    needed ONLY if we are using the static link version of the UI
        **    library. If we are using the DLL version, we should NOT call
        **    this function in our application.
        */
#if 0
        if (!OleUIInitialize(hInstance, hPrevInstance))
                {
                OleDbgOut("Could not initialize OLEUI library\n");
                return FALSE;
                }
#endif
        // message loop
        while (GetMessage(&msg, NULL, NULL, NULL))
                {
                if (lpCSimpSvrApp->IsInPlaceActive())

                        // Only key messages need to be sent to OleTranslateAccelerator.  Any other message
                        // would result in an extra FAR call to occur for that message processing...

                        if ( (msg.message >= WM_KEYFIRST) && (msg.message <= WM_KEYLAST) )

                                // OleTranslateAccelerator MUST be called, even though this application does
                                // not have an accelerator table.  This has to be done in order for the
                                // mneumonics for the top level menu items to work properly.

                                if ( OleTranslateAccelerator ( lpCSimpSvrApp->GetDoc()->GetObj()->GetInPlaceFrame(),
                                                                                lpCSimpSvrApp->GetDoc()->GetObj()->GetFrameInfo(),
                                                                                &msg) == NOERROR)
                                        continue;

                TranslateMessage(&msg);    /* Translates virtual key codes           */
                DispatchMessage(&msg);     /* Dispatches message to window           */
                }

        // De-initialization for UI libraries.  Just like OleUIInitialize, this
        // funciton is needed ONLY if we are using the static link version of the
        // OLE UI library.
#if 0
        OleUIUninitialize();
#endif

        return (msg.wParam);           /* Returns the value from PostQuitMessage */
}

Variable Documentation

CClassFactory FAR* lpClassFactory

Definition at line 28 of file SimpSvr.Cpp.

CSimpSvrApp FAR* lpCSimpSvrApp

Definition at line 27 of file SimpSvr.Cpp.

Generated on Wed Nov 13 2024 16:53:17 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/SimpSvr/SimpSvr.h File Reference

  • Com
  • Fundamentals
  • SimpSvr
Defines | Functions

SimpSvr.h File Reference

Go to the source code of this file.

Defines

#define | IDM_ABOUT 100
#define | IDM_INSERT 101
#define | IDM_VERB0 1000

Functions

BOOL FAR PASCAL EXPORT | About (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
long FAR PASCAL EXPORT | DocWndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
BOOL | InitApplication (HINSTANCE hInstance)
BOOL | InitInstance (HINSTANCE hInstance, int nCmdShow)
long FAR PASCAL EXPORT | MainWndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
int PASCAL | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

Define Documentation

#define IDM_ABOUT 100

Definition at line 6 of file SimpSvr.h.

#define IDM_INSERT 101

Definition at line 7 of file SimpSvr.h.

#define IDM_VERB0 1000

Definition at line 8 of file SimpSvr.h.

Function Documentation

BOOL FAR PASCAL EXPORT About | ( | HWND | hDlg,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 445 of file Generic.C.

{
   static  HFONT hfontDlg;    // Font for dialog text
   static   HFONT hFinePrint; // Font for 'fine print' in dialog
   DWORD   dwVerInfoSize;     // Size of version information block
   LPSTR   lpVersion;         // String pointer to 'version' text
   DWORD   dwVerHnd=0;        // An 'ignored' parameter, always '0'
   UINT    uVersionLen;
   WORD    wRootLen;
   BOOL    bRetCode;
   int     i;
   char    szFullPath[BUFFSIZE];
   char    szResult[BUFFSIZE];
   char    szGetName[BUFFSIZE];
   DWORD dwVersion;
   char  szVersion[40];
   DWORD dwResult;
   HRESULT hRes;

   switch (message) {
        case WM_INITDIALOG:
         ShowWindow (hDlg, SW_HIDE);

         if (PRIMARYLANGID(GetUserDefaultLangID()) == LANG_JAPANESE)
         {
            hfontDlg = CreateFont(14, 0, 0, 0, 0, 0, 0, 0, SHIFTJIS_CHARSET, 0, 0, 0,
                                  VARIABLE_PITCH | FF_DONTCARE, "");
            hFinePrint = CreateFont(11, 0, 0, 0, 0, 0, 0, 0, SHIFTJIS_CHARSET, 0, 0, 0,
                                    VARIABLE_PITCH | FF_DONTCARE, "");
         }
         else
         {
            hfontDlg = CreateFont(14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                  VARIABLE_PITCH | FF_SWISS, "");
            hFinePrint = CreateFont(11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                    VARIABLE_PITCH | FF_SWISS, "");
         }

         CenterWindow (hDlg, GetWindow (hDlg, GW_OWNER));
         GetModuleFileName (hInst, szFullPath, sizeof(szFullPath));

         // Now lets dive in and pull out the version information:
         dwVerInfoSize = GetFileVersionInfoSize(szFullPath, &dwVerHnd);
         if (dwVerInfoSize) {
            LPSTR   lpstrVffInfo;
            HANDLE  hMem;
            hMem = GlobalAlloc(GMEM_MOVEABLE, dwVerInfoSize);
            lpstrVffInfo  = GlobalLock(hMem);
            GetFileVersionInfo(szFullPath, dwVerHnd, dwVerInfoSize, lpstrVffInfo);
            // The below 'hex' value looks a little confusing, but
            // essentially what it is, is the hexidecimal representation
            // of a couple different values that represent the language
            // and character set that we are wanting string values for.
            // 040904E4 is a very common one, because it means:
            //   US English, Windows MultiLingual characterset
            // Or to pull it all apart:
            // 04------        = SUBLANG_ENGLISH_USA
            // --09----        = LANG_ENGLISH
            // --11----        = LANG_JAPANESE
            // ----04E4 = 1252 = Codepage for Windows:Multilingual

            // Use safe string handling
            szGetName[sizeof(szGetName) - 1] = '\0';
            lstrcpyn(szGetName, GetStringRes(IDS_VER_INFO_LANG), sizeof(szGetName) - 1);
            if (szGetName[sizeof(szGetName) - 1] != '\0') {
                return FALSE; // Buffer overflow error
            }

            wRootLen = (WORD) lstrlen(szGetName); // Save this position

            // Set the title of the dialog using safe string handling
            hRes = StringCchCatN(szGetName, sizeof(szGetName), "ProductName", sizeof("ProductName"));
            if (FAILED(hRes)) {
                return FALSE; // Buffer overflow error
            }

            bRetCode = VerQueryValue((LPVOID)lpstrVffInfo,
               (LPSTR)szGetName,
               (LPVOID)&lpVersion,
               (UINT *)&uVersionLen);

            // Notice order of version and string...
            if (PRIMARYLANGID(GetUserDefaultLangID()) == LANG_JAPANESE)
            {
                // Use safe string handling
                hRes = StringCchCopyN(szResult, sizeof(szResult), lpVersion, lstrlen(lpVersion));
                if (FAILED(hRes)) {
                    return FALSE; // Buffer overflow error
                }
                hRes = StringCchCatN(szResult, sizeof(szResult), " ‚Ìƒo[ƒWƒ‡ƒ“î•ñ", sizeof(" ‚Ìƒo[ƒWƒ‡ƒ“î•ñ"));
                if (FAILED(hRes)) {
                    return FALSE; // Buffer overflow error
                }
            }
            else
            {
                // Use safe string handling
                hRes = StringCchCopyN(szResult, sizeof(szResult), "About ", sizeof("About "));
                if (FAILED(hRes)) {
                    return FALSE; // Buffer overflow error
                }
                hRes = StringCchCatN(szResult, sizeof(szResult), lpVersion, lstrlen(lpVersion));
                if (FAILED(hRes)) {
                    return FALSE; // Buffer overflow error
                }
            }

            // -----------------------------------------------------

            SetWindowText (hDlg, szResult);

            // Walk through the dialog items that we want to replace:
            for (i = DLG_VERFIRST; i <= DLG_VERLAST; i++) {
               GetDlgItemText(hDlg, i, szResult, sizeof(szResult));
               szGetName[wRootLen] = (char)0;
               // Use safe sting handling
               hRes = StringCchCatN(szGetName, sizeof(szGetName), szResult, sizeof(szResult));
               if (FAILED(hRes)) {
                   return FALSE; // Buffer overflow error
               }
               uVersionLen   = 0;
               lpVersion     = NULL;
               bRetCode      =  VerQueryValue((LPVOID)lpstrVffInfo,
                  (LPSTR)szGetName,
                  (LPVOID)&lpVersion,
                  (UINT *)&uVersionLen);

               if ( bRetCode && uVersionLen && lpVersion) {
                   // Replace dialog item text with version info
                   // Use safe string handling
                   hRes = StringCchCopyN(szResult, sizeof(szResult), lpVersion, lstrlen(lpVersion));
                   if (FAILED(hRes)) {
                       return FALSE; // Buffer overflow error
                   }
                   SetDlgItemText(hDlg, i, szResult);
               }
               else
               {
                  dwResult = GetLastError();

                  // Use safe string handling
                  hRes = StringCchPrintf(szResult, sizeof(szResult), GetStringRes(IDS_VERSION_ERROR), dwResult);
                  if (FAILED(hRes)) {
                      return FALSE; // Buffer overflow error
                  }

                  SetDlgItemText (hDlg, i, szResult);
               }
               SendMessage (GetDlgItem (hDlg, i), WM_SETFONT,
                  (ULONG_PTR)((i==DLG_VERLAST)?hFinePrint:hfontDlg),
                  TRUE);
            } // for (i = DLG_VERFIRST; i <= DLG_VERLAST; i++)

            GlobalUnlock(hMem);
            GlobalFree(hMem);

         } else {
            // No version information available.
         } // if (dwVerInfoSize)

            SendMessage (GetDlgItem (hDlg, IDC_LABEL), WM_SETFONT,
            (WPARAM)hfontDlg,(LPARAM)TRUE);

         // We are  using GetVersion rather then GetVersionEx
         // because earlier versions of Windows NT and Win32s
         // didn't include GetVersionEx:
         dwVersion = GetVersion();

         if (dwVersion < 0x80000000) {
            // Windows NT
            // Use safe sting handling
            hRes = StringCchPrintf(szVersion, sizeof(szVersion), "Microsoft Windows NT %u.%u (Build: %u)",
                (DWORD)(LOBYTE(LOWORD(dwVersion))),
                (DWORD)(HIBYTE(LOWORD(dwVersion))),
                (DWORD)(HIWORD(dwVersion)) );
            if (FAILED(hRes)) {
                return FALSE; // Buffer overflow error
            }
         } else if (LOBYTE(LOWORD(dwVersion))<4) {
            // Win32s
            // Use safe sting handling
            hRes = StringCchPrintf(szVersion, sizeof(szVersion), "Microsoft Win32s %u.%u (Build: %u)",
                (DWORD)(LOBYTE(LOWORD(dwVersion))),
                (DWORD)(HIBYTE(LOWORD(dwVersion))),
                (DWORD)(HIWORD(dwVersion) & ~0x8000) );
            if (FAILED(hRes)) {
                return FALSE; // Buffer overflow error
            }
         } else {
            // Windows 95
            // Use safe sting handling
            hRes = StringCchPrintf(szVersion, sizeof(szVersion), "Microsoft Windows 95 %u.%u",
                (DWORD)(LOBYTE(LOWORD(dwVersion))),
                (DWORD)(HIBYTE(LOWORD(dwVersion))) );
            if (FAILED(hRes)) {
                return FALSE; // Buffer overflow error
            }
         }

          SetWindowText (GetDlgItem(hDlg, IDC_OSVERSION), szVersion);
         ShowWindow (hDlg, SW_SHOW);
         return (TRUE);

      case WM_COMMAND:
         if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) {
            EndDialog(hDlg, TRUE);
            DeleteObject (hfontDlg);
            DeleteObject (hFinePrint);
            return (TRUE);
         }
         break;
   }

    return FALSE;
}

long FAR PASCAL EXPORT DocWndProc | ( | HWND | hWnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 311 of file SimpCntr.Cpp.

{
        HDC hDC;
        PAINTSTRUCT ps;

        switch (message) {
                case WM_PAINT:

                        hDC = BeginPaint(hWnd, &ps);

                        if (lpCSimpleApp)
                                lpCSimpleApp->PaintApp (hDC);

                        EndPaint(hWnd, &ps);
                        break;

                case WM_LBUTTONDBLCLK:
                        {
                        POINT pt;

                        pt.x = (int)(short)LOWORD (lParam );
                        pt.y = (int)(short)HIWORD (lParam );

                        if (lpCSimpleApp->m_lpDoc->m_lpSite &&
                                lpCSimpleApp->m_lpDoc->m_lpSite->m_lpOleObject)
                                {
                                RECT rect;

                                lpCSimpleApp->m_lpDoc->m_lpSite->GetObjRect(&rect);

                                if ( PtInRect(&rect, pt) )
                                        {
                                        // Execute object's default verb
                                        lpCSimpleApp->m_lpDoc->m_lpSite->m_lpOleObject->DoVerb(
                                                        OLEIVERB_PRIMARY, (LPMSG)&message,
                                                        &lpCSimpleApp->m_lpDoc->m_lpSite->m_OleClientSite,
                                                        -1, hWnd, &rect);
                                        }
                                }
                        }
                        break;

        // no code is added to WM_LBUTTONDOWN for context sensitive help, because
        // this app does not do context sensitive help.
        case WM_LBUTTONDOWN:

                LPOLEINPLACEOBJECT lpObject;

                if (lpCSimpleApp->m_lpDoc->m_fInPlaceActive)
                        {
                        lpCSimpleApp->m_lpDoc->m_lpSite->m_lpOleObject->QueryInterface(IID_IOleInPlaceObject, (LPVOID FAR *)&lpObject);
                        lpObject->UIDeactivate();

                        // this code is needed because we don't support inside out.
                        RECT rect;
                        lpCSimpleApp->m_lpDoc->m_lpSite->GetObjRect(&rect);
                        lpCSimpleApp->m_lpDoc->m_lpSite->m_lpOleObject->DoVerb(OLEIVERB_HIDE, (LPMSG)&message, &lpCSimpleApp->m_lpDoc->m_lpSite->m_OleClientSite, -1, hWnd, &rect);

                        lpObject->Release();
                        }

                break;

                default:                          /* Passes it on if unproccessed */
                        return (DefWindowProc(hWnd, message, wParam, lParam));
        }
        return (NULL);
}

BOOL InitApplication ( HINSTANCE hInstance )

Definition at line 186 of file Generic.C.

{
    WNDCLASS  wc;
    HWND      hwnd;

    // Win32 will always set hPrevInstance to NULL, so lets check
    // things a little closer. This is because we only want a single
    // version of this app to run at a time
    hwnd = FindWindow (szAppName, szTitle);
    if (hwnd)
    {
        // We found another version of ourself. Lets defer to it:
        if (IsIconic(hwnd))
        {
            ShowWindow(hwnd, SW_RESTORE);
        }
        SetForegroundWindow (hwnd);

        // If this app actually had any functionality, we would
        // also want to communicate any action that our 'twin'
        // should now perform based on how the user tried to
        // execute us.
        return FALSE;
    }

    // Fill in window class structure with parameters that describe
    // the main window.
    wc.style         = CS_HREDRAW | CS_VREDRAW;
    wc.lpfnWndProc   = (WNDPROC)WndProc;
    wc.cbClsExtra    = 0;
    wc.cbWndExtra    = 0;
    wc.hInstance     = hInstance;
    wc.hIcon         = LoadIcon (hInstance, szAppName);
    wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);

    // Since Windows95 has a slightly different recommended
    // format for the 'Help' menu, lets put this in the alternate menu like this:
    if (IS_WIN95)
    {
        wc.lpszMenuName  = "WIN95";
    }
    else
    {
        wc.lpszMenuName  = szAppName;
    }
    wc.lpszClassName = szAppName;

    // Register the window class and return success/failure code.
    if (IS_WIN95)
    {
        return MyRegisterClass(&wc);
    }
    else
    {
        return RegisterClass(&wc);
    }
}

BOOL InitInstance | ( | HINSTANCE | hInstance,
 |  | int | nCmdShow
 | ) |  |

Definition at line 255 of file Generic.C.

{
   HWND hWnd;

   hInst = hInstance; // Store instance handle in our global variable

   hWnd = CreateWindow(szAppName, szTitle, WS_OVERLAPPEDWINDOW,
      CW_USEDEFAULT, 0, CW_USEDEFAULT, 0,
      NULL, NULL, hInstance, NULL);

   if (!hWnd) {
      return (FALSE);
   }

   ShowWindow(hWnd, nCmdShow);
   UpdateWindow(hWnd);

   return (TRUE);
}

long FAR PASCAL EXPORT MainWndProc | ( | HWND | hWnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 3333 of file sdkdiff.cpp.

{
    char str[32];
    long ret;
    DWORD threadid;
  HRESULT hr;

    switch (message) {

        case WM_CREATE:

            /* initialise menu options to default/saved
             * option settings
             */

#define CHECKMENU(id, fChecked)  \
          CheckMenuItem(hMenu, (id), (fChecked) ? MF_CHECKED:MF_UNCHECKED)

            /* outline_include options */
            CHECKMENU(IDM_OUTLINE_INCSAME,   (outline_include & INCLUDE_SAME));
            CHECKMENU(IDM_OUTLINE_INCLEFT,   (outline_include & INCLUDE_LEFTONLY));
            CHECKMENU(IDM_OUTLINE_INCRIGHT,  (outline_include & INCLUDE_RIGHTONLY));
            CHECKMENU(IDM_OUTLINE_INCDIFFER, (outline_include & INCLUDE_DIFFER));

            /* expand_include options */
            CHECKMENU(IDM_EXPAND_INCSAME,         (expand_include & INCLUDE_SAME));
            CHECKMENU(IDM_EXPAND_INCLEFT,         (expand_include & INCLUDE_LEFTONLY));
            CHECKMENU(IDM_EXPAND_INCRIGHT,        (expand_include & INCLUDE_RIGHTONLY));
            CHECKMENU(IDM_EXPAND_INCMOVEDLEFT,    (expand_include & INCLUDE_MOVEDLEFT));
            CHECKMENU(IDM_EXPAND_INCMOVEDRIGHT,   (expand_include & INCLUDE_MOVEDRIGHT));
            CHECKMENU(IDM_EXPAND_INCSIMILARLEFT,  (expand_include & INCLUDE_SIMILARLEFT));
            CHECKMENU(IDM_EXPAND_INCSIMILARRIGHT, (expand_include & INCLUDE_SIMILARRIGHT));

            /* other options */
            CHECKMENU(line_numbers, TRUE);
            CHECKMENU(expand_mode, TRUE);
            CHECKMENU(IDM_IGNBLANKS, ignore_blanks);
            CHECKMENU(IDM_SHOWWHITESPACE, show_whitespace);
            CHECKMENU(IDM_ALG2, Algorithm2);
            CHECKMENU(IDM_MONOCOLS, mono_colours);
            CHECKMENU(IDM_PICTURE, picture_mode);
            CHECKMENU(IDM_HIDEMARK, hide_markedfiles);
#undef CHECKMENU

            /* nothing currently displayed */
            DisplayMode = MODE_NULL;

            break;

        case WM_SYSCOLORCHANGE:
            {
                HIGHCONTRAST hc;

                hc.cbSize = sizeof(hc);
                SystemParametersInfo(SPI_GETHIGHCONTRAST,0 ,&hc, 0);

                mono_colours = (hc.dwFlags & HCF_HIGHCONTRASTON);
                if (mono_colours) {
                    SetMonoColours();
                } else {
                    SetColours();
                }

                CheckMenuItem(hMenu, IDM_MONOCOLS,
                              mono_colours? MF_CHECKED:MF_UNCHECKED);
                hr = StringCchPrintf(str, 32, szD, mono_colours);
        if (FAILED(hr))
          OutputError(hr, IDS_SAFE_PRINTF);
                WriteProfileString(APPNAME, szMonoColours, str);
                SendMessage(hwndRCD, message, wParam, lParam);
                SendMessage(hwndStatus, message, wParam, lParam);
                SendMessage(hwndBar, message, wParam, lParam);

                /* The diffs are still valid, but force a re-display
                 * of bar window and main table.
                 */
                SendMessage(hwndBar, WM_COMMAND, IDM_MONOCOLS, 0);
                InvalidateRect(hwndBar, NULL, TRUE);
                view_changeviewoptions(current_view);
            }
            break;

        case WM_COMMAND:
            switch (GET_WM_COMMAND_ID(wParam, lParam)) {
                case IDM_EXIT:
                    if (ghThread!=NULL) {
                        bAbort = TRUE;
                        SetStatus(LoadRcString(IDS_ABORT_PENDING));
                        break;
                    }
                    if (!view_isexpanded(current_view)) {
                        /* save the current outline size and position */
                        WINDOWPLACEMENT wp;
                        wp.length = sizeof(wp);
                        if (GetWindowPlacement(hwndClient,&wp)) {
                            WriteProfileInt(APPNAME, szOutlineShowCmd, wp.showCmd);
                            WriteProfileInt(APPNAME, szOutlineMaxX, wp.ptMaxPosition.x);
                            WriteProfileInt(APPNAME, szOutlineMaxY, wp.ptMaxPosition.y);
                            WriteProfileInt(APPNAME, szOutlineNormLeft, wp.rcNormalPosition.left);
                            WriteProfileInt(APPNAME, szOutlineNormTop, wp.rcNormalPosition.top);
                            WriteProfileInt(APPNAME, szOutlineNormRight, wp.rcNormalPosition.right);
                            WriteProfileInt(APPNAME, szOutlineNormBottom, wp.rcNormalPosition.bottom);
                            WriteProfileInt(APPNAME, szOutlineSaved, 1);
                        }
                    } else {
                        /* save the current expanded size and position */
                        WINDOWPLACEMENT wp;
                        wp.length = sizeof(wp);
                        if (GetWindowPlacement(hwndClient,&wp)) {
                            WriteProfileInt(APPNAME, szExpandShowCmd, wp.showCmd);
                            WriteProfileInt(APPNAME, szExpandMaxX, wp.ptMaxPosition.x);
                            WriteProfileInt(APPNAME, szExpandMaxY, wp.ptMaxPosition.y);
                            WriteProfileInt(APPNAME, szExpandNormLeft, wp.rcNormalPosition.left);
                            WriteProfileInt(APPNAME, szExpandNormTop, wp.rcNormalPosition.top);
                            WriteProfileInt(APPNAME, szExpandNormRight, wp.rcNormalPosition.right);
                            WriteProfileInt(APPNAME, szExpandNormBottom, wp.rcNormalPosition.bottom);
                            WriteProfileInt(APPNAME, szExpandedSaved, 1);
                        }
                    }
                    DestroyWindow(hWnd);
                    break;

                case IDM_ABORT:
                    /* abort menu item, or status bar button.
                     * the status bar button text gives the appropriate
                     * action depending on our state - abort, outline
                     * or expand. But the command sent is always
                     * IDM_ABORT. Thus we need to check the state
                     * to see what to do. If we are busy, set the abort
                     * flag. If there is nothing to view,
                     * exit, otherwise switch outline<->expand
                     */
                    if (IsBusy()) {
                        bAbort = TRUE;
                        SetStatus(LoadRcString(IDS_ABORT_PENDING));
                    } else if (DisplayMode == MODE_NULL) {
                        DestroyWindow(hWnd);
                    } else if (DisplayMode == MODE_EXPAND) {
                        ToOutline(hWnd);
                    } else {
                        ToExpand(hWnd);
                    }
                    break;

                case IDM_FILE:
                    /* select two files and compare them */
                    if (SetBusy()) {

                        /* close the current view */
                        view_close(current_view);

                        /* make a new empty view */
                        current_view = view_new(hwndRCD);

                        /* make a COMPLIST using the files dialog,
                         * and notify the view
                         */
                        if (complist_filedialog(current_view) == NULL) {
                            view_close(current_view);
                        }

                        /* all done! */
                        SetNotBusy();
                    } else {
                        BusyError();
                    }
                    break;

                case IDM_DIR:

                    /* read two directory names, scan them and
                     * compare all the files and subdirs.
                     */
                    if (SetBusy()) {

                        /* close the current view */
                        view_close(current_view);

                        /* make a new empty view */
                        current_view = view_new(hwndRCD);

                        ghThread = CreateThread(NULL, 0, wd_dirdialog,
                                                (LPVOID) current_view, 0, &threadid);

                        if (ghThread == NULL)
                        {

                            /*
                             * either we are on WIN16, or the
                             * thread call failed. continue
                             * single-threaded.
                             */
                            wd_dirdialog( (LPVOID) current_view);

                        }

                    } else {
                        BusyError();
                    }
                    break;

                case IDM_CLOSE:
                    /* close the output list -
                     * discard all results so far
                     */
                    if (!IsBusy()) {
                        view_close(current_view);
                    }
                    break;

                case IDM_PRINT:
                    /* print the current view -
                     * either the outline list of filenames,
                     * or the currently expanded file.
                     */
                    if (!IsBusy()) {
                        DoPrint();
                    } else {
                        BusyError();
                    }
                    break;

                case IDM_TIME:
                    /* show time it took */
                    {       char msg[50];
                        DWORD tim;
                        if (IsBusy()) {
                            BusyError();
                        } else {
                            tim = complist_querytime();
                            hr = StringCchPrintf(msg, 50, LoadRcString(IDS_SECONDS), tim/1000, tim%1000);
              if (FAILED(hr))
                OutputError(hr, IDS_SAFE_PRINTF);
                            Trace_Status(msg);
                        }
                    }
                    break;

                case IDM_TRACE:
                    /* enable tracing */
                    bTrace = TRUE;
                    Trace_Status(LoadRcString(IDS_TRACING_ENABLED));
                    break;

                case IDM_TRACEOFF:
                    /* enable tracing */
                    bTrace = FALSE;
                    Trace_Status(LoadRcString(IDS_TRACING_DISABLED));
                    break;

                case IDM_SAVELIST:
                    /* allow user to save list of same/different files
                     * to a text file. dialog box to give filename
                     * and select which types of file to include
                     */
                    if (current_view == NULL) {
                        MessageBox(hWnd,
                                   LoadRcString(IDS_CREATE_DIFF_LIST),
                                   szSdkDiff, MB_OK|MB_ICONSTOP);
                        break;
                    }

                    complist_savelist(view_getcomplist(current_view), NULL, outline_include);
                    break;

                case IDM_COPYFILES:
                    /*
                     * copy files that are same/different to a new
                     * root directory. dialog box allows user
                     * to select new root and inclusion options
                     */
                    if (current_view == NULL) {
                        MessageBox(hWnd,
                                   LoadRcString(IDS_CREATE_DIFF_LIST),
                                   szSdkDiff, MB_OK|MB_ICONSTOP);
                        break;
                    }

                    if (SetBusy()) {
                        ghThread = CreateThread(NULL, 0, wd_copy,
                                                (LPVOID) current_view, 0, &threadid);
                        if (ghThread == NULL)
                        {
                            wd_copy( (LPVOID) current_view);
                        }

                    } else {
                        BusyError();
                    }

                    break;

                case IDM_ABOUT:
                    ShellAbout( hWnd,
                                (LPTSTR)szSdkDiff,
                                LoadRcString(IDS_TOOL_DESCRIPTION),
                                LoadIcon(hInst, szSdkDiff)
                              );
                    break;

                case IDM_CONTENTS:
                    /* Help contents */
          TCHAR pszHelp[MAX_PATH];
          memset(pszHelp, 0, MAX_PATH);
          hr = StringCchCopy(pszHelp, MAX_PATH, pszWorkingDirectoryName);
          if (FAILED(hr))
            OutputError(hr, IDS_SAFE_COPY);
          hr = StringCchCat(pszHelp, MAX_PATH, "sdkdiff.hlp");
          if (FAILED(hr))
            OutputError(hr, IDS_SAFE_CAT);
          WinHelp(hWnd, pszHelp, HELP_INDEX, 0);
                    break;

                    /* launch an editor on the current item - left, right or
                     * composite view
                     */
                case IDM_EDITLEFT:
                    do_editthread(current_view, CI_LEFT);
                    break;

                case IDM_EDITRIGHT:
                    do_editthread(current_view, CI_RIGHT);
                    break;

                case IDM_EDITCOMP:
                    {
                        COMPITEM item = view_getitem(current_view, selection);
                        FILEDATA fdLeft;
                        FILEDATA fdRight;

                        fdLeft = compitem_getleftfile(item);
                        fdRight = compitem_getrightfile(item);
                        if ((fdLeft && file_IsUnicode(fdLeft)) || (fdRight && file_IsUnicode(fdRight))) {
                            MessageBox(hWnd, LoadRcString(IDS_NOCOMPUNICODE),
                                       szSdkDiff, MB_OK);
                        } else {
                            do_editthread(current_view, CI_COMP);
                        }
                    }
                    break;

                    /* allow customisation of the editor command line */
                case IDM_SETEDIT:
                    if (StringInput(editor_cmdline, sizeof(editor_cmdline),
                                    LoadRcString(IDS_EDITOR_COMMAND),
                                    (LPSTR)szSdkDiff, editor_cmdline)) {
                        WriteProfileString(APPNAME, szEditor,
                                           editor_cmdline);
                    }
                    break;

                case IDM_SETTABWIDTH:
                    {
                        char sz[32];
                        int n;

LTabWidth_tryagain:
                        hr = StringCchPrintf(sz, 32, "%d", g_tabwidth);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        if (StringInput(sz, sizeof(sz),
                                        LoadRcString(IDS_TABWIDTH),
                                        (LPSTR)szSdkDiff, sz))
                        {
                            n = atoi(sz);
                            if (n <= 0 || n > 100)
                            {
                                MessageBox(hWnd,
                                           LoadRcString(IDS_BAD_TABWIDTH),
                                           szSdkDiff, MB_OK);
                                goto LTabWidth_tryagain;
                            }
                            WriteProfileInt(APPNAME, szTabWidth, n);
                            g_tabwidth = n;
                            SendMessage(hwndRCD, TM_SETTABWIDTH, 0, n);
                        }
                    }
                    break;

                case IDM_TABWIDTH4:
                case IDM_TABWIDTH8:
                    g_tabwidth = (GET_WM_COMMAND_ID(wParam, lParam) == IDM_TABWIDTH8) ? 8 : 4;
                    SendMessage(hwndRCD, TM_SETTABWIDTH, 0, g_tabwidth);
                    break;

                case IDM_SETFONT:
                    {
                        CHOOSEFONT cf;
                        LOGFONT lf;
                        char szFace[LF_FACESIZE];

                        hr = StringCchCopy(szFace, LF_FACESIZE, g_szFontFaceName);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_COPY);

                        memset(&lf, 0, sizeof(lf));
                        hr = StringCchCopy(lf.lfFaceName, LF_FACESIZE, szFace);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_COPY);
                        lf.lfWeight = g_fFontBold ? FW_BOLD : FW_DONTCARE;
                        lf.lfHeight = g_nFontHeight;
                        lf.lfCharSet = g_bFontCharSet;

                        memset(&cf, 0, sizeof(cf));
                        cf.lStructSize = sizeof(CHOOSEFONT);
                        cf.hwndOwner = hWnd;
                        cf.lpLogFont = &lf;
                        cf.Flags = CF_INITTOLOGFONTSTRUCT|CF_FORCEFONTEXIST|
                                CF_SCREENFONTS|CF_LIMITSIZE;
                        cf.nSizeMin = 8;
                        cf.nSizeMax = 36;
                        cf.lpszStyle = szFace;
                        if (ChooseFont(&cf))
                            {
                            hr = StringCchCopy(g_szFontFaceName, LF_FACESIZE, lf.lfFaceName);
              if (FAILED(hr))
                OutputError(hr, IDS_SAFE_COPY);
                            g_fFontBold = (lf.lfWeight == FW_BOLD);
                            g_nFontHeight = lf.lfHeight;
                            g_bFontCharSet = lf.lfCharSet;

                            WriteProfileString(APPNAME, szFontFaceName, g_szFontFaceName);
                            WriteProfileInt(APPNAME, szFontHeight, g_nFontHeight);
                            WriteProfileInt(APPNAME, szFontBold, g_fFontBold);
                            WriteProfileInt(APPNAME, szFontCharSet, g_bFontCharSet);

                            GetFontPref();

                            view_changeviewoptions(current_view);
                            }
                    }
                    break;

                case IDM_LNRS:
                case IDM_RNRS:
                case IDM_NONRS:

                    /* option selects whether the line nrs displayed
                     * in expand mode are the line nrs in the left
                     * file, the right file or none
                     */

                    CheckMenuItem(GetMenu(hWnd),
                                  line_numbers, MF_UNCHECKED);
                    line_numbers = GET_WM_COMMAND_ID(wParam, lParam);
                    CheckMenuItem(GetMenu(hWnd), line_numbers, MF_CHECKED);
                    hr = StringCchPrintf(str, 32, szD, line_numbers);
          if (FAILED(hr))
            OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szLineNumbers, str);

                    /* change the display to show the line nr style
                     * chosen
                     */

                    view_changeviewoptions(current_view);
                    break;

                /*
                 * options selecting which lines to include in the
                 * expand listing, based on their state
                 */
                case IDM_EXPAND_INCSAME:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_SAME;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCSAME,
                              (expand_include & INCLUDE_SAME) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCLEFT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_LEFTONLY;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCLEFT,
                              (expand_include & INCLUDE_LEFTONLY) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCRIGHT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_RIGHTONLY;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCRIGHT,
                              (expand_include & INCLUDE_RIGHTONLY) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCMOVEDLEFT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_MOVEDLEFT;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCMOVEDLEFT,
                              (expand_include & INCLUDE_MOVEDLEFT) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCMOVEDRIGHT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_MOVEDRIGHT;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCMOVEDRIGHT,
                              (expand_include & INCLUDE_MOVEDRIGHT) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCSIMILARLEFT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_SIMILARLEFT;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCSIMILARLEFT,
                              (expand_include & INCLUDE_SIMILARLEFT) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCSIMILARRIGHT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_SIMILARRIGHT;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCSIMILARRIGHT,
                              (expand_include & INCLUDE_SIMILARRIGHT) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                    /*
                     * options selecting which files to include in the
                     * outline listing, based on their state
                     */
                case IDM_OUTLINE_INCLEFT:

                    /* toggle flag in outline_include options */
                    outline_include ^= INCLUDE_LEFTONLY;

                    /* check/uncheck as necessary */
                    CheckMenuItem(hMenu, IDM_OUTLINE_INCLEFT,
                                  (outline_include & INCLUDE_LEFTONLY) ?
                                  MF_CHECKED:MF_UNCHECKED);

                    hr = StringCchPrintf(str, 32, szD, outline_include);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szFileInclude, str);
                    view_changeviewoptions(current_view);

                    break;

                case IDM_OUTLINE_INCRIGHT:

                    outline_include ^= INCLUDE_RIGHTONLY;

                    CheckMenuItem(hMenu, IDM_OUTLINE_INCRIGHT,
                                  (outline_include & INCLUDE_RIGHTONLY) ?
                                  MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, outline_include);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szFileInclude, str);
                    view_changeviewoptions(current_view);

                    break;

                case IDM_OUTLINE_INCSAME:

                    outline_include ^= INCLUDE_SAME;

                    CheckMenuItem(hMenu, IDM_OUTLINE_INCSAME,
                                  (outline_include & INCLUDE_SAME) ?
                                  MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, outline_include);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szFileInclude, str);
                    view_changeviewoptions(current_view);

                    break;

                case IDM_OUTLINE_INCDIFFER:

                    outline_include ^= INCLUDE_DIFFER;

                    CheckMenuItem(hMenu, IDM_OUTLINE_INCDIFFER,
                                  (outline_include & INCLUDE_DIFFER) ?
                                  MF_CHECKED:MF_UNCHECKED);

                    hr = StringCchPrintf(str, 32, szD, outline_include);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szFileInclude, str);
                    view_changeviewoptions(current_view);

                    break;

                case IDM_UPDATE:
                    OnUpdate( (COMPITEM) lParam);
                    break;

                case IDM_RESCAN:
                    RescanFile(hWnd);

                    /* do we need to force any repaints? */
                    // - no, as RescanFile sends a IDM_UPDATE
                    break;

                case IDM_LONLY:
                case IDM_RONLY:
                case IDM_BOTHFILES:
                    /* option selects whether the expanded file
                     * show is the combined file, or just one
                     * or other of the input files.
                     *
                     * if we are not in expand mode, this also
                     * causes us to expand the selection
                     */

                    CheckMenuItem(GetMenu(hWnd), expand_mode, MF_UNCHECKED);
                    expand_mode = GET_WM_COMMAND_ID(wParam, lParam);
                    CheckMenuItem(GetMenu(hWnd), expand_mode, MF_CHECKED);

                    /* change the current view to show only the lines
                     * of the selected type.
                     */
                    if (DisplayMode == MODE_OUTLINE) {
                        ToExpand(hWnd);
                    } else {
                        view_changeviewoptions(current_view);
                    }

                    break;

                case IDM_IGNBLANKS:

                    /* if selected, ignore all spaces and tabs on
                     * comparison - expand view only: outline view
                     * will still show that 'text files differ'
                     */

                    ignore_blanks = !ignore_blanks;
                    CheckMenuItem(hMenu, IDM_IGNBLANKS,
                                  ignore_blanks? MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, ignore_blanks);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szBlanks, str);

                    /* invalidate all diffs since we have
                     * changed diff options, and re-do and display the
                     * current diff if we are in expand mode.
                     */
                    view_changediffoptions(current_view);

                    /* force repaint of bar window */
                    InvalidateRect(hwndBar, NULL, TRUE);

                    break;

                case IDM_SHOWWHITESPACE:

                        /* if selected, display all spaces and tabs in
                           the expanded text view */
                        show_whitespace = !show_whitespace;
                        CheckMenuItem(hMenu, IDM_SHOWWHITESPACE,
                                show_whitespace ? MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, show_whitespace);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szShowWhitespace, str);

                        // change the current view to show only the lines
                        // of the selected type.
                        if (DisplayMode == MODE_EXPAND) {
                                view_changeviewoptions(current_view);
                        }

                        break;

                case IDM_ALG2:

                    /* if selected, do algorithm2 which does not accept
                     * unsafe matches.
                     */

                    Algorithm2 = !Algorithm2;
                    CheckMenuItem(hMenu, IDM_ALG2,
                                  Algorithm2? MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, Algorithm2);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szAlgorithm2, str);

                    /* invalidate all diffs since we have
                     * changed diff options, and re-do and display the
                     * current diff if we are in expand mode.
                     */
                    view_changediffoptions(current_view);

                    /* force repaint of bar window */
                    InvalidateRect(hwndBar, NULL, TRUE);

                    break;

                case IDM_MONOCOLS:

                    /* Use monochrome colours - toggle */

                    mono_colours = !mono_colours;
                    CheckMenuItem(hMenu, IDM_MONOCOLS,
                                  mono_colours? MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, mono_colours);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szMonoColours, str);
                    if (mono_colours)
                        SetMonoColours();
                    else
                        SetColours();

                    /* The diffs are still valid, but force a re-display
                     * of bar window and main table.
                     */
                    SendMessage(hwndBar, WM_COMMAND, IDM_MONOCOLS, 0);
                    InvalidateRect(hwndBar, NULL, TRUE);
                    view_changeviewoptions(current_view);

                    break;

                case IDM_PICTURE:
                    picture_mode = !picture_mode;
                    CheckMenuItem(hMenu, IDM_PICTURE,
                                  picture_mode? MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, picture_mode);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szPicture, str);
                    DoResize(hWnd);
                    break;

                case IDM_HIDEMARK:
                    // toggle state of marked files hidden or not
                    hide_markedfiles = !hide_markedfiles;
                    CheckMenuItem(hMenu, IDM_HIDEMARK,
                                  hide_markedfiles? MF_CHECKED : MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, hide_markedfiles);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szHideMark, str);

                    // rebuild view with new global option
                    // - note that marks only affect outline views
                    if (!view_isexpanded(current_view)) {
                        view_changeviewoptions(current_view);
                    }
                    break;

                case IDM_FIND:
                  {
                  int nRet = IDCANCEL;
                  DLGPROC lpProc = (DLGPROC) MakeProcInstance((WINPROCTYPE) FindDlgProc, hInst);
                  if (lpProc)
                    {
                    char *pszFind = NULL;
                    sdkdiff_UI(TRUE);
                    nRet = (BOOL) DialogBoxParam(hInst, (LPCTSTR) IDD_FIND, hwndClient, lpProc, 0L);
                    sdkdiff_UI(FALSE);
                    FreeProcInstance(lpProc);
                    }
                  }
                  break;

                case IDM_FINDNEXT:
                  {
                  const LONG iCol = (view_isexpanded(current_view)) ? 2 : 1;
                  FindString(hWnd, iCol, NULL, 1, 0);
                  break;
                  }

                case IDM_FINDPREV:
                  {
                  const LONG iCol = (view_isexpanded(current_view)) ? 2 : 1;
                  FindString(hWnd, iCol, NULL, -1, 0);
                  break;
                  }

                case IDM_GOTOLINE:
                  {
                  if (!view_getrowcount(current_view))
                    {
                    MessageBox(hWnd, LoadRcString(IDS_GOTOLINE_NOLINES), szSdkDiff, MB_OK|MB_ICONSTOP|MB_TASKMODAL);
                    }
                  else
                    {
                    DLGPROC lpProc = (DLGPROC) MakeProcInstance((WINPROCTYPE)GoToLineDlgProc, hInst);
                    if (lpProc)
                      {
                      sdkdiff_UI(TRUE);
                      DialogBoxParam(hInst, (LPCTSTR) IDD_GOTOLINE, hwndClient, lpProc, 0L);
                      sdkdiff_UI(FALSE);
                      FreeProcInstance(lpProc);
                      }
                    }
                  }
                  break;

                case IDM_EDITCOPY:
                    {
                        unsigned long cb = 0;
                        LPCSTR pszText = NULL;
                        long iRow = 0;
                        const BOOL fOutline = !view_isexpanded(current_view);

                        /* first count total data size */
                        for (iRow = 0; iRow < selection_nrows; iRow++) {
                            if (fOutline) {
                                pszText = view_gettext(current_view, selection + iRow, 1);
                                if (!pszText)
                                    break;
                                cb += (lstrlen(pszText) + 3) * sizeof(char);
                            }

                            pszText = view_gettext(current_view, selection + iRow, 2);
                            if (!pszText)
                                break;
                            cb += (lstrlen(pszText)) * sizeof(char);
                        }

                        if (cb && OpenClipboard(NULL)) {
                            /* space for trailing nul char */
                            cb++;

                            /* copy data to clipboard */
                            if (EmptyClipboard()) {
                                HGLOBAL hData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,  cb);

                                if (hData) {
                                    void *pv = hData;
                                    if (!pv) {
                                        HeapFree(GetProcessHeap(), NULL, hData);
                                    }
                                    else {
                                        LPSTR pszBuf = (LPSTR) pv;
                                        memset(pv, 0, cb);

                                        for (iRow = 0; iRow < selection_nrows; iRow++) {
                                            if (fOutline) {
                                                pszText = view_gettext(current_view, selection + iRow, 1);
                                                if (!pszText)
                                                    break;

                                                hr = StringCchCopy(pszBuf, cb, pszText);
                        if (FAILED(hr))
                          OutputError(hr, IDS_SAFE_COPY);
                                                pszBuf += lstrlen(pszBuf);
                                                *(pszBuf++) = '\t';
                                                *pszBuf = 0;
                                            }

                                            pszText = view_gettext(current_view, selection + iRow, 2);
                                            if (!pszText)
                                                break;

                                            hr = StringCchCopy(pszBuf, cb, pszText);
                      if (FAILED(hr))
                        OutputError(hr, IDS_SAFE_COPY);
                                            pszBuf += lstrlen(pszBuf);

                                            if (fOutline) {
                                                *(pszBuf++) = '\r';
                                                *(pszBuf++) = '\n';
                                                *pszBuf = 0;
                                            }
                                        }

                                        SetClipboardData(CF_TEXT, hData);
                                    }
                                }
                            }
                            CloseClipboard();
                        }
                    }
                    break;

                case IDM_MARK:
                    {
                        BOOL bChanged = FALSE;
                        int i;

                        // toggle the mark on the current selection
                        // note that the selection could be multiple rows
                        for (i = 0; i < selection_nrows; i++) {

                            if (view_setmarkstate(current_view, selection + i,
                                                  !view_getmarkstate(current_view, selection + i))) {

                                bChanged = TRUE;
                            }
                        }

                        if (bChanged) {
                            // yes the mark state was changed - need
                            // to rebuild the view.
                            if (!view_isexpanded(current_view)) {
                                view_changeviewoptions(current_view);
                            }
                        }
                        break;
                    }

                case IDM_TOGGLEMARK:
                    // toggle the state of all files: unmark all
                    // marked files and vice versa
                    complist_togglemark(view_getcomplist(current_view));

                    // rebuild view
                    if (!view_isexpanded(current_view)) {
                        view_changeviewoptions(current_view);
                    }
                    break;

                case IDM_MARKPATTERN:
                    // dialog to query the pattern, then set a mark on
                    // all compitems whose title matches that pattern
                    // returns TRUE if anything was changed
                    if (complist_markpattern(view_getcomplist(current_view))) {

                        // rebuild view
                        if (!view_isexpanded(current_view)) {
                            view_changeviewoptions(current_view);
                        }
                    }
                    break;

                case IDM_EXPAND:

                    /* show the expanded view of the
                     * selected file
                     */
                    if (current_view != NULL) {
                        ToExpand(hWnd);
                    }

                    break;

                case IDM_OUTLINE:
                    /* return to the outline view (list of filenames) */
                    ToOutline(hWnd);

                    break;

                case IDM_FCHANGE:
                    /* find the next line in the current view
                     * that is not the same in both files -
                     * in outline view, finds the next filename that
                     * is not identical
                     */
                    FindNextChange();
                    break;

                case IDM_FPCHANGE:
                    /* same as IDM_FCHANGE, but going backwards from
                     * current position
                     */
                    FindPrevChange();
                    break;

                case IDM_FCHANGE_LAURIE:
                    /* same as IDM_FCHANGE, but tries to keep cursor on same
                     * line.
                     */
                    _FindNextChange(TRUE, FALSE);
                    break;

                case IDM_FPCHANGE_LAURIE:
                    /* same as IDM_FPCHANGE, but tries to keep cursor on same
                     * line.
                     */
                    _FindPrevChange(TRUE, FALSE);
                    break;

                    // given a line that has been moved, jump to the
                    // other representation of the same line.
                    // this used to be available just through double-click
                    // but now is also available from a context menu
                case IDM_TOMOVED:
                    ToMoved(hWnd, TRUE);
                    break;
            }
            break;

        case WM_SIZE:
            DoResize(hWnd);
            break;

        case WM_SETFOCUS:
            /* set the focus on the table class so it can process
             * page-up /pagedown keys etc.
             */
            SetFocus(hwndRCD);
            break;

        case WM_KEYDOWN:
            /* although the table window has the focus, he passes
             * back to us any keys he doesn't understand
             * We handle escape here to mean 'return to outline view'
             */
            if (wParam == VK_ESCAPE) {
                ToOutline(hWnd);
            } else if (wParam == VK_APPS) {
                // Handle the context menu keyboard key
                POINT posCursor;
                GetCursorPos(&posCursor);
                ScreenToClient(hwndRCD, &posCursor);
                OnRightClick(hWnd, posCursor.x, posCursor.y);
            }
            break;

        case WM_RBUTTONDOWN:
            /*
             * the table window handles this by performing the
             * selection and then passing the message to us, allowing
             * us to put up a context menu.
             */
            OnRightClick(hWnd, LOWORD(lParam), HIWORD(lParam));
            break;

        case WM_CLOSE:
            SendMessage(hWnd, WM_COMMAND, IDM_EXIT, 0);
            return TRUE;

            /* don't allow close when busy - process this message in
             * order to ensure this
             */
            break;

        case WM_DESTROY:
      TCHAR pszHelp[MAX_PATH];
      memset(pszHelp, 0, MAX_PATH);
      hr = StringCchCopy(pszHelp, MAX_PATH, pszWorkingDirectoryName);
      if (FAILED(hr))
        OutputError(hr, IDS_SAFE_COPY);
      hr = StringCchCat(pszHelp, MAX_PATH, "sdkdiff.hlp");
      if (FAILED(hr))
        OutputError(hr, IDS_SAFE_COPY);
            DeleteTools();
            WinHelp(hWnd, pszHelp, HELP_QUIT, 0);
            PostQuitMessage(0);
            break;

        case TM_CURRENTVIEW:
            /* allow other people such as the bar window to query the
             * current view
             */
            return((INT_PTR) current_view);

#ifdef LATER
#ifdef WM_MOUSEWHEEL
        case WM_MOUSEWHEEL:
            if (LOWORD(wParam) & MK_MBUTTON) {
                if ((short)HIWORD(wParam) < 0) {
                    // The next occurence
                    _FindNextChange(FALSE, TRUE);
                }
                else {
                    _FindPrevChange(FALSE, TRUE);
                }
            }
            break;
#endif
#endif

        case WM_QUERYENDSESSION:
            if (IsBusy())
                return FALSE;
            return TRUE;

        case WM_ENDSESSION:
            SendMessage(hWnd, WM_CLOSE, 0, 0);
            break;

        default:
            /* handle registered table messages */
            if (message == table_msgcode) {
                ret = TableServer(hWnd, wParam, lParam);
                return(ret);
            }
            return(DefWindowProc(hWnd, message, wParam, lParam));
    }
    return(0);
}

int PASCAL WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

_tWinMain - Application entry point and dispatch loop

Definition at line 48 of file Demo.c.

{

    HWND hWnd;
    MSG msg;
    CHAR szAppName[64];

    UNREFERENCED_PARAMETER(lpCmdLine);

    if (!hPrevInstance)
        if (!DemoInit(hInstance))
            return (0);

    hInst = hInstance;
    LoadString(hInstance, IDS_APPNAME, szAppName, sizeof(szAppName));

    hWnd = CreateWindow("Demo",
        szAppName,
        WS_OVERLAPPEDWINDOW,
        CW_USEDEFAULT,
        CW_USEDEFAULT,
        CW_USEDEFAULT,
        CW_USEDEFAULT,
        NULL,
        NULL,
        hInstance,
        NULL);

    if (!hWnd)
        return (0);

    ShowWindow(hWnd, nCmdShow);
    UpdateWindow(hWnd);

    while (GetMessage(&msg, NULL, 0, 0)) {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }
    return (int)(msg.wParam);
}

Generated on Wed Nov 13 2024 16:53:17 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/AppUtil/AppUtil.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • AppUtil
Defines | Functions

AppUtil.Cpp File Reference

#include <windows.h>
#include <tchar.h>
#include <shellapi.h>
#include "apputil.h"
#include <assert.h>
#include <aclapi.h>

Go to the source code of this file.

Defines

#define | _NOANSIMACROS_

Functions

STDAPI | A_StgCreateDocfile (LPSTR pszFileName, DWORD dwAccessMode, DWORD reserved, IStorage **ppIStorage)
STDAPI | A_StgIsStorageFile (LPSTR pszFileName)
STDAPI | A_StgOpenStorage (LPSTR pszFileName, IStorage *pIStorage, DWORD dwAccessMode, SNB snbExclude, DWORD reserved, IStorage **ppIStorage)
STDAPI | A_StringFromGUID2 (REFGUID guid, LPSTR pszGUID, int cch)
STDAPI | A_WriteFmtUserTypeStg (IStorage *pIStorage, CLIPFORMAT ClipFmt, LPSTR pszUserType)
BOOL | AddRegNamedValue (LPTSTR pszKey, LPTSTR pszSubkey, LPTSTR pszValueName, LPTSTR pszValue)
HRESULT | AnsiToUc (LPSTR pszAnsi, LPWSTR pwszUc, int cch)
BOOL CmdExec (LPTSTR szCmd)
HPALETTE | CreateColorScalePalette (HDC hDC, int nColor)
BOOL | DComOk (void)
void | DelayBox (HINSTANCE hInst, LPTSTR pszTemplate, HWND hWndOwner)
BOOL CALLBACK | DialogProc (HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
void | ErrorBox (HINSTANCE hInst, HWND hWndOwner, INT iStringID)
BOOL | FileExist (TCHAR *pszFileName)
BOOL | GetErrorMsg (HRESULT hr, LPTSTR pszMsg, UINT uiSize)
BOOL | GetExeName (HINSTANCE hInst, TCHAR *pszExeName)
void | GoWeb (HINSTANCE hInst, LPSTR pszTarget)
void | HrMsg (HWND hWndOwner, LPTSTR pszTitle, HRESULT hr)
void | HrMsgId (HINSTANCE hInst, HWND hWndOwner, INT iStringID, HRESULT hr)
DWORD | lRandom (void)
BOOL | MakeFamilyPath (HINSTANCE hInst, TCHAR *pszNewPath, TCHAR *pszFileExt)
void | OutputDebugFmt (LPTSTR pszFmt,...)
VOID | PaintWindow (HWND hWnd, int nColor)
void | ReadHelp (HWND hWndOwner, LPTSTR pszHelpFile)
void | ReadSource (HWND hWndOwner, OPENFILENAME *pOfn)
void | ReadTutorial (HINSTANCE hInst, HWND hWndOwner, LPTSTR pszHTMLFile)
BOOL | SetRegKeyValue (LPTSTR pszKey, LPTSTR pszSubkey, LPTSTR pszValue)
LPSTR | SkipAnsi (LPSTR psz, BOOL bSkipWhite)
HRESULT | UcToAnsi (LPWSTR pwszUc, LPSTR pszAnsi, int cch)
LRESULT CALLBACK | WindowProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)

Define Documentation

#define _NOANSIMACROS_

Definition at line 56 of file AppUtil.Cpp.

Function Documentation

STDAPI A_StgCreateDocfile | ( | LPSTR | pszFileName,
 |  | DWORD | dwAccessMode,
 |  | DWORD | reserved,
 |  | IStorage ** | ppIStorage
 | ) |  |

Definition at line 230 of file AppUtil.Cpp.

{
  HRESULT hr = E_INVALIDARG;
  WCHAR wszUc[MAX_PATH];
  LPWSTR pwszUc = NULL;

  // Null the caller's output variable.
  *ppIStorage = NULL;

  if (NULL != pszFileName)
  {
    AnsiToUc(pszFileName, wszUc, MAX_PATH);
    pwszUc = wszUc;
  }

  hr = StgCreateDocfile(pwszUc, dwAccessMode, reserved, ppIStorage);

  return hr;
}

STDAPI A_StgIsStorageFile ( LPSTR pszFileName )

Definition at line 209 of file AppUtil.Cpp.

{
  HRESULT hr = E_INVALIDARG;
  WCHAR wszUc[MAX_PATH];

  if (NULL != pszFileName)
  {
    AnsiToUc(pszFileName, wszUc, MAX_PATH);
    hr = StgIsStorageFile(wszUc);
  }

  return hr;
}

STDAPI A_StgOpenStorage | ( | LPSTR | pszFileName,
 |  | IStorage * | pIStorage,
 |  | DWORD | dwAccessMode,
 |  | SNB | snbExclude,
 |  | DWORD | reserved,
 |  | IStorage ** | ppIStorage
 | ) |  |

Definition at line 260 of file AppUtil.Cpp.

{
  HRESULT hr = E_INVALIDARG;
  WCHAR wszUc[MAX_PATH];
  LPWSTR pwszUc = NULL;

  // Null the caller's output variable.
  *ppIStorage = NULL;

  if (NULL != pszFileName)
  {
    AnsiToUc(pszFileName, wszUc, MAX_PATH);
    pwszUc = wszUc;
  }

  hr = StgOpenStorage(
         pwszUc,
         pIStorage,
         dwAccessMode,
         snbExclude,
         reserved,
         ppIStorage);

  return hr;
}

STDAPI A_StringFromGUID2 | ( | REFGUID | guid,
 |  | LPSTR | pszGUID,
 |  | int | cch
 | ) |  |

Definition at line 152 of file AppUtil.Cpp.

{
  HRESULT hr = E_INVALIDARG;
  LPWSTR  pszUc;
  IMalloc* pIMalloc;

  if (NULL != pszGUID && 0 < cch)
  {
    hr = CoGetMalloc(MEMCTX_TASK, &pIMalloc);
    if (SUCCEEDED(hr))
    {
      pszUc = (LPWSTR)pIMalloc->Alloc((cch+1)*sizeof(TCHAR));
      pIMalloc->Release();
      if (NULL != pszUc)
      {
        hr = StringFromGUID2(guid, pszUc, cch);
        if (SUCCEEDED(hr))
          hr = UcToAnsi(pszUc, pszGUID, cch);
        CoTaskMemFree((void *)pszUc);
      }
      else
        hr = E_OUTOFMEMORY;
    }
  }

  return hr;
}

STDAPI A_WriteFmtUserTypeStg | ( | IStorage * | pIStorage,
 |  | CLIPFORMAT | ClipFmt,
 |  | LPSTR | pszUserType
 | ) |  |

Definition at line 186 of file AppUtil.Cpp.

{
  HRESULT hr = E_INVALIDARG;
  WCHAR wszUc[MAX_PATH];

  if (NULL != pszUserType)
  {
    AnsiToUc(pszUserType, wszUc, MAX_PATH);
    hr = WriteFmtUserTypeStg(pIStorage, ClipFmt, wszUc);
  }

  return hr;
}

BOOL AddRegNamedValue | ( | LPTSTR | pszKey,
 |  | LPTSTR | pszSubkey,
 |  | LPTSTR | pszValueName,
 |  | LPTSTR | pszValue
 | ) |  |

Definition at line 2811 of file AppUtil.Cpp.

{
  BOOL bOk = FALSE;
  LONG ec;
  HKEY hKey;
  TCHAR szKey[MAX_STRING_LENGTH];

  lstrcpyn(szKey, pszKey, MAX_STRING_LENGTH);

  if (NULL != pszSubkey)
  {
    lstrncat(szKey, TEXT("\\"), MAX_STRING_LENGTH - lstrlen(szKey));
    lstrncat(szKey, pszSubkey, MAX_STRING_LENGTH - lstrlen(szKey));
  }

  ec = RegOpenKeyEx(
         HKEY_CLASSES_ROOT,
         szKey,
         0,
         KEY_ALL_ACCESS,
         &hKey);

  if (NULL != pszValue && ERROR_SUCCESS == ec)
  {
    ec = RegSetValueEx(
           hKey,
           pszValueName,
           0,
           REG_SZ,
           (BYTE *)pszValue,
           (lstrlen(pszValue)+1)*sizeof(TCHAR));
    if (ERROR_SUCCESS == ec)
      bOk = TRUE;
    RegCloseKey(hKey);
  }

  return bOk;
}

HRESULT AnsiToUc | ( | LPSTR | pszAnsi,
 |  | LPWSTR | pwszUc,
 |  | int | cch
 | ) |  |

Definition at line 80 of file AppUtil.Cpp.

{
  HRESULT hr = E_POINTER;
  int cOut;

  assert(cch > 0);

  if (NULL != pszAnsi && NULL != pwszUc)
  {
    cOut = MultiByteToWideChar(CP_ACP, 0, pszAnsi, -1, pwszUc, cch);

    if (0 != cOut)
      hr = NOERROR;
    else
      hr = E_FAIL;
  }

  return hr;
}

BOOL CmdExec ( LPTSTR szCmd )

Definition at line 690 of file AppUtil.Cpp.

{
  BOOL bOk;
  STARTUPINFO si;
  PROCESS_INFORMATION pi;

  // Execute the command with a call to the CreateProcess API call.
  memset(&si,0,sizeof(STARTUPINFO));
  si.cb = sizeof(STARTUPINFO);
  si.wShowWindow = SW_SHOW;
  bOk = CreateProcess(NULL,szCmd,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi);
  CloseHandle(pi.hThread);
  CloseHandle(pi.hProcess);

  return bOk;
}

HPALETTE CreateColorScalePalette | ( | HDC | hDC,
 |  | int | nColor
 | ) |  |

Definition at line 358 of file AppUtil.Cpp.

{
  HPALETTE     hPalette;
  GLOBALHANDLE hMem;
  LPLOGPALETTE lpMem;
  int          idx,nReserved,nSize;

  hPalette = NULL;
  if(GetDeviceCaps(hDC,RASTERCAPS) & RC_PALETTE)
  {
    nReserved = GetDeviceCaps(hDC,NUMRESERVED);
    nSize     = GetDeviceCaps(hDC,SIZEPALETTE) - nReserved;

    hMem = GlobalAlloc(
             GHND,
             (DWORD)sizeof(LOGPALETTE)+(sizeof(PALETTEENTRY)*nSize));
    if(hMem)
    {
      if(lpMem = (LPLOGPALETTE)GlobalLock(hMem))
      {
        lpMem->palNumEntries = (WORD)nSize;
        lpMem->palVersion    = (WORD)0x0300;
        switch(nColor)
        {
          case COLOR_SCALE_RED:
            for(idx=0; idx < nSize; idx++)
            {
              lpMem->palPalEntry[idx].peRed   = (BYTE)idx;
              lpMem->palPalEntry[idx].peGreen = 0;
              lpMem->palPalEntry[idx].peBlue  = 0;
              lpMem->palPalEntry[idx].peFlags = PC_RESERVED;
            }
            break;

          case COLOR_SCALE_GREEN:
            for(idx=0; idx < nSize; idx++)
            {
              lpMem->palPalEntry[idx].peRed   = 0;
              lpMem->palPalEntry[idx].peGreen = (BYTE)idx;
              lpMem->palPalEntry[idx].peBlue  = 0;
              lpMem->palPalEntry[idx].peFlags = PC_RESERVED;
            }
            break;

          case COLOR_SCALE_BLUE:
            for(idx=0; idx < nSize; idx++)
            {
              lpMem->palPalEntry[idx].peRed   = 0;
              lpMem->palPalEntry[idx].peGreen = 0;
              lpMem->palPalEntry[idx].peBlue  = (BYTE)idx;
              lpMem->palPalEntry[idx].peFlags = PC_RESERVED;
            }
            break;

          default:
          case COLOR_SCALE_GRAY:
            for(idx=0; idx < nSize; idx++)
            {
              lpMem->palPalEntry[idx].peRed   = (BYTE)idx;
              lpMem->palPalEntry[idx].peGreen = (BYTE)idx;
              lpMem->palPalEntry[idx].peBlue  = (BYTE)idx;
              lpMem->palPalEntry[idx].peFlags = PC_RESERVED;
            }
            break;
        }

        hPalette = CreatePalette(lpMem);

        GlobalUnlock(hMem);
      }
      GlobalFree(hMem);
    }
  }

  return(hPalette);
}

BOOL DComOk ( void )

Definition at line 309 of file AppUtil.Cpp.

{
  BOOL bOk = FALSE;

  if (NULL != GetProcAddress(
                GetModuleHandle(TEXT("OLE32")),
                "CoInitializeEx"))
    bOk = TRUE;

  return(bOk);
}

void DelayBox | ( | HINSTANCE | hInst,
 |  | LPTSTR | pszTemplate,
 |  | HWND | hWndOwner
 | ) |  |

Definition at line 1543 of file AppUtil.Cpp.

{
  CDelayBox dlgBox;

  // Show a time-delayed message box.
  dlgBox.ShowDialog(hInst, pszTemplate, hWndOwner);

  return;
}

INT_PTR CALLBACK DialogProc | ( | HWND | hWndDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 1311 of file AppUtil.Cpp.

{
  // Get a pointer to the window class object.
  CVirDialog* pdlg = (CVirDialog*) GetWindowLongPtr(hWndDlg, GWLP_USERDATA);

  switch (uMsg)
  {
    case WM_INITDIALOG:
      // Get a pointer to the window class object.
      pdlg = (CVirDialog*) lParam;

      // Assign the m_hWnd member variable.
      pdlg->m_hWnd = hWndDlg;

      // Set the USERDATA word to point to the class object.
      SetWindowLongPtr(hWndDlg, GWLP_USERDATA, (INT_PTR) pdlg);
      break;

    default:
      break;
  }

  // Call its message proc method.
  if (pdlg != (CVirDialog *) 0)
    return (pdlg->DialogProc(hWndDlg, uMsg, wParam, lParam));
  else
    return (FALSE);
}

void ErrorBox | ( | HINSTANCE | hInst,
 |  | HWND | hWndOwner,
 |  | INT | iStringID
 | ) |  |

Definition at line 1574 of file AppUtil.Cpp.

{
  TCHAR szMsg[MAX_STRING_LENGTH];

  // Load the error message string from the resources.
  if (LoadString(
        hInst,
        iStringID,
        szMsg,
        MAX_STRING_LENGTH))
  {
    // Put up error message box with the retrieved error string message.
    MessageBox(
      hWndOwner,
      szMsg,
      TEXT(ERROR_TITLE_STR),
      MB_OK | MB_ICONEXCLAMATION);
  }

  return;
}

BOOL FileExist ( TCHAR * pszFileName )

Definition at line 562 of file AppUtil.Cpp.

{
  BOOL bExist = FALSE;
  HANDLE hFile;

  if (NULL != pszFileName)
  {
    // Use the preferred Win32 API call and not the older OpenFile.
    hFile = CreateFile(
              pszFileName,
              GENERIC_READ,
              FILE_SHARE_READ | FILE_SHARE_WRITE,
              NULL,
              OPEN_EXISTING,
              0,
              0);

    if (hFile != INVALID_HANDLE_VALUE)
    {
      // If the handle is valid then the file exists.
      CloseHandle(hFile);
      bExist = TRUE;
    }
  }

  return (bExist);
}

BOOL GetErrorMsg | ( | HRESULT | hr,
 |  | LPTSTR | pszMsg,
 |  | UINT | uiSize
 | ) |  |

Definition at line 725 of file AppUtil.Cpp.

{
  BOOL bErr = FAILED(hr);
  DWORD dwSize;

  if (bErr)
  {
    memset(pszMsg, 0, uiSize * sizeof(TCHAR));

    dwSize = FormatMessage(
      FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM,
      NULL,
      hr,
      MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL),
      pszMsg,
      uiSize,
      NULL);
    if (dwSize>2)
    {
      // Take out the trailing CRLF.
      pszMsg[--dwSize] = 0;
      pszMsg[--dwSize] = 0;
    }
  }

  return bErr;
}

BOOL GetExeName | ( | HINSTANCE | hInst,
 |  | TCHAR * | pszExeName
 | ) |  |

Definition at line 652 of file AppUtil.Cpp.

{
  BOOL bOk = FALSE;
  TCHAR  szPath[MAX_PATH];
  TCHAR  szName[64];
  TCHAR  szFileExt[64];

  if (NULL != pszExeName)
  {
    pszExeName[0] = 0;

    bOk = (0 != GetModuleFileName(hInst, szPath, MAX_PATH));
    if (bOk)
    {
      _tsplitpath(szPath, NULL, NULL, szName, szFileExt);
      lstrcpyn(pszExeName, szName, MAX_PATH);
      lstrncat(pszExeName, szFileExt, MAX_PATH - lstrlen(pszExeName));
    }
  }

  return bOk;
}

void GoWeb | ( | HINSTANCE | hInst,
 |  | LPSTR | pszTarget
 | ) |  |

Definition at line 1012 of file AppUtil.Cpp.

{
  INT_PTR iRes;
  BOOL bOk = FALSE;
  LPTSTR pszNew;
  TCHAR  szNew[MAX_PATH];
  TCHAR  szWork[MAX_PATH];

  szNew[0] = 0;
  pszNew = (LPTSTR) &szNew[0];

#if defined(UNICODE)
  AnsiToUc(pszTarget, pszNew, MAX_PATH);
#else
  lstrcpyn(pszNew, pszTarget, MAX_PATH);
#endif

  if (NULL == pszTarget)
    ReadTutorial(hInst, NULL, NULL);
  else if ('/' == *pszNew)
  {
    lstrcpyn(szWork, TEXT("http:"), MAX_PATH);
    lstrncat(szWork, pszNew, MAX_PATH - lstrlen(szWork));
    pszNew = szWork;
    bOk = TRUE;
  }
  else
  {
    // First check if the .HTM file is there at all.
    bOk = FileExist(pszNew);
    if (!bOk)
    {
      // If the .HTM file doesn't exist the put up an error box.
      iRes = MessageBox(
               NULL,
               TEXT(NOHTM_ERROR_STR),
               TEXT(ERROR_TITLE_STR),
               MB_OK | MB_ICONEXCLAMATION);
    }
  }

  if (bOk)
  {
    // Use shell to invoke web browser on the readme HTML file.
    iRes = (INT_PTR) ShellExecute(NULL, NULL, pszNew, NULL, NULL, 0);
    if (iRes <= 32)
    {
      // If unable to browse then put up an error box.
      HrMsg(NULL, TEXT(NOBROWSE_ERROR_STR), E_FAIL);
    }
  }

  return;
}

void HrMsg | ( | HWND | hWndOwner,
 |  | LPTSTR | pszTitle,
 |  | HRESULT | hr
 | ) |  |

Definition at line 775 of file AppUtil.Cpp.

{
  TCHAR szMsg[MAX_PATH];
  TCHAR szErrMsg[MAX_PATH];
  int iResult;

  wsprintf(szMsg, TEXT("Error=0x%X:\r\n"), hr);
  GetErrorMsg(hr, szErrMsg, MAX_PATH);
  lstrncat(szMsg, szErrMsg, MAX_PATH - lstrlen(szMsg));
  iResult = MessageBox(
              hWndOwner,
              szMsg,
              pszTitle,
              MB_OK | MB_ICONEXCLAMATION);

  return;
}

void HrMsgId | ( | HINSTANCE | hInst,
 |  | HWND | hWndOwner,
 |  | INT | iStringID,
 |  | HRESULT | hr
 | ) |  |

Definition at line 819 of file AppUtil.Cpp.

{
  TCHAR szMsg[MAX_STRING_LENGTH];

  // Load the error message string from the resources.
  if (LoadString(
        hInst,
        iStringID,
        szMsg,
        MAX_STRING_LENGTH))
  {
    // Put up error message box with the retrieved error string message.
    HrMsg(hWndOwner, szMsg, hr);
  }

  return;
}

DWORD lRandom ( void )

Definition at line 332 of file AppUtil.Cpp.

{
  static DWORD glSeed = (DWORD)-365387184;

  glSeed *= 69069;

  return(++glSeed);
}

BOOL MakeFamilyPath | ( | HINSTANCE | hInst,
 |  | TCHAR * | pszNewPath,
 |  | TCHAR * | pszFileExt
 | ) |  |

Definition at line 608 of file AppUtil.Cpp.

{
  BOOL bOk = FALSE;
  TCHAR  szPath[MAX_PATH];
  TCHAR  szDrive[64];
  TCHAR  szDir[MAX_PATH];
  TCHAR  szName[64];

  if (NULL != pszNewPath)
  {
    pszNewPath[0] = 0;

    bOk = (0 != GetModuleFileName(hInst, szPath, MAX_PATH));
    if (bOk)
    {
      _tsplitpath(szPath, szDrive, szDir, szName, NULL);
      lstrcpyn(pszNewPath, szDrive, MAX_PATH);
      lstrncat(pszNewPath, szDir, MAX_PATH - lstrlen(pszNewPath));
      lstrncat(pszNewPath, szName, MAX_PATH - lstrlen(pszNewPath));
      lstrncat(pszNewPath, pszFileExt, MAX_PATH - lstrlen(pszNewPath));
    }
  }

  return bOk;
}

void OutputDebugFmt | ( | LPTSTR | pszFmt,
 |  |  | ...
 | ) |  |

Definition at line 1138 of file AppUtil.Cpp.

{
  va_list arglist;
  va_start(arglist, pszFmt);
  TCHAR szMsg[MAX_STRING_LENGTH];

  // Use the format string and arguments to format the content text.
  wvsprintf(szMsg, pszFmt, arglist);
  // Output the newly formated message string to the debugger display.
  OutputDebugString(szMsg);

  return;
}

VOID PaintWindow | ( | HWND | hWnd,
 |  | int | nColor
 | ) |  |

Definition at line 451 of file AppUtil.Cpp.

{
  HDC         hDC;
  int         nMapMode,idx,nSize,nReserved,nLoop;
  RECT        rect;
  HBRUSH      hBrush;
  PAINTSTRUCT ps;
  HPALETTE    hPal;

  if(hDC = BeginPaint(hWnd,&ps))
  {
    GetClientRect(hWnd,&rect);
    nMapMode = SetMapMode(hDC,MM_ANISOTROPIC);

    if(GetDeviceCaps(hDC,RASTERCAPS) & RC_PALETTE)
    {
      nReserved = GetDeviceCaps(hDC,NUMRESERVED);
      nSize     = GetDeviceCaps(hDC,SIZEPALETTE) - nReserved;

      if(hPal = CreateColorScalePalette(hDC,nColor))
      {
        hPal = SelectPalette(hDC,hPal,FALSE);
        RealizePalette(hDC);

        SetWindowExtEx(hDC,nSize,nSize,NULL);
        SetViewportExtEx(hDC,rect.right,-rect.bottom,NULL);
        SetViewportOrgEx(hDC,0,rect.bottom,NULL);

        nLoop = nSize >> 1;
        for(idx=0; idx < nLoop; idx++)
        {
          hBrush = CreateSolidBrush(PALETTEINDEX(idx+nLoop));
          SetRect(&rect,idx,idx,nSize-idx,nSize-idx);
          FillRect(hDC,&rect,hBrush);
          DeleteObject(hBrush);
        }
        DeleteObject(SelectPalette(hDC,hPal,FALSE));
        RealizePalette(hDC);
      }
    }
    else
    {
      SetWindowExtEx(hDC,512,512,NULL);
      SetViewportExtEx(hDC,rect.right,-rect.bottom,NULL);
      SetViewportOrgEx(hDC,0,rect.bottom,NULL);

      for(idx=0; idx < 256; idx++)
      {
        hBrush = CreateSolidBrush(RGB(0,0,idx));
        SetRect(&rect,idx,idx,512-idx,512-idx);
        FillRect(hDC,&rect,hBrush);
        DeleteObject(hBrush);
      }
    }

    SetMapMode(hDC,nMapMode);

    EndPaint(hWnd,&ps);
  }

  return;
}

void ReadHelp | ( | HWND | hWndOwner,
 |  | LPTSTR | pszHelpFile
 | ) |  |

Definition at line 858 of file AppUtil.Cpp.

{
  INT_PTR iRes;

  if (NULL != pszHelpFile)
  {
    // First check if the .HTM help file is there at all.
    if (FileExist(pszHelpFile))
    {
      // Use shell to invoke web browser on the HTML help file.
      iRes = (INT_PTR) ShellExecute(
                     hWndOwner,
                     TEXT("open"),
                     pszHelpFile,
                     NULL,
                     NULL,
                     SW_SHOWNORMAL);
      if (iRes <= 32)
      {
        // If unable to browse then put up an error box.
        HrMsg(hWndOwner, TEXT(NOBROWSE_ERROR_STR), E_FAIL);
      }
    }
    else
    {
      // If the .HTM file doesn't exist the put up an error box.
      iRes = MessageBox(
               hWndOwner,
               TEXT(NOHTM_ERROR_STR),
               TEXT(ERROR_TITLE_STR),
               MB_OK | MB_ICONEXCLAMATION);
    }
  }

  return;
}

void ReadSource | ( | HWND | hWndOwner,
 |  | OPENFILENAME * | pOfn
 | ) |  |

Definition at line 1086 of file AppUtil.Cpp.

{
  TCHAR szReadCmd[MAX_PATH+12];
  TCHAR szFileName[MAX_PATH];
  BOOL bOk;
  int iResult;

  // We'll use the OpenFileName Common Dialog (defined in main app).
  // Set the dialog's file filter and title.
  szFileName[0] = 0;
  pOfn->lpstrFilter = TEXT(OFN_SOURCEFILES_STR);
  pOfn->lpstrTitle = TEXT(OFN_SOURCETITLE_STR);
  pOfn->lpstrFile = szFileName;

  // Call up the dialog to get a file name from the user.
  if (GetOpenFileName(pOfn))
  {
    // If the user provided a file name then assemble a command string
    lstrcpyn(szReadCmd, TEXT(EDITOR_EXE_STR), MAX_PATH+12);
    lstrncat(szReadCmd, szFileName, MAX_PATH+12 - lstrlen(szReadCmd));
    // And execute it.
    bOk = CmdExec(szReadCmd);
    if (!bOk)
    {
      // If create procees failed then put up an error box.
      iResult = MessageBox(
                  hWndOwner,
                  TEXT(NOEDITOR_ERROR_STR),
                  TEXT(ERROR_TITLE_STR),
                  MB_OK | MB_ICONEXCLAMATION);
    }
  }

  return;
}

void ReadTutorial | ( | HINSTANCE | hInst,
 |  | HWND | hWndOwner,
 |  | LPTSTR | pszHTMLFile
 | ) |  |

Definition at line 931 of file AppUtil.Cpp.

{
  TCHAR szFileName[MAX_PATH];

  szFileName[0] = 0;

  if (NULL == pszHTMLFile)
  {
    // Build a path to where the .HTM file should be. It should be in
    // the same directory as the .EXE but with the .HTM extension.
    MakeFamilyPath(hInst, szFileName, TEXT(HTML_FILE_EXT));
  }
  else
  {
    // Use the HTML file specified in a sibling directory.
    BOOL bOk = FALSE;
    TCHAR  szPath[MAX_PATH];
    TCHAR  szDrive[64];
    TCHAR  szDir[MAX_PATH];
    TCHAR  szName[64];
    LPTSTR psz;
    LONG   len;

    bOk = (0 != GetModuleFileName(hInst, szPath, MAX_PATH));
    if (bOk)
    {
      _tsplitpath(szPath, szDrive, szDir, szName, NULL);
      len = lstrlen(szDir);
      if (len > 1)
      {
        // Scan backwards in the Dir path to obtain the path to the
        // parent directory.
        psz = &szDir[0] + len - 1;
        while (psz > &szDir[0])
        {
          psz--;
          if (*psz == '\\' || *psz == '/')
          {
            psz++;
            *psz = 0;
            break;
          }
        }
        // Now build the complete Path & FileName using the Specified
        // HTML file name.
        lstrcpyn(szFileName, szDrive, MAX_PATH);
        lstrncat(szFileName, szDir, MAX_PATH - lstrlen(szFileName));
        if ('.' == *pszHTMLFile)
          lstrncat(szFileName, szName, MAX_PATH - lstrlen(szFileName));
        lstrncat(szFileName, pszHTMLFile, MAX_PATH - lstrlen(szFileName));
      }
    }
  }

  // Now Browse/Read the HTM file.
  ReadHelp(hWndOwner, szFileName);

  return;
}

BOOL SetRegKeyValue | ( | LPTSTR | pszKey,
 |  | LPTSTR | pszSubkey,
 |  | LPTSTR | pszValue
 | ) |  |

Definition at line 2653 of file AppUtil.Cpp.

{
  BOOL bOk = FALSE;
  LONG ec;
  HKEY hKey;
  TCHAR szKey[MAX_STRING_LENGTH];
  DWORD dwRes;
  PSID pEveryoneSID = NULL, pAdminSID = NULL;
  PACL pACL = NULL;
  PSECURITY_DESCRIPTOR pSD = NULL;
  EXPLICIT_ACCESS ea[2];
  SID_IDENTIFIER_AUTHORITY SIDAuthWorld = SECURITY_WORLD_SID_AUTHORITY;
  SID_IDENTIFIER_AUTHORITY SIDAuthNT = SECURITY_NT_AUTHORITY;
  SECURITY_ATTRIBUTES sa;
  LONG lRes;

  lstrcpyn(szKey, pszKey, MAX_STRING_LENGTH);

  if (NULL != pszSubkey)
  {
    lstrncat(szKey, TEXT("\\"), MAX_STRING_LENGTH - lstrlen(szKey));
    lstrncat(szKey, pszSubkey, MAX_STRING_LENGTH - lstrlen(szKey));
  }

  // Create a well-known SID for the Everyone group.
  if(!AllocateAndInitializeSid( &SIDAuthWorld, 1,
    SECURITY_WORLD_RID,
    0, 0, 0, 0, 0, 0, 0,
    &pEveryoneSID))
  {
    goto Cleanup;
  }

  // Initialize an EXPLICIT_ACCESS structure for an ACE.
  // The ACE will allow Everyone read access to the key.
  ZeroMemory(&ea, 2 * sizeof(EXPLICIT_ACCESS));
  ea[0].grfAccessPermissions = KEY_READ;
  ea[0].grfAccessMode = SET_ACCESS;
  ea[0].grfInheritance= NO_INHERITANCE;
  ea[0].Trustee.TrusteeForm = TRUSTEE_IS_SID;
  ea[0].Trustee.TrusteeType = TRUSTEE_IS_WELL_KNOWN_GROUP;
  ea[0].Trustee.ptstrName  = (LPTSTR) pEveryoneSID;

  // Create a SID for the BUILTIN\Administrators group.
  if(!AllocateAndInitializeSid( &SIDAuthNT, 2,
    SECURITY_BUILTIN_DOMAIN_RID,
    DOMAIN_ALIAS_RID_ADMINS,
    0, 0, 0, 0, 0, 0,
    &pAdminSID))
  {
    goto Cleanup;
  }

  // Initialize an EXPLICIT_ACCESS structure for an ACE.
  // The ACE will allow the Administrators group full access to the key.
  ea[1].grfAccessPermissions = KEY_ALL_ACCESS;
  ea[1].grfAccessMode = SET_ACCESS;
  ea[1].grfInheritance= NO_INHERITANCE;
  ea[1].Trustee.TrusteeForm = TRUSTEE_IS_SID;
  ea[1].Trustee.TrusteeType = TRUSTEE_IS_GROUP;
  ea[1].Trustee.ptstrName  = (LPTSTR) pAdminSID;

  // Create a new ACL that contains the new ACEs.
  dwRes = SetEntriesInAcl(2, ea, NULL, &pACL);
  if (ERROR_SUCCESS != dwRes)
  {
    goto Cleanup;
  }

  // Initialize a security descriptor.
  pSD = (PSECURITY_DESCRIPTOR) LocalAlloc(LPTR,
    SECURITY_DESCRIPTOR_MIN_LENGTH);
  if (pSD == NULL)
  {
    goto Cleanup;
  }

  if (!InitializeSecurityDescriptor(pSD, SECURITY_DESCRIPTOR_REVISION))
  {
    goto Cleanup;
  }

  // Add the ACL to the security descriptor.
  if (!SetSecurityDescriptorDacl(pSD,
    TRUE,     // fDaclPresent flag
    pACL,
    FALSE))   // not a default DACL
  {
    goto Cleanup;
  }

  // Initialize a security attributes structure.
  sa.nLength = sizeof (SECURITY_ATTRIBUTES);
  sa.lpSecurityDescriptor = pSD;
  sa.bInheritHandle = FALSE;

  // Use the security attributes to set the security descriptor
  // when you create a key.
  ec = RegCreateKeyEx(
         HKEY_CLASSES_ROOT,
         szKey,
         0,
         NULL,
         REG_OPTION_NON_VOLATILE,
         KEY_READ | KEY_WRITE,
         &sa,
         &hKey,
         NULL);

  if (NULL != pszValue && ERROR_SUCCESS == ec)
  {
    ec = RegSetValueEx(
           hKey,
           NULL,
           0,
           REG_SZ,
           (BYTE *)pszValue,
           (lstrlen(pszValue)+1)*sizeof(TCHAR));
    if (ERROR_SUCCESS == ec)
      bOk = TRUE;
  }

Cleanup:

  if (pEveryoneSID)
    FreeSid(pEveryoneSID);
  if (pAdminSID)
    FreeSid(pAdminSID);
  if (pACL)
    LocalFree(pACL);
  if (pSD)
    LocalFree(pSD);
  if (hKey)
    RegCloseKey(hKey);

  return bOk;
}

LPSTR SkipAnsi | ( | LPSTR | psz,
 |  | BOOL | bSkipWhite
 | ) |  |

Definition at line 531 of file AppUtil.Cpp.

{
  char ch;
  BOOL bWhite;

  while (ch = *psz)
  {
    bWhite = ('\n'==ch || '\r'==ch || '\t'==ch || ' '==ch);

    if ((bSkipWhite && !bWhite) || (!bSkipWhite && bWhite))
      break;

    psz++;
  }

  return psz;
}

HRESULT UcToAnsi | ( | LPWSTR | pwszUc,
 |  | LPSTR | pszAnsi,
 |  | int | cch
 | ) |  |

Definition at line 121 of file AppUtil.Cpp.

{
  HRESULT hr = E_POINTER;
  int cOut;

  assert(cch > 0);

  if (NULL != pszAnsi && NULL != pwszUc)
  {
    cOut = WideCharToMultiByte(CP_ACP, 0, pwszUc, -1, pszAnsi, cch, NULL, NULL);
    if (0 != cOut)
      hr = NOERROR;
    else
      hr = E_FAIL;
  }

  return hr;
}

LRESULT CALLBACK WindowProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 1176 of file AppUtil.Cpp.

{
  // Get a pointer to the window class object.
  CVirWindow* pWin = (CVirWindow*) GetWindowLongPtr(hWnd, GWLP_USERDATA);

  switch (uMsg)
  {
    case WM_NCCREATE:
      // Since this is the first time that we can get ahold of
      // a pointer to the window class object, all messages that might
      // have been sent before this are never seen by the Windows object
      // and only get passed on to the DefWindowProc

      // Get the initial creation pointer to the window object
      pWin = (CVirWindow *) ((CREATESTRUCT *)lParam)->lpCreateParams;

      // Set it's protected m_hWnd member variable to ensure that
      // member functions have access to the correct window handle.
      pWin->m_hWnd = hWnd;

      // Set its USERDATA DWORD to point to the window object
      SetWindowLongPtr(hWnd, GWLP_USERDATA, (INT_PTR) pWin);
      break;

    case WM_DESTROY:
      // This is our signal to destroy the window object.
      SetWindowLongPtr(hWnd, GWLP_USERDATA, 0);
      DELETE_POINTER(pWin);
      break;

    default:
      break;
  }

  // Call its message proc method.
  if (NULL != pWin)
    return (pWin->WindowProc(uMsg, wParam, lParam));
  else
    return (DefWindowProc(hWnd, uMsg, wParam, lParam));
}

Generated on Wed Nov 13 2024 16:53:17 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/AppUtil/AppUtil.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • AppUtil
Defines | Typedefs | Enumerations | Functions

AppUtil.h File Reference

#include <assert.h>

Go to the source code of this file.

Defines

#define | ASSERT(condition)
#define | ASSERTFAIL_ERROR_STR "Assertion Failed."
#define | CKHR(Pfx, Ec)
#define | COLOR_SCALE_BLUE 3
#define | COLOR_SCALE_GRAY 4
#define | COLOR_SCALE_GREEN 2
#define | COLOR_SCALE_RED 1
#define | DEBUG_FMT_CHARS 8
#define | DELAYBOX_DURATION 3000
#define | DELETE_POINTER(p)
#define | EDITOR_EXE_STR "notepad.exe "
#define | ERROR_TITLE_STR "-Error-"
#define | GETCLASSBRUSH(hWnd) (HBRUSH)GetClassLong(hWnd,GCL_HBRBACKGROUND)
#define | GETINSTANCE(hWnd) (HANDLE)GetWindowLong(hWnd,GWL_HINSTANCE)
#define | GUID_SIZE 128
#define | HELP_FILE_EXT ".htm"
#define | HTML_FILE_EXT ".htm"
#define | LICENSE_FILE_EXT ".lic"
#define | LOG(sMsg)
#define | LOGASSERT(condition)
#define | LOGERROR(Pfx, Ec)
#define | LOGF1(sFmt, x)
#define | LOGF2(sFmt, x, y)
#define | LOGF3(sFmt, x, y, z)
#define | LOGID(id)
#define | lstrncat(strDest, strSource, count) strncat(strDest,strSource,count)
#define | MAX_LINE_CHARS 5
#define | MAX_LINE_NUM 99999
#define | MAX_LOG_LINES 500
#define | MAX_STRING_LENGTH 256
#define | MAXLOGST MAX_PATH + MAX_LINE_CHARS + DEBUG_FMT_CHARS
#define | NOBROWSE_ERROR_STR "Can't run browser."
#define | NOCOM_ERROR_STR "Can't Init COM."
#define | NOEDITOR_ERROR_STR "Can't run editor."
#define | NOHTM_ERROR_STR "Can't find .HTM file."
#define | NOTICE_TITLE_STR "-Notice-"
#define | NOTUTORIAL_ERROR_STR "Can't run tutorial."
#define | NOTXT_ERROR_STR "Can't find .TXT file."
#define | ODF1(sFmt, x)
#define | ODF2(sFmt, x, y)
#define | ODF3(sFmt, x, y, z)
#define | ODS(x)
#define | OFN_SOURCEFILES_STR "Source Files (*.CPP;*.H;*.RC;*.C;*.MAK;*.TXT;*.)\0*.CPP;*.H;*.RC;*.C;*.MAK;*.TXT;makefile\0"
#define | OFN_SOURCETITLE_STR "Open Source File"
#define | RELEASE_INTERFACE(p)
#define | StgCreateDocfile(a, b, c, d) A_StgCreateDocfile(a, b, c, d)
#define | StgIsStorageFile(a) A_StgIsStorageFile(a)
#define | StgOpenStorage(a, b, c, d, e, f) A_StgOpenStorage(a, b, c, d, e, f)
#define | StringFromGUID2(a, b, c) A_StringFromGUID2(a, b, c)
#define | TID GetCurrentThreadId()
#define | TUTORIAL_EXE_STR "tutorial.exe "
#define | TXT_FILE_EXT ".txt"
#define | WriteFmtUserTypeStg(a, b, c) A_WriteFmtUserTypeStg(a, b, c)

Typedefs

typedef unsigned(WINAPI * | PCRTTHREADPROC )(LPVOID pThreadProc)
typedef LPVOID * | PPVOID

Enumerations

enum PERSTGSTATE {
PERS_UNINIT = 0, PERS_SCRIBBLE, PERS_NOSCRIBBLE, PERS_HANDSOFF,
PERS_UNINIT = 0, PERS_SCRIBBLE, PERS_NOSCRIBBLE, PERS_HANDSOFF
}

Functions

STDAPI | A_StgCreateDocfile (LPSTR, DWORD, DWORD, IStorage **)
STDAPI | A_StgIsStorageFile (LPSTR)
STDAPI | A_StgOpenStorage (LPSTR, IStorage *, DWORD, SNB, DWORD, IStorage **)
STDAPI | A_StringFromGUID2 (REFGUID, LPSTR, int)
STDAPI | A_WriteFmtUserTypeStg (IStorage *, CLIPFORMAT, LPSTR)
BOOL | AddRegNamedValue (LPTSTR pszKey, LPTSTR pszSubkey, LPTSTR pszValueName, LPTSTR pszValue)
HRESULT | AnsiToUc (LPSTR pszAnsi, LPWSTR pszUc, int cch)
BOOL CmdExec (LPTSTR szCmd)
HPALETTE | CreateColorScalePalette (HWND hDC, int nColor)
BOOL | DComOk (void)
BOOL CALLBACK | DialogProc (HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
BOOL | FileExist (TCHAR *szFileName)
BOOL | GetErrorMsg (HRESULT hr, LPTSTR pszMsg, UINT uiSize)
BOOL | GetExeName (HINSTANCE hInst, TCHAR *pszExeName)
void | GoWeb (HINSTANCE hInst, LPSTR pszTarget)
void | HrMsg (HWND hWndOwner, LPTSTR pszTitle, HRESULT hr)
void | HrMsgId (HINSTANCE hInst, HWND hWndOwner, INT iStringID, HRESULT hr)
DWORD | lRandom (void)
BOOL | MakeFamilyPath (HINSTANCE hInst, TCHAR *pszNewPath, TCHAR *pszFileExt)
void | OutputDebugFmt (LPTSTR szFmt,...)
VOID | PaintWindow (HWND hWnd, int nColor)
void | ReadHelp (HWND hWndOwner, LPTSTR pszHelpFile)
void | ReadSource (HWND hWndOwner, OPENFILENAME *pOfn)
void | ReadTutorial (HINSTANCE hInst, HWND hWndOwner, LPTSTR pszHTMLFile)
BOOL | SetRegKeyValue (LPTSTR pszKey, LPTSTR pszSubkey, LPTSTR pszValue)
LPSTR | SkipAnsi (LPSTR psz, BOOL bSkipWhite)
HRESULT | UcToAnsi (LPWSTR pwszUc, LPSTR pszAnsi, int cch)
LRESULT CALLBACK | WindowProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)

Define Documentation

#define ASSERT ( condition )

Definition at line 1410 of file AppUtil.h.

#define ASSERTFAIL_ERROR_STR "Assertion Failed."

Definition at line 138 of file AppUtil.h.

#define CKHR | ( | Pfx,
 |  | Ec
 | ) |

Definition at line 1412 of file AppUtil.h.

#define COLOR_SCALE_BLUE 3

Definition at line 123 of file AppUtil.h.

#define COLOR_SCALE_GRAY 4

Definition at line 124 of file AppUtil.h.

#define COLOR_SCALE_GREEN 2

Definition at line 122 of file AppUtil.h.

#define COLOR_SCALE_RED 1

Definition at line 121 of file AppUtil.h.

#define DEBUG_FMT_CHARS 8

Definition at line 116 of file AppUtil.h.

#define DELAYBOX_DURATION 3000

Definition at line 119 of file AppUtil.h.

#define DELETE_POINTER ( p )
Value:
{\
  if (NULL != p)\
  {\
    delete p;\
    p = NULL;\
  }\
}

Definition at line 76 of file AppUtil.h.

#define EDITOR_EXE_STR "notepad.exe "

Definition at line 126 of file AppUtil.h.

#define ERROR_TITLE_STR "-Error-"

Definition at line 131 of file AppUtil.h.

#define GETCLASSBRUSH ( hWnd ) (HBRUSH)GetClassLong(hWnd,GCL_HBRBACKGROUND)

Definition at line 108 of file AppUtil.h.

#define GETINSTANCE ( hWnd ) (HANDLE)GetWindowLong(hWnd,GWL_HINSTANCE)

Definition at line 107 of file AppUtil.h.

#define GUID_SIZE 128

Definition at line 112 of file AppUtil.h.

#define HELP_FILE_EXT ".htm"

Definition at line 139 of file AppUtil.h.

#define HTML_FILE_EXT ".htm"

Definition at line 140 of file AppUtil.h.

#define LICENSE_FILE_EXT ".lic"

Definition at line 142 of file AppUtil.h.

#define LOG ( sMsg )
Value:
{\
  if (NULL!=g_pMsgLog)\
    g_pMsgLog->Msg(TEXT(sMsg));\
}

Definition at line 1414 of file AppUtil.h.

#define LOGASSERT ( condition )
Value:
{\
  if (!(condition))\
    LOGID(IDS_ASSERT_FAIL);\
}

Definition at line 1463 of file AppUtil.h.

#define LOGERROR | ( | Pfx,
 |  | Ec
 | ) |
Value:
{\
  TCHAR szMsg[MAX_PATH];\
  if (NULL!=g_pMsgLog && GetErrorMsg(Ec,szMsg,MAX_PATH))\
    g_pMsgLog->MsgFmt(TEXT("%s Error=0x%X: %s"),TEXT(Pfx),Ec,szMsg);\
}

Definition at line 1447 of file AppUtil.h.

#define LOGF1 | ( | sFmt,
 |  | x
 | ) |
Value:
{\
  if (NULL!=g_pMsgLog)\
    g_pMsgLog->MsgFmt(TEXT(sFmt),x);\
}

Definition at line 1422 of file AppUtil.h.

#define LOGF2 | ( | sFmt,
 |  | x,
 |  | y
 | ) |
Value:
{\
  if (NULL!=g_pMsgLog)\
    g_pMsgLog->MsgFmt(TEXT(sFmt),x,y);\
}

Definition at line 1430 of file AppUtil.h.

#define LOGF3 | ( | sFmt,
 |  | x,
 |  | y,
 |  | z
 | ) |
Value:
{\
  if (NULL!=g_pMsgLog)\
    g_pMsgLog->MsgFmt(TEXT(sFmt),x,y,z);\
}

Definition at line 1438 of file AppUtil.h.

#define LOGID ( id )
Value:
{\
  if (NULL!=g_pMsgLog)\
    g_pMsgLog->MsgID(id);\
}

Definition at line 1456 of file AppUtil.h.

#define lstrncat | ( | strDest,
 |  | strSource,
 |  | count |
 | ) |  | strncat(strDest,strSource,count)

Definition at line 1193 of file AppUtil.h.

#define MAX_LINE_CHARS 5

Definition at line 115 of file AppUtil.h.

#define MAX_LINE_NUM 99999

Definition at line 114 of file AppUtil.h.

#define MAX_LOG_LINES 500

Definition at line 118 of file AppUtil.h.

#define MAX_STRING_LENGTH 256

Definition at line 113 of file AppUtil.h.

#define MAXLOGST MAX_PATH + MAX_LINE_CHARS + DEBUG_FMT_CHARS

Definition at line 117 of file AppUtil.h.

#define NOBROWSE_ERROR_STR "Can't run browser."

Definition at line 137 of file AppUtil.h.

#define NOCOM_ERROR_STR "Can't Init COM."

Definition at line 132 of file AppUtil.h.

#define NOEDITOR_ERROR_STR "Can't run editor."

Definition at line 133 of file AppUtil.h.

#define NOHTM_ERROR_STR "Can't find .HTM file."

Definition at line 136 of file AppUtil.h.

#define NOTICE_TITLE_STR "-Notice-"

Definition at line 130 of file AppUtil.h.

#define NOTUTORIAL_ERROR_STR "Can't run tutorial."

Definition at line 134 of file AppUtil.h.

#define NOTXT_ERROR_STR "Can't find .TXT file."

Definition at line 135 of file AppUtil.h.

#define ODF1 | ( | sFmt,
 |  | x
 | ) |

Definition at line 1404 of file AppUtil.h.

#define ODF2 | ( | sFmt,
 |  | x,
 |  | y
 | ) |

Definition at line 1406 of file AppUtil.h.

#define ODF3 | ( | sFmt,
 |  | x,
 |  | y,
 |  | z
 | ) |

Definition at line 1408 of file AppUtil.h.

#define ODS ( x )

Definition at line 1402 of file AppUtil.h.

#define OFN_SOURCEFILES_STR "Source Files (*.CPP;*.H;*.RC;*.C;*.MAK;*.TXT;*.)\0*.CPP;*.H;*.RC;*.C;*.MAK;*.TXT;makefile\0"

Definition at line 128 of file AppUtil.h.

#define OFN_SOURCETITLE_STR "Open Source File"

Definition at line 129 of file AppUtil.h.

#define RELEASE_INTERFACE ( p )
Value:
{\
  IUnknown* pTmp = (IUnknown*)p;\
  p = NULL;\
  if (NULL != pTmp)\
    pTmp->Release();\
}

Definition at line 85 of file AppUtil.h.

#define StgCreateDocfile | ( | a,
 |  | b,
 |  | c,
 |  | d |
 | ) |  | A_StgCreateDocfile(a, b, c, d)

Definition at line 793 of file AppUtil.h.

#define StgIsStorageFile ( a ) A_StgIsStorageFile(a)

Definition at line 790 of file AppUtil.h.

#define StgOpenStorage | ( | a,
 |  | b,
 |  | c,
 |  | d,
 |  | e,
 |  | f |
 | ) |  | A_StgOpenStorage(a, b, c, d, e, f)

Definition at line 796 of file AppUtil.h.

#define StringFromGUID2 | ( | a,
 |  | b,
 |  | c |
 | ) |  | A_StringFromGUID2(a, b, c)

Definition at line 784 of file AppUtil.h.

#define TID GetCurrentThreadId()

Definition at line 1196 of file AppUtil.h.

#define TUTORIAL_EXE_STR "tutorial.exe "

Definition at line 127 of file AppUtil.h.

#define TXT_FILE_EXT ".txt"

Definition at line 141 of file AppUtil.h.

#define WriteFmtUserTypeStg | ( | a,
 |  | b,
 |  | c |
 | ) |  | A_WriteFmtUserTypeStg(a, b, c)

Definition at line 787 of file AppUtil.h.

Typedef Documentation

typedef unsigned(WINAPI * PCRTTHREADPROC)(LPVOID pThreadProc)

Definition at line 105 of file AppUtil.h.

typedef LPVOID* PPVOID

Definition at line 70 of file AppUtil.h.

Enumeration Type Documentation

enum PERSTGSTATE
Enumerator:
PERS_UNINIT
PERS_SCRIBBLE
PERS_NOSCRIBBLE
PERS_HANDSOFF
PERS_UNINIT
PERS_SCRIBBLE
PERS_NOSCRIBBLE
PERS_HANDSOFF

Definition at line 95 of file AppUtil.h.

{
  PERS_UNINIT = 0,  // Uninitialized.
  PERS_SCRIBBLE,    // Write     permitted; Read     permitted.
  PERS_NOSCRIBBLE,  // Write NOT permitted; Read     permitted.
  PERS_HANDSOFF     // Write NOT permitted; Read NOT permitted.
} PERSTGSTATE;

Function Documentation

STDAPI A_StgCreateDocfile | ( | LPSTR | ,
 |  | DWORD | ,
 |  | DWORD | ,
 |  | IStorage ** |
 | ) |  |

Definition at line 230 of file AppUtil.Cpp.

{
  HRESULT hr = E_INVALIDARG;
  WCHAR wszUc[MAX_PATH];
  LPWSTR pwszUc = NULL;

  // Null the caller's output variable.
  *ppIStorage = NULL;

  if (NULL != pszFileName)
  {
    AnsiToUc(pszFileName, wszUc, MAX_PATH);
    pwszUc = wszUc;
  }

  hr = StgCreateDocfile(pwszUc, dwAccessMode, reserved, ppIStorage);

  return hr;
}

STDAPI A_StgIsStorageFile ( LPSTR )

Definition at line 209 of file AppUtil.Cpp.

{
  HRESULT hr = E_INVALIDARG;
  WCHAR wszUc[MAX_PATH];

  if (NULL != pszFileName)
  {
    AnsiToUc(pszFileName, wszUc, MAX_PATH);
    hr = StgIsStorageFile(wszUc);
  }

  return hr;
}

STDAPI A_StgOpenStorage | ( | LPSTR | ,
 |  | IStorage * | ,
 |  | DWORD | ,
 |  | SNB | ,
 |  | DWORD | ,
 |  | IStorage ** |
 | ) |  |

Definition at line 260 of file AppUtil.Cpp.

{
  HRESULT hr = E_INVALIDARG;
  WCHAR wszUc[MAX_PATH];
  LPWSTR pwszUc = NULL;

  // Null the caller's output variable.
  *ppIStorage = NULL;

  if (NULL != pszFileName)
  {
    AnsiToUc(pszFileName, wszUc, MAX_PATH);
    pwszUc = wszUc;
  }

  hr = StgOpenStorage(
         pwszUc,
         pIStorage,
         dwAccessMode,
         snbExclude,
         reserved,
         ppIStorage);

  return hr;
}

STDAPI A_StringFromGUID2 | ( | REFGUID | ,
 |  | LPSTR | ,
 |  | int |
 | ) |  |

Definition at line 152 of file AppUtil.Cpp.

{
  HRESULT hr = E_INVALIDARG;
  LPWSTR  pszUc;
  IMalloc* pIMalloc;

  if (NULL != pszGUID && 0 < cch)
  {
    hr = CoGetMalloc(MEMCTX_TASK, &pIMalloc);
    if (SUCCEEDED(hr))
    {
      pszUc = (LPWSTR)pIMalloc->Alloc((cch+1)*sizeof(TCHAR));
      pIMalloc->Release();
      if (NULL != pszUc)
      {
        hr = StringFromGUID2(guid, pszUc, cch);
        if (SUCCEEDED(hr))
          hr = UcToAnsi(pszUc, pszGUID, cch);
        CoTaskMemFree((void *)pszUc);
      }
      else
        hr = E_OUTOFMEMORY;
    }
  }

  return hr;
}

STDAPI A_WriteFmtUserTypeStg | ( | IStorage * | ,
 |  | CLIPFORMAT | ,
 |  | LPSTR |
 | ) |  |

Definition at line 186 of file AppUtil.Cpp.

{
  HRESULT hr = E_INVALIDARG;
  WCHAR wszUc[MAX_PATH];

  if (NULL != pszUserType)
  {
    AnsiToUc(pszUserType, wszUc, MAX_PATH);
    hr = WriteFmtUserTypeStg(pIStorage, ClipFmt, wszUc);
  }

  return hr;
}

BOOL AddRegNamedValue | ( | LPTSTR | pszKey,
 |  | LPTSTR | pszSubkey,
 |  | LPTSTR | pszValueName,
 |  | LPTSTR | pszValue
 | ) |  |

Definition at line 2811 of file AppUtil.Cpp.

{
  BOOL bOk = FALSE;
  LONG ec;
  HKEY hKey;
  TCHAR szKey[MAX_STRING_LENGTH];

  lstrcpyn(szKey, pszKey, MAX_STRING_LENGTH);

  if (NULL != pszSubkey)
  {
    lstrncat(szKey, TEXT("\\"), MAX_STRING_LENGTH - lstrlen(szKey));
    lstrncat(szKey, pszSubkey, MAX_STRING_LENGTH - lstrlen(szKey));
  }

  ec = RegOpenKeyEx(
         HKEY_CLASSES_ROOT,
         szKey,
         0,
         KEY_ALL_ACCESS,
         &hKey);

  if (NULL != pszValue && ERROR_SUCCESS == ec)
  {
    ec = RegSetValueEx(
           hKey,
           pszValueName,
           0,
           REG_SZ,
           (BYTE *)pszValue,
           (lstrlen(pszValue)+1)*sizeof(TCHAR));
    if (ERROR_SUCCESS == ec)
      bOk = TRUE;
    RegCloseKey(hKey);
  }

  return bOk;
}

HRESULT AnsiToUc | ( | LPSTR | pszAnsi,
 |  | LPWSTR | pszUc,
 |  | int | cch
 | ) |  |

Definition at line 80 of file AppUtil.Cpp.

{
  HRESULT hr = E_POINTER;
  int cOut;

  assert(cch > 0);

  if (NULL != pszAnsi && NULL != pwszUc)
  {
    cOut = MultiByteToWideChar(CP_ACP, 0, pszAnsi, -1, pwszUc, cch);

    if (0 != cOut)
      hr = NOERROR;
    else
      hr = E_FAIL;
  }

  return hr;
}

BOOL CmdExec ( LPTSTR szCmd )

Definition at line 690 of file AppUtil.Cpp.

{
  BOOL bOk;
  STARTUPINFO si;
  PROCESS_INFORMATION pi;

  // Execute the command with a call to the CreateProcess API call.
  memset(&si,0,sizeof(STARTUPINFO));
  si.cb = sizeof(STARTUPINFO);
  si.wShowWindow = SW_SHOW;
  bOk = CreateProcess(NULL,szCmd,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi);
  CloseHandle(pi.hThread);
  CloseHandle(pi.hProcess);

  return bOk;
}

HPALETTE CreateColorScalePalette | ( | HWND | hDC,
 |  | int | nColor
 | ) |  |
BOOL DComOk ( void )

Definition at line 309 of file AppUtil.Cpp.

{
  BOOL bOk = FALSE;

  if (NULL != GetProcAddress(
                GetModuleHandle(TEXT("OLE32")),
                "CoInitializeEx"))
    bOk = TRUE;

  return(bOk);
}

BOOL CALLBACK DialogProc | ( | HWND | hWndDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 1311 of file AppUtil.Cpp.

{
  // Get a pointer to the window class object.
  CVirDialog* pdlg = (CVirDialog*) GetWindowLongPtr(hWndDlg, GWLP_USERDATA);

  switch (uMsg)
  {
    case WM_INITDIALOG:
      // Get a pointer to the window class object.
      pdlg = (CVirDialog*) lParam;

      // Assign the m_hWnd member variable.
      pdlg->m_hWnd = hWndDlg;

      // Set the USERDATA word to point to the class object.
      SetWindowLongPtr(hWndDlg, GWLP_USERDATA, (INT_PTR) pdlg);
      break;

    default:
      break;
  }

  // Call its message proc method.
  if (pdlg != (CVirDialog *) 0)
    return (pdlg->DialogProc(hWndDlg, uMsg, wParam, lParam));
  else
    return (FALSE);
}

BOOL FileExist ( TCHAR * szFileName )

Definition at line 562 of file AppUtil.Cpp.

{
  BOOL bExist = FALSE;
  HANDLE hFile;

  if (NULL != pszFileName)
  {
    // Use the preferred Win32 API call and not the older OpenFile.
    hFile = CreateFile(
              pszFileName,
              GENERIC_READ,
              FILE_SHARE_READ | FILE_SHARE_WRITE,
              NULL,
              OPEN_EXISTING,
              0,
              0);

    if (hFile != INVALID_HANDLE_VALUE)
    {
      // If the handle is valid then the file exists.
      CloseHandle(hFile);
      bExist = TRUE;
    }
  }

  return (bExist);
}

BOOL GetErrorMsg | ( | HRESULT | hr,
 |  | LPTSTR | pszMsg,
 |  | UINT | uiSize
 | ) |  |

Definition at line 725 of file AppUtil.Cpp.

{
  BOOL bErr = FAILED(hr);
  DWORD dwSize;

  if (bErr)
  {
    memset(pszMsg, 0, uiSize * sizeof(TCHAR));

    dwSize = FormatMessage(
      FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM,
      NULL,
      hr,
      MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL),
      pszMsg,
      uiSize,
      NULL);
    if (dwSize>2)
    {
      // Take out the trailing CRLF.
      pszMsg[--dwSize] = 0;
      pszMsg[--dwSize] = 0;
    }
  }

  return bErr;
}

BOOL GetExeName | ( | HINSTANCE | hInst,
 |  | TCHAR * | pszExeName
 | ) |  |

Definition at line 652 of file AppUtil.Cpp.

{
  BOOL bOk = FALSE;
  TCHAR  szPath[MAX_PATH];
  TCHAR  szName[64];
  TCHAR  szFileExt[64];

  if (NULL != pszExeName)
  {
    pszExeName[0] = 0;

    bOk = (0 != GetModuleFileName(hInst, szPath, MAX_PATH));
    if (bOk)
    {
      _tsplitpath(szPath, NULL, NULL, szName, szFileExt);
      lstrcpyn(pszExeName, szName, MAX_PATH);
      lstrncat(pszExeName, szFileExt, MAX_PATH - lstrlen(pszExeName));
    }
  }

  return bOk;
}

void GoWeb | ( | HINSTANCE | hInst,
 |  | LPSTR | pszTarget
 | ) |  |

Definition at line 1012 of file AppUtil.Cpp.

{
  INT_PTR iRes;
  BOOL bOk = FALSE;
  LPTSTR pszNew;
  TCHAR  szNew[MAX_PATH];
  TCHAR  szWork[MAX_PATH];

  szNew[0] = 0;
  pszNew = (LPTSTR) &szNew[0];

#if defined(UNICODE)
  AnsiToUc(pszTarget, pszNew, MAX_PATH);
#else
  lstrcpyn(pszNew, pszTarget, MAX_PATH);
#endif

  if (NULL == pszTarget)
    ReadTutorial(hInst, NULL, NULL);
  else if ('/' == *pszNew)
  {
    lstrcpyn(szWork, TEXT("http:"), MAX_PATH);
    lstrncat(szWork, pszNew, MAX_PATH - lstrlen(szWork));
    pszNew = szWork;
    bOk = TRUE;
  }
  else
  {
    // First check if the .HTM file is there at all.
    bOk = FileExist(pszNew);
    if (!bOk)
    {
      // If the .HTM file doesn't exist the put up an error box.
      iRes = MessageBox(
               NULL,
               TEXT(NOHTM_ERROR_STR),
               TEXT(ERROR_TITLE_STR),
               MB_OK | MB_ICONEXCLAMATION);
    }
  }

  if (bOk)
  {
    // Use shell to invoke web browser on the readme HTML file.
    iRes = (INT_PTR) ShellExecute(NULL, NULL, pszNew, NULL, NULL, 0);
    if (iRes <= 32)
    {
      // If unable to browse then put up an error box.
      HrMsg(NULL, TEXT(NOBROWSE_ERROR_STR), E_FAIL);
    }
  }

  return;
}

void HrMsg | ( | HWND | hWndOwner,
 |  | LPTSTR | pszTitle,
 |  | HRESULT | hr
 | ) |  |

Definition at line 775 of file AppUtil.Cpp.

{
  TCHAR szMsg[MAX_PATH];
  TCHAR szErrMsg[MAX_PATH];
  int iResult;

  wsprintf(szMsg, TEXT("Error=0x%X:\r\n"), hr);
  GetErrorMsg(hr, szErrMsg, MAX_PATH);
  lstrncat(szMsg, szErrMsg, MAX_PATH - lstrlen(szMsg));
  iResult = MessageBox(
              hWndOwner,
              szMsg,
              pszTitle,
              MB_OK | MB_ICONEXCLAMATION);

  return;
}

void HrMsgId | ( | HINSTANCE | hInst,
 |  | HWND | hWndOwner,
 |  | INT | iStringID,
 |  | HRESULT | hr
 | ) |  |

Definition at line 819 of file AppUtil.Cpp.

{
  TCHAR szMsg[MAX_STRING_LENGTH];

  // Load the error message string from the resources.
  if (LoadString(
        hInst,
        iStringID,
        szMsg,
        MAX_STRING_LENGTH))
  {
    // Put up error message box with the retrieved error string message.
    HrMsg(hWndOwner, szMsg, hr);
  }

  return;
}

DWORD lRandom ( void )

Definition at line 332 of file AppUtil.Cpp.

{
  static DWORD glSeed = (DWORD)-365387184;

  glSeed *= 69069;

  return(++glSeed);
}

BOOL MakeFamilyPath | ( | HINSTANCE | hInst,
 |  | TCHAR * | pszNewPath,
 |  | TCHAR * | pszFileExt
 | ) |  |

Definition at line 608 of file AppUtil.Cpp.

{
  BOOL bOk = FALSE;
  TCHAR  szPath[MAX_PATH];
  TCHAR  szDrive[64];
  TCHAR  szDir[MAX_PATH];
  TCHAR  szName[64];

  if (NULL != pszNewPath)
  {
    pszNewPath[0] = 0;

    bOk = (0 != GetModuleFileName(hInst, szPath, MAX_PATH));
    if (bOk)
    {
      _tsplitpath(szPath, szDrive, szDir, szName, NULL);
      lstrcpyn(pszNewPath, szDrive, MAX_PATH);
      lstrncat(pszNewPath, szDir, MAX_PATH - lstrlen(pszNewPath));
      lstrncat(pszNewPath, szName, MAX_PATH - lstrlen(pszNewPath));
      lstrncat(pszNewPath, pszFileExt, MAX_PATH - lstrlen(pszNewPath));
    }
  }

  return bOk;
}

void OutputDebugFmt | ( | LPTSTR | szFmt,
 |  |  | ...
 | ) |  |

Definition at line 1138 of file AppUtil.Cpp.

{
  va_list arglist;
  va_start(arglist, pszFmt);
  TCHAR szMsg[MAX_STRING_LENGTH];

  // Use the format string and arguments to format the content text.
  wvsprintf(szMsg, pszFmt, arglist);
  // Output the newly formated message string to the debugger display.
  OutputDebugString(szMsg);

  return;
}

VOID PaintWindow | ( | HWND | hWnd,
 |  | int | nColor
 | ) |  |

Definition at line 451 of file AppUtil.Cpp.

{
  HDC         hDC;
  int         nMapMode,idx,nSize,nReserved,nLoop;
  RECT        rect;
  HBRUSH      hBrush;
  PAINTSTRUCT ps;
  HPALETTE    hPal;

  if(hDC = BeginPaint(hWnd,&ps))
  {
    GetClientRect(hWnd,&rect);
    nMapMode = SetMapMode(hDC,MM_ANISOTROPIC);

    if(GetDeviceCaps(hDC,RASTERCAPS) & RC_PALETTE)
    {
      nReserved = GetDeviceCaps(hDC,NUMRESERVED);
      nSize     = GetDeviceCaps(hDC,SIZEPALETTE) - nReserved;

      if(hPal = CreateColorScalePalette(hDC,nColor))
      {
        hPal = SelectPalette(hDC,hPal,FALSE);
        RealizePalette(hDC);

        SetWindowExtEx(hDC,nSize,nSize,NULL);
        SetViewportExtEx(hDC,rect.right,-rect.bottom,NULL);
        SetViewportOrgEx(hDC,0,rect.bottom,NULL);

        nLoop = nSize >> 1;
        for(idx=0; idx < nLoop; idx++)
        {
          hBrush = CreateSolidBrush(PALETTEINDEX(idx+nLoop));
          SetRect(&rect,idx,idx,nSize-idx,nSize-idx);
          FillRect(hDC,&rect,hBrush);
          DeleteObject(hBrush);
        }
        DeleteObject(SelectPalette(hDC,hPal,FALSE));
        RealizePalette(hDC);
      }
    }
    else
    {
      SetWindowExtEx(hDC,512,512,NULL);
      SetViewportExtEx(hDC,rect.right,-rect.bottom,NULL);
      SetViewportOrgEx(hDC,0,rect.bottom,NULL);

      for(idx=0; idx < 256; idx++)
      {
        hBrush = CreateSolidBrush(RGB(0,0,idx));
        SetRect(&rect,idx,idx,512-idx,512-idx);
        FillRect(hDC,&rect,hBrush);
        DeleteObject(hBrush);
      }
    }

    SetMapMode(hDC,nMapMode);

    EndPaint(hWnd,&ps);
  }

  return;
}

void ReadHelp | ( | HWND | hWndOwner,
 |  | LPTSTR | pszHelpFile
 | ) |  |

Definition at line 858 of file AppUtil.Cpp.

{
  INT_PTR iRes;

  if (NULL != pszHelpFile)
  {
    // First check if the .HTM help file is there at all.
    if (FileExist(pszHelpFile))
    {
      // Use shell to invoke web browser on the HTML help file.
      iRes = (INT_PTR) ShellExecute(
                     hWndOwner,
                     TEXT("open"),
                     pszHelpFile,
                     NULL,
                     NULL,
                     SW_SHOWNORMAL);
      if (iRes <= 32)
      {
        // If unable to browse then put up an error box.
        HrMsg(hWndOwner, TEXT(NOBROWSE_ERROR_STR), E_FAIL);
      }
    }
    else
    {
      // If the .HTM file doesn't exist the put up an error box.
      iRes = MessageBox(
               hWndOwner,
               TEXT(NOHTM_ERROR_STR),
               TEXT(ERROR_TITLE_STR),
               MB_OK | MB_ICONEXCLAMATION);
    }
  }

  return;
}

void ReadSource | ( | HWND | hWndOwner,
 |  | OPENFILENAME * | pOfn
 | ) |  |

Definition at line 1086 of file AppUtil.Cpp.

{
  TCHAR szReadCmd[MAX_PATH+12];
  TCHAR szFileName[MAX_PATH];
  BOOL bOk;
  int iResult;

  // We'll use the OpenFileName Common Dialog (defined in main app).
  // Set the dialog's file filter and title.
  szFileName[0] = 0;
  pOfn->lpstrFilter = TEXT(OFN_SOURCEFILES_STR);
  pOfn->lpstrTitle = TEXT(OFN_SOURCETITLE_STR);
  pOfn->lpstrFile = szFileName;

  // Call up the dialog to get a file name from the user.
  if (GetOpenFileName(pOfn))
  {
    // If the user provided a file name then assemble a command string
    lstrcpyn(szReadCmd, TEXT(EDITOR_EXE_STR), MAX_PATH+12);
    lstrncat(szReadCmd, szFileName, MAX_PATH+12 - lstrlen(szReadCmd));
    // And execute it.
    bOk = CmdExec(szReadCmd);
    if (!bOk)
    {
      // If create procees failed then put up an error box.
      iResult = MessageBox(
                  hWndOwner,
                  TEXT(NOEDITOR_ERROR_STR),
                  TEXT(ERROR_TITLE_STR),
                  MB_OK | MB_ICONEXCLAMATION);
    }
  }

  return;
}

void ReadTutorial | ( | HINSTANCE | hInst,
 |  | HWND | hWndOwner,
 |  | LPTSTR | pszHTMLFile
 | ) |  |

Definition at line 931 of file AppUtil.Cpp.

{
  TCHAR szFileName[MAX_PATH];

  szFileName[0] = 0;

  if (NULL == pszHTMLFile)
  {
    // Build a path to where the .HTM file should be. It should be in
    // the same directory as the .EXE but with the .HTM extension.
    MakeFamilyPath(hInst, szFileName, TEXT(HTML_FILE_EXT));
  }
  else
  {
    // Use the HTML file specified in a sibling directory.
    BOOL bOk = FALSE;
    TCHAR  szPath[MAX_PATH];
    TCHAR  szDrive[64];
    TCHAR  szDir[MAX_PATH];
    TCHAR  szName[64];
    LPTSTR psz;
    LONG   len;

    bOk = (0 != GetModuleFileName(hInst, szPath, MAX_PATH));
    if (bOk)
    {
      _tsplitpath(szPath, szDrive, szDir, szName, NULL);
      len = lstrlen(szDir);
      if (len > 1)
      {
        // Scan backwards in the Dir path to obtain the path to the
        // parent directory.
        psz = &szDir[0] + len - 1;
        while (psz > &szDir[0])
        {
          psz--;
          if (*psz == '\\' || *psz == '/')
          {
            psz++;
            *psz = 0;
            break;
          }
        }
        // Now build the complete Path & FileName using the Specified
        // HTML file name.
        lstrcpyn(szFileName, szDrive, MAX_PATH);
        lstrncat(szFileName, szDir, MAX_PATH - lstrlen(szFileName));
        if ('.' == *pszHTMLFile)
          lstrncat(szFileName, szName, MAX_PATH - lstrlen(szFileName));
        lstrncat(szFileName, pszHTMLFile, MAX_PATH - lstrlen(szFileName));
      }
    }
  }

  // Now Browse/Read the HTM file.
  ReadHelp(hWndOwner, szFileName);

  return;
}

BOOL SetRegKeyValue | ( | LPTSTR | pszKey,
 |  | LPTSTR | pszSubkey,
 |  | LPTSTR | pszValue
 | ) |  |

Definition at line 2653 of file AppUtil.Cpp.

{
  BOOL bOk = FALSE;
  LONG ec;
  HKEY hKey;
  TCHAR szKey[MAX_STRING_LENGTH];
  DWORD dwRes;
  PSID pEveryoneSID = NULL, pAdminSID = NULL;
  PACL pACL = NULL;
  PSECURITY_DESCRIPTOR pSD = NULL;
  EXPLICIT_ACCESS ea[2];
  SID_IDENTIFIER_AUTHORITY SIDAuthWorld = SECURITY_WORLD_SID_AUTHORITY;
  SID_IDENTIFIER_AUTHORITY SIDAuthNT = SECURITY_NT_AUTHORITY;
  SECURITY_ATTRIBUTES sa;
  LONG lRes;

  lstrcpyn(szKey, pszKey, MAX_STRING_LENGTH);

  if (NULL != pszSubkey)
  {
    lstrncat(szKey, TEXT("\\"), MAX_STRING_LENGTH - lstrlen(szKey));
    lstrncat(szKey, pszSubkey, MAX_STRING_LENGTH - lstrlen(szKey));
  }

  // Create a well-known SID for the Everyone group.
  if(!AllocateAndInitializeSid( &SIDAuthWorld, 1,
    SECURITY_WORLD_RID,
    0, 0, 0, 0, 0, 0, 0,
    &pEveryoneSID))
  {
    goto Cleanup;
  }

  // Initialize an EXPLICIT_ACCESS structure for an ACE.
  // The ACE will allow Everyone read access to the key.
  ZeroMemory(&ea, 2 * sizeof(EXPLICIT_ACCESS));
  ea[0].grfAccessPermissions = KEY_READ;
  ea[0].grfAccessMode = SET_ACCESS;
  ea[0].grfInheritance= NO_INHERITANCE;
  ea[0].Trustee.TrusteeForm = TRUSTEE_IS_SID;
  ea[0].Trustee.TrusteeType = TRUSTEE_IS_WELL_KNOWN_GROUP;
  ea[0].Trustee.ptstrName  = (LPTSTR) pEveryoneSID;

  // Create a SID for the BUILTIN\Administrators group.
  if(!AllocateAndInitializeSid( &SIDAuthNT, 2,
    SECURITY_BUILTIN_DOMAIN_RID,
    DOMAIN_ALIAS_RID_ADMINS,
    0, 0, 0, 0, 0, 0,
    &pAdminSID))
  {
    goto Cleanup;
  }

  // Initialize an EXPLICIT_ACCESS structure for an ACE.
  // The ACE will allow the Administrators group full access to the key.
  ea[1].grfAccessPermissions = KEY_ALL_ACCESS;
  ea[1].grfAccessMode = SET_ACCESS;
  ea[1].grfInheritance= NO_INHERITANCE;
  ea[1].Trustee.TrusteeForm = TRUSTEE_IS_SID;
  ea[1].Trustee.TrusteeType = TRUSTEE_IS_GROUP;
  ea[1].Trustee.ptstrName  = (LPTSTR) pAdminSID;

  // Create a new ACL that contains the new ACEs.
  dwRes = SetEntriesInAcl(2, ea, NULL, &pACL);
  if (ERROR_SUCCESS != dwRes)
  {
    goto Cleanup;
  }

  // Initialize a security descriptor.
  pSD = (PSECURITY_DESCRIPTOR) LocalAlloc(LPTR,
    SECURITY_DESCRIPTOR_MIN_LENGTH);
  if (pSD == NULL)
  {
    goto Cleanup;
  }

  if (!InitializeSecurityDescriptor(pSD, SECURITY_DESCRIPTOR_REVISION))
  {
    goto Cleanup;
  }

  // Add the ACL to the security descriptor.
  if (!SetSecurityDescriptorDacl(pSD,
    TRUE,     // fDaclPresent flag
    pACL,
    FALSE))   // not a default DACL
  {
    goto Cleanup;
  }

  // Initialize a security attributes structure.
  sa.nLength = sizeof (SECURITY_ATTRIBUTES);
  sa.lpSecurityDescriptor = pSD;
  sa.bInheritHandle = FALSE;

  // Use the security attributes to set the security descriptor
  // when you create a key.
  ec = RegCreateKeyEx(
         HKEY_CLASSES_ROOT,
         szKey,
         0,
         NULL,
         REG_OPTION_NON_VOLATILE,
         KEY_READ | KEY_WRITE,
         &sa,
         &hKey,
         NULL);

  if (NULL != pszValue && ERROR_SUCCESS == ec)
  {
    ec = RegSetValueEx(
           hKey,
           NULL,
           0,
           REG_SZ,
           (BYTE *)pszValue,
           (lstrlen(pszValue)+1)*sizeof(TCHAR));
    if (ERROR_SUCCESS == ec)
      bOk = TRUE;
  }

Cleanup:

  if (pEveryoneSID)
    FreeSid(pEveryoneSID);
  if (pAdminSID)
    FreeSid(pAdminSID);
  if (pACL)
    LocalFree(pACL);
  if (pSD)
    LocalFree(pSD);
  if (hKey)
    RegCloseKey(hKey);

  return bOk;
}

LPSTR SkipAnsi | ( | LPSTR | psz,
 |  | BOOL | bSkipWhite
 | ) |  |

Definition at line 531 of file AppUtil.Cpp.

{
  char ch;
  BOOL bWhite;

  while (ch = *psz)
  {
    bWhite = ('\n'==ch || '\r'==ch || '\t'==ch || ' '==ch);

    if ((bSkipWhite && !bWhite) || (!bSkipWhite && bWhite))
      break;

    psz++;
  }

  return psz;
}

HRESULT UcToAnsi | ( | LPWSTR | pwszUc,
 |  | LPSTR | pszAnsi,
 |  | int | cch
 | ) |  |

Definition at line 121 of file AppUtil.Cpp.

{
  HRESULT hr = E_POINTER;
  int cOut;

  assert(cch > 0);

  if (NULL != pszAnsi && NULL != pwszUc)
  {
    cOut = WideCharToMultiByte(CP_ACP, 0, pwszUc, -1, pszAnsi, cch, NULL, NULL);
    if (0 != cOut)
      hr = NOERROR;
    else
      hr = E_FAIL;
  }

  return hr;
}

LRESULT CALLBACK WindowProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 1176 of file AppUtil.Cpp.

{
  // Get a pointer to the window class object.
  CVirWindow* pWin = (CVirWindow*) GetWindowLongPtr(hWnd, GWLP_USERDATA);

  switch (uMsg)
  {
    case WM_NCCREATE:
      // Since this is the first time that we can get ahold of
      // a pointer to the window class object, all messages that might
      // have been sent before this are never seen by the Windows object
      // and only get passed on to the DefWindowProc

      // Get the initial creation pointer to the window object
      pWin = (CVirWindow *) ((CREATESTRUCT *)lParam)->lpCreateParams;

      // Set it's protected m_hWnd member variable to ensure that
      // member functions have access to the correct window handle.
      pWin->m_hWnd = hWnd;

      // Set its USERDATA DWORD to point to the window object
      SetWindowLongPtr(hWnd, GWLP_USERDATA, (INT_PTR) pWin);
      break;

    case WM_DESTROY:
      // This is our signal to destroy the window object.
      SetWindowLongPtr(hWnd, GWLP_USERDATA, 0);
      DELETE_POINTER(pWin);
      break;

    default:
      break;
  }

  // Call its message proc method.
  if (NULL != pWin)
    return (pWin->WindowProc(uMsg, wParam, lParam));
  else
    return (DefWindowProc(hWnd, uMsg, wParam, lParam));
}

Generated on Wed Nov 13 2024 16:53:17 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/AptClien/AptClien.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • AptClien
Functions | Variables

AptClien.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <initguid.h>
#include <commdlg.h>
#include <apputil.h>
#include <micars.h>
#include <carguids.h>
#include "aptclien.h"
#include "utcrucar.h"

Go to the source code of this file.

Functions

BOOL | InitApplication (HINSTANCE hInstance)
BOOL | UnicodeOk (void)
int PASCAL | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

Variables

CMsgLog * | g_pMsgLog = NULL

Function Documentation

BOOL InitApplication ( HINSTANCE hInstance )

Definition at line 1006 of file AptClien.Cpp.

{
  BOOL bOk;
  // The window class for all instances of the main frame window.
  WNDCLASSEX wcf;

  // Assign the appropriate values for this main frame window class.
  wcf.cbSize        = sizeof(WNDCLASSEX);
  wcf.cbClsExtra    = 0;            // No per-class extra data.
  wcf.cbWndExtra    = 0;            // No per-window extra data.
  wcf.hInstance     = hInstance;    // Application module instance.
  wcf.lpfnWndProc   = &WindowProc;  // Global Window Procedure (defined in
                                    // APPUTIL for all CVirWindows).
  wcf.hCursor       = LoadCursor(NULL, IDC_ARROW); // Load app cursor.
  wcf.hIcon         = (HICON) LoadIcon(            // Load app icon.
                                hInstance,
                                TEXT("AppIcon"));
  wcf.hIconSm       = (HICON) LoadImage(           // Load small icon.
                                hInstance,
                                TEXT("AppIcon"),
                                IMAGE_ICON,
                                16, 16,
                                0);
  wcf.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);  // Default backgnd color.
  wcf.style         = CS_HREDRAW | CS_VREDRAW;     // Class style(s).
  wcf.lpszClassName = TEXT(MAIN_WINDOW_CLASS_NAME_STR); // Class name.
  wcf.lpszMenuName  = TEXT(MAIN_WINDOW_CLASS_MENU_STR); // Menu name.

  // Register the window class and return FALSE if unsuccesful.
  bOk = RegisterClassEx(&wcf);

  return (bOk);
}

BOOL UnicodeOk ( void )

Definition at line 978 of file AptClien.Cpp.

{
  BOOL bOk = TRUE;
  TCHAR szUserName[MAX_STRING_LENGTH];
  DWORD dwSize = MAX_STRING_LENGTH;

  if (!GetUserName(szUserName, &dwSize))
    bOk = ERROR_CALL_NOT_IMPLEMENTED == GetLastError() ? FALSE : TRUE;

  return bOk;
}

int PASCAL WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 1065 of file AptClien.Cpp.

{
  CMainWindow* pWin = NULL;
  MSG msg;
  HACCEL hAccel;
  int iRun = FALSE;

  // If we were compiled for UNICODE and the platform seems OK with this
  // then proceed.  Else we error and exit the app.
  if (UnicodeOk())
  {
    // Call to initialize the COM Library.  Use the SUCCEEDED macro
    // to detect success.  If fail then exit app with error message.
    if (SUCCEEDED(CoInitialize(NULL)))
    {
      // If we succeeded in initializing the COM Library we proceed to
      // initialize the application.  If we can't init the application
      // then we signal shut down with an error message exit.
      iRun = InitApplication(hInstance);
      if (iRun)
      {
        // Assume we'll set iRun to TRUE when initialization is done.
        iRun = FALSE;
        // We are still go for running so we try to create a nifty new
        // CMainWindow object for this app instance.
        pWin = new CMainWindow;
        if (NULL != pWin)
        {
          // Now we initialize an instance of the new CMainWindow.
          // This includes creating the main window.
          if (pWin->InitInstance(hInstance, nCmdShow))
          {
            // Load the keyboard accelerators from the resources.
            hAccel = LoadAccelerators(hInstance, TEXT("AppAccel"));
            if (NULL != hAccel)
            {
              // Signal App Initialization is successfully done.
              iRun = TRUE;
            }
          }
        }
      }

      if (iRun)
      {
        // If we initialized the app instance properly then we are still
        // go for running.  We then start up the main message pump for
        // the application.
        while (GetMessage(&msg, NULL, 0, 0))
        {
          if (!TranslateAccelerator(
                 pWin->GetHwnd(),
                 hAccel,
                 &msg))
          {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
          }
        }

        // We ask COM to unload any unused COM Servers.
        CoFreeUnusedLibraries();

        // We'll pass to Windows the reason why we exited the message loop.
        iRun = (int) msg.wParam;
      }
      else
      {
        // We failed to initialize the application. Put up error message
        // box saying that application couldn't be initialized.  Parent
        // window is desktop (ie, NULL). Exit the failed application
        // (ie, by returning FALSE to WinMain).
        ErrorBox(hInstance, NULL, IDS_APPINITFAILED);

        // Delete the CMainWindow object.
        DELETE_POINTER(pWin);
      }

      // We're exiting this app (either normally or by init failure) so
      // shut down the COM Library.
      CoUninitialize();
    }
    else
    {
      // We failed to Initialize the COM Library. Put up error message box
      // saying that COM Library couldn't be initialized.  Parent window
      // is desktop (ie, NULL). Exit the failed application (ie, by
      // returning FALSE to WinMain).
      ErrorBox(hInstance, NULL, IDS_COMINITFAILED);
    }
  }
  else
  {
    // If we were compiled for UNICODE but the platform has problems with
    // this then indicate an error and exit the app immediately.
    CHAR szMsg[MAX_STRING_LENGTH];

    if (LoadStringA(
          hInstance,
          IDS_NOUNICODE,
          szMsg,
          MAX_STRING_LENGTH))
    {
      MessageBoxA(
        NULL,
        szMsg,
        ERROR_TITLE_STR,
        MB_OK | MB_ICONEXCLAMATION);
    }
  }

  return iRun;
}

Variable Documentation

CMsgLog* g_pMsgLog = NULL

Definition at line 89 of file AptClien.Cpp.

Generated on Wed Nov 13 2024 16:53:17 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/AptClien/AptClien.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • AptClien
Defines

AptClien.h File Reference

Go to the source code of this file.

Defines

#define | IDM_CAR_CLUTCH 1103
#define | IDM_CAR_CREATE 1100
#define | IDM_CAR_RELEASE 1101
#define | IDM_CAR_SHIFT 1102
#define | IDM_CAR_SPEED 1104
#define | IDM_CAR_STEER 1105
#define | IDM_CCAR_ADJUST 1307
#define | IDM_CCAR_CLUTCH 1303
#define | IDM_CCAR_CREATE 1300
#define | IDM_CCAR_ENGAGE 1306
#define | IDM_CCAR_RELEASE 1301
#define | IDM_CCAR_SHIFT 1302
#define | IDM_CCAR_SPEED 1304
#define | IDM_CCAR_STEER 1305
#define | IDM_FILE_EXIT 1000
#define | IDM_HELP_ABOUT 1905
#define | IDM_HELP_ABOUTSERVER 1906
#define | IDM_HELP_CONTENTS 1900
#define | IDM_HELP_READSOURCE 1904
#define | IDM_HELP_TUTMARSHAL 1903
#define | IDM_HELP_TUTORIAL 1901
#define | IDM_HELP_TUTSERVER 1902
#define | IDM_LOG_COPYCLIP 1892
#define | IDM_LOG_LOGCLEAR 1890
#define | IDM_LOG_LOGGING 1891
#define | IDM_UCAR_CLUTCH 1203
#define | IDM_UCAR_CREATE 1200
#define | IDM_UCAR_OFFROAD 1206
#define | IDM_UCAR_RELEASE 1201
#define | IDM_UCAR_SHIFT 1202
#define | IDM_UCAR_SPEED 1204
#define | IDM_UCAR_STEER 1205
#define | IDM_UCAR_WINCH 1207
#define | IDM_UCRU_ADJUST 1407
#define | IDM_UCRU_CLUTCH 1403
#define | IDM_UCRU_CREATE 1400
#define | IDM_UCRU_ENGAGE 1406
#define | IDM_UCRU_OFFROAD 1408
#define | IDM_UCRU_RELEASE 1401
#define | IDM_UCRU_SHIFT 1402
#define | IDM_UCRU_SPEED 1404
#define | IDM_UCRU_STEER 1405
#define | IDM_UCRU_WINCH 1409
#define | IDS_APPINITFAILED 2001
#define | IDS_ASSERT_FAIL 2200
#define | IDS_COMINITFAILED 2000
#define | IDS_NOSERVER 2004
#define | IDS_NOTIMPLEMENTED 2301
#define | IDS_NOUNICODE 2003
#define | IDS_OUTOFMEMORY 2002
#define | IDS_START_MESSAGE_LOG 2400
#define | MAIN_WINDOW_CLASS_MENU_STR "APTCLIENMenu"
#define | MAIN_WINDOW_CLASS_NAME_STR "APTCLIENWindow"
#define | MAIN_WINDOW_TITLE_STR "APTCLIEN: Tutorial Code Sample"
#define | MARSHAL_TUTFILE_STR "marshal.htm"
#define | OFN_DEFAULTFILES_STR "All Files (*.*)\0*.*\0"
#define | OFN_DEFAULTTITLE_STR "Open File"
#define | SERVER_TUTFILE_STR "aptserve.htm"
#define | SERVER_WINDOW_TITLE_STR "APTSERVE: Tutorial Code Sample"

Define Documentation

#define IDM_CAR_CLUTCH 1103

Definition at line 115 of file AptClien.h.

#define IDM_CAR_CREATE 1100

Definition at line 112 of file AptClien.h.

#define IDM_CAR_RELEASE 1101

Definition at line 113 of file AptClien.h.

#define IDM_CAR_SHIFT 1102

Definition at line 114 of file AptClien.h.

#define IDM_CAR_SPEED 1104

Definition at line 116 of file AptClien.h.

#define IDM_CAR_STEER 1105

Definition at line 117 of file AptClien.h.

#define IDM_CCAR_ADJUST 1307

Definition at line 137 of file AptClien.h.

#define IDM_CCAR_CLUTCH 1303

Definition at line 133 of file AptClien.h.

#define IDM_CCAR_CREATE 1300

Definition at line 130 of file AptClien.h.

#define IDM_CCAR_ENGAGE 1306

Definition at line 136 of file AptClien.h.

#define IDM_CCAR_RELEASE 1301

Definition at line 131 of file AptClien.h.

#define IDM_CCAR_SHIFT 1302

Definition at line 132 of file AptClien.h.

#define IDM_CCAR_SPEED 1304

Definition at line 134 of file AptClien.h.

#define IDM_CCAR_STEER 1305

Definition at line 135 of file AptClien.h.

#define IDM_FILE_EXIT 1000

Definition at line 109 of file AptClien.h.

#define IDM_HELP_ABOUT 1905

Definition at line 162 of file AptClien.h.

#define IDM_HELP_ABOUTSERVER 1906

Definition at line 163 of file AptClien.h.

#define IDM_HELP_CONTENTS 1900

Definition at line 157 of file AptClien.h.

#define IDM_HELP_READSOURCE 1904

Definition at line 161 of file AptClien.h.

#define IDM_HELP_TUTMARSHAL 1903

Definition at line 160 of file AptClien.h.

#define IDM_HELP_TUTORIAL 1901

Definition at line 158 of file AptClien.h.

#define IDM_HELP_TUTSERVER 1902

Definition at line 159 of file AptClien.h.

#define IDM_LOG_COPYCLIP 1892

Definition at line 154 of file AptClien.h.

#define IDM_LOG_LOGCLEAR 1890

Definition at line 152 of file AptClien.h.

#define IDM_LOG_LOGGING 1891

Definition at line 153 of file AptClien.h.

#define IDM_UCAR_CLUTCH 1203

Definition at line 123 of file AptClien.h.

#define IDM_UCAR_CREATE 1200

Definition at line 120 of file AptClien.h.

#define IDM_UCAR_OFFROAD 1206

Definition at line 126 of file AptClien.h.

#define IDM_UCAR_RELEASE 1201

Definition at line 121 of file AptClien.h.

#define IDM_UCAR_SHIFT 1202

Definition at line 122 of file AptClien.h.

#define IDM_UCAR_SPEED 1204

Definition at line 124 of file AptClien.h.

#define IDM_UCAR_STEER 1205

Definition at line 125 of file AptClien.h.

#define IDM_UCAR_WINCH 1207

Definition at line 127 of file AptClien.h.

#define IDM_UCRU_ADJUST 1407

Definition at line 147 of file AptClien.h.

#define IDM_UCRU_CLUTCH 1403

Definition at line 143 of file AptClien.h.

#define IDM_UCRU_CREATE 1400

Definition at line 140 of file AptClien.h.

#define IDM_UCRU_ENGAGE 1406

Definition at line 146 of file AptClien.h.

#define IDM_UCRU_OFFROAD 1408

Definition at line 148 of file AptClien.h.

#define IDM_UCRU_RELEASE 1401

Definition at line 141 of file AptClien.h.

#define IDM_UCRU_SHIFT 1402

Definition at line 142 of file AptClien.h.

#define IDM_UCRU_SPEED 1404

Definition at line 144 of file AptClien.h.

#define IDM_UCRU_STEER 1405

Definition at line 145 of file AptClien.h.

#define IDM_UCRU_WINCH 1409

Definition at line 149 of file AptClien.h.

#define IDS_APPINITFAILED 2001

Definition at line 167 of file AptClien.h.

#define IDS_ASSERT_FAIL 2200

Definition at line 172 of file AptClien.h.

#define IDS_COMINITFAILED 2000

Definition at line 166 of file AptClien.h.

#define IDS_NOSERVER 2004

Definition at line 170 of file AptClien.h.

#define IDS_NOTIMPLEMENTED 2301

Definition at line 175 of file AptClien.h.

#define IDS_NOUNICODE 2003

Definition at line 169 of file AptClien.h.

#define IDS_OUTOFMEMORY 2002

Definition at line 168 of file AptClien.h.

#define IDS_START_MESSAGE_LOG 2400

Definition at line 178 of file AptClien.h.

#define MAIN_WINDOW_CLASS_MENU_STR "APTCLIENMenu"

Definition at line 97 of file AptClien.h.

#define MAIN_WINDOW_CLASS_NAME_STR "APTCLIENWindow"

Definition at line 96 of file AptClien.h.

#define MAIN_WINDOW_TITLE_STR "APTCLIEN: Tutorial Code Sample"

Definition at line 95 of file AptClien.h.

#define MARSHAL_TUTFILE_STR "marshal.htm"

Definition at line 102 of file AptClien.h.

#define OFN_DEFAULTFILES_STR "All Files (*.*)\0*.*\0"

Definition at line 105 of file AptClien.h.

#define OFN_DEFAULTTITLE_STR "Open File"

Definition at line 106 of file AptClien.h.

#define SERVER_TUTFILE_STR "aptserve.htm"

Definition at line 101 of file AptClien.h.

#define SERVER_WINDOW_TITLE_STR "APTSERVE: Tutorial Code Sample"

Definition at line 98 of file AptClien.h.

Generated on Wed Nov 13 2024 16:53:17 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/AptClien/UTCRUCAR.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • AptClien
Functions

UTCRUCAR.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <apputil.h>
#include <micars.h>
#include <carguids.h>
#include "aptclien.h"
#include "utcrucar.h"

Go to the source code of this file.

Functions

HRESULT CreateUtilityCruiseCar (IUnknown *pUnkOuter, REFIID riid, PPVOID ppv)
STDMETHODIMP_ (ULONG) COUtilityCruiseCar

Function Documentation

HRESULT CreateUtilityCruiseCar | ( | IUnknown * | pUnkOuter,
 |  | REFIID | riid,
 |  | PPVOID | ppv
 | ) |  |

Definition at line 1029 of file UTCRUCAR.Cpp.

{
  HRESULT hr;
  COUtilityCruiseCar* pCob;

  LOGF1("C: CreateUtilityCruiseCar. pUnkOuter=0x%X.",pUnkOuter);

  // If the creation call is requesting aggregation (pUnkOuter != NULL),
  // the COM rules state the IUnknown interface MUST also be concomitantly
  // requested.  If it is not so requested ( riid != IID_IUnknown) then
  // an error must be returned indicating that no aggregate creation of
  // the COUtilityCruiseCar COM Object can be performed using anything
  // other than a controlling IUnknown interface.
  if (NULL != pUnkOuter && riid != IID_IUnknown)
    hr = CLASS_E_NOAGGREGATION;
  else
  {
    // Instantiate a COUtilityCruiseCar COM Object.
    pCob = new COUtilityCruiseCar(pUnkOuter);
    if (NULL != pCob)
    {
      // If we have succeeded in instantiating the COUtilityCruiseCar object
      // we initialize it (with any subordinate COM objects) to offer it's
      // interfaces.
      hr = pCob->Init();
      if (SUCCEEDED(hr))
      {
        // We QueryInterface this new COM Object not only to deposit the
        // main interface pointer to the caller's pointer variable, but to
        // also automatically bump the Reference Count on the new COM
        // Object after handing out this *ppv reference to it.
        hr = pCob->QueryInterface(riid, (PPVOID)ppv);
      }
      else
        DELETE_POINTER(pCob);
    }
    else
      hr = E_OUTOFMEMORY;
  }

  if (SUCCEEDED(hr))
  {
    LOGF1("C: CreateUtilityCruiseCar Succeeded. *ppv=0x%X.",*ppv);
  }
  else
  {
    LOGF1("C: CreateUtilityCruiseCar Failed. hr=0x%X.",hr);
  }

  return hr;
}

STDMETHODIMP_ ( ULONG )

Definition at line 924 of file UTCRUCAR.Cpp.

{
  // Decrement the Interface Reference Count.
  --m_cRefI;

  LOGF1("C: COUtilityCruiseCar::CImpIUtility::Release. Delegating. New cI=%i.", m_cRefI);

  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:17 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/AptClien/UTCRUCAR.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • AptClien

UTCRUCAR.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/AptServe/AptServe.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • AptServe
Functions | Variables

AptServe.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <initguid.h>
#include <apputil.h>
#include <micars.h>
#include <carguids.h>
#include "aptserve.h"
#include "server.h"
#include "factory.h"

Go to the source code of this file.

Functions

BOOL | InitApplication (HINSTANCE hInstance)
BOOL | UnicodeOk (void)
int WINAPI | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

Variables

CSendLog * | g_pMsgLog = NULL
CServer * | g_pServer = NULL

Function Documentation

BOOL InitApplication ( HINSTANCE hInstance )

Definition at line 794 of file AptServe.Cpp.

{
  BOOL bOk;
  // The window class for all instances of the main frame window.
  WNDCLASSEX wcf;

  // Assign the appropriate values for this main frame window class.
  wcf.cbSize        = sizeof(WNDCLASSEX);
  wcf.cbClsExtra    = 0;            // No per-class extra data.
  wcf.cbWndExtra    = 0;            // No per-window extra data.
  wcf.hInstance     = hInstance;    // Application module instance.
  wcf.lpfnWndProc   = &WindowProc;  // Global Window Procedure (defined in
                                    // APPUTIL for all CVirWindows).
  wcf.hCursor       = LoadCursor(NULL, IDC_ARROW); // Load app cursor.
  wcf.hIcon         = (HICON) LoadIcon(            // Load app icon.
                                hInstance,
                                TEXT("AppIcon"));
  wcf.hIconSm       = (HICON) LoadImage(           // Load small icon.
                                hInstance,
                                TEXT("AppIcon"),
                                IMAGE_ICON,
                                16, 16,
                                0);
  wcf.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);  // Default backgnd color.
  wcf.style         = CS_HREDRAW | CS_VREDRAW;     // Class style(s).
  wcf.lpszClassName = TEXT(MAIN_WINDOW_CLASS_NAME_STR); // Class name.
  wcf.lpszMenuName  = TEXT(MAIN_WINDOW_CLASS_MENU_STR); // Menu name.

  // Register the window class and return FALSE if unsuccesful.
  bOk = RegisterClassEx(&wcf);

  return (bOk);
}

BOOL UnicodeOk ( void )

Definition at line 767 of file AptServe.Cpp.

{
  BOOL bOk = TRUE;
  TCHAR szUserName[MAX_STRING_LENGTH];
  DWORD dwSize = MAX_STRING_LENGTH;

  if (!GetUserName(szUserName, &dwSize))
    bOk = ERROR_CALL_NOT_IMPLEMENTED == GetLastError() ? FALSE : TRUE;

  return bOk;
}

int WINAPI WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 851 of file AptServe.Cpp.

{
  CMainWindow* pWin = NULL;
  int iRun = TRUE;
  MSG msg;

  // If we were compiled for UNICODE and the platform seems OK with this
  // then proceed.  Else we error and exit the app.
  if (UnicodeOk())
  {
    // Call to initialize the COM Library.  Use the SUCCEEDED macro
    // to detect success.  If fail then exit app with error message.
    // The default apartment model is assumed and used.
    if (SUCCEEDED(CoInitialize(NULL)))
    {
      // If we succeeded in initializing the COM Library we proceed to
      // initialize the application.  If we can't init the application
      // then we signal shut down with an error message exit.
      iRun = InitApplication(hInstance);
      if (iRun)
      {
        // Assume we'll set iRun to TRUE when initialization is done.
        iRun = FALSE;

        // We are still go for running so we try to create a nifty new
        // CMainWindow object for this app instance.
        pWin = new CMainWindow;
        if (NULL != pWin)
        {
          // Setup the server control object.
          g_pServer = new CServer;
          if (NULL != g_pServer)
          {
            // Assign the server's instance handle.
            g_pServer->m_hInstServer = hInstance;

            // Check command line for switches to register or unregister
            // this server's managed components.   iRun will be set to 2
            // to signal an immediate and quiet exit of this application
            // if such registration or unregistration is requested.
            if (0 == lstrcmpiA(lpCmdLine, "-RegServer")
                || 0 == lstrcmpiA(lpCmdLine, "/RegServer"))
            {
              if (pWin->RegisterServer())
                iRun = 2;
            }
            else if (0 == lstrcmpiA(lpCmdLine, "-UnregServer")
                     || 0 == lstrcmpiA(lpCmdLine, "/UnregServer"))
            {
              if (pWin->UnregisterServer())
                iRun = 2;
            }

            if (FALSE == iRun)
            {
              // If we did not process a command line switch that
              // requires immediate exit, then initialize an instance of
              // the new CMainWindow. This entails creating the main window.
              if (pWin->InitInstance(hInstance, nCmdShow))
              {
                LOGF2("L<%X>: CmdLine Switches= %s",TID,lpCmdLine);
                // Create and register the Class Factories.  But only do so
                // if this application has been launched by COM as indicated
                // by the -Embedding command line switch.
                if (0 == lstrcmpiA(lpCmdLine, "-Embedding")
                    || 0 == lstrcmpiA(lpCmdLine, "/Embedding"))
                  iRun = g_pServer->OpenFactories();
              }
            }
          }
        }
      }

      switch (iRun)
      {
        case TRUE:
          {
            // If we initialized the app instance properly then we are still
            // go for running.  We then start up the main message pump for
            // the application.  The application will normally live hidden
            // as a local server.
            while (GetMessage(&msg, NULL, 0, 0))
            {
              TranslateMessage(&msg);
              DispatchMessage(&msg);
            }

            // We'll pass to the OS the reason why we exited the message
            // loop.
            iRun = (int) msg.wParam;
          }
          break;

        case FALSE:
          // We failed to initialize the application--issue an error
          // messagebox.  Can't initialize or can't run stand-alone.
          ErrorBox(hInstance, NULL, IDS_APPINITFAILED);

          // Delete the CMainWindow object.
          DELETE_POINTER(pWin);

          // Pass the OS an error code of 1.
          iRun = 1;
          break;

        default:
          // Pass the OS an error code of 0.
          iRun = 0;
          break;
      }

      // We're exiting this app (either normally or by init failure) so
      // shut down the COM Library.
      CoUninitialize();
    }
    else
    {
      // We failed to Initialize the COM Library. Put up error message box
      // saying that COM Library couldn't be initialized.  Parent window
      // is desktop (ie, NULL). Exit the failed application (ie, by
      // returning FALSE to WinMain).
      ErrorBox(hInstance, NULL, IDS_COMINITFAILED);
    }
  }
  else
  {
    // If we were compiled for UNICODE but the platform has problems with
    // this then indicate an error and exit the app immediately.
    CHAR szMsg[MAX_STRING_LENGTH];

    if (LoadStringA(
          hInstance,
          IDS_NOUNICODE,
          szMsg,
          MAX_STRING_LENGTH))
    {
      MessageBoxA(
        NULL,
        szMsg,
        ERROR_TITLE_STR,
        MB_OK | MB_ICONEXCLAMATION);
    }
  }

  return iRun;
}

Variable Documentation

CSendLog* g_pMsgLog = NULL

Definition at line 81 of file AptServe.Cpp.

CServer* g_pServer = NULL

Definition at line 78 of file AptServe.Cpp.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/AptServe/AptServe.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • AptServe
Defines

AptServe.h File Reference

Go to the source code of this file.

Defines

#define | CLIENT_WINDOW_TITLE "APTCLIEN: Tutorial Code Sample"
#define | IDM_FILE_EXIT 1000
#define | IDM_HELP_ABOUT 1905
#define | IDM_LOG_COPYCLIP 1891
#define | IDM_LOG_LOGCLEAR 1890
#define | IDS_APPINITFAILED 2001
#define | IDS_ASSERT_FAIL 2200
#define | IDS_COMINITFAILED 2000
#define | IDS_LOGTO_CLIENT 2400
#define | IDS_LOGTO_SERVER 2401
#define | IDS_NOHELPFILE 2003
#define | IDS_NOSERVER 2005
#define | IDS_NOTIMPLEMENTED 2301
#define | IDS_NOUNICODE 2004
#define | IDS_OUTOFMEMORY 2002
#define | MAIN_WINDOW_CLASS_MENU_STR "APTSERVEMenu"
#define | MAIN_WINDOW_CLASS_NAME_STR "APTSERVEWindow"
#define | MAIN_WINDOW_TITLE_STR "APTSERVE: Tutorial Code Sample"

Define Documentation

#define CLIENT_WINDOW_TITLE "APTCLIEN: Tutorial Code Sample"

Definition at line 79 of file AptServe.h.

#define IDM_FILE_EXIT 1000

Definition at line 82 of file AptServe.h.

#define IDM_HELP_ABOUT 1905

Definition at line 89 of file AptServe.h.

#define IDM_LOG_COPYCLIP 1891

Definition at line 86 of file AptServe.h.

#define IDM_LOG_LOGCLEAR 1890

Definition at line 85 of file AptServe.h.

#define IDS_APPINITFAILED 2001

Definition at line 93 of file AptServe.h.

#define IDS_ASSERT_FAIL 2200

Definition at line 99 of file AptServe.h.

#define IDS_COMINITFAILED 2000

Definition at line 92 of file AptServe.h.

#define IDS_LOGTO_CLIENT 2400

Definition at line 105 of file AptServe.h.

#define IDS_LOGTO_SERVER 2401

Definition at line 106 of file AptServe.h.

#define IDS_NOHELPFILE 2003

Definition at line 95 of file AptServe.h.

#define IDS_NOSERVER 2005

Definition at line 97 of file AptServe.h.

#define IDS_NOTIMPLEMENTED 2301

Definition at line 102 of file AptServe.h.

#define IDS_NOUNICODE 2004

Definition at line 96 of file AptServe.h.

#define IDS_OUTOFMEMORY 2002

Definition at line 94 of file AptServe.h.

#define MAIN_WINDOW_CLASS_MENU_STR "APTSERVEMenu"

Definition at line 78 of file AptServe.h.

#define MAIN_WINDOW_CLASS_NAME_STR "APTSERVEWindow"

Definition at line 77 of file AptServe.h.

#define MAIN_WINDOW_TITLE_STR "APTSERVE: Tutorial Code Sample"

Definition at line 76 of file AptServe.h.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/AptServe/CAR.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • AptServe
Functions

CAR.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <apputil.h>
#include <micars.h>
#include <carguids.h>
#include "server.h"
#include "car.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) COCar

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 378 of file CAR.Cpp.

{
  // Decrement the Interface Reference Count.
  --m_cRefI;

  LOGF2("L<%X>: COCar::CImpICar::Release. Delegating. New cI=%i.",TID,m_cRefI);

  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/AptServe/CAR.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • AptServe

CAR.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/AptServe/CRUCAR.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • AptServe
Functions

CRUCAR.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <apputil.h>
#include <micars.h>
#include <carguids.h>
#include "server.h"
#include "car.h"
#include "crucar.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) COCruiseCar

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 705 of file CRUCAR.Cpp.

{
  // Decrement the Interface Reference Count.
  --m_cRefI;

  LOGF2("L<%X>: COCruiseCar::CImpICruise::Release. Delegating. New cI=%i.",TID,m_cRefI);

  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/AptServe/CRUCAR.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • AptServe

CRUCAR.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/AptServe/Factory.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • AptServe
Functions

Factory.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <apputil.h>
#include <micars.h>
#include <carguids.h>
#include "server.h"
#include "factory.h"
#include "car.h"
#include "utilcar.h"
#include "crucar.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CFCar

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 1242 of file Factory.Cpp.

{
  // Decrement the Interface Reference Count.
  InterlockedDecrement((PLONG) &m_cRefI);

  LOGF2("L<%X>: CFCruiseCar::CImpIClassFactory::Release. Delegating. New cI=%i.",TID,m_cRefI);

  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/AptServe/Factory.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • AptServe

Factory.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/AptServe/Server.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • AptServe
Functions

Server.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <process.h>
#include <apputil.h>
#include <micars.h>
#include <carguids.h>
#include "server.h"
#include "factory.h"

Go to the source code of this file.

Functions

unsigned WINAPI | AptThreadProc (LPARAM lparam)
HANDLE | StartThread (PCRTTHREADPROC pThreadProc, LPVOID pInitData, DWORD *pdwThreadId)

Function Documentation

unsigned WINAPI AptThreadProc ( LPARAM lparam )

Definition at line 375 of file Server.Cpp.

{
  HRESULT hr;
  MSG msg;
  DWORD dwCFRegId;
  APT_INIT_DATA* paid = (APT_INIT_DATA*) lparam;

  LOGF1("L: AptThreadProc. Starting Apartment Thread <%X>.",TID);

  // Initialize COM for this apartment thread. Specify new STA.
  hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);

  // Now register the class factory with COM.
  LOGF1("L: AptThreadProc. Registering class factory of apartment <%X>.",TID);
  hr = CoRegisterClassObject(
         paid->rclsid,
         paid->pcf,
         CLSCTX_LOCAL_SERVER,
         REGCLS_MULTIPLEUSE,
         &dwCFRegId);
  LOGERROR("L:CoRegisterClassObject",hr);
  if (SUCCEEDED(hr))
  {
    // Provide a message pump for this thread.
    while (GetMessage(&msg, 0, 0, 0))
      DispatchMessage(&msg);

    LOGF1("L: AptThreadProc. Revoking class factory of apartment <%X>.",TID);
    // Unregister the class factory with COM when the thread dies.
    CoRevokeClassObject(dwCFRegId);
  }
  else
  {
    LOGF2("L<%X>: AptThreadProc. RegisterClass failed. hr=0x%X.",TID,hr);
  }

  // Uninitialize COM in the context of this apartment thread.
  CoUninitialize();

  LOGF1("L: AptThreadProc. Apartment Thread <%X> Terminated.",TID);

  return (int) msg.wParam;
}

HANDLE StartThread | ( | PCRTTHREADPROC | pThreadProc,
 |  | LPVOID | pInitData,
 |  | DWORD * | pdwThreadId
 | ) |  |

Definition at line 343 of file Server.Cpp.

{
  HANDLE hThrd;

  hThrd = (HANDLE) _beginthreadex(
                     0,                       // Default security specified.
                     0,                       // Default stack size.
                     pThreadProc,             // Thread Procedure address.
                     (LPVOID) pInitData,      // Address of Init data.
                     0,                       // Default state (running).
                     (unsigned*)pdwThreadId); // Address of ThreadID Var.

  return hThrd;
}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/AptServe/Server.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • AptServe
Variables

Server.h File Reference

Go to the source code of this file.

Variables

CSendLog * g_pMsgLog
CServer * g_pServer

Variable Documentation

CSendLog* g_pMsgLog

Definition at line 89 of file AptClien.Cpp.

CServer* g_pServer

Definition at line 78 of file AptServe.Cpp.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/AptServe/UtilCAR.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • AptServe
Functions

UtilCAR.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <apputil.h>
#include <micars.h>
#include <carguids.h>
#include "server.h"
#include "car.h"
#include "utilcar.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) COUtilityCar

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 705 of file UtilCAR.Cpp.

{
  // Decrement the Interface Reference Count.
  --m_cRefI;

  LOGF2("L<%X>: COUtilityCar::CImpIUtility::Release. Delegating. New cI=%i.",TID,m_cRefI);

  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/AptServe/UtilCAR.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • AptServe

UtilCAR.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/ComObj/CAR.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • ComObj
Functions

CAR.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <apputil.h>
#include <icars.h>
#include <carguids.h>
#include "comobji.h"
#include "comobj.h"
#include "car.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) COCar

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 354 of file CAR.Cpp.

{
  // Decrement the Interface Reference Count.
  --m_cRefI;

  LOGF1("D: COCar::CImpICar::Release. Delegating. New cI=%i.", m_cRefI);

  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/ComObj/CAR.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • ComObj

CAR.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/ComObj/ComObj.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • ComObj
Defines | Functions | Variables

ComObj.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <initguid.h>
#include <apputil.h>
#include <icars.h>
#include <carguids.h>
#include "comobji.h"
#include "comobj.h"
#include "car.h"
#include "utilcar.h"
#include "crucar.h"

Go to the source code of this file.

Defines

#define | _DLLEXPORT_

Functions

DLLENTRY BOOL WINAPI | ComObjAboutBox (HWND hWnd)
DLLENTRY BOOL WINAPI | ComObjInitMsgLog (CMsgLog *pMsgLog)
DLLENTRY HRESULT WINAPI | CreateCar (IUnknown *pUnkOuter, REFIID riid, PPVOID ppv)
DLLENTRY HRESULT WINAPI | CreateCruiseCar (IUnknown *pUnkOuter, REFIID riid, PPVOID ppv)
DLLENTRY HRESULT WINAPI | CreateUtilityCar (IUnknown *pUnkOuter, REFIID riid, PPVOID ppv)
BOOL WINAPI | DllMain (HINSTANCE hDllInst, DWORD fdwReason, LPVOID lpvReserved)
BOOL | UnicodeOk (void)

Variables

CDllData * g_pDll
CMsgLog * | g_pMsgLog

Define Documentation

#define _DLLEXPORT_

Definition at line 68 of file ComObj.Cpp.

Function Documentation

DLLENTRY BOOL WINAPI ComObjAboutBox ( HWND hWnd )

Definition at line 247 of file ComObj.Cpp.

{
  // Define one of those nifty APPUTIL CAboutBox modal dialog objects.
  CAboutBox dlgAboutBox;

  // Show the standard About Box dialog for this DLL by telling the dialog
  // C++ object to show itself by invoking its ShowDialog method.
  // Pass it this DLL instance and the parent window handle.  Use a dialog
  // resource ID for the dialog stored in this DLL module's resources.
  dlgAboutBox.ShowDialog(
    g_pDll->hDllInst,
    MAKEINTRESOURCE(IDD_ABOUTBOX),
    hWnd);

  return TRUE;
}

DLLENTRY BOOL WINAPI ComObjInitMsgLog ( CMsgLog * pMsgLog )

Definition at line 219 of file ComObj.Cpp.

{
  // Set up a pointer to the host EXE's Message Log facility so that any
  // LOG macros used in this DLL will log to the host EXE's log window.
  g_pMsgLog = pMsgLog;

  LOG("D: --- COMOBJ.DLL now logging ---");

  return TRUE;
}

DLLENTRY HRESULT WINAPI CreateCar | ( | IUnknown * | pUnkOuter,
 |  | REFIID | riid,
 |  | PPVOID | ppv
 | ) |  |

Definition at line 288 of file ComObj.Cpp.

{
  HRESULT hr;
  COCar* pCob;

  LOGF1("D: CreateCar. pUnkOuter=0x%X.",pUnkOuter);

  // If the creation call is requesting aggregation (pUnkOuter != NULL),
  // the COM rules state the IUnknown interface MUST also be concomitantly
  // be requested.  If it is not so requested (riid != IID_IUnknown) then
  // an error must be returned indicating that no aggregate creation of
  // the COCar COM Object can be performed.
  if (NULL != pUnkOuter && riid != IID_IUnknown)
    hr = CLASS_E_NOAGGREGATION;
  else
  {
    // Instantiate a CCar COM Object.
    pCob = new COCar(pUnkOuter);

    // We QueryInterface this new COM Object not only to deposit the
    // requested interface pointer into the caller's pointer variable,
    // but to also automatically bump the Reference Count on the new
    // COM Object after handing out this reference to it.
    if (NULL != pCob)
      hr = pCob->QueryInterface(riid, (PPVOID)ppv);
    else
      hr = E_OUTOFMEMORY;
  }

  if (SUCCEEDED(hr))
    LOGF1("D: CreateCar Succeeded. *ppv=0x%X.",*ppv);

  return hr;
}

DLLENTRY HRESULT WINAPI CreateCruiseCar | ( | IUnknown * | pUnkOuter,
 |  | REFIID | riid,
 |  | PPVOID | ppv
 | ) |  |

Definition at line 428 of file ComObj.Cpp.

{
  HRESULT hr;
  COCruiseCar* pCob;

  LOGF1("D: CreateCruiseCar. pUnkOuter=0x%X.",pUnkOuter);

  // If the creation call is requesting aggregation (pUnkOuter != NULL),
  // the COM rules state the IUnknown interface MUST also be concomitantly
  // be requested.  If it is not so requested (riid != IID_IUnknown) then
  // an error must be returned indicating that no aggregate creation of
  // the COCruiseCar COM Object can be performed.
  if (NULL != pUnkOuter && riid != IID_IUnknown)
    hr = CLASS_E_NOAGGREGATION;
  else
  {
    // Instantiate a COCruiseCar COM Object.
    pCob = new COCruiseCar(pUnkOuter);
    if (NULL != pCob)
    {
      // If we have succeeded in instantiating the COCruiseCar object
      // we initialize it to set up any subordinate objects (ie, via
      // containment or aggregation).
      hr = pCob->Init();
      if (SUCCEEDED(hr))
      {
        // We QueryInterface this new COM Object not only to deposit the
        // requested interface pointer into the caller's pointer variable,
        // but to also automatically bump the Reference Count on the new
        // COM Object after handing out this reference to it.
        hr = pCob->QueryInterface(riid, (PPVOID)ppv);
      }
    }
    else
      hr = E_OUTOFMEMORY;
  }

  if (SUCCEEDED(hr))
    LOGF1("D: CreateCruiseCar Succeeded. *ppv=0x%X.",*ppv);

  return hr;
}

DLLENTRY HRESULT WINAPI CreateUtilityCar | ( | IUnknown * | pUnkOuter,
 |  | REFIID | riid,
 |  | PPVOID | ppv
 | ) |  |

Definition at line 352 of file ComObj.Cpp.

{
  HRESULT hr;
  COUtilityCar* pCob;

  LOGF1("D: CreateUtilityCar. pUnkOuter=0x%X.",pUnkOuter);

  // If the creation call is requesting aggregation (pUnkOuter != NULL),
  // the COM rules state the IUnknown interface MUST also be concomitantly
  // be requested.  If it is not so requested (riid != IID_IUnknown) then
  // an error must be returned indicating that no aggregate creation of
  // the COUtilityCar COM Object can be performed.
  if (NULL != pUnkOuter && riid != IID_IUnknown)
    hr = CLASS_E_NOAGGREGATION;
  else
  {
    // Instantiate a CUtilityCar COM Object.
    pCob = new COUtilityCar(pUnkOuter);
    if (NULL != pCob)
    {
      // If we have succeeded in instantiating the COUtilityCar object
      // we initialize it to set up any subordinate objects (ie, via
      // containment or aggregation).
      hr = pCob->Init();
      if (SUCCEEDED(hr))
      {
        // We QueryInterface this new COM Object not only to deposit the
        // requested interface pointer into the caller's pointer variable,
        // but to also automatically bump the Reference Count on the new
        // COM Object after handing out this reference to it.
        hr = pCob->QueryInterface(riid, (PPVOID)ppv);
      }
    }
    else
      hr = E_OUTOFMEMORY;
  }

  if (SUCCEEDED(hr))
    LOGF1("D: CreateUtilityCar Succeeded. *ppv=0x%X.",*ppv);

  return hr;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hDllInst,
 |  | DWORD | fdwReason,
 |  | LPVOID | lpvReserved
 | ) |  |

Definition at line 144 of file ComObj.Cpp.

{
  BOOL bResult = TRUE;

  // Dispatch this main call based on the reason it was called.
  switch (fdwReason)
  {
    case DLL_PROCESS_ATTACH:
      // The DLL is being loaded for the first time by a given process.
      // Perform per-process initialization here.  If the initialization
      // is successful, return TRUE; if unsuccessful, return FALSE.
      bResult = FALSE;
      if (UnicodeOk())
      {
        // Instantiate a DLL global data encapsulator class.
        g_pDll = new CDllData;
        if (NULL != g_pDll)
        {
          // Remember the DLL Instance handle.
          g_pDll->hDllInst = hDllInst;
          // Create a MsgBox object.
          g_pDll->pMsgBox = new CMsgBox;
          if (NULL != g_pDll->pMsgBox)
            bResult = TRUE;
        }
      }
      break;

    case DLL_PROCESS_DETACH:
      // The DLL is being unloaded by a given process.  Do any
      // per-process clean up here, such as undoing what was done in
      // DLL_PROCESS_ATTACH.  The return value is ignored.
      if (NULL != g_pDll)
      {
        DELETE_POINTER(g_pDll->pMsgBox);
        DELETE_POINTER(g_pDll);
      }
      break;

    case DLL_THREAD_ATTACH:
      // A thread is being created in a process that has already loaded
      // this DLL.  Perform any per-thread initialization here.  The
      // return value is ignored.
      break;

    case DLL_THREAD_DETACH:
      // A thread is exiting cleanly in a process that has already
      // loaded this DLL.  Perform any per-thread clean up here.  The
      // return value is ignored.
      break;

    default:
      break;
  }

  return (bResult);
}

BOOL UnicodeOk ( void )

Definition at line 97 of file ComObj.Cpp.

{
  BOOL bOk = TRUE;
  TCHAR szUserName[MAX_STRING_LENGTH];
  DWORD dwSize = MAX_STRING_LENGTH;

  if (!GetUserName(szUserName, &dwSize))
    bOk = ERROR_CALL_NOT_IMPLEMENTED == GetLastError() ? FALSE : TRUE;

  return bOk;
}

Variable Documentation

CDllData* g_pDll

Definition at line 83 of file ComObj.Cpp.

CMsgLog* g_pMsgLog

Definition at line 79 of file ComObj.Cpp.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/ComObj/ComObj.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • ComObj
Defines | Functions

ComObj.h File Reference

Go to the source code of this file.

Defines

#define | DLLENTRY extern __declspec(dllimport)
#define | STDENTRY DLLENTRY HRESULT WINAPI
#define | STDENTRY_(type) DLLENTRY type WINAPI

Functions

STDENTRY | CreateCar (IUnknown *pUnkOuter, REFIID riid, PPVOID ppv)
STDENTRY | CreateCruiseCar (IUnknown *pUnkOuter, REFIID riid, PPVOID ppv)
STDENTRY | CreateUtilityCar (IUnknown *pUnkOuter, REFIID riid, PPVOID ppv)
STDENTRY_ (BOOL) ComObjInitMsgLog(CMsgLog *pMsgLog)

Define Documentation

#define DLLENTRY extern __declspec(dllimport)

Definition at line 72 of file ComObj.h.

#define STDENTRY DLLENTRY HRESULT WINAPI

Definition at line 77 of file ComObj.h.

#define STDENTRY_ ( type ) DLLENTRY type WINAPI

Definition at line 78 of file ComObj.h.

Function Documentation

STDENTRY CreateCar | ( | IUnknown * | pUnkOuter,
 |  | REFIID | riid,
 |  | PPVOID | ppv
 | ) |  |

Definition at line 288 of file ComObj.Cpp.

{
  HRESULT hr;
  COCar* pCob;

  LOGF1("D: CreateCar. pUnkOuter=0x%X.",pUnkOuter);

  // If the creation call is requesting aggregation (pUnkOuter != NULL),
  // the COM rules state the IUnknown interface MUST also be concomitantly
  // be requested.  If it is not so requested (riid != IID_IUnknown) then
  // an error must be returned indicating that no aggregate creation of
  // the COCar COM Object can be performed.
  if (NULL != pUnkOuter && riid != IID_IUnknown)
    hr = CLASS_E_NOAGGREGATION;
  else
  {
    // Instantiate a CCar COM Object.
    pCob = new COCar(pUnkOuter);

    // We QueryInterface this new COM Object not only to deposit the
    // requested interface pointer into the caller's pointer variable,
    // but to also automatically bump the Reference Count on the new
    // COM Object after handing out this reference to it.
    if (NULL != pCob)
      hr = pCob->QueryInterface(riid, (PPVOID)ppv);
    else
      hr = E_OUTOFMEMORY;
  }

  if (SUCCEEDED(hr))
    LOGF1("D: CreateCar Succeeded. *ppv=0x%X.",*ppv);

  return hr;
}

STDENTRY CreateCruiseCar | ( | IUnknown * | pUnkOuter,
 |  | REFIID | riid,
 |  | PPVOID | ppv
 | ) |  |

Definition at line 428 of file ComObj.Cpp.

{
  HRESULT hr;
  COCruiseCar* pCob;

  LOGF1("D: CreateCruiseCar. pUnkOuter=0x%X.",pUnkOuter);

  // If the creation call is requesting aggregation (pUnkOuter != NULL),
  // the COM rules state the IUnknown interface MUST also be concomitantly
  // be requested.  If it is not so requested (riid != IID_IUnknown) then
  // an error must be returned indicating that no aggregate creation of
  // the COCruiseCar COM Object can be performed.
  if (NULL != pUnkOuter && riid != IID_IUnknown)
    hr = CLASS_E_NOAGGREGATION;
  else
  {
    // Instantiate a COCruiseCar COM Object.
    pCob = new COCruiseCar(pUnkOuter);
    if (NULL != pCob)
    {
      // If we have succeeded in instantiating the COCruiseCar object
      // we initialize it to set up any subordinate objects (ie, via
      // containment or aggregation).
      hr = pCob->Init();
      if (SUCCEEDED(hr))
      {
        // We QueryInterface this new COM Object not only to deposit the
        // requested interface pointer into the caller's pointer variable,
        // but to also automatically bump the Reference Count on the new
        // COM Object after handing out this reference to it.
        hr = pCob->QueryInterface(riid, (PPVOID)ppv);
      }
    }
    else
      hr = E_OUTOFMEMORY;
  }

  if (SUCCEEDED(hr))
    LOGF1("D: CreateCruiseCar Succeeded. *ppv=0x%X.",*ppv);

  return hr;
}

STDENTRY CreateUtilityCar | ( | IUnknown * | pUnkOuter,
 |  | REFIID | riid,
 |  | PPVOID | ppv
 | ) |  |

Definition at line 352 of file ComObj.Cpp.

{
  HRESULT hr;
  COUtilityCar* pCob;

  LOGF1("D: CreateUtilityCar. pUnkOuter=0x%X.",pUnkOuter);

  // If the creation call is requesting aggregation (pUnkOuter != NULL),
  // the COM rules state the IUnknown interface MUST also be concomitantly
  // be requested.  If it is not so requested (riid != IID_IUnknown) then
  // an error must be returned indicating that no aggregate creation of
  // the COUtilityCar COM Object can be performed.
  if (NULL != pUnkOuter && riid != IID_IUnknown)
    hr = CLASS_E_NOAGGREGATION;
  else
  {
    // Instantiate a CUtilityCar COM Object.
    pCob = new COUtilityCar(pUnkOuter);
    if (NULL != pCob)
    {
      // If we have succeeded in instantiating the COUtilityCar object
      // we initialize it to set up any subordinate objects (ie, via
      // containment or aggregation).
      hr = pCob->Init();
      if (SUCCEEDED(hr))
      {
        // We QueryInterface this new COM Object not only to deposit the
        // requested interface pointer into the caller's pointer variable,
        // but to also automatically bump the Reference Count on the new
        // COM Object after handing out this reference to it.
        hr = pCob->QueryInterface(riid, (PPVOID)ppv);
      }
    }
    else
      hr = E_OUTOFMEMORY;
  }

  if (SUCCEEDED(hr))
    LOGF1("D: CreateUtilityCar Succeeded. *ppv=0x%X.",*ppv);

  return hr;
}

STDENTRY_ ( BOOL )

Definition at line 316 of file DllSkel.Cpp.

{
  // Define one of those nifty APPUTIL CAboutBox modal dialog objects.
  CAboutBox dlgAboutBox;

  // Show the standard About Box dialog for this DLL by telling the dialog
  // C++ object to show itself by invoking its ShowDialog method.
  // Pass it this DLL instance and the parent window handle.  Use a dialog
  // resource ID for the dialog stored in this DLL module's resources.
  dlgAboutBox.ShowDialog(
    g_pDll->hDllInst,
    MAKEINTRESOURCE(IDD_ABOUTBOX),
    hWnd);

  return TRUE;
}

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/ComObj/ComObjI.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • ComObj
Classes | Defines | Variables

ComObjI.h File Reference

Go to the source code of this file.

Classes

class | CDllData

Defines

#define | ABOUT_TITLE_STR "COMOBJ: Tutorial Code Sample"
#define | IDD_ABOUTBOX 1000
#define | IDS_ASSERT_FAIL 2200

Variables

CMsgLog * | g_pMsgLog

Define Documentation

#define ABOUT_TITLE_STR "COMOBJ: Tutorial Code Sample"

Definition at line 65 of file ComObjI.h.

#define IDD_ABOUTBOX 1000

Definition at line 68 of file ComObjI.h.

#define IDS_ASSERT_FAIL 2200

Definition at line 71 of file ComObjI.h.

Variable Documentation

CMsgLog* g_pMsgLog

Definition at line 89 of file AptClien.Cpp.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/ComObj/CRUCAR.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • ComObj
Defines | Functions

CRUCAR.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <apputil.h>
#include <icars.h>
#include <carguids.h>
#include "comobji.h"
#include "comobj.h"
#include "car.h"
#include "crucar.h"

Go to the source code of this file.

Defines

#define _LOCALCALLS_

Functions

STDMETHODIMP_ (ULONG) COCruiseCar

Define Documentation

#define _LOCALCALLS_

Definition at line 59 of file CRUCAR.Cpp.

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 407 of file CRUCAR.Cpp.

{
  // Decrement the Interface Reference Count.
  --m_cRefI;

  LOGF1("D: COCruiseCar::CImpICruise::Release. Delegating. New cI=%i.", m_cRefI);

  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/ComObj/CRUCAR.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • ComObj

CRUCAR.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/ComObj/UtilCAR.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • ComObj
Defines | Functions

UtilCAR.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <apputil.h>
#include <icars.h>
#include <carguids.h>
#include "comobji.h"
#include "comobj.h"
#include "car.h"
#include "utilcar.h"

Go to the source code of this file.

Defines

#define _LOCALCALLS_

Functions

STDMETHODIMP_ (ULONG) COUtilityCar

Define Documentation

#define _LOCALCALLS_

Definition at line 59 of file UtilCAR.Cpp.

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 639 of file UtilCAR.Cpp.

{
  // Decrement the Interface Reference Count.
  --m_cRefI;

  LOGF1("D: COUtilityCar::CImpIUtility::Release. Delegating. New cI=%i.", m_cRefI);

  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/ComObj/UtilCAR.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • ComObj

UtilCAR.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/ComUser/ComUser.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • ComUser
Functions | Variables

ComUser.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <initguid.h>
#include <commdlg.h>
#include <apputil.h>
#include <icars.h>
#include <carguids.h>
#include <comobj.h>
#include "comuser.h"
#include "utcrucar.h"

Go to the source code of this file.

Functions

BOOL | InitApplication (HINSTANCE hInstance)
BOOL | UnicodeOk (void)
int PASCAL | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

Variables

CMsgLog * | g_pMsgLog = NULL

Function Documentation

BOOL InitApplication ( HINSTANCE hInstance )

Definition at line 932 of file ComUser.Cpp.

{
  BOOL bOk;
  // The window class for all instances of the main frame window.
  WNDCLASSEX wcf;

  // Assign the appropriate values for this main frame window class.
  wcf.cbSize        = sizeof(WNDCLASSEX);
  wcf.cbClsExtra    = 0;            // No per-class extra data.
  wcf.cbWndExtra    = 0;            // No per-window extra data.
  wcf.hInstance     = hInstance;    // Application module instance.
  wcf.lpfnWndProc   = &WindowProc;  // Global Window Procedure (defined in
                                    // APPUTIL for all CVirWindows).
  wcf.hCursor       = LoadCursor(NULL, IDC_ARROW); // Load app cursor.
  wcf.hIcon         = (HICON) LoadIcon(            // Load app icon.
                                hInstance,
                                TEXT("AppIcon"));
  wcf.hIconSm       = (HICON) LoadImage(           // Load small icon.
                                hInstance,
                                TEXT("AppIcon"),
                                IMAGE_ICON,
                                16, 16,
                                0);
  wcf.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);  // Default backgnd color.
  wcf.style         = CS_HREDRAW | CS_VREDRAW;     // Class style(s).
  wcf.lpszClassName = TEXT(MAIN_WINDOW_CLASS_NAME_STR); // Class name.
  wcf.lpszMenuName  = TEXT(MAIN_WINDOW_CLASS_MENU_STR); // Menu name.

  // Register the window class and return FALSE if unsuccesful.
  bOk = RegisterClassEx(&wcf);

  return (bOk);
}

BOOL UnicodeOk ( void )

Definition at line 906 of file ComUser.Cpp.

{
  BOOL bOk = TRUE;
  TCHAR szUserName[MAX_STRING_LENGTH];
  DWORD dwSize = MAX_STRING_LENGTH;

  if (!GetUserName(szUserName, &dwSize))
    bOk = ERROR_CALL_NOT_IMPLEMENTED == GetLastError() ? FALSE : TRUE;

  return bOk;
}

int PASCAL WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 989 of file ComUser.Cpp.

{
  CMainWindow* pWin = NULL;
  MSG msg;
  HACCEL hAccel;
  int iRun = FALSE;

  // If we were compiled for UNICODE and the platform seems OK with this
  // then proceed.  Else we error and exit the app.
  if (UnicodeOk())
  {
    // Call to initialize the COM Library.  Use the SUCCEEDED macro
    // to detect success.  If fail then exit app with error message.
    if (SUCCEEDED(CoInitialize(NULL)))
    {
      // If we succeeded in initializing the COM Library we proceed to
      // initialize the application.  If we can't init the application
      // then we signal shut down with an error message exit.
      iRun = InitApplication(hInstance);

      if (iRun)
      {
        // Assume we'll set iRun to TRUE when initialization is done.
        iRun = FALSE;
        // We are still go for running so we try to create a nifty new
        // CMainWindow object for this app instance.
        pWin = new CMainWindow;
        if (NULL != pWin)
        {
          // Now we initialize an instance of the new CMainWindow.
          // This includes creating the main window.
          if (pWin->InitInstance(hInstance, nCmdShow))
          {
            // Load the keyboard accelerators from the resources.
            hAccel = LoadAccelerators(hInstance, TEXT("AppAccel"));
            if (NULL != hAccel)
            {
              // Signal App Initialization is successfully done.
              iRun = TRUE;
            }
          }
        }
      }

      if (iRun)
      {
        // If we initialized the app instance properly then we are still
        // go for running.  We then start up the main message pump for
        // the application.
        while (GetMessage(&msg, NULL, 0, 0))
        {
          if (!TranslateAccelerator(
                 pWin->GetHwnd(),
                 hAccel,
                 &msg))
          {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
          }
        }

        // We'll pass to Windows the reason why we exited the message loop.
        iRun = (int) msg.wParam;
      }
      else
      {
        // We failed to initialize the application. Put up error message
        // box saying that application couldn't be initialized.  Parent
        // window is desktop (ie, NULL). Exit the failed application
        // (ie, by returning FALSE to WinMain).
        ErrorBox(hInstance, NULL, IDS_APPINITFAILED);

        // Delete the CMainWindow object.
        DELETE_POINTER(pWin);
      }

      // We're exiting this app (either normally or by init failure) so
      // shut down the COM Library.
      CoUninitialize();
    }
    else
    {
      // We failed to Initialize the COM Library. Put up error message box
      // saying that COM Library couldn't be initialized.  Parent window
      // is desktop (ie, NULL). Exit the failed application (ie, by
      // returning FALSE to WinMain).
      ErrorBox(hInstance, NULL, IDS_COMINITFAILED);
    }
  }
  else
  {
    // If we were compiled for UNICODE but the platform has problems with
    // this then indicate an error and exit the app immediately.
    CHAR szMsg[MAX_STRING_LENGTH];

    if (LoadStringA(
          hInstance,
          IDS_UNICODEFAIL,
          szMsg,
          MAX_STRING_LENGTH))
    {
      MessageBoxA(
        NULL,
        szMsg,
        ERROR_TITLE_STR,
        MB_OK | MB_ICONEXCLAMATION);
    }
  }

  return iRun;
}

Variable Documentation

CMsgLog* g_pMsgLog = NULL

Definition at line 71 of file ComUser.Cpp.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/ComUser/ComUser.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • ComUser
Defines

ComUser.h File Reference

Go to the source code of this file.

Defines

#define | DLL_TUTFILE_STR "comobj.htm"
#define | IDM_CAR_CLUTCH 1103
#define | IDM_CAR_CREATE 1100
#define | IDM_CAR_RELEASE 1101
#define | IDM_CAR_SHIFT 1102
#define | IDM_CAR_SPEED 1104
#define | IDM_CAR_STEER 1105
#define | IDM_CCAR_ADJUST 1307
#define | IDM_CCAR_CLUTCH 1303
#define | IDM_CCAR_CREATE 1300
#define | IDM_CCAR_ENGAGE 1306
#define | IDM_CCAR_RELEASE 1301
#define | IDM_CCAR_SHIFT 1302
#define | IDM_CCAR_SPEED 1304
#define | IDM_CCAR_STEER 1305
#define | IDM_FILE_EXIT 1000
#define | IDM_HELP_ABOUT 1904
#define | IDM_HELP_ABOUTDLL 1905
#define | IDM_HELP_CONTENTS 1900
#define | IDM_HELP_READSOURCE 1903
#define | IDM_HELP_TUTDLL 1902
#define | IDM_HELP_TUTORIAL 1901
#define | IDM_LOG_COPYCLIP 1892
#define | IDM_LOG_LOGCLEAR 1890
#define | IDM_LOG_LOGGING 1891
#define | IDM_UCAR_CLUTCH 1203
#define | IDM_UCAR_CREATE 1200
#define | IDM_UCAR_OFFROAD 1206
#define | IDM_UCAR_RELEASE 1201
#define | IDM_UCAR_SHIFT 1202
#define | IDM_UCAR_SPEED 1204
#define | IDM_UCAR_STEER 1205
#define | IDM_UCAR_WINCH 1207
#define | IDM_UCRU_ADJUST 1407
#define | IDM_UCRU_CLUTCH 1403
#define | IDM_UCRU_CREATE 1400
#define | IDM_UCRU_ENGAGE 1406
#define | IDM_UCRU_OFFROAD 1408
#define | IDM_UCRU_RELEASE 1401
#define | IDM_UCRU_SHIFT 1402
#define | IDM_UCRU_SPEED 1404
#define | IDM_UCRU_STEER 1405
#define | IDM_UCRU_WINCH 1409
#define | IDS_APPINITFAILED 2001
#define | IDS_ASSERT_FAIL 2200
#define | IDS_COMINITFAILED 2000
#define | IDS_NOTIMPLEMENTED 2301
#define | IDS_OUTOFMEMORY 2002
#define | IDS_START_MESSAGE_LOG 2400
#define | IDS_UNICODEFAIL 2003
#define | MAIN_WINDOW_CLASS_MENU_STR "COMUSERMenu"
#define | MAIN_WINDOW_CLASS_NAME_STR "COMUSERWindow"
#define | MAIN_WINDOW_TITLE_STR "COMUSER: Tutorial Code Sample"
#define | OFN_DEFAULTFILES_STR "All Files (*.*)\0*.*\0"
#define | OFN_DEFAULTTITLE_STR "Open File"

Define Documentation

#define DLL_TUTFILE_STR "comobj.htm"

Definition at line 101 of file ComUser.h.

#define IDM_CAR_CLUTCH 1103

Definition at line 114 of file ComUser.h.

#define IDM_CAR_CREATE 1100

Definition at line 111 of file ComUser.h.

#define IDM_CAR_RELEASE 1101

Definition at line 112 of file ComUser.h.

#define IDM_CAR_SHIFT 1102

Definition at line 113 of file ComUser.h.

#define IDM_CAR_SPEED 1104

Definition at line 115 of file ComUser.h.

#define IDM_CAR_STEER 1105

Definition at line 116 of file ComUser.h.

#define IDM_CCAR_ADJUST 1307

Definition at line 136 of file ComUser.h.

#define IDM_CCAR_CLUTCH 1303

Definition at line 132 of file ComUser.h.

#define IDM_CCAR_CREATE 1300

Definition at line 129 of file ComUser.h.

#define IDM_CCAR_ENGAGE 1306

Definition at line 135 of file ComUser.h.

#define IDM_CCAR_RELEASE 1301

Definition at line 130 of file ComUser.h.

#define IDM_CCAR_SHIFT 1302

Definition at line 131 of file ComUser.h.

#define IDM_CCAR_SPEED 1304

Definition at line 133 of file ComUser.h.

#define IDM_CCAR_STEER 1305

Definition at line 134 of file ComUser.h.

#define IDM_FILE_EXIT 1000

Definition at line 108 of file ComUser.h.

#define IDM_HELP_ABOUT 1904

Definition at line 160 of file ComUser.h.

#define IDM_HELP_ABOUTDLL 1905

Definition at line 161 of file ComUser.h.

#define IDM_HELP_CONTENTS 1900

Definition at line 156 of file ComUser.h.

#define IDM_HELP_READSOURCE 1903

Definition at line 159 of file ComUser.h.

#define IDM_HELP_TUTDLL 1902

Definition at line 158 of file ComUser.h.

#define IDM_HELP_TUTORIAL 1901

Definition at line 157 of file ComUser.h.

#define IDM_LOG_COPYCLIP 1892

Definition at line 153 of file ComUser.h.

#define IDM_LOG_LOGCLEAR 1890

Definition at line 151 of file ComUser.h.

#define IDM_LOG_LOGGING 1891

Definition at line 152 of file ComUser.h.

#define IDM_UCAR_CLUTCH 1203

Definition at line 122 of file ComUser.h.

#define IDM_UCAR_CREATE 1200

Definition at line 119 of file ComUser.h.

#define IDM_UCAR_OFFROAD 1206

Definition at line 125 of file ComUser.h.

#define IDM_UCAR_RELEASE 1201

Definition at line 120 of file ComUser.h.

#define IDM_UCAR_SHIFT 1202

Definition at line 121 of file ComUser.h.

#define IDM_UCAR_SPEED 1204

Definition at line 123 of file ComUser.h.

#define IDM_UCAR_STEER 1205

Definition at line 124 of file ComUser.h.

#define IDM_UCAR_WINCH 1207

Definition at line 126 of file ComUser.h.

#define IDM_UCRU_ADJUST 1407

Definition at line 146 of file ComUser.h.

#define IDM_UCRU_CLUTCH 1403

Definition at line 142 of file ComUser.h.

#define IDM_UCRU_CREATE 1400

Definition at line 139 of file ComUser.h.

#define IDM_UCRU_ENGAGE 1406

Definition at line 145 of file ComUser.h.

#define IDM_UCRU_OFFROAD 1408

Definition at line 147 of file ComUser.h.

#define IDM_UCRU_RELEASE 1401

Definition at line 140 of file ComUser.h.

#define IDM_UCRU_SHIFT 1402

Definition at line 141 of file ComUser.h.

#define IDM_UCRU_SPEED 1404

Definition at line 143 of file ComUser.h.

#define IDM_UCRU_STEER 1405

Definition at line 144 of file ComUser.h.

#define IDM_UCRU_WINCH 1409

Definition at line 148 of file ComUser.h.

#define IDS_APPINITFAILED 2001

Definition at line 165 of file ComUser.h.

#define IDS_ASSERT_FAIL 2200

Definition at line 169 of file ComUser.h.

#define IDS_COMINITFAILED 2000

Definition at line 164 of file ComUser.h.

#define IDS_NOTIMPLEMENTED 2301

Definition at line 172 of file ComUser.h.

#define IDS_OUTOFMEMORY 2002

Definition at line 166 of file ComUser.h.

#define IDS_START_MESSAGE_LOG 2400

Definition at line 175 of file ComUser.h.

#define IDS_UNICODEFAIL 2003

Definition at line 167 of file ComUser.h.

#define MAIN_WINDOW_CLASS_MENU_STR "COMUSERMenu"

Definition at line 98 of file ComUser.h.

#define MAIN_WINDOW_CLASS_NAME_STR "COMUSERWindow"

Definition at line 97 of file ComUser.h.

#define MAIN_WINDOW_TITLE_STR "COMUSER: Tutorial Code Sample"

Definition at line 96 of file ComUser.h.

#define OFN_DEFAULTFILES_STR "All Files (*.*)\0*.*\0"

Definition at line 104 of file ComUser.h.

#define OFN_DEFAULTTITLE_STR "Open File"

Definition at line 105 of file ComUser.h.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/ComUser/UTCRUCAR.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • ComUser
Functions

UTCRUCAR.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <apputil.h>
#include <icars.h>
#include <carguids.h>
#include <comobj.h>
#include "comuser.h"
#include "utcrucar.h"

Go to the source code of this file.

Functions

HRESULT CreateUtilityCruiseCar (IUnknown *pUnkOuter, REFIID riid, PPVOID ppv)
STDMETHODIMP_ (ULONG) COUtilityCruiseCar

Function Documentation

HRESULT CreateUtilityCruiseCar | ( | IUnknown * | pUnkOuter,
 |  | REFIID | riid,
 |  | PPVOID | ppv
 | ) |  |

Definition at line 552 of file UTCRUCAR.Cpp.

{
  HRESULT hr;
  COUtilityCruiseCar* pCob;

  LOGF1("E: CreateUtilityCruiseCar. pUnkOuter=0x%X.",pUnkOuter);

  // If the creation call is requesting aggregation (pUnkOuter != NULL),
  // the COM rules state the IUnknown interface MUST also be concomitantly
  // requested.  If it is not so requested ( riid != IID_IUnknown) then
  // an error must be returned indicating that no aggregate creation of
  // the COUtilityCruiseCar COM Object can be performed using anything
  // other than a controlling IUnknown interface.
  if (NULL != pUnkOuter && riid != IID_IUnknown)
    hr = CLASS_E_NOAGGREGATION;
  else
  {
    // Instantiate a COUtilityCruiseCar COM Object.
    pCob = new COUtilityCruiseCar(pUnkOuter);
    if (NULL != pCob)
    {
      // If we have succeeded in instantiating the COUtilityCruiseCar object
      // we initialize it to offer it's interfaces.
      hr = pCob->Init();
      if (SUCCEEDED(hr))
      {
        // We QueryInterface this new COM Object not only to deposit the
        // main interface pointer to the caller's pointer variable, but to
        // also automatically bump the Reference Count on the new COM
        // Object after handing out this *ppv reference to it.
        hr = pCob->QueryInterface(riid, (PPVOID)ppv);
      }
    }
    else
      hr = E_OUTOFMEMORY;
  }

  if (SUCCEEDED(hr))
    LOGF1("E: CreateUtilityCruiseCar Succeeded. *ppv=0x%X.",*ppv);

  return hr;
}

STDMETHODIMP_ ( ULONG )

Definition at line 428 of file UTCRUCAR.Cpp.

{
  // Decrement the Interface Reference Count.
  --m_cRefI;

  LOGF1("E: COUtilityCruiseCar::CImpIUtility::Release. Delegating. New cI=%i.", m_cRefI);

  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:17 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/ComUser/UTCRUCAR.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • ComUser

UTCRUCAR.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/ConClien/ConClien.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • ConClien
Functions

ConClien.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <olectl.h>
#include <initguid.h>
#include <commdlg.h>
#include <apputil.h>
#include <iball.h>
#include <ballguid.h>
#include "guiball.h"
#include "conclien.h"

Go to the source code of this file.

Functions

BOOL | InitApplication (HINSTANCE hInstance)
BOOL | UnicodeOk (void)
int PASCAL | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

Function Documentation

BOOL InitApplication ( HINSTANCE hInstance )

Definition at line 524 of file ConClien.Cpp.

{
  BOOL bOk;
  // The window class for all instances of the main frame window.
  WNDCLASSEX wcf;

  // Assign the appropriate values for this main frame window class.
  wcf.cbSize        = sizeof(WNDCLASSEX);
  wcf.cbClsExtra    = 0;            // No per-class extra data.
  wcf.cbWndExtra    = 0;            // No per-window extra data.
  wcf.hInstance     = hInstance;    // Application module instance.
  wcf.lpfnWndProc   = &WindowProc;  // Global Window Procedure (defined in
                                    // APPUTIL for all CVirWindows).
  wcf.hCursor       = LoadCursor(NULL, IDC_ARROW); // Load app cursor.
  wcf.hIcon         = (HICON) LoadIcon(            // Load app icon.
                                hInstance,
                                TEXT("AppIcon"));
  wcf.hIconSm       = (HICON) LoadImage(           // Load small icon.
                                hInstance,
                                TEXT("AppIcon"),
                                IMAGE_ICON,
                                16, 16,
                                0);
  wcf.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); // Backgnd color.
  wcf.style         = CS_HREDRAW | CS_VREDRAW;     // Class style(s).
  wcf.lpszClassName = TEXT(MAIN_WINDOW_CLASS_NAME_STR); // Class name.
  wcf.lpszMenuName  = TEXT(MAIN_WINDOW_CLASS_MENU_STR); // Menu name.

  // Register the window class and return FALSE if unsuccesful.
  bOk = RegisterClassEx(&wcf);

  return (bOk);
}

BOOL UnicodeOk ( void )

Definition at line 498 of file ConClien.Cpp.

{
  BOOL bOk = TRUE;
  TCHAR szUserName[MAX_STRING_LENGTH];
  DWORD dwSize = MAX_STRING_LENGTH;

  if (!GetUserName(szUserName, &dwSize))
    bOk = ERROR_CALL_NOT_IMPLEMENTED == GetLastError() ? FALSE : TRUE;

  return bOk;
}

int PASCAL WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 581 of file ConClien.Cpp.

{
  CMainWindow* pWin = NULL;
  MSG msg;
  HACCEL hAccel;
  int iRun = FALSE;

  // If we were compiled for UNICODE and the platform seems OK with this
  // then proceed.  Else we error and exit the app.
  if (UnicodeOk())
  {
    // Call to initialize the COM Library.  Use the SUCCEEDED macro
    // to detect success.  If fail then exit app with error message.
    // Tell COM that this client process and all subordinate threads
    // will live in a single-threaded apartment world.
    if (SUCCEEDED(CoInitialize(NULL)))
    {
      // If we succeeded in initializing the COM Library we proceed to
      // initialize the application.  If we can't init the application
      // then we signal shut down with an error message exit.
      iRun = InitApplication(hInstance);
      if (iRun)
      {
        // Assume we'll set iRun to TRUE when initialization is done.
        iRun = FALSE;
        // We are still go for running so we try to create a nifty new
        // CMainWindow object for this app instance.
        pWin = new CMainWindow;
        if (NULL != pWin)
        {
          // Now we initialize an instance of the new CMainWindow.
          // This includes creating the main window.
          if (pWin->InitInstance(hInstance, nCmdShow))
          {
            // Load the keyboard accelerators from the resources.
            hAccel = LoadAccelerators(hInstance, TEXT("AppAccel"));
            if (NULL != hAccel)
            {
              // Signal App Initialization is successfully done.
              iRun = TRUE;
            }
          }
        }
      }

      if (iRun)
      {
        // If we initialized the app instance properly then we are still
        // go for running.  We then start up the main message pump for
        // the application.
        while (GetMessage(&msg, NULL, 0, 0))
        {
          if (!TranslateAccelerator(pWin->GetHwnd(), hAccel, &msg))
          {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
          }
        }

        // We also ask COM to unload any unused COM Servers, including our
        // friend, CONSERVE.
        CoFreeUnusedLibraries();

        // We'll pass to Windows the reason why we exited the message loop.
        iRun = msg.wParam;
      }
      else
      {
        // We failed to initialize the application. Put up error message
        // box saying that application couldn't be initialized.  Parent
        // window is desktop (ie, NULL). Exit the failed application
        // (ie, by returning FALSE to WinMain).
        ErrorBox(hInstance, NULL, IDS_APPINITFAILED);

        // Delete the CMainWindow object.
        DELETE_POINTER(pWin);
      }

      // We're exiting this app (either normally or by init failure) so
      // shut down the COM Library.
      CoUninitialize();
    }
    else
    {
      // We failed to Initialize the COM Library. Put up error message box
      // saying that COM Library couldn't be initialized.  Parent window
      // is desktop (ie, NULL). Exit the failed application (ie, by
      // returning FALSE to WinMain).
      ErrorBox(hInstance, NULL, IDS_COMINITFAILED);
    }
  }
  else
  {
    // If we were compiled for UNICODE but the platform has problems with
    // this then indicate an error and exit the app immediately.
    CHAR szMsg[MAX_STRING_LENGTH];

    if (LoadStringA(
          hInstance,
          IDS_NOUNICODE,
          szMsg,
          MAX_STRING_LENGTH))
    {
      MessageBoxA(
        NULL,
        szMsg,
        ERROR_TITLE_STR,
        MB_OK | MB_ICONEXCLAMATION);
    }
  }

  return iRun;
}

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/ConClien/ConClien.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • ConClien
Defines

ConClien.h File Reference

Go to the source code of this file.

Defines

#define | IDM_FILE_EXIT 1000
#define | IDM_HELP_ABOUT 1905
#define | IDM_HELP_ABOUTSERVER 1906
#define | IDM_HELP_CONTENTS 1900
#define | IDM_HELP_READSOURCE 1904
#define | IDM_HELP_TUTORIAL 1901
#define | IDM_HELP_TUTSERVER 1902
#define | IDM_SOUND_BALL_OFF 1101
#define | IDM_SOUND_BALL_ON 1100
#define | IDS_APPINITFAILED 2001
#define | IDS_ASSERT_FAIL 2200
#define | IDS_COMINITFAILED 2000
#define | IDS_NOSERVER 2004
#define | IDS_NOTIMPLEMENTED 2301
#define | IDS_NOUNICODE 2003
#define | IDS_OUTOFMEMORY 2002
#define | MAIN_WINDOW_CLASS_MENU_STR "CONCLIENMenu"
#define | MAIN_WINDOW_CLASS_NAME_STR "CONCLIENWindow"
#define | MAIN_WINDOW_TITLE_STR "CONCLIEN: Tutorial Code Sample"
#define | OFN_DEFAULTFILES_STR "All Files (*.*)\0*.*\0"
#define | OFN_DEFAULTTITLE_STR "Open File"
#define | SERVER_TUTFILE_STR "conserve.htm"

Define Documentation

#define IDM_FILE_EXIT 1000

Definition at line 94 of file ConClien.h.

#define IDM_HELP_ABOUT 1905

Definition at line 105 of file ConClien.h.

#define IDM_HELP_ABOUTSERVER 1906

Definition at line 106 of file ConClien.h.

#define IDM_HELP_CONTENTS 1900

Definition at line 101 of file ConClien.h.

#define IDM_HELP_READSOURCE 1904

Definition at line 104 of file ConClien.h.

#define IDM_HELP_TUTORIAL 1901

Definition at line 102 of file ConClien.h.

#define IDM_HELP_TUTSERVER 1902

Definition at line 103 of file ConClien.h.

#define IDM_SOUND_BALL_OFF 1101

Definition at line 98 of file ConClien.h.

#define IDM_SOUND_BALL_ON 1100

Definition at line 97 of file ConClien.h.

#define IDS_APPINITFAILED 2001

Definition at line 110 of file ConClien.h.

#define IDS_ASSERT_FAIL 2200

Definition at line 115 of file ConClien.h.

#define IDS_COMINITFAILED 2000

Definition at line 109 of file ConClien.h.

#define IDS_NOSERVER 2004

Definition at line 113 of file ConClien.h.

#define IDS_NOTIMPLEMENTED 2301

Definition at line 118 of file ConClien.h.

#define IDS_NOUNICODE 2003

Definition at line 112 of file ConClien.h.

#define IDS_OUTOFMEMORY 2002

Definition at line 111 of file ConClien.h.

#define MAIN_WINDOW_CLASS_MENU_STR "CONCLIENMenu"

Definition at line 84 of file ConClien.h.

#define MAIN_WINDOW_CLASS_NAME_STR "CONCLIENWindow"

Definition at line 83 of file ConClien.h.

#define MAIN_WINDOW_TITLE_STR "CONCLIEN: Tutorial Code Sample"

Definition at line 82 of file ConClien.h.

#define OFN_DEFAULTFILES_STR "All Files (*.*)\0*.*\0"

Definition at line 90 of file ConClien.h.

#define OFN_DEFAULTTITLE_STR "Open File"

Definition at line 91 of file ConClien.h.

#define SERVER_TUTFILE_STR "conserve.htm"

Definition at line 87 of file ConClien.h.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/ConClien/GUIBALL.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • ConClien

GUIBALL.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <olectl.h>
#include <apputil.h>
#include <iball.h>
#include <ballguid.h>
#include "guiball.h"
#include "sink.h"
#include "conclien.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/ConClien/GUIBALL.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • ConClien

GUIBALL.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/ConClien/SINK.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • ConClien
Functions

SINK.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <olectl.h>
#include <apputil.h>
#include <iball.h>
#include <ballguid.h>
#include "guiball.h"
#include "sink.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) COBallSink

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 349 of file SINK.Cpp.

{
  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/ConClien/SINK.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • ConClien

SINK.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/ConServe/BALL.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • ConServe
Functions

BALL.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <olectl.h>
#include <apputil.h>
#include <iball.h>
#include <ballguid.h>
#include "server.h"
#include "connect.h"
#include "ball.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) COBall

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 1199 of file BALL.Cpp.

{
  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/ConServe/BALL.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • ConServe

BALL.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/ConServe/Connect.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • ConServe
Functions

Connect.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <olectl.h>
#include <apputil.h>
#include <iball.h>
#include <ballguid.h>
#include "server.h"
#include "connect.h"
#include "ball.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) COEnumConnectionPoints

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 1298 of file Connect.Cpp.

{
  ULONG cRefs;

  // Pass this release along to the Host object being enumerated.
  m_pHostObj->Release();

  cRefs = --m_cRefs;

  if (0 == cRefs)
  {
    // We artificially bump the main ref count to prevent reentrancy via
    // the main object destructor.
    m_cRefs++;
    delete this;
  }

  return cRefs;
}

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/ConServe/Connect.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • ConServe

Connect.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/ConServe/ConServe.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • ConServe
Defines | Functions | Variables

ConServe.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <initguid.h>
#include <apputil.h>
#include <iBall.h>
#include <ballguid.h>
#include "conserve.h"
#include "server.h"
#include "factory.h"

Go to the source code of this file.

Defines

#define | _DLLEXPORT_

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, PPVOID ppv)
BOOL WINAPI | DllMain (HINSTANCE hDllInst, DWORD fdwReason, LPVOID lpvReserved)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)
BOOL | UnicodeOk (void)

Variables

CServer * | g_pServer = NULL

Define Documentation

#define _DLLEXPORT_

Definition at line 62 of file ConServe.Cpp.

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 250 of file ConServe.Cpp.

{
  HRESULT hr;

  // We return S_OK of there are no longer any living objects AND
  // there are no outstanding client locks on this server.
  hr = g_pServer->CanUnloadNow();

  return hr;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | PPVOID | ppv
 | ) |  |

Definition at line 209 of file ConServe.Cpp.

{
  HRESULT hr = CLASS_E_CLASSNOTAVAILABLE;
  IUnknown* pCob = NULL;

  if (CLSID_DllSndBall == rclsid)
  {
    hr = E_OUTOFMEMORY;
    pCob = new CFBall(NULL, g_pServer);
  }

  if (NULL != pCob)
  {
    g_pServer->ObjectsUp();
    hr = pCob->QueryInterface(riid, ppv);
    if (FAILED(hr))
    {
      g_pServer->ObjectsDown();
      DELETE_POINTER(pCob);
    }
  }

  return hr;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hDllInst,
 |  | DWORD | fdwReason,
 |  | LPVOID | lpvReserved
 | ) |  |

Definition at line 134 of file ConServe.Cpp.

{
  BOOL bResult = TRUE;

  // Dispatch this main call based on the reason it was called.
  switch (fdwReason)
  {
    case DLL_PROCESS_ATTACH:
      // The DLL is being loaded for the first time by a given process.
      // Perform per-process initialization here.  If the initialization
      // is successful, return TRUE; if unsuccessful, return FALSE.
      bResult = FALSE;
      if (UnicodeOk())
      {
        // Instantiate the CServer utility class.
        g_pServer = new CServer;
        if (NULL != g_pServer)
        {
          // Remember the DLL Instance handle.
          g_pServer->m_hDllInst = hDllInst;
          bResult = TRUE;
        }
      }
      break;

    case DLL_PROCESS_DETACH:
      // The DLL is being unloaded by a given process.  Do any
      // per-process clean up here, such as undoing what was done in
      // DLL_PROCESS_ATTACH.  The return value is ignored.
      DELETE_POINTER(g_pServer);
      break;

    case DLL_THREAD_ATTACH:
      // A thread is being created in a process that has already loaded
      // this DLL.  Perform any per-thread initialization here.  The
      // return value is ignored.
      break;

    case DLL_THREAD_DETACH:
      // A thread is exiting cleanly in a process that has already
      // loaded this DLL.  Perform any per-thread clean up here.  The
      // return value is ignored.
      break;

    default:
      break;
  }

  return (bResult);
}

STDAPI DllRegisterServer ( void )

Definition at line 273 of file ConServe.Cpp.

{
  HRESULT  hr = NOERROR;
  TCHAR    szID[GUID_SIZE+1];
  TCHAR    szCLSID[GUID_SIZE+32];
  TCHAR    szModulePath[MAX_PATH];

  // Obtain the path to this module's executable file for later use.
  GetModuleFileName(
    g_pServer->m_hDllInst,
    szModulePath,
    sizeof(szModulePath)/sizeof(TCHAR));

  /*-------------------------------------------------------------------------
    Create registry entries for the DllSndBall Component.
  -------------------------------------------------------------------------*/
  // Create some base key strings.
  StringFromGUID2(CLSID_DllSndBall, szID, GUID_SIZE);
  lstrcpyn(szCLSID, TEXT("CLSID\\"), sizeof(szCLSID)/sizeof(TCHAR));
  lstrncat(szCLSID, szID, sizeof(szCLSID)/sizeof(TCHAR) - lstrlen(szCLSID));

  // Create ProgID keys.
  SetRegKeyValue(
    TEXT("CTS.DllSndBall.1"),
    NULL,
    TEXT("DllSndBall Component - CONSERVE Code Sample"));
  SetRegKeyValue(
    TEXT("CTS.DllSndBall.1"),
    TEXT("CLSID"),
    szID);

  // Create VersionIndependentProgID keys.
  SetRegKeyValue(
    TEXT("CTS.DllSndBall"),
    NULL,
    TEXT("DllSndBall Component - CONSERVE Code Sample"));
  SetRegKeyValue(
    TEXT("CTS.DllSndBall"),
    TEXT("CurVer"),
    TEXT("CTS.DllSndBall.1"));
  SetRegKeyValue(
    TEXT("CTS.DllSndBall"),
    TEXT("CLSID"),
    szID);

  // Create entries under CLSID.
  SetRegKeyValue(
    szCLSID,
    NULL,
    TEXT("DllSndBall Component - CONSERVE Code Sample"));
  SetRegKeyValue(
    szCLSID,
    TEXT("ProgID"),
    TEXT("CTS.DllSndBall.1"));
  SetRegKeyValue(
    szCLSID,
    TEXT("VersionIndependentProgID"),
    TEXT("CTS.DllSndBall"));
  SetRegKeyValue(
    szCLSID,
    TEXT("NotInsertable"),
    NULL);
  SetRegKeyValue(
    szCLSID,
    TEXT("InprocServer32"),
    szModulePath);
  AddRegNamedValue(
    szCLSID,
    TEXT("InprocServer32"),
    TEXT("ThreadingModel"),
    TEXT("Apartment"));

  return hr;
}

STDAPI DllUnregisterServer ( void )

Definition at line 360 of file ConServe.Cpp.

{
  HRESULT  hr = NOERROR;
  TCHAR    szID[GUID_SIZE+1];
  TCHAR    szCLSID[GUID_SIZE+32];
  TCHAR    szTemp[MAX_PATH+GUID_SIZE];

  /*-------------------------------------------------------------------------
    Delete registry entries for the SndBall Component.
  -------------------------------------------------------------------------*/
  //Create some base key strings.
  StringFromGUID2(CLSID_DllSndBall, szID, GUID_SIZE);
  lstrcpyn(szCLSID, TEXT("CLSID\\"), sizeof(szCLSID)/sizeof(TCHAR));
  lstrncat(szCLSID, szID, sizeof(szCLSID)/sizeof(TCHAR) - lstrlen(szCLSID));

  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.DllSndBall\\CurVer"));
  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.DllSndBall\\CLSID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.DllSndBall"));

  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.DllSndBall.1\\CLSID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.DllSndBall.1"));

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("ProgID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("VersionIndependentProgID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("NotInsertable"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("InprocServer32"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  RegDeleteKey(HKEY_CLASSES_ROOT, szCLSID);

  return hr;
}

BOOL UnicodeOk ( void )

Definition at line 86 of file ConServe.Cpp.

{
  BOOL bOk = TRUE;
  TCHAR szUserName[MAX_STRING_LENGTH];
  DWORD dwSize = MAX_STRING_LENGTH;

  if (!GetUserName(szUserName, &dwSize))
    bOk = ERROR_CALL_NOT_IMPLEMENTED == GetLastError() ? FALSE : TRUE;

  return bOk;
}

Variable Documentation

CServer* g_pServer = NULL

Definition at line 72 of file ConServe.Cpp.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/ConServe/ConServe.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • ConServe
Defines | Functions

ConServe.h File Reference

Go to the source code of this file.

Defines

#define | DLLENTRY extern __declspec(dllimport)
#define | STDENTRY DLLENTRY HRESULT WINAPI
#define | STDENTRY_(type) DLLENTRY type WINAPI

Functions

STDENTRY | DllRegisterServer (void)
STDENTRY | DllUnregisterServer (void)

Define Documentation

#define DLLENTRY extern __declspec(dllimport)

Definition at line 47 of file ConServe.h.

#define STDENTRY DLLENTRY HRESULT WINAPI

Definition at line 49 of file ConServe.h.

#define STDENTRY_ ( type ) DLLENTRY type WINAPI

Definition at line 50 of file ConServe.h.

Function Documentation

STDENTRY DllRegisterServer ( void )

Definition at line 69 of file ComSpyAudit.Cpp.

{
  // registers object, typelib and all interfaces in typelib
  return _Module.RegisterServer(TRUE);
}

STDENTRY DllUnregisterServer ( void )

Definition at line 78 of file ComSpyAudit.Cpp.

{
  _Module.UnregisterServer();
  return S_OK;
}

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/ConServe/Factory.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • ConServe
Functions

Factory.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <olectl.h>
#include <apputil.h>
#include <iball.h>
#include <ballguid.h>
#include "server.h"
#include "factory.h"
#include "connect.h"
#include "ball.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CFBall

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 366 of file Factory.Cpp.

{
  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/ConServe/Factory.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • ConServe

Factory.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/ConServe/Server.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • ConServe

Server.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <apputil.h>
#include "server.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/ConServe/Server.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • ConServe
Defines | Variables

Server.h File Reference

Go to the source code of this file.

Defines

#define IDS_ASSERT_FAIL 2200

Variables

CServer * g_pServer

Define Documentation

#define IDS_ASSERT_FAIL 2200

Definition at line 43 of file Server.h.

Variable Documentation

CServer* g_pServer

Definition at line 78 of file AptServe.Cpp.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/DcdMarsh/PAPINT.Idl File Reference

  • Com
  • Fundamentals
  • TutSamp
  • DcdMarsh
Functions

PAPINT.Idl File Reference

Go to the source code of this file.

Functions

HRESULT | Erase (void)
HRESULT | Erased (void)
HRESULT | GetInk ([in] LONG lIndex,[out] SHORT *pnInkType,[out] SHORT *pnX,[out] SHORT *pnY,[out] SHORT *pnInkWidth,[out] COLORREF *pcrInkColor)
HRESULT | InitPaper ([in, out] RECT *pWinRect,[out] BOOL *pbFirst)
HRESULT | InkDraw ([in] SHORT nX,[in] SHORT nY)
HRESULT | InkStart ([in] SHORT nX,[in] SHORT nY,[in] SHORT nInkWidth,[in] COLORREF crInkColor)
HRESULT | InkStop ([in] SHORT nX,[in] SHORT nY)
HRESULT | Load ([out] RECT *pWinRect)
HRESULT | Loaded (void)
HRESULT | Lock ([in] BOOL bLock)
HRESULT | Locked (void)
HRESULT | Resize ([in] LONG lWidth,[in] LONG lHeight)
HRESULT | Resized ([in] LONG lWidth,[in] LONG lHeight)
HRESULT | Save (void)
HRESULT | Saved (void)
HRESULT | Unlocked (void)

Function Documentation

HRESULT CGuiPaper::Erase ( void )

Definition at line 1474 of file PAPER.Cpp.

{
  HRESULT hr = E_FAIL;
  LONG i;

  if (OwnThis())
  {
    if (m_bLocked)
    {
      if (m_lInkDataEnd > 0 && NULL != m_paInkData)
      {
        // Loop thru the current Ink Data array and mark each
        // item as erased.
        for (i=0; i<m_lInkDataMax; i++)
          m_paInkData[i].nType = INKTYPE_NONE;

        // Reset the Ink Data End index to 0.
        m_lInkDataEnd = 0;
        hr = NOERROR;
      }
    }

    UnOwnThis();
  }

  // Notify all other connected clients of the erase.
  if (SUCCEEDED(hr))
    m_pCO->NotifySinks(PAPER_EVENT_ERASED, 0, 0, 0, 0);

  return hr;
}

STDMETHODIMP COPaperSink::CImpIPaperSink::Erased ( void )

Definition at line 535 of file SINK.Cpp.

{
  HRESULT hr = E_FAIL;

  // Only echo drawing action if we are not the current Master.
  if (!m_pCO->m_pGuiPaper->Master())
    hr = m_pCO->m_pGuiPaper->Erase();

  return hr;
}

STDMETHODIMP COPaper::CImpISharePaper::GetInk | ( | [in] LONG | lIndex,
 |  | [out] SHORT * | pnInkType,
 |  | [out] SHORT * | pnX,
 |  | [out] SHORT * | pnY,
 |  | [out] SHORT * | pnInkWidth,
 |  | [out] COLORREF * | pcrInkColor
 | ) |  |

Definition at line 1431 of file PAPER.Cpp.

{
  HRESULT hr = NOERROR;

  if (OwnThis())
  {
    if (iIndex < m_lInkDataEnd+1)
    {
      *pnInkType = m_paInkData[iIndex].nType;
      *pnX = m_paInkData[iIndex].nX;
      *pnY = m_paInkData[iIndex].nY;
      *pnInkWidth = m_paInkData[iIndex].nWidth;
      *pcrInkColor = m_paInkData[iIndex].crColor;
    }
    else
      hr = E_FAIL;

    UnOwnThis();
  }

  return hr;
}

STDMETHODIMP COPaper::CImpIPaper::InitPaper | ( | [in,out] RECT * | pWinRect,
 |  | [out] BOOL * | pbFirst
 | ) |  |

Definition at line 842 of file PAPER.Cpp.

{
  HRESULT hr = E_FAIL;
  INKDATA* paInkData;
  BOOL bFirst = (NULL == m_paInkData);

  // Tell caller if this is first ink data array instance to Init.
  if (NULL != pbFirst)
    *pbFirst = bFirst;

  if (OwnThis())
  {
    if (bFirst)
    {
      // Build the initial dynamic array of InkData.
      paInkData = new INKDATA[(LONG) INKDATA_ALLOC_INIT];
      if (NULL != paInkData)
      {
        // Zero the array.
        memset(paInkData, 0, INKDATA_ALLOC_INIT * sizeof(INKDATA));

        // Rig this Paper object so that it can use the Ink Data array.
        m_lInkDataMax = INKDATA_ALLOC_INIT;
        m_paInkData = paInkData;

        // Zero the Paper Properties structure. Init the ink data version.
        memset(&m_PaperProperties, 0, sizeof(PAPER_PROPERTIES));
        m_PaperProperties.lInkDataVersion = INKDATA_VERSION10;

        // Register a clipboard format for these COPaper things.
        m_ClipBdFmt = RegisterClipboardFormat(TEXT(CLIPBDFMT_STR));

        // Assign window rect values from master client.
        m_WinRect.left = 0;
        m_WinRect.top = 0;
        m_WinRect.right = pWinRect->right;
        m_WinRect.bottom = pWinRect->bottom;
        m_PaperProperties.WinRect.right = m_WinRect.right;
        m_PaperProperties.WinRect.bottom = m_WinRect.bottom;
        hr = NOERROR;
      }
      else
        hr = E_OUTOFMEMORY;
    }
    else
    {
      // If not the first init, assign slave client's output rect values.
      pWinRect->left = m_WinRect.left = 0;
      pWinRect->top = m_WinRect.top = 0;
      pWinRect->right = m_WinRect.right = m_PaperProperties.WinRect.right;
      pWinRect->bottom = m_WinRect.bottom = m_PaperProperties.WinRect.bottom;
      hr = NOERROR;
    }

    UnOwnThis();
  }

  return hr;
}

STDMETHODIMP COPaperSink::CImpIPaperSink::InkDraw | ( | [in] SHORT | nX,
 |  | [in] SHORT | nY
 | ) |  |

Definition at line 1332 of file PAPER.Cpp.

{
  HRESULT hr = E_FAIL;

  if (OwnThis())
  {
    if (m_bLocked)
    {
      hr = NextSlot();
      if (SUCCEEDED(hr))
      {
        // Add the new item to the Ink Data Array.
        m_paInkData[m_lInkDataEnd].nType = INKTYPE_DRAW;
        m_paInkData[m_lInkDataEnd].nX = nX;
        m_paInkData[m_lInkDataEnd].nY = nY;
        m_paInkData[m_lInkDataEnd].nWidth = m_nInkWidth;
        m_paInkData[m_lInkDataEnd].crColor = m_crInkColor;
        m_pCO->NotifySinks(PAPER_EVENT_INKDRAW, nX, nY, 0, 0);
      }
    }

    UnOwnThis();
  }

  return hr;
}

STDMETHODIMP COPaperSink::CImpIPaperSink::InkStart | ( | [in] SHORT | nX,
 |  | [in] SHORT | nY,
 |  | [in] SHORT | nInkWidth,
 |  | [in] COLORREF | crInkColor
 | ) |  |

Definition at line 1278 of file PAPER.Cpp.

{
  HRESULT hr = E_FAIL;

  if (OwnThis())
  {
    if (m_bLocked)
    {
      hr = NextSlot();
      if (SUCCEEDED(hr))
      {
        // Add the new item to the Ink Data Array.
        m_paInkData[m_lInkDataEnd].nType = INKTYPE_START;
        m_paInkData[m_lInkDataEnd].nX = nX;
        m_paInkData[m_lInkDataEnd].nY = nY;
        m_paInkData[m_lInkDataEnd].nWidth = nInkWidth;
        m_paInkData[m_lInkDataEnd].crColor = crInkColor;
        m_nInkWidth = nInkWidth;
        m_crInkColor = crInkColor;
        m_pCO->NotifySinks(
          PAPER_EVENT_INKSTART,
          nX,
          nY,
          nInkWidth,
          crInkColor);
      }
    }

    UnOwnThis();
  }

  return hr;
}

STDMETHODIMP COPaperSink::CImpIPaperSink::InkStop | ( | [in] SHORT | nX,
 |  | [in] SHORT | nY
 | ) |  |

Definition at line 1377 of file PAPER.Cpp.

{
  HRESULT hr = E_FAIL;

  if (OwnThis())
  {
    if (m_bLocked)
    {
      hr = NextSlot();
      if (SUCCEEDED(hr))
      {
        // Add the new item to the Ink Data Array.
        m_paInkData[m_lInkDataEnd].nType = INKTYPE_STOP;
        m_paInkData[m_lInkDataEnd].nX = nX;
        m_paInkData[m_lInkDataEnd].nY = nY;
        m_paInkData[m_lInkDataEnd].nWidth = m_nInkWidth;
        m_paInkData[m_lInkDataEnd].crColor = m_crInkColor;
        m_pCO->NotifySinks(PAPER_EVENT_INKSTOP, nX, nY, 0, 0);
      }
    }

    UnOwnThis();
  }

  return hr;
}

HRESULT Load ( [out] RECT * pWinRect )
STDMETHODIMP COPaperSink::CImpIPaperSink::Loaded ( void )

Definition at line 397 of file SINK.Cpp.

{
  HRESULT hr;

  // We have been notified that a load was done. Thus, a whole new array
  // of ink data must be displayed in a cleared window of this client.
  m_pCO->m_pGuiPaper->ClearWin();
  hr = m_pCO->m_pGuiPaper->PaintWin();

  return hr;
}

HRESULT Lock ( [in] BOOL bLock )
STDMETHODIMP COPaperSink::CImpIPaperSink::Locked ( void )

Definition at line 354 of file SINK.Cpp.

{
  HRESULT hr = E_NOTIMPL;

  // For future evolution.

  return hr;
}

HRESULT Resize | ( | [in] LONG | lWidth,
 |  | [in] LONG | lHeight
 | ) |  |
STDMETHODIMP COPaperSink::CImpIPaperSink::Resized | ( | [in] LONG | lWidth,
 |  | [in] LONG | lHeight
 | ) |  |

Definition at line 561 of file SINK.Cpp.

{
  HRESULT hr = E_FAIL;

  // Only echo drawing action if we are not the current Master.
  if (!m_pCO->m_pGuiPaper->Master())
    hr = m_pCO->m_pGuiPaper->Resize(lWidth, lHeight);

  return hr;
}

HRESULT Save ( void )
STDMETHODIMP COPaperSink::CImpIPaperSink::Saved ( void )

Definition at line 422 of file SINK.Cpp.

{
  HRESULT hr = E_NOTIMPL;

  // For future evolution.

  return hr;
}

STDMETHODIMP COPaperSink::CImpIPaperSink::Unlocked ( void )

Definition at line 375 of file SINK.Cpp.

{
  HRESULT hr = E_NOTIMPL;

  // For future evolution.

  return hr;
}

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/DcdServe/Connect.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • DcdServe
Functions

Connect.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <olectl.h>
#include <apputil.h>
#include <papint.h>
#include <papguids.h>
#include "server.h"
#include "connect.h"
#include "paper.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) COEnumConnectionPoints

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 1268 of file Connect.Cpp.

{
  ULONG cRefs;

  // Pass this release along to the Host object being enumerated.
  m_pHostObj->Release();

  cRefs = --m_cRefs;

  if (0 == cRefs)
  {
    // We artificially bump the main ref count to prevent reentrancy via
    // the main object destructor.
    m_cRefs++;
    delete this;
  }

  return cRefs;
}

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/DcdServe/Connect.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • DcdServe

Connect.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/DcdServe/DcdServe.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • DcdServe
Functions | Variables

DcdServe.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <initguid.h>
#include <apputil.h>
#include <papint.h>
#include <papguids.h>
#include "dcdserve.h"
#include "server.h"
#include "factory.h"

Go to the source code of this file.

Functions

BOOL | InitApplication (HINSTANCE hInstance)
BOOL | UnicodeOk (void)
int WINAPI | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

Variables

CServer * | g_pServer = NULL

Function Documentation

BOOL InitApplication ( HINSTANCE hInstance )

Definition at line 522 of file DcdServe.Cpp.

{
  BOOL bOk;
  // The window class for all instances of the main frame window.
  WNDCLASSEX wcf;

  // Assign the appropriate values for this main frame window class.
  wcf.cbSize        = sizeof(WNDCLASSEX);
  wcf.cbClsExtra    = 0;            // No per-class extra data.
  wcf.cbWndExtra    = 0;            // No per-window extra data.
  wcf.hInstance     = hInstance;    // Application module instance.
  wcf.lpfnWndProc   = &WindowProc;  // Global Window Procedure (defined in
                                    // APPUTIL for all CVirWindows).
  wcf.hCursor       = LoadCursor(NULL, IDC_ARROW); // Load app cursor.
  wcf.hIcon         = (HICON) LoadIcon(            // Load app icon.
                                hInstance,
                                TEXT("AppIcon"));
  wcf.hIconSm       = (HICON) LoadImage(           // Load small icon.
                                hInstance,
                                TEXT("AppIcon"),
                                IMAGE_ICON,
                                16, 16,
                                0);
  wcf.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);  // Default backgnd color.
  wcf.style         = CS_HREDRAW | CS_VREDRAW;     // Class style(s).
  wcf.lpszClassName = TEXT(MAIN_WINDOW_CLASS_NAME_STR); // Class name.
  wcf.lpszMenuName  = TEXT(MAIN_WINDOW_CLASS_MENU_STR); // Menu name.

  // Register the window class and return FALSE if unsuccesful.
  bOk = RegisterClassEx(&wcf);

  return (bOk);
}

BOOL UnicodeOk ( void )

Definition at line 497 of file DcdServe.Cpp.

{
  BOOL bOk = TRUE;
  TCHAR szUserName[MAX_STRING_LENGTH];
  DWORD dwSize = MAX_STRING_LENGTH;

  if (!GetUserName(szUserName, &dwSize))
    bOk = ERROR_CALL_NOT_IMPLEMENTED == GetLastError() ? FALSE : TRUE;

  return bOk;
}

int WINAPI WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 579 of file DcdServe.Cpp.

{
  CMainWindow* pWin = NULL;
  HRESULT hr;
  int iRun = TRUE;
  MSG msg;

  // If we were compiled for UNICODE and the platform seems OK with this
  // then proceed.  Else we error and exit the app.
  if (UnicodeOk())
  {
    // Ensure that DCOM (Distributed COM) is installed.
    if (DComOk())
    {
      // Call to initialize the COM Library.  Use the SUCCEEDED macro
      // to detect success.  If fail then exit app with error message.
      if (SUCCEEDED(CoInitialize(NULL)))
      {
        // Initialize for server security.
        hr = CoInitializeSecurity(
               NULL,                        //Points to security descriptor
               -1,                          //Count of entries in asAuthSvc
               NULL,                        //Array of names to register
               NULL,                        //Reserved for future use
               RPC_C_AUTHN_LEVEL_NONE,      //Default authentication level
                                            // for proxies
               RPC_C_IMP_LEVEL_IMPERSONATE, //Default impersonation level
                                            // for proxies
               NULL,                        //Reserved; must be set to NULL
               EOAC_NONE,                   //Additional client or
                                            // server-side capabilities
               NULL);                       //Reserved for future use
        if (SUCCEEDED(hr))
        {
          // If we succeeded in initializing the COM Library we proceed to
          // initialize the application.  If we can't init the application
          // then we signal shut down with an error message exit.
          iRun = InitApplication(hInstance);
          if (iRun)
          {
            // Assume we'll set iRun to TRUE when initialization is done.
            iRun = FALSE;

            // We are still go for running so we try to create a nifty new
            // CMainWindow object for this app instance.
            pWin = new CMainWindow;
            if (NULL != pWin)
            {
              // Setup the server control object.
              g_pServer = new CServer;
              if (NULL != g_pServer)
              {
                // Assign the server's instance handle.
                g_pServer->m_hInstServer = hInstance;

                // Check command line for switches to register or unregister
                // this server's managed components.   iRun will be set to 2
                // to signal an immediate and quiet exit of this application
                // if such registration or unregistration is requested.
                if (0 == lstrcmpiA(lpCmdLine, "-RegServer")
                    || 0 == lstrcmpiA(lpCmdLine, "/RegServer"))
                {
                  if (pWin->RegisterServer())
                    iRun = 2;
                }
                else if (0 == lstrcmpiA(lpCmdLine, "-UnregServer")
                         || 0 == lstrcmpiA(lpCmdLine, "/UnregServer"))
                {
                  if (pWin->UnregisterServer())
                    iRun = 2;
                }

                if (FALSE == iRun)
                {
                  // If we did not process a command line switch that
                  // requires immediate exit, then initialize an instance
                  // of the new CMainWindow. This entails creating the main
                  // window.
                  if (pWin->InitInstance(hInstance, nCmdShow))
                  {
                    // Create and register the Class Factories.  But only do
                    // so if this application has been launched by COM as
                    // indicated by the -Embedding command line switch.
                    if (0 == lstrcmpiA(lpCmdLine, "-Embedding")
                        || 0 == lstrcmpiA(lpCmdLine, "/Embedding"))
                      iRun = g_pServer->OpenFactories();
                  }
                }
              }
            }
          }
        }

        switch (iRun)
        {
          case TRUE:
            {
              // If we initialized the app instance properly then we are
              // still go for running. We then start up the main message
              // pump for the application. The application will live hidden
              // as a local server.
              while (GetMessage(&msg, NULL, 0, 0))
              {
                TranslateMessage(&msg);
                DispatchMessage(&msg);
              }

              // We'll pass to the OS the reason why we exited the message
              // loop.
              iRun = (int) msg.wParam;
            }
            break;

          case FALSE:
            // We failed to initialize the application--issue an error
            // messagebox.  Can't initialize or can't run stand-alone.
            ErrorBox(hInstance, NULL, IDS_APPINITFAILED);

            // Delete the CMainWindow object.
            DELETE_POINTER(pWin);

            // Pass the OS an error code of 1.
            iRun = 1;
            break;

          default:
            // Pass the OS an error code of 0.
            iRun = 0;
            break;
        }

        // We're exiting this app (either normally or by init failure) so
        // shut down the COM Library.
        CoUninitialize();
      }
      else
      {
        // We failed to Initialize the COM Library. Put up error message box
        // saying that COM Library couldn't be initialized.  Parent window
        // is desktop (ie, NULL). Exit the failed application (ie, by
        // returning FALSE to WinMain).
        ErrorBox(hInstance, NULL, IDS_COMINITFAILED);
      }
    }
    else
    {
      // If DCOM is not installed indicate an error and
      // exit the app immediately.
      ErrorBox(hInstance, NULL, IDS_NODCOM);
    }
  }
  else
  {
    // If we were compiled for UNICODE but the platform has problems with
    // this then indicate an error and exit the app immediately.
    CHAR szMsg[MAX_STRING_LENGTH];

    if (LoadStringA(
          hInstance,
          IDS_NOUNICODE,
          szMsg,
          MAX_STRING_LENGTH))
    {
      MessageBoxA(
        NULL,
        szMsg,
        ERROR_TITLE_STR,
        MB_OK | MB_ICONEXCLAMATION);
    }
  }

  return iRun;
}

Variable Documentation

CServer* g_pServer = NULL

Definition at line 81 of file DcdServe.Cpp.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/DcdServe/DcdServe.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • DcdServe
Defines

DcdServe.h File Reference

Go to the source code of this file.

Defines

#define | IDM_FILE_EXIT 1000
#define | IDM_HELP_ABOUT 1905
#define | IDS_APPINITFAILED 2001
#define | IDS_ASSERT_FAIL 2200
#define | IDS_COMINITFAILED 2000
#define | IDS_NODCOM 2005
#define | IDS_NOHELPFILE 2003
#define | IDS_NOSERVER 2006
#define | IDS_NOTIMPLEMENTED 2301
#define | IDS_NOUNICODE 2004
#define | IDS_OUTOFMEMORY 2002
#define | MAIN_WINDOW_CLASS_MENU_STR "DCDSERVEMenu"
#define | MAIN_WINDOW_CLASS_NAME_STR "DCDSERVEWindow"
#define | MAIN_WINDOW_TITLE_STR "DCDSERVE: Tutorial Code Sample"

Define Documentation

#define IDM_FILE_EXIT 1000

Definition at line 80 of file DcdServe.h.

#define IDM_HELP_ABOUT 1905

Definition at line 83 of file DcdServe.h.

#define IDS_APPINITFAILED 2001

Definition at line 87 of file DcdServe.h.

#define IDS_ASSERT_FAIL 2200

Definition at line 94 of file DcdServe.h.

#define IDS_COMINITFAILED 2000

Definition at line 86 of file DcdServe.h.

#define IDS_NODCOM 2005

Definition at line 91 of file DcdServe.h.

#define IDS_NOHELPFILE 2003

Definition at line 89 of file DcdServe.h.

#define IDS_NOSERVER 2006

Definition at line 92 of file DcdServe.h.

#define IDS_NOTIMPLEMENTED 2301

Definition at line 97 of file DcdServe.h.

#define IDS_NOUNICODE 2004

Definition at line 90 of file DcdServe.h.

#define IDS_OUTOFMEMORY 2002

Definition at line 88 of file DcdServe.h.

#define MAIN_WINDOW_CLASS_MENU_STR "DCDSERVEMenu"

Definition at line 77 of file DcdServe.h.

#define MAIN_WINDOW_CLASS_NAME_STR "DCDSERVEWindow"

Definition at line 76 of file DcdServe.h.

#define MAIN_WINDOW_TITLE_STR "DCDSERVE: Tutorial Code Sample"

Definition at line 75 of file DcdServe.h.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/DcdServe/Factory.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • DcdServe
Functions

Factory.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <olectl.h>
#include <apputil.h>
#include <papint.h>
#include <papguids.h>
#include "server.h"
#include "factory.h"
#include "connect.h"
#include "paper.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CFPaper

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 375 of file Factory.Cpp.

{
  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/DcdServe/Factory.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • DcdServe

Factory.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/DcdServe/PAPER.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • DcdServe
Functions

PAPER.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <olectl.h>
#include <apputil.h>
#include <papint.h>
#include <papguids.h>
#include "server.h"
#include "connect.h"
#include "paper.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) COPaper

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 818 of file PAPER.Cpp.

{
  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/DcdServe/PAPER.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • DcdServe

PAPER.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/DcdServe/Server.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • DcdServe

Server.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <apputil.h>
#include <papint.h>
#include <papguids.h>
#include "server.h"
#include "factory.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/DcdServe/Server.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • DcdServe
Variables

Server.h File Reference

Go to the source code of this file.

Variables

CServer * g_pServer

Variable Documentation

CServer* g_pServer

Definition at line 78 of file AptServe.Cpp.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/DComDraw/DComDraw.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • DComDraw
Functions | Variables

DComDraw.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <olectl.h>
#include <initguid.h>
#include <commdlg.h>
#include <apputil.h>
#include <papint.h>
#include <papguids.h>
#include "guipaper.h"
#include "dcomdraw.h"

Go to the source code of this file.

Functions

BOOL | InitApplication (HINSTANCE hInstance)
BOOL | UnicodeOk (void)
int PASCAL | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pszCmdLine, int nCmdShow)

Variables

COSERVERINFO | g_ServerInfo
TCHAR | g_szMachineName [MAX_PATH] = TEXT("")
OLECHAR | g_wszMachineName [MAX_PATH]

Function Documentation

BOOL InitApplication ( HINSTANCE hInstance )

Definition at line 686 of file DComDraw.Cpp.

{
  BOOL bOk;
  // The window class for all instances of the main frame window.
  WNDCLASSEX wcf;

  // Assign the appropriate values for this main frame window class.
  wcf.cbSize        = sizeof(WNDCLASSEX);
  wcf.cbClsExtra    = 0;            // No per-class extra data.
  wcf.cbWndExtra    = 0;            // No per-window extra data.
  wcf.hInstance     = hInstance;    // Application module instance.
  wcf.lpfnWndProc   = &WindowProc;  // Global Window Procedure (defined in
                                    // APPUTIL for all CVirWindows).
  wcf.hCursor       = NULL;                        // Load app cursor.
  wcf.hIcon         = (HICON) LoadIcon(            // Load app icon.
                                hInstance,
                                TEXT("AppIcon"));
  wcf.hIconSm       = (HICON) LoadImage(           // Load small icon.
                                hInstance,
                                TEXT("AppIcon"),
                                IMAGE_ICON,
                                16, 16,
                                0);
  wcf.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); // Backgnd color.
  wcf.style         = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; // Class style(s).
  wcf.lpszClassName = TEXT(MAIN_WINDOW_CLASS_NAME_STR);   // Class name.
  wcf.lpszMenuName  = TEXT(MAIN_WINDOW_CLASS_MENU_STR);   // Menu name.

  // Register the window class and return FALSE if unsuccesful.
  bOk = RegisterClassEx(&wcf);

  // Zero the g_ServerInfo structure.
  memset(&g_ServerInfo, 0, sizeof(COSERVERINFO));

  // Init the remote machine name.
  g_wszMachineName[0] = 0;
#ifdef UNICODE
  g_ServerInfo.pwszName = &g_szMachineName[0];
#else
  g_ServerInfo.pwszName = &g_wszMachineName[0];
#endif

  return (bOk);
}

BOOL UnicodeOk ( void )

Definition at line 660 of file DComDraw.Cpp.

{
  BOOL bOk = TRUE;
  TCHAR szUserName[MAX_STRING_LENGTH];
  DWORD dwSize = MAX_STRING_LENGTH;

  if (!GetUserName(szUserName, &dwSize))
    bOk = ERROR_CALL_NOT_IMPLEMENTED == GetLastError() ? FALSE : TRUE;

  return bOk;
}

int PASCAL WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | pszCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 754 of file DComDraw.Cpp.

{
  CMainWindow* pWin = NULL;
  MSG msg;
  HACCEL hAccel;
  HRESULT hr;
  int iRun = FALSE;

  // If we were compiled for UNICODE and the platform seems OK with this
  // then proceed.  Else we error and exit the app.
  if (UnicodeOk())
  {
    // Call to initialize the COM Library.  Use the SUCCEEDED macro
    // to detect success.  If fail then exit app with error message.
    // Tell COM that this client process will use the Single Threaded
    // Apartment model.
    if (SUCCEEDED(CoInitialize(NULL)))
    {
      // Ensure that DCOM (Distributed COM) is installed.
      if (DComOk())
      {
        // Initialize for Client process security. Allow COPaper to
        // call back into the client (ie, the client can impersonate
        // the server identity).
        hr = CoInitializeSecurity(
               NULL,                        //Points to security descriptor
               -1,                          //Count of entries in asAuthSvc
               NULL,                        //Array of names to register
               NULL,                        //Reserved for future use
               RPC_C_AUTHN_LEVEL_NONE,      //Default authentication level
                                            // for proxies
               RPC_C_IMP_LEVEL_IMPERSONATE, //Default impersonation level
                                            // for proxies
               NULL,                        //Reserved; must be set to NULL
               EOAC_NONE,                   //Additional client or
                                            // server-side capabilities
               NULL);                       //Reserved for future use
        if (SUCCEEDED(hr))
        {
          // If we succeeded in initializing the COM Library we proceed to
          // initialize the application.  If we can't init the application
          // then we signal shut down with an error message exit.
          iRun = InitApplication(hInstance);
          if (iRun)
          {
            // Assume we'll set iRun to TRUE when initialization is done.
            iRun = FALSE;
            // We are still go for running so we try to create a nifty new
            // CMainWindow object for this app instance.
            pWin = new CMainWindow;
            if (NULL != pWin)
            {
              // Now we initialize an instance of the new CMainWindow.
              // This includes creating the main window.
              if (pWin->InitInstance(hInstance, pszCmdLine, nCmdShow))
              {
                // Load the keyboard accelerators from the resources.
                hAccel = LoadAccelerators(hInstance, TEXT("AppAccel"));
                if (NULL != hAccel)
                {
                  // Signal App Initialization is successfully done.
                  iRun = TRUE;
                }
              }
            }
          }
        }

        if (iRun)
        {
          // If we initialized the app instance properly then we are still
          // go for running.  We then start up the main message pump for
          // the application.
          while (GetMessage(&msg, NULL, 0, 0))
          {
            if (!TranslateAccelerator(pWin->GetHwnd(), hAccel, &msg))
            {
              TranslateMessage(&msg);
              DispatchMessage(&msg);
            }
          }

          // We also ask COM to unload any unused COM Servers, including our
          // friend, DCDSERVE.
          CoFreeUnusedLibraries();

          // We'll pass to Windows the reason why we exited the message loop.
          iRun = (int) msg.wParam;
        }
        else
        {
          // We failed to initialize the application. Put up error message
          // box saying that application couldn't be initialized.  Parent
          // window is desktop (ie, NULL). Exit the failed application
          // (ie, by returning FALSE to WinMain).
          ErrorBox(hInstance, NULL, IDS_APPINITFAILED);

          // Delete the CMainWindow object.
          DELETE_POINTER(pWin);
        }

        // We're exiting this app (either normally or by init failure) so
        // shut down the COM Library.
        CoUninitialize();
      }
      else
      {
        // If DCOM isn't installed then indicate an error
        // and exit the app immediately.
        ErrorBox(hInstance, NULL, IDS_NODCOM);
      }
    }
    else
    {
      // We failed to Initialize the COM Library. Put up error message
      // box saying that COM Library couldn't be initialized.  Parent
      // window is desktop (ie, NULL). Exit the failed application
      // (ie, by returning FALSE to WinMain).
      ErrorBox(hInstance, NULL, IDS_COMINITFAILED);
    }
  }
  else
  {
    // If we were compiled for UNICODE but the platform has problems with
    // this then indicate an error and exit the app immediately.
    CHAR szMsg[MAX_STRING_LENGTH];

    if (LoadStringA(
          hInstance,
          IDS_NOUNICODE,
          szMsg,
          MAX_STRING_LENGTH))
    {
      MessageBoxA(
        NULL,
        szMsg,
        ERROR_TITLE_STR,
        MB_OK | MB_ICONEXCLAMATION);
    }
  }

  return iRun;
}

Variable Documentation

COSERVERINFO g_ServerInfo

Definition at line 94 of file DComDraw.Cpp.

TCHAR g_szMachineName[MAX_PATH] = TEXT("")

Definition at line 96 of file DComDraw.Cpp.

OLECHAR g_wszMachineName[MAX_PATH]

Definition at line 97 of file DComDraw.Cpp.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/DComDraw/DComDraw.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • DComDraw
Defines | Enumerations

DComDraw.h File Reference

Go to the source code of this file.

Defines

#define | IDC_EDIT_MACHINE 2502
#define | IDC_STATIC_MACHINE 2501
#define | IDD_LOAD_REMOTE 2500
#define | IDM_DRAW_ERASE 1103
#define | IDM_DRAW_MASTER 1100
#define | IDM_DRAW_REDRAW 1102
#define | IDM_DRAW_SLAVE 1101
#define | IDM_FILE_EXIT 1019
#define | IDM_FILE_LOADLOCAL 1001
#define | IDM_FILE_LOADREMOTE 1000
#define | IDM_FILE_SAVE 1002
#define | IDM_HELP_ABOUT 1905
#define | IDM_HELP_CONTENTS 1900
#define | IDM_HELP_READSOURCE 1904
#define | IDM_HELP_TUTMARSH 1903
#define | IDM_HELP_TUTORIAL 1901
#define | IDM_HELP_TUTSERVER 1902
#define | IDM_PEN_COLOR 1200
#define | IDM_PEN_MEDIUM 1202
#define | IDM_PEN_THICK 1203
#define | IDM_PEN_THIN 1201
#define | IDS_APPINITFAILED 2001
#define | IDS_ASK_SAVE 2301
#define | IDS_ASSERT_FAIL 2200
#define | IDS_COMINITFAILED 2000
#define | IDS_DRAWING_CHANGED 2300
#define | IDS_NODCOM 2004
#define | IDS_NOSERVER 2005
#define | IDS_NOTIMPLEMENTED 2006
#define | IDS_NOUNICODE 2003
#define | IDS_OUTOFMEMORY 2002
#define | LOCAL_CREATE_ERR_STR "Local Object Creation"
#define | MAIN_APP_NAME_STR "DCOMDRAW: "
#define | MAIN_WINDOW_CLASS_MENU_STR "DCOMDRAWMenu"
#define | MAIN_WINDOW_CLASS_NAME_STR "DCOMDRAWWindow"
#define | MAIN_WINDOW_MASTER_STR "DCOMDRAW: Shared Drawing [***TALK***]"
#define | MAIN_WINDOW_SLAVE_STR "DCOMDRAW: Shared Drawing [LISTEN]"
#define | MAIN_WINDOW_TITLE_STR "DCOMDRAW: Shared Drawing"
#define | MARSHAL_TUTFILE_STR "dcdmarsh.htm"
#define | OFN_DEFAULTFILES_STR "All Files (*.*)\0*.*\0"
#define | OFN_DEFAULTTITLE_STR "Open File"
#define | PENCUR_MEDIUM 4
#define | PENCUR_OFF 0
#define | PENCUR_ON 1
#define | PENCUR_THICK 8
#define | PENCUR_THIN 2
#define | REMOTE_CREATE_ERR_STR "Remote Object Creation"
#define | SERVER_TUTFILE_STR "dcdserve.htm"

Enumerations

enum | { INK_THIN = 2, INK_MEDIUM = 10, INK_THICK = 20 }

Define Documentation

#define IDC_EDIT_MACHINE 2502

Definition at line 179 of file DComDraw.h.

#define IDC_STATIC_MACHINE 2501

Definition at line 178 of file DComDraw.h.

#define IDD_LOAD_REMOTE 2500

Definition at line 177 of file DComDraw.h.

#define IDM_DRAW_ERASE 1103

Definition at line 145 of file DComDraw.h.

#define IDM_DRAW_MASTER 1100

Definition at line 142 of file DComDraw.h.

#define IDM_DRAW_REDRAW 1102

Definition at line 144 of file DComDraw.h.

#define IDM_DRAW_SLAVE 1101

Definition at line 143 of file DComDraw.h.

#define IDM_FILE_EXIT 1019

Definition at line 139 of file DComDraw.h.

#define IDM_FILE_LOADLOCAL 1001

Definition at line 137 of file DComDraw.h.

#define IDM_FILE_LOADREMOTE 1000

Definition at line 136 of file DComDraw.h.

#define IDM_FILE_SAVE 1002

Definition at line 138 of file DComDraw.h.

#define IDM_HELP_ABOUT 1905

Definition at line 159 of file DComDraw.h.

#define IDM_HELP_CONTENTS 1900

Definition at line 154 of file DComDraw.h.

#define IDM_HELP_READSOURCE 1904

Definition at line 158 of file DComDraw.h.

#define IDM_HELP_TUTMARSH 1903

Definition at line 157 of file DComDraw.h.

#define IDM_HELP_TUTORIAL 1901

Definition at line 155 of file DComDraw.h.

#define IDM_HELP_TUTSERVER 1902

Definition at line 156 of file DComDraw.h.

#define IDM_PEN_COLOR 1200

Definition at line 148 of file DComDraw.h.

#define IDM_PEN_MEDIUM 1202

Definition at line 150 of file DComDraw.h.

#define IDM_PEN_THICK 1203

Definition at line 151 of file DComDraw.h.

#define IDM_PEN_THIN 1201

Definition at line 149 of file DComDraw.h.

#define IDS_APPINITFAILED 2001

Definition at line 163 of file DComDraw.h.

#define IDS_ASK_SAVE 2301

Definition at line 174 of file DComDraw.h.

#define IDS_ASSERT_FAIL 2200

Definition at line 170 of file DComDraw.h.

#define IDS_COMINITFAILED 2000

Definition at line 162 of file DComDraw.h.

#define IDS_DRAWING_CHANGED 2300

Definition at line 173 of file DComDraw.h.

#define IDS_NODCOM 2004

Definition at line 166 of file DComDraw.h.

#define IDS_NOSERVER 2005

Definition at line 167 of file DComDraw.h.

#define IDS_NOTIMPLEMENTED 2006

Definition at line 168 of file DComDraw.h.

#define IDS_NOUNICODE 2003

Definition at line 165 of file DComDraw.h.

#define IDS_OUTOFMEMORY 2002

Definition at line 164 of file DComDraw.h.

#define LOCAL_CREATE_ERR_STR "Local Object Creation"

Definition at line 117 of file DComDraw.h.

#define MAIN_APP_NAME_STR "DCOMDRAW: "

Definition at line 100 of file DComDraw.h.

#define MAIN_WINDOW_CLASS_MENU_STR "DCOMDRAWMenu"

Definition at line 105 of file DComDraw.h.

#define MAIN_WINDOW_CLASS_NAME_STR "DCOMDRAWWindow"

Definition at line 104 of file DComDraw.h.

#define MAIN_WINDOW_MASTER_STR "DCOMDRAW: Shared Drawing [***TALK***]"

Definition at line 102 of file DComDraw.h.

#define MAIN_WINDOW_SLAVE_STR "DCOMDRAW: Shared Drawing [LISTEN]"

Definition at line 103 of file DComDraw.h.

#define MAIN_WINDOW_TITLE_STR "DCOMDRAW: Shared Drawing"

Definition at line 101 of file DComDraw.h.

#define MARSHAL_TUTFILE_STR "dcdmarsh.htm"

Definition at line 109 of file DComDraw.h.

#define OFN_DEFAULTFILES_STR "All Files (*.*)\0*.*\0"

Definition at line 112 of file DComDraw.h.

#define OFN_DEFAULTTITLE_STR "Open File"

Definition at line 113 of file DComDraw.h.

#define PENCUR_MEDIUM 4

Definition at line 131 of file DComDraw.h.

#define PENCUR_OFF 0

Definition at line 128 of file DComDraw.h.

#define PENCUR_ON 1

Definition at line 129 of file DComDraw.h.

#define PENCUR_THICK 8

Definition at line 132 of file DComDraw.h.

#define PENCUR_THIN 2

Definition at line 130 of file DComDraw.h.

#define REMOTE_CREATE_ERR_STR "Remote Object Creation"

Definition at line 116 of file DComDraw.h.

#define SERVER_TUTFILE_STR "dcdserve.htm"

Definition at line 108 of file DComDraw.h.

Enumeration Type Documentation

anonymous enum
Enumerator:
INK_THIN
INK_MEDIUM
INK_THICK

Definition at line 120 of file DComDraw.h.

{
  INK_THIN = 2,
  INK_MEDIUM = 10,
  INK_THICK = 20
};

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/DComDraw/GUIPAPER.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • DComDraw

GUIPAPER.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <olectl.h>
#include <commdlg.h>
#include <tchar.h>
#include <apputil.h>
#include <papint.h>
#include <papguids.h>
#include "guipaper.h"
#include "sink.h"
#include "dcomdraw.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/DComDraw/GUIPAPER.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • DComDraw

GUIPAPER.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/DComDraw/SINK.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • DComDraw
Functions

SINK.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <olectl.h>
#include <apputil.h>
#include <papint.h>
#include <papguids.h>
#include "guipaper.h"
#include "sink.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) COPaperSink

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 337 of file SINK.Cpp.

{
  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/DComDraw/SINK.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • DComDraw

SINK.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/DllClien/DllClien.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • DllClien
Functions | Variables

DllClien.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <initguid.h>
#include <commdlg.h>
#include <apputil.h>
#include <icars.h>
#include <carguids.h>
#include "dllclien.h"
#include "utcrucar.h"

Go to the source code of this file.

Functions

BOOL | InitApplication (HINSTANCE hInstance)
BOOL | UnicodeOk (void)
int PASCAL | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

Variables

CMsgLog * | g_pMsgLog = NULL

Function Documentation

BOOL InitApplication ( HINSTANCE hInstance )

Definition at line 1006 of file DllClien.Cpp.

{
  BOOL bOk;
  // The window class for all instances of the main frame window.
  WNDCLASSEX wcf;

  // Assign the appropriate values for this main frame window class.
  wcf.cbSize        = sizeof(WNDCLASSEX);
  wcf.cbClsExtra    = 0;            // No per-class extra data.
  wcf.cbWndExtra    = 0;            // No per-window extra data.
  wcf.hInstance     = hInstance;    // Application module instance.
  wcf.lpfnWndProc   = &WindowProc;  // Global Window Procedure (defined in
                                    // APPUTIL for all CVirWindows).
  wcf.hCursor       = LoadCursor(NULL, IDC_ARROW); // Load app cursor.
  wcf.hIcon         = (HICON) LoadIcon(            // Load app icon.
                                hInstance,
                                TEXT("AppIcon"));
  wcf.hIconSm       = (HICON) LoadImage(           // Load small icon.
                                hInstance,
                                TEXT("AppIcon"),
                                IMAGE_ICON,
                                16, 16,
                                0);
  wcf.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);  // Default backgnd color.
  wcf.style         = CS_HREDRAW | CS_VREDRAW;     // Class style(s).
  wcf.lpszClassName = TEXT(MAIN_WINDOW_CLASS_NAME_STR); // Class name.
  wcf.lpszMenuName  = TEXT(MAIN_WINDOW_CLASS_MENU_STR); // Menu name.

  // Register the window class and return FALSE if unsuccesful.
  bOk = RegisterClassEx(&wcf);

  return (bOk);
}

BOOL UnicodeOk ( void )

Definition at line 980 of file DllClien.Cpp.

{
  BOOL bOk = TRUE;
  TCHAR szUserName[MAX_STRING_LENGTH];
  DWORD dwSize = MAX_STRING_LENGTH;

  if (!GetUserName(szUserName, &dwSize))
    bOk = ERROR_CALL_NOT_IMPLEMENTED == GetLastError() ? FALSE : TRUE;

  return bOk;
}

int PASCAL WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 1063 of file DllClien.Cpp.

{
  CMainWindow* pWin = NULL;
  MSG msg;
  HACCEL hAccel;
  int iRun = FALSE;

  // If we were compiled for UNICODE and the platform seems OK with this
  // then proceed.  Else we error and exit the app.
  if (UnicodeOk())
  {
    // Call to initialize the COM Library.  Use the SUCCEEDED macro
    // to detect success.  If fail then exit app with error message.
    if (SUCCEEDED(CoInitialize(NULL)))
    {
      // If we succeeded in initializing the COM Library we proceed to
      // initialize the application.  If we can't init the application
      // then we signal shut down with an error message exit.
      iRun = InitApplication(hInstance);
      if (iRun)
      {
        // Assume we'll set iRun to TRUE when initialization is done.
        iRun = FALSE;
        // We are still go for running so we try to create a nifty new
        // CMainWindow object for this app instance.
        pWin = new CMainWindow;
        if (NULL != pWin)
        {
          // Now we initialize an instance of the new CMainWindow.
          // This includes creating the main window.
          if (pWin->InitInstance(hInstance, nCmdShow))
          {
            // Load the keyboard accelerators from the resources.
            hAccel = LoadAccelerators(hInstance, TEXT("AppAccel"));
            if (NULL != hAccel)
            {
              // Signal App Initialization is successfully done.
              iRun = TRUE;
            }
          }
        }
      }

      if (iRun)
      {
        // If we initialized the app instance properly then we are still
        // go for running.  We then start up the main message pump for
        // the application.
        while (GetMessage(&msg, NULL, 0, 0))
        {
          if (!TranslateAccelerator(
                 pWin->GetHwnd(),
                 hAccel,
                 &msg))
          {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
          }
        }

        // We ask COM to unload any unused COM Servers.
        CoFreeUnusedLibraries();

        // We'll pass to Windows the reason why we exited the message loop.
        iRun = (int) msg.wParam;
      }
      else
      {
        // We failed to initialize the application. Put up error message
        // box saying that application couldn't be initialized.  Parent
        // window is desktop (ie, NULL). Exit the failed application
        // (ie, by returning FALSE to WinMain).
        ErrorBox(hInstance, NULL, IDS_APPINITFAILED);

        // Delete the CMainWindow object.
        DELETE_POINTER(pWin);
      }

      // We're exiting this app (either normally or by init failure) so
      // shut down the COM Library.
      CoUninitialize();
    }
    else
    {
      // We failed to Initialize the COM Library. Put up error message box
      // saying that COM Library couldn't be initialized.  Parent window
      // is desktop (ie, NULL). Exit the failed application (ie, by
      // returning FALSE to WinMain).
      ErrorBox(hInstance, NULL, IDS_COMINITFAILED);
    }
  }
  else
  {
    // If we were compiled for UNICODE but the platform has problems with
    // this then indicate an error and exit the app immediately.
    CHAR szMsg[MAX_STRING_LENGTH];

    if (LoadStringA(
          hInstance,
          IDS_NOUNICODE,
          szMsg,
          MAX_STRING_LENGTH))
    {
      MessageBoxA(
        NULL,
        szMsg,
        ERROR_TITLE_STR,
        MB_OK | MB_ICONEXCLAMATION);
    }
  }

  return iRun;
}

Variable Documentation

CMsgLog* g_pMsgLog = NULL

Definition at line 83 of file DllClien.Cpp.

Generated on Wed Nov 13 2024 16:53:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/DllClien/DllClien.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • DllClien
Defines

DllClien.h File Reference

Go to the source code of this file.

Defines

#define | IDM_CAR_CLUTCH 1103
#define | IDM_CAR_CREATE 1100
#define | IDM_CAR_RELEASE 1101
#define | IDM_CAR_SHIFT 1102
#define | IDM_CAR_SPEED 1104
#define | IDM_CAR_STEER 1105
#define | IDM_CCAR_ADJUST 1307
#define | IDM_CCAR_CLUTCH 1303
#define | IDM_CCAR_CREATE 1300
#define | IDM_CCAR_ENGAGE 1306
#define | IDM_CCAR_RELEASE 1301
#define | IDM_CCAR_SHIFT 1302
#define | IDM_CCAR_SPEED 1304
#define | IDM_CCAR_STEER 1305
#define | IDM_FILE_EXIT 1000
#define | IDM_HELP_ABOUT 1905
#define | IDM_HELP_ABOUTSERVER 1906
#define | IDM_HELP_CONTENTS 1900
#define | IDM_HELP_READSOURCE 1904
#define | IDM_HELP_TUTORIAL 1901
#define | IDM_HELP_TUTREGISTER 1903
#define | IDM_HELP_TUTSERVER 1902
#define | IDM_LOG_COPYCLIP 1892
#define | IDM_LOG_LOGCLEAR 1890
#define | IDM_LOG_LOGGING 1891
#define | IDM_UCAR_CLUTCH 1203
#define | IDM_UCAR_CREATE 1200
#define | IDM_UCAR_OFFROAD 1206
#define | IDM_UCAR_RELEASE 1201
#define | IDM_UCAR_SHIFT 1202
#define | IDM_UCAR_SPEED 1204
#define | IDM_UCAR_STEER 1205
#define | IDM_UCAR_WINCH 1207
#define | IDM_UCRU_ADJUST 1407
#define | IDM_UCRU_CLUTCH 1403
#define | IDM_UCRU_CREATE 1400
#define | IDM_UCRU_ENGAGE 1406
#define | IDM_UCRU_OFFROAD 1408
#define | IDM_UCRU_RELEASE 1401
#define | IDM_UCRU_SHIFT 1402
#define | IDM_UCRU_SPEED 1404
#define | IDM_UCRU_STEER 1405
#define | IDM_UCRU_WINCH 1409
#define | IDS_APPINITFAILED 2001
#define | IDS_ASSERT_FAIL 2200
#define | IDS_COMINITFAILED 2000
#define | IDS_NOSERVER 2004
#define | IDS_NOTIMPLEMENTED 2301
#define | IDS_NOUNICODE 2003
#define | IDS_OUTOFMEMORY 2002
#define | IDS_START_MESSAGE_LOG 2400
#define | MAIN_WINDOW_CLASS_MENU_STR "DLLCLIENMenu"
#define | MAIN_WINDOW_CLASS_NAME_STR "DLLCLIENWindow"
#define | MAIN_WINDOW_TITLE_STR "DLLCLIEN: Tutorial Code Sample"
#define | OFN_DEFAULTFILES_STR "All Files (*.*)\0*.*\0"
#define | OFN_DEFAULTTITLE_STR "Open File"
#define | REGISTER_TUTFILE_STR "register.htm"
#define | SERVER_TUTFILE_STR "dllserve.htm"

Define Documentation

#define IDM_CAR_CLUTCH 1103

Definition at line 116 of file DllClien.h.

#define IDM_CAR_CREATE 1100

Definition at line 113 of file DllClien.h.

#define IDM_CAR_RELEASE 1101

Definition at line 114 of file DllClien.h.

#define IDM_CAR_SHIFT 1102

Definition at line 115 of file DllClien.h.

#define IDM_CAR_SPEED 1104

Definition at line 117 of file DllClien.h.

#define IDM_CAR_STEER 1105

Definition at line 118 of file DllClien.h.

#define IDM_CCAR_ADJUST 1307

Definition at line 138 of file DllClien.h.

#define IDM_CCAR_CLUTCH 1303

Definition at line 134 of file DllClien.h.

#define IDM_CCAR_CREATE 1300

Definition at line 131 of file DllClien.h.

#define IDM_CCAR_ENGAGE 1306

Definition at line 137 of file DllClien.h.

#define IDM_CCAR_RELEASE 1301

Definition at line 132 of file DllClien.h.

#define IDM_CCAR_SHIFT 1302

Definition at line 133 of file DllClien.h.

#define IDM_CCAR_SPEED 1304

Definition at line 135 of file DllClien.h.

#define IDM_CCAR_STEER 1305

Definition at line 136 of file DllClien.h.

#define IDM_FILE_EXIT 1000

Definition at line 110 of file DllClien.h.

#define IDM_HELP_ABOUT 1905

Definition at line 163 of file DllClien.h.

#define IDM_HELP_ABOUTSERVER 1906

Definition at line 164 of file DllClien.h.

#define IDM_HELP_CONTENTS 1900

Definition at line 158 of file DllClien.h.

#define IDM_HELP_READSOURCE 1904

Definition at line 162 of file DllClien.h.

#define IDM_HELP_TUTORIAL 1901

Definition at line 159 of file DllClien.h.

#define IDM_HELP_TUTREGISTER 1903

Definition at line 161 of file DllClien.h.

#define IDM_HELP_TUTSERVER 1902

Definition at line 160 of file DllClien.h.

#define IDM_LOG_COPYCLIP 1892

Definition at line 155 of file DllClien.h.

#define IDM_LOG_LOGCLEAR 1890

Definition at line 153 of file DllClien.h.

#define IDM_LOG_LOGGING 1891

Definition at line 154 of file DllClien.h.

#define IDM_UCAR_CLUTCH 1203

Definition at line 124 of file DllClien.h.

#define IDM_UCAR_CREATE 1200

Definition at line 121 of file DllClien.h.

#define IDM_UCAR_OFFROAD 1206

Definition at line 127 of file DllClien.h.

#define IDM_UCAR_RELEASE 1201

Definition at line 122 of file DllClien.h.

#define IDM_UCAR_SHIFT 1202

Definition at line 123 of file DllClien.h.

#define IDM_UCAR_SPEED 1204

Definition at line 125 of file DllClien.h.

#define IDM_UCAR_STEER 1205

Definition at line 126 of file DllClien.h.

#define IDM_UCAR_WINCH 1207

Definition at line 128 of file DllClien.h.

#define IDM_UCRU_ADJUST 1407

Definition at line 148 of file DllClien.h.

#define IDM_UCRU_CLUTCH 1403

Definition at line 144 of file DllClien.h.

#define IDM_UCRU_CREATE 1400

Definition at line 141 of file DllClien.h.

#define IDM_UCRU_ENGAGE 1406

Definition at line 147 of file DllClien.h.

#define IDM_UCRU_OFFROAD 1408

Definition at line 149 of file DllClien.h.

#define IDM_UCRU_RELEASE 1401

Definition at line 142 of file DllClien.h.

#define IDM_UCRU_SHIFT 1402

Definition at line 143 of file DllClien.h.

#define IDM_UCRU_SPEED 1404

Definition at line 145 of file DllClien.h.

#define IDM_UCRU_STEER 1405

Definition at line 146 of file DllClien.h.

#define IDM_UCRU_WINCH 1409

Definition at line 150 of file DllClien.h.

#define IDS_APPINITFAILED 2001

Definition at line 168 of file DllClien.h.

#define IDS_ASSERT_FAIL 2200

Definition at line 173 of file DllClien.h.

#define IDS_COMINITFAILED 2000

Definition at line 167 of file DllClien.h.

#define IDS_NOSERVER 2004

Definition at line 171 of file DllClien.h.

#define IDS_NOTIMPLEMENTED 2301

Definition at line 176 of file DllClien.h.

#define IDS_NOUNICODE 2003

Definition at line 170 of file DllClien.h.

#define IDS_OUTOFMEMORY 2002

Definition at line 169 of file DllClien.h.

#define IDS_START_MESSAGE_LOG 2400

Definition at line 179 of file DllClien.h.

#define MAIN_WINDOW_CLASS_MENU_STR "DLLCLIENMenu"

Definition at line 99 of file DllClien.h.

#define MAIN_WINDOW_CLASS_NAME_STR "DLLCLIENWindow"

Definition at line 98 of file DllClien.h.

#define MAIN_WINDOW_TITLE_STR "DLLCLIEN: Tutorial Code Sample"

Definition at line 97 of file DllClien.h.

#define OFN_DEFAULTFILES_STR "All Files (*.*)\0*.*\0"

Definition at line 106 of file DllClien.h.

#define OFN_DEFAULTTITLE_STR "Open File"

Definition at line 107 of file DllClien.h.

#define REGISTER_TUTFILE_STR "register.htm"

Definition at line 103 of file DllClien.h.

#define SERVER_TUTFILE_STR "dllserve.htm"

Definition at line 102 of file DllClien.h.

Generated on Wed Nov 13 2024 16:53:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/DllClien/UTCRUCAR.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • DllClien
Functions

UTCRUCAR.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <apputil.h>
#include <icars.h>
#include <carguids.h>
#include "dllclien.h"
#include "utcrucar.h"

Go to the source code of this file.

Functions

HRESULT CreateUtilityCruiseCar (IUnknown *pUnkOuter, REFIID riid, PPVOID ppv)
STDMETHODIMP_ (ULONG) COUtilityCruiseCar

Function Documentation

HRESULT CreateUtilityCruiseCar | ( | IUnknown * | pUnkOuter,
 |  | REFIID | riid,
 |  | PPVOID | ppv
 | ) |  |

Definition at line 565 of file UTCRUCAR.Cpp.

{
  HRESULT hr;
  COUtilityCruiseCar* pCob;

  LOGF1("C: CreateUtilityCruiseCar. pUnkOuter=0x%X.",pUnkOuter);

  // If the creation call is requesting aggregation (pUnkOuter != NULL),
  // the COM rules state the IUnknown interface MUST also be concomitantly
  // requested.  If it is not so requested ( riid != IID_IUnknown) then
  // an error must be returned indicating that no aggregate creation of
  // the COUtilityCruiseCar COM Object can be performed using anything
  // other than a controlling IUnknown interface.
  if (NULL != pUnkOuter && riid != IID_IUnknown)
    hr = CLASS_E_NOAGGREGATION;
  else
  {
    // Instantiate a COUtilityCruiseCar COM Object.
    pCob = new COUtilityCruiseCar(pUnkOuter);
    if (NULL != pCob)
    {
      // If we have succeeded in instantiating the COUtilityCruiseCar object
      // we initialize it to offer it's interfaces.
      hr = pCob->Init();
      if (SUCCEEDED(hr))
      {
        // We QueryInterface this new COM Object not only to deposit the
        // main interface pointer to the caller's pointer variable, but to
        // also automatically bump the Reference Count on the new COM
        // Object after handing out this *ppv reference to it.
        hr = pCob->QueryInterface(riid, (PPVOID)ppv);
      }
    }
    else
      hr = E_OUTOFMEMORY;
  }

  if (SUCCEEDED(hr))
    LOGF1("C: CreateUtilityCruiseCar Succeeded. *ppv=0x%X.",*ppv);

  return hr;
}

STDMETHODIMP_ ( ULONG )

Definition at line 441 of file UTCRUCAR.Cpp.

{
  // Decrement the Interface Reference Count.
  --m_cRefI;

  LOGF1("C: COUtilityCruiseCar::CImpIUtility::Release. Delegating. New cI=%i.", m_cRefI);

  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:17 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/DllClien/UTCRUCAR.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • DllClien

UTCRUCAR.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/DllServe/CAR.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • DllServe
Functions

CAR.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <apputil.h>
#include <icars.h>
#include <carguids.h>
#include "server.h"
#include "car.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) COCar

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 362 of file CAR.Cpp.

{
  // Decrement the Interface Reference Count.
  --m_cRefI;

  LOGF1("S: COCar::CImpICar::Release. Delegating. New cI=%i.", m_cRefI);

  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/DllServe/CAR.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • DllServe

CAR.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/DllServe/CRUCAR.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • DllServe
Functions

CRUCAR.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <apputil.h>
#include <icars.h>
#include <carguids.h>
#include "server.h"
#include "car.h"
#include "crucar.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) COCruiseCar

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 431 of file CRUCAR.Cpp.

{
  // Decrement the Interface Reference Count.
  --m_cRefI;

  LOGF1("S: COCruiseCar::CImpICruise::Release. Delegating. New cI=%i.",m_cRefI);

  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/DllServe/CRUCAR.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • DllServe

CRUCAR.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/DllServe/DllServe.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • DllServe
Defines | Functions | Variables

DllServe.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <initguid.h>
#include <apputil.h>
#include <icars.h>
#include <carguids.h>
#include "dllserve.h"
#include "server.h"
#include "factory.h"

Go to the source code of this file.

Defines

#define | _DLLEXPORT_

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, PPVOID ppv)
BOOL WINAPI | DllMain (HINSTANCE hDllInst, DWORD fdwReason, LPVOID lpvReserved)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)
BOOL | UnicodeOk (void)

Variables

CMsgLog * | g_pMsgLog = NULL
CServer * | g_pServer = NULL

Define Documentation

#define _DLLEXPORT_

Definition at line 67 of file DllServe.Cpp.

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 282 of file DllServe.Cpp.

{
  HRESULT hr;

  LOGF2("S: DllCanUnloadNow. cObjects=%i, cLocks=%i.", g_pServer->m_cObjects, g_pServer->m_cLocks);

  // We return S_OK of there are no longer any living objects AND
  // there are no outstanding client locks on this server.
  hr = (0L==g_pServer->m_cObjects && 0L==g_pServer->m_cLocks) ? S_OK : S_FALSE;

  return hr;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | PPVOID | ppv
 | ) |  |

Definition at line 222 of file DllServe.Cpp.

{
  HRESULT hr = CLASS_E_CLASSNOTAVAILABLE;
  IUnknown* pCob = NULL;

  if (CLSID_DllCar == rclsid)
  {
    LOG("S: DllGetClassObject: Requesting CFCar.");
    hr = E_OUTOFMEMORY;
    pCob = new CFCar(NULL, g_pServer);
  }
  else if (CLSID_DllUtilityCar == rclsid)
  {
    LOG("S: DllGetClassObject: Requesting CFUtilityCar.");
    hr = E_OUTOFMEMORY;
    pCob = new CFUtilityCar(NULL, g_pServer);
  }
  else if (CLSID_DllCruiseCar == rclsid)
  {
    LOG("S: DllGetClassObject: Requesting CFCruiseCar.");
    hr = E_OUTOFMEMORY;
    pCob = new CFCruiseCar(NULL, g_pServer);
  }
  else if (CLSID_DllCarSample == rclsid)
  {
    LOG("S: DllGetClassObject: Requesting CFCarSample.");
    hr = E_OUTOFMEMORY;
    pCob = new CFCarSample(NULL, g_pServer);
  }

  if (NULL != pCob)
  {
    g_pServer->ObjectsUp();
    hr = pCob->QueryInterface(riid, ppv);
    if (FAILED(hr))
    {
      g_pServer->ObjectsDown();
      DELETE_POINTER(pCob);
    }
  }

  return hr;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hDllInst,
 |  | DWORD | fdwReason,
 |  | LPVOID | lpvReserved
 | ) |  |

Definition at line 142 of file DllServe.Cpp.

{
  BOOL bResult = TRUE;

  // Dispatch this main call based on the reason it was called.
  switch (fdwReason)
  {
    case DLL_PROCESS_ATTACH:
      // The DLL is being loaded for the first time by a given process.
      // Perform per-process initialization here.  If the initialization
      // is successful, return TRUE; if unsuccessful, return FALSE.
      bResult = FALSE;
      if (UnicodeOk())
      {
        // Instantiate the CServer utility class.
        g_pServer = new CServer;
        if (NULL != g_pServer)
        {
          // Remember the DLL Instance handle.
          g_pServer->m_hDllInst = hDllInst;

          // Create a MsgBox object.
          g_pServer->m_pMsgBox = new CMsgBox;
          if (NULL != g_pServer->m_pMsgBox)
            bResult = TRUE;
        }
      }
      break;

    case DLL_PROCESS_DETACH:
      // The DLL is being unloaded by a given process.  Do any
      // per-process clean up here, such as undoing what was done in
      // DLL_PROCESS_ATTACH.  The return value is ignored.
      DELETE_POINTER(g_pServer->m_pMsgBox);
      DELETE_POINTER(g_pServer);
      break;

    case DLL_THREAD_ATTACH:
      // A thread is being created in a process that has already loaded
      // this DLL.  Perform any per-thread initialization here.  The
      // return value is ignored.
      break;

    case DLL_THREAD_DETACH:
      // A thread is exiting cleanly in a process that has already
      // loaded this DLL.  Perform any per-thread clean up here.  The
      // return value is ignored.
      break;

    default:
      break;
  }

  return (bResult);
}

STDAPI DllRegisterServer ( void )

Definition at line 307 of file DllServe.Cpp.

{
  HRESULT  hr = NOERROR;
  TCHAR    szID[GUID_SIZE+1];
  TCHAR    szCLSID[GUID_SIZE+32];
  TCHAR    szModulePath[MAX_PATH];

  // Obtain the path to this module's executable file for later use.
  GetModuleFileName(
    g_pServer->m_hDllInst,
    szModulePath,
    sizeof(szModulePath)/sizeof(TCHAR));

  /*-------------------------------------------------------------------------
    Create registry entries for the DllCar Component.
  -------------------------------------------------------------------------*/
  // Create some base key strings.
  StringFromGUID2(CLSID_DllCar, szID, GUID_SIZE);
  lstrcpyn(szCLSID, TEXT("CLSID\\"), sizeof(szCLSID)/sizeof(TCHAR));
  lstrncat(szCLSID, szID, sizeof(szCLSID)/sizeof(TCHAR) - lstrlen(szCLSID));

  // Create ProgID keys.
  SetRegKeyValue(
    TEXT("CTS.DllCar.1"),
    NULL,
    TEXT("DllCar Component - DLLSERVE Code Sample"));
  SetRegKeyValue(
    TEXT("CTS.DllCar.1"),
    TEXT("CLSID"),
    szID);

  // Create VersionIndependentProgID keys.
  SetRegKeyValue(
    TEXT("CTS.DllCar"),
    NULL,
    TEXT("DllCar Component - DLLSERVE Code Sample"));
  SetRegKeyValue(
    TEXT("CTS.DllCar"),
    TEXT("CurVer"),
    TEXT("CTS.DllCar.1"));
  SetRegKeyValue(
    TEXT("CTS.DllCar"),
    TEXT("CLSID"),
    szID);

  // Create entries under CLSID.
  SetRegKeyValue(
    szCLSID,
    NULL,
    TEXT("DllCar Component - DLLSERVE Code Sample"));
  SetRegKeyValue(
    szCLSID,
    TEXT("ProgID"),
    TEXT("CTS.DllCar.1"));
  SetRegKeyValue(
    szCLSID,
    TEXT("VersionIndependentProgID"),
    TEXT("CTS.DllCar"));
  SetRegKeyValue(
    szCLSID,
    TEXT("NotInsertable"),
    NULL);
  SetRegKeyValue(
    szCLSID,
    TEXT("InprocServer32"),
    szModulePath);

  /*-------------------------------------------------------------------------
    Create registry entries for the DllUtilityCar Component.
  -------------------------------------------------------------------------*/
  // Create some base key strings.
  StringFromGUID2(CLSID_DllUtilityCar, szID, GUID_SIZE);
  lstrcpyn(szCLSID, TEXT("CLSID\\"), sizeof(szCLSID)/sizeof(TCHAR));
  lstrncat(szCLSID, szID, sizeof(szCLSID)/sizeof(TCHAR) - lstrlen(szCLSID));

  // Create ProgID keys.
  SetRegKeyValue(
    TEXT("CTS.DllUtilityCar.1"),
    NULL,
    TEXT("DllUtilityCar Component - DLLSERVE Code Sample"));
  SetRegKeyValue(
    TEXT("CTS.DllUtilityCar.1"),
    TEXT("CLSID"),
    szID);

  // Create VersionIndependentProgID keys.
  SetRegKeyValue(
    TEXT("CTS.DllUtilityCar"),
    NULL,
    TEXT("DllUtilityCar Component - DLLSERVE Code Sample"));
  SetRegKeyValue(
    TEXT("CTS.DllUtilityCar"),
    TEXT("CurVer"),
    TEXT("CTS.DllUtilityCar.1"));
  SetRegKeyValue(
    TEXT("CTS.DllUtilityCar"),
    TEXT("CLSID"),
    szID);

  // Create entries under CLSID.
  SetRegKeyValue(
    szCLSID,
    NULL,
    TEXT("DllUtilityCar Component - DLLSERVE Code Sample"));
  SetRegKeyValue(
    szCLSID,
    TEXT("ProgID"),
    TEXT("CTS.DllUtilityCar.1"));
  SetRegKeyValue(
    szCLSID,
    TEXT("VersionIndependentProgID"),
    TEXT("CTS.DllUtilityCar"));
  SetRegKeyValue(
    szCLSID,
    TEXT("NotInsertable"),
    NULL);
  SetRegKeyValue(
    szCLSID,
    TEXT("InprocServer32"),
    szModulePath);

  /*-------------------------------------------------------------------------
    Create registry entries for the DllCruiseCar Component.
  -------------------------------------------------------------------------*/
  // Create some base key strings.
  StringFromGUID2(CLSID_DllCruiseCar, szID, GUID_SIZE);
  lstrcpyn(szCLSID, TEXT("CLSID\\"), sizeof(szCLSID)/sizeof(TCHAR));
  lstrncat(szCLSID, szID, sizeof(szCLSID)/sizeof(TCHAR) - lstrlen(szCLSID));

  // Create ProgID keys.
  SetRegKeyValue(
    TEXT("CTS.DllCruiseCar.1"),
    NULL,
    TEXT("DllCruiseCar Component - DLLSERVE Code Sample"));
  SetRegKeyValue(
    TEXT("CTS.DllCruiseCar.1"),
    TEXT("CLSID"),
    szID);

  // Create VersionIndependentProgID keys.
  SetRegKeyValue(
    TEXT("CTS.DllCruiseCar"),
    NULL,
    TEXT("DllCruiseCar Component - DLLSERVE Code Sample"));
  SetRegKeyValue(
    TEXT("CTS.DllCruiseCar"),
    TEXT("CurVer"),
    TEXT("CTS.DllCruiseCar.1"));
  SetRegKeyValue(
    TEXT("CTS.DllCruiseCar"),
    TEXT("CLSID"),
    szID);

  // Create entries under CLSID.
  SetRegKeyValue(
    szCLSID,
    NULL,
    TEXT("DllCruiseCar Component - DLLSERVE Code Sample"));
  SetRegKeyValue(
    szCLSID,
    TEXT("ProgID"),
    TEXT("CTS.DllCruiseCar.1"));
  SetRegKeyValue(
    szCLSID,
    TEXT("VersionIndependentProgID"),
    TEXT("CTS.DllCruiseCar"));
  SetRegKeyValue(
    szCLSID,
    TEXT("NotInsertable"),
    NULL);
  SetRegKeyValue(
    szCLSID,
    TEXT("InprocServer32"),
    szModulePath);

  /*-------------------------------------------------------------------------
    Create registry entries for the DllCarSample Component.
  -------------------------------------------------------------------------*/
  // Create some base key strings.
  StringFromGUID2(CLSID_DllCarSample, szID, GUID_SIZE);
  lstrcpyn(szCLSID, TEXT("CLSID\\"), sizeof(szCLSID)/sizeof(TCHAR));
  lstrncat(szCLSID, szID, sizeof(szCLSID)/sizeof(TCHAR) - lstrlen(szCLSID));

  // Create ProgID keys.
  SetRegKeyValue(
    TEXT("CTS.DllCarSample.1"),
    NULL,
    TEXT("DllCarSample Component - DLLSERVE Code Sample"));
  SetRegKeyValue(
    TEXT("CTS.DllCarSample.1"),
    TEXT("CLSID"),
    szID);

  // Create VersionIndependentProgID keys.
  SetRegKeyValue(
    TEXT("CTS.DllCarSample"),
    NULL,
    TEXT("DllCarSample Component - DLLSERVE Code Sample"));
  SetRegKeyValue(
    TEXT("CTS.DllCarSample"),
    TEXT("CurVer"),
    TEXT("CTS.DllCarSample.1"));
  SetRegKeyValue(
    TEXT("CTS.DllCarSample"),
    TEXT("CLSID"),
    szID);

  // Create entries under CLSID.
  SetRegKeyValue(
    szCLSID,
    NULL,
    TEXT("DllCarSample Component - DLLSERVE Code Sample"));
  SetRegKeyValue(
    szCLSID,
    TEXT("ProgID"),
    TEXT("CTS.DllCarSample.1"));
  SetRegKeyValue(
    szCLSID,
    TEXT("VersionIndependentProgID"),
    TEXT("CTS.DllCarSample"));
  SetRegKeyValue(
    szCLSID,
    TEXT("NotInsertable"),
    NULL);
  SetRegKeyValue(
    szCLSID,
    TEXT("InprocServer32"),
    szModulePath);

  return hr;
}

STDAPI DllUnregisterServer ( void )

Definition at line 551 of file DllServe.Cpp.

{
  HRESULT  hr = NOERROR;
  TCHAR    szID[GUID_SIZE+1];
  TCHAR    szCLSID[GUID_SIZE+32];
  TCHAR    szTemp[MAX_PATH+GUID_SIZE];

  /*-------------------------------------------------------------------------
    Delete registry entries for the DllCar Component.
  -------------------------------------------------------------------------*/
  //Create some base key strings.
  StringFromGUID2(CLSID_DllCar, szID, GUID_SIZE);
  lstrcpyn(szCLSID, TEXT("CLSID\\"), sizeof(szCLSID)/sizeof(TCHAR));
  lstrncat(szCLSID, szID, sizeof(szCLSID)/sizeof(TCHAR) - lstrlen(szCLSID));

  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.DllCar\\CurVer"));
  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.DllCar\\CLSID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.DllCar"));

  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.DllCar.1\\CLSID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.DllCar.1"));

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("ProgID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("VersionIndependentProgID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("NotInsertable"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("InprocServer32"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  RegDeleteKey(HKEY_CLASSES_ROOT, szCLSID);

  /*-------------------------------------------------------------------------
    Delete registry entries for the DllUtilityCar Component.
  -------------------------------------------------------------------------*/
  //Create some base key strings.
  StringFromGUID2(CLSID_DllUtilityCar, szID, GUID_SIZE);
  lstrcpyn(szCLSID, TEXT("CLSID\\"), sizeof(szCLSID)/sizeof(TCHAR));
  lstrncat(szCLSID, szID, sizeof(szCLSID)/sizeof(TCHAR) - lstrlen(szCLSID));

  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.DllUtilityCar\\CurVer"));
  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.DllUtilityCar\\CLSID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.DllUtilityCar"));

  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.DllUtilityCar.1\\CLSID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.DllUtilityCar.1"));

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("ProgID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("VersionIndependentProgID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("NotInsertable"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("InprocServer32"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  RegDeleteKey(HKEY_CLASSES_ROOT, szCLSID);

  /*-------------------------------------------------------------------------
    Delete registry entries for the DllCruiseCar Component.
  -------------------------------------------------------------------------*/
  //Create some base key strings.
  StringFromGUID2(CLSID_DllCruiseCar, szID, GUID_SIZE);
  lstrcpyn(szCLSID, TEXT("CLSID\\"), sizeof(szCLSID)/sizeof(TCHAR));
  lstrncat(szCLSID, szID, sizeof(szCLSID)/sizeof(TCHAR) - lstrlen(szCLSID));

  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.DllCruiseCar\\CurVer"));
  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.DllCruiseCar\\CLSID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.DllCruiseCar"));

  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.DllCruiseCar.1\\CLSID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.DllCruiseCar.1"));

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("ProgID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("VersionIndependentProgID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("NotInsertable"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("InprocServer32"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  RegDeleteKey(HKEY_CLASSES_ROOT, szCLSID);

  /*-------------------------------------------------------------------------
    Delete registry entries for the DllCarSample Component.
  -------------------------------------------------------------------------*/
  //Create some base key strings.
  StringFromGUID2(CLSID_DllCarSample, szID, GUID_SIZE);
  lstrcpyn(szCLSID, TEXT("CLSID\\"), sizeof(szCLSID)/sizeof(TCHAR));
  lstrncat(szCLSID, szID, sizeof(szCLSID)/sizeof(TCHAR) - lstrlen(szCLSID));

  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.DllCarSample\\CurVer"));
  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.DllCarSample\\CLSID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.DllCarSample"));

  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.DllCarSample.1\\CLSID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.DllCarSample.1"));

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("ProgID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("VersionIndependentProgID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("NotInsertable"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("InprocServer32"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  RegDeleteKey(HKEY_CLASSES_ROOT, szCLSID);

  return hr;
}

BOOL UnicodeOk ( void )

Definition at line 95 of file DllServe.Cpp.

{
  BOOL bOk = TRUE;
  TCHAR szUserName[MAX_STRING_LENGTH];
  DWORD dwSize = MAX_STRING_LENGTH;

  if (!GetUserName(szUserName, &dwSize))
    bOk = ERROR_CALL_NOT_IMPLEMENTED == GetLastError() ? FALSE : TRUE;

  return bOk;
}

Variable Documentation

CMsgLog* g_pMsgLog = NULL

Definition at line 81 of file DllServe.Cpp.

CServer* g_pServer = NULL

Definition at line 77 of file DllServe.Cpp.

Generated on Wed Nov 13 2024 16:53:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/DllServe/DllServe.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • DllServe
Defines | Functions

DllServe.h File Reference

Go to the source code of this file.

Defines

#define | DLLENTRY extern __declspec(dllimport)
#define | STDENTRY DLLENTRY HRESULT WINAPI
#define | STDENTRY_(type) DLLENTRY type WINAPI

Functions

STDENTRY | DllRegisterServer (void)
STDENTRY | DllUnregisterServer (void)

Define Documentation

#define DLLENTRY extern __declspec(dllimport)

Definition at line 47 of file DllServe.h.

#define STDENTRY DLLENTRY HRESULT WINAPI

Definition at line 49 of file DllServe.h.

#define STDENTRY_ ( type ) DLLENTRY type WINAPI

Definition at line 50 of file DllServe.h.

Function Documentation

STDENTRY DllRegisterServer ( void )

Definition at line 69 of file ComSpyAudit.Cpp.

{
  // registers object, typelib and all interfaces in typelib
  return _Module.RegisterServer(TRUE);
}

STDENTRY DllUnregisterServer ( void )

Definition at line 78 of file ComSpyAudit.Cpp.

{
  _Module.UnregisterServer();
  return S_OK;
}

Generated on Wed Nov 13 2024 16:53:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/DllServe/Factory.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • DllServe
Functions

Factory.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <apputil.h>
#include <icars.h>
#include <carguids.h>
#include "server.h"
#include "factory.h"
#include "car.h"
#include "utilcar.h"
#include "crucar.h"
#include "sample.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CFCar

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 1678 of file Factory.Cpp.

{
  // Decrement the Interface Reference Count.
  --m_cRefI;

  LOGF1("S: CFCarSample::CImpIClassFactory::Release. Delegating. New cI=%i.",m_cRefI);

  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/DllServe/Factory.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • DllServe

Factory.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/DllServe/Sample.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • DllServe
Functions

Sample.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <apputil.h>
#include <icars.h>
#include <carguids.h>
#include "server.h"
#include "sample.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) COCarSample

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 366 of file Sample.Cpp.

{
  // Decrement the Interface Reference Count.
  --m_cRefI;

  LOGF1("S: COCarSample::CImpISample::Release. Delegating. New cI=%i.", m_cRefI);

  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/DllServe/Sample.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • DllServe

Sample.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/DllServe/Server.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • DllServe

Server.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <apputil.h>
#include "server.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/DllServe/Server.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • DllServe
Defines | Variables

Server.h File Reference

Go to the source code of this file.

Defines

#define | ABOUT_TITLE_STR "DLLSERVE: Tutorial Code Sample"
#define | IDD_ABOUTBOX 1000
#define | IDS_ASSERT_FAIL 2200

Variables

CMsgLog * | g_pMsgLog
CServer * g_pServer

Define Documentation

#define ABOUT_TITLE_STR "DLLSERVE: Tutorial Code Sample"

Definition at line 42 of file Server.h.

#define IDD_ABOUTBOX 1000

Definition at line 45 of file Server.h.

#define IDS_ASSERT_FAIL 2200

Definition at line 48 of file Server.h.

Variable Documentation

CMsgLog* g_pMsgLog

Definition at line 89 of file AptClien.Cpp.

CServer* g_pServer

Definition at line 78 of file AptServe.Cpp.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/DllServe/UtilCAR.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • DllServe
Functions

UtilCAR.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <apputil.h>
#include <icars.h>
#include <carguids.h>
#include "server.h"
#include "car.h"
#include "utilcar.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) COUtilityCar

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 670 of file UtilCAR.Cpp.

{
  // Decrement the Interface Reference Count.
  --m_cRefI;

  LOGF1("S: COUtilityCar::CImpIUtility::Release. Delegating. New cI=%i.", m_cRefI);

  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/DllServe/UtilCAR.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • DllServe

UtilCAR.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/DllSkel/DllSkel.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • DllSkel
Defines | Functions | Variables

DllSkel.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <apputil.h>
#include "dllskeli.h"
#include "dllskel.h"

Go to the source code of this file.

Defines

#define | _DLLEXPORT_
#define | DLLSKELSHARED_STR "DLLSkelShared"

Functions

BOOL WINAPI | DllMain (HINSTANCE hDllInst, DWORD fdwReason, LPVOID lpvReserved)
STDENTRY_ (BOOL) DllHelloBox(HWND hWnd)
BOOL | UnicodeOk (void)

Variables

CDllData * g_pDll

Define Documentation

#define _DLLEXPORT_

Definition at line 61 of file DllSkel.Cpp.

#define DLLSKELSHARED_STR "DLLSkelShared"

Definition at line 105 of file DllSkel.Cpp.

Function Documentation

BOOL WINAPI DllMain | ( | HINSTANCE | hDllInst,
 |  | DWORD | fdwReason,
 |  | LPVOID | lpvReserved
 | ) |  |

Definition at line 143 of file DllSkel.Cpp.

{
  BOOL bResult = TRUE;

  // Dispatch this call based on the reason it was called.
  switch (fdwReason)
  {
    case DLL_PROCESS_ATTACH:
      // The DLL is being loaded for the first time by a given process.
      // Perform per-process initialization here.  If the initialization
      // is successful, return TRUE; if unsuccessful, return FALSE.
      bResult = FALSE;
      if (UnicodeOk())
      {
        // Instantiate a DLL global data encapsulator class.
        g_pDll = new CDllData;
        if (NULL != g_pDll)
        {
          // Remember the DLL Instance handle.
          g_pDll->hDllInst = hDllInst;
          // Create a MsgBox object.
          g_pDll->pMsgBox = new CMsgBox;
          if (NULL != g_pDll->pMsgBox)
          {
            BOOL fFirst;
            int iSharedSize = sizeof(CDllShared);

            // Create a named file mapping object.
            g_hMapObj = CreateFileMapping(
                          (HANDLE) 0xFFFFFFFF,     // Use paging file
                          NULL,                    // No security attributes
                          PAGE_READWRITE,          // Read/Write access
                          0,                       // Mem Size: high 32 bits
                          iSharedSize,             // Mem Size: low 32 bits
                          DLLSKELSHARED_STR);      // Name of map object
            if (NULL != g_hMapObj)
            {
              // Determine if this is the first create of the file mapping.
              fFirst = (ERROR_ALREADY_EXISTS != GetLastError());

              // Now get a pointer to the file-mapped shared memory.
              g_pvShared = MapViewOfFile(
                             g_hMapObj,        // File Map obj to view
                             FILE_MAP_WRITE,   // Read/Write access
                             0,                // high: map from beginning
                             0,                // low:
                             0);               // default: map entire file
              if (NULL != g_pvShared)
              {
                CDllShared* pShared = (CDllShared*) g_pvShared;

                if (fFirst)
                {
                  // If this is the first attaching process, init the
                  // shared memory.
                  memset(g_pvShared, 0, iSharedSize);
                  pShared->iUserCount = 1;
                }
                else
                {
                  // Increment the cummulative global count of all
                  // attached processes (ie, the count of DLL users).
                  InterlockedIncrement((LONG*) &pShared->iUserCount);
                }
                // Save a local instance copy of this user instance
                // count. Each user process has its own g_pDll instance
                // data and can thus remember it's user instance count.
                g_pDll->iUserCount = pShared->iUserCount;
                bResult = TRUE;
              }
            }
          }
        }
      }
      break;

    case DLL_PROCESS_DETACH:
      // The DLL is being unloaded by a given process.  Do any
      // per-process clean up here, such as undoing what was done in
      // DLL_PROCESS_ATTACH.  The return value is ignored.
      // Unmap any shared memory from the process's address space.
      UnmapViewOfFile(g_pvShared);
      // Close the process's handle to the file-mapping object.
      CloseHandle(g_hMapObj);
      if (NULL != g_pDll)
      {
        // Delete the message box and global DLL instance data.
        DELETE_POINTER(g_pDll->pMsgBox);
        DELETE_POINTER(g_pDll);
      }
      break;

    case DLL_THREAD_ATTACH:
      // A thread is being created in a process that has already loaded
      // this DLL.  Perform any per-thread initialization here.  The
      // return value is ignored.
      break;

    case DLL_THREAD_DETACH:
      // A thread is exiting cleanly in a process that has already
      // loaded this DLL.  Perform any per-thread clean up here.  The
      // return value is ignored.
      break;

    default:
      break;
  }

  return (bResult);
}

STDENTRY_ ( BOOL )

Definition at line 316 of file DllSkel.Cpp.

{
  // Define one of those nifty APPUTIL CAboutBox modal dialog objects.
  CAboutBox dlgAboutBox;

  // Show the standard About Box dialog for this DLL by telling the dialog
  // C++ object to show itself by invoking its ShowDialog method.
  // Pass it this DLL instance and the parent window handle.  Use a dialog
  // resource ID for the dialog stored in this DLL module's resources.
  dlgAboutBox.ShowDialog(
    g_pDll->hDllInst,
    MAKEINTRESOURCE(IDD_ABOUTBOX),
    hWnd);

  return TRUE;
}

BOOL UnicodeOk ( void )

Definition at line 89 of file DllSkel.Cpp.

{
  BOOL bOk = TRUE;
  TCHAR szUserName[MAX_STRING_LENGTH];
  DWORD dwSize = MAX_STRING_LENGTH;

  if (!GetUserName(szUserName, &dwSize))
    bOk = ERROR_CALL_NOT_IMPLEMENTED == GetLastError() ? FALSE : TRUE;

  return bOk;
}

Variable Documentation

CDllData* g_pDll

Definition at line 75 of file DllSkel.Cpp.

Generated on Wed Nov 13 2024 16:53:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/DllSkel/DllSkel.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • DllSkel
Defines | Functions

DllSkel.h File Reference

Go to the source code of this file.

Defines

#define | DLLENTRY extern __declspec(dllimport)
#define | STDENTRY DLLENTRY HRESULT WINAPI
#define | STDENTRY_(type) DLLENTRY type WINAPI

Functions

STDENTRY_ (BOOL) DllHelloBox(HWND)

Define Documentation

#define DLLENTRY extern __declspec(dllimport)

Definition at line 54 of file DllSkel.h.

#define STDENTRY DLLENTRY HRESULT WINAPI

Definition at line 56 of file DllSkel.h.

#define STDENTRY_ ( type ) DLLENTRY type WINAPI

Definition at line 57 of file DllSkel.h.

Function Documentation

STDENTRY_ ( BOOL )

Definition at line 316 of file DllSkel.Cpp.

{
  // Define one of those nifty APPUTIL CAboutBox modal dialog objects.
  CAboutBox dlgAboutBox;

  // Show the standard About Box dialog for this DLL by telling the dialog
  // C++ object to show itself by invoking its ShowDialog method.
  // Pass it this DLL instance and the parent window handle.  Use a dialog
  // resource ID for the dialog stored in this DLL module's resources.
  dlgAboutBox.ShowDialog(
    g_pDll->hDllInst,
    MAKEINTRESOURCE(IDD_ABOUTBOX),
    hWnd);

  return TRUE;
}

Generated on Wed Nov 13 2024 16:53:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/DllSkel/DllSkelI.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • DllSkel
Classes | Defines

DllSkelI.h File Reference

Go to the source code of this file.

Classes

class | CDllData
class | CDllShared

Defines

#define | ABOUT_TITLE_STR "DLLSKEL: Tutorial Code Sample"
#define | IDD_ABOUTBOX 1000
#define | IDS_ASSERT_FAIL 2200
#define | IDS_COMINITFAILED 2000
#define | IDS_DLLINITFAILED 2001
#define | IDS_HELLOCOUNTFMT 2302
#define | IDS_HELLOTITLE 2303
#define | IDS_NOHELPFILE 2003
#define | IDS_NOTIMPLEMENTED 2301
#define | IDS_OUTOFMEMORY 2002

Define Documentation

#define ABOUT_TITLE_STR "DLLSKEL: Tutorial Code Sample"

Definition at line 83 of file DllSkelI.h.

#define IDD_ABOUTBOX 1000

Definition at line 86 of file DllSkelI.h.

#define IDS_ASSERT_FAIL 2200

Definition at line 94 of file DllSkelI.h.

#define IDS_COMINITFAILED 2000

Definition at line 89 of file DllSkelI.h.

#define IDS_DLLINITFAILED 2001

Definition at line 90 of file DllSkelI.h.

#define IDS_HELLOCOUNTFMT 2302

Definition at line 98 of file DllSkelI.h.

#define IDS_HELLOTITLE 2303

Definition at line 99 of file DllSkelI.h.

#define IDS_NOHELPFILE 2003

Definition at line 92 of file DllSkelI.h.

#define IDS_NOTIMPLEMENTED 2301

Definition at line 97 of file DllSkelI.h.

#define IDS_OUTOFMEMORY 2002

Definition at line 91 of file DllSkelI.h.

Generated on Wed Nov 13 2024 16:53:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/DllUser/DllUser.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • DllUser
Functions

DllUser.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <commdlg.h>
#include <apputil.h>
#include "dlluser.h"
#include "dllskel.h"

Go to the source code of this file.

Functions

BOOL | InitApplication (HINSTANCE hInstance)
BOOL | UnicodeOk (void)
int PASCAL | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

Function Documentation

BOOL InitApplication ( HINSTANCE hInstance )

Definition at line 407 of file DllUser.Cpp.

{
  BOOL bOk;
  // The window class for all instances of the main frame window.
  WNDCLASSEX wcf;

  // Assign the appropriate values for this main frame window class.
  wcf.cbSize        = sizeof(WNDCLASSEX);
  wcf.cbClsExtra    = 0;            // No per-class extra data.
  wcf.cbWndExtra    = 0;            // No per-window extra data.
  wcf.hInstance     = hInstance;    // Application module instance.
  wcf.lpfnWndProc   = &WindowProc;  // Global Window Procedure (defined in
                                    // APPUTIL for all CVirWindows).
  wcf.hCursor       = LoadCursor(NULL, IDC_ARROW); // Load app cursor.
  wcf.hIcon         = (HICON) LoadIcon(            // Load app icon.
                                hInstance,
                                TEXT("AppIcon"));
  wcf.hIconSm       = (HICON) LoadImage(           // Load small icon.
                                hInstance,
                                TEXT("AppIcon"),
                                IMAGE_ICON,
                                16, 16,
                                0);
  wcf.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);  // Default backgnd color.
  wcf.style         = CS_HREDRAW | CS_VREDRAW;     // Class style(s).
  wcf.lpszClassName = TEXT(MAIN_WINDOW_CLASS_NAME_STR); // Class name.
  wcf.lpszMenuName  = TEXT(MAIN_WINDOW_CLASS_MENU_STR); // Menu name.

  // Register the window class and return FALSE if unsuccesful.
  bOk = RegisterClassEx(&wcf);

  return (bOk);
}

BOOL UnicodeOk ( void )

Definition at line 381 of file DllUser.Cpp.

{
  BOOL bOk = TRUE;
  TCHAR szUserName[MAX_STRING_LENGTH];
  DWORD dwSize = MAX_STRING_LENGTH;

  if (!GetUserName(szUserName, &dwSize))
    bOk = ERROR_CALL_NOT_IMPLEMENTED == GetLastError() ? FALSE : TRUE;

  return bOk;
}

int PASCAL WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 464 of file DllUser.Cpp.

{
  CMainWindow* pWin;
  MSG msg;
  HACCEL hAccel;
  int iRun = FALSE;

  // If we were compiled for UNICODE and the platform seems OK with this
  // then proceed.  Else we error and exit the app.
  if (UnicodeOk())
  {
    // Call to initialize the COM Library.  Use the SUCCEEDED macro
    // to detect success.  If fail then exit app with error message.
    if (SUCCEEDED(CoInitialize(NULL)))
    {
      // If we succeeded in initializing the COM Library we proceed to
      // initialize the application.  If we can't init the application
      // then we signal shut down with an error message exit.
      iRun = InitApplication(hInstance);

      if (iRun)
      {
        // Assume we'll set iRun to TRUE when initialization is done.
        iRun = FALSE;
        // We are still go for running so we try to create a nifty new
        // CMainWindow object for this app instance.
        pWin = new CMainWindow;
        if (NULL != pWin)
        {
          // Now we initialize an instance of the new CMainWindow.
          // This includes creating the main window.
          if (pWin->InitInstance(hInstance, nCmdShow))
          {
            // Load the keyboard accelerators from the resources.
            hAccel = LoadAccelerators(hInstance, TEXT("AppAccel"));
            if (NULL != hAccel)
            {
              // Signal App Initialization is successfully done.
              iRun = TRUE;
            }
          }
        }
      }

      if (iRun)
      {
        // If we initialized the app instance properly then we are still
        // go for running.  We then start up the main message pump for
        // the application.
        while (GetMessage(&msg, NULL, 0, 0))
        {
          if (!TranslateAccelerator(
                 pWin->GetHwnd(),
                 hAccel,
                 &msg))
          {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
          }
        }

        // We'll pass to Windows the reason why we exited the message loop.
        iRun = (int) msg.wParam;
      }
      else
      {
        // We failed to initialize the application. Put up error message
        // box saying that application couldn't be initialized.  Parent
        // window is desktop (ie, NULL). Exit the failed application
        // (ie, by returning FALSE to WinMain).
        ErrorBox(hInstance, NULL, IDS_APPINITFAILED);

        // Delete the CMainWindow object.
        DELETE_POINTER(pWin);
      }

      // We're exiting this app (either normally or by init failure) so
      // shut down the COM Library.
      CoUninitialize();
    }
    else
    {
      // We failed to Initialize the COM Library. Put up error message box
      // saying that COM Library couldn't be initialized.  Parent window
      // is desktop (ie, NULL). Exit the failed application (ie, by
      // returning FALSE to WinMain).
      ErrorBox(hInstance, NULL, IDS_COMINITFAILED);
    }
  }
  else
  {
    // If we were compiled for UNICODE but the platform has problems with
    // this then indicate an error and exit the app immediately.
    CHAR szMsg[MAX_STRING_LENGTH];

    if (LoadStringA(
          hInstance,
          IDS_UNICODEFAIL,
          szMsg,
          MAX_STRING_LENGTH))
    {
      MessageBoxA(
        NULL,
        szMsg,
        ERROR_TITLE_STR,
        MB_OK | MB_ICONEXCLAMATION);
    }
  }

  return iRun;
}

Generated on Wed Nov 13 2024 16:53:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/DllUser/DllUser.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • DllUser
Defines

DllUser.h File Reference

Go to the source code of this file.

Defines

#define | DLL_TUTFILE_STR "dllskel.htm"
#define | IDM_FILE_EXIT 1000
#define | IDM_HELP_ABOUT 1904
#define | IDM_HELP_CONTENTS 1900
#define | IDM_HELP_READSOURCE 1903
#define | IDM_HELP_TUTDLL 1902
#define | IDM_HELP_TUTORIAL 1901
#define | IDM_TEST_DLLABOUT 1801
#define | IDM_TEST_DLLHELLO 1800
#define | IDS_APPINITFAILED 2001
#define | IDS_ASSERT_FAIL 2200
#define | IDS_COMINITFAILED 2000
#define | IDS_NOTIMPLEMENTED 2301
#define | IDS_OUTOFMEMORY 2002
#define | IDS_UNICODEFAIL 2003
#define | MAIN_WINDOW_CLASS_MENU_STR "DLLUSERMenu"
#define | MAIN_WINDOW_CLASS_NAME_STR "DLLUSERWindow"
#define | MAIN_WINDOW_TITLE_STR "DLLUSER: Tutorial Code Sample"
#define | OFN_DEFAULTFILES_STR "All Files (*.*)\0*.*\0"
#define | OFN_DEFAULTTITLE_STR "Open File"

Define Documentation

#define DLL_TUTFILE_STR "dllskel.htm"

Definition at line 88 of file DllUser.h.

#define IDM_FILE_EXIT 1000

Definition at line 95 of file DllUser.h.

#define IDM_HELP_ABOUT 1904

Definition at line 106 of file DllUser.h.

#define IDM_HELP_CONTENTS 1900

Definition at line 102 of file DllUser.h.

#define IDM_HELP_READSOURCE 1903

Definition at line 105 of file DllUser.h.

#define IDM_HELP_TUTDLL 1902

Definition at line 104 of file DllUser.h.

#define IDM_HELP_TUTORIAL 1901

Definition at line 103 of file DllUser.h.

#define IDM_TEST_DLLABOUT 1801

Definition at line 99 of file DllUser.h.

#define IDM_TEST_DLLHELLO 1800

Definition at line 98 of file DllUser.h.

#define IDS_APPINITFAILED 2001

Definition at line 110 of file DllUser.h.

#define IDS_ASSERT_FAIL 2200

Definition at line 114 of file DllUser.h.

#define IDS_COMINITFAILED 2000

Definition at line 109 of file DllUser.h.

#define IDS_NOTIMPLEMENTED 2301

Definition at line 117 of file DllUser.h.

#define IDS_OUTOFMEMORY 2002

Definition at line 111 of file DllUser.h.

#define IDS_UNICODEFAIL 2003

Definition at line 112 of file DllUser.h.

#define MAIN_WINDOW_CLASS_MENU_STR "DLLUSERMenu"

Definition at line 85 of file DllUser.h.

#define MAIN_WINDOW_CLASS_NAME_STR "DLLUSERWindow"

Definition at line 84 of file DllUser.h.

#define MAIN_WINDOW_TITLE_STR "DLLUSER: Tutorial Code Sample"

Definition at line 83 of file DllUser.h.

#define OFN_DEFAULTFILES_STR "All Files (*.*)\0*.*\0"

Definition at line 91 of file DllUser.h.

#define OFN_DEFAULTTITLE_STR "Open File"

Definition at line 92 of file DllUser.h.

Generated on Wed Nov 13 2024 16:53:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/ExeSkel/ExeSkel.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • ExeSkel
Functions

ExeSkel.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <commdlg.h>
#include <apputil.h>
#include "exeskel.h"

Go to the source code of this file.

Functions

BOOL | InitApplication (HINSTANCE hInstance)
BOOL | UnicodeOk (void)
int PASCAL | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

Function Documentation

BOOL InitApplication ( HINSTANCE hInstance )

Definition at line 387 of file ExeSkel.Cpp.

{
  BOOL bOk;
  // The window class for all instances of the main frame window.
  WNDCLASSEX wcf;

  // Assign the appropriate values for this main frame window class.
  wcf.cbSize        = sizeof(WNDCLASSEX);
  wcf.cbClsExtra    = 0;            // No per-class extra data.
  wcf.cbWndExtra    = 0;            // No per-window extra data.
  wcf.hInstance     = hInstance;    // Application module instance.
  wcf.lpfnWndProc   = &WindowProc;  // Global Window Procedure (defined in
                                    // APPUTIL for all CVirWindows).
  wcf.hCursor       = LoadCursor(NULL, IDC_ARROW); // Load app cursor.
  wcf.hIcon         = (HICON) LoadIcon(            // Load app icon.
                                hInstance,
                                TEXT("AppIcon"));
  wcf.hIconSm       = (HICON) LoadImage(           // Load small icon.
                                hInstance,
                                TEXT("AppIcon"),
                                IMAGE_ICON,
                                16, 16,
                                0);
  wcf.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);  // Default backgnd color.
  wcf.style         = CS_HREDRAW | CS_VREDRAW;          // Class style(s).
  wcf.lpszClassName = TEXT(MAIN_WINDOW_CLASS_NAME_STR); // Class name.
  wcf.lpszMenuName  = TEXT(MAIN_WINDOW_CLASS_MENU_STR); // Menu name.

  // Register the window class and return FALSE if unsuccesful.
  bOk = RegisterClassEx(&wcf);

  return (bOk);
}

BOOL UnicodeOk ( void )

Definition at line 361 of file ExeSkel.Cpp.

{
  BOOL bOk = TRUE;
  TCHAR szUserName[MAX_STRING_LENGTH];
  DWORD dwSize = MAX_STRING_LENGTH;

  if (!GetUserName(szUserName, &dwSize))
    bOk = ERROR_CALL_NOT_IMPLEMENTED == GetLastError() ? FALSE : TRUE;

  return bOk;
}

int PASCAL WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 444 of file ExeSkel.Cpp.

{
  CMainWindow* pWin = NULL;
  MSG msg;
  HACCEL hAccel;
  int iRun = FALSE;

  // If we were compiled for UNICODE and the platform seems OK with this
  // then proceed.  Else we error and exit the app.
  if (UnicodeOk())
  {
    // Call to initialize the COM Library.  Use the SUCCEEDED macro
    // to detect success.  If fail then exit app with error message.
    if (SUCCEEDED(CoInitialize(NULL)))
    {
      // If we succeeded in initializing the COM Library we proceed to
      // initialize the application.  If we can't init the application
      // then we signal shut down with an error message exit.
      iRun = InitApplication(hInstance);

      if (iRun)
      {
        // Assume we'll set iRun to TRUE when initialization is done.
        iRun = FALSE;
        // We are still go for running so we try to create a nifty new
        // CMainWindow object for this app instance.
        pWin = new CMainWindow;
        if (NULL != pWin)
        {
          // Now we initialize an instance of the new CMainWindow.
          // This includes creating the main window.
          if (pWin->InitInstance(hInstance, nCmdShow))
          {
            // Load the keyboard accelerators from the resources.
            hAccel = LoadAccelerators(hInstance, TEXT("AppAccel"));
            if (NULL != hAccel)
            {
              // Signal App Initialization is successfully done.
              iRun = TRUE;
            }
          }
        }
      }

      if (iRun)
      {
        // If we initialized the app instance properly then we are still
        // go for running.  We then start up the main message pump for
        // the application.
        while (GetMessage(&msg, NULL, 0, 0))
        {
          if (!TranslateAccelerator(
                 pWin->GetHwnd(),
                 hAccel,
                 &msg))
          {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
          }
        }

        // We'll pass to Windows the reason why we exited the message loop.
        iRun = msg.wParam;
      }
      else
      {
        // We failed to initialize the application. Put up error message
        // box saying that application couldn't be initialized.  Parent
        // window is desktop (ie, NULL). Exit the failed application
        // (ie, by returning FALSE to WinMain).
        ErrorBox(hInstance, NULL, IDS_APPINITFAILED);

        // Delete the CMainWindow object.
        DELETE_POINTER(pWin);
      }

      // We're exiting this app (either normally or by init failure) so
      // shut down the COM Library.
      CoUninitialize();
    }
    else
    {
      // We failed to Initialize the COM Library. Put up error message box
      // saying that COM Library couldn't be initialized.  Parent window
      // is desktop (ie, NULL). Exit the failed application (ie, by
      // returning FALSE to WinMain).
      ErrorBox(hInstance, NULL, IDS_COMINITFAILED);
    }
  }
  else
  {
    // If we were compiled for UNICODE but the platform has problems with
    // this then indicate an error and exit the app immediately.
    CHAR szMsg[MAX_STRING_LENGTH];

    if (LoadStringA(
          hInstance,
          IDS_UNICODEFAIL,
          szMsg,
          MAX_STRING_LENGTH))
    {
      MessageBoxA(
        NULL,
        szMsg,
        ERROR_TITLE_STR,
        MB_OK | MB_ICONEXCLAMATION);
    }
  }

  return iRun;
}

Generated on Wed Nov 13 2024 16:53:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/ExeSkel/ExeSkel.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • ExeSkel
Defines

ExeSkel.h File Reference

Go to the source code of this file.

Defines

#define | IDM_FILE_EXIT 1000
#define | IDM_HELP_ABOUT 1903
#define | IDM_HELP_CONTENTS 1900
#define | IDM_HELP_READSOURCE 1902
#define | IDM_HELP_TUTORIAL 1901
#define | IDS_APPINITFAILED 2001
#define | IDS_ASSERT_FAIL 2200
#define | IDS_COMINITFAILED 2000
#define | IDS_NOTIMPLEMENTED 2301
#define | IDS_OUTOFMEMORY 2002
#define | IDS_UNICODEFAIL 2003
#define | MAIN_WINDOW_CLASS_MENU_STR "EXESKELMenu"
#define | MAIN_WINDOW_CLASS_NAME_STR "EXESKELWindow"
#define | MAIN_WINDOW_TITLE_STR "EXESKEL: Tutorial Code Sample"
#define | OFN_DEFAULTFILES_STR "All Files (*.*)\0*.*\0"
#define | OFN_DEFAULTTITLE_STR "Open File"

Define Documentation

#define IDM_FILE_EXIT 1000

Definition at line 87 of file ExeSkel.h.

#define IDM_HELP_ABOUT 1903

Definition at line 93 of file ExeSkel.h.

#define IDM_HELP_CONTENTS 1900

Definition at line 90 of file ExeSkel.h.

#define IDM_HELP_READSOURCE 1902

Definition at line 92 of file ExeSkel.h.

#define IDM_HELP_TUTORIAL 1901

Definition at line 91 of file ExeSkel.h.

#define IDS_APPINITFAILED 2001

Definition at line 97 of file ExeSkel.h.

#define IDS_ASSERT_FAIL 2200

Definition at line 101 of file ExeSkel.h.

#define IDS_COMINITFAILED 2000

Definition at line 96 of file ExeSkel.h.

#define IDS_NOTIMPLEMENTED 2301

Definition at line 104 of file ExeSkel.h.

#define IDS_OUTOFMEMORY 2002

Definition at line 98 of file ExeSkel.h.

#define IDS_UNICODEFAIL 2003

Definition at line 99 of file ExeSkel.h.

#define MAIN_WINDOW_CLASS_MENU_STR "EXESKELMenu"

Definition at line 80 of file ExeSkel.h.

#define MAIN_WINDOW_CLASS_NAME_STR "EXESKELWindow"

Definition at line 79 of file ExeSkel.h.

#define MAIN_WINDOW_TITLE_STR "EXESKEL: Tutorial Code Sample"

Definition at line 78 of file ExeSkel.h.

#define OFN_DEFAULTFILES_STR "All Files (*.*)\0*.*\0"

Definition at line 83 of file ExeSkel.h.

#define OFN_DEFAULTTITLE_STR "Open File"

Definition at line 84 of file ExeSkel.h.

Generated on Wed Nov 13 2024 16:53:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/FreClien/FreClien.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • FreClien
Functions

FreClien.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <initguid.h>
#include <commdlg.h>
#include <apputil.h>
#include <iball.h>
#include <ballguid.h>
#include "guiball.h"
#include "freclien.h"

Go to the source code of this file.

Functions

BOOL | InitApplication (HINSTANCE hInstance)
BOOL | UnicodeOk (void)
int PASCAL | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

Function Documentation

BOOL InitApplication ( HINSTANCE hInstance )

Definition at line 445 of file FreClien.Cpp.

{
  BOOL bOk;
  // The window class for all instances of the main frame window.
  WNDCLASSEX wcf;

  // Assign the appropriate values for this main frame window class.
  wcf.cbSize        = sizeof(WNDCLASSEX);
  wcf.cbClsExtra    = 0;            // No per-class extra data.
  wcf.cbWndExtra    = 0;            // No per-window extra data.
  wcf.hInstance     = hInstance;    // Application module instance.
  wcf.lpfnWndProc   = &WindowProc;  // Global Window Procedure (defined in
                                    // APPUTIL for all CVirWindows).
  wcf.hCursor       = LoadCursor(NULL, IDC_ARROW); // Load app cursor.
  wcf.hIcon         = (HICON) LoadIcon(            // Load app icon.
                                hInstance,
                                TEXT("AppIcon"));
  wcf.hIconSm       = (HICON) LoadImage(           // Load small icon.
                                hInstance,
                                TEXT("AppIcon"),
                                IMAGE_ICON,
                                16, 16,
                                0);
  wcf.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); // Backgnd color.
  wcf.style         = CS_HREDRAW | CS_VREDRAW;     // Class style(s).
  wcf.lpszClassName = TEXT(MAIN_WINDOW_CLASS_NAME_STR); // Class name.
  wcf.lpszMenuName  = TEXT(MAIN_WINDOW_CLASS_MENU_STR); // Menu name.

  // Register the window class and return FALSE if unsuccesful.
  bOk = RegisterClassEx(&wcf);

  return (bOk);
}

BOOL UnicodeOk ( void )

Definition at line 419 of file FreClien.Cpp.

{
  BOOL bOk = TRUE;
  TCHAR szUserName[MAX_STRING_LENGTH];
  DWORD dwSize = MAX_STRING_LENGTH;

  if (!GetUserName(szUserName, &dwSize))
    bOk = ERROR_CALL_NOT_IMPLEMENTED == GetLastError() ? FALSE : TRUE;

  return bOk;
}

int PASCAL WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 502 of file FreClien.Cpp.

{
  CMainWindow* pWin = NULL;
  MSG msg;
  HACCEL hAccel;
  int iRun = FALSE;

  // If we were compiled for UNICODE and the platform seems OK with this
  // then proceed.  Else we error and exit the app.
  if (UnicodeOk())
  {
    // Call to initialize the COM Library.  Use the SUCCEEDED macro
    // to detect success.  If fail, then exit app with error message.
    // Initialize COM here in the main process thread to establish this
    // main thread as the founder of the multi-thread apartment
    // (MTA) of this process. Other worker free-threads will also live
    // in this multi-threaded apartment. The app can have only one such
    // multi-threaded apartment but could have a mixed model with other
    // single-threaded apartments running. This sample has no other
    // single-threaded apartments.
    if (SUCCEEDED(CoInitializeEx(NULL, COINIT_MULTITHREADED)))
    {
      // Ensure that DCOM (Distributed COM) is installed and enabled.
      if (DComOk())
      {
        // If we succeeded in initializing the COM Library and DCOM is
        // available, we proceed to initialize the application.  If we
        // can't init the application then we signal shut down with
        // an error message exit.
        iRun = InitApplication(hInstance);
        if (iRun)
        {
          // Assume we'll set iRun to TRUE when initialization is done.
          iRun = FALSE;
          // We are still go for running so we try to create a nifty new
          // CMainWindow object for this app instance.
          pWin = new CMainWindow;
          if (NULL != pWin)
          {
            // Now we initialize an instance of the new CMainWindow.
            // This includes creating the main window.
            if (pWin->InitInstance(hInstance, nCmdShow))
            {
              // Load the keyboard accelerators from the resources.
              hAccel = LoadAccelerators(hInstance, TEXT("AppAccel"));
              if (NULL != hAccel)
              {
                // Signal App Initialization is successfully done.
                iRun = TRUE;
              }
            }
          }
        }

        if (iRun)
        {
          // If we initialized the app instance properly then we are still
          // go for running.  We then start up the main message pump for
          // the application.
          while (GetMessage(&msg, NULL, 0, 0))
          {
            if (!TranslateAccelerator(pWin->GetHwnd(), hAccel, &msg))
            {
              TranslateMessage(&msg);
              DispatchMessage(&msg);
            }
          }

          // We also ask COM to unload any unused COM Servers, including our
          // friend, FRESERVE.
          CoFreeUnusedLibraries();

          // We'll pass to Windows the reason why we exited the message loop.
          iRun = (int) msg.wParam;
        }
        else
        {
          // We failed to initialize the application. Put up error message
          // box saying that application couldn't be initialized.  Parent
          // window is desktop (ie, NULL). Exit the failed application
          // (ie, by returning FALSE to WinMain).
          ErrorBox(hInstance, NULL, IDS_APPINITFAILED);

          // Delete the CMainWindow object.
          DELETE_POINTER(pWin);
        }

        // We're exiting this app (either normally or by init failure) so
        // shut down the COM Library.
        CoUninitialize();
      }
      else
      {
        // If DCOM isn't installed or is not enabled, then
        // indicate an error and exit the app immediately.
        ErrorBox(hInstance, NULL, IDS_NODCOM);
      }
    }
    else
    {
      // We failed to Initialize the COM Library. Put up error message
      // box saying that COM Library couldn't be initialized.  Parent
      // window is desktop (ie, NULL). Exit the failed application
      // (ie, by returning FALSE to WinMain).
      ErrorBox(hInstance, NULL, IDS_COMINITFAILED);
    }
  }
  else
  {
    // If we were compiled for UNICODE but the platform has problems with
    // this then indicate an error and exit the app immediately.
    CHAR szMsg[MAX_STRING_LENGTH];

    if (LoadStringA(
          hInstance,
          IDS_NOUNICODE,
          szMsg,
          MAX_STRING_LENGTH))
    {
      MessageBoxA(
        NULL,
        szMsg,
        ERROR_TITLE_STR,
        MB_OK | MB_ICONEXCLAMATION);
    }
  }

  return iRun;
}

Generated on Wed Nov 13 2024 16:53:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/FreClien/FreClien.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • FreClien
Defines

FreClien.h File Reference

Go to the source code of this file.

Defines

#define | IDM_FILE_EXIT 1000
#define | IDM_HELP_ABOUT 1905
#define | IDM_HELP_ABOUTSERVER 1906
#define | IDM_HELP_CONTENTS 1900
#define | IDM_HELP_READSOURCE 1904
#define | IDM_HELP_TUTORIAL 1901
#define | IDM_HELP_TUTSERVER 1902
#define | IDS_APPINITFAILED 2001
#define | IDS_ASSERT_FAIL 2200
#define | IDS_COMINITFAILED 2000
#define | IDS_NODCOM 2004
#define | IDS_NOSERVER 2005
#define | IDS_NOTIMPLEMENTED 2301
#define | IDS_NOUNICODE 2003
#define | IDS_OUTOFMEMORY 2002
#define | MAIN_WINDOW_CLASS_MENU_STR "FRECLIENMenu"
#define | MAIN_WINDOW_CLASS_NAME_STR "FRECLIENWindow"
#define | MAIN_WINDOW_TITLE_STR "FRECLIEN: Tutorial Code Sample"
#define | NOCOMOBJ_ERROR_STR "Can't Create COM Object"
#define | NOTHREAD_ERROR_STR "Can't Create Thread"
#define | OFN_DEFAULTFILES_STR "All Files (*.*)\0*.*\0"
#define | OFN_DEFAULTTITLE_STR "Open File"
#define | SERVER_TUTFILE_STR "freserve.htm"

Define Documentation

#define IDM_FILE_EXIT 1000

Definition at line 98 of file FreClien.h.

#define IDM_HELP_ABOUT 1905

Definition at line 105 of file FreClien.h.

#define IDM_HELP_ABOUTSERVER 1906

Definition at line 106 of file FreClien.h.

#define IDM_HELP_CONTENTS 1900

Definition at line 101 of file FreClien.h.

#define IDM_HELP_READSOURCE 1904

Definition at line 104 of file FreClien.h.

#define IDM_HELP_TUTORIAL 1901

Definition at line 102 of file FreClien.h.

#define IDM_HELP_TUTSERVER 1902

Definition at line 103 of file FreClien.h.

#define IDS_APPINITFAILED 2001

Definition at line 110 of file FreClien.h.

#define IDS_ASSERT_FAIL 2200

Definition at line 116 of file FreClien.h.

#define IDS_COMINITFAILED 2000

Definition at line 109 of file FreClien.h.

#define IDS_NODCOM 2004

Definition at line 113 of file FreClien.h.

#define IDS_NOSERVER 2005

Definition at line 114 of file FreClien.h.

#define IDS_NOTIMPLEMENTED 2301

Definition at line 119 of file FreClien.h.

#define IDS_NOUNICODE 2003

Definition at line 112 of file FreClien.h.

#define IDS_OUTOFMEMORY 2002

Definition at line 111 of file FreClien.h.

#define MAIN_WINDOW_CLASS_MENU_STR "FRECLIENMenu"

Definition at line 84 of file FreClien.h.

#define MAIN_WINDOW_CLASS_NAME_STR "FRECLIENWindow"

Definition at line 83 of file FreClien.h.

#define MAIN_WINDOW_TITLE_STR "FRECLIEN: Tutorial Code Sample"

Definition at line 82 of file FreClien.h.

#define NOCOMOBJ_ERROR_STR "Can't Create COM Object"

Definition at line 91 of file FreClien.h.

#define NOTHREAD_ERROR_STR "Can't Create Thread"

Definition at line 90 of file FreClien.h.

#define OFN_DEFAULTFILES_STR "All Files (*.*)\0*.*\0"

Definition at line 94 of file FreClien.h.

#define OFN_DEFAULTTITLE_STR "Open File"

Definition at line 95 of file FreClien.h.

#define SERVER_TUTFILE_STR "freserve.htm"

Definition at line 87 of file FreClien.h.

Generated on Wed Nov 13 2024 16:53:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/FreClien/GUIBALL.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • FreClien
Functions

GUIBALL.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <apputil.h>
#include <iball.h>
#include <ballguid.h>
#include "guiball.h"
#include "freclien.h"

Go to the source code of this file.

Functions

DWORD WINAPI BallThreadProc (LPARAM lparam)

Function Documentation

DWORD WINAPI BallThreadProc ( LPARAM lparam )

Definition at line 145 of file GUIBALL.Cpp.

{
  CThreadInitData* pInitData = (CThreadInitData*) lparam;
  DWORD nEndCount = 0;
  HRESULT hr;
  BOOL bAlive;

  // Initialize COM for use by this thread. Tell COM this new thread
  // is another free-threaded thread in the multi-threaded apartment.
  hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
  bAlive = SUCCEEDED(hr);

  if (bAlive)
  {
    // Continuously move the ball while it is still alive.
    while (bAlive)
    {
      // Use system timer to slow down the ball motion to the range
      // of the humanly perceptible.
      if (GetTickCount() > nEndCount)
      {
        // After the delay, call from this thread thru IBall interface
        // to move the ball that lives in the single COBall COM object.
        // Set bAlive flag FALSE if the COBall can no longer move.
        hr = pInitData->m_pIBall->Move(TRUE);
        bAlive = (NOERROR == hr);

        // Set new timer end count.
        nEndCount = GetTickCount() + pInitData->m_nDelay;
      }
    }

    // UnInitialize COM for use by this thread.
    CoUninitialize();
  }

  return 0;
}

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/FreClien/GUIBALL.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • FreClien

GUIBALL.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/FreServe/BALL.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • FreServe
Functions

BALL.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <apputil.h>
#include <iball.h>
#include <ballguid.h>
#include "server.h"
#include "ball.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) COBall

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 792 of file BALL.Cpp.

{
  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/FreServe/BALL.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • FreServe

BALL.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/FreServe/Factory.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • FreServe
Functions

Factory.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <apputil.h>
#include <iball.h>
#include <ballguid.h>
#include "server.h"
#include "factory.h"
#include "ball.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CFBall

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 364 of file Factory.Cpp.

{
  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/FreServe/Factory.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • FreServe

Factory.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/FreServe/FreServe.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • FreServe
Defines | Functions | Variables

FreServe.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <initguid.h>
#include <apputil.h>
#include <iball.h>
#include <ballguid.h>
#include "freserve.h"
#include "server.h"
#include "factory.h"

Go to the source code of this file.

Defines

#define | _DLLEXPORT_

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, PPVOID ppv)
BOOL WINAPI | DllMain (HINSTANCE hDllInst, DWORD fdwReason, LPVOID lpvReserved)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)
BOOL | UnicodeOk (void)

Variables

CServer * | g_pServer = NULL

Define Documentation

#define _DLLEXPORT_

Definition at line 64 of file FreServe.Cpp.

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 251 of file FreServe.Cpp.

{
  HRESULT hr;

  // We return S_OK of there are no longer any living objects AND
  // there are no outstanding client locks on this server.
  hr = g_pServer->CanUnloadNow();

  return hr;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | PPVOID | ppv
 | ) |  |

Definition at line 210 of file FreServe.Cpp.

{
  HRESULT hr = CLASS_E_CLASSNOTAVAILABLE;
  IUnknown* pCob = NULL;

  if (CLSID_DllBall == rclsid)
  {
    hr = E_OUTOFMEMORY;
    pCob = new CFBall(NULL, g_pServer);
  }

  if (NULL != pCob)
  {
    g_pServer->ObjectsUp();
    hr = pCob->QueryInterface(riid, ppv);
    if (FAILED(hr))
    {
      g_pServer->ObjectsDown();
      DELETE_POINTER(pCob);
    }
  }

  return hr;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hDllInst,
 |  | DWORD | fdwReason,
 |  | LPVOID | lpvReserved
 | ) |  |

Definition at line 135 of file FreServe.Cpp.

{
  BOOL bResult = TRUE;

  // Dispatch this main call based on the reason it was called.
  switch (fdwReason)
  {
    case DLL_PROCESS_ATTACH:
      // The DLL is being loaded for the first time by a given process.
      // Perform per-process initialization here.  If the initialization
      // is successful, return TRUE; if unsuccessful, return FALSE.
      bResult = FALSE;
      if (UnicodeOk())
      {
        // Instantiate the CServer utility class.
        g_pServer = new CServer;
        if (NULL != g_pServer)
        {
          // Remember the DLL Instance handle.
          g_pServer->m_hDllInst = hDllInst;
          bResult = TRUE;
        }
      }
      break;

    case DLL_PROCESS_DETACH:
      // The DLL is being unloaded by a given process.  Do any
      // per-process clean up here, such as undoing what was done in
      // DLL_PROCESS_ATTACH.  The return value is ignored.
      DELETE_POINTER(g_pServer);
      break;

    case DLL_THREAD_ATTACH:
      // A thread is being created in a process that has already loaded
      // this DLL.  Perform any per-thread initialization here.  The
      // return value is ignored.
      break;

    case DLL_THREAD_DETACH:
      // A thread is exiting cleanly in a process that has already
      // loaded this DLL.  Perform any per-thread clean up here.  The
      // return value is ignored.
      break;

    default:
      break;
  }

  return (bResult);
}

STDAPI DllRegisterServer ( void )

Definition at line 274 of file FreServe.Cpp.

{
  HRESULT  hr = NOERROR;
  TCHAR    szID[GUID_SIZE+1];
  TCHAR    szCLSID[GUID_SIZE+32];
  TCHAR    szModulePath[MAX_PATH];

  // Obtain the path to this module's executable file for later use.
  GetModuleFileName(
    g_pServer->m_hDllInst,
    szModulePath,
    sizeof(szModulePath)/sizeof(TCHAR));

  /*-------------------------------------------------------------------------
    Create registry entries for the DllBall Component.
  -------------------------------------------------------------------------*/
  // Create some base key strings.
  StringFromGUID2(CLSID_DllBall, szID, GUID_SIZE);
  lstrcpyn(szCLSID, TEXT("CLSID\\"), sizeof(szCLSID)/sizeof(TCHAR));
  lstrncat(szCLSID, szID, sizeof(szCLSID)/sizeof(TCHAR) - lstrlen(szCLSID));

  // Create ProgID keys.
  SetRegKeyValue(
    TEXT("CTS.DllBall.1"),
    NULL,
    TEXT("DllBall Component - FRESERVE Code Sample"));
  SetRegKeyValue(
    TEXT("CTS.DllBall.1"),
    TEXT("CLSID"),
    szID);

  // Create VersionIndependentProgID keys.
  SetRegKeyValue(
    TEXT("CTS.DllBall"),
    NULL,
    TEXT("DllBall Component - FRESERVE Code Sample"));
  SetRegKeyValue(
    TEXT("CTS.DllBall"),
    TEXT("CurVer"),
    TEXT("CTS.DllBall.1"));
  SetRegKeyValue(
    TEXT("CTS.DllBall"),
    TEXT("CLSID"),
    szID);

  // Create entries under CLSID.
  SetRegKeyValue(
    szCLSID,
    NULL,
    TEXT("DllBall Component - FRESERVE Code Sample"));
  SetRegKeyValue(
    szCLSID,
    TEXT("ProgID"),
    TEXT("CTS.DllBall.1"));
  SetRegKeyValue(
    szCLSID,
    TEXT("VersionIndependentProgID"),
    TEXT("CTS.DllBall"));
  SetRegKeyValue(
    szCLSID,
    TEXT("NotInsertable"),
    NULL);
  SetRegKeyValue(
    szCLSID,
    TEXT("InprocServer32"),
    szModulePath);
  AddRegNamedValue(
    szCLSID,
    TEXT("InprocServer32"),
    TEXT("ThreadingModel"),
    TEXT("Both"));

  return hr;
}

STDAPI DllUnregisterServer ( void )

Definition at line 361 of file FreServe.Cpp.

{
  HRESULT  hr = NOERROR;
  TCHAR    szID[GUID_SIZE+1];
  TCHAR    szCLSID[GUID_SIZE+32];
  TCHAR    szTemp[MAX_PATH+GUID_SIZE];

  /*-------------------------------------------------------------------------
    Delete registry entries for the Ball Component.
  -------------------------------------------------------------------------*/
  //Create some base key strings.
  StringFromGUID2(CLSID_DllBall, szID, GUID_SIZE);
  lstrcpyn(szCLSID, TEXT("CLSID\\"), sizeof(szCLSID)/sizeof(TCHAR));
  lstrncat(szCLSID, szID, sizeof(szCLSID)/sizeof(TCHAR) - lstrlen(szCLSID));

  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.DllBall\\CurVer"));
  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.DllBall\\CLSID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.DllBall"));

  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.DllBall.1\\CLSID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.DllBall.1"));

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("ProgID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("VersionIndependentProgID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("NotInsertable"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("InprocServer32"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  RegDeleteKey(HKEY_CLASSES_ROOT, szCLSID);

  return hr;
}

BOOL UnicodeOk ( void )

Definition at line 88 of file FreServe.Cpp.

{
  BOOL bOk = TRUE;
  TCHAR szUserName[MAX_STRING_LENGTH];
  DWORD dwSize = MAX_STRING_LENGTH;

  if (!GetUserName(szUserName, &dwSize))
    bOk = ERROR_CALL_NOT_IMPLEMENTED == GetLastError() ? FALSE : TRUE;

  return bOk;
}

Variable Documentation

CServer* g_pServer = NULL

Definition at line 74 of file FreServe.Cpp.

Generated on Wed Nov 13 2024 16:53:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/FreServe/FreServe.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • FreServe
Defines | Functions

FreServe.h File Reference

Go to the source code of this file.

Defines

#define | DLLENTRY extern __declspec(dllimport)
#define | STDENTRY DLLENTRY HRESULT WINAPI
#define | STDENTRY_(type) DLLENTRY type WINAPI

Functions

STDENTRY | DllRegisterServer (void)
STDENTRY | DllUnregisterServer (void)

Define Documentation

#define DLLENTRY extern __declspec(dllimport)

Definition at line 47 of file FreServe.h.

#define STDENTRY DLLENTRY HRESULT WINAPI

Definition at line 49 of file FreServe.h.

#define STDENTRY_ ( type ) DLLENTRY type WINAPI

Definition at line 50 of file FreServe.h.

Function Documentation

STDENTRY DllRegisterServer ( void )

Definition at line 69 of file ComSpyAudit.Cpp.

{
  // registers object, typelib and all interfaces in typelib
  return _Module.RegisterServer(TRUE);
}

STDENTRY DllUnregisterServer ( void )

Definition at line 78 of file ComSpyAudit.Cpp.

{
  _Module.UnregisterServer();
  return S_OK;
}

Generated on Wed Nov 13 2024 16:53:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/FreServe/Server.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • FreServe

Server.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <apputil.h>
#include "server.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/FreServe/Server.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • FreServe
Defines | Variables

Server.h File Reference

Go to the source code of this file.

Defines

#define IDS_ASSERT_FAIL 2200

Variables

CServer * g_pServer

Define Documentation

#define IDS_ASSERT_FAIL 2200

Definition at line 43 of file Server.h.

Variable Documentation

CServer* g_pServer

Definition at line 78 of file AptServe.Cpp.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/Inc/AppUtil.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • Inc
Defines | Typedefs | Enumerations | Functions

AppUtil.h File Reference

#include <assert.h>

Go to the source code of this file.

Defines

#define | ASSERT(condition)
#define | ASSERTFAIL_ERROR_STR "Assertion Failed."
#define | CKHR(Pfx, Ec)
#define | COLOR_SCALE_BLUE 3
#define | COLOR_SCALE_GRAY 4
#define | COLOR_SCALE_GREEN 2
#define | COLOR_SCALE_RED 1
#define | DEBUG_FMT_CHARS 8
#define | DELAYBOX_DURATION 3000
#define | DELETE_POINTER(p)
#define | EDITOR_EXE_STR "notepad.exe "
#define | ERROR_TITLE_STR "-Error-"
#define | GETCLASSBRUSH(hWnd) (HBRUSH)GetClassLong(hWnd,GCL_HBRBACKGROUND)
#define | GETINSTANCE(hWnd) (HANDLE)GetWindowLong(hWnd,GWL_HINSTANCE)
#define | GUID_SIZE 128
#define | HELP_FILE_EXT ".htm"
#define | HTML_FILE_EXT ".htm"
#define | LICENSE_FILE_EXT ".lic"
#define | LOG(sMsg)
#define | LOGASSERT(condition)
#define | LOGERROR(Pfx, Ec)
#define | LOGF1(sFmt, x)
#define | LOGF2(sFmt, x, y)
#define | LOGF3(sFmt, x, y, z)
#define | LOGID(id)
#define | lstrncat(strDest, strSource, count) strncat(strDest,strSource,count)
#define | MAX_LINE_CHARS 5
#define | MAX_LINE_NUM 99999
#define | MAX_LOG_LINES 500
#define | MAX_STRING_LENGTH 256
#define | MAXLOGST MAX_PATH + MAX_LINE_CHARS + DEBUG_FMT_CHARS
#define | NOBROWSE_ERROR_STR "Can't run browser."
#define | NOCOM_ERROR_STR "Can't Init COM."
#define | NOEDITOR_ERROR_STR "Can't run editor."
#define | NOHTM_ERROR_STR "Can't find .HTM file."
#define | NOTICE_TITLE_STR "-Notice-"
#define | NOTUTORIAL_ERROR_STR "Can't run tutorial."
#define | NOTXT_ERROR_STR "Can't find .TXT file."
#define | ODF1(sFmt, x)
#define | ODF2(sFmt, x, y)
#define | ODF3(sFmt, x, y, z)
#define | ODS(x)
#define | OFN_SOURCEFILES_STR "Source Files (*.CPP;*.H;*.RC;*.C;*.MAK;*.TXT;*.)\0*.CPP;*.H;*.RC;*.C;*.MAK;*.TXT;makefile\0"
#define | OFN_SOURCETITLE_STR "Open Source File"
#define | RELEASE_INTERFACE(p)
#define | StgCreateDocfile(a, b, c, d) A_StgCreateDocfile(a, b, c, d)
#define | StgIsStorageFile(a) A_StgIsStorageFile(a)
#define | StgOpenStorage(a, b, c, d, e, f) A_StgOpenStorage(a, b, c, d, e, f)
#define | StringFromGUID2(a, b, c) A_StringFromGUID2(a, b, c)
#define | TID GetCurrentThreadId()
#define | TUTORIAL_EXE_STR "tutorial.exe "
#define | TXT_FILE_EXT ".txt"
#define | WriteFmtUserTypeStg(a, b, c) A_WriteFmtUserTypeStg(a, b, c)

Typedefs

typedef unsigned(WINAPI * | PCRTTHREADPROC )(LPVOID pThreadProc)
typedef LPVOID * | PPVOID

Enumerations

enum PERSTGSTATE {
PERS_UNINIT = 0, PERS_SCRIBBLE, PERS_NOSCRIBBLE, PERS_HANDSOFF,
PERS_UNINIT = 0, PERS_SCRIBBLE, PERS_NOSCRIBBLE, PERS_HANDSOFF
}

Functions

STDAPI | A_StgCreateDocfile (LPSTR, DWORD, DWORD, IStorage **)
STDAPI | A_StgIsStorageFile (LPSTR)
STDAPI | A_StgOpenStorage (LPSTR, IStorage *, DWORD, SNB, DWORD, IStorage **)
STDAPI | A_StringFromGUID2 (REFGUID, LPSTR, int)
STDAPI | A_WriteFmtUserTypeStg (IStorage *, CLIPFORMAT, LPSTR)
BOOL | AddRegNamedValue (LPTSTR pszKey, LPTSTR pszSubkey, LPTSTR pszValueName, LPTSTR pszValue)
HRESULT | AnsiToUc (LPSTR pszAnsi, LPWSTR pszUc, int cch)
BOOL CmdExec (LPTSTR szCmd)
HPALETTE | CreateColorScalePalette (HWND hDC, int nColor)
BOOL | DComOk (void)
BOOL CALLBACK | DialogProc (HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
BOOL | FileExist (TCHAR *szFileName)
BOOL | GetErrorMsg (HRESULT hr, LPTSTR pszMsg, UINT uiSize)
BOOL | GetExeName (HINSTANCE hInst, TCHAR *pszExeName)
void | GoWeb (HINSTANCE hInst, LPSTR pszTarget)
void | HrMsg (HWND hWndOwner, LPTSTR pszTitle, HRESULT hr)
void | HrMsgId (HINSTANCE hInst, HWND hWndOwner, INT iStringID, HRESULT hr)
DWORD | lRandom (void)
BOOL | MakeFamilyPath (HINSTANCE hInst, TCHAR *pszNewPath, TCHAR *pszFileExt)
void | OutputDebugFmt (LPTSTR szFmt,...)
VOID | PaintWindow (HWND hWnd, int nColor)
void | ReadHelp (HWND hWndOwner, LPTSTR pszHelpFile)
void | ReadSource (HWND hWndOwner, OPENFILENAME *pOfn)
void | ReadTutorial (HINSTANCE hInst, HWND hWndOwner, LPTSTR pszHTMLFile)
BOOL | SetRegKeyValue (LPTSTR pszKey, LPTSTR pszSubkey, LPTSTR pszValue)
LPSTR | SkipAnsi (LPSTR psz, BOOL bSkipWhite)
HRESULT | UcToAnsi (LPWSTR pwszUc, LPSTR pszAnsi, int cch)
LRESULT CALLBACK | WindowProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)

Define Documentation

#define ASSERT ( condition )

Definition at line 1410 of file AppUtil.h.

#define ASSERTFAIL_ERROR_STR "Assertion Failed."

Definition at line 138 of file AppUtil.h.

#define CKHR | ( | Pfx,
 |  | Ec
 | ) |

Definition at line 1412 of file AppUtil.h.

#define COLOR_SCALE_BLUE 3

Definition at line 123 of file AppUtil.h.

#define COLOR_SCALE_GRAY 4

Definition at line 124 of file AppUtil.h.

#define COLOR_SCALE_GREEN 2

Definition at line 122 of file AppUtil.h.

#define COLOR_SCALE_RED 1

Definition at line 121 of file AppUtil.h.

#define DEBUG_FMT_CHARS 8

Definition at line 116 of file AppUtil.h.

#define DELAYBOX_DURATION 3000

Definition at line 119 of file AppUtil.h.

#define DELETE_POINTER ( p )
Value:
{\
  if (NULL != p)\
  {\
    delete p;\
    p = NULL;\
  }\
}

Definition at line 76 of file AppUtil.h.

#define EDITOR_EXE_STR "notepad.exe "

Definition at line 126 of file AppUtil.h.

#define ERROR_TITLE_STR "-Error-"

Definition at line 131 of file AppUtil.h.

#define GETCLASSBRUSH ( hWnd ) (HBRUSH)GetClassLong(hWnd,GCL_HBRBACKGROUND)

Definition at line 108 of file AppUtil.h.

#define GETINSTANCE ( hWnd ) (HANDLE)GetWindowLong(hWnd,GWL_HINSTANCE)

Definition at line 107 of file AppUtil.h.

#define GUID_SIZE 128

Definition at line 112 of file AppUtil.h.

#define HELP_FILE_EXT ".htm"

Definition at line 139 of file AppUtil.h.

#define HTML_FILE_EXT ".htm"

Definition at line 140 of file AppUtil.h.

#define LICENSE_FILE_EXT ".lic"

Definition at line 142 of file AppUtil.h.

#define LOG ( sMsg )
Value:
{\
  if (NULL!=g_pMsgLog)\
    g_pMsgLog->Msg(TEXT(sMsg));\
}

Definition at line 1414 of file AppUtil.h.

#define LOGASSERT ( condition )
Value:
{\
  if (!(condition))\
    LOGID(IDS_ASSERT_FAIL);\
}

Definition at line 1463 of file AppUtil.h.

#define LOGERROR | ( | Pfx,
 |  | Ec
 | ) |
Value:
{\
  TCHAR szMsg[MAX_PATH];\
  if (NULL!=g_pMsgLog && GetErrorMsg(Ec,szMsg,MAX_PATH))\
    g_pMsgLog->MsgFmt(TEXT("%s Error=0x%X: %s"),TEXT(Pfx),Ec,szMsg);\
}

Definition at line 1447 of file AppUtil.h.

#define LOGF1 | ( | sFmt,
 |  | x
 | ) |
Value:
{\
  if (NULL!=g_pMsgLog)\
    g_pMsgLog->MsgFmt(TEXT(sFmt),x);\
}

Definition at line 1422 of file AppUtil.h.

#define LOGF2 | ( | sFmt,
 |  | x,
 |  | y
 | ) |
Value:
{\
  if (NULL!=g_pMsgLog)\
    g_pMsgLog->MsgFmt(TEXT(sFmt),x,y);\
}

Definition at line 1430 of file AppUtil.h.

#define LOGF3 | ( | sFmt,
 |  | x,
 |  | y,
 |  | z
 | ) |
Value:
{\
  if (NULL!=g_pMsgLog)\
    g_pMsgLog->MsgFmt(TEXT(sFmt),x,y,z);\
}

Definition at line 1438 of file AppUtil.h.

#define LOGID ( id )
Value:
{\
  if (NULL!=g_pMsgLog)\
    g_pMsgLog->MsgID(id);\
}

Definition at line 1456 of file AppUtil.h.

#define lstrncat | ( | strDest,
 |  | strSource,
 |  | count |
 | ) |  | strncat(strDest,strSource,count)

Definition at line 1193 of file AppUtil.h.

#define MAX_LINE_CHARS 5

Definition at line 115 of file AppUtil.h.

#define MAX_LINE_NUM 99999

Definition at line 114 of file AppUtil.h.

#define MAX_LOG_LINES 500

Definition at line 118 of file AppUtil.h.

#define MAX_STRING_LENGTH 256

Definition at line 113 of file AppUtil.h.

#define MAXLOGST MAX_PATH + MAX_LINE_CHARS + DEBUG_FMT_CHARS

Definition at line 117 of file AppUtil.h.

#define NOBROWSE_ERROR_STR "Can't run browser."

Definition at line 137 of file AppUtil.h.

#define NOCOM_ERROR_STR "Can't Init COM."

Definition at line 132 of file AppUtil.h.

#define NOEDITOR_ERROR_STR "Can't run editor."

Definition at line 133 of file AppUtil.h.

#define NOHTM_ERROR_STR "Can't find .HTM file."

Definition at line 136 of file AppUtil.h.

#define NOTICE_TITLE_STR "-Notice-"

Definition at line 130 of file AppUtil.h.

#define NOTUTORIAL_ERROR_STR "Can't run tutorial."

Definition at line 134 of file AppUtil.h.

#define NOTXT_ERROR_STR "Can't find .TXT file."

Definition at line 135 of file AppUtil.h.

#define ODF1 | ( | sFmt,
 |  | x
 | ) |

Definition at line 1404 of file AppUtil.h.

#define ODF2 | ( | sFmt,
 |  | x,
 |  | y
 | ) |

Definition at line 1406 of file AppUtil.h.

#define ODF3 | ( | sFmt,
 |  | x,
 |  | y,
 |  | z
 | ) |

Definition at line 1408 of file AppUtil.h.

#define ODS ( x )

Definition at line 1402 of file AppUtil.h.

#define OFN_SOURCEFILES_STR "Source Files (*.CPP;*.H;*.RC;*.C;*.MAK;*.TXT;*.)\0*.CPP;*.H;*.RC;*.C;*.MAK;*.TXT;makefile\0"

Definition at line 128 of file AppUtil.h.

#define OFN_SOURCETITLE_STR "Open Source File"

Definition at line 129 of file AppUtil.h.

#define RELEASE_INTERFACE ( p )
Value:
{\
  IUnknown* pTmp = (IUnknown*)p;\
  p = NULL;\
  if (NULL != pTmp)\
    pTmp->Release();\
}

Definition at line 85 of file AppUtil.h.

#define StgCreateDocfile | ( | a,
 |  | b,
 |  | c,
 |  | d |
 | ) |  | A_StgCreateDocfile(a, b, c, d)

Definition at line 793 of file AppUtil.h.

#define StgIsStorageFile ( a ) A_StgIsStorageFile(a)

Definition at line 790 of file AppUtil.h.

#define StgOpenStorage | ( | a,
 |  | b,
 |  | c,
 |  | d,
 |  | e,
 |  | f |
 | ) |  | A_StgOpenStorage(a, b, c, d, e, f)

Definition at line 796 of file AppUtil.h.

#define StringFromGUID2 | ( | a,
 |  | b,
 |  | c |
 | ) |  | A_StringFromGUID2(a, b, c)

Definition at line 784 of file AppUtil.h.

#define TID GetCurrentThreadId()

Definition at line 1196 of file AppUtil.h.

#define TUTORIAL_EXE_STR "tutorial.exe "

Definition at line 127 of file AppUtil.h.

#define TXT_FILE_EXT ".txt"

Definition at line 141 of file AppUtil.h.

#define WriteFmtUserTypeStg | ( | a,
 |  | b,
 |  | c |
 | ) |  | A_WriteFmtUserTypeStg(a, b, c)

Definition at line 787 of file AppUtil.h.

Typedef Documentation

typedef unsigned(WINAPI * PCRTTHREADPROC)(LPVOID pThreadProc)

Definition at line 105 of file AppUtil.h.

typedef LPVOID* PPVOID

Definition at line 70 of file AppUtil.h.

Enumeration Type Documentation

enum PERSTGSTATE
Enumerator:
PERS_UNINIT
PERS_SCRIBBLE
PERS_NOSCRIBBLE
PERS_HANDSOFF
PERS_UNINIT
PERS_SCRIBBLE
PERS_NOSCRIBBLE
PERS_HANDSOFF

Definition at line 95 of file AppUtil.h.

{
  PERS_UNINIT = 0,  // Uninitialized.
  PERS_SCRIBBLE,    // Write     permitted; Read     permitted.
  PERS_NOSCRIBBLE,  // Write NOT permitted; Read     permitted.
  PERS_HANDSOFF     // Write NOT permitted; Read NOT permitted.
} PERSTGSTATE;

Function Documentation

STDAPI A_StgCreateDocfile | ( | LPSTR | ,
 |  | DWORD | ,
 |  | DWORD | ,
 |  | IStorage ** |
 | ) |  |

Definition at line 230 of file AppUtil.Cpp.

{
  HRESULT hr = E_INVALIDARG;
  WCHAR wszUc[MAX_PATH];
  LPWSTR pwszUc = NULL;

  // Null the caller's output variable.
  *ppIStorage = NULL;

  if (NULL != pszFileName)
  {
    AnsiToUc(pszFileName, wszUc, MAX_PATH);
    pwszUc = wszUc;
  }

  hr = StgCreateDocfile(pwszUc, dwAccessMode, reserved, ppIStorage);

  return hr;
}

STDAPI A_StgIsStorageFile ( LPSTR )

Definition at line 209 of file AppUtil.Cpp.

{
  HRESULT hr = E_INVALIDARG;
  WCHAR wszUc[MAX_PATH];

  if (NULL != pszFileName)
  {
    AnsiToUc(pszFileName, wszUc, MAX_PATH);
    hr = StgIsStorageFile(wszUc);
  }

  return hr;
}

STDAPI A_StgOpenStorage | ( | LPSTR | ,
 |  | IStorage * | ,
 |  | DWORD | ,
 |  | SNB | ,
 |  | DWORD | ,
 |  | IStorage ** |
 | ) |  |

Definition at line 260 of file AppUtil.Cpp.

{
  HRESULT hr = E_INVALIDARG;
  WCHAR wszUc[MAX_PATH];
  LPWSTR pwszUc = NULL;

  // Null the caller's output variable.
  *ppIStorage = NULL;

  if (NULL != pszFileName)
  {
    AnsiToUc(pszFileName, wszUc, MAX_PATH);
    pwszUc = wszUc;
  }

  hr = StgOpenStorage(
         pwszUc,
         pIStorage,
         dwAccessMode,
         snbExclude,
         reserved,
         ppIStorage);

  return hr;
}

STDAPI A_StringFromGUID2 | ( | REFGUID | ,
 |  | LPSTR | ,
 |  | int |
 | ) |  |

Definition at line 152 of file AppUtil.Cpp.

{
  HRESULT hr = E_INVALIDARG;
  LPWSTR  pszUc;
  IMalloc* pIMalloc;

  if (NULL != pszGUID && 0 < cch)
  {
    hr = CoGetMalloc(MEMCTX_TASK, &pIMalloc);
    if (SUCCEEDED(hr))
    {
      pszUc = (LPWSTR)pIMalloc->Alloc((cch+1)*sizeof(TCHAR));
      pIMalloc->Release();
      if (NULL != pszUc)
      {
        hr = StringFromGUID2(guid, pszUc, cch);
        if (SUCCEEDED(hr))
          hr = UcToAnsi(pszUc, pszGUID, cch);
        CoTaskMemFree((void *)pszUc);
      }
      else
        hr = E_OUTOFMEMORY;
    }
  }

  return hr;
}

STDAPI A_WriteFmtUserTypeStg | ( | IStorage * | ,
 |  | CLIPFORMAT | ,
 |  | LPSTR |
 | ) |  |

Definition at line 186 of file AppUtil.Cpp.

{
  HRESULT hr = E_INVALIDARG;
  WCHAR wszUc[MAX_PATH];

  if (NULL != pszUserType)
  {
    AnsiToUc(pszUserType, wszUc, MAX_PATH);
    hr = WriteFmtUserTypeStg(pIStorage, ClipFmt, wszUc);
  }

  return hr;
}

BOOL AddRegNamedValue | ( | LPTSTR | pszKey,
 |  | LPTSTR | pszSubkey,
 |  | LPTSTR | pszValueName,
 |  | LPTSTR | pszValue
 | ) |  |

Definition at line 2811 of file AppUtil.Cpp.

{
  BOOL bOk = FALSE;
  LONG ec;
  HKEY hKey;
  TCHAR szKey[MAX_STRING_LENGTH];

  lstrcpyn(szKey, pszKey, MAX_STRING_LENGTH);

  if (NULL != pszSubkey)
  {
    lstrncat(szKey, TEXT("\\"), MAX_STRING_LENGTH - lstrlen(szKey));
    lstrncat(szKey, pszSubkey, MAX_STRING_LENGTH - lstrlen(szKey));
  }

  ec = RegOpenKeyEx(
         HKEY_CLASSES_ROOT,
         szKey,
         0,
         KEY_ALL_ACCESS,
         &hKey);

  if (NULL != pszValue && ERROR_SUCCESS == ec)
  {
    ec = RegSetValueEx(
           hKey,
           pszValueName,
           0,
           REG_SZ,
           (BYTE *)pszValue,
           (lstrlen(pszValue)+1)*sizeof(TCHAR));
    if (ERROR_SUCCESS == ec)
      bOk = TRUE;
    RegCloseKey(hKey);
  }

  return bOk;
}

HRESULT AnsiToUc | ( | LPSTR | pszAnsi,
 |  | LPWSTR | pszUc,
 |  | int | cch
 | ) |  |

Definition at line 80 of file AppUtil.Cpp.

{
  HRESULT hr = E_POINTER;
  int cOut;

  assert(cch > 0);

  if (NULL != pszAnsi && NULL != pwszUc)
  {
    cOut = MultiByteToWideChar(CP_ACP, 0, pszAnsi, -1, pwszUc, cch);

    if (0 != cOut)
      hr = NOERROR;
    else
      hr = E_FAIL;
  }

  return hr;
}

BOOL CmdExec ( LPTSTR szCmd )

Definition at line 690 of file AppUtil.Cpp.

{
  BOOL bOk;
  STARTUPINFO si;
  PROCESS_INFORMATION pi;

  // Execute the command with a call to the CreateProcess API call.
  memset(&si,0,sizeof(STARTUPINFO));
  si.cb = sizeof(STARTUPINFO);
  si.wShowWindow = SW_SHOW;
  bOk = CreateProcess(NULL,szCmd,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi);
  CloseHandle(pi.hThread);
  CloseHandle(pi.hProcess);

  return bOk;
}

HPALETTE CreateColorScalePalette | ( | HWND | hDC,
 |  | int | nColor
 | ) |  |
BOOL DComOk ( void )

Definition at line 309 of file AppUtil.Cpp.

{
  BOOL bOk = FALSE;

  if (NULL != GetProcAddress(
                GetModuleHandle(TEXT("OLE32")),
                "CoInitializeEx"))
    bOk = TRUE;

  return(bOk);
}

BOOL CALLBACK DialogProc | ( | HWND | hWndDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 1311 of file AppUtil.Cpp.

{
  // Get a pointer to the window class object.
  CVirDialog* pdlg = (CVirDialog*) GetWindowLongPtr(hWndDlg, GWLP_USERDATA);

  switch (uMsg)
  {
    case WM_INITDIALOG:
      // Get a pointer to the window class object.
      pdlg = (CVirDialog*) lParam;

      // Assign the m_hWnd member variable.
      pdlg->m_hWnd = hWndDlg;

      // Set the USERDATA word to point to the class object.
      SetWindowLongPtr(hWndDlg, GWLP_USERDATA, (INT_PTR) pdlg);
      break;

    default:
      break;
  }

  // Call its message proc method.
  if (pdlg != (CVirDialog *) 0)
    return (pdlg->DialogProc(hWndDlg, uMsg, wParam, lParam));
  else
    return (FALSE);
}

BOOL FileExist ( TCHAR * szFileName )

Definition at line 562 of file AppUtil.Cpp.

{
  BOOL bExist = FALSE;
  HANDLE hFile;

  if (NULL != pszFileName)
  {
    // Use the preferred Win32 API call and not the older OpenFile.
    hFile = CreateFile(
              pszFileName,
              GENERIC_READ,
              FILE_SHARE_READ | FILE_SHARE_WRITE,
              NULL,
              OPEN_EXISTING,
              0,
              0);

    if (hFile != INVALID_HANDLE_VALUE)
    {
      // If the handle is valid then the file exists.
      CloseHandle(hFile);
      bExist = TRUE;
    }
  }

  return (bExist);
}

BOOL GetErrorMsg | ( | HRESULT | hr,
 |  | LPTSTR | pszMsg,
 |  | UINT | uiSize
 | ) |  |

Definition at line 725 of file AppUtil.Cpp.

{
  BOOL bErr = FAILED(hr);
  DWORD dwSize;

  if (bErr)
  {
    memset(pszMsg, 0, uiSize * sizeof(TCHAR));

    dwSize = FormatMessage(
      FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM,
      NULL,
      hr,
      MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL),
      pszMsg,
      uiSize,
      NULL);
    if (dwSize>2)
    {
      // Take out the trailing CRLF.
      pszMsg[--dwSize] = 0;
      pszMsg[--dwSize] = 0;
    }
  }

  return bErr;
}

BOOL GetExeName | ( | HINSTANCE | hInst,
 |  | TCHAR * | pszExeName
 | ) |  |

Definition at line 652 of file AppUtil.Cpp.

{
  BOOL bOk = FALSE;
  TCHAR  szPath[MAX_PATH];
  TCHAR  szName[64];
  TCHAR  szFileExt[64];

  if (NULL != pszExeName)
  {
    pszExeName[0] = 0;

    bOk = (0 != GetModuleFileName(hInst, szPath, MAX_PATH));
    if (bOk)
    {
      _tsplitpath(szPath, NULL, NULL, szName, szFileExt);
      lstrcpyn(pszExeName, szName, MAX_PATH);
      lstrncat(pszExeName, szFileExt, MAX_PATH - lstrlen(pszExeName));
    }
  }

  return bOk;
}

void GoWeb | ( | HINSTANCE | hInst,
 |  | LPSTR | pszTarget
 | ) |  |

Definition at line 1012 of file AppUtil.Cpp.

{
  INT_PTR iRes;
  BOOL bOk = FALSE;
  LPTSTR pszNew;
  TCHAR  szNew[MAX_PATH];
  TCHAR  szWork[MAX_PATH];

  szNew[0] = 0;
  pszNew = (LPTSTR) &szNew[0];

#if defined(UNICODE)
  AnsiToUc(pszTarget, pszNew, MAX_PATH);
#else
  lstrcpyn(pszNew, pszTarget, MAX_PATH);
#endif

  if (NULL == pszTarget)
    ReadTutorial(hInst, NULL, NULL);
  else if ('/' == *pszNew)
  {
    lstrcpyn(szWork, TEXT("http:"), MAX_PATH);
    lstrncat(szWork, pszNew, MAX_PATH - lstrlen(szWork));
    pszNew = szWork;
    bOk = TRUE;
  }
  else
  {
    // First check if the .HTM file is there at all.
    bOk = FileExist(pszNew);
    if (!bOk)
    {
      // If the .HTM file doesn't exist the put up an error box.
      iRes = MessageBox(
               NULL,
               TEXT(NOHTM_ERROR_STR),
               TEXT(ERROR_TITLE_STR),
               MB_OK | MB_ICONEXCLAMATION);
    }
  }

  if (bOk)
  {
    // Use shell to invoke web browser on the readme HTML file.
    iRes = (INT_PTR) ShellExecute(NULL, NULL, pszNew, NULL, NULL, 0);
    if (iRes <= 32)
    {
      // If unable to browse then put up an error box.
      HrMsg(NULL, TEXT(NOBROWSE_ERROR_STR), E_FAIL);
    }
  }

  return;
}

void HrMsg | ( | HWND | hWndOwner,
 |  | LPTSTR | pszTitle,
 |  | HRESULT | hr
 | ) |  |

Definition at line 775 of file AppUtil.Cpp.

{
  TCHAR szMsg[MAX_PATH];
  TCHAR szErrMsg[MAX_PATH];
  int iResult;

  wsprintf(szMsg, TEXT("Error=0x%X:\r\n"), hr);
  GetErrorMsg(hr, szErrMsg, MAX_PATH);
  lstrncat(szMsg, szErrMsg, MAX_PATH - lstrlen(szMsg));
  iResult = MessageBox(
              hWndOwner,
              szMsg,
              pszTitle,
              MB_OK | MB_ICONEXCLAMATION);

  return;
}

void HrMsgId | ( | HINSTANCE | hInst,
 |  | HWND | hWndOwner,
 |  | INT | iStringID,
 |  | HRESULT | hr
 | ) |  |

Definition at line 819 of file AppUtil.Cpp.

{
  TCHAR szMsg[MAX_STRING_LENGTH];

  // Load the error message string from the resources.
  if (LoadString(
        hInst,
        iStringID,
        szMsg,
        MAX_STRING_LENGTH))
  {
    // Put up error message box with the retrieved error string message.
    HrMsg(hWndOwner, szMsg, hr);
  }

  return;
}

DWORD lRandom ( void )

Definition at line 332 of file AppUtil.Cpp.

{
  static DWORD glSeed = (DWORD)-365387184;

  glSeed *= 69069;

  return(++glSeed);
}

BOOL MakeFamilyPath | ( | HINSTANCE | hInst,
 |  | TCHAR * | pszNewPath,
 |  | TCHAR * | pszFileExt
 | ) |  |

Definition at line 608 of file AppUtil.Cpp.

{
  BOOL bOk = FALSE;
  TCHAR  szPath[MAX_PATH];
  TCHAR  szDrive[64];
  TCHAR  szDir[MAX_PATH];
  TCHAR  szName[64];

  if (NULL != pszNewPath)
  {
    pszNewPath[0] = 0;

    bOk = (0 != GetModuleFileName(hInst, szPath, MAX_PATH));
    if (bOk)
    {
      _tsplitpath(szPath, szDrive, szDir, szName, NULL);
      lstrcpyn(pszNewPath, szDrive, MAX_PATH);
      lstrncat(pszNewPath, szDir, MAX_PATH - lstrlen(pszNewPath));
      lstrncat(pszNewPath, szName, MAX_PATH - lstrlen(pszNewPath));
      lstrncat(pszNewPath, pszFileExt, MAX_PATH - lstrlen(pszNewPath));
    }
  }

  return bOk;
}

void OutputDebugFmt | ( | LPTSTR | szFmt,
 |  |  | ...
 | ) |  |

Definition at line 1138 of file AppUtil.Cpp.

{
  va_list arglist;
  va_start(arglist, pszFmt);
  TCHAR szMsg[MAX_STRING_LENGTH];

  // Use the format string and arguments to format the content text.
  wvsprintf(szMsg, pszFmt, arglist);
  // Output the newly formated message string to the debugger display.
  OutputDebugString(szMsg);

  return;
}

VOID PaintWindow | ( | HWND | hWnd,
 |  | int | nColor
 | ) |  |

Definition at line 451 of file AppUtil.Cpp.

{
  HDC         hDC;
  int         nMapMode,idx,nSize,nReserved,nLoop;
  RECT        rect;
  HBRUSH      hBrush;
  PAINTSTRUCT ps;
  HPALETTE    hPal;

  if(hDC = BeginPaint(hWnd,&ps))
  {
    GetClientRect(hWnd,&rect);
    nMapMode = SetMapMode(hDC,MM_ANISOTROPIC);

    if(GetDeviceCaps(hDC,RASTERCAPS) & RC_PALETTE)
    {
      nReserved = GetDeviceCaps(hDC,NUMRESERVED);
      nSize     = GetDeviceCaps(hDC,SIZEPALETTE) - nReserved;

      if(hPal = CreateColorScalePalette(hDC,nColor))
      {
        hPal = SelectPalette(hDC,hPal,FALSE);
        RealizePalette(hDC);

        SetWindowExtEx(hDC,nSize,nSize,NULL);
        SetViewportExtEx(hDC,rect.right,-rect.bottom,NULL);
        SetViewportOrgEx(hDC,0,rect.bottom,NULL);

        nLoop = nSize >> 1;
        for(idx=0; idx < nLoop; idx++)
        {
          hBrush = CreateSolidBrush(PALETTEINDEX(idx+nLoop));
          SetRect(&rect,idx,idx,nSize-idx,nSize-idx);
          FillRect(hDC,&rect,hBrush);
          DeleteObject(hBrush);
        }
        DeleteObject(SelectPalette(hDC,hPal,FALSE));
        RealizePalette(hDC);
      }
    }
    else
    {
      SetWindowExtEx(hDC,512,512,NULL);
      SetViewportExtEx(hDC,rect.right,-rect.bottom,NULL);
      SetViewportOrgEx(hDC,0,rect.bottom,NULL);

      for(idx=0; idx < 256; idx++)
      {
        hBrush = CreateSolidBrush(RGB(0,0,idx));
        SetRect(&rect,idx,idx,512-idx,512-idx);
        FillRect(hDC,&rect,hBrush);
        DeleteObject(hBrush);
      }
    }

    SetMapMode(hDC,nMapMode);

    EndPaint(hWnd,&ps);
  }

  return;
}

void ReadHelp | ( | HWND | hWndOwner,
 |  | LPTSTR | pszHelpFile
 | ) |  |

Definition at line 858 of file AppUtil.Cpp.

{
  INT_PTR iRes;

  if (NULL != pszHelpFile)
  {
    // First check if the .HTM help file is there at all.
    if (FileExist(pszHelpFile))
    {
      // Use shell to invoke web browser on the HTML help file.
      iRes = (INT_PTR) ShellExecute(
                     hWndOwner,
                     TEXT("open"),
                     pszHelpFile,
                     NULL,
                     NULL,
                     SW_SHOWNORMAL);
      if (iRes <= 32)
      {
        // If unable to browse then put up an error box.
        HrMsg(hWndOwner, TEXT(NOBROWSE_ERROR_STR), E_FAIL);
      }
    }
    else
    {
      // If the .HTM file doesn't exist the put up an error box.
      iRes = MessageBox(
               hWndOwner,
               TEXT(NOHTM_ERROR_STR),
               TEXT(ERROR_TITLE_STR),
               MB_OK | MB_ICONEXCLAMATION);
    }
  }

  return;
}

void ReadSource | ( | HWND | hWndOwner,
 |  | OPENFILENAME * | pOfn
 | ) |  |

Definition at line 1086 of file AppUtil.Cpp.

{
  TCHAR szReadCmd[MAX_PATH+12];
  TCHAR szFileName[MAX_PATH];
  BOOL bOk;
  int iResult;

  // We'll use the OpenFileName Common Dialog (defined in main app).
  // Set the dialog's file filter and title.
  szFileName[0] = 0;
  pOfn->lpstrFilter = TEXT(OFN_SOURCEFILES_STR);
  pOfn->lpstrTitle = TEXT(OFN_SOURCETITLE_STR);
  pOfn->lpstrFile = szFileName;

  // Call up the dialog to get a file name from the user.
  if (GetOpenFileName(pOfn))
  {
    // If the user provided a file name then assemble a command string
    lstrcpyn(szReadCmd, TEXT(EDITOR_EXE_STR), MAX_PATH+12);
    lstrncat(szReadCmd, szFileName, MAX_PATH+12 - lstrlen(szReadCmd));
    // And execute it.
    bOk = CmdExec(szReadCmd);
    if (!bOk)
    {
      // If create procees failed then put up an error box.
      iResult = MessageBox(
                  hWndOwner,
                  TEXT(NOEDITOR_ERROR_STR),
                  TEXT(ERROR_TITLE_STR),
                  MB_OK | MB_ICONEXCLAMATION);
    }
  }

  return;
}

void ReadTutorial | ( | HINSTANCE | hInst,
 |  | HWND | hWndOwner,
 |  | LPTSTR | pszHTMLFile
 | ) |  |

Definition at line 931 of file AppUtil.Cpp.

{
  TCHAR szFileName[MAX_PATH];

  szFileName[0] = 0;

  if (NULL == pszHTMLFile)
  {
    // Build a path to where the .HTM file should be. It should be in
    // the same directory as the .EXE but with the .HTM extension.
    MakeFamilyPath(hInst, szFileName, TEXT(HTML_FILE_EXT));
  }
  else
  {
    // Use the HTML file specified in a sibling directory.
    BOOL bOk = FALSE;
    TCHAR  szPath[MAX_PATH];
    TCHAR  szDrive[64];
    TCHAR  szDir[MAX_PATH];
    TCHAR  szName[64];
    LPTSTR psz;
    LONG   len;

    bOk = (0 != GetModuleFileName(hInst, szPath, MAX_PATH));
    if (bOk)
    {
      _tsplitpath(szPath, szDrive, szDir, szName, NULL);
      len = lstrlen(szDir);
      if (len > 1)
      {
        // Scan backwards in the Dir path to obtain the path to the
        // parent directory.
        psz = &szDir[0] + len - 1;
        while (psz > &szDir[0])
        {
          psz--;
          if (*psz == '\\' || *psz == '/')
          {
            psz++;
            *psz = 0;
            break;
          }
        }
        // Now build the complete Path & FileName using the Specified
        // HTML file name.
        lstrcpyn(szFileName, szDrive, MAX_PATH);
        lstrncat(szFileName, szDir, MAX_PATH - lstrlen(szFileName));
        if ('.' == *pszHTMLFile)
          lstrncat(szFileName, szName, MAX_PATH - lstrlen(szFileName));
        lstrncat(szFileName, pszHTMLFile, MAX_PATH - lstrlen(szFileName));
      }
    }
  }

  // Now Browse/Read the HTM file.
  ReadHelp(hWndOwner, szFileName);

  return;
}

BOOL SetRegKeyValue | ( | LPTSTR | pszKey,
 |  | LPTSTR | pszSubkey,
 |  | LPTSTR | pszValue
 | ) |  |

Definition at line 2653 of file AppUtil.Cpp.

{
  BOOL bOk = FALSE;
  LONG ec;
  HKEY hKey;
  TCHAR szKey[MAX_STRING_LENGTH];
  DWORD dwRes;
  PSID pEveryoneSID = NULL, pAdminSID = NULL;
  PACL pACL = NULL;
  PSECURITY_DESCRIPTOR pSD = NULL;
  EXPLICIT_ACCESS ea[2];
  SID_IDENTIFIER_AUTHORITY SIDAuthWorld = SECURITY_WORLD_SID_AUTHORITY;
  SID_IDENTIFIER_AUTHORITY SIDAuthNT = SECURITY_NT_AUTHORITY;
  SECURITY_ATTRIBUTES sa;
  LONG lRes;

  lstrcpyn(szKey, pszKey, MAX_STRING_LENGTH);

  if (NULL != pszSubkey)
  {
    lstrncat(szKey, TEXT("\\"), MAX_STRING_LENGTH - lstrlen(szKey));
    lstrncat(szKey, pszSubkey, MAX_STRING_LENGTH - lstrlen(szKey));
  }

  // Create a well-known SID for the Everyone group.
  if(!AllocateAndInitializeSid( &SIDAuthWorld, 1,
    SECURITY_WORLD_RID,
    0, 0, 0, 0, 0, 0, 0,
    &pEveryoneSID))
  {
    goto Cleanup;
  }

  // Initialize an EXPLICIT_ACCESS structure for an ACE.
  // The ACE will allow Everyone read access to the key.
  ZeroMemory(&ea, 2 * sizeof(EXPLICIT_ACCESS));
  ea[0].grfAccessPermissions = KEY_READ;
  ea[0].grfAccessMode = SET_ACCESS;
  ea[0].grfInheritance= NO_INHERITANCE;
  ea[0].Trustee.TrusteeForm = TRUSTEE_IS_SID;
  ea[0].Trustee.TrusteeType = TRUSTEE_IS_WELL_KNOWN_GROUP;
  ea[0].Trustee.ptstrName  = (LPTSTR) pEveryoneSID;

  // Create a SID for the BUILTIN\Administrators group.
  if(!AllocateAndInitializeSid( &SIDAuthNT, 2,
    SECURITY_BUILTIN_DOMAIN_RID,
    DOMAIN_ALIAS_RID_ADMINS,
    0, 0, 0, 0, 0, 0,
    &pAdminSID))
  {
    goto Cleanup;
  }

  // Initialize an EXPLICIT_ACCESS structure for an ACE.
  // The ACE will allow the Administrators group full access to the key.
  ea[1].grfAccessPermissions = KEY_ALL_ACCESS;
  ea[1].grfAccessMode = SET_ACCESS;
  ea[1].grfInheritance= NO_INHERITANCE;
  ea[1].Trustee.TrusteeForm = TRUSTEE_IS_SID;
  ea[1].Trustee.TrusteeType = TRUSTEE_IS_GROUP;
  ea[1].Trustee.ptstrName  = (LPTSTR) pAdminSID;

  // Create a new ACL that contains the new ACEs.
  dwRes = SetEntriesInAcl(2, ea, NULL, &pACL);
  if (ERROR_SUCCESS != dwRes)
  {
    goto Cleanup;
  }

  // Initialize a security descriptor.
  pSD = (PSECURITY_DESCRIPTOR) LocalAlloc(LPTR,
    SECURITY_DESCRIPTOR_MIN_LENGTH);
  if (pSD == NULL)
  {
    goto Cleanup;
  }

  if (!InitializeSecurityDescriptor(pSD, SECURITY_DESCRIPTOR_REVISION))
  {
    goto Cleanup;
  }

  // Add the ACL to the security descriptor.
  if (!SetSecurityDescriptorDacl(pSD,
    TRUE,     // fDaclPresent flag
    pACL,
    FALSE))   // not a default DACL
  {
    goto Cleanup;
  }

  // Initialize a security attributes structure.
  sa.nLength = sizeof (SECURITY_ATTRIBUTES);
  sa.lpSecurityDescriptor = pSD;
  sa.bInheritHandle = FALSE;

  // Use the security attributes to set the security descriptor
  // when you create a key.
  ec = RegCreateKeyEx(
         HKEY_CLASSES_ROOT,
         szKey,
         0,
         NULL,
         REG_OPTION_NON_VOLATILE,
         KEY_READ | KEY_WRITE,
         &sa,
         &hKey,
         NULL);

  if (NULL != pszValue && ERROR_SUCCESS == ec)
  {
    ec = RegSetValueEx(
           hKey,
           NULL,
           0,
           REG_SZ,
           (BYTE *)pszValue,
           (lstrlen(pszValue)+1)*sizeof(TCHAR));
    if (ERROR_SUCCESS == ec)
      bOk = TRUE;
  }

Cleanup:

  if (pEveryoneSID)
    FreeSid(pEveryoneSID);
  if (pAdminSID)
    FreeSid(pAdminSID);
  if (pACL)
    LocalFree(pACL);
  if (pSD)
    LocalFree(pSD);
  if (hKey)
    RegCloseKey(hKey);

  return bOk;
}

LPSTR SkipAnsi | ( | LPSTR | psz,
 |  | BOOL | bSkipWhite
 | ) |  |

Definition at line 531 of file AppUtil.Cpp.

{
  char ch;
  BOOL bWhite;

  while (ch = *psz)
  {
    bWhite = ('\n'==ch || '\r'==ch || '\t'==ch || ' '==ch);

    if ((bSkipWhite && !bWhite) || (!bSkipWhite && bWhite))
      break;

    psz++;
  }

  return psz;
}

HRESULT UcToAnsi | ( | LPWSTR | pwszUc,
 |  | LPSTR | pszAnsi,
 |  | int | cch
 | ) |  |

Definition at line 121 of file AppUtil.Cpp.

{
  HRESULT hr = E_POINTER;
  int cOut;

  assert(cch > 0);

  if (NULL != pszAnsi && NULL != pwszUc)
  {
    cOut = WideCharToMultiByte(CP_ACP, 0, pwszUc, -1, pszAnsi, cch, NULL, NULL);
    if (0 != cOut)
      hr = NOERROR;
    else
      hr = E_FAIL;
  }

  return hr;
}

LRESULT CALLBACK WindowProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 1176 of file AppUtil.Cpp.

{
  // Get a pointer to the window class object.
  CVirWindow* pWin = (CVirWindow*) GetWindowLongPtr(hWnd, GWLP_USERDATA);

  switch (uMsg)
  {
    case WM_NCCREATE:
      // Since this is the first time that we can get ahold of
      // a pointer to the window class object, all messages that might
      // have been sent before this are never seen by the Windows object
      // and only get passed on to the DefWindowProc

      // Get the initial creation pointer to the window object
      pWin = (CVirWindow *) ((CREATESTRUCT *)lParam)->lpCreateParams;

      // Set it's protected m_hWnd member variable to ensure that
      // member functions have access to the correct window handle.
      pWin->m_hWnd = hWnd;

      // Set its USERDATA DWORD to point to the window object
      SetWindowLongPtr(hWnd, GWLP_USERDATA, (INT_PTR) pWin);
      break;

    case WM_DESTROY:
      // This is our signal to destroy the window object.
      SetWindowLongPtr(hWnd, GWLP_USERDATA, 0);
      DELETE_POINTER(pWin);
      break;

    default:
      break;
  }

  // Call its message proc method.
  if (NULL != pWin)
    return (pWin->WindowProc(uMsg, wParam, lParam));
  else
    return (DefWindowProc(hWnd, uMsg, wParam, lParam));
}

Generated on Wed Nov 13 2024 16:53:17 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/Inc/BALLGUID.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • Inc
Functions

BALLGUID.h File Reference

Go to the source code of this file.

Functions

DEFINE_GUID (IID_IBall, 0x0002da22, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
DEFINE_GUID (CLSID_DllSndBall, 0x0002da27, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
DEFINE_GUID (IID_IBallSink, 0x0002da26, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
DEFINE_GUID (CLSID_DllBall, 0x0002da23, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)

Function Documentation

DEFINE_GUID | ( | IID_IBall | ,
 |  | 0x0002da22 | ,
 |  | 0x0000 | ,
 |  | 0x0000 | ,
 |  | 0xc0 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x46 |
 | ) |  |
DEFINE_GUID | ( | CLSID_DllSndBall | ,
 |  | 0x0002da27 | ,
 |  | 0x0000 | ,
 |  | 0x0000 | ,
 |  | 0xc0 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x46 |
 | ) |  |
DEFINE_GUID | ( | IID_IBallSink | ,
 |  | 0x0002da26 | ,
 |  | 0x0000 | ,
 |  | 0x0000 | ,
 |  | 0xc0 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x46 |
 | ) |  |
DEFINE_GUID | ( | CLSID_DllBall | ,
 |  | 0x0002da23 | ,
 |  | 0x0000 | ,
 |  | 0x0000 | ,
 |  | 0xc0 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x46 |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/Inc/CARGUIDS.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • Inc
Functions

CARGUIDS.h File Reference

Go to the source code of this file.

Functions

DEFINE_GUID (IID_ICar, 0x0002da00, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
DEFINE_GUID (CLSID_AptCruiseCar, 0x0002da0f, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
DEFINE_GUID (CLSID_AptUtilityCar, 0x0002da0e, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
DEFINE_GUID (CLSID_AptCar, 0x0002da0d, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
DEFINE_GUID (CLSID_LocCruiseCar, 0x0002da0c, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
DEFINE_GUID (CLSID_LocUtilityCar, 0x0002da0b, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
DEFINE_GUID (CLSID_LocCar, 0x0002da0a, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
DEFINE_GUID (CLSID_LicCarSample, 0x0002da09, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
DEFINE_GUID (CLSID_LicCruiseCar, 0x0002da08, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
DEFINE_GUID (CLSID_DllCarSample, 0x0002da07, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
DEFINE_GUID (CLSID_DllCruiseCar, 0x0002da06, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
DEFINE_GUID (CLSID_DllUtilityCar, 0x0002da05, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
DEFINE_GUID (CLSID_DllCar, 0x0002da04, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
DEFINE_GUID (IID_ISample, 0x0002da03, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
DEFINE_GUID (IID_ICruise, 0x0002da02, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
DEFINE_GUID (IID_IUtility, 0x0002da01, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)

Function Documentation

DEFINE_GUID | ( | IID_ICar | ,
 |  | 0x0002da00 | ,
 |  | 0x0000 | ,
 |  | 0x0000 | ,
 |  | 0xc0 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x46 |
 | ) |  |
DEFINE_GUID | ( | CLSID_AptCruiseCar | ,
 |  | 0x0002da0f | ,
 |  | 0x0000 | ,
 |  | 0x0000 | ,
 |  | 0xc0 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x46 |
 | ) |  |
DEFINE_GUID | ( | CLSID_AptUtilityCar | ,
 |  | 0x0002da0e | ,
 |  | 0x0000 | ,
 |  | 0x0000 | ,
 |  | 0xc0 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x46 |
 | ) |  |
DEFINE_GUID | ( | CLSID_AptCar | ,
 |  | 0x0002da0d | ,
 |  | 0x0000 | ,
 |  | 0x0000 | ,
 |  | 0xc0 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x46 |
 | ) |  |
DEFINE_GUID | ( | CLSID_LocCruiseCar | ,
 |  | 0x0002da0c | ,
 |  | 0x0000 | ,
 |  | 0x0000 | ,
 |  | 0xc0 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x46 |
 | ) |  |
DEFINE_GUID | ( | CLSID_LocUtilityCar | ,
 |  | 0x0002da0b | ,
 |  | 0x0000 | ,
 |  | 0x0000 | ,
 |  | 0xc0 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x46 |
 | ) |  |
DEFINE_GUID | ( | CLSID_LocCar | ,
 |  | 0x0002da0a | ,
 |  | 0x0000 | ,
 |  | 0x0000 | ,
 |  | 0xc0 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x46 |
 | ) |  |
DEFINE_GUID | ( | CLSID_LicCarSample | ,
 |  | 0x0002da09 | ,
 |  | 0x0000 | ,
 |  | 0x0000 | ,
 |  | 0xc0 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x46 |
 | ) |  |
DEFINE_GUID | ( | CLSID_LicCruiseCar | ,
 |  | 0x0002da08 | ,
 |  | 0x0000 | ,
 |  | 0x0000 | ,
 |  | 0xc0 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x46 |
 | ) |  |
DEFINE_GUID | ( | CLSID_DllCarSample | ,
 |  | 0x0002da07 | ,
 |  | 0x0000 | ,
 |  | 0x0000 | ,
 |  | 0xc0 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x46 |
 | ) |  |
DEFINE_GUID | ( | CLSID_DllCruiseCar | ,
 |  | 0x0002da06 | ,
 |  | 0x0000 | ,
 |  | 0x0000 | ,
 |  | 0xc0 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x46 |
 | ) |  |
DEFINE_GUID | ( | CLSID_DllUtilityCar | ,
 |  | 0x0002da05 | ,
 |  | 0x0000 | ,
 |  | 0x0000 | ,
 |  | 0xc0 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x46 |
 | ) |  |
DEFINE_GUID | ( | CLSID_DllCar | ,
 |  | 0x0002da04 | ,
 |  | 0x0000 | ,
 |  | 0x0000 | ,
 |  | 0xc0 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x46 |
 | ) |  |
DEFINE_GUID | ( | IID_ISample | ,
 |  | 0x0002da03 | ,
 |  | 0x0000 | ,
 |  | 0x0000 | ,
 |  | 0xc0 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x46 |
 | ) |  |
DEFINE_GUID | ( | IID_ICruise | ,
 |  | 0x0002da02 | ,
 |  | 0x0000 | ,
 |  | 0x0000 | ,
 |  | 0xc0 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x46 |
 | ) |  |
DEFINE_GUID | ( | IID_IUtility | ,
 |  | 0x0002da01 | ,
 |  | 0x0000 | ,
 |  | 0x0000 | ,
 |  | 0xc0 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x46 |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/Inc/IBALL.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • Inc
Functions

IBALL.h File Reference

Go to the source code of this file.

Functions

DECLARE_INTERFACE_ (IBall, IUnknown)
DECLARE_INTERFACE_ (IBallSink, IUnknown)

Function Documentation

DECLARE_INTERFACE_ | ( | IBall | ,
 |  | IUnknown |
 | ) |  |

Definition at line 52 of file IBALL.h.

{
  // IUnknown methods.
  STDMETHOD(QueryInterface) (THIS_ REFIID, PPVOID) PURE;
  STDMETHOD_(ULONG,AddRef)  (THIS) PURE;
  STDMETHOD_(ULONG,Release) (THIS) PURE;

  // IBall methods.
  STDMETHOD(Reset)      (THIS_ RECT*, SHORT) PURE;
  STDMETHOD(Move)       (THIS_ BOOL) PURE;
  STDMETHOD(GetBall)    (THIS_ POINT*, POINT*, COLORREF*) PURE;
};

DECLARE_INTERFACE_ | ( | IBallSink | ,
 |  | IUnknown |
 | ) |  |

Definition at line 85 of file IBALL.h.

{
  // IUnknown methods.
  STDMETHOD(QueryInterface) (THIS_ REFIID, PPVOID) PURE;
  STDMETHOD_(ULONG,AddRef)  (THIS) PURE;
  STDMETHOD_(ULONG,Release) (THIS) PURE;

  // IBallSink methods.
  STDMETHOD(BounceBottom)   (THIS) PURE;
  STDMETHOD(BounceLeft)     (THIS) PURE;
  STDMETHOD(BounceRight)    (THIS) PURE;
  STDMETHOD(BounceTop)      (THIS) PURE;
};

Generated on Wed Nov 13 2024 16:53:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/Inc/ICARS.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • Inc
Functions

ICARS.h File Reference

Go to the source code of this file.

Functions

DECLARE_INTERFACE_ (ICar, IUnknown)
DECLARE_INTERFACE_ (ISample, IUnknown)
DECLARE_INTERFACE_ (ICruise, IUnknown)
DECLARE_INTERFACE_ (IUtility, IUnknown)

Function Documentation

DECLARE_INTERFACE_ | ( | ICar | ,
 |  | IUnknown |
 | ) |  |

Definition at line 55 of file ICARS.h.

{
  // IUnknown methods.
  STDMETHOD(QueryInterface) (THIS_ REFIID, PPVOID) PURE;
  STDMETHOD_(ULONG,AddRef)  (THIS) PURE;
  STDMETHOD_(ULONG,Release) (THIS) PURE;

  // ICar methods.
  STDMETHOD(Shift)   (THIS_ short) PURE;
  STDMETHOD(Clutch)  (THIS_ short) PURE;
  STDMETHOD(Speed)   (THIS_ short) PURE;
  STDMETHOD(Steer)   (THIS_ short) PURE;
};

DECLARE_INTERFACE_ | ( | ISample | ,
 |  | IUnknown |
 | ) |  |

Definition at line 129 of file ICARS.h.

{
  // IUnknown methods.
  STDMETHOD(QueryInterface) (THIS_ REFIID, PPVOID) PURE;
  STDMETHOD_(ULONG,AddRef)  (THIS) PURE;
  STDMETHOD_(ULONG,Release) (THIS) PURE;

  // ISample methods.
  STDMETHOD(Init)     (THIS_ HWND, PVOID) PURE;
  STDMETHOD(AboutBox) (THIS_ HWND) PURE;
};

DECLARE_INTERFACE_ | ( | ICruise | ,
 |  | IUnknown |
 | ) |  |

Definition at line 105 of file ICARS.h.

{
  // IUnknown methods.
  STDMETHOD(QueryInterface) (THIS_ REFIID, PPVOID) PURE;
  STDMETHOD_(ULONG,AddRef)  (THIS) PURE;
  STDMETHOD_(ULONG,Release) (THIS) PURE;

  // ICruise methods.
  STDMETHOD(Engage) (THIS_ BOOL) PURE;
  STDMETHOD(Adjust) (THIS_ BOOL) PURE;
};

DECLARE_INTERFACE_ | ( | IUtility | ,
 |  | IUnknown |
 | ) |  |

Definition at line 81 of file ICARS.h.

{
  // IUnknown methods.
  STDMETHOD(QueryInterface) (THIS_ REFIID, PPVOID) PURE;
  STDMETHOD_(ULONG,AddRef)  (THIS) PURE;
  STDMETHOD_(ULONG,Release) (THIS) PURE;

  // IUtility methods.
  STDMETHOD(Offroad)   (THIS_ short) PURE;
  STDMETHOD(Winch)     (THIS_ short) PURE;
};

Generated on Wed Nov 13 2024 16:53:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/Inc/IPageS.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • Inc
Defines | Functions

IPageS.h File Reference

Go to the source code of this file.

Defines

#define | OPENSTATE_NO 2
#define | OPENSTATE_NONE 0
#define | OPENSTATE_YES 1
#define | PAGE_NAME_SIZE 16
#define | PAGE_TITLE_SIZE 64
#define | PAGELIST_USTR L"PageList"
#define | PAGETYPE_DELETED 1
#define | PAGETYPE_DRAWING 3
#define | PAGETYPE_NONE 0
#define | PAGETYPE_TEXT 2
#define | WM_USER_PAGECHANGED WM_USER+400
#define | WM_USER_PAGECLOSED WM_USER+401

Functions

DECLARE_INTERFACE_ (IPageList, IUnknown)
DECLARE_INTERFACE_ (IDrawPageSink, IUnknown)
DECLARE_INTERFACE_ (IDrawPage, IUnknown)
DECLARE_INTERFACE_ (ITextPageSink, IUnknown)
DECLARE_INTERFACE_ (ITextPage, IUnknown)
DECLARE_INTERFACE_ (IPageListSink, IUnknown)

Define Documentation

#define OPENSTATE_NO 2

Definition at line 49 of file IPageS.h.

#define OPENSTATE_NONE 0

Definition at line 47 of file IPageS.h.

#define OPENSTATE_YES 1

Definition at line 48 of file IPageS.h.

#define PAGE_NAME_SIZE 16

Definition at line 52 of file IPageS.h.

#define PAGE_TITLE_SIZE 64

Definition at line 51 of file IPageS.h.

#define PAGELIST_USTR L"PageList"

Definition at line 55 of file IPageS.h.

#define PAGETYPE_DELETED 1

Definition at line 42 of file IPageS.h.

#define PAGETYPE_DRAWING 3

Definition at line 44 of file IPageS.h.

#define PAGETYPE_NONE 0

Definition at line 41 of file IPageS.h.

#define PAGETYPE_TEXT 2

Definition at line 43 of file IPageS.h.

#define WM_USER_PAGECHANGED WM_USER+400

Definition at line 58 of file IPageS.h.

#define WM_USER_PAGECLOSED WM_USER+401

Definition at line 59 of file IPageS.h.

Function Documentation

DECLARE_INTERFACE_ | ( | IPageList | ,
 |  | IUnknown |
 | ) |  |

Definition at line 94 of file IPageS.h.

{
  // IUnknown methods.
  STDMETHOD(QueryInterface) (THIS_ REFIID, PPVOID) PURE;
  STDMETHOD_(ULONG,AddRef)  (THIS) PURE;
  STDMETHOD_(ULONG,Release) (THIS) PURE;

  // IPageList methods.
  STDMETHOD(Get)        (THIS_ INT, BOOL*, SHORT*, WCHAR*, WCHAR*) PURE;
  STDMETHOD(Set)        (THIS_ INT, SHORT, WCHAR*) PURE;
  STDMETHOD(Add)        (THIS_ INT, SHORT, WCHAR*, INT*) PURE;
  STDMETHOD(Delete)     (THIS_ INT) PURE;
  STDMETHOD(Clear)      (THIS) PURE;
};

DECLARE_INTERFACE_ | ( | IDrawPageSink | ,
 |  | IUnknown |
 | ) |  |

Definition at line 264 of file IPageS.h.

{
  // IUnknown methods.
  STDMETHOD(QueryInterface) (THIS_ REFIID, PPVOID) PURE;
  STDMETHOD_(ULONG,AddRef)  (THIS) PURE;
  STDMETHOD_(ULONG,Release) (THIS) PURE;

  // IDrawPageSink methods.
  STDMETHOD(Loaded)      (THIS) PURE;
  STDMETHOD(Saved)       (THIS) PURE;
  STDMETHOD(InkStart)    (THIS_ SHORT, SHORT, SHORT, COLORREF) PURE;
  STDMETHOD(InkDraw)     (THIS_ SHORT, SHORT) PURE;
  STDMETHOD(InkStop)     (THIS_ SHORT, SHORT) PURE;
  STDMETHOD(Cleared)     (THIS) PURE;
  STDMETHOD(Resized)     (THIS_ SHORT, SHORT) PURE;
};

DECLARE_INTERFACE_ | ( | IDrawPage | ,
 |  | IUnknown |
 | ) |  |

Definition at line 226 of file IPageS.h.

{
  // IUnknown methods.
  STDMETHOD(QueryInterface) (THIS_ REFIID, PPVOID) PURE;
  STDMETHOD_(ULONG,AddRef)  (THIS) PURE;
  STDMETHOD_(ULONG,Release) (THIS) PURE;

  // IDrawPage methods.
  STDMETHOD(InkStart)   (THIS_ SHORT, SHORT, SHORT, COLORREF) PURE;
  STDMETHOD(InkDraw)    (THIS_ SHORT, SHORT) PURE;
  STDMETHOD(InkStop)    (THIS_ SHORT, SHORT) PURE;
  STDMETHOD(Clear)      (THIS_ BOOL) PURE;
  STDMETHOD(Resize)     (THIS_ SHORT, SHORT) PURE;
  STDMETHOD(Redraw)     (THIS) PURE;
};

DECLARE_INTERFACE_ | ( | ITextPageSink | ,
 |  | IUnknown |
 | ) |  |

Definition at line 192 of file IPageS.h.

{
  // IUnknown methods.
  STDMETHOD(QueryInterface) (THIS_ REFIID, PPVOID) PURE;
  STDMETHOD_(ULONG,AddRef)  (THIS) PURE;
  STDMETHOD_(ULONG,Release) (THIS) PURE;

  // ITextPageSink methods.
  STDMETHOD(Loaded)      (THIS) PURE;
  STDMETHOD(Saved)       (THIS) PURE;
  STDMETHOD(Put)         (THIS) PURE;
  STDMETHOD(Cleared)     (THIS) PURE;
};

DECLARE_INTERFACE_ | ( | ITextPage | ,
 |  | IUnknown |
 | ) |  |

Definition at line 162 of file IPageS.h.

{
  // IUnknown methods.
  STDMETHOD(QueryInterface) (THIS_ REFIID, PPVOID) PURE;
  STDMETHOD_(ULONG,AddRef)  (THIS) PURE;
  STDMETHOD_(ULONG,Release) (THIS) PURE;

  // ITextPage methods.
  STDMETHOD(GetLength)  (THIS_ INT*) PURE;
  STDMETHOD(GetText)    (THIS_ WCHAR*) PURE;
  STDMETHOD(PutText)    (THIS_ WCHAR*, INT) PURE;
  STDMETHOD(Clear)      (THIS_ BOOL) PURE;
};

DECLARE_INTERFACE_ | ( | IPageListSink | ,
 |  | IUnknown |
 | ) |  |

Definition at line 129 of file IPageS.h.

{
  // IUnknown methods.
  STDMETHOD(QueryInterface) (THIS_ REFIID, PPVOID) PURE;
  STDMETHOD_(ULONG,AddRef)  (THIS) PURE;
  STDMETHOD_(ULONG,Release) (THIS) PURE;

  // IPageListSink methods.
  STDMETHOD(Loaded)      (THIS) PURE;
  STDMETHOD(Saved)       (THIS) PURE;
  STDMETHOD(Cleared)     (THIS) PURE;
  STDMETHOD(PageAdded)   (THIS_ INT) PURE;
  STDMETHOD(PageDeleted) (THIS_ INT) PURE;
  STDMETHOD(PageSet)     (THIS_ INT) PURE;
};

Generated on Wed Nov 13 2024 16:53:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/Inc/IPAPER.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • Inc
Functions

IPAPER.h File Reference

Go to the source code of this file.

Functions

DECLARE_INTERFACE_ (IPaper, IUnknown)
DECLARE_INTERFACE_ (IPaperSink, IUnknown)

Function Documentation

DECLARE_INTERFACE_ | ( | IPaper | ,
 |  | IUnknown |
 | ) |  |

Definition at line 69 of file IPAPER.h.

{
  // IUnknown methods.
  STDMETHOD(QueryInterface) (THIS_ REFIID, PPVOID) PURE;
  STDMETHOD_(ULONG,AddRef)  (THIS) PURE;
  STDMETHOD_(ULONG,Release) (THIS) PURE;

  // IPaper methods.
  STDMETHOD(InitPaper)  (THIS_ RECT*, BOOL*) PURE;
  STDMETHOD(Lock)       (THIS_ SHORT*) PURE;
  STDMETHOD(Unlock)     (THIS_ SHORT) PURE;
  STDMETHOD(Load)       (THIS_ SHORT, IStorage*) PURE;
  STDMETHOD(Save)       (THIS_ SHORT, IStorage*) PURE;
  STDMETHOD(InkStart)   (THIS_ SHORT, SHORT, SHORT, SHORT, COLORREF) PURE;
  STDMETHOD(InkDraw)    (THIS_ SHORT, SHORT, SHORT) PURE;
  STDMETHOD(InkStop)    (THIS_ SHORT, SHORT, SHORT) PURE;
  STDMETHOD(Erase)      (THIS_ SHORT) PURE;
  STDMETHOD(Resize)     (THIS_ SHORT, SHORT, SHORT) PURE;
  STDMETHOD(Redraw)     (THIS_ SHORT) PURE;
};

DECLARE_INTERFACE_ | ( | IPaperSink | ,
 |  | IUnknown |
 | ) |  |

Definition at line 116 of file IPAPER.h.

{
  // IUnknown methods.
  STDMETHOD(QueryInterface) (THIS_ REFIID, PPVOID) PURE;
  STDMETHOD_(ULONG,AddRef)  (THIS) PURE;
  STDMETHOD_(ULONG,Release) (THIS) PURE;

  // IPaperSink methods.
  STDMETHOD(Locked)     (THIS) PURE;
  STDMETHOD(Unlocked)   (THIS) PURE;
  STDMETHOD(Loaded)     (THIS) PURE;
  STDMETHOD(Saved)      (THIS) PURE;
  STDMETHOD(InkStart)   (THIS_ SHORT, SHORT, SHORT, COLORREF) PURE;
  STDMETHOD(InkDraw)    (THIS_ SHORT, SHORT) PURE;
  STDMETHOD(InkStop)    (THIS_ SHORT, SHORT) PURE;
  STDMETHOD(Erased)     (THIS) PURE;
  STDMETHOD(Resized)    (THIS_ SHORT, SHORT) PURE;
};

Generated on Wed Nov 13 2024 16:53:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/Inc/PageGUID.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • Inc
Functions

PageGUID.h File Reference

Go to the source code of this file.

Functions

DEFINE_GUID (IID_IPageList, 0x0002da10, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
DEFINE_GUID (CLSID_DrawPage, 0x0002da18, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
DEFINE_GUID (IID_IDrawPageSink, 0x0002da17, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
DEFINE_GUID (IID_IDrawPage, 0x0002da16, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
DEFINE_GUID (CLSID_TextPage, 0x0002da15, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
DEFINE_GUID (IID_ITextPageSink, 0x0002da14, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
DEFINE_GUID (IID_ITextPage, 0x0002da13, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
DEFINE_GUID (CLSID_PageList, 0x0002da12, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
DEFINE_GUID (IID_IPageListSink, 0x0002da11, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)

Function Documentation

DEFINE_GUID | ( | IID_IPageList | ,
 |  | 0x0002da10 | ,
 |  | 0x0000 | ,
 |  | 0x0000 | ,
 |  | 0xc0 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x46 |
 | ) |  |
DEFINE_GUID | ( | CLSID_DrawPage | ,
 |  | 0x0002da18 | ,
 |  | 0x0000 | ,
 |  | 0x0000 | ,
 |  | 0xc0 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x46 |
 | ) |  |
DEFINE_GUID | ( | IID_IDrawPageSink | ,
 |  | 0x0002da17 | ,
 |  | 0x0000 | ,
 |  | 0x0000 | ,
 |  | 0xc0 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x46 |
 | ) |  |
DEFINE_GUID | ( | IID_IDrawPage | ,
 |  | 0x0002da16 | ,
 |  | 0x0000 | ,
 |  | 0x0000 | ,
 |  | 0xc0 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x46 |
 | ) |  |
DEFINE_GUID | ( | CLSID_TextPage | ,
 |  | 0x0002da15 | ,
 |  | 0x0000 | ,
 |  | 0x0000 | ,
 |  | 0xc0 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x46 |
 | ) |  |
DEFINE_GUID | ( | IID_ITextPageSink | ,
 |  | 0x0002da14 | ,
 |  | 0x0000 | ,
 |  | 0x0000 | ,
 |  | 0xc0 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x46 |
 | ) |  |
DEFINE_GUID | ( | IID_ITextPage | ,
 |  | 0x0002da13 | ,
 |  | 0x0000 | ,
 |  | 0x0000 | ,
 |  | 0xc0 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x46 |
 | ) |  |
DEFINE_GUID | ( | CLSID_PageList | ,
 |  | 0x0002da12 | ,
 |  | 0x0000 | ,
 |  | 0x0000 | ,
 |  | 0xc0 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x46 |
 | ) |  |
DEFINE_GUID | ( | IID_IPageListSink | ,
 |  | 0x0002da11 | ,
 |  | 0x0000 | ,
 |  | 0x0000 | ,
 |  | 0xc0 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x46 |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/Inc/PAPGUIDS.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • Inc
Functions

PAPGUIDS.h File Reference

Go to the source code of this file.

Functions

DEFINE_GUID (IID_IPaper, 0x0002da30, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
DEFINE_GUID (CLSID_SharePaper, 0x0002da32, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
DEFINE_GUID (IID_ISharePaper, 0x0002da31, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
DEFINE_GUID (CLSID_DllPaper, 0x0002da38, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
DEFINE_GUID (IID_IPaperSink, 0x0002da34, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)

Function Documentation

DEFINE_GUID | ( | IID_IPaper | ,
 |  | 0x0002da30 | ,
 |  | 0x0000 | ,
 |  | 0x0000 | ,
 |  | 0xc0 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x46 |
 | ) |  |
DEFINE_GUID | ( | CLSID_SharePaper | ,
 |  | 0x0002da32 | ,
 |  | 0x0000 | ,
 |  | 0x0000 | ,
 |  | 0xc0 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x46 |
 | ) |  |
DEFINE_GUID | ( | IID_ISharePaper | ,
 |  | 0x0002da31 | ,
 |  | 0x0000 | ,
 |  | 0x0000 | ,
 |  | 0xc0 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x46 |
 | ) |  |
DEFINE_GUID | ( | CLSID_DllPaper | ,
 |  | 0x0002da38 | ,
 |  | 0x0000 | ,
 |  | 0x0000 | ,
 |  | 0xc0 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x46 |
 | ) |  |
DEFINE_GUID | ( | IID_IPaperSink | ,
 |  | 0x0002da34 | ,
 |  | 0x0000 | ,
 |  | 0x0000 | ,
 |  | 0xc0 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x46 |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/LicClien/LicClien.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • LicClien
Functions | Variables

LicClien.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <initguid.h>
#include <olectl.h>
#include <commdlg.h>
#include <apputil.h>
#include <icars.h>
#include <carguids.h>
#include "licclien.h"
#include "utcrucar.h"

Go to the source code of this file.

Functions

BOOL | InitApplication (HINSTANCE hInstance)
BOOL | UnicodeOk (void)
int PASCAL | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

Variables

CMsgLog * | g_pMsgLog = NULL

Function Documentation

BOOL InitApplication ( HINSTANCE hInstance )

Definition at line 1216 of file LicClien.Cpp.

{
  BOOL bOk;
  // The window class for all instances of the main frame window.
  WNDCLASSEX wcf;

  // Assign the appropriate values for this main frame window class.
  wcf.cbSize        = sizeof(WNDCLASSEX);
  wcf.cbClsExtra    = 0;            // No per-class extra data.
  wcf.cbWndExtra    = 0;            // No per-window extra data.
  wcf.hInstance     = hInstance;    // Application module instance.
  wcf.lpfnWndProc   = &WindowProc;  // Global Window Procedure (defined in
                                    // APPUTIL for all CVirWindows).
  wcf.hCursor       = LoadCursor(NULL, IDC_ARROW); // Load app cursor.
  wcf.hIcon         = (HICON) LoadIcon(            // Load app icon.
                                hInstance,
                                TEXT("AppIcon"));
  wcf.hIconSm       = (HICON) LoadImage(           // Load small icon.
                                hInstance,
                                TEXT("AppIcon"),
                                IMAGE_ICON,
                                16, 16,
                                0);
  wcf.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);  // Default backgnd color.
  wcf.style         = CS_HREDRAW | CS_VREDRAW;     // Class style(s).
  wcf.lpszClassName = TEXT(MAIN_WINDOW_CLASS_NAME_STR); // Class name.
  wcf.lpszMenuName  = TEXT(MAIN_WINDOW_CLASS_MENU_STR); // Menu name.

  // Register the window class and return FALSE if unsuccesful.
  bOk = RegisterClassEx(&wcf);

  return (bOk);
}

BOOL UnicodeOk ( void )

Definition at line 1190 of file LicClien.Cpp.

{
  BOOL bOk = TRUE;
  TCHAR szUserName[MAX_STRING_LENGTH];
  DWORD dwSize = MAX_STRING_LENGTH;

  if (!GetUserName(szUserName, &dwSize))
    bOk = ERROR_CALL_NOT_IMPLEMENTED == GetLastError() ? FALSE : TRUE;

  return bOk;
}

int PASCAL WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 1273 of file LicClien.Cpp.

{
  CMainWindow* pWin = NULL;
  MSG msg;
  HACCEL hAccel;
  int iRun = FALSE;

  // If we were compiled for UNICODE and the platform seems OK with this
  // then proceed.  Else we error and exit the app.
  if (UnicodeOk())
  {
    // Call to initialize the COM Library.  Use the SUCCEEDED macro
    // to detect success.  If fail then exit app with error message.
    if (SUCCEEDED(CoInitialize(NULL)))
    {
      // If we succeeded in initializing the COM Library we proceed to
      // initialize the application.  If we can't init the application
      // then we signal shut down with an error message exit.
      iRun = InitApplication(hInstance);
      if (iRun)
      {
        // Assume we'll set iRun to TRUE when initialization is done.
        iRun = FALSE;
        // We are still go for running so we try to create a nifty new
        // CMainWindow object for this app instance.
        pWin = new CMainWindow;
        if (NULL != pWin)
        {
          // Now we initialize an instance of the new CMainWindow.
          // This includes creating the main window.
          if (pWin->InitInstance(hInstance, nCmdShow))
          {
            // Load the keyboard accelerators from the resources.
            hAccel = LoadAccelerators(hInstance, TEXT("AppAccel"));
            if (NULL != hAccel)
            {
              // Signal App Initialization is successfully done.
              iRun = TRUE;
            }
          }
        }
      }

      if (iRun)
      {
        // If we initialized the app instance properly then we are still
        // go for running.  We then start up the main message pump for
        // the application.
        while (GetMessage(&msg, NULL, 0, 0))
        {
          if (!TranslateAccelerator(
                 pWin->GetHwnd(),
                 hAccel,
                 &msg))
          {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
          }
        }

        // We ask COM to unload any unused COM Servers.
        CoFreeUnusedLibraries();

        // We'll pass to Windows the reason why we exited the message loop.
        iRun = (int) msg.wParam;
      }
      else
      {
        // We failed to initialize the application. Put up error message
        // box saying that application couldn't be initialized.  Parent
        // window is desktop (ie, NULL). Exit the failed application
        // (ie, by returning FALSE to WinMain).
        ErrorBox(hInstance, NULL, IDS_APPINITFAILED);

        // Delete the CMainWindow object.
        DELETE_POINTER(pWin);
      }

      // We're exiting this app (either normally or by init failure) so
      // shut down the COM Library.
      CoUninitialize();
    }
    else
    {
      // We failed to Initialize the COM Library. Put up error message box
      // saying that COM Library couldn't be initialized.  Parent window
      // is desktop (ie, NULL). Exit the failed application (ie, by
      // returning FALSE to WinMain).
      ErrorBox(hInstance, NULL, IDS_COMINITFAILED);
    }
  }
  else
  {
    // If we were compiled for UNICODE but the platform has problems with
    // this then indicate an error and exit the app immediately.
    CHAR szMsg[MAX_STRING_LENGTH];

    if (LoadStringA(
          hInstance,
          IDS_NOUNICODE,
          szMsg,
          MAX_STRING_LENGTH))
    {
      MessageBoxA(
        NULL,
        szMsg,
        ERROR_TITLE_STR,
        MB_OK | MB_ICONEXCLAMATION);
    }
  }

  return iRun;
}

Variable Documentation

CMsgLog* g_pMsgLog = NULL

Definition at line 96 of file LicClien.Cpp.

Generated on Wed Nov 13 2024 16:53:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/LicClien/LicClien.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • LicClien
Defines

LicClien.h File Reference

Go to the source code of this file.

Defines

#define | DLLSERVE_TUTFILE_STR "dllserve.htm"
#define | IDM_CAR_CLUTCH 1103
#define | IDM_CAR_CREATE 1100
#define | IDM_CAR_RELEASE 1101
#define | IDM_CAR_SHIFT 1102
#define | IDM_CAR_SPEED 1104
#define | IDM_CAR_STEER 1105
#define | IDM_CCAR_ADJUST 1307
#define | IDM_CCAR_CLUTCH 1303
#define | IDM_CCAR_CREATE 1300
#define | IDM_CCAR_ENGAGE 1306
#define | IDM_CCAR_RELEASE 1301
#define | IDM_CCAR_SHIFT 1302
#define | IDM_CCAR_SPEED 1304
#define | IDM_CCAR_STEER 1305
#define | IDM_FILE_EXIT 1000
#define | IDM_HELP_ABOUT 1905
#define | IDM_HELP_ABOUTDLLSERVER 1907
#define | IDM_HELP_ABOUTLICSERVER 1906
#define | IDM_HELP_CONTENTS 1900
#define | IDM_HELP_READSOURCE 1904
#define | IDM_HELP_TUTDLLSERVER 1903
#define | IDM_HELP_TUTLICSERVER 1902
#define | IDM_HELP_TUTORIAL 1901
#define | IDM_LOG_COPYCLIP 1894
#define | IDM_LOG_DLLSERVER 1892
#define | IDM_LOG_LICSERVER 1891
#define | IDM_LOG_LOGCLEAR 1890
#define | IDM_LOG_LOGGING 1893
#define | IDM_UCAR_CLUTCH 1203
#define | IDM_UCAR_CREATE 1200
#define | IDM_UCAR_OFFROAD 1206
#define | IDM_UCAR_RELEASE 1201
#define | IDM_UCAR_SHIFT 1202
#define | IDM_UCAR_SPEED 1204
#define | IDM_UCAR_STEER 1205
#define | IDM_UCAR_WINCH 1207
#define | IDM_UCRU_ADJUST 1409
#define | IDM_UCRU_CLEARLICKEY 1401
#define | IDM_UCRU_CLUTCH 1405
#define | IDM_UCRU_CREATE 1402
#define | IDM_UCRU_ENGAGE 1408
#define | IDM_UCRU_GETLICKEY 1400
#define | IDM_UCRU_OFFROAD 1410
#define | IDM_UCRU_RELEASE 1403
#define | IDM_UCRU_SHIFT 1404
#define | IDM_UCRU_SPEED 1406
#define | IDM_UCRU_STEER 1407
#define | IDM_UCRU_WINCH 1411
#define | IDS_APPINITFAILED 2001
#define | IDS_ASSERT_FAIL 2200
#define | IDS_COMINITFAILED 2000
#define | IDS_NODLLSERVER 2004
#define | IDS_NOLICENSE 2006
#define | IDS_NOLICSERVER 2005
#define | IDS_NORUNLICENSE 2007
#define | IDS_NOTIMPLEMENTED 2301
#define | IDS_NOUNICODE 2003
#define | IDS_OUTOFMEMORY 2002
#define | IDS_START_MESSAGE_LOG 2400
#define | LICSERVE_TUTFILE_STR "licserve.htm"
#define | MAIN_WINDOW_CLASS_MENU_STR "LICCLIENMenu"
#define | MAIN_WINDOW_CLASS_NAME_STR "LICCLIENWindow"
#define | MAIN_WINDOW_TITLE_STR "LICCLIEN: Tutorial Code Sample"
#define | OFN_DEFAULTFILES_STR "All Files (*.*)\0*.*\0"
#define | OFN_DEFAULTTITLE_STR "Open File"

Define Documentation

#define DLLSERVE_TUTFILE_STR "dllserve.htm"

Definition at line 108 of file LicClien.h.

#define IDM_CAR_CLUTCH 1103

Definition at line 121 of file LicClien.h.

#define IDM_CAR_CREATE 1100

Definition at line 118 of file LicClien.h.

#define IDM_CAR_RELEASE 1101

Definition at line 119 of file LicClien.h.

#define IDM_CAR_SHIFT 1102

Definition at line 120 of file LicClien.h.

#define IDM_CAR_SPEED 1104

Definition at line 122 of file LicClien.h.

#define IDM_CAR_STEER 1105

Definition at line 123 of file LicClien.h.

#define IDM_CCAR_ADJUST 1307

Definition at line 143 of file LicClien.h.

#define IDM_CCAR_CLUTCH 1303

Definition at line 139 of file LicClien.h.

#define IDM_CCAR_CREATE 1300

Definition at line 136 of file LicClien.h.

#define IDM_CCAR_ENGAGE 1306

Definition at line 142 of file LicClien.h.

#define IDM_CCAR_RELEASE 1301

Definition at line 137 of file LicClien.h.

#define IDM_CCAR_SHIFT 1302

Definition at line 138 of file LicClien.h.

#define IDM_CCAR_SPEED 1304

Definition at line 140 of file LicClien.h.

#define IDM_CCAR_STEER 1305

Definition at line 141 of file LicClien.h.

#define IDM_FILE_EXIT 1000

Definition at line 115 of file LicClien.h.

#define IDM_HELP_ABOUT 1905

Definition at line 172 of file LicClien.h.

#define IDM_HELP_ABOUTDLLSERVER 1907

Definition at line 174 of file LicClien.h.

#define IDM_HELP_ABOUTLICSERVER 1906

Definition at line 173 of file LicClien.h.

#define IDM_HELP_CONTENTS 1900

Definition at line 167 of file LicClien.h.

#define IDM_HELP_READSOURCE 1904

Definition at line 171 of file LicClien.h.

#define IDM_HELP_TUTDLLSERVER 1903

Definition at line 170 of file LicClien.h.

#define IDM_HELP_TUTLICSERVER 1902

Definition at line 169 of file LicClien.h.

#define IDM_HELP_TUTORIAL 1901

Definition at line 168 of file LicClien.h.

#define IDM_LOG_COPYCLIP 1894

Definition at line 164 of file LicClien.h.

#define IDM_LOG_DLLSERVER 1892

Definition at line 162 of file LicClien.h.

#define IDM_LOG_LICSERVER 1891

Definition at line 161 of file LicClien.h.

#define IDM_LOG_LOGCLEAR 1890

Definition at line 160 of file LicClien.h.

#define IDM_LOG_LOGGING 1893

Definition at line 163 of file LicClien.h.

#define IDM_UCAR_CLUTCH 1203

Definition at line 129 of file LicClien.h.

#define IDM_UCAR_CREATE 1200

Definition at line 126 of file LicClien.h.

#define IDM_UCAR_OFFROAD 1206

Definition at line 132 of file LicClien.h.

#define IDM_UCAR_RELEASE 1201

Definition at line 127 of file LicClien.h.

#define IDM_UCAR_SHIFT 1202

Definition at line 128 of file LicClien.h.

#define IDM_UCAR_SPEED 1204

Definition at line 130 of file LicClien.h.

#define IDM_UCAR_STEER 1205

Definition at line 131 of file LicClien.h.

#define IDM_UCAR_WINCH 1207

Definition at line 133 of file LicClien.h.

#define IDM_UCRU_ADJUST 1409

Definition at line 155 of file LicClien.h.

#define IDM_UCRU_CLEARLICKEY 1401

Definition at line 147 of file LicClien.h.

#define IDM_UCRU_CLUTCH 1405

Definition at line 151 of file LicClien.h.

#define IDM_UCRU_CREATE 1402

Definition at line 148 of file LicClien.h.

#define IDM_UCRU_ENGAGE 1408

Definition at line 154 of file LicClien.h.

#define IDM_UCRU_GETLICKEY 1400

Definition at line 146 of file LicClien.h.

#define IDM_UCRU_OFFROAD 1410

Definition at line 156 of file LicClien.h.

#define IDM_UCRU_RELEASE 1403

Definition at line 149 of file LicClien.h.

#define IDM_UCRU_SHIFT 1404

Definition at line 150 of file LicClien.h.

#define IDM_UCRU_SPEED 1406

Definition at line 152 of file LicClien.h.

#define IDM_UCRU_STEER 1407

Definition at line 153 of file LicClien.h.

#define IDM_UCRU_WINCH 1411

Definition at line 157 of file LicClien.h.

#define IDS_APPINITFAILED 2001

Definition at line 178 of file LicClien.h.

#define IDS_ASSERT_FAIL 2200

Definition at line 186 of file LicClien.h.

#define IDS_COMINITFAILED 2000

Definition at line 177 of file LicClien.h.

#define IDS_NODLLSERVER 2004

Definition at line 181 of file LicClien.h.

#define IDS_NOLICENSE 2006

Definition at line 183 of file LicClien.h.

#define IDS_NOLICSERVER 2005

Definition at line 182 of file LicClien.h.

#define IDS_NORUNLICENSE 2007

Definition at line 184 of file LicClien.h.

#define IDS_NOTIMPLEMENTED 2301

Definition at line 189 of file LicClien.h.

#define IDS_NOUNICODE 2003

Definition at line 180 of file LicClien.h.

#define IDS_OUTOFMEMORY 2002

Definition at line 179 of file LicClien.h.

#define IDS_START_MESSAGE_LOG 2400

Definition at line 192 of file LicClien.h.

#define LICSERVE_TUTFILE_STR "licserve.htm"

Definition at line 107 of file LicClien.h.

#define MAIN_WINDOW_CLASS_MENU_STR "LICCLIENMenu"

Definition at line 104 of file LicClien.h.

#define MAIN_WINDOW_CLASS_NAME_STR "LICCLIENWindow"

Definition at line 103 of file LicClien.h.

#define MAIN_WINDOW_TITLE_STR "LICCLIEN: Tutorial Code Sample"

Definition at line 102 of file LicClien.h.

#define OFN_DEFAULTFILES_STR "All Files (*.*)\0*.*\0"

Definition at line 111 of file LicClien.h.

#define OFN_DEFAULTTITLE_STR "Open File"

Definition at line 112 of file LicClien.h.

Generated on Wed Nov 13 2024 16:53:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/LicClien/UTCRUCAR.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • LicClien
Functions

UTCRUCAR.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <olectl.h>
#include <apputil.h>
#include <icars.h>
#include <carguids.h>
#include "licclien.h"
#include "utcrucar.h"

Go to the source code of this file.

Functions

HRESULT CreateUtilityCruiseCar (IUnknown *pUnkOuter, REFIID riid, BSTR bstrLicKey, PPVOID ppv)
STDMETHODIMP_ (ULONG) COUtilityCruiseCar

Function Documentation

HRESULT CreateUtilityCruiseCar | ( | IUnknown * | pUnkOuter,
 |  | REFIID | riid,
 |  | BSTR | bstrLicKey,
 |  | PPVOID | ppv
 | ) |  |

Definition at line 582 of file UTCRUCAR.Cpp.

{
  HRESULT hr;
  COUtilityCruiseCar* pCob;

  LOGF1("C: CreateUtilityCruiseCar. pUnkOuter=0x%X.",pUnkOuter);

  // If the creation call is requesting aggregation (pUnkOuter != NULL),
  // the COM rules state the IUnknown interface MUST also be concomitantly
  // requested.  If it is not so requested ( riid != IID_IUnknown) then
  // an error must be returned indicating that no aggregate creation of
  // the COUtilityCruiseCar COM Object can be performed using anything
  // other than a controlling IUnknown interface.
  if (NULL != pUnkOuter && riid != IID_IUnknown)
    hr = CLASS_E_NOAGGREGATION;
  else
  {
    // Instantiate a COUtilityCruiseCar COM Object.
    pCob = new COUtilityCruiseCar(pUnkOuter);
    if (NULL != pCob)
    {
      // If we have succeeded in instantiating the COUtilityCruiseCar object
      // we initialize it to offer it's interfaces.
      hr = pCob->Init(bstrLicKey);
      if (SUCCEEDED(hr))
      {
        // We QueryInterface this new COM Object not only to deposit the
        // main interface pointer to the caller's pointer variable, but to
        // also automatically bump the Reference Count on the new COM
        // Object after handing out this *ppv reference to it.
        hr = pCob->QueryInterface(riid, (PPVOID)ppv);
      }
    }
    else
      hr = E_OUTOFMEMORY;
  }

  if (SUCCEEDED(hr))
  {
    LOGF1("C: CreateUtilityCruiseCar Succeeded. *ppv=0x%X.",*ppv);
  }
  else
  {
    LOG("C: CreateUtilityCruiseCar Failed.");
  }

  return hr;
}

STDMETHODIMP_ ( ULONG )

Definition at line 457 of file UTCRUCAR.Cpp.

{
  // Decrement the Interface Reference Count.
  --m_cRefI;

  LOGF1("C: COUtilityCruiseCar::CImpIUtility::Release. Delegating. New cI=%i.", m_cRefI);

  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:17 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/LicClien/UTCRUCAR.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • LicClien

UTCRUCAR.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/LicServe/CRUCAR.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • LicServe
Functions

CRUCAR.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <apputil.h>
#include <icars.h>
#include <carguids.h>
#include "server.h"
#include "crucar.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) COLicCruiseCar

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 442 of file CRUCAR.Cpp.

{
  // Decrement the Interface Reference Count.
  --m_cRefI;

  LOGF1("P: COLicCruiseCar::CImpICruise::Release. Delegating. New cI=%i.",m_cRefI);

  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/LicServe/CRUCAR.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • LicServe

CRUCAR.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/LicServe/Factory.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • LicServe
Functions

Factory.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <olectl.h>
#include <apputil.h>
#include <icars.h>
#include <carguids.h>
#include "server.h"
#include "factory.h"
#include "crucar.h"
#include "sample.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CFLicCruiseCar

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 1032 of file Factory.Cpp.

{
  // Decrement the Interface Reference Count.
  --m_cRefI;

  LOGF1("P: CFLicCarSample::CImpIClassFactory::Release. Delegating. New cI=%i.",m_cRefI);

  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/LicServe/Factory.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • LicServe

Factory.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/LicServe/LicServe.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • LicServe
Defines | Functions | Variables

LicServe.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <initguid.h>
#include <olectl.h>
#include <apputil.h>
#include <icars.h>
#include <carguids.h>
#include "licserve.h"
#include "server.h"
#include "factory.h"

Go to the source code of this file.

Defines

#define | _DLLEXPORT_

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, PPVOID ppv)
BOOL WINAPI | DllMain (HINSTANCE hDllInst, DWORD fdwReason, LPVOID lpvReserved)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)
BOOL | UnicodeOk (void)

Variables

CMsgLog * | g_pMsgLog = NULL
CServer * | g_pServer = NULL

Define Documentation

#define _DLLEXPORT_

Definition at line 67 of file LicServe.Cpp.

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 274 of file LicServe.Cpp.

{
  HRESULT hr;

  LOGF2("P: DllCanUnloadNow. cObjects=%i, cLocks=%i.", g_pServer->m_cObjects, g_pServer->m_cLocks);

  // We return S_OK of there are no longer any living objects AND
  // there are no outstanding client locks on this server.
  hr = (0L==g_pServer->m_cObjects && 0L==g_pServer->m_cLocks) ? S_OK : S_FALSE;

  return hr;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | PPVOID | ppv
 | ) |  |

Definition at line 226 of file LicServe.Cpp.

{
  HRESULT hr = CLASS_E_CLASSNOTAVAILABLE;
  IUnknown* pCob = NULL;

  if (CLSID_LicCruiseCar == rclsid)
  {
    LOG("P: DllGetClassObject: Requesting CFLicCruiseCar.");
    hr = E_OUTOFMEMORY;
    pCob = new CFLicCruiseCar(NULL, g_pServer);
  }
  else if (CLSID_LicCarSample == rclsid)
  {
    LOG("P: DllGetClassObject: Requesting CFLicCarSample.");
    hr = E_OUTOFMEMORY;
    pCob = new CFLicCarSample(NULL, g_pServer);
  }

  if (NULL != pCob)
  {
    g_pServer->ObjectsUp();
    hr = pCob->QueryInterface(riid, ppv);
    if (FAILED(hr))
    {
      g_pServer->ObjectsDown();
      DELETE_POINTER(pCob);
    }
  }

  return hr;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hDllInst,
 |  | DWORD | fdwReason,
 |  | LPVOID | lpvReserved
 | ) |  |

Definition at line 142 of file LicServe.Cpp.

{
  BOOL bResult = TRUE;

  // Dispatch this main call based on the reason it was called.
  switch (fdwReason)
  {
    case DLL_PROCESS_ATTACH:
      // The DLL is being loaded for the first time by a given process.
      // Perform per-process initialization here.  If the initialization
      // is successful, return TRUE; if unsuccessful, return FALSE.
      bResult = FALSE;
      if (UnicodeOk())
      {
        // Instantiate the CServer utility class.
        g_pServer = new CServer;
        if (NULL != g_pServer)
        {
          // Remember the DLL Instance handle.
          g_pServer->m_hDllInst = hDllInst;

          // Create a MsgBox object.
          g_pServer->m_pMsgBox = new CMsgBox;
          if (NULL != g_pServer->m_pMsgBox)
          {
            // Check for valid Machine License.
            g_pServer->CheckLicense();
            bResult = TRUE;
          }
        }
      }
      break;

    case DLL_PROCESS_DETACH:
      // The DLL is being unloaded by a given process.  Do any
      // per-process clean up here, such as undoing what was done in
      // DLL_PROCESS_ATTACH.  The return value is ignored.
      DELETE_POINTER(g_pServer->m_pMsgBox);
      DELETE_POINTER(g_pServer);
      break;

    case DLL_THREAD_ATTACH:
      // A thread is being created in a process that has already loaded
      // this DLL.  Perform any per-thread initialization here.  The
      // return value is ignored.
      break;

    case DLL_THREAD_DETACH:
      // A thread is exiting cleanly in a process that has already
      // loaded this DLL.  Perform any per-thread clean up here.  The
      // return value is ignored.
      break;

    default:
      break;
  }

  return (bResult);
}

STDAPI DllRegisterServer ( void )

Definition at line 299 of file LicServe.Cpp.

{
  HRESULT  hr = NOERROR;
  TCHAR    szID[GUID_SIZE+1];
  TCHAR    szCLSID[GUID_SIZE+32];
  TCHAR    szModulePath[MAX_PATH];

  // Obtain the path to this module's executable file for later use.
  GetModuleFileName(
    g_pServer->m_hDllInst,
    szModulePath,
    sizeof(szModulePath) / sizeof(TCHAR));

  /*-------------------------------------------------------------------------
    Create registry entries for the LicCruiseCar Component.
  -------------------------------------------------------------------------*/
  // Create some base key strings.
  StringFromGUID2(CLSID_LicCruiseCar, szID, GUID_SIZE);
  lstrcpyn(szCLSID, TEXT("CLSID\\"), sizeof(szCLSID)/sizeof(TCHAR));
  lstrncat(szCLSID, szID, sizeof(szCLSID)/sizeof(TCHAR) - lstrlen(szCLSID));

  // Create ProgID keys.
  SetRegKeyValue(
    TEXT("CTS.LicCruiseCar.1"),
    NULL,
    TEXT("LicCruiseCar Component - LICSERVE Code Sample"));
  SetRegKeyValue(
    TEXT("CTS.LicCruiseCar.1"),
    TEXT("CLSID"),
    szID);

  // Create VersionIndependentProgID keys.
  SetRegKeyValue(
    TEXT("CTS.LicCruiseCar"),
    NULL,
    TEXT("LicCruiseCar Component - LICSERVE Code Sample"));
  SetRegKeyValue(
    TEXT("CTS.LicCruiseCar"),
    TEXT("CurVer"),
    TEXT("CTS.LicCruiseCar.1"));
  SetRegKeyValue(
    TEXT("CTS.LicCruiseCar"),
    TEXT("CLSID"),
    szID);

  // Create entries under CLSID.
  SetRegKeyValue(
    szCLSID,
    NULL,
    TEXT("LicCruiseCar Component - LICSERVE Code Sample"));
  SetRegKeyValue(
    szCLSID,
    TEXT("ProgID"),
    TEXT("CTS.LicCruiseCar.1"));
  SetRegKeyValue(
    szCLSID,
    TEXT("VersionIndependentProgID"),
    TEXT("CTS.LicCruiseCar"));
  SetRegKeyValue(
    szCLSID,
    TEXT("NotInsertable"),
    NULL);
  SetRegKeyValue(
    szCLSID,
    TEXT("InprocServer32"),
    szModulePath);

  /*-------------------------------------------------------------------------
    Create registry entries for the LicCarSample Component.
  -------------------------------------------------------------------------*/
  // Create some base key strings.
  StringFromGUID2(CLSID_LicCarSample, szID, GUID_SIZE);
  lstrcpyn(szCLSID, TEXT("CLSID\\"), sizeof(szCLSID)/sizeof(TCHAR));
  lstrncat(szCLSID, szID, sizeof(szCLSID)/sizeof(TCHAR) - lstrlen(szCLSID));

  // Create ProgID keys.
  SetRegKeyValue(
    TEXT("CTS.LicCarSample.1"),
    NULL,
    TEXT("LicCarSample Component - LICSERVE Code Sample"));
  SetRegKeyValue(
    TEXT("CTS.LicCarSample.1"),
    TEXT("CLSID"),
    szID);

  // Create VersionIndependentProgID keys.
  SetRegKeyValue(
    TEXT("CTS.LicCarSample"),
    NULL,
    TEXT("LicCarSample Component - LICSERVE Code Sample"));
  SetRegKeyValue(
    TEXT("CTS.LicCarSample"),
    TEXT("CurVer"),
    TEXT("CTS.LicCarSample.1"));
  SetRegKeyValue(
    TEXT("CTS.LicCarSample"),
    TEXT("CLSID"),
    szID);

  // Create entries under CLSID.
  SetRegKeyValue(
    szCLSID,
    NULL,
    TEXT("LicCarSample Component - LICSERVE Code Sample"));
  SetRegKeyValue(
    szCLSID,
    TEXT("ProgID"),
    TEXT("CTS.LicCarSample.1"));
  SetRegKeyValue(
    szCLSID,
    TEXT("VersionIndependentProgID"),
    TEXT("CTS.LicCarSample"));
  SetRegKeyValue(
    szCLSID,
    TEXT("NotInsertable"),
    NULL);
  SetRegKeyValue(
    szCLSID,
    TEXT("InprocServer32"),
    szModulePath);

  return hr;
}

STDAPI DllUnregisterServer ( void )

Definition at line 436 of file LicServe.Cpp.

{
  HRESULT  hr = NOERROR;
  TCHAR    szID[GUID_SIZE+1];
  TCHAR    szCLSID[GUID_SIZE+32];
  TCHAR    szTemp[MAX_PATH+GUID_SIZE];

  /*-------------------------------------------------------------------------
    Delete registry entries for the LicCruiseCar Component.
  -------------------------------------------------------------------------*/
  //Create some base key strings.
  StringFromGUID2(CLSID_LicCruiseCar, szID, GUID_SIZE);
  lstrcpyn(szCLSID, TEXT("CLSID\\"), sizeof(szCLSID)/sizeof(TCHAR));
  lstrncat(szCLSID, szID, sizeof(szCLSID)/sizeof(TCHAR) - lstrlen(szCLSID));

  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.LicCruiseCar\\CurVer"));
  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.LicCruiseCar\\CLSID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.LicCruiseCar"));

  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.LicCruiseCar.1\\CLSID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.LicCruiseCar.1"));

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("ProgID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("VersionIndependentProgID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("NotInsertable"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("InprocServer32"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  RegDeleteKey(HKEY_CLASSES_ROOT, szCLSID);

  /*-------------------------------------------------------------------------
    Delete registry entries for the LicCarSample Component.
  -------------------------------------------------------------------------*/
  //Create some base key strings.
  StringFromGUID2(CLSID_LicCarSample, szID, GUID_SIZE);
  lstrcpyn(szCLSID, TEXT("CLSID\\"), sizeof(szCLSID)/sizeof(TCHAR));
  lstrncat(szCLSID, szID, sizeof(szCLSID)/sizeof(TCHAR) - lstrlen(szCLSID));

  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.LicCarSample\\CurVer"));
  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.LicCarSample\\CLSID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.LicCarSample"));

  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.LicCarSample.1\\CLSID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.LicCarSample.1"));

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("ProgID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("VersionIndependentProgID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("NotInsertable"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("InprocServer32"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  RegDeleteKey(HKEY_CLASSES_ROOT, szCLSID);

  return hr;
}

BOOL UnicodeOk ( void )

Definition at line 95 of file LicServe.Cpp.

{
  BOOL bOk = TRUE;
  TCHAR szUserName[MAX_STRING_LENGTH];
  DWORD dwSize = MAX_STRING_LENGTH;

  if (!GetUserName(szUserName, &dwSize))
    bOk = ERROR_CALL_NOT_IMPLEMENTED == GetLastError() ? FALSE : TRUE;

  return bOk;
}

Variable Documentation

CMsgLog* g_pMsgLog = NULL

Definition at line 81 of file LicServe.Cpp.

CServer* g_pServer = NULL

Definition at line 77 of file LicServe.Cpp.

Generated on Wed Nov 13 2024 16:53:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/LicServe/LicServe.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • LicServe
Defines | Functions

LicServe.h File Reference

Go to the source code of this file.

Defines

#define | DLLENTRY extern __declspec(dllimport)
#define | STDENTRY DLLENTRY HRESULT WINAPI
#define | STDENTRY_(type) DLLENTRY type WINAPI

Functions

STDENTRY | DllRegisterServer (void)
STDENTRY | DllUnregisterServer (void)

Define Documentation

#define DLLENTRY extern __declspec(dllimport)

Definition at line 47 of file LicServe.h.

#define STDENTRY DLLENTRY HRESULT WINAPI

Definition at line 49 of file LicServe.h.

#define STDENTRY_ ( type ) DLLENTRY type WINAPI

Definition at line 50 of file LicServe.h.

Function Documentation

STDENTRY DllRegisterServer ( void )

Definition at line 69 of file ComSpyAudit.Cpp.

{
  // registers object, typelib and all interfaces in typelib
  return _Module.RegisterServer(TRUE);
}

STDENTRY DllUnregisterServer ( void )

Definition at line 78 of file ComSpyAudit.Cpp.

{
  _Module.UnregisterServer();
  return S_OK;
}

Generated on Wed Nov 13 2024 16:53:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/LicServe/Sample.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • LicServe
Functions

Sample.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <apputil.h>
#include <icars.h>
#include <carguids.h>
#include "server.h"
#include "sample.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) COLicCarSample

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 377 of file Sample.Cpp.

{
  // Decrement the Interface Reference Count.
  --m_cRefI;

  LOGF1("P: COLicCarSample::CImpISample::Release. Delegating. New cI=%i.", m_cRefI);

  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/LicServe/Sample.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • LicServe

Sample.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/LicServe/Server.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • LicServe

Server.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <apputil.h>
#include "server.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/LicServe/Server.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • LicServe
Defines | Variables

Server.h File Reference

Go to the source code of this file.

Defines

#define | ABOUT_TITLE_STR "LICSERVE: Tutorial Code Sample"
#define | IDD_ABOUTBOX 1000
#define | IDS_ASSERT_FAIL 2200
#define | LICENSE_EXT_STR ".LIC"
#define | MAX_LICENSEKEY 128

Variables

CMsgLog * | g_pMsgLog
CServer * g_pServer

Define Documentation

#define ABOUT_TITLE_STR "LICSERVE: Tutorial Code Sample"

Definition at line 44 of file Server.h.

#define IDD_ABOUTBOX 1000

Definition at line 50 of file Server.h.

#define IDS_ASSERT_FAIL 2200

Definition at line 53 of file Server.h.

#define LICENSE_EXT_STR ".LIC"

Definition at line 45 of file Server.h.

#define MAX_LICENSEKEY 128

Definition at line 47 of file Server.h.

Variable Documentation

CMsgLog* g_pMsgLog

Definition at line 89 of file AptClien.Cpp.

CServer* g_pServer

Definition at line 78 of file AptServe.Cpp.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/LocClien/LocClien.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • LocClien
Functions | Variables

LocClien.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <initguid.h>
#include <commdlg.h>
#include <apputil.h>
#include <micars.h>
#include <carguids.h>
#include "locclien.h"
#include "utcrucar.h"

Go to the source code of this file.

Functions

BOOL | InitApplication (HINSTANCE hInstance)
BOOL | UnicodeOk (void)
int PASCAL | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

Variables

CMsgLog * | g_pMsgLog = NULL

Function Documentation

BOOL InitApplication ( HINSTANCE hInstance )

Definition at line 1003 of file LocClien.Cpp.

{
  BOOL bOk;
  // The window class for all instances of the main frame window.
  WNDCLASSEX wcf;

  // Assign the appropriate values for this main frame window class.
  wcf.cbSize        = sizeof(WNDCLASSEX);
  wcf.cbClsExtra    = 0;            // No per-class extra data.
  wcf.cbWndExtra    = 0;            // No per-window extra data.
  wcf.hInstance     = hInstance;    // Application module instance.
  wcf.lpfnWndProc   = &WindowProc;  // Global Window Procedure (defined in
                                    // APPUTIL for all CVirWindows).
  wcf.hCursor       = LoadCursor(NULL, IDC_ARROW); // Load app cursor.
  wcf.hIcon         = (HICON) LoadIcon(            // Load app icon.
                                hInstance,
                                TEXT("AppIcon"));
  wcf.hIconSm       = (HICON) LoadImage(           // Load small icon.
                                hInstance,
                                TEXT("AppIcon"),
                                IMAGE_ICON,
                                16, 16,
                                0);
  wcf.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);  // Default backgnd color.
  wcf.style         = CS_HREDRAW | CS_VREDRAW;     // Class style(s).
  wcf.lpszClassName = TEXT(MAIN_WINDOW_CLASS_NAME_STR); // Class name.
  wcf.lpszMenuName  = TEXT(MAIN_WINDOW_CLASS_MENU_STR); // Menu name.

  // Register the window class and return FALSE if unsuccesful.
  bOk = RegisterClassEx(&wcf);

  return (bOk);
}

BOOL UnicodeOk ( void )

Definition at line 977 of file LocClien.Cpp.

{
  BOOL bOk = TRUE;
  TCHAR szUserName[MAX_STRING_LENGTH];
  DWORD dwSize = MAX_STRING_LENGTH;

  if (!GetUserName(szUserName, &dwSize))
    bOk = ERROR_CALL_NOT_IMPLEMENTED == GetLastError() ? FALSE : TRUE;

  return bOk;
}

int PASCAL WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 1060 of file LocClien.Cpp.

{
  CMainWindow* pWin = NULL;
  MSG msg;
  HACCEL hAccel;
  int iRun = FALSE;

  // If we were compiled for UNICODE and the platform seems OK with this
  // then proceed.  Else we error and exit the app.
  if (UnicodeOk())
  {
    // Call to initialize the COM Library.  Use the SUCCEEDED macro
    // to detect success.  If fail then exit app with error message.
    if (SUCCEEDED(CoInitialize(NULL)))
    {
      // If we succeeded in initializing the COM Library we proceed to
      // initialize the application.  If we can't init the application
      // then we signal shut down with an error message exit.
      iRun = InitApplication(hInstance);
      if (iRun)
      {
        // Assume we'll set iRun to TRUE when initialization is done.
        iRun = FALSE;
        // We are still go for running so we try to create a nifty new
        // CMainWindow object for this app instance.
        pWin = new CMainWindow;
        if (NULL != pWin)
        {
          // Now we initialize an instance of the new CMainWindow.
          // This includes creating the main window.
          if (pWin->InitInstance(hInstance, nCmdShow))
          {
            // Load the keyboard accelerators from the resources.
            hAccel = LoadAccelerators(hInstance, TEXT("AppAccel"));
            if (NULL != hAccel)
            {
              // Signal App Initialization is successfully done.
              iRun = TRUE;
            }
          }
        }
      }

      if (iRun)
      {
        // If we initialized the app instance properly then we are still
        // go for running.  We then start up the main message pump for
        // the application.
        while (GetMessage(&msg, NULL, 0, 0))
        {
          if (!TranslateAccelerator(
                 pWin->GetHwnd(),
                 hAccel,
                 &msg))
          {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
          }
        }

        // We ask COM to unload any unused COM Servers.
        CoFreeUnusedLibraries();

        // We'll pass to Windows the reason why we exited the message loop.
        iRun = msg.wParam;
      }
      else
      {
        // We failed to initialize the application. Put up error message
        // box saying that application couldn't be initialized.  Parent
        // window is desktop (ie, NULL). Exit the failed application
        // (ie, by returning FALSE to WinMain).
        ErrorBox(hInstance, NULL, IDS_APPINITFAILED);

        // Delete the CMainWindow object.
        DELETE_POINTER(pWin);
      }

      // We're exiting this app (either normally or by init failure) so
      // shut down the COM Library.
      CoUninitialize();
    }
    else
    {
      // We failed to Initialize the COM Library. Put up error message box
      // saying that COM Library couldn't be initialized.  Parent window
      // is desktop (ie, NULL). Exit the failed application (ie, by
      // returning FALSE to WinMain).
      ErrorBox(hInstance, NULL, IDS_COMINITFAILED);
    }
  }
  else
  {
    // If we were compiled for UNICODE but the platform has problems with
    // this then indicate an error and exit the app immediately.
    CHAR szMsg[MAX_STRING_LENGTH];

    if (LoadStringA(
          hInstance,
          IDS_NOUNICODE,
          szMsg,
          MAX_STRING_LENGTH))
    {
      MessageBoxA(
        NULL,
        szMsg,
        ERROR_TITLE_STR,
        MB_OK | MB_ICONEXCLAMATION);
    }
  }

  return iRun;
}

Variable Documentation

CMsgLog* g_pMsgLog = NULL

Definition at line 88 of file LocClien.Cpp.

Generated on Wed Nov 13 2024 16:53:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/LocClien/LocClien.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • LocClien
Defines

LocClien.h File Reference

Go to the source code of this file.

Defines

#define | IDM_CAR_CLUTCH 1103
#define | IDM_CAR_CREATE 1100
#define | IDM_CAR_RELEASE 1101
#define | IDM_CAR_SHIFT 1102
#define | IDM_CAR_SPEED 1104
#define | IDM_CAR_STEER 1105
#define | IDM_CCAR_ADJUST 1307
#define | IDM_CCAR_CLUTCH 1303
#define | IDM_CCAR_CREATE 1300
#define | IDM_CCAR_ENGAGE 1306
#define | IDM_CCAR_RELEASE 1301
#define | IDM_CCAR_SHIFT 1302
#define | IDM_CCAR_SPEED 1304
#define | IDM_CCAR_STEER 1305
#define | IDM_FILE_EXIT 1000
#define | IDM_HELP_ABOUT 1905
#define | IDM_HELP_ABOUTSERVER 1906
#define | IDM_HELP_CONTENTS 1900
#define | IDM_HELP_READSOURCE 1904
#define | IDM_HELP_TUTMARSHAL 1903
#define | IDM_HELP_TUTORIAL 1901
#define | IDM_HELP_TUTSERVER 1902
#define | IDM_LOG_COPYCLIP 1892
#define | IDM_LOG_LOGCLEAR 1890
#define | IDM_LOG_LOGGING 1891
#define | IDM_UCAR_CLUTCH 1203
#define | IDM_UCAR_CREATE 1200
#define | IDM_UCAR_OFFROAD 1206
#define | IDM_UCAR_RELEASE 1201
#define | IDM_UCAR_SHIFT 1202
#define | IDM_UCAR_SPEED 1204
#define | IDM_UCAR_STEER 1205
#define | IDM_UCAR_WINCH 1207
#define | IDM_UCRU_ADJUST 1407
#define | IDM_UCRU_CLUTCH 1403
#define | IDM_UCRU_CREATE 1400
#define | IDM_UCRU_ENGAGE 1406
#define | IDM_UCRU_OFFROAD 1408
#define | IDM_UCRU_RELEASE 1401
#define | IDM_UCRU_SHIFT 1402
#define | IDM_UCRU_SPEED 1404
#define | IDM_UCRU_STEER 1405
#define | IDM_UCRU_WINCH 1409
#define | IDS_APPINITFAILED 2001
#define | IDS_ASSERT_FAIL 2200
#define | IDS_COMINITFAILED 2000
#define | IDS_NOSERVER 2004
#define | IDS_NOTIMPLEMENTED 2301
#define | IDS_NOUNICODE 2003
#define | IDS_OUTOFMEMORY 2002
#define | IDS_START_MESSAGE_LOG 2400
#define | MAIN_WINDOW_CLASS_MENU_STR "LOCCLIENMenu"
#define | MAIN_WINDOW_CLASS_NAME_STR "LOCCLIENWindow"
#define | MAIN_WINDOW_TITLE_STR "LOCCLIEN: Tutorial Code Sample"
#define | MARSHAL_TUTFILE_STR "marshal.htm"
#define | OFN_DEFAULTFILES_STR "All Files (*.*)\0*.*\0"
#define | OFN_DEFAULTTITLE_STR "Open File"
#define | SERVER_TUTFILE_STR "locserve.htm"
#define | SERVER_WINDOW_TITLE_STR "LOCSERVE: Tutorial Code Sample"

Define Documentation

#define IDM_CAR_CLUTCH 1103

Definition at line 115 of file LocClien.h.

#define IDM_CAR_CREATE 1100

Definition at line 112 of file LocClien.h.

#define IDM_CAR_RELEASE 1101

Definition at line 113 of file LocClien.h.

#define IDM_CAR_SHIFT 1102

Definition at line 114 of file LocClien.h.

#define IDM_CAR_SPEED 1104

Definition at line 116 of file LocClien.h.

#define IDM_CAR_STEER 1105

Definition at line 117 of file LocClien.h.

#define IDM_CCAR_ADJUST 1307

Definition at line 137 of file LocClien.h.

#define IDM_CCAR_CLUTCH 1303

Definition at line 133 of file LocClien.h.

#define IDM_CCAR_CREATE 1300

Definition at line 130 of file LocClien.h.

#define IDM_CCAR_ENGAGE 1306

Definition at line 136 of file LocClien.h.

#define IDM_CCAR_RELEASE 1301

Definition at line 131 of file LocClien.h.

#define IDM_CCAR_SHIFT 1302

Definition at line 132 of file LocClien.h.

#define IDM_CCAR_SPEED 1304

Definition at line 134 of file LocClien.h.

#define IDM_CCAR_STEER 1305

Definition at line 135 of file LocClien.h.

#define IDM_FILE_EXIT 1000

Definition at line 109 of file LocClien.h.

#define IDM_HELP_ABOUT 1905

Definition at line 162 of file LocClien.h.

#define IDM_HELP_ABOUTSERVER 1906

Definition at line 163 of file LocClien.h.

#define IDM_HELP_CONTENTS 1900

Definition at line 157 of file LocClien.h.

#define IDM_HELP_READSOURCE 1904

Definition at line 161 of file LocClien.h.

#define IDM_HELP_TUTMARSHAL 1903

Definition at line 160 of file LocClien.h.

#define IDM_HELP_TUTORIAL 1901

Definition at line 158 of file LocClien.h.

#define IDM_HELP_TUTSERVER 1902

Definition at line 159 of file LocClien.h.

#define IDM_LOG_COPYCLIP 1892

Definition at line 154 of file LocClien.h.

#define IDM_LOG_LOGCLEAR 1890

Definition at line 152 of file LocClien.h.

#define IDM_LOG_LOGGING 1891

Definition at line 153 of file LocClien.h.

#define IDM_UCAR_CLUTCH 1203

Definition at line 123 of file LocClien.h.

#define IDM_UCAR_CREATE 1200

Definition at line 120 of file LocClien.h.

#define IDM_UCAR_OFFROAD 1206

Definition at line 126 of file LocClien.h.

#define IDM_UCAR_RELEASE 1201

Definition at line 121 of file LocClien.h.

#define IDM_UCAR_SHIFT 1202

Definition at line 122 of file LocClien.h.

#define IDM_UCAR_SPEED 1204

Definition at line 124 of file LocClien.h.

#define IDM_UCAR_STEER 1205

Definition at line 125 of file LocClien.h.

#define IDM_UCAR_WINCH 1207

Definition at line 127 of file LocClien.h.

#define IDM_UCRU_ADJUST 1407

Definition at line 147 of file LocClien.h.

#define IDM_UCRU_CLUTCH 1403

Definition at line 143 of file LocClien.h.

#define IDM_UCRU_CREATE 1400

Definition at line 140 of file LocClien.h.

#define IDM_UCRU_ENGAGE 1406

Definition at line 146 of file LocClien.h.

#define IDM_UCRU_OFFROAD 1408

Definition at line 148 of file LocClien.h.

#define IDM_UCRU_RELEASE 1401

Definition at line 141 of file LocClien.h.

#define IDM_UCRU_SHIFT 1402

Definition at line 142 of file LocClien.h.

#define IDM_UCRU_SPEED 1404

Definition at line 144 of file LocClien.h.

#define IDM_UCRU_STEER 1405

Definition at line 145 of file LocClien.h.

#define IDM_UCRU_WINCH 1409

Definition at line 149 of file LocClien.h.

#define IDS_APPINITFAILED 2001

Definition at line 167 of file LocClien.h.

#define IDS_ASSERT_FAIL 2200

Definition at line 172 of file LocClien.h.

#define IDS_COMINITFAILED 2000

Definition at line 166 of file LocClien.h.

#define IDS_NOSERVER 2004

Definition at line 170 of file LocClien.h.

#define IDS_NOTIMPLEMENTED 2301

Definition at line 175 of file LocClien.h.

#define IDS_NOUNICODE 2003

Definition at line 169 of file LocClien.h.

#define IDS_OUTOFMEMORY 2002

Definition at line 168 of file LocClien.h.

#define IDS_START_MESSAGE_LOG 2400

Definition at line 178 of file LocClien.h.

#define MAIN_WINDOW_CLASS_MENU_STR "LOCCLIENMenu"

Definition at line 97 of file LocClien.h.

#define MAIN_WINDOW_CLASS_NAME_STR "LOCCLIENWindow"

Definition at line 96 of file LocClien.h.

#define MAIN_WINDOW_TITLE_STR "LOCCLIEN: Tutorial Code Sample"

Definition at line 95 of file LocClien.h.

#define MARSHAL_TUTFILE_STR "marshal.htm"

Definition at line 102 of file LocClien.h.

#define OFN_DEFAULTFILES_STR "All Files (*.*)\0*.*\0"

Definition at line 105 of file LocClien.h.

#define OFN_DEFAULTTITLE_STR "Open File"

Definition at line 106 of file LocClien.h.

#define SERVER_TUTFILE_STR "locserve.htm"

Definition at line 101 of file LocClien.h.

#define SERVER_WINDOW_TITLE_STR "LOCSERVE: Tutorial Code Sample"

Definition at line 98 of file LocClien.h.

Generated on Wed Nov 13 2024 16:53:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/LocClien/UTCRUCAR.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • LocClien
Functions

UTCRUCAR.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <apputil.h>
#include <micars.h>
#include <carguids.h>
#include "locclien.h"
#include "utcrucar.h"

Go to the source code of this file.

Functions

HRESULT CreateUtilityCruiseCar (IUnknown *pUnkOuter, REFIID riid, PPVOID ppv)
STDMETHODIMP_ (ULONG) COUtilityCruiseCar

Function Documentation

HRESULT CreateUtilityCruiseCar | ( | IUnknown * | pUnkOuter,
 |  | REFIID | riid,
 |  | PPVOID | ppv
 | ) |  |

Definition at line 1029 of file UTCRUCAR.Cpp.

{
  HRESULT hr;
  COUtilityCruiseCar* pCob;

  LOGF1("C: CreateUtilityCruiseCar. pUnkOuter=0x%X.",pUnkOuter);

  // If the creation call is requesting aggregation (pUnkOuter != NULL),
  // the COM rules state the IUnknown interface MUST also be concomitantly
  // requested.  If it is not so requested ( riid != IID_IUnknown) then
  // an error must be returned indicating that no aggregate creation of
  // the COUtilityCruiseCar COM Object can be performed using anything
  // other than a controlling IUnknown interface.
  if (NULL != pUnkOuter && riid != IID_IUnknown)
    hr = CLASS_E_NOAGGREGATION;
  else
  {
    // Instantiate a COUtilityCruiseCar COM Object.
    pCob = new COUtilityCruiseCar(pUnkOuter);
    if (NULL != pCob)
    {
      // If we have succeeded in instantiating the COUtilityCruiseCar object
      // we initialize it (with any subordinate COM objects) to offer it's
      // interfaces.
      hr = pCob->Init();
      if (SUCCEEDED(hr))
      {
        // We QueryInterface this new COM Object not only to deposit the
        // main interface pointer to the caller's pointer variable, but to
        // also automatically bump the Reference Count on the new COM
        // Object after handing out this *ppv reference to it.
        hr = pCob->QueryInterface(riid, (PPVOID)ppv);
      }
      else
        DELETE_POINTER(pCob);
    }
    else
      hr = E_OUTOFMEMORY;
  }

  if (SUCCEEDED(hr))
  {
    LOGF1("C: CreateUtilityCruiseCar Succeeded. *ppv=0x%X.",*ppv);
  }
  else
  {
    LOGF1("C: CreateUtilityCruiseCar Failed. hr=0x%X.",hr);
  }

  return hr;
}

STDMETHODIMP_ ( ULONG )

Definition at line 924 of file UTCRUCAR.Cpp.

{
  // Decrement the Interface Reference Count.
  --m_cRefI;

  LOGF1("C: COUtilityCruiseCar::CImpIUtility::Release. Delegating. New cI=%i.", m_cRefI);

  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:17 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/LocClien/UTCRUCAR.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • LocClien

UTCRUCAR.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/LocServe/CAR.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • LocServe
Functions

CAR.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <apputil.h>
#include <micars.h>
#include <carguids.h>
#include "server.h"
#include "car.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) COCar

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 375 of file CAR.Cpp.

{
  // Decrement the Interface Reference Count.
  --m_cRefI;

  LOGF1("L: COCar::CImpICar::Release. Delegating. New cI=%i.", m_cRefI);

  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/LocServe/CAR.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • LocServe

CAR.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/LocServe/CRUCAR.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • LocServe
Functions

CRUCAR.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <apputil.h>
#include <micars.h>
#include <carguids.h>
#include "server.h"
#include "car.h"
#include "crucar.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) COCruiseCar

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 453 of file CRUCAR.Cpp.

{
  // Decrement the Interface Reference Count.
  --m_cRefI;

  LOGF1("L: COCruiseCar::CImpICruise::Release. Delegating. New cI=%i.",m_cRefI);

  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/LocServe/CRUCAR.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • LocServe

CRUCAR.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/LocServe/Factory.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • LocServe
Functions

Factory.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <apputil.h>
#include <micars.h>
#include <carguids.h>
#include "server.h"
#include "factory.h"
#include "car.h"
#include "utilcar.h"
#include "crucar.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CFCar

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 1238 of file Factory.Cpp.

{
  // Decrement the Interface Reference Count.
  InterlockedDecrement((PLONG) &m_cRefI);

  LOGF1("L: CFCruiseCar::CImpIClassFactory::Release. Delegating. New cI=%i.",m_cRefI);

  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/LocServe/Factory.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • LocServe

Factory.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/LocServe/LocServe.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • LocServe
Functions | Variables

LocServe.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <initguid.h>
#include <apputil.h>
#include <micars.h>
#include <carguids.h>
#include "locserve.h"
#include "server.h"
#include "factory.h"

Go to the source code of this file.

Functions

BOOL | InitApplication (HINSTANCE hInstance)
BOOL | UnicodeOk (void)
int WINAPI | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

Variables

CSendLog * | g_pMsgLog = NULL
CServer * | g_pServer = NULL

Function Documentation

BOOL InitApplication ( HINSTANCE hInstance )

Definition at line 783 of file LocServe.Cpp.

{
  BOOL bOk;
  // The window class for all instances of the main frame window.
  WNDCLASSEX wcf;

  // Assign the appropriate values for this main frame window class.
  wcf.cbSize        = sizeof(WNDCLASSEX);
  wcf.cbClsExtra    = 0;            // No per-class extra data.
  wcf.cbWndExtra    = 0;            // No per-window extra data.
  wcf.hInstance     = hInstance;    // Application module instance.
  wcf.lpfnWndProc   = &WindowProc;  // Global Window Procedure (defined in
                                    // APPUTIL for all CVirWindows).
  wcf.hCursor       = LoadCursor(NULL, IDC_ARROW); // Load app cursor.
  wcf.hIcon         = (HICON) LoadIcon(            // Load app icon.
                                hInstance,
                                TEXT("AppIcon"));
  wcf.hIconSm       = (HICON) LoadImage(           // Load small icon.
                                hInstance,
                                TEXT("AppIcon"),
                                IMAGE_ICON,
                                16, 16,
                                0);
  wcf.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);  // Default backgnd color.
  wcf.style         = CS_HREDRAW | CS_VREDRAW;     // Class style(s).
  wcf.lpszClassName = TEXT(MAIN_WINDOW_CLASS_NAME_STR); // Class name.
  wcf.lpszMenuName  = TEXT(MAIN_WINDOW_CLASS_MENU_STR); // Menu name.

  // Register the window class and return FALSE if unsuccesful.
  bOk = RegisterClassEx(&wcf);

  return (bOk);
}

BOOL UnicodeOk ( void )

Definition at line 758 of file LocServe.Cpp.

{
  BOOL bOk = TRUE;
  TCHAR szUserName[MAX_STRING_LENGTH];
  DWORD dwSize = MAX_STRING_LENGTH;

  if (!GetUserName(szUserName, &dwSize))
    bOk = ERROR_CALL_NOT_IMPLEMENTED == GetLastError() ? FALSE : TRUE;

  return bOk;
}

int WINAPI WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 840 of file LocServe.Cpp.

{
  CMainWindow* pWin = NULL;
  int iRun = TRUE;
  MSG msg;

  // If we were compiled for UNICODE and the platform seems OK with this
  // then proceed.  Else we error and exit the app.
  if (UnicodeOk())
  {
    // Call to initialize the COM Library.  Use the SUCCEEDED macro
    // to detect success.  If fail then exit app with error message.
    if (SUCCEEDED(CoInitialize(NULL)))
    {
      // If we succeeded in initializing the COM Library we proceed to
      // initialize the application.  If we can't init the application
      // then we signal shut down with an error message exit.
      iRun = InitApplication(hInstance);
      if (iRun)
      {
        // Assume we'll set iRun to TRUE when initialization is done.
        iRun = FALSE;

        // We are still go for running so we try to create a nifty new
        // CMainWindow object for this app instance.
        pWin = new CMainWindow;
        if (NULL != pWin)
        {
          // Setup the server control object.
          g_pServer = new CServer;
          if (NULL != g_pServer)
          {
            // Assign the server's instance handle.
            g_pServer->m_hInstServer = hInstance;

            // Check command line for switches to register or unregister
            // this server's managed components.   iRun will be set to 2
            // to signal an immediate and quiet exit of this application
            // if such registration or unregistration is requested.
            if (0 == lstrcmpiA(lpCmdLine, "-RegServer")
                || 0 == lstrcmpiA(lpCmdLine, "/RegServer"))
            {
              if (pWin->RegisterServer())
                iRun = 2;
            }
            else if (0 == lstrcmpiA(lpCmdLine, "-UnregServer")
                     || 0 == lstrcmpiA(lpCmdLine, "/UnregServer"))
            {
              if (pWin->UnregisterServer())
                iRun = 2;
            }

            if (FALSE == iRun)
            {
              // If we did not process a command line switch that
              // requires immediate exit, then initialize an instance of
              // the new CMainWindow. This entails creating the main window.
              if (pWin->InitInstance(hInstance, nCmdShow))
              {
                LOGF1("L: CmdLine Switches= %s", lpCmdLine);
                // Create and register the Class Factories.  But only do so
                // if this application has been launched by COM as indicated
                // by the -Embedding command line switch.
                if (0 == lstrcmpiA(lpCmdLine, "-Embedding")
                    || 0 == lstrcmpiA(lpCmdLine, "/Embedding"))
                  iRun = g_pServer->OpenFactories();
              }
            }
          }
        }
      }

      switch (iRun)
      {
        case TRUE:
          {
            // If we initialized the app instance properly then we are still
            // go for running.  We then start up the main message pump for
            // the application.  The application will live hidden as a local
            // server.
            while (GetMessage(&msg, NULL, 0, 0))
            {
              TranslateMessage(&msg);
              DispatchMessage(&msg);
            }

            // We'll pass to the OS the reason why we exited the message
            // loop.
            iRun = (int) msg.wParam;
          }
          break;

        case FALSE:
          // We failed to initialize the application--issue an error
          // messagebox.  Can't initialize or can't run stand-alone.
          ErrorBox(hInstance, NULL, IDS_APPINITFAILED);

          // Delete the CMainWindow object.
          DELETE_POINTER(pWin);

          // Pass the OS an error code of 1.
          iRun = 1;
          break;

        default:
          // Pass the OS an error code of 0.
          iRun = 0;
          break;
      }

      // We're exiting this app (either normally or by init failure) so
      // shut down the COM Library.
      CoUninitialize();
    }
    else
    {
      // We failed to Initialize the COM Library. Put up error message box
      // saying that COM Library couldn't be initialized.  Parent window
      // is desktop (ie, NULL). Exit the failed application (ie, by
      // returning FALSE to WinMain).
      ErrorBox(hInstance, NULL, IDS_COMINITFAILED);
    }
  }
  else
  {
    // If we were compiled for UNICODE but the platform has problems with
    // this then indicate an error and exit the app immediately.
    CHAR szMsg[MAX_STRING_LENGTH];

    if (LoadStringA(
          hInstance,
          IDS_NOUNICODE,
          szMsg,
          MAX_STRING_LENGTH))
    {
      MessageBoxA(
        NULL,
        szMsg,
        ERROR_TITLE_STR,
        MB_OK | MB_ICONEXCLAMATION);
    }
  }

  return iRun;
}

Variable Documentation

CSendLog* g_pMsgLog = NULL

Definition at line 81 of file LocServe.Cpp.

CServer* g_pServer = NULL

Definition at line 78 of file LocServe.Cpp.

Generated on Wed Nov 13 2024 16:53:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/LocServe/LocServe.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • LocServe
Defines

LocServe.h File Reference

Go to the source code of this file.

Defines

#define | CLIENT_WINDOW_TITLE "LOCCLIEN: Tutorial Code Sample"
#define | IDM_FILE_EXIT 1000
#define | IDM_HELP_ABOUT 1905
#define | IDM_LOG_COPYCLIP 1891
#define | IDM_LOG_LOGCLEAR 1890
#define | IDS_APPINITFAILED 2001
#define | IDS_ASSERT_FAIL 2200
#define | IDS_COMINITFAILED 2000
#define | IDS_LOGTO_CLIENT 2400
#define | IDS_LOGTO_SERVER 2401
#define | IDS_NOHELPFILE 2003
#define | IDS_NOSERVER 2005
#define | IDS_NOTIMPLEMENTED 2301
#define | IDS_NOUNICODE 2004
#define | IDS_OUTOFMEMORY 2002
#define | MAIN_WINDOW_CLASS_MENU_STR "LOCSERVEMenu"
#define | MAIN_WINDOW_CLASS_NAME_STR "LOCSERVEWindow"
#define | MAIN_WINDOW_TITLE_STR "LOCSERVE: Tutorial Code Sample"

Define Documentation

#define CLIENT_WINDOW_TITLE "LOCCLIEN: Tutorial Code Sample"

Definition at line 79 of file LocServe.h.

#define IDM_FILE_EXIT 1000

Definition at line 82 of file LocServe.h.

#define IDM_HELP_ABOUT 1905

Definition at line 89 of file LocServe.h.

#define IDM_LOG_COPYCLIP 1891

Definition at line 86 of file LocServe.h.

#define IDM_LOG_LOGCLEAR 1890

Definition at line 85 of file LocServe.h.

#define IDS_APPINITFAILED 2001

Definition at line 93 of file LocServe.h.

#define IDS_ASSERT_FAIL 2200

Definition at line 99 of file LocServe.h.

#define IDS_COMINITFAILED 2000

Definition at line 92 of file LocServe.h.

#define IDS_LOGTO_CLIENT 2400

Definition at line 105 of file LocServe.h.

#define IDS_LOGTO_SERVER 2401

Definition at line 106 of file LocServe.h.

#define IDS_NOHELPFILE 2003

Definition at line 95 of file LocServe.h.

#define IDS_NOSERVER 2005

Definition at line 97 of file LocServe.h.

#define IDS_NOTIMPLEMENTED 2301

Definition at line 102 of file LocServe.h.

#define IDS_NOUNICODE 2004

Definition at line 96 of file LocServe.h.

#define IDS_OUTOFMEMORY 2002

Definition at line 94 of file LocServe.h.

#define MAIN_WINDOW_CLASS_MENU_STR "LOCSERVEMenu"

Definition at line 78 of file LocServe.h.

#define MAIN_WINDOW_CLASS_NAME_STR "LOCSERVEWindow"

Definition at line 77 of file LocServe.h.

#define MAIN_WINDOW_TITLE_STR "LOCSERVE: Tutorial Code Sample"

Definition at line 76 of file LocServe.h.

Generated on Wed Nov 13 2024 16:53:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/LocServe/Server.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • LocServe

Server.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <apputil.h>
#include <micars.h>
#include <carguids.h>
#include "server.h"
#include "factory.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/LocServe/Server.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • LocServe
Variables

Server.h File Reference

Go to the source code of this file.

Variables

CSendLog * g_pMsgLog
CServer * g_pServer

Variable Documentation

CSendLog* g_pMsgLog

Definition at line 89 of file AptClien.Cpp.

CServer* g_pServer

Definition at line 78 of file AptServe.Cpp.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/LocServe/UtilCAR.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • LocServe
Functions

UtilCAR.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <apputil.h>
#include <micars.h>
#include <carguids.h>
#include "server.h"
#include "car.h"
#include "utilcar.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) COUtilityCar

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 698 of file UtilCAR.Cpp.

{
  // Decrement the Interface Reference Count.
  --m_cRefI;

  LOGF1("L: COUtilityCar::CImpIUtility::Release. Delegating. New cI=%i.", m_cRefI);

  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/LocServe/UtilCAR.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • LocServe

UtilCAR.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/Marshal/MICARS.Idl File Reference

  • Com
  • Fundamentals
  • TutSamp
  • Marshal
Functions

MICARS.Idl File Reference

Go to the source code of this file.

Functions

HRESULT | Adjust ([in] BOOL bUpDown)
HRESULT | Clutch ([in] short nEngaged)
HRESULT | Engage ([in] BOOL bOnOff)
HRESULT | Offroad ([in] short nGear)
HRESULT | Shift ([in] short nGear)
HRESULT | Speed ([in] short nMph)
HRESULT | Steer ([in] short nAngle)
HRESULT | Winch ([in] short nRpm)

Function Documentation

STDMETHODIMP COUtilityCruiseCar::CImpICruise::Adjust ( [in] BOOL bUpDown )

Definition at line 775 of file UTCRUCAR.Cpp.

{
  LOGF1("C: COUtilityCruiseCar::CImpICruise::Adjust. Delegating. bUpDown=%i.",bUpDown);

  // Delegate this call to the contained COCruiseCar's ICruise::Adjust.
  m_pBackObj->m_pICruise->Adjust(bUpDown);

  return NOERROR;
}

STDMETHODIMP COUtilityCruiseCar::CImpICar::Clutch ( [in] short nEngaged )

Definition at line 515 of file UTCRUCAR.Cpp.

{
  LOGF1("C: COUtilityCruiseCar::CImpICar::Clutch. Delegating. nEngaged=%i.", nEngaged);

  // Delegate this call to the contained COCruiseCar's ICar::Clutch.
  return m_pBackObj->m_pICar->Clutch(nEngaged);
}

STDMETHODIMP COUtilityCruiseCar::CImpICruise::Engage ( [in] BOOL bOnOff )

Definition at line 745 of file UTCRUCAR.Cpp.

{
  LOGF1("C: COUtilityCruiseCar::CImpICruise::Engage. Delegating. bOnOff=%i.",bOnOff);

  // Delegate this call to the contained COCruiseCar's ICruise::Engage.
  m_pBackObj->m_pICruise->Engage(bOnOff);

  return NOERROR;
}

STDMETHODIMP COUtilityCruiseCar::CImpIUtility::Offroad ( [in] short nGear )

Definition at line 957 of file UTCRUCAR.Cpp.

{
  LOGF1("C: COUtilityCruiseCar::CImpIUtility::Offroad. Called. nGear=%i.",nGear);

  // We don't delegate because this IUtility implementation is native to
  // the composite COUtilityCruiseCar object.

  return NOERROR;
}

STDMETHODIMP COUtilityCruiseCar::CImpICar::Shift ( [in] short nGear )

Definition at line 488 of file UTCRUCAR.Cpp.

{
  LOGF1("C: COUtilityCruiseCar::CImpICar::Shift. Delegating. nGear=%i.",nGear);

  // Delegate this call to the contained COCruiseCar's ICar::Shift.
  return m_pBackObj->m_pICar->Shift(nGear);
}

STDMETHODIMP COUtilityCruiseCar::CImpICar::Speed ( [in] short nMph )

Definition at line 542 of file UTCRUCAR.Cpp.

{
  LOGF1("C: COUtilityCruiseCar::CImpICar::Speed. Delegating. nMph=%i.",nMph);

  // Delegate this call to the contained COCruiseCar's ICar::Speed.
  return m_pBackObj->m_pICar->Speed(nMph);
}

STDMETHODIMP COUtilityCruiseCar::CImpICar::Steer ( [in] short nAngle )

Definition at line 569 of file UTCRUCAR.Cpp.

{
  LOGF1("C: COUtilityCruiseCar::CImpICar::Steer. Delegating. nAngle=%i.",nAngle);

  // Delegate this call to the contained COCruiseCar's ICar::Steer.
  return m_pBackObj->m_pICar->Steer(nAngle);
}

STDMETHODIMP COUtilityCruiseCar::CImpIUtility::Winch ( [in] short nRpm )

Definition at line 987 of file UTCRUCAR.Cpp.

{
  LOGF1("C: COUtilityCruiseCar::CImpIUtility::Winch. Called. nRpm=%i.",nRpm);

  // We don't delegate because this IUtility implementation is native to
  // the composite COUtilityCruiseCar object.

  return NOERROR;
}

Generated on Wed Nov 13 2024 16:53:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/Marshal2/Marshal2.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • Marshal2
Functions | Variables

Marshal2.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <apputil.h>
#include "micars.h"

Go to the source code of this file.

Functions

BOOL WINAPI | DllMain (HINSTANCE hDllInst, DWORD fdwReason, LPVOID lpvReserved)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)
BOOL | UnicodeOk (void)

Variables

HINSTANCE | g_hDllInst = NULL

Function Documentation

BOOL WINAPI DllMain | ( | HINSTANCE | hDllInst,
 |  | DWORD | fdwReason,
 |  | LPVOID | lpvReserved
 | ) |  |

Definition at line 114 of file Marshal2.Cpp.

{
  BOOL bResult = TRUE;

  // Dispatch this main call based on the reason it was called.
  switch (fdwReason)
  {
    case DLL_PROCESS_ATTACH:
      // The DLL is being loaded for the first time by a given process.
      // Perform per-process initialization here.  If the initialization
      // is successful, return TRUE; if unsuccessful, return FALSE.
      g_hDllInst = hDllInst;
      bResult = UnicodeOk();
      break;

    case DLL_PROCESS_DETACH:
      // The DLL is being unloaded by a given process.  Do any
      // per-process clean up here, such as undoing what was done in
      // DLL_PROCESS_ATTACH.  The return value is ignored.
      break;

    case DLL_THREAD_ATTACH:
      // A thread is being created in a process that has already loaded
      // this DLL.  Perform any per-thread initialization here.  The
      // return value is ignored.
      break;

    case DLL_THREAD_DETACH:
      // A thread is exiting cleanly in a process that has already
      // loaded this DLL.  Perform any per-thread clean up here.  The
      // return value is ignored.
      break;

    default:
      break;
  }

  return (bResult);
}

STDAPI DllRegisterServer ( void )

Definition at line 169 of file Marshal2.Cpp.

{
  HRESULT  hr = NOERROR;
  TCHAR    szID[GUID_SIZE+1];
  TCHAR    szIFace[GUID_SIZE+32];
  TCHAR    szCLSID[GUID_SIZE+32];
  TCHAR    szModulePath[MAX_PATH];

  // Obtain the path to this module's executable file for later use.
  GetModuleFileName(
    g_hDllInst,
    szModulePath,
    sizeof(szModulePath)/sizeof(TCHAR));

  /*-------------------------------------------------------------------------
    Create registry entries for the ICar Interface.
  -------------------------------------------------------------------------*/
  // Create some base key strings.
  StringFromGUID2(IID_ICar, szID, GUID_SIZE);
  lstrcpyn(szIFace, TEXT("Interface\\"), sizeof(szIFace)/sizeof(TCHAR));
  lstrncat(szIFace, szID, sizeof(szIFace)/sizeof(TCHAR) - lstrlen(szIFace));
  lstrcpyn(szCLSID, TEXT("CLSID\\"), sizeof(szCLSID)/sizeof(TCHAR));
  lstrncat(szCLSID, szID, sizeof(szCLSID)/sizeof(TCHAR) - lstrlen(szCLSID));

  // Create the HKEY_CLASSES_ROOT\Interface entries.
  SetRegKeyValue(
    szIFace,
    NULL,
    TEXT("ICar"));
  SetRegKeyValue(
    szIFace,
    TEXT("ProxyStubClsid32"),
    szID);
  SetRegKeyValue(
    szIFace,
    TEXT("NumMethods"),
    TEXT("7"));

  // Create the HKEY_CLASSES_ROOT\CLSID entries.
  SetRegKeyValue(
    szCLSID,
    NULL,
    TEXT("ICar Proxy/Stub Factory"));
  SetRegKeyValue(
    szCLSID,
    TEXT("InprocServer32"),
    szModulePath);

  /*-------------------------------------------------------------------------
    Create registry entries for the IUtility Interface.
  -------------------------------------------------------------------------*/
  // Create some base key strings.
  StringFromGUID2(IID_IUtility, szID, GUID_SIZE);
  lstrcpyn(szIFace, TEXT("Interface\\"), sizeof(szIFace)/sizeof(TCHAR));
  lstrncat(szIFace, szID, sizeof(szIFace)/sizeof(TCHAR) - lstrlen(szIFace));
  lstrcpyn(szCLSID, TEXT("CLSID\\"), sizeof(szCLSID)/sizeof(TCHAR));
  lstrncat(szCLSID, szID, sizeof(szCLSID)/sizeof(TCHAR) - lstrlen(szCLSID));

  // Create the HKEY_CLASSES_ROOT\Interface entries.
  SetRegKeyValue(
    szIFace,
    NULL,
    TEXT("IUtility"));
  SetRegKeyValue(
    szIFace,
    TEXT("ProxyStubClsid32"),
    szID);
  SetRegKeyValue(
    szIFace,
    TEXT("NumMethods"),
    TEXT("5"));

  // Create the HKEY_CLASSES_ROOT\CLSID entries.
  SetRegKeyValue(
    szCLSID,
    NULL,
    TEXT("IUtility Proxy/Stub Factory"));
  SetRegKeyValue(
    szCLSID,
    TEXT("InprocServer32"),
    szModulePath);

  /*-------------------------------------------------------------------------
    Create registry entries for the ICruise Interface.
  -------------------------------------------------------------------------*/
  // Create some base key strings.
  StringFromGUID2(IID_ICruise, szID, GUID_SIZE);
  lstrcpyn(szIFace, TEXT("Interface\\"), sizeof(szIFace)/sizeof(TCHAR));
  lstrncat(szIFace, szID, sizeof(szIFace)/sizeof(TCHAR) - lstrlen(szIFace));
  lstrcpyn(szCLSID, TEXT("CLSID\\"), sizeof(szCLSID)/sizeof(TCHAR));
  lstrncat(szCLSID, szID, sizeof(szCLSID)/sizeof(TCHAR) - lstrlen(szCLSID));

  // Create the HKEY_CLASSES_ROOT\Interface entries.
  SetRegKeyValue(
    szIFace,
    NULL,
    TEXT("ICruise"));
  SetRegKeyValue(
    szIFace,
    TEXT("ProxyStubClsid32"),
    szID);
  SetRegKeyValue(
    szIFace,
    TEXT("NumMethods"),
    TEXT("5"));

  // Create the HKEY_CLASSES_ROOT\CLSID entries.
  SetRegKeyValue(
    szCLSID,
    NULL,
    TEXT("ICruise Proxy/Stub Factory"));
  SetRegKeyValue(
    szCLSID,
    TEXT("InprocServer32"),
    szModulePath);

  return hr;
}

STDAPI DllUnregisterServer ( void )

Definition at line 300 of file Marshal2.Cpp.

{
  HRESULT  hr = NOERROR;
  TCHAR    szID[GUID_SIZE+1];
  TCHAR    szIFace[GUID_SIZE+32];
  TCHAR    szCLSID[GUID_SIZE+32];
  TCHAR    szTemp[MAX_PATH+GUID_SIZE];

  /*-------------------------------------------------------------------------
    Delete registry entries for the ICar Interface.
  -------------------------------------------------------------------------*/
  //Create some base key strings.
  StringFromGUID2(IID_ICar, szID, GUID_SIZE);
  lstrcpyn(szIFace, TEXT("Interface\\"), sizeof(szIFace)/sizeof(TCHAR));
  lstrncat(szIFace, szID, sizeof(szIFace)/sizeof(TCHAR) - lstrlen(szIFace));
  lstrcpyn(szCLSID, TEXT("CLSID\\"), sizeof(szCLSID)/sizeof(TCHAR));
  lstrncat(szCLSID, szID, sizeof(szCLSID)/sizeof(TCHAR) - lstrlen(szCLSID));

  lstrcpyn(szTemp, szCLSID, sizeof(szTemp)/sizeof(TCHAR));
  lstrncat(szTemp, TEXT("\\InprocServer32"), sizeof(szTemp)/sizeof(TCHAR) -
    lstrlen(szTemp));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  lstrcpyn(szTemp, szIFace, sizeof(szTemp)/sizeof(TCHAR));
  lstrncat(szTemp, TEXT("\\ProxyStubClsid32"), sizeof(szTemp)/sizeof(TCHAR) -
    lstrlen(szTemp));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  lstrcpyn(szTemp, szIFace, sizeof(szTemp)/sizeof(TCHAR));
  lstrncat(szTemp, TEXT("\\NumMethods"), sizeof(szTemp)/sizeof(TCHAR) -
    lstrlen(szTemp));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  RegDeleteKey(HKEY_CLASSES_ROOT, szCLSID);
  RegDeleteKey(HKEY_CLASSES_ROOT, szIFace);

  /*-------------------------------------------------------------------------
    Delete registry entries for the IUtility Interface.
  -------------------------------------------------------------------------*/
  //Create some base key strings.
  StringFromGUID2(IID_IUtility, szID, GUID_SIZE);
  lstrcpyn(szIFace, TEXT("Interface\\"), sizeof(szIFace)/sizeof(TCHAR));
  lstrncat(szIFace, szID, sizeof(szIFace)/sizeof(TCHAR) - lstrlen(szIFace));
  lstrcpyn(szCLSID, TEXT("CLSID\\"), sizeof(szCLSID)/sizeof(TCHAR));
  lstrncat(szCLSID, szID, sizeof(szCLSID)/sizeof(TCHAR) - lstrlen(szCLSID));

  lstrcpyn(szTemp, szCLSID, sizeof(szTemp)/sizeof(TCHAR));
  lstrncat(szTemp, TEXT("\\InprocServer32"), sizeof(szTemp)/sizeof(TCHAR) -
    lstrlen(szTemp));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  lstrcpyn(szTemp, szIFace, sizeof(szTemp)/sizeof(TCHAR));
  lstrncat(szTemp, TEXT("\\ProxyStubClsid32"), sizeof(szTemp)/sizeof(TCHAR) -
    lstrlen(szTemp));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  lstrcpyn(szTemp, szIFace, sizeof(szTemp)/sizeof(TCHAR));
  lstrncat(szTemp, TEXT("\\NumMethods"), sizeof(szTemp)/sizeof(TCHAR) -
    lstrlen(szTemp));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  RegDeleteKey(HKEY_CLASSES_ROOT, szCLSID);
  RegDeleteKey(HKEY_CLASSES_ROOT, szIFace);

  /*-------------------------------------------------------------------------
    Delete registry entries for the ICruise Interface.
  -------------------------------------------------------------------------*/
  //Create some base key strings.
  StringFromGUID2(IID_ICruise, szID, GUID_SIZE);
  lstrcpyn(szIFace, TEXT("Interface\\"), sizeof(szIFace)/sizeof(TCHAR));
  lstrncat(szIFace, szID, sizeof(szIFace)/sizeof(TCHAR) - lstrlen(szIFace));
  lstrcpyn(szCLSID, TEXT("CLSID\\"), sizeof(szCLSID)/sizeof(TCHAR));
  lstrncat(szCLSID, szID, sizeof(szCLSID)/sizeof(TCHAR) - lstrlen(szCLSID));

  lstrcpyn(szTemp, szCLSID, sizeof(szTemp)/sizeof(TCHAR));
  lstrncat(szTemp, TEXT("\\InprocServer32"), sizeof(szTemp)/sizeof(TCHAR) -
    lstrlen(szTemp));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  lstrcpyn(szTemp, szIFace, sizeof(szTemp)/sizeof(TCHAR));
  lstrncat(szTemp, TEXT("\\ProxyStubClsid32"), sizeof(szTemp)/sizeof(TCHAR) -
    lstrlen(szTemp));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  lstrcpyn(szTemp, szIFace, sizeof(szTemp)/sizeof(TCHAR));
  lstrncat(szTemp, TEXT("\\NumMethods"), sizeof(szTemp)/sizeof(TCHAR) -
    lstrlen(szTemp));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  RegDeleteKey(HKEY_CLASSES_ROOT, szCLSID);
  RegDeleteKey(HKEY_CLASSES_ROOT, szIFace);

  return hr;
}

BOOL UnicodeOk ( void )

Definition at line 67 of file Marshal2.Cpp.

{
  BOOL bOk = TRUE;
  TCHAR szUserName[MAX_STRING_LENGTH];
  DWORD dwSize = MAX_STRING_LENGTH;

  if (!GetUserName(szUserName, &dwSize))
    bOk = ERROR_CALL_NOT_IMPLEMENTED == GetLastError() ? FALSE : TRUE;

  return bOk;
}

Variable Documentation

HINSTANCE g_hDllInst = NULL

Definition at line 53 of file Marshal2.Cpp.

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/Marshal2/MICARS.Idl File Reference

  • Com
  • Fundamentals
  • TutSamp
  • Marshal2
Functions

MICARS.Idl File Reference

Go to the source code of this file.

Functions

HRESULT | Adjust ([in] BOOL bUpDown)
HRESULT | Clutch ([in] short nEngaged)
HRESULT | Engage ([in] BOOL bOnOff)
HRESULT | Offroad ([in] short nGear)
HRESULT | Shift ([in] short nGear)
HRESULT | Speed ([in] short nMph)
HRESULT | Steer ([in] short nAngle)
HRESULT | Winch ([in] short nRpm)

Function Documentation

HRESULT Adjust ( [in] BOOL bUpDown )
HRESULT Clutch ( [in] short nEngaged )
HRESULT Engage ( [in] BOOL bOnOff )
HRESULT Offroad ( [in] short nGear )
HRESULT Shift ( [in] short nGear )
HRESULT Speed ( [in] short nMph )
HRESULT Steer ( [in] short nAngle )
HRESULT Winch ( [in] short nRpm )
Generated on Wed Nov 13 2024 16:53:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerClien/DRAWSINK.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerClien
Functions

DRAWSINK.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <olectl.h>
#include <apputil.h>
#include <ipages.h>
#include <pageguid.h>
#include "guidraw.h"
#include "drawsink.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CODrawPageSink

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 340 of file DRAWSINK.Cpp.

{
  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerClien/DRAWSINK.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerClien

DRAWSINK.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerClien/GUIDRAW.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerClien

GUIDRAW.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <olectl.h>
#include <apputil.h>
#include <ipages.h>
#include <pageguid.h>
#include "resdef.h"
#include "guidraw.h"
#include "drawsink.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerClien/GUIDRAW.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerClien

GUIDRAW.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerClien/GUIList.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerClien

GUIList.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <olectl.h>
#include <commdlg.h>
#include <tchar.h>
#include <apputil.h>
#include <ipages.h>
#include <pageguid.h>
#include "resdef.h"
#include "pagefile.h"
#include "listwin.h"
#include "guilist.h"
#include "listsink.h"
#include "textwin.h"
#include "guitext.h"
#include "textsink.h"
#include "guidraw.h"
#include "drawsink.h"
#include "perclien.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerClien/GUIList.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerClien

GUIList.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerClien/GUIText.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerClien

GUIText.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <olectl.h>
#include <apputil.h>
#include <ipages.h>
#include <pageguid.h>
#include "resdef.h"
#include "textwin.h"
#include "guitext.h"
#include "textsink.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerClien/GUIText.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerClien

GUIText.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerClien/ListSINK.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerClien
Functions

ListSINK.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <olectl.h>
#include <apputil.h>
#include <ipages.h>
#include <pageguid.h>
#include "pagefile.h"
#include "listwin.h"
#include "guilist.h"
#include "listsink.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) COPageListSink

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 345 of file ListSINK.Cpp.

{
  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerClien/ListSINK.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerClien

ListSINK.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerClien/ListWIN.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerClien

ListWIN.Cpp File Reference

#include <windows.h>
#include <tchar.h>
#include <apputil.h>
#include "listwin.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerClien/ListWIN.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerClien
Defines

ListWIN.h File Reference

Go to the source code of this file.

Defines

#define | IDC_LISTWIN 7000
#define | MAX_SHOW_LINES 200
#define | MAXLINE_SIZE 128

Define Documentation

#define IDC_LISTWIN 7000

Definition at line 37 of file ListWIN.h.

#define MAX_SHOW_LINES 200

Definition at line 34 of file ListWIN.h.

#define MAXLINE_SIZE 128

Definition at line 33 of file ListWIN.h.

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerClien/PageFILE.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerClien

PageFILE.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <apputil.h>
#include <ipages.h>
#include <pageguid.h>
#include "pagefile.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerClien/PageFILE.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerClien

PageFILE.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerClien/PerClien.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerClien
Functions | Variables

PerClien.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <olectl.h>
#include <initguid.h>
#include <commdlg.h>
#include <apputil.h>
#include <ipages.h>
#include <pageguid.h>
#include "resdef.h"
#include "pagefile.h"
#include "listwin.h"
#include "guilist.h"
#include "perclien.h"

Go to the source code of this file.

Functions

BOOL | InitApplication (HINSTANCE hInstance)
BOOL | UnicodeOk (void)
int PASCAL | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pszCmdLine, int nCmdShow)

Variables

TCHAR | g_szPageTitle [PAGE_TITLE_SIZE] = TEXT(PAGE_UNTITLED_STR)

Function Documentation

BOOL InitApplication ( HINSTANCE hInstance )

Definition at line 614 of file PerClien.Cpp.

{
  BOOL bOk;
  // The window class for all instances of the main frame window.
  WNDCLASSEX wcf;

  // Assign the appropriate values for this main frame window class.
  wcf.cbSize        = sizeof(WNDCLASSEX);
  wcf.cbClsExtra    = 0;            // No per-class extra data.
  wcf.cbWndExtra    = 0;            // No per-window extra data.
  wcf.hInstance     = hInstance;    // Application module instance.
  wcf.lpfnWndProc   = &WindowProc;  // Global Window Procedure (defined in
                                    // APPUTIL for all CVirWindows).
  wcf.hCursor       = LoadCursor(NULL, IDC_ARROW); // Load app cursor.
  wcf.hIcon         = (HICON) LoadIcon(            // Load app icon.
                                hInstance,
                                TEXT("AppIcon"));
  wcf.hIconSm       = (HICON) LoadImage(           // Load small icon.
                                hInstance,
                                TEXT("AppIcon"),
                                IMAGE_ICON,
                                16, 16,
                                0);
  wcf.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);  // Default backgnd color.
  wcf.style         = CS_HREDRAW | CS_VREDRAW;          // Class style(s).
  wcf.lpszClassName = TEXT(MAIN_WINDOW_CLASS_NAME_STR); // Class name.
  wcf.lpszMenuName  = TEXT(MAIN_WINDOW_CLASS_MENU_STR); // Menu name.
  // Register the window class and return FALSE if unsuccesful.
  bOk = RegisterClassEx(&wcf);

  if (bOk)
  {
    // Assign the appropriate values for the text page window class.
    wcf.lpszClassName = TEXT(TEXT_WINDOW_CLASS_NAME_STR); // Class name.
    wcf.lpszMenuName  = TEXT(TEXT_WINDOW_CLASS_MENU_STR); // Menu name.
    // Register the window class and return FALSE if unsuccesful.
    bOk = RegisterClassEx(&wcf);
  }

  if (bOk)
  {
    // Assign the appropriate values for the drawing page window class.
    wcf.hCursor       = LoadCursor(                  // Load pen cursor.
                          hInstance,
                          TEXT("PenCursor"));
    wcf.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); // Backgnd color.
    wcf.style         = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; // Class style(s).
    wcf.lpszClassName = TEXT(DRAW_WINDOW_CLASS_NAME_STR);   // Class name.
    wcf.lpszMenuName  = TEXT(DRAW_WINDOW_CLASS_MENU_STR);   // Menu name.
    // Register the window class and return FALSE if unsuccesful.
    bOk = RegisterClassEx(&wcf);
  }

  return (bOk);
}

BOOL UnicodeOk ( void )

Definition at line 588 of file PerClien.Cpp.

{
  BOOL bOk = TRUE;
  TCHAR szUserName[MAX_STRING_LENGTH];
  DWORD dwSize = MAX_STRING_LENGTH;

  if (!GetUserName(szUserName, &dwSize))
    bOk = ERROR_CALL_NOT_IMPLEMENTED == GetLastError() ? FALSE : TRUE;

  return bOk;
}

int PASCAL WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | pszCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 693 of file PerClien.Cpp.

{
  CMainWindow* pWin = NULL;
  MSG msg;
  HACCEL hAccel;
  int iRun = FALSE;

  // If we were compiled for UNICODE and the platform seems OK with this
  // then proceed.  Else we error and exit the app.
  if (UnicodeOk())
  {
    // Call to initialize the COM Library.  Use the SUCCEEDED macro
    // to detect success.  If fail then exit app with error message.
    // Tell COM that this client process and all subordinate threads
    // will live in an apartment threaded world.
    if (SUCCEEDED(CoInitialize(NULL)))
    {
      // If we succeeded in initializing the COM Library we proceed to
      // initialize the application.  If we can't init the application
      // then we signal shut down with an error message exit.
      iRun = InitApplication(hInstance);
      if (iRun)
      {
        // Assume we'll set iRun to TRUE when initialization is done.
        iRun = FALSE;
        // We are still go for running so we try to create a nifty new
        // CMainWindow object for this app instance.
        pWin = new CMainWindow;
        if (NULL != pWin)
        {
          // Now we initialize an instance of the new CMainWindow.
          // This includes creating the main window.  Note: if
          // InitInstance fails then it would have already deleted
          // pWin so we wouldn't need to delete it here.
          if (pWin->InitInstance(hInstance, pszCmdLine, nCmdShow))
          {
            // Load the keyboard accelerators from the resources.
            hAccel = LoadAccelerators(hInstance, TEXT("AppAccel"));
            if (NULL != hAccel)
            {
              // Signal App Initialization is successfully done.
              iRun = TRUE;
            }
          }
        }
      }

      if (iRun)
      {
        // If we initialized the app instance properly then we are still
        // go for running.  We then start up the main message pump for
        // the application.
        while (GetMessage(&msg, NULL, 0, 0))
        {
          if (!TranslateAccelerator(pWin->GetHwnd(), hAccel, &msg))
          {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
          }
        }

        // We also ask COM to unload any unused COM Servers, including our
        // friend, PERSERVE.
        CoFreeUnusedLibraries();

        // We'll pass to Windows the reason why we exited the message loop.
        iRun = (int) msg.wParam;
      }
      else
      {
        // We failed to Initialize the application. Put up error message
        // box saying that application couldn't be initialized.  Parent
        // window is desktop (ie, NULL).
        ErrorBox(hInstance, NULL, IDS_APPINITFAILED);
        DELETE_POINTER(pWin);
      }

      // We're exiting this app (either normally or by init failure) so
      // shut down the COM Library.
      CoUninitialize();
    }
    else
    {
      // We failed to Initialize the COM Library. Put up error message box
      // saying that COM Library couldn't be initialized.  Parent window
      // is desktop (ie, NULL).
      ErrorBox(hInstance, NULL, IDS_COMINITFAILED);
    }
  }
  else
  {
    // If we were compiled for UNICODE but the platform has problems with
    // this then indicate an error and exit the app immediately.
    CHAR szMsg[MAX_STRING_LENGTH];

    if (LoadStringA(
          hInstance,
          IDS_NOUNICODE,
          szMsg,
          MAX_STRING_LENGTH))
    {
      MessageBoxA(
        NULL,
        szMsg,
        ERROR_TITLE_STR,
        MB_OK | MB_ICONEXCLAMATION);
    }
  }

  return iRun;
}

Variable Documentation

TCHAR g_szPageTitle[PAGE_TITLE_SIZE] = TEXT(PAGE_UNTITLED_STR)

Definition at line 100 of file PerClien.Cpp.

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerClien/PerClien.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerClien

PerClien.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerClien/RESDEF.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerClien
Defines

RESDEF.h File Reference

Go to the source code of this file.

Defines

#define | DRAW_WINDOW_CLASS_MENU_STR "DrawMenu"
#define | DRAW_WINDOW_CLASS_NAME_STR "DrawWindow"
#define | DRAW_WINDOW_NAME_STR "PERCLIEN Drawing: "
#define | IDC_EDIT_PGTITLE 5002
#define | IDC_STATIC_PGTITLE 5001
#define | IDD_PAGE_PROPS 5000
#define | IDM_DHELP_ABOUT 2904
#define | IDM_DHELP_CONTENTS 2900
#define | IDM_DHELP_READSOURCE 2903
#define | IDM_DHELP_TUTORIAL 2901
#define | IDM_DHELP_TUTSERVER 2962
#define | IDM_DRAW_CLEAR 2701
#define | IDM_DRAW_EXIT 2702
#define | IDM_DRAW_SAVE 2700
#define | IDM_EDIT_COPY 2303
#define | IDM_EDIT_CUT 2302
#define | IDM_EDIT_DELETE 2305
#define | IDM_EDIT_PASTE 2304
#define | IDM_EDIT_SELECTALL 2301
#define | IDM_EDIT_UNDO 2300
#define | IDM_FILE_EXIT 1004
#define | IDM_FILE_NEW 1000
#define | IDM_FILE_OPEN 1001
#define | IDM_FILE_SAVE 1002
#define | IDM_FILE_SAVEAS 1003
#define | IDM_HELP_ABOUT 1906
#define | IDM_HELP_CONTENTS 1900
#define | IDM_HELP_PERDRAW 1904
#define | IDM_HELP_PERSERVE 1902
#define | IDM_HELP_PERTEXT 1903
#define | IDM_HELP_READSOURCE 1905
#define | IDM_HELP_TUTORIAL 1901
#define | IDM_PAGE_DELETE 1102
#define | IDM_PAGE_NEWDRAW 1104
#define | IDM_PAGE_NEWTEXT 1103
#define | IDM_PAGE_OPEN 1100
#define | IDM_PAGE_TITLE 1101
#define | IDM_PEN_COLOR 2800
#define | IDM_PEN_MEDIUM 2802
#define | IDM_PEN_THICK 2803
#define | IDM_PEN_THIN 2801
#define | IDM_TEXT_CLEAR 2201
#define | IDM_TEXT_EXIT 2202
#define | IDM_TEXT_SAVE 2200
#define | IDM_THELP_ABOUT 2404
#define | IDM_THELP_CONTENTS 2400
#define | IDM_THELP_READSOURCE 2403
#define | IDM_THELP_TUTORIAL 2401
#define | IDM_THELP_TUTSERVER 2402
#define | IDS_APPINITFAILED 9001
#define | IDS_ASK_SAVE 9503
#define | IDS_ASSERT_FAIL 9300
#define | IDS_COMINITFAILED 9000
#define | IDS_DRAW_PAGE 9501
#define | IDS_FILE_CHANGED 9502
#define | IDS_NOSERVER 9003
#define | IDS_NOTIMPLEMENTED 9009
#define | IDS_NOUNICODE 9002
#define | IDS_OFN_PAGFILES 9504
#define | IDS_OFN_PAGOPEN 9505
#define | IDS_OFN_PAGSAVE 9506
#define | IDS_OPENDRAWPAGE 9008
#define | IDS_OPENTEXTPAGE 9007
#define | IDS_OUTOFMEMORY 9004
#define | IDS_PAGEFULL 9006
#define | IDS_TEXT_PAGE 9500
#define | IDS_TOOMANYOPEN 9005
#define | MAIN_APP_NAME_STR "PERCLIEN: "
#define | MAIN_WINDOW_CLASS_MENU_STR "PERCLIENMenu"
#define | MAIN_WINDOW_CLASS_NAME_STR "PERCLIENWindow"
#define | MAIN_WINDOW_TITLE_STR "PERCLIEN: perclien.pag"
#define | NOFILE_STR "No File Open"
#define | OFN_DEFAULTFILES_STR "All Files (*.*)\0*.*\0"
#define | OFN_DEFAULTTITLE_STR "Open File"
#define | SERVER_PERDRAW_STR "perdraw.htm"
#define | SERVER_PERSERVE_STR "perserve.htm"
#define | SERVER_PERTEXT_STR "pertext.htm"
#define | TEXT_WINDOW_CLASS_MENU_STR "TextMenu"
#define | TEXT_WINDOW_CLASS_NAME_STR "TextWindow"
#define | TEXT_WINDOW_NAME_STR "PERCLIEN Text: "

Define Documentation

#define DRAW_WINDOW_CLASS_MENU_STR "DrawMenu"

Definition at line 133 of file RESDEF.h.

#define DRAW_WINDOW_CLASS_NAME_STR "DrawWindow"

Definition at line 132 of file RESDEF.h.

#define DRAW_WINDOW_NAME_STR "PERCLIEN Drawing: "

Definition at line 131 of file RESDEF.h.

#define IDC_EDIT_PGTITLE 5002

Definition at line 78 of file RESDEF.h.

#define IDC_STATIC_PGTITLE 5001

Definition at line 77 of file RESDEF.h.

#define IDD_PAGE_PROPS 5000

Definition at line 76 of file RESDEF.h.

#define IDM_DHELP_ABOUT 2904

Definition at line 149 of file RESDEF.h.

#define IDM_DHELP_CONTENTS 2900

Definition at line 145 of file RESDEF.h.

#define IDM_DHELP_READSOURCE 2903

Definition at line 148 of file RESDEF.h.

#define IDM_DHELP_TUTORIAL 2901

Definition at line 146 of file RESDEF.h.

#define IDM_DHELP_TUTSERVER 2962

Definition at line 147 of file RESDEF.h.

#define IDM_DRAW_CLEAR 2701

Definition at line 137 of file RESDEF.h.

#define IDM_DRAW_EXIT 2702

Definition at line 138 of file RESDEF.h.

#define IDM_DRAW_SAVE 2700

Definition at line 136 of file RESDEF.h.

#define IDM_EDIT_COPY 2303

Definition at line 118 of file RESDEF.h.

#define IDM_EDIT_CUT 2302

Definition at line 117 of file RESDEF.h.

#define IDM_EDIT_DELETE 2305

Definition at line 120 of file RESDEF.h.

#define IDM_EDIT_PASTE 2304

Definition at line 119 of file RESDEF.h.

#define IDM_EDIT_SELECTALL 2301

Definition at line 116 of file RESDEF.h.

#define IDM_EDIT_UNDO 2300

Definition at line 115 of file RESDEF.h.

#define IDM_FILE_EXIT 1004

Definition at line 59 of file RESDEF.h.

#define IDM_FILE_NEW 1000

Definition at line 55 of file RESDEF.h.

#define IDM_FILE_OPEN 1001

Definition at line 56 of file RESDEF.h.

#define IDM_FILE_SAVE 1002

Definition at line 57 of file RESDEF.h.

#define IDM_FILE_SAVEAS 1003

Definition at line 58 of file RESDEF.h.

#define IDM_HELP_ABOUT 1906

Definition at line 73 of file RESDEF.h.

#define IDM_HELP_CONTENTS 1900

Definition at line 67 of file RESDEF.h.

#define IDM_HELP_PERDRAW 1904

Definition at line 71 of file RESDEF.h.

#define IDM_HELP_PERSERVE 1902

Definition at line 69 of file RESDEF.h.

#define IDM_HELP_PERTEXT 1903

Definition at line 70 of file RESDEF.h.

#define IDM_HELP_READSOURCE 1905

Definition at line 72 of file RESDEF.h.

#define IDM_HELP_TUTORIAL 1901

Definition at line 68 of file RESDEF.h.

#define IDM_PAGE_DELETE 1102

Definition at line 63 of file RESDEF.h.

#define IDM_PAGE_NEWDRAW 1104

Definition at line 65 of file RESDEF.h.

#define IDM_PAGE_NEWTEXT 1103

Definition at line 64 of file RESDEF.h.

#define IDM_PAGE_OPEN 1100

Definition at line 61 of file RESDEF.h.

#define IDM_PAGE_TITLE 1101

Definition at line 62 of file RESDEF.h.

#define IDM_PEN_COLOR 2800

Definition at line 140 of file RESDEF.h.

#define IDM_PEN_MEDIUM 2802

Definition at line 142 of file RESDEF.h.

#define IDM_PEN_THICK 2803

Definition at line 143 of file RESDEF.h.

#define IDM_PEN_THIN 2801

Definition at line 141 of file RESDEF.h.

#define IDM_TEXT_CLEAR 2201

Definition at line 111 of file RESDEF.h.

#define IDM_TEXT_EXIT 2202

Definition at line 112 of file RESDEF.h.

#define IDM_TEXT_SAVE 2200

Definition at line 110 of file RESDEF.h.

#define IDM_THELP_ABOUT 2404

Definition at line 127 of file RESDEF.h.

#define IDM_THELP_CONTENTS 2400

Definition at line 123 of file RESDEF.h.

#define IDM_THELP_READSOURCE 2403

Definition at line 126 of file RESDEF.h.

#define IDM_THELP_TUTORIAL 2401

Definition at line 124 of file RESDEF.h.

#define IDM_THELP_TUTSERVER 2402

Definition at line 125 of file RESDEF.h.

#define IDS_APPINITFAILED 9001

Definition at line 82 of file RESDEF.h.

#define IDS_ASK_SAVE 9503

Definition at line 98 of file RESDEF.h.

#define IDS_ASSERT_FAIL 9300

Definition at line 92 of file RESDEF.h.

#define IDS_COMINITFAILED 9000

Definition at line 81 of file RESDEF.h.

#define IDS_DRAW_PAGE 9501

Definition at line 96 of file RESDEF.h.

#define IDS_FILE_CHANGED 9502

Definition at line 97 of file RESDEF.h.

#define IDS_NOSERVER 9003

Definition at line 84 of file RESDEF.h.

#define IDS_NOTIMPLEMENTED 9009

Definition at line 90 of file RESDEF.h.

#define IDS_NOUNICODE 9002

Definition at line 83 of file RESDEF.h.

#define IDS_OFN_PAGFILES 9504

Definition at line 99 of file RESDEF.h.

#define IDS_OFN_PAGOPEN 9505

Definition at line 100 of file RESDEF.h.

#define IDS_OFN_PAGSAVE 9506

Definition at line 101 of file RESDEF.h.

#define IDS_OPENDRAWPAGE 9008

Definition at line 89 of file RESDEF.h.

#define IDS_OPENTEXTPAGE 9007

Definition at line 88 of file RESDEF.h.

#define IDS_OUTOFMEMORY 9004

Definition at line 85 of file RESDEF.h.

#define IDS_PAGEFULL 9006

Definition at line 87 of file RESDEF.h.

#define IDS_TEXT_PAGE 9500

Definition at line 95 of file RESDEF.h.

#define IDS_TOOMANYOPEN 9005

Definition at line 86 of file RESDEF.h.

#define MAIN_APP_NAME_STR "PERCLIEN: "

Definition at line 38 of file RESDEF.h.

#define MAIN_WINDOW_CLASS_MENU_STR "PERCLIENMenu"

Definition at line 41 of file RESDEF.h.

#define MAIN_WINDOW_CLASS_NAME_STR "PERCLIENWindow"

Definition at line 40 of file RESDEF.h.

#define MAIN_WINDOW_TITLE_STR "PERCLIEN: perclien.pag"

Definition at line 39 of file RESDEF.h.

#define NOFILE_STR "No File Open"

Definition at line 42 of file RESDEF.h.

#define OFN_DEFAULTFILES_STR "All Files (*.*)\0*.*\0"

Definition at line 50 of file RESDEF.h.

#define OFN_DEFAULTTITLE_STR "Open File"

Definition at line 51 of file RESDEF.h.

#define SERVER_PERDRAW_STR "perdraw.htm"

Definition at line 47 of file RESDEF.h.

#define SERVER_PERSERVE_STR "perserve.htm"

Definition at line 45 of file RESDEF.h.

#define SERVER_PERTEXT_STR "pertext.htm"

Definition at line 46 of file RESDEF.h.

#define TEXT_WINDOW_CLASS_MENU_STR "TextMenu"

Definition at line 107 of file RESDEF.h.

#define TEXT_WINDOW_CLASS_NAME_STR "TextWindow"

Definition at line 106 of file RESDEF.h.

#define TEXT_WINDOW_NAME_STR "PERCLIEN Text: "

Definition at line 105 of file RESDEF.h.

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerClien/TextSINK.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerClien
Functions

TextSINK.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <olectl.h>
#include <apputil.h>
#include <ipages.h>
#include <pageguid.h>
#include "textwin.h"
#include "guitext.h"
#include "textsink.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) COTextPageSink

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 341 of file TextSINK.Cpp.

{
  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerClien/TextSINK.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerClien

TextSINK.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerClien/TextWIN.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerClien

TextWIN.Cpp File Reference

#include <windows.h>
#include <tchar.h>
#include <apputil.h>
#include "textwin.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerClien/TextWIN.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerClien
Defines

TextWIN.h File Reference

Go to the source code of this file.

Defines

#define | IDC_TEXTWIN 7100
#define | MAX_TEXT_SIZE 4095

Define Documentation

#define IDC_TEXTWIN 7100

Definition at line 37 of file TextWIN.h.

#define MAX_TEXT_SIZE 4095

Definition at line 34 of file TextWIN.h.

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerDraw/Connect.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerDraw
Functions

Connect.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <olectl.h>
#include <apputil.h>
#include <ipages.h>
#include <pageguid.h>
#include "server.h"
#include "connect.h"
#include "drawpage.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) COEnumConnectionPoints

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 1234 of file Connect.Cpp.

{
  ULONG cRefs;

  // Pass this release along to the Host object being enumerated.
  m_pHostObj->Release();

  cRefs = --m_cRefs;

  if (0 == cRefs)
  {
    // We artificially bump the main ref count to prevent reentrancy via
    // the main object destructor.
    m_cRefs++;
    delete this;
  }

  return cRefs;
}

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerDraw/Connect.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerDraw

Connect.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerDraw/DRAWPage.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerDraw
Functions

DRAWPage.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <olectl.h>
#include <apputil.h>
#include <ipages.h>
#include <pageguid.h>
#include "server.h"
#include "connect.h"
#include "drawpage.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CODrawPage

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 1534 of file DRAWPage.Cpp.

{
  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerDraw/DRAWPage.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerDraw

DRAWPage.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerDraw/Factory.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerDraw
Functions

Factory.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <olectl.h>
#include <apputil.h>
#include <ipages.h>
#include <pageguid.h>
#include "server.h"
#include "factory.h"
#include "connect.h"
#include "drawpage.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CFDrawPage

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 370 of file Factory.Cpp.

{
  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerDraw/Factory.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerDraw

Factory.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerDraw/PerDraw.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerDraw
Defines | Functions | Variables

PerDraw.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <initguid.h>
#include <apputil.h>
#include <ipages.h>
#include <pageguid.h>
#include "perdraw.h"
#include "server.h"
#include "factory.h"

Go to the source code of this file.

Defines

#define | _DLLEXPORT_

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, PPVOID ppv)
BOOL WINAPI | DllMain (HINSTANCE hDllInst, DWORD fdwReason, LPVOID lpvReserved)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)
BOOL | UnicodeOk (void)

Variables

CServer * | g_pServer = NULL

Define Documentation

#define _DLLEXPORT_

Definition at line 64 of file PerDraw.Cpp.

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 252 of file PerDraw.Cpp.

{
  HRESULT hr;

  // We return S_OK if there are no longer any living objects AND
  // there are no outstanding client locks on this server.
  hr = g_pServer->CanUnloadNow();

  return hr;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | PPVOID | ppv
 | ) |  |

Definition at line 211 of file PerDraw.Cpp.

{
  HRESULT hr = CLASS_E_CLASSNOTAVAILABLE;
  IUnknown* pCO = NULL;

  if (CLSID_DrawPage == rclsid)
  {
    hr = E_OUTOFMEMORY;
    pCO = new CFDrawPage(NULL, g_pServer);
  }

  if (NULL != pCO)
  {
    g_pServer->ObjectsUp();
    hr = pCO->QueryInterface(riid, ppv);
    if (FAILED(hr))
    {
      g_pServer->ObjectsDown();
      DELETE_POINTER(pCO);
    }
  }

  return hr;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hDllInst,
 |  | DWORD | fdwReason,
 |  | LPVOID | lpvReserved
 | ) |  |

Definition at line 136 of file PerDraw.Cpp.

{
  BOOL bResult = TRUE;

  // Dispatch this main call based on the reason it was called.
  switch (fdwReason)
  {
    case DLL_PROCESS_ATTACH:
      // The DLL is being loaded for the first time by a given process.
      // Perform per-process initialization here.  If the initialization
      // is successful, return TRUE; if unsuccessful, return FALSE.
      bResult = FALSE;
      if (UnicodeOk())
      {
        // Instantiate the CServer utility class.
        g_pServer = new CServer;
        if (NULL != g_pServer)
        {
          // Remember the DLL Instance handle.
          g_pServer->m_hDllInst = hDllInst;
          bResult = TRUE;
        }
      }
      break;

    case DLL_PROCESS_DETACH:
      // The DLL is being unloaded by a given process.  Do any
      // per-process clean up here, such as undoing what was done in
      // DLL_PROCESS_ATTACH.  The return value is ignored.
      DELETE_POINTER(g_pServer);
      break;

    case DLL_THREAD_ATTACH:
      // A thread is being created in a process that has already loaded
      // this DLL.  Perform any per-thread initialization here.  The
      // return value is ignored.
      break;

    case DLL_THREAD_DETACH:
      // A thread is exiting cleanly in a process that has already
      // loaded this DLL.  Perform any per-thread clean up here.  The
      // return value is ignored.
      break;

    default:
      break;
  }

  return (bResult);
}

STDAPI DllRegisterServer ( void )

Definition at line 275 of file PerDraw.Cpp.

{
  HRESULT  hr = NOERROR;
  TCHAR    szID[GUID_SIZE+1];
  TCHAR    szCLSID[GUID_SIZE+32];
  TCHAR    szModulePath[MAX_PATH];

  // Obtain the path to this module's executable file for later use.
  GetModuleFileName(
    g_pServer->m_hDllInst,
    szModulePath,
    sizeof(szModulePath)/sizeof(TCHAR));

  /*-------------------------------------------------------------------------
    Create registry entries for the DrawPage Component.
  -------------------------------------------------------------------------*/
  // Create some base key strings.
  StringFromGUID2(CLSID_DrawPage, szID, GUID_SIZE);
  lstrcpyn(szCLSID, TEXT("CLSID\\"), sizeof(szCLSID)/sizeof(TCHAR));
  lstrncat(szCLSID, szID, sizeof(szCLSID)/sizeof(TCHAR) - lstrlen(szCLSID));

  // Create ProgID keys.
  SetRegKeyValue(
    TEXT("CTS.DrawPage.1"),
    NULL,
    TEXT("DrawPage Component - PERDRAW Code Sample"));
  SetRegKeyValue(
    TEXT("CTS.DrawPage.1"),
    TEXT("CLSID"),
    szID);

  // Create VersionIndependentProgID keys.
  SetRegKeyValue(
    TEXT("CTS.DrawPage"),
    NULL,
    TEXT("DrawPage Component - PERDRAW Code Sample"));
  SetRegKeyValue(
    TEXT("CTS.DrawPage"),
    TEXT("CurVer"),
    TEXT("CTS.DrawPage.1"));
  SetRegKeyValue(
    TEXT("CTS.DrawPage"),
    TEXT("CLSID"),
    szID);

  // Create entries under CLSID.
  SetRegKeyValue(
    szCLSID,
    NULL,
    TEXT("DrawPage Component - PERDRAW Code Sample"));
  SetRegKeyValue(
    szCLSID,
    TEXT("ProgID"),
    TEXT("CTS.DrawPage.1"));
  SetRegKeyValue(
    szCLSID,
    TEXT("VersionIndependentProgID"),
    TEXT("CTS.DrawPage"));
  SetRegKeyValue(
    szCLSID,
    TEXT("NotInsertable"),
    NULL);
  SetRegKeyValue(
    szCLSID,
    TEXT("InprocServer32"),
    szModulePath);
  AddRegNamedValue(
    szCLSID,
    TEXT("InprocServer32"),
    TEXT("ThreadingModel"),
    TEXT("Apartment"));

  return hr;
}

STDAPI DllUnregisterServer ( void )

Definition at line 362 of file PerDraw.Cpp.

{
  HRESULT  hr = NOERROR;
  TCHAR    szID[GUID_SIZE+1];
  TCHAR    szCLSID[GUID_SIZE+32];
  TCHAR    szTemp[MAX_PATH+GUID_SIZE];

  /*-------------------------------------------------------------------------
    Delete registry entries for the DrawPage Component.
  -------------------------------------------------------------------------*/
  //Create some base key strings.
  StringFromGUID2(CLSID_DrawPage, szID, GUID_SIZE);
  lstrcpyn(szCLSID, TEXT("CLSID\\"), sizeof(szCLSID)/sizeof(TCHAR));
  lstrncat(szCLSID, szID, sizeof(szCLSID)/sizeof(TCHAR) - lstrlen(szCLSID));

  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.DrawPage\\CurVer"));
  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.DrawPage\\CLSID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.DrawPage"));

  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.DrawPage.1\\CLSID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.DrawPage.1"));

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("ProgID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("VersionIndependentProgID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("NotInsertable"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("InprocServer32"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  RegDeleteKey(HKEY_CLASSES_ROOT, szCLSID);

  return hr;
}

BOOL UnicodeOk ( void )

Definition at line 88 of file PerDraw.Cpp.

{
  BOOL bOk = TRUE;
  TCHAR szUserName[MAX_STRING_LENGTH];
  DWORD dwSize = MAX_STRING_LENGTH;

  if (!GetUserName(szUserName, &dwSize))
    bOk = ERROR_CALL_NOT_IMPLEMENTED == GetLastError() ? FALSE : TRUE;

  return bOk;
}

Variable Documentation

CServer* g_pServer = NULL

Definition at line 74 of file PerDraw.Cpp.

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerDraw/PerDraw.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerDraw
Defines | Functions

PerDraw.h File Reference

Go to the source code of this file.

Defines

#define | DLLENTRY extern __declspec(dllimport)
#define | STDENTRY DLLENTRY HRESULT WINAPI
#define | STDENTRY_(type) DLLENTRY type WINAPI

Functions

STDENTRY | DllRegisterServer (void)
STDENTRY | DllUnregisterServer (void)

Define Documentation

#define DLLENTRY extern __declspec(dllimport)

Definition at line 47 of file PerDraw.h.

#define STDENTRY DLLENTRY HRESULT WINAPI

Definition at line 49 of file PerDraw.h.

#define STDENTRY_ ( type ) DLLENTRY type WINAPI

Definition at line 50 of file PerDraw.h.

Function Documentation

STDENTRY DllRegisterServer ( void )

Definition at line 69 of file ComSpyAudit.Cpp.

{
  // registers object, typelib and all interfaces in typelib
  return _Module.RegisterServer(TRUE);
}

STDENTRY DllUnregisterServer ( void )

Definition at line 78 of file ComSpyAudit.Cpp.

{
  _Module.UnregisterServer();
  return S_OK;
}

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerDraw/Server.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerDraw

Server.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <apputil.h>
#include "server.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerDraw/Server.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerDraw
Variables

Server.h File Reference

Go to the source code of this file.

Variables

CServer * g_pServer

Variable Documentation

CServer* g_pServer

Definition at line 78 of file AptServe.Cpp.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerServe/Connect.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerServe
Functions

Connect.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <olectl.h>
#include <apputil.h>
#include <ipages.h>
#include <pageguid.h>
#include "server.h"
#include "connect.h"
#include "pagelist.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) COEnumConnectionPoints

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 1232 of file Connect.Cpp.

{
  ULONG cRefs;

  // Pass this release along to the Host object being enumerated.
  m_pHostObj->Release();

  cRefs = --m_cRefs;

  if (0 == cRefs)
  {
    // We artificially bump the main ref count to prevent reentrancy via
    // the main object destructor.
    m_cRefs++;
    delete this;
  }

  return cRefs;
}

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerServe/Connect.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerServe

Connect.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerServe/Factory.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerServe
Functions

Factory.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <olectl.h>
#include <apputil.h>
#include <ipages.h>
#include <pageguid.h>
#include "server.h"
#include "factory.h"
#include "connect.h"
#include "pagelist.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CFPageList

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 370 of file Factory.Cpp.

{
  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerServe/Factory.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerServe

Factory.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerServe/PageList.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerServe
Functions

PageList.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <olectl.h>
#include <apputil.h>
#include <ipages.h>
#include <pageguid.h>
#include "server.h"
#include "connect.h"
#include "pagelist.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) COPageList

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 1189 of file PageList.Cpp.

{
  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerServe/PageList.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerServe

PageList.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerServe/PerServe.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerServe
Defines | Functions | Variables

PerServe.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <initguid.h>
#include <apputil.h>
#include <ipages.h>
#include <pageguid.h>
#include "perserve.h"
#include "server.h"
#include "factory.h"

Go to the source code of this file.

Defines

#define | _DLLEXPORT_

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, PPVOID ppv)
BOOL WINAPI | DllMain (HINSTANCE hDllInst, DWORD fdwReason, LPVOID lpvReserved)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)
BOOL | UnicodeOk (void)

Variables

CServer * | g_pServer = NULL

Define Documentation

#define _DLLEXPORT_

Definition at line 64 of file PerServe.Cpp.

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 252 of file PerServe.Cpp.

{
  HRESULT hr;

  // We return S_OK if there are no longer any living objects AND
  // there are no outstanding client locks on this server.
  hr = g_pServer->CanUnloadNow();

  return hr;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | PPVOID | ppv
 | ) |  |

Definition at line 211 of file PerServe.Cpp.

{
  HRESULT hr = CLASS_E_CLASSNOTAVAILABLE;
  IUnknown* pCO = NULL;

  if (CLSID_PageList == rclsid)
  {
    hr = E_OUTOFMEMORY;
    pCO = new CFPageList(NULL, g_pServer);
  }

  if (NULL != pCO)
  {
    g_pServer->ObjectsUp();
    hr = pCO->QueryInterface(riid, ppv);
    if (FAILED(hr))
    {
      g_pServer->ObjectsDown();
      DELETE_POINTER(pCO);
    }
  }

  return hr;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hDllInst,
 |  | DWORD | fdwReason,
 |  | LPVOID | lpvReserved
 | ) |  |

Definition at line 136 of file PerServe.Cpp.

{
  BOOL bResult = TRUE;

  // Dispatch this main call based on the reason it was called.
  switch (fdwReason)
  {
    case DLL_PROCESS_ATTACH:
      // The DLL is being loaded for the first time by a given process.
      // Perform per-process initialization here.  If the initialization
      // is successful, return TRUE; if unsuccessful, return FALSE.
      bResult = FALSE;
      if (UnicodeOk())
      {
        // Instantiate the CServer utility class.
        g_pServer = new CServer;
        if (NULL != g_pServer)
        {
          // Remember the DLL Instance handle.
          g_pServer->m_hDllInst = hDllInst;
          bResult = TRUE;
        }
      }
      break;

    case DLL_PROCESS_DETACH:
      // The DLL is being unloaded by a given process.  Do any
      // per-process clean up here, such as undoing what was done in
      // DLL_PROCESS_ATTACH.  The return value is ignored.
      DELETE_POINTER(g_pServer);
      break;

    case DLL_THREAD_ATTACH:
      // A thread is being created in a process that has already loaded
      // this DLL.  Perform any per-thread initialization here.  The
      // return value is ignored.
      break;

    case DLL_THREAD_DETACH:
      // A thread is exiting cleanly in a process that has already
      // loaded this DLL.  Perform any per-thread clean up here.  The
      // return value is ignored.
      break;

    default:
      break;
  }

  return (bResult);
}

STDAPI DllRegisterServer ( void )

Definition at line 276 of file PerServe.Cpp.

{
  HRESULT  hr = NOERROR;
  TCHAR    szID[GUID_SIZE+1];
  TCHAR    szCLSID[GUID_SIZE+32];
  TCHAR    szModulePath[MAX_PATH];

  // Obtain the path to this module's executable file for later use.
  GetModuleFileName(
    g_pServer->m_hDllInst,
    szModulePath,
    sizeof(szModulePath)/sizeof(TCHAR));

  /*-------------------------------------------------------------------------
    Create registry entries for the PageList Component.
  -------------------------------------------------------------------------*/
  // Create some base key strings.
  StringFromGUID2(CLSID_PageList, szID, GUID_SIZE);
  lstrcpyn(szCLSID, TEXT("CLSID\\"), sizeof(szCLSID)/sizeof(TCHAR));
  lstrncat(szCLSID, szID, sizeof(szCLSID)/sizeof(TCHAR) - lstrlen(szCLSID));

  // Create ProgID keys.
  SetRegKeyValue(
    TEXT("CTS.PageList.1"),
    NULL,
    TEXT("PageList Component - PERSERVE Code Sample"));
  SetRegKeyValue(
    TEXT("CTS.PageList.1"),
    TEXT("CLSID"),
    szID);

  // Create VersionIndependentProgID keys.
  SetRegKeyValue(
    TEXT("CTS.PageList"),
    NULL,
    TEXT("PageList Component - PERSERVE Code Sample"));
  SetRegKeyValue(
    TEXT("CTS.PageList"),
    TEXT("CurVer"),
    TEXT("CTS.PageList.1"));
  SetRegKeyValue(
    TEXT("CTS.PageList"),
    TEXT("CLSID"),
    szID);

  // Create entries under CLSID.
  SetRegKeyValue(
    szCLSID,
    NULL,
    TEXT("PageList Component - PERSERVE Code Sample"));
  SetRegKeyValue(
    szCLSID,
    TEXT("ProgID"),
    TEXT("CTS.PageList.1"));
  SetRegKeyValue(
    szCLSID,
    TEXT("VersionIndependentProgID"),
    TEXT("CTS.PageList"));
  SetRegKeyValue(
    szCLSID,
    TEXT("NotInsertable"),
    NULL);
  SetRegKeyValue(
    szCLSID,
    TEXT("InprocServer32"),
    szModulePath);
  AddRegNamedValue(
    szCLSID,
    TEXT("InprocServer32"),
    TEXT("ThreadingModel"),
    TEXT("Apartment"));

  return hr;
}

STDAPI DllUnregisterServer ( void )

Definition at line 364 of file PerServe.Cpp.

{
  HRESULT  hr = NOERROR;
  TCHAR    szID[GUID_SIZE+1];
  TCHAR    szCLSID[GUID_SIZE+32];
  TCHAR    szTemp[MAX_PATH+GUID_SIZE];

  /*-------------------------------------------------------------------------
    Delete registry entries for the PageList Component.
  -------------------------------------------------------------------------*/
  //Create some base key strings.
  StringFromGUID2(CLSID_PageList, szID, GUID_SIZE);
  lstrcpyn(szCLSID, TEXT("CLSID\\"), sizeof(szCLSID)/sizeof(TCHAR));
  lstrncat(szCLSID, szID, sizeof(szCLSID)/sizeof(TCHAR) - lstrlen(szCLSID));

  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.PageList\\CurVer"));
  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.PageList\\CLSID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.PageList"));

  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.PageList.1\\CLSID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.PageList.1"));

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("ProgID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("VersionIndependentProgID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("NotInsertable"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("InprocServer32"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  RegDeleteKey(HKEY_CLASSES_ROOT, szCLSID);

  return hr;
}

BOOL UnicodeOk ( void )

Definition at line 88 of file PerServe.Cpp.

{
  BOOL bOk = TRUE;
  TCHAR szUserName[MAX_STRING_LENGTH];
  DWORD dwSize = MAX_STRING_LENGTH;

  if (!GetUserName(szUserName, &dwSize))
    bOk = ERROR_CALL_NOT_IMPLEMENTED == GetLastError() ? FALSE : TRUE;

  return bOk;
}

Variable Documentation

CServer* g_pServer = NULL

Definition at line 74 of file PerServe.Cpp.

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerServe/PerServe.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerServe
Defines | Functions

PerServe.h File Reference

Go to the source code of this file.

Defines

#define | DLLENTRY extern __declspec(dllimport)
#define | STDENTRY DLLENTRY HRESULT WINAPI
#define | STDENTRY_(type) DLLENTRY type WINAPI

Functions

STDENTRY | DllRegisterServer (void)
STDENTRY | DllUnregisterServer (void)

Define Documentation

#define DLLENTRY extern __declspec(dllimport)

Definition at line 47 of file PerServe.h.

#define STDENTRY DLLENTRY HRESULT WINAPI

Definition at line 49 of file PerServe.h.

#define STDENTRY_ ( type ) DLLENTRY type WINAPI

Definition at line 50 of file PerServe.h.

Function Documentation

STDENTRY DllRegisterServer ( void )

Definition at line 69 of file ComSpyAudit.Cpp.

{
  // registers object, typelib and all interfaces in typelib
  return _Module.RegisterServer(TRUE);
}

STDENTRY DllUnregisterServer ( void )

Definition at line 78 of file ComSpyAudit.Cpp.

{
  _Module.UnregisterServer();
  return S_OK;
}

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerServe/Server.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerServe

Server.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <apputil.h>
#include "server.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerServe/Server.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerServe
Variables

Server.h File Reference

Go to the source code of this file.

Variables

CServer * g_pServer

Variable Documentation

CServer* g_pServer

Definition at line 78 of file AptServe.Cpp.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerText/Connect.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerText
Functions

Connect.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <olectl.h>
#include <apputil.h>
#include <ipages.h>
#include <pageguid.h>
#include "server.h"
#include "connect.h"
#include "textpage.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) COEnumConnectionPoints

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 1232 of file Connect.Cpp.

{
  ULONG cRefs;

  // Pass this release along to the Host object being enumerated.
  m_pHostObj->Release();

  cRefs = --m_cRefs;

  if (0 == cRefs)
  {
    // We artificially bump the main ref count to prevent reentrancy via
    // the main object destructor.
    m_cRefs++;
    delete this;
  }

  return cRefs;
}

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerText/Connect.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerText

Connect.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerText/Factory.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerText
Functions

Factory.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <olectl.h>
#include <apputil.h>
#include <ipages.h>
#include <pageguid.h>
#include "server.h"
#include "factory.h"
#include "connect.h"
#include "textpage.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CFTextPage

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 370 of file Factory.Cpp.

{
  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerText/Factory.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerText

Factory.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerText/PerText.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerText
Defines | Functions | Variables

PerText.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <initguid.h>
#include <apputil.h>
#include <ipages.h>
#include <pageguid.h>
#include "pertext.h"
#include "server.h"
#include "factory.h"

Go to the source code of this file.

Defines

#define | _DLLEXPORT_

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, PPVOID ppv)
BOOL WINAPI | DllMain (HINSTANCE hDllInst, DWORD fdwReason, LPVOID lpvReserved)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)
BOOL | UnicodeOk (void)

Variables

CServer * | g_pServer = NULL

Define Documentation

#define _DLLEXPORT_

Definition at line 62 of file PerText.Cpp.

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 251 of file PerText.Cpp.

{
  HRESULT hr;

  // We return S_OK if there are no longer any living objects AND
  // there are no outstanding client locks on this server.
  // Ask server control object.
  hr = g_pServer->CanUnloadNow();

  return hr;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | PPVOID | ppv
 | ) |  |

Definition at line 210 of file PerText.Cpp.

{
  HRESULT hr = CLASS_E_CLASSNOTAVAILABLE;
  IUnknown* pCO = NULL;

  if (CLSID_TextPage == rclsid)
  {
    hr = E_OUTOFMEMORY;
    pCO = new CFTextPage(NULL, g_pServer);
  }

  if (NULL != pCO)
  {
    g_pServer->ObjectsUp();
    hr = pCO->QueryInterface(riid, ppv);
    if (FAILED(hr))
    {
      g_pServer->ObjectsDown();
      DELETE_POINTER(pCO);
    }
  }

  return hr;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hDllInst,
 |  | DWORD | fdwReason,
 |  | LPVOID | lpvReserved
 | ) |  |

Definition at line 134 of file PerText.Cpp.

{
  BOOL bResult = TRUE;

  // Dispatch this main call based on the reason it was called.
  switch (fdwReason)
  {
    case DLL_PROCESS_ATTACH:
      // The DLL is being loaded for the first time by a given process.
      // Perform per-process initialization here.  If the initialization
      // is successful, return TRUE; if unsuccessful, return FALSE.
      bResult = FALSE;
      if (UnicodeOk())
      {
        // Instantiate the CServer utility class.
        g_pServer = new CServer;
        if (NULL != g_pServer)
        {
          // Remember the DLL Instance handle.
          g_pServer->m_hDllInst = hDllInst;
          bResult = TRUE;
        }
      }
      break;

    case DLL_PROCESS_DETACH:
      // The DLL is being unloaded by a given process.  Do any
      // per-process clean up here, such as undoing what was done in
      // DLL_PROCESS_ATTACH.  The return value is ignored.
      DELETE_POINTER(g_pServer);
      break;

    case DLL_THREAD_ATTACH:
      // A thread is being created in a process that has already loaded
      // this DLL.  Perform any per-thread initialization here.  The
      // return value is ignored.
      break;

    case DLL_THREAD_DETACH:
      // A thread is exiting cleanly in a process that has already
      // loaded this DLL.  Perform any per-thread clean up here.  The
      // return value is ignored.
      break;

    default:
      break;
  }

  return (bResult);
}

STDAPI DllRegisterServer ( void )

Definition at line 275 of file PerText.Cpp.

{
  HRESULT  hr = NOERROR;
  TCHAR    szID[GUID_SIZE+1];
  TCHAR    szCLSID[GUID_SIZE+32];
  TCHAR    szModulePath[MAX_PATH];

  // Obtain the path to this module's executable file for later use.
  GetModuleFileName(
    g_pServer->m_hDllInst,
    szModulePath,
    sizeof(szModulePath)/sizeof(TCHAR));

  /*-------------------------------------------------------------------------
    Create registry entries for the TextPage Component.
  -------------------------------------------------------------------------*/
  // Create some base key strings.
  StringFromGUID2(CLSID_TextPage, szID, GUID_SIZE);
  lstrcpyn(szCLSID, TEXT("CLSID\\"), sizeof(szCLSID)/sizeof(TCHAR));
  lstrncat(szCLSID, szID, sizeof(szCLSID)/sizeof(TCHAR) - lstrlen(szCLSID));

  // Create ProgID keys.
  SetRegKeyValue(
    TEXT("CTS.TextPage.1"),
    NULL,
    TEXT("TextPage Component - PERTEXT Code Sample"));
  SetRegKeyValue(
    TEXT("CTS.TextPage.1"),
    TEXT("CLSID"),
    szID);

  // Create VersionIndependentProgID keys.
  SetRegKeyValue(
    TEXT("CTS.TextPage"),
    NULL,
    TEXT("TextPage Component - PERTEXT Code Sample"));
  SetRegKeyValue(
    TEXT("CTS.TextPage"),
    TEXT("CurVer"),
    TEXT("CTS.TextPage.1"));
  SetRegKeyValue(
    TEXT("CTS.TextPage"),
    TEXT("CLSID"),
    szID);

  // Create entries under CLSID.
  SetRegKeyValue(
    szCLSID,
    NULL,
    TEXT("TextPage Component - PERTEXT Code Sample"));
  SetRegKeyValue(
    szCLSID,
    TEXT("ProgID"),
    TEXT("CTS.TextPage.1"));
  SetRegKeyValue(
    szCLSID,
    TEXT("VersionIndependentProgID"),
    TEXT("CTS.TextPage"));
  SetRegKeyValue(
    szCLSID,
    TEXT("NotInsertable"),
    NULL);
  SetRegKeyValue(
    szCLSID,
    TEXT("InprocServer32"),
    szModulePath);
  AddRegNamedValue(
    szCLSID,
    TEXT("InprocServer32"),
    TEXT("ThreadingModel"),
    TEXT("Apartment"));

  return hr;
}

STDAPI DllUnregisterServer ( void )

Definition at line 362 of file PerText.Cpp.

{
  HRESULT  hr = NOERROR;
  TCHAR    szID[GUID_SIZE+1];
  TCHAR    szCLSID[GUID_SIZE+32];
  TCHAR    szTemp[MAX_PATH+GUID_SIZE];

  /*-------------------------------------------------------------------------
    Delete registry entries for the TextPage Component.
  -------------------------------------------------------------------------*/
  //Create some base key strings.
  StringFromGUID2(CLSID_TextPage, szID, GUID_SIZE);
  lstrcpyn(szCLSID, TEXT("CLSID\\"), sizeof(szCLSID)/sizeof(TCHAR));
  lstrncat(szCLSID, szID, sizeof(szCLSID)/sizeof(TCHAR) - lstrlen(szCLSID));

  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.TextPage\\CurVer"));
  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.TextPage\\CLSID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.TextPage"));

  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.TextPage.1\\CLSID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.TextPage.1"));

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("ProgID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("VersionIndependentProgID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("NotInsertable"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("InprocServer32"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  RegDeleteKey(HKEY_CLASSES_ROOT, szCLSID);

  return hr;
}

BOOL UnicodeOk ( void )

Definition at line 86 of file PerText.Cpp.

{
  BOOL bOk = TRUE;
  TCHAR szUserName[MAX_STRING_LENGTH];
  DWORD dwSize = MAX_STRING_LENGTH;

  if (!GetUserName(szUserName, &dwSize))
    bOk = ERROR_CALL_NOT_IMPLEMENTED == GetLastError() ? FALSE : TRUE;

  return bOk;
}

Variable Documentation

CServer* g_pServer = NULL

Definition at line 72 of file PerText.Cpp.

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerText/PerText.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerText
Defines | Functions

PerText.h File Reference

Go to the source code of this file.

Defines

#define | DLLENTRY extern __declspec(dllimport)
#define | STDENTRY DLLENTRY HRESULT WINAPI
#define | STDENTRY_(type) DLLENTRY type WINAPI

Functions

STDENTRY | DllRegisterServer (void)
STDENTRY | DllUnregisterServer (void)

Define Documentation

#define DLLENTRY extern __declspec(dllimport)

Definition at line 47 of file PerText.h.

#define STDENTRY DLLENTRY HRESULT WINAPI

Definition at line 49 of file PerText.h.

#define STDENTRY_ ( type ) DLLENTRY type WINAPI

Definition at line 50 of file PerText.h.

Function Documentation

STDENTRY DllRegisterServer ( void )

Definition at line 69 of file ComSpyAudit.Cpp.

{
  // registers object, typelib and all interfaces in typelib
  return _Module.RegisterServer(TRUE);
}

STDENTRY DllUnregisterServer ( void )

Definition at line 78 of file ComSpyAudit.Cpp.

{
  _Module.UnregisterServer();
  return S_OK;
}

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerText/Server.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerText

Server.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <apputil.h>
#include "server.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerText/Server.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerText
Variables

Server.h File Reference

Go to the source code of this file.

Variables

CServer * g_pServer

Variable Documentation

CServer* g_pServer

Definition at line 78 of file AptServe.Cpp.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerText/TextPage.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerText
Functions

TextPage.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <olectl.h>
#include <apputil.h>
#include <ipages.h>
#include <pageguid.h>
#include "server.h"
#include "connect.h"
#include "textpage.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) COTextPage

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 1210 of file TextPage.Cpp.

{
  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/PerText/TextPage.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • PerText

TextPage.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/ReadTut/ReadTut.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • ReadTut
Functions

ReadTut.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <apputil.h>
#include "readtut.h"

Go to the source code of this file.

Functions

int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pszCmdLine, int nCmdShow)

Function Documentation

int PASCAL WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | pszCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 69 of file ReadTut.Cpp.

{
  int   iFail = FALSE;
  LPSTR psz;
  char  ch;

  if (SUCCEEDED(CoInitialize(NULL)))
  {
    // Show a message box saying that loading of tutorial is underway.
    DelayBox(hInstance, MAKEINTRESOURCE(IDD_LOADING_MSG), NULL);

    /*--------------------------------------------------------------------
      Walk down the command line looking for an HTML target. The first
      non-whitespace character after whitespace is assumed to be the
      beginning of the HTML target specification. This can be a fully
      qualified internet URL or a path/filename. This is all done in ANSI
      because pszCmdLine is in ANSI. Any command line switches are
      skipped and ignored.
    --------------------------------------------------------------------*/
    psz = pszCmdLine;

    while (ch = *psz)
    {
      BOOL bStop = FALSE;

      switch (ch)
      {
        case '\t':
        case '\n':
        case '\r':
        case ' ':
          // Skip any white space.
          psz = SkipAnsi(psz, TRUE);
          continue;

        case '/':
          // Handle '/' switches here. If '//' then assume it's a URL.
          ch = *(++psz);
          if ('/' == ch)
          {
            --psz;
            bStop = TRUE;
            break;
          }
          else
          {
            // If any '/' switches found skip to next white space.
            psz = SkipAnsi(psz, FALSE);
            continue;
          }

        case '-':
          // If any '-' switches found skip to next white space.
          psz = SkipAnsi(psz, FALSE);
          continue;

        default:
          bStop = TRUE;
          break;
      }

      if (bStop)
        break;

      psz++;
    }

    if (0 == ch)
    {
      /*------------------------------------------------------------------
        If the command line has no HTML target specified then assume a
        file with name <thismodulename>.HTM in the same directory as this
        executing EXE. In this case, the assumed file is READTUT.HTM. Call
        the APPUTIL ReadTutorial utility function to Browse this HTML
        file. If READTUT.EXE is renamed to TUTORIAL.EXE then the assumed
        file to browse is TUTORIAL.HTM.
      ------------------------------------------------------------------*/
      ReadTutorial(hInstance, NULL, NULL);
    }
    else
    {
      // If the command line has an HTML target specified then use it
      // to call the APPUTIL GoWeb utility function to Browse to the
      // specified HTML file on the world wide web.
      GoWeb(hInstance, psz);
    }

    // We're exiting this app so shut down the COM Library.
    CoUninitialize();
  }
  else
  {
    // Show error message box if we can't initialize the COM libraries.
    MessageBox(NULL,
               TEXT(NOCOM_ERROR_STR),
               TEXT(ERROR_TITLE_STR),
               MB_OK | MB_ICONEXCLAMATION);
    iFail = TRUE;
  }

  return iFail;
}

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/ReadTut/ReadTut.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • ReadTut
Defines

ReadTut.h File Reference

Go to the source code of this file.

Defines

#define | IDD_LOADING_MSG 2500
#define | IDS_ASSERT_FAIL 2200
#define | IDS_COMINITFAILED 2000
#define | IDS_ERROR_TITLE 2400
#define | IDS_NOTIMPLEMENTED 2301
#define | IDS_OUTOFMEMORY 2001
#define | MAX_STRING 128

Define Documentation

#define IDD_LOADING_MSG 2500

Definition at line 50 of file ReadTut.h.

#define IDS_ASSERT_FAIL 2200

Definition at line 43 of file ReadTut.h.

#define IDS_COMINITFAILED 2000

Definition at line 40 of file ReadTut.h.

#define IDS_ERROR_TITLE 2400

Definition at line 48 of file ReadTut.h.

#define IDS_NOTIMPLEMENTED 2301

Definition at line 46 of file ReadTut.h.

#define IDS_OUTOFMEMORY 2001

Definition at line 41 of file ReadTut.h.

#define MAX_STRING 128

Definition at line 37 of file ReadTut.h.

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/Register/register.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • Register
Functions

register.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <initguid.h>
#include <apputil.h>
#include "register.h"

Go to the source code of this file.

Functions

int | ErrorBoxID (HINSTANCE hInst, UINT uStrID)
LPSTR | SkipAnsiString (LPSTR psz, BOOL bSkipWhite)
int PASCAL | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pszCmdLine, int nCmdShow)

Function Documentation

int ErrorBoxID | ( | HINSTANCE | hInst,
 |  | UINT | uStrID
 | ) |  |

Definition at line 68 of file register.Cpp.

{
  int iResult = FALSE;
  CHAR szTitle[MAX_STRING];
  CHAR szError[MAX_STRING];

  if (LoadStringA(hInst, IDS_ERROR_TITLE, szTitle, MAX_STRING))
    if (LoadStringA(hInst, uStrID, szError, MAX_STRING))
      iResult = MessageBoxA(
                  NULL,
                  szError,
                  szTitle,
                  MB_OK | MB_ICONEXCLAMATION);

  return (iResult);
}

LPSTR SkipAnsiString | ( | LPSTR | psz,
 |  | BOOL | bSkipWhite
 | ) |  |

Definition at line 104 of file register.Cpp.

{
  char ch;
  BOOL bWhite;

  while (ch = *psz)
  {
    bWhite = ('\n'==ch || '\r'==ch || '\t'==ch || ' '==ch);

    if ((bSkipWhite && !bWhite) || (!bSkipWhite && bWhite))
      break;

    psz++;
  }

  return psz;
}

int PASCAL WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | pszCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 146 of file register.Cpp.

{
  int   iFail = FALSE;
  BOOL  bEXE = FALSE;
  BOOL  bUnreg = FALSE;
  LPSTR psz;
  char  ch;

  /*--------------------------------------------------------------------
    Walk down the command line looking for /u and /e in any order.
    The first non-whitespace character after whitespace that is not
    a "/" is assumed to be the beginning of the server filename.
    This is all done in ANSI because pszCmdLine is in ANSI.
  --------------------------------------------------------------------*/
  psz = pszCmdLine;

  while (ch = *psz)
  {
    BOOL    bStop = FALSE;

    switch (ch)
    {
      case '\t':
      case '\n':
      case '\r':
      case ' ':
        // Skip any white space.
        psz = SkipAnsiString(psz, TRUE);
        continue;

      case '/':
      case '-':
        // Check what option this is, then skip to next whitespace.
        ch = *(++psz);
        if ('u' == ch)
          bUnreg = TRUE;
        if ('e' == ch)
          bEXE = TRUE;
        psz = SkipAnsiString(psz, FALSE);
        continue;

      default:
        bStop = TRUE;
        break;
    }

    if (bStop)
      break;

    psz++;
  }

  if (0 != ch)
  {
    // If the command line was not null, launch the specified EXE or
    // load the specified DLL and tell either to do their registration
    // or unregistartion.
    if (bEXE)
    {
      // Verify the length of the input string to make sure we don't overrun
      // our buffer.
      if (lstrlenA(psz) < (MAX_PATH - 1 - lstrlenA("/UNREGSERVER"))) {
        UINT uError;
        CHAR szEXE[MAX_PATH];

        wsprintfA(
          szEXE,
          "%s %s",
          psz,
          bUnreg ? "/UNREGSERVER" : "/REGSERVER");

        // We WinExec the .EXE server passing /unregserver or /regserver.
        uError = WinExec(szEXE, SW_HIDE);
        if (uError < 32)
        {
          ErrorBoxID(hInstance, IDS_EXERUN_FAIL);
          iFail = TRUE;
        }
        else
        {
          // Show a timed message box indicating registration success.
          DelayBox(hInstance, MAKEINTRESOURCE(IDD_SUCCESS_MSG), NULL);
        }
      }
      else
      {
        ErrorBoxID(hInstance, IDS_EXERUN_FAIL);
        iFail = TRUE;
      }
    }
    else
    {
      // Because we load the DLL server into our own (ie, REGISTER.EXE)
      // process space, call to initialize the COM Library.  Use the
      // SUCCEEDED macro to detect success.  If fail then exit app
      // with error message.
      if (SUCCEEDED(CoInitialize(NULL)))
      {
        HINSTANCE hMod;

        // Load the Server DLL into our process space.
        hMod = LoadLibraryA(psz);

        if (NULL != hMod)
        {
          HRESULT (STDAPICALLTYPE *pfn)(void);

          if (bUnreg)
          {
            (FARPROC&)pfn = GetProcAddress(hMod, "DllUnregisterServer");

            if (NULL != pfn)
              iFail = FAILED((*pfn)());

            if (iFail)
              ErrorBoxID(hInstance, IDS_DLLUNREG_FAIL);
            else
            {
              // Show a timed message box indicating registration success.
              DelayBox(hInstance, MAKEINTRESOURCE(IDD_SUCCESS_MSG), NULL);
            }
          }
          else
          {
            (FARPROC&)pfn = GetProcAddress(hMod, "DllRegisterServer");

            if (NULL != pfn)
              iFail = FAILED((*pfn)());
            if (iFail)
              ErrorBoxID(hInstance, IDS_DLLREG_FAIL);
            else
            {
              // Show a timed message box indicating registration success.
              DelayBox(hInstance, MAKEINTRESOURCE(IDD_SUCCESS_MSG), NULL);
            }
          }
          CoFreeLibrary(hMod);
        }
        else
          ErrorBoxID(hInstance, IDS_LOADLIB_FAIL);

        // We're exiting this app so shut down the COM Library.
        CoUninitialize();
      }
      else
        ErrorBoxID(hInstance, IDS_COMINITFAILED);
    }
  }

  return iFail;
}

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/Register/register.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • Register
Defines

register.h File Reference

Go to the source code of this file.

Defines

#define | IDD_SUCCESS_MSG 2350
#define | IDS_ASSERT_FAIL 2200
#define | IDS_COMINITFAILED 2000
#define | IDS_DLLREG_FAIL 2003
#define | IDS_DLLUNREG_FAIL 2002
#define | IDS_ERROR_TITLE 2400
#define | IDS_EXERUN_FAIL 2005
#define | IDS_LOADLIB_FAIL 2004
#define | IDS_NOTIMPLEMENTED 2301
#define | IDS_OUTOFMEMORY 2001
#define | MAX_STRING 128

Define Documentation

#define IDD_SUCCESS_MSG 2350

Definition at line 51 of file register.h.

#define IDS_ASSERT_FAIL 2200

Definition at line 47 of file register.h.

#define IDS_COMINITFAILED 2000

Definition at line 40 of file register.h.

#define IDS_DLLREG_FAIL 2003

Definition at line 43 of file register.h.

#define IDS_DLLUNREG_FAIL 2002

Definition at line 42 of file register.h.

#define IDS_ERROR_TITLE 2400

Definition at line 53 of file register.h.

#define IDS_EXERUN_FAIL 2005

Definition at line 45 of file register.h.

#define IDS_LOADLIB_FAIL 2004

Definition at line 44 of file register.h.

#define IDS_NOTIMPLEMENTED 2301

Definition at line 50 of file register.h.

#define IDS_OUTOFMEMORY 2001

Definition at line 41 of file register.h.

#define MAX_STRING 128

Definition at line 37 of file register.h.

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/RemClien/RemClien.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • RemClien
Functions | Variables

RemClien.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <initguid.h>
#include <commdlg.h>
#include <apputil.h>
#include <micars.h>
#include <carguids.h>
#include "remclien.h"
#include "utcrucar.h"

Go to the source code of this file.

Functions

HRESULT | CreateRemote (COSERVERINFO *pServerInfo, REFCLSID rclsid, PPVOID ppv)
BOOL | InitApplication (HINSTANCE hInstance)
BOOL | UnicodeOk (void)
int PASCAL | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

Variables

CMsgLog * | g_pMsgLog = NULL
COSERVERINFO | g_ServerInfo
TCHAR | g_szMachineName [MAX_PATH] = TEXT("")
OLECHAR | g_wszMachineName [MAX_PATH]

Function Documentation

HRESULT CreateRemote | ( | COSERVERINFO * | pServerInfo,
 |  | REFCLSID | rclsid,
 |  | PPVOID | ppv
 | ) |  |

Definition at line 243 of file RemClien.Cpp.

{
  HRESULT hr = E_FAIL;
  IClassFactory* pICF = NULL;
  HCURSOR hCurPrev;
  HCURSOR hCurWait = LoadCursor(NULL, IDC_WAIT);

  // Ensure a remote machine name was specified by user.
  if (pServerInfo->pwszName[0])
  {
    // Change cursor to the hour glass.  Things could take awhile working
    // across the network.
    hCurPrev = SetCursor(hCurWait);

    // Get the COM Object Class Factory.
    hr = CoGetClassObject(
           rclsid,
           CLSCTX_REMOTE_SERVER,
           pServerInfo,
           IID_IClassFactory,
           (PPVOID)&pICF);
    LOGERROR("C:CoGetClassObject.",hr);
    if (SUCCEEDED(hr))
    {
      // Use Class Factory to create an instance of the COM object.
      hr = pICF->CreateInstance(
                   NULL,
                   IID_IUnknown,
                   ppv);
      pICF->Release();
      LOGERROR("C:CreateInstance.",hr);
    }

    // Set Cursor back to what it was.
    SetCursor(hCurPrev);
  }
  else
  {
    LOG("C: ???? Specify remote machine name first.");
  }

  return hr;
}

BOOL InitApplication ( HINSTANCE hInstance )

Definition at line 1145 of file RemClien.Cpp.

{
  BOOL bOk;
  // The window class for all instances of the main frame window.
  WNDCLASSEX wcf;

  // Assign the appropriate values for this main frame window class.
  wcf.cbSize        = sizeof(WNDCLASSEX);
  wcf.cbClsExtra    = 0;            // No per-class extra data.
  wcf.cbWndExtra    = 0;            // No per-window extra data.
  wcf.hInstance     = hInstance;    // Application module instance.
  wcf.lpfnWndProc   = &WindowProc;  // Global Window Procedure (defined in
                                    // APPUTIL for all CVirWindows).
  wcf.hCursor       = LoadCursor(NULL, IDC_ARROW); // Load app cursor.
  wcf.hIcon         = (HICON) LoadIcon(            // Load app icon.
                                hInstance,
                                TEXT("AppIcon"));
  wcf.hIconSm       = (HICON) LoadImage(           // Load small icon.
                                hInstance,
                                TEXT("AppIcon"),
                                IMAGE_ICON,
                                16, 16,
                                0);
  wcf.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);  // Default backgnd color.
  wcf.style         = CS_HREDRAW | CS_VREDRAW;     // Class style(s).
  wcf.lpszClassName = TEXT(MAIN_WINDOW_CLASS_NAME_STR); // Class name.
  wcf.lpszMenuName  = TEXT(MAIN_WINDOW_CLASS_MENU_STR); // Menu name.

  // Register the window class and return FALSE if unsuccesful.
  bOk = RegisterClassEx(&wcf);

  // Zero the g_ServerInfo structure.
  memset(&g_ServerInfo, 0, sizeof(COSERVERINFO));

  // Init the remote machine name.
  g_wszMachineName[0] = 0;
#ifdef UNICODE
  g_ServerInfo.pwszName = &g_szMachineName[0];
#else
  g_ServerInfo.pwszName = &g_wszMachineName[0];
#endif

  return (bOk);
}

BOOL UnicodeOk ( void )

Definition at line 1119 of file RemClien.Cpp.

{
  BOOL bOk = TRUE;
  TCHAR szUserName[MAX_STRING_LENGTH];
  DWORD dwSize = MAX_STRING_LENGTH;

  if (!GetUserName(szUserName, &dwSize))
    bOk = ERROR_CALL_NOT_IMPLEMENTED == GetLastError() ? FALSE : TRUE;

  return bOk;
}

int PASCAL WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 1213 of file RemClien.Cpp.

{
  CMainWindow* pWin = NULL;
  MSG msg;
  HACCEL hAccel;
  int iRun = FALSE;

  // If we were compiled for UNICODE and the platform seems OK with this
  // then proceed.  Else we error and exit the app.
  if (UnicodeOk())
  {
    // Call to initialize the COM Library.  Use the SUCCEEDED macro
    // to detect success.  If fail then exit app with error message.
    if (SUCCEEDED(CoInitialize(NULL)))
    {
      // Ensure that DCOM (Distributed COM) is installed.
      if (DComOk())
      {
        // If we succeeded in initializing the COM Library and confirming
        // adequate DCOM support, we proceed to initialize the
        // application.  If we can't init the application then we signal
        // shut down with an error message exit.
        iRun = InitApplication(hInstance);
        if (iRun)
        {
          // Assume we'll set iRun to TRUE when initialization is done.
          iRun = FALSE;
          // We are still go for running so we try to create a nifty new
          // CMainWindow object for this app instance.
          pWin = new CMainWindow;
          if (NULL != pWin)
          {
            // Now we initialize an instance of the new CMainWindow.
            // This includes creating the main window.
            if (pWin->InitInstance(hInstance, nCmdShow))
            {
              // Load the keyboard accelerators from the resources.
              hAccel = LoadAccelerators(hInstance, TEXT("AppAccel"));
              if (NULL != hAccel)
              {
                // Signal App Initialization is successfully done.
                iRun = TRUE;
              }
            }
          }
        }

        if (iRun)
        {
          // If we initialized the app instance properly then we are still
          // go for running.  We then start up the main message pump for
          // the application.
          while (GetMessage(&msg, NULL, 0, 0))
          {
            if (!TranslateAccelerator(
                   pWin->GetHwnd(),
                   hAccel,
                   &msg))
            {
              TranslateMessage(&msg);
              DispatchMessage(&msg);
            }
          }

          // We ask COM to unload any unused COM Servers.
          CoFreeUnusedLibraries();

          // We'll pass to Windows the reason why we exited the message loop.
          iRun = (int) msg.wParam;
        }
        else
        {
          // We failed to initialize the application. Put up error message
          // box saying that application couldn't be initialized.  Parent
          // window is desktop (ie, NULL). Exit the failed application
          // (ie, by returning FALSE to WinMain).
          ErrorBox(hInstance, NULL, IDS_APPINITFAILED);

          // Delete the CMainWindow object.
          DELETE_POINTER(pWin);
        }

        // We're exiting this app (either normally or by init failure) so
        // shut down the COM Library.
        CoUninitialize();
      }
      else
      {
        // If DCOM is not installed indicate an error and
        // exit the app immediately.
        ErrorBox(hInstance, NULL, IDS_NODCOM);
      }
    }
    else
    {
      // We failed to Initialize the COM Library. Put up error message
      // box saying that COM Library couldn't be initialized.  Parent
      // window is desktop (ie, NULL). Exit the failed application
      // (ie, by returning FALSE to WinMain).
      ErrorBox(hInstance, NULL, IDS_COMINITFAILED);
    }
  }
  else
  {
    // If we were compiled for UNICODE but the platform has problems with
    // this then indicate an error and exit the app immediately.
    CHAR szMsg[MAX_STRING_LENGTH];

    if (LoadStringA(
          hInstance,
          IDS_NOUNICODE,
          szMsg,
          MAX_STRING_LENGTH))
    {
      MessageBoxA(
        NULL,
        szMsg,
        ERROR_TITLE_STR,
        MB_OK | MB_ICONEXCLAMATION);
    }
  }

  return iRun;
}

Variable Documentation

CMsgLog* g_pMsgLog = NULL

Definition at line 83 of file RemClien.Cpp.

COSERVERINFO g_ServerInfo

Definition at line 86 of file RemClien.Cpp.

TCHAR g_szMachineName[MAX_PATH] = TEXT("")

Definition at line 88 of file RemClien.Cpp.

OLECHAR g_wszMachineName[MAX_PATH]

Definition at line 89 of file RemClien.Cpp.

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/RemClien/RemClien.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • RemClien
Defines

RemClien.h File Reference

Go to the source code of this file.

Defines

#define | IDC_EDIT_MACHINE 2502
#define | IDC_STATIC_MACHINE 2501
#define | IDD_REMOTE_INFO 2500
#define | IDM_CAR_CLUTCH 1103
#define | IDM_CAR_CREATE 1100
#define | IDM_CAR_RELEASE 1101
#define | IDM_CAR_SHIFT 1102
#define | IDM_CAR_SPEED 1104
#define | IDM_CAR_STEER 1105
#define | IDM_CCAR_ADJUST 1307
#define | IDM_CCAR_CLUTCH 1303
#define | IDM_CCAR_CREATE 1300
#define | IDM_CCAR_ENGAGE 1306
#define | IDM_CCAR_RELEASE 1301
#define | IDM_CCAR_SHIFT 1302
#define | IDM_CCAR_SPEED 1304
#define | IDM_CCAR_STEER 1305
#define | IDM_FILE_EXIT 1001
#define | IDM_FILE_MACHINE 1000
#define | IDM_HELP_ABOUT 1905
#define | IDM_HELP_CONTENTS 1900
#define | IDM_HELP_READSOURCE 1904
#define | IDM_HELP_TUTMARSHAL 1903
#define | IDM_HELP_TUTORIAL 1901
#define | IDM_HELP_TUTSERVER 1902
#define | IDM_LOG_COPYCLIP 1892
#define | IDM_LOG_LOGCLEAR 1890
#define | IDM_LOG_LOGGING 1891
#define | IDM_UCAR_CLUTCH 1203
#define | IDM_UCAR_CREATE 1200
#define | IDM_UCAR_OFFROAD 1206
#define | IDM_UCAR_RELEASE 1201
#define | IDM_UCAR_SHIFT 1202
#define | IDM_UCAR_SPEED 1204
#define | IDM_UCAR_STEER 1205
#define | IDM_UCAR_WINCH 1207
#define | IDM_UCRU_ADJUST 1407
#define | IDM_UCRU_CLUTCH 1403
#define | IDM_UCRU_CREATE 1400
#define | IDM_UCRU_ENGAGE 1406
#define | IDM_UCRU_OFFROAD 1408
#define | IDM_UCRU_RELEASE 1401
#define | IDM_UCRU_SHIFT 1402
#define | IDM_UCRU_SPEED 1404
#define | IDM_UCRU_STEER 1405
#define | IDM_UCRU_WINCH 1409
#define | IDS_APPINITFAILED 2001
#define | IDS_ASSERT_FAIL 2200
#define | IDS_COMINITFAILED 2000
#define | IDS_NODCOM 2004
#define | IDS_NOSERVER 2005
#define | IDS_NOTIMPLEMENTED 2301
#define | IDS_NOUNICODE 2003
#define | IDS_OUTOFMEMORY 2002
#define | IDS_START_MESSAGE_LOG 2400
#define | MAIN_WINDOW_CLASS_MENU_STR "REMCLIENMenu"
#define | MAIN_WINDOW_CLASS_NAME_STR "REMCLIENWindow"
#define | MAIN_WINDOW_TITLE_STR "REMCLIEN: Tutorial Code Sample"
#define | MARSHAL_TUTFILE_STR "marshal.htm"
#define | OFN_DEFAULTFILES_STR "All Files (*.*)\0*.*\0"
#define | OFN_DEFAULTTITLE_STR "Open File"
#define | SERVER_TUTFILE_STR "aptserve.htm"

Define Documentation

#define IDC_EDIT_MACHINE 2502

Definition at line 202 of file RemClien.h.

#define IDC_STATIC_MACHINE 2501

Definition at line 201 of file RemClien.h.

#define IDD_REMOTE_INFO 2500

Definition at line 200 of file RemClien.h.

#define IDM_CAR_CLUTCH 1103

Definition at line 134 of file RemClien.h.

#define IDM_CAR_CREATE 1100

Definition at line 131 of file RemClien.h.

#define IDM_CAR_RELEASE 1101

Definition at line 132 of file RemClien.h.

#define IDM_CAR_SHIFT 1102

Definition at line 133 of file RemClien.h.

#define IDM_CAR_SPEED 1104

Definition at line 135 of file RemClien.h.

#define IDM_CAR_STEER 1105

Definition at line 136 of file RemClien.h.

#define IDM_CCAR_ADJUST 1307

Definition at line 156 of file RemClien.h.

#define IDM_CCAR_CLUTCH 1303

Definition at line 152 of file RemClien.h.

#define IDM_CCAR_CREATE 1300

Definition at line 149 of file RemClien.h.

#define IDM_CCAR_ENGAGE 1306

Definition at line 155 of file RemClien.h.

#define IDM_CCAR_RELEASE 1301

Definition at line 150 of file RemClien.h.

#define IDM_CCAR_SHIFT 1302

Definition at line 151 of file RemClien.h.

#define IDM_CCAR_SPEED 1304

Definition at line 153 of file RemClien.h.

#define IDM_CCAR_STEER 1305

Definition at line 154 of file RemClien.h.

#define IDM_FILE_EXIT 1001

Definition at line 128 of file RemClien.h.

#define IDM_FILE_MACHINE 1000

Definition at line 127 of file RemClien.h.

#define IDM_HELP_ABOUT 1905

Definition at line 181 of file RemClien.h.

#define IDM_HELP_CONTENTS 1900

Definition at line 176 of file RemClien.h.

#define IDM_HELP_READSOURCE 1904

Definition at line 180 of file RemClien.h.

#define IDM_HELP_TUTMARSHAL 1903

Definition at line 179 of file RemClien.h.

#define IDM_HELP_TUTORIAL 1901

Definition at line 177 of file RemClien.h.

#define IDM_HELP_TUTSERVER 1902

Definition at line 178 of file RemClien.h.

#define IDM_LOG_COPYCLIP 1892

Definition at line 173 of file RemClien.h.

#define IDM_LOG_LOGCLEAR 1890

Definition at line 171 of file RemClien.h.

#define IDM_LOG_LOGGING 1891

Definition at line 172 of file RemClien.h.

#define IDM_UCAR_CLUTCH 1203

Definition at line 142 of file RemClien.h.

#define IDM_UCAR_CREATE 1200

Definition at line 139 of file RemClien.h.

#define IDM_UCAR_OFFROAD 1206

Definition at line 145 of file RemClien.h.

#define IDM_UCAR_RELEASE 1201

Definition at line 140 of file RemClien.h.

#define IDM_UCAR_SHIFT 1202

Definition at line 141 of file RemClien.h.

#define IDM_UCAR_SPEED 1204

Definition at line 143 of file RemClien.h.

#define IDM_UCAR_STEER 1205

Definition at line 144 of file RemClien.h.

#define IDM_UCAR_WINCH 1207

Definition at line 146 of file RemClien.h.

#define IDM_UCRU_ADJUST 1407

Definition at line 166 of file RemClien.h.

#define IDM_UCRU_CLUTCH 1403

Definition at line 162 of file RemClien.h.

#define IDM_UCRU_CREATE 1400

Definition at line 159 of file RemClien.h.

#define IDM_UCRU_ENGAGE 1406

Definition at line 165 of file RemClien.h.

#define IDM_UCRU_OFFROAD 1408

Definition at line 167 of file RemClien.h.

#define IDM_UCRU_RELEASE 1401

Definition at line 160 of file RemClien.h.

#define IDM_UCRU_SHIFT 1402

Definition at line 161 of file RemClien.h.

#define IDM_UCRU_SPEED 1404

Definition at line 163 of file RemClien.h.

#define IDM_UCRU_STEER 1405

Definition at line 164 of file RemClien.h.

#define IDM_UCRU_WINCH 1409

Definition at line 168 of file RemClien.h.

#define IDS_APPINITFAILED 2001

Definition at line 185 of file RemClien.h.

#define IDS_ASSERT_FAIL 2200

Definition at line 191 of file RemClien.h.

#define IDS_COMINITFAILED 2000

Definition at line 184 of file RemClien.h.

#define IDS_NODCOM 2004

Definition at line 188 of file RemClien.h.

#define IDS_NOSERVER 2005

Definition at line 189 of file RemClien.h.

#define IDS_NOTIMPLEMENTED 2301

Definition at line 194 of file RemClien.h.

#define IDS_NOUNICODE 2003

Definition at line 187 of file RemClien.h.

#define IDS_OUTOFMEMORY 2002

Definition at line 186 of file RemClien.h.

#define IDS_START_MESSAGE_LOG 2400

Definition at line 197 of file RemClien.h.

#define MAIN_WINDOW_CLASS_MENU_STR "REMCLIENMenu"

Definition at line 116 of file RemClien.h.

#define MAIN_WINDOW_CLASS_NAME_STR "REMCLIENWindow"

Definition at line 115 of file RemClien.h.

#define MAIN_WINDOW_TITLE_STR "REMCLIEN: Tutorial Code Sample"

Definition at line 114 of file RemClien.h.

#define MARSHAL_TUTFILE_STR "marshal.htm"

Definition at line 120 of file RemClien.h.

#define OFN_DEFAULTFILES_STR "All Files (*.*)\0*.*\0"

Definition at line 123 of file RemClien.h.

#define OFN_DEFAULTTITLE_STR "Open File"

Definition at line 124 of file RemClien.h.

#define SERVER_TUTFILE_STR "aptserve.htm"

Definition at line 119 of file RemClien.h.

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/RemClien/UTCRUCAR.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • RemClien
Functions

UTCRUCAR.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <apputil.h>
#include <micars.h>
#include <carguids.h>
#include "remclien.h"
#include "utcrucar.h"

Go to the source code of this file.

Functions

HRESULT CreateUtilityCruiseCar (IUnknown *pUnkOuter, REFIID riid, PPVOID ppv)
STDMETHODIMP_ (ULONG) COUtilityCruiseCar

Function Documentation

HRESULT CreateUtilityCruiseCar | ( | IUnknown * | pUnkOuter,
 |  | REFIID | riid,
 |  | PPVOID | ppv
 | ) |  |

Definition at line 1040 of file UTCRUCAR.Cpp.

{
  HRESULT hr;
  COUtilityCruiseCar* pCob;

  LOGF1("C: CreateUtilityCruiseCar. pUnkOuter=0x%X.",pUnkOuter);

  // If the creation call is requesting aggregation (pUnkOuter != NULL),
  // the COM rules state the IUnknown interface MUST also be concomitantly
  // requested.  If it is not so requested ( riid != IID_IUnknown) then
  // an error must be returned indicating that no aggregate creation of
  // the COUtilityCruiseCar COM Object can be performed using anything
  // other than a controlling IUnknown interface.
  if (NULL != pUnkOuter && riid != IID_IUnknown)
    hr = CLASS_E_NOAGGREGATION;
  else
  {
    // Instantiate a COUtilityCruiseCar COM Object.
    pCob = new COUtilityCruiseCar(pUnkOuter);
    if (NULL != pCob)
    {
      // If we have succeeded in instantiating the COUtilityCruiseCar object
      // we initialize it (with any subordinate COM objects) to offer it's
      // interfaces.
      hr = pCob->Init();
      if (SUCCEEDED(hr))
      {
        // We QueryInterface this new COM Object not only to deposit the
        // main interface pointer to the caller's pointer variable, but to
        // also automatically bump the Reference Count on the new COM
        // Object after handing out this *ppv reference to it.
        hr = pCob->QueryInterface(riid, (PPVOID)ppv);
      }
      else
        DELETE_POINTER(pCob);
    }
    else
      hr = E_OUTOFMEMORY;
  }

  if (SUCCEEDED(hr))
  {
    LOGF1("C: CreateUtilityCruiseCar Succeeded. *ppv=0x%X.",*ppv);
  }
  else
  {
    LOGF1("C: CreateUtilityCruiseCar Failed. hr=0x%X.",hr);
  }

  return hr;
}

STDMETHODIMP_ ( ULONG )

Definition at line 935 of file UTCRUCAR.Cpp.

{
  // Decrement the Interface Reference Count.
  --m_cRefI;

  LOGF1("C: COUtilityCruiseCar::CImpIUtility::Release. Delegating. New cI=%i.", m_cRefI);

  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:17 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/RemClien/UTCRUCAR.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • RemClien

UTCRUCAR.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/StoClien/GUIPAPER.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • StoClien

GUIPAPER.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <olectl.h>
#include <commdlg.h>
#include <tchar.h>
#include <apputil.h>
#include <ipaper.h>
#include <papguids.h>
#include "papfile.h"
#include "guipaper.h"
#include "sink.h"
#include "stoclien.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/StoClien/GUIPAPER.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • StoClien

GUIPAPER.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/StoClien/PAPFILE.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • StoClien

PAPFILE.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <apputil.h>
#include <ipaper.h>
#include <papguids.h>
#include "papfile.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/StoClien/PAPFILE.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • StoClien

PAPFILE.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/StoClien/SINK.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • StoClien
Functions

SINK.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <olectl.h>
#include <apputil.h>
#include <ipaper.h>
#include <papguids.h>
#include "papfile.h"
#include "guipaper.h"
#include "sink.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) COPaperSink

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 340 of file SINK.Cpp.

{
  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/StoClien/SINK.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • StoClien

SINK.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/StoClien/StoClien.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • StoClien
Functions

StoClien.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <olectl.h>
#include <initguid.h>
#include <commdlg.h>
#include <apputil.h>
#include <ipaper.h>
#include <papguids.h>
#include "papfile.h"
#include "guipaper.h"
#include "stoclien.h"

Go to the source code of this file.

Functions

BOOL | InitApplication (HINSTANCE hInstance)
BOOL | UnicodeOk (void)
int PASCAL | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pszCmdLine, int nCmdShow)

Function Documentation

BOOL InitApplication ( HINSTANCE hInstance )

Definition at line 787 of file StoClien.Cpp.

{
  BOOL bOk;
  // The window class for all instances of the main frame window.
  WNDCLASSEX wcf;

  // Assign the appropriate values for this main frame window class.
  wcf.cbSize        = sizeof(WNDCLASSEX);
  wcf.cbClsExtra    = 0;            // No per-class extra data.
  wcf.cbWndExtra    = 0;            // No per-window extra data.
  wcf.hInstance     = hInstance;    // Application module instance.
  wcf.lpfnWndProc   = &WindowProc;  // Global Window Procedure (defined in
                                    // APPUTIL for all CVirWindows).
  wcf.hCursor       = LoadCursor(                  // Load app cursor.
                        hInstance,
                        TEXT("AppCursor"));
  wcf.hIcon         = (HICON) LoadIcon(            // Load app icon.
                                hInstance,
                                TEXT("AppIcon"));
  wcf.hIconSm       = (HICON) LoadImage(           // Load small icon.
                                hInstance,
                                TEXT("AppIcon"),
                                IMAGE_ICON,
                                16, 16,
                                0);
  wcf.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); // Backgnd color.
  wcf.style         = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; // Class style(s).
  wcf.lpszClassName = TEXT(MAIN_WINDOW_CLASS_NAME_STR);   // Class name.
  wcf.lpszMenuName  = TEXT(MAIN_WINDOW_CLASS_MENU_STR);   // Menu name.

  // Register the window class and return FALSE if unsuccesful.
  bOk = RegisterClassEx(&wcf);

  return (bOk);
}

BOOL UnicodeOk ( void )

Definition at line 761 of file StoClien.Cpp.

{
  BOOL bOk = TRUE;
  TCHAR szUserName[MAX_STRING_LENGTH];
  DWORD dwSize = MAX_STRING_LENGTH;

  if (!GetUserName(szUserName, &dwSize))
    bOk = ERROR_CALL_NOT_IMPLEMENTED == GetLastError() ? FALSE : TRUE;

  return bOk;
}

int PASCAL WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | pszCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 846 of file StoClien.Cpp.

{
  CMainWindow* pWin = NULL;
  MSG msg;
  HACCEL hAccel;
  int iRun = FALSE;

  // If we were compiled for UNICODE and the platform seems OK with this
  // then proceed.  Else we error and exit the app.
  if (UnicodeOk())
  {
    // Call to initialize the COM Library.  Use the SUCCEEDED macro
    // to detect success.  If fail then exit app with error message.
    // Tell COM that this client process and all subordinate threads
    // will live in an apartment threaded world.
    if (SUCCEEDED(CoInitialize(NULL)))
    {
      // If we succeeded in initializing the COM Library we proceed to
      // initialize the application.  If we can't init the application
      // then we signal shut down with an error message exit.
      iRun = InitApplication(hInstance);
      if (iRun)
      {
        // Assume we'll set iRun to TRUE when initialization is done.
        iRun = FALSE;
        // We are still go for running so we try to create a nifty new
        // CMainWindow object for this app instance.
        pWin = new CMainWindow;
        if (NULL != pWin)
        {
          // Now we initialize an instance of the new CMainWindow.
          // This includes creating the main window.
          if (pWin->InitInstance(hInstance, pszCmdLine, nCmdShow))
          {
            // Load the keyboard accelerators from the resources.
            hAccel = LoadAccelerators(hInstance, TEXT("AppAccel"));
            if (NULL != hAccel)
            {
              // Signal App Initialization is successfully done.
              iRun = TRUE;
            }
          }
        }
      }

      if (iRun)
      {
        // If we initialized the app instance properly then we are still
        // go for running.  We then start up the main message pump for
        // the application.
        while (GetMessage(&msg, NULL, 0, 0))
        {
          if (!TranslateAccelerator(pWin->GetHwnd(), hAccel, &msg))
          {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
          }
        }

        // We also ask COM to unload any unused COM Servers, including our
        // friend, STOSERVE.
        CoFreeUnusedLibraries();

        // We'll pass to Windows the reason why we exited the message loop.
        iRun = (int) msg.wParam;
      }
      else
      {
        // We failed to initialize the application. Put up error message
        // box saying that application couldn't be initialized.  Parent
        // window is desktop (ie, NULL). Exit the failed application
        // (ie, by returning FALSE to WinMain).
        ErrorBox(hInstance, NULL, IDS_APPINITFAILED);

        // Delete the CMainWindow object.
        DELETE_POINTER(pWin);
      }

      // We're exiting this app (either normally or by init failure) so
      // shut down the COM Library.
      CoUninitialize();
    }
    else
    {
      // We failed to Initialize the COM Library. Put up error message
      // box saying that COM Library couldn't be initialized.  Parent
      // window is desktop (ie, NULL). Exit the failed application
      // (ie, by returning FALSE to WinMain).
      ErrorBox(hInstance, NULL, IDS_COMINITFAILED);
    }
  }
  else
  {
    // If we were compiled for UNICODE but the platform has problems with
    // this then indicate an error and exit the app immediately.
    CHAR szMsg[MAX_STRING_LENGTH];

    if (LoadStringA(
          hInstance,
          IDS_NOUNICODE,
          szMsg,
          MAX_STRING_LENGTH))
    {
      MessageBoxA(
        NULL,
        szMsg,
        ERROR_TITLE_STR,
        MB_OK | MB_ICONEXCLAMATION);
    }
  }

  return iRun;
}

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/StoClien/StoClien.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • StoClien
Defines | Enumerations

StoClien.h File Reference

Go to the source code of this file.

Defines

#define | IDM_DRAW_ERASE 1103
#define | IDM_DRAW_OFF 1101
#define | IDM_DRAW_ON 1100
#define | IDM_DRAW_REDRAW 1102
#define | IDM_FILE_EXIT 1020
#define | IDM_FILE_OPEN 1000
#define | IDM_FILE_SAVE 1001
#define | IDM_FILE_SAVEAS 1002
#define | IDM_HELP_ABOUT 1905
#define | IDM_HELP_ABOUTSERVER 1906
#define | IDM_HELP_CONTENTS 1900
#define | IDM_HELP_READSOURCE 1904
#define | IDM_HELP_TUTORIAL 1901
#define | IDM_HELP_TUTSERVER 1902
#define | IDM_PEN_COLOR 1200
#define | IDM_PEN_MEDIUM 1202
#define | IDM_PEN_THICK 1203
#define | IDM_PEN_THIN 1201
#define | IDM_SINK_OFF 1301
#define | IDM_SINK_ON 1300
#define | IDS_APPINITFAILED 2001
#define | IDS_ASK_SAVE 2301
#define | IDS_ASSERT_FAIL 2200
#define | IDS_COMINITFAILED 2000
#define | IDS_DRAWING_CHANGED 2300
#define | IDS_NOSERVER 2004
#define | IDS_NOTIMPLEMENTED 2005
#define | IDS_NOUNICODE 2003
#define | IDS_OFN_PAPFILES 2302
#define | IDS_OFN_PAPOPEN 2303
#define | IDS_OFN_PAPSAVE 2304
#define | IDS_OUTOFMEMORY 2002
#define | MAIN_APP_NAME_STR "STOCLIEN: "
#define | MAIN_WINDOW_CLASS_MENU_STR "STOCLIENMenu"
#define | MAIN_WINDOW_CLASS_NAME_STR "STOCLIENWindow"
#define | MAIN_WINDOW_TITLE_STR "STOCLIEN: stoclien.pap"
#define | OFN_DEFAULTFILES_STR "All Files (*.*)\0*.*\0"
#define | OFN_DEFAULTTITLE_STR "Open File"
#define | SERVER_TUTFILE_STR "stoserve.htm"

Enumerations

enum | { INK_THIN = 2, INK_MEDIUM = 10, INK_THICK = 20 }

Define Documentation

#define IDM_DRAW_ERASE 1103

Definition at line 112 of file StoClien.h.

#define IDM_DRAW_OFF 1101

Definition at line 110 of file StoClien.h.

#define IDM_DRAW_ON 1100

Definition at line 109 of file StoClien.h.

#define IDM_DRAW_REDRAW 1102

Definition at line 111 of file StoClien.h.

#define IDM_FILE_EXIT 1020

Definition at line 106 of file StoClien.h.

#define IDM_FILE_OPEN 1000

Definition at line 103 of file StoClien.h.

#define IDM_FILE_SAVE 1001

Definition at line 104 of file StoClien.h.

#define IDM_FILE_SAVEAS 1002

Definition at line 105 of file StoClien.h.

#define IDM_HELP_ABOUT 1905

Definition at line 129 of file StoClien.h.

#define IDM_HELP_ABOUTSERVER 1906

Definition at line 130 of file StoClien.h.

#define IDM_HELP_CONTENTS 1900

Definition at line 125 of file StoClien.h.

#define IDM_HELP_READSOURCE 1904

Definition at line 128 of file StoClien.h.

#define IDM_HELP_TUTORIAL 1901

Definition at line 126 of file StoClien.h.

#define IDM_HELP_TUTSERVER 1902

Definition at line 127 of file StoClien.h.

#define IDM_PEN_COLOR 1200

Definition at line 115 of file StoClien.h.

#define IDM_PEN_MEDIUM 1202

Definition at line 117 of file StoClien.h.

#define IDM_PEN_THICK 1203

Definition at line 118 of file StoClien.h.

#define IDM_PEN_THIN 1201

Definition at line 116 of file StoClien.h.

#define IDM_SINK_OFF 1301

Definition at line 122 of file StoClien.h.

#define IDM_SINK_ON 1300

Definition at line 121 of file StoClien.h.

#define IDS_APPINITFAILED 2001

Definition at line 134 of file StoClien.h.

#define IDS_ASK_SAVE 2301

Definition at line 144 of file StoClien.h.

#define IDS_ASSERT_FAIL 2200

Definition at line 140 of file StoClien.h.

#define IDS_COMINITFAILED 2000

Definition at line 133 of file StoClien.h.

#define IDS_DRAWING_CHANGED 2300

Definition at line 143 of file StoClien.h.

#define IDS_NOSERVER 2004

Definition at line 137 of file StoClien.h.

#define IDS_NOTIMPLEMENTED 2005

Definition at line 138 of file StoClien.h.

#define IDS_NOUNICODE 2003

Definition at line 136 of file StoClien.h.

#define IDS_OFN_PAPFILES 2302

Definition at line 145 of file StoClien.h.

#define IDS_OFN_PAPOPEN 2303

Definition at line 146 of file StoClien.h.

#define IDS_OFN_PAPSAVE 2304

Definition at line 147 of file StoClien.h.

#define IDS_OUTOFMEMORY 2002

Definition at line 135 of file StoClien.h.

#define MAIN_APP_NAME_STR "STOCLIEN: "

Definition at line 81 of file StoClien.h.

#define MAIN_WINDOW_CLASS_MENU_STR "STOCLIENMenu"

Definition at line 84 of file StoClien.h.

#define MAIN_WINDOW_CLASS_NAME_STR "STOCLIENWindow"

Definition at line 83 of file StoClien.h.

#define MAIN_WINDOW_TITLE_STR "STOCLIEN: stoclien.pap"

Definition at line 82 of file StoClien.h.

#define OFN_DEFAULTFILES_STR "All Files (*.*)\0*.*\0"

Definition at line 90 of file StoClien.h.

#define OFN_DEFAULTTITLE_STR "Open File"

Definition at line 91 of file StoClien.h.

#define SERVER_TUTFILE_STR "stoserve.htm"

Definition at line 87 of file StoClien.h.

Enumeration Type Documentation

anonymous enum
Enumerator:
INK_THIN
INK_MEDIUM
INK_THICK

Definition at line 94 of file StoClien.h.

{
  INK_THIN = 2,
  INK_MEDIUM = 10,
  INK_THICK = 20
};

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/StoServe/Connect.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • StoServe
Functions

Connect.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <olectl.h>
#include <apputil.h>
#include <ipaper.h>
#include <papguids.h>
#include "server.h"
#include "connect.h"
#include "paper.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) COEnumConnectionPoints

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 1298 of file Connect.Cpp.

{
  ULONG cRefs;

  // Pass this release along to the Host object being enumerated.
  m_pHostObj->Release();

  cRefs = --m_cRefs;

  if (0 == cRefs)
  {
    // We artificially bump the main ref count to prevent reentrancy via
    // the main object destructor.
    m_cRefs++;
    delete this;
  }

  return cRefs;
}

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/StoServe/Connect.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • StoServe

Connect.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/StoServe/Factory.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • StoServe
Functions

Factory.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <olectl.h>
#include <apputil.h>
#include <ipaper.h>
#include <papguids.h>
#include "server.h"
#include "factory.h"
#include "connect.h"
#include "paper.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CFPaper

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 370 of file Factory.Cpp.

{
  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/StoServe/Factory.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • StoServe

Factory.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/StoServe/PAPER.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • StoServe
Functions

PAPER.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <olectl.h>
#include <apputil.h>
#include <ipaper.h>
#include <papguids.h>
#include "server.h"
#include "connect.h"
#include "paper.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) COPaper

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 810 of file PAPER.Cpp.

{
  // Delegate this call to the outer object's Release.
  return m_pUnkOuter->Release();
}

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/StoServe/PAPER.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • StoServe

PAPER.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/StoServe/Server.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • StoServe

Server.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <apputil.h>
#include "server.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/StoServe/Server.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • StoServe
Defines | Variables

Server.h File Reference

Go to the source code of this file.

Defines

#define IDS_ASSERT_FAIL 2200

Variables

CServer * g_pServer

Define Documentation

#define IDS_ASSERT_FAIL 2200

Definition at line 43 of file Server.h.

Variable Documentation

CServer* g_pServer

Definition at line 78 of file AptServe.Cpp.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/StoServe/StoServe.Cpp File Reference

  • Com
  • Fundamentals
  • TutSamp
  • StoServe
Defines | Functions | Variables

StoServe.Cpp File Reference

#include <windows.h>
#include <ole2.h>
#include <initguid.h>
#include <apputil.h>
#include <ipaper.h>
#include <papguids.h>
#include "stoserve.h"
#include "server.h"
#include "factory.h"

Go to the source code of this file.

Defines

#define | _DLLEXPORT_

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, PPVOID ppv)
BOOL WINAPI | DllMain (HINSTANCE hDllInst, DWORD fdwReason, LPVOID lpvReserved)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)
BOOL | UnicodeOk (void)

Variables

CServer * | g_pServer = NULL

Define Documentation

#define _DLLEXPORT_

Definition at line 64 of file StoServe.Cpp.

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 252 of file StoServe.Cpp.

{
  HRESULT hr;

  // We return S_OK if there are no longer any living objects AND
  // there are no outstanding client locks on this server.
  hr = g_pServer->CanUnloadNow();

  return hr;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | PPVOID | ppv
 | ) |  |

Definition at line 211 of file StoServe.Cpp.

{
  HRESULT hr = CLASS_E_CLASSNOTAVAILABLE;
  IUnknown* pCob = NULL;

  if (CLSID_DllPaper == rclsid)
  {
    hr = E_OUTOFMEMORY;
    pCob = new CFPaper(NULL, g_pServer);
  }

  if (NULL != pCob)
  {
    g_pServer->ObjectsUp();
    hr = pCob->QueryInterface(riid, ppv);
    if (FAILED(hr))
    {
      g_pServer->ObjectsDown();
      DELETE_POINTER(pCob);
    }
  }

  return hr;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hDllInst,
 |  | DWORD | fdwReason,
 |  | LPVOID | lpvReserved
 | ) |  |

Definition at line 136 of file StoServe.Cpp.

{
  BOOL bResult = TRUE;

  // Dispatch this main call based on the reason it was called.
  switch (fdwReason)
  {
    case DLL_PROCESS_ATTACH:
      // The DLL is being loaded for the first time by a given process.
      // Perform per-process initialization here.  If the initialization
      // is successful, return TRUE; if unsuccessful, return FALSE.
      bResult = FALSE;
      if (UnicodeOk())
      {
        // Instantiate the CServer utility class.
        g_pServer = new CServer;
        if (NULL != g_pServer)
        {
          // Remember the DLL Instance handle.
          g_pServer->m_hDllInst = hDllInst;
          bResult = TRUE;
        }
      }
      break;

    case DLL_PROCESS_DETACH:
      // The DLL is being unloaded by a given process.  Do any
      // per-process clean up here, such as undoing what was done in
      // DLL_PROCESS_ATTACH.  The return value is ignored.
      DELETE_POINTER(g_pServer);
      break;

    case DLL_THREAD_ATTACH:
      // A thread is being created in a process that has already loaded
      // this DLL.  Perform any per-thread initialization here.  The
      // return value is ignored.
      break;

    case DLL_THREAD_DETACH:
      // A thread is exiting cleanly in a process that has already
      // loaded this DLL.  Perform any per-thread clean up here.  The
      // return value is ignored.
      break;

    default:
      break;
  }

  return (bResult);
}

STDAPI DllRegisterServer ( void )

Definition at line 275 of file StoServe.Cpp.

{
  HRESULT  hr = NOERROR;
  TCHAR    szID[GUID_SIZE+1];
  TCHAR    szCLSID[GUID_SIZE+32];
  TCHAR    szModulePath[MAX_PATH];

  // Obtain the path to this module's executable file for later use.
  GetModuleFileName(
    g_pServer->m_hDllInst,
    szModulePath,
    sizeof(szModulePath)/sizeof(TCHAR));

  /*-------------------------------------------------------------------------
    Create registry entries for the DllPaper Component.
  -------------------------------------------------------------------------*/
  // Create some base key strings.
  StringFromGUID2(CLSID_DllPaper, szID, GUID_SIZE);
  lstrcpyn(szCLSID, TEXT("CLSID\\"), sizeof(szCLSID)/sizeof(TCHAR));
  lstrncat(szCLSID, szID, sizeof(szCLSID)/sizeof(TCHAR) - lstrlen(szCLSID));

  // Create ProgID keys.
  SetRegKeyValue(
    TEXT("CTS.DllPaper.1"),
    NULL,
    TEXT("DllPaper Component - STOSERVE Code Sample"));
  SetRegKeyValue(
    TEXT("CTS.DllPaper.1"),
    TEXT("CLSID"),
    szID);

  // Create VersionIndependentProgID keys.
  SetRegKeyValue(
    TEXT("CTS.DllPaper"),
    NULL,
    TEXT("DllPaper Component - STOSERVE Code Sample"));
  SetRegKeyValue(
    TEXT("CTS.DllPaper"),
    TEXT("CurVer"),
    TEXT("CTS.DllPaper.1"));
  SetRegKeyValue(
    TEXT("CTS.DllPaper"),
    TEXT("CLSID"),
    szID);

  // Create entries under CLSID.
  SetRegKeyValue(
    szCLSID,
    NULL,
    TEXT("DllPaper Component - STOSERVE Code Sample"));
  SetRegKeyValue(
    szCLSID,
    TEXT("ProgID"),
    TEXT("CTS.DllPaper.1"));
  SetRegKeyValue(
    szCLSID,
    TEXT("VersionIndependentProgID"),
    TEXT("CTS.DllPaper"));
  SetRegKeyValue(
    szCLSID,
    TEXT("NotInsertable"),
    NULL);
  SetRegKeyValue(
    szCLSID,
    TEXT("InprocServer32"),
    szModulePath);
  AddRegNamedValue(
    szCLSID,
    TEXT("InprocServer32"),
    TEXT("ThreadingModel"),
    TEXT("Apartment"));

  return hr;
}

STDAPI DllUnregisterServer ( void )

Definition at line 362 of file StoServe.Cpp.

{
  HRESULT  hr = NOERROR;
  TCHAR    szID[GUID_SIZE+1];
  TCHAR    szCLSID[GUID_SIZE+32];
  TCHAR    szTemp[MAX_PATH+GUID_SIZE];

  /*-------------------------------------------------------------------------
    Delete registry entries for the Paper Component.
  -------------------------------------------------------------------------*/
  //Create some base key strings.
  StringFromGUID2(CLSID_DllPaper, szID, GUID_SIZE);
  lstrcpyn(szCLSID, TEXT("CLSID\\"), sizeof(szCLSID)/sizeof(TCHAR));
  lstrncat(szCLSID, szID, sizeof(szCLSID)/sizeof(TCHAR) - lstrlen(szCLSID));

  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.DllPaper\\CurVer"));
  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.DllPaper\\CLSID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.DllPaper"));

  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.DllPaper.1\\CLSID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CTS.DllPaper.1"));

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("ProgID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("VersionIndependentProgID"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("NotInsertable"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  wsprintf(szTemp, TEXT("%s\\%s"), szCLSID, TEXT("InprocServer32"));
  RegDeleteKey(HKEY_CLASSES_ROOT, szTemp);

  RegDeleteKey(HKEY_CLASSES_ROOT, szCLSID);

  return hr;
}

BOOL UnicodeOk ( void )

Definition at line 88 of file StoServe.Cpp.

{
  BOOL bOk = TRUE;
  TCHAR szUserName[MAX_STRING_LENGTH];
  DWORD dwSize = MAX_STRING_LENGTH;

  if (!GetUserName(szUserName, &dwSize))
    bOk = ERROR_CALL_NOT_IMPLEMENTED == GetLastError() ? FALSE : TRUE;

  return bOk;
}

Variable Documentation

CServer* g_pServer = NULL

Definition at line 74 of file StoServe.Cpp.

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/TutSamp/StoServe/StoServe.h File Reference

  • Com
  • Fundamentals
  • TutSamp
  • StoServe
Defines | Functions

StoServe.h File Reference

Go to the source code of this file.

Defines

#define | DLLENTRY extern __declspec(dllimport)
#define | STDENTRY DLLENTRY HRESULT WINAPI
#define | STDENTRY_(type) DLLENTRY type WINAPI

Functions

STDENTRY | DllRegisterServer (void)
STDENTRY | DllUnregisterServer (void)

Define Documentation

#define DLLENTRY extern __declspec(dllimport)

Definition at line 47 of file StoServe.h.

#define STDENTRY DLLENTRY HRESULT WINAPI

Definition at line 49 of file StoServe.h.

#define STDENTRY_ ( type ) DLLENTRY type WINAPI

Definition at line 50 of file StoServe.h.

Function Documentation

STDENTRY DllRegisterServer ( void )

Definition at line 69 of file ComSpyAudit.Cpp.

{
  // registers object, typelib and all interfaces in typelib
  return _Module.RegisterServer(TRUE);
}

STDENTRY DllUnregisterServer ( void )

Definition at line 78 of file ComSpyAudit.Cpp.

{
  _Module.UnregisterServer();
  return S_OK;
}

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/WinHlprs/cDialog.Cxx File Reference

  • Com
  • Fundamentals
  • WinHlprs
Functions

cDialog.Cxx File Reference

#include <windows.h>
#include "cdialog.h"

Go to the source code of this file.

Functions

BOOL CALLBACK DialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)

Function Documentation

BOOL CALLBACK DialogProc | ( | HWND | hwndDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 77 of file cDialog.Cxx.

{
    CHlprDialog * pdlg;
    switch (uMsg)
    {
    case WM_INITDIALOG:
        // This message is how we identify the dialog object.

        // get a pointer to the window class object
        pdlg = (CHlprDialog *) lParam;
        // set its USERDATA word to point to the class object
        SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pdlg);
        break;
    default:
        // get a pointer to the window class object
        pdlg = (CHlprDialog *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
        break;
    }
    // and call its message proc method
    if (pdlg != (CHlprDialog *) 0)
    {
        return(pdlg->DialogProc(hwndDlg, uMsg, wParam, lParam));
    }
    else
    {
        return(FALSE);
    }
}

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/WinHlprs/cDialog.h File Reference

  • Com
  • Fundamentals
  • WinHlprs
Functions

cDialog.h File Reference

Go to the source code of this file.

Functions

BOOL CALLBACK DialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)

Function Documentation

BOOL CALLBACK DialogProc | ( | HWND | hwndDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 1311 of file AppUtil.Cpp.

{
  // Get a pointer to the window class object.
  CVirDialog* pdlg = (CVirDialog*) GetWindowLongPtr(hWndDlg, GWLP_USERDATA);

  switch (uMsg)
  {
    case WM_INITDIALOG:
      // Get a pointer to the window class object.
      pdlg = (CVirDialog*) lParam;

      // Assign the m_hWnd member variable.
      pdlg->m_hWnd = hWndDlg;

      // Set the USERDATA word to point to the class object.
      SetWindowLongPtr(hWndDlg, GWLP_USERDATA, (INT_PTR) pdlg);
      break;

    default:
      break;
  }

  // Call its message proc method.
  if (pdlg != (CVirDialog *) 0)
    return (pdlg->DialogProc(hWndDlg, uMsg, wParam, lParam));
  else
    return (FALSE);
}

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/WinHlprs/cwindow.Cxx File Reference

  • Com
  • Fundamentals
  • WinHlprs
Functions

cwindow.Cxx File Reference

#include "cwindow.h"

Go to the source code of this file.

Functions

LRESULT CALLBACK WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)

Function Documentation

LRESULT CALLBACK WindowProc | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 101 of file cwindow.Cxx.

{
    CHlprWindow * pw;
    switch (uMsg)
    {
    case WM_CREATE:
        // Since this is the first time that we can get ahold of
        // a pointer to the window class object, all messages that might
        // have been sent before this are never seen by the Windows object
        // and only get passed on to te DefWindowProc

        // get a pointer to the window class object
        pw = (CHlprWindow *) ((CREATESTRUCT *)lParam)->lpCreateParams;
        // set its USERDATA DWORD to point to the class object
        SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR) pw);
        // Set it's protected _hwnd member variable to ensure that
        // member functions have access to the correct window handle.
        pw->_hwnd = hwnd;
        break;
    case WM_DESTROY:
        // This is our signal to destroy the window class object.

        pw = (CHlprWindow *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
        SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
        delete pw;
        pw = (CHlprWindow *) 0;
        break;
    default:
        // get a pointer to the window class object
        pw = (CHlprWindow *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
        break;
    }
    // and call its message proc method
    if (pw != (CHlprWindow *) 0)
    {
        return(pw->WindowProc(uMsg, wParam, lParam));
    }
    else
    {
        return(DefWindowProc(hwnd, uMsg, wParam, lParam));
    }
}

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/WinHlprs/cwindow.h File Reference

  • Com
  • Fundamentals
  • WinHlprs
Functions

cwindow.h File Reference

#include <windows.h>

Go to the source code of this file.

Functions

LRESULT CALLBACK WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)

Function Documentation

LRESULT CALLBACK WindowProc | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 1176 of file AppUtil.Cpp.

{
  // Get a pointer to the window class object.
  CVirWindow* pWin = (CVirWindow*) GetWindowLongPtr(hWnd, GWLP_USERDATA);

  switch (uMsg)
  {
    case WM_NCCREATE:
      // Since this is the first time that we can get ahold of
      // a pointer to the window class object, all messages that might
      // have been sent before this are never seen by the Windows object
      // and only get passed on to the DefWindowProc

      // Get the initial creation pointer to the window object
      pWin = (CVirWindow *) ((CREATESTRUCT *)lParam)->lpCreateParams;

      // Set it's protected m_hWnd member variable to ensure that
      // member functions have access to the correct window handle.
      pWin->m_hWnd = hWnd;

      // Set its USERDATA DWORD to point to the window object
      SetWindowLongPtr(hWnd, GWLP_USERDATA, (INT_PTR) pWin);
      break;

    case WM_DESTROY:
      // This is our signal to destroy the window object.
      SetWindowLongPtr(hWnd, GWLP_USERDATA, 0);
      DELETE_POINTER(pWin);
      break;

    default:
      break;
  }

  // Call its message proc method.
  if (NULL != pWin)
    return (pWin->WindowProc(uMsg, wParam, lParam));
  else
    return (DefWindowProc(hWnd, uMsg, wParam, lParam));
}

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/WinHlprs/strmHelp.Cxx File Reference

  • Com
  • Fundamentals
  • WinHlprs
Defines | Functions

strmHelp.Cxx File Reference

#include <windows.h>
#include <ole2.h>
#include "strmhelp.h"
#include <stdio.h>

Go to the source code of this file.

Defines

#define | MAX_SIZE 128

Functions

HRESULT | ReadDouble (IStream *pstm, double *pd, ULONG FAR *pcbRead)
DWORD | SizeDouble (void)
HRESULT | WriteDouble (IStream *pstm, double d, ULONG FAR *pcbWritten)

Define Documentation

#define MAX_SIZE 128

Definition at line 26 of file strmHelp.Cxx.

Function Documentation

HRESULT ReadDouble | ( | IStream * | pstm,
 |  | double * | pd,
 |  | ULONG FAR * | pcbRead
 | ) |  |

Definition at line 91 of file strmHelp.Cxx.

{
    HRESULT hr;
    char szTemp[MAX_SIZE];
    ULONG cbRead;
    DWORD cch = 0;
    do
    {
        hr = pstm->Read(&szTemp[cch], sizeof(char), &cbRead);
        if (pcbRead && SUCCEEDED(hr))
        {
            pcbRead += cbRead;
        }

    } while (SUCCEEDED(hr) && szTemp[cch++]);
    if (SUCCEEDED(hr))
    {
        sscanf(szTemp, "%lf",pd);
    }
    return(hr);
}

DWORD SizeDouble ( void )

Definition at line 43 of file strmHelp.Cxx.

{
    return(MAX_SIZE);
}

HRESULT WriteDouble | ( | IStream * | pstm,
 |  | double | d,
 |  | ULONG FAR * | pcbWritten
 | ) |  |

Definition at line 65 of file strmHelp.Cxx.

{
    char szTemp[MAX_SIZE];
    sprintf(szTemp,"%.100lg", d);
    size_t cch = strlen(szTemp);
    return(pstm->Write(szTemp, (ULONG)(cch + 1), pcbWritten));
}

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Fundamentals/WinHlprs/strmHelp.h File Reference

  • Com
  • Fundamentals
  • WinHlprs
Functions

strmHelp.h File Reference

Go to the source code of this file.

Functions

HRESULT | ReadDouble (IStream *pstm, double *pd, ULONG FAR *pcbRead)
DWORD | SizeDouble (void)
HRESULT | WriteDouble (IStream *pstm, double d, ULONG FAR *pcbWritten)

Function Documentation

HRESULT ReadDouble | ( | IStream * | pstm,
 |  | double * | pd,
 |  | ULONG FAR * | pcbRead
 | ) |  |

Definition at line 91 of file strmHelp.Cxx.

{
    HRESULT hr;
    char szTemp[MAX_SIZE];
    ULONG cbRead;
    DWORD cch = 0;
    do
    {
        hr = pstm->Read(&szTemp[cch], sizeof(char), &cbRead);
        if (pcbRead && SUCCEEDED(hr))
        {
            pcbRead += cbRead;
        }

    } while (SUCCEEDED(hr) && szTemp[cch++]);
    if (SUCCEEDED(hr))
    {
        sscanf(szTemp, "%lf",pd);
    }
    return(hr);
}

DWORD SizeDouble ( void )

Definition at line 43 of file strmHelp.Cxx.

{
    return(MAX_SIZE);
}

HRESULT WriteDouble | ( | IStream * | pstm,
 |  | double | d,
 |  | ULONG FAR * | pcbWritten
 | ) |  |

Definition at line 65 of file strmHelp.Cxx.

{
    char szTemp[MAX_SIZE];
    sprintf(szTemp,"%.100lg", d);
    size_t cch = strlen(szTemp);
    return(pstm->Write(szTemp, (ULONG)(cch + 1), pcbWritten));
}

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/BYOT/BYOTSampleWeb/_ScriptLibrary/rsProxy.java File Reference

  • Com
  • Services
  • BYOT
  • BYOTSampleWeb
  • _ScriptLibrary
Classes

rsProxy.java File Reference

Go to the source code of this file.

Classes

class RSProxy
Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/BYOT/Client/BYOTTransaction/BYOTTransaction.Cpp File Reference

  • Com
  • Services
  • BYOT
  • Client
  • BYOTTransaction
Functions | Variables

BYOTTransaction.Cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include "ByotTransaction.h"
#include "ByotTransaction_i.c"
#include "ByotTransObj.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 42 of file BYOTTransaction.Cpp.

{
    return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 50 of file BYOTTransaction.Cpp.

{
    return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 27 of file BYOTTransaction.Cpp.

{
    if (dwReason == DLL_PROCESS_ATTACH)
    {
        _Module.Init(ObjectMap, hInstance, &LIBID_BYOTTRANSACTIONLib);
        DisableThreadLibraryCalls(hInstance);
    }
    else if (dwReason == DLL_PROCESS_DETACH)
        _Module.Term();
    return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 58 of file BYOTTransaction.Cpp.

{
    // registers object, typelib and all interfaces in typelib
    return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 67 of file BYOTTransaction.Cpp.

{
    return _Module.UnregisterServer(TRUE);
}

Variable Documentation

CComModule _Module

Definition at line 17 of file BYOTTransaction.Cpp.

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/BYOT/Client/BYOTTransaction/BYOTTransaction.Idl File Reference

  • Com
  • Services
  • BYOT
  • Client
  • BYOTTransaction
Functions | Variables

BYOTTransaction.Idl File Reference

Go to the source code of this file.

Functions

HRESULT | AbortTransaction ()
HRESULT | CommitTransaction ()
interface | helpstring ("Begins a BYOT Transaction")] HRESULT BeginTransaction()
library BYOTTRANSACTIONLib | importlib ("stdole32.tlb")
importlib ("stdole2.tlb")
HRESULT | TipURL ([out, retval] BSTR *pVal)

Variables

import oaidl | idl

Function Documentation

HRESULT AbortTransaction ( )
HRESULT CommitTransaction ( )
interface helpstring ( "Begins a BYOT Transaction" )
library BYOTTRANSACTIONLib importlib ( "stdole32.tlb" )
importlib ( "stdole2.tlb" )
HRESULT TipURL ( [out, retval] BSTR * pVal ) [get]

Variable Documentation

import ocidl idl

Definition at line 7 of file BYOTTransaction.Idl.

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/BYOT/Client/BYOTTransaction/BYOTtransObj.Cpp File Reference

  • Com
  • Services
  • BYOT
  • Client
  • BYOTTransaction

BYOTtransObj.Cpp File Reference

#include "stdafx.h"
#include <comsvcs.h>
#include "ByotTransaction.h"
#include "ByotTransObj.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/BYOT/Client/BYOTTransaction/BYOTtransObj.h File Reference

  • Com
  • Services
  • BYOT
  • Client
  • BYOTTransaction
Classes | Variables

BYOTtransObj.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class | CByotTransObj

Variables

CRITICAL_SECTION | g_cs

Variable Documentation

CRITICAL_SECTION g_cs

Definition at line 41 of file SServer.Cpp.

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/BYOT/Client/BYOTTransaction/Resource.h File Reference

  • Com
  • Services
  • BYOT
  • Client
  • BYOTTransaction
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_BYOTTRANSOBJ 101
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_BYOTTRANSOBJ 101

Definition at line 6 of file Resource.h.

#define IDS_PROJNAME 100

Definition at line 5 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/BYOT/Client/BYOTTransaction/StdAfx.Cpp File Reference

  • Com
  • Services
  • BYOT
  • Client
  • BYOTTransaction

StdAfx.Cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/BYOT/Client/BYOTTransaction/StdAfx.h File Reference

  • Com
  • Services
  • BYOT
  • Client
  • BYOTTransaction
Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0500
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 16 of file StdAfx.h.

#define _WIN32_WINNT 0x0500

Definition at line 14 of file StdAfx.h.

#define STRICT

Definition at line 12 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/BYOT/Server/BYOTTxEnlister/EnlistTransaction.Cpp File Reference

  • Com
  • Services
  • BYOT
  • Server
  • BYOTTxEnlister

EnlistTransaction.Cpp File Reference

#include "stdafx.h"
#include "TxEnlister.h"
#include "EnlistTransaction.h"
#include <comsvcs.h>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/BYOT/Server/BYOTTxEnlister/EnlistTransaction.h File Reference

  • Com
  • Services
  • BYOT
  • Server
  • BYOTTxEnlister
Classes

EnlistTransaction.h File Reference

#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Classes

class CEnlistTransaction
Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/BYOT/Server/BYOTTxEnlister/Resource.h File Reference

  • Com
  • Services
  • BYOT
  • Server
  • BYOTTxEnlister
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_ENLISTTRANSACTION 101
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_ENLISTTRANSACTION 101

Definition at line 6 of file Resource.h.

#define IDS_PROJNAME 100

Definition at line 5 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/BYOT/Server/BYOTTxEnlister/StdAfx.Cpp File Reference

  • Com
  • Services
  • BYOT
  • Server
  • BYOTTxEnlister

StdAfx.Cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/BYOT/Server/BYOTTxEnlister/StdAfx.h File Reference

  • Com
  • Services
  • BYOT
  • Server
  • BYOTTxEnlister
Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0500
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 16 of file StdAfx.h.

#define _WIN32_WINNT 0x0500

Definition at line 14 of file StdAfx.h.

#define STRICT

Definition at line 12 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/BYOT/Server/BYOTTxEnlister/TxEnlister.Cpp File Reference

  • Com
  • Services
  • BYOT
  • Server
  • BYOTTxEnlister
Functions | Variables

TxEnlister.Cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include "TxEnlister.h"
#include "TxEnlister_i.c"
#include "EnlistTransaction.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 42 of file TxEnlister.Cpp.

{
    return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 50 of file TxEnlister.Cpp.

{
    return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 27 of file TxEnlister.Cpp.

{
    if (dwReason == DLL_PROCESS_ATTACH)
    {
        _Module.Init(ObjectMap, hInstance, &LIBID_TXENLISTERLib);
        DisableThreadLibraryCalls(hInstance);
    }
    else if (dwReason == DLL_PROCESS_DETACH)
        _Module.Term();
    return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 58 of file TxEnlister.Cpp.

{
    // registers object, typelib and all interfaces in typelib
    return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 67 of file TxEnlister.Cpp.

{
    return _Module.UnregisterServer(TRUE);
}

Variable Documentation

CComModule _Module

Definition at line 17 of file TxEnlister.Cpp.

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/BYOT/Server/BYOTTxEnlister/TxEnlister.Idl File Reference

  • Com
  • Services
  • BYOT
  • Server
  • BYOTTxEnlister
Functions | Variables

TxEnlister.Idl File Reference

Go to the source code of this file.

Functions

HRESULT | CreateInstance ([in] BSTR bstrProgId,[out, retval] IDispatch **ppDispatch)
interface | helpstring ("Enlists in a TIP Transaction")] HRESULT EnlistTransaction([in] BSTR bstrTipUrl)
library TXENLISTERLib | importlib ("stdole32.tlb")
importlib ("stdole2.tlb")

Variables

import oaidl | idl

Function Documentation

HRESULT CreateInstance | ( | [in] BSTR | bstrProgId,
 |  | [out, retval] IDispatch ** | ppDispatch
 | ) |  |
interface helpstring ( "Enlists in a TIP Transaction" )
library TXENLISTERLib importlib ( "stdole32.tlb" )
importlib ( "stdole2.tlb" )

Variable Documentation

import ocidl idl

Definition at line 7 of file TxEnlister.Idl.

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Concurrency/SyncComp/Main.Cpp File Reference

  • Com
  • Services
  • Concurrency
  • SyncComp
Defines

Main.Cpp File Reference

#include "stdafx.h"
#include "Main.h"
#import "STAObject\ReleaseMinSize\STAObject.dll"
#import "FreeObject\ReleaseMinSize\FreeObject.dll"
#import "ComSyncObject\ReleaseMinSize\ComSyncObject.dll"

Go to the source code of this file.

Defines

#define IDT_UIUPDATE 500

Define Documentation

#define IDT_UIUPDATE 500

Definition at line 36 of file Main.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Concurrency/SyncComp/Main.h File Reference

  • Com
  • Services
  • Concurrency
  • SyncComp
Classes

Main.h File Reference

#include "windows.h"
#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Classes

class CMain
Generated on Wed Nov 13 2024 16:53:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Concurrency/SyncComp/Resource.h File Reference

  • Com
  • Services
  • Concurrency
  • SyncComp
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | COMSYNC_OFFSET 2
#define | FREE_OFFSET 1
#define | IDC_AVGTIME1 214
#define | IDC_AVGTIME2 215
#define | IDC_AVGTIME3 216
#define | IDC_AVGTIMEBASE 214
#define | IDC_ITERCOUNT 205
#define | IDC_ITERTOTAL 206
#define | IDC_MAXTIME1 208
#define | IDC_MAXTIME2 209
#define | IDC_MAXTIME3 210
#define | IDC_MAXTIMEBASE 208
#define | IDC_MINTIME1 211
#define | IDC_MINTIME2 212
#define | IDC_MINTIME3 213
#define | IDC_MINTIMEBASE 211
#define | IDC_RADIO_BASE 201
#define | IDC_RADIO_COMSYNC 203
#define | IDC_RADIO_FREE 202
#define | IDC_RADIO_STA 201
#define | IDC_START 207
#define | IDC_THREADCOUNT 204
#define | IDC_THREADRUNNING 217
#define | IDD_MAIN 101
#define | IDR_Test1 100
#define | IDS_PROJNAME 100
#define | STA_OFFSET 0

Define Documentation

#define COMSYNC_OFFSET 2

Definition at line 7 of file Resource.h.

#define FREE_OFFSET 1

Definition at line 6 of file Resource.h.

#define IDC_AVGTIME1 214

Definition at line 28 of file Resource.h.

#define IDC_AVGTIME2 215

Definition at line 29 of file Resource.h.

#define IDC_AVGTIME3 216

Definition at line 30 of file Resource.h.

#define IDC_AVGTIMEBASE 214

Definition at line 27 of file Resource.h.

#define IDC_ITERCOUNT 205

Definition at line 16 of file Resource.h.

#define IDC_ITERTOTAL 206

Definition at line 17 of file Resource.h.

#define IDC_MAXTIME1 208

Definition at line 20 of file Resource.h.

#define IDC_MAXTIME2 209

Definition at line 21 of file Resource.h.

#define IDC_MAXTIME3 210

Definition at line 22 of file Resource.h.

#define IDC_MAXTIMEBASE 208

Definition at line 19 of file Resource.h.

#define IDC_MINTIME1 211

Definition at line 24 of file Resource.h.

#define IDC_MINTIME2 212

Definition at line 25 of file Resource.h.

#define IDC_MINTIME3 213

Definition at line 26 of file Resource.h.

#define IDC_MINTIMEBASE 211

Definition at line 23 of file Resource.h.

#define IDC_RADIO_BASE 201

Definition at line 11 of file Resource.h.

#define IDC_RADIO_COMSYNC 203

Definition at line 14 of file Resource.h.

#define IDC_RADIO_FREE 202

Definition at line 13 of file Resource.h.

#define IDC_RADIO_STA 201

Definition at line 12 of file Resource.h.

#define IDC_START 207

Definition at line 18 of file Resource.h.

#define IDC_THREADCOUNT 204

Definition at line 15 of file Resource.h.

#define IDC_THREADRUNNING 217

Definition at line 31 of file Resource.h.

#define IDD_MAIN 101

Definition at line 10 of file Resource.h.

#define IDR_Test1 100

Definition at line 9 of file Resource.h.

#define IDS_PROJNAME 100

Definition at line 8 of file Resource.h.

#define STA_OFFSET 0

Definition at line 5 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Concurrency/SyncComp/StdAfx.Cpp File Reference

  • Com
  • Services
  • Concurrency
  • SyncComp

StdAfx.Cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Concurrency/SyncComp/StdAfx.h File Reference

  • Com
  • Services
  • Concurrency
  • SyncComp
Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>
#include <atlwin.h>
#include <stdio.h>

Go to the source code of this file.

Defines

#define | _WIN32_WINNT 0x0500
#define | STRICT

Variables

CComModule | _Module
IGlobalInterfaceTable * | g_pGIT

Define Documentation

#define _WIN32_WINNT 0x0500

Definition at line 14 of file StdAfx.h.

#define STRICT

Definition at line 12 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

IGlobalInterfaceTable* g_pGIT

Definition at line 29 of file SyncComp.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Concurrency/SyncComp/SyncComp.Cpp File Reference

  • Com
  • Services
  • Concurrency
  • SyncComp
Functions | Variables

SyncComp.Cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include "main.h"

Go to the source code of this file.

Functions

int WINAPI | _tWinMain (HINSTANCE hInstance, HINSTANCE, LPTSTR lpCmdLine, int)

Variables

CComModule | _Module
IGlobalInterfaceTable * | g_pGIT

Function Documentation

int WINAPI _tWinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | ,
 |  | LPTSTR | lpCmdLine,
 |  | int |
 | ) |  |

Definition at line 38 of file SyncComp.Cpp.

{

    HRESULT hRes = CoInitializeEx(NULL, COINIT_MULTITHREADED);
    _ASSERTE(SUCCEEDED(hRes));

    _Module.Init(NULL, hInstance);

  // get the GIT
  hRes = CoCreateInstance(CLSID_StdGlobalInterfaceTable,
                            NULL,
                            CLSCTX_INPROC_SERVER,
                            IID_IGlobalInterfaceTable,
                            (void **)&g_pGIT);
    _ASSERTE(SUCCEEDED(hRes));

  // show our dialog
  CMain dlg;
  dlg.DoModal();

  // we are done with the GIT
  g_pGIT->Release();

  CoUninitialize();

    _Module.Term();
    return 0;
}

Variable Documentation

CComModule _Module

Definition at line 26 of file SyncComp.Cpp.

IGlobalInterfaceTable* g_pGIT

Definition at line 29 of file SyncComp.Cpp.

Generated on Wed Nov 13 2024 16:53:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Concurrency/SyncComp/SyncComp.Idl File Reference

  • Com
  • Services
  • Concurrency
  • SyncComp
Variables

SyncComp.Idl File Reference

Go to the source code of this file.

Variables

library DummyLib

Variable Documentation

library DummyLib

Definition at line 7 of file SyncComp.Idl.

Generated on Wed Nov 13 2024 16:53:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Concurrency/SyncComp/ComSyncObject/ComSyncObject.Cpp File Reference

  • Com
  • Services
  • Concurrency
  • SyncComp
  • ComSyncObject
Functions | Variables

ComSyncObject.Cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include "ComSyncObject.h"
#include "ComSyncObject_i.c"
#include "ComSyncTest.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 60 of file ComSyncObject.Cpp.

{
    return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 68 of file ComSyncObject.Cpp.

{
    return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 45 of file ComSyncObject.Cpp.

{
    if (dwReason == DLL_PROCESS_ATTACH)
    {
        _Module.Init(ObjectMap, hInstance, &LIBID_COMSYNCOBJECTLib);
        DisableThreadLibraryCalls(hInstance);
    }
    else if (dwReason == DLL_PROCESS_DETACH)
        _Module.Term();
    return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 76 of file ComSyncObject.Cpp.

{
    // registers object, typelib and all interfaces in typelib
    return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 85 of file ComSyncObject.Cpp.

{
    return _Module.UnregisterServer(TRUE);
}

Variable Documentation

CComModule _Module

Definition at line 35 of file ComSyncObject.Cpp.

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Concurrency/SyncComp/ComSyncObject/ComSyncObject.Idl File Reference

  • Com
  • Services
  • Concurrency
  • SyncComp
  • ComSyncObject
Functions | Variables

ComSyncObject.Idl File Reference

Go to the source code of this file.

Functions

library COMSYNCOBJECTLib | importlib ("stdole32.tlb")
importlib ("stdole2.tlb")

Variables

import oaidl | idl

Function Documentation

library COMSYNCOBJECTLib importlib ( "stdole32.tlb" )
importlib ( "stdole2.tlb" )

Variable Documentation

import ocidl idl

Definition at line 7 of file ComSyncObject.Idl.

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Concurrency/SyncComp/ComSyncObject/ComSyncTest.Cpp File Reference

  • Com
  • Services
  • Concurrency
  • SyncComp
  • ComSyncObject
Defines

ComSyncTest.Cpp File Reference

#include "stdafx.h"
#include "ComSyncObject.h"
#include "ComSyncTest.h"

Go to the source code of this file.

Defines

#define LOOPCOUNT 10000

Define Documentation

#define LOOPCOUNT 10000

Definition at line 25 of file ComSyncTest.Cpp.

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Concurrency/SyncComp/ComSyncObject/ComSyncTest.h File Reference

  • Com
  • Services
  • Concurrency
  • SyncComp
  • ComSyncObject
Classes

ComSyncTest.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class CComSyncTest
Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Concurrency/SyncComp/ComSyncObject/Resource.h File Reference

  • Com
  • Services
  • Concurrency
  • SyncComp
  • ComSyncObject
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_COMSYNCTEST 101
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_COMSYNCTEST 101

Definition at line 6 of file Resource.h.

#define IDS_PROJNAME 100

Definition at line 5 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Concurrency/SyncComp/ComSyncObject/StdAfx.Cpp File Reference

  • Com
  • Services
  • Concurrency
  • SyncComp
  • ComSyncObject

StdAfx.Cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Concurrency/SyncComp/ComSyncObject/StdAfx.h File Reference

  • Com
  • Services
  • Concurrency
  • SyncComp
  • ComSyncObject
Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0500
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 16 of file StdAfx.h.

#define _WIN32_WINNT 0x0500

Definition at line 14 of file StdAfx.h.

#define STRICT

Definition at line 12 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Concurrency/SyncComp/FreeObject/FreeObject.Cpp File Reference

  • Com
  • Services
  • Concurrency
  • SyncComp
  • FreeObject
Functions | Variables

FreeObject.Cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include "FreeObject.h"
#include "FreeObject_i.c"
#include "FreeTest.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module
CRITICAL_SECTION | g_csSync

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 65 of file FreeObject.Cpp.

{
    return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 73 of file FreeObject.Cpp.

{
    return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 45 of file FreeObject.Cpp.

{
    if (dwReason == DLL_PROCESS_ATTACH)
    {
        _Module.Init(ObjectMap, hInstance, &LIBID_FREEOBJECTLib);
        DisableThreadLibraryCalls(hInstance);
    // initialize our critsec
    DWORD dwSpinCount = 0;
    InitializeCriticalSectionAndSpinCount(&g_csSync, dwSpinCount);
    }
    else if (dwReason == DLL_PROCESS_DETACH) {
    DeleteCriticalSection(&g_csSync);
        _Module.Term();
  }
    return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 81 of file FreeObject.Cpp.

{
    // registers object, typelib and all interfaces in typelib
    return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 90 of file FreeObject.Cpp.

{
    return _Module.UnregisterServer(TRUE);
}

Variable Documentation

CComModule _Module

Definition at line 34 of file FreeObject.Cpp.

CRITICAL_SECTION g_csSync

Definition at line 35 of file FreeObject.Cpp.

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Concurrency/SyncComp/FreeObject/FreeObject.Idl File Reference

  • Com
  • Services
  • Concurrency
  • SyncComp
  • FreeObject
Functions | Variables

FreeObject.Idl File Reference

Go to the source code of this file.

Functions

library FREEOBJECTLib | importlib ("stdole32.tlb")
importlib ("stdole2.tlb")

Variables

import oaidl | idl

Function Documentation

library FREEOBJECTLib importlib ( "stdole32.tlb" )
importlib ( "stdole2.tlb" )

Variable Documentation

import ocidl idl

Definition at line 7 of file FreeObject.Idl.

Generated on Wed Nov 13 2024 16:53:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Concurrency/SyncComp/FreeObject/FreeTest.Cpp File Reference

  • Com
  • Services
  • Concurrency
  • SyncComp
  • FreeObject
Defines | Variables

FreeTest.Cpp File Reference

#include "stdafx.h"
#include "FreeObject.h"
#include "FreeTest.h"

Go to the source code of this file.

Defines

#define | LOOPCOUNT 10000

Variables

CRITICAL_SECTION | g_csSync

Define Documentation

#define LOOPCOUNT 10000

Definition at line 26 of file FreeTest.Cpp.

Variable Documentation

CRITICAL_SECTION g_csSync

Definition at line 35 of file FreeObject.Cpp.

Generated on Wed Nov 13 2024 16:53:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Concurrency/SyncComp/FreeObject/FreeTest.h File Reference

  • Com
  • Services
  • Concurrency
  • SyncComp
  • FreeObject
Classes

FreeTest.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class CFreeTest
Generated on Wed Nov 13 2024 16:53:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Concurrency/SyncComp/FreeObject/Resource.h File Reference

  • Com
  • Services
  • Concurrency
  • SyncComp
  • FreeObject
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_FREETEST 101
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_FREETEST 101

Definition at line 6 of file Resource.h.

#define IDS_PROJNAME 100

Definition at line 5 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Concurrency/SyncComp/FreeObject/StdAfx.Cpp File Reference

  • Com
  • Services
  • Concurrency
  • SyncComp
  • FreeObject

StdAfx.Cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Concurrency/SyncComp/FreeObject/StdAfx.h File Reference

  • Com
  • Services
  • Concurrency
  • SyncComp
  • FreeObject
Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0500
#define | MUTEX_NAME "ComSyncFreeObject"
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 16 of file StdAfx.h.

#define _WIN32_WINNT 0x0500

Definition at line 14 of file StdAfx.h.

#define MUTEX_NAME "ComSyncFreeObject"

Definition at line 24 of file StdAfx.h.

#define STRICT

Definition at line 12 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Concurrency/SyncComp/STAObject/Resource.h File Reference

  • Com
  • Services
  • Concurrency
  • SyncComp
  • STAObject
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_STATEST 101
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_STATEST 101

Definition at line 6 of file Resource.h.

#define IDS_PROJNAME 100

Definition at line 5 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Concurrency/SyncComp/STAObject/STAObject.Cpp File Reference

  • Com
  • Services
  • Concurrency
  • SyncComp
  • STAObject
Functions | Variables

STAObject.Cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include "STAObject.h"
#include "STAObject_i.c"
#include "STATest.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 61 of file STAObject.Cpp.

{
    return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 69 of file STAObject.Cpp.

{
    return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 46 of file STAObject.Cpp.

{
    if (dwReason == DLL_PROCESS_ATTACH)
    {
        _Module.Init(ObjectMap, hInstance, &LIBID_STAOBJECTLib);
        DisableThreadLibraryCalls(hInstance);
    }
    else if (dwReason == DLL_PROCESS_DETACH)
        _Module.Term();
    return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 77 of file STAObject.Cpp.

{
    // registers object, typelib and all interfaces in typelib
    return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 86 of file STAObject.Cpp.

{
    return _Module.UnregisterServer(TRUE);
}

Variable Documentation

CComModule _Module

Definition at line 36 of file STAObject.Cpp.

Generated on Wed Nov 13 2024 16:53:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Concurrency/SyncComp/STAObject/STAObject.Idl File Reference

  • Com
  • Services
  • Concurrency
  • SyncComp
  • STAObject
Functions | Variables

STAObject.Idl File Reference

Go to the source code of this file.

Functions

library STAOBJECTLib | importlib ("stdole32.tlb")
importlib ("stdole2.tlb")

Variables

import oaidl | idl

Function Documentation

library STAOBJECTLib importlib ( "stdole32.tlb" )
importlib ( "stdole2.tlb" )

Variable Documentation

import ocidl idl

Definition at line 7 of file STAObject.Idl.

Generated on Wed Nov 13 2024 16:53:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Concurrency/SyncComp/STAObject/STATest.Cpp File Reference

  • Com
  • Services
  • Concurrency
  • SyncComp
  • STAObject
Defines

STATest.Cpp File Reference

#include "stdafx.h"
#include "STAObject.h"
#include "STATest.h"

Go to the source code of this file.

Defines

#define LOOPCOUNT 10000

Define Documentation

#define LOOPCOUNT 10000

Definition at line 25 of file STATest.Cpp.

Generated on Wed Nov 13 2024 16:53:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Concurrency/SyncComp/STAObject/STATest.h File Reference

  • Com
  • Services
  • Concurrency
  • SyncComp
  • STAObject
Classes

STATest.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class CSTATest
Generated on Wed Nov 13 2024 16:53:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Concurrency/SyncComp/STAObject/StdAfx.Cpp File Reference

  • Com
  • Services
  • Concurrency
  • SyncComp
  • STAObject

StdAfx.Cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Concurrency/SyncComp/STAObject/StdAfx.h File Reference

  • Com
  • Services
  • Concurrency
  • SyncComp
  • STAObject
Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0500
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 16 of file StdAfx.h.

#define _WIN32_WINNT 0x0500

Definition at line 14 of file StdAfx.h.

#define STRICT

Definition at line 12 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Crm/CrmDebug/CrmDebug.Cpp File Reference

  • Com
  • Services
  • Crm
  • CrmDebug
Functions | Variables

CrmDebug.Cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include "initguid.h"
#include "CrmDebug.h"
#include "dlldatax.h"
#include "CrmDebug_i.c"
#include "CrmDebugCompensator.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 100 of file CrmDebug.Cpp.

{
#ifdef _MERGE_PROXYSTUB
  if (PrxDllCanUnloadNow() != S_OK)
    return S_FALSE;
#endif
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 112 of file CrmDebug.Cpp.

{
#ifdef _MERGE_PROXYSTUB
  if (PrxDllGetClassObject(rclsid, riid, ppv) == S_OK)
    return S_OK;
#endif
  return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID | lpReserved
 | ) |  |

Definition at line 80 of file CrmDebug.Cpp.

{
  lpReserved;
#ifdef _MERGE_PROXYSTUB
  if (!PrxDllMain(hInstance, dwReason, lpReserved))
    return FALSE;
#endif
  if (dwReason == DLL_PROCESS_ATTACH)
  {
    _Module.Init(ObjectMap, hInstance);
    DisableThreadLibraryCalls(hInstance);
  }
  else if (dwReason == DLL_PROCESS_DETACH)
    _Module.Term();
  return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 124 of file CrmDebug.Cpp.

{
#ifdef _MERGE_PROXYSTUB
  HRESULT hRes = PrxDllRegisterServer();
  if (FAILED(hRes))
    return hRes;
#endif
  // registers object, typelib and all interfaces in typelib
  return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 138 of file CrmDebug.Cpp.

{
#ifdef _MERGE_PROXYSTUB
  PrxDllUnregisterServer();
#endif
  _Module.UnregisterServer();
  return S_OK;
}

Variable Documentation

CComModule _Module

Definition at line 70 of file CrmDebug.Cpp.

Generated on Wed Nov 13 2024 16:53:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Crm/CrmDebug/CrmDebug.Idl File Reference

  • Com
  • Services
  • Crm
  • CrmDebug
Functions | Variables

CrmDebug.Idl File Reference

Go to the source code of this file.

Functions

library CRMDEBUGLib | importlib ("stdole32.tlb")
importlib ("stdole2.tlb")

Variables

import oaidl | idl

Function Documentation

library CRMDEBUGLib importlib ( "stdole32.tlb" )
importlib ( "stdole2.tlb" )

Variable Documentation

import ocidl idl

Definition at line 40 of file CrmDebug.Idl.

Generated on Wed Nov 13 2024 16:53:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Crm/CrmDebug/CrmDebugCompensator.Cpp File Reference

  • Com
  • Services
  • Crm
  • CrmDebug

CrmDebugCompensator.Cpp File Reference

#include "stdafx.h"
#include "CrmDebug.h"
#include "CrmDebugCompensator.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Crm/CrmDebug/CrmDebugCompensator.h File Reference

  • Com
  • Services
  • Crm
  • CrmDebug
Classes

CrmDebugCompensator.h File Reference

#include "resource.h"
#include "comsvcs.h"

Go to the source code of this file.

Classes

class CCrmDebugCompensator
Generated on Wed Nov 13 2024 16:53:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Crm/CrmDebug/DllDatax.c File Reference

  • Com
  • Services
  • Crm
  • CrmDebug

DllDatax.c File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Crm/CrmDebug/DllDatax.h File Reference

  • Com
  • Services
  • Crm
  • CrmDebug

DllDatax.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Crm/CrmDebug/Resource.h File Reference

  • Com
  • Services
  • Crm
  • CrmDebug
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_CRMDEBUGCOMPENSATOR 101
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_CRMDEBUGCOMPENSATOR 101

Definition at line 6 of file Resource.h.

#define IDS_PROJNAME 100

Definition at line 5 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Crm/CrmDebug/StdAfx.Cpp File Reference

  • Com
  • Services
  • Crm
  • CrmDebug

StdAfx.Cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Crm/CrmDebug/StdAfx.h File Reference

  • Com
  • Services
  • Crm
  • CrmDebug
Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0500
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 19 of file StdAfx.h.

#define _WIN32_WINNT 0x0500

Definition at line 16 of file StdAfx.h.

#define STRICT

Definition at line 12 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Crm/CrmFiles/CrmFiles.Cpp File Reference

  • Com
  • Services
  • Crm
  • CrmFiles
Functions | Variables

CrmFiles.Cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include "initguid.h"
#include "CrmFiles.h"
#include "dlldatax.h"
#include "CrmFiles_i.c"
#include "CrmFilesWorker.h"
#include "CrmFilesCompensator.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 103 of file CrmFiles.Cpp.

{
#ifdef _MERGE_PROXYSTUB
  if (PrxDllCanUnloadNow() != S_OK)
    return S_FALSE;
#endif
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 115 of file CrmFiles.Cpp.

{
#ifdef _MERGE_PROXYSTUB
  if (PrxDllGetClassObject(rclsid, riid, ppv) == S_OK)
    return S_OK;
#endif
  return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID | lpReserved
 | ) |  |

Definition at line 83 of file CrmFiles.Cpp.

{
  lpReserved;
#ifdef _MERGE_PROXYSTUB
  if (!PrxDllMain(hInstance, dwReason, lpReserved))
    return FALSE;
#endif
  if (dwReason == DLL_PROCESS_ATTACH)
  {
    _Module.Init(ObjectMap, hInstance);
    DisableThreadLibraryCalls(hInstance);
  }
  else if (dwReason == DLL_PROCESS_DETACH)
    _Module.Term();
  return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 127 of file CrmFiles.Cpp.

{
#ifdef _MERGE_PROXYSTUB
  HRESULT hRes = PrxDllRegisterServer();
  if (FAILED(hRes))
    return hRes;
#endif
  // registers object, typelib and all interfaces in typelib
  return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 141 of file CrmFiles.Cpp.

{
#ifdef _MERGE_PROXYSTUB
  PrxDllUnregisterServer();
#endif
  _Module.UnregisterServer();
  return S_OK;
}

Variable Documentation

CComModule _Module

Definition at line 72 of file CrmFiles.Cpp.

Generated on Wed Nov 13 2024 16:53:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Crm/CrmFiles/CrmFiles.Idl File Reference

  • Com
  • Services
  • Crm
  • CrmFiles
Functions

CrmFiles.Idl File Reference

#include "..\idl\ICrmFiles.idl"

Go to the source code of this file.

Functions

library CRMFILESLib importlib ("stdole32.tlb")
importlib ("stdole2.tlb")

Function Documentation

library CRMFILESLib importlib ( "stdole32.tlb" )
importlib ( "stdole2.tlb" )
Generated on Wed Nov 13 2024 16:53:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Crm/CrmFiles/CrmFilesCompensator.Cpp File Reference

  • Com
  • Services
  • Crm
  • CrmFiles

CrmFilesCompensator.Cpp File Reference

#include "stdafx.h"
#include "CrmFiles.h"
#include "CrmFilesCompensator.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Crm/CrmFiles/CrmFilesCompensator.h File Reference

  • Com
  • Services
  • Crm
  • CrmFiles
Classes

CrmFilesCompensator.h File Reference

#include "resource.h"
#include <comsvcs.h>
#include "comdef.h"
#include "CrmFilesWorker.h"

Go to the source code of this file.

Classes

class CCrmFilesCompensator
Generated on Wed Nov 13 2024 16:53:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Crm/CrmFiles/CrmFilesWorker.Cpp File Reference

  • Com
  • Services
  • Crm
  • CrmFiles

CrmFilesWorker.Cpp File Reference

#include "stdafx.h"
#include "CrmFiles.h"
#include "CrmFilesWorker.h"
#include <time.h>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Crm/CrmFiles/CrmFilesWorker.h File Reference

  • Com
  • Services
  • Crm
  • CrmFiles
Classes | Typedefs | Enumerations

CrmFilesWorker.h File Reference

#include "resource.h"
#include <comsvcs.h>

Go to the source code of this file.

Classes

class | CCrmFilesWorker
struct | tagCrmFilesCreateFileLogRecord
struct | tagCrmFilesDeleteFileLogRecord

Typedefs

typedef struct
tagCrmFilesCreateFileLogRecord 		CrmFilesCreateFileLogRecord
typedef struct
tagCrmFilesDeleteFileLogRecord 		CrmFilesDeleteFileLogRecord

Enumerations

enum | CrmFilesCommandType { ct_DeleteFile, ct_CreateFile }

Typedef Documentation

typedef struct tagCrmFilesCreateFileLogRecord CrmFilesCreateFileLogRecord
typedef struct tagCrmFilesDeleteFileLogRecord CrmFilesDeleteFileLogRecord

Enumeration Type Documentation

enum CrmFilesCommandType
Enumerator:
ct_DeleteFile
ct_CreateFile

Definition at line 66 of file CrmFilesWorker.h.

{ ct_DeleteFile, ct_CreateFile } CrmFilesCommandType;

Generated on Wed Nov 13 2024 16:53:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Crm/CrmFiles/DllDatax.c File Reference

  • Com
  • Services
  • Crm
  • CrmFiles

DllDatax.c File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Crm/CrmFiles/DllDatax.h File Reference

  • Com
  • Services
  • Crm
  • CrmFiles

DllDatax.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Crm/CrmFiles/Resource.h File Reference

  • Com
  • Services
  • Crm
  • CrmFiles
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_CRMFILESCOMPENSATOR 102
#define | IDR_CRMFILESWORKER 101
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_CRMFILESCOMPENSATOR 102

Definition at line 7 of file Resource.h.

#define IDR_CRMFILESWORKER 101

Definition at line 6 of file Resource.h.

#define IDS_PROJNAME 100

Definition at line 5 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Crm/CrmFiles/StdAfx.Cpp File Reference

  • Com
  • Services
  • Crm
  • CrmFiles

StdAfx.Cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Crm/CrmFiles/StdAfx.h File Reference

  • Com
  • Services
  • Crm
  • CrmFiles
Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0500
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 19 of file StdAfx.h.

#define _WIN32_WINNT 0x0500

Definition at line 16 of file StdAfx.h.

#define STRICT

Definition at line 12 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Crm/CrmFilesTest/CrmFilesTest.Cpp File Reference

  • Com
  • Services
  • Crm
  • CrmFilesTest
Functions | Variables

CrmFilesTest.Cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include "initguid.h"
#include "CrmFilesTest.h"
#include "dlldatax.h"
#include "CrmFilesTest_i.c"
#include "CrmFilesTestObj.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 100 of file CrmFilesTest.Cpp.

{
#ifdef _MERGE_PROXYSTUB
  if (PrxDllCanUnloadNow() != S_OK)
    return S_FALSE;
#endif
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 112 of file CrmFilesTest.Cpp.

{
#ifdef _MERGE_PROXYSTUB
  if (PrxDllGetClassObject(rclsid, riid, ppv) == S_OK)
    return S_OK;
#endif
  return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID | lpReserved
 | ) |  |

Definition at line 80 of file CrmFilesTest.Cpp.

{
  lpReserved;
#ifdef _MERGE_PROXYSTUB
  if (!PrxDllMain(hInstance, dwReason, lpReserved))
    return FALSE;
#endif
  if (dwReason == DLL_PROCESS_ATTACH)
  {
    _Module.Init(ObjectMap, hInstance);
    DisableThreadLibraryCalls(hInstance);
  }
  else if (dwReason == DLL_PROCESS_DETACH)
    _Module.Term();
  return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 124 of file CrmFilesTest.Cpp.

{
#ifdef _MERGE_PROXYSTUB
  HRESULT hRes = PrxDllRegisterServer();
  if (FAILED(hRes))
    return hRes;
#endif
  // registers object, typelib and all interfaces in typelib
  return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 138 of file CrmFilesTest.Cpp.

{
#ifdef _MERGE_PROXYSTUB
  PrxDllUnregisterServer();
#endif
  _Module.UnregisterServer();
  return S_OK;
}

Variable Documentation

CComModule _Module

Definition at line 70 of file CrmFilesTest.Cpp.

Generated on Wed Nov 13 2024 16:53:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Crm/CrmFilesTest/CrmFilesTest.Idl File Reference

  • Com
  • Services
  • Crm
  • CrmFilesTest
Functions | Variables

CrmFilesTest.Idl File Reference

#include "mtxattr.h"

Go to the source code of this file.

Functions

HRESULT | Abort ()
HRESULT | Commit ()
HRESULT | CreateFile ()
HRESULT | DeleteFile ()
interface | helpstring ("property FileName")] HRESULT FileName([in] BSTR new Val)
interface | id (1)
library CRMFILESTESTLib | importlib ("stdole32.tlb")
importlib ("stdole2.tlb")
HRESULT | Language ([in] long newVal)

Variables

import oaidl | idl

Function Documentation

HRESULT Abort ( )
HRESULT Commit ( )
HRESULT CreateFile ( )
HRESULT DeleteFile ( )
interface helpstring ( "property FileName" ) [new]
interface id ( 1 )
library CRMFILESTESTLib importlib ( "stdole32.tlb" )
importlib ( "stdole2.tlb" )
HRESULT Language ( [in] long newVal ) [set]

Variable Documentation

import ocidl idl

Definition at line 39 of file CrmFilesTest.Idl.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Crm/CrmFilesTest/CrmFilesTestObj.Cpp File Reference

  • Com
  • Services
  • Crm
  • CrmFilesTest

CrmFilesTestObj.Cpp File Reference

#include "stdafx.h"
#include "CrmFilesTest.h"
#include "CrmFilesTestObj.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Crm/CrmFilesTest/CrmFilesTestObj.h File Reference

  • Com
  • Services
  • Crm
  • CrmFilesTest
Classes

CrmFilesTestObj.h File Reference

#include "resource.h"
#include <comsvcs.h>
#include "comdef.h"
#include "CrmFiles.h"

Go to the source code of this file.

Classes

class CCrmFilesTest
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Crm/CrmFilesTest/DllDatax.c File Reference

  • Com
  • Services
  • Crm
  • CrmFilesTest

DllDatax.c File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Crm/CrmFilesTest/DllDatax.h File Reference

  • Com
  • Services
  • Crm
  • CrmFilesTest

DllDatax.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Crm/CrmFilesTest/Resource.h File Reference

  • Com
  • Services
  • Crm
  • CrmFilesTest
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_CRMFILESTEST 101
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_CRMFILESTEST 101

Definition at line 6 of file Resource.h.

#define IDS_PROJNAME 100

Definition at line 5 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Crm/CrmFilesTest/StdAfx.Cpp File Reference

  • Com
  • Services
  • Crm
  • CrmFilesTest

StdAfx.Cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Crm/CrmFilesTest/StdAfx.h File Reference

  • Com
  • Services
  • Crm
  • CrmFilesTest
Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0500
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 19 of file StdAfx.h.

#define _WIN32_WINNT 0x0500

Definition at line 16 of file StdAfx.h.

#define STRICT

Definition at line 12 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Crm/CrmMonitor/CrmMonComp.Cpp File Reference

  • Com
  • Services
  • Crm
  • CrmMonitor
Functions | Variables

CrmMonComp.Cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include "initguid.h"
#include "CrmMonComp.h"
#include "dlldatax.h"
#include "CrmMonComp_i.c"
#include "CrmMonCompObj.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 99 of file CrmMonComp.Cpp.

{
#ifdef _MERGE_PROXYSTUB
  if (PrxDllCanUnloadNow() != S_OK)
    return S_FALSE;
#endif
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 111 of file CrmMonComp.Cpp.

{
#ifdef _MERGE_PROXYSTUB
  if (PrxDllGetClassObject(rclsid, riid, ppv) == S_OK)
    return S_OK;
#endif
  return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID | lpReserved
 | ) |  |

Definition at line 79 of file CrmMonComp.Cpp.

{
  lpReserved;
#ifdef _MERGE_PROXYSTUB
  if (!PrxDllMain(hInstance, dwReason, lpReserved))
    return FALSE;
#endif
  if (dwReason == DLL_PROCESS_ATTACH)
  {
    _Module.Init(ObjectMap, hInstance);
    DisableThreadLibraryCalls(hInstance);
  }
  else if (dwReason == DLL_PROCESS_DETACH)
    _Module.Term();
  return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 123 of file CrmMonComp.Cpp.

{
#ifdef _MERGE_PROXYSTUB
  HRESULT hRes = PrxDllRegisterServer();
  if (FAILED(hRes))
    return hRes;
#endif
  // registers object, typelib and all interfaces in typelib
  return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 137 of file CrmMonComp.Cpp.

{
#ifdef _MERGE_PROXYSTUB
  PrxDllUnregisterServer();
#endif
  _Module.UnregisterServer();
  return S_OK;
}

Variable Documentation

CComModule _Module

Definition at line 69 of file CrmMonComp.Cpp.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Crm/CrmMonitor/CrmMonComp.Idl File Reference

  • Com
  • Services
  • Crm
  • CrmMonitor
Functions | Variables

CrmMonComp.Idl File Reference

Go to the source code of this file.

Functions

HRESULT | AbortTransaction ()
HRESULT | ActivityId ([out, retval] VARIANT *pVal)
HRESULT | ColumnHeaders ([out, retval] VARIANT *pVal)
HRESULT | Description ([out, retval] VARIANT *pVal)
HRESULT | FindClerks ([out, retval] long *plNumberOfClerks)
HRESULT | FormattedRecord ([out, retval] VARIANT *pVal)
interface | helpstring ("property TransactionUOW")] HRESULT TransactionUOW([in] VARIANT new Val)
library CRMMONCOMPLib | importlib ("stdole32.tlb")
importlib ("stdole2.tlb")
HRESULT | NumberOfLogRecords ([out, retval] long *pVal)
HRESULT | ProgId ([out, retval] VARIANT *pVal)
HRESULT | SetClerk ([in] long lClerkNumber)
HRESULT | SetRecord ([in] long lRecordNumber)
HRESULT | TransactionState ([out, retval] VARIANT *pVal)

Variables

import oaidl | idl

Function Documentation

HRESULT AbortTransaction ( )
HRESULT ActivityId ( [out, retval] VARIANT * pVal ) [get]
HRESULT ColumnHeaders ( [out, retval] VARIANT * pVal ) [get]
HRESULT Description ( [out, retval] VARIANT * pVal ) [get]
HRESULT FindClerks ( [out, retval] long * plNumberOfClerks ) [get]
HRESULT FormattedRecord ( [out, retval] VARIANT * pVal ) [get]
interface helpstring ( "property TransactionUOW" ) [new]
library CRMMONCOMPLib importlib ( "stdole32.tlb" )
importlib ( "stdole2.tlb" )
HRESULT NumberOfLogRecords ( [out, retval] long * pVal ) [get]
HRESULT ProgId ( [out, retval] VARIANT * pVal ) [get]
HRESULT SetClerk ( [in] long lClerkNumber )
HRESULT SetRecord ( [in] long lRecordNumber )
HRESULT TransactionState ( [out, retval] VARIANT * pVal ) [get]

Variable Documentation

import ocidl idl

Definition at line 40 of file CrmMonComp.Idl.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Crm/CrmMonitor/CrmMonCompObj.Cpp File Reference

  • Com
  • Services
  • Crm
  • CrmMonitor

CrmMonCompObj.Cpp File Reference

#include "stdafx.h"
#include "CrmMonComp.h"
#include "CrmMonCompObj.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Crm/CrmMonitor/CrmMonCompObj.h File Reference

  • Com
  • Services
  • Crm
  • CrmMonitor
Classes | Typedefs

CrmMonCompObj.h File Reference

#include "resource.h"
#include "comdef.h"
#include <comsvcs.h>
#include <vector>

Go to the source code of this file.

Classes

class | CCrmMonComp
struct | CLERK_ENTRY

Typedefs

typedef vector< CLERK_ENTRY * > | VEC_CLERKS

Typedef Documentation

typedef vector<CLERK_ENTRY *> VEC_CLERKS

Definition at line 75 of file CrmMonCompObj.h.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Crm/CrmMonitor/DllDatax.c File Reference

  • Com
  • Services
  • Crm
  • CrmMonitor

DllDatax.c File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Crm/CrmMonitor/DllDatax.h File Reference

  • Com
  • Services
  • Crm
  • CrmMonitor

DllDatax.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Crm/CrmMonitor/Resource.h File Reference

  • Com
  • Services
  • Crm
  • CrmMonitor
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_CRMMONCOMP 101
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_CRMMONCOMP 101

Definition at line 6 of file Resource.h.

#define IDS_PROJNAME 100

Definition at line 5 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Crm/CrmMonitor/StdAfx.Cpp File Reference

  • Com
  • Services
  • Crm
  • CrmMonitor

StdAfx.Cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Crm/CrmMonitor/StdAfx.h File Reference

  • Com
  • Services
  • Crm
  • CrmMonitor
Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0500
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 19 of file StdAfx.h.

#define _WIN32_WINNT 0x0500

Definition at line 16 of file StdAfx.h.

#define STRICT

Definition at line 12 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Crm/IDL/icrmFiles.Idl File Reference

  • Com
  • Services
  • Crm
  • IDL
Functions | Variables

icrmFiles.Idl File Reference

#include "mtxattr.h"

Go to the source code of this file.

Functions

HRESULT | DeleteFile ([in] BSTR bstrFileName)

Variables

import oaidl | idl

Function Documentation

HRESULT DeleteFile ( [in] BSTR bstrFileName )

Variable Documentation

import ocidl idl

Definition at line 38 of file icrmFiles.Idl.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNews/CascadeEC/cascade.Cpp File Reference

  • Com
  • Services
  • Events
  • EventNews
  • CascadeEC

cascade.Cpp File Reference

#include "stdafx.h"
#include "CascadeEC.h"
#include "Cascade.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNews/CascadeEC/cascade.h File Reference

  • Com
  • Services
  • Events
  • EventNews
  • CascadeEC
Classes

cascade.h File Reference

#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Classes

class CCascade
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNews/CascadeEC/cascadeec.Cpp File Reference

  • Com
  • Services
  • Events
  • EventNews
  • CascadeEC
Functions | Variables

cascadeec.Cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include "CascadeEC.h"
#include "CascadeEC_i.c"
#include "Cascade.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 42 of file cascadeec.Cpp.

{
    return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 50 of file cascadeec.Cpp.

{
    return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 27 of file cascadeec.Cpp.

{
    if (dwReason == DLL_PROCESS_ATTACH)
    {
        _Module.Init(ObjectMap, hInstance, &LIBID_CASCADEECLib);
        DisableThreadLibraryCalls(hInstance);
    }
    else if (dwReason == DLL_PROCESS_DETACH)
        _Module.Term();
    return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 58 of file cascadeec.Cpp.

{
    // registers object, typelib and all interfaces in typelib
    return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 67 of file cascadeec.Cpp.

{
    return _Module.UnregisterServer(TRUE);
}

Variable Documentation

CComModule _Module

Definition at line 17 of file cascadeec.Cpp.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNews/CascadeEC/cascadeec.Idl File Reference

  • Com
  • Services
  • Events
  • EventNews
  • CascadeEC
Functions | Variables

cascadeec.Idl File Reference

Go to the source code of this file.

Functions

library CASCADEECLib | importlib ("stdole32.tlb")
importlib ("stdole2.tlb")

Variables

import oaidl | idl

Function Documentation

library CASCADEECLib importlib ( "stdole32.tlb" )
importlib ( "stdole2.tlb" )

Variable Documentation

import include news idl

Definition at line 7 of file cascadeec.Idl.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNews/CascadeEC/resource.h File Reference

  • Com
  • Services
  • Events
  • EventNews
  • CascadeEC
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_CASCADE 101
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_CASCADE 101

Definition at line 6 of file resource.h.

#define IDS_PROJNAME 100

Definition at line 5 of file resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNews/CascadeEC/stdafx.Cpp File Reference

  • Com
  • Services
  • Events
  • EventNews
  • CascadeEC

stdafx.Cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNews/CascadeEC/stdafx.h File Reference

  • Com
  • Services
  • Events
  • EventNews
  • CascadeEC
Defines | Variables

stdafx.h File Reference

#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0500
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 16 of file stdafx.h.

#define _WIN32_WINNT 0x0500

Definition at line 14 of file stdafx.h.

#define STRICT

Definition at line 12 of file stdafx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNews/Include/news.Idl File Reference

  • Com
  • Services
  • Events
  • EventNews
  • Include
Functions | Variables

news.Idl File Reference

#include "mtxattr.h"

Go to the source code of this file.

Functions

interface | helpstring ("method NewsFlash")] HRESULT NewsFlash([in] DATE dtTimeStamp
HRESULT | LongQuote ([in] BSTR Symbol,[in] double BidPrice,[in] double AskPrice,[in] BSTR LastTradeTime,[in] double LastTradePrice,[in] double NetChange,[in] double DailyHigh,[in] double DailyLow,[in] long AskSize,[in] long BidSize,[in] double OpenPrice,[in] double ClosePrice,[in] BSTR CloseDate)
HRESULT | ShortQuote ([in] BSTR Symbol,[in] double BidPrice,[in] double AskPrice,[in] DATE LastTradeTime,[in] double LastTradePrice,[in] double NetChange,[in] double DailyHigh,[in] double DailyLow)

Variables

interface BSTR BSTR | Headline
import oaidl | idl
interface BSTR | Symbol
interface BSTR BSTR BSTR | URL

Function Documentation

interface helpstring ( "method NewsFlash" )
HRESULT LongQuote | ( | [in] BSTR | Symbol,
 |  | [in] double | BidPrice,
 |  | [in] double | AskPrice,
 |  | [in] BSTR | LastTradeTime,
 |  | [in] double | LastTradePrice,
 |  | [in] double | NetChange,
 |  | [in] double | DailyHigh,
 |  | [in] double | DailyLow,
 |  | [in] long | AskSize,
 |  | [in] long | BidSize,
 |  | [in] double | OpenPrice,
 |  | [in] double | ClosePrice,
 |  | [in] BSTR | CloseDate
 | ) |  |
HRESULT ShortQuote | ( | [in] BSTR | Symbol,
 |  | [in] double | BidPrice,
 |  | [in] double | AskPrice,
 |  | [in] DATE | LastTradeTime,
 |  | [in] double | LastTradePrice,
 |  | [in] double | NetChange,
 |  | [in] double | DailyHigh,
 |  | [in] double | DailyLow
 | ) |  |

Variable Documentation

interface BSTR BSTR Headline

Definition at line 19 of file news.Idl.

import eventsys idl

Definition at line 3 of file news.Idl.

interface BSTR Symbol

Definition at line 19 of file news.Idl.

interface BSTR BSTR BSTR URL

Definition at line 19 of file news.Idl.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNews/NewsEventClass/newsevent.Cpp File Reference

  • Com
  • Services
  • Events
  • EventNews
  • NewsEventClass

newsevent.Cpp File Reference

#include "stdafx.h"
#include "NewsEventClass.h"
#include "NewsEvent.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNews/NewsEventClass/newsevent.h File Reference

  • Com
  • Services
  • Events
  • EventNews
  • NewsEventClass
Classes

newsevent.h File Reference

#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Classes

class CNewsEvent
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNews/NewsEventClass/newseventclass.Cpp File Reference

  • Com
  • Services
  • Events
  • EventNews
  • NewsEventClass
Functions | Variables

newseventclass.Cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include "NewsEventClass.h"
#include "NewsEventClass_i.c"
#include "NewsEvent.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 42 of file newseventclass.Cpp.

{
    return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 50 of file newseventclass.Cpp.

{
    return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 27 of file newseventclass.Cpp.

{
    if (dwReason == DLL_PROCESS_ATTACH)
    {
        _Module.Init(ObjectMap, hInstance, &LIBID_NEWSEVENTCLASSLib);
        DisableThreadLibraryCalls(hInstance);
    }
    else if (dwReason == DLL_PROCESS_DETACH)
        _Module.Term();
    return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 58 of file newseventclass.Cpp.

{
    // registers object, typelib and all interfaces in typelib
    return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 67 of file newseventclass.Cpp.

{
    return _Module.UnregisterServer(TRUE);
}

Variable Documentation

CComModule _Module

Definition at line 17 of file newseventclass.Cpp.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNews/NewsEventClass/newseventclass.Idl File Reference

  • Com
  • Services
  • Events
  • EventNews
  • NewsEventClass
Functions | Variables

newseventclass.Idl File Reference

Go to the source code of this file.

Functions

library NEWSEVENTCLASSLib | importlib ("stdole32.tlb")
importlib ("stdole2.tlb")

Variables

import oaidl | idl

Function Documentation

library NEWSEVENTCLASSLib importlib ( "stdole32.tlb" )
importlib ( "stdole2.tlb" )

Variable Documentation

import include News idl

Definition at line 7 of file newseventclass.Idl.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNews/NewsEventClass/resource.h File Reference

  • Com
  • Services
  • Events
  • EventNews
  • NewsEventClass
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_NEWSEVENT 101
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_NEWSEVENT 101

Definition at line 6 of file resource.h.

#define IDS_PROJNAME 100

Definition at line 5 of file resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNews/NewsEventClass/stdafx.Cpp File Reference

  • Com
  • Services
  • Events
  • EventNews
  • NewsEventClass

stdafx.Cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNews/NewsEventClass/stdafx.h File Reference

  • Com
  • Services
  • Events
  • EventNews
  • NewsEventClass
Defines | Variables

stdafx.h File Reference

#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0400
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 16 of file stdafx.h.

#define _WIN32_WINNT 0x0400

Definition at line 14 of file stdafx.h.

#define STRICT

Definition at line 12 of file stdafx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNews/PersistATL/newsevent.Cpp File Reference

  • Com
  • Services
  • Events
  • EventNews
  • PersistATL

newsevent.Cpp File Reference

#include "stdafx.h"
#include "PersistATL.h"
#include "NewsEvent.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNews/PersistATL/newsevent.h File Reference

  • Com
  • Services
  • Events
  • EventNews
  • PersistATL
Classes

newsevent.h File Reference

#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Classes

class CNewsEvent
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNews/PersistATL/persistatl.Cpp File Reference

  • Com
  • Services
  • Events
  • EventNews
  • PersistATL
Functions | Variables

persistatl.Cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include "PersistATL.h"
#include "PersistATL_i.c"
#include "NewsEvent.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 42 of file persistatl.Cpp.

{
    return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 50 of file persistatl.Cpp.

{
    return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 27 of file persistatl.Cpp.

{
    if (dwReason == DLL_PROCESS_ATTACH)
    {
        _Module.Init(ObjectMap, hInstance, &LIBID_PERSISTATLLib);
        DisableThreadLibraryCalls(hInstance);
    }
    else if (dwReason == DLL_PROCESS_DETACH)
        _Module.Term();
    return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 58 of file persistatl.Cpp.

{
    // registers object, typelib and all interfaces in typelib
    return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 67 of file persistatl.Cpp.

{
    return _Module.UnregisterServer(TRUE);
}

Variable Documentation

CComModule _Module

Definition at line 17 of file persistatl.Cpp.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNews/PersistATL/persistatl.Idl File Reference

  • Com
  • Services
  • Events
  • EventNews
  • PersistATL
Functions | Variables

persistatl.Idl File Reference

Go to the source code of this file.

Functions

library PERSISTATLLib | importlib ("stdole32.tlb")
importlib ("stdole2.tlb")

Variables

import oaidl | idl

Function Documentation

library PERSISTATLLib importlib ( "stdole32.tlb" )
importlib ( "stdole2.tlb" )

Variable Documentation

import include news idl

Definition at line 7 of file persistatl.Idl.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNews/PersistATL/resource.h File Reference

  • Com
  • Services
  • Events
  • EventNews
  • PersistATL
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_NEWSEVENT 101
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_NEWSEVENT 101

Definition at line 6 of file resource.h.

#define IDS_PROJNAME 100

Definition at line 5 of file resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNews/PersistATL/stdafx.Cpp File Reference

  • Com
  • Services
  • Events
  • EventNews
  • PersistATL

stdafx.Cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNews/PersistATL/stdafx.h File Reference

  • Com
  • Services
  • Events
  • EventNews
  • PersistATL
Defines | Variables

stdafx.h File Reference

#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0500
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 16 of file stdafx.h.

#define _WIN32_WINNT 0x0500

Definition at line 14 of file stdafx.h.

#define STRICT

Definition at line 12 of file stdafx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNewsJAVA/CascadeEvent/Cascadeec/CascadeEC.java File Reference

  • Com
  • Services
  • Events
  • EventNewsJAVA
  • CascadeEvent
  • Cascadeec
Classes | Namespaces

CascadeEC.java File Reference

Go to the source code of this file.

Classes

class | cascadeec::CascadeEC
.register(clsid=8CE4A9E0-0FC1-11D3-925A-0080C7C30D72, typelib=7508F170-0FC1-11D3-925A-0080C7C30D72, version="1.0", description="Cascade Class") More...

Namespaces

namespace | cascadeec
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNewsJAVA/CascadeEvent/Cascadeec/INewsEvent.java File Reference

  • Com
  • Services
  • Events
  • EventNewsJAVA
  • CascadeEvent
  • Cascadeec
Classes | Namespaces

INewsEvent.java File Reference

Go to the source code of this file.

Classes

interface | cascadeec::INewsEvent
.interface(iid=4BF5E480-A5D3-11D2-AD4D-0080C7BFF6DB, thread=AUTO, type=DUAL) More...

Namespaces

namespace | cascadeec
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNewsJAVA/CascadeEvent/Cascadeec/INewsEventDefault.java File Reference

  • Com
  • Services
  • Events
  • EventNewsJAVA
  • CascadeEvent
  • Cascadeec
Classes | Namespaces

INewsEventDefault.java File Reference

Go to the source code of this file.

Classes

interface | cascadeec::INewsEventDefault
.interface(iid=00020400-0000-0000-C000-000000000046, thread=AUTO, type=DUAL) More...

Namespaces

namespace | cascadeec
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminAccessChecksLevelOptions.java File Reference

  • Com
  • Services
  • Events
  • EventNewsJAVA
  • ComAdmin
Classes | Namespaces

COMAdminAccessChecksLevelOptions.java File Reference

Go to the source code of this file.

Classes

interface | comadmin::COMAdminAccessChecksLevelOptions

Namespaces

namespace | comadmin
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminActivationOptions.java File Reference

  • Com
  • Services
  • Events
  • EventNewsJAVA
  • ComAdmin
Classes | Namespaces

COMAdminActivationOptions.java File Reference

Go to the source code of this file.

Classes

interface | comadmin::COMAdminActivationOptions

Namespaces

namespace | comadmin
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminApplicationExportOptions.java File Reference

  • Com
  • Services
  • Events
  • EventNewsJAVA
  • ComAdmin
Classes | Namespaces

COMAdminApplicationExportOptions.java File Reference

Go to the source code of this file.

Classes

interface | comadmin::COMAdminApplicationExportOptions

Namespaces

namespace | comadmin
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminApplicationInstallOptions.java File Reference

  • Com
  • Services
  • Events
  • EventNewsJAVA
  • ComAdmin
Classes | Namespaces

COMAdminApplicationInstallOptions.java File Reference

Go to the source code of this file.

Classes

interface | comadmin::COMAdminApplicationInstallOptions

Namespaces

namespace | comadmin
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminAuthenticationCapabilitiesOptions.java File Reference

  • Com
  • Services
  • Events
  • EventNewsJAVA
  • ComAdmin
Classes | Namespaces

COMAdminAuthenticationCapabilitiesOptions.java File Reference

Go to the source code of this file.

Classes

interface | comadmin::COMAdminAuthenticationCapabilitiesOptions

Namespaces

namespace | comadmin
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminAuthenticationLevelOptions.java File Reference

  • Com
  • Services
  • Events
  • EventNewsJAVA
  • ComAdmin
Classes | Namespaces

COMAdminAuthenticationLevelOptions.java File Reference

Go to the source code of this file.

Classes

interface | comadmin::COMAdminAuthenticationLevelOptions

Namespaces

namespace | comadmin
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminCatalog.java File Reference

  • Com
  • Services
  • Events
  • EventNewsJAVA
  • ComAdmin
Classes | Namespaces

COMAdminCatalog.java File Reference

Go to the source code of this file.

Classes

class | comadmin::COMAdminCatalog
.class(classid=F618C514-DFB8-11D1-A2CF-00805FC79235,DynamicCasts) .interface(iid=DD662187-DFC2-11D1-A2CF-00805FC79235, thread=AUTO, type=DUAL) More...

Namespaces

namespace | comadmin
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminCatalogCollection.java File Reference

  • Com
  • Services
  • Events
  • EventNewsJAVA
  • ComAdmin
Classes | Namespaces

COMAdminCatalogCollection.java File Reference

Go to the source code of this file.

Classes

class | comadmin::COMAdminCatalogCollection
.class(classid=F618C516-DFB8-11D1-A2CF-00805FC79235,DynamicCasts) .interface(iid=6EB22872-8A19-11D0-81B6-00A0C9231C29, thread=AUTO, type=DUAL) More...

Namespaces

namespace | comadmin
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminCatalogObject.java File Reference

  • Com
  • Services
  • Events
  • EventNewsJAVA
  • ComAdmin
Classes | Namespaces

COMAdminCatalogObject.java File Reference

Go to the source code of this file.

Classes

class | comadmin::COMAdminCatalogObject
.class(classid=F618C515-DFB8-11D1-A2CF-00805FC79235,DynamicCasts) .interface(iid=6EB22871-8A19-11D0-81B6-00A0C9231C29, thread=AUTO, type=DUAL) More...

Namespaces

namespace | comadmin
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminComponentFlags.java File Reference

  • Com
  • Services
  • Events
  • EventNewsJAVA
  • ComAdmin
Classes | Namespaces

COMAdminComponentFlags.java File Reference

Go to the source code of this file.

Classes

interface | comadmin::COMAdminComponentFlags

Namespaces

namespace | comadmin
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminErrorCodes.java File Reference

  • Com
  • Services
  • Events
  • EventNewsJAVA
  • ComAdmin
Classes | Namespaces

COMAdminErrorCodes.java File Reference

Go to the source code of this file.

Classes

interface | comadmin::COMAdminErrorCodes

Namespaces

namespace | comadmin
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminFileFlags.java File Reference

  • Com
  • Services
  • Events
  • EventNewsJAVA
  • ComAdmin
Classes | Namespaces

COMAdminFileFlags.java File Reference

Go to the source code of this file.

Classes

interface | comadmin::COMAdminFileFlags

Namespaces

namespace | comadmin
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminImpersonationLevelOptions.java File Reference

  • Com
  • Services
  • Events
  • EventNewsJAVA
  • ComAdmin
Classes | Namespaces

COMAdminImpersonationLevelOptions.java File Reference

Go to the source code of this file.

Classes

interface | comadmin::COMAdminImpersonationLevelOptions

Namespaces

namespace | comadmin
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminOS.java File Reference

  • Com
  • Services
  • Events
  • EventNewsJAVA
  • ComAdmin
Classes | Namespaces

COMAdminOS.java File Reference

Go to the source code of this file.

Classes

interface | comadmin::COMAdminOS

Namespaces

namespace | comadmin
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminServiceOptions.java File Reference

  • Com
  • Services
  • Events
  • EventNewsJAVA
  • ComAdmin
Classes | Namespaces

COMAdminServiceOptions.java File Reference

Go to the source code of this file.

Classes

interface | comadmin::COMAdminServiceOptions

Namespaces

namespace | comadmin
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminServiceStatusOptions.java File Reference

  • Com
  • Services
  • Events
  • EventNewsJAVA
  • ComAdmin
Classes | Namespaces

COMAdminServiceStatusOptions.java File Reference

Go to the source code of this file.

Classes

interface | comadmin::COMAdminServiceStatusOptions

Namespaces

namespace | comadmin
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminSynchronizationOptions.java File Reference

  • Com
  • Services
  • Events
  • EventNewsJAVA
  • ComAdmin
Classes | Namespaces

COMAdminSynchronizationOptions.java File Reference

Go to the source code of this file.

Classes

interface | comadmin::COMAdminSynchronizationOptions

Namespaces

namespace | comadmin
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminThreadingModels.java File Reference

  • Com
  • Services
  • Events
  • EventNewsJAVA
  • ComAdmin
Classes | Namespaces

COMAdminThreadingModels.java File Reference

Go to the source code of this file.

Classes

interface | comadmin::COMAdminThreadingModels

Namespaces

namespace | comadmin
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNewsJAVA/ComAdmin/COMAdminTransactionOptions.java File Reference

  • Com
  • Services
  • Events
  • EventNewsJAVA
  • ComAdmin
Classes | Namespaces

COMAdminTransactionOptions.java File Reference

Go to the source code of this file.

Classes

interface | comadmin::COMAdminTransactionOptions

Namespaces

namespace | comadmin
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNewsJAVA/ComAdmin/ICatalogCollection.java File Reference

  • Com
  • Services
  • Events
  • EventNewsJAVA
  • ComAdmin
Classes | Namespaces

ICatalogCollection.java File Reference

Go to the source code of this file.

Classes

interface | comadmin::ICatalogCollection
.interface(iid=6EB22872-8A19-11D0-81B6-00A0C9231C29, thread=AUTO, type=DUAL) More...

Namespaces

namespace | comadmin
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNewsJAVA/ComAdmin/ICatalogObject.java File Reference

  • Com
  • Services
  • Events
  • EventNewsJAVA
  • ComAdmin
Classes | Namespaces

ICatalogObject.java File Reference

Go to the source code of this file.

Classes

interface | comadmin::ICatalogObject
.interface(iid=6EB22871-8A19-11D0-81B6-00A0C9231C29, thread=AUTO, type=DUAL) More...

Namespaces

namespace | comadmin
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNewsJAVA/ComAdmin/ICOMAdminCatalog.java File Reference

  • Com
  • Services
  • Events
  • EventNewsJAVA
  • ComAdmin
Classes | Namespaces

ICOMAdminCatalog.java File Reference

Go to the source code of this file.

Classes

interface | comadmin::ICOMAdminCatalog
.interface(iid=DD662187-DFC2-11D1-A2CF-00805FC79235, thread=AUTO, type=DUAL) More...

Namespaces

namespace | comadmin
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNewsJAVA/NewsEvent/Helper/sampleConstants.java File Reference

  • Com
  • Services
  • Events
  • EventNewsJAVA
  • NewsEvent
  • Helper
Classes | Namespaces

sampleConstants.java File Reference

Go to the source code of this file.

Classes

interface | helper::sampleConstants

Namespaces

namespace | helper
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNewsJAVA/NewsEvent/newsEventClass/INewsEvent.java File Reference

  • Com
  • Services
  • Events
  • EventNewsJAVA
  • NewsEvent
  • newsEventClass
Classes | Namespaces

INewsEvent.java File Reference

Go to the source code of this file.

Classes

interface | newseventclass::INewsEvent
.interface(iid=4BF5E480-A5D3-11D2-AD4D-0080C7BFF6DB, thread=AUTO, type=DUAL) More...

Namespaces

namespace | newseventclass
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNewsJAVA/NewsEvent/newsEventClass/INewsEventDefault.java File Reference

  • Com
  • Services
  • Events
  • EventNewsJAVA
  • NewsEvent
  • newsEventClass
Classes | Namespaces

INewsEventDefault.java File Reference

Go to the source code of this file.

Classes

interface | newseventclass::INewsEventDefault
.interface(iid=00020400-0000-0000-C000-000000000046, thread=AUTO, type=DUAL) More...

Namespaces

namespace | newseventclass
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNewsJAVA/NewsEvent/newsEventClass/NewsEvent.java File Reference

  • Com
  • Services
  • Events
  • EventNewsJAVA
  • NewsEvent
  • newsEventClass
Classes | Namespaces

NewsEvent.java File Reference

Go to the source code of this file.

Classes

class | newseventclass::NewsEvent
.register(clsid=997FF9C0-0F01-11D3-9257-0080C7C30D72, typelib=94007C90-0F00-11D3-9257-0080C7C30D72, version="1.0", description="NewsEvent Class") More...

Namespaces

namespace | newseventclass
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNewsJAVA/NewsFlash/NewsFlash.java File Reference

  • Com
  • Services
  • Events
  • EventNewsJAVA
  • NewsFlash
Classes

NewsFlash.java File Reference

Go to the source code of this file.

Classes

class NewsFlash
This class can take a variable number of parameters on the command line. More...
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNewsJAVA/NewsSuscriber/NewsSubscriber.java File Reference

  • Com
  • Services
  • Events
  • EventNewsJAVA
  • NewsSuscriber
Classes

NewsSubscriber.java File Reference

Go to the source code of this file.

Classes

class NewsSubscriber
This class can take a variable number of parameters on the command line. More...
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNewsJAVA/PersistSubs/Persistatl/INewsEvent.java File Reference

  • Com
  • Services
  • Events
  • EventNewsJAVA
  • PersistSubs
  • Persistatl
Classes | Namespaces

INewsEvent.java File Reference

Go to the source code of this file.

Classes

interface | persistatl::INewsEvent
.interface(iid=4BF5E480-A5D3-11D2-AD4D-0080C7BFF6DB, thread=AUTO, type=DUAL) More...

Namespaces

namespace | persistatl
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNewsJAVA/PersistSubs/Persistatl/INewsEventDefault.java File Reference

  • Com
  • Services
  • Events
  • EventNewsJAVA
  • PersistSubs
  • Persistatl
Classes | Namespaces

INewsEventDefault.java File Reference

Go to the source code of this file.

Classes

interface | persistatl::INewsEventDefault
.interface(iid=00020400-0000-0000-C000-000000000046, thread=AUTO, type=DUAL) More...

Namespaces

namespace | persistatl
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/EventNewsJAVA/PersistSubs/Persistatl/NewsEvent.java File Reference

  • Com
  • Services
  • Events
  • EventNewsJAVA
  • PersistSubs
  • Persistatl
Classes | Namespaces

NewsEvent.java File Reference

Go to the source code of this file.

Classes

class | persistatl::NewsEvent
.register(clsid=6B834DA0-A5D3-11D2-AD4D-0080C7BFF6DB, typelib=04A47040-A5D3-11D2-AD4D-0080C7BFF6DB, version="1.0", description="NewsEvent Class") More...

Namespaces

namespace | persistatl
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/UserEvents/VCAcct/Account.cpp File Reference

  • Com
  • Services
  • Events
  • UserEvents
  • VCAcct
Defines | Functions | Variables

Account.cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include "initguid.h"
#include "Account.h"
#include "CAccount.h"
#include <comadmin.h>
#include "Account_i.c"

Go to the source code of this file.

Defines

#define | IID_DEFINED

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Define Documentation

#define IID_DEFINED

Definition at line 53 of file Account.cpp.

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 90 of file Account.cpp.

{
#ifdef _MERGE_PROXYSTUB
  if (PrxDllCanUnloadNow() != S_OK)
    return S_FALSE;
#endif
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 102 of file Account.cpp.

{
#ifdef _MERGE_PROXYSTUB
  if (PrxDllGetClassObject(rclsid, riid, ppv) == S_OK)
    return S_OK;
#endif
  return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID | lpReserved
 | ) |  |

Definition at line 70 of file Account.cpp.

{
  lpReserved;
#ifdef _MERGE_PROXYSTUB
  if (!PrxDllMain(hInstance, dwReason, lpReserved))
    return FALSE;
#endif
  if (dwReason == DLL_PROCESS_ATTACH)
  {
    _Module.Init(ObjectMap, hInstance);
    DisableThreadLibraryCalls(hInstance);
  }
  else if (dwReason == DLL_PROCESS_DETACH)
    _Module.Term();
  return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 114 of file Account.cpp.

{
#ifdef _MERGE_PROXYSTUB
  HRESULT hRes = PrxDllRegisterServer();
  if (FAILED(hRes))
    return hRes;
#endif
  // registers object, typelib and all interfaces in typelib
  return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 128 of file Account.cpp.

{
#ifdef _MERGE_PROXYSTUB
  PrxDllUnregisterServer();
#endif
  _Module.UnregisterServer();
  return S_OK;
}

Variable Documentation

CComModule _Module

Definition at line 60 of file Account.cpp.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/UserEvents/VCAcct/Account.idl File Reference

  • Com
  • Services
  • Events
  • UserEvents
  • VCAcct
Classes | Namespaces | Functions

Account.idl File Reference

#include <mtxattr.h>

Go to the source code of this file.

Classes

class | ACCOUNT::CAccount
interface | IAccount

Namespaces

namespace | ACCOUNT

Functions

ACCOUNT::importlib ("stdole2.tlb")
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/UserEvents/VCAcct/CAccount.cpp File Reference

  • Com
  • Services
  • Events
  • UserEvents
  • VCAcct

CAccount.cpp File Reference

#include "stdafx.h"
#include "Account.h"
#include "CAccount.h"
#include <stdio.h>
#include <comsvcs.h>
#include <adoid.h>
#include <adoint.h>
#include <comdef.h>
#include <string>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/UserEvents/VCAcct/CAccount.h File Reference

  • Com
  • Services
  • Events
  • UserEvents
  • VCAcct
Classes

CAccount.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class CAccount
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/UserEvents/VCAcct/Resource.h File Reference

  • Com
  • Services
  • Events
  • UserEvents
  • VCAcct
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_Account 1
#define | IDR_GetReceipt 117
#define | IDR_MoveMoney 2
#define | IDR_UpdateReceipt 115
#define | IDR_UpdateReceipt1 119
#define | IDS_ACCOUNT_DESC 1
#define | IDS_GETRECEIPT_DESC 116
#define | IDS_MOVEMONEY_DESC 2
#define | IDS_UPDATERECEIPT_DESC 114
#define | IDS_UPDATERECEIPT_DESC1 118

Define Documentation

#define IDR_Account 1

Definition at line 6 of file Resource.h.

#define IDR_GetReceipt 117

Definition at line 12 of file Resource.h.

#define IDR_MoveMoney 2

Definition at line 8 of file Resource.h.

#define IDR_UpdateReceipt 115

Definition at line 10 of file Resource.h.

#define IDR_UpdateReceipt1 119

Definition at line 14 of file Resource.h.

#define IDS_ACCOUNT_DESC 1

Definition at line 5 of file Resource.h.

#define IDS_GETRECEIPT_DESC 116

Definition at line 11 of file Resource.h.

#define IDS_MOVEMONEY_DESC 2

Definition at line 7 of file Resource.h.

#define IDS_UPDATERECEIPT_DESC 114

Definition at line 9 of file Resource.h.

#define IDS_UPDATERECEIPT_DESC1 118

Definition at line 13 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/UserEvents/VCAcct/StdAfx.cpp File Reference

  • Com
  • Services
  • Events
  • UserEvents
  • VCAcct

StdAfx.cpp File Reference

#include "stdafx.h"
#include <initguid.h>
#include <adoid.h>
#include <adoint.h>
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Events/UserEvents/VCAcct/StdAfx.h File Reference

  • Com
  • Services
  • Events
  • UserEvents
  • VCAcct
Defines | Functions | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Defines

#define | _ATL_STATIC_REGISTRY
#define | APP_ERROR 0x80004100
#define | RETHROW_ERR(exp) { if (FAILED(hr = (exp))) {lErrFlag = 2; throw hr;}}
#define | THROW_ERR(exp, str) {if (FAILED (hr = (exp))) {lErrFlag = 0; pErrMsg = _T(str); throw hr;}}
#define | THROW_STR(str) { hr = APP_ERROR; lErrFlag = 1; pErrMsg = str; throw hr;}

Functions

BSTR | TCHAR2BSTR (TCHAR *szBuf)

Variables

CComModule | _Module

Define Documentation

#define _ATL_STATIC_REGISTRY

Definition at line 24 of file StdAfx.h.

#define APP_ERROR 0x80004100

Definition at line 36 of file StdAfx.h.

#define RETHROW_ERR ( exp ) { if (FAILED(hr = (exp))) {lErrFlag = 2; throw hr;}}

Definition at line 34 of file StdAfx.h.

#define THROW_ERR | ( | exp,
 |  | str |
 | ) |  | {if (FAILED (hr = (exp))) {lErrFlag = 0; pErrMsg = _T(str); throw hr;}}

Definition at line 32 of file StdAfx.h.

#define THROW_STR ( str ) { hr = APP_ERROR; lErrFlag = 1; pErrMsg = str; throw hr;}

Definition at line 33 of file StdAfx.h.

Function Documentation

BSTR TCHAR2BSTR ( TCHAR * szBuf ) [inline]

Definition at line 39 of file StdAfx.h.

                                      {

  WCHAR* wszBuf;

#ifndef UNICODE
  wszBuf = new WCHAR [512];
  MultiByteToWideChar( CP_ACP, 0, szBuf, -1, wszBuf, 512 );
#else
  wszBuf = szBuf;
#endif

  BSTR bstrNew = ::SysAllocString (wszBuf);

#ifndef UNICODE
  delete [] wszBuf;
#endif

  return bstrNew;
}

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Object_Pooling/ObjectPoolingJAVA/ObjectPoolingComponent/Account/util/DatabaseSettings.java File Reference

  • Com
  • Services
  • Object_Pooling
  • ObjectPoolingJAVA
  • ObjectPoolingComponent
  • Account
  • util
Classes | Namespaces

DatabaseSettings.java File Reference

Go to the source code of this file.

Classes

interface | util::DatabaseSettings

Namespaces

namespace | util
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Object_Pooling/OPBankSample/Account.VC/Account.Cpp File Reference

  • Com
  • Services
  • Object_Pooling
  • OPBankSample
  • Account.VC
Defines | Functions | Variables

Account.Cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include "initguid.h"
#include "Account.h"
#include <comsvcs.h>
#include "CAccount.h"
#include "MvMoney.h"
#include "Account_i.c"
#include "GetRec.h"
#include "UpdRec.h"

Go to the source code of this file.

Defines

#define | IID_DEFINED

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Define Documentation

#define IID_DEFINED

Definition at line 30 of file Account.Cpp.

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 74 of file Account.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 83 of file Account.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID | lpReserved
 | ) |  |

Definition at line 50 of file Account.Cpp.

{
  lpReserved;
#ifdef _MERGE_PROXYSTUB
  if (!PrxDllMain(hInstance, dwReason, lpReserved))
    return FALSE;
#endif
  if (dwReason == DLL_PROCESS_ATTACH)
  {
    _Module.Init(ObjectMap, hInstance);
    DisableThreadLibraryCalls(hInstance);

  }
  else if (dwReason == DLL_PROCESS_DETACH)
    _Module.Term();
  return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 92 of file Account.Cpp.

{
  // registers object, typelib and all interfaces in typelib
  return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 102 of file Account.Cpp.

{
  _Module.UnregisterServer();
  return S_OK;
}

Variable Documentation

CComModule _Module

Definition at line 36 of file Account.Cpp.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Object_Pooling/OPBankSample/Account.VC/Account.Idl File Reference

  • Com
  • Services
  • Object_Pooling
  • OPBankSample
  • Account.VC
Functions | Variables

Account.Idl File Reference

#include <mtxattr.h>

Go to the source code of this file.

Functions

library ACCOUNT | importlib ("stdole2.tlb")
HRESULT | SetAccountClsctx ([in] long clsctx)

Variables

import oaidl | idl
interface long | lAmount
interface long | lSecondAccount
interface long long long | lTranType
interface long BSTR * | pbstrResult
interface retval long * | plReceiptNo

Function Documentation

library ACCOUNT importlib ( "stdole2.tlb" )
HRESULT SetAccountClsctx ( [in] long clsctx )

Variable Documentation

import oaidl idl

Definition at line 18 of file Account.Idl.

interface long long lAmount

Definition at line 32 of file Account.Idl.

interface long lSecondAccount

Definition at line 50 of file Account.Idl.

interface long long long lTranType

Definition at line 50 of file Account.Idl.

interface long long long BSTR * pbstrResult

Definition at line 32 of file Account.Idl.

interface retval long * plReceiptNo

Definition at line 69 of file Account.Idl.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Object_Pooling/OPBankSample/Account.VC/caccount.Cpp File Reference

  • Com
  • Services
  • Object_Pooling
  • OPBankSample
  • Account.VC
Functions

caccount.Cpp File Reference

#include "stdafx.h"
#include "Account.h"
#include <comsvcs.h>
#include "CAccount.h"
#include <stdio.h>
#include <transact.h>

Go to the source code of this file.

Functions

HRESULT | CheckAmount (IObjectContext *pObjectContext, long lAmount, BSTR *s)
HRESULT | GetConnection (WCHAR *sDSN, HENV *phenv, HDBC *phdbc, HSTMT *phstmt, BOOL bUseObjectPool)
void | GetODBCError (HENV henv, HDBC hdbc, HSTMT hstmt, BSTR *sErr)

Function Documentation

HRESULT CheckAmount | ( | IObjectContext * | pObjectContext,
 |  | long | lAmount,
 |  | BSTR * | s
 | ) |  |

Definition at line 257 of file caccount.Cpp.

{

  if (!pObjectContext)
  {
    *s = ::SysAllocString(L"No Context");
    return E_FAIL;
  }
  // Check security for large transfers
  if (lAmount > 500 || lAmount < -500)
  {
    BOOL bInRole;
    BSTR bstrRole;

    bstrRole = ::SysAllocString(L"Managers");
    HRESULT hr;
    hr = pObjectContext->IsCallerInRole (bstrRole, &bInRole);
    ::SysFreeString(bstrRole);

    if (FAILED( hr ))
    {
      *s = ::SysAllocString(L"IsCallerInRole() call failed!  Please add the 'Managers' Roll to the package.");
      return hr;
    }

    if (!bInRole)
    {
      *s = ::SysAllocString(L"Need 'Managers' role for amounts over $500");
      return  E_FAIL;
    }
  }
  return S_OK;
}

HRESULT GetConnection | ( | WCHAR * | sDSN,
 |  | HENV * | phenv,
 |  | HDBC * | phdbc,
 |  | HSTMT * | phstmt,
 |  | BOOL | bUseObjectPool
 | ) |  |

Definition at line 64 of file caccount.Cpp.

{

  RETCODE rc;
  HRESULT hr= S_OK;

  rc = SQLAllocEnv(phenv);
  ASSERT_SQL_SUCCESS(rc);
  if (bUseObjectPool)
  {
    rc = SQLSetEnvAttr(*phenv, SQL_ATTR_CONNECTION_POOLING, (void*)SQL_CP_OFF, 0);
    ASSERT_SQL_SUCCESS(rc);
  }
  rc = SQLAllocConnect(*phenv, phdbc);
  if (SQL_FAILED(rc))
    return E_FAIL;
  WCHAR szConn[255];
  WORD nSize = 255;
  rc = SQLDriverConnect(*phdbc, NULL, (SQLWCHAR *)sDsn, SQL_NTS, (SQLWCHAR *)szConn, 255, (short *)&nSize, (UWORD)SQL_DRIVER_NOPROMPT);
  if (SQL_FAILED(rc))
  {
    SQLFreeEnv(*phenv);
    return E_FAIL;
  }
  rc = SQLAllocStmt(*phdbc, phstmt); // generic stmt
  if (SQL_FAILED(rc))
  {
    SQLFreeConnect(*phdbc);
    SQLFreeEnv(*phenv);

    return E_FAIL;
  }

  return S_OK;

}

void GetODBCError | ( | HENV | henv,
 |  | HDBC | hdbc,
 |  | HSTMT | hstmt,
 |  | BSTR * | sErr
 | ) |  |

Definition at line 42 of file caccount.Cpp.

{
  WCHAR szSqlState[64];
  SDWORD NativeError;
  WCHAR szErr[512];
  SWORD cbErrorMsg;
  SQLError(henv, hdbc, hstmt, (SQLWCHAR *)szSqlState, &NativeError, (SQLWCHAR *)szErr, 511, &cbErrorMsg);
  *sErr = ::SysAllocString(szErr);
}

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Object_Pooling/OPBankSample/Account.VC/caccount.h File Reference

  • Com
  • Services
  • Object_Pooling
  • OPBankSample
  • Account.VC
Classes

caccount.h File Reference

#include "resource.h"
#include <comsvcs.h>

Go to the source code of this file.

Classes

class CAccount
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Object_Pooling/OPBankSample/Account.VC/getrec.Cpp File Reference

  • Com
  • Services
  • Object_Pooling
  • OPBankSample
  • Account.VC

getrec.Cpp File Reference

#include "stdafx.h"
#include "Account.h"
#include <comsvcs.h>
#include "GetRec.h"
#include "UpdRec.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Object_Pooling/OPBankSample/Account.VC/getrec.h File Reference

  • Com
  • Services
  • Object_Pooling
  • OPBankSample
  • Account.VC
Classes

getrec.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class CGetReceipt
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Object_Pooling/OPBankSample/Account.VC/mvmoney.Cpp File Reference

  • Com
  • Services
  • Object_Pooling
  • OPBankSample
  • Account.VC
Functions

mvmoney.Cpp File Reference

#include "stdafx.h"
#include "Account.h"
#include "MvMoney.h"
#include "GetRec.h"
#include <comsvcs.h>

Go to the source code of this file.

Functions

HRESULT CheckAmount (IObjectContext *pObjectContext, long lAmount, BSTR *s)

Function Documentation

HRESULT CheckAmount | ( | IObjectContext * | pObjectContext,
 |  | long | lAmount,
 |  | BSTR * | s
 | ) |  |

Definition at line 257 of file caccount.Cpp.

{

  if (!pObjectContext)
  {
    *s = ::SysAllocString(L"No Context");
    return E_FAIL;
  }
  // Check security for large transfers
  if (lAmount > 500 || lAmount < -500)
  {
    BOOL bInRole;
    BSTR bstrRole;

    bstrRole = ::SysAllocString(L"Managers");
    HRESULT hr;
    hr = pObjectContext->IsCallerInRole (bstrRole, &bInRole);
    ::SysFreeString(bstrRole);

    if (FAILED( hr ))
    {
      *s = ::SysAllocString(L"IsCallerInRole() call failed!  Please add the 'Managers' Roll to the package.");
      return hr;
    }

    if (!bInRole)
    {
      *s = ::SysAllocString(L"Need 'Managers' role for amounts over $500");
      return  E_FAIL;
    }
  }
  return S_OK;
}

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Object_Pooling/OPBankSample/Account.VC/mvmoney.h File Reference

  • Com
  • Services
  • Object_Pooling
  • OPBankSample
  • Account.VC
Classes

mvmoney.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class CMoveMoney
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Object_Pooling/OPBankSample/Account.VC/resource.h File Reference

  • Com
  • Services
  • Object_Pooling
  • OPBankSample
  • Account.VC
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_Account 1
#define | IDR_GetReceipt 117
#define | IDR_MoveMoney 2
#define | IDR_UpdateReceipt 115
#define | IDR_UpdateReceipt1 119
#define | IDS_ACCOUNT_DESC 1
#define | IDS_GETRECEIPT_DESC 116
#define | IDS_MOVEMONEY_DESC 2
#define | IDS_UPDATERECEIPT_DESC 114
#define | IDS_UPDATERECEIPT_DESC1 118

Define Documentation

#define IDR_Account 1

Definition at line 6 of file resource.h.

#define IDR_GetReceipt 117

Definition at line 12 of file resource.h.

#define IDR_MoveMoney 2

Definition at line 8 of file resource.h.

#define IDR_UpdateReceipt 115

Definition at line 10 of file resource.h.

#define IDR_UpdateReceipt1 119

Definition at line 14 of file resource.h.

#define IDS_ACCOUNT_DESC 1

Definition at line 5 of file resource.h.

#define IDS_GETRECEIPT_DESC 116

Definition at line 11 of file resource.h.

#define IDS_MOVEMONEY_DESC 2

Definition at line 7 of file resource.h.

#define IDS_UPDATERECEIPT_DESC 114

Definition at line 9 of file resource.h.

#define IDS_UPDATERECEIPT_DESC1 118

Definition at line 13 of file resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Object_Pooling/OPBankSample/Account.VC/stdafx.Cpp File Reference

  • Com
  • Services
  • Object_Pooling
  • OPBankSample
  • Account.VC

stdafx.Cpp File Reference

#include "stdafx.h"
#include <initguid.h>
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Object_Pooling/OPBankSample/Account.VC/stdafx.h File Reference

  • Com
  • Services
  • Object_Pooling
  • OPBankSample
  • Account.VC
Defines | Functions | Variables

stdafx.h File Reference

#include <atlbase.h>
#include <atlcom.h>
#include <SQL.h>
#include <SQLEXT.h>

Go to the source code of this file.

Defines

#define | APP_ERROR 0x80004100
#define | ASSERT_SQL_SUCCESS(rc) { _ASSERTE(rc==SQL_SUCCESS || rc==SQL_SUCCESS_WITH_INFO);}
#define | RETHROW_ERR(exp) { if (FAILED(hr = (exp))) {lErrFlag = 2; throw hr;}}
#define | SafeRelease(x) { if (x){x->Release();x=NULL;}}
#define | SQL_FAILED(rc) ( (rc) != SQL_SUCCESS && (rc) != SQL_SUCCESS_WITH_INFO)
#define | THROW_ERR(exp, str) {if (FAILED (hr = (exp))) {lErrFlag = 0; pErrMsg = _T(str); throw hr;}}
#define | THROW_STR(str) { hr = APP_ERROR; lErrFlag = 1; pErrMsg = str; throw hr;}

Functions

void | GetError (HENV henv, HDBC hdbc, HSTMT hstmt, BSTR *sErr)

Variables

CComModule | _Module

Define Documentation

#define APP_ERROR 0x80004100

Definition at line 40 of file stdafx.h.

#define ASSERT_SQL_SUCCESS ( rc ) { _ASSERTE(rc==SQL_SUCCESS || rc==SQL_SUCCESS_WITH_INFO);}

Definition at line 51 of file stdafx.h.

#define RETHROW_ERR ( exp ) { if (FAILED(hr = (exp))) {lErrFlag = 2; throw hr;}}

Definition at line 38 of file stdafx.h.

#define SafeRelease ( x ) { if (x){x->Release();x=NULL;}}

Definition at line 44 of file stdafx.h.

#define SQL_FAILED ( rc ) ( (rc) != SQL_SUCCESS && (rc) != SQL_SUCCESS_WITH_INFO)

Definition at line 47 of file stdafx.h.

#define THROW_ERR | ( | exp,
 |  | str |
 | ) |  | {if (FAILED (hr = (exp))) {lErrFlag = 0; pErrMsg = _T(str); throw hr;}}

Definition at line 36 of file stdafx.h.

#define THROW_STR ( str ) { hr = APP_ERROR; lErrFlag = 1; pErrMsg = str; throw hr;}

Definition at line 37 of file stdafx.h.

Function Documentation

void GetError | ( | HENV | henv,
 |  | HDBC | hdbc,
 |  | HSTMT | hstmt,
 |  | BSTR * | sErr
 | ) |  |

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Object_Pooling/OPBankSample/Account.VC/unicode.h File Reference

  • Com
  • Services
  • Object_Pooling
  • OPBankSample
  • Account.VC
Defines

unicode.h File Reference

Go to the source code of this file.

Defines

#define _UNICODE

Define Documentation

#define _UNICODE

Definition at line 12 of file unicode.h.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Object_Pooling/OPBankSample/Account.VC/updrec.Cpp File Reference

  • Com
  • Services
  • Object_Pooling
  • OPBankSample
  • Account.VC
Functions

updrec.Cpp File Reference

#include "stdafx.h"
#include "Account.h"
#include <comsvcs.h>
#include "UpdRec.h"
#include <transact.h>

Go to the source code of this file.

Functions

HRESULT | GetConnection (WCHAR *sDSN, HENV *phenv, HDBC *phdbc, HSTMT *phstmt, BOOL bUseObjectPool)
void | GetODBCError (HENV henv, HDBC hdbc, HSTMT hstmt, BSTR *sErr)

Function Documentation

HRESULT GetConnection | ( | WCHAR * | sDSN,
 |  | HENV * | phenv,
 |  | HDBC * | phdbc,
 |  | HSTMT * | phstmt,
 |  | BOOL | bUseObjectPool
 | ) |  |

Definition at line 64 of file caccount.Cpp.

{

  RETCODE rc;
  HRESULT hr= S_OK;

  rc = SQLAllocEnv(phenv);
  ASSERT_SQL_SUCCESS(rc);
  if (bUseObjectPool)
  {
    rc = SQLSetEnvAttr(*phenv, SQL_ATTR_CONNECTION_POOLING, (void*)SQL_CP_OFF, 0);
    ASSERT_SQL_SUCCESS(rc);
  }
  rc = SQLAllocConnect(*phenv, phdbc);
  if (SQL_FAILED(rc))
    return E_FAIL;
  WCHAR szConn[255];
  WORD nSize = 255;
  rc = SQLDriverConnect(*phdbc, NULL, (SQLWCHAR *)sDsn, SQL_NTS, (SQLWCHAR *)szConn, 255, (short *)&nSize, (UWORD)SQL_DRIVER_NOPROMPT);
  if (SQL_FAILED(rc))
  {
    SQLFreeEnv(*phenv);
    return E_FAIL;
  }
  rc = SQLAllocStmt(*phdbc, phstmt); // generic stmt
  if (SQL_FAILED(rc))
  {
    SQLFreeConnect(*phdbc);
    SQLFreeEnv(*phenv);

    return E_FAIL;
  }

  return S_OK;

}

void GetODBCError | ( | HENV | henv,
 |  | HDBC | hdbc,
 |  | HSTMT | hstmt,
 |  | BSTR * | sErr
 | ) |  |

Definition at line 42 of file caccount.Cpp.

{
  WCHAR szSqlState[64];
  SDWORD NativeError;
  WCHAR szErr[512];
  SWORD cbErrorMsg;
  SQLError(henv, hdbc, hstmt, (SQLWCHAR *)szSqlState, &NativeError, (SQLWCHAR *)szErr, 511, &cbErrorMsg);
  *sErr = ::SysAllocString(szErr);
}

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Object_Pooling/OPBankSample/Account.VC/updrec.h File Reference

  • Com
  • Services
  • Object_Pooling
  • OPBankSample
  • Account.VC
Classes

updrec.h File Reference

#include "resource.h"
#include "comsvcs.h"

Go to the source code of this file.

Classes

class CUpdateReceipt
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Object_Pooling/OPBankSample/OPBank/bankdlg.Cpp File Reference

  • Com
  • Services
  • Object_Pooling
  • OPBankSample
  • OPBank
Defines | Functions | Variables

bankdlg.Cpp File Reference

#include "stdafx.h"
#include <SQL.h>
#include <SQLEXT.h>
#include "BankDlg.h"
#include "..\account.vc\Account.h"
#include "..\account.vc\Account_i.c"
#include "stdio.h"
#include <fstream.h>
#include "commctrl.h"
#include "stdlib.h"

Go to the source code of this file.

Defines

#define | DBNTWIN32
#define | ERROR_COLUMN 2
#define | FILE_VERSION 18
#define | IID_DEFINED
#define | NUMBER_OF_COLUMNS 4

Functions

DWORD WINAPI | AccountThread (LPVOID v)
HRESULT | CreateRows (long nRows, HSTMT hstmt)
DWORD WINAPI | CreateRowsThread (LPVOID v)
HRESULT | CreateSchema (HSTMT hstmt)
DWORD WINAPI | CreateSchemaThread (LPVOID v)
HRESULT | FreeConnection (HENV henv, HDBC hdbc, HSTMT hstmt)
HRESULT | GetConnection (HENV *phEnv, HDBC *phdbc, HSTMT *phstmt)
HRESULT | GetRowCount (HSTMT hstmt, long *pRowCount)
DWORD WINAPI | MoveMoneyThread (LPVOID v)
void | ShowResults (BSTR sString, BOOL bError)
HRESULT | VerifySchema (HSTMT hstmt)

Variables

BOOL | g_bAssertOnErrors = FALSE
BOOL | g_bRetry = FALSE
BOOL | g_bStop = FALSE
BOOL | g_bStopOnODBCErrors = FALSE
BOOL g_bUnattended
HACCEL | g_hAccel = NULL
HWND | g_hDlg = NULL
HWND | g_hWndResults = NULL
HWND | g_hWndStop = NULL
HWND | g_hWndSubmit = NULL
long | g_nRows = 500
int | g_nThreadsRunning = 0
LARGE_INTEGER | g_PerfFreq
HANDLE * | g_pHandles = NULL
THREADDATA g_pSuite []
WCHAR * | g_szLogFile

Define Documentation

#define DBNTWIN32

Definition at line 24 of file bankdlg.Cpp.

#define ERROR_COLUMN 2

Definition at line 41 of file bankdlg.Cpp.

#define FILE_VERSION 18

Definition at line 40 of file bankdlg.Cpp.

#define IID_DEFINED

Definition at line 31 of file bankdlg.Cpp.

#define NUMBER_OF_COLUMNS 4

Definition at line 39 of file bankdlg.Cpp.

Function Documentation

DWORD WINAPI AccountThread ( LPVOID v )

Definition at line 480 of file bankthrds.Cpp.

{
  THREADDATA * pTd = (THREADDATA *)v;
  HRESULT hr;
  BOOL bLocalStop = FALSE;
  BSTR s;
  EnumCoInit eCoInit = pTd -> eCoInit;
  if (eCoInit == CoInitRandom)
  {
    eCoInit = (EnumCoInit)RandInt(2);

  }
  switch (eCoInit)
  {
  case CoInitMTA:
    s = SysAllocString(L"Initializing COM (MTA)");
    ShowResults(s, FALSE);
    hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
    break;
  case CoInitSTA:
    s = SysAllocString(L"Initializing COM (STA)");
    ShowResults(s, FALSE);
    hr = CoInitialize(NULL);
    break;
  default:
    _ASSERTE(0);

  }

  WCHAR sz[MSG_BUF_SIZE];
  if (hr)
  {
    wsprintf(sz, L"CoInitialize or CoInitializeEx failed.  hr = %Hx", hr);
    ShowResults(SysAllocString(sz), TRUE);
    CoUninitialize();
    return hr;
  }

  CLSID clsid = CLSID_CAccount;
  IID iid = IID_IAccount;
  switch (pTd -> eLang)
  {
  case VB:
    hr = CLSIDFromProgID(L"Bank.IAccount", &clsid);
    if (FAILED(hr))
    {
      //ShowResults(SysAllocString(L"VB Account Not registered.  Using VC Account."), TRUE);
      clsid = CLSID_CAccount;
    }
    break;
  case VC:
    break;
  case Java:
    ShowResults(SysAllocString(L"Java not supported (yet).  Using VC Account."), TRUE);
    break;
  // (04.26.00 mdl) Included support for Delphi.
  case Delphi:
        hr  = CLSIDFromProgID(L"DelphiBank.Account", &clsid);
    IIDFromString(L"{4D237DC1-041A-11D4-81A3-005004D0FBC3}", &iid);
    if (FAILED(hr))
    {
      ShowResults(SysAllocString(L"Delphi Account Not registered.  Using VC Account."), TRUE);
      clsid = CLSID_CAccount;
      iid = IID_IAccount;
    }
        break;
  default:
    _ASSERTE(0);
  }

  int nCount = 0;

  BSTR sResult = 0;

  int nFrom = pTd -> nFrom;
  int nTo = pTd -> nTo;

  DWORD liStartTime = GetTickCount();
  IAccount * pAccount = NULL;
  IErrorInfo * pInfo = NULL;
  nCount = 0;
  DWORD dwTime;
  LARGE_INTEGER stop;
  LARGE_INTEGER start;
  while (g_bStop == FALSE && (nCount < pTd -> nIters) && bLocalStop == FALSE)
  {

    if (!pAccount)
    {
      if (pTd -> bChatty)
      {
        s = SysAllocString(L"Creating Account");
        ShowResults(s, FALSE);
      }
      // (04.26.00 mdl) Modified to use variable vs. fixed iid.
      //hr = CreateObject(clsid, CLSCTX_ALL, IID_IAccount, (void **)&pAccount, &dwTime);
      hr = CreateObject(clsid, CLSCTX_ALL, iid, (void **)&pAccount, &dwTime);
      if (pTd -> bChatty)
      {
        wsprintf(sz, L"CoCreateInstance took %d ms", dwTime);
        ShowResults(SysAllocString(sz), FALSE);
      }

      if (hr)
      {

        wsprintf(sz, L"Failed to create the account component! HRESULT: %lX", hr);
        ShowResults(SysAllocString(sz), TRUE);
        if (g_bAssertOnErrors)
          _ASSERTE(0);
        if (g_bRetry == FALSE) // don't exit for Wolfpack
          break; // exit thread if create fails
        else
        {
          ShowResults(SysAllocString(L"Waiting for 100 ms"), FALSE);
          Sleep(100);
        }

      }

    }
    if (pAccount)
    {

      int nAmount = pTd -> nAmount;
      if (pTd -> nTranType == DEBIT)
        nAmount = -1  * nAmount;

      if (pTd -> bRandom)
      {
        if (!g_nRows)
        {
          ShowResults(SysAllocString(L"Put in a valid number of rows you dweeb!"), TRUE);
          g_bStop = TRUE;
        }
        else
        {
          nTo = RandInt(g_nRows); // nTo==nFrom legal?
          nTo++;
        }
      }
      QueryPerformanceCounter( &start);
      hr = pAccount -> Post(nTo, nAmount, &sResult);
      QueryPerformanceCounter( &stop);
      if (pTd -> bChatty)
      {
        wsprintf(sz, L"Account Post took %d ms", 1000*(stop.QuadPart-start.QuadPart)/g_PerfFreq.QuadPart);
        ShowResults(SysAllocString(sz), FALSE);
      }
      if (hr)
      {
        GetErrorInfo(NULL, &pInfo);
        if( pInfo )
        {
          pInfo -> GetDescription(&sResult);
          pInfo -> Release();
        }
        if (g_bAssertOnErrors)
          _ASSERTE(0);
        if (hr == E_UNEXPECTED && g_bStopOnODBCErrors) // E_UNEXPECTED returned on ODBC errors
        {
          if (!g_bRetry)
              bLocalStop = TRUE;
          else // retry for wolfpack
          {
            if (pAccount)
            {
              pAccount -> Release();
              pAccount = NULL;
            }
          }

        }
        else  // non-ODBC error
        {
          if (!g_bRetry)
            g_bStop = TRUE;
          else // retry for wolfpack
          {
            if (pAccount)
            {
              pAccount -> Release();
              pAccount = NULL;
            }
          }

        }
        if (!sResult || SysStringLen(sResult) == 0)
        {
          SysFreeString(sResult);
          if (hr == E_ACCESSDENIED)
            sResult = ::SysAllocString(L"Call failed due to security violation ");
          else
            sResult = ::SysAllocString(L"Call failed ");
        }
        wsprintf(sz, L"%s HRESULT: 0x%lx", sResult, hr);
        ShowResults(SysAllocString(sz), TRUE);
        SysFreeString(sResult); // not posting it

      }
      else
      {

        if (pTd -> bChatty)
        {
          ShowResults(sResult, FALSE);
        }
      }

      if (pTd -> bCreatePerIteration && pAccount)
      {
        pAccount -> Release();
        pAccount = NULL;
      }
    }

    nCount++;
  }

  if (pAccount)
  {
    pAccount -> Release();
    pAccount = NULL;
  }

  float t = (GetTickCount() - (float)liStartTime)  / 1000;
  _snwprintf(sz,MSG_BUF_SIZE, L"Done.  Time: %2.4f seconds for %ld iterations", t, nCount);
  ShowResults(SysAllocString(sz), FALSE);
  CoUninitialize();
  return 0;

}

HRESULT CreateRows | ( | long | nRows,
 |  | HSTMT | hstmt
 | ) |  |

Definition at line 968 of file bankthrds.Cpp.

{

  HENV henv = 0;
  HDBC hdbc = 0;
  HRESULT hr;
  BSTR sErr;
  BOOL bGotConnection = FALSE;
  RETCODE rc;

  if (!hstmt)
  {
    hr = GetConnection(&henv, &hdbc, &hstmt);
    bGotConnection = TRUE;
    if (hr)
      return hr;
  }

  //
  //  get the current rowcount
  //

  long nCurRows = 0;

  hr = GetRowCount(hstmt, &nCurRows);
  if (FAILED(hr))
    return hr;

  WCHAR szSQL[64];
  wsprintf(szSQL, L"Current Row count is %d", nCurRows+1);
  ShowResults(SysAllocString(szSQL), FALSE);
  wsprintf(szSQL, L"setting rowcount to be %d", nRows);
  ShowResults(SysAllocString(szSQL), FALSE);
  if (nCurRows <= nRows)
  {
    int i;
    for (i=nCurRows+1; i<=nRows; i++)
    {
      wsprintf(szSQL, L"insert into VcAccount values (%i, '')", 100000);
      rc = SQLExecDirect(hstmt, szSQL, SQL_NTS);
      if (SQL_FAILED(rc))
      {
        GetOdbcError(0,0,hstmt,&sErr);
        ShowResults(sErr, TRUE);
        break;
      }
    }
  }
  else
  {
    ShowResults(SysAllocString(L"truncating rows"), FALSE);
    wsprintf(szSQL, L"delete from VcAccount where AccountNo > %d", nRows);
    rc = SQLExecDirect(hstmt, szSQL, SQL_NTS);
    if (SQL_FAILED(rc))
    {
      GetOdbcError(0,0,hstmt,&sErr);
      ShowResults(sErr, TRUE);
    }
  }

  ShowResults(SysAllocString(L"Done setting row count"), FALSE);
  if (bGotConnection)
  {
    FreeConnection(henv, hdbc, hstmt);
  }
  else
  {
    SQLFreeStmt(hstmt, SQL_CLOSE);
  }

  return S_OK;

}

DWORD WINAPI CreateRowsThread ( LPVOID v )

Definition at line 217 of file bankthrds.Cpp.

{

  CreateRows((long)v, NULL);
  return S_OK;
}

HRESULT CreateSchema ( HSTMT hstmt )

Definition at line 1050 of file bankthrds.Cpp.

{
  HENV henv = 0;
  HDBC hdbc = 0;
  HRESULT hr;
  int i;
  RETCODE rc;
  BOOL bGotConnection = FALSE;

  if (!hstmt)
  {
    hr = GetConnection(&henv, &hdbc, &hstmt);
    bGotConnection = TRUE;
    if (hr)
      return hr;
  }
  ShowResults(SysAllocString(L"Creating schema"), FALSE);
  for (i=0; i< sizeof(sCreateSchema)/sizeof(sCreateSchema[0]); i++)
  {
    rc = SQLExecDirect(hstmt, sCreateSchema[i], SQL_NTS);
    if (SQL_FAILED(rc))
    {
      _ASSERTE(0);
      ShowResults(SysAllocString(L"Failed to create schema!"), TRUE);
      break;
    }
  }

  //
  //  we always need to add a row to the receipt table

  SQLExecDirect(hstmt, L"insert into receipt values(0)", SQL_NTS);

  if (bGotConnection)
  {
    FreeConnection(henv, hdbc, hstmt);
  }
  else
  {
    SQLFreeStmt(hstmt, SQL_CLOSE);
  }

  return S_OK;
}

DWORD WINAPI CreateSchemaThread ( LPVOID v )

Definition at line 724 of file bankthrds.Cpp.

{
  HENV henv = 0;
  HDBC hdbc = 0;
  HSTMT hstmt = 0;
  HRESULT hr= S_OK;
  BSTR sErr = NULL;
  WORD nSize = 255;
  hr = GetConnection(&henv, &hdbc, &hstmt);
  if (FAILED(hr))
  {
    ShowResults(SysAllocString(L"Done -- failed to get connection"), FALSE);
    return -1;
  }

  CreateSchema(hstmt);

  if (hr != S_OK)
  {
    GetOdbcError(henv, hdbc, hstmt, &sErr);
    ShowResults(sErr, TRUE);
  }
  else
  {
    ShowResults(SysAllocString(L"Done creating schema"), FALSE);
  }

  if (hstmt)
  {
    SQLFreeStmt(hstmt, SQL_DROP);
  }
  if (hdbc)
  {
    SQLDisconnect(hdbc);
    SQLFreeConnect(hdbc);
  }
  if (henv)
    SQLFreeEnv(henv);

  return 0;
}

HRESULT FreeConnection | ( | HENV | henv,
 |  | HDBC | hdbc,
 |  | HSTMT | hstmt
 | ) |  |

Definition at line 886 of file bankthrds.Cpp.

{
  ShowResults(SysAllocString(L"Freeing Connection"), FALSE);

  if (hstmt)
    SQLFreeStmt(hstmt, SQL_DROP);
  if (hdbc)
  {
    SQLDisconnect(hdbc);
    SQLFreeConnect(hdbc);
  }
  if (henv)
    SQLFreeEnv(henv);
  return S_OK;
}

HRESULT GetConnection | ( | HENV * | phEnv,
 |  | HDBC * | phdbc,
 |  | HSTMT * | phstmt
 | ) |  |

Definition at line 778 of file bankthrds.Cpp.

{
  WCHAR * sDsn = L"FILEDSN=OPBankSamples;DATABASE=pubs;UID=sa;PWD=;APP=VC Bank";
  RETCODE rc;
  HRESULT hr= S_OK;
  BSTR sErr = NULL;
  rc = SQLAllocEnv(&*phEnv);
  ASSERT_SQL_SUCCESS(rc);
  BSTR s;
  s = SysAllocString(L"Getting Connection");
  ShowResults(s, FALSE);
  rc = SQLAllocConnect(*phEnv, phdbc);
  if (SQL_FAILED(rc))
  {
    GetOdbcError(*phEnv, *phdbc, *phstmt, &sErr);
    ShowResults(sErr, TRUE);
    return (DWORD)E_FAIL;
  }
  WCHAR szConn[255];
  WORD nSize = 255;
  rc = SQLDriverConnect(*phdbc, NULL, (SQLWCHAR *)sDsn, SQL_NTS, (SQLWCHAR *)szConn, 255, (short *)&nSize, (UWORD)SQL_DRIVER_NOPROMPT);
  if (SQL_FAILED(rc))
  {
    GetOdbcError(*phEnv, *phdbc, *phstmt, &sErr);
    ShowResults(sErr, TRUE);
    SQLFreeEnv(*phEnv);
    return (DWORD)E_FAIL;
  }
  rc = SQLAllocStmt(*phdbc, phstmt); // generic stmt
  if (SQL_FAILED(rc))
  {
    GetOdbcError(*phEnv, *phdbc, *phstmt, &sErr);
    ShowResults(sErr, TRUE);
    SQLFreeConnect(*phdbc);
    SQLFreeEnv(*phEnv);
    return (DWORD)E_FAIL;
  }

  return S_OK;
}

HRESULT GetRowCount | ( | HSTMT | hstmt,
 |  | long * | pRowCount
 | ) |  |

Definition at line 827 of file bankthrds.Cpp.

{

  HRESULT hr;
  HENV henv = 0;
  HDBC hdbc = 0;

  BOOL bGotConnection = FALSE;
  if (!hstmt)
  {
    hr = GetConnection(&henv, &hdbc, &hstmt);
    bGotConnection = TRUE;
    if (hr)
      return hr;
  }

  //
  //  get the current number of rows
  //

  int nRows = 0;
  long len = 0;
  RETCODE rc;
  ShowResults(SysAllocString(L"Getting Current Row Count"), FALSE);
  rc = SQLExecDirect(hstmt, L"select max(AccountNo) from VcAccount", SQL_NTS);
  while (SQLFetch(hstmt) == SQL_SUCCESS) // only get the first one for now
  {

    rc = SQLGetData(hstmt, 1, SQL_C_LONG, &nRows, 0, &len);
    if (SQL_FAILED(rc))
    {
      BSTR sErr;
      GetOdbcError(henv, hdbc, hstmt, &sErr);
      ShowResults(sErr, TRUE);
    }
  }

  *pRowCount = nRows;
  if (bGotConnection)
  {
    FreeConnection(henv, hdbc, hstmt);
  }
  else
  {
    SQLFreeStmt(hstmt, SQL_CLOSE);
  }

  return S_OK;
}

DWORD WINAPI MoveMoneyThread ( LPVOID v )

Definition at line 231 of file bankthrds.Cpp.

{

  THREADDATA * pTd = (THREADDATA *)v;
  HRESULT hr;
  BOOL bLocalStop = FALSE;
  BSTR s;
  EnumCoInit eCoInit = pTd -> eCoInit;
  if (eCoInit == CoInitRandom)
  {
    eCoInit = (EnumCoInit)RandInt(2);

  }
  switch (eCoInit)
  {
  case CoInitMTA:
    s = SysAllocString(L"Initializing COM (MTA)");
    ShowResults(s, FALSE);
    hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
    break;
  case CoInitSTA:
    s = SysAllocString(L"Initializing COM (STA)");
    ShowResults(s, FALSE);
    hr = CoInitialize(NULL);
    break;
  default:
    _ASSERTE(0);

  }
  WCHAR sz[MSG_BUF_SIZE];

  if (hr)
  {
    wsprintf(sz, L"CoInitialize or CoInitializeEx failed.  hr = %Hx", hr);
    ShowResults(SysAllocString(sz), TRUE);
    CoUninitialize();
    return hr;
  }

  CLSID clsid = CLSID_CMoveMoney;
  IID   iid = IID_IMoveMoney;
  switch (pTd -> eLang)
  {
  case VB:
    hr = CLSIDFromProgID(L"Bank.IMoveMoney", &clsid);
    if (FAILED(hr))
    {
      //ShowResults(SysAllocString(L"VB Account Not registered.  Using VC Account."), TRUE);
      clsid = CLSID_CMoveMoney;
    }
    break;
  case VC:
    break;
  case Java:
    ShowResults(SysAllocString(L"Java not supported (yet).  Using VC Account."), TRUE);
    break;
    // (04.26.00 mdl) Included support for Delphi.
  case Delphi:
        hr = CLSIDFromProgID(L"DelphiBank.MoveMoney", &clsid);
    IIDFromString(L"{A8C18C7A-4D78-475B-A5E7-96F73DB2CE8D}", &iid);
    if (FAILED(hr))
    {
      ShowResults(SysAllocString(L"Delphi MoveMoney Not registered.  Using VC Account."), TRUE);
      clsid = CLSID_CMoveMoney;
      iid = IID_IMoveMoney;
    }
        break;
  default:
    _ASSERTE(0);
  }

  int nCount = 0;

  BSTR sResult = 0;

  int nFrom = pTd -> nFrom;
  int nTo = pTd -> nTo;

  DWORD liStartTime = GetTickCount();

  IErrorInfo * pInfo = NULL;
  nCount = 0;
  IMoveMoney * pMove = NULL;
  DWORD dwTime;
  LARGE_INTEGER stop;
  LARGE_INTEGER start;
  while (g_bStop == FALSE && (nCount < pTd -> nIters)  && bLocalStop == FALSE )
  {

    if (pMove == NULL)
    {
      if (pTd -> bChatty)
      {
        ShowResults(SysAllocString(L"Creating MoveMoney"), FALSE);
      }

      // (04.26.00 mdl) Modified to use variable vs. fixed iid.
      //hr = CreateObject(clsid, CLSCTX_ALL, IID_IMoveMoney, (void **)&pMove, &dwTime);
      hr = CreateObject(clsid, CLSCTX_ALL, iid, (void **)&pMove, &dwTime);
      if (pTd -> bChatty)
      {
        wsprintf(sz, L"CoCreateInstance took %d ms", dwTime);
        ShowResults(SysAllocString(sz), FALSE);
      }
      if (hr)
      {

        wsprintf(sz, L"Failed to create the move money component! HRESULT: %lX", hr);
        ShowResults(SysAllocString(sz), TRUE);
        if (g_bAssertOnErrors)
          _ASSERTE(0);
        if (g_bRetry == FALSE) // don't exit for Wolfpack
          break; // exit thread if create fails
        else
        {
          ShowResults(SysAllocString(L"Waiting for 100 ms"), FALSE);
          Sleep(100);
        }
      }
    }

    if (pMove) // may be NULL w/ Wolfpack failover
    {
      IMoveMoneyOptions * pOptions = NULL;
      hr = pMove -> QueryInterface(IID_IMoveMoneyOptions, (void **)&pOptions);
      if (pOptions)
      {
        pOptions -> UseComPlus();
        pOptions -> SetAccountClsctx(CLSCTX_ALL);
        pOptions -> Release();
      }

      if (pTd -> bRandom)
      {
        nFrom = 0;
        nTo = 0;
        nFrom = RandInt(g_nRows);
        nFrom++; // we want 1 --> nRows
        nTo = RandInt(g_nRows);
        nTo++;
        if (nFrom > nTo) //always move from lowest to highest to stop deadlocks
        {
          int nTemp = nTo;
          nTo = nFrom;
          nFrom = nTemp;
        }
      }

      QueryPerformanceCounter( &start);
      hr = pMove -> Perform(nFrom, nTo, pTd -> nAmount, pTd -> nTranType, &sResult);
      QueryPerformanceCounter( &stop);
      if (pTd -> bChatty)
      {
        wsprintf(sz, L"MoveMoney Perform took %d ms",  1000*(stop.QuadPart-start.QuadPart)/g_PerfFreq.QuadPart);
        ShowResults(SysAllocString(sz), FALSE);
      }
      if (hr)
      {
        GetErrorInfo(NULL, &pInfo);
        if( pInfo )
        {
          pInfo -> GetDescription(&sResult);
          pInfo -> Release();
        }
        if (g_bAssertOnErrors)
          _ASSERTE(0);
        if (hr == E_UNEXPECTED && g_bStopOnODBCErrors) // E_UNEXPECTED returned on ODBC errors
        {
          if (!g_bRetry)
            bLocalStop = TRUE;
          else // retry for wolfpack
          {
            if (pMove)
            {
              pMove -> Release();
              pMove = NULL;
            }
          }
        }
        else  // non-ODBC error, stop all threads
        {
          if (!g_bRetry)
            g_bStop = TRUE;
          else // retry for wolfpack
          {
            if (pMove)
            {
              pMove -> Release();
              pMove = NULL;
            }
          }
        }
        *sz = NULL;
        if (!sResult)
        {
          if (hr == E_ACCESSDENIED)
            sResult = ::SysAllocString(L"Call failed due to security violation ");
          else
            sResult = ::SysAllocString(L"Call failed ");

        }
        wsprintf(sz, L"%s HRESULT: 0x%lx", sResult, hr);
        ShowResults(SysAllocString(sz), TRUE);
        SysFreeString(sResult); // not posting it
        sResult = NULL;
      }
      else
      {
        if (pTd -> bChatty)
          ShowResults(sResult, FALSE);
      }

      if (pTd -> bCreatePerIteration && pMove)
      {
        pMove -> Release();
        pMove = NULL;
      }
    }

    nCount++;
  }

  if (pMove)
  {
    pMove -> Release();
    pMove = NULL;
  }

  float t = (GetTickCount() - (float)liStartTime)  / 1000;
  _snwprintf(sz, MSG_BUF_SIZE, L"Done.  Time: %2.4f seconds for %ld iterations", t, nCount);
  ShowResults(SysAllocString(sz), FALSE);
  CoUninitialize();
  return 0;
}

void ShowResults | ( | BSTR | sString,
 |  | BOOL | bError
 | ) |  |

Definition at line 194 of file bankthrds.Cpp.

{

  if (bError)
  {
    ::PostMessage(g_hDlg, WM_SHOWERROR, (WPARAM)GetCurrentThreadId() , (LPARAM)sString);
  }
  else
  {
    ::PostMessage(g_hDlg, WM_SHOWRESULTS, (WPARAM)GetCurrentThreadId() , (LPARAM)sString);
  }

}

HRESULT VerifySchema ( HSTMT hstmt )

Definition at line 911 of file bankthrds.Cpp.

{
  HRESULT hr = S_OK;
  BOOL bGotConnection = FALSE;
  HENV henv = 0;
  HDBC hdbc = 0;
  if (!hstmt)
  {
    hr = GetConnection(&henv, &hdbc, &hstmt);
    bGotConnection = TRUE;
    if (hr)
      return hr;
  }

  ShowResults(SysAllocString(L"Verifying schema"), FALSE);
  int i;
  RETCODE rc;
  long nRowCount = 0;
  for (i=0;i< sizeof(sCheckSchema) / sizeof(sCheckSchema[0]); i++)
  {
    rc = SQLExecDirect(hstmt, sCheckSchema[i], SQL_NTS);
    if (SQL_FAILED(rc))
    {
      hr = E_FAIL;
      break;
    }

    rc = SQLRowCount(hstmt, &nRowCount);
    if (nRowCount != 1)
    {
      hr = E_FAIL;
      break;
    }
  }

  if (bGotConnection)
  {
    FreeConnection(henv, hdbc, hstmt);
  }
  else
  {
    SQLFreeStmt(hstmt, SQL_CLOSE);
  }

  return hr;

}

Variable Documentation

BOOL g_bAssertOnErrors = FALSE

Definition at line 53 of file bankdlg.Cpp.

BOOL g_bRetry = FALSE

Definition at line 55 of file bankdlg.Cpp.

BOOL g_bStop = FALSE

Definition at line 52 of file bankdlg.Cpp.

BOOL g_bStopOnODBCErrors = FALSE

Definition at line 54 of file bankdlg.Cpp.

BOOL g_bUnattended

Definition at line 41 of file OPBank.Cpp.

HACCEL g_hAccel = NULL

Definition at line 59 of file bankdlg.Cpp.

HWND g_hDlg = NULL

Definition at line 51 of file bankdlg.Cpp.

HWND g_hWndResults = NULL

Definition at line 48 of file bankdlg.Cpp.

HWND g_hWndStop = NULL

Definition at line 50 of file bankdlg.Cpp.

HWND g_hWndSubmit = NULL

Definition at line 49 of file bankdlg.Cpp.

long g_nRows = 500

Definition at line 56 of file bankdlg.Cpp.

int g_nThreadsRunning = 0

Definition at line 58 of file bankdlg.Cpp.

LARGE_INTEGER g_PerfFreq

Definition at line 72 of file bankthrds.Cpp.

HANDLE* g_pHandles = NULL

Definition at line 57 of file bankdlg.Cpp.

THREADDATA g_pSuite[]
Initial value:

{

  MOVEMONEY,  CoInitMTA,      5,    TRUE, TRUE, 1,    2,  TRANSFER, 5,    5,    FALSE,        VC,
  MOVEMONEY,  CoInitSTA,      5,    TRUE, TRUE, 1,    2,  TRANSFER, 5,    1,    TRUE,       VC,
  ACCOUNT,  CoInitMTA,      5,    TRUE, TRUE, 1,    2,  DEBIT,    5,    1,    FALSE,        VC,
  ACCOUNT,  CoInitRandom,   5,    TRUE, TRUE, 1,    2,  CREDIT,   5,    5,    FALSE,        VC

}

Definition at line 79 of file bankdlg.Cpp.

WCHAR* g_szLogFile

Definition at line 42 of file OPBank.Cpp.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Object_Pooling/OPBankSample/OPBank/bankdlg.h File Reference

  • Com
  • Services
  • Object_Pooling
  • OPBankSample
  • OPBank
Classes | Defines | Enumerations

bankdlg.h File Reference

#include "resource.h"
#include "linkable.h"
#include "resource.h"

Go to the source code of this file.

Classes

class | CBankDlg
struct | CREATEDATA
class | CThreadData
struct | RESULTDATA
struct | THREADDATA

Defines

#define | WM_SHOWERROR WM_USER+2
#define | WM_SHOWRESULTS WM_USER+1

Enumerations

enum | BankLang { VC = 0, VB, Java, Delphi }
enum | EnumCoInit { CoInitMTA = 0, CoInitSTA, CoInitRandom }

Define Documentation

#define WM_SHOWERROR WM_USER+2

Definition at line 29 of file bankdlg.h.

#define WM_SHOWRESULTS WM_USER+1

Definition at line 28 of file bankdlg.h.

Enumeration Type Documentation

enum BankLang
Enumerator:
VC
VB
Java
Delphi

Definition at line 39 of file bankdlg.h.

{
  VC = 0,
  VB,
  Java,
  Delphi,
} BankLang;

enum EnumCoInit
Enumerator:
CoInitMTA
CoInitSTA
CoInitRandom

Definition at line 31 of file bankdlg.h.

{
  CoInitMTA = 0,
  CoInitSTA,
  CoInitRandom
} EnumCoInit;

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Object_Pooling/OPBankSample/OPBank/bankthrds.Cpp File Reference

  • Com
  • Services
  • Object_Pooling
  • OPBankSample
  • OPBank
Classes | Defines | Functions | Variables

bankthrds.Cpp File Reference

#include "stdafx.h"
#include <SQL.h>
#include <SQLEXT.h>
#include "BankDlg.h"
#include "stdio.h"
#include <fstream.h>
#include "commctrl.h"
#include "stdlib.h"
#include "..\account.vc\account_i.c"
#include "..\account.vc\account.h"

Go to the source code of this file.

Classes

union | UnionInt64

Defines

#define | ASSERT_SQL_SUCCESS(rc) { _ASSERTE(rc==SQL_SUCCESS || rc==SQL_SUCCESS_WITH_INFO);}
#define | MSG_BUF_SIZE 256
#define | SQL_FAILED(rc) ( (rc) != SQL_SUCCESS && (rc) != SQL_SUCCESS_WITH_INFO)

Functions

DWORD WINAPI | AccountThread (LPVOID v)
HRESULT | CreateObject (REFCLSID clsid, DWORD clsctx, REFIID iid, void **ppv, DWORD *pdwTime)
HRESULT | CreateRows (long nRows, HSTMT hstmt)
DWORD WINAPI | CreateRowsThread (LPVOID v)
HRESULT | CreateSchema (HSTMT hstmt)
DWORD WINAPI | CreateSchemaThread (LPVOID v)
HRESULT | FreeConnection (HENV henv, HDBC hdbc, HSTMT hstmt)
HRESULT | GetConnection (HENV *phEnv, HDBC *phdbc, HSTMT *phstmt)
void | GetOdbcError (HENV henv, HDBC hdbc, HSTMT hstmt, BSTR *sErr)
HRESULT | GetRowCount (HSTMT hstmt, long *pRowCount)
DWORD WINAPI | MoveMoneyThread (LPVOID v)
unsigned long | RandInt (unsigned long ulMax)
void | ShowResults (BSTR sString, BOOL bError)
HRESULT | VerifySchema (HSTMT hstmt)

Variables

BOOL g_bAssertOnErrors
BOOL g_bRetry
BOOL g_bStop
BOOL g_bStopOnODBCErrors
HWND | g_hDlg
HWND | g_hWndResults
HWND | g_hWndStop
HWND | g_hWndSubmit
long | g_nRows
LARGE_INTEGER | g_PerfFreq

Define Documentation

#define ASSERT_SQL_SUCCESS ( rc ) { _ASSERTE(rc==SQL_SUCCESS || rc==SQL_SUCCESS_WITH_INFO);}

Definition at line 44 of file bankthrds.Cpp.

#define MSG_BUF_SIZE 256

Definition at line 29 of file bankthrds.Cpp.

#define SQL_FAILED ( rc ) ( (rc) != SQL_SUCCESS && (rc) != SQL_SUCCESS_WITH_INFO)

Definition at line 43 of file bankthrds.Cpp.

Function Documentation

DWORD WINAPI AccountThread ( LPVOID v )

Definition at line 480 of file bankthrds.Cpp.

{
  THREADDATA * pTd = (THREADDATA *)v;
  HRESULT hr;
  BOOL bLocalStop = FALSE;
  BSTR s;
  EnumCoInit eCoInit = pTd -> eCoInit;
  if (eCoInit == CoInitRandom)
  {
    eCoInit = (EnumCoInit)RandInt(2);

  }
  switch (eCoInit)
  {
  case CoInitMTA:
    s = SysAllocString(L"Initializing COM (MTA)");
    ShowResults(s, FALSE);
    hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
    break;
  case CoInitSTA:
    s = SysAllocString(L"Initializing COM (STA)");
    ShowResults(s, FALSE);
    hr = CoInitialize(NULL);
    break;
  default:
    _ASSERTE(0);

  }

  WCHAR sz[MSG_BUF_SIZE];
  if (hr)
  {
    wsprintf(sz, L"CoInitialize or CoInitializeEx failed.  hr = %Hx", hr);
    ShowResults(SysAllocString(sz), TRUE);
    CoUninitialize();
    return hr;
  }

  CLSID clsid = CLSID_CAccount;
  IID iid = IID_IAccount;
  switch (pTd -> eLang)
  {
  case VB:
    hr = CLSIDFromProgID(L"Bank.IAccount", &clsid);
    if (FAILED(hr))
    {
      //ShowResults(SysAllocString(L"VB Account Not registered.  Using VC Account."), TRUE);
      clsid = CLSID_CAccount;
    }
    break;
  case VC:
    break;
  case Java:
    ShowResults(SysAllocString(L"Java not supported (yet).  Using VC Account."), TRUE);
    break;
  // (04.26.00 mdl) Included support for Delphi.
  case Delphi:
        hr  = CLSIDFromProgID(L"DelphiBank.Account", &clsid);
    IIDFromString(L"{4D237DC1-041A-11D4-81A3-005004D0FBC3}", &iid);
    if (FAILED(hr))
    {
      ShowResults(SysAllocString(L"Delphi Account Not registered.  Using VC Account."), TRUE);
      clsid = CLSID_CAccount;
      iid = IID_IAccount;
    }
        break;
  default:
    _ASSERTE(0);
  }

  int nCount = 0;

  BSTR sResult = 0;

  int nFrom = pTd -> nFrom;
  int nTo = pTd -> nTo;

  DWORD liStartTime = GetTickCount();
  IAccount * pAccount = NULL;
  IErrorInfo * pInfo = NULL;
  nCount = 0;
  DWORD dwTime;
  LARGE_INTEGER stop;
  LARGE_INTEGER start;
  while (g_bStop == FALSE && (nCount < pTd -> nIters) && bLocalStop == FALSE)
  {

    if (!pAccount)
    {
      if (pTd -> bChatty)
      {
        s = SysAllocString(L"Creating Account");
        ShowResults(s, FALSE);
      }
      // (04.26.00 mdl) Modified to use variable vs. fixed iid.
      //hr = CreateObject(clsid, CLSCTX_ALL, IID_IAccount, (void **)&pAccount, &dwTime);
      hr = CreateObject(clsid, CLSCTX_ALL, iid, (void **)&pAccount, &dwTime);
      if (pTd -> bChatty)
      {
        wsprintf(sz, L"CoCreateInstance took %d ms", dwTime);
        ShowResults(SysAllocString(sz), FALSE);
      }

      if (hr)
      {

        wsprintf(sz, L"Failed to create the account component! HRESULT: %lX", hr);
        ShowResults(SysAllocString(sz), TRUE);
        if (g_bAssertOnErrors)
          _ASSERTE(0);
        if (g_bRetry == FALSE) // don't exit for Wolfpack
          break; // exit thread if create fails
        else
        {
          ShowResults(SysAllocString(L"Waiting for 100 ms"), FALSE);
          Sleep(100);
        }

      }

    }
    if (pAccount)
    {

      int nAmount = pTd -> nAmount;
      if (pTd -> nTranType == DEBIT)
        nAmount = -1  * nAmount;

      if (pTd -> bRandom)
      {
        if (!g_nRows)
        {
          ShowResults(SysAllocString(L"Put in a valid number of rows you dweeb!"), TRUE);
          g_bStop = TRUE;
        }
        else
        {
          nTo = RandInt(g_nRows); // nTo==nFrom legal?
          nTo++;
        }
      }
      QueryPerformanceCounter( &start);
      hr = pAccount -> Post(nTo, nAmount, &sResult);
      QueryPerformanceCounter( &stop);
      if (pTd -> bChatty)
      {
        wsprintf(sz, L"Account Post took %d ms", 1000*(stop.QuadPart-start.QuadPart)/g_PerfFreq.QuadPart);
        ShowResults(SysAllocString(sz), FALSE);
      }
      if (hr)
      {
        GetErrorInfo(NULL, &pInfo);
        if( pInfo )
        {
          pInfo -> GetDescription(&sResult);
          pInfo -> Release();
        }
        if (g_bAssertOnErrors)
          _ASSERTE(0);
        if (hr == E_UNEXPECTED && g_bStopOnODBCErrors) // E_UNEXPECTED returned on ODBC errors
        {
          if (!g_bRetry)
              bLocalStop = TRUE;
          else // retry for wolfpack
          {
            if (pAccount)
            {
              pAccount -> Release();
              pAccount = NULL;
            }
          }

        }
        else  // non-ODBC error
        {
          if (!g_bRetry)
            g_bStop = TRUE;
          else // retry for wolfpack
          {
            if (pAccount)
            {
              pAccount -> Release();
              pAccount = NULL;
            }
          }

        }
        if (!sResult || SysStringLen(sResult) == 0)
        {
          SysFreeString(sResult);
          if (hr == E_ACCESSDENIED)
            sResult = ::SysAllocString(L"Call failed due to security violation ");
          else
            sResult = ::SysAllocString(L"Call failed ");
        }
        wsprintf(sz, L"%s HRESULT: 0x%lx", sResult, hr);
        ShowResults(SysAllocString(sz), TRUE);
        SysFreeString(sResult); // not posting it

      }
      else
      {

        if (pTd -> bChatty)
        {
          ShowResults(sResult, FALSE);
        }
      }

      if (pTd -> bCreatePerIteration && pAccount)
      {
        pAccount -> Release();
        pAccount = NULL;
      }
    }

    nCount++;
  }

  if (pAccount)
  {
    pAccount -> Release();
    pAccount = NULL;
  }

  float t = (GetTickCount() - (float)liStartTime)  / 1000;
  _snwprintf(sz,MSG_BUF_SIZE, L"Done.  Time: %2.4f seconds for %ld iterations", t, nCount);
  ShowResults(SysAllocString(sz), FALSE);
  CoUninitialize();
  return 0;

}

HRESULT CreateObject | ( | REFCLSID | clsid,
 |  | DWORD | clsctx,
 |  | REFIID | iid,
 |  | void ** | ppv,
 |  | DWORD * | pdwTime
 | ) |  |

Definition at line 146 of file bankthrds.Cpp.

{

  HRESULT hr = E_FAIL;
  LARGE_INTEGER stop;
  LARGE_INTEGER start;
  LARGE_INTEGER total;

  QueryPerformanceCounter( &start);
  hr = CoCreateInstance(clsid, NULL, clsctx, iid, ppv);
  QueryPerformanceCounter( &stop);
  total.QuadPart = 1000*(stop.QuadPart-start.QuadPart)/g_PerfFreq.QuadPart;
  if (total.HighPart != 0)
    ShowResults(SysAllocString(L"Overflow in performance counters!"), TRUE);

  *pdwTime  = total.LowPart;

  return hr;
}

HRESULT CreateRows | ( | long | nRows,
 |  | HSTMT | hstmt
 | ) |  |

Definition at line 968 of file bankthrds.Cpp.

{

  HENV henv = 0;
  HDBC hdbc = 0;
  HRESULT hr;
  BSTR sErr;
  BOOL bGotConnection = FALSE;
  RETCODE rc;

  if (!hstmt)
  {
    hr = GetConnection(&henv, &hdbc, &hstmt);
    bGotConnection = TRUE;
    if (hr)
      return hr;
  }

  //
  //  get the current rowcount
  //

  long nCurRows = 0;

  hr = GetRowCount(hstmt, &nCurRows);
  if (FAILED(hr))
    return hr;

  WCHAR szSQL[64];
  wsprintf(szSQL, L"Current Row count is %d", nCurRows+1);
  ShowResults(SysAllocString(szSQL), FALSE);
  wsprintf(szSQL, L"setting rowcount to be %d", nRows);
  ShowResults(SysAllocString(szSQL), FALSE);
  if (nCurRows <= nRows)
  {
    int i;
    for (i=nCurRows+1; i<=nRows; i++)
    {
      wsprintf(szSQL, L"insert into VcAccount values (%i, '')", 100000);
      rc = SQLExecDirect(hstmt, szSQL, SQL_NTS);
      if (SQL_FAILED(rc))
      {
        GetOdbcError(0,0,hstmt,&sErr);
        ShowResults(sErr, TRUE);
        break;
      }
    }
  }
  else
  {
    ShowResults(SysAllocString(L"truncating rows"), FALSE);
    wsprintf(szSQL, L"delete from VcAccount where AccountNo > %d", nRows);
    rc = SQLExecDirect(hstmt, szSQL, SQL_NTS);
    if (SQL_FAILED(rc))
    {
      GetOdbcError(0,0,hstmt,&sErr);
      ShowResults(sErr, TRUE);
    }
  }

  ShowResults(SysAllocString(L"Done setting row count"), FALSE);
  if (bGotConnection)
  {
    FreeConnection(henv, hdbc, hstmt);
  }
  else
  {
    SQLFreeStmt(hstmt, SQL_CLOSE);
  }

  return S_OK;

}

DWORD WINAPI CreateRowsThread ( LPVOID v )

Definition at line 217 of file bankthrds.Cpp.

{

  CreateRows((long)v, NULL);
  return S_OK;
}

HRESULT CreateSchema ( HSTMT hstmt )

Definition at line 1050 of file bankthrds.Cpp.

{
  HENV henv = 0;
  HDBC hdbc = 0;
  HRESULT hr;
  int i;
  RETCODE rc;
  BOOL bGotConnection = FALSE;

  if (!hstmt)
  {
    hr = GetConnection(&henv, &hdbc, &hstmt);
    bGotConnection = TRUE;
    if (hr)
      return hr;
  }
  ShowResults(SysAllocString(L"Creating schema"), FALSE);
  for (i=0; i< sizeof(sCreateSchema)/sizeof(sCreateSchema[0]); i++)
  {
    rc = SQLExecDirect(hstmt, sCreateSchema[i], SQL_NTS);
    if (SQL_FAILED(rc))
    {
      _ASSERTE(0);
      ShowResults(SysAllocString(L"Failed to create schema!"), TRUE);
      break;
    }
  }

  //
  //  we always need to add a row to the receipt table

  SQLExecDirect(hstmt, L"insert into receipt values(0)", SQL_NTS);

  if (bGotConnection)
  {
    FreeConnection(henv, hdbc, hstmt);
  }
  else
  {
    SQLFreeStmt(hstmt, SQL_CLOSE);
  }

  return S_OK;
}

DWORD WINAPI CreateSchemaThread ( LPVOID v )

Definition at line 724 of file bankthrds.Cpp.

{
  HENV henv = 0;
  HDBC hdbc = 0;
  HSTMT hstmt = 0;
  HRESULT hr= S_OK;
  BSTR sErr = NULL;
  WORD nSize = 255;
  hr = GetConnection(&henv, &hdbc, &hstmt);
  if (FAILED(hr))
  {
    ShowResults(SysAllocString(L"Done -- failed to get connection"), FALSE);
    return -1;
  }

  CreateSchema(hstmt);

  if (hr != S_OK)
  {
    GetOdbcError(henv, hdbc, hstmt, &sErr);
    ShowResults(sErr, TRUE);
  }
  else
  {
    ShowResults(SysAllocString(L"Done creating schema"), FALSE);
  }

  if (hstmt)
  {
    SQLFreeStmt(hstmt, SQL_DROP);
  }
  if (hdbc)
  {
    SQLDisconnect(hdbc);
    SQLFreeConnect(hdbc);
  }
  if (henv)
    SQLFreeEnv(henv);

  return 0;
}

HRESULT FreeConnection | ( | HENV | henv,
 |  | HDBC | hdbc,
 |  | HSTMT | hstmt
 | ) |  |

Definition at line 886 of file bankthrds.Cpp.

{
  ShowResults(SysAllocString(L"Freeing Connection"), FALSE);

  if (hstmt)
    SQLFreeStmt(hstmt, SQL_DROP);
  if (hdbc)
  {
    SQLDisconnect(hdbc);
    SQLFreeConnect(hdbc);
  }
  if (henv)
    SQLFreeEnv(henv);
  return S_OK;
}

HRESULT GetConnection | ( | HENV * | phEnv,
 |  | HDBC * | phdbc,
 |  | HSTMT * | phstmt
 | ) |  |

Definition at line 778 of file bankthrds.Cpp.

{
  WCHAR * sDsn = L"FILEDSN=OPBankSamples;DATABASE=pubs;UID=sa;PWD=;APP=VC Bank";
  RETCODE rc;
  HRESULT hr= S_OK;
  BSTR sErr = NULL;
  rc = SQLAllocEnv(&*phEnv);
  ASSERT_SQL_SUCCESS(rc);
  BSTR s;
  s = SysAllocString(L"Getting Connection");
  ShowResults(s, FALSE);
  rc = SQLAllocConnect(*phEnv, phdbc);
  if (SQL_FAILED(rc))
  {
    GetOdbcError(*phEnv, *phdbc, *phstmt, &sErr);
    ShowResults(sErr, TRUE);
    return (DWORD)E_FAIL;
  }
  WCHAR szConn[255];
  WORD nSize = 255;
  rc = SQLDriverConnect(*phdbc, NULL, (SQLWCHAR *)sDsn, SQL_NTS, (SQLWCHAR *)szConn, 255, (short *)&nSize, (UWORD)SQL_DRIVER_NOPROMPT);
  if (SQL_FAILED(rc))
  {
    GetOdbcError(*phEnv, *phdbc, *phstmt, &sErr);
    ShowResults(sErr, TRUE);
    SQLFreeEnv(*phEnv);
    return (DWORD)E_FAIL;
  }
  rc = SQLAllocStmt(*phdbc, phstmt); // generic stmt
  if (SQL_FAILED(rc))
  {
    GetOdbcError(*phEnv, *phdbc, *phstmt, &sErr);
    ShowResults(sErr, TRUE);
    SQLFreeConnect(*phdbc);
    SQLFreeEnv(*phEnv);
    return (DWORD)E_FAIL;
  }

  return S_OK;
}

void GetOdbcError | ( | HENV | henv,
 |  | HDBC | hdbc,
 |  | HSTMT | hstmt,
 |  | BSTR * | sErr
 | ) |  |

Definition at line 176 of file bankthrds.Cpp.

{
    WCHAR szSqlState[64];
    SDWORD NativeError;
    WCHAR szErr[512];
    SWORD cbErrorMsg;
    SQLError(henv, hdbc, hstmt, (SQLWCHAR *)szSqlState, &NativeError, (SQLWCHAR *)szErr, 511, &cbErrorMsg);
    *sErr = ::SysAllocString(szErr);
}

HRESULT GetRowCount | ( | HSTMT | hstmt,
 |  | long * | pRowCount
 | ) |  |

Definition at line 827 of file bankthrds.Cpp.

{

  HRESULT hr;
  HENV henv = 0;
  HDBC hdbc = 0;

  BOOL bGotConnection = FALSE;
  if (!hstmt)
  {
    hr = GetConnection(&henv, &hdbc, &hstmt);
    bGotConnection = TRUE;
    if (hr)
      return hr;
  }

  //
  //  get the current number of rows
  //

  int nRows = 0;
  long len = 0;
  RETCODE rc;
  ShowResults(SysAllocString(L"Getting Current Row Count"), FALSE);
  rc = SQLExecDirect(hstmt, L"select max(AccountNo) from VcAccount", SQL_NTS);
  while (SQLFetch(hstmt) == SQL_SUCCESS) // only get the first one for now
  {

    rc = SQLGetData(hstmt, 1, SQL_C_LONG, &nRows, 0, &len);
    if (SQL_FAILED(rc))
    {
      BSTR sErr;
      GetOdbcError(henv, hdbc, hstmt, &sErr);
      ShowResults(sErr, TRUE);
    }
  }

  *pRowCount = nRows;
  if (bGotConnection)
  {
    FreeConnection(henv, hdbc, hstmt);
  }
  else
  {
    SQLFreeStmt(hstmt, SQL_CLOSE);
  }

  return S_OK;
}

DWORD WINAPI MoveMoneyThread ( LPVOID v )

Definition at line 231 of file bankthrds.Cpp.

{

  THREADDATA * pTd = (THREADDATA *)v;
  HRESULT hr;
  BOOL bLocalStop = FALSE;
  BSTR s;
  EnumCoInit eCoInit = pTd -> eCoInit;
  if (eCoInit == CoInitRandom)
  {
    eCoInit = (EnumCoInit)RandInt(2);

  }
  switch (eCoInit)
  {
  case CoInitMTA:
    s = SysAllocString(L"Initializing COM (MTA)");
    ShowResults(s, FALSE);
    hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
    break;
  case CoInitSTA:
    s = SysAllocString(L"Initializing COM (STA)");
    ShowResults(s, FALSE);
    hr = CoInitialize(NULL);
    break;
  default:
    _ASSERTE(0);

  }
  WCHAR sz[MSG_BUF_SIZE];

  if (hr)
  {
    wsprintf(sz, L"CoInitialize or CoInitializeEx failed.  hr = %Hx", hr);
    ShowResults(SysAllocString(sz), TRUE);
    CoUninitialize();
    return hr;
  }

  CLSID clsid = CLSID_CMoveMoney;
  IID   iid = IID_IMoveMoney;
  switch (pTd -> eLang)
  {
  case VB:
    hr = CLSIDFromProgID(L"Bank.IMoveMoney", &clsid);
    if (FAILED(hr))
    {
      //ShowResults(SysAllocString(L"VB Account Not registered.  Using VC Account."), TRUE);
      clsid = CLSID_CMoveMoney;
    }
    break;
  case VC:
    break;
  case Java:
    ShowResults(SysAllocString(L"Java not supported (yet).  Using VC Account."), TRUE);
    break;
    // (04.26.00 mdl) Included support for Delphi.
  case Delphi:
        hr = CLSIDFromProgID(L"DelphiBank.MoveMoney", &clsid);
    IIDFromString(L"{A8C18C7A-4D78-475B-A5E7-96F73DB2CE8D}", &iid);
    if (FAILED(hr))
    {
      ShowResults(SysAllocString(L"Delphi MoveMoney Not registered.  Using VC Account."), TRUE);
      clsid = CLSID_CMoveMoney;
      iid = IID_IMoveMoney;
    }
        break;
  default:
    _ASSERTE(0);
  }

  int nCount = 0;

  BSTR sResult = 0;

  int nFrom = pTd -> nFrom;
  int nTo = pTd -> nTo;

  DWORD liStartTime = GetTickCount();

  IErrorInfo * pInfo = NULL;
  nCount = 0;
  IMoveMoney * pMove = NULL;
  DWORD dwTime;
  LARGE_INTEGER stop;
  LARGE_INTEGER start;
  while (g_bStop == FALSE && (nCount < pTd -> nIters)  && bLocalStop == FALSE )
  {

    if (pMove == NULL)
    {
      if (pTd -> bChatty)
      {
        ShowResults(SysAllocString(L"Creating MoveMoney"), FALSE);
      }

      // (04.26.00 mdl) Modified to use variable vs. fixed iid.
      //hr = CreateObject(clsid, CLSCTX_ALL, IID_IMoveMoney, (void **)&pMove, &dwTime);
      hr = CreateObject(clsid, CLSCTX_ALL, iid, (void **)&pMove, &dwTime);
      if (pTd -> bChatty)
      {
        wsprintf(sz, L"CoCreateInstance took %d ms", dwTime);
        ShowResults(SysAllocString(sz), FALSE);
      }
      if (hr)
      {

        wsprintf(sz, L"Failed to create the move money component! HRESULT: %lX", hr);
        ShowResults(SysAllocString(sz), TRUE);
        if (g_bAssertOnErrors)
          _ASSERTE(0);
        if (g_bRetry == FALSE) // don't exit for Wolfpack
          break; // exit thread if create fails
        else
        {
          ShowResults(SysAllocString(L"Waiting for 100 ms"), FALSE);
          Sleep(100);
        }
      }
    }

    if (pMove) // may be NULL w/ Wolfpack failover
    {
      IMoveMoneyOptions * pOptions = NULL;
      hr = pMove -> QueryInterface(IID_IMoveMoneyOptions, (void **)&pOptions);
      if (pOptions)
      {
        pOptions -> UseComPlus();
        pOptions -> SetAccountClsctx(CLSCTX_ALL);
        pOptions -> Release();
      }

      if (pTd -> bRandom)
      {
        nFrom = 0;
        nTo = 0;
        nFrom = RandInt(g_nRows);
        nFrom++; // we want 1 --> nRows
        nTo = RandInt(g_nRows);
        nTo++;
        if (nFrom > nTo) //always move from lowest to highest to stop deadlocks
        {
          int nTemp = nTo;
          nTo = nFrom;
          nFrom = nTemp;
        }
      }

      QueryPerformanceCounter( &start);
      hr = pMove -> Perform(nFrom, nTo, pTd -> nAmount, pTd -> nTranType, &sResult);
      QueryPerformanceCounter( &stop);
      if (pTd -> bChatty)
      {
        wsprintf(sz, L"MoveMoney Perform took %d ms",  1000*(stop.QuadPart-start.QuadPart)/g_PerfFreq.QuadPart);
        ShowResults(SysAllocString(sz), FALSE);
      }
      if (hr)
      {
        GetErrorInfo(NULL, &pInfo);
        if( pInfo )
        {
          pInfo -> GetDescription(&sResult);
          pInfo -> Release();
        }
        if (g_bAssertOnErrors)
          _ASSERTE(0);
        if (hr == E_UNEXPECTED && g_bStopOnODBCErrors) // E_UNEXPECTED returned on ODBC errors
        {
          if (!g_bRetry)
            bLocalStop = TRUE;
          else // retry for wolfpack
          {
            if (pMove)
            {
              pMove -> Release();
              pMove = NULL;
            }
          }
        }
        else  // non-ODBC error, stop all threads
        {
          if (!g_bRetry)
            g_bStop = TRUE;
          else // retry for wolfpack
          {
            if (pMove)
            {
              pMove -> Release();
              pMove = NULL;
            }
          }
        }
        *sz = NULL;
        if (!sResult)
        {
          if (hr == E_ACCESSDENIED)
            sResult = ::SysAllocString(L"Call failed due to security violation ");
          else
            sResult = ::SysAllocString(L"Call failed ");

        }
        wsprintf(sz, L"%s HRESULT: 0x%lx", sResult, hr);
        ShowResults(SysAllocString(sz), TRUE);
        SysFreeString(sResult); // not posting it
        sResult = NULL;
      }
      else
      {
        if (pTd -> bChatty)
          ShowResults(sResult, FALSE);
      }

      if (pTd -> bCreatePerIteration && pMove)
      {
        pMove -> Release();
        pMove = NULL;
      }
    }

    nCount++;
  }

  if (pMove)
  {
    pMove -> Release();
    pMove = NULL;
  }

  float t = (GetTickCount() - (float)liStartTime)  / 1000;
  _snwprintf(sz, MSG_BUF_SIZE, L"Done.  Time: %2.4f seconds for %ld iterations", t, nCount);
  ShowResults(SysAllocString(sz), FALSE);
  CoUninitialize();
  return 0;
}

unsigned long RandInt ( unsigned long ulMax )

Definition at line 95 of file bankthrds.Cpp.

{

  UnionInt64 seed;
  seed.l[1] = (unsigned long) TlsGetValue (g_ulTlsRandomHigh);
  seed.l[0] = (unsigned long) TlsGetValue (g_ulTlsRandomLow);

  if (seed.n == 0)
  {
    // initialize random number stream
    seed.l[1] = GetCurrentThreadId();
    seed.l[0] = GetTickCount();
    seed.n ^= g_llMultiplier;
    seed.i[3] = 0;
  }

  seed.n = seed.n * g_llMultiplier + g_llIncrement;
  seed.i[3] = 0;  // clear high 16 bits;

  TlsSetValue (g_ulTlsRandomHigh, (void*) seed.l[1]);
  TlsSetValue (g_ulTlsRandomLow, (void*) seed.l[0]);

  // shift so that high DWORD is zero, low DWORD contains most significant bits
  seed.i[0] = seed.i[1];
  seed.i[1] = seed.i[2];
  seed.i[2] = 0;

  seed.n *= ulMax;
  return seed.l[1];
}

void ShowResults | ( | BSTR | sString,
 |  | BOOL | bError
 | ) |  |

Definition at line 194 of file bankthrds.Cpp.

{

  if (bError)
  {
    ::PostMessage(g_hDlg, WM_SHOWERROR, (WPARAM)GetCurrentThreadId() , (LPARAM)sString);
  }
  else
  {
    ::PostMessage(g_hDlg, WM_SHOWRESULTS, (WPARAM)GetCurrentThreadId() , (LPARAM)sString);
  }

}

HRESULT VerifySchema ( HSTMT hstmt )

Definition at line 911 of file bankthrds.Cpp.

{
  HRESULT hr = S_OK;
  BOOL bGotConnection = FALSE;
  HENV henv = 0;
  HDBC hdbc = 0;
  if (!hstmt)
  {
    hr = GetConnection(&henv, &hdbc, &hstmt);
    bGotConnection = TRUE;
    if (hr)
      return hr;
  }

  ShowResults(SysAllocString(L"Verifying schema"), FALSE);
  int i;
  RETCODE rc;
  long nRowCount = 0;
  for (i=0;i< sizeof(sCheckSchema) / sizeof(sCheckSchema[0]); i++)
  {
    rc = SQLExecDirect(hstmt, sCheckSchema[i], SQL_NTS);
    if (SQL_FAILED(rc))
    {
      hr = E_FAIL;
      break;
    }

    rc = SQLRowCount(hstmt, &nRowCount);
    if (nRowCount != 1)
    {
      hr = E_FAIL;
      break;
    }
  }

  if (bGotConnection)
  {
    FreeConnection(henv, hdbc, hstmt);
  }
  else
  {
    SQLFreeStmt(hstmt, SQL_CLOSE);
  }

  return hr;

}

Variable Documentation

BOOL g_bAssertOnErrors

Definition at line 53 of file bankdlg.Cpp.

BOOL g_bRetry

Definition at line 55 of file bankdlg.Cpp.

BOOL g_bStop

Definition at line 52 of file bankdlg.Cpp.

BOOL g_bStopOnODBCErrors

Definition at line 54 of file bankdlg.Cpp.

HWND g_hDlg

Definition at line 51 of file bankdlg.Cpp.

HWND g_hWndResults

Definition at line 48 of file bankdlg.Cpp.

HWND g_hWndStop

Definition at line 50 of file bankdlg.Cpp.

HWND g_hWndSubmit

Definition at line 49 of file bankdlg.Cpp.

long g_nRows

Definition at line 56 of file bankdlg.Cpp.

LARGE_INTEGER g_PerfFreq

Definition at line 72 of file bankthrds.Cpp.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Object_Pooling/OPBankSample/OPBank/linkable.Cpp File Reference

  • Com
  • Services
  • Object_Pooling
  • OPBankSample
  • OPBank

linkable.Cpp File Reference

#include <stdafx.h>
#include "linkable.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Object_Pooling/OPBankSample/OPBank/linkable.h File Reference

  • Com
  • Services
  • Object_Pooling
  • OPBankSample
  • OPBank
Classes

linkable.h File Reference

#include <windows.h>

Go to the source code of this file.

Classes

class | CLinkable
class | CListHeader
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Object_Pooling/OPBankSample/OPBank/OPBank.Cpp File Reference

  • Com
  • Services
  • Object_Pooling
  • OPBankSample
  • OPBank
Functions | Variables

OPBank.Cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include "initguid.h"
#include "OPBank.h"
#include <SQL.h>
#include <SQLEXT.h>
#include "bankdlg.h"

Go to the source code of this file.

Functions

int WINAPI | _tWinMain (HINSTANCE hInstance, HINSTANCE, LPTSTR lpCmdLine, int)
LPCTSTR | FindOneOf (LPCTSTR p1, LPCTSTR p2)

Variables

CExeModule _Module
BOOL | g_bUnattended = FALSE
HACCEL | g_hAccel
WCHAR * | g_szLogFile = NULL

Function Documentation

int WINAPI _tWinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | ,
 |  | LPTSTR | lpCmdLine,
 |  | int |
 | ) |  |

Definition at line 95 of file OPBank.Cpp.

{
  lpCmdLine = GetCommandLine(); //this line necessary for _ATL_MIN_CRT
  HRESULT hRes = CoInitialize(NULL);
//  If you are running on NT 4.0 or higher you can use the following call
//  instead to make the EXE free threaded.
//  This means that calls come in on a random RPC thread
//  HRESULT hRes = CoInitializeEx(NULL, COINIT_MULTITHREADED);
  _ASSERTE(SUCCEEDED(hRes));
  _Module.Init(ObjectMap, hInstance);
  _Module.dwThreadID = GetCurrentThreadId();
  TCHAR szTokens[] = _T("-/");

  int nRet = 0;
  BOOL bRun = TRUE;
  LPCTSTR lpszToken = FindOneOf(lpCmdLine, szTokens);
  while (lpszToken != NULL)
  {
    if (lstrcmpi(lpszToken, _T("UnregServer"))==0)
    {
      _Module.UpdateRegistryFromResource(IDR_OPBank, FALSE);
      nRet = _Module.UnregisterServer();
      bRun = FALSE;
      break;
    }
    if (lstrcmpi(lpszToken, _T("RegServer"))==0)
    {
      _Module.UpdateRegistryFromResource(IDR_OPBank, TRUE);
      nRet = _Module.RegisterServer(TRUE);
      bRun = FALSE;
      break;
    }

    lpszToken = FindOneOf(lpszToken, szTokens);
  }

  TCHAR * p = lpCmdLine;

  while (*p != '-' && *p)
    p++;

  while (*p)
  {

    switch (*p)
    {

      case 'u':
      case 'U':
        g_bUnattended = TRUE;
        if (!g_szLogFile)
        {
          g_szLogFile = new WCHAR[64];
          lstrcpy(g_szLogFile, L"C:\\vcbank.log");
        }
        break;
      case 'f':
      case 'F':
        {

          if (g_szLogFile)
          {
            delete [] g_szLogFile;
            g_szLogFile = NULL;
          }
          p+=2; // skip "f:" or "f "
          TCHAR * q = p;
          while (*q  && *q != ' ')
            q++;

          int nChars =  q-p+1;
          g_szLogFile = new WCHAR[nChars];
          _ASSERTE(p!= NULL);
          lstrcpyn(g_szLogFile, p, nChars);
          p = q;
        }
        break;
      default:
        break;
    }

    p++;
  }

  if (bRun)
  {
    hRes = _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER,
      REGCLS_MULTIPLEUSE);
    _ASSERTE(SUCCEEDED(hRes));

    CBankDlg dlg;
    HWND hWnd = dlg.Create(NULL);
    if (hWnd)
    {
      g_hAccel = LoadAccelerators(_Module.m_hInst, MAKEINTRESOURCE(IDR_ACCELERATORS));
      _ASSERTE(g_hAccel);
      ShowWindow(hWnd, SW_SHOWNORMAL);
      MSG msg;
      while (GetMessage(&msg, 0, 0, 0))
      {
        if (!TranslateAccelerator(hWnd, g_hAccel, &msg))
        {
          if (!IsDialogMessage(hWnd, &msg))
          {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
          }
        }

      }
    }
    else
    {
      MessageBox(NULL, L"Unable to load dialog!", L"C Bank", MB_ICONSTOP);
    }
    _Module.RevokeClassObjects();
  }

  if (g_szLogFile)
    delete [] g_szLogFile;

  CoUninitialize();
  return nRet;
}

LPCTSTR FindOneOf | ( | LPCTSTR | p1,
 |  | LPCTSTR | p2
 | ) |  |

Definition at line 74 of file OPBank.Cpp.

{
    while (p1 != NULL && *p1 != NULL)
    {
        LPCTSTR p = p2;
        while (p != NULL && *p != NULL)
        {
            if (*p1 == *p)
                return CharNext(p1);
            p = CharNext(p);
        }
        p1 = CharNext(p1);
    }
    return NULL;
}

Variable Documentation

CExeModule _Module

Definition at line 64 of file OPBank.Cpp.

BOOL g_bUnattended = FALSE

Definition at line 41 of file OPBank.Cpp.

HACCEL g_hAccel

Definition at line 59 of file bankdlg.Cpp.

WCHAR* g_szLogFile = NULL

Definition at line 42 of file OPBank.Cpp.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Object_Pooling/OPBankSample/OPBank/OPBank.Idl File Reference

  • Com
  • Services
  • Object_Pooling
  • OPBankSample
  • OPBank
Functions | Variables

OPBank.Idl File Reference

Go to the source code of this file.

Functions

library OPBANKLib | importlib ("stdole32.tlb")
importlib ("stdole2.tlb")

Variables

import oaidl | idl

Function Documentation

library OPBANKLib importlib ( "stdole32.tlb" )
importlib ( "stdole2.tlb" )

Variable Documentation

import ocidl idl

Definition at line 7 of file OPBank.Idl.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Object_Pooling/OPBankSample/OPBank/resource.h File Reference

  • Com
  • Services
  • Object_Pooling
  • OPBankSample
  • OPBank
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | ACCOUNT 5
#define | CREATEROWS 107
#define | CREDIT 2
#define | DEBIT 1
#define | ID_AC_CREDIT 32774
#define | ID_AC_DEBIT 32773
#define | ID_ASSERT_ON_ERRORS 32777
#define | ID_COINIT_MTA 32675
#define | ID_COINIT_RANDOM 32677
#define | ID_COINIT_STA 32676
#define | ID_LANG_C 32791
#define | ID_LANG_DELPHI 32794
#define | ID_LANG_JAVA 32793
#define | ID_LANG_VB 32792
#define | ID_MM_CREDIT 32772
#define | ID_MM_DEBIT 32771
#define | ID_MM_TRANSFER 32770
#define | IDC_ACCOUNT 203
#define | IDC_ADD 224
#define | IDC_AMOUNT 216
#define | IDC_CHATTY 218
#define | IDC_CREATE_ROWS 207
#define | IDC_CREATE_TABLES 219
#define | IDC_CREDIT 213
#define | IDC_DEBIT 214
#define | IDC_DESCRIPTION 226
#define | IDC_FROM 204
#define | IDC_ITERS 209
#define | IDC_MOVEMONEY 202
#define | IDC_MTA 211
#define | IDC_ODBC_STOP 227
#define | IDC_REMOVE 226
#define | IDC_RESULTS 208
#define | IDC_ROWS 201
#define | IDC_RUN_SUITE 220
#define | IDC_STA 210
#define | IDC_STOP 212
#define | IDC_SUBMIT 200
#define | IDC_SUITE_STATUS 225
#define | IDC_THREADS 217
#define | IDC_TO 205
#define | IDC_VIEW_NEXT 221
#define | IDC_VIEW_PREV 222
#define | IDD_BANKDLG 101
#define | IDM_ACCOUNT_ALL 32803
#define | IDM_ADD 32787
#define | IDM_COPY 32796
#define | IDM_COPYALL 32797
#define | IDM_COPYERRORS 32798
#define | IDM_GO 32782
#define | IDM_KILL_THREADS 32784
#define | IDM_OPTION_CHATTY 32779
#define | IDM_OPTION_CREATE_ITERATION 32780
#define | IDM_OPTION_ODBC_ASSERT 32778
#define | IDM_OPTION_ODBC_STOP 32778
#define | IDM_POOL_TEST 32804
#define | IDM_PREV 32786
#define | IDM_RANDOM 32781
#define | IDM_RANDOM_COINIT 32790
#define | IDM_REMOVE 32788
#define | IDM_RETRY 32795
#define | IDM_RUN_SUITE 32789
#define | IDM_STOP 32783
#define | IDM_VIEW_NEXT 32785
#define | IDR_ACCELERATORS 202
#define | IDR_MENU 201
#define | IDR_OPBank 100
#define | IDS_PROJNAME 100
#define | MOVEMONEY 4
#define | POOLTEST 7
#define | TRANSFER 3
#define | VERIFY_SCHEMA 108

Define Documentation

#define ACCOUNT 5

Definition at line 9 of file resource.h.

#define CREATEROWS 107

Definition at line 14 of file resource.h.

#define CREDIT 2

Definition at line 6 of file resource.h.

#define DEBIT 1

Definition at line 5 of file resource.h.

#define ID_AC_CREDIT 32774

Definition at line 51 of file resource.h.

#define ID_AC_DEBIT 32773

Definition at line 50 of file resource.h.

#define ID_ASSERT_ON_ERRORS 32777

Definition at line 52 of file resource.h.

#define ID_COINIT_MTA 32675

Definition at line 44 of file resource.h.

#define ID_COINIT_RANDOM 32677

Definition at line 46 of file resource.h.

#define ID_COINIT_STA 32676

Definition at line 45 of file resource.h.

#define ID_LANG_C 32791

Definition at line 67 of file resource.h.

#define ID_LANG_DELPHI 32794

Definition at line 70 of file resource.h.

#define ID_LANG_JAVA 32793

Definition at line 69 of file resource.h.

#define ID_LANG_VB 32792

Definition at line 68 of file resource.h.

#define ID_MM_CREDIT 32772

Definition at line 49 of file resource.h.

#define ID_MM_DEBIT 32771

Definition at line 48 of file resource.h.

#define ID_MM_TRANSFER 32770

Definition at line 47 of file resource.h.

#define IDC_ACCOUNT 203

Definition at line 21 of file resource.h.

#define IDC_ADD 224

Definition at line 39 of file resource.h.

#define IDC_AMOUNT 216

Definition at line 32 of file resource.h.

#define IDC_CHATTY 218

Definition at line 34 of file resource.h.

#define IDC_CREATE_ROWS 207

Definition at line 24 of file resource.h.

#define IDC_CREATE_TABLES 219

Definition at line 35 of file resource.h.

#define IDC_CREDIT 213

Definition at line 30 of file resource.h.

#define IDC_DEBIT 214

Definition at line 31 of file resource.h.

#define IDC_DESCRIPTION 226

Definition at line 42 of file resource.h.

#define IDC_FROM 204

Definition at line 22 of file resource.h.

#define IDC_ITERS 209

Definition at line 26 of file resource.h.

#define IDC_MOVEMONEY 202

Definition at line 19 of file resource.h.

#define IDC_MTA 211

Definition at line 28 of file resource.h.

#define IDC_ODBC_STOP 227

Definition at line 43 of file resource.h.

#define IDC_REMOVE 226

Definition at line 41 of file resource.h.

#define IDC_RESULTS 208

Definition at line 25 of file resource.h.

#define IDC_ROWS 201

Definition at line 18 of file resource.h.

#define IDC_RUN_SUITE 220

Definition at line 36 of file resource.h.

#define IDC_STA 210

Definition at line 27 of file resource.h.

#define IDC_STOP 212

Definition at line 29 of file resource.h.

#define IDC_SUBMIT 200

Definition at line 16 of file resource.h.

#define IDC_SUITE_STATUS 225

Definition at line 40 of file resource.h.

#define IDC_THREADS 217

Definition at line 33 of file resource.h.

#define IDC_TO 205

Definition at line 23 of file resource.h.

#define IDC_VIEW_NEXT 221

Definition at line 37 of file resource.h.

#define IDC_VIEW_PREV 222

Definition at line 38 of file resource.h.

#define IDD_BANKDLG 101

Definition at line 13 of file resource.h.

#define IDM_ACCOUNT_ALL 32803

Definition at line 75 of file resource.h.

#define IDM_ADD 32787

Definition at line 63 of file resource.h.

#define IDM_COPY 32796

Definition at line 72 of file resource.h.

#define IDM_COPYALL 32797

Definition at line 73 of file resource.h.

#define IDM_COPYERRORS 32798

Definition at line 74 of file resource.h.

#define IDM_GO 32782

Definition at line 58 of file resource.h.

#define IDM_KILL_THREADS 32784

Definition at line 60 of file resource.h.

#define IDM_OPTION_CHATTY 32779

Definition at line 55 of file resource.h.

#define IDM_OPTION_CREATE_ITERATION 32780

Definition at line 56 of file resource.h.

#define IDM_OPTION_ODBC_ASSERT 32778

Definition at line 53 of file resource.h.

#define IDM_OPTION_ODBC_STOP 32778

Definition at line 54 of file resource.h.

#define IDM_POOL_TEST 32804

Definition at line 76 of file resource.h.

#define IDM_PREV 32786

Definition at line 62 of file resource.h.

#define IDM_RANDOM 32781

Definition at line 57 of file resource.h.

#define IDM_RANDOM_COINIT 32790

Definition at line 66 of file resource.h.

#define IDM_REMOVE 32788

Definition at line 64 of file resource.h.

#define IDM_RETRY 32795

Definition at line 71 of file resource.h.

#define IDM_RUN_SUITE 32789

Definition at line 65 of file resource.h.

#define IDM_STOP 32783

Definition at line 59 of file resource.h.

#define IDM_VIEW_NEXT 32785

Definition at line 61 of file resource.h.

#define IDR_ACCELERATORS 202

Definition at line 20 of file resource.h.

#define IDR_MENU 201

Definition at line 17 of file resource.h.

#define IDR_OPBank 100

Definition at line 12 of file resource.h.

#define IDS_PROJNAME 100

Definition at line 11 of file resource.h.

#define MOVEMONEY 4

Definition at line 8 of file resource.h.

#define POOLTEST 7

Definition at line 10 of file resource.h.

#define TRANSFER 3

Definition at line 7 of file resource.h.

#define VERIFY_SCHEMA 108

Definition at line 15 of file resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Object_Pooling/OPBankSample/OPBank/stdafx.Cpp File Reference

  • Com
  • Services
  • Object_Pooling
  • OPBankSample
  • OPBank

stdafx.Cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Object_Pooling/OPBankSample/OPBank/stdafx.h File Reference

  • Com
  • Services
  • Object_Pooling
  • OPBankSample
  • OPBank
Classes | Defines | Variables

stdafx.h File Reference

#include <atlbase.h>
#include <atlcom.h>
#include <shellapi.h>
#include <atlwin.h>

Go to the source code of this file.

Classes

class | CExeModule

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0500
#define | STRICT

Variables

CExeModule _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 16 of file stdafx.h.

#define _WIN32_WINNT 0x0500

Definition at line 14 of file stdafx.h.

#define STRICT

Definition at line 12 of file stdafx.h.

Variable Documentation

CExeModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Object_Pooling/PoolTest/PoolTest.Cpp File Reference

  • Com
  • Services
  • Object_Pooling
  • PoolTest
Functions | Variables

PoolTest.Cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include "PoolTest.h"
#include "testdlg.h"

Go to the source code of this file.

Functions

int WINAPI | _tWinMain (HINSTANCE hInstance, HINSTANCE, LPTSTR lpCmdLine, int)

Variables

CComModule | _Module

Function Documentation

int WINAPI _tWinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | ,
 |  | LPTSTR | lpCmdLine,
 |  | int |
 | ) |  |

Definition at line 39 of file PoolTest.Cpp.

{

    HRESULT hRes = CoInitializeEx(NULL, COINIT_MULTITHREADED);
    _ASSERTE(SUCCEEDED(hRes));

    _Module.Init(NULL, hInstance);

  // show our dialog
  CTestDlg *dlg = new CTestDlg;
  dlg->DoModal();
  delete dlg;

  CoUninitialize();

    _Module.Term();
    return 0;
}

Variable Documentation

CComModule _Module

Definition at line 31 of file PoolTest.Cpp.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Object_Pooling/PoolTest/PoolTest.h File Reference

  • Com
  • Services
  • Object_Pooling
  • PoolTest

PoolTest.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Object_Pooling/PoolTest/PoolTest.Idl File Reference

  • Com
  • Services
  • Object_Pooling
  • PoolTest
Variables

PoolTest.Idl File Reference

Go to the source code of this file.

Variables

library DummyLib

Variable Documentation

library DummyLib

Definition at line 7 of file PoolTest.Idl.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Object_Pooling/PoolTest/Resource.h File Reference

  • Com
  • Services
  • Object_Pooling
  • PoolTest
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_NUMBERWRITES 201
#define | IDD_TESTDLG 101
#define | IDR_PoolTest 100
#define | IDS_PROJNAME 100

Define Documentation

#define IDC_NUMBERWRITES 201

Definition at line 8 of file Resource.h.

#define IDD_TESTDLG 101

Definition at line 7 of file Resource.h.

#define IDR_PoolTest 100

Definition at line 6 of file Resource.h.

#define IDS_PROJNAME 100

Definition at line 5 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Object_Pooling/PoolTest/StdAfx.Cpp File Reference

  • Com
  • Services
  • Object_Pooling
  • PoolTest

StdAfx.Cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Object_Pooling/PoolTest/StdAfx.h File Reference

  • Com
  • Services
  • Object_Pooling
  • PoolTest
Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>
#include <atlwin.h>
#include <comdef.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0500
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 21 of file StdAfx.h.

#define _WIN32_WINNT 0x0500

Definition at line 19 of file StdAfx.h.

#define STRICT

Definition at line 17 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Object_Pooling/PoolTest/TestDlg.Cpp File Reference

  • Com
  • Services
  • Object_Pooling
  • PoolTest

TestDlg.Cpp File Reference

#include "stdafx.h"
#include "TestDlg.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Object_Pooling/PoolTest/TestDlg.h File Reference

  • Com
  • Services
  • Object_Pooling
  • PoolTest
Classes

TestDlg.h File Reference

#include "resource.h"
#include <atlhost.h>
#include <initguid.h>
#include "LogWriter\LogWriter_i.c"
#include "LogWriter\LogWriter.h"

Go to the source code of this file.

Classes

class CTestDlg
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Object_Pooling/PoolTest/LogWriter/DllDatax.c File Reference

  • Com
  • Services
  • Object_Pooling
  • PoolTest
  • LogWriter

DllDatax.c File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Object_Pooling/PoolTest/LogWriter/DllDatax.h File Reference

  • Com
  • Services
  • Object_Pooling
  • PoolTest
  • LogWriter

DllDatax.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Object_Pooling/PoolTest/LogWriter/LogFile.Cpp File Reference

  • Com
  • Services
  • Object_Pooling
  • PoolTest
  • LogWriter

LogFile.Cpp File Reference

#include "stdafx.h"
#include "LogWriter.h"
#include "LogFile.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Object_Pooling/PoolTest/LogWriter/LogFile.h File Reference

  • Com
  • Services
  • Object_Pooling
  • PoolTest
  • LogWriter
Classes

LogFile.h File Reference

#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Classes

class CLogFile
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Object_Pooling/PoolTest/LogWriter/LogWriter.Cpp File Reference

  • Com
  • Services
  • Object_Pooling
  • PoolTest
  • LogWriter
Functions | Variables

LogWriter.Cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include "LogWriter.h"
#include "dlldatax.h"
#include "LogWriter_i.c"
#include "LogFile.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 87 of file LogWriter.Cpp.

{
#ifdef _MERGE_PROXYSTUB
    if (PrxDllCanUnloadNow() != S_OK)
        return S_FALSE;
#endif
    return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 99 of file LogWriter.Cpp.

{
#ifdef _MERGE_PROXYSTUB
    if (PrxDllGetClassObject(rclsid, riid, ppv) == S_OK)
        return S_OK;
#endif
    return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID | lpReserved
 | ) |  |

Definition at line 67 of file LogWriter.Cpp.

{
    lpReserved;
#ifdef _MERGE_PROXYSTUB
    if (!PrxDllMain(hInstance, dwReason, lpReserved))
        return FALSE;
#endif
    if (dwReason == DLL_PROCESS_ATTACH)
    {
        _Module.Init(ObjectMap, hInstance, &LIBID_LOGWRITERLib);
        DisableThreadLibraryCalls(hInstance);
    }
    else if (dwReason == DLL_PROCESS_DETACH)
        _Module.Term();
    return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 111 of file LogWriter.Cpp.

{
#ifdef _MERGE_PROXYSTUB
    HRESULT hRes = PrxDllRegisterServer();
    if (FAILED(hRes))
        return hRes;
#endif
    // registers object, typelib and all interfaces in typelib
    return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 125 of file LogWriter.Cpp.

{
#ifdef _MERGE_PROXYSTUB
    PrxDllUnregisterServer();
#endif
    return _Module.UnregisterServer(TRUE);
}

Variable Documentation

CComModule _Module

Definition at line 57 of file LogWriter.Cpp.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Object_Pooling/PoolTest/LogWriter/LogWriter.Idl File Reference

  • Com
  • Services
  • Object_Pooling
  • PoolTest
  • LogWriter
Functions | Variables

LogWriter.Idl File Reference

Go to the source code of this file.

Functions

library LOGWRITERLib | importlib ("stdole32.tlb")
importlib ("stdole2.tlb")

Variables

interface DWORD | dwID
import oaidl | idl

Function Documentation

library LOGWRITERLib importlib ( "stdole32.tlb" )
importlib ( "stdole2.tlb" )

Variable Documentation

interface DWORD dwID

Definition at line 18 of file LogWriter.Idl.

import ocidl idl

Definition at line 7 of file LogWriter.Idl.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Object_Pooling/PoolTest/LogWriter/Resource.h File Reference

  • Com
  • Services
  • Object_Pooling
  • PoolTest
  • LogWriter
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_LOGFILE 101
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_LOGFILE 101

Definition at line 6 of file Resource.h.

#define IDS_PROJNAME 100

Definition at line 5 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Object_Pooling/PoolTest/LogWriter/StdAfx.Cpp File Reference

  • Com
  • Services
  • Object_Pooling
  • PoolTest
  • LogWriter

StdAfx.Cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Object_Pooling/PoolTest/LogWriter/StdAfx.h File Reference

  • Com
  • Services
  • Object_Pooling
  • PoolTest
  • LogWriter
Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>
#include <comdef.h>
#include <comsvcs.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0500
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 21 of file StdAfx.h.

#define _WIN32_WINNT 0x0500

Definition at line 19 of file StdAfx.h.

#define STRICT

Definition at line 17 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/StdAfx.Cpp File Reference

  • Com
  • Services
  • Queued_Components

StdAfx.Cpp File Reference

#include "stdafx.h"
#include <initguid.h>
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCJAVA/Components/Helper/DatabaseSettings.java File Reference

  • Com
  • Services
  • Queued_Components
  • QCJAVA
  • Components
  • Helper
Classes | Namespaces

DatabaseSettings.java File Reference

Go to the source code of this file.

Classes

interface | helper::DatabaseSettings

Namespaces

namespace | helper
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCJAVA/Components/qcNotify/_ShipStatus.java File Reference

  • Com
  • Services
  • Queued_Components
  • QCJAVA
  • Components
  • qcNotify
Classes | Namespaces

_ShipStatus.java File Reference

Go to the source code of this file.

Classes

class | qcnotify::_ShipStatus

Namespaces

namespace | qcnotify
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCJAVA/Components/qcNotify/INotify.java File Reference

  • Com
  • Services
  • Queued_Components
  • QCJAVA
  • Components
  • qcNotify
Classes | Namespaces

INotify.java File Reference

Go to the source code of this file.

Classes

interface | qcnotify::INotify
.interface(iid=6DD1E6EF-28C1-11D2-B5B6-00C04FC340EE, thread=AUTO, type=DUAL) More...

Namespaces

namespace | qcnotify
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCJAVA/Components/qcNotify/INotifyDefault.java File Reference

  • Com
  • Services
  • Queued_Components
  • QCJAVA
  • Components
  • qcNotify
Classes | Namespaces

INotifyDefault.java File Reference

Go to the source code of this file.

Classes

interface | qcnotify::INotifyDefault
.interface(iid=00020400-0000-0000-C000-000000000046, thread=AUTO, type=DUAL) More...

Namespaces

namespace | qcnotify
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCJAVA/Components/qcNotify/Notify.java File Reference

  • Com
  • Services
  • Queued_Components
  • QCJAVA
  • Components
  • qcNotify
Classes | Namespaces

Notify.java File Reference

Go to the source code of this file.

Classes

class | qcnotify::Notify
.register(clsid=6DD1E6F0-28C1-11D2-B5B6-00C04FC340EE, typelib=6DD1E6DC-28C1-11D2-B5B6-00C04FC340EE, version="1.0", description="Notify Class") More...

Namespaces

namespace | qcnotify
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCJAVA/Components/qcOrder/IOrder.java File Reference

  • Com
  • Services
  • Queued_Components
  • QCJAVA
  • Components
  • qcOrder
Classes | Namespaces

IOrder.java File Reference

Go to the source code of this file.

Classes

interface | qcorder::IOrder
.interface(iid=CB34A1A1-28C2-11D2-B5B6-00C04FC340EE, thread=AUTO, type=DUAL) More...

Namespaces

namespace | qcorder
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCJAVA/Components/qcOrder/IOrderDefault.java File Reference

  • Com
  • Services
  • Queued_Components
  • QCJAVA
  • Components
  • qcOrder
Classes | Namespaces

IOrderDefault.java File Reference

Go to the source code of this file.

Classes

interface | qcorder::IOrderDefault
.interface(iid=00020400-0000-0000-C000-000000000046, thread=AUTO, type=DUAL) More...

Namespaces

namespace | qcorder
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCJAVA/Components/qcOrder/Order.java File Reference

  • Com
  • Services
  • Queued_Components
  • QCJAVA
  • Components
  • qcOrder
Classes | Namespaces

Order.java File Reference

Go to the source code of this file.

Classes

class | qcorder::Order
.register(clsid=CB34A1A2-28C2-11D2-B5B6-00C04FC340EE, typelib=6DD1E6C2-28C1-11D2-B5B6-00C04FC340EE, version="1.0", description="Order Class") More...

Namespaces

namespace | qcorder
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCJAVA/Components/qcShip/IShip.java File Reference

  • Com
  • Services
  • Queued_Components
  • QCJAVA
  • Components
  • qcShip
Classes | Namespaces

IShip.java File Reference

Go to the source code of this file.

Classes

interface | qcship::IShip
.interface(iid=CB34A1A4-28C2-11D2-B5B6-00C04FC340EE, thread=AUTO, type=DUAL) More...

Namespaces

namespace | qcship
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCJAVA/Components/qcShip/IShipDefault.java File Reference

  • Com
  • Services
  • Queued_Components
  • QCJAVA
  • Components
  • qcShip
Classes | Namespaces

IShipDefault.java File Reference

Go to the source code of this file.

Classes

interface | qcship::IShipDefault
.interface(iid=00020400-0000-0000-C000-000000000046, thread=AUTO, type=DUAL) More...

Namespaces

namespace | qcship
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCJAVA/Components/qcShip/Ship.java File Reference

  • Com
  • Services
  • Queued_Components
  • QCJAVA
  • Components
  • qcShip
Classes | Namespaces

Ship.java File Reference

Go to the source code of this file.

Classes

class | qcship::Ship
.register(clsid=CB34A1A5-28C2-11D2-B5B6-00C04FC340EE, typelib=6DD1E6CF-28C1-11D2-B5B6-00C04FC340EE, version="1.0", description="Ship Class") More...

Namespaces

namespace | qcship
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp1/DataSourceNames.h File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp1
Variables

DataSourceNames.h File Reference

Go to the source code of this file.

Variables

LPCWSTR const | pszOrderDSN = "DSN=QCSampleOrder"
LPCWSTR const | pszPassword = ""
LPCWSTR const | pszShipDSN = "DSN=QCSampleShip"
LPCWSTR const | pszUserId = "sa"

Variable Documentation

LPCWSTR const pszOrderDSN = "DSN=QCSampleOrder"

Definition at line 25 of file DataSourceNames.h.

LPCWSTR const pszPassword = ""

Definition at line 28 of file DataSourceNames.h.

LPCWSTR const pszShipDSN = "DSN=QCSampleShip"

Definition at line 26 of file DataSourceNames.h.

LPCWSTR const pszUserId = "sa"

Definition at line 27 of file DataSourceNames.h.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp1/Driver/Driver.Cpp File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp1
  • Driver
Functions | Variables

Driver.Cpp File Reference

#include "stdafx.h"
#include "..\DataSourceNames.h"
#include <iostream>
#include <initguid.h>
#include <time.h>
#include <adoid.h>
#include <adoint.h>
#include "..\QCOrder\processFlags.h"
#include "..\QCOrder\QCOrder.h"

Go to the source code of this file.

Functions

HRESULT | CheckHR (HRESULT hr, LPCSTR pszVerb)
HRESULT | CreateOrder (long lOrderId, long lFlags)
HRESULT | ExecSQLStmt (LPCWSTR pszDSN, LPCWSTR pszSQLStmt)
int __cdecl | main ()

Variables

const int | nLineItemsPerOrder = 5
const int | nOrdersPerDriver = 100
const int | nSleepMilliseconds = 1000

Function Documentation

HRESULT CheckHR | ( | HRESULT | hr,
 |  | LPCSTR | pszVerb
 | ) |  |

Definition at line 155 of file Driver.Cpp.

{
  if (hr != S_OK)
  {
    std::cerr << pszVerb << " hr 0x" << std::hex << hr << '\n';
    _RPTF2(FAILED(hr) ? _CRT_ERROR : _CRT_WARN, "%s hr 0x%x\n", pszVerb, hr);
  }
  return hr;
}

HRESULT CreateOrder | ( | long | lOrderId,
 |  | long | lFlags
 | ) |  |

Definition at line 111 of file Driver.Cpp.

{
  _COM_SMARTPTR_TYPEDEF(IOrder, _uuidof(IOrder));

  IOrderPtr pOrder;

  HRESULT hr = pOrder.CreateInstance(_uuidof(Order));
  CheckHR(hr, "CoCreateInstance CLSID_Order");

  if (SUCCEEDED(hr))
  {
    hr = pOrder->put_OrderId(lOrderId);
    CheckHR(hr, "put_OrderId");
  }

  if (SUCCEEDED(hr))
  {
    hr = pOrder->put_CustomerId( (lOrderId % 1000) * (rand() % 1000) );
    CheckHR(hr, "put_CustomerId");
  }

  for (int ix = 1; ix <= nLineItemsPerOrder && SUCCEEDED(hr); ix++)
  {
    // Derive ItemId and quantity from time of day
    hr = pOrder->LineItem(lOrderId % 100 + ix, lOrderId % 10 + 2 * ix);
    CheckHR(hr, "LineItem");
  }

  if (SUCCEEDED(hr))
  {
    _RPT1(_CRT_WARN, "QCSamp1 %d Driver\n", lOrderId);
    hr = pOrder->Process(lFlags); // process the complete order
    CheckHR(hr, "Process");
  }
  return hr;
}

HRESULT ExecSQLStmt | ( | LPCWSTR | pszDSN,
 |  | LPCWSTR | pszSQLStmt
 | ) |  |

Definition at line 172 of file Driver.Cpp.

{
  CComPtr<ADOConnection> pADOConnection;

  HRESULT hr = CoCreateInstance(  CLSID_CADOConnection, NULL, CLSCTX_INPROC_SERVER,
                  IID_IADOConnection, (void **) &pADOConnection);
  CheckHR(hr, "CoCreateInstance CLSID_CADOConnection");

  if (SUCCEEDED(hr))
  {
    hr = pADOConnection->Open(  _bstr_t(pszDSN), _bstr_t(pszUserId),
                  _bstr_t(pszPassword), adOpenUnspecified);
    CheckHR(hr, "pADOConnection->Open");
  }

  if (SUCCEEDED(hr))
    hr = pADOConnection->Execute(_bstr_t(pszSQLStmt), NULL, adCmdText, NULL);

  return hr;
}

int __cdecl main ( void )

Definition at line 58 of file Driver.Cpp.

{
  long lFlags = 0;  // no database, vtable binding, not queued calls
//  lFlags |= processFlagLateBound;     // Invoke components via Automation (IDispatch)
//  lFlags |= processFlagWriteDB;     // Write to Order & Shipping tables
  lFlags |= processFlagQueuedComponents;  // Queued calls to Ship and Notify

  HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED); // init COM library
  CheckHR(hr, "CoInitializeEx");

  if (SUCCEEDED(hr))
  {
    if (lFlags & processFlagWriteDB)
    {
      ExecSQLStmt(pszOrderDSN,    // Create Order table
            L"create table QCSampleOrder "
            L"  (order_id  int, "
            L"   cust_id   int, "
            L"   line_no   int, "
            L"   item_id   int, "
            L"   quantity  int, "
            L"   ship_status varchar(25) )" );
      // Accept error - table may already exist

      ExecSQLStmt(pszShipDSN,     // Create ship table
            L"create table QCSampleShip "
            L"  (order_id int, "
            L"   cust_id  int, "
            L"   line_no  int, "
            L"   item_id  int, "
            L"   quantity int, "
            L"   ship_status_enum int )" );
      // Accept error - table may already exist
    }

    for (int ix = 0; ix < nOrdersPerDriver && SUCCEEDED(hr); ix++)
    {
      long lOrderId = time(NULL);
      hr = CreateOrder(lOrderId, lFlags);
      Sleep(nSleepMilliseconds);      // Wait between orders
    }

    CoUninitialize();
  }
  return hr;
}

Variable Documentation

const int nLineItemsPerOrder = 5

Definition at line 40 of file Driver.Cpp.

const int nOrdersPerDriver = 100

Definition at line 41 of file Driver.Cpp.

const int nSleepMilliseconds = 1000

Definition at line 42 of file Driver.Cpp.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp1/Driver/StdAfx.Cpp File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp1
  • Driver

StdAfx.Cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp1/Driver/StdAfx.h File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp1
  • Driver
Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>
#include <crtdbg.h>
#include <comsvcs.h>
#include <stdlib.h>
#include <vector>
#include <comdef.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0500
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 33 of file StdAfx.h.

#define _WIN32_WINNT 0x0500

Definition at line 32 of file StdAfx.h.

#define STRICT

Definition at line 29 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp1/QCNotify/Notify.Cpp File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp1
  • QCNotify

Notify.Cpp File Reference

#include "stdafx.h"
#include "..\DataSourceNames.h"
#include <adoid.h>
#include <adoint.h>
#include "QCNotify.h"
#include "Notify.h"
#include "..\QCOrder\processFlags.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp1/QCNotify/Notify.h File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp1
  • QCNotify
Classes

Notify.h File Reference

#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Classes

class CONotify
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp1/QCNotify/QCNotify.Cpp File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp1
  • QCNotify
Functions | Variables

QCNotify.Cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include "initguid.h"
#include <adoid.h>
#include "QCNotify.h"
#include "QCNotify_i.c"
#include "Notify.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 67 of file QCNotify.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 81 of file QCNotify.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 47 of file QCNotify.Cpp.

{
  if (dwReason == DLL_PROCESS_ATTACH)
  {
    _Module.Init(ObjectMap, hInstance);
    DisableThreadLibraryCalls(hInstance);
  }
  else if (dwReason == DLL_PROCESS_DETACH)
    _Module.Term();
  return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 93 of file QCNotify.Cpp.

{
  // registers object, typelib and all interfaces in typelib
  return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 106 of file QCNotify.Cpp.

{
  _Module.UnregisterServer();
  return S_OK;
}

Variable Documentation

CComModule _Module

Definition at line 31 of file QCNotify.Cpp.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp1/QCNotify/QCNotify.Idl File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp1
  • QCNotify
Typedefs | Enumerations | Functions | Variables

QCNotify.Idl File Reference

#include "mtxattr.h"

Go to the source code of this file.

Typedefs

typedef enum _ShipStatus | ShipStatus

Enumerations

enum _ShipStatus {
ssUnprocessed = 0, ssShipped = 1, ssBackOrdered = 2, ssNotStocked = 3,
ssUnrecognizedItem = 4, ssUnprocessed = 0, ssShipped = 1, ssBackOrdered = 2,
ssNotStocked = 3, ssUnrecognizedItem = 4
}

Functions

interface propput HRESULT | CustomerId ([in] long lCustomerId)
library QCNOTIFYLib | importlib ("stdole2.tlb")
HRESULT | LineItem ([in] long lItemId,[in] long lQuantity,[in] ShipStatus shipStatus)
HRESULT | OrderId ([in] long lOrderId)
HRESULT | Process ([in] long lFlags)

Variables

import oaidl | idl

Typedef Documentation

typedef enum _ShipStatus ShipStatus

Enumeration Type Documentation

enum _ShipStatus
Enumerator:
ssUnprocessed
ssShipped
ssBackOrdered
ssNotStocked
ssUnrecognizedItem
ssUnprocessed
ssShipped
ssBackOrdered
ssNotStocked
ssUnrecognizedItem

Definition at line 28 of file QCNotify.Idl.

{
  ssUnprocessed   = 0,  // as yet unprocessed
  ssShipped     = 1,  // item is on its way
  ssBackOrdered   = 2,  // item ordered from supplier
  ssNotStocked    = 3,  // we no longer stock this item
  ssUnrecognizedItem  = 4   // item identifier not recognized
} ShipStatus;

Function Documentation

interface propput HRESULT CustomerId ( [in] long lCustomerId )
library QCNOTIFYLib importlib ( "stdole2.tlb" )
HRESULT LineItem | ( | [in] long | lItemId,
 |  | [in] long | lQuantity,
 |  | [in] ShipStatus | shipStatus
 | ) |  |
HRESULT OrderId ( [in] long lOrderId ) [set]
HRESULT Process ( [in] long lFlags )

Variable Documentation

import oaidl idl

Definition at line 24 of file QCNotify.Idl.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp1/QCNotify/Resource.h File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp1
  • QCNotify
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_NOTIFY 102
#define | IDR_ORDER 101
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_NOTIFY 102

Definition at line 7 of file Resource.h.

#define IDR_ORDER 101

Definition at line 6 of file Resource.h.

#define IDS_PROJNAME 100

Definition at line 5 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp1/QCNotify/StdAfx.Cpp File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp1
  • QCNotify

StdAfx.Cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp1/QCNotify/StdAfx.h File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp1
  • QCNotify
Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>
#include <crtdbg.h>
#include <comsvcs.h>
#include <stdlib.h>
#include <vector>
#include <comdef.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0500
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 33 of file StdAfx.h.

#define _WIN32_WINNT 0x0500

Definition at line 32 of file StdAfx.h.

#define STRICT

Definition at line 29 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp1/QCOrder/Order.Cpp File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp1
  • QCOrder

Order.Cpp File Reference

#include "stdafx.h"
#include "..\DataSourceNames.h"
#include <adoid.h>
#include <adoint.h>
#include "QCOrder.h"
#include "Order.h"
#include "..\QCOrder\processFlags.h"
#include "..\QCShip\QCShip.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp1/QCOrder/Order.h File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp1
  • QCOrder
Classes

Order.h File Reference

#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Classes

class COrder
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp1/QCOrder/processFlags.h File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp1
  • QCOrder
Variables

processFlags.h File Reference

Go to the source code of this file.

Variables

const long | processFlagLateBound = 2
const long | processFlagQueuedComponents = 4
const long | processFlagWriteDB = 1

Variable Documentation

const long processFlagLateBound = 2

Definition at line 28 of file processFlags.h.

const long processFlagQueuedComponents = 4

Definition at line 29 of file processFlags.h.

const long processFlagWriteDB = 1

Definition at line 27 of file processFlags.h.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp1/QCOrder/QCOrder.Cpp File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp1
  • QCOrder
Functions | Variables

QCOrder.Cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include "initguid.h"
#include <adoid.h>
#include "../QCShip/QCShip.h"
#include "../QCShip/QCShip_i.c"
#include "QCOrder.h"
#include "QCOrder_i.c"
#include "Order.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 68 of file QCOrder.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 82 of file QCOrder.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 48 of file QCOrder.Cpp.

{
  if (dwReason == DLL_PROCESS_ATTACH)
  {
    _Module.Init(ObjectMap, hInstance);
    DisableThreadLibraryCalls(hInstance);
  }
  else if (dwReason == DLL_PROCESS_DETACH)
    _Module.Term();
  return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 94 of file QCOrder.Cpp.

{
  // registers object, typelib and all interfaces in typelib
  return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 107 of file QCOrder.Cpp.

{
  _Module.UnregisterServer();
  return S_OK;
}

Variable Documentation

CComModule _Module

Definition at line 32 of file QCOrder.Cpp.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp1/QCOrder/QCOrder.Idl File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp1
  • QCOrder
Functions | Variables

QCOrder.Idl File Reference

#include "mtxattr.h"

Go to the source code of this file.

Functions

interface propput HRESULT | CustomerId ([in] long lCustomerId)
library QCORDERLib | importlib ("stdole2.tlb")
HRESULT | LineItem ([in] long lItemId,[in] long lQuantity)
HRESULT | OrderId ([in] long lOrderId)
HRESULT | Process ([in] long lFlags)

Variables

import oaidl | idl

Function Documentation

interface propput HRESULT CustomerId ( [in] long lCustomerId )
library QCORDERLib importlib ( "stdole2.tlb" )
HRESULT LineItem | ( | [in] long | lItemId,
 |  | [in] long | lQuantity
 | ) |  |
HRESULT OrderId ( [in] long lOrderId ) [set]
HRESULT Process ( [in] long lFlags )

Variable Documentation

import oaidl idl

Definition at line 23 of file QCOrder.Idl.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp1/QCOrder/Resource.h File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp1
  • QCOrder
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_ORDER 101
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_ORDER 101

Definition at line 6 of file Resource.h.

#define IDS_PROJNAME 100

Definition at line 5 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp1/QCOrder/StdAfx.Cpp File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp1
  • QCOrder

StdAfx.Cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp1/QCOrder/StdAfx.h File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp1
  • QCOrder
Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>
#include <crtdbg.h>
#include <comsvcs.h>
#include <stdlib.h>
#include <vector>
#include <comdef.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0500
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 33 of file StdAfx.h.

#define _WIN32_WINNT 0x0500

Definition at line 32 of file StdAfx.h.

#define STRICT

Definition at line 29 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp1/QCShip/QCShip.Cpp File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp1
  • QCShip
Functions | Variables

QCShip.Cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include "initguid.h"
#include <adoid.h>
#include "..\QCNotify\QCNotify.h"
#include "..\QCNotify\QCNotify_i.c"
#include "QCShip.h"
#include "QCShip_i.c"
#include "Ship.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 69 of file QCShip.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 83 of file QCShip.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 49 of file QCShip.Cpp.

{
  if (dwReason == DLL_PROCESS_ATTACH)
  {
    _Module.Init(ObjectMap, hInstance);
    DisableThreadLibraryCalls(hInstance);
  }
  else if (dwReason == DLL_PROCESS_DETACH)
    _Module.Term();
  return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 96 of file QCShip.Cpp.

{
  // registers object, typelib and all interfaces in typelib
  return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 109 of file QCShip.Cpp.

{
  _Module.UnregisterServer();
  return S_OK;
}

Variable Documentation

CComModule _Module

Definition at line 33 of file QCShip.Cpp.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp1/QCShip/QCShip.Idl File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp1
  • QCShip
Functions | Variables

QCShip.Idl File Reference

#include "mtxattr.h"

Go to the source code of this file.

Functions

interface propput HRESULT | CustomerId ([in] long lCustomerId)
library QCSHIPLib | importlib ("stdole2.tlb")
HRESULT | LineItem ([in] long lItemId,[in] long lQuantity)
HRESULT | OrderId ([in] long lOrderId)
HRESULT | Process ([in] long lFlags)

Variables

import oaidl | idl

Function Documentation

interface propput HRESULT CustomerId ( [in] long lCustomerId )
library QCSHIPLib importlib ( "stdole2.tlb" )
HRESULT LineItem | ( | [in] long | lItemId,
 |  | [in] long | lQuantity
 | ) |  |
HRESULT OrderId ( [in] long lOrderId ) [set]
HRESULT Process ( [in] long lFlags )

Variable Documentation

import oaidl idl

Definition at line 25 of file QCShip.Idl.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp1/QCShip/Resource.h File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp1
  • QCShip
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_SHIP 101
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_SHIP 101

Definition at line 6 of file Resource.h.

#define IDS_PROJNAME 100

Definition at line 5 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp1/QCShip/Ship.Cpp File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp1
  • QCShip

Ship.Cpp File Reference

#include "stdafx.h"
#include "..\DataSourceNames.h"
#include <adoid.h>
#include <adoint.h>
#include "QCShip.h"
#include "Ship.h"
#include "..\QCOrder\processFlags.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp1/QCShip/Ship.h File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp1
  • QCShip
Classes

Ship.h File Reference

#include "resource.h"
#include "..\QCNotify\QCNotify.h"

Go to the source code of this file.

Classes

class COShip
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp1/QCShip/StdAfx.Cpp File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp1
  • QCShip

StdAfx.Cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp1/QCShip/StdAfx.h File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp1
  • QCShip
Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>
#include <crtdbg.h>
#include <comsvcs.h>
#include <stdlib.h>
#include <vector>
#include <comdef.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0500
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 33 of file StdAfx.h.

#define _WIN32_WINNT 0x0500

Definition at line 32 of file StdAfx.h.

#define STRICT

Definition at line 29 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp2/DataSourceNames.h File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp2
Variables

DataSourceNames.h File Reference

Go to the source code of this file.

Variables

LPCWSTR const | pszOrderDSN = "DSN=QCSampleOrder"
LPCWSTR const | pszPassword = ""
LPCWSTR const | pszShipDSN = "DSN=QCSampleShip"
LPCWSTR const | pszUserId = "sa"

Variable Documentation

LPCWSTR const pszOrderDSN = "DSN=QCSampleOrder"

Definition at line 17 of file DataSourceNames.h.

LPCWSTR const pszPassword = ""

Definition at line 20 of file DataSourceNames.h.

LPCWSTR const pszShipDSN = "DSN=QCSampleShip"

Definition at line 18 of file DataSourceNames.h.

LPCWSTR const pszUserId = "sa"

Definition at line 19 of file DataSourceNames.h.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp2/Driver/Driver.Cpp File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp2
  • Driver
Functions | Variables

Driver.Cpp File Reference

#include "stdafx.h"
#include "..\DataSourceNames.h"
#include <iostream>
#include <initguid.h>
#include <adoid.h>
#include <adoint.h>
#include "..\QCOrder\processFlags.h"
#include "..\QCOrder\QCOrder.h"

Go to the source code of this file.

Functions

HRESULT | CheckHR (HRESULT hr, LPCSTR pszVerb)
HRESULT | CreateOrder (long lOrderId, long lFlags)
HRESULT | ExecSQLStmt (LPCWSTR pszDSN, LPCWSTR pszSQLStmt)
int __cdecl | main ()

Variables

const int | nLineItemsPerOrder = 5
const int | nOrdersPerDriver = 100
const int | nSleepMilliseconds = 250

Function Documentation

HRESULT CheckHR | ( | HRESULT | hr,
 |  | LPCSTR | pszVerb
 | ) |  |

Definition at line 142 of file Driver.Cpp.

{
  if (hr != S_OK)
  {
    std::cerr << pszVerb << " hr 0x" << std::hex << hr << '\n';
    _RPTF2(FAILED(hr) ? _CRT_ERROR : _CRT_WARN, "%s hr 0x%x\n", pszVerb, hr);
  }
  return hr;
}

HRESULT CreateOrder | ( | long | lOrderId,
 |  | long | lFlags
 | ) |  |

Definition at line 98 of file Driver.Cpp.

{
  _COM_SMARTPTR_TYPEDEF(IOrder, _uuidof(IOrder));

  IOrderPtr pOrder;

  HRESULT hr = pOrder.CreateInstance(_uuidof(Order));
  CheckHR(hr, "CoCreateInstance CLSID_Order");

  if (SUCCEEDED(hr))
  {
    hr = pOrder->put_OrderId(lOrderId);
    CheckHR(hr, "put_OrderId");
  }

  if (SUCCEEDED(hr))
  {
    hr = pOrder->put_CustomerId( (lOrderId % 1000) * (rand() % 1000) );
    CheckHR(hr, "put_CustomerId");
  }

  for (int ix = 1; ix <= nLineItemsPerOrder && SUCCEEDED(hr); ix++)
  {
    // Derive ItemId and quantity from time of day
    hr = pOrder->LineItem(lOrderId % 100 + ix, lOrderId % 10 + 2 * ix);
    CheckHR(hr, "LineItem");
  }

  if (SUCCEEDED(hr))
  {
    _RPT1(_CRT_WARN, "QCSamp2 %d Driver\n", lOrderId);
    hr = pOrder->Process(lFlags); // process the complete order
    CheckHR(hr, "Process");
  }
  return hr;
}

HRESULT ExecSQLStmt | ( | LPCWSTR | pszDSN,
 |  | LPCWSTR | pszSQLStmt
 | ) |  |

Definition at line 159 of file Driver.Cpp.

{
  CComPtr<ADOConnection> pADOConnection;

  HRESULT hr = CoCreateInstance(  CLSID_CADOConnection, NULL, CLSCTX_INPROC_SERVER,
                  IID_IADOConnection, (void **) &pADOConnection);
  CheckHR(hr, "CoCreateInstance CLSID_CADOConnection");

  if (SUCCEEDED(hr))
  {
    hr = pADOConnection->Open(  _bstr_t(pszDSN), _bstr_t(pszUserId),
                  _bstr_t(pszPassword), adOpenUnspecified);
    CheckHR(hr, "pADOConnection->Open");
  }

  if (SUCCEEDED(hr))
    hr = pADOConnection->Execute(_bstr_t(pszSQLStmt), NULL, adCmdText, NULL);

  return hr;
}

int __cdecl main ( void )

Definition at line 45 of file Driver.Cpp.

{
  long lFlags = 0;  // no database, vtable binding, not queued calls
//  lFlags |= processFlagLateBound;     // Invoke components via Automation (IDispatch)
//  lFlags |= processFlagWriteDB;     // Write to Order & Shipping tables
  lFlags |= processFlagQueuedComponents;  // Queued calls to Ship and Notify

  HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED); // init COM library
  CheckHR(hr, "CoInitializeEx");

  if (SUCCEEDED(hr))
  {
    if (lFlags & processFlagWriteDB)
    {
      ExecSQLStmt(pszOrderDSN,    // Create Order table
            L"create table QCSampleOrder "
            L"  (order_id  int, "
            L"   cust_id   int, "
            L"   line_no   int, "
            L"   item_id   int, "
            L"   quantity  int, "
            L"   ship_status varchar(25) )" );
      // Accept error - table may already exist

      ExecSQLStmt(pszShipDSN,     // Create ship table
            L"create table QCSampleShip "
            L"  (order_id int, "
            L"   cust_id  int, "
            L"   line_no  int, "
            L"   item_id  int, "
            L"   quantity int, "
            L"   ship_status_enum int )" );
      // Accept error - table may already exist
    }

    for (int ix = 0; ix < nOrdersPerDriver && SUCCEEDED(hr); ix++)
    {
      long lOrderId = time(NULL);
      hr = CreateOrder(lOrderId, lFlags);
      Sleep(nSleepMilliseconds);      // Wait between orders
    }

    CoUninitialize();
  }
  return hr;
}

Variable Documentation

const int nLineItemsPerOrder = 5

Definition at line 27 of file Driver.Cpp.

const int nOrdersPerDriver = 100

Definition at line 28 of file Driver.Cpp.

const int nSleepMilliseconds = 250

Definition at line 29 of file Driver.Cpp.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp2/Driver/StdAfx.Cpp File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp2
  • Driver

StdAfx.Cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp2/Driver/StdAfx.h File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp2
  • Driver
Defines

StdAfx.h File Reference

#include <atlbase.h>
#include <crtdbg.h>
#include <comsvcs.h>
#include <stdlib.h>
#include <time.h>
#include <comdef.h>

Go to the source code of this file.

Defines

#define | _WIN32_WINNT 0x0500
#define | STRICT

Define Documentation

#define _WIN32_WINNT 0x0500

Definition at line 15 of file StdAfx.h.

#define STRICT

Definition at line 12 of file StdAfx.h.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp2/QCNotify/Notify.Cpp File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp2
  • QCNotify

Notify.Cpp File Reference

#include "stdafx.h"
#include "..\DataSourceNames.h"
#include <adoid.h>
#include <adoint.h>
#include "QCNotify.h"
#include "Notify.h"
#include "..\QCOrder\processFlags.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp2/QCNotify/Notify.h File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp2
  • QCNotify
Classes

Notify.h File Reference

#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Classes

class CONotify
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp2/QCNotify/QCNotify.Cpp File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp2
  • QCNotify
Functions | Variables

QCNotify.Cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include "initguid.h"
#include <adoid.h>
#include "QCNotify.h"
#include "QCNotify_i.c"
#include "Notify.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 37 of file QCNotify.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 45 of file QCNotify.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 22 of file QCNotify.Cpp.

{
  if (dwReason == DLL_PROCESS_ATTACH)
  {
    _Module.Init(ObjectMap, hInstance);
    DisableThreadLibraryCalls(hInstance);
  }
  else if (dwReason == DLL_PROCESS_DETACH)
    _Module.Term();
  return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 53 of file QCNotify.Cpp.

{
  // registers object, typelib and all interfaces in typelib
  return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 62 of file QCNotify.Cpp.

{
  _Module.UnregisterServer();
  return S_OK;
}

Variable Documentation

CComModule _Module

Definition at line 12 of file QCNotify.Cpp.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp2/QCNotify/QCNotify.Idl File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp2
  • QCNotify
Typedefs | Enumerations | Functions | Variables

QCNotify.Idl File Reference

#include "mtxattr.h"

Go to the source code of this file.

Typedefs

typedef enum _ShipStatus | ShipStatus

Enumerations

enum _ShipStatus {
ssUnprocessed = 0, ssShipped = 1, ssBackOrdered = 2, ssNotStocked = 3,
ssUnrecognizedItem = 4, ssUnprocessed = 0, ssShipped = 1, ssBackOrdered = 2,
ssNotStocked = 3, ssUnrecognizedItem = 4
}

Functions

interface propput HRESULT | CustomerId ([in] long lCustomerId)
library QCNOTIFYLib | importlib ("stdole2.tlb")
HRESULT | LineItem ([in] long lItemId,[in] long lQuantity,[in] ShipStatus shipStatus)
HRESULT | OrderId ([in] long lOrderId)
HRESULT | Process ([in] long lFlags)

Variables

import oaidl | idl

Typedef Documentation

typedef enum _ShipStatus ShipStatus

Enumeration Type Documentation

enum _ShipStatus
Enumerator:
ssUnprocessed
ssShipped
ssBackOrdered
ssNotStocked
ssUnrecognizedItem
ssUnprocessed
ssShipped
ssBackOrdered
ssNotStocked
ssUnrecognizedItem

Definition at line 21 of file QCNotify.Idl.

{
  ssUnprocessed   = 0,  // as yet unprocessed
  ssShipped     = 1,  // item is on its way
  ssBackOrdered   = 2,  // item ordered from supplier
  ssNotStocked    = 3,  // we no longer stock this item
  ssUnrecognizedItem  = 4   // item identifier not recognized
} ShipStatus;

Function Documentation

interface propput HRESULT CustomerId ( [in] long lCustomerId )
library QCNOTIFYLib importlib ( "stdole2.tlb" )
HRESULT LineItem | ( | [in] long | lItemId,
 |  | [in] long | lQuantity,
 |  | [in] ShipStatus | shipStatus
 | ) |  |
HRESULT OrderId ( [in] long lOrderId ) [set]
HRESULT Process ( [in] long lFlags )

Variable Documentation

import oaidl idl

Definition at line 17 of file QCNotify.Idl.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp2/QCNotify/Resource.h File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp2
  • QCNotify
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_NOTIFY 102
#define | IDR_ORDER 101
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_NOTIFY 102

Definition at line 7 of file Resource.h.

#define IDR_ORDER 101

Definition at line 6 of file Resource.h.

#define IDS_PROJNAME 100

Definition at line 5 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp2/QCNotify/StdAfx.Cpp File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp2
  • QCNotify

StdAfx.Cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp2/QCNotify/StdAfx.h File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp2
  • QCNotify
Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>
#include <crtdbg.h>
#include <comsvcs.h>
#include <stdlib.h>
#include <vector>
#include <comdef.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0500
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 16 of file StdAfx.h.

#define _WIN32_WINNT 0x0500

Definition at line 15 of file StdAfx.h.

#define STRICT

Definition at line 12 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp2/QCOrder/Order.Cpp File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp2
  • QCOrder

Order.Cpp File Reference

#include "stdafx.h"
#include "..\DataSourceNames.h"
#include <adoid.h>
#include <adoint.h>
#include "QCOrder.h"
#include "Order.h"
#include "..\QCOrder\processFlags.h"
#include "..\QCShip2\QCShip2.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp2/QCOrder/Order.h File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp2
  • QCOrder
Classes

Order.h File Reference

#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Classes

class COrder
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp2/QCOrder/processFlags.h File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp2
  • QCOrder
Variables

processFlags.h File Reference

Go to the source code of this file.

Variables

const long | processFlagLateBound = 2
const long | processFlagQueuedComponents = 4
const long | processFlagWriteDB = 1

Variable Documentation

const long processFlagLateBound = 2

Definition at line 21 of file processFlags.h.

const long processFlagQueuedComponents = 4

Definition at line 22 of file processFlags.h.

const long processFlagWriteDB = 1

Definition at line 20 of file processFlags.h.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp2/QCOrder/QCOrder.Cpp File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp2
  • QCOrder
Functions | Variables

QCOrder.Cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include "initguid.h"
#include <adoid.h>
#include "../QCShip2/QCShip2.h"
#include "../QCShip2/QCShip2_i.c"
#include "QCOrder.h"
#include "QCOrder_i.c"
#include "Order.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 38 of file QCOrder.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 46 of file QCOrder.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 23 of file QCOrder.Cpp.

{
  if (dwReason == DLL_PROCESS_ATTACH)
  {
    _Module.Init(ObjectMap, hInstance);
    DisableThreadLibraryCalls(hInstance);
  }
  else if (dwReason == DLL_PROCESS_DETACH)
    _Module.Term();
  return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 54 of file QCOrder.Cpp.

{
  // registers object, typelib and all interfaces in typelib
  return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 63 of file QCOrder.Cpp.

{
  _Module.UnregisterServer();
  return S_OK;
}

Variable Documentation

CComModule _Module

Definition at line 13 of file QCOrder.Cpp.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp2/QCOrder/QCOrder.Idl File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp2
  • QCOrder
Functions | Variables

QCOrder.Idl File Reference

#include "mtxattr.h"

Go to the source code of this file.

Functions

interface propput HRESULT | CustomerId ([in] long lCustomerId)
library QCORDERLib | importlib ("stdole2.tlb")
HRESULT | LineItem ([in] long lItemId,[in] long lQuantity)
HRESULT | OrderId ([in] long lOrderId)
HRESULT | Process ([in] long lFlags)

Variables

import oaidl | idl

Function Documentation

interface propput HRESULT CustomerId ( [in] long lCustomerId )
library QCORDERLib importlib ( "stdole2.tlb" )
HRESULT LineItem | ( | [in] long | lItemId,
 |  | [in] long | lQuantity
 | ) |  |
HRESULT OrderId ( [in] long lOrderId ) [set]
HRESULT Process ( [in] long lFlags )

Variable Documentation

import oaidl idl

Definition at line 16 of file QCOrder.Idl.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp2/QCOrder/Resource.h File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp2
  • QCOrder
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_ORDER 101
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_ORDER 101

Definition at line 6 of file Resource.h.

#define IDS_PROJNAME 100

Definition at line 5 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp2/QCOrder/StdAfx.Cpp File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp2
  • QCOrder

StdAfx.Cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp2/QCOrder/StdAfx.h File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp2
  • QCOrder
Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>
#include <crtdbg.h>
#include <comsvcs.h>
#include <stdlib.h>
#include <vector>
#include <comdef.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0500
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 16 of file StdAfx.h.

#define _WIN32_WINNT 0x0500

Definition at line 15 of file StdAfx.h.

#define STRICT

Definition at line 12 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp2/QCShip2/QCShip2.Cpp File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp2
  • QCShip2
Functions | Variables

QCShip2.Cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include "initguid.h"
#include <adoid.h>
#include "..\QCNotify\QCNotify.h"
#include "..\QCNotify\QCNotify_i.c"
#include "QCShip2.h"
#include "QCShip2_i.c"
#include "Ship2.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 39 of file QCShip2.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 47 of file QCShip2.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 24 of file QCShip2.Cpp.

{
  if (dwReason == DLL_PROCESS_ATTACH)
  {
    _Module.Init(ObjectMap, hInstance);
    DisableThreadLibraryCalls(hInstance);
  }
  else if (dwReason == DLL_PROCESS_DETACH)
    _Module.Term();
  return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 55 of file QCShip2.Cpp.

{
  // registers object, typelib and all interfaces in typelib
  return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 64 of file QCShip2.Cpp.

{
  _Module.UnregisterServer();
  return S_OK;
}

Variable Documentation

CComModule _Module

Definition at line 14 of file QCShip2.Cpp.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp2/QCShip2/QCShip2.Idl File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp2
  • QCShip2
Functions | Variables

QCShip2.Idl File Reference

#include "mtxattr.h"

Go to the source code of this file.

Functions

interface propput HRESULT | CustomerId ([in] long lCustomerId)
library QCSHIP2Lib | importlib ("stdole2.tlb")
HRESULT | LineItem ([in] long lItemId,[in] long lQuantity)
HRESULT | OrderId ([in] long lOrderId)
HRESULT | Process ([in] long lFlags,[in] IUnknown *punkNotify)

Variables

import oaidl | idl

Function Documentation

interface propput HRESULT CustomerId ( [in] long lCustomerId )
library QCSHIP2Lib importlib ( "stdole2.tlb" )
HRESULT LineItem | ( | [in] long | lItemId,
 |  | [in] long | lQuantity
 | ) |  |
HRESULT OrderId ( [in] long lOrderId ) [set]
HRESULT Process | ( | [in] long | lFlags,
 |  | [in] IUnknown * | punkNotify
 | ) |  |

Variable Documentation

import oaidl idl

Definition at line 17 of file QCShip2.Idl.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp2/QCShip2/Resource.h File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp2
  • QCShip2
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_SHIP2 101
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_SHIP2 101

Definition at line 6 of file Resource.h.

#define IDS_PROJNAME 100

Definition at line 5 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp2/QCShip2/Ship2.Cpp File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp2
  • QCShip2

Ship2.Cpp File Reference

#include "stdafx.h"
#include "..\DataSourceNames.h"
#include <adoid.h>
#include <adoint.h>
#include "QCShip2.h"
#include "Ship2.h"
#include "..\QCOrder\processFlags.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp2/QCShip2/Ship2.h File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp2
  • QCShip2
Classes

Ship2.h File Reference

#include "resource.h"
#include "..\QCNotify\QCNotify.h"

Go to the source code of this file.

Classes

class COShip2
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp2/QCShip2/StdAfx.Cpp File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp2
  • QCShip2

StdAfx.Cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Queued_Components/QCSamp2/QCShip2/StdAfx.h File Reference

  • Com
  • Services
  • Queued_Components
  • QCSamp2
  • QCShip2
Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>
#include <crtdbg.h>
#include <comsvcs.h>
#include <stdlib.h>
#include <vector>
#include <comdef.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0500
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 16 of file StdAfx.h.

#define _WIN32_WINNT 0x0500

Definition at line 15 of file StdAfx.h.

#define STRICT

Definition at line 12 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Resource_Dispenser/Disp1.Cpp File Reference

  • Com
  • Services
  • Resource_Dispenser
Functions | Variables

Disp1.Cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include "initguid.h"
#include "Disp1.h"
#include "Disp1_i.c"
#include "LDisp.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 42 of file Disp1.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 50 of file Disp1.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 27 of file Disp1.Cpp.

{
  if (dwReason == DLL_PROCESS_ATTACH)
  {
    _Module.Init(ObjectMap, hInstance);
    DisableThreadLibraryCalls(hInstance);
  }
  else if (dwReason == DLL_PROCESS_DETACH)
    _Module.Term();
  return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 58 of file Disp1.Cpp.

{
  // registers object, typelib and all interfaces in typelib
  return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 67 of file Disp1.Cpp.

{
  _Module.UnregisterServer();
  return S_OK;
}

Variable Documentation

CComModule _Module

Definition at line 17 of file Disp1.Cpp.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Resource_Dispenser/Disp1.Idl File Reference

  • Com
  • Services
  • Resource_Dispenser
Functions | Variables

Disp1.Idl File Reference

Go to the source code of this file.

Functions

HRESULT | DeAlloc ([in]long JAustin)
importlib ("stdole2.tlb")
library DISP1Lib | importlib ("stdole32.tlb")

Variables

import oaidl | idl
interface out long * | pJAustin

Function Documentation

HRESULT DeAlloc ( [in] long JAustin )
importlib ( "stdole2.tlb" )
library DISP1Lib importlib ( "stdole32.tlb" )

Variable Documentation

import ocidl idl

Definition at line 7 of file Disp1.Idl.

interface out long* pJAustin

Definition at line 19 of file Disp1.Idl.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Resource_Dispenser/LDisp.Cpp File Reference

  • Com
  • Services
  • Resource_Dispenser

LDisp.Cpp File Reference

#include "stdafx.h"
#include "Disp1.h"
#include "LDisp.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Resource_Dispenser/LDisp.h File Reference

  • Com
  • Services
  • Resource_Dispenser
Classes

LDisp.h File Reference

#include "resource.h"
#include <mtxdm.h>

Go to the source code of this file.

Classes

class CLDisp
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Resource_Dispenser/Resource.h File Reference

  • Com
  • Services
  • Resource_Dispenser
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_LDISP 101
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_LDISP 101

Definition at line 6 of file Resource.h.

#define IDS_PROJNAME 100

Definition at line 5 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Resource_Dispenser/StdAfx.Cpp File Reference

  • Com
  • Services
  • Resource_Dispenser

StdAfx.Cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Resource_Dispenser/StdAfx.h File Reference

  • Com
  • Services
  • Resource_Dispenser
Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0500
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 16 of file StdAfx.h.

#define _WIN32_WINNT 0x0500

Definition at line 15 of file StdAfx.h.

#define STRICT

Definition at line 12 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Security/VC/Resource.h File Reference

  • Com
  • Services
  • Security
  • VC
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_VCSECURITYSAMPLECLASS 101
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_VCSECURITYSAMPLECLASS 101

Definition at line 6 of file Resource.h.

#define IDS_PROJNAME 100

Definition at line 5 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Security/VC/StdAfx.Cpp File Reference

  • Com
  • Services
  • Security
  • VC

StdAfx.Cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Security/VC/StdAfx.h File Reference

  • Com
  • Services
  • Security
  • VC
Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0500
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 19 of file StdAfx.h.

#define _WIN32_WINNT 0x0500

Definition at line 16 of file StdAfx.h.

#define STRICT

Definition at line 12 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Security/VC/VCSecuritySample.Cpp File Reference

  • Com
  • Services
  • Security
  • VC
Functions | Variables

VCSecuritySample.Cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include "initguid.h"
#include "VCSecuritySample.h"
#include "VCSecuritySample_i.c"
#include "VCSecuritySampleClass.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 42 of file VCSecuritySample.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 50 of file VCSecuritySample.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 27 of file VCSecuritySample.Cpp.

{
  if (dwReason == DLL_PROCESS_ATTACH)
  {
    _Module.Init(ObjectMap, hInstance);
    DisableThreadLibraryCalls(hInstance);
  }
  else if (dwReason == DLL_PROCESS_DETACH)
    _Module.Term();
  return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 58 of file VCSecuritySample.Cpp.

{
  // registers object, typelib and all interfaces in typelib
  return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 67 of file VCSecuritySample.Cpp.

{
  _Module.UnregisterServer();
  return S_OK;
}

Variable Documentation

CComModule _Module

Definition at line 17 of file VCSecuritySample.Cpp.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Security/VC/VCSecuritySample.Idl File Reference

  • Com
  • Services
  • Security
  • VC
Functions | Variables

VCSecuritySample.Idl File Reference

Go to the source code of this file.

Functions

interface | helpstring ("method AmIAnAdministrator")] HRESULT AmIAnAdministrator([out
importlib ("stdole2.tlb")
library VCSECURITYSAMPLELib | importlib ("stdole32.tlb")
interface retval short *HRESULT | WhoAmI ([out, retval] BSTR *)

Variables

import oaidl | idl

Function Documentation

interface helpstring ( "method AmIAnAdministrator" )
importlib ( "stdole2.tlb" )
library VCSECURITYSAMPLELib importlib ( "stdole32.tlb" )
interface retval short* HRESULT WhoAmI ( [out, retval] BSTR * )

Variable Documentation

import ocidl idl

Definition at line 7 of file VCSecuritySample.Idl.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Security/VC/VCSecuritySampleCLASS.Cpp File Reference

  • Com
  • Services
  • Security
  • VC

VCSecuritySampleCLASS.Cpp File Reference

#include "stdafx.h"
#include "VCSecuritySample.h"
#include "VCSecuritySampleClass.h"
#include <comsvcs.h>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Security/VC/VCSecuritySampleCLASS.h File Reference

  • Com
  • Services
  • Security
  • VC
Classes

VCSecuritySampleCLASS.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class CVCSecuritySampleClass
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Shared_Property_Manager/TServer/Computer.Cpp File Reference

  • Com
  • Services
  • Shared_Property_Manager
  • TServer

Computer.Cpp File Reference

#include "stdafx.h"
#include "tServer.h"
#include "Computer.h"
#include <mtx.h>
#include <time.h>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Shared_Property_Manager/TServer/Computer.h File Reference

  • Com
  • Services
  • Shared_Property_Manager
  • TServer
Classes

Computer.h File Reference

#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Classes

class CComputer
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Shared_Property_Manager/TServer/Human.Cpp File Reference

  • Com
  • Services
  • Shared_Property_Manager
  • TServer

Human.Cpp File Reference

#include "stdafx.h"
#include "tServer.h"
#include "Human.h"
#include <mtx.h>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Shared_Property_Manager/TServer/Human.h File Reference

  • Com
  • Services
  • Shared_Property_Manager
  • TServer
Classes

Human.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class CHuman
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Shared_Property_Manager/TServer/resource.h File Reference

  • Com
  • Services
  • Shared_Property_Manager
  • TServer
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_Computer 106
#define | IDR_Human 108
#define | IDS_COMPUTER_DESC 105
#define | IDS_HUMAN_DESC 107
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_Computer 106

Definition at line 7 of file resource.h.

#define IDR_Human 108

Definition at line 9 of file resource.h.

#define IDS_COMPUTER_DESC 105

Definition at line 6 of file resource.h.

#define IDS_HUMAN_DESC 107

Definition at line 8 of file resource.h.

#define IDS_PROJNAME 100

Definition at line 5 of file resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Shared_Property_Manager/TServer/StdAfx.Cpp File Reference

  • Com
  • Services
  • Shared_Property_Manager
  • TServer

StdAfx.Cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Shared_Property_Manager/TServer/StdAfx.h File Reference

  • Com
  • Services
  • Shared_Property_Manager
  • TServer
Defines | Functions | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _ATL_STATIC_REGISTRY
#define | _WIN32_WINNT 0x0500
#define | AFX_STDAFX_H__AA22C995_FD72_11D0_B5DC_00C04FB957D8__INCLUDED_
#define | STRICT
#define | THROW_ERR(exp) if (FAILED (hr = (exp))) throw hr

Functions

BSTR | TCHAR2BSTR (TCHAR *szBuf)

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 33 of file StdAfx.h.

#define _ATL_STATIC_REGISTRY

Definition at line 17 of file StdAfx.h.

#define _WIN32_WINNT 0x0500

Definition at line 30 of file StdAfx.h.

#define AFX_STDAFX_H__AA22C995_FD72_11D0_B5DC_00C04FB957D8__INCLUDED_

Definition at line 20 of file StdAfx.h.

#define STRICT

Definition at line 26 of file StdAfx.h.

#define THROW_ERR ( exp ) if (FAILED (hr = (exp))) throw hr

Definition at line 43 of file StdAfx.h.

Function Documentation

BSTR TCHAR2BSTR ( TCHAR * szBuf ) [inline]

Definition at line 45 of file StdAfx.h.

                                      {

  WCHAR* wszBuf;

#ifndef UNICODE
  wszBuf = new WCHAR [512];
  MultiByteToWideChar( CP_ACP, 0, szBuf, -1, wszBuf, 512 );
#else
  wszBuf = szBuf;
#endif

  BSTR bstrNew = ::SysAllocString (wszBuf);

#ifndef UNICODE
  delete [] wszBuf;
#endif

  return bstrNew;
}

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Shared_Property_Manager/TServer/TServer.Cpp File Reference

  • Com
  • Services
  • Shared_Property_Manager
  • TServer
Functions | Variables

TServer.Cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include "initguid.h"
#include "tServer.h"
#include "tServer_i.c"
#include "Computer.h"
#include "Human.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 81 of file TServer.Cpp.

{
#ifdef _MERGE_PROXYSTUB
  if (PrxDllCanUnloadNow() != S_OK)
    return S_FALSE;
#endif
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 93 of file TServer.Cpp.

{
#ifdef _MERGE_PROXYSTUB
  if (PrxDllGetClassObject(rclsid, riid, ppv) == S_OK)
    return S_OK;
#endif
  return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID | lpReserved
 | ) |  |

Definition at line 61 of file TServer.Cpp.

{
  lpReserved;
#ifdef _MERGE_PROXYSTUB
  if (!PrxDllMain(hInstance, dwReason, lpReserved))
    return FALSE;
#endif
  if (dwReason == DLL_PROCESS_ATTACH)
  {
    _Module.Init(ObjectMap, hInstance);
    DisableThreadLibraryCalls(hInstance);
  }
  else if (dwReason == DLL_PROCESS_DETACH)
    _Module.Term();
  return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 105 of file TServer.Cpp.

{
#ifdef _MERGE_PROXYSTUB
  HRESULT hRes = PrxDllRegisterServer();
  if (FAILED(hRes))
    return hRes;
#endif
  // registers object, typelib and all interfaces in typelib
  return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 119 of file TServer.Cpp.

{
#ifdef _MERGE_PROXYSTUB
  PrxDllUnregisterServer();
#endif
  _Module.UnregisterServer();
  return S_OK;
}

Variable Documentation

CComModule _Module

Definition at line 50 of file TServer.Cpp.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Shared_Property_Manager/TServer/TServer.Idl File Reference

  • Com
  • Services
  • Shared_Property_Manager
  • TServer
Functions | Variables

TServer.Idl File Reference

Go to the source code of this file.

Functions

HRESULT | GetNewMove ([in] long lGameID,[in] long lOrder,[out] VARIANT *pvName,[out] VARIANT *pvFoeX,[out] VARIANT *pvFoeY,[out] VARIANT *pvWin,[out] VARIANT *pvUpdate)
importlib ("stdole2.tlb")
library TSERVERLib | importlib ("stdole32.tlb")
HRESULT | NewMove ([in] long lGameID,[in] VARIANT_BOOL bEasy,[in] long lX,[in] long lY,[out] VARIANT *pvMyX,[out] VARIANT *pvMyY,[out] VARIANT *pvWin)
HRESULT | NewMove ([in] long lGameID,[in] long lOrder,[in] long lX,[in] long lY,[out] VARIANT *pvWin)

Variables

import oaidl | idl
interface VARIANT * | pvGameID
interface VARIANT VARIANT * | pvName
interface VARIANT VARIANT * | pvOrder
interface VARIANT VARIANT VARIANT * | pvX
interface VARIANT VARIANT
VARIANT VARIANT * 		pvY

Function Documentation

HRESULT GetNewMove | ( | [in] long | lGameID,
 |  | [in] long | lOrder,
 |  | [out] VARIANT * | pvName,
 |  | [out] VARIANT * | pvFoeX,
 |  | [out] VARIANT * | pvFoeY,
 |  | [out] VARIANT * | pvWin,
 |  | [out] VARIANT * | pvUpdate
 | ) |  |
importlib ( "stdole2.tlb" )
library TSERVERLib importlib ( "stdole32.tlb" )
HRESULT NewMove | ( | [in] long | lGameID,
 |  | [in] VARIANT_BOOL | bEasy,
 |  | [in] long | lX,
 |  | [in] long | lY,
 |  | [out] VARIANT * | pvMyX,
 |  | [out] VARIANT * | pvMyY,
 |  | [out] VARIANT * | pvWin
 | ) |  |
HRESULT NewMove | ( | [in] long | lGameID,
 |  | [in] long | lOrder,
 |  | [in] long | lX,
 |  | [in] long | lY,
 |  | [out] VARIANT * | pvWin
 | ) |  |

Variable Documentation

import ocidl idl

Definition at line 17 of file TServer.Idl.

interface VARIANT * pvGameID

Definition at line 29 of file TServer.Idl.

interface VARIANT VARIANT* pvName

Definition at line 31 of file TServer.Idl.

interface VARIANT VARIANT VARIANT * pvOrder

Definition at line 29 of file TServer.Idl.

interface VARIANT VARIANT VARIANT* pvX

Definition at line 29 of file TServer.Idl.

interface VARIANT VARIANT VARIANT VARIANT* pvY

Definition at line 29 of file TServer.Idl.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/DataAccess/DataAcADO/adocomponent.Cpp File Reference

  • Com
  • Services
  • Transaction
  • DataAccess
  • DataAcADO

adocomponent.Cpp File Reference

#include "stdafx.h"
#include "ADOKB.h"
#include "ADOComponent.h"
#import "D:\Program Files\Common Files\System\ado\msado20.tlb"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/DataAccess/DataAcADO/adocomponent.h File Reference

  • Com
  • Services
  • Transaction
  • DataAccess
  • DataAcADO
Classes

adocomponent.h File Reference

#include "resource.h"
#include <comsvcs.h>
#include "resource.h"

Go to the source code of this file.

Classes

class CADOComponent
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/DataAccess/DataAcADO/ADOKB.Cpp File Reference

  • Com
  • Services
  • Transaction
  • DataAccess
  • DataAcADO
Functions | Variables

ADOKB.Cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include "initguid.h"
#include "ADOKB.h"
#include "ADOKB_i.c"
#include "ADOComponent.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 61 of file ADOKB.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 69 of file ADOKB.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 46 of file ADOKB.Cpp.

{
  if (dwReason == DLL_PROCESS_ATTACH)
  {
    _Module.Init(ObjectMap, hInstance);
    DisableThreadLibraryCalls(hInstance);
  }
  else if (dwReason == DLL_PROCESS_DETACH)
    _Module.Term();
  return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 77 of file ADOKB.Cpp.

{
  // registers object, typelib and all interfaces in typelib
  return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 86 of file ADOKB.Cpp.

{
  _Module.UnregisterServer();
  return S_OK;
}

Variable Documentation

CComModule _Module

Definition at line 36 of file ADOKB.Cpp.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/DataAccess/DataAcADO/ADOKB.Idl File Reference

  • Com
  • Services
  • Transaction
  • DataAccess
  • DataAcADO
Functions | Variables

ADOKB.Idl File Reference

Go to the source code of this file.

Functions

interface | helpstring ("method SimpleQuery")] HRESULT SimpleQuery([in
importlib ("stdole2.tlb")
library ADOKBLib | importlib ("stdole32.tlb")

Variables

import oaidl | idl
interface out VARIANT * | returnval

Function Documentation

interface helpstring ( "method SimpleQuery" )
importlib ( "stdole2.tlb" )
library ADOKBLib importlib ( "stdole32.tlb" )

Variable Documentation

import ocidl idl

Definition at line 25 of file ADOKB.Idl.

interface out VARIANT* returnval

Definition at line 37 of file ADOKB.Idl.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/DataAccess/DataAcADO/Resource.h File Reference

  • Com
  • Services
  • Transaction
  • DataAccess
  • DataAcADO
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_ADOCOMPONENT 101
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_ADOCOMPONENT 101

Definition at line 22 of file Resource.h.

#define IDS_PROJNAME 100

Definition at line 21 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/DataAccess/DataAcADO/StdAfx.Cpp File Reference

  • Com
  • Services
  • Transaction
  • DataAccess
  • DataAcADO

StdAfx.Cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/DataAccess/DataAcADO/StdAfx.h File Reference

  • Com
  • Services
  • Transaction
  • DataAccess
  • DataAcADO
Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0500
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 19 of file StdAfx.h.

#define _WIN32_WINNT 0x0500

Definition at line 16 of file StdAfx.h.

#define STRICT

Definition at line 12 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/DataAccess/DataAcOleDB/helper.h File Reference

  • Com
  • Services
  • Transaction
  • DataAccess
  • DataAcOleDB
Defines | Functions

helper.h File Reference

Go to the source code of this file.

Defines

#define | __LONGSTRING(string) L##string
#define | CHECK_HR(hr)
#define | LONGSTRING(string) __LONGSTRING(string)
#define | XCHECK_HR(hr)

Functions

HRESULT | myDisplayErrorInfo (HRESULT hrReturned, IErrorInfo *pIErrorInfo, LPCWSTR pwszFile, ULONG ulLine)
HRESULT | myDisplayErrorRecord (HRESULT hrReturned, ULONG iRecord, IErrorRecords *pIErrorRecords, LPCWSTR pwszFile, ULONG ulLine)
HRESULT | myGetSqlErrorInfo (ULONG iRecord, IErrorRecords *pIErrorRecords, BSTR *pBstr, LONG *plNativeError)
HRESULT | myHandleResult (HRESULT hrReturned, LPCWSTR pwszFile, ULONG ulLine)

Define Documentation

#define __LONGSTRING ( string ) L##string

Definition at line 22 of file helper.h.

#define CHECK_HR ( hr )
Value:
{                                                 \
   if(FAILED(hr))                                       \
      goto error;                                       \
}

Definition at line 26 of file helper.h.

#define LONGSTRING ( string ) __LONGSTRING(string)

Definition at line 23 of file helper.h.

#define XCHECK_HR ( hr )
Value:
{                                                 \
   if(FAILED(myHandleResult(hr, LONGSTRING(__FILE__), __LINE__))) \
      goto error;                                       \
}

Definition at line 34 of file helper.h.

Function Documentation

HRESULT myDisplayErrorInfo | ( | HRESULT | hrReturned,
 |  | IErrorInfo * | pIErrorInfo,
 |  | LPCWSTR | pwszFile,
 |  | ULONG | ulLine
 | ) |  |

Definition at line 213 of file helper.h.

{
   HRESULT        hr;
   BSTR           bstrDescription   = NULL;
   BSTR           bstrSource        = NULL;

   // Get the description of the error
   CHECK_HR(hr = pIErrorInfo->GetDescription(&bstrDescription));

   // Get the source of the error -- this will be the window title
   CHECK_HR(hr = pIErrorInfo->GetSource(&bstrSource));

   // Display this error information
   wprintf(L"\nErrorInfo:  HResult: 0x%08x, Description: %s\nSource: %s\n"
            L"File: %s, Line: %d\n",
            hrReturned,
            bstrDescription,
            bstrSource,
            pwszFile,
            ulLine);

error:
   SysFreeString(bstrDescription);
   SysFreeString(bstrSource);
   return hr;
}

HRESULT myDisplayErrorRecord | ( | HRESULT | hrReturned,
 |  | ULONG | iRecord,
 |  | IErrorRecords * | pIErrorRecords,
 |  | LPCWSTR | pwszFile,
 |  | ULONG | ulLine
 | ) |  |

Definition at line 135 of file helper.h.

{
   HRESULT           hr;
   IErrorInfo *      pIErrorInfo       = NULL;
   BSTR              bstrDescription   = NULL;
   BSTR              bstrSource        = NULL;
   BSTR              bstrSQLInfo       = NULL;

   static LCID       lcid              = GetUserDefaultLCID();

   LONG              lNativeError      = 0;
   ERRORINFO         ErrorInfo;
   WCHAR       szBuff[1024];

   // Get the IErrorInfo interface pointer for this error record
   CHECK_HR(hr = pIErrorRecords->GetErrorInfo(iRecord, lcid, &pIErrorInfo));

   // Get the description of this error
   CHECK_HR(hr = pIErrorInfo->GetDescription(&bstrDescription));

   // Get the source of this error
   CHECK_HR(hr = pIErrorInfo->GetSource(&bstrSource));

   // Get the basic error information for this record
   CHECK_HR(hr = pIErrorRecords->GetBasicErrorInfo(iRecord, &ErrorInfo));

   // If the error object supports ISQLErrorInfo, get this information
   myGetSqlErrorInfo(iRecord, pIErrorRecords, &bstrSQLInfo, &lNativeError);

   // Display the error information to the user
   if( bstrSQLInfo )
   {
      _snwprintf(szBuff, 1024, L"\nErrorRecord:  HResult: 0x%08x\nDescription: %s\n"
         L"SQLErrorInfo: %s\nSource: %s\nFile: %s, Line: %d\n",
         ErrorInfo.hrError,
         bstrDescription,
         bstrSQLInfo,
         bstrSource,
         pwszFile,
         ulLine);
   }
   else
   {
      _snwprintf(szBuff, 1024, L"\nErrorRecord:  HResult: 0x%08x\nDescription: %s\n"
         L"Source: %s\nFile: %s, Line: %d\n",
         ErrorInfo.hrError,
         bstrDescription,
         bstrSource,
         pwszFile,
         ulLine);
   }
   // Display the formatter buffer
  wsprintf(szBuff);

error:
   if( pIErrorInfo )
      pIErrorInfo->Release();
   SysFreeString(bstrDescription);
   SysFreeString(bstrSource);
   SysFreeString(bstrSQLInfo);
   return hr;
}

HRESULT myGetSqlErrorInfo | ( | ULONG | iRecord,
 |  | IErrorRecords * | pIErrorRecords,
 |  | BSTR * | pBstr,
 |  | LONG * | plNativeError
 | ) |  |

Definition at line 254 of file helper.h.

{
   HRESULT           hr;
   ISQLErrorInfo *   pISQLErrorInfo   = NULL;
   LONG              lNativeError     = 0;

   // Attempt to get the ISQLErrorInfo interface for this error
   // record through GetCustomErrorObject. Note that ISQLErrorInfo
   // is not mandatory, so failure is acceptable here.
   CHECK_HR(hr = pIErrorRecords->GetCustomErrorObject(
            iRecord,                               // iRecord
            IID_ISQLErrorInfo,                     // riid
            (IUnknown**)&pISQLErrorInfo            // ppISQLErrorInfo
            ));

   // If we obtained the ISQLErrorInfo interface, get the SQL
   // error string and native error code for this error
   if( pISQLErrorInfo )
      hr = pISQLErrorInfo->GetSQLInfo(pBstr, &lNativeError);

error:
   if( plNativeError )
      *plNativeError = lNativeError;
   if( pISQLErrorInfo )
      pISQLErrorInfo->Release();
   return hr;
}

HRESULT myHandleResult | ( | HRESULT | hrReturned,
 |  | LPCWSTR | pwszFile,
 |  | ULONG | ulLine
 | ) |  |

Definition at line 60 of file helper.h.

{
   HRESULT           hr;
   IErrorInfo *      pIErrorInfo      = NULL;
   IErrorRecords *   pIErrorRecords   = NULL;
   ULONG             cRecords;
   ULONG             iErr;

   // If the method called as part of the XCHECK_HR macro failed,
   // we will attempt to get extended error information for the call
   if( FAILED(hrReturned) )
   {
      // Obtain the current error object, if any, by using the
      // Automation GetErrorInfo function, which will give
      // us back an IErrorInfo interface pointer if successful
      hr = GetErrorInfo(0, &pIErrorInfo);

      // We've got the IErrorInfo interface pointer on the error object
      if( SUCCEEDED(hr) && pIErrorInfo )
      {
         // OLE DB extends the Automation error model by allowing
         // error objects to support the IErrorRecords interface. This
         // interface can expose information on multiple errors.
         hr = pIErrorInfo->QueryInterface(IID_IErrorRecords,
                  (void**)&pIErrorRecords);
         if( SUCCEEDED(hr) )
         {
            // Get the count of error records from the object
            CHECK_HR(hr = pIErrorRecords->GetRecordCount(&cRecords));

            // Loop through the set of error records, and
            // display the error information for each one
            for( iErr = 0; iErr < cRecords; iErr++ )
            {
               myDisplayErrorRecord(hrReturned, iErr, pIErrorRecords,
                  pwszFile, ulLine);
            }
         }
         // The object didn't support IErrorRecords; display
         // the error information for this single error
         else
         {
            myDisplayErrorInfo(hrReturned, pIErrorInfo, pwszFile, ulLine);
         }
      }
      // There was no error object, so just display the HRESULT
      // to the user
      else
      {
         wprintf(L"\nNo Error Info posted; HResult: 0x%08x\n"
            L"File: %s, Line: %d\n", hrReturned, pwszFile, ulLine);
      }
   }

error:
   if( pIErrorInfo )
      pIErrorInfo->Release();
   if( pIErrorRecords )
      pIErrorRecords->Release();
   return hrReturned;
}

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/DataAccess/DataAcOleDB/oledbcomponent.Cpp File Reference

  • Com
  • Services
  • Transaction
  • DataAccess
  • DataAcOleDB
Functions

oledbcomponent.Cpp File Reference

#include "stdafx.h"
#include "Oledbkb.h"
#include "OLEDBComponent.h"
#include "oledb.h"
#include "oledberr.h"
#include "msdaguid.h"
#include "msdasql.h"
#include <windows.h>
#include <stdio.h>

Go to the source code of this file.

Functions

HRESULT SetInitProps (IDBInitialize *)

Function Documentation

HRESULT SetInitProps ( IDBInitialize * pIDBInitialize )

Definition at line 213 of file oledbcomponent.Cpp.

{
  IDBProperties* pIDBProperties;
   DBPROP         InitProperties[4];
   DBPROPSET      rgInitPropSet;
  HRESULT     retcode;

   for (ULONG i = 0; i < 4; i++ )
  {
    VariantInit(&InitProperties[i].vValue);
      InitProperties[i].dwOptions = DBPROPOPTIONS_REQUIRED;
      InitProperties[i].colid = DB_NULLID;
   }

   InitProperties[0].dwPropertyID = DBPROP_INIT_PROMPT;
   InitProperties[0].vValue.vt = VT_I2;
   InitProperties[0].vValue.iVal = DBPROMPT_NOPROMPT;

   InitProperties[1].dwPropertyID = DBPROP_INIT_DATASOURCE;
   InitProperties[1].vValue.vt = VT_BSTR;
   InitProperties[1].vValue.bstrVal = SysAllocString(OLESTR("pubs"));

   InitProperties[2].dwPropertyID = DBPROP_AUTH_USERID;
   InitProperties[2].vValue.vt = VT_BSTR;
   InitProperties[2].vValue.bstrVal = SysAllocString(OLESTR("sa"));

   InitProperties[3].dwPropertyID = DBPROP_AUTH_PASSWORD;
   InitProperties[3].vValue.vt = VT_BSTR;
   InitProperties[3].vValue.bstrVal = SysAllocString(OLESTR(""));

   rgInitPropSet.guidPropertySet = DBPROPSET_DBINIT;
   rgInitPropSet.cProperties = 4;
   rgInitPropSet.rgProperties = InitProperties;

   if(FAILED(pIDBInitialize->QueryInterface(IID_IDBProperties, (void**) &pIDBProperties)))
    goto error;
   if(FAILED(pIDBProperties->SetProperties(1, &rgInitPropSet)))
    goto error;

  retcode = S_OK;
  goto cleanup;

error:
  retcode = E_FAIL;
  goto cleanup;

cleanup:
  if(pIDBProperties)
    pIDBProperties->Release();

  SysFreeString(InitProperties[1].vValue.bstrVal);
   SysFreeString(InitProperties[2].vValue.bstrVal);
   SysFreeString(InitProperties[3].vValue.bstrVal);

  return retcode;
}

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/DataAccess/DataAcOleDB/oledbcomponent.h File Reference

  • Com
  • Services
  • Transaction
  • DataAccess
  • DataAcOleDB
Classes | Defines

oledbcomponent.h File Reference

#include "resource.h"
#include <comsvcs.h>
#include "resource.h"

Go to the source code of this file.

Classes

class | COLEDBComponent

Defines

#define | DBINITCONSTANTS
#define | INITGUID
#define | UNICODE

Define Documentation

#define DBINITCONSTANTS

Definition at line 30 of file oledbcomponent.h.

#define INITGUID

Definition at line 31 of file oledbcomponent.h.

#define UNICODE

Definition at line 29 of file oledbcomponent.h.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/DataAccess/DataAcOleDB/OLEDBKB.Cpp File Reference

  • Com
  • Services
  • Transaction
  • DataAccess
  • DataAcOleDB
Functions | Variables

OLEDBKB.Cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include "initguid.h"
#include "Oledbkb.h"
#include "Oledbkb_i.c"
#include "OLEDBComponent.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 61 of file OLEDBKB.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 69 of file OLEDBKB.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 46 of file OLEDBKB.Cpp.

{
  if (dwReason == DLL_PROCESS_ATTACH)
  {
    _Module.Init(ObjectMap, hInstance);
    DisableThreadLibraryCalls(hInstance);
  }
  else if (dwReason == DLL_PROCESS_DETACH)
    _Module.Term();
  return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 77 of file OLEDBKB.Cpp.

{
  // registers object, typelib and all interfaces in typelib
  return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 86 of file OLEDBKB.Cpp.

{
  _Module.UnregisterServer();
  return S_OK;
}

Variable Documentation

CComModule _Module

Definition at line 36 of file OLEDBKB.Cpp.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/DataAccess/DataAcOleDB/OLEDBKB.Idl File Reference

  • Com
  • Services
  • Transaction
  • DataAccess
  • DataAcOleDB
Functions | Variables

OLEDBKB.Idl File Reference

Go to the source code of this file.

Functions

interface | helpstring ("method SimpleQuery")] HRESULT SimpleQuery([in
importlib ("stdole2.tlb")
library OLEDBKBLib | importlib ("stdole32.tlb")

Variables

import oaidl | idl
interface out BSTR * | returnval

Function Documentation

interface helpstring ( "method SimpleQuery" )
importlib ( "stdole2.tlb" )
library OLEDBKBLib importlib ( "stdole32.tlb" )

Variable Documentation

import ocidl idl

Definition at line 26 of file OLEDBKB.Idl.

interface out BSTR* returnval

Definition at line 38 of file OLEDBKB.Idl.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/DataAccess/DataAcOleDB/Resource.h File Reference

  • Com
  • Services
  • Transaction
  • DataAccess
  • DataAcOleDB
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_OLEDBCOMPONENT 101
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_OLEDBCOMPONENT 101

Definition at line 22 of file Resource.h.

#define IDS_PROJNAME 100

Definition at line 21 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/DataAccess/DataAcOleDB/StdAfx.Cpp File Reference

  • Com
  • Services
  • Transaction
  • DataAccess
  • DataAcOleDB

StdAfx.Cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/DataAccess/DataAcOleDB/StdAfx.h File Reference

  • Com
  • Services
  • Transaction
  • DataAccess
  • DataAcOleDB
Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0500
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 19 of file StdAfx.h.

#define _WIN32_WINNT 0x0500

Definition at line 16 of file StdAfx.h.

#define STRICT

Definition at line 12 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/DataAccess/DataAcRDO/rdocomponent.Cpp File Reference

  • Com
  • Services
  • Transaction
  • DataAccess
  • DataAcRDO

rdocomponent.Cpp File Reference

#include "stdafx.h"
#include "RDOKB.h"
#include "RDOComponent.h"
#import "msrdo20.dll"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/DataAccess/DataAcRDO/rdocomponent.h File Reference

  • Com
  • Services
  • Transaction
  • DataAccess
  • DataAcRDO
Classes

rdocomponent.h File Reference

#include "resource.h"
#include <comsvcs.h>
#include "resource.h"

Go to the source code of this file.

Classes

class CRDOComponent
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/DataAccess/DataAcRDO/RDOKB.Cpp File Reference

  • Com
  • Services
  • Transaction
  • DataAccess
  • DataAcRDO
Functions | Variables

RDOKB.Cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include "initguid.h"
#include "RDOKB.h"
#include "RDOKB_i.c"
#include "RDOComponent.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 60 of file RDOKB.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 68 of file RDOKB.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 45 of file RDOKB.Cpp.

{
  if (dwReason == DLL_PROCESS_ATTACH)
  {
    _Module.Init(ObjectMap, hInstance);
    DisableThreadLibraryCalls(hInstance);
  }
  else if (dwReason == DLL_PROCESS_DETACH)
    _Module.Term();
  return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 76 of file RDOKB.Cpp.

{
  // registers object, typelib and all interfaces in typelib
  return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 85 of file RDOKB.Cpp.

{
  _Module.UnregisterServer();
  return S_OK;
}

Variable Documentation

CComModule _Module

Definition at line 35 of file RDOKB.Cpp.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/DataAccess/DataAcRDO/RDOKB.Idl File Reference

  • Com
  • Services
  • Transaction
  • DataAccess
  • DataAcRDO
Functions | Variables

RDOKB.Idl File Reference

Go to the source code of this file.

Functions

interface | helpstring ("method SimpleQuery")] HRESULT SimpleQuery([in
importlib ("stdole2.tlb")
library RDOKBLib | importlib ("stdole32.tlb")

Variables

import oaidl | idl
interface out VARIANT * | returnval

Function Documentation

interface helpstring ( "method SimpleQuery" )
importlib ( "stdole2.tlb" )
library RDOKBLib importlib ( "stdole32.tlb" )

Variable Documentation

import ocidl idl

Definition at line 26 of file RDOKB.Idl.

interface out VARIANT* returnval

Definition at line 38 of file RDOKB.Idl.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/DataAccess/DataAcRDO/Resource.h File Reference

  • Com
  • Services
  • Transaction
  • DataAccess
  • DataAcRDO
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_RDOCOMPONENT 101
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_RDOCOMPONENT 101

Definition at line 6 of file Resource.h.

#define IDS_PROJNAME 100

Definition at line 5 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/DataAccess/DataAcRDO/StdAfx.Cpp File Reference

  • Com
  • Services
  • Transaction
  • DataAccess
  • DataAcRDO

StdAfx.Cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/DataAccess/DataAcRDO/StdAfx.h File Reference

  • Com
  • Services
  • Transaction
  • DataAccess
  • DataAcRDO
Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0500
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 19 of file StdAfx.h.

#define _WIN32_WINNT 0x0500

Definition at line 16 of file StdAfx.h.

#define STRICT

Definition at line 12 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/VCAcct/account.Cpp File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • VCAcct
Defines | Functions | Variables

account.Cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include "initguid.h"
#include "Account.h"
#include "CAccount.h"
#include "MoveMoney.h"
#include "Account_i.c"
#include "GetReceipt.h"
#include "UpdateReceipt.h"

Go to the source code of this file.

Defines

#define | IID_DEFINED

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Define Documentation

#define IID_DEFINED

Definition at line 52 of file account.Cpp.

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 94 of file account.Cpp.

{
#ifdef _MERGE_PROXYSTUB
  if (PrxDllCanUnloadNow() != S_OK)
    return S_FALSE;
#endif
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 106 of file account.Cpp.

{
#ifdef _MERGE_PROXYSTUB
  if (PrxDllGetClassObject(rclsid, riid, ppv) == S_OK)
    return S_OK;
#endif
  return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID | lpReserved
 | ) |  |

Definition at line 74 of file account.Cpp.

{
  lpReserved;
#ifdef _MERGE_PROXYSTUB
  if (!PrxDllMain(hInstance, dwReason, lpReserved))
    return FALSE;
#endif
  if (dwReason == DLL_PROCESS_ATTACH)
  {
    _Module.Init(ObjectMap, hInstance);
    DisableThreadLibraryCalls(hInstance);
  }
  else if (dwReason == DLL_PROCESS_DETACH)
    _Module.Term();
  return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 118 of file account.Cpp.

{
#ifdef _MERGE_PROXYSTUB
  HRESULT hRes = PrxDllRegisterServer();
  if (FAILED(hRes))
    return hRes;
#endif
  // registers object, typelib and all interfaces in typelib
  return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 132 of file account.Cpp.

{
#ifdef _MERGE_PROXYSTUB
  PrxDllUnregisterServer();
#endif
  _Module.UnregisterServer();
  return S_OK;
}

Variable Documentation

CComModule _Module

Definition at line 61 of file account.Cpp.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/VCAcct/account.Idl File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • VCAcct
Functions | Variables

account.Idl File Reference

#include <mtxattr.h>

Go to the source code of this file.

Functions

HRESULT | GetNextReceipt ([out, retval] long *plReceiptNo)
library ACCOUNT | importlib ("stdole2.tlb")
HRESULT | Perform ([in] long lPrimeAccount,[in] long lSecondAccount,[in] long lAmount,[in] long lTranType,[out, retval] BSTR *pbstrResult)
HRESULT | Post ([in] long lAccount,[in] long lAmount,[out, retval] BSTR *pbstrResult)
HRESULT | Update ([out, retval] long *plReceiptNo)

Variables

import ocidl | idl

Function Documentation

HRESULT GetNextReceipt ( [out, retval] long * plReceiptNo )
library ACCOUNT importlib ( "stdole2.tlb" )
HRESULT Perform | ( | [in] long | lPrimeAccount,
 |  | [in] long | lSecondAccount,
 |  | [in] long | lAmount,
 |  | [in] long | lTranType,
 |  | [out, retval] BSTR * | pbstrResult
 | ) |  |
HRESULT Post | ( | [in] long | lAccount,
 |  | [in] long | lAmount,
 |  | [out, retval] BSTR * | pbstrResult
 | ) |  |
HRESULT Update ( [out, retval] long * plReceiptNo )

Variable Documentation

import ocidl idl

Definition at line 37 of file account.Idl.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/VCAcct/caccount.Cpp File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • VCAcct

caccount.Cpp File Reference

#include "stdafx.h"
#include "Account.h"
#include "CAccount.h"
#include <stdio.h>
#include <comsvcs.h>
#include <adoid.h>
#include <adoint.h>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/VCAcct/caccount.h File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • VCAcct
Classes

caccount.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class CAccount
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/VCAcct/getreceipt.Cpp File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • VCAcct

getreceipt.Cpp File Reference

#include "stdafx.h"
#include "Account.h"
#include "GetReceipt.h"
#include "UpdateReceipt.h"
#include <comsvcs.h>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/VCAcct/getreceipt.h File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • VCAcct
Classes

getreceipt.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class CGetReceipt
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/VCAcct/moveMoney.Cpp File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • VCAcct

moveMoney.Cpp File Reference

#include "stdafx.h"
#include "Account.h"
#include "MoveMoney.h"
#include "GetReceipt.h"
#include <comsvcs.h>
#include <comdef.h>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/VCAcct/moveMoney.h File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • VCAcct
Classes

moveMoney.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class CMoveMoney
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/VCAcct/Resource.h File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • VCAcct
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_Account 1
#define | IDR_GetReceipt 117
#define | IDR_MoveMoney 2
#define | IDR_UpdateReceipt 115
#define | IDR_UpdateReceipt1 119
#define | IDS_ACCOUNT_DESC 1
#define | IDS_GETRECEIPT_DESC 116
#define | IDS_MOVEMONEY_DESC 2
#define | IDS_UPDATERECEIPT_DESC 114
#define | IDS_UPDATERECEIPT_DESC1 118

Define Documentation

#define IDR_Account 1

Definition at line 6 of file Resource.h.

#define IDR_GetReceipt 117

Definition at line 12 of file Resource.h.

#define IDR_MoveMoney 2

Definition at line 8 of file Resource.h.

#define IDR_UpdateReceipt 115

Definition at line 10 of file Resource.h.

#define IDR_UpdateReceipt1 119

Definition at line 14 of file Resource.h.

#define IDS_ACCOUNT_DESC 1

Definition at line 5 of file Resource.h.

#define IDS_GETRECEIPT_DESC 116

Definition at line 11 of file Resource.h.

#define IDS_MOVEMONEY_DESC 2

Definition at line 7 of file Resource.h.

#define IDS_UPDATERECEIPT_DESC 114

Definition at line 9 of file Resource.h.

#define IDS_UPDATERECEIPT_DESC1 118

Definition at line 13 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/VCAcct/StdAfx.Cpp File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • VCAcct

StdAfx.Cpp File Reference

#include "stdafx.h"
#include <initguid.h>
#include <adoid.h>
#include <adoint.h>
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/VCAcct/StdAfx.h File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • VCAcct
Defines | Functions | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Defines

#define | _ATL_STATIC_REGISTRY
#define | APP_ERROR 0x80004100
#define | RETHROW_ERR(exp) { if (FAILED(hr = (exp))) {lErrFlag = 2; throw hr;}}
#define | THROW_ERR(exp, str) {if (FAILED (hr = (exp))) {lErrFlag = 0; pErrMsg = _T(str); throw hr;}}
#define | THROW_STR(str) { hr = APP_ERROR; lErrFlag = 1; pErrMsg = str; throw hr;}

Functions

BSTR | TCHAR2BSTR (TCHAR *szBuf)

Variables

CComModule | _Module

Define Documentation

#define _ATL_STATIC_REGISTRY

Definition at line 24 of file StdAfx.h.

#define APP_ERROR 0x80004100

Definition at line 36 of file StdAfx.h.

#define RETHROW_ERR ( exp ) { if (FAILED(hr = (exp))) {lErrFlag = 2; throw hr;}}

Definition at line 34 of file StdAfx.h.

#define THROW_ERR | ( | exp,
 |  | str |
 | ) |  | {if (FAILED (hr = (exp))) {lErrFlag = 0; pErrMsg = _T(str); throw hr;}}

Definition at line 32 of file StdAfx.h.

#define THROW_STR ( str ) { hr = APP_ERROR; lErrFlag = 1; pErrMsg = str; throw hr;}

Definition at line 33 of file StdAfx.h.

Function Documentation

BSTR TCHAR2BSTR ( TCHAR * szBuf ) [inline]

Definition at line 39 of file StdAfx.h.

                                      {

  WCHAR* wszBuf;

#ifndef UNICODE
  wszBuf = new WCHAR [512];
  MultiByteToWideChar( CP_ACP, 0, szBuf, -1, wszBuf, 512 );
#else
  wszBuf = szBuf;
#endif

  BSTR bstrNew = ::SysAllocString (wszBuf);

#ifndef UNICODE
  delete [] wszBuf;
#endif

  return bstrNew;
}

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/VCAcct/Updatereceipt.Cpp File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • VCAcct

Updatereceipt.Cpp File Reference

#include "stdafx.h"
#include "Account.h"
#include "UpdateReceipt.h"
#include <comsvcs.h>
#include <adoid.h>
#include <adoint.h>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/VCAcct/Updatereceipt.h File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • VCAcct
Classes

Updatereceipt.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class CUpdateReceipt
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/_ADO.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

_ADO.java File Reference

Go to the source code of this file.

Classes

interface | msado15::_ADO
.interface(iid=00000534-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/_Collection.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

_Collection.java File Reference

Go to the source code of this file.

Classes

interface | msado15::_Collection
.interface(iid=00000512-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/_Command.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

_Command.java File Reference

Go to the source code of this file.

Classes

interface | msado15::_Command
.interface(iid=0000054E-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/_Connection.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

_Connection.java File Reference

Go to the source code of this file.

Classes

interface | msado15::_Connection
.interface(iid=00000550-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/_DynaCollection.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

_DynaCollection.java File Reference

Go to the source code of this file.

Classes

interface | msado15::_DynaCollection
.interface(iid=00000513-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/_Parameter.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

_Parameter.java File Reference

Go to the source code of this file.

Classes

interface | msado15::_Parameter
.interface(iid=0000050C-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/_Record.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

_Record.java File Reference

Go to the source code of this file.

Classes

interface | msado15::_Record
.interface(iid=00000562-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/_Recordset.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

_Recordset.java File Reference

Go to the source code of this file.

Classes

interface | msado15::_Recordset
.interface(iid=00000556-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/_Stream.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

_Stream.java File Reference

Go to the source code of this file.

Classes

interface | msado15::_Stream
.interface(iid=00000565-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ADCPROP_ASYNCTHREADPRIORITY_ENUM.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

ADCPROP_ASYNCTHREADPRIORITY_ENUM.java File Reference

Go to the source code of this file.

Classes

class | msado15::ADCPROP_ASYNCTHREADPRIORITY_ENUM

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ADCPROP_AUTORECALC_ENUM.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

ADCPROP_AUTORECALC_ENUM.java File Reference

Go to the source code of this file.

Classes

class | msado15::ADCPROP_AUTORECALC_ENUM

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ADCPROP_UPDATECRITERIA_ENUM.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

ADCPROP_UPDATECRITERIA_ENUM.java File Reference

Go to the source code of this file.

Classes

class | msado15::ADCPROP_UPDATECRITERIA_ENUM

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ADOCommandConstruction.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

ADOCommandConstruction.java File Reference

Go to the source code of this file.

Classes

interface | msado15::ADOCommandConstruction
.interface(iid=00000517-0000-0010-8000-00AA006D2EA4, thread=AUTO) More...

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ADOConnectionConstruction.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

ADOConnectionConstruction.java File Reference

Go to the source code of this file.

Classes

interface | msado15::ADOConnectionConstruction
.interface(iid=00000551-0000-0010-8000-00AA006D2EA4, thread=AUTO) More...

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ADOConnectionConstruction15.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

ADOConnectionConstruction15.java File Reference

Go to the source code of this file.

Classes

interface | msado15::ADOConnectionConstruction15
.interface(iid=00000516-0000-0010-8000-00AA006D2EA4, thread=AUTO) More...

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ADORecordConstruction.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

ADORecordConstruction.java File Reference

Go to the source code of this file.

Classes

interface | msado15::ADORecordConstruction
.interface(iid=00000567-0000-0010-8000-00AA006D2EA4, thread=AUTO) More...

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ADORecordsetConstruction.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

ADORecordsetConstruction.java File Reference

Go to the source code of this file.

Classes

interface | msado15::ADORecordsetConstruction
.interface(iid=00000283-0000-0010-8000-00AA006D2EA4, thread=AUTO) More...

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ADOStreamConstruction.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

ADOStreamConstruction.java File Reference

Go to the source code of this file.

Classes

interface | msado15::ADOStreamConstruction
.interface(iid=00000568-0000-0010-8000-00AA006D2EA4, thread=AUTO) More...

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/AffectEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

AffectEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::AffectEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/BookmarkEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

BookmarkEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::BookmarkEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/CEResyncEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

CEResyncEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::CEResyncEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Command.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

Command.java File Reference

Go to the source code of this file.

Classes

class | msado15::Command
.class(classid=00000507-0000-0010-8000-00AA006D2EA4,DynamicCasts) .interface(iid=0000054E-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Command15.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

Command15.java File Reference

Go to the source code of this file.

Classes

interface | msado15::Command15
.interface(iid=00000508-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/CommandTypeEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

CommandTypeEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::CommandTypeEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/CompareEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

CompareEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::CompareEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Connection.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

Connection.java File Reference

Go to the source code of this file.

Classes

class | msado15::Connection
.class(classid=00000514-0000-0010-8000-00AA006D2EA4,DynamicCasts) .interface(iid=00000550-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Connection15.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

Connection15.java File Reference

Go to the source code of this file.

Classes

interface | msado15::Connection15
.interface(iid=00000515-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ConnectionEvents.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

ConnectionEvents.java File Reference

Go to the source code of this file.

Classes

interface | msado15::ConnectionEvents
.interface(iid=00000400-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DISPATCH) More...

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ConnectionEventsVt.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

ConnectionEventsVt.java File Reference

Go to the source code of this file.

Classes

interface | msado15::ConnectionEventsVt
.interface(iid=00000402-0000-0010-8000-00AA006D2EA4, thread=AUTO) More...

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ConnectModeEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

ConnectModeEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::ConnectModeEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ConnectOptionEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

ConnectOptionEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::ConnectOptionEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ConnectPromptEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

ConnectPromptEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::ConnectPromptEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/CopyRecordOptionsEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

CopyRecordOptionsEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::CopyRecordOptionsEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/CursorLocationEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

CursorLocationEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::CursorLocationEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/CursorOptionEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

CursorOptionEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::CursorOptionEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/CursorTypeEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

CursorTypeEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::CursorTypeEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/DataTypeEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

DataTypeEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::DataTypeEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/EditModeEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

EditModeEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::EditModeEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Error.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

Error.java File Reference

Go to the source code of this file.

Classes

interface | msado15::Error
.interface(iid=00000500-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Errors.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

Errors.java File Reference

Go to the source code of this file.

Classes

interface | msado15::Errors
.interface(iid=00000501-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ErrorValueEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

ErrorValueEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::ErrorValueEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/EventReasonEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

EventReasonEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::EventReasonEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/EventStatusEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

EventStatusEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::EventStatusEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ExecuteOptionEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

ExecuteOptionEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::ExecuteOptionEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Field.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

Field.java File Reference

Go to the source code of this file.

Classes

interface | msado15::Field
.interface(iid=0000054C-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Field15.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

Field15.java File Reference

Go to the source code of this file.

Classes

interface | msado15::Field15
.interface(iid=00000505-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/FieldAttributeEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

FieldAttributeEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::FieldAttributeEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/FieldEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

FieldEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::FieldEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Fields.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

Fields.java File Reference

Go to the source code of this file.

Classes

interface | msado15::Fields
.interface(iid=00000564-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Fields15.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

Fields15.java File Reference

Go to the source code of this file.

Classes

interface | msado15::Fields15
.interface(iid=00000506-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Fields20.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

Fields20.java File Reference

Go to the source code of this file.

Classes

interface | msado15::Fields20
.interface(iid=0000054D-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/FilterGroupEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

FilterGroupEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::FilterGroupEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/GetRowsOptionEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

GetRowsOptionEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::GetRowsOptionEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/IRecFields.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

IRecFields.java File Reference

Go to the source code of this file.

Classes

interface | msado15::IRecFields
.interface(iid=00000563-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/IsolationLevelEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

IsolationLevelEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::IsolationLevelEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/LineSeparatorEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

LineSeparatorEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::LineSeparatorEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/LockTypeEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

LockTypeEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::LockTypeEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/MarshalOptionsEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

MarshalOptionsEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::MarshalOptionsEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/MoveRecordOptionsEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

MoveRecordOptionsEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::MoveRecordOptionsEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ObjectStateEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

ObjectStateEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::ObjectStateEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Parameter.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

Parameter.java File Reference

Go to the source code of this file.

Classes

class | msado15::Parameter
.class(classid=0000050B-0000-0010-8000-00AA006D2EA4,DynamicCasts) .interface(iid=0000050C-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ParameterAttributesEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

ParameterAttributesEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::ParameterAttributesEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ParameterDirectionEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

ParameterDirectionEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::ParameterDirectionEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Parameters.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

Parameters.java File Reference

Go to the source code of this file.

Classes

interface | msado15::Parameters
.interface(iid=0000050D-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/PersistFormatEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

PersistFormatEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::PersistFormatEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/PositionEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

PositionEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::PositionEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Properties.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

Properties.java File Reference

Go to the source code of this file.

Classes

interface | msado15::Properties
.interface(iid=00000504-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Property.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

Property.java File Reference

Go to the source code of this file.

Classes

interface | msado15::Property
.interface(iid=00000503-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/PropertyAttributesEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

PropertyAttributesEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::PropertyAttributesEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Record.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

Record.java File Reference

Go to the source code of this file.

Classes

class | msado15::Record
.class(classid=00000560-0000-0010-8000-00AA006D2EA4,DynamicCasts) .interface(iid=00000562-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/RecordCreateOptionsEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

RecordCreateOptionsEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::RecordCreateOptionsEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/RecordOpenOptionsEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

RecordOpenOptionsEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::RecordOpenOptionsEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Recordset.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

Recordset.java File Reference

Go to the source code of this file.

Classes

class | msado15::Recordset
.class(classid=00000535-0000-0010-8000-00AA006D2EA4,DynamicCasts) .interface(iid=00000556-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Recordset15.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

Recordset15.java File Reference

Go to the source code of this file.

Classes

interface | msado15::Recordset15
.interface(iid=0000050E-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Recordset20.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

Recordset20.java File Reference

Go to the source code of this file.

Classes

interface | msado15::Recordset20
.interface(iid=0000054F-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Recordset21.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

Recordset21.java File Reference

Go to the source code of this file.

Classes

interface | msado15::Recordset21
.interface(iid=00000555-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/RecordsetEvents.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

RecordsetEvents.java File Reference

Go to the source code of this file.

Classes

interface | msado15::RecordsetEvents
.interface(iid=00000266-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DISPATCH) More...

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/RecordsetEventsVt.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

RecordsetEventsVt.java File Reference

Go to the source code of this file.

Classes

interface | msado15::RecordsetEventsVt
.interface(iid=00000403-0000-0010-8000-00AA006D2EA4, thread=AUTO) More...

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/RecordStatusEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

RecordStatusEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::RecordStatusEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/RecordTypeEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

RecordTypeEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::RecordTypeEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/ResyncEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

ResyncEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::ResyncEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/SaveOptionsEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

SaveOptionsEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::SaveOptionsEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/SchemaEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

SchemaEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::SchemaEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/SearchDirectionEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

SearchDirectionEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::SearchDirectionEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/SeekEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

SeekEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::SeekEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/Stream.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

Stream.java File Reference

Go to the source code of this file.

Classes

class | msado15::Stream
.class(classid=00000566-0000-0010-8000-00AA006D2EA4,DynamicCasts) .interface(iid=00000565-0000-0010-8000-00AA006D2EA4, thread=AUTO, type=DUAL) More...

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/StreamOpenOptionsEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

StreamOpenOptionsEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::StreamOpenOptionsEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/StreamReadEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

StreamReadEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::StreamReadEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/StreamTypeEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

StreamTypeEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::StreamTypeEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/StreamWriteEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

StreamWriteEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::StreamWriteEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/StringFormatEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

StringFormatEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::StringFormatEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/MsAdo15/XactAttributeEnum.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • MsAdo15
Classes | Namespaces

XactAttributeEnum.java File Reference

Go to the source code of this file.

Classes

class | msado15::XactAttributeEnum

Namespaces

namespace | msado15
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/vcAcct/CAccount.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • vcAcct
Classes | Namespaces

CAccount.java File Reference

Go to the source code of this file.

Classes

class | vcacct::CAccount
.class(classid=04CF0B76-1989-11D0-B917-0080C7394688,DynamicCasts) .interface(iid=04CF0B72-1989-11D0-B917-0080C7394688, thread=AUTO, type=DUAL) More...

Namespaces

namespace | vcacct
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/vcAcct/CGetReceipt.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • vcAcct
Classes | Namespaces

CGetReceipt.java File Reference

Go to the source code of this file.

Classes

class | vcacct::CGetReceipt
.class(classid=A81260B2-DDC8-11D0-B5A0-00C04FB957D8,DynamicCasts) .interface(iid=A81260B1-DDC8-11D0-B5A0-00C04FB957D8, thread=AUTO, type=DUAL) More...

Namespaces

namespace | vcacct
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/vcAcct/CMoveMoney.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • vcAcct
Classes | Namespaces

CMoveMoney.java File Reference

Go to the source code of this file.

Classes

class | vcacct::CMoveMoney
.class(classid=04CF0B7B-1989-11D0-B917-0080C7394688,DynamicCasts) .interface(iid=04CF0B77-1989-11D0-B917-0080C7394688, thread=AUTO, type=DUAL) More...

Namespaces

namespace | vcacct
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/vcAcct/CUpdateReceipt.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • vcAcct
Classes | Namespaces

CUpdateReceipt.java File Reference

Go to the source code of this file.

Classes

class | vcacct::CUpdateReceipt
.class(classid=A81260B8-DDC8-11D0-B5A0-00C04FB957D8,DynamicCasts) .interface(iid=A81260B7-DDC8-11D0-B5A0-00C04FB957D8, thread=AUTO, type=DUAL) More...

Namespaces

namespace | vcacct
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/vcAcct/IAccount.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • vcAcct
Classes | Namespaces

IAccount.java File Reference

Go to the source code of this file.

Classes

interface | vcacct::IAccount
.interface(iid=04CF0B72-1989-11D0-B917-0080C7394688, thread=AUTO, type=DUAL) More...

Namespaces

namespace | vcacct
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/vcAcct/IGetReceipt.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • vcAcct
Classes | Namespaces

IGetReceipt.java File Reference

Go to the source code of this file.

Classes

interface | vcacct::IGetReceipt
.interface(iid=A81260B1-DDC8-11D0-B5A0-00C04FB957D8, thread=AUTO, type=DUAL) More...

Namespaces

namespace | vcacct
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/vcAcct/IMoveMoney.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • vcAcct
Classes | Namespaces

IMoveMoney.java File Reference

Go to the source code of this file.

Classes

interface | vcacct::IMoveMoney
.interface(iid=04CF0B77-1989-11D0-B917-0080C7394688, thread=AUTO, type=DUAL) More...

Namespaces

namespace | vcacct
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Services/Transaction/SampleBank/vjAcct/vcAcct/IUpdateReceipt.java File Reference

  • Com
  • Services
  • Transaction
  • SampleBank
  • vjAcct
  • vcAcct
Classes | Namespaces

IUpdateReceipt.java File Reference

Go to the source code of this file.

Classes

interface | vcacct::IUpdateReceipt
.interface(iid=A81260B7-DDC8-11D0-B5A0-00C04FB957D8, thread=AUTO, type=DUAL) More...

Namespaces

namespace | vcacct
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/StructuredStorage/Propsets/propdump.cpp File Reference

  • Com
  • StructuredStorage
  • Propsets
Defines | Functions

propdump.cpp File Reference

#include <stdio.h>
#include <windows.h>

Go to the source code of this file.

Defines

#define | _UNICODE
#define | UNICODE

Functions

void | ConvertValueToString (const PROPVARIANT &propvar, WCHAR *pwszValue, ULONG cchValue)
void | ConvertVarTypeToString (VARTYPE vt, WCHAR *pwszType, ULONG cchType)
void | DisplayProperty (const PROPVARIANT &propvar, const STATPROPSTG &statpropstg)
void | DisplayPropertySet (FMTID fmtid, const WCHAR *pwszStorageName, IPropertyStorage *pPropStg)
void | DisplayPropertySetsInStorage (const WCHAR *pwszStorageName, IPropertySetStorage *pPropSetStg)
void | DisplayStorageTree (const WCHAR *pwszStorageName, IStorage *pStg)
void | wmain (int cArgs, WCHAR *rgwszArgs[])

Define Documentation

#define _UNICODE

Definition at line 15 of file propdump.cpp.

#define UNICODE

Definition at line 14 of file propdump.cpp.

Function Documentation

void ConvertValueToString | ( | const PROPVARIANT & | propvar,
 |  | WCHAR * | pwszValue,
 |  | ULONG | cchValue
 | ) |  |

Definition at line 202 of file propdump.cpp.

{
    // Make sure the output string will be terminated

    pwszValue[ cchValue - 1 ] = L'\0';
    --cchValue;

    // Based on the type, put the value into pwszValue as a string.

    switch( propvar.vt )
    {
    case VT_EMPTY:
        wcsncpy( pwszValue, L"", cchValue );
        break;
    case VT_NULL:
        wcsncpy( pwszValue, L"", cchValue );
        break;
    case VT_I2:
        _snwprintf( pwszValue, cchValue, L"%i", propvar.iVal );
        break;
    case VT_I4:
    case VT_INT:
        _snwprintf( pwszValue, cchValue, L"%li", propvar.lVal );
        break;
    case VT_I8:
        _snwprintf( pwszValue, cchValue, L"%I64i", propvar.hVal );
        break;
    case VT_UI2:
        _snwprintf ( pwszValue, cchValue, L"%u", propvar.uiVal );
        break;
    case VT_UI4:
    case VT_UINT:
        _snwprintf ( pwszValue, cchValue, L"%lu", propvar.ulVal );
        break;
    case VT_UI8:
        _snwprintf ( pwszValue, cchValue, L"%I64u", propvar.uhVal );
        break;
    case VT_R4:
        _snwprintf ( pwszValue, cchValue, L"%f", propvar.fltVal );
        break;
    case VT_R8:
        _snwprintf ( pwszValue, cchValue, L"%lf", propvar.dblVal );
        break;
    case VT_BSTR:
        _snwprintf ( pwszValue, cchValue, L"\"%s\"", propvar.bstrVal );
        break;
    case VT_ERROR:
        _snwprintf ( pwszValue, cchValue, L"0x%08X", propvar.scode );
        break;
    case VT_BOOL:
        _snwprintf ( pwszValue, cchValue, L"%s",
                     VARIANT_TRUE == propvar.boolVal ? L"True" : L"False" );
        break;
    case VT_I1:
        _snwprintf ( pwszValue, cchValue, L"%i", propvar.cVal );
        break;
    case VT_UI1:
        _snwprintf ( pwszValue, cchValue, L"%u", propvar.bVal );
        break;
    case VT_VOID:
        wcsncpy( pwszValue, L"", cchValue );
        break;
    case VT_LPSTR:
        if( 0 >_snwprintf ( pwszValue, cchValue, L"\"%hs\"", propvar.pszVal ))
            // String is too big for pwszValue
            wcsncpy( pwszValue, L"...", cchValue );
        break;
    case VT_LPWSTR:
        if( 0 > _snwprintf ( pwszValue, cchValue, L"\"%s\"", propvar.pwszVal ))
            // String is too big for pwszValue
            wcsncpy( pwszValue, L"...", cchValue );
        break;
    case VT_FILETIME:
        _snwprintf ( pwszValue, cchValue, L"%08x:%08x",
                     propvar.filetime.dwHighDateTime,
                     propvar.filetime.dwLowDateTime );
        break;
    case VT_CLSID:
        pwszValue[0] = L'\0';
        StringFromGUID2( *propvar.puuid, pwszValue, cchValue );
        break;
    default:
        wcsncpy( pwszValue, L"...", cchValue );
        break;
    }

}

void ConvertVarTypeToString | ( | VARTYPE | vt,
 |  | WCHAR * | pwszType,
 |  | ULONG | cchType
 | ) |  |

Definition at line 33 of file propdump.cpp.

{
    const WCHAR *pwszModifier;

    // Make sure the output string will be terminated
    // (wcsncpy doesn't guarantee termination)

    pwszType[ cchType-1 ] = L'\0';
    --cchType;

    // Stringize the basic type

    switch( vt & VT_TYPEMASK )
    {
    case VT_EMPTY:
        wcsncpy( pwszType, L"VT_EMPTY", cchType );
        break;
    case VT_NULL:
        wcsncpy( pwszType, L"VT_NULL", cchType );
        break;
    case VT_I2:
        wcsncpy( pwszType, L"VT_I2", cchType );
        break;
    case VT_I4:
        wcsncpy( pwszType, L"VT_I4", cchType );
        break;
    case VT_I8:
        wcsncpy( pwszType, L"VT_I8", cchType );
        break;
    case VT_UI2:
        wcsncpy( pwszType, L"VT_UI2", cchType );
        break;
    case VT_UI4:
        wcsncpy( pwszType, L"VT_UI4", cchType );
        break;
    case VT_UI8:
        wcsncpy( pwszType, L"VT_UI8", cchType );
        break;
    case VT_R4:
        wcsncpy( pwszType, L"VT_R4", cchType );
        break;
    case VT_R8:
        wcsncpy( pwszType, L"VT_R8", cchType );
        break;
    case VT_CY:
        wcsncpy( pwszType, L"VT_CY", cchType );
        break;
    case VT_DATE:
        wcsncpy( pwszType, L"VT_DATE", cchType );
        break;
    case VT_BSTR:
        wcsncpy( pwszType, L"VT_BSTR", cchType );
        break;
    case VT_ERROR:
        wcsncpy( pwszType, L"VT_ERROR", cchType );
        break;
    case VT_BOOL:
        wcsncpy( pwszType, L"VT_BOOL", cchType );
        break;
    case VT_VARIANT:
        wcsncpy( pwszType, L"VT_VARIANT", cchType );
        break;
    case VT_DECIMAL:
        wcsncpy( pwszType, L"VT_DECIMAL", cchType );
        break;
    case VT_I1:
        wcsncpy( pwszType, L"VT_I1", cchType );
        break;
    case VT_UI1:
        wcsncpy( pwszType, L"VT_UI1", cchType );
        break;
    case VT_INT:
        wcsncpy( pwszType, L"VT_INT", cchType );
        break;
    case VT_UINT:
        wcsncpy( pwszType, L"VT_UINT", cchType );
        break;
    case VT_VOID:
        wcsncpy( pwszType, L"VT_VOID", cchType );
        break;
    case VT_SAFEARRAY:
        wcsncpy( pwszType, L"VT_SAFEARRAY", cchType );
        break;
    case VT_USERDEFINED:
        wcsncpy( pwszType, L"VT_USERDEFINED", cchType );
        break;
    case VT_LPSTR:
        wcsncpy( pwszType, L"VT_LPSTR", cchType );
        break;
    case VT_LPWSTR:
        wcsncpy( pwszType, L"VT_LPWSTR", cchType );
        break;
    case VT_RECORD:
        wcsncpy( pwszType, L"VT_RECORD", cchType );
        break;
    case VT_FILETIME:
        wcsncpy( pwszType, L"VT_FILETIME", cchType );
        break;
    case VT_BLOB:
        wcsncpy( pwszType, L"VT_BLOB", cchType );
        break;
    case VT_STREAM:
        wcsncpy( pwszType, L"VT_STREAM", cchType );
        break;
    case VT_STORAGE:
        wcsncpy( pwszType, L"VT_STORAGE", cchType );
        break;
    case VT_STREAMED_OBJECT:
        wcsncpy( pwszType, L"VT_STREAMED_OBJECT", cchType );
        break;
    case VT_STORED_OBJECT:
        wcsncpy( pwszType, L"VT_BLOB_OBJECT", cchType );
        break;
    case VT_CF:
        wcsncpy( pwszType, L"VT_CF", cchType );
        break;
    case VT_CLSID:
        wcsncpy( pwszType, L"VT_CLSID", cchType );
        break;
    default:
        _snwprintf( pwszType, cchType, L"Unknown (%d)", vt & VT_TYPEMASK );
        break;
    }

    // Adjust cchType for the characters we just added

    cchType -= wcslen(pwszType);

    // Add the type modifiers if present

    if( vt & VT_VECTOR )
    {
        pwszModifier = L" | VT_VECTOR";
        wcsncat( pwszType, pwszModifier, cchType );
        cchType -= wcslen( pwszModifier );
    }

    if( vt & VT_ARRAY )
    {
        pwszModifier = L" | VT_ARRAY";
        wcsncat( pwszType, pwszModifier, cchType );
        cchType -= wcslen( pwszModifier );
    }

    if( vt & VT_RESERVED )
    {
        pwszModifier = L" | VT_RESERVED";
        wcsncat( pwszType, pwszModifier, cchType );
        cchType -= wcslen( pwszModifier );
    }

}

void DisplayProperty | ( | const PROPVARIANT & | propvar,
 |  | const STATPROPSTG & | statpropstg
 | ) |  |

Definition at line 302 of file propdump.cpp.

{
    WCHAR wsz[ MAX_PATH + 1 ];

    ConvertVarTypeToString( statpropstg.vt, wsz, sizeof(wsz)/sizeof(wsz[0]) );

    wprintf( L"   ----------------------------------------------------\n"
             L"   PropID = %-5d VarType = %-23s",
             statpropstg.propid, wsz );

    if( NULL != statpropstg.lpwstrName )
        wprintf( L" Name = %s", statpropstg.lpwstrName );

    ConvertValueToString( propvar, wsz, sizeof(wsz)/sizeof(wsz[0]) );

    wprintf( L"\n   Value = %s\n", wsz );

}

void DisplayPropertySet | ( | FMTID | fmtid,
 |  | const WCHAR * | pwszStorageName,
 |  | IPropertyStorage * | pPropStg
 | ) |  |

Definition at line 331 of file propdump.cpp.

{
    IEnumSTATPROPSTG *penum = NULL;
    HRESULT hr = S_OK;
    STATPROPSTG statpropstg;
    PROPVARIANT propvar;
    PROPSPEC propspec;
    PROPID propid;
    WCHAR *pwszFriendlyName = NULL;

    // This string will hold a string-ized FMTID.  It needs
    // to be 38 characters, plus the terminator
    // character.  But just to be safe we'll make
    // it a little bigger.
    WCHAR wszFMTID[ 64 ] = { L"" };

    PropVariantInit( &propvar );
    memset( &statpropstg, 0, sizeof(statpropstg) );

    try
    {
        // Display the ID of the property set

        StringFromGUID2( fmtid,
                         wszFMTID,
                         sizeof(wszFMTID)/sizeof(wszFMTID[0]) );
        wprintf( L"\n Property Set %s\n", wszFMTID );

        // If this is one of common property sets, show which one.

        if( FMTID_SummaryInformation == fmtid )
            wprintf( L"   (SummaryInformation property set)\n" );
        else if( FMTID_DocSummaryInformation == fmtid )
            wprintf( L"   (DocumentSummaryInformation property set)\n" );
        else if( FMTID_UserDefinedProperties == fmtid )
            wprintf( L"   (UserDefined property set)\n" );

        // Also display the name of the storage that contains
        // this property set

        wprintf( L"   in \"%s\":\n", pwszStorageName );

        // If this property set has a friendly name, display it now.
        // (Property names are stored in the special dictionary
        // property - the name of the property set is indicated by naming
        // the dictionary property itself.)

        propid = PID_DICTIONARY;
        pwszFriendlyName = NULL;

        hr = pPropStg->ReadPropertyNames( 1, &propid, &pwszFriendlyName );
        if( S_OK == hr )
        {
            wprintf( L"   (Friendly name is \"%s\")\n\n", pwszFriendlyName );
            CoTaskMemFree( pwszFriendlyName );
            pwszFriendlyName = NULL;
        }
        else
            wprintf( L"\n" );

        // Get a property enumerator

        hr = pPropStg->Enum( &penum );
        if( FAILED(hr) ) throw L"Failed IPropertyStorage::Enum";

        // Get the first property in the enumeration

        hr = penum->Next( 1, &statpropstg, NULL );

        // Loop through and display each property.  The ‘Next'
        // call above (and at the bottom of the while loop)
        // will return S_OK if it returns another property,
        // S_FALSE if there are no more properties,
        // and anything else is an error.

        while( S_OK == hr )
        {

            // Read the property out of the property set

            PropVariantInit( &propvar );
            propspec.ulKind = PRSPEC_PROPID;
            propspec.propid = statpropstg.propid;

            hr = pPropStg->ReadMultiple( 1, &propspec, &propvar );
            if( FAILED(hr) ) throw L"Failed IPropertyStorage::ReadMultiple";

            // Display the property value, type, etc.

            DisplayProperty( propvar, statpropstg );

            // Free buffers that were allocated during the read and
            // by the enumerator.

            PropVariantClear( &propvar );
            CoTaskMemFree( statpropstg.lpwstrName );
            statpropstg.lpwstrName = NULL;

            // Move to the next property in the enumeration

            hr = penum->Next( 1, &statpropstg, NULL );
        }
        if( FAILED(hr) ) throw L"Failed IEnumSTATPROPSTG::Next";
    }
    catch( LPCWSTR pwszErrorMessage )
    {
        wprintf( L"Error in DumpPropertySet: %s (hr = %08x)\n",
                 pwszErrorMessage, hr );
    }

    if( NULL != penum )
        penum->Release();

    if( NULL != statpropstg.lpwstrName )
        CoTaskMemFree( statpropstg.lpwstrName );

    PropVariantClear( &propvar );
}

void DisplayPropertySetsInStorage | ( | const WCHAR * | pwszStorageName,
 |  | IPropertySetStorage * | pPropSetStg
 | ) |  |

Definition at line 462 of file propdump.cpp.

{
    IEnumSTATPROPSETSTG *penum = NULL;
    HRESULT hr = S_OK;
    IPropertyStorage *pPropStg = NULL;
    STATPROPSETSTG statpropsetstg;

    try
    {
        // Get a property-set enumerator (which only enumerates the property
        // sets at this level of the storage, not its children).

        hr = pPropSetStg->Enum( &penum );
        if( FAILED(hr) ) throw L"failed IPropertySetStorage::Enum";

        // Get the first property set in the enumeration.
        // (The field we're interested in is
        // statpropsetstg.fmtid, so that we can open the
        // property set.)

        memset( &statpropsetstg, 0, sizeof(statpropsetstg) );
        hr = penum->Next( 1, &statpropsetstg, NULL );

        // Loop through all the property sets

        while( S_OK == hr )
        {
            // Open the property set

            hr = pPropSetStg->Open( statpropsetstg.fmtid,
                                    STGM_READ | STGM_SHARE_EXCLUSIVE,
                                    &pPropStg );
            if( FAILED(hr) ) throw L"failed IPropertySetStorage::Open";

            // Display the properties in the property set

            DisplayPropertySet( statpropsetstg.fmtid,
                                pwszStorageName,
                                pPropStg );

            pPropStg->Release();
            pPropStg = NULL;

            // Get the FMTID of the next property set in the enumeration.

            hr = penum->Next( 1, &statpropsetstg, NULL );

        }
        if( FAILED(hr) ) throw L"Failed IEnumSTATPROPSETSTG::Next";

        // Special-case handling for the UserDefined property set:
        // This property set actually lives inside the well-known
        // DocumentSummaryInformation property set.  It is the only
        // property set which is allowed to live inside another
        // (and exists for legacy compatibility).  It does not get
        // included in a normal enumeration, so we have to check for
        // it explicitely.  We'll handle it by looking for it when
        // we reach the end of the enumerator.

        hr = pPropSetStg->Open( FMTID_UserDefinedProperties,
                                STGM_READ | STGM_SHARE_EXCLUSIVE,
                                &pPropStg );
        if( SUCCEEDED(hr) )
        {
            DisplayPropertySet( FMTID_UserDefinedProperties,
                                pwszStorageName,
                                pPropStg );
            pPropStg = NULL;
        }

    }
    catch( LPCWSTR pwszErrorMessage )
    {
        wprintf( L"Error in DumpPropertySetsInStorage: %s (hr = %08x)\n",
                 pwszErrorMessage, hr );
    }

    if( NULL != pPropStg )
        pPropStg->Release();
    if( NULL != penum )
        penum->Release();
}

void DisplayStorageTree | ( | const WCHAR * | pwszStorageName,
 |  | IStorage * | pStg
 | ) |  |

Definition at line 557 of file propdump.cpp.

{
    IPropertySetStorage *pPropSetStg = NULL;
    IStorage *pStgChild = NULL;
    WCHAR *pwszChildStorageName = NULL;
    IEnumSTATSTG *penum = NULL;
    HRESULT hr = S_OK;
    STATSTG statstg;

    memset( &statstg, 0, sizeof(statstg) );

    try
    {
        // Dump the property sets at this storage level

        hr = pStg->QueryInterface( IID_IPropertySetStorage,
                                   reinterpret_cast<void**>(&pPropSetStg) );
        if( FAILED(hr) )
            throw L"Failed IStorage::QueryInterface(IID_IPropertySetStorage)";

        DisplayPropertySetsInStorage( pwszStorageName, pPropSetStg );

        // Get an enumerator for this storage.

        hr = pStg->EnumElements( NULL, NULL, NULL, &penum );
        if( FAILED(hr) ) throw L"failed IStorage::Enum";

        // Get the name of the first element (stream/storage)
        // in the enumeration.  As usual, ‘Next' will return
        // S_OK if it returns an element of the enumerator,
        // S_FALSE if there are no more elements, and an
        // error otherwise.

        hr = penum->Next( 1, &statstg, 0 );

        // Loop through all the direct children of this storage.

        while( S_OK == hr )
        {
            // Check if this is a storage that isn't a property set
            // (since we already displayed the property sets above).
            // You can tell if a stream/storage is a property set
            // because the first character of it's name is the
            // ‘\005' reserved character.

            if( STGTY_STORAGE == statstg.type
                &&
                L'\005' != statstg.pwcsName[0] )
            {
                // Yes, this is a normal storage, not a propset.
                // Open the storage.

                ULONG cchChildStorageName;

                hr = pStg->OpenStorage( statstg.pwcsName,
                                        NULL,
                                        STGM_READ | STGM_SHARE_EXCLUSIVE,
                                        NULL, 0,
                                        &pStgChild );
                if( FAILED(hr) ) throw L"failed IStorage::OpenStorage";

                // Compose a name of the form "Storage\ChildStorage\..."
                // for display purposes.  First, allocate it.

                cchChildStorageName = wcslen(pwszStorageName)
                                        + wcslen(statstg.pwcsName)
                                        + 2  // For the two "\" chars
                                        + 1; // For the string terminator

                pwszChildStorageName = new WCHAR[ cchChildStorageName ];
                if( NULL == pwszChildStorageName )
                {
                    hr = HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY);
                    throw L"couldn't allocate memory";
                }

                // Terminate the name

                pwszChildStorageName[ cchChildStorageName-1 ] = L'\0';
                --cchChildStorageName;

                // Build the name.

                wcsncpy( pwszChildStorageName, pwszStorageName,
                         cchChildStorageName );
                cchChildStorageName -= wcslen(pwszStorageName);

                wcsncat( pwszChildStorageName, L"\\",
                         cchChildStorageName );
                cchChildStorageName -= 2;

                wcsncat( pwszChildStorageName, statstg.pwcsName,
                         cchChildStorageName );

                // Dump all the property sets under this child storage.

                DisplayStorageTree( pwszChildStorageName, pStgChild );

                pStgChild->Release();
                pStgChild = NULL;

                delete pwszChildStorageName;
                pwszChildStorageName = NULL;
            }

            // Move on to the next element in the enumeration of this storage.

            CoTaskMemFree( statstg.pwcsName );
            statstg.pwcsName = NULL;

            hr = penum->Next( 1, &statstg, 0 );
        }
        if( FAILED(hr) ) throw L"failed IEnumSTATSTG::Next";
    }
    catch( LPCWSTR pwszErrorMessage )
    {
        wprintf( L"Error in DumpStorageTree: %s (hr = %08x)\n",
                 pwszErrorMessage, hr );
    }

    // Clean up before returning.

    if( NULL != statstg.pwcsName )
        CoTaskMemFree( statstg.pwcsName );
    if( NULL != pStgChild )
        pStgChild->Release();
    if( NULL != pStg )
        pStg->Release();
    if( NULL != penum )
        penum->Release();
    if( NULL != pwszChildStorageName )
        delete pwszChildStorageName;

}

void wmain | ( | int | cArgs,
 |  | WCHAR * | rgwszArgs[]
 | ) |  |

Definition at line 701 of file propdump.cpp.

{
    HRESULT hr = S_OK;
    IStorage *pStg = NULL;

    // Display usage information if necessary.

    if( 1 == cArgs
        ||
        0 == wcscmp( L"-?", rgwszArgs[1] )
        ||
        0 == wcscmp( L"/?", rgwszArgs[1] ))
    {
        printf( "\n"
                "Purpose:  Enumerate all properties in all\n"
                "          property sets for a storage file\n"
                "Usage:    PropDump <filename>\n"
                "E.g.:     PropDump word.doc\n"
                "\n" );
        exit(0);
    }

    // Open the root storage.

    hr = StgOpenStorageEx( rgwszArgs[1],
                           STGM_READ | STGM_SHARE_DENY_WRITE,
                           STGFMT_ANY,
                           0,
                           NULL,
                           NULL,
                           IID_IStorage,
                           reinterpret_cast<void**>(&pStg) );

    // Dump all the properties in all the property sets within this
    // storage.

    if( FAILED(hr) )
    {
        wprintf( L"Error:  couldn't open storage \"%s\" (hr = %08x)\n",
                 rgwszArgs[1], hr );
    }
    else
    {
        printf( "\nDisplaying all property sets ...\n" );
        DisplayStorageTree( rgwszArgs[1], pStg );
        pStg->Release();
    }

}

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/StructuredStorage/Propsets/stgcreatepropsetstg.cpp File Reference

  • Com
  • StructuredStorage
  • Propsets
Defines | Functions

stgcreatepropsetstg.cpp File Reference

#include <stdio.h>
#include <windows.h>
#include <ole2.h>

Go to the source code of this file.

Defines

#define | _UNICODE
#define | UNICODE
#define | WIN32_LEAN_AND_MEAN

Functions

IPropertyStorage * | CreatePropertySetInStorage (IStorage *pStg, const FMTID &fmtid)
void | wmain ()

Define Documentation

#define _UNICODE

Definition at line 16 of file stgcreatepropsetstg.cpp.

#define UNICODE

Definition at line 15 of file stgcreatepropsetstg.cpp.

#define WIN32_LEAN_AND_MEAN

Definition at line 17 of file stgcreatepropsetstg.cpp.

Function Documentation

IPropertyStorage* CreatePropertySetInStorage | ( | IStorage * | pStg,
 |  | const FMTID & | fmtid
 | ) |  |

Definition at line 26 of file stgcreatepropsetstg.cpp.

{
    HRESULT hr = S_OK;
    IPropertySetStorage *pPropSetStg = NULL;
    IPropertyStorage *pPropStg = NULL;

    try
    {
        hr = StgCreatePropSetStg( pStg, 0 /*reserved*/, &pPropSetStg );
        if( FAILED(hr) ) throw L"Failed StgCreatePropSetStg (%08x)";

        hr = pPropSetStg->Create( fmtid, NULL,
            PROPSETFLAG_DEFAULT,
            STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE,
            &pPropStg );
        if( FAILED(hr) ) throw L"Failed IPropertySetStorage::Create (%08x)";

        // Success.  The caller must now call Release on pPropStg
    }
    catch( const WCHAR *pwszError )
    {
        wprintf( L"Error: %s (%08x)\n", pwszError, hr );
    }

    if( NULL != pPropSetStg )
        pPropSetStg->Release();

    return( pPropStg );
}

void wmain ( )

Definition at line 57 of file stgcreatepropsetstg.cpp.

{
    HRESULT hr = S_OK;
    IStorage *pStg = NULL;
    IPropertyStorage *pPropStg = NULL;

    try
    {
        // Create an object with an IStorage interface.  It is not necessary
        // that it be a system-provided storage, such as what is obtained by
        // this call.  Any object implementing IStorage will do.

        hr = StgCreateStorageEx( NULL,  // Just create a temporary storage
                                 STGM_CREATE
                                    | STGM_READWRITE
                                    | STGM_SHARE_EXCLUSIVE,
                                 STGFMT_STORAGE,
                                 0, NULL, NULL,
                                 IID_IStorage,
                                 reinterpret_cast<void**>(&pStg) );
        if( FAILED(hr) ) throw L"Failed StgCreateStorageEx";

        // Now get and use an IPropertySetStorage representing this IStorage.

        pPropStg = CreatePropertySetInStorage( pStg, FMTID_SummaryInformation );
        if( NULL == pPropStg ) throw L"Failed CreatePropertySetInStorage";

        //-----
        // Here we could call IPropertyStorage methods such as WriteMultiple and
        // ReadMultiple using the pPropStg pointer.
        //-----

        printf( "Success\n" );
    }
    catch( const WCHAR *pwszError )
    {
        wprintf( L"Error: %s (%08x)\n", pwszError, hr );
    }

    if( NULL != pPropStg )
        pPropStg->Release();
    if( NULL != pStg )
        pStg->Release();

}

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/StructuredStorage/Propsets/writeread.cpp File Reference

  • Com
  • StructuredStorage
  • Propsets
Defines | Functions | Variables

writeread.cpp File Reference

#include <stdio.h>
#include <windows.h>
#include <ole2.h>

Go to the source code of this file.

Defines

#define | _UNICODE
#define | UNICODE
#define | WIN32_LEAN_AND_MEAN

Functions

EXTERN_C void | wmain ()

Variables

const FMTID | fmtid

Define Documentation

#define _UNICODE

Definition at line 22 of file writeread.cpp.

#define UNICODE

Definition at line 21 of file writeread.cpp.

#define WIN32_LEAN_AND_MEAN

Definition at line 20 of file writeread.cpp.

Function Documentation

EXTERN_C void wmain ( )

Definition at line 41 of file writeread.cpp.

{
   HRESULT hr = S_OK;
   IPropertySetStorage *pPropSetStg = NULL;
   IPropertyStorage *pPropStg = NULL;
   WCHAR *pwszError = L"";

   try
   {

        // Create a file and a property set within it.

        hr = StgCreateStorageEx( L"WriteRead.stg",
                                 STGM_CREATE|STGM_SHARE_EXCLUSIVE|STGM_READWRITE,
                                 STGFMT_STORAGE,
                                    // STGFMT_STORAGE => Structured Storage property sets
                                    // STGFMT_FILE    => NTFS property sets
                                 0, NULL, NULL,
                                 IID_IPropertySetStorage,
                                 reinterpret_cast<void**>(&pPropSetStg) );
        if( FAILED(hr) ) throw L"Failed StgCreateStorageEx";

        hr = pPropSetStg->Create( fmtid, NULL, PROPSETFLAG_DEFAULT,
                                  STGM_CREATE|STGM_READWRITE|STGM_SHARE_EXCLUSIVE,
                                  &pPropStg );
        if( FAILED(hr) ) throw L"Failed IPropertySetStorage::Create";

        // Write a Unicode string property to the property set

        PROPVARIANT propvarWrite, propvarRead;
        PROPSPEC propspec;

        propspec.ulKind = PRSPEC_LPWSTR;
        propspec.lpwstr = L"Property Name";

        PropVariantInit( &propvarWrite );
        propvarWrite.vt = VT_LPWSTR;
        propvarWrite.pwszVal = L"Property Value";

        hr = pPropStg->WriteMultiple( 1, &propspec, &propvarWrite, PID_FIRST_USABLE );
        if( FAILED(hr) ) throw L"Failed IPropertyStorage::WriteMultiple";

        // It's not necessary, but give the property set a friendly name.

        PROPID propidDictionary = PID_DICTIONARY;
        WCHAR *pwszFriendlyName = L"Write/Read Properties Sample Property Set";
        hr = pPropStg->WritePropertyNames( 1, &propidDictionary, &pwszFriendlyName );
        if( FAILED(hr) ) throw L"Failed IPropertyStorage::WritePropertyNames";

        // Close and reopen everything.
        // By using the STGFMT_ANY flag in the StgOpenStorageEx call,
        // it doesn't matter if this is a structure storage property
        // set or an NTFS property set (see the StgCreateStorageEx call
        // above).

        pPropStg->Release(); pPropStg = NULL;
        pPropSetStg->Release(); pPropSetStg = NULL;

        hr = StgOpenStorageEx( L"WriteRead.stg",
                               STGM_READ|STGM_SHARE_DENY_WRITE,
                               STGFMT_ANY,
                               0, NULL, NULL,
                               IID_IPropertySetStorage,
                               reinterpret_cast<void**>(&pPropSetStg) );
        if( FAILED(hr) ) throw L"Failed StgOpenStorageEx";

        hr = pPropSetStg->Open( fmtid, STGM_READ|STGM_SHARE_EXCLUSIVE,
                                &pPropStg );
        if( FAILED(hr) ) throw L"Failed IPropertySetStorage::Open";

        // Read the property back and validate it

        PropVariantInit( &propvarRead );
        hr = pPropStg->ReadMultiple( 1, &propspec, &propvarRead );
        if( FAILED(hr) ) throw L"Failed IPropertyStorage::ReadMultiple";

        if( S_FALSE == hr )
            throw L"Property didn't exist after reopening the property set";
        else if( propvarWrite.vt != propvarRead.vt )
            throw L"Property types didn't match after reopening the property set";
        else if( 0 != wcscmp( propvarWrite.pwszVal, propvarRead.pwszVal ))
            throw L"Property values didn't match after reopening the property set";
        else
            wprintf( L"Success\n" );

   }
   catch( const WCHAR *pwszError )
   {
       wprintf( L"Error:  %s (hr=%08x)\n", pwszError, hr );
   }

   if( pPropStg ) pPropStg->Release();
   if( pPropSetStg ) pPropSetStg->Release();

}

Variable Documentation

const FMTID fmtid
Initial value:
 {
    0xd170df2e,
    0x1117,
    0x11d2,
    {0xaa, 0x01, 0x00, 0x80, 0x5f, 0xfe, 0x11, 0xb8}
  }

Definition at line 33 of file writeread.cpp.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Tools/COMPlusWizard/VJ/COMPlus.java File Reference

  • Com
  • Tools
  • COMPlusWizard
  • VJ
Classes

COMPlus.java File Reference

Go to the source code of this file.

Classes

class COMPlus
This class is designed to be packaged with a COM DLL output format. More...
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Tools/COMPlusWizard/VJ/op.java File Reference

  • Com
  • Tools
  • COMPlusWizard
  • VJ
Classes

op.java File Reference

Go to the source code of this file.

Classes

class COMPlus
This class is designed to be packaged with a COM DLL output format. More...
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Tools/EntityProxy/DataServices/data.Cpp File Reference

  • Com
  • Tools
  • EntityProxy
  • DataServices
Functions | Variables

data.Cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include "Data.h"
#include "Data_i.c"
#include "Entity.h"
#include "Dynamic.h"
#include "odbcdata.h"
#include "Proxy.h"
#include "Resultset.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 56 of file data.Cpp.

{
//    return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
  return S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 65 of file data.Cpp.

{
    return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 33 of file data.Cpp.

{
    if (dwReason == DLL_PROCESS_ATTACH)
    {
        _Module.Init(ObjectMap, hInstance, &LIBID_DataServices);
        DisableThreadLibraryCalls(hInstance);
    LoadLibraryW(L"dbnmpntw.dll");
    LoadLibraryW(L"odbc32.dll");
    LoadLibraryW(L"sqlsrv32.dll");
    LoadLibraryW(L"nddeapi.dll");
    LoadLibraryW(L"winspool.drv");
    }
    else if (dwReason == DLL_PROCESS_DETACH)
  {
        _Module.Term();
  }
  _Module.Lock();
    return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 73 of file data.Cpp.

{
    // registers object, typelib and all interfaces in typelib
    return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 82 of file data.Cpp.

{
    return _Module.UnregisterServer(TRUE);
}

Variable Documentation

CComModule _Module

Definition at line 20 of file data.Cpp.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Tools/EntityProxy/DataServices/data.Idl File Reference

  • Com
  • Tools
  • EntityProxy
  • DataServices
Enumerations | Functions | Variables

data.Idl File Reference

#include <mtxattr.h>

Go to the source code of this file.

Enumerations

enum ColEditModeEnum {
colEditNone = 0, colEditInProgress = 1, colEditAdd = 2, colEditDelete = 4,
colEditDeleted = 8
}

Functions

HRESULT _stdcall | _NewEnum ([out, retval] IUnknown **ppunk)
HRESULT _stdcall | Add ([in] VARIANT *Item,[in, optional] VARIANT *Key,[in, optional] VARIANT *Before,[in, optional] VARIANT *After)
HRESULT | Append (VARIANT *pItem, VARIANT *pKey)
HRESULT _stdcall | Count ([out, retval] long *pi4)
HRESULT | DeleteCommand ([out, retval] BSTR *pVal)
HRESULT | DeleteStoredProcedure ([out, retval] BSTR *pVal)
HRESULT | DeleteStoredProcedure ([in] BSTR newVal)
HRESULT | EditMode ([out, retval] ColEditModeEnum *pVal)
HRESULT | EditMode ([in] ColEditModeEnum newVal)
HRESULT | EntityDelete ([in] IEntityData *Entity,[out, retval] long *Result)
HRESULT | EntityInsert (IEntityData *Entity,[out, retval] long *Result)
HRESULT | EntityLoad ([in] BSTR ReadStoredProc,[in] BSTR UpdateStoredProc,[in] BSTR DeleteStoredProc,[in] BSTR InsertStoredProc,[in] BSTR KeyField,[in] VARIANT KeyValue,[out, optional] long *Result,[out, retval] IEntityData **Entity)
HRESULT | EntityLookup ([in]BSTR SQLString,[out, optional] long *Result,[in, optional] BSTR ReadStoredProc,[in, optional] BSTR UpdateStoredProc,[in, optional] BSTR DeleteStoredProc,[in, optional] BSTR InsertStoredProc,[in, optional] BSTR KeyField,[out, retval] IEntityData **Entity)
HRESULT | EntityQuery ([in]BSTR SQLString,[out, optional] long *Result,[in, optional] BSTR ReadStoredProc,[in, optional] BSTR UpdateStoredProc,[in, optional] BSTR DeleteStoredProc,[in, optional] BSTR InsertStoredProc,[in, optional] BSTR KeyField,[out, retval] IResultset **Resultset)
HRESULT | EntityRead ([in] IEntityData *Entity,[out, retval] long *Results)
HRESULT | EntityUpdate ([in]IEntityData *Entity,[out, retval] long *Result)
HRESULT | Field ([in] VARIANT *Index,[out, retval] VARIANT *pVal)
interface | helpstring ("Given an index, returns an item in the collection.")] HRESULT _stdcall Item([in] VARIANT *Index
interface | helpstring ("Given an index, returns an item in the resultset.")] HRESULT Record(long nIndex
interface | helpstring ("Execute a SQL String as fast as possible.")] HRESULT Execute([in] BSTR SQLString
interface | helpstring ("Given an index, returns an item in the structure.")] HRESULT _stdcall Item([in] VARIANT *Index
interface | id (DISPID_VALUE)
importlib ("stdole2.tlb")
library DataServices | importlib ("stdole32.tlb")
importlib ("c:\Program Files\Common Files\System\ado\msado15.dll")
HRESULT | Initialize (long Size)
HRESULT | Insert ([in] long Index,[in] BSTR Key,[in] VARIANT *pVal)
HRESULT | InsertCommand ([out, retval] BSTR *pVal)
HRESULT | InsertStoredProcedure ([in] BSTR newVal)
HRESULT | InsertStoredProcedure ([out, retval] BSTR *pVal)
HRESULT | Key (long Index,[out, retval] BSTR *pVal)
HRESULT | Key (long Index,[in] BSTR newVal)
HRESULT | KeyField ([in] BSTR newVal)
HRESULT | KeyField ([out, retval] BSTR *pVal)
HRESULT | LookupFree ()
HRESULT | ManualConstruct ([in] BSTR ConstructString)
HRESULT | NextEntity ([out, retval] IEntityData **Entity)
HRESULT | NextLookup ([out, optional] long *Result,[out, retval] IEntityData **Entity)
HRESULT | NextResultset ([out, optional] long *Result,[out, retval] IResultset **Resultset)
HRESULT | ReadCommand ([out, retval] BSTR *pVal)
HRESULT | ReadStoredProcedure ([out, retval] BSTR *pVal)
HRESULT | ReadStoredProcedure ([in] BSTR newVal)
HRESULT | Recordset ([in] _Recordset *newVal)
HRESULT _stdcall | Remove ([in] VARIANT *Index)
HRESULT | RSQuery ([in] BSTR QueryText,[out, optional] VARIANT *Result,[out, retval] _Recordset **Recordset)
HRESULT | RSQueryRW ([in] BSTR QueryText,[out, optional] VARIANT *Result,[out, retval] _Recordset **rs)
HRESULT | RSUpdate (_Recordset *rs)
HRESULT | UpdateCommand ([out, retval] BSTR *pVal)
HRESULT | UpdateStoredProcedure ([in] BSTR newVal)
HRESULT | UpdateStoredProcedure ([out, retval] BSTR *pVal)

Variables

import oaidl | idl
interface IEntityData ** | pVal
interface VARIANT * | pvarRet
interface long * | Result

Enumeration Type Documentation

enum ColEditModeEnum
Enumerator:
colEditNone
colEditInProgress
colEditAdd
colEditDelete
colEditDeleted

Definition at line 26 of file data.Idl.

                 {
        colEditNone = 0,
        colEditInProgress = 1,
        colEditAdd = 2,
        colEditDelete = 4,
        colEditDeleted = 8
    } ColEditModeEnum;

Function Documentation

HRESULT _stdcall _NewEnum ( [out, retval] IUnknown ** ppunk )
HRESULT _stdcall Add | ( | [in] VARIANT * | Item,
 |  | [in, optional] VARIANT * | Key,
 |  | [in, optional] VARIANT * | Before,
 |  | [in, optional] VARIANT * | After
 | ) |  |
HRESULT Append | ( | VARIANT * | pItem,
 |  | VARIANT * | pKey
 | ) |  |
HRESULT _stdcall Count ( [out, retval] long * pi4 )
HRESULT DeleteCommand ( [out, retval] BSTR * pVal ) [get]
HRESULT DeleteStoredProcedure ( [out, retval] BSTR * pVal ) [get]
HRESULT DeleteStoredProcedure ( [in] BSTR newVal ) [set]
HRESULT EditMode ( [out, retval] ColEditModeEnum * pVal ) [get]
HRESULT EditMode ( [in] ColEditModeEnum newVal ) [set]
HRESULT EntityDelete | ( | [in] IEntityData * | Entity,
 |  | [out, retval] long * | Result
 | ) |  |
HRESULT EntityInsert | ( | IEntityData * | Entity,
 |  | [out, retval] long * | Result
 | ) |  |
HRESULT EntityLoad | ( | [in] BSTR | ReadStoredProc,
 |  | [in] BSTR | UpdateStoredProc,
 |  | [in] BSTR | DeleteStoredProc,
 |  | [in] BSTR | InsertStoredProc,
 |  | [in] BSTR | KeyField,
 |  | [in] VARIANT | KeyValue,
 |  | [out, optional] long * | Result,
 |  | [out, retval] IEntityData ** | Entity
 | ) |  |
HRESULT EntityLookup | ( | [in] BSTR | SQLString,
 |  | [out, optional] long * | Result,
 |  | [in, optional] BSTR | ReadStoredProc,
 |  | [in, optional] BSTR | UpdateStoredProc,
 |  | [in, optional] BSTR | DeleteStoredProc,
 |  | [in, optional] BSTR | InsertStoredProc,
 |  | [in, optional] BSTR | KeyField,
 |  | [out, retval] IEntityData ** | Entity
 | ) |  |
HRESULT EntityQuery | ( | [in] BSTR | SQLString,
 |  | [out, optional] long * | Result,
 |  | [in, optional] BSTR | ReadStoredProc,
 |  | [in, optional] BSTR | UpdateStoredProc,
 |  | [in, optional] BSTR | DeleteStoredProc,
 |  | [in, optional] BSTR | InsertStoredProc,
 |  | [in, optional] BSTR | KeyField,
 |  | [out, retval] IResultset ** | Resultset
 | ) |  |
HRESULT EntityRead | ( | [in] IEntityData * | Entity,
 |  | [out, retval] long * | Results
 | ) |  |
HRESULT EntityUpdate | ( | [in] IEntityData * | Entity,
 |  | [out, retval] long * | Result
 | ) |  |
HRESULT Field | ( | [in] VARIANT * | Index,
 |  | [out, retval] VARIANT * | pVal |
 | ) |  |  | [get]
interface helpstring | ( | "Given an | index,
 |  | returns an item in the collection." |
 | ) |  |
interface helpstring | ( | "Given an | index,
 |  | returns an item in the resultset." |
 | ) |  |
interface helpstring ( "Execute a SQL String as fast as possible." )
interface helpstring | ( | "Given an | index,
 |  | returns an item in the structure." |
 | ) |  |
interface id ( DISPID_VALUE )
importlib ( "stdole2.tlb" )
library DataServices importlib ( "stdole32.tlb" )
importlib ( "c:\Program Files\Common Files\System\ado\msado15.dll" )
HRESULT Initialize ( long Size )
HRESULT Insert | ( | [in] long | Index,
 |  | [in] BSTR | Key,
 |  | [in] VARIANT * | pVal
 | ) |  |
HRESULT InsertCommand ( [out, retval] BSTR * pVal ) [get]
HRESULT InsertStoredProcedure ( [in] BSTR newVal ) [set]
HRESULT InsertStoredProcedure ( [out, retval] BSTR * pVal ) [get]
HRESULT Key | ( | long | Index,
 |  | [out, retval] BSTR * | pVal |
 | ) |  |  | [get]
HRESULT Key | ( | long | Index,
 |  | [in] BSTR | newVal |
 | ) |  |  | [set]
HRESULT KeyField ( [in] BSTR newVal ) [set]
HRESULT KeyField ( [out, retval] BSTR * pVal ) [get]
HRESULT LookupFree ( )
HRESULT ManualConstruct ( [in] BSTR ConstructString )
HRESULT NextEntity ( [out, retval] IEntityData ** Entity )
HRESULT NextLookup | ( | [out, optional] long * | Result,
 |  | [out, retval] IEntityData ** | Entity
 | ) |  |
HRESULT NextResultset | ( | [out, optional] long * | Result,
 |  | [out, retval] IResultset ** | Resultset
 | ) |  |
HRESULT ReadCommand ( [out, retval] BSTR * pVal ) [get]
HRESULT ReadStoredProcedure ( [out, retval] BSTR * pVal ) [get]
HRESULT ReadStoredProcedure ( [in] BSTR newVal ) [set]
HRESULT Recordset ( [in] _Recordset * newVal ) [set]
HRESULT _stdcall Remove ( [in] VARIANT * Index )
HRESULT RSQuery | ( | [in] BSTR | QueryText,
 |  | [out, optional] VARIANT * | Result,
 |  | [out, retval] _Recordset ** | Recordset
 | ) |  |
HRESULT RSQueryRW | ( | [in] BSTR | QueryText,
 |  | [out, optional] VARIANT * | Result,
 |  | [out, retval] _Recordset ** | rs
 | ) |  |
HRESULT RSUpdate ( _Recordset * rs )
HRESULT UpdateCommand ( [out, retval] BSTR * pVal ) [get]
HRESULT UpdateStoredProcedure ( [in] BSTR newVal ) [set]
HRESULT UpdateStoredProcedure ( [out, retval] BSTR * pVal ) [get]

Variable Documentation

import ocidl idl

Definition at line 7 of file data.Idl.

interface retval long * pVal

Definition at line 146 of file data.Idl.

interface VARIANT * pvarRet

Definition at line 46 of file data.Idl.

interface long* Result

Definition at line 160 of file data.Idl.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Tools/EntityProxy/DataServices/dynamic.Cpp File Reference

  • Com
  • Tools
  • EntityProxy
  • DataServices

dynamic.Cpp File Reference

#include "stdafx.h"
#include "Data.h"
#include "Dynamic.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Tools/EntityProxy/DataServices/dynamic.h File Reference

  • Com
  • Tools
  • EntityProxy
  • DataServices
Classes | Typedefs | Functions

dynamic.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class | CDynamic

Typedefs

typedef std::map< _bstr_t, long > | bstr2long
typedef std::map< long, _bstr_t > | long2bstr
typedef std::vector
< CFastVariant, std::allocator
< CFastVariant > > 		varvect

Functions

bool | operator< (const CFastVariant l, const CFastVariant r)
bool | operator== (const CFastVariant l, const CFastVariant r)

Typedef Documentation

typedef std::map<_bstr_t, long> bstr2long

Definition at line 15 of file dynamic.h.

typedef std::map<long, _bstr_t> long2bstr

Definition at line 16 of file dynamic.h.

typedef std::vector<CFastVariant, std::allocator<CFastVariant> > varvect

Definition at line 13 of file dynamic.h.

Function Documentation

bool operator< | ( | const CFastVariant | l,
 |  | const CFastVariant | r
 | ) |  |
bool operator== | ( | const CFastVariant | l,
 |  | const CFastVariant | r
 | ) |  |
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Tools/EntityProxy/DataServices/entity.Cpp File Reference

  • Com
  • Tools
  • EntityProxy
  • DataServices
Functions

entity.Cpp File Reference

#include "stdafx.h"
#include "Data.h"
#include "Entity.h"

Go to the source code of this file.

Functions

IMPLEMENT_FIXED_ALLOC (CEntity, 100)
IMPLEMENT_FIXED_ALLOC (CStaticEntity, 100)

Function Documentation

IMPLEMENT_FIXED_ALLOC | ( | CEntity | ,
 |  | 100 |
 | ) |  |
IMPLEMENT_FIXED_ALLOC | ( | CStaticEntity | ,
 |  | 100 |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Tools/EntityProxy/DataServices/entity.h File Reference

  • Com
  • Tools
  • EntityProxy
  • DataServices
Classes

entity.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class | CEntity
class | CStaticEntity
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Tools/EntityProxy/DataServices/entity_except.Cpp File Reference

  • Com
  • Tools
  • EntityProxy
  • DataServices

entity_except.Cpp File Reference

#include "stdafx.h"
#include "Data.h"
#include "Entity.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Tools/EntityProxy/DataServices/heap.Cpp File Reference

  • Com
  • Tools
  • EntityProxy
  • DataServices
Functions | Variables

heap.Cpp File Reference

#include "stdafx.h"
#include "Data.h"
#include "Entity.h"
#include "Resultset.h"

Go to the source code of this file.

Functions

void __cdecl | operator delete (void *p)
void *__cdecl | operator new (size_t nSize)

Variables

HANDLE | g_hGeneralHeap = HeapCreate(0, sizeof(CResultset) * 5, 0)

Function Documentation

void __cdecl operator delete ( void * p )

Definition at line 22 of file heap.Cpp.

{
  HeapFree(g_hGeneralHeap, 0, p);
}

void* __cdecl operator new ( size_t nSize ) [inline]

Definition at line 17 of file heap.Cpp.

{
  return HeapAlloc(g_hGeneralHeap, 0, nSize);
}

Variable Documentation

HANDLE g_hGeneralHeap = HeapCreate(0, sizeof(CResultset) * 5, 0)

Definition at line 15 of file heap.Cpp.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Tools/EntityProxy/DataServices/heap.h File Reference

  • Com
  • Tools
  • EntityProxy
  • DataServices
Classes | Defines | Functions

heap.h File Reference

Go to the source code of this file.

Classes

class | CFixedAlloc
struct | CFixedAlloc::CNode
struct | CPlex

Defines

#define | DECLARE_FIXED_ALLOC(class_name)
#define | IMPLEMENT_FIXED_ALLOC(class_name, block_size) CFixedAlloc class_name::s_alloc(sizeof(class_name), block_size) \

Functions

void __cdecl | operator delete (void *p)
void *__cdecl | operator new (size_t nSize)

Define Documentation

#define DECLARE_FIXED_ALLOC ( class_name )
Value:
public: \
  void* operator new(size_t size) \
  { \
    return s_alloc.Alloc(); \
  } \
  void* operator new(size_t, void* p) \
    { return p; } \
  void operator delete(void* p) { s_alloc.Free(p); } \
  void* operator new(size_t size, LPCSTR, int) \
  { \
    return s_alloc.Alloc(); \
  } \
protected: \
  static CFixedAlloc s_alloc \

Definition at line 96 of file heap.h.

#define IMPLEMENT_FIXED_ALLOC | ( | class_name,
 |  | block_size |
 | ) |  | CFixedAlloc class_name::s_alloc(sizeof(class_name), block_size) \

Definition at line 114 of file heap.h.

Function Documentation

void __cdecl operator delete ( void * p ) [inline]

Definition at line 22 of file heap.Cpp.

{
  HeapFree(g_hGeneralHeap, 0, p);
}

void* __cdecl operator new ( size_t nSize ) [inline]

Definition at line 17 of file heap.Cpp.

{
  return HeapAlloc(g_hGeneralHeap, 0, nSize);
}

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Tools/EntityProxy/DataServices/limits.h File Reference

  • Com
  • Tools
  • EntityProxy
  • DataServices
Defines

limits.h File Reference

Go to the source code of this file.

Defines

#define | ENTITY_BANKS 100
#define | ENTITY_PER_BANK 100
#define | FIELDNAME_MAXSIZE 128
#define | MAX_FIELD_DATA_SIZE 2048

Define Documentation

#define ENTITY_BANKS 100

Definition at line 13 of file limits.h.

#define ENTITY_PER_BANK 100

Definition at line 12 of file limits.h.

#define FIELDNAME_MAXSIZE 128

Definition at line 16 of file limits.h.

#define MAX_FIELD_DATA_SIZE 2048

Definition at line 9 of file limits.h.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Tools/EntityProxy/DataServices/marshalhelpers.h File Reference

  • Com
  • Tools
  • EntityProxy
  • DataServices
Functions

marshalhelpers.h File Reference

#include <comdef.h>

Go to the source code of this file.

Functions

unsigned long | GetVariantSize (VARIANT &var)
IStream & | operator<< (IStream &stream, CComBSTR &data) throw (_com_error)
template<class _T_ >
IStream & | operator<< (IStream &stream, const _T_ &data) throw (_com_error)
IStream & | operator<< (IStream &stream, CFastVariant &data) throw (_com_error)
IStream & | operator<< (IStream &stream, const char *data) throw (_com_error)
IStream & | operator<< (IStream &stream, const wchar_t *data) throw (_com_error)
IStream & | operator<< (IStream &stream, VARIANT data) throw (_com_error)
IStream & | operator<< (IStream &stream, const _bstr_t &data) throw (_com_error)
IStream & | operator>> (IStream &stream, char *data) throw (_com_error)
IStream & | operator>> (IStream &stream, CComBSTR &data) throw (_com_error)
IStream & | operator>> (IStream &stream, VARIANT &data) throw (_com_error)
IStream & | operator>> (IStream &stream, wchar_t *data) throw (_com_error)
template<class _T_ >
IStream & | operator>> (IStream &stream, _T_ &data) throw (_com_error)
IStream & | operator>> (IStream &stream, _bstr_t &data) throw (_com_error)
IStream & | operator>> (IStream &stream, CFastVariant &data) throw (_com_error)
IStream & | operator>> (IStream &stream, CString &data) throw (_com_error)

Function Documentation

unsigned long GetVariantSize ( VARIANT & var ) [inline]

Definition at line 7 of file marshalhelpers.h.

{
  VARTYPE vt = var.vt;
  unsigned long sz = sizeof(VARTYPE);
  HRESULT hr = 0;

  switch (vt)
  {
  case VT_UNKNOWN:
  case VT_DISPATCH:
    {
      {
        IUnknown* punkVal = var.punkVal;
        CComPtr<IPersistStream> spStream;
        if (punkVal != NULL)
        {
          hr = punkVal->QueryInterface(IID_IPersistStream, (void**)&spStream);
          if (FAILED(hr))
            return sz;
          ULARGE_INTEGER pcbSize;
          hr = spStream->GetSizeMax(&pcbSize);
          if (FAILED(hr))
            return sz;
          sz += pcbSize.LowPart;
          sz += 256;
        }
      }
    }
  case VT_UI1:
  case VT_I1:
    sz  +=  sizeof(BYTE);
    break;
  case VT_I2:
  case VT_UI2:
  case VT_BOOL:
    sz  +=  sizeof(short);
    break;
  case VT_I4:
  case VT_UI4:
  case VT_R4:
  case VT_INT:
  case VT_UINT:
  case VT_ERROR:
  case VT_NULL:
    sz  +=  sizeof(long);
    break;
  case VT_R8:
  case VT_CY:
  case VT_DATE:
    sz  +=  sizeof(double);
    break;
  case VT_BSTR:
    sz += ((SysStringLen(var.bstrVal) * sizeof(OLECHAR))+6);
    break;
  case VT_VARIANT:
    sz += sizeof(VARIANT);
    sz += GetVariantSize(*(var.pvarVal));
  default:
    break;
  }
  return sz;
}

IStream& operator<< | ( | IStream & | stream,
 |  | CComBSTR & | data |
 | ) |  |  | throw (_com_error) [inline]

Definition at line 202 of file marshalhelpers.h.

{
  _com_util::CheckError(data.WriteToStream(&stream));
  return stream;
}

template<class _T_ >
IStream& operator<< | ( | IStream & | stream,
 |  | const _T_ & | data |
 | ) |  |  | throw (_com_error)

Definition at line 72 of file marshalhelpers.h.

{
  _com_util::CheckError(stream.Write( &data, sizeof(data), 0));
  return stream;
}

IStream& operator<< | ( | IStream & | stream,
 |  | CFastVariant & | data |
 | ) |  |  | throw (_com_error) [inline]

Definition at line 84 of file marshalhelpers.h.

{
  _com_util::CheckError(data.WriteToStream( &stream ));
  return stream;
}

IStream& operator<< | ( | IStream & | stream,
 |  | const char * | data |
 | ) |  |  | throw (_com_error) [inline]

Definition at line 118 of file marshalhelpers.h.

{
  long length = strlen(data) + 1;

  stream<<length;
  _com_util::CheckError(stream.Write( data, length*sizeof(*data), 0));

  return stream;
}

IStream& operator<< | ( | IStream & | stream,
 |  | const wchar_t * | data |
 | ) |  |  | throw (_com_error) [inline]

Definition at line 137 of file marshalhelpers.h.

{
  long length = wcslen(data) + 1;

  stream << length;
  _com_util::CheckError(stream.Write( data, length*sizeof(*data), 0));

  return stream;
}

IStream& operator<< | ( | IStream & | stream,
 |  | VARIANT | data |
 | ) |  |  | throw (_com_error) [inline]

Definition at line 96 of file marshalhelpers.h.

{
  CFastVariant v;
  v.Attach(&data);

  stream<<v;

  v.Detach(&data);

  return stream;
}

IStream& operator<< | ( | IStream & | stream,
 |  | const _bstr_t & | data |
 | ) |  |  | throw (_com_error) [inline]

Definition at line 171 of file marshalhelpers.h.

{
  CComBSTR bstr;

  bstr.Attach(data);

  _com_util::CheckError(bstr.WriteToStream(&stream));
  bstr.Detach();

  return stream;
}

IStream& operator>> | ( | IStream & | stream,
 |  | char * | data |
 | ) |  |  | throw (_com_error) [inline]

Definition at line 128 of file marshalhelpers.h.

{
  long length;

  stream>>length;
  _com_util::CheckError(stream.Read( data, length*sizeof(*data), 0));
  return stream;
}

IStream& operator>> | ( | IStream & | stream,
 |  | CComBSTR & | data |
 | ) |  |  | throw (_com_error) [inline]

Definition at line 196 of file marshalhelpers.h.

{
  _com_util::CheckError(data.ReadFromStream(&stream));
  return stream;
}

IStream& operator>> | ( | IStream & | stream,
 |  | VARIANT & | data |
 | ) |  |  | throw (_com_error) [inline]

Definition at line 108 of file marshalhelpers.h.

{
  CFastVariant v;

  stream>>v;

  v.Detach(&data);
  return stream;
}

IStream& operator>> | ( | IStream & | stream,
 |  | wchar_t * | data |
 | ) |  |  | throw (_com_error) [inline]

Definition at line 147 of file marshalhelpers.h.

{
  long length;

  stream>>length;
  _com_util::CheckError(stream.Read( data, length * sizeof(*data), 0));
  return stream;
}

template<class _T_ >
IStream& operator>> | ( | IStream & | stream,
 |  | _T_ & | data |
 | ) |  |  | throw (_com_error)

Definition at line 78 of file marshalhelpers.h.

{
  _com_util::CheckError(stream.Read( &data, sizeof(data), 0));
  return stream;
}

IStream& operator>> | ( | IStream & | stream,
 |  | _bstr_t & | data |
 | ) |  |  | throw (_com_error) [inline]

Definition at line 183 of file marshalhelpers.h.

{
  CComBSTR bstr;

  _com_util::CheckError(bstr.ReadFromStream(&stream));

  _bstr_t  bs(bstr.Detach(),false); // use ref counting to prevent copy

  data = bs;

  return stream;
}

IStream& operator>> | ( | IStream & | stream,
 |  | CFastVariant & | data |
 | ) |  |  | throw (_com_error) [inline]

Definition at line 90 of file marshalhelpers.h.

{
  _com_util::CheckError(data.ReadFromStream( &stream ));
  return stream;
}

IStream& operator>> | ( | IStream & | stream,
 |  | CString & | data |
 | ) |  |  | throw (_com_error) [inline]

Definition at line 156 of file marshalhelpers.h.

{
  long length;
  LPWSTR wszData;

  stream>>length;

  wszData = data.GetBuffer(length+1);

  _com_util::CheckError(stream.Read( (void*)wszData, length * sizeof(*wszData), 0));

  data.ReleaseBuffer();
  return stream;
}

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Tools/EntityProxy/DataServices/odbcdata.Cpp File Reference

  • Com
  • Tools
  • EntityProxy
  • DataServices

odbcdata.Cpp File Reference

#include "stdafx.h"
#include "Data.h"
#include "Entity.h"
#include "Dynamic.h"
#include "Resultset.h"
#include "odbcdata.h"
#include "Proxy.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Tools/EntityProxy/DataServices/odbcdata.h File Reference

  • Com
  • Tools
  • EntityProxy
  • DataServices
Classes | Defines | Functions

odbcdata.h File Reference

#include "pooleddata.h"
#include <SQL.h>
#include <SQLEXT.h>
#include <ODBCSS.H>

Go to the source code of this file.

Classes

class | CODBCData

Defines

#define | ASSERT_SQL_SUCCESS(rc) { _ASSERTE(rc==SQL_SUCCESS || rc==SQL_SUCCESS_WITH_INFO);}
#define | PROCESS_SQL_ERROR(_rc) if (SQL_FAILED(_rc)) { char _szError[1024]; ATLTRACE ("ODBC Execution failed in file %s at line %d, code: %#x\n", __FILE__, __LINE__, _rc); if (m_spObjectContext.p != NULL) m_spObjectContext->SetAbort(); GetODBCError(_szError); return AtlReportError(CLSID_Proxy, _szError, IID_IDataProxy, E_FAIL); }
#define | SQL_FAILED(rc) ( (rc) != SQL_SUCCESS && (rc) != SQL_SUCCESS_WITH_INFO)

Functions

void | GetError (HENV henv, HDBC hdbc, HSTMT hstmt, BSTR *sErr)

Define Documentation

#define ASSERT_SQL_SUCCESS ( rc ) { _ASSERTE(rc==SQL_SUCCESS || rc==SQL_SUCCESS_WITH_INFO);}

Definition at line 10 of file odbcdata.h.

#define PROCESS_SQL_ERROR ( _rc ) if (SQL_FAILED(_rc)) { char _szError[1024]; ATLTRACE ("ODBC Execution failed in file %s at line %d, code: %#x\n", __FILE__, __LINE__, _rc); if (m_spObjectContext.p != NULL) m_spObjectContext->SetAbort(); GetODBCError(_szError); return AtlReportError(CLSID_Proxy, _szError, IID_IDataProxy, E_FAIL); }

Definition at line 11 of file odbcdata.h.

#define SQL_FAILED ( rc ) ( (rc) != SQL_SUCCESS && (rc) != SQL_SUCCESS_WITH_INFO)

Definition at line 9 of file odbcdata.h.

Function Documentation

void GetError | ( | HENV | henv,
 |  | HDBC | hdbc,
 |  | HSTMT | hstmt,
 |  | BSTR * | sErr
 | ) |  |
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Tools/EntityProxy/DataServices/pooleddata.Cpp File Reference

  • Com
  • Tools
  • EntityProxy
  • DataServices
Functions

pooleddata.Cpp File Reference

#include "stdafx.h"
#include "pooleddata.h"

Go to the source code of this file.

Functions

IMPLEMENT_FIXED_ALLOC (tagFieldMetaData, ENTITY_PER_BANK)

Function Documentation

IMPLEMENT_FIXED_ALLOC | ( | tagFieldMetaData | ,
 |  | ENTITY_PER_BANK |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Tools/EntityProxy/DataServices/pooleddata.h File Reference

  • Com
  • Tools
  • EntityProxy
  • DataServices
Classes | Typedefs

pooleddata.h File Reference

Go to the source code of this file.

Classes

class | CPooledData
struct | tagFieldMetaData

Typedefs

typedef struct tagFieldMetaData | FieldMetaData

Typedef Documentation

typedef struct tagFieldMetaData FieldMetaData
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Tools/EntityProxy/DataServices/proxy.Cpp File Reference

  • Com
  • Tools
  • EntityProxy
  • DataServices

proxy.Cpp File Reference

#include "stdafx.h"
#include "Data.h"
#include "Entity.h"
#include "Dynamic.h"
#include "Resultset.h"
#include "odbcdata.h"
#include "Proxy.h"
#include <wchar.h>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Tools/EntityProxy/DataServices/proxy.h File Reference

  • Com
  • Tools
  • EntityProxy
  • DataServices
Classes

proxy.h File Reference

#include "resource.h"
#include <mtx.h>

Go to the source code of this file.

Classes

class CProxy
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Tools/EntityProxy/DataServices/proxy_except.Cpp File Reference

  • Com
  • Tools
  • EntityProxy
  • DataServices

proxy_except.Cpp File Reference

#include "stdafx.h"
#include "Data.h"
#include "Entity.h"
#include "Dynamic.h"
#include "Resultset.h"
#include "odbcdata.h"
#include "Proxy.h"
#include <wchar.h>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Tools/EntityProxy/DataServices/resource.h File Reference

  • Com
  • Tools
  • EntityProxy
  • DataServices
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_DYNAMIC 103
#define | IDR_ENTITY 102
#define | IDR_PROXY 101
#define | IDR_RESULTSET 104
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_DYNAMIC 103

Definition at line 8 of file resource.h.

#define IDR_ENTITY 102

Definition at line 7 of file resource.h.

#define IDR_PROXY 101

Definition at line 6 of file resource.h.

#define IDR_RESULTSET 104

Definition at line 9 of file resource.h.

#define IDS_PROJNAME 100

Definition at line 5 of file resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Tools/EntityProxy/DataServices/resultset.Cpp File Reference

  • Com
  • Tools
  • EntityProxy
  • DataServices

resultset.Cpp File Reference

#include "stdafx.h"
#include "Data.h"
#include "Entity.h"
#include "Resultset.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Tools/EntityProxy/DataServices/resultset.h File Reference

  • Com
  • Tools
  • EntityProxy
  • DataServices
Classes

resultset.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class | CDynamicResultset
class | CResultset
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Tools/EntityProxy/DataServices/staticmap.h File Reference

  • Com
  • Tools
  • EntityProxy
  • DataServices
Classes

staticmap.h File Reference

Go to the source code of this file.

Classes

class CStaticMap
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Tools/EntityProxy/DataServices/stdafx.Cpp File Reference

  • Com
  • Tools
  • EntityProxy
  • DataServices

stdafx.Cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Tools/EntityProxy/DataServices/stdafx.h File Reference

  • Com
  • Tools
  • EntityProxy
  • DataServices
Defines | Variables

stdafx.h File Reference

#include <atlbase.h>
#include <atlcom.h>
#include <mtx.h>
#import "c:\Program Files\Common Files\System\ado\msado15.dll"
#include <vector>
#include <map>
#include "limits.h"
#include "string_fast.h"
#include "heap.h"
#include "string.h"
#include "utils.h"
#include "MarshalHelpers.h"
#include "StaticMap.h"
#include "utils.h"

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0400
#define | APP_ERROR 0x80004100
#define | ARRAY_VERSION 4
#define | COLLECTION_VERSION 4
#define | RETHROW_ERR(exp) { if (FAILED(hr = (exp))) {lErrFlag = 2; throw hr;}}
#define | SafeRelease(x) { if (x){x->Release();x=NULL;}}
#define | SETABORT if (m_spObjectContext.p != NULL) m_spObjectContext->SetAbort();
#define | SETCOMPLETE if (m_spObjectContext.p != NULL) m_spObjectContext->SetComplete();
#define | STRICT
#define | THROW_ERR(exp, str) {if (FAILED (hr = (exp))) {lErrFlag = 0; pErrMsg = _T(str); throw hr;}}
#define | THROW_STR(str) { hr = APP_ERROR; lErrFlag = 1; pErrMsg = str; throw hr;}
#define | WCSCMP wcscmp_fast
#define | WCSCPY wcscpy_fast
#define | WCSNCMP wcsncmp_fast
#define | WCSNCPY wcsncpy_fast

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 16 of file stdafx.h.

#define _WIN32_WINNT 0x0400

Definition at line 14 of file stdafx.h.

#define APP_ERROR 0x80004100

Definition at line 27 of file stdafx.h.

#define ARRAY_VERSION 4

Definition at line 40 of file stdafx.h.

#define COLLECTION_VERSION 4

Definition at line 41 of file stdafx.h.

#define RETHROW_ERR ( exp ) { if (FAILED(hr = (exp))) {lErrFlag = 2; throw hr;}}

Definition at line 26 of file stdafx.h.

#define SafeRelease ( x ) { if (x){x->Release();x=NULL;}}

Definition at line 28 of file stdafx.h.

#define SETABORT if (m_spObjectContext.p != NULL) m_spObjectContext->SetAbort();

Definition at line 55 of file stdafx.h.

#define SETCOMPLETE if (m_spObjectContext.p != NULL) m_spObjectContext->SetComplete();

Definition at line 54 of file stdafx.h.

#define STRICT

Definition at line 12 of file stdafx.h.

#define THROW_ERR | ( | exp,
 |  | str |
 | ) |  | {if (FAILED (hr = (exp))) {lErrFlag = 0; pErrMsg = _T(str); throw hr;}}

Definition at line 24 of file stdafx.h.

#define THROW_STR ( str ) { hr = APP_ERROR; lErrFlag = 1; pErrMsg = str; throw hr;}

Definition at line 25 of file stdafx.h.

#define WCSCMP wcscmp_fast

Definition at line 52 of file stdafx.h.

#define WCSCPY wcscpy_fast

Definition at line 46 of file stdafx.h.

#define WCSNCMP wcsncmp_fast

Definition at line 50 of file stdafx.h.

#define WCSNCPY wcsncpy_fast

Definition at line 48 of file stdafx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Tools/EntityProxy/DataServices/string.Cpp File Reference

  • Com
  • Tools
  • EntityProxy
  • DataServices
Defines | Functions | Variables

string.Cpp File Reference

#include "stdafx.h"
#include "heap.h"

Go to the source code of this file.

Defines

#define | ROUND(x, y) (((x)+(y-1))&~(y-1))
#define | ROUND4(x) ROUND(x, 4)

Functions

IMPLEMENT_FIXED_ALLOC (CString, 100)
CString | operator+ (WCHAR ch, const CString &string)
CString | operator+ (const CString &string1, WCHAR ch)
CString | operator+ (LPCWSTR lpsz, const CString &string)
CString | operator+ (const CString &string, LPCWSTR lpsz)
CString | operator+ (const CString &string1, const CString &string2)

Variables

LPCWSTR | _epPchNil = (LPCWSTR)(((BYTE*)&_epInitData)+sizeof(CStringData))
const WCHAR | epChNil = L'\0'

Define Documentation

#define ROUND | ( | x,
 |  | y |
 | ) |  | (((x)+(y-1))&~(y-1))

Definition at line 64 of file string.Cpp.

#define ROUND4 ( x ) ROUND(x, 4)

Definition at line 65 of file string.Cpp.

Function Documentation

IMPLEMENT_FIXED_ALLOC | ( | CString | ,
 |  | 100 |
 | ) |  |
CString operator+ | ( | WCHAR | ch,
 |  | const CString & | string
 | ) |  |

Definition at line 433 of file string.Cpp.

{
  CString s;
  s.ConcatCopy(1, &ch, string.GetData()->nDataLength, string.m_pchData);
  return s;
}

CString operator+ | ( | const CString & | string1,
 |  | WCHAR | ch
 | ) |  |

Definition at line 426 of file string.Cpp.

{
  CString s;
  s.ConcatCopy(string1.GetData()->nDataLength, string1.m_pchData, 1, &ch);
  return s;
}

CString operator+ | ( | LPCWSTR | lpsz,
 |  | const CString & | string
 | ) |  |

Definition at line 418 of file string.Cpp.

{
  CString s;
  s.ConcatCopy(CString::SafeStrlen(lpsz), lpsz, string.GetData()->nDataLength,
    string.m_pchData);
  return s;
}

CString operator+ | ( | const CString & | string,
 |  | LPCWSTR | lpsz
 | ) |  |

Definition at line 410 of file string.Cpp.

{
  CString s;
  s.ConcatCopy(string.GetData()->nDataLength, string.m_pchData,
    CString::SafeStrlen(lpsz), lpsz);
  return s;
}

CString operator+ | ( | const CString & | string1,
 |  | const CString & | string2
 | ) |  |

Definition at line 402 of file string.Cpp.

{
  CString s;
  s.ConcatCopy(string1.GetData()->nDataLength, string1.m_pchData,
    string2.GetData()->nDataLength, string2.m_pchData);
  return s;
}

Variable Documentation

LPCWSTR _epPchNil = (LPCWSTR)(((BYTE*)&_epInitData)+sizeof(CStringData))

Definition at line 12 of file string.Cpp.

const WCHAR epChNil = L'\0'

Definition at line 9 of file string.Cpp.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Tools/EntityProxy/DataServices/string.h File Reference

  • Com
  • Tools
  • EntityProxy
  • DataServices
Classes | Defines | Functions | Variables

string.h File Reference

Go to the source code of this file.

Classes

class | CString
struct | CStringData

Defines

#define | epEmptyString EpGetEmptyString()

Functions

const CString & | EpGetEmptyString ()
bool | operator!= (const CString &s1, const CString &s2)
bool | operator!= (const CString &s1, LPCWSTR s2)
bool | operator!= (LPCWSTR s1, const CString &s2)
bool | operator< (LPCWSTR s1, const CString &s2)
bool | operator< (const CString &s1, LPCWSTR s2)
bool | operator< (const CString &s1, const CString &s2)
bool | operator<= (LPCWSTR s1, const CString &s2)
bool | operator<= (const CString &s1, const CString &s2)
bool | operator<= (const CString &s1, LPCWSTR s2)
bool | operator== (const CString &s1, LPCWSTR s2)
bool | operator== (const CString &s1, const CString &s2)
bool | operator== (LPCWSTR s1, const CString &s2)
bool | operator> (LPCWSTR s1, const CString &s2)
bool | operator> (const CString &s1, const CString &s2)
bool | operator> (const CString &s1, LPCWSTR s2)
bool | operator>= (const CString &s1, LPCWSTR s2)
bool | operator>= (LPCWSTR s1, const CString &s2)
bool | operator>= (const CString &s1, const CString &s2)

Variables

LPCWSTR | _epPchNil
const WCHAR | epChNil

Define Documentation

#define epEmptyString EpGetEmptyString()

Definition at line 193 of file string.h.

Function Documentation

const CString& EpGetEmptyString ( ) [inline]

Definition at line 189 of file string.h.

{
  return *(CString*)&_epPchNil;
}

bool operator!= | ( | const CString & | s1,
 |  | const CString & | s2 |
 | ) |  |  | [inline]

Definition at line 240 of file string.h.

  { return s1.Compare(s2) != 0; }

bool operator!= | ( | const CString & | s1,
 |  | LPCWSTR | s2 |
 | ) |  |  | [inline]

Definition at line 242 of file string.h.

  { return s1.Compare(s2) != 0; }

bool operator!= | ( | LPCWSTR | s1,
 |  | const CString & | s2 |
 | ) |  |  | [inline]

Definition at line 244 of file string.h.

  { return s2.Compare(s1) != 0; }

bool operator< | ( | LPCWSTR | s1,
 |  | const CString & | s2 |
 | ) |  |  | [inline]

Definition at line 250 of file string.h.

  { return s2.Compare(s1) > 0; }

bool operator< | ( | const CString & | s1,
 |  | LPCWSTR | s2 |
 | ) |  |  | [inline]

Definition at line 248 of file string.h.

  { return s1.Compare(s2) < 0; }

bool operator< | ( | const CString & | s1,
 |  | const CString & | s2 |
 | ) |  |  | [inline]

Definition at line 246 of file string.h.

  { return s1.Compare(s2) < 0; }

bool operator<= | ( | LPCWSTR | s1,
 |  | const CString & | s2 |
 | ) |  |  | [inline]

Definition at line 262 of file string.h.

  { return s2.Compare(s1) >= 0; }

bool operator<= | ( | const CString & | s1,
 |  | const CString & | s2 |
 | ) |  |  | [inline]

Definition at line 258 of file string.h.

  { return s1.Compare(s2) <= 0; }

bool operator<= | ( | const CString & | s1,
 |  | LPCWSTR | s2 |
 | ) |  |  | [inline]

Definition at line 260 of file string.h.

  { return s1.Compare(s2) <= 0; }

bool operator== | ( | const CString & | s1,
 |  | LPCWSTR | s2 |
 | ) |  |  | [inline]

Definition at line 236 of file string.h.

  { return s1.Compare(s2) == 0; }

bool operator== | ( | const CString & | s1,
 |  | const CString & | s2 |
 | ) |  |  | [inline]

Definition at line 234 of file string.h.

  { return s1.Compare(s2) == 0; }

bool operator== | ( | LPCWSTR | s1,
 |  | const CString & | s2 |
 | ) |  |  | [inline]

Definition at line 238 of file string.h.

  { return s2.Compare(s1) == 0; }

bool operator> | ( | LPCWSTR | s1,
 |  | const CString & | s2 |
 | ) |  |  | [inline]

Definition at line 256 of file string.h.

  { return s2.Compare(s1) < 0; }

bool operator> | ( | const CString & | s1,
 |  | const CString & | s2 |
 | ) |  |  | [inline]

Definition at line 252 of file string.h.

  { return s1.Compare(s2) > 0; }

bool operator> | ( | const CString & | s1,
 |  | LPCWSTR | s2 |
 | ) |  |  | [inline]

Definition at line 254 of file string.h.

  { return s1.Compare(s2) > 0; }

bool operator>= | ( | const CString & | s1,
 |  | LPCWSTR | s2 |
 | ) |  |  | [inline]

Definition at line 266 of file string.h.

  { return s1.Compare(s2) >= 0; }

bool operator>= | ( | LPCWSTR | s1,
 |  | const CString & | s2 |
 | ) |  |  | [inline]

Definition at line 268 of file string.h.

  { return s2.Compare(s1) <= 0; }

bool operator>= | ( | const CString & | s1,
 |  | const CString & | s2 |
 | ) |  |  | [inline]

Definition at line 264 of file string.h.

  { return s1.Compare(s2) >= 0; }

Variable Documentation

LPCWSTR _epPchNil

Definition at line 12 of file string.Cpp.

const WCHAR epChNil

Definition at line 9 of file string.Cpp.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Tools/EntityProxy/DataServices/string_fast.Cpp File Reference

  • Com
  • Tools
  • EntityProxy
  • DataServices
Functions

string_fast.Cpp File Reference

#include "stdafx.h"
#include <stdio.h>
#include "string_fast.h"

Go to the source code of this file.

Functions

int __cdecl | wcscmp_fast (const WCHAR *src, const WCHAR *dst)
long | wcscpy_count (WCHAR *d, WCHAR const *s)
WCHAR * | wcscpy_fast (WCHAR *d, WCHAR const *s)
int | wcsncmp_fast (const WCHAR *first, const WCHAR *last, size_t count)
WCHAR * | wcsncpy_fast (WCHAR *dest, const WCHAR *source, size_t count)
long | WriteChars (WCHAR *string, const WCHAR *name, int nData)
long | WriteChars (WCHAR *string, int nData)
long | WriteChars (WCHAR *str, const WCHAR *str1, const WCHAR *str2, const WCHAR *str3)
long | WriteChars (WCHAR *str, const WCHAR *text)
long | WriteChars (WCHAR *str, const WCHAR *name, const WCHAR *data, int slen, bool bQuotes)
long | WriteChars (WCHAR *str, const WCHAR *name, const WCHAR *month, short nDay, short nYear)

Function Documentation

int __cdecl wcscmp_fast | ( | const WCHAR * | src,
 |  | const WCHAR * | dst |
 | ) |  |  | [inline]

Definition at line 409 of file string_fast.Cpp.

{
  register int i = -1;

  do
  {
    i++;
  }
  while (dst[i] && src[i] == dst[i]);

  return((int)(src[i] - dst[i]));
}

long wcscpy_count | ( | WCHAR * | d,
 |  | WCHAR const * | s |
 | ) |  |  | [inline]

Definition at line 211 of file string_fast.Cpp.

{
  register int i = 0;
  while (d[i] = s[i])
    ++i;
  return (i);
}

WCHAR* wcscpy_fast | ( | WCHAR * | d,
 |  | WCHAR const * | s |
 | ) |  |  | [inline]

Definition at line 379 of file string_fast.Cpp.

{
  register int i = 0;
  while (d[i] = s[i])
    ++i;
  return (d);
}

int wcsncmp_fast | ( | const WCHAR * | first,
 |  | const WCHAR * | last,
 |  | size_t | count |
 | ) |  |  | [inline]

Definition at line 395 of file string_fast.Cpp.

{
  if (!count)
    return(0);
  register int i = -1;

  do
  {
    i++;
  }
  while (--count && first[i] && first[i] == last[i]);
  return((int)(first[i] - last[i]));
}

WCHAR* wcsncpy_fast | ( | WCHAR * | dest,
 |  | const WCHAR * | source,
 |  | size_t | count |
 | ) |  |  | [inline]

Definition at line 387 of file string_fast.Cpp.

{
  dest[count] = L'\0';
  while ((count-- > 0) && (dest[count] = source[count]) != 0);    /* copy string */

  return dest;
}

long WriteChars | ( | WCHAR * | string,
 |  | const WCHAR * | name,
 |  | int | nData |
 | ) |  |  | [inline]

Definition at line 323 of file string_fast.Cpp.

{
  long length = 0;

  length += wcscpy_count(&string[length], name);
  length += wcscpy_count(&string[length], L" = ");

  WCHAR *str = &string[length];

  WCHAR buffer[32];

  register unsigned int v2;
  register const WCHAR *ap;
  register WCHAR *s = buffer + 30;
  if (nData <= 0)
  {
    if (nData == 0)
    {
      *str++ = L'0';
      length = str - string;

      length += wcscpy_count(&string[length], L", ");

      return length;
    }
    else
    {
      *str++ = L'-';
      #pragma warning (disable:4146)
      nData = -nData;
      #pragma warning (default:4146)
    }
  }
  s[1] = L'\0';

  do
  {
    v2 = nData / 1000;
    ap = char_table + 2 + ((nData - 1000 * v2) << 2);
    *s-- = *ap--;
    *s-- = *ap--;
    *s-- = *ap;
  }
  while ((nData = v2) > 0);

  while (L'0' == *++s);
  *str = *s;
  while ((*++str = *++s));

  length = str - string;

  length += wcscpy_count(&string[length], L", ");

  return length;
}

long WriteChars | ( | WCHAR * | string,
 |  | int | nData |
 | ) |  |  | [inline]

Definition at line 280 of file string_fast.Cpp.

{
  WCHAR *str = string;

  WCHAR buffer[32];

  register unsigned int v2;
  register const WCHAR *ap;
  register WCHAR *s = buffer + 30;
  if (nData <= 0)
  {
    if (nData == 0)
    {
      *str++ = L'0';
      return str - string;
    }
    else
    {
      *str++ = L'-';
      #pragma warning (disable:4146)
      nData = -nData;
      #pragma warning (default:4146)
    }
  }
  s[1] = L'\0';

  do
  {
    v2 = nData / 1000;
    ap = char_table + 2 + ((nData - 1000 * v2) << 2);
    *s-- = *ap--;
    *s-- = *ap--;
    *s-- = *ap;
  }
  while ((nData = v2) > 0);

  while (L'0' == *++s);
  *str = *s;
  while ((*++str = *++s));

  return str - string;
}

long WriteChars | ( | WCHAR * | str,
 |  | const WCHAR * | str1,
 |  | const WCHAR * | str2,
 |  | const WCHAR * | str3 |
 | ) |  |  | [inline]

Definition at line 268 of file string_fast.Cpp.

{
  long length = 0;

  length += wcscpy_count(&str[length], str1);
  str[length++] = L' ';
  length += wcscpy_count(&str[length], str2);
  str[length++] = L' ';
  length += wcscpy_count(&str[length], str3);
  return length;
}

long WriteChars | ( | WCHAR * | str,
 |  | const WCHAR * | text |
 | ) |  |  | [inline]

Definition at line 219 of file string_fast.Cpp.

{
  return wcscpy_count(str, text);
}

long WriteChars | ( | WCHAR * | str,
 |  | const WCHAR * | name,
 |  | const WCHAR * | data,
 |  | int | slen,
 |  | bool | bQuotes |
 | ) |  |  | [inline]

Definition at line 224 of file string_fast.Cpp.

{
  long length = 0;

  length += wcscpy_count(&str[length], name);

  if (bQuotes)
    length += wcscpy_count(&str[length], L" = \"");
  else
    length += wcscpy_count(&str[length], L" = ");

  if (slen > 0)
  {
    wcsncpy_fast(&str[length], data, slen);

    length += slen;
  }
  else
  {
    length += wcscpy_count(&str[length], data);
  }

  if (bQuotes)
    length += wcscpy_count(&str[length], L"\", ");
  else
    length += wcscpy_count(&str[length], L", ");

  return length;
}

long WriteChars | ( | WCHAR * | str,
 |  | const WCHAR * | name,
 |  | const WCHAR * | month,
 |  | short | nDay,
 |  | short | nYear |
 | ) |  |  | [inline]

Definition at line 254 of file string_fast.Cpp.

{
  long length = 0;

  length += wcscpy_count(&str[length], name);
  length += wcscpy_count(&str[length], L" = \"");
  length += wcscpy_count(&str[length], month);
  length += WriteChars(&str[length], nDay);
  str[length++] = L' ';
  length += WriteChars(&str[length], nYear);
  length += wcscpy_count(&str[length], L"\", ");
  return length;
}

Generated on Wed Nov 13 2024 16:53:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Tools/EntityProxy/DataServices/string_fast.h File Reference

  • Com
  • Tools
  • EntityProxy
  • DataServices
Functions

string_fast.h File Reference

#include <stdarg.h>

Go to the source code of this file.

Functions

int __cdecl | wcscmp_fast (const WCHAR *src, const WCHAR *dst)
long | wcscpy_count (WCHAR *d, WCHAR const *s)
WCHAR * | wcscpy_fast (WCHAR *d, WCHAR const *s)
int | wcsncmp_fast (const WCHAR *first, const WCHAR *last, size_t count)
WCHAR *__cdecl | wcsncpy_fast (WCHAR *dest, const WCHAR *source, size_t count)
long | WriteChars (WCHAR *string, const WCHAR *name, int nData)
long | WriteChars (WCHAR *str, const WCHAR *name, const WCHAR *data, int slen, bool bQuotes)
long | WriteChars (WCHAR *str, const WCHAR *name, const WCHAR *data, short nDay, short nYear)
long | WriteChars (WCHAR *string, int nData)
long | WriteChars (WCHAR *str, const WCHAR *text)
long | WriteChars (WCHAR *str, const WCHAR *str1, const WCHAR *str2, const WCHAR *str3)

Function Documentation

int __cdecl wcscmp_fast | ( | const WCHAR * | src,
 |  | const WCHAR * | dst |
 | ) |  |  | [inline]

Definition at line 409 of file string_fast.Cpp.

{
  register int i = -1;

  do
  {
    i++;
  }
  while (dst[i] && src[i] == dst[i]);

  return((int)(src[i] - dst[i]));
}

long wcscpy_count | ( | WCHAR * | d,
 |  | WCHAR const * | s |
 | ) |  |  | [inline]

Definition at line 211 of file string_fast.Cpp.

{
  register int i = 0;
  while (d[i] = s[i])
    ++i;
  return (i);
}

WCHAR* wcscpy_fast | ( | WCHAR * | d,
 |  | WCHAR const * | s |
 | ) |  |  | [inline]

Definition at line 379 of file string_fast.Cpp.

{
  register int i = 0;
  while (d[i] = s[i])
    ++i;
  return (d);
}

int wcsncmp_fast | ( | const WCHAR * | first,
 |  | const WCHAR * | last,
 |  | size_t | count |
 | ) |  |  | [inline]

Definition at line 395 of file string_fast.Cpp.

{
  if (!count)
    return(0);
  register int i = -1;

  do
  {
    i++;
  }
  while (--count && first[i] && first[i] == last[i]);
  return((int)(first[i] - last[i]));
}

WCHAR* __cdecl wcsncpy_fast | ( | WCHAR * | dest,
 |  | const WCHAR * | source,
 |  | size_t | count |
 | ) |  |  | [inline]

Definition at line 387 of file string_fast.Cpp.

{
  dest[count] = L'\0';
  while ((count-- > 0) && (dest[count] = source[count]) != 0);    /* copy string */

  return dest;
}

long WriteChars | ( | WCHAR * | string,
 |  | const WCHAR * | name,
 |  | int | nData |
 | ) |  |  | [inline]

Definition at line 323 of file string_fast.Cpp.

{
  long length = 0;

  length += wcscpy_count(&string[length], name);
  length += wcscpy_count(&string[length], L" = ");

  WCHAR *str = &string[length];

  WCHAR buffer[32];

  register unsigned int v2;
  register const WCHAR *ap;
  register WCHAR *s = buffer + 30;
  if (nData <= 0)
  {
    if (nData == 0)
    {
      *str++ = L'0';
      length = str - string;

      length += wcscpy_count(&string[length], L", ");

      return length;
    }
    else
    {
      *str++ = L'-';
      #pragma warning (disable:4146)
      nData = -nData;
      #pragma warning (default:4146)
    }
  }
  s[1] = L'\0';

  do
  {
    v2 = nData / 1000;
    ap = char_table + 2 + ((nData - 1000 * v2) << 2);
    *s-- = *ap--;
    *s-- = *ap--;
    *s-- = *ap;
  }
  while ((nData = v2) > 0);

  while (L'0' == *++s);
  *str = *s;
  while ((*++str = *++s));

  length = str - string;

  length += wcscpy_count(&string[length], L", ");

  return length;
}

long WriteChars | ( | WCHAR * | str,
 |  | const WCHAR * | name,
 |  | const WCHAR * | data,
 |  | int | slen,
 |  | bool | bQuotes |
 | ) |  |  | [inline]

Definition at line 224 of file string_fast.Cpp.

{
  long length = 0;

  length += wcscpy_count(&str[length], name);

  if (bQuotes)
    length += wcscpy_count(&str[length], L" = \"");
  else
    length += wcscpy_count(&str[length], L" = ");

  if (slen > 0)
  {
    wcsncpy_fast(&str[length], data, slen);

    length += slen;
  }
  else
  {
    length += wcscpy_count(&str[length], data);
  }

  if (bQuotes)
    length += wcscpy_count(&str[length], L"\", ");
  else
    length += wcscpy_count(&str[length], L", ");

  return length;
}

long WriteChars | ( | WCHAR * | str,
 |  | const WCHAR * | name,
 |  | const WCHAR * | data,
 |  | short | nDay,
 |  | short | nYear |
 | ) |  |  | [inline]

Definition at line 254 of file string_fast.Cpp.

{
  long length = 0;

  length += wcscpy_count(&str[length], name);
  length += wcscpy_count(&str[length], L" = \"");
  length += wcscpy_count(&str[length], month);
  length += WriteChars(&str[length], nDay);
  str[length++] = L' ';
  length += WriteChars(&str[length], nYear);
  length += wcscpy_count(&str[length], L"\", ");
  return length;
}

long WriteChars | ( | WCHAR * | string,
 |  | int | nData |
 | ) |  |  | [inline]

Definition at line 280 of file string_fast.Cpp.

{
  WCHAR *str = string;

  WCHAR buffer[32];

  register unsigned int v2;
  register const WCHAR *ap;
  register WCHAR *s = buffer + 30;
  if (nData <= 0)
  {
    if (nData == 0)
    {
      *str++ = L'0';
      return str - string;
    }
    else
    {
      *str++ = L'-';
      #pragma warning (disable:4146)
      nData = -nData;
      #pragma warning (default:4146)
    }
  }
  s[1] = L'\0';

  do
  {
    v2 = nData / 1000;
    ap = char_table + 2 + ((nData - 1000 * v2) << 2);
    *s-- = *ap--;
    *s-- = *ap--;
    *s-- = *ap;
  }
  while ((nData = v2) > 0);

  while (L'0' == *++s);
  *str = *s;
  while ((*++str = *++s));

  return str - string;
}

long WriteChars | ( | WCHAR * | str,
 |  | const WCHAR * | text |
 | ) |  |  | [inline]

Definition at line 219 of file string_fast.Cpp.

{
  return wcscpy_count(str, text);
}

long WriteChars | ( | WCHAR * | str,
 |  | const WCHAR * | str1,
 |  | const WCHAR * | str2,
 |  | const WCHAR * | str3 |
 | ) |  |  | [inline]

Definition at line 268 of file string_fast.Cpp.

{
  long length = 0;

  length += wcscpy_count(&str[length], str1);
  str[length++] = L' ';
  length += wcscpy_count(&str[length], str2);
  str[length++] = L' ';
  length += wcscpy_count(&str[length], str3);
  return length;
}

Generated on Wed Nov 13 2024 16:53:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Tools/EntityProxy/DataServices/utils.Cpp File Reference

  • Com
  • Tools
  • EntityProxy
  • DataServices
Functions

utils.Cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Functions

WCHAR * | BuildExecCommand (WCHAR *wszSQLStart, LPCWSTR wszStoredProc, LPCWSTR wszKeyField, VARIANT *pVal)
IMPLEMENT_FIXED_ALLOC (CFastVariant, ENTITY_PER_BANK)
long | WriteNamedParam (WCHAR *wszParamStart, LPCWSTR wszName, VARIANT *pVal)

Function Documentation

WCHAR* BuildExecCommand | ( | WCHAR * | wszSQLStart,
 |  | LPCWSTR | wszStoredProc,
 |  | LPCWSTR | wszKeyField,
 |  | VARIANT * | pVal
 | ) |  |

Definition at line 86 of file utils.Cpp.

{
  WCHAR *wszSQL = wszSQLStart;

  if (wszStoredProc[0] != L'\0')
  {
    wszSQL += WriteChars(wszSQL, L"EXEC ");
    wszSQL += WriteChars(wszSQL, wszStoredProc);
    wszSQL[0] = L' ';
    wszSQL[1] = L'@';
    wszSQL += 2;
    wszSQL += WriteNamedParam(wszSQL, wszKeyField, pVal);
  }
  // WriteChars as used in WriteNamedParam automatically adds a comma and a space
  // since the most used case requires it.
  // We don't need it here, so just insert a terminator.
  wszSQL[-2] = L'\0';
  return wszSQLStart;
}

IMPLEMENT_FIXED_ALLOC | ( | CFastVariant | ,
 |  | ENTITY_PER_BANK |
 | ) |  |
long WriteNamedParam | ( | WCHAR * | wszParamStart,
 |  | LPCWSTR | wszName,
 |  | VARIANT * | pVal |
 | ) |  |  | [inline]

Definition at line 5 of file utils.Cpp.

{
  long length;

  if (pVal->vt == VT_BSTR)
  {
    int slen = SysStringLen(pVal->bstrVal);

    if (slen > 0)
      length = WriteChars(wszParamStart, wszName, (LPCWSTR)pVal->bstrVal, slen, true);
    else
      length = WriteChars(wszParamStart, wszName, L"\'\'", 0, false);
  }
  else if (pVal->vt == VT_I2)
  {
    length = WriteChars(wszParamStart, wszName, (short)pVal->iVal);
  }
  else if (pVal->vt == VT_DATE)
  {
    SYSTEMTIME systime;
    VariantTimeToSystemTime(pVal->date, &systime);
    length = WriteChars(wszParamStart, wszName, (LPCWSTR)month[systime.wMonth-1], (short)systime.wDay, (short)systime.wYear);
  }
  else if (pVal->vt == VT_NULL)
  {
    length = WriteChars(wszParamStart, wszName, L"NULL", 0, false);
  }
  else if (pVal->vt == VT_I4)
  {
    length = WriteChars(wszParamStart, wszName, (long)pVal->lVal);
  }
  else if (pVal->vt == VT_BOOL)
  {
    long bVal;
    if (pVal->boolVal == VARIANT_TRUE)
      bVal = 1;
    else
      bVal = 0;
    length = WriteChars(wszParamStart, wszName, (long)bVal);
  }
  else if (pVal->vt == VT_EMPTY)
  {
    length = WriteChars(wszParamStart, wszName, (long)0);
  }
  else if (pVal->vt == VT_UI1)
  {
    length = WriteChars(wszParamStart, wszName, (BYTE)pVal->bVal);
  }
  else if (pVal->vt == VT_DECIMAL)
  {
    CFastVariant data;
    VariantChangeType(&data, pVal, 0, VT_BSTR);
    length = WriteChars(wszParamStart, wszName, (LPCWSTR)data.bstrVal, SysStringLen(data.bstrVal), false);
  }
  else if (pVal->vt == VT_CY)
  {
    CFastVariant data;
    VariantChangeType(&data, pVal, 0, VT_BSTR);
    length = WriteChars(wszParamStart, wszName, (LPCWSTR)data.bstrVal, SysStringLen(data.bstrVal), false);
  }
  else if (pVal->vt == VT_R4)
  {
    CFastVariant data;
    VariantChangeType(&data, pVal, 0, VT_BSTR);
    length = WriteChars(wszParamStart, wszName, (LPCWSTR)data.bstrVal, SysStringLen(data.bstrVal), false);
  }
  else if (pVal->vt == VT_R8)
  {
    CFastVariant data;
    VariantChangeType(&data, pVal, 0, VT_BSTR);
    length = WriteChars(wszParamStart, wszName, (LPCWSTR)data.bstrVal, SysStringLen(data.bstrVal), false);
  }
  else
  {
    CFastVariant data;
    VariantChangeType(&data, pVal, 0, VT_BSTR);
    length = WriteChars(wszParamStart, wszName, (LPCWSTR)data.bstrVal, SysStringLen(data.bstrVal), false);
  }
  return length;
}

Generated on Wed Nov 13 2024 16:53:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Com/Tools/EntityProxy/DataServices/utils.h File Reference

  • Com
  • Tools
  • EntityProxy
  • DataServices
Classes | Functions | Variables

utils.h File Reference

Go to the source code of this file.

Classes

class | CFastVariant

Functions

WCHAR * | BuildExecCommand (WCHAR *wszSQL, LPCWSTR wszStoredProc, LPCWSTR wszKeyField, VARIANT *pVal)
long | WriteNamedParam (WCHAR *wszParamStart, LPCWSTR wszName, VARIANT *pVal)

Variables

WCHAR *const | month []

Function Documentation

WCHAR* BuildExecCommand | ( | WCHAR * | wszSQL,
 |  | LPCWSTR | wszStoredProc,
 |  | LPCWSTR | wszKeyField,
 |  | VARIANT * | pVal
 | ) |  |

Definition at line 86 of file utils.Cpp.

{
  WCHAR *wszSQL = wszSQLStart;

  if (wszStoredProc[0] != L'\0')
  {
    wszSQL += WriteChars(wszSQL, L"EXEC ");
    wszSQL += WriteChars(wszSQL, wszStoredProc);
    wszSQL[0] = L' ';
    wszSQL[1] = L'@';
    wszSQL += 2;
    wszSQL += WriteNamedParam(wszSQL, wszKeyField, pVal);
  }
  // WriteChars as used in WriteNamedParam automatically adds a comma and a space
  // since the most used case requires it.
  // We don't need it here, so just insert a terminator.
  wszSQL[-2] = L'\0';
  return wszSQLStart;
}

long WriteNamedParam | ( | WCHAR * | wszParamStart,
 |  | LPCWSTR | wszName,
 |  | VARIANT * | pVal |
 | ) |  |  | [inline]

Definition at line 5 of file utils.Cpp.

{
  long length;

  if (pVal->vt == VT_BSTR)
  {
    int slen = SysStringLen(pVal->bstrVal);

    if (slen > 0)
      length = WriteChars(wszParamStart, wszName, (LPCWSTR)pVal->bstrVal, slen, true);
    else
      length = WriteChars(wszParamStart, wszName, L"\'\'", 0, false);
  }
  else if (pVal->vt == VT_I2)
  {
    length = WriteChars(wszParamStart, wszName, (short)pVal->iVal);
  }
  else if (pVal->vt == VT_DATE)
  {
    SYSTEMTIME systime;
    VariantTimeToSystemTime(pVal->date, &systime);
    length = WriteChars(wszParamStart, wszName, (LPCWSTR)month[systime.wMonth-1], (short)systime.wDay, (short)systime.wYear);
  }
  else if (pVal->vt == VT_NULL)
  {
    length = WriteChars(wszParamStart, wszName, L"NULL", 0, false);
  }
  else if (pVal->vt == VT_I4)
  {
    length = WriteChars(wszParamStart, wszName, (long)pVal->lVal);
  }
  else if (pVal->vt == VT_BOOL)
  {
    long bVal;
    if (pVal->boolVal == VARIANT_TRUE)
      bVal = 1;
    else
      bVal = 0;
    length = WriteChars(wszParamStart, wszName, (long)bVal);
  }
  else if (pVal->vt == VT_EMPTY)
  {
    length = WriteChars(wszParamStart, wszName, (long)0);
  }
  else if (pVal->vt == VT_UI1)
  {
    length = WriteChars(wszParamStart, wszName, (BYTE)pVal->bVal);
  }
  else if (pVal->vt == VT_DECIMAL)
  {
    CFastVariant data;
    VariantChangeType(&data, pVal, 0, VT_BSTR);
    length = WriteChars(wszParamStart, wszName, (LPCWSTR)data.bstrVal, SysStringLen(data.bstrVal), false);
  }
  else if (pVal->vt == VT_CY)
  {
    CFastVariant data;
    VariantChangeType(&data, pVal, 0, VT_BSTR);
    length = WriteChars(wszParamStart, wszName, (LPCWSTR)data.bstrVal, SysStringLen(data.bstrVal), false);
  }
  else if (pVal->vt == VT_R4)
  {
    CFastVariant data;
    VariantChangeType(&data, pVal, 0, VT_BSTR);
    length = WriteChars(wszParamStart, wszName, (LPCWSTR)data.bstrVal, SysStringLen(data.bstrVal), false);
  }
  else if (pVal->vt == VT_R8)
  {
    CFastVariant data;
    VariantChangeType(&data, pVal, 0, VT_BSTR);
    length = WriteChars(wszParamStart, wszName, (LPCWSTR)data.bstrVal, SysStringLen(data.bstrVal), false);
  }
  else
  {
    CFastVariant data;
    VariantChangeType(&data, pVal, 0, VT_BSTR);
    length = WriteChars(wszParamStart, wszName, (LPCWSTR)data.bstrVal, SysStringLen(data.bstrVal), false);
  }
  return length;
}

Variable Documentation

WCHAR* const month[]
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/ADO/ADOVCGEN/adoheader.h File Reference

  • Dataaccess
  • ADO
  • ADOVCGEN
Defines

adoheader.h File Reference

#import "C:\Program Files\Common Files\System\ADO\msado15.dll"
#import "C:\Program Files\Common Files\System\ole db\oledb32.dll"

Go to the source code of this file.

Defines

#define | CATCHDB } catch(CException *err) { err->ReportError(); err->Delete(); }
#define | MAX_COUNT 256
#define | TRYDB try{

Define Documentation

#define CATCHDB } catch(CException *err) { err->ReportError(); err->Delete(); }

Definition at line 16 of file adoheader.h.

#define MAX_COUNT 256

Definition at line 14 of file adoheader.h.

#define TRYDB try{

Definition at line 15 of file adoheader.h.

Generated on Wed Nov 13 2024 16:53:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/ADO/ADOVCGEN/advcgen.cpp File Reference

  • Dataaccess
  • ADO
  • ADOVCGEN
Variables

advcgen.cpp File Reference

#include "stdafx.h"
#include "ADVCGEN.h"
#include "ADVCGENDlg.h"

Go to the source code of this file.

Variables

CADVCGENApp theApp

Variable Documentation

CADVCGENApp theApp

Definition at line 37 of file advcgen.cpp.

Generated on Wed Nov 13 2024 16:53:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/ADO/ADOVCGEN/advcgen.h File Reference

  • Dataaccess
  • ADO
  • ADOVCGEN
Classes

advcgen.h File Reference

#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Classes

class CADVCGENApp
Generated on Wed Nov 13 2024 16:53:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/ADO/ADOVCGEN/advcgendlg.cpp File Reference

  • Dataaccess
  • ADO
  • ADOVCGEN
Classes

advcgendlg.cpp File Reference

#include "stdafx.h"
#include "ADVCGEN.h"
#include "ADVCGENDlg.h"

Go to the source code of this file.

Classes

class CAboutDlg
Generated on Wed Nov 13 2024 16:53:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/ADO/ADOVCGEN/advcgendlg.h File Reference

  • Dataaccess
  • ADO
  • ADOVCGEN
Classes

advcgendlg.h File Reference

#include "ADOHeader.h"
#include "datagrid.h"

Go to the source code of this file.

Classes

class CADVCGENDlg
Generated on Wed Nov 13 2024 16:53:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/ADO/ADOVCGEN/datagrid.cpp File Reference

  • Dataaccess
  • ADO
  • ADOVCGEN

datagrid.cpp File Reference

#include "stdafx.h"
#include "datagrid.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/ADO/ADOVCGEN/datagrid.h File Reference

  • Dataaccess
  • ADO
  • ADOVCGEN
Classes

datagrid.h File Reference

Go to the source code of this file.

Classes

class CDataGrid
Generated on Wed Nov 13 2024 16:53:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/ADO/ADOVCGEN/resource.h File Reference

  • Dataaccess
  • ADO
  • ADOVCGEN
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | ID_REFRESH 57671
#define | IDC_BUTTON1 1000
#define | IDC_BUTTON2 1006
#define | IDC_CHECK1 1010
#define | IDC_CONNECTSTRING 1001
#define | IDC_DATAGRID1 1004
#define | IDC_EDIT1 1005
#define | IDC_TABLELIST 1003
#define | IDD_ABOUTBOX 100
#define | IDD_ADVCGEN_DIALOG 102
#define | IDM_ABOUTBOX 0x0010
#define | IDR_MAINFRAME 128
#define | IDS_ABOUTBOX 101

Define Documentation

#define ID_REFRESH 57671

Definition at line 17 of file resource.h.

#define IDC_BUTTON1 1000

Definition at line 10 of file resource.h.

#define IDC_BUTTON2 1006

Definition at line 15 of file resource.h.

#define IDC_CHECK1 1010

Definition at line 16 of file resource.h.

#define IDC_CONNECTSTRING 1001

Definition at line 11 of file resource.h.

#define IDC_DATAGRID1 1004

Definition at line 13 of file resource.h.

#define IDC_EDIT1 1005

Definition at line 14 of file resource.h.

#define IDC_TABLELIST 1003

Definition at line 12 of file resource.h.

#define IDD_ABOUTBOX 100

Definition at line 6 of file resource.h.

#define IDD_ADVCGEN_DIALOG 102

Definition at line 8 of file resource.h.

#define IDM_ABOUTBOX 0x0010

Definition at line 5 of file resource.h.

#define IDR_MAINFRAME 128

Definition at line 9 of file resource.h.

#define IDS_ABOUTBOX 101

Definition at line 7 of file resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/ADO/ADOVCGEN/stdafx.cpp File Reference

  • Dataaccess
  • ADO
  • ADOVCGEN

stdafx.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/ADO/ADOVCGEN/stdafx.h File Reference

  • Dataaccess
  • ADO
  • ADOVCGEN
Defines

stdafx.h File Reference

#include <afxwin.h>
#include <afxext.h>
#include <afxdisp.h>
#include <afxdtctl.h>
#include <afxcmn.h>

Go to the source code of this file.

Defines

#define VC_EXTRALEAN

Define Documentation

#define VC_EXTRALEAN

Definition at line 13 of file stdafx.h.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/ADO/isapi/adoisapi.cpp File Reference

  • Dataaccess
  • ADO
  • isapi
Defines | Functions | Variables

adoisapi.cpp File Reference

#import "c:\program files\common files\system\ado\msado15.dll"
#include <httpext.h>
#include <stdio.h>

Go to the source code of this file.

Defines

#define | LogError(x)

Functions

char | ConvertHexToDec (char cHex)
void | DebugLog (const char *szErrStr, const char *FName, const int lNum)
HRESULT | FetchData (EXTENSION_CONTROL_BLOCK *pECB)
BOOL WINAPI | GetExtensionVersion (HSE_VERSION_INFO *pVer)
DWORD WINAPI | HttpExtensionProc (EXTENSION_CONTROL_BLOCK *pECB)
VOID | OutputErrors (EXTENSION_CONTROL_BLOCK *pECB, _com_error &e)
VOID | OutputErrors (EXTENSION_CONTROL_BLOCK *pECB, HRESULT hrError)
VOID | OutputString (EXTENSION_CONTROL_BLOCK *pECB, LPCSTR szBuffer)
VOID | PatchQuery (char *szQuery, char **ppszPatchedQuery)
BOOL WINAPI | TerminateExtension (DWORD dwFlags)

Variables

const PCSTR | g_pszConnection = "Provider=SQLOLEDB;data source=YOUR SERVER NAME;initial catalog=northwind;uid=YOUR USER ID;pwd=YOUR USER's PASSWORD;"
const char * | szProgLog = "c:\\AdoIsapi.txt"

Define Documentation

#define LogError ( x )

Definition at line 29 of file adoisapi.cpp.

Function Documentation

char ConvertHexToDec ( char cHex )

Definition at line 84 of file adoisapi.cpp.

{
  if ((toupper(cHex) >= 'A') && (toupper(cHex) <= 'F'))
    return cHex - 'A' + 10;
  else
    return cHex - '0';
} // end -- char ConvertHexToDec(char cHex)

void DebugLog | ( | const char * | szErrStr,
 |  | const char * | FName,
 |  | const int | lNum
 | ) |  |

Definition at line 296 of file adoisapi.cpp.

{
    FILE *fp;
    if( (fp=fopen(szProgLog,"at+")) == NULL )
    {
        return ;
    }

    fprintf(fp,"Error %s (%d): %s\n",FName,lNum,szErrStr );
    fclose(fp);

}

HRESULT FetchData ( EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 172 of file adoisapi.cpp.

{
  HRESULT     hr = NOERROR;
  bool      fComInitialized = false;
  _RecordsetPtr pRs = NULL;
    _ConnectionPtr  pConn = NULL;
  FieldPtr    *rgflds = NULL;
  long      lNumFields, lFld;
  char      *pszPatchedQuery, *pszQueryPtr;
  _variant_t    vValue;

  OutputString(pECB, "<HEAD><TITLE>Query Results"
            "</TITLE></HEAD>\r\n<BODY>\r\n");

  OutputString(pECB, "<LINK REL=\"STYLESHEET\" HREF=\"..\\ADOStyle.css\">\r\n");

  // Updated Code to support IE 4 semantics requiring controls passed as parameters to be named
  // Search for the new parameter "Query=" in the string, and then use PatchQuery starting at the
  // equals sign.  Note: If other parameters are passed as part of the form, this code needs to
  // be updated to find the end of the parameter and not use the entire rest of the lpszQueryString
  pszQueryPtr = strstr(pECB->lpszQueryString, "Query=") + strlen("Query=") - 1;
  PatchQuery(pszQueryPtr, &pszPatchedQuery);

  OutputString(pECB, "<P><H2>Query String</H2>");
  OutputString(pECB, pszPatchedQuery);
  LogError(pszPatchedQuery);
  try
  {
    if (FAILED(hr = ::CoInitialize(NULL)))
        {
            _com_issue_error(hr);
        }

    fComInitialized = true;

        // Create the connection object
        pConn.CreateInstance(__uuidof(Connection ));
        LogError( "Create Connetion object fine...");
        pConn->ConnectionString  = g_pszConnection;
        pConn->Open("","","",-1);
        LogError( "Opened Connetion object fine...");
    // Open the recordset
    pRs.CreateInstance(__uuidof(Recordset) );
        LogError( "Created  Recordset object fine...");
        pRs->PutRefActiveConnection(pConn);
        LogError( "Set Referend from Rs to Conn");
    pRs->Open(pszPatchedQuery, vtMissing, adOpenForwardOnly, adLockReadOnly, adCmdUnknown);
        LogError( "Opended Recordset object fine...");
    lNumFields = pRs->Fields->Count;

    rgflds = new FieldPtr[lNumFields];
    if (!rgflds)
        {
            _com_issue_error(E_OUTOFMEMORY);
        }
    memset(rgflds, 0, lNumFields * sizeof(FieldPtr));

    for (lFld = 0; lFld < lNumFields; lFld++)
        {
            rgflds[lFld] = pRs->Fields->GetItem(lFld);
        }

    OutputString(pECB, "<P><H2>Query Results</H2>");
    OutputString(pECB, "<P><TABLE BORDER=1 CELLSPACING=4>");

    //
    // print column names
    //
    OutputString(pECB, "<TR>");

    for (lFld = 0; lFld < lNumFields; lFld++)
    {
      OutputString(pECB, "<TH>");
      OutputString(pECB, (PCSTR)(_bstr_t)rgflds[lFld]->Name);
    }

    //
    // print data
    //
    while (VARIANT_FALSE == pRs->EndOfFile)
    {
      OutputString(pECB, "<TR>");

      for (lFld = 0; lFld < lNumFields; lFld++)
      {
        OutputString(pECB, "<TD>");

        vValue = rgflds[lFld]->Value;
        if (VT_NULL == vValue.vt)
          OutputString(pECB, "(Null)");
        else
          OutputString(pECB, (PCSTR)(_bstr_t)vValue);
      }

      OutputString(pECB, "</TR>");

      pRs->MoveNext();
    }

    OutputString(pECB, "</TABLE>");
    OutputString(pECB, "</BODY>\r\n");
  }
  catch (_com_error &e)
  {
    OutputErrors(pECB, e);
    hr = e.Error();
  }

  if (rgflds)
      delete[] rgflds;

  pRs = NULL;

  if (fComInitialized)
    {
        ::CoUninitialize();
    }

  OutputString(pECB, "</BODY>\r\n");

  return hr;

} // end -- HRESULT FetchData(EXTENSION_CONTROL_BLOCK *pECB)

BOOL WINAPI GetExtensionVersion ( HSE_VERSION_INFO * pVer )

Definition at line 39 of file adoisapi.cpp.

{
    // Initialize COM
    CoInitialize(NULL);
    LogError("GetExtensionVersion()");

  pVer->dwExtensionVersion = MAKELONG( HSE_VERSION_MINOR, HSE_VERSION_MAJOR );

  lstrcpynA( pVer->lpszExtensionDesc, "Sample ADO ISAPI Application", HSE_MAX_EXT_DLL_NAME_LEN );

  return TRUE;
} // end -- BOOL WINAPI GetExtensionVersion(HSE_VERSION_INFO *pVer)

DWORD WINAPI HttpExtensionProc ( EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 60 of file adoisapi.cpp.

{
  DWORD dwWritten;
  char  szContent[] = "Content-type: text/html\r\n\r\n";
    LogError("HttpExtensionProc() -- entry");
  dwWritten = sizeof(szContent);
    pECB->ServerSupportFunction (pECB->ConnID,
                                 HSE_REQ_SEND_RESPONSE_HEADER,
                                 NULL,
                                 &dwWritten,
                                 (LPDWORD)szContent);

  if (FAILED(FetchData(pECB)))
    {
        LogError("HttpExtensionProc() -- Failed...");
    return HSE_STATUS_ERROR;
    }
  else
    {
        LogError("HttpExtensionProc() -- Successful...");
    return HSE_STATUS_SUCCESS;
    }
} // end -- DWORD WINAPI HttpExtensionProc(EXTENSION_CONTROL_BLOCK *pECB )

VOID OutputErrors | ( | EXTENSION_CONTROL_BLOCK * | pECB,
 |  | _com_error & | e
 | ) |  |

Definition at line 148 of file adoisapi.cpp.

{
  char    szBuffer[512];

  // output hresult
  OutputString(pECB, "<P><H1>Error Fetching Data</H1>");

  sprintf(szBuffer, "<p>Code = %08lx", e.Error());
  OutputString(pECB, szBuffer);

    sprintf(szBuffer, "<p>Code meaning = %s", e.ErrorMessage());
    OutputString(pECB, szBuffer);

  _bstr_t bstrSource(e.Source());
    sprintf(szBuffer, "<p>Source = %s", (LPCSTR) bstrSource);
  OutputString(pECB, szBuffer);

  _bstr_t bstrDescription(e.Description());
    sprintf(szBuffer, "<p>Description = %s", (LPCSTR) bstrDescription);
  OutputString(pECB, szBuffer);

  return;
} // end -- VOID OutputErrors(EXTENSION_CONTROL_BLOCK *pECB, _com_error &e)

VOID OutputErrors | ( | EXTENSION_CONTROL_BLOCK * | pECB,
 |  | HRESULT | hrError
 | ) |  |
VOID OutputString | ( | EXTENSION_CONTROL_BLOCK * | pECB,
 |  | LPCSTR | szBuffer
 | ) |  |

Definition at line 139 of file adoisapi.cpp.

{
  DWORD dwBuffer = strlen(szBuffer);
  pECB->WriteClient(pECB->ConnID, (PVOID) szBuffer, &dwBuffer, 0);

    // for debugging we save the output to a file if _DEBUG is defined...
    LogError(szBuffer);
} // end -- VOID OutputString(EXTENSION_CONTROL_BLOCK *pECB, LPCSTR szBuffer)

VOID PatchQuery | ( | char * | szQuery,
 |  | char ** | ppszPatchedQuery
 | ) |  |

Definition at line 95 of file adoisapi.cpp.

{
  char *p = szQuery + 1;

  while (*p++)
  {
    if (*p == '+') //replace '+' by ' '
        {
            *p = ' ';
        }

    if( *p == '%' ) //a number begins
    {
      char ch;

      if (*++p)
      {
        ch = ConvertHexToDec(*p) << 4; //convert the first digit

        if (*++p)
        {
          ch |= ConvertHexToDec(*p);  //convert the 2nd digit

          if (!*(p + 1))
          {
            *(p-2) = ch;
            *(p-1) = '\0';
            break;
          }
          else
          {
            *(p-2) = ' ';
            *(p-1) = ' ';
            *p = ch;
          }
        }
      }
    }
  }

  *ppszPatchedQuery = szQuery + 1;
    return;
}   // end -- VOID PatchQuery(char *szQuery, char **ppszPatchedQuery)

BOOL WINAPI TerminateExtension ( DWORD dwFlags )

Definition at line 52 of file adoisapi.cpp.

{
    // Unregister COM
    CoUninitialize();
    return TRUE;
} // end -- BOOL WINAPI TerminateExtension(  DWORD dwFlags  )

Variable Documentation

const PCSTR g_pszConnection = "Provider=SQLOLEDB;data source=YOUR SERVER NAME;initial catalog=northwind;uid=YOUR USER ID;pwd=YOUR USER's PASSWORD;"

Definition at line 36 of file adoisapi.cpp.

const char* szProgLog = "c:\\AdoIsapi.txt"

Definition at line 15 of file adoisapi.cpp.

Generated on Wed Nov 13 2024 16:53:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/ADO/shell/adovbs.inc File Reference

  • Dataaccess
  • ADO
  • shell

adovbs.inc File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/odbc/odbcsql/odbcsql.c File Reference

  • Dataaccess
  • odbc
  • odbcsql
Classes | Typedefs | Functions | Variables

odbcsql.c File Reference

Go to the source code of this file.

Classes

struct | STR_BINDING

Typedefs

typedef struct STR_BINDING | BINDING

Functions

int | _tmain (int argc, TCHAR **argv)
void | AllocateBindings (HSTMT lpStmt, SQLSMALLINT cCols, BINDING **lppBinding, SQLSMALLINT *lpDisplay)
void | DisplayResults (HSTMT lpStmt, SQLSMALLINT cCols)
void | DisplayTitles (HSTMT lpStmt, DWORD siDisplaySize, BINDING *pBinding)
void | HandleError (SQLHANDLE hHandle, SQLSMALLINT hType, RETCODE RetCode)
void | SetConsole (DWORD siDisplaySize, BOOL fInvert)

Variables

SHORT | gHeight = 80

Typedef Documentation

typedef struct STR_BINDING BINDING

Function Documentation

int _tmain | ( | int | argc,
 |  | TCHAR ** | argv
 | ) |  |

Definition at line 121 of file odbcsql.c.

{
  HENV  lpEnv = NULL;
  HDBC  lpDbc = NULL;
  HSTMT lpStmt = NULL;
  TCHAR *pszConnStr;
  TCHAR szInput[SQL_QUERY_SIZE];

  // Allocate an environment

  if (SQLAllocHandle(SQL_HANDLE_ENV,SQL_NULL_HANDLE,&lpEnv) == SQL_ERROR)
  {
    fprintf(stderr,"Unable to allocate an environment handle\n");
    exit(-1);
  }

  // Register this as an application that expects 2.x behavior,
  // you must register something if you use AllocHandle

  TRYODBC(lpEnv,
      SQL_HANDLE_ENV,
      SQLSetEnvAttr(lpEnv,
              SQL_ATTR_ODBC_VERSION,
              (SQLPOINTER)SQL_OV_ODBC2,
              0));

  // Allocate a connection

  TRYODBC(lpEnv,
      SQL_HANDLE_ENV,
      SQLAllocHandle(SQL_HANDLE_DBC,lpEnv,&lpDbc));

  if (argc > 1)
  {
    pszConnStr = *++argv;
  } else
  {
    pszConnStr = NULL;
  }

  // Connect to the driver.  Use the connection string if supplied
  // on the input, otherwise let the driver manager prompt for input.

  TRYODBC(lpDbc,
      SQL_HANDLE_DBC,
      SQLDriverConnect(lpDbc,
               GetDesktopWindow(),
               pszConnStr,
               SQL_NTS,
               NULL,
               0,
               NULL,
               SQL_DRIVER_COMPLETE));

  fprintf(stderr,"Connected!\n");

  TRYODBC(lpDbc,
      SQL_HANDLE_DBC,
      SQLAllocHandle(SQL_HANDLE_STMT,lpDbc,&lpStmt));

  printf("Enter SQL commands, type (control)Z to exit\nSQL COMMAND>");

  // Loop to get input and execute queries

  while(_fgetts(szInput, SQL_QUERY_SIZE-1, stdin))
  {
    RETCODE   RetCode;
    SQLSMALLINT sNumResults;

    // Execute the query

    if (!(*szInput))
    {
      printf("SQL COMMAND>");
      continue;
    }
    RetCode = SQLExecDirect(lpStmt,szInput,SQL_NTS);

    switch(RetCode)
    {
      case  SQL_SUCCESS_WITH_INFO:
      {
        HandleError(lpStmt,SQL_HANDLE_STMT,RetCode);
        // fall through
      }
      case  SQL_SUCCESS:
      {
        // If this is a row-returning query, display
        // results
        TRYODBC(lpStmt,
            SQL_HANDLE_STMT,
            SQLNumResultCols(lpStmt,&sNumResults));

        if (sNumResults > 0)
        {
          DisplayResults(lpStmt,sNumResults);
        } else
        {
          SQLINTEGER    siRowCount;

          TRYODBC(lpStmt,
              SQL_HANDLE_STMT,
              SQLRowCount(lpStmt,&siRowCount));

          if (siRowCount >= 0)
          {
            _tprintf(TEXT("%d %s affected\n"),
                siRowCount,
                siRowCount == 1 ? TEXT("row") : TEXT("rows"));
          }
        }
        break;
      }

      case  SQL_ERROR:
      {
        HandleError(lpStmt,SQL_HANDLE_STMT,RetCode);
        break;
      }

      default:
          fprintf(stderr,"Unexpected return code %d!\n",RetCode);

    }
    TRYODBC(lpStmt,
        SQL_HANDLE_STMT,
        SQLFreeStmt(lpStmt,SQL_CLOSE));

    printf("SQL COMMAND>");
  }

Exit:

  // Free ODBC handles and exit

  if (lpDbc)
  {
    SQLDisconnect(lpDbc);
    SQLFreeConnect(lpDbc);
  }
  if (lpEnv)
    SQLFreeEnv(lpEnv);

  printf("\nDisconnected.");

  return 0;

}

void AllocateBindings | ( | HSTMT | lpStmt,
 |  | SQLSMALLINT | cCols,
 |  | BINDING ** | lppBinding,
 |  | SQLSMALLINT * | lpDisplay
 | ) |  |

Definition at line 382 of file odbcsql.c.

{
  SQLSMALLINT   iCol;
  BINDING     *lpThisBinding, *lpLastBinding;
  SQLSMALLINT   cchDisplay, cchColumnNameLength, ssType;

  *lpDisplay = 0;

  for (iCol = 1; iCol <= cCols; iCol++)
  {
    lpThisBinding = (BINDING *)(malloc(sizeof(BINDING)));
    if (!(lpThisBinding))
    {
      fprintf(stderr,"Out of memory!\n");
      exit(-100);
    }

    if (iCol == 1)
    {
      *lppBinding = lpThisBinding;
    }
    else
    {
      lpLastBinding->sNext = lpThisBinding;
    }
    lpLastBinding=lpThisBinding;

    // Figure out the display length of the column (we will
    // bind to char since we are only displaying data, in general
    // you should bind to the appropriate C type if you are going
    // to manipulate data since it is much faster...)

    TRYODBC(lpStmt,
        SQL_HANDLE_STMT,
        SQLColAttribute(lpStmt,
                 iCol,
                 SQL_DESC_DISPLAY_SIZE,
                 NULL,
                 0,
                 NULL,
                 &cchDisplay));

    // Figure out if this is a character or numeric column; this is
    // used to determine if we want to display the data left- or right-
    // aligned.

    // !! Note a bug in the 3.x documentation.  We claim that
    // SQL_DESC_TYPE is a 1.x feature.   That is not true, SQL_DESC_TYPE
    // is a 3.x feature.   SQL_DESC_CONCISE_TYPE maps to the 1.x
    // SQL_COLUMN_TYPE.   This is what you must use if you want to work
    // against a 2.x driver.  Sorry for the inconvenience...

    TRYODBC(lpStmt,
        SQL_HANDLE_STMT,
        SQLColAttribute(lpStmt,
                iCol,
                SQL_DESC_CONCISE_TYPE,
                NULL,
                0,
                NULL,
                &ssType));

    lpThisBinding->fChar = (ssType == SQL_CHAR ||
                ssType == SQL_VARCHAR ||
                ssType == SQL_LONGVARCHAR);

    lpThisBinding->sNext = NULL;

    // Arbitrary limit on display size
    if (cchDisplay > DISPLAY_MAX)
      cchDisplay = DISPLAY_MAX;

    // Allocate a buffer big enough to hold the text representation
    // of the data.  Add one character for the null terminator

    lpThisBinding->szBuffer = (TCHAR *)malloc((cchDisplay+1) * sizeof(TCHAR));

    if (!(lpThisBinding->szBuffer))
    {
      fprintf(stderr,"Out of memory!\n");
      exit(-100);
    }

    // Map this buffer to the driver's buffer.   At Fetch time,
    // the driver will fill in this data.  Note that the size is
    // count of bytes (for Unicode).  All ODBC functions that take
    // SQLPOINTER use count of bytes; all functions that take only
    // strings use count of characters.

    TRYODBC(lpStmt,
        SQL_HANDLE_STMT,
        SQLBindCol(lpStmt,
               iCol,
               SQL_C_TCHAR,
               (SQLPOINTER) lpThisBinding->szBuffer,
               (cchDisplay + 1) * sizeof(TCHAR),
               &lpThisBinding->indPtr));

    // Now set the display size that we will use to display
    // the data.   Figure out the length of the column name

    TRYODBC(lpStmt,
        SQL_HANDLE_STMT,
        SQLColAttribute(lpStmt,
                iCol,
                SQL_DESC_NAME,
                NULL,
                0,
                &cchColumnNameLength,
                NULL));

    lpThisBinding->siDisplaySize = max(cchDisplay, cchColumnNameLength);
    if (lpThisBinding->siDisplaySize < NULL_SIZE)
      lpThisBinding->siDisplaySize = NULL_SIZE;

    *lpDisplay += lpThisBinding->siDisplaySize + DISPLAY_FORMAT_EXTRA;

  }

  Exit:
    // Not really a good error exit handler, we should free
    // up any memory that we allocated.   But this is a sample...

    return;
}

void DisplayResults | ( | HSTMT | lpStmt,
 |  | SQLSMALLINT | cCols
 | ) |  |

Definition at line 281 of file odbcsql.c.

{
  BINDING     *pFirstBinding, *pThisBinding;
  SQLSMALLINT   siDisplaySize;
  RETCODE     RetCode;
  int       iCount = 0;

  // Allocate memory for each column

  AllocateBindings(lpStmt,cCols,&pFirstBinding, &siDisplaySize);

  // Set the display mode and write the titles

  DisplayTitles(lpStmt,siDisplaySize, pFirstBinding);

  // Fetch and display the data

  do {
    // Fetch a row

    if (iCount++ >= gHeight - 2)
    {
      char  szInput[100];
      printf("              ");
      SetConsole(siDisplaySize+2,TRUE);
      printf("   Press ENTER to continue, Q to quit");
      printf("%d",gHeight);
      SetConsole(siDisplaySize+2,FALSE);
      gets(szInput);
      if ((*szInput == 'Q') || (*szInput == 'q'))
        goto Exit;

      iCount = 1;
      DisplayTitles(lpStmt,siDisplaySize, pFirstBinding);
    }

    TRYODBC(lpStmt,SQL_HANDLE_STMT, RetCode = SQLFetch(lpStmt));

    if (RetCode == SQL_NO_DATA_FOUND)
      break;

    // Display the data.   Ignore truncations

    for (pThisBinding = pFirstBinding;
       pThisBinding;
       pThisBinding = pThisBinding->sNext)
    {
      if (pThisBinding->indPtr != SQL_NULL_DATA)
      {
        _tprintf(pThisBinding->fChar ? TEXT(DISPLAY_FORMAT_C):
                         TEXT(DISPLAY_FORMAT),
            PIPE,
            pThisBinding->siDisplaySize,
            pThisBinding->siDisplaySize,
            pThisBinding->szBuffer);
      } else
      {
        _tprintf(TEXT(DISPLAY_FORMAT_C),
            PIPE,
            pThisBinding->siDisplaySize,
            pThisBinding->siDisplaySize,
            "<NULL>");
      }
    }
    _tprintf(TEXT(" %c\n"),PIPE);

  } while ( 1);

  SetConsole(siDisplaySize+2,TRUE);
  printf("%*.*s",siDisplaySize+2,siDisplaySize+2," ");
  SetConsole(siDisplaySize+2,FALSE);
  printf("\n");

Exit:
  // Clean up the allocated buffers

  while (pFirstBinding)
  {
    pThisBinding=pFirstBinding->sNext;
    free(pFirstBinding->szBuffer);
    free(pFirstBinding);
    pFirstBinding=pThisBinding;
  }

}

void DisplayTitles | ( | HSTMT | lpStmt,
 |  | DWORD | siDisplaySize,
 |  | BINDING * | pBinding
 | ) |  |

Definition at line 527 of file odbcsql.c.

{
  TCHAR     szTitle[DISPLAY_MAX];
  SQLSMALLINT   iCol = 1;

  SetConsole(siDisplaySize+2,TRUE);

  for (;pBinding;pBinding=pBinding->sNext)
  {
    TRYODBC(lpStmt,
        SQL_HANDLE_STMT,
        SQLColAttribute(lpStmt,
                iCol++,
                SQL_DESC_NAME,
                szTitle,
                sizeof(szTitle),  // Note count of bytes!
                NULL,
                NULL));

    _tprintf(TEXT(DISPLAY_FORMAT_C), PIPE,
         pBinding->siDisplaySize,
         pBinding->siDisplaySize,
         szTitle);

  }

Exit:

  _tprintf(TEXT(" %c"),PIPE);
  SetConsole(siDisplaySize+2,FALSE);
  _tprintf(TEXT("\n"));

}

void HandleError | ( | SQLHANDLE | hHandle,
 |  | SQLSMALLINT | hType,
 |  | RETCODE | RetCode
 | ) |  |

Definition at line 618 of file odbcsql.c.

{
  SQLSMALLINT iRec = 0;
  SQLINTEGER  iError;
  TCHAR   szMessage[1000];
  TCHAR   szState[SQL_SQLSTATE_SIZE];

  if (RetCode == SQL_INVALID_HANDLE)
  {
    fprintf(stderr,"Invalid handle!\n");
    return;
  }

  while (SQLGetDiagRec(hType,
             hHandle,
             ++iRec,
             szState,
             &iError,
             szMessage,
             (SQLSMALLINT)(sizeof(szMessage) / sizeof(TCHAR)),
             (SQLSMALLINT *)NULL) == SQL_SUCCESS)
  {

    // Hide data truncated..
    if (_tcsncmp(szState,TEXT("01004"),5))
      _ftprintf(stderr,TEXT("[%5.5s] %s (%d)\n"),szState,szMessage,iError);
  }

}

void SetConsole | ( | DWORD | siDisplaySize,
 |  | BOOL | fInvert
 | ) |  |

Definition at line 573 of file odbcsql.c.

{
  HANDLE              hConsole;
  CONSOLE_SCREEN_BUFFER_INFO    csbInfo;

    // A little bit of fun here -- reset the console screen
    // buffer size if necessary

    hConsole = GetStdHandle(STD_OUTPUT_HANDLE);

    if (hConsole != INVALID_HANDLE_VALUE)
    {
    if (GetConsoleScreenBufferInfo(hConsole, &csbInfo))
    {
      if (csbInfo.dwSize.X <  (SHORT) siDisplaySize)
      {
        csbInfo.dwSize.X =  (SHORT) siDisplaySize;
                SetConsoleScreenBufferSize(hConsole,csbInfo.dwSize);
      }

      gHeight = csbInfo.dwSize.Y;
    }

    if (fInvert)
      SetConsoleTextAttribute(hConsole, (WORD)(csbInfo.wAttributes |
                        BACKGROUND_BLUE));
    else
      SetConsoleTextAttribute(hConsole,(WORD)(csbInfo.wAttributes & ~(
                        BACKGROUND_BLUE)));
  }
}

Variable Documentation

SHORT gHeight = 80

Definition at line 108 of file odbcsql.c.

Generated on Wed Nov 13 2024 16:53:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/odbc/quiktest/autotest.h File Reference

  • Dataaccess
  • odbc
  • quiktest
Classes | Defines | Typedefs | Functions | Variables

autotest.h File Reference

#include <windows.h>
#include <stdlib.h>
#include <string.h>
#include "sql.h"
#include "sqlext.h"

Go to the source code of this file.

Classes

struct | tagSERVERINFO

Defines

#define | AbortTest(lps) { lps->cErrors=TEST_ABORTED; }
#define | AllocateMemory(cb) (GlobalLock(GlobalAlloc((GMEM_FIXED | GMEM_ZEROINIT), (cb))))
#define | AUTO_MAX_TEST_NAME 35
#define | AUTO_MAX_TESTCASE_NAME 35
#define | AUTO_MAX_TESTDESC_NAME 75
#define | CQBITS (sizeof(UINT) * 8)
#define | EXTFUN __export FAR PASCAL
#define | EXTFUNCDECL
#define | GETBIT(p1, p2) getqbit(p1,(p2)-1)
#define | getqbit(lpa, pos) (lpa[((pos) / CQBITS)] & (1 << ((pos) - (CQBITS * ((pos) / CQBITS)))))
#define | InitTest(lps) { lps->cErrors=0; }
#define | MAX_KEYWORD_LEN 149
#define | MAX_USER_INFO 50
#define | MAXFLUSH 300
#define | NumItems(s) (sizeof(s) / sizeof(s[0]))
#define | ReleaseMemory(lp)
#define | TEST_ABORTED (-1)

Typedefs

typedef SERVERINFO FAR * | lpSERVERINFO
typedef struct tagSERVERINFO | SERVERINFO

Functions

LPTSTR EXTFUN | GetRCString (HINSTANCE hInst, LPTSTR buf, int cbbuf, UINT ids)
BOOL EXTFUNCDECL FAR | szLogPrintf (lpSERVERINFO lps, BOOL fForce, LPTSTR szFmt,...)
int EXTFUNCDECL FAR | szMessageBox (HWND hwnd, UINT style, LPTSTR szTitle, LPTSTR szFmt,...)

Variables

HINSTANCE | hLoadedInst

Define Documentation

#define AbortTest ( lps ) { lps->cErrors=TEST_ABORTED; }

Definition at line 48 of file autotest.h.

#define AllocateMemory ( cb ) (GlobalLock(GlobalAlloc((GMEM_FIXED | GMEM_ZEROINIT), (cb))))

Definition at line 51 of file autotest.h.

#define AUTO_MAX_TEST_NAME 35

Definition at line 29 of file autotest.h.

#define AUTO_MAX_TESTCASE_NAME 35

Definition at line 30 of file autotest.h.

#define AUTO_MAX_TESTDESC_NAME 75

Definition at line 31 of file autotest.h.

#define CQBITS (sizeof(UINT) * 8)

Definition at line 66 of file autotest.h.

#define EXTFUN __export FAR PASCAL

Definition at line 42 of file autotest.h.

#define EXTFUNCDECL

Definition at line 41 of file autotest.h.

#define GETBIT | ( | p1,
 |  | p2 |
 | ) |  | getqbit(p1,(p2)-1)

Definition at line 69 of file autotest.h.

#define getqbit | ( | lpa,
 |  | pos |
 | ) |  | (lpa[((pos) / CQBITS)] & (1 << ((pos) - (CQBITS * ((pos) / CQBITS)))))

Definition at line 67 of file autotest.h.

#define InitTest ( lps ) { lps->cErrors=0; }

Definition at line 46 of file autotest.h.

#define MAX_KEYWORD_LEN 149

Definition at line 35 of file autotest.h.

#define MAX_USER_INFO 50

Definition at line 34 of file autotest.h.

#define MAXFLUSH 300

Definition at line 33 of file autotest.h.

#define NumItems ( s ) (sizeof(s) / sizeof(s[0]))

Definition at line 62 of file autotest.h.

#define ReleaseMemory ( lp )
Value:
(GlobalUnlock(((HGLOBAL)LOWORD(GlobalHandle(SELECTOROF(lp))))), \
                (BOOL)GlobalFree(((HGLOBAL)LOWORD(GlobalHandle(SELECTOROF(lp))))))

Definition at line 57 of file autotest.h.

#define TEST_ABORTED (-1)

Definition at line 27 of file autotest.h.

Typedef Documentation

typedef SERVERINFO FAR* lpSERVERINFO

Definition at line 108 of file autotest.h.

typedef struct tagSERVERINFO SERVERINFO

Function Documentation

LPTSTR EXTFUN GetRCString | ( | HINSTANCE | hInst,
 |  | LPTSTR | buf,
 |  | int | cbbuf,
 |  | UINT | ids
 | ) |  |
BOOL EXTFUNCDECL FAR szLogPrintf | ( | lpSERVERINFO | lps,
 |  | BOOL | fForce,
 |  | LPTSTR | szFmt,
 |  |  | ...
 | ) |  |
int EXTFUNCDECL FAR szMessageBox | ( | HWND | hwnd,
 |  | UINT | style,
 |  | LPTSTR | szTitle,
 |  | LPTSTR | szFmt,
 |  |  | ...
 | ) |  |

Variable Documentation

HINSTANCE hLoadedInst

Definition at line 10 of file dllstub.c.

Generated on Wed Nov 13 2024 16:53:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/odbc/quiktest/custom.c File Reference

  • Dataaccess
  • odbc
  • quiktest
Defines | Typedefs | Functions | Variables

custom.c File Reference

#include "autotest.h"
#include "custom.h"

Go to the source code of this file.

Defines

#define | CHECKERRS(sErr)
#define | CHECKTEST(lps, exprc, actrc, func)
#define | szAddress "%04X:%04X\r\n"

Typedefs

typedef HDBC FAR HSTMT FAR | lpSERVERINFO

Functions

BOOL EXTFUN | AutoTestDesc (UWORD iTest, LPSTR szName, LPSTR szDesc)
void EXTFUN | AutoTestFunc (lpSERVERINFO lpSrvr)
BOOL EXTFUN | AutoTestName (LPSTR szName, UINT FAR *pcbTestCases)
BOOL FAR PASCAL | CheckTest (lpSERVERINFO lps, RETCODE exprc, RETCODE actrc, LPSTR szFuncName)
SWORD FAR PASCAL | DoDisplayInfoDesc (HENV FAR *phenv, HDBC FAR *phdbc, HSTMT FAR *phstmt, lpSERVERINFO lpSrvr)
SWORD FAR PASCAL | DoHelloWorld (HENV FAR *phenv, HDBC FAR *phdbc, HSTMT FAR *phstmt, lpSERVERINFO lpSrvr)
SWORD FAR PASCAL | DoSimpleConnect (HENV FAR *phenv, HDBC FAR *phdbc, HSTMT FAR *phstmt, lpSERVERINFO lpSrvr)
typedef | SWORD (FAR PASCAL *TESTCASEFUNC)(HENV FAR *

Variables

struct {
TESTCASEFUNC lpTestFunc
UINT uiDesc
UINT uiName
} TestCases []

Define Documentation

#define CHECKERRS ( sErr )
Value:
if(!sErr) szLogPrintf(lpSrvr, FALSE, "\t\tPassed\r\n\r\n"); \
  else szLogPrintf(lpSrvr, FALSE, "\t\t%d errors\r\n\r\n", sErr);

Definition at line 37 of file custom.c.

#define CHECKTEST | ( | lps,
 |  | exprc,
 |  | actrc,
 |  | func
 | ) |
Value:
{                                                  \
  if(!CheckTest(lps, exprc, actrc, (LPSTR)func))  \
    return TEST_ABORTED;                         \
}

Definition at line 32 of file custom.c.

#define szAddress "%04X:%04X\r\n"

Typedef Documentation

typedef HDBC FAR HSTMT FAR lpSERVERINFO

Definition at line 30 of file custom.c.

Function Documentation

BOOL EXTFUN AutoTestDesc | ( | UWORD | iTest,
 |  | LPSTR | szName,
 |  | LPSTR | szDesc
 | ) |  |

Definition at line 119 of file custom.c.

{
  // Extra protection should AutoTestName return invalid pcbTestCases
  if(iTest > NumItems(TestCases))
    return FALSE;

  // Use GetRCString to retrieve resource string directly into return
  //    values
  GetRCString(hLoadedInst, szName,
          AUTO_MAX_TESTCASE_NAME, TestCases[(iTest-1)].uiName);
  GetRCString(hLoadedInst, szDesc,
          AUTO_MAX_TESTDESC_NAME, TestCases[(iTest-1)].uiDesc);

   return TRUE;
}

void EXTFUN AutoTestFunc ( lpSERVERINFO lpSrvr )

Definition at line 151 of file custom.c.

{
  HENV    henv=NULL;
  HDBC    hdbc=NULL;
  HSTMT   hstmt0=NULL;
  int   iDex;
  SWORD   cErrCnt;                    // Count errors
  char    szName[AUTO_MAX_TESTCASE_NAME+6]; // Room for NULL and \r\n

  // Sets the error count to 0
  InitTest(lpSrvr);

  // Loop through the count of test cases looking for set bits via GETBIT.
  //    When a bit is set, that test is to be run.  We've stored the
  //    function address which will implement the test, so simply call it.
  for(iDex=1;  iDex<=NumItems(TestCases);  iDex++)
    if(GETBIT(lpSrvr->rglMask, iDex)) {
      // Print out title of test
      GetRCString(hLoadedInst, szName,
          AUTO_MAX_TESTCASE_NAME, TestCases[(iDex-1)].uiName);
      szLogPrintf(lpSrvr, FALSE, "%s:\r\n", (LPSTR)szName);

      // Call the test case and add errors
      cErrCnt =
        (*TestCases[(iDex-1)].lpTestFunc)(&henv, &hdbc, &hstmt0, lpSrvr);
      if(cErrCnt != TEST_ABORTED)
        lpSrvr->cErrors += cErrCnt;
      else
        goto abort;
      }
  return;

  // When a test must abort, the test case should call the AbortTest
  //    macro which sets lpSrvr->cErrors to TEST_ABORTED.
abort:
  return;
}

BOOL EXTFUN AutoTestName | ( | LPSTR | szName,
 |  | UINT FAR * | pcbTestCases
 | ) |  |

Definition at line 92 of file custom.c.

{
  GetRCString(hLoadedInst, szName, AUTO_MAX_TEST_NAME, idsTestName);
  *pcbTestCases = NumItems(TestCases);

   return TRUE;
}

BOOL FAR PASCAL CheckTest | ( | lpSERVERINFO | lps,
 |  | RETCODE | exprc,
 |  | RETCODE | actrc,
 |  | LPSTR | szFuncName
 | ) |  |

Definition at line 407 of file custom.c.

{
  if(exprc != actrc) {
    szLogPrintf(lps, FALSE, "\t%s failed:\r\n", (LPSTR)szFuncName);
    szLogPrintf(lps, FALSE, "\t\tExpected: %d\r\n", exprc);
    szLogPrintf(lps, FALSE, "\t\tActual:   %d\r\n", actrc);
    return FALSE;
    }
  else
    return TRUE;
}

SWORD FAR PASCAL DoDisplayInfoDesc | ( | HENV FAR * | phenv,
 |  | HDBC FAR * | phdbc,
 |  | HSTMT FAR * | phstmt,
 |  | lpSERVERINFO | lpSrvr
 | ) |  |

Definition at line 249 of file custom.c.

{
  SWORD   sErr=0;

#ifndef WIN32
#define szAddress "%04X:%04X\r\n"
#else
#define szAddress "%08X\r\n"
#endif

  // The hwnd parameter is the window of style "edit" which is used for output.
  //  The szLogFile parameter is used for file logging of output.
  szLogPrintf(lpSrvr, FALSE,
        "\thwnd:\t\t\t\t\t\t\t%04X\r\n", lpSrvr->hwnd);
  szLogPrintf(lpSrvr, FALSE,
        "\tszLogFile:\t\t\t\t%s\r\n", (LPSTR)lpSrvr->szLogFile);

  // Print out address information.  Note that szAddress is conditionaly compiled
  //    to handle 16 and 32-bit.  It will be concatenated to the format string
  //    by the compiler to create a file platform correct string.
  szLogPrintf(lpSrvr, FALSE,
        "\thenv:\t\t\t\t\t\t\t" szAddress,
#ifndef WIN32
        HIWORD(lpSrvr->henv), LOWORD(lpSrvr->henv));
#else
        lpSrvr->henv);
#endif
  szLogPrintf(lpSrvr, FALSE,
        "\thdbc:\t\t\t\t\t\t\t" szAddress,
#ifndef WIN32
        HIWORD(lpSrvr->hdbc), LOWORD(lpSrvr->hdbc));
#else
        lpSrvr->hdbc);
#endif
  szLogPrintf(lpSrvr, FALSE,
        "\thstmt:\t\t\t\t\t\t\t" szAddress,
#ifndef WIN32
        HIWORD(lpSrvr->hstmt), LOWORD(lpSrvr->hstmt));
#else
        lpSrvr->hstmt);
#endif

  // The following are defined via the Tools, Manage Test Sources dialog in
  //    the ODBC Test application.
  szLogPrintf(lpSrvr, FALSE,
        "\tszSource:\t\t\t\t\t%s\r\n", (LPSTR)lpSrvr->szSource);
  szLogPrintf(lpSrvr, FALSE,
        "\tszValidServer0:\t\t\t\t\t\t%s\r\n", (LPSTR)lpSrvr->szValidServer0);
  szLogPrintf(lpSrvr, FALSE,
        "\tszValidLogin0:\t\t\t\t\t\t%s\r\n", (LPSTR)lpSrvr->szValidLogin0);
  szLogPrintf(lpSrvr, FALSE,
        "\tszValidPassword0:\t\t\t%s\r\n", (LPSTR)lpSrvr->szValidPassword0);
  szLogPrintf(lpSrvr, FALSE,
        "\tszKeywords:\t\t\t%s\r\n", (LPSTR)lpSrvr->szKeywords);

  // The following elements describe the run-time environment
  szLogPrintf(lpSrvr, FALSE,
        "\tcErrors:\t\t\t\t\t\t%d\r\n", (LPSTR)lpSrvr->cErrors);
  szLogPrintf(lpSrvr, FALSE,
        "\tfDebug:\t\t\t\t\t\t%d\r\n", (LPSTR)lpSrvr->fDebug);
  szLogPrintf(lpSrvr, FALSE,
        "\tfScreen:\t\t\t\t\t\t%d\r\n", (LPSTR)lpSrvr->fScreen);
  szLogPrintf(lpSrvr, FALSE,
        "\tfLog:\t\t\t\t\t\t\t\t%d\r\n", (LPSTR)lpSrvr->fLog);
  szLogPrintf(lpSrvr, FALSE,
        "\tfIsolate:\t\t\t\t\t\t%d\r\n", (LPSTR)lpSrvr->fIsolate);
  szLogPrintf(lpSrvr, FALSE,
        "\tvCursorLib:\t\t\t\t%lu\r\n", (LPSTR)lpSrvr->vCursorLib);
  szLogPrintf(lpSrvr, FALSE,
        "\thLoadedInst:\t\t\t%04X\r\n", (LPSTR)lpSrvr->hLoadedInst);

  // check for errors
  CHECKERRS(sErr);

  return sErr;
}

SWORD FAR PASCAL DoHelloWorld | ( | HENV FAR * | phenv,
 |  | HDBC FAR * | phdbc,
 |  | HSTMT FAR * | phstmt,
 |  | lpSERVERINFO | lpSrvr
 | ) |  |

Definition at line 213 of file custom.c.

{
  SWORD   sErr=1;           // Pretend there was 1 error

  // The szMessageBox function will display a formatted message via the
  //    Windows MessageBox function.  This function should not be used
  //    for standard testing since a good test will run unattended.
  szMessageBox(lpSrvr->hwnd,
        MB_ICONINFORMATION | MB_OK,
        "Hello World",
        "This is a sample message.");

  // The szLogPrintf function is preferred for output operations.  It will
  //    format your string using wvsprintf (which has a limit of 2000 characters)
  //    and log the result both to the output window and to a file per
  //    user instructions.
  szLogPrintf(lpSrvr, FALSE, "\tHello World!!\r\n");

  // check for errors
  CHECKERRS(sErr);

  return sErr;
}

SWORD FAR PASCAL DoSimpleConnect | ( | HENV FAR * | phenv,
 |  | HDBC FAR * | phdbc,
 |  | HSTMT FAR * | phstmt,
 |  | lpSERVERINFO | lpSrvr
 | ) |  |

Definition at line 337 of file custom.c.

{
  RETCODE     rc;
  SWORD       sErr=0;

  // This test will assume that the ODBC handles passed in
  //    are NULL.  One could have this function do a connection
  //    and pass the handles to other test functions.
  rc = SQLAllocEnv(phenv);
  CHECKTEST(lpSrvr, SQL_SUCCESS, rc, "SQLAllocEnv");

  rc = SQLAllocConnect(*phenv, phdbc);
  CHECKTEST(lpSrvr, SQL_SUCCESS, rc, "SQLAllocConnect");

  rc = SQLConnect(*phdbc, lpSrvr->szValidServer0, SQL_NTS,
                  lpSrvr->szValidLogin0, SQL_NTS,
                  lpSrvr->szValidPassword0, SQL_NTS);
  CHECKTEST(lpSrvr,
      (RETCODE)((rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO)
            ? rc : SQL_SUCCESS),
      rc, "SQLConnect");

  rc = SQLAllocStmt(*phdbc, phstmt);
  CHECKTEST(lpSrvr, SQL_SUCCESS, rc, "SQLAllocStmt");

  rc = SQLFreeStmt(*phstmt, SQL_DROP);
  CHECKTEST(lpSrvr, SQL_SUCCESS, rc, "SQLFreeStmt");

  rc = SQLDisconnect(*phdbc);
  CHECKTEST(lpSrvr, SQL_SUCCESS, rc, "SQLDisconnect");

  rc = SQLFreeConnect(*phdbc);
  CHECKTEST(lpSrvr, SQL_SUCCESS, rc, "SQLFreeConnect");

  rc = SQLFreeEnv(*phenv);
  CHECKTEST(lpSrvr, SQL_SUCCESS, rc, "SQLFreeEnv");

  // check for errors
  CHECKERRS(sErr);

  return sErr;
}

typedef SWORD ( FAR PASCAL * TESTCASEFUNC )

Variable Documentation

TESTCASEFUNC lpTestFunc

Definition at line 64 of file custom.c.

struct { ... } TestCases[]
UINT uiDesc

Definition at line 63 of file custom.c.

UINT uiName

Definition at line 62 of file custom.c.

Generated on Wed Nov 13 2024 16:53:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/odbc/quiktest/custom.h File Reference

  • Dataaccess
  • odbc
  • quiktest
Defines

custom.h File Reference

Go to the source code of this file.

Defines

#define | idsDisplayInfo 30004
#define | idsDisplayInfoDesc 30005
#define | idsHelloWorld 30002
#define | idsHelloWorldDesc 30003
#define | idsSimpleConnect 30006
#define | idsSimpleConnectDesc 30007
#define | idsTestName 30001

Define Documentation

#define idsDisplayInfo 30004

Definition at line 18 of file custom.h.

#define idsDisplayInfoDesc 30005

Definition at line 19 of file custom.h.

#define idsHelloWorld 30002

Definition at line 16 of file custom.h.

#define idsHelloWorldDesc 30003

Definition at line 17 of file custom.h.

#define idsSimpleConnect 30006

Definition at line 20 of file custom.h.

#define idsSimpleConnectDesc 30007

Definition at line 21 of file custom.h.

#define idsTestName 30001

Definition at line 15 of file custom.h.

Generated on Wed Nov 13 2024 16:53:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/odbc/quiktest/dllstub.c File Reference

  • Dataaccess
  • odbc
  • quiktest
Functions | Variables

dllstub.c File Reference

#include <windows.h>
#include "autotest.h"

Go to the source code of this file.

Functions

int EXTFUN | LibMain (HINSTANCE hInst, WORD wDataSeg, WORD cbHeapSize, LPSTR szCmdLine)
int EXTFUN | WEP (int fParm)

Variables

HINSTANCE | hLoadedInst

Function Documentation

int EXTFUN LibMain | ( | HINSTANCE | hInst,
 |  | WORD | wDataSeg,
 |  | WORD | cbHeapSize,
 |  | LPSTR | szCmdLine
 | ) |  |

Definition at line 61 of file dllstub.c.

{
  if(cbHeapSize != 0)
    UnlockData(0);

  hLoadedInst = hInst;

  return TRUE;
}

int EXTFUN WEP ( int fParm )

Definition at line 83 of file dllstub.c.

{
  switch (fParm) {
    case WEP_SYSTEM_EXIT:
    case WEP_FREE_DLL:
    default:
      return TRUE;
  }
}

Variable Documentation

HINSTANCE hLoadedInst

Definition at line 10 of file dllstub.c.

Generated on Wed Nov 13 2024 16:53:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/odbc/quiktest/quiktest.c File Reference

  • Dataaccess
  • odbc
  • quiktest
Classes | Defines | Typedefs | Functions | Variables

quiktest.c File Reference

#include "autotest.h"
#include <stdio.h>
#include <string.h>
#include <malloc.h>
#include <wchar.h>
#include <tchar.h>
#include <time.h>
#include <math.h>
#include "sql.h"
#include "sqlext.h"
#include "quiktest.h"

Go to the source code of this file.

Classes

struct | tagDescInfo
struct | tagDescType
struct | tagDIAGINFO
struct | tagHANDLES

Defines

#define | QUIKTEST

Typedefs

typedef struct tagHANDLES | HANDLES
typedef struct tagHANDLES * | lpHANDLES

Functions

_inline BOOL PASCAL | AllocHdbc (HDBC *phdbc)
_inline BOOL PASCAL PASCAL | AllocHenv ()
_inline BOOL PASCAL | AllocHstmt ()
BOOL | AllowedType (SWORD fType)
BOOL CALLBACK | AutoTestDesc (UWORD iTest, LPTSTR szName, LPTSTR szDesc)
void CALLBACK | AutoTestFunc (lpSERVERINFO pTestSource)
BOOL CALLBACK | AutoTestName (LPTSTR szName, UINT *cbTestCases)
BOOL PASCAL | BindAllColumns (QTSTRUCT *lpqt, FIELDINFO *rgFields, UWORD cTypes, DSTRUCT *lpd)
BOOL PASCAL | BindFetchColumns (QTSTRUCT *lpqt, FIELDINFO *rgFields, UWORD cTypes, DSTRUCT *lpdFetch)
void PASCAL | BinToHex (PTR rgbValue, SWORD cbValue, LPTSTR szHexString)
BOOL PASCAL | BuildCreateStmt (QTSTRUCT *lpqt, FIELDINFO *rgFields, UWORD cTypes)
BOOL PASCAL | BuildInsertStmt (QTSTRUCT *lpqt, FIELDINFO *rgFields, UWORD cTypes, DSTRUCT *lpd, SDWORD *cColsSelected, BOOL fBindParameter)
BOOL PASCAL | CanAllocHdesc ()
UWORD PASCAL | CheckConformanceLevel ()
VOID PASCAL | CheckData (SWORD fHandleType, UWORD uwDescField, PTR rgbValue, LPTSTR szDataSourceName)
BOOL | CheckDataResults (SWORD row, SWORD iTableCol, FIELDINFO *pField, DSTRUCT *pDataStr, SDWORD cbValue, TCHAR *rgbValue)
void | CheckDescOp (SQLHDESC hdesc, SQLRETURN rc, SQLUSMALLINT uwDescIndex, SQLSMALLINT swDescRecCount, SQLSMALLINT swDescRec, SQLUSMALLINT iDescField, SQLINTEGER swUpdateMode)
void | CheckDescRecord (SQLHDESC hdesc, SQLSMALLINT swDescRec, SQLSMALLINT fType, SQLSMALLINT fSubType, SQLINTEGER cbLength, SQLSMALLINT ibPrecision, SQLSMALLINT ibScale, SQLPOINTER pData, SQLINTEGER *pcbValue, SQLINTEGER *pIndicator, SQLUSMALLINT iDescType)
void | CheckDescriptor (SQLHDESC hdesc, SQLINTEGER swUpdateMode, SQLHSTMT hstmt, UWORD uwDescIndex)
void PASCAL | CleanUp (DSTRUCT *lpd, QTSTRUCT *lpqt, FIELDINFO *rgFields, LPTSTR szTableName, BOOL fSilent, LPTSTR szValidServer)
VOID PASCAL | ClearErrorQueue ()
BOOL | CompareAnsiToUnicode (SQLCHAR *aszBuf, SQLINTEGER cbA, SQLWCHAR *wszBuf, SQLINTEGER cbW, SQLTCHAR *szAPI)
void | CompareAnsiUnicodeResults (SQLHSTMT hstmtA, SQLHSTMT hstmtW, SQLTCHAR *szAPI)
void | CompareDescField (SQLHDESC hdesc1, SQLHDESC hdesc2, SQLUSMALLINT uwDescIndex, SQLSMALLINT swDescRec, SQLSMALLINT swDescRecCount, SQLUSMALLINT uwDescField, TCHAR *pszAPI)
void | CompareDescriptor (SQLHDESC hdesc1, SQLHDESC hdesc2, UWORD uwDescIndex, TCHAR *pszAPI)
void | CompareWithExpected (PTR rgbValue, SDWORD *pcbValue, UWORD row, UWORD icol, FIELDINFO *rgFields)
BOOL PASCAL | Connect (lpSERVERINFO lpSI, QTSTRUCT *lpqt)
SWORD | CreateDescRecord (SQLHDESC hdesc, SQLHSTMT hstmt, UWORD uwDescType)
void PASCAL | CreateParamQuery (QTSTRUCT *lpqt, FIELDINFO *rgFields, UWORD cTypes)
SQLRETURN | DescBindCol (SQLHSTMT hstmt, SQLSMALLINT icol, SQLSMALLINT fCType, SQLPOINTER rgbValue, SQLINTEGER cbValueMax, SQLINTEGER *pcbValue)
SQLRETURN | DescBindParameter (SQLHSTMT hstmt, SQLUSMALLINT ipar, SQLSMALLINT fParamType, SQLSMALLINT fCType, SQLSMALLINT fSqlType, SQLUINTEGER cbColDef, SQLSMALLINT ibScale, SQLPOINTER rgbValue, SQLINTEGER cbValueMax, SQLINTEGER *pcbValue)
void PASCAL | DisplayAllErrors ()
VOID PASCAL | DisplayTestName (UWORD i)
VOID PASCAL | DropHdbc (HDBC hdbc)
_inline VOID PASCAL | DropHenv ()
void PASCAL | DropTable (LPTSTR szTableName, BOOL fSilent)
int PASCAL | ErrsHandle (SWORD fHandleType, SQLHANDLE hHandle, RETCODE retExpected, RETCODE retReceived, LPTSTR szFunction, LPTSTR szFile, int iLine, BOOL fDiag)
SWORD PASCAL | ExecEndTran (QTSTRUCT *lpqt, FIELDINFO *rgFields, UWORD cTypes, DSTRUCT *lpd, SQLSMALLINT fHandleType, SQLSMALLINT fMode, UWORD cSeed)
BOOL PASCAL | FindError (SWORD fHandleType, LPTSTR szFindState)
_inline BOOL PASCAL | FreeStmt (UWORD fOption)
void PASCAL | FullDisconnect ()
VOID PASCAL | GetDiagRecs (SWORD fHandleType, SQLHANDLE hHandle)
UWORD PASCAL | GetDMVersion ()
VOID PASCAL | GetErrors (HENV henv, HDBC hdbc, HSTMT hstmt)
SWORD PASCAL | GetRowCnt (QTSTRUCT *lpqt)
VOID PASCAL | GetSomeData (HSTMT lhstmt, LPTSTR szTableName, BOOL fBindCol, FIELDINFO rgField)
UWORD PASCAL | GetTypeInfo (FIELDINFO *rgFields, QTSTRUCT *lpqt)
BOOL PASCAL | IgnoreType (LPTSTR szType, SWORD wSQLType)
BOOL PASCAL | InsertOneRow (QTSTRUCT *lpqt, FIELDINFO *rgFields, UWORD cTypes, DSTRUCT *lpd, UWORD cSeed, BOOL fFreeHstmt)
BOOL PASCAL | Is3XDriver (HDBC hdbc, QTSTRUCT *lpqt)
void PASCAL | qtDisplayError (LPTSTR szFunction, LPTSTR buf, LPTSTR szFile, int iLine)
LPTSTR PASCAL | qtMakeData (int row, int col, FIELDINFO *rgField, LPTSTR buf)
void | ResetHstmt (SQLHSTMT *phstmt)
LPTSTR PASCAL | RetcodeToTCHAR (RETCODE retcode, LPTSTR buf)
void PASCAL | RetrieveData (QTSTRUCT *lpqt, FIELDINFO *rgFields, UWORD cTypes, DSTRUCT *lpd)
int PASCAL | ReturnCheck (RETCODE retExpected, RETCODE retReceived, LPTSTR szFunction, LPTSTR szFile, int iLine, BOOL fDiag)
_inline int PASCAL | SearchForError (HENV henv, HDBC hdbc, HSTMT hstmt, LPTSTR szFindState)
_inline RETCODE PASCAL | SelectFromTable (QTSTRUCT *lpqt)
_inline RETCODE PASCAL | SelectFromTableFetch (QTSTRUCT *lpqt, TCHAR *szColName)
_inline BOOL PASCAL | SetConnectionAttributes (HDBC lhdbc, UWORD fAttr, UDWORD rgbValue)
VOID PASCAL | SetErrorCondition (SWORD fHandleType)
_inline BOOL PASCAL | SetStatementAttributes (UWORD fAttr, PTR rgbValue)
void PASCAL | SetTableName (QTSTRUCT *lpqt)
_inline UWORD PASCAL | Supported (UWORD uwSQLFunc)
_inline VOID WINAPI | szWrite (LPTSTR szStr, BOOL fNewLine)
void PASCAL | TestBindParam (QTSTRUCT *lpqt, FIELDINFO *rgFields, UWORD cTypes, DSTRUCT *lpd)
VOID PASCAL | TestConnectAttr (HDBC hdbc, SDWORD fAttribute, UDWORD rgbValue, LPTSTR lpAttr, BOOL fReadOnlyAttr)
void PASCAL | TestConnectionOptions ()
void PASCAL | TestCopyDesc (QTSTRUCT *lpqt)
VOID PASCAL | TestCursorName (QTSTRUCT *lpqt)
void PASCAL | TestData (QTSTRUCT *lpqt, FIELDINFO *rgFields, UWORD cTypes, DSTRUCT *lpd)
void PASCAL | TestDescDefaults (QTSTRUCT *lpqt)
void PASCAL | TestDiagField ()
void PASCAL | TestDiagRec ()
void PASCAL | TestEndTran (QTSTRUCT *lpqt, FIELDINFO *rgFields, UWORD cTypes, DSTRUCT *lpd)
void PASCAL | TestEnvAttr ()
void PASCAL | TestExtendedFetch (QTSTRUCT *lpqt, FIELDINFO *rgFields, UWORD cTypes)
void PASCAL | TestFetchScroll (QTSTRUCT *lpqt)
void PASCAL | TestGetDescField (QTSTRUCT *lpqt)
void PASCAL | TestGetDescRec (QTSTRUCT *lpqt)
void PASCAL | TestLargeQuery (QTSTRUCT *lpqt, FIELDINFO *rgFields, UWORD cTypes, DSTRUCT *lpd)
void PASCAL | TestLikeQuery (QTSTRUCT *lpqt, FIELDINFO *rgFields, UWORD cTypes, DSTRUCT *lpd)
void PASCAL | TestMetaData (lpSERVERINFO lpSI, QTSTRUCT *lpqt, FIELDINFO *rgFields, UWORD cTypes)
void PASCAL | TestMixedAnsiUnicode (QTSTRUCT *lpqt)
VOID PASCAL | TestNumResCols (SDWORD cColsSelected, QTSTRUCT *lpqt)
void PASCAL | TestOJCap (QTSTRUCT *lpqt)
void PASCAL | TestQuickRebind (QTSTRUCT *lpqt, FIELDINFO *rgFields, UWORD cTypes, DSTRUCT *lpd)
void PASCAL | TestSearchedQuery (QTSTRUCT *lpqt, FIELDINFO *rgFields, UWORD cTypes, DSTRUCT *lpd, BOOL fBindParameter)
void PASCAL | TestSetDescField (QTSTRUCT *lpqt)
void PASCAL | TestSetDescRec (QTSTRUCT *lpqt)
void PASCAL | TestSQLBrowseConnect (lpSERVERINFO lpSI)
void PASCAL | TestSQLColumnPrivileges (QTSTRUCT *lpqt)
void PASCAL | TestSQLDataSources ()
void PASCAL | TestSQLDescribeParam (QTSTRUCT *lpqt)
void PASCAL | TestSQLDrivers ()
void PASCAL | TestSQLForeignKeys (QTSTRUCT *lpqt)
void PASCAL | TestSQLMoreResults (QTSTRUCT *lpqt)
void PASCAL | TestSQLNativeSQL (QTSTRUCT *lpqt)
void PASCAL | TestSQLNumParams (QTSTRUCT *lpqt)
void PASCAL | TestSQLParamOptions (QTSTRUCT *lpqt)
void PASCAL | TestSQLPrimaryKeys (QTSTRUCT *lpqt)
void PASCAL | TestSQLProcedureColumns (QTSTRUCT *lpqt)
void PASCAL | TestSQLProcedures ()
void PASCAL | TestSQLSetConnectAttr ()
void PASCAL | TestSQLSetScrollOptions ()
void PASCAL | TestSQLSetStmtAttr ()
void PASCAL | TestSQLSpecialCols (QTSTRUCT *lpqt)
BOOL PASCAL | TestSQLStatistics (QTSTRUCT *lpqt, FIELDINFO *rgFields, UWORD cTypes, DSTRUCT *lpd, UWORD fIndex)
void PASCAL | TestSQLTablePrivileges ()
void PASCAL | TestSQLTables (QTSTRUCT *lpqt)
void PASCAL | TestStmtOptions ()
void | TestThreading (lpSERVERINFO lpSI, QTSTRUCT *lpqt, FIELDINFO *rgFieldInfo)
void PASCAL | TestUseDesc (QTSTRUCT *lpqt, FIELDINFO *rgFields)
DWORD WINAPI | ThreadLoop (void *pArg)
void PASCAL | VerifyIndex (QTSTRUCT *lpqt, UWORD fIndex)

Variables

SQLTCHAR | buf [MAX_STRING_SIZE]
SQLINTEGER | cbtsval = sizeof(TIMESTAMP_STRUCT)
SQLINTEGER | cbValue
SQLINTEGER | cbValueMax
SUPPORTCONCURINFO ConcurList []
SQLSMALLINT | DescBuf [MAX_DESC_BUF]
struct tagDescType | DescTypes []
UWORD | fBindParameter = FALSE
UWORD | fDiagFieldSupported = FALSE
UWORD | fDiagRecSupported = FALSE
BOOL | g_f3XDriver = FALSE
UWORD | guwRowCount = 0
LPTSTR iTestNames []
lpSERVERINFO | lpSI = NULL
SUPPORTOPTINFO OptionList []
struct tagDescInfo | rgDescInfo []
struct tagDIAGINFO | rgDiagInfo []
SQLUINTEGER | RowsProcessed
SQLUSMALLINT | StatusArray [STATUS_ARRAY_SIZE]
SQLINTEGER | swBindOffset = 128
TCHAR | szInsertStmt [MAX_STRING_SIZE]
SQLTCHAR | szParamName [MAX_STRING_SIZE] = TEXT("Parameter Name")
TIMESTAMP_STRUCT | tsval = {1955, 12, 31, 23, 59, 59, 999}
UWORD | uDriverODBCVer = 0

Define Documentation

#define QUIKTEST

Definition at line 15 of file quiktest.c.

Typedef Documentation

typedef struct tagHANDLES HANDLES
typedef struct tagHANDLES * lpHANDLES

Function Documentation

_inline BOOL PASCAL AllocHdbc ( HDBC * phdbc )

Definition at line 879 of file quiktest.c.

{
  BOOL            fFailed=FALSE;
  RETCODE rc=SQL_SUCCESS;

  if (Supported(SQL_API_SQLALLOCHANDLE))
  {
    rc = SQLAllocHandle(SQL_HANDLE_DBC,henv, phdbc);
    if(!RETCHECK(SQL_SUCCESS, rc, szSQLALLOCHANDLE))
      fFailed=TRUE;
  }
  else
  {
    rc = SQLAllocConnect(henv, phdbc);
    if(!RETCHECK(SQL_SUCCESS, rc, szSQLALLOCCONNECT))
      fFailed=TRUE;
  }

  return(fFailed);

} //AllocHdbc()

_inline BOOL PASCAL PASCAL AllocHenv ( )

Definition at line 907 of file quiktest.c.

{
  BOOL            fFailed=FALSE;
  RETCODE rc=SQL_SUCCESS;

  rc = SQLAllocEnv(&henv);
  if (!RETCHECK(SQL_SUCCESS, rc,szSQLALLOCENV))
    fFailed=TRUE;

  return(fFailed);

} //AllocHenv()

_inline BOOL PASCAL AllocHstmt ( )

Definition at line 850 of file quiktest.c.

{
  BOOL            fFailed=FALSE;
  RETCODE rc=SQL_SUCCESS;

  if (Supported(SQL_API_SQLALLOCHANDLE))
  {
    rc = SQLAllocHandle(SQL_HANDLE_STMT,hdbc, &hstmt);
    if(!RETCHECK(SQL_SUCCESS, rc, szSQLALLOCHANDLE))
      fFailed=TRUE;
  }
  else
  {
    rc = SQLAllocStmt(hdbc, &hstmt);
    if(!RETCHECK(SQL_SUCCESS, rc, szSQLALLOCSTMT))
      fFailed=TRUE;
  }

  return(fFailed);

} //AllocHstmt()

BOOL AllowedType ( SWORD fType )

Definition at line 2161 of file quiktest.c.

{
  SWORD i, swNumTypes=0;
  BOOL bAllowed=TRUE;
  SWORD rgAllowedTypes[MAX_TYPES_SUPPORTED]={
    SQL_CHAR,
    SQL_BINARY
//              SQL_BIT
/*
    SQL_TINYINT
    SQL_NUMERIC,
    SQL_INTEGER,
    SQL_SMALLINT,
    SQL_FLOAT,
    SQL_REAL,
    SQL_TYPE_TIMESTAMP,
    SQL_LONGVARBINARY,
    SQL_LONGVARCHAR
*/
  };

  if (swNumTypes > 0)
  {
    bAllowed=FALSE;

    for (i=0; i < swNumTypes; i++)
    {
      if (fType == rgAllowedTypes[i])
        bAllowed=TRUE;
    }
  }

  return bAllowed;
}

BOOL CALLBACK AutoTestDesc | ( | UWORD | iTest,
 |  | LPTSTR | szName,
 |  | LPTSTR | szDesc
 | ) |  |

Definition at line 7181 of file quiktest.c.

{

  UWORD len=0;

  if (iTest > (sizeof(iTestNames)/sizeof(LPTSTR)))
    return FALSE;

  if (szName)
  _tcscpy(szName,iTestNames[iTest-1]);

  if (szDesc)
  _tcscpy(szDesc,TEXT(" "));

  return TRUE;

}

void CALLBACK AutoTestFunc ( lpSERVERINFO pTestSource )

Definition at line 7203 of file quiktest.c.

{

  RETCODE                 rc;
  UWORD                           cTypes;
        UDWORD                  dwLen=0;
  UWORD                           fIndex;
  SDWORD                  cColsSelected;
  FIELDINFO               *rgFields =
    (FIELDINFO  *)AllocateMemory(sizeof(FIELDINFO) * MAX_TYPES_SUPPORTED);
  QTSTRUCT                        *lpqt =
    (QTSTRUCT  *)AllocateMemory(sizeof (QTSTRUCT));
  DSTRUCT                 *lpd =
    (DSTRUCT  *)AllocateMemory(sizeof (DSTRUCT) * MAX_TYPES_SUPPORTED);
  UWORD                           uDMVer;
  SDWORD                  cbValue=0;
  TCHAR                           szAPI[MEDBUFF];
  UWORD                           i;
  TCHAR           szState[100]=TEXT(""),
        szErrMsg[XLARGEBUFF]=TEXT("");

  lpSI = pTestSource;
  lpSI->failed = 0;
  henv = NULL;
  hdbc = NULL;
  hstmt = NULL;
  hdesc = NULL;

  if(lpSI->szValidServer0)
  {
    if (Connect(lpSI,lpqt))
      goto ErrorRet;
  }
  else
  {
    henv = lpSI->henv;
    hdbc = lpSI->hdbc;

    rc = SQLSetConnectOption(hdbc,SQL_ODBC_CURSORS,dwLen);
    _tcscpy(szAPI,szSQLSETCONNECTOPTION);

    if(RETCHECK(SQL_SUCCESS, rc,szAPI))
      lpSI->vCursorLib = dwLen;
  }

  uDMVer=GetDMVersion();

  fIndex=CheckConformanceLevel();

  fBindParameter=Supported(SQL_API_SQLBINDPARAMETER);
  fDiagRecSupported=Supported(SQL_API_SQLGETDIAGREC);
  fDiagFieldSupported=Supported(SQL_API_SQLGETDIAGFIELD);

  AllocHstmt();

  if (!(cTypes=GetTypeInfo(rgFields,lpqt)))
    goto ErrorRet;

  guwRowCount=cTypes+1;   // Extra row inserted with DAE.

  // cTypes=20;                     //DEBUG

  /* build create statement */
  if (BuildCreateStmt(lpqt,rgFields,cTypes))
    goto ErrorRet;

  /* put together the insert statement, and set the parameters   */
  /* parameters are only set the first time through, after which */
  /* the contents of the pointers is changed                     */
  if (BuildInsertStmt(lpqt, rgFields,cTypes,lpd,&cColsSelected,fBindParameter))
    goto ErrorRet;

  CreateParamQuery(lpqt,rgFields,cTypes);

  for(i=1;i <= (sizeof(iTestNames)/sizeof(LPTSTR));i++)
  {
    lpqt->sz[0] = TEXT('\0');

    if(GETBIT(pTestSource->rglMask,i))
    {
      /* Display current Test */
      DisplayTestName(i);

      switch(i)
      {
        case 1:
          TestConnectionOptions();
          break;
        case 2:
          TestStmtOptions();
          break;
        case 3:
          TestCursorName(lpqt);
          break;
        case 4:
          TestData(lpqt,rgFields,cTypes,lpd);
          break;
        case 5:
          TestNumResCols(cColsSelected,lpqt);
          break;
        case 6:
          TestMetaData(lpSI,lpqt,rgFields,cTypes);
          break;
        case 7:
          TestSearchedQuery(lpqt,rgFields,cTypes,lpd,fBindParameter);
          break;
        case 8:
          TestLargeQuery(lpqt,rgFields,cTypes,lpd);
          break;
        case 9:
          TestSQLTables(lpqt);
          break;
        case 10:
          TestSQLStatistics(lpqt,rgFields,cTypes,lpd,fIndex);
          break;
        case 11:
          TestSQLSpecialCols(lpqt);
          break;
        case 12:
          TestLikeQuery(lpqt,rgFields,cTypes,lpd);
          break;
        case 13:
          TestSQLForeignKeys(lpqt);
          break;
        case 14:
          TestSQLBrowseConnect(lpSI);
          break;
        case 15:
          TestSQLDataSources();
          break;
        case 16:
          TestSQLDrivers();
          break;
        case 17:
          TestSQLMoreResults(lpqt);
          break;
        case 18:
          TestSQLNativeSQL(lpqt);
          break;
        case 19:
          TestSQLDescribeParam(lpqt);
          break;
        case 20:
          TestSQLNumParams(lpqt);
          break;
        case 21:
          TestSQLParamOptions(lpqt);
          break;
        case 22:
          TestSQLPrimaryKeys(lpqt);
          break;
        case 23:
          TestSQLProcedures();
          break;
        case 24:
          TestSQLTablePrivileges();
          break;
        case 25:
          TestSQLColumnPrivileges(lpqt);
          break;
        case 26:
          TestSQLSetScrollOptions();
          break;
        case 27:
          TestExtendedFetch(lpqt,rgFields,cTypes);
          break;
        case 28:
          TestOJCap(lpqt);
          break;
        case 29:
          TestSQLSetConnectAttr();
          break;
        case 30:
          TestSQLSetStmtAttr();
          break;
        case 31:
          TestThreading(lpSI,lpqt,rgFields);
          break;
        case 32:
          TestGetDescField(lpqt);
          break;
        case 33:
          TestSetDescField(lpqt);
          break;
        case 34:
          TestGetDescRec(lpqt);
          break;
        case 35:
          TestSetDescRec(lpqt);
          break;
        case 36:
          TestCopyDesc(lpqt);
          break;
        case 37:
          TestDescDefaults(lpqt);
          break;
        case 38:
          TestUseDesc(lpqt, rgFields);
          break;
        case 39:
          TestEnvAttr();
          break;
        case 40:
          TestEndTran(lpqt,rgFields,cTypes,lpd);
          break;
        case 41:
          TestBindParam(lpqt,rgFields,cTypes,lpd);
          break;
        case 42:
          TestQuickRebind(lpqt,rgFields,cTypes,lpd);
          break;
        case 43:
          TestFetchScroll(lpqt);
          break;
        case 44:
          TestDiagRec();
          break;
        case 45:
          TestDiagField();
          break;
        case 46:
          TestMixedAnsiUnicode(lpqt);
          break;

      } /* switch(i) */

    } /* if(GETBIT(pTestSource->rglMask,i)) */

  }

  //the end of test cases for ODBC SDK 3.0

  /* finished testing, clean up */
  CleanUp(lpd,lpqt,rgFields,lpqt->szTableName,FALSE,lpSI->szValidServer0);

  szWrite(szBLANKLINE,TRUE);

  lpSI->cErrors = lpSI->failed;

  return;

ErrorRet:
  /* a failure in an ODBC function that prevents completion of the        */
  /* test - for example, connect to the server                                                    */

  szWrite(TEXT("\t\t *** Unrecoverable Quick Test FAILURE ***"), TRUE);

  /* finished testing, clean up */
  CleanUp(lpd,lpqt,rgFields,lpqt->szTableName,FALSE,lpSI->szValidServer0);

  lpSI->cErrors = ABORT;

  return;
}

BOOL CALLBACK AutoTestName | ( | LPTSTR | szName,
 |  | UINT * | cbTestCases
 | ) |  |

Definition at line 7166 of file quiktest.c.

{
  static TCHAR szTestName[] = TEXT("Quick Test");

  _tcscpy(szName, szTestName);

  *cbTestCases = sizeof(iTestNames)/sizeof(LPTSTR);

  return TRUE;
}

BOOL PASCAL BindAllColumns | ( | QTSTRUCT * | lpqt,
 |  | FIELDINFO * | rgFields,
 |  | UWORD | cTypes,
 |  | DSTRUCT * | lpd
 | ) |  |

Definition at line 2849 of file quiktest.c.

{
//-----------------------------------------------------------------------
//      Function:               BindAllColumns
  UWORD           i,
        w;
  RETCODE rc=SQL_SUCCESS;

  for(i = 0, w = 0; i < cTypes; i++)
    {

    if(!qtMakeData(1, i,&rgFields[i],lpqt->szDataItem))
      continue;

    w++;

    switch(rgFields[i].wSQLType)
      {
      case SQL_INTEGER:
        rc = SQLBindCol(hstmt, w, SQL_C_DEFAULT,
              &lpd[i].sdword, IGNORED, &lpd[i].cb);
        break;
      case SQL_SMALLINT:
        rc = SQLBindCol(hstmt, w, SQL_C_DEFAULT,
              &lpd[i].sword, IGNORED, &lpd[i].cb);
        break;
      case SQL_FLOAT:
      case SQL_DOUBLE:
        rc = SQLBindCol(hstmt, w, SQL_C_DEFAULT,
              &lpd[i].sdouble, IGNORED, &lpd[i].cb);
        break;
      case SQL_REAL:
        rc = SQLBindCol(hstmt, w, SQL_C_DEFAULT,
              &lpd[i].sfloat, IGNORED, &lpd[i].cb);
        break;
      case SQL_DATE:
      case SQL_TYPE_DATE:
        rc = SQLBindCol(hstmt, w, SQL_C_DEFAULT,
              &lpd[i].date, IGNORED, &lpd[i].cb);
        break;
      case SQL_TIME:
      case SQL_TYPE_TIME:
        rc = SQLBindCol(hstmt, w, SQL_C_DEFAULT,
              &lpd[i].time, IGNORED, &lpd[i].cb);
        break;
      case SQL_TIMESTAMP:
      case SQL_TYPE_TIMESTAMP:
        rc = SQLBindCol(hstmt, w, SQL_C_DEFAULT,
              &lpd[i].timestamp, IGNORED, &lpd[i].cb);
        break;
      case SQL_CHAR:
      case SQL_WCHAR:
      case SQL_VARCHAR:
      case SQL_WVARCHAR:
      case SQL_LONGVARCHAR:
      case SQL_WLONGVARCHAR:
      case SQL_NUMERIC:
      case SQL_DECIMAL:
        rc = SQLBindCol(hstmt, w, SQL_C_TCHAR,
              lpd[i].data, MAX_STRING_SIZE*sizeof(SQLTCHAR), &lpd[i].cb);
        break;
      default:
        rc = SQLBindCol(hstmt, w, SQL_C_DEFAULT,
              lpd[i].data, MAX_STRING_SIZE, &lpd[i].cb);
        break;
      }

    if(!RETCHECK(SQL_SUCCESS, rc, szSQLBINDCOL))
      return(FALSE);
    }

  return(TRUE);

} //BindAllColumns()

BOOL PASCAL BindFetchColumns | ( | QTSTRUCT * | lpqt,
 |  | FIELDINFO * | rgFields,
 |  | UWORD | cTypes,
 |  | DSTRUCT * | lpdFetch
 | ) |  |

Definition at line 2931 of file quiktest.c.

{
  UWORD           i,
        w;
  RETCODE rc=SQL_SUCCESS;

  for(i = 0, w = 0; i < cTypes; i++)
    {

    if(!qtMakeData(0, i,&rgFields[i],lpqt->szDataItem))
      continue;

    w++;

    switch(rgFields[i].wSQLType)
      {
      case SQL_BIGINT:
      case SQL_INTEGER:
        rc = SQLBindCol(hstmt, w, SQL_C_DEFAULT,
              &lpdFetch[i].sdword, IGNORED, &lpdFetch[i].cb);
        break;
      case SQL_TINYINT:
      case SQL_SMALLINT:
        rc = SQLBindCol(hstmt, w, SQL_C_DEFAULT,
              &lpdFetch[i].sword, IGNORED, &lpdFetch[i].cb);
        break;
      case SQL_FLOAT:
      case SQL_DOUBLE:
        rc = SQLBindCol(hstmt, w, SQL_C_DEFAULT,
              &lpdFetch[i].sdouble, IGNORED, &lpdFetch[i].cb);
        break;
      case SQL_REAL:
        rc = SQLBindCol(hstmt, w, SQL_C_DEFAULT,
              &lpdFetch[i].sfloat, IGNORED, &lpdFetch[i].cb);
        break;
      case SQL_DATE:
      case SQL_TYPE_DATE:
        rc = SQLBindCol(hstmt, w, SQL_C_DEFAULT,
              &lpdFetch[i].date, IGNORED, &lpdFetch[i].cb);
        break;
      case SQL_TIME:
      case SQL_TYPE_TIME:
        rc = SQLBindCol(hstmt, w, SQL_C_DEFAULT,
              &lpdFetch[i].time, IGNORED, &lpdFetch[i].cb);
        break;
      case SQL_TIMESTAMP:
      case SQL_TYPE_TIMESTAMP:
        rc = SQLBindCol(hstmt, w, SQL_C_DEFAULT,
              &lpdFetch[i].timestamp, IGNORED, &lpdFetch[i].cb);
        break;
      case SQL_BIT:
      case SQL_BINARY:
      case SQL_VARBINARY:
      case SQL_LONGVARBINARY:
        rc = SQLBindCol(hstmt, w, SQL_C_TCHAR,
              lpdFetch[i].data, sizeof(lpdFetch[i].data), &lpdFetch[i].cb);
        break;
      case SQL_CHAR:
      case SQL_WCHAR:
      case SQL_VARCHAR:
      case SQL_WVARCHAR:
      case SQL_LONGVARCHAR:
      case SQL_WLONGVARCHAR:
      case SQL_NUMERIC:
      case SQL_DECIMAL:
      default:
        rc = SQLBindCol(hstmt, w, SQL_C_TCHAR,
              lpdFetch[i].data, sizeof(lpdFetch[i].data), &lpdFetch[i].cb);
        break;
      }

    if(!RETCHECK(SQL_SUCCESS, rc, szSQLBINDCOL))
      return(FALSE);
    }

  return(TRUE);

} /*BindFetchColumns() */

void PASCAL BinToHex | ( | PTR | rgbValue,
 |  | SWORD | cbValue,
 |  | LPTSTR | szHexString
 | ) |  |

Definition at line 363 of file quiktest.c.

{
  UWORD ib;
  LPTSTR pch;
  TCHAR rgchDigits[] = TEXT("0123456789ABCDEF");

  _tcscpy(szHexString, TEXT("0x"));
  if(cbValue > (MAX_STRING_SIZE - 3)/2 || cbValue < 0)
    cbValue = (MAX_STRING_SIZE - 3)/2;

  pch = &szHexString[_tcslen(szHexString)];
  for(ib=0; ib < cbValue; ib++)
    {
    *pch++ = rgchDigits[((LPBYTE)rgbValue)[ib] >> 4];
    *pch++ = rgchDigits[((LPBYTE)rgbValue)[ib] & 0xF];
    }
  *pch = TEXT('\0');

} /* BinToHex() */

BOOL PASCAL BuildCreateStmt | ( | QTSTRUCT * | lpqt,
 |  | FIELDINFO * | rgFields,
 |  | UWORD | cTypes
 | ) |  |

Definition at line 2391 of file quiktest.c.

{
  RETCODE         rc=SQL_SUCCESS;
  TCHAR        szNum[MAX_NUM_BUFFER];   /* used with _ttoi and itoa conversions */
  SWORD       wNum;
  UWORD       i;
  SDWORD      sdw;
  LPTSTR       pch=NULL;

  /* the column names will be ctypname (where typename is the
    type name returned by the source in SQLGetTypeInfo) */

  *lpqt->sz = TEXT('\0');
  _tcscpy(lpqt->sz,TEXT("Create Table "));
  _tcscat(lpqt->sz, lpqt->szTableName);
  _tcscat(lpqt->sz,TEXT(" ("));
  for(i = 0; i < cTypes; i++) {
      TCHAR szParamType[50];
      TCHAR szNotNull[10];
      *lpqt->szParam = TEXT('\0');

    /* if SQLGetTypeInfo returned params they need to be used in
      the create statement */

    if(rgFields[i].szParams == NULL || _tcslen(rgFields[i].szParams) == 0)
      *lpqt->szParam = TEXT('\0');
    else if(_tcschr(rgFields[i].szParams, TEXT(',')) == NULL)
      wsprintf(lpqt->szParam,TEXT("(%s)"), rgFields[i].szLength);
    else
      {
      _tcscpy(szNum, rgFields[i].szLength);
      wsprintf(lpqt->szParam,TEXT("(%s, %d)"), rgFields[i].szLength,
        _ttoi(szNum) - SCALEDIFF);
      }

    _tcscpy(szParamType, rgFields[i].szType);
    if(pch = _tcschr((LPTSTR)szParamType, TEXT('(')))
      {
      *pch = TEXT('\0');
      _tcscat(szParamType, lpqt->szParam);
      _tcscat(szParamType, (LPTSTR)_tcschr(rgFields[i].szType, TEXT(')')) + 1);
      }
    else
      {
      _tcscat(szParamType, lpqt->szParam);
      }

    /* If the field is not nullable, we need to create the table that way */
    rc = SQLGetInfo(hdbc, SQL_NON_NULLABLE_COLUMNS, &wNum,
      sizeof (SWORD), NULL);
    if(rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO)
      RETCHECK(SQL_SUCCESS, rc,szSQLGETINFO);

    if((rgFields[i].nullable == SQL_NO_NULLS) && (wNum != SQL_NNC_NULL))
      _tcscpy(szNotNull,TEXT("NOT NULL"));
    else
      szNotNull[0] = TEXT('\0');

    wsprintf(&lpqt->sz[_tcslen(lpqt->sz)],TEXT(" %s %s %s ,"),
      rgFields[i].szFieldName, (LPTSTR)szParamType, (LPTSTR)szNotNull);
  }

  /* remove the last comma and space */
  lpqt->sz[_tcslen(lpqt->sz) - 2] = TEXT('\0');
  _tcscat(lpqt->sz,TEXT(")"));

  rc = SQLExecDirect(hstmt, lpqt->sz, SQL_NTS);
  if(rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO)
    if(!RETCHECK(SQL_SUCCESS, rc,szSQLEXECDIRECT))
      goto BuildErrorRet;

  /* now that table was created, call SQLColumns.  Both as
    a test and to get necessary information to insert data */

  rc = SQLColumns(hstmt, NULL, SQL_NTS, NULL, SQL_NTS,
    lpqt->szTableName, SQL_NTS, NULL, SQL_NTS);
  RETCHECK(SQL_SUCCESS, rc,szSQLCOLUMNS);

  for(i = 0; i < cTypes; i++) {
    rc = SQLFetch(hstmt);
    RETCHECK(SQL_SUCCESS, rc,szSQLFETCH);

    /* precision */
    rc = SQLGetData(hstmt, 7, SQL_C_LONG, &rgFields[i].precision, IGNORED,
      &sdw);
    RETCHECK(SQL_SUCCESS, rc,szSQLGETDATA);

    /* length */
    if((rgFields[i].precision == 0) || (sdw == SQL_NO_TOTAL)){
      rc = SQLGetData(hstmt, 8, SQL_C_LONG, &rgFields[i].precision, IGNORED,
        &sdw);
      RETCHECK(SQL_SUCCESS, rc,szSQLGETDATA);
      if(sdw == SQL_NO_TOTAL)         /* precision & length were undetermined */
        rgFields[i].precision = 1000;   /* so set it to an arbitary value */
    }

    /* numeric scale */
    rc = SQLGetData(hstmt, 9, SQL_C_SHORT, &rgFields[i].scale, IGNORED,
      &sdw);
    RETCHECK(SQL_SUCCESS, rc,szSQLGETDATA);
    if(sdw == SQL_NO_TOTAL)
      rgFields[i].scale = 0;
  }

  rc = SQLFreeStmt(hstmt, SQL_CLOSE);
  RETCHECK(SQL_SUCCESS, rc,szSQLFREESTMT);

  /* look for columns the test should not try to update by running
    a select * query and calling ColAttributes on the result fields */
  /* select * does not return the fields in a defined order, so field order
    must be specified */

  _tcscpy(lpqt->sz,TEXT("select "));
  for(i = 0; i < cTypes; i ++) {
    if(i)
      _tcscat(lpqt->sz,TEXT(","));
    _tcscat(lpqt->sz, rgFields[i].szFieldName);
  }

  _tcscat(lpqt->sz,TEXT(" from "));
  _tcscat(lpqt->sz, lpqt->szTableName);

  rc = SQLExecDirect(hstmt, lpqt->sz, SQL_NTS);
  RETCHECK(SQL_SUCCESS, rc,szSQLEXECDIRECT);

  for(i = 1; i <= cTypes; i++) {

    rc = SQLColAttributes(hstmt, i, SQL_COLUMN_UPDATABLE, NULL,
      0, NULL, &sdw);
    RETCHECK(SQL_SUCCESS, rc,szSQLCOLATTRIBUTES);

    rgFields[i - 1].fAutoUpdate = sdw == SQL_ATTR_READONLY;

    rc = SQLColAttributes(hstmt, i, SQL_COLUMN_UNSIGNED, NULL,
      0, NULL, &sdw);
    RETCHECK(SQL_SUCCESS, rc,szSQLCOLATTRIBUTES);

    rgFields[i - 1].fUnsigned = sdw;
  }

  rc = SQLFreeStmt(hstmt, SQL_CLOSE);
  RETCHECK(SQL_SUCCESS, rc,szSQLFREESTMT);

  return(FALSE);

BuildErrorRet:

  return(TRUE);

} //BuildCreateStmt()

BOOL PASCAL BuildInsertStmt | ( | QTSTRUCT * | lpqt,
 |  | FIELDINFO * | rgFields,
 |  | UWORD | cTypes,
 |  | DSTRUCT * | lpd,
 |  | SDWORD * | cColsSelected,
 |  | BOOL | fBindParameter
 | ) |  |

Definition at line 2549 of file quiktest.c.

{
  RETCODE         rc;
  UWORD           w;
  UWORD           i;
  PTR                     ptr;
  UWORD           ind;
  SDWORD          sdw;
  LPTSTR          pch=NULL;
  BOOL                    fColNames=TRUE,
          fLongData=FALSE;
  SDWORD                  *sdwArray = (SDWORD  *)AllocateMemory(sizeof(SDWORD) * MAX_TYPES_SUPPORTED);

  _tcscpy(lpqt->szColNames,TEXT("\0"));
  _tcscpy(lpqt->szValues,TEXT("\0"));

  for(i = 0; i < cTypes; i++) {

    for(ind = 0, w = 0; ind < cTypes; ind++) {

      pch = qtMakeData(i, ind,&rgFields[ind], lpqt->szDataItem);

      if(!pch) /* current type is READ_ONLY) */
        continue;

      /* for every nullable type, that field will be set to    */
      /* null when the row number corresponds with the field */
      /* number */

      if(*pch)
        {
        _tcscpy(lpd[w].data, pch);
        lpd[w].cb = SQL_NTS;
        }
      else
        {
        _tcscpy(lpd[w].data,TEXT(""));
        lpd[w].cb = SQL_NULL_DATA;
        }

      if(fColNames)
        {
        /* the first time throught, the insert */
        /* statement itself is created         */
        _tcscat(lpqt->szColNames, rgFields[ind].szFieldName);
        _tcscat(lpqt->szColNames,TEXT(", "));
        _tcscat(lpqt->szValues,TEXT(" ?, "));

        /* and parameters are set                                                                               */
        /* set all the parameters using pointers to buffers in*/
        /* the param struct.                                                                                    */
        if(!fBindParameter)
          {
          rc = SQLSetParam(hstmt, (UWORD)(w+1),
            SQL_C_TCHAR, rgFields[ind].wSQLType,
            rgFields[ind].precision, rgFields[ind].scale,
            &lpd[w].data,
            &lpd[w].cb);
          RETCHECK(SQL_SUCCESS, rc,szSQLSETPARAM);
          }
        else
          {
          rc = SQLBindParameter(hstmt, (UWORD)(w+1),
            SQL_PARAM_INPUT,
            SQL_C_TCHAR, rgFields[ind].wSQLType,
            rgFields[ind].precision, rgFields[ind].scale,
            &lpd[w].data, MAX_STRING_SIZE,
            &lpd[w].cb);
          RETCHECK(SQL_SUCCESS, rc,szSQLBINDPARAMETER);
          }
      }
      w++;
      cNumResSetCols=w;
    }

    if(fColNames)
      {
      /* the first time through, the insert                   */
      /* statement needs to be SQLPrepare'd                   */
      /* remove the "," at the end of the string      */
      lpqt->szColNames[_tcslen(lpqt->szColNames) - 2] = TEXT('\0');
      lpqt->szValues[_tcslen(lpqt->szValues) - 2] = TEXT('\0');

      wsprintf(lpqt->sz,TEXT("insert into %s (%s) VALUES(%s)"),
        lpqt->szTableName, lpqt->szColNames, lpqt->szValues);

      //copy the insert statement, with the column names.
      //_ASSERTE(_tcslen(lpqt->sz) < MAX_STRING_SIZE);
      _tcscpy(szInsertStmt,lpqt->sz);

      //prepare the statement
      rc = SQLPrepare(hstmt, lpqt->sz, SQL_NTS);
      if(!RETCHECK(SQL_SUCCESS, rc,szSQLPREPARE))
        goto InsertErrorRet;

      fColNames = FALSE; /* no more first times through */
      }

    rc = SQLExecute(hstmt); /* insert a row */

    if(!RETCHECK(SQL_SUCCESS, rc,szSQLEXECUTE))
    {
      if (SQL_SUCCESS_WITH_INFO != rc)                // BANDAID, normally would fail on S.W.I
        goto InsertErrorRet;
    }

    rc = SQLRowCount(hstmt, &sdw);
    RETCHECK(SQL_SUCCESS, rc,szSQLROWCOUNT);

    if(sdw != 1) /* the execute inserted 1 row */
      DISPLAYERROR(szSQLROWCOUNT,TEXT("Insert single row"));

    /* FreeStmt SQL_CLOSE */
    rc = SQLFreeStmt(hstmt, SQL_CLOSE);
    RETCHECK(SQL_SUCCESS, rc,szSQLFREESTMT);
  }

  /* for the last row use SQLParamData and SQLPutData */

  /* First check to see if the SQL_LEN_DATA_AT_EXEC macro is supported */
  rc = SQLGetInfo(hdbc, SQL_NEED_LONG_DATA_LEN,
    lpqt->buf, (SWORD)sizeof(lpqt->buf), NULL);
  if(rc == SQL_SUCCESS)
    if(lpqt->buf[0] == TEXT('Y'))
      fLongData = TRUE;

  for(ind = 0, w = 0; ind < cTypes; ind++)
    {

    /* set all the params */

    if(rgFields[ind].fAutoUpdate)
      continue;

    if(fLongData && ((rgFields[ind].wSQLType == SQL_LONGVARBINARY) ||
      (rgFields[ind].wSQLType == SQL_LONGVARCHAR))){
      /* Make sure we don't exceed the max negative SDWORD value */
      if(rgFields[ind].precision > (MAXSDWORD + SQL_LEN_DATA_AT_EXEC_OFFSET))
        sdwArray[ind] = MINSDWORD - SQL_LEN_DATA_AT_EXEC_OFFSET;
      else
        sdwArray[ind] = SQL_LEN_DATA_AT_EXEC(rgFields[ind].precision);
      }
    else
      sdwArray[ind] = SQL_DATA_AT_EXEC;

    w++;
    if(!fBindParameter){
      rc = SQLSetParam(hstmt, w,
        SQL_C_TCHAR, rgFields[ind].wSQLType,
        rgFields[ind].precision, rgFields[ind].scale,
        (LPTSTR)(UDWORD)ind, &sdwArray[ind]);
      RETCHECK(SQL_SUCCESS, rc,szSQLSETPARAM);
      }
    else{
      rc = SQLBindParameter(hstmt, w, SQL_PARAM_INPUT,
        SQL_C_TCHAR, rgFields[ind].wSQLType,
        rgFields[ind].precision, rgFields[ind].scale,
        (LPTSTR)(((UDWORD)ind)+BIND_PARM_OFFSET), 0, &sdwArray[ind]);
      RETCHECK(SQL_SUCCESS, rc,szSQLBINDPARAMETER);
      }
  }

  *cColsSelected = w;

  rc = SQLExecDirect(hstmt, lpqt->sz, SQL_NTS);
  if (!RETCHECK(SQL_NEED_DATA, rc,szSQLEXECDIRECT))
    goto InsertErrorRet;

  for(ind = 0; ind <= cTypes; ind++)
    {
    rc = SQLParamData(hstmt, &ptr);
    if(rc != SQL_NEED_DATA)
      break;

    pch = qtMakeData(cTypes, ind, &rgFields[(unsigned long)ptr-BIND_PARM_OFFSET],
      lpqt->szDataItem);

    if(*pch) {
      rc = SQLPutData(hstmt, pch, SQL_NTS);
      RETCHECK(SQL_SUCCESS, rc,szSQLPUTDATA);
    } else {
      rc = SQLPutData(hstmt, (LPTSTR)IGNORED, SQL_NULL_DATA);
      RETCHECK(SQL_SUCCESS, rc,szSQLPUTDATA);
    }
  }

  RETCHECK(SQL_SUCCESS, rc,szSQLPARAMDATA);

  rc = SQLRowCount(hstmt, &sdw);
  RETCHECK(SQL_SUCCESS, rc,szSQLROWCOUNT);

  if(sdw != 1)
    DISPLAYERROR(szSQLROWCOUNT,TEXT("Insert single row"));

  rc = SQLFreeStmt(hstmt, SQL_RESET_PARAMS);
  RETCHECK(SQL_SUCCESS, rc,szSQLFREESTMT);

  ReleaseMemory(sdwArray);

  return(FALSE);

InsertErrorRet:

  SQLFreeStmt(hstmt, SQL_RESET_PARAMS);

  ReleaseMemory(sdwArray);

  return(TRUE);

} //BuildInsertStmt()

BOOL PASCAL CanAllocHdesc ( )

Definition at line 1310 of file quiktest.c.

{
  BOOL fSupported=FALSE;

  /* Allocate an hdesc: */
  if(Supported(SQL_API_SQLALLOCHANDLE))
    fSupported = RC_SUCCESSFUL(SQLAllocHandle(SQL_HANDLE_DESC, hdbc, &hdesc));

  return(fSupported);

}

UWORD PASCAL CheckConformanceLevel ( )

Definition at line 1233 of file quiktest.c.

{
  RETCODE         rc=SQL_SUCCESS;
  UWORD           fIndex=0;
  SWORD           cb=0;

  rc = SQLGetInfo(hdbc, SQL_ODBC_SQL_CONFORMANCE, &fIndex,
    sizeof (fIndex), &cb);
  RETCHECK(SQL_SUCCESS, rc,szSQLGETINFO);

  if(fIndex != 0 && fIndex != 1 && fIndex != 2) {
    /* one of these two values should always be returned */
    DISPLAYERROR(szSQLGETINFO,TEXT("SQL_ODBC_API_CONFORMANCE - invalid value"));
  }

  return(fIndex);

} //CheckConformanceLevel()

VOID PASCAL CheckData | ( | SWORD | fHandleType,
 |  | UWORD | uwDescField,
 |  | PTR | rgbValue,
 |  | LPTSTR | szDataSourceName
 | ) |  |

Definition at line 1352 of file quiktest.c.

{
  TCHAR                   szBuff[MEDBUFF]=TEXT("");
  LPTSTR          pszExpState=szHY009;

  if (fHandleType == SQL_HANDLE_DESC)
    pszExpState=szHY091;

  switch(uwDescField)
  {
    case SQL_DIAG_RETURNCODE:
      {
        RETCODE rcRec=*(RETCODE *)rgbValue;

        if (rcRec!= SQL_ERROR)
        {
          wsprintf(szBuff,TEXT("\t\t\tSQL_DIAG_RETURN_CODE\tReceived: %d\tExpected: %d"),rcRec,-1);
        }
      }
      break;

    case SQL_DIAG_SQLSTATE:
      {
        if (_tcscmp((LPTSTR)rgbValue,pszExpState))
        {
          wsprintf(szBuff,TEXT("\t\t\tSQL_DIAG_SQLSTATE\tReceived: %s\tExpected: %s"),(LPTSTR)rgbValue,pszExpState);
        }
      }
      break;
    case SQL_DIAG_CLASS_ORIGIN:
      {
        if (_tcscmp((LPTSTR)rgbValue,szISO))
          wsprintf(szBuff,TEXT("\t\t\tSQL_DIAG_CLASS_ORIGIN\tReceived: %s\tExpected: %s"),(LPTSTR)rgbValue,szISO);
      }
      break;
    case SQL_DIAG_SUBCLASS_ORIGIN:
      {
        if (_tcscmp((LPTSTR)rgbValue,szISO))
          wsprintf(szBuff,TEXT("\t\t\tSQL_DIAG_CLASS_ORIGIN\tReceived: %s\tExpected: %s"),(LPTSTR)rgbValue,szISO);
      }
      break;
    case SQL_DIAG_NUMBER:
      {
        SDWORD cRecs=*(SDWORD *)rgbValue;
        if (cRecs != 1)
          wsprintf(szBuff,TEXT("\t\t\tSQL_DIAG_NUMBER\tReceived: %d\tExpected: %d"),cRecs,1);
      }
      break;
    case SQL_DIAG_SERVER_NAME:
      {
        switch(fHandleType)
        {
        case SQL_HANDLE_DBC:
        case SQL_HANDLE_STMT:
          if (_tcscmp((LPTSTR)rgbValue,szDataSourceName))
            wsprintf(szBuff,TEXT("\t\t\tSQL_DIAG_SERVER_NAME\tReceived: %s\tExpected: %s"),(LPTSTR)rgbValue,szDataSourceName);
          break;
        }
      }
      break;
    default:
      break;

  }

  if (*szBuff)
    DISPLAYERROR(szSQLGETDIAGFIELD,szBuff);

} /* CheckData() */

BOOL CheckDataResults | ( | SWORD | row,
 |  | SWORD | iTableCol,
 |  | FIELDINFO * | pField,
 |  | DSTRUCT * | pDataStr,
 |  | SDWORD | cbValue,
 |  | TCHAR * | rgbValue
 | ) |  |

Definition at line 344 of file quiktest.c.

{
  if((pField ->nullable)&& (cbValue<1))
  {
    if(cbValue == SQL_NULL_DATA && pDataStr[iTableCol].cb == SQL_NULL_DATA)
      return TRUE;
    return FALSE;
  }

  return CmpODBCtoCHAR(pDataStr, rgbValue, pField->wSQLType, iTableCol);
}

void CheckDescOp | ( | SQLHDESC | hdesc,
 |  | SQLRETURN | rc,
 |  | SQLUSMALLINT | uwDescIndex,
 |  | SQLSMALLINT | swDescRecCount,
 |  | SQLSMALLINT | swDescRec,
 |  | SQLUSMALLINT | iDescField,
 |  | SQLINTEGER | swUpdateMode
 | ) |  |

Definition at line 5231 of file quiktest.c.

{
  TCHAR * pszAPI, szOp[10];
  SQLSMALLINT fValidOp;   // Descriptor types operation is valid for

  if (DESC_UPDATE_MODE_READ == swUpdateMode)
  {
    pszAPI=szSQLGETDESCFIELD;
    _tcscpy(szOp, TEXT("read"));
    fValidOp=rgDescInfo[iDescField].fGettable;
  }
  else
  {
    pszAPI=szSQLSETDESCFIELD;
    _tcscpy(szOp, TEXT("write"));
    fValidOp=rgDescInfo[iDescField].fSettable;
  }

  // If we're reading beyond the last record, expect SQL_NO_DATA.
  if (swDescRec > swDescRecCount && DESC_UPDATE_MODE_READ == swUpdateMode)
  {
    wsprintf(buf,TEXT("%s: Able to %s descriptor field %s in the %s beyond last record."),
        pszAPI, szOp, rgDescInfo[iDescField].szDescFieldName, DescTypes[uwDescIndex].szDescName);
    ERRSHANDLE(SQL_HANDLE_DESC, hdesc, SQL_NO_DATA, rc, buf);
  }
  else
  {
    if (fValidOp & DescTypes[uwDescIndex].uwTypeMask)
    {
      wsprintf(buf,TEXT("%s: Unable to %s descriptor field %s in the %s"),
          pszAPI, szOp, rgDescInfo[iDescField].szDescFieldName, DescTypes[uwDescIndex].szDescName);
      ERRSHANDLE(SQL_HANDLE_DESC, hdesc, SQL_SUCCESS, rc, buf);
    }
    else
    {
      wsprintf(buf,TEXT("%s: Able to %s descriptor field %s in the %s"),
          pszAPI, szOp, rgDescInfo[iDescField].szDescFieldName, DescTypes[uwDescIndex].szDescName);
      ERRSHANDLE(SQL_HANDLE_DESC, hdesc, SQL_ERROR, rc, buf);
    }
  }
}

void CheckDescRecord | ( | SQLHDESC | hdesc,
 |  | SQLSMALLINT | swDescRec,
 |  | SQLSMALLINT | fType,
 |  | SQLSMALLINT | fSubType,
 |  | SQLINTEGER | cbLength,
 |  | SQLSMALLINT | ibPrecision,
 |  | SQLSMALLINT | ibScale,
 |  | SQLPOINTER | pData,
 |  | SQLINTEGER * | pcbValue,
 |  | SQLINTEGER * | pIndicator,
 |  | SQLUSMALLINT | iDescType
 | ) |  |

Definition at line 5500 of file quiktest.c.

{
  SQLINTEGER Length, * pIndicator2;
  PTR pDescPtr;
  SQLRETURN rc;
  SQLSMALLINT fType2, fSubType2, cbName, Precision, Scale, Nullable;
  TCHAR   szName[MAX_DESC_BUF]=TEXT("");

  // Write the record
  rc = SQLSetDescRec(hdesc, swDescRec, fType, fSubType, cbLength, ibPrecision,
    ibScale, pData, pcbValue, pIndicator);

  // Can't set IRD, so it should error
  if (SQL_ATTR_IMP_ROW_DESC == DescTypes[iDescType].uwDescType)
    ERRSHANDLE(SQL_HANDLE_DESC, hdesc, SQL_ERROR, rc, szSQLSETDESCREC);
  else
  {
    wsprintf(buf,TEXT("%s: Unable to write record %d in %s"),
      szSQLSETDESCREC, swDescRec, DescTypes[iDescType].szDescName);
    ERRSHANDLE(SQL_HANDLE_DESC, hdesc, SQL_SUCCESS, rc, buf);
  }

  if (RC_SUCCESSFUL(rc))
  {
    // Read it again
    rc = SQLGetDescRec(hdesc, swDescRec, szName, sizeof(szName)/sizeof(TCHAR),
      &cbName, &fType2, &fSubType2, &Length, &Precision, &Scale, &Nullable);

    wsprintf(buf,TEXT("%s: Unable to read record %d in %s"),
      szSQLGETDESCREC, swDescRec, DescTypes[iDescType].szDescName);
    ERRSHANDLE(SQL_HANDLE_DESC, hdesc, SQL_SUCCESS, rc, buf);

    if (RC_SUCCESSFUL(rc))
    {
      // Compare values
      if (fType2 != fType)
        DISPLAYERROR(szSQLSETDESCREC,TEXT("fType not set correctly"));

      if (Precision != ibPrecision)
        DISPLAYERROR(szSQLSETDESCREC,TEXT("ibPrecision not set correctly"));

      switch(fType)
      {
        case SQL_DECIMAL:
        case SQL_NUMERIC:
        case SQL_C_DOUBLE:
        case SQL_C_FLOAT:
          // Scale is only defined for NUMERIC or DECIMAL types
          if (Scale != ibScale)
            DISPLAYERROR(szSQLSETDESCREC,TEXT("ibScale not set correctly"));
          break;
        case SQL_DATETIME:
        case SQL_INTEGER:
          // Subtype is only valid for DATETIME or INTERVAL types
          if (fSubType2 != fSubType)
            DISPLAYERROR(szSQLSETDESCREC,TEXT("fSubType not set correctly"));
          break;
      }

      // For application descriptors, compare the Length and get the
      // data ptr value to check for accuracy
      switch(DescTypes[iDescType].uwDescType)
      {
        case SQL_ATTR_APP_ROW_DESC:
        case SQL_ATTR_APP_PARAM_DESC:

          if (Length != cbLength)
            DISPLAYERROR(szSQLSETDESCREC,TEXT("cbLength not set correctly"));

          rc = SQLGetDescField(hdesc, swDescRec, SQL_DESC_DATA_PTR,
            &pDescPtr, sizeof(PTR), &cbValue);
          ERRSHANDLE(SQL_HANDLE_DESC, hdesc, SQL_SUCCESS, rc, szSQLGETDESCFIELD);

          if (pDescPtr != pData)
            DISPLAYERROR(szSQLSETDESCREC,TEXT("rgbValue not set correctly"));

          // Get the octet length ptr value and check for accuracy
          rc = SQLGetDescField(hdesc, swDescRec, SQL_DESC_OCTET_LENGTH_PTR,
            &pDescPtr, sizeof(PTR), &cbValue);
          ERRSHANDLE(SQL_HANDLE_DESC, hdesc, SQL_SUCCESS, rc, szSQLGETDESCFIELD);

          if (pDescPtr != pcbValue)
            DISPLAYERROR(szSQLSETDESCREC,TEXT("cbValue not set correctly"));

          rc = SQLGetDescField(hdesc, swDescRec, SQL_DESC_INDICATOR_PTR,
            &pIndicator2, sizeof(PTR), &cbValue);
          ERRSHANDLE(SQL_HANDLE_DESC, hdesc, SQL_SUCCESS, rc, szSQLGETDESCFIELD);

          if (pIndicator2 != pIndicator)
            DISPLAYERROR(szSQLSETDESCREC,TEXT("Indicator not set correctly"));

          break;
        case SQL_ATTR_IMP_ROW_DESC:
        case SQL_ATTR_IMP_PARAM_DESC:
          break;
        default:
          DISPLAYERROR(szSQLSETDESCREC,TEXT("Unknown descriptor type."));
      }
    }
  }

}

void CheckDescriptor | ( | SQLHDESC | hdesc,
 |  | SQLINTEGER | swUpdateMode,
 |  | SQLHSTMT | hstmt,
 |  | UWORD | uwDescIndex
 | ) |  |

Definition at line 5369 of file quiktest.c.

{
  SQLINTEGER cbValue2;
  SQLSMALLINT swDescRec=0, swDescRecCount, swAdditionalRecs=0;
  SQLUSMALLINT iDescField, iStartField=0;
  SQLRETURN rc;

  // Get the descriptor record count.
  rc = SQLGetDescField(hdesc, 0, SQL_DESC_COUNT, &swDescRecCount,
    sizeof(swDescRecCount), &cbValue);

  if (SQL_SUCCESS == rc) {

    // In read mode, try to read one past last record
    if (swUpdateMode == DESC_UPDATE_MODE_READ)
      swAdditionalRecs=1;

    // Check all records, including header
    for (swDescRec=0; swDescRec <= swDescRecCount+swAdditionalRecs; swDescRec++) {

      // Check all fields
      for (iDescField=iStartField; iDescField < sizeof(rgDescInfo)/sizeof(rgDescInfo[0]); iDescField++) {

        // If we've gone past the header fields, then break out of loop to check record fields
        if (0 == swDescRec && !rgDescInfo[iDescField].fHeader) {
          iStartField=iDescField;
          break;
        }

        if (DESC_UPDATE_MODE_READ == swUpdateMode)
        {
          // Read from the field
          rc = SQLGetDescField(hdesc, swDescRec, rgDescInfo[iDescField].uwDescField,
            &DescBuf, sizeof(DescBuf), &cbValue);

          CheckDescOp(hdesc, rc, uwDescIndex, swDescRecCount, swDescRec, iDescField, swUpdateMode);

          if (RC_SUCCESSFUL(rc))
          {
            // Compare cbValue with expected
            cbValue2=rgDescInfo[iDescField].cbValue; // For most fields

            if (!rgDescInfo[iDescField].size)
              cbValue2 = _tcslen((LPTSTR)DescBuf) * sizeof(SQLTCHAR);  // For string fields

            // Make sure cbValue and cbValue2 agree
            if (cbValue != cbValue2)
            {
              wsprintf(buf,TEXT("Compare error in %s field %s, expected")\
                TEXT(" StringLength %d, received %d"), DescTypes[uwDescIndex].szDescName,
                rgDescInfo[iDescField].szDescFieldName, cbValue2, cbValue);
              DISPLAYERROR(szSQLGETDESCFIELD, buf);
            }
          }
        }
        else
        {
          // Write to the field.  For char fields size is 0 (unknown),
          // so compute the length of the string
          rc = SQLSetDescField(hdesc, swDescRec, rgDescInfo[iDescField].uwDescField,
            (SQLPOINTER)rgDescInfo[iDescField].NewValue,
            (rgDescInfo[iDescField].size) ? rgDescInfo[iDescField].size :
            _tcslen((LPTSTR)rgDescInfo[iDescField].NewValue)*sizeof(TCHAR));

          CheckDescOp(hdesc, rc, uwDescIndex, swDescRecCount, swDescRec, iDescField, swUpdateMode);

          if (RC_SUCCESSFUL(rc))
            CompareDescField(hdesc, NULL, uwDescIndex, swDescRec, swDescRecCount,iDescField, szSQLSETDESCFIELD);
        }
      }
    }
  }
  else {
    // Unable to read record count from descriptor header, can't proceed
    wsprintf(buf,TEXT("\t\tUnable to read record count from descriptor header."));
    ERRSHANDLE(SQL_HANDLE_DESC, hdesc, SQL_SUCCESS, rc, buf);
  }
}

void PASCAL CleanUp | ( | DSTRUCT * | lpd,
 |  | QTSTRUCT * | lpqt,
 |  | FIELDINFO * | rgFields,
 |  | LPTSTR | szTableName,
 |  | BOOL | fSilent,
 |  | LPTSTR | szValidServer
 | ) |  |

Definition at line 2829 of file quiktest.c.

{

  DropTable(szTableName, fSilent);

  if(szValidServer)
    FullDisconnect();

  ReleaseMemory(lpd);
  ReleaseMemory(lpqt);
  ReleaseMemory(rgFields);

} //CleanUp()

VOID PASCAL ClearErrorQueue ( )

Definition at line 1062 of file quiktest.c.

{
  TCHAR szErrMsg[MAX_STRING_SIZE];
  TCHAR szState[6];

  /* Eat up the SQL_SUCCESS_WITH_INFO error record */
  while (RC_SUCCESSFUL(SQLError(NULL, hdbc,NULL, szState, NULL,
    szErrMsg, sizeof(szErrMsg)/sizeof(TCHAR), NULL)))
      ;
}

BOOL CompareAnsiToUnicode | ( | SQLCHAR * | aszBuf,
 |  | SQLINTEGER | cbA,
 |  | SQLWCHAR * | wszBuf,
 |  | SQLINTEGER | cbW,
 |  | SQLTCHAR * | szAPI
 | ) |  |

Definition at line 1641 of file quiktest.c.

{
  SQLWCHAR wszConvBuf[MAX_STRING_SIZE];
  SQLTCHAR tszAval[MAX_STRING_SIZE], tszWval[MAX_STRING_SIZE];
  SQLINTEGER cbT;
  BOOL bCompare=TRUE;

  // Check ANSI count of bytes returned
  if ((cbA != SQL_NULL_DATA) && (SQLINTEGER)strlen(aszBuf) != cbA)
  {
    wsprintf(buf, TEXT("ANSI count of bytes returned incorrect.")\
      TEXT(" Expected: %d, received: %d"),
      strlen(aszBuf), cbA);
    DISPLAYERROR(szAPI, buf);
    bCompare=FALSE;
  }

  // Compare ANSI count of bytes with Unicode count
  cbT = (cbA > 0) ? (SQLINTEGER)(cbA * sizeof(SQLWCHAR)) : cbA;
  if (cbW != cbT)
  {
    wsprintf(buf, TEXT("Unicode count of bytes returned incorrect.")\
      TEXT(" Expected: %d, received: %d"), cbT, cbW);
    DISPLAYERROR(szAPI, buf);
    bCompare=FALSE;
  }

  // Compare strings if not NULL DATA
  if (cbA != SQL_NULL_DATA)
  {
    // Compare ANSI and Unicode strings returned
    (void)(MultiByteToWideChar(CP_ACP, 0, aszBuf, strlen(aszBuf), wszConvBuf,
      MAX_STRING_SIZE));
    wszConvBuf[strlen(aszBuf)]=L'\0';

    if (wcscmp(wszConvBuf, wszBuf))
    {

#ifdef UNICODE
      wcscpy(tszAval,wszConvBuf);
      wcscpy(tszWval,wszBuf);
#else
      WideCharToMultiByte(CP_ACP, 0, wszConvBuf, wcslen(wszConvBuf), tszAval,
        MAX_STRING_SIZE, NULL, NULL);
      tszAval[wcslen(wszConvBuf)] = '\0';

      WideCharToMultiByte(CP_ACP, 0, wszBuf, wcslen(wszBuf), tszWval,
        MAX_STRING_SIZE, NULL, NULL);
      tszAval[wcslen(wszBuf)] = '\0';

#endif

      _stprintf(buf, TEXT("Unicode string did not match ANSI string.\r\n")\
        TEXT("\t\t\tUnicode: '%s', ANSI: '%s'"), tszWval, tszAval);
      DISPLAYERROR(szAPI, buf);
      bCompare=FALSE;
    }
  }

  return bCompare;
}

void CompareAnsiUnicodeResults | ( | SQLHSTMT | hstmtA,
 |  | SQLHSTMT | hstmtW,
 |  | SQLTCHAR * | szAPI
 | ) |  |

Definition at line 1708 of file quiktest.c.

{
  SQLCHAR aszBuf[MAX_STRING_SIZE];
  SQLWCHAR wszBuf[MAX_STRING_SIZE];
  SQLINTEGER cbANSI, cbUnicode;
  SQLUSMALLINT    uwCol;
  SQLSMALLINT             swColCountA, swColCountW;
  SQLRETURN rc, rcA, rcW;

  // Check width of result sets
  rc=SQLNumResultCols(hstmtA, &swColCountA);
  ERRSHANDLE(SQL_HANDLE_STMT, hstmtA, SQL_SUCCESS, rc, szSQLNUMRESULTCOLS);
  rc=SQLNumResultCols(hstmtW, &swColCountW);
  ERRSHANDLE(SQL_HANDLE_STMT, hstmtW, SQL_SUCCESS, rc, szSQLNUMRESULTCOLS);
  if (swColCountA != swColCountW)
    DISPLAYERROR(szAPI,TEXT("ANSI and Unicode result sets different widths."));

  uwCol=1;
  do {
    rc=SQLBindCol(hstmtA, uwCol, SQL_C_CHAR, aszBuf, sizeof(aszBuf), &cbANSI);
    ERRSHANDLE(SQL_HANDLE_STMT, hstmtA, SQL_SUCCESS, rc, szSQLBINDCOL);
    rc=SQLBindCol(hstmtW, uwCol, SQL_C_WCHAR, wszBuf, sizeof(wszBuf), &cbUnicode);
    ERRSHANDLE(SQL_HANDLE_STMT, hstmtW, SQL_SUCCESS, rc, szSQLBINDCOL);

    // Copy something into the buffers so we can tell if they were modified
    strcpy(aszBuf, "Untouched");
    wcscpy(wszBuf, L"Untouched");

    // Fetch into the buffers
    rcA=SQLFetch(hstmtA);
    rcW=SQLFetch(hstmtW);

    if (RC_SUCCESSFUL(rcA) && RC_SUCCESSFUL(rcW))
    {
      if (!CompareAnsiToUnicode(aszBuf, cbANSI, wszBuf, cbUnicode, szSQLFETCH))
      {
        rcW=SQL_NO_DATA;        // Abort the loop w/o generating failure
        rcA=SQL_NO_DATA;
      }
    }

    // Unbind the column bound above on each statement
    rc=SQLFreeStmt(hstmtA, SQL_UNBIND);
    ERRSHANDLE(SQL_HANDLE_STMT, hstmtA, SQL_SUCCESS, rc, szSQLFREESTMT);
    rc=SQLFreeStmt(hstmtW, SQL_UNBIND);
    ERRSHANDLE(SQL_HANDLE_STMT, hstmtW, SQL_SUCCESS, rc, szSQLFREESTMT);

    // Don't exceed the total number of columns in result set
    uwCol++;
    if (uwCol > (SQLUSMALLINT)swColCountA)
      uwCol=1;
  }
  while (RC_SUCCESSFUL(rcA) && RC_SUCCESSFUL(rcW));

  // Make sure the result sets were the same size
  if (rcW != SQL_NO_DATA)
    ERRSHANDLE(SQL_HANDLE_STMT, hstmtW, SQL_NO_DATA, rc, szSQLFETCH);

  // Make sure the result sets were the same size
  if (rcA != rcW)
    DISPLAYERROR(szAPI,TEXT("ANSI and Unicode result sets not the same length."));

  rc=SQLFreeStmt(hstmtA, SQL_CLOSE);
  ERRSHANDLE(SQL_HANDLE_STMT, hstmtA, SQL_SUCCESS, rc, szSQLFREESTMT);
  rc=SQLFreeStmt(hstmtW, SQL_CLOSE);
  ERRSHANDLE(SQL_HANDLE_STMT, hstmtW, SQL_SUCCESS, rc, szSQLFREESTMT);

}

void CompareDescField | ( | SQLHDESC | hdesc1,
 |  | SQLHDESC | hdesc2,
 |  | SQLUSMALLINT | uwDescIndex,
 |  | SQLSMALLINT | swDescRec,
 |  | SQLSMALLINT | swDescRecCount,
 |  | SQLUSMALLINT | uwDescField,
 |  | TCHAR * | pszAPI
 | ) |  |

Definition at line 5283 of file quiktest.c.

{
  SQLRETURN rc;
  SQLTCHAR DescBuf2[MAX_DESC_BUF];
  SQLINTEGER cbValue2;

  // Make sure we've got a valid descriptor handle for hdesc1
  // (hdesc2 is allowed to be NULL)
  if (SQL_NULL_HDESC == hdesc1) {
    wsprintf(buf,TEXT("\t\tCompareDescriptor: hdesc1 handle was null!"));
    DISPLAYERROR(pszAPI, buf);
    return;
  }

  // Read the value from hdesc1
  rc = SQLGetDescField(hdesc1, swDescRec, rgDescInfo[uwDescField].uwDescField,
    &DescBuf, sizeof(DescBuf), &cbValue);

  CheckDescOp(hdesc1, rc, uwDescIndex, swDescRecCount, swDescRec, uwDescField, DESC_UPDATE_MODE_READ);

  cbValue2=rgDescInfo[uwDescField].cbValue;

  // Get the value to compare to
  if (SQL_NULL_HDESC == hdesc2) {

    // Compare to rgDescInfo if it's settable
    if (rgDescInfo[uwDescField].fSettable & DescTypes[uwDescIndex].uwTypeMask) {

      // Copy the set value into DescBuf2.  For char fields size is 0
      // (unknown), and the new value is actually the pointer to the start
      // of the string.
      SQLPOINTER pNewvalue = &(rgDescInfo[uwDescField].NewValue);

      if (!rgDescInfo[uwDescField].size)
      {
        pNewvalue = (SQLPOINTER)rgDescInfo[uwDescField].NewValue;
        cbValue2        = (_tcslen(pNewvalue)+1) * sizeof(TCHAR);
      }

      memcpy(&DescBuf2, pNewvalue, cbValue2);
    }
  }
  else {

    // Compare to hdesc2
    rc = SQLGetDescField(hdesc2, swDescRec, rgDescInfo[uwDescField].uwDescField,
      &DescBuf2, sizeof(DescBuf2), &cbValue);

    // Since hdesc2 is an unassociated hdesc, treat it as an ARD
    // (uwDescIndex=0)
    CheckDescOp(hdesc2, rc, 0, swDescRecCount, swDescRec, uwDescField, DESC_UPDATE_MODE_READ);
  }

  // Perform the compare if settable in source desc and settable in
  // target desc (application descriptors) when using hdesc2
  if (rgDescInfo[uwDescField].fSettable & DescTypes[uwDescIndex].uwTypeMask)
  {
    if (!hdesc2 || (rgDescInfo[uwDescField].fSettable & DESC_ARD))
    {
      // IPD field SQL_DESC_TYPE is settable for consitency check, but set
      // value can't be retrieved, so skip compare in this case
      if (SQL_ATTR_IMP_PARAM_DESC != DescTypes[uwDescIndex].uwDescType ||
        SQL_DESC_DATA_PTR != rgDescInfo[uwDescField].uwDescField)
      {
        if (memcmp(DescBuf, DescBuf2, cbValue2)) {
          // Compare error, print message
          wsprintf(buf,TEXT("Compare error in %s field %s"),
            DescTypes[uwDescIndex].szDescName,rgDescInfo[uwDescField].szDescFieldName);
          DISPLAYERROR(pszAPI, buf);
        }
      }
    }
  }
}

void CompareDescriptor | ( | SQLHDESC | hdesc1,
 |  | SQLHDESC | hdesc2,
 |  | UWORD | uwDescIndex,
 |  | TCHAR * | pszAPI
 | ) |  |

Definition at line 5456 of file quiktest.c.

{
  SQLSMALLINT swDescRec, swDescRecCount;
  SQLUSMALLINT iDescField, iStartField=0;
  SQLRETURN rc;

  // Make sure we've got a valid descriptor handle for hdesc1
  // (hdesc2 is allowed to be NULL)
  if (SQL_NULL_HDESC == hdesc1) {
    wsprintf(buf,TEXT("\t\thCompareDescriptor: hdesc1 handle was null!"));
    DISPLAYERROR(szSQLGETDESCFIELD, buf);
    return;
  }

  // Get the descriptor record count.
  rc = SQLGetDescField(hdesc1, 0, SQL_DESC_COUNT, &swDescRecCount,
    sizeof(swDescRecCount), &cbValue);

  if (SQL_SUCCESS == rc) {

    // Check all records, including header
    for (swDescRec=0; swDescRec <= swDescRecCount; swDescRec++) {

      // Check all fields
      for (iDescField=iStartField; iDescField < sizeof(rgDescInfo)/sizeof(rgDescInfo[0]); iDescField++) {

        // If we've gone past the header fields, then break out of loop to check record fields
        if (0 == swDescRec && !rgDescInfo[iDescField].fHeader) {
          iStartField=iDescField;
          break;
        }

        CompareDescField(hdesc1, hdesc2, uwDescIndex, swDescRec, swDescRecCount, iDescField, pszAPI);
      }
    }
  }
  else {
    // Unable to read record count from descriptor header, can't proceed
    wsprintf(buf,TEXT("\t\tUnable to read record count from descriptor header."));
    ERRSHANDLE(SQL_HANDLE_DESC, hdesc1, SQL_SUCCESS, rc, buf);
  }
}

void CompareWithExpected | ( | PTR | rgbValue,
 |  | SDWORD * | pcbValue,
 |  | UWORD | row,
 |  | UWORD | icol,
 |  | FIELDINFO * | rgFields
 | ) |  |

Definition at line 676 of file quiktest.c.

{
  LPTSTR   pch=NULL;
  TCHAR szExpBuf[MAX_STRING_SIZE]=TEXT("");
  TCHAR * stopstr;

  pch = qtMakeData(row-1, icol-1, &rgFields[icol-1], szExpBuf);

  // Field is not READ ONLY, compare the value we inserted
  if(pch)
  {
    // Where row and column match and field is nullable, a NULL exists
    if (icol-1 == row-1 && rgFields[icol-1].nullable)
    {
      // Post an error if not SQL_NULL_DATA
      if (*pcbValue != SQL_NULL_DATA)
        DISPLAYERROR(TEXT("Simulate BindCol"),TEXT("Didn't return SQL_NULL_DATA"));
    }
    else
    {
      BOOL bCompare;
      TCHAR * pstr=szExpBuf;  // Pointer to start of expected string

      switch(rgFields[icol-1].wSQLType)
      {
        case SQL_BIT:
        case SQL_TINYINT:
        case SQL_SMALLINT:
        case SQL_INTEGER:
          // Compare the data values as long // tcsncmp
          bCompare=(_ttol(rgbValue) == _ttol(pstr));
          break;
        case SQL_NUMERIC:
        case SQL_DECIMAL:
        case SQL_REAL:
          bCompare=(fabs(_tcstod(rgbValue, &stopstr) - _tcstod(pstr, &stopstr)) <= fabs((1/pow(10,7))*_tcstod(rgbValue, &stopstr)));
          break;
        case SQL_FLOAT:
        case SQL_DOUBLE:
          // Compare the data values as doubles strtod
          bCompare=(_tcstod(rgbValue, &stopstr) == _tcstod(pstr, &stopstr));
          break;
        case SQL_DATE:
        case SQL_TIME:
        case SQL_TIMESTAMP:
        case SQL_TYPE_DATE:
        case SQL_TYPE_TIME:
        case SQL_TYPE_TIMESTAMP:
          pstr=szExpBuf+_tcslen(TEXT("{ts '"));
          // Replace second ' with '\0'                                                                   '
          _tcstok(pstr, TEXT("'"));
          if (_tcslen(rgbValue) > _tcslen(TEXT("1994-10-10 10:00:00")))
            _tcscat(pstr, TEXT(".000"));
          bCompare=(!_tcsncmp(rgbValue, pstr, rgFields[icol-1].precision));
          break;
        default:
          bCompare=(!_tcsncmp(rgbValue, pstr, _tcslen(pstr)));
      }

      // Compare the data values as char
      if (!bCompare)
      {
        DISPLAYERROR(TEXT("Simulate BindCol"),TEXT("Returned data didn't match"));
        szWrite(TEXT("\t\t\tExpected: "), FALSE);
        szWrite(pstr, TRUE);
        szWrite(TEXT("\t\t\tReceived: "), FALSE);
        szWrite(rgbValue, TRUE);
      }
    }
  }
} //CompareWithExpected

BOOL PASCAL Connect | ( | lpSERVERINFO | lpSI,
 |  | QTSTRUCT * | lpqt
 | ) |  |

Definition at line 1113 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;
  SDWORD sdwAppVer;

/* The signal for test to use it's
  own allocated handles, is if the a server name is passed in.  If it
  is not, the test should use the hdbc passed in */

  /* ****************** Allocate Env ************************* */
  if (AllocHenv())
    goto ConnectErrorRet;

  /* ****************** Set Application Version ************************* */

  rc = SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION, (SQLPOINTER)SQL_OV_ODBC3,
    SQL_IS_UINTEGER);
  if(!RETCHECK(SQL_SUCCESS, rc, szSQLSETENVATTR))
    goto ConnectErrorRet;

  /* ****************** Allocate Connection ************************* */

  rc = SQLAllocConnect(henv, &hdbc);
  if(!RETCHECK(SQL_SUCCESS, rc, szSQLALLOCCONNECT))
    goto ConnectErrorRet;

  /* ****************** Set Connection Attributes ************************* */
  rc = SQLSetConnectOption(hdbc,SQL_ODBC_CURSORS,lpSI->vCursorLib);

  if(!FindError(SQL_HANDLE_DBC,szHYC00))
    if (!RETCHECK(SQL_SUCCESS, rc,szSQLSETCONNECTOPTION))
    goto ConnectErrorRet;

  /* create a DriverConnect string */
  wsprintf(lpqt->sz, TEXT("dsn=%s;uid=%s;pwd=%s;"),
    lpSI->szValidServer0,
    lpSI->szValidLogin0,
    lpSI->szValidPassword0);

  /* since SQL_DRIVER_COMPLETE is used, it is possible that the
  driver will bring up a dialog asking for more information. */
  rc = SQLDriverConnect(hdbc, lpSI->hwnd, lpqt->sz,
    SQL_NTS, lpqt->buf, MAX_STRING_SIZE, NULL, SQL_DRIVER_NOPROMPT);

  if (RC_NOTSUCCESSFUL(rc))
  {
    if (!RETCHECK(SQL_SUCCESS, rc,szSQLDRIVERCONNECT))
      goto ConnectErrorRet;
  }
  else
    ClearErrorQueue();

  rc = SQLDisconnect(hdbc);
  RETCHECK(SQL_SUCCESS, rc,szSQLDISCONNECT);

  rc = SQLConnect(hdbc, lpSI->szValidServer0, SQL_NTS,
            lpSI->szValidLogin0, SQL_NTS,
            lpSI->szValidPassword0, SQL_NTS);

  if (RC_SUCCESSFUL(rc))
    ClearErrorQueue();
  else if (!RETCHECK(SQL_SUCCESS, rc,szSQLCONNECT))
    goto ConnectErrorRet;

  // Set the global 3.0 driver flag
  g_f3XDriver=Is3XDriver(hdbc,lpqt);

  // We're now connected, check application version and adjust expected error
  // states appropriately.
  rc = SQLGetEnvAttr(henv, SQL_ATTR_ODBC_VERSION, &sdwAppVer, SQL_IS_UINTEGER, NULL);
  RETCHECK(SQL_SUCCESS, rc,szSQLGETENVATTR);

  if (RC_SUCCESSFUL(rc) && (SQL_OV_ODBC2 == sdwAppVer))
  {
    _tcscpy(szHY009, TEXT("S1009"));
    _tcscpy(szHYC00, TEXT("S1C00"));
  }

  return(FALSE);

ConnectErrorRet:

  return(TRUE);

} //Connect()

SWORD CreateDescRecord | ( | SQLHDESC | hdesc,
 |  | SQLHSTMT | hstmt,
 |  | UWORD | uwDescType
 | ) |  |

Definition at line 5167 of file quiktest.c.

{
  UDWORD cbColDef;
  SWORD swColCount;
  SQLRETURN rc;
  SWORD fType, fSQLType;
  SWORD ibScale;
  TCHAR rgBuf[100];

  switch(uwDescType) {
    case SQL_ATTR_APP_ROW_DESC:
      rc = SQLSetDescField(hdesc, 1, SQL_DESC_TYPE, (SQLPOINTER)SQL_C_DEFAULT,
        SQL_IS_SMALLINT);
      ERRSHANDLE(SQL_HANDLE_DESC, hdesc, SQL_SUCCESS, rc,szSQLSETDESCFIELD);

      if (SQL_SUCCEEDED(rc))
        return 1;

      rc=SQLBindCol(hstmt, 1, SQL_C_TCHAR, rgBuf, sizeof(rgBuf), NULL);
      RETCHECK(SQL_SUCCESS, rc,szSQLBINDCOL);
      if (SQL_SUCCEEDED(rc))
        return 1;
      break;
    case SQL_ATTR_IMP_PARAM_DESC:
    case SQL_ATTR_APP_PARAM_DESC:
      // Select statement has already been done by this time
      rc=SQLDescribeCol(hstmt, 1, NULL, 0, NULL, &fSQLType, &cbColDef,
        &ibScale, NULL);
      RETCHECK(SQL_SUCCESS, rc,szSQLDESCRIBECOL);
      if (!SQL_SUCCEEDED(rc))
        return 0;

      if (SQL_ATTR_APP_PARAM_DESC == uwDescType)
        fType=SQL_C_TCHAR;
      else
        fType=fSQLType;

      rc = SQLSetDescField(hdesc, 1, SQL_DESC_TYPE, (SQLPOINTER)fType,
        SQL_IS_SMALLINT);
      ERRSHANDLE(SQL_HANDLE_DESC, hdesc, SQL_SUCCESS, rc,szSQLSETDESCFIELD);

      if (SQL_SUCCEEDED(rc))
        return 1;

      rc=SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_TCHAR,
        fSQLType, cbColDef, ibScale, rgBuf, sizeof(rgBuf), NULL);
      RETCHECK(SQL_SUCCESS, rc,szSQLDESCRIBECOL);
      if (SQL_SUCCEEDED(rc))
        return 1;
      break;
    case SQL_ATTR_IMP_ROW_DESC:
      // Quiktest has already done the select for us
      // Need to find out how many cols in result set
      rc=SQLNumResultCols(hstmt, &swColCount);
      if (SQL_SUCCEEDED(rc))
        return(swColCount);
      break;
  }
  return 0;
}       //CreateDescRecord

void PASCAL CreateParamQuery | ( | QTSTRUCT * | lpqt,
 |  | FIELDINFO * | rgFields,
 |  | UWORD | cTypes
 | ) |  |

Definition at line 3279 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;
  UWORD           i;
  LPTSTR  pch=NULL;
  TCHAR           szQuery[MAX_QUERY_SIZE];
  static SDWORD  sdw = SQL_DATA_AT_EXEC;
  UWORD           w,
        ind;

  wsprintf(szQuery,TEXT("select %s from %s where "), lpqt->szColNames,lpqt->szTableName);

  for(i = 0, w = 0,ind=0; i < cTypes; i++)
    {
    pch = qtMakeData(ind, i,&rgFields[i], lpqt->szDataItem);

    if ((rgFields[i].fSearchable == SQL_SEARCHABLE ||
      rgFields[i].fSearchable == SQL_ALL_EXCEPT_LIKE) &&
      pch && *pch)
    {
      w++;

      switch(rgFields[i].wSQLType)
      {
        case SQL_REAL:
        case SQL_FLOAT:
        case SQL_DOUBLE:
          wsprintf(&szQuery[_tcslen(szQuery)],TEXT("%s < ? + 1 and "),
            rgFields[i].szFieldName);
          break;
        default:
          wsprintf(&szQuery[_tcslen(szQuery)],TEXT("%s = ? and "),
            rgFields[i].szFieldName);
      }

      if(!fBindParameter)
      {
        rc = SQLSetParam(hstmt, w,
          SQL_C_TCHAR, rgFields[i].wSQLType,
          rgFields[i].precision, rgFields[i].scale,
          (LPTSTR)(UDWORD)i, &sdw);
        RETCHECK(SQL_SUCCESS, rc,szSQLSETPARAM);
      }
      else
      {
        rc = SQLBindParameter(hstmt, w, SQL_PARAM_INPUT,
          SQL_C_TCHAR, rgFields[i].wSQLType,
          rgFields[i].precision, rgFields[i].scale,
          (LPTSTR)((UDWORD)i+BIND_PARM_OFFSET), 0, &sdw);
        RETCHECK(SQL_SUCCESS, rc,szSQLBINDPARAMETER);
      }

      ind++;
    }
  }

  if (_tcsstr(szQuery,TEXT("and")))
  {
    /* remove the final "and " */
    szQuery[_tcslen(szQuery) - 5] = TEXT('\0');
  }

  _tcscpy(lpqt->szParamQuery, szQuery);

}

SQLRETURN DescBindCol | ( | SQLHSTMT | hstmt,
 |  | SQLSMALLINT | icol,
 |  | SQLSMALLINT | fCType,
 |  | SQLPOINTER | rgbValue,
 |  | SQLINTEGER | cbValueMax,
 |  | SQLINTEGER * | pcbValue
 | ) |  |

Definition at line 5733 of file quiktest.c.

{
  SQLHDESC hdesc;
  SQLRETURN rc;

  rc = SQLGetStmtAttr(hstmt, SQL_ATTR_APP_ROW_DESC, &hdesc, sizeof(hdesc), NULL);
  if (!RETCHECK(SQL_SUCCESS, rc,szSQLGETSTMTATTR))
    return rc;

  rc = SQLSetDescField(hdesc, icol, SQL_DESC_CONCISE_TYPE, (SQLPOINTER)fCType,
    SQL_IS_SMALLINT);               // Set icol and fCType
  if (!ERRSHANDLE(SQL_HANDLE_DESC, hdesc, SQL_SUCCESS, rc,szSQLSETDESCFIELD))
    return rc;

  rc = SQLSetDescField(hdesc, icol, SQL_DESC_OCTET_LENGTH, (SQLPOINTER)cbValueMax,
    SQL_IS_INTEGER);                // Set cbValueMax
  if (!ERRSHANDLE(SQL_HANDLE_DESC, hdesc, SQL_SUCCESS, rc,szSQLSETDESCFIELD))
    return rc;

  rc = SQLSetDescField(hdesc, icol, SQL_DESC_OCTET_LENGTH_PTR, (SQLPOINTER)pcbValue,
    SQL_IS_POINTER);                // Set pcbValue/octet length
  if (!ERRSHANDLE(SQL_HANDLE_DESC, hdesc, SQL_SUCCESS, rc,szSQLSETDESCFIELD))
    return rc;

  rc = SQLSetDescField(hdesc, icol, SQL_DESC_INDICATOR_PTR, (SQLPOINTER)pcbValue,
    SQL_IS_POINTER);                // Set pcbValue/indicator
  if (!ERRSHANDLE(SQL_HANDLE_DESC, hdesc, SQL_SUCCESS, rc,szSQLSETDESCFIELD))
    return rc;

  rc = SQLSetDescField(hdesc, icol, SQL_DESC_DATA_PTR, (SQLPOINTER)rgbValue,
    SQL_IS_POINTER);                // Set rgbValue
  ERRSHANDLE(SQL_HANDLE_DESC, hdesc, SQL_SUCCESS, rc,szSQLSETDESCFIELD);

  return rc;
}

SQLRETURN DescBindParameter | ( | SQLHSTMT | hstmt,
 |  | SQLUSMALLINT | ipar,
 |  | SQLSMALLINT | fParamType,
 |  | SQLSMALLINT | fCType,
 |  | SQLSMALLINT | fSqlType,
 |  | SQLUINTEGER | cbColDef,
 |  | SQLSMALLINT | ibScale,
 |  | SQLPOINTER | rgbValue,
 |  | SQLINTEGER | cbValueMax,
 |  | SQLINTEGER * | pcbValue
 | ) |  |

Definition at line 5605 of file quiktest.c.

{
  SQLHDESC hdescAPD, hdescIPD;
  SQLRETURN rc;

  rc = SQLGetStmtAttr(hstmt, SQL_ATTR_APP_PARAM_DESC, &hdescAPD, sizeof(hdescAPD), NULL);
  if (!RETCHECK(SQL_SUCCESS, rc,szSQLGETSTMTATTR))
    return rc;

  rc = SQLGetStmtAttr(hstmt, SQL_ATTR_IMP_PARAM_DESC, &hdescIPD, sizeof(hdescIPD), NULL);
  if (!RETCHECK(SQL_SUCCESS, rc,szSQLGETSTMTATTR))
    return rc;

  // Parameter type
  rc = SQLSetDescField(hdescIPD, ipar, SQL_DESC_PARAMETER_TYPE, (SQLPOINTER)fParamType,
    SQL_IS_SMALLINT);               // Set ipar and fParamType for IPD
  if (!ERRSHANDLE(SQL_HANDLE_DESC, hdescIPD, SQL_SUCCESS, rc,szSQLSETDESCFIELD))
    return rc;

  // C type
  rc = SQLSetDescField(hdescAPD, ipar, SQL_DESC_CONCISE_TYPE, (SQLPOINTER)fCType,
    SQL_IS_SMALLINT);               // Set ipar and fCType of APD
  if (!ERRSHANDLE(SQL_HANDLE_DESC, hdescAPD, SQL_SUCCESS, rc,szSQLSETDESCFIELD))
    return rc;

  // Sql type
  rc = SQLSetDescField(hdescIPD, ipar, SQL_DESC_CONCISE_TYPE, (SQLPOINTER)fSqlType,
    SQL_IS_SMALLINT);               // Set fSqlType of IPD
  if (!ERRSHANDLE(SQL_HANDLE_DESC, hdescIPD, SQL_SUCCESS, rc,szSQLSETDESCFIELD))
    return rc;

  // Column Size (Length or Precision)
  if (fSqlType == SQL_CHAR ||
    fSqlType == SQL_WCHAR ||
    fSqlType == SQL_VARCHAR ||
    fSqlType == SQL_WVARCHAR ||
    fSqlType == SQL_LONGVARCHAR ||
    fSqlType == SQL_WLONGVARCHAR ||
    fSqlType == SQL_BINARY ||
    fSqlType == SQL_VARBINARY ||
    fSqlType == SQL_LONGVARBINARY ||
    fSqlType == SQL_TYPE_DATE ||
    fSqlType == SQL_TYPE_TIME ||
    fSqlType == SQL_TYPE_TIMESTAMP ||
    (fSqlType >= SQL_INTERVAL_YEAR &&
     fSqlType <= SQL_INTERVAL_MINUTE_TO_SECOND))
  {
    rc = SQLSetDescField(hdescIPD, ipar, SQL_DESC_LENGTH, (SQLPOINTER)cbColDef,
      SQL_IS_UINTEGER);               // Set cbColDef (Length) of IPD
    if (!ERRSHANDLE(SQL_HANDLE_DESC, hdescIPD, SQL_SUCCESS, rc,szSQLSETDESCFIELD))
      return rc;
  }
  else if (fSqlType == SQL_DECIMAL ||
       fSqlType == SQL_NUMERIC ||
       fSqlType == SQL_FLOAT ||
       fSqlType == SQL_REAL ||
       fSqlType == SQL_DOUBLE)
  {
    rc = SQLSetDescField(hdescIPD, ipar, SQL_DESC_PRECISION, (SQLPOINTER)cbColDef,
      SQL_IS_SMALLINT);               // Set cbColDef (Precision) of IPD
    if (!ERRSHANDLE(SQL_HANDLE_DESC, hdescIPD, SQL_SUCCESS, rc,szSQLSETDESCFIELD))
      return rc;
  }

  // Scale
  if (fSqlType == SQL_TYPE_DATE ||
    fSqlType == SQL_TYPE_TIME ||
    fSqlType == SQL_TYPE_TIMESTAMP ||
    (fSqlType >= SQL_INTERVAL_YEAR &&
     fSqlType <= SQL_INTERVAL_MINUTE_TO_SECOND))
  {
    switch(fSqlType)
    {
      case SQL_TYPE_TIME:
      case SQL_TYPE_TIMESTAMP:
      case SQL_INTERVAL_SECOND:
      case SQL_INTERVAL_DAY_TO_SECOND:
      case SQL_INTERVAL_HOUR_TO_SECOND:
      case SQL_INTERVAL_MINUTE_TO_SECOND:
        rc = SQLSetDescField(hdescIPD, ipar, SQL_DESC_PRECISION, (SQLPOINTER)ibScale,
          SQL_IS_SMALLINT);               // Set scale of IPD
        if (!ERRSHANDLE(SQL_HANDLE_DESC, hdescIPD, SQL_SUCCESS, rc,szSQLSETDESCFIELD))
          return rc;
        break;
      default:
        rc = SQLSetDescField(hdescIPD, ipar, SQL_DESC_PRECISION, (SQLPOINTER)0,
          SQL_IS_SMALLINT);               // Set scale of IPD
        if (!ERRSHANDLE(SQL_HANDLE_DESC, hdescIPD, SQL_SUCCESS, rc,szSQLSETDESCFIELD))
          return rc;
    }
  }
  else
  {
    rc = SQLSetDescField(hdescIPD, ipar, SQL_DESC_SCALE, (SQLPOINTER)ibScale,
      SQL_IS_SMALLINT);               // Set scale of IPD
    if (!ERRSHANDLE(SQL_HANDLE_DESC, hdescIPD, SQL_SUCCESS, rc,szSQLSETDESCFIELD))
      return rc;
  }

  // cbValueMax
  rc = SQLSetDescField(hdescAPD, ipar, SQL_DESC_OCTET_LENGTH, (SQLPOINTER)cbValueMax,
    SQL_IS_INTEGER);                // Set cbValueMax of APD
  if (!ERRSHANDLE(SQL_HANDLE_DESC, hdescAPD, SQL_SUCCESS, rc,szSQLSETDESCFIELD))
    return rc;

  // pcbValue
  rc = SQLSetDescField(hdescAPD, ipar, SQL_DESC_OCTET_LENGTH_PTR, (SQLPOINTER)pcbValue,
    SQL_IS_POINTER);                // Set pcbValue/octet length
  if (!ERRSHANDLE(SQL_HANDLE_DESC, hdescAPD, SQL_SUCCESS, rc,szSQLSETDESCFIELD))
    return rc;

  rc = SQLSetDescField(hdescAPD, ipar, SQL_DESC_INDICATOR_PTR, (SQLPOINTER)pcbValue,
    SQL_IS_POINTER);                // Set pcbValue/indicator
  if (!ERRSHANDLE(SQL_HANDLE_DESC, hdescAPD, SQL_SUCCESS, rc,szSQLSETDESCFIELD))
    return rc;

  // Data ptr
  rc = SQLSetDescField(hdescAPD, ipar, SQL_DESC_DATA_PTR, (SQLPOINTER)rgbValue,
    SQL_IS_POINTER);                // Set rgbValue
  ERRSHANDLE(SQL_HANDLE_DESC, hdescAPD, SQL_SUCCESS, rc,szSQLSETDESCFIELD);

  return rc;

}

void PASCAL DisplayAllErrors ( )

Definition at line 491 of file quiktest.c.

{
  if (!fDiagRecSupported)
  {
    GetErrors(henv,NULL,NULL);
    GetErrors(NULL,hdbc,NULL);
    GetErrors(NULL,NULL,hstmt);
  }
  else
  {
    GetDiagRecs(SQL_HANDLE_ENV,henv);
    GetDiagRecs(SQL_HANDLE_DBC,hdbc);
    GetDiagRecs(SQL_HANDLE_STMT,hstmt);
    GetDiagRecs(SQL_HANDLE_DESC,hdesc);
  }

} /* DisplayAllErrors() */

VOID PASCAL DisplayTestName ( UWORD i )

Definition at line 7152 of file quiktest.c.

{
  szWrite(szBLANKLINE,TRUE);
  szWrite(szTAB,FALSE);
  szWrite(iTestNames[i-1], TRUE);

} /* DisplayTestName() */

VOID PASCAL DropHdbc ( HDBC hdbc )

Definition at line 1017 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;

  if (Supported(SQL_API_SQLFREEHANDLE))
  {
    rc = SQLFreeHandle(SQL_HANDLE_DBC,hdbc);
    RETCHECK(SQL_SUCCESS, rc,szSQLFREEHANDLE);
  }
  else
  {
    rc = SQLFreeConnect(hdbc);
    RETCHECK(SQL_SUCCESS, rc,szSQLFREECONNECT);
  }

} //DropHdbc()

_inline VOID PASCAL DropHenv ( )

Definition at line 1040 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;

  if (Supported(SQL_API_SQLFREEHANDLE))
  {
    rc = SQLFreeHandle(SQL_HANDLE_ENV,henv);
    RETCHECK(SQL_SUCCESS, rc,szSQLFREEHANDLE);
  }
  else
  {
    rc = SQLFreeEnv(henv);
    RETCHECK(SQL_SUCCESS, rc,szSQLFREEENV);
  }

} //DropHenv()

void PASCAL DropTable | ( | LPTSTR | szTableName,
 |  | BOOL | fSilent
 | ) |  |

Definition at line 2803 of file quiktest.c.

{
  TCHAR           szBuff[100];
  RETCODE rc=SQL_ERROR;

  _tcscpy(szBuff,TEXT("drop table "));
  _tcscat(szBuff, szTableName);

  rc = SQLExecDirect(hstmt, szBuff, SQL_NTS);

  if (!fSilent)
    {
    if(!RETCHECK(SQL_SUCCESS, rc,szSQLEXECDIRECT))
      szWrite(TEXT("Unable to drop table"), TRUE);
    }

} //DropTable()

int PASCAL ErrsHandle | ( | SWORD | fHandleType,
 |  | SQLHANDLE | hHandle,
 |  | RETCODE | retExpected,
 |  | RETCODE | retReceived,
 |  | LPTSTR | szFunction,
 |  | LPTSTR | szFile,
 |  | int | iLine,
 |  | BOOL | fDiag
 | ) |  |

Definition at line 588 of file quiktest.c.

{
  TCHAR buf[MAX_STRING_SIZE];

  if(retExpected == retReceived)
    return TRUE;

  szWrite(TEXT(""), TRUE);

  szWrite(TEXT("\t\t\t"), FALSE);
  szWrite(szFunction, TRUE);

  szWrite(TEXT("\t\t\tExpected: "), FALSE);
  szWrite(RetcodeToTCHAR(retExpected, buf), TRUE);

  szWrite(TEXT("\t\t\tReceived: "), FALSE);
  szWrite(RetcodeToTCHAR(retReceived, buf), TRUE);

  if (!fDiag)
    GetDiagRecs(fHandleType,hHandle);

  wsprintf(buf,TEXT("\t\t\t%s: %d"), szFile, iLine);
  szWrite(buf, TRUE);

  szWrite(TEXT("\t\t\t --------  "), TRUE);

  lpSI->failed++;

  return FALSE;
}

SWORD PASCAL ExecEndTran | ( | QTSTRUCT * | lpqt,
 |  | FIELDINFO * | rgFields,
 |  | UWORD | cTypes,
 |  | DSTRUCT * | lpd,
 |  | SQLSMALLINT | fHandleType,
 |  | SQLSMALLINT | fMode,
 |  | UWORD | cSeed
 | ) |  |

Definition at line 6718 of file quiktest.c.

{
    RETCODE rc;

    //does not free the hstmt
    if(!InsertOneRow(lpqt,rgFields,cTypes,lpd,cSeed, FALSE))
        return (INSERT_FAIL);

    switch(fHandleType)
    {
      case SQL_HANDLE_ENV:
        rc= SQLEndTran(fHandleType,henv,fMode);
        break;
      case SQL_HANDLE_DBC:
        rc= SQLEndTran(fHandleType,hdbc,fMode);
        break;
      default:
        DISPLAYERROR(TEXT("ExecEndTran"),TEXT("Did not recieve correct handle type"));
        break;
    }
    RETCHECK(SQL_SUCCESS, rc,szSQLENDTRAN);

    if (SQL_COMMIT == fMode && SQL_SUCCESS == rc)
      guwRowCount++;  // We inserted a row, increment global row count

    //free the hstmt handle
    FreeStmt(SQL_CLOSE);

    return(GetRowCnt(lpqt));
} //ExecEndTran

BOOL PASCAL FindError | ( | SWORD | fHandleType,
 |  | LPTSTR | szFindState
 | ) |  |

Definition at line 625 of file quiktest.c.

{
  SQLHANDLE handle = SQL_NULL_HANDLE;
  SWORD irec;
  TCHAR szErrorMsg[SQL_MAX_MESSAGE_LENGTH];
  RETCODE rc;
  TCHAR szState[6];

  switch(fHandleType)
  {
    case SQL_HANDLE_ENV:
      handle = henv;
      break;

    case SQL_HANDLE_DBC:
      handle = hdbc;
      break;

    case SQL_HANDLE_STMT:
      handle = hstmt;
      break;

    case SQL_HANDLE_DESC:
      if(!Supported(SQL_API_SQLGETDIAGREC))
        return TRUE;

      handle = hdesc;
      break;

    default:
      DISPLAYERROR(TEXT("FindError"), TEXT("invalid fHandleType"));
      return FALSE;
  }

  for(irec = 1
    ; rc = SQLGetDiagRec(fHandleType, handle, irec, szState, NULL, szErrorMsg, SQL_MAX_MESSAGE_LENGTH, NULL)
    , RC_SUCCESSFUL(rc)
    ; irec++)
  {
    if(_tcscmp(szState, szFindState) == 0)
      return TRUE;
  }
  return FALSE;

} /* FindError() */

_inline BOOL PASCAL FreeStmt ( UWORD fOption )

Definition at line 994 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;

  if (Supported(SQL_API_SQLFREEHANDLE) && (fOption == SQL_DROP))
  {
    rc = SQLFreeHandle(SQL_HANDLE_STMT,hstmt);
    RETCHECK(SQL_SUCCESS, rc,szSQLFREEHANDLE);
  }
  else
  {
    rc = SQLFreeStmt(hstmt, fOption);
    RETCHECK(SQL_SUCCESS, rc,szSQLFREESTMT);
  }

  return(RC_NOTSUCCESSFUL(rc));

} //FreeStmt()

void PASCAL FullDisconnect ( )

Definition at line 2769 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;

  /* SQLCancel has the same functionality as SQLFreeStmt w/ SQL_CLOSE     */
  /*      in a non-asynchronous environment                                                                                       */

  rc = SQLCancel(hstmt);
  RETCHECK(SQL_SUCCESS, rc,szSQLCANCEL);

  FreeStmt(SQL_DROP);

  /* if the connection was made in the                                            */
  /*      test, it should be disconnected                                                 */
  /* in the test, otherwise it should be left connected */

  rc = SQLDisconnect(hdbc);
  RETCHECK(SQL_SUCCESS, rc,szSQLDISCONNECT);

  rc = SQLFreeConnect(hdbc);
  RETCHECK(SQL_SUCCESS, rc,szSQLFREECONNECT);

  rc = SQLFreeEnv(henv);
  RETCHECK(SQL_SUCCESS, rc,szSQLFREEENV);

} //FullDisconnect()

VOID PASCAL GetDiagRecs | ( | SWORD | fHandleType,
 |  | SQLHANDLE | hHandle
 | ) |  |

Definition at line 447 of file quiktest.c.

{
  TCHAR           szMessageText[XLARGEBUFF]=TEXT(""),
        szBuff[XLARGEBUFF]=TEXT("");
  TCHAR           szSQLState[100]=TEXT("");
  RETCODE rc=SQL_SUCCESS;
  SWORD           irecRecNumber=0;
  SDWORD  fNativeError=0;
  SWORD           cchBufferLength=sizeof(szMessageText)/sizeof(TCHAR),
        cbTextLength=0;
  SDWORD  sdNumRecs=0;

  if (fDiagFieldSupported)
  {
    /* Get number of diag, records */
    rc = SQLGetDiagField(fHandleType, hHandle,0,SQL_DIAG_NUMBER,
      &sdNumRecs,sizeof(sdNumRecs),NULL);
  }

  for(irecRecNumber=1;(irecRecNumber <= sdNumRecs) && RC_SUCCESSFUL(rc);irecRecNumber++)
  {
    rc = SQLGetDiagRec(fHandleType, hHandle, irecRecNumber,szSQLState,&fNativeError,
      szMessageText,cchBufferLength,&cbTextLength);

    if (RC_SUCCESSFUL(rc))
    {
      wsprintf(szBuff,TEXT("\t\t\tState: %s"), szSQLState);
      szWrite(szBuff, TRUE);
      wsprintf(szBuff,TEXT("\t\t\tError: %s"), szMessageText);
      szWrite(szBuff, TRUE);
    }

  }

} /* GetErrors() */

UWORD PASCAL GetDMVersion ( )

Definition at line 7135 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;
  TCHAR           szNum[MAX_NUM_BUFFER];

  rc = SQLGetInfo(hdbc, SQL_ODBC_VER, szNum, sizeof(szNum), NULL);
  RETCHECK(SQL_SUCCESS, rc,szSQLGETINFO);

  return((UWORD)_ttoi(_tcstok(szNum,TEXT("."))));

} /* GetDMVersion() */

VOID PASCAL GetErrors | ( | HENV | henv,
 |  | HDBC | hdbc,
 |  | HSTMT | hstmt
 | ) |  |

Definition at line 423 of file quiktest.c.

{
  TCHAR buf[MAX_ERROR_SIZE];
  TCHAR largebuf[COMBINED_SIZE];
  TCHAR szState[100];
  RETCODE rc=SQL_SUCCESS;

  for(rc = SQLError(henv, hdbc, hstmt, szState, NULL, buf, MAX_ERROR_SIZE, NULL)
    ; RC_SUCCESSFUL(rc)
    ; rc = SQLError(henv, NULL, NULL, szState, NULL, buf, MAX_ERROR_SIZE, NULL))
  {
    wsprintf(largebuf,TEXT("\t\t\tState: %s"), szState);
    szWrite(largebuf, TRUE);
    wsprintf(largebuf,TEXT("\t\t\tError: %s"), buf);
    szWrite(largebuf, TRUE);
  }

} /* GetErrors() */

SWORD PASCAL GetRowCnt ( QTSTRUCT * lpqt )

Definition at line 6571 of file quiktest.c.

{
  SWORD           sRowCnt;
  RETCODE         rc;

  // free the statment handle for a fresh start
  FreeStmt(SQL_DROP);

  AllocHstmt();

  //get row count for the table
  wsprintf(lpqt->sz,TEXT("select count(*) from %s"), lpqt->szTableName);

  rc = SQLExecDirect(hstmt, lpqt->sz, SQL_NTS);
  RETCHECK(SQL_SUCCESS, rc,szSQLEXECDIRECT);

  rc = SQLFetch(hstmt);
  RETCHECK(SQL_SUCCESS, rc,szSQLFETCH);

  rc = SQLGetData(hstmt,1, SQL_C_SSHORT, &sRowCnt, sizeof(sRowCnt), NULL);
  RETCHECK(SQL_SUCCESS, rc,szSQLGETDATA);

  FreeStmt(SQL_CLOSE);

  return sRowCnt;
}//GetRowCount

VOID PASCAL GetSomeData | ( | HSTMT | lhstmt,
 |  | LPTSTR | szTableName,
 |  | BOOL | fBindCol,
 |  | FIELDINFO | rgField
 | ) |  |

Definition at line 767 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;
  SDWORD  cbValue=0;
  TCHAR           szQuery[XLARGEBUFF]=TEXT(""),
        szBuff[XLARGEBUFF]=TEXT("");
  TCHAR           szErrMsg[MAX_STRING_SIZE]=TEXT(""),
        szDataItem[XLARGEBUFF]=TEXT("");
  LPTSTR   pch=NULL;

  pch = qtMakeData(0, 0,&rgField, szDataItem);

  wsprintf(szQuery,szSELECTSTAR,szTableName);
  rc=SQLExecDirect(lhstmt,szQuery,SQL_NTS);
//      RETCHECK(SQL_SUCCESS,rc,szSQLEXECDIRECT);

  if (fBindCol)
  {
    rc = SQLBindCol(lhstmt, 1, SQL_C_TCHAR, szBuff, sizeof(szBuff),&cbValue);
//              RETCHECK(SQL_SUCCESS, rc, szSQLBINDCOL);
  }

  rc = SQLFetch(lhstmt);
//      RETCHECK(SQL_SUCCESS, rc,szSQLFETCH);

  if (!fBindCol)
  {
    rc = SQLGetData(lhstmt,1, SQL_C_TCHAR,szBuff, sizeof(szBuff), NULL);
//              RETCHECK(SQL_SUCCESS, rc,szSQLGETDATA);
  }

  _tcscmp(szDataItem,szBuff);

} /* GetSomeData() */

UWORD PASCAL GetTypeInfo | ( | FIELDINFO * | rgFields,
 |  | QTSTRUCT * | lpqt
 | ) |  |

Definition at line 2200 of file quiktest.c.

{
  RETCODE         rc=SQL_SUCCESS;
  UWORD       cFieldName;
  SDWORD      cMaxTypeSize, cMaxRowSize;
  UWORD       i,
          cTypes=0;
  SDWORD      sdw;
  LPTSTR       pch=NULL;
  BOOL                    fAutoInc=0;

  /* Get the type information to use in a create statement for a table */

  rc = SQLGetInfo(hdbc, SQL_MAX_COLUMN_NAME_LEN, &cFieldName,
    sizeof cFieldName, NULL);
  RETCHECK(SQL_SUCCESS, rc,szSQLGETINFO);

  rc = SQLGetInfo(hdbc, SQL_MAX_ROW_SIZE, &cMaxRowSize,
    sizeof cMaxRowSize, NULL);
  /* don't check for SQL_SUCCES here, it's a 2.0 function.  If it's successful
    That's great, if not then no maximum is assumed. */

  cMaxTypeSize = cMaxRowSize / MAX_TYPES_SUPPORTED;

/* TO DO: add checks in here for dos file types GetInfo SQL_QUALIFIER_NAME_SEPARATER */

  if(cFieldName > MAX_FIELD - 1)
    cFieldName = MAX_FIELD - 1;

  if(cFieldName < PREFIX_SIZE)
  {
    DISPLAYERROR(szSQLGETINFO,TEXT("MAX_COLUMN_NAME_LEN is too small for autotest to run"));
    goto TypeErrorRet;
  }

  rc = SQLGetTypeInfo(hstmt, SQL_ALL_TYPES);
  RETCHECK(SQL_SUCCESS, rc,szSQLGETTYPEINFO);

  for(i = 0; i < MAX_TYPES_SUPPORTED; i++)
  {

    rc = SQLFetch(hstmt);
    if(rc != SQL_SUCCESS && rc !=SQL_SUCCESS_WITH_INFO)
      break;

    *rgFields[i].szType = *rgFields[i].szLength = *rgFields[i].szParams = TEXT('\0');

    /* get type name */
    rc = SQLGetData(hstmt, 1, SQL_C_TCHAR,
      rgFields[i].szType, sizeof(rgFields[i].szType), &sdw);

    if(!RETCHECK(SQL_SUCCESS, rc,szSQLGETDATA))
      goto TypeErrorRet;

    wsprintf(rgFields[i].szFieldName,TEXT("c%02u"), i+COLNAME_START);
    /* copy first portion of type name for easy reference */
    _tcsnccat(rgFields[i].szFieldName, rgFields[i].szType, TYPE_PORTION);

    /* change spaces in field name to '_' */
    while((pch = (LPTSTR)_tcschr(rgFields[i].szFieldName, TEXT(' '))) != NULL)
      *pch = TEXT('_');

    /* get the SQLType */
    rc = SQLGetData(hstmt, 2, SQL_C_DEFAULT,
      (SWORD  *)&rgFields[i].wSQLType, IGNORED,
      &sdw);
    if(!RETCHECK(SQL_SUCCESS, rc,szSQLGETDATA))
      goto TypeErrorRet;

    /* Max length */
    rc = SQLGetData(hstmt, 3, SQL_C_TCHAR,
      rgFields[i].szLength, sizeof(rgFields[i].szLength), &sdw);
    if(!RETCHECK(SQL_SUCCESS, rc,szSQLGETDATA))
      goto TypeErrorRet;

    /* limit the row size for those drivers that don't support a long
      enough row length for all the fields to be at the max length */
    switch(rgFields[i].wSQLType)
    {
      case SQL_CHAR:
      case SQL_WCHAR:
      case SQL_VARCHAR:
      case SQL_WVARCHAR:
      case SQL_VARBINARY:
      case SQL_BINARY:
      case SQL_LONGVARCHAR:
      case SQL_LONGVARBINARY:
      case SQL_WLONGVARCHAR:

        if(cMaxTypeSize)
        {
          if(_ttol (rgFields[i].szLength) > cMaxTypeSize)
            _ltot(cMaxTypeSize, rgFields[i].szLength, 10);
        }
    }

    /* prefix */
    rc = SQLGetData(hstmt, 4, SQL_C_TCHAR,
      rgFields[i].szPrefix, sizeof(rgFields[i].szPrefix), &sdw);
    if(!RETCHECK(SQL_SUCCESS, rc,szSQLGETDATA))
      goto TypeErrorRet;

    /* suffix */
    rc = SQLGetData(hstmt, 5, SQL_C_TCHAR,
      rgFields[i].szSuffix, sizeof(rgFields[i].szSuffix), &sdw);
    if(!RETCHECK(SQL_SUCCESS, rc,szSQLGETDATA))
      goto TypeErrorRet;

    /* create params */
    rc = SQLGetData(hstmt, 6, SQL_C_TCHAR,
      rgFields[i].szParams, sizeof(rgFields[i].szParams), &sdw);
    if(!RETCHECK(SQL_SUCCESS, rc,szSQLGETDATA))
      goto TypeErrorRet;

    /* nullable */
    rc = SQLGetData(hstmt, 7, SQL_C_SHORT, &rgFields[i].nullable, IGNORED,
      &sdw);
    if(!RETCHECK(SQL_SUCCESS, rc,szSQLGETDATA))
      goto TypeErrorRet;

    /* searchable */
    rc = SQLGetData(hstmt, 9, SQL_C_SHORT, &rgFields[i].fSearchable, IGNORED,
      &sdw);
    if(!RETCHECK(SQL_SUCCESS, rc,szSQLGETDATA))
      goto TypeErrorRet;

    /* autoincrement */
    rc = SQLGetData(hstmt, 12, SQL_C_SHORT, &rgFields[i].autoinc, IGNORED,
      &sdw);
    if(!RETCHECK(SQL_SUCCESS, rc,szSQLGETDATA))
      goto TypeErrorRet;

    // Since some data types will have NULL for autoincrement, we need to set to FALSE
    if (SQL_NULL_DATA == sdw)
      rgFields[i].autoinc=FALSE;

    if (IgnoreType(rgFields[i].szType,rgFields[i].wSQLType))
    {
      i--;
      continue;
    }

    /* The following code only allows the first autoincrement column to
      be placed in the table.  Many DBMS's do not allow more than one per table. */
    if(rgFields[i].autoinc == TRUE)
    {
      if(fAutoInc)
      {
        i--;
        continue;
      }
      else
        fAutoInc = TRUE;
    }

    // Limit data types to those desired (use for debugging)
    if (!AllowedType(rgFields[i].wSQLType))
    {
      i--;
      continue;
    }
  }

  cTypes = i;

  /* if the type name contains spaces, replace them with _ because
    most servers don't allow spaces in field names */

  RETCHECK(SQL_NO_DATA_FOUND, rc,szSQLFETCH);

  rc = SQLFreeStmt(hstmt, SQL_CLOSE);
  RETCHECK(SQL_SUCCESS, rc,szSQLFREESTMT);

  SetTableName(lpqt);

  return(cTypes);

TypeErrorRet:

  return(0);

} //GetTypeInfo()

BOOL PASCAL IgnoreType | ( | LPTSTR | szType,
 |  | SWORD | wSQLType
 | ) |  |

Definition at line 1205 of file quiktest.c.

{
  BOOL fIgnore=FALSE;

/* If a line below is compiled in, that type will not be used in creating
 the table.  (useful for when one specific type is causing problems in
 a particular test, this way the test can be run for all other types)
*/

  if (!_tcscmp(szType,TEXT("LONG RAW")) ||
     !_tcscmp(szType,TEXT("LONG VARTCHAR")) ||
     !_tcscmp(szType,TEXT("LONG VARTCHAR FOR BIT DATA")))
    {
    fIgnore=TRUE;
    }

  //if (wSQLType != SQL_CHAR)
  //      fIgnore=TRUE;

  return(fIgnore);

} //IgnoreType()

BOOL PASCAL InsertOneRow | ( | QTSTRUCT * | lpqt,
 |  | FIELDINFO * | rgFields,
 |  | UWORD | cTypes,
 |  | DSTRUCT * | lpd,
 |  | UWORD | cSeed,
 |  | BOOL | fFreeHstmt
 | ) |  |

Definition at line 6615 of file quiktest.c.

{
  RETCODE                         rc;
  UWORD                           w;
  UWORD                           ind;
  LPTSTR                          pch=NULL;
  SQLHDESC                                hdesc;
   SQLSMALLINT          fParamType = SQL_PARAM_INPUT;
  TCHAR                                   szDataItem[150];

  //prepare the insert statement
  rc = SQLPrepare(hstmt, szInsertStmt, SQL_NTS);
  RETCHECK(SQL_SUCCESS, rc,szSQLPREPARE);

  //going through each data type, call SQLBindParam
  for(ind = 0, w = 0; ind < cTypes; ind++)
  {

    //make data according to data type description in rgFields[], cSeed is the seed
    pch = qtMakeData(cSeed,ind,&rgFields[ind], szDataItem);

    //if the data type is READ_ONLY, skip
    if(!pch)
      continue;

    //populate the NULL data
    if(*pch)
    {
      _tcscpy(lpd[w].data, pch);
      lpd[w].cb = SQL_NTS;
    }
    else
    {
      _tcscpy(lpd[w].data,TEXT(""));
      lpd[w].cb = SQL_NULL_DATA;
    }

    if (g_f3XDriver && Supported(SQL_API_SQLSETDESCFIELD))
//              if (0)  //DEBUG
    {
      //bind the data buffer in lpd[] to each column of the table
      rc = SQLBindParam(hstmt, (SQLSMALLINT)(w+1),SQL_C_TCHAR, rgFields[ind].wSQLType,
                  rgFields[ind].precision, rgFields[ind].scale,
                  &lpd[w].data, &lpd[w].cb);
      RETCHECK(SQL_SUCCESS, rc,szSQLBINDPARAM);

      if(rc!= SQL_SUCCESS)
        return FALSE;

      //get the driver parameter descriptor handle
      rc = SQLGetStmtAttr(hstmt,SQL_ATTR_IMP_PARAM_DESC, &hdesc, sizeof(hdesc),NULL);
      RETCHECK(SQL_SUCCESS, rc,szSQLGETSTMTATTR);
      if(rc!= SQL_SUCCESS)
        return FALSE;

      //set the parameter type field in the descriptor
      rc = SQLSetDescField(hdesc, (SQLSMALLINT)(w+1), SQL_DESC_PARAMETER_TYPE,
                    (PTR)fParamType, sizeof(fParamType));
      RETCHECK(SQL_SUCCESS, rc,szSQLSETDESCFIELD);

    }
    else
    {
      rc = SQLBindParameter(hstmt, (UWORD)(w+1),SQL_PARAM_INPUT,SQL_C_TCHAR,
              rgFields[ind].wSQLType, rgFields[ind].precision,
              rgFields[ind].scale,&lpd[w].data, 100, &lpd[w].cb);

      RETCHECK(SQL_SUCCESS, rc,szSQLBINDPARAMETER);

      if(rc!= SQL_SUCCESS)
        return FALSE;
    }

    //go on to next column
    w++;
  }

  // insert a row
  rc = SQLExecute(hstmt);
  RETCHECK(SQL_SUCCESS, rc,szSQLEXECUTE);
  if(rc!= SQL_SUCCESS)
    return FALSE;

  //free the hstmt if required
  if(fFreeHstmt)
  {
    if (FreeStmt(SQL_CLOSE))
      return FALSE;

  }

  return TRUE;

}       //InsertOneRow

BOOL PASCAL Is3XDriver | ( | HDBC | hdbc,
 |  | QTSTRUCT * | lpqt
 | ) |  |

Definition at line 1078 of file quiktest.c.

{
  RETCODE         rc=SQL_SUCCESS;
  LPTSTR          pch=NULL;
  BOOL                    f3XDriver=FALSE;

  rc = SQLGetInfo(hdbc, SQL_DRIVER_ODBC_VER,
    lpqt->buf, sizeof(lpqt->buf), NULL);
  if(RETCHECK(SQL_SUCCESS, rc,szSQLGETINFO))
  {
    pch = _tcstok(lpqt->buf,TEXT("."));

    if (!_tcsnccmp(pch,TEXT("02"), 2))
    {
      pch = _tcstok(NULL,TEXT("."));

      if(!_tcsnccmp(pch,TEXT("00"), 2))
        DISPLAYERROR(szSQLGETINFO,TEXT("Driver returned ODBC version 2.00 which is no longer supported.  Please upgrade to 2.01"));

    }
    else if (!_tcsnccmp(pch,TEXT("03"), 2))
      f3XDriver=TRUE;
  }

  uDriverODBCVer=_ttoi(lpqt->buf);

  return(f3XDriver);

} //Is3XDriver()

void PASCAL qtDisplayError | ( | LPTSTR | szFunction,
 |  | LPTSTR | buf,
 |  | LPTSTR | szFile,
 |  | int | iLine
 | ) |  |

Definition at line 6956 of file quiktest.c.

{
  TCHAR szTmp[MAX_STRING_SIZE];

  szWrite(TEXT(""), TRUE);
  szWrite(TEXT("\t\t\t"), FALSE);
  szWrite(szFunction, FALSE);
  szWrite(TEXT("  FAILED"), TRUE);
  szWrite(TEXT("\t\t\t"), FALSE);
  szWrite(buf, TRUE);

  wsprintf(szTmp,TEXT("\t\t\t%s: %d"), szFile, iLine);
  szWrite(szTmp, TRUE);

  szWrite(TEXT("\t\t\t  --------  "), TRUE);

  lpSI->failed++;

  return;
}

LPTSTR PASCAL qtMakeData | ( | int | row,
 |  | int | col,
 |  | FIELDINFO * | rgField,
 |  | LPTSTR | buf
 | ) |  |

Definition at line 6982 of file quiktest.c.

{
  int i;
  TCHAR szColNum[10];
  TCHAR tmpbuf[256];

  if(rgField->fAutoUpdate)
    return NULL;

  if(rgField->nullable && (row==col))
    {
    _tcscpy(buf,TEXT(""));
    return buf;
    }

  switch(rgField->wSQLType) {
    case SQL_CHAR:
    case SQL_WCHAR:
    case SQL_VARCHAR:
    case SQL_WVARCHAR:
    case SQL_LONGVARCHAR:
    case SQL_WLONGVARCHAR:
    case SQL_BINARY:
    case SQL_VARBINARY:
    case SQL_LONGVARBINARY:
      if(rgField->precision < (4*sizeof(TCHAR)) )
        wsprintf(buf,TEXT("%d"), 1);
      else
        wsprintf(buf,TEXT("%d%d"), row, row);
      break;
    case SQL_DECIMAL:
    case SQL_NUMERIC:
    case SQL_REAL:
    case SQL_FLOAT:
    case SQL_DOUBLE:
      if(row == 2 && !rgField->fUnsigned) /* make the second row negative for variety */
        wsprintf(buf,TEXT("-%d.%d"), row, row);
      else
        wsprintf(buf,TEXT("%d.%d"), row, row);
      break;

    case SQL_BIT:
      if(row > 2)
        wsprintf(buf,TEXT("%d"), 1);
      else
        wsprintf(buf,TEXT("%d"), 0);

      break;

    case SQL_SMALLINT:
    case SQL_INTEGER:
    case SQL_TINYINT:
    case SQL_BIGINT:
      if(row == 2 && !rgField->fUnsigned) /* make the second row negative for variety */
        wsprintf(buf,TEXT("-%d"), row);
      else
        wsprintf(buf,TEXT("%d"), row);
      break;

    case SQL_TIME:
    case SQL_TYPE_TIME:
      wsprintf(buf,TEXT("{t '01:%02d:%02d'}"), row % 60, row % 60);
      break;
    case SQL_DATE:
    case SQL_TYPE_DATE:
      wsprintf(buf,TEXT("{d '1994-%02d-%02d'}"), (row % 12) + 1, (row % 30) + 1);
      break;
    case SQL_TIMESTAMP:
    case SQL_TYPE_TIMESTAMP:
      // precision <= 16 means the timestamp column doesn't have enough precision to hold seconds
      if ( rgField->precision > 16 )
        wsprintf(buf,TEXT("{ts '1994-%02d-%02d 01:%02d:%02d'}"), (row % 12) + 1, (row % 30) + 1, row % 60, row % 60);
      else
        wsprintf(buf,TEXT("{ts '1994-%02d-%02d 01:%02d:%02d'}"), (row % 12) + 1, (row % 30) + 1, row % 60, 0);
      break;

    case SQL_GUID:
      _itot(row, szColNum, 10);
      _tcscpy(tmpbuf, szColNum);
      for (i=0; i<11; i++){
        _tcscat(tmpbuf, szColNum);
      }
      wsprintf(buf, TEXT("%.8s-%.4s-%.4s-%.4s-%.12s"), tmpbuf, tmpbuf, tmpbuf, tmpbuf, tmpbuf);
      break;

  }
  return buf;
}

void ResetHstmt ( SQLHSTMT * phstmt )

Definition at line 751 of file quiktest.c.

{
  SQLRETURN rc;

  // Free and reallocate stmt handle to clean up
  rc=SQLFreeHandle(SQL_HANDLE_STMT, *phstmt);
  ERRSHANDLE(SQL_HANDLE_STMT, *phstmt, SQL_SUCCESS, rc, szSQLFREESTMT);
  rc=SQLAllocHandle(SQL_HANDLE_STMT, hdbc, phstmt);
  RETCHECK(SQL_SUCCESS, rc,szSQLALLOCHANDLE);
  hdesc=NULL;     // Global hdesc needs to be NULL or attempt to read freed mem
}

LPTSTR PASCAL RetcodeToTCHAR | ( | RETCODE | retcode,
 |  | LPTSTR | buf
 | ) |  |

Definition at line 514 of file quiktest.c.

{
  switch (retcode)
    {
    case SQL_SUCCESS:
      _tcscpy (buf,TEXT("SQL_SUCCESS"));
      break;
    case SQL_ERROR:
      _tcscpy (buf,TEXT("SQL_ERROR"));
      break;
    case SQL_SUCCESS_WITH_INFO:
      _tcscpy (buf,TEXT("SQL_SUCCESS_WITH_INFO"));
      break;
    case SQL_NO_DATA_FOUND:
      _tcscpy (buf,TEXT("SQL_NO_DATA_FOUND"));
      break;
    case SQL_NEED_DATA:
      _tcscpy (buf,TEXT("SQL_NEED_DATA"));
      break;
    case SQL_INVALID_HANDLE:
      _tcscpy (buf,TEXT("SQL_INVALID_HANDLE"));
      break;
    case SQL_STILL_EXECUTING:
      _tcscpy (buf,TEXT("SQL_STILL_EXECUTING"));
      break;
    default:
      _tcscpy(buf,TEXT("UNKNOWN rc"));
    }

  return buf;
}

void PASCAL RetrieveData | ( | QTSTRUCT * | lpqt,
 |  | FIELDINFO * | rgFields,
 |  | UWORD | cTypes,
 |  | DSTRUCT * | lpd
 | ) |  |

Definition at line 3084 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;
  UWORD           ind,
        i;
  SDWORD          nSame;
  LPTSTR  pch=NULL;
  TCHAR           szNum[MAX_NUM_BUFFER];   /* used with _ttoi and itoa conversions */
  TCHAR           *stopstring=NULL;
  double  Num=0,
        Num2=0;

  for(ind = 0; ;ind++)
    {

    /* Get the data back */
    rc = SQLFetch(hstmt);
    if(rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO)
      break;

    for(i = 0; i < cTypes; i++)
      {
      /* make sure it's original data placed */
      /* in that field/row location                   */
      pch = qtMakeData(ind, i,&rgFields[i], lpqt->szDataItem);

      if(!pch)
        continue;

      if(!*pch) {
        if(lpd[i].cb != SQL_NULL_DATA)
          DISPLAYERROR(szRETDATA, TEXT("should have been NULL"));
        continue;
      }
      switch(rgFields[i].wSQLType)
        {
        /* check the outlen and data    */
        /* returned for each type.      */
        case SQL_INTEGER:
          if(lpd[i].cb != sizeof(SDWORD))
            DISPLAYERROR(szRETDATA,szINCORRECTOUTLEN);

          _tcscpy(szNum, pch);
          nSame = _ttol(szNum) == lpd[i].sdword;
          break;
        case SQL_SMALLINT:
          if(lpd[i].cb != sizeof(SWORD))
            DISPLAYERROR(szRETDATA,szINCORRECTOUTLEN);

          _tcscpy(szNum, pch);
          nSame = _ttoi(szNum) == lpd[i].sword;
          break;

        case SQL_FLOAT:
        case SQL_DOUBLE:
          if(lpd[i].cb != sizeof(SDOUBLE))
            DISPLAYERROR(szRETDATA,szINCORRECTOUTLEN);

          _tcscpy(szNum, pch);
          Num=_tcstod(szNum, &stopstring);
          nSame = Num - lpd[i].sdouble < 0.001 && Num - lpd[i].sdouble > -0.001;

          break;

        case SQL_REAL:
          if(lpd[i].cb != sizeof(SFLOAT))
            DISPLAYERROR(szRETDATA,szINCORRECTOUTLEN);

          _tcscpy(szNum, pch);
          Num=_tcstod(szNum, &stopstring);

          nSame = Num - lpd[i].sfloat < 0.001 && Num - lpd[i].sfloat > -0.001;
          break;

        case SQL_TINYINT:
          if(lpd[i].cb != sizeof(SCHAR))
            DISPLAYERROR(szRETDATA,szINCORRECTOUTLEN);

          _tcscpy(szNum, pch);
          nSame = (SCHAR)_ttoi(szNum) == (SCHAR)lpd[i].data[0];
          break;

        case SQL_DECIMAL:
        case SQL_NUMERIC:
          if(lpd[i].cb > MAX_STRING_SIZE*sizeof(TCHAR))
            DISPLAYERROR(szRETDATA,szINCORRECTOUTLEN);

          // Chg _tcslen to strlen below pending spec decision
          if((lpd[i].cb / sizeof(TCHAR)) > (UDWORD)_tcslen(lpd[i].data))
            DISPLAYERROR(szRETDATA,szINCORRECTOUTLEN);

          {
          TCHAR szNum2[MAX_NUM_BUFFER];

          _tcscpy(szNum, pch);
          _tcscpy(szNum2, pch);
          Num=_tcstod(szNum, &stopstring);
          Num2=_tcstod(szNum2, &stopstring);

          nSame = Num - Num2 < 0.001 &&   Num - Num2 > -0.001;
          }

          break;

        case SQL_VARCHAR:
        case SQL_WVARCHAR:
        case SQL_LONGVARCHAR:
        case SQL_WLONGVARCHAR:
          if(lpd[i].cb > MAX_STRING_SIZE*sizeof(TCHAR))
            DISPLAYERROR(szRETDATA,szINCORRECTOUTLEN);

          if(lpd[i].cb / sizeof(SQLTCHAR) > _tcslen(lpd[i].data))
            DISPLAYERROR(szRETDATA,szINCORRECTOUTLEN);
          nSame = (SDWORD)_tcsstr(lpd[i].data, pch);

          break;

        case SQL_VARBINARY:
        case SQL_LONGVARBINARY:
          if(lpd[i].cb > MAX_STRING_SIZE)
            DISPLAYERROR(szRETDATA,szINCORRECTOUTLEN);

          if(lpd[i].cb * 2 != (SWORD)_tcslen(pch))
            DISPLAYERROR(szRETDATA,szINCORRECTOUTLEN);

          nSame = TRUE; /* not checking returned data for binary */

          break;

        case SQL_CHAR:
        case SQL_WCHAR:
          if(lpd[i].cb > MAX_STRING_SIZE*sizeof(TCHAR) && rc == SQL_SUCCESS)
            DISPLAYERROR(szRETDATA,TEXT("incorrect return code for outlen"));

          if(((lpd[i].cb / sizeof(TCHAR)) != (UDWORD)rgFields[i].precision) && rc == SQL_SUCCESS)
            DISPLAYERROR(szRETDATA,szINCORRECTOUTLEN);

          nSame = !_tcsnccmp(lpd[i].data, pch, _tcslen(pch));

          break;
        case SQL_BINARY:
        default:
          if(lpd[i].cb > MAX_STRING_SIZE && rc == SQL_SUCCESS)
            DISPLAYERROR(szRETDATA,szINCORRECTOUTLEN);
          nSame = TRUE; /* not checking returned data for binary */
        }

    if(!nSame)
      DISPLAYERROR(szRETDATA, TEXT("invalid data"));
    }
  }

  RETCHECK(SQL_NO_DATA_FOUND, rc, szSQLFETCH);

  if(ind != cTypes + 1)
    DISPLAYERROR(szSQLFETCH, TEXT("Incorrect number of result rows"));

  rc = SQLFreeStmt(hstmt, SQL_CLOSE);
  RETCHECK(SQL_SUCCESS, rc, szSQLFREESTMT);

  rc = SQLFreeStmt(hstmt, SQL_UNBIND);
  RETCHECK(SQL_SUCCESS, rc, szSQLFREESTMT);

  rc = SQLFreeStmt(hstmt, SQL_RESET_PARAMS);
  RETCHECK(SQL_SUCCESS, rc, szSQLFREESTMT);

} // RetrieveData()

int PASCAL ReturnCheck | ( | RETCODE | retExpected,
 |  | RETCODE | retReceived,
 |  | LPTSTR | szFunction,
 |  | LPTSTR | szFile,
 |  | int | iLine,
 |  | BOOL | fDiag
 | ) |  |

Definition at line 552 of file quiktest.c.

{
  TCHAR buf[MAX_STRING_SIZE];

  if(retExpected == retReceived)
    return TRUE;

  szWrite(TEXT(""), TRUE);

  szWrite(TEXT("\t\t\t"), FALSE);
  szWrite(szFunction, TRUE);

  szWrite(TEXT("\t\t\tExpected: "), FALSE);
  szWrite(RetcodeToTCHAR(retExpected, buf), TRUE);

  szWrite(TEXT("\t\t\tReceived: "), FALSE);
  szWrite(RetcodeToTCHAR(retReceived, buf), TRUE);

  if (!fDiag)
    DisplayAllErrors();

  wsprintf(buf,TEXT("\t\t\t%s: %d"), szFile, iLine);
  szWrite(buf, TRUE);

  szWrite(TEXT("\t\t\t --------  "), TRUE);

  lpSI->failed++;

  return FALSE;
}

_inline int PASCAL SearchForError | ( | HENV | henv,
 |  | HDBC | hdbc,
 |  | HSTMT | hstmt,
 |  | LPTSTR | szFindState
 | ) |  |

Definition at line 389 of file quiktest.c.

{
  TCHAR buf[MAX_STRING_SIZE];
  RETCODE rc;
  TCHAR szState[6];
  int found = FALSE;

  for(rc = SQLError(henv, hdbc, hstmt, szState, NULL, buf, MAX_STRING_SIZE, NULL)
    ; !found && (rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO)
    ; rc = SQLError(henv, NULL, NULL, szState, NULL, buf, MAX_STRING_SIZE, NULL))
  {
    found = _tcscmp(szState, szFindState) == 0;
  }

  return(found);

} /* SearchForError() */

_inline RETCODE PASCAL SelectFromTable ( QTSTRUCT * lpqt )

Definition at line 809 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;
  TCHAR           szQuery[LARGEBUFF];

  wsprintf(szQuery,TEXT("select %s from %s"),
  //wsprintf(szQuery,TEXT("select %s from %s order by %s"),
    lpqt->szColNames, lpqt->szTableName/*, lpqt->szColNames*/);

  rc = SQLExecDirect(hstmt, szQuery, SQL_NTS);
  RETCHECK(SQL_SUCCESS, rc,szSQLEXECDIRECT);

  return(rc);

} /* SelectFromTable() */

_inline RETCODE PASCAL SelectFromTableFetch | ( | QTSTRUCT * | lpqt,
 |  | TCHAR * | szColName
 | ) |  |

Definition at line 829 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;
  TCHAR           szQuery[LARGEBUFF];

  wsprintf(szQuery,TEXT("select %s from %s order by %s"),
    lpqt->szColNames, lpqt->szTableName, szColName);

  rc = SQLExecDirect(hstmt, szQuery, SQL_NTS);
  if((SQL_SUCCESS!=rc) && (SQL_SUCCESS_WITH_INFO!=rc)){
    RETCHECK(SQL_SUCCESS_WITH_INFO, rc,szSQLEXECDIRECT);
    return SQL_NO_DATA;
  }

  return SQL_SUCCESS;
} /* SelectFromTableFetch() */

_inline BOOL PASCAL SetConnectionAttributes | ( | HDBC | lhdbc,
 |  | UWORD | fAttr,
 |  | UDWORD | rgbValue
 | ) |  |

Definition at line 959 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;
  TCHAR           szAPI[MEDBUFF];
  BOOL            fFailed=FALSE;

  if (Supported(SQL_API_SQLSETCONNECTATTR))
  {
    rc = SQLSetConnectAttr(lhdbc,(SDWORD)fAttr,(PTR)rgbValue,sizeof(UDWORD));
    _tcscpy(szAPI,szSQLSETCONNECTATTR);
  }
  else
  {
    rc = SQLSetConnectOption(lhdbc,fAttr,rgbValue);
    _tcscpy(szAPI,szSQLSETCONNECTOPTION);
  }

  if (rc != SQL_SUCCESS)
  {
    if(!FindError(SQL_HANDLE_DBC,szHYC00))
      RETCHECK(SQL_SUCCESS, rc,szAPI);

    fFailed=TRUE;
  }

  return(fFailed);

} //SetConnectionAttributes()

VOID PASCAL SetErrorCondition ( SWORD fHandleType )

Definition at line 1327 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;

  /* The following are used to produce "(S1)HY009" SQL State */
  switch (fHandleType)
  {
    case SQL_HANDLE_ENV:
      rc = SQLAllocConnect(henv, NULL);
      break;
    case SQL_HANDLE_DBC:
      rc = SQLAllocStmt(hdbc, NULL);
      break;
    case SQL_HANDLE_STMT:
      rc = SQLExecDirect(hstmt, NULL, SQL_NTS);               // Produces a DM error
      break;
    case SQL_HANDLE_DESC:
      rc = SQLGetDescField(hdesc, 0, SQL_DESC_AUTO_UNIQUE_VALUE, NULL, 0, NULL);
      break;
  }

} //SetErrorCondition()

_inline BOOL PASCAL SetStatementAttributes | ( | UWORD | fAttr,
 |  | PTR | rgbValue
 | ) |  |

Definition at line 924 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;
  TCHAR           szAPI[MEDBUFF];
  BOOL            fFailed=FALSE;

  if (Supported(SQL_API_SQLSETSTMTATTR))
  {
    rc = SQLSetStmtAttr(hstmt,(SDWORD)fAttr,rgbValue,sizeof(UDWORD));
    _tcscpy(szAPI,szSQLSETSTMTATTR);
  }
  else
  {
    rc = SQLSetStmtOption(hstmt,fAttr,(UDWORD)rgbValue);
    _tcscpy(szAPI,szSQLSETSTMTOPTION);
  }

  if (rc != SQL_SUCCESS)
  {
    if(!FindError(SQL_HANDLE_STMT,szHYC00))
      RETCHECK(SQL_SUCCESS, rc,szAPI);

    fFailed=TRUE;
  }

  return(fFailed);

} //SetStatementAttributes()

void PASCAL SetTableName ( QTSTRUCT * lpqt )

Definition at line 2119 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;
  UWORD           cTableName;
  TCHAR           szTime[MEDBUFF]=TEXT(""),
        szTmpBuff[MEDBUFF],
        *pTime=NULL;

  _tstrtime(szTmpBuff);

  /* Remove colons */
  pTime=_tcstok(szTmpBuff, TEXT(":"));
  while (pTime)
  {
    _tcscat(szTime,pTime);
    pTime=_tcstok(NULL, TEXT(":"));
  }

  rc = SQLGetInfo(hdbc, SQL_MAX_TABLE_NAME_LEN, &cTableName,
    sizeof (cTableName), NULL);
  if(rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO)
    RETCHECK(SQL_SUCCESS, rc,szSQLGETINFO);

  rc = SQLGetInfo(hdbc, SQL_QUALIFIER_NAME_SEPARATOR,
    lpqt->buf, sizeof(lpqt->buf), NULL);
  if(rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO)
    RETCHECK(SQL_SUCCESS, rc,szSQLGETINFO);

  if(!(_tcscmp(TEXT("\\"), lpqt->buf)))
    cTableName -= 4;

  _sntprintf(lpqt->szTableName, min(cTableName, MAX_TABLE_NAME-1),
        TEXT("q%s"), szTime);

} //SetTableName()

_inline UWORD PASCAL Supported ( UWORD uwSQLFunc )

Definition at line 327 of file quiktest.c.

{
  UWORD           fLevel2=FALSE;
  RETCODE rc=SQL_SUCCESS;

  rc = SQLGetFunctions(hdbc, uwSQLFunc,&fLevel2);
  RETCHECK(SQL_SUCCESS, rc,szSQLGETFUNCTIONS);

  return(fLevel2);

} //Supported()

_inline VOID WINAPI szWrite | ( | LPTSTR | szStr,
 |  | BOOL | fNewLine
 | ) |  |

Definition at line 412 of file quiktest.c.

{
  szLogPrintf(lpSI, FALSE, szStr);
  if(fNewLine)
    szLogPrintf(lpSI, FALSE, TEXT("\r\n"));
}

void PASCAL TestBindParam | ( | QTSTRUCT * | lpqt,
 |  | FIELDINFO * | rgFields,
 |  | UWORD | cTypes,
 |  | DSTRUCT * | lpd
 | ) |  |

Definition at line 6851 of file quiktest.c.

{
  RETCODE                         rc;
  SQLINTEGER              cbValue = SQL_NTS;
  TCHAR                           szDataItem[150];

  if(Supported(SQL_API_SQLBINDPARAM))
  {
    //test SQLBindParam by inserting one row, do not free the hstmt handle
    if (InsertOneRow(lpqt,rgFields,cTypes,lpd,(UWORD)(guwRowCount),FALSE))
      guwRowCount++; // We've inserted a row
  }
  else
  {
    //prepare the insert statement
    rc = SQLPrepare(hstmt, szInsertStmt, SQL_NTS);
    RETCHECK(SQL_SUCCESS, rc,szSQLPREPARE);

    //make data according to data type description in rgFields[0], cSeed is the seed
    qtMakeData(cTypes+1,0,&rgFields[0],szDataItem);

    //try to bind lpqt->szDataItem to the first column of the table
    rc = SQLBindParam(hstmt,1,SQL_C_TCHAR, rgFields[0].wSQLType, rgFields[0].precision,
                rgFields[0].scale,lpqt->szDataItem, &cbValue);

    //check error msg
    if(!FindError(SQL_HANDLE_STMT,szIM001))
      DISPLAYERROR(szSQLBINDPARAM,TEXT("Did not return Not Supported Message"));

    RETCHECK(SQL_ERROR, rc,szSQLBINDPARAM);
  }

  //free the hstmt handle
  FreeStmt(SQL_CLOSE);

} // TestBindParam()

VOID PASCAL TestConnectAttr | ( | HDBC | hdbc,
 |  | SDWORD | fAttribute,
 |  | UDWORD | rgbValue,
 |  | LPTSTR | lpAttr,
 |  | BOOL | fReadOnlyAttr
 | ) |  |

Definition at line 4742 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;
  TCHAR           szBuff[LARGEBUFF]=TEXT("");
  UDWORD  pvParam=0;
  RETCODE rcExp=fReadOnlyAttr ? SQL_ERROR : SQL_SUCCESS;

  rc = SQLSetConnectAttr(hdbc,fAttribute,(PTR)rgbValue,sizeof(rgbValue));

  if(!FindError(SQL_HANDLE_DBC,szHYC00))
  {

    RETCHECK(rcExp,rc,szSQLSETCONNECTATTR);

    rc = SQLGetConnectAttr(hdbc,fAttribute,&pvParam,sizeof(pvParam),NULL);

    if(!FindError(SQL_HANDLE_DBC,szHYC00))
    {
      RETCHECK(SQL_SUCCESS,rc,szSQLGETCONNECTATTR);

      if(!fReadOnlyAttr && (pvParam != rgbValue))
      {
        wsprintf(szBuff,TEXT("%s returned incorrect value"),lpAttr);
        DISPLAYERROR(szSQLGETCONNECTATTR,szBuff);
      }
    }
    else
      RETCHECK(SQL_ERROR,rc,szSQLGETCONNECTATTR);
  }
  else
    RETCHECK(SQL_ERROR,rc,szSQLSETCONNECTATTR);

} //TestConnectAttr()

void PASCAL TestConnectionOptions ( )

Definition at line 1256 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;
  SDWORD  sdw,
        cbValue=0;
  BOOL            fConnectOption=TRUE;
  TCHAR           szAPI[MEDBUFF];
  HDBC            lhdbc=NULL;

  rc=SQLAllocConnect(henv,&lhdbc);
  RETCHECK(SQL_SUCCESS, rc,szSQLALLOCCONNECT);

  SetConnectionAttributes(lhdbc,SQL_ACCESS_MODE,SQL_MODE_READ_WRITE);

  SetConnectionAttributes(lhdbc,SQL_AUTOCOMMIT,TRUE);

  if (SetConnectionAttributes(lhdbc,SQL_LOGIN_TIMEOUT,TEST_CONNECT_OPTION))
    fConnectOption = FALSE;

  if (Supported(SQL_API_SQLGETCONNECTATTR))
  {
    rc = SQLGetConnectAttr(lhdbc, SQL_LOGIN_TIMEOUT, (PTR)&sdw,0,&cbValue);
    _tcscpy(szAPI,szSQLGETCONNECTATTR);
  }
  else
  {
    rc = SQLGetConnectOption(lhdbc, SQL_LOGIN_TIMEOUT, &sdw);
    _tcscpy(szAPI,szSQLSETCONNECTOPTION);
  }

  if(rc != SQL_SUCCESS)
  {
    if(!FindError(SQL_HANDLE_DBC,szHYC00))
      RETCHECK(SQL_SUCCESS, rc,szAPI);
  }
  else
  {
    if(sdw != TEST_CONNECT_OPTION && fConnectOption)
      DISPLAYERROR(szAPI,TEXT("SQL_LOGIN_TIMEOUT returned incorrect value"));
  }

  rc=SQLFreeConnect(lhdbc);
  RETCHECK(SQL_SUCCESS, rc,szSQLFREECONNECT);

} //TestConnectionOptions()

void PASCAL TestCopyDesc ( QTSTRUCT * lpqt )

Definition at line 6147 of file quiktest.c.

{
  SQLRETURN rc=SQL_SUCCESS;
  SQLUSMALLINT iDescType;
  SQLSMALLINT swExpRecCount;

  SQLHDESC hdesc1=NULL, hdesc2=NULL;
  PTR rgbValue=NULL;
  TCHAR   szName[MAX_DESC_BUF]=TEXT("");
  TCHAR   szQuery[XLARGEBUFF]=TEXT("");

  ResetHstmt(&hstmt);

  // Allocate a default descriptor
  rc = SQLAllocHandle(SQL_HANDLE_DESC, hdbc, &hdesc);

  if (RC_SUCCESSFUL(rc))
  {

    if (!Supported(SQL_API_SQLCOPYDESC))
    {
      rc = SQLCopyDesc(hdesc, hdesc1);

      if(!FindError(SQL_HANDLE_DESC,szIM001))
        DISPLAYERROR(szSQLCOPYDESC, szNotSupported);
      RETCHECK(SQL_ERROR, rc,szSQLCOPYDESC);
    }
    else
    {

      // Perform a select stmt
      wsprintf(szQuery,szSELECTSTAR,lpqt->szTableName);
      rc = SQLExecDirect(hstmt, szQuery, SQL_NTS);
      RETCHECK(SQL_SUCCESS, rc,szSQLEXECDIRECT);

      // For each descriptor type
      for (iDescType=0; iDescType < sizeof(DescTypes)/sizeof(DescTypes[0]); iDescType++)
      {
        // Get the handle for the automatically allocated descriptor
        rc = SQLGetStmtAttr(hstmt, DescTypes[iDescType].uwDescType, &hdesc1, sizeof(hdesc1), &cbValue);
        RETCHECK(SQL_SUCCESS, rc,szSQLGETSTMTATTR);

        // Create a descriptor record so we have something to read besides header
        swExpRecCount=CreateDescRecord(hdesc1, hstmt, DescTypes[iDescType].uwDescType);

        // Update all descriptor records to new values
        CheckDescriptor(hdesc1, DESC_UPDATE_MODE_WRITE, hstmt, iDescType);

        // Copy the descriptor to the newly allocated descriptor
        rc = SQLCopyDesc(hdesc1, hdesc);
        ERRSHANDLE(SQL_HANDLE_DESC, hdesc1, SQL_SUCCESS, rc, szSQLCOPYDESC);
        ERRSHANDLE(SQL_HANDLE_DESC, hdesc, SQL_SUCCESS, rc, szSQLCOPYDESC);

        // Compare each field in the copied descriptor to the original
        if (RC_SUCCESSFUL(rc))
          CompareDescriptor(hdesc1, hdesc, iDescType, szSQLCOPYDESC);
      }

    }

    // Free descriptor handle
    if (hdesc)
    {
      rc = SQLFreeHandle(SQL_HANDLE_DESC, hdesc);
      RETCHECK(SQL_SUCCESS, rc,szSQLFREEHANDLE);
    }

    ResetHstmt(&hstmt);
  }

} //TestCopyDesc()

VOID PASCAL TestCursorName ( QTSTRUCT * lpqt )

Definition at line 7101 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;
  TCHAR           szCursorName[MEDBUFF];
  SWORD           cb=0;

  SelectFromTable(lpqt);

  /* the cursor name should be created by the driver since one was        */
  /* not specified                                                                                                                                        */

  rc = SQLGetCursorName(hstmt, szCursorName, sizeof(szCursorName)/sizeof(TCHAR), &cb);
  RETCHECK(SQL_SUCCESS, rc,szSQLGETCURSORNAME);

  if(cb > MAX_STRING_SIZE)
  {
    DISPLAYERROR(szSQLGETCURSORNAME,TEXT("invalid cb"));
    cb = MAX_STRING_SIZE;
  }

  /* don't check the name itself, just make sure that     */
  /*      something was returned                                                                          */
  if(!*szCursorName)
    DISPLAYERROR(szSQLGETCURSORNAME,TEXT("no name returned"));

  FreeStmt(SQL_CLOSE);

} /* TestCursorName() */

void PASCAL TestData | ( | QTSTRUCT * | lpqt,
 |  | FIELDINFO * | rgFields,
 |  | UWORD | cTypes,
 |  | DSTRUCT * | lpd
 | ) |  |

Definition at line 3260 of file quiktest.c.

{

  /* bind all fields to a variable of the correct type for retreiving data */
  if (!BindAllColumns(lpqt,rgFields,cTypes,lpd))
    return;

  SelectFromTable(lpqt);

  RetrieveData(lpqt,rgFields,cTypes,lpd);

} // TestData()

void PASCAL TestDescDefaults ( QTSTRUCT * lpqt )

Definition at line 6223 of file quiktest.c.

{
  SQLRETURN rc=SQL_SUCCESS;
  SQLINTEGER cbValue;
  SQLSMALLINT swDescRec;
  SQLUSMALLINT iDescField, iStartField=0, iDescType;

  if (Supported(SQL_API_SQLGETDESCFIELD))
  {

    // Reallocate hstmt to check defaults against
    ResetHstmt(&hstmt);

    // For each descriptor type
    for (iDescType=0; iDescType < sizeof(DescTypes)/sizeof(DescTypes[0]); iDescType++)
    {
      // Get the handle for the descriptor
      rc = SQLGetStmtAttr(hstmt, DescTypes[iDescType].uwDescType, &hdesc, sizeof(hdesc), NULL);
      RETCHECK(SQL_SUCCESS, rc,szSQLGETSTMTATTR);

      swDescRec=0;

      // For each descriptor field, read the value
      for (iDescField=iStartField; iDescField < sizeof(rgDescInfo)/sizeof(rgDescInfo[0]); iDescField++) {

        // If we've gone past the header fields, then create a record and check record fields
        if (0 == swDescRec && !rgDescInfo[iDescField].fHeader) {
          iStartField=iDescField;
          // Make sure we're not on the IRD, 'cause you can't modify an IRD
          if (SQL_ATTR_IMP_ROW_DESC != DescTypes[iDescType].uwDescType)
          {
            // Create a record with all default values
            rc = SQLSetDescField(hdesc, 0, SQL_DESC_COUNT, (SQLPOINTER)1,
              SQL_IS_SMALLINT);
            RETCHECK(SQL_SUCCESS, rc,szSQLSETDESCFIELD);

            swDescRec++;
          }
          continue;
        }

        // If the field has a default value
        if (rgDescInfo[iDescField].fDefault & DescTypes[iDescType].uwTypeMask)
        {
          // Read from the field
          rc = SQLGetDescField(hdesc, swDescRec, rgDescInfo[iDescField].uwDescField,
            &DescBuf, sizeof(DescBuf), &cbValue);
          RETCHECK(SQL_SUCCESS, rc,szSQLGETDESCFIELD);

          if (RC_SUCCESSFUL(rc))
          {
            // Perform the compare
            if (memcmp(DescBuf, &rgDescInfo[iDescField].DefaultVal, cbValue))
            {
              // Compare error, print message
              wsprintf(buf,TEXT("Error in %s field %s default value"),
                DescTypes[iDescType].szDescName,rgDescInfo[iDescField].szDescFieldName);
              DISPLAYERROR(szSQLGETDESCFIELD, buf);
            }
          }
        }
      }
    }
  }
} // TestDescDefaults

void PASCAL TestDiagField ( )

Definition at line 1545 of file quiktest.c.

{
  SQLRETURN       rcFunction,
          rc=SQL_SUCCESS;
  SWORD                   cbValue=0;
  UWORD                   iHandle=0,
          iField=0,
          cHandles;

  TCHAR                   szDataSourceName[MAX_STRING_SIZE] = TEXT("");
  TCHAR                   rgbValue[SQL_MAX_MESSAGE_LENGTH];
  TCHAR                   szAPI[MEDBUFF]=TEXT("");
  TCHAR                   szBuff[MEDBUFF]=TEXT("");
  RETCODE         rcExp=SQL_SUCCESS;

  HANDLES rgHandles[] =
  {
    SQL_HANDLE_ENV, henv,
    SQL_HANDLE_DBC, hdbc,
    SQL_HANDLE_STMT, hstmt,
    SQL_HANDLE_DESC, hdesc,
  };

  cHandles=sizeof(rgHandles)/sizeof(HANDLES);

  /* Call SQLGetInfo to get values to compare: */
  rcFunction = SQLGetInfo(hdbc, SQL_DATA_SOURCE_NAME,
    szDataSourceName, sizeof(szDataSourceName), NULL);
  RETCHECK(SQL_SUCCESS, rcFunction, szSQLGETINFO);

  hdesc = SQL_NULL_HDESC;

  /* Allocate an hdesc: */
  if(Supported(SQL_API_SQLALLOCHANDLE) && g_f3XDriver)
  {
    rcFunction = SQLAllocHandle(SQL_HANDLE_DESC, hdbc, &hdesc);
    RETCHECK(SQL_SUCCESS, rcFunction, szSQLALLOCHANDLE);

    // Update the array entry for the hdesc
    rgHandles[3].hHandle=hdesc;

  }
  else
    cHandles--;

  for (iHandle=0; iHandle < cHandles; iHandle++)
  {

    SetErrorCondition(rgHandles[iHandle].fHandleType);

    if(fDiagFieldSupported)
    {
      for (iField=0;iField < sizeof(rgDiagInfo)/sizeof(struct tagDIAGINFO);iField++)
      {
        rc = SQLGetDiagField(rgHandles[iHandle].fHandleType, rgHandles[iHandle].hHandle,
              rgDiagInfo[iField].irecRecNumber, rgDiagInfo[iField].uwDescField,
              rgbValue, SQL_MAX_MESSAGE_LENGTH, &cbValue);

        DIAGRETCHECK(rcExp, rc, szSQLGETDIAGFIELD);

        if (RC_SUCCESSFUL(rc))
          CheckData(rgHandles[iHandle].fHandleType,rgDiagInfo[iField].uwDescField,
            rgbValue,szDataSourceName);
      }

    }
    else
    {
      rc = SQLGetDiagField(SQL_HANDLE_ENV, henv, 0, SQL_DIAG_RETURNCODE, rgbValue,SQL_MAX_MESSAGE_LENGTH, &cbValue);

      if(!FindError(rgHandles[iHandle].fHandleType, szIM001))
        DISPLAYERROR(szAPI, szNotSupported);

    }

  }

  /* Free the hdesc: */
  if (hdesc)
  {
    rcFunction = SQLFreeHandle(SQL_HANDLE_DESC, hdesc);
    RETCHECK(rcExp, rcFunction, szSQLFREEHANDLE);
    hdesc = SQL_NULL_HDESC;
  }

//ExitTestDiagField

  FreeStmt(SQL_CLOSE);

} /* TestDiagField() */

void PASCAL TestDiagRec ( )

Definition at line 1435 of file quiktest.c.

{
  SQLRETURN       rcFunction,
          rc=SQL_SUCCESS;
  SWORD                   cbErrorMsg;
  SDWORD          fNativeError;
  UWORD                   iHandle=0,
          iField=0,
          cHandles;

  SDWORD          *pfNativeError = NULL;
  LPTSTR          pchMessageText = NULL;

  TCHAR                   szDataSourceName[MAX_STRING_SIZE] = TEXT("");
  TCHAR                   szState[SQL_SQLSTATE_SIZE+1];
  TCHAR                   szErrorMsg[SQL_MAX_MESSAGE_LENGTH];
  TCHAR                   szAPI[MEDBUFF]=TEXT("");
  TCHAR                   szBuff[MEDBUFF]=TEXT("");

  LPTSTR          pszExpState=szHY009;
  RETCODE         rcExp=SQL_SUCCESS;

  HANDLES rgHandles[] =
  {
    SQL_HANDLE_ENV, henv,
    SQL_HANDLE_DBC, hdbc,
    SQL_HANDLE_STMT, hstmt,
    SQL_HANDLE_DESC, hdesc,
  };

  cHandles=sizeof(rgHandles)/sizeof(HANDLES);

  /* Call SQLGetInfo to get values to compare: */
  rcFunction = SQLGetInfo(hdbc, SQL_DATA_SOURCE_NAME,
    szDataSourceName, sizeof(szDataSourceName), NULL);
  RETCHECK(SQL_SUCCESS, rcFunction, szSQLGETINFO);

  /* Allocate an hdesc: */
  if(Supported(SQL_API_SQLALLOCHANDLE) && g_f3XDriver)
  {
    rcFunction = SQLAllocHandle(SQL_HANDLE_DESC, hdbc, &hdesc);
    RETCHECK(SQL_SUCCESS, rcFunction, szSQLALLOCHANDLE);

    // Update the array entry for the hdesc
    rgHandles[3].hHandle=hdesc;

  }
  else
    cHandles--;

  for (iHandle=0; iHandle < cHandles; iHandle++)
  {

    SetErrorCondition(rgHandles[iHandle].fHandleType);

    rc = SQLGetDiagRec(rgHandles[iHandle].fHandleType, rgHandles[iHandle].hHandle,
          1,szState,&fNativeError, szErrorMsg,
          SQL_MAX_MESSAGE_LENGTH, &cbErrorMsg);

    if (rgHandles[iHandle].fHandleType == SQL_HANDLE_DESC)
      pszExpState=szHY091;

    rcExp=SQL_SUCCESS;

    if(fDiagRecSupported)
    {

      DIAGRETCHECK(rcExp, rc, szSQLGETDIAGREC);
      if (RC_SUCCESSFUL(rc) && _tcscmp(szState,pszExpState))
      {
        wsprintf(szBuff,TEXT("\t\t\tReceived: %s\tExpected: %s"),szState,       pszExpState);
        DISPLAYERROR(szSQLGETDIAGREC,szBuff);
      }
    }
    else
    {
      if(!FindError(rgHandles[iHandle].fHandleType, szIM001))
        DISPLAYERROR(szSQLGETDIAGREC, szNotSupported);
    }

  }

  /* Free the hdesc: */
  if (hdesc)
  {
    rcFunction = SQLFreeHandle(SQL_HANDLE_DESC, hdesc);
    RETCHECK(rcExp, rcFunction, szSQLFREEHANDLE);
    hdesc = SQL_NULL_HDESC;
  }

//ExitTestDiagRec

  FreeStmt(SQL_CLOSE);

} /* TestDiagRec() */

void PASCAL TestEndTran | ( | QTSTRUCT * | lpqt,
 |  | FIELDINFO * | rgFields,
 |  | UWORD | cTypes,
 |  | DSTRUCT * | lpd
 | ) |  |

Definition at line 6756 of file quiktest.c.

{
  SWORD                           i;
  RETCODE                         rc;
  SWORD                           sTXN;
  SWORD                           sRowCnt_Pre;
  SWORD                           sRowCnt_Aft;
  SQLSMALLINT             fHandleType[]={SQL_HANDLE_ENV, SQL_HANDLE_DBC};
  SDWORD                  cbValue=0;

  //check if transaction is supported
  rc = SQLGetInfo(hdbc, SQL_TXN_CAPABLE, &sTXN, sizeof(sTXN), NULL);
  RETCHECK(SQL_SUCCESS, rc,szSQLGETINFO);

  //check both henv and hdbc handle
  for(i=0; i<=1; i++)
  {

    //get the row count of the table
    sRowCnt_Pre = GetRowCnt(lpqt);

    //check if SQLEndTran is supported
    if(Supported(SQL_API_SQLENDTRAN))
    {
      if(sTXN != SQL_TC_NONE)
      {
        //set the autocommit to off
        SetConnectionAttributes(hdbc,SQL_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF);

        //insert one row, and call SQLEndTran to roll back the transction
        sRowCnt_Aft = ExecEndTran(lpqt,rgFields,cTypes,lpd,fHandleType[i],SQL_ROLLBACK,(UWORD)(guwRowCount));

        //the row count should be the same
        if(sRowCnt_Aft != sRowCnt_Pre)
          DISPLAYERROR(szSQLENDTRAN,TEXT("Did not Roll Back the insert transaction"));
      }

      //insert one row, and call SQLEndTran to commit the transction
      sRowCnt_Aft = ExecEndTran(lpqt,rgFields,cTypes,lpd,fHandleType[i],SQL_COMMIT,(UWORD)(guwRowCount));

      //the row count should be increased by 1
      if(sRowCnt_Aft != (sRowCnt_Pre+1) )
        DISPLAYERROR(szSQLENDTRAN,TEXT("Did not commit the insert transaction"));

      if( sTXN != SQL_TC_NONE)
      {
        //set the autocommit to off
        SetConnectionAttributes(hdbc,SQL_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF);
      }

    }//end of the situation where SQLEndTran is supported
    else
    {

      switch(fHandleType[i])
      {
        case SQL_HANDLE_ENV:
          rc= SQLEndTran(fHandleType[i],henv,SQL_COMMIT);
          break;
        case SQL_HANDLE_DBC:
          rc= SQLEndTran(fHandleType[i],hdbc,SQL_ROLLBACK);
          break;
      }

      //check error msg
      if(!FindError(fHandleType[i],szIM001))
        DISPLAYERROR(szSQLENDTRAN,TEXT("Did not return not Supported Message"));

      RETCHECK(SQL_ERROR, rc,szSQLENDTRAN);

      //free the hstmt handle
      FreeStmt(SQL_CLOSE);

    }//end of error msg checking

  }//end of the loop to check both henv and hdbc

  // Commit the transaction started in GetRowCnt inside ExecEndTran
  rc= SQLEndTran(SQL_HANDLE_ENV,henv,SQL_COMMIT);
  RETCHECK(SQL_SUCCESS, rc,szSQLENDTRAN);

  SetConnectionAttributes(hdbc,SQL_AUTOCOMMIT, SQL_AUTOCOMMIT_ON);

  //free the hstmt handle
  FreeStmt(SQL_CLOSE);

} // TestEndTran()

void PASCAL TestEnvAttr ( )

Definition at line 6471 of file quiktest.c.

{
  SQLINTEGER      sdwEnvAttr;
  SQLRETURN       rc;
  HENV                    tshenv;
  BOOL                    fSetSupported = Supported(SQL_API_SQLSETENVATTR),
          fGetSupported = Supported(SQL_API_SQLGETENVATTR);
  LONG DEFAULT_ODBC_VERSION;

  //allocate an enviroment handle
  rc = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &tshenv);
  RETCHECK(SQL_SUCCESS, rc,szSQLALLOCHANDLE);

  //-------------------------------
  //-------- SQLSetEnvAttr --------
  //-------------------------------
  // Set to SQL_FALSE
  rc = SQLSetEnvAttr(tshenv, SQL_ATTR_ODBC_VERSION, (PTR)SQL_OV_ODBC3,
    SQL_IS_UINTEGER);

  if(!fSetSupported)
  {
    if (!FindError(SQL_HANDLE_ENV,szIM001))
      DISPLAYERROR(szSQLSETENVATTR, szNotSupported);

    RETCHECK(SQL_ERROR, rc,szSQLSETENVATTR);
  }
  else
    RETCHECK(SQL_SUCCESS, rc,szSQLSETENVATTR);

  if (RC_SUCCESSFUL(rc))
  {
    // Read it again
    rc = SQLGetEnvAttr(tshenv, SQL_ATTR_ODBC_VERSION, &sdwEnvAttr,
      sizeof(sdwEnvAttr), NULL);

    if(!fGetSupported)
    {
      if (!FindError(SQL_HANDLE_ENV,szIM001))
        DISPLAYERROR(szSQLGETENVATTR, szNotSupported);

      RETCHECK(SQL_ERROR, rc,szSQLGETENVATTR);
    }
    else
      RETCHECK(SQL_SUCCESS, rc,szSQLGETENVATTR);

    if (RC_SUCCESSFUL(rc) && (SQL_OV_ODBC3 != sdwEnvAttr))
    {
      // New value wrong
      DISPLAYERROR(szSQLSETENVATTR,TEXT("Unable to set environment attribute SQL_ATTR_ODBC_VERSION to SQL_OV_ODBC3."));
    }
  }

  rc = SQLFreeHandle(SQL_HANDLE_ENV,tshenv);
  RETCHECK(SQL_SUCCESS, rc,szSQLFREEHANDLE);

  //-------------------------------
  //-------- SQLGetEnvAttr --------
  //-------------------------------
  rc = SQLAllocEnv(&tshenv);
  RETCHECK(SQL_SUCCESS, rc,szSQLALLOCENV);

  rc = SQLGetEnvAttr(tshenv, SQL_ATTR_ODBC_VERSION, &sdwEnvAttr,
    sizeof(sdwEnvAttr), NULL);

  if(!fGetSupported)
  {
    if (!FindError(SQL_HANDLE_ENV,szIM001))
      DISPLAYERROR(szSQLGETENVATTR, szNotSupported);

    RETCHECK(SQL_ERROR, rc,szSQLGETENVATTR);
  }
  else
    RETCHECK(SQL_SUCCESS, rc,szSQLGETENVATTR);

  DEFAULT_ODBC_VERSION = SQL_OV_ODBC2;

  if (RC_SUCCESSFUL(rc) && (DEFAULT_ODBC_VERSION != sdwEnvAttr))
  {
    // Default value wrong
    wsprintf(buf, TEXT("Value was not %d!"), DEFAULT_ODBC_VERSION);
    DISPLAYERROR(szSQLGETENVATTR,buf);
  }

  rc = SQLFreeHandle(SQL_HANDLE_ENV,tshenv);
  RETCHECK(SQL_SUCCESS, rc,szSQLFREEHANDLE);

} //TestEnvAttr()

void PASCAL TestExtendedFetch | ( | QTSTRUCT * | lpqt,
 |  | FIELDINFO * | rgFields,
 |  | UWORD | cTypes
 | ) |  |

Definition at line 3792 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;
  WORD            fLevel2 = FALSE;
  DWORD           dwLen=0;
  SWORD           fSqlType;
  SDWORD  cbValue=0;
  UWORD           iTableCol,row,iCol,uwRowSetSize;
  TCHAR           szQuery[MAX_STRING_SIZE], szColName[SMALLBUFF];
  TCHAR*  rgbValue;
  DSTRUCT*        rgData;
  DSTRUCT*        pDataBuf;
  BOOL            fCol0Bound=TRUE;

  uwRowSetSize=5; /* Cinco seems like a good rowset size */

  /* Only col which might not be bound but might not be AutoUpdateable is col 0 */
  if(!qtMakeData(0, 0, &rgFields[0], szQuery))
    fCol0Bound = FALSE;

  SelectFromTable(lpqt);

  rc = SQLBindCol(hstmt, 1, SQL_C_BINARY, lpqt->sz, MAX_BIND_ARRAY_ELEMENT,
    &cbValue);
  RETCHECK(SQL_SUCCESS, rc,szSQLBINDCOL);

  if (!Supported(SQL_API_SQLEXTENDEDFETCH))
  {
    rc = SQLExtendedFetch(hstmt, SQL_FETCH_FIRST, IGNORED, NULL, NULL);
    if(!FindError(SQL_HANDLE_STMT,szIM001))
      DISPLAYERROR(szSQLEXTENDEDFETCH, szNotSupported);
    RETCHECK(SQL_ERROR, rc,szSQLEXTENDEDFETCH);

    FreeStmt(SQL_CLOSE);
    return;
  }

  rc = SQLGetStmtOption(hstmt,SQL_CURSOR_TYPE,&dwLen);
  RETCHECK(SQL_SUCCESS, rc,szSQLGETSTMTOPTION);

  if(dwLen != SQL_CURSOR_FORWARD_ONLY)
    {
    rc = SQLExtendedFetch(hstmt, SQL_FETCH_FIRST, IGNORED, NULL, NULL);
    RETCHECK(SQL_SUCCESS, rc,szSQLEXTENDEDFETCH);
    }
  else
    {
    rc = SQLExtendedFetch(hstmt, SQL_FETCH_FIRST, IGNORED, NULL, NULL);
    RETCHECK(SQL_ERROR, rc,szSQLEXTENDEDFETCH);
    }

  rc = SQLFreeStmt(hstmt, SQL_CLOSE);
  RETCHECK(SQL_SUCCESS, rc, szSQLFREESTMT);

  rc = SQLFreeStmt(hstmt, SQL_UNBIND);
  RETCHECK(SQL_SUCCESS, rc, szSQLFREESTMT);

  rc = SQLFreeStmt(hstmt, SQL_RESET_PARAMS);
  RETCHECK(SQL_SUCCESS, rc, szSQLFREESTMT);

  /* Allocate an area for ExtendedFetch to take place */
  if (!(rgData = AllocateMemory(sizeof(DSTRUCT)*cTypes*uwRowSetSize))){
    DISPLAYERROR(szSQLEXTENDEDFETCH,TEXT("Insufficient Memory Available"));
    return;
  }

  /* Allocate an area for test data */
  if (!(rgbValue = AllocateMemory(MAX_STRING_SIZE*sizeof(TCHAR)))){
    DISPLAYERROR(szSQLEXTENDEDFETCH,TEXT("Insufficient Memory Available"));
    ReleaseMemory(rgData);
    return;
  }

  /* Get column for "order by" clause: */
  wsprintf(szQuery,TEXT("select %s from %s"),lpqt->szColNames, lpqt->szTableName);
  rc = SQLExecDirect(hstmt, szQuery, SQL_NTS);
  if((SQL_SUCCESS!=rc) && (SQL_SUCCESS_WITH_INFO!=rc)){
    RETCHECK(SQL_SUCCESS_WITH_INFO, rc, szSQLEXECDIRECT);
    goto abortxfetch;
  }
  iCol=0;
  do      {
    iCol++;
    rc=SQLDescribeCol(hstmt, iCol, szColName, SMALLBUFF,
      NULL, &fSqlType, NULL, NULL, NULL);
    RETCHECK(SQL_SUCCESS, rc,szSQLDESCRIBECOL);
  } while(fSqlType!=SQL_CHAR && iCol<=cTypes);

  FreeStmt(SQL_CLOSE);
  if(iCol>cTypes){
    DISPLAYERROR(szSQLEXTENDEDFETCH, TEXT("\t\t\tSelect-order by  Failed"));
    goto abortxfetch;
  }

  /* Set rowset size and set to row-wise binding:  */
  rc = SQLSetStmtOption(hstmt, SQL_ROWSET_SIZE, (UDWORD)uwRowSetSize);
  if (SQL_SUCCESS != rc){
    DISPLAYERROR(TEXT("ExtendedFetch...SQLSetStmtOption(Rowset_Size)"),
      TEXT("SQLSetStmtOption Failed"));
    GetErrors(henv, hdbc,hstmt);
  }
  rc = SQLSetStmtOption(hstmt, SQL_BIND_TYPE, (sizeof(DSTRUCT)*cTypes));
  if (SQL_SUCCESS != rc){
    DISPLAYERROR(TEXT("ExtendedFetch...SQLSetStmtOption(Bind_Type)"),
      TEXT("SQLSetStmtOption Failed"));
    GetErrors(henv, hdbc,hstmt);
  }

  if(SQL_SUCCESS != SelectFromTableFetch(lpqt, szColName)){
    DISPLAYERROR(szSQLEXTENDEDFETCH, TEXT("\t\t\tSelect-order by  Failed"));
    goto abortxfetch;
  }
  if (!BindFetchColumns(lpqt, rgFields, cTypes, rgData)){
    DISPLAYERROR(szSQLEXTENDEDFETCH, szSQLBINDCOL);
    goto abortxfetch;
  }
  /* Fetch into allocated area rowset to be tested */
  rc = SQLExtendedFetch(hstmt, SQL_FETCH_NEXT, 1, NULL, NULL);
  if (SQL_SUCCESS != rc){
    RETCHECK(SQL_SUCCESS, rc,szSQLEXTENDEDFETCH);
    DISPLAYERROR(szSQLEXTENDEDFETCH, TEXT("Fetch Failed"));
    goto abortxfetch;
  }

  rc = SQLFreeStmt(hstmt, SQL_CLOSE);
  RETCHECK(SQL_SUCCESS, rc, szSQLFREESTMT);

  rc = SQLFreeStmt(hstmt, SQL_UNBIND);
  RETCHECK(SQL_SUCCESS, rc, szSQLFREESTMT);

  /* Set rowset size to "1" to test each row of rowset independently:  */
  rc = SQLSetStmtOption(hstmt, SQL_ROWSET_SIZE, (UDWORD)(1));
  if (SQL_SUCCESS != rc){
    DISPLAYERROR(TEXT("ExtendedFetch...SQLSetStmtOption(Rowset_Size)"),
      TEXT("SQLSetStmtOption Failed"));
    GetErrors(henv, hdbc,hstmt);
  }

  /* Check data in all rows of rowset */
  if(SQL_SUCCESS != SelectFromTableFetch(lpqt, szColName)){
    DISPLAYERROR(szSQLEXTENDEDFETCH, TEXT("\t\t\tSelect-order by  Failed"));
    goto abortxfetch;
  }

  // Need to change this loop if number of rows in table < uwRowSetSize
  for (row=0; row<uwRowSetSize; row++)
  {
    SWORD iResultSetCol=0;
    if (SQL_SUCCESS != (rc = SQLFetch(hstmt))){
      RETCHECK(SQL_SUCCESS, rc, szSQLFETCH);
      DISPLAYERROR(szSQLEXTENDEDFETCH, TEXT("Fetch Failed"));
      goto abortxfetch;
    }

    pDataBuf=rgData+row*cTypes;
    for (iTableCol=0; iTableCol<cTypes; iTableCol++)
    {
      /* Ignore columns which aren't bound as they aren't in the result set */
      if((!iTableCol && !fCol0Bound) || rgFields[iTableCol].fAutoUpdate)
        continue;

      iResultSetCol++;
      rc = SQLGetData(hstmt, iResultSetCol, SQL_C_TCHAR, rgbValue, MAX_STRING_SIZE*sizeof(TCHAR),
        &cbValue);
      if(rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO)
        RETCHECK(SQL_SUCCESS, rc,szSQLGETDATA);

      if(!CheckDataResults(row, iTableCol, &rgFields[iTableCol], pDataBuf,cbValue,rgbValue))
      {
        wsprintf(lpqt->buf, TEXT("Data Check Failed, Row %d, Table Col %d, DataType %d (%s)"),
          row, iTableCol, rgFields[iTableCol].wSQLType, rgFields[iTableCol].szFieldName) ;
        szWrite(lpqt->buf,FALSE);
        rgbValue[MAX_STRING_SIZE-1]=TEXT('\0');
        wsprintf(lpqt->buf, TEXT("Returned Data: (%s)"), rgbValue);
        DISPLAYERROR(TEXT("ExtendedFetch"),lpqt->buf);
        // goto abortxfetch;
      }
    }
  }

abortxfetch:
  FreeStmt(SQL_CLOSE);
  FreeStmt(SQL_UNBIND);
  ReleaseMemory(rgData);
  ReleaseMemory(rgbValue);
} /* TestExtendedFetch() */

void PASCAL TestFetchScroll ( QTSTRUCT * lpqt )

Definition at line 6900 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;
  TCHAR           szSave[MAX_QUERY_SIZE];
  DWORD           dwLen=0;
  SDWORD  cbValue=0;

  /* check if SQLGetFunctions says your API is supported */
  if(!Supported( SQL_API_SQLFETCHSCROLL))
  {
    /* Call your 3.0 API here and verify that the correct state is returned */
    rc = SQLFetchScroll(hstmt,SQL_FETCH_FIRST, 0);
    if(!FindError(SQL_HANDLE_STMT,szIM001))
      DISPLAYERROR(szSQLFETCHSCROLL, szNotSupported);
    RETCHECK(SQL_ERROR, rc, szSQLFETCHSCROLL);
  }
  else
  {
    ResetHstmt(&hstmt);

    /* Valid Testing of SQLFetchScroll */
    SelectFromTable(lpqt);

    rc = SQLBindCol(hstmt, 1, SQL_C_TCHAR, lpqt->sz, sizeof(lpqt->sz),
      &cbValue);
    RETCHECK(SQL_SUCCESS, rc, szSQLBINDCOL);

    rc = SQLFetchScroll(hstmt, SQL_FETCH_NEXT, 3);
    RETCHECK(SQL_SUCCESS, rc, szSQLFETCHSCROLL);
    _tcscpy(szSave,lpqt->sz);

    rc = SQLFetchScroll(hstmt, SQL_FETCH_PRIOR, 1);
    RETCHECK(SQL_ERROR, rc, szSQLFETCHSCROLL);

    rc = SQLFetchScroll(hstmt, SQL_FETCH_FIRST, 0);
    RETCHECK(SQL_ERROR, rc, szSQLFETCHSCROLL);

    rc = SQLFetchScroll(hstmt, SQL_FETCH_LAST, 0);
    RETCHECK(SQL_ERROR, rc, szSQLFETCHSCROLL);

    rc = SQLFreeStmt(hstmt, SQL_CLOSE);
    RETCHECK(SQL_SUCCESS, rc, szSQLFREESTMT);

  }

  //free the hstmt handle
  FreeStmt(SQL_CLOSE);

} // TestFetchScroll()

void PASCAL TestGetDescField ( QTSTRUCT * lpqt )

Definition at line 5775 of file quiktest.c.

{
  SQLRETURN rc=SQL_SUCCESS;
  SQLUSMALLINT iDescType;

  SQLHDESC hdesc1=NULL, hdesc2=NULL;
  PTR rgbValue=NULL;
  SQLSMALLINT swDescRecCount, swExpRecCount;
  SQLINTEGER cbValue;
  TCHAR   szName[MAX_DESC_BUF]=TEXT("");
  TCHAR   szQuery[XLARGEBUFF]=TEXT("");

  if (!Supported(SQL_API_SQLGETDESCFIELD))
  {
    // Allocate a default descriptor
    rc = SQLAllocHandle(SQL_HANDLE_DESC, hdbc, &hdesc);

    if (RC_SUCCESSFUL(rc))
    {
      rc = SQLGetDescField(hdesc, 0, SQL_DESC_COUNT, &DescBuf, sizeof(DescBuf),
        &cbValue);

      if(!FindError(SQL_HANDLE_DESC,szIM001))
        DISPLAYERROR(szSQLGETDESCFIELD, szNotSupported);
      RETCHECK(SQL_ERROR, rc,szSQLGETDESCFIELD);
    }
  }
  else
  {
    // Make sure all parameters and columns are unbound
    ResetHstmt(&hstmt);

    // Perform a select stmt
    wsprintf(szQuery,szSELECTSTAR,lpqt->szTableName);
    rc = SQLExecDirect(hstmt, szQuery, SQL_NTS);
    RETCHECK(SQL_SUCCESS, rc,szSQLEXECDIRECT);

    // For each descriptor type
    for (iDescType=0; iDescType < sizeof(DescTypes)/sizeof(DescTypes[0]); iDescType++)
    {

      // Get the handle for the automatically allocated descriptor
      rc = SQLGetStmtAttr(hstmt, DescTypes[iDescType].uwDescType, &hdesc1, sizeof(hdesc1), &cbValue);
      RETCHECK(SQL_SUCCESS, rc,szSQLGETSTMTATTR);

      // Create a descriptor record so we have something to read besides header
      swExpRecCount=CreateDescRecord(hdesc1, hstmt, DescTypes[iDescType].uwDescType);

      // Get the count of descriptor records (iRecord ignored for header fields)
      rc = SQLGetDescField(hdesc1, 0, SQL_DESC_COUNT, &swDescRecCount,
        sizeof(swDescRecCount), &cbValue);

      if (SQL_SUCCEEDED(rc))
      {
        // Check count value for expected
        if (swExpRecCount != swDescRecCount)
        {
          wsprintf(buf,TEXT("Expected record count %d, found %d"),
            swExpRecCount, swDescRecCount);
          DISPLAYERROR(szSQLGETDESCFIELD, buf);
        }

        CheckDescriptor(hdesc1, DESC_UPDATE_MODE_READ, hstmt, iDescType);
      }
      else
      {
        // Unable to read record count from descriptor header, can't proceed
        wsprintf(buf,TEXT("Unable to read record count from descriptor header for descriptor type %d"),
          DescTypes[iDescType].szDescName);
        ERRSHANDLE(SQL_HANDLE_DESC, hdesc1, SQL_SUCCESS, rc, buf);
      }
    }

    rc=SQLCloseCursor(hstmt);
    RETCHECK(SQL_SUCCESS, rc,szSQLCLOSECURSOR);
  }

} // TestGetDescField()

void PASCAL TestGetDescRec ( QTSTRUCT * lpqt )

Definition at line 5924 of file quiktest.c.

{
  SQLRETURN rc=SQL_SUCCESS;
  SQLUSMALLINT iDescType;

  SQLHDESC hdesc1=NULL, hdesc2=NULL;
  PTR rgbValue=NULL;
        SQLSMALLINT swDescRec, swDescRecCount, iRecord=0, cbName, fType, fSubType,
    Precision, Scale, Nullable, swExpRecCount;
  SQLINTEGER Length, cbValue;
  TCHAR   szName[MAX_DESC_BUF]=TEXT("");
  TCHAR   szQuery[XLARGEBUFF]=TEXT("");

  if (!Supported(SQL_API_SQLGETDESCREC))
  {
    // Allocate a default descriptor
    rc = SQLAllocHandle(SQL_HANDLE_DESC, hdbc, &hdesc);

    if (RC_SUCCESSFUL(rc))
    {
      rc = SQLGetDescRec(hdesc, iRecord, szName, MAX_DESC_BUF, &cbName, &fType,
        &fSubType, &Length, &Precision, &Scale, &Nullable);

      if(!FindError(SQL_HANDLE_DESC,szIM001))
        DISPLAYERROR(szSQLGETDESCREC, szNotSupported);
      RETCHECK(SQL_ERROR, rc,szSQLGETDESCREC);
    }
  }
  else
  {
    // Make sure all parameters and columns are unbound
    ResetHstmt(&hstmt);

    // Turn on bookmarks so we can retrieve from record 0 of ARD
    rc = SQLSetStmtAttr(hstmt, SQL_ATTR_USE_BOOKMARKS, (SQLPOINTER)SQL_UB_ON, SQL_IS_INTEGER);
    RETCHECK(SQL_SUCCESS, rc,szSQLSETSTMTATTR);

    // Perform a select stmt
    wsprintf(szQuery,szSELECTSTAR,lpqt->szTableName);
    rc = SQLExecDirect(hstmt, szQuery, SQL_NTS);
    RETCHECK(SQL_SUCCESS, rc,szSQLEXECDIRECT);

    // For each descriptor type
    for (iDescType=0; iDescType < sizeof(DescTypes)/sizeof(DescTypes[0]); iDescType++)
    {

      // Get the handle for the automatically allocated descriptor
      rc = SQLGetStmtAttr(hstmt, DescTypes[iDescType].uwDescType, &hdesc1, sizeof(hdesc1), &cbValue);
      RETCHECK(SQL_SUCCESS, rc,szSQLGETSTMTATTR);

      // Create a descriptor record so we have something to read besides header
      swExpRecCount=CreateDescRecord(hdesc1, hstmt, DescTypes[iDescType].uwDescType);

      // Get the count of descriptor records
      // Count for automatically allocated descriptors is written in
      // SetDescField test.
      rc = SQLGetDescField(hdesc1, 0, SQL_DESC_COUNT, &swDescRecCount,
        sizeof(swDescRecCount), &cbValue);

      if (SQL_SUCCESS == rc)
      {

        // For all descriptor records
        for (swDescRec=0; swDescRec <= swDescRecCount+1; swDescRec++)
        {
            // Read the record
            rc = SQLGetDescRec(hdesc1, swDescRec, szName, sizeof(szName), &cbName, &fType,
              &fSubType, &Length, &Precision, &Scale, &Nullable);

            if (swDescRec <= swDescRecCount)
            {
              // Retrieving bookmark on IPD is an error
              if (SQL_ATTR_IMP_PARAM_DESC == DescTypes[iDescType].uwDescType && 0 == swDescRec)
              {
                wsprintf(buf,TEXT("%s: Able to read record %d from %s"),
                  szSQLGETDESCREC, swDescRec, DescTypes[iDescType].szDescName);
                ERRSHANDLE(SQL_HANDLE_DESC, hdesc1, SQL_ERROR, rc, buf);
              }
              else
              {
                wsprintf(buf,TEXT("%s: Unable to read record %d from %s"),
                  szSQLGETDESCREC, swDescRec, DescTypes[iDescType].szDescName);
                ERRSHANDLE(SQL_HANDLE_DESC, hdesc1, SQL_SUCCESS, rc, buf);
              }
            }
            else
            {
              wsprintf(buf,TEXT("%s: Did not receive SQL_NO_DATA reading record %d from %s"),
                szSQLGETDESCREC, swDescRec, DescTypes[iDescType].szDescName);
              ERRSHANDLE(SQL_HANDLE_DESC, hdesc1, SQL_NO_DATA, rc, buf);
            }
        }
      }
      else
      {
        // Unable to read record count from descriptor header, can't proceed
        wsprintf(buf,TEXT("\t\tUnable to read record count from descriptor header for %s"),
          DescTypes[iDescType].szDescName);
        ERRSHANDLE(SQL_HANDLE_DESC, hdesc1, SQL_SUCCESS, rc, buf);
      }
    }

    rc=SQLCloseCursor(hstmt);
    RETCHECK(SQL_SUCCESS, rc,szSQLCLOSECURSOR);

  }

} //TestGetDescRec()

void PASCAL TestLargeQuery | ( | QTSTRUCT * | lpqt,
 |  | FIELDINFO * | rgFields,
 |  | UWORD | cTypes,
 |  | DSTRUCT * | lpd
 | ) |  |

Definition at line 3470 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;
  UWORD           ind=0,
        i;
  LPTSTR  pch=NULL;
  TCHAR           szQuery[2048];

  /* > 1K query */
  wsprintf(szQuery,TEXT("select %s from %s where "), lpqt->szColNames,
    lpqt->szTableName);

  for(i = 0; i < cTypes; i++)
    {
    if (rgFields[i].fSearchable == SQL_SEARCHABLE ||
      rgFields[i].fSearchable == SQL_ALL_EXCEPT_LIKE)
      break;
    }

  pch = qtMakeData(cTypes, 1, &rgFields[i], lpqt->szDataItem);
  while(_tcslen(szQuery) < 1024L)
    {
    int li=_tcslen(szQuery);
    switch(rgFields[i].wSQLType)
      {
      case SQL_REAL:
      case SQL_FLOAT:
      case SQL_DOUBLE:
        wsprintf(&szQuery[_tcslen(szQuery)],TEXT("%s < %s + 1 and "),
          rgFields[i].szFieldName, pch);
        break;
      default:
        wsprintf(&szQuery[_tcslen(szQuery)],TEXT("%s = %s%s%s and "),
        rgFields[i].szFieldName, rgFields[i].szPrefix, pch, rgFields[i].szSuffix);
        break;
      }
    }

  /* remove the final "and " */
  szQuery[_tcslen(szQuery) - 5] = TEXT('\0');

  rc = SQLExecDirect(hstmt, szQuery, SQL_NTS);
  RETCHECK(SQL_SUCCESS, rc,szSQLEXECDIRECT);

  if (RC_SUCCESSFUL(rc))
    {
    for(i = 0;; i++)
      {
      rc = SQLFetch(hstmt);

      if(rc != SQL_SUCCESS)
        break;
      }

    RETCHECK(SQL_NO_DATA_FOUND, rc,szSQLFETCH);

    /* should have gotten at least 1 row back */

    if(i < 1)
      DISPLAYERROR(TEXT("> 1K query"),TEXT("incorrect number of rows returned"));

    }

  /* SQLFreeStmt with SQL_CLOSE to re-use the hstmt */

  FreeStmt(SQL_CLOSE);

} //TestLargeQuery()

void PASCAL TestLikeQuery | ( | QTSTRUCT * | lpqt,
 |  | FIELDINFO * | rgFields,
 |  | UWORD | cTypes,
 |  | DSTRUCT * | lpd
 | ) |  |

Definition at line 3705 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;
  UWORD   i;
  SDWORD  cbValue=0;

  for(i = 0; i < cTypes; i++)
    {
    if(rgFields[i].fSearchable == SQL_LIKE_ONLY ||
      rgFields[i].fSearchable == SQL_SEARCHABLE)
      {
      _tcscpy(lpqt->buf, rgFields[i].szFieldName);
      break;
      }
  }

  if(i < cTypes)
    {

    /* execute a query using like.  This query should return all records */
    /* this query should return all rows in the table                                                       */

    wsprintf(lpqt->sz,TEXT("select * from %s where %s not like 'a'"), lpqt->szTableName,
      lpqt->buf, lpqt->buf);
    rc = SQLExecDirect(hstmt, lpqt->sz, SQL_NTS);
    RETCHECK(SQL_SUCCESS, rc,szSQLEXECDIRECT);

    for(i = 0;; i++)
      {
      rc = SQLFetch(hstmt);
      if(rc != SQL_SUCCESS)
        break;

      rc = SQLGetData(hstmt, 1, SQL_C_TCHAR, lpqt->sz, sizeof(lpqt->sz),
        &cbValue);
      if(rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO)
        RETCHECK(SQL_SUCCESS, rc,szSQLGETDATA);
      }

    RETCHECK(SQL_NO_DATA_FOUND, rc,szSQLFETCH);

    if(i != cTypes)
      DISPLAYERROR(TEXT("'LIKE' query"),TEXT("incorrect number of result rows"));

    }

  FreeStmt(SQL_CLOSE);

} //TestLikeQuery()

void PASCAL TestMetaData | ( | lpSERVERINFO | lpSI,
 |  | QTSTRUCT * | lpqt,
 |  | FIELDINFO * | rgFields,
 |  | UWORD | cTypes
 | ) |  |

Definition at line 3015 of file quiktest.c.

{
  SWORD    wNum;
  UWORD    w;
  UWORD    i;
  UDWORD   dwLen;
  RETCODE rc=SQL_SUCCESS;
  SWORD           wType;
  SWORD           wNull;

  SelectFromTable(lpqt);

  for(i = 0, w = 0; i < cTypes; i++)
    {
    dwLen = 0;
    wNum = 0;
    wNull = 0;

    /* information returned by SQLDescribeCol should match info */
    /*      used to create table */

    if(!qtMakeData(1, i,&rgFields[i],lpqt->szDataItem))
      continue;

    w++;
    rc = SQLDescribeCol(hstmt, w, lpqt->buf,
      sizeof(lpqt->buf)/sizeof(TCHAR), NULL, &wType, &dwLen, &wNum, &wNull);
    RETCHECK(SQL_SUCCESS, rc,szSQLDESCRIBECOL);

    /* verify that column name returned is column name created */

    if(0 != _tcsicmp(rgFields[i].szFieldName, lpqt->buf))
      DISPLAYERROR(szSQLDESCRIBECOL,TEXT("incorrect column name"));

    if(wType != rgFields[i].wSQLType)
    {
      // For a 2.x driver, SQLGetTypeInfo result will be SQL_DATE, etc,
      // but 3.0 DM will convert SQLDescribeCol values to TYPE_DATE, ETC.
      if ((uDriverODBCVer < 3) &&
        ((SQL_TYPE_DATE == wType && SQL_DATE == rgFields[i].wSQLType) ||
        (SQL_TYPE_TIME == wType && SQL_TIME == rgFields[i].wSQLType) ||
        (SQL_TYPE_TIMESTAMP == wType && SQL_TIMESTAMP == rgFields[i].wSQLType)))
        NULL;
      else
        DISPLAYERROR(szSQLDESCRIBECOL,TEXT("incorrect SQLType"));
    }

    if(dwLen != (UDWORD)rgFields[i].precision)
      DISPLAYERROR(szSQLDESCRIBECOL,TEXT("incorrect precision"));

    if(wNum != rgFields[i].scale)
      DISPLAYERROR(szSQLDESCRIBECOL,TEXT("incorrect scale"));

    if(wNull != rgFields[i].nullable && wNull != SQL_NULLABLE_UNKNOWN &&
      rgFields[i].nullable != SQL_NULLABLE_UNKNOWN)
      {
      DISPLAYERROR(szSQLDESCRIBECOL,TEXT("incorrect nullable"));
      }
    }

  FreeStmt(SQL_CLOSE);

} //TestMetaData()

void PASCAL TestMixedAnsiUnicode ( QTSTRUCT * lpqt )

Definition at line 1784 of file quiktest.c.

{
  HDBC    hdbcANSI, hdbcUnicode;
  HSTMT hstmtANSIA, hstmtANSIW, hstmtUA, hstmtUW, hstmtW;
  SQLINTEGER cbANSI, cchUnicode;
  SQLWCHAR wszServer[MAX_STRING_SIZE], wszLogin[MAX_STRING_SIZE],
    wszPassword[MAX_STRING_SIZE], wszQuery[MAX_STRING_SIZE],
    wszBuf[MAX_STRING_SIZE], wszTable[MAX_STRING_SIZE];
  SQLCHAR aszServer[MAX_STRING_SIZE], aszLogin[MAX_STRING_SIZE],
    aszPassword[MAX_STRING_SIZE], aszQuery[MAX_STRING_SIZE],
    aszBuf[MAX_STRING_SIZE], aszTable[MAX_STRING_SIZE];
  SQLUSMALLINT fStmts;
  SQLRETURN rc, rcA=SQL_SUCCESS, rcW=SQL_SUCCESS;

  // We've already set the environment attribute to 3.0 by this point

#ifdef UNICODE
  // Copy the unicode strings
  _tcscpy(wszServer, lpSI->szValidServer0);
  _tcscpy(wszLogin, lpSI->szValidLogin0);
  _tcscpy(wszPassword, lpSI->szValidPassword0);
  _tcscpy(wszTable, lpqt->szTableName);
  wsprintf(wszQuery,szSELECTSTAR,lpqt->szTableName);

  // Convert and copy to ANSI strings
  /*
  int WideCharToMultiByte(
     UINT  CodePage,        // code page
     DWORD  dwFlags,        // performance and mapping flags
     LPCWSTR  lpWideCharStr,        // address of wide-character string
     int  cchWideChar,      // number of characters in string
     LPSTR  lpMultiByteStr, // address of buffer for new string
     int  cchMultiByte,     // size of buffer
     LPCSTR  lpDefaultChar, // address of default for unmappable characters
     LPBOOL  lpUsedDefaultChar      // address of flag set when default char. used
    );
  */
  // Server
  (void)(WideCharToMultiByte(CP_ACP,
              0,
              lpSI->szValidServer0,
              _tcslen(lpSI->szValidServer0),
              aszServer,
              sizeof(aszServer),
              NULL,
              NULL));
  aszServer[_tcslen(lpSI->szValidServer0)]=TEXT('\0');

  // UID
  (void)(WideCharToMultiByte(CP_ACP,
              0,
              lpSI->szValidLogin0,
              _tcslen(lpSI->szValidLogin0),
              aszLogin,
              sizeof(aszLogin),
              NULL,
              NULL));
  aszLogin[_tcslen(lpSI->szValidLogin0)]=TEXT('\0');

  // PWD
  (void)(WideCharToMultiByte(CP_ACP,
              0,
              lpSI->szValidPassword0,
              _tcslen(lpSI->szValidPassword0),
              aszPassword,
              sizeof(aszPassword),
              NULL,
              NULL));
  aszPassword[_tcslen(lpSI->szValidPassword0)]=TEXT('\0');

  // Select stmt
  (void)(WideCharToMultiByte(CP_ACP,
              0,
              wszQuery,
              _tcslen(wszQuery),
              aszQuery,
              sizeof(aszQuery),
              NULL,
              NULL));
  aszQuery[_tcslen(wszQuery)]=TEXT('\0');

  // Table name
  (void)(WideCharToMultiByte(CP_ACP,
              0,
              wszTable,
              _tcslen(wszTable),
              aszTable,
              sizeof(aszTable),
              NULL,
              NULL));
  aszTable[_tcslen(wszTable)]=TEXT('\0');

#else
  // Copy the ANSI strings
  _tcscpy(aszServer, lpSI->szValidServer0);
  _tcscpy(aszLogin, lpSI->szValidLogin0);
  _tcscpy(aszPassword, lpSI->szValidPassword0);
  _tcscpy(aszTable, lpqt->szTableName);
  sprintf(aszQuery,szSELECTSTAR,lpqt->szTableName);

  // Convert and copy to Unicode strings
  /*
  int MultiByteToWideChar(
     UINT  CodePage,        // code page
     DWORD  dwFlags,        // character-type options
     LPCSTR  lpMultiByteStr,        // address of string to map
     int  cchMultiByte,     // number of characters in string
     LPWSTR  lpWideCharStr, // address of wide-character buffer
     int  cchWideChar       // size of buffer
    );
  */

  // Server
  (void) MultiByteToWideChar(CP_ACP,
                  0,
                  lpSI->szValidServer0,
                  _tcslen(lpSI->szValidServer0),
                  wszServer,
                  sizeof(wszServer)/sizeof(WCHAR)
                  );
  wszServer[_tcslen(lpSI->szValidServer0)]=TEXT('\0');

  // UID
  (void) MultiByteToWideChar(CP_ACP,
                  0,
                  lpSI->szValidLogin0,
                  _tcslen(lpSI->szValidLogin0),
                  wszLogin,
                  sizeof(wszLogin)/sizeof(WCHAR)
                  );
  wszLogin[_tcslen(lpSI->szValidLogin0)]=TEXT('\0');

  // PWD
  (void) MultiByteToWideChar(CP_ACP,
                  0,
                  lpSI->szValidPassword0,
                  _tcslen(lpSI->szValidPassword0),
                  wszPassword,
                  sizeof(wszPassword)/sizeof(WCHAR)
                  );
  wszPassword[_tcslen(lpSI->szValidPassword0)]=TEXT('\0');

  // Select stmt
  (void) MultiByteToWideChar(CP_ACP,
                  0,
                  aszQuery,
                  _tcslen(aszQuery),
                  wszQuery,
                  sizeof(wszQuery)/sizeof(WCHAR)
                  );
  wszQuery[_tcslen(aszQuery)]=TEXT('\0');

  // Table name
  (void) MultiByteToWideChar(CP_ACP,
                  0,
                  aszTable,
                  _tcslen(aszTable),
                  wszTable,
                  sizeof(wszTable)/sizeof(WCHAR)
                  );
  wszTable[_tcslen(aszTable)]=TEXT('\0');

#endif

  // Allocate connection for ANSI
  rc = SQLAllocConnect(henv, &hdbcANSI);
  RETCHECK(SQL_SUCCESS, rc, szSQLALLOCCONNECT);

  // Allocate connection for Unicode
  rc = SQLAllocConnect(henv, &hdbcUnicode);
  RETCHECK(SQL_SUCCESS, rc, szSQLALLOCCONNECT);

  // If Unicode is defined, then strings need to be converted to ANSI
  // before calling SQLConnectA
  rc = SQLConnectA(hdbcANSI, (LPSTR)aszServer, SQL_NTS,
            (LPSTR)aszLogin, SQL_NTS,
            (LPSTR)aszPassword, SQL_NTS);
  if (!RC_SUCCESSFUL(rc))
    ERRSHANDLE(SQL_HANDLE_DBC, hdbcANSI, SQL_SUCCESS, rc,szSQLCONNECT);

  rc = SQLConnectW(hdbcUnicode, (LPWSTR)wszServer, SQL_NTS,
            (LPWSTR)wszLogin, SQL_NTS,
            (LPWSTR)wszPassword, SQL_NTS);
  if (!RC_SUCCESSFUL(rc))
    ERRSHANDLE(SQL_HANDLE_DBC, hdbcUnicode, SQL_SUCCESS, rc,szSQLCONNECTW);

  // Test mixed SQLNativeSQL calls        on the ANSI connection
  rc=SQLNativeSqlA(hdbcANSI, aszQuery, strlen(aszQuery), aszBuf,
    sizeof(aszBuf), &cbANSI);
  ERRSHANDLE(SQL_HANDLE_DBC, hdbcANSI, SQL_SUCCESS, rc,szSQLNATIVESQL);
  rc=SQLNativeSqlW(hdbcANSI, wszQuery, wcslen(wszQuery), wszBuf,
    sizeof(wszBuf)/sizeof(WCHAR), &cchUnicode);
  ERRSHANDLE(SQL_HANDLE_DBC, hdbcANSI, SQL_SUCCESS, rc,szSQLNATIVESQL);

  CompareAnsiToUnicode(aszBuf, cbANSI, wszBuf, cchUnicode*sizeof(WCHAR), szSQLNATIVESQLW);

  // Allocate stmt handles for ANSI connection
  rc = SQLAllocStmt(hdbcANSI, &hstmtANSIA);       // Handle for ANSI calls
  ERRSHANDLE(SQL_HANDLE_DBC, hdbcANSI, SQL_SUCCESS, rc,szSQLALLOCSTMT);
  rc = SQLAllocStmt(hdbcANSI, &hstmtANSIW);       // Handle for Unicode calls
  ERRSHANDLE(SQL_HANDLE_DBC, hdbcANSI, SQL_SUCCESS, rc,szSQLALLOCSTMT);

  // Allocate stmt handles for Unicode connection
  rc = SQLAllocStmt(hdbcUnicode, &hstmtUA); // Handle for ANSI calls
  ERRSHANDLE(SQL_HANDLE_DBC, hdbcUnicode, SQL_SUCCESS, rc,szSQLALLOCSTMT);
  rc = SQLAllocStmt(hdbcUnicode, &hstmtUW); // Handle for Unicode calls
  ERRSHANDLE(SQL_HANDLE_DBC, hdbcUnicode, SQL_SUCCESS, rc,szSQLALLOCSTMT);

  // Call SQLTablesA&W on two different hdbcs
  strcpy(aszBuf,"%");
  wcscpy(wszBuf,L"%");
  rc = SQLTablesA(hstmtANSIA, NULL, 0, NULL, 0, aszBuf, SQL_NTS, NULL, 0);
  ERRSHANDLE(SQL_HANDLE_STMT, hstmtANSIA, SQL_SUCCESS, rc, szSQLTABLESA);
  rc = SQLTablesW(hstmtUW, NULL, 0, NULL, 0, wszBuf, SQL_NTS, NULL, 0);
  ERRSHANDLE(SQL_HANDLE_STMT, hstmtUW, SQL_SUCCESS, rc, szSQLTABLESW);

  // Compare the two result sets
  CompareAnsiUnicodeResults(hstmtANSIA, hstmtUW, szSQLTABLESW);

  // See if the driver supports multiple active stmts
  if (uDriverODBCVer >= 3)
    rc = SQLGetInfo(hdbcANSI, SQL_ACTIVE_STATEMENTS, &fStmts, 0, NULL);
  else
    rc = SQLGetInfo(hdbcANSI, SQL_ACTIVE_STATEMENTS, &fStmts, sizeof(fStmts), NULL);
  ERRSHANDLE(SQL_HANDLE_DBC, hdbcANSI, SQL_SUCCESS, rc, szSQLGETINFO);

  // Create a search string for ANSI
  aszBuf[0]=aszTable[0];
  aszBuf[1]=TEXT('\0');
  strcat(aszBuf,"%");

  // Create a search string for Unicode
  wszBuf[0]=wszTable[0];
  wszBuf[1]=TEXT('\0');
  wcscat(wszBuf,L"%");

  // If the allowed active statements is > 1, then use the same connection
  // otherwise use the other connection
  if (fStmts > 1)
    hstmtW=hstmtUW;
  else
    hstmtW=hstmtANSIW;

  // Call SQLColumnsA&W on two different hstmts (same connection if allowed)
  // Call for only the given table to limit compare errors at this time
  rc = SQLColumnsA(hstmtUA, NULL, 0, NULL, 0, aszTable, SQL_NTS, NULL, 0);
  ERRSHANDLE(SQL_HANDLE_STMT, hstmtANSIA, SQL_SUCCESS, rc, szSQLCOLUMNSA);

  // Call for only the given table to limit compare errors at this time
  rc = SQLColumnsW(hstmtW, NULL, 0, NULL, 0, wszTable, SQL_NTS, NULL, 0);
  ERRSHANDLE(SQL_HANDLE_STMT, hstmtW, SQL_SUCCESS, rc, szSQLCOLUMNSW);

  CompareAnsiUnicodeResults(hstmtUA, hstmtW, szSQLCOLUMNSW);

  rc = SQLExecDirectA(hstmtUA, aszQuery, SQL_NTS);
  ERRSHANDLE(SQL_HANDLE_STMT, hstmtUA, SQL_SUCCESS, rc, szSQLEXECDIRECTA);

  // Call for only the given table to limit compare errors at this time
  rc = SQLExecDirectW(hstmtW, wszQuery, SQL_NTS);
  ERRSHANDLE(SQL_HANDLE_STMT, hstmtW, SQL_SUCCESS, rc, szSQLEXECDIRECTW);

  CompareAnsiUnicodeResults(hstmtUA, hstmtW, szSQLEXECDIRECTW);

  // Disconnect and free ANSI handles
  rc=SQLFreeStmt(hstmtANSIA, SQL_DROP);
  ERRSHANDLE(SQL_HANDLE_STMT, hstmtANSIA, SQL_SUCCESS, rc,szSQLFREESTMT);
  rc=SQLFreeStmt(hstmtANSIW, SQL_DROP);
  ERRSHANDLE(SQL_HANDLE_STMT, hstmtANSIW, SQL_SUCCESS, rc,szSQLFREESTMT);
  rc=SQLDisconnect(hdbcANSI);
  ERRSHANDLE(SQL_HANDLE_DBC, hdbcANSI, SQL_SUCCESS, rc,szSQLCONNECT);
  rc=SQLFreeConnect(hdbcANSI);
  ERRSHANDLE(SQL_HANDLE_DBC, hdbcANSI, SQL_SUCCESS, rc,szSQLCONNECT);
  // Disconnect and free Unicode handles
  rc=SQLFreeStmt(hstmtUA, SQL_DROP);
  ERRSHANDLE(SQL_HANDLE_STMT, hstmtUA, SQL_SUCCESS, rc,szSQLFREESTMT);
  rc=SQLFreeStmt(hstmtUW, SQL_DROP);
  ERRSHANDLE(SQL_HANDLE_STMT, hstmtUW, SQL_SUCCESS, rc,szSQLFREESTMT);
  rc=SQLDisconnect(hdbcUnicode);
  ERRSHANDLE(SQL_HANDLE_DBC, hdbcUnicode, SQL_SUCCESS, rc,szSQLCONNECT);
  rc=SQLFreeConnect(hdbcUnicode);
  ERRSHANDLE(SQL_HANDLE_DBC, hdbcUnicode, SQL_SUCCESS, rc,szSQLCONNECT);

} /* TestMixedAnsiUnicode() */

VOID PASCAL TestNumResCols | ( | SDWORD | cColsSelected,
 |  | QTSTRUCT * | lpqt
 | ) |  |

Definition at line 7078 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;
  SWORD           wNum;

  SelectFromTable(lpqt);

  rc = SQLNumResultCols(hstmt, &wNum);
  RETCHECK(SQL_SUCCESS, rc,szSQLNUMRESULTCOLS);

  if(wNum != cColsSelected)
    DISPLAYERROR(szSQLNUMRESULTCOLS,TEXT("incorrect value returned"));

  FreeStmt(SQL_CLOSE);

} /* TestNumResCols() */

void PASCAL TestOJCap ( QTSTRUCT * lpqt )

Definition at line 3761 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;
  UDWORD  udw;

  rc = SQLGetInfo(hdbc, (UWORD)SQL_OJ_CAPABILITIES, &udw, (SWORD)(sizeof(udw)), NULL);
  if(RETCHECK(SQL_SUCCESS, rc,szSQLGETINFO))
  {
    udw &= ~(SQL_OJ_LEFT | SQL_OJ_RIGHT | SQL_OJ_FULL | SQL_OJ_NESTED       |
          SQL_OJ_NOT_ORDERED | SQL_OJ_INNER | SQL_OJ_ALL_COMPARISON_OPS);
    if(udw)
    {
      wsprintf(lpqt->buf,TEXT("Undefined flags return from SQLGetInfo(...SQL_OJ_CAPABILITIES...) = %lX"), udw);
      DISPLAYERROR(szSQLGETINFO, lpqt->buf);
    }
  }

  rc = SQLGetInfo(hdbc, SQL_OUTER_JOINS, lpqt->buf, sizeof(lpqt->buf), NULL);
  if(RETCHECK(SQL_SUCCESS, rc,szSQLGETINFO)){
    *lpqt->buf = toupper(*lpqt->buf);
    if((!_tcsnccmp(lpqt->buf,TEXT("Y"), 1)) && (!_tcsnccmp(lpqt->buf,TEXT("N"), 1)))
      DISPLAYERROR(szSQLGETINFO,TEXT("Driver returned an invalid value for SQLGetInfo(...SQL_OUTER_JOINS...).  The only valid values are \"Y\" and \"N\"."));
    }

} //TestOJCap()

void PASCAL TestQuickRebind | ( | QTSTRUCT * | lpqt,
 |  | FIELDINFO * | rgFields,
 |  | UWORD | cTypes,
 |  | DSTRUCT * | lpd
 | ) |  |

Definition at line 3994 of file quiktest.c.

{
  RETCODE rc;
  UWORD           row,iCol,iRowset,uwRowsetSize,iRowsetRow,iTableCol;
  UDWORD  udwRowSize;
  SWORD           fSqlType;
  SDWORD  sdwOffset;
  DSTRUCT *rgData, *pZeroRow;
  DSTRUCT *pCurrentRowData;
  TCHAR           szQuery[MAX_STRING_SIZE], szColName[SMALLBUFF];
  SDWORD  cbValue;
  TCHAR*  rgbValue=NULL;
  BOOL            fCol0Bound=TRUE;

  udwRowSize = sizeof(DSTRUCT)*cTypes;
            /* cNumResSetCols is set in BuildInsertStmt() */
  uwRowsetSize = 5;/* uwRowsetSize rows per Rowset */

  /* Only col which might not be bound but might not be AutoUpdateable is col 0 */
  if(!qtMakeData(0, 0, &rgFields[0], szQuery))
    fCol0Bound = FALSE;

  /* Allocate an area for QuickRebind to take place */
  if (!(rgData = AllocateMemory(NUM_QUIKREBIND_ROWSETS*(uwRowsetSize+1)*udwRowSize) )){
    DISPLAYERROR(szQUICKREBIND,TEXT("\t\t\tInsufficient Memory Available"));
    return;
  }

  /* Allocate an area for a row of zeroes to place between each Rowset. */
  if (!(pZeroRow = AllocateMemory(udwRowSize) )){
    DISPLAYERROR(szQUICKREBIND,TEXT("\t\t\tInsufficient Memory Available"));
    goto abortQuikRebind;
  }

  /* Allocate an area for test data */
  if (!(rgbValue = AllocateMemory(MAX_STRING_SIZE * sizeof(SQLTCHAR)))){
    DISPLAYERROR(szSQLEXTENDEDFETCH,TEXT("Insufficient Memory Available"));
    goto abortQuikRebind;
  }

  ResetHstmt(&hstmt);

  /* Get column for "order by" clause: */
  wsprintf(szQuery,TEXT("select %s from %s"),lpqt->szColNames, lpqt->szTableName);
  rc = SQLExecDirect(hstmt, szQuery, SQL_NTS);
  if((SQL_SUCCESS!=rc) && (SQL_SUCCESS_WITH_INFO!=rc)){
    RETCHECK(SQL_SUCCESS_WITH_INFO, rc, szSQLEXECDIRECT);
    goto abortQuikRebind;
  }
  iCol=0;
  do      {
    iCol++;
    rc=SQLDescribeCol(hstmt, iCol, szColName, SMALLBUFF,
      NULL, &fSqlType, NULL, NULL, NULL);
    RETCHECK(SQL_SUCCESS, rc,szSQLDESCRIBECOL);
  } while(fSqlType!=SQL_CHAR && iCol<=cTypes);

  FreeStmt(SQL_CLOSE);
  if(iCol>=cTypes){
    DISPLAYERROR(szQUICKREBIND, TEXT("\t\t\tSelect-order by  Failed"));
    goto abortQuikRebind;
  }

  /* Set to row-wise binding and set Rowset size to uwRowsetSize:  */
  rc = SQLSetStmtAttr(hstmt,SQL_ATTR_ROW_BIND_TYPE,(PTR)udwRowSize,SQL_IS_INTEGER);
  if (SQL_SUCCESS != rc){
    _tcscpy(lpqt->buf,TEXT("\t\t\tQuick Rebind FAILED...SQLSetDescField(Bind_Type)"));
    szWrite(lpqt->buf, TRUE);
    goto abortQuikRebind;
  }
  rc = SQLSetStmtAttr(hstmt,SQL_ATTR_ROW_ARRAY_SIZE,(PTR)uwRowsetSize,SQL_IS_INTEGER);
  if (SQL_SUCCESS != rc){
      DISPLAYERROR(szQUICKREBIND,TEXT("\t\t\tSetStmtAttr(Rowset Size)"));
    goto abortQuikRebind;
  }

  /* Define area storing Quikrebind offset value: */
  rc = SQLSetStmtAttr(hstmt, SQL_ATTR_ROW_BIND_OFFSET_PTR, &sdwOffset, SQL_IS_POINTER);
  if (SQL_SUCCESS != rc){
    if(FindError(SQL_HANDLE_STMT,szHYC00)){
      _tcscpy(lpqt->buf,TEXT("\t\t\tQuickRebind Not Supported"));
      szWrite(lpqt->buf, TRUE);
      goto abortQuikRebind;
    }
    _tcscpy(lpqt->buf,TEXT("\t\t\tQuick Rebind FAILED...QuickRebind Not Functional"));
    szWrite(lpqt->buf, TRUE);
    goto abortQuikRebind;
  }

  if(SQL_SUCCESS != SelectFromTableFetch(lpqt, szColName)){
    DISPLAYERROR(szQUICKREBIND, TEXT("\t\t\tSelect-order by  Failed"));
    goto abortQuikRebind;
  }

  if (!BindFetchColumns(lpqt, rgFields, cTypes, rgData)){
    DISPLAYERROR(szQUICKREBIND,szSQLBINDCOL);
    goto abortQuikRebind;
  }

  /* Test quick rebind feature with two pairs of Rowsets, all *
   * rowsets separated by a row of zeroes:                    */
  for (iRowset=0; iRowset<=1; iRowset++)
  {
    if(iRowset)
      if(SQL_SUCCESS != SelectFromTableFetch(lpqt, szColName)){
        DISPLAYERROR(szQUICKREBIND, TEXT("\t\t\tSelect-order by  Failed"));
        goto abortQuikRebind;
      }

    /* Set offset value (to 0 or 1  * uwRowsetSize * udwRowSize) for 1st rowset */
    sdwOffset = iRowset*((1+uwRowsetSize)*udwRowSize);

    /* Fetch rowset into desired area */
    rc = SQLFetchScroll(hstmt, SQL_FETCH_NEXT, 1);
    if (SQL_SUCCESS != rc){
      ERRSHANDLE(SQL_HANDLE_STMT, hstmt, SQL_SUCCESS, rc, szSQLFETCHSCROLL);
      DISPLAYERROR(szQUICKREBIND,TEXT("Fetch Failed"));
      goto abortQuikRebind;
    }

    /* Set offset value (to 2 or 3 * uwRowsetSize * udwRowSize) for 2nd rowset */
    sdwOffset = (iRowset+2)*(1+uwRowsetSize)*udwRowSize;

    rc = SQLFetchScroll(hstmt, SQL_FETCH_NEXT, 1);
    if (SQL_SUCCESS != rc){
      ERRSHANDLE(SQL_HANDLE_STMT, hstmt, SQL_SUCCESS, rc, szSQLFETCHSCROLL);
      DISPLAYERROR(szQUICKREBIND,TEXT("Fetch Failed"));
      goto abortQuikRebind;
    }
    FreeStmt(SQL_CLOSE);
  }

  rc = SQLFreeStmt(hstmt, SQL_UNBIND);
  RETCHECK(SQL_SUCCESS, rc, szSQLFREESTMT);

  rc = SQLSetStmtAttr(hstmt,SQL_ATTR_ROW_ARRAY_SIZE,(PTR)1,SQL_IS_INTEGER);
  if (SQL_SUCCESS != rc){
      DISPLAYERROR(szQUICKREBIND,TEXT("\t\t\tSetStmtAttr(Rowset Size)"));
    goto abortQuikRebind;
  }

  /* Check stored values: */
  for (iRowset=0; iRowset<=1; iRowset++)
  {
    if(SQL_SUCCESS != SelectFromTableFetch(lpqt, szColName)){
      DISPLAYERROR(szQUICKREBIND, TEXT("\t\t\tSelect-order by  Failed"));
      goto abortQuikRebind;
    }

    /* First Rowset starts either in Allocated Row 0 or 3 */
    iRowsetRow= iRowset*(1+uwRowsetSize);
    //for (row=0; row<NUM_QUIKREBIND_ROWSETS  ;row++,iRowsetRow++)
    for (row=0; row<(uwRowsetSize*2)  ;row++,iRowsetRow++)
    {
      UWORD iResultSetCol=0;
      if(row==uwRowsetSize)
        iRowsetRow+= 2+uwRowsetSize; /* Jump to 2nd Rowset */

      /* Don't check data in "zero" row,      *
       * the spacer row between rowsets:      */
      if(iRowsetRow%(1+uwRowsetSize) == uwRowsetSize)
        continue;

      /* Fetch next rowset */
      rc = SQLFetch(hstmt);
      if (SQL_SUCCESS != rc){
        ERRSHANDLE(SQL_HANDLE_STMT, hstmt, SQL_SUCCESS, rc, szSQLFETCH);
        DISPLAYERROR(szQUICKREBIND,TEXT("Fetch Failed"));
        goto abortQuikRebind;
      }

      pCurrentRowData = rgData+iRowsetRow*cTypes;
      for(iTableCol=0; iTableCol<cTypes; iTableCol++)
      {
        /* Ignore columns which aren't bound as they aren't in the result set */
        if((!iTableCol && !fCol0Bound) || rgFields[iTableCol].fAutoUpdate)
          continue;

        iResultSetCol++;
        rc = SQLGetData(hstmt, iResultSetCol, SQL_C_TCHAR, rgbValue, MAX_STRING_SIZE * sizeof(SQLTCHAR),
          &cbValue);
        if(rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO)
          RETCHECK(SQL_SUCCESS, rc,szSQLGETDATA);

        if(!CheckDataResults(row, iTableCol, &rgFields[iTableCol], pCurrentRowData,cbValue,rgbValue))
        {
          wsprintf(lpqt->buf, TEXT("Data Check Failed, Row %d, Table Col %d, DataType %d (%s)"),
            row, iTableCol, rgFields[iTableCol].wSQLType, rgFields[iTableCol].szFieldName) ;
          szWrite(lpqt->buf,FALSE);
          rgbValue[MAX_STRING_SIZE-1]=TEXT('\0');
          wsprintf(lpqt->buf, TEXT("Returned Data: (%s)"), rgbValue);
          DISPLAYERROR(szQUICKREBIND,lpqt->buf);
          goto abortQuikRebind;
        }
      }/* end for(iTableCol) */
    } /* end for(row)                         */
    FreeStmt(SQL_CLOSE);
  } /* end for (iRowset)  */

  /* Check Unused memory areas:    */
  for (iRowsetRow=uwRowsetSize; iRowsetRow<NUM_QUIKREBIND_ROWSETS*(uwRowsetSize+1);  )
  {
    pCurrentRowData = rgData+iRowsetRow*cTypes;
    if(memcmp(pCurrentRowData, pZeroRow, udwRowSize))
      DISPLAYERROR(szQUICKREBIND,
          TEXT("Unused memory areas altered after Quick Rebind."));
    iRowsetRow+=(uwRowsetSize+1);
  }

abortQuikRebind:
  ResetHstmt(&hstmt);
  if (rgbValue)
    ReleaseMemory(rgbValue);
  if (pZeroRow)
    ReleaseMemory(pZeroRow);
  ReleaseMemory(rgData);

} /* TestQuickRebind() */

void PASCAL TestSearchedQuery | ( | QTSTRUCT * | lpqt,
 |  | FIELDINFO * | rgFields,
 |  | UWORD | cTypes,
 |  | DSTRUCT * | lpd,
 |  | BOOL | fBindParameter
 | ) |  |

Definition at line 3351 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;
  UWORD           i;
  LPTSTR          pch=NULL;
  SDWORD  sdw;
  UWORD           w;
  UDWORD  udw;
  UWORD           ind;

  wsprintf(lpqt->sz, TEXT("select %s from %s where "), lpqt->szColNames,
    lpqt->szTableName);

    sdw = SQL_DATA_AT_EXEC;

  for(i = 0, w = 0,ind=0; i < cTypes; i++)
    {
    pch = qtMakeData(ind, i,&rgFields[i], lpqt->szDataItem);

    if ((rgFields[i].fSearchable == SQL_SEARCHABLE ||
      rgFields[i].fSearchable == SQL_ALL_EXCEPT_LIKE) &&
      pch && *pch) {
      w++;
      switch(rgFields[i].wSQLType) {
        case SQL_REAL:
        case SQL_FLOAT:
        case SQL_DOUBLE:
          wsprintf(&lpqt->sz[_tcslen(lpqt->sz)], TEXT("%s < ? + 1 and "),
            rgFields[i].szFieldName);
          break;
        default:
          wsprintf(&lpqt->sz[_tcslen(lpqt->sz)], TEXT("%s = ? and "),
          rgFields[i].szFieldName);
      }

      if(!fBindParameter){
        rc = SQLSetParam(hstmt, w,
          SQL_C_TCHAR, rgFields[i].wSQLType,
          rgFields[i].precision, rgFields[i].scale,
          (LPTSTR)(UDWORD)i, &sdw);
        RETCHECK(SQL_SUCCESS, rc, szSQLSETPARAM);
        }
      else{
        rc = SQLBindParameter(hstmt, w, SQL_PARAM_INPUT,
          SQL_C_TCHAR, rgFields[i].wSQLType,
          rgFields[i].precision, rgFields[i].scale,
          (LPTSTR)((UDWORD)i+BIND_PARM_OFFSET), 0, &sdw);
        RETCHECK(SQL_SUCCESS, rc, szSQLBINDPARAMETER);
        }

      ind++;
    }
  }
  /* remove the final "and " */
  lpqt->sz[_tcslen(lpqt->sz) - 5] = TEXT('\0');
  _tcscpy(lpqt->szParamQuery, lpqt->sz);

  rc = SQLPrepare(hstmt, lpqt->sz, SQL_NTS);
  RETCHECK(SQL_SUCCESS, rc, szSQLPREPARE);

  rc = SQLExecute(hstmt);
  RETCHECK(SQL_NEED_DATA, rc, szSQLEXECUTE);

  udw = cTypes;

  for(i = 0; ; i++)
    {
    rc = SQLParamData(hstmt, (PTR *)&udw);
    if(rc != SQL_NEED_DATA)
      break;

    if(udw-BIND_PARM_OFFSET < cTypes)
      pch = qtMakeData(cTypes, i,&rgFields[udw-BIND_PARM_OFFSET], lpqt->szDataItem);
    else
      DISPLAYERROR(szSQLPARAMDATA, TEXT("invalid rgbValue"));

    if(*pch)
      {
      udw = _tcslen(pch);
      rc = SQLPutData(hstmt, pch, (SDWORD)_tcslen(pch)*sizeof(SQLTCHAR));
      RETCHECK(SQL_SUCCESS, rc, szSQLPUTDATA);
      }
    else
      {
      rc = SQLPutData(hstmt, (LPTSTR)IGNORED, SQL_NULL_DATA);
      RETCHECK(SQL_SUCCESS, rc, szSQLPUTDATA);
      }
    }

  RETCHECK(SQL_SUCCESS, rc, szSQLPARAMDATA);

  for(i = 0;; i++)
    {
    rc = SQLFetch(hstmt);

    if(rc != SQL_SUCCESS)
      break;
    }

  RETCHECK(SQL_NO_DATA_FOUND, rc, szSQLFETCH);

  /* should have gotten 1 row back */

  if(i != 1)
    DISPLAYERROR(TEXT("Param/PutData"), TEXT("incorrect number of rows returned"));

  FreeStmt(SQL_CLOSE);
  FreeStmt(SQL_RESET_PARAMS);

} //TestSearchedQuery()

void PASCAL TestSetDescField ( QTSTRUCT * lpqt )

Definition at line 5859 of file quiktest.c.

{
  SQLRETURN rc=SQL_SUCCESS;
  SQLUSMALLINT iDescType;

  SQLHDESC hdesc1=NULL, hdesc2=NULL;
  PTR rgbValue=NULL;
  SQLSMALLINT swDescRecCount, swExpRecCount;
  SQLINTEGER cbValue;
  TCHAR   szName[MAX_DESC_BUF]=TEXT("");
  TCHAR   szQuery[XLARGEBUFF]=TEXT("");

  if (!Supported(SQL_API_SQLSETDESCFIELD))
  {
    // Allocate a default descriptor
    rc = SQLAllocHandle(SQL_HANDLE_DESC, hdbc, &hdesc);

    if (RC_SUCCESSFUL(rc))
    {
      rc = SQLSetDescField(hdesc, 0, SQL_DESC_COUNT, &swDescRecCount,
        sizeof(swDescRecCount));

      if(!FindError(SQL_HANDLE_DESC,szIM001))
        DISPLAYERROR(szSQLSETDESCFIELD, szNotSupported);
      RETCHECK(SQL_ERROR, rc,szSQLSETDESCFIELD);
    }
  }
  else
  {
    // Make sure all parameters and columns are unbound
    ResetHstmt(&hstmt);

    // Perform a select stmt
    wsprintf(szQuery,szSELECTSTAR,lpqt->szTableName);
    rc = SQLExecDirect(hstmt, szQuery, SQL_NTS);
    RETCHECK(SQL_SUCCESS, rc,szSQLEXECDIRECT);

    // For each descriptor type
    for (iDescType=0; iDescType < sizeof(DescTypes)/sizeof(DescTypes[0]); iDescType++)
    {

      // Get the handle for the automatically allocated descriptor
      rc = SQLGetStmtAttr(hstmt, DescTypes[iDescType].uwDescType, &hdesc1, sizeof(hdesc1), &cbValue);
      RETCHECK(SQL_SUCCESS, rc,szSQLGETSTMTATTR);

      // Create a descriptor record so we have something to read besides header
      swExpRecCount=CreateDescRecord(hdesc1, hstmt, DescTypes[iDescType].uwDescType);

      // Update all descriptor records to new values
      CheckDescriptor(hdesc1, DESC_UPDATE_MODE_WRITE, hstmt, iDescType);

      // Compare the descriptor with the update values
      // CompareDescriptor(hdesc1, NULL, iDescType, szSQLSETDESCFIELD);
    }

    ResetHstmt(&hstmt);
  }

} //TestSetDescField()

void PASCAL TestSetDescRec ( QTSTRUCT * lpqt )

Definition at line 6038 of file quiktest.c.

{
  SQLRETURN rc=SQL_SUCCESS;
        SQLINTEGER cbLength=300,cbValue, Indicator;
  SQLUSMALLINT iDescType;

  SQLHDESC hdesc1=NULL, hdesc2=NULL;
  PTR rgbValue=NULL;
        SQLSMALLINT swDescRec, swDescRecCount, swStartRec=1, iRecord=0, fType=1, fSubType=1,
                ibPrecision=0, ibScale=0;
  SQLSMALLINT swExpRecCount;
  TCHAR   szQuery[XLARGEBUFF]=TEXT("");

  if (!Supported(SQL_API_SQLSETDESCREC))
  {
    // Allocate a default descriptor
    rc = SQLAllocHandle(SQL_HANDLE_DESC, hdbc, &hdesc);

    if (RC_SUCCESSFUL(rc))
    {
      rc = SQLSetDescRec(hdesc, iRecord, fType, fSubType, cbLength,
        ibPrecision, ibScale, &DescBuf, &cbValue, &Indicator);

      if(!FindError(SQL_HANDLE_DESC,szIM001))
        DISPLAYERROR(szSQLSETDESCREC, szNotSupported);
      RETCHECK(SQL_ERROR, rc,szSQLSETDESCREC);
    }
  }
  else
  {
    // Make sure all parameters and columns are unbound
    ResetHstmt(&hstmt);

    // Perform a select stmt
    wsprintf(szQuery,szSELECTSTAR,lpqt->szTableName);
    rc = SQLExecDirect(hstmt, szQuery, SQL_NTS);
    RETCHECK(SQL_SUCCESS, rc,szSQLEXECDIRECT);

    // If bookmarks are supported, then we want to try to set record 0
    rc = SQLSetStmtAttr(hstmt, SQL_ATTR_USE_BOOKMARKS,
      (PTR)SQL_UB_VARIABLE, SQL_IS_INTEGER);
    if (RC_SUCCESSFUL(rc))
      swStartRec=0;

    // For each descriptor type
    for (iDescType=0; iDescType < sizeof(DescTypes)/sizeof(DescTypes[0]); iDescType++)
    {

      // Get the handle for the automatically allocated descriptor
      rc = SQLGetStmtAttr(hstmt, DescTypes[iDescType].uwDescType, &hdesc1, sizeof(hdesc1), &cbValue);
      RETCHECK(SQL_SUCCESS, rc,szSQLGETSTMTATTR);

      // Create a descriptor record so we have something to read besides header
      swExpRecCount=CreateDescRecord(hdesc1, hstmt, DescTypes[iDescType].uwDescType);

      // Get the count of descriptor records
      rc = SQLGetDescField(hdesc1, 0, SQL_DESC_COUNT, &swDescRecCount,
        sizeof(swDescRecCount), &cbValue);

      if (SQL_SUCCESS == rc)
      {

        // For all descriptor records
        for (swDescRec=swStartRec; swDescRec <= swDescRecCount; swDescRec++)
        {
          // Test with a DATETIME record so we can check the subtype field.
          SQLINTEGER Indicator=0;
          fType=SQL_DATETIME;
          fSubType=SQL_CODE_TIMESTAMP;
          cbLength=sizeof(TIMESTAMP_STRUCT);
          ibPrecision=5;  // For DATETIME, SQL_CODE_DATE data
                      // precision defaults to 0, but it implies it can be set otherwise.
          ibScale=0;              // Only used for DECIMAL or NUMERIC types, otherwise undefined

          CheckDescRecord(hdesc1, swDescRec, fType, fSubType, cbLength, ibPrecision,
            ibScale, &tsval, &cbValue, &Indicator, iDescType);

          // Test with a numeric record to test scale
          Indicator=0;
          fType=SQL_NUMERIC;
          fSubType=SQL_CODE_TIMESTAMP;
          cbLength=sizeof(TIMESTAMP_STRUCT);
          ibPrecision=5;  // For DATETIME, SQL_CODE_DATE data
                      // precision defaults to 0, but it implies it can be set otherwise.
          ibScale=0;              // Only used for DECIMAL or NUMERIC types, otherwise undefined

          CheckDescRecord(hdesc1, swDescRec, fType, fSubType, cbLength, ibPrecision,
            ibScale, &tsval, &cbValue, &Indicator, iDescType);
        }
      }
      else
      {
        // Unable to read record count from descriptor header,
        // can't proceed
        wsprintf(buf,TEXT("\t\tUnable to read record count from descriptor header for  %s"),
          DescTypes[iDescType].szDescName);
        ERRSHANDLE(SQL_HANDLE_DESC, hdesc1, SQL_SUCCESS, rc, buf);
      }
    }
    ResetHstmt(&hstmt);
  }

} //TestSetDescRec()

void PASCAL TestSQLBrowseConnect ( lpSERVERINFO lpSI )

Definition at line 4255 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;
  UWORD           cMaxConnections=0;
  TCHAR           szBCString[40];
  TCHAR           szDSN[40];
  HDBC            hdbcb=NULL;
  SQLINTEGER    sdwCP;

  AllocHdbc(&hdbcb);

  rc = SQLGetInfo(hdbc, SQL_ACTIVE_CONNECTIONS, &cMaxConnections, sizeof(cMaxConnections), NULL);
  RETCHECK(SQL_SUCCESS, rc,szSQLGETINFO);

  rc = SQLGetEnvAttr(henv, SQL_ATTR_CONNECTION_POOLING, &sdwCP, SQL_IS_INTEGER, NULL);
  RETCHECK(SQL_SUCCESS, rc,szSQLGETENVATTR);
  if ( SQL_CP_OFF != sdwCP)
    {
      DISPLAYERROR(szSQLBROWSECONNECT, szBrowseNotSupported);
      return;
    }

  if(cMaxConnections != 1)
    {
    _tcscpy(szBCString,TEXT("DSN="));
    _tcscat(szBCString, lpSI->szValidServer0);

    if(lpSI->szValidServer0[0] == 0)
      {
      rc = SQLGetInfo(hdbc, SQL_DATA_SOURCE_NAME, szDSN, sizeof(szDSN), NULL);
      _tcscat(szBCString, szDSN);
      }

    if(!Supported(SQL_API_SQLBROWSECONNECT))
      {
      HDBC thdbc=NULL;

      rc = SQLBrowseConnect(hdbcb, szBCString, SQL_NTS, NULL, 0, NULL);
      thdbc = hdbc;
      hdbc = hdbcb;
      if(!FindError(SQL_HANDLE_DBC,szIM001))
        DISPLAYERROR(szSQLBROWSECONNECT, szNotSupported);
      RETCHECK(SQL_ERROR, rc,szSQLBROWSECONNECT);
      hdbc = thdbc;

      rc = SQLFreeConnect(hdbcb);
      RETCHECK(SQL_SUCCESS, rc,szSQLFREECONNECT);

      }
    else
      {
      rc = SQLBrowseConnect(hdbcb, szBCString, SQL_NTS, NULL, 0, NULL);
      RETCHECK(SQL_NEED_DATA, rc,szSQLBROWSECONNECT);

      rc = SQLDisconnect(hdbcb);
      RETCHECK(SQL_SUCCESS, rc,szSQLDISCONNECT);
      rc = SQLFreeConnect(hdbcb);
      RETCHECK(SQL_SUCCESS, rc,szSQLFREECONNECT);
      }
    }

} //TestSQLBrowseConnect()

void PASCAL TestSQLColumnPrivileges ( QTSTRUCT * lpqt )

Definition at line 4653 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;

  if(!Supported( SQL_API_SQLCOLUMNPRIVILEGES))
    {
    rc = SQLColumnPrivileges(hstmt, NULL, 0, NULL, 0, lpqt->szTableName, SQL_NTS,
      NULL, 0);
    if(!FindError(SQL_HANDLE_STMT,szIM001))
      DISPLAYERROR(TEXT("SQLColummPrivileges"), szNotSupported);
    RETCHECK(SQL_ERROR, rc,TEXT("SQLColumnPrivileges"));
    }
  else
    {
    rc = SQLColumnPrivileges(hstmt, NULL, 0, NULL, 0, lpqt->szTableName, SQL_NTS,
      NULL, 0);
    RETCHECK(SQL_SUCCESS, rc,TEXT("SQLColumnPrivileges"));
    while(rc == SQL_SUCCESS)
      rc = SQLFetch(hstmt);

    RETCHECK(SQL_NO_DATA_FOUND, rc,szSQLFETCH);

    FreeStmt(SQL_CLOSE);
    }

} // TestSQLColumnPrivileges()

void PASCAL TestSQLDataSources ( )

Definition at line 4323 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;

  if (!Supported( SQL_API_SQLDATASOURCES))
    {
    rc = SQLDataSources(henv, SQL_FETCH_FIRST, NULL, 0, NULL, NULL, 0, NULL);

    if(!FindError(SQL_HANDLE_ENV,szIM001))
      DISPLAYERROR(TEXT("SQLDataSources"), szNotSupported);

    RETCHECK(SQL_ERROR, rc,TEXT("SQLDataSources"));
    }
  else
    {
    rc = SQLDataSources(henv, SQL_FETCH_FIRST, NULL, 0, NULL, NULL, 0, NULL);
    RETCHECK(SQL_SUCCESS, rc,TEXT("SQLDataSources"));
    }

} //TestSQLDataSources()

void PASCAL TestSQLDescribeParam ( QTSTRUCT * lpqt )

Definition at line 4433 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;

  rc = SQLPrepare(hstmt, lpqt->szParamQuery, SQL_NTS);
  RETCHECK(SQL_SUCCESS, rc,szSQLPREPARE);

  if(!Supported( SQL_API_SQLDESCRIBEPARAM))
    {
    rc = SQLPrepare(hstmt, lpqt->szParamQuery, SQL_NTS);
    RETCHECK(SQL_SUCCESS, rc,szSQLPREPARE);
    rc = SQLDescribeParam(hstmt, 1, NULL, NULL, NULL, NULL);
    if(!FindError(SQL_HANDLE_STMT,szIM001))
      DISPLAYERROR(szSQLDESCRIBEPARAM, szNotSupported);
    RETCHECK(SQL_ERROR, rc,szSQLDESCRIBEPARAM);
    }
  else
    {
    rc = SQLPrepare(hstmt, lpqt->szParamQuery, SQL_NTS);
    RETCHECK(SQL_SUCCESS, rc,szSQLPREPARE);
    rc = SQLDescribeParam(hstmt, 1, NULL, NULL, NULL, NULL);
    RETCHECK(SQL_SUCCESS, rc,szSQLDESCRIBEPARAM);
    }

    FreeStmt(SQL_CLOSE);

} //TestSQLDescribeParam()

void PASCAL TestSQLDrivers ( )

Definition at line 4349 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;

  if(!Supported( SQL_API_SQLDRIVERS))
    {
    rc = SQLDrivers(henv, SQL_FETCH_FIRST, NULL, 0, NULL, NULL, 0, NULL);
    if(!FindError(SQL_HANDLE_ENV,szIM001))
      DISPLAYERROR(TEXT("SQLDrivers"), szNotSupported);
    RETCHECK(SQL_ERROR, rc,TEXT("SQLDataSources"));
    }
  else
    {
    rc = SQLDrivers(henv, SQL_FETCH_FIRST, NULL, 0, NULL, NULL, 0, NULL);
    if(rc != SQL_SUCCESS)
      RETCHECK(SQL_SUCCESS_WITH_INFO, rc,TEXT("SQLDrivers"));
    }

} //TestSQLDrivers()

void PASCAL TestSQLForeignKeys ( QTSTRUCT * lpqt )

Definition at line 4219 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;

  if (!Supported(SQL_API_SQLFOREIGNKEYS))
    {
    rc = SQLForeignKeys(hstmt, NULL, 0, NULL, 0, lpqt->szTableName,
      SQL_NTS, NULL, 0, NULL, 0, NULL, 0);

    if(!FindError(SQL_HANDLE_STMT,szIM001))
      DISPLAYERROR(szSQLFOREIGNKEYS, szNotSupported);
    RETCHECK(SQL_ERROR, rc,szSQLFOREIGNKEYS);
    }
  else
    {
    rc = SQLForeignKeys(hstmt, NULL, 0, NULL, 0, lpqt->szTableName,
      SQL_NTS, NULL, 0, NULL, 0, NULL, 0);

    RETCHECK(SQL_SUCCESS, rc,szSQLFOREIGNKEYS);

    while(rc == SQL_SUCCESS)
      rc = SQLFetch(hstmt);

    RETCHECK(SQL_NO_DATA_FOUND, rc,szSQLFETCH);

    FreeStmt(SQL_CLOSE);

    }

} //TestSQLForeignKeys()

void PASCAL TestSQLMoreResults ( QTSTRUCT * lpqt )

Definition at line 4374 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;

  if(!Supported( SQL_API_SQLMORERESULTS))
    {
    SelectFromTable(lpqt);

    rc = SQLMoreResults(hstmt);
    if(!FindError(SQL_HANDLE_STMT,szIM001))
      DISPLAYERROR(TEXT("SQLMoreResults"), szNotSupported);
    RETCHECK(SQL_ERROR, rc,TEXT("SQLMoreResults"));
    }
  else
    {
    SelectFromTable(lpqt);

    rc = SQLMoreResults(hstmt);
    RETCHECK(SQL_NO_DATA_FOUND, rc,TEXT("SQLMoreResults"));
    }

  FreeStmt(SQL_CLOSE);

} //TestSQLMoreResults()

void PASCAL TestSQLNativeSQL ( QTSTRUCT * lpqt )

Definition at line 4404 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;
  TCHAR           szQuery[XLARGEBUFF];

  wsprintf(szQuery,TEXT("select * from %s were 0 > 1"),lpqt->szTableName);

  if(!Supported( SQL_API_SQLNATIVESQL))
    {
    rc = SQLNativeSql(hdbc, szQuery, SQL_NTS, NULL, 0, NULL);
    if(!FindError(SQL_HANDLE_DBC,szIM001))
      DISPLAYERROR(TEXT("SQLNativeSql"), szNotSupported);
    RETCHECK(SQL_ERROR, rc,TEXT("SQLNativeSql"));
    }
  else
    {
    rc = SQLNativeSql(hdbc, szQuery, SQL_NTS, NULL, 0, NULL);
    RETCHECK(SQL_SUCCESS, rc,TEXT("SQLNativeSql"));
    }

  FreeStmt(SQL_CLOSE);

} //TestSQLNativeSQL()

void PASCAL TestSQLNumParams ( QTSTRUCT * lpqt )

Definition at line 4467 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;

  rc = SQLPrepare(hstmt, lpqt->szParamQuery, SQL_NTS);
  RETCHECK(SQL_SUCCESS, rc,szSQLPREPARE);

  if(!Supported( SQL_API_SQLNUMPARAMS))
    {
    rc = SQLNumParams(hstmt, NULL);
    if(!FindError(SQL_HANDLE_STMT,szIM001))
      DISPLAYERROR(szSQLNUMPARAMS, szNotSupported);
    RETCHECK(SQL_ERROR, rc,szSQLNUMPARAMS);
    }
  else
    {
    rc = SQLNumParams(hstmt, NULL);
    RETCHECK(SQL_SUCCESS, rc,szSQLNUMPARAMS);
    }

  FreeStmt(SQL_CLOSE);

} //TestSQLNumParams()

void PASCAL TestSQLParamOptions ( QTSTRUCT * lpqt )

Definition at line 4499 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;

  rc = SQLPrepare(hstmt, lpqt->szParamQuery, SQL_NTS);
  RETCHECK(SQL_SUCCESS, rc,szSQLPREPARE);

  if(!Supported( SQL_API_SQLPARAMOPTIONS))
    {
    rc = SQLParamOptions(hstmt, 1, NULL);
    if(!FindError(SQL_HANDLE_STMT,szIM001))
      DISPLAYERROR(szSQLPARAMOPTIONS, szNotSupported);
    RETCHECK(SQL_ERROR, rc,szSQLPARAMOPTIONS);
    }
  else
    {
    rc = SQLParamOptions(hstmt, 1, NULL);
    RETCHECK(SQL_SUCCESS, rc,szSQLPARAMOPTIONS);
    }

  FreeStmt(SQL_CLOSE);

} //TestSQLParamOptions()

void PASCAL TestSQLPrimaryKeys ( QTSTRUCT * lpqt )

Definition at line 4530 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;

  if (!Supported( SQL_API_SQLPRIMARYKEYS))
    {
    rc = SQLPrimaryKeys(hstmt, NULL, 0, NULL, 0, lpqt->szTableName, SQL_NTS);
    if(!FindError(SQL_HANDLE_STMT,szIM001))
      DISPLAYERROR(szSQLPRIMARYKEYS, szNotSupported);
    RETCHECK(SQL_ERROR, rc,szSQLPRIMARYKEYS);
    }
  else
    {
    rc = SQLPrimaryKeys(hstmt, NULL, 0, NULL, 0, lpqt->szTableName, SQL_NTS);
    RETCHECK(SQL_SUCCESS, rc,szSQLPRIMARYKEYS);
    while(rc == SQL_SUCCESS)
      rc = SQLFetch(hstmt);

    RETCHECK(SQL_NO_DATA_FOUND, rc,szSQLFETCH);

    FreeStmt(SQL_CLOSE);

    }

} //TestSQLPrimaryKeys()

void PASCAL TestSQLProcedureColumns ( QTSTRUCT * lpqt )

Definition at line 4562 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;

  if(!Supported( SQL_API_SQLPROCEDURECOLUMNS))
    {
    rc = SQLProcedureColumns(hstmt, NULL, 0, NULL, 0, NULL, 0, NULL, 0);
    if(!FindError(SQL_HANDLE_STMT,szIM001))
      DISPLAYERROR(TEXT("SQLProcedureColumns"), szNotSupported);
    RETCHECK(SQL_ERROR, rc,TEXT("SQLProcedureColumns"));
    }
  else
    {
    rc = SQLProcedureColumns(hstmt, NULL, 0, NULL, 0, NULL, 0, NULL, 0);
    RETCHECK(SQL_SUCCESS, rc,TEXT("SQLProcedureColumns"));
    while(rc == SQL_SUCCESS)
      rc = SQLFetch(hstmt);

    RETCHECK(SQL_NO_DATA_FOUND, rc,szSQLFETCH);

    FreeStmt(SQL_CLOSE);
    }

} //TestSQLProcedureColumns()

void PASCAL TestSQLProcedures ( )

Definition at line 4593 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;

  if(!Supported( SQL_API_SQLPROCEDURES))
    {
    rc = SQLProcedures(hstmt, NULL, 0, NULL, 0, NULL, 0);
    if(!FindError(SQL_HANDLE_STMT,szIM001))
      DISPLAYERROR(TEXT("SQLProcedures"), szNotSupported);
    RETCHECK(SQL_ERROR, rc,TEXT("SQLProcedures"));
    }
  else
    {
    rc = SQLProcedures(hstmt, NULL, 0, NULL, 0, NULL, 0);
    RETCHECK(SQL_SUCCESS, rc,TEXT("SQLProcedures"));
    while(rc == SQL_SUCCESS)
      rc = SQLFetch(hstmt);
    RETCHECK(SQL_NO_DATA_FOUND, rc,szSQLFETCH);

    FreeStmt(SQL_CLOSE);
    }

} //TestSQLProcedures()

void PASCAL TestSQLSetConnectAttr ( )

Definition at line 4782 of file quiktest.c.

{
  RETCODE rc = SQL_SUCCESS;
  UDWORD  pvParam;
  UWORD   rgbValue;
  BOOL    fSupportSetConnectAttr = TRUE;
  BOOL    fSupportGetConnectAttr = TRUE;

  //make sure these APIs are supported before testing
  if(!Supported(SQL_API_SQLSETCONNECTATTR))
    {
    rgbValue = SQL_MODE_READ_WRITE;
    fSupportSetConnectAttr = FALSE;
    rc = SQLSetConnectAttr(hdbc,SQL_ACCESS_MODE,&rgbValue,sizeof(rgbValue));
    if(!FindError(SQL_HANDLE_DBC,szIM001))
      DISPLAYERROR(szSQLSETCONNECTATTR,TEXT("did not return Not supported message"));
    RETCHECK(SQL_ERROR,rc,szSQLSETCONNECTATTR);
    }

  if(!Supported(SQL_API_SQLGETCONNECTATTR))
    {
    fSupportGetConnectAttr = FALSE;
    rc = SQLGetConnectAttr(hdbc,SQL_ACCESS_MODE,&pvParam,sizeof(pvParam),NULL);
    if(!FindError(SQL_HANDLE_DBC,szIM001))
      DISPLAYERROR(szSQLGETCONNECTATTR,TEXT("did not return Not supported message"));
    RETCHECK(SQL_ERROR,rc,szSQLGETCONNECTATTR);
    }

  if(fSupportSetConnectAttr && (!fSupportGetConnectAttr))
    {
    //test SQL_ACCESS_MODE
    rgbValue = SQL_MODE_READ_WRITE;
    rc = SQLSetConnectAttr(hdbc,SQL_ACCESS_MODE,&rgbValue,sizeof(rgbValue));
    if(!FindError(SQL_HANDLE_DBC,szHYC00))
      RETCHECK(SQL_SUCCESS,rc,szSQLSETCONNECTATTR);
    else
      RETCHECK(SQL_ERROR,rc,szSQLSETCONNECTATTR);
    //test SQL_AUTOCOMMIT
    rgbValue = SQL_AUTOCOMMIT_ON;
    rc = SQLSetConnectAttr(hdbc,SQL_AUTOCOMMIT,&rgbValue,sizeof(rgbValue));
    if(!FindError(SQL_HANDLE_DBC,szHYC00))
      RETCHECK(SQL_SUCCESS,rc,szSQLSETCONNECTATTR);
    else
      RETCHECK(SQL_ERROR,rc,szSQLSETCONNECTATTR);
    //test SQL_LOGIN_TIMEOUT
    //the choice of 15 seconds for timeout is arbitrary
    rgbValue = 15;
    rc = SQLSetConnectAttr(hdbc,SQL_LOGIN_TIMEOUT,&rgbValue,sizeof(rgbValue));
    if(!FindError(SQL_HANDLE_DBC,szHYC00))
      RETCHECK(SQL_SUCCESS,rc,szSQLSETCONNECTATTR);
    else
      RETCHECK(SQL_ERROR,rc,szSQLSETCONNECTATTR);
    }

  if((!fSupportSetConnectAttr) && fSupportGetConnectAttr)
  {
    //test SQL_ACCESS_MODE
    rc = SQLGetConnectAttr(hdbc,SQL_ACCESS_MODE,&pvParam,sizeof(pvParam),NULL);
    if(!FindError(SQL_HANDLE_DBC,szHYC00))
      RETCHECK(SQL_SUCCESS,rc,szSQLGETCONNECTATTR);
    else
      RETCHECK(SQL_ERROR,rc,szSQLGETCONNECTATTR);
    //test SQL_AUTOCOMMIT
    rc = SQLGetConnectAttr(hdbc,SQL_AUTOCOMMIT,&pvParam,sizeof(pvParam),NULL);
    if(!FindError(SQL_HANDLE_DBC,szHYC00))
      RETCHECK(SQL_SUCCESS,rc,szSQLGETCONNECTATTR);
    else
      RETCHECK(SQL_ERROR,rc,szSQLGETCONNECTATTR);
    //test SQL_LOGIN_TIMEOUT
    rc = SQLGetConnectAttr(hdbc,SQL_LOGIN_TIMEOUT,&pvParam,sizeof(pvParam),NULL);
    if(!FindError(SQL_HANDLE_DBC,szHYC00))
      RETCHECK(SQL_SUCCESS,rc,szSQLGETCONNECTATTR);
    else
      RETCHECK(SQL_ERROR,rc,szSQLGETCONNECTATTR);
    //SQL_ATTR_AUTO_IPD is a read-only attribute
    rc = SQLGetConnectAttr(hdbc,SQL_ATTR_AUTO_IPD,&pvParam,sizeof(pvParam),NULL);
    if(!FindError(SQL_HANDLE_DBC,szHYC00))
      RETCHECK(SQL_SUCCESS,rc,szSQLGETCONNECTATTR);
    else
      RETCHECK(SQL_ERROR,rc,szSQLGETCONNECTATTR);
  }

  if(fSupportSetConnectAttr && fSupportGetConnectAttr)
  {

    //test SQL_ACCESS_MODE
    TestConnectAttr(hdbc,SQL_ACCESS_MODE,SQL_MODE_READ_WRITE,TEXT("SQL_ACCESS_MODE"),FALSE);

    //test SQL_AUTOCOMMIT
    TestConnectAttr(hdbc,SQL_AUTOCOMMIT,SQL_AUTOCOMMIT_ON,TEXT("SQL_AUTOCOMMIT"),FALSE);

    //test SQL_LOGIN_TIMEOUT
    //the choice of 15 seconds for timeout is arbitrary
    TestConnectAttr(hdbc,SQL_LOGIN_TIMEOUT,15,TEXT("SQL_LOGIN_TIMEOUT"),FALSE);

    //SQL_ATTR_AUTO_IPD is a read-only attribute
    TestConnectAttr(hdbc,SQL_ATTR_AUTO_IPD,15,TEXT("SQL_ATTR_AUTO_IPD"),TRUE);
  }

} //TestSQLSetConnectAttr()

void PASCAL TestSQLSetScrollOptions ( )

Definition at line 4685 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;
  UWORD           i,
        j;
  UDWORD  fSupportedOpt;
  UDWORD  fSupportedCon;
  TCHAR           szState[100]=TEXT(""),
        szErrMsg[XLARGEBUFF]=TEXT("");

  FreeStmt(SQL_CLOSE);

  if(!Supported( SQL_API_SQLSETSCROLLOPTIONS))
    {
    rc = SQLSetScrollOptions(hstmt, SQL_CONCUR_READ_ONLY, SQL_SCROLL_FORWARD_ONLY,
      1);
    if(!FindError(SQL_HANDLE_STMT,szIM001))
      DISPLAYERROR(szSQLSETSCROLLOPTIONS, szNotSupported);
    RETCHECK(SQL_ERROR, rc,szSQLSETSCROLLOPTIONS);
    }
  else
    {
    rc = SQLGetInfo(hdbc, SQL_SCROLL_CONCURRENCY, &fSupportedCon, 4, NULL);
    RETCHECK(SQL_SUCCESS, rc,szSQLGETINFO);
    rc = SQLGetInfo(hdbc, SQL_SCROLL_OPTIONS, &fSupportedOpt, 4, NULL);
    RETCHECK(SQL_SUCCESS, rc,szSQLGETINFO);

    for(i = 0; i < sizeof(OptionList) / sizeof(SUPPORTOPTINFO); i ++)
      {
      for(j = 0; j < sizeof(ConcurList) / sizeof(SUPPORTCONCURINFO); j++)
        {
        if(fSupportedOpt & OptionList[i].Support && fSupportedCon & ConcurList[j].Support)
          {
          if(!((ConcurList[j].Option == SQL_CONCUR_VALUES) && ((lpSI->vCursorLib ==
              SQL_CUR_USE_IF_NEEDED) || (lpSI->vCursorLib == SQL_CUR_USE_ODBC))))
            {
            rc = SQLSetScrollOptions(hstmt, ConcurList[j].Option,OptionList[i].Option, 1);
            RETCHECK(SQL_SUCCESS, rc,szSQLSETSCROLLOPTIONS);
            }

          }
        }
      }
    }

  FreeStmt(SQL_CLOSE);

  // Set the Cursor back to READ_ONLY, FORWARD_ONLY, 1
  rc = SQLSetScrollOptions(hstmt,SQL_CONCUR_READ_ONLY,SQL_SCROLL_FORWARD_ONLY,1);

} //TestSQLSetScrollOptions()

void PASCAL TestSQLSetStmtAttr ( )

Definition at line 4890 of file quiktest.c.

{
  RETCODE rc = SQL_SUCCESS, rc2= SQL_SUCCESS;
  UDWORD  pvParam;
  UWORD   rgbValue;
  BOOL    fSupportSetStmtAttr = TRUE;
  BOOL    fSupportGetStmtAttr = TRUE;

  //make sure these APIs are supported before testing
  if(!Supported(SQL_API_SQLSETSTMTATTR))
    {
    //the choice of 300 for SQL_MAX_LENGTH is arbitrary
    rgbValue = 300;
    fSupportSetStmtAttr = FALSE;
    rc = SQLSetStmtAttr(hstmt,SQL_MAX_LENGTH,&rgbValue,sizeof(rgbValue));
    if(!FindError(SQL_HANDLE_STMT,szIM001))
      DISPLAYERROR(szSQLSETSTMTATTR,TEXT("did not return Not supported message"));
    RETCHECK(SQL_ERROR,rc,szSQLSETSTMTATTR);
    }

  if(!Supported(SQL_API_SQLGETSTMTATTR))
    {
    fSupportGetStmtAttr = FALSE;
    rc = SQLGetStmtAttr(hstmt,SQL_MAX_LENGTH,&pvParam,sizeof(pvParam),NULL);
    if(!FindError(SQL_HANDLE_STMT,szIM001))
      DISPLAYERROR(szSQLGETSTMTATTR,TEXT("did not return Not supported message"));
    RETCHECK(SQL_ERROR,rc,szSQLGETSTMTATTR);
    }

  if(fSupportSetStmtAttr && (!fSupportGetStmtAttr))
    {
    //test SQL_MAX_LENGTH
    rgbValue = 300;
    rc = SQLSetStmtAttr(hstmt,SQL_MAX_LENGTH,&rgbValue,sizeof(rgbValue));
    if(!FindError(SQL_HANDLE_STMT,szHYC00))
      RETCHECK(SQL_SUCCESS,rc,szSQLSETSTMTATTR);
    else
      RETCHECK(SQL_ERROR,rc,szSQLSETSTMTATTR);
    //test SQL_ATTR_METADATA_ID -- new in 3.0
    rgbValue = SQL_FALSE;
    rc = SQLSetStmtAttr(hstmt,SQL_ATTR_METADATA_ID,&rgbValue,sizeof(rgbValue));
    if(!FindError(SQL_HANDLE_STMT,szHYC00))
      RETCHECK(SQL_SUCCESS,rc,szSQLSETSTMTATTR);
    else
      RETCHECK(SQL_ERROR,rc,szSQLSETSTMTATTR);
    }

  if((!fSupportSetStmtAttr) && fSupportGetStmtAttr)
    {
    //test SQL_MAX_LENGTH
    rc = SQLGetStmtAttr(hstmt,SQL_MAX_LENGTH,&pvParam,sizeof(pvParam),NULL);
    if(!FindError(SQL_HANDLE_STMT,szHYC00))
      RETCHECK(SQL_SUCCESS,rc,szSQLGETSTMTATTR);
    else
      RETCHECK(SQL_ERROR,rc,szSQLGETSTMTATTR);
    //test SQL_ATTR_METADATA_ID -- new in 3.0
    rc = SQLGetStmtAttr(hstmt,SQL_ATTR_METADATA_ID,&pvParam,sizeof(pvParam),NULL);
    if(!FindError(SQL_HANDLE_STMT,szHYC00))
      RETCHECK(SQL_SUCCESS,rc,szSQLGETSTMTATTR);
    else
      RETCHECK(SQL_ERROR,rc,szSQLGETSTMTATTR);
    }

  if(fSupportSetStmtAttr && fSupportGetStmtAttr)
    {

    //test SQL_MAX_LENGTH
    rgbValue = 8000;
    rc = SQLSetStmtAttr(hstmt,SQL_MAX_LENGTH,(PTR)rgbValue,sizeof(rgbValue));
    if(!FindError(SQL_HANDLE_STMT,szHYC00))
      {
      RETCHECK(SQL_SUCCESS,rc,szSQLSETSTMTATTR);
      rc = SQLGetStmtAttr(hstmt,SQL_MAX_LENGTH,&pvParam,sizeof(pvParam),NULL);
      if(!FindError(SQL_HANDLE_STMT,szHYC00))
        {
        RETCHECK(SQL_SUCCESS,rc,szSQLGETSTMTATTR);
        if(pvParam != 8000)
          DISPLAYERROR(szSQLGETSTMTATTR,TEXT("SQL_MAX_LENGTH returned incorrect value"));
        }
      else
        RETCHECK(SQL_ERROR,rc,szSQLGETSTMTATTR);
      }
    else
      RETCHECK(SQL_ERROR,rc,szSQLSETSTMTATTR);

    //test SQL_ATTR_METADATA_ID -- new in 3.0
    rgbValue = SQL_FALSE;
    rc = SQLSetStmtAttr(hstmt,SQL_ATTR_METADATA_ID,(PTR)rgbValue,sizeof(rgbValue));
    if (!FindError(SQL_HANDLE_STMT,szHYC00) && !FindError(SQL_HANDLE_STMT,szHY092))
      RETCHECK(SQL_SUCCESS,rc,szSQLSETSTMTATTR);

    rc2 = SQLGetStmtAttr(hstmt,SQL_ATTR_METADATA_ID,&pvParam,sizeof(pvParam),NULL);
    if (!FindError(SQL_HANDLE_STMT,szHYC00) && !FindError(SQL_HANDLE_STMT,szHY092))
      RETCHECK(SQL_SUCCESS,rc,szSQLGETSTMTATTR);

    if (RC_SUCCESSFUL(rc) && RC_SUCCESSFUL(rc2) && pvParam != SQL_FALSE)
      DISPLAYERROR(szSQLGETSTMTATTR,TEXT("SQL_ATTR_METADATA_ID returned incorrect value"));

    //Reset SQL_MAX_LENGTH
    rgbValue = 0;
    rc = SQLSetStmtAttr(hstmt,SQL_MAX_LENGTH,(PTR)rgbValue,sizeof(rgbValue));
    if(!FindError(SQL_HANDLE_STMT,szHYC00))
      {
      RETCHECK(SQL_SUCCESS,rc,szSQLSETSTMTATTR);
      rc = SQLGetStmtAttr(hstmt,SQL_MAX_LENGTH,&pvParam,sizeof(pvParam),NULL);
      if(!FindError(SQL_HANDLE_STMT,szHYC00))
        {
        RETCHECK(SQL_SUCCESS,rc,szSQLGETSTMTATTR);
        if(pvParam != 0)
          DISPLAYERROR(szSQLGETSTMTATTR,TEXT("SQL_MAX_LENGTH returned incorrect value"));
        }
      else
        RETCHECK(SQL_ERROR,rc,szSQLGETSTMTATTR);
      }
    else
      RETCHECK(SQL_ERROR,rc,szSQLSETSTMTATTR);
  }

} //TestSQLSetStmtAttr()

void PASCAL TestSQLSpecialCols ( QTSTRUCT * lpqt )

Definition at line 3590 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;
  UWORD           i;

  rc = SQLSpecialColumns(hstmt, SQL_BEST_ROWID, NULL, 0, NULL, 0,
    lpqt->szTableName, (SWORD)(_tcslen(lpqt->szTableName)), SQL_SCOPE_TRANSACTION,
    SQL_NULLABLE);
  RETCHECK(SQL_SUCCESS, rc,szSQLSPECIALCOLUMNS);

  for(i = 0;; i++)
    {
    rc = SQLFetch(hstmt);
    if(rc != SQL_SUCCESS)
      break;
    }

  RETCHECK(SQL_NO_DATA_FOUND, rc,szSQLFETCH);

  FreeStmt(SQL_CLOSE);

} //TestSQLSpecialCols()

BOOL PASCAL TestSQLStatistics | ( | QTSTRUCT * | lpqt,
 |  | FIELDINFO * | rgFields,
 |  | UWORD | cTypes,
 |  | DSTRUCT * | lpd,
 |  | UWORD | fIndex
 | ) |  |

Definition at line 3668 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;
  UWORD           i;

  _tcscpy(lpqt->szDataItem, lpqt->szTableName);
  lpqt->szDataItem[0] = TEXT('i');
  for(i = 1; i < cTypes; i++)
    if(rgFields[i].wSQLType == SQL_INTEGER ||
      rgFields[i].wSQLType == SQL_SMALLINT)
      break;
  if(i == cTypes)
    i = 0;

  _tcscpy(lpqt->buf, rgFields[i].szFieldName);
  wsprintf(lpqt->sz,TEXT("create unique index %s on %s (%s)"),
    lpqt->szDataItem, lpqt->szTableName, lpqt->buf);

  rc = SQLExecDirect(hstmt, lpqt->sz, SQL_NTS);
  if(fIndex < 1)
    /* if this is minimal grammar, don't count on indexes being available */
    fIndex = rc == SQL_SUCCESS;
  else
    RETCHECK(SQL_SUCCESS, rc,szSQLEXECDIRECT);

  VerifyIndex(lpqt,fIndex);

  return(fIndex);

} //TestSQLStatistics()

void PASCAL TestSQLTablePrivileges ( )

Definition at line 4622 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;

  if(!Supported( SQL_API_SQLTABLEPRIVILEGES))
    {
    rc = SQLTablePrivileges(hstmt, NULL, 0, NULL, 0, NULL, 0);
    if(!FindError(SQL_HANDLE_STMT,szIM001))
      DISPLAYERROR(TEXT("SQLTablePrivileges"), szNotSupported);
    RETCHECK(SQL_ERROR, rc,TEXT("SQLTablePrivileges"));
    }
  else
    {
    rc = SQLTablePrivileges(hstmt, NULL, 0, NULL, 0, NULL, 0);
    RETCHECK(SQL_SUCCESS, rc,TEXT("SQLTablePrivileges"));
    while(rc == SQL_SUCCESS)
      rc = SQLFetch(hstmt);

    RETCHECK(SQL_NO_DATA_FOUND, rc,szSQLFETCH);

    FreeStmt(SQL_CLOSE);
    }

} //TestSQLTablePrivileges()

void PASCAL TestSQLTables ( QTSTRUCT * lpqt )

Definition at line 3547 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;
  BOOL            fFoundTable=FALSE;
  UWORD           i;

  /* this call may return many tables, as  */
  /* long as the one created earlier shows */
  /* up it will pass. */

  rc = SQLTables(hstmt, NULL, 0, NULL, 0,TEXT("q%"),SQL_NTS,TEXT("'TABLE'"), SQL_NTS);

  RETCHECK(SQL_SUCCESS, rc,szSQLTABLES);

  for(i = 0;; i++)
    {
    rc = SQLFetch(hstmt);
    if(rc != SQL_SUCCESS)
      break;

    /* column 3 is tablename */
    rc = SQLGetData(hstmt, 3, SQL_C_TCHAR, lpqt->sz, sizeof(lpqt->sz), NULL);
    RETCHECK(SQL_SUCCESS, rc,szSQLGETDATA); /* should not overflow
      and return SQL_SUCCESS_WITH_INFO because the buffer is larger than the
      table name */
    fFoundTable += 0 == _tcsicmp(lpqt->sz, lpqt->szTableName);
    }

  RETCHECK(SQL_NO_DATA_FOUND, rc,szSQLFETCH);

  if(1 != fFoundTable) {
    DISPLAYERROR(szSQLTABLES,TEXT("table not found"));
  }

  FreeStmt(SQL_CLOSE);

} //TestSQLTables()

void PASCAL TestStmtOptions ( )

Definition at line 2072 of file quiktest.c.

{
  UDWORD  dwLen,
        udw;
  BOOL            fConnectOption;
  RETCODE rc=SQL_SUCCESS;
  TCHAR           szAPI[MEDBUFF];
  SDWORD  cbValue=0;

  SetStatementAttributes(SQL_MAX_LENGTH,(PTR)&udw);

  if (SetStatementAttributes(SQL_MAX_LENGTH, (PTR)TEST_STMT_OPTION))
    fConnectOption = TRUE;

  if (Supported(SQL_API_SQLGETSTMTATTR))
  {
    rc = SQLGetStmtAttr(hstmt, SQL_MAX_LENGTH, (PTR)&dwLen,sizeof(dwLen),&cbValue);
    _tcscpy(szAPI,szSQLGETSTMTATTR);
  }
  else
  {
    rc = SQLGetStmtOption(hstmt, SQL_MAX_LENGTH, &dwLen);
    _tcscpy(szAPI,szSQLGETSTMTOPTION);
  }

  if(rc != SQL_SUCCESS)
  {
    if(!FindError(SQL_HANDLE_STMT,szHYC00))
      RETCHECK(SQL_SUCCESS, rc,szSQLGETSTMTOPTION);
  }
  else
  {
    if(dwLen != TEST_STMT_OPTION && rc == SQL_SUCCESS && fConnectOption)
      DISPLAYERROR(szSQLGETSTMTOPTION,TEXT("incorrect SQL_MAX_LENGTH value returned"));
  }

  //Reset the MAX_LENGTH
  if(fConnectOption)
    SetStatementAttributes(SQL_MAX_LENGTH, (PTR)0);

} //TestStmtOptions()

void TestThreading | ( | lpSERVERINFO | lpSI,
 |  | QTSTRUCT * | lpqt,
 |  | FIELDINFO * | rgFieldInfo
 | ) |  |

Definition at line 5082 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;
   THREAD_STRUCT *pArg;
   HANDLE hThread[NUM_THREAD];
  DWORD dwThreadId;
  UWORD i;
  HENV    henv1;
  HDBC    hdbc1;

  // allocate memory for the threads
  pArg = (THREAD_STRUCT *)AllocateMemory((NUM_THREAD) * sizeof(THREAD_STRUCT));

  if(!pArg)
  {
    szWrite(TEXT("\t\t\tMultiThreading Test interrupted due to error in memory allocation"), TRUE);
    return;
  }

  // only one environment handle will be needed for all threads
  rc = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv1);
  RETCHECK(SQL_SUCCESS, rc,szSQLALLOCHANDLE);

  // Set environment attribute, or we can't allocate connection
  rc = SQLSetEnvAttr(henv1, SQL_ATTR_ODBC_VERSION, (SQLPOINTER)SQL_OV_ODBC3,
    SQL_IS_UINTEGER);
  RETCHECK(SQL_SUCCESS, rc,szSQLSETENVATTR);

  for (i=0; i < NUM_THREAD; i++ )
  {
    // allocate connection handle for each thread
    rc=SQLAllocHandle(SQL_HANDLE_DBC,henv1, &hdbc1);
    RETCHECK(SQL_SUCCESS, rc,szSQLALLOCHANDLE);

    // create string to be used in connecting
    wsprintf(lpqt->sz,TEXT("dsn=%s;uid=%s;pwd=%s;"),
    lpSI->szValidServer0,
    lpSI->szValidLogin0,
    lpSI->szValidPassword0);

    rc=SQLDriverConnect(hdbc1, lpSI->hwnd, lpqt->sz,
       SQL_NTS, lpqt->buf, MAX_STRING_SIZE, NULL, SQL_DRIVER_NOPROMPT);

    if (!RC_SUCCESSFUL(rc))
      DISPLAYERROR(TEXT("TestThread failed:"),TEXT("SQLDriverConnect failed"));

    // initialize thread structure
    pArg[i].henv = henv1;
    pArg[i].hdbc = hdbc1;
    _tcscpy(pArg[i].szTableName, lpqt->szTableName);
    pArg[i].rgFieldInfo=rgFieldInfo[0];

    // start thread
    hThread[i]= CreateThread(NULL,
              0,
              ThreadLoop,
              &pArg[i],
              0,
              &dwThreadId);

    if(hThread[i]==0)
    {
      DISPLAYERROR(TEXT("TestThread failed:"),TEXT("cannot create thread"));
      break;
    }
  }

  // wait for thread completion
  WaitForMultipleObjects(NUM_THREAD,hThread,TRUE,INFINITE);

  for(i=0; i<NUM_THREAD; i++ )
  CloseHandle(hThread[i]);

  SQLFreeHandle(SQL_HANDLE_ENV,henv1);
  if (pArg)
    ReleaseMemory(pArg);
}       //end of TestThreading()

void PASCAL TestUseDesc | ( | QTSTRUCT * | lpqt,
 |  | FIELDINFO * | rgFields
 | ) |  |

Definition at line 6292 of file quiktest.c.

{
  LPTSTR   pch=NULL;
  SDWORD crow=0;
  TCHAR   szQuery[XLARGEBUFF]=TEXT("");
  SQLRETURN rc;
  UWORD   row, icol, paramno;
  SWORD   ccol;
  TCHAR * rgbMemBuf=NULL, * rgbValue=NULL;
  SDWORD * pcbValueBuf=NULL, * pcbValue=NULL;

  if (Supported(SQL_API_SQLSETDESCFIELD))
  {

    // Test descriptor bindcol

    // Reallocate hstmt to set to defaults
    ResetHstmt(&hstmt);

    // Perform a select stmt
    wsprintf(szQuery,szSELECTSTAR,lpqt->szTableName);
    rc = SQLExecDirect(hstmt, szQuery, SQL_NTS);
    RETCHECK(SQL_SUCCESS, rc,szSQLEXECDIRECT);

    rc=SQLNumResultCols(hstmt, &ccol);
    RETCHECK(SQL_SUCCESS, rc, szSQLNUMRESULTCOLS);

    rc=SQLFreeStmt(hstmt, SQL_CLOSE); // Close the cursor so we can insert
    RETCHECK(SQL_SUCCESS, rc,szSQLFREESTMT);

    rgbMemBuf=AllocateMemory(ccol*MAX_STRING_SIZE*sizeof(TCHAR));

    if (!rgbMemBuf)
    {
      DISPLAYERROR(TEXT("Simulate BindCol"),TEXT("Out of memory!"));
      goto ExitUseDesc;
    }

    pcbValueBuf=(SDWORD *)AllocateMemory(ccol*sizeof(SDWORD));

    if (!pcbValueBuf)
    {
      DISPLAYERROR(TEXT("Simulate BindCol"),TEXT("Out of memory!"));
      goto ExitUseDesc;
    }

    // Bind a parameter for each column in the result set using descriptors
    paramno=0;
    for (icol=1, rgbValue=rgbMemBuf, pcbValue=pcbValueBuf;
      icol <= ccol;
      icol++, rgbValue+=MAX_STRING_SIZE, pcbValue++)
    {
      pch = qtMakeData(guwRowCount, icol-1, &rgFields[icol-1], rgbValue);

      // Field is not READ ONLY
      if(pch)
      {
        // Where row and column match and field is nullable, make NULL
        if (icol == guwRowCount && rgFields[icol-1].nullable)
          *pcbValue=SQL_NULL_DATA;
        else
          *pcbValue=SQL_NTS;

        paramno++;
//                              rc=SQLBindParameter(hstmt, paramno, SQL_PARAM_INPUT, SQL_C_TCHAR,
        rc=DescBindParameter(hstmt, paramno, SQL_PARAM_INPUT, SQL_C_TCHAR,
          rgFields[icol-1].wSQLType, rgFields[icol-1].precision,
          rgFields[icol-1].scale, rgbValue, 0, pcbValue);
        RETCHECK(SQL_SUCCESS, rc,TEXT("DescBindParameter"));
      }
    }

    // Insert the new row.  Note that the inserted row will be checked
    // for accuracy below.
    rc = SQLExecDirect(hstmt, szInsertStmt, SQL_NTS);
    ERRSHANDLE(SQL_HANDLE_STMT, hstmt, SQL_SUCCESS, rc, szSQLEXECDIRECT);

    if (RC_SUCCESSFUL(rc))
      guwRowCount++;

    // Perform the select stmt again
    wsprintf(szQuery,szSELECTSTAR,lpqt->szTableName);
    rc = SQLExecDirect(hstmt, szQuery, SQL_NTS);
    RETCHECK(SQL_SUCCESS, rc,szSQLEXECDIRECT);

    // Bind all the columns to char
    for (icol=1, rgbValue=rgbMemBuf, pcbValue=pcbValueBuf;
      icol <= ccol;
      icol++, rgbValue+=MAX_STRING_SIZE, pcbValue++)
    {
      // Bind to next column
      rc = DescBindCol(hstmt, icol, SQL_C_TCHAR, rgbValue, MAX_STRING_SIZE*sizeof(TCHAR), pcbValue);
//                      rc = SQLBindCol(hstmt, icol, SQL_C_TCHAR, rgbValue, MAX_STRING_SIZE*sizeof(TCHAR), pcbValue);
      RETCHECK(SQL_SUCCESS, rc, TEXT("DescBindCol"));
    }

    // Fetch all the rows and check the bound value with MakeAData for
    // each column
    for (row=1; rc == SQL_SUCCESS; row++)
    {
      rc=SQLFetch(hstmt); // Will return SQL_NO_DATA after last row

      if (SQL_SUCCESS == rc)
      {

        // Compare all the columns
        for (icol=1, rgbValue=rgbMemBuf, pcbValue=pcbValueBuf;
          icol <= ccol;
          icol++, rgbValue+=MAX_STRING_SIZE, pcbValue++)
        {

          CompareWithExpected(rgbValue, pcbValue, row, icol, rgFields);
        }
      }
      else
        ERRSHANDLE(SQL_HANDLE_STMT, hstmt, SQL_NO_DATA, rc, szSQLFETCH);

    }

    // Close the cursor and retry using SQLFetchScroll
    rc=SQLFreeStmt(hstmt, SQL_CLOSE);
    RETCHECK(SQL_SUCCESS, rc,szSQLFREESTMT);

    // Make sure we have a rowset size of 1
    rc=SQLSetStmtAttr(hstmt, SQL_ATTR_ROW_ARRAY_SIZE, (SQLPOINTER)1, SQL_IS_UINTEGER);
    ERRSHANDLE(SQL_HANDLE_STMT, hstmt, SQL_SUCCESS, rc, szSQLSETDESCFIELD);

    // Re-execute the query
    rc = SQLExecDirect(hstmt, szQuery, SQL_NTS);
    RETCHECK(SQL_SUCCESS, rc,szSQLEXECDIRECT);

    // Fetch all the rows and check the bound value with MakeAData for
    // each column
    for (row=1, rc=SQL_SUCCESS; rc == SQL_SUCCESS; row++)
    {
      rc=SQLFetchScroll(hstmt, SQL_FETCH_NEXT, 1); // Will return SQL_NO_DATA after last row

      if (SQL_SUCCESS == rc)
      {

        // Compare all the columns
        for (icol=1, rgbValue=rgbMemBuf, pcbValue=pcbValueBuf;
          icol <= ccol;
          icol++, rgbValue+=MAX_STRING_SIZE, pcbValue++)
        {

          CompareWithExpected(rgbValue, pcbValue, row, icol, rgFields);
        }
      }
      else
        ERRSHANDLE(SQL_HANDLE_STMT, hstmt, SQL_NO_DATA, rc, szSQLFETCHSCROLL);

    }

  }

ExitUseDesc:
  rc=SQLFreeStmt(hstmt,SQL_RESET_PARAMS);
  rc=SQLFreeStmt(hstmt, SQL_CLOSE);
  RETCHECK(SQL_SUCCESS, rc,szSQLFREESTMT);

  if (rgbMemBuf)
    ReleaseMemory(rgbMemBuf);
  if (pcbValueBuf)
    ReleaseMemory(pcbValueBuf);

} // TestUseDesc

DWORD WINAPI ThreadLoop ( void * pArg )

Definition at line 5054 of file quiktest.c.

{

  THREAD_STRUCT *ptArg = (THREAD_STRUCT *)pArg;
  int i;
  RETCODE rc;

  for(i=0; i< NUM_THREAD; i++)
    TestOneThread(ptArg);

  // free connection handle for each thread
  rc=SQLDisconnect(ptArg->hdbc);
    RETCHECK(SQL_SUCCESS,rc,szSQLDISCONNECT);
  rc=SQLFreeHandle(SQL_HANDLE_DBC,ptArg->hdbc);
  RETCHECK(SQL_SUCCESS,rc,szSQLFREEHANDLE);

  return(0);
} //end of ThreadLoop

void PASCAL VerifyIndex | ( | QTSTRUCT * | lpqt,
 |  | UWORD | fIndex
 | ) |  |

Definition at line 3620 of file quiktest.c.

{
  RETCODE rc=SQL_SUCCESS;
  BOOL            fFoundTable=FALSE;
  UWORD           i;
  SDWORD  sdw;

  rc = SQLStatistics(hstmt, NULL, 0, NULL, 0, lpqt->szTableName,
  SQL_NTS, SQL_INDEX_ALL, SQL_ENSURE);
  RETCHECK(SQL_SUCCESS, rc,TEXT("SQLStatistics"));

  fFoundTable = 0;
  for(i = 0;; i++)
    {
    rc = SQLFetch(hstmt);
    if(rc != SQL_SUCCESS)
      break;

    rc = SQLGetData(hstmt, 3, SQL_C_TCHAR, lpqt->sz, sizeof(lpqt->sz),
      &sdw);
    RETCHECK(SQL_SUCCESS, rc,szSQLGETDATA);
    if (_tcsicmp(lpqt->sz, lpqt->szTableName) == 0)
      {
      rc = SQLGetData(hstmt, 6, SQL_C_TCHAR, lpqt->sz, sizeof(lpqt->sz),
        &sdw);
      RETCHECK(SQL_SUCCESS, rc,szSQLGETDATA);
      fFoundTable += 0 == _tcsicmp(lpqt->sz, lpqt->szDataItem);
      }
    }

  RETCHECK(SQL_NO_DATA_FOUND, rc,szSQLFETCH);

  if(1 != fFoundTable && fIndex)
    DISPLAYERROR(TEXT("SQLStatistics"),TEXT("index not returned"));

  /* one row represents original table, the */
  /* other represents the index                           */
  if(i > 2 || i < 1)
    DISPLAYERROR(TEXT("SQLStatistics"),TEXT("too many rows"));

  FreeStmt(SQL_CLOSE);

} //VerifyIndex()

Variable Documentation

SQLTCHAR buf[MAX_STRING_SIZE]

Definition at line 219 of file quiktest.c.

SQLINTEGER cbtsval = sizeof(TIMESTAMP_STRUCT)

Definition at line 214 of file quiktest.c.

SQLINTEGER cbValue

Definition at line 215 of file quiktest.c.

SQLINTEGER cbValueMax

Definition at line 215 of file quiktest.c.

SUPPORTCONCURINFO ConcurList[]
Initial value:
 {SQL_SCCO_READ_ONLY, SQL_CONCUR_READ_ONLY,
                  SQL_SCCO_LOCK, SQL_CONCUR_LOCK,
                  SQL_SCCO_OPT_TIMESTAMP, SQL_CONCUR_TIMESTAMP,
                  SQL_SCCO_OPT_VALUES, SQL_CONCUR_VALUES}

Definition at line 187 of file quiktest.c.

SQLSMALLINT DescBuf[MAX_DESC_BUF]

Definition at line 217 of file quiktest.c.

struct tagDescType DescTypes[]
UWORD fBindParameter = FALSE

Definition at line 197 of file quiktest.c.

UWORD fDiagFieldSupported = FALSE

Definition at line 199 of file quiktest.c.

UWORD fDiagRecSupported = FALSE

Definition at line 198 of file quiktest.c.

BOOL g_f3XDriver = FALSE

Definition at line 318 of file quiktest.c.

UWORD guwRowCount = 0

Definition at line 201 of file quiktest.c.

LPTSTR iTestNames[]

Definition at line 126 of file quiktest.c.

lpSERVERINFO lpSI = NULL

Definition at line 196 of file quiktest.c.

SUPPORTOPTINFO OptionList[]
Initial value:
 {SQL_SO_FORWARD_ONLY, SQL_SCROLL_FORWARD_ONLY,
                  SQL_SO_KEYSET_DRIVEN, SQL_SCROLL_KEYSET_DRIVEN,
                  SQL_SO_DYNAMIC, SQL_SCROLL_DYNAMIC}

Definition at line 183 of file quiktest.c.

struct tagDescInfo rgDescInfo[]
struct tagDIAGINFO rgDiagInfo[]
SQLUINTEGER RowsProcessed

Definition at line 216 of file quiktest.c.

SQLUSMALLINT StatusArray[STATUS_ARRAY_SIZE]

Definition at line 218 of file quiktest.c.

SQLINTEGER swBindOffset = 128

Definition at line 215 of file quiktest.c.

TCHAR szInsertStmt[MAX_STRING_SIZE]

Definition at line 321 of file quiktest.c.

SQLTCHAR szParamName[MAX_STRING_SIZE] = TEXT("Parameter Name")

Definition at line 220 of file quiktest.c.

TIMESTAMP_STRUCT tsval = {1955, 12, 31, 23, 59, 59, 999}

Definition at line 213 of file quiktest.c.

UWORD uDriverODBCVer = 0

Definition at line 200 of file quiktest.c.

Generated on Wed Nov 13 2024 16:53:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/odbc/quiktest/quiktest.h File Reference

  • Dataaccess
  • odbc
  • quiktest
Classes | Defines | Typedefs | Functions | Variables

quiktest.h File Reference

Go to the source code of this file.

Classes

struct | FieldInfo
struct | SupportConcurList
struct | SupportOptList
struct | tagDataStruct
struct | tagQtStruct
struct | THREAD_STRUCT

Defines

#define | ABORT -1
#define | BIND_PARM_OFFSET 0
#define | BIND_SIZE 12
#define | COLNAME_START 1
#define | COMBINED_SIZE MAX_ERROR_SIZE + 30
#define | DESC_AD DESC_APD|DESC_ARD
#define | DESC_ALL DESC_APD|DESC_IPD|DESC_ARD|DESC_IRD
#define | DESC_APD 1
#define | DESC_ARD 4
#define | DESC_ID DESC_IPD|DESC_IRD
#define | DESC_IPD 2
#define | DESC_IRD 8
#define | DESC_MOST DESC_AD|DESC_IPD
#define | DESC_NONE 0
#define | DESC_PD DESC_APD|DESC_IPD
#define | DESC_RD DESC_ARD|DESC_IRD
#define | DESC_UPDATE_MODE_READ 0
#define | DESC_UPDATE_MODE_WRITE 1
#define | DIAGRETCHECK(exp, rec, buf) ReturnCheck(exp, rec, buf, TEXT(__FILE__), __LINE__,TRUE)
#define | DISPLAYERROR(func, string) qtDisplayError(func, string, TEXT(__FILE__), __LINE__)
#define | ERRSHANDLE(type, handle, exp, rec, buf) ErrsHandle(type, handle, exp, rec, buf, TEXT(__FILE__), __LINE__,FALSE)
#define | IGNORED 999
#define | INSERT_FAIL -1
#define | LARGEBUFF 300
#define | MAX_BIND_ARRAY_ELEMENT MAX_QUERY_SIZE / MAX_BIND_ELEMENTS
#define | MAX_BIND_ELEMENTS 100
#define | MAX_COLUMN_LIST_SIZE 200
#define | MAX_COLUMN_NAME_SIZE 100
#define | MAX_DATA_SIZE 45
#define | MAX_DESC_BUF 200
#define | MAX_ERROR_SIZE 200
#define | MAX_FIELD 40
#define | MAX_INSERT_VALUES_SIZE 200
#define | MAX_NUM_BUFFER 60
#define | MAX_PARAM_SIZE 129
#define | MAX_PREFIX 129
#define | MAX_QUERY_SIZE 2048
#define | MAX_ROW_ITEM_LIMIT 4
#define | MAX_STRING_SIZE 700
#define | MAX_SUFFIX 129
#define | MAX_TABLE_NAME 60
#define | MAX_TYPE_NAME 129
#define | MAX_TYPES_SUPPORTED 25
#define | MAXSDWORD ((SDWORD)(MAXUDWORD / 2))
#define | MAXUDWORD ((UDWORD)(-1))
#define | MEDBUFF 200
#define | MINSDWORD (-(SDWORD)((MAXUDWORD / 2) + 1))
#define | NUM_QUIKREBIND_ROWSETS 6
#define | NUM_THREAD 5
#define | PREFIX_SIZE 3
#define | RC_NOTSUCCESSFUL(rc) (!(RC_SUCCESSFUL(rc)))
#define | RC_SUCCESSFUL(rc)
#define | REC_COUNT_UNK -1
#define | RETCHECK(exp, rec, buf) ReturnCheck(exp, rec, buf, TEXT(__FILE__), __LINE__,FALSE)
#define | SCALEDIFF 4
#define | SMALLBUFF 100
#define | STATE_SIZE 6
#define | STATUS_ARRAY_SIZE 5
#define | TEST_CONNECT_OPTION 15
#define | TEST_STMT_OPTION 300
#define | TYPE_PORTION 4
#define | UNTOUCHED 0xCA
#define | XLARGEBUFF 1024

Typedefs

typedef struct tagDataStruct | DSTRUCT
typedef struct FieldInfo | FIELDINFO
typedef struct tagQtStruct | QTSTRUCT
typedef struct SupportConcurList | SUPPORTCONCURINFO
typedef struct SupportOptList | SUPPORTOPTINFO

Functions

BOOL PASCAL | CmpODBCtoCHAR (DSTRUCT *rgTestValue, TCHAR *szTrueValue, SWORD fSqlType, SWORD iResSetCol)
void *PASCAL | CvtCHARtoODBC (void *odbcValue, TCHAR *buf, SWORD fSqlType)
void PASCAL | qtDisplayError (LPTSTR szFunction, LPTSTR buf, LPTSTR szFile, int iLine)
LPTSTR PASCAL | qtMakeData (int row, int col, FIELDINFO *rgField, LPTSTR buf)
int PASCAL | ReturnCheck (RETCODE retExpected, RETCODE retReceived, LPTSTR szFunction, LPTSTR szFile, int iLine, BOOL fDiag)

Variables

UWORD cNumResSetCols

Define Documentation

#define ABORT -1

Definition at line 39 of file quiktest.h.

#define BIND_PARM_OFFSET 0

Definition at line 74 of file quiktest.h.

#define BIND_SIZE 12

Definition at line 66 of file quiktest.h.

#define COLNAME_START 1

Definition at line 78 of file quiktest.h.

#define COMBINED_SIZE MAX_ERROR_SIZE + 30

Definition at line 50 of file quiktest.h.

#define DESC_AD DESC_APD|DESC_ARD

Definition at line 61 of file quiktest.h.

#define DESC_ALL DESC_APD|DESC_IPD|DESC_ARD|DESC_IRD

Definition at line 63 of file quiktest.h.

#define DESC_APD 1

Definition at line 54 of file quiktest.h.

#define DESC_ARD 4

Definition at line 56 of file quiktest.h.

#define DESC_ID DESC_IPD|DESC_IRD

Definition at line 60 of file quiktest.h.

#define DESC_IPD 2

Definition at line 55 of file quiktest.h.

#define DESC_IRD 8

Definition at line 57 of file quiktest.h.

#define DESC_MOST DESC_AD|DESC_IPD

Definition at line 62 of file quiktest.h.

#define DESC_NONE 0

Definition at line 53 of file quiktest.h.

#define DESC_PD DESC_APD|DESC_IPD

Definition at line 58 of file quiktest.h.

#define DESC_RD DESC_ARD|DESC_IRD

Definition at line 59 of file quiktest.h.

#define DESC_UPDATE_MODE_READ 0

Definition at line 82 of file quiktest.h.

#define DESC_UPDATE_MODE_WRITE 1

Definition at line 83 of file quiktest.h.

#define DIAGRETCHECK | ( | exp,
 |  | rec,
 |  | buf |
 | ) |  | ReturnCheck(exp, rec, buf, TEXT(__FILE__), __LINE__,TRUE)

Definition at line 105 of file quiktest.h.

#define DISPLAYERROR | ( | func,
 |  | string |
 | ) |  | qtDisplayError(func, string, TEXT(__FILE__), __LINE__)

Definition at line 107 of file quiktest.h.

#define ERRSHANDLE | ( | type,
 |  | handle,
 |  | exp,
 |  | rec,
 |  | buf |
 | ) |  | ErrsHandle(type, handle, exp, rec, buf, TEXT(__FILE__), __LINE__,FALSE)

Definition at line 103 of file quiktest.h.

#define IGNORED 999

Definition at line 35 of file quiktest.h.

#define INSERT_FAIL -1

Definition at line 88 of file quiktest.h.

#define LARGEBUFF 300

Definition at line 47 of file quiktest.h.

#define MAX_BIND_ARRAY_ELEMENT MAX_QUERY_SIZE / MAX_BIND_ELEMENTS

Definition at line 17 of file quiktest.h.

#define MAX_BIND_ELEMENTS 100

Definition at line 16 of file quiktest.h.

#define MAX_COLUMN_LIST_SIZE 200

Definition at line 21 of file quiktest.h.

#define MAX_COLUMN_NAME_SIZE 100

Definition at line 22 of file quiktest.h.

#define MAX_DATA_SIZE 45

Definition at line 20 of file quiktest.h.

#define MAX_DESC_BUF 200

Definition at line 81 of file quiktest.h.

#define MAX_ERROR_SIZE 200

Definition at line 31 of file quiktest.h.

#define MAX_FIELD 40

Definition at line 26 of file quiktest.h.

#define MAX_INSERT_VALUES_SIZE 200

Definition at line 23 of file quiktest.h.

#define MAX_NUM_BUFFER 60

Definition at line 30 of file quiktest.h.

#define MAX_PARAM_SIZE 129

Definition at line 19 of file quiktest.h.

#define MAX_PREFIX 129

Definition at line 27 of file quiktest.h.

#define MAX_QUERY_SIZE 2048

Definition at line 15 of file quiktest.h.

#define MAX_ROW_ITEM_LIMIT 4

Definition at line 32 of file quiktest.h.

#define MAX_STRING_SIZE 700

Definition at line 18 of file quiktest.h.

#define MAX_SUFFIX 129

Definition at line 28 of file quiktest.h.

#define MAX_TABLE_NAME 60

Definition at line 29 of file quiktest.h.

#define MAX_TYPE_NAME 129

Definition at line 25 of file quiktest.h.

#define MAX_TYPES_SUPPORTED 25

Definition at line 24 of file quiktest.h.

#define MAXSDWORD ((SDWORD)(MAXUDWORD / 2))

Definition at line 43 of file quiktest.h.

#define MAXUDWORD ((UDWORD)(-1))

Definition at line 41 of file quiktest.h.

#define MEDBUFF 200

Definition at line 46 of file quiktest.h.

#define MINSDWORD (-(SDWORD)((MAXUDWORD / 2) + 1))

Definition at line 42 of file quiktest.h.

#define NUM_QUIKREBIND_ROWSETS 6

Definition at line 70 of file quiktest.h.

#define NUM_THREAD 5

Definition at line 69 of file quiktest.h.

#define PREFIX_SIZE 3

Definition at line 34 of file quiktest.h.

#define RC_NOTSUCCESSFUL ( rc ) (!(RC_SUCCESSFUL(rc)))

Definition at line 99 of file quiktest.h.

#define RC_SUCCESSFUL ( rc )
Value:
((rc) == SQL_SUCCESS || \
    (rc) == SQL_SUCCESS_WITH_INFO)

Definition at line 96 of file quiktest.h.

#define REC_COUNT_UNK -1

Definition at line 84 of file quiktest.h.

#define RETCHECK | ( | exp,
 |  | rec,
 |  | buf |
 | ) |  | ReturnCheck(exp, rec, buf, TEXT(__FILE__), __LINE__,FALSE)

Definition at line 101 of file quiktest.h.

#define SCALEDIFF 4

Definition at line 38 of file quiktest.h.

#define SMALLBUFF 100

Definition at line 45 of file quiktest.h.

#define STATE_SIZE 6

Definition at line 49 of file quiktest.h.

#define STATUS_ARRAY_SIZE 5

Definition at line 65 of file quiktest.h.

#define TEST_CONNECT_OPTION 15

Definition at line 36 of file quiktest.h.

#define TEST_STMT_OPTION 300

Definition at line 37 of file quiktest.h.

#define TYPE_PORTION 4

Definition at line 40 of file quiktest.h.

#define UNTOUCHED 0xCA

Definition at line 90 of file quiktest.h.

#define XLARGEBUFF 1024

Definition at line 48 of file quiktest.h.

Typedef Documentation

typedef struct tagDataStruct DSTRUCT
typedef struct FieldInfo FIELDINFO
typedef struct tagQtStruct QTSTRUCT
typedef struct SupportConcurList SUPPORTCONCURINFO
typedef struct SupportOptList SUPPORTOPTINFO

Function Documentation

BOOL PASCAL CmpODBCtoCHAR | ( | DSTRUCT * | rgTestValue,
 |  | TCHAR * | szTrueValue,
 |  | SWORD | fSqlType,
 |  | SWORD | iResSetCol
 | ) |  |

Definition at line 286 of file quiktest.h.

{
  BOOL fTestPass=TRUE;
  SWORD test1,test2;
  TCHAR *pStop=NULL;

  switch (fSqlType) {
    case SQL_BIGINT:
    case SQL_INTEGER:
      if(_ttoi(szTrueValue) == (int)rgTestValue[iCol].sdword)
        return TRUE;
      return FALSE;

    case SQL_DECIMAL:
    case SQL_NUMERIC:
        return  (_tcstod(szTrueValue,&pStop) ==
          _tcstod(rgTestValue[iCol].data,&pStop));
    case SQL_TINYINT:
    case SQL_SMALLINT:
      if(_ttoi(szTrueValue) == (int)rgTestValue[iCol].sword)
        return TRUE;
      return FALSE;

    case SQL_FLOAT:
    case SQL_DOUBLE:
        return  (_tcstod(szTrueValue,&pStop) == rgTestValue[iCol].sdouble);

    case SQL_REAL:
        /* Need to account for round-off errors in _tcstod conversions: */
        test1 = (SWORD)(1000*_tcstod(szTrueValue,&pStop));
        test1 = (SWORD)((test1>0) ? (test1+5)/10 : (test1-5)/10);
        test2 = (SWORD)(1000*rgTestValue[iCol].sfloat);
        test2 = (SWORD)((test2>0) ? (test2+5)/10 : (test2-5)/10);
        return  (test1 == test2);

    case SQL_TIMESTAMP:
    case SQL_TYPE_TIMESTAMP:
    {
      TIMESTAMP_STRUCT tss;
      CvtCHARtoODBC(&tss, szTrueValue, SQL_TYPE_TIMESTAMP);

      fTestPass= ((rgTestValue[iCol].timestamp.month == tss.month)
        && (rgTestValue[iCol].timestamp.day == tss.day)
        && (rgTestValue[iCol].timestamp.year == tss.year)
        && (rgTestValue[iCol].timestamp.hour == tss.hour)
        && (rgTestValue[iCol].timestamp.minute == tss.minute)
        && (rgTestValue[iCol].timestamp.fraction ==
          tss.fraction));
      /* Seconds value is zero for small timestamp, so to keep it from always failing... */
      if(0 != rgTestValue[iCol].timestamp.second)
        fTestPass= (fTestPass && rgTestValue[iCol].timestamp.second == tss.second);
      return fTestPass;
    }

    case SQL_TIME:
    case SQL_TYPE_TIME:
    {
      TIME_STRUCT tss;

      CvtCHARtoODBC(&tss, szTrueValue, SQL_TYPE_TIME);
      fTestPass=  ((rgTestValue[iCol].time.hour == tss.hour)
        && (rgTestValue[iCol].time.minute == tss.minute));
      /* Seconds value is zero for small timestamp, so to keep it from always failing... */
      if(0 != rgTestValue[iCol].time.second)
        fTestPass= (fTestPass && rgTestValue[iCol].time.second == tss.second);
      return fTestPass;
    }

    case SQL_DATE:
    case SQL_TYPE_DATE:
    {
      DATE_STRUCT tss;
      CvtCHARtoODBC(&tss, szTrueValue, SQL_TYPE_DATE);

      return ((rgTestValue[iCol].date.month == tss.month)
        && (rgTestValue[iCol].date.day == tss.day)
        && (rgTestValue[iCol].date.year == tss.year));
    }

    case SQL_BIT:
    case SQL_CHAR:
    case SQL_VARCHAR:
    case SQL_LONGVARCHAR:
    case SQL_BINARY:
    case SQL_VARBINARY:
    case SQL_LONGVARBINARY:
    default:
      return !(_tcsncmp(szTrueValue, rgTestValue[iCol].data,
        _tcslen(szTrueValue)));

  }
}

void* PASCAL CvtCHARtoODBC | ( | void * | odbcValue,
 |  | TCHAR * | buf,
 |  | SWORD | fSqlType
 | ) |  |

Definition at line 218 of file quiktest.h.

{
  if(!buf)
    return NULL;

  switch (fSqlType) {
    case SQL_DATE:
    case SQL_TYPE_DATE:
    {
      TCHAR szDATEDELIM[] = TEXT("d{}'- ");
      TCHAR szTempBuff[30];
      LPTSTR   tmpstr=szTempBuff;
      _tcscpy((LPTSTR) szTempBuff, buf);

      ((DATE_STRUCT *)odbcValue)->year = _ttoi(_tcstok(tmpstr, szDATEDELIM));
      ((DATE_STRUCT *)odbcValue)->month = _ttoi(_tcstok(NULL, szDATEDELIM));
      ((DATE_STRUCT *)odbcValue)->day = _ttoi(_tcstok(NULL, szDATEDELIM));
      break;
    }

    case SQL_TIME:
    case SQL_TYPE_TIME:
    {
      TCHAR szTIMEDELIM[] = TEXT("t{}': ");
      TCHAR szTempBuff[30];
      LPTSTR   tmpstr=szTempBuff;
      _tcscpy((LPTSTR) szTempBuff, buf);

      ((TIME_STRUCT *)odbcValue)->hour = _ttoi(_tcstok(tmpstr, szTIMEDELIM));
      ((TIME_STRUCT *)odbcValue)->minute = _ttoi(_tcstok(NULL, szTIMEDELIM));
      ((TIME_STRUCT *)odbcValue)->second = _ttoi(_tcstok(NULL, szTIMEDELIM));

      break;
    }

    case SQL_TIMESTAMP:
    case SQL_TYPE_TIMESTAMP:
    {
      TCHAR szDATETIMEDELIM[] = TEXT("ts'{}-:. ");
      TCHAR szTempBuff[30];
      LPTSTR   tmpstr=szTempBuff;
      LPTSTR  endstr, frstr;
      _tcscpy((LPTSTR) szTempBuff, buf);

      /* First the date */
      ((TIMESTAMP_STRUCT *)odbcValue)->year = _ttoi(_tcstok(tmpstr, szDATETIMEDELIM));
      ((TIMESTAMP_STRUCT *)odbcValue)->month = _ttoi(_tcstok(NULL, szDATETIMEDELIM));
      ((TIMESTAMP_STRUCT *)odbcValue)->day = _ttoi(_tcstok(NULL, szDATETIMEDELIM));
      /* Then the complete time */
      ((TIMESTAMP_STRUCT *)odbcValue)->hour = _ttoi(_tcstok(NULL, szDATETIMEDELIM));
      ((TIMESTAMP_STRUCT *)odbcValue)->minute = _ttoi(_tcstok(NULL, szDATETIMEDELIM));
      ((TIMESTAMP_STRUCT *)odbcValue)->second = _ttoi(_tcstok(NULL, szDATETIMEDELIM));
      if(frstr = _tcstok(NULL, szDATETIMEDELIM))
        ((TIMESTAMP_STRUCT *)odbcValue)->fraction = (_tcstoul(frstr, &endstr, 10) * 1000000);
      else
        ((TIMESTAMP_STRUCT *)odbcValue)->fraction = 0;

      break;
    }

  }
  return odbcValue;
}

void PASCAL qtDisplayError | ( | LPTSTR | szFunction,
 |  | LPTSTR | buf,
 |  | LPTSTR | szFile,
 |  | int | iLine
 | ) |  |

Definition at line 6956 of file quiktest.c.

{
  TCHAR szTmp[MAX_STRING_SIZE];

  szWrite(TEXT(""), TRUE);
  szWrite(TEXT("\t\t\t"), FALSE);
  szWrite(szFunction, FALSE);
  szWrite(TEXT("  FAILED"), TRUE);
  szWrite(TEXT("\t\t\t"), FALSE);
  szWrite(buf, TRUE);

  wsprintf(szTmp,TEXT("\t\t\t%s: %d"), szFile, iLine);
  szWrite(szTmp, TRUE);

  szWrite(TEXT("\t\t\t  --------  "), TRUE);

  lpSI->failed++;

  return;
}

LPTSTR PASCAL qtMakeData | ( | int | row,
 |  | int | col,
 |  | FIELDINFO * | rgField,
 |  | LPTSTR | buf
 | ) |  |

Definition at line 6982 of file quiktest.c.

{
  int i;
  TCHAR szColNum[10];
  TCHAR tmpbuf[256];

  if(rgField->fAutoUpdate)
    return NULL;

  if(rgField->nullable && (row==col))
    {
    _tcscpy(buf,TEXT(""));
    return buf;
    }

  switch(rgField->wSQLType) {
    case SQL_CHAR:
    case SQL_WCHAR:
    case SQL_VARCHAR:
    case SQL_WVARCHAR:
    case SQL_LONGVARCHAR:
    case SQL_WLONGVARCHAR:
    case SQL_BINARY:
    case SQL_VARBINARY:
    case SQL_LONGVARBINARY:
      if(rgField->precision < (4*sizeof(TCHAR)) )
        wsprintf(buf,TEXT("%d"), 1);
      else
        wsprintf(buf,TEXT("%d%d"), row, row);
      break;
    case SQL_DECIMAL:
    case SQL_NUMERIC:
    case SQL_REAL:
    case SQL_FLOAT:
    case SQL_DOUBLE:
      if(row == 2 && !rgField->fUnsigned) /* make the second row negative for variety */
        wsprintf(buf,TEXT("-%d.%d"), row, row);
      else
        wsprintf(buf,TEXT("%d.%d"), row, row);
      break;

    case SQL_BIT:
      if(row > 2)
        wsprintf(buf,TEXT("%d"), 1);
      else
        wsprintf(buf,TEXT("%d"), 0);

      break;

    case SQL_SMALLINT:
    case SQL_INTEGER:
    case SQL_TINYINT:
    case SQL_BIGINT:
      if(row == 2 && !rgField->fUnsigned) /* make the second row negative for variety */
        wsprintf(buf,TEXT("-%d"), row);
      else
        wsprintf(buf,TEXT("%d"), row);
      break;

    case SQL_TIME:
    case SQL_TYPE_TIME:
      wsprintf(buf,TEXT("{t '01:%02d:%02d'}"), row % 60, row % 60);
      break;
    case SQL_DATE:
    case SQL_TYPE_DATE:
      wsprintf(buf,TEXT("{d '1994-%02d-%02d'}"), (row % 12) + 1, (row % 30) + 1);
      break;
    case SQL_TIMESTAMP:
    case SQL_TYPE_TIMESTAMP:
      // precision <= 16 means the timestamp column doesn't have enough precision to hold seconds
      if ( rgField->precision > 16 )
        wsprintf(buf,TEXT("{ts '1994-%02d-%02d 01:%02d:%02d'}"), (row % 12) + 1, (row % 30) + 1, row % 60, row % 60);
      else
        wsprintf(buf,TEXT("{ts '1994-%02d-%02d 01:%02d:%02d'}"), (row % 12) + 1, (row % 30) + 1, row % 60, 0);
      break;

    case SQL_GUID:
      _itot(row, szColNum, 10);
      _tcscpy(tmpbuf, szColNum);
      for (i=0; i<11; i++){
        _tcscat(tmpbuf, szColNum);
      }
      wsprintf(buf, TEXT("%.8s-%.4s-%.4s-%.4s-%.12s"), tmpbuf, tmpbuf, tmpbuf, tmpbuf, tmpbuf);
      break;

  }
  return buf;
}

int PASCAL ReturnCheck | ( | RETCODE | retExpected,
 |  | RETCODE | retReceived,
 |  | LPTSTR | szFunction,
 |  | LPTSTR | szFile,
 |  | int | iLine,
 |  | BOOL | fDiag
 | ) |  |

Definition at line 552 of file quiktest.c.

{
  TCHAR buf[MAX_STRING_SIZE];

  if(retExpected == retReceived)
    return TRUE;

  szWrite(TEXT(""), TRUE);

  szWrite(TEXT("\t\t\t"), FALSE);
  szWrite(szFunction, TRUE);

  szWrite(TEXT("\t\t\tExpected: "), FALSE);
  szWrite(RetcodeToTCHAR(retExpected, buf), TRUE);

  szWrite(TEXT("\t\t\tReceived: "), FALSE);
  szWrite(RetcodeToTCHAR(retReceived, buf), TRUE);

  if (!fDiag)
    DisplayAllErrors();

  wsprintf(buf,TEXT("\t\t\t%s: %d"), szFile, iLine);
  szWrite(buf, TRUE);

  szWrite(TEXT("\t\t\t --------  "), TRUE);

  lpSI->failed++;

  return FALSE;
}

Variable Documentation

UWORD cNumResSetCols

Definition at line 114 of file quiktest.h.

HDBC hdbc

Definition at line 203 of file quiktest.h.

SQLHDESC hdesc

Definition at line 205 of file quiktest.h.

HENV henv

Definition at line 202 of file quiktest.h.

HSTMT hstmt

Definition at line 204 of file quiktest.h.

BYTE rgb[max(max(max(sizeof(HENV), sizeof(HDBC)),max(sizeof(HSTMT), sizeof(SQLHDESC))), sizeof(UDWORD))]

Definition at line 197 of file quiktest.h.

SDWORD sdw

Definition at line 200 of file quiktest.h.

SWORD sw

Definition at line 198 of file quiktest.h.

UDWORD udw

Definition at line 201 of file quiktest.h.

UWORD uw

Definition at line 199 of file quiktest.h.

Generated on Wed Nov 13 2024 16:53:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/internetpublishing/ippsample/Guids.Cpp File Reference

  • Dataaccess
  • oledb
  • internetpublishing
  • ippsample
Defines

Guids.Cpp File Reference

#include "stdafx.h"
#include <oledb.h>
#include <initguid.h>
#include <msdaipp.h>

Go to the source code of this file.

Defines

#define | DBINITCONSTANTS
#define | INITGUID
#define | OLEDBVER 0x0250

Define Documentation

#define DBINITCONSTANTS

Definition at line 23 of file Guids.Cpp.

#define INITGUID

Definition at line 26 of file Guids.Cpp.

#define OLEDBVER 0x0250

Definition at line 19 of file Guids.Cpp.

Generated on Wed Nov 13 2024 16:53:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/internetpublishing/ippsample/IAuth.Cpp File Reference

  • Dataaccess
  • oledb
  • internetpublishing
  • ippsample

IAuth.Cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/internetpublishing/ippsample/Sample1.Cpp File Reference

  • Dataaccess
  • oledb
  • internetpublishing
  • ippsample
Functions

Sample1.Cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Functions

HRESULT | Bind (LPWSTR pwchUrl, REFGUID rguid, REFIID riid, DWORD dwFlags, IUnknown **ppUnk, LPWSTR pwchUserName, LPWSTR pwchPassword, BOOL fCreate)
HRESULT | Download (int argc, wchar_t *argv[])
LPWSTR | DuplicateWSTR (LPWSTR wsz)
HRESULT | Enum (int argc, wchar_t *argv[])
HRESULT | EnumerateParent (LPWSTR pwchUrl, LPWSTR pwchUserName, LPWSTR pwchPassword)
HRESULT | EnumerateWithRowsetPointer (IRowset *pRowset, BOOL fVerbose)
HRESULT | GetParentUrl (LPWSTR pwchUrl, LPWSTR *ppwchParent)
HRESULT | ISO (ISO_OPS op, int argc, wchar_t *argv[])
void | PrintUsage ()
HRESULT | Search (int argc, wchar_t *argv[])
HRESULT | Upload (int argc, wchar_t *argv[])
int __cdecl | wmain (int argc, wchar_t *argv[])

Function Documentation

HRESULT Bind | ( | LPWSTR | pwchUrl,
 |  | REFGUID | rguid,
 |  | REFIID | riid,
 |  | DWORD | dwFlags,
 |  | IUnknown ** | ppUnk,
 |  | LPWSTR | pwchUserName,
 |  | LPWSTR | pwchPassword,
 |  | BOOL | fCreate
 | ) |  |

Definition at line 1082 of file Sample1.Cpp.

{
   HRESULT           hr = S_OK;
   IAuthenticate     *pAuth = NULL;
   IBindResource     *pBindResource = NULL;
   ICreateRow        *pCreateRow = NULL;
   DBBINDURLSTATUS   dwBindStatus;

   //instantiation of the IAuthenticate callback
   if((NULL != pwchUserName) && (NULL != pwchPassword))
   {
      pAuth = new CImpAuth;
      if(NULL == pAuth)
      {
         return E_OUTOFMEMORY;
      }

      hr = ((CImpAuth *)pAuth)->Set(pwchUserName, pwchPassword);
      if(FAILED(hr))
      {
         delete pAuth;
         return hr;
      }

      pAuth->AddRef();
   }

   if(TRUE == fCreate)
   {
      //Calling CoCreateInstance to get the ICreateRow interface
      //on the binder.
      hr = CoCreateInstance(CLSID_RootBinder,
                            NULL,
                            CLSCTX_ALL,
                            IID_ICreateRow,
                            (void **)&pCreateRow);
      if(FAILED(hr))
      {
         if(NULL != pAuth)
         {
            pAuth->Release();
         }
         return hr;
      }

      //Creating!
      hr = pCreateRow->CreateRow(NULL,
                                pwchUrl,
                                dwFlags,
                                rguid,
                                riid,
                                pAuth,
                                NULL,
                                &dwBindStatus,
                                 NULL,
                                ppUnk);

      pCreateRow->Release();
   }
   else
   {
      //Calling CoCreateInstance to get the IBindResource interface
      //on the binder.
      hr = CoCreateInstance(CLSID_RootBinder,
                            NULL,
                            CLSCTX_ALL,
                            IID_IBindResource,
                            (void **)&pBindResource);
      if(FAILED(hr))
      {
         if(NULL != pAuth)
         {
            pAuth->Release();
         }
         return hr;
      }

      //Binding!
      hr = pBindResource->Bind(  NULL,
                                pwchUrl,
                                dwFlags,
                                rguid,
                                riid,
                                pAuth,
                                NULL,
                                &dwBindStatus,
                                ppUnk);

      pBindResource->Release();
   }

   if(NULL != pAuth)
   {
      pAuth->Release();
   }

   return hr;
}

HRESULT Download | ( | int | argc,
 |  | wchar_t * | argv[]
 | ) |  |

Definition at line 112 of file Sample1.Cpp.

{
   HRESULT     hr = S_OK;
   IStream     *pStream = NULL;
   LPWSTR      pwchUrl = NULL;
   LPWSTR      pwchLocalFile = NULL;
   LPWSTR      pwchUserName = NULL;
   LPWSTR      pwchPassword = NULL;
   HANDLE      hFile=INVALID_HANDLE_VALUE;
   BYTE        rgbBuf[1024]; //a 1-k buffer for reading
   ULONG       cbRead, cbWritten;
   int         i;

   //Parameter checking:
   if( (1 > argc) || (4 < argc) )
   {
      return E_INVALIDARG;
   }

   for(i = 0; i < argc; i++)
   {
      if(0 == _wcsnicmp(argv[i], L"u=", 2))
      {
         pwchUrl = argv[i] + 2;
      }
      else if(0 == _wcsnicmp(argv[i], L"l=", 2))
      {
         pwchLocalFile = argv[i] + 2;
      }
      else if(0 == _wcsnicmp(argv[i], L"n=", 2))
      {
         pwchUserName = argv[i] + 2;
      }
      else if(0 == _wcsnicmp(argv[i], L"p=", 2))
      {
         pwchPassword = argv[i] + 2;
      }
      else
      {
         return E_INVALIDARG;
      }
   }

   //URL is not optional:
   if( NULL == pwchUrl )
   {
      return E_INVALIDARG;
   }

   //You may not set one and not the other:
   if(  ( (NULL == pwchUserName) && (NULL != pwchPassword) )
      ||( (NULL != pwchUserName) && (NULL == pwchPassword) ) )
   {
      pwchUserName = NULL;
      pwchPassword = NULL;
   }

   //open the local file to be written to:
   if(NULL != pwchLocalFile)
   {
      hFile = CreateFileW(pwchLocalFile,
                          GENERIC_WRITE,
                          FILE_SHARE_READ,
                          NULL,
                          CREATE_ALWAYS,
                          FILE_ATTRIBUTE_NORMAL,
                          NULL);

      if(INVALID_HANDLE_VALUE == hFile)
      {
         return HRESULT_FROM_WIN32(GetLastError());
      }
   }

   //Bind to a stream:
   hr = Bind(pwchUrl,
             DBGUID_STREAM,
             IID_IStream,
             DBBINDURLFLAG_READ | DBBINDURLFLAG_SHARE_DENY_WRITE,
             (IUnknown **)&pStream,
             pwchUserName,
             pwchPassword,
             FALSE);
   if(FAILED(hr))
   {
      goto cleanup;
      return hr;
   }

   //loop through the reading of the file using IStream::Read, and
   //then write to the local file if need to.
   while(TRUE)
   {
      hr = pStream->Read((void *)rgbBuf,
                          1024,
                          &cbRead);

      if(0 == cbRead)
      {
         break;
      }

      if(INVALID_HANDLE_VALUE != hFile)
      {
         if(FALSE == WriteFile(hFile, rgbBuf, cbRead, &cbWritten, NULL))
         {
            hr = HRESULT_FROM_WIN32(GetLastError());
            goto cleanup;
         }
      }
   }

cleanup:

   //cleaning up by releasing pStream
   if(NULL != pStream)
   {
      pStream->Release();
      pStream = NULL;
   }

   if(INVALID_HANDLE_VALUE != hFile)
   {
      CloseHandle(hFile);
      hFile = INVALID_HANDLE_VALUE;
   }

   return hr;
}

LPWSTR DuplicateWSTR ( LPWSTR wsz )

Definition at line 1592 of file Sample1.Cpp.

{
   INT_PTR     cwch = wcslen(wsz) + 1;
   LPWSTR   pwchNew = new WCHAR[cwch];

   if(NULL == wsz)
   {
      return NULL;
   }

   wcsncpy(pwchNew, wsz, cwch);

   return pwchNew;
}

HRESULT Enum | ( | int | argc,
 |  | wchar_t * | argv[]
 | ) |  |

Definition at line 425 of file Sample1.Cpp.

{
   HRESULT           hr = S_OK;

   IRowset           *pRowset = NULL;

   LPWSTR            pwchUrl = NULL;
   LPWSTR            pwchUserName = NULL;
   LPWSTR            pwchPassword = NULL;
   BOOL              fVerbose = FALSE;
   int               i;

   //parameter checking:
   if( (1 > argc) || (4 < argc) )
   {
      return E_INVALIDARG;
   }

   for(i = 0; i < argc; i++)
   {
      if(0 == _wcsnicmp(argv[i], L"v=", 2))
      {
         if(0 == _wcsicmp(argv[i] + 2, L"yes"))
         {
            fVerbose = TRUE;
         }
         else if (0 == _wcsicmp(argv[i] + 2, L"no"))
         {
            fVerbose = FALSE;
         }
         else
         {
            return E_INVALIDARG;
         }
      }
      else if(0 == _wcsnicmp(argv[i], L"u=", 2))
      {
         pwchUrl = argv[i] + 2;
      }
      else if(0 == _wcsnicmp(argv[i], L"n=", 2))
      {
         pwchUserName = argv[i] + 2;
      }
      else if(0 == _wcsnicmp(argv[i], L"p=", 2))
      {
         pwchPassword = argv[i] + 2;
      }
      else
      {
         return E_INVALIDARG;
      }
   }

   //this is not optional:
   if( NULL == pwchUrl )
   {
      return E_INVALIDARG;
   }

   //You may not set one and not the other:
   if(  ( (NULL == pwchUserName) && (NULL != pwchPassword) )
      ||( (NULL != pwchUserName) && (NULL == pwchPassword) ) )
   {
      pwchUserName = NULL;
      pwchPassword = NULL;
   }

   //Bind the resource to the IRowset interface
   hr = Bind(pwchUrl,
             DBGUID_ROWSET,
             IID_IRowset,
             DBBINDURLFLAG_READ,
             (IUnknown **)&pRowset,
             pwchUserName,
             pwchPassword,
             FALSE);
   if(FAILED(hr))
   {
      return hr;
   }

   //calling Enumerate:
   hr = EnumerateWithRowsetPointer(pRowset, fVerbose);

   pRowset->Release();

   return hr;
}

HRESULT EnumerateParent | ( | LPWSTR | pwchUrl,
 |  | LPWSTR | pwchUserName,
 |  | LPWSTR | pwchPassword
 | ) |  |

Definition at line 1442 of file Sample1.Cpp.

{
   HRESULT  hr = S_OK;
   LPWSTR   lpParent;
   IRowset  *pRowset;

   hr = GetParentUrl(pwchUrl, &lpParent);
   if(FAILED(hr))
   {
      return hr;
   }

   hr = Bind(pwchUrl,
             DBGUID_ROWSET,
             IID_IRowset,
             DBBINDURLFLAG_READ,
             (IUnknown **)&pRowset,
             pwchUserName,
             pwchPassword,
             FALSE);
   if(FAILED(hr))
   {
      delete [] lpParent;
      return hr;
   }

   hr = EnumerateWithRowsetPointer(pRowset, FALSE);

   delete [] lpParent;

   return hr;
}

HRESULT EnumerateWithRowsetPointer | ( | IRowset * | pRowset,
 |  | BOOL | fVerbose
 | ) |  |

Definition at line 1207 of file Sample1.Cpp.

{
   HRESULT           hr = S_OK;
   DWORD             i;

   IColumnsInfo      *pColumnsInfo = NULL;
   DWORD_PTR          cColumn;
   DBCOLUMNINFO      *pInfo = NULL;
   OLECHAR           *pStringsBuf = NULL;

   IAccessor         *pAccessor = NULL;
   DBBINDING         *pBindings = NULL;
   HACCESSOR         hAccessor = NULL;
   DBBINDSTATUS      *pBindStatus = NULL;

   BYTE              *pData = NULL;
   DWORD_PTR          cRowsObtained;
   HROW              *pRow = NULL;
   DWORD             cRow;
   ULONG             *pStatus = NULL;
   ULONG             *pLength = NULL;

   if(NULL == pRowset)
   {
      return E_INVALIDARG;
   }

   //since there are a number of places where things may fail and need to
   //be cleaned up, we wrap the code in a while(FALSE) loop for easy
   //clean up.

   do{
      //finding out all the columns supported by the rowset.  This is
      //accomplished through the IColumnsInfo interface
      hr = pRowset->QueryInterface(IID_IColumnsInfo, (void **)&pColumnsInfo);
      if(FAILED(hr))
      {
         break;
      }

      hr = pColumnsInfo->GetColumnInfo(&cColumn, &pInfo, &pStringsBuf);
      if(FAILED(hr))
      {
         break;
      }

      if(0 == cColumn)
      {
         if(fVerbose)
         {
            printf("There are no columns for our rowset\n");
         }
         hr = S_OK;
         break;
      }

      //next we need to create an accessor.
      hr = pRowset->QueryInterface(IID_IAccessor, (void **)&pAccessor);
      if(FAILED(hr))
      {
         break;
      }

      pBindings = new DBBINDING [cColumn];
      if(NULL == pBindings)
      {
         hr = E_OUTOFMEMORY;
         break;
      }
      memset(pBindings, 0, cColumn * sizeof(DBBINDING));

      pBindStatus = new DBBINDSTATUS [cColumn];
      if(NULL == pBindStatus)
      {
         hr = E_OUTOFMEMORY;
         break;
      }
      memset(pBindStatus, 0, cColumn * sizeof(DBBINDSTATUS));

      //We have to transfer the information in the DBCOLUMNINFO
      //to our new DBBINDING.  However, we're asking for all the
      //columns in WSTR to display them if neccessary.  Almost all
      //types can be converted to DBTYPE_WSTR
      for(i = 0; i < cColumn; i++)
      {
         //we are going to ask for all the columns as DBTYPE_WSTR.
         pBindings[i].iOrdinal   = pInfo[i].iOrdinal;
         pBindings[i].obValue    = i * MAX_PATH;
         pBindings[i].obLength   = (cColumn * MAX_PATH) + (i * sizeof(ULONG));
         pBindings[i].obStatus   = (cColumn * (MAX_PATH + sizeof(ULONG)))
                                    + (i * sizeof(ULONG));
         pBindings[i].pTypeInfo  = pInfo[i].pTypeInfo;
         pBindings[i].pObject    = NULL;
         pBindings[i].pBindExt   = NULL;
         pBindings[i].dwPart     = DBPART_VALUE | DBPART_LENGTH | DBPART_STATUS;
         pBindings[i].dwMemOwner = DBMEMOWNER_CLIENTOWNED;
         pBindings[i].eParamIO   = 0;
         pBindings[i].cbMaxLen   = MAX_PATH;
         pBindings[i].dwFlags    = 0;
         pBindings[i].wType      = DBTYPE_WSTR;
         pBindings[i].bPrecision = pInfo[i].bPrecision;
         pBindings[i].bScale     = pInfo[i].bScale;
      }

      hr = pAccessor->CreateAccessor(DBACCESSOR_ROWDATA,
                                     cColumn,
                                     pBindings,
                                     0,
                                     &hAccessor,
                                     pBindStatus);

      if(FAILED(hr))
      {
         break;
      }

      //We need to pass a buffer into the GetData call.  here
      //we allocate it.
      pData = new BYTE [cColumn * (MAX_PATH + (2 * sizeof(ULONG)))];
      if(NULL == pData)
      {
         hr = E_OUTOFMEMORY;
         break;
      }
      pStatus = (ULONG *)( pData + (cColumn * MAX_PATH) );
      pLength = (ULONG *)( pData + (cColumn * (MAX_PATH + sizeof(ULONG))) );

      //getting the rows row by row and print them to stdout if neccessary.
      cRow=0;
      while(TRUE)
      {
         hr = pRowset->GetNextRows(NULL, 0, 1, &cRowsObtained, &pRow);
         if(FAILED(hr) || (DB_S_ENDOFROWSET == hr))
         {
            break;
         }

         hr = pRowset->GetData(pRow[0], hAccessor, (void *)pData);
         pRowset->ReleaseRows(1, pRow, NULL, NULL, NULL);

         if(FAILED(hr))
         {
            break;
         }

         if(fVerbose)
         {
            printf("Columns for Row %i:\n", cRow);

            for(i = 0; i < cColumn; i++)
            {
               LPWSTR   lpColData;

               lpColData = (LPWSTR) (pData + (i * MAX_PATH));

               //making sure the data is terminated.
               //The data we get back has the right length, but they may not be
               //null-terminated.
               if(DBSTATUS_S_OK == pStatus[i])
               {
                  lpColData[ pLength[i] / sizeof(WCHAR) ] = L'\0';
               }
               else if(DBSTATUS_S_TRUNCATED == pStatus[i])
               {
                  lpColData[ (MAX_PATH / sizeof(WCHAR)) - 1 ] = L'\0';
               }

               printf("  Column %i: %ls\n", i, lpColData);
            }
         }

         cRow++;
      }

   }while(FALSE);

   //cleanup:
   if (NULL != pColumnsInfo)
   {
      pColumnsInfo->Release();
   }

   if (NULL != pInfo)
   {
      CoTaskMemFree(pInfo);
   }

   if (NULL != pStringsBuf)
   {
      CoTaskMemFree(pStringsBuf);
   }

   if (NULL != pAccessor)
   {
      if (NULL != hAccessor)
      {
         pAccessor->ReleaseAccessor(hAccessor, NULL);
      }
      pAccessor->Release();
   }

   if (NULL != pBindings)
   {
      delete [] pBindings;
   }

   if (NULL != pBindStatus)
   {
      delete [] pBindStatus;
   }

   if (NULL != pData)
   {
      delete [] pData;
   }

   return hr;
}

HRESULT GetParentUrl | ( | LPWSTR | pwchUrl,
 |  | LPWSTR * | ppwchParent
 | ) |  |

Definition at line 1488 of file Sample1.Cpp.

{
   HRESULT     hr = S_OK;
   LPWSTR      lpParent = NULL;
   PWCHAR      pwchLast;
   DWORD_PTR   cwchUrl = wcslen(pwchUrl);

   if(NULL == ppwchParent)
   {
      return E_INVALIDARG;
   }
   *ppwchParent = NULL;

   lpParent = new WCHAR [cwchUrl + 1];
   if (NULL == lpParent)
   {
      return E_OUTOFMEMORY;
   }
   wcsncpy(lpParent, pwchUrl, cwchUrl + 1);

   pwchLast = wcsrchr(lpParent, L'/');
   if(NULL == pwchLast)
   {
      delete [] lpParent;
      return E_INVALIDARG;
   }

   if(pwchLast == (lpParent + cwchUrl - 1))
   {
      //The last character is a NULL
      lpParent[cwchUrl-1] = L'\0';
      pwchLast = wcsrchr(lpParent, L'/');
      if(NULL == pwchLast)
      {
         delete [] lpParent;
         return E_INVALIDARG;
      }
   }

   if(L'/' == *(pwchLast - 1))
   {
      //The '/' pointed to by pchLast is the // in the URL.
      delete [] lpParent;
      return S_OK;
   }

   *pwchLast = L'\0'; //cutting the URL off at the last '/'

   *ppwchParent = lpParent;

   return hr;
}

HRESULT ISO | ( | ISO_OPS | op,
 |  | int | argc,
 |  | wchar_t * | argv[]
 | ) |  |

Definition at line 775 of file Sample1.Cpp.

{
   HRESULT              hr = S_OK;
   IScopedOperations    *pISO = NULL;
   LPWSTR               pwchUrl = NULL;
   LPWSTR               pwchUserName = NULL;
   LPWSTR               pwchPassword = NULL;

   LPWSTR               pwchUrlSrc = NULL;
   LPWSTR               pwchUserNameSrc = NULL;
   LPWSTR               pwchPasswordSrc = NULL;

   LPWSTR               pwchUrlDest = NULL;
   LPWSTR               pwchUserNameDest = NULL;
   LPWSTR               pwchPasswordDest = NULL;

   LPWSTR               pwchUrlBind = NULL;
   LPWSTR               pwchUserNameBind = NULL;
   LPWSTR               pwchPasswordBind = NULL;

   IAuthenticate        *pAuth = NULL;

   int                  i;
   DWORD                dwStatus = 0;
   BOOL                 fAlloc = FALSE;

   //parameter checking
   if((1 > argc) || (6 < argc))
   {
      return E_INVALIDARG;
   }

   for(i = 0; i < argc; i++)
   {
      if(0 == _wcsnicmp(argv[i], L"u=", 2))
      {
         pwchUrl = argv[i] + 2;
      }
      else if(0 == _wcsnicmp(argv[i], L"us=", 3))
      {
         pwchUrlSrc = argv[i] + 3;
      }
      else if(0 == _wcsnicmp(argv[i], L"ud=", 3))
      {
         pwchUrlDest = argv[i] + 3;
      }
      else if(0 == _wcsnicmp(argv[i], L"n=", 2))
      {
         pwchUserName = argv[i] + 2;
      }
      else if(0 == _wcsnicmp(argv[i], L"p=", 2))
      {
         pwchPassword = argv[i] + 2;
      }
      else if(0 == _wcsnicmp(argv[i], L"ns=", 3))
      {
         pwchUserNameSrc = argv[i] + 3;
      }
      else if(0 == _wcsnicmp(argv[i], L"ps=", 3))
      {
         pwchPasswordSrc = argv[i] + 3;
      }
      else if(0 == _wcsnicmp(argv[i], L"nd=", 3))
      {
         pwchUserNameDest = argv[i] + 3;
      }
      else if(0 == _wcsnicmp(argv[i], L"pd=", 3))
      {
         pwchPasswordDest = argv[i] + 3;
      }
      else
      {
         return E_INVALIDARG;
      }
   }

   //You may not set one and not the other:
   if(  ( (NULL == pwchUserName) && (NULL != pwchPassword) )
      ||( (NULL != pwchUserName) && (NULL == pwchPassword) ) )
   {
      pwchUserName = NULL;
      pwchPassword = NULL;
   }

   if(  ( (NULL == pwchUserNameSrc) && (NULL != pwchPasswordSrc) )
      ||( (NULL != pwchUserNameSrc) && (NULL == pwchPasswordSrc) ) )
   {
      pwchUserNameSrc = NULL;
      pwchPasswordSrc = NULL;
   }

   if(  ( (NULL == pwchUserNameDest) && (NULL != pwchPasswordDest) )
      ||( (NULL != pwchUserNameDest) && (NULL == pwchPasswordDest) ) )
   {
      pwchUserNameDest = NULL;
      pwchPasswordDest = NULL;
   }

   //if we're making a collection or deleting something, we do similar processing:
   if(ISO_MKDIR == op)
   {
      //this is not optional:
      if( NULL == pwchUrl )
      {
         return E_INVALIDARG;
      }

      //For creation of collection, merely binding is enough.
      hr = Bind(pwchUrl,
                DBGUID_ROW,
                IID_IScopedOperations,
                DBBINDURLFLAG_WRITE
                  | DBBINDURLFLAG_OVERWRITE
                  | DBBINDURLFLAG_COLLECTION,
                (IUnknown **)&pISO,
                pwchUserName,
                pwchPassword,
                TRUE);

      if(FAILED(hr))
      {
         return hr;
      }
   }
   else if(ISO_DELETE == op)
   {
      //this is not optional:
      if( NULL == pwchUrl )
      {
         return E_INVALIDARG;
      }

      hr = Bind(pwchUrl,
                DBGUID_ROW,
                IID_IScopedOperations,
                DBBINDURLFLAG_WRITE,
                (IUnknown **)&pISO,
                pwchUserName,
                pwchPassword,
                FALSE);
      if(FAILED(hr))
      {
         return hr;
      }

      hr = pISO->Delete(1,
                        (LPCWSTR *)&pwchUrl,
                        0,
                        &dwStatus);
   }
   else if((ISO_COPY == op) || (ISO_MOVE == op))
   {
      //we require both URLs
      if((NULL == pwchUrlSrc) || (NULL == pwchUrlDest))
      {
         return E_INVALIDARG;
      }

      //when we bind, we have to bind to a remote server.  If the
      //source URL is a file, we have to bind to the destination instead.
      //we cannot accept two file:// urls though.
      if(0 != _wcsnicmp(pwchUrlSrc, L"file://", 7))
      {
         pwchUrlBind = pwchUrlSrc;
         pwchUserNameBind = pwchUserNameSrc;
         pwchPasswordBind = pwchPasswordSrc;
      }
      else if (0 != _wcsnicmp(pwchUrlDest, L"file://", 7))
      {
         //we need to bind to the parent folder of the destination URL
         //in this case:
         hr = GetParentUrl(pwchUrlDest, &pwchUrlBind);
         if(FAILED(hr))
         {
            return hr;
         }
         fAlloc = TRUE;
         pwchUserNameBind = pwchUserNameDest;
         pwchPasswordBind = pwchPasswordDest;
      }
      else
      {
         return E_INVALIDARG;
      }

      //binding.  we have to make sure to pass in the right set of
      //credentials
      hr = Bind(pwchUrlBind,
                DBGUID_ROW,
                IID_IScopedOperations,
                DBBINDURLFLAG_READWRITE,
                (IUnknown **)&pISO,
                pwchUserNameBind,
                pwchPasswordBind,
                FALSE);
      if(fAlloc && (NULL != pwchUrlBind))
      {
         //cleanup while we can
         delete [] pwchUrlBind;
      }
      if(FAILED(hr))
      {
         return hr;
      }

      //the Copy/Move call takes an IAuthenticate interface pointer
      //for the destination resourecs as one of the arguments.
      //This way, we may authenticate to the source and destination
      //with different sets of credentials
      if((NULL != pwchUserNameDest) && (NULL != pwchPasswordDest))
      {
         pAuth = new CImpAuth;
         if(NULL == pAuth)
         {
            pISO->Release();

            return E_OUTOFMEMORY;
         }

         hr = ((CImpAuth *)pAuth)->Set(pwchUserNameDest, pwchPasswordDest);
         if(FAILED(hr))
         {
            delete pAuth;

            pISO->Release();

            return hr;
         }

         pAuth->AddRef();
      }

      //finally, the calls
      if(ISO_COPY == op)
      {
         hr = pISO->Copy(1,
                         (LPCWSTR *)&pwchUrlSrc,
                         (LPCWSTR *)&pwchUrlDest,
                         DBCOPY_REPLACE_EXISTING
                           | DBCOPY_ALLOW_EMULATION,
                         pAuth,
                         &dwStatus,
                         NULL,
                         NULL);
      }
      else if (ISO_MOVE == op)
      {
         hr = pISO->Move(1,
                         (LPCWSTR *)&pwchUrlSrc,
                         (LPCWSTR *)&pwchUrlDest,
                         DBMOVE_REPLACE_EXISTING
                           | DBMOVE_DONT_UPDATE_LINKS
                           | DBMOVE_ALLOW_EMULATION,
                         pAuth,
                         &dwStatus,
                         NULL,
                         NULL);
      }

      //cleaning up:
      if(NULL != pAuth)
      {
         pAuth->Release();
      }
   }
   else
   {
      return E_INVALIDARG;
   }

   //cleanup:
   if(NULL != pISO)
   {
      pISO->Release();
   }

   return hr;
}

void PrintUsage ( void )

Definition at line 1549 of file Sample1.Cpp.

{
   wprintf(L"sample1.exe\n");
   wprintf(L"Usage:\n");
   wprintf(L"   sample1 <action> [action specific parameters]\n");
   wprintf(L"      where <action> is one of the followings:\n");
   wprintf(L"                download\n");
   wprintf(L"                upload\n");
   wprintf(L"                enum\n");
   wprintf(L"                search\n");
   wprintf(L"                mkdir\n");
   wprintf(L"                copy\n");
   wprintf(L"                move\n");
   wprintf(L"                delete\n");
   wprintf(L"      action specific parameters:\n");
   wprintf(L"         download: u=url [l=local_dest] [n=username p=password]\n");
   wprintf(L"         upload:   u=url l=local_src [n=username p=password]\n");
   wprintf(L"         enum:     u=url [v=yes/no] [n=username p=password]\n");
   wprintf(L"         search:   u=url [q=\"SQL query\"] [v=yes/no] [n=username p=password]\n");
   wprintf(L"                   note that '\"' in the query should be typed as '\\\"'\n");
   wprintf(L"         mkdir:    u=url [n=username p=password]\n");
   wprintf(L"         copy:     us=src ud=dest [ns=username ps=password]\n");
   wprintf(L"                                  [nd=username pd=password]\n");
   wprintf(L"         move:     us=src ud=dest [ns=username ps=password]\n");
   wprintf(L"                                  [nd=username pd=password]\n");
   wprintf(L"         delete:   u=url [n=username p=password]\n");
}

HRESULT Search | ( | int | argc,
 |  | wchar_t * | argv[]
 | ) |  |

Definition at line 539 of file Sample1.Cpp.

{
   HRESULT           hr = S_OK;
   LPWSTR            pwchUrl = NULL;
   LPWSTR            pwchQuery = NULL;
   LPWSTR            pwchUserName = NULL;
   LPWSTR            pwchPassword = NULL;
   BOOL              fVerbose = FALSE;
   int               i;

   IDBCreateCommand  *pCreateCommand = NULL;
   ICommand          *pCommand = NULL;
   ICommandText      *pCommandText = NULL;
   IRowset           *pRowset = NULL;
   LONG_PTR          cRowsAffected = 0;

   //parameter checking:
   if( (1 > argc) || (5 < argc) )
   {
      hr = E_INVALIDARG;
      goto cleanup;
   }

   for(i = 0; i < argc; i++)
   {
      if(0 == _wcsnicmp(argv[i], L"v=", 2))
      {
         if(0 == _wcsicmp(argv[i] + 2, L"yes"))
         {
            fVerbose = TRUE;
         }
         else if (0 == _wcsicmp(argv[i] + 2, L"no"))
         {
            fVerbose = FALSE;
         }
         else
         {
            hr = E_INVALIDARG;
            goto cleanup;
         }
      }
      else if(0 == _wcsnicmp(argv[i], L"u=", 2))
      {
         pwchUrl = argv[i] + 2;
      }
      else if(0 == _wcsnicmp(argv[i], L"q=", 2))
      {
         DWORD_PTR    cwchQuery = 0;

         cwchQuery = wcslen(argv[i] + 2);

         if(NULL != pwchQuery)
         {
            //if the user has two q="xxx", we might have a leak, unless
            //we do this.

            delete [] pwchQuery;
         }

         //no need to add one since we're stripping the last "
         pwchQuery = new WCHAR[cwchQuery + 1];
         if(NULL == pwchQuery)
         {
            hr = E_OUTOFMEMORY;
            goto cleanup;
         }

         wcsncpy(pwchQuery, argv[i] + 2, cwchQuery + 1);
      }
      else if(0 == _wcsnicmp(argv[i], L"n=", 2))
      {
         pwchUserName = argv[i] + 2;
      }
      else if(0 == _wcsnicmp(argv[i], L"p=", 2))
      {
         pwchPassword = argv[i] + 2;
      }
      else
      {
         hr = E_INVALIDARG;
         goto cleanup;
      }
   }

   //this is not optional:
   if( NULL == pwchUrl )
   {
      hr = E_INVALIDARG;
      goto cleanup;
   }

   //You may not set one and not the other:
   if(  ( (NULL == pwchUserName) && (NULL != pwchPassword) )
      ||( (NULL != pwchUserName) && (NULL == pwchPassword) ) )
   {
      pwchUserName = NULL;
      pwchPassword = NULL;
   }

   //now on to the real processing.  In order to get a command object,
   // we have to bind to a session first.

   hr = Bind(pwchUrl,
             DBGUID_SESSION,
             IID_IDBCreateCommand,
             DBBINDURLFLAG_READ,
             (IUnknown **)&pCreateCommand,
             pwchUserName,
             pwchPassword,
             FALSE);
   if(FAILED(hr))
   {
      goto cleanup;
   }

   //now we should create the command:

   hr = pCreateCommand->CreateCommand(
                           NULL,
                           IID_ICommandText,
                           (IUnknown **)&pCommandText);
   pCreateCommand->Release(); //we don't need this anymore
   if(FAILED(hr))
   {
      goto cleanup;
   }

   if(NULL == pwchQuery)
   {
      //we use the default query:
      LPWSTR   wszQueryFormat = L"SELECT \"DAV:displayname\" FROM SCOPE ('SHALLOW TRAVERSAL OF \"%s\"')";
      INT_PTR      cwchQuery = wcslen(wszQueryFormat) + wcslen(pwchUrl) + 1;
      int      nRet;

      pwchQuery = new WCHAR[cwchQuery];
      if(NULL == pwchQuery)
      {
         hr = E_OUTOFMEMORY;
         goto cleanup;
      }

      nRet = swprintf(pwchQuery, wszQueryFormat, pwchUrl);
      if((0 >= nRet) || (cwchQuery <= nRet))
      {
         //the number of chars don't add up
         hr = E_FAIL;
         goto cleanup;
      }
   }

   //we have to set the command text now:
   hr = pCommandText->SetCommandText(
               DBGUID_DEFAULT,
               pwchQuery);
   if(FAILED(hr))
   {
      pCommandText->Release();
      goto cleanup;
   }

   hr = pCommandText->QueryInterface(
                        IID_ICommand,
                        (void **)&pCommand);
   pCommandText->Release();
   if(FAILED(hr))
   {
      goto cleanup;
   }

   //Finally, execute the command to get the IRowset pointer
   hr = pCommand->Execute(
                        NULL,
                        IID_IRowset,
                        NULL,
                        &cRowsAffected,
                        (IUnknown**)&pRowset);
   pCommand->Release();
   if(FAILED(hr))
   {
      goto cleanup;
   }

   hr = EnumerateWithRowsetPointer(pRowset, fVerbose);
   pRowset->Release();

cleanup:

   if(NULL != pwchQuery)
   {
      delete [] pwchQuery;
      pwchQuery = NULL;
   }

   return hr;
}

HRESULT Upload | ( | int | argc,
 |  | wchar_t * | argv[]
 | ) |  |

Definition at line 262 of file Sample1.Cpp.

{
   HRESULT     hr = S_OK;
   IStream     *pStream = NULL;
   LPWSTR      pwchUrl = NULL;
   LPWSTR      pwchLocalFile = NULL;
   LPWSTR      pwchUserName = NULL;
   LPWSTR      pwchPassword = NULL;
   HANDLE      hFile=INVALID_HANDLE_VALUE;
   BYTE        rgbBuf[1024]; //a 1-k buffer for reading
   ULONG       cbRead, cbWritten;
   int         i;

   //parameter checking:
   if( (2 > argc) || (4 < argc) )
   {
      return E_INVALIDARG;
   }

   for(i = 0; i < argc; i++)
   {
      if(0 == _wcsnicmp(argv[i], L"u=", 2))
      {
         pwchUrl = argv[i] + 2;
      }
      else if(0 == _wcsnicmp(argv[i], L"l=", 2))
      {
         pwchLocalFile = argv[i] + 2;
      }
      else if(0 == _wcsnicmp(argv[i], L"n=", 2))
      {
         pwchUserName = argv[i] + 2;
      }
      else if(0 == _wcsnicmp(argv[i], L"p=", 2))
      {
         pwchPassword = argv[i] + 2;
      }
      else
      {
         return E_INVALIDARG;
      }
   }

   //you have to have the URL:
   if(NULL == pwchUrl)
   {
      return E_INVALIDARG;
   }

   //local file source is not optional
   if(NULL == pwchLocalFile)
   {
      return E_INVALIDARG;
   }

   //You may not set one and not the other:
   if(  ( (NULL == pwchUserName) && (NULL != pwchPassword) )
      ||( (NULL != pwchUserName) && (NULL == pwchPassword) ) )
   {
      pwchUserName = NULL;
      pwchPassword = NULL;
   }

   //opening the local file to read from
   hFile = CreateFileW(pwchLocalFile,
                       GENERIC_READ,
                       FILE_SHARE_READ,
                       NULL,
                       OPEN_EXISTING,
                       FILE_ATTRIBUTE_NORMAL,
                       NULL);

   if(INVALID_HANDLE_VALUE == hFile)
   {
      return HRESULT_FROM_WIN32(GetLastError());
   }

   //Bind to a stream:
   //note the bindflags or STGM we use will make sure that we can overwrite
   //the target file if it exists
   hr = Bind(pwchUrl,
             DBGUID_STREAM,
             IID_IStream,
             DBBINDURLFLAG_WRITE
               | DBBINDURLFLAG_SHARE_DENY_WRITE
               | DBBINDURLFLAG_OVERWRITE,
             (IUnknown **)&pStream,
             pwchUserName,
             pwchPassword,
             TRUE);
   if(FAILED(hr))
   {
      goto cleanup;
   }

   //loop through the file.  read a chunk from the local file, then
   //write to the server with IStream::Write
   while(TRUE)
   {
      if(FALSE == ReadFile(hFile, rgbBuf, 1024, &cbRead, NULL))
      {
         hr = HRESULT_FROM_WIN32(GetLastError());
         goto cleanup;
      }

      if(0 == cbRead)
      {
         break;
      }

      hr = pStream->Write((void *)rgbBuf,
                           cbRead,
                           &cbWritten);
      if(FAILED(hr))
      {
         goto cleanup;
      }
   }

   //after writing completes, we must commit
   hr = pStream->Commit(STGC_DEFAULT);

cleanup:

   //clean up
   if(NULL != pStream)
   {
      pStream->Release();
      pStream = NULL;
   }

   if(INVALID_HANDLE_VALUE != hFile)
   {
      CloseHandle(hFile);
      hFile = INVALID_HANDLE_VALUE;
   }

   return hr;
}

int __cdecl wmain | ( | int | argc,
 |  | wchar_t * | argv[]
 | ) |  |

Definition at line 24 of file Sample1.Cpp.

{
  HRESULT     hr = S_OK;
   LPWSTR      lpAction = argv[1];

   if(3 > argc)
  {
    //there has to be at least 4 arguments.
      hr = E_INVALIDARG;
  }
  else
  {
      CoInitialize(NULL);

      argc -= 2; //skip the name of command and action
      argv += 2;

      //switch on the action to perform:
      if(0 == _wcsicmp(lpAction, L"download"))
      {
         hr = Download(argc, argv);
      }
      else if(0 == _wcsicmp(lpAction, L"upload"))
      {
         hr = Upload(argc, argv);
      }
      else if(0 == _wcsicmp(lpAction, L"enum"))
      {
         hr = Enum(argc, argv);
      }
      else if(0 == _wcsicmp(lpAction, L"search"))
      {
         hr = Search(argc, argv);
      }
      else if(0 == _wcsicmp(lpAction, L"mkdir"))
      {
         hr = ISO(ISO_MKDIR, argc, argv);
      }
      else if(0 == _wcsicmp(lpAction, L"copy"))
      {
         hr = ISO(ISO_COPY, argc, argv);
      }
      else if(0 == _wcsicmp(lpAction, L"move"))
      {
         hr = ISO(ISO_MOVE, argc, argv);
      }
      else if(0 == _wcsicmp(lpAction, L"delete"))
      {
         hr = ISO(ISO_DELETE, argc, argv);
      }
      else
      {
         hr = E_INVALIDARG;
      }

      CoUninitialize();
  }

   if(E_INVALIDARG == hr)
   {
      PrintUsage();
      return 1;
   }

   wprintf(L"\nOperation %s completed with code=0x%08x\n", lpAction, hr);

  return 0;
}

Generated on Wed Nov 13 2024 16:53:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/internetpublishing/ippsample/Sample1.h File Reference

  • Dataaccess
  • oledb
  • internetpublishing
  • ippsample
Classes | Enumerations | Functions

Sample1.h File Reference

Go to the source code of this file.

Classes

class | CImpAuth

Enumerations

enum | ISO_OPS { ISO_MKDIR, ISO_COPY, ISO_MOVE, ISO_DELETE }

Functions

HRESULT | Bind (LPWSTR wszUrl, REFGUID rguid, REFIID riid, DWORD dwFlags, IUnknown **ppUnk, LPWSTR wszUserName, LPWSTR wszPassword, BOOL fCreate)
HRESULT | Download (int argc, wchar_t *argv[])
LPWSTR | DuplicateWSTR (LPWSTR wsz)
HRESULT | Enum (int argc, wchar_t *argv[])
HRESULT | EnumerateParent (LPWSTR wszUrl, LPWSTR wszUserName, LPWSTR wszPassword)
HRESULT | EnumerateWithRowsetPointer (IRowset *pIRowset, BOOL fVerbose)
HRESULT | GetParentUrl (LPWSTR wszUrl, LPWSTR *ppwchParent)
HRESULT | ISO (ISO_OPS Op, int argc, wchar_t *argv[])
void | PrintUsage ()
HRESULT | Search (int argc, wchar_t *argv[])
HRESULT | Upload (int argc, wchar_t *argv[])

Enumeration Type Documentation

enum ISO_OPS
Enumerator:
ISO_MKDIR
ISO_COPY
ISO_MOVE
ISO_DELETE

Definition at line 19 of file Sample1.h.

{
   ISO_MKDIR,
   ISO_COPY,
   ISO_MOVE,
   ISO_DELETE
};

Function Documentation

HRESULT Bind | ( | LPWSTR | wszUrl,
 |  | REFGUID | rguid,
 |  | REFIID | riid,
 |  | DWORD | dwFlags,
 |  | IUnknown ** | ppUnk,
 |  | LPWSTR | wszUserName,
 |  | LPWSTR | wszPassword,
 |  | BOOL | fCreate
 | ) |  |

Definition at line 1082 of file Sample1.Cpp.

{
   HRESULT           hr = S_OK;
   IAuthenticate     *pAuth = NULL;
   IBindResource     *pBindResource = NULL;
   ICreateRow        *pCreateRow = NULL;
   DBBINDURLSTATUS   dwBindStatus;

   //instantiation of the IAuthenticate callback
   if((NULL != pwchUserName) && (NULL != pwchPassword))
   {
      pAuth = new CImpAuth;
      if(NULL == pAuth)
      {
         return E_OUTOFMEMORY;
      }

      hr = ((CImpAuth *)pAuth)->Set(pwchUserName, pwchPassword);
      if(FAILED(hr))
      {
         delete pAuth;
         return hr;
      }

      pAuth->AddRef();
   }

   if(TRUE == fCreate)
   {
      //Calling CoCreateInstance to get the ICreateRow interface
      //on the binder.
      hr = CoCreateInstance(CLSID_RootBinder,
                            NULL,
                            CLSCTX_ALL,
                            IID_ICreateRow,
                            (void **)&pCreateRow);
      if(FAILED(hr))
      {
         if(NULL != pAuth)
         {
            pAuth->Release();
         }
         return hr;
      }

      //Creating!
      hr = pCreateRow->CreateRow(NULL,
                                pwchUrl,
                                dwFlags,
                                rguid,
                                riid,
                                pAuth,
                                NULL,
                                &dwBindStatus,
                                 NULL,
                                ppUnk);

      pCreateRow->Release();
   }
   else
   {
      //Calling CoCreateInstance to get the IBindResource interface
      //on the binder.
      hr = CoCreateInstance(CLSID_RootBinder,
                            NULL,
                            CLSCTX_ALL,
                            IID_IBindResource,
                            (void **)&pBindResource);
      if(FAILED(hr))
      {
         if(NULL != pAuth)
         {
            pAuth->Release();
         }
         return hr;
      }

      //Binding!
      hr = pBindResource->Bind(  NULL,
                                pwchUrl,
                                dwFlags,
                                rguid,
                                riid,
                                pAuth,
                                NULL,
                                &dwBindStatus,
                                ppUnk);

      pBindResource->Release();
   }

   if(NULL != pAuth)
   {
      pAuth->Release();
   }

   return hr;
}

HRESULT Download | ( | int | argc,
 |  | wchar_t * | argv[]
 | ) |  |

Definition at line 112 of file Sample1.Cpp.

{
   HRESULT     hr = S_OK;
   IStream     *pStream = NULL;
   LPWSTR      pwchUrl = NULL;
   LPWSTR      pwchLocalFile = NULL;
   LPWSTR      pwchUserName = NULL;
   LPWSTR      pwchPassword = NULL;
   HANDLE      hFile=INVALID_HANDLE_VALUE;
   BYTE        rgbBuf[1024]; //a 1-k buffer for reading
   ULONG       cbRead, cbWritten;
   int         i;

   //Parameter checking:
   if( (1 > argc) || (4 < argc) )
   {
      return E_INVALIDARG;
   }

   for(i = 0; i < argc; i++)
   {
      if(0 == _wcsnicmp(argv[i], L"u=", 2))
      {
         pwchUrl = argv[i] + 2;
      }
      else if(0 == _wcsnicmp(argv[i], L"l=", 2))
      {
         pwchLocalFile = argv[i] + 2;
      }
      else if(0 == _wcsnicmp(argv[i], L"n=", 2))
      {
         pwchUserName = argv[i] + 2;
      }
      else if(0 == _wcsnicmp(argv[i], L"p=", 2))
      {
         pwchPassword = argv[i] + 2;
      }
      else
      {
         return E_INVALIDARG;
      }
   }

   //URL is not optional:
   if( NULL == pwchUrl )
   {
      return E_INVALIDARG;
   }

   //You may not set one and not the other:
   if(  ( (NULL == pwchUserName) && (NULL != pwchPassword) )
      ||( (NULL != pwchUserName) && (NULL == pwchPassword) ) )
   {
      pwchUserName = NULL;
      pwchPassword = NULL;
   }

   //open the local file to be written to:
   if(NULL != pwchLocalFile)
   {
      hFile = CreateFileW(pwchLocalFile,
                          GENERIC_WRITE,
                          FILE_SHARE_READ,
                          NULL,
                          CREATE_ALWAYS,
                          FILE_ATTRIBUTE_NORMAL,
                          NULL);

      if(INVALID_HANDLE_VALUE == hFile)
      {
         return HRESULT_FROM_WIN32(GetLastError());
      }
   }

   //Bind to a stream:
   hr = Bind(pwchUrl,
             DBGUID_STREAM,
             IID_IStream,
             DBBINDURLFLAG_READ | DBBINDURLFLAG_SHARE_DENY_WRITE,
             (IUnknown **)&pStream,
             pwchUserName,
             pwchPassword,
             FALSE);
   if(FAILED(hr))
   {
      goto cleanup;
      return hr;
   }

   //loop through the reading of the file using IStream::Read, and
   //then write to the local file if need to.
   while(TRUE)
   {
      hr = pStream->Read((void *)rgbBuf,
                          1024,
                          &cbRead);

      if(0 == cbRead)
      {
         break;
      }

      if(INVALID_HANDLE_VALUE != hFile)
      {
         if(FALSE == WriteFile(hFile, rgbBuf, cbRead, &cbWritten, NULL))
         {
            hr = HRESULT_FROM_WIN32(GetLastError());
            goto cleanup;
         }
      }
   }

cleanup:

   //cleaning up by releasing pStream
   if(NULL != pStream)
   {
      pStream->Release();
      pStream = NULL;
   }

   if(INVALID_HANDLE_VALUE != hFile)
   {
      CloseHandle(hFile);
      hFile = INVALID_HANDLE_VALUE;
   }

   return hr;
}

LPWSTR DuplicateWSTR ( LPWSTR wsz )

Definition at line 1592 of file Sample1.Cpp.

{
   INT_PTR     cwch = wcslen(wsz) + 1;
   LPWSTR   pwchNew = new WCHAR[cwch];

   if(NULL == wsz)
   {
      return NULL;
   }

   wcsncpy(pwchNew, wsz, cwch);

   return pwchNew;
}

HRESULT Enum | ( | int | argc,
 |  | wchar_t * | argv[]
 | ) |  |

Definition at line 425 of file Sample1.Cpp.

{
   HRESULT           hr = S_OK;

   IRowset           *pRowset = NULL;

   LPWSTR            pwchUrl = NULL;
   LPWSTR            pwchUserName = NULL;
   LPWSTR            pwchPassword = NULL;
   BOOL              fVerbose = FALSE;
   int               i;

   //parameter checking:
   if( (1 > argc) || (4 < argc) )
   {
      return E_INVALIDARG;
   }

   for(i = 0; i < argc; i++)
   {
      if(0 == _wcsnicmp(argv[i], L"v=", 2))
      {
         if(0 == _wcsicmp(argv[i] + 2, L"yes"))
         {
            fVerbose = TRUE;
         }
         else if (0 == _wcsicmp(argv[i] + 2, L"no"))
         {
            fVerbose = FALSE;
         }
         else
         {
            return E_INVALIDARG;
         }
      }
      else if(0 == _wcsnicmp(argv[i], L"u=", 2))
      {
         pwchUrl = argv[i] + 2;
      }
      else if(0 == _wcsnicmp(argv[i], L"n=", 2))
      {
         pwchUserName = argv[i] + 2;
      }
      else if(0 == _wcsnicmp(argv[i], L"p=", 2))
      {
         pwchPassword = argv[i] + 2;
      }
      else
      {
         return E_INVALIDARG;
      }
   }

   //this is not optional:
   if( NULL == pwchUrl )
   {
      return E_INVALIDARG;
   }

   //You may not set one and not the other:
   if(  ( (NULL == pwchUserName) && (NULL != pwchPassword) )
      ||( (NULL != pwchUserName) && (NULL == pwchPassword) ) )
   {
      pwchUserName = NULL;
      pwchPassword = NULL;
   }

   //Bind the resource to the IRowset interface
   hr = Bind(pwchUrl,
             DBGUID_ROWSET,
             IID_IRowset,
             DBBINDURLFLAG_READ,
             (IUnknown **)&pRowset,
             pwchUserName,
             pwchPassword,
             FALSE);
   if(FAILED(hr))
   {
      return hr;
   }

   //calling Enumerate:
   hr = EnumerateWithRowsetPointer(pRowset, fVerbose);

   pRowset->Release();

   return hr;
}

HRESULT EnumerateParent | ( | LPWSTR | wszUrl,
 |  | LPWSTR | wszUserName,
 |  | LPWSTR | wszPassword
 | ) |  |

Definition at line 1442 of file Sample1.Cpp.

{
   HRESULT  hr = S_OK;
   LPWSTR   lpParent;
   IRowset  *pRowset;

   hr = GetParentUrl(pwchUrl, &lpParent);
   if(FAILED(hr))
   {
      return hr;
   }

   hr = Bind(pwchUrl,
             DBGUID_ROWSET,
             IID_IRowset,
             DBBINDURLFLAG_READ,
             (IUnknown **)&pRowset,
             pwchUserName,
             pwchPassword,
             FALSE);
   if(FAILED(hr))
   {
      delete [] lpParent;
      return hr;
   }

   hr = EnumerateWithRowsetPointer(pRowset, FALSE);

   delete [] lpParent;

   return hr;
}

HRESULT EnumerateWithRowsetPointer | ( | IRowset * | pIRowset,
 |  | BOOL | fVerbose
 | ) |  |

Definition at line 1207 of file Sample1.Cpp.

{
   HRESULT           hr = S_OK;
   DWORD             i;

   IColumnsInfo      *pColumnsInfo = NULL;
   DWORD_PTR          cColumn;
   DBCOLUMNINFO      *pInfo = NULL;
   OLECHAR           *pStringsBuf = NULL;

   IAccessor         *pAccessor = NULL;
   DBBINDING         *pBindings = NULL;
   HACCESSOR         hAccessor = NULL;
   DBBINDSTATUS      *pBindStatus = NULL;

   BYTE              *pData = NULL;
   DWORD_PTR          cRowsObtained;
   HROW              *pRow = NULL;
   DWORD             cRow;
   ULONG             *pStatus = NULL;
   ULONG             *pLength = NULL;

   if(NULL == pRowset)
   {
      return E_INVALIDARG;
   }

   //since there are a number of places where things may fail and need to
   //be cleaned up, we wrap the code in a while(FALSE) loop for easy
   //clean up.

   do{
      //finding out all the columns supported by the rowset.  This is
      //accomplished through the IColumnsInfo interface
      hr = pRowset->QueryInterface(IID_IColumnsInfo, (void **)&pColumnsInfo);
      if(FAILED(hr))
      {
         break;
      }

      hr = pColumnsInfo->GetColumnInfo(&cColumn, &pInfo, &pStringsBuf);
      if(FAILED(hr))
      {
         break;
      }

      if(0 == cColumn)
      {
         if(fVerbose)
         {
            printf("There are no columns for our rowset\n");
         }
         hr = S_OK;
         break;
      }

      //next we need to create an accessor.
      hr = pRowset->QueryInterface(IID_IAccessor, (void **)&pAccessor);
      if(FAILED(hr))
      {
         break;
      }

      pBindings = new DBBINDING [cColumn];
      if(NULL == pBindings)
      {
         hr = E_OUTOFMEMORY;
         break;
      }
      memset(pBindings, 0, cColumn * sizeof(DBBINDING));

      pBindStatus = new DBBINDSTATUS [cColumn];
      if(NULL == pBindStatus)
      {
         hr = E_OUTOFMEMORY;
         break;
      }
      memset(pBindStatus, 0, cColumn * sizeof(DBBINDSTATUS));

      //We have to transfer the information in the DBCOLUMNINFO
      //to our new DBBINDING.  However, we're asking for all the
      //columns in WSTR to display them if neccessary.  Almost all
      //types can be converted to DBTYPE_WSTR
      for(i = 0; i < cColumn; i++)
      {
         //we are going to ask for all the columns as DBTYPE_WSTR.
         pBindings[i].iOrdinal   = pInfo[i].iOrdinal;
         pBindings[i].obValue    = i * MAX_PATH;
         pBindings[i].obLength   = (cColumn * MAX_PATH) + (i * sizeof(ULONG));
         pBindings[i].obStatus   = (cColumn * (MAX_PATH + sizeof(ULONG)))
                                    + (i * sizeof(ULONG));
         pBindings[i].pTypeInfo  = pInfo[i].pTypeInfo;
         pBindings[i].pObject    = NULL;
         pBindings[i].pBindExt   = NULL;
         pBindings[i].dwPart     = DBPART_VALUE | DBPART_LENGTH | DBPART_STATUS;
         pBindings[i].dwMemOwner = DBMEMOWNER_CLIENTOWNED;
         pBindings[i].eParamIO   = 0;
         pBindings[i].cbMaxLen   = MAX_PATH;
         pBindings[i].dwFlags    = 0;
         pBindings[i].wType      = DBTYPE_WSTR;
         pBindings[i].bPrecision = pInfo[i].bPrecision;
         pBindings[i].bScale     = pInfo[i].bScale;
      }

      hr = pAccessor->CreateAccessor(DBACCESSOR_ROWDATA,
                                     cColumn,
                                     pBindings,
                                     0,
                                     &hAccessor,
                                     pBindStatus);

      if(FAILED(hr))
      {
         break;
      }

      //We need to pass a buffer into the GetData call.  here
      //we allocate it.
      pData = new BYTE [cColumn * (MAX_PATH + (2 * sizeof(ULONG)))];
      if(NULL == pData)
      {
         hr = E_OUTOFMEMORY;
         break;
      }
      pStatus = (ULONG *)( pData + (cColumn * MAX_PATH) );
      pLength = (ULONG *)( pData + (cColumn * (MAX_PATH + sizeof(ULONG))) );

      //getting the rows row by row and print them to stdout if neccessary.
      cRow=0;
      while(TRUE)
      {
         hr = pRowset->GetNextRows(NULL, 0, 1, &cRowsObtained, &pRow);
         if(FAILED(hr) || (DB_S_ENDOFROWSET == hr))
         {
            break;
         }

         hr = pRowset->GetData(pRow[0], hAccessor, (void *)pData);
         pRowset->ReleaseRows(1, pRow, NULL, NULL, NULL);

         if(FAILED(hr))
         {
            break;
         }

         if(fVerbose)
         {
            printf("Columns for Row %i:\n", cRow);

            for(i = 0; i < cColumn; i++)
            {
               LPWSTR   lpColData;

               lpColData = (LPWSTR) (pData + (i * MAX_PATH));

               //making sure the data is terminated.
               //The data we get back has the right length, but they may not be
               //null-terminated.
               if(DBSTATUS_S_OK == pStatus[i])
               {
                  lpColData[ pLength[i] / sizeof(WCHAR) ] = L'\0';
               }
               else if(DBSTATUS_S_TRUNCATED == pStatus[i])
               {
                  lpColData[ (MAX_PATH / sizeof(WCHAR)) - 1 ] = L'\0';
               }

               printf("  Column %i: %ls\n", i, lpColData);
            }
         }

         cRow++;
      }

   }while(FALSE);

   //cleanup:
   if (NULL != pColumnsInfo)
   {
      pColumnsInfo->Release();
   }

   if (NULL != pInfo)
   {
      CoTaskMemFree(pInfo);
   }

   if (NULL != pStringsBuf)
   {
      CoTaskMemFree(pStringsBuf);
   }

   if (NULL != pAccessor)
   {
      if (NULL != hAccessor)
      {
         pAccessor->ReleaseAccessor(hAccessor, NULL);
      }
      pAccessor->Release();
   }

   if (NULL != pBindings)
   {
      delete [] pBindings;
   }

   if (NULL != pBindStatus)
   {
      delete [] pBindStatus;
   }

   if (NULL != pData)
   {
      delete [] pData;
   }

   return hr;
}

HRESULT GetParentUrl | ( | LPWSTR | wszUrl,
 |  | LPWSTR * | ppwchParent
 | ) |  |

Definition at line 1488 of file Sample1.Cpp.

{
   HRESULT     hr = S_OK;
   LPWSTR      lpParent = NULL;
   PWCHAR      pwchLast;
   DWORD_PTR   cwchUrl = wcslen(pwchUrl);

   if(NULL == ppwchParent)
   {
      return E_INVALIDARG;
   }
   *ppwchParent = NULL;

   lpParent = new WCHAR [cwchUrl + 1];
   if (NULL == lpParent)
   {
      return E_OUTOFMEMORY;
   }
   wcsncpy(lpParent, pwchUrl, cwchUrl + 1);

   pwchLast = wcsrchr(lpParent, L'/');
   if(NULL == pwchLast)
   {
      delete [] lpParent;
      return E_INVALIDARG;
   }

   if(pwchLast == (lpParent + cwchUrl - 1))
   {
      //The last character is a NULL
      lpParent[cwchUrl-1] = L'\0';
      pwchLast = wcsrchr(lpParent, L'/');
      if(NULL == pwchLast)
      {
         delete [] lpParent;
         return E_INVALIDARG;
      }
   }

   if(L'/' == *(pwchLast - 1))
   {
      //The '/' pointed to by pchLast is the // in the URL.
      delete [] lpParent;
      return S_OK;
   }

   *pwchLast = L'\0'; //cutting the URL off at the last '/'

   *ppwchParent = lpParent;

   return hr;
}

HRESULT ISO | ( | ISO_OPS | Op,
 |  | int | argc,
 |  | wchar_t * | argv[]
 | ) |  |

Definition at line 775 of file Sample1.Cpp.

{
   HRESULT              hr = S_OK;
   IScopedOperations    *pISO = NULL;
   LPWSTR               pwchUrl = NULL;
   LPWSTR               pwchUserName = NULL;
   LPWSTR               pwchPassword = NULL;

   LPWSTR               pwchUrlSrc = NULL;
   LPWSTR               pwchUserNameSrc = NULL;
   LPWSTR               pwchPasswordSrc = NULL;

   LPWSTR               pwchUrlDest = NULL;
   LPWSTR               pwchUserNameDest = NULL;
   LPWSTR               pwchPasswordDest = NULL;

   LPWSTR               pwchUrlBind = NULL;
   LPWSTR               pwchUserNameBind = NULL;
   LPWSTR               pwchPasswordBind = NULL;

   IAuthenticate        *pAuth = NULL;

   int                  i;
   DWORD                dwStatus = 0;
   BOOL                 fAlloc = FALSE;

   //parameter checking
   if((1 > argc) || (6 < argc))
   {
      return E_INVALIDARG;
   }

   for(i = 0; i < argc; i++)
   {
      if(0 == _wcsnicmp(argv[i], L"u=", 2))
      {
         pwchUrl = argv[i] + 2;
      }
      else if(0 == _wcsnicmp(argv[i], L"us=", 3))
      {
         pwchUrlSrc = argv[i] + 3;
      }
      else if(0 == _wcsnicmp(argv[i], L"ud=", 3))
      {
         pwchUrlDest = argv[i] + 3;
      }
      else if(0 == _wcsnicmp(argv[i], L"n=", 2))
      {
         pwchUserName = argv[i] + 2;
      }
      else if(0 == _wcsnicmp(argv[i], L"p=", 2))
      {
         pwchPassword = argv[i] + 2;
      }
      else if(0 == _wcsnicmp(argv[i], L"ns=", 3))
      {
         pwchUserNameSrc = argv[i] + 3;
      }
      else if(0 == _wcsnicmp(argv[i], L"ps=", 3))
      {
         pwchPasswordSrc = argv[i] + 3;
      }
      else if(0 == _wcsnicmp(argv[i], L"nd=", 3))
      {
         pwchUserNameDest = argv[i] + 3;
      }
      else if(0 == _wcsnicmp(argv[i], L"pd=", 3))
      {
         pwchPasswordDest = argv[i] + 3;
      }
      else
      {
         return E_INVALIDARG;
      }
   }

   //You may not set one and not the other:
   if(  ( (NULL == pwchUserName) && (NULL != pwchPassword) )
      ||( (NULL != pwchUserName) && (NULL == pwchPassword) ) )
   {
      pwchUserName = NULL;
      pwchPassword = NULL;
   }

   if(  ( (NULL == pwchUserNameSrc) && (NULL != pwchPasswordSrc) )
      ||( (NULL != pwchUserNameSrc) && (NULL == pwchPasswordSrc) ) )
   {
      pwchUserNameSrc = NULL;
      pwchPasswordSrc = NULL;
   }

   if(  ( (NULL == pwchUserNameDest) && (NULL != pwchPasswordDest) )
      ||( (NULL != pwchUserNameDest) && (NULL == pwchPasswordDest) ) )
   {
      pwchUserNameDest = NULL;
      pwchPasswordDest = NULL;
   }

   //if we're making a collection or deleting something, we do similar processing:
   if(ISO_MKDIR == op)
   {
      //this is not optional:
      if( NULL == pwchUrl )
      {
         return E_INVALIDARG;
      }

      //For creation of collection, merely binding is enough.
      hr = Bind(pwchUrl,
                DBGUID_ROW,
                IID_IScopedOperations,
                DBBINDURLFLAG_WRITE
                  | DBBINDURLFLAG_OVERWRITE
                  | DBBINDURLFLAG_COLLECTION,
                (IUnknown **)&pISO,
                pwchUserName,
                pwchPassword,
                TRUE);

      if(FAILED(hr))
      {
         return hr;
      }
   }
   else if(ISO_DELETE == op)
   {
      //this is not optional:
      if( NULL == pwchUrl )
      {
         return E_INVALIDARG;
      }

      hr = Bind(pwchUrl,
                DBGUID_ROW,
                IID_IScopedOperations,
                DBBINDURLFLAG_WRITE,
                (IUnknown **)&pISO,
                pwchUserName,
                pwchPassword,
                FALSE);
      if(FAILED(hr))
      {
         return hr;
      }

      hr = pISO->Delete(1,
                        (LPCWSTR *)&pwchUrl,
                        0,
                        &dwStatus);
   }
   else if((ISO_COPY == op) || (ISO_MOVE == op))
   {
      //we require both URLs
      if((NULL == pwchUrlSrc) || (NULL == pwchUrlDest))
      {
         return E_INVALIDARG;
      }

      //when we bind, we have to bind to a remote server.  If the
      //source URL is a file, we have to bind to the destination instead.
      //we cannot accept two file:// urls though.
      if(0 != _wcsnicmp(pwchUrlSrc, L"file://", 7))
      {
         pwchUrlBind = pwchUrlSrc;
         pwchUserNameBind = pwchUserNameSrc;
         pwchPasswordBind = pwchPasswordSrc;
      }
      else if (0 != _wcsnicmp(pwchUrlDest, L"file://", 7))
      {
         //we need to bind to the parent folder of the destination URL
         //in this case:
         hr = GetParentUrl(pwchUrlDest, &pwchUrlBind);
         if(FAILED(hr))
         {
            return hr;
         }
         fAlloc = TRUE;
         pwchUserNameBind = pwchUserNameDest;
         pwchPasswordBind = pwchPasswordDest;
      }
      else
      {
         return E_INVALIDARG;
      }

      //binding.  we have to make sure to pass in the right set of
      //credentials
      hr = Bind(pwchUrlBind,
                DBGUID_ROW,
                IID_IScopedOperations,
                DBBINDURLFLAG_READWRITE,
                (IUnknown **)&pISO,
                pwchUserNameBind,
                pwchPasswordBind,
                FALSE);
      if(fAlloc && (NULL != pwchUrlBind))
      {
         //cleanup while we can
         delete [] pwchUrlBind;
      }
      if(FAILED(hr))
      {
         return hr;
      }

      //the Copy/Move call takes an IAuthenticate interface pointer
      //for the destination resourecs as one of the arguments.
      //This way, we may authenticate to the source and destination
      //with different sets of credentials
      if((NULL != pwchUserNameDest) && (NULL != pwchPasswordDest))
      {
         pAuth = new CImpAuth;
         if(NULL == pAuth)
         {
            pISO->Release();

            return E_OUTOFMEMORY;
         }

         hr = ((CImpAuth *)pAuth)->Set(pwchUserNameDest, pwchPasswordDest);
         if(FAILED(hr))
         {
            delete pAuth;

            pISO->Release();

            return hr;
         }

         pAuth->AddRef();
      }

      //finally, the calls
      if(ISO_COPY == op)
      {
         hr = pISO->Copy(1,
                         (LPCWSTR *)&pwchUrlSrc,
                         (LPCWSTR *)&pwchUrlDest,
                         DBCOPY_REPLACE_EXISTING
                           | DBCOPY_ALLOW_EMULATION,
                         pAuth,
                         &dwStatus,
                         NULL,
                         NULL);
      }
      else if (ISO_MOVE == op)
      {
         hr = pISO->Move(1,
                         (LPCWSTR *)&pwchUrlSrc,
                         (LPCWSTR *)&pwchUrlDest,
                         DBMOVE_REPLACE_EXISTING
                           | DBMOVE_DONT_UPDATE_LINKS
                           | DBMOVE_ALLOW_EMULATION,
                         pAuth,
                         &dwStatus,
                         NULL,
                         NULL);
      }

      //cleaning up:
      if(NULL != pAuth)
      {
         pAuth->Release();
      }
   }
   else
   {
      return E_INVALIDARG;
   }

   //cleanup:
   if(NULL != pISO)
   {
      pISO->Release();
   }

   return hr;
}

void PrintUsage ( )

Definition at line 1549 of file Sample1.Cpp.

{
   wprintf(L"sample1.exe\n");
   wprintf(L"Usage:\n");
   wprintf(L"   sample1 <action> [action specific parameters]\n");
   wprintf(L"      where <action> is one of the followings:\n");
   wprintf(L"                download\n");
   wprintf(L"                upload\n");
   wprintf(L"                enum\n");
   wprintf(L"                search\n");
   wprintf(L"                mkdir\n");
   wprintf(L"                copy\n");
   wprintf(L"                move\n");
   wprintf(L"                delete\n");
   wprintf(L"      action specific parameters:\n");
   wprintf(L"         download: u=url [l=local_dest] [n=username p=password]\n");
   wprintf(L"         upload:   u=url l=local_src [n=username p=password]\n");
   wprintf(L"         enum:     u=url [v=yes/no] [n=username p=password]\n");
   wprintf(L"         search:   u=url [q=\"SQL query\"] [v=yes/no] [n=username p=password]\n");
   wprintf(L"                   note that '\"' in the query should be typed as '\\\"'\n");
   wprintf(L"         mkdir:    u=url [n=username p=password]\n");
   wprintf(L"         copy:     us=src ud=dest [ns=username ps=password]\n");
   wprintf(L"                                  [nd=username pd=password]\n");
   wprintf(L"         move:     us=src ud=dest [ns=username ps=password]\n");
   wprintf(L"                                  [nd=username pd=password]\n");
   wprintf(L"         delete:   u=url [n=username p=password]\n");
}

HRESULT Search | ( | int | argc,
 |  | wchar_t * | argv[]
 | ) |  |

Definition at line 539 of file Sample1.Cpp.

{
   HRESULT           hr = S_OK;
   LPWSTR            pwchUrl = NULL;
   LPWSTR            pwchQuery = NULL;
   LPWSTR            pwchUserName = NULL;
   LPWSTR            pwchPassword = NULL;
   BOOL              fVerbose = FALSE;
   int               i;

   IDBCreateCommand  *pCreateCommand = NULL;
   ICommand          *pCommand = NULL;
   ICommandText      *pCommandText = NULL;
   IRowset           *pRowset = NULL;
   LONG_PTR          cRowsAffected = 0;

   //parameter checking:
   if( (1 > argc) || (5 < argc) )
   {
      hr = E_INVALIDARG;
      goto cleanup;
   }

   for(i = 0; i < argc; i++)
   {
      if(0 == _wcsnicmp(argv[i], L"v=", 2))
      {
         if(0 == _wcsicmp(argv[i] + 2, L"yes"))
         {
            fVerbose = TRUE;
         }
         else if (0 == _wcsicmp(argv[i] + 2, L"no"))
         {
            fVerbose = FALSE;
         }
         else
         {
            hr = E_INVALIDARG;
            goto cleanup;
         }
      }
      else if(0 == _wcsnicmp(argv[i], L"u=", 2))
      {
         pwchUrl = argv[i] + 2;
      }
      else if(0 == _wcsnicmp(argv[i], L"q=", 2))
      {
         DWORD_PTR    cwchQuery = 0;

         cwchQuery = wcslen(argv[i] + 2);

         if(NULL != pwchQuery)
         {
            //if the user has two q="xxx", we might have a leak, unless
            //we do this.

            delete [] pwchQuery;
         }

         //no need to add one since we're stripping the last "
         pwchQuery = new WCHAR[cwchQuery + 1];
         if(NULL == pwchQuery)
         {
            hr = E_OUTOFMEMORY;
            goto cleanup;
         }

         wcsncpy(pwchQuery, argv[i] + 2, cwchQuery + 1);
      }
      else if(0 == _wcsnicmp(argv[i], L"n=", 2))
      {
         pwchUserName = argv[i] + 2;
      }
      else if(0 == _wcsnicmp(argv[i], L"p=", 2))
      {
         pwchPassword = argv[i] + 2;
      }
      else
      {
         hr = E_INVALIDARG;
         goto cleanup;
      }
   }

   //this is not optional:
   if( NULL == pwchUrl )
   {
      hr = E_INVALIDARG;
      goto cleanup;
   }

   //You may not set one and not the other:
   if(  ( (NULL == pwchUserName) && (NULL != pwchPassword) )
      ||( (NULL != pwchUserName) && (NULL == pwchPassword) ) )
   {
      pwchUserName = NULL;
      pwchPassword = NULL;
   }

   //now on to the real processing.  In order to get a command object,
   // we have to bind to a session first.

   hr = Bind(pwchUrl,
             DBGUID_SESSION,
             IID_IDBCreateCommand,
             DBBINDURLFLAG_READ,
             (IUnknown **)&pCreateCommand,
             pwchUserName,
             pwchPassword,
             FALSE);
   if(FAILED(hr))
   {
      goto cleanup;
   }

   //now we should create the command:

   hr = pCreateCommand->CreateCommand(
                           NULL,
                           IID_ICommandText,
                           (IUnknown **)&pCommandText);
   pCreateCommand->Release(); //we don't need this anymore
   if(FAILED(hr))
   {
      goto cleanup;
   }

   if(NULL == pwchQuery)
   {
      //we use the default query:
      LPWSTR   wszQueryFormat = L"SELECT \"DAV:displayname\" FROM SCOPE ('SHALLOW TRAVERSAL OF \"%s\"')";
      INT_PTR      cwchQuery = wcslen(wszQueryFormat) + wcslen(pwchUrl) + 1;
      int      nRet;

      pwchQuery = new WCHAR[cwchQuery];
      if(NULL == pwchQuery)
      {
         hr = E_OUTOFMEMORY;
         goto cleanup;
      }

      nRet = swprintf(pwchQuery, wszQueryFormat, pwchUrl);
      if((0 >= nRet) || (cwchQuery <= nRet))
      {
         //the number of chars don't add up
         hr = E_FAIL;
         goto cleanup;
      }
   }

   //we have to set the command text now:
   hr = pCommandText->SetCommandText(
               DBGUID_DEFAULT,
               pwchQuery);
   if(FAILED(hr))
   {
      pCommandText->Release();
      goto cleanup;
   }

   hr = pCommandText->QueryInterface(
                        IID_ICommand,
                        (void **)&pCommand);
   pCommandText->Release();
   if(FAILED(hr))
   {
      goto cleanup;
   }

   //Finally, execute the command to get the IRowset pointer
   hr = pCommand->Execute(
                        NULL,
                        IID_IRowset,
                        NULL,
                        &cRowsAffected,
                        (IUnknown**)&pRowset);
   pCommand->Release();
   if(FAILED(hr))
   {
      goto cleanup;
   }

   hr = EnumerateWithRowsetPointer(pRowset, fVerbose);
   pRowset->Release();

cleanup:

   if(NULL != pwchQuery)
   {
      delete [] pwchQuery;
      pwchQuery = NULL;
   }

   return hr;
}

HRESULT Upload | ( | int | argc,
 |  | wchar_t * | argv[]
 | ) |  |

Definition at line 262 of file Sample1.Cpp.

{
   HRESULT     hr = S_OK;
   IStream     *pStream = NULL;
   LPWSTR      pwchUrl = NULL;
   LPWSTR      pwchLocalFile = NULL;
   LPWSTR      pwchUserName = NULL;
   LPWSTR      pwchPassword = NULL;
   HANDLE      hFile=INVALID_HANDLE_VALUE;
   BYTE        rgbBuf[1024]; //a 1-k buffer for reading
   ULONG       cbRead, cbWritten;
   int         i;

   //parameter checking:
   if( (2 > argc) || (4 < argc) )
   {
      return E_INVALIDARG;
   }

   for(i = 0; i < argc; i++)
   {
      if(0 == _wcsnicmp(argv[i], L"u=", 2))
      {
         pwchUrl = argv[i] + 2;
      }
      else if(0 == _wcsnicmp(argv[i], L"l=", 2))
      {
         pwchLocalFile = argv[i] + 2;
      }
      else if(0 == _wcsnicmp(argv[i], L"n=", 2))
      {
         pwchUserName = argv[i] + 2;
      }
      else if(0 == _wcsnicmp(argv[i], L"p=", 2))
      {
         pwchPassword = argv[i] + 2;
      }
      else
      {
         return E_INVALIDARG;
      }
   }

   //you have to have the URL:
   if(NULL == pwchUrl)
   {
      return E_INVALIDARG;
   }

   //local file source is not optional
   if(NULL == pwchLocalFile)
   {
      return E_INVALIDARG;
   }

   //You may not set one and not the other:
   if(  ( (NULL == pwchUserName) && (NULL != pwchPassword) )
      ||( (NULL != pwchUserName) && (NULL == pwchPassword) ) )
   {
      pwchUserName = NULL;
      pwchPassword = NULL;
   }

   //opening the local file to read from
   hFile = CreateFileW(pwchLocalFile,
                       GENERIC_READ,
                       FILE_SHARE_READ,
                       NULL,
                       OPEN_EXISTING,
                       FILE_ATTRIBUTE_NORMAL,
                       NULL);

   if(INVALID_HANDLE_VALUE == hFile)
   {
      return HRESULT_FROM_WIN32(GetLastError());
   }

   //Bind to a stream:
   //note the bindflags or STGM we use will make sure that we can overwrite
   //the target file if it exists
   hr = Bind(pwchUrl,
             DBGUID_STREAM,
             IID_IStream,
             DBBINDURLFLAG_WRITE
               | DBBINDURLFLAG_SHARE_DENY_WRITE
               | DBBINDURLFLAG_OVERWRITE,
             (IUnknown **)&pStream,
             pwchUserName,
             pwchPassword,
             TRUE);
   if(FAILED(hr))
   {
      goto cleanup;
   }

   //loop through the file.  read a chunk from the local file, then
   //write to the server with IStream::Write
   while(TRUE)
   {
      if(FALSE == ReadFile(hFile, rgbBuf, 1024, &cbRead, NULL))
      {
         hr = HRESULT_FROM_WIN32(GetLastError());
         goto cleanup;
      }

      if(0 == cbRead)
      {
         break;
      }

      hr = pStream->Write((void *)rgbBuf,
                           cbRead,
                           &cbWritten);
      if(FAILED(hr))
      {
         goto cleanup;
      }
   }

   //after writing completes, we must commit
   hr = pStream->Commit(STGC_DEFAULT);

cleanup:

   //clean up
   if(NULL != pStream)
   {
      pStream->Release();
      pStream = NULL;
   }

   if(INVALID_HANDLE_VALUE != hFile)
   {
      CloseHandle(hFile);
      hFile = INVALID_HANDLE_VALUE;
   }

   return hr;
}

Generated on Wed Nov 13 2024 16:53:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/internetpublishing/ippsample/StdAfx.Cpp File Reference

  • Dataaccess
  • oledb
  • internetpublishing
  • ippsample

StdAfx.Cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/internetpublishing/ippsample/StdAfx.h File Reference

  • Dataaccess
  • oledb
  • internetpublishing
  • ippsample
Defines

StdAfx.h File Reference

#include <stdio.h>
#include <oledb.h>
#include <oledberr.h>
#include <msdaipp.h>
#include <msdasc.h>
#include "sample1.h"

Go to the source code of this file.

Defines

#define WIN32_LEAN_AND_MEAN

Define Documentation

#define WIN32_LEAN_AND_MEAN

Definition at line 26 of file StdAfx.h.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/omniprov/source/cdbfile.cpp File Reference

  • Dataaccess
  • oledb
  • omniprov
  • source

cdbfile.cpp File Reference

#include "stdafx.h"
#include "CDBFile.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/omniprov/source/cdbfile.h File Reference

  • Dataaccess
  • oledb
  • omniprov
  • source
Classes | Defines

cdbfile.h File Reference

#include "CRow.h"
#include <comdef.h>
#include "CRow.h"

Go to the source code of this file.

Classes

class | CDBFile

Defines

#define | CONTRACT_FILE false
#define | DBFILE_FLUSH_ERROR 100
#define | ERROR_IN_ROW_DATA -1
#define | EXPAND_FILE true
#define | FETCH_SUCCESS 0
#define | LAST_ROW_FETCHED 1
#define | MAX_RECORD_SIZE 10000
#define | MAX_TABLE_NAME_SIZE 20
#define | OUT_LINE_FILE()

Define Documentation

#define CONTRACT_FILE false

Definition at line 30 of file cdbfile.h.

#define DBFILE_FLUSH_ERROR 100

Definition at line 26 of file cdbfile.h.

#define ERROR_IN_ROW_DATA -1

Definition at line 24 of file cdbfile.h.

#define EXPAND_FILE true

Definition at line 29 of file cdbfile.h.

#define FETCH_SUCCESS 0

Definition at line 25 of file cdbfile.h.

#define LAST_ROW_FETCHED 1

Definition at line 23 of file cdbfile.h.

#define MAX_RECORD_SIZE 10000

Definition at line 21 of file cdbfile.h.

#define MAX_TABLE_NAME_SIZE 20

Definition at line 27 of file cdbfile.h.

#define OUT_LINE_FILE ( )

Definition at line 36 of file cdbfile.h.

Generated on Wed Nov 13 2024 16:53:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/omniprov/source/crow.cpp File Reference

  • Dataaccess
  • oledb
  • omniprov
  • source

crow.cpp File Reference

#include "stdafx.h"
#include "CRow.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/omniprov/source/crow.h File Reference

  • Dataaccess
  • oledb
  • omniprov
  • source
Classes | Defines

crow.h File Reference

Go to the source code of this file.

Classes

class | CRow

Defines

#define | BAD_RECORD_FORMAT -1
#define | MAX_COLUMNSIZE 255

Define Documentation

#define BAD_RECORD_FORMAT -1

Definition at line 24 of file crow.h.

#define MAX_COLUMNSIZE 255

Definition at line 23 of file crow.h.

Generated on Wed Nov 13 2024 16:53:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/omniprov/source/irowsetchange.h File Reference

  • Dataaccess
  • oledb
  • omniprov
  • source
Classes

irowsetchange.h File Reference

#include "CRow.h"

Go to the source code of this file.

Classes

class IRowsetChangeImpl< T, Storage, RowClass >
Generated on Wed Nov 13 2024 16:53:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/omniprov/source/irowsetscroll.h File Reference

  • Dataaccess
  • oledb
  • omniprov
  • source
Classes

irowsetscroll.h File Reference

#include "RNCP.h"

Go to the source code of this file.

Classes

class IRowsetScrollImpl< T, RowsetInterface >
Generated on Wed Nov 13 2024 16:53:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/omniprov/source/msomniprovds.h File Reference

  • Dataaccess
  • oledb
  • omniprov
  • source
Classes

msomniprovds.h File Reference

#include "resource.h"
#include "MSOmniProvRS.h"
#include "resource.h"

Go to the source code of this file.

Classes

class CMSOmniProvSource
Generated on Wed Nov 13 2024 16:53:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/omniprov/source/msomniprovrs.cpp File Reference

  • Dataaccess
  • oledb
  • omniprov
  • source

msomniprovrs.cpp File Reference

#include "stdafx.h"
#include "TheProvider.h"
#include "MSOmniProvRS.h"
#include <comdef.h>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/omniprov/source/msomniprovrs.h File Reference

  • Dataaccess
  • oledb
  • omniprov
  • source
Classes | Typedefs

msomniprovrs.h File Reference

#include "resource.h"
#include "IRowsetScroll.h"
#include "IRowsetChange.h"
#include "RNCP.h"
#include "CDBFile.h"

Go to the source code of this file.

Classes

class | CMSOmniProvCommand
class | CMSOmniProvRowset

Typedefs

typedef CDBFile | dummyStore

Typedef Documentation

typedef CDBFile dummyStore

Definition at line 103 of file msomniprovrs.h.

Generated on Wed Nov 13 2024 16:53:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/omniprov/source/msomniprovsess.h File Reference

  • Dataaccess
  • oledb
  • omniprov
  • source
Classes

msomniprovsess.h File Reference

#include "resource.h"
#include "MSOmniProvRS.h"

Go to the source code of this file.

Classes

class | CMSOmniProvSession
class | CMSOmniProvSessionColSchemaRowset
class | CMSOmniProvSessionPTSchemaRowset
class | CMSOmniProvSessionTRSchemaRowset
Generated on Wed Nov 13 2024 16:53:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/omniprov/source/resource.h File Reference

  • Dataaccess
  • oledb
  • omniprov
  • source
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_MSOMNIPROV 101
#define | IDS_DBPROP_ABORTPRESERVE 164
#define | IDS_DBPROP_ACTIVESESSIONS 102
#define | IDS_DBPROP_APPENDONLY 211
#define | IDS_DBPROP_ASYNCTXNABORT 129
#define | IDS_DBPROP_ASYNCTXNCOMMIT 103
#define | IDS_DBPROP_AUTH_CACHE_AUTHINFO 172
#define | IDS_DBPROP_AUTH_ENCRYPT_PASSWORD 173
#define | IDS_DBPROP_AUTH_INTEGRATED 174
#define | IDS_DBPROP_AUTH_MASK_PASSWORD 175
#define | IDS_DBPROP_AUTH_PASSWORD 176
#define | IDS_DBPROP_AUTH_PERSIST_ENCRYPTED 177
#define | IDS_DBPROP_AUTH_PERSIST_SENSITIVE_AUTHINFO 178
#define | IDS_DBPROP_AUTH_USERID 179
#define | IDS_DBPROP_BLOCKINGSTORAGEOBJECTS 165
#define | IDS_DBPROP_BOOKMARKS 206
#define | IDS_DBPROP_BOOKMARKSKIPPED 207
#define | IDS_DBPROP_BOOKMARKTYPE 208
#define | IDS_DBPROP_BYREFACCESSORS 104
#define | IDS_DBPROP_CANFETCHBACKWARDS 209
#define | IDS_DBPROP_CANHOLDROWS 210
#define | IDS_DBPROP_CANSCROLLBACKWARDS 212
#define | IDS_DBPROP_CATALOGLOCATION 105
#define | IDS_DBPROP_CATALOGTERM 106
#define | IDS_DBPROP_CATALOGUSAGE 107
#define | IDS_DBPROP_CHANGEINSERTEDROWS 169
#define | IDS_DBPROP_COLUMNDEFINITION 108
#define | IDS_DBPROP_COLUMNRESTRICT 213
#define | IDS_DBPROP_COMMANDTIMEOUT 214
#define | IDS_DBPROP_COMMITPRESERVE 215
#define | IDS_DBPROP_CONCATNULLBEHAVIOR 109
#define | IDS_DBPROP_DATASOURCENAME 110
#define | IDS_DBPROP_DATASOURCEREADONLY 111
#define | IDS_DBPROP_DBMSNAME 112
#define | IDS_DBPROP_DBMSVER 113
#define | IDS_DBPROP_DELAYSTORAGEOBJECTS 216
#define | IDS_DBPROP_DSOTHREADMODEL 130
#define | IDS_DBPROP_GROUPBY 143
#define | IDS_DBPROP_HETEROGENEOUSTABLES 144
#define | IDS_DBPROP_IAccessor 195
#define | IDS_DBPROP_IColumnsInfo 196
#define | IDS_DBPROP_IColumnsRowset 197
#define | IDS_DBPROP_IConnectionPointContainer 198
#define | IDS_DBPROP_IConvertType 171
#define | IDS_DBPROP_IDENTIFIERCASE 145
#define | IDS_DBPROP_IMMOBILEROWS 217
#define | IDS_DBPROP_INIT_DATASOURCE 180
#define | IDS_DBPROP_INIT_HWND 181
#define | IDS_DBPROP_INIT_IMPERSONATION_LEVEL 182
#define | IDS_DBPROP_INIT_LCID 188
#define | IDS_DBPROP_INIT_LOCATION 183
#define | IDS_DBPROP_INIT_MODE 184
#define | IDS_DBPROP_INIT_OLEDBSERVICES 1189
#define | IDS_DBPROP_INIT_PROMPT 185
#define | IDS_DBPROP_INIT_PROTECTION_LEVEL 186
#define | IDS_DBPROP_INIT_PROVIDERSTRING 189
#define | IDS_DBPROP_INIT_TIMEOUT 187
#define | IDS_DBPROP_IProvideMoniker 199
#define | IDS_DBPROP_IRowset 200
#define | IDS_DBPROP_IRowsetChange 201
#define | IDS_DBPROP_IRowsetIdentity 202
#define | IDS_DBPROP_IRowsetInfo 203
#define | IDS_DBPROP_IRowsetLocate 204
#define | IDS_DBPROP_IRowsetResynch 205
#define | IDS_DBPROP_IRowsetScroll 166
#define | IDS_DBPROP_IRowsetUpdate 167
#define | IDS_DBPROP_ISequentialStream 163
#define | IDS_DBPROP_ISupportErrorInfo 168
#define | IDS_DBPROP_LITERALBOOKMARKS 218
#define | IDS_DBPROP_LITERALIDENTITY 219
#define | IDS_DBPROP_LOCKMODES 146
#define | IDS_DBPROP_MAXINDEXSIZE 147
#define | IDS_DBPROP_MAXOPENROWS 220
#define | IDS_DBPROP_MAXPENDINGROWS 221
#define | IDS_DBPROP_MAXROWS 222
#define | IDS_DBPROP_MAXROWSIZE 148
#define | IDS_DBPROP_MAXROWSIZEINCLUDESBLOB 149
#define | IDS_DBPROP_MAXTABLESINSELECT 150
#define | IDS_DBPROP_MULTIPLEPARAMSETS 131
#define | IDS_DBPROP_MULTIPLERESULTS 162
#define | IDS_DBPROP_MULTIPLESTORAGEOBJECTS 151
#define | IDS_DBPROP_MULTITABLEUPDATE 152
#define | IDS_DBPROP_NOTIFICATIONPHASES 153
#define | IDS_DBPROP_NOTIFYCOLUMNSET 134
#define | IDS_DBPROP_NOTIFYROWDELETE 135
#define | IDS_DBPROP_NOTIFYROWFIRSTCHANGE 136
#define | IDS_DBPROP_NOTIFYROWINSERT 137
#define | IDS_DBPROP_NOTIFYROWRESYNCH 138
#define | IDS_DBPROP_NOTIFYROWSETFETCHPOSITIONCHANGE 140
#define | IDS_DBPROP_NOTIFYROWSETRELEASE 139
#define | IDS_DBPROP_NOTIFYROWUNDOCHANGE 141
#define | IDS_DBPROP_NOTIFYROWUNDODELETE 142
#define | IDS_DBPROP_NOTIFYROWUNDOINSERT 159
#define | IDS_DBPROP_NOTIFYROWUPDATE 160
#define | IDS_DBPROP_NULLCOLLATION 154
#define | IDS_DBPROP_OLEOBJECTS 155
#define | IDS_DBPROP_ORDERBYCOLUMNSINSELECT 156
#define | IDS_DBPROP_ORDEREDBOOKMARKS 233
#define | IDS_DBPROP_OTHERINSERT 223
#define | IDS_DBPROP_OTHERUPDATEDELETE 224
#define | IDS_DBPROP_OUTPUTPARAMETERAVAILABILITY 132
#define | IDS_DBPROP_OWNINSERT 225
#define | IDS_DBPROP_OWNUPDATEDELETE 226
#define | IDS_DBPROP_PERSISTENTIDTYPE 133
#define | IDS_DBPROP_PREPAREABORTBEHAVIOR 158
#define | IDS_DBPROP_PREPARECOMMITBEHAVIOR 157
#define | IDS_DBPROP_PROCEDURETERM 114
#define | IDS_DBPROP_PROVIDERNAME 116
#define | IDS_DBPROP_PROVIDEROLEDBVER 115
#define | IDS_DBPROP_PROVIDERVER 117
#define | IDS_DBPROP_QUICKRESTART 227
#define | IDS_DBPROP_QUOTEDIDENTIFIERCASE 118
#define | IDS_DBPROP_REENTRANTEVENTS 228
#define | IDS_DBPROP_REMOVEDELETED 229
#define | IDS_DBPROP_REPORTMULTIPLECHANGES 230
#define | IDS_DBPROP_RETURNPENDINGINSERTS 170
#define | IDS_DBPROP_ROWRESTRICT 231
#define | IDS_DBPROP_ROWSETCONVERSIONSONCOMMAND 161
#define | IDS_DBPROP_ROWTHREADMODEL 232
#define | IDS_DBPROP_SCHEMATERM 119
#define | IDS_DBPROP_SCHEMAUSAGE 120
#define | IDS_DBPROP_SERVERCURSOR 191
#define | IDS_DBPROP_SESS_AUTOCOMMITISOLEVELS 190
#define | IDS_DBPROP_SQLSUPPORT 121
#define | IDS_DBPROP_STRONGIDENTITY 194
#define | IDS_DBPROP_STRUCTUREDSTORAGE 122
#define | IDS_DBPROP_SUBQUERIES 123
#define | IDS_DBPROP_SUPPORTEDTXNDDL 128
#define | IDS_DBPROP_SUPPORTEDTXNISOLEVELS 124
#define | IDS_DBPROP_SUPPORTEDTXNISORETAIN 125
#define | IDS_DBPROP_TABLETERM 126
#define | IDS_DBPROP_TRANSACTEDOBJECT 192
#define | IDS_DBPROP_UPDATABILITY 193
#define | IDS_DBPROP_USERNAME 127
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_MSOMNIPROV 101

Definition at line 6 of file resource.h.

#define IDS_DBPROP_ABORTPRESERVE 164

Definition at line 69 of file resource.h.

#define IDS_DBPROP_ACTIVESESSIONS 102

Definition at line 7 of file resource.h.

#define IDS_DBPROP_APPENDONLY 211

Definition at line 116 of file resource.h.

#define IDS_DBPROP_ASYNCTXNABORT 129

Definition at line 34 of file resource.h.

#define IDS_DBPROP_ASYNCTXNCOMMIT 103

Definition at line 8 of file resource.h.

#define IDS_DBPROP_AUTH_CACHE_AUTHINFO 172

Definition at line 77 of file resource.h.

#define IDS_DBPROP_AUTH_ENCRYPT_PASSWORD 173

Definition at line 78 of file resource.h.

#define IDS_DBPROP_AUTH_INTEGRATED 174

Definition at line 79 of file resource.h.

#define IDS_DBPROP_AUTH_MASK_PASSWORD 175

Definition at line 80 of file resource.h.

#define IDS_DBPROP_AUTH_PASSWORD 176

Definition at line 81 of file resource.h.

#define IDS_DBPROP_AUTH_PERSIST_ENCRYPTED 177

Definition at line 82 of file resource.h.

#define IDS_DBPROP_AUTH_PERSIST_SENSITIVE_AUTHINFO 178

Definition at line 83 of file resource.h.

#define IDS_DBPROP_AUTH_USERID 179

Definition at line 84 of file resource.h.

#define IDS_DBPROP_BLOCKINGSTORAGEOBJECTS 165

Definition at line 70 of file resource.h.

#define IDS_DBPROP_BOOKMARKS 206

Definition at line 111 of file resource.h.

#define IDS_DBPROP_BOOKMARKSKIPPED 207

Definition at line 112 of file resource.h.

#define IDS_DBPROP_BOOKMARKTYPE 208

Definition at line 113 of file resource.h.

#define IDS_DBPROP_BYREFACCESSORS 104

Definition at line 9 of file resource.h.

#define IDS_DBPROP_CANFETCHBACKWARDS 209

Definition at line 114 of file resource.h.

#define IDS_DBPROP_CANHOLDROWS 210

Definition at line 115 of file resource.h.

#define IDS_DBPROP_CANSCROLLBACKWARDS 212

Definition at line 117 of file resource.h.

#define IDS_DBPROP_CATALOGLOCATION 105

Definition at line 10 of file resource.h.

#define IDS_DBPROP_CATALOGTERM 106

Definition at line 11 of file resource.h.

#define IDS_DBPROP_CATALOGUSAGE 107

Definition at line 12 of file resource.h.

#define IDS_DBPROP_CHANGEINSERTEDROWS 169

Definition at line 74 of file resource.h.

#define IDS_DBPROP_COLUMNDEFINITION 108

Definition at line 13 of file resource.h.

#define IDS_DBPROP_COLUMNRESTRICT 213

Definition at line 118 of file resource.h.

#define IDS_DBPROP_COMMANDTIMEOUT 214

Definition at line 119 of file resource.h.

#define IDS_DBPROP_COMMITPRESERVE 215

Definition at line 120 of file resource.h.

#define IDS_DBPROP_CONCATNULLBEHAVIOR 109

Definition at line 14 of file resource.h.

#define IDS_DBPROP_DATASOURCENAME 110

Definition at line 15 of file resource.h.

#define IDS_DBPROP_DATASOURCEREADONLY 111

Definition at line 16 of file resource.h.

#define IDS_DBPROP_DBMSNAME 112

Definition at line 17 of file resource.h.

#define IDS_DBPROP_DBMSVER 113

Definition at line 18 of file resource.h.

#define IDS_DBPROP_DELAYSTORAGEOBJECTS 216

Definition at line 121 of file resource.h.

#define IDS_DBPROP_DSOTHREADMODEL 130

Definition at line 35 of file resource.h.

#define IDS_DBPROP_GROUPBY 143

Definition at line 48 of file resource.h.

#define IDS_DBPROP_HETEROGENEOUSTABLES 144

Definition at line 49 of file resource.h.

#define IDS_DBPROP_IAccessor 195

Definition at line 100 of file resource.h.

#define IDS_DBPROP_IColumnsInfo 196

Definition at line 101 of file resource.h.

#define IDS_DBPROP_IColumnsRowset 197

Definition at line 102 of file resource.h.

#define IDS_DBPROP_IConnectionPointContainer 198

Definition at line 103 of file resource.h.

#define IDS_DBPROP_IConvertType 171

Definition at line 76 of file resource.h.

#define IDS_DBPROP_IDENTIFIERCASE 145

Definition at line 50 of file resource.h.

#define IDS_DBPROP_IMMOBILEROWS 217

Definition at line 122 of file resource.h.

#define IDS_DBPROP_INIT_DATASOURCE 180

Definition at line 85 of file resource.h.

#define IDS_DBPROP_INIT_HWND 181

Definition at line 86 of file resource.h.

#define IDS_DBPROP_INIT_IMPERSONATION_LEVEL 182

Definition at line 87 of file resource.h.

#define IDS_DBPROP_INIT_LCID 188

Definition at line 93 of file resource.h.

#define IDS_DBPROP_INIT_LOCATION 183

Definition at line 88 of file resource.h.

#define IDS_DBPROP_INIT_MODE 184

Definition at line 89 of file resource.h.

#define IDS_DBPROP_INIT_OLEDBSERVICES 1189

Definition at line 139 of file resource.h.

#define IDS_DBPROP_INIT_PROMPT 185

Definition at line 90 of file resource.h.

#define IDS_DBPROP_INIT_PROTECTION_LEVEL 186

Definition at line 91 of file resource.h.

#define IDS_DBPROP_INIT_PROVIDERSTRING 189

Definition at line 94 of file resource.h.

#define IDS_DBPROP_INIT_TIMEOUT 187

Definition at line 92 of file resource.h.

#define IDS_DBPROP_IProvideMoniker 199

Definition at line 104 of file resource.h.

#define IDS_DBPROP_IRowset 200

Definition at line 105 of file resource.h.

#define IDS_DBPROP_IRowsetChange 201

Definition at line 106 of file resource.h.

#define IDS_DBPROP_IRowsetIdentity 202

Definition at line 107 of file resource.h.

#define IDS_DBPROP_IRowsetInfo 203

Definition at line 108 of file resource.h.

#define IDS_DBPROP_IRowsetLocate 204

Definition at line 109 of file resource.h.

#define IDS_DBPROP_IRowsetResynch 205

Definition at line 110 of file resource.h.

#define IDS_DBPROP_IRowsetScroll 166

Definition at line 71 of file resource.h.

#define IDS_DBPROP_IRowsetUpdate 167

Definition at line 72 of file resource.h.

#define IDS_DBPROP_ISequentialStream 163

Definition at line 68 of file resource.h.

#define IDS_DBPROP_ISupportErrorInfo 168

Definition at line 73 of file resource.h.

#define IDS_DBPROP_LITERALBOOKMARKS 218

Definition at line 123 of file resource.h.

#define IDS_DBPROP_LITERALIDENTITY 219

Definition at line 124 of file resource.h.

#define IDS_DBPROP_LOCKMODES 146

Definition at line 51 of file resource.h.

#define IDS_DBPROP_MAXINDEXSIZE 147

Definition at line 52 of file resource.h.

#define IDS_DBPROP_MAXOPENROWS 220

Definition at line 125 of file resource.h.

#define IDS_DBPROP_MAXPENDINGROWS 221

Definition at line 126 of file resource.h.

#define IDS_DBPROP_MAXROWS 222

Definition at line 127 of file resource.h.

#define IDS_DBPROP_MAXROWSIZE 148

Definition at line 53 of file resource.h.

#define IDS_DBPROP_MAXROWSIZEINCLUDESBLOB 149

Definition at line 54 of file resource.h.

#define IDS_DBPROP_MAXTABLESINSELECT 150

Definition at line 55 of file resource.h.

#define IDS_DBPROP_MULTIPLEPARAMSETS 131

Definition at line 36 of file resource.h.

#define IDS_DBPROP_MULTIPLERESULTS 162

Definition at line 67 of file resource.h.

#define IDS_DBPROP_MULTIPLESTORAGEOBJECTS 151

Definition at line 56 of file resource.h.

#define IDS_DBPROP_MULTITABLEUPDATE 152

Definition at line 57 of file resource.h.

#define IDS_DBPROP_NOTIFICATIONPHASES 153

Definition at line 58 of file resource.h.

#define IDS_DBPROP_NOTIFYCOLUMNSET 134

Definition at line 39 of file resource.h.

#define IDS_DBPROP_NOTIFYROWDELETE 135

Definition at line 40 of file resource.h.

#define IDS_DBPROP_NOTIFYROWFIRSTCHANGE 136

Definition at line 41 of file resource.h.

#define IDS_DBPROP_NOTIFYROWINSERT 137

Definition at line 42 of file resource.h.

#define IDS_DBPROP_NOTIFYROWRESYNCH 138

Definition at line 43 of file resource.h.

#define IDS_DBPROP_NOTIFYROWSETFETCHPOSITIONCHANGE 140

Definition at line 45 of file resource.h.

#define IDS_DBPROP_NOTIFYROWSETRELEASE 139

Definition at line 44 of file resource.h.

#define IDS_DBPROP_NOTIFYROWUNDOCHANGE 141

Definition at line 46 of file resource.h.

#define IDS_DBPROP_NOTIFYROWUNDODELETE 142

Definition at line 47 of file resource.h.

#define IDS_DBPROP_NOTIFYROWUNDOINSERT 159

Definition at line 64 of file resource.h.

#define IDS_DBPROP_NOTIFYROWUPDATE 160

Definition at line 65 of file resource.h.

#define IDS_DBPROP_NULLCOLLATION 154

Definition at line 59 of file resource.h.

#define IDS_DBPROP_OLEOBJECTS 155

Definition at line 60 of file resource.h.

#define IDS_DBPROP_ORDERBYCOLUMNSINSELECT 156

Definition at line 61 of file resource.h.

#define IDS_DBPROP_ORDEREDBOOKMARKS 233

Definition at line 138 of file resource.h.

#define IDS_DBPROP_OTHERINSERT 223

Definition at line 128 of file resource.h.

#define IDS_DBPROP_OTHERUPDATEDELETE 224

Definition at line 129 of file resource.h.

#define IDS_DBPROP_OUTPUTPARAMETERAVAILABILITY 132

Definition at line 37 of file resource.h.

#define IDS_DBPROP_OWNINSERT 225

Definition at line 130 of file resource.h.

#define IDS_DBPROP_OWNUPDATEDELETE 226

Definition at line 131 of file resource.h.

#define IDS_DBPROP_PERSISTENTIDTYPE 133

Definition at line 38 of file resource.h.

#define IDS_DBPROP_PREPAREABORTBEHAVIOR 158

Definition at line 63 of file resource.h.

#define IDS_DBPROP_PREPARECOMMITBEHAVIOR 157

Definition at line 62 of file resource.h.

#define IDS_DBPROP_PROCEDURETERM 114

Definition at line 19 of file resource.h.

#define IDS_DBPROP_PROVIDERNAME 116

Definition at line 21 of file resource.h.

#define IDS_DBPROP_PROVIDEROLEDBVER 115

Definition at line 20 of file resource.h.

#define IDS_DBPROP_PROVIDERVER 117

Definition at line 22 of file resource.h.

#define IDS_DBPROP_QUICKRESTART 227

Definition at line 132 of file resource.h.

#define IDS_DBPROP_QUOTEDIDENTIFIERCASE 118

Definition at line 23 of file resource.h.

#define IDS_DBPROP_REENTRANTEVENTS 228

Definition at line 133 of file resource.h.

#define IDS_DBPROP_REMOVEDELETED 229

Definition at line 134 of file resource.h.

#define IDS_DBPROP_REPORTMULTIPLECHANGES 230

Definition at line 135 of file resource.h.

#define IDS_DBPROP_RETURNPENDINGINSERTS 170

Definition at line 75 of file resource.h.

#define IDS_DBPROP_ROWRESTRICT 231

Definition at line 136 of file resource.h.

#define IDS_DBPROP_ROWSETCONVERSIONSONCOMMAND 161

Definition at line 66 of file resource.h.

#define IDS_DBPROP_ROWTHREADMODEL 232

Definition at line 137 of file resource.h.

#define IDS_DBPROP_SCHEMATERM 119

Definition at line 24 of file resource.h.

#define IDS_DBPROP_SCHEMAUSAGE 120

Definition at line 25 of file resource.h.

#define IDS_DBPROP_SERVERCURSOR 191

Definition at line 96 of file resource.h.

#define IDS_DBPROP_SESS_AUTOCOMMITISOLEVELS 190

Definition at line 95 of file resource.h.

#define IDS_DBPROP_SQLSUPPORT 121

Definition at line 26 of file resource.h.

#define IDS_DBPROP_STRONGIDENTITY 194

Definition at line 99 of file resource.h.

#define IDS_DBPROP_STRUCTUREDSTORAGE 122

Definition at line 27 of file resource.h.

#define IDS_DBPROP_SUBQUERIES 123

Definition at line 28 of file resource.h.

#define IDS_DBPROP_SUPPORTEDTXNDDL 128

Definition at line 33 of file resource.h.

#define IDS_DBPROP_SUPPORTEDTXNISOLEVELS 124

Definition at line 29 of file resource.h.

#define IDS_DBPROP_SUPPORTEDTXNISORETAIN 125

Definition at line 30 of file resource.h.

#define IDS_DBPROP_TABLETERM 126

Definition at line 31 of file resource.h.

#define IDS_DBPROP_TRANSACTEDOBJECT 192

Definition at line 97 of file resource.h.

#define IDS_DBPROP_UPDATABILITY 193

Definition at line 98 of file resource.h.

#define IDS_DBPROP_USERNAME 127

Definition at line 32 of file resource.h.

#define IDS_PROJNAME 100

Definition at line 5 of file resource.h.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/omniprov/source/rncp.h File Reference

  • Dataaccess
  • oledb
  • omniprov
  • source
Classes

rncp.h File Reference

Go to the source code of this file.

Classes

class CProxyIRowsetNotify< T >
Generated on Wed Nov 13 2024 16:53:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/omniprov/source/stdafx.cpp File Reference

  • Dataaccess
  • oledb
  • omniprov
  • source

stdafx.cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/omniprov/source/stdafx.h File Reference

  • Dataaccess
  • oledb
  • omniprov
  • source
Defines | Variables

stdafx.h File Reference

#include <atlbase.h>
#include <atlcom.h>
#include <atlctl.h>
#include <atldb.h>
#include <stdio.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _ATL_DEBUG_QI
#define | _WIN32_WINNT 0x0400
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 24 of file stdafx.h.

#define _ATL_DEBUG_QI

Definition at line 11 of file stdafx.h.

#define _WIN32_WINNT 0x0400

Definition at line 22 of file stdafx.h.

#define STRICT

Definition at line 20 of file stdafx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/omniprov/source/theprovider.cpp File Reference

  • Dataaccess
  • oledb
  • omniprov
  • source
Functions | Variables

theprovider.cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include "TheProvider.h"
#include "TheProvider_i.c"
#include "MSOmniProvSess.h"
#include "MSOmniProvDS.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 43 of file theprovider.cpp.

{
    return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 51 of file theprovider.cpp.

{
    return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 28 of file theprovider.cpp.

{
    if (dwReason == DLL_PROCESS_ATTACH)
    {
        _Module.Init(ObjectMap, hInstance, &LIBID_THEPROVIDERLib);
        DisableThreadLibraryCalls(hInstance);
    }
    else if (dwReason == DLL_PROCESS_DETACH)
        _Module.Term();
    return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 59 of file theprovider.cpp.

{
    // registers object, typelib and all interfaces in typelib
    return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 68 of file theprovider.cpp.

{
    return _Module.UnregisterServer(TRUE);
}

Variable Documentation

CComModule _Module

Definition at line 18 of file theprovider.cpp.

Generated on Wed Nov 13 2024 16:53:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/omniprov/source/theprovider.h File Reference

  • Dataaccess
  • oledb
  • omniprov
  • source
Defines | Typedefs | Functions | Variables

theprovider.h File Reference

#include "rpc.h"
#include "rpcndr.h"
#include "oaidl.h"
#include "ocidl.h"

Go to the source code of this file.

Defines

#define | __MSOmniProv_FWD_DEFINED__
#define | __REQUIRED_RPCNDR_H_VERSION__ 475
#define | __THEPROVIDERLib_LIBRARY_DEFINED__

Typedefs

typedef struct MSOmniProv | MSOmniProv

Functions

void *__RPC_USER | MIDL_user_allocate (size_t)
void __RPC_USER | MIDL_user_free (void *)

Variables

EXTERN_C const CLSID | CLSID_MSOmniProv
EXTERN_C const IID | LIBID_THEPROVIDERLib

Define Documentation

#define __MSOmniProv_FWD_DEFINED__

Definition at line 45 of file theprovider.h.

#define __REQUIRED_RPCNDR_H_VERSION__ 475

Definition at line 24 of file theprovider.h.

#define __THEPROVIDERLib_LIBRARY_DEFINED__

Definition at line 69 of file theprovider.h.

Typedef Documentation

typedef struct MSOmniProv MSOmniProv

Definition at line 50 of file theprovider.h.

Function Documentation

void* __RPC_USER MIDL_user_allocate ( size_t )

Definition at line 364 of file Picklpc.c.

{
    unsigned char * pcAllocated;
    unsigned char * pcUserPtr;

    pcAllocated = (unsigned char *) malloc( s + 15 );
    pcUserPtr =  ALIGN_TO8( pcAllocated );
    if ( pcUserPtr == pcAllocated )
        pcUserPtr = pcAllocated + 8;

    *(pcUserPtr - 1) = (char) (pcUserPtr - pcAllocated);

    return( pcUserPtr );
}

void __RPC_USER MIDL_user_free ( void * )

Definition at line 593 of file Client.C.

{
    HeapFree(GetProcessHeap(), 0, pointer);
}

Variable Documentation

EXTERN_C const CLSID CLSID_MSOmniProv

Definition at line 77 of file theprovider.h.

EXTERN_C const IID LIBID_THEPROVIDERLib

Definition at line 75 of file theprovider.h.

Generated on Wed Nov 13 2024 16:53:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/omniprov/source/theprovider.idl File Reference

  • Dataaccess
  • oledb
  • omniprov
  • source
Classes | Namespaces | Functions

theprovider.idl File Reference

Go to the source code of this file.

Classes

class | THEPROVIDERLib::MSOmniProv

Namespaces

namespace | THEPROVIDERLib

Functions

THEPROVIDERLib::importlib ("stdole32.tlb")
THEPROVIDERLib::importlib ("stdole2.tlb")
Generated on Wed Nov 13 2024 16:53:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/prsample/command.cpp File Reference

  • Dataaccess
  • oledb
  • prsample
Functions

command.cpp File Reference

#include "prsample.h"

Go to the source code of this file.

Functions

HRESULT | myCreateCommand (IUnknown *pUnkSession, IUnknown **ppUnkCommand)
HRESULT | myExecuteCommand (IUnknown *pUnkCommand, WCHAR *pwszCommandText, ULONG cPropSets, DBPROPSET *rgPropSets, IUnknown **ppUnkRowset)

Function Documentation

HRESULT myCreateCommand | ( | IUnknown * | pUnkSession,
 |  | IUnknown ** | ppUnkCommand
 | ) |  |

Definition at line 30 of file command.cpp.

{
  HRESULT         hr;
  IDBCreateCommand *    pIDBCreateCommand     = NULL;

  // Attempt to create a Command object from the Session object
  XCHECK_HR(hr = pUnkSession->QueryInterface(
        IID_IDBCreateCommand, (void**)&pIDBCreateCommand));
  XCHECK_HR(hr = pIDBCreateCommand->CreateCommand(
        NULL,       //pUnkOuter
        IID_ICommand,   //riid
        ppUnkCommand    //ppCommand
        ));

CLEANUP:
  if( pIDBCreateCommand )
    pIDBCreateCommand->Release();
  return hr;
}

HRESULT myExecuteCommand | ( | IUnknown * | pUnkCommand,
 |  | WCHAR * | pwszCommandText,
 |  | ULONG | cPropSets,
 |  | DBPROPSET * | rgPropSets,
 |  | IUnknown ** | ppUnkRowset
 | ) |  |

Definition at line 70 of file command.cpp.

{
  HRESULT         hr;
  ICommandText *      pICommandText       = NULL;
  ICommandProperties *  pICommandProperties     = NULL;

  // Set the properties on the Command object
  XCHECK_HR(hr = pUnkCommand->QueryInterface(
        IID_ICommandProperties, (void**)&pICommandProperties));
  XCHECK_HR(hr = pICommandProperties->SetProperties(cPropSets, rgPropSets));

  // Set the text for this Command, using the default command text
  // dialect. All providers that support commands must support this
  // dialect and providers that support SQL must be able to recognize
  // an SQL command as SQL when this dialect is specified
  XCHECK_HR(hr = pUnkCommand->QueryInterface(
        IID_ICommandText, (void**)&pICommandText));
  XCHECK_HR(hr = pICommandText->SetCommandText(
        DBGUID_DEFAULT,   //guidDialect
        pwszCommandText   //pwszCommandText
        ));

  // And execute the Command. Note that the user could have
  // entered a non-row returning command, so we will check for
  // that and return failure to prevent the display of the
  // non-existant rowset by the caller
  XCHECK_HR(hr = pICommandText->Execute(
        NULL,     //pUnkOuter
        IID_IRowset,  //riid
        NULL,     //pParams
        NULL,     //pcRowsAffected
        ppUnkRowset   //ppRowset
        ));

  if( !*ppUnkRowset )
  {
    printf("\nThe command executed successfully, but did not " \
         "return a rowset.\nNo rowset will be displayed.\n");
    hr = E_FAIL;
  }

CLEANUP:
  if( pICommandText )
    pICommandText->Release();
  if( pICommandProperties )
    pICommandProperties->Release();
  return hr;
}

Generated on Wed Nov 13 2024 16:53:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/prsample/datasource.cpp File Reference

  • Dataaccess
  • oledb
  • prsample
Functions

datasource.cpp File Reference

#include "prsample.h"

Go to the source code of this file.

Functions

void | myAddProperty (DBPROP *pProp, DBPROPID dwPropertyID, VARTYPE vtType, LONG lValue, DBPROPOPTIONS dwOptions)
HRESULT | myCreateDataSource (IUnknown **ppUnkDataSource)
HRESULT | myDoInitialization (IUnknown *pIUnknown)
HRESULT | myGetProperty (IUnknown *pIUnknown, REFIID riid, DBPROPID dwPropertyID, REFGUID guidPropertySet, BOOL *pbValue)

Function Documentation

void myAddProperty | ( | DBPROP * | pProp,
 |  | DBPROPID | dwPropertyID,
 |  | VARTYPE | vtType,
 |  | LONG | lValue,
 |  | DBPROPOPTIONS | dwOptions
 | ) |  |

Definition at line 309 of file datasource.cpp.

{
  // Set up the property structure
  pProp->dwPropertyID   = dwPropertyID;
  pProp->dwOptions    = dwOptions;
  pProp->dwStatus     = DBPROPSTATUS_OK;
  pProp->colid      = DB_NULLID;
  V_VT(&pProp->vValue)  = vtType;

  // Since VARIANT data is a union, we can place the value in any
  // member (except for VT_DECIMAL, which is a union with the whole
  // VARIANT structure -- but we know we're not passing VT_DECIMAL)
  V_I4(&pProp->vValue)  = lValue;
}

HRESULT myCreateDataSource ( IUnknown ** ppUnkDataSource )

Definition at line 31 of file datasource.cpp.

{
  HRESULT         hr;
  IDataInitialize *   pIDataInitialize      = NULL;
  IDBPromptInitialize * pIDBPromptInitialize    = NULL;
  IDBInitialize *     pIDBInitialize        = NULL;
  CLSID         clsid           = CLSID_MSDASQL;

  // Use the Microsoft Data Links UI to create the DataSource
  // object; this will allow the user to select the provider
  // to connect to and to set the initialization properties
  // for the DataSource object, which will be created by the
  // Data Links UI.
  if( g_dwFlags & USE_PROMPTDATASOURCE )
  {
    // Create the Data Links UI object and obtain the
    // IDBPromptInitialize interface from it
    XCHECK_HR(hr = CoCreateInstance(
          CLSID_DataLinks,        //clsid -- Data Links UI
          NULL,             //pUnkOuter
          CLSCTX_INPROC_SERVER,     //dwClsContext
          IID_IDBPromptInitialize,    //riid
          (void**)&pIDBPromptInitialize //ppvObj
          ));

    // Invoke the Data Links UI to allow the user to select
    // the provider and set initialization properties for
    // the DataSource object that this will create
    XCHECK_HR(hr = pIDBPromptInitialize->PromptDataSource(
          NULL,             //pUnkOuter
          GetDesktopWindow(),       //hWndParent
          DBPROMPTOPTIONS_PROPERTYSHEET,  //dwPromptOptions
          0,                //cSourceTypeFilter
          NULL,             //rgSourceTypeFilter
          NULL,             //pwszszzProviderFilter
          IID_IDBInitialize,        //riid
          (IUnknown**)&pIDBInitialize   //ppDataSource
          ));

    // We've obtained a DataSource object from the Data Links UI. This
    // object has had its initialization properties set, so all we
    // need to do is Initialize it
    XCHECK_HR(hr = pIDBInitialize->Initialize());
  }
  // We are not using the Data Links UI to create the DataSource object.
  // Instead, we will enumerate the providers installed on this system
  // through the OLE DB Enumerator and will allow the user to select
  // the ProgID of the provider for which we will create a DataSource
  // object.
  else
  {
    // Use the OLE DB Enumerator to obtain a rowset of installed providers,
    // then allow the user to select a provider from this rowset
    CHECK_HR(hr = myCreateEnumerator(CLSID_OLEDB_ENUMERATOR, &clsid));

    // We will create the DataSource object through the OLE DB service
    // component IDataInitialize interface, so we need to create an
    // instance of the data initialization object
    XCHECK_HR(hr = CoCreateInstance(
          CLSID_MSDAINITIALIZE,     //clsid -- data initialize
          NULL,             //pUnkOuter
          CLSCTX_INPROC_SERVER,     //dwClsContext
          IID_IDataInitialize,      //riid
          (void**)&pIDataInitialize   //ppvObj
          ));

    // Use IDataInitialize::CreateDBInstance to create an uninitialized
    // DataSource object for the chosen provider. By using this service
    // component method, the service component manager can provide
    // additional functionality beyond what is natively supported by the
    // provider if the consumer requests that functionality
    XCHECK_HR(hr = pIDataInitialize->CreateDBInstance(
          clsid,              //clsid -- provider
          NULL,             //pUnkOuter
          CLSCTX_INPROC_SERVER,     //dwClsContext
          NULL,             //pwszReserved
          IID_IDBInitialize,        //riid
          (IUnknown**)&pIDBInitialize   //ppDataSource
          ));

    // Initialize the DataSource object by setting any required
    // initialization properties and calling IDBInitialize::Initialize
    CHECK_HR(hr = myDoInitialization(pIDBInitialize));
  }

CLEANUP:
  *ppUnkDataSource = pIDBInitialize;
  if( pIDataInitialize )
    pIDataInitialize->Release();
  if( pIDBPromptInitialize )
    pIDBPromptInitialize->Release();
  return hr;
}

HRESULT myDoInitialization ( IUnknown * pIUnknown )

Definition at line 138 of file datasource.cpp.

{
  HRESULT         hr;
  IDBInitialize *     pIDBInitialize        = NULL;
  IDBProperties *     pIDBProperties        = NULL;
  HWND          hWnd            = GetDesktopWindow();

  const ULONG       cProperties         = 2;
  DBPROP          rgProperties[cProperties];
  DBPROPSET       rgPropSets[1];

  // In order to initialize the DataSource object most providers require
  // some initialization properties to be set by the consumer. For instance,
  // these might include the data source to connect to and the user ID and
  // password to use to establish identity. We will ask the provider to
  // prompt the user for this required information by setting the following
  // properties:
  myAddProperty(&rgProperties[0],DBPROP_INIT_PROMPT,VT_I2,DBPROMPT_COMPLETE);
  myAddProperty(&rgProperties[1],DBPROP_INIT_HWND,  VT_I4,(LONG)hWnd);

  rgPropSets[0].rgProperties    = rgProperties;
  rgPropSets[0].cProperties   = cProperties;
  rgPropSets[0].guidPropertySet = DBPROPSET_DBINIT;

  // Obtain the needed interfaces
  XCHECK_HR(hr = pIUnknown->QueryInterface(IID_IDBProperties,
        (void**)&pIDBProperties));
  XCHECK_HR(hr = pIUnknown->QueryInterface(IID_IDBInitialize,
        (void**)&pIDBInitialize));

  // If a provider requires initialization properties, it must support the
  // properties that we are setting (_PROMPT and _HWND). However, some
  // providers do not need initialization properties and may therefore
  // not support the _PROMPT and _HWND properties. Because of this, we will
  // not check the return value from SetProperties
  hr = pIDBProperties->SetProperties(1, rgPropSets);

  // Now that we've set our properties, initialize the provider
  XCHECK_HR(hr = pIDBInitialize->Initialize());

CLEANUP:
  if( pIDBProperties )
    pIDBProperties->Release();
  if( pIDBInitialize )
    pIDBInitialize->Release();
  return hr;
}

HRESULT myGetProperty | ( | IUnknown * | pIUnknown,
 |  | REFIID | riid,
 |  | DBPROPID | dwPropertyID,
 |  | REFGUID | guidPropertySet,
 |  | BOOL * | pbValue
 | ) |  |

Definition at line 198 of file datasource.cpp.

{
  HRESULT         hr;
  DBPROPID        rgPropertyIDs[1];
  DBPROPIDSET       rgPropertyIDSets[1];

  ULONG         cPropSets         = 0;
  DBPROPSET *       rgPropSets          = NULL;

  IDBProperties *     pIDBProperties        = NULL;
  ISessionProperties *  pISesProps          = NULL;
  ICommandProperties *  pICmdProps          = NULL;
  IRowsetInfo *     pIRowsetInfo        = NULL;

  // Initialize the output value
  *pbValue = FALSE;

  // Set up the property ID array
  rgPropertyIDs[0] = dwPropertyID;

  // Set up the Property ID Set
  rgPropertyIDSets[0].rgPropertyIDs = rgPropertyIDs;
  rgPropertyIDSets[0].cPropertyIDs  = 1;
  rgPropertyIDSets[0].guidPropertySet = guidPropertySet;

  // Get the property value for this property from the provider, but
  // don't try to display extended error information, since this may
  // not be a supported property: a failure is, in fact, expected if
  // the property is not supported
  if( riid == IID_IDBProperties )
  {
    XCHECK_HR(hr = pIUnknown->QueryInterface(IID_IDBProperties,
          (void**)&pIDBProperties));
    CHECK_HR(hr = pIDBProperties->GetProperties(
          1,          //cPropertyIDSets
          rgPropertyIDSets, //rgPropertyIDSets
          &cPropSets,     //pcPropSets
          &rgPropSets     //prgPropSets
          ));
  }
  else if( riid == IID_ISessionProperties )
  {
    XCHECK_HR(hr = pIUnknown->QueryInterface(IID_ISessionProperties,
          (void**)&pISesProps));
    CHECK_HR(hr = pISesProps->GetProperties(
          1,          //cPropertyIDSets
          rgPropertyIDSets, //rgPropertyIDSets
          &cPropSets,     //pcPropSets
          &rgPropSets     //prgPropSets
          ));
  }
  else if( riid == IID_ICommandProperties )
  {
    XCHECK_HR(hr = pIUnknown->QueryInterface(IID_ICommandProperties,
          (void**)&pICmdProps));
    CHECK_HR(hr = pICmdProps->GetProperties(
          1,          //cPropertyIDSets
          rgPropertyIDSets, //rgPropertyIDSets
          &cPropSets,     //pcPropSets
          &rgPropSets     //prgPropSets
          ));
  }
  else
  {
    XCHECK_HR(hr = pIUnknown->QueryInterface(IID_IRowsetInfo,
          (void**)&pIRowsetInfo));
    CHECK_HR(hr = pIRowsetInfo->GetProperties(
          1,          //cPropertyIDSets
          rgPropertyIDSets, //rgPropertyIDSets
          &cPropSets,     //pcPropSets
          &rgPropSets     //prgPropSets
          ));
  }

  // Return the value for this property to the caller if
  // it's a VT_BOOL type value, as expected
  if( V_VT(&rgPropSets[0].rgProperties[0].vValue) == VT_BOOL )
    *pbValue = V_BOOL(&rgPropSets[0].rgProperties[0].vValue);

CLEANUP:
  if( rgPropSets )
  {
    CoTaskMemFree(rgPropSets[0].rgProperties);
    CoTaskMemFree(rgPropSets);
  }
  if( pIDBProperties )
    pIDBProperties->Release();
  if( pISesProps )
    pISesProps->Release();
  if( pICmdProps )
    pICmdProps->Release();
  if( pIRowsetInfo )
    pIRowsetInfo->Release();
  return hr;
}

Generated on Wed Nov 13 2024 16:53:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/prsample/enum.cpp File Reference

  • Dataaccess
  • oledb
  • prsample
Functions

enum.cpp File Reference

#include "prsample.h"

Go to the source code of this file.

Functions

HRESULT myCreateEnumerator (REFCLSID clsidEnumerator, CLSID *pCLSID)

Function Documentation

HRESULT myCreateEnumerator | ( | REFCLSID | clsidEnumerator,
 |  | CLSID * | pCLSID
 | ) |  |

Definition at line 30 of file enum.cpp.

{
  HRESULT         hr;
  IUnknown *        pIUnkEnumerator       = NULL;
  ISourcesRowset *    pISourcesRowset       = NULL;
  IRowset *       pIRowset          = NULL;
  IDBInitialize *     pIDBInitialize        = NULL;
  WCHAR         wszProgID[MAX_NAME_LEN + 1] = {0};

  const ULONG       cProperties         = 2;
  DBPROP          rgProperties[cProperties];
  DBPROPSET       rgPropSets[1];

  // Create the Enumerator object. We ask for IUnknown when creating
  // the enumerator because some enumerators may require initialization
  // before we can obtain a sources rowset from the enumerator. This is
  // indicated by whether the enumerator object exposes IDBInitialize
  // or not (we don't want to ask for IDBInitialize, since enumerators
  // that don't require initialization will cause the CoCreateInstance
  // to fail)
  XCHECK_HR(hr = CoCreateInstance(
        clsidEnumerator,      //clsid -- enumerator
        NULL,           //pUnkOuter
        CLSCTX_INPROC_SERVER,   //dwClsContext
        IID_IUnknown,       //riid
        (void**)&pIUnkEnumerator  //ppvObj
        ));

  // If the enumerator exposes IDBInitialize, we need to initialize it
  if( SUCCEEDED(hr = pIUnkEnumerator->QueryInterface(IID_IDBInitialize,
        (void**)&pIDBInitialize)) )
  {
    CHECK_HR(hr = myDoInitialization(pIUnkEnumerator));
  }

  // Set properties on the rowset, to request additional functionality
  myAddRowsetProperties(rgPropSets, cProperties, rgProperties);

  // Obtain a sources rowset from the enumerator. This rowset contains
  // all of the OLE DB providers that this enumerator is able to list
  XCHECK_HR(hr = pIUnkEnumerator->QueryInterface(IID_ISourcesRowset,
        (void**)&pISourcesRowset));
  XCHECK_HR(hr = pISourcesRowset->GetSourcesRowset(
        NULL,         //pUnkOuter
        IID_IRowset,      //riid
        1,            //cPropSets
        rgPropSets,       //rgPropSets
        (IUnknown**)&pIRowset //ppRowset
        ));

  // Display the rowset to the user; this will allow the user to
  // perform basic navigation of the rowset and will allow the user
  // to select a row containing a desired provider.
  CHECK_HR(hr = myDisplayRowset(pIRowset,
        L"SOURCES_NAME", MAX_NAME_LEN, wszProgID));

  // Obtain the ProgID for the provider to use from the user;
  // the default value for this is the value of the SOURCES_NAME
  // column in the row selected by the user previously
  myGetInputFromUser(wszProgID, L"\nType the ProgID of a provider"
        L" to use [Enter = `%s`]: ", wszProgID);
  XCHECK_HR(hr = CLSIDFromProgID(wszProgID, pCLSID));

CLEANUP:
  if( pIUnkEnumerator )
    pIUnkEnumerator->Release();
  if( pISourcesRowset )
    pISourcesRowset->Release();
  if( pIRowset )
    pIRowset->Release();
  if( pIDBInitialize )
    pIDBInitialize->Release();
  return hr;
}

Generated on Wed Nov 13 2024 16:53:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/prsample/error.cpp File Reference

  • Dataaccess
  • oledb
  • prsample
Functions

error.cpp File Reference

#include "prsample.h"

Go to the source code of this file.

Functions

HRESULT | myDisplayErrorInfo (HRESULT hrReturned, IErrorInfo *pIErrorInfo, LPCWSTR pwszFile, ULONG ulLine)
HRESULT | myDisplayErrorRecord (HRESULT hrReturned, ULONG iRecord, IErrorRecords *pIErrorRecords, LPCWSTR pwszFile, ULONG ulLine)
HRESULT | myGetSqlErrorInfo (ULONG iRecord, IErrorRecords *pIErrorRecords, BSTR *pBstr, LONG *plNativeError)
HRESULT | myHandleResult (HRESULT hrReturned, LPCWSTR pwszFile, ULONG ulLine)

Function Documentation

HRESULT myDisplayErrorInfo | ( | HRESULT | hrReturned,
 |  | IErrorInfo * | pIErrorInfo,
 |  | LPCWSTR | pwszFile,
 |  | ULONG | ulLine
 | ) |  |

Definition at line 180 of file error.cpp.

{
  HRESULT         hr;
  BSTR          bstrDescription       = NULL;
  BSTR          bstrSource          = NULL;

  // Get the description of the error
  CHECK_HR(hr = pIErrorInfo->GetDescription(&bstrDescription));

  // Get the source of the error -- this will be the window title
  CHECK_HR(hr = pIErrorInfo->GetSource(&bstrSource));

  // Display this error information
  wprintf(L"\nErrorInfo:  HResult: 0x%08x, Description: %s\nSource: %s\n"
        L"File: %s, Line: %d\n",
        hrReturned,
        bstrDescription,
        bstrSource,
        pwszFile,
        ulLine);

CLEANUP:
  SysFreeString(bstrDescription);
  SysFreeString(bstrSource);
  return hr;
}

HRESULT myDisplayErrorRecord | ( | HRESULT | hrReturned,
 |  | ULONG | iRecord,
 |  | IErrorRecords * | pIErrorRecords,
 |  | LPCWSTR | pwszFile,
 |  | ULONG | ulLine
 | ) |  |

Definition at line 105 of file error.cpp.

{
  HRESULT         hr;
  IErrorInfo *      pIErrorInfo         = NULL;
  BSTR          bstrDescription       = NULL;
  BSTR          bstrSource          = NULL;
  BSTR          bstrSQLInfo         = NULL;

  static LCID       lcid            = GetUserDefaultLCID();

  LONG          lNativeError        = 0;
  ERRORINFO       ErrorInfo;

  // Get the IErrorInfo interface pointer for this error record
  CHECK_HR(hr = pIErrorRecords->GetErrorInfo(iRecord, lcid, &pIErrorInfo));

  // Get the description of this error
  CHECK_HR(hr = pIErrorInfo->GetDescription(&bstrDescription));

  // Get the source of this error
  CHECK_HR(hr = pIErrorInfo->GetSource(&bstrSource));

  // Get the basic error information for this record
  CHECK_HR(hr = pIErrorRecords->GetBasicErrorInfo(iRecord, &ErrorInfo));

  // If the error object supports ISQLErrorInfo, get this information
  myGetSqlErrorInfo(iRecord, pIErrorRecords, &bstrSQLInfo, &lNativeError);

  // Display the error information to the user
  if( bstrSQLInfo )
  {
    wprintf(L"\nErrorRecord:  HResult: 0x%08x\nDescription: %s\n"
      L"SQLErrorInfo: %s\nSource: %s\nFile: %s, Line: %d\n",
      ErrorInfo.hrError,
      bstrDescription,
      bstrSQLInfo,
      bstrSource,
      pwszFile,
      ulLine);
  }
  else
  {
    wprintf(L"\nErrorRecord:  HResult: 0x%08x\nDescription: %s\n"
      L"Source: %s\nFile: %s, Line: %d\n",
      ErrorInfo.hrError,
      bstrDescription,
      bstrSource,
      pwszFile,
      ulLine);
  }

CLEANUP:
  if( pIErrorInfo )
    pIErrorInfo->Release();
  SysFreeString(bstrDescription);
  SysFreeString(bstrSource);
  SysFreeString(bstrSQLInfo);
  return hr;
}

HRESULT myGetSqlErrorInfo | ( | ULONG | iRecord,
 |  | IErrorRecords * | pIErrorRecords,
 |  | BSTR * | pBstr,
 |  | LONG * | plNativeError
 | ) |  |

Definition at line 221 of file error.cpp.

{
  HRESULT         hr;
  ISQLErrorInfo *     pISQLErrorInfo        = NULL;
  LONG          lNativeError        = 0;

  // Attempt to get the ISQLErrorInfo interface for this error
  // record through GetCustomErrorObject. Note that ISQLErrorInfo
  // is not mandatory, so failure is acceptable here
  CHECK_HR(hr = pIErrorRecords->GetCustomErrorObject(
        iRecord,            //iRecord
        IID_ISQLErrorInfo,        //riid
        (IUnknown**)&pISQLErrorInfo   //ppISQLErrorInfo
        ));

  // If we obtained the ISQLErrorInfo interface, get the SQL
  // error string and native error code for this error
  if( pISQLErrorInfo )
    hr = pISQLErrorInfo->GetSQLInfo(pBstr, &lNativeError);

CLEANUP:
  if( plNativeError )
    *plNativeError = lNativeError;
  if( pISQLErrorInfo )
    pISQLErrorInfo->Release();
  return hr;
}

HRESULT myHandleResult | ( | HRESULT | hrReturned,
 |  | LPCWSTR | pwszFile,
 |  | ULONG | ulLine
 | ) |  |

Definition at line 31 of file error.cpp.

{
  HRESULT         hr;
  IErrorInfo *      pIErrorInfo         = NULL;
  IErrorRecords *     pIErrorRecords        = NULL;
  ULONG         cRecords;
  ULONG         iErr;

  // If the method called as part of the XCHECK_HR macro failed,
  // we will attempt to get extended error information for the call
  if( FAILED(hrReturned) )
  {
    // Obtain the current Error object, if any, by using the
    // OLE Automation GetErrorInfo function, which will give
    // us back an IErrorInfo interface pointer if successful
    hr = GetErrorInfo(0, &pIErrorInfo);

    // We've got the IErrorInfo interface pointer on the Error object
    if( SUCCEEDED(hr) && pIErrorInfo )
    {
      // OLE DB extends the OLE Automation error model by allowing
      // Error objects to support the IErrorRecords interface; this
      // interface can expose information on multiple errors.
      hr = pIErrorInfo->QueryInterface(IID_IErrorRecords,
            (void**)&pIErrorRecords);
      if( SUCCEEDED(hr) )
      {
        // Get the count of error records from the object
        CHECK_HR(hr = pIErrorRecords->GetRecordCount(&cRecords));

        // Loop through the set of error records and
        // display the error information for each one
        for( iErr = 0; iErr < cRecords; iErr++ )
        {
          myDisplayErrorRecord(hrReturned, iErr, pIErrorRecords,
            pwszFile, ulLine);
        }
      }
      // The object didn't support IErrorRecords; display
      // the error information for this single error
      else
      {
        myDisplayErrorInfo(hrReturned, pIErrorInfo, pwszFile, ulLine);
      }
    }
    // There was no Error object, so just display the HRESULT to the user
    else
    {
      wprintf(L"\nNo Error Info posted; HResult: 0x%08x\n"
        L"File: %s, Line: %d\n", hrReturned, pwszFile, ulLine);
    }
  }

CLEANUP:
  if( pIErrorInfo )
    pIErrorInfo->Release();
  if( pIErrorRecords )
    pIErrorRecords->Release();
  return hrReturned;
}

Generated on Wed Nov 13 2024 16:53:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/prsample/main.cpp File Reference

  • Dataaccess
  • oledb
  • prsample
Defines | Functions | Variables

main.cpp File Reference

#include "prsample.h"

Go to the source code of this file.

Defines

#define | DBINITCONSTANTS

Functions

int | main ()
void | myDisplayInstructions (void)
CHAR | myGetChar (void)
BOOL | myGetInputFromUser (LPWSTR pwszInput, LPCWSTR pwszFmt,...)
BOOL | myParseCommandLine (void)

Variables

DWORD | g_dwFlags = USE_PROMPTDATASOURCE | DISPLAY_METHODCALLS

Define Documentation

#define DBINITCONSTANTS

Definition at line 16 of file main.cpp.

Function Documentation

int main ( void )

Definition at line 59 of file main.cpp.

{
  HRESULT         hr;
  IUnknown *        pUnkDataSource        = NULL;
  IUnknown *        pUnkSession         = NULL;
  IUnknown *        pUnkRowset          = NULL;

  // Parse command line arguments, if any; this will update
  // the value of g_dwFlags as appropriate for the arguments
  if( !myParseCommandLine() )
    return EXIT_FAILURE;

  // Display instructions for the given command line arguments
  myDisplayInstructions();

  // Initialize OLE
  hr = CoInitialize(NULL);
  if( FAILED(hr) )
    return EXIT_FAILURE;

  // Create the Data Source object using the OLE DB service components
  CHECK_HR(hr = myCreateDataSource(&pUnkDataSource));

  // Create a Session object from the Data Source object
  CHECK_HR(hr = myCreateSession(pUnkDataSource, &pUnkSession));

  // Create a Rowset object from the Session object, either directly
  // from the Session or through a Command object
  CHECK_HR(hr = myCreateRowset(pUnkSession, &pUnkRowset));

  // Display the Rowset object data to the user
  CHECK_HR(hr = myDisplayRowset(pUnkRowset, NULL, 0, NULL));

CLEANUP:
  if( pUnkRowset )
    pUnkRowset->Release();
  if( pUnkSession )
    pUnkSession->Release();
  if( pUnkDataSource )
    pUnkDataSource->Release();

  CoUninitialize();

  if( FAILED(hr) )
    return EXIT_FAILURE;

  return EXIT_SUCCESS;
}

void myDisplayInstructions ( void )

Definition at line 199 of file main.cpp.

{
  CHAR          ch;

  // Display header and ask the user if they want instructions
  printf("\nOLE DB Programmer's Reference Sample\n" \
       "====================================\n\n");
  printf("Display instructions [Y or N]? ");
  do
  {
    ch = myGetChar();
  }
  while( ch != 'y' && ch != 'n' );
  printf("%c\n\n", ch);

  // No instructions, so we're done
  if( ch == 'n' )
    return;

  // Display basic instructions
  printf("This application is a simple OLE DB sample that will display\n" \
       "a rowset and will allow basic navigation of that rowset by\n" \
       "the user. The application will perform the following steps:\n\n");

  // Display DataSource creation instructions
  if( g_dwFlags & USE_PROMPTDATASOURCE )
  {
    printf(" - Creates a DataSource object through the Microsoft Data\n" \
         "   Links UI. This allows the user to select the OLE DB\n" \
         "   provider to use and to set connection properties.\n");
  }
  else
  {
    printf(" - Creates a DataSource object through IDataInitialize::\n" \
         "   CreateDBInstance, which allows the OLE DB service\n" \
         "   component manager to add additional functionality to\n" \
         "   the provider as requested. The user will select the\n" \
         "   provider to use from a rowset obtained from the OLE DB\n" \
         "   enumerator.\n");
  }

  // Display Session creation and table-selection instructions
  printf(" - Creates a Session object from the DataSource object.\n");
  printf(" - If the provider supports the schema rowset interface,\n" \
       "   creates a TABLES schema rowset and allows the user to\n" \
       "   select a table name from this rowset.\n");

  // Display Rowset creation instructions
  if( g_dwFlags & USE_COMMAND )
  {
    printf(" - Creates a Command object from the Session object and\n" \
         "   allows the user to specify command text for this Command,\n" \
         "   then executes the command to create the final rowset.\n");
  }
  else
  {
    printf(" - Creates the final rowset over the table specified by the\n" \
         "   user.\n");
  }

  printf(" - Displays this rowset and allows the user to perform basic\n" \
       "   navigation of that rowset.\n\n");

  // Wait for the user to press a key before continuing
  printf("Press a key to continue...");
  myGetChar();
  printf("\n\n");
}

CHAR myGetChar ( void )

Definition at line 320 of file main.cpp.

{
  CHAR          ch;

  // Get a character from the keyboard
  ch = _getch();

  // Re-read for the actual key value if necessary
  if( !ch || ch == 0xE0 )
    ch = _getch();

  return tolower(ch);
}

BOOL myGetInputFromUser | ( | LPWSTR | pwszInput,
 |  | LPCWSTR | pwszFmt,
 |  |  | ...
 | ) |  |

Definition at line 283 of file main.cpp.

{
  va_list         vargs;
  WCHAR         wszBuffer[MAX_NAME_LEN + 1] = {0};

  // Create the string with variable arguments...
  va_start(vargs, pwszFmt);
  _vsnwprintf(wszBuffer, MAX_NAME_LEN, pwszFmt, vargs);
  va_end(vargs);

  // Output the string...
  wprintf(wszBuffer);

  // Now get the Input from the user...
  _getws(wszBuffer);
  if( wszBuffer[0] )
  {
    wcscpy(pwszInput, wszBuffer);
    return TRUE;
  }

  return FALSE;
}

BOOL myParseCommandLine ( void )

Definition at line 119 of file main.cpp.

{
  int           iArg;
  CHAR *          psz;

  // Set the locale for all C runtime functions
  setlocale(LC_ALL, ".ACP");

  // Go through each command line argument and set the appropriate
  // bits in g_dwFlags, depending on the chosen options
  for( iArg = 1; iArg < __argc; iArg++ )
  {
    // Inspect the current argument string
    psz = __argv[iArg];

    // Valid options begin with '-' or '/'
    if( psz[0] == '-' || psz[0] == '/' )
    {
      // The next character is the option
      switch( tolower(psz[1]) )
      {
      case 'u':
        // Use the service components UI to prompt for and create
        // the DataSource object; the enumerator is not used
        g_dwFlags |= USE_PROMPTDATASOURCE;
        g_dwFlags &= ~USE_ENUMERATOR;
        continue;
      case 'e':
        // Use the enumerator to select the provider, then use
        // IDataInitialize to create the DataSource object;
        // don't use the UI to prompt for the DataSource
        g_dwFlags |= USE_ENUMERATOR;
        g_dwFlags &= ~USE_PROMPTDATASOURCE;
        continue;
      case 'c':
        // Use ICommand instead of IOpenRowset
        g_dwFlags |= USE_COMMAND;
        continue;
      case 'b':
        // Use ISequentialStream to fetch BLOB column data
        g_dwFlags |= USE_ISEQSTREAM;
        continue;
      case 'n':
        // Don't display method call strings as part of
        // the extended error checking macro
        g_dwFlags &= ~DISPLAY_METHODCALLS;
        continue;
      }
    }

    // Invalid argument; show the usage flags to the user
    fprintf(stderr, "Usage: %s [-u] [-e] [-c] [-b] [-n]\n\nWhere:\n\t" \
      "u = Use the Microsoft Data Links UI " \
        "to create the DataSource\n\t" \
      "e = Use the Enumerator and IDataInitialize " \
        "to create the DataSource\n\t" \
      "c = Use ICommand instead of IOpenRowset to create the Rowset\n\t" \
      "b = Use ISequentialStream for BLOB columns\n\t" \
      "n = Don't display method call strings\n",
      __argv[0]);

    return FALSE;
  }

  return TRUE;
}

Variable Documentation

DWORD g_dwFlags = USE_PROMPTDATASOURCE | DISPLAY_METHODCALLS

Definition at line 24 of file main.cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/prsample/prsample.h File Reference

  • Dataaccess
  • oledb
  • prsample
Defines | Enumerations | Functions | Variables

prsample.h File Reference

#include "oledb.h"
#include "oledberr.h"
#include "msdasc.h"
#include "msdaguid.h"
#include "msdasql.h"
#include <stdio.h>
#include <conio.h>
#include <locale.h>

Go to the source code of this file.

Defines

#define | __LONGSTRING(string) L##string
#define | CHECK_HR(hr)
#define | CHECK_MEMORY(hr, pv)
#define | LONGSTRING(string) __LONGSTRING(string)
#define | MAX_COL_SIZE 5000
#define | MAX_DISPLAY_SIZE 20
#define | MAX_NAME_LEN 256
#define | MAX_ROWS 10
#define | MIN_DISPLAY_SIZE 3
#define | ROUNDUP(size) ROUNDUP_(size, ROUNDUP_AMOUNT)
#define | ROUNDUP_(size, amount) (((ULONG)(size)+((amount)-1))&~((amount)-1))
#define | ROUNDUP_AMOUNT 8
#define | XCHECK_HR(hr)

Enumerations

enum {
USE_PROMPTDATASOURCE = 0x0001, USE_ENUMERATOR = 0x0002, USE_COMMAND = 0x0010, USE_ISEQSTREAM = 0x0100,
DISPLAY_METHODCALLS = 0x1000, DISPLAY_INSTRUCTIONS = 0x2000
}

Functions

void | myAddProperty (DBPROP *pProp, DBPROPID dwPropertyID, VARTYPE vtType=VT_BOOL, LONG lValue=VARIANT_TRUE, DBPROPOPTIONS dwOptions=DBPROPOPTIONS_OPTIONAL)
void | myAddRowsetProperties (DBPROPSET *pPropSet, ULONG cProperties, DBPROP *rgProperties)
HRESULT | myCreateAccessor (IUnknown *pUnkRowset, HACCESSOR *phAccessor, ULONG *pcBindings, DBBINDING **prgBindings, ULONG *pcbRowSize)
HRESULT | myCreateCommand (IUnknown *pUnkSession, IUnknown **ppUnkCommand)
HRESULT | myCreateDataSource (IUnknown **ppUnkDataSource)
HRESULT | myCreateEnumerator (REFCLSID clsidEnumerator, CLSID *pCLSID)
HRESULT | myCreateRowset (IUnknown *pUnkSession, IUnknown **ppUnkRowset)
HRESULT | myCreateSchemaRowset (GUID guidSchema, IUnknown *pUnkSession, ULONG cchBuffer, LPWSTR pwszBuffer)
HRESULT | myCreateSession (IUnknown *pUnkDataSource, IUnknown **ppUnkSession)
HRESULT | myDisplayColumnNames (IUnknown *pUnkRowset, ULONG *rgDispSize)
HRESULT | myDisplayErrorInfo (HRESULT hrReturned, IErrorInfo *pIErrorInfo, LPCWSTR pwszFile, ULONG ulLine)
HRESULT | myDisplayErrorRecord (HRESULT hrReturned, ULONG iRecord, IErrorRecords *pIErrorRecords, LPCWSTR pwszFile, ULONG ulLine)
void | myDisplayInstructions ()
HRESULT | myDisplayRow (ULONG iRow, ULONG cBindings, DBBINDING *rgBindings, void *pData, ULONG *rgDispSize)
HRESULT | myDisplayRowset (IUnknown *pUnkRowset, LPCWSTR pwszColToReturn, ULONG cchBuffer, LPWSTR pwszBuffer)
HRESULT | myDoInitialization (IUnknown *pIUnknown)
HRESULT | myExecuteCommand (IUnknown *pUnkCommand, WCHAR *pwszCommandText, ULONG cPropSets, DBPROPSET *rgPropSets, IUnknown **ppUnkRowset)
HRESULT | myFindColumn (IUnknown *pUnkRowset, LPCWSTR pwszName, LONG *plIndex)
void | myFreeBindings (ULONG cBindings, DBBINDING *rgBindings)
CHAR | myGetChar ()
BOOL | myGetInputFromUser (LPWSTR pwszInput, LPCWSTR pwszFmt,...)
HRESULT | myGetProperty (IUnknown *pIUnknown, REFIID riid, DBPROPID dwPropertyID, REFGUID guidPropertySet, BOOL *pbValue)
HRESULT | myGetSqlErrorInfo (ULONG iRecord, IErrorRecords *pIErrorRecords, BSTR *pBstr, LONG *plNativeError)
HRESULT | myHandleResult (HRESULT hrReturned, LPCWSTR pwszFile, ULONG ulLine)
HRESULT | myInteractWithRowset (IRowset *pIRowset, LONG *pcRows, ULONG cRowsObtained, BOOL fCanFetchBackwards, void *pData, ULONG cbRowSize, DBBINDING *pBinding, ULONG cchBuffer, LPWSTR pwszBuffer)
BOOL myParseCommandLine ()
HRESULT | mySetupBindings (IUnknown *pUnkRowset, ULONG *pcBindings, DBBINDING **prgBindings, ULONG *pcbRowSize)
HRESULT | myUpdateDisplaySize (ULONG cBindings, DBBINDING *rgBindings, void *pData, ULONG *rgDispSize)

Variables

DWORD g_dwFlags

Define Documentation

#define __LONGSTRING ( string ) L##string

Definition at line 41 of file prsample.h.

#define CHECK_HR ( hr )
Value:
if(FAILED(hr))        \
    goto CLEANUP

Definition at line 45 of file prsample.h.

#define CHECK_MEMORY | ( | hr,
 |  | pv
 | ) |
Value:
{               \
  if(!pv)           \
  {             \
    hr = E_OUTOFMEMORY;   \
    CHECK_HR(hr);     \
  }             \
}

Definition at line 57 of file prsample.h.

#define LONGSTRING ( string ) __LONGSTRING(string)

Definition at line 42 of file prsample.h.

#define MAX_COL_SIZE 5000

Definition at line 67 of file prsample.h.

#define MAX_DISPLAY_SIZE 20

Definition at line 71 of file prsample.h.

#define MAX_NAME_LEN 256

Definition at line 68 of file prsample.h.

#define MAX_ROWS 10

Definition at line 70 of file prsample.h.

#define MIN_DISPLAY_SIZE 3

Definition at line 72 of file prsample.h.

#define ROUNDUP ( size ) ROUNDUP_(size, ROUNDUP_AMOUNT)

Definition at line 77 of file prsample.h.

#define ROUNDUP_ | ( | size,
 |  | amount |
 | ) |  | (((ULONG)(size)+((amount)-1))&~((amount)-1))

Definition at line 76 of file prsample.h.

#define ROUNDUP_AMOUNT 8

Definition at line 75 of file prsample.h.

#define XCHECK_HR ( hr )
Value:
{                                 \
  if( g_dwFlags & DISPLAY_METHODCALLS )             \
    fwprintf(stderr, LONGSTRING(#hr) L"\n");          \
  if(FAILED(myHandleResult(hr, LONGSTRING(__FILE__), __LINE__)))  \
    goto CLEANUP;                       \
}

Definition at line 50 of file prsample.h.

Enumeration Type Documentation

anonymous enum
Enumerator:
USE_PROMPTDATASOURCE
USE_ENUMERATOR
USE_COMMAND
USE_ISEQSTREAM
DISPLAY_METHODCALLS
DISPLAY_INSTRUCTIONS

Definition at line 79 of file prsample.h.

{
  //Connecting
  USE_PROMPTDATASOURCE    = 0x0001,
  USE_ENUMERATOR        = 0x0002,

  //Rowset
  USE_COMMAND         = 0x0010,

  //Storage Objects
  USE_ISEQSTREAM        = 0x0100,

  // Display options
  DISPLAY_METHODCALLS     = 0x1000,
  DISPLAY_INSTRUCTIONS    = 0x2000,
};

Function Documentation

void myAddProperty | ( | DBPROP * | pProp,
 |  | DBPROPID | dwPropertyID,
 |  | VARTYPE | vtType = VT_BOOL,
 |  | LONG | lValue = VARIANT_TRUE,
 |  | DBPROPOPTIONS | dwOptions = DBPROPOPTIONS_OPTIONAL
 | ) |  |

Definition at line 309 of file datasource.cpp.

{
  // Set up the property structure
  pProp->dwPropertyID   = dwPropertyID;
  pProp->dwOptions    = dwOptions;
  pProp->dwStatus     = DBPROPSTATUS_OK;
  pProp->colid      = DB_NULLID;
  V_VT(&pProp->vValue)  = vtType;

  // Since VARIANT data is a union, we can place the value in any
  // member (except for VT_DECIMAL, which is a union with the whole
  // VARIANT structure -- but we know we're not passing VT_DECIMAL)
  V_I4(&pProp->vValue)  = lValue;
}

void myAddRowsetProperties | ( | DBPROPSET * | pPropSet,
 |  | ULONG | cProperties,
 |  | DBPROP * | rgProperties
 | ) |  |

Definition at line 1007 of file rowset.cpp.

{
  // Initialize the property set array
  pPropSet->rgProperties    = rgProperties;
  pPropSet->cProperties   = cProperties;
  pPropSet->guidPropertySet = DBPROPSET_ROWSET;

  // Add the following two properties (as OPTIONAL) to the property
  // array contained in the property set array in order to request
  // that they be supported by the rowset we will create. Because
  // these are optional, the rowset we obtain may or may not support
  // this functionality. We will check for the functionality that
  // we need once the rowset is created and will modify our behavior
  // appropriately
  myAddProperty(&rgProperties[0], DBPROP_CANFETCHBACKWARDS);
  myAddProperty(&rgProperties[1], DBPROP_IRowsetLocate);
}

HRESULT myCreateAccessor | ( | IUnknown * | pUnkRowset,
 |  | HACCESSOR * | phAccessor,
 |  | ULONG * | pcBindings,
 |  | DBBINDING ** | prgBindings,
 |  | ULONG * | pcbRowSize
 | ) |  |

Definition at line 396 of file rowset.cpp.

{
  HRESULT         hr;
  IAccessor *       pIAccessor          = NULL;

  // An Accessor is basically a handle to a collection of bindings.
  // To create the Accessor, we need to first create an array of
  // bindings for the columns in the Rowset
  CHECK_HR(hr = mySetupBindings(pUnkRowset, pcBindings, prgBindings,
    pcbRowSize));

  // Now that we have an array of bindings, tell the provider to
  // create the Accessor for those bindings. We get back a handle
  // to this Accessor, which we will use when fetching data
  XCHECK_HR(hr = pUnkRowset->QueryInterface(
        IID_IAccessor, (void**)&pIAccessor));
  XCHECK_HR(hr = pIAccessor->CreateAccessor(
        DBACCESSOR_ROWDATA, //dwAccessorFlags
        *pcBindings,    //cBindings
        *prgBindings,   //rgBindings
        0,          //cbRowSize
        phAccessor,     //phAccessor
        NULL        //rgStatus
        ));

CLEANUP:
  if( pIAccessor )
    pIAccessor->Release();
  return hr;
}

HRESULT myCreateCommand | ( | IUnknown * | pUnkSession,
 |  | IUnknown ** | ppUnkCommand
 | ) |  |

Definition at line 30 of file command.cpp.

{
  HRESULT         hr;
  IDBCreateCommand *    pIDBCreateCommand     = NULL;

  // Attempt to create a Command object from the Session object
  XCHECK_HR(hr = pUnkSession->QueryInterface(
        IID_IDBCreateCommand, (void**)&pIDBCreateCommand));
  XCHECK_HR(hr = pIDBCreateCommand->CreateCommand(
        NULL,       //pUnkOuter
        IID_ICommand,   //riid
        ppUnkCommand    //ppCommand
        ));

CLEANUP:
  if( pIDBCreateCommand )
    pIDBCreateCommand->Release();
  return hr;
}

HRESULT myCreateDataSource ( IUnknown ** ppUnkDataSource )

Definition at line 31 of file datasource.cpp.

{
  HRESULT         hr;
  IDataInitialize *   pIDataInitialize      = NULL;
  IDBPromptInitialize * pIDBPromptInitialize    = NULL;
  IDBInitialize *     pIDBInitialize        = NULL;
  CLSID         clsid           = CLSID_MSDASQL;

  // Use the Microsoft Data Links UI to create the DataSource
  // object; this will allow the user to select the provider
  // to connect to and to set the initialization properties
  // for the DataSource object, which will be created by the
  // Data Links UI.
  if( g_dwFlags & USE_PROMPTDATASOURCE )
  {
    // Create the Data Links UI object and obtain the
    // IDBPromptInitialize interface from it
    XCHECK_HR(hr = CoCreateInstance(
          CLSID_DataLinks,        //clsid -- Data Links UI
          NULL,             //pUnkOuter
          CLSCTX_INPROC_SERVER,     //dwClsContext
          IID_IDBPromptInitialize,    //riid
          (void**)&pIDBPromptInitialize //ppvObj
          ));

    // Invoke the Data Links UI to allow the user to select
    // the provider and set initialization properties for
    // the DataSource object that this will create
    XCHECK_HR(hr = pIDBPromptInitialize->PromptDataSource(
          NULL,             //pUnkOuter
          GetDesktopWindow(),       //hWndParent
          DBPROMPTOPTIONS_PROPERTYSHEET,  //dwPromptOptions
          0,                //cSourceTypeFilter
          NULL,             //rgSourceTypeFilter
          NULL,             //pwszszzProviderFilter
          IID_IDBInitialize,        //riid
          (IUnknown**)&pIDBInitialize   //ppDataSource
          ));

    // We've obtained a DataSource object from the Data Links UI. This
    // object has had its initialization properties set, so all we
    // need to do is Initialize it
    XCHECK_HR(hr = pIDBInitialize->Initialize());
  }
  // We are not using the Data Links UI to create the DataSource object.
  // Instead, we will enumerate the providers installed on this system
  // through the OLE DB Enumerator and will allow the user to select
  // the ProgID of the provider for which we will create a DataSource
  // object.
  else
  {
    // Use the OLE DB Enumerator to obtain a rowset of installed providers,
    // then allow the user to select a provider from this rowset
    CHECK_HR(hr = myCreateEnumerator(CLSID_OLEDB_ENUMERATOR, &clsid));

    // We will create the DataSource object through the OLE DB service
    // component IDataInitialize interface, so we need to create an
    // instance of the data initialization object
    XCHECK_HR(hr = CoCreateInstance(
          CLSID_MSDAINITIALIZE,     //clsid -- data initialize
          NULL,             //pUnkOuter
          CLSCTX_INPROC_SERVER,     //dwClsContext
          IID_IDataInitialize,      //riid
          (void**)&pIDataInitialize   //ppvObj
          ));

    // Use IDataInitialize::CreateDBInstance to create an uninitialized
    // DataSource object for the chosen provider. By using this service
    // component method, the service component manager can provide
    // additional functionality beyond what is natively supported by the
    // provider if the consumer requests that functionality
    XCHECK_HR(hr = pIDataInitialize->CreateDBInstance(
          clsid,              //clsid -- provider
          NULL,             //pUnkOuter
          CLSCTX_INPROC_SERVER,     //dwClsContext
          NULL,             //pwszReserved
          IID_IDBInitialize,        //riid
          (IUnknown**)&pIDBInitialize   //ppDataSource
          ));

    // Initialize the DataSource object by setting any required
    // initialization properties and calling IDBInitialize::Initialize
    CHECK_HR(hr = myDoInitialization(pIDBInitialize));
  }

CLEANUP:
  *ppUnkDataSource = pIDBInitialize;
  if( pIDataInitialize )
    pIDataInitialize->Release();
  if( pIDBPromptInitialize )
    pIDBPromptInitialize->Release();
  return hr;
}

HRESULT myCreateEnumerator | ( | REFCLSID | clsidEnumerator,
 |  | CLSID * | pCLSID
 | ) |  |

Definition at line 30 of file enum.cpp.

{
  HRESULT         hr;
  IUnknown *        pIUnkEnumerator       = NULL;
  ISourcesRowset *    pISourcesRowset       = NULL;
  IRowset *       pIRowset          = NULL;
  IDBInitialize *     pIDBInitialize        = NULL;
  WCHAR         wszProgID[MAX_NAME_LEN + 1] = {0};

  const ULONG       cProperties         = 2;
  DBPROP          rgProperties[cProperties];
  DBPROPSET       rgPropSets[1];

  // Create the Enumerator object. We ask for IUnknown when creating
  // the enumerator because some enumerators may require initialization
  // before we can obtain a sources rowset from the enumerator. This is
  // indicated by whether the enumerator object exposes IDBInitialize
  // or not (we don't want to ask for IDBInitialize, since enumerators
  // that don't require initialization will cause the CoCreateInstance
  // to fail)
  XCHECK_HR(hr = CoCreateInstance(
        clsidEnumerator,      //clsid -- enumerator
        NULL,           //pUnkOuter
        CLSCTX_INPROC_SERVER,   //dwClsContext
        IID_IUnknown,       //riid
        (void**)&pIUnkEnumerator  //ppvObj
        ));

  // If the enumerator exposes IDBInitialize, we need to initialize it
  if( SUCCEEDED(hr = pIUnkEnumerator->QueryInterface(IID_IDBInitialize,
        (void**)&pIDBInitialize)) )
  {
    CHECK_HR(hr = myDoInitialization(pIUnkEnumerator));
  }

  // Set properties on the rowset, to request additional functionality
  myAddRowsetProperties(rgPropSets, cProperties, rgProperties);

  // Obtain a sources rowset from the enumerator. This rowset contains
  // all of the OLE DB providers that this enumerator is able to list
  XCHECK_HR(hr = pIUnkEnumerator->QueryInterface(IID_ISourcesRowset,
        (void**)&pISourcesRowset));
  XCHECK_HR(hr = pISourcesRowset->GetSourcesRowset(
        NULL,         //pUnkOuter
        IID_IRowset,      //riid
        1,            //cPropSets
        rgPropSets,       //rgPropSets
        (IUnknown**)&pIRowset //ppRowset
        ));

  // Display the rowset to the user; this will allow the user to
  // perform basic navigation of the rowset and will allow the user
  // to select a row containing a desired provider.
  CHECK_HR(hr = myDisplayRowset(pIRowset,
        L"SOURCES_NAME", MAX_NAME_LEN, wszProgID));

  // Obtain the ProgID for the provider to use from the user;
  // the default value for this is the value of the SOURCES_NAME
  // column in the row selected by the user previously
  myGetInputFromUser(wszProgID, L"\nType the ProgID of a provider"
        L" to use [Enter = `%s`]: ", wszProgID);
  XCHECK_HR(hr = CLSIDFromProgID(wszProgID, pCLSID));

CLEANUP:
  if( pIUnkEnumerator )
    pIUnkEnumerator->Release();
  if( pISourcesRowset )
    pISourcesRowset->Release();
  if( pIRowset )
    pIRowset->Release();
  if( pIDBInitialize )
    pIDBInitialize->Release();
  return hr;
}

HRESULT myCreateRowset | ( | IUnknown * | pUnkSession,
 |  | IUnknown ** | ppUnkRowset
 | ) |  |

Definition at line 39 of file rowset.cpp.

{
  HRESULT         hr;
  IUnknown *        pUnkCommand           = NULL;
  IOpenRowset *     pIOpenRowset          = NULL;
  WCHAR         wszTableName[MAX_NAME_LEN + 1]  = {0};

  const ULONG       cProperties           = 2;
  DBPROP          rgProperties[cProperties];
  DBPROPSET       rgPropSets[1];

  // Obtain a default table name from the user by displaying the
  // tables schema rowset if schema rowsets are supported.
  CHECK_HR(hr = myCreateSchemaRowset(DBSCHEMA_TABLES, pUnkSession,
    MAX_NAME_LEN, wszTableName));

  // Set properties on the rowset, to request additional functionality
  myAddRowsetProperties(rgPropSets, cProperties, rgProperties);

  // If the user requested that the rowset be created from a
  // Command object, create a Command, set its properties and
  // text and execute it to create the Rowset object
  if( g_dwFlags & USE_COMMAND )
  {
    WCHAR   wszCommandText[MAX_NAME_LEN + 1];

    // Attempt to create the Command object from the provider's
    // Session object. Note that Commands are not supported by
    // all providers, and this will fail in that case
    CHECK_HR(hr = myCreateCommand(pUnkSession, &pUnkCommand));

    // Get the command text that we will execute from the user
    if( !myGetInputFromUser(wszCommandText, L"\nType the command "
      L"to execute [Enter = `select * from %s`]: ", wszTableName) )
    {
      swprintf(wszCommandText, L"select * from %s", wszTableName);
    }

    // And execute the Command the user entered
    CHECK_HR(hr = myExecuteCommand(pUnkCommand, wszCommandText,
          1, rgPropSets, ppUnkRowset));
  }
  // Otherwise, the user gets the default behavior, which is to use
  // IOpenRowset to create the Rowset object from the Session object.
  // IOpenRowset is supported by all providers; it takes a TableID
  // and creates a rowset containing all rows in that table. It is
  // similar to using SQL command text of "select * from TableID"
  else
  {
    DBID        TableID;

    // Create the TableID
    TableID.eKind     = DBKIND_NAME;
    TableID.uName.pwszName  = wszTableName;

    // Obtain the table name from the user
    myGetInputFromUser(wszTableName, L"\nType the name of the table "
      L"to use [Enter = `%s`]: ", wszTableName);

    // Get the IOpenRowset interface and create a Rowset object
    // over the requested table through OpenRowset
    XCHECK_HR(hr = pUnkSession->QueryInterface(
          IID_IOpenRowset, (void**)&pIOpenRowset));
    XCHECK_HR(hr = pIOpenRowset->OpenRowset(
          NULL,     //pUnkOuter
          &TableID,   //pTableID
          NULL,     //pIndexID
          IID_IRowset,  //riid
          1,        //cPropSets
          rgPropSets,   //rgPropSets
          ppUnkRowset   //ppRowset
          ));
  }

CLEANUP:
  if( pIOpenRowset )
    pIOpenRowset->Release();
  if( pUnkCommand )
    pUnkCommand->Release();
  return hr;
}

HRESULT myCreateSchemaRowset | ( | GUID | guidSchema,
 |  | IUnknown * | pUnkSession,
 |  | ULONG | cchBuffer,
 |  | LPWSTR | pwszBuffer
 | ) |  |

Definition at line 63 of file session.cpp.

{
  HRESULT         hr              = S_OK;
  IDBSchemaRowset *   pIDBSchemaRowset      = NULL;
  IUnknown *        pUnkRowset          = NULL;

  const ULONG       cProperties         = 2;
  DBPROP          rgProperties[cProperties];
  DBPROPSET       rgPropSets[1];

  // Attempt to obtain the IDBSchemaRowset interface on the Session object.
  // This is not a mandatory interface; if it is not supported, we are done
  CHECK_HR(pUnkSession->QueryInterface(
          IID_IDBSchemaRowset, (void**)&pIDBSchemaRowset));

  // Set properties on the rowset, to request additional functionality
  myAddRowsetProperties(rgPropSets, cProperties, rgProperties);

  // Get the requested schema rowset; if IDBSchemaRowset is supported,
  // the following schema rowsets are required to be supported:
  //  DBSCHEMA_TABLES, DBSCHEMA_COLUMNS, and DBSCHEMA_PROVIDERTYPES
  // We know that we will be asking for one of these, so it is not
  // necessary to call IDBSchemaRowset::GetSchemas in this case
  XCHECK_HR(hr = pIDBSchemaRowset->GetRowset(
        NULL,     //pUnkOuter
        guidSchema,   //guidSchema
        0,        //cRestrictions
        NULL,     //rgRestrictions
        IID_IRowset,  //riid
        1,        //cPropSets
        rgPropSets,   //rgPropSets
        &pUnkRowset   //ppRowset
        ));

  // Display the rowset to the user; this will allow the user to
  // perform basic navigation of the rowset and will allow the user
  // to select a row containing a desired table name (taken from the
  // TABLE_NAME column)
  CHECK_HR(hr = myDisplayRowset(pUnkRowset,
    L"TABLE_NAME", cchBuffer, pwszBuffer));

CLEANUP:
  if( pIDBSchemaRowset )
    pIDBSchemaRowset->Release();
  if( pUnkRowset )
    pUnkRowset->Release();
  return hr;
}

HRESULT myCreateSession | ( | IUnknown * | pUnkDataSource,
 |  | IUnknown ** | ppUnkSession
 | ) |  |

Definition at line 29 of file session.cpp.

{
  HRESULT         hr;
  IDBCreateSession *    pIDBCreateSession   = NULL;

  //Create a Session Object from a Data Source Object
  XCHECK_HR(hr = pUnkDataSource->QueryInterface(
        IID_IDBCreateSession, (void**)&pIDBCreateSession));
  XCHECK_HR(hr = pIDBCreateSession->CreateSession(
        NULL,       //pUnkOuter
        IID_IOpenRowset,  //riid
        ppUnkSession    //ppSession
        ));

CLEANUP:
  if( pIDBCreateSession )
    pIDBCreateSession->Release();
  return hr;
}

HRESULT myDisplayColumnNames | ( | IUnknown * | pUnkRowset,
 |  | ULONG * | rgDispSize
 | ) |  |

Definition at line 760 of file rowset.cpp.

{
  HRESULT         hr;
  IColumnsInfo *      pIColumnsInfo       = NULL;
  ULONG         cColumns;
  DBCOLUMNINFO *      rgColumnInfo        = NULL;
  LPOLESTR        pStringsBuffer        = NULL;
  WCHAR         wszColumn[MAX_DISPLAY_SIZE + 1];
  LPWSTR          pwszColName;
  ULONG         iCol;
  ULONG         cSpaces;
  ULONG         iSpace;

  // Get the IColumnsInfo interface for the Rowset
  XCHECK_HR(hr = pUnkRowset->QueryInterface(
        IID_IColumnsInfo, (void**)&pIColumnsInfo));

  // Get the columns information
  XCHECK_HR(hr = pIColumnsInfo->GetColumnInfo(
        &cColumns,    //pcColumns
        &rgColumnInfo,  //prgColumnInfo
        &pStringsBuffer //ppStringBuffer
        ));

  // Display the title of the row index column
  wprintf(L" Row | ");

  // Display all column names
  for( iCol = 0; iCol < cColumns; iCol++ )
  {
    pwszColName = rgColumnInfo[iCol].pwszName;

    // If the column name is NULL, we'll use a default string
    if( !pwszColName )
    {
      // Is this the bookmark column?
      if( !rgColumnInfo[iCol].iOrdinal )
        pwszColName = L"Bmk";
      else
        pwszColName = L"(null)";
    }

    // Ensure that the name is no longer than MAX_DISPLAY_SIZE
    wcsncpy(wszColumn, pwszColName, MAX_DISPLAY_SIZE);
    wszColumn[min(rgDispSize[iCol], MAX_DISPLAY_SIZE)] = L'\0';

    // Figure out how many spaces we need to print after this column name
    cSpaces = min(rgDispSize[iCol], MAX_DISPLAY_SIZE) - wcslen(wszColumn);

    // Print the column name
    wprintf(L"%s", wszColumn);

    // Now print any spaces necessary to align this column
    for(iSpace = 0; iSpace < cSpaces; iSpace++ )
      putch(' ');

    // Now end the column with a separator marker if necessary
    if( iCol < cColumns - 1 )
      wprintf(L" | ");
  }

  // Done with the header, so print a newline
  wprintf(L"\n");

CLEANUP:
  CoTaskMemFree(rgColumnInfo);
  CoTaskMemFree(pStringsBuffer);
  if( pIColumnsInfo )
    pIColumnsInfo->Release();
  return hr;
}

HRESULT myDisplayErrorInfo | ( | HRESULT | hrReturned,
 |  | IErrorInfo * | pIErrorInfo,
 |  | LPCWSTR | pwszFile,
 |  | ULONG | ulLine
 | ) |  |

Definition at line 213 of file helper.h.

{
   HRESULT        hr;
   BSTR           bstrDescription   = NULL;
   BSTR           bstrSource        = NULL;

   // Get the description of the error
   CHECK_HR(hr = pIErrorInfo->GetDescription(&bstrDescription));

   // Get the source of the error -- this will be the window title
   CHECK_HR(hr = pIErrorInfo->GetSource(&bstrSource));

   // Display this error information
   wprintf(L"\nErrorInfo:  HResult: 0x%08x, Description: %s\nSource: %s\n"
            L"File: %s, Line: %d\n",
            hrReturned,
            bstrDescription,
            bstrSource,
            pwszFile,
            ulLine);

error:
   SysFreeString(bstrDescription);
   SysFreeString(bstrSource);
   return hr;
}

HRESULT myDisplayErrorRecord | ( | HRESULT | hrReturned,
 |  | ULONG | iRecord,
 |  | IErrorRecords * | pIErrorRecords,
 |  | LPCWSTR | pwszFile,
 |  | ULONG | ulLine
 | ) |  |

Definition at line 135 of file helper.h.

{
   HRESULT           hr;
   IErrorInfo *      pIErrorInfo       = NULL;
   BSTR              bstrDescription   = NULL;
   BSTR              bstrSource        = NULL;
   BSTR              bstrSQLInfo       = NULL;

   static LCID       lcid              = GetUserDefaultLCID();

   LONG              lNativeError      = 0;
   ERRORINFO         ErrorInfo;
   WCHAR       szBuff[1024];

   // Get the IErrorInfo interface pointer for this error record
   CHECK_HR(hr = pIErrorRecords->GetErrorInfo(iRecord, lcid, &pIErrorInfo));

   // Get the description of this error
   CHECK_HR(hr = pIErrorInfo->GetDescription(&bstrDescription));

   // Get the source of this error
   CHECK_HR(hr = pIErrorInfo->GetSource(&bstrSource));

   // Get the basic error information for this record
   CHECK_HR(hr = pIErrorRecords->GetBasicErrorInfo(iRecord, &ErrorInfo));

   // If the error object supports ISQLErrorInfo, get this information
   myGetSqlErrorInfo(iRecord, pIErrorRecords, &bstrSQLInfo, &lNativeError);

   // Display the error information to the user
   if( bstrSQLInfo )
   {
      _snwprintf(szBuff, 1024, L"\nErrorRecord:  HResult: 0x%08x\nDescription: %s\n"
         L"SQLErrorInfo: %s\nSource: %s\nFile: %s, Line: %d\n",
         ErrorInfo.hrError,
         bstrDescription,
         bstrSQLInfo,
         bstrSource,
         pwszFile,
         ulLine);
   }
   else
   {
      _snwprintf(szBuff, 1024, L"\nErrorRecord:  HResult: 0x%08x\nDescription: %s\n"
         L"Source: %s\nFile: %s, Line: %d\n",
         ErrorInfo.hrError,
         bstrDescription,
         bstrSource,
         pwszFile,
         ulLine);
   }
   // Display the formatter buffer
  wsprintf(szBuff);

error:
   if( pIErrorInfo )
      pIErrorInfo->Release();
   SysFreeString(bstrDescription);
   SysFreeString(bstrSource);
   SysFreeString(bstrSQLInfo);
   return hr;
}

void myDisplayInstructions ( )

Definition at line 199 of file main.cpp.

{
  CHAR          ch;

  // Display header and ask the user if they want instructions
  printf("\nOLE DB Programmer's Reference Sample\n" \
       "====================================\n\n");
  printf("Display instructions [Y or N]? ");
  do
  {
    ch = myGetChar();
  }
  while( ch != 'y' && ch != 'n' );
  printf("%c\n\n", ch);

  // No instructions, so we're done
  if( ch == 'n' )
    return;

  // Display basic instructions
  printf("This application is a simple OLE DB sample that will display\n" \
       "a rowset and will allow basic navigation of that rowset by\n" \
       "the user. The application will perform the following steps:\n\n");

  // Display DataSource creation instructions
  if( g_dwFlags & USE_PROMPTDATASOURCE )
  {
    printf(" - Creates a DataSource object through the Microsoft Data\n" \
         "   Links UI. This allows the user to select the OLE DB\n" \
         "   provider to use and to set connection properties.\n");
  }
  else
  {
    printf(" - Creates a DataSource object through IDataInitialize::\n" \
         "   CreateDBInstance, which allows the OLE DB service\n" \
         "   component manager to add additional functionality to\n" \
         "   the provider as requested. The user will select the\n" \
         "   provider to use from a rowset obtained from the OLE DB\n" \
         "   enumerator.\n");
  }

  // Display Session creation and table-selection instructions
  printf(" - Creates a Session object from the DataSource object.\n");
  printf(" - If the provider supports the schema rowset interface,\n" \
       "   creates a TABLES schema rowset and allows the user to\n" \
       "   select a table name from this rowset.\n");

  // Display Rowset creation instructions
  if( g_dwFlags & USE_COMMAND )
  {
    printf(" - Creates a Command object from the Session object and\n" \
         "   allows the user to specify command text for this Command,\n" \
         "   then executes the command to create the final rowset.\n");
  }
  else
  {
    printf(" - Creates the final rowset over the table specified by the\n" \
         "   user.\n");
  }

  printf(" - Displays this rowset and allows the user to perform basic\n" \
       "   navigation of that rowset.\n\n");

  // Wait for the user to press a key before continuing
  printf("Press a key to continue...");
  myGetChar();
  printf("\n\n");
}

HRESULT myDisplayRow | ( | ULONG | iRow,
 |  | ULONG | cBindings,
 |  | DBBINDING * | rgBindings,
 |  | void * | pData,
 |  | ULONG * | rgDispSize
 | ) |  |

Definition at line 843 of file rowset.cpp.

{
  HRESULT         hr              = S_OK;
  WCHAR         wszColumn[MAX_DISPLAY_SIZE + 1];
  DBSTATUS        dwStatus;
  ULONG         ulLength;
  void *          pvValue;
  ULONG         iCol;
  ULONG         cbRead;
  ISequentialStream *   pISeqStream         = NULL;
  ULONG         cSpaces;
  ULONG         iSpace;

  // Display the row number
  wprintf(L" [%d] | ", iRow);

  // For each column that we have bound, display the data
  for( iCol = 0; iCol < cBindings; iCol++ )
  {
    // We have bound status, length, and the data value for all
    // columns, so we know that these can all be used
    dwStatus  = *(DBSTATUS *)((BYTE *)pData + rgBindings[iCol].obStatus);
    ulLength  = *(ULONG *)((BYTE *)pData + rgBindings[iCol].obLength);
    pvValue   = (BYTE *)pData + rgBindings[iCol].obValue;

    // Check the status of this column. This decides
    // exactly what will be displayed for the column
    switch( dwStatus )
    {
      // The data is NULL, so don't try to display it
      case DBSTATUS_S_ISNULL:
        wcscpy(wszColumn, L"(null)");
        break;

      // The data was fetched, but may have been truncated.
      // Display string data for this column to the user
      case DBSTATUS_S_TRUNCATED:
      case DBSTATUS_S_OK:
      case DBSTATUS_S_DEFAULT:
      {
        // We have either bound the column as a Unicode string
        // (DBTYPE_WSTR) or as an ISequentialStream object
        // (DBTYPE_IUNKNOWN), and have to do different processing
        // for each one of these possibilities
        switch( rgBindings[iCol].wType )
        {
          case DBTYPE_WSTR:
          {
            // Copy the string data
            wcsncpy(wszColumn, (WCHAR *)pvValue, MAX_DISPLAY_SIZE);
            wszColumn[MAX_DISPLAY_SIZE - 1] = L'\0';
            break;
          }

          case DBTYPE_IUNKNOWN:
          {
            // We've bound this as an ISequentialStream object,
            // therefore the data in our buffer is a pointer
            // to the object's ISequentialStream interface
            pISeqStream =  *(ISequentialStream**)pvValue;

            // We call ISequentialStream::Read to read bytes from
            // the stream blindly into our buffer, simply as a
            // demonstration of ISequentialStream. To display the
            // data properly, the native provider type of this
            // column should be accounted for; it could be
            // DBTYPE_WSTR, in which case this works, or it could
            // be DBTYPE_STR or DBTYPE_BYTES, in which case this
            // won't display the data correctly
            CHECK_HR(hr = pISeqStream->Read(
                  wszColumn,      //pBuffer
                  MAX_DISPLAY_SIZE, //cBytes
                  &cbRead       //pcBytesRead
                  ));

            // Since streams don't provide NULL-termination,
            // we'll NULL-terminate the resulting string ourselves
            wszColumn[cbRead / sizeof(WCHAR)] = L'\0';

            // Release the stream object, now that we're done
            pISeqStream->Release();
            pISeqStream = NULL;
            break;
          }
        }
        break;
      }

      // This is an error status, so don't try to display the data
      default:
        wcscpy(wszColumn, L"(error status)");
        break;
    }

    // Determine how many spaces we need to add after displaying this
    // data to align it with this column in other rows
    cSpaces = min(rgDispSize[iCol], MAX_DISPLAY_SIZE) - wcslen(wszColumn);

    // Print the column data
    wprintf(L"%s", wszColumn);

    // Now print any spaces necessary
    for(iSpace = 0; iSpace < cSpaces; iSpace++ )
      putch(' ');

    // Now end the column with a separator marker if necessary
    if( iCol < cBindings - 1 )
      wprintf(L" | ");
  }

CLEANUP:
  if( pISeqStream )
    pISeqStream->Release();

  // Print the row separator
  wprintf(L"\n");
  return hr;
}

HRESULT myDisplayRowset | ( | IUnknown * | pUnkRowset,
 |  | LPCWSTR | pwszColToReturn,
 |  | ULONG | cchBuffer,
 |  | LPWSTR | pwszBuffer
 | ) |  |

Definition at line 446 of file rowset.cpp.

{
  HRESULT         hr;
  IRowset *       pIRowset          = NULL;
  ULONG         cBindings;
  DBBINDING *       rgBindings          = NULL;
  HACCESSOR       hAccessor         = DB_NULL_HACCESSOR;
  ULONG         cbRowSize;
  void *          pData           = NULL;
  ULONG *         rgDispSize          = NULL;
  ULONG         cRowsObtained;
  HROW *          rghRows           = NULL;
  ULONG         iRow;
  LONG          cRows           = MAX_ROWS;
  LONG          iRetCol           = -1;
  BOOL          fCanFetchBackwards;
  ULONG         iIndex;
  void *          pCurData;

  // Obtain the IRowset interface for use in fetching rows and data
  XCHECK_HR(hr = pUnkRowset->QueryInterface(
        IID_IRowset, (void**)&pIRowset));

  // Determine whether this rowset supports fetching data backwards;
  // we use this to determine whether the rowset can support moving
  // to the previous set of rows, described in more detail below
  myGetProperty(pUnkRowset, IID_IRowset, DBPROP_CANFETCHBACKWARDS,
    DBPROPSET_ROWSET, &fCanFetchBackwards);

  // If the caller wants us to return the data for a particular column
  // from a user-selected row, we need to turn the column name into a
  // column ordinal
  if( pwszColToReturn )
    CHECK_HR(hr = myFindColumn(pUnkRowset, pwszColToReturn, &iRetCol));

  // Create an Accessor. An Accessor is basically a handle to a
  // collection of bindings that describes to the provider how to
  // copy (and convert, if necessary) column data into our buffer.
  // The Accessor that this creates will bind all columns as either
  // DBTYPE_WSTR (a Unicode string) or as an ISequentialStream object
  // (used for BLOB data). This will also give us the size of the
  // row buffer that the Accessor describes to the provider
  CHECK_HR(hr = myCreateAccessor(pUnkRowset, &hAccessor,
                    &cBindings, &rgBindings, &cbRowSize));

  // Allocate enough memory to hold cRows rows of data; this is
  // where the actual row data from the provider will be placed
  pData = CoTaskMemAlloc(cbRowSize * MAX_ROWS);
  CHECK_MEMORY(hr, pData);

  // Allocate memory for an array that we will use to calculate the
  // maximum display size used by each column in the current set of
  // rows
  rgDispSize = (ULONG *)CoTaskMemAlloc(cBindings * sizeof(ULONG));
  CHECK_MEMORY(hr, rgDispSize);

  // In this loop, we perform the following process:
  //  - reset the maximum display size array
  //  - try to get cRows row handles from the provider
  //  - these handles are then used to actually get the row data from the
  //    provider copied into our allocated buffer
  //  - calculate the maximum display size for each column
  //  - release the row handles to the rows we obtained
  //  - display the column names for the rowset
  //  - display the row data for the rows that we fetched
  //  - get user input
  //  - free the provider-allocated row handle array
  //  - repeat unless the user has chosen to quit or has selected a row
  while( hr == S_OK )
  {
    // Clear the maximum display size array
    memset(rgDispSize, 0, cBindings * sizeof(ULONG));

    // Attempt to get cRows row handles from the provider
    XCHECK_HR(hr = pIRowset->GetNextRows(
          DB_NULL_HCHAPTER, //hChapter
          0,          //lOffset
          cRows,        //cRows
          &cRowsObtained,   //pcRowsObtained
          &rghRows      //prghRows
          ));

    // Loop over the row handles obtained from GetNextRows,
    // actually fetching the data for these rows into our buffer
    for( iRow = 0; iRow < cRowsObtained; iRow++ )
    {
      // Find the location in our buffer where we want to place
      // the data for this row. Note that if we fetched rows
      // backwards (cRows < 0), the row handles obtained from the
      // provider are reversed from the order in which we want to
      // actually display the data on the screen, so we will
      // account for this. This ensures that the resulting order
      // of row data in the pData buffer matches the order we
      // wish to use to display the data
      iIndex    = cRows > 0 ? iRow : cRowsObtained - iRow - 1;
      pCurData  = (BYTE*)pData + (cbRowSize * iIndex);

      // Get the data for this row handle. The provider will copy
      // (and convert, if necessary) the data for each of the
      // columns that are described in our Accessor into the given
      // buffer (pCurData)
      XCHECK_HR(hr = pIRowset->GetData(
          rghRows[iRow],  //hRow
          hAccessor,    //hAccessor
          pCurData    //pData
          ));

      // Update the maximum display size array, accounting for this row
      CHECK_HR(hr = myUpdateDisplaySize(cBindings, rgBindings,
        pCurData, rgDispSize));
    }

    // If we obtained rows, release the row handles for the retrieved rows
    // and display the names of the rowset columns before we display the data
    if( cRowsObtained )
    {
      // Release the row handles that we obtained
      XCHECK_HR(hr = pIRowset->ReleaseRows(
            cRowsObtained,  //cRows
            rghRows,    //rghRows
            NULL,     //rgRowOptions
            NULL,     //rgRefCounts
            NULL      //rgRowStatus
            ));

      // Display the names of the rowset columns
      CHECK_HR(hr = myDisplayColumnNames(pIRowset, rgDispSize));
    }

    // For each row that we obtained the data for, display this data
    for( iRow = 0; iRow < cRowsObtained; iRow++ )
    {
      // Get a pointer to the data for this row
      pCurData = (BYTE*)pData + (cbRowSize* iRow);

      // And display the row data
      CHECK_HR(hr = myDisplayRow(iRow, cBindings, rgBindings,
        pCurData, rgDispSize));
    }

    // Allow the user to navigate the rowset. This displays the appropriate
    // prompts, gets the user's input, may call IRowset::RestartPosition,
    // and may copy data from a selected row to the selection buffer, if so
    // directed. This will return S_OK if the user asked for more rows,
    // S_FALSE if the user selected a row, or E_FAIL if the user quits
    hr = myInteractWithRowset(
      pIRowset,         // IRowset pointer, for RestartPosition
      &cRows,           // updated with fetch direction value
      cRowsObtained,        // to indicate selection range
      fCanFetchBackwards,     // whether [P]revious is supported
      pData,            // data pointer for copying selection
      cbRowSize,          // size of rows for copying selection
      iRetCol >= 0 ?        // bindings for the selection column,
        &rgBindings[iRetCol] :  //  or NULL if no selection column
        NULL,
      cchBuffer,          // size of the selection buffer
      pwszBuffer);        // pointer to the selection buffer

    // Since we are allowing the provider to allocate the memory for
    // the row handle array, we will free this memory and reset the
    // pointer to NULL. If this is not NULL on the next call to GetNextRows,
    // the provider will assume that it points to an allocated array of
    // the required size (which may not be the case if we obtained less
    // than cRows rows from this last call to GetNextRows
    CoTaskMemFree(rghRows);
    rghRows = NULL;
  }

CLEANUP:
  myFreeBindings(cBindings, rgBindings);
  CoTaskMemFree(rgDispSize);
  CoTaskMemFree(pData);
  if( pIRowset )
    pIRowset->Release();
  return hr;
}

HRESULT myDoInitialization ( IUnknown * pIUnknown )

Definition at line 138 of file datasource.cpp.

{
  HRESULT         hr;
  IDBInitialize *     pIDBInitialize        = NULL;
  IDBProperties *     pIDBProperties        = NULL;
  HWND          hWnd            = GetDesktopWindow();

  const ULONG       cProperties         = 2;
  DBPROP          rgProperties[cProperties];
  DBPROPSET       rgPropSets[1];

  // In order to initialize the DataSource object most providers require
  // some initialization properties to be set by the consumer. For instance,
  // these might include the data source to connect to and the user ID and
  // password to use to establish identity. We will ask the provider to
  // prompt the user for this required information by setting the following
  // properties:
  myAddProperty(&rgProperties[0],DBPROP_INIT_PROMPT,VT_I2,DBPROMPT_COMPLETE);
  myAddProperty(&rgProperties[1],DBPROP_INIT_HWND,  VT_I4,(LONG)hWnd);

  rgPropSets[0].rgProperties    = rgProperties;
  rgPropSets[0].cProperties   = cProperties;
  rgPropSets[0].guidPropertySet = DBPROPSET_DBINIT;

  // Obtain the needed interfaces
  XCHECK_HR(hr = pIUnknown->QueryInterface(IID_IDBProperties,
        (void**)&pIDBProperties));
  XCHECK_HR(hr = pIUnknown->QueryInterface(IID_IDBInitialize,
        (void**)&pIDBInitialize));

  // If a provider requires initialization properties, it must support the
  // properties that we are setting (_PROMPT and _HWND). However, some
  // providers do not need initialization properties and may therefore
  // not support the _PROMPT and _HWND properties. Because of this, we will
  // not check the return value from SetProperties
  hr = pIDBProperties->SetProperties(1, rgPropSets);

  // Now that we've set our properties, initialize the provider
  XCHECK_HR(hr = pIDBInitialize->Initialize());

CLEANUP:
  if( pIDBProperties )
    pIDBProperties->Release();
  if( pIDBInitialize )
    pIDBInitialize->Release();
  return hr;
}

HRESULT myExecuteCommand | ( | IUnknown * | pUnkCommand,
 |  | WCHAR * | pwszCommandText,
 |  | ULONG | cPropSets,
 |  | DBPROPSET * | rgPropSets,
 |  | IUnknown ** | ppUnkRowset
 | ) |  |

Definition at line 70 of file command.cpp.

{
  HRESULT         hr;
  ICommandText *      pICommandText       = NULL;
  ICommandProperties *  pICommandProperties     = NULL;

  // Set the properties on the Command object
  XCHECK_HR(hr = pUnkCommand->QueryInterface(
        IID_ICommandProperties, (void**)&pICommandProperties));
  XCHECK_HR(hr = pICommandProperties->SetProperties(cPropSets, rgPropSets));

  // Set the text for this Command, using the default command text
  // dialect. All providers that support commands must support this
  // dialect and providers that support SQL must be able to recognize
  // an SQL command as SQL when this dialect is specified
  XCHECK_HR(hr = pUnkCommand->QueryInterface(
        IID_ICommandText, (void**)&pICommandText));
  XCHECK_HR(hr = pICommandText->SetCommandText(
        DBGUID_DEFAULT,   //guidDialect
        pwszCommandText   //pwszCommandText
        ));

  // And execute the Command. Note that the user could have
  // entered a non-row returning command, so we will check for
  // that and return failure to prevent the display of the
  // non-existant rowset by the caller
  XCHECK_HR(hr = pICommandText->Execute(
        NULL,     //pUnkOuter
        IID_IRowset,  //riid
        NULL,     //pParams
        NULL,     //pcRowsAffected
        ppUnkRowset   //ppRowset
        ));

  if( !*ppUnkRowset )
  {
    printf("\nThe command executed successfully, but did not " \
         "return a rowset.\nNo rowset will be displayed.\n");
    hr = E_FAIL;
  }

CLEANUP:
  if( pICommandText )
    pICommandText->Release();
  if( pICommandProperties )
    pICommandProperties->Release();
  return hr;
}

HRESULT myFindColumn | ( | IUnknown * | pUnkRowset,
 |  | LPCWSTR | pwszName,
 |  | LONG * | plIndex
 | ) |  |

Definition at line 1093 of file rowset.cpp.

{
  HRESULT         hr;
  IColumnsInfo *      pIColumnsInfo       = NULL;
  ULONG         cColumns;
  DBCOLUMNINFO *      rgColumnInfo        = NULL;
  OLECHAR *       pStringsBuffer        = NULL;
  ULONG         iCol;

  // Get the IColumnsInfo interface
  XCHECK_HR(hr = pUnkRowset->QueryInterface(
        IID_IColumnsInfo, (void**)&pIColumnsInfo));

  // Get the columns information
  XCHECK_HR(hr = pIColumnsInfo->GetColumnInfo(
        &cColumns,    //pcColumns
        &rgColumnInfo,  //prgColumnInfo
        &pStringsBuffer //ppStringBuffer
        ));

  // Assume that we'll find the column
  hr = S_OK;

  // Search for the column we need
  for( iCol = 0; iCol < cColumns; iCol++ )
  {
    // If the column name matches we've found the column...
    if( rgColumnInfo[iCol].pwszName &&
      !wcscmp(pwszName, rgColumnInfo[iCol].pwszName) )
    {
      *plIndex = iCol;
      goto CLEANUP;
    }
  }

  // If we didn't find the column, we'll return S_FALSE
  hr = S_FALSE;

CLEANUP:
  CoTaskMemFree(rgColumnInfo);
  CoTaskMemFree(pStringsBuffer);
  if( pIColumnsInfo )
    pIColumnsInfo->Release();
  return hr;
}

void myFreeBindings | ( | ULONG | cBindings,
 |  | DBBINDING * | rgBindings
 | ) |  |

Definition at line 978 of file rowset.cpp.

{
  ULONG         iBind;

  // Free any memory used by DBOBJECT structures in the array
  for( iBind = 0; iBind < cBindings; iBind++ )
    CoTaskMemFree(rgBindings[iBind].pObject);

  // Now free the bindings array itself
  CoTaskMemFree(rgBindings);
}

CHAR myGetChar ( )

Definition at line 320 of file main.cpp.

{
  CHAR          ch;

  // Get a character from the keyboard
  ch = _getch();

  // Re-read for the actual key value if necessary
  if( !ch || ch == 0xE0 )
    ch = _getch();

  return tolower(ch);
}

BOOL myGetInputFromUser | ( | LPWSTR | pwszInput,
 |  | LPCWSTR | pwszFmt,
 |  |  | ...
 | ) |  |

Definition at line 283 of file main.cpp.

{
  va_list         vargs;
  WCHAR         wszBuffer[MAX_NAME_LEN + 1] = {0};

  // Create the string with variable arguments...
  va_start(vargs, pwszFmt);
  _vsnwprintf(wszBuffer, MAX_NAME_LEN, pwszFmt, vargs);
  va_end(vargs);

  // Output the string...
  wprintf(wszBuffer);

  // Now get the Input from the user...
  _getws(wszBuffer);
  if( wszBuffer[0] )
  {
    wcscpy(pwszInput, wszBuffer);
    return TRUE;
  }

  return FALSE;
}

HRESULT myGetProperty | ( | IUnknown * | pIUnknown,
 |  | REFIID | riid,
 |  | DBPROPID | dwPropertyID,
 |  | REFGUID | guidPropertySet,
 |  | BOOL * | pbValue
 | ) |  |

Definition at line 198 of file datasource.cpp.

{
  HRESULT         hr;
  DBPROPID        rgPropertyIDs[1];
  DBPROPIDSET       rgPropertyIDSets[1];

  ULONG         cPropSets         = 0;
  DBPROPSET *       rgPropSets          = NULL;

  IDBProperties *     pIDBProperties        = NULL;
  ISessionProperties *  pISesProps          = NULL;
  ICommandProperties *  pICmdProps          = NULL;
  IRowsetInfo *     pIRowsetInfo        = NULL;

  // Initialize the output value
  *pbValue = FALSE;

  // Set up the property ID array
  rgPropertyIDs[0] = dwPropertyID;

  // Set up the Property ID Set
  rgPropertyIDSets[0].rgPropertyIDs = rgPropertyIDs;
  rgPropertyIDSets[0].cPropertyIDs  = 1;
  rgPropertyIDSets[0].guidPropertySet = guidPropertySet;

  // Get the property value for this property from the provider, but
  // don't try to display extended error information, since this may
  // not be a supported property: a failure is, in fact, expected if
  // the property is not supported
  if( riid == IID_IDBProperties )
  {
    XCHECK_HR(hr = pIUnknown->QueryInterface(IID_IDBProperties,
          (void**)&pIDBProperties));
    CHECK_HR(hr = pIDBProperties->GetProperties(
          1,          //cPropertyIDSets
          rgPropertyIDSets, //rgPropertyIDSets
          &cPropSets,     //pcPropSets
          &rgPropSets     //prgPropSets
          ));
  }
  else if( riid == IID_ISessionProperties )
  {
    XCHECK_HR(hr = pIUnknown->QueryInterface(IID_ISessionProperties,
          (void**)&pISesProps));
    CHECK_HR(hr = pISesProps->GetProperties(
          1,          //cPropertyIDSets
          rgPropertyIDSets, //rgPropertyIDSets
          &cPropSets,     //pcPropSets
          &rgPropSets     //prgPropSets
          ));
  }
  else if( riid == IID_ICommandProperties )
  {
    XCHECK_HR(hr = pIUnknown->QueryInterface(IID_ICommandProperties,
          (void**)&pICmdProps));
    CHECK_HR(hr = pICmdProps->GetProperties(
          1,          //cPropertyIDSets
          rgPropertyIDSets, //rgPropertyIDSets
          &cPropSets,     //pcPropSets
          &rgPropSets     //prgPropSets
          ));
  }
  else
  {
    XCHECK_HR(hr = pIUnknown->QueryInterface(IID_IRowsetInfo,
          (void**)&pIRowsetInfo));
    CHECK_HR(hr = pIRowsetInfo->GetProperties(
          1,          //cPropertyIDSets
          rgPropertyIDSets, //rgPropertyIDSets
          &cPropSets,     //pcPropSets
          &rgPropSets     //prgPropSets
          ));
  }

  // Return the value for this property to the caller if
  // it's a VT_BOOL type value, as expected
  if( V_VT(&rgPropSets[0].rgProperties[0].vValue) == VT_BOOL )
    *pbValue = V_BOOL(&rgPropSets[0].rgProperties[0].vValue);

CLEANUP:
  if( rgPropSets )
  {
    CoTaskMemFree(rgPropSets[0].rgProperties);
    CoTaskMemFree(rgPropSets);
  }
  if( pIDBProperties )
    pIDBProperties->Release();
  if( pISesProps )
    pISesProps->Release();
  if( pICmdProps )
    pICmdProps->Release();
  if( pIRowsetInfo )
    pIRowsetInfo->Release();
  return hr;
}

HRESULT myGetSqlErrorInfo | ( | ULONG | iRecord,
 |  | IErrorRecords * | pIErrorRecords,
 |  | BSTR * | pBstr,
 |  | LONG * | plNativeError
 | ) |  |

Definition at line 254 of file helper.h.

{
   HRESULT           hr;
   ISQLErrorInfo *   pISQLErrorInfo   = NULL;
   LONG              lNativeError     = 0;

   // Attempt to get the ISQLErrorInfo interface for this error
   // record through GetCustomErrorObject. Note that ISQLErrorInfo
   // is not mandatory, so failure is acceptable here.
   CHECK_HR(hr = pIErrorRecords->GetCustomErrorObject(
            iRecord,                               // iRecord
            IID_ISQLErrorInfo,                     // riid
            (IUnknown**)&pISQLErrorInfo            // ppISQLErrorInfo
            ));

   // If we obtained the ISQLErrorInfo interface, get the SQL
   // error string and native error code for this error
   if( pISQLErrorInfo )
      hr = pISQLErrorInfo->GetSQLInfo(pBstr, &lNativeError);

error:
   if( plNativeError )
      *plNativeError = lNativeError;
   if( pISQLErrorInfo )
      pISQLErrorInfo->Release();
   return hr;
}

HRESULT myHandleResult | ( | HRESULT | hrReturned,
 |  | LPCWSTR | pwszFile,
 |  | ULONG | ulLine
 | ) |  |

Definition at line 60 of file helper.h.

{
   HRESULT           hr;
   IErrorInfo *      pIErrorInfo      = NULL;
   IErrorRecords *   pIErrorRecords   = NULL;
   ULONG             cRecords;
   ULONG             iErr;

   // If the method called as part of the XCHECK_HR macro failed,
   // we will attempt to get extended error information for the call
   if( FAILED(hrReturned) )
   {
      // Obtain the current error object, if any, by using the
      // Automation GetErrorInfo function, which will give
      // us back an IErrorInfo interface pointer if successful
      hr = GetErrorInfo(0, &pIErrorInfo);

      // We've got the IErrorInfo interface pointer on the error object
      if( SUCCEEDED(hr) && pIErrorInfo )
      {
         // OLE DB extends the Automation error model by allowing
         // error objects to support the IErrorRecords interface. This
         // interface can expose information on multiple errors.
         hr = pIErrorInfo->QueryInterface(IID_IErrorRecords,
                  (void**)&pIErrorRecords);
         if( SUCCEEDED(hr) )
         {
            // Get the count of error records from the object
            CHECK_HR(hr = pIErrorRecords->GetRecordCount(&cRecords));

            // Loop through the set of error records, and
            // display the error information for each one
            for( iErr = 0; iErr < cRecords; iErr++ )
            {
               myDisplayErrorRecord(hrReturned, iErr, pIErrorRecords,
                  pwszFile, ulLine);
            }
         }
         // The object didn't support IErrorRecords; display
         // the error information for this single error
         else
         {
            myDisplayErrorInfo(hrReturned, pIErrorInfo, pwszFile, ulLine);
         }
      }
      // There was no error object, so just display the HRESULT
      // to the user
      else
      {
         wprintf(L"\nNo Error Info posted; HResult: 0x%08x\n"
            L"File: %s, Line: %d\n", hrReturned, pwszFile, ulLine);
      }
   }

error:
   if( pIErrorInfo )
      pIErrorInfo->Release();
   if( pIErrorRecords )
      pIErrorRecords->Release();
   return hrReturned;
}

HRESULT myInteractWithRowset | ( | IRowset * | pIRowset,
 |  | LONG * | pcRows,
 |  | ULONG | cRowsObtained,
 |  | BOOL | fCanFetchBackwards,
 |  | void * | pData,
 |  | ULONG | cbRowSize,
 |  | DBBINDING * | pBinding,
 |  | ULONG | cchBuffer,
 |  | LPWSTR | pwszBuffer
 | ) |  |

Definition at line 642 of file rowset.cpp.

{
  HRESULT         hr              = S_OK;
  CHAR          ch;

  // Let the user know if no rows were fetched
  if( !cRowsObtained )
    printf("\n*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\n" \
         "*                                 *\n" \
         "* No rows obtained on this fetch! *\n" \
         "*                                 *\n" \
         "*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\n");

  // Print navigation options
  if( fCanFetchBackwards )
    printf("\n[P]revious; [N]ext; [R]estart; ");
  else
    printf("\n[N]ext; [R]estart; ");

  // Print selection options
  if( cRowsObtained && pwszBuffer && pBinding )
    printf("[0]-[%d] for a row; ", cRowsObtained - 1);

  // User can always quit the program
  printf("[Q]uit? ");

  // Get the user's input
  while( TRUE )
  {
    // Get a character from the console
    ch = myGetChar();

    // Look for one of the allowed options; if not found, go
    // back around and wait for another input from the user

    // If we're looking for a row selection, allow the user to select
    // a row that we fetched, then copy the data from the requested
    // column into the selection buffer we were passed
    if( pwszBuffer && pBinding &&
      ch >= '0' && ch < (int)('0' + cRowsObtained) )
    {
      // Save the data for the selected row
      ULONG nSelection = ch - '0';
      _snwprintf(pwszBuffer, cchBuffer, L"%s",
          (WCHAR *)((BYTE *)pData + cbRowSize * nSelection +
          pBinding->obValue));
      pwszBuffer[cchBuffer] = L'\0';
      hr = S_FALSE;
    }
    // If the provider supports fetching backwards, set *pcRows
    // to -MAX_ROWS. When GetNextRows is called with this value,
    // it will fetch rows backwards from the current position
    // until it fetches MAX_ROWS rows or hits the end of the rowset
    else if( fCanFetchBackwards && ch == 'p' )
    {
      // Fetch backwards
      *pcRows = -MAX_ROWS;
    }
    // Set *pcRows so that the next call to GetNextRows fetches
    // MAX_ROWS rows forward from the current position
    else if( ch == 'n' )
    {
      // Fetch forward
      *pcRows = MAX_ROWS;
    }
    // Call IRowset::RestartPosition and fetch the first MAX_ROWS
    // rows of the rowset forward from there
    else if( ch == 'r' )
    {
      // RestartPosition
      *pcRows = MAX_ROWS;
      XCHECK_HR(hr = pIRowset->RestartPosition(DB_NULL_HCHAPTER));

      // Restarting a command may return the DB_S_COMMANDREEXECUTED
      // warning. If this happens, we still want the caller to
      // continue to display data, so we will reset the result code
      // to S_OK
      hr = S_OK;
    }
    // Quit the program
    else if( ch == 'q' )
    {
      hr = E_FAIL;
    }
    // Invalid option; go back up and get another character from the user
    else
    {
      continue;
    }

    // Echo the character and stop waiting for input
    printf("%c\n", ch);
    break;
  }

CLEANUP:
  return hr;
}

BOOL myParseCommandLine ( )

Definition at line 119 of file main.cpp.

{
  int           iArg;
  CHAR *          psz;

  // Set the locale for all C runtime functions
  setlocale(LC_ALL, ".ACP");

  // Go through each command line argument and set the appropriate
  // bits in g_dwFlags, depending on the chosen options
  for( iArg = 1; iArg < __argc; iArg++ )
  {
    // Inspect the current argument string
    psz = __argv[iArg];

    // Valid options begin with '-' or '/'
    if( psz[0] == '-' || psz[0] == '/' )
    {
      // The next character is the option
      switch( tolower(psz[1]) )
      {
      case 'u':
        // Use the service components UI to prompt for and create
        // the DataSource object; the enumerator is not used
        g_dwFlags |= USE_PROMPTDATASOURCE;
        g_dwFlags &= ~USE_ENUMERATOR;
        continue;
      case 'e':
        // Use the enumerator to select the provider, then use
        // IDataInitialize to create the DataSource object;
        // don't use the UI to prompt for the DataSource
        g_dwFlags |= USE_ENUMERATOR;
        g_dwFlags &= ~USE_PROMPTDATASOURCE;
        continue;
      case 'c':
        // Use ICommand instead of IOpenRowset
        g_dwFlags |= USE_COMMAND;
        continue;
      case 'b':
        // Use ISequentialStream to fetch BLOB column data
        g_dwFlags |= USE_ISEQSTREAM;
        continue;
      case 'n':
        // Don't display method call strings as part of
        // the extended error checking macro
        g_dwFlags &= ~DISPLAY_METHODCALLS;
        continue;
      }
    }

    // Invalid argument; show the usage flags to the user
    fprintf(stderr, "Usage: %s [-u] [-e] [-c] [-b] [-n]\n\nWhere:\n\t" \
      "u = Use the Microsoft Data Links UI " \
        "to create the DataSource\n\t" \
      "e = Use the Enumerator and IDataInitialize " \
        "to create the DataSource\n\t" \
      "c = Use ICommand instead of IOpenRowset to create the Rowset\n\t" \
      "b = Use ISequentialStream for BLOB columns\n\t" \
      "n = Don't display method call strings\n",
      __argv[0]);

    return FALSE;
  }

  return TRUE;
}

HRESULT mySetupBindings | ( | IUnknown * | pUnkRowset,
 |  | ULONG * | pcBindings,
 |  | DBBINDING ** | prgBindings,
 |  | ULONG * | pcbRowSize
 | ) |  |

Definition at line 151 of file rowset.cpp.

{
  HRESULT         hr;
  ULONG         cColumns;
  DBCOLUMNINFO *      rgColumnInfo        = NULL;
  LPWSTR          pStringBuffer       = NULL;
  IColumnsInfo *      pIColumnsInfo       = NULL;

  ULONG         iCol;
  ULONG         dwOffset          = 0;
  DBBINDING *       rgBindings          = NULL;

  ULONG         cStorageObjs        = 0;
  BOOL          fMultipleObjs       = FALSE;

  // Obtain the column information for the Rowset; from this, we can find
  // out the following information that we need to construct the bindings
  // array:
  //  - the number of columns
  //  - the ordinal of each column
  //  - the precision and scale of numeric columns
  //  - the OLE DB data type of the column
  XCHECK_HR(hr = pUnkRowset->QueryInterface(
        IID_IColumnsInfo, (void**)&pIColumnsInfo));
  XCHECK_HR(hr = pIColumnsInfo->GetColumnInfo(
        &cColumns,    //pcColumns
        &rgColumnInfo,  //prgColumnInfo
        &pStringBuffer  //ppStringBuffer
        ));

  // Allocate memory for the bindings array; there is a one-to-one
  // mapping between the columns returned from GetColumnInfo and our
  // bindings
  rgBindings = (DBBINDING*)CoTaskMemAlloc(cColumns * sizeof(DBBINDING));
  CHECK_MEMORY(hr, rgBindings);
  memset(rgBindings, 0, cColumns * sizeof(DBBINDING));

  // Determine if the Rowset supports multiple storage object bindings;
  // if it does not, we will only bind the first BLOB column or IUnknown
  // column as an ISequentialStream object, and will bind the rest as
  // DBTYPE_WSTR
  myGetProperty(pUnkRowset, IID_IRowset, DBPROP_MULTIPLESTORAGEOBJECTS,
    DBPROPSET_ROWSET, &fMultipleObjs);

  // Construct the binding array element for each column
  for( iCol = 0; iCol < cColumns; iCol++ )
  {
    // This binding applies to the ordinal of this column
    rgBindings[iCol].iOrdinal = rgColumnInfo[iCol].iOrdinal;

    // We are asking the provider to give us the data for this column
    // (DBPART_VALUE), the length of that data (DBPART_LENGTH), and
    // the status of the column (DBPART_STATUS)
    rgBindings[iCol].dwPart   = DBPART_VALUE|DBPART_LENGTH|DBPART_STATUS;

    // The following values are the offsets to the status, length, and
    // data value that the provider will fill with the appropriate values
    // when we fetch data later. When we fetch data, we will pass a
    // pointer to a buffer that the provider will copy column data to,
    // in accordance with the binding we have provided for that column;
    // these are offsets into that future buffer
    rgBindings[iCol].obStatus = dwOffset;
    rgBindings[iCol].obLength = dwOffset + sizeof(DBSTATUS);
    rgBindings[iCol].obValue  = dwOffset + sizeof(DBSTATUS) + sizeof(ULONG);

    // Any memory allocated for the data value will be owned by us, the
    // client. Note that no data will be allocated in this case, as the
    // DBTYPE_WSTR bindings we are using will tell the provider to simply
    // copy data directly into our provided buffer
    rgBindings[iCol].dwMemOwner = DBMEMOWNER_CLIENTOWNED;

    // This is not a parameter binding
    rgBindings[iCol].eParamIO = DBPARAMIO_NOTPARAM;

    // We want to use the precision and scale of the column
    rgBindings[iCol].bPrecision = rgColumnInfo[iCol].bPrecision;
    rgBindings[iCol].bScale   = rgColumnInfo[iCol].bScale;

    // Bind this column as DBTYPE_WSTR, which tells the provider to
    // copy a Unicode string representation of the data into our buffer,
    // converting from the native type if necessary
    rgBindings[iCol].wType    = DBTYPE_WSTR;

    // Initially, we set the length for this data in our buffer to 0;
    // the correct value for this will be calculated directly below
    rgBindings[iCol].cbMaxLen = 0;

    // Determine the maximum number of bytes required in our buffer to
    // contain the Unicode string representation of the provider's native
    // data type, including room for the NULL-termination character
    switch( rgColumnInfo[iCol].wType )
    {
      case DBTYPE_NULL:
      case DBTYPE_EMPTY:
      case DBTYPE_I1:
      case DBTYPE_I2:
      case DBTYPE_I4:
      case DBTYPE_UI1:
      case DBTYPE_UI2:
      case DBTYPE_UI4:
      case DBTYPE_R4:
      case DBTYPE_BOOL:
      case DBTYPE_I8:
      case DBTYPE_UI8:
      case DBTYPE_R8:
      case DBTYPE_CY:
      case DBTYPE_ERROR:
        // When the above types are converted to a string, they
        // will all fit into 25 characters, so use that plus space
        // for the NULL-terminator
        rgBindings[iCol].cbMaxLen = (25 + 1) * sizeof(WCHAR);
        break;

      case DBTYPE_DECIMAL:
      case DBTYPE_NUMERIC:
      case DBTYPE_DATE:
      case DBTYPE_DBDATE:
      case DBTYPE_DBTIMESTAMP:
      case DBTYPE_GUID:
        // Converted to a string, the above types will all fit into
        // 50 characters, so use that plus space for the terminator
        rgBindings[iCol].cbMaxLen = (50 + 1) * sizeof(WCHAR);
        break;

      case DBTYPE_BYTES:
        // In converting DBTYPE_BYTES to a string, each byte
        // becomes two characters (e.g. 0xFF -> "FF"), so we
        // will use double the maximum size of the column plus
        // include space for the NULL-terminator
        rgBindings[iCol].cbMaxLen =
          (rgColumnInfo[iCol].ulColumnSize * 2 + 1) * sizeof(WCHAR);
        break;

      case DBTYPE_STR:
      case DBTYPE_WSTR:
      case DBTYPE_BSTR:
        // Going from a string to our string representation,
        // we can just take the maximum size of the column,
        // a count of characters, and include space for the
        // terminator, which is not included in the column size
        rgBindings[iCol].cbMaxLen =
          (rgColumnInfo[iCol].ulColumnSize + 1) * sizeof(WCHAR);
        break;

      default:
        // For any other type, we will simply use our maximum
        // column buffer size, since the display size of these
        // columns may be variable (e.g. DBTYPE_VARIANT) or
        // unknown (e.g. provider-specific types)
        rgBindings[iCol].cbMaxLen = MAX_COL_SIZE;
        break;
    };

    // If the provider's native data type for this column is
    // DBTYPE_IUNKNOWN or this is a BLOB column and the user
    // has requested that we bind BLOB columns as ISequentialStream
    // objects, bind this column as an ISequentialStream object if
    // the provider supports our creating another ISequentialStream
    // binding
    if( (rgColumnInfo[iCol].wType == DBTYPE_IUNKNOWN ||
       ((rgColumnInfo[iCol].dwFlags & DBCOLUMNFLAGS_ISLONG) &&
        (g_dwFlags & USE_ISEQSTREAM))) &&
      (fMultipleObjs || !cStorageObjs) )
    {
      // To create an ISequentialStream object, we will
      // bind this column as DBTYPE_IUNKNOWN to indicate
      // that we are requesting this column as an object
      rgBindings[iCol].wType        = DBTYPE_IUNKNOWN;

      // We want to allocate enough space in our buffer for
      // the ISequentialStream pointer we will obtain from
      // the provider
      rgBindings[iCol].cbMaxLen     = sizeof(ISequentialStream *);

      // To specify the type of object that we want from the
      // provider, we need to create a DBOBJECT structure and
      // place it in our binding for this column
        rgBindings[iCol].pObject      =
                (DBOBJECT *)CoTaskMemAlloc(sizeof(DBOBJECT));
      CHECK_MEMORY(hr, rgBindings[iCol].pObject);

      // Direct the provider to create an ISequentialStream
      // object over the data for this column
      rgBindings[iCol].pObject->iid   = IID_ISequentialStream;

      // We want read access on the ISequentialStream
      // object that the provider will create for us
      rgBindings[iCol].pObject->dwFlags = STGM_READ;

      // Keep track of the number of storage objects (ISequentialStream
      // is a storage interface) that we have requested, so that we
      // can avoid requesting multiple storage objects from a provider
      // that only supports a single storage object in our bindings
      cStorageObjs++;
    }

    // Ensure that the bound maximum length is no more than the
    // maximum column size in bytes that we've defined
    rgBindings[iCol].cbMaxLen
      = min(rgBindings[iCol].cbMaxLen, MAX_COL_SIZE);

    // Update the offset past the end of this column's data, so
    // that the next column will begin in the correct place in
    // the buffer
    dwOffset = rgBindings[iCol].cbMaxLen + rgBindings[iCol].obValue;

    // Ensure that the data for the next column will be correctly
    // aligned for all platforms, or, if we're done with columns,
    // that if we allocate space for multiple rows that the data
    // for every row is correctly aligned
    dwOffset = ROUNDUP(dwOffset);
  }

  // Return the row size (the current dwOffset is the size of the row),
  // the count of bindings, and the bindings array to the caller
  *pcbRowSize   = dwOffset;
  *pcBindings   = cColumns;
  *prgBindings  = rgBindings;

CLEANUP:
  CoTaskMemFree(rgColumnInfo);
  CoTaskMemFree(pStringBuffer);
  if( pIColumnsInfo )
    pIColumnsInfo->Release();
  return hr;
}

HRESULT myUpdateDisplaySize | ( | ULONG | cBindings,
 |  | DBBINDING * | rgBindings,
 |  | void * | pData,
 |  | ULONG * | rgDispSize
 | ) |  |

Definition at line 1035 of file rowset.cpp.

{
  DBSTATUS        dwStatus;
  ULONG         cchLength;
  ULONG         iCol;

  // Loop through the bindings, comparing the size of each column
  // against the previously found maximum size for that column
  for( iCol = 0; iCol < cBindings; iCol++ )
  {
    dwStatus  = *(DBSTATUS *)((BYTE *)pData + rgBindings[iCol].obStatus);
    cchLength = ((*(ULONG *)((BYTE *)pData + rgBindings[iCol].obLength))
          / sizeof(WCHAR));

    // The length that we need to display depends on the status
    // of this column and generally on the data in the column
    switch( dwStatus )
    {
      case DBSTATUS_S_ISNULL:
        cchLength = 6;            // "(null)"
        break;

      case DBSTATUS_S_TRUNCATED:
      case DBSTATUS_S_OK:
      case DBSTATUS_S_DEFAULT:
        if( rgBindings[iCol].wType == DBTYPE_IUNKNOWN )
          cchLength = 2 + 8;        // "0x%08lx"

        // Ensure that the length is at least the minimum display size
        cchLength = max(cchLength, MIN_DISPLAY_SIZE);
        break;

      default:
        cchLength = 14;           // "(error status)"
        break;
    }

    if( rgDispSize[iCol] < cchLength )
      rgDispSize[iCol] = cchLength;
  }

  return S_OK;
}

Variable Documentation

DWORD g_dwFlags

Definition at line 24 of file main.cpp.

Generated on Wed Nov 13 2024 16:53:28 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/prsample/resource.h File Reference

  • Dataaccess
  • oledb
  • prsample

resource.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:52:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/prsample/rowset.cpp File Reference

  • Dataaccess
  • oledb
  • prsample
Functions

rowset.cpp File Reference

#include "prsample.h"

Go to the source code of this file.

Functions

void | myAddRowsetProperties (DBPROPSET *pPropSet, ULONG cProperties, DBPROP *rgProperties)
HRESULT | myCreateAccessor (IUnknown *pUnkRowset, HACCESSOR *phAccessor, ULONG *pcBindings, DBBINDING **prgBindings, ULONG *pcbRowSize)
HRESULT | myCreateRowset (IUnknown *pUnkSession, IUnknown **ppUnkRowset)
HRESULT | myDisplayColumnNames (IUnknown *pUnkRowset, ULONG *rgDispSize)
HRESULT | myDisplayRow (ULONG iRow, ULONG cBindings, DBBINDING *rgBindings, void *pData, ULONG *rgDispSize)
HRESULT | myDisplayRowset (IUnknown *pUnkRowset, LPCWSTR pwszColToReturn, ULONG cchBuffer, LPWSTR pwszBuffer)
HRESULT | myFindColumn (IUnknown *pUnkRowset, LPCWSTR pwszName, LONG *plIndex)
void | myFreeBindings (ULONG cBindings, DBBINDING *rgBindings)
HRESULT | myInteractWithRowset (IRowset *pIRowset, LONG *pcRows, ULONG cRowsObtained, BOOL fCanFetchBackwards, void *pData, ULONG cbRowSize, DBBINDING *pBinding, ULONG cchBuffer, LPWSTR pwszBuffer)
HRESULT | mySetupBindings (IUnknown *pUnkRowset, ULONG *pcBindings, DBBINDING **prgBindings, ULONG *pcbRowSize)
HRESULT | myUpdateDisplaySize (ULONG cBindings, DBBINDING *rgBindings, void *pData, ULONG *rgDispSize)

Function Documentation

void myAddRowsetProperties | ( | DBPROPSET * | pPropSet,
 |  | ULONG | cProperties,
 |  | DBPROP * | rgProperties
 | ) |  |

Definition at line 1007 of file rowset.cpp.

{
  // Initialize the property set array
  pPropSet->rgProperties    = rgProperties;
  pPropSet->cProperties   = cProperties;
  pPropSet->guidPropertySet = DBPROPSET_ROWSET;

  // Add the following two properties (as OPTIONAL) to the property
  // array contained in the property set array in order to request
  // that they be supported by the rowset we will create. Because
  // these are optional, the rowset we obtain may or may not support
  // this functionality. We will check for the functionality that
  // we need once the rowset is created and will modify our behavior
  // appropriately
  myAddProperty(&rgProperties[0], DBPROP_CANFETCHBACKWARDS);
  myAddProperty(&rgProperties[1], DBPROP_IRowsetLocate);
}

HRESULT myCreateAccessor | ( | IUnknown * | pUnkRowset,
 |  | HACCESSOR * | phAccessor,
 |  | ULONG * | pcBindings,
 |  | DBBINDING ** | prgBindings,
 |  | ULONG * | pcbRowSize
 | ) |  |

Definition at line 396 of file rowset.cpp.

{
  HRESULT         hr;
  IAccessor *       pIAccessor          = NULL;

  // An Accessor is basically a handle to a collection of bindings.
  // To create the Accessor, we need to first create an array of
  // bindings for the columns in the Rowset
  CHECK_HR(hr = mySetupBindings(pUnkRowset, pcBindings, prgBindings,
    pcbRowSize));

  // Now that we have an array of bindings, tell the provider to
  // create the Accessor for those bindings. We get back a handle
  // to this Accessor, which we will use when fetching data
  XCHECK_HR(hr = pUnkRowset->QueryInterface(
        IID_IAccessor, (void**)&pIAccessor));
  XCHECK_HR(hr = pIAccessor->CreateAccessor(
        DBACCESSOR_ROWDATA, //dwAccessorFlags
        *pcBindings,    //cBindings
        *prgBindings,   //rgBindings
        0,          //cbRowSize
        phAccessor,     //phAccessor
        NULL        //rgStatus
        ));

CLEANUP:
  if( pIAccessor )
    pIAccessor->Release();
  return hr;
}

HRESULT myCreateRowset | ( | IUnknown * | pUnkSession,
 |  | IUnknown ** | ppUnkRowset
 | ) |  |

Definition at line 39 of file rowset.cpp.

{
  HRESULT         hr;
  IUnknown *        pUnkCommand           = NULL;
  IOpenRowset *     pIOpenRowset          = NULL;
  WCHAR         wszTableName[MAX_NAME_LEN + 1]  = {0};

  const ULONG       cProperties           = 2;
  DBPROP          rgProperties[cProperties];
  DBPROPSET       rgPropSets[1];

  // Obtain a default table name from the user by displaying the
  // tables schema rowset if schema rowsets are supported.
  CHECK_HR(hr = myCreateSchemaRowset(DBSCHEMA_TABLES, pUnkSession,
    MAX_NAME_LEN, wszTableName));

  // Set properties on the rowset, to request additional functionality
  myAddRowsetProperties(rgPropSets, cProperties, rgProperties);

  // If the user requested that the rowset be created from a
  // Command object, create a Command, set its properties and
  // text and execute it to create the Rowset object
  if( g_dwFlags & USE_COMMAND )
  {
    WCHAR   wszCommandText[MAX_NAME_LEN + 1];

    // Attempt to create the Command object from the provider's
    // Session object. Note that Commands are not supported by
    // all providers, and this will fail in that case
    CHECK_HR(hr = myCreateCommand(pUnkSession, &pUnkCommand));

    // Get the command text that we will execute from the user
    if( !myGetInputFromUser(wszCommandText, L"\nType the command "
      L"to execute [Enter = `select * from %s`]: ", wszTableName) )
    {
      swprintf(wszCommandText, L"select * from %s", wszTableName);
    }

    // And execute the Command the user entered
    CHECK_HR(hr = myExecuteCommand(pUnkCommand, wszCommandText,
          1, rgPropSets, ppUnkRowset));
  }
  // Otherwise, the user gets the default behavior, which is to use
  // IOpenRowset to create the Rowset object from the Session object.
  // IOpenRowset is supported by all providers; it takes a TableID
  // and creates a rowset containing all rows in that table. It is
  // similar to using SQL command text of "select * from TableID"
  else
  {
    DBID        TableID;

    // Create the TableID
    TableID.eKind     = DBKIND_NAME;
    TableID.uName.pwszName  = wszTableName;

    // Obtain the table name from the user
    myGetInputFromUser(wszTableName, L"\nType the name of the table "
      L"to use [Enter = `%s`]: ", wszTableName);

    // Get the IOpenRowset interface and create a Rowset object
    // over the requested table through OpenRowset
    XCHECK_HR(hr = pUnkSession->QueryInterface(
          IID_IOpenRowset, (void**)&pIOpenRowset));
    XCHECK_HR(hr = pIOpenRowset->OpenRowset(
          NULL,     //pUnkOuter
          &TableID,   //pTableID
          NULL,     //pIndexID
          IID_IRowset,  //riid
          1,        //cPropSets
          rgPropSets,   //rgPropSets
          ppUnkRowset   //ppRowset
          ));
  }

CLEANUP:
  if( pIOpenRowset )
    pIOpenRowset->Release();
  if( pUnkCommand )
    pUnkCommand->Release();
  return hr;
}

HRESULT myDisplayColumnNames | ( | IUnknown * | pUnkRowset,
 |  | ULONG * | rgDispSize
 | ) |  |

Definition at line 760 of file rowset.cpp.

{
  HRESULT         hr;
  IColumnsInfo *      pIColumnsInfo       = NULL;
  ULONG         cColumns;
  DBCOLUMNINFO *      rgColumnInfo        = NULL;
  LPOLESTR        pStringsBuffer        = NULL;
  WCHAR         wszColumn[MAX_DISPLAY_SIZE + 1];
  LPWSTR          pwszColName;
  ULONG         iCol;
  ULONG         cSpaces;
  ULONG         iSpace;

  // Get the IColumnsInfo interface for the Rowset
  XCHECK_HR(hr = pUnkRowset->QueryInterface(
        IID_IColumnsInfo, (void**)&pIColumnsInfo));

  // Get the columns information
  XCHECK_HR(hr = pIColumnsInfo->GetColumnInfo(
        &cColumns,    //pcColumns
        &rgColumnInfo,  //prgColumnInfo
        &pStringsBuffer //ppStringBuffer
        ));

  // Display the title of the row index column
  wprintf(L" Row | ");

  // Display all column names
  for( iCol = 0; iCol < cColumns; iCol++ )
  {
    pwszColName = rgColumnInfo[iCol].pwszName;

    // If the column name is NULL, we'll use a default string
    if( !pwszColName )
    {
      // Is this the bookmark column?
      if( !rgColumnInfo[iCol].iOrdinal )
        pwszColName = L"Bmk";
      else
        pwszColName = L"(null)";
    }

    // Ensure that the name is no longer than MAX_DISPLAY_SIZE
    wcsncpy(wszColumn, pwszColName, MAX_DISPLAY_SIZE);
    wszColumn[min(rgDispSize[iCol], MAX_DISPLAY_SIZE)] = L'\0';

    // Figure out how many spaces we need to print after this column name
    cSpaces = min(rgDispSize[iCol], MAX_DISPLAY_SIZE) - wcslen(wszColumn);

    // Print the column name
    wprintf(L"%s", wszColumn);

    // Now print any spaces necessary to align this column
    for(iSpace = 0; iSpace < cSpaces; iSpace++ )
      putch(' ');

    // Now end the column with a separator marker if necessary
    if( iCol < cColumns - 1 )
      wprintf(L" | ");
  }

  // Done with the header, so print a newline
  wprintf(L"\n");

CLEANUP:
  CoTaskMemFree(rgColumnInfo);
  CoTaskMemFree(pStringsBuffer);
  if( pIColumnsInfo )
    pIColumnsInfo->Release();
  return hr;
}

HRESULT myDisplayRow | ( | ULONG | iRow,
 |  | ULONG | cBindings,
 |  | DBBINDING * | rgBindings,
 |  | void * | pData,
 |  | ULONG * | rgDispSize
 | ) |  |

Definition at line 843 of file rowset.cpp.

{
  HRESULT         hr              = S_OK;
  WCHAR         wszColumn[MAX_DISPLAY_SIZE + 1];
  DBSTATUS        dwStatus;
  ULONG         ulLength;
  void *          pvValue;
  ULONG         iCol;
  ULONG         cbRead;
  ISequentialStream *   pISeqStream         = NULL;
  ULONG         cSpaces;
  ULONG         iSpace;

  // Display the row number
  wprintf(L" [%d] | ", iRow);

  // For each column that we have bound, display the data
  for( iCol = 0; iCol < cBindings; iCol++ )
  {
    // We have bound status, length, and the data value for all
    // columns, so we know that these can all be used
    dwStatus  = *(DBSTATUS *)((BYTE *)pData + rgBindings[iCol].obStatus);
    ulLength  = *(ULONG *)((BYTE *)pData + rgBindings[iCol].obLength);
    pvValue   = (BYTE *)pData + rgBindings[iCol].obValue;

    // Check the status of this column. This decides
    // exactly what will be displayed for the column
    switch( dwStatus )
    {
      // The data is NULL, so don't try to display it
      case DBSTATUS_S_ISNULL:
        wcscpy(wszColumn, L"(null)");
        break;

      // The data was fetched, but may have been truncated.
      // Display string data for this column to the user
      case DBSTATUS_S_TRUNCATED:
      case DBSTATUS_S_OK:
      case DBSTATUS_S_DEFAULT:
      {
        // We have either bound the column as a Unicode string
        // (DBTYPE_WSTR) or as an ISequentialStream object
        // (DBTYPE_IUNKNOWN), and have to do different processing
        // for each one of these possibilities
        switch( rgBindings[iCol].wType )
        {
          case DBTYPE_WSTR:
          {
            // Copy the string data
            wcsncpy(wszColumn, (WCHAR *)pvValue, MAX_DISPLAY_SIZE);
            wszColumn[MAX_DISPLAY_SIZE - 1] = L'\0';
            break;
          }

          case DBTYPE_IUNKNOWN:
          {
            // We've bound this as an ISequentialStream object,
            // therefore the data in our buffer is a pointer
            // to the object's ISequentialStream interface
            pISeqStream =  *(ISequentialStream**)pvValue;

            // We call ISequentialStream::Read to read bytes from
            // the stream blindly into our buffer, simply as a
            // demonstration of ISequentialStream. To display the
            // data properly, the native provider type of this
            // column should be accounted for; it could be
            // DBTYPE_WSTR, in which case this works, or it could
            // be DBTYPE_STR or DBTYPE_BYTES, in which case this
            // won't display the data correctly
            CHECK_HR(hr = pISeqStream->Read(
                  wszColumn,      //pBuffer
                  MAX_DISPLAY_SIZE, //cBytes
                  &cbRead       //pcBytesRead
                  ));

            // Since streams don't provide NULL-termination,
            // we'll NULL-terminate the resulting string ourselves
            wszColumn[cbRead / sizeof(WCHAR)] = L'\0';

            // Release the stream object, now that we're done
            pISeqStream->Release();
            pISeqStream = NULL;
            break;
          }
        }
        break;
      }

      // This is an error status, so don't try to display the data
      default:
        wcscpy(wszColumn, L"(error status)");
        break;
    }

    // Determine how many spaces we need to add after displaying this
    // data to align it with this column in other rows
    cSpaces = min(rgDispSize[iCol], MAX_DISPLAY_SIZE) - wcslen(wszColumn);

    // Print the column data
    wprintf(L"%s", wszColumn);

    // Now print any spaces necessary
    for(iSpace = 0; iSpace < cSpaces; iSpace++ )
      putch(' ');

    // Now end the column with a separator marker if necessary
    if( iCol < cBindings - 1 )
      wprintf(L" | ");
  }

CLEANUP:
  if( pISeqStream )
    pISeqStream->Release();

  // Print the row separator
  wprintf(L"\n");
  return hr;
}

HRESULT myDisplayRowset | ( | IUnknown * | pUnkRowset,
 |  | LPCWSTR | pwszColToReturn,
 |  | ULONG | cchBuffer,
 |  | LPWSTR | pwszBuffer
 | ) |  |

Definition at line 446 of file rowset.cpp.

{
  HRESULT         hr;
  IRowset *       pIRowset          = NULL;
  ULONG         cBindings;
  DBBINDING *       rgBindings          = NULL;
  HACCESSOR       hAccessor         = DB_NULL_HACCESSOR;
  ULONG         cbRowSize;
  void *          pData           = NULL;
  ULONG *         rgDispSize          = NULL;
  ULONG         cRowsObtained;
  HROW *          rghRows           = NULL;
  ULONG         iRow;
  LONG          cRows           = MAX_ROWS;
  LONG          iRetCol           = -1;
  BOOL          fCanFetchBackwards;
  ULONG         iIndex;
  void *          pCurData;

  // Obtain the IRowset interface for use in fetching rows and data
  XCHECK_HR(hr = pUnkRowset->QueryInterface(
        IID_IRowset, (void**)&pIRowset));

  // Determine whether this rowset supports fetching data backwards;
  // we use this to determine whether the rowset can support moving
  // to the previous set of rows, described in more detail below
  myGetProperty(pUnkRowset, IID_IRowset, DBPROP_CANFETCHBACKWARDS,
    DBPROPSET_ROWSET, &fCanFetchBackwards);

  // If the caller wants us to return the data for a particular column
  // from a user-selected row, we need to turn the column name into a
  // column ordinal
  if( pwszColToReturn )
    CHECK_HR(hr = myFindColumn(pUnkRowset, pwszColToReturn, &iRetCol));

  // Create an Accessor. An Accessor is basically a handle to a
  // collection of bindings that describes to the provider how to
  // copy (and convert, if necessary) column data into our buffer.
  // The Accessor that this creates will bind all columns as either
  // DBTYPE_WSTR (a Unicode string) or as an ISequentialStream object
  // (used for BLOB data). This will also give us the size of the
  // row buffer that the Accessor describes to the provider
  CHECK_HR(hr = myCreateAccessor(pUnkRowset, &hAccessor,
                    &cBindings, &rgBindings, &cbRowSize));

  // Allocate enough memory to hold cRows rows of data; this is
  // where the actual row data from the provider will be placed
  pData = CoTaskMemAlloc(cbRowSize * MAX_ROWS);
  CHECK_MEMORY(hr, pData);

  // Allocate memory for an array that we will use to calculate the
  // maximum display size used by each column in the current set of
  // rows
  rgDispSize = (ULONG *)CoTaskMemAlloc(cBindings * sizeof(ULONG));
  CHECK_MEMORY(hr, rgDispSize);

  // In this loop, we perform the following process:
  //  - reset the maximum display size array
  //  - try to get cRows row handles from the provider
  //  - these handles are then used to actually get the row data from the
  //    provider copied into our allocated buffer
  //  - calculate the maximum display size for each column
  //  - release the row handles to the rows we obtained
  //  - display the column names for the rowset
  //  - display the row data for the rows that we fetched
  //  - get user input
  //  - free the provider-allocated row handle array
  //  - repeat unless the user has chosen to quit or has selected a row
  while( hr == S_OK )
  {
    // Clear the maximum display size array
    memset(rgDispSize, 0, cBindings * sizeof(ULONG));

    // Attempt to get cRows row handles from the provider
    XCHECK_HR(hr = pIRowset->GetNextRows(
          DB_NULL_HCHAPTER, //hChapter
          0,          //lOffset
          cRows,        //cRows
          &cRowsObtained,   //pcRowsObtained
          &rghRows      //prghRows
          ));

    // Loop over the row handles obtained from GetNextRows,
    // actually fetching the data for these rows into our buffer
    for( iRow = 0; iRow < cRowsObtained; iRow++ )
    {
      // Find the location in our buffer where we want to place
      // the data for this row. Note that if we fetched rows
      // backwards (cRows < 0), the row handles obtained from the
      // provider are reversed from the order in which we want to
      // actually display the data on the screen, so we will
      // account for this. This ensures that the resulting order
      // of row data in the pData buffer matches the order we
      // wish to use to display the data
      iIndex    = cRows > 0 ? iRow : cRowsObtained - iRow - 1;
      pCurData  = (BYTE*)pData + (cbRowSize * iIndex);

      // Get the data for this row handle. The provider will copy
      // (and convert, if necessary) the data for each of the
      // columns that are described in our Accessor into the given
      // buffer (pCurData)
      XCHECK_HR(hr = pIRowset->GetData(
          rghRows[iRow],  //hRow
          hAccessor,    //hAccessor
          pCurData    //pData
          ));

      // Update the maximum display size array, accounting for this row
      CHECK_HR(hr = myUpdateDisplaySize(cBindings, rgBindings,
        pCurData, rgDispSize));
    }

    // If we obtained rows, release the row handles for the retrieved rows
    // and display the names of the rowset columns before we display the data
    if( cRowsObtained )
    {
      // Release the row handles that we obtained
      XCHECK_HR(hr = pIRowset->ReleaseRows(
            cRowsObtained,  //cRows
            rghRows,    //rghRows
            NULL,     //rgRowOptions
            NULL,     //rgRefCounts
            NULL      //rgRowStatus
            ));

      // Display the names of the rowset columns
      CHECK_HR(hr = myDisplayColumnNames(pIRowset, rgDispSize));
    }

    // For each row that we obtained the data for, display this data
    for( iRow = 0; iRow < cRowsObtained; iRow++ )
    {
      // Get a pointer to the data for this row
      pCurData = (BYTE*)pData + (cbRowSize* iRow);

      // And display the row data
      CHECK_HR(hr = myDisplayRow(iRow, cBindings, rgBindings,
        pCurData, rgDispSize));
    }

    // Allow the user to navigate the rowset. This displays the appropriate
    // prompts, gets the user's input, may call IRowset::RestartPosition,
    // and may copy data from a selected row to the selection buffer, if so
    // directed. This will return S_OK if the user asked for more rows,
    // S_FALSE if the user selected a row, or E_FAIL if the user quits
    hr = myInteractWithRowset(
      pIRowset,         // IRowset pointer, for RestartPosition
      &cRows,           // updated with fetch direction value
      cRowsObtained,        // to indicate selection range
      fCanFetchBackwards,     // whether [P]revious is supported
      pData,            // data pointer for copying selection
      cbRowSize,          // size of rows for copying selection
      iRetCol >= 0 ?        // bindings for the selection column,
        &rgBindings[iRetCol] :  //  or NULL if no selection column
        NULL,
      cchBuffer,          // size of the selection buffer
      pwszBuffer);        // pointer to the selection buffer

    // Since we are allowing the provider to allocate the memory for
    // the row handle array, we will free this memory and reset the
    // pointer to NULL. If this is not NULL on the next call to GetNextRows,
    // the provider will assume that it points to an allocated array of
    // the required size (which may not be the case if we obtained less
    // than cRows rows from this last call to GetNextRows
    CoTaskMemFree(rghRows);
    rghRows = NULL;
  }

CLEANUP:
  myFreeBindings(cBindings, rgBindings);
  CoTaskMemFree(rgDispSize);
  CoTaskMemFree(pData);
  if( pIRowset )
    pIRowset->Release();
  return hr;
}

HRESULT myFindColumn | ( | IUnknown * | pUnkRowset,
 |  | LPCWSTR | pwszName,
 |  | LONG * | plIndex
 | ) |  |

Definition at line 1093 of file rowset.cpp.

{
  HRESULT         hr;
  IColumnsInfo *      pIColumnsInfo       = NULL;
  ULONG         cColumns;
  DBCOLUMNINFO *      rgColumnInfo        = NULL;
  OLECHAR *       pStringsBuffer        = NULL;
  ULONG         iCol;

  // Get the IColumnsInfo interface
  XCHECK_HR(hr = pUnkRowset->QueryInterface(
        IID_IColumnsInfo, (void**)&pIColumnsInfo));

  // Get the columns information
  XCHECK_HR(hr = pIColumnsInfo->GetColumnInfo(
        &cColumns,    //pcColumns
        &rgColumnInfo,  //prgColumnInfo
        &pStringsBuffer //ppStringBuffer
        ));

  // Assume that we'll find the column
  hr = S_OK;

  // Search for the column we need
  for( iCol = 0; iCol < cColumns; iCol++ )
  {
    // If the column name matches we've found the column...
    if( rgColumnInfo[iCol].pwszName &&
      !wcscmp(pwszName, rgColumnInfo[iCol].pwszName) )
    {
      *plIndex = iCol;
      goto CLEANUP;
    }
  }

  // If we didn't find the column, we'll return S_FALSE
  hr = S_FALSE;

CLEANUP:
  CoTaskMemFree(rgColumnInfo);
  CoTaskMemFree(pStringsBuffer);
  if( pIColumnsInfo )
    pIColumnsInfo->Release();
  return hr;
}

void myFreeBindings | ( | ULONG | cBindings,
 |  | DBBINDING * | rgBindings
 | ) |  |

Definition at line 978 of file rowset.cpp.

{
  ULONG         iBind;

  // Free any memory used by DBOBJECT structures in the array
  for( iBind = 0; iBind < cBindings; iBind++ )
    CoTaskMemFree(rgBindings[iBind].pObject);

  // Now free the bindings array itself
  CoTaskMemFree(rgBindings);
}

HRESULT myInteractWithRowset | ( | IRowset * | pIRowset,
 |  | LONG * | pcRows,
 |  | ULONG | cRowsObtained,
 |  | BOOL | fCanFetchBackwards,
 |  | void * | pData,
 |  | ULONG | cbRowSize,
 |  | DBBINDING * | pBinding,
 |  | ULONG | cchBuffer,
 |  | LPWSTR | pwszBuffer
 | ) |  |

Definition at line 642 of file rowset.cpp.

{
  HRESULT         hr              = S_OK;
  CHAR          ch;

  // Let the user know if no rows were fetched
  if( !cRowsObtained )
    printf("\n*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\n" \
         "*                                 *\n" \
         "* No rows obtained on this fetch! *\n" \
         "*                                 *\n" \
         "*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\n");

  // Print navigation options
  if( fCanFetchBackwards )
    printf("\n[P]revious; [N]ext; [R]estart; ");
  else
    printf("\n[N]ext; [R]estart; ");

  // Print selection options
  if( cRowsObtained && pwszBuffer && pBinding )
    printf("[0]-[%d] for a row; ", cRowsObtained - 1);

  // User can always quit the program
  printf("[Q]uit? ");

  // Get the user's input
  while( TRUE )
  {
    // Get a character from the console
    ch = myGetChar();

    // Look for one of the allowed options; if not found, go
    // back around and wait for another input from the user

    // If we're looking for a row selection, allow the user to select
    // a row that we fetched, then copy the data from the requested
    // column into the selection buffer we were passed
    if( pwszBuffer && pBinding &&
      ch >= '0' && ch < (int)('0' + cRowsObtained) )
    {
      // Save the data for the selected row
      ULONG nSelection = ch - '0';
      _snwprintf(pwszBuffer, cchBuffer, L"%s",
          (WCHAR *)((BYTE *)pData + cbRowSize * nSelection +
          pBinding->obValue));
      pwszBuffer[cchBuffer] = L'\0';
      hr = S_FALSE;
    }
    // If the provider supports fetching backwards, set *pcRows
    // to -MAX_ROWS. When GetNextRows is called with this value,
    // it will fetch rows backwards from the current position
    // until it fetches MAX_ROWS rows or hits the end of the rowset
    else if( fCanFetchBackwards && ch == 'p' )
    {
      // Fetch backwards
      *pcRows = -MAX_ROWS;
    }
    // Set *pcRows so that the next call to GetNextRows fetches
    // MAX_ROWS rows forward from the current position
    else if( ch == 'n' )
    {
      // Fetch forward
      *pcRows = MAX_ROWS;
    }
    // Call IRowset::RestartPosition and fetch the first MAX_ROWS
    // rows of the rowset forward from there
    else if( ch == 'r' )
    {
      // RestartPosition
      *pcRows = MAX_ROWS;
      XCHECK_HR(hr = pIRowset->RestartPosition(DB_NULL_HCHAPTER));

      // Restarting a command may return the DB_S_COMMANDREEXECUTED
      // warning. If this happens, we still want the caller to
      // continue to display data, so we will reset the result code
      // to S_OK
      hr = S_OK;
    }
    // Quit the program
    else if( ch == 'q' )
    {
      hr = E_FAIL;
    }
    // Invalid option; go back up and get another character from the user
    else
    {
      continue;
    }

    // Echo the character and stop waiting for input
    printf("%c\n", ch);
    break;
  }

CLEANUP:
  return hr;
}

HRESULT mySetupBindings | ( | IUnknown * | pUnkRowset,
 |  | ULONG * | pcBindings,
 |  | DBBINDING ** | prgBindings,
 |  | ULONG * | pcbRowSize
 | ) |  |

Definition at line 151 of file rowset.cpp.

{
  HRESULT         hr;
  ULONG         cColumns;
  DBCOLUMNINFO *      rgColumnInfo        = NULL;
  LPWSTR          pStringBuffer       = NULL;
  IColumnsInfo *      pIColumnsInfo       = NULL;

  ULONG         iCol;
  ULONG         dwOffset          = 0;
  DBBINDING *       rgBindings          = NULL;

  ULONG         cStorageObjs        = 0;
  BOOL          fMultipleObjs       = FALSE;

  // Obtain the column information for the Rowset; from this, we can find
  // out the following information that we need to construct the bindings
  // array:
  //  - the number of columns
  //  - the ordinal of each column
  //  - the precision and scale of numeric columns
  //  - the OLE DB data type of the column
  XCHECK_HR(hr = pUnkRowset->QueryInterface(
        IID_IColumnsInfo, (void**)&pIColumnsInfo));
  XCHECK_HR(hr = pIColumnsInfo->GetColumnInfo(
        &cColumns,    //pcColumns
        &rgColumnInfo,  //prgColumnInfo
        &pStringBuffer  //ppStringBuffer
        ));

  // Allocate memory for the bindings array; there is a one-to-one
  // mapping between the columns returned from GetColumnInfo and our
  // bindings
  rgBindings = (DBBINDING*)CoTaskMemAlloc(cColumns * sizeof(DBBINDING));
  CHECK_MEMORY(hr, rgBindings);
  memset(rgBindings, 0, cColumns * sizeof(DBBINDING));

  // Determine if the Rowset supports multiple storage object bindings;
  // if it does not, we will only bind the first BLOB column or IUnknown
  // column as an ISequentialStream object, and will bind the rest as
  // DBTYPE_WSTR
  myGetProperty(pUnkRowset, IID_IRowset, DBPROP_MULTIPLESTORAGEOBJECTS,
    DBPROPSET_ROWSET, &fMultipleObjs);

  // Construct the binding array element for each column
  for( iCol = 0; iCol < cColumns; iCol++ )
  {
    // This binding applies to the ordinal of this column
    rgBindings[iCol].iOrdinal = rgColumnInfo[iCol].iOrdinal;

    // We are asking the provider to give us the data for this column
    // (DBPART_VALUE), the length of that data (DBPART_LENGTH), and
    // the status of the column (DBPART_STATUS)
    rgBindings[iCol].dwPart   = DBPART_VALUE|DBPART_LENGTH|DBPART_STATUS;

    // The following values are the offsets to the status, length, and
    // data value that the provider will fill with the appropriate values
    // when we fetch data later. When we fetch data, we will pass a
    // pointer to a buffer that the provider will copy column data to,
    // in accordance with the binding we have provided for that column;
    // these are offsets into that future buffer
    rgBindings[iCol].obStatus = dwOffset;
    rgBindings[iCol].obLength = dwOffset + sizeof(DBSTATUS);
    rgBindings[iCol].obValue  = dwOffset + sizeof(DBSTATUS) + sizeof(ULONG);

    // Any memory allocated for the data value will be owned by us, the
    // client. Note that no data will be allocated in this case, as the
    // DBTYPE_WSTR bindings we are using will tell the provider to simply
    // copy data directly into our provided buffer
    rgBindings[iCol].dwMemOwner = DBMEMOWNER_CLIENTOWNED;

    // This is not a parameter binding
    rgBindings[iCol].eParamIO = DBPARAMIO_NOTPARAM;

    // We want to use the precision and scale of the column
    rgBindings[iCol].bPrecision = rgColumnInfo[iCol].bPrecision;
    rgBindings[iCol].bScale   = rgColumnInfo[iCol].bScale;

    // Bind this column as DBTYPE_WSTR, which tells the provider to
    // copy a Unicode string representation of the data into our buffer,
    // converting from the native type if necessary
    rgBindings[iCol].wType    = DBTYPE_WSTR;

    // Initially, we set the length for this data in our buffer to 0;
    // the correct value for this will be calculated directly below
    rgBindings[iCol].cbMaxLen = 0;

    // Determine the maximum number of bytes required in our buffer to
    // contain the Unicode string representation of the provider's native
    // data type, including room for the NULL-termination character
    switch( rgColumnInfo[iCol].wType )
    {
      case DBTYPE_NULL:
      case DBTYPE_EMPTY:
      case DBTYPE_I1:
      case DBTYPE_I2:
      case DBTYPE_I4:
      case DBTYPE_UI1:
      case DBTYPE_UI2:
      case DBTYPE_UI4:
      case DBTYPE_R4:
      case DBTYPE_BOOL:
      case DBTYPE_I8:
      case DBTYPE_UI8:
      case DBTYPE_R8:
      case DBTYPE_CY:
      case DBTYPE_ERROR:
        // When the above types are converted to a string, they
        // will all fit into 25 characters, so use that plus space
        // for the NULL-terminator
        rgBindings[iCol].cbMaxLen = (25 + 1) * sizeof(WCHAR);
        break;

      case DBTYPE_DECIMAL:
      case DBTYPE_NUMERIC:
      case DBTYPE_DATE:
      case DBTYPE_DBDATE:
      case DBTYPE_DBTIMESTAMP:
      case DBTYPE_GUID:
        // Converted to a string, the above types will all fit into
        // 50 characters, so use that plus space for the terminator
        rgBindings[iCol].cbMaxLen = (50 + 1) * sizeof(WCHAR);
        break;

      case DBTYPE_BYTES:
        // In converting DBTYPE_BYTES to a string, each byte
        // becomes two characters (e.g. 0xFF -> "FF"), so we
        // will use double the maximum size of the column plus
        // include space for the NULL-terminator
        rgBindings[iCol].cbMaxLen =
          (rgColumnInfo[iCol].ulColumnSize * 2 + 1) * sizeof(WCHAR);
        break;

      case DBTYPE_STR:
      case DBTYPE_WSTR:
      case DBTYPE_BSTR:
        // Going from a string to our string representation,
        // we can just take the maximum size of the column,
        // a count of characters, and include space for the
        // terminator, which is not included in the column size
        rgBindings[iCol].cbMaxLen =
          (rgColumnInfo[iCol].ulColumnSize + 1) * sizeof(WCHAR);
        break;

      default:
        // For any other type, we will simply use our maximum
        // column buffer size, since the display size of these
        // columns may be variable (e.g. DBTYPE_VARIANT) or
        // unknown (e.g. provider-specific types)
        rgBindings[iCol].cbMaxLen = MAX_COL_SIZE;
        break;
    };

    // If the provider's native data type for this column is
    // DBTYPE_IUNKNOWN or this is a BLOB column and the user
    // has requested that we bind BLOB columns as ISequentialStream
    // objects, bind this column as an ISequentialStream object if
    // the provider supports our creating another ISequentialStream
    // binding
    if( (rgColumnInfo[iCol].wType == DBTYPE_IUNKNOWN ||
       ((rgColumnInfo[iCol].dwFlags & DBCOLUMNFLAGS_ISLONG) &&
        (g_dwFlags & USE_ISEQSTREAM))) &&
      (fMultipleObjs || !cStorageObjs) )
    {
      // To create an ISequentialStream object, we will
      // bind this column as DBTYPE_IUNKNOWN to indicate
      // that we are requesting this column as an object
      rgBindings[iCol].wType        = DBTYPE_IUNKNOWN;

      // We want to allocate enough space in our buffer for
      // the ISequentialStream pointer we will obtain from
      // the provider
      rgBindings[iCol].cbMaxLen     = sizeof(ISequentialStream *);

      // To specify the type of object that we want from the
      // provider, we need to create a DBOBJECT structure and
      // place it in our binding for this column
        rgBindings[iCol].pObject      =
                (DBOBJECT *)CoTaskMemAlloc(sizeof(DBOBJECT));
      CHECK_MEMORY(hr, rgBindings[iCol].pObject);

      // Direct the provider to create an ISequentialStream
      // object over the data for this column
      rgBindings[iCol].pObject->iid   = IID_ISequentialStream;

      // We want read access on the ISequentialStream
      // object that the provider will create for us
      rgBindings[iCol].pObject->dwFlags = STGM_READ;

      // Keep track of the number of storage objects (ISequentialStream
      // is a storage interface) that we have requested, so that we
      // can avoid requesting multiple storage objects from a provider
      // that only supports a single storage object in our bindings
      cStorageObjs++;
    }

    // Ensure that the bound maximum length is no more than the
    // maximum column size in bytes that we've defined
    rgBindings[iCol].cbMaxLen
      = min(rgBindings[iCol].cbMaxLen, MAX_COL_SIZE);

    // Update the offset past the end of this column's data, so
    // that the next column will begin in the correct place in
    // the buffer
    dwOffset = rgBindings[iCol].cbMaxLen + rgBindings[iCol].obValue;

    // Ensure that the data for the next column will be correctly
    // aligned for all platforms, or, if we're done with columns,
    // that if we allocate space for multiple rows that the data
    // for every row is correctly aligned
    dwOffset = ROUNDUP(dwOffset);
  }

  // Return the row size (the current dwOffset is the size of the row),
  // the count of bindings, and the bindings array to the caller
  *pcbRowSize   = dwOffset;
  *pcBindings   = cColumns;
  *prgBindings  = rgBindings;

CLEANUP:
  CoTaskMemFree(rgColumnInfo);
  CoTaskMemFree(pStringBuffer);
  if( pIColumnsInfo )
    pIColumnsInfo->Release();
  return hr;
}

HRESULT myUpdateDisplaySize | ( | ULONG | cBindings,
 |  | DBBINDING * | rgBindings,
 |  | void * | pData,
 |  | ULONG * | rgDispSize
 | ) |  |

Definition at line 1035 of file rowset.cpp.

{
  DBSTATUS        dwStatus;
  ULONG         cchLength;
  ULONG         iCol;

  // Loop through the bindings, comparing the size of each column
  // against the previously found maximum size for that column
  for( iCol = 0; iCol < cBindings; iCol++ )
  {
    dwStatus  = *(DBSTATUS *)((BYTE *)pData + rgBindings[iCol].obStatus);
    cchLength = ((*(ULONG *)((BYTE *)pData + rgBindings[iCol].obLength))
          / sizeof(WCHAR));

    // The length that we need to display depends on the status
    // of this column and generally on the data in the column
    switch( dwStatus )
    {
      case DBSTATUS_S_ISNULL:
        cchLength = 6;            // "(null)"
        break;

      case DBSTATUS_S_TRUNCATED:
      case DBSTATUS_S_OK:
      case DBSTATUS_S_DEFAULT:
        if( rgBindings[iCol].wType == DBTYPE_IUNKNOWN )
          cchLength = 2 + 8;        // "0x%08lx"

        // Ensure that the length is at least the minimum display size
        cchLength = max(cchLength, MIN_DISPLAY_SIZE);
        break;

      default:
        cchLength = 14;           // "(error status)"
        break;
    }

    if( rgDispSize[iCol] < cchLength )
      rgDispSize[iCol] = cchLength;
  }

  return S_OK;
}

Generated on Wed Nov 13 2024 16:53:28 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/prsample/session.cpp File Reference

  • Dataaccess
  • oledb
  • prsample
Functions

session.cpp File Reference

#include "prsample.h"

Go to the source code of this file.

Functions

HRESULT | myCreateSchemaRowset (GUID guidSchema, IUnknown *pUnkSession, ULONG cchBuffer, LPWSTR pwszBuffer)
HRESULT | myCreateSession (IUnknown *pUnkDataSource, IUnknown **ppUnkSession)

Function Documentation

HRESULT myCreateSchemaRowset | ( | GUID | guidSchema,
 |  | IUnknown * | pUnkSession,
 |  | ULONG | cchBuffer,
 |  | LPWSTR | pwszBuffer
 | ) |  |

Definition at line 63 of file session.cpp.

{
  HRESULT         hr              = S_OK;
  IDBSchemaRowset *   pIDBSchemaRowset      = NULL;
  IUnknown *        pUnkRowset          = NULL;

  const ULONG       cProperties         = 2;
  DBPROP          rgProperties[cProperties];
  DBPROPSET       rgPropSets[1];

  // Attempt to obtain the IDBSchemaRowset interface on the Session object.
  // This is not a mandatory interface; if it is not supported, we are done
  CHECK_HR(pUnkSession->QueryInterface(
          IID_IDBSchemaRowset, (void**)&pIDBSchemaRowset));

  // Set properties on the rowset, to request additional functionality
  myAddRowsetProperties(rgPropSets, cProperties, rgProperties);

  // Get the requested schema rowset; if IDBSchemaRowset is supported,
  // the following schema rowsets are required to be supported:
  //  DBSCHEMA_TABLES, DBSCHEMA_COLUMNS, and DBSCHEMA_PROVIDERTYPES
  // We know that we will be asking for one of these, so it is not
  // necessary to call IDBSchemaRowset::GetSchemas in this case
  XCHECK_HR(hr = pIDBSchemaRowset->GetRowset(
        NULL,     //pUnkOuter
        guidSchema,   //guidSchema
        0,        //cRestrictions
        NULL,     //rgRestrictions
        IID_IRowset,  //riid
        1,        //cPropSets
        rgPropSets,   //rgPropSets
        &pUnkRowset   //ppRowset
        ));

  // Display the rowset to the user; this will allow the user to
  // perform basic navigation of the rowset and will allow the user
  // to select a row containing a desired table name (taken from the
  // TABLE_NAME column)
  CHECK_HR(hr = myDisplayRowset(pUnkRowset,
    L"TABLE_NAME", cchBuffer, pwszBuffer));

CLEANUP:
  if( pIDBSchemaRowset )
    pIDBSchemaRowset->Release();
  if( pUnkRowset )
    pUnkRowset->Release();
  return hr;
}

HRESULT myCreateSession | ( | IUnknown * | pUnkDataSource,
 |  | IUnknown ** | ppUnkSession
 | ) |  |

Definition at line 29 of file session.cpp.

{
  HRESULT         hr;
  IDBCreateSession *    pIDBCreateSession   = NULL;

  //Create a Session Object from a Data Source Object
  XCHECK_HR(hr = pUnkDataSource->QueryInterface(
        IID_IDBCreateSession, (void**)&pIDBCreateSession));
  XCHECK_HR(hr = pIDBCreateSession->CreateSession(
        NULL,       //pUnkOuter
        IID_IOpenRowset,  //riid
        ppUnkSession    //ppSession
        ));

CLEANUP:
  if( pIDBCreateSession )
    pIDBCreateSession->Release();
  return hr;
}

Generated on Wed Nov 13 2024 16:53:28 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/cbase.cpp File Reference

  • Dataaccess
  • oledb
  • rowsetviewer
Functions

cbase.cpp File Reference

#include "Headers.h"

Go to the source code of this file.

Functions

SOURCE | DetermineObjectType (IUnknown *pIUnkObject, SOURCE eSource)
SOURCE | GuidToSourceType (REFGUID guidType)
STDMETHODIMP_ (ULONG) CBase

Function Documentation

SOURCE DetermineObjectType | ( | IUnknown * | pIUnkObject,
 |  | SOURCE | eSource
 | ) |  |

Definition at line 1289 of file cbase.cpp.

{
  //Don't rely upon the caller knowing exactly what the object type is...
  //Since many OLE DB methods can return different objects depending upon interface or properties
  //requested.  So use the "suggested" type as an optimizing starting point, and if not
  //then proceed the hard way to determine exactly what it is...

  //Do we need to figure out what type of object this is?
  if(!pIUnkObject)
    return eCUnknown;

  IUnknown* pIUnknown = NULL;
  HRESULT hr = E_NOINTERFACE;

  //See of the object is what the user's "guess" indicates...
  //If it is where done...
  switch(eSource)
  {
    case eCRow:
      hr = TRACE_QI(pIUnkObject, IID_IRow, &pIUnknown);
      break;

    case eCRowset:
      hr = TRACE_QI(pIUnkObject, IID_IRowset, &pIUnknown);
      break;

    case eCCommand:
      hr = TRACE_QI(pIUnkObject, IID_ICommand, &pIUnknown);
      break;

    case eCSession:
      hr = TRACE_QI(pIUnkObject, IID_IOpenRowset, &pIUnknown);
      break;

    case eCMultipleResults:
      hr = TRACE_QI(pIUnkObject, IID_IMultipleResults, &pIUnknown);
      break;

    case eCEnumerator:
      hr = TRACE_QI(pIUnkObject, IID_ISourcesRowset, &pIUnknown);
      break;

    case eCBinder:
      hr = TRACE_QI(pIUnkObject, IID_IBindResource, &pIUnknown);
      break;

    case eCDataSource:
      //IDBInitialize is no longer enough to fully indentify wither the object returned
      //is a DataSource or not.  Other objects also have these: ie: Enumerator, Binder, etc
      if(SUCCEEDED(hr = TRACE_QI(pIUnkObject, IID_IDBInitialize, &pIUnknown)))
      {
        TRACE_RELEASE(pIUnknown, L"IDBInitialize");
        hr = TRACE_QI(pIUnkObject, IID_IPersist, &pIUnknown);
      }
      break;

    case eCServiceComp:
      hr = TRACE_QI(pIUnkObject, IID_IDataInitialize, &pIUnknown);
      break;

    case eCDataLinks:
      hr = TRACE_QI(pIUnkObject, IID_IDBPromptInitialize, &pIUnknown);
      break;

    case eCStream:
      //Some providers for some reason may not support the inherited ISequentialStream interface
      if(FAILED(hr = TRACE_QI(pIUnkObject, IID_ISequentialStream, &pIUnknown)))
        hr = TRACE_QI(pIUnkObject, IID_IStream, &pIUnknown);
      break;

    case eCDataset:
      hr = TRACE_QI(pIUnkObject, IID_IMDDataset, &pIUnknown);
      break;

    case eCRowPosition:
      hr = TRACE_QI(pIUnkObject, IID_IRowPosition, &pIUnknown);
      break;

    case eCTransaction:
      hr = TRACE_QI(pIUnkObject, IID_ITransaction, &pIUnknown);
      break;

    case eCTransactionOptions:
      hr = TRACE_QI(pIUnkObject, IID_ITransactionOptions, &pIUnknown);
      break;

    case eCError:
      hr = TRACE_QI(pIUnkObject, IID_IErrorInfo, &pIUnknown);
      break;

    case eCCustomError:
      hr = TRACE_QI(pIUnkObject, IID_ISQLErrorInfo, &pIUnknown);
      break;

    case eCConnectionPoint:
      hr = TRACE_QI(pIUnkObject, IID_IConnectionPoint, &pIUnknown);
      break;

    default:
      hr = E_NOINTERFACE;
      break;
  };

  //If the object doesn't match the users guess we will need to try and determine what it really is...
  if(FAILED(hr))
  {
    //Since many objects support the same interface,
    //we need to actually QI for a "unique" interface on that object
    //to determine what type of object it really is...
    if(SUCCEEDED(hr = TRACE_QI(pIUnkObject, IID_IRow, &pIUnknown)))
      eSource = eCRow;
    else if(SUCCEEDED(hr = TRACE_QI(pIUnkObject, IID_IRowset, &pIUnknown)))
      eSource = eCRowset;
    else if(SUCCEEDED(hr = TRACE_QI(pIUnkObject, IID_ICommand, &pIUnknown)))
      eSource = eCCommand;
    else if(SUCCEEDED(hr = TRACE_QI(pIUnkObject, IID_IOpenRowset, &pIUnknown)))
      eSource = eCSession;
    else if(SUCCEEDED(hr = TRACE_QI(pIUnkObject, IID_IMultipleResults, &pIUnknown)))
      eSource = eCMultipleResults;
    else if(SUCCEEDED(hr = TRACE_QI(pIUnkObject, IID_ISourcesRowset, &pIUnknown)))
      eSource = eCEnumerator;
    else if(SUCCEEDED(hr = TRACE_QI(pIUnkObject, IID_IBindResource, &pIUnknown)))
      eSource = eCBinder;
    else if(SUCCEEDED(hr = TRACE_QI(pIUnkObject, IID_IDBProperties, &pIUnknown)))
      eSource = eCDataSource;
    else if(SUCCEEDED(hr = TRACE_QI(pIUnkObject, IID_IDataInitialize, &pIUnknown)))
      eSource = eCServiceComp;
    else if(SUCCEEDED(hr = TRACE_QI(pIUnkObject, IID_IDBPromptInitialize, &pIUnknown)))
      eSource = eCDataLinks;
    else if(SUCCEEDED(hr = TRACE_QI(pIUnkObject, IID_ISequentialStream, &pIUnknown)) || SUCCEEDED(hr = TRACE_QI(pIUnkObject, IID_IStream, &pIUnknown)))
      eSource = eCStream;
    else if(SUCCEEDED(hr = TRACE_QI(pIUnkObject, IID_IMDDataset, &pIUnknown)))
      eSource = eCDataset;
    else if(SUCCEEDED(hr = TRACE_QI(pIUnkObject, IID_IRowPosition, &pIUnknown)))
      eSource = eCRowPosition;
    else if(SUCCEEDED(hr = TRACE_QI(pIUnkObject, IID_ITransaction, &pIUnknown)))
      eSource = eCTransaction;
    else if(SUCCEEDED(hr = TRACE_QI(pIUnkObject, IID_ITransactionOptions, &pIUnknown)))
      eSource = eCTransactionOptions;
    else if(SUCCEEDED(hr = TRACE_QI(pIUnkObject, IID_IErrorInfo, &pIUnknown)))
      eSource = eCError;
    else if(SUCCEEDED(hr = TRACE_QI(pIUnkObject, IID_ISQLErrorInfo, &pIUnknown)))
      eSource = eCCustomError;
    else if(SUCCEEDED(hr = TRACE_QI(pIUnkObject, IID_IConnectionPoint, &pIUnknown)))
      eSource = eCConnectionPoint;
    else
      eSource = eCUnknown;
  }

  if(SUCCEEDED(hr))
    TRACE_RELEASE(pIUnknown, L"IUnknown");
  return eSource;
}

SOURCE GuidToSourceType ( REFGUID guidType )

Definition at line 1265 of file cbase.cpp.

{
  if(guidType == DBGUID_ROWSET)
    return eCRowset;
  else if(guidType == DBGUID_ROW)
    return eCRow;
  else if(guidType == DBGUID_COMMAND)
    return eCCommand;
  else if(guidType == DBGUID_SESSION)
    return eCSession;
  else if(guidType == DBGUID_DSO)
    return eCDataSource;
  else if(guidType == DBGUID_STREAM)
    return eCStream;

  return eCUnknown;
}

STDMETHODIMP_ ( ULONG )

Definition at line 632 of file cbase.cpp.

{
  ASSERT(m_cRef);
  if(--m_cRef)
    return m_cRef;

  //COM Aggregation rule #5
  //The outer object must protect its implementation of Release from
  //reentrantcy with an artifical reference count arround its destruction code
  m_cRef++;

  //Delete this object
  delete this;
  return 0;
}

Generated on Wed Nov 13 2024 16:53:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/cbase.h File Reference

  • Dataaccess
  • oledb
  • rowsetviewer
Classes | Defines | Enumerations | Functions | Variables

cbase.h File Reference

Go to the source code of this file.

Classes

class | CAggregate
class | CAsynchBase
class | CBase
class | CConnectionPoint
class | CContainerBase
class | CPropertiesBase
class | CUnknown

Defines

#define | HANDLE_GETINTERFACE(interface)
#define | OBTAIN_INTERFACE(interface)
#define | RELEASE_INTERFACE(interface)
#define | SOURCE_GETINTERFACE(pObject, type) ((pObject) ? (type*)(pObject)->GetInterface(IID_##type) : NULL)
#define | SOURCE_GETOBJECT(pObject, source) (((pObject) && (((pObject)->GetObjectType() == e##source) || ((pObject)->GetBaseType() & e##source))) ? (source*)(pObject) : NULL)
#define | SOURCE_GETPARENT(pObject, source) ((pObject) ? (source*)(pObject)->GetParent(e##source) : NULL)

Enumerations

enum BASE_CLASS {
eCBase = 0x0001000, eCContainerBase = 0x0002000, eCAsynchBase = 0x0004000, eCPropertiesBase = 0x0008000,
eCDataAccess = 0x0010000
}
enum SOURCE {
eInvalid = 0, eCUnknown = 1, eCDataSource = 2, eCSession = 3,
eCCommand = 4, eCMultipleResults = 5, eCRowset = 6, eCRow = 7,
eCStream = 8, eCEnumerator = 9, eCBinder = 10, eCServiceComp = 11,
eCDataLinks = 12, eCDataset = 13, eCTransaction = 14, eCTransactionOptions = 15,
eCError = 16, eCCustomError = 17, eCRowPosition = 18, eCConnectionPoint = 19
}

Functions

SOURCE | DetermineObjectType (IUnknown *pIUnknown, SOURCE eSource)
SOURCE | GuidToSourceType (REFGUID guidType)

Variables

const IID | IID_IAggregate

Define Documentation

#define HANDLE_GETINTERFACE ( interface )
Value:
if(riid == IID_##interface)         \
    return (IUnknown**)&m_p##interface

Definition at line 68 of file cbase.h.

#define OBTAIN_INTERFACE ( interface )
Value:
if(!m_p##interface)             \
    TRACE_QI(m_pIUnknown, IID_##interface, (IUnknown**)&m_p##interface, GetObjectName())

Definition at line 72 of file cbase.h.

#define RELEASE_INTERFACE ( interface )
Value:
if(m_p##interface)              \
    TRACE_RELEASE(m_p##interface, WIDESTRING(#interface))

Definition at line 76 of file cbase.h.

#define SOURCE_GETINTERFACE | ( | pObject,
 |  | type |
 | ) |  | ((pObject) ? (type*)(pObject)->GetInterface(IID_##type) : NULL)

Definition at line 80 of file cbase.h.

#define SOURCE_GETOBJECT | ( | pObject,
 |  | source |
 | ) |  | (((pObject) && (((pObject)->GetObjectType() == e##source) || ((pObject)->GetBaseType() & e##source))) ? (source*)(pObject) : NULL)

Definition at line 83 of file cbase.h.

#define SOURCE_GETPARENT | ( | pObject,
 |  | source |
 | ) |  | ((pObject) ? (source*)(pObject)->GetParent(e##source) : NULL)

Definition at line 86 of file cbase.h.

Enumeration Type Documentation

enum BASE_CLASS
Enumerator:
eCBase
eCContainerBase
eCAsynchBase
eCPropertiesBase
eCDataAccess

Definition at line 57 of file cbase.h.

{
  eCBase        = 0x0001000,
  eCContainerBase   = 0x0002000,
  eCAsynchBase    = 0x0004000,
  eCPropertiesBase  = 0x0008000,
  eCDataAccess    = 0x0010000
};

enum SOURCE
Enumerator:
eInvalid
eCUnknown
eCDataSource
eCSession
eCCommand
eCMultipleResults
eCRowset
eCRow
eCStream
eCEnumerator
eCBinder
eCServiceComp
eCDataLinks
eCDataset
eCTransaction
eCTransactionOptions
eCError
eCCustomError
eCRowPosition
eCConnectionPoint

Definition at line 30 of file cbase.h.

{
  eInvalid        = 0,

  //Object Source
  eCUnknown       = 1,
  eCDataSource      = 2,
  eCSession       = 3,
  eCCommand       = 4,
  eCMultipleResults   = 5,
  eCRowset        = 6,
  eCRow         = 7,
  eCStream        = 8,
  eCEnumerator      = 9,
  eCBinder        =10,
  eCServiceComp     =11,
  eCDataLinks       =12,
  eCDataset       =13,
  eCTransaction     =14,
  eCTransactionOptions  =15,
  eCError         =16,
  eCCustomError     =17,
  eCRowPosition     =18,
  eCConnectionPoint   =19,
};

Function Documentation

SOURCE DetermineObjectType | ( | IUnknown * | pIUnknown,
 |  | SOURCE | eSource
 | ) |  |

Definition at line 1289 of file cbase.cpp.

{
  //Don't rely upon the caller knowing exactly what the object type is...
  //Since many OLE DB methods can return different objects depending upon interface or properties
  //requested.  So use the "suggested" type as an optimizing starting point, and if not
  //then proceed the hard way to determine exactly what it is...

  //Do we need to figure out what type of object this is?
  if(!pIUnkObject)
    return eCUnknown;

  IUnknown* pIUnknown = NULL;
  HRESULT hr = E_NOINTERFACE;

  //See of the object is what the user's "guess" indicates...
  //If it is where done...
  switch(eSource)
  {
    case eCRow:
      hr = TRACE_QI(pIUnkObject, IID_IRow, &pIUnknown);
      break;

    case eCRowset:
      hr = TRACE_QI(pIUnkObject, IID_IRowset, &pIUnknown);
      break;

    case eCCommand:
      hr = TRACE_QI(pIUnkObject, IID_ICommand, &pIUnknown);
      break;

    case eCSession:
      hr = TRACE_QI(pIUnkObject, IID_IOpenRowset, &pIUnknown);
      break;

    case eCMultipleResults:
      hr = TRACE_QI(pIUnkObject, IID_IMultipleResults, &pIUnknown);
      break;

    case eCEnumerator:
      hr = TRACE_QI(pIUnkObject, IID_ISourcesRowset, &pIUnknown);
      break;

    case eCBinder:
      hr = TRACE_QI(pIUnkObject, IID_IBindResource, &pIUnknown);
      break;

    case eCDataSource:
      //IDBInitialize is no longer enough to fully indentify wither the object returned
      //is a DataSource or not.  Other objects also have these: ie: Enumerator, Binder, etc
      if(SUCCEEDED(hr = TRACE_QI(pIUnkObject, IID_IDBInitialize, &pIUnknown)))
      {
        TRACE_RELEASE(pIUnknown, L"IDBInitialize");
        hr = TRACE_QI(pIUnkObject, IID_IPersist, &pIUnknown);
      }
      break;

    case eCServiceComp:
      hr = TRACE_QI(pIUnkObject, IID_IDataInitialize, &pIUnknown);
      break;

    case eCDataLinks:
      hr = TRACE_QI(pIUnkObject, IID_IDBPromptInitialize, &pIUnknown);
      break;

    case eCStream:
      //Some providers for some reason may not support the inherited ISequentialStream interface
      if(FAILED(hr = TRACE_QI(pIUnkObject, IID_ISequentialStream, &pIUnknown)))
        hr = TRACE_QI(pIUnkObject, IID_IStream, &pIUnknown);
      break;

    case eCDataset:
      hr = TRACE_QI(pIUnkObject, IID_IMDDataset, &pIUnknown);
      break;

    case eCRowPosition:
      hr = TRACE_QI(pIUnkObject, IID_IRowPosition, &pIUnknown);
      break;

    case eCTransaction:
      hr = TRACE_QI(pIUnkObject, IID_ITransaction, &pIUnknown);
      break;

    case eCTransactionOptions:
      hr = TRACE_QI(pIUnkObject, IID_ITransactionOptions, &pIUnknown);
      break;

    case eCError:
      hr = TRACE_QI(pIUnkObject, IID_IErrorInfo, &pIUnknown);
      break;

    case eCCustomError:
      hr = TRACE_QI(pIUnkObject, IID_ISQLErrorInfo, &pIUnknown);
      break;

    case eCConnectionPoint:
      hr = TRACE_QI(pIUnkObject, IID_IConnectionPoint, &pIUnknown);
      break;

    default:
      hr = E_NOINTERFACE;
      break;
  };

  //If the object doesn't match the users guess we will need to try and determine what it really is...
  if(FAILED(hr))
  {
    //Since many objects support the same interface,
    //we need to actually QI for a "unique" interface on that object
    //to determine what type of object it really is...
    if(SUCCEEDED(hr = TRACE_QI(pIUnkObject, IID_IRow, &pIUnknown)))
      eSource = eCRow;
    else if(SUCCEEDED(hr = TRACE_QI(pIUnkObject, IID_IRowset, &pIUnknown)))
      eSource = eCRowset;
    else if(SUCCEEDED(hr = TRACE_QI(pIUnkObject, IID_ICommand, &pIUnknown)))
      eSource = eCCommand;
    else if(SUCCEEDED(hr = TRACE_QI(pIUnkObject, IID_IOpenRowset, &pIUnknown)))
      eSource = eCSession;
    else if(SUCCEEDED(hr = TRACE_QI(pIUnkObject, IID_IMultipleResults, &pIUnknown)))
      eSource = eCMultipleResults;
    else if(SUCCEEDED(hr = TRACE_QI(pIUnkObject, IID_ISourcesRowset, &pIUnknown)))
      eSource = eCEnumerator;
    else if(SUCCEEDED(hr = TRACE_QI(pIUnkObject, IID_IBindResource, &pIUnknown)))
      eSource = eCBinder;
    else if(SUCCEEDED(hr = TRACE_QI(pIUnkObject, IID_IDBProperties, &pIUnknown)))
      eSource = eCDataSource;
    else if(SUCCEEDED(hr = TRACE_QI(pIUnkObject, IID_IDataInitialize, &pIUnknown)))
      eSource = eCServiceComp;
    else if(SUCCEEDED(hr = TRACE_QI(pIUnkObject, IID_IDBPromptInitialize, &pIUnknown)))
      eSource = eCDataLinks;
    else if(SUCCEEDED(hr = TRACE_QI(pIUnkObject, IID_ISequentialStream, &pIUnknown)) || SUCCEEDED(hr = TRACE_QI(pIUnkObject, IID_IStream, &pIUnknown)))
      eSource = eCStream;
    else if(SUCCEEDED(hr = TRACE_QI(pIUnkObject, IID_IMDDataset, &pIUnknown)))
      eSource = eCDataset;
    else if(SUCCEEDED(hr = TRACE_QI(pIUnkObject, IID_IRowPosition, &pIUnknown)))
      eSource = eCRowPosition;
    else if(SUCCEEDED(hr = TRACE_QI(pIUnkObject, IID_ITransaction, &pIUnknown)))
      eSource = eCTransaction;
    else if(SUCCEEDED(hr = TRACE_QI(pIUnkObject, IID_ITransactionOptions, &pIUnknown)))
      eSource = eCTransactionOptions;
    else if(SUCCEEDED(hr = TRACE_QI(pIUnkObject, IID_IErrorInfo, &pIUnknown)))
      eSource = eCError;
    else if(SUCCEEDED(hr = TRACE_QI(pIUnkObject, IID_ISQLErrorInfo, &pIUnknown)))
      eSource = eCCustomError;
    else if(SUCCEEDED(hr = TRACE_QI(pIUnkObject, IID_IConnectionPoint, &pIUnknown)))
      eSource = eCConnectionPoint;
    else
      eSource = eCUnknown;
  }

  if(SUCCEEDED(hr))
    TRACE_RELEASE(pIUnknown, L"IUnknown");
  return eSource;
}

SOURCE GuidToSourceType ( REFGUID guidType )

Definition at line 1265 of file cbase.cpp.

{
  if(guidType == DBGUID_ROWSET)
    return eCRowset;
  else if(guidType == DBGUID_ROW)
    return eCRow;
  else if(guidType == DBGUID_COMMAND)
    return eCCommand;
  else if(guidType == DBGUID_SESSION)
    return eCSession;
  else if(guidType == DBGUID_DSO)
    return eCDataSource;
  else if(guidType == DBGUID_STREAM)
    return eCStream;

  return eCUnknown;
}

Variable Documentation

const IID IID_IAggregate
Generated on Wed Nov 13 2024 16:53:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/cbinder.cpp File Reference

  • Dataaccess
  • oledb
  • rowsetviewer

cbinder.cpp File Reference

#include "Headers.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/cbinder.h File Reference

  • Dataaccess
  • oledb
  • rowsetviewer
Classes

cbinder.h File Reference

Go to the source code of this file.

Classes

class CBinder
Generated on Wed Nov 13 2024 16:53:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/ccommand.cpp File Reference

  • Dataaccess
  • oledb
  • rowsetviewer

ccommand.cpp File Reference

#include "Headers.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/ccommand.h File Reference

  • Dataaccess
  • oledb
  • rowsetviewer
Classes

ccommand.h File Reference

#include "CRowset.h"

Go to the source code of this file.

Classes

class | CCommand
class | CParameters
Generated on Wed Nov 13 2024 16:53:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/cdatalinks.cpp File Reference

  • Dataaccess
  • oledb
  • rowsetviewer

cdatalinks.cpp File Reference

#include "Headers.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/cdatalinks.h File Reference

  • Dataaccess
  • oledb
  • rowsetviewer
Classes

cdatalinks.h File Reference

Go to the source code of this file.

Classes

class | CDataLinks
class | CServiceComp
Generated on Wed Nov 13 2024 16:53:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/cdataset.cpp File Reference

  • Dataaccess
  • oledb
  • rowsetviewer

cdataset.cpp File Reference

#include "Headers.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/cdataset.h File Reference

  • Dataaccess
  • oledb
  • rowsetviewer
Classes

cdataset.h File Reference

Go to the source code of this file.

Classes

class CDataset
Generated on Wed Nov 13 2024 16:53:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/cdatasource.cpp File Reference

  • Dataaccess
  • oledb
  • rowsetviewer

cdatasource.cpp File Reference

#include "Headers.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/cdatasource.h File Reference

  • Dataaccess
  • oledb
  • rowsetviewer
Classes

cdatasource.h File Reference

Go to the source code of this file.

Classes

class CDataSource
Generated on Wed Nov 13 2024 16:53:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/cdialog.cpp File Reference

  • Dataaccess
  • oledb
  • rowsetviewer
Defines | Enumerations | Functions

cdialog.cpp File Reference

#include "Headers.h"
#include "CMainWindow.h"

Go to the source code of this file.

Defines

#define | NOTSET -2

Enumerations

enum PROP_COLUMNS {
PROP_NAME, PROP_TYPE, PROP_VALUE, PROP_FLAGS,
PROP_DESC, PROP_COLID
}

Functions

WCHAR * | GetSchemaName (REFGUID guidSchema)

Define Documentation

#define NOTSET -2

Definition at line 35 of file cdialog.cpp.

Enumeration Type Documentation

enum PROP_COLUMNS
Enumerator:
PROP_NAME
PROP_TYPE
PROP_VALUE
PROP_FLAGS
PROP_DESC
PROP_COLID

Definition at line 25 of file cdialog.cpp.

{
  PROP_NAME,
  PROP_TYPE,
  PROP_VALUE,
  PROP_FLAGS,
  PROP_DESC,
  PROP_COLID
};

Function Documentation

WCHAR* GetSchemaName ( REFGUID guidSchema )

Definition at line 3803 of file cdialog.cpp.

{
  for(ULONG i=0; i<NUMELE(g_rgSchemaInfo); i++)
  {
    if(guidSchema == *(g_rgSchemaInfo[i].pguidSchema))
      return g_rgSchemaInfo[i].pwszSchemaName;
  }

  return NULL;
}

Generated on Wed Nov 13 2024 16:53:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/cdialog.h File Reference

  • Dataaccess
  • oledb
  • rowsetviewer
Classes | Defines | Typedefs | Functions

cdialog.h File Reference

#include "CDialogLite.h"
#include "Error.h"
#include "CEnum.h"
#include "List.h"
#include "CTrace.h"

Go to the source code of this file.

Classes

struct | _SCHEMAINFO
class | CAlterColumnDlg
class | CAlterIndexDlg
class | CAlterTableDlg
class | CComboBoxGuid
class | CComboBoxString
class | CConstraintDlg
class | CDSLContextBox
class | CEditValueDlg
class | CExecuteParamDlg
class | CFullConnect
class | CFullConnectOptions
class | CFullConnectProperties
class | CFullConnectProvider
class | CFullConnectSecurity
class | CInitStringBox
class | CInterfaceDlg
class | CMultipleResultsDlg
class | CPropertiesDlg
class | CRowsetViewerDlg
class | CSchemaDlg

Defines

#define | MAX_RECENTCONFIGS 10
#define | MAX_RECENTFILES 10
#define | MAX_RESTRICTIONS 7

Typedefs

typedef struct _SCHEMAINFO | SCHEMAINFO

Functions

WCHAR * | GetSchemaName (REFGUID guidSchema)

Define Documentation

#define MAX_RECENTCONFIGS 10

Definition at line 41 of file cdialog.h.

#define MAX_RECENTFILES 10

Definition at line 42 of file cdialog.h.

#define MAX_RESTRICTIONS 7

Definition at line 40 of file cdialog.h.

Typedef Documentation

typedef struct _SCHEMAINFO SCHEMAINFO

Function Documentation

WCHAR* GetSchemaName ( REFGUID guidSchema )

Definition at line 3803 of file cdialog.cpp.

{
  for(ULONG i=0; i<NUMELE(g_rgSchemaInfo); i++)
  {
    if(guidSchema == *(g_rgSchemaInfo[i].pguidSchema))
      return g_rgSchemaInfo[i].pwszSchemaName;
  }

  return NULL;
}

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/cdialoglite.cpp File Reference

  • Dataaccess
  • oledb
  • rowsetviewer
Functions | Variables

cdialoglite.cpp File Reference

#include "Headers.h"

Go to the source code of this file.

Functions

BOOL | DisplayContextMenu (HWND hWnd, UINT iID, REFPOINTS rPts, HWND hWndParent, BOOL fRelCords)
LRESULT | DisplayDialog (UINT uID, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM lParam)
CAppLite * GetAppLite ()
INDEX | LV_FindItem (HWND hWnd, LPARAM lParam, INDEX iStart)
LRESULT | LV_GetAllItems (HWND hWnd, INDEX *pcItems, INDEX **prgItems, LPARAM **prgParams)
INT | LV_GetItemImage (HWND hWnd, INDEX iItem, INDEX iSubItem)
LPARAM | LV_GetItemParam (HWND hWnd, INDEX iItem, INDEX iSubItem)
UINT | LV_GetItemState (HWND hWnd, INDEX iItem, UINT iMask)
INDEX | LV_GetItemText (HWND hWnd, INDEX iItem, INDEX iSubItem, WCHAR *pwszName, ULONG ulMaxSize)
LRESULT | LV_GetSelItems (HWND hWnd, INDEX *pcItems, INDEX **prgSelItems, LPARAM **prgSelParams)
INDEX | LV_InsertColumn (HWND hWnd, INDEX iColumn, WCHAR *wszName, INT iImage)
INDEX | LV_InsertItem (HWND hWnd, INDEX iItem, INDEX iSubItem, WCHAR *wszName, LPARAM lParam, INT iImage, UINT iState, UINT iStateMask)
BOOL | LV_SetItemImage (HWND hWnd, INDEX iItem, INDEX iSubItem, INT iImage)
BOOL | LV_SetItemParam (HWND hWnd, INDEX iItem, INDEX iSubItem, LPARAM lParam)
BOOL | LV_SetItemState (HWND hWnd, INDEX iItem, INDEX iSubItem, UINT iState, UINT iStateMask)
BOOL | LV_SetItemText (HWND hWnd, INDEX iItem, INDEX iSubItem, WCHAR *pwszName)
void | SetAppLite (CAppLite *pCAppLite)
STDMETHODIMP_ (ULONG) CDropObject
HTREEITEM | TV_FindItem (HWND hWnd, HTREEITEM hParent, WCHAR *wszName)
LPARAM | TV_GetItemParam (HWND hWnd, HTREEITEM hItem)
BOOL | TV_GetItemText (HWND hWnd, HTREEITEM hItem, WCHAR *pwszBuffer, LONG ulMaxSize)
HTREEITEM | TV_InsertItem (HWND hWnd, HTREEITEM hParent, HTREEITEM hInsAfter, WCHAR *wszName, LPARAM lParam, INT iImage, INT iSelectedImage, UINT iState, UINT iStateMask)
BOOL | TV_SetItemState (HWND hWnd, HTREEITEM hItem, UINT iState, UINT iStateMask)
int PASCAL | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

Variables

CAppLite * | g_pCAppLite = NULL

Function Documentation

BOOL DisplayContextMenu | ( | HWND | hWnd,
 |  | UINT | iID,
 |  | REFPOINTS | rPts,
 |  | HWND | hWndParent,
 |  | BOOL | fRelCords
 | ) |  |

Definition at line 5564 of file cdialoglite.cpp.

{
  //Load the SubMenu
  HMENU hMenu = LoadMenu(GetAppLite()->m_hInstance, MAKEINTRESOURCE(iID));
  HMENU hSubMenu = GetSubMenu(hMenu, 0);

  RECT rect;
  GetWindowRect(hWnd, &rect);
  POINTS pts = rPts;  //Make a copy to modify const...

  //Coordinates might be Screen Coordinates or Relative
  if(fRelCords)
  {
    rect.top  += pts.y;
    rect.bottom += pts.y;
    rect.left += pts.x;
    rect.right  += pts.x;
  }

  //This message may have come from the keyboard
  //Just display at upper left corner
  if(pts.x < rect.left || pts.x > rect.right || pts.y < rect.top || pts.y > rect.bottom)
  {
    pts.x = (SHORT)rect.left + 5;
    pts.y = (SHORT)rect.top + 5;
  }

  //Display SubMenu
  //Wants (x,y) in Screen Coordinates
  BOOL bResult = TrackPopupMenu(hSubMenu,
          TPM_LEFTALIGN | TPM_RIGHTBUTTON,
          pts.x,
          pts.y,
          0,
          hWndParent,
          NULL);

  DestroyMenu(hSubMenu);
  DestroyMenu(hMenu);
  return bResult;
}

LRESULT DisplayDialog | ( | UINT | uID,
 |  | HWND | hWndParent,
 |  | DLGPROC | lpDialogFunc,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 5611 of file cdialoglite.cpp.

{
  //Display DialogBoxParam and dump any errors...
  LRESULT lResult = DialogBoxParam(GetAppLite()->m_hInstance, MAKEINTRESOURCE(uID), hWndParent, lpDialogFunc, lParam);
  GETLASTERROR(lResult != -1);

  return lResult;
}

CAppLite* GetAppLite ( )

Definition at line 25 of file cdialoglite.cpp.

{ return g_pCAppLite;   }

INDEX LV_FindItem | ( | HWND | hWnd,
 |  | LPARAM | lParam,
 |  | INDEX | iStart
 | ) |  |

Definition at line 5378 of file cdialoglite.cpp.

{
  //LVM_FINDITEM
  LV_FINDINFO lvFindInfo = { LVIF_PARAM, 0, lParam, 0, 0};
  return (INDEX)SendMessage(hWnd, LVM_FINDITEM, (WPARAM)iStart, (LPARAM)&lvFindInfo);
}

LRESULT LV_GetAllItems | ( | HWND | hWnd,
 |  | INDEX * | pcItems,
 |  | INDEX ** | prgItems,
 |  | LPARAM ** | prgParams
 | ) |  |

Definition at line 5345 of file cdialoglite.cpp.

{
  //Get the total Items
  HRESULT hr = S_OK;
  INDEX i=0;
  INDEX cItems = (INDEX)SendMessage(hWnd, LVM_GETITEMCOUNT, 0, 0);

  //Alloc Output Array
  if(prgItems)
    SAFE_ALLOC(*prgItems, INDEX, cItems);
  if(prgParams)
    SAFE_ALLOC(*prgParams, LPARAM, cItems);

  //Find all Items
  for(i=0; i<cItems; i++)
  {
    if(prgItems)
      (*prgItems)[i] = i;
    if(prgParams)
      (*prgParams)[i] = LV_GetItemParam(hWnd, i, 0);
  }

CLEANUP:
  if(pcItems)
    *pcItems = cItems;
  return cItems;
}

INT LV_GetItemImage | ( | HWND | hWnd,
 |  | INDEX | iItem,
 |  | INDEX | iSubItem
 | ) |  |

Definition at line 5285 of file cdialoglite.cpp.

{
  //LVM_GETITEM
  LV_ITEM lvItem = { LVIF_IMAGE, (INT)iItem, (INT)iSubItem, 0, 0, 0, 0, 0, 0, 0};
  SendMessage(hWnd, LVM_GETITEM, 0, (LPARAM)&lvItem);
  return lvItem.iImage;
}

LPARAM LV_GetItemParam | ( | HWND | hWnd,
 |  | INDEX | iItem,
 |  | INDEX | iSubItem
 | ) |  |

Definition at line 5297 of file cdialoglite.cpp.

{
  //LVM_GETITEM
  LV_ITEM lvItem = { LVIF_PARAM, (INT)iItem, (INT)iSubItem, 0, 0, 0, 0, 0, 0, 0};
  SendMessage(hWnd, LVM_GETITEM, 0, (LPARAM)&lvItem);
  return lvItem.lParam;
}

UINT LV_GetItemState | ( | HWND | hWnd,
 |  | INDEX | iItem,
 |  | UINT | iMask
 | ) |  |

Definition at line 5275 of file cdialoglite.cpp.

{
  //LVM_GETITEMSTATE
  return  (UINT)SendMessage(hWnd, LVM_GETITEMSTATE, (WPARAM)iItem, (LPARAM)iMask);
}

INDEX LV_GetItemText | ( | HWND | hWnd,
 |  | INDEX | iItem,
 |  | INDEX | iSubItem,
 |  | WCHAR * | pwszName,
 |  | ULONG | ulMaxSize
 | ) |  |

Definition at line 5246 of file cdialoglite.cpp.

{
  ASSERT(pwszName);
  pwszName[0] = wEOL;
  INDEX lReturn = 0;

  //LVM_GETITEMTEXT
  if(IsUnicodeOS())
  {
    LV_ITEMW lvItem = { LVIF_TEXT, (INT)iItem, (INT)iSubItem, 0, 0, pwszName, ulMaxSize, 0, 0, 0};
    lReturn = (INDEX)SendMessage(hWnd, LVM_GETITEMTEXTW, (WPARAM)iItem, (LPARAM)&lvItem);
  }
  else
  {
    CHAR szBuffer[MAX_NAME_LEN] = {0};

    LV_ITEMA lvItem = { LVIF_TEXT, (INT)iItem, (INT)iSubItem, 0, 0, szBuffer, MAX_NAME_LEN, 0, 0, 0};
    lReturn = (INDEX)SendMessage(hWnd, LVM_GETITEMTEXTA, (WPARAM)iItem, (LPARAM)&lvItem);

    ConvertToWCHAR(szBuffer, pwszName, ulMaxSize);
  }

  return lReturn;
}

LRESULT LV_GetSelItems | ( | HWND | hWnd,
 |  | INDEX * | pcItems,
 |  | INDEX ** | prgSelItems,
 |  | LPARAM ** | prgSelParams
 | ) |  |

Definition at line 5310 of file cdialoglite.cpp.

{
  //Get the total Selected Items
  HRESULT hr = S_OK;
  INDEX i,iSelItem =0;
  INDEX cItems = (INDEX)SendMessage(hWnd, LVM_GETSELECTEDCOUNT, 0, 0);

  //Alloc Output Array
  if(prgSelItems)
    SAFE_ALLOC(*prgSelItems, INDEX, cItems);
  if(prgSelParams)
    SAFE_ALLOC(*prgSelParams, LPARAM, cItems);

  //Find all params of Selected Items
  iSelItem = (INDEX)SendMessage(hWnd, LVM_GETNEXTITEM, (WPARAM)-1, (LPARAM)LVNI_SELECTED);
  for(i=0; i<cItems; i++)
  {
    if(prgSelItems)
      (*prgSelItems)[i] = iSelItem;
    if(prgSelParams)
      (*prgSelParams)[i] = LV_GetItemParam(hWnd, iSelItem, 0);
    iSelItem = (INDEX)SendMessage(hWnd, LVM_GETNEXTITEM, (WPARAM)iSelItem, (LPARAM)LVNI_SELECTED);
  }

CLEANUP:
  if(pcItems)
    *pcItems = cItems;
  return cItems;
}

INDEX LV_InsertColumn | ( | HWND | hWnd,
 |  | INDEX | iColumn,
 |  | WCHAR * | wszName,
 |  | INT | iImage
 | ) |  |

Definition at line 5101 of file cdialoglite.cpp.

{
  ULONG dwMask = LVCF_TEXT | LVCF_FMT | LVCF_SUBITEM;
  INT dwFmt = LVCFMT_LEFT;
  if(iImage != IMAGE_NONE)
  {
    dwMask |= LVCF_IMAGE;
    dwFmt |= LVCFMT_IMAGE;
  }

  //LVM_INSERTCOLUMN
  if(IsUnicodeOS())
  {
    //Setup LV_COLUMNINFO
    LV_COLUMNW lvColumnHeader = { dwMask, dwFmt, 0, wszName, 0, 0, iImage, 0};
    return (INDEX)SendMessage(hWnd, LVM_INSERTCOLUMNW, (WPARAM)iColumn, (LPARAM)&lvColumnHeader);
  }
  else
  {
    //Setup LV_COLUMNINFO
    CHAR szBuffer[MAX_NAME_LEN];
    LV_COLUMNA lvColumnHeader = { dwMask, dwFmt, 0, szBuffer, 0, 0, iImage, 0};
    ConvertToMBCS(wszName, szBuffer, MAX_NAME_LEN);
    return (INDEX)SendMessage(hWnd, LVM_INSERTCOLUMNA, (WPARAM)iColumn, (LPARAM)&lvColumnHeader);
  }
}

INDEX LV_InsertItem | ( | HWND | hWnd,
 |  | INDEX | iItem,
 |  | INDEX | iSubItem,
 |  | WCHAR * | wszName,
 |  | LPARAM | lParam,
 |  | INT | iImage,
 |  | UINT | iState,
 |  | UINT | iStateMask
 | ) |  |

Definition at line 5133 of file cdialoglite.cpp.

{
  //Calculate the Mask/flags
  ULONG dwMask = 0;
  if(wszName)
    dwMask |= LVIF_TEXT;
  if(iImage != IMAGE_NONE)
    dwMask |= LVIF_IMAGE;
  if(iState != STATE_NONE)
    dwMask |= LVIF_STATE;
  if(iSubItem == 0)
    dwMask |= LVIF_PARAM;

  if(IsUnicodeOS())
  {
    //LVM_INSERTITEM
    if(iSubItem==0)
    {
      LV_ITEMW lvItem = { dwMask, (INT)iItem, (INT)iSubItem, iState, iStateMask, wszName, 0, iImage, lParam, 0};
      return (INDEX)SendMessageW(hWnd, LVM_INSERTITEMW, 0, (LPARAM)&lvItem);
    }
    //LVM_SETITEM
    else
    {
      LV_ITEMW lvItem = { dwMask, (INT)iItem, (INT)iSubItem, iState, iStateMask, wszName, 0, iImage, lParam, 0};
      return (INDEX)SendMessageW(hWnd, LVM_SETITEMW, 0, (LPARAM)&lvItem);
    }
  }
  else
  {
    CHAR szBuffer[MAX_QUERY_LEN+1];
    ConvertToMBCS(wszName, szBuffer, MAX_QUERY_LEN);

    //LVM_INSERTITEM
    if(iSubItem==0)
    {
      LV_ITEMA lvItem = { dwMask, (INT)iItem, (INT)iSubItem, iState, iStateMask, szBuffer, 0, iImage, lParam, 0};
      return (INDEX)SendMessageA(hWnd, LVM_INSERTITEMA, 0, (LPARAM)&lvItem);
    }
    //LVM_SETITEM
    else
    {
      LV_ITEMA lvItem = { dwMask, (INT)iItem, (INT)iSubItem, iState, iStateMask, szBuffer, 0, iImage, lParam, 0};
      return (INDEX)SendMessageA(hWnd, LVM_SETITEMA, 0, (LPARAM)&lvItem);
    }
  }

  return LVM_ERR;
}

BOOL LV_SetItemImage | ( | HWND | hWnd,
 |  | INDEX | iItem,
 |  | INDEX | iSubItem,
 |  | INT | iImage
 | ) |  |

Definition at line 5223 of file cdialoglite.cpp.

{
  //LVM_SETITEM (With IMAGE mask)
  LV_ITEM lvItem = { LVIF_IMAGE, (INT)iItem, (INT)iSubItem, 0, 0, NULL, 0, iImage, 0, 0};
  return (BOOL)SendMessage(hWnd, LVM_SETITEM, 0, (LPARAM)&lvItem);
}

BOOL LV_SetItemParam | ( | HWND | hWnd,
 |  | INDEX | iItem,
 |  | INDEX | iSubItem,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 5234 of file cdialoglite.cpp.

{
  //LVM_SETITEM (With IMAGE mask)
  LV_ITEM lvItem = { LVIF_PARAM, (INT)iItem, (INT)iSubItem, 0, 0, NULL, 0, 0, lParam, 0};
  return (BOOL)SendMessage(hWnd, LVM_SETITEM, 0, (LPARAM)&lvItem);
}

BOOL LV_SetItemState | ( | HWND | hWnd,
 |  | INDEX | iItem,
 |  | INDEX | iSubItem,
 |  | UINT | iState,
 |  | UINT | iStateMask
 | ) |  |

Definition at line 5212 of file cdialoglite.cpp.

{
  //LVM_SETITEM
  LV_ITEM lvItem = { LVIF_STATE, (INT)iItem, (INT)iSubItem, iState, iStateMask, NULL, 0, 0, 0, 0};
  return (BOOL)SendMessage(hWnd, LVM_SETITEMSTATE, (WPARAM)iItem, (LPARAM)&lvItem);
}

BOOL LV_SetItemText | ( | HWND | hWnd,
 |  | INDEX | iItem,
 |  | INDEX | iSubItem,
 |  | WCHAR * | pwszName
 | ) |  |

Definition at line 5188 of file cdialoglite.cpp.

{
  if(IsUnicodeOS())
  {
    //LVM_SETITEM
    LV_ITEMW lvItem = { LVIF_TEXT, (INT)iItem, (INT)iSubItem, 0, 0, pwszName, 0, 0, 0, 0};
    return (BOOL)SendMessage(hWnd, LVM_SETITEMTEXTW, (WPARAM)iItem, (LPARAM)&lvItem);
  }
  else
  {
    CHAR szBuffer[MAX_NAME_LEN+1];
    ConvertToMBCS(pwszName, szBuffer, MAX_NAME_LEN);

    //LVM_SETITEM
    LV_ITEMA lvItem = { LVIF_TEXT, (INT)iItem, (INT)iSubItem, 0, 0, szBuffer, 0, 0, 0, 0};
    return (BOOL)SendMessageA(hWnd, LVM_SETITEMTEXTA, (WPARAM)iItem, (LPARAM)&lvItem);
  }
}

void SetAppLite ( CAppLite * pCAppLite )

Definition at line 26 of file cdialoglite.cpp.

{ g_pCAppLite = pCAppLite;  }

STDMETHODIMP_ ( ULONG )

Definition at line 5908 of file cdialoglite.cpp.

{
  //Release
  if(--m_cRef)
    return m_cRef;

  delete this;
  return 0;
}

HTREEITEM TV_FindItem | ( | HWND | hWnd,
 |  | HTREEITEM | hParent,
 |  | WCHAR * | wszName
 | ) |  |

Definition at line 5485 of file cdialoglite.cpp.

{
  ASSERT(hWnd);
  ASSERT(wszName);
  CHAR szBuffer[MAX_NAME_LEN];

  //Convert to MBCS
  CHAR szName[MAX_NAME_LEN];
  ConvertToMBCS(wszName, szName, MAX_NAME_LEN);

  TVITEMA tvItemA = { TVIF_TEXT, 0, 0, 0, szBuffer, MAX_NAME_LEN, 0, 0, 0, 0};
  tvItemA.hItem = (HTREEITEM)SendMessage(hWnd, TVM_GETNEXTITEM, (WPARAM)TVGN_CHILD, (LPARAM)hParent);
  while(tvItemA.hItem)
  {
    //Try to find this string in the Tree
    if(SendMessage(hWnd, TVM_GETITEM, 0, (LPARAM)&tvItemA))
    {
      if(strcmp(szName, tvItemA.pszText)==0)
        return tvItemA.hItem;
    }

    //Otherwise get the NextItem and continue...
    tvItemA.hItem = (HTREEITEM)SendMessage(hWnd, TVM_GETNEXTITEM, (WPARAM)TVGN_NEXT, (LPARAM)tvItemA.hItem);
  }

  return NULL;
}

LPARAM TV_GetItemParam | ( | HWND | hWnd,
 |  | HTREEITEM | hItem
 | ) |  |

Definition at line 5453 of file cdialoglite.cpp.

{
  //no-op
  if(hItem == NULL)
    return NULL;

  TVITEM tvItem = { TVIF_PARAM, hItem, 0, 0, NULL, 0, 0, 0, 0, 0};

  //GetItem
  SendMessage(hWnd, TVM_GETITEM, 0, (LPARAM)&tvItem);

  //return the lParam
  return tvItem.lParam;
}

BOOL TV_GetItemText | ( | HWND | hWnd,
 |  | HTREEITEM | hItem,
 |  | WCHAR * | pwszBuffer,
 |  | LONG | ulMaxSize
 | ) |  |

Definition at line 5425 of file cdialoglite.cpp.

{
  ASSERT(pwszBuffer);
  BOOL bReturn = 0;

  if(IsUnicodeOS())
  {
    TVITEMW tvItem = { TVIF_TEXT, hItem, 0, 0, pwszBuffer, ulMaxSize, 0, 0, 0, 0};
    bReturn = (BOOL)SendMessage(hWnd, TVM_GETITEMW, 0, (LPARAM)&tvItem);
  }
  else
  {
    CHAR szBuffer[MAX_NAME_LEN] = {0};

    TVITEMA tvItem = { TVIF_TEXT, hItem, 0, 0, szBuffer, MAX_NAME_LEN, 0, 0, 0, 0};
    bReturn = (BOOL)SendMessage(hWnd, TVM_GETITEMA, 0, (LPARAM)&tvItem);

    ConvertToWCHAR(szBuffer, pwszBuffer, ulMaxSize);
  }

  return bReturn;
}

HTREEITEM TV_InsertItem | ( | HWND | hWnd,
 |  | HTREEITEM | hParent,
 |  | HTREEITEM | hInsAfter,
 |  | WCHAR * | wszName,
 |  | LPARAM | lParam,
 |  | INT | iImage,
 |  | INT | iSelectedImage,
 |  | UINT | iState,
 |  | UINT | iStateMask
 | ) |  |

Definition at line 5390 of file cdialoglite.cpp.

{
  //Calculate the Mask/flags
  ULONG dwMask = 0;
  if(wszName)
    dwMask |= LVIF_TEXT;
  if(iImage != IMAGE_NONE)
    dwMask |= (LVIF_IMAGE | TVIF_SELECTEDIMAGE);
  if(iState != STATE_NONE)
    dwMask |= LVIF_STATE;
  if(lParam != PARAM_NONE)
    dwMask |= LVIF_PARAM;

  if(IsUnicodeOS())
  {
    //TVM_INSERTITEM
    TV_INSERTSTRUCTW tvInsertStruct = { hParent, hInsAfter, { dwMask, 0, iState, iStateMask, wszName, 0, iImage, iSelectedImage, 0, lParam} };
    return (HTREEITEM)SendMessageW(hWnd, TVM_INSERTITEMW, 0, (LPARAM)&tvInsertStruct);
  }
  else
  {
    CHAR szBuffer[MAX_NAME_LEN+1];
    ConvertToMBCS(wszName, szBuffer, MAX_NAME_LEN);

    //TVM_INSERTITEM
    TV_INSERTSTRUCTA tvInsertStruct = { hParent, hInsAfter, { dwMask, 0, iState, iStateMask, szBuffer, 0, iImage, iSelectedImage, 0, lParam} };
    return (HTREEITEM)SendMessageA(hWnd, TVM_INSERTITEMA, 0, (LPARAM)&tvInsertStruct);
  }
}

BOOL TV_SetItemState | ( | HWND | hWnd,
 |  | HTREEITEM | hItem,
 |  | UINT | iState,
 |  | UINT | iStateMask
 | ) |  |

Definition at line 5473 of file cdialoglite.cpp.

{
  //TVM_SETITEM
  TVITEM tvItem = { TVIF_STATE, hItem, iState, iStateMask, NULL, 0, 0, 0, 0, 0};
  return (BOOL)SendMessage(hWnd, TVM_SETITEM, 0, (LPARAM)&tvItem);
}

int PASCAL WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 34 of file cdialoglite.cpp.

{
  //Should have a static CAppLite object at this point...
  CAppLite* pCAppLite = GetAppLite();
  ASSERT(pCAppLite);

  //Create CWndApp
  if(!pCAppLite->AppInitialize(hInstance, hPrevInstance, lpCmdLine, nCmdShow))
    return -1;

  //Init
  if(!pCAppLite->InitInstance())
    return pCAppLite->ExitInstance();

  //Make sure we have a CMainWindow setup at this point...
  if(!CAppLite::m_pCMainWindow || !CAppLite::m_pCMainWindow->m_hWnd)
    return pCAppLite->ExitInstance();

  //Run
  if(!pCAppLite->Run())
    return pCAppLite->ExitInstance();

  //Exit
  return pCAppLite->ExitInstance();
}

Variable Documentation

CAppLite* g_pCAppLite = NULL

Definition at line 24 of file cdialoglite.cpp.

Generated on Wed Nov 13 2024 16:53:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/cdialoglite.h File Reference

  • Dataaccess
  • oledb
  • rowsetviewer
Classes | Defines | Typedefs | Enumerations | Functions | Variables

cdialoglite.h File Reference

#include <richedit.h>
#include <exdisp.h>
#include <exdispid.h>
#include <mshtmdid.h>
#include <msxml.h>
#include "Error.h"
#include "Error.h"

Go to the source code of this file.

Classes

class | _NoAddRefReleaseQIOnSmartPtr< T >
class | CAppLite
class | CButtonLite
class | CCmdLineLite
class | CComboBoxEx
class | CComboBoxLite
class | CComWSTR
class | CConsole
class | CDialogLite
class | CDropObject
class | CDropSource
class | CDropTarget
class | CEditBoxLite
class | CFileLite
class | CFrameWndLite
class | CListBoxLite
class | CListViewLite
class | CMDIChildLite
class | CMDIFrameLite
class | COleClient
class | CPropPageLite
class | CPropSheetLite
class | CRichEditLite
class | CScrollBarLite
class | CSmartPtr< T >
class | CSmartPtrTrace< T >
class | CSplitterLite
class | CStatusBarLite
class | CTabLite
class | CToolBarLite
class | CTreeViewLite
class | CWaitCursor
class | CWebBrowser
class | CWndLite
class | CXmlDOM

Defines

#define | BST2STATE(dwValue) ((dwValue) ? BST_CHECKED : BST_UNCHECKED)
#define | BST3STATE(dwValue) ((dwValue) ? ((dwValue) == BST_INDETERMINATE ? (dwValue) : BST_CHECKED) : BST_UNCHECKED)
#define | ON_COMMAND(ID, func) case ID: (func); return TRUE;
#define | ON_COMMAND_UI(ID, flags) case ID: (*pdwFlags = (flags)); return TRUE;
#define | ON_COMMAND_UI_CHECKED(ID, func) ON_COMMAND_UI(ID, (func) ? MF_CHECKED : MF_UNCHECKED)
#define | ON_COMMAND_UI_ENABLED(ID, func) ON_COMMAND_UI(ID, (func) ? MF_ENABLED : MF_GRAYED)
#define | REFPOINTS const POINTS &
#define | REFRECT const RECT &
#define | STATEIMAGEINDEX(iImage) INDEXTOSTATEIMAGEMASK(iImage+1)

Typedefs

typedef LRESULT | INDEX

Enumerations

enum COLORA {
CA_NORMAL = 0, CA_BOLD = CFM_BOLD, CA_ITALIC = CFM_ITALIC, CA_UNDERLINE = CFM_UNDERLINE,
CA_STRIKEOUT = CFM_STRIKEOUT, CA_PROTECTED = CFM_PROTECTED, CA_LINK = CFM_LINK, CA_AUTO_COLOR = CFE_AUTOCOLOR,
CA_COLOR = CFM_COLOR, CA_DISABLE = CFM_CHARSET
}
enum | OUTPUT_SPECIAL { NEWLINE = 00000001 }

Functions

BOOL | DisplayContextMenu (HWND hWnd, UINT iID, REFPOINTS pts, HWND hWndParent, BOOL fRelCords=FALSE)
LRESULT | DisplayDialog (UINT uID, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM lParam)
CAppLite * GetAppLite ()
INDEX | LV_FindItem (HWND hWnd, LPARAM lParam, INDEX iStart=-1)
LRESULT | LV_GetAllItems (HWND hWnd, INDEX *pcItems=NULL, INDEX **prgItems=NULL, LPARAM **prgParams=NULL)
INT | LV_GetItemImage (HWND hWnd, INDEX iItem, INDEX iSubItem)
LPARAM | LV_GetItemParam (HWND hWnd, INDEX iItem, INDEX iSubItem)
UINT | LV_GetItemState (HWND hWnd, INDEX iItem, UINT iMask=0)
INDEX | LV_GetItemText (HWND hWnd, INDEX iItem, INDEX iSubItem, WCHAR *pwszName, ULONG ulMaxSize)
LRESULT | LV_GetSelItems (HWND hWnd, INDEX *pcItems=NULL, INDEX **prgSelItems=NULL, LPARAM **prgSelParams=NULL)
INDEX | LV_InsertColumn (HWND hWnd, INDEX iColumn, WCHAR *wszName, INT iImage=IMAGE_NONE)
INDEX | LV_InsertItem (HWND hWnd, INDEX iItem, INDEX iSubItem, WCHAR *wszName, LPARAM lParam=PARAM_NONE, INT iImage=IMAGE_NONE, UINT iState=IMAGE_NONE, UINT iStateMask=IMAGE_NONE)
BOOL | LV_SetItemImage (HWND hWnd, INDEX iItem, INDEX iSubItem, INT iImage)
BOOL | LV_SetItemParam (HWND hWnd, INDEX iItem, INDEX iSubItem, LPARAM lParam)
BOOL | LV_SetItemState (HWND hWnd, INDEX iItem, INDEX iSubItem, UINT iState, UINT iStateMask)
BOOL | LV_SetItemText (HWND hWnd, INDEX iItem, INDEX iSubItem, WCHAR *pwszName)
void | SetAppLite (CAppLite *pCAppLite)
HTREEITEM | TV_FindItem (HWND hWnd, HTREEITEM hParent, WCHAR *wszName)
LPARAM | TV_GetItemParam (HWND hWnd, HTREEITEM hItem)
BOOL | TV_GetItemText (HWND hWnd, HTREEITEM hItem, WCHAR *pwszBuffer, LONG ulMaxSize)
HTREEITEM | TV_InsertItem (HWND hWnd, HTREEITEM hParent, HTREEITEM hInsAfter, WCHAR *wszName, LPARAM lParam=0, INT iImage=0, INT iSelectedImage=0, UINT iState=0, UINT iStateMask=0)
BOOL | TV_SetItemState (HWND hWnd, HTREEITEM hItem, UINT iState, UINT iStateMask)

Variables

const INDEX | INVALID_INDEX = -1

Define Documentation

#define BST2STATE ( dwValue ) ((dwValue) ? BST_CHECKED : BST_UNCHECKED)

Definition at line 30 of file cdialoglite.h.

#define BST3STATE ( dwValue ) ((dwValue) ? ((dwValue) == BST_INDETERMINATE ? (dwValue) : BST_CHECKED) : BST_UNCHECKED)

Definition at line 31 of file cdialoglite.h.

#define ON_COMMAND | ( | ID,
 |  | func |
 | ) |  | case ID: (func); return TRUE;

Definition at line 24 of file cdialoglite.h.

#define ON_COMMAND_UI | ( | ID,
 |  | flags |
 | ) |  | case ID: (*pdwFlags = (flags)); return TRUE;

Definition at line 25 of file cdialoglite.h.

#define ON_COMMAND_UI_CHECKED | ( | ID,
 |  | func |
 | ) |  | ON_COMMAND_UI(ID, (func) ? MF_CHECKED : MF_UNCHECKED)

Definition at line 27 of file cdialoglite.h.

#define ON_COMMAND_UI_ENABLED | ( | ID,
 |  | func |
 | ) |  | ON_COMMAND_UI(ID, (func) ? MF_ENABLED : MF_GRAYED)

Definition at line 26 of file cdialoglite.h.

#define REFPOINTS const POINTS &

Definition at line 55 of file cdialoglite.h.

#define REFRECT const RECT &

Definition at line 56 of file cdialoglite.h.

#define STATEIMAGEINDEX ( iImage ) INDEXTOSTATEIMAGEMASK(iImage+1)

Definition at line 29 of file cdialoglite.h.

Typedef Documentation

typedef LRESULT INDEX

Definition at line 34 of file cdialoglite.h.

Enumeration Type Documentation

enum COLORA
Enumerator:
CA_NORMAL
CA_BOLD
CA_ITALIC
CA_UNDERLINE
CA_STRIKEOUT
CA_PROTECTED
CA_LINK
CA_AUTO_COLOR
CA_COLOR
CA_DISABLE

Definition at line 455 of file cdialoglite.h.

{
  CA_NORMAL     = 0,
  CA_BOLD       = CFM_BOLD,
  CA_ITALIC     = CFM_ITALIC,
  CA_UNDERLINE    = CFM_UNDERLINE,
  CA_STRIKEOUT    = CFM_STRIKEOUT,
  CA_PROTECTED    = CFM_PROTECTED,
  CA_LINK       = CFM_LINK,
  CA_AUTO_COLOR   = CFE_AUTOCOLOR,
  CA_COLOR      = CFM_COLOR,
  CA_DISABLE      = CFM_CHARSET,
};

enum OUTPUT_SPECIAL
Enumerator:
NEWLINE

Definition at line 469 of file cdialoglite.h.

{
  NEWLINE       = 00000001,
};

Function Documentation

BOOL DisplayContextMenu | ( | HWND | hWnd,
 |  | UINT | iID,
 |  | REFPOINTS | pts,
 |  | HWND | hWndParent,
 |  | BOOL | fRelCords = FALSE
 | ) |  |

Definition at line 5564 of file cdialoglite.cpp.

{
  //Load the SubMenu
  HMENU hMenu = LoadMenu(GetAppLite()->m_hInstance, MAKEINTRESOURCE(iID));
  HMENU hSubMenu = GetSubMenu(hMenu, 0);

  RECT rect;
  GetWindowRect(hWnd, &rect);
  POINTS pts = rPts;  //Make a copy to modify const...

  //Coordinates might be Screen Coordinates or Relative
  if(fRelCords)
  {
    rect.top  += pts.y;
    rect.bottom += pts.y;
    rect.left += pts.x;
    rect.right  += pts.x;
  }

  //This message may have come from the keyboard
  //Just display at upper left corner
  if(pts.x < rect.left || pts.x > rect.right || pts.y < rect.top || pts.y > rect.bottom)
  {
    pts.x = (SHORT)rect.left + 5;
    pts.y = (SHORT)rect.top + 5;
  }

  //Display SubMenu
  //Wants (x,y) in Screen Coordinates
  BOOL bResult = TrackPopupMenu(hSubMenu,
          TPM_LEFTALIGN | TPM_RIGHTBUTTON,
          pts.x,
          pts.y,
          0,
          hWndParent,
          NULL);

  DestroyMenu(hSubMenu);
  DestroyMenu(hMenu);
  return bResult;
}

LRESULT DisplayDialog | ( | UINT | uID,
 |  | HWND | hWndParent,
 |  | DLGPROC | lpDialogFunc,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 5611 of file cdialoglite.cpp.

{
  //Display DialogBoxParam and dump any errors...
  LRESULT lResult = DialogBoxParam(GetAppLite()->m_hInstance, MAKEINTRESOURCE(uID), hWndParent, lpDialogFunc, lParam);
  GETLASTERROR(lResult != -1);

  return lResult;
}

CAppLite* GetAppLite ( )

Definition at line 25 of file cdialoglite.cpp.

{ return g_pCAppLite;   }

INDEX LV_FindItem | ( | HWND | hWnd,
 |  | LPARAM | lParam,
 |  | INDEX | iStart = -1
 | ) |  |

Definition at line 5378 of file cdialoglite.cpp.

{
  //LVM_FINDITEM
  LV_FINDINFO lvFindInfo = { LVIF_PARAM, 0, lParam, 0, 0};
  return (INDEX)SendMessage(hWnd, LVM_FINDITEM, (WPARAM)iStart, (LPARAM)&lvFindInfo);
}

LRESULT LV_GetAllItems | ( | HWND | hWnd,
 |  | INDEX * | pcItems = NULL,
 |  | INDEX ** | prgItems = NULL,
 |  | LPARAM ** | prgParams = NULL
 | ) |  |

Definition at line 5345 of file cdialoglite.cpp.

{
  //Get the total Items
  HRESULT hr = S_OK;
  INDEX i=0;
  INDEX cItems = (INDEX)SendMessage(hWnd, LVM_GETITEMCOUNT, 0, 0);

  //Alloc Output Array
  if(prgItems)
    SAFE_ALLOC(*prgItems, INDEX, cItems);
  if(prgParams)
    SAFE_ALLOC(*prgParams, LPARAM, cItems);

  //Find all Items
  for(i=0; i<cItems; i++)
  {
    if(prgItems)
      (*prgItems)[i] = i;
    if(prgParams)
      (*prgParams)[i] = LV_GetItemParam(hWnd, i, 0);
  }

CLEANUP:
  if(pcItems)
    *pcItems = cItems;
  return cItems;
}

INT LV_GetItemImage | ( | HWND | hWnd,
 |  | INDEX | iItem,
 |  | INDEX | iSubItem
 | ) |  |

Definition at line 5285 of file cdialoglite.cpp.

{
  //LVM_GETITEM
  LV_ITEM lvItem = { LVIF_IMAGE, (INT)iItem, (INT)iSubItem, 0, 0, 0, 0, 0, 0, 0};
  SendMessage(hWnd, LVM_GETITEM, 0, (LPARAM)&lvItem);
  return lvItem.iImage;
}

LPARAM LV_GetItemParam | ( | HWND | hWnd,
 |  | INDEX | iItem,
 |  | INDEX | iSubItem
 | ) |  |

Definition at line 5297 of file cdialoglite.cpp.

{
  //LVM_GETITEM
  LV_ITEM lvItem = { LVIF_PARAM, (INT)iItem, (INT)iSubItem, 0, 0, 0, 0, 0, 0, 0};
  SendMessage(hWnd, LVM_GETITEM, 0, (LPARAM)&lvItem);
  return lvItem.lParam;
}

UINT LV_GetItemState | ( | HWND | hWnd,
 |  | INDEX | iItem,
 |  | UINT | iMask = 0
 | ) |  |

Definition at line 5275 of file cdialoglite.cpp.

{
  //LVM_GETITEMSTATE
  return  (UINT)SendMessage(hWnd, LVM_GETITEMSTATE, (WPARAM)iItem, (LPARAM)iMask);
}

INDEX LV_GetItemText | ( | HWND | hWnd,
 |  | INDEX | iItem,
 |  | INDEX | iSubItem,
 |  | WCHAR * | pwszName,
 |  | ULONG | ulMaxSize
 | ) |  |

Definition at line 5246 of file cdialoglite.cpp.

{
  ASSERT(pwszName);
  pwszName[0] = wEOL;
  INDEX lReturn = 0;

  //LVM_GETITEMTEXT
  if(IsUnicodeOS())
  {
    LV_ITEMW lvItem = { LVIF_TEXT, (INT)iItem, (INT)iSubItem, 0, 0, pwszName, ulMaxSize, 0, 0, 0};
    lReturn = (INDEX)SendMessage(hWnd, LVM_GETITEMTEXTW, (WPARAM)iItem, (LPARAM)&lvItem);
  }
  else
  {
    CHAR szBuffer[MAX_NAME_LEN] = {0};

    LV_ITEMA lvItem = { LVIF_TEXT, (INT)iItem, (INT)iSubItem, 0, 0, szBuffer, MAX_NAME_LEN, 0, 0, 0};
    lReturn = (INDEX)SendMessage(hWnd, LVM_GETITEMTEXTA, (WPARAM)iItem, (LPARAM)&lvItem);

    ConvertToWCHAR(szBuffer, pwszName, ulMaxSize);
  }

  return lReturn;
}

LRESULT LV_GetSelItems | ( | HWND | hWnd,
 |  | INDEX * | pcItems = NULL,
 |  | INDEX ** | prgSelItems = NULL,
 |  | LPARAM ** | prgSelParams = NULL
 | ) |  |

Definition at line 5310 of file cdialoglite.cpp.

{
  //Get the total Selected Items
  HRESULT hr = S_OK;
  INDEX i,iSelItem =0;
  INDEX cItems = (INDEX)SendMessage(hWnd, LVM_GETSELECTEDCOUNT, 0, 0);

  //Alloc Output Array
  if(prgSelItems)
    SAFE_ALLOC(*prgSelItems, INDEX, cItems);
  if(prgSelParams)
    SAFE_ALLOC(*prgSelParams, LPARAM, cItems);

  //Find all params of Selected Items
  iSelItem = (INDEX)SendMessage(hWnd, LVM_GETNEXTITEM, (WPARAM)-1, (LPARAM)LVNI_SELECTED);
  for(i=0; i<cItems; i++)
  {
    if(prgSelItems)
      (*prgSelItems)[i] = iSelItem;
    if(prgSelParams)
      (*prgSelParams)[i] = LV_GetItemParam(hWnd, iSelItem, 0);
    iSelItem = (INDEX)SendMessage(hWnd, LVM_GETNEXTITEM, (WPARAM)iSelItem, (LPARAM)LVNI_SELECTED);
  }

CLEANUP:
  if(pcItems)
    *pcItems = cItems;
  return cItems;
}

INDEX LV_InsertColumn | ( | HWND | hWnd,
 |  | INDEX | iColumn,
 |  | WCHAR * | wszName,
 |  | INT | iImage = IMAGE_NONE
 | ) |  |

Definition at line 5101 of file cdialoglite.cpp.

{
  ULONG dwMask = LVCF_TEXT | LVCF_FMT | LVCF_SUBITEM;
  INT dwFmt = LVCFMT_LEFT;
  if(iImage != IMAGE_NONE)
  {
    dwMask |= LVCF_IMAGE;
    dwFmt |= LVCFMT_IMAGE;
  }

  //LVM_INSERTCOLUMN
  if(IsUnicodeOS())
  {
    //Setup LV_COLUMNINFO
    LV_COLUMNW lvColumnHeader = { dwMask, dwFmt, 0, wszName, 0, 0, iImage, 0};
    return (INDEX)SendMessage(hWnd, LVM_INSERTCOLUMNW, (WPARAM)iColumn, (LPARAM)&lvColumnHeader);
  }
  else
  {
    //Setup LV_COLUMNINFO
    CHAR szBuffer[MAX_NAME_LEN];
    LV_COLUMNA lvColumnHeader = { dwMask, dwFmt, 0, szBuffer, 0, 0, iImage, 0};
    ConvertToMBCS(wszName, szBuffer, MAX_NAME_LEN);
    return (INDEX)SendMessage(hWnd, LVM_INSERTCOLUMNA, (WPARAM)iColumn, (LPARAM)&lvColumnHeader);
  }
}

INDEX LV_InsertItem | ( | HWND | hWnd,
 |  | INDEX | iItem,
 |  | INDEX | iSubItem,
 |  | WCHAR * | wszName,
 |  | LPARAM | lParam = PARAM_NONE,
 |  | INT | iImage = IMAGE_NONE,
 |  | UINT | iState = IMAGE_NONE,
 |  | UINT | iStateMask = IMAGE_NONE
 | ) |  |

Definition at line 5133 of file cdialoglite.cpp.

{
  //Calculate the Mask/flags
  ULONG dwMask = 0;
  if(wszName)
    dwMask |= LVIF_TEXT;
  if(iImage != IMAGE_NONE)
    dwMask |= LVIF_IMAGE;
  if(iState != STATE_NONE)
    dwMask |= LVIF_STATE;
  if(iSubItem == 0)
    dwMask |= LVIF_PARAM;

  if(IsUnicodeOS())
  {
    //LVM_INSERTITEM
    if(iSubItem==0)
    {
      LV_ITEMW lvItem = { dwMask, (INT)iItem, (INT)iSubItem, iState, iStateMask, wszName, 0, iImage, lParam, 0};
      return (INDEX)SendMessageW(hWnd, LVM_INSERTITEMW, 0, (LPARAM)&lvItem);
    }
    //LVM_SETITEM
    else
    {
      LV_ITEMW lvItem = { dwMask, (INT)iItem, (INT)iSubItem, iState, iStateMask, wszName, 0, iImage, lParam, 0};
      return (INDEX)SendMessageW(hWnd, LVM_SETITEMW, 0, (LPARAM)&lvItem);
    }
  }
  else
  {
    CHAR szBuffer[MAX_QUERY_LEN+1];
    ConvertToMBCS(wszName, szBuffer, MAX_QUERY_LEN);

    //LVM_INSERTITEM
    if(iSubItem==0)
    {
      LV_ITEMA lvItem = { dwMask, (INT)iItem, (INT)iSubItem, iState, iStateMask, szBuffer, 0, iImage, lParam, 0};
      return (INDEX)SendMessageA(hWnd, LVM_INSERTITEMA, 0, (LPARAM)&lvItem);
    }
    //LVM_SETITEM
    else
    {
      LV_ITEMA lvItem = { dwMask, (INT)iItem, (INT)iSubItem, iState, iStateMask, szBuffer, 0, iImage, lParam, 0};
      return (INDEX)SendMessageA(hWnd, LVM_SETITEMA, 0, (LPARAM)&lvItem);
    }
  }

  return LVM_ERR;
}

BOOL LV_SetItemImage | ( | HWND | hWnd,
 |  | INDEX | iItem,
 |  | INDEX | iSubItem,
 |  | INT | iImage
 | ) |  |

Definition at line 5223 of file cdialoglite.cpp.

{
  //LVM_SETITEM (With IMAGE mask)
  LV_ITEM lvItem = { LVIF_IMAGE, (INT)iItem, (INT)iSubItem, 0, 0, NULL, 0, iImage, 0, 0};
  return (BOOL)SendMessage(hWnd, LVM_SETITEM, 0, (LPARAM)&lvItem);
}

BOOL LV_SetItemParam | ( | HWND | hWnd,
 |  | INDEX | iItem,
 |  | INDEX | iSubItem,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 5234 of file cdialoglite.cpp.

{
  //LVM_SETITEM (With IMAGE mask)
  LV_ITEM lvItem = { LVIF_PARAM, (INT)iItem, (INT)iSubItem, 0, 0, NULL, 0, 0, lParam, 0};
  return (BOOL)SendMessage(hWnd, LVM_SETITEM, 0, (LPARAM)&lvItem);
}

BOOL LV_SetItemState | ( | HWND | hWnd,
 |  | INDEX | iItem,
 |  | INDEX | iSubItem,
 |  | UINT | iState,
 |  | UINT | iStateMask
 | ) |  |

Definition at line 5212 of file cdialoglite.cpp.

{
  //LVM_SETITEM
  LV_ITEM lvItem = { LVIF_STATE, (INT)iItem, (INT)iSubItem, iState, iStateMask, NULL, 0, 0, 0, 0};
  return (BOOL)SendMessage(hWnd, LVM_SETITEMSTATE, (WPARAM)iItem, (LPARAM)&lvItem);
}

BOOL LV_SetItemText | ( | HWND | hWnd,
 |  | INDEX | iItem,
 |  | INDEX | iSubItem,
 |  | WCHAR * | pwszName
 | ) |  |

Definition at line 5188 of file cdialoglite.cpp.

{
  if(IsUnicodeOS())
  {
    //LVM_SETITEM
    LV_ITEMW lvItem = { LVIF_TEXT, (INT)iItem, (INT)iSubItem, 0, 0, pwszName, 0, 0, 0, 0};
    return (BOOL)SendMessage(hWnd, LVM_SETITEMTEXTW, (WPARAM)iItem, (LPARAM)&lvItem);
  }
  else
  {
    CHAR szBuffer[MAX_NAME_LEN+1];
    ConvertToMBCS(pwszName, szBuffer, MAX_NAME_LEN);

    //LVM_SETITEM
    LV_ITEMA lvItem = { LVIF_TEXT, (INT)iItem, (INT)iSubItem, 0, 0, szBuffer, 0, 0, 0, 0};
    return (BOOL)SendMessageA(hWnd, LVM_SETITEMTEXTA, (WPARAM)iItem, (LPARAM)&lvItem);
  }
}

void SetAppLite ( CAppLite * pCAppLite )

Definition at line 26 of file cdialoglite.cpp.

{ g_pCAppLite = pCAppLite;  }

HTREEITEM TV_FindItem | ( | HWND | hWnd,
 |  | HTREEITEM | hParent,
 |  | WCHAR * | wszName
 | ) |  |

Definition at line 5485 of file cdialoglite.cpp.

{
  ASSERT(hWnd);
  ASSERT(wszName);
  CHAR szBuffer[MAX_NAME_LEN];

  //Convert to MBCS
  CHAR szName[MAX_NAME_LEN];
  ConvertToMBCS(wszName, szName, MAX_NAME_LEN);

  TVITEMA tvItemA = { TVIF_TEXT, 0, 0, 0, szBuffer, MAX_NAME_LEN, 0, 0, 0, 0};
  tvItemA.hItem = (HTREEITEM)SendMessage(hWnd, TVM_GETNEXTITEM, (WPARAM)TVGN_CHILD, (LPARAM)hParent);
  while(tvItemA.hItem)
  {
    //Try to find this string in the Tree
    if(SendMessage(hWnd, TVM_GETITEM, 0, (LPARAM)&tvItemA))
    {
      if(strcmp(szName, tvItemA.pszText)==0)
        return tvItemA.hItem;
    }

    //Otherwise get the NextItem and continue...
    tvItemA.hItem = (HTREEITEM)SendMessage(hWnd, TVM_GETNEXTITEM, (WPARAM)TVGN_NEXT, (LPARAM)tvItemA.hItem);
  }

  return NULL;
}

LPARAM TV_GetItemParam | ( | HWND | hWnd,
 |  | HTREEITEM | hItem
 | ) |  |

Definition at line 5453 of file cdialoglite.cpp.

{
  //no-op
  if(hItem == NULL)
    return NULL;

  TVITEM tvItem = { TVIF_PARAM, hItem, 0, 0, NULL, 0, 0, 0, 0, 0};

  //GetItem
  SendMessage(hWnd, TVM_GETITEM, 0, (LPARAM)&tvItem);

  //return the lParam
  return tvItem.lParam;
}

BOOL TV_GetItemText | ( | HWND | hWnd,
 |  | HTREEITEM | hItem,
 |  | WCHAR * | pwszBuffer,
 |  | LONG | ulMaxSize
 | ) |  |

Definition at line 5425 of file cdialoglite.cpp.

{
  ASSERT(pwszBuffer);
  BOOL bReturn = 0;

  if(IsUnicodeOS())
  {
    TVITEMW tvItem = { TVIF_TEXT, hItem, 0, 0, pwszBuffer, ulMaxSize, 0, 0, 0, 0};
    bReturn = (BOOL)SendMessage(hWnd, TVM_GETITEMW, 0, (LPARAM)&tvItem);
  }
  else
  {
    CHAR szBuffer[MAX_NAME_LEN] = {0};

    TVITEMA tvItem = { TVIF_TEXT, hItem, 0, 0, szBuffer, MAX_NAME_LEN, 0, 0, 0, 0};
    bReturn = (BOOL)SendMessage(hWnd, TVM_GETITEMA, 0, (LPARAM)&tvItem);

    ConvertToWCHAR(szBuffer, pwszBuffer, ulMaxSize);
  }

  return bReturn;
}

HTREEITEM TV_InsertItem | ( | HWND | hWnd,
 |  | HTREEITEM | hParent,
 |  | HTREEITEM | hInsAfter,
 |  | WCHAR * | wszName,
 |  | LPARAM | lParam = 0,
 |  | INT | iImage = 0,
 |  | INT | iSelectedImage = 0,
 |  | UINT | iState = 0,
 |  | UINT | iStateMask = 0
 | ) |  |

Definition at line 5390 of file cdialoglite.cpp.

{
  //Calculate the Mask/flags
  ULONG dwMask = 0;
  if(wszName)
    dwMask |= LVIF_TEXT;
  if(iImage != IMAGE_NONE)
    dwMask |= (LVIF_IMAGE | TVIF_SELECTEDIMAGE);
  if(iState != STATE_NONE)
    dwMask |= LVIF_STATE;
  if(lParam != PARAM_NONE)
    dwMask |= LVIF_PARAM;

  if(IsUnicodeOS())
  {
    //TVM_INSERTITEM
    TV_INSERTSTRUCTW tvInsertStruct = { hParent, hInsAfter, { dwMask, 0, iState, iStateMask, wszName, 0, iImage, iSelectedImage, 0, lParam} };
    return (HTREEITEM)SendMessageW(hWnd, TVM_INSERTITEMW, 0, (LPARAM)&tvInsertStruct);
  }
  else
  {
    CHAR szBuffer[MAX_NAME_LEN+1];
    ConvertToMBCS(wszName, szBuffer, MAX_NAME_LEN);

    //TVM_INSERTITEM
    TV_INSERTSTRUCTA tvInsertStruct = { hParent, hInsAfter, { dwMask, 0, iState, iStateMask, szBuffer, 0, iImage, iSelectedImage, 0, lParam} };
    return (HTREEITEM)SendMessageA(hWnd, TVM_INSERTITEMA, 0, (LPARAM)&tvInsertStruct);
  }
}

BOOL TV_SetItemState | ( | HWND | hWnd,
 |  | HTREEITEM | hItem,
 |  | UINT | iState,
 |  | UINT | iStateMask
 | ) |  |

Definition at line 5473 of file cdialoglite.cpp.

{
  //TVM_SETITEM
  TVITEM tvItem = { TVIF_STATE, hItem, iState, iStateMask, NULL, 0, 0, 0, 0, 0};
  return (BOOL)SendMessage(hWnd, TVM_SETITEM, 0, (LPARAM)&tvItem);
}

Variable Documentation

const INDEX INVALID_INDEX = -1

Definition at line 35 of file cdialoglite.h.

Generated on Wed Nov 13 2024 16:53:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/cenum.cpp File Reference

  • Dataaccess
  • oledb
  • rowsetviewer
Functions

cenum.cpp File Reference

#include "Headers.h"

Go to the source code of this file.

Functions

WINOLEAPI CoCreateInstanceEx (REFCLSID, IUnknown *, DWORD, COSERVERINFO *, DWORD, MULTI_QI *)

Function Documentation

WINOLEAPI CoCreateInstanceEx | ( | REFCLSID | ,
 |  | IUnknown * | ,
 |  | DWORD | ,
 |  | COSERVERINFO * | ,
 |  | DWORD | ,
 |  | MULTI_QI * |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/cenum.h File Reference

  • Dataaccess
  • oledb
  • rowsetviewer
Classes

cenum.h File Reference

#include "CBase.h"
#include "CDataSource.h"

Go to the source code of this file.

Classes

class | CEnumerator
struct | ENUMINFO
Generated on Wed Nov 13 2024 16:53:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/cerror.cpp File Reference

  • Dataaccess
  • oledb
  • rowsetviewer

cerror.cpp File Reference

#include "Headers.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/cerror.h File Reference

  • Dataaccess
  • oledb
  • rowsetviewer
Classes

cerror.h File Reference

Go to the source code of this file.

Classes

class | CCustomError
class | CError
Generated on Wed Nov 13 2024 16:53:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/clistener.cpp File Reference

  • Dataaccess
  • oledb
  • rowsetviewer
Functions

clistener.cpp File Reference

#include "Headers.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CListener

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 164 of file clistener.cpp.

{
  ASSERT(m_cRef);
  if(--m_cRef)
    return m_cRef;

  delete this;
  return 0;
}

Generated on Wed Nov 13 2024 16:53:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/clistener.h File Reference

  • Dataaccess
  • oledb
  • rowsetviewer
Classes

clistener.h File Reference

Go to the source code of this file.

Classes

class CListener
Generated on Wed Nov 13 2024 16:53:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/cmainwindow.cpp File Reference

  • Dataaccess
  • oledb
  • rowsetviewer
Enumerations | Variables

cmainwindow.cpp File Reference

#include "Headers.h"
#include "version.h"

Go to the source code of this file.

Enumerations

enum | { STATUSBAR_TEXT = 0, STATUSBAR_DESC = 1 }

Variables

enum { ... } | STATUSBAR

Enumeration Type Documentation

anonymous enum
Enumerator:
STATUSBAR_TEXT
STATUSBAR_DESC

Definition at line 23 of file cmainwindow.cpp.

{
  STATUSBAR_TEXT  = 0,
  STATUSBAR_DESC  = 1
} STATUSBAR;

Variable Documentation

enum { ... } STATUSBAR
Generated on Wed Nov 13 2024 16:53:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/cmainwindow.h File Reference

  • Dataaccess
  • oledb
  • rowsetviewer
Classes | Enumerations

cmainwindow.h File Reference

#include "Property.h"
#include "CDialog.h"
#include "CMDIChild.h"
#include "CListener.h"
#include "CTrace.h"
#include "CObjTree.h"
#include "CBinder.h"
#include "CRowset.h"
#include "COptions.h"
#include "Property.h"
#include "CDialog.h"

Go to the source code of this file.

Classes

class | CAboutDlg
class | CMainWindow

Enumerations

enum COLUMN_DESC {
COLUMN_DBCID, COLUMN_TYPENAME, COLUMN_DATATYPE, COLUMN_SIZE,
COLUMN_PREC, COLUMN_SCALE
}
enum | COLUMN_ISCO { COLUMN_ISCO_SRCURL, COLUMN_ISCO_DESTURL }
enum IMAGEICONS {
IMAGE_NORMAL = 0, IMAGE_CHECKED = 1, IMAGE_UNCHECKED = 2, IMAGE_LOCK = 3,
IMAGE_QUESTION = 4, IMAGE_ERROR = 5, IMAGE_FORM = 6, IMAGE_ARROW_UP = 7,
IMAGE_ARROW_DOWN = 8, IMAGE_DELETE = 9, IMAGE_CHANGE = 10, IMAGE_INSERT = 11,
IMAGE_CHAPTER = 12, IMAGE_MULTIPLE = 13, IMAGE_OBJECTS = 14, IMAGE_DATASOURCE = 15,
IMAGE_SESSION = 16, IMAGE_COMMAND = 17, IMAGE_TABLE = 18, IMAGE_SERVICECOMP = 19,
IMAGE_DATALINKS = 19, IMAGE_REMOTING = 20, IMAGE_DRAWNPOOL = 21, IMAGE_POOLING = 22,
IMAGE_INTERFACE = 23, IMAGE_STREAM = 24, IMAGE_CUBE = 25
}
enum | INDEX_COLUMN_DESC { COLUMN_ID, COLUMN_ORDER }
enum | STATEICONS { STATE_NORMAL = 0, STATE_CHECKED = 1, STATE_UNCHECKED = 2 }

Enumeration Type Documentation

enum COLUMN_DESC
Enumerator:
COLUMN_DBCID
COLUMN_TYPENAME
COLUMN_DATATYPE
COLUMN_SIZE
COLUMN_PREC
COLUMN_SCALE

Definition at line 77 of file cmainwindow.h.

{
  COLUMN_DBCID,
  COLUMN_TYPENAME,
  COLUMN_DATATYPE,
  COLUMN_SIZE,
  COLUMN_PREC,
  COLUMN_SCALE
};

enum COLUMN_ISCO
Enumerator:
COLUMN_ISCO_SRCURL
COLUMN_ISCO_DESTURL

Definition at line 93 of file cmainwindow.h.

{
  COLUMN_ISCO_SRCURL,
  COLUMN_ISCO_DESTURL
};

enum IMAGEICONS
Enumerator:
IMAGE_NORMAL
IMAGE_CHECKED
IMAGE_UNCHECKED
IMAGE_LOCK
IMAGE_QUESTION
IMAGE_ERROR
IMAGE_FORM
IMAGE_ARROW_UP
IMAGE_ARROW_DOWN
IMAGE_DELETE
IMAGE_CHANGE
IMAGE_INSERT
IMAGE_CHAPTER
IMAGE_MULTIPLE
IMAGE_OBJECTS
IMAGE_DATASOURCE
IMAGE_SESSION
IMAGE_COMMAND
IMAGE_TABLE
IMAGE_SERVICECOMP
IMAGE_DATALINKS
IMAGE_REMOTING
IMAGE_DRAWNPOOL
IMAGE_POOLING
IMAGE_INTERFACE
IMAGE_STREAM
IMAGE_CUBE

Definition at line 19 of file cmainwindow.h.

{
  IMAGE_NORMAL    = 0,
  IMAGE_CHECKED   = 1,
  IMAGE_UNCHECKED   = 2,
  IMAGE_LOCK      = 3,
  IMAGE_QUESTION    = 4,
  IMAGE_ERROR     = 5,
  IMAGE_FORM      = 6,
  IMAGE_ARROW_UP    = 7,
  IMAGE_ARROW_DOWN  = 8,
  IMAGE_DELETE    = 9,
  IMAGE_CHANGE    = 10,
  IMAGE_INSERT    = 11,
  IMAGE_CHAPTER   = 12,
  IMAGE_MULTIPLE    = 13,
  IMAGE_OBJECTS   = 14,
  IMAGE_DATASOURCE  = 15,
  IMAGE_SESSION   = 16,
  IMAGE_COMMAND   = 17,
  IMAGE_TABLE     = 18,
  IMAGE_SERVICECOMP = 19,
  IMAGE_DATALINKS   = 19,
  IMAGE_REMOTING    = 20,
  IMAGE_DRAWNPOOL   = 21,
  IMAGE_POOLING   = 22,
  IMAGE_INTERFACE   = 23,
  IMAGE_STREAM    = 24,
  IMAGE_CUBE      = 25
};

enum INDEX_COLUMN_DESC
Enumerator:
COLUMN_ID
COLUMN_ORDER

Definition at line 87 of file cmainwindow.h.

{
  COLUMN_ID,
  COLUMN_ORDER
};

enum STATEICONS
Enumerator:
STATE_NORMAL
STATE_CHECKED
STATE_UNCHECKED

Definition at line 70 of file cmainwindow.h.

{
  STATE_NORMAL    = 0,
  STATE_CHECKED   = 1,
  STATE_UNCHECKED   = 2
};

Generated on Wed Nov 13 2024 16:53:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/cmdichild.cpp File Reference

  • Dataaccess
  • oledb
  • rowsetviewer

cmdichild.cpp File Reference

#include "Headers.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/cmdichild.h File Reference

  • Dataaccess
  • oledb
  • rowsetviewer
Classes

cmdichild.h File Reference

#include "CDialog.h"
#include "CError.h"
#include "CTrace.h"
#include "CDataLinks.h"
#include "CDataSource.h"
#include "CSession.h"
#include "CCommand.h"
#include "CRowset.h"
#include "CRow.h"
#include "CMultipleResults.h"
#include "CRowPosition.h"
#include "CDataSet.h"
#include "CStream.h"
#include "CBinder.h"

Go to the source code of this file.

Classes

class | CDataGrid
class | CMDIChild
class | CQueryBox
Generated on Wed Nov 13 2024 16:53:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/cmultipleresults.h File Reference

  • Dataaccess
  • oledb
  • rowsetviewer
Classes

cmultipleresults.h File Reference

Go to the source code of this file.

Classes

class CMultipleResults
Generated on Wed Nov 13 2024 16:53:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/cmutipleresults.cpp File Reference

  • Dataaccess
  • oledb
  • rowsetviewer

cmutipleresults.cpp File Reference

#include "Headers.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/cobjtree.cpp File Reference

  • Dataaccess
  • oledb
  • rowsetviewer

cobjtree.cpp File Reference

#include "Headers.h"
#include "CObjTree.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/cobjtree.h File Reference

  • Dataaccess
  • oledb
  • rowsetviewer
Classes

cobjtree.h File Reference

Go to the source code of this file.

Classes

class | CMDIObjects
class | CObjTree
Generated on Wed Nov 13 2024 16:53:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/common.cpp File Reference

  • Dataaccess
  • oledb
  • rowsetviewer
Classes | Defines | Typedefs | Functions | Variables

common.cpp File Reference

#include "Headers.h"
#include <errno.h>

Go to the source code of this file.

Classes

struct | _SynchInfo

Defines

#define | DBINITCONSTANTS
#define | INITGUID

Typedefs

typedef struct _SynchInfo | SYNCHINFO

Functions

HRESULT | BrowseOpenFileName (HINSTANCE hInstance, HWND hWnd, WCHAR *pwszTitle, WCHAR *pwszFileName, ULONG ulMaxSize, WCHAR *pwszExtension, WCHAR *pwszFilter, DWORD *pdwFileOffset, DWORD dwFlags)
HRESULT | BrowseSaveFileName (HINSTANCE hInstance, HWND hWnd, WCHAR *pwszTitle, WCHAR *pwszFileName, ULONG ulMaxSize, WCHAR *pwszExtension, WCHAR *pwszFilter, DWORD *pdwFileOffset, DWORD dwFlags)
BOOL | CenterDialog (HWND hdlg)
HRESULT | CloseRegKey (HKEY hKey)
BOOL | ConvertToLONG (LPCWSTR pwszText, LONG *plValue, LONG lMin, LONG lMax, INT iBase)
INT | ConvertToMBCS (LPCWSTR pwsz, INT cchSrc, CHAR *psz, INT cchDst)
CHAR * | ConvertToMBCS (LPCWSTR pwsz)
INT | ConvertToMBCS (LPCWSTR pwsz, CHAR *psz, INT cchDst)
INT | ConvertToWCHAR (LPCSTR psz, WCHAR *pwsz, INT cchDst)
INT | ConvertToWCHAR (LPCSTR psz, INT cchSrc, WCHAR *pwsz, INT cchDst)
WCHAR * | ConvertToWCHAR (LPCSTR psz)
HRESULT | CopyBinding (DBBINDING *pDest, DBBINDING *pSource)
HRESULT | CreateDefFileName (LPCWSTR pwszFileName, WCHAR *pwszFullPath, ULONG ulMaxSize, BOOL fCurrentDir)
HRESULT | CreateRegKey (HKEY hRootKey, WCHAR *pwszKeyName, HKEY *phKey, REGSAM samDesired)
HRESULT | DataConvert (DBSTATUS dbSrcStatus, DBLENGTH cbSrcLength, DBLENGTH cbSrcMaxLength, DBTYPE wSrcType, void *pSrcValue, BYTE bPrecision, BYTE bScale, DBTYPE wDstType, DBSTATUS *pdbDstStatus, DBLENGTH *pcbDstLength, void *pDstValue, DBLENGTH cbDstMaxLength, DWORD dwConvFlags)
HRESULT | DBIDCopy (DBID *pDst, const DBID *pSrc)
BOOL | DBIDEqual (const DBID *pDst, const DBID *pSrc)
void | DBIDFree (DBID *pDBID)
HRESULT | DBIDToString (const DBID *pDBID, WCHAR *pwsz, ULONG ulMaxLen)
HRESULT | DelRegEntry (HKEY hRootKey, WCHAR *pwszKeyName, BOOL fSubKeys)
HRESULT | DelRegEntry (HKEY hRootKey, WCHAR *pwszKeyName)
HRESULT | FreeBindingData (DBCOUNTITEM cBindings, const DBBINDING *rgBindings, void *pData, BOOL fSetData)
HRESULT | FreeBindings (DBCOUNTITEM *pcBindings, DBBINDING **prgBindings)
HRESULT | FreeColAccess (ULONG *pcColAccess, DBCOLUMNACCESS **prgColAccess, void **ppData)
HRESULT | FreeConstraintDesc (DBORDINAL *pcConsDesc, DBCONSTRAINTDESC **prgConsDesc, BOOL fFree)
HRESULT | FreeData (DBTYPE wType, DBLENGTH cData, void *rgData)
RECT | GetClientCoords (HWND hWndParent, HWND hWnd)
SIZE | GetClientSize (HWND hWnd)
WCHAR * | GetColName (const DBCOLUMNINFO *pColInfo)
DBTYPE | GetDBType (WCHAR *pwsz)
HRESULT | GetDBTypeMaxSize (DBTYPE wType, DBLENGTH *pulMaxSize, BYTE *pbPrecision, BYTE *pbScale)
WCHAR * | GetDBTypeName (DBTYPE wType)
BOOL | GetEditBoxValue (HWND hEditWnd, LONG *plValue, LONG lMin, LONG lMax, BOOL fAllowEmpty)
DBLENGTH | GetMaxDisplaySize (DBTYPE wBindingType, DBTYPE wBackendType, DBLENGTH ulColumnSize, DBLENGTH ulMaxVarSize)
ULONG_PTR | GetMenuData (HMENU hMenu, UINT uItem, BOOL fByPosition)
WCHAR * | GetProgID (REFCLSID clsid)
HRESULT | GetRegEntry (HKEY hRootKey, WCHAR *pwszKeyName, WCHAR *pwszValueName, WCHAR *pwszValue, ULONG cBytes)
HRESULT | GetRegEntry (HKEY hRootKey, WCHAR *pwszKeyName, WCHAR *pwszValueName, WCHAR **ppwszValue)
HRESULT | GetRegEntry (HKEY hRootKey, WCHAR *pwszKeyName, WCHAR *pwszValueName, ULONG *pulValue)
HRESULT | GetRegEntry (HKEY hRootKey, WCHAR *pwszKeyName, WCHAR *pwszValueName, void *pStruct, ULONG cBytes, ULONG *pcActualBytes, ULONG dwType)
HRESULT | GetRegEnumKey (HKEY hRootKey, WCHAR *pwszKeyName, DWORD dwIndex, WCHAR *pwszSubKeyName, ULONG cBytes)
HRESULT | GetRegEnumValue (HKEY hRootKey, WCHAR *pwszKeyName, DWORD dwIndex, WCHAR *pwszValueName, ULONG *pcBytes)
HRESULT | GetRegEnumValue (HKEY hRootKey, WCHAR *pwszKeyName, DWORD dwIndex, WCHAR **ppwszValueName)
void * | GetThis (HWND hWnd)
DBTYPE | GetVariantType (WCHAR *pwsz)
WCHAR * | GetVariantTypeName (VARTYPE vt)
BOOL | GetWindowPos (HWND hWnd, POINTS *pPTS)
SIZE | GetWindowSize (HWND hWnd)
void | InternalTrace (LPCWSTR pwszText)
void | InternalTraceFmt (LPCWSTR pwszFmt,...)
BOOL | IsFixedType (DBTYPE wType)
BOOL | IsNumericType (DBTYPE wType)
BOOL IsUnicodeOS ()
BOOL | IsVariableType (DBTYPE wType)
BOOL | MoveWindow (HWND hWnd, ULONG x, ULONG y)
HRESULT | OpenRegKey (HKEY hRootKey, WCHAR *pwszKeyName, DWORD ulOptions, REGSAM samDesired, HKEY *phKey)
HRESULT | PostProcessString (WCHAR *pwsz, DBLENGTH ulMaxSize, DWORD dwFlags)
HRESULT | SafeArrayToString (SAFEARRAY *pSafeArray, DBTYPE wType, WCHAR *pwszBuffer, DBLENGTH ulMaxSize)
BOOL | SetMenuData (HMENU hMenu, UINT uItem, BOOL fByPosition, ULONG_PTR dwItemData)
HRESULT | SetRegEntry (HKEY hRootKey, WCHAR *pwszKeyName, WCHAR *pwszValueName, void *pStruct, ULONG cBytes, DWORD dwType)
HRESULT | SetRegEntry (HKEY hRootKey, WCHAR *pwszKeyName, WCHAR *pwszValueName, WCHAR *pwszValue)
HRESULT | SetRegEntry (HKEY hRootKey, WCHAR *pwszKeyName, WCHAR *pwszValueName, ULONG ulValue)
BOOL | SetSubMenuData (HMENU hMenu, UINT uItem, BOOL fByPosition, ULONG_PTR dwItemData)
void * | SetThis (HWND hWnd, void *pThis)
WCHAR * | StackFormat (LPCWSTR pwszFmt,...)
CHAR * | strDuplicate (LPCSTR psz)
BOOL | StringCompare (LPCWSTR pwsz1, LPCWSTR pwsz2)
BOOL | StringCompareI (LPCWSTR pwsz1, LPCWSTR pwsz2)
CHAR * | StringCopy (CHAR *pszDest, LPCSTR pszSource, DBLENGTH cMaxLen)
WCHAR * | StringCopy (WCHAR *pwszDest, LPCWSTR pwszSource, DBLENGTH cMaxLen)
WCHAR * | StringFormat (WCHAR *pwszDest, DBLENGTH ulStrLen, LPCWSTR pwszFmt,...)
HRESULT | StringToSafeArray (WCHAR *pwszBuffer, DBTYPE wType, SAFEARRAY **ppSafeArray)
HRESULT | StringToVariant (WCHAR *pwsz, VARTYPE vt, VARIANT *pVariant, DWORD dwFlags)
HRESULT | StringToVector (WCHAR *pwszBuffer, DBTYPE wType, DBVECTOR *pVector)
INT_PTR WINAPI | SynchSubProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
void | SyncSibling (HWND hToWnd, HWND hFromWnd)
HRESULT | VariantChangeFast (VARIANT *pVarDest, VARIANT *pVarSrc, LCID lcid, USHORT wFlags, VARTYPE vt)
HRESULT | VariantClearFast (VARIANT *pVariant)
HRESULT | VariantCopyFast (VARIANT *pVarDest, VARIANT *pVarSrc)
HRESULT | VariantInitFast (VARIANT *pVariant)
HRESULT | VariantToString (VARIANT *pVariant, WCHAR *pwsz, DBLENGTH ulMaxSize, DWORD dwFlags)
HRESULT | VectorToString (DBVECTOR *pVector, DBTYPE wType, WCHAR *pwszBuffer, DBLENGTH ulMaxSize)
WCHAR * | wcsDuplicate (LPCWSTR pwsz)
WCHAR * | wGetWindowText (HWND hWnd)
INT | wMessageBox (HWND hwnd, UINT uiStyle, WCHAR *pwszTitle, WCHAR *pwszFmt,...)
LRESULT | wSendMessage (HWND hWnd, UINT Msg, WPARAM wParam, WCHAR *pwszText)
LRESULT | wSendMessageFmt (HWND hWnd, UINT Msg, WPARAM wParam, WCHAR *pwszFmt,...)

Variables

CComPtr< IDataConvert > | g_spDataConvert
WCHAR | wsz_ERROR [] = "Microsoft OLE DB RowsetViewer - Error"
WCHAR | wsz_ERRORINFO [] = "Microsoft OLE DB RowsetViewer - IErrorInfo"
WCHAR | wsz_EXCEPTION [] = "Microsoft OLE DB RowsetViewer - Exception"
WCHAR | wsz_INFO [] = "Microsoft OLE DB RowsetViewer - Info"
WCHAR | wsz_INVALID_VALUE_ [] = "Invalid Value '%s' specified. Please specify a value >= %lu and <= %lu."
WCHAR | wsz_SUCCESS [] = "Microsoft OLE DB RowsetViewer - Success"
WCHAR | wsz_WARNING [] = "Microsoft OLE DB RowsetViewer - Warning"

Define Documentation

#define DBINITCONSTANTS

Definition at line 15 of file common.cpp.

#define INITGUID

Definition at line 16 of file common.cpp.

Typedef Documentation

typedef struct _SynchInfo SYNCHINFO

Function Documentation

HRESULT BrowseOpenFileName | ( | HINSTANCE | hInstance,
 |  | HWND | hWnd,
 |  | WCHAR * | pwszTitle,
 |  | WCHAR * | pwszFileName,
 |  | ULONG | ulMaxSize,
 |  | WCHAR * | pwszExtension,
 |  | WCHAR * | pwszFilter,
 |  | DWORD * | pdwFileOffset,
 |  | DWORD | dwFlags
 | ) |  |

Definition at line 3276 of file common.cpp.

{
  static ULONG ulFilterIndex = 1;  //Default to first filter
  HRESULT hr = E_FAIL;

  if(IsUnicodeOS())
  {
    //Setup OPENFILENAME struct...
    OPENFILENAMEW    ofn;
    memset( &ofn, 0, sizeof( ofn ));
    ofn.lStructSize       = sizeof( OPENFILENAMEW );
    ofn.hwndOwner         = hWnd;
    ofn.hInstance         = hInstance;
    ofn.nMaxFile          = ulMaxSize;
    ofn.nMaxCustFilter    = MAX_NAME_LEN;
    ofn.nFilterIndex    = ulFilterIndex;
    ofn.lpstrFile         = pwszFileName;
    ofn.lpstrTitle      = pwszTitle;
    ofn.lpstrFilter     = pwszFilter;
    ofn.lpstrDefExt     = pwszExtension;
    ofn.Flags             = dwFlags;

    //Display Common Dialog to obtain File To Load...
    TESTC_(GetOpenFileNameW(&ofn),TRUE);

    //Save the Choosen Filter Index
    ulFilterIndex = ofn.nFilterIndex;
    hr = S_OK;

    //Save the first FileName offset (if multiselet)
    if(pdwFileOffset)
      *pdwFileOffset = ofn.nFileOffset;
  }
  else
  {
    CHAR szFileName[MAX_NAME_LEN];
    ConvertToMBCS(pwszFileName, szFileName, MAX_NAME_LEN);
    CHAR szTitle[MAX_NAME_LEN];
    ConvertToMBCS(pwszTitle, szTitle, MAX_NAME_LEN);
    CHAR szExtension[MAX_NAME_LEN];
    ConvertToMBCS(pwszExtension, szExtension, MAX_NAME_LEN);

    //NOTE:  pwszFilter is a double null terminated string, (containing an array of singurally
    //null terminated sub strings).
    CHAR szFilter[MAX_QUERY_LEN] = {0};
    CHAR* pszFilter = szFilter;
    while(pwszFilter && *pwszFilter)
    {
      ConvertToMBCS(pwszFilter, pszFilter, MAX_QUERY_LEN-(INT)(pszFilter-szFilter));
      pwszFilter += wcslen(pwszFilter) + 1;
      pszFilter += strlen(pszFilter) + 1;
    }

    //Setup OPENFILENAME struct...
    OPENFILENAMEA    ofn;
    memset( &ofn, 0, sizeof( ofn ));
    ofn.lStructSize       = sizeof( OPENFILENAMEA );
    ofn.hwndOwner         = hWnd;
    ofn.hInstance         = hInstance;
    ofn.nMaxFile          = ulMaxSize;
    ofn.nMaxCustFilter    = MAX_NAME_LEN;
    ofn.nFilterIndex    = ulFilterIndex;
    ofn.lpstrFile         = szFileName;
    ofn.lpstrTitle      = szTitle;
    ofn.lpstrFilter     = szFilter;
    ofn.lpstrDefExt     = szExtension;
    ofn.Flags             = dwFlags;

    //Display Common Dialog to obtain File To Load...
    TESTC_(GetOpenFileNameA(&ofn), TRUE)
    ConvertToWCHAR(szFileName, pwszFileName, MAX_NAME_LEN);

    //Save the Choosen Filter Index
    ulFilterIndex = ofn.nFilterIndex;
    hr = S_OK;

    //Save the first FileName offset (if multiselet)
    if(pdwFileOffset)
      *pdwFileOffset = ofn.nFileOffset;
  }

CLEANUP:
  return hr;
}

HRESULT BrowseSaveFileName | ( | HINSTANCE | hInstance,
 |  | HWND | hWnd,
 |  | WCHAR * | pwszTitle,
 |  | WCHAR * | pwszFileName,
 |  | ULONG | ulMaxSize,
 |  | WCHAR * | pwszExtension,
 |  | WCHAR * | pwszFilter,
 |  | DWORD * | pdwFileOffset,
 |  | DWORD | dwFlags
 | ) |  |

Definition at line 3420 of file common.cpp.

{
  HRESULT hr = E_FAIL;
  static ULONG ulFilterIndex = 1;  //Default to first filter

  if(IsUnicodeOS())
  {
    //Setup OPENFILENAME struct...
    OPENFILENAMEW    ofn;
    memset( &ofn, 0, sizeof( ofn ));
    ofn.lStructSize       = sizeof( OPENFILENAMEW );
    ofn.hwndOwner         = hWnd;
    ofn.hInstance         = hInstance;
    ofn.nMaxFile          = ulMaxSize;
    ofn.lpstrFile         = pwszFileName;
    ofn.lpstrTitle      = pwszTitle;
    ofn.lpstrFilter     = pwszFilter;
    ofn.nMaxCustFilter    = MAX_NAME_LEN;
    ofn.nFilterIndex    = ulFilterIndex;
    ofn.lpstrDefExt     = pwszExtension;
    ofn.Flags             = dwFlags;

    //Display Common Dialog to obtain File To Save...
    if(GetSaveFileNameW(&ofn))
    {
      ulFilterIndex = ofn.nFilterIndex;

      //Save the first FileName offset (if multiselet)
      if(pdwFileOffset)
        *pdwFileOffset = ofn.nFileOffset;

      hr = S_OK;
    }
  }
  else
  {
    CHAR szFileName[MAX_NAME_LEN];
    ConvertToMBCS(pwszFileName, szFileName, MAX_NAME_LEN);
    CHAR szTitle[MAX_NAME_LEN];
    ConvertToMBCS(pwszTitle, szTitle, MAX_NAME_LEN);
    CHAR szExtension[MAX_NAME_LEN];
    ConvertToMBCS(pwszExtension, szExtension, MAX_NAME_LEN);

    //NOTE:  pwszFilter is a double null terminated string, (containing an array of singurally
    //null terminated sub strings).
    CHAR szFilter[MAX_QUERY_LEN] = {0};
    CHAR* pszFilter = szFilter;
    while(pwszFilter && *pwszFilter)
    {
      ConvertToMBCS(pwszFilter, pszFilter, MAX_QUERY_LEN-(INT)(pszFilter-szFilter));
      pwszFilter += wcslen(pwszFilter) + 1;
      pszFilter += strlen(pszFilter) + 1;
    }

    //Setup OPENFILENAME struct...
    OPENFILENAMEA    ofn;
    memset( &ofn, 0, sizeof( ofn ));
    ofn.lStructSize       = sizeof( OPENFILENAMEA );
    ofn.hwndOwner         = hWnd;
    ofn.hInstance         = hInstance;
    ofn.nMaxFile          = ulMaxSize;
    ofn.lpstrFile         = szFileName;
    ofn.lpstrTitle      = szTitle;
    ofn.lpstrFilter     = szFilter;
    ofn.nMaxCustFilter    = MAX_NAME_LEN;
    ofn.nFilterIndex    = ulFilterIndex;
    ofn.lpstrDefExt     = szExtension;
    ofn.Flags             = dwFlags;

    //Display Common Dialog to obtain File To Save...
    if(GetSaveFileNameA(&ofn))
    {
      ConvertToWCHAR(szFileName, pwszFileName, MAX_NAME_LEN);
      ulFilterIndex = ofn.nFilterIndex;

      //Save the first FileName offset (if multiselet)
      if(pdwFileOffset)
        *pdwFileOffset = ofn.nFileOffset;

      hr = S_OK;
    }
  }

  return hr;
}

BOOL CenterDialog ( HWND hdlg )

Definition at line 2784 of file common.cpp.

{
  RECT  rcParent;                         // Parent window client rect
  RECT  rcDlg;                            // Dialog window rect
  int   nLeft, nTop;                      // Top-left coordinates
  int   cWidth, cHeight;                  // Width and height
  HWND  hwnd;

  // Get frame window client rect in screen coordinates
  hwnd = GetParent(hdlg);
  if(hwnd == NULL || hwnd == GetDesktopWindow())
  {
    rcParent.top = rcParent.left = 0;
    rcParent.right = GetSystemMetrics(SM_CXFULLSCREEN);
    rcParent.bottom = GetSystemMetrics(SM_CYFULLSCREEN);
  }
  else
  {
    GetWindowRect(hwnd, &rcParent);
  }

  // Determine the top-left point for the dialog to be centered
  GetWindowRect(hdlg, &rcDlg);
  cWidth  = rcDlg.right  - rcDlg.left;
  cHeight = rcDlg.bottom - rcDlg.top;
  nLeft   = rcParent.left +
            (((rcParent.right  - rcParent.left) - cWidth ) / 2);
  nTop    = rcParent.top  +
            (((rcParent.bottom - rcParent.top ) - cHeight) / 2);
  if (nLeft < 0) nLeft = 0;
  if (nTop  < 0) nTop  = 0;

  // Place the dialog
  return MoveWindow(hdlg, nLeft, nTop, cWidth, cHeight, TRUE);
}

HRESULT CloseRegKey ( HKEY hKey )

Definition at line 3965 of file common.cpp.

{
  HRESULT hr = S_OK;

  //RegCloseKey
  if(hKey)
    hr = RegCloseKey(hKey);

  if(hr != S_OK)
    hr = E_FAIL;
  return hr;
}

BOOL ConvertToLONG | ( | LPCWSTR | pwszText,
 |  | LONG * | plValue,
 |  | LONG | lMin,
 |  | LONG | lMax,
 |  | INT | iBase
 | ) |  |

Definition at line 3129 of file common.cpp.

{
  ASSERT(plValue);
  if(!pwszText || !pwszText[0])
    return FALSE;

  errno = 0;
  WCHAR*  pwszEnd = NULL;

  //Convert to LONG
  LONG lValue = wcstol(pwszText, &pwszEnd, iBase);
  if(errno==ERANGE || !pwszText[0] || lValue<lMin || lValue>lMax || pwszEnd==NULL || pwszEnd[0]!=wEOL)
    return FALSE;

  //Only change the input value on success...
  *plValue = lValue;
  return TRUE;
}

INT ConvertToMBCS | ( | LPCWSTR | pwsz,
 |  | INT | cchSrc,
 |  | CHAR * | psz,
 |  | INT | cchDst
 | ) |  |

Definition at line 196 of file common.cpp.

{
  //NOTE: The user can call this function with the Destination as NULL to indicate
  //just provide the length of the required conversion

  //No source
  if(!pwsz && psz)
  {
    //Conveience for the caller:
    //always make sure the result is null-terminated - if their is enough room
    if(cchDst >= 1)
    {
      psz[0] = EOL;
      return 1;
    }
    return 0;
  }

  //NOTE: WideCharToMultiByte destination buffer is really in (cb) count of bytes,
  //but to make things simplier since MultiByteToWideChar is opposite for the output
  //buffer, we will operate everything in cch - this is not a perf hit either since we don't
  //need a conversion since for CHAR -> cch == cb
  ASSERT(1/*cch*/ == sizeof(CHAR)/*cb*/);

  //Convert the string to MBCS
  INT cchWritten = WideCharToMultiByte(CP_ACP, 0, pwsz, cchSrc/*cch*/, psz, cchDst/*cb*/, NULL, NULL);

  //Since the buffer we passed in may be smaller than the actual data returned
  //we may not actually get to copy the NULL termintor, so make sure there is one at least
  //at the end of the buffer...
  if(cchDst && (cchDst < cchSrc))
  {
    cchWritten = cchDst;
    psz[cchWritten-1] = '\0';
  }

  return cchWritten;
}

CHAR* ConvertToMBCS ( LPCWSTR pwsz )

Definition at line 240 of file common.cpp.

{
  HRESULT hr = S_OK;

  //no-op case
  if(!pwsz)
    return NULL;

  //Determine the space required for the conversion
  INT iLen = ConvertToMBCS(pwsz, -1, NULL, 0);

  //Allocate space for the string
  CHAR* pszBuffer = NULL;
  SAFE_ALLOC(pszBuffer, CHAR, iLen+1);

  //Now convert the string
  ConvertToMBCS(pwsz, pszBuffer, iLen+1);

CLEANUP:
  return pszBuffer;
}

INT ConvertToMBCS | ( | LPCWSTR | pwsz,
 |  | CHAR * | psz,
 |  | INT | cchDst
 | ) |  |

Definition at line 186 of file common.cpp.

{
  return ConvertToMBCS(pwsz, -1, psz, cchDst);
}

INT ConvertToWCHAR | ( | LPCSTR | psz,
 |  | WCHAR * | pwsz,
 |  | INT | cchDst
 | ) |  |

Definition at line 267 of file common.cpp.

{
  //Delegate
  return ConvertToWCHAR(psz, -1, pwsz, cchDst);
}

INT ConvertToWCHAR | ( | LPCSTR | psz,
 |  | INT | cchSrc,
 |  | WCHAR * | pwsz,
 |  | INT | cchDst
 | ) |  |

Definition at line 279 of file common.cpp.

{
  //NOTE: The user can call this function with the Destination as NULL to indicate
  //just provide the length of the required conversion

  //No source
  if(!psz && pwsz)
  {
    //Conveience for the caller:
    //always make sure the result is null-terminated - if their is enough room
    if(cchDst >= 1)
    {
      pwsz[0] = wEOL;
      return 1;
    }
    return 0;
  }

  //NOTE: WideCharToMultiByte destination buffer is really in (cb) count of bytes,
  //but to make things simplier since MultiByteToWideChar is opposite for the output
  //buffer, we will operate everything in cch - this is not a perf hit either since we don't
  //need a conversion since for CHAR -> cch == cb
  ASSERT(1/*cch*/ == sizeof(CHAR)/*cb*/);

  //Convert the string to MBCS
  INT cchWritten = MultiByteToWideChar(CP_ACP, 0, psz, cchSrc/*cb*/, pwsz, cchDst/*cch*/);

  //Since the buffer we passed in may be smaller than the actual data returned
  //we may not actually get to copy the NULL termintor, so make sure there is one at least
  //at the end of the buffer...
  if(cchDst && (cchDst < cchSrc))
  {
    cchWritten = cchDst;
    pwsz[cchWritten-1] = L'\0';
  }

  return cchWritten;
}

WCHAR* ConvertToWCHAR ( LPCSTR psz )

Definition at line 323 of file common.cpp.

{
  HRESULT hr = S_OK;

  //no-op case
  if(!psz)
    return NULL;

  //Determine the space required for the conversion
  INT iLen = ConvertToWCHAR(psz, -1, NULL, 0);

  //Allocate space for the string
  WCHAR* pwszBuffer = NULL;
  SAFE_ALLOC(pwszBuffer, WCHAR, iLen+1);

  //Now convert the string
  ConvertToWCHAR(psz, pwszBuffer, iLen+1);

CLEANUP:
  return pwszBuffer;
}

HRESULT CopyBinding | ( | DBBINDING * | pDest,
 |  | DBBINDING * | pSource
 | ) |  |

Definition at line 2337 of file common.cpp.

{
  ASSERT(pDest);
  ASSERT(pSource);
  HRESULT hr = S_OK;

  //First just memcopy the inline info
  memcpy(pDest, pSource, sizeof(DBBINDING));

  //Now we need to allocate any out-of-line info
  if(pSource->pObject)
  {
    SAFE_ALLOC(pDest->pObject, DBOBJECT, 1);
    memcpy(pDest->pObject, pSource->pObject, sizeof(DBOBJECT));
  }

CLEANUP:
  return hr;
}

HRESULT CreateDefFileName | ( | LPCWSTR | pwszFileName,
 |  | WCHAR * | pwszFullPath,
 |  | ULONG | ulMaxSize,
 |  | BOOL | fCurrentDir
 | ) |  |

Definition at line 3366 of file common.cpp.

{
  if(pwszFileName == NULL || pwszFullPath == NULL || ulMaxSize == 0)
    return E_INVALIDARG;

  //Obtain the current Directory
  DWORD ulStrLen = 0;
  if(fCurrentDir)
  {
    if(IsUnicodeOS())
    {
      ulStrLen = GetCurrentDirectoryW(ulMaxSize, pwszFullPath);
    }
    else
    {
      CHAR szBuffer[MAX_PATH+1];
      ulStrLen = GetCurrentDirectoryA(MAX_PATH, szBuffer);
      ConvertToWCHAR(szBuffer, pwszFullPath, ulMaxSize);
    }
  }
  else
  {
    if(IsUnicodeOS())
    {
      ulStrLen = GetSystemDirectoryW(pwszFullPath, ulMaxSize);
    }
    else
    {
      CHAR szBuffer[MAX_PATH+1];
      ulStrLen = GetSystemDirectoryA(szBuffer, MAX_PATH);
      ConvertToWCHAR(szBuffer, pwszFullPath, ulMaxSize);
    }
  }

  if(ulStrLen)
  {
    //We can't just strcat a "\filename" since depending upon the current
    //directory sometimes it returns "c:\" or "c:\oledb", etc...
    if(pwszFullPath[ulStrLen-1] != L'\\')
      wcscat(pwszFullPath, L"\\");

    //Now tack on the suggested filename...
    wcscat(pwszFullPath, pwszFileName);
    return S_OK;
  }

  return E_FAIL;
}

HRESULT CreateRegKey | ( | HKEY | hRootKey,
 |  | WCHAR * | pwszKeyName,
 |  | HKEY * | phKey,
 |  | REGSAM | samDesired
 | ) |  |

Definition at line 3511 of file common.cpp.

{
  HRESULT hr = E_FAIL;
  ULONG dwDisposition = 0;

  //Need the name of the key to open
  if(!pwszKeyName)
    return E_FAIL;

  if(IsUnicodeOS())
  {
    hr = RegCreateKeyExW(hRootKey, pwszKeyName, 0, NULL, REG_OPTION_NON_VOLATILE, samDesired, NULL, phKey, &dwDisposition);
  }
  else
  {
    CHAR szBuffer[MAX_NAME_LEN];
    ConvertToMBCS(pwszKeyName, szBuffer, MAX_NAME_LEN);

    hr = RegCreateKeyExA(hRootKey, szBuffer, 0, NULL, REG_OPTION_NON_VOLATILE, samDesired, NULL, phKey, &dwDisposition);
  }

  if(hr != S_OK)
    hr = E_FAIL;
  return hr;
}

HRESULT DataConvert | ( | DBSTATUS | dbSrcStatus,
 |  | DBLENGTH | cbSrcLength,
 |  | DBLENGTH | cbSrcMaxLength,
 |  | DBTYPE | wSrcType,
 |  | void * | pSrcValue,
 |  | BYTE | bPrecision,
 |  | BYTE | bScale,
 |  | DBTYPE | wDstType,
 |  | DBSTATUS * | pdbDstStatus,
 |  | DBLENGTH * | pcbDstLength,
 |  | void * | pDstValue,
 |  | DBLENGTH | cbDstMaxLength,
 |  | DWORD | dwConvFlags
 | ) |  |

Definition at line 381 of file common.cpp.

{
  HRESULT hr = S_OK;
  if(pdbDstStatus)
    *pdbDstStatus = DBSTATUS_S_OK;
  if(pcbDstLength)
    *pcbDstLength = 0;

  //NOTE: cbSrcLength passed in is the actual length of the data (untruncated).
  //cbSrcMaxLength is the maximum size of the source (read) buffer thats valid.  This is useful to
  //seperate into two seperate items, since for String data this doesn't include the null terminator
  //and for fixed length it is the maximum.  But all data source is bound by cbSrcMaxLength...
  cbSrcLength = (wSrcType & DBTYPE_BYREF) ? cbSrcLength : min(cbSrcLength, cbSrcMaxLength);

  //STATUS...
  switch(dbSrcStatus)
  {
    case DBSTATUS_S_ISNULL:
    case DBSTATUS_S_DEFAULT:
    case DBSTATUS_S_IGNORE:
      hr = S_OK;
      goto CLEANUP;

    case DBSTATUS_S_TRUNCATED:
      hr = S_OK;
      break;

    case DBSTATUS_S_OK:
      hr = S_OK;
      break;

    default:
      hr = DB_E_CANTCONVERTVALUE;
      goto CLEANUP;
  };

  //LENGTH...

  //VALUE...
  if(!pSrcValue || !pDstValue)
    goto CLEANUP;

  //Can we convert this "locally" without bringing in DC?
  if(!(dwConvFlags & CONV_MSDADC_ONLY))
  {
    switch(DBTYPE_SRC_DST(wSrcType, wDstType))
    {
      case DBTYPE_SRC_DST(DBTYPE_WSTR, DBTYPE_WSTR):
      {
        //cbSrcLength - doesn't account for Null terminator
        DBLENGTH cbSrcLengthPlusTerm  = min(cbSrcLength + sizeof(WCHAR), cbSrcMaxLength);

        //VALUE
        //NOTE: We don't use wcscpy since user data could have embedded NULLs
        memcpy(pDstValue, pSrcValue, (size_t)(min(cbSrcLengthPlusTerm, cbDstMaxLength)));

        //Since the buffer we passed in may be smaller than the actual data returned
        //we may not actually get to copy the NULL termintor, so make sure there is one at least
        //at the end of the buffer...
        if(cbDstMaxLength && (cbDstMaxLength < cbSrcLengthPlusTerm))
          ((WCHAR*)pDstValue)[cbDstMaxLength/sizeof(WCHAR)-1] = L'\0';

        //LENGTH
        //NOTE: This doesn't include the NULL terminator
        if(pcbDstLength)
          *pcbDstLength = min(cbSrcLength, cbDstMaxLength);
        break;
      }

      case DBTYPE_SRC_DST(DBTYPE_STR, DBTYPE_WSTR):
      {
        //cbSrcLength - doesn't account for Null terminator
        DBLENGTH cbSrcLengthPlusTerm  = min(cbSrcLength + sizeof(CHAR), cbSrcMaxLength);

        //VALUE
        INT chWritten = ConvertToWCHAR((CHAR*)pSrcValue, (INT)cbSrcLengthPlusTerm/sizeof(CHAR), (WCHAR*)pDstValue, (INT)cbDstMaxLength/sizeof(WCHAR));

        //NOTE: LENGTH doesn't include the NULL terminator
        if(pcbDstLength && chWritten)
          *pcbDstLength = (chWritten * sizeof(WCHAR)) - sizeof(WCHAR);
        break;
      }

      case DBTYPE_SRC_DST(DBTYPE_WSTR, DBTYPE_STR):
      {
        //cbSrcLength - doesn't account for Null terminator
        DBLENGTH cbSrcLengthPlusTerm  = min(cbSrcLength + sizeof(WCHAR), cbSrcMaxLength);

        //VALUE
        INT chWritten = ConvertToMBCS((WCHAR*)pSrcValue, (INT)cbSrcLengthPlusTerm/sizeof(WCHAR), (CHAR*)pDstValue, (INT)cbDstMaxLength/sizeof(CHAR));

        //NOTE: LENGTH doesn't include the NULL terminator
        if(pcbDstLength && chWritten)
          *pcbDstLength   = (chWritten * sizeof(CHAR)) - sizeof(CHAR);
        break;
      }

      case DBTYPE_SRC_DST(DBTYPE_VARIANT, DBTYPE_WSTR):
      {
        hr = VariantToString((VARIANT*)pSrcValue, (WCHAR*)pDstValue, cbDstMaxLength/sizeof(WCHAR), dwConvFlags);

        //LENGTH
        //NOTE: This doesn't include the NULL terminator
        if(pcbDstLength)
          *pcbDstLength   = wcslen((WCHAR*)pDstValue)*sizeof(WCHAR);
        break;
      }

      case DBTYPE_SRC_DST(DBTYPE_WSTR, DBTYPE_VARIANT):
      {
        VARIANT vVariant;
        V_VT(&vVariant) = VT_BSTR;
        V_BSTR(&vVariant) = SysAllocString((WCHAR*)pSrcValue);
        memcpy(pDstValue, &vVariant, sizeof(VARIANT));

        //LENGTH
        if(pcbDstLength)
          *pcbDstLength   = sizeof(VARIANT);
        break;
      }

      case DBTYPE_SRC_DST(DBTYPE_HCHAPTER, DBTYPE_WSTR):
      {
        //TODO
        IUnknown* pIUnknown = *(IUnknown**)pSrcValue;
        StringFormat((WCHAR*)pDstValue, cbDstMaxLength/sizeof(WCHAR), L"0x%p", pIUnknown);

        //LENGTH
        //NOTE: This doesn't include the NULL terminator
        if(pcbDstLength)
          *pcbDstLength   = wcslen((WCHAR*)pDstValue)*sizeof(WCHAR);
        break;
      }

      case DBTYPE_SRC_DST(DBTYPE_WSTR, DBTYPE_HCHAPTER):
      {
        //TODO - I have no clue how to update a hChapter columns?
        //But since we allow binding in the Accessor as native HCHAPTER we
        //need to support the SetData case, otherwise it will assert...

        //LENGTH
        if(pcbDstLength)
          *pcbDstLength   = sizeof(HCHAPTER);
        break;
      }

      default:
      {
        if(wSrcType & DBTYPE_VECTOR && wDstType == DBTYPE_WSTR)
        {
          hr = VectorToString((DBVECTOR*)pSrcValue, wSrcType, (WCHAR*)pDstValue, cbDstMaxLength/sizeof(WCHAR));

          //LENGTH
          if(pcbDstLength)
            *pcbDstLength   = wcslen((WCHAR*)pDstValue)*sizeof(WCHAR);
          break;
        }
        else if(wDstType & DBTYPE_VECTOR && wSrcType == DBTYPE_WSTR)
        {
          hr = StringToVector((WCHAR*)pSrcValue, wDstType, (DBVECTOR*)pDstValue);

          //LENGTH
          if(pcbDstLength)
            *pcbDstLength   = sizeof(DBVECTOR);
          break;
        }
        else if(wSrcType & DBTYPE_ARRAY && wDstType == DBTYPE_WSTR)
        {
          hr = SafeArrayToString(*(SAFEARRAY**)pSrcValue, wSrcType, (WCHAR*)pDstValue, cbDstMaxLength/sizeof(WCHAR));

          //LENGTH
          if(pcbDstLength)
            *pcbDstLength   = wcslen((WCHAR*)pDstValue)*sizeof(WCHAR);
          break;
        }
        else if(wDstType & DBTYPE_ARRAY && wSrcType == DBTYPE_WSTR)
        {
          hr = StringToSafeArray((WCHAR*)pSrcValue, wDstType, (SAFEARRAY**)pDstValue);

          //LENGTH
          if(pcbDstLength)
            *pcbDstLength   = sizeof(DBVECTOR);
          break;
        }
        else
        {
          //Unhandled Conversion?
          hr = DB_E_CANTCONVERTVALUE;
        }
      }
    };
  }

  //Otherwise use the DataConversion Library...
  //Either we didn't support the conversion, or the user explcitly requested DC
  if((dwConvFlags & CONV_MSDADC_ONLY) || FAILED(hr))
  {
    //Obtain DataConversion library
    if(!g_spDataConvert)
      TESTC(hr = g_spDataConvert.CoCreateInstance(CLSID_OLEDB_CONVERSIONLIBRARY));

    //Unable to obtain DC or not allowed to use it...
    if(!g_spDataConvert)
      TESTC(hr = DB_E_CANTCONVERTVALUE);

    //We need to convert from the consumers type to ours...
    hr = g_spDataConvert->DataConvert(
        wSrcType,             // wSrcType
        wDstType,             // wDstType
        cbSrcLength,            // cbSrcLength
        pcbDstLength,           // pcbDstLength
        pSrcValue,              // pSrc
        pDstValue,              // pDst
        cbDstMaxLength,           // cbDstMaxLength
        dbSrcStatus,            // dbsSrcStatus
        pdbDstStatus,           // pdbsStatus
        bPrecision,             // bPrecision
        bScale,               // bScale
        0L );               // dwFlags
  }

CLEANUP:
  return hr;
}

HRESULT DBIDCopy | ( | DBID * | pDst,
 |  | const DBID * | pSrc
 | ) |  |

Definition at line 1833 of file common.cpp.

{
  ASSERT(pDst && pSrc);
  HRESULT hr = S_OK;

  //Simple case, no out-of-line data...
  memcpy(pDst, pSrc, sizeof(DBID));

  //Now copy any outofline data...
  switch(pDst->eKind)
  {
    case DBKIND_PGUID_PROPID:
      pDst->uGuid.pguid = NULL;
      if(pSrc->uGuid.pguid)
      {
        SAFE_ALLOC(pDst->uGuid.pguid, GUID, 1);
        memcpy(pDst->uGuid.pguid, pSrc->uGuid.pguid, sizeof(GUID));
      }
      break;

    case DBKIND_PGUID_NAME:
      pDst->uGuid.pguid = NULL;
      if(pSrc->uGuid.pguid)
      {
        SAFE_ALLOC(pDst->uGuid.pguid, GUID, 1);
        memcpy(pDst->uGuid.pguid, pSrc->uGuid.pguid, sizeof(GUID));
      }
      pDst->uName.pwszName = wcsDuplicate(pDst->uName.pwszName);
      break;

    case DBKIND_GUID_NAME:
    case DBKIND_NAME:
      pDst->uName.pwszName = wcsDuplicate(pDst->uName.pwszName);
      break;
  };

CLEANUP:
  return hr;
}

BOOL DBIDEqual | ( | const DBID * | pDst,
 |  | const DBID * | pSrc
 | ) |  |

Definition at line 1879 of file common.cpp.

{
  ASSERT(pDst && pSrc);
  BOOL bEqual = FALSE;

  if(pDst->eKind == pSrc->eKind)
  {
    //Now compare sub-parts...
    switch(pDst->eKind)
    {
      case DBKIND_PGUID_NAME:
        if(bEqual = pDst->uGuid.pguid && pSrc->uGuid.pguid ? memcmp(pDst->uGuid.pguid, pSrc->uGuid.pguid, sizeof(GUID))==0 : pDst->uGuid.pguid == pSrc->uGuid.pguid)
          bEqual = StringCompare(pDst->uName.pwszName, pSrc->uName.pwszName);
        break;

      case DBKIND_PGUID_PROPID:
        if(bEqual = pDst->uGuid.pguid && pSrc->uGuid.pguid ? memcmp(pDst->uGuid.pguid, pSrc->uGuid.pguid, sizeof(GUID))==0 : pDst->uGuid.pguid == pSrc->uGuid.pguid)
          bEqual = (pDst->uName.ulPropid == pSrc->uName.ulPropid);
        break;

      case DBKIND_PROPID:
        bEqual = (pDst->uName.ulPropid == pSrc->uName.ulPropid);
        break;

      case DBKIND_GUID_PROPID:
        bEqual = (pDst->uName.ulPropid == pSrc->uName.ulPropid);
        break;

      case DBKIND_GUID:
        bEqual = memcmp(&pDst->uGuid.guid, &pSrc->uGuid.guid, sizeof(GUID))==0;
        break;

      case DBKIND_GUID_NAME:
        if(bEqual = memcmp(&pDst->uGuid.guid, &pSrc->uGuid.guid, sizeof(GUID))==0)
          bEqual = StringCompare(pDst->uName.pwszName, pSrc->uName.pwszName);
        break;

      case DBKIND_NAME:
        bEqual = StringCompare(pDst->uName.pwszName, pSrc->uName.pwszName);
        break;

      default:
        break;
    };

  }

  //Otherwise
  return bEqual;
}

void DBIDFree ( DBID * pDBID )

Definition at line 1805 of file common.cpp.

{
  if(pDBID)
  {
    switch(pDBID->eKind)
    {
      case DBKIND_PGUID_NAME:
        SAFE_FREE(pDBID->uGuid.pguid);
        SAFE_FREE(pDBID->uName.pwszName);
        break;

      case DBKIND_GUID_NAME:
      case DBKIND_NAME:
        SAFE_FREE(pDBID->uName.pwszName);
        break;

      case DBKIND_PGUID_PROPID:
        SAFE_FREE(pDBID->uGuid.pguid);
        break;
    };
  }
}

HRESULT DBIDToString | ( | const DBID * | pDBID,
 |  | WCHAR * | pwsz,
 |  | ULONG | ulMaxLen
 | ) |  |

Definition at line 1725 of file common.cpp.

{
  //No-op
  if(!ulMaxLen)
    return S_OK;

  ASSERT(pwsz);
  WCHAR wszBuffer[MAX_NAME_LEN] = {0};
  pwsz[0] = wEOL;

  //No-op
  if(pDBID == NULL)
  {
    StringCopy(pwsz, L"NULL", MAX_NAME_LEN);
    return S_OK;
  }

  //ColumnID (SubItem)  DBID
  switch(pDBID->eKind)
  {
    case DBKIND_NAME:
      StringFormat(pwsz, ulMaxLen, L"{\"%s\"}", pDBID->uName.pwszName);
      break;

    case DBKIND_PROPID:
      StringFormat(pwsz, ulMaxLen, L"{%ld}", pDBID->uName.ulPropid);
      break;

    case DBKIND_GUID:
      StringFromGUID2(pDBID->uGuid.guid, pwsz, ulMaxLen);
      break;

    case DBKIND_GUID_NAME:
      StringFromGUID2(pDBID->uGuid.guid, wszBuffer, MAX_NAME_LEN);
      StringFormat(pwsz, ulMaxLen, L"{%s,\"%s\"}", wszBuffer, pDBID->uName.pwszName);
      break;

    case DBKIND_GUID_PROPID:
    {
      //Special Case:  Maybe this is a defined RowCol DBID
      WCHAR* pwszColName = GetRowColName(pDBID);
      if(pwszColName)
      {
        StringCopy(pwsz, pwszColName, ulMaxLen);
      }
      else
      {
        StringFromGUID2(pDBID->uGuid.guid, wszBuffer, MAX_NAME_LEN);
        StringFormat(pwsz, ulMaxLen, L"{%s,%ld}", wszBuffer, pDBID->uName.ulPropid);
      }
      break;
    }

    case DBKIND_PGUID_NAME:
      if(pDBID->uGuid.pguid)
        StringFromGUID2(*pDBID->uGuid.pguid, wszBuffer, MAX_NAME_LEN);
      StringFormat(pwsz, ulMaxLen, L"{&%s,\"%s\"}", wszBuffer, pDBID->uName.pwszName);
      break;

    case DBKIND_PGUID_PROPID:
      if(pDBID->uGuid.pguid)
        StringFromGUID2(*pDBID->uGuid.pguid, wszBuffer, MAX_NAME_LEN);
      StringFormat(pwsz, ulMaxLen, L"{&%s,%ld}", wszBuffer, pDBID->uName.ulPropid);
      break;

    default:
      ASSERT(!"Unhandled Type!");
      break;
  };

  //Make sure the resulting string is NULL terminated
  pwsz[ulMaxLen ? ulMaxLen-1 : 0] = wEOL;
  return S_OK;
}

HRESULT DelRegEntry | ( | HKEY | hRootKey,
 |  | WCHAR * | pwszKeyName,
 |  | BOOL | fSubKeys
 | ) |  |

Definition at line 3930 of file common.cpp.

{
  HKEY hKey = NULL;
  WCHAR wszBuffer[MAX_NAME_LEN];
  HRESULT hr = S_OK;

  //RegDeleteKey only deletes the key if there are no subkeys
  if(SUCCEEDED(hr = OpenRegKey(hRootKey, pwszKeyName, 0, KEY_READ | KEY_WRITE, &hKey)))
  {
    //This is a pain to always have to delete the subkeys to remove the key...
    if(fSubKeys)
    {
      //Loop over all subkeys...
      //NOTE: GetRegEnum requires KEY_ENUMERATE_SUB_KEYS which is found in KEY_READ.
      while((hr = GetRegEnumKey(hKey, NULL, 0, wszBuffer, MAX_NAME_LEN))==S_OK)
      {
        //Recurse and delete the sub key...
        if(FAILED(hr = DelRegEntry(hKey, wszBuffer, fSubKeys)))
          break;
      }
    }

    //Now we can delete the root key
    hr = DelRegEntry(hRootKey, pwszKeyName);
    CloseRegKey(hKey);
  }

  return hr;
}

HRESULT DelRegEntry | ( | HKEY | hRootKey,
 |  | WCHAR * | pwszKeyName
 | ) |  |

Definition at line 3898 of file common.cpp.

{
  HRESULT hr;

  //DelRegEntry
  if(IsUnicodeOS())
  {
    hr = RegDeleteKeyW(hRootKey, pwszKeyName);
  }
  else
  {
    CHAR szBuffer[MAX_NAME_LEN];
    ConvertToMBCS(pwszKeyName, szBuffer, MAX_NAME_LEN);
    hr = RegDeleteKeyA(hRootKey, szBuffer);
  }

  //Entry successfully deleted - return S_OK
  if(hr==S_OK)
    return S_OK;

  //Entry not found - return S_FALSE
  if(hr==ERROR_FILE_NOT_FOUND)
    return S_FALSE;

  return E_FAIL;
}

HRESULT FreeBindingData | ( | DBCOUNTITEM | cBindings,
 |  | const DBBINDING * | rgBindings,
 |  | void * | pData,
 |  | BOOL | fSetData
 | ) |  |

Definition at line 2285 of file common.cpp.

{
  //Need to walk the array and free any other alloc memory
  for(ULONG i=0; i<cBindings; i++)
  {
    //First make sure we have valid data...
    if(!VALUE_IS_BOUND(rgBindings[i]) || !STATUS_IS_BOUND(rgBindings[i]))
      continue;

    //Free any "out-of-line" memory
    DBSTATUS dbStatus = BINDING_STATUS(rgBindings[i], pData);
    switch(dbStatus)
    {
      case DBSTATUS_S_OK:
      case DBSTATUS_S_TRUNCATED:
      case DBSTATUS_S_ALREADYEXISTS:
        //Always free in successful status (either Getting or Setting).
        if(rgBindings[i].dwMemOwner == DBMEMOWNER_CLIENTOWNED)
          FreeData(rgBindings[i].wType, 1, &BINDING_VALUE(rgBindings[i], pData));
        break;

      case DBSTATUS_S_ISNULL:
      case DBSTATUS_S_DEFAULT:
      case DBSTATUS_S_IGNORE:
        //Nothing to do in either case Getting or Setting.
        //In Getting data in undefined, in Setting the value was never setup...
        break;

      default:
        //Otherwise data is undefined for retrieval from the provider (GetData, GetColumns, etc)
        //But for Setting (SetData, InsertRow, SetColumns, etc), we created the data
        //which has to be free'd even if the provider failed.

        //NOTE: For IUnknown columns the provider releases on Setting, but instead of
        //having special logic all over, we AddRef the Stream an extra time before
        //setting, so it can always be released like the rest of the data and doesn't
        //have to be special cased...

//        if(fSetData && rgBindings[i].dwMemOwner == DBMEMOWNER_CLIENTOWNED)
//          FreeData(rgBindings[i].wType, 1, &BINDING_VALUE(rgBindings[i], pData));
        break;
    }
  }

  return S_OK;
}

HRESULT FreeBindings | ( | DBCOUNTITEM * | pcBindings,
 |  | DBBINDING ** | prgBindings
 | ) |  |

Definition at line 2362 of file common.cpp.

{
  ASSERT(pcBindings);
  ASSERT(prgBindings);

  //Need to walk the array and free any other alloc memory
  for(ULONG i=0; i<*pcBindings; i++)
  {
    //Free any pObjects
    if(*prgBindings)
      SAFE_FREE((*prgBindings)[i].pObject);
  }

  //Now we can free the outer struct
  *pcBindings = 0;
  SAFE_FREE(*prgBindings);
  return S_OK;
}

HRESULT FreeColAccess | ( | ULONG * | pcColAccess,
 |  | DBCOLUMNACCESS ** | prgColAccess,
 |  | void ** | ppData
 | ) |  |

Definition at line 2386 of file common.cpp.

{
  ASSERT(pcColAccess);
  ASSERT(prgColAccess);

  //Now we can free the outer struct
  *pcColAccess = 0;
  SAFE_FREE(*prgColAccess);
  SAFE_FREE(*ppData);
  return S_OK;
}

HRESULT FreeConstraintDesc | ( | DBORDINAL * | pcConsDesc,
 |  | DBCONSTRAINTDESC ** | prgConsDesc,
 |  | BOOL | fFree
 | ) |  |

Definition at line 2404 of file common.cpp.

{
  DBORDINAL     indexCol;
  DBCONSTRAINTDESC  *rgConsDesc;

  ASSERT(pcConsDesc);
  ASSERT(prgConsDesc);

  rgConsDesc = *prgConsDesc;
  for(DBORDINAL index = 0; index<*pcConsDesc; index++)
  {
    // release the current element
    DBIDFree(rgConsDesc[index].pConstraintID);
    SAFE_FREE(rgConsDesc[index].pConstraintID);

    DBIDFree(rgConsDesc[index].pReferencedTableID);
    SAFE_FREE(rgConsDesc[index].pReferencedTableID);

    SAFE_FREE(rgConsDesc[index].pwszConstraintText);

    for (indexCol = 0; indexCol < rgConsDesc[index].cColumns; indexCol++)
      DBIDFree(&rgConsDesc[index].rgColumnList[indexCol]);

    SAFE_FREE(rgConsDesc[index].rgColumnList);

    for (indexCol = 0; indexCol < rgConsDesc[index].cForeignKeyColumns; indexCol++)
      DBIDFree(&rgConsDesc[index].rgForeignKeyColumnList[indexCol]);

    SAFE_FREE(rgConsDesc[index].rgForeignKeyColumnList);
  }

  //Now we can free the outer struct
  *pcConsDesc = 0;
  if(fFree)
    SAFE_FREE(*prgConsDesc);
  return S_OK;
}

HRESULT FreeData | ( | DBTYPE | wType,
 |  | DBLENGTH | cData,
 |  | void * | rgData
 | ) |  |

Definition at line 2196 of file common.cpp.

{
  //no-op
  if(!rgData)
    return S_OK;

  //Loop over all elements of the array
  for(ULONG i=0; i<cData; i++)
  {
    //Free any "out-of-line" memory
    switch(wType)
    {
      case DBTYPE_BSTR:
      {
        BSTR* pbstr = &((BSTR*)rgData)[i];
        SAFE_BSTRFREE(*pbstr);
        break;
      }

      case DBTYPE_VARIANT:
      {
        VARIANT* pVariant = &((VARIANT*)rgData)[i];
        VariantClearFast(pVariant);
        break;
      }

      case DBTYPE_IDISPATCH:
      case DBTYPE_IUNKNOWN:
      {
        IUnknown* pIUnknown = ((IUnknown**)rgData)[i];
        SAFE_RELEASE(pIUnknown);
        break;
      }

      case DBTYPE_VARNUMERIC:
      case DBTYPE_PROPVARIANT:
        //TODO:
        break;

      default:
      {
        //NOTE: All the modifiers are mutually exclusive.

        //DBTYPE_BYREF
        if(wType & DBTYPE_BYREF)
        {
          void* pByRef  = ((void**)rgData)[i];

          //Free any outofline sub elements, (recursive)
          FreeData(wType & ~DBTYPE_BYREF, 1, pByRef);

          //Free the allocated block
          SAFE_FREE(pByRef);
        }

        //DBTYPE_VECTOR
        else if(wType & DBTYPE_VECTOR)
        {
          DBVECTOR* pVector = &((DBVECTOR*)rgData)[i];

          //Free any outofline sub elements, (recursive)
          FreeData(wType & ~DBTYPE_VECTOR, pVector->size, pVector->ptr);

          //Free the block of memory
          SAFE_FREE(pVector->ptr);
        }

        //DBTYPE_ARRAY
        else if(wType & DBTYPE_ARRAY)
        {
          SAFEARRAY** ppSafeArray = &((SAFEARRAY**)rgData)[i];
          if(*ppSafeArray)
            SafeArrayDestroy(*ppSafeArray);
          *ppSafeArray = NULL;
        }

        break;
      }
    };
  }

  return S_OK;
}

RECT GetClientCoords | ( | HWND | hWndParent,
 |  | HWND | hWnd
 | ) |  |

Definition at line 2919 of file common.cpp.

{
  //Need the Boundary Rectangle in Client Coordinates, with
  //respect to the parent window...
  RECT rect, rectClientCoords;
  GetWindowRect(hWnd, &rect);

  POINT ptTopLeft = { rect.left, rect.top };
  ScreenToClient(hWndParent, &ptTopLeft);
  POINT ptBottomRight = { rect.right, rect.bottom };
  ScreenToClient(hWndParent, &ptBottomRight);

  rectClientCoords.top    = ptTopLeft.y;
  rectClientCoords.left   = ptTopLeft.x;
  rectClientCoords.bottom   = ptBottomRight.y;
  rectClientCoords.right    = ptBottomRight.x;
  return rectClientCoords;
}

SIZE GetClientSize ( HWND hWnd )

Definition at line 2899 of file common.cpp.

{
  RECT rect = { 0,0,0,0 };
  SIZE size = { 0,0 };

  //Obtain window cordinates.
  if(GetClientRect(hWnd, &rect))
  {
    //Fillin SIZE struct
    size.cx = rect.right - rect.left;
    size.cy = rect.bottom - rect.top;
  }
  return size;
}

WCHAR* GetColName ( const DBCOLUMNINFO * pColInfo )

Definition at line 2452 of file common.cpp.

{
  static WCHAR* pwszNullName = L"<NULL>";
  static WCHAR* pwszEmptyName = L"<Empty>";
  static WCHAR* pwszBookmarkName = L"<Bookmark>";

  //Providers are not required to return a Column Name for any column
  //Useful information, but some columns (ie: Bookmarks) and others
  //May not have a column name.  So this method will either just return
  //whatever the provider returned or will generate an appropiate one if not...
  //We really need a column name to help for the GUI headers

  if(pColInfo == NULL)
    return NULL;

  WCHAR* pwszColName = pColInfo->pwszName;
  if(pColInfo->iOrdinal == 0)
  {
    //Bookmark
    if(!pwszColName || !pwszColName[0])
      pwszColName = pwszBookmarkName;
  }
  else
  {
    //otherwise
    if(!pwszColName || !pwszColName[0])
    {
      //If this is a DBID defined column
      if(pColInfo->columnid.eKind == DBKIND_GUID_PROPID)
        pwszColName = GetRowColName(&pColInfo->columnid);
    }
  }

  //Handle Boundaries
  if(!pwszColName)
    pwszColName = pwszNullName;
  else if(!pwszColName[0])
    pwszColName = pwszEmptyName;

  ASSERT(pwszColName);
  return pwszColName;
}

DBTYPE GetDBType ( WCHAR * pwsz )

Definition at line 2165 of file common.cpp.

{
  return (DBTYPE)GetMapName(pwsz, g_cDBTypes, g_rgDBTypes);
}

HRESULT GetDBTypeMaxSize | ( | DBTYPE | wType,
 |  | DBLENGTH * | pulMaxSize,
 |  | BYTE * | pbPrecision,
 |  | BYTE * | pbScale
 | ) |  |

Definition at line 1992 of file common.cpp.

{
  HRESULT   hr = S_OK;

  //On failure we will set the column size to the max, so callers
  //don't have to condition this for normal unknown types...
  DBLENGTH  ulMaxSize = MAX_COL_SIZE;
  BYTE    bPrecision  = 0;
  BYTE    bScale    = 0;

  //Values taken from OLE DB Spec, Appendix A
  //In some situations we need to know ulMaxSize, Prec, Scale, as defaults or creating
  //an accessor before we actually have ColumnsInfo.  Useful info, but mainly used
  //only for defaults for dialogs...

  switch(wType)
  {
    case DBTYPE_EMPTY:
    case DBTYPE_NULL:
      ulMaxSize = 0;
      break;

    case DBTYPE_STR:
    case DBTYPE_WSTR:
    case DBTYPE_BYTES:
    case DBTYPE_VARNUMERIC:
      ulMaxSize = MAX_COL_SIZE;
      break;

    case DBTYPE_BSTR:
      ulMaxSize = sizeof(BSTR);
      break;

    case DBTYPE_I1:
    case DBTYPE_UI1:
      ulMaxSize = 1;
      bPrecision = 3;
      break;

    case DBTYPE_I2:
    case DBTYPE_UI2:
      ulMaxSize = 2;
      bPrecision = 5;
      break;

    case DBTYPE_I4:
    case DBTYPE_UI4:
      ulMaxSize = 4;
      bPrecision = 10;
      break;

    case DBTYPE_I8:
      ulMaxSize = 8;
      bPrecision = 19;
      break;

    case DBTYPE_UI8:
      ulMaxSize = 8;
      bPrecision = 20;
      break;

    case DBTYPE_R4:
      ulMaxSize = sizeof(float);
      bPrecision = 7;
      break;

    case DBTYPE_R8:
      ulMaxSize = sizeof(double);
      bPrecision = 16;
      break;

    case DBTYPE_CY:
      ulMaxSize = 8;
      bPrecision = 19;
      break;

    case DBTYPE_NUMERIC:
      ulMaxSize = sizeof(DB_NUMERIC);
      bPrecision = 38;
      break;

    case DBTYPE_DATE:
      ulMaxSize = sizeof(double);
      break;

    case DBTYPE_BOOL:
      ulMaxSize = 2;
      break;

    case DBTYPE_VARIANT:
      ulMaxSize = sizeof(VARIANT);
      break;

    case DBTYPE_IDISPATCH:
    case DBTYPE_IUNKNOWN:
      ulMaxSize = sizeof(IUnknown*);
      break;

    case DBTYPE_GUID:
      ulMaxSize = sizeof(GUID);
      break;

    case DBTYPE_ERROR:
      ulMaxSize = sizeof(SCODE);
      break;

    case DBTYPE_DBDATE:
      ulMaxSize = sizeof(DBDATE);
      break;

    case DBTYPE_DBTIME:
      ulMaxSize = sizeof(DBTIME);
      break;

    case DBTYPE_DBTIMESTAMP:
      ulMaxSize = sizeof(DBTIMESTAMP);
      break;

    case DBTYPE_DECIMAL:
      ulMaxSize = sizeof(DECIMAL);
      bPrecision = 28;
      break;

    default:
      //DBTYPE_BYREF
      if(wType & DBTYPE_BYREF)
      {
        ulMaxSize = sizeof(void*);
      }
      //DBTYPE_ARRAY
      else if(wType & DBTYPE_ARRAY)
      {
        ulMaxSize = sizeof(SAFEARRAY*);
      }
      //DBTYPE_VECTOR
      else if(wType & DBTYPE_VECTOR)
      {
        ulMaxSize = sizeof(DBVECTOR*);
      }
      else
      {
        //On failure we will set the column size to the max (already done above), so callers
        //don't have to condition this for normal unknown types...
        hr = E_FAIL;
      }
      break;
  };

  if(pulMaxSize)
    *pulMaxSize = ulMaxSize;
  if(pbPrecision)
    *pbPrecision = bPrecision;
  if(pbScale)
    *pbScale = bScale;
  return hr;
}

WCHAR* GetDBTypeName ( DBTYPE wType )

Definition at line 2155 of file common.cpp.

{
  return GetBitMapName(wType, g_cDBTypes, g_rgDBTypes, DBTYPE_VECTOR | DBTYPE_ARRAY | DBTYPE_BYREF | DBTYPE_RESERVED/*dwBitStart*/);
}

BOOL GetEditBoxValue | ( | HWND | hEditWnd,
 |  | LONG * | plValue,
 |  | LONG | lMin,
 |  | LONG | lMax,
 |  | BOOL | fAllowEmpty
 | ) |  |

Definition at line 3153 of file common.cpp.

{
  ASSERT(hEditWnd);
  ASSERT(plValue);
  WCHAR wszBuffer[MAX_QUERY_LEN] = {0};

  //Get the EditText
  wSendMessage(hEditWnd, WM_GETTEXT, MAX_QUERY_LEN, wszBuffer);
  if(wszBuffer[0] || !fAllowEmpty)
  {
    //Delegate
    if(!wszBuffer[0] || !ConvertToLONG(wszBuffer, plValue, lMin, lMax))
    {
      wMessageBox(hEditWnd, MB_TASKMODAL | MB_ICONERROR | MB_OK,  wsz_ERROR,
        wsz_INVALID_VALUE_, wszBuffer, lMin, lMax);
      SetFocus(hEditWnd);
      return FALSE;
    }
  }

  return TRUE;
}

DBLENGTH GetMaxDisplaySize | ( | DBTYPE | wBindingType,
 |  | DBTYPE | wBackendType,
 |  | DBLENGTH | ulColumnSize,
 |  | DBLENGTH | ulMaxVarSize
 | ) |  |

Definition at line 2501 of file common.cpp.

{
  //Obtain the correct number of bytes to respresent the data in the wBindingType format.
  //NOTE: For variable types, the bytes will be bounded by ulMaxVarSize (cbMaxLen), for
  //fixed length type bindings, the size will be bounded by the type, (ie: NOT ulMaxVarSize),
  //since the provider ignores cbMaxLen for fixed length types and assumes their is enough
  //storage for the type...
  DBLENGTH cbMaxLen = 0;

  //May need to adjust the MaxLen, depending upon what the BindingType is
  switch(wBindingType)
  {
    //Strings are kind of a pain.  Although we get the luxury of
    //Having the provider coerce the type, we need to allocate a buffer
    //large enough for the provider to store the type in "string" format
    case DBTYPE_STR:
    case DBTYPE_WSTR:
    {
      switch(wBackendType)
      {
        case DBTYPE_NULL:
        case DBTYPE_EMPTY:
          //Don't need much room for these...
          cbMaxLen = 0 + 1;
          break;

        case DBTYPE_I1:
        case DBTYPE_I2:
        case DBTYPE_I4:
        case DBTYPE_UI1:
        case DBTYPE_UI2:
        case DBTYPE_UI4:
        case DBTYPE_R4:
        case DBTYPE_HCHAPTER:
          //All of the above fit well into 15 characters of display size
          cbMaxLen = 15 + 1;
          break;

        case DBTYPE_I8:
        case DBTYPE_UI8:
        case DBTYPE_R8:
        case DBTYPE_CY:
        case DBTYPE_ERROR:
        case DBTYPE_BOOL:
          //All of the above fit well into 25 characters of display size
          cbMaxLen = 25 + 1;
          break;

        case DBTYPE_DECIMAL:
        case DBTYPE_NUMERIC:
        case DBTYPE_DATE:
        case DBTYPE_DBDATE:
        case DBTYPE_DBTIMESTAMP:
        case DBTYPE_GUID:
          //All of the above fit well into 50 characters of display size
          cbMaxLen = 50 + 1;
          break;

        case DBTYPE_BYTES:
          //Bytes -> String, 1 byte = 2 Ascii chars. (0xFF == "FF")
          cbMaxLen = min(ulColumnSize, ulMaxVarSize) * 2 + 1;
          break;

        case DBTYPE_STR:
        case DBTYPE_WSTR:
          //String -> String
          //ulColumnSize already contains the length
          cbMaxLen = min(ulColumnSize, ulMaxVarSize) + 1;
          break;

        case DBTYPE_IUNKNOWN:
        case DBTYPE_IDISPATCH:
          cbMaxLen = sizeof(IUnknown*);
          break;

        default:
          //For everything else
          //Just default to our largest buffer size
          cbMaxLen = ulMaxVarSize;
          break;
      };

      //Adjust for Unicode strings
      if(wBindingType == DBTYPE_WSTR)
        cbMaxLen *= 2;

      //Make sure variable types are bounded by the maximum variable size,
      //since we are binding this is a string (STR/WSTR)
      cbMaxLen = min(cbMaxLen, ulMaxVarSize);
      break;
    }

    default:
    {
      //Otherwise were not binding it as an inline string, so we don't need to know the
      //total formating string length, we can simply specify the size of the type...

      //NOTE: On failure this function already sets the maxlen to the max for unrecognized types.
      GetDBTypeMaxSize(wBindingType, &cbMaxLen);

      //Make sure variable types are bounded by the maximum variable size.
      //We can't do this for fixed length types since the provider assumes this memory
      //is at least the size of the data type...
      if(IsVariableType(wBindingType))
        cbMaxLen = min(cbMaxLen, ulMaxVarSize);
      break;
    }
  };

  return cbMaxLen;
}

ULONG_PTR GetMenuData | ( | HMENU | hMenu,
 |  | UINT | uItem,
 |  | BOOL | fByPosition
 | ) |  |

Definition at line 3248 of file common.cpp.

{
  //Setup our Menu Structure...
  //NOTE: HBITMAP was added in IE5, and may not work on older controls...
  MENUITEMINFOA menuinfo = { offsetof(MENUITEMINFOA, cch) + sizeof(UINT), MIIM_DATA, 0, 0, 0, NULL, NULL, NULL, 0, NULL, 0 };

#ifndef _WIN64
  //First set this menu's item data
  //NOTE: HBITMAP was added in IE5, and may not work on older controls...
  //So we will first try with the smaller size, since this should be backward compatible...
  if(GetMenuItemInfoA(hMenu, uItem, fByPosition, &menuinfo))
    return menuinfo.dwItemData;
#endif //_WIN64

  //Retry Logic
  //On some OS's, (Win64), it only assumes the full NT5 structure size
  //thus for a new OS doesn't have backward compatability issues...
  menuinfo.cbSize = sizeof(MENUITEMINFOA);
  if(GetMenuItemInfoA(hMenu, uItem, fByPosition, &menuinfo))
    return menuinfo.dwItemData;
  return 0;
}

WCHAR* GetProgID ( REFCLSID clsid )

Definition at line 3570 of file common.cpp.

{
  WCHAR* pwszProgID = NULL;
  WCHAR wszBuffer[MAX_NAME_LEN];
  wszBuffer[0] = wEOL;

  //ProgID From the Sprecified CLSID
  if(FAILED(ProgIDFromCLSID(clsid, &pwszProgID)))
  {
    //If that does work, we will just return the
    //String representation of the GUID
    StringFromGUID2(clsid, wszBuffer, MAX_NAME_LEN);
    pwszProgID = wcsDuplicate(wszBuffer);
  }

  return pwszProgID;
}

HRESULT GetRegEntry | ( | HKEY | hRootKey,
 |  | WCHAR * | pwszKeyName,
 |  | WCHAR * | pwszValueName,
 |  | WCHAR * | pwszValue,
 |  | ULONG | cBytes
 | ) |  |

Definition at line 3715 of file common.cpp.

{
  if(IsUnicodeOS())
  {
    return GetRegEntry(hRootKey, pwszKeyName, pwszValueName, pwszValue, cBytes, NULL, REG_SZ);
  }
  else
  {
    CHAR szBuffer[MAX_NAME_LEN];
    HRESULT hr = GetRegEntry(hRootKey, pwszKeyName, pwszValueName, szBuffer, MAX_NAME_LEN, NULL, REG_SZ);
    if(SUCCEEDED(hr))
      ConvertToWCHAR(szBuffer, pwszValue, cBytes);

    return hr;
  }
}

HRESULT GetRegEntry | ( | HKEY | hRootKey,
 |  | WCHAR * | pwszKeyName,
 |  | WCHAR * | pwszValueName,
 |  | WCHAR ** | ppwszValue
 | ) |  |

Definition at line 3737 of file common.cpp.

{
  HRESULT hr = S_OK;
  ASSERT(ppwszValue);
  ULONG cBytes = 0;
  CHAR* pszBuffer = NULL;

  //Obtain the length first (value = NULL)
  TESTC(hr = GetRegEntry(hRootKey, pwszKeyName, pwszValueName, NULL, 0, &cBytes, REG_SZ));

  //Allocate the string
  //NOTE: The length returned from RegQueryValueEx also includes the NULL terminator
  SAFE_ALLOC(*ppwszValue, WCHAR, cBytes);

  if(IsUnicodeOS())
  {
    //Now obtain the data
    TESTC(hr = GetRegEntry(hRootKey, pwszKeyName, pwszValueName, *ppwszValue, cBytes, &cBytes, REG_SZ));
  }
  else
  {
    //Allocate the string
    SAFE_ALLOC(pszBuffer, CHAR, cBytes);

    //Now obtain the data
    TESTC(hr = GetRegEntry(hRootKey, pwszKeyName, pwszValueName, pszBuffer, cBytes, &cBytes, REG_SZ));
    ConvertToWCHAR(pszBuffer, *ppwszValue, cBytes);
    return hr;
  }

CLEANUP:
  SAFE_FREE(pszBuffer);
  return hr;
}

HRESULT GetRegEntry | ( | HKEY | hRootKey,
 |  | WCHAR * | pwszKeyName,
 |  | WCHAR * | pwszValueName,
 |  | ULONG * | pulValue
 | ) |  |

Definition at line 3777 of file common.cpp.

{
  return GetRegEntry(hRootKey, pwszKeyName, pwszValueName, pulValue, sizeof(ULONG), NULL, REG_DWORD);
}

HRESULT GetRegEntry | ( | HKEY | hRootKey,
 |  | WCHAR * | pwszKeyName,
 |  | WCHAR * | pwszValueName,
 |  | void * | pStruct,
 |  | ULONG | cBytes,
 |  | ULONG * | pcActualBytes,
 |  | ULONG | dwType
 | ) |  |

Definition at line 3787 of file common.cpp.

{
  HRESULT hr = E_FAIL;
  HKEY hKey = NULL;

  //NOTE: pStruct can be NULL if the user is just obtaining the length...

  //Obtain the Data for the above key
  if(pwszKeyName)
  {
    if(FAILED(OpenRegKey(hRootKey, pwszKeyName, 0, KEY_READ, &hKey)))
      goto CLEANUP;
  }

  if(IsUnicodeOS())
  {
    hr = RegQueryValueExW(hKey ? hKey : hRootKey, pwszValueName, NULL, &dwType, (BYTE*)pStruct, &cBytes);
  }
  else
  {
    //Obtain the Data for the above key
    CHAR szBuffer[MAX_NAME_LEN];
    ConvertToMBCS(pwszValueName, szBuffer, MAX_NAME_LEN);

    hr = RegQueryValueExA(hKey ? hKey : hRootKey, szBuffer, NULL, &dwType, (BYTE*)pStruct, &cBytes);
  }

  if(hr != S_OK)
    hr = E_FAIL;

CLEANUP:
  if(pcActualBytes)
    *pcActualBytes = cBytes;

  CloseRegKey(hKey);
  return hr;
}

HRESULT GetRegEnumKey | ( | HKEY | hRootKey,
 |  | WCHAR * | pwszKeyName,
 |  | DWORD | dwIndex,
 |  | WCHAR * | pwszSubKeyName,
 |  | ULONG | cBytes
 | ) |  |

Definition at line 3593 of file common.cpp.

{
  HRESULT hr = E_FAIL;
  HKEY hKey = NULL;

  //Need some place to put the key name returned!
  if(!pwszSubKeyName)
    return E_FAIL;

  //Obtain the Key for HKEY_CLASSES_ROOT\"KeyName"
  if(pwszKeyName)
  {
    if(FAILED(OpenRegKey(hRootKey, pwszKeyName, 0, KEY_READ, &hKey)))
      goto CLEANUP;
  }

  if(IsUnicodeOS())
  {
    //Obtain the specified RegItem at the index specified
    hr = RegEnumKeyW(hKey ? hKey : hRootKey, dwIndex, pwszSubKeyName, cBytes);
  }
  else
  {
    CHAR szBuffer[MAX_NAME_LEN] = {0};

    //Obtain the specified RegItem at the index specified
    hr = RegEnumKeyA(hKey ? hKey : hRootKey, dwIndex, szBuffer, MAX_NAME_LEN);
    ConvertToWCHAR(szBuffer, pwszSubKeyName, cBytes);
  }

CLEANUP:
  if(hr != S_OK && hr != ERROR_NO_MORE_ITEMS)
    hr = E_FAIL;
  CloseRegKey(hKey);
  return hr;
}

HRESULT GetRegEnumValue | ( | HKEY | hRootKey,
 |  | WCHAR * | pwszKeyName,
 |  | DWORD | dwIndex,
 |  | WCHAR * | pwszValueName,
 |  | ULONG * | pcBytes
 | ) |  |

Definition at line 3672 of file common.cpp.

{
  HRESULT hr = E_FAIL;
  HKEY hKey = NULL;
  ASSERT(pcBytes);

  //Obtain the Key for HKEY_CLASSES_ROOT\"KeyName"
  if(pwszKeyName)
  {
    if(FAILED(OpenRegKey(hRootKey, pwszKeyName, 0, KEY_READ, &hKey)))
      goto CLEANUP;
  }

  if(IsUnicodeOS())
  {
    //Obtain the specified RegItem at the index specified
    hr = RegEnumValueW(hKey ? hKey : hRootKey, dwIndex, pwszValueName, pcBytes, 0, NULL, NULL, 0);
  }
  else
  {
    CHAR szBuffer[MAX_NAME_LEN] = {0};
    ULONG cTotal = sizeof(szBuffer);

    //Obtain the specified RegItem at the index specified
    hr = RegEnumValueA(hKey ? hKey : hRootKey, dwIndex, pwszValueName ? szBuffer : NULL, &cTotal, 0, NULL, NULL, 0);

    if(pwszValueName)
      ConvertToWCHAR(szBuffer, pwszValueName, *pcBytes);
    *pcBytes = cTotal;
  }

CLEANUP:
  if(hr != S_OK && hr != ERROR_NO_MORE_ITEMS)
    hr = E_FAIL;
  CloseRegKey(hKey);
  return hr;
}

HRESULT GetRegEnumValue | ( | HKEY | hRootKey,
 |  | WCHAR * | pwszKeyName,
 |  | DWORD | dwIndex,
 |  | WCHAR ** | ppwszValueName
 | ) |  |

Definition at line 3636 of file common.cpp.

{
  HRESULT hr = S_OK;
  ULONG cBytes = 0;
  HKEY hKey = NULL;
  ULONG cMaxValueChars = 0;

  //Obtain the Key for HKEY_CLASSES_ROOT\"KeyName"
  if(pwszKeyName)
  {
    if(FAILED(OpenRegKey(hRootKey, pwszKeyName, 0, KEY_READ, &hKey)))
      goto CLEANUP;
  }

  //First obtain the length of the Value...
  if(S_OK == RegQueryInfoKey(hKey ? hKey : hRootKey, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &cMaxValueChars, NULL, NULL, NULL))
  {
    //Alloc a buffer large enough...
    SAFE_ALLOC(*ppwszValueName, WCHAR, cMaxValueChars+1);
    (*ppwszValueName)[0] = wEOL;

    //Now obtain the data...
    cBytes = (cMaxValueChars+1)*sizeof(WCHAR);
    hr = GetRegEnumValue(hRootKey, pwszKeyName, dwIndex, *ppwszValueName, &cBytes);
  }

CLEANUP:
  CloseRegKey(hKey);
  return hr;
}

void* GetThis ( HWND hWnd )

Definition at line 2633 of file common.cpp.

{
  //Return the current value...
  ASSERT(hWnd);
  return (void*)GetWindowLongPtr(hWnd, GWLP_USERDATA);
}

DBTYPE GetVariantType ( WCHAR * pwsz )

Definition at line 2185 of file common.cpp.

{
  return (DBTYPE)GetMapName(pwsz, g_cVariantTypes, g_rgVariantTypes);
}

WCHAR* GetVariantTypeName ( VARTYPE vt )

Definition at line 2175 of file common.cpp.

{
  return GetBitMapName(vt, g_cVariantTypes, g_rgVariantTypes, VT_VECTOR | VT_ARRAY | VT_BYREF | VT_RESERVED/*dwBitStart*/);
}

BOOL GetWindowPos | ( | HWND | hWnd,
 |  | POINTS * | pPTS
 | ) |  |

Definition at line 2860 of file common.cpp.

{
  ASSERT(pPTS);

  RECT rect;
  if(GetWindowRect(hWnd, &rect))
  {
    pPTS->x = (SHORT)rect.left;
    pPTS->y = (SHORT)rect.top;
  }

  return FALSE;
}

SIZE GetWindowSize ( HWND hWnd )

Definition at line 2879 of file common.cpp.

{
  RECT rect = { 0,0,0,0 };
  SIZE size = { 0,0 };

  //Obtain window cordinates.
  if(GetWindowRect(hWnd, &rect))
  {
    //Fillin SIZE struct
    size.cx = rect.right - rect.left;
    size.cy = rect.bottom - rect.top;
  }
  return size;
}

void InternalTrace ( LPCWSTR pwszText )

Definition at line 2732 of file common.cpp.

{
  //NOTE:  We have a fixed argument version and a variable version (...), since
  //we have problems with calls to a variable length version and trying to use the '%'
  //operator as a real character and not as a format specifier...

  if(pwszText)
  {
    if(IsUnicodeOS())
    {
      OutputDebugStringW(pwszText);
    }
    else
    {
      //Output to the DebugWindow
      CHAR szBuffer[MAX_QUERY_LEN];
      ConvertToMBCS(pwszText, szBuffer, MAX_QUERY_LEN);
      OutputDebugStringA(szBuffer);
    }
  }
}

void InternalTraceFmt | ( | LPCWSTR | pwszFmt,
 |  |  | ...
 | ) |  |

Definition at line 2759 of file common.cpp.

{
  va_list   marker;
  WCHAR   wszBuffer[MAX_QUERY_LEN];

  // Use format and arguements as input
  //This version will not overwrite the stack, since it only copies
  //upto the max size of the array
  va_start(marker, pwszFmt);
  _vsnwprintf(wszBuffer, MAX_QUERY_LEN, pwszFmt, marker);
  va_end(marker);

  //Make sure there is a NULL Terminator, vsnwprintf will not copy
  //the terminator if length==MAX_QUERY_LEN
  wszBuffer[MAX_QUERY_LEN-1] = wEOL;

  //Delegate
  InternalTrace(wszBuffer);
}

BOOL IsFixedType ( DBTYPE wType )

Definition at line 1955 of file common.cpp.

{
  return !IsVariableType(wType);
}

BOOL IsNumericType ( DBTYPE wType )

Definition at line 1964 of file common.cpp.

{
  //According to OLE DB Spec Appendix A (Numeric Data Types)
  switch(wType)
  {
    case DBTYPE_I1:
    case DBTYPE_I2:
    case DBTYPE_I4:
    case DBTYPE_I8:
    case DBTYPE_UI1:
    case DBTYPE_UI2:
    case DBTYPE_UI4:
    case DBTYPE_UI8:
    case DBTYPE_R4:
    case DBTYPE_R8:
    case DBTYPE_CY:
    case DBTYPE_DECIMAL:
    case DBTYPE_NUMERIC:
      return TRUE;
  }
  return FALSE;
}

BOOL IsUnicodeOS ( )

Definition at line 40 of file common.cpp.

{
  static BOOL fInitialized = FALSE;
  static BOOL fUnicode = TRUE;

  //NOTE:  Don't call another other helper functions from within this function
  //that might also use the IsUnicodeOS flag, otherwise this will be an infinite loop...

  if(!fInitialized)
  {
    HKEY hkJunk = HKEY_CURRENT_USER;

    // Check to see if we have win95's broken registry, thus we do not have Unicode support
    if((RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE", 0, KEY_READ, &hkJunk) == S_OK) && hkJunk == HKEY_CURRENT_USER)
    {
      // Try the ANSI version
      if((RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, KEY_READ, &hkJunk) == S_OK) && (hkJunk != HKEY_CURRENT_USER))
      {
        fUnicode = FALSE;
      }
    }

    if(hkJunk != HKEY_CURRENT_USER)
      RegCloseKey(hkJunk);
    fInitialized = TRUE;
  }

  return fUnicode;
}

BOOL IsVariableType ( DBTYPE wType )

Definition at line 1936 of file common.cpp.

{
  //According to OLE DB Spec Appendix A (Variable-Length Data Types)
  switch(wType)
  {
    case DBTYPE_STR:
    case DBTYPE_WSTR:
    case DBTYPE_BYTES:
    case DBTYPE_VARNUMERIC:
      return TRUE;
  }
  return FALSE;
}

BOOL MoveWindow | ( | HWND | hWnd,
 |  | ULONG | x,
 |  | ULONG | y
 | ) |  |

Definition at line 2825 of file common.cpp.

{
  RECT  rcParent;                         // Parent window client rect
  RECT  rcDlg;                            // Dialog window rect
  int   nLeft, nTop;                      // Top-left coordinates
  int   cWidth, cHeight;                  // Width and height
  HWND  hWndParent;

  // Get frame window client rect in screen coordinates
  hWndParent = GetParent(hWnd);
  if(hWndParent == NULL || hWndParent == GetDesktopWindow())
  {
    rcParent.top = rcParent.left = 0;
    rcParent.right = GetSystemMetrics(SM_CXFULLSCREEN);
    rcParent.bottom = GetSystemMetrics(SM_CYFULLSCREEN);
  }
  else
    GetWindowRect(hWndParent, &rcParent);

  // Determine the top-left point for the dialog to be centered
  GetWindowRect(hWnd, &rcDlg);
  cWidth  = rcDlg.right  - rcDlg.left;
  cHeight = rcDlg.bottom - rcDlg.top;
  nLeft   = rcParent.left + x;
  nTop    = rcParent.top + y;

  // Place the dialog
  return MoveWindow(hWnd, nLeft, nTop, cWidth, cHeight, TRUE);
}

HRESULT OpenRegKey | ( | HKEY | hRootKey,
 |  | WCHAR * | pwszKeyName,
 |  | DWORD | ulOptions,
 |  | REGSAM | samDesired,
 |  | HKEY * | phKey
 | ) |  |

Definition at line 3542 of file common.cpp.

{
  HRESULT hr = E_FAIL;

  if(IsUnicodeOS())
  {
    //Obtain the Key for HKEY_CLASSES_ROOT\"SubKey"
    hr = RegOpenKeyExW(hRootKey, pwszKeyName, ulOptions, samDesired, phKey);
  }
  else
  {
    CHAR szBuffer[MAX_NAME_LEN];
    ConvertToMBCS(pwszKeyName, szBuffer, MAX_NAME_LEN);

    //Obtain the Key for HKEY_CLASSES_ROOT\"SubKey"
    hr = RegOpenKeyExA(hRootKey, szBuffer, ulOptions, samDesired, phKey);
  }

  if(hr != S_OK)
    return E_FAIL;
  return hr;
}

HRESULT PostProcessString | ( | WCHAR * | pwsz,
 |  | DBLENGTH | ulMaxSize,
 |  | DWORD | dwFlags
 | ) |  |

Definition at line 351 of file common.cpp.

{
  ASSERT(pwsz);
  ASSERT(ulMaxSize);
  WCHAR* pwszStop = NULL;
  LONG lValue = 0;

  //Currently only deals with HEX or DECIMAL
  ASSERT(dwFlags & CONV_HEX || dwFlags & CONV_DECIMAL);

  //Convert String to integer
  if(!ConvertToLONG(pwsz, &lValue, LONG_MIN, LONG_MAX, 0/*0 base indicates WinAPI to interpret*/))
    return E_FAIL;

  //Convert Integer back to requested Format
  if(dwFlags & CONV_HEX)
    StringFormat(pwsz, ulMaxSize, L"0x%x", lValue);
  else
    StringFormat(pwsz, ulMaxSize, L"%d", lValue);

  return S_OK;
}

HRESULT SafeArrayToString | ( | SAFEARRAY * | pSafeArray,
 |  | DBTYPE | wType,
 |  | WCHAR * | pwszBuffer,
 |  | DBLENGTH | ulMaxSize
 | ) |  |

Definition at line 1051 of file common.cpp.

{
  ASSERT(pSafeArray);
  ASSERT(pwszBuffer);

  //No-op
  if(!ulMaxSize)
    return S_OK;

  //This method is capable of handling N-Dimenstions of Data!!
  //We need to take N-Dimensions of Data and convert it to a string

  //For example:  We have a 3D data, where z-dim has 2 elements, y-Dim has 3 ele
  //and x-dim has 2 elements we end up with the following matrix of points

  //  (z, y, x)  => value [[[
  //  (1, 1, 1)  => 1
  //  (1, 1, 2)  => 2
  //  (1, 2, 1)  => 3   ][
  //  (1, 2, 2)  => 4
  //  (1, 3, 1)  => 5   ][
  //  (1, 3, 2)  => 6
  //  (2, 1, 1)  => 7   ]][[
  //  (2, 1, 2)  => 8
  //  (2, 2, 1)  => 9   ][
  //  (2, 2, 2)  => A
  //  (2, 3, 1)  => B   ][
  //  (2, 3, 2)  => C
  //            ]]]

  //So what we need to generate is a string of:
  //  [ [[1,2][3,4][5,6]] [[7,8][9,A][B,C]] ]

  //The algorythm we are using is bascially based upon a "ripple" counter.
  //We keep a counter for each dimension.  So when CounterDim[0] hits the Upper
  //Limit, we increment CounterDim[1] and set CounterDim[0] back to LowerLimit.
  //This continues until all have reached the upper limit together:
  //{CounterDim[n-1]==UpperLimt, ... Dim[0]==UpperLimit}

  //The braces are determined by rising/falling edges of the ripple counter.
  //Everytime a dimension restarts its value from Upper->Lower we see a "][".
  //So we have a pre and a post set of - "[[[" braces "]]]" for the number of dimensions.
  //You'll notices the set of braces in the above example on the rising/falling
  //edges of the ripple counter....

  HRESULT hr = S_OK;

  CVariant cVariant;
  WCHAR* pwsz = pwszBuffer;
  WCHAR* pwszEnd = pwsz + ulMaxSize;

  ULONG i,iDim, ulInnerElements = 0;
  ULONG cDimensions = SafeArrayGetDim(pSafeArray);
  BOOL bDone = FALSE;

  //No-op
  if(!cDimensions)
    return E_FAIL;

  //Make sure there is no Array in the type
  wType &= ~VT_ARRAY;
  pwsz[0] = wEOL;

  LONG* rgIndices = NULL;
  SAFE_ALLOC(rgIndices, LONG, cDimensions);

  //Loop over all dimenstions and fill in "pre" info...
  for(iDim=0; iDim<cDimensions; iDim++)
  {
    //Fill in lower bound
    LONG lLowerBound = 0;
    SafeArrayGetLBound(pSafeArray, iDim+1, &lLowerBound);
    rgIndices[iDim] = lLowerBound;

    //Fill in outer dimension indicater
    *pwsz = L'[';
    pwsz++;
  }

  //Calculate the total number of inner items...
  //This is easy, all dimensions will have the same number "inner" items
  //IE:  rg[y][x] - all y arrays have x elements.
  //IE:  rg[z][y][x] - all z arrays, have y arrays, which have x elements
  ulInnerElements = pSafeArray->rgsabound[0].cElements;
  while(!bDone && (pwsz < pwszEnd))
  {
    //Dimension[0] always goes through a complete cycle every time
    //Just do this part of the ripple counter seperately...
    for(i=0; i<ulInnerElements; i++)
    {
      //Initialize Variant
      cVariant.Init();

      //Obtain the data from the safe array...
      switch(wType)
      {
        case VT_EMPTY:
        case VT_NULL:
        case VT_I2:
        case VT_I4:
        case VT_R4:
        case VT_R8:
        case VT_CY:
        case VT_DATE:
        case VT_BSTR:
        case VT_DISPATCH:
        case VT_ERROR:
        case VT_BOOL:
        case VT_UNKNOWN:
        case VT_I1:
        case VT_UI1:
        case VT_UI2:
        case VT_UI4:
        case VT_I8:
        case VT_UI8:
        case VT_INT:
        case VT_UINT:
          //Otherwise if its a valid variant type, we can place it within
          //our variant as a subtype and delegate to VariantToString to
          //do the converion
          V_VT(&cVariant) = wType;
          TESTC(hr = SafeArrayGetElement(pSafeArray, rgIndices, &V_I4(&cVariant)));
          break;

        case VT_VARIANT:
          //just place directly into our variant.
          TESTC(hr = SafeArrayGetElement(pSafeArray, rgIndices, &cVariant));
          break;

        case VT_DECIMAL:
          //DECIMAL is not part of the VARIANT union
          V_VT(&cVariant)   = wType;
          TESTC(hr = SafeArrayGetElement(pSafeArray, rgIndices, &V_DECIMAL(&cVariant)));
          break;

        default:
          //Unable to handle this type...
          TESTC(hr = E_FAIL);
      }

      rgIndices[0]++;

      //Convert VARIANT To String
      TESTC(hr = VariantToString(&cVariant, pwsz, pwszEnd - pwsz, CONV_NONE));
      pwsz += wcslen(pwsz);

      //Array Seperator
      if(i<ulInnerElements-1 && (pwsz < pwszEnd))
      {
        *pwsz = L',';
        pwsz++;
      }

      //Clear the Variant, (could be outofline memory...)
      XTEST(cVariant.Clear());

      if(!(pwsz < pwszEnd))
        break;
    }

    //Adjust the other Dimensions of the ripple counter
    for(iDim=0; iDim<cDimensions; iDim++)
    {
      LONG lUpperBound = 0;
      SafeArrayGetUBound(pSafeArray, iDim+1, &lUpperBound);

      //Increment this ripple if below max bound, and exit out (break)
      if(rgIndices[iDim] < lUpperBound)
      {
        rgIndices[iDim]++;

        //Need to add opening braces...
        for(ULONG j=iDim; j>0 && (pwsz < pwszEnd); j--)
        {
          *pwsz = L'[';
          pwsz++;
        }
        break;
      }
      //Otherwise reset this one and move onto the
      //next Dimension (ie: Don't break...)
      else if(iDim != cDimensions-1)
      {
        LONG lLowerBound = 0;
        SafeArrayGetLBound(pSafeArray, iDim+1, &lLowerBound);
        rgIndices[iDim] = lLowerBound;

        if(pwsz < pwszEnd)
        {
          *pwsz = L']';
          pwsz++;
        }
      }
      //If we have hit the last Dimension and its over the value
      //This means were done...
      else
      {
        bDone = TRUE;
      }
    }
  }

  //Display Right outer braces
  for(iDim=0; iDim<cDimensions && (pwsz < pwszEnd); iDim++)
  {
    *pwsz = L']';
    pwsz++;
  }

CLEANUP:
  SAFE_FREE(rgIndices);
  return hr;
}

BOOL SetMenuData | ( | HMENU | hMenu,
 |  | UINT | uItem,
 |  | BOOL | fByPosition,
 |  | ULONG_PTR | dwItemData
 | ) |  |

Definition at line 3181 of file common.cpp.

{
  //Setup our Menu Structure...
  //NOTE: HBITMAP was added in IE5, and may not work on older controls...
  MENUITEMINFOA menuinfo = { offsetof(MENUITEMINFOA, cch) + sizeof(UINT), MIIM_DATA, 0, 0, 0, NULL, NULL, NULL, dwItemData, NULL, 0};

#ifndef _WIN64
  //Set this menu's item data
  //NOTE: HBITMAP was added in IE5, and may not work on older controls...
  //So we will first try with the smaller size, since this should be backward compatible...
  if(SetMenuItemInfoA(hMenu, uItem, fByPosition, &menuinfo))
    return TRUE;
#endif //_WIN64

  //Retry Logic
  //On some OS's, (Win64), it only assumes the full NT5 structure size
  //thus for a new OS doesn't have backward compatability issues...
  menuinfo.cbSize = sizeof(MENUITEMINFOA);
  return SetMenuItemInfoA(hMenu, uItem, fByPosition, &menuinfo);
}

HRESULT SetRegEntry | ( | HKEY | hRootKey,
 |  | WCHAR * | pwszKeyName,
 |  | WCHAR * | pwszValueName,
 |  | void * | pStruct,
 |  | ULONG | cBytes,
 |  | DWORD | dwType
 | ) |  |

Definition at line 3859 of file common.cpp.

{
  HRESULT hr = E_FAIL;
  HKEY hKey = NULL;

  //Obtain the Data for the above key
  if(pwszKeyName)
  {
    if(FAILED(hr = CreateRegKey(hRootKey, pwszKeyName, &hKey)))
      goto CLEANUP;
  }

  if(IsUnicodeOS())
  {
    //Set the data for the above key (or the root key...)
    hr = RegSetValueExW(hKey ? hKey : hRootKey, pwszValueName, 0, dwType, (BYTE*)pStruct, cBytes);
  }
  else
  {
    //Set the data for the above key (or the root key...)
    CHAR szBuffer[MAX_NAME_LEN];
    ConvertToMBCS(pwszValueName, szBuffer, MAX_NAME_LEN);
    hr = RegSetValueExA(hKey ? hKey : hRootKey, szBuffer, 0, dwType, (BYTE*)pStruct, cBytes);
  }

  if(hr != S_OK)
    hr = E_FAIL;

CLEANUP:
  CloseRegKey(hKey);
  return hr;
}

HRESULT SetRegEntry | ( | HKEY | hRootKey,
 |  | WCHAR * | pwszKeyName,
 |  | WCHAR * | pwszValueName,
 |  | WCHAR * | pwszValue
 | ) |  |

Definition at line 3830 of file common.cpp.

{
  if(IsUnicodeOS())
  {
    return SetRegEntry(hRootKey, pwszKeyName, pwszValueName, pwszValue ? pwszValue : L"", pwszValue ? (wcslen(pwszValue)+1)*sizeof(WCHAR) : sizeof(WCHAR), REG_SZ);
  }
  else
  {
    CHAR szBuffer[MAX_NAME_LEN];
    ConvertToMBCS(pwszValue, szBuffer, MAX_NAME_LEN);
    return SetRegEntry(hRootKey, pwszKeyName, pwszValueName, pwszValue ? szBuffer : "", pwszValue ? (strlen(szBuffer)+1)*sizeof(CHAR) : sizeof(CHAR), REG_SZ);
  }
}

HRESULT SetRegEntry | ( | HKEY | hRootKey,
 |  | WCHAR * | pwszKeyName,
 |  | WCHAR * | pwszValueName,
 |  | ULONG | ulValue
 | ) |  |

Definition at line 3849 of file common.cpp.

{
  return SetRegEntry(hRootKey, pwszKeyName, pwszValueName, &ulValue, sizeof(ULONG), REG_DWORD);
}

BOOL SetSubMenuData | ( | HMENU | hMenu,
 |  | UINT | uItem,
 |  | BOOL | fByPosition,
 |  | ULONG_PTR | dwItemData
 | ) |  |

Definition at line 3207 of file common.cpp.

{
  //NOTE: Having every menu item in all objects menu have unique ids, makes adding the same interface
  //to another object very painful, and causes manually editing the menu resources, making sure its
  //added to OnUpdateCommand for enabling/disabling the menu item, as well as adding another
  //case in OnCommand for the same interface!

  //Instead we have devised a design where we can intitally set the item data of every menu
  //to contain the object identifier.  This way we can always obtain the stored data of the menu
  //and instantly know the type of object this interface/method is called from.  Saves hundreads
  //of lines of code, and almost ellimiates all places to remember to add code to...

  //First set this menu's item data
  if(SetMenuData(hMenu, 0, TRUE/*fByPosition*/, dwItemData))
  {
    //Now that we have successfully set the data, we should loop through any child
    //menus and also set that data, since there is no current way to traverse backward in a menu...
    INT iItems = GetMenuItemCount(hMenu);
    for(INT i=0; i<iItems; i++)
    {
      ULONG ulMenuID = GetMenuItemID(hMenu, i);
      if(ulMenuID == ULONG_MAX)
      {
        //Recursive Alogorytm
        HMENU hSubMenu = GetSubMenu(hMenu, i);
        if(hSubMenu)
          SetSubMenuData(hSubMenu, 0, TRUE/*fByPosition*/, dwItemData);
      }
    }

    return TRUE;
  }

  return FALSE;
}

void* SetThis | ( | HWND | hWnd,
 |  | void * | pThis
 | ) |  |

Definition at line 2618 of file common.cpp.

{
  ASSERT(hWnd);
  void* pPrev = (void*)SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)pThis);

  //NOTE: We need to help prevent the case of overwriting the "this" pointer
  //in a nested senario.  If you hit this assert a subwindow has subclassed the window
  //as well.  By replacing the this pointer, the previous window will lose the correct
  //class assoicted with it.
  ASSERT(!pPrev || !pThis || pPrev == pThis);

  //Return the current value...
  return pThis;
}

WCHAR* StackFormat | ( | LPCWSTR | pwszFmt,
 |  |  | ...
 | ) |  |

Definition at line 91 of file common.cpp.

{
  va_list   marker;

  ASSERT(pwszFmt);
  static WCHAR wszBuffer[MAX_QUERY_LEN];
  wszBuffer[0] = wEOL;

  // Use format and arguements as input
  //This version will not overwrite the stack, since it only copies
  //upto the max size of the array
  va_start(marker, pwszFmt);
  _vsnwprintf(wszBuffer, NUMELE(wszBuffer), pwszFmt, marker);
  va_end(marker);

  //Make sure there is a NULL Terminator, vsnwprintf will not copy
  //the terminator if length==MAX_QUERY_LEN
  wszBuffer[NUMELE(wszBuffer)-1] = wEOL;
  return wszBuffer;
}

CHAR* strDuplicate ( LPCSTR psz )

Definition at line 1671 of file common.cpp.

{
  HRESULT hr = S_OK;

  //no-op case
  if(!psz)
    return NULL;

  ULONG cLen  = strlen(psz);

  //Allocate space for the string
  CHAR* pszBuffer = NULL;
  SAFE_ALLOC(pszBuffer, CHAR, cLen+1);

  //Now copy the string
  strcpy(pszBuffer, psz);

CLEANUP:
  return pszBuffer;
}

BOOL StringCompare | ( | LPCWSTR | pwsz1,
 |  | LPCWSTR | pwsz2
 | ) |  |

Definition at line 142 of file common.cpp.

{
  //Safe guard against NULL...
  if(pwsz1 && pwsz2)
    return wcscmp(pwsz1, pwsz2)==0;

  return pwsz1 == pwsz2;
}

BOOL StringCompareI | ( | LPCWSTR | pwsz1,
 |  | LPCWSTR | pwsz2
 | ) |  |

Definition at line 156 of file common.cpp.

{
  //Safe guard against NULL...
  if(pwsz1 && pwsz2)
    return _wcsicmp(pwsz1, pwsz2)==0;

  return pwsz1 == pwsz2;
}

CHAR* StringCopy | ( | CHAR * | pszDest,
 |  | LPCSTR | pszSource,
 |  | DBLENGTH | cMaxLen
 | ) |  |

Definition at line 169 of file common.cpp.

{
  //Safe guard against overflow...
  CHAR* pszReturn = strncpy(pszDest, pszSource, (size_t)cMaxLen);
  if(cMaxLen)
  {
    pszDest[cMaxLen-1] = EOL;
  }

  return pszReturn;
}

WCHAR* StringCopy | ( | WCHAR * | pwszDest,
 |  | LPCWSTR | pwszSource,
 |  | DBLENGTH | cMaxLen
 | ) |  |

Definition at line 75 of file common.cpp.

{
  //Safe guard against overflow...
  WCHAR* pwszReturn = wcsncpy(pwszDest, pwszSource, (size_t)cMaxLen);
  if(cMaxLen)
  {
    pwszDest[cMaxLen-1] = wEOL;
  }

  return pwszReturn;
}

WCHAR* StringFormat | ( | WCHAR * | pwszDest,
 |  | DBLENGTH | ulStrLen,
 |  | LPCWSTR | pwszFmt,
 |  |  | ...
 | ) |  |

Definition at line 116 of file common.cpp.

{
  ASSERT(pwszDest);
  ASSERT(ulStrLen);
  ASSERT(pwszFmt);

  va_list   marker;

  // Use format and arguements as input
  //This version will not overwrite the stack, since it only copies
  //upto the max size of the array
  va_start(marker, pwszFmt);
  _vsnwprintf(pwszDest, ulStrLen, pwszFmt, marker);
  va_end(marker);

  //Make sure there is a NULL Terminator, vsnwprintf will not copy
  //the terminator if length==MAX_QUERY_LEN
  pwszDest[ulStrLen-1] = wEOL;
  return pwszDest;
}

HRESULT StringToSafeArray | ( | WCHAR * | pwszBuffer,
 |  | DBTYPE | wType,
 |  | SAFEARRAY ** | ppSafeArray
 | ) |  |

Definition at line 1270 of file common.cpp.

{
  ASSERT(ppSafeArray);
  if(!pwszBuffer)
    return E_INVALIDARG;

  //We already know we need to create an array
  wType &= ~VT_ARRAY;

  //This method is capable of handling N-Dimenstions of Data!!
  //We need to a String of N Dimensions and turn it into a SafeArray

  //For example:  We have a 3D data, where z-dim has 2 elements, y-Dim has 3 ele
  //and x-dim has 2 elements we end up with the following matrix of points

  //  (z, y, x)  => value [[[
  //  (1, 1, 1)  => 1
  //  (1, 1, 2)  => 2
  //  (1, 2, 1)  => 3   ][
  //  (1, 2, 2)  => 4
  //  (1, 3, 1)  => 5   ][
  //  (1, 3, 2)  => 6
  //  (2, 1, 1)  => 7   ]][[
  //  (2, 1, 2)  => 8
  //  (2, 2, 1)  => 9   ][
  //  (2, 2, 2)  => A
  //  (2, 3, 1)  => B   ][
  //  (2, 3, 2)  => C
  //            ]]]

  //So we could be passed a string of:
  //  [ [[1,2][3,4][5,6]] [[7,8][9,A][B,C]] ]

  //The algorythm we are using is bascially based upon a "ripple" counter.
  //We keep a counter for each dimension.  So when CounterDim[0] hits the Upper
  //Limit, we increment CounterDim[1] and set CounterDim[0] back to LowerLimit.
  //This continues until all have reached the upper limit together:
  //{CounterDim[n-1]==UpperLimt, ... Dim[0]==UpperLimit}

  //The braces are determined by rising/falling edges of the ripple counter.
  //Everytime a dimension restarts its value from Upper->Lower we see a "][".
  //So we have a pre and a post set of - "[[[" braces "]]]" for the number of dimensions.
  //You'll notices the set of braces in the above example on the rising/falling
  //edges of the ripple counter....

  HRESULT hr = S_OK;
  CVariant cVariant;

  WCHAR wszBuffer[MAX_COL_SIZE];
  wszBuffer[0] = wEOL;
  WCHAR* pwsz = pwszBuffer;

  ULONG i,iDim, ulInnerElements = 0;

  //Determine the Number of Dimensions...
  ULONG cDimensions = 0;
  while(pwsz[0]==L'[')
  {
    cDimensions++;
    pwsz++;
    wcscat(wszBuffer, L"]");
  }

  //Find the End of the Data (where everever "]...") is...
  WCHAR* pwszNext = pwsz;
  WCHAR* pwszEnd = pwsz;
  WCHAR* pwszCurEnd = wcschr(pwsz, L']');

  //No-op
  if(cDimensions < 1)
    return E_FAIL;

  //Create SafeArray
  SAFEARRAY* pSafeArray = NULL;
  *ppSafeArray = NULL;

  LONG* rgIndices = NULL;
  SAFEARRAYBOUND* rgSafeArrayBounds = NULL;

  //Indices array...
  SAFE_ALLOC(rgIndices, LONG, cDimensions);
  memset(rgIndices, 0, cDimensions * sizeof(LONG));

  //SafeArrayBounds array...
  SAFE_ALLOC(rgSafeArrayBounds, SAFEARRAYBOUND, cDimensions);
  memset(rgSafeArrayBounds, 0, cDimensions*sizeof(SAFEARRAYBOUND));

  //Need to find out how many elements are in Dim[0]
  //NOTE: <= 'Allow empty string safearrays'
  while(pwszNext && pwszNext <= pwszCurEnd)
  {
    ulInnerElements++;
    rgIndices[0]++;
    pwszNext = wcschr(pwszNext, L',');
    if(pwszNext)
      pwszNext++;
  }

  //Now from the [] notation find out how many elements in the other dimenstions
  //  [ [[1,2][3,4][5,6]] [[7,8][9,A][B,C]] ]

  //The algorythm we will use is:
  //Everytime we see a "]" we need to increment the next Dimension elements
  //Everytime we see a "[" we need to reset the previous Dimension elements

  //TODO
  //Currently this algorythm only handles 1 dimension.
  //No reason it couldn't use the above method and work for more, just on
  //a time constraint, and the only provider we have supports max 1 dim...

  ASSERT(cDimensions == 1);

  //Create the SafeArrayBounds
  for(iDim=0; iDim<cDimensions; iDim++)
  {
    rgSafeArrayBounds[iDim].lLbound = 0;
    rgSafeArrayBounds[iDim].cElements = rgIndices[0];
  }

  //Now actually create the SafeArray
  pSafeArray = SafeArrayCreate(wType, cDimensions, rgSafeArrayBounds);
  ASSERT(pSafeArray);

  pwszCurEnd = wcschr(pwsz, L']');
  rgIndices[0] = 0;
  pwszNext = pwsz;
  for(i=0; i<ulInnerElements; i++)
  {
    //Obtain the start and end of the value
    pwszEnd = wcschr(pwszNext, L',');
    if(pwszEnd==NULL || pwszEnd>pwszCurEnd)
      pwszEnd = pwszCurEnd;

    //Setup rgIndicaes
    rgIndices[0] = i;

    //Convert Value to a Variant
    void* pValue = NULL;
    StringCopy(wszBuffer, pwszNext, pwszEnd-pwszNext+1);
    TESTC(hr = StringToVariant(wszBuffer, wType, &cVariant, CONV_NONE));

    //Add this Value to the SafeArray
    //NOTE: According to the spec for SafeArrayPutElement
    //VT_DISPATCH, VT_UNKNOWN, and VT_BSTR are pointers, and do not require another level of indirection.
    switch(wType)
    {
      case VT_DISPATCH:
      case VT_UNKNOWN:
      case VT_BSTR:
        pValue = V_UNKNOWN(&cVariant);
        break;

      case VT_VARIANT:
        pValue = &cVariant;
        break;

      case VT_DECIMAL:
        //DECIMAL is not part of the VARIANT union
        pValue = &V_DECIMAL(&cVariant);
        break;

      default:
        pValue = &V_I4(&cVariant);
        break;
    };

    //Add this Value to the SafeArray
    TESTC(hr = SafeArrayPutElement(pSafeArray, rgIndices, pValue));
    XTEST(cVariant.Clear());

    //Incement to next value...
    pwszNext = wcschr(pwszNext, L',');
    if(pwszNext)
      pwszNext += 1;
  }

  //Everything complete successfully...
  *ppSafeArray = pSafeArray;

CLEANUP:
  SAFE_FREE(rgIndices);
  SAFE_FREE(rgSafeArrayBounds);
  return hr;
}

HRESULT StringToVariant | ( | WCHAR * | pwsz,
 |  | VARTYPE | vt,
 |  | VARIANT * | pVariant,
 |  | DWORD | dwFlags
 | ) |  |

Definition at line 928 of file common.cpp.

{
  //Convert a VARIANT to a WCHAR
  ASSERT(pVariant);
  HRESULT hr = S_OK;

  //Assign the type...
  V_VT(pVariant) = vt;

  //VT_ARRAY is not handled by VariantChangeType
  if(vt & VT_ARRAY)
  {
    SAFEARRAY* pSafeArray = NULL;
    TESTC(hr = StringToSafeArray(pwsz, vt, &pSafeArray));
    V_ARRAY(pVariant) = pSafeArray;
    goto CLEANUP;
  }

  //VariantChangeType seems to handle most types,
  //except the following cases...
  switch(vt)
  {
    case VT_NULL:
    case VT_EMPTY:
      break;

    case VT_BOOL:
    {
      //This type requires a string
      if(!pwsz)
        TESTC(hr = E_INVALIDARG);

      if(dwFlags & CONV_VARBOOL && StringCompareI(pwsz, L"VARIANT_TRUE"))
        V_BOOL(pVariant) = VARIANT_TRUE;
      else if(dwFlags & CONV_VARBOOL && StringCompareI(pwsz, L"VARIANT_FALSE"))
        V_BOOL(pVariant) = VARIANT_FALSE;
      else if(dwFlags & CONV_ALPHABOOL && StringCompareI(pwsz, L"True"))
        V_BOOL(pVariant) = VARIANT_TRUE;
      else if(dwFlags & CONV_ALPHABOOL && StringCompareI(pwsz, L"False"))
        V_BOOL(pVariant) = VARIANT_FALSE;
      else
      {
        LONG lValue = 0;
        if(!ConvertToLONG(pwsz, &lValue, SHRT_MIN, SHRT_MAX, 0/*Base*/))
        {
          hr = E_FAIL;
          goto CLEANUP;
        }
        V_BOOL(pVariant) = (VARIANT_BOOL)lValue;
      }
      break;
    }

    case VT_I4:
    case VT_ERROR:
    case VT_UI4:
    {
      //This type requires a string
      if(!pwsz)
        TESTC(hr = E_INVALIDARG);

      //We handle this case seperatly since we want to handle HEX values
      WCHAR* pwszStop = NULL;
      BOOL fSigned = (vt != VT_UI4);
      errno = 0;

      //Convert
      ULONG ulValue = vt==VT_UI4 ? wcstoul(pwsz, &pwszStop, 0) : wcstol(pwsz, &pwszStop, 0);

      //Function stopped converting prematurely...
      if(pwszStop==NULL || pwszStop[0]!=wEOL || errno==ERANGE)
        TESTC(hr = E_FAIL);

      V_UI4(pVariant) = ulValue;
      break;
    }

    case VT_I8:
    {
      //This type requires a string
      if(!pwsz)
        TESTC(hr = E_INVALIDARG);

      //TODO64: OLEAUT doesn't have support for this type yet, so we have to special case...
      LONGLONG llValue = _wtoi64(pwsz);
//      V_I8(pVariant) = ulValue;
      pVariant->ullVal = llValue;
      break;
    }

    case VT_VARIANT:
    {
      //Place the string into the BSTR of the VARIANT
      V_VT(pVariant) = VT_BSTR;
      V_BSTR(pVariant) = SysAllocString(pwsz);
      break;
    }

    default:
    {
      //Place the string into the BSTR of the VARIANT
      V_VT(pVariant) = VT_BSTR;
      V_BSTR(pVariant) = SysAllocString(pwsz);

      //Now delegate to VariantChangeType...
      TESTC(hr = VariantChangeFast(
        pVariant, // Destination (convert in place)
        pVariant, // Source
        ULONG_MAX,  // LCID
        0,      // dwFlags
        vt ));
    }
  };

CLEANUP:
  return hr;
}

HRESULT StringToVector | ( | WCHAR * | pwszBuffer,
 |  | DBTYPE | wType,
 |  | DBVECTOR * | pVector
 | ) |  |

Definition at line 1565 of file common.cpp.

{
  ASSERT(pVector);
  if(!pwszBuffer)
    return E_INVALIDARG;

  //Make sure we are dealing with the base type...
  wType &= ~DBTYPE_VECTOR;

  HRESULT hr = S_OK;
  VARIANT Variant;
  VariantInitFast(&Variant);

  WCHAR wszBuffer[MAX_COL_SIZE] = {0};
  ULONG iEle = 0;

  //Determine the Number of Elements...
  pVector->size = 1;
  WCHAR* pwsz = pwszBuffer;
  while(pwsz = wcschr(pwsz, L','))
  {
    pVector->size++;
    pwsz++;
  }

  //Obtain the size of each element
  DBLENGTH ulTypeSize = 0;
  if(FAILED(GetDBTypeMaxSize(wType, &ulTypeSize)))
    return hr;

  //Alloc the vector...
  SAFE_ALLOC(pVector->ptr, BYTE, ulTypeSize*pVector->size);

  pwsz = pwszBuffer;
  for(iEle=0; iEle<pVector->size; iEle++)
  {
    //Obtain the start and end of the value
    WCHAR* pwszEnd = wcschr(pwsz, L',');
    void* pElement = (BYTE*)pVector->ptr + (ulTypeSize*iEle);

    //Convert Value to a Variant
    StringCopy(wszBuffer, pwsz, pwszEnd ? pwszEnd-pwsz+1 : MAX_COL_SIZE);
    TESTC(hr = StringToVariant(wszBuffer, wType, &Variant, CONV_NONE));

    //Add this to the vector...
    switch(wType)
    {
      case VT_EMPTY:
      case VT_NULL:
        break;

      case VT_I2:
        *(SHORT*)pElement = V_I2(&Variant);
        break;

      case VT_I4:
      case VT_R4:
      case VT_R8:
      case VT_CY:
      case VT_DATE:
      case VT_BSTR:
      case VT_DISPATCH:
      case VT_ERROR:
      case VT_BOOL:
      case VT_UNKNOWN:
      case VT_I1:
      case VT_UI1:
      case VT_UI2:
      case VT_UI4:
      case VT_I8:
      case VT_UI8:
      case VT_INT:
      case VT_UINT:
        memcpy(pElement, &V_I4(&Variant), (size_t)ulTypeSize);
        break;

      case VT_VARIANT:
        //just place directly into our variant.
        *(VARIANT*)pElement = Variant;
        break;

      case VT_DECIMAL:
        *(DECIMAL*)pElement = V_DECIMAL(&Variant);
        break;

      default:
        //Unable to handle this type...
        TESTC(hr = E_NOTIMPL);
    };

    //Incement to next value...
    pwsz = wcschr(pwsz, L',');
    if(pwsz)
      pwsz += 1;
  }

CLEANUP:
  return hr;
}

INT_PTR WINAPI SynchSubProc | ( | HWND | hWnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 2685 of file common.cpp.

{
  SYNCHINFO* pSynchInfo = (SYNCHINFO*)GetThis(hWnd);
  static BOOL fInsideSend = FALSE;

  switch(message)
  {
    case WM_INITDIALOG:
    {
      //SubClass
      pSynchInfo = new SYNCHINFO;
      pSynchInfo->wpProc    = (WNDPROC)GetWindowLongPtr(hWnd, GWLP_WNDPROC);
      pSynchInfo->hWndSynch = (HWND)lParam;

      SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)SynchSubProc);
      SetThis(hWnd, (void*)pSynchInfo);
      return 0;
    }

    case WM_DESTROY:
      SetThis(hWnd, NULL);
      SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)pSynchInfo->wpProc);
      SAFE_DELETE(pSynchInfo);
      break;

    case WM_VSCROLL:
      if(!fInsideSend)
      {
        //Send a synch message to the other control
        fInsideSend = TRUE;
        SendMessage(pSynchInfo->hWndSynch, message, wParam, lParam);
        fInsideSend = FALSE;
      }
      break;
  }

  if(pSynchInfo && pSynchInfo->wpProc)
    return CallWindowProc(pSynchInfo->wpProc, hWnd, message, wParam, lParam);
  return TRUE;
}

void SyncSibling | ( | HWND | hToWnd,
 |  | HWND | hFromWnd
 | ) |  |

Definition at line 2645 of file common.cpp.

{
  ASSERT(hToWnd && hFromWnd);

  //Make both windows synched,
  //Get the current selection from the Source
  INDEX iItem = (INDEX)SendMessage(hFromWnd, LVM_GETNEXTITEM, (WPARAM)-1, (LPARAM)LVNI_SELECTED);

  //Tell the Target to select the same selection
  if(iItem != LVM_ERR)
  {
    //Get the current selection from the Target and Unselect it
    INDEX iOldItem = (INDEX)SendMessage(hToWnd, LVM_GETNEXTITEM, (WPARAM)-1, (LPARAM)LVNI_SELECTED);
    if(iItem != iOldItem)
    {
      //Unselect previous one
      LV_SetItemState(hToWnd, iOldItem, 0, 0, LVIS_SELECTED);

      //Select the new one
      LV_SetItemState(hToWnd, iItem, 0, LVIS_SELECTED, LVNI_SELECTED);

      //Ensure that it is visible
      SendMessage(hToWnd, LVM_ENSUREVISIBLE, (WPARAM)iItem, (LPARAM)FALSE);
    }
  }
}

HRESULT VariantChangeFast | ( | VARIANT * | pVarDest,
 |  | VARIANT * | pVarSrc,
 |  | LCID | lcid,
 |  | USHORT | wFlags,
 |  | VARTYPE | vt
 | ) |  |

Definition at line 817 of file common.cpp.

{
  HRESULT hr = S_OK;
  static LCID lcidDef = GetSystemDefaultLCID();

  //Delegate...
  TESTC(hr = VariantChangeTypeEx(
    pVarDest, // Destination (convert in place)
    pVarSrc,  // Source
    lcid != ULONG_MAX ? lcid : lcidDef,   // LCID
    wFlags,   // dwFlags
    vt ));

CLEANUP:
  return hr;
}

HRESULT VariantClearFast ( VARIANT * pVariant )

Definition at line 746 of file common.cpp.

{
  ASSERT(pVariant);
  HRESULT hr = S_OK;

  switch(V_VT(pVariant))
  {
    case VT_EMPTY:
      break;

    case VT_NULL:
    case VT_I8:
      V_VT(pVariant) = VT_EMPTY;
      break;

    default:
      //Nice to know if this fails, display error
      XTESTC(hr = VariantClear(pVariant));
      break;
  }

CLEANUP:
  return hr;
}

HRESULT VariantCopyFast | ( | VARIANT * | pVarDest,
 |  | VARIANT * | pVarSrc
 | ) |  |

Definition at line 777 of file common.cpp.

{
  ASSERT(pVarDest);
  ASSERT(pVarSrc);
  HRESULT hr = S_OK;

  //First Free the Destination.
  //NOTE: This is the same symmantics as VariantCopy.  We do this always since
  //we know how to clear other types as well...
  TESTC(hr = VariantClearFast(pVarDest));

  //Now do the copy...
  switch(V_VT(pVarSrc))
  {
    case VT_EMPTY:
    case VT_NULL:
      V_VT(pVarDest) = V_VT(pVarSrc);
      break;

    case VT_I8:
      V_VT(pVarDest) = V_VT(pVarSrc);
      pVarDest->ullVal = pVarSrc->ullVal;
      break;

    default:
      //Nice to know if this fails, display error
      XTESTC(hr = VariantCopy(pVarDest, pVarSrc));
      break;
  };

CLEANUP:
  return hr;
}

HRESULT VariantInitFast ( VARIANT * pVariant )

Definition at line 733 of file common.cpp.

{
  ASSERT(pVariant);
  V_VT(pVariant) = VT_EMPTY;

  return S_OK;
}

HRESULT VariantToString | ( | VARIANT * | pVariant,
 |  | WCHAR * | pwsz,
 |  | DBLENGTH | ulMaxSize,
 |  | DWORD | dwFlags
 | ) |  |

Definition at line 841 of file common.cpp.

{
  //No-op
  if(!ulMaxSize)
    return S_OK;

  //Convert a VARIANT to a WCHAR
  ASSERT(pVariant);
  ASSERT(pwsz);
  pwsz[0] = EOL;

  //Find the VariantType
  DBTYPE wType = V_VT(pVariant);
  CVariant cVariant;
  HRESULT hr = S_OK;

  //VT_ARRAY is not handled by VariantChangeType
  if(wType & VT_ARRAY)
  {
    TESTC(hr = SafeArrayToString(V_ARRAY(pVariant), wType, pwsz, ulMaxSize));
    goto CLEANUP;
  }

  switch(wType)
  {
    case VT_NULL:
    case VT_EMPTY:
      //pwsz is already set to null terminator above
      break;

    case VT_BOOL:
      if(V_BOOL(pVariant) == VARIANT_TRUE)
        StringFormat(pwsz, ulMaxSize, L"%s", dwFlags & CONV_VARBOOL ? L"VARIANT_TRUE" : L"True");
      else if(V_BOOL(pVariant) == VARIANT_FALSE)
        StringFormat(pwsz, ulMaxSize, L"%s", dwFlags & CONV_VARBOOL ? L"VARIANT_FALSE" : L"False");
      else
        StringFormat(pwsz, ulMaxSize, L"%d", V_BOOL(pVariant));
      break;

    case VT_ERROR:
      StringFormat(pwsz, ulMaxSize, L"%d", V_ERROR(pVariant));
      break;

    case VT_I8:
    {
      //TODO64: OLEAUT doesn't have support for this type yet, so we have to special case...
//      StringFormat(pwsz, ulMaxSize, L"%ld", V_I8(pVariant));
      StringFormat(pwsz, ulMaxSize, L"%ld", pVariant->ullVal);
      break;
    }

    default:
    {
      TESTC(hr = VariantChangeFast(
        &cVariant,  // Destination (convert not in place)
        pVariant, // Source
        ULONG_MAX,  // LCID
        0,      // dwFlags
        VT_BSTR ));

      StringCopy(pwsz, V_BSTR(&cVariant), ulMaxSize);

      //May need Hex postprocessing
      if(dwFlags & CONV_HEX)
      {
        switch(V_VT(pVariant))
        {
          case DBTYPE_I4:
            //"0x" + 10 characters
            if(ulMaxSize >= 12)
              StringFormat(pwsz, ulMaxSize, L"0x%x", V_I4(pVariant));
            break;
        }
      }
    }
  };

CLEANUP:
  pwsz[ulMaxSize ? ulMaxSize-1 : 0] = wEOL;
  return hr;
}

HRESULT VectorToString | ( | DBVECTOR * | pVector,
 |  | DBTYPE | wType,
 |  | WCHAR * | pwszBuffer,
 |  | DBLENGTH | ulMaxSize
 | ) |  |

Definition at line 1460 of file common.cpp.

{
  ASSERT(pVector);
  ASSERT(pwszBuffer);
  HRESULT hr = S_OK;

  //No-op
  if(!ulMaxSize)
    return S_OK;

  VARIANT Variant;
  VARIANT* pVariant = NULL;
  WCHAR* pwsz = pwszBuffer;
  WCHAR* pwszEnd = pwsz + ulMaxSize;
  pwsz[0] = wEOL;

  //Make sure we are dealing with the base type...
  wType &= ~DBTYPE_VECTOR;

  //Loop over the vector...
  for(ULONG iEle=0; iEle<pVector->size; iEle++)
  {
    //Initialize Variant
    pVariant = &Variant;
    pVariant->vt = VT_EMPTY;

    //NOTE: The pVariant is really just a pointer to the data.  We don't free the data
    //since the vector data doesn't belong to us, we are just convering the given data to
    //a string.  The simplest way to do this is to dump into a variant and let our helper
    //function VariantToString deal with this...

    //Obtain the data from the vector...
    switch(wType)
    {
      case VT_EMPTY:
      case VT_NULL:
        V_VT(pVariant) = wType;
        break;

      case VT_I2:
      case VT_I4:
      case VT_R4:
      case VT_R8:
      case VT_CY:
      case VT_DATE:
      case VT_BSTR:
      case VT_DISPATCH:
      case VT_ERROR:
      case VT_BOOL:
      case VT_UNKNOWN:
      case VT_I1:
      case VT_UI1:
      case VT_UI2:
      case VT_UI4:
      case VT_I8:
      case VT_UI8:
      case VT_INT:
      case VT_UINT:
      {
        DBLENGTH ulTypeSize = 0;
        if(SUCCEEDED(GetDBTypeMaxSize(wType, &ulTypeSize)))
        {
          V_VT(pVariant) = wType;
          memcpy(&V_I4(pVariant), (BYTE*)pVector->ptr + (ulTypeSize*iEle), (size_t)ulTypeSize);
        }
        break;
      }

      case VT_VARIANT:
        //just place directly into our variant.
        pVariant = (VARIANT*)((BYTE*)pVector->ptr + (sizeof(VARIANT)*iEle));
        break;

      case VT_DECIMAL:
        //DECIMAL is not part of the VARIANT union
        V_VT(pVariant)    = wType;
        V_DECIMAL(pVariant) = *(DECIMAL*)((BYTE*)pVector->ptr + (sizeof(DECIMAL)*iEle));
        break;

      default:
        //Unable to handle this type...
        TESTC(hr = E_FAIL);
    }

    //Convert VARIANT To String
    TESTC(hr = VariantToString(pVariant, pwsz, pwszEnd - pwsz, CONV_NONE));
    pwsz += wcslen(pwsz);

    //Vector Seperator
    if(iEle<pVector->size-1 && (pwsz < pwszEnd))
    {
      *pwsz = L',';
      pwsz++;
    }
  }

CLEANUP:
  return hr;
}

WCHAR* wcsDuplicate ( LPCWSTR pwsz )

Definition at line 1698 of file common.cpp.

{
  HRESULT hr = S_OK;

  //no-op case
  if(!pwsz)
    return NULL;

  ULONG cLen  = wcslen(pwsz);

  //Allocate space for the string
  WCHAR* pwszBuffer = NULL;
  SAFE_ALLOC(pwszBuffer, WCHAR, cLen+1);

  //Now copy the string
  StringCopy(pwszBuffer, pwsz, cLen+1);

CLEANUP:
  return pwszBuffer;
}

WCHAR* wGetWindowText ( HWND hWnd )

Definition at line 3098 of file common.cpp.

{
  //Dynamic Memory Version of the the WinAPI GetWindowText
  WCHAR* pwsz = NULL;
  HRESULT hr = S_OK;

  //First obtain the length of the string
  LRESULT iLength = SendMessage(hWnd, WM_GETTEXTLENGTH, 0, 0);
  if(iLength>0)
  {
    LRESULT iActLength = 0;

    //Allocate our string
    SAFE_ALLOC(pwsz, WCHAR, iLength+1);

    //Now get the text from the window...
    iActLength = wSendMessage(hWnd, WM_GETTEXT, iLength+1, pwsz);

    //Ensure NULL terminated...
    pwsz[iActLength>0 ? min(iActLength, iLength) : 0] = wEOL;
  }

CLEANUP:
  return pwsz;
}

INT wMessageBox | ( | HWND | hwnd,
 |  | UINT | uiStyle,
 |  | WCHAR * | pwszTitle,
 |  | WCHAR * | pwszFmt,
 |  |  | ...
 | ) |  |

Definition at line 2942 of file common.cpp.

{
  va_list   marker;
  WCHAR   wszBuffer[MAX_QUERY_LEN];

  // Use format and arguements as input
  //This version will not overwrite the stack, since it only copies
  //upto the max size of the array
  va_start(marker, pwszFmt);
  _vsnwprintf(wszBuffer, MAX_QUERY_LEN, pwszFmt, marker);
  va_end(marker);

  //Make sure there is a NULL Terminator, vsnwprintf will not copy
  //the terminator if length==MAX_QUERY_LEN
  wszBuffer[MAX_QUERY_LEN-1] = wEOL;

  //Unicode version is supported on both Win95/WinNT
  return MessageBoxW(hwnd, wszBuffer, pwszTitle, uiStyle);
}

LRESULT wSendMessage | ( | HWND | hWnd,
 |  | UINT | Msg,
 |  | WPARAM | wParam,
 |  | WCHAR * | pwszText
 | ) |  |

Definition at line 2973 of file common.cpp.

{
  LRESULT lResult = 0;
  HRESULT hr = S_OK;

  if(IsUnicodeOS())
  {
    //WinNT - Unicode, no need for conversions...
    lResult = SendMessageW(hWnd, Msg, (WPARAM)wParam, (LPARAM)pwszText);
  }
  else
  {
    //Win95 - Unicode not supported...
    CHAR szBuffer[MAX_QUERY_LEN] = { 0, 0, 0, 0 };
    ULONG ulDestSize = MAX_QUERY_LEN;
    CHAR* psz = szBuffer;

    //All messages that have [input] strings
    switch(Msg)
    {
      case EM_GETLINE:
        ((WORD*)psz)[0] = MAX_QUERY_LEN;
        break;

      case WM_GETTEXT:
        //We may need to dynamically allocate this...
        if(wParam > MAX_QUERY_LEN)
          SAFE_ALLOC(psz, CHAR, wParam);
        break;

      case EM_GETSELTEXT:
        ASSERT(wParam && "wSendMessage EM_GETSELTEXT requires a length so the conversion buffer so it doesn't overflow...");
        ulDestSize = (ULONG)wParam;

        //We may need to dynamically allocate this...
        if(wParam > MAX_QUERY_LEN)
          SAFE_ALLOC(psz, CHAR, wParam);
        wParam = 0;
        break;

      case SB_SETTEXTW:
        Msg = SB_SETTEXT;

      case WM_SETTEXT:
      case EM_REPLACESEL:
      case CB_FINDSTRINGEXACT:
      case CB_FINDSTRING:
      case CB_ADDSTRING:
      case LB_ADDSTRING:
      case SB_SETTEXTA:
        //Convert to ANSI before sending
        //We may need to dynamically allocate this...
        if(!ConvertToMBCS(pwszText, psz, MAX_QUERY_LEN))
          psz = ConvertToMBCS(pwszText);
        break;
    };

    //Send the message with an ANSI Buffer
    lResult = SendMessageA(hWnd, Msg, (WPARAM)wParam, (LPARAM)psz);

    //All messages that have [output] messages (return strings)
    switch(Msg)
    {
      case WM_GETTEXT:
        //Now convert the result into the users WCHAR buffer
        //wParam indicates the max length
        ConvertToWCHAR(psz, pwszText, (INT)wParam);
        break;

      case EM_GETLINE:
        //Now convert the result into the users WCHAR buffer
        ASSERT(pwszText);
        ConvertToWCHAR(psz, pwszText, ((WORD*)pwszText)[0]);
        break;

      case CB_GETLBTEXT:
      case EM_GETSELTEXT:
      case LB_GETTEXT:
        //Now convert the result into the users WCHAR buffer
        ConvertToWCHAR(psz, pwszText, ulDestSize);
        break;
    };

    //Free any dynamically allocated memory
    if(psz != szBuffer)
      SAFE_FREE(psz);
  }

CLEANUP:
  return lResult;
}

LRESULT wSendMessageFmt | ( | HWND | hWnd,
 |  | UINT | Msg,
 |  | WPARAM | wParam,
 |  | WCHAR * | pwszFmt,
 |  |  | ...
 | ) |  |

Definition at line 3070 of file common.cpp.

{
  ASSERT(pwszFmt);
  ASSERT(wParam != WM_GETTEXT);

  va_list   marker;
  WCHAR   wszBuffer[MAX_QUERY_LEN];

  // Use format and arguements as input
  //This version will not overwrite the stack, since it only copies
  //upto the max size of the array
  va_start(marker, pwszFmt);
  _vsnwprintf(wszBuffer, MAX_QUERY_LEN, pwszFmt, marker);
  va_end(marker);

  //Make sure there is a NULL Terminator, vsnwprintf will not copy
  //the terminator if length==MAX_QUERY_LEN
  wszBuffer[MAX_QUERY_LEN-1] = wEOL;

  //Delegate
  return wSendMessage(hWnd, Msg, wParam, wszBuffer);
}

Variable Documentation

CComPtr<IDataConvert> g_spDataConvert

Definition at line 32 of file common.cpp.

WCHAR wsz_ERROR[] = "Microsoft OLE DB RowsetViewer - Error"
WCHAR wsz_ERRORINFO[] = "Microsoft OLE DB RowsetViewer - IErrorInfo"
WCHAR wsz_EXCEPTION[] = "Microsoft OLE DB RowsetViewer - Exception"
WCHAR wsz_INFO[] = "Microsoft OLE DB RowsetViewer - Info"
WCHAR wsz_INVALID_VALUE_[] = "Invalid Value '%s' specified. Please specify a value >= %lu and <= %lu."
WCHAR wsz_SUCCESS[] = "Microsoft OLE DB RowsetViewer - Success"
WCHAR wsz_WARNING[] = "Microsoft OLE DB RowsetViewer - Warning"
Generated on Wed Nov 13 2024 16:53:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/common.h File Reference

  • Dataaccess
  • oledb
  • rowsetviewer
Classes | Defines | Enumerations | Functions | Variables

common.h File Reference

#include "Headers.h"
#include "crtdbg.h"

Go to the source code of this file.

Classes

class | CVariant

Defines

#define | __WIDESTRING(str) L##str
#define | ABS(value) ((value) >= 0 ? (value) : -(value))
#define | ASSERT(exp) _ASSERTE(exp)
#define | ASSERTC(exp) { if(!(exp)) { ASSERT(!#exp); goto CLEANUP; } }
#define | BINDING_LENGTH(Binding, p) (*(DBLENGTH*)((BYTE*)(p) + (Binding).obLength))
#define | BINDING_STATUS(Binding, p) (*(DBSTATUS*)((BYTE*)(p) + (Binding).obStatus))
#define | BINDING_VALUE(Binding, p) (*(void**)((BYTE*)(p) + (Binding).obValue ))
#define | BIT_CLEAR(dwValue, dwMask) (!((dwValue) & (dwMask)))
#define | BIT_SET(dwValue, dwMask) (((dwValue) & (dwMask)) == (dwMask))
#define | BREAKINTO() DebugBreak()
#define | CHECK_MEMORY(p) { if(!(p)) { DisplayAllErrors(hr = E_OUTOFMEMORY, WIDESTRING(__FILE__), __LINE__); goto CLEANUP; } }
#define | DBTYPE_SRC_DST(dbSrc, dbDst) (((dbSrc) << (sizeof(DBTYPE)*8)) + (dbDst))
#define | DISP_FILE_LINE
#define | ENABLE_BIT(dwValue, dwMask, fEnable) ((fEnable) ? (dwValue) |= (dwMask) : (dwValue) &= ~(dwMask))
#define | EOL '\0'
#define | GETLASTERROR(exp) { if(!(exp)) { DisplayWinError(GetLastError(), WIDESTRING(__FILE__), __LINE__); } }
#define | GETLASTERRORC(exp) { if(!(exp)) { DisplayWinError(GetLastError(), WIDESTRING(__FILE__), __LINE__)); goto CLEANUP; } }
#define | HKEY_ROWSETVIEWER HKEY_CURRENT_USER
#define | IMAGE_NONE (-1)
#define | IS_EVEN(dwValue) (((dwValue) & 1) == 0)
#define | LENGTH_IS_BOUND(Binding) ( (Binding).dwPart & DBPART_LENGTH )
#define | LV_ALLITEMS (LVM_ERR)
#define | LV_ALLSELITEMS (LV_ALLITEMS-1)
#define | LVM_ERR (-1)
#define | MAX_BLOCK_SIZE 2000
#define | MAX_COL_SIZE 5000
#define | MAX_NAME_LEN 256
#define | MAX_OPENROWS 256
#define | MAX_QUERY_LEN 4096
#define | NUMELE(rgEle) (sizeof(rgEle) / sizeof(rgEle[0]))
#define | PARAM_NONE (-1)
#define | POINTER_DISPLAYSIZE (sizeof(INT_PTR)*2+2+1)
#define | RGB_FROM_COLOREF(cref) (((cref & 0x000000FF) << 16) | ((cref & 0x0000FF00)) | ((cref & 0x00FF0000) >> 16))
#define | ROUNDUP(size) ROUNDUP_(size, ROUNDUP_AMOUNT)
#define | ROUNDUP_(size, amount) (((ULONG)(size)+((amount)-1))&~((amount)-1))
#define | ROUNDUP_AMOUNT 8
#define | SAFE_ADDREF(p) if(p) { (p)->AddRef(); }
#define | SAFE_ALLOC(p, type, cb) { DISP_FILE_LINE; (p) = (type*)CoTaskMemAlloc(ULONG((cb)*sizeof(type))); CHECK_MEMORY(p); }
#define | SAFE_BSTRALLOC(p, bstr) { (p) = SysAllocString(bstr); CHECK_MEMORY(p); }
#define | SAFE_BSTRFREE(p) if(p) { SysFreeString(p); (p) = NULL; }
#define | SAFE_DELETE(p) if(p) { delete p; p = NULL; }
#define | SAFE_FREE(p) if(p) { CoTaskMemFree((void*)p); (p) = NULL; }
#define | SAFE_REALLOC(p, type, cb) { DISP_FILE_LINE; (p) = (type*)CoTaskMemRealloc((type*)p, ULONG((cb)*sizeof(type))); CHECK_MEMORY(p); }
#define | SAFE_RELEASE(p) if(p) { (p)->Release(); (p) = NULL; }
#define | STATE_NONE (-1)
#define | STATUS_IS_BOUND(Binding) ( (Binding).dwPart & DBPART_STATUS )
#define | TEST(hr) { (hr); }
#define | TESTC(hr) { if(FAILED(hr)) goto CLEANUP; }
#define | TESTC_(hr, hrExpected) { if((hr) != (hrExpected)) goto CLEANUP; }
#define | TRACE if(0) InternalTrace
#define | TRACEFMT if(0) InternalTraceFmt
#define | VALUE_CHAR(value) #value, value
#define | VALUE_CHAR_HR(hr) #hr, HRESULT_FROM_WIN32(hr)
#define | VALUE_IS_BOUND(Binding) ( (Binding).dwPart & DBPART_VALUE )
#define | VALUE_PWCHAR(value) L#value, &value
#define | VALUE_WCHAR(value) L#value, value
#define | wEOL L'\0'
#define | WIDESTRING(str) __WIDESTRING(str)
#define | WndEOL "\r\n"
#define | wszCONFIG_KEY wszROWSETVIEWER_KEY L"\\Config"
#define | wszMDICHILD_KEY wszROWSETVIEWER_KEY L"\\MDIChild"
#define | wszOBJECTS_KEY wszROWSETVIEWER_KEY L"\\Objects"
#define | wszOPTIONS_KEY wszROWSETVIEWER_KEY L"\\Options"
#define | wszRECENTCONFIG_KEY wszROWSETVIEWER_KEY L"\\RecentConfig"
#define | wszRECENTFILE_KEY wszROWSETVIEWER_KEY L"\\RecentFile"
#define | wszRECENTINITSTRING_KEY wszROWSETVIEWER_KEY L"\\RecentInitString"
#define | wszRECENTURL_KEY wszROWSETVIEWER_KEY L"\\RecentURL"
#define | wszROWSETVIEWER_KEY L"Software\\Microsoft\\OLE DB\\RowsetViewer"
#define | wszTRACE_KEY wszROWSETVIEWER_KEY L"\\Trace"
#define | wWndEOL L"\r\n"
#define | XTEST(hr) { DisplayAllErrors(hr, WIDESTRING(__FILE__), __LINE__); }
#define | XTEST_(hr, hrExpected) { DisplayAllErrors(hr, hrExpected, WIDESTRING(__FILE__), __LINE__); }
#define | XTESTC(hr) { if(FAILED(DisplayAllErrors(hr, WIDESTRING(__FILE__), __LINE__))) goto CLEANUP; }
#define | XTESTC_(hr, hrExpected) { if(FAILED(DisplayAllErrors(hr, hrExpected, WIDESTRING(__FILE__), __LINE__))) goto CLEANUP; }

Enumerations

enum CONV_FLAGS {
CONV_NONE = 0x00000000, CONV_VARBOOL = 0x00000001, CONV_ALPHABOOL = 0x00000002, CONV_HEX = 0x00000004,
CONV_OCTAL = 0x00000008, CONV_DECIMAL = 0x00000010, CONV_BINARY = 0x00000020, CONV_TYPENAME = 0x00000100,
CONV_MSDADC_ONLY = 0x00001000
}

Functions

HRESULT | BrowseOpenFileName (HINSTANCE hInstance, HWND hWnd, WCHAR *pwszTitle, WCHAR *pwszFileName, ULONG ulMaxSize, WCHAR *pwszExtension=NULL, WCHAR *pwszFilter=L"All Files (*.*)\0*.*\0\0", DWORD *pdwFileOffset=NULL, DWORD dwFlags=OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_SHAREAWARE)
HRESULT | BrowseSaveFileName (HINSTANCE hInstance, HWND hWnd, WCHAR *pwszTitle, WCHAR *pwszFileName, ULONG ulMaxSize, WCHAR *pwszExtension=NULL, WCHAR *pwszFilter=L"All Files (*.*)\0*.*\0\0", DWORD *pdwFileOffset=NULL, DWORD dwFlags=OFN_EXPLORER|OFN_PATHMUSTEXIST|OFN_HIDEREADONLY|OFN_SHAREAWARE|OFN_CREATEPROMPT)
BOOL | CenterDialog (HWND hDlg)
HRESULT | CloseRegKey (HKEY hKey)
HRESULT | CLSIDFromProgIDEx (WCHAR *pwszString, CLSID *pCLSID)
HRESULT | CLSIDFromStringEx (WCHAR *pwszString, CLSID *pCLSID)
BOOL | ConvertToLONG (LPCWSTR pwszText, LONG *plValue, LONG lMin=LONG_MIN, LONG lMax=LONG_MAX, INT iBase=10)
INT | ConvertToMBCS (LPCWSTR pwsz, CHAR *psz, INT chDst)
INT | ConvertToMBCS (LPCWSTR pwsz, INT cchSrc, CHAR *psz, INT cchDst)
CHAR * | ConvertToMBCS (LPCWSTR pwsz)
INT | ConvertToWCHAR (LPCSTR psz, INT cchSrc, WCHAR *pwsz, INT ccbDst)
INT | ConvertToWCHAR (LPCSTR psz, WCHAR *pwsz, INT cbDst)
WCHAR * | ConvertToWCHAR (LPCSTR psz)
HRESULT | CopyBinding (DBBINDING *pDest, DBBINDING *pSource)
HRESULT | CreateDefFileName (LPCWSTR pwszFileName, WCHAR *pwszFullPath, ULONG ulMaxSize, BOOL fCurrentDir=TRUE)
HRESULT | CreateRegKey (HKEY hRootKey, WCHAR *pwszKeyName, HKEY *phKey, REGSAM samDesired=KEY_READ|KEY_WRITE)
HRESULT | DataConvert (DBSTATUS dbSrcStatus, DBLENGTH cbSrcLength, DBLENGTH cbSrcMaxLength, DBTYPE wSrcType, void *pSrcValue, BYTE bPrecision, BYTE bScale, DBTYPE wDstType, DBSTATUS *pdbDstStatus, DBLENGTH *pcbDstLength, void *pDstValue, DBLENGTH cbDstMaxLength, DWORD dwConvFlags)
HRESULT | DBIDCopy (DBID *pDst, const DBID *pSrc)
BOOL | DBIDEqual (const DBID *pDst, const DBID *pSrc)
void | DBIDFree (DBID *pDBID)
HRESULT | DBIDToString (const DBID *pDBID, WCHAR *pwsz, ULONG ulMaxLen)
HRESULT | DelRegEntry (HKEY hRootKey, WCHAR *pwszKeyName)
HRESULT | DelRegEntry (HKEY hRootKey, WCHAR *pwszKeyName, BOOL fSubKeys)
HRESULT | FreeBindingData (DBCOUNTITEM cBindings, const DBBINDING *rgBindings, void *pData, BOOL fSetData=FALSE)
HRESULT | FreeBindings (DBCOUNTITEM *pcBindings, DBBINDING **prgBindings)
HRESULT | FreeColAccess (ULONG *pcColAccess, DBCOLUMNACCESS **prgColAccess, void **ppData)
HRESULT | FreeConstraintDesc (DBORDINAL *pcConsDesc, DBCONSTRAINTDESC **prgConsDesc, BOOL fFree=TRUE)
HRESULT | FreeData (DBTYPE wType, DBLENGTH cData, void *rgData)
RECT | GetClientCoords (HWND hWndParent, HWND hWnd)
SIZE | GetClientSize (HWND hWnd)
WCHAR * | GetColName (const DBCOLUMNINFO *pColInfo)
DBTYPE | GetDBType (WCHAR *pwszName)
HRESULT | GetDBTypeMaxSize (DBTYPE wType, DBLENGTH *pulMaxSize=NULL, BYTE *pbPrecision=NULL, BYTE *pbScale=NULL)
WCHAR * | GetDBTypeName (DBTYPE wType)
BOOL | GetEditBoxValue (HWND hEditWnd, LONG *plValue, LONG lMin=LONG_MIN, LONG lMax=LONG_MAX, BOOL fAllowEmpty=FALSE)
DBLENGTH | GetMaxDisplaySize (DBTYPE wBindingType, DBTYPE wBackendType, DBLENGTH ulColumnSize, DBLENGTH ulMaxVarSize)
ULONG_PTR | GetMenuData (HMENU hMenu, UINT uItem, BOOL fByPosition)
WCHAR * | GetProgID (REFCLSID clsid)
HRESULT | GetRegEntry (HKEY hRootKey, WCHAR *pwszKeyName, WCHAR *pwszValueName, WCHAR **ppwszValue)
HRESULT | GetRegEntry (HKEY hRootKey, WCHAR *pwszKeyName, WCHAR *pwszValueName, WCHAR *pwszValue, ULONG cBytes)
HRESULT | GetRegEntry (HKEY hRootKey, WCHAR *pwszKeyName, WCHAR *pwszValueName, ULONG *pulValue)
HRESULT | GetRegEntry (HKEY hRootKey, WCHAR *pwszKeyName, WCHAR *pwszValueName, void *pStruct, ULONG cbSize, ULONG *pcbActualSize, ULONG dwType=REG_BINARY)
HRESULT | GetRegEnumKey (HKEY hRootKey, WCHAR *pwszKeyName, DWORD dwIndex, WCHAR *pwszSubKeyName, ULONG cBytes)
HRESULT | GetRegEnumValue (HKEY hRootKey, WCHAR *pwszKeyName, DWORD dwIndex, WCHAR *pwszValueName, ULONG *pcBytes)
HRESULT | GetRegEnumValue (HKEY hRootKey, WCHAR *pwszKeyName, DWORD dwIndex, WCHAR **ppwszValueName)
void * | GetThis (HWND hWnd)
DBTYPE | GetVariantType (WCHAR *pwszName)
WCHAR * | GetVariantTypeName (DBTYPE wType)
BOOL | GetWindowPos (HWND hWnd, POINTS *pPTS)
SIZE | GetWindowSize (HWND hWnd)
void | InternalTrace (LPCWSTR pwszText)
void | InternalTraceFmt (LPCWSTR pwszFmt,...)
BOOL | IsFixedType (DBTYPE wType)
BOOL | IsNumericType (DBTYPE wType)
BOOL IsUnicodeOS ()
BOOL | IsVariableType (DBTYPE wType)
HINSTANCE | LoadDll (WCHAR *pwszDll)
BOOL | MoveWindow (HWND hWnd, ULONG x, ULONG y)
HRESULT | OpenRegKey (HKEY hRootKey, WCHAR *pwszKeyName, DWORD ulOptions, REGSAM samDesired, HKEY *phKey)
HRESULT | PostProcessString (WCHAR *pwsz, DBLENGTH ulMaxSize, DWORD dwFlags)
LONG | RunSysCommand (WCHAR *pwszCommand)
HRESULT | SafeArrayToString (SAFEARRAY *pSafeArray, DBTYPE wType, WCHAR *pwsz, DBLENGTH ulMaxSize)
BOOL | SetMenuData (HMENU hMenu, UINT uItem, BOOL fByPosition, ULONG_PTR dwItemData)
HRESULT | SetRegEntry (HKEY hRootKey, WCHAR *pwszKeyName, WCHAR *pwszValueName, void *pStruct, ULONG cbSize, ULONG dwType=REG_BINARY)
HRESULT | SetRegEntry (HKEY hRootKey, WCHAR *pwszKeyName, WCHAR *pwszValueName, ULONG ulValue)
HRESULT | SetRegEntry (HKEY hRootKey, WCHAR *pwszKeyName, WCHAR *pwszValueName, WCHAR *pwszValue)
BOOL | SetSubMenuData (HMENU hMenu, UINT uItem, BOOL fByPosition, ULONG_PTR dwItemData)
void * | SetThis (HWND hWnd, void *pThis)
WCHAR * | StackFormat (LPCWSTR pwszFmt,...)
CHAR * | strDuplicate (LPCSTR psz)
BOOL | StringCompare (LPCWSTR pwsz1, LPCWSTR pwsz2)
BOOL | StringCompareI (LPCWSTR pwsz1, LPCWSTR pwsz2)
WCHAR * | StringCopy (WCHAR *pwszDest, LPCWSTR pwszSource, DBLENGTH cMaxLen)
CHAR * | StringCopy (CHAR *pszDest, LPCSTR pszSource, DBLENGTH cMaxLen)
WCHAR * | StringFormat (WCHAR *pwszDest, DBLENGTH ulStrLen, LPCWSTR pwszFmt,...)
HRESULT | StringToSafeArray (WCHAR *pwsz, DBTYPE wType, SAFEARRAY **ppSafeArray)
HRESULT | StringToVariant (WCHAR *pwsz, VARTYPE vt, VARIANT *pVariant, DWORD dwFlags=CONV_ALPHABOOL|CONV_VARBOOL)
HRESULT | StringToVector (WCHAR *pwszBuffer, DBTYPE wType, DBVECTOR *pVector)
INT_PTR WINAPI | SynchSubProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
void | SyncSibling (HWND hwndLstChg, HWND hwndLstSrc)
HRESULT | VariantChangeFast (VARIANT *pVarDest, VARIANT *pVarSrc, LCID lcid, USHORT wFlags, VARTYPE vt)
HRESULT | VariantClearFast (VARIANT *pVariant)
HRESULT | VariantCopyFast (VARIANT *pVarDest, VARIANT *pVarSrc)
HRESULT | VariantInitFast (VARIANT *pVariant)
HRESULT | VariantToString (VARIANT *pVariant, WCHAR *pwsz, DBLENGTH ulMaxSize, DWORD dwFlags)
HRESULT | VectorToString (DBVECTOR *pVector, DBTYPE wType, WCHAR *pwszBuffer, DBLENGTH ulMaxSize)
WCHAR * | wcsDuplicate (LPCWSTR pwsz)
WCHAR * | wGetWindowText (HWND hWnd)
INT | wMessageBox (HWND hDlg, UINT uiStyle, WCHAR *pwszTitle, WCHAR *pwszFmt,...)
LRESULT | wSendMessage (HWND hWnd, UINT Msg, WPARAM wParam, WCHAR *pwszText)
LRESULT | wSendMessageFmt (HWND hWnd, UINT Msg, WPARAM wParam, WCHAR *pwszFmt,...)

Variables

CComPtr< IDataConvert > | g_spDataConvert
const BOOL | HANDLED_MSG = TRUE
const COLORREF | RGB_BLUE = RGB(0, 0, 0xff)
const COLORREF | RGB_BROWN = RGB(0x80, 0x40, 0)
const COLORREF | RGB_DARK_BLUE = RGB(0, 0, 0x80)
const COLORREF | RGB_DARK_GREEN = RGB(0, 0x80, 0)
const COLORREF | RGB_DARK_RED = RGB(0x80, 0, 0)
const COLORREF | RGB_GREEN = RGB(0, 0xff, 0)
const COLORREF | RGB_NONE = 0
const COLORREF | RGB_RED = RGB(0xff, 0, 0)
const BOOL | UNHANDLED_MSG = FALSE
WCHAR | wsz_ERROR []
WCHAR | wsz_ERRORINFO []
WCHAR | wsz_EXCEPTION []
WCHAR | wsz_INFO []
WCHAR | wsz_INVALID_VALUE_ []
WCHAR | wsz_SUCCESS []
WCHAR | wsz_WARNING []

Define Documentation

#define __WIDESTRING ( str ) L##str

Definition at line 111 of file common.h.

#define ABS ( value ) ((value) >= 0 ? (value) : -(value))

Definition at line 205 of file common.h.

#define ASSERT ( exp ) _ASSERTE(exp)

Definition at line 405 of file common.h.

#define ASSERTC ( exp ) { if(!(exp)) { ASSERT(!#exp); goto CLEANUP; } }

Definition at line 406 of file common.h.

#define BINDING_LENGTH | ( | Binding,
 |  | p |
 | ) |  | (*(DBLENGTH*)((BYTE*)(p) + (Binding).obLength))

Definition at line 190 of file common.h.

#define BINDING_STATUS | ( | Binding,
 |  | p |
 | ) |  | (*(DBSTATUS*)((BYTE*)(p) + (Binding).obStatus))

Definition at line 186 of file common.h.

#define BINDING_VALUE | ( | Binding,
 |  | p |
 | ) |  | (*(void**)((BYTE*)(p) + (Binding).obValue ))

Definition at line 194 of file common.h.

#define BIT_CLEAR | ( | dwValue,
 |  | dwMask |
 | ) |  | (!((dwValue) & (dwMask)))

Definition at line 202 of file common.h.

#define BIT_SET | ( | dwValue,
 |  | dwMask |
 | ) |  | (((dwValue) & (dwMask)) == (dwMask))

Definition at line 201 of file common.h.

#define BREAKINTO ( ) DebugBreak()

Definition at line 423 of file common.h.

#define CHECK_MEMORY ( p ) { if(!(p)) { DisplayAllErrors(hr = E_OUTOFMEMORY, WIDESTRING(__FILE__), __LINE__); goto CLEANUP; } }

Definition at line 121 of file common.h.

#define DBTYPE_SRC_DST | ( | dbSrc,
 |  | dbDst |
 | ) |  | (((dbSrc) << (sizeof(DBTYPE)*8)) + (dbDst))

Definition at line 182 of file common.h.

#define DISP_FILE_LINE

Definition at line 118 of file common.h.

#define ENABLE_BIT | ( | dwValue,
 |  | dwMask,
 |  | fEnable |
 | ) |  | ((fEnable) ? (dwValue) |= (dwMask) : (dwValue) &= ~(dwMask))

Definition at line 203 of file common.h.

#define EOL '\0'

Definition at line 171 of file common.h.

#define GETLASTERROR ( exp ) { if(!(exp)) { DisplayWinError(GetLastError(), WIDESTRING(__FILE__), __LINE__); } }

Definition at line 147 of file common.h.

#define GETLASTERRORC ( exp ) { if(!(exp)) { DisplayWinError(GetLastError(), WIDESTRING(__FILE__), __LINE__)); goto CLEANUP; } }

Definition at line 148 of file common.h.

#define HKEY_ROWSETVIEWER HKEY_CURRENT_USER

Definition at line 55 of file common.h.

#define IMAGE_NONE (-1)

Definition at line 101 of file common.h.

#define IS_EVEN ( dwValue ) (((dwValue) & 1) == 0)

Definition at line 204 of file common.h.

#define LENGTH_IS_BOUND ( Binding ) ( (Binding).dwPart & DBPART_LENGTH )

Definition at line 189 of file common.h.

#define LV_ALLITEMS (LVM_ERR)

Definition at line 98 of file common.h.

#define LV_ALLSELITEMS (LV_ALLITEMS-1)

Definition at line 99 of file common.h.

#define LVM_ERR (-1)

Definition at line 97 of file common.h.

#define MAX_BLOCK_SIZE 2000

Definition at line 159 of file common.h.

#define MAX_COL_SIZE 5000

Definition at line 158 of file common.h.

#define MAX_NAME_LEN 256

Definition at line 156 of file common.h.

#define MAX_OPENROWS 256

Definition at line 160 of file common.h.

#define MAX_QUERY_LEN 4096

Definition at line 155 of file common.h.

#define NUMELE ( rgEle ) (sizeof(rgEle) / sizeof(rgEle[0]))

Definition at line 110 of file common.h.

#define PARAM_NONE (-1)

Definition at line 102 of file common.h.

#define POINTER_DISPLAYSIZE (sizeof(INT_PTR)*2+2+1)

Definition at line 163 of file common.h.

#define RGB_FROM_COLOREF ( cref ) (((cref & 0x000000FF) << 16) | ((cref & 0x0000FF00)) | ((cref & 0x00FF0000) >> 16))

Definition at line 73 of file common.h.

#define ROUNDUP ( size ) ROUNDUP_(size, ROUNDUP_AMOUNT)

Definition at line 199 of file common.h.

#define ROUNDUP_ | ( | size,
 |  | amount |
 | ) |  | (((ULONG)(size)+((amount)-1))&~((amount)-1))

Definition at line 198 of file common.h.

#define ROUNDUP_AMOUNT 8

Definition at line 197 of file common.h.

#define SAFE_ADDREF ( p ) if(p) { (p)->AddRef(); }

Definition at line 129 of file common.h.

#define SAFE_ALLOC | ( | p,
 |  | type,
 |  | cb |
 | ) |  | { DISP_FILE_LINE; (p) = (type*)CoTaskMemAlloc(ULONG((cb)*sizeof(type))); CHECK_MEMORY(p); }

Definition at line 122 of file common.h.

#define SAFE_BSTRALLOC | ( | p,
 |  | bstr |
 | ) |  | { (p) = SysAllocString(bstr); CHECK_MEMORY(p); }

Definition at line 124 of file common.h.

#define SAFE_BSTRFREE ( p ) if(p) { SysFreeString(p); (p) = NULL; }

Definition at line 127 of file common.h.

#define SAFE_DELETE ( p ) if(p) { delete p; p = NULL; }

Definition at line 131 of file common.h.

#define SAFE_FREE ( p ) if(p) { CoTaskMemFree((void*)p); (p) = NULL; }

Definition at line 126 of file common.h.

#define SAFE_REALLOC | ( | p,
 |  | type,
 |  | cb |
 | ) |  | { DISP_FILE_LINE; (p) = (type*)CoTaskMemRealloc((type*)p, ULONG((cb)*sizeof(type))); CHECK_MEMORY(p); }

Definition at line 123 of file common.h.

#define SAFE_RELEASE ( p ) if(p) { (p)->Release(); (p) = NULL; }

Definition at line 130 of file common.h.

#define STATE_NONE (-1)

Definition at line 103 of file common.h.

#define STATUS_IS_BOUND ( Binding ) ( (Binding).dwPart & DBPART_STATUS )

Definition at line 185 of file common.h.

#define TEST ( hr ) { (hr); }

Definition at line 135 of file common.h.

#define TESTC ( hr ) { if(FAILED(hr)) goto CLEANUP; }

Definition at line 136 of file common.h.

#define TESTC_ | ( | hr,
 |  | hrExpected |
 | ) |  | { if((hr) != (hrExpected)) goto CLEANUP; }

Definition at line 137 of file common.h.

#define TRACE if(0) InternalTrace

Definition at line 413 of file common.h.

#define TRACEFMT if(0) InternalTraceFmt

Definition at line 414 of file common.h.

#define VALUE_CHAR ( value ) #value, value

Definition at line 167 of file common.h.

#define VALUE_CHAR_HR ( hr ) #hr, HRESULT_FROM_WIN32(hr)

Definition at line 169 of file common.h.

#define VALUE_IS_BOUND ( Binding ) ( (Binding).dwPart & DBPART_VALUE )

Definition at line 193 of file common.h.

#define VALUE_PWCHAR ( value ) L#value, &value

Definition at line 168 of file common.h.

#define VALUE_WCHAR ( value ) L#value, value

Definition at line 166 of file common.h.

#define wEOL L'\0'

Definition at line 172 of file common.h.

#define WIDESTRING ( str ) __WIDESTRING(str)

Definition at line 112 of file common.h.

#define WndEOL "\r\n"

Definition at line 173 of file common.h.

#define wszCONFIG_KEY wszROWSETVIEWER_KEY L"\\Config"

Definition at line 57 of file common.h.

#define wszMDICHILD_KEY wszROWSETVIEWER_KEY L"\\MDIChild"

Definition at line 64 of file common.h.

#define wszOBJECTS_KEY wszROWSETVIEWER_KEY L"\\Objects"

Definition at line 63 of file common.h.

#define wszOPTIONS_KEY wszROWSETVIEWER_KEY L"\\Options"

Definition at line 61 of file common.h.

#define wszRECENTCONFIG_KEY wszROWSETVIEWER_KEY L"\\RecentConfig"

Definition at line 58 of file common.h.

#define wszRECENTFILE_KEY wszROWSETVIEWER_KEY L"\\RecentFile"

Definition at line 59 of file common.h.

#define wszRECENTINITSTRING_KEY wszROWSETVIEWER_KEY L"\\RecentInitString"

Definition at line 60 of file common.h.

#define wszRECENTURL_KEY wszROWSETVIEWER_KEY L"\\RecentURL"

Definition at line 65 of file common.h.

#define wszROWSETVIEWER_KEY L"Software\\Microsoft\\OLE DB\\RowsetViewer"

Definition at line 56 of file common.h.

#define wszTRACE_KEY wszROWSETVIEWER_KEY L"\\Trace"

Definition at line 62 of file common.h.

#define wWndEOL L"\r\n"

Definition at line 174 of file common.h.

#define XTEST ( hr ) { DisplayAllErrors(hr, WIDESTRING(__FILE__), __LINE__); }

Definition at line 141 of file common.h.

#define XTEST_ | ( | hr,
 |  | hrExpected |
 | ) |  | { DisplayAllErrors(hr, hrExpected, WIDESTRING(__FILE__), __LINE__); }

Definition at line 142 of file common.h.

#define XTESTC ( hr ) { if(FAILED(DisplayAllErrors(hr, WIDESTRING(__FILE__), __LINE__))) goto CLEANUP; }

Definition at line 143 of file common.h.

#define XTESTC_ | ( | hr,
 |  | hrExpected |
 | ) |  | { if(FAILED(DisplayAllErrors(hr, hrExpected, WIDESTRING(__FILE__), __LINE__))) goto CLEANUP; }

Definition at line 144 of file common.h.

Enumeration Type Documentation

enum CONV_FLAGS
Enumerator:
CONV_NONE
CONV_VARBOOL
CONV_ALPHABOOL
CONV_HEX
CONV_OCTAL
CONV_DECIMAL
CONV_BINARY
CONV_TYPENAME
CONV_MSDADC_ONLY

Definition at line 35 of file common.h.

{
  CONV_NONE     = 0x00000000,
  CONV_VARBOOL    = 0x00000001,
  CONV_ALPHABOOL    = 0x00000002,
  CONV_HEX      = 0x00000004,
  CONV_OCTAL      = 0x00000008,
  CONV_DECIMAL    = 0x00000010,
  CONV_BINARY     = 0x00000020,

  CONV_TYPENAME   = 0x00000100,
  CONV_MSDADC_ONLY  = 0x00001000
};

Function Documentation

HRESULT BrowseOpenFileName | ( | HINSTANCE | hInstance,
 |  | HWND | hWnd,
 |  | WCHAR * | pwszTitle,
 |  | WCHAR * | pwszFileName,
 |  | ULONG | ulMaxSize,
 |  | WCHAR * | pwszExtension = NULL,
 |  | WCHAR * | pwszFilter = L"All Files (*.*)\0*.*\0\0",
 |  | DWORD * | pdwFileOffset = NULL,
 |  | DWORD | dwFlags = OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_SHAREAWARE
 | ) |  |

Definition at line 3276 of file common.cpp.

{
  static ULONG ulFilterIndex = 1;  //Default to first filter
  HRESULT hr = E_FAIL;

  if(IsUnicodeOS())
  {
    //Setup OPENFILENAME struct...
    OPENFILENAMEW    ofn;
    memset( &ofn, 0, sizeof( ofn ));
    ofn.lStructSize       = sizeof( OPENFILENAMEW );
    ofn.hwndOwner         = hWnd;
    ofn.hInstance         = hInstance;
    ofn.nMaxFile          = ulMaxSize;
    ofn.nMaxCustFilter    = MAX_NAME_LEN;
    ofn.nFilterIndex    = ulFilterIndex;
    ofn.lpstrFile         = pwszFileName;
    ofn.lpstrTitle      = pwszTitle;
    ofn.lpstrFilter     = pwszFilter;
    ofn.lpstrDefExt     = pwszExtension;
    ofn.Flags             = dwFlags;

    //Display Common Dialog to obtain File To Load...
    TESTC_(GetOpenFileNameW(&ofn),TRUE);

    //Save the Choosen Filter Index
    ulFilterIndex = ofn.nFilterIndex;
    hr = S_OK;

    //Save the first FileName offset (if multiselet)
    if(pdwFileOffset)
      *pdwFileOffset = ofn.nFileOffset;
  }
  else
  {
    CHAR szFileName[MAX_NAME_LEN];
    ConvertToMBCS(pwszFileName, szFileName, MAX_NAME_LEN);
    CHAR szTitle[MAX_NAME_LEN];
    ConvertToMBCS(pwszTitle, szTitle, MAX_NAME_LEN);
    CHAR szExtension[MAX_NAME_LEN];
    ConvertToMBCS(pwszExtension, szExtension, MAX_NAME_LEN);

    //NOTE:  pwszFilter is a double null terminated string, (containing an array of singurally
    //null terminated sub strings).
    CHAR szFilter[MAX_QUERY_LEN] = {0};
    CHAR* pszFilter = szFilter;
    while(pwszFilter && *pwszFilter)
    {
      ConvertToMBCS(pwszFilter, pszFilter, MAX_QUERY_LEN-(INT)(pszFilter-szFilter));
      pwszFilter += wcslen(pwszFilter) + 1;
      pszFilter += strlen(pszFilter) + 1;
    }

    //Setup OPENFILENAME struct...
    OPENFILENAMEA    ofn;
    memset( &ofn, 0, sizeof( ofn ));
    ofn.lStructSize       = sizeof( OPENFILENAMEA );
    ofn.hwndOwner         = hWnd;
    ofn.hInstance         = hInstance;
    ofn.nMaxFile          = ulMaxSize;
    ofn.nMaxCustFilter    = MAX_NAME_LEN;
    ofn.nFilterIndex    = ulFilterIndex;
    ofn.lpstrFile         = szFileName;
    ofn.lpstrTitle      = szTitle;
    ofn.lpstrFilter     = szFilter;
    ofn.lpstrDefExt     = szExtension;
    ofn.Flags             = dwFlags;

    //Display Common Dialog to obtain File To Load...
    TESTC_(GetOpenFileNameA(&ofn), TRUE)
    ConvertToWCHAR(szFileName, pwszFileName, MAX_NAME_LEN);

    //Save the Choosen Filter Index
    ulFilterIndex = ofn.nFilterIndex;
    hr = S_OK;

    //Save the first FileName offset (if multiselet)
    if(pdwFileOffset)
      *pdwFileOffset = ofn.nFileOffset;
  }

CLEANUP:
  return hr;
}

HRESULT BrowseSaveFileName | ( | HINSTANCE | hInstance,
 |  | HWND | hWnd,
 |  | WCHAR * | pwszTitle,
 |  | WCHAR * | pwszFileName,
 |  | ULONG | ulMaxSize,
 |  | WCHAR * | pwszExtension = NULL,
 |  | WCHAR * | pwszFilter = L"All Files (*.*)\0*.*\0\0",
 |  | DWORD * | pdwFileOffset = NULL,
 |  | DWORD | dwFlags = OFN_EXPLORER|OFN_PATHMUSTEXIST|OFN_HIDEREADONLY|OFN_SHAREAWARE|OFN_CREATEPROMPT
 | ) |  |

Definition at line 3420 of file common.cpp.

{
  HRESULT hr = E_FAIL;
  static ULONG ulFilterIndex = 1;  //Default to first filter

  if(IsUnicodeOS())
  {
    //Setup OPENFILENAME struct...
    OPENFILENAMEW    ofn;
    memset( &ofn, 0, sizeof( ofn ));
    ofn.lStructSize       = sizeof( OPENFILENAMEW );
    ofn.hwndOwner         = hWnd;
    ofn.hInstance         = hInstance;
    ofn.nMaxFile          = ulMaxSize;
    ofn.lpstrFile         = pwszFileName;
    ofn.lpstrTitle      = pwszTitle;
    ofn.lpstrFilter     = pwszFilter;
    ofn.nMaxCustFilter    = MAX_NAME_LEN;
    ofn.nFilterIndex    = ulFilterIndex;
    ofn.lpstrDefExt     = pwszExtension;
    ofn.Flags             = dwFlags;

    //Display Common Dialog to obtain File To Save...
    if(GetSaveFileNameW(&ofn))
    {
      ulFilterIndex = ofn.nFilterIndex;

      //Save the first FileName offset (if multiselet)
      if(pdwFileOffset)
        *pdwFileOffset = ofn.nFileOffset;

      hr = S_OK;
    }
  }
  else
  {
    CHAR szFileName[MAX_NAME_LEN];
    ConvertToMBCS(pwszFileName, szFileName, MAX_NAME_LEN);
    CHAR szTitle[MAX_NAME_LEN];
    ConvertToMBCS(pwszTitle, szTitle, MAX_NAME_LEN);
    CHAR szExtension[MAX_NAME_LEN];
    ConvertToMBCS(pwszExtension, szExtension, MAX_NAME_LEN);

    //NOTE:  pwszFilter is a double null terminated string, (containing an array of singurally
    //null terminated sub strings).
    CHAR szFilter[MAX_QUERY_LEN] = {0};
    CHAR* pszFilter = szFilter;
    while(pwszFilter && *pwszFilter)
    {
      ConvertToMBCS(pwszFilter, pszFilter, MAX_QUERY_LEN-(INT)(pszFilter-szFilter));
      pwszFilter += wcslen(pwszFilter) + 1;
      pszFilter += strlen(pszFilter) + 1;
    }

    //Setup OPENFILENAME struct...
    OPENFILENAMEA    ofn;
    memset( &ofn, 0, sizeof( ofn ));
    ofn.lStructSize       = sizeof( OPENFILENAMEA );
    ofn.hwndOwner         = hWnd;
    ofn.hInstance         = hInstance;
    ofn.nMaxFile          = ulMaxSize;
    ofn.lpstrFile         = szFileName;
    ofn.lpstrTitle      = szTitle;
    ofn.lpstrFilter     = szFilter;
    ofn.nMaxCustFilter    = MAX_NAME_LEN;
    ofn.nFilterIndex    = ulFilterIndex;
    ofn.lpstrDefExt     = szExtension;
    ofn.Flags             = dwFlags;

    //Display Common Dialog to obtain File To Save...
    if(GetSaveFileNameA(&ofn))
    {
      ConvertToWCHAR(szFileName, pwszFileName, MAX_NAME_LEN);
      ulFilterIndex = ofn.nFilterIndex;

      //Save the first FileName offset (if multiselet)
      if(pdwFileOffset)
        *pdwFileOffset = ofn.nFileOffset;

      hr = S_OK;
    }
  }

  return hr;
}

BOOL CenterDialog ( HWND hDlg )

Definition at line 2784 of file common.cpp.

{
  RECT  rcParent;                         // Parent window client rect
  RECT  rcDlg;                            // Dialog window rect
  int   nLeft, nTop;                      // Top-left coordinates
  int   cWidth, cHeight;                  // Width and height
  HWND  hwnd;

  // Get frame window client rect in screen coordinates
  hwnd = GetParent(hdlg);
  if(hwnd == NULL || hwnd == GetDesktopWindow())
  {
    rcParent.top = rcParent.left = 0;
    rcParent.right = GetSystemMetrics(SM_CXFULLSCREEN);
    rcParent.bottom = GetSystemMetrics(SM_CYFULLSCREEN);
  }
  else
  {
    GetWindowRect(hwnd, &rcParent);
  }

  // Determine the top-left point for the dialog to be centered
  GetWindowRect(hdlg, &rcDlg);
  cWidth  = rcDlg.right  - rcDlg.left;
  cHeight = rcDlg.bottom - rcDlg.top;
  nLeft   = rcParent.left +
            (((rcParent.right  - rcParent.left) - cWidth ) / 2);
  nTop    = rcParent.top  +
            (((rcParent.bottom - rcParent.top ) - cHeight) / 2);
  if (nLeft < 0) nLeft = 0;
  if (nTop  < 0) nTop  = 0;

  // Place the dialog
  return MoveWindow(hdlg, nLeft, nTop, cWidth, cHeight, TRUE);
}

HRESULT CloseRegKey ( HKEY hKey )

Definition at line 3965 of file common.cpp.

{
  HRESULT hr = S_OK;

  //RegCloseKey
  if(hKey)
    hr = RegCloseKey(hKey);

  if(hr != S_OK)
    hr = E_FAIL;
  return hr;
}

HRESULT CLSIDFromProgIDEx | ( | WCHAR * | pwszString,
 |  | CLSID * | pCLSID
 | ) |  |
HRESULT CLSIDFromStringEx | ( | WCHAR * | pwszString,
 |  | CLSID * | pCLSID
 | ) |  |
BOOL ConvertToLONG | ( | LPCWSTR | pwszText,
 |  | LONG * | plValue,
 |  | LONG | lMin = LONG_MIN,
 |  | LONG | lMax = LONG_MAX,
 |  | INT | iBase = 10
 | ) |  |

Definition at line 3129 of file common.cpp.

{
  ASSERT(plValue);
  if(!pwszText || !pwszText[0])
    return FALSE;

  errno = 0;
  WCHAR*  pwszEnd = NULL;

  //Convert to LONG
  LONG lValue = wcstol(pwszText, &pwszEnd, iBase);
  if(errno==ERANGE || !pwszText[0] || lValue<lMin || lValue>lMax || pwszEnd==NULL || pwszEnd[0]!=wEOL)
    return FALSE;

  //Only change the input value on success...
  *plValue = lValue;
  return TRUE;
}

INT ConvertToMBCS | ( | LPCWSTR | pwsz,
 |  | CHAR * | psz,
 |  | INT | chDst
 | ) |  |

Definition at line 186 of file common.cpp.

{
  return ConvertToMBCS(pwsz, -1, psz, cchDst);
}

INT ConvertToMBCS | ( | LPCWSTR | pwsz,
 |  | INT | cchSrc,
 |  | CHAR * | psz,
 |  | INT | cchDst
 | ) |  |

Definition at line 196 of file common.cpp.

{
  //NOTE: The user can call this function with the Destination as NULL to indicate
  //just provide the length of the required conversion

  //No source
  if(!pwsz && psz)
  {
    //Conveience for the caller:
    //always make sure the result is null-terminated - if their is enough room
    if(cchDst >= 1)
    {
      psz[0] = EOL;
      return 1;
    }
    return 0;
  }

  //NOTE: WideCharToMultiByte destination buffer is really in (cb) count of bytes,
  //but to make things simplier since MultiByteToWideChar is opposite for the output
  //buffer, we will operate everything in cch - this is not a perf hit either since we don't
  //need a conversion since for CHAR -> cch == cb
  ASSERT(1/*cch*/ == sizeof(CHAR)/*cb*/);

  //Convert the string to MBCS
  INT cchWritten = WideCharToMultiByte(CP_ACP, 0, pwsz, cchSrc/*cch*/, psz, cchDst/*cb*/, NULL, NULL);

  //Since the buffer we passed in may be smaller than the actual data returned
  //we may not actually get to copy the NULL termintor, so make sure there is one at least
  //at the end of the buffer...
  if(cchDst && (cchDst < cchSrc))
  {
    cchWritten = cchDst;
    psz[cchWritten-1] = '\0';
  }

  return cchWritten;
}

CHAR* ConvertToMBCS ( LPCWSTR pwsz )

Definition at line 240 of file common.cpp.

{
  HRESULT hr = S_OK;

  //no-op case
  if(!pwsz)
    return NULL;

  //Determine the space required for the conversion
  INT iLen = ConvertToMBCS(pwsz, -1, NULL, 0);

  //Allocate space for the string
  CHAR* pszBuffer = NULL;
  SAFE_ALLOC(pszBuffer, CHAR, iLen+1);

  //Now convert the string
  ConvertToMBCS(pwsz, pszBuffer, iLen+1);

CLEANUP:
  return pszBuffer;
}

INT ConvertToWCHAR | ( | LPCSTR | psz,
 |  | INT | cchSrc,
 |  | WCHAR * | pwsz,
 |  | INT | ccbDst
 | ) |  |

Definition at line 279 of file common.cpp.

{
  //NOTE: The user can call this function with the Destination as NULL to indicate
  //just provide the length of the required conversion

  //No source
  if(!psz && pwsz)
  {
    //Conveience for the caller:
    //always make sure the result is null-terminated - if their is enough room
    if(cchDst >= 1)
    {
      pwsz[0] = wEOL;
      return 1;
    }
    return 0;
  }

  //NOTE: WideCharToMultiByte destination buffer is really in (cb) count of bytes,
  //but to make things simplier since MultiByteToWideChar is opposite for the output
  //buffer, we will operate everything in cch - this is not a perf hit either since we don't
  //need a conversion since for CHAR -> cch == cb
  ASSERT(1/*cch*/ == sizeof(CHAR)/*cb*/);

  //Convert the string to MBCS
  INT cchWritten = MultiByteToWideChar(CP_ACP, 0, psz, cchSrc/*cb*/, pwsz, cchDst/*cch*/);

  //Since the buffer we passed in may be smaller than the actual data returned
  //we may not actually get to copy the NULL termintor, so make sure there is one at least
  //at the end of the buffer...
  if(cchDst && (cchDst < cchSrc))
  {
    cchWritten = cchDst;
    pwsz[cchWritten-1] = L'\0';
  }

  return cchWritten;
}

INT ConvertToWCHAR | ( | LPCSTR | psz,
 |  | WCHAR * | pwsz,
 |  | INT | cbDst
 | ) |  |

Definition at line 267 of file common.cpp.

{
  //Delegate
  return ConvertToWCHAR(psz, -1, pwsz, cchDst);
}

WCHAR* ConvertToWCHAR ( LPCSTR psz )

Definition at line 323 of file common.cpp.

{
  HRESULT hr = S_OK;

  //no-op case
  if(!psz)
    return NULL;

  //Determine the space required for the conversion
  INT iLen = ConvertToWCHAR(psz, -1, NULL, 0);

  //Allocate space for the string
  WCHAR* pwszBuffer = NULL;
  SAFE_ALLOC(pwszBuffer, WCHAR, iLen+1);

  //Now convert the string
  ConvertToWCHAR(psz, pwszBuffer, iLen+1);

CLEANUP:
  return pwszBuffer;
}

HRESULT CopyBinding | ( | DBBINDING * | pDest,
 |  | DBBINDING * | pSource
 | ) |  |

Definition at line 2337 of file common.cpp.

{
  ASSERT(pDest);
  ASSERT(pSource);
  HRESULT hr = S_OK;

  //First just memcopy the inline info
  memcpy(pDest, pSource, sizeof(DBBINDING));

  //Now we need to allocate any out-of-line info
  if(pSource->pObject)
  {
    SAFE_ALLOC(pDest->pObject, DBOBJECT, 1);
    memcpy(pDest->pObject, pSource->pObject, sizeof(DBOBJECT));
  }

CLEANUP:
  return hr;
}

HRESULT CreateDefFileName | ( | LPCWSTR | pwszFileName,
 |  | WCHAR * | pwszFullPath,
 |  | ULONG | ulMaxSize,
 |  | BOOL | fCurrentDir = TRUE
 | ) |  |

Definition at line 3366 of file common.cpp.

{
  if(pwszFileName == NULL || pwszFullPath == NULL || ulMaxSize == 0)
    return E_INVALIDARG;

  //Obtain the current Directory
  DWORD ulStrLen = 0;
  if(fCurrentDir)
  {
    if(IsUnicodeOS())
    {
      ulStrLen = GetCurrentDirectoryW(ulMaxSize, pwszFullPath);
    }
    else
    {
      CHAR szBuffer[MAX_PATH+1];
      ulStrLen = GetCurrentDirectoryA(MAX_PATH, szBuffer);
      ConvertToWCHAR(szBuffer, pwszFullPath, ulMaxSize);
    }
  }
  else
  {
    if(IsUnicodeOS())
    {
      ulStrLen = GetSystemDirectoryW(pwszFullPath, ulMaxSize);
    }
    else
    {
      CHAR szBuffer[MAX_PATH+1];
      ulStrLen = GetSystemDirectoryA(szBuffer, MAX_PATH);
      ConvertToWCHAR(szBuffer, pwszFullPath, ulMaxSize);
    }
  }

  if(ulStrLen)
  {
    //We can't just strcat a "\filename" since depending upon the current
    //directory sometimes it returns "c:\" or "c:\oledb", etc...
    if(pwszFullPath[ulStrLen-1] != L'\\')
      wcscat(pwszFullPath, L"\\");

    //Now tack on the suggested filename...
    wcscat(pwszFullPath, pwszFileName);
    return S_OK;
  }

  return E_FAIL;
}

HRESULT CreateRegKey | ( | HKEY | hRootKey,
 |  | WCHAR * | pwszKeyName,
 |  | HKEY * | phKey,
 |  | REGSAM | samDesired = KEY_READ|KEY_WRITE
 | ) |  |

Definition at line 3511 of file common.cpp.

{
  HRESULT hr = E_FAIL;
  ULONG dwDisposition = 0;

  //Need the name of the key to open
  if(!pwszKeyName)
    return E_FAIL;

  if(IsUnicodeOS())
  {
    hr = RegCreateKeyExW(hRootKey, pwszKeyName, 0, NULL, REG_OPTION_NON_VOLATILE, samDesired, NULL, phKey, &dwDisposition);
  }
  else
  {
    CHAR szBuffer[MAX_NAME_LEN];
    ConvertToMBCS(pwszKeyName, szBuffer, MAX_NAME_LEN);

    hr = RegCreateKeyExA(hRootKey, szBuffer, 0, NULL, REG_OPTION_NON_VOLATILE, samDesired, NULL, phKey, &dwDisposition);
  }

  if(hr != S_OK)
    hr = E_FAIL;
  return hr;
}

HRESULT DataConvert | ( | DBSTATUS | dbSrcStatus,
 |  | DBLENGTH | cbSrcLength,
 |  | DBLENGTH | cbSrcMaxLength,
 |  | DBTYPE | wSrcType,
 |  | void * | pSrcValue,
 |  | BYTE | bPrecision,
 |  | BYTE | bScale,
 |  | DBTYPE | wDstType,
 |  | DBSTATUS * | pdbDstStatus,
 |  | DBLENGTH * | pcbDstLength,
 |  | void * | pDstValue,
 |  | DBLENGTH | cbDstMaxLength,
 |  | DWORD | dwConvFlags
 | ) |  |

Definition at line 381 of file common.cpp.

{
  HRESULT hr = S_OK;
  if(pdbDstStatus)
    *pdbDstStatus = DBSTATUS_S_OK;
  if(pcbDstLength)
    *pcbDstLength = 0;

  //NOTE: cbSrcLength passed in is the actual length of the data (untruncated).
  //cbSrcMaxLength is the maximum size of the source (read) buffer thats valid.  This is useful to
  //seperate into two seperate items, since for String data this doesn't include the null terminator
  //and for fixed length it is the maximum.  But all data source is bound by cbSrcMaxLength...
  cbSrcLength = (wSrcType & DBTYPE_BYREF) ? cbSrcLength : min(cbSrcLength, cbSrcMaxLength);

  //STATUS...
  switch(dbSrcStatus)
  {
    case DBSTATUS_S_ISNULL:
    case DBSTATUS_S_DEFAULT:
    case DBSTATUS_S_IGNORE:
      hr = S_OK;
      goto CLEANUP;

    case DBSTATUS_S_TRUNCATED:
      hr = S_OK;
      break;

    case DBSTATUS_S_OK:
      hr = S_OK;
      break;

    default:
      hr = DB_E_CANTCONVERTVALUE;
      goto CLEANUP;
  };

  //LENGTH...

  //VALUE...
  if(!pSrcValue || !pDstValue)
    goto CLEANUP;

  //Can we convert this "locally" without bringing in DC?
  if(!(dwConvFlags & CONV_MSDADC_ONLY))
  {
    switch(DBTYPE_SRC_DST(wSrcType, wDstType))
    {
      case DBTYPE_SRC_DST(DBTYPE_WSTR, DBTYPE_WSTR):
      {
        //cbSrcLength - doesn't account for Null terminator
        DBLENGTH cbSrcLengthPlusTerm  = min(cbSrcLength + sizeof(WCHAR), cbSrcMaxLength);

        //VALUE
        //NOTE: We don't use wcscpy since user data could have embedded NULLs
        memcpy(pDstValue, pSrcValue, (size_t)(min(cbSrcLengthPlusTerm, cbDstMaxLength)));

        //Since the buffer we passed in may be smaller than the actual data returned
        //we may not actually get to copy the NULL termintor, so make sure there is one at least
        //at the end of the buffer...
        if(cbDstMaxLength && (cbDstMaxLength < cbSrcLengthPlusTerm))
          ((WCHAR*)pDstValue)[cbDstMaxLength/sizeof(WCHAR)-1] = L'\0';

        //LENGTH
        //NOTE: This doesn't include the NULL terminator
        if(pcbDstLength)
          *pcbDstLength = min(cbSrcLength, cbDstMaxLength);
        break;
      }

      case DBTYPE_SRC_DST(DBTYPE_STR, DBTYPE_WSTR):
      {
        //cbSrcLength - doesn't account for Null terminator
        DBLENGTH cbSrcLengthPlusTerm  = min(cbSrcLength + sizeof(CHAR), cbSrcMaxLength);

        //VALUE
        INT chWritten = ConvertToWCHAR((CHAR*)pSrcValue, (INT)cbSrcLengthPlusTerm/sizeof(CHAR), (WCHAR*)pDstValue, (INT)cbDstMaxLength/sizeof(WCHAR));

        //NOTE: LENGTH doesn't include the NULL terminator
        if(pcbDstLength && chWritten)
          *pcbDstLength = (chWritten * sizeof(WCHAR)) - sizeof(WCHAR);
        break;
      }

      case DBTYPE_SRC_DST(DBTYPE_WSTR, DBTYPE_STR):
      {
        //cbSrcLength - doesn't account for Null terminator
        DBLENGTH cbSrcLengthPlusTerm  = min(cbSrcLength + sizeof(WCHAR), cbSrcMaxLength);

        //VALUE
        INT chWritten = ConvertToMBCS((WCHAR*)pSrcValue, (INT)cbSrcLengthPlusTerm/sizeof(WCHAR), (CHAR*)pDstValue, (INT)cbDstMaxLength/sizeof(CHAR));

        //NOTE: LENGTH doesn't include the NULL terminator
        if(pcbDstLength && chWritten)
          *pcbDstLength   = (chWritten * sizeof(CHAR)) - sizeof(CHAR);
        break;
      }

      case DBTYPE_SRC_DST(DBTYPE_VARIANT, DBTYPE_WSTR):
      {
        hr = VariantToString((VARIANT*)pSrcValue, (WCHAR*)pDstValue, cbDstMaxLength/sizeof(WCHAR), dwConvFlags);

        //LENGTH
        //NOTE: This doesn't include the NULL terminator
        if(pcbDstLength)
          *pcbDstLength   = wcslen((WCHAR*)pDstValue)*sizeof(WCHAR);
        break;
      }

      case DBTYPE_SRC_DST(DBTYPE_WSTR, DBTYPE_VARIANT):
      {
        VARIANT vVariant;
        V_VT(&vVariant) = VT_BSTR;
        V_BSTR(&vVariant) = SysAllocString((WCHAR*)pSrcValue);
        memcpy(pDstValue, &vVariant, sizeof(VARIANT));

        //LENGTH
        if(pcbDstLength)
          *pcbDstLength   = sizeof(VARIANT);
        break;
      }

      case DBTYPE_SRC_DST(DBTYPE_HCHAPTER, DBTYPE_WSTR):
      {
        //TODO
        IUnknown* pIUnknown = *(IUnknown**)pSrcValue;
        StringFormat((WCHAR*)pDstValue, cbDstMaxLength/sizeof(WCHAR), L"0x%p", pIUnknown);

        //LENGTH
        //NOTE: This doesn't include the NULL terminator
        if(pcbDstLength)
          *pcbDstLength   = wcslen((WCHAR*)pDstValue)*sizeof(WCHAR);
        break;
      }

      case DBTYPE_SRC_DST(DBTYPE_WSTR, DBTYPE_HCHAPTER):
      {
        //TODO - I have no clue how to update a hChapter columns?
        //But since we allow binding in the Accessor as native HCHAPTER we
        //need to support the SetData case, otherwise it will assert...

        //LENGTH
        if(pcbDstLength)
          *pcbDstLength   = sizeof(HCHAPTER);
        break;
      }

      default:
      {
        if(wSrcType & DBTYPE_VECTOR && wDstType == DBTYPE_WSTR)
        {
          hr = VectorToString((DBVECTOR*)pSrcValue, wSrcType, (WCHAR*)pDstValue, cbDstMaxLength/sizeof(WCHAR));

          //LENGTH
          if(pcbDstLength)
            *pcbDstLength   = wcslen((WCHAR*)pDstValue)*sizeof(WCHAR);
          break;
        }
        else if(wDstType & DBTYPE_VECTOR && wSrcType == DBTYPE_WSTR)
        {
          hr = StringToVector((WCHAR*)pSrcValue, wDstType, (DBVECTOR*)pDstValue);

          //LENGTH
          if(pcbDstLength)
            *pcbDstLength   = sizeof(DBVECTOR);
          break;
        }
        else if(wSrcType & DBTYPE_ARRAY && wDstType == DBTYPE_WSTR)
        {
          hr = SafeArrayToString(*(SAFEARRAY**)pSrcValue, wSrcType, (WCHAR*)pDstValue, cbDstMaxLength/sizeof(WCHAR));

          //LENGTH
          if(pcbDstLength)
            *pcbDstLength   = wcslen((WCHAR*)pDstValue)*sizeof(WCHAR);
          break;
        }
        else if(wDstType & DBTYPE_ARRAY && wSrcType == DBTYPE_WSTR)
        {
          hr = StringToSafeArray((WCHAR*)pSrcValue, wDstType, (SAFEARRAY**)pDstValue);

          //LENGTH
          if(pcbDstLength)
            *pcbDstLength   = sizeof(DBVECTOR);
          break;
        }
        else
        {
          //Unhandled Conversion?
          hr = DB_E_CANTCONVERTVALUE;
        }
      }
    };
  }

  //Otherwise use the DataConversion Library...
  //Either we didn't support the conversion, or the user explcitly requested DC
  if((dwConvFlags & CONV_MSDADC_ONLY) || FAILED(hr))
  {
    //Obtain DataConversion library
    if(!g_spDataConvert)
      TESTC(hr = g_spDataConvert.CoCreateInstance(CLSID_OLEDB_CONVERSIONLIBRARY));

    //Unable to obtain DC or not allowed to use it...
    if(!g_spDataConvert)
      TESTC(hr = DB_E_CANTCONVERTVALUE);

    //We need to convert from the consumers type to ours...
    hr = g_spDataConvert->DataConvert(
        wSrcType,             // wSrcType
        wDstType,             // wDstType
        cbSrcLength,            // cbSrcLength
        pcbDstLength,           // pcbDstLength
        pSrcValue,              // pSrc
        pDstValue,              // pDst
        cbDstMaxLength,           // cbDstMaxLength
        dbSrcStatus,            // dbsSrcStatus
        pdbDstStatus,           // pdbsStatus
        bPrecision,             // bPrecision
        bScale,               // bScale
        0L );               // dwFlags
  }

CLEANUP:
  return hr;
}

HRESULT DBIDCopy | ( | DBID * | pDst,
 |  | const DBID * | pSrc
 | ) |  |

Definition at line 1833 of file common.cpp.

{
  ASSERT(pDst && pSrc);
  HRESULT hr = S_OK;

  //Simple case, no out-of-line data...
  memcpy(pDst, pSrc, sizeof(DBID));

  //Now copy any outofline data...
  switch(pDst->eKind)
  {
    case DBKIND_PGUID_PROPID:
      pDst->uGuid.pguid = NULL;
      if(pSrc->uGuid.pguid)
      {
        SAFE_ALLOC(pDst->uGuid.pguid, GUID, 1);
        memcpy(pDst->uGuid.pguid, pSrc->uGuid.pguid, sizeof(GUID));
      }
      break;

    case DBKIND_PGUID_NAME:
      pDst->uGuid.pguid = NULL;
      if(pSrc->uGuid.pguid)
      {
        SAFE_ALLOC(pDst->uGuid.pguid, GUID, 1);
        memcpy(pDst->uGuid.pguid, pSrc->uGuid.pguid, sizeof(GUID));
      }
      pDst->uName.pwszName = wcsDuplicate(pDst->uName.pwszName);
      break;

    case DBKIND_GUID_NAME:
    case DBKIND_NAME:
      pDst->uName.pwszName = wcsDuplicate(pDst->uName.pwszName);
      break;
  };

CLEANUP:
  return hr;
}

BOOL DBIDEqual | ( | const DBID * | pDst,
 |  | const DBID * | pSrc
 | ) |  |

Definition at line 1879 of file common.cpp.

{
  ASSERT(pDst && pSrc);
  BOOL bEqual = FALSE;

  if(pDst->eKind == pSrc->eKind)
  {
    //Now compare sub-parts...
    switch(pDst->eKind)
    {
      case DBKIND_PGUID_NAME:
        if(bEqual = pDst->uGuid.pguid && pSrc->uGuid.pguid ? memcmp(pDst->uGuid.pguid, pSrc->uGuid.pguid, sizeof(GUID))==0 : pDst->uGuid.pguid == pSrc->uGuid.pguid)
          bEqual = StringCompare(pDst->uName.pwszName, pSrc->uName.pwszName);
        break;

      case DBKIND_PGUID_PROPID:
        if(bEqual = pDst->uGuid.pguid && pSrc->uGuid.pguid ? memcmp(pDst->uGuid.pguid, pSrc->uGuid.pguid, sizeof(GUID))==0 : pDst->uGuid.pguid == pSrc->uGuid.pguid)
          bEqual = (pDst->uName.ulPropid == pSrc->uName.ulPropid);
        break;

      case DBKIND_PROPID:
        bEqual = (pDst->uName.ulPropid == pSrc->uName.ulPropid);
        break;

      case DBKIND_GUID_PROPID:
        bEqual = (pDst->uName.ulPropid == pSrc->uName.ulPropid);
        break;

      case DBKIND_GUID:
        bEqual = memcmp(&pDst->uGuid.guid, &pSrc->uGuid.guid, sizeof(GUID))==0;
        break;

      case DBKIND_GUID_NAME:
        if(bEqual = memcmp(&pDst->uGuid.guid, &pSrc->uGuid.guid, sizeof(GUID))==0)
          bEqual = StringCompare(pDst->uName.pwszName, pSrc->uName.pwszName);
        break;

      case DBKIND_NAME:
        bEqual = StringCompare(pDst->uName.pwszName, pSrc->uName.pwszName);
        break;

      default:
        break;
    };

  }

  //Otherwise
  return bEqual;
}

void DBIDFree ( DBID * pDBID )

Definition at line 1805 of file common.cpp.

{
  if(pDBID)
  {
    switch(pDBID->eKind)
    {
      case DBKIND_PGUID_NAME:
        SAFE_FREE(pDBID->uGuid.pguid);
        SAFE_FREE(pDBID->uName.pwszName);
        break;

      case DBKIND_GUID_NAME:
      case DBKIND_NAME:
        SAFE_FREE(pDBID->uName.pwszName);
        break;

      case DBKIND_PGUID_PROPID:
        SAFE_FREE(pDBID->uGuid.pguid);
        break;
    };
  }
}

HRESULT DBIDToString | ( | const DBID * | pDBID,
 |  | WCHAR * | pwsz,
 |  | ULONG | ulMaxLen
 | ) |  |

Definition at line 1725 of file common.cpp.

{
  //No-op
  if(!ulMaxLen)
    return S_OK;

  ASSERT(pwsz);
  WCHAR wszBuffer[MAX_NAME_LEN] = {0};
  pwsz[0] = wEOL;

  //No-op
  if(pDBID == NULL)
  {
    StringCopy(pwsz, L"NULL", MAX_NAME_LEN);
    return S_OK;
  }

  //ColumnID (SubItem)  DBID
  switch(pDBID->eKind)
  {
    case DBKIND_NAME:
      StringFormat(pwsz, ulMaxLen, L"{\"%s\"}", pDBID->uName.pwszName);
      break;

    case DBKIND_PROPID:
      StringFormat(pwsz, ulMaxLen, L"{%ld}", pDBID->uName.ulPropid);
      break;

    case DBKIND_GUID:
      StringFromGUID2(pDBID->uGuid.guid, pwsz, ulMaxLen);
      break;

    case DBKIND_GUID_NAME:
      StringFromGUID2(pDBID->uGuid.guid, wszBuffer, MAX_NAME_LEN);
      StringFormat(pwsz, ulMaxLen, L"{%s,\"%s\"}", wszBuffer, pDBID->uName.pwszName);
      break;

    case DBKIND_GUID_PROPID:
    {
      //Special Case:  Maybe this is a defined RowCol DBID
      WCHAR* pwszColName = GetRowColName(pDBID);
      if(pwszColName)
      {
        StringCopy(pwsz, pwszColName, ulMaxLen);
      }
      else
      {
        StringFromGUID2(pDBID->uGuid.guid, wszBuffer, MAX_NAME_LEN);
        StringFormat(pwsz, ulMaxLen, L"{%s,%ld}", wszBuffer, pDBID->uName.ulPropid);
      }
      break;
    }

    case DBKIND_PGUID_NAME:
      if(pDBID->uGuid.pguid)
        StringFromGUID2(*pDBID->uGuid.pguid, wszBuffer, MAX_NAME_LEN);
      StringFormat(pwsz, ulMaxLen, L"{&%s,\"%s\"}", wszBuffer, pDBID->uName.pwszName);
      break;

    case DBKIND_PGUID_PROPID:
      if(pDBID->uGuid.pguid)
        StringFromGUID2(*pDBID->uGuid.pguid, wszBuffer, MAX_NAME_LEN);
      StringFormat(pwsz, ulMaxLen, L"{&%s,%ld}", wszBuffer, pDBID->uName.ulPropid);
      break;

    default:
      ASSERT(!"Unhandled Type!");
      break;
  };

  //Make sure the resulting string is NULL terminated
  pwsz[ulMaxLen ? ulMaxLen-1 : 0] = wEOL;
  return S_OK;
}

HRESULT DelRegEntry | ( | HKEY | hRootKey,
 |  | WCHAR * | pwszKeyName
 | ) |  |

Definition at line 3898 of file common.cpp.

{
  HRESULT hr;

  //DelRegEntry
  if(IsUnicodeOS())
  {
    hr = RegDeleteKeyW(hRootKey, pwszKeyName);
  }
  else
  {
    CHAR szBuffer[MAX_NAME_LEN];
    ConvertToMBCS(pwszKeyName, szBuffer, MAX_NAME_LEN);
    hr = RegDeleteKeyA(hRootKey, szBuffer);
  }

  //Entry successfully deleted - return S_OK
  if(hr==S_OK)
    return S_OK;

  //Entry not found - return S_FALSE
  if(hr==ERROR_FILE_NOT_FOUND)
    return S_FALSE;

  return E_FAIL;
}

HRESULT DelRegEntry | ( | HKEY | hRootKey,
 |  | WCHAR * | pwszKeyName,
 |  | BOOL | fSubKeys
 | ) |  |

Definition at line 3930 of file common.cpp.

{
  HKEY hKey = NULL;
  WCHAR wszBuffer[MAX_NAME_LEN];
  HRESULT hr = S_OK;

  //RegDeleteKey only deletes the key if there are no subkeys
  if(SUCCEEDED(hr = OpenRegKey(hRootKey, pwszKeyName, 0, KEY_READ | KEY_WRITE, &hKey)))
  {
    //This is a pain to always have to delete the subkeys to remove the key...
    if(fSubKeys)
    {
      //Loop over all subkeys...
      //NOTE: GetRegEnum requires KEY_ENUMERATE_SUB_KEYS which is found in KEY_READ.
      while((hr = GetRegEnumKey(hKey, NULL, 0, wszBuffer, MAX_NAME_LEN))==S_OK)
      {
        //Recurse and delete the sub key...
        if(FAILED(hr = DelRegEntry(hKey, wszBuffer, fSubKeys)))
          break;
      }
    }

    //Now we can delete the root key
    hr = DelRegEntry(hRootKey, pwszKeyName);
    CloseRegKey(hKey);
  }

  return hr;
}

HRESULT FreeBindingData | ( | DBCOUNTITEM | cBindings,
 |  | const DBBINDING * | rgBindings,
 |  | void * | pData,
 |  | BOOL | fSetData = FALSE
 | ) |  |

Definition at line 2285 of file common.cpp.

{
  //Need to walk the array and free any other alloc memory
  for(ULONG i=0; i<cBindings; i++)
  {
    //First make sure we have valid data...
    if(!VALUE_IS_BOUND(rgBindings[i]) || !STATUS_IS_BOUND(rgBindings[i]))
      continue;

    //Free any "out-of-line" memory
    DBSTATUS dbStatus = BINDING_STATUS(rgBindings[i], pData);
    switch(dbStatus)
    {
      case DBSTATUS_S_OK:
      case DBSTATUS_S_TRUNCATED:
      case DBSTATUS_S_ALREADYEXISTS:
        //Always free in successful status (either Getting or Setting).
        if(rgBindings[i].dwMemOwner == DBMEMOWNER_CLIENTOWNED)
          FreeData(rgBindings[i].wType, 1, &BINDING_VALUE(rgBindings[i], pData));
        break;

      case DBSTATUS_S_ISNULL:
      case DBSTATUS_S_DEFAULT:
      case DBSTATUS_S_IGNORE:
        //Nothing to do in either case Getting or Setting.
        //In Getting data in undefined, in Setting the value was never setup...
        break;

      default:
        //Otherwise data is undefined for retrieval from the provider (GetData, GetColumns, etc)
        //But for Setting (SetData, InsertRow, SetColumns, etc), we created the data
        //which has to be free'd even if the provider failed.

        //NOTE: For IUnknown columns the provider releases on Setting, but instead of
        //having special logic all over, we AddRef the Stream an extra time before
        //setting, so it can always be released like the rest of the data and doesn't
        //have to be special cased...

//        if(fSetData && rgBindings[i].dwMemOwner == DBMEMOWNER_CLIENTOWNED)
//          FreeData(rgBindings[i].wType, 1, &BINDING_VALUE(rgBindings[i], pData));
        break;
    }
  }

  return S_OK;
}

HRESULT FreeBindings | ( | DBCOUNTITEM * | pcBindings,
 |  | DBBINDING ** | prgBindings
 | ) |  |

Definition at line 2362 of file common.cpp.

{
  ASSERT(pcBindings);
  ASSERT(prgBindings);

  //Need to walk the array and free any other alloc memory
  for(ULONG i=0; i<*pcBindings; i++)
  {
    //Free any pObjects
    if(*prgBindings)
      SAFE_FREE((*prgBindings)[i].pObject);
  }

  //Now we can free the outer struct
  *pcBindings = 0;
  SAFE_FREE(*prgBindings);
  return S_OK;
}

HRESULT FreeColAccess | ( | ULONG * | pcColAccess,
 |  | DBCOLUMNACCESS ** | prgColAccess,
 |  | void ** | ppData
 | ) |  |

Definition at line 2386 of file common.cpp.

{
  ASSERT(pcColAccess);
  ASSERT(prgColAccess);

  //Now we can free the outer struct
  *pcColAccess = 0;
  SAFE_FREE(*prgColAccess);
  SAFE_FREE(*ppData);
  return S_OK;
}

HRESULT FreeConstraintDesc | ( | DBORDINAL * | pcConsDesc,
 |  | DBCONSTRAINTDESC ** | prgConsDesc,
 |  | BOOL | fFree = TRUE
 | ) |  |

Definition at line 2404 of file common.cpp.

{
  DBORDINAL     indexCol;
  DBCONSTRAINTDESC  *rgConsDesc;

  ASSERT(pcConsDesc);
  ASSERT(prgConsDesc);

  rgConsDesc = *prgConsDesc;
  for(DBORDINAL index = 0; index<*pcConsDesc; index++)
  {
    // release the current element
    DBIDFree(rgConsDesc[index].pConstraintID);
    SAFE_FREE(rgConsDesc[index].pConstraintID);

    DBIDFree(rgConsDesc[index].pReferencedTableID);
    SAFE_FREE(rgConsDesc[index].pReferencedTableID);

    SAFE_FREE(rgConsDesc[index].pwszConstraintText);

    for (indexCol = 0; indexCol < rgConsDesc[index].cColumns; indexCol++)
      DBIDFree(&rgConsDesc[index].rgColumnList[indexCol]);

    SAFE_FREE(rgConsDesc[index].rgColumnList);

    for (indexCol = 0; indexCol < rgConsDesc[index].cForeignKeyColumns; indexCol++)
      DBIDFree(&rgConsDesc[index].rgForeignKeyColumnList[indexCol]);

    SAFE_FREE(rgConsDesc[index].rgForeignKeyColumnList);
  }

  //Now we can free the outer struct
  *pcConsDesc = 0;
  if(fFree)
    SAFE_FREE(*prgConsDesc);
  return S_OK;
}

HRESULT FreeData | ( | DBTYPE | wType,
 |  | DBLENGTH | cData,
 |  | void * | rgData
 | ) |  |

Definition at line 2196 of file common.cpp.

{
  //no-op
  if(!rgData)
    return S_OK;

  //Loop over all elements of the array
  for(ULONG i=0; i<cData; i++)
  {
    //Free any "out-of-line" memory
    switch(wType)
    {
      case DBTYPE_BSTR:
      {
        BSTR* pbstr = &((BSTR*)rgData)[i];
        SAFE_BSTRFREE(*pbstr);
        break;
      }

      case DBTYPE_VARIANT:
      {
        VARIANT* pVariant = &((VARIANT*)rgData)[i];
        VariantClearFast(pVariant);
        break;
      }

      case DBTYPE_IDISPATCH:
      case DBTYPE_IUNKNOWN:
      {
        IUnknown* pIUnknown = ((IUnknown**)rgData)[i];
        SAFE_RELEASE(pIUnknown);
        break;
      }

      case DBTYPE_VARNUMERIC:
      case DBTYPE_PROPVARIANT:
        //TODO:
        break;

      default:
      {
        //NOTE: All the modifiers are mutually exclusive.

        //DBTYPE_BYREF
        if(wType & DBTYPE_BYREF)
        {
          void* pByRef  = ((void**)rgData)[i];

          //Free any outofline sub elements, (recursive)
          FreeData(wType & ~DBTYPE_BYREF, 1, pByRef);

          //Free the allocated block
          SAFE_FREE(pByRef);
        }

        //DBTYPE_VECTOR
        else if(wType & DBTYPE_VECTOR)
        {
          DBVECTOR* pVector = &((DBVECTOR*)rgData)[i];

          //Free any outofline sub elements, (recursive)
          FreeData(wType & ~DBTYPE_VECTOR, pVector->size, pVector->ptr);

          //Free the block of memory
          SAFE_FREE(pVector->ptr);
        }

        //DBTYPE_ARRAY
        else if(wType & DBTYPE_ARRAY)
        {
          SAFEARRAY** ppSafeArray = &((SAFEARRAY**)rgData)[i];
          if(*ppSafeArray)
            SafeArrayDestroy(*ppSafeArray);
          *ppSafeArray = NULL;
        }

        break;
      }
    };
  }

  return S_OK;
}

RECT GetClientCoords | ( | HWND | hWndParent,
 |  | HWND | hWnd
 | ) |  |

Definition at line 2919 of file common.cpp.

{
  //Need the Boundary Rectangle in Client Coordinates, with
  //respect to the parent window...
  RECT rect, rectClientCoords;
  GetWindowRect(hWnd, &rect);

  POINT ptTopLeft = { rect.left, rect.top };
  ScreenToClient(hWndParent, &ptTopLeft);
  POINT ptBottomRight = { rect.right, rect.bottom };
  ScreenToClient(hWndParent, &ptBottomRight);

  rectClientCoords.top    = ptTopLeft.y;
  rectClientCoords.left   = ptTopLeft.x;
  rectClientCoords.bottom   = ptBottomRight.y;
  rectClientCoords.right    = ptBottomRight.x;
  return rectClientCoords;
}

SIZE GetClientSize ( HWND hWnd )

Definition at line 2899 of file common.cpp.

{
  RECT rect = { 0,0,0,0 };
  SIZE size = { 0,0 };

  //Obtain window cordinates.
  if(GetClientRect(hWnd, &rect))
  {
    //Fillin SIZE struct
    size.cx = rect.right - rect.left;
    size.cy = rect.bottom - rect.top;
  }
  return size;
}

WCHAR* GetColName ( const DBCOLUMNINFO * pColInfo )

Definition at line 2452 of file common.cpp.

{
  static WCHAR* pwszNullName = L"<NULL>";
  static WCHAR* pwszEmptyName = L"<Empty>";
  static WCHAR* pwszBookmarkName = L"<Bookmark>";

  //Providers are not required to return a Column Name for any column
  //Useful information, but some columns (ie: Bookmarks) and others
  //May not have a column name.  So this method will either just return
  //whatever the provider returned or will generate an appropiate one if not...
  //We really need a column name to help for the GUI headers

  if(pColInfo == NULL)
    return NULL;

  WCHAR* pwszColName = pColInfo->pwszName;
  if(pColInfo->iOrdinal == 0)
  {
    //Bookmark
    if(!pwszColName || !pwszColName[0])
      pwszColName = pwszBookmarkName;
  }
  else
  {
    //otherwise
    if(!pwszColName || !pwszColName[0])
    {
      //If this is a DBID defined column
      if(pColInfo->columnid.eKind == DBKIND_GUID_PROPID)
        pwszColName = GetRowColName(&pColInfo->columnid);
    }
  }

  //Handle Boundaries
  if(!pwszColName)
    pwszColName = pwszNullName;
  else if(!pwszColName[0])
    pwszColName = pwszEmptyName;

  ASSERT(pwszColName);
  return pwszColName;
}

DBTYPE GetDBType ( WCHAR * pwszName )

Definition at line 2165 of file common.cpp.

{
  return (DBTYPE)GetMapName(pwsz, g_cDBTypes, g_rgDBTypes);
}

HRESULT GetDBTypeMaxSize | ( | DBTYPE | wType,
 |  | DBLENGTH * | pulMaxSize = NULL,
 |  | BYTE * | pbPrecision = NULL,
 |  | BYTE * | pbScale = NULL
 | ) |  |

Definition at line 1992 of file common.cpp.

{
  HRESULT   hr = S_OK;

  //On failure we will set the column size to the max, so callers
  //don't have to condition this for normal unknown types...
  DBLENGTH  ulMaxSize = MAX_COL_SIZE;
  BYTE    bPrecision  = 0;
  BYTE    bScale    = 0;

  //Values taken from OLE DB Spec, Appendix A
  //In some situations we need to know ulMaxSize, Prec, Scale, as defaults or creating
  //an accessor before we actually have ColumnsInfo.  Useful info, but mainly used
  //only for defaults for dialogs...

  switch(wType)
  {
    case DBTYPE_EMPTY:
    case DBTYPE_NULL:
      ulMaxSize = 0;
      break;

    case DBTYPE_STR:
    case DBTYPE_WSTR:
    case DBTYPE_BYTES:
    case DBTYPE_VARNUMERIC:
      ulMaxSize = MAX_COL_SIZE;
      break;

    case DBTYPE_BSTR:
      ulMaxSize = sizeof(BSTR);
      break;

    case DBTYPE_I1:
    case DBTYPE_UI1:
      ulMaxSize = 1;
      bPrecision = 3;
      break;

    case DBTYPE_I2:
    case DBTYPE_UI2:
      ulMaxSize = 2;
      bPrecision = 5;
      break;

    case DBTYPE_I4:
    case DBTYPE_UI4:
      ulMaxSize = 4;
      bPrecision = 10;
      break;

    case DBTYPE_I8:
      ulMaxSize = 8;
      bPrecision = 19;
      break;

    case DBTYPE_UI8:
      ulMaxSize = 8;
      bPrecision = 20;
      break;

    case DBTYPE_R4:
      ulMaxSize = sizeof(float);
      bPrecision = 7;
      break;

    case DBTYPE_R8:
      ulMaxSize = sizeof(double);
      bPrecision = 16;
      break;

    case DBTYPE_CY:
      ulMaxSize = 8;
      bPrecision = 19;
      break;

    case DBTYPE_NUMERIC:
      ulMaxSize = sizeof(DB_NUMERIC);
      bPrecision = 38;
      break;

    case DBTYPE_DATE:
      ulMaxSize = sizeof(double);
      break;

    case DBTYPE_BOOL:
      ulMaxSize = 2;
      break;

    case DBTYPE_VARIANT:
      ulMaxSize = sizeof(VARIANT);
      break;

    case DBTYPE_IDISPATCH:
    case DBTYPE_IUNKNOWN:
      ulMaxSize = sizeof(IUnknown*);
      break;

    case DBTYPE_GUID:
      ulMaxSize = sizeof(GUID);
      break;

    case DBTYPE_ERROR:
      ulMaxSize = sizeof(SCODE);
      break;

    case DBTYPE_DBDATE:
      ulMaxSize = sizeof(DBDATE);
      break;

    case DBTYPE_DBTIME:
      ulMaxSize = sizeof(DBTIME);
      break;

    case DBTYPE_DBTIMESTAMP:
      ulMaxSize = sizeof(DBTIMESTAMP);
      break;

    case DBTYPE_DECIMAL:
      ulMaxSize = sizeof(DECIMAL);
      bPrecision = 28;
      break;

    default:
      //DBTYPE_BYREF
      if(wType & DBTYPE_BYREF)
      {
        ulMaxSize = sizeof(void*);
      }
      //DBTYPE_ARRAY
      else if(wType & DBTYPE_ARRAY)
      {
        ulMaxSize = sizeof(SAFEARRAY*);
      }
      //DBTYPE_VECTOR
      else if(wType & DBTYPE_VECTOR)
      {
        ulMaxSize = sizeof(DBVECTOR*);
      }
      else
      {
        //On failure we will set the column size to the max (already done above), so callers
        //don't have to condition this for normal unknown types...
        hr = E_FAIL;
      }
      break;
  };

  if(pulMaxSize)
    *pulMaxSize = ulMaxSize;
  if(pbPrecision)
    *pbPrecision = bPrecision;
  if(pbScale)
    *pbScale = bScale;
  return hr;
}

WCHAR* GetDBTypeName ( DBTYPE wType )

Definition at line 2155 of file common.cpp.

{
  return GetBitMapName(wType, g_cDBTypes, g_rgDBTypes, DBTYPE_VECTOR | DBTYPE_ARRAY | DBTYPE_BYREF | DBTYPE_RESERVED/*dwBitStart*/);
}

BOOL GetEditBoxValue | ( | HWND | hEditWnd,
 |  | LONG * | plValue,
 |  | LONG | lMin = LONG_MIN,
 |  | LONG | lMax = LONG_MAX,
 |  | BOOL | fAllowEmpty = FALSE
 | ) |  |

Definition at line 3153 of file common.cpp.

{
  ASSERT(hEditWnd);
  ASSERT(plValue);
  WCHAR wszBuffer[MAX_QUERY_LEN] = {0};

  //Get the EditText
  wSendMessage(hEditWnd, WM_GETTEXT, MAX_QUERY_LEN, wszBuffer);
  if(wszBuffer[0] || !fAllowEmpty)
  {
    //Delegate
    if(!wszBuffer[0] || !ConvertToLONG(wszBuffer, plValue, lMin, lMax))
    {
      wMessageBox(hEditWnd, MB_TASKMODAL | MB_ICONERROR | MB_OK,  wsz_ERROR,
        wsz_INVALID_VALUE_, wszBuffer, lMin, lMax);
      SetFocus(hEditWnd);
      return FALSE;
    }
  }

  return TRUE;
}

DBLENGTH GetMaxDisplaySize | ( | DBTYPE | wBindingType,
 |  | DBTYPE | wBackendType,
 |  | DBLENGTH | ulColumnSize,
 |  | DBLENGTH | ulMaxVarSize
 | ) |  |

Definition at line 2501 of file common.cpp.

{
  //Obtain the correct number of bytes to respresent the data in the wBindingType format.
  //NOTE: For variable types, the bytes will be bounded by ulMaxVarSize (cbMaxLen), for
  //fixed length type bindings, the size will be bounded by the type, (ie: NOT ulMaxVarSize),
  //since the provider ignores cbMaxLen for fixed length types and assumes their is enough
  //storage for the type...
  DBLENGTH cbMaxLen = 0;

  //May need to adjust the MaxLen, depending upon what the BindingType is
  switch(wBindingType)
  {
    //Strings are kind of a pain.  Although we get the luxury of
    //Having the provider coerce the type, we need to allocate a buffer
    //large enough for the provider to store the type in "string" format
    case DBTYPE_STR:
    case DBTYPE_WSTR:
    {
      switch(wBackendType)
      {
        case DBTYPE_NULL:
        case DBTYPE_EMPTY:
          //Don't need much room for these...
          cbMaxLen = 0 + 1;
          break;

        case DBTYPE_I1:
        case DBTYPE_I2:
        case DBTYPE_I4:
        case DBTYPE_UI1:
        case DBTYPE_UI2:
        case DBTYPE_UI4:
        case DBTYPE_R4:
        case DBTYPE_HCHAPTER:
          //All of the above fit well into 15 characters of display size
          cbMaxLen = 15 + 1;
          break;

        case DBTYPE_I8:
        case DBTYPE_UI8:
        case DBTYPE_R8:
        case DBTYPE_CY:
        case DBTYPE_ERROR:
        case DBTYPE_BOOL:
          //All of the above fit well into 25 characters of display size
          cbMaxLen = 25 + 1;
          break;

        case DBTYPE_DECIMAL:
        case DBTYPE_NUMERIC:
        case DBTYPE_DATE:
        case DBTYPE_DBDATE:
        case DBTYPE_DBTIMESTAMP:
        case DBTYPE_GUID:
          //All of the above fit well into 50 characters of display size
          cbMaxLen = 50 + 1;
          break;

        case DBTYPE_BYTES:
          //Bytes -> String, 1 byte = 2 Ascii chars. (0xFF == "FF")
          cbMaxLen = min(ulColumnSize, ulMaxVarSize) * 2 + 1;
          break;

        case DBTYPE_STR:
        case DBTYPE_WSTR:
          //String -> String
          //ulColumnSize already contains the length
          cbMaxLen = min(ulColumnSize, ulMaxVarSize) + 1;
          break;

        case DBTYPE_IUNKNOWN:
        case DBTYPE_IDISPATCH:
          cbMaxLen = sizeof(IUnknown*);
          break;

        default:
          //For everything else
          //Just default to our largest buffer size
          cbMaxLen = ulMaxVarSize;
          break;
      };

      //Adjust for Unicode strings
      if(wBindingType == DBTYPE_WSTR)
        cbMaxLen *= 2;

      //Make sure variable types are bounded by the maximum variable size,
      //since we are binding this is a string (STR/WSTR)
      cbMaxLen = min(cbMaxLen, ulMaxVarSize);
      break;
    }

    default:
    {
      //Otherwise were not binding it as an inline string, so we don't need to know the
      //total formating string length, we can simply specify the size of the type...

      //NOTE: On failure this function already sets the maxlen to the max for unrecognized types.
      GetDBTypeMaxSize(wBindingType, &cbMaxLen);

      //Make sure variable types are bounded by the maximum variable size.
      //We can't do this for fixed length types since the provider assumes this memory
      //is at least the size of the data type...
      if(IsVariableType(wBindingType))
        cbMaxLen = min(cbMaxLen, ulMaxVarSize);
      break;
    }
  };

  return cbMaxLen;
}

ULONG_PTR GetMenuData | ( | HMENU | hMenu,
 |  | UINT | uItem,
 |  | BOOL | fByPosition
 | ) |  |

Definition at line 3248 of file common.cpp.

{
  //Setup our Menu Structure...
  //NOTE: HBITMAP was added in IE5, and may not work on older controls...
  MENUITEMINFOA menuinfo = { offsetof(MENUITEMINFOA, cch) + sizeof(UINT), MIIM_DATA, 0, 0, 0, NULL, NULL, NULL, 0, NULL, 0 };

#ifndef _WIN64
  //First set this menu's item data
  //NOTE: HBITMAP was added in IE5, and may not work on older controls...
  //So we will first try with the smaller size, since this should be backward compatible...
  if(GetMenuItemInfoA(hMenu, uItem, fByPosition, &menuinfo))
    return menuinfo.dwItemData;
#endif //_WIN64

  //Retry Logic
  //On some OS's, (Win64), it only assumes the full NT5 structure size
  //thus for a new OS doesn't have backward compatability issues...
  menuinfo.cbSize = sizeof(MENUITEMINFOA);
  if(GetMenuItemInfoA(hMenu, uItem, fByPosition, &menuinfo))
    return menuinfo.dwItemData;
  return 0;
}

WCHAR* GetProgID ( REFCLSID clsid )

Definition at line 3570 of file common.cpp.

{
  WCHAR* pwszProgID = NULL;
  WCHAR wszBuffer[MAX_NAME_LEN];
  wszBuffer[0] = wEOL;

  //ProgID From the Sprecified CLSID
  if(FAILED(ProgIDFromCLSID(clsid, &pwszProgID)))
  {
    //If that does work, we will just return the
    //String representation of the GUID
    StringFromGUID2(clsid, wszBuffer, MAX_NAME_LEN);
    pwszProgID = wcsDuplicate(wszBuffer);
  }

  return pwszProgID;
}

HRESULT GetRegEntry | ( | HKEY | hRootKey,
 |  | WCHAR * | pwszKeyName,
 |  | WCHAR * | pwszValueName,
 |  | WCHAR ** | ppwszValue
 | ) |  |

Definition at line 3737 of file common.cpp.

{
  HRESULT hr = S_OK;
  ASSERT(ppwszValue);
  ULONG cBytes = 0;
  CHAR* pszBuffer = NULL;

  //Obtain the length first (value = NULL)
  TESTC(hr = GetRegEntry(hRootKey, pwszKeyName, pwszValueName, NULL, 0, &cBytes, REG_SZ));

  //Allocate the string
  //NOTE: The length returned from RegQueryValueEx also includes the NULL terminator
  SAFE_ALLOC(*ppwszValue, WCHAR, cBytes);

  if(IsUnicodeOS())
  {
    //Now obtain the data
    TESTC(hr = GetRegEntry(hRootKey, pwszKeyName, pwszValueName, *ppwszValue, cBytes, &cBytes, REG_SZ));
  }
  else
  {
    //Allocate the string
    SAFE_ALLOC(pszBuffer, CHAR, cBytes);

    //Now obtain the data
    TESTC(hr = GetRegEntry(hRootKey, pwszKeyName, pwszValueName, pszBuffer, cBytes, &cBytes, REG_SZ));
    ConvertToWCHAR(pszBuffer, *ppwszValue, cBytes);
    return hr;
  }

CLEANUP:
  SAFE_FREE(pszBuffer);
  return hr;
}

HRESULT GetRegEntry | ( | HKEY | hRootKey,
 |  | WCHAR * | pwszKeyName,
 |  | WCHAR * | pwszValueName,
 |  | WCHAR * | pwszValue,
 |  | ULONG | cBytes
 | ) |  |

Definition at line 3715 of file common.cpp.

{
  if(IsUnicodeOS())
  {
    return GetRegEntry(hRootKey, pwszKeyName, pwszValueName, pwszValue, cBytes, NULL, REG_SZ);
  }
  else
  {
    CHAR szBuffer[MAX_NAME_LEN];
    HRESULT hr = GetRegEntry(hRootKey, pwszKeyName, pwszValueName, szBuffer, MAX_NAME_LEN, NULL, REG_SZ);
    if(SUCCEEDED(hr))
      ConvertToWCHAR(szBuffer, pwszValue, cBytes);

    return hr;
  }
}

HRESULT GetRegEntry | ( | HKEY | hRootKey,
 |  | WCHAR * | pwszKeyName,
 |  | WCHAR * | pwszValueName,
 |  | ULONG * | pulValue
 | ) |  |

Definition at line 3777 of file common.cpp.

{
  return GetRegEntry(hRootKey, pwszKeyName, pwszValueName, pulValue, sizeof(ULONG), NULL, REG_DWORD);
}

HRESULT GetRegEntry | ( | HKEY | hRootKey,
 |  | WCHAR * | pwszKeyName,
 |  | WCHAR * | pwszValueName,
 |  | void * | pStruct,
 |  | ULONG | cbSize,
 |  | ULONG * | pcbActualSize,
 |  | ULONG | dwType = REG_BINARY
 | ) |  |

Definition at line 3787 of file common.cpp.

{
  HRESULT hr = E_FAIL;
  HKEY hKey = NULL;

  //NOTE: pStruct can be NULL if the user is just obtaining the length...

  //Obtain the Data for the above key
  if(pwszKeyName)
  {
    if(FAILED(OpenRegKey(hRootKey, pwszKeyName, 0, KEY_READ, &hKey)))
      goto CLEANUP;
  }

  if(IsUnicodeOS())
  {
    hr = RegQueryValueExW(hKey ? hKey : hRootKey, pwszValueName, NULL, &dwType, (BYTE*)pStruct, &cBytes);
  }
  else
  {
    //Obtain the Data for the above key
    CHAR szBuffer[MAX_NAME_LEN];
    ConvertToMBCS(pwszValueName, szBuffer, MAX_NAME_LEN);

    hr = RegQueryValueExA(hKey ? hKey : hRootKey, szBuffer, NULL, &dwType, (BYTE*)pStruct, &cBytes);
  }

  if(hr != S_OK)
    hr = E_FAIL;

CLEANUP:
  if(pcActualBytes)
    *pcActualBytes = cBytes;

  CloseRegKey(hKey);
  return hr;
}

HRESULT GetRegEnumKey | ( | HKEY | hRootKey,
 |  | WCHAR * | pwszKeyName,
 |  | DWORD | dwIndex,
 |  | WCHAR * | pwszSubKeyName,
 |  | ULONG | cBytes
 | ) |  |

Definition at line 3593 of file common.cpp.

{
  HRESULT hr = E_FAIL;
  HKEY hKey = NULL;

  //Need some place to put the key name returned!
  if(!pwszSubKeyName)
    return E_FAIL;

  //Obtain the Key for HKEY_CLASSES_ROOT\"KeyName"
  if(pwszKeyName)
  {
    if(FAILED(OpenRegKey(hRootKey, pwszKeyName, 0, KEY_READ, &hKey)))
      goto CLEANUP;
  }

  if(IsUnicodeOS())
  {
    //Obtain the specified RegItem at the index specified
    hr = RegEnumKeyW(hKey ? hKey : hRootKey, dwIndex, pwszSubKeyName, cBytes);
  }
  else
  {
    CHAR szBuffer[MAX_NAME_LEN] = {0};

    //Obtain the specified RegItem at the index specified
    hr = RegEnumKeyA(hKey ? hKey : hRootKey, dwIndex, szBuffer, MAX_NAME_LEN);
    ConvertToWCHAR(szBuffer, pwszSubKeyName, cBytes);
  }

CLEANUP:
  if(hr != S_OK && hr != ERROR_NO_MORE_ITEMS)
    hr = E_FAIL;
  CloseRegKey(hKey);
  return hr;
}

HRESULT GetRegEnumValue | ( | HKEY | hRootKey,
 |  | WCHAR * | pwszKeyName,
 |  | DWORD | dwIndex,
 |  | WCHAR * | pwszValueName,
 |  | ULONG * | pcBytes
 | ) |  |

Definition at line 3672 of file common.cpp.

{
  HRESULT hr = E_FAIL;
  HKEY hKey = NULL;
  ASSERT(pcBytes);

  //Obtain the Key for HKEY_CLASSES_ROOT\"KeyName"
  if(pwszKeyName)
  {
    if(FAILED(OpenRegKey(hRootKey, pwszKeyName, 0, KEY_READ, &hKey)))
      goto CLEANUP;
  }

  if(IsUnicodeOS())
  {
    //Obtain the specified RegItem at the index specified
    hr = RegEnumValueW(hKey ? hKey : hRootKey, dwIndex, pwszValueName, pcBytes, 0, NULL, NULL, 0);
  }
  else
  {
    CHAR szBuffer[MAX_NAME_LEN] = {0};
    ULONG cTotal = sizeof(szBuffer);

    //Obtain the specified RegItem at the index specified
    hr = RegEnumValueA(hKey ? hKey : hRootKey, dwIndex, pwszValueName ? szBuffer : NULL, &cTotal, 0, NULL, NULL, 0);

    if(pwszValueName)
      ConvertToWCHAR(szBuffer, pwszValueName, *pcBytes);
    *pcBytes = cTotal;
  }

CLEANUP:
  if(hr != S_OK && hr != ERROR_NO_MORE_ITEMS)
    hr = E_FAIL;
  CloseRegKey(hKey);
  return hr;
}

HRESULT GetRegEnumValue | ( | HKEY | hRootKey,
 |  | WCHAR * | pwszKeyName,
 |  | DWORD | dwIndex,
 |  | WCHAR ** | ppwszValueName
 | ) |  |

Definition at line 3636 of file common.cpp.

{
  HRESULT hr = S_OK;
  ULONG cBytes = 0;
  HKEY hKey = NULL;
  ULONG cMaxValueChars = 0;

  //Obtain the Key for HKEY_CLASSES_ROOT\"KeyName"
  if(pwszKeyName)
  {
    if(FAILED(OpenRegKey(hRootKey, pwszKeyName, 0, KEY_READ, &hKey)))
      goto CLEANUP;
  }

  //First obtain the length of the Value...
  if(S_OK == RegQueryInfoKey(hKey ? hKey : hRootKey, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &cMaxValueChars, NULL, NULL, NULL))
  {
    //Alloc a buffer large enough...
    SAFE_ALLOC(*ppwszValueName, WCHAR, cMaxValueChars+1);
    (*ppwszValueName)[0] = wEOL;

    //Now obtain the data...
    cBytes = (cMaxValueChars+1)*sizeof(WCHAR);
    hr = GetRegEnumValue(hRootKey, pwszKeyName, dwIndex, *ppwszValueName, &cBytes);
  }

CLEANUP:
  CloseRegKey(hKey);
  return hr;
}

void* GetThis ( HWND hWnd )

Definition at line 2633 of file common.cpp.

{
  //Return the current value...
  ASSERT(hWnd);
  return (void*)GetWindowLongPtr(hWnd, GWLP_USERDATA);
}

DBTYPE GetVariantType ( WCHAR * pwszName )

Definition at line 2185 of file common.cpp.

{
  return (DBTYPE)GetMapName(pwsz, g_cVariantTypes, g_rgVariantTypes);
}

WCHAR* GetVariantTypeName ( DBTYPE wType )
BOOL GetWindowPos | ( | HWND | hWnd,
 |  | POINTS * | pPTS
 | ) |  |

Definition at line 2860 of file common.cpp.

{
  ASSERT(pPTS);

  RECT rect;
  if(GetWindowRect(hWnd, &rect))
  {
    pPTS->x = (SHORT)rect.left;
    pPTS->y = (SHORT)rect.top;
  }

  return FALSE;
}

SIZE GetWindowSize ( HWND hWnd )

Definition at line 2879 of file common.cpp.

{
  RECT rect = { 0,0,0,0 };
  SIZE size = { 0,0 };

  //Obtain window cordinates.
  if(GetWindowRect(hWnd, &rect))
  {
    //Fillin SIZE struct
    size.cx = rect.right - rect.left;
    size.cy = rect.bottom - rect.top;
  }
  return size;
}

void InternalTrace ( LPCWSTR pwszText )

Definition at line 2732 of file common.cpp.

{
  //NOTE:  We have a fixed argument version and a variable version (...), since
  //we have problems with calls to a variable length version and trying to use the '%'
  //operator as a real character and not as a format specifier...

  if(pwszText)
  {
    if(IsUnicodeOS())
    {
      OutputDebugStringW(pwszText);
    }
    else
    {
      //Output to the DebugWindow
      CHAR szBuffer[MAX_QUERY_LEN];
      ConvertToMBCS(pwszText, szBuffer, MAX_QUERY_LEN);
      OutputDebugStringA(szBuffer);
    }
  }
}

void InternalTraceFmt | ( | LPCWSTR | pwszFmt,
 |  |  | ...
 | ) |  |

Definition at line 2759 of file common.cpp.

{
  va_list   marker;
  WCHAR   wszBuffer[MAX_QUERY_LEN];

  // Use format and arguements as input
  //This version will not overwrite the stack, since it only copies
  //upto the max size of the array
  va_start(marker, pwszFmt);
  _vsnwprintf(wszBuffer, MAX_QUERY_LEN, pwszFmt, marker);
  va_end(marker);

  //Make sure there is a NULL Terminator, vsnwprintf will not copy
  //the terminator if length==MAX_QUERY_LEN
  wszBuffer[MAX_QUERY_LEN-1] = wEOL;

  //Delegate
  InternalTrace(wszBuffer);
}

BOOL IsFixedType ( DBTYPE wType )

Definition at line 1955 of file common.cpp.

{
  return !IsVariableType(wType);
}

BOOL IsNumericType ( DBTYPE wType )

Definition at line 1964 of file common.cpp.

{
  //According to OLE DB Spec Appendix A (Numeric Data Types)
  switch(wType)
  {
    case DBTYPE_I1:
    case DBTYPE_I2:
    case DBTYPE_I4:
    case DBTYPE_I8:
    case DBTYPE_UI1:
    case DBTYPE_UI2:
    case DBTYPE_UI4:
    case DBTYPE_UI8:
    case DBTYPE_R4:
    case DBTYPE_R8:
    case DBTYPE_CY:
    case DBTYPE_DECIMAL:
    case DBTYPE_NUMERIC:
      return TRUE;
  }
  return FALSE;
}

BOOL IsUnicodeOS ( )

Definition at line 40 of file common.cpp.

{
  static BOOL fInitialized = FALSE;
  static BOOL fUnicode = TRUE;

  //NOTE:  Don't call another other helper functions from within this function
  //that might also use the IsUnicodeOS flag, otherwise this will be an infinite loop...

  if(!fInitialized)
  {
    HKEY hkJunk = HKEY_CURRENT_USER;

    // Check to see if we have win95's broken registry, thus we do not have Unicode support
    if((RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE", 0, KEY_READ, &hkJunk) == S_OK) && hkJunk == HKEY_CURRENT_USER)
    {
      // Try the ANSI version
      if((RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, KEY_READ, &hkJunk) == S_OK) && (hkJunk != HKEY_CURRENT_USER))
      {
        fUnicode = FALSE;
      }
    }

    if(hkJunk != HKEY_CURRENT_USER)
      RegCloseKey(hkJunk);
    fInitialized = TRUE;
  }

  return fUnicode;
}

BOOL IsVariableType ( DBTYPE wType )

Definition at line 1936 of file common.cpp.

{
  //According to OLE DB Spec Appendix A (Variable-Length Data Types)
  switch(wType)
  {
    case DBTYPE_STR:
    case DBTYPE_WSTR:
    case DBTYPE_BYTES:
    case DBTYPE_VARNUMERIC:
      return TRUE;
  }
  return FALSE;
}

HINSTANCE LoadDll ( WCHAR * pwszDll )
BOOL MoveWindow | ( | HWND | hWnd,
 |  | ULONG | x,
 |  | ULONG | y
 | ) |  |

Definition at line 2825 of file common.cpp.

{
  RECT  rcParent;                         // Parent window client rect
  RECT  rcDlg;                            // Dialog window rect
  int   nLeft, nTop;                      // Top-left coordinates
  int   cWidth, cHeight;                  // Width and height
  HWND  hWndParent;

  // Get frame window client rect in screen coordinates
  hWndParent = GetParent(hWnd);
  if(hWndParent == NULL || hWndParent == GetDesktopWindow())
  {
    rcParent.top = rcParent.left = 0;
    rcParent.right = GetSystemMetrics(SM_CXFULLSCREEN);
    rcParent.bottom = GetSystemMetrics(SM_CYFULLSCREEN);
  }
  else
    GetWindowRect(hWndParent, &rcParent);

  // Determine the top-left point for the dialog to be centered
  GetWindowRect(hWnd, &rcDlg);
  cWidth  = rcDlg.right  - rcDlg.left;
  cHeight = rcDlg.bottom - rcDlg.top;
  nLeft   = rcParent.left + x;
  nTop    = rcParent.top + y;

  // Place the dialog
  return MoveWindow(hWnd, nLeft, nTop, cWidth, cHeight, TRUE);
}

HRESULT OpenRegKey | ( | HKEY | hRootKey,
 |  | WCHAR * | pwszKeyName,
 |  | DWORD | ulOptions,
 |  | REGSAM | samDesired,
 |  | HKEY * | phKey
 | ) |  |

Definition at line 3542 of file common.cpp.

{
  HRESULT hr = E_FAIL;

  if(IsUnicodeOS())
  {
    //Obtain the Key for HKEY_CLASSES_ROOT\"SubKey"
    hr = RegOpenKeyExW(hRootKey, pwszKeyName, ulOptions, samDesired, phKey);
  }
  else
  {
    CHAR szBuffer[MAX_NAME_LEN];
    ConvertToMBCS(pwszKeyName, szBuffer, MAX_NAME_LEN);

    //Obtain the Key for HKEY_CLASSES_ROOT\"SubKey"
    hr = RegOpenKeyExA(hRootKey, szBuffer, ulOptions, samDesired, phKey);
  }

  if(hr != S_OK)
    return E_FAIL;
  return hr;
}

HRESULT PostProcessString | ( | WCHAR * | pwsz,
 |  | DBLENGTH | ulMaxSize,
 |  | DWORD | dwFlags
 | ) |  |

Definition at line 351 of file common.cpp.

{
  ASSERT(pwsz);
  ASSERT(ulMaxSize);
  WCHAR* pwszStop = NULL;
  LONG lValue = 0;

  //Currently only deals with HEX or DECIMAL
  ASSERT(dwFlags & CONV_HEX || dwFlags & CONV_DECIMAL);

  //Convert String to integer
  if(!ConvertToLONG(pwsz, &lValue, LONG_MIN, LONG_MAX, 0/*0 base indicates WinAPI to interpret*/))
    return E_FAIL;

  //Convert Integer back to requested Format
  if(dwFlags & CONV_HEX)
    StringFormat(pwsz, ulMaxSize, L"0x%x", lValue);
  else
    StringFormat(pwsz, ulMaxSize, L"%d", lValue);

  return S_OK;
}

LONG RunSysCommand ( WCHAR * pwszCommand )
HRESULT SafeArrayToString | ( | SAFEARRAY * | pSafeArray,
 |  | DBTYPE | wType,
 |  | WCHAR * | pwsz,
 |  | DBLENGTH | ulMaxSize
 | ) |  |

Definition at line 1051 of file common.cpp.

{
  ASSERT(pSafeArray);
  ASSERT(pwszBuffer);

  //No-op
  if(!ulMaxSize)
    return S_OK;

  //This method is capable of handling N-Dimenstions of Data!!
  //We need to take N-Dimensions of Data and convert it to a string

  //For example:  We have a 3D data, where z-dim has 2 elements, y-Dim has 3 ele
  //and x-dim has 2 elements we end up with the following matrix of points

  //  (z, y, x)  => value [[[
  //  (1, 1, 1)  => 1
  //  (1, 1, 2)  => 2
  //  (1, 2, 1)  => 3   ][
  //  (1, 2, 2)  => 4
  //  (1, 3, 1)  => 5   ][
  //  (1, 3, 2)  => 6
  //  (2, 1, 1)  => 7   ]][[
  //  (2, 1, 2)  => 8
  //  (2, 2, 1)  => 9   ][
  //  (2, 2, 2)  => A
  //  (2, 3, 1)  => B   ][
  //  (2, 3, 2)  => C
  //            ]]]

  //So what we need to generate is a string of:
  //  [ [[1,2][3,4][5,6]] [[7,8][9,A][B,C]] ]

  //The algorythm we are using is bascially based upon a "ripple" counter.
  //We keep a counter for each dimension.  So when CounterDim[0] hits the Upper
  //Limit, we increment CounterDim[1] and set CounterDim[0] back to LowerLimit.
  //This continues until all have reached the upper limit together:
  //{CounterDim[n-1]==UpperLimt, ... Dim[0]==UpperLimit}

  //The braces are determined by rising/falling edges of the ripple counter.
  //Everytime a dimension restarts its value from Upper->Lower we see a "][".
  //So we have a pre and a post set of - "[[[" braces "]]]" for the number of dimensions.
  //You'll notices the set of braces in the above example on the rising/falling
  //edges of the ripple counter....

  HRESULT hr = S_OK;

  CVariant cVariant;
  WCHAR* pwsz = pwszBuffer;
  WCHAR* pwszEnd = pwsz + ulMaxSize;

  ULONG i,iDim, ulInnerElements = 0;
  ULONG cDimensions = SafeArrayGetDim(pSafeArray);
  BOOL bDone = FALSE;

  //No-op
  if(!cDimensions)
    return E_FAIL;

  //Make sure there is no Array in the type
  wType &= ~VT_ARRAY;
  pwsz[0] = wEOL;

  LONG* rgIndices = NULL;
  SAFE_ALLOC(rgIndices, LONG, cDimensions);

  //Loop over all dimenstions and fill in "pre" info...
  for(iDim=0; iDim<cDimensions; iDim++)
  {
    //Fill in lower bound
    LONG lLowerBound = 0;
    SafeArrayGetLBound(pSafeArray, iDim+1, &lLowerBound);
    rgIndices[iDim] = lLowerBound;

    //Fill in outer dimension indicater
    *pwsz = L'[';
    pwsz++;
  }

  //Calculate the total number of inner items...
  //This is easy, all dimensions will have the same number "inner" items
  //IE:  rg[y][x] - all y arrays have x elements.
  //IE:  rg[z][y][x] - all z arrays, have y arrays, which have x elements
  ulInnerElements = pSafeArray->rgsabound[0].cElements;
  while(!bDone && (pwsz < pwszEnd))
  {
    //Dimension[0] always goes through a complete cycle every time
    //Just do this part of the ripple counter seperately...
    for(i=0; i<ulInnerElements; i++)
    {
      //Initialize Variant
      cVariant.Init();

      //Obtain the data from the safe array...
      switch(wType)
      {
        case VT_EMPTY:
        case VT_NULL:
        case VT_I2:
        case VT_I4:
        case VT_R4:
        case VT_R8:
        case VT_CY:
        case VT_DATE:
        case VT_BSTR:
        case VT_DISPATCH:
        case VT_ERROR:
        case VT_BOOL:
        case VT_UNKNOWN:
        case VT_I1:
        case VT_UI1:
        case VT_UI2:
        case VT_UI4:
        case VT_I8:
        case VT_UI8:
        case VT_INT:
        case VT_UINT:
          //Otherwise if its a valid variant type, we can place it within
          //our variant as a subtype and delegate to VariantToString to
          //do the converion
          V_VT(&cVariant) = wType;
          TESTC(hr = SafeArrayGetElement(pSafeArray, rgIndices, &V_I4(&cVariant)));
          break;

        case VT_VARIANT:
          //just place directly into our variant.
          TESTC(hr = SafeArrayGetElement(pSafeArray, rgIndices, &cVariant));
          break;

        case VT_DECIMAL:
          //DECIMAL is not part of the VARIANT union
          V_VT(&cVariant)   = wType;
          TESTC(hr = SafeArrayGetElement(pSafeArray, rgIndices, &V_DECIMAL(&cVariant)));
          break;

        default:
          //Unable to handle this type...
          TESTC(hr = E_FAIL);
      }

      rgIndices[0]++;

      //Convert VARIANT To String
      TESTC(hr = VariantToString(&cVariant, pwsz, pwszEnd - pwsz, CONV_NONE));
      pwsz += wcslen(pwsz);

      //Array Seperator
      if(i<ulInnerElements-1 && (pwsz < pwszEnd))
      {
        *pwsz = L',';
        pwsz++;
      }

      //Clear the Variant, (could be outofline memory...)
      XTEST(cVariant.Clear());

      if(!(pwsz < pwszEnd))
        break;
    }

    //Adjust the other Dimensions of the ripple counter
    for(iDim=0; iDim<cDimensions; iDim++)
    {
      LONG lUpperBound = 0;
      SafeArrayGetUBound(pSafeArray, iDim+1, &lUpperBound);

      //Increment this ripple if below max bound, and exit out (break)
      if(rgIndices[iDim] < lUpperBound)
      {
        rgIndices[iDim]++;

        //Need to add opening braces...
        for(ULONG j=iDim; j>0 && (pwsz < pwszEnd); j--)
        {
          *pwsz = L'[';
          pwsz++;
        }
        break;
      }
      //Otherwise reset this one and move onto the
      //next Dimension (ie: Don't break...)
      else if(iDim != cDimensions-1)
      {
        LONG lLowerBound = 0;
        SafeArrayGetLBound(pSafeArray, iDim+1, &lLowerBound);
        rgIndices[iDim] = lLowerBound;

        if(pwsz < pwszEnd)
        {
          *pwsz = L']';
          pwsz++;
        }
      }
      //If we have hit the last Dimension and its over the value
      //This means were done...
      else
      {
        bDone = TRUE;
      }
    }
  }

  //Display Right outer braces
  for(iDim=0; iDim<cDimensions && (pwsz < pwszEnd); iDim++)
  {
    *pwsz = L']';
    pwsz++;
  }

CLEANUP:
  SAFE_FREE(rgIndices);
  return hr;
}

BOOL SetMenuData | ( | HMENU | hMenu,
 |  | UINT | uItem,
 |  | BOOL | fByPosition,
 |  | ULONG_PTR | dwItemData
 | ) |  |

Definition at line 3181 of file common.cpp.

{
  //Setup our Menu Structure...
  //NOTE: HBITMAP was added in IE5, and may not work on older controls...
  MENUITEMINFOA menuinfo = { offsetof(MENUITEMINFOA, cch) + sizeof(UINT), MIIM_DATA, 0, 0, 0, NULL, NULL, NULL, dwItemData, NULL, 0};

#ifndef _WIN64
  //Set this menu's item data
  //NOTE: HBITMAP was added in IE5, and may not work on older controls...
  //So we will first try with the smaller size, since this should be backward compatible...
  if(SetMenuItemInfoA(hMenu, uItem, fByPosition, &menuinfo))
    return TRUE;
#endif //_WIN64

  //Retry Logic
  //On some OS's, (Win64), it only assumes the full NT5 structure size
  //thus for a new OS doesn't have backward compatability issues...
  menuinfo.cbSize = sizeof(MENUITEMINFOA);
  return SetMenuItemInfoA(hMenu, uItem, fByPosition, &menuinfo);
}

HRESULT SetRegEntry | ( | HKEY | hRootKey,
 |  | WCHAR * | pwszKeyName,
 |  | WCHAR * | pwszValueName,
 |  | void * | pStruct,
 |  | ULONG | cbSize,
 |  | ULONG | dwType = REG_BINARY
 | ) |  |
HRESULT SetRegEntry | ( | HKEY | hRootKey,
 |  | WCHAR * | pwszKeyName,
 |  | WCHAR * | pwszValueName,
 |  | ULONG | ulValue
 | ) |  |

Definition at line 3849 of file common.cpp.

{
  return SetRegEntry(hRootKey, pwszKeyName, pwszValueName, &ulValue, sizeof(ULONG), REG_DWORD);
}

HRESULT SetRegEntry | ( | HKEY | hRootKey,
 |  | WCHAR * | pwszKeyName,
 |  | WCHAR * | pwszValueName,
 |  | WCHAR * | pwszValue
 | ) |  |

Definition at line 3830 of file common.cpp.

{
  if(IsUnicodeOS())
  {
    return SetRegEntry(hRootKey, pwszKeyName, pwszValueName, pwszValue ? pwszValue : L"", pwszValue ? (wcslen(pwszValue)+1)*sizeof(WCHAR) : sizeof(WCHAR), REG_SZ);
  }
  else
  {
    CHAR szBuffer[MAX_NAME_LEN];
    ConvertToMBCS(pwszValue, szBuffer, MAX_NAME_LEN);
    return SetRegEntry(hRootKey, pwszKeyName, pwszValueName, pwszValue ? szBuffer : "", pwszValue ? (strlen(szBuffer)+1)*sizeof(CHAR) : sizeof(CHAR), REG_SZ);
  }
}

BOOL SetSubMenuData | ( | HMENU | hMenu,
 |  | UINT | uItem,
 |  | BOOL | fByPosition,
 |  | ULONG_PTR | dwItemData
 | ) |  |

Definition at line 3207 of file common.cpp.

{
  //NOTE: Having every menu item in all objects menu have unique ids, makes adding the same interface
  //to another object very painful, and causes manually editing the menu resources, making sure its
  //added to OnUpdateCommand for enabling/disabling the menu item, as well as adding another
  //case in OnCommand for the same interface!

  //Instead we have devised a design where we can intitally set the item data of every menu
  //to contain the object identifier.  This way we can always obtain the stored data of the menu
  //and instantly know the type of object this interface/method is called from.  Saves hundreads
  //of lines of code, and almost ellimiates all places to remember to add code to...

  //First set this menu's item data
  if(SetMenuData(hMenu, 0, TRUE/*fByPosition*/, dwItemData))
  {
    //Now that we have successfully set the data, we should loop through any child
    //menus and also set that data, since there is no current way to traverse backward in a menu...
    INT iItems = GetMenuItemCount(hMenu);
    for(INT i=0; i<iItems; i++)
    {
      ULONG ulMenuID = GetMenuItemID(hMenu, i);
      if(ulMenuID == ULONG_MAX)
      {
        //Recursive Alogorytm
        HMENU hSubMenu = GetSubMenu(hMenu, i);
        if(hSubMenu)
          SetSubMenuData(hSubMenu, 0, TRUE/*fByPosition*/, dwItemData);
      }
    }

    return TRUE;
  }

  return FALSE;
}

void* SetThis | ( | HWND | hWnd,
 |  | void * | pThis
 | ) |  |

Definition at line 2618 of file common.cpp.

{
  ASSERT(hWnd);
  void* pPrev = (void*)SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)pThis);

  //NOTE: We need to help prevent the case of overwriting the "this" pointer
  //in a nested senario.  If you hit this assert a subwindow has subclassed the window
  //as well.  By replacing the this pointer, the previous window will lose the correct
  //class assoicted with it.
  ASSERT(!pPrev || !pThis || pPrev == pThis);

  //Return the current value...
  return pThis;
}

WCHAR* StackFormat | ( | LPCWSTR | pwszFmt,
 |  |  | ...
 | ) |  |

Definition at line 91 of file common.cpp.

{
  va_list   marker;

  ASSERT(pwszFmt);
  static WCHAR wszBuffer[MAX_QUERY_LEN];
  wszBuffer[0] = wEOL;

  // Use format and arguements as input
  //This version will not overwrite the stack, since it only copies
  //upto the max size of the array
  va_start(marker, pwszFmt);
  _vsnwprintf(wszBuffer, NUMELE(wszBuffer), pwszFmt, marker);
  va_end(marker);

  //Make sure there is a NULL Terminator, vsnwprintf will not copy
  //the terminator if length==MAX_QUERY_LEN
  wszBuffer[NUMELE(wszBuffer)-1] = wEOL;
  return wszBuffer;
}

CHAR* strDuplicate ( LPCSTR psz )

Definition at line 1671 of file common.cpp.

{
  HRESULT hr = S_OK;

  //no-op case
  if(!psz)
    return NULL;

  ULONG cLen  = strlen(psz);

  //Allocate space for the string
  CHAR* pszBuffer = NULL;
  SAFE_ALLOC(pszBuffer, CHAR, cLen+1);

  //Now copy the string
  strcpy(pszBuffer, psz);

CLEANUP:
  return pszBuffer;
}

BOOL StringCompare | ( | LPCWSTR | pwsz1,
 |  | LPCWSTR | pwsz2
 | ) |  |

Definition at line 142 of file common.cpp.

{
  //Safe guard against NULL...
  if(pwsz1 && pwsz2)
    return wcscmp(pwsz1, pwsz2)==0;

  return pwsz1 == pwsz2;
}

BOOL StringCompareI | ( | LPCWSTR | pwsz1,
 |  | LPCWSTR | pwsz2
 | ) |  |

Definition at line 156 of file common.cpp.

{
  //Safe guard against NULL...
  if(pwsz1 && pwsz2)
    return _wcsicmp(pwsz1, pwsz2)==0;

  return pwsz1 == pwsz2;
}

WCHAR* StringCopy | ( | WCHAR * | pwszDest,
 |  | LPCWSTR | pwszSource,
 |  | DBLENGTH | cMaxLen
 | ) |  |

Definition at line 75 of file common.cpp.

{
  //Safe guard against overflow...
  WCHAR* pwszReturn = wcsncpy(pwszDest, pwszSource, (size_t)cMaxLen);
  if(cMaxLen)
  {
    pwszDest[cMaxLen-1] = wEOL;
  }

  return pwszReturn;
}

CHAR* StringCopy | ( | CHAR * | pszDest,
 |  | LPCSTR | pszSource,
 |  | DBLENGTH | cMaxLen
 | ) |  |

Definition at line 169 of file common.cpp.

{
  //Safe guard against overflow...
  CHAR* pszReturn = strncpy(pszDest, pszSource, (size_t)cMaxLen);
  if(cMaxLen)
  {
    pszDest[cMaxLen-1] = EOL;
  }

  return pszReturn;
}

WCHAR* StringFormat | ( | WCHAR * | pwszDest,
 |  | DBLENGTH | ulStrLen,
 |  | LPCWSTR | pwszFmt,
 |  |  | ...
 | ) |  |

Definition at line 116 of file common.cpp.

{
  ASSERT(pwszDest);
  ASSERT(ulStrLen);
  ASSERT(pwszFmt);

  va_list   marker;

  // Use format and arguements as input
  //This version will not overwrite the stack, since it only copies
  //upto the max size of the array
  va_start(marker, pwszFmt);
  _vsnwprintf(pwszDest, ulStrLen, pwszFmt, marker);
  va_end(marker);

  //Make sure there is a NULL Terminator, vsnwprintf will not copy
  //the terminator if length==MAX_QUERY_LEN
  pwszDest[ulStrLen-1] = wEOL;
  return pwszDest;
}

HRESULT StringToSafeArray | ( | WCHAR * | pwsz,
 |  | DBTYPE | wType,
 |  | SAFEARRAY ** | ppSafeArray
 | ) |  |

Definition at line 1270 of file common.cpp.

{
  ASSERT(ppSafeArray);
  if(!pwszBuffer)
    return E_INVALIDARG;

  //We already know we need to create an array
  wType &= ~VT_ARRAY;

  //This method is capable of handling N-Dimenstions of Data!!
  //We need to a String of N Dimensions and turn it into a SafeArray

  //For example:  We have a 3D data, where z-dim has 2 elements, y-Dim has 3 ele
  //and x-dim has 2 elements we end up with the following matrix of points

  //  (z, y, x)  => value [[[
  //  (1, 1, 1)  => 1
  //  (1, 1, 2)  => 2
  //  (1, 2, 1)  => 3   ][
  //  (1, 2, 2)  => 4
  //  (1, 3, 1)  => 5   ][
  //  (1, 3, 2)  => 6
  //  (2, 1, 1)  => 7   ]][[
  //  (2, 1, 2)  => 8
  //  (2, 2, 1)  => 9   ][
  //  (2, 2, 2)  => A
  //  (2, 3, 1)  => B   ][
  //  (2, 3, 2)  => C
  //            ]]]

  //So we could be passed a string of:
  //  [ [[1,2][3,4][5,6]] [[7,8][9,A][B,C]] ]

  //The algorythm we are using is bascially based upon a "ripple" counter.
  //We keep a counter for each dimension.  So when CounterDim[0] hits the Upper
  //Limit, we increment CounterDim[1] and set CounterDim[0] back to LowerLimit.
  //This continues until all have reached the upper limit together:
  //{CounterDim[n-1]==UpperLimt, ... Dim[0]==UpperLimit}

  //The braces are determined by rising/falling edges of the ripple counter.
  //Everytime a dimension restarts its value from Upper->Lower we see a "][".
  //So we have a pre and a post set of - "[[[" braces "]]]" for the number of dimensions.
  //You'll notices the set of braces in the above example on the rising/falling
  //edges of the ripple counter....

  HRESULT hr = S_OK;
  CVariant cVariant;

  WCHAR wszBuffer[MAX_COL_SIZE];
  wszBuffer[0] = wEOL;
  WCHAR* pwsz = pwszBuffer;

  ULONG i,iDim, ulInnerElements = 0;

  //Determine the Number of Dimensions...
  ULONG cDimensions = 0;
  while(pwsz[0]==L'[')
  {
    cDimensions++;
    pwsz++;
    wcscat(wszBuffer, L"]");
  }

  //Find the End of the Data (where everever "]...") is...
  WCHAR* pwszNext = pwsz;
  WCHAR* pwszEnd = pwsz;
  WCHAR* pwszCurEnd = wcschr(pwsz, L']');

  //No-op
  if(cDimensions < 1)
    return E_FAIL;

  //Create SafeArray
  SAFEARRAY* pSafeArray = NULL;
  *ppSafeArray = NULL;

  LONG* rgIndices = NULL;
  SAFEARRAYBOUND* rgSafeArrayBounds = NULL;

  //Indices array...
  SAFE_ALLOC(rgIndices, LONG, cDimensions);
  memset(rgIndices, 0, cDimensions * sizeof(LONG));

  //SafeArrayBounds array...
  SAFE_ALLOC(rgSafeArrayBounds, SAFEARRAYBOUND, cDimensions);
  memset(rgSafeArrayBounds, 0, cDimensions*sizeof(SAFEARRAYBOUND));

  //Need to find out how many elements are in Dim[0]
  //NOTE: <= 'Allow empty string safearrays'
  while(pwszNext && pwszNext <= pwszCurEnd)
  {
    ulInnerElements++;
    rgIndices[0]++;
    pwszNext = wcschr(pwszNext, L',');
    if(pwszNext)
      pwszNext++;
  }

  //Now from the [] notation find out how many elements in the other dimenstions
  //  [ [[1,2][3,4][5,6]] [[7,8][9,A][B,C]] ]

  //The algorythm we will use is:
  //Everytime we see a "]" we need to increment the next Dimension elements
  //Everytime we see a "[" we need to reset the previous Dimension elements

  //TODO
  //Currently this algorythm only handles 1 dimension.
  //No reason it couldn't use the above method and work for more, just on
  //a time constraint, and the only provider we have supports max 1 dim...

  ASSERT(cDimensions == 1);

  //Create the SafeArrayBounds
  for(iDim=0; iDim<cDimensions; iDim++)
  {
    rgSafeArrayBounds[iDim].lLbound = 0;
    rgSafeArrayBounds[iDim].cElements = rgIndices[0];
  }

  //Now actually create the SafeArray
  pSafeArray = SafeArrayCreate(wType, cDimensions, rgSafeArrayBounds);
  ASSERT(pSafeArray);

  pwszCurEnd = wcschr(pwsz, L']');
  rgIndices[0] = 0;
  pwszNext = pwsz;
  for(i=0; i<ulInnerElements; i++)
  {
    //Obtain the start and end of the value
    pwszEnd = wcschr(pwszNext, L',');
    if(pwszEnd==NULL || pwszEnd>pwszCurEnd)
      pwszEnd = pwszCurEnd;

    //Setup rgIndicaes
    rgIndices[0] = i;

    //Convert Value to a Variant
    void* pValue = NULL;
    StringCopy(wszBuffer, pwszNext, pwszEnd-pwszNext+1);
    TESTC(hr = StringToVariant(wszBuffer, wType, &cVariant, CONV_NONE));

    //Add this Value to the SafeArray
    //NOTE: According to the spec for SafeArrayPutElement
    //VT_DISPATCH, VT_UNKNOWN, and VT_BSTR are pointers, and do not require another level of indirection.
    switch(wType)
    {
      case VT_DISPATCH:
      case VT_UNKNOWN:
      case VT_BSTR:
        pValue = V_UNKNOWN(&cVariant);
        break;

      case VT_VARIANT:
        pValue = &cVariant;
        break;

      case VT_DECIMAL:
        //DECIMAL is not part of the VARIANT union
        pValue = &V_DECIMAL(&cVariant);
        break;

      default:
        pValue = &V_I4(&cVariant);
        break;
    };

    //Add this Value to the SafeArray
    TESTC(hr = SafeArrayPutElement(pSafeArray, rgIndices, pValue));
    XTEST(cVariant.Clear());

    //Incement to next value...
    pwszNext = wcschr(pwszNext, L',');
    if(pwszNext)
      pwszNext += 1;
  }

  //Everything complete successfully...
  *ppSafeArray = pSafeArray;

CLEANUP:
  SAFE_FREE(rgIndices);
  SAFE_FREE(rgSafeArrayBounds);
  return hr;
}

HRESULT StringToVariant | ( | WCHAR * | pwsz,
 |  | VARTYPE | vt,
 |  | VARIANT * | pVariant,
 |  | DWORD | dwFlags = CONV_ALPHABOOL|CONV_VARBOOL
 | ) |  |

Definition at line 928 of file common.cpp.

{
  //Convert a VARIANT to a WCHAR
  ASSERT(pVariant);
  HRESULT hr = S_OK;

  //Assign the type...
  V_VT(pVariant) = vt;

  //VT_ARRAY is not handled by VariantChangeType
  if(vt & VT_ARRAY)
  {
    SAFEARRAY* pSafeArray = NULL;
    TESTC(hr = StringToSafeArray(pwsz, vt, &pSafeArray));
    V_ARRAY(pVariant) = pSafeArray;
    goto CLEANUP;
  }

  //VariantChangeType seems to handle most types,
  //except the following cases...
  switch(vt)
  {
    case VT_NULL:
    case VT_EMPTY:
      break;

    case VT_BOOL:
    {
      //This type requires a string
      if(!pwsz)
        TESTC(hr = E_INVALIDARG);

      if(dwFlags & CONV_VARBOOL && StringCompareI(pwsz, L"VARIANT_TRUE"))
        V_BOOL(pVariant) = VARIANT_TRUE;
      else if(dwFlags & CONV_VARBOOL && StringCompareI(pwsz, L"VARIANT_FALSE"))
        V_BOOL(pVariant) = VARIANT_FALSE;
      else if(dwFlags & CONV_ALPHABOOL && StringCompareI(pwsz, L"True"))
        V_BOOL(pVariant) = VARIANT_TRUE;
      else if(dwFlags & CONV_ALPHABOOL && StringCompareI(pwsz, L"False"))
        V_BOOL(pVariant) = VARIANT_FALSE;
      else
      {
        LONG lValue = 0;
        if(!ConvertToLONG(pwsz, &lValue, SHRT_MIN, SHRT_MAX, 0/*Base*/))
        {
          hr = E_FAIL;
          goto CLEANUP;
        }
        V_BOOL(pVariant) = (VARIANT_BOOL)lValue;
      }
      break;
    }

    case VT_I4:
    case VT_ERROR:
    case VT_UI4:
    {
      //This type requires a string
      if(!pwsz)
        TESTC(hr = E_INVALIDARG);

      //We handle this case seperatly since we want to handle HEX values
      WCHAR* pwszStop = NULL;
      BOOL fSigned = (vt != VT_UI4);
      errno = 0;

      //Convert
      ULONG ulValue = vt==VT_UI4 ? wcstoul(pwsz, &pwszStop, 0) : wcstol(pwsz, &pwszStop, 0);

      //Function stopped converting prematurely...
      if(pwszStop==NULL || pwszStop[0]!=wEOL || errno==ERANGE)
        TESTC(hr = E_FAIL);

      V_UI4(pVariant) = ulValue;
      break;
    }

    case VT_I8:
    {
      //This type requires a string
      if(!pwsz)
        TESTC(hr = E_INVALIDARG);

      //TODO64: OLEAUT doesn't have support for this type yet, so we have to special case...
      LONGLONG llValue = _wtoi64(pwsz);
//      V_I8(pVariant) = ulValue;
      pVariant->ullVal = llValue;
      break;
    }

    case VT_VARIANT:
    {
      //Place the string into the BSTR of the VARIANT
      V_VT(pVariant) = VT_BSTR;
      V_BSTR(pVariant) = SysAllocString(pwsz);
      break;
    }

    default:
    {
      //Place the string into the BSTR of the VARIANT
      V_VT(pVariant) = VT_BSTR;
      V_BSTR(pVariant) = SysAllocString(pwsz);

      //Now delegate to VariantChangeType...
      TESTC(hr = VariantChangeFast(
        pVariant, // Destination (convert in place)
        pVariant, // Source
        ULONG_MAX,  // LCID
        0,      // dwFlags
        vt ));
    }
  };

CLEANUP:
  return hr;
}

HRESULT StringToVector | ( | WCHAR * | pwszBuffer,
 |  | DBTYPE | wType,
 |  | DBVECTOR * | pVector
 | ) |  |

Definition at line 1565 of file common.cpp.

{
  ASSERT(pVector);
  if(!pwszBuffer)
    return E_INVALIDARG;

  //Make sure we are dealing with the base type...
  wType &= ~DBTYPE_VECTOR;

  HRESULT hr = S_OK;
  VARIANT Variant;
  VariantInitFast(&Variant);

  WCHAR wszBuffer[MAX_COL_SIZE] = {0};
  ULONG iEle = 0;

  //Determine the Number of Elements...
  pVector->size = 1;
  WCHAR* pwsz = pwszBuffer;
  while(pwsz = wcschr(pwsz, L','))
  {
    pVector->size++;
    pwsz++;
  }

  //Obtain the size of each element
  DBLENGTH ulTypeSize = 0;
  if(FAILED(GetDBTypeMaxSize(wType, &ulTypeSize)))
    return hr;

  //Alloc the vector...
  SAFE_ALLOC(pVector->ptr, BYTE, ulTypeSize*pVector->size);

  pwsz = pwszBuffer;
  for(iEle=0; iEle<pVector->size; iEle++)
  {
    //Obtain the start and end of the value
    WCHAR* pwszEnd = wcschr(pwsz, L',');
    void* pElement = (BYTE*)pVector->ptr + (ulTypeSize*iEle);

    //Convert Value to a Variant
    StringCopy(wszBuffer, pwsz, pwszEnd ? pwszEnd-pwsz+1 : MAX_COL_SIZE);
    TESTC(hr = StringToVariant(wszBuffer, wType, &Variant, CONV_NONE));

    //Add this to the vector...
    switch(wType)
    {
      case VT_EMPTY:
      case VT_NULL:
        break;

      case VT_I2:
        *(SHORT*)pElement = V_I2(&Variant);
        break;

      case VT_I4:
      case VT_R4:
      case VT_R8:
      case VT_CY:
      case VT_DATE:
      case VT_BSTR:
      case VT_DISPATCH:
      case VT_ERROR:
      case VT_BOOL:
      case VT_UNKNOWN:
      case VT_I1:
      case VT_UI1:
      case VT_UI2:
      case VT_UI4:
      case VT_I8:
      case VT_UI8:
      case VT_INT:
      case VT_UINT:
        memcpy(pElement, &V_I4(&Variant), (size_t)ulTypeSize);
        break;

      case VT_VARIANT:
        //just place directly into our variant.
        *(VARIANT*)pElement = Variant;
        break;

      case VT_DECIMAL:
        *(DECIMAL*)pElement = V_DECIMAL(&Variant);
        break;

      default:
        //Unable to handle this type...
        TESTC(hr = E_NOTIMPL);
    };

    //Incement to next value...
    pwsz = wcschr(pwsz, L',');
    if(pwsz)
      pwsz += 1;
  }

CLEANUP:
  return hr;
}

INT_PTR WINAPI SynchSubProc | ( | HWND | hWnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 2685 of file common.cpp.

{
  SYNCHINFO* pSynchInfo = (SYNCHINFO*)GetThis(hWnd);
  static BOOL fInsideSend = FALSE;

  switch(message)
  {
    case WM_INITDIALOG:
    {
      //SubClass
      pSynchInfo = new SYNCHINFO;
      pSynchInfo->wpProc    = (WNDPROC)GetWindowLongPtr(hWnd, GWLP_WNDPROC);
      pSynchInfo->hWndSynch = (HWND)lParam;

      SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)SynchSubProc);
      SetThis(hWnd, (void*)pSynchInfo);
      return 0;
    }

    case WM_DESTROY:
      SetThis(hWnd, NULL);
      SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)pSynchInfo->wpProc);
      SAFE_DELETE(pSynchInfo);
      break;

    case WM_VSCROLL:
      if(!fInsideSend)
      {
        //Send a synch message to the other control
        fInsideSend = TRUE;
        SendMessage(pSynchInfo->hWndSynch, message, wParam, lParam);
        fInsideSend = FALSE;
      }
      break;
  }

  if(pSynchInfo && pSynchInfo->wpProc)
    return CallWindowProc(pSynchInfo->wpProc, hWnd, message, wParam, lParam);
  return TRUE;
}

void SyncSibling | ( | HWND | hwndLstChg,
 |  | HWND | hwndLstSrc
 | ) |  |

Definition at line 2645 of file common.cpp.

{
  ASSERT(hToWnd && hFromWnd);

  //Make both windows synched,
  //Get the current selection from the Source
  INDEX iItem = (INDEX)SendMessage(hFromWnd, LVM_GETNEXTITEM, (WPARAM)-1, (LPARAM)LVNI_SELECTED);

  //Tell the Target to select the same selection
  if(iItem != LVM_ERR)
  {
    //Get the current selection from the Target and Unselect it
    INDEX iOldItem = (INDEX)SendMessage(hToWnd, LVM_GETNEXTITEM, (WPARAM)-1, (LPARAM)LVNI_SELECTED);
    if(iItem != iOldItem)
    {
      //Unselect previous one
      LV_SetItemState(hToWnd, iOldItem, 0, 0, LVIS_SELECTED);

      //Select the new one
      LV_SetItemState(hToWnd, iItem, 0, LVIS_SELECTED, LVNI_SELECTED);

      //Ensure that it is visible
      SendMessage(hToWnd, LVM_ENSUREVISIBLE, (WPARAM)iItem, (LPARAM)FALSE);
    }
  }
}

HRESULT VariantChangeFast | ( | VARIANT * | pVarDest,
 |  | VARIANT * | pVarSrc,
 |  | LCID | lcid,
 |  | USHORT | wFlags,
 |  | VARTYPE | vt
 | ) |  |

Definition at line 817 of file common.cpp.

{
  HRESULT hr = S_OK;
  static LCID lcidDef = GetSystemDefaultLCID();

  //Delegate...
  TESTC(hr = VariantChangeTypeEx(
    pVarDest, // Destination (convert in place)
    pVarSrc,  // Source
    lcid != ULONG_MAX ? lcid : lcidDef,   // LCID
    wFlags,   // dwFlags
    vt ));

CLEANUP:
  return hr;
}

HRESULT VariantClearFast ( VARIANT * pVariant )

Definition at line 746 of file common.cpp.

{
  ASSERT(pVariant);
  HRESULT hr = S_OK;

  switch(V_VT(pVariant))
  {
    case VT_EMPTY:
      break;

    case VT_NULL:
    case VT_I8:
      V_VT(pVariant) = VT_EMPTY;
      break;

    default:
      //Nice to know if this fails, display error
      XTESTC(hr = VariantClear(pVariant));
      break;
  }

CLEANUP:
  return hr;
}

HRESULT VariantCopyFast | ( | VARIANT * | pVarDest,
 |  | VARIANT * | pVarSrc
 | ) |  |

Definition at line 777 of file common.cpp.

{
  ASSERT(pVarDest);
  ASSERT(pVarSrc);
  HRESULT hr = S_OK;

  //First Free the Destination.
  //NOTE: This is the same symmantics as VariantCopy.  We do this always since
  //we know how to clear other types as well...
  TESTC(hr = VariantClearFast(pVarDest));

  //Now do the copy...
  switch(V_VT(pVarSrc))
  {
    case VT_EMPTY:
    case VT_NULL:
      V_VT(pVarDest) = V_VT(pVarSrc);
      break;

    case VT_I8:
      V_VT(pVarDest) = V_VT(pVarSrc);
      pVarDest->ullVal = pVarSrc->ullVal;
      break;

    default:
      //Nice to know if this fails, display error
      XTESTC(hr = VariantCopy(pVarDest, pVarSrc));
      break;
  };

CLEANUP:
  return hr;
}

HRESULT VariantInitFast ( VARIANT * pVariant )

Definition at line 733 of file common.cpp.

{
  ASSERT(pVariant);
  V_VT(pVariant) = VT_EMPTY;

  return S_OK;
}

HRESULT VariantToString | ( | VARIANT * | pVariant,
 |  | WCHAR * | pwsz,
 |  | DBLENGTH | ulMaxSize,
 |  | DWORD | dwFlags
 | ) |  |

Definition at line 841 of file common.cpp.

{
  //No-op
  if(!ulMaxSize)
    return S_OK;

  //Convert a VARIANT to a WCHAR
  ASSERT(pVariant);
  ASSERT(pwsz);
  pwsz[0] = EOL;

  //Find the VariantType
  DBTYPE wType = V_VT(pVariant);
  CVariant cVariant;
  HRESULT hr = S_OK;

  //VT_ARRAY is not handled by VariantChangeType
  if(wType & VT_ARRAY)
  {
    TESTC(hr = SafeArrayToString(V_ARRAY(pVariant), wType, pwsz, ulMaxSize));
    goto CLEANUP;
  }

  switch(wType)
  {
    case VT_NULL:
    case VT_EMPTY:
      //pwsz is already set to null terminator above
      break;

    case VT_BOOL:
      if(V_BOOL(pVariant) == VARIANT_TRUE)
        StringFormat(pwsz, ulMaxSize, L"%s", dwFlags & CONV_VARBOOL ? L"VARIANT_TRUE" : L"True");
      else if(V_BOOL(pVariant) == VARIANT_FALSE)
        StringFormat(pwsz, ulMaxSize, L"%s", dwFlags & CONV_VARBOOL ? L"VARIANT_FALSE" : L"False");
      else
        StringFormat(pwsz, ulMaxSize, L"%d", V_BOOL(pVariant));
      break;

    case VT_ERROR:
      StringFormat(pwsz, ulMaxSize, L"%d", V_ERROR(pVariant));
      break;

    case VT_I8:
    {
      //TODO64: OLEAUT doesn't have support for this type yet, so we have to special case...
//      StringFormat(pwsz, ulMaxSize, L"%ld", V_I8(pVariant));
      StringFormat(pwsz, ulMaxSize, L"%ld", pVariant->ullVal);
      break;
    }

    default:
    {
      TESTC(hr = VariantChangeFast(
        &cVariant,  // Destination (convert not in place)
        pVariant, // Source
        ULONG_MAX,  // LCID
        0,      // dwFlags
        VT_BSTR ));

      StringCopy(pwsz, V_BSTR(&cVariant), ulMaxSize);

      //May need Hex postprocessing
      if(dwFlags & CONV_HEX)
      {
        switch(V_VT(pVariant))
        {
          case DBTYPE_I4:
            //"0x" + 10 characters
            if(ulMaxSize >= 12)
              StringFormat(pwsz, ulMaxSize, L"0x%x", V_I4(pVariant));
            break;
        }
      }
    }
  };

CLEANUP:
  pwsz[ulMaxSize ? ulMaxSize-1 : 0] = wEOL;
  return hr;
}

HRESULT VectorToString | ( | DBVECTOR * | pVector,
 |  | DBTYPE | wType,
 |  | WCHAR * | pwszBuffer,
 |  | DBLENGTH | ulMaxSize
 | ) |  |

Definition at line 1460 of file common.cpp.

{
  ASSERT(pVector);
  ASSERT(pwszBuffer);
  HRESULT hr = S_OK;

  //No-op
  if(!ulMaxSize)
    return S_OK;

  VARIANT Variant;
  VARIANT* pVariant = NULL;
  WCHAR* pwsz = pwszBuffer;
  WCHAR* pwszEnd = pwsz + ulMaxSize;
  pwsz[0] = wEOL;

  //Make sure we are dealing with the base type...
  wType &= ~DBTYPE_VECTOR;

  //Loop over the vector...
  for(ULONG iEle=0; iEle<pVector->size; iEle++)
  {
    //Initialize Variant
    pVariant = &Variant;
    pVariant->vt = VT_EMPTY;

    //NOTE: The pVariant is really just a pointer to the data.  We don't free the data
    //since the vector data doesn't belong to us, we are just convering the given data to
    //a string.  The simplest way to do this is to dump into a variant and let our helper
    //function VariantToString deal with this...

    //Obtain the data from the vector...
    switch(wType)
    {
      case VT_EMPTY:
      case VT_NULL:
        V_VT(pVariant) = wType;
        break;

      case VT_I2:
      case VT_I4:
      case VT_R4:
      case VT_R8:
      case VT_CY:
      case VT_DATE:
      case VT_BSTR:
      case VT_DISPATCH:
      case VT_ERROR:
      case VT_BOOL:
      case VT_UNKNOWN:
      case VT_I1:
      case VT_UI1:
      case VT_UI2:
      case VT_UI4:
      case VT_I8:
      case VT_UI8:
      case VT_INT:
      case VT_UINT:
      {
        DBLENGTH ulTypeSize = 0;
        if(SUCCEEDED(GetDBTypeMaxSize(wType, &ulTypeSize)))
        {
          V_VT(pVariant) = wType;
          memcpy(&V_I4(pVariant), (BYTE*)pVector->ptr + (ulTypeSize*iEle), (size_t)ulTypeSize);
        }
        break;
      }

      case VT_VARIANT:
        //just place directly into our variant.
        pVariant = (VARIANT*)((BYTE*)pVector->ptr + (sizeof(VARIANT)*iEle));
        break;

      case VT_DECIMAL:
        //DECIMAL is not part of the VARIANT union
        V_VT(pVariant)    = wType;
        V_DECIMAL(pVariant) = *(DECIMAL*)((BYTE*)pVector->ptr + (sizeof(DECIMAL)*iEle));
        break;

      default:
        //Unable to handle this type...
        TESTC(hr = E_FAIL);
    }

    //Convert VARIANT To String
    TESTC(hr = VariantToString(pVariant, pwsz, pwszEnd - pwsz, CONV_NONE));
    pwsz += wcslen(pwsz);

    //Vector Seperator
    if(iEle<pVector->size-1 && (pwsz < pwszEnd))
    {
      *pwsz = L',';
      pwsz++;
    }
  }

CLEANUP:
  return hr;
}

WCHAR* wcsDuplicate ( LPCWSTR pwsz )

Definition at line 1698 of file common.cpp.

{
  HRESULT hr = S_OK;

  //no-op case
  if(!pwsz)
    return NULL;

  ULONG cLen  = wcslen(pwsz);

  //Allocate space for the string
  WCHAR* pwszBuffer = NULL;
  SAFE_ALLOC(pwszBuffer, WCHAR, cLen+1);

  //Now copy the string
  StringCopy(pwszBuffer, pwsz, cLen+1);

CLEANUP:
  return pwszBuffer;
}

WCHAR* wGetWindowText ( HWND hWnd )

Definition at line 3098 of file common.cpp.

{
  //Dynamic Memory Version of the the WinAPI GetWindowText
  WCHAR* pwsz = NULL;
  HRESULT hr = S_OK;

  //First obtain the length of the string
  LRESULT iLength = SendMessage(hWnd, WM_GETTEXTLENGTH, 0, 0);
  if(iLength>0)
  {
    LRESULT iActLength = 0;

    //Allocate our string
    SAFE_ALLOC(pwsz, WCHAR, iLength+1);

    //Now get the text from the window...
    iActLength = wSendMessage(hWnd, WM_GETTEXT, iLength+1, pwsz);

    //Ensure NULL terminated...
    pwsz[iActLength>0 ? min(iActLength, iLength) : 0] = wEOL;
  }

CLEANUP:
  return pwsz;
}

INT wMessageBox | ( | HWND | hDlg,
 |  | UINT | uiStyle,
 |  | WCHAR * | pwszTitle,
 |  | WCHAR * | pwszFmt,
 |  |  | ...
 | ) |  |

Definition at line 2942 of file common.cpp.

{
  va_list   marker;
  WCHAR   wszBuffer[MAX_QUERY_LEN];

  // Use format and arguements as input
  //This version will not overwrite the stack, since it only copies
  //upto the max size of the array
  va_start(marker, pwszFmt);
  _vsnwprintf(wszBuffer, MAX_QUERY_LEN, pwszFmt, marker);
  va_end(marker);

  //Make sure there is a NULL Terminator, vsnwprintf will not copy
  //the terminator if length==MAX_QUERY_LEN
  wszBuffer[MAX_QUERY_LEN-1] = wEOL;

  //Unicode version is supported on both Win95/WinNT
  return MessageBoxW(hwnd, wszBuffer, pwszTitle, uiStyle);
}

LRESULT wSendMessage | ( | HWND | hWnd,
 |  | UINT | Msg,
 |  | WPARAM | wParam,
 |  | WCHAR * | pwszText
 | ) |  |

Definition at line 2973 of file common.cpp.

{
  LRESULT lResult = 0;
  HRESULT hr = S_OK;

  if(IsUnicodeOS())
  {
    //WinNT - Unicode, no need for conversions...
    lResult = SendMessageW(hWnd, Msg, (WPARAM)wParam, (LPARAM)pwszText);
  }
  else
  {
    //Win95 - Unicode not supported...
    CHAR szBuffer[MAX_QUERY_LEN] = { 0, 0, 0, 0 };
    ULONG ulDestSize = MAX_QUERY_LEN;
    CHAR* psz = szBuffer;

    //All messages that have [input] strings
    switch(Msg)
    {
      case EM_GETLINE:
        ((WORD*)psz)[0] = MAX_QUERY_LEN;
        break;

      case WM_GETTEXT:
        //We may need to dynamically allocate this...
        if(wParam > MAX_QUERY_LEN)
          SAFE_ALLOC(psz, CHAR, wParam);
        break;

      case EM_GETSELTEXT:
        ASSERT(wParam && "wSendMessage EM_GETSELTEXT requires a length so the conversion buffer so it doesn't overflow...");
        ulDestSize = (ULONG)wParam;

        //We may need to dynamically allocate this...
        if(wParam > MAX_QUERY_LEN)
          SAFE_ALLOC(psz, CHAR, wParam);
        wParam = 0;
        break;

      case SB_SETTEXTW:
        Msg = SB_SETTEXT;

      case WM_SETTEXT:
      case EM_REPLACESEL:
      case CB_FINDSTRINGEXACT:
      case CB_FINDSTRING:
      case CB_ADDSTRING:
      case LB_ADDSTRING:
      case SB_SETTEXTA:
        //Convert to ANSI before sending
        //We may need to dynamically allocate this...
        if(!ConvertToMBCS(pwszText, psz, MAX_QUERY_LEN))
          psz = ConvertToMBCS(pwszText);
        break;
    };

    //Send the message with an ANSI Buffer
    lResult = SendMessageA(hWnd, Msg, (WPARAM)wParam, (LPARAM)psz);

    //All messages that have [output] messages (return strings)
    switch(Msg)
    {
      case WM_GETTEXT:
        //Now convert the result into the users WCHAR buffer
        //wParam indicates the max length
        ConvertToWCHAR(psz, pwszText, (INT)wParam);
        break;

      case EM_GETLINE:
        //Now convert the result into the users WCHAR buffer
        ASSERT(pwszText);
        ConvertToWCHAR(psz, pwszText, ((WORD*)pwszText)[0]);
        break;

      case CB_GETLBTEXT:
      case EM_GETSELTEXT:
      case LB_GETTEXT:
        //Now convert the result into the users WCHAR buffer
        ConvertToWCHAR(psz, pwszText, ulDestSize);
        break;
    };

    //Free any dynamically allocated memory
    if(psz != szBuffer)
      SAFE_FREE(psz);
  }

CLEANUP:
  return lResult;
}

LRESULT wSendMessageFmt | ( | HWND | hWnd,
 |  | UINT | Msg,
 |  | WPARAM | wParam,
 |  | WCHAR * | pwszFmt,
 |  |  | ...
 | ) |  |

Definition at line 3070 of file common.cpp.

{
  ASSERT(pwszFmt);
  ASSERT(wParam != WM_GETTEXT);

  va_list   marker;
  WCHAR   wszBuffer[MAX_QUERY_LEN];

  // Use format and arguements as input
  //This version will not overwrite the stack, since it only copies
  //upto the max size of the array
  va_start(marker, pwszFmt);
  _vsnwprintf(wszBuffer, MAX_QUERY_LEN, pwszFmt, marker);
  va_end(marker);

  //Make sure there is a NULL Terminator, vsnwprintf will not copy
  //the terminator if length==MAX_QUERY_LEN
  wszBuffer[MAX_QUERY_LEN-1] = wEOL;

  //Delegate
  return wSendMessage(hWnd, Msg, wParam, wszBuffer);
}

Variable Documentation

CComPtr<IDataConvert> g_spDataConvert

Definition at line 32 of file common.cpp.

const BOOL HANDLED_MSG = TRUE

Definition at line 93 of file common.h.

const COLORREF RGB_BLUE = RGB(0, 0, 0xff)

Definition at line 75 of file common.h.

const COLORREF RGB_BROWN = RGB(0x80, 0x40, 0)

Definition at line 81 of file common.h.

const COLORREF RGB_DARK_BLUE = RGB(0, 0, 0x80)

Definition at line 76 of file common.h.

const COLORREF RGB_DARK_GREEN = RGB(0, 0x80, 0)

Definition at line 78 of file common.h.

const COLORREF RGB_DARK_RED = RGB(0x80, 0, 0)

Definition at line 80 of file common.h.

const COLORREF RGB_GREEN = RGB(0, 0xff, 0)

Definition at line 77 of file common.h.

const COLORREF RGB_NONE = 0

Definition at line 83 of file common.h.

const COLORREF RGB_RED = RGB(0xff, 0, 0)

Definition at line 79 of file common.h.

const BOOL UNHANDLED_MSG = FALSE

Definition at line 94 of file common.h.

WCHAR wsz_ERROR[]
WCHAR wsz_ERRORINFO[]
WCHAR wsz_EXCEPTION[]
WCHAR wsz_INFO[]
WCHAR wsz_INVALID_VALUE_[]
WCHAR wsz_SUCCESS[]
WCHAR wsz_WARNING[]
Generated on Wed Nov 13 2024 16:53:11 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/coptions.cpp File Reference

  • Dataaccess
  • oledb
  • rowsetviewer

coptions.cpp File Reference

#include "Headers.h"
#include "COptions.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/coptions.h File Reference

  • Dataaccess
  • oledb
  • rowsetviewer
Classes | Enumerations

coptions.h File Reference

Go to the source code of this file.

Classes

class | COptionsAccessor
class | COptionsCommand
class | COptionsDataSource
class | COptionsError
class | COptionsNotify
class | COptionsRowset
class | COptionsSheet

Enumerations

enum ACCESSOR_OPTIONS {
ACCESSOR_BIND_VALUE = 0x00000001, ACCESSOR_BIND_LENGTH = 0x00000002, ACCESSOR_BIND_STATUS = 0x00000004, ACCESSOR_BIND_BOOKMARK = 0x00000008,
ACCESSOR_BLOB_ISEQSTREAM = 0x00000010, ACCESSOR_BLOB_ILOCKBYTES = 0x00000020, ACCESSOR_BLOB_ISTORAGE = 0x00000040, ACCESSOR_BLOB_ISTREAM = 0x00000080,
ACCESSOR_OWNED_PROVIDER = 0x00001000
}
enum | COMMAND_OPTIONS { COMMAND_ROWSAFFECTED = 0x00000001, COMMAND_RELEASE_OPENOBJECTS = 0x00000002 }
enum CREATE_OPTIONS {
CREATE_INITIALIZE = 0x00000001, CREATE_SETPROPERTIES = 0x00000002, CREATE_USESERVICECOMP = 0x00000010, CREATE_NEWWINDOW = 0x00000100,
CREATE_NEWWINDOW_IFEXISTS = 0x00000200, CREATE_FINDWINDOW = 0x00000400, CREATE_NODISPLAY = 0x00000800, CREATE_CURSORENGINE = 0x00001000,
CREATE_RESTARTPOSITION = 0x00002000, CREATE_DETERMINE_TYPE = 0x00004000, CREATE_NO_AUTOSAVE = 0x00010000, CREATE_QI_MANDATORY = 0x00100000,
CREATE_QI_OPTIONAL = 0x00200000
}
enum NOTIFY_OPTIONS {
NOTIFY_OLEDB = 0x00000001, NOTIFY_ADDREF = 0x00000008, NOTIFY_RELEASE = 0x00000010, NOTIFY_QI = 0x00000020,
NOTIFY_TRACEPROVIDER = 0x01000000, NOTIFY_IDBASYNCHNOTIFY = 0x00000100, NOTIFY_IROWSETNOTIFY = 0x00000200, NOTIFY_IROWPOSITIONCHANGE = 0x00000400,
NOTIFY_PROMPTVETO = 0x00010000, NOTIFY_IPOOLNOTIFY = 0x00100000
}
enum ROWSET_OPTIONS {
ROWSET_SETDEFAULTPROPS = 0x00000004, ROWSET_ROWSTOFETCH = 0x00000100, ROWSET_NODATA = 0x00000200, ROWSET_HIDDENCOLUMNS = 0x00001000,
ROWSET_ALWAYSRELEASEROWS = 0x00010000
}

Enumeration Type Documentation

enum ACCESSOR_OPTIONS
Enumerator:
ACCESSOR_BIND_VALUE
ACCESSOR_BIND_LENGTH
ACCESSOR_BIND_STATUS
ACCESSOR_BIND_BOOKMARK
ACCESSOR_BLOB_ISEQSTREAM
ACCESSOR_BLOB_ILOCKBYTES
ACCESSOR_BLOB_ISTORAGE
ACCESSOR_BLOB_ISTREAM
ACCESSOR_OWNED_PROVIDER

Definition at line 47 of file coptions.h.

{
  ACCESSOR_BIND_VALUE     = 0x00000001, //DBPART_VALUE
  ACCESSOR_BIND_LENGTH    = 0x00000002, //DBPART_LENGTH
  ACCESSOR_BIND_STATUS    = 0x00000004, //DBPART_STATUS
  ACCESSOR_BIND_BOOKMARK    = 0x00000008,

  ACCESSOR_BLOB_ISEQSTREAM  = 0x00000010,
  ACCESSOR_BLOB_ILOCKBYTES  = 0x00000020,
  ACCESSOR_BLOB_ISTORAGE    = 0x00000040,
  ACCESSOR_BLOB_ISTREAM   = 0x00000080,

  ACCESSOR_OWNED_PROVIDER   = 0x00001000
};

enum COMMAND_OPTIONS
Enumerator:
COMMAND_ROWSAFFECTED
COMMAND_RELEASE_OPENOBJECTS

Definition at line 41 of file coptions.h.

{
  COMMAND_ROWSAFFECTED    = 0x00000001,
  COMMAND_RELEASE_OPENOBJECTS = 0x00000002
};

enum CREATE_OPTIONS
Enumerator:
CREATE_INITIALIZE
CREATE_SETPROPERTIES
CREATE_USESERVICECOMP
CREATE_NEWWINDOW
CREATE_NEWWINDOW_IFEXISTS
CREATE_FINDWINDOW
CREATE_NODISPLAY
CREATE_CURSORENGINE
CREATE_RESTARTPOSITION
CREATE_DETERMINE_TYPE
CREATE_NO_AUTOSAVE
CREATE_QI_MANDATORY
CREATE_QI_OPTIONAL

Definition at line 19 of file coptions.h.

{
  CREATE_INITIALIZE     = 0x00000001,
  CREATE_SETPROPERTIES    = 0x00000002,

  CREATE_USESERVICECOMP   = 0x00000010,
//  CREATE_USETRACEPROVIDER   = 0x00000020,

  CREATE_NEWWINDOW      = 0x00000100,
  CREATE_NEWWINDOW_IFEXISTS = 0x00000200,
  CREATE_FINDWINDOW     = 0x00000400,
  CREATE_NODISPLAY      = 0x00000800,

  CREATE_CURSORENGINE     = 0x00001000,
  CREATE_RESTARTPOSITION    = 0x00002000,
  CREATE_DETERMINE_TYPE   = 0x00004000,

  CREATE_NO_AUTOSAVE      = 0x00010000,
  CREATE_QI_MANDATORY     = 0x00100000,
  CREATE_QI_OPTIONAL      = 0x00200000
};

enum NOTIFY_OPTIONS
Enumerator:
NOTIFY_OLEDB
NOTIFY_ADDREF
NOTIFY_RELEASE
NOTIFY_QI
NOTIFY_TRACEPROVIDER
NOTIFY_IDBASYNCHNOTIFY
NOTIFY_IROWSETNOTIFY
NOTIFY_IROWPOSITIONCHANGE
NOTIFY_PROMPTVETO
NOTIFY_IPOOLNOTIFY

Definition at line 73 of file coptions.h.

{
  NOTIFY_OLEDB        = 0x00000001,
  NOTIFY_ADDREF       = 0x00000008,
  NOTIFY_RELEASE        = 0x00000010,
  NOTIFY_QI         = 0x00000020,

  //Trace Provider
  NOTIFY_TRACEPROVIDER    = 0x01000000,

  //Notifications
  NOTIFY_IDBASYNCHNOTIFY    = 0x00000100,
  NOTIFY_IROWSETNOTIFY    = 0x00000200,
  NOTIFY_IROWPOSITIONCHANGE = 0x00000400,

  NOTIFY_PROMPTVETO     = 0x00010000,
  NOTIFY_IPOOLNOTIFY      = 0x00100000,
};

enum ROWSET_OPTIONS
Enumerator:
ROWSET_SETDEFAULTPROPS
ROWSET_ROWSTOFETCH
ROWSET_NODATA
ROWSET_HIDDENCOLUMNS
ROWSET_ALWAYSRELEASEROWS

Definition at line 62 of file coptions.h.

{
  ROWSET_SETDEFAULTPROPS    = 0x00000004,
  ROWSET_ROWSTOFETCH      = 0x00000100,
  ROWSET_NODATA       = 0x00000200,

  ROWSET_HIDDENCOLUMNS    = 0x00001000,

  ROWSET_ALWAYSRELEASEROWS  = 0x00010000
};

Generated on Wed Nov 13 2024 16:53:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/crow.cpp File Reference

  • Dataaccess
  • oledb
  • rowsetviewer

crow.cpp File Reference

#include "Headers.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/crow.h File Reference

  • Dataaccess
  • oledb
  • rowsetviewer
Classes

crow.h File Reference

#include "CRowset.h"

Go to the source code of this file.

Classes

class CRow
Generated on Wed Nov 13 2024 16:53:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/crowposition.cpp File Reference

  • Dataaccess
  • oledb
  • rowsetviewer

crowposition.cpp File Reference

#include "Headers.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/crowposition.h File Reference

  • Dataaccess
  • oledb
  • rowsetviewer
Classes

crowposition.h File Reference

Go to the source code of this file.

Classes

class CRowPosition
Generated on Wed Nov 13 2024 16:53:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/crowset.cpp File Reference

  • Dataaccess
  • oledb
  • rowsetviewer

crowset.cpp File Reference

#include "Headers.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/crowset.h File Reference

  • Dataaccess
  • oledb
  • rowsetviewer
Classes | Enumerations

crowset.h File Reference

Go to the source code of this file.

Classes

class | CBindings
class | CColumnInfo
class | CDataAccess
class | CRowset

Enumerations

enum | BINDCOLS { BIND_ALLCOLS = 0x00000001, BIND_ALLCOLSEXPECTBOOKMARK = 0x00000002, BIND_UPDATEABLECOLS = 0x00000004 }

Enumeration Type Documentation

enum BINDCOLS
Enumerator:
BIND_ALLCOLS
BIND_ALLCOLSEXPECTBOOKMARK
BIND_UPDATEABLECOLS

Definition at line 19 of file crowset.h.

{
  BIND_ALLCOLS        = 0x00000001,
  BIND_ALLCOLSEXPECTBOOKMARK  = 0x00000002,
  BIND_UPDATEABLECOLS     = 0x00000004
};

Generated on Wed Nov 13 2024 16:53:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/csession.cpp File Reference

  • Dataaccess
  • oledb
  • rowsetviewer

csession.cpp File Reference

#include "Headers.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/csession.h File Reference

  • Dataaccess
  • oledb
  • rowsetviewer
Classes

csession.h File Reference

#include "CTransaction.h"

Go to the source code of this file.

Classes

class | CSession
struct | PROVTYPEINFO
Generated on Wed Nov 13 2024 16:53:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/cstream.cpp File Reference

  • Dataaccess
  • oledb
  • rowsetviewer

cstream.cpp File Reference

#include "Headers.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/cstream.h File Reference

  • Dataaccess
  • oledb
  • rowsetviewer
Classes

cstream.h File Reference

Go to the source code of this file.

Classes

class | CFileStream
class | CStorageBuffer
class | CStream
Generated on Wed Nov 13 2024 16:53:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/ctrace.cpp File Reference

  • Dataaccess
  • oledb
  • rowsetviewer

ctrace.cpp File Reference

#include "Headers.h"
#include "CTrace.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/ctrace.h File Reference

  • Dataaccess
  • oledb
  • rowsetviewer
Classes | Defines

ctrace.h File Reference

Go to the source code of this file.

Classes

class | CIntTrace
class | CMDITrace

Defines

#define | TRACE_ADDREF CIntTrace::TraceAddRef
#define | TRACE_METHOD CIntTrace::TraceMethod
#define | TRACE_NOTIFICATION CIntTrace::TraceNotification
#define | TRACE_QI CIntTrace::TraceQI
#define | TRACE_RELEASE(pv, name) TRACE_RELEASE_(pv, name, 1)
#define | TRACE_RELEASE_(pv, name, ulExpectedRef) CIntTrace::TraceRelease((IUnknown**)&pv, name, ulExpectedRef);

Define Documentation

#define TRACE_ADDREF CIntTrace::TraceAddRef

Definition at line 25 of file ctrace.h.

#define TRACE_METHOD CIntTrace::TraceMethod

Definition at line 27 of file ctrace.h.

#define TRACE_NOTIFICATION CIntTrace::TraceNotification

Definition at line 28 of file ctrace.h.

#define TRACE_QI CIntTrace::TraceQI

Definition at line 26 of file ctrace.h.

#define TRACE_RELEASE | ( | pv,
 |  | name |
 | ) |  | TRACE_RELEASE_(pv, name, 1)

Definition at line 30 of file ctrace.h.

#define TRACE_RELEASE_ | ( | pv,
 |  | name,
 |  | ulExpectedRef |
 | ) |  | CIntTrace::TraceRelease((IUnknown**)&pv, name, ulExpectedRef);

Definition at line 29 of file ctrace.h.

Generated on Wed Nov 13 2024 16:53:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/ctransaction.cpp File Reference

  • Dataaccess
  • oledb
  • rowsetviewer

ctransaction.cpp File Reference

#include "Headers.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/ctransaction.h File Reference

  • Dataaccess
  • oledb
  • rowsetviewer
Classes

ctransaction.h File Reference

Go to the source code of this file.

Classes

class | CTransaction
class | CTransactionOptions
Generated on Wed Nov 13 2024 16:53:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/cwinapp.cpp File Reference

  • Dataaccess
  • oledb
  • rowsetviewer
Variables

cwinapp.cpp File Reference

#include "Headers.h"
#include "CWinApp.h"

Go to the source code of this file.

Variables

CWinApp theApp

Variable Documentation

CWinApp theApp

Definition at line 47 of file cwinapp.cpp.

Generated on Wed Nov 13 2024 16:53:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/cwinapp.h File Reference

  • Dataaccess
  • oledb
  • rowsetviewer
Classes

cwinapp.h File Reference

#include "CDialogLite.h"
#include "Spy.h"
#include "Spy.h"

Go to the source code of this file.

Classes

class CWinApp
Generated on Wed Nov 13 2024 16:53:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/error.cpp File Reference

  • Dataaccess
  • oledb
  • rowsetviewer
Functions | Variables

error.cpp File Reference

#include "Headers.h"

Go to the source code of this file.

Functions

HRESULT | DisplayAccessorErrors (HRESULT hrReturned, DBCOUNTITEM cBindings, const DBBINDING *rgBindings, DBBINDSTATUS *rgStatus)
HRESULT | DisplayAllErrors (HRESULT hrActual, WCHAR *pwszFile, ULONG ulLine, INT *piResult)
HRESULT | DisplayAllErrors (HRESULT hrActual, HRESULT hrExpected, WCHAR *pwszFile, ULONG ulLine, INT *piResult)
HRESULT | DisplayBindingErrors (HRESULT hrReturned, DBCOUNTITEM cBindings, const DBBINDING *rgBindings, void *pData)
HRESULT | DisplayColAccessErrors (HRESULT hrReturned, DBORDINAL cColAccess, DBCOLUMNACCESS *rgColAccess)
HRESULT | DisplayColumnErrors (HRESULT hrReturned, DBORDINAL cColumns, DBID *rgColumns, DBSTATUS *rgStatus)
HRESULT | DisplayErrorInfo (HRESULT hrActual, WCHAR *pwszFile, ULONG ulLine, INT *piResult)
HRESULT | DisplayHRESULT (HRESULT hrActual, WCHAR *pwszFile, ULONG ulLine, INT *piResult)
HRESULT | DisplayPropErrors (HRESULT hrReturned, ULONG cPropInfoSets, DBPROPINFOSET *rgPropInfoSets)
HRESULT | DisplayPropErrors (HRESULT hrReturned, REFIID riid, IUnknown *pIUnknown)
HRESULT | DisplayPropErrors (HRESULT hrReturned, ULONG cPropSets, DBPROPSET *rgPropSets)
HRESULT | DisplayRefCountErrors (WCHAR *pwszName, ULONG ulActRefCount, ULONG ulExpRefCount)
HRESULT | DisplayRowErrors (HRESULT hrReturned, DBROWCOUNT cRows, HROW *rghRows, DBROWSTATUS *rgRowStatus)
HRESULT | DisplayWinError (DWORD dwError, WCHAR *pwszFile, LONG lLine, WCHAR *pwszText)
HRESULT | GetAllocedPropInfo (ULONG cPropertyIDSets, DBPROPIDSET *rgPropertyIDSets, ULONG *pcPropInfoSets, DBPROPINFOSET **prgPropInfoSets)
WCHAR * | GetAsynchPhase (ULONG ulAsynchPhase)
WCHAR * | GetAsynchReason (ULONG ulOperation)
WCHAR * | GetBitMapName (DWORD dwItem, ULONG cNameMap, const WIDENAMEMAP *rgNameMap, DWORD dwBitStart)
WCHAR * | GetDialectName (REFGUID rguid)
CHAR * | GetErrorName (HRESULT hr)
BOOL | GetErrorPosting (ERRORPOST eErrorPost)
WCHAR * | GetInterfaceName (REFIID riid)
WCHAR * | GetMapName (const DBID *pDBID, ULONG cMap, const WIDEDBIDMAP *rgMap)
WCHAR * | GetMapName (LONG lItem, ULONG cNameMap, const WIDENAMEMAP *rgNameMap, DWORD dwConvFlags)
LONG | GetMapName (CHAR *psz, ULONG cNameMap, const NAMEMAP *rgNameMap)
WCHAR * | GetMapName (REFGUID guid, ULONG cGuidMap, const WIDEGUIDMAP *rgGuidMap)
CHAR * | GetMapName (LONG lItem, ULONG cNameMap, const NAMEMAP *rgNameMap)
LONG | GetMapName (WCHAR *pwsz, ULONG cNameMap, const WIDENAMEMAP *rgNameMap)
WCHAR * | GetObjectTypeName (REFGUID rguidObjectType)
WCHAR * | GetPhaseName (DBEVENTPHASE ePhase)
WCHAR * | GetPropertyName (DBPROPID dwPropertyID, REFGUID guidPropertySet)
WCHAR * | GetPropSetName (REFGUID guidPropertySet)
WCHAR * | GetPropStatusName (DBPROPSTATUS dbPropStatus)
WCHAR * | GetReasonName (DBREASON eReason)
WCHAR * | GetRowColName (const DBID *pColumnid)
HRESULT | GetSqlErrorInfo (ULONG iRecord, IErrorRecords *pIErrorRecords, BSTR *pBstr, LONG *plNativeError)
HRESULT | GetStaticPropInfo (ULONG cPropertyIDSets, DBPROPIDSET *rgPropertyIDSets, ULONG *pcStaticInfoSets, const DBPROPINFOSET **prgStaticInfoSets)
HRESULT | GetStaticPropValues (DBPROPID dwPropertyID, REFGUID guidPropertySet, ULONG *pcPropValMap, const WIDENAMEMAP **prgPropValMap)
WCHAR * | GetStatusName (DBSTATUS dbStatus, DWORD dwConvFlags)
DBSTATUS | GetStatusValue (WCHAR *pwszName)
BOOL | IsSpecialPropSet (REFGUID guidSpecialPropertySet, GUID *pGuidPropertySet)
BOOL | SetErrorPosting (ERRORPOST eErrorPost, BOOL fSet)

Variables

const GUID | DBGUID_MSSQLXML = {0x5d531cb2L,0xe6ed,0x11d2,{0xb2,0x52,0x00,0xc0,0x4f,0x68,0x1b,0x71}}
const GUID | DBGUID_XPATH = {0xec2a4293L,0xe898,0x11d2,{0xb1,0xb7,0x00,0xc0,0x4f,0x68,0x0c,0x56}}
DWORD | g_dwBreakID = 0
DWORD | g_dwErrorPost = EP_ERRORINFO_FAILURE | EP_HRESULT_NOERRORINFO

Function Documentation

HRESULT DisplayAccessorErrors | ( | HRESULT | hrReturned,
 |  | DBCOUNTITEM | cBindings,
 |  | const DBBINDING * | rgBindings,
 |  | DBBINDSTATUS * | rgStatus
 | ) |  |

Definition at line 3180 of file error.cpp.

{
  //Display the badstatus for row operations.
  INT iSelect = 0;

  //Binding Errors only occur with the following returned codes...
  if(hrReturned!=DB_S_ERRORSOCCURRED && hrReturned!=DB_E_ERRORSOCCURRED)
    return hrReturned;

  //Display any binding errors
  for(ULONG i=0; i<cBindings; i++)
  {
    ASSERT(rgBindings);
    ASSERT(rgStatus);

    switch(rgStatus[i])
    {
      case DBBINDSTATUS_OK:
        break;

      //Display BindStatus Error to the user...
      default:
      {
        iSelect = wMessageBox(GetFocus(), MB_TASKMODAL | MB_ICONERROR | MB_OKCANCEL, wsz_ERROR,
          L"Accessor BindStatus Errors:\n"
          L"rgBindings[%lu]\n\n"
          L"iOrdinal = %ld\n"
          L"wType = %s\n"
          L"cbMaxLen = %lu\n"
          L"bPrecision = %d\n"
          L"bScale = %d\n\n"
          L"DBBINDSTATUS = %s",
          i,
          rgBindings[i].iOrdinal,
          GetDBTypeName(rgBindings[i].wType),
          rgBindings[i].cbMaxLen,
          rgBindings[i].bPrecision,
          rgBindings[i].bScale,
          GetMapName(rgStatus[i], NUMELE(g_rgBindStatusMap), g_rgBindStatusMap)
          );

        if(iSelect == IDCANCEL)
        {
          //NOTE: Will return DB_E_CANCELED if the user doesn't wish to continue
          hrReturned = DB_E_CANCELED;
          goto CLEANUP;
        }
        break;
      }
    }
  }

CLEANUP:
  return hrReturned;
}

HRESULT DisplayAllErrors | ( | HRESULT | hrActual,
 |  | WCHAR * | pwszFile,
 |  | ULONG | ulLine,
 |  | INT * | piResult
 | ) |  |

Definition at line 3458 of file error.cpp.

{
  //Delegate
  //This function just verifies that the hreuslt succeeded...
  return DisplayAllErrors(hrActual, SUCCEEDED(hrActual) ? hrActual : S_OK, pwszFile, ulLine, piResult);
}

HRESULT DisplayAllErrors | ( | HRESULT | hrActual,
 |  | HRESULT | hrExpected,
 |  | WCHAR * | pwszFile,
 |  | ULONG | ulLine,
 |  | INT * | piResult
 | ) |  |

Definition at line 3469 of file error.cpp.

{
  BOOL bEqual = (hrActual == hrExpected) || (hrActual == S_OK);

  //First Display any ErrorInfo
  //NOTE: If ErrorInfo=Always, ErrorInfo is always displayed
  if((!bEqual || GetErrorPosting(EP_ERRORINFO_ALWAYS)) && !GetErrorPosting(EP_ERRORINFO_NEVER))
  {
    if(DisplayErrorInfo(hrActual, pwszFile, ulLine, piResult)==S_OK)
    {
      //We had ErrorInfo, no need to display error info
      //Unless the user has something other than NOERRORINFO selected
      if(GetErrorPosting(EP_HRESULT_NOERRORINFO))
        goto CLEANUP;
    }
  }

  //Second, Display the HRESULT, (if requested)
  //NOTE: If HRESULT=Always, Hresult is always displayed, except if S_OK is returned, otherwise you would always get message boxes...
  if((!bEqual || (hrActual!=S_OK && GetErrorPosting(EP_HRESULT_ALWAYS))) && !GetErrorPosting(EP_HRESULT_NEVER))
  {
    //Display the HRESULT
    DisplayHRESULT(hrActual, pwszFile, ulLine, piResult);
  }

CLEANUP:
  //We need to return a failure code if not equal, so we don't continue...
  if(!bEqual && SUCCEEDED(hrActual))
    return E_FAIL;

  return hrActual;
}

HRESULT DisplayBindingErrors | ( | HRESULT | hrReturned,
 |  | DBCOUNTITEM | cBindings,
 |  | const DBBINDING * | rgBindings,
 |  | void * | pData
 | ) |  |

Definition at line 2739 of file error.cpp.

{
  //Display the badstatus for pData operations.
  //(ie:  GetData / SetData / InsertRow)
  INT iSelect = 0;

  //Binding Errors only occur with the following returned codes...
  if(hrReturned!=DB_S_ERRORSOCCURRED && hrReturned!=DB_E_ERRORSOCCURRED)
    return hrReturned;

  for(ULONG i=0; i<cBindings; i++)
  {
    ASSERT(rgBindings);

    //If STATUS is not bound, we don't know if this binding failed or not.
    //And we can't really access the data or length, since we are not sure what the status is...
    if(!STATUS_IS_BOUND(rgBindings[i]))
      continue;

    DBSTATUS dbStatus = BINDING_STATUS(rgBindings[i], pData);
    DBLENGTH dbLength = LENGTH_IS_BOUND(rgBindings[i]) ? BINDING_LENGTH(rgBindings[i], pData) : 0;

    switch(dbStatus)
    {
      case DBSTATUS_S_OK:
      case DBSTATUS_S_ISNULL:
      case DBSTATUS_S_DEFAULT:
      case DBSTATUS_S_IGNORE:
        break;

      //Display Status Error to the user...
      default:
      {
        iSelect = wMessageBox(GetFocus(), MB_TASKMODAL | MB_ICONERROR | MB_OKCANCEL, wsz_ERROR,
          L"Binding Status Errors:\n"
          L"rgBindings[%lu]\n\n"
          L"iOrdinal = %ld\n"
          L"wType = %s\n"
          L"cbMaxLen = %lu\n"
          L"bPrecision = %d\n"
          L"bScale = %d\n\n"
          L"DBSTATUS = %s\n"
          L"DBLENGTH = %lu\n",
          i,
          rgBindings[i].iOrdinal,
          GetDBTypeName(rgBindings[i].wType),
          rgBindings[i].cbMaxLen,
          rgBindings[i].bPrecision,
          rgBindings[i].bScale,
          GetStatusName(dbStatus),
          dbLength
          );

        if(iSelect == IDCANCEL)
        {
          hrReturned = DB_E_CANCELED;
          goto CLEANUP;
        }
        break;
      }
    }
  }

CLEANUP:
  return hrReturned;
}

HRESULT DisplayColAccessErrors | ( | HRESULT | hrReturned,
 |  | DBORDINAL | cColAccess,
 |  | DBCOLUMNACCESS * | rgColAccess
 | ) |  |

Definition at line 2811 of file error.cpp.

{
  //Display the badstatus for pData operations.
  //(ie:  GetData / SetData / InsertRow)
  INT iSelect = 0;

  //Binding Errors only occur with the following returned codes...
  if(hrReturned!=DB_S_ERRORSOCCURRED && hrReturned!=DB_E_ERRORSOCCURRED)
    return hrReturned;

  for(ULONG i=0; i<cColAccess; i++)
  {
    ASSERT(rgColAccess);
    DBCOLUMNACCESS* pColAccess = &rgColAccess[i];

    switch(pColAccess->dwStatus)
    {
      case DBSTATUS_S_OK:
      case DBSTATUS_S_ISNULL:
      case DBSTATUS_S_DEFAULT:
      case DBSTATUS_S_IGNORE:
        break;

      default:
      {
        //Convert the Column ID into a string
        WCHAR wszBuffer[MAX_NAME_LEN] = {0};
        DBIDToString(&pColAccess->columnid, wszBuffer, MAX_NAME_LEN);

        //Display Status Error to the user...
        iSelect = wMessageBox(GetFocus(), MB_TASKMODAL | MB_ICONERROR | MB_OKCANCEL, wsz_ERROR,
          L"ColumnAccess Status Errors:\n"
          L"rgColAccess[%lu]\n\n"
          L"columnid = %s\n"
          L"wType = %s\n"
          L"cbMaxLen = %lu\n"
          L"bPrecision = %d\n"
          L"bScale = %d\n\n"
          L"dwStatus = %s\n"
          L"cbDataLen = %lu\n",
          i,
          wszBuffer,
          GetDBTypeName(pColAccess->wType),
          pColAccess->cbMaxLen,
          pColAccess->bPrecision,
          pColAccess->bScale,
          GetStatusName(pColAccess->dwStatus),
          pColAccess->cbDataLen
          );

        if(iSelect == IDCANCEL)
        {
          hrReturned = DB_E_CANCELED;
          goto CLEANUP;
        }
        break;
      }
    }
  }

CLEANUP:
  return hrReturned;
}

HRESULT DisplayColumnErrors | ( | HRESULT | hrReturned,
 |  | DBORDINAL | cColumns,
 |  | DBID * | rgColumns,
 |  | DBSTATUS * | rgStatus
 | ) |  |

Definition at line 2880 of file error.cpp.

{
  //Display the badstatus for pData operations.
  //(ie:  GetData / SetData / InsertRow)
  INT iSelect = 0;

  //Binding Errors only occur with the following returned codes...
  if(hrReturned!=DB_S_ERRORSOCCURRED && hrReturned!=DB_E_ERRORSOCCURRED)
    return hrReturned;

  for(ULONG i=0; i<cColumns; i++)
  {
    ASSERT(rgColumns);
    DBID* pDBID = &rgColumns[i];

    switch(rgStatus[i])
    {
      case DBSTATUS_S_OK:
      case DBSTATUS_S_ISNULL:
      case DBSTATUS_S_DEFAULT:
      case DBSTATUS_S_IGNORE:
        break;

      default:
      {
        //Convert the Column ID into a string
        WCHAR wszBuffer[MAX_NAME_LEN] = {0};
        DBIDToString(pDBID, wszBuffer, MAX_NAME_LEN);

        //Display Status Error to the user...
        iSelect = wMessageBox(GetFocus(), MB_TASKMODAL | MB_ICONERROR | MB_OKCANCEL, wsz_ERROR,
          L"Column Status Errors:\n"
          L"rgColumnIDs[%lu]\n\n"
          L"columnid = %s\n"
          L"dwStatus = %s\n",
          i,
          wszBuffer,
          GetStatusName(rgStatus[i])
          );

        if(iSelect == IDCANCEL)
        {
          hrReturned = DB_E_CANCELED;
          goto CLEANUP;
        }
        break;
      }
    }
  }

CLEANUP:
  return hrReturned;
}

HRESULT DisplayErrorInfo | ( | HRESULT | hrActual,
 |  | WCHAR * | pwszFile,
 |  | ULONG | ulLine,
 |  | INT * | piResult
 | ) |  |

Definition at line 3603 of file error.cpp.

{
  HRESULT hr = S_OK;

  CSmartPtr<IErrorInfo>   spErrorInfo;
  CSmartPtr<IErrorRecords>  spErrorRecords;
  ULONG cErrorRecords = 0;

  CComBSTR cstrDescription;
  CComBSTR cstrSource;
  CComBSTR cstrSQLInfo;
  INT iResult = 0;
  static LCID lcid = GetSystemDefaultLCID();

  //NOTE: GetErrorInfo will return S_OK and a NULL pointer if there is not error object
  if((hr = GetErrorInfo(0, &spErrorInfo))==S_OK && spErrorInfo)
  {
    //The Error Object may support multiple Errors (IErrorRecords)
    if(SUCCEEDED(hr = spErrorInfo->QueryInterface(&spErrorRecords)))
    {
      //Multiple Errors
      XTESTC(hr = spErrorRecords->GetRecordCount(&cErrorRecords));
    }
    else
    {
      //Only a single Error Object
      cErrorRecords = 1;
    }

    LONG lNativeError = 0;
    ERRORINFO ErrorInfo = { hrActual, 0 };

    //Loop through the records
    for(ULONG i=0; i<cErrorRecords; i++)
    {
      //For multiple errors, we will allow the user to cancel out of the dialogs
      //since the user may not be interested in clicking through many errors...
      //NOTE: This logic puts on the CANCEL button if more than 1 and not the last error...
      UINT uMBType = MB_TASKMODAL | MB_ICONERROR | MB_OK;
      if(i < (cErrorRecords-1))
        uMBType |= MB_OKCANCEL;

      //ErrorRecords
      if(spErrorRecords)
      {
        spErrorInfo.Release();
        XTESTC(hr = spErrorRecords->GetErrorInfo(i, lcid, &spErrorInfo));

        //Get the Basic ErrorInfo
        XTEST(hr = spErrorRecords->GetBasicErrorInfo(i, &ErrorInfo));

        //Get the SQL Info
        GetSqlErrorInfo(i, spErrorRecords, &cstrSQLInfo, &lNativeError);
      }
      else
      {
        //ErrorInfo is only available...
        XTEST(hr = spErrorInfo->GetGUID(&ErrorInfo.iid));
      }

      //Get the Description
      XTEST(hr = spErrorInfo->GetDescription(&cstrDescription));

      //Get the Source - this will be the window title...
      XTEST(hr = spErrorInfo->GetSource(&cstrSource));

      //Display the Error
      if(cstrSQLInfo)
      {
        iResult = wMessageBox(GetFocus(), uMBType, cstrSource ? cstrSource : wsz_ERRORINFO,
                L"Source: \"%s\"\n\n"
                L"Interface: %s\n"
                L"Result: 0x%08x = %S\n\n"
                L"ISQLErrorInfo: [%s][0x%08x]\n"
                L"IErrorInfo: [0x%08x] \"%s\"\n\n"
                L"File: %s\n"
                L"Line: %d",
                cstrSource,
                GetInterfaceName(ErrorInfo.iid),
                ErrorInfo.hrError, GetErrorName(ErrorInfo.hrError),
                cstrSQLInfo, lNativeError,
                ErrorInfo.dwMinor, cstrDescription,
                pwszFile,
                ulLine);
      }
      else
      {
        iResult = wMessageBox(GetFocus(), uMBType, cstrSource ? cstrSource : wsz_ERRORINFO,
                L"Source: \"%s\"\n\n"
                L"Interface: %s\n"
                L"Result: 0x%08x = %S\n\n"
//                L"ISQLErrorInfo: [%s][0x%08x]\n"
                L"IErrorInfo: [0x%08x] \"%s\"\n\n"
                L"File: %s\n"
                L"Line: %d",
                cstrSource,
                GetInterfaceName(ErrorInfo.iid),
                ErrorInfo.hrError, GetErrorName(ErrorInfo.hrError),
//                cstrSQLInfo, lNativeError,
                ErrorInfo.dwMinor, cstrDescription,
                pwszFile,
                ulLine);
      }

      spErrorInfo.Release();
      cstrDescription.Empty();
      cstrSource.Empty();
      cstrSQLInfo.Empty();

      if(iResult == IDCANCEL)
        goto CLEANUP;
    }
  }

CLEANUP:
  if(piResult)
    *piResult = iResult;
  return hr;
}

HRESULT DisplayHRESULT | ( | HRESULT | hrActual,
 |  | WCHAR * | pwszFile,
 |  | ULONG | ulLine,
 |  | INT * | piResult
 | ) |  |

Definition at line 3555 of file error.cpp.

{
  //If we end up here, their must not be any extended error info supported by the provider
  //the best we can do is display the HRESULT, and see of the system has a defined string
  //for the last error?
  CHAR* pszError = NULL;
  INT iResult = 0;

  //Format the Message (obtain the textual string)
  FormatMessageA(
    FORMAT_MESSAGE_ALLOCATE_BUFFER |
    FORMAT_MESSAGE_FROM_SYSTEM |
    FORMAT_MESSAGE_IGNORE_INSERTS,
    NULL,
    hrActual,
    MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
    (CHAR*)&pszError,
    0,
    NULL );

  if(pszError)
  {
    //Display the Error (including Windows Defined String)
    iResult = wMessageBox(GetFocus(), MB_TASKMODAL | MB_ICONERROR | MB_OK, wsz_ERROR,
      L"Interface: %s\nResult: 0x%08x = %S\n\nFormatMessage: \"%S\"\n\nFile: %s\nLine: %d", L"Unknown", hrActual, GetErrorName(hrActual), pszError, pwszFile, ulLine);

    // Free the buffer from Format Message
    LocalFree( pszError );
  }
  else
  {
    //Display the Error
    iResult = wMessageBox(GetFocus(), MB_TASKMODAL | MB_ICONERROR | MB_OK, wsz_ERROR,
      L"Interface: %s\nResult: 0x%08x = %S\n\nFile: %s\nLine: %d", L"Unknown", hrActual, GetErrorName(hrActual), pwszFile, ulLine);
  }

  if(piResult)
    *piResult = iResult;

  return hrActual;
}

HRESULT DisplayPropErrors | ( | HRESULT | hrReturned,
 |  | ULONG | cPropInfoSets,
 |  | DBPROPINFOSET * | rgPropInfoSets
 | ) |  |

Definition at line 3311 of file error.cpp.

{
  //Property Errors only occur with the following returned codes...
  if(hrReturned!=DB_S_ERRORSOCCURRED && hrReturned!=DB_E_ERRORSOCCURRED)
    return hrReturned;

  //Display all property errors...
  for(ULONG iPropInfoSet=0; iPropInfoSet<cPropInfoSets; iPropInfoSet++)
  {
    DBPROPINFOSET* pPropInfoSet = &rgPropInfoSets[iPropInfoSet];
    for(ULONG iPropInfo=0; iPropInfo<pPropInfoSet->cPropertyInfos; iPropInfo++)
    {
      DBPROPINFO* pPropInfo = &pPropInfoSet->rgPropertyInfos[iPropInfo];
      if(pPropInfo->dwFlags == DBPROPFLAGS_NOTSUPPORTED)
      {
        WCHAR wszBuffer[MAX_NAME_LEN+1];
        WCHAR wszPropSet[MAX_NAME_LEN+1];

        WCHAR* pwszPropSet = GetPropSetName(pPropInfoSet->guidPropertySet);
        if(pwszPropSet == NULL)
        {
          StringFromGUID2(pPropInfoSet->guidPropertySet, wszPropSet, MAX_NAME_LEN);
          pwszPropSet = wszPropSet;
        }

        //Find property Value
        wszBuffer[0] = wEOL;
        VariantToString(&pPropInfo->vValues, wszBuffer, MAX_NAME_LEN, CONV_VARBOOL);

        //Append the Error
        INT iSelect = wMessageBox
          (
            GetFocus(), MB_TASKMODAL | MB_ICONERROR | MB_OKCANCEL, wsz_ERROR,
            L"Properties in Error:\n"
            L"rgPropInfoSets[%d].rgPropertyInfos[%d]\n\n"
            L"guidPropertySet\t= %s\n"
            L"pwszDescription\t= %s\n"
            L"dwPropertyID\t= %s (0x%x)\n"
            L"vtType\t\t= %s\n"
            L"vValues\t\t= %s\n\n"
            L"dwFlags\t\t= %s (0x%x)",
            iPropInfoSet,iPropInfo,
            pwszPropSet,
            pPropInfo->pwszDescription,
            GetPropertyName(pPropInfo->dwPropertyID, pPropInfoSet->guidPropertySet),
            pPropInfo->dwPropertyID,
            GetVariantTypeName(pPropInfo->vtType),
            wszBuffer,
            L"DBPROPFLAGS_NOTSUPPORTED",
            pPropInfo->dwFlags
          );

        if(iSelect == IDCANCEL)
        {
          //NOTE: Will return DB_E_CANCELED if the user doesn't wish to continue
          hrReturned = DB_E_CANCELED;
          goto CLEANUP;
        }
      }
    }
  }

CLEANUP:
  return hrReturned;
}

HRESULT DisplayPropErrors | ( | HRESULT | hrReturned,
 |  | REFIID | riid,
 |  | IUnknown * | pIUnknown
 | ) |  |

Definition at line 3382 of file error.cpp.

{
  ASSERT(pIUnknown);

  //Property Errors only occur with the following returned codes...
  if(hrReturned!=DB_S_ERRORSOCCURRED && hrReturned!=DB_E_ERRORSOCCURRED)
    return hrReturned;

  //GetProperties with DBPROPSET_PROPERTIESINERROR.
  ULONG cPropSets = 0;
  DBPROPSET* rgPropSets = NULL;
  IDBProperties* pIDBProperties = NULL;
  ICommandProperties* pICommandProperties = NULL;

  //Setup input DBPROPSET_PROPERTIESINERROR
  const ULONG cPropertyIDSets = 1;
  DBPROPIDSET rgPropertyIDSets[cPropertyIDSets];
  rgPropertyIDSets[0].guidPropertySet = DBPROPSET_PROPERTIESINERROR;
  rgPropertyIDSets[0].cPropertyIDs = 0;
  rgPropertyIDSets[0].rgPropertyIDs = NULL;

  //Which GetProperties
  if(riid == IID_IDBProperties)
  {
    XTESTC(pIUnknown->QueryInterface(IID_IDBProperties, (void**)&pIDBProperties));
    XTESTC(pIDBProperties->GetProperties(cPropertyIDSets, rgPropertyIDSets, &cPropSets, &rgPropSets));
  }
  else
  {
    XTESTC(pIUnknown->QueryInterface(IID_ICommandProperties, (void**)&pICommandProperties));
    XTESTC(pICommandProperties->GetProperties(cPropertyIDSets, rgPropertyIDSets, &cPropSets, &rgPropSets));
  }

  //Now delegate to display all properties in error
  TESTC(hrReturned = DisplayPropErrors(hrReturned, cPropSets, rgPropSets));

CLEANUP:
  FreeProperties(&cPropSets, &rgPropSets);
  SAFE_RELEASE(pICommandProperties);
  SAFE_RELEASE(pIDBProperties);
  return hrReturned;
}

HRESULT DisplayPropErrors | ( | HRESULT | hrReturned,
 |  | ULONG | cPropSets,
 |  | DBPROPSET * | rgPropSets
 | ) |  |

Definition at line 3241 of file error.cpp.

{
  //Property Errors only occur with the following returned codes...
  if(hrReturned!=DB_S_ERRORSOCCURRED && hrReturned!=DB_E_ERRORSOCCURRED)
    return hrReturned;

  //Display all property errors...
  for(ULONG iPropSet=0; iPropSet<cPropSets; iPropSet++)
  {
    DBPROPSET* pPropSet = &rgPropSets[iPropSet];
    for(ULONG iProp=0; iProp<pPropSet->cProperties; iProp++)
    {
      DBPROP* pProp = &pPropSet->rgProperties[iProp];
      if(pProp->dwStatus != DBPROPSTATUS_OK)
      {
        WCHAR wszBuffer[MAX_NAME_LEN+1];
        WCHAR wszPropSet[MAX_NAME_LEN+1];

        WCHAR* pwszPropSet = GetPropSetName(pPropSet->guidPropertySet);
        if(pwszPropSet == NULL)
        {
          StringFromGUID2(pPropSet->guidPropertySet, wszPropSet, MAX_NAME_LEN);
          pwszPropSet = wszPropSet;
        }

        //Find property Value
        wszBuffer[0] = wEOL;
        VariantToString(&pProp->vValue, wszBuffer, MAX_NAME_LEN, CONV_VARBOOL);

        //Append the Error
        INT iSelect = wMessageBox
          (
            GetFocus(), MB_TASKMODAL | MB_ICONERROR | MB_OKCANCEL, wsz_ERROR,
            L"Properties in Error:\n"
            L"rgPropSets[%d].rgProperties[%d]\n\n"
            L"guidPropertySet\t= %s\n"
            L"dwPropertyID\t= %s (0x%x)\n"
            L"dwOptions\t\t= %s\n"
            L"vValue.vt\t\t= %s\n"
            L"vValue\t\t= %s\n\n"
            L"dbStatus\t\t= %s",
            iPropSet,iProp,
            pwszPropSet,
            GetPropertyName(pProp->dwPropertyID, pPropSet->guidPropertySet),
            pProp->dwPropertyID,
            pProp->dwOptions == DBPROPOPTIONS_REQUIRED ? L"DBPROPOPTIONS_REQUIRED" : L"DBPROPOPTIONS_OPTIONAL",
            GetVariantTypeName(V_VT(&pProp->vValue)),
            wszBuffer,
            GetPropStatusName(pProp->dwStatus)
          );

        if(iSelect == IDCANCEL)
        {
          //NOTE: Will return DB_E_CANCELED if the user doesn't wish to continue
          hrReturned = DB_E_CANCELED;
          goto CLEANUP;
        }
      }
    }
  }

CLEANUP:
  return hrReturned;
}

HRESULT DisplayRefCountErrors | ( | WCHAR * | pwszName,
 |  | ULONG | ulActRefCount,
 |  | ULONG | ulExpRefCount
 | ) |  |

Definition at line 3430 of file error.cpp.

{
  ASSERT(pwszName);

  //Display RefCount difference...
  if(ulActRefCount != ulExpRefCount && GetErrorPosting(EP_REFCOUNT_FAILURE))
  {
    wMessageBox
      (
      GetFocus(),
      MB_TASKMODAL | MB_ICONERROR | MB_OK,
      wsz_ERROR,
      L"%s\n"
      L"RefCount = %d, Expected = %d",
      pwszName,
      ulActRefCount,
      ulExpRefCount
      );
  }

  return S_OK;
}

HRESULT DisplayRowErrors | ( | HRESULT | hrReturned,
 |  | DBROWCOUNT | cRows,
 |  | HROW * | rghRows,
 |  | DBROWSTATUS * | rgRowStatus
 | ) |  |

Definition at line 3112 of file error.cpp.

{
  //Display the badstatus for row operations.
  INT iSelect = 0;

  //Binding Errors only occur with the following returned codes...
  if(hrReturned!=DB_S_ERRORSOCCURRED && hrReturned!=DB_E_ERRORSOCCURRED)
    return hrReturned;

  for(LONG i=0; i<cRows; i++)
  {
    ASSERT(rghRows);
    ASSERT(rgRowStatus);

    switch(rgRowStatus[i])
    {
      case DBROWSTATUS_S_OK:
        break;

      //Display RowStatus Error to the user...
      default:
      {
        iSelect = wMessageBox(GetFocus(), MB_TASKMODAL | MB_ICONERROR | MB_OKCANCEL, wsz_ERROR,
          L"Row Status Errors:\n\n"
          L"rghRow[%lu] = 0x%p\n"
          L"DBROWSTATUS = %d=%s",
          i,
          rghRows[i],
          rgRowStatus[i],
          GetMapName(rgRowStatus[i], NUMELE(g_rgRowStatusMap), g_rgRowStatusMap)
          );

        if(iSelect == IDCANCEL)
        {
          //NOTE: Will return DB_E_CANCELED if the user doesn't wish to continue
          hrReturned = DB_E_CANCELED;
          goto CLEANUP;
        }
        break;
      }
    }
  }

CLEANUP:
  return hrReturned;
}

HRESULT DisplayWinError | ( | DWORD | dwError,
 |  | WCHAR * | pwszFile,
 |  | LONG | lLine,
 |  | WCHAR * | pwszText
 | ) |  |

Definition at line 3507 of file error.cpp.

{
  if(dwError)
  {
    CHAR* pszError = NULL;

    //Format the Message (obtain the textual string)
    FormatMessageA(
      FORMAT_MESSAGE_ALLOCATE_BUFFER |
      FORMAT_MESSAGE_FROM_SYSTEM |
      FORMAT_MESSAGE_IGNORE_INSERTS,
      NULL,
      dwError,
      MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
      (CHAR*)&pszError,
      0,
      NULL
    );

    if(pszError)
    {
      //Display the Error
      wMessageBox
        (
        GetFocus(), MB_TASKMODAL | MB_ICONERROR | MB_OK, wsz_ERROR,
        L"%s: GetLastError() = %d = %S" wWndEOL
        L"<File:%s>" wWndEOL
        L"Line:%d" wWndEOL,
        pwszText,
        dwError,
        pszError,
        pwszFile,
        lLine
        );

      // Free the buffer.
      LocalFree( pszError );
    }
  }

  return dwError;
}

HRESULT GetAllocedPropInfo | ( | ULONG | cPropertyIDSets,
 |  | DBPROPIDSET * | rgPropertyIDSets,
 |  | ULONG * | pcPropInfoSets,
 |  | DBPROPINFOSET ** | prgPropInfoSets
 | ) |  |

Definition at line 2164 of file error.cpp.

{
  HRESULT hr = S_OK;
  ASSERT(pcPropInfoSets);
  ASSERT(prgPropInfoSets);

  ULONG iPropSet,cStaticInfoSets = 0;
  const DBPROPINFOSET* rgStaticInfoSets = NULL;

  ULONG cPropInfoSets = 0;
  DBPROPINFOSET* rgPropInfoSets = NULL;

  //Delegate
  TESTC(hr = GetStaticPropInfo(cPropertyIDSets, rgPropertyIDSets, &cStaticInfoSets, &rgStaticInfoSets));

  //Now dump this static info into an allocated DBPROPINFOSET...
  SAFE_ALLOC(rgPropInfoSets, DBPROPINFOSET, cStaticInfoSets);
  cPropInfoSets = cStaticInfoSets;
  for(iPropSet=0; iPropSet<cStaticInfoSets; iPropSet++)
  {
    //Setup outer
    rgPropInfoSets[iPropSet].cPropertyInfos   = rgStaticInfoSets[iPropSet].cPropertyInfos;
    rgPropInfoSets[iPropSet].guidPropertySet  = rgStaticInfoSets[iPropSet].guidPropertySet;
    SAFE_ALLOC(rgPropInfoSets[iPropSet].rgPropertyInfos, DBPROPINFO, rgStaticInfoSets[iPropSet].cPropertyInfos);
    memcpy(rgPropInfoSets[iPropSet].rgPropertyInfos, rgStaticInfoSets[iPropSet].rgPropertyInfos, sizeof(DBPROPINFO)*rgStaticInfoSets[iPropSet].cPropertyInfos);
  }

CLEANUP:
  *pcPropInfoSets = cPropInfoSets;
  *prgPropInfoSets = rgPropInfoSets;
  return hr;
};

WCHAR* GetAsynchPhase ( ULONG ulAsynchPhase )

Definition at line 3093 of file error.cpp.

{
  const static WIDENAMEMAP  rgAsynchPhase[] =
  {
    VALUE_WCHAR(DBASYNCHPHASE_INITIALIZATION),
    VALUE_WCHAR(DBASYNCHPHASE_POPULATION),
    VALUE_WCHAR(DBASYNCHPHASE_COMPLETE),
    VALUE_WCHAR(DBASYNCHPHASE_CANCELED),
  };

  return GetMapName(ulAsynchPhase, NUMELE(rgAsynchPhase), rgAsynchPhase);
}

WCHAR* GetAsynchReason ( ULONG ulOperation )

Definition at line 3079 of file error.cpp.

{
  const static WIDENAMEMAP  rgAsynchReason[] =
  {
    VALUE_WCHAR(  DBASYNCHOP_OPEN ),
  };

  return GetMapName(ulOperation, NUMELE(rgAsynchReason), rgAsynchReason);
}

WCHAR* GetBitMapName | ( | DWORD | dwItem,
 |  | ULONG | cNameMap,
 |  | const WIDENAMEMAP * | rgNameMap,
 |  | DWORD | dwBitStart
 | ) |  |

Definition at line 2595 of file error.cpp.

{
  static WCHAR wszBuffer[MAX_NAME_LEN] = {0};
  DWORD dwItemBase = dwItem;
  DWORD dwFound = 0;

  //NOTE: Some bitmasks, are actually composed of some sequental values, and then some bits.
  //For Example, DBTYPE_* contains sequential types upto a point, and then the rest are bit masks.
  //This function is designed to handle this case as well, dwBitStart denotes all bits that
  //are allowed to be on, all other values (non-indicated-bits) will be compared literally ie: (==).
  if(dwBitStart)
    dwItemBase &= ~dwBitStart;  //Remove all high order bits

  for(ULONG i=0; i<cNameMap; i++)
  {
    //Does our item contains this particular bit?
    if(BIT_SET(dwItem, (DWORD)rgNameMap[i].lItem))
    {
      if(dwBitStart)
      {
        //If we are using a bitstart, then we need to make sure either this is one
        //of the special orable bits, or the items match exactly, if not then skip...
        if(! ((dwBitStart & rgNameMap[i].lItem) || dwItemBase == (DWORD)rgNameMap[i].lItem) )
          continue;
      }

      if(dwFound)
      {
        wcscat(wszBuffer, L" | ");
        wcscat(wszBuffer, rgNameMap[i].pwszName);
      }
      else
      {
        wcscpy(wszBuffer, rgNameMap[i].pwszName);
      }

      //NOTE: We keep track of all the "bits" we have found.
      dwFound |= rgNameMap[i].lItem;
    }
  }

  //We keep track of all the bits we saw, so if at the end we didn't see some of the bits
  //then we just return the bits, and not an incorrect sub-set string mapping...
  if(dwFound != dwItem)
  {
    //Unknown, just display bitmask as hex
    StringFormat(wszBuffer, NUMELE(wszBuffer), L"0x%08x", dwItem);
  }

  //return
  return wszBuffer;
}

WCHAR* GetDialectName ( REFGUID rguid )

Definition at line 2728 of file error.cpp.

{
  return GetMapName(rguid, g_cDialectMaps, g_rgDialectMaps);
}

CHAR* GetErrorName ( HRESULT hr )

Definition at line 2686 of file error.cpp.

{
  return GetMapName(hr, NUMELE(g_rgErrorMap), g_rgErrorMap);
}

BOOL GetErrorPosting ( ERRORPOST eErrorPost )

Definition at line 35 of file error.cpp.

{
  return g_dwErrorPost & eErrorPost;
};

WCHAR* GetInterfaceName ( REFIID riid )

Definition at line 2696 of file error.cpp.

{
  return GetMapName(riid, NUMELE(g_rgInterfaceMaps), g_rgInterfaceMaps);
}

WCHAR* GetMapName | ( | const DBID * | pDBID,
 |  | ULONG | cMap,
 |  | const WIDEDBIDMAP * | rgMap
 | ) |  |

Definition at line 2670 of file error.cpp.

{
  for(ULONG i=0; i<cMap; i++)
  {
    if(memcmp(pDBID, rgMap[i].pDBID, sizeof(DBID))==0)
      return rgMap[i].pwszName;
  }

  //Otherwise indicate failure
  return NULL;
}

WCHAR* GetMapName | ( | LONG | lItem,
 |  | ULONG | cNameMap,
 |  | const WIDENAMEMAP * | rgNameMap,
 |  | DWORD | dwConvFlags
 | ) |  |

Definition at line 2566 of file error.cpp.

{
  for(ULONG i=0; i<cNameMap; i++)
  {
    if(lItem == rgNameMap[i].lItem)
      return rgNameMap[i].pwszName;
  }

  if(dwConvFlags)
  {
    //If we didn't find it, then just format the value in a string
    //and return it to the user (if requested)...
    static WCHAR wszBuffer[MAX_NAME_LEN];
    if(dwConvFlags & CONV_HEX)
      StringFormat(wszBuffer, NUMELE(wszBuffer), L"0x%x", lItem);
    else
      StringFormat(wszBuffer, NUMELE(wszBuffer), L"%d", lItem);
    return wszBuffer;
  }

  //Otherwise indicate failure
  return NULL;
}

LONG GetMapName | ( | CHAR * | psz,
 |  | ULONG | cNameMap,
 |  | const NAMEMAP * | rgNameMap
 | ) |  |

Definition at line 2549 of file error.cpp.

{
  for(ULONG i=0; i<cNameMap; i++)
  {
    if(strcmp(psz, rgNameMap[i].pszName)==0)
      return rgNameMap[i].lItem;
  }

  //Otherwise indicate failure
  return -1;
}

WCHAR* GetMapName | ( | REFGUID | guid,
 |  | ULONG | cGuidMap,
 |  | const WIDEGUIDMAP * | rgGuidMap
 | ) |  |

Definition at line 2653 of file error.cpp.

{
  for(ULONG i=0; i<cGuidMap; i++)
  {
    if(guid == *(rgGuidMap[i].pGuid))
      return rgGuidMap[i].pwszName;
  }

  //Otherwise indicate failure
  return NULL;
}

CHAR* GetMapName | ( | LONG | lItem,
 |  | ULONG | cNameMap,
 |  | const NAMEMAP * | rgNameMap
 | ) |  |

Definition at line 2516 of file error.cpp.

{
  for(ULONG i=0; i<cNameMap; i++)
  {
    if(lItem == rgNameMap[i].lItem)
      return rgNameMap[i].pszName;
  }

  //Otherwise indicate failure
  return NULL;
}

LONG GetMapName | ( | WCHAR * | pwsz,
 |  | ULONG | cNameMap,
 |  | const WIDENAMEMAP * | rgNameMap
 | ) |  |

Definition at line 2533 of file error.cpp.

{
  for(ULONG i=0; i<cNameMap; i++)
  {
    if(StringCompare(pwsz, rgNameMap[i].pwszName))
      return rgNameMap[i].lItem;
  }

  //Otherwise indicate failure
  return -1;
}

WCHAR* GetObjectTypeName ( REFGUID rguidObjectType )

Definition at line 2447 of file error.cpp.

{
  return GetMapName(rguidObjectType, g_cObjectTypeMaps, g_rgObjectTypeMaps);
}

WCHAR* GetPhaseName ( DBEVENTPHASE ePhase )

Definition at line 3023 of file error.cpp.

{
  const static WIDENAMEMAP  rgPhase[] =
  {
    VALUE_WCHAR(DBEVENTPHASE_OKTODO),
    VALUE_WCHAR(DBEVENTPHASE_ABOUTTODO),
    VALUE_WCHAR(DBEVENTPHASE_SYNCHAFTER),
    VALUE_WCHAR(DBEVENTPHASE_DIDEVENT),
    VALUE_WCHAR(DBEVENTPHASE_FAILEDTODO)
  };

  return GetMapName(ePhase, NUMELE(rgPhase), rgPhase);
}

WCHAR* GetPropertyName | ( | DBPROPID | dwPropertyID,
 |  | REFGUID | guidPropertySet
 | ) |  |

Definition at line 2457 of file error.cpp.

{
  //Thankfully all OLE DB Properties have different DBPROPIDs, (all unique)
  //The problem is that provider specific properties may not be.
  //So if we know the set we can find the property, otherwsie we don't know it...
  ULONG cPropInfoSets = 0;
  const DBPROPINFOSET* rgPropInfoSets = NULL;
  DBPROPINFO* pPropInfo = NULL;

  //Setup the info we are looking for...
  const ULONG cPropertyIDSets = 1;
  DBPROPIDSET rgPropertyIDSets[cPropertyIDSets];
  rgPropertyIDSets[0].cPropertyIDs = 0;
  rgPropertyIDSets[0].rgPropertyIDs = NULL;
  rgPropertyIDSets[0].guidPropertySet = guidPropertySet;

  //Obtain the properties for the specified set...
  TESTC(GetStaticPropInfo(cPropertyIDSets, rgPropertyIDSets, &cPropInfoSets, &rgPropInfoSets));

  //Now that we have the correct set, just obtain the sub element (property name)
  pPropInfo = FindProperty(dwPropertyID, guidPropertySet, cPropInfoSets, (DBPROPINFOSET*)rgPropInfoSets);
  if(pPropInfo)
    return pPropInfo->pwszDescription;

CLEANUP:
  return NULL;
}

WCHAR* GetPropSetName ( REFGUID guidPropertySet )

Definition at line 2490 of file error.cpp.

{
  return GetMapName(guidPropertySet, g_cPropSetMaps, g_rgPropSetMaps);
}

WCHAR* GetPropStatusName ( DBPROPSTATUS dbPropStatus )

Definition at line 1554 of file error.cpp.

{
  return GetMapName(dbPropStatus, NUMELE(g_rgPropStatusMap), g_rgPropStatusMap);
}

WCHAR* GetReasonName ( DBREASON eReason )

Definition at line 3041 of file error.cpp.

{
  const static WIDENAMEMAP  rgReason[] =
  {
    VALUE_WCHAR(  DBREASON_ROWSET_FETCHPOSITIONCHANGE ),
    VALUE_WCHAR(  DBREASON_ROWSET_RELEASE ),
    VALUE_WCHAR(  DBREASON_COLUMN_SET ),
    VALUE_WCHAR(  DBREASON_COLUMN_RECALCULATED  ),
    VALUE_WCHAR(  DBREASON_ROW_ACTIVATE ),
    VALUE_WCHAR(  DBREASON_ROW_RELEASE  ),
    VALUE_WCHAR(  DBREASON_ROW_DELETE ),
    VALUE_WCHAR(  DBREASON_ROW_FIRSTCHANGE  ),
    VALUE_WCHAR(  DBREASON_ROW_INSERT ),
    VALUE_WCHAR(  DBREASON_ROW_RESYNCH  ),
    VALUE_WCHAR(  DBREASON_ROW_UNDOCHANGE ),
    VALUE_WCHAR(  DBREASON_ROW_UNDOINSERT ),
    VALUE_WCHAR(  DBREASON_ROW_UNDODELETE ),
    VALUE_WCHAR(  DBREASON_ROW_UPDATE ),
    VALUE_WCHAR(  DBREASON_ROWSET_CHANGED ),

    VALUE_WCHAR( DBREASON_ROWPOSITION_CHANGED ),
    VALUE_WCHAR(  DBREASON_ROWPOSITION_CHAPTERCHANGED ),
    VALUE_WCHAR(  DBREASON_ROWPOSITION_CLEARED  ),
    VALUE_WCHAR(  DBREASON_ROW_ASYNCHINSERT ),

//    VALUE_WCHAR(  DBREASON_ROWSET_ROWSADDED ),
//    VALUE_WCHAR(  DBREASON_ROWSET_POPULATIONCOMPLETE  ),
//    VALUE_WCHAR(  DBREASON_ROWSET_POPULATIONSTOPPED ),
  };

  return GetMapName(eReason, NUMELE(rgReason), rgReason);
}

WCHAR* GetRowColName ( const DBID * pColumnid )

Definition at line 2304 of file error.cpp.

{
  return GetMapName(pColumnid, g_cRowColMaps, g_rgRowColMaps);
}

HRESULT GetSqlErrorInfo | ( | ULONG | iRecord,
 |  | IErrorRecords * | pIErrorRecords,
 |  | BSTR * | pBstr,
 |  | LONG * | plNativeError
 | ) |  |

Definition at line 3731 of file error.cpp.

{
  ASSERT(pBstr);
  HRESULT hr = S_OK;

  CSmartPtr<ISQLErrorInfo>  spSQLErrorInfo;
  LONG lNativeError = 0;

  //Get the Error Records
  if(pIErrorRecords)
  {
    //If there is ErrorInfo, GetSQLInfo for the desired record
    //ISQLErrorInfo is not mandatory
    TESTC(hr = pIErrorRecords->GetCustomErrorObject(iRecord, IID_ISQLErrorInfo, (IUnknown**)&spSQLErrorInfo));

    //If there was a CustomErrorObject
    if(spSQLErrorInfo)
      hr = spSQLErrorInfo->GetSQLInfo(pBstr, &lNativeError);
  }

CLEANUP:
  if(plNativeError)
    *plNativeError = lNativeError;
  return hr;
}

HRESULT GetStaticPropInfo | ( | ULONG | cPropertyIDSets,
 |  | DBPROPIDSET * | rgPropertyIDSets,
 |  | ULONG * | pcStaticInfoSets,
 |  | const DBPROPINFOSET ** | prgStaticInfoSets
 | ) |  |

Definition at line 1768 of file error.cpp.

{
  HRESULT hr = S_OK;
  ASSERT(pcStaticInfoSets);
  ASSERT(prgStaticInfoSets);

  //DBPROPSET_COLUMN
  const static DBPROPINFO rgColumnPropInfo[] =
  {
    VALUE_WCHAR(DBPROP_COL_AUTOINCREMENT),      DBPROPFLAGS_COLUMN,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_COL_DEFAULT  ),        DBPROPFLAGS_COLUMN,     DBTYPE_EMPTY,   {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_COL_DESCRIPTION  ),      DBPROPFLAGS_COLUMN,     DBTYPE_BSTR,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_COL_FIXEDLENGTH  ),      DBPROPFLAGS_COLUMN,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_COL_INCREMENT),        DBPROPFLAGS_COLUMN,     DBTYPE_EMPTY,   {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_COL_ISLONG),         DBPROPFLAGS_COLUMN,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_COL_NULLABLE ),        DBPROPFLAGS_COLUMN,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_COL_PRIMARYKEY ),      DBPROPFLAGS_COLUMN,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_COL_UNIQUE ),        DBPROPFLAGS_COLUMN,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_COLUMNLCID),         DBPROPFLAGS_COLUMN,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_COL_SEED),         DBPROPFLAGS_COLUMN,     DBTYPE_EMPTY,   {0,0,0,0,0},
  };

  //DBPROPSET_DATASOURCE
  const static DBPROPINFO rgDataSourcePropInfo[] =
  {
    VALUE_WCHAR(DBPROP_CURRENTCATALOG ),      DBPROPFLAGS_DATASOURCE,   DBTYPE_BSTR,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_MULTIPLECONNECTIONS),    DBPROPFLAGS_DATASOURCE,   DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_RESETDATASOURCE),      DBPROPFLAGS_DATASOURCE,   DBTYPE_I4,      {0,0,0,0,0},
  };

  //DBPROPSET_DATASOURCEINFO
  const static DBPROPINFO rgDataSourceInfoPropInfo[] =
  {
    VALUE_WCHAR(DBPROP_ACTIVESESSIONS ),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_ALTERCOLUMN),        DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_ASYNCTXNABORT  ),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_ASYNCTXNCOMMIT ),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_BYREFACCESSORS ),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_CATALOGLOCATION  ),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_CATALOGTERM  ),        DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BSTR,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_CATALOGUSAGE ),        DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_COLUMNDEFINITION ),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_COMSERVICES  ),        DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_CONCATNULLBEHAVIOR ),    DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_CONNECTIONSTATUS),     DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_DATASOURCENAME ),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BSTR,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_DATASOURCEREADONLY ),    DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_DATASOURCE_TYPE),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_DBMSNAME ),          DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BSTR,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_DBMSVER  ),          DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BSTR,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_DSOTHREADMODEL ),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_GENERATEURL),        DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_GROUPBY  ),          DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_HETEROGENEOUSTABLES  ),    DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IDENTIFIERCASE),       DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_MAXINDEXSIZE ),        DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_MAXOPENCHAPTERS  ),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_MAXROWSIZE ),        DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_MAXROWSIZEINCLUDESBLOB ),  DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_MAXTABLESINSELECT  ),    DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_MULTIPLEPARAMSETS  ),    DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_MULTIPLERESULTS  ),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_MULTIPLESTORAGEOBJECTS ),  DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_MULTITABLEUPDATE ),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_NULLCOLLATION  ),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_OLEOBJECTS ),        DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_OPENROWSETSUPPORT),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_ORDERBYCOLUMNSINSELECT ),  DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_OUTPUTPARAMETERAVAILABILITY  ),  DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_PERSISTENTIDTYPE ),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_PREPAREABORTBEHAVIOR ),    DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_PREPARECOMMITBEHAVIOR  ),  DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_PROCEDURETERM  ),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BSTR,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_PROVIDERFRIENDLYNAME),   DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BSTR,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_PROVIDERMEMORY),       DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_PROVIDERFILENAME ),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BSTR,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_PROVIDEROLEDBVER ),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BSTR,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_PROVIDERVER  ),        DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BSTR,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_QUOTEDIDENTIFIERCASE ),    DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_ROWSETCONVERSIONSONCOMMAND ),  DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_SCHEMATERM ),        DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BSTR,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_SCHEMAUSAGE  ),        DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_SERVERNAME),         DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BSTR,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_SQLSUPPORT ),        DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_STRUCTUREDSTORAGE  ),    DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_SUBQUERIES ),        DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_SUPPORTEDTXNDDL  ),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_SUPPORTEDTXNISOLEVELS  ),  DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_SUPPORTEDTXNISORETAIN  ),  DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_TABLETERM  ),        DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BSTR,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_TABLESTATISTICS  ),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_USERNAME ),          DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BSTR,    {0,0,0,0,0},

    //OLAP Documention
    VALUE_WCHAR(MDPROP_AXES),           DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(MDPROP_FLATTENING_SUPPORT),     DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(MDPROP_MDX_JOINCUBES),        DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(MDPROP_NAMED_LEVELS),       DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(MDPROP_RANGEROWSET),        DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(MDPROP_MDX_SLICER),         DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(MDPROP_MDX_CUBEQUALIFICATION),    DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(MDPROP_MDX_OUTERREFERENCE),     DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(MDPROP_MDX_QUERYBYPROPERTY),    DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(MDPROP_MDX_CASESUPPORT),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(MDPROP_MDX_STRING_COMPOP),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(MDPROP_MDX_DESCFLAGS),        DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(MDPROP_MDX_SET_FUNCTIONS),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(MDPROP_MDX_MEMBER_FUNCTIONS),   DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(MDPROP_MDX_NUMERIC_FUNCTIONS),    DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(MDPROP_MDX_FORMULAS),       DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(MDPROP_MDX_AGGREGATECELL_UPDATE), DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},

    //Not yet doc'd...
    VALUE_WCHAR(DBPROP_STORAGEFLAGS),       DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},

    //2.6
    VALUE_WCHAR(DBPROP_TABLESTATISTICS  ),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
  };

  //DBPROPSET_INDEX
  const static DBPROPINFO rgIndexPropInfo[] =
  {
    VALUE_WCHAR(DBPROP_INDEX_AUTOUPDATE),     DBPROPFLAGS_INDEX,      DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INDEX_CLUSTERED),      DBPROPFLAGS_INDEX,      DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INDEX_FILLFACTOR),     DBPROPFLAGS_INDEX,      DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INDEX_INITIALSIZE),      DBPROPFLAGS_INDEX,      DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INDEX_NULLCOLLATION),    DBPROPFLAGS_INDEX,      DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INDEX_NULLS),        DBPROPFLAGS_INDEX,      DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INDEX_PRIMARYKEY),     DBPROPFLAGS_INDEX,      DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INDEX_SORTBOOKMARKS),    DBPROPFLAGS_INDEX,      DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INDEX_TEMPINDEX),      DBPROPFLAGS_INDEX,      DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INDEX_TYPE),         DBPROPFLAGS_INDEX,      DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INDEX_UNIQUE),       DBPROPFLAGS_INDEX,      DBTYPE_BOOL,    {0,0,0,0,0},
  };

  //DBPROPSET_DBINIT
  const static DBPROPINFO rgInitPropInfo[] =
  {
    VALUE_WCHAR(DBPROP_AUTH_CACHE_AUTHINFO  ),    DBPROPFLAGS_DBINIT,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_AUTH_ENCRYPT_PASSWORD  ),  DBPROPFLAGS_DBINIT,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_AUTH_INTEGRATED  ),      DBPROPFLAGS_DBINIT,     DBTYPE_BSTR,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_AUTH_MASK_PASSWORD ),    DBPROPFLAGS_DBINIT,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_AUTH_PASSWORD  ),      DBPROPFLAGS_DBINIT,     DBTYPE_BSTR,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_AUTH_PERSIST_ENCRYPTED ),  DBPROPFLAGS_DBINIT,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_AUTH_PERSIST_SENSITIVE_AUTHINFO  ),    DBPROPFLAGS_DBINIT,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_AUTH_USERID  ),        DBPROPFLAGS_DBINIT,     DBTYPE_BSTR,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INIT_ASYNCH),        DBPROPFLAGS_DBINIT,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INIT_BINDFLAGS),       DBPROPFLAGS_DBINIT,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INIT_CATALOG),       DBPROPFLAGS_DBINIT,     DBTYPE_BSTR,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INIT_DATASOURCE),      DBPROPFLAGS_DBINIT,     DBTYPE_BSTR,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INIT_GENERALTIMEOUT),    DBPROPFLAGS_DBINIT,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INIT_HWND  ),        DBPROPFLAGS_DBINIT,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INIT_IMPERSONATION_LEVEL ),  DBPROPFLAGS_DBINIT,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INIT_LCID  ),        DBPROPFLAGS_DBINIT,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INIT_LOCATION  ),      DBPROPFLAGS_DBINIT,     DBTYPE_BSTR,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INIT_LOCKOWNER),       DBPROPFLAGS_DBINIT,     DBTYPE_BSTR,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INIT_MODE  ),        DBPROPFLAGS_DBINIT,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INIT_OLEDBSERVICES),     DBPROPFLAGS_DBINIT,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INIT_PROMPT  ),        DBPROPFLAGS_DBINIT,     DBTYPE_I2,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INIT_PROTECTION_LEVEL  ),  DBPROPFLAGS_DBINIT,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INIT_PROVIDERSTRING  ),    DBPROPFLAGS_DBINIT,     DBTYPE_BSTR,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INIT_TIMEOUT ),        DBPROPFLAGS_DBINIT,     DBTYPE_I4,      {0,0,0,0,0},
  };

  //DBPROPSET_SESSION
  const static DBPROPINFO rgSessionPropInfo[] =
  {
    VALUE_WCHAR(DBPROP_SESS_AUTOCOMMITISOLEVELS ),  DBPROPFLAGS_SESSION,    DBTYPE_I4,      {0,0,0,0,0},
  };

  //DBPROPSET_TABLE
  const static DBPROPINFO rgTablePropInfo[] =
  {
    VALUE_WCHAR(DBPROP_TBL_TEMPTABLE  ),      DBPROPFLAGS_TABLE,      DBTYPE_BOOL,    {0,0,0,0,0},
  };

  //DBPROPSET_TRUSTEE
  const static DBPROPINFO rgTrusteePropInfo[] =
  {
    //Documented in Security Whitepaper
    VALUE_WCHAR(DBPROP_TRUSTEE_USERNAME),     DBPROPFLAGS_TRUSTEE,    DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_TRUSTEE_AUTHENTICATION),   DBPROPFLAGS_TRUSTEE,    DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_TRUSTEE_NEWAUTHENTICATION),  DBPROPFLAGS_TRUSTEE,    DBTYPE_BOOL,    {0,0,0,0,0},
  };

  //DBPROPSET_VIEW
  const static DBPROPINFO rgViewPropInfo[] =
  {
    VALUE_WCHAR(DBPROP_FILTERCOMPAREOPS ),      DBPROPFLAGS_VIEW,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IAccessor  ),        DBPROPFLAGS_VIEW,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IColumnsInfo ),        DBPROPFLAGS_VIEW,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_ISupportErrorInfo),      DBPROPFLAGS_VIEW,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IViewChapter),       DBPROPFLAGS_VIEW,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IViewFilter),        DBPROPFLAGS_VIEW,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IViewRowset),        DBPROPFLAGS_VIEW,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IViewSort),          DBPROPFLAGS_VIEW,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_MAXORSINFILTER ),      DBPROPFLAGS_VIEW,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_MAXSORTCOLUMNS ),      DBPROPFLAGS_VIEW,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_SORTONINDEX  ),        DBPROPFLAGS_VIEW,     DBTYPE_BOOL,    {0,0,0,0,0},
  };

  //DBPROPSET_ROWSET
  const static DBPROPINFO rgRowsetPropInfo[] =
  {
    VALUE_WCHAR(DBPROP_ABORTPRESERVE  ),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_ACCESSORDER),        DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_APPENDONLY ),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_BLOCKINGSTORAGEOBJECTS ),  DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_BOOKMARKINFO),       DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_BOOKMARKS  ),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_BOOKMARKSKIPPED  ),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_BOOKMARKTYPE ),        DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_CACHEDEFERRED  ),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_CANFETCHBACKWARDS  ),    DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_CANHOLDROWS  ),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_CANSCROLLBACKWARDS ),    DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_CHANGEINSERTEDROWS ),    DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_CLIENTCURSOR),       DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_COLUMNRESTRICT ),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_COMMANDTIMEOUT ),      DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_COMMITPRESERVE ),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_DEFERRED ),          DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_DELAYSTORAGEOBJECTS  ),    DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_FINDCOMPAREOPS ),      DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_HIDDENCOLUMNS),        DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IAccessor  ),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IChapteredRowset ),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IColumnsInfo ),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IColumnsInfo2),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IColumnsRowset ),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IConnectionPointContainer),  DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IConvertType ),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_ICreateRow),         DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IDBAsynchStatus  ),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IGetRow),          DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IGetSession),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IGetSourceRow),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_ILockBytes),         DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IMMOBILEROWS),       DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IMultipleResults),     DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IParentRowset),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IRow),           DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IRowChange),         DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IRowSchemaChange),     DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IRowset  ),          DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IRowsetChange  ),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IRowsetCurrentIndex),    DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IRowsetFind  ),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IRowsetIdentity),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IRowsetIndex),       DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IRowsetInfo),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IRowsetLocate),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IRowsetRefresh),       DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IRowsetScroll),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IRowsetUpdate),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IRowsetView),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IScopedOperations),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_ISequentialStream),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IStorage),         DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IStream),          DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_ISupportErrorInfo),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_LITERALBOOKMARKS ),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_LITERALIDENTITY  ),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_LOCKMODE),         DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_MAXOPENROWS  ),        DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_MAXPENDINGROWS ),      DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_MAXROWS  ),          DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_MAYWRITECOLUMN ),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_MEMORYUSAGE  ),        DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_NOTIFICATIONGRANULARITY  ),  DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_NOTIFICATIONPHASES ),    DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_NOTIFYCOLUMNSET  ),      DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_NOTIFYROWDELETE  ),      DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_NOTIFYROWFIRSTCHANGE ),    DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_NOTIFYROWINSERT  ),      DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_NOTIFYROWRESYNCH ),      DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_NOTIFYROWSETRELEASE  ),    DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_NOTIFYROWSETFETCHPOSITIONCHANGE),  DBPROPFLAGS_ROWSET,     DBTYPE_I4,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_NOTIFYROWUNDOCHANGE  ),    DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_NOTIFYROWUNDODELETE  ),    DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_NOTIFYROWUNDOINSERT  ),    DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_NOTIFYROWUPDATE  ),      DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_ORDEREDBOOKMARKS ),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_OTHERINSERT  ),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_OTHERUPDATEDELETE  ),    DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_OWNINSERT  ),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_OWNUPDATEDELETE  ),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_QUICKRESTART ),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_REENTRANTEVENTS  ),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_REMOVEDELETED  ),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_REPORTMULTIPLECHANGES  ),  DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_RETURNPENDINGINSERTS ),    DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_ROW_BULKOPS),        DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_ROWRESTRICT  ),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_ROWSET_ASYNCH  ),      DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_ROWTHREADMODEL ),      DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_SERVERCURSOR ),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_SERVERDATAONINSERT),     DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_STRONGIDENTITY ),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_TRANSACTEDOBJECT ),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_UNIQUEROWS),         DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_UPDATABILITY ),        DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},

    //2.6
    //TODO: IRowsetBookmark and property are not doc'd - as of today?
    VALUE_WCHAR(DBPROP_IRowsetBookmark  ),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_SKIPROWCOUNTRESULTS  ),    DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},

    //Currently not doc'd due to unknown property set...
    VALUE_WCHAR(DBPROP_IBindResource),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IDBBinderProperties),    DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IRegisterProvider),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IRowsetResynch),       DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},

    //Deprecated Properties
//    VALUE_WCHAR(DBPROP_MARSHALLABLE ),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
  };

  //DBPROPSET_STREAM
  const static DBPROPINFO rgStreamPropInfo[] =
  {
    VALUE_WCHAR(DBPROP_OUTPUTSTREAM ),        DBPROPFLAGS_STREAM,     DBTYPE_IUNKNOWN,  {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_OUTPUTENCODING),       DBPROPFLAGS_STREAM,     DBTYPE_BSTR,    {0,0,0,0,0},
  };

  //Now build a static map of all the sets...
  const static DBPROPINFOSET rgAllPropInfoSet[] =
  {
    //DBPROPSET_COLUMN
    (DBPROPINFO*)rgColumnPropInfo,        NUMELE(rgColumnPropInfo),       {0xc8b522b9,0x5cf3,0x11ce,{0xad,0xe5,0x00,0xaa,0x00,0x44,0x77,0x3d}},
    //DBPROPSET_DATASOURCE
    (DBPROPINFO*)rgDataSourcePropInfo,      NUMELE(rgDataSourcePropInfo),   {0xc8b522ba,0x5cf3,0x11ce,{0xad,0xe5,0x00,0xaa,0x00,0x44,0x77,0x3d}},
    //DBPROPSET_DATASOURCEINFO
    (DBPROPINFO*)rgDataSourceInfoPropInfo,    NUMELE(rgDataSourceInfoPropInfo), {0xc8b522bb,0x5cf3,0x11ce,{0xad,0xe5,0x00,0xaa,0x00,0x44,0x77,0x3d}},
    //DBPROPSET_INDEX
    (DBPROPINFO*)rgIndexPropInfo,       NUMELE(rgIndexPropInfo),      {0xc8b522bd,0x5cf3,0x11ce,{0xad,0xe5,0x00,0xaa,0x00,0x44,0x77,0x3d}},
    //DBPROPSET_DBINIT
    (DBPROPINFO*)rgInitPropInfo,        NUMELE(rgInitPropInfo),       {0xc8b522bc,0x5cf3,0x11ce,{0xad,0xe5,0x00,0xaa,0x00,0x44,0x77,0x3d}},
    //DBPROPSET_SESSION
    (DBPROPINFO*)rgSessionPropInfo,       NUMELE(rgSessionPropInfo),      {0xc8b522c6,0x5cf3,0x11ce,{0xad,0xe5,0x00,0xaa,0x00,0x44,0x77,0x3d}},
    //DBPROPSET_TABLE
    (DBPROPINFO*)rgTablePropInfo,       NUMELE(rgTablePropInfo),      {0xc8b522bf,0x5cf3,0x11ce,{0xad,0xe5,0x00,0xaa,0x00,0x44,0x77,0x3d}},
    //DBPROPSET_TRUSTEE
    (DBPROPINFO*)rgTrusteePropInfo,       NUMELE(rgTrusteePropInfo),      {0xc8b522e1,0x5cf3,0x11ce,{0xad,0xe5,0x00,0xaa,0x00,0x44,0x77,0x3d}},
    //DBPROPSET_VIEW
    (DBPROPINFO*)rgViewPropInfo,        NUMELE(rgViewPropInfo),       {0xc8b522df,0x5cf3,0x11ce,{0xad,0xe5,0x00,0xaa,0x00,0x44,0x77,0x3d}},
    //DBPROPSET_ROWSET
    (DBPROPINFO*)rgRowsetPropInfo,        NUMELE(rgRowsetPropInfo),     {0xc8b522be,0x5cf3,0x11ce,{0xad,0xe5,0x00,0xaa,0x00,0x44,0x77,0x3d}},
    //DBPROPSET_STREAM
    (DBPROPINFO*)rgStreamPropInfo,        NUMELE(rgStreamPropInfo),     {0xc8b522fd,0x5cf3,0x11ce,{0xad,0xe5,0x00,0xaa,0x00,0x44,0x77,0x3d}},
  };

  if(cPropertyIDSets == 0)
  {
    //Return all OLE DB Defined sets to the caller.
    *pcStaticInfoSets   = NUMELE(rgAllPropInfoSet);
    *prgStaticInfoSets    = rgAllPropInfoSet;
    return S_OK;
  }
  else
  {
    //Currently this routine only handles one level.
    //All that we currently need at this point for RowsetViewer...
    ASSERT(cPropertyIDSets==1);
    ASSERT(rgPropertyIDSets && rgPropertyIDSets[0].cPropertyIDs==0);

    //First, is this a special property set, then map it to its defined property set...?
    GUID guidSpecialPropertySet = rgPropertyIDSets[0].guidPropertySet;
    IsSpecialPropSet(guidSpecialPropertySet, &guidSpecialPropertySet);

    //Now loop through all the Property Sets and see which is desired...
    for(ULONG iPropSet=0; iPropSet<NUMELE(rgAllPropInfoSet); iPropSet++)
    {
      const DBPROPINFOSET* pPropInfoSet = &rgAllPropInfoSet[iPropSet];
      if(guidSpecialPropertySet == pPropInfoSet->guidPropertySet)
      {
        *pcStaticInfoSets   = 1;
        *prgStaticInfoSets    = pPropInfoSet;
        return S_OK;
      }
    }
  }

//CLEANUP:
  //Otherwise propety set was not found...
  *pcStaticInfoSets = 0;
  *prgStaticInfoSets = NULL;
  return DB_E_NOTFOUND;
};

HRESULT GetStaticPropValues | ( | DBPROPID | dwPropertyID,
 |  | REFGUID | guidPropertySet,
 |  | ULONG * | pcPropValMap,
 |  | const WIDENAMEMAP ** | prgPropValMap
 | ) |  |

Definition at line 1714 of file error.cpp.

{
  ASSERT(pcPropValMap);
  ASSERT(prgPropValMap);

  //DBPROPSET_ROWSET
  if(guidPropertySet == DBPROPSET_ROWSET)
  {
    switch(dwPropertyID)
    {
      case DBPROP_UPDATABILITY:
      {
        const static WIDENAMEMAP rgUPDATABILITY[] =
        {
          VALUE_WCHAR(DBPROPVAL_UP_CHANGE ),
          VALUE_WCHAR(DBPROPVAL_UP_DELETE ),
          VALUE_WCHAR(DBPROPVAL_UP_INSERT ),
        };

        *pcPropValMap = NUMELE(rgUPDATABILITY);
        *prgPropValMap = rgUPDATABILITY;
        return S_OK;
      }
    };
  }
  else if(guidPropertySet == DBPROPSET_DBINIT)
  {
    switch(dwPropertyID)
    {
      case DBPROP_INIT_PROMPT:
      {
        const static WIDENAMEMAP rgPrompts[] =
        {
          VALUE_WCHAR(DBPROMPT_PROMPT),
          VALUE_WCHAR(DBPROMPT_COMPLETE),
          VALUE_WCHAR(DBPROMPT_COMPLETEREQUIRED),
          VALUE_WCHAR(DBPROMPT_NOPROMPT),
        };

        *pcPropValMap = NUMELE(rgPrompts);
        *prgPropValMap = rgPrompts;
        return S_OK;
      }
    };
  }

  return DB_E_NOTFOUND;
}

WCHAR* GetStatusName | ( | DBSTATUS | dbStatus,
 |  | DWORD | dwConvFlags
 | ) |  |

Definition at line 1609 of file error.cpp.

{
  return GetMapName(dbStatus, NUMELE(g_rgStatusMap), g_rgStatusMap, dwConvFlags);
}

DBSTATUS GetStatusValue ( WCHAR * pwszName )

Definition at line 1618 of file error.cpp.

{
  return GetMapName(pwszName, NUMELE(g_rgStatusMap), g_rgStatusMap);
}

BOOL IsSpecialPropSet | ( | REFGUID | guidSpecialPropertySet,
 |  | GUID * | pGuidPropertySet
 | ) |  |

Definition at line 1668 of file error.cpp.

{
  //Special Property Sets
  typedef struct _SPECIALGUIDMAP
  {
    const GUID* pSpecialPropertySet;
    const GUID* pGuidPropertySet;
  } SPECIALGUIDMAP;

  const static SPECIALGUIDMAP rgSpecialPropSet[] =
  {
    & DBPROPSET_COLUMNALL,            & DBPROPSET_COLUMN,
    & DBPROPSET_DATASOURCEALL,          & DBPROPSET_DATASOURCE,
    & DBPROPSET_DATASOURCEINFOALL,        & DBPROPSET_DATASOURCEINFO,
    & DBPROPSET_INDEXALL,           & DBPROPSET_INDEX,
    & DBPROPSET_DBINITALL,            & DBPROPSET_DBINIT,
    & DBPROPSET_SESSIONALL,           & DBPROPSET_SESSION,
    & DBPROPSET_TABLEALL,           & DBPROPSET_TABLE,
    & DBPROPSET_TRUSTEEALL,           & DBPROPSET_TRUSTEE,
    & DBPROPSET_VIEWALL,            & DBPROPSET_VIEW,
    & DBPROPSET_ROWSETALL,            & DBPROPSET_ROWSET,
    & DBPROPSET_STREAMALL,            & DBPROPSET_STREAM,
  };

  //Is this one of the special Property Sets
  for(ULONG iPropSet=0; iPropSet<NUMELE(rgSpecialPropSet); iPropSet++)
  {
    const SPECIALGUIDMAP* pSpecPropSet = &rgSpecialPropSet[iPropSet];
    if(guidSpecialPropertySet == *pSpecPropSet->pSpecialPropertySet)
    {
      if(pGuidPropertySet)
        *pGuidPropertySet = *pSpecPropSet->pGuidPropertySet;
      return TRUE;
    }
  }

  //Not a special set...
  return FALSE;
}

BOOL SetErrorPosting | ( | ERRORPOST | eErrorPost,
 |  | BOOL | fSet
 | ) |  |

Definition at line 25 of file error.cpp.

{
  if(fSet)
    g_dwErrorPost |= eErrorPost;
  else
    g_dwErrorPost &= ~eErrorPost;

  return TRUE;
};

Variable Documentation

const GUID DBGUID_MSSQLXML = {0x5d531cb2L,0xe6ed,0x11d2,{0xb2,0x52,0x00,0xc0,0x4f,0x68,0x1b,0x71}}
const GUID DBGUID_XPATH = {0xec2a4293L,0xe898,0x11d2,{0xb1,0xb7,0x00,0xc0,0x4f,0x68,0x0c,0x56}}
DWORD g_dwBreakID = 0

Definition at line 23 of file error.cpp.

DWORD g_dwErrorPost = EP_ERRORINFO_FAILURE | EP_HRESULT_NOERRORINFO

Definition at line 22 of file error.cpp.

Generated on Wed Nov 13 2024 16:53:28 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/error.h File Reference

  • Dataaccess
  • oledb
  • rowsetviewer
Classes | Typedefs | Enumerations | Functions | Variables

error.h File Reference

Go to the source code of this file.

Classes

struct | _NAMEMAP
struct | _WIDEDBIDMAP
struct | _WIDEGUIDMAP
struct | _WIDENAMEMAP

Typedefs

typedef struct _NAMEMAP | NAMEMAP
typedef struct _WIDEDBIDMAP | WIDEDBIDMAP
typedef struct _WIDEGUIDMAP | WIDEGUIDMAP
typedef struct _WIDENAMEMAP | WIDENAMEMAP

Enumerations

enum ERRORPOST {
EP_ERRORINFO_ALWAYS = 0x00000002, EP_ERRORINFO_FAILURE = 0x00000004, EP_ERRORINFO_NEVER = 0x00000008, EP_HRESULT_ALWAYS = 0x00000010,
EP_HRESULT_NOERRORINFO = 0x00000020, EP_HRESULT_NEVER = 0x00000040, EP_HRESULT_FAILURE = 0x00000080, EP_REFCOUNT_FAILURE = 0x00000100,
EP_IMALLOC_SPY = 0x00001000, EP_IMALLOC_ALLOCS = 0x00002000
}

Functions

HRESULT | DisplayAccessorErrors (HRESULT hrReturned, DBCOUNTITEM cBindings, const DBBINDING *rgBindings, DBBINDSTATUS *rgStatus)
HRESULT | DisplayAllErrors (HRESULT hrActual, HRESULT hrExpected, WCHAR *pwszFile=L"Unknown", ULONG ulLine=0, INT *piResult=0)
HRESULT | DisplayAllErrors (HRESULT hrActual, WCHAR *pwszFile=L"Unknown", ULONG ulLine=0, INT *piResult=0)
HRESULT | DisplayBindingErrors (HRESULT hrReturned, DBCOUNTITEM cBindings, const DBBINDING *rgBindings, void *pData)
HRESULT | DisplayColAccessErrors (HRESULT hrReturned, DBORDINAL cColAccess, DBCOLUMNACCESS *rgColAccess)
HRESULT | DisplayColumnErrors (HRESULT hrReturned, DBORDINAL cColumns, DBID *rgColumns, DBSTATUS *rgStatus)
HRESULT | DisplayErrorInfo (HRESULT hrActual, WCHAR *pwszFile=L"Unknown", ULONG ulLine=0, INT *piResult=0)
HRESULT | DisplayHRESULT (HRESULT hrActual, WCHAR *pwszFile=L"Unknown", ULONG ulLine=0, INT *piResult=0)
HRESULT | DisplayPropErrors (HRESULT hrReturned, REFIID riid, IUnknown *pIUnknown)
HRESULT | DisplayPropErrors (HRESULT hrReturned, ULONG cPropSets, DBPROPSET *rgPropSets)
HRESULT | DisplayPropErrors (HRESULT hrReturned, ULONG cPropInfoSets, DBPROPINFOSET *rgPropInfoSets)
HRESULT | DisplayRefCountErrors (WCHAR *pwszName, ULONG ulActRefCount, ULONG ulExpRefCount=0)
HRESULT | DisplayRowErrors (HRESULT hrReturned, DBROWCOUNT cRows, HROW *rghRows, DBROWSTATUS *rgRowStatus)
HRESULT | DisplayWinError (DWORD dwError, WCHAR *pwszFile, LONG lLine, WCHAR *pwszText=L"Windows")
HRESULT | GetAllocedPropInfo (ULONG cPropertyIDSets, DBPROPIDSET *rgPropertyIDSets, ULONG *pcPropInfoSets, DBPROPINFOSET **prgPropInfoSets)
WCHAR * | GetAsynchPhase (ULONG ulAsynchPhase)
WCHAR * | GetAsynchReason (ULONG ulOperation)
WCHAR * | GetBitMapName (DWORD dwItem, ULONG cNameMap, const WIDENAMEMAP *rgNameMap, DWORD dwBitStart=0)
WCHAR * | GetDialectName (REFGUID rguid)
CHAR * | GetErrorName (HRESULT hr)
BOOL | GetErrorPosting (ERRORPOST eErrorPost)
WCHAR * | GetInterfaceName (REFIID riid)
WCHAR * | GetMapName (const DBID *pDBID, ULONG cDBIDMap, const WIDEDBIDMAP *rgDBIDMap)
LONG | GetMapName (WCHAR *pwsz, ULONG cNameMap, const WIDENAMEMAP *rgNameMap)
CHAR * | GetMapName (LONG lItem, ULONG cNameMap, const NAMEMAP *rgNameMap)
WCHAR * | GetMapName (REFGUID guid, ULONG cGuidMap, const WIDEGUIDMAP *rgGuidMap)
WCHAR * | GetMapName (LONG lItem, ULONG cNameMap, const WIDENAMEMAP *rgNameMap, DWORD dwConvFlags=CONV_NONE)
LONG | GetMapName (CHAR *psz, ULONG cNameMap, const NAMEMAP *rgNameMap)
WCHAR * | GetObjectTypeName (REFGUID rguidObjectType)
WCHAR * | GetPhaseName (DBEVENTPHASE ePhase)
WCHAR * | GetPropertyName (DBPROPID dwPropertyID, REFGUID guidPropertySet)
WCHAR * | GetPropSetName (REFGUID guidPropertySet)
WCHAR * | GetPropStatusName (DBPROPSTATUS dbPropStatus)
WCHAR * | GetReasonName (DBREASON eReason)
WCHAR * | GetRowColName (const DBID *pColumnid)
HRESULT | GetSqlErrorInfo (ULONG iRecord, IErrorRecords *pIErrorRecords, BSTR *pBstr, LONG *plNativeError=NULL)
HRESULT | GetStaticPropInfo (ULONG cPropertyIDSets, DBPROPIDSET *rgPropertyIDSets, ULONG *pcStaticInfoSets, const DBPROPINFOSET **prgStaticInfoSets)
HRESULT | GetStaticPropValues (DBPROPID dwPropertyID, REFGUID guidPropertySet, ULONG *pcPropValMap, const WIDENAMEMAP **prgPropValMap)
WCHAR * | GetStatusName (DBSTATUS dbStatus, DWORD dwConvFlags=CONV_DECIMAL)
DBSTATUS | GetStatusValue (WCHAR *pszName)
BOOL | IsSpecialPropSet (REFGUID guidSpecialPropertySet, GUID *pGuidPropertySet)
BOOL | SetErrorPosting (ERRORPOST eErrorPost, BOOL fSet=TRUE)

Variables

const ULONG | g_cBindURLMaps
const ULONG | g_cCDFlagsMaps
const ULONG | g_cColFlagsMaps
const ULONG | g_cConsTypeMaps
const ULONG | g_cDBTypes
const ULONG | g_cDeferrabilityMaps
const ULONG | g_cDialectMaps
const ULONG | g_cInterfaceMaps
const ULONG | g_cIsoLevels
const ULONG | g_cLCID
const ULONG | g_cMatchTypeMaps
const ULONG | g_cObjectTypeMaps
const ULONG | g_cPromptOptions
const ULONG | g_cPropSetMaps
const ULONG | g_cResultFlagMaps
const ULONG | g_cRowColMaps
const ULONG | g_cSourceType
const ULONG | g_cUpDelRuleMaps
const ULONG | g_cVariantTypes
const ULONG | g_cXACTTC
DWORD g_dwBreakID
DWORD g_dwErrorPost
const WIDENAMEMAP | g_rgBindURLMaps []
const WIDENAMEMAP | g_rgCDFlagsMaps []
const WIDENAMEMAP | g_rgColFlagsMaps []
const WIDENAMEMAP | g_rgConsTypeMaps []
const WIDENAMEMAP | g_rgDBTypes []
const WIDENAMEMAP | g_rgDeferrabilityMaps []
const WIDEGUIDMAP | g_rgDialectMaps []
const WIDEGUIDMAP | g_rgInterfaceMaps []
const WIDENAMEMAP | g_rgIsoLevels []
const WIDENAMEMAP | g_rgLCID []
const WIDENAMEMAP | g_rgMatchTypeMaps []
const WIDEGUIDMAP | g_rgObjectTypeMaps []
const WIDENAMEMAP | g_rgPromptOptions []
const WIDEGUIDMAP | g_rgPropSetMaps []
const WIDENAMEMAP | g_rgResultFlagMaps []
const WIDEDBIDMAP | g_rgRowColMaps []
const WIDENAMEMAP | g_rgSourceType []
const WIDENAMEMAP | g_rgUpDelRuleMaps []
const WIDENAMEMAP | g_rgVariantTypes []
const WIDENAMEMAP | g_rgXACTTC []

Typedef Documentation

typedef struct _NAMEMAP NAMEMAP
typedef struct _WIDEDBIDMAP WIDEDBIDMAP
typedef struct _WIDEGUIDMAP WIDEGUIDMAP
typedef struct _WIDENAMEMAP WIDENAMEMAP

Enumeration Type Documentation

enum ERRORPOST
Enumerator:
EP_ERRORINFO_ALWAYS
EP_ERRORINFO_FAILURE
EP_ERRORINFO_NEVER
EP_HRESULT_ALWAYS
EP_HRESULT_NOERRORINFO
EP_HRESULT_NEVER
EP_HRESULT_FAILURE
EP_REFCOUNT_FAILURE
EP_IMALLOC_SPY
EP_IMALLOC_ALLOCS

Definition at line 54 of file error.h.

{
  EP_ERRORINFO_ALWAYS   = 0x00000002,
  EP_ERRORINFO_FAILURE  = 0x00000004,
  EP_ERRORINFO_NEVER    = 0x00000008,

  EP_HRESULT_ALWAYS   = 0x00000010,
  EP_HRESULT_NOERRORINFO  = 0x00000020,
  EP_HRESULT_NEVER    = 0x00000040,
  EP_HRESULT_FAILURE    = 0x00000080,

  EP_REFCOUNT_FAILURE   = 0x00000100,
  EP_IMALLOC_SPY      = 0x00001000,
  EP_IMALLOC_ALLOCS   = 0x00002000
};

Function Documentation

HRESULT DisplayAccessorErrors | ( | HRESULT | hrReturned,
 |  | DBCOUNTITEM | cBindings,
 |  | const DBBINDING * | rgBindings,
 |  | DBBINDSTATUS * | rgStatus
 | ) |  |

Definition at line 3180 of file error.cpp.

{
  //Display the badstatus for row operations.
  INT iSelect = 0;

  //Binding Errors only occur with the following returned codes...
  if(hrReturned!=DB_S_ERRORSOCCURRED && hrReturned!=DB_E_ERRORSOCCURRED)
    return hrReturned;

  //Display any binding errors
  for(ULONG i=0; i<cBindings; i++)
  {
    ASSERT(rgBindings);
    ASSERT(rgStatus);

    switch(rgStatus[i])
    {
      case DBBINDSTATUS_OK:
        break;

      //Display BindStatus Error to the user...
      default:
      {
        iSelect = wMessageBox(GetFocus(), MB_TASKMODAL | MB_ICONERROR | MB_OKCANCEL, wsz_ERROR,
          L"Accessor BindStatus Errors:\n"
          L"rgBindings[%lu]\n\n"
          L"iOrdinal = %ld\n"
          L"wType = %s\n"
          L"cbMaxLen = %lu\n"
          L"bPrecision = %d\n"
          L"bScale = %d\n\n"
          L"DBBINDSTATUS = %s",
          i,
          rgBindings[i].iOrdinal,
          GetDBTypeName(rgBindings[i].wType),
          rgBindings[i].cbMaxLen,
          rgBindings[i].bPrecision,
          rgBindings[i].bScale,
          GetMapName(rgStatus[i], NUMELE(g_rgBindStatusMap), g_rgBindStatusMap)
          );

        if(iSelect == IDCANCEL)
        {
          //NOTE: Will return DB_E_CANCELED if the user doesn't wish to continue
          hrReturned = DB_E_CANCELED;
          goto CLEANUP;
        }
        break;
      }
    }
  }

CLEANUP:
  return hrReturned;
}

HRESULT DisplayAllErrors | ( | HRESULT | hrActual,
 |  | HRESULT | hrExpected,
 |  | WCHAR * | pwszFile = L"Unknown",
 |  | ULONG | ulLine = 0,
 |  | INT * | piResult = 0
 | ) |  |

Definition at line 3469 of file error.cpp.

{
  BOOL bEqual = (hrActual == hrExpected) || (hrActual == S_OK);

  //First Display any ErrorInfo
  //NOTE: If ErrorInfo=Always, ErrorInfo is always displayed
  if((!bEqual || GetErrorPosting(EP_ERRORINFO_ALWAYS)) && !GetErrorPosting(EP_ERRORINFO_NEVER))
  {
    if(DisplayErrorInfo(hrActual, pwszFile, ulLine, piResult)==S_OK)
    {
      //We had ErrorInfo, no need to display error info
      //Unless the user has something other than NOERRORINFO selected
      if(GetErrorPosting(EP_HRESULT_NOERRORINFO))
        goto CLEANUP;
    }
  }

  //Second, Display the HRESULT, (if requested)
  //NOTE: If HRESULT=Always, Hresult is always displayed, except if S_OK is returned, otherwise you would always get message boxes...
  if((!bEqual || (hrActual!=S_OK && GetErrorPosting(EP_HRESULT_ALWAYS))) && !GetErrorPosting(EP_HRESULT_NEVER))
  {
    //Display the HRESULT
    DisplayHRESULT(hrActual, pwszFile, ulLine, piResult);
  }

CLEANUP:
  //We need to return a failure code if not equal, so we don't continue...
  if(!bEqual && SUCCEEDED(hrActual))
    return E_FAIL;

  return hrActual;
}

HRESULT DisplayAllErrors | ( | HRESULT | hrActual,
 |  | WCHAR * | pwszFile = L"Unknown",
 |  | ULONG | ulLine = 0,
 |  | INT * | piResult = 0
 | ) |  |

Definition at line 3458 of file error.cpp.

{
  //Delegate
  //This function just verifies that the hreuslt succeeded...
  return DisplayAllErrors(hrActual, SUCCEEDED(hrActual) ? hrActual : S_OK, pwszFile, ulLine, piResult);
}

HRESULT DisplayBindingErrors | ( | HRESULT | hrReturned,
 |  | DBCOUNTITEM | cBindings,
 |  | const DBBINDING * | rgBindings,
 |  | void * | pData
 | ) |  |

Definition at line 2739 of file error.cpp.

{
  //Display the badstatus for pData operations.
  //(ie:  GetData / SetData / InsertRow)
  INT iSelect = 0;

  //Binding Errors only occur with the following returned codes...
  if(hrReturned!=DB_S_ERRORSOCCURRED && hrReturned!=DB_E_ERRORSOCCURRED)
    return hrReturned;

  for(ULONG i=0; i<cBindings; i++)
  {
    ASSERT(rgBindings);

    //If STATUS is not bound, we don't know if this binding failed or not.
    //And we can't really access the data or length, since we are not sure what the status is...
    if(!STATUS_IS_BOUND(rgBindings[i]))
      continue;

    DBSTATUS dbStatus = BINDING_STATUS(rgBindings[i], pData);
    DBLENGTH dbLength = LENGTH_IS_BOUND(rgBindings[i]) ? BINDING_LENGTH(rgBindings[i], pData) : 0;

    switch(dbStatus)
    {
      case DBSTATUS_S_OK:
      case DBSTATUS_S_ISNULL:
      case DBSTATUS_S_DEFAULT:
      case DBSTATUS_S_IGNORE:
        break;

      //Display Status Error to the user...
      default:
      {
        iSelect = wMessageBox(GetFocus(), MB_TASKMODAL | MB_ICONERROR | MB_OKCANCEL, wsz_ERROR,
          L"Binding Status Errors:\n"
          L"rgBindings[%lu]\n\n"
          L"iOrdinal = %ld\n"
          L"wType = %s\n"
          L"cbMaxLen = %lu\n"
          L"bPrecision = %d\n"
          L"bScale = %d\n\n"
          L"DBSTATUS = %s\n"
          L"DBLENGTH = %lu\n",
          i,
          rgBindings[i].iOrdinal,
          GetDBTypeName(rgBindings[i].wType),
          rgBindings[i].cbMaxLen,
          rgBindings[i].bPrecision,
          rgBindings[i].bScale,
          GetStatusName(dbStatus),
          dbLength
          );

        if(iSelect == IDCANCEL)
        {
          hrReturned = DB_E_CANCELED;
          goto CLEANUP;
        }
        break;
      }
    }
  }

CLEANUP:
  return hrReturned;
}

HRESULT DisplayColAccessErrors | ( | HRESULT | hrReturned,
 |  | DBORDINAL | cColAccess,
 |  | DBCOLUMNACCESS * | rgColAccess
 | ) |  |

Definition at line 2811 of file error.cpp.

{
  //Display the badstatus for pData operations.
  //(ie:  GetData / SetData / InsertRow)
  INT iSelect = 0;

  //Binding Errors only occur with the following returned codes...
  if(hrReturned!=DB_S_ERRORSOCCURRED && hrReturned!=DB_E_ERRORSOCCURRED)
    return hrReturned;

  for(ULONG i=0; i<cColAccess; i++)
  {
    ASSERT(rgColAccess);
    DBCOLUMNACCESS* pColAccess = &rgColAccess[i];

    switch(pColAccess->dwStatus)
    {
      case DBSTATUS_S_OK:
      case DBSTATUS_S_ISNULL:
      case DBSTATUS_S_DEFAULT:
      case DBSTATUS_S_IGNORE:
        break;

      default:
      {
        //Convert the Column ID into a string
        WCHAR wszBuffer[MAX_NAME_LEN] = {0};
        DBIDToString(&pColAccess->columnid, wszBuffer, MAX_NAME_LEN);

        //Display Status Error to the user...
        iSelect = wMessageBox(GetFocus(), MB_TASKMODAL | MB_ICONERROR | MB_OKCANCEL, wsz_ERROR,
          L"ColumnAccess Status Errors:\n"
          L"rgColAccess[%lu]\n\n"
          L"columnid = %s\n"
          L"wType = %s\n"
          L"cbMaxLen = %lu\n"
          L"bPrecision = %d\n"
          L"bScale = %d\n\n"
          L"dwStatus = %s\n"
          L"cbDataLen = %lu\n",
          i,
          wszBuffer,
          GetDBTypeName(pColAccess->wType),
          pColAccess->cbMaxLen,
          pColAccess->bPrecision,
          pColAccess->bScale,
          GetStatusName(pColAccess->dwStatus),
          pColAccess->cbDataLen
          );

        if(iSelect == IDCANCEL)
        {
          hrReturned = DB_E_CANCELED;
          goto CLEANUP;
        }
        break;
      }
    }
  }

CLEANUP:
  return hrReturned;
}

HRESULT DisplayColumnErrors | ( | HRESULT | hrReturned,
 |  | DBORDINAL | cColumns,
 |  | DBID * | rgColumns,
 |  | DBSTATUS * | rgStatus
 | ) |  |

Definition at line 2880 of file error.cpp.

{
  //Display the badstatus for pData operations.
  //(ie:  GetData / SetData / InsertRow)
  INT iSelect = 0;

  //Binding Errors only occur with the following returned codes...
  if(hrReturned!=DB_S_ERRORSOCCURRED && hrReturned!=DB_E_ERRORSOCCURRED)
    return hrReturned;

  for(ULONG i=0; i<cColumns; i++)
  {
    ASSERT(rgColumns);
    DBID* pDBID = &rgColumns[i];

    switch(rgStatus[i])
    {
      case DBSTATUS_S_OK:
      case DBSTATUS_S_ISNULL:
      case DBSTATUS_S_DEFAULT:
      case DBSTATUS_S_IGNORE:
        break;

      default:
      {
        //Convert the Column ID into a string
        WCHAR wszBuffer[MAX_NAME_LEN] = {0};
        DBIDToString(pDBID, wszBuffer, MAX_NAME_LEN);

        //Display Status Error to the user...
        iSelect = wMessageBox(GetFocus(), MB_TASKMODAL | MB_ICONERROR | MB_OKCANCEL, wsz_ERROR,
          L"Column Status Errors:\n"
          L"rgColumnIDs[%lu]\n\n"
          L"columnid = %s\n"
          L"dwStatus = %s\n",
          i,
          wszBuffer,
          GetStatusName(rgStatus[i])
          );

        if(iSelect == IDCANCEL)
        {
          hrReturned = DB_E_CANCELED;
          goto CLEANUP;
        }
        break;
      }
    }
  }

CLEANUP:
  return hrReturned;
}

HRESULT DisplayErrorInfo | ( | HRESULT | hrActual,
 |  | WCHAR * | pwszFile = L"Unknown",
 |  | ULONG | ulLine = 0,
 |  | INT * | piResult = 0
 | ) |  |

Definition at line 3603 of file error.cpp.

{
  HRESULT hr = S_OK;

  CSmartPtr<IErrorInfo>   spErrorInfo;
  CSmartPtr<IErrorRecords>  spErrorRecords;
  ULONG cErrorRecords = 0;

  CComBSTR cstrDescription;
  CComBSTR cstrSource;
  CComBSTR cstrSQLInfo;
  INT iResult = 0;
  static LCID lcid = GetSystemDefaultLCID();

  //NOTE: GetErrorInfo will return S_OK and a NULL pointer if there is not error object
  if((hr = GetErrorInfo(0, &spErrorInfo))==S_OK && spErrorInfo)
  {
    //The Error Object may support multiple Errors (IErrorRecords)
    if(SUCCEEDED(hr = spErrorInfo->QueryInterface(&spErrorRecords)))
    {
      //Multiple Errors
      XTESTC(hr = spErrorRecords->GetRecordCount(&cErrorRecords));
    }
    else
    {
      //Only a single Error Object
      cErrorRecords = 1;
    }

    LONG lNativeError = 0;
    ERRORINFO ErrorInfo = { hrActual, 0 };

    //Loop through the records
    for(ULONG i=0; i<cErrorRecords; i++)
    {
      //For multiple errors, we will allow the user to cancel out of the dialogs
      //since the user may not be interested in clicking through many errors...
      //NOTE: This logic puts on the CANCEL button if more than 1 and not the last error...
      UINT uMBType = MB_TASKMODAL | MB_ICONERROR | MB_OK;
      if(i < (cErrorRecords-1))
        uMBType |= MB_OKCANCEL;

      //ErrorRecords
      if(spErrorRecords)
      {
        spErrorInfo.Release();
        XTESTC(hr = spErrorRecords->GetErrorInfo(i, lcid, &spErrorInfo));

        //Get the Basic ErrorInfo
        XTEST(hr = spErrorRecords->GetBasicErrorInfo(i, &ErrorInfo));

        //Get the SQL Info
        GetSqlErrorInfo(i, spErrorRecords, &cstrSQLInfo, &lNativeError);
      }
      else
      {
        //ErrorInfo is only available...
        XTEST(hr = spErrorInfo->GetGUID(&ErrorInfo.iid));
      }

      //Get the Description
      XTEST(hr = spErrorInfo->GetDescription(&cstrDescription));

      //Get the Source - this will be the window title...
      XTEST(hr = spErrorInfo->GetSource(&cstrSource));

      //Display the Error
      if(cstrSQLInfo)
      {
        iResult = wMessageBox(GetFocus(), uMBType, cstrSource ? cstrSource : wsz_ERRORINFO,
                L"Source: \"%s\"\n\n"
                L"Interface: %s\n"
                L"Result: 0x%08x = %S\n\n"
                L"ISQLErrorInfo: [%s][0x%08x]\n"
                L"IErrorInfo: [0x%08x] \"%s\"\n\n"
                L"File: %s\n"
                L"Line: %d",
                cstrSource,
                GetInterfaceName(ErrorInfo.iid),
                ErrorInfo.hrError, GetErrorName(ErrorInfo.hrError),
                cstrSQLInfo, lNativeError,
                ErrorInfo.dwMinor, cstrDescription,
                pwszFile,
                ulLine);
      }
      else
      {
        iResult = wMessageBox(GetFocus(), uMBType, cstrSource ? cstrSource : wsz_ERRORINFO,
                L"Source: \"%s\"\n\n"
                L"Interface: %s\n"
                L"Result: 0x%08x = %S\n\n"
//                L"ISQLErrorInfo: [%s][0x%08x]\n"
                L"IErrorInfo: [0x%08x] \"%s\"\n\n"
                L"File: %s\n"
                L"Line: %d",
                cstrSource,
                GetInterfaceName(ErrorInfo.iid),
                ErrorInfo.hrError, GetErrorName(ErrorInfo.hrError),
//                cstrSQLInfo, lNativeError,
                ErrorInfo.dwMinor, cstrDescription,
                pwszFile,
                ulLine);
      }

      spErrorInfo.Release();
      cstrDescription.Empty();
      cstrSource.Empty();
      cstrSQLInfo.Empty();

      if(iResult == IDCANCEL)
        goto CLEANUP;
    }
  }

CLEANUP:
  if(piResult)
    *piResult = iResult;
  return hr;
}

HRESULT DisplayHRESULT | ( | HRESULT | hrActual,
 |  | WCHAR * | pwszFile = L"Unknown",
 |  | ULONG | ulLine = 0,
 |  | INT * | piResult = 0
 | ) |  |

Definition at line 3555 of file error.cpp.

{
  //If we end up here, their must not be any extended error info supported by the provider
  //the best we can do is display the HRESULT, and see of the system has a defined string
  //for the last error?
  CHAR* pszError = NULL;
  INT iResult = 0;

  //Format the Message (obtain the textual string)
  FormatMessageA(
    FORMAT_MESSAGE_ALLOCATE_BUFFER |
    FORMAT_MESSAGE_FROM_SYSTEM |
    FORMAT_MESSAGE_IGNORE_INSERTS,
    NULL,
    hrActual,
    MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
    (CHAR*)&pszError,
    0,
    NULL );

  if(pszError)
  {
    //Display the Error (including Windows Defined String)
    iResult = wMessageBox(GetFocus(), MB_TASKMODAL | MB_ICONERROR | MB_OK, wsz_ERROR,
      L"Interface: %s\nResult: 0x%08x = %S\n\nFormatMessage: \"%S\"\n\nFile: %s\nLine: %d", L"Unknown", hrActual, GetErrorName(hrActual), pszError, pwszFile, ulLine);

    // Free the buffer from Format Message
    LocalFree( pszError );
  }
  else
  {
    //Display the Error
    iResult = wMessageBox(GetFocus(), MB_TASKMODAL | MB_ICONERROR | MB_OK, wsz_ERROR,
      L"Interface: %s\nResult: 0x%08x = %S\n\nFile: %s\nLine: %d", L"Unknown", hrActual, GetErrorName(hrActual), pwszFile, ulLine);
  }

  if(piResult)
    *piResult = iResult;

  return hrActual;
}

HRESULT DisplayPropErrors | ( | HRESULT | hrReturned,
 |  | REFIID | riid,
 |  | IUnknown * | pIUnknown
 | ) |  |

Definition at line 3382 of file error.cpp.

{
  ASSERT(pIUnknown);

  //Property Errors only occur with the following returned codes...
  if(hrReturned!=DB_S_ERRORSOCCURRED && hrReturned!=DB_E_ERRORSOCCURRED)
    return hrReturned;

  //GetProperties with DBPROPSET_PROPERTIESINERROR.
  ULONG cPropSets = 0;
  DBPROPSET* rgPropSets = NULL;
  IDBProperties* pIDBProperties = NULL;
  ICommandProperties* pICommandProperties = NULL;

  //Setup input DBPROPSET_PROPERTIESINERROR
  const ULONG cPropertyIDSets = 1;
  DBPROPIDSET rgPropertyIDSets[cPropertyIDSets];
  rgPropertyIDSets[0].guidPropertySet = DBPROPSET_PROPERTIESINERROR;
  rgPropertyIDSets[0].cPropertyIDs = 0;
  rgPropertyIDSets[0].rgPropertyIDs = NULL;

  //Which GetProperties
  if(riid == IID_IDBProperties)
  {
    XTESTC(pIUnknown->QueryInterface(IID_IDBProperties, (void**)&pIDBProperties));
    XTESTC(pIDBProperties->GetProperties(cPropertyIDSets, rgPropertyIDSets, &cPropSets, &rgPropSets));
  }
  else
  {
    XTESTC(pIUnknown->QueryInterface(IID_ICommandProperties, (void**)&pICommandProperties));
    XTESTC(pICommandProperties->GetProperties(cPropertyIDSets, rgPropertyIDSets, &cPropSets, &rgPropSets));
  }

  //Now delegate to display all properties in error
  TESTC(hrReturned = DisplayPropErrors(hrReturned, cPropSets, rgPropSets));

CLEANUP:
  FreeProperties(&cPropSets, &rgPropSets);
  SAFE_RELEASE(pICommandProperties);
  SAFE_RELEASE(pIDBProperties);
  return hrReturned;
}

HRESULT DisplayPropErrors | ( | HRESULT | hrReturned,
 |  | ULONG | cPropSets,
 |  | DBPROPSET * | rgPropSets
 | ) |  |

Definition at line 3241 of file error.cpp.

{
  //Property Errors only occur with the following returned codes...
  if(hrReturned!=DB_S_ERRORSOCCURRED && hrReturned!=DB_E_ERRORSOCCURRED)
    return hrReturned;

  //Display all property errors...
  for(ULONG iPropSet=0; iPropSet<cPropSets; iPropSet++)
  {
    DBPROPSET* pPropSet = &rgPropSets[iPropSet];
    for(ULONG iProp=0; iProp<pPropSet->cProperties; iProp++)
    {
      DBPROP* pProp = &pPropSet->rgProperties[iProp];
      if(pProp->dwStatus != DBPROPSTATUS_OK)
      {
        WCHAR wszBuffer[MAX_NAME_LEN+1];
        WCHAR wszPropSet[MAX_NAME_LEN+1];

        WCHAR* pwszPropSet = GetPropSetName(pPropSet->guidPropertySet);
        if(pwszPropSet == NULL)
        {
          StringFromGUID2(pPropSet->guidPropertySet, wszPropSet, MAX_NAME_LEN);
          pwszPropSet = wszPropSet;
        }

        //Find property Value
        wszBuffer[0] = wEOL;
        VariantToString(&pProp->vValue, wszBuffer, MAX_NAME_LEN, CONV_VARBOOL);

        //Append the Error
        INT iSelect = wMessageBox
          (
            GetFocus(), MB_TASKMODAL | MB_ICONERROR | MB_OKCANCEL, wsz_ERROR,
            L"Properties in Error:\n"
            L"rgPropSets[%d].rgProperties[%d]\n\n"
            L"guidPropertySet\t= %s\n"
            L"dwPropertyID\t= %s (0x%x)\n"
            L"dwOptions\t\t= %s\n"
            L"vValue.vt\t\t= %s\n"
            L"vValue\t\t= %s\n\n"
            L"dbStatus\t\t= %s",
            iPropSet,iProp,
            pwszPropSet,
            GetPropertyName(pProp->dwPropertyID, pPropSet->guidPropertySet),
            pProp->dwPropertyID,
            pProp->dwOptions == DBPROPOPTIONS_REQUIRED ? L"DBPROPOPTIONS_REQUIRED" : L"DBPROPOPTIONS_OPTIONAL",
            GetVariantTypeName(V_VT(&pProp->vValue)),
            wszBuffer,
            GetPropStatusName(pProp->dwStatus)
          );

        if(iSelect == IDCANCEL)
        {
          //NOTE: Will return DB_E_CANCELED if the user doesn't wish to continue
          hrReturned = DB_E_CANCELED;
          goto CLEANUP;
        }
      }
    }
  }

CLEANUP:
  return hrReturned;
}

HRESULT DisplayPropErrors | ( | HRESULT | hrReturned,
 |  | ULONG | cPropInfoSets,
 |  | DBPROPINFOSET * | rgPropInfoSets
 | ) |  |

Definition at line 3311 of file error.cpp.

{
  //Property Errors only occur with the following returned codes...
  if(hrReturned!=DB_S_ERRORSOCCURRED && hrReturned!=DB_E_ERRORSOCCURRED)
    return hrReturned;

  //Display all property errors...
  for(ULONG iPropInfoSet=0; iPropInfoSet<cPropInfoSets; iPropInfoSet++)
  {
    DBPROPINFOSET* pPropInfoSet = &rgPropInfoSets[iPropInfoSet];
    for(ULONG iPropInfo=0; iPropInfo<pPropInfoSet->cPropertyInfos; iPropInfo++)
    {
      DBPROPINFO* pPropInfo = &pPropInfoSet->rgPropertyInfos[iPropInfo];
      if(pPropInfo->dwFlags == DBPROPFLAGS_NOTSUPPORTED)
      {
        WCHAR wszBuffer[MAX_NAME_LEN+1];
        WCHAR wszPropSet[MAX_NAME_LEN+1];

        WCHAR* pwszPropSet = GetPropSetName(pPropInfoSet->guidPropertySet);
        if(pwszPropSet == NULL)
        {
          StringFromGUID2(pPropInfoSet->guidPropertySet, wszPropSet, MAX_NAME_LEN);
          pwszPropSet = wszPropSet;
        }

        //Find property Value
        wszBuffer[0] = wEOL;
        VariantToString(&pPropInfo->vValues, wszBuffer, MAX_NAME_LEN, CONV_VARBOOL);

        //Append the Error
        INT iSelect = wMessageBox
          (
            GetFocus(), MB_TASKMODAL | MB_ICONERROR | MB_OKCANCEL, wsz_ERROR,
            L"Properties in Error:\n"
            L"rgPropInfoSets[%d].rgPropertyInfos[%d]\n\n"
            L"guidPropertySet\t= %s\n"
            L"pwszDescription\t= %s\n"
            L"dwPropertyID\t= %s (0x%x)\n"
            L"vtType\t\t= %s\n"
            L"vValues\t\t= %s\n\n"
            L"dwFlags\t\t= %s (0x%x)",
            iPropInfoSet,iPropInfo,
            pwszPropSet,
            pPropInfo->pwszDescription,
            GetPropertyName(pPropInfo->dwPropertyID, pPropInfoSet->guidPropertySet),
            pPropInfo->dwPropertyID,
            GetVariantTypeName(pPropInfo->vtType),
            wszBuffer,
            L"DBPROPFLAGS_NOTSUPPORTED",
            pPropInfo->dwFlags
          );

        if(iSelect == IDCANCEL)
        {
          //NOTE: Will return DB_E_CANCELED if the user doesn't wish to continue
          hrReturned = DB_E_CANCELED;
          goto CLEANUP;
        }
      }
    }
  }

CLEANUP:
  return hrReturned;
}

HRESULT DisplayRefCountErrors | ( | WCHAR * | pwszName,
 |  | ULONG | ulActRefCount,
 |  | ULONG | ulExpRefCount = 0
 | ) |  |

Definition at line 3430 of file error.cpp.

{
  ASSERT(pwszName);

  //Display RefCount difference...
  if(ulActRefCount != ulExpRefCount && GetErrorPosting(EP_REFCOUNT_FAILURE))
  {
    wMessageBox
      (
      GetFocus(),
      MB_TASKMODAL | MB_ICONERROR | MB_OK,
      wsz_ERROR,
      L"%s\n"
      L"RefCount = %d, Expected = %d",
      pwszName,
      ulActRefCount,
      ulExpRefCount
      );
  }

  return S_OK;
}

HRESULT DisplayRowErrors | ( | HRESULT | hrReturned,
 |  | DBROWCOUNT | cRows,
 |  | HROW * | rghRows,
 |  | DBROWSTATUS * | rgRowStatus
 | ) |  |

Definition at line 3112 of file error.cpp.

{
  //Display the badstatus for row operations.
  INT iSelect = 0;

  //Binding Errors only occur with the following returned codes...
  if(hrReturned!=DB_S_ERRORSOCCURRED && hrReturned!=DB_E_ERRORSOCCURRED)
    return hrReturned;

  for(LONG i=0; i<cRows; i++)
  {
    ASSERT(rghRows);
    ASSERT(rgRowStatus);

    switch(rgRowStatus[i])
    {
      case DBROWSTATUS_S_OK:
        break;

      //Display RowStatus Error to the user...
      default:
      {
        iSelect = wMessageBox(GetFocus(), MB_TASKMODAL | MB_ICONERROR | MB_OKCANCEL, wsz_ERROR,
          L"Row Status Errors:\n\n"
          L"rghRow[%lu] = 0x%p\n"
          L"DBROWSTATUS = %d=%s",
          i,
          rghRows[i],
          rgRowStatus[i],
          GetMapName(rgRowStatus[i], NUMELE(g_rgRowStatusMap), g_rgRowStatusMap)
          );

        if(iSelect == IDCANCEL)
        {
          //NOTE: Will return DB_E_CANCELED if the user doesn't wish to continue
          hrReturned = DB_E_CANCELED;
          goto CLEANUP;
        }
        break;
      }
    }
  }

CLEANUP:
  return hrReturned;
}

HRESULT DisplayWinError | ( | DWORD | dwError,
 |  | WCHAR * | pwszFile,
 |  | LONG | lLine,
 |  | WCHAR * | pwszText = L"Windows"
 | ) |  |

Definition at line 3507 of file error.cpp.

{
  if(dwError)
  {
    CHAR* pszError = NULL;

    //Format the Message (obtain the textual string)
    FormatMessageA(
      FORMAT_MESSAGE_ALLOCATE_BUFFER |
      FORMAT_MESSAGE_FROM_SYSTEM |
      FORMAT_MESSAGE_IGNORE_INSERTS,
      NULL,
      dwError,
      MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
      (CHAR*)&pszError,
      0,
      NULL
    );

    if(pszError)
    {
      //Display the Error
      wMessageBox
        (
        GetFocus(), MB_TASKMODAL | MB_ICONERROR | MB_OK, wsz_ERROR,
        L"%s: GetLastError() = %d = %S" wWndEOL
        L"<File:%s>" wWndEOL
        L"Line:%d" wWndEOL,
        pwszText,
        dwError,
        pszError,
        pwszFile,
        lLine
        );

      // Free the buffer.
      LocalFree( pszError );
    }
  }

  return dwError;
}

HRESULT GetAllocedPropInfo | ( | ULONG | cPropertyIDSets,
 |  | DBPROPIDSET * | rgPropertyIDSets,
 |  | ULONG * | pcPropInfoSets,
 |  | DBPROPINFOSET ** | prgPropInfoSets
 | ) |  |

Definition at line 2164 of file error.cpp.

{
  HRESULT hr = S_OK;
  ASSERT(pcPropInfoSets);
  ASSERT(prgPropInfoSets);

  ULONG iPropSet,cStaticInfoSets = 0;
  const DBPROPINFOSET* rgStaticInfoSets = NULL;

  ULONG cPropInfoSets = 0;
  DBPROPINFOSET* rgPropInfoSets = NULL;

  //Delegate
  TESTC(hr = GetStaticPropInfo(cPropertyIDSets, rgPropertyIDSets, &cStaticInfoSets, &rgStaticInfoSets));

  //Now dump this static info into an allocated DBPROPINFOSET...
  SAFE_ALLOC(rgPropInfoSets, DBPROPINFOSET, cStaticInfoSets);
  cPropInfoSets = cStaticInfoSets;
  for(iPropSet=0; iPropSet<cStaticInfoSets; iPropSet++)
  {
    //Setup outer
    rgPropInfoSets[iPropSet].cPropertyInfos   = rgStaticInfoSets[iPropSet].cPropertyInfos;
    rgPropInfoSets[iPropSet].guidPropertySet  = rgStaticInfoSets[iPropSet].guidPropertySet;
    SAFE_ALLOC(rgPropInfoSets[iPropSet].rgPropertyInfos, DBPROPINFO, rgStaticInfoSets[iPropSet].cPropertyInfos);
    memcpy(rgPropInfoSets[iPropSet].rgPropertyInfos, rgStaticInfoSets[iPropSet].rgPropertyInfos, sizeof(DBPROPINFO)*rgStaticInfoSets[iPropSet].cPropertyInfos);
  }

CLEANUP:
  *pcPropInfoSets = cPropInfoSets;
  *prgPropInfoSets = rgPropInfoSets;
  return hr;
};

WCHAR* GetAsynchPhase ( ULONG ulAsynchPhase )

Definition at line 3093 of file error.cpp.

{
  const static WIDENAMEMAP  rgAsynchPhase[] =
  {
    VALUE_WCHAR(DBASYNCHPHASE_INITIALIZATION),
    VALUE_WCHAR(DBASYNCHPHASE_POPULATION),
    VALUE_WCHAR(DBASYNCHPHASE_COMPLETE),
    VALUE_WCHAR(DBASYNCHPHASE_CANCELED),
  };

  return GetMapName(ulAsynchPhase, NUMELE(rgAsynchPhase), rgAsynchPhase);
}

WCHAR* GetAsynchReason ( ULONG ulOperation )

Definition at line 3079 of file error.cpp.

{
  const static WIDENAMEMAP  rgAsynchReason[] =
  {
    VALUE_WCHAR(  DBASYNCHOP_OPEN ),
  };

  return GetMapName(ulOperation, NUMELE(rgAsynchReason), rgAsynchReason);
}

WCHAR* GetBitMapName | ( | DWORD | dwItem,
 |  | ULONG | cNameMap,
 |  | const WIDENAMEMAP * | rgNameMap,
 |  | DWORD | dwBitStart = 0
 | ) |  |

Definition at line 2595 of file error.cpp.

{
  static WCHAR wszBuffer[MAX_NAME_LEN] = {0};
  DWORD dwItemBase = dwItem;
  DWORD dwFound = 0;

  //NOTE: Some bitmasks, are actually composed of some sequental values, and then some bits.
  //For Example, DBTYPE_* contains sequential types upto a point, and then the rest are bit masks.
  //This function is designed to handle this case as well, dwBitStart denotes all bits that
  //are allowed to be on, all other values (non-indicated-bits) will be compared literally ie: (==).
  if(dwBitStart)
    dwItemBase &= ~dwBitStart;  //Remove all high order bits

  for(ULONG i=0; i<cNameMap; i++)
  {
    //Does our item contains this particular bit?
    if(BIT_SET(dwItem, (DWORD)rgNameMap[i].lItem))
    {
      if(dwBitStart)
      {
        //If we are using a bitstart, then we need to make sure either this is one
        //of the special orable bits, or the items match exactly, if not then skip...
        if(! ((dwBitStart & rgNameMap[i].lItem) || dwItemBase == (DWORD)rgNameMap[i].lItem) )
          continue;
      }

      if(dwFound)
      {
        wcscat(wszBuffer, L" | ");
        wcscat(wszBuffer, rgNameMap[i].pwszName);
      }
      else
      {
        wcscpy(wszBuffer, rgNameMap[i].pwszName);
      }

      //NOTE: We keep track of all the "bits" we have found.
      dwFound |= rgNameMap[i].lItem;
    }
  }

  //We keep track of all the bits we saw, so if at the end we didn't see some of the bits
  //then we just return the bits, and not an incorrect sub-set string mapping...
  if(dwFound != dwItem)
  {
    //Unknown, just display bitmask as hex
    StringFormat(wszBuffer, NUMELE(wszBuffer), L"0x%08x", dwItem);
  }

  //return
  return wszBuffer;
}

WCHAR* GetDialectName ( REFGUID rguid )

Definition at line 2728 of file error.cpp.

{
  return GetMapName(rguid, g_cDialectMaps, g_rgDialectMaps);
}

CHAR* GetErrorName ( HRESULT hr )

Definition at line 2686 of file error.cpp.

{
  return GetMapName(hr, NUMELE(g_rgErrorMap), g_rgErrorMap);
}

BOOL GetErrorPosting ( ERRORPOST eErrorPost )

Definition at line 35 of file error.cpp.

{
  return g_dwErrorPost & eErrorPost;
};

WCHAR* GetInterfaceName ( REFIID riid )

Definition at line 2696 of file error.cpp.

{
  return GetMapName(riid, NUMELE(g_rgInterfaceMaps), g_rgInterfaceMaps);
}

WCHAR* GetMapName | ( | const DBID * | pDBID,
 |  | ULONG | cDBIDMap,
 |  | const WIDEDBIDMAP * | rgDBIDMap
 | ) |  |

Definition at line 2670 of file error.cpp.

{
  for(ULONG i=0; i<cMap; i++)
  {
    if(memcmp(pDBID, rgMap[i].pDBID, sizeof(DBID))==0)
      return rgMap[i].pwszName;
  }

  //Otherwise indicate failure
  return NULL;
}

LONG GetMapName | ( | WCHAR * | pwsz,
 |  | ULONG | cNameMap,
 |  | const WIDENAMEMAP * | rgNameMap
 | ) |  |

Definition at line 2533 of file error.cpp.

{
  for(ULONG i=0; i<cNameMap; i++)
  {
    if(StringCompare(pwsz, rgNameMap[i].pwszName))
      return rgNameMap[i].lItem;
  }

  //Otherwise indicate failure
  return -1;
}

CHAR* GetMapName | ( | LONG | lItem,
 |  | ULONG | cNameMap,
 |  | const NAMEMAP * | rgNameMap
 | ) |  |

Definition at line 2516 of file error.cpp.

{
  for(ULONG i=0; i<cNameMap; i++)
  {
    if(lItem == rgNameMap[i].lItem)
      return rgNameMap[i].pszName;
  }

  //Otherwise indicate failure
  return NULL;
}

WCHAR* GetMapName | ( | REFGUID | guid,
 |  | ULONG | cGuidMap,
 |  | const WIDEGUIDMAP * | rgGuidMap
 | ) |  |

Definition at line 2653 of file error.cpp.

{
  for(ULONG i=0; i<cGuidMap; i++)
  {
    if(guid == *(rgGuidMap[i].pGuid))
      return rgGuidMap[i].pwszName;
  }

  //Otherwise indicate failure
  return NULL;
}

WCHAR* GetMapName | ( | LONG | lItem,
 |  | ULONG | cNameMap,
 |  | const WIDENAMEMAP * | rgNameMap,
 |  | DWORD | dwConvFlags = CONV_NONE
 | ) |  |

Definition at line 2566 of file error.cpp.

{
  for(ULONG i=0; i<cNameMap; i++)
  {
    if(lItem == rgNameMap[i].lItem)
      return rgNameMap[i].pwszName;
  }

  if(dwConvFlags)
  {
    //If we didn't find it, then just format the value in a string
    //and return it to the user (if requested)...
    static WCHAR wszBuffer[MAX_NAME_LEN];
    if(dwConvFlags & CONV_HEX)
      StringFormat(wszBuffer, NUMELE(wszBuffer), L"0x%x", lItem);
    else
      StringFormat(wszBuffer, NUMELE(wszBuffer), L"%d", lItem);
    return wszBuffer;
  }

  //Otherwise indicate failure
  return NULL;
}

LONG GetMapName | ( | CHAR * | psz,
 |  | ULONG | cNameMap,
 |  | const NAMEMAP * | rgNameMap
 | ) |  |

Definition at line 2549 of file error.cpp.

{
  for(ULONG i=0; i<cNameMap; i++)
  {
    if(strcmp(psz, rgNameMap[i].pszName)==0)
      return rgNameMap[i].lItem;
  }

  //Otherwise indicate failure
  return -1;
}

WCHAR* GetObjectTypeName ( REFGUID rguidObjectType )

Definition at line 2447 of file error.cpp.

{
  return GetMapName(rguidObjectType, g_cObjectTypeMaps, g_rgObjectTypeMaps);
}

WCHAR* GetPhaseName ( DBEVENTPHASE ePhase )

Definition at line 3023 of file error.cpp.

{
  const static WIDENAMEMAP  rgPhase[] =
  {
    VALUE_WCHAR(DBEVENTPHASE_OKTODO),
    VALUE_WCHAR(DBEVENTPHASE_ABOUTTODO),
    VALUE_WCHAR(DBEVENTPHASE_SYNCHAFTER),
    VALUE_WCHAR(DBEVENTPHASE_DIDEVENT),
    VALUE_WCHAR(DBEVENTPHASE_FAILEDTODO)
  };

  return GetMapName(ePhase, NUMELE(rgPhase), rgPhase);
}

WCHAR* GetPropertyName | ( | DBPROPID | dwPropertyID,
 |  | REFGUID | guidPropertySet
 | ) |  |

Definition at line 2457 of file error.cpp.

{
  //Thankfully all OLE DB Properties have different DBPROPIDs, (all unique)
  //The problem is that provider specific properties may not be.
  //So if we know the set we can find the property, otherwsie we don't know it...
  ULONG cPropInfoSets = 0;
  const DBPROPINFOSET* rgPropInfoSets = NULL;
  DBPROPINFO* pPropInfo = NULL;

  //Setup the info we are looking for...
  const ULONG cPropertyIDSets = 1;
  DBPROPIDSET rgPropertyIDSets[cPropertyIDSets];
  rgPropertyIDSets[0].cPropertyIDs = 0;
  rgPropertyIDSets[0].rgPropertyIDs = NULL;
  rgPropertyIDSets[0].guidPropertySet = guidPropertySet;

  //Obtain the properties for the specified set...
  TESTC(GetStaticPropInfo(cPropertyIDSets, rgPropertyIDSets, &cPropInfoSets, &rgPropInfoSets));

  //Now that we have the correct set, just obtain the sub element (property name)
  pPropInfo = FindProperty(dwPropertyID, guidPropertySet, cPropInfoSets, (DBPROPINFOSET*)rgPropInfoSets);
  if(pPropInfo)
    return pPropInfo->pwszDescription;

CLEANUP:
  return NULL;
}

WCHAR* GetPropSetName ( REFGUID guidPropertySet )

Definition at line 2490 of file error.cpp.

{
  return GetMapName(guidPropertySet, g_cPropSetMaps, g_rgPropSetMaps);
}

WCHAR* GetPropStatusName ( DBPROPSTATUS dbPropStatus )

Definition at line 1554 of file error.cpp.

{
  return GetMapName(dbPropStatus, NUMELE(g_rgPropStatusMap), g_rgPropStatusMap);
}

WCHAR* GetReasonName ( DBREASON eReason )

Definition at line 3041 of file error.cpp.

{
  const static WIDENAMEMAP  rgReason[] =
  {
    VALUE_WCHAR(  DBREASON_ROWSET_FETCHPOSITIONCHANGE ),
    VALUE_WCHAR(  DBREASON_ROWSET_RELEASE ),
    VALUE_WCHAR(  DBREASON_COLUMN_SET ),
    VALUE_WCHAR(  DBREASON_COLUMN_RECALCULATED  ),
    VALUE_WCHAR(  DBREASON_ROW_ACTIVATE ),
    VALUE_WCHAR(  DBREASON_ROW_RELEASE  ),
    VALUE_WCHAR(  DBREASON_ROW_DELETE ),
    VALUE_WCHAR(  DBREASON_ROW_FIRSTCHANGE  ),
    VALUE_WCHAR(  DBREASON_ROW_INSERT ),
    VALUE_WCHAR(  DBREASON_ROW_RESYNCH  ),
    VALUE_WCHAR(  DBREASON_ROW_UNDOCHANGE ),
    VALUE_WCHAR(  DBREASON_ROW_UNDOINSERT ),
    VALUE_WCHAR(  DBREASON_ROW_UNDODELETE ),
    VALUE_WCHAR(  DBREASON_ROW_UPDATE ),
    VALUE_WCHAR(  DBREASON_ROWSET_CHANGED ),

    VALUE_WCHAR( DBREASON_ROWPOSITION_CHANGED ),
    VALUE_WCHAR(  DBREASON_ROWPOSITION_CHAPTERCHANGED ),
    VALUE_WCHAR(  DBREASON_ROWPOSITION_CLEARED  ),
    VALUE_WCHAR(  DBREASON_ROW_ASYNCHINSERT ),

//    VALUE_WCHAR(  DBREASON_ROWSET_ROWSADDED ),
//    VALUE_WCHAR(  DBREASON_ROWSET_POPULATIONCOMPLETE  ),
//    VALUE_WCHAR(  DBREASON_ROWSET_POPULATIONSTOPPED ),
  };

  return GetMapName(eReason, NUMELE(rgReason), rgReason);
}

WCHAR* GetRowColName ( const DBID * pColumnid )

Definition at line 2304 of file error.cpp.

{
  return GetMapName(pColumnid, g_cRowColMaps, g_rgRowColMaps);
}

HRESULT GetSqlErrorInfo | ( | ULONG | iRecord,
 |  | IErrorRecords * | pIErrorRecords,
 |  | BSTR * | pBstr,
 |  | LONG * | plNativeError = NULL
 | ) |  |

Definition at line 3731 of file error.cpp.

{
  ASSERT(pBstr);
  HRESULT hr = S_OK;

  CSmartPtr<ISQLErrorInfo>  spSQLErrorInfo;
  LONG lNativeError = 0;

  //Get the Error Records
  if(pIErrorRecords)
  {
    //If there is ErrorInfo, GetSQLInfo for the desired record
    //ISQLErrorInfo is not mandatory
    TESTC(hr = pIErrorRecords->GetCustomErrorObject(iRecord, IID_ISQLErrorInfo, (IUnknown**)&spSQLErrorInfo));

    //If there was a CustomErrorObject
    if(spSQLErrorInfo)
      hr = spSQLErrorInfo->GetSQLInfo(pBstr, &lNativeError);
  }

CLEANUP:
  if(plNativeError)
    *plNativeError = lNativeError;
  return hr;
}

HRESULT GetStaticPropInfo | ( | ULONG | cPropertyIDSets,
 |  | DBPROPIDSET * | rgPropertyIDSets,
 |  | ULONG * | pcStaticInfoSets,
 |  | const DBPROPINFOSET ** | prgStaticInfoSets
 | ) |  |

Definition at line 1768 of file error.cpp.

{
  HRESULT hr = S_OK;
  ASSERT(pcStaticInfoSets);
  ASSERT(prgStaticInfoSets);

  //DBPROPSET_COLUMN
  const static DBPROPINFO rgColumnPropInfo[] =
  {
    VALUE_WCHAR(DBPROP_COL_AUTOINCREMENT),      DBPROPFLAGS_COLUMN,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_COL_DEFAULT  ),        DBPROPFLAGS_COLUMN,     DBTYPE_EMPTY,   {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_COL_DESCRIPTION  ),      DBPROPFLAGS_COLUMN,     DBTYPE_BSTR,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_COL_FIXEDLENGTH  ),      DBPROPFLAGS_COLUMN,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_COL_INCREMENT),        DBPROPFLAGS_COLUMN,     DBTYPE_EMPTY,   {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_COL_ISLONG),         DBPROPFLAGS_COLUMN,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_COL_NULLABLE ),        DBPROPFLAGS_COLUMN,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_COL_PRIMARYKEY ),      DBPROPFLAGS_COLUMN,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_COL_UNIQUE ),        DBPROPFLAGS_COLUMN,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_COLUMNLCID),         DBPROPFLAGS_COLUMN,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_COL_SEED),         DBPROPFLAGS_COLUMN,     DBTYPE_EMPTY,   {0,0,0,0,0},
  };

  //DBPROPSET_DATASOURCE
  const static DBPROPINFO rgDataSourcePropInfo[] =
  {
    VALUE_WCHAR(DBPROP_CURRENTCATALOG ),      DBPROPFLAGS_DATASOURCE,   DBTYPE_BSTR,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_MULTIPLECONNECTIONS),    DBPROPFLAGS_DATASOURCE,   DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_RESETDATASOURCE),      DBPROPFLAGS_DATASOURCE,   DBTYPE_I4,      {0,0,0,0,0},
  };

  //DBPROPSET_DATASOURCEINFO
  const static DBPROPINFO rgDataSourceInfoPropInfo[] =
  {
    VALUE_WCHAR(DBPROP_ACTIVESESSIONS ),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_ALTERCOLUMN),        DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_ASYNCTXNABORT  ),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_ASYNCTXNCOMMIT ),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_BYREFACCESSORS ),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_CATALOGLOCATION  ),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_CATALOGTERM  ),        DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BSTR,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_CATALOGUSAGE ),        DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_COLUMNDEFINITION ),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_COMSERVICES  ),        DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_CONCATNULLBEHAVIOR ),    DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_CONNECTIONSTATUS),     DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_DATASOURCENAME ),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BSTR,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_DATASOURCEREADONLY ),    DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_DATASOURCE_TYPE),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_DBMSNAME ),          DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BSTR,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_DBMSVER  ),          DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BSTR,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_DSOTHREADMODEL ),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_GENERATEURL),        DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_GROUPBY  ),          DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_HETEROGENEOUSTABLES  ),    DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IDENTIFIERCASE),       DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_MAXINDEXSIZE ),        DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_MAXOPENCHAPTERS  ),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_MAXROWSIZE ),        DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_MAXROWSIZEINCLUDESBLOB ),  DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_MAXTABLESINSELECT  ),    DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_MULTIPLEPARAMSETS  ),    DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_MULTIPLERESULTS  ),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_MULTIPLESTORAGEOBJECTS ),  DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_MULTITABLEUPDATE ),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_NULLCOLLATION  ),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_OLEOBJECTS ),        DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_OPENROWSETSUPPORT),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_ORDERBYCOLUMNSINSELECT ),  DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_OUTPUTPARAMETERAVAILABILITY  ),  DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_PERSISTENTIDTYPE ),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_PREPAREABORTBEHAVIOR ),    DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_PREPARECOMMITBEHAVIOR  ),  DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_PROCEDURETERM  ),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BSTR,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_PROVIDERFRIENDLYNAME),   DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BSTR,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_PROVIDERMEMORY),       DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_PROVIDERFILENAME ),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BSTR,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_PROVIDEROLEDBVER ),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BSTR,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_PROVIDERVER  ),        DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BSTR,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_QUOTEDIDENTIFIERCASE ),    DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_ROWSETCONVERSIONSONCOMMAND ),  DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_SCHEMATERM ),        DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BSTR,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_SCHEMAUSAGE  ),        DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_SERVERNAME),         DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BSTR,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_SQLSUPPORT ),        DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_STRUCTUREDSTORAGE  ),    DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_SUBQUERIES ),        DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_SUPPORTEDTXNDDL  ),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_SUPPORTEDTXNISOLEVELS  ),  DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_SUPPORTEDTXNISORETAIN  ),  DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_TABLETERM  ),        DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BSTR,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_TABLESTATISTICS  ),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_USERNAME ),          DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BSTR,    {0,0,0,0,0},

    //OLAP Documention
    VALUE_WCHAR(MDPROP_AXES),           DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(MDPROP_FLATTENING_SUPPORT),     DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(MDPROP_MDX_JOINCUBES),        DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(MDPROP_NAMED_LEVELS),       DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(MDPROP_RANGEROWSET),        DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(MDPROP_MDX_SLICER),         DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(MDPROP_MDX_CUBEQUALIFICATION),    DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(MDPROP_MDX_OUTERREFERENCE),     DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(MDPROP_MDX_QUERYBYPROPERTY),    DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(MDPROP_MDX_CASESUPPORT),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(MDPROP_MDX_STRING_COMPOP),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(MDPROP_MDX_DESCFLAGS),        DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(MDPROP_MDX_SET_FUNCTIONS),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(MDPROP_MDX_MEMBER_FUNCTIONS),   DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(MDPROP_MDX_NUMERIC_FUNCTIONS),    DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(MDPROP_MDX_FORMULAS),       DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(MDPROP_MDX_AGGREGATECELL_UPDATE), DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},

    //Not yet doc'd...
    VALUE_WCHAR(DBPROP_STORAGEFLAGS),       DBPROPFLAGS_DATASOURCEINFO, DBTYPE_BOOL,    {0,0,0,0,0},

    //2.6
    VALUE_WCHAR(DBPROP_TABLESTATISTICS  ),      DBPROPFLAGS_DATASOURCEINFO, DBTYPE_I4,      {0,0,0,0,0},
  };

  //DBPROPSET_INDEX
  const static DBPROPINFO rgIndexPropInfo[] =
  {
    VALUE_WCHAR(DBPROP_INDEX_AUTOUPDATE),     DBPROPFLAGS_INDEX,      DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INDEX_CLUSTERED),      DBPROPFLAGS_INDEX,      DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INDEX_FILLFACTOR),     DBPROPFLAGS_INDEX,      DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INDEX_INITIALSIZE),      DBPROPFLAGS_INDEX,      DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INDEX_NULLCOLLATION),    DBPROPFLAGS_INDEX,      DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INDEX_NULLS),        DBPROPFLAGS_INDEX,      DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INDEX_PRIMARYKEY),     DBPROPFLAGS_INDEX,      DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INDEX_SORTBOOKMARKS),    DBPROPFLAGS_INDEX,      DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INDEX_TEMPINDEX),      DBPROPFLAGS_INDEX,      DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INDEX_TYPE),         DBPROPFLAGS_INDEX,      DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INDEX_UNIQUE),       DBPROPFLAGS_INDEX,      DBTYPE_BOOL,    {0,0,0,0,0},
  };

  //DBPROPSET_DBINIT
  const static DBPROPINFO rgInitPropInfo[] =
  {
    VALUE_WCHAR(DBPROP_AUTH_CACHE_AUTHINFO  ),    DBPROPFLAGS_DBINIT,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_AUTH_ENCRYPT_PASSWORD  ),  DBPROPFLAGS_DBINIT,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_AUTH_INTEGRATED  ),      DBPROPFLAGS_DBINIT,     DBTYPE_BSTR,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_AUTH_MASK_PASSWORD ),    DBPROPFLAGS_DBINIT,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_AUTH_PASSWORD  ),      DBPROPFLAGS_DBINIT,     DBTYPE_BSTR,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_AUTH_PERSIST_ENCRYPTED ),  DBPROPFLAGS_DBINIT,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_AUTH_PERSIST_SENSITIVE_AUTHINFO  ),    DBPROPFLAGS_DBINIT,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_AUTH_USERID  ),        DBPROPFLAGS_DBINIT,     DBTYPE_BSTR,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INIT_ASYNCH),        DBPROPFLAGS_DBINIT,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INIT_BINDFLAGS),       DBPROPFLAGS_DBINIT,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INIT_CATALOG),       DBPROPFLAGS_DBINIT,     DBTYPE_BSTR,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INIT_DATASOURCE),      DBPROPFLAGS_DBINIT,     DBTYPE_BSTR,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INIT_GENERALTIMEOUT),    DBPROPFLAGS_DBINIT,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INIT_HWND  ),        DBPROPFLAGS_DBINIT,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INIT_IMPERSONATION_LEVEL ),  DBPROPFLAGS_DBINIT,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INIT_LCID  ),        DBPROPFLAGS_DBINIT,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INIT_LOCATION  ),      DBPROPFLAGS_DBINIT,     DBTYPE_BSTR,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INIT_LOCKOWNER),       DBPROPFLAGS_DBINIT,     DBTYPE_BSTR,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INIT_MODE  ),        DBPROPFLAGS_DBINIT,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INIT_OLEDBSERVICES),     DBPROPFLAGS_DBINIT,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INIT_PROMPT  ),        DBPROPFLAGS_DBINIT,     DBTYPE_I2,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INIT_PROTECTION_LEVEL  ),  DBPROPFLAGS_DBINIT,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INIT_PROVIDERSTRING  ),    DBPROPFLAGS_DBINIT,     DBTYPE_BSTR,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_INIT_TIMEOUT ),        DBPROPFLAGS_DBINIT,     DBTYPE_I4,      {0,0,0,0,0},
  };

  //DBPROPSET_SESSION
  const static DBPROPINFO rgSessionPropInfo[] =
  {
    VALUE_WCHAR(DBPROP_SESS_AUTOCOMMITISOLEVELS ),  DBPROPFLAGS_SESSION,    DBTYPE_I4,      {0,0,0,0,0},
  };

  //DBPROPSET_TABLE
  const static DBPROPINFO rgTablePropInfo[] =
  {
    VALUE_WCHAR(DBPROP_TBL_TEMPTABLE  ),      DBPROPFLAGS_TABLE,      DBTYPE_BOOL,    {0,0,0,0,0},
  };

  //DBPROPSET_TRUSTEE
  const static DBPROPINFO rgTrusteePropInfo[] =
  {
    //Documented in Security Whitepaper
    VALUE_WCHAR(DBPROP_TRUSTEE_USERNAME),     DBPROPFLAGS_TRUSTEE,    DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_TRUSTEE_AUTHENTICATION),   DBPROPFLAGS_TRUSTEE,    DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_TRUSTEE_NEWAUTHENTICATION),  DBPROPFLAGS_TRUSTEE,    DBTYPE_BOOL,    {0,0,0,0,0},
  };

  //DBPROPSET_VIEW
  const static DBPROPINFO rgViewPropInfo[] =
  {
    VALUE_WCHAR(DBPROP_FILTERCOMPAREOPS ),      DBPROPFLAGS_VIEW,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IAccessor  ),        DBPROPFLAGS_VIEW,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IColumnsInfo ),        DBPROPFLAGS_VIEW,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_ISupportErrorInfo),      DBPROPFLAGS_VIEW,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IViewChapter),       DBPROPFLAGS_VIEW,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IViewFilter),        DBPROPFLAGS_VIEW,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IViewRowset),        DBPROPFLAGS_VIEW,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IViewSort),          DBPROPFLAGS_VIEW,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_MAXORSINFILTER ),      DBPROPFLAGS_VIEW,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_MAXSORTCOLUMNS ),      DBPROPFLAGS_VIEW,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_SORTONINDEX  ),        DBPROPFLAGS_VIEW,     DBTYPE_BOOL,    {0,0,0,0,0},
  };

  //DBPROPSET_ROWSET
  const static DBPROPINFO rgRowsetPropInfo[] =
  {
    VALUE_WCHAR(DBPROP_ABORTPRESERVE  ),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_ACCESSORDER),        DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_APPENDONLY ),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_BLOCKINGSTORAGEOBJECTS ),  DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_BOOKMARKINFO),       DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_BOOKMARKS  ),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_BOOKMARKSKIPPED  ),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_BOOKMARKTYPE ),        DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_CACHEDEFERRED  ),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_CANFETCHBACKWARDS  ),    DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_CANHOLDROWS  ),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_CANSCROLLBACKWARDS ),    DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_CHANGEINSERTEDROWS ),    DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_CLIENTCURSOR),       DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_COLUMNRESTRICT ),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_COMMANDTIMEOUT ),      DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_COMMITPRESERVE ),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_DEFERRED ),          DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_DELAYSTORAGEOBJECTS  ),    DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_FINDCOMPAREOPS ),      DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_HIDDENCOLUMNS),        DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IAccessor  ),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IChapteredRowset ),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IColumnsInfo ),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IColumnsInfo2),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IColumnsRowset ),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IConnectionPointContainer),  DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IConvertType ),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_ICreateRow),         DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IDBAsynchStatus  ),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IGetRow),          DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IGetSession),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IGetSourceRow),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_ILockBytes),         DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IMMOBILEROWS),       DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IMultipleResults),     DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IParentRowset),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IRow),           DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IRowChange),         DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IRowSchemaChange),     DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IRowset  ),          DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IRowsetChange  ),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IRowsetCurrentIndex),    DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IRowsetFind  ),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IRowsetIdentity),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IRowsetIndex),       DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IRowsetInfo),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IRowsetLocate),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IRowsetRefresh),       DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IRowsetScroll),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IRowsetUpdate),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IRowsetView),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IScopedOperations),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_ISequentialStream),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IStorage),         DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IStream),          DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_ISupportErrorInfo),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_LITERALBOOKMARKS ),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_LITERALIDENTITY  ),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_LOCKMODE),         DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_MAXOPENROWS  ),        DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_MAXPENDINGROWS ),      DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_MAXROWS  ),          DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_MAYWRITECOLUMN ),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_MEMORYUSAGE  ),        DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_NOTIFICATIONGRANULARITY  ),  DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_NOTIFICATIONPHASES ),    DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_NOTIFYCOLUMNSET  ),      DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_NOTIFYROWDELETE  ),      DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_NOTIFYROWFIRSTCHANGE ),    DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_NOTIFYROWINSERT  ),      DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_NOTIFYROWRESYNCH ),      DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_NOTIFYROWSETRELEASE  ),    DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_NOTIFYROWSETFETCHPOSITIONCHANGE),  DBPROPFLAGS_ROWSET,     DBTYPE_I4,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_NOTIFYROWUNDOCHANGE  ),    DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_NOTIFYROWUNDODELETE  ),    DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_NOTIFYROWUNDOINSERT  ),    DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_NOTIFYROWUPDATE  ),      DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_ORDEREDBOOKMARKS ),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_OTHERINSERT  ),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_OTHERUPDATEDELETE  ),    DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_OWNINSERT  ),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_OWNUPDATEDELETE  ),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_QUICKRESTART ),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_REENTRANTEVENTS  ),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_REMOVEDELETED  ),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_REPORTMULTIPLECHANGES  ),  DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_RETURNPENDINGINSERTS ),    DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_ROW_BULKOPS),        DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_ROWRESTRICT  ),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_ROWSET_ASYNCH  ),      DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_ROWTHREADMODEL ),      DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_SERVERCURSOR ),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_SERVERDATAONINSERT),     DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_STRONGIDENTITY ),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_TRANSACTEDOBJECT ),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_UNIQUEROWS),         DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_UPDATABILITY ),        DBPROPFLAGS_ROWSET,     DBTYPE_I4,      {0,0,0,0,0},

    //2.6
    //TODO: IRowsetBookmark and property are not doc'd - as of today?
    VALUE_WCHAR(DBPROP_IRowsetBookmark  ),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_SKIPROWCOUNTRESULTS  ),    DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},

    //Currently not doc'd due to unknown property set...
    VALUE_WCHAR(DBPROP_IBindResource),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IDBBinderProperties),    DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IRegisterProvider),      DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_IRowsetResynch),       DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},

    //Deprecated Properties
//    VALUE_WCHAR(DBPROP_MARSHALLABLE ),        DBPROPFLAGS_ROWSET,     DBTYPE_BOOL,    {0,0,0,0,0},
  };

  //DBPROPSET_STREAM
  const static DBPROPINFO rgStreamPropInfo[] =
  {
    VALUE_WCHAR(DBPROP_OUTPUTSTREAM ),        DBPROPFLAGS_STREAM,     DBTYPE_IUNKNOWN,  {0,0,0,0,0},
    VALUE_WCHAR(DBPROP_OUTPUTENCODING),       DBPROPFLAGS_STREAM,     DBTYPE_BSTR,    {0,0,0,0,0},
  };

  //Now build a static map of all the sets...
  const static DBPROPINFOSET rgAllPropInfoSet[] =
  {
    //DBPROPSET_COLUMN
    (DBPROPINFO*)rgColumnPropInfo,        NUMELE(rgColumnPropInfo),       {0xc8b522b9,0x5cf3,0x11ce,{0xad,0xe5,0x00,0xaa,0x00,0x44,0x77,0x3d}},
    //DBPROPSET_DATASOURCE
    (DBPROPINFO*)rgDataSourcePropInfo,      NUMELE(rgDataSourcePropInfo),   {0xc8b522ba,0x5cf3,0x11ce,{0xad,0xe5,0x00,0xaa,0x00,0x44,0x77,0x3d}},
    //DBPROPSET_DATASOURCEINFO
    (DBPROPINFO*)rgDataSourceInfoPropInfo,    NUMELE(rgDataSourceInfoPropInfo), {0xc8b522bb,0x5cf3,0x11ce,{0xad,0xe5,0x00,0xaa,0x00,0x44,0x77,0x3d}},
    //DBPROPSET_INDEX
    (DBPROPINFO*)rgIndexPropInfo,       NUMELE(rgIndexPropInfo),      {0xc8b522bd,0x5cf3,0x11ce,{0xad,0xe5,0x00,0xaa,0x00,0x44,0x77,0x3d}},
    //DBPROPSET_DBINIT
    (DBPROPINFO*)rgInitPropInfo,        NUMELE(rgInitPropInfo),       {0xc8b522bc,0x5cf3,0x11ce,{0xad,0xe5,0x00,0xaa,0x00,0x44,0x77,0x3d}},
    //DBPROPSET_SESSION
    (DBPROPINFO*)rgSessionPropInfo,       NUMELE(rgSessionPropInfo),      {0xc8b522c6,0x5cf3,0x11ce,{0xad,0xe5,0x00,0xaa,0x00,0x44,0x77,0x3d}},
    //DBPROPSET_TABLE
    (DBPROPINFO*)rgTablePropInfo,       NUMELE(rgTablePropInfo),      {0xc8b522bf,0x5cf3,0x11ce,{0xad,0xe5,0x00,0xaa,0x00,0x44,0x77,0x3d}},
    //DBPROPSET_TRUSTEE
    (DBPROPINFO*)rgTrusteePropInfo,       NUMELE(rgTrusteePropInfo),      {0xc8b522e1,0x5cf3,0x11ce,{0xad,0xe5,0x00,0xaa,0x00,0x44,0x77,0x3d}},
    //DBPROPSET_VIEW
    (DBPROPINFO*)rgViewPropInfo,        NUMELE(rgViewPropInfo),       {0xc8b522df,0x5cf3,0x11ce,{0xad,0xe5,0x00,0xaa,0x00,0x44,0x77,0x3d}},
    //DBPROPSET_ROWSET
    (DBPROPINFO*)rgRowsetPropInfo,        NUMELE(rgRowsetPropInfo),     {0xc8b522be,0x5cf3,0x11ce,{0xad,0xe5,0x00,0xaa,0x00,0x44,0x77,0x3d}},
    //DBPROPSET_STREAM
    (DBPROPINFO*)rgStreamPropInfo,        NUMELE(rgStreamPropInfo),     {0xc8b522fd,0x5cf3,0x11ce,{0xad,0xe5,0x00,0xaa,0x00,0x44,0x77,0x3d}},
  };

  if(cPropertyIDSets == 0)
  {
    //Return all OLE DB Defined sets to the caller.
    *pcStaticInfoSets   = NUMELE(rgAllPropInfoSet);
    *prgStaticInfoSets    = rgAllPropInfoSet;
    return S_OK;
  }
  else
  {
    //Currently this routine only handles one level.
    //All that we currently need at this point for RowsetViewer...
    ASSERT(cPropertyIDSets==1);
    ASSERT(rgPropertyIDSets && rgPropertyIDSets[0].cPropertyIDs==0);

    //First, is this a special property set, then map it to its defined property set...?
    GUID guidSpecialPropertySet = rgPropertyIDSets[0].guidPropertySet;
    IsSpecialPropSet(guidSpecialPropertySet, &guidSpecialPropertySet);

    //Now loop through all the Property Sets and see which is desired...
    for(ULONG iPropSet=0; iPropSet<NUMELE(rgAllPropInfoSet); iPropSet++)
    {
      const DBPROPINFOSET* pPropInfoSet = &rgAllPropInfoSet[iPropSet];
      if(guidSpecialPropertySet == pPropInfoSet->guidPropertySet)
      {
        *pcStaticInfoSets   = 1;
        *prgStaticInfoSets    = pPropInfoSet;
        return S_OK;
      }
    }
  }

//CLEANUP:
  //Otherwise propety set was not found...
  *pcStaticInfoSets = 0;
  *prgStaticInfoSets = NULL;
  return DB_E_NOTFOUND;
};

HRESULT GetStaticPropValues | ( | DBPROPID | dwPropertyID,
 |  | REFGUID | guidPropertySet,
 |  | ULONG * | pcPropValMap,
 |  | const WIDENAMEMAP ** | prgPropValMap
 | ) |  |

Definition at line 1714 of file error.cpp.

{
  ASSERT(pcPropValMap);
  ASSERT(prgPropValMap);

  //DBPROPSET_ROWSET
  if(guidPropertySet == DBPROPSET_ROWSET)
  {
    switch(dwPropertyID)
    {
      case DBPROP_UPDATABILITY:
      {
        const static WIDENAMEMAP rgUPDATABILITY[] =
        {
          VALUE_WCHAR(DBPROPVAL_UP_CHANGE ),
          VALUE_WCHAR(DBPROPVAL_UP_DELETE ),
          VALUE_WCHAR(DBPROPVAL_UP_INSERT ),
        };

        *pcPropValMap = NUMELE(rgUPDATABILITY);
        *prgPropValMap = rgUPDATABILITY;
        return S_OK;
      }
    };
  }
  else if(guidPropertySet == DBPROPSET_DBINIT)
  {
    switch(dwPropertyID)
    {
      case DBPROP_INIT_PROMPT:
      {
        const static WIDENAMEMAP rgPrompts[] =
        {
          VALUE_WCHAR(DBPROMPT_PROMPT),
          VALUE_WCHAR(DBPROMPT_COMPLETE),
          VALUE_WCHAR(DBPROMPT_COMPLETEREQUIRED),
          VALUE_WCHAR(DBPROMPT_NOPROMPT),
        };

        *pcPropValMap = NUMELE(rgPrompts);
        *prgPropValMap = rgPrompts;
        return S_OK;
      }
    };
  }

  return DB_E_NOTFOUND;
}

WCHAR* GetStatusName | ( | DBSTATUS | dbStatus,
 |  | DWORD | dwConvFlags = CONV_DECIMAL
 | ) |  |

Definition at line 1609 of file error.cpp.

{
  return GetMapName(dbStatus, NUMELE(g_rgStatusMap), g_rgStatusMap, dwConvFlags);
}

DBSTATUS GetStatusValue ( WCHAR * pszName )

Definition at line 1618 of file error.cpp.

{
  return GetMapName(pwszName, NUMELE(g_rgStatusMap), g_rgStatusMap);
}

BOOL IsSpecialPropSet | ( | REFGUID | guidSpecialPropertySet,
 |  | GUID * | pGuidPropertySet
 | ) |  |

Definition at line 1668 of file error.cpp.

{
  //Special Property Sets
  typedef struct _SPECIALGUIDMAP
  {
    const GUID* pSpecialPropertySet;
    const GUID* pGuidPropertySet;
  } SPECIALGUIDMAP;

  const static SPECIALGUIDMAP rgSpecialPropSet[] =
  {
    & DBPROPSET_COLUMNALL,            & DBPROPSET_COLUMN,
    & DBPROPSET_DATASOURCEALL,          & DBPROPSET_DATASOURCE,
    & DBPROPSET_DATASOURCEINFOALL,        & DBPROPSET_DATASOURCEINFO,
    & DBPROPSET_INDEXALL,           & DBPROPSET_INDEX,
    & DBPROPSET_DBINITALL,            & DBPROPSET_DBINIT,
    & DBPROPSET_SESSIONALL,           & DBPROPSET_SESSION,
    & DBPROPSET_TABLEALL,           & DBPROPSET_TABLE,
    & DBPROPSET_TRUSTEEALL,           & DBPROPSET_TRUSTEE,
    & DBPROPSET_VIEWALL,            & DBPROPSET_VIEW,
    & DBPROPSET_ROWSETALL,            & DBPROPSET_ROWSET,
    & DBPROPSET_STREAMALL,            & DBPROPSET_STREAM,
  };

  //Is this one of the special Property Sets
  for(ULONG iPropSet=0; iPropSet<NUMELE(rgSpecialPropSet); iPropSet++)
  {
    const SPECIALGUIDMAP* pSpecPropSet = &rgSpecialPropSet[iPropSet];
    if(guidSpecialPropertySet == *pSpecPropSet->pSpecialPropertySet)
    {
      if(pGuidPropertySet)
        *pGuidPropertySet = *pSpecPropSet->pGuidPropertySet;
      return TRUE;
    }
  }

  //Not a special set...
  return FALSE;
}

BOOL SetErrorPosting | ( | ERRORPOST | eErrorPost,
 |  | BOOL | fSet = TRUE
 | ) |  |

Definition at line 25 of file error.cpp.

{
  if(fSet)
    g_dwErrorPost |= eErrorPost;
  else
    g_dwErrorPost &= ~eErrorPost;

  return TRUE;
};

Variable Documentation

const ULONG g_cBindURLMaps
const ULONG g_cCDFlagsMaps
const ULONG g_cColFlagsMaps
const ULONG g_cConsTypeMaps
const ULONG g_cDBTypes
const ULONG g_cDeferrabilityMaps
const ULONG g_cDialectMaps
const ULONG g_cInterfaceMaps
const ULONG g_cIsoLevels
const ULONG g_cLCID
const ULONG g_cMatchTypeMaps
const ULONG g_cObjectTypeMaps
const ULONG g_cPromptOptions
const ULONG g_cPropSetMaps
const ULONG g_cResultFlagMaps
const ULONG g_cRowColMaps
const ULONG g_cSourceType
const ULONG g_cUpDelRuleMaps
const ULONG g_cVariantTypes
const ULONG g_cXACTTC
DWORD g_dwBreakID

Definition at line 23 of file error.cpp.

DWORD g_dwErrorPost

Definition at line 22 of file error.cpp.

const WIDENAMEMAP g_rgBindURLMaps[]
const WIDENAMEMAP g_rgCDFlagsMaps[]
const WIDENAMEMAP g_rgColFlagsMaps[]
const WIDENAMEMAP g_rgConsTypeMaps[]
const WIDENAMEMAP g_rgDBTypes[]
const WIDENAMEMAP g_rgDeferrabilityMaps[]
const WIDEGUIDMAP g_rgDialectMaps[]
const WIDEGUIDMAP g_rgInterfaceMaps[]
const WIDENAMEMAP g_rgIsoLevels[]
const WIDENAMEMAP g_rgLCID[]
const WIDENAMEMAP g_rgMatchTypeMaps[]
const WIDEGUIDMAP g_rgObjectTypeMaps[]
const WIDENAMEMAP g_rgPromptOptions[]
const WIDEGUIDMAP g_rgPropSetMaps[]
const WIDENAMEMAP g_rgResultFlagMaps[]
const WIDEDBIDMAP g_rgRowColMaps[]
const WIDENAMEMAP g_rgSourceType[]
const WIDENAMEMAP g_rgUpDelRuleMaps[]
const WIDENAMEMAP g_rgVariantTypes[]
const WIDENAMEMAP g_rgXACTTC[]
Generated on Wed Nov 13 2024 16:53:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/headers.cpp File Reference

  • Dataaccess
  • oledb
  • rowsetviewer

headers.cpp File Reference

#include "Headers.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/headers.h File Reference

  • Dataaccess
  • oledb
  • rowsetviewer
Defines

headers.h File Reference

#include "oledb.h"
#include "oledberr.h"
#include "msdasc.h"
#include "msdaguid.h"
#include <msdadc.h>
#include <windows.h>
#include <windowsx.h>
#include <commctrl.h>
#include <stddef.h>
#include <stdio.h>
#include <limits.h>
#include <wchar.h>
#include <ocidl.h>
#include <olectl.h>
#include <cguid.h>
#include <locale.h>
#include <richedit.h>
#include <htmlhelp.h>
#include <atlbase.h>
#include "resource.h"
#include "Common.h"
#include "CWinApp.h"
#include "CMainWindow.h"
#include "Spy.h"
#include "resource.h"
#include "Common.h"

Go to the source code of this file.

Defines

#define STRICT

Define Documentation

#define STRICT

Definition at line 18 of file headers.h.

Generated on Wed Nov 13 2024 16:53:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/list.h File Reference

  • Dataaccess
  • oledb
  • rowsetviewer
Classes | Typedefs

list.h File Reference

#include <limits.h>

Go to the source code of this file.

Classes

class | CAssoc< KEY, VALUE >
class | CList< TYPE, ARG_TYPE >
class | CMap< KEY, ARG_KEY, VALUE, ARG_VALUE >
class | CNode< TYPE >
class | CVector< TYPE, IDX >
class | CVectorEx< TYPE, IDX >

Typedefs

typedef void * | POSITION

Typedef Documentation

typedef void* POSITION

ULONG_MAX

Definition at line 25 of file list.h.

Generated on Wed Nov 13 2024 16:53:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/property.cpp File Reference

  • Dataaccess
  • oledb
  • rowsetviewer
Functions

property.cpp File Reference

#include "Headers.h"

Go to the source code of this file.

Functions

HRESULT | CombineProperties (ULONG *pcPropInfoSets, DBPROPINFOSET **prgPropInfoSets, ULONG cPropInfoSets2, DBPROPINFOSET *rgPropInfoSets2, BOOL bFreeAddedPropSet)
HRESULT | CombineProperties (ULONG *pcPropInfoSets, DBPROPINFOSET **prgPropInfoSets, ULONG cPropSets2, DBPROPSET *rgPropSets2, BOOL bFreeAddedPropSet)
DBPROPINFO * | FindProperty (DBPROPID dwPropertyID, REFGUID guidPropertySet, ULONG cPropInfoSets, DBPROPINFOSET *rgPropInfoSets)
DBPROPINFOSET * | FindPropSet (REFGUID guidPropertySet, ULONG cPropInfoSets, DBPROPINFOSET *rgPropInfoSets)
HRESULT | FreeProperties (ULONG *pcPropInfoSets, DBPROPINFOSET **prgPropInfoSets)
HRESULT | FreeProperties (ULONG *pcProperties, DBPROP **prgProperties)
HRESULT | FreeProperties (ULONG *pcPropSets, DBPROPSET **prgPropSets)
HRESULT | FreeProperties (ULONG *pcPropIDSets, DBPROPIDSET **prgPropIDSets)
HRESULT | GetProperty (REFIID riid, IUnknown *pIUnknown, DBPROPID dwPropertyID, REFGUID guidPropertySet, DBTYPE wType, void *pv)
HRESULT | GetProperty (REFIID riid, IUnknown *pIUnknown, DBPROPID dwPropertyID, REFGUID guidPropertySet, DBPROP **ppProperty)
HRESULT | GetPropInfo (IDBProperties *pIDBProperties, DBPROPID dwPropertyID, REFGUID guidPropertySet, DBPROPINFO **ppPropInfo)
DBPROPFLAGS | GetPropInfoFlags (IDBProperties *pIDBProperties, DBPROPID dwPropertyID, REFGUID guidPropertySet)
BOOL | IsSettableProperty (IDBProperties *pIDBProperties, DBPROPID dwPropertyID, REFGUID guidPropertySet)
BOOL | IsSupportedProperty (IDBProperties *pIDBProperties, DBPROPID dwPropertyID, REFGUID guidPropertySet)
HRESULT | SetProperty (DBPROPID dwPropertyID, REFGUID guidPropertySet, ULONG *pcPropSets, DBPROPSET **prgPropSets, DBTYPE wType, void *pv, DBPROPOPTIONS dwOptions, const DBID &colid)

Function Documentation

HRESULT CombineProperties | ( | ULONG * | pcPropInfoSets,
 |  | DBPROPINFOSET ** | prgPropInfoSets,
 |  | ULONG | cPropInfoSets2,
 |  | DBPROPINFOSET * | rgPropInfoSets2,
 |  | BOOL | bFreeAddedPropSet
 | ) |  |

Definition at line 647 of file property.cpp.

{
  ASSERT(pcPropInfoSets);
  ASSERT(prgPropInfoSets);
  HRESULT hr = S_OK;

  //Make our lives a little easier...
  ULONG cPropInfoSets = *pcPropInfoSets;
  DBPROPINFOSET* rgPropInfoSets = *prgPropInfoSets;

  //Now combine both sets...
  if(cPropInfoSets2 && rgPropInfoSets2)
  {
    if(cPropInfoSets && rgPropInfoSets)
    {
      //Loop over all the provider returned properties, and see if they
      //already exist in the OLE DB Defined properties.
      for(ULONG iPropSet=0; iPropSet<cPropInfoSets2; iPropSet++)
      {
        DBPROPINFOSET* pPropInfoSet2 = &rgPropInfoSets2[iPropSet];
        DBPROPINFOSET* pFoundSet = FindPropSet(pPropInfoSet2->guidPropertySet, cPropInfoSets, rgPropInfoSets);

        if(pFoundSet)
        {
          //Add all properties of this set...
          for(ULONG iProp=0; iProp<pPropInfoSet2->cPropertyInfos; iProp++)
          {
            DBPROPINFO* pPropInfo2 = &pPropInfoSet2->rgPropertyInfos[iProp];
            DBPROPINFO* pFoundProp = FindProperty(pPropInfo2->dwPropertyID, pPropInfoSet2->guidPropertySet, 1, pFoundSet);

            if(pFoundProp)
            {
              //Found the propertyset as well as the property
              //just need to update it in the list...
              *pFoundProp = *pPropInfo2;
            }
            else
            {
              //Found the property set, but not the property
              //just need to add this property to the list...
              SAFE_REALLOC(pFoundSet->rgPropertyInfos, DBPROPINFO, pFoundSet->cPropertyInfos + 1);
              pFoundSet->rgPropertyInfos[pFoundSet->cPropertyInfos] = *pPropInfo2;
              pFoundSet->cPropertyInfos++;
            }

            //Do we need to make a copy of the variant...
            if(!bFreeAddedPropSet)
            {
              //TODO
              //Also what about the stringbuffer with property descriptions?
            }
          }
        }
        else
        {
          //Need to add the entire property set, as well as all the properties.
          SAFE_REALLOC(rgPropInfoSets, DBPROPINFOSET, cPropInfoSets + 1);
          rgPropInfoSets[cPropInfoSets].guidPropertySet = pPropInfoSet2->guidPropertySet;
          rgPropInfoSets[cPropInfoSets].cPropertyInfos  = pPropInfoSet2->cPropertyInfos;

          //Add all the properties of this set...
          SAFE_ALLOC(rgPropInfoSets[cPropInfoSets].rgPropertyInfos, DBPROPINFO, pPropInfoSet2->cPropertyInfos);
          for(ULONG iProp=0; iProp<pPropInfoSet2->cPropertyInfos; iProp++)
          {
            rgPropInfoSets[cPropInfoSets].rgPropertyInfos[iProp] = pPropInfoSet2->rgPropertyInfos[iProp];

            //Do we need to make a copy of the variant...
            if(!bFreeAddedPropSet)
            {
              //TODO
              //Also what about the stringbuffer with property descriptions?
            }
          }
          cPropInfoSets++;
        }

        //We are done with this array of properties...
        if(bFreeAddedPropSet)
          SAFE_FREE(pPropInfoSet2->rgPropertyInfos);
      }

      //NOTE: In the process of combining both of these sets, we are doing
      //direct memory copy of the internal DBPROPINFO items, this way
      //we don't need to variant copy all the values, and duplicate all the
      //strings.  But this also requires that we don't free the source of the
      //copies as well.  So we will finally end up freeing the combined
      //property sets (cPropInfoSets) but not (cPropInfoSets2)
      if(bFreeAddedPropSet)
        SAFE_FREE(rgPropInfoSets2);
    }
    else
    {
      cPropInfoSets = cPropInfoSets2;
      rgPropInfoSets = rgPropInfoSets2;
    }
  }

CLEANUP:
  *pcPropInfoSets = cPropInfoSets;
  *prgPropInfoSets = rgPropInfoSets;
  return hr;
}

HRESULT CombineProperties | ( | ULONG * | pcPropInfoSets,
 |  | DBPROPINFOSET ** | prgPropInfoSets,
 |  | ULONG | cPropSets2,
 |  | DBPROPSET * | rgPropSets2,
 |  | BOOL | bFreeAddedPropSet
 | ) |  |

Definition at line 755 of file property.cpp.

{
  ASSERT(pcPropInfoSets);
  ASSERT(prgPropInfoSets);
  HRESULT hr = S_OK;

  //Make our lives a little easier...
  ULONG cPropInfoSets = *pcPropInfoSets;
  DBPROPINFOSET* rgPropInfoSets = *prgPropInfoSets;

  //Now combine both sets...
  if(cPropSets2 && rgPropSets2)
  {
    //Loop over all the provider returned properties, and see if they
    //already exist in the OLE DB Defined properties.
    for(ULONG iPropSet=0; iPropSet<cPropSets2; iPropSet++)
    {
      DBPROPSET* pPropSet2 = &rgPropSets2[iPropSet];
      DBPROPINFOSET* pFoundSet = FindPropSet(pPropSet2->guidPropertySet, cPropInfoSets, rgPropInfoSets);

      if(pFoundSet)
      {
        //Add all properties of this set...
        for(ULONG iProp=0; iProp<pPropSet2->cProperties; iProp++)
        {
          DBPROP* pProp2 = &pPropSet2->rgProperties[iProp];
          DBPROPINFO* pFoundProp = FindProperty(pProp2->dwPropertyID, pPropSet2->guidPropertySet, 1, pFoundSet);

          if(pFoundProp)
          {
            //Found the propertyset as well as the property
            //just need to update it in the list...
            pFoundProp->dwPropertyID  = pProp2->dwPropertyID;
            pFoundProp->vValues     = pProp2->vValue;

            //Update the Type (if its meaningful...)
            if(pProp2->vValue.vt != VT_EMPTY)
              pFoundProp->vtType    = pProp2->vValue.vt;

            //NOTE: WE store the dwOptions flag within the DBPROPFLAGS_REQUIRED
            ENABLE_BIT(pFoundProp->dwFlags, DBPROPFLAGS_REQUIRED, pProp2->dwOptions == DBPROPOPTIONS_REQUIRED);
          }
          else
          {
            //Found the property set, but not the property
            //just need to add this property to the list...
            SAFE_REALLOC(pFoundSet->rgPropertyInfos, DBPROPINFO, pFoundSet->cPropertyInfos + 1);
            memset(&pFoundSet->rgPropertyInfos[pFoundSet->cPropertyInfos], 0, sizeof(DBPROPINFO));
            pFoundSet->rgPropertyInfos[pFoundSet->cPropertyInfos].dwPropertyID  = pProp2->dwPropertyID;
            pFoundSet->rgPropertyInfos[pFoundSet->cPropertyInfos].vtType    = pProp2->vValue.vt;
            pFoundSet->rgPropertyInfos[pFoundSet->cPropertyInfos].vValues   = pProp2->vValue;

            //NOTE: WE store the dwOptions flag within the DBPROPFLAGS_REQUIRED
            ENABLE_BIT(pFoundSet->rgPropertyInfos[pFoundSet->cPropertyInfos].dwFlags, DBPROPFLAGS_REQUIRED, pProp2->dwOptions == DBPROPOPTIONS_REQUIRED);
            pFoundSet->cPropertyInfos++;
          }

          //Do we need to make a copy of the variant...
          if(!bFreeAddedPropSet)
          {
            //TODO
            //Also what about the stringbuffer with property descriptions?
          }
        }
      }
      else
      {
        //Need to add the entire property set, as well as all the properties.
        SAFE_REALLOC(rgPropInfoSets, DBPROPINFOSET, cPropInfoSets + 1);
        rgPropInfoSets[cPropInfoSets].guidPropertySet = pPropSet2->guidPropertySet;
        rgPropInfoSets[cPropInfoSets].cPropertyInfos  = pPropSet2->cProperties;

        //Add all the properties of this set...
        SAFE_ALLOC(rgPropInfoSets[cPropInfoSets].rgPropertyInfos, DBPROPINFO, pPropSet2->cProperties);
        for(ULONG iProp=0; iProp<pPropSet2->cProperties; iProp++)
        {
          memset(&rgPropInfoSets[cPropInfoSets].rgPropertyInfos[iProp], 0, sizeof(DBPROPINFO));
          rgPropInfoSets[cPropInfoSets].rgPropertyInfos[iProp].dwPropertyID = pPropSet2->rgProperties[iProp].dwPropertyID;
          rgPropInfoSets[cPropInfoSets].rgPropertyInfos[iProp].vtType     = pPropSet2->rgProperties[iProp].vValue.vt;
          rgPropInfoSets[cPropInfoSets].rgPropertyInfos[iProp].vValues    = pPropSet2->rgProperties[iProp].vValue;

          //NOTE: WE store the dwOptions flag within the DBPROPFLAGS_REQUIRED
          ENABLE_BIT(rgPropInfoSets[cPropInfoSets].rgPropertyInfos[iProp].dwFlags, DBPROPFLAGS_REQUIRED, pPropSet2->rgProperties[iProp].dwOptions == DBPROPOPTIONS_REQUIRED);

          //Do we need to make a copy of the variant...
          if(!bFreeAddedPropSet)
          {
            //TODO
            //Also what about the stringbuffer with property descriptions?
          }
        }
        cPropInfoSets++;
      }

      //We are done with this array of properties...
      if(bFreeAddedPropSet)
        SAFE_FREE(pPropSet2->rgProperties);
    }

    //NOTE: In the process of combining both of these sets, we are doing
    //direct memory copy of the internal DBPROPINFO items, this way
    //we don't need to variant copy all the values, and duplicate all the
    //strings.  But this also requires that we don't free the source of the
    //copies as well.  So we will finally end up freeing the combined
    //property sets (cPropInfoSets) but not (cPropInfoSets2)
    if(bFreeAddedPropSet)
      SAFE_FREE(rgPropSets2);
  }

CLEANUP:
  *pcPropInfoSets = cPropInfoSets;
  *prgPropInfoSets = rgPropInfoSets;
  return hr;
}

DBPROPINFO* FindProperty | ( | DBPROPID | dwPropertyID,
 |  | REFGUID | guidPropertySet,
 |  | ULONG | cPropInfoSets,
 |  | DBPROPINFOSET * | rgPropInfoSets
 | ) |  |

Definition at line 619 of file property.cpp.

{
  //Loop over the number of property sets
  for(ULONG iPropSet=0; iPropSet<cPropInfoSets; iPropSet++)
  {
    DBPROPINFOSET* pPropInfoSet = &rgPropInfoSets[iPropSet];

    //Make sure where looking in the right property set
    if(guidPropertySet != pPropInfoSet->guidPropertySet)
      continue;

    //Loop over the array of properties in this set
    for(ULONG iProp=0; iProp<pPropInfoSet->cPropertyInfos; iProp++)
    {
      DBPROPINFO* pPropInfo = &pPropInfoSet->rgPropertyInfos[iProp];
      if(pPropInfo->dwPropertyID == dwPropertyID)
        return pPropInfo;
    }
  }

  return NULL;
}

DBPROPINFOSET* FindPropSet | ( | REFGUID | guidPropertySet,
 |  | ULONG | cPropInfoSets,
 |  | DBPROPINFOSET * | rgPropInfoSets
 | ) |  |

Definition at line 599 of file property.cpp.

{
  //Loop over the property sets
  for(ULONG iPropSet=0; iPropSet<cPropInfoSets; iPropSet++)
  {
    DBPROPINFOSET* pPropInfoSet = &rgPropInfoSets[iPropSet];

    //Make sure where looking in the right property set
    if(guidPropertySet == pPropInfoSet->guidPropertySet)
      return pPropInfoSet;
  }

  return NULL;
}

HRESULT FreeProperties | ( | ULONG * | pcPropInfoSets,
 |  | DBPROPINFOSET ** | prgPropInfoSets
 | ) |  |

Definition at line 1191 of file property.cpp.

{
  ASSERT(pcPropInfoSets);
  ASSERT(prgPropInfoSets);
  HRESULT hr = S_OK;

  //Loop over all the property info sets
  for(ULONG iPropSet=0; iPropSet<*pcPropInfoSets; iPropSet++)
  {
    DBPROPINFOSET* pPropInfoSet = &((*prgPropInfoSets)[iPropSet]);

    //Free the inner variants first
    for(ULONG iProp=0; iProp<pPropInfoSet->cPropertyInfos; iProp++)
    {
      DBPROPINFO* pPropInfo = &pPropInfoSet->rgPropertyInfos[iProp];
      XTEST(hr = VariantClearFast(&pPropInfo->vValues));
    }

    //Now free the set
    SAFE_FREE(pPropInfoSet->rgPropertyInfos);
  }

  //Now free the outer set
  *pcPropInfoSets = 0;
  SAFE_FREE((*prgPropInfoSets));
  return hr;
}

HRESULT FreeProperties | ( | ULONG * | pcProperties,
 |  | DBPROP ** | prgProperties
 | ) |  |

Definition at line 1116 of file property.cpp.

{
  ASSERT(pcProperties);
  ASSERT(prgProperties);
  HRESULT hr = S_OK;

  //no-op case
  if(*pcProperties==0 || *prgProperties==NULL)
    return S_OK;

  //Free the inner variants first
  for(ULONG iProp=0; iProp<*pcProperties; iProp++)
  {
    DBPROP* pProp = &((*prgProperties)[iProp]);
    XTEST(hr = VariantClearFast(&pProp->vValue));
  }

  //Now NULL the set
  *pcProperties = 0;
  SAFE_FREE(*prgProperties);
  return hr;
}

HRESULT FreeProperties | ( | ULONG * | pcPropSets,
 |  | DBPROPSET ** | prgPropSets
 | ) |  |

Definition at line 1143 of file property.cpp.

{
  ASSERT(pcPropSets);
  ASSERT(prgPropSets);
  HRESULT hr = S_OK;

  //Loop over all the property sets
  for(ULONG iPropSet=0; iPropSet<*pcPropSets; iPropSet++)
  {
    DBPROPSET* pPropSet = &((*prgPropSets)[iPropSet]);
    FreeProperties(&pPropSet->cProperties, &pPropSet->rgProperties);
  }

  //Now NULL the outer set
  *pcPropSets = 0;
  SAFE_FREE(*prgPropSets);
  return hr;
}

HRESULT FreeProperties | ( | ULONG * | pcPropIDSets,
 |  | DBPROPIDSET ** | prgPropIDSets
 | ) |  |

Definition at line 1167 of file property.cpp.

{
  ASSERT(pcPropIDSets);
  ASSERT(prgPropIDSets);
  HRESULT hr = S_OK;

  //Loop over all the property sets
  for(ULONG iPropIDSet=0; iPropIDSet<*pcPropIDSets; iPropIDSet++)
  {
    DBPROPIDSET* pPropIDSet = &((*prgPropIDSets)[iPropIDSet]);
    SAFE_FREE(pPropIDSet->rgPropertyIDs);
  }

  //Now NULL the outer set
  *pcPropIDSets = 0;
  SAFE_FREE(*prgPropIDSets);
  return hr;
}

HRESULT GetProperty | ( | REFIID | riid,
 |  | IUnknown * | pIUnknown,
 |  | DBPROPID | dwPropertyID,
 |  | REFGUID | guidPropertySet,
 |  | DBTYPE | wType,
 |  | void * | pv
 | ) |  |

Definition at line 942 of file property.cpp.

{
  ASSERT(pv);
  HRESULT hr = S_OK;
  DBPROP* pProp = NULL;

  //Delegate
  hr = GetProperty(riid, pIUnknown, dwPropertyID, guidPropertySet, &pProp);

  //Put the value in the users buffer...
  if(SUCCEEDED(hr) && pProp)
  {
    //If the types are not what the user expected to receive then
    //we have to fail since pValue is of type wType.
    if(wType != pProp->vValue.vt)
    {
      //Free the property (since were not returning it to the user...)
      XTEST(hr = VariantClearFast(&pProp->vValue));
      TESTC(hr = E_INVALIDARG);
    }

    switch(wType)
    {
      case DBTYPE_BOOL:
        *(VARIANT_BOOL*)pv      = V_BOOL(&pProp->vValue);
        break;

      case DBTYPE_I2:
        *(SHORT*)pv         = V_I2(&pProp->vValue);
        break;

      case DBTYPE_I4:
        *(LONG*)pv          = V_I4(&pProp->vValue);
        break;

  #ifdef _WIN64
      case DBTYPE_I8:
  //TODO64: *(LONG_PTR*)pv        = V_I8(&pProp->vValue);
        *(LONG_PTR*)pv        = pProp->vValue.ullVal;
        break;
  #endif //_WIN64

      case DBTYPE_WSTR:
      case DBTYPE_BSTR:
        *(BSTR*)pv          = V_BSTR(&pProp->vValue);
        break;

      case DBTYPE_VARIANT:
        *(VARIANT*)pv       = pProp->vValue;  //Assignment
        break;

      default:
        ASSERT(FALSE); //Unhandled property type
        TESTC(hr = E_INVALIDARG);
        break;
    };
  }

CLEANUP:
  //NOTE: GetProperty returns a pointer to the DBPROP (rgProperties) which is allocated
  //and needs to be free'd.  But the actual value we passed directly to the user which
  //is required to free the value, but we need to the free the outer array
  SAFE_FREE(pProp);
  return hr;
}

HRESULT GetProperty | ( | REFIID | riid,
 |  | IUnknown * | pIUnknown,
 |  | DBPROPID | dwPropertyID,
 |  | REFGUID | guidPropertySet,
 |  | DBPROP ** | ppProperty
 | ) |  |

Definition at line 879 of file property.cpp.

{
  ASSERT(ppProperty);
  *ppProperty = NULL;

  HRESULT hr = S_OK;

  //Invalid Arguments
  if(!pIUnknown)
    return E_INVALIDARG;

  ULONG     cPropSets = 0;
  DBPROPSET*    rgPropSets = NULL;
  const ULONG   cPropertyIDSets = 1;
  DBPROPIDSET   rgPropertyIDSets[cPropertyIDSets];

  //SetUp input DBPROPIDSET struct (all static)
  rgPropertyIDSets[0].cPropertyIDs = cPropertyIDSets;
  rgPropertyIDSets[0].rgPropertyIDs = &dwPropertyID;
  rgPropertyIDSets[0].guidPropertySet = guidPropertySet;

  //Need to figure out which Interface was passed in
  //IDBInitialize, or ICommand, or IRowset, all three allow GetProperties
  if(riid == IID_IDBProperties)
  {
    //GetProperties, property might not be supported
    hr = ((IDBProperties*)pIUnknown)->GetProperties(cPropertyIDSets, rgPropertyIDSets, &cPropSets, &rgPropSets);
  }
  else if(riid == IID_ICommandProperties)
  {
    //GetProperties, property might not be supported
    hr = ((ICommandProperties*)pIUnknown)->GetProperties(cPropertyIDSets, rgPropertyIDSets, &cPropSets, &rgPropSets);
  }
  else if(riid == IID_IRowsetInfo)
  {
    //GetProperties, property might not be supported
    hr = ((IRowsetInfo*)pIUnknown)->GetProperties(cPropertyIDSets, rgPropertyIDSets, &cPropSets, &rgPropSets);
  }

  //Check return result
  //Can be DB_S_ / DB_E_ERRORSOCCURRED if notsupported property...
  if(FAILED(hr) && hr != DB_E_ERRORSOCCURRED)
    TESTC(hr);

  //Verify results
  ASSERTC(cPropSets==1 && rgPropSets!=NULL);
  ASSERTC(rgPropSets[0].cProperties==1 && rgPropSets[0].rgProperties!=NULL);
  ASSERTC(rgPropSets[0].rgProperties[0].dwPropertyID == dwPropertyID);

  //Return the property to the user
  *ppProperty = rgPropSets[0].rgProperties;

CLEANUP:
  //Just Free the outer Struct,
  //since we return the inner Property for the user to free
  SAFE_FREE(rgPropSets);
  return hr;
}

HRESULT GetPropInfo | ( | IDBProperties * | pIDBProperties,
 |  | DBPROPID | dwPropertyID,
 |  | REFGUID | guidPropertySet,
 |  | DBPROPINFO ** | ppPropInfo
 | ) |  |

Definition at line 1013 of file property.cpp.

{
  if(ppPropInfo)
    *ppPropInfo = NULL;

  if(!pIDBProperties)
    return E_FAIL;

  HRESULT hr = S_OK;
  const ULONG cPropIDSets = 1;
  DBPROPIDSET rgPropIDSets[cPropIDSets];

  ULONG cPropInfoSets = 0;
  DBPROPINFOSET* rgPropInfoSets = NULL;

  //Construct the DBPROPIDSET structure
  rgPropIDSets[0].cPropertyIDs = 1;
  rgPropIDSets[0].rgPropertyIDs = &dwPropertyID;
  rgPropIDSets[0].guidPropertySet = guidPropertySet;

  //Don't display dialog if errors occurred.
  //Errors can occur if properties are not supported by the provider
  TESTC(hr = pIDBProperties->GetPropertyInfo(cPropIDSets,rgPropIDSets,&cPropInfoSets,&rgPropInfoSets,NULL));

CLEANUP:
  *ppPropInfo = rgPropInfoSets ? rgPropInfoSets[0].rgPropertyInfos  : NULL;
  SAFE_FREE(rgPropInfoSets);
  return hr;
}

DBPROPFLAGS GetPropInfoFlags | ( | IDBProperties * | pIDBProperties,
 |  | DBPROPID | dwPropertyID,
 |  | REFGUID | guidPropertySet
 | ) |  |

Definition at line 1048 of file property.cpp.

{
  if(!pIDBProperties)
    return 0;

  DBPROPINFO* pPropInfo = NULL;
  DBPROPFLAGS dwFlags = DBPROPFLAGS_NOTSUPPORTED;

  //GetPropInfo
  TESTC(GetPropInfo(pIDBProperties, dwPropertyID, guidPropertySet, &pPropInfo));
  if(pPropInfo)
  {
    dwFlags = pPropInfo->dwFlags;

    //Free the variant, could contain a safearray or similar...
    XTEST(VariantClearFast(&pPropInfo->vValues));
  }

CLEANUP:
  SAFE_FREE(pPropInfo);
  return dwFlags;
}

BOOL IsSettableProperty | ( | IDBProperties * | pIDBProperties,
 |  | DBPROPID | dwPropertyID,
 |  | REFGUID | guidPropertySet
 | ) |  |

Definition at line 1086 of file property.cpp.

{
  return GetPropInfoFlags(pIDBProperties, dwPropertyID, guidPropertySet) & DBPROPFLAGS_WRITE;
}

BOOL IsSupportedProperty | ( | IDBProperties * | pIDBProperties,
 |  | DBPROPID | dwPropertyID,
 |  | REFGUID | guidPropertySet
 | ) |  |

Definition at line 1076 of file property.cpp.

{
  return GetPropInfoFlags(pIDBProperties, dwPropertyID, guidPropertySet) != DBPROPFLAGS_NOTSUPPORTED;
}

HRESULT SetProperty | ( | DBPROPID | dwPropertyID,
 |  | REFGUID | guidPropertySet,
 |  | ULONG * | pcPropSets,
 |  | DBPROPSET ** | prgPropSets,
 |  | DBTYPE | wType,
 |  | void * | pv,
 |  | DBPROPOPTIONS | dwOptions,
 |  | const DBID & | colid
 | ) |  |

Definition at line 1096 of file property.cpp.

{
  ASSERT(prgPropSets && pcPropSets);

  //The simplest Approach is to just use our class...
  CPropSets sCPropSets(*pcPropSets, *prgPropSets);

  //Delegate
  HRESULT hr = sCPropSets.SetProperty(dwPropertyID, guidPropertySet, wType, pv, dwOptions, colid);

  //Return the properties to the user and remove from static class...
  sCPropSets.Detach(pcPropSets, prgPropSets);
  return hr;
}

Generated on Wed Nov 13 2024 16:53:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/property.h File Reference

  • Dataaccess
  • oledb
  • rowsetviewer
Classes | Functions

property.h File Reference

Go to the source code of this file.

Classes

class | CProperties
class | CPropertyIDs
class | CPropertyInfos
class | CPropIDSets
class | CPropInfoSets
class | CPropSets
class | TPropBase< TYPE >
class | TPropSetBase< TYPE, OBJTYPE >

Functions

HRESULT | CombineProperties (ULONG *pcPropInfoSets, DBPROPINFOSET **prgPropInfoSets, ULONG cPropInfoSets2, DBPROPINFOSET *rgPropInfoSets2, BOOL bFreeAddedPropSet=TRUE)
HRESULT | CombineProperties (ULONG *pcPropInfoSets, DBPROPINFOSET **prgPropInfoSets, ULONG cPropSets2, DBPROPSET *rgPropSets2, BOOL bFreeAddedPropSet=TRUE)
DBPROPINFO * | FindProperty (DBPROPID dwPropertyID, REFGUID guidPropertySet, ULONG cPropInfoSets, DBPROPINFOSET *rgPropInfoSets)
DBPROPINFOSET * | FindPropSet (REFGUID guidPropertySet, ULONG cPropInfoSets, DBPROPINFOSET *rgPropInfoSets)
HRESULT | FreeProperties (ULONG *pcProperties, DBPROP **prgProperties)
HRESULT | FreeProperties (ULONG *pcPropSets, DBPROPSET **prgPropSets)
HRESULT | FreeProperties (ULONG *pcPropIDSets, DBPROPIDSET **prgPropIDSets)
HRESULT | FreeProperties (ULONG *pcPropInfoSets, DBPROPINFOSET **prgPropInfoSets)
HRESULT | GetProperty (REFIID riid, IUnknown *pIUnknown, DBPROPID dwPropertyID, REFGUID guidPropertySet, DBPROP **ppProperty)
HRESULT | GetProperty (REFIID riid, IUnknown *pIUnknown, DBPROPID dwPropertyID, REFGUID guidPropertySet, DBTYPE wType, void *pv)
HRESULT | GetPropInfo (IDBProperties *pIDBProperties, DBPROPID dwPropertyID, REFGUID guidPropertySet, DBPROPINFO **ppPropInfo)
DBPROPFLAGS | GetPropInfoFlags (IDBProperties *pIDBProperties, DBPROPID dwPropertyID, REFGUID guidPropertySet)
BOOL | IsSettableProperty (IDBProperties *pIDBProperties, DBPROPID dwPropertyID, REFGUID guidPropertySet)
BOOL | IsSupportedProperty (IDBProperties *pIDBProperties, DBPROPID dwPropertyID, REFGUID guidPropertySet)
HRESULT | SetProperty (DBPROPID dwPropertyID, REFGUID guidPropertySet, ULONG *pcPropSets, DBPROPSET **prgPropSets, DBTYPE wType, void *pv, DBPROPOPTIONS dwOptions=DBPROPOPTIONS_REQUIRED, const DBID &colid=DB_NULLID)

Function Documentation

HRESULT CombineProperties | ( | ULONG * | pcPropInfoSets,
 |  | DBPROPINFOSET ** | prgPropInfoSets,
 |  | ULONG | cPropInfoSets2,
 |  | DBPROPINFOSET * | rgPropInfoSets2,
 |  | BOOL | bFreeAddedPropSet = TRUE
 | ) |  |

Definition at line 647 of file property.cpp.

{
  ASSERT(pcPropInfoSets);
  ASSERT(prgPropInfoSets);
  HRESULT hr = S_OK;

  //Make our lives a little easier...
  ULONG cPropInfoSets = *pcPropInfoSets;
  DBPROPINFOSET* rgPropInfoSets = *prgPropInfoSets;

  //Now combine both sets...
  if(cPropInfoSets2 && rgPropInfoSets2)
  {
    if(cPropInfoSets && rgPropInfoSets)
    {
      //Loop over all the provider returned properties, and see if they
      //already exist in the OLE DB Defined properties.
      for(ULONG iPropSet=0; iPropSet<cPropInfoSets2; iPropSet++)
      {
        DBPROPINFOSET* pPropInfoSet2 = &rgPropInfoSets2[iPropSet];
        DBPROPINFOSET* pFoundSet = FindPropSet(pPropInfoSet2->guidPropertySet, cPropInfoSets, rgPropInfoSets);

        if(pFoundSet)
        {
          //Add all properties of this set...
          for(ULONG iProp=0; iProp<pPropInfoSet2->cPropertyInfos; iProp++)
          {
            DBPROPINFO* pPropInfo2 = &pPropInfoSet2->rgPropertyInfos[iProp];
            DBPROPINFO* pFoundProp = FindProperty(pPropInfo2->dwPropertyID, pPropInfoSet2->guidPropertySet, 1, pFoundSet);

            if(pFoundProp)
            {
              //Found the propertyset as well as the property
              //just need to update it in the list...
              *pFoundProp = *pPropInfo2;
            }
            else
            {
              //Found the property set, but not the property
              //just need to add this property to the list...
              SAFE_REALLOC(pFoundSet->rgPropertyInfos, DBPROPINFO, pFoundSet->cPropertyInfos + 1);
              pFoundSet->rgPropertyInfos[pFoundSet->cPropertyInfos] = *pPropInfo2;
              pFoundSet->cPropertyInfos++;
            }

            //Do we need to make a copy of the variant...
            if(!bFreeAddedPropSet)
            {
              //TODO
              //Also what about the stringbuffer with property descriptions?
            }
          }
        }
        else
        {
          //Need to add the entire property set, as well as all the properties.
          SAFE_REALLOC(rgPropInfoSets, DBPROPINFOSET, cPropInfoSets + 1);
          rgPropInfoSets[cPropInfoSets].guidPropertySet = pPropInfoSet2->guidPropertySet;
          rgPropInfoSets[cPropInfoSets].cPropertyInfos  = pPropInfoSet2->cPropertyInfos;

          //Add all the properties of this set...
          SAFE_ALLOC(rgPropInfoSets[cPropInfoSets].rgPropertyInfos, DBPROPINFO, pPropInfoSet2->cPropertyInfos);
          for(ULONG iProp=0; iProp<pPropInfoSet2->cPropertyInfos; iProp++)
          {
            rgPropInfoSets[cPropInfoSets].rgPropertyInfos[iProp] = pPropInfoSet2->rgPropertyInfos[iProp];

            //Do we need to make a copy of the variant...
            if(!bFreeAddedPropSet)
            {
              //TODO
              //Also what about the stringbuffer with property descriptions?
            }
          }
          cPropInfoSets++;
        }

        //We are done with this array of properties...
        if(bFreeAddedPropSet)
          SAFE_FREE(pPropInfoSet2->rgPropertyInfos);
      }

      //NOTE: In the process of combining both of these sets, we are doing
      //direct memory copy of the internal DBPROPINFO items, this way
      //we don't need to variant copy all the values, and duplicate all the
      //strings.  But this also requires that we don't free the source of the
      //copies as well.  So we will finally end up freeing the combined
      //property sets (cPropInfoSets) but not (cPropInfoSets2)
      if(bFreeAddedPropSet)
        SAFE_FREE(rgPropInfoSets2);
    }
    else
    {
      cPropInfoSets = cPropInfoSets2;
      rgPropInfoSets = rgPropInfoSets2;
    }
  }

CLEANUP:
  *pcPropInfoSets = cPropInfoSets;
  *prgPropInfoSets = rgPropInfoSets;
  return hr;
}

HRESULT CombineProperties | ( | ULONG * | pcPropInfoSets,
 |  | DBPROPINFOSET ** | prgPropInfoSets,
 |  | ULONG | cPropSets2,
 |  | DBPROPSET * | rgPropSets2,
 |  | BOOL | bFreeAddedPropSet = TRUE
 | ) |  |

Definition at line 755 of file property.cpp.

{
  ASSERT(pcPropInfoSets);
  ASSERT(prgPropInfoSets);
  HRESULT hr = S_OK;

  //Make our lives a little easier...
  ULONG cPropInfoSets = *pcPropInfoSets;
  DBPROPINFOSET* rgPropInfoSets = *prgPropInfoSets;

  //Now combine both sets...
  if(cPropSets2 && rgPropSets2)
  {
    //Loop over all the provider returned properties, and see if they
    //already exist in the OLE DB Defined properties.
    for(ULONG iPropSet=0; iPropSet<cPropSets2; iPropSet++)
    {
      DBPROPSET* pPropSet2 = &rgPropSets2[iPropSet];
      DBPROPINFOSET* pFoundSet = FindPropSet(pPropSet2->guidPropertySet, cPropInfoSets, rgPropInfoSets);

      if(pFoundSet)
      {
        //Add all properties of this set...
        for(ULONG iProp=0; iProp<pPropSet2->cProperties; iProp++)
        {
          DBPROP* pProp2 = &pPropSet2->rgProperties[iProp];
          DBPROPINFO* pFoundProp = FindProperty(pProp2->dwPropertyID, pPropSet2->guidPropertySet, 1, pFoundSet);

          if(pFoundProp)
          {
            //Found the propertyset as well as the property
            //just need to update it in the list...
            pFoundProp->dwPropertyID  = pProp2->dwPropertyID;
            pFoundProp->vValues     = pProp2->vValue;

            //Update the Type (if its meaningful...)
            if(pProp2->vValue.vt != VT_EMPTY)
              pFoundProp->vtType    = pProp2->vValue.vt;

            //NOTE: WE store the dwOptions flag within the DBPROPFLAGS_REQUIRED
            ENABLE_BIT(pFoundProp->dwFlags, DBPROPFLAGS_REQUIRED, pProp2->dwOptions == DBPROPOPTIONS_REQUIRED);
          }
          else
          {
            //Found the property set, but not the property
            //just need to add this property to the list...
            SAFE_REALLOC(pFoundSet->rgPropertyInfos, DBPROPINFO, pFoundSet->cPropertyInfos + 1);
            memset(&pFoundSet->rgPropertyInfos[pFoundSet->cPropertyInfos], 0, sizeof(DBPROPINFO));
            pFoundSet->rgPropertyInfos[pFoundSet->cPropertyInfos].dwPropertyID  = pProp2->dwPropertyID;
            pFoundSet->rgPropertyInfos[pFoundSet->cPropertyInfos].vtType    = pProp2->vValue.vt;
            pFoundSet->rgPropertyInfos[pFoundSet->cPropertyInfos].vValues   = pProp2->vValue;

            //NOTE: WE store the dwOptions flag within the DBPROPFLAGS_REQUIRED
            ENABLE_BIT(pFoundSet->rgPropertyInfos[pFoundSet->cPropertyInfos].dwFlags, DBPROPFLAGS_REQUIRED, pProp2->dwOptions == DBPROPOPTIONS_REQUIRED);
            pFoundSet->cPropertyInfos++;
          }

          //Do we need to make a copy of the variant...
          if(!bFreeAddedPropSet)
          {
            //TODO
            //Also what about the stringbuffer with property descriptions?
          }
        }
      }
      else
      {
        //Need to add the entire property set, as well as all the properties.
        SAFE_REALLOC(rgPropInfoSets, DBPROPINFOSET, cPropInfoSets + 1);
        rgPropInfoSets[cPropInfoSets].guidPropertySet = pPropSet2->guidPropertySet;
        rgPropInfoSets[cPropInfoSets].cPropertyInfos  = pPropSet2->cProperties;

        //Add all the properties of this set...
        SAFE_ALLOC(rgPropInfoSets[cPropInfoSets].rgPropertyInfos, DBPROPINFO, pPropSet2->cProperties);
        for(ULONG iProp=0; iProp<pPropSet2->cProperties; iProp++)
        {
          memset(&rgPropInfoSets[cPropInfoSets].rgPropertyInfos[iProp], 0, sizeof(DBPROPINFO));
          rgPropInfoSets[cPropInfoSets].rgPropertyInfos[iProp].dwPropertyID = pPropSet2->rgProperties[iProp].dwPropertyID;
          rgPropInfoSets[cPropInfoSets].rgPropertyInfos[iProp].vtType     = pPropSet2->rgProperties[iProp].vValue.vt;
          rgPropInfoSets[cPropInfoSets].rgPropertyInfos[iProp].vValues    = pPropSet2->rgProperties[iProp].vValue;

          //NOTE: WE store the dwOptions flag within the DBPROPFLAGS_REQUIRED
          ENABLE_BIT(rgPropInfoSets[cPropInfoSets].rgPropertyInfos[iProp].dwFlags, DBPROPFLAGS_REQUIRED, pPropSet2->rgProperties[iProp].dwOptions == DBPROPOPTIONS_REQUIRED);

          //Do we need to make a copy of the variant...
          if(!bFreeAddedPropSet)
          {
            //TODO
            //Also what about the stringbuffer with property descriptions?
          }
        }
        cPropInfoSets++;
      }

      //We are done with this array of properties...
      if(bFreeAddedPropSet)
        SAFE_FREE(pPropSet2->rgProperties);
    }

    //NOTE: In the process of combining both of these sets, we are doing
    //direct memory copy of the internal DBPROPINFO items, this way
    //we don't need to variant copy all the values, and duplicate all the
    //strings.  But this also requires that we don't free the source of the
    //copies as well.  So we will finally end up freeing the combined
    //property sets (cPropInfoSets) but not (cPropInfoSets2)
    if(bFreeAddedPropSet)
      SAFE_FREE(rgPropSets2);
  }

CLEANUP:
  *pcPropInfoSets = cPropInfoSets;
  *prgPropInfoSets = rgPropInfoSets;
  return hr;
}

DBPROPINFO* FindProperty | ( | DBPROPID | dwPropertyID,
 |  | REFGUID | guidPropertySet,
 |  | ULONG | cPropInfoSets,
 |  | DBPROPINFOSET * | rgPropInfoSets
 | ) |  |

Definition at line 619 of file property.cpp.

{
  //Loop over the number of property sets
  for(ULONG iPropSet=0; iPropSet<cPropInfoSets; iPropSet++)
  {
    DBPROPINFOSET* pPropInfoSet = &rgPropInfoSets[iPropSet];

    //Make sure where looking in the right property set
    if(guidPropertySet != pPropInfoSet->guidPropertySet)
      continue;

    //Loop over the array of properties in this set
    for(ULONG iProp=0; iProp<pPropInfoSet->cPropertyInfos; iProp++)
    {
      DBPROPINFO* pPropInfo = &pPropInfoSet->rgPropertyInfos[iProp];
      if(pPropInfo->dwPropertyID == dwPropertyID)
        return pPropInfo;
    }
  }

  return NULL;
}

DBPROPINFOSET* FindPropSet | ( | REFGUID | guidPropertySet,
 |  | ULONG | cPropInfoSets,
 |  | DBPROPINFOSET * | rgPropInfoSets
 | ) |  |

Definition at line 599 of file property.cpp.

{
  //Loop over the property sets
  for(ULONG iPropSet=0; iPropSet<cPropInfoSets; iPropSet++)
  {
    DBPROPINFOSET* pPropInfoSet = &rgPropInfoSets[iPropSet];

    //Make sure where looking in the right property set
    if(guidPropertySet == pPropInfoSet->guidPropertySet)
      return pPropInfoSet;
  }

  return NULL;
}

HRESULT FreeProperties | ( | ULONG * | pcProperties,
 |  | DBPROP ** | prgProperties
 | ) |  |

Definition at line 1116 of file property.cpp.

{
  ASSERT(pcProperties);
  ASSERT(prgProperties);
  HRESULT hr = S_OK;

  //no-op case
  if(*pcProperties==0 || *prgProperties==NULL)
    return S_OK;

  //Free the inner variants first
  for(ULONG iProp=0; iProp<*pcProperties; iProp++)
  {
    DBPROP* pProp = &((*prgProperties)[iProp]);
    XTEST(hr = VariantClearFast(&pProp->vValue));
  }

  //Now NULL the set
  *pcProperties = 0;
  SAFE_FREE(*prgProperties);
  return hr;
}

HRESULT FreeProperties | ( | ULONG * | pcPropSets,
 |  | DBPROPSET ** | prgPropSets
 | ) |  |

Definition at line 1143 of file property.cpp.

{
  ASSERT(pcPropSets);
  ASSERT(prgPropSets);
  HRESULT hr = S_OK;

  //Loop over all the property sets
  for(ULONG iPropSet=0; iPropSet<*pcPropSets; iPropSet++)
  {
    DBPROPSET* pPropSet = &((*prgPropSets)[iPropSet]);
    FreeProperties(&pPropSet->cProperties, &pPropSet->rgProperties);
  }

  //Now NULL the outer set
  *pcPropSets = 0;
  SAFE_FREE(*prgPropSets);
  return hr;
}

HRESULT FreeProperties | ( | ULONG * | pcPropIDSets,
 |  | DBPROPIDSET ** | prgPropIDSets
 | ) |  |

Definition at line 1167 of file property.cpp.

{
  ASSERT(pcPropIDSets);
  ASSERT(prgPropIDSets);
  HRESULT hr = S_OK;

  //Loop over all the property sets
  for(ULONG iPropIDSet=0; iPropIDSet<*pcPropIDSets; iPropIDSet++)
  {
    DBPROPIDSET* pPropIDSet = &((*prgPropIDSets)[iPropIDSet]);
    SAFE_FREE(pPropIDSet->rgPropertyIDs);
  }

  //Now NULL the outer set
  *pcPropIDSets = 0;
  SAFE_FREE(*prgPropIDSets);
  return hr;
}

HRESULT FreeProperties | ( | ULONG * | pcPropInfoSets,
 |  | DBPROPINFOSET ** | prgPropInfoSets
 | ) |  |

Definition at line 1191 of file property.cpp.

{
  ASSERT(pcPropInfoSets);
  ASSERT(prgPropInfoSets);
  HRESULT hr = S_OK;

  //Loop over all the property info sets
  for(ULONG iPropSet=0; iPropSet<*pcPropInfoSets; iPropSet++)
  {
    DBPROPINFOSET* pPropInfoSet = &((*prgPropInfoSets)[iPropSet]);

    //Free the inner variants first
    for(ULONG iProp=0; iProp<pPropInfoSet->cPropertyInfos; iProp++)
    {
      DBPROPINFO* pPropInfo = &pPropInfoSet->rgPropertyInfos[iProp];
      XTEST(hr = VariantClearFast(&pPropInfo->vValues));
    }

    //Now free the set
    SAFE_FREE(pPropInfoSet->rgPropertyInfos);
  }

  //Now free the outer set
  *pcPropInfoSets = 0;
  SAFE_FREE((*prgPropInfoSets));
  return hr;
}

HRESULT GetProperty | ( | REFIID | riid,
 |  | IUnknown * | pIUnknown,
 |  | DBPROPID | dwPropertyID,
 |  | REFGUID | guidPropertySet,
 |  | DBPROP ** | ppProperty
 | ) |  |

Definition at line 879 of file property.cpp.

{
  ASSERT(ppProperty);
  *ppProperty = NULL;

  HRESULT hr = S_OK;

  //Invalid Arguments
  if(!pIUnknown)
    return E_INVALIDARG;

  ULONG     cPropSets = 0;
  DBPROPSET*    rgPropSets = NULL;
  const ULONG   cPropertyIDSets = 1;
  DBPROPIDSET   rgPropertyIDSets[cPropertyIDSets];

  //SetUp input DBPROPIDSET struct (all static)
  rgPropertyIDSets[0].cPropertyIDs = cPropertyIDSets;
  rgPropertyIDSets[0].rgPropertyIDs = &dwPropertyID;
  rgPropertyIDSets[0].guidPropertySet = guidPropertySet;

  //Need to figure out which Interface was passed in
  //IDBInitialize, or ICommand, or IRowset, all three allow GetProperties
  if(riid == IID_IDBProperties)
  {
    //GetProperties, property might not be supported
    hr = ((IDBProperties*)pIUnknown)->GetProperties(cPropertyIDSets, rgPropertyIDSets, &cPropSets, &rgPropSets);
  }
  else if(riid == IID_ICommandProperties)
  {
    //GetProperties, property might not be supported
    hr = ((ICommandProperties*)pIUnknown)->GetProperties(cPropertyIDSets, rgPropertyIDSets, &cPropSets, &rgPropSets);
  }
  else if(riid == IID_IRowsetInfo)
  {
    //GetProperties, property might not be supported
    hr = ((IRowsetInfo*)pIUnknown)->GetProperties(cPropertyIDSets, rgPropertyIDSets, &cPropSets, &rgPropSets);
  }

  //Check return result
  //Can be DB_S_ / DB_E_ERRORSOCCURRED if notsupported property...
  if(FAILED(hr) && hr != DB_E_ERRORSOCCURRED)
    TESTC(hr);

  //Verify results
  ASSERTC(cPropSets==1 && rgPropSets!=NULL);
  ASSERTC(rgPropSets[0].cProperties==1 && rgPropSets[0].rgProperties!=NULL);
  ASSERTC(rgPropSets[0].rgProperties[0].dwPropertyID == dwPropertyID);

  //Return the property to the user
  *ppProperty = rgPropSets[0].rgProperties;

CLEANUP:
  //Just Free the outer Struct,
  //since we return the inner Property for the user to free
  SAFE_FREE(rgPropSets);
  return hr;
}

HRESULT GetProperty | ( | REFIID | riid,
 |  | IUnknown * | pIUnknown,
 |  | DBPROPID | dwPropertyID,
 |  | REFGUID | guidPropertySet,
 |  | DBTYPE | wType,
 |  | void * | pv
 | ) |  |

Definition at line 942 of file property.cpp.

{
  ASSERT(pv);
  HRESULT hr = S_OK;
  DBPROP* pProp = NULL;

  //Delegate
  hr = GetProperty(riid, pIUnknown, dwPropertyID, guidPropertySet, &pProp);

  //Put the value in the users buffer...
  if(SUCCEEDED(hr) && pProp)
  {
    //If the types are not what the user expected to receive then
    //we have to fail since pValue is of type wType.
    if(wType != pProp->vValue.vt)
    {
      //Free the property (since were not returning it to the user...)
      XTEST(hr = VariantClearFast(&pProp->vValue));
      TESTC(hr = E_INVALIDARG);
    }

    switch(wType)
    {
      case DBTYPE_BOOL:
        *(VARIANT_BOOL*)pv      = V_BOOL(&pProp->vValue);
        break;

      case DBTYPE_I2:
        *(SHORT*)pv         = V_I2(&pProp->vValue);
        break;

      case DBTYPE_I4:
        *(LONG*)pv          = V_I4(&pProp->vValue);
        break;

  #ifdef _WIN64
      case DBTYPE_I8:
  //TODO64: *(LONG_PTR*)pv        = V_I8(&pProp->vValue);
        *(LONG_PTR*)pv        = pProp->vValue.ullVal;
        break;
  #endif //_WIN64

      case DBTYPE_WSTR:
      case DBTYPE_BSTR:
        *(BSTR*)pv          = V_BSTR(&pProp->vValue);
        break;

      case DBTYPE_VARIANT:
        *(VARIANT*)pv       = pProp->vValue;  //Assignment
        break;

      default:
        ASSERT(FALSE); //Unhandled property type
        TESTC(hr = E_INVALIDARG);
        break;
    };
  }

CLEANUP:
  //NOTE: GetProperty returns a pointer to the DBPROP (rgProperties) which is allocated
  //and needs to be free'd.  But the actual value we passed directly to the user which
  //is required to free the value, but we need to the free the outer array
  SAFE_FREE(pProp);
  return hr;
}

HRESULT GetPropInfo | ( | IDBProperties * | pIDBProperties,
 |  | DBPROPID | dwPropertyID,
 |  | REFGUID | guidPropertySet,
 |  | DBPROPINFO ** | ppPropInfo
 | ) |  |

Definition at line 1013 of file property.cpp.

{
  if(ppPropInfo)
    *ppPropInfo = NULL;

  if(!pIDBProperties)
    return E_FAIL;

  HRESULT hr = S_OK;
  const ULONG cPropIDSets = 1;
  DBPROPIDSET rgPropIDSets[cPropIDSets];

  ULONG cPropInfoSets = 0;
  DBPROPINFOSET* rgPropInfoSets = NULL;

  //Construct the DBPROPIDSET structure
  rgPropIDSets[0].cPropertyIDs = 1;
  rgPropIDSets[0].rgPropertyIDs = &dwPropertyID;
  rgPropIDSets[0].guidPropertySet = guidPropertySet;

  //Don't display dialog if errors occurred.
  //Errors can occur if properties are not supported by the provider
  TESTC(hr = pIDBProperties->GetPropertyInfo(cPropIDSets,rgPropIDSets,&cPropInfoSets,&rgPropInfoSets,NULL));

CLEANUP:
  *ppPropInfo = rgPropInfoSets ? rgPropInfoSets[0].rgPropertyInfos  : NULL;
  SAFE_FREE(rgPropInfoSets);
  return hr;
}

DBPROPFLAGS GetPropInfoFlags | ( | IDBProperties * | pIDBProperties,
 |  | DBPROPID | dwPropertyID,
 |  | REFGUID | guidPropertySet
 | ) |  |

Definition at line 1048 of file property.cpp.

{
  if(!pIDBProperties)
    return 0;

  DBPROPINFO* pPropInfo = NULL;
  DBPROPFLAGS dwFlags = DBPROPFLAGS_NOTSUPPORTED;

  //GetPropInfo
  TESTC(GetPropInfo(pIDBProperties, dwPropertyID, guidPropertySet, &pPropInfo));
  if(pPropInfo)
  {
    dwFlags = pPropInfo->dwFlags;

    //Free the variant, could contain a safearray or similar...
    XTEST(VariantClearFast(&pPropInfo->vValues));
  }

CLEANUP:
  SAFE_FREE(pPropInfo);
  return dwFlags;
}

BOOL IsSettableProperty | ( | IDBProperties * | pIDBProperties,
 |  | DBPROPID | dwPropertyID,
 |  | REFGUID | guidPropertySet
 | ) |  |

Definition at line 1086 of file property.cpp.

{
  return GetPropInfoFlags(pIDBProperties, dwPropertyID, guidPropertySet) & DBPROPFLAGS_WRITE;
}

BOOL IsSupportedProperty | ( | IDBProperties * | pIDBProperties,
 |  | DBPROPID | dwPropertyID,
 |  | REFGUID | guidPropertySet
 | ) |  |

Definition at line 1076 of file property.cpp.

{
  return GetPropInfoFlags(pIDBProperties, dwPropertyID, guidPropertySet) != DBPROPFLAGS_NOTSUPPORTED;
}

HRESULT SetProperty | ( | DBPROPID | dwPropertyID,
 |  | REFGUID | guidPropertySet,
 |  | ULONG * | pcPropSets,
 |  | DBPROPSET ** | prgPropSets,
 |  | DBTYPE | wType,
 |  | void * | pv,
 |  | DBPROPOPTIONS | dwOptions = DBPROPOPTIONS_REQUIRED,
 |  | const DBID & | colid = DB_NULLID
 | ) |  |

Definition at line 1096 of file property.cpp.

{
  ASSERT(prgPropSets && pcPropSets);

  //The simplest Approach is to just use our class...
  CPropSets sCPropSets(*pcPropSets, *prgPropSets);

  //Delegate
  HRESULT hr = sCPropSets.SetProperty(dwPropertyID, guidPropertySet, wType, pv, dwOptions, colid);

  //Return the properties to the user and remove from static class...
  sCPropSets.Detach(pcPropSets, prgPropSets);
  return hr;
}

Generated on Wed Nov 13 2024 16:53:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/resource.h File Reference

  • Dataaccess
  • oledb
  • rowsetviewer
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | ID_MDICLIENT 102
#define | ID_MDIOBJECTS 138
#define | ID_MDITRACE 137
#define | ID_OBJECTTREE 139
#define | ID_STATUSBAR 101
#define | ID_TIMER 108
#define | ID_TOOLBAR 103
#define | ID_TREEVIEW 107
#define | IDB_ADD 4
#define | IDB_ADDCOL 1372
#define | IDB_ADDDEFINEDPROPS 1337
#define | IDB_ADDFKCOL 1380
#define | IDB_ADDSET 5
#define | IDB_ADTG 1360
#define | IDB_AGGREGATION 1342
#define | IDB_ALWAYSRELEASEROWS 1250
#define | IDB_AUTOSAVE 1344
#define | IDB_BIND_BOOKMARK 1209
#define | IDB_BIND_LENGTH 1321
#define | IDB_BIND_STATUS 1320
#define | IDB_BIND_VALUE 1322
#define | IDB_BLOB_ILOCKBYTES 1214
#define | IDB_BLOB_INLINE 1212
#define | IDB_BLOB_ISEQSTREAM 1213
#define | IDB_BLOB_ISTORAGE 1215
#define | IDB_BLOB_ISTREAM 1216
#define | IDB_BREAKID 1228
#define | IDB_BROWSE_DATASOURCE 1180
#define | IDB_BROWSE_INTEGRATED 1201
#define | IDB_BROWSE_LOCATION 1179
#define | IDB_BROWSE_PROVIDER 1272
#define | IDB_BROWSE_PROVSTRING 1202
#define | IDB_CACHEINFO 1155
#define | IDB_CASEINSENSITIVE 1299
#define | IDB_CASESENSITIVE 1298
#define | IDB_CLEARALL 1256
#define | IDB_COLPROP 1305
#define | IDB_CONFIG_REMOVE 1196
#define | IDB_CONFIG_SAVE 1195
#define | IDB_CONNECT 1200
#define | IDB_CURSORENGINE 1109
#define | IDB_DEFAULTFETCH 1339
#define | IDB_DEFAULTS 1178
#define | IDB_DELCOL 1373
#define | IDB_DELETE 6
#define | IDB_DELETESET 7
#define | IDB_DELFKCOL 1381
#define | IDB_DIRECTORY 1330
#define | IDB_DISPLAY_ADDREF 1213
#define | IDB_DISPLAY_HEXADECIMAL 1210
#define | IDB_DISPLAY_IDBASYNCHNOTIFY 1276
#define | IDB_DISPLAY_IROWPOSITIONCHANGE 1278
#define | IDB_DISPLAY_IROWSETNOTIFY 1277
#define | IDB_DISPLAY_OLEDB 1211
#define | IDB_DISPLAY_PROMPTVETO 1254
#define | IDB_DISPLAY_QI 1215
#define | IDB_DISPLAY_RELEASE 1214
#define | IDB_DISPLAY_ROWSAFFECTED 1243
#define | IDB_DISPLAYTREE 1191
#define | IDB_ENCRYPTINFO 1160
#define | IDB_ENCRYPTPASSWORD 1167
#define | IDB_ERRORINFO_ALWAYS 1218
#define | IDB_ERRORINFO_FAILURE 1219
#define | IDB_ERRORINFO_NEVER 1220
#define | IDB_EXISTING_DSO 1315
#define | IDB_FETCHDATA 1348
#define | IDB_FILENAME 1332
#define | IDB_FROM_ARRAY 1113
#define | IDB_FROM_BYREF 1112
#define | IDB_FROM_VECTOR 1114
#define | IDB_HIDDENCOLUMNS 1347
#define | IDB_HRESULT_ALWAYS 1221
#define | IDB_HRESULT_FAILURE 1222
#define | IDB_HRESULT_NEVER 1223
#define | IDB_HRESULT_NOERRORINFO 1251
#define | IDB_IMAGE 179
#define | IDB_IMALLOC_ALLOCS 1226
#define | IDB_IMALLOC_SPY 1225
#define | IDB_INDEXPROPERTIES 1302
#define | IDB_INIT_INITIALIZE 1129
#define | IDB_INIT_SETPROPERTIES 1128
#define | IDB_INPROC_HANDLER 1107
#define | IDB_INPROC_SERVER 1104
#define | IDB_LOCAL_SERVER 1105
#define | IDB_MASKPASSWORD 1166
#define | IDB_MOREPROPERTIES 1138
#define | IDB_MSDADC_ONLY 1356
#define | IDB_OPTIONS 3
#define | IDB_OUTPUT 1343
#define | IDB_OWNED_PROVIDER 1118
#define | IDB_PERSISTINFO 1159
#define | IDB_QI_MANDATORY 1130
#define | IDB_QI_OPTIONAL 1131
#define | IDB_REFCOUNT_FAILURE 1224
#define | IDB_RELEASE_OPENOBJECTS 1247
#define | IDB_REMOTE_SERVER 1106
#define | IDB_RESET 5
#define | IDB_ROWSETPROPERTIES 1299
#define | IDB_ROWSTOFETCH 1340
#define | IDB_SETCOMMANDNONE 1391
#define | IDB_SETCOMMANDSTREAM 1390
#define | IDB_SETCOMMANDTEXT 1280
#define | IDB_SETDEFAULTPROPS 1249
#define | IDB_SETPARAMS 1258
#define | IDB_SETPROPERTIES 1255
#define | IDB_SHOWSUPPORTED 1287
#define | IDB_STATE 177
#define | IDB_TABLEPROPERTIES 1384
#define | IDB_TEST 1182
#define | IDB_TO_ARRAY 1116
#define | IDB_TO_BYREF 1115
#define | IDB_TO_VECTOR 1117
#define | IDB_TOOLBAR 158
#define | IDB_UNICODE 1271
#define | IDB_USE_TRACEPROVIDER 1212
#define | IDB_USEOPTCOLUMNS 1109
#define | IDB_USEPARAMS 1257
#define | IDB_USEPROPERTIES 1108
#define | IDB_USERESTRICTIONS 1109
#define | IDB_USESERVICECOMP 1265
#define | IDB_XML 1359
#define | IDB_XML_BROWSER 1392
#define | IDB_XML_DOM 1394
#define | IDB_XML_EDITBOX 1395
#define | IDC_ADDCOL 1372
#define | IDC_ADDFKCOL 1380
#define | IDC_Aggregate 1314
#define | IDC_ASYNCH 1097
#define | IDC_BINDINGTYPE 1357
#define | IDC_CATALOG 1286
#define | IDC_ChangeIndexID 1383
#define | IDC_COLLIST 1370
#define | IDC_COLNAME 1371
#define | IDC_COLUMN 1260
#define | IDC_COLUMNS 1293
#define | IDC_COMBO1 1388
#define | IDC_COMPAREOP 1262
#define | IDC_CONFIG 1192
#define | IDC_CONSTYPE 1305
#define | IDC_COORDINATES 40325
#define | IDC_DATATYPE 1306
#define | IDC_DEFAULTDIALECT 1246
#define | IDC_DEFERRABILITY 1369
#define | IDC_DELCOL 1373
#define | IDC_DELETERULE 1376
#define | IDC_DELFKCOL 1381
#define | IDC_DIALECT 1246
#define | IDC_DIMENSIONS 40324
#define | IDC_EDITBOX 20
#define | IDC_FKCOLLIST 1378
#define | IDC_FKCOLNAME 1379
#define | IDC_FROMTYPE 1110
#define | IDC_IMPERSONATE 1161
#define | IDC_INTERFACE 1132
#define | IDC_INTERFACESTREAM 1133
#define | IDC_ISCO_FLAGS 1323
#define | IDC_ISOLEVEL 1095
#define | IDC_LCID 1133
#define | IDC_LISTBOX 1037
#define | IDC_LISTVIEW 1012
#define | IDC_LOCALE 1164
#define | IDC_MATCHTYPE 1374
#define | IDC_MDICHILD 290
#define | IDC_NAME 1119
#define | IDC_OBJECTTYPE 1294
#define | IDC_ORDER 1300
#define | IDC_PROMPT 1152
#define | IDC_PROPEDIT_OPTIONS 1083
#define | IDC_PROPEDIT_TYPE 1080
#define | IDC_PROPEDIT_VALUE 1079
#define | IDC_PROPSET 1266
#define | IDC_PROTECTION 1162
#define | IDC_PROVIDER 10
#define | IDC_RADIO_SETSTREAM 1390
#define | IDC_RADIO_SETTEXT 1389
#define | IDC_RECORD 1360
#define | IDC_REFIID 1388
#define | IDC_RESERVED 1133
#define | IDC_RESTRICTION1 1063
#define | IDC_RESTRICTION2 1068
#define | IDC_RESTRICTION3 1067
#define | IDC_RESTRICTION4 1069
#define | IDC_RESTRICTION5 1064
#define | IDC_RESTRICTION6 1066
#define | IDC_RESTRICTION7 1065
#define | IDC_RETAINING 1096
#define | IDC_SCHEMAS 1090
#define | IDC_SCROLLBAR 1038
#define | IDC_SPIN_COUNT 1283
#define | IDC_SPIN_OFFSET 1282
#define | IDC_STATIC -1
#define | IDC_TOTYPE 1111
#define | IDC_TRANSACTION 1292
#define | IDC_TREEVIEW 1186
#define | IDC_TYPE 1235
#define | IDC_TYPENAME 1304
#define | IDC_UPDATERULE 1375
#define | IDC_URLs 1324
#define | IDC_XACTTC 1099
#define | IDCOMBO_AXIS 40323
#define | IDD_ABOUT 80
#define | IDD_ADDCOLUMN 257
#define | IDD_ADDCONSTRAINTDESC 344
#define | IDD_AGGREGATION 325
#define | IDD_ALTERCOLUMN 348
#define | IDD_ALTERINDEX 346
#define | IDD_ALTERTABLE 347
#define | IDD_BINDRESOURCE 248
#define | IDD_BROWSE_ENUM 215
#define | IDD_CANCONVERT 196
#define | IDD_COMMANDPERSIST 333
#define | IDD_CREATEACCESSOR 238
#define | IDD_CREATEINDEX 259
#define | IDD_CREATETABLE 258
#define | IDD_DATAINIT_GETDATASOURCE 239
#define | IDD_DATASOURCEADMIN_CREATEDATASOURCE 244
#define | IDD_DROPCOLUMN 256
#define | IDD_DROPCONSTRAINT 345
#define | IDD_DROPINDEX 233
#define | IDD_DROPTABLE 234
#define | IDD_ERRORRECORDS 339
#define | IDD_EXECUTE 232
#define | IDD_FINDNEXTROW 235
#define | IDD_FULLCONNECT_OPTIONS 203
#define | IDD_FULLCONNECT_PROPERTIES 204
#define | IDD_FULLCONNECT_PROVIDER 60
#define | IDD_FULLCONNECT_SECURITY 205
#define | IDD_GETAXISINFO 243
#define | IDD_GETAXISROWSET 343
#define | IDD_GETCOLUMNSROWSET 230
#define | IDD_GETLISTVIEW 225
#define | IDD_GETNEXTROWS 245
#define | IDD_GETREFERENCEDROWSET 303
#define | IDD_GETSOURCESROWSET 231
#define | IDD_INTERFACE 198
#define | IDD_ISCO_COPY 302
#define | IDD_ISCO_DELETE 301
#define | IDD_MDICHILD 90
#define | IDD_MSPERSIST 338
#define | IDD_MULTIPLERESULTS 351
#define | IDD_OPENROWSET 229
#define | IDD_OPTIONS_ACCESSOR 300
#define | IDD_OPTIONS_COMMAND 228
#define | IDD_OPTIONS_ERRORS 224
#define | IDD_OPTIONS_NOTIFICATIONS 222
#define | IDD_OPTIONS_ROWSET 202
#define | IDD_PARAMEXECUTE 227
#define | IDD_PROMPTDATASOURCE 260
#define | IDD_PROMPTFILENAME 311
#define | IDD_PROVIDERINFO 206
#define | IDD_ROW_OPEN 247
#define | IDD_ROWCHANGE 131
#define | IDD_SCHEMAROWSET 170
#define | IDD_SCHEMATREEVIEW 208
#define | IDD_SETCOMMANDSTREAM 349
#define | IDD_SETCOMMANDTEXT 236
#define | IDD_SETPARAMETERINFO 226
#define | IDD_SETPROPERTIES 184
#define | IDD_SETVALUE 330
#define | IDD_SIMPLE_LISTBOX 332
#define | IDD_STREAM_VIEWER 342
#define | IDD_TRANSACTION_ABORT 194
#define | IDD_TRANSACTION_COMMIT 252
#define | IDD_TRANSACTION_GETINFO 254
#define | IDD_TRANSACTION_JOIN 251
#define | IDD_TRANSACTION_RELEASE 255
#define | IDD_TRANSACTION_SETOPTIONS 201
#define | IDD_TRANSACTION_START 193
#define | IDD_URLMAPPING 310
#define | IDE_BREAKID 1358
#define | IDE_COLNAME 1297
#define | IDE_COLUMN 1237
#define | IDE_COLUMNID 1303
#define | IDE_COMMANDID 1354
#define | IDE_COMMANDTEXT 1288
#define | IDE_CONSNAME 1377
#define | IDE_CONSTEXT 1235
#define | IDE_CONSTRAINTID 1382
#define | IDE_COUNT 1263
#define | IDE_DATA 1238
#define | IDE_DATASOURCE 1040
#define | IDE_DESCRIPTION 1135
#define | IDE_DIRECTORY 1329
#define | IDE_FILENAME 1331
#define | IDE_FKCOLNAME 1379
#define | IDE_INDEXID 1233
#define | IDE_INITSTRING 1349
#define | IDE_INTEGRATED 1158
#define | IDE_ISCO_DESTINATION 1304
#define | IDE_ISCO_SOURCE 1326
#define | IDE_LOCATION 31
#define | IDE_MAXLENGTH 1299
#define | IDE_NewIndexID 1234
#define | IDE_NewTableID 1385
#define | IDE_OFFSET 1285
#define | IDE_ORDINAL 1237
#define | IDE_PASSWORD 40
#define | IDE_PRECISION 1233
#define | IDE_PROPEDIT_NAME 1081
#define | IDE_PROPERTY_HELP 1082
#define | IDE_PROPINFO_FLAGS 1085
#define | IDE_PROPINFO_VALUE 1086
#define | IDE_PROVSTRING 42
#define | IDE_REFERENCEDTABLE 1233
#define | IDE_REMOTESERVER 1290
#define | IDE_RESTRICTION1 1050
#define | IDE_RESTRICTION2 1051
#define | IDE_RESTRICTION3 1053
#define | IDE_RESTRICTION4 1054
#define | IDE_RESTRICTION5 1055
#define | IDE_RESTRICTION6 1056
#define | IDE_RESTRICTION7 1052
#define | IDE_ROWSTOFETCH 1338
#define | IDE_SCALE 1234
#define | IDE_SIZE 1236
#define | IDE_TABLEID 1232
#define | IDE_TIMEOUT 1134
#define | IDE_URL 1295
#define | IDE_USERID 30
#define | IDE_VALUE 1261
#define | IDI_ABOUTICON 1203
#define | IDL_AXISINFO 40326
#define | IDL_BINDFLAGS 1296
#define | IDL_CDFLAGS 1386
#define | IDL_COLUMNDESC 1298
#define | IDL_COLUMNS 1267
#define | IDL_CONVFLAGS 1275
#define | IDL_FLAGS 1328
#define | IDL_INDEXCOLUMNDESC 1301
#define | IDL_LISTVIEW 1199
#define | IDL_MODE 1163
#define | IDL_NAMES 1094
#define | IDL_OPTIONS 1333
#define | IDL_PARAMNAMES 1240
#define | IDL_PARAMVALUES 1241
#define | IDL_PROPERTY 1077
#define | IDL_PROVIDERFILTER 1335
#define | IDL_TYPEFILTER 1334
#define | IDL_URLs 1327
#define | IDL_VALUES 1033
#define | IDM_ABOUT 280
#define | IDM_ACCESSOR_ADDREF 40555
#define | IDM_ADDREFROWS 40091
#define | IDM_ARRANGEICONS 240
#define | IDM_AUTOPOSITION 40923
#define | IDM_BINDER_ADDREF 40782
#define | IDM_BINDERMENU 320
#define | IDM_BINDING_VARIANT 40432
#define | IDM_BROWSE_ENUM 40551
#define | IDM_BROWSE_FILE 40550
#define | IDM_BROWSE_OPTION 212
#define | IDM_BROWSE_TABLENAME 40544
#define | IDM_CASCADE 230
#define | IDM_CHANGESTATUS 199
#define | IDM_CHANGEVALUE 223
#define | IDM_CHAPTERED_ADDREFCHAPTER 40635
#define | IDM_CHAPTERED_RELEASECHAPTER 40636
#define | IDM_CLEAREDITWINDOW 40471
#define | IDM_CLEARNOTIFYWINDOW 410
#define | IDM_CLOSEALL 250
#define | IDM_CLOSEWINDOW 40156
#define | IDM_COMMAND_ADDREF 40580
#define | IDM_COMMAND_CANCEL 40572
#define | IDM_COMMAND_CLEARCOMMAND 40507
#define | IDM_COMMAND_GETDBSESSION 40071
#define | IDM_COMMAND_GETPROPERTIES 40450
#define | IDM_COMMAND_SETPROPERTIES 40261
#define | IDM_COMMANDMENU 314
#define | IDM_COMMANDPERSIST_DELETECOMMAND 40925
#define | IDM_COMMANDPERSIST_GETCURRENTCOMMAND 40926
#define | IDM_COMMANDPERSIST_LOADCOMMAND 40927
#define | IDM_COMMANDPERSIST_SAVECOMMAND 40928
#define | IDM_COMMANDPREPARE 40462
#define | IDM_COMMANDTEXT_EXECUTE 40831
#define | IDM_COMMANDUNPREPARE 40463
#define | IDM_CONNECTIONPOINT_ADDREF 40972
#define | IDM_CONNECTIONPOINTMENU 335
#define | IDM_COPYEDITWINDOW 40698
#define | IDM_COPYNOTIFYWINDOW 40702
#define | IDM_COPYTEXT 40549
#define | IDM_CREATE_DATALINKS 40976
#define | IDM_CREATE_ROOTBINDER 40819
#define | IDM_CREATE_ROOTENUMERATOR 40974
#define | IDM_CREATE_ROWPOSITION 40981
#define | IDM_CREATE_SERVICECOMPONENTS 40973
#define | IDM_CREATEFILEMONIKER 40924
#define | IDM_CUSTOMERROR_ADDREF 40982
#define | IDM_CUSTOMERRORMENU 337
#define | IDM_CUTEDITWINDOW 40699
#define | IDM_DATALINKS_ADDREF 40975
#define | IDM_DATALINKSMENU 336
#define | IDM_DATASET_ADDREF 40882
#define | IDM_DATASET_FREEAXISINFO 40327
#define | IDM_DATASET_GETAXISINFO 40318
#define | IDM_DATASET_GETAXISROWSET 40319
#define | IDM_DATASET_GETCELLDATA 40320
#define | IDM_DATASET_GETNEXTAXISROW 40075
#define | IDM_DATASET_GETSPECIFICATION 40986
#define | IDM_DATASETMENU 317
#define | IDM_DATASOURCE_ADDREF 40573
#define | IDM_DATASOURCEMENU 312
#define | IDM_DBSTATUS_S_DEFAULT 40530
#define | IDM_DBSTATUS_S_IGNORE 40787
#define | IDM_DBSTATUS_S_ISNULL 40529
#define | IDM_DBSTATUS_S_OK 40528
#define | IDM_DELETEROWS 40103
#define | IDM_DISPLAY_HEX 40554
#define | IDM_DISPLAYALLERRORS 40166
#define | IDM_DISPLAYERRORINFO 40643
#define | IDM_EDITMENU 173
#define | IDM_ENUMERATOR 319
#define | IDM_ENUMERATOR_ADDREF 40589
#define | IDM_ENUMERATORMENU 319
#define | IDM_ERROR_ADDREF 40592
#define | IDM_ERRORINFO_GETDESCRIPTION 40611
#define | IDM_ERRORINFO_GETGUID 40612
#define | IDM_ERRORINFO_GETHELPCONTEXT 40613
#define | IDM_ERRORINFO_GETHELPFILE 40614
#define | IDM_ERRORINFO_GETSOURCE 40615
#define | IDM_ERRORMENU 315
#define | IDM_ERRORRECORDS 40163
#define | IDM_ERRORRECORDS_ADDERRORRECORD 40616
#define | IDM_ERRORRECORDS_GETBASICERRORINFO 40617
#define | IDM_ERRORRECORDS_GETCUSTOMERROROBJECT 40618
#define | IDM_ERRORRECORDS_GETERRORINFO 40619
#define | IDM_ERRORRECORDS_GETERRORPARAMETERS 40620
#define | IDM_ERRORRECORDS_GETRECORDCOUNT 40621
#define | IDM_EXECUTE 40070
#define | IDM_EXIT 40150
#define | IDM_FULLCONNECT 40503
#define | IDM_FULLDISCONNECT 40502
#define | IDM_GETCOMMANDSTREAM 40993
#define | IDM_GETCOMMANDTEXT 40074
#define | IDM_GETDATA 40092
#define | IDM_GETDATASOURCE 40282
#define | IDM_GETERRORINFO 40606
#define | IDM_GETLASTVISIBLEDATA 40826
#define | IDM_GETNEXTROWS 40093
#define | IDM_GETORIGINALDATA 40106
#define | IDM_GETPARAMETERINFO 40568
#define | IDM_GETPENDINGROWS 40107
#define | IDM_GETREFERENCEDROWSET 40448
#define | IDM_GETROWFROMHROW 40733
#define | IDM_GETROWSTATUS 40108
#define | IDM_GETSCHEMAROWSET 40454
#define | IDM_GETSCHEMAS 40111
#define | IDM_GETSPECIFICATION 40449
#define | IDM_GETURLFROMHROW 40734
#define | IDM_GETVISIBLEDATA 40477
#define | IDM_HELP 40013
#define | IDM_IACCESSOR_ADDREFACCESSOR 40562
#define | IDM_IACCESSOR_CREATEACCESSOR 40561
#define | IDM_IACCESSOR_GETBINDINGS 40560
#define | IDM_IACCESSOR_RELEASEACCESSOR 40563
#define | IDM_IBINDRESOURCE_BIND 40771
#define | IDM_ICOLUMNSINFO2_GETRESTRICTEDCOLUMNINFO 40751
#define | IDM_ICOLUMNSINFO_GETCOLUMNINFO 40464
#define | IDM_ICOLUMNSINFO_MAPCOLUMNIDS 40465
#define | IDM_ICOLUMNSROWSET_GETAVAILABLECOLUMNS 40160
#define | IDM_ICOLUMNSROWSET_GETCOLUMNSROWSET 40161
#define | IDM_ICONNECTIONPOINT_ADVISE 40651
#define | IDM_ICONNECTIONPOINT_ENUMCONNECTIONS 40653
#define | IDM_ICONNECTIONPOINT_GETCONNECTIONINTERFACE 40649
#define | IDM_ICONNECTIONPOINT_GETCONNECTIONPOINTCONTAINER 40650
#define | IDM_ICONNECTIONPOINT_UNADVISE 40652
#define | IDM_ICONVERTTYPE_CANCONVERT 40475
#define | IDM_ICPC_ENUMCONNECTIONPOINTS 40645
#define | IDM_ICPC_FINDCONNECTIONPOINT 40644
#define | IDM_ICREATEROW_CREATEROW 40773
#define | IDM_IDATAINITIALIZE_CREATEDBINSTANCE 40689
#define | IDM_IDATAINITIALIZE_CREATEDBINSTANCEEX 40690
#define | IDM_IDATAINITIALIZE_GETDATASOURCE 40691
#define | IDM_IDATAINITIALIZE_GETINITIALIZATIONSTRING 40692
#define | IDM_IDATAINITIALIZE_GETINITIALIZATIONSTRING_NOPASSWORD 40725
#define | IDM_IDATAINITIALIZE_LOADSTRINGFROMSTORAGE 40693
#define | IDM_IDATAINITIALIZE_WRITESTRINGTOSTORAGE 40697
#define | IDM_IDATASOURCEADMIN_CREATEDATASOURCE 40708
#define | IDM_IDATASOURCEADMIN_DESTROYDATASOURCE 40712
#define | IDM_IDATASOURCEADMIN_GETCREATIONPROPERTIES 40710
#define | IDM_IDATASOURCEADMIN_MODIFYDATASOURCE 40711
#define | IDM_IDBASYNCHNOTIFY_E_FAIL 40520
#define | IDM_IDBASYNCHNOTIFY_S_FALSE 40517
#define | IDM_IDBASYNCHNOTIFY_S_OK 40516
#define | IDM_IDBASYNCHNOTIFY_S_UNWANTEDPHASE 40518
#define | IDM_IDBASYNCHNOTIFY_S_UNWANTEDREASON 40519
#define | IDM_IDBASYNCHSTATUS_ABORT 40521
#define | IDM_IDBASYNCHSTATUS_GETSTATUS 40522
#define | IDM_IDBBINDERPROPERTIES_RESET 40777
#define | IDM_IDBCREATECOMMAND_CREATECOMMAND 40057
#define | IDM_IDBCREATESESSION_CREATESESSION 40149
#define | IDM_IDBINFO_GETKEYWORDS 40299
#define | IDM_IDBINFO_GETLITERALINFO 40300
#define | IDM_IDBINITIALIZE_INITIALIZE 40043
#define | IDM_IDBINITIALIZE_UNINITIALIZE 40044
#define | IDM_IDBPROMPTINITIALIZE_PROMPTDATASOURCE 40707
#define | IDM_IDBPROMPTINITIALIZE_PROMPTDATASOURCE_ADVANCED 40977
#define | IDM_IDBPROMPTINITIALIZE_PROMPTFILENAME 40696
#define | IDM_IDBPROMPTINITIALIZE_PROMPTFILENAME_ADVANCED 40979
#define | IDM_IDBPROPERTIES_GETPROPERTIES 40170
#define | IDM_IDBPROPERTIES_GETPROPERTYINFO 40169
#define | IDM_IDBPROPERTIES_SETPROPERTIES 40453
#define | IDM_IGETPOOL_GETPOOL 40918
#define | IDM_IGETPOOL_GETPOOLSTATE 40919
#define | IDM_IGETSESSION_GETSESSION 40756
#define | IDM_ILOCKBYTES_FLUSH 40861
#define | IDM_ILOCKBYTES_LOCKREGION 40863
#define | IDM_ILOCKBYTES_READAT 40859
#define | IDM_ILOCKBYTES_SETSIZE 40862
#define | IDM_ILOCKBYTES_STAT 40865
#define | IDM_ILOCKBYTES_UNLOCKREGION 40864
#define | IDM_ILOCKBYTES_WRITE 40860
#define | IDM_IMDFIND_FINDCELL 40983
#define | IDM_IMDFIND_FINDTUPEL 40984
#define | IDM_IMDRANGEROWSET_GETRANGEROWSET 40985
#define | IDM_IMULTIPLERESULTS_GETRESULT 40668
#define | IDM_INDEX_ALTERINDEX 40990
#define | IDM_INDEX_CREATEINDEX 40287
#define | IDM_INDEX_DROPINDEX 40288
#define | IDM_INSERTROW 40104
#define | IDM_INVALID 40162
#define | IDM_IPERSIST_GETCLASSID 40281
#define | IDM_IPERSISTFILE_GETCURFILE 40305
#define | IDM_IPERSISTFILE_ISDIRTY 40301
#define | IDM_IPERSISTFILE_LOAD 40302
#define | IDM_IPERSISTFILE_SAVE 40303
#define | IDM_IPERSISTFILE_SAVECOMPLETED 40304
#define | IDM_IPOOLINFO_GETCOUNT 40908
#define | IDM_IPOOLINFO_GETPOOLID 40915
#define | IDM_IPOOLINFO_GETPOOLTIMEOUT 40913
#define | IDM_IPOOLINFO_GETPROTOTYPE 40916
#define | IDM_IPOOLINFO_GETRETRYTIMEOUT 40914
#define | IDM_IPOOLINFO_REFRESH 40917
#define | IDM_IPOOLINFO_SETPOOLTIMEOUT 40912
#define | IDM_IPOOLINFO_SETRETRYTIMEOUT 40911
#define | IDM_IREGISTERPROVIDER_GETURLMAPPING 40779
#define | IDM_IREGISTERPROVIDER_SETURLMAPPING 40780
#define | IDM_IREGISTERPROVIDER_UNREGISTERPROVIDER 40781
#define | IDM_IROW_ADDCOLUMNS 40763
#define | IDM_IROW_DELETECOLUMNS 40762
#define | IDM_IROW_GETCOLUMNS 40752
#define | IDM_IROW_GETSOURCEROWSET 40754
#define | IDM_IROW_OPEN 40755
#define | IDM_IROW_SETCOLUMNS 40761
#define | IDM_IROWPOS_CLEARROWPOSITION 40434
#define | IDM_IROWPOS_GETROWPOSITION 40436
#define | IDM_IROWPOS_GETROWSET 40440
#define | IDM_IROWPOS_INITIALIZE 40439
#define | IDM_IROWPOS_SETROWPOSITION 40435
#define | IDM_IROWPOSITION_E_FAIL 40495
#define | IDM_IROWPOSITION_S_FALSE 40492
#define | IDM_IROWPOSITION_S_OK 40491
#define | IDM_IROWPOSITION_S_UNWANTEDPHASE 40498
#define | IDM_IROWPOSITION_S_UNWANTEDREASON 40499
#define | IDM_IROWSET_CURSORENGINE 40800
#define | IDM_IROWSET_GETPROPERTIES 40447
#define | IDM_IROWSETBOOKMARK_POSITIONONBOOKMARK 40996
#define | IDM_IROWSETFIND_FINDNEXTROW 40634
#define | IDM_IROWSETINDENTITY_ISSAMEROW 40631
#define | IDM_IROWSETLOCATE_COMPARE 40626
#define | IDM_IROWSETLOCATE_GETDATA 40829
#define | IDM_IROWSETLOCATE_GETROWSAT 40629
#define | IDM_IROWSETLOCATE_GETROWSBYBOOKMARK 40628
#define | IDM_IROWSETLOCATE_HASH 40630
#define | IDM_IROWSETNOTIFY_E_FAIL 40490
#define | IDM_IROWSETNOTIFY_S_FALSE 40487
#define | IDM_IROWSETNOTIFY_S_OK 40486
#define | IDM_IROWSETNOTIFY_S_UNWANTEDPHASE 40496
#define | IDM_IROWSETNOTIFY_S_UNWANTEDREASON 40497
#define | IDM_IROWSETPROPERTIES 40444
#define | IDM_IROWSETSCROLL_GETAPPROXIMATEPOSITION 40632
#define | IDM_IROWSETSCROLL_GETDATA 40830
#define | IDM_IROWSETSCROLL_GETROWSATRATIO 40633
#define | IDM_IROWSETVIEW_CREATEVIEW 40672
#define | IDM_IROWSETVIEW_GETVIEW 40673
#define | IDM_ISCOPEDOPERATIONS_COPY 40765
#define | IDM_ISCOPEDOPERATIONS_DELETE 40766
#define | IDM_ISCOPEDOPERATIONS_MOVE 40767
#define | IDM_ISCOPEDOPERATIONS_OPENROWSET 40768
#define | IDM_ISEQSTREAM_READ 40848
#define | IDM_ISEQSTREAM_WRITE 40849
#define | IDM_ISERVICEPROVIDER 40840
#define | IDM_ISESSIONPROPERTIES_GETPROPERTIES 40174
#define | IDM_ISESSIONPROPERTIES_SETPROPERTIES 40175
#define | IDM_ISOURCESROWSET_GETSOURCESROWSET 40117
#define | IDM_ISTREAM_CLONE 40858
#define | IDM_ISTREAM_COMMIT 40853
#define | IDM_ISTREAM_COPYTO 40852
#define | IDM_ISTREAM_LOCKREGION 40855
#define | IDM_ISTREAM_READ 40866
#define | IDM_ISTREAM_REVERT 40854
#define | IDM_ISTREAM_SEEK 40850
#define | IDM_ISTREAM_SETSIZE 40851
#define | IDM_ISTREAM_STAT 40857
#define | IDM_ISTREAM_UNLOCKREGION 40856
#define | IDM_ISTREAM_WRITE 40867
#define | IDM_ISUPPORTERRORINFO 40275
#define | IDM_ITRANSACTION_ABORT 40685
#define | IDM_ITRANSACTION_COMMIT 40686
#define | IDM_ITRANSACTION_GETTRANSACTIONINFO 40536
#define | IDM_ITRANSACTION_RELEASETRANSACTION 40726
#define | IDM_ITRANSACTIONDISPENSOR_BEGINTRANSACTION 40714
#define | IDM_ITRANSACTIONJOIN_GETOPTIONSOBJECT 40532
#define | IDM_ITRANSACTIONJOIN_JOINTRANSACTION 40533
#define | IDM_ITRANSACTIONJOIN_RELEASETRANSACTION 40971
#define | IDM_ITRANSACTIONLOCAL_GETOPTIONSOBJECT 40531
#define | IDM_ITRANSACTIONLOCAL_STARTTRANSACTION 40539
#define | IDM_ITRANSACTIONOBJECT_GETTRANSACTIONOBJECT 40272
#define | IDM_ITRANSACTIONOPTIONS_GETOPTIONS 40537
#define | IDM_ITRANSACTIONOPTIONS_SETOPTIONS 40538
#define | IDM_IUNKNOWN_AUTOQI 40869
#define | IDM_IUNKNOWN_QUERYINTERFACE 40575
#define | IDM_IUNKNOWN_RELEASE 40322
#define | IDM_IUNKNOWN_RELEASEALL 40509
#define | IDM_IUNKNOWN_RELEASECHILDREN 40995
#define | IDM_MAPPARAMETERNAMES 40569
#define | IDM_MSPERSIST_ROWSET_LOAD 40798
#define | IDM_MSPERSIST_ROWSET_SAVE 40797
#define | IDM_MULTIPLERESULTS_ADDREF 40675
#define | IDM_MULTIPLERESULTSMENU 321
#define | IDM_NEXTWINDOW 40157
#define | IDM_NOTIFY_E_FAIL 40796
#define | IDM_NOTIFY_S_FALSE 40793
#define | IDM_NOTIFY_S_OK 40792
#define | IDM_NOTIFY_S_UNWANTEDPHASE 40795
#define | IDM_NOTIFY_S_UNWANTEDREASON 40794
#define | IDM_NOTIFYMENU 175
#define | IDM_OBJECTSWINDOW 40833
#define | IDM_OPENROWSET 40056
#define | IDM_OPTIONS 40442
#define | IDM_PARSEDISPLAYNAME 40623
#define | IDM_PASTEEDITWINDOW 40700
#define | IDM_POOLINFO_ADDREF 40901
#define | IDM_POOLMENU 329
#define | IDM_POOLMNGR_ENUMPOOLS 40900
#define | IDM_POOLMNGR_REFRESH 40907
#define | IDM_PREVWINDOW 40158
#define | IDM_PROVIDERINFO 40542
#define | IDM_RECENTCONFIG1 111
#define | IDM_RECENTCONFIG10 120
#define | IDM_RECENTCONFIG2 112
#define | IDM_RECENTCONFIG3 113
#define | IDM_RECENTCONFIG4 114
#define | IDM_RECENTCONFIG5 115
#define | IDM_RECENTCONFIG6 116
#define | IDM_RECENTCONFIG7 117
#define | IDM_RECENTCONFIG8 118
#define | IDM_RECENTCONFIG9 119
#define | IDM_RECENTFILE1 121
#define | IDM_RECENTFILE10 130
#define | IDM_RECENTFILE2 122
#define | IDM_RECENTFILE3 123
#define | IDM_RECENTFILE4 124
#define | IDM_RECENTFILE5 125
#define | IDM_RECENTFILE6 126
#define | IDM_RECENTFILE7 127
#define | IDM_RECENTFILE8 128
#define | IDM_RECENTFILE9 129
#define | IDM_REFRESH 40015
#define | IDM_REFRESHVISIBLEDATA 40828
#define | IDM_RELEASE_JOINEDTRANSACTION 40970
#define | IDM_RELEASEALLROWS 40474
#define | IDM_RELEASEROWS 40094
#define | IDM_RESTARTPOSITION 40096
#define | IDM_RESYNCHROWS 40478
#define | IDM_ROW_ADDREF 40735
#define | IDM_ROWMENU 302
#define | IDM_ROWPOS_ADDREF 40595
#define | IDM_ROWPOSITIONMENU 316
#define | IDM_ROWSET_ADDREF 40583
#define | IDM_ROWSETMENU 172
#define | IDM_SERVICECOMP_ADDREF 40886
#define | IDM_SERVICECOMPMENU 323
#define | IDM_SESSION_ADDREF 40577
#define | IDM_SESSIONMENU 313
#define | IDM_SETCOMMANDSTREAM 40994
#define | IDM_SETCOMMANDTEXT 40073
#define | IDM_SETDATA 40105
#define | IDM_SETERRORINFO 40607
#define | IDM_SETPARAMETERINFO 40570
#define | IDM_SQLERRORINFO_GETSQLINFO 40622
#define | IDM_STREAM_ADDREF 40836
#define | IDM_STREAMMENU 322
#define | IDM_TABLE_ADDCOLUMN 40283
#define | IDM_TABLE_ADDCONSTRAINT 40987
#define | IDM_TABLE_ALTERCOLUMN 40992
#define | IDM_TABLE_ALTERTABLE 40991
#define | IDM_TABLE_CREATETABLE 40284
#define | IDM_TABLE_CREATETABLEWITHCONSTRAINTS 40988
#define | IDM_TABLE_DROPCOLUMN 40285
#define | IDM_TABLE_DROPCONSTRAINT 40989
#define | IDM_TABLE_DROPTABLE 40286
#define | IDM_TILEHORIZONTAL 220
#define | IDM_TILEVERTICAL 40155
#define | IDM_TRACEWINDOW 40832
#define | IDM_TRANSACTION_ADDREF 40586
#define | IDM_TRANSACTIONMENU 318
#define | IDM_TRANSACTIONOPTIONS_ADDREF 40966
#define | IDM_TRANSACTIONOPTIONSMENU 334
#define | IDM_TREESCHEMA 211
#define | IDM_UNDO 40109
#define | IDM_UNKNOWN_ADDREF 40843
#define | IDM_UNKNOWNMENU 324
#define | IDM_UPDATE 40110
#define | IDP_TABS 1393
#define | IDR_BROWSE_PROPERTY 331
#define | IDR_ROWSETVIEWER 100
#define | IDR_TRANSACTIONMENU 318
#define | IDT_CATALOG 1176
#define | IDT_COLUMNNAME 1190
#define | IDT_DATASOURCE 1175
#define | IDT_DBMS 1173
#define | IDT_FILEDESC 65535
#define | IDT_FILEINFO 65535
#define | IDT_HELPMSG 1125
#define | IDT_PROVIDERDESC 1170
#define | IDT_PROVIDERFILENAME 1169
#define | IDT_PROVIDERVERSION 1171
#define | IDT_READONLY 1178
#define | IDT_RESTRICTION1 1049
#define | IDT_RESTRICTION2 1057
#define | IDT_RESTRICTION3 1058
#define | IDT_RESTRICTION4 1059
#define | IDT_RESTRICTION5 1060
#define | IDT_RESTRICTION6 1061
#define | IDT_RESTRICTION7 1062
#define | IDT_RESULT 1119
#define | IDT_STATIC 1252
#define | IDT_STATIC10 1259
#define | IDT_STATIC11 1260
#define | IDT_STATIC2 1253
#define | IDT_STATIC3 1254
#define | IDT_STATIC4 1256
#define | IDT_STATIC5 1255
#define | IDT_STATIC6 1257
#define | IDT_STATIC7 1311
#define | IDT_STATIC8 1312
#define | IDT_STATIC9 1258
#define | IDT_THREADMODEL 1177
#define | IDT_VALUE 1345

Define Documentation

#define ID_MDICLIENT 102

Definition at line 22 of file resource.h.

#define ID_MDIOBJECTS 138

Definition at line 48 of file resource.h.

#define ID_MDITRACE 137

Definition at line 47 of file resource.h.

#define ID_OBJECTTREE 139

Definition at line 49 of file resource.h.

#define ID_STATUSBAR 101

Definition at line 21 of file resource.h.

#define ID_TIMER 108

Definition at line 25 of file resource.h.

#define ID_TOOLBAR 103

Definition at line 23 of file resource.h.

#define ID_TREEVIEW 107

Definition at line 24 of file resource.h.

#define IDB_ADD 4

Definition at line 6 of file resource.h.

#define IDB_ADDCOL 1372

Definition at line 398 of file resource.h.

#define IDB_ADDDEFINEDPROPS 1337

Definition at line 376 of file resource.h.

#define IDB_ADDFKCOL 1380

Definition at line 409 of file resource.h.

#define IDB_ADDSET 5

Definition at line 8 of file resource.h.

#define IDB_ADTG 1360

Definition at line 392 of file resource.h.

#define IDB_AGGREGATION 1342

Definition at line 380 of file resource.h.

#define IDB_ALWAYSRELEASEROWS 1250

Definition at line 300 of file resource.h.

#define IDB_AUTOSAVE 1344

Definition at line 382 of file resource.h.

#define IDB_BIND_BOOKMARK 1209

Definition at line 259 of file resource.h.

#define IDB_BIND_LENGTH 1321

Definition at line 362 of file resource.h.

#define IDB_BIND_STATUS 1320

Definition at line 361 of file resource.h.

#define IDB_BIND_VALUE 1322

Definition at line 363 of file resource.h.

#define IDB_BLOB_ILOCKBYTES 1214

Definition at line 267 of file resource.h.

#define IDB_BLOB_INLINE 1212

Definition at line 262 of file resource.h.

#define IDB_BLOB_ISEQSTREAM 1213

Definition at line 265 of file resource.h.

#define IDB_BLOB_ISTORAGE 1215

Definition at line 269 of file resource.h.

#define IDB_BLOB_ISTREAM 1216

Definition at line 270 of file resource.h.

#define IDB_BREAKID 1228

Definition at line 280 of file resource.h.

#define IDB_BROWSE_DATASOURCE 1180

Definition at line 246 of file resource.h.

#define IDB_BROWSE_INTEGRATED 1201

Definition at line 256 of file resource.h.

#define IDB_BROWSE_LOCATION 1179

Definition at line 245 of file resource.h.

#define IDB_BROWSE_PROVIDER 1272

Definition at line 324 of file resource.h.

#define IDB_BROWSE_PROVSTRING 1202

Definition at line 257 of file resource.h.

#define IDB_CACHEINFO 1155

Definition at line 226 of file resource.h.

#define IDB_CASEINSENSITIVE 1299

Definition at line 346 of file resource.h.

#define IDB_CASESENSITIVE 1298

Definition at line 344 of file resource.h.

#define IDB_CLEARALL 1256

Definition at line 308 of file resource.h.

#define IDB_COLPROP 1305

Definition at line 354 of file resource.h.

#define IDB_CONFIG_REMOVE 1196

Definition at line 253 of file resource.h.

#define IDB_CONFIG_SAVE 1195

Definition at line 252 of file resource.h.

#define IDB_CONNECT 1200

Definition at line 255 of file resource.h.

#define IDB_CURSORENGINE 1109

Definition at line 201 of file resource.h.

#define IDB_DEFAULTFETCH 1339

Definition at line 378 of file resource.h.

#define IDB_DEFAULTS 1178

Definition at line 243 of file resource.h.

#define IDB_DELCOL 1373

Definition at line 400 of file resource.h.

#define IDB_DELETE 6

Definition at line 9 of file resource.h.

#define IDB_DELETESET 7

Definition at line 10 of file resource.h.

#define IDB_DELFKCOL 1381

Definition at line 411 of file resource.h.

#define IDB_DIRECTORY 1330

Definition at line 370 of file resource.h.

#define IDB_DISPLAY_ADDREF 1213

Definition at line 264 of file resource.h.

#define IDB_DISPLAY_HEXADECIMAL 1210

Definition at line 260 of file resource.h.

#define IDB_DISPLAY_IDBASYNCHNOTIFY 1276

Definition at line 326 of file resource.h.

#define IDB_DISPLAY_IROWPOSITIONCHANGE 1278

Definition at line 328 of file resource.h.

#define IDB_DISPLAY_IROWSETNOTIFY 1277

Definition at line 327 of file resource.h.

#define IDB_DISPLAY_OLEDB 1211

Definition at line 261 of file resource.h.

#define IDB_DISPLAY_PROMPTVETO 1254

Definition at line 305 of file resource.h.

#define IDB_DISPLAY_QI 1215

Definition at line 268 of file resource.h.

#define IDB_DISPLAY_RELEASE 1214

Definition at line 266 of file resource.h.

#define IDB_DISPLAY_ROWSAFFECTED 1243

Definition at line 295 of file resource.h.

#define IDB_DISPLAYTREE 1191

Definition at line 250 of file resource.h.

#define IDB_ENCRYPTINFO 1160

Definition at line 229 of file resource.h.

#define IDB_ENCRYPTPASSWORD 1167

Definition at line 235 of file resource.h.

#define IDB_ERRORINFO_ALWAYS 1218

Definition at line 271 of file resource.h.

#define IDB_ERRORINFO_FAILURE 1219

Definition at line 272 of file resource.h.

#define IDB_ERRORINFO_NEVER 1220

Definition at line 273 of file resource.h.

#define IDB_EXISTING_DSO 1315

Definition at line 360 of file resource.h.

#define IDB_FETCHDATA 1348

Definition at line 385 of file resource.h.

#define IDB_FILENAME 1332

Definition at line 372 of file resource.h.

#define IDB_FROM_ARRAY 1113

Definition at line 205 of file resource.h.

#define IDB_FROM_BYREF 1112

Definition at line 204 of file resource.h.

#define IDB_FROM_VECTOR 1114

Definition at line 206 of file resource.h.

#define IDB_HIDDENCOLUMNS 1347

Definition at line 384 of file resource.h.

#define IDB_HRESULT_ALWAYS 1221

Definition at line 274 of file resource.h.

#define IDB_HRESULT_FAILURE 1222

Definition at line 275 of file resource.h.

#define IDB_HRESULT_NEVER 1223

Definition at line 276 of file resource.h.

#define IDB_HRESULT_NOERRORINFO 1251

Definition at line 301 of file resource.h.

#define IDB_IMAGE 179

Definition at line 56 of file resource.h.

#define IDB_IMALLOC_ALLOCS 1226

Definition at line 279 of file resource.h.

#define IDB_IMALLOC_SPY 1225

Definition at line 278 of file resource.h.

#define IDB_INDEXPROPERTIES 1302

Definition at line 350 of file resource.h.

#define IDB_INIT_INITIALIZE 1129

Definition at line 215 of file resource.h.

#define IDB_INIT_SETPROPERTIES 1128

Definition at line 214 of file resource.h.

#define IDB_INPROC_HANDLER 1107

Definition at line 197 of file resource.h.

#define IDB_INPROC_SERVER 1104

Definition at line 194 of file resource.h.

#define IDB_LOCAL_SERVER 1105

Definition at line 195 of file resource.h.

#define IDB_MASKPASSWORD 1166

Definition at line 234 of file resource.h.

#define IDB_MOREPROPERTIES 1138

Definition at line 224 of file resource.h.

#define IDB_MSDADC_ONLY 1356

Definition at line 388 of file resource.h.

#define IDB_OPTIONS 3

Definition at line 5 of file resource.h.

#define IDB_OUTPUT 1343

Definition at line 381 of file resource.h.

#define IDB_OWNED_PROVIDER 1118

Definition at line 210 of file resource.h.

#define IDB_PERSISTINFO 1159

Definition at line 228 of file resource.h.

#define IDB_QI_MANDATORY 1130

Definition at line 216 of file resource.h.

#define IDB_QI_OPTIONAL 1131

Definition at line 217 of file resource.h.

#define IDB_REFCOUNT_FAILURE 1224

Definition at line 277 of file resource.h.

#define IDB_RELEASE_OPENOBJECTS 1247

Definition at line 298 of file resource.h.

#define IDB_REMOTE_SERVER 1106

Definition at line 196 of file resource.h.

#define IDB_RESET 5

Definition at line 7 of file resource.h.

#define IDB_ROWSETPROPERTIES 1299

Definition at line 345 of file resource.h.

#define IDB_ROWSTOFETCH 1340

Definition at line 379 of file resource.h.

#define IDB_SETCOMMANDNONE 1391

Definition at line 422 of file resource.h.

#define IDB_SETCOMMANDSTREAM 1390

Definition at line 421 of file resource.h.

#define IDB_SETCOMMANDTEXT 1280

Definition at line 329 of file resource.h.

#define IDB_SETDEFAULTPROPS 1249

Definition at line 299 of file resource.h.

#define IDB_SETPARAMS 1258

Definition at line 312 of file resource.h.

#define IDB_SETPROPERTIES 1255

Definition at line 306 of file resource.h.

#define IDB_SHOWSUPPORTED 1287

Definition at line 334 of file resource.h.

#define IDB_STATE 177

Definition at line 55 of file resource.h.

#define IDB_TABLEPROPERTIES 1384

Definition at line 414 of file resource.h.

#define IDB_TEST 1182

Definition at line 247 of file resource.h.

#define IDB_TO_ARRAY 1116

Definition at line 208 of file resource.h.

#define IDB_TO_BYREF 1115

Definition at line 207 of file resource.h.

#define IDB_TO_VECTOR 1117

Definition at line 209 of file resource.h.

#define IDB_TOOLBAR 158

Definition at line 50 of file resource.h.

#define IDB_UNICODE 1271

Definition at line 323 of file resource.h.

#define IDB_USE_TRACEPROVIDER 1212

Definition at line 263 of file resource.h.

#define IDB_USEOPTCOLUMNS 1109

Definition at line 200 of file resource.h.

#define IDB_USEPARAMS 1257

Definition at line 310 of file resource.h.

#define IDB_USEPROPERTIES 1108

Definition at line 198 of file resource.h.

#define IDB_USERESTRICTIONS 1109

Definition at line 199 of file resource.h.

#define IDB_USESERVICECOMP 1265

Definition at line 320 of file resource.h.

#define IDB_XML 1359

Definition at line 391 of file resource.h.

#define IDB_XML_BROWSER 1392

Definition at line 423 of file resource.h.

#define IDB_XML_DOM 1394

Definition at line 425 of file resource.h.

#define IDB_XML_EDITBOX 1395

Definition at line 426 of file resource.h.

#define IDC_ADDCOL 1372

Definition at line 397 of file resource.h.

#define IDC_ADDFKCOL 1380

Definition at line 408 of file resource.h.

#define IDC_Aggregate 1314

Definition at line 359 of file resource.h.

#define IDC_ASYNCH 1097

Definition at line 192 of file resource.h.

#define IDC_BINDINGTYPE 1357

Definition at line 389 of file resource.h.

#define IDC_CATALOG 1286

Definition at line 333 of file resource.h.

#define IDC_ChangeIndexID 1383

Definition at line 413 of file resource.h.

#define IDC_COLLIST 1370

Definition at line 395 of file resource.h.

#define IDC_COLNAME 1371

Definition at line 396 of file resource.h.

#define IDC_COLUMN 1260

Definition at line 315 of file resource.h.

#define IDC_COLUMNS 1293

Definition at line 338 of file resource.h.

#define IDC_COMBO1 1388

Definition at line 417 of file resource.h.

#define IDC_COMPAREOP 1262

Definition at line 318 of file resource.h.

#define IDC_CONFIG 1192

Definition at line 251 of file resource.h.

#define IDC_CONSTYPE 1305

Definition at line 355 of file resource.h.

#define IDC_COORDINATES 40325

Definition at line 492 of file resource.h.

#define IDC_DATATYPE 1306

Definition at line 356 of file resource.h.

#define IDC_DEFAULTDIALECT 1246

Definition at line 296 of file resource.h.

#define IDC_DEFERRABILITY 1369

Definition at line 394 of file resource.h.

#define IDC_DELCOL 1373

Definition at line 399 of file resource.h.

#define IDC_DELETERULE 1376

Definition at line 403 of file resource.h.

#define IDC_DELFKCOL 1381

Definition at line 410 of file resource.h.

#define IDC_DIALECT 1246

Definition at line 297 of file resource.h.

#define IDC_DIMENSIONS 40324

Definition at line 491 of file resource.h.

#define IDC_EDITBOX 20

Definition at line 12 of file resource.h.

#define IDC_FKCOLLIST 1378

Definition at line 405 of file resource.h.

#define IDC_FKCOLNAME 1379

Definition at line 406 of file resource.h.

#define IDC_FROMTYPE 1110

Definition at line 202 of file resource.h.

#define IDC_IMPERSONATE 1161

Definition at line 230 of file resource.h.

#define IDC_INTERFACE 1132

Definition at line 218 of file resource.h.

#define IDC_INTERFACESTREAM 1133

Definition at line 220 of file resource.h.

#define IDC_ISCO_FLAGS 1323

Definition at line 364 of file resource.h.

#define IDC_ISOLEVEL 1095

Definition at line 190 of file resource.h.

#define IDC_LCID 1133

Definition at line 219 of file resource.h.

#define IDC_LISTBOX 1037

Definition at line 156 of file resource.h.

#define IDC_LISTVIEW 1012

Definition at line 154 of file resource.h.

#define IDC_LOCALE 1164

Definition at line 233 of file resource.h.

#define IDC_MATCHTYPE 1374

Definition at line 401 of file resource.h.

#define IDC_MDICHILD 290

Definition at line 109 of file resource.h.

#define IDC_NAME 1119

Definition at line 212 of file resource.h.

#define IDC_OBJECTTYPE 1294

Definition at line 339 of file resource.h.

#define IDC_ORDER 1300

Definition at line 348 of file resource.h.

#define IDC_PROMPT 1152

Definition at line 225 of file resource.h.

#define IDC_PROPEDIT_OPTIONS 1083

Definition at line 185 of file resource.h.

#define IDC_PROPEDIT_TYPE 1080

Definition at line 182 of file resource.h.

#define IDC_PROPEDIT_VALUE 1079

Definition at line 181 of file resource.h.

#define IDC_PROPSET 1266

Definition at line 321 of file resource.h.

#define IDC_PROTECTION 1162

Definition at line 231 of file resource.h.

#define IDC_PROVIDER 10

Definition at line 11 of file resource.h.

#define IDC_RADIO_SETSTREAM 1390

Definition at line 420 of file resource.h.

#define IDC_RADIO_SETTEXT 1389

Definition at line 419 of file resource.h.

#define IDC_RECORD 1360

Definition at line 393 of file resource.h.

#define IDC_REFIID 1388

Definition at line 418 of file resource.h.

#define IDC_RESERVED 1133

Definition at line 221 of file resource.h.

#define IDC_RESTRICTION1 1063

Definition at line 173 of file resource.h.

#define IDC_RESTRICTION2 1068

Definition at line 178 of file resource.h.

#define IDC_RESTRICTION3 1067

Definition at line 177 of file resource.h.

#define IDC_RESTRICTION4 1069

Definition at line 179 of file resource.h.

#define IDC_RESTRICTION5 1064

Definition at line 174 of file resource.h.

#define IDC_RESTRICTION6 1066

Definition at line 176 of file resource.h.

#define IDC_RESTRICTION7 1065

Definition at line 175 of file resource.h.

#define IDC_RETAINING 1096

Definition at line 191 of file resource.h.

#define IDC_SCHEMAS 1090

Definition at line 188 of file resource.h.

#define IDC_SCROLLBAR 1038

Definition at line 157 of file resource.h.

#define IDC_SPIN_COUNT 1283

Definition at line 331 of file resource.h.

#define IDC_SPIN_OFFSET 1282

Definition at line 330 of file resource.h.

#define IDC_STATIC -1

Definition at line 741 of file resource.h.

#define IDC_TOTYPE 1111

Definition at line 203 of file resource.h.

#define IDC_TRANSACTION 1292

Definition at line 337 of file resource.h.

#define IDC_TREEVIEW 1186

Definition at line 248 of file resource.h.

#define IDC_TYPE 1235

Definition at line 287 of file resource.h.

#define IDC_TYPENAME 1304

Definition at line 352 of file resource.h.

#define IDC_UPDATERULE 1375

Definition at line 402 of file resource.h.

#define IDC_URLs 1324

Definition at line 365 of file resource.h.

#define IDC_XACTTC 1099

Definition at line 193 of file resource.h.

#define IDCOMBO_AXIS 40323

Definition at line 490 of file resource.h.

#define IDD_ABOUT 80

Definition at line 18 of file resource.h.

#define IDD_ADDCOLUMN 257

Definition at line 104 of file resource.h.

#define IDD_ADDCONSTRAINTDESC 344

Definition at line 146 of file resource.h.

#define IDD_AGGREGATION 325

Definition at line 132 of file resource.h.

#define IDD_ALTERCOLUMN 348

Definition at line 150 of file resource.h.

#define IDD_ALTERINDEX 346

Definition at line 148 of file resource.h.

#define IDD_ALTERTABLE 347

Definition at line 149 of file resource.h.

#define IDD_BINDRESOURCE 248

Definition at line 97 of file resource.h.

#define IDD_BROWSE_ENUM 215

Definition at line 72 of file resource.h.

#define IDD_CANCONVERT 196

Definition at line 60 of file resource.h.

#define IDD_COMMANDPERSIST 333

Definition at line 137 of file resource.h.

#define IDD_CREATEACCESSOR 238

Definition at line 90 of file resource.h.

#define IDD_CREATEINDEX 259

Definition at line 106 of file resource.h.

#define IDD_CREATETABLE 258

Definition at line 105 of file resource.h.

#define IDD_DATAINIT_GETDATASOURCE 239

Definition at line 91 of file resource.h.

#define IDD_DATASOURCEADMIN_CREATEDATASOURCE 244

Definition at line 94 of file resource.h.

#define IDD_DROPCOLUMN 256

Definition at line 103 of file resource.h.

#define IDD_DROPCONSTRAINT 345

Definition at line 147 of file resource.h.

#define IDD_DROPINDEX 233

Definition at line 86 of file resource.h.

#define IDD_DROPTABLE 234

Definition at line 87 of file resource.h.

#define IDD_ERRORRECORDS 339

Definition at line 143 of file resource.h.

#define IDD_EXECUTE 232

Definition at line 85 of file resource.h.

#define IDD_FINDNEXTROW 235

Definition at line 88 of file resource.h.

#define IDD_FULLCONNECT_OPTIONS 203

Definition at line 65 of file resource.h.

#define IDD_FULLCONNECT_PROPERTIES 204

Definition at line 66 of file resource.h.

#define IDD_FULLCONNECT_PROVIDER 60

Definition at line 17 of file resource.h.

#define IDD_FULLCONNECT_SECURITY 205

Definition at line 67 of file resource.h.

#define IDD_GETAXISINFO 243

Definition at line 93 of file resource.h.

#define IDD_GETAXISROWSET 343

Definition at line 145 of file resource.h.

#define IDD_GETCOLUMNSROWSET 230

Definition at line 83 of file resource.h.

#define IDD_GETLISTVIEW 225

Definition at line 77 of file resource.h.

#define IDD_GETNEXTROWS 245

Definition at line 95 of file resource.h.

#define IDD_GETREFERENCEDROWSET 303

Definition at line 114 of file resource.h.

#define IDD_GETSOURCESROWSET 231

Definition at line 84 of file resource.h.

#define IDD_INTERFACE 198

Definition at line 61 of file resource.h.

#define IDD_ISCO_COPY 302

Definition at line 112 of file resource.h.

#define IDD_ISCO_DELETE 301

Definition at line 111 of file resource.h.

#define IDD_MDICHILD 90

Definition at line 19 of file resource.h.

#define IDD_MSPERSIST 338

Definition at line 142 of file resource.h.

#define IDD_MULTIPLERESULTS 351

Definition at line 152 of file resource.h.

#define IDD_OPENROWSET 229

Definition at line 81 of file resource.h.

#define IDD_OPTIONS_ACCESSOR 300

Definition at line 110 of file resource.h.

#define IDD_OPTIONS_COMMAND 228

Definition at line 80 of file resource.h.

#define IDD_OPTIONS_ERRORS 224

Definition at line 76 of file resource.h.

#define IDD_OPTIONS_NOTIFICATIONS 222

Definition at line 74 of file resource.h.

#define IDD_OPTIONS_ROWSET 202

Definition at line 64 of file resource.h.

#define IDD_PARAMEXECUTE 227

Definition at line 79 of file resource.h.

#define IDD_PROMPTDATASOURCE 260

Definition at line 107 of file resource.h.

#define IDD_PROMPTFILENAME 311

Definition at line 116 of file resource.h.

#define IDD_PROVIDERINFO 206

Definition at line 68 of file resource.h.

#define IDD_ROW_OPEN 247

Definition at line 96 of file resource.h.

#define IDD_ROWCHANGE 131

Definition at line 46 of file resource.h.

#define IDD_SCHEMAROWSET 170

Definition at line 51 of file resource.h.

#define IDD_SCHEMATREEVIEW 208

Definition at line 69 of file resource.h.

#define IDD_SETCOMMANDSTREAM 349

Definition at line 151 of file resource.h.

#define IDD_SETCOMMANDTEXT 236

Definition at line 89 of file resource.h.

#define IDD_SETPARAMETERINFO 226

Definition at line 78 of file resource.h.

#define IDD_SETPROPERTIES 184

Definition at line 57 of file resource.h.

#define IDD_SETVALUE 330

Definition at line 134 of file resource.h.

#define IDD_SIMPLE_LISTBOX 332

Definition at line 136 of file resource.h.

#define IDD_STREAM_VIEWER 342

Definition at line 144 of file resource.h.

#define IDD_TRANSACTION_ABORT 194

Definition at line 59 of file resource.h.

#define IDD_TRANSACTION_COMMIT 252

Definition at line 100 of file resource.h.

#define IDD_TRANSACTION_GETINFO 254

Definition at line 101 of file resource.h.

#define IDD_TRANSACTION_JOIN 251

Definition at line 99 of file resource.h.

#define IDD_TRANSACTION_RELEASE 255

Definition at line 102 of file resource.h.

#define IDD_TRANSACTION_SETOPTIONS 201

Definition at line 63 of file resource.h.

#define IDD_TRANSACTION_START 193

Definition at line 58 of file resource.h.

#define IDD_URLMAPPING 310

Definition at line 115 of file resource.h.

#define IDE_BREAKID 1358

Definition at line 390 of file resource.h.

#define IDE_COLNAME 1297

Definition at line 342 of file resource.h.

#define IDE_COLUMN 1237

Definition at line 291 of file resource.h.

#define IDE_COLUMNID 1303

Definition at line 351 of file resource.h.

#define IDE_COMMANDID 1354

Definition at line 387 of file resource.h.

#define IDE_COMMANDTEXT 1288

Definition at line 335 of file resource.h.

#define IDE_CONSNAME 1377

Definition at line 404 of file resource.h.

#define IDE_CONSTEXT 1235

Definition at line 288 of file resource.h.

#define IDE_CONSTRAINTID 1382

Definition at line 412 of file resource.h.

#define IDE_COUNT 1263

Definition at line 319 of file resource.h.

#define IDE_DATA 1238

Definition at line 292 of file resource.h.

#define IDE_DATASOURCE 1040

Definition at line 158 of file resource.h.

#define IDE_DESCRIPTION 1135

Definition at line 223 of file resource.h.

#define IDE_DIRECTORY 1329

Definition at line 369 of file resource.h.

#define IDE_FILENAME 1331

Definition at line 371 of file resource.h.

#define IDE_FKCOLNAME 1379

Definition at line 407 of file resource.h.

#define IDE_INDEXID 1233

Definition at line 283 of file resource.h.

#define IDE_INITSTRING 1349

Definition at line 386 of file resource.h.

#define IDE_INTEGRATED 1158

Definition at line 227 of file resource.h.

#define IDE_ISCO_DESTINATION 1304

Definition at line 353 of file resource.h.

#define IDE_ISCO_SOURCE 1326

Definition at line 366 of file resource.h.

#define IDE_LOCATION 31

Definition at line 14 of file resource.h.

#define IDE_MAXLENGTH 1299

Definition at line 347 of file resource.h.

#define IDE_NewIndexID 1234

Definition at line 286 of file resource.h.

#define IDE_NewTableID 1385

Definition at line 415 of file resource.h.

#define IDE_OFFSET 1285

Definition at line 332 of file resource.h.

#define IDE_ORDINAL 1237

Definition at line 290 of file resource.h.

#define IDE_PASSWORD 40

Definition at line 15 of file resource.h.

#define IDE_PRECISION 1233

Definition at line 282 of file resource.h.

#define IDE_PROPEDIT_NAME 1081

Definition at line 183 of file resource.h.

#define IDE_PROPERTY_HELP 1082

Definition at line 184 of file resource.h.

#define IDE_PROPINFO_FLAGS 1085

Definition at line 186 of file resource.h.

#define IDE_PROPINFO_VALUE 1086

Definition at line 187 of file resource.h.

#define IDE_PROVSTRING 42

Definition at line 16 of file resource.h.

#define IDE_REFERENCEDTABLE 1233

Definition at line 284 of file resource.h.

#define IDE_REMOTESERVER 1290

Definition at line 336 of file resource.h.

#define IDE_RESTRICTION1 1050

Definition at line 160 of file resource.h.

#define IDE_RESTRICTION2 1051

Definition at line 161 of file resource.h.

#define IDE_RESTRICTION3 1053

Definition at line 163 of file resource.h.

#define IDE_RESTRICTION4 1054

Definition at line 164 of file resource.h.

#define IDE_RESTRICTION5 1055

Definition at line 165 of file resource.h.

#define IDE_RESTRICTION6 1056

Definition at line 166 of file resource.h.

#define IDE_RESTRICTION7 1052

Definition at line 162 of file resource.h.

#define IDE_ROWSTOFETCH 1338

Definition at line 377 of file resource.h.

#define IDE_SCALE 1234

Definition at line 285 of file resource.h.

#define IDE_SIZE 1236

Definition at line 289 of file resource.h.

#define IDE_TABLEID 1232

Definition at line 281 of file resource.h.

#define IDE_TIMEOUT 1134

Definition at line 222 of file resource.h.

#define IDE_URL 1295

Definition at line 340 of file resource.h.

#define IDE_USERID 30

Definition at line 13 of file resource.h.

#define IDE_VALUE 1261

Definition at line 317 of file resource.h.

#define IDI_ABOUTICON 1203

Definition at line 258 of file resource.h.

#define IDL_AXISINFO 40326

Definition at line 493 of file resource.h.

#define IDL_BINDFLAGS 1296

Definition at line 341 of file resource.h.

#define IDL_CDFLAGS 1386

Definition at line 416 of file resource.h.

#define IDL_COLUMNDESC 1298

Definition at line 343 of file resource.h.

#define IDL_COLUMNS 1267

Definition at line 322 of file resource.h.

#define IDL_CONVFLAGS 1275

Definition at line 325 of file resource.h.

#define IDL_FLAGS 1328

Definition at line 368 of file resource.h.

#define IDL_INDEXCOLUMNDESC 1301

Definition at line 349 of file resource.h.

#define IDL_LISTVIEW 1199

Definition at line 254 of file resource.h.

#define IDL_MODE 1163

Definition at line 232 of file resource.h.

#define IDL_NAMES 1094

Definition at line 189 of file resource.h.

#define IDL_OPTIONS 1333

Definition at line 373 of file resource.h.

#define IDL_PARAMNAMES 1240

Definition at line 293 of file resource.h.

#define IDL_PARAMVALUES 1241

Definition at line 294 of file resource.h.

#define IDL_PROPERTY 1077

Definition at line 180 of file resource.h.

#define IDL_PROVIDERFILTER 1335

Definition at line 375 of file resource.h.

#define IDL_TYPEFILTER 1334

Definition at line 374 of file resource.h.

#define IDL_URLs 1327

Definition at line 367 of file resource.h.

#define IDL_VALUES 1033

Definition at line 155 of file resource.h.

#define IDM_ABOUT 280

Definition at line 108 of file resource.h.

#define IDM_ACCESSOR_ADDREF 40555

Definition at line 555 of file resource.h.

#define IDM_ADDREFROWS 40091

Definition at line 438 of file resource.h.

#define IDM_ARRANGEICONS 240

Definition at line 92 of file resource.h.

#define IDM_AUTOPOSITION 40923

Definition at line 709 of file resource.h.

#define IDM_BINDER_ADDREF 40782

Definition at line 652 of file resource.h.

#define IDM_BINDERMENU 320

Definition at line 127 of file resource.h.

#define IDM_BINDING_VARIANT 40432

Definition at line 495 of file resource.h.

#define IDM_BROWSE_ENUM 40551

Definition at line 553 of file resource.h.

#define IDM_BROWSE_FILE 40550

Definition at line 552 of file resource.h.

#define IDM_BROWSE_OPTION 212

Definition at line 71 of file resource.h.

#define IDM_BROWSE_TABLENAME 40544

Definition at line 550 of file resource.h.

#define IDM_CASCADE 230

Definition at line 82 of file resource.h.

#define IDM_CHANGESTATUS 199

Definition at line 62 of file resource.h.

#define IDM_CHANGEVALUE 223

Definition at line 75 of file resource.h.

#define IDM_CHAPTERED_ADDREFCHAPTER 40635

Definition at line 596 of file resource.h.

#define IDM_CHAPTERED_RELEASECHAPTER 40636

Definition at line 597 of file resource.h.

#define IDM_CLEAREDITWINDOW 40471

Definition at line 513 of file resource.h.

#define IDM_CLEARNOTIFYWINDOW 410

Definition at line 153 of file resource.h.

#define IDM_CLOSEALL 250

Definition at line 98 of file resource.h.

#define IDM_CLOSEWINDOW 40156

Definition at line 456 of file resource.h.

#define IDM_COMMAND_ADDREF 40580

Definition at line 567 of file resource.h.

#define IDM_COMMAND_CANCEL 40572

Definition at line 563 of file resource.h.

#define IDM_COMMAND_CLEARCOMMAND 40507

Definition at line 530 of file resource.h.

#define IDM_COMMAND_GETDBSESSION 40071

Definition at line 434 of file resource.h.

#define IDM_COMMAND_GETPROPERTIES 40450

Definition at line 506 of file resource.h.

#define IDM_COMMAND_SETPROPERTIES 40261

Definition at line 468 of file resource.h.

#define IDM_COMMANDMENU 314

Definition at line 119 of file resource.h.

#define IDM_COMMANDPERSIST_DELETECOMMAND 40925

Definition at line 711 of file resource.h.

#define IDM_COMMANDPERSIST_GETCURRENTCOMMAND 40926

Definition at line 712 of file resource.h.

#define IDM_COMMANDPERSIST_LOADCOMMAND 40927

Definition at line 713 of file resource.h.

#define IDM_COMMANDPERSIST_SAVECOMMAND 40928

Definition at line 714 of file resource.h.

#define IDM_COMMANDPREPARE 40462

Definition at line 509 of file resource.h.

#define IDM_COMMANDTEXT_EXECUTE 40831

Definition at line 667 of file resource.h.

#define IDM_COMMANDUNPREPARE 40463

Definition at line 510 of file resource.h.

#define IDM_CONNECTIONPOINT_ADDREF 40972

Definition at line 718 of file resource.h.

#define IDM_CONNECTIONPOINTMENU 335

Definition at line 139 of file resource.h.

#define IDM_COPYEDITWINDOW 40698

Definition at line 619 of file resource.h.

#define IDM_COPYNOTIFYWINDOW 40702

Definition at line 622 of file resource.h.

#define IDM_COPYTEXT 40549

Definition at line 551 of file resource.h.

#define IDM_CREATE_DATALINKS 40976

Definition at line 722 of file resource.h.

#define IDM_CREATE_ROOTBINDER 40819

Definition at line 662 of file resource.h.

#define IDM_CREATE_ROOTENUMERATOR 40974

Definition at line 720 of file resource.h.

#define IDM_CREATE_ROWPOSITION 40981

Definition at line 725 of file resource.h.

#define IDM_CREATE_SERVICECOMPONENTS 40973

Definition at line 719 of file resource.h.

#define IDM_CREATEFILEMONIKER 40924

Definition at line 710 of file resource.h.

#define IDM_CUSTOMERROR_ADDREF 40982

Definition at line 726 of file resource.h.

#define IDM_CUSTOMERRORMENU 337

Definition at line 141 of file resource.h.

#define IDM_CUTEDITWINDOW 40699

Definition at line 620 of file resource.h.

#define IDM_DATALINKS_ADDREF 40975

Definition at line 721 of file resource.h.

#define IDM_DATALINKSMENU 336

Definition at line 140 of file resource.h.

#define IDM_DATASET_ADDREF 40882

Definition at line 694 of file resource.h.

#define IDM_DATASET_FREEAXISINFO 40327

Definition at line 494 of file resource.h.

#define IDM_DATASET_GETAXISINFO 40318

Definition at line 486 of file resource.h.

#define IDM_DATASET_GETAXISROWSET 40319

Definition at line 487 of file resource.h.

#define IDM_DATASET_GETCELLDATA 40320

Definition at line 488 of file resource.h.

#define IDM_DATASET_GETNEXTAXISROW 40075

Definition at line 437 of file resource.h.

#define IDM_DATASET_GETSPECIFICATION 40986

Definition at line 730 of file resource.h.

#define IDM_DATASETMENU 317

Definition at line 122 of file resource.h.

#define IDM_DATASOURCE_ADDREF 40573

Definition at line 564 of file resource.h.

#define IDM_DATASOURCEMENU 312

Definition at line 117 of file resource.h.

#define IDM_DBSTATUS_S_DEFAULT 40530

Definition at line 541 of file resource.h.

#define IDM_DBSTATUS_S_IGNORE 40787

Definition at line 653 of file resource.h.

#define IDM_DBSTATUS_S_ISNULL 40529

Definition at line 540 of file resource.h.

#define IDM_DBSTATUS_S_OK 40528

Definition at line 539 of file resource.h.

#define IDM_DELETEROWS 40103

Definition at line 443 of file resource.h.

#define IDM_DISPLAY_HEX 40554

Definition at line 554 of file resource.h.

#define IDM_DISPLAYALLERRORS 40166

Definition at line 463 of file resource.h.

#define IDM_DISPLAYERRORINFO 40643

Definition at line 598 of file resource.h.

#define IDM_EDITMENU 173

Definition at line 53 of file resource.h.

#define IDM_ENUMERATOR 319

Definition at line 125 of file resource.h.

#define IDM_ENUMERATOR_ADDREF 40589

Definition at line 570 of file resource.h.

#define IDM_ENUMERATORMENU 319

Definition at line 126 of file resource.h.

#define IDM_ERROR_ADDREF 40592

Definition at line 571 of file resource.h.

#define IDM_ERRORINFO_GETDESCRIPTION 40611

Definition at line 575 of file resource.h.

#define IDM_ERRORINFO_GETGUID 40612

Definition at line 576 of file resource.h.

#define IDM_ERRORINFO_GETHELPCONTEXT 40613

Definition at line 577 of file resource.h.

#define IDM_ERRORINFO_GETHELPFILE 40614

Definition at line 578 of file resource.h.

#define IDM_ERRORINFO_GETSOURCE 40615

Definition at line 579 of file resource.h.

#define IDM_ERRORMENU 315

Definition at line 120 of file resource.h.

#define IDM_ERRORRECORDS 40163

Definition at line 462 of file resource.h.

#define IDM_ERRORRECORDS_ADDERRORRECORD 40616

Definition at line 580 of file resource.h.

#define IDM_ERRORRECORDS_GETBASICERRORINFO 40617

Definition at line 581 of file resource.h.

#define IDM_ERRORRECORDS_GETCUSTOMERROROBJECT 40618

Definition at line 582 of file resource.h.

#define IDM_ERRORRECORDS_GETERRORINFO 40619

Definition at line 583 of file resource.h.

#define IDM_ERRORRECORDS_GETERRORPARAMETERS 40620

Definition at line 584 of file resource.h.

#define IDM_ERRORRECORDS_GETRECORDCOUNT 40621

Definition at line 585 of file resource.h.

#define IDM_EXECUTE 40070

Definition at line 433 of file resource.h.

#define IDM_EXIT 40150

Definition at line 454 of file resource.h.

#define IDM_FULLCONNECT 40503

Definition at line 529 of file resource.h.

#define IDM_FULLDISCONNECT 40502

Definition at line 528 of file resource.h.

#define IDM_GETCOMMANDSTREAM 40993

Definition at line 737 of file resource.h.

#define IDM_GETCOMMANDTEXT 40074

Definition at line 436 of file resource.h.

#define IDM_GETDATA 40092

Definition at line 439 of file resource.h.

#define IDM_GETDATASOURCE 40282

Definition at line 472 of file resource.h.

#define IDM_GETERRORINFO 40606

Definition at line 573 of file resource.h.

#define IDM_GETLASTVISIBLEDATA 40826

Definition at line 663 of file resource.h.

#define IDM_GETNEXTROWS 40093

Definition at line 440 of file resource.h.

#define IDM_GETORIGINALDATA 40106

Definition at line 446 of file resource.h.

#define IDM_GETPARAMETERINFO 40568

Definition at line 560 of file resource.h.

#define IDM_GETPENDINGROWS 40107

Definition at line 447 of file resource.h.

#define IDM_GETREFERENCEDROWSET 40448

Definition at line 504 of file resource.h.

#define IDM_GETROWFROMHROW 40733

Definition at line 631 of file resource.h.

#define IDM_GETROWSTATUS 40108

Definition at line 448 of file resource.h.

#define IDM_GETSCHEMAROWSET 40454

Definition at line 508 of file resource.h.

#define IDM_GETSCHEMAS 40111

Definition at line 451 of file resource.h.

#define IDM_GETSPECIFICATION 40449

Definition at line 505 of file resource.h.

#define IDM_GETURLFROMHROW 40734

Definition at line 632 of file resource.h.

#define IDM_GETVISIBLEDATA 40477

Definition at line 516 of file resource.h.

#define IDM_HELP 40013

Definition at line 427 of file resource.h.

#define IDM_IACCESSOR_ADDREFACCESSOR 40562

Definition at line 558 of file resource.h.

#define IDM_IACCESSOR_CREATEACCESSOR 40561

Definition at line 557 of file resource.h.

#define IDM_IACCESSOR_GETBINDINGS 40560

Definition at line 556 of file resource.h.

#define IDM_IACCESSOR_RELEASEACCESSOR 40563

Definition at line 559 of file resource.h.

#define IDM_IBINDRESOURCE_BIND 40771

Definition at line 646 of file resource.h.

#define IDM_ICOLUMNSINFO2_GETRESTRICTEDCOLUMNINFO 40751

Definition at line 634 of file resource.h.

#define IDM_ICOLUMNSINFO_GETCOLUMNINFO 40464

Definition at line 511 of file resource.h.

#define IDM_ICOLUMNSINFO_MAPCOLUMNIDS 40465

Definition at line 512 of file resource.h.

#define IDM_ICOLUMNSROWSET_GETAVAILABLECOLUMNS 40160

Definition at line 459 of file resource.h.

#define IDM_ICOLUMNSROWSET_GETCOLUMNSROWSET 40161

Definition at line 460 of file resource.h.

#define IDM_ICONNECTIONPOINT_ADVISE 40651

Definition at line 603 of file resource.h.

#define IDM_ICONNECTIONPOINT_ENUMCONNECTIONS 40653

Definition at line 605 of file resource.h.

#define IDM_ICONNECTIONPOINT_GETCONNECTIONINTERFACE 40649

Definition at line 601 of file resource.h.

#define IDM_ICONNECTIONPOINT_GETCONNECTIONPOINTCONTAINER 40650

Definition at line 602 of file resource.h.

#define IDM_ICONNECTIONPOINT_UNADVISE 40652

Definition at line 604 of file resource.h.

#define IDM_ICONVERTTYPE_CANCONVERT 40475

Definition at line 515 of file resource.h.

#define IDM_ICPC_ENUMCONNECTIONPOINTS 40645

Definition at line 600 of file resource.h.

#define IDM_ICPC_FINDCONNECTIONPOINT 40644

Definition at line 599 of file resource.h.

#define IDM_ICREATEROW_CREATEROW 40773

Definition at line 647 of file resource.h.

#define IDM_IDATAINITIALIZE_CREATEDBINSTANCE 40689

Definition at line 612 of file resource.h.

#define IDM_IDATAINITIALIZE_CREATEDBINSTANCEEX 40690

Definition at line 613 of file resource.h.

#define IDM_IDATAINITIALIZE_GETDATASOURCE 40691

Definition at line 614 of file resource.h.

#define IDM_IDATAINITIALIZE_GETINITIALIZATIONSTRING 40692

Definition at line 615 of file resource.h.

#define IDM_IDATAINITIALIZE_GETINITIALIZATIONSTRING_NOPASSWORD 40725

Definition at line 629 of file resource.h.

#define IDM_IDATAINITIALIZE_LOADSTRINGFROMSTORAGE 40693

Definition at line 616 of file resource.h.

#define IDM_IDATAINITIALIZE_WRITESTRINGTOSTORAGE 40697

Definition at line 618 of file resource.h.

#define IDM_IDATASOURCEADMIN_CREATEDATASOURCE 40708

Definition at line 624 of file resource.h.

#define IDM_IDATASOURCEADMIN_DESTROYDATASOURCE 40712

Definition at line 627 of file resource.h.

#define IDM_IDATASOURCEADMIN_GETCREATIONPROPERTIES 40710

Definition at line 625 of file resource.h.

#define IDM_IDATASOURCEADMIN_MODIFYDATASOURCE 40711

Definition at line 626 of file resource.h.

#define IDM_IDBASYNCHNOTIFY_E_FAIL 40520

Definition at line 536 of file resource.h.

#define IDM_IDBASYNCHNOTIFY_S_FALSE 40517

Definition at line 533 of file resource.h.

#define IDM_IDBASYNCHNOTIFY_S_OK 40516

Definition at line 532 of file resource.h.

#define IDM_IDBASYNCHNOTIFY_S_UNWANTEDPHASE 40518

Definition at line 534 of file resource.h.

#define IDM_IDBASYNCHNOTIFY_S_UNWANTEDREASON 40519

Definition at line 535 of file resource.h.

#define IDM_IDBASYNCHSTATUS_ABORT 40521

Definition at line 537 of file resource.h.

#define IDM_IDBASYNCHSTATUS_GETSTATUS 40522

Definition at line 538 of file resource.h.

#define IDM_IDBBINDERPROPERTIES_RESET 40777

Definition at line 648 of file resource.h.

#define IDM_IDBCREATECOMMAND_CREATECOMMAND 40057

Definition at line 432 of file resource.h.

#define IDM_IDBCREATESESSION_CREATESESSION 40149

Definition at line 453 of file resource.h.

#define IDM_IDBINFO_GETKEYWORDS 40299

Definition at line 479 of file resource.h.

#define IDM_IDBINFO_GETLITERALINFO 40300

Definition at line 480 of file resource.h.

#define IDM_IDBINITIALIZE_INITIALIZE 40043

Definition at line 429 of file resource.h.

#define IDM_IDBINITIALIZE_UNINITIALIZE 40044

Definition at line 430 of file resource.h.

#define IDM_IDBPROMPTINITIALIZE_PROMPTDATASOURCE 40707

Definition at line 623 of file resource.h.

#define IDM_IDBPROMPTINITIALIZE_PROMPTDATASOURCE_ADVANCED 40977

Definition at line 723 of file resource.h.

#define IDM_IDBPROMPTINITIALIZE_PROMPTFILENAME 40696

Definition at line 617 of file resource.h.

#define IDM_IDBPROMPTINITIALIZE_PROMPTFILENAME_ADVANCED 40979

Definition at line 724 of file resource.h.

#define IDM_IDBPROPERTIES_GETPROPERTIES 40170

Definition at line 465 of file resource.h.

#define IDM_IDBPROPERTIES_GETPROPERTYINFO 40169

Definition at line 464 of file resource.h.

#define IDM_IDBPROPERTIES_SETPROPERTIES 40453

Definition at line 507 of file resource.h.

#define IDM_IGETPOOL_GETPOOL 40918

Definition at line 707 of file resource.h.

#define IDM_IGETPOOL_GETPOOLSTATE 40919

Definition at line 708 of file resource.h.

#define IDM_IGETSESSION_GETSESSION 40756

Definition at line 638 of file resource.h.

#define IDM_ILOCKBYTES_FLUSH 40861

Definition at line 686 of file resource.h.

#define IDM_ILOCKBYTES_LOCKREGION 40863

Definition at line 688 of file resource.h.

#define IDM_ILOCKBYTES_READAT 40859

Definition at line 684 of file resource.h.

#define IDM_ILOCKBYTES_SETSIZE 40862

Definition at line 687 of file resource.h.

#define IDM_ILOCKBYTES_STAT 40865

Definition at line 690 of file resource.h.

#define IDM_ILOCKBYTES_UNLOCKREGION 40864

Definition at line 689 of file resource.h.

#define IDM_ILOCKBYTES_WRITE 40860

Definition at line 685 of file resource.h.

#define IDM_IMDFIND_FINDCELL 40983

Definition at line 727 of file resource.h.

#define IDM_IMDFIND_FINDTUPEL 40984

Definition at line 728 of file resource.h.

#define IDM_IMDRANGEROWSET_GETRANGEROWSET 40985

Definition at line 729 of file resource.h.

#define IDM_IMULTIPLERESULTS_GETRESULT 40668

Definition at line 606 of file resource.h.

#define IDM_INDEX_ALTERINDEX 40990

Definition at line 734 of file resource.h.

#define IDM_INDEX_CREATEINDEX 40287

Definition at line 477 of file resource.h.

#define IDM_INDEX_DROPINDEX 40288

Definition at line 478 of file resource.h.

#define IDM_INSERTROW 40104

Definition at line 444 of file resource.h.

#define IDM_INVALID 40162

Definition at line 461 of file resource.h.

#define IDM_IPERSIST_GETCLASSID 40281

Definition at line 471 of file resource.h.

#define IDM_IPERSISTFILE_GETCURFILE 40305

Definition at line 485 of file resource.h.

#define IDM_IPERSISTFILE_ISDIRTY 40301

Definition at line 481 of file resource.h.

#define IDM_IPERSISTFILE_LOAD 40302

Definition at line 482 of file resource.h.

#define IDM_IPERSISTFILE_SAVE 40303

Definition at line 483 of file resource.h.

#define IDM_IPERSISTFILE_SAVECOMPLETED 40304

Definition at line 484 of file resource.h.

#define IDM_IPOOLINFO_GETCOUNT 40908

Definition at line 699 of file resource.h.

#define IDM_IPOOLINFO_GETPOOLID 40915

Definition at line 704 of file resource.h.

#define IDM_IPOOLINFO_GETPOOLTIMEOUT 40913

Definition at line 702 of file resource.h.

#define IDM_IPOOLINFO_GETPROTOTYPE 40916

Definition at line 705 of file resource.h.

#define IDM_IPOOLINFO_GETRETRYTIMEOUT 40914

Definition at line 703 of file resource.h.

#define IDM_IPOOLINFO_REFRESH 40917

Definition at line 706 of file resource.h.

#define IDM_IPOOLINFO_SETPOOLTIMEOUT 40912

Definition at line 701 of file resource.h.

#define IDM_IPOOLINFO_SETRETRYTIMEOUT 40911

Definition at line 700 of file resource.h.

#define IDM_IREGISTERPROVIDER_GETURLMAPPING 40779

Definition at line 649 of file resource.h.

#define IDM_IREGISTERPROVIDER_SETURLMAPPING 40780

Definition at line 650 of file resource.h.

#define IDM_IREGISTERPROVIDER_UNREGISTERPROVIDER 40781

Definition at line 651 of file resource.h.

#define IDM_IROW_ADDCOLUMNS 40763

Definition at line 641 of file resource.h.

#define IDM_IROW_DELETECOLUMNS 40762

Definition at line 640 of file resource.h.

#define IDM_IROW_GETCOLUMNS 40752

Definition at line 635 of file resource.h.

#define IDM_IROW_GETSOURCEROWSET 40754

Definition at line 636 of file resource.h.

#define IDM_IROW_OPEN 40755

Definition at line 637 of file resource.h.

#define IDM_IROW_SETCOLUMNS 40761

Definition at line 639 of file resource.h.

#define IDM_IROWPOS_CLEARROWPOSITION 40434

Definition at line 496 of file resource.h.

#define IDM_IROWPOS_GETROWPOSITION 40436

Definition at line 498 of file resource.h.

#define IDM_IROWPOS_GETROWSET 40440

Definition at line 500 of file resource.h.

#define IDM_IROWPOS_INITIALIZE 40439

Definition at line 499 of file resource.h.

#define IDM_IROWPOS_SETROWPOSITION 40435

Definition at line 497 of file resource.h.

#define IDM_IROWPOSITION_E_FAIL 40495

Definition at line 523 of file resource.h.

#define IDM_IROWPOSITION_S_FALSE 40492

Definition at line 522 of file resource.h.

#define IDM_IROWPOSITION_S_OK 40491

Definition at line 521 of file resource.h.

#define IDM_IROWPOSITION_S_UNWANTEDPHASE 40498

Definition at line 526 of file resource.h.

#define IDM_IROWPOSITION_S_UNWANTEDREASON 40499

Definition at line 527 of file resource.h.

#define IDM_IROWSET_CURSORENGINE 40800

Definition at line 661 of file resource.h.

#define IDM_IROWSET_GETPROPERTIES 40447

Definition at line 503 of file resource.h.

#define IDM_IROWSETBOOKMARK_POSITIONONBOOKMARK 40996

Definition at line 740 of file resource.h.

#define IDM_IROWSETFIND_FINDNEXTROW 40634

Definition at line 595 of file resource.h.

#define IDM_IROWSETINDENTITY_ISSAMEROW 40631

Definition at line 592 of file resource.h.

#define IDM_IROWSETLOCATE_COMPARE 40626

Definition at line 588 of file resource.h.

#define IDM_IROWSETLOCATE_GETDATA 40829

Definition at line 665 of file resource.h.

#define IDM_IROWSETLOCATE_GETROWSAT 40629

Definition at line 590 of file resource.h.

#define IDM_IROWSETLOCATE_GETROWSBYBOOKMARK 40628

Definition at line 589 of file resource.h.

#define IDM_IROWSETLOCATE_HASH 40630

Definition at line 591 of file resource.h.

#define IDM_IROWSETNOTIFY_E_FAIL 40490

Definition at line 520 of file resource.h.

#define IDM_IROWSETNOTIFY_S_FALSE 40487

Definition at line 519 of file resource.h.

#define IDM_IROWSETNOTIFY_S_OK 40486

Definition at line 518 of file resource.h.

#define IDM_IROWSETNOTIFY_S_UNWANTEDPHASE 40496

Definition at line 524 of file resource.h.

#define IDM_IROWSETNOTIFY_S_UNWANTEDREASON 40497

Definition at line 525 of file resource.h.

#define IDM_IROWSETPROPERTIES 40444

Definition at line 502 of file resource.h.

#define IDM_IROWSETSCROLL_GETAPPROXIMATEPOSITION 40632

Definition at line 593 of file resource.h.

#define IDM_IROWSETSCROLL_GETDATA 40830

Definition at line 666 of file resource.h.

#define IDM_IROWSETSCROLL_GETROWSATRATIO 40633

Definition at line 594 of file resource.h.

#define IDM_IROWSETVIEW_CREATEVIEW 40672

Definition at line 607 of file resource.h.

#define IDM_IROWSETVIEW_GETVIEW 40673

Definition at line 608 of file resource.h.

#define IDM_ISCOPEDOPERATIONS_COPY 40765

Definition at line 642 of file resource.h.

#define IDM_ISCOPEDOPERATIONS_DELETE 40766

Definition at line 643 of file resource.h.

#define IDM_ISCOPEDOPERATIONS_MOVE 40767

Definition at line 644 of file resource.h.

#define IDM_ISCOPEDOPERATIONS_OPENROWSET 40768

Definition at line 645 of file resource.h.

#define IDM_ISEQSTREAM_READ 40848

Definition at line 673 of file resource.h.

#define IDM_ISEQSTREAM_WRITE 40849

Definition at line 674 of file resource.h.

#define IDM_ISERVICEPROVIDER 40840

Definition at line 671 of file resource.h.

#define IDM_ISESSIONPROPERTIES_GETPROPERTIES 40174

Definition at line 466 of file resource.h.

#define IDM_ISESSIONPROPERTIES_SETPROPERTIES 40175

Definition at line 467 of file resource.h.

#define IDM_ISOURCESROWSET_GETSOURCESROWSET 40117

Definition at line 452 of file resource.h.

#define IDM_ISTREAM_CLONE 40858

Definition at line 683 of file resource.h.

#define IDM_ISTREAM_COMMIT 40853

Definition at line 678 of file resource.h.

#define IDM_ISTREAM_COPYTO 40852

Definition at line 677 of file resource.h.

#define IDM_ISTREAM_LOCKREGION 40855

Definition at line 680 of file resource.h.

#define IDM_ISTREAM_READ 40866

Definition at line 691 of file resource.h.

#define IDM_ISTREAM_REVERT 40854

Definition at line 679 of file resource.h.

#define IDM_ISTREAM_SEEK 40850

Definition at line 675 of file resource.h.

#define IDM_ISTREAM_SETSIZE 40851

Definition at line 676 of file resource.h.

#define IDM_ISTREAM_STAT 40857

Definition at line 682 of file resource.h.

#define IDM_ISTREAM_UNLOCKREGION 40856

Definition at line 681 of file resource.h.

#define IDM_ISTREAM_WRITE 40867

Definition at line 692 of file resource.h.

#define IDM_ISUPPORTERRORINFO 40275

Definition at line 470 of file resource.h.

#define IDM_ITRANSACTION_ABORT 40685

Definition at line 610 of file resource.h.

#define IDM_ITRANSACTION_COMMIT 40686

Definition at line 611 of file resource.h.

#define IDM_ITRANSACTION_GETTRANSACTIONINFO 40536

Definition at line 545 of file resource.h.

#define IDM_ITRANSACTION_RELEASETRANSACTION 40726

Definition at line 630 of file resource.h.

#define IDM_ITRANSACTIONDISPENSOR_BEGINTRANSACTION 40714

Definition at line 628 of file resource.h.

#define IDM_ITRANSACTIONJOIN_GETOPTIONSOBJECT 40532

Definition at line 543 of file resource.h.

#define IDM_ITRANSACTIONJOIN_JOINTRANSACTION 40533

Definition at line 544 of file resource.h.

#define IDM_ITRANSACTIONJOIN_RELEASETRANSACTION 40971

Definition at line 717 of file resource.h.

#define IDM_ITRANSACTIONLOCAL_GETOPTIONSOBJECT 40531

Definition at line 542 of file resource.h.

#define IDM_ITRANSACTIONLOCAL_STARTTRANSACTION 40539

Definition at line 548 of file resource.h.

#define IDM_ITRANSACTIONOBJECT_GETTRANSACTIONOBJECT 40272

Definition at line 469 of file resource.h.

#define IDM_ITRANSACTIONOPTIONS_GETOPTIONS 40537

Definition at line 546 of file resource.h.

#define IDM_ITRANSACTIONOPTIONS_SETOPTIONS 40538

Definition at line 547 of file resource.h.

#define IDM_IUNKNOWN_AUTOQI 40869

Definition at line 693 of file resource.h.

#define IDM_IUNKNOWN_QUERYINTERFACE 40575

Definition at line 565 of file resource.h.

#define IDM_IUNKNOWN_RELEASE 40322

Definition at line 489 of file resource.h.

#define IDM_IUNKNOWN_RELEASEALL 40509

Definition at line 531 of file resource.h.

#define IDM_IUNKNOWN_RELEASECHILDREN 40995

Definition at line 739 of file resource.h.

#define IDM_MAPPARAMETERNAMES 40569

Definition at line 561 of file resource.h.

#define IDM_MSPERSIST_ROWSET_LOAD 40798

Definition at line 660 of file resource.h.

#define IDM_MSPERSIST_ROWSET_SAVE 40797

Definition at line 659 of file resource.h.

#define IDM_MULTIPLERESULTS_ADDREF 40675

Definition at line 609 of file resource.h.

#define IDM_MULTIPLERESULTSMENU 321

Definition at line 128 of file resource.h.

#define IDM_NEXTWINDOW 40157

Definition at line 457 of file resource.h.

#define IDM_NOTIFY_E_FAIL 40796

Definition at line 658 of file resource.h.

#define IDM_NOTIFY_S_FALSE 40793

Definition at line 655 of file resource.h.

#define IDM_NOTIFY_S_OK 40792

Definition at line 654 of file resource.h.

#define IDM_NOTIFY_S_UNWANTEDPHASE 40795

Definition at line 657 of file resource.h.

#define IDM_NOTIFY_S_UNWANTEDREASON 40794

Definition at line 656 of file resource.h.

#define IDM_NOTIFYMENU 175

Definition at line 54 of file resource.h.

#define IDM_OBJECTSWINDOW 40833

Definition at line 669 of file resource.h.

#define IDM_OPENROWSET 40056

Definition at line 431 of file resource.h.

#define IDM_OPTIONS 40442

Definition at line 501 of file resource.h.

#define IDM_PARSEDISPLAYNAME 40623

Definition at line 587 of file resource.h.

#define IDM_PASTEEDITWINDOW 40700

Definition at line 621 of file resource.h.

#define IDM_POOLINFO_ADDREF 40901

Definition at line 697 of file resource.h.

#define IDM_POOLMENU 329

Definition at line 133 of file resource.h.

#define IDM_POOLMNGR_ENUMPOOLS 40900

Definition at line 696 of file resource.h.

#define IDM_POOLMNGR_REFRESH 40907

Definition at line 698 of file resource.h.

#define IDM_PREVWINDOW 40158

Definition at line 458 of file resource.h.

#define IDM_PROVIDERINFO 40542

Definition at line 549 of file resource.h.

#define IDM_RECENTCONFIG1 111

Definition at line 26 of file resource.h.

#define IDM_RECENTCONFIG10 120

Definition at line 35 of file resource.h.

#define IDM_RECENTCONFIG2 112

Definition at line 27 of file resource.h.

#define IDM_RECENTCONFIG3 113

Definition at line 28 of file resource.h.

#define IDM_RECENTCONFIG4 114

Definition at line 29 of file resource.h.

#define IDM_RECENTCONFIG5 115

Definition at line 30 of file resource.h.

#define IDM_RECENTCONFIG6 116

Definition at line 31 of file resource.h.

#define IDM_RECENTCONFIG7 117

Definition at line 32 of file resource.h.

#define IDM_RECENTCONFIG8 118

Definition at line 33 of file resource.h.

#define IDM_RECENTCONFIG9 119

Definition at line 34 of file resource.h.

#define IDM_RECENTFILE1 121

Definition at line 36 of file resource.h.

#define IDM_RECENTFILE10 130

Definition at line 45 of file resource.h.

#define IDM_RECENTFILE2 122

Definition at line 37 of file resource.h.

#define IDM_RECENTFILE3 123

Definition at line 38 of file resource.h.

#define IDM_RECENTFILE4 124

Definition at line 39 of file resource.h.

#define IDM_RECENTFILE5 125

Definition at line 40 of file resource.h.

#define IDM_RECENTFILE6 126

Definition at line 41 of file resource.h.

#define IDM_RECENTFILE7 127

Definition at line 42 of file resource.h.

#define IDM_RECENTFILE8 128

Definition at line 43 of file resource.h.

#define IDM_RECENTFILE9 129

Definition at line 44 of file resource.h.

#define IDM_REFRESH 40015

Definition at line 428 of file resource.h.

#define IDM_REFRESHVISIBLEDATA 40828

Definition at line 664 of file resource.h.

#define IDM_RELEASE_JOINEDTRANSACTION 40970

Definition at line 716 of file resource.h.

#define IDM_RELEASEALLROWS 40474

Definition at line 514 of file resource.h.

#define IDM_RELEASEROWS 40094

Definition at line 441 of file resource.h.

#define IDM_RESTARTPOSITION 40096

Definition at line 442 of file resource.h.

#define IDM_RESYNCHROWS 40478

Definition at line 517 of file resource.h.

#define IDM_ROW_ADDREF 40735

Definition at line 633 of file resource.h.

#define IDM_ROWMENU 302

Definition at line 113 of file resource.h.

#define IDM_ROWPOS_ADDREF 40595

Definition at line 572 of file resource.h.

#define IDM_ROWPOSITIONMENU 316

Definition at line 121 of file resource.h.

#define IDM_ROWSET_ADDREF 40583

Definition at line 568 of file resource.h.

#define IDM_ROWSETMENU 172

Definition at line 52 of file resource.h.

#define IDM_SERVICECOMP_ADDREF 40886

Definition at line 695 of file resource.h.

#define IDM_SERVICECOMPMENU 323

Definition at line 130 of file resource.h.

#define IDM_SESSION_ADDREF 40577

Definition at line 566 of file resource.h.

#define IDM_SESSIONMENU 313

Definition at line 118 of file resource.h.

#define IDM_SETCOMMANDSTREAM 40994

Definition at line 738 of file resource.h.

#define IDM_SETCOMMANDTEXT 40073

Definition at line 435 of file resource.h.

#define IDM_SETDATA 40105

Definition at line 445 of file resource.h.

#define IDM_SETERRORINFO 40607

Definition at line 574 of file resource.h.

#define IDM_SETPARAMETERINFO 40570

Definition at line 562 of file resource.h.

#define IDM_SQLERRORINFO_GETSQLINFO 40622

Definition at line 586 of file resource.h.

#define IDM_STREAM_ADDREF 40836

Definition at line 670 of file resource.h.

#define IDM_STREAMMENU 322

Definition at line 129 of file resource.h.

#define IDM_TABLE_ADDCOLUMN 40283

Definition at line 473 of file resource.h.

#define IDM_TABLE_ADDCONSTRAINT 40987

Definition at line 731 of file resource.h.

#define IDM_TABLE_ALTERCOLUMN 40992

Definition at line 736 of file resource.h.

#define IDM_TABLE_ALTERTABLE 40991

Definition at line 735 of file resource.h.

#define IDM_TABLE_CREATETABLE 40284

Definition at line 474 of file resource.h.

#define IDM_TABLE_CREATETABLEWITHCONSTRAINTS 40988

Definition at line 732 of file resource.h.

#define IDM_TABLE_DROPCOLUMN 40285

Definition at line 475 of file resource.h.

#define IDM_TABLE_DROPCONSTRAINT 40989

Definition at line 733 of file resource.h.

#define IDM_TABLE_DROPTABLE 40286

Definition at line 476 of file resource.h.

#define IDM_TILEHORIZONTAL 220

Definition at line 73 of file resource.h.

#define IDM_TILEVERTICAL 40155

Definition at line 455 of file resource.h.

#define IDM_TRACEWINDOW 40832

Definition at line 668 of file resource.h.

#define IDM_TRANSACTION_ADDREF 40586

Definition at line 569 of file resource.h.

#define IDM_TRANSACTIONMENU 318

Definition at line 124 of file resource.h.

#define IDM_TRANSACTIONOPTIONS_ADDREF 40966

Definition at line 715 of file resource.h.

#define IDM_TRANSACTIONOPTIONSMENU 334

Definition at line 138 of file resource.h.

#define IDM_TREESCHEMA 211

Definition at line 70 of file resource.h.

#define IDM_UNDO 40109

Definition at line 449 of file resource.h.

#define IDM_UNKNOWN_ADDREF 40843

Definition at line 672 of file resource.h.

#define IDM_UNKNOWNMENU 324

Definition at line 131 of file resource.h.

#define IDM_UPDATE 40110

Definition at line 450 of file resource.h.

#define IDP_TABS 1393

Definition at line 424 of file resource.h.

#define IDR_BROWSE_PROPERTY 331

Definition at line 135 of file resource.h.

#define IDR_ROWSETVIEWER 100

Definition at line 20 of file resource.h.

#define IDR_TRANSACTIONMENU 318

Definition at line 123 of file resource.h.

#define IDT_CATALOG 1176

Definition at line 241 of file resource.h.

#define IDT_COLUMNNAME 1190

Definition at line 249 of file resource.h.

#define IDT_DATASOURCE 1175

Definition at line 240 of file resource.h.

#define IDT_DBMS 1173

Definition at line 239 of file resource.h.

#define IDT_FILEDESC 65535

Definition at line 742 of file resource.h.

#define IDT_FILEINFO 65535

Definition at line 743 of file resource.h.

#define IDT_HELPMSG 1125

Definition at line 213 of file resource.h.

#define IDT_PROVIDERDESC 1170

Definition at line 237 of file resource.h.

#define IDT_PROVIDERFILENAME 1169

Definition at line 236 of file resource.h.

#define IDT_PROVIDERVERSION 1171

Definition at line 238 of file resource.h.

#define IDT_READONLY 1178

Definition at line 244 of file resource.h.

#define IDT_RESTRICTION1 1049

Definition at line 159 of file resource.h.

#define IDT_RESTRICTION2 1057

Definition at line 167 of file resource.h.

#define IDT_RESTRICTION3 1058

Definition at line 168 of file resource.h.

#define IDT_RESTRICTION4 1059

Definition at line 169 of file resource.h.

#define IDT_RESTRICTION5 1060

Definition at line 170 of file resource.h.

#define IDT_RESTRICTION6 1061

Definition at line 171 of file resource.h.

#define IDT_RESTRICTION7 1062

Definition at line 172 of file resource.h.

#define IDT_RESULT 1119

Definition at line 211 of file resource.h.

#define IDT_STATIC 1252

Definition at line 302 of file resource.h.

#define IDT_STATIC10 1259

Definition at line 314 of file resource.h.

#define IDT_STATIC11 1260

Definition at line 316 of file resource.h.

#define IDT_STATIC2 1253

Definition at line 303 of file resource.h.

#define IDT_STATIC3 1254

Definition at line 304 of file resource.h.

#define IDT_STATIC4 1256

Definition at line 309 of file resource.h.

#define IDT_STATIC5 1255

Definition at line 307 of file resource.h.

#define IDT_STATIC6 1257

Definition at line 311 of file resource.h.

#define IDT_STATIC7 1311

Definition at line 357 of file resource.h.

#define IDT_STATIC8 1312

Definition at line 358 of file resource.h.

#define IDT_STATIC9 1258

Definition at line 313 of file resource.h.

#define IDT_THREADMODEL 1177

Definition at line 242 of file resource.h.

#define IDT_VALUE 1345

Definition at line 383 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/spy.cpp File Reference

  • Dataaccess
  • oledb
  • rowsetviewer
Defines | Functions | Variables

spy.cpp File Reference

#include "Headers.h"
#include "Spy.h"

Go to the source code of this file.

Defines

#define | BUFFER_FILENAME(pActual) (*(WCHAR**)FILENAME_OFFSET(pActual))
#define | BUFFER_ID(pActual) (*(ULONG*)ID_OFFSET(pActual))
#define | BUFFER_LENGTH(pActual) (*(SIZE_T*)LENGTH_OFFSET(pActual))
#define | BUFFER_LINENUMBER(pActual) (*(ULONG*)LINENUMBER_OFFSET(pActual))
#define | FILENAME_OFFSET(pActual) (ID_OFFSET(pActual) + IDSIZE)
#define | HEAD_OFFSET(pActual) ((BYTE*)pActual)
#define | HEAD_SIGNITURE(pActual) (*(ULONG*)HEAD_OFFSET(pActual))
#define | HEADER_OFFSET(pRequest) ((BYTE*)(pRequest) - HEADERSIZE)
#define | ID_OFFSET(pActual) (LENGTH_OFFSET(pActual) + LENGTHSIZE)
#define | LENGTH_OFFSET(pActual) (HEAD_OFFSET(pActual) + HEADSIZE)
#define | LINENUMBER_OFFSET(pActual) (FILENAME_OFFSET(pActual) + FILENAMESIZE)
#define | TAIL_OFFSET(pActual) (USERS_OFFSET(pActual)+BUFFER_LENGTH(pActual))
#define | TAIL_SIGNITURE(pActual) (*(BYTE*)TAIL_OFFSET(pActual))
#define | USERS_OFFSET(pActual) (HEAD_OFFSET(pActual) + HEADERSIZE)

Functions

void | EnableCRTAllocHook (BOOL fEnable)
void | EnableCRTReportHook (BOOL fEnable)

Variables

const BYTE | ALLOCSIGN = '$'
const ULONG | FILENAMESIZE = sizeof(WCHAR*)
const ULONG | FOOTERSIZE = TAILSIZE
const BYTE | FREESIGN = 'Z'
const ULONG | HEADERSIZE = ROUNDUP(HEADSIZE + LENGTHSIZE + IDSIZE + FILENAMESIZE + LINENUMBERSIZE)
const BYTE | HEADSIGN = '{'
const ULONG | HEADSIZE = sizeof(ULONG)
const ULONG | IDSIZE = sizeof(ULONG)
const SIZE_T | LENGTHSIZE = sizeof(SIZE_T)
const ULONG | LINENUMBERSIZE = sizeof(ULONG)
const BYTE | TAILSIGN = '}'
const ULONG | TAILSIZE = sizeof(BYTE)

Define Documentation

#define BUFFER_FILENAME ( pActual ) (*(WCHAR**)FILENAME_OFFSET(pActual))

Definition at line 62 of file spy.cpp.

#define BUFFER_ID ( pActual ) (*(ULONG*)ID_OFFSET(pActual))

Definition at line 59 of file spy.cpp.

#define BUFFER_LENGTH ( pActual ) (*(SIZE_T*)LENGTH_OFFSET(pActual))

Definition at line 56 of file spy.cpp.

#define BUFFER_LINENUMBER ( pActual ) (*(ULONG*)LINENUMBER_OFFSET(pActual))

Definition at line 65 of file spy.cpp.

#define FILENAME_OFFSET ( pActual ) (ID_OFFSET(pActual) + IDSIZE)

Definition at line 61 of file spy.cpp.

#define HEAD_OFFSET ( pActual ) ((BYTE*)pActual)

Definition at line 49 of file spy.cpp.

#define HEAD_SIGNITURE ( pActual ) (*(ULONG*)HEAD_OFFSET(pActual))

Definition at line 67 of file spy.cpp.

#define HEADER_OFFSET ( pRequest ) ((BYTE*)(pRequest) - HEADERSIZE)

Definition at line 53 of file spy.cpp.

#define ID_OFFSET ( pActual ) (LENGTH_OFFSET(pActual) + LENGTHSIZE)

Definition at line 58 of file spy.cpp.

#define LENGTH_OFFSET ( pActual ) (HEAD_OFFSET(pActual) + HEADSIZE)

Definition at line 55 of file spy.cpp.

#define LINENUMBER_OFFSET ( pActual ) (FILENAME_OFFSET(pActual) + FILENAMESIZE)

Definition at line 64 of file spy.cpp.

#define TAIL_OFFSET ( pActual ) (USERS_OFFSET(pActual)+BUFFER_LENGTH(pActual))

Definition at line 50 of file spy.cpp.

#define TAIL_SIGNITURE ( pActual ) (*(BYTE*)TAIL_OFFSET(pActual))

Definition at line 68 of file spy.cpp.

#define USERS_OFFSET ( pActual ) (HEAD_OFFSET(pActual) + HEADERSIZE)

Definition at line 52 of file spy.cpp.

Function Documentation

void EnableCRTAllocHook ( BOOL fEnable )

Definition at line 685 of file spy.cpp.

{
#ifdef _DEBUG
  if(fEnable)
  {
    if(!g_fpPrevCRTAllocHook)
      g_fpPrevCRTAllocHook  = (_CRT_ALLOC_HOOK_SIGNED)_CrtSetAllocHook((_CRT_ALLOC_HOOK)&CRTAllocHook);
  }
  else
  {
    if(g_fpPrevCRTAllocHook)
      _CrtSetAllocHook((_CRT_ALLOC_HOOK)g_fpPrevCRTAllocHook);
    g_fpPrevCRTAllocHook = NULL;
  }
#endif //_DEBUG
}

void EnableCRTReportHook ( BOOL fEnable )

Definition at line 613 of file spy.cpp.

{
#ifdef _DEBUG
  if(fEnable)
  {
    if(!g_fpPrevCRTReportHook)
      g_fpPrevCRTReportHook = _CrtSetReportHook(&CRTReportHook);
  }
  else
  {
    if(g_fpPrevCRTReportHook)
      _CrtSetReportHook(g_fpPrevCRTReportHook);
    g_fpPrevCRTReportHook = NULL;
  }
#endif //_DEBUG
}

Variable Documentation

const BYTE ALLOCSIGN = '$'

Definition at line 46 of file spy.cpp.

const ULONG FILENAMESIZE = sizeof(WCHAR*)

Definition at line 36 of file spy.cpp.

const ULONG FOOTERSIZE = TAILSIZE

Definition at line 41 of file spy.cpp.

const BYTE FREESIGN = 'Z'

Definition at line 47 of file spy.cpp.

const ULONG HEADERSIZE = ROUNDUP(HEADSIZE + LENGTHSIZE + IDSIZE + FILENAMESIZE + LINENUMBERSIZE)

Definition at line 40 of file spy.cpp.

const BYTE HEADSIGN = '{'

Definition at line 43 of file spy.cpp.

const ULONG HEADSIZE = sizeof(ULONG)

Definition at line 33 of file spy.cpp.

const ULONG IDSIZE = sizeof(ULONG)

Definition at line 35 of file spy.cpp.

const SIZE_T LENGTHSIZE = sizeof(SIZE_T)

Definition at line 34 of file spy.cpp.

const ULONG LINENUMBERSIZE = sizeof(ULONG)

Definition at line 37 of file spy.cpp.

const BYTE TAILSIGN = '}'

Definition at line 44 of file spy.cpp.

const ULONG TAILSIZE = sizeof(BYTE)

Definition at line 38 of file spy.cpp.

Generated on Wed Nov 13 2024 16:53:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/spy.h File Reference

  • Dataaccess
  • oledb
  • rowsetviewer
Classes | Functions

spy.h File Reference

#include "objidl.h"
#include "List.h"
#include "List.h"

Go to the source code of this file.

Classes

class | CMallocSpy

Functions

void | EnableCRTAllocHook (BOOL fEnable=TRUE)
void | EnableCRTReportHook (BOOL fEnable=TRUE)

Function Documentation

void EnableCRTAllocHook ( BOOL fEnable = TRUE )

Definition at line 685 of file spy.cpp.

{
#ifdef _DEBUG
  if(fEnable)
  {
    if(!g_fpPrevCRTAllocHook)
      g_fpPrevCRTAllocHook  = (_CRT_ALLOC_HOOK_SIGNED)_CrtSetAllocHook((_CRT_ALLOC_HOOK)&CRTAllocHook);
  }
  else
  {
    if(g_fpPrevCRTAllocHook)
      _CrtSetAllocHook((_CRT_ALLOC_HOOK)g_fpPrevCRTAllocHook);
    g_fpPrevCRTAllocHook = NULL;
  }
#endif //_DEBUG
}

void EnableCRTReportHook ( BOOL fEnable = TRUE )

Definition at line 613 of file spy.cpp.

{
#ifdef _DEBUG
  if(fEnable)
  {
    if(!g_fpPrevCRTReportHook)
      g_fpPrevCRTReportHook = _CrtSetReportHook(&CRTReportHook);
  }
  else
  {
    if(g_fpPrevCRTReportHook)
      _CrtSetReportHook(g_fpPrevCRTReportHook);
    g_fpPrevCRTReportHook = NULL;
  }
#endif //_DEBUG
}

Generated on Wed Nov 13 2024 16:53:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/rowsetviewer/version.h File Reference

  • Dataaccess
  • oledb
  • rowsetviewer
Defines

version.h File Reference

Go to the source code of this file.

Defines

#define | IDS_RESDLL_VER 1
#define | VER_COMPANYNAME_STR "Microsoft Corporation\0"
#define | VER_FILEFLAGS (0)
#define | VER_FILEFLAGSMASK (VS_FF_DEBUG | VS_FF_PRERELEASE)
#define | VER_FILEOS VOS_NT_WINDOWS32
#define | VER_FILEVERSION 2,70,7531.0
#define | VER_FILEVERSION_STR "2.70.7531.0\0"
#define | VER_LEGALCOPYRIGHT_STR "Copyright \251 Microsoft Corporation 1994-1999\0"
#define | VER_PRODUCTNAME_STR "Microsoft OLE DB\0"
#define | VER_PRODUCTVERSION 2,70,7531.0
#define | VER_PRODUCTVERSION_STR "2.70.7531.0\0"

Define Documentation

#define IDS_RESDLL_VER 1

Definition at line 36 of file version.h.

#define VER_COMPANYNAME_STR "Microsoft Corporation\0"

Definition at line 31 of file version.h.

#define VER_FILEFLAGS (0)

Definition at line 26 of file version.h.

#define VER_FILEFLAGSMASK (VS_FF_DEBUG | VS_FF_PRERELEASE)

Definition at line 22 of file version.h.

#define VER_FILEOS VOS_NT_WINDOWS32

Definition at line 29 of file version.h.

#define VER_FILEVERSION 2,70,7531.0

Definition at line 17 of file version.h.

#define VER_FILEVERSION_STR "2.70.7531.0\0"

Definition at line 18 of file version.h.

#define VER_LEGALCOPYRIGHT_STR "Copyright \251 Microsoft Corporation 1994-1999\0"

Definition at line 33 of file version.h.

#define VER_PRODUCTNAME_STR "Microsoft OLE DB\0"

Definition at line 32 of file version.h.

#define VER_PRODUCTVERSION 2,70,7531.0

Definition at line 19 of file version.h.

#define VER_PRODUCTVERSION_STR "2.70.7531.0\0"

Definition at line 20 of file version.h.

Generated on Wed Nov 13 2024 16:53:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampclnt/dump.cpp File Reference

  • Dataaccess
  • oledb
  • sampclnt
Functions

dump.cpp File Reference

#include "sampclnt.h"

Go to the source code of this file.

Functions

ULONG | CalcPrettyPrintMaxColWidth (DBBINDING *rgBind, ULONG cBind)
void | DumpColumnHeadings (DBBINDING *rgBind, ULONG cBind, DBCOLUMNINFO *pColInfo, ULONG cCol, ULONG cMaxColWidth)
void | DumpColumnsInfo (DBCOLUMNINFO *pColInfo, ULONG cCol)
HRESULT | DumpErrorHResult (HRESULT hr_return, const char *format,...)
void | DumpErrorMsg (const char *format,...)
void | DumpRow (DBBINDING *rgBind, ULONG cBind, ULONG cMaxColWidth, BYTE *pData)
void | DumpStatusMsg (const char *format,...)
char * | GetNoteString (Note *rgNote, int cNote, DWORD dwValue)
char * | GetNoteStringBitvals (Note *rgNote, int cNote, DWORD dwValue)
WCHAR * | LookupColumnName (DBCOLUMNINFO *rgColInfo, ULONG cCol, ULONG iCol)
void | PrintColumn (COLUMNDATA *pColumn, DBBINDING *rgBind, ULONG iBind, ULONG cMaxColWidth)
void | tfprintf (FILE *fp, const char *format,...)
void | tvfprintf (FILE *fp, const char *format, va_list argptr)
void | WriteColumnInfo (FILE *fp, DBCOLUMNINFO *p)

Function Documentation

ULONG CalcPrettyPrintMaxColWidth | ( | DBBINDING * | rgBind,
 |  | ULONG | cBind
 | ) |  |

Definition at line 431 of file dump.cpp.

{
  ULONG cMaxWidth;
    ULONG   cTotalWidth;
    ULONG iBind;

  assert(rgBind != NULL);

  cMaxWidth = DEFAULT_CBMAXLENGTH;
  while (1)
    {
    cTotalWidth = 0;

    for (iBind=0; iBind < cBind; iBind++)
      cTotalWidth += min( cMaxWidth, rgBind[iBind].cbMaxLen ) + 1;

    if (cTotalWidth < PRETTYPRINT_MAXTOTALWIDTH || cMaxWidth < PRETTYPRINT_MINCOLWIDTH)
      break;

    cMaxWidth--;
    }

  return cMaxWidth;
}

void DumpColumnHeadings | ( | DBBINDING * | rgBind,
 |  | ULONG | cBind,
 |  | DBCOLUMNINFO * | pColInfo,
 |  | ULONG | cCol,
 |  | ULONG | cMaxColWidth
 | ) |  |

Definition at line 462 of file dump.cpp.

{
  ULONG iBind;

  assert(rgBind != NULL);
    assert(pColInfo != NULL);

  for (iBind=0; iBind < cBind; iBind++)
    tfprintf( g_fpLogFile, "%-*.*S ",
      min( cMaxColWidth, rgBind[iBind].cbMaxLen ),
      min( cMaxColWidth, rgBind[iBind].cbMaxLen ),
      LookupColumnName( pColInfo, cCol, rgBind[iBind].iOrdinal ) );
  tfprintf( g_fpLogFile, "\n" );
  for (iBind=0; iBind < cBind; iBind++)
    tfprintf( g_fpLogFile, "%-*.*s ",
      min( cMaxColWidth, rgBind[iBind].cbMaxLen ),
      min( cMaxColWidth, rgBind[iBind].cbMaxLen ),
      "------------------------------" );
  tfprintf( g_fpLogFile, "\n" );
}

void DumpColumnsInfo | ( | DBCOLUMNINFO * | pColInfo,
 |  | ULONG | cCol
 | ) |  |

Definition at line 218 of file dump.cpp.

{
  ULONG j;

  assert(pColInfo != NULL);

  tfprintf( g_fpLogFile, "\nColumn Information:\n\n");

  for (j=0; j < cCol; j++)
    {
    WriteColumnInfo( g_fpLogFile, &pColInfo[j] );
    }
}

HRESULT DumpErrorHResult | ( | HRESULT | hr_return,
 |  | const char * | format,
 |  |  | ...
 | ) |  |

Definition at line 63 of file dump.cpp.

{
  char     buff[100];
  int      cBytesWritten;
  va_list  argptr;

  //
  // Dump an error message.
  // Print the text of the HRESULT,
  // Return the HRESULT we were passed.

    // these result codes were generated from the oledberr.h
  static Note ResultCodes[] = {
    // oledberr.h error codes
    NOTE(DB_E_BADACCESSORHANDLE),
    NOTE(DB_E_BADACCESSORHANDLE),
    NOTE(DB_E_ROWLIMITEXCEEDED),
    NOTE(DB_E_READONLYACCESSOR),
    NOTE(DB_E_SCHEMAVIOLATION),
    NOTE(DB_E_BADROWHANDLE),
    NOTE(DB_E_OBJECTOPEN),
    NOTE(DB_E_BADBINDINFO),
    NOTE(DB_SEC_E_PERMISSIONDENIED),
    NOTE(DB_E_NOTAREFERENCECOLUMN),
    NOTE(DB_E_NOCOMMAND),
    NOTE(DB_E_BADBOOKMARK),
    NOTE(DB_E_BADLOCKMODE),
    NOTE(DB_E_PARAMNOTOPTIONAL),
    NOTE(DB_E_BADRATIO),
    NOTE(DB_E_ERRORSINCOMMAND),
    NOTE(DB_E_BADSTARTPOSITION),
    NOTE(DB_E_NOTREENTRANT),
    NOTE(DB_E_NOAGGREGATION),
    NOTE(DB_E_DELETEDROW),
    NOTE(DB_E_CANTFETCHBACKWARDS),
    NOTE(DB_E_ROWSNOTRELEASED),
    NOTE(DB_E_BADSTORAGEFLAG),
    NOTE(DB_E_BADSTATUSVALUE),
    NOTE(DB_E_CANTSCROLLBACKWARDS),
    NOTE(DB_E_INTEGRITYVIOLATION),
    NOTE(DB_E_ABORTLIMITREACHED),
    NOTE(DB_E_DUPLICATEINDEXID),
    NOTE(DB_E_NOINDEX),
    NOTE(DB_E_INDEXINUSE),
    NOTE(DB_E_NOTABLE),
    NOTE(DB_E_CONCURRENCYVIOLATION),
    NOTE(DB_E_BADCOPY),
    NOTE(DB_E_BADPRECISION),
    NOTE(DB_E_BADSCALE),
    NOTE(DB_E_BADID),
    NOTE(DB_E_BADTYPE),
    NOTE(DB_E_DUPLICATECOLUMNID),
    NOTE(DB_E_DUPLICATETABLEID),
    NOTE(DB_E_TABLEINUSE),
    NOTE(DB_E_NOLOCALE),
    NOTE(DB_E_BADRECORDNUM),
    NOTE(DB_E_BOOKMARKSKIPPED),
    NOTE(DB_E_BADPROPERTYVALUE),
    NOTE(DB_E_INVALID),
    NOTE(DB_E_BADACCESSORFLAGS),
    NOTE(DB_E_BADSTORAGEFLAGS),
    NOTE(DB_E_BYREFACCESSORNOTSUPPORTED),
    NOTE(DB_E_NULLACCESSORNOTSUPPORTED),
    NOTE(DB_E_NOTPREPARED),
    NOTE(DB_E_BADACCESSORTYPE),
    NOTE(DB_E_WRITEONLYACCESSOR),
    NOTE(DB_SEC_E_AUTH_FAILED),
    NOTE(DB_E_CANCELED),
    NOTE(DB_E_BADSOURCEHANDLE),
    NOTE(DB_S_ROWLIMITEXCEEDED),
    NOTE(DB_S_COLUMNTYPEMISMATCH),
    NOTE(DB_S_TYPEINFOOVERRIDDEN),
    NOTE(DB_S_BOOKMARKSKIPPED),
    NOTE(DB_S_ENDOFROWSET),
    NOTE(DB_S_BUFFERFULL),
    NOTE(DB_S_CANTRELEASE),
    NOTE(DB_S_DIALECTIGNORED),
    NOTE(DB_S_UNWANTEDPHASE),
    NOTE(DB_S_COLUMNSCHANGED),
    NOTE(DB_S_ERRORSRETURNED),
    NOTE(DB_S_BADROWHANDLE),
    NOTE(DB_S_DELETEDROW),
    NOTE(DB_S_STOPLIMITREACHED),
    NOTE(DB_S_LOCKUPGRADED),
    NOTE(DB_S_PROPERTIESCHANGED),
    NOTE(DB_S_ERRORSOCCURRED),
    NOTE(DB_S_PARAMUNAVAILABLE),
    NOTE(DB_S_MULTIPLECHANGES),

    // winerr.h
    NOTE(E_UNEXPECTED),
    NOTE(E_NOTIMPL),
    NOTE(E_OUTOFMEMORY),
    NOTE(E_INVALIDARG),
    NOTE(E_NOINTERFACE),
    NOTE(E_POINTER),
    NOTE(E_HANDLE),
    NOTE(E_ABORT),
    NOTE(E_FAIL),
    NOTE(E_ACCESSDENIED),
    NOTE(S_OK),
    NOTE(S_FALSE),
    NOTE(E_UNEXPECTED),
    NOTE(E_NOTIMPL),
    NOTE(E_OUTOFMEMORY),
    NOTE(E_INVALIDARG),
    NOTE(E_NOINTERFACE),
    NOTE(E_POINTER),
    NOTE(E_HANDLE),
    NOTE(E_ABORT),
    NOTE(E_FAIL),
    NOTE(E_ACCESSDENIED),
    // BindMoniker Errors
    NOTE(MK_E_NOOBJECT),
    NOTE(MK_E_EXCEEDEDDEADLINE),
    NOTE(MK_E_CONNECTMANUALLY),
    NOTE(MK_E_INTERMEDIATEINTERFACENOTSUPPORTED),
    NOTE(STG_E_ACCESSDENIED),
    NOTE(MK_E_SYNTAX),
    NOTE(MK_E_CANTOPENFILE),
  };

  // Format the message.
  // Print name of hresult code.

  if (format)
    {
    va_start( argptr, format );
    cBytesWritten = _vsnprintf( buff, sizeof(buff), format, argptr );
    va_end( argptr );
    }
  else
    strcpy( buff, "" );

  // log to stderr and also to our log file
  tfprintf( stderr, "%.*s: Returned %.30s\n",
    sizeof(buff), buff,
    GetNoteString( ResultCodes, NUMELEM(ResultCodes), GetScode(hr_return)) );

    tfprintf( g_fpLogFile, "%.*s: Returned %.30s\n",
    sizeof(buff), buff,
    GetNoteString( ResultCodes, NUMELEM(ResultCodes), GetScode(hr_return)) );

  return ResultFromScode( hr_return );
}

void DumpErrorMsg | ( | const char * | format,
 |  |  | ...
 | ) |  |

Definition at line 24 of file dump.cpp.

{
  va_list argptr;

  assert(format != NULL);

  // log this message to stderr and to our log file
  va_start( argptr, format );
  tvfprintf( stderr, format, argptr);
    tvfprintf( g_fpLogFile, format, argptr);
  va_end( argptr );
}

void DumpRow | ( | DBBINDING * | rgBind,
 |  | ULONG | cBind,
 |  | ULONG | cMaxColWidth,
 |  | BYTE * | pData
 | ) |  |

Definition at line 518 of file dump.cpp.

{
  ULONG     iBind;
    COLUMNDATA* pColumn;

  assert(rgBind);
  assert( offsetof(COLUMNDATA, dwLength) == 0);

  // Print each column we're bound to.
  for (iBind=0; iBind < cBind; iBind++)
    {
    // Columns are bound differently; not so easy.
    // Print out to at least DEFAULT_CBMAXLENGTH width (pretty),
    // Limit to first dwLength characters.

    pColumn = (COLUMNDATA *) (pData + rgBind[iBind].obLength);
    PrintColumn( pColumn, rgBind, iBind, cMaxColWidth );
    }
  tfprintf( g_fpLogFile, "\n" );
}

void DumpStatusMsg | ( | const char * | format,
 |  |  | ...
 | ) |  |

Definition at line 43 of file dump.cpp.

{
  va_list argptr;

  assert(format != NULL);

  // log this message to stdout and to our log file
  va_start( argptr, format );
  tvfprintf( stdout, format, argptr );
    tvfprintf( g_fpLogFile, format, argptr );
  va_end( argptr );
}

char* GetNoteString | ( | Note * | rgNote,
 |  | int | cNote,
 |  | DWORD | dwValue
 | ) |  |

Definition at line 375 of file dump.cpp.

{
  int j;

  assert(rgNote != NULL);

  // Scan a table of value/string,
  // return ptr to string found.

  for (j=0; j < cNote; j++) {
    if (rgNote[j].dwFlag == dwValue)
      return rgNote[j].szText;
  }
  return "<unknown>";
}

char* GetNoteStringBitvals | ( | Note * | rgNote,
 |  | int | cNote,
 |  | DWORD | dwValue
 | ) |  |

Definition at line 402 of file dump.cpp.

{
  static char buff[400];
  int j;

  assert(rgNote != NULL);

  // Make a string that combines all the bits ORed together.

  strcpy(buff, "");
  for (j=0; j < cNote; j++) {
    if (rgNote[j].dwFlag & dwValue) {
      if (buff[0])
        strcat( buff, " | " );
      strcat( buff, rgNote[j].szText );
    }
  }
  assert(strlen(buff) < sizeof(buff));
  return buff;
}

WCHAR* LookupColumnName | ( | DBCOLUMNINFO * | rgColInfo,
 |  | ULONG | cCol,
 |  | ULONG | iCol
 | ) |  |

Definition at line 492 of file dump.cpp.

{
  ULONG j;

  assert(rgColInfo != NULL);

  // A really slow way to get the column name, given the ordinal.
  // The problem is that result-set ordinals do not necessarily match
  // the index into the ColumnInfo array.
  // (May have bookmark, which is always column 0.)

  for (j=0; j < cCol; j++)
    if (rgColInfo[j].iOrdinal == iCol)
      return rgColInfo[j].pwszName;

  return L"Error";
}

void PrintColumn | ( | COLUMNDATA * | pColumn,
 |  | DBBINDING * | rgBind,
 |  | ULONG | iBind,
 |  | ULONG | cMaxColWidth
 | ) |  |

Definition at line 549 of file dump.cpp.

{
  void* p;
  ULONG   ulPrintWidth;
  ULONG   ulPrintPrecision;
  DWORD   dwStatus;
  DWORD   dwLength;
  BOOL    fDidVariant;
  BOOL    fIsUnicode;
  char* sFormat;
  HRESULT hr;

    assert(pColumn != NULL);
    assert(rgBind != NULL);

  // Pretty print a column.
  // May have different type of binding.

  fDidVariant = FALSE;
  fIsUnicode  = FALSE;
  dwStatus = pColumn->dwStatus;
  dwLength = pColumn->dwLength;

  if (dwStatus == DBSTATUS_S_ISNULL)
    {
    p = "<null>";
    dwLength = strlen( (char *) p);
    }
    else if (dwStatus == DBBINDSTATUS_UNSUPPORTEDCONVERSION)
        {
        p = "<unsupportedconversion>";
    dwLength = strlen( (char *) p);
        }
  else
    {
    switch (rgBind[iBind].wType)
      {
    case DBTYPE_STR:
      // We have a string in our buffer, so use it.
      p = (void *) &pColumn->bData;
      break;
    case DBTYPE_VARIANT:
      // We have a variant in our buffer, so convert to string.
      p = (void *) &pColumn->bData;
      hr = VariantChangeTypeEx(
          (VARIANT *) p,      // Destination (convert in place)
          (VARIANT *) p,      // Source
          LOCALE_SYSTEM_DEFAULT,  // LCID
          0,            // dwFlags
          VT_BSTR );
      if (FAILED(hr))
              {
        DumpErrorHResult( hr, "VariantChangeTypeEx, field %d", iBind );
                return;
                }
      p = (wchar_t *) (((VARIANT *)p)->bstrVal) ;
      dwLength = ((DWORD *)p)[-1] / sizeof(wchar_t);
      fDidVariant = TRUE;
      fIsUnicode  = TRUE;
      break;
    default:
      p = "??? unknown type ???";
      break;
      }
    }

  // Print the column.
  // If it has been truncated or rounded, print a '#' in
  // the far right-hand column.
  ulPrintWidth     = min( cMaxColWidth, rgBind[iBind].cbMaxLen );
  ulPrintPrecision = min( cMaxColWidth, dwLength );
  if (dwStatus == DBSTATUS_S_TRUNCATED ||  cMaxColWidth < dwLength)
  {
    ulPrintWidth--;
    ulPrintPrecision--;
  }

  sFormat = fIsUnicode ? "%-*.*S" : "%-*.*s";

  tfprintf( g_fpLogFile, sFormat, ulPrintWidth, ulPrintPrecision, p );

  if (dwStatus == DBSTATUS_S_TRUNCATED ||  cMaxColWidth < dwLength)
    tfprintf( g_fpLogFile, "#" );
  tfprintf( g_fpLogFile, " " );

  // Free memory used by the variant.
  if (fDidVariant)
    VariantClear( (VARIANT *) &pColumn->bData );

  return;
}

void tfprintf | ( | FILE * | fp,
 |  | const char * | format,
 |  |  | ...
 | ) |  |

Definition at line 650 of file dump.cpp.

{
  int   cBytesWritten;
  char  buff[400];
  va_list argptr;

  assert(format != NULL);

  // Dump a formatted string.
    // _vsnprintf prevents overflowing our buffer.
  va_start( argptr, format );
  cBytesWritten = _vsnprintf( buff, sizeof(buff), format, argptr );
  va_end( argptr );
  buff[sizeof(buff)-1] = '\0';

  // Can't use fprintf, because string could contain '%'.
  if (fp)
    fputs( buff, fp );
}

void tvfprintf | ( | FILE * | fp,
 |  | const char * | format,
 |  | va_list | argptr
 | ) |  |

Definition at line 677 of file dump.cpp.

{
  int   cBytesWritten;
  char  buff[400];

  assert(format != NULL);

  // Dump a formatted string.
    // _vsnprintf prevents overflowing our buffer.
  cBytesWritten = _vsnprintf( buff, sizeof(buff), format, argptr );
  buff[sizeof(buff)-1] = '\0';

  // Can't use fprintf, because string could contain '%'.
  if (fp)
    fputs( buff, fp );
}

void WriteColumnInfo | ( | FILE * | fp,
 |  | DBCOLUMNINFO * | p
 | ) |  |

Definition at line 238 of file dump.cpp.

{
  DBID      *pCol;
    DBKIND      eKind;
  wchar_t   wszGuidBuff[MAX_GUID_STRING];
    wchar_t     wszNameBuff[MAX_GUID_STRING];

  static char *szDbcolkind[] = { "Guid+Name", "Guid+PropID", "Name",
      "Guid+Name", "Guid+PropID", "PropID", "Guid" };

  assert(p != NULL);

  // For DBTYPEENUM.  Doesn't need to be in order.
  // Below we mask off the high bits.
  static Note typenotes[] =
      {
    NOTE(DBTYPE_EMPTY),
    NOTE(DBTYPE_NULL),
    NOTE(DBTYPE_I2),
    NOTE(DBTYPE_I4),
    NOTE(DBTYPE_R4),
    NOTE(DBTYPE_R8),
    NOTE(DBTYPE_CY),
    NOTE(DBTYPE_DATE),
    NOTE(DBTYPE_BSTR),
    NOTE(DBTYPE_IDISPATCH),
    NOTE(DBTYPE_ERROR),
    NOTE(DBTYPE_BOOL),
    NOTE(DBTYPE_VARIANT),
    NOTE(DBTYPE_IUNKNOWN),
    NOTE(DBTYPE_DECIMAL),
    NOTE(DBTYPE_UI1),
    NOTE(DBTYPE_ARRAY),
    NOTE(DBTYPE_BYREF),
    NOTE(DBTYPE_I1),
    NOTE(DBTYPE_UI2),
    NOTE(DBTYPE_UI4),
    NOTE(DBTYPE_I8),
    NOTE(DBTYPE_UI8),
    NOTE(DBTYPE_GUID),
    NOTE(DBTYPE_VECTOR),
    NOTE(DBTYPE_RESERVED),
    NOTE(DBTYPE_BYTES),
    NOTE(DBTYPE_STR),
    NOTE(DBTYPE_WSTR),
    NOTE(DBTYPE_NUMERIC),
    NOTE(DBTYPE_UDT),
    NOTE(DBTYPE_DBDATE),
    NOTE(DBTYPE_DBTIME),
    NOTE(DBTYPE_DBTIMESTAMP),
      };

  static Note flagnotes[] =
      {
    NOTE(DBCOLUMNFLAGS_ISBOOKMARK),
    NOTE(DBCOLUMNFLAGS_MAYDEFER),
    NOTE(DBCOLUMNFLAGS_WRITE),
    NOTE(DBCOLUMNFLAGS_WRITEUNKNOWN),
    NOTE(DBCOLUMNFLAGS_ISFIXEDLENGTH),
    NOTE(DBCOLUMNFLAGS_ISNULLABLE),
    NOTE(DBCOLUMNFLAGS_MAYBENULL),
    NOTE(DBCOLUMNFLAGS_ISLONG),
    NOTE(DBCOLUMNFLAGS_ISROWID),
    NOTE(DBCOLUMNFLAGS_ISROWVER),
    NOTE(DBCOLUMNFLAGS_CACHEDEFERRED),
    };

  pCol = & p->columnid;
    eKind = pCol->eKind;

    // stringize GUID for pretty printing
    switch (eKind)
        {
        case DBKIND_GUID_NAME:
        case DBKIND_GUID_PROPID:
        case DBKIND_GUID:
          StringFromGUID2( pCol->uGuid.guid, wszGuidBuff, sizeof(wszGuidBuff) );
            break;
        case DBKIND_PGUID_NAME:
        case DBKIND_PGUID_PROPID:
          StringFromGUID2( *(pCol->uGuid.pguid), wszGuidBuff, sizeof(wszGuidBuff) );
            break;
        default:
            wcscpy( wszGuidBuff, L"<none>" );
            break;
        }

    // stringize name or propID for pretty printing
    switch (eKind)
        {
        case DBKIND_GUID_NAME:
        case DBKIND_NAME:
        case DBKIND_PGUID_NAME:
            swprintf( wszNameBuff, L"[name=%.50S]", pCol->uName.pwszName ? pCol->uName.pwszName : L"(unknown)" );
            break;
        case DBKIND_GUID_PROPID:
        case DBKIND_PGUID_PROPID:
        case DBKIND_PROPID:
            swprintf( wszNameBuff, L"[propid=%lu]", pCol->uName.ulPropid );
            break;
        default:
            wcscpy( wszNameBuff, L"" );
            break;
        }

    // pretty print column info
    tfprintf( fp, "ColumnId [kind=%.40s] [guid=%.40S] %.60S\n",
        szDbcolkind[eKind], wszGuidBuff, wszNameBuff );

  // Now move on to other stuff...
  // Name in DBCOLUMNINFO different than name in DBCOLUMNID (maybe).
  tfprintf(fp, "  Name          = '%.50S'\n", p->pwszName );
  tfprintf(fp, "  iOrdinal      = %d\n", p->iOrdinal);
  tfprintf(fp, "  wType         = %.100s\n",
    GetNoteString( typenotes, NUMELEM(typenotes),
        p->wType & (~DBTYPE_BYREF) & (~DBTYPE_ARRAY) & (~DBTYPE_VECTOR) ) );
  if (p->wType & DBTYPE_BYREF)
    tfprintf(fp, "      (BYREF)\n");
  if (p->wType & DBTYPE_ARRAY)
    tfprintf(fp, "      (ARRAY)\n");
  if (p->wType & DBTYPE_VECTOR)
    tfprintf(fp, "      (VECTOR)\n");
  tfprintf(fp, "  ulColumnSize  = %ld\n", p->ulColumnSize );
  tfprintf(fp, "  bPrecision    = %d\n",  p->bPrecision );
  tfprintf(fp, "  bScale        = %d\n",  p->bScale );
  tfprintf(fp, "  dwFlags       = %s\n\n",
    GetNoteStringBitvals( flagnotes, NUMELEM(flagnotes), p->dwFlags ) );

}

Generated on Wed Nov 13 2024 16:53:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampclnt/resource.h File Reference

  • Dataaccess
  • oledb
  • sampclnt

resource.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampclnt/sampclnt.cpp File Reference

  • Dataaccess
  • oledb
  • sampclnt
Defines | Functions | Variables

sampclnt.cpp File Reference

#include "sampclnt.h"

Go to the source code of this file.

Defines

#define | DBINITCONSTANTS
#define | INITGUID

Functions

HRESULT | CleanupRowset (IRowset *pIRowset, HACCESSOR hAccessor)
HRESULT | CreateAccessor (IRowset *pIRowset, DBBINDING *rgBind, ULONG cBind, HACCESSOR *phAccessor_out)
HRESULT | DoTests ()
HRESULT | GetColumnsInfo (IRowset *pIRowset, ULONG *pcCol_out, DBCOLUMNINFO **ppColumnInfo_out, WCHAR **ppStringsBuffer_out)
HRESULT | GetData (IRowset *pIRowset, ULONG cMaxRowSize, HACCESSOR hAccessor, DBBINDING *rgBind, ULONG cBind, DBCOLUMNINFO *pColumnInfo, ULONG cCol)
HRESULT | GetDataFromRowset (IRowset *pIRowset)
HRESULT | GetDBSessionFromDataSource (IDBInitialize *pIDBInitialize, IOpenRowset **ppIOpenRowset_out)
HRESULT | GetRowsetFromDBSession (IOpenRowset *pIOpenRowset, LPWSTR pwszTableName, IRowset **ppIRowset_out)
HRESULT | GetSampprovDataSource (IDBInitialize **ppIDBInitialize_out)
void | main ()
HRESULT | SetupBindings (ULONG cCol, DBCOLUMNINFO *pColumnInfo, DBBINDING *rgBind_out, ULONG *pcBind_out, ULONG *pcMaxRowSize_out)

Variables

FILE * | g_fpLogFile = NULL
IMalloc * | g_pIMalloc = NULL

Define Documentation

#define DBINITCONSTANTS

Definition at line 38 of file sampclnt.cpp.

#define INITGUID

Definition at line 37 of file sampclnt.cpp.

Function Documentation

HRESULT CleanupRowset | ( | IRowset * | pIRowset,
 |  | HACCESSOR | hAccessor
 | ) |  |

Definition at line 1091 of file sampclnt.cpp.

{
  IAccessor*  pIAccessor = NULL;
  HRESULT   hr;

    assert(pIRowset != NULL);

  // tell the rowset object it can release the accessor, via IAccessor
  hr = pIRowset->QueryInterface( IID_IAccessor, (void**)&pIAccessor );
  if (FAILED(hr))
    {
        DUMP_ERROR_LINENUMBER();
    DumpErrorHResult( hr, "pIRowset->QI for IID_IAccessor" );
    goto error;
    }
  hr = pIAccessor->ReleaseAccessor( hAccessor, NULL );
  if (FAILED(hr))
    {
        DUMP_ERROR_LINENUMBER();
    DumpErrorHResult( hr, "pIAccessor->ReleaseAccessor" );
    goto error;
    }
  pIAccessor->Release();
  pIAccessor = NULL;

  return ResultFromScode( S_OK );

error:
  if (pIAccessor)
      pIAccessor->Release();

    return ResultFromScode( hr );
}

HRESULT CreateAccessor | ( | IRowset * | pIRowset,
 |  | DBBINDING * | rgBind,
 |  | ULONG | cBind,
 |  | HACCESSOR * | phAccessor_out
 | ) |  |

Definition at line 879 of file sampclnt.cpp.

{
  IAccessor*  pIAccessor = NULL;
  HACCESSOR   hAccessor;
  HRESULT   hr;

  assert(pIRowset != NULL);
    assert(rgBind != NULL);
    assert(phAccessor_out != NULL);

    // Get an accessor for our bindings from the rowset, via IAccessor
  hr = pIRowset->QueryInterface( IID_IAccessor, (void**)&pIAccessor );
  if (FAILED(hr))
      {
        DUMP_ERROR_LINENUMBER();
        DumpErrorHResult( hr, "pIRowset->QI for IID_IAccessor" );
        goto error;
        }
  hr = pIAccessor->CreateAccessor( DBACCESSOR_ROWDATA, cBind, rgBind, 0,
                                   &hAccessor, NULL );
  if (FAILED(hr))
      {
        DUMP_ERROR_LINENUMBER();
        DumpErrorHResult( hr, "pIAccessor->CreateAccessor" );
        goto error;
        }
  pIAccessor->Release();
  pIAccessor = NULL;

  *phAccessor_out = hAccessor;

  return ResultFromScode( S_OK );

error:
  if (pIAccessor)
      pIAccessor->Release();
  *phAccessor_out = NULL;

  return ResultFromScode( hr );
}

HRESULT DoTests ( void )

Definition at line 192 of file sampclnt.cpp.

{
  IDBInitialize*      pIDBInitialize  = NULL;
    IOpenRowset*        pIOpenRowset    = NULL;
    IRowset*        pIRowset    = NULL;
  LPWSTR          pwszTableName   =   L"customer.csv";
  HRESULT         hr;

  hr = GetSampprovDataSource( &pIDBInitialize );
  if (FAILED(hr))
      {
        DUMP_ERROR_LINENUMBER();
        DumpErrorHResult( hr, "GetSampprovDataSource" );
        goto error;
        }

    hr = GetDBSessionFromDataSource( pIDBInitialize, &pIOpenRowset );
    if (FAILED(hr))
        {
        DUMP_ERROR_LINENUMBER();
        DumpErrorHResult( hr, "GetDBSessionFromDataSource" );
        goto error;
        }

    pIDBInitialize->Release();
    pIDBInitialize = NULL;

    hr = GetRowsetFromDBSession( pIOpenRowset, pwszTableName, &pIRowset );
    if (FAILED(hr))
        {
        DUMP_ERROR_LINENUMBER();
        DumpErrorHResult( hr, "GetRowsetFromDBCreateSession" );
        goto error;
        }

    pIOpenRowset->Release();
    pIOpenRowset = NULL;

  hr = GetDataFromRowset( pIRowset );
  if (FAILED(hr))
      {
        DUMP_ERROR_LINENUMBER();
        DumpErrorHResult( hr, "GetDataFromRowset" );
        goto error;
        }
    pIRowset->Release();
    pIRowset = NULL;
  CoFreeUnusedLibraries();

  DumpStatusMsg( "\nDone! ");
  printf("\n\nFor more data from this run, see the log file sampclnt.out\n" );
  return ResultFromScode( S_OK );

error:
  if (pIRowset)
    pIRowset->Release();
    if (pIOpenRowset)
        pIOpenRowset->Release();
    if (pIDBInitialize)
      pIDBInitialize->Release();

  return ResultFromScode( hr );
}

HRESULT GetColumnsInfo | ( | IRowset * | pIRowset,
 |  | ULONG * | pcCol_out,
 |  | DBCOLUMNINFO ** | ppColumnInfo_out,
 |  | WCHAR ** | ppStringsBuffer_out
 | ) |  |

Definition at line 697 of file sampclnt.cpp.

{
  IColumnsInfo*   pIColumnsInfo = NULL;
    ULONG     cCol;
    DBCOLUMNINFO* pColumnInfo;
    WCHAR*      pStringsBuffer;
  HRESULT     hr;

  assert(pIRowset != NULL);
    assert(pcCol_out != NULL);
    assert(ppColumnInfo_out != NULL);
    assert(ppStringsBuffer_out != NULL);

  // get column information from the command object via IColumnsInfo
  hr = pIRowset->QueryInterface( IID_IColumnsInfo, (void **) &pIColumnsInfo );
    if (FAILED(hr))
      {
        DUMP_ERROR_LINENUMBER();
        DumpErrorHResult( hr, "IRowset::QI for IID_IColumnsInfo" );
        goto error;
        }
  hr = pIColumnsInfo->GetColumnInfo(
      &cCol,
      &pColumnInfo,
      &pStringsBuffer );
    if (FAILED(hr))
      {
        DUMP_ERROR_LINENUMBER();
        DumpErrorHResult( hr, "pIColumnsInfo->GetColumnInfo" );
        goto error;
        }
  pIColumnsInfo->Release();
  pIColumnsInfo = NULL;

  DumpColumnsInfo( pColumnInfo, cCol );

    // fill out-params
    *pcCol_out = cCol;
    *ppColumnInfo_out = pColumnInfo;
    *ppStringsBuffer_out = pStringsBuffer;

  return ResultFromScode( S_OK );

error:
  if (pIColumnsInfo)
      pIColumnsInfo->Release();

  *pcCol_out = 0;
    *ppColumnInfo_out = NULL;
    *ppStringsBuffer_out = NULL;

  return ResultFromScode( hr );
}

HRESULT GetData | ( | IRowset * | pIRowset,
 |  | ULONG | cMaxRowSize,
 |  | HACCESSOR | hAccessor,
 |  | DBBINDING * | rgBind,
 |  | ULONG | cBind,
 |  | DBCOLUMNINFO * | pColumnInfo,
 |  | ULONG | cCol
 | ) |  |

Definition at line 966 of file sampclnt.cpp.

{
  ULONG   cRowsObtained;
  ULONG iRow;
  BYTE* pRowData = NULL;
  HROW  rghRows[NUMROWS_CHUNK];
  HROW* pRows = &rghRows[0];
  ULONG cMaxColWidth;     // needed for pretty printing
  HRESULT hr;

  assert(pIRowset != NULL);
    assert(rgBind != NULL);
    assert(pColumnInfo != NULL);

  // create a buffer for row data, big enough to hold the biggest row
  pRowData = (BYTE *) malloc( cMaxRowSize );
  if (!pRowData)
    {
        DUMP_ERROR_LINENUMBER();
        DumpErrorMsg("GetData: malloc failed\n");
        goto error;
    }

  // pretty print
    cMaxColWidth = CalcPrettyPrintMaxColWidth( rgBind, cBind );

    // pretty print
  DumpColumnHeadings( rgBind, cBind, pColumnInfo, cCol, cMaxColWidth );

    // process all the rows, NUMROWS_CHUNK rows at a time
  while (1)
    {
    hr = pIRowset->GetNextRows(
      NULL,           // hChapter
      0,              // cRowsToSkip
      NUMROWS_CHUNK,        // cRowsDesired
      &cRowsObtained,             // pcRowsObtained
      &pRows );         // filled in w/ row handles
    if (FAILED(hr))
      {
            DUMP_ERROR_LINENUMBER();
            DumpErrorHResult( hr, "pIRowset->GetNextRows" );
            goto error;
      }

    if ( cRowsObtained == 0 )     // all done, no more rows left to get
      break;

    // loop over rows obtained, getting data for each
    for ( iRow=0; iRow < cRowsObtained; iRow++ )
      {
      hr = pIRowset->GetData(
        rghRows[iRow],
        hAccessor,
        pRowData );
             if (FAILED(hr))
              {
                DUMP_ERROR_LINENUMBER();
                DumpErrorHResult( hr, "pIRowset->GetData" );
                goto error;
              }

      // pretty print
            DumpRow( rgBind, cBind, cMaxColWidth, pRowData );
      }
    // release row handles
    hr = pIRowset->ReleaseRows( cRowsObtained, rghRows, NULL, NULL, NULL );
        if (FAILED(hr))
              {
                DUMP_ERROR_LINENUMBER();
                DumpErrorHResult( hr, "pIRowset->ReleaseRows" );
                goto error;
              }
    } // end while

  // free row data buffer
  free( pRowData );
  return ResultFromScode( S_OK );

error:
  if (pRowData)
    free( pRowData );

    return ResultFromScode( hr );
}

HRESULT GetDataFromRowset ( IRowset * pIRowset )

Definition at line 573 of file sampclnt.cpp.

{
  ULONG       cCol;
  ULONG       cbMaxRowSize;   // buffer size for 1 row's data
  ULONG       cBind;
  DBBINDING   rgBind[MAX_BINDINGS];
  HACCESSOR   hAccessor   = NULL;
  DBCOLUMNINFO* pColumnInfo   = NULL;
  WCHAR*      pStringsBuffer  = NULL;
  HRESULT     hr;

  DumpStatusMsg( "Reading all the data in the rowset...\n" );

  assert(pIRowset != NULL);
  assert(g_pIMalloc != NULL);

  hr = GetColumnsInfo( pIRowset, &cCol, &pColumnInfo, &pStringsBuffer );
  if (FAILED(hr))
      {
        DUMP_ERROR_LINENUMBER();
        DumpErrorHResult( hr,  "GetColumnsInfo");
        goto error;
        }

  hr = SetupBindings( cCol, pColumnInfo, rgBind, &cBind, &cbMaxRowSize );
  if (FAILED(hr))
      {
        DUMP_ERROR_LINENUMBER();
        DumpErrorHResult( hr,  "SetupBindings");
        goto error;
        }

  hr = CreateAccessor( pIRowset, rgBind, cBind, &hAccessor );
  if (FAILED(hr))
      {
        DUMP_ERROR_LINENUMBER();
        DumpErrorHResult( hr,  "CreateAccessor" );
        goto error;
        }

  hr = GetData( pIRowset, cbMaxRowSize, hAccessor, rgBind, cBind, pColumnInfo, cCol );
  if (FAILED(hr))
      {
        DUMP_ERROR_LINENUMBER();
        DumpErrorHResult( hr,  "GetData" );
        goto error;
        }

  g_pIMalloc->Free( pColumnInfo );
    pColumnInfo = NULL;
  g_pIMalloc->Free( pStringsBuffer );
    pStringsBuffer = NULL;

  hr = CleanupRowset( pIRowset, hAccessor );
  if (FAILED(hr))
      {
        DUMP_ERROR_LINENUMBER();
        DumpErrorHResult( hr,  "CleanupRowset" );
        goto error;
        }

  return ResultFromScode( S_OK );

error:
  if (pColumnInfo)
    g_pIMalloc->Free( pColumnInfo );
  if (pStringsBuffer)
    g_pIMalloc->Free( pStringsBuffer );

    return ResultFromScode( hr );
}

HRESULT GetDBSessionFromDataSource | ( | IDBInitialize * | pIDBInitialize,
 |  | IOpenRowset ** | ppIOpenRowset_out
 | ) |  |

Definition at line 412 of file sampclnt.cpp.

{
    IDBCreateSession*   pIDBCreateSession;
    IOpenRowset*        pIOpenRowset;
    HRESULT             hr;

    DumpStatusMsg( "Getting a DBSession object from the data source object...\n" );

    assert(pIDBInitialize != NULL);
    assert(ppIOpenRowset_out  != NULL );

    hr = pIDBInitialize->QueryInterface( IID_IDBCreateSession, (void**)&pIDBCreateSession);
    if (FAILED(hr))
      {
        DUMP_ERROR_LINENUMBER();
        DumpErrorHResult( hr, "IDBInitialize::QI for IDBCreateSession");
        goto error;
        }

    hr = pIDBCreateSession->CreateSession( NULL, IID_IOpenRowset, (IUnknown**)&pIOpenRowset );
    if (FAILED(hr))
      {
        DUMP_ERROR_LINENUMBER();
        DumpErrorHResult( hr, "IDBCreateSession::CreateSession");
        goto error;
        }
     pIDBCreateSession->Release();
     pIDBCreateSession = NULL;

     // all went well
     *ppIOpenRowset_out = pIOpenRowset;
     return ResultFromScode( S_OK );

error:
    if (pIDBCreateSession)
        pIDBCreateSession->Release();

    *ppIOpenRowset_out = NULL;
    return ResultFromScode( hr );
}

HRESULT GetRowsetFromDBSession | ( | IOpenRowset * | pIOpenRowset,
 |  | LPWSTR | pwszTableName,
 |  | IRowset ** | ppIRowset_out
 | ) |  |

**********************************************************************

Definition at line 486 of file sampclnt.cpp.

{
    DBID            dbcolid;
    IRowset*        pIRowset = NULL;
    HRESULT         hr;

    DumpStatusMsg( "Getting a rowset object from the DBSession object...\n" );

    assert(pIOpenRowset != NULL);
    assert(ppIRowset_out  != NULL );

    // tell the provider which table to open
    dbcolid.eKind           = DBKIND_NAME;
    dbcolid.uName.pwszName  = pwszTableName;

    hr = pIOpenRowset->OpenRowset
                        (
                        NULL,                   // pUnkOuter - we are not aggregating
                        &dbcolid,               // pTableID -  the table we want
            NULL,         // pIndexID - the index we want
                        IID_IRowset,            // riid - interface we want on the rowset object
                        0,                      // cProperties - we are niave about props for now
                        NULL,                   // prgProperties[]
                        (IUnknown**)&pIRowset   // ppRowset
                        );
    if (FAILED(hr))
      {
        DUMP_ERROR_LINENUMBER();
        DumpErrorHResult( hr, "IOpenRowset::OpenRowset" );
        goto error;
        }

    // all went well
    *ppIRowset_out = pIRowset;
    return ResultFromScode( S_OK );

error:
    if (pIRowset)
        pIRowset->Release();
    *ppIRowset_out = NULL;

    return ResultFromScode( hr );
}

HRESULT GetSampprovDataSource ( IDBInitialize ** ppIDBInitialize_out )

Definition at line 293 of file sampclnt.cpp.

{
  IDBInitialize*  pIDBInit = NULL;
  IDBProperties*  pIDBProperties = NULL;
  DBPROPSET   dbPropSet[1];
  DBPROP      dbProp[1];

  HRESULT hr;

  DumpStatusMsg( "Connecting to the SampProv sample data provider...\n" );

  assert(ppIDBInitialize_out != NULL);

  VariantInit(&(dbProp[0].vValue));

  // Create an instance of the SampProv sample data provider
  hr = CoCreateInstance( CLSID_SampProv, NULL, CLSCTX_INPROC_SERVER,
        IID_IDBInitialize, (void **)&pIDBInit );
  if (FAILED(hr))
      {
        DUMP_ERROR_LINENUMBER();
        DumpErrorHResult( hr, "CoCreateInstance" );
        goto error;
        }

  // Initialize this provider with the path to the customer.csv file
  dbPropSet[0].rgProperties   = &dbProp[0];
  dbPropSet[0].cProperties    = 1;
  dbPropSet[0].guidPropertySet  = DBPROPSET_DBINIT;

  dbProp[0].dwPropertyID      = DBPROP_INIT_DATASOURCE;
  dbProp[0].dwOptions       = DBPROPOPTIONS_REQUIRED;
  dbProp[0].colid         = DB_NULLID;
  V_VT(&(dbProp[0].vValue))   = VT_BSTR;
  V_BSTR(&(dbProp[0].vValue))   = SysAllocString( L"." );
    if ( NULL == V_BSTR(&(dbProp[0].vValue)) )
        {
        DUMP_ERROR_LINENUMBER();
        DumpErrorMsg( "SysAllocString failed\n" );
        goto error;
        }

    hr = pIDBInit->QueryInterface( IID_IDBProperties, (void**)&pIDBProperties);
    if (FAILED(hr))
      {
        DUMP_ERROR_LINENUMBER();
        DumpErrorHResult( hr, "IDBInitialize::QI for IDBProperties");
        goto error;
        }

  hr = pIDBProperties->SetProperties( 1, &dbPropSet[0]);
  if (FAILED(hr))
      {
        DUMP_ERROR_LINENUMBER();
        DumpErrorHResult( hr, "IDBProperties::SetProperties" );
        goto error;
        }

  hr = pIDBInit->Initialize();
  if (FAILED(hr))
      {
        DUMP_ERROR_LINENUMBER();
        DumpErrorHResult( hr, "IDBInitialize::Initialize" );
        goto error;
        }

  *ppIDBInitialize_out = pIDBInit;

  hr = ResultFromScode( S_OK );

error:
    VariantClear( &(dbProp[0].vValue) );

  if( pIDBProperties )
    pIDBProperties->Release();

  if( FAILED(hr) )
  {
    if (pIDBInit)
        pIDBInit->Release();
    *ppIDBInitialize_out = NULL;
  }

  return hr;
}

void main ( void )

Definition at line 72 of file sampclnt.cpp.

{
  DWORD   dwVersion;
  HRESULT hr;
  time_t  ttime;
    BOOL  fOleInitialized = FALSE;
  char  ch;

    g_fpLogFile = fopen( "sampclnt.out", "at");
    if (!g_fpLogFile)
      {
      DumpErrorMsg( "Warning: cannot open log file sampclnt.out\n" );
        }

    time(&ttime);

    DumpStatusMsg( "\n-------------------------\n\n");
    DumpStatusMsg( "running sampclnt.exe\n%s\n\n", ctime(&ttime) );

  dwVersion = OleBuildVersion();
    if (HIWORD(dwVersion) != rmm)
    {
    DumpErrorMsg( "Error: OLE version mismatch. Build version %ld, current version %ld\n",
      rmm, HIWORD(dwVersion) );
        goto error;
    }

  hr = OleInitialize( NULL );
  if (FAILED(hr))
      {
        DUMP_ERROR_LINENUMBER();
        DumpErrorMsg("Error: OleInitialize failed\n");
        goto error;
    }
  fOleInitialized = TRUE;

    hr = CoGetMalloc( MEMCTX_TASK, &g_pIMalloc );
  if (FAILED(hr))
      {
        DUMP_ERROR_LINENUMBER();
        DumpErrorMsg("Error: CoGetMalloc failed\n");
        goto error;
        }

    hr = DoTests();
  if (FAILED(hr))
      {
        DUMP_ERROR_LINENUMBER();
        DumpErrorHResult( hr, "DoTests");
        goto error;
        }

    g_pIMalloc->Release();
  OleUninitialize();

  if (g_fpLogFile)
      fclose(g_fpLogFile);

  /* Pause before we quit, in case user ran from an icon, so they can see our messages. */
  printf("\n\n>>> Output has gone into 'sampclnt.out'.");
  printf("\n>>> You may wish to use a wide-column editor to view this file.\n\n");
  printf("<press any key to continue>");
  ch = _getch();
  return;

error:
    if (g_pIMalloc)
      g_pIMalloc->Release();
  if (fOleInitialized)
      OleUninitialize();
  if (g_fpLogFile)
      fclose(g_fpLogFile);

  /* Pause before we quit, in case user ran from an icon, so they can see our messages. */
  printf("\n\n>>> Output has gone into 'sampclnt.out'.");
  printf("\n>>> You may wish to use a wide-column editor to view this file.\n\n");
  printf("<press any key to continue>");
  ch = _getch();

  return;
}

HRESULT SetupBindings | ( | ULONG | cCol,
 |  | DBCOLUMNINFO * | pColumnInfo,
 |  | DBBINDING * | rgBind_out,
 |  | ULONG * | pcBind_out,
 |  | ULONG * | pcMaxRowSize_out
 | ) |  |

Definition at line 792 of file sampclnt.cpp.

{
  ULONG dwOffset;
  ULONG iCol;
  ULONG iBind;

    assert(pColumnInfo != NULL);
    assert(rgBind_out != NULL);
    assert(pcBind_out != NULL);
    assert(pcMaxRowSize_out != NULL);

  memset(rgBind_out, 0, sizeof(DBBINDING)*cCol);
  // Create bindings.
  // Bind everything as a string just to keep things simple.
  dwOffset = 0;
  iBind=0;
  for (iCol=0; iCol < cCol; iCol++)
  {
    // Skip columns of type _VECTOR. Probably binary data.
    if (pColumnInfo[iCol].wType & DBTYPE_VECTOR)
      continue;

    rgBind_out[iBind].dwPart  = DBPART_VALUE | DBPART_LENGTH |
                    DBPART_STATUS;
        rgBind_out[iBind].dwMemOwner= DBMEMOWNER_CLIENTOWNED;
        rgBind_out[iBind].eParamIO  = DBPARAMIO_NOTPARAM;
    rgBind_out[iBind].iOrdinal  = pColumnInfo[iCol].iOrdinal;
    rgBind_out[iBind].wType   = DBTYPE_STR;
    rgBind_out[iBind].pTypeInfo = NULL;
    rgBind_out[iBind].obValue   = dwOffset + offsetof(COLUMNDATA,bData);
    rgBind_out[iBind].obLength  = dwOffset + offsetof(COLUMNDATA,dwLength);
    rgBind_out[iBind].obStatus  = dwOffset + offsetof(COLUMNDATA,dwStatus);
    rgBind_out[iBind].bPrecision= 0;
    rgBind_out[iBind].bScale  = 0;
    rgBind_out[iBind].cbMaxLen  = pColumnInfo[iCol].wType == DBTYPE_STR ?
                    pColumnInfo[iCol].ulColumnSize + sizeof(char) : DEFAULT_CBMAXLENGTH;
    rgBind_out[iBind].pObject = NULL;
    rgBind_out[iBind].pBindExt  = NULL;
    dwOffset += rgBind_out[iBind].cbMaxLen + offsetof( COLUMNDATA, bData );
    dwOffset = ROUND_UP( dwOffset, COLUMN_ALIGNVAL );
    iBind++;
  }

  *pcBind_out     = iBind;
  *pcMaxRowSize_out = dwOffset;

  return ResultFromScode( S_OK );
}

Variable Documentation

FILE* g_fpLogFile = NULL

Definition at line 43 of file sampclnt.cpp.

IMalloc* g_pIMalloc = NULL

Definition at line 42 of file sampclnt.cpp.

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampclnt/sampclnt.h File Reference

  • Dataaccess
  • oledb
  • sampclnt
Classes | Defines | Functions | Variables

sampclnt.h File Reference

#include <windows.h>
#include <ole2ver.h>
#include <cguid.h>
#include <stdio.h>
#include <stddef.h>
#include <stdarg.h>
#include <time.h>
#include <assert.h>
#include <conio.h>
#include <oledb.h>
#include <oledberr.h>

Go to the source code of this file.

Classes

struct | COLUMNDATA
struct | Note

Defines

#define | COLUMN_ALIGNVAL 8
#define | DEFAULT_CBMAXLENGTH 40
#define | DUMP_ERROR_LINENUMBER() DumpErrorMsg("Error at file: %s line: %u \n", __FILE__, __LINE__)
#define | INC_OLE2
#define | MAX_BINDINGS 100
#define | MAX_GUID_STRING 42
#define | MAX_NAME_STRING 60
#define | NOTE(s) { (DWORD) s, #s }
#define | NUMELEM(p) (sizeof(p)/sizeof(*p))
#define | NUMROWS_CHUNK 20
#define | PRETTYPRINT_MAXTOTALWIDTH 200
#define | PRETTYPRINT_MINCOLWIDTH 6
#define | ROUND_UP(Size, Amount) (((DWORD)(Size) + ((Amount) - 1)) & ~((Amount) - 1))
#define | WIN32_LEAN_AND_MEAN

Functions

ULONG | CalcPrettyPrintMaxColWidth (DBBINDING *rgBind, ULONG cBind)
HRESULT | CleanupRowset (IRowset *pIRowset, HACCESSOR hAccessor)
HRESULT | CreateAccessor (IRowset *pIRowset, DBBINDING *rgBind, ULONG cBind, HACCESSOR *phAccessor_out)
DEFINE_GUID (CLSID_SampProv, 0xE8CCCB79L, 0x7C36, 0x101B, 0xAC, 0x3A, 0x00, 0xAA, 0x00, 0x44, 0x77, 0x3D)
DEFINE_GUID (DBINIT_OPT_SAMPPROV_PATH, 0xe9fbaf50, 0xd402, 0x11ce, 0xbe, 0xdc, 0x0, 0xaa, 0x0, 0xa1, 0x4d, 0x7d)
HRESULT | DoTests ()
void | DumpColumnHeadings (DBBINDING *rgBind, ULONG cBind, DBCOLUMNINFO *pColInfo, ULONG cCol, ULONG cMaxColWidth)
void | DumpColumnsInfo (DBCOLUMNINFO *pColInfo, ULONG cCol)
HRESULT | DumpErrorHResult (HRESULT hr_return, const char *format,...)
void | DumpErrorMsg (const char *format,...)
void | DumpRow (DBBINDING *rgBind, ULONG cBind, ULONG cMaxColWidth, BYTE *pData)
void | DumpStatusMsg (const char *format,...)
HRESULT | GetColumnsInfo (IRowset *pIRowset, ULONG *pcCol_out, DBCOLUMNINFO **ppColumnInfo_out, WCHAR **ppStringsBuffer_out)
HRESULT | GetData (IRowset *pIRowset, ULONG cMaxRowSize, HACCESSOR hAccessor, DBBINDING *rgBind, ULONG cBind, DBCOLUMNINFO *pColumnInfo, ULONG cCol)
HRESULT | GetDataFromRowset (IRowset *pIRowset)
HRESULT | GetDBSessionFromDataSource (IDBInitialize *pIDBInitialize, IOpenRowset **ppIOpenRowset_out)
char * | GetNoteString (Note *rgNote, int cNote, DWORD dwValue)
char * | GetNoteStringBitvals (Note *rgNote, int cNote, DWORD dwValue)
HRESULT | GetRowsetFromDBSession (IOpenRowset *pIOpenRowset, LPWSTR pwszTableName, IRowset **ppIRowset_out)
HRESULT | GetSampprovDataSource (IDBInitialize **ppIDBInitialize_out)
WCHAR * | LookupColumnName (DBCOLUMNINFO *rgColInfo, ULONG cCol, ULONG iCol)
void | main ()
void | PrintColumn (COLUMNDATA *pColumn, DBBINDING *rgBind, ULONG iBind, ULONG cMaxColWidth)
HRESULT | SetupBindings (ULONG cCol, DBCOLUMNINFO *pColumnInfo, DBBINDING *rgBind_out, ULONG *cBind_out, ULONG *pcMaxRowSize_out)
void | tfprintf (FILE *fp, const char *format,...)
void | tvfprintf (FILE *fp, const char *format, va_list argptr)
void | WriteColumnInfo (FILE *fp, DBCOLUMNINFO *p)

Variables

FILE * | g_fpLogFile
IMalloc * | g_pIMalloc

Define Documentation

#define COLUMN_ALIGNVAL 8

Definition at line 41 of file sampclnt.h.

#define DEFAULT_CBMAXLENGTH 40

Definition at line 47 of file sampclnt.h.

#define DUMP_ERROR_LINENUMBER ( ) DumpErrorMsg("Error at file: %s line: %u \n", __FILE__, __LINE__)

Definition at line 69 of file sampclnt.h.

#define INC_OLE2

Definition at line 16 of file sampclnt.h.

#define MAX_BINDINGS 100

Definition at line 45 of file sampclnt.h.

#define MAX_GUID_STRING 42

Definition at line 43 of file sampclnt.h.

#define MAX_NAME_STRING 60

Definition at line 44 of file sampclnt.h.

#define NOTE ( s ) { (DWORD) s, #s }

Definition at line 94 of file sampclnt.h.

#define NUMELEM ( p ) (sizeof(p)/sizeof(*p))

Definition at line 65 of file sampclnt.h.

#define NUMROWS_CHUNK 20

Definition at line 46 of file sampclnt.h.

#define PRETTYPRINT_MAXTOTALWIDTH 200

Definition at line 51 of file sampclnt.h.

#define PRETTYPRINT_MINCOLWIDTH 6

Definition at line 52 of file sampclnt.h.

#define ROUND_UP | ( | Size,
 |  | Amount |
 | ) |  | (((DWORD)(Size) + ((Amount) - 1)) & ~((Amount) - 1))

Definition at line 62 of file sampclnt.h.

#define WIN32_LEAN_AND_MEAN

Definition at line 15 of file sampclnt.h.

Function Documentation

ULONG CalcPrettyPrintMaxColWidth | ( | DBBINDING * | rgBind,
 |  | ULONG | cBind
 | ) |  |

Definition at line 431 of file dump.cpp.

{
  ULONG cMaxWidth;
    ULONG   cTotalWidth;
    ULONG iBind;

  assert(rgBind != NULL);

  cMaxWidth = DEFAULT_CBMAXLENGTH;
  while (1)
    {
    cTotalWidth = 0;

    for (iBind=0; iBind < cBind; iBind++)
      cTotalWidth += min( cMaxWidth, rgBind[iBind].cbMaxLen ) + 1;

    if (cTotalWidth < PRETTYPRINT_MAXTOTALWIDTH || cMaxWidth < PRETTYPRINT_MINCOLWIDTH)
      break;

    cMaxWidth--;
    }

  return cMaxWidth;
}

HRESULT CleanupRowset | ( | IRowset * | pIRowset,
 |  | HACCESSOR | hAccessor
 | ) |  |

Definition at line 1091 of file sampclnt.cpp.

{
  IAccessor*  pIAccessor = NULL;
  HRESULT   hr;

    assert(pIRowset != NULL);

  // tell the rowset object it can release the accessor, via IAccessor
  hr = pIRowset->QueryInterface( IID_IAccessor, (void**)&pIAccessor );
  if (FAILED(hr))
    {
        DUMP_ERROR_LINENUMBER();
    DumpErrorHResult( hr, "pIRowset->QI for IID_IAccessor" );
    goto error;
    }
  hr = pIAccessor->ReleaseAccessor( hAccessor, NULL );
  if (FAILED(hr))
    {
        DUMP_ERROR_LINENUMBER();
    DumpErrorHResult( hr, "pIAccessor->ReleaseAccessor" );
    goto error;
    }
  pIAccessor->Release();
  pIAccessor = NULL;

  return ResultFromScode( S_OK );

error:
  if (pIAccessor)
      pIAccessor->Release();

    return ResultFromScode( hr );
}

HRESULT CreateAccessor | ( | IRowset * | pIRowset,
 |  | DBBINDING * | rgBind,
 |  | ULONG | cBind,
 |  | HACCESSOR * | phAccessor_out
 | ) |  |

Definition at line 879 of file sampclnt.cpp.

{
  IAccessor*  pIAccessor = NULL;
  HACCESSOR   hAccessor;
  HRESULT   hr;

  assert(pIRowset != NULL);
    assert(rgBind != NULL);
    assert(phAccessor_out != NULL);

    // Get an accessor for our bindings from the rowset, via IAccessor
  hr = pIRowset->QueryInterface( IID_IAccessor, (void**)&pIAccessor );
  if (FAILED(hr))
      {
        DUMP_ERROR_LINENUMBER();
        DumpErrorHResult( hr, "pIRowset->QI for IID_IAccessor" );
        goto error;
        }
  hr = pIAccessor->CreateAccessor( DBACCESSOR_ROWDATA, cBind, rgBind, 0,
                                   &hAccessor, NULL );
  if (FAILED(hr))
      {
        DUMP_ERROR_LINENUMBER();
        DumpErrorHResult( hr, "pIAccessor->CreateAccessor" );
        goto error;
        }
  pIAccessor->Release();
  pIAccessor = NULL;

  *phAccessor_out = hAccessor;

  return ResultFromScode( S_OK );

error:
  if (pIAccessor)
      pIAccessor->Release();
  *phAccessor_out = NULL;

  return ResultFromScode( hr );
}

DEFINE_GUID | ( | CLSID_SampProv | ,
 |  | 0xE8CCCB79L | ,
 |  | 0x7C36 | ,
 |  | 0x101B | ,
 |  | 0xAC | ,
 |  | 0x3A | ,
 |  | 0x00 | ,
 |  | 0xAA | ,
 |  | 0x00 | ,
 |  | 0x44 | ,
 |  | 0x77 | ,
 |  | 0x3D |
 | ) |  |
DEFINE_GUID | ( | DBINIT_OPT_SAMPPROV_PATH | ,
 |  | 0xe9fbaf50 | ,
 |  | 0xd402 | ,
 |  | 0x11ce | ,
 |  | 0xbe | ,
 |  | 0xdc | ,
 |  | 0x0 | ,
 |  | 0xaa | ,
 |  | 0x0 | ,
 |  | 0xa1 | ,
 |  | 0x4d | ,
 |  | 0x7d |
 | ) |  |
HRESULT DoTests ( )

Definition at line 1605 of file ComPerf.Cpp.

{
  if(!AptFreeCOMTest(LOOPS))
    return FALSE;
  if(!AptFreeAutoTest(LOOPS))
    return FALSE;
  if(!FreeFreeCOMTest(LOOPS))
    return FALSE;
  if(!FreeFreeAutoTest(LOOPS))
    return FALSE;
  FPrintResults();
  return TRUE;
} // DoTests

void DumpColumnHeadings | ( | DBBINDING * | rgBind,
 |  | ULONG | cBind,
 |  | DBCOLUMNINFO * | pColInfo,
 |  | ULONG | cCol,
 |  | ULONG | cMaxColWidth
 | ) |  |

Definition at line 462 of file dump.cpp.

{
  ULONG iBind;

  assert(rgBind != NULL);
    assert(pColInfo != NULL);

  for (iBind=0; iBind < cBind; iBind++)
    tfprintf( g_fpLogFile, "%-*.*S ",
      min( cMaxColWidth, rgBind[iBind].cbMaxLen ),
      min( cMaxColWidth, rgBind[iBind].cbMaxLen ),
      LookupColumnName( pColInfo, cCol, rgBind[iBind].iOrdinal ) );
  tfprintf( g_fpLogFile, "\n" );
  for (iBind=0; iBind < cBind; iBind++)
    tfprintf( g_fpLogFile, "%-*.*s ",
      min( cMaxColWidth, rgBind[iBind].cbMaxLen ),
      min( cMaxColWidth, rgBind[iBind].cbMaxLen ),
      "------------------------------" );
  tfprintf( g_fpLogFile, "\n" );
}

void DumpColumnsInfo | ( | DBCOLUMNINFO * | pColInfo,
 |  | ULONG | cCol
 | ) |  |

Definition at line 218 of file dump.cpp.

{
  ULONG j;

  assert(pColInfo != NULL);

  tfprintf( g_fpLogFile, "\nColumn Information:\n\n");

  for (j=0; j < cCol; j++)
    {
    WriteColumnInfo( g_fpLogFile, &pColInfo[j] );
    }
}

HRESULT DumpErrorHResult | ( | HRESULT | hr_return,
 |  | const char * | format,
 |  |  | ...
 | ) |  |

Definition at line 63 of file dump.cpp.

{
  char     buff[100];
  int      cBytesWritten;
  va_list  argptr;

  //
  // Dump an error message.
  // Print the text of the HRESULT,
  // Return the HRESULT we were passed.

    // these result codes were generated from the oledberr.h
  static Note ResultCodes[] = {
    // oledberr.h error codes
    NOTE(DB_E_BADACCESSORHANDLE),
    NOTE(DB_E_BADACCESSORHANDLE),
    NOTE(DB_E_ROWLIMITEXCEEDED),
    NOTE(DB_E_READONLYACCESSOR),
    NOTE(DB_E_SCHEMAVIOLATION),
    NOTE(DB_E_BADROWHANDLE),
    NOTE(DB_E_OBJECTOPEN),
    NOTE(DB_E_BADBINDINFO),
    NOTE(DB_SEC_E_PERMISSIONDENIED),
    NOTE(DB_E_NOTAREFERENCECOLUMN),
    NOTE(DB_E_NOCOMMAND),
    NOTE(DB_E_BADBOOKMARK),
    NOTE(DB_E_BADLOCKMODE),
    NOTE(DB_E_PARAMNOTOPTIONAL),
    NOTE(DB_E_BADRATIO),
    NOTE(DB_E_ERRORSINCOMMAND),
    NOTE(DB_E_BADSTARTPOSITION),
    NOTE(DB_E_NOTREENTRANT),
    NOTE(DB_E_NOAGGREGATION),
    NOTE(DB_E_DELETEDROW),
    NOTE(DB_E_CANTFETCHBACKWARDS),
    NOTE(DB_E_ROWSNOTRELEASED),
    NOTE(DB_E_BADSTORAGEFLAG),
    NOTE(DB_E_BADSTATUSVALUE),
    NOTE(DB_E_CANTSCROLLBACKWARDS),
    NOTE(DB_E_INTEGRITYVIOLATION),
    NOTE(DB_E_ABORTLIMITREACHED),
    NOTE(DB_E_DUPLICATEINDEXID),
    NOTE(DB_E_NOINDEX),
    NOTE(DB_E_INDEXINUSE),
    NOTE(DB_E_NOTABLE),
    NOTE(DB_E_CONCURRENCYVIOLATION),
    NOTE(DB_E_BADCOPY),
    NOTE(DB_E_BADPRECISION),
    NOTE(DB_E_BADSCALE),
    NOTE(DB_E_BADID),
    NOTE(DB_E_BADTYPE),
    NOTE(DB_E_DUPLICATECOLUMNID),
    NOTE(DB_E_DUPLICATETABLEID),
    NOTE(DB_E_TABLEINUSE),
    NOTE(DB_E_NOLOCALE),
    NOTE(DB_E_BADRECORDNUM),
    NOTE(DB_E_BOOKMARKSKIPPED),
    NOTE(DB_E_BADPROPERTYVALUE),
    NOTE(DB_E_INVALID),
    NOTE(DB_E_BADACCESSORFLAGS),
    NOTE(DB_E_BADSTORAGEFLAGS),
    NOTE(DB_E_BYREFACCESSORNOTSUPPORTED),
    NOTE(DB_E_NULLACCESSORNOTSUPPORTED),
    NOTE(DB_E_NOTPREPARED),
    NOTE(DB_E_BADACCESSORTYPE),
    NOTE(DB_E_WRITEONLYACCESSOR),
    NOTE(DB_SEC_E_AUTH_FAILED),
    NOTE(DB_E_CANCELED),
    NOTE(DB_E_BADSOURCEHANDLE),
    NOTE(DB_S_ROWLIMITEXCEEDED),
    NOTE(DB_S_COLUMNTYPEMISMATCH),
    NOTE(DB_S_TYPEINFOOVERRIDDEN),
    NOTE(DB_S_BOOKMARKSKIPPED),
    NOTE(DB_S_ENDOFROWSET),
    NOTE(DB_S_BUFFERFULL),
    NOTE(DB_S_CANTRELEASE),
    NOTE(DB_S_DIALECTIGNORED),
    NOTE(DB_S_UNWANTEDPHASE),
    NOTE(DB_S_COLUMNSCHANGED),
    NOTE(DB_S_ERRORSRETURNED),
    NOTE(DB_S_BADROWHANDLE),
    NOTE(DB_S_DELETEDROW),
    NOTE(DB_S_STOPLIMITREACHED),
    NOTE(DB_S_LOCKUPGRADED),
    NOTE(DB_S_PROPERTIESCHANGED),
    NOTE(DB_S_ERRORSOCCURRED),
    NOTE(DB_S_PARAMUNAVAILABLE),
    NOTE(DB_S_MULTIPLECHANGES),

    // winerr.h
    NOTE(E_UNEXPECTED),
    NOTE(E_NOTIMPL),
    NOTE(E_OUTOFMEMORY),
    NOTE(E_INVALIDARG),
    NOTE(E_NOINTERFACE),
    NOTE(E_POINTER),
    NOTE(E_HANDLE),
    NOTE(E_ABORT),
    NOTE(E_FAIL),
    NOTE(E_ACCESSDENIED),
    NOTE(S_OK),
    NOTE(S_FALSE),
    NOTE(E_UNEXPECTED),
    NOTE(E_NOTIMPL),
    NOTE(E_OUTOFMEMORY),
    NOTE(E_INVALIDARG),
    NOTE(E_NOINTERFACE),
    NOTE(E_POINTER),
    NOTE(E_HANDLE),
    NOTE(E_ABORT),
    NOTE(E_FAIL),
    NOTE(E_ACCESSDENIED),
    // BindMoniker Errors
    NOTE(MK_E_NOOBJECT),
    NOTE(MK_E_EXCEEDEDDEADLINE),
    NOTE(MK_E_CONNECTMANUALLY),
    NOTE(MK_E_INTERMEDIATEINTERFACENOTSUPPORTED),
    NOTE(STG_E_ACCESSDENIED),
    NOTE(MK_E_SYNTAX),
    NOTE(MK_E_CANTOPENFILE),
  };

  // Format the message.
  // Print name of hresult code.

  if (format)
    {
    va_start( argptr, format );
    cBytesWritten = _vsnprintf( buff, sizeof(buff), format, argptr );
    va_end( argptr );
    }
  else
    strcpy( buff, "" );

  // log to stderr and also to our log file
  tfprintf( stderr, "%.*s: Returned %.30s\n",
    sizeof(buff), buff,
    GetNoteString( ResultCodes, NUMELEM(ResultCodes), GetScode(hr_return)) );

    tfprintf( g_fpLogFile, "%.*s: Returned %.30s\n",
    sizeof(buff), buff,
    GetNoteString( ResultCodes, NUMELEM(ResultCodes), GetScode(hr_return)) );

  return ResultFromScode( hr_return );
}

void DumpErrorMsg | ( | const char * | format,
 |  |  | ...
 | ) |  |

Definition at line 24 of file dump.cpp.

{
  va_list argptr;

  assert(format != NULL);

  // log this message to stderr and to our log file
  va_start( argptr, format );
  tvfprintf( stderr, format, argptr);
    tvfprintf( g_fpLogFile, format, argptr);
  va_end( argptr );
}

void DumpRow | ( | DBBINDING * | rgBind,
 |  | ULONG | cBind,
 |  | ULONG | cMaxColWidth,
 |  | BYTE * | pData
 | ) |  |

Definition at line 518 of file dump.cpp.

{
  ULONG     iBind;
    COLUMNDATA* pColumn;

  assert(rgBind);
  assert( offsetof(COLUMNDATA, dwLength) == 0);

  // Print each column we're bound to.
  for (iBind=0; iBind < cBind; iBind++)
    {
    // Columns are bound differently; not so easy.
    // Print out to at least DEFAULT_CBMAXLENGTH width (pretty),
    // Limit to first dwLength characters.

    pColumn = (COLUMNDATA *) (pData + rgBind[iBind].obLength);
    PrintColumn( pColumn, rgBind, iBind, cMaxColWidth );
    }
  tfprintf( g_fpLogFile, "\n" );
}

void DumpStatusMsg | ( | const char * | format,
 |  |  | ...
 | ) |  |

Definition at line 43 of file dump.cpp.

{
  va_list argptr;

  assert(format != NULL);

  // log this message to stdout and to our log file
  va_start( argptr, format );
  tvfprintf( stdout, format, argptr );
    tvfprintf( g_fpLogFile, format, argptr );
  va_end( argptr );
}

HRESULT GetColumnsInfo | ( | IRowset * | pIRowset,
 |  | ULONG * | pcCol_out,
 |  | DBCOLUMNINFO ** | ppColumnInfo_out,
 |  | WCHAR ** | ppStringsBuffer_out
 | ) |  |

Definition at line 697 of file sampclnt.cpp.

{
  IColumnsInfo*   pIColumnsInfo = NULL;
    ULONG     cCol;
    DBCOLUMNINFO* pColumnInfo;
    WCHAR*      pStringsBuffer;
  HRESULT     hr;

  assert(pIRowset != NULL);
    assert(pcCol_out != NULL);
    assert(ppColumnInfo_out != NULL);
    assert(ppStringsBuffer_out != NULL);

  // get column information from the command object via IColumnsInfo
  hr = pIRowset->QueryInterface( IID_IColumnsInfo, (void **) &pIColumnsInfo );
    if (FAILED(hr))
      {
        DUMP_ERROR_LINENUMBER();
        DumpErrorHResult( hr, "IRowset::QI for IID_IColumnsInfo" );
        goto error;
        }
  hr = pIColumnsInfo->GetColumnInfo(
      &cCol,
      &pColumnInfo,
      &pStringsBuffer );
    if (FAILED(hr))
      {
        DUMP_ERROR_LINENUMBER();
        DumpErrorHResult( hr, "pIColumnsInfo->GetColumnInfo" );
        goto error;
        }
  pIColumnsInfo->Release();
  pIColumnsInfo = NULL;

  DumpColumnsInfo( pColumnInfo, cCol );

    // fill out-params
    *pcCol_out = cCol;
    *ppColumnInfo_out = pColumnInfo;
    *ppStringsBuffer_out = pStringsBuffer;

  return ResultFromScode( S_OK );

error:
  if (pIColumnsInfo)
      pIColumnsInfo->Release();

  *pcCol_out = 0;
    *ppColumnInfo_out = NULL;
    *ppStringsBuffer_out = NULL;

  return ResultFromScode( hr );
}

HRESULT GetData | ( | IRowset * | pIRowset,
 |  | ULONG | cMaxRowSize,
 |  | HACCESSOR | hAccessor,
 |  | DBBINDING * | rgBind,
 |  | ULONG | cBind,
 |  | DBCOLUMNINFO * | pColumnInfo,
 |  | ULONG | cCol
 | ) |  |

Definition at line 966 of file sampclnt.cpp.

{
  ULONG   cRowsObtained;
  ULONG iRow;
  BYTE* pRowData = NULL;
  HROW  rghRows[NUMROWS_CHUNK];
  HROW* pRows = &rghRows[0];
  ULONG cMaxColWidth;     // needed for pretty printing
  HRESULT hr;

  assert(pIRowset != NULL);
    assert(rgBind != NULL);
    assert(pColumnInfo != NULL);

  // create a buffer for row data, big enough to hold the biggest row
  pRowData = (BYTE *) malloc( cMaxRowSize );
  if (!pRowData)
    {
        DUMP_ERROR_LINENUMBER();
        DumpErrorMsg("GetData: malloc failed\n");
        goto error;
    }

  // pretty print
    cMaxColWidth = CalcPrettyPrintMaxColWidth( rgBind, cBind );

    // pretty print
  DumpColumnHeadings( rgBind, cBind, pColumnInfo, cCol, cMaxColWidth );

    // process all the rows, NUMROWS_CHUNK rows at a time
  while (1)
    {
    hr = pIRowset->GetNextRows(
      NULL,           // hChapter
      0,              // cRowsToSkip
      NUMROWS_CHUNK,        // cRowsDesired
      &cRowsObtained,             // pcRowsObtained
      &pRows );         // filled in w/ row handles
    if (FAILED(hr))
      {
            DUMP_ERROR_LINENUMBER();
            DumpErrorHResult( hr, "pIRowset->GetNextRows" );
            goto error;
      }

    if ( cRowsObtained == 0 )     // all done, no more rows left to get
      break;

    // loop over rows obtained, getting data for each
    for ( iRow=0; iRow < cRowsObtained; iRow++ )
      {
      hr = pIRowset->GetData(
        rghRows[iRow],
        hAccessor,
        pRowData );
             if (FAILED(hr))
              {
                DUMP_ERROR_LINENUMBER();
                DumpErrorHResult( hr, "pIRowset->GetData" );
                goto error;
              }

      // pretty print
            DumpRow( rgBind, cBind, cMaxColWidth, pRowData );
      }
    // release row handles
    hr = pIRowset->ReleaseRows( cRowsObtained, rghRows, NULL, NULL, NULL );
        if (FAILED(hr))
              {
                DUMP_ERROR_LINENUMBER();
                DumpErrorHResult( hr, "pIRowset->ReleaseRows" );
                goto error;
              }
    } // end while

  // free row data buffer
  free( pRowData );
  return ResultFromScode( S_OK );

error:
  if (pRowData)
    free( pRowData );

    return ResultFromScode( hr );
}

HRESULT GetDataFromRowset ( IRowset * pIRowset )

Definition at line 573 of file sampclnt.cpp.

{
  ULONG       cCol;
  ULONG       cbMaxRowSize;   // buffer size for 1 row's data
  ULONG       cBind;
  DBBINDING   rgBind[MAX_BINDINGS];
  HACCESSOR   hAccessor   = NULL;
  DBCOLUMNINFO* pColumnInfo   = NULL;
  WCHAR*      pStringsBuffer  = NULL;
  HRESULT     hr;

  DumpStatusMsg( "Reading all the data in the rowset...\n" );

  assert(pIRowset != NULL);
  assert(g_pIMalloc != NULL);

  hr = GetColumnsInfo( pIRowset, &cCol, &pColumnInfo, &pStringsBuffer );
  if (FAILED(hr))
      {
        DUMP_ERROR_LINENUMBER();
        DumpErrorHResult( hr,  "GetColumnsInfo");
        goto error;
        }

  hr = SetupBindings( cCol, pColumnInfo, rgBind, &cBind, &cbMaxRowSize );
  if (FAILED(hr))
      {
        DUMP_ERROR_LINENUMBER();
        DumpErrorHResult( hr,  "SetupBindings");
        goto error;
        }

  hr = CreateAccessor( pIRowset, rgBind, cBind, &hAccessor );
  if (FAILED(hr))
      {
        DUMP_ERROR_LINENUMBER();
        DumpErrorHResult( hr,  "CreateAccessor" );
        goto error;
        }

  hr = GetData( pIRowset, cbMaxRowSize, hAccessor, rgBind, cBind, pColumnInfo, cCol );
  if (FAILED(hr))
      {
        DUMP_ERROR_LINENUMBER();
        DumpErrorHResult( hr,  "GetData" );
        goto error;
        }

  g_pIMalloc->Free( pColumnInfo );
    pColumnInfo = NULL;
  g_pIMalloc->Free( pStringsBuffer );
    pStringsBuffer = NULL;

  hr = CleanupRowset( pIRowset, hAccessor );
  if (FAILED(hr))
      {
        DUMP_ERROR_LINENUMBER();
        DumpErrorHResult( hr,  "CleanupRowset" );
        goto error;
        }

  return ResultFromScode( S_OK );

error:
  if (pColumnInfo)
    g_pIMalloc->Free( pColumnInfo );
  if (pStringsBuffer)
    g_pIMalloc->Free( pStringsBuffer );

    return ResultFromScode( hr );
}

HRESULT GetDBSessionFromDataSource | ( | IDBInitialize * | pIDBInitialize,
 |  | IOpenRowset ** | ppIOpenRowset_out
 | ) |  |

Definition at line 412 of file sampclnt.cpp.

{
    IDBCreateSession*   pIDBCreateSession;
    IOpenRowset*        pIOpenRowset;
    HRESULT             hr;

    DumpStatusMsg( "Getting a DBSession object from the data source object...\n" );

    assert(pIDBInitialize != NULL);
    assert(ppIOpenRowset_out  != NULL );

    hr = pIDBInitialize->QueryInterface( IID_IDBCreateSession, (void**)&pIDBCreateSession);
    if (FAILED(hr))
      {
        DUMP_ERROR_LINENUMBER();
        DumpErrorHResult( hr, "IDBInitialize::QI for IDBCreateSession");
        goto error;
        }

    hr = pIDBCreateSession->CreateSession( NULL, IID_IOpenRowset, (IUnknown**)&pIOpenRowset );
    if (FAILED(hr))
      {
        DUMP_ERROR_LINENUMBER();
        DumpErrorHResult( hr, "IDBCreateSession::CreateSession");
        goto error;
        }
     pIDBCreateSession->Release();
     pIDBCreateSession = NULL;

     // all went well
     *ppIOpenRowset_out = pIOpenRowset;
     return ResultFromScode( S_OK );

error:
    if (pIDBCreateSession)
        pIDBCreateSession->Release();

    *ppIOpenRowset_out = NULL;
    return ResultFromScode( hr );
}

char* GetNoteString | ( | Note * | rgNote,
 |  | int | cNote,
 |  | DWORD | dwValue
 | ) |  |

Definition at line 375 of file dump.cpp.

{
  int j;

  assert(rgNote != NULL);

  // Scan a table of value/string,
  // return ptr to string found.

  for (j=0; j < cNote; j++) {
    if (rgNote[j].dwFlag == dwValue)
      return rgNote[j].szText;
  }
  return "<unknown>";
}

char* GetNoteStringBitvals | ( | Note * | rgNote,
 |  | int | cNote,
 |  | DWORD | dwValue
 | ) |  |

Definition at line 402 of file dump.cpp.

{
  static char buff[400];
  int j;

  assert(rgNote != NULL);

  // Make a string that combines all the bits ORed together.

  strcpy(buff, "");
  for (j=0; j < cNote; j++) {
    if (rgNote[j].dwFlag & dwValue) {
      if (buff[0])
        strcat( buff, " | " );
      strcat( buff, rgNote[j].szText );
    }
  }
  assert(strlen(buff) < sizeof(buff));
  return buff;
}

HRESULT GetRowsetFromDBSession | ( | IOpenRowset * | pIOpenRowset,
 |  | LPWSTR | pwszTableName,
 |  | IRowset ** | ppIRowset_out
 | ) |  |

**********************************************************************

Definition at line 486 of file sampclnt.cpp.

{
    DBID            dbcolid;
    IRowset*        pIRowset = NULL;
    HRESULT         hr;

    DumpStatusMsg( "Getting a rowset object from the DBSession object...\n" );

    assert(pIOpenRowset != NULL);
    assert(ppIRowset_out  != NULL );

    // tell the provider which table to open
    dbcolid.eKind           = DBKIND_NAME;
    dbcolid.uName.pwszName  = pwszTableName;

    hr = pIOpenRowset->OpenRowset
                        (
                        NULL,                   // pUnkOuter - we are not aggregating
                        &dbcolid,               // pTableID -  the table we want
            NULL,         // pIndexID - the index we want
                        IID_IRowset,            // riid - interface we want on the rowset object
                        0,                      // cProperties - we are niave about props for now
                        NULL,                   // prgProperties[]
                        (IUnknown**)&pIRowset   // ppRowset
                        );
    if (FAILED(hr))
      {
        DUMP_ERROR_LINENUMBER();
        DumpErrorHResult( hr, "IOpenRowset::OpenRowset" );
        goto error;
        }

    // all went well
    *ppIRowset_out = pIRowset;
    return ResultFromScode( S_OK );

error:
    if (pIRowset)
        pIRowset->Release();
    *ppIRowset_out = NULL;

    return ResultFromScode( hr );
}

HRESULT GetSampprovDataSource ( IDBInitialize ** ppIDBInitialize_out )

Definition at line 293 of file sampclnt.cpp.

{
  IDBInitialize*  pIDBInit = NULL;
  IDBProperties*  pIDBProperties = NULL;
  DBPROPSET   dbPropSet[1];
  DBPROP      dbProp[1];

  HRESULT hr;

  DumpStatusMsg( "Connecting to the SampProv sample data provider...\n" );

  assert(ppIDBInitialize_out != NULL);

  VariantInit(&(dbProp[0].vValue));

  // Create an instance of the SampProv sample data provider
  hr = CoCreateInstance( CLSID_SampProv, NULL, CLSCTX_INPROC_SERVER,
        IID_IDBInitialize, (void **)&pIDBInit );
  if (FAILED(hr))
      {
        DUMP_ERROR_LINENUMBER();
        DumpErrorHResult( hr, "CoCreateInstance" );
        goto error;
        }

  // Initialize this provider with the path to the customer.csv file
  dbPropSet[0].rgProperties   = &dbProp[0];
  dbPropSet[0].cProperties    = 1;
  dbPropSet[0].guidPropertySet  = DBPROPSET_DBINIT;

  dbProp[0].dwPropertyID      = DBPROP_INIT_DATASOURCE;
  dbProp[0].dwOptions       = DBPROPOPTIONS_REQUIRED;
  dbProp[0].colid         = DB_NULLID;
  V_VT(&(dbProp[0].vValue))   = VT_BSTR;
  V_BSTR(&(dbProp[0].vValue))   = SysAllocString( L"." );
    if ( NULL == V_BSTR(&(dbProp[0].vValue)) )
        {
        DUMP_ERROR_LINENUMBER();
        DumpErrorMsg( "SysAllocString failed\n" );
        goto error;
        }

    hr = pIDBInit->QueryInterface( IID_IDBProperties, (void**)&pIDBProperties);
    if (FAILED(hr))
      {
        DUMP_ERROR_LINENUMBER();
        DumpErrorHResult( hr, "IDBInitialize::QI for IDBProperties");
        goto error;
        }

  hr = pIDBProperties->SetProperties( 1, &dbPropSet[0]);
  if (FAILED(hr))
      {
        DUMP_ERROR_LINENUMBER();
        DumpErrorHResult( hr, "IDBProperties::SetProperties" );
        goto error;
        }

  hr = pIDBInit->Initialize();
  if (FAILED(hr))
      {
        DUMP_ERROR_LINENUMBER();
        DumpErrorHResult( hr, "IDBInitialize::Initialize" );
        goto error;
        }

  *ppIDBInitialize_out = pIDBInit;

  hr = ResultFromScode( S_OK );

error:
    VariantClear( &(dbProp[0].vValue) );

  if( pIDBProperties )
    pIDBProperties->Release();

  if( FAILED(hr) )
  {
    if (pIDBInit)
        pIDBInit->Release();
    *ppIDBInitialize_out = NULL;
  }

  return hr;
}

WCHAR* LookupColumnName | ( | DBCOLUMNINFO * | rgColInfo,
 |  | ULONG | cCol,
 |  | ULONG | iCol
 | ) |  |

Definition at line 492 of file dump.cpp.

{
  ULONG j;

  assert(rgColInfo != NULL);

  // A really slow way to get the column name, given the ordinal.
  // The problem is that result-set ordinals do not necessarily match
  // the index into the ColumnInfo array.
  // (May have bookmark, which is always column 0.)

  for (j=0; j < cCol; j++)
    if (rgColInfo[j].iOrdinal == iCol)
      return rgColInfo[j].pwszName;

  return L"Error";
}

void main ( )

Definition at line 14 of file Simple.c.

{
#ifdef JAPAN
        printf ("‚v‚‰‚Ž‚R‚QA‚±‚ê‚ÍŽ–Œ‚¾I");
#else
        printf ("Win32, it's happenin'!");
#endif

        return(0);
}

void PrintColumn | ( | COLUMNDATA * | pColumn,
 |  | DBBINDING * | rgBind,
 |  | ULONG | iBind,
 |  | ULONG | cMaxColWidth
 | ) |  |

Definition at line 549 of file dump.cpp.

{
  void* p;
  ULONG   ulPrintWidth;
  ULONG   ulPrintPrecision;
  DWORD   dwStatus;
  DWORD   dwLength;
  BOOL    fDidVariant;
  BOOL    fIsUnicode;
  char* sFormat;
  HRESULT hr;

    assert(pColumn != NULL);
    assert(rgBind != NULL);

  // Pretty print a column.
  // May have different type of binding.

  fDidVariant = FALSE;
  fIsUnicode  = FALSE;
  dwStatus = pColumn->dwStatus;
  dwLength = pColumn->dwLength;

  if (dwStatus == DBSTATUS_S_ISNULL)
    {
    p = "<null>";
    dwLength = strlen( (char *) p);
    }
    else if (dwStatus == DBBINDSTATUS_UNSUPPORTEDCONVERSION)
        {
        p = "<unsupportedconversion>";
    dwLength = strlen( (char *) p);
        }
  else
    {
    switch (rgBind[iBind].wType)
      {
    case DBTYPE_STR:
      // We have a string in our buffer, so use it.
      p = (void *) &pColumn->bData;
      break;
    case DBTYPE_VARIANT:
      // We have a variant in our buffer, so convert to string.
      p = (void *) &pColumn->bData;
      hr = VariantChangeTypeEx(
          (VARIANT *) p,      // Destination (convert in place)
          (VARIANT *) p,      // Source
          LOCALE_SYSTEM_DEFAULT,  // LCID
          0,            // dwFlags
          VT_BSTR );
      if (FAILED(hr))
              {
        DumpErrorHResult( hr, "VariantChangeTypeEx, field %d", iBind );
                return;
                }
      p = (wchar_t *) (((VARIANT *)p)->bstrVal) ;
      dwLength = ((DWORD *)p)[-1] / sizeof(wchar_t);
      fDidVariant = TRUE;
      fIsUnicode  = TRUE;
      break;
    default:
      p = "??? unknown type ???";
      break;
      }
    }

  // Print the column.
  // If it has been truncated or rounded, print a '#' in
  // the far right-hand column.
  ulPrintWidth     = min( cMaxColWidth, rgBind[iBind].cbMaxLen );
  ulPrintPrecision = min( cMaxColWidth, dwLength );
  if (dwStatus == DBSTATUS_S_TRUNCATED ||  cMaxColWidth < dwLength)
  {
    ulPrintWidth--;
    ulPrintPrecision--;
  }

  sFormat = fIsUnicode ? "%-*.*S" : "%-*.*s";

  tfprintf( g_fpLogFile, sFormat, ulPrintWidth, ulPrintPrecision, p );

  if (dwStatus == DBSTATUS_S_TRUNCATED ||  cMaxColWidth < dwLength)
    tfprintf( g_fpLogFile, "#" );
  tfprintf( g_fpLogFile, " " );

  // Free memory used by the variant.
  if (fDidVariant)
    VariantClear( (VARIANT *) &pColumn->bData );

  return;
}

HRESULT SetupBindings | ( | ULONG | cCol,
 |  | DBCOLUMNINFO * | pColumnInfo,
 |  | DBBINDING * | rgBind_out,
 |  | ULONG * | cBind_out,
 |  | ULONG * | pcMaxRowSize_out
 | ) |  |

Definition at line 792 of file sampclnt.cpp.

{
  ULONG dwOffset;
  ULONG iCol;
  ULONG iBind;

    assert(pColumnInfo != NULL);
    assert(rgBind_out != NULL);
    assert(pcBind_out != NULL);
    assert(pcMaxRowSize_out != NULL);

  memset(rgBind_out, 0, sizeof(DBBINDING)*cCol);
  // Create bindings.
  // Bind everything as a string just to keep things simple.
  dwOffset = 0;
  iBind=0;
  for (iCol=0; iCol < cCol; iCol++)
  {
    // Skip columns of type _VECTOR. Probably binary data.
    if (pColumnInfo[iCol].wType & DBTYPE_VECTOR)
      continue;

    rgBind_out[iBind].dwPart  = DBPART_VALUE | DBPART_LENGTH |
                    DBPART_STATUS;
        rgBind_out[iBind].dwMemOwner= DBMEMOWNER_CLIENTOWNED;
        rgBind_out[iBind].eParamIO  = DBPARAMIO_NOTPARAM;
    rgBind_out[iBind].iOrdinal  = pColumnInfo[iCol].iOrdinal;
    rgBind_out[iBind].wType   = DBTYPE_STR;
    rgBind_out[iBind].pTypeInfo = NULL;
    rgBind_out[iBind].obValue   = dwOffset + offsetof(COLUMNDATA,bData);
    rgBind_out[iBind].obLength  = dwOffset + offsetof(COLUMNDATA,dwLength);
    rgBind_out[iBind].obStatus  = dwOffset + offsetof(COLUMNDATA,dwStatus);
    rgBind_out[iBind].bPrecision= 0;
    rgBind_out[iBind].bScale  = 0;
    rgBind_out[iBind].cbMaxLen  = pColumnInfo[iCol].wType == DBTYPE_STR ?
                    pColumnInfo[iCol].ulColumnSize + sizeof(char) : DEFAULT_CBMAXLENGTH;
    rgBind_out[iBind].pObject = NULL;
    rgBind_out[iBind].pBindExt  = NULL;
    dwOffset += rgBind_out[iBind].cbMaxLen + offsetof( COLUMNDATA, bData );
    dwOffset = ROUND_UP( dwOffset, COLUMN_ALIGNVAL );
    iBind++;
  }

  *pcBind_out     = iBind;
  *pcMaxRowSize_out = dwOffset;

  return ResultFromScode( S_OK );
}

void tfprintf | ( | FILE * | fp,
 |  | const char * | format,
 |  |  | ...
 | ) |  |

Definition at line 650 of file dump.cpp.

{
  int   cBytesWritten;
  char  buff[400];
  va_list argptr;

  assert(format != NULL);

  // Dump a formatted string.
    // _vsnprintf prevents overflowing our buffer.
  va_start( argptr, format );
  cBytesWritten = _vsnprintf( buff, sizeof(buff), format, argptr );
  va_end( argptr );
  buff[sizeof(buff)-1] = '\0';

  // Can't use fprintf, because string could contain '%'.
  if (fp)
    fputs( buff, fp );
}

void tvfprintf | ( | FILE * | fp,
 |  | const char * | format,
 |  | va_list | argptr
 | ) |  |

Definition at line 677 of file dump.cpp.

{
  int   cBytesWritten;
  char  buff[400];

  assert(format != NULL);

  // Dump a formatted string.
    // _vsnprintf prevents overflowing our buffer.
  cBytesWritten = _vsnprintf( buff, sizeof(buff), format, argptr );
  buff[sizeof(buff)-1] = '\0';

  // Can't use fprintf, because string could contain '%'.
  if (fp)
    fputs( buff, fp );
}

void WriteColumnInfo | ( | FILE * | fp,
 |  | DBCOLUMNINFO * | p
 | ) |  |

Definition at line 238 of file dump.cpp.

{
  DBID      *pCol;
    DBKIND      eKind;
  wchar_t   wszGuidBuff[MAX_GUID_STRING];
    wchar_t     wszNameBuff[MAX_GUID_STRING];

  static char *szDbcolkind[] = { "Guid+Name", "Guid+PropID", "Name",
      "Guid+Name", "Guid+PropID", "PropID", "Guid" };

  assert(p != NULL);

  // For DBTYPEENUM.  Doesn't need to be in order.
  // Below we mask off the high bits.
  static Note typenotes[] =
      {
    NOTE(DBTYPE_EMPTY),
    NOTE(DBTYPE_NULL),
    NOTE(DBTYPE_I2),
    NOTE(DBTYPE_I4),
    NOTE(DBTYPE_R4),
    NOTE(DBTYPE_R8),
    NOTE(DBTYPE_CY),
    NOTE(DBTYPE_DATE),
    NOTE(DBTYPE_BSTR),
    NOTE(DBTYPE_IDISPATCH),
    NOTE(DBTYPE_ERROR),
    NOTE(DBTYPE_BOOL),
    NOTE(DBTYPE_VARIANT),
    NOTE(DBTYPE_IUNKNOWN),
    NOTE(DBTYPE_DECIMAL),
    NOTE(DBTYPE_UI1),
    NOTE(DBTYPE_ARRAY),
    NOTE(DBTYPE_BYREF),
    NOTE(DBTYPE_I1),
    NOTE(DBTYPE_UI2),
    NOTE(DBTYPE_UI4),
    NOTE(DBTYPE_I8),
    NOTE(DBTYPE_UI8),
    NOTE(DBTYPE_GUID),
    NOTE(DBTYPE_VECTOR),
    NOTE(DBTYPE_RESERVED),
    NOTE(DBTYPE_BYTES),
    NOTE(DBTYPE_STR),
    NOTE(DBTYPE_WSTR),
    NOTE(DBTYPE_NUMERIC),
    NOTE(DBTYPE_UDT),
    NOTE(DBTYPE_DBDATE),
    NOTE(DBTYPE_DBTIME),
    NOTE(DBTYPE_DBTIMESTAMP),
      };

  static Note flagnotes[] =
      {
    NOTE(DBCOLUMNFLAGS_ISBOOKMARK),
    NOTE(DBCOLUMNFLAGS_MAYDEFER),
    NOTE(DBCOLUMNFLAGS_WRITE),
    NOTE(DBCOLUMNFLAGS_WRITEUNKNOWN),
    NOTE(DBCOLUMNFLAGS_ISFIXEDLENGTH),
    NOTE(DBCOLUMNFLAGS_ISNULLABLE),
    NOTE(DBCOLUMNFLAGS_MAYBENULL),
    NOTE(DBCOLUMNFLAGS_ISLONG),
    NOTE(DBCOLUMNFLAGS_ISROWID),
    NOTE(DBCOLUMNFLAGS_ISROWVER),
    NOTE(DBCOLUMNFLAGS_CACHEDEFERRED),
    };

  pCol = & p->columnid;
    eKind = pCol->eKind;

    // stringize GUID for pretty printing
    switch (eKind)
        {
        case DBKIND_GUID_NAME:
        case DBKIND_GUID_PROPID:
        case DBKIND_GUID:
          StringFromGUID2( pCol->uGuid.guid, wszGuidBuff, sizeof(wszGuidBuff) );
            break;
        case DBKIND_PGUID_NAME:
        case DBKIND_PGUID_PROPID:
          StringFromGUID2( *(pCol->uGuid.pguid), wszGuidBuff, sizeof(wszGuidBuff) );
            break;
        default:
            wcscpy( wszGuidBuff, L"<none>" );
            break;
        }

    // stringize name or propID for pretty printing
    switch (eKind)
        {
        case DBKIND_GUID_NAME:
        case DBKIND_NAME:
        case DBKIND_PGUID_NAME:
            swprintf( wszNameBuff, L"[name=%.50S]", pCol->uName.pwszName ? pCol->uName.pwszName : L"(unknown)" );
            break;
        case DBKIND_GUID_PROPID:
        case DBKIND_PGUID_PROPID:
        case DBKIND_PROPID:
            swprintf( wszNameBuff, L"[propid=%lu]", pCol->uName.ulPropid );
            break;
        default:
            wcscpy( wszNameBuff, L"" );
            break;
        }

    // pretty print column info
    tfprintf( fp, "ColumnId [kind=%.40s] [guid=%.40S] %.60S\n",
        szDbcolkind[eKind], wszGuidBuff, wszNameBuff );

  // Now move on to other stuff...
  // Name in DBCOLUMNINFO different than name in DBCOLUMNID (maybe).
  tfprintf(fp, "  Name          = '%.50S'\n", p->pwszName );
  tfprintf(fp, "  iOrdinal      = %d\n", p->iOrdinal);
  tfprintf(fp, "  wType         = %.100s\n",
    GetNoteString( typenotes, NUMELEM(typenotes),
        p->wType & (~DBTYPE_BYREF) & (~DBTYPE_ARRAY) & (~DBTYPE_VECTOR) ) );
  if (p->wType & DBTYPE_BYREF)
    tfprintf(fp, "      (BYREF)\n");
  if (p->wType & DBTYPE_ARRAY)
    tfprintf(fp, "      (ARRAY)\n");
  if (p->wType & DBTYPE_VECTOR)
    tfprintf(fp, "      (VECTOR)\n");
  tfprintf(fp, "  ulColumnSize  = %ld\n", p->ulColumnSize );
  tfprintf(fp, "  bPrecision    = %d\n",  p->bPrecision );
  tfprintf(fp, "  bScale        = %d\n",  p->bScale );
  tfprintf(fp, "  dwFlags       = %s\n\n",
    GetNoteStringBitvals( flagnotes, NUMELEM(flagnotes), p->dwFlags ) );

}

Variable Documentation

FILE* g_fpLogFile

Definition at line 43 of file sampclnt.cpp.

IMalloc* g_pIMalloc

Definition at line 42 of file sampclnt.cpp.

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampclnt/sampver.h File Reference

  • Dataaccess
  • oledb
  • sampclnt
Defines

sampver.h File Reference

Go to the source code of this file.

Defines

#define | VER_COMPANYNAME_STR "Microsoft Corporation\0"
#define | VER_FILEFLAGS (0)
#define | VER_FILEFLAGSMASK (VS_FF_DEBUG | VS_FF_PRERELEASE)
#define | VER_FILEOS VOS_NT_WINDOWS32
#define | VER_FILEVERSION 2,50,4809.0
#define | VER_FILEVERSION_STR "2.50.4809.0\0"
#define | VER_LEGALCOPYRIGHT_STR "Copyright \251 Microsoft Corporation 1991-2000\0"
#define | VER_PRODUCTNAME_STR "Microsoft OLE DB\0"
#define | VER_PRODUCTVERSION 2,50,4809.0
#define | VER_PRODUCTVERSION_STR "2.50.4809.0\0"

Define Documentation

#define VER_COMPANYNAME_STR "Microsoft Corporation\0"

Definition at line 29 of file sampver.h.

#define VER_FILEFLAGS (0)

Definition at line 24 of file sampver.h.

#define VER_FILEFLAGSMASK (VS_FF_DEBUG | VS_FF_PRERELEASE)

Definition at line 20 of file sampver.h.

#define VER_FILEOS VOS_NT_WINDOWS32

Definition at line 27 of file sampver.h.

#define VER_FILEVERSION 2,50,4809.0

Definition at line 15 of file sampver.h.

#define VER_FILEVERSION_STR "2.50.4809.0\0"

Definition at line 16 of file sampver.h.

#define VER_LEGALCOPYRIGHT_STR "Copyright \251 Microsoft Corporation 1991-2000\0"

Definition at line 31 of file sampver.h.

#define VER_PRODUCTNAME_STR "Microsoft OLE DB\0"

Definition at line 30 of file sampver.h.

#define VER_PRODUCTVERSION 2,50,4809.0

Definition at line 17 of file sampver.h.

#define VER_PRODUCTVERSION_STR "2.50.4809.0\0"

Definition at line 18 of file sampver.h.

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/accessor.cpp File Reference

  • Dataaccess
  • oledb
  • sampprov

accessor.cpp File Reference

#include "headers.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/accessor.h File Reference

  • Dataaccess
  • oledb
  • sampprov
Classes

accessor.h File Reference

Go to the source code of this file.

Classes

class CImpIAccessor
Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/asserts.cpp File Reference

  • Dataaccess
  • oledb
  • sampprov
Functions

asserts.cpp File Reference

#include "headers.h"
#include <time.h>
#include "asserts.h"

Go to the source code of this file.

Functions

HRESULT | ConvertToMBCS (WCHAR *pwsz, CHAR *psz, ULONG cStrLen)
HRESULT | ConvertToWCHAR (CHAR *psz, WCHAR *pwsz, ULONG cStrLen)
HRESULT | FreeProperties (ULONG *pcProperties, DBPROP **prgProperties)
HRESULT | FreeProperties (ULONG *pcPropSets, DBPROPSET **prgPropSets)
LRESULT | wSendMessage (HWND hWnd, UINT Msg, WPARAM wParam, WCHAR *pwszBuffer)

Function Documentation

HRESULT ConvertToMBCS | ( | WCHAR * | pwsz,
 |  | CHAR * | psz,
 |  | ULONG | cStrLen
 | ) |  |

Definition at line 47 of file asserts.cpp.

{
  ASSERT(psz);

  //No-op
  if(pwsz==NULL)
  {
    psz[0] = EOL;
    return S_FALSE;
  }

  //Convert the string to MBCS
  //NOTE:  WideCharToMultiByte returns 0 if truncation occurs!  So when iResult = 0
  //you can be assured the amount copied is the maximum length of the buffer...
  INT iResult = WideCharToMultiByte(CP_OEMCP, 0, pwsz, -1, psz, cStrLen, NULL, NULL);
  return iResult ? S_OK : E_FAIL;
}

HRESULT ConvertToWCHAR | ( | CHAR * | psz,
 |  | WCHAR * | pwsz,
 |  | ULONG | cStrLen
 | ) |  |

Definition at line 69 of file asserts.cpp.

{
  ASSERT(pwsz);

  //No-op
  if(psz==NULL)
  {
    pwsz[0] = wEOL;
    return S_FALSE;
  }

  //Convert the string to MBCS
  //NOTE:  MultiByteToWideChar returns 0 if truncation occurs!  So when iResult = 0
  //you can be assured the amount copied is the maximum length of the buffer...
  INT iResult = MultiByteToWideChar(CP_OEMCP, 0, psz, -1, pwsz, cStrLen);
  return iResult ? S_OK : E_FAIL;
}

HRESULT FreeProperties | ( | ULONG * | pcProperties,
 |  | DBPROP ** | prgProperties
 | ) |  |

Definition at line 93 of file asserts.cpp.

{
  ASSERT(pcProperties);
  ASSERT(prgProperties);
  HRESULT hr = S_OK;

  //no-op case
  if(*pcProperties==0 || *prgProperties==NULL)
    return S_OK;

  //Free the inner variants first
  for(ULONG i=0; i<*pcProperties; i++)
  {
    //if DBPROPSTATUS_NOTSUPPORTED then vValue is undefined
    if((*prgProperties)[i].dwStatus != DBPROPSTATUS_NOTSUPPORTED)
      TESTC(hr = VariantClear(&((*prgProperties)[i].vValue)));
  }

CLEANUP:
  //Now NULL the set
  *pcProperties = 0;
  SAFE_FREE(*prgProperties);
  return hr;
}

HRESULT FreeProperties | ( | ULONG * | pcPropSets,
 |  | DBPROPSET ** | prgPropSets
 | ) |  |

Definition at line 122 of file asserts.cpp.

{
  ASSERT(pcPropSets);
  ASSERT(prgPropSets);
  HRESULT hr = S_OK;

  //Loop over all the property sets
  for(ULONG i=0; i<*pcPropSets; i++)
    FreeProperties(&((*prgPropSets)[i].cProperties), &((*prgPropSets)[i].rgProperties));

  //Now NULL the outer set
  *pcPropSets = 0;
  SAFE_FREE(*prgPropSets);
  return hr;
}

LRESULT wSendMessage | ( | HWND | hWnd,
 |  | UINT | Msg,
 |  | WPARAM | wParam,
 |  | WCHAR * | pwszBuffer
 | ) |  |

Definition at line 18 of file asserts.cpp.

{
  CHAR szBuffer[MAX_QUERY_LEN];
  szBuffer[0] = EOL;

  if(pwszBuffer && Msg != WM_GETTEXT && Msg != CB_GETLBTEXT)
  {
    //Convert to ANSI before sending, since we don't know if this was a GET/SET message
    ConvertToMBCS(pwszBuffer, szBuffer, MAX_QUERY_LEN);
  }

  //Send the message with an ANSI Buffer
  LRESULT lResult = SendMessageA(hWnd, Msg, (WPARAM)wParam, (LPARAM)szBuffer);

  if(pwszBuffer && Msg == WM_GETTEXT || Msg == CB_GETLBTEXT)
  {
    //Now convert the result into the users WCHAR buffer
    // 64 bit TODO
    ConvertToWCHAR(szBuffer, pwszBuffer, (ULONG)(Msg == WM_GETTEXT ? wParam : MAX_QUERY_LEN));
  }
  return lResult;
}

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/asserts.h File Reference

  • Dataaccess
  • oledb
  • sampprov
Defines | Functions

asserts.h File Reference

#include <crtdbg.h>

Go to the source code of this file.

Defines

#define | ASSERT _ASSERTE
#define | assert ASSERT
#define | DEBUGCODE(p)
#define | TRACE OLEDB_Trace

Functions

HRESULT | ConvertToMBCS (WCHAR *pwsz, CHAR *psz, ULONG cStrLen)
HRESULT | ConvertToWCHAR (CHAR *psz, WCHAR *pwsz, ULONG cStrLen)
HRESULT | FreeProperties (ULONG *pcProperties, DBPROP **prgProperties)
HRESULT | FreeProperties (ULONG *pcPropSets, DBPROPSET **prgPropSets)
void | OLEDB_Trace (const char *format,...)
LRESULT | wSendMessage (HWND hWnd, UINT Msg, WPARAM wParam, WCHAR *pwszBuffer)

Define Documentation

#define ASSERT _ASSERTE

Definition at line 37 of file asserts.h.

#define assert ASSERT

Definition at line 38 of file asserts.h.

#define DEBUGCODE ( p )

Definition at line 46 of file asserts.h.

#define TRACE OLEDB_Trace

Definition at line 44 of file asserts.h.

Function Documentation

HRESULT ConvertToMBCS | ( | WCHAR * | pwsz,
 |  | CHAR * | psz,
 |  | ULONG | cStrLen
 | ) |  |

Definition at line 47 of file asserts.cpp.

{
  ASSERT(psz);

  //No-op
  if(pwsz==NULL)
  {
    psz[0] = EOL;
    return S_FALSE;
  }

  //Convert the string to MBCS
  //NOTE:  WideCharToMultiByte returns 0 if truncation occurs!  So when iResult = 0
  //you can be assured the amount copied is the maximum length of the buffer...
  INT iResult = WideCharToMultiByte(CP_OEMCP, 0, pwsz, -1, psz, cStrLen, NULL, NULL);
  return iResult ? S_OK : E_FAIL;
}

HRESULT ConvertToWCHAR | ( | CHAR * | psz,
 |  | WCHAR * | pwsz,
 |  | ULONG | cStrLen
 | ) |  |

Definition at line 69 of file asserts.cpp.

{
  ASSERT(pwsz);

  //No-op
  if(psz==NULL)
  {
    pwsz[0] = wEOL;
    return S_FALSE;
  }

  //Convert the string to MBCS
  //NOTE:  MultiByteToWideChar returns 0 if truncation occurs!  So when iResult = 0
  //you can be assured the amount copied is the maximum length of the buffer...
  INT iResult = MultiByteToWideChar(CP_OEMCP, 0, psz, -1, pwsz, cStrLen);
  return iResult ? S_OK : E_FAIL;
}

HRESULT FreeProperties | ( | ULONG * | pcProperties,
 |  | DBPROP ** | prgProperties
 | ) |  |

Definition at line 1116 of file property.cpp.

{
  ASSERT(pcProperties);
  ASSERT(prgProperties);
  HRESULT hr = S_OK;

  //no-op case
  if(*pcProperties==0 || *prgProperties==NULL)
    return S_OK;

  //Free the inner variants first
  for(ULONG iProp=0; iProp<*pcProperties; iProp++)
  {
    DBPROP* pProp = &((*prgProperties)[iProp]);
    XTEST(hr = VariantClearFast(&pProp->vValue));
  }

  //Now NULL the set
  *pcProperties = 0;
  SAFE_FREE(*prgProperties);
  return hr;
}

HRESULT FreeProperties | ( | ULONG * | pcPropSets,
 |  | DBPROPSET ** | prgPropSets
 | ) |  |

Definition at line 1143 of file property.cpp.

{
  ASSERT(pcPropSets);
  ASSERT(prgPropSets);
  HRESULT hr = S_OK;

  //Loop over all the property sets
  for(ULONG iPropSet=0; iPropSet<*pcPropSets; iPropSet++)
  {
    DBPROPSET* pPropSet = &((*prgPropSets)[iPropSet]);
    FreeProperties(&pPropSet->cProperties, &pPropSet->rgProperties);
  }

  //Now NULL the outer set
  *pcPropSets = 0;
  SAFE_FREE(*prgPropSets);
  return hr;
}

void OLEDB_Trace | ( | const char * | format,
 |  |  | ... |
 | ) |  |  | [inline]

Definition at line 45 of file asserts.h.

{ /* do nothing */ }

LRESULT wSendMessage | ( | HWND | hWnd,
 |  | UINT | Msg,
 |  | WPARAM | wParam,
 |  | WCHAR * | pwszBuffer
 | ) |  |

Definition at line 2973 of file common.cpp.

{
  LRESULT lResult = 0;
  HRESULT hr = S_OK;

  if(IsUnicodeOS())
  {
    //WinNT - Unicode, no need for conversions...
    lResult = SendMessageW(hWnd, Msg, (WPARAM)wParam, (LPARAM)pwszText);
  }
  else
  {
    //Win95 - Unicode not supported...
    CHAR szBuffer[MAX_QUERY_LEN] = { 0, 0, 0, 0 };
    ULONG ulDestSize = MAX_QUERY_LEN;
    CHAR* psz = szBuffer;

    //All messages that have [input] strings
    switch(Msg)
    {
      case EM_GETLINE:
        ((WORD*)psz)[0] = MAX_QUERY_LEN;
        break;

      case WM_GETTEXT:
        //We may need to dynamically allocate this...
        if(wParam > MAX_QUERY_LEN)
          SAFE_ALLOC(psz, CHAR, wParam);
        break;

      case EM_GETSELTEXT:
        ASSERT(wParam && "wSendMessage EM_GETSELTEXT requires a length so the conversion buffer so it doesn't overflow...");
        ulDestSize = (ULONG)wParam;

        //We may need to dynamically allocate this...
        if(wParam > MAX_QUERY_LEN)
          SAFE_ALLOC(psz, CHAR, wParam);
        wParam = 0;
        break;

      case SB_SETTEXTW:
        Msg = SB_SETTEXT;

      case WM_SETTEXT:
      case EM_REPLACESEL:
      case CB_FINDSTRINGEXACT:
      case CB_FINDSTRING:
      case CB_ADDSTRING:
      case LB_ADDSTRING:
      case SB_SETTEXTA:
        //Convert to ANSI before sending
        //We may need to dynamically allocate this...
        if(!ConvertToMBCS(pwszText, psz, MAX_QUERY_LEN))
          psz = ConvertToMBCS(pwszText);
        break;
    };

    //Send the message with an ANSI Buffer
    lResult = SendMessageA(hWnd, Msg, (WPARAM)wParam, (LPARAM)psz);

    //All messages that have [output] messages (return strings)
    switch(Msg)
    {
      case WM_GETTEXT:
        //Now convert the result into the users WCHAR buffer
        //wParam indicates the max length
        ConvertToWCHAR(psz, pwszText, (INT)wParam);
        break;

      case EM_GETLINE:
        //Now convert the result into the users WCHAR buffer
        ASSERT(pwszText);
        ConvertToWCHAR(psz, pwszText, ((WORD*)pwszText)[0]);
        break;

      case CB_GETLBTEXT:
      case EM_GETSELTEXT:
      case LB_GETTEXT:
        //Now convert the result into the users WCHAR buffer
        ConvertToWCHAR(psz, pwszText, ulDestSize);
        break;
    };

    //Free any dynamically allocated memory
    if(psz != szBuffer)
      SAFE_FREE(psz);
  }

CLEANUP:
  return lResult;
}

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/baseobj.cpp File Reference

  • Dataaccess
  • oledb
  • sampprov

baseobj.cpp File Reference

#include "headers.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/baseobj.h File Reference

  • Dataaccess
  • oledb
  • sampprov
Classes | Enumerations

baseobj.h File Reference

Go to the source code of this file.

Classes

class CBaseObj

Enumerations

enum EBaseObjectType {
BOT_UNDEFINED, BOT_DATASOURCE, BOT_COMMAND, BOT_ROWSET,
BOT_SESSION, BOT_ROW, BOT_STREAM, BOT_BINDER
}

Enumeration Type Documentation

enum EBaseObjectType
Enumerator:
BOT_UNDEFINED
BOT_DATASOURCE
BOT_COMMAND
BOT_ROWSET
BOT_SESSION
BOT_ROW
BOT_STREAM
BOT_BINDER

Definition at line 19 of file baseobj.h.

{
  BOT_UNDEFINED,
  BOT_DATASOURCE,
  BOT_COMMAND,
  BOT_ROWSET,
  BOT_SESSION,
  BOT_ROW,
  BOT_STREAM,
  BOT_BINDER,
};

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/binder.cpp File Reference

  • Dataaccess
  • oledb
  • sampprov
Functions | Variables

binder.cpp File Reference

#include "headers.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (DBREFCOUNT) CBinder
STDMETHODIMP_ (ULONG) CBinder

Variables

WCHAR | g_wszDataSourceKeyword [] = "DataSource"
WCHAR | g_wszFileKeyword [] = "File"
WCHAR | g_wszRowKeyword [] = "Row"

Function Documentation

STDMETHODIMP_ ( DBREFCOUNT )

Definition at line 138 of file binder.cpp.

{
    return ++m_cRef;
}

STDMETHODIMP_ ( ULONG )

Definition at line 157 of file binder.cpp.

{
    if (!--m_cRef)
        {
        delete this;
        return 0;
        }

    return m_cRef;
}

Variable Documentation

WCHAR g_wszDataSourceKeyword[] = "DataSource"

Definition at line 16 of file binder.cpp.

WCHAR g_wszFileKeyword[] = "File"

Definition at line 17 of file binder.cpp.

WCHAR g_wszRowKeyword[] = "Row"

Definition at line 18 of file binder.cpp.

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/binder.h File Reference

  • Dataaccess
  • oledb
  • sampprov
Classes | Typedefs

binder.h File Reference

#include "baseobj.h"

Go to the source code of this file.

Classes

class | CBinder
class | CImpIBindResource
class | CImpICreateRow
class | CImpIDBBinderProperties

Typedefs

typedef CBinder * | PCBINDER
typedef CImpIBindResource * | PIMPIBINDRESOURCE
typedef CImpICreateRow * | PIMPICREATEROW
typedef CImpIDBBinderProperties * | PIMPIDBBINDERPROPERTIES

Typedef Documentation

typedef CBinder* PCBINDER

Definition at line 77 of file binder.h.

typedef CImpIBindResource* PIMPIBINDRESOURCE

Definition at line 22 of file binder.h.

typedef CImpICreateRow* PIMPICREATEROW

Definition at line 26 of file binder.h.

typedef CImpIDBBinderProperties* PIMPIDBBINDERPROPERTIES

Definition at line 25 of file binder.h.

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/bitarray.cpp File Reference

  • Dataaccess
  • oledb
  • sampprov

bitarray.cpp File Reference

#include "headers.h"
#include "bitarray.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/bitarray.h File Reference

  • Dataaccess
  • oledb
  • sampprov
Classes | Typedefs | Variables

bitarray.h File Reference

Go to the source code of this file.

Classes

class | CBitArray

Typedefs

typedef CBitArray FAR * | LPBITARRAY

Variables

class FAR | CBitArray

Typedef Documentation

typedef CBitArray FAR* LPBITARRAY

Definition at line 15 of file bitarray.h.

Variable Documentation

class FAR CBitArray

Definition at line 14 of file bitarray.h.

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/classfac.cpp File Reference

  • Dataaccess
  • oledb
  • sampprov
Functions

classfac.cpp File Reference

#include "headers.h"
#include "classfac.h"
#include "msdasc.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
HRESULT CALLBACK | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)
BOOL WINAPI | DllMain (HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)
STDMETHODIMP_ (DBREFCOUNT) CClassFactory

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 205 of file classfac.cpp.

{
    if (!g_cObj && !g_cLock)
        return ResultFromScode( S_OK );
    else
        return ResultFromScode( S_FALSE );
}

HRESULT CALLBACK DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 154 of file classfac.cpp.

{
    CClassFactory * pClassFactory;
    HRESULT         hr;

    // Check for valid ppvObj pointer
    if (!ppvObj)
        return ResultFromScode( E_INVALIDARG );

    // In case we fail, we need to zero output arguments
    *ppvObj = NULL;

    // We only service CLSID_SampProv
    if (rclsid != CLSID_SampProv &&
    rclsid != CLSID_SampProvConnectionPage &&
    rclsid != CLSID_SampProvAdvancedPage &&
    rclsid != CLSID_SampProvBinder)
        return ResultFromScode( CLASS_E_CLASSNOTAVAILABLE );

    // We only support the IUnknown and IClassFactory interfaces
    if (riid != IID_IUnknown &&
        riid != IID_IClassFactory)
        return ResultFromScode( E_NOINTERFACE );

    // Create our ClassFactory object
    pClassFactory = new CClassFactory(rclsid);
    if (pClassFactory == NULL)
        return ResultFromScode( E_OUTOFMEMORY );

    // Get the desired interface on this object
    hr = pClassFactory->QueryInterface( riid, ppvObj );
    if (!SUCCEEDED( hr ))
        SAFE_DELETE( pClassFactory );

    return hr;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstDLL,
 |  | DWORD | fdwReason,
 |  | LPVOID | lpvReserved
 | ) |  |

Definition at line 82 of file classfac.cpp.

{
    BOOL        fRetVal = FALSE;
    SYSTEM_INFO SystemInformation;

    switch (fdwReason)
        {
    case DLL_PROCESS_ATTACH:

        // Assume successfully initialized
        fRetVal = TRUE;

        // Do one-time initialization when first process attaches
        if (!g_cAttachedProcesses)
            {
            g_hInstance = hInstDLL;

            // Get the system page size
            if (!g_dwPageSize)
                {
                GetSystemInfo( &SystemInformation );    // can't fail
                g_dwPageSize = SystemInformation.dwPageSize;
                }
            }

        // Do per-process initialization here...

        // Remember that another process successfully attached
        g_cAttachedProcesses++;
        break;

    case DLL_PROCESS_DETACH:
        // Clean up when the last process is going away
        if (g_cAttachedProcesses == 1)
            {
            }

        // Do per-process clean up here...

        // Remember that a process has detached
        g_cAttachedProcesses--;
        break;

    case DLL_THREAD_ATTACH:
        break;

    case DLL_THREAD_DETACH:
        break;
        }

    return fRetVal;
}

STDAPI DllRegisterServer ( void )

Definition at line 502 of file classfac.cpp.

{
    HKEY        hk;
    HMODULE     hModule;
    DWORD       dwDisposition;
    LONG        stat;
  CHAR    strFileName[MAX_PATH+1];
    CHAR        strOutBuff[300+1];
  HRESULT   hr = S_OK;

    // Get the full path name for this DLL.
    if (NULL == (hModule = GetModuleHandle( s_strDllName )))
        return ResultFromScode( E_FAIL );
    if (0 == GetModuleFileName( hModule, strFileName, sizeof( strFileName ) / sizeof( char )))
        return ResultFromScode( E_FAIL );

    // Make a clean start
    DllUnregisterServer();

    // Loop through s_rgRegInfo, and put everything in it.
    // Every entry is based on HKEY_CLASSES_ROOT.
    for (ULONG i=0; i < NUMELEM( s_rgRegInfo ); i++)
        {

    // Fill in any "%s" arguments with the name of this DLL.
    if (s_rgRegInfo[i].dwType == REG_DWORD)
      *(DWORD*)strOutBuff = atol( s_rgRegInfo[i].strValue );
    else
      wsprintf( strOutBuff, s_rgRegInfo[i].strValue, strFileName );

        // Create the Key.  If it exists, we open it.
        // Thus we can still change the value below.
        stat = RegCreateKeyEx(
                HKEY_CLASSES_ROOT,
                s_rgRegInfo[i].strRegKey,
                0,  // dwReserved
                NULL,   // lpszClass
                REG_OPTION_NON_VOLATILE,
                KEY_ALL_ACCESS, // security access mask
                NULL,   // lpSecurityAttributes
                &hk,    // phkResult
                &dwDisposition );
        if (stat != ERROR_SUCCESS)
            return ResultFromScode( E_FAIL );

        stat = RegSetValueEx(
                hk,               // created above
                s_rgRegInfo[i].strValueName,  // lpszValueName
                0,                // dwReserved
                s_rgRegInfo[i].dwType,      // fdwType
        (BYTE *) strOutBuff,      // value
                s_rgRegInfo[i].dwType == REG_SZ ?
                strlen( strOutBuff ) + 1 :    // cbData, including null terminator
        sizeof(DWORD));
        RegCloseKey( hk );
        if (stat != ERROR_SUCCESS)
            return ResultFromScode( E_FAIL );
        }

  IRegisterProvider*  pIRegisterProvider = NULL;
  //Register with the RootBinder
  if(SUCCEEDED(CoCreateInstance(CLSID_RootBinder, NULL, CLSCTX_ALL, IID_IRegisterProvider, (void**)&pIRegisterProvider)))
  {
    //Register Sampprov's URL prefix with the RootBinder
    hr = pIRegisterProvider->SetURLMapping(SAMPPROV_URL_PREFIX, 0, CLSID_SampProvBinder);
    pIRegisterProvider->Release();
  }

    return ResultFromScode( hr );
}

STDAPI DllUnregisterServer ( void )

Definition at line 453 of file classfac.cpp.

{
    int     i;
    int     iNumErrors = 0;
  LONG  stat;

    // Delete all table entries.  Loop in reverse order, since they
    // are entered in a basic-to-complex order.
    // We cannot delete a key that has subkeys.
    // Ignore errors.
    for (i=NUMELEM( s_rgRegInfo ) - 1; i >= 0; i--)
        {
    stat = RegDeleteKey( HKEY_CLASSES_ROOT, s_rgRegInfo[i].strRegKey );
        if ((stat != ERROR_SUCCESS) &&
          (stat != ERROR_FILE_NOT_FOUND) )
            iNumErrors++;
        }

  IRegisterProvider*  pIRegisterProvider = NULL;
  //Obtain the Root Binder
  if(SUCCEEDED(CoCreateInstance(CLSID_RootBinder, NULL, CLSCTX_ALL, IID_IRegisterProvider, (void**)&pIRegisterProvider)))
  {
    //Unregister SampProv's URL prefix with the RootBinder
    //NOTE:  Don't fail, since we may have never registered ourselves with the root binder
    pIRegisterProvider->UnregisterProvider(SAMPPROV_URL_PREFIX, 0, CLSID_SampProvBinder);
    pIRegisterProvider->Release();
  }

    return ResultFromScode( iNumErrors ? E_FAIL : S_OK );
}

STDMETHODIMP_ ( DBREFCOUNT )

Definition at line 302 of file classfac.cpp.

{
    if (!--m_cRef)
        {
        delete this;
        return 0;
        }

    return m_cRef;
}

Variable Documentation

DWORD dwType

Definition at line 25 of file classfac.cpp.

char* strRegKey

Definition at line 23 of file classfac.cpp.

char* strValue

Definition at line 26 of file classfac.cpp.

char* strValueName

Definition at line 24 of file classfac.cpp.

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/classfac.h File Reference

  • Dataaccess
  • oledb
  • sampprov
Classes

classfac.h File Reference

Go to the source code of this file.

Classes

class CClassFactory
Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/colinfo.cpp File Reference

  • Dataaccess
  • oledb
  • sampprov

colinfo.cpp File Reference

#include "headers.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/command.cpp File Reference

  • Dataaccess
  • oledb
  • sampprov
Functions

command.cpp File Reference

#include "headers.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (DBREFCOUNT) CCommand

Function Documentation

STDMETHODIMP_ ( DBREFCOUNT )

Definition at line 216 of file command.cpp.

{
    if (!--m_cRef)
        {
        delete this;
        return 0;
        }

    return m_cRef;
}

Generated on Wed Nov 13 2024 16:53:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/command.h File Reference

  • Dataaccess
  • oledb
  • sampprov
Classes | Typedefs | Enumerations

command.h File Reference

#include "baseobj.h"
#include "dbsess.h"

Go to the source code of this file.

Classes

class | CCommand
class | CImpICommandProperties
class | CImpICommandText

Typedefs

typedef CCommand * | PCCOMMAND
typedef CImpIColumnsInfo * | PIMPICOLUMNSINFO
typedef CImpICommandProperties * | PIMPICOMMANDPROPERTIES
typedef CImpICommandText * | PIMPICOMMANDTEXT
typedef CImpIConvertType * | PIMPICONVERTTYPE

Enumerations

enum COMMAND_STATUS_FLAG {
CMD_STATUS_MASK = 0x0000000F, CMD_INITIALIZED = 0x00000001, CMD_TEXT_SET = 0x00000002, CMD_EXECUTING = 0x00000004,
CMD_EXEC_CANCELED = 0x10000000
}

Typedef Documentation

typedef CCommand* PCCOMMAND

Definition at line 141 of file command.h.

typedef CImpIColumnsInfo* PIMPICOLUMNSINFO

Definition at line 28 of file command.h.

typedef CImpICommandProperties* PIMPICOMMANDPROPERTIES

Definition at line 27 of file command.h.

typedef CImpICommandText* PIMPICOMMANDTEXT

Definition at line 24 of file command.h.

typedef CImpIConvertType* PIMPICONVERTTYPE

Definition at line 29 of file command.h.

Enumeration Type Documentation

enum COMMAND_STATUS_FLAG
Enumerator:
CMD_STATUS_MASK
CMD_INITIALIZED
CMD_TEXT_SET
CMD_EXECUTING
CMD_EXEC_CANCELED

Definition at line 34 of file command.h.

                         {
  // Command Object status flags
  CMD_STATUS_MASK     = 0x0000000F,
  CMD_INITIALIZED     = 0x00000001,
  CMD_TEXT_SET      = 0x00000002,
  CMD_EXECUTING     = 0x00000004,
  CMD_EXEC_CANCELED   = 0x10000000,
};

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/common.cpp File Reference

  • Dataaccess
  • oledb
  • sampprov
Functions

common.cpp File Reference

#include "headers.h"

Go to the source code of this file.

Functions

BOOL IsEqualDBID (const DBID *px, const DBID *py)

Function Documentation

BOOL IsEqualDBID | ( | const DBID * | px,
 |  | const DBID * | py
 | ) |  |

Definition at line 27 of file common.cpp.

{
  if(!px || !py)
    return FALSE;

  if(px->eKind == py->eKind)
  {
    switch(px->eKind)
    {
      case DBKIND_GUID_NAME:
        if ((px->uGuid.guid==py->uGuid.guid) &&
           px->uName.pwszName==NULL &&
           py->uName.pwszName==NULL)
           return TRUE;

        if ((px->uGuid.guid==py->uGuid.guid) &&
          wcscmp((px->uName.pwszName),(py->uName.pwszName))==0 )
          return TRUE;
        break;

      case DBKIND_GUID_PROPID:
        if ((px->uGuid.guid == py->uGuid.guid)&&
          (px->uName.ulPropid == py->uName.ulPropid))
          return TRUE;
        break;

      case DBKIND_NAME:
        if (NULL == px->uName.pwszName || NULL == py->uName.pwszName)
          return px->uName.pwszName == py->uName.pwszName;
        if (0==wcscmp((px->uName.pwszName),(py->uName.pwszName)))
          return TRUE;
        break;

      case DBKIND_PGUID_NAME:
        if ((px->uGuid.pguid) == (py->uGuid.pguid))
          return TRUE;
        break;

      case DBKIND_PGUID_PROPID:
        if ((px->uGuid.pguid)==(py->uGuid.pguid)&&
          (px->uName.ulPropid == py->uName.ulPropid))
          return TRUE;
        break;

      case DBKIND_PROPID:
        if (px->uName.ulPropid == py->uName.ulPropid)
          return TRUE;
        break;

      case DBKIND_GUID:
        if (px->uGuid.guid==py->uGuid.guid)
          return TRUE;
        break;

      default:
        assert(!"Unhandled Case!");
        return FALSE;
    }
  }

  return FALSE;
}

Generated on Wed Nov 13 2024 16:53:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/common.h File Reference

  • Dataaccess
  • oledb
  • sampprov
Functions

common.h File Reference

Go to the source code of this file.

Functions

BOOL IsEqualDBID (const DBID *px, const DBID *py)

Function Documentation

BOOL IsEqualDBID | ( | const DBID * | px,
 |  | const DBID * | py
 | ) |  |

Definition at line 27 of file common.cpp.

{
  if(!px || !py)
    return FALSE;

  if(px->eKind == py->eKind)
  {
    switch(px->eKind)
    {
      case DBKIND_GUID_NAME:
        if ((px->uGuid.guid==py->uGuid.guid) &&
           px->uName.pwszName==NULL &&
           py->uName.pwszName==NULL)
           return TRUE;

        if ((px->uGuid.guid==py->uGuid.guid) &&
          wcscmp((px->uName.pwszName),(py->uName.pwszName))==0 )
          return TRUE;
        break;

      case DBKIND_GUID_PROPID:
        if ((px->uGuid.guid == py->uGuid.guid)&&
          (px->uName.ulPropid == py->uName.ulPropid))
          return TRUE;
        break;

      case DBKIND_NAME:
        if (NULL == px->uName.pwszName || NULL == py->uName.pwszName)
          return px->uName.pwszName == py->uName.pwszName;
        if (0==wcscmp((px->uName.pwszName),(py->uName.pwszName)))
          return TRUE;
        break;

      case DBKIND_PGUID_NAME:
        if ((px->uGuid.pguid) == (py->uGuid.pguid))
          return TRUE;
        break;

      case DBKIND_PGUID_PROPID:
        if ((px->uGuid.pguid)==(py->uGuid.pguid)&&
          (px->uName.ulPropid == py->uName.ulPropid))
          return TRUE;
        break;

      case DBKIND_PROPID:
        if (px->uName.ulPropid == py->uName.ulPropid)
          return TRUE;
        break;

      case DBKIND_GUID:
        if (px->uGuid.guid==py->uGuid.guid)
          return TRUE;
        break;

      default:
        assert(!"Unhandled Case!");
        return FALSE;
    }
  }

  return FALSE;
}

Generated on Wed Nov 13 2024 16:53:11 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/crtsess.cpp File Reference

  • Dataaccess
  • oledb
  • sampprov

crtsess.cpp File Reference

#include "headers.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/cvttype.cpp File Reference

  • Dataaccess
  • oledb
  • sampprov

cvttype.cpp File Reference

#include "headers.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/datasrc.cpp File Reference

  • Dataaccess
  • oledb
  • sampprov
Functions

datasrc.cpp File Reference

#include "headers.h"
#include <shlobj.h>
#include <shellapi.h>

Go to the source code of this file.

Functions

STDMETHODIMP_ (DBREFCOUNT) CDataSource

Function Documentation

STDMETHODIMP_ ( DBREFCOUNT )

Definition at line 246 of file datasrc.cpp.

{
    if (!--m_cRef)
        {
        delete this;
        return 0;
        }

    return m_cRef;
}

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/datasrc.h File Reference

  • Dataaccess
  • oledb
  • sampprov
Classes | Typedefs

datasrc.h File Reference

#include "fileio.h"
#include "baseobj.h"

Go to the source code of this file.

Classes

class | CDataSource
class | CDSLAdvancedPage
class | CDSLConnectionPage
class | CImpIDBCreateSession
class | CImpIDBInfo
class | CImpIDBInitialize
class | CImpIDBProperties
class | CImpIPersist
class | CImpIServiceProvider
class | CImpISpecifyPropertyPages
class | CPropertyPage

Typedefs

typedef CDataSource * | PCDATASOURCE
typedef CImpIDBCreateSession * | PIMPIDBCREATESESSION
typedef CImpIDBInfo * | PIMPIDBINFO
typedef CImpIDBInitialize * | PIMPIDBINITIALIZE
typedef CImpIDBProperties * | PIMPIDBProperties
typedef CImpIPersist * | PIMPIPERSIST

Typedef Documentation

typedef CDataSource * PCDATASOURCE

Definition at line 26 of file datasrc.h.

typedef CImpIDBCreateSession* PIMPIDBCREATESESSION

Definition at line 31 of file datasrc.h.

typedef CImpIDBInfo* PIMPIDBINFO

Definition at line 32 of file datasrc.h.

typedef CImpIDBInitialize* PIMPIDBINITIALIZE

Definition at line 29 of file datasrc.h.

typedef CImpIDBProperties* PIMPIDBProperties

Definition at line 30 of file datasrc.h.

typedef CImpIPersist* PIMPIPERSIST

Definition at line 33 of file datasrc.h.

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/dbinit.cpp File Reference

  • Dataaccess
  • oledb
  • sampprov

dbinit.cpp File Reference

#include "headers.h"
#include <msdasc.h>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/dbprop.cpp File Reference

  • Dataaccess
  • oledb
  • sampprov

dbprop.cpp File Reference

#include "headers.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/dbsess.cpp File Reference

  • Dataaccess
  • oledb
  • sampprov
Functions

dbsess.cpp File Reference

#include "headers.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (DBREFCOUNT) CDBSession

Function Documentation

STDMETHODIMP_ ( DBREFCOUNT )

Definition at line 217 of file dbsess.cpp.

{
    if( !--m_cRef )
  {
    delete this;
    return 0;
  }

    return m_cRef;
}

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/dbsess.h File Reference

  • Dataaccess
  • oledb
  • sampprov
Classes | Typedefs

dbsess.h File Reference

#include "baseobj.h"

Go to the source code of this file.

Classes

class | CDBSession
class | CImpIDBCreateCommand
class | CImpIGetDataSource
class | CImpIOpenRowset
class | CImpISessionProperties

Typedefs

typedef CDBSession * | PCDBSESSION
typedef CImpIBindResource * | PIMPIBINDRESOURCE
typedef CImpIDBCreateCommand * | PIMPIDBCREATECOMMAND
typedef CImpIGetDataSource * | PIMPIGETDATASOURCE
typedef CImpIOpenRowset * | PIMPIOPENROWSET
typedef CImpISessionProperties * | PIMPISESSIONPROPERTIES

Typedef Documentation

typedef CDBSession* PCDBSESSION

Definition at line 91 of file dbsess.h.

typedef CImpIBindResource* PIMPIBINDRESOURCE

Definition at line 30 of file dbsess.h.

typedef CImpIDBCreateCommand* PIMPIDBCREATECOMMAND

Definition at line 29 of file dbsess.h.

typedef CImpIGetDataSource* PIMPIGETDATASOURCE

Definition at line 24 of file dbsess.h.

typedef CImpIOpenRowset* PIMPIOPENROWSET

Definition at line 27 of file dbsess.h.

typedef CImpISessionProperties* PIMPISESSIONPROPERTIES

Definition at line 28 of file dbsess.h.

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/extbuff.cpp File Reference

  • Dataaccess
  • oledb
  • sampprov

extbuff.cpp File Reference

#include "headers.h"
#include "extbuff.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/extbuff.h File Reference

  • Dataaccess
  • oledb
  • sampprov
Classes | Typedefs | Variables

extbuff.h File Reference

Go to the source code of this file.

Classes

class | CExtBuffer

Typedefs

typedef CExtBuffer FAR * | LPEXTBUFFER

Variables

class FAR | CExtBuffer

Typedef Documentation

typedef CExtBuffer FAR* LPEXTBUFFER

Definition at line 15 of file extbuff.h.

Variable Documentation

class FAR CExtBuffer

Definition at line 14 of file extbuff.h.

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/fileidx.cpp File Reference

  • Dataaccess
  • oledb
  • sampprov

fileidx.cpp File Reference

#include "headers.h"
#include "fileidx.h"
#include <stdlib.h>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/fileidx.h File Reference

  • Dataaccess
  • oledb
  • sampprov
Classes | Typedefs

fileidx.h File Reference

#include <windows.h>

Go to the source code of this file.

Classes

class | CFileIdx
struct | FILEDEX

Typedefs

typedef struct FILEDEX * | LPFILEDEX

Typedef Documentation

typedef struct FILEDEX* LPFILEDEX
Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/fileio.cpp File Reference

  • Dataaccess
  • oledb
  • sampprov

fileio.cpp File Reference

#include "headers.h"
#include "fileio.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/fileio.h File Reference

  • Dataaccess
  • oledb
  • sampprov
Classes | Defines | Typedefs | Enumerations

fileio.h File Reference

#include <fstream.h>
#include "fileidx.h"
#include "hashtbl.h"

Go to the source code of this file.

Classes

class | CFileIO

Defines

#define | MAX_COLUMNS 129
#define | MAX_INPUT_BUFFER 2048

Typedefs

typedef CFileIO FAR * | PCFILEIO

Enumerations

enum | UPDTYPE { UPDATE, INSERT }

Define Documentation

#define MAX_COLUMNS 129

Definition at line 18 of file fileio.h.

#define MAX_INPUT_BUFFER 2048

Definition at line 17 of file fileio.h.

Typedef Documentation

typedef CFileIO FAR* PCFILEIO

Definition at line 124 of file fileio.h.

Enumeration Type Documentation

enum UPDTYPE
Enumerator:
UPDATE
INSERT

Definition at line 21 of file fileio.h.

{UPDATE, INSERT};

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/globals.cpp File Reference

  • Dataaccess
  • oledb
  • sampprov
Defines

globals.cpp File Reference

#include "headers.h"

Go to the source code of this file.

Defines

#define | DBINITCONSTANTS
#define | INITGUID

Define Documentation

#define DBINITCONSTANTS

Definition at line 13 of file globals.cpp.

#define INITGUID

Definition at line 12 of file globals.cpp.

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/guids.h File Reference

  • Dataaccess
  • oledb
  • sampprov
Functions

guids.h File Reference

Go to the source code of this file.

Functions

DEFINE_GUID (CLSID_SampProv, 0xE8CCCB79L, 0x7C36, 0x101B, 0xAC, 0x3A, 0x00, 0xAA, 0x00, 0x44, 0x77, 0x3D)
DEFINE_GUID (CLSID_SampProvBinder, 0x245e7460, 0xb577, 0x11d2, 0xaf, 0x53, 0x0, 0xc0, 0x4f, 0x78, 0x29, 0x26)
DEFINE_GUID (CLSID_SampProvAdvancedPage, 0x119c8712, 0x905b, 0x11d2, 0xaf, 0x65, 0x0, 0xc0, 0x4f, 0x6f, 0x86, 0x97)
DEFINE_GUID (CLSID_SampProvConnectionPage, 0x119c8711, 0x905b, 0x11d2, 0xaf, 0x65, 0x0, 0xc0, 0x4f, 0x6f, 0x86, 0x97)
DEFINE_GUID (DBGUID_SAMPLEDIALECT, 0xe9fbaf50, 0xd402, 0x11ce, 0xbe, 0xdc, 0x0, 0xaa, 0x0, 0xa1, 0x4d, 0x7d)

Function Documentation

DEFINE_GUID | ( | CLSID_SampProv | ,
 |  | 0xE8CCCB79L | ,
 |  | 0x7C36 | ,
 |  | 0x101B | ,
 |  | 0xAC | ,
 |  | 0x3A | ,
 |  | 0x00 | ,
 |  | 0xAA | ,
 |  | 0x00 | ,
 |  | 0x44 | ,
 |  | 0x77 | ,
 |  | 0x3D |
 | ) |  |
DEFINE_GUID | ( | CLSID_SampProvBinder | ,
 |  | 0x245e7460 | ,
 |  | 0xb577 | ,
 |  | 0x11d2 | ,
 |  | 0xaf | ,
 |  | 0x53 | ,
 |  | 0x0 | ,
 |  | 0xc0 | ,
 |  | 0x4f | ,
 |  | 0x78 | ,
 |  | 0x29 | ,
 |  | 0x26 |
 | ) |  |
DEFINE_GUID | ( | CLSID_SampProvAdvancedPage | ,
 |  | 0x119c8712 | ,
 |  | 0x905b | ,
 |  | 0x11d2 | ,
 |  | 0xaf | ,
 |  | 0x65 | ,
 |  | 0x0 | ,
 |  | 0xc0 | ,
 |  | 0x4f | ,
 |  | 0x6f | ,
 |  | 0x86 | ,
 |  | 0x97 |
 | ) |  |
DEFINE_GUID | ( | CLSID_SampProvConnectionPage | ,
 |  | 0x119c8711 | ,
 |  | 0x905b | ,
 |  | 0x11d2 | ,
 |  | 0xaf | ,
 |  | 0x65 | ,
 |  | 0x0 | ,
 |  | 0xc0 | ,
 |  | 0x4f | ,
 |  | 0x6f | ,
 |  | 0x86 | ,
 |  | 0x97 |
 | ) |  |
DEFINE_GUID | ( | DBGUID_SAMPLEDIALECT | ,
 |  | 0xe9fbaf50 | ,
 |  | 0xd402 | ,
 |  | 0x11ce | ,
 |  | 0xbe | ,
 |  | 0xdc | ,
 |  | 0x0 | ,
 |  | 0xaa | ,
 |  | 0x0 | ,
 |  | 0xa1 | ,
 |  | 0x4d | ,
 |  | 0x7d |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/hashtbl.cpp File Reference

  • Dataaccess
  • oledb
  • sampprov
Functions

hashtbl.cpp File Reference

#include "headers.h"
#include "hashtbl.h"

Go to the source code of this file.

Functions

VOID | AddSlotToList (PLSTSLOT plstslot, ULONG islot, PSLOT pslot)
VOID | DecoupleSlot (PLSTSLOT plstslot, ULONG islot, PSLOT pslot)
HRESULT | GetNextSlots (PLSTSLOT plstslot, ULONG cslot, ULONG *pislot)
HRESULT | InitializeSlotList (ULONG cslotMax, ULONG cbSlot, ULONG cbPage, LPBITARRAY pbits, PLSTSLOT *pplstslot, BYTE **prgslot)
HRESULT | ReleaseSlotList (PLSTSLOT plstslot)
HRESULT | ReleaseSlots (PLSTSLOT plstslot, ULONG islot, ULONG cslot)
HRESULT | ResetSlotList (PLSTSLOT plstslot)

Function Documentation

VOID AddSlotToList | ( | PLSTSLOT | plstslot,
 |  | ULONG | islot,
 |  | PSLOT | pslot
 | ) |  |

Definition at line 154 of file hashtbl.cpp.

{
    pslot->islotPrev = 0;
    pslot->islotNext = plstslot->islotFirst;
    plstslot->islotFirst = islot;
    if (pslot->islotNext)
        ((PSLOT) & plstslot->rgslot[(pslot->islotNext *plstslot->cbSlot)-sizeof(SLOT)])->islotPrev = islot;
}

VOID DecoupleSlot | ( | PLSTSLOT | plstslot,
 |  | ULONG | islot,
 |  | PSLOT | pslot
 | ) |  |

Definition at line 129 of file hashtbl.cpp.

{
    if (pslot->islotNext)
        ((PSLOT) & plstslot->rgslot[(pslot->islotNext *plstslot->cbSlot)-sizeof(SLOT)])->islotPrev = pslot->islotPrev;
    if (pslot->islotPrev)
        ((PSLOT) & plstslot->rgslot[(pslot->islotPrev *plstslot->cbSlot)-sizeof(SLOT)])->islotNext = pslot->islotNext;
    else
        plstslot->islotFirst = pslot->islotNext;
    if (islot == plstslot->islotRov)
        plstslot->islotRov = pslot->islotNext;
}

HRESULT GetNextSlots | ( | PLSTSLOT | plstslot,
 |  | ULONG | cslot,
 |  | ULONG * | pislot
 | ) |  |

Definition at line 24 of file hashtbl.cpp.

{
    ULONG   islot, dslot;
    PSLOT   pslot, pslotTmp;
    ULONG   cbCommit;
    HRESULT hr;

    if (plstslot->islotRov)
        plstslot->islotRov = ((PSLOT) & plstslot->rgslot[(plstslot->islotRov * plstslot->cbSlot)-sizeof(SLOT)])->islotNext;
    else
        plstslot->islotRov = plstslot->islotFirst;

    islot = plstslot->islotRov;
    while (islot)
        {
        if (((PSLOT) & plstslot->rgslot[(islot *plstslot->cbSlot)-sizeof(SLOT)])->cslot >= cslot)
            break;
        islot = ((PSLOT) & plstslot->rgslot[(islot *plstslot->cbSlot)-sizeof(SLOT)])->islotNext;
        }
    if (islot == 0)
        {
        islot = plstslot->islotFirst;
        while (islot != plstslot->islotRov)
            {
            if (((PSLOT) & plstslot->rgslot[(islot *plstslot->cbSlot)-sizeof(SLOT)])->cslot >= cslot)
                break;
            islot = ((PSLOT) & plstslot->rgslot[(islot *plstslot->cbSlot)-sizeof(SLOT)])->islotNext;
            }
        if (islot == plstslot->islotRov)
            islot = 0;
        }

    if (islot == 0)
        {
        cbCommit = ((cslot *plstslot->cbSlot) / plstslot->cbPage + 1) *plstslot->cbPage;
        if ((plstslot->cbCommitCurrent + cbCommit) > plstslot->cbCommitMax
            || VirtualAlloc((VOID *) ((BYTE *) plstslot + plstslot->cbCommitCurrent),
                                    cbCommit,
                                    MEM_COMMIT,
                                    PAGE_READWRITE ) == NULL)
            return ResultFromScode( E_OUTOFMEMORY );

        islot = (ULONG) ((plstslot->cbCommitCurrent + plstslot->cbExtra) / plstslot->cbSlot);
        dslot = ((cbCommit + plstslot->cbslotLeftOver) / plstslot->cbSlot);
        if ((plstslot->pbitsSlot)->IsSlotSet( islot - 1 ) != NOERROR)
            {
            if ((plstslot->pbitsSlot)->FindSet( islot - 1, plstslot->islotMin, &islot ) == NOERROR)
                islot++;
            else
                islot = plstslot->islotMin;
            pslot = (PSLOT) & plstslot->rgslot[(islot *plstslot->cbSlot)-sizeof(SLOT)];
            pslot->cslot += dslot;
            DecoupleSlot( plstslot, islot, pslot );
            }
        else
            {
            pslot = (PSLOT) ((BYTE *) plstslot + plstslot->cbCommitCurrent - plstslot->cbslotLeftOver);
            pslot->cslot = dslot;
            }

        pslot->islotNext = plstslot->islotFirst;
        pslot->islotPrev = 0;

        plstslot->islotMax += dslot;
        plstslot->islotFirst       = islot;
        plstslot->cbslotLeftOver   = (cbCommit + plstslot->cbslotLeftOver) % plstslot->cbSlot;
        plstslot->cbCommitCurrent += cbCommit;

        if (pslot->islotNext)
            ((PSLOT) & plstslot->rgslot[(pslot->islotNext *plstslot->cbSlot)-sizeof(SLOT)])->islotPrev = islot;
        islot = plstslot->islotFirst;
        }

    pslot = (PSLOT) & plstslot->rgslot[(islot *plstslot->cbSlot)-sizeof(SLOT)];
    DecoupleSlot( plstslot, islot, pslot );
    if (pslot->cslot > cslot)
        {
        pslotTmp = (PSLOT) & plstslot->rgslot[ ((islot + cslot) *plstslot->cbSlot)-sizeof(SLOT)];
        pslotTmp->cslot = pslot->cslot - cslot;
        AddSlotToList( plstslot, islot + cslot, pslotTmp );
        }

    if (FAILED( hr = (plstslot->pbitsSlot)->SetSlots( islot, islot + cslot - 1 )))
        return hr;

    if (pislot)
        *pislot = islot;
    return ResultFromScode( S_OK );
}

HRESULT InitializeSlotList | ( | ULONG | cslotMax,
 |  | ULONG | cbSlot,
 |  | ULONG | cbPage,
 |  | LPBITARRAY | pbits,
 |  | PLSTSLOT * | pplstslot,
 |  | BYTE ** | prgslot
 | ) |  |

Definition at line 225 of file hashtbl.cpp.

{
    ULONG    cbReserve;
    BYTE     *pbAlloc;
    ULONG    cbCommitFirst;
    PLSTSLOT plstslot;
    ULONG    cslot, islotFirst;
    PSLOT    pslot;

    if (cbPage == 0)
        {
        SYSTEM_INFO sysinfo;

        GetSystemInfo( &sysinfo );
        cbPage = sysinfo.dwPageSize;
        }

    // Add in the LSTSLOT and SLOT
  cbSlot = cbSlot + (sizeof( LSTSLOT ) + sizeof( SLOT ));

  cbReserve = ((cslotMax *(cbSlot + (sizeof( LSTSLOT ) + sizeof( SLOT )))) / cbPage + 1) *cbPage;

    pbAlloc = (BYTE *) VirtualAlloc( NULL, cbReserve, MEM_RESERVE, PAGE_READWRITE );
    if (pbAlloc == NULL)
        return ResultFromScode( E_OUTOFMEMORY );

    cbCommitFirst = ((sizeof( LSTSLOT ) + sizeof( SLOT )) / cbPage + 1) * cbPage;
    plstslot = (PLSTSLOT) VirtualAlloc( pbAlloc, cbCommitFirst, MEM_COMMIT, PAGE_READWRITE );
    if (plstslot == NULL)
        {
        VirtualFree((VOID *) pbAlloc, 0, MEM_RELEASE );
        return ResultFromScode( E_OUTOFMEMORY );
        }

    plstslot->cbSlot          = cbSlot;
    plstslot->cbPage          = cbPage;
    plstslot->cbCommitCurrent = cbCommitFirst;
    plstslot->cbCommitMax     = cbReserve;
    plstslot->pbitsSlot       = pbits;

    if (cbSlot <= 2*(sizeof( LSTSLOT ) + sizeof( SLOT )))
        {
        islotFirst        = (sizeof( LSTSLOT ) + sizeof( SLOT )) / cbSlot + (((sizeof( LSTSLOT ) + sizeof( SLOT )) % cbSlot) ? 1 : 0);
        plstslot->cbExtra = 0;
        cslot = (ULONG) ((cbCommitFirst / cbSlot) - islotFirst);
        plstslot->cbslotLeftOver = cbCommitFirst - cbSlot * (cslot + islotFirst);
        }
    else
        {
        islotFirst        = 1;
        plstslot->cbExtra = cbSlot - (sizeof( LSTSLOT ) + sizeof( SLOT ));
        cslot = (cbCommitFirst - (sizeof( LSTSLOT ) + sizeof( SLOT ))) / cbSlot;
        plstslot->cbslotLeftOver = cbCommitFirst - (sizeof( LSTSLOT ) + sizeof( SLOT )) - cslot*cbSlot;
        }
    plstslot->rgslot = ((BYTE *) plstslot - plstslot->cbExtra);
    if (cslot)
        {
        plstslot->islotFirst = islotFirst;
        pslot = (PSLOT) & plstslot->rgslot[(islotFirst *plstslot->cbSlot)-sizeof(SLOT)];
        pslot->cslot     = cslot;
        pslot->islotNext = 0;
        pslot->islotPrev = 0;
        }
    else
        plstslot->islotFirst = 0;
    plstslot->islotMin   = islotFirst;
    plstslot->islotMax   = islotFirst + cslot - 1;
    plstslot->islotRov = plstslot->islotFirst;

    *pplstslot = plstslot;
    *prgslot   = plstslot->rgslot;
    return ResultFromScode( S_OK );
}

HRESULT ReleaseSlotList ( PLSTSLOT plstslot )

Definition at line 351 of file hashtbl.cpp.

{
    if (plstslot == NULL)
        return NOERROR;

    if (plstslot->cbCommitCurrent)
        VirtualFree((VOID *) plstslot, plstslot->cbCommitCurrent, MEM_DECOMMIT );

    VirtualFree((VOID *) plstslot, 0, MEM_RELEASE );
    return ResultFromScode( S_OK );
}

HRESULT ReleaseSlots | ( | PLSTSLOT | plstslot,
 |  | ULONG | islot,
 |  | ULONG | cslot
 | ) |  |

Definition at line 179 of file hashtbl.cpp.

{
    PSLOT pslot, pslotTmp;

    (plstslot->pbitsSlot)->ResetSlots( islot, islot + cslot - 1 );
    pslot = (PSLOT) & plstslot->rgslot[(islot * plstslot->cbSlot)-sizeof(SLOT)];
    pslot->cslot = cslot;

    if (islot > plstslot->islotMin && (plstslot->pbitsSlot)->IsSlotSet( islot - 1 ) != NOERROR)
        {
        if ((plstslot->pbitsSlot)->FindSet( islot - 1, plstslot->islotMin, &islot ) == NOERROR)
            islot++;
        else
            islot = plstslot->islotMin;
        pslot = (PSLOT) & plstslot->rgslot[(islot * plstslot->cbSlot)-sizeof(SLOT)];
        pslot->cslot += cslot;
        DecoupleSlot( plstslot, islot, pslot );
        }

    if ((islot + cslot) <= plstslot->islotMax && (plstslot->pbitsSlot)->IsSlotSet( islot + cslot ) != NOERROR)
        {
        pslotTmp = (PSLOT) & plstslot->rgslot[ ((islot + cslot) *plstslot->cbSlot)-sizeof(SLOT)];
        pslot->cslot += pslotTmp->cslot;
        DecoupleSlot( plstslot, (islot + cslot), pslotTmp );
        }

    AddSlotToList( plstslot, islot, pslot );
    return ResultFromScode( S_OK );
}

HRESULT ResetSlotList ( PLSTSLOT plstslot )

Definition at line 318 of file hashtbl.cpp.

{
    ULONG   cslot;
    PSLOT   pslot;

    cslot = (plstslot->islotMax >= plstslot->islotMin) ? (plstslot->islotMax - plstslot->islotMin + 1) : 0;
    if (cslot)
        {
        plstslot->islotFirst = plstslot->islotMin;
        pslot = (PSLOT) & plstslot->rgslot[(plstslot->islotFirst *plstslot->cbSlot)-sizeof(SLOT)];
        pslot->cslot     = cslot;
        pslot->islotNext = 0;
        pslot->islotPrev = 0;
        }
    else
        plstslot->islotFirst = 0;

    plstslot->islotRov = plstslot->islotFirst;
    return ResultFromScode( S_OK );
}

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/hashtbl.h File Reference

  • Dataaccess
  • oledb
  • sampprov
Classes | Defines | Typedefs | Functions

hashtbl.h File Reference

#include "bitarray.h"

Go to the source code of this file.

Classes

struct | _COLUMNDATA
struct | tagLSTSLOT
struct | tagRowBuff
struct | tagSLOT

Defines

#define | SIZE_64K 65535

Typedefs

typedef struct _COLUMNDATA | COLUMNDATA
typedef struct tagLSTSLOT | LSTSLOT
typedef struct _COLUMNDATA * | PCOLUMNDATA
typedef struct tagLSTSLOT * | PLSTSLOT
typedef struct tagRowBuff * | PROWBUFF
typedef struct tagSLOT * | PSLOT
typedef struct tagRowBuff | ROWBUFF
typedef struct tagSLOT | SLOT

Functions

VOID | AddSlotToList (PLSTSLOT plstslot, ULONG islot, PSLOT pslot)
VOID | DecoupleSlot (PLSTSLOT plstslot, ULONG islot, PSLOT pslot)
HRESULT | GetNextSlots (PLSTSLOT plstslot, ULONG cslot, ULONG *pislot)
HRESULT | InitializeSlotList (ULONG cslotMax, ULONG cbSlot, ULONG cbPage, LPBITARRAY pbits, PLSTSLOT *pplstslot, BYTE **prgslot)
HRESULT | ReleaseSlotList (PLSTSLOT plstslot)
HRESULT | ReleaseSlots (PLSTSLOT plstslot, ULONG islot, ULONG cslot)
HRESULT | ResetSlotList (PLSTSLOT plstslot)

Define Documentation

#define SIZE_64K 65535

Definition at line 13 of file hashtbl.h.

Typedef Documentation

typedef struct _COLUMNDATA COLUMNDATA
typedef struct tagLSTSLOT LSTSLOT
typedef struct _COLUMNDATA * PCOLUMNDATA
typedef struct tagLSTSLOT * PLSTSLOT
typedef struct tagRowBuff * PROWBUFF
typedef struct tagSLOT * PSLOT
typedef struct tagRowBuff ROWBUFF
typedef struct tagSLOT SLOT

Function Documentation

VOID AddSlotToList | ( | PLSTSLOT | plstslot,
 |  | ULONG | islot,
 |  | PSLOT | pslot
 | ) |  |

Definition at line 154 of file hashtbl.cpp.

{
    pslot->islotPrev = 0;
    pslot->islotNext = plstslot->islotFirst;
    plstslot->islotFirst = islot;
    if (pslot->islotNext)
        ((PSLOT) & plstslot->rgslot[(pslot->islotNext *plstslot->cbSlot)-sizeof(SLOT)])->islotPrev = islot;
}

VOID DecoupleSlot | ( | PLSTSLOT | plstslot,
 |  | ULONG | islot,
 |  | PSLOT | pslot
 | ) |  |

Definition at line 129 of file hashtbl.cpp.

{
    if (pslot->islotNext)
        ((PSLOT) & plstslot->rgslot[(pslot->islotNext *plstslot->cbSlot)-sizeof(SLOT)])->islotPrev = pslot->islotPrev;
    if (pslot->islotPrev)
        ((PSLOT) & plstslot->rgslot[(pslot->islotPrev *plstslot->cbSlot)-sizeof(SLOT)])->islotNext = pslot->islotNext;
    else
        plstslot->islotFirst = pslot->islotNext;
    if (islot == plstslot->islotRov)
        plstslot->islotRov = pslot->islotNext;
}

HRESULT GetNextSlots | ( | PLSTSLOT | plstslot,
 |  | ULONG | cslot,
 |  | ULONG * | pislot
 | ) |  |

Definition at line 24 of file hashtbl.cpp.

{
    ULONG   islot, dslot;
    PSLOT   pslot, pslotTmp;
    ULONG   cbCommit;
    HRESULT hr;

    if (plstslot->islotRov)
        plstslot->islotRov = ((PSLOT) & plstslot->rgslot[(plstslot->islotRov * plstslot->cbSlot)-sizeof(SLOT)])->islotNext;
    else
        plstslot->islotRov = plstslot->islotFirst;

    islot = plstslot->islotRov;
    while (islot)
        {
        if (((PSLOT) & plstslot->rgslot[(islot *plstslot->cbSlot)-sizeof(SLOT)])->cslot >= cslot)
            break;
        islot = ((PSLOT) & plstslot->rgslot[(islot *plstslot->cbSlot)-sizeof(SLOT)])->islotNext;
        }
    if (islot == 0)
        {
        islot = plstslot->islotFirst;
        while (islot != plstslot->islotRov)
            {
            if (((PSLOT) & plstslot->rgslot[(islot *plstslot->cbSlot)-sizeof(SLOT)])->cslot >= cslot)
                break;
            islot = ((PSLOT) & plstslot->rgslot[(islot *plstslot->cbSlot)-sizeof(SLOT)])->islotNext;
            }
        if (islot == plstslot->islotRov)
            islot = 0;
        }

    if (islot == 0)
        {
        cbCommit = ((cslot *plstslot->cbSlot) / plstslot->cbPage + 1) *plstslot->cbPage;
        if ((plstslot->cbCommitCurrent + cbCommit) > plstslot->cbCommitMax
            || VirtualAlloc((VOID *) ((BYTE *) plstslot + plstslot->cbCommitCurrent),
                                    cbCommit,
                                    MEM_COMMIT,
                                    PAGE_READWRITE ) == NULL)
            return ResultFromScode( E_OUTOFMEMORY );

        islot = (ULONG) ((plstslot->cbCommitCurrent + plstslot->cbExtra) / plstslot->cbSlot);
        dslot = ((cbCommit + plstslot->cbslotLeftOver) / plstslot->cbSlot);
        if ((plstslot->pbitsSlot)->IsSlotSet( islot - 1 ) != NOERROR)
            {
            if ((plstslot->pbitsSlot)->FindSet( islot - 1, plstslot->islotMin, &islot ) == NOERROR)
                islot++;
            else
                islot = plstslot->islotMin;
            pslot = (PSLOT) & plstslot->rgslot[(islot *plstslot->cbSlot)-sizeof(SLOT)];
            pslot->cslot += dslot;
            DecoupleSlot( plstslot, islot, pslot );
            }
        else
            {
            pslot = (PSLOT) ((BYTE *) plstslot + plstslot->cbCommitCurrent - plstslot->cbslotLeftOver);
            pslot->cslot = dslot;
            }

        pslot->islotNext = plstslot->islotFirst;
        pslot->islotPrev = 0;

        plstslot->islotMax += dslot;
        plstslot->islotFirst       = islot;
        plstslot->cbslotLeftOver   = (cbCommit + plstslot->cbslotLeftOver) % plstslot->cbSlot;
        plstslot->cbCommitCurrent += cbCommit;

        if (pslot->islotNext)
            ((PSLOT) & plstslot->rgslot[(pslot->islotNext *plstslot->cbSlot)-sizeof(SLOT)])->islotPrev = islot;
        islot = plstslot->islotFirst;
        }

    pslot = (PSLOT) & plstslot->rgslot[(islot *plstslot->cbSlot)-sizeof(SLOT)];
    DecoupleSlot( plstslot, islot, pslot );
    if (pslot->cslot > cslot)
        {
        pslotTmp = (PSLOT) & plstslot->rgslot[ ((islot + cslot) *plstslot->cbSlot)-sizeof(SLOT)];
        pslotTmp->cslot = pslot->cslot - cslot;
        AddSlotToList( plstslot, islot + cslot, pslotTmp );
        }

    if (FAILED( hr = (plstslot->pbitsSlot)->SetSlots( islot, islot + cslot - 1 )))
        return hr;

    if (pislot)
        *pislot = islot;
    return ResultFromScode( S_OK );
}

HRESULT InitializeSlotList | ( | ULONG | cslotMax,
 |  | ULONG | cbSlot,
 |  | ULONG | cbPage,
 |  | LPBITARRAY | pbits,
 |  | PLSTSLOT * | pplstslot,
 |  | BYTE ** | prgslot
 | ) |  |

Definition at line 225 of file hashtbl.cpp.

{
    ULONG    cbReserve;
    BYTE     *pbAlloc;
    ULONG    cbCommitFirst;
    PLSTSLOT plstslot;
    ULONG    cslot, islotFirst;
    PSLOT    pslot;

    if (cbPage == 0)
        {
        SYSTEM_INFO sysinfo;

        GetSystemInfo( &sysinfo );
        cbPage = sysinfo.dwPageSize;
        }

    // Add in the LSTSLOT and SLOT
  cbSlot = cbSlot + (sizeof( LSTSLOT ) + sizeof( SLOT ));

  cbReserve = ((cslotMax *(cbSlot + (sizeof( LSTSLOT ) + sizeof( SLOT )))) / cbPage + 1) *cbPage;

    pbAlloc = (BYTE *) VirtualAlloc( NULL, cbReserve, MEM_RESERVE, PAGE_READWRITE );
    if (pbAlloc == NULL)
        return ResultFromScode( E_OUTOFMEMORY );

    cbCommitFirst = ((sizeof( LSTSLOT ) + sizeof( SLOT )) / cbPage + 1) * cbPage;
    plstslot = (PLSTSLOT) VirtualAlloc( pbAlloc, cbCommitFirst, MEM_COMMIT, PAGE_READWRITE );
    if (plstslot == NULL)
        {
        VirtualFree((VOID *) pbAlloc, 0, MEM_RELEASE );
        return ResultFromScode( E_OUTOFMEMORY );
        }

    plstslot->cbSlot          = cbSlot;
    plstslot->cbPage          = cbPage;
    plstslot->cbCommitCurrent = cbCommitFirst;
    plstslot->cbCommitMax     = cbReserve;
    plstslot->pbitsSlot       = pbits;

    if (cbSlot <= 2*(sizeof( LSTSLOT ) + sizeof( SLOT )))
        {
        islotFirst        = (sizeof( LSTSLOT ) + sizeof( SLOT )) / cbSlot + (((sizeof( LSTSLOT ) + sizeof( SLOT )) % cbSlot) ? 1 : 0);
        plstslot->cbExtra = 0;
        cslot = (ULONG) ((cbCommitFirst / cbSlot) - islotFirst);
        plstslot->cbslotLeftOver = cbCommitFirst - cbSlot * (cslot + islotFirst);
        }
    else
        {
        islotFirst        = 1;
        plstslot->cbExtra = cbSlot - (sizeof( LSTSLOT ) + sizeof( SLOT ));
        cslot = (cbCommitFirst - (sizeof( LSTSLOT ) + sizeof( SLOT ))) / cbSlot;
        plstslot->cbslotLeftOver = cbCommitFirst - (sizeof( LSTSLOT ) + sizeof( SLOT )) - cslot*cbSlot;
        }
    plstslot->rgslot = ((BYTE *) plstslot - plstslot->cbExtra);
    if (cslot)
        {
        plstslot->islotFirst = islotFirst;
        pslot = (PSLOT) & plstslot->rgslot[(islotFirst *plstslot->cbSlot)-sizeof(SLOT)];
        pslot->cslot     = cslot;
        pslot->islotNext = 0;
        pslot->islotPrev = 0;
        }
    else
        plstslot->islotFirst = 0;
    plstslot->islotMin   = islotFirst;
    plstslot->islotMax   = islotFirst + cslot - 1;
    plstslot->islotRov = plstslot->islotFirst;

    *pplstslot = plstslot;
    *prgslot   = plstslot->rgslot;
    return ResultFromScode( S_OK );
}

HRESULT ReleaseSlotList ( PLSTSLOT plstslot )

Definition at line 351 of file hashtbl.cpp.

{
    if (plstslot == NULL)
        return NOERROR;

    if (plstslot->cbCommitCurrent)
        VirtualFree((VOID *) plstslot, plstslot->cbCommitCurrent, MEM_DECOMMIT );

    VirtualFree((VOID *) plstslot, 0, MEM_RELEASE );
    return ResultFromScode( S_OK );
}

HRESULT ReleaseSlots | ( | PLSTSLOT | plstslot,
 |  | ULONG | islot,
 |  | ULONG | cslot
 | ) |  |

Definition at line 179 of file hashtbl.cpp.

{
    PSLOT pslot, pslotTmp;

    (plstslot->pbitsSlot)->ResetSlots( islot, islot + cslot - 1 );
    pslot = (PSLOT) & plstslot->rgslot[(islot * plstslot->cbSlot)-sizeof(SLOT)];
    pslot->cslot = cslot;

    if (islot > plstslot->islotMin && (plstslot->pbitsSlot)->IsSlotSet( islot - 1 ) != NOERROR)
        {
        if ((plstslot->pbitsSlot)->FindSet( islot - 1, plstslot->islotMin, &islot ) == NOERROR)
            islot++;
        else
            islot = plstslot->islotMin;
        pslot = (PSLOT) & plstslot->rgslot[(islot * plstslot->cbSlot)-sizeof(SLOT)];
        pslot->cslot += cslot;
        DecoupleSlot( plstslot, islot, pslot );
        }

    if ((islot + cslot) <= plstslot->islotMax && (plstslot->pbitsSlot)->IsSlotSet( islot + cslot ) != NOERROR)
        {
        pslotTmp = (PSLOT) & plstslot->rgslot[ ((islot + cslot) *plstslot->cbSlot)-sizeof(SLOT)];
        pslot->cslot += pslotTmp->cslot;
        DecoupleSlot( plstslot, (islot + cslot), pslotTmp );
        }

    AddSlotToList( plstslot, islot, pslot );
    return ResultFromScode( S_OK );
}

HRESULT ResetSlotList ( PLSTSLOT plstslot )

Definition at line 318 of file hashtbl.cpp.

{
    ULONG   cslot;
    PSLOT   pslot;

    cslot = (plstslot->islotMax >= plstslot->islotMin) ? (plstslot->islotMax - plstslot->islotMin + 1) : 0;
    if (cslot)
        {
        plstslot->islotFirst = plstslot->islotMin;
        pslot = (PSLOT) & plstslot->rgslot[(plstslot->islotFirst *plstslot->cbSlot)-sizeof(SLOT)];
        pslot->cslot     = cslot;
        pslot->islotNext = 0;
        pslot->islotPrev = 0;
        }
    else
        plstslot->islotFirst = 0;

    plstslot->islotRov = plstslot->islotFirst;
    return ResultFromScode( S_OK );
}

Generated on Wed Nov 13 2024 16:53:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/headers.cpp File Reference

  • Dataaccess
  • oledb
  • sampprov

headers.cpp File Reference

#include "headers.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/headers.h File Reference

  • Dataaccess
  • oledb
  • sampprov
Defines

headers.h File Reference

#include <windows.h>
#include <windowsx.h>
#include <limits.h>
#include <stdio.h>
#include <stddef.h>
#include <wchar.h>
#include <commdlg.h>
#include "oledb.h"
#include "oledberr.h"
#include "msdadc.h"
#include "msdaguid.h"
#include "sampprov.h"
#include "asserts.h"
#include "utilprop.h"
#include "guids.h"
#include "resource.h"
#include "datasrc.h"
#include "dbsess.h"
#include "rowset.h"
#include "command.h"
#include "accessor.h"
#include "binder.h"
#include "row.h"
#include "stream.h"
#include "common.h"
#include "guids.h"
#include "resource.h"
#include "common.h"

Go to the source code of this file.

Defines

#define | INC_OLE2
#define | STRICT
#define | WIN32_LEAN_AND_MEAN

Define Documentation

#define INC_OLE2

Definition at line 19 of file headers.h.

#define STRICT

Definition at line 21 of file headers.h.

#define WIN32_LEAN_AND_MEAN

Definition at line 16 of file headers.h.

Generated on Wed Nov 13 2024 16:53:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/igetrow.cpp File Reference

  • Dataaccess
  • oledb
  • sampprov

igetrow.cpp File Reference

#include "headers.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/irowiden.cpp File Reference

  • Dataaccess
  • oledb
  • sampprov

irowiden.cpp File Reference

#include "headers.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/irowset.cpp File Reference

  • Dataaccess
  • oledb
  • sampprov

irowset.cpp File Reference

#include "headers.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/opnrowst.cpp File Reference

  • Dataaccess
  • oledb
  • sampprov

opnrowst.cpp File Reference

#include "headers.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/persist.cpp File Reference

  • Dataaccess
  • oledb
  • sampprov

persist.cpp File Reference

#include "headers.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/resource.h File Reference

  • Dataaccess
  • oledb
  • sampprov
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDB_BROWSE_DIRECTORY 1002
#define | IDC_STATIC -1
#define | IDD_DSL_ADVANCED 102
#define | IDD_DSL_CONNECTION 101
#define | IDE_DATASOURCE 1000

Define Documentation

#define IDB_BROWSE_DIRECTORY 1002

Definition at line 8 of file resource.h.

#define IDC_STATIC -1

Definition at line 9 of file resource.h.

#define IDD_DSL_ADVANCED 102

Definition at line 6 of file resource.h.

#define IDD_DSL_CONNECTION 101

Definition at line 5 of file resource.h.

#define IDE_DATASOURCE 1000

Definition at line 7 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/row.cpp File Reference

  • Dataaccess
  • oledb
  • sampprov
Functions

row.cpp File Reference

#include "headers.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (DBREFCOUNT) CRow

Function Documentation

STDMETHODIMP_ ( DBREFCOUNT )

Definition at line 274 of file row.cpp.

{
    if (!--m_cRef)
        {
        delete this;
        return 0;
        }

    return m_cRef;
}

Generated on Wed Nov 13 2024 16:53:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/row.h File Reference

  • Dataaccess
  • oledb
  • sampprov
Classes | Defines | Typedefs

row.h File Reference

#include "baseobj.h"

Go to the source code of this file.

Classes

class | CImpIGetSession
class | CImpIRow
class | CImpIRowChange
class | CRow

Defines

#define | DEFAULT_STREAM 0
#define | DEFAULT_STREAM_ORDINAL 1
#define | EXTRA_COLUMNS 1

Typedefs

typedef CImpIConvertType * | PIMPCONVERTTYPE
typedef CImpIColumnsInfo * | PIMPICOLUMNSINFO
typedef CImpIGetSession * | PIMPIGETSESSION
typedef CImpIRow * | PIMPIROW
typedef CImpIRowChange * | PIMPIROWCHANGE

Define Documentation

#define DEFAULT_STREAM 0

Definition at line 23 of file row.h.

#define DEFAULT_STREAM_ORDINAL 1

Definition at line 24 of file row.h.

#define EXTRA_COLUMNS 1

Definition at line 21 of file row.h.

Typedef Documentation

typedef CImpIConvertType* PIMPCONVERTTYPE

Definition at line 36 of file row.h.

typedef CImpIColumnsInfo* PIMPICOLUMNSINFO

Definition at line 35 of file row.h.

typedef CImpIGetSession* PIMPIGETSESSION

Definition at line 37 of file row.h.

typedef CImpIRow* PIMPIROW

Definition at line 32 of file row.h.

typedef CImpIRowChange* PIMPIROWCHANGE

Definition at line 38 of file row.h.

Generated on Wed Nov 13 2024 16:53:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/rowchng.cpp File Reference

  • Dataaccess
  • oledb
  • sampprov

rowchng.cpp File Reference

#include "headers.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/rowinfo.cpp File Reference

  • Dataaccess
  • oledb
  • sampprov

rowinfo.cpp File Reference

#include "headers.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/rowset.cpp File Reference

  • Dataaccess
  • oledb
  • sampprov
Functions

rowset.cpp File Reference

#include "headers.h"

Go to the source code of this file.

Functions

HRESULT GetInternalTypeFromCSVType (SWORD swDataType, BOOL fIsSigned, DWORD *pdwdbType)
STDMETHODIMP_ (DBREFCOUNT) CRowset

Function Documentation

HRESULT GetInternalTypeFromCSVType | ( | SWORD | swDataType,
 |  | BOOL | fIsSigned,
 |  | DWORD * | pdwdbType
 | ) |  |

Definition at line 454 of file rowset.cpp.

{
    static struct {
        SWORD   swCSVType;
        BOOL    fIsSigned;          // 1=signed, 0=unsigned
        BOOL    fSignedDistinction; // 1=signed matters
        DWORD   dwdbType;
    } TypeTable[] =
        {
            {TYPE_CHAR,         0, 0, DBTYPE_STR },
            {TYPE_SLONG,        1, 1, DBTYPE_I4  },
        };

    for (int j=0; j < NUMELEM( TypeTable ); j++)
        {
        if (swDataType == TypeTable[j].swCSVType        // type match
        && (!TypeTable[j].fSignedDistinction            // care about sign?
            || fIsSigned == TypeTable[j].fIsSigned))    // sign match
            {
            assert( pdwdbType );
            *pdwdbType     = TypeTable[j].dwdbType;
            return ResultFromScode( S_OK );
            }
        }

    // Should never get here, since we supposedly have
    // a table of all possible CSV types.
    assert( !"Unmatched CSV Type." );
    return ResultFromScode( E_FAIL );
}

STDMETHODIMP_ ( DBREFCOUNT )

Definition at line 311 of file rowset.cpp.

{
    if (!--m_cRef)
        {
        this->m_pCreator->DecrementOpenRowsets();
        delete this;
        return 0;
        }

    return m_cRef;
}

Generated on Wed Nov 13 2024 16:53:28 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/rowset.h File Reference

  • Dataaccess
  • oledb
  • sampprov
Classes | Typedefs | Functions

rowset.h File Reference

#include "fileio.h"
#include "bitarray.h"
#include "extbuff.h"
#include "hashtbl.h"
#include "command.h"
#include "baseobj.h"
#include "dbsess.h"

Go to the source code of this file.

Classes

class | CImpIColumnsInfo
class | CImpIConvertType
class | CImpIGetRow
class | CImpIRowset
class | CImpIRowsetChange
class | CImpIRowsetIdentity
class | CImpIRowsetInfo
class | CRowset

Typedefs

typedef CRowset * | PCROWSET
typedef CImpIAccessor * | PIMPIACCESSOR
typedef CImpIColumnsInfo * | PIMPICOLUMNSINFO
typedef CImpIConvertType * | PIMPICONVERTTYPE
typedef CImpIGetRow * | PIMPIGETROW
typedef CImpIRowset * | PIMPIROWSET
typedef CImpIRowsetChange * | PIMPIROWSETCHANGE
typedef CImpIRowsetIdentity * | PIMPIROWSETIDENTITY
typedef CImpIRowsetInfo * | PIMPIROWSETINFO

Functions

HRESULT | GetInternalTypeFromCSVType (SWORD swDataType, BOOL fIsSigned, DWORD *pdwdbType)

Typedef Documentation

typedef CRowset* PCROWSET

Definition at line 169 of file rowset.h.

typedef CImpIAccessor* PIMPIACCESSOR

Definition at line 38 of file rowset.h.

typedef CImpIColumnsInfo* PIMPICOLUMNSINFO

Definition at line 37 of file rowset.h.

typedef CImpIConvertType* PIMPICONVERTTYPE

Definition at line 41 of file rowset.h.

typedef CImpIGetRow* PIMPIGETROW

Definition at line 42 of file rowset.h.

typedef CImpIRowset* PIMPIROWSET

Definition at line 33 of file rowset.h.

typedef CImpIRowsetChange* PIMPIROWSETCHANGE

Definition at line 36 of file rowset.h.

typedef CImpIRowsetIdentity* PIMPIROWSETIDENTITY

Definition at line 39 of file rowset.h.

typedef CImpIRowsetInfo* PIMPIROWSETINFO

Definition at line 40 of file rowset.h.

Function Documentation

HRESULT GetInternalTypeFromCSVType | ( | SWORD | swDataType,
 |  | BOOL | fIsSigned,
 |  | DWORD * | pdwdbType
 | ) |  |

Definition at line 454 of file rowset.cpp.

{
    static struct {
        SWORD   swCSVType;
        BOOL    fIsSigned;          // 1=signed, 0=unsigned
        BOOL    fSignedDistinction; // 1=signed matters
        DWORD   dwdbType;
    } TypeTable[] =
        {
            {TYPE_CHAR,         0, 0, DBTYPE_STR },
            {TYPE_SLONG,        1, 1, DBTYPE_I4  },
        };

    for (int j=0; j < NUMELEM( TypeTable ); j++)
        {
        if (swDataType == TypeTable[j].swCSVType        // type match
        && (!TypeTable[j].fSignedDistinction            // care about sign?
            || fIsSigned == TypeTable[j].fIsSigned))    // sign match
            {
            assert( pdwdbType );
            *pdwdbType     = TypeTable[j].dwdbType;
            return ResultFromScode( S_OK );
            }
        }

    // Should never get here, since we supposedly have
    // a table of all possible CSV types.
    assert( !"Unmatched CSV Type." );
    return ResultFromScode( E_FAIL );
}

Generated on Wed Nov 13 2024 16:53:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/sampprov.h File Reference

  • Dataaccess
  • oledb
  • sampprov
Classes | Defines | Typedefs | Functions | Variables

sampprov.h File Reference

Go to the source code of this file.

Classes

struct | tagACCESSOR

Defines

#define | CHECK_MEMORY(pv) if(!(pv)) { hr = E_OUTOFMEMORY; goto CLEANUP; }
#define | COLUMN_ALIGNVAL 8
#define | DEFINE_ADDREF_RELEASE
#define | DEFINE_DEFAULT_IUNKNOWN_ADDREF_RELEASE
#define | DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR(BaseClass, InterfaceClass)
#define | DEFINE_DEFAULT_IUNKNOWN_MEMBER_DATA(BaseClass)
#define | EOL '\0'
#define | GLOBAL_(type, name, val) extern type name
#define | INT_DISPLAY_SIZE 80
#define | MAX(a, b) ( (a) > (b) ? (a) : (b) )
#define | MAX_BIND_LEN (MAX_IBUFFER_SIZE/10)
#define | MAX_HEAP_SIZE 128000
#define | MAX_IBUFFER_SIZE 2000000
#define | MAX_QUERY_LEN 4096
#define | MAX_TOTAL_ROWBUFF_SIZE (10*1024*1024)
#define | MIN(a, b) ( (a) < (b) ? (a) : (b) )
#define | NUMELEM(x) (sizeof(x)/sizeof(*x))
#define | OBJECT_CONSTRUCTED() InterlockedIncrement(&g_cObj);
#define | OBJECT_DESTRUCTED() InterlockedDecrement(&g_cObj);
#define | PROVIDER_ALLOC(cb) CoTaskMemAlloc((ULONG)(cb));
#define | PROVIDER_REALLOC(pv, cb) CoTaskMemRealloc(pv, (ULONG)(cb));
#define | ROUND_DOWN(Size, Amount) ((DBLENGTH)(Size) & ~((Amount) - 1))
#define | ROUND_UP(Size, Amount) (((DBLENGTH)(Size) + ((Amount) - 1)) & ~((Amount) - 1))
#define | SAFE_ADDREF(pv) if((pv)) { ((IUnknown*)pv)->AddRef(); }
#define | SAFE_ALLOC(pv, type, cb) { pv = (type*)CoTaskMemAlloc((ULONG)(cb)*sizeof(type)); CHECK_MEMORY(pv); }
#define | SAFE_DELETE(pv) { if(pv) delete (pv); pv = NULL; }
#define | SAFE_DELETE_ARRAY(pv) { if(pv) delete [] (pv); pv = NULL; }
#define | SAFE_FREE(pv) { CoTaskMemFree(pv); pv = NULL; }
#define | SAFE_REALLOC(pv, type, cb) { pv = (type*)CoTaskMemRealloc(pv, (ULONG)(cb)*sizeof(type)); CHECK_MEMORY(pv);}
#define | SAFE_RELEASE(pv) if((pv)) { ((IUnknown*)pv)->Release(); (pv) = NULL; }
#define | SAFE_SYSALLOC(pv, bstr) { pv = SysAllocString(bstr); CHECK_MEMORY(pv); }
#define | SAFE_SYSFREE(bstr) { SysFreeString(bstr); bstr = NULL;}
#define | SAMPPROV_URL_PREFIX L"sampprov"
#define | STAT_ENDOFCURSOR 0x00000100
#define | TEST(exp) { if(FAILED(exp)) { ASSERT(!#exp); } }
#define | TESTC(exp) { if(FAILED(exp)) { goto CLEANUP; } }
#define | wEOL L'\0'

Typedefs

typedef struct tagACCESSOR | ACCESSOR
typedef VOID ** | LPLPVOID
typedef struct tagACCESSOR * | PACCESSOR
typedef long int | SDWORD
typedef signed long | SLONG
typedef short int | SWORD
typedef unsigned long int | UDWORD
typedef unsigned long | ULONG
typedef unsigned short | USHORT
typedef unsigned short int | UWORD

Functions

GLOBAL_ (LONG, g_cObj, 0L)
GLOBAL_ (IDataConvert *, g_pIDataConvert, NULL)
GLOBAL_ (HINSTANCE, g_hInstance, 0L)
GLOBAL_ (DWORD, g_dwPageSize, 0L)
GLOBAL_ (DWORD, g_cAttachedProcesses, 0L)
GLOBAL_ (LONG, g_cLock, 0L)

Variables

WCHAR | g_wszDataSourceKeyword []
WCHAR | g_wszFileKeyword []
WCHAR | g_wszRowKeyword []

Define Documentation

#define CHECK_MEMORY ( pv ) if(!(pv)) { hr = E_OUTOFMEMORY; goto CLEANUP; }

Definition at line 37 of file sampprov.h.

#define COLUMN_ALIGNVAL 8

Definition at line 100 of file sampprov.h.

#define DEFINE_ADDREF_RELEASE
Value:
STDMETHODIMP_(ULONG)  AddRef(void)                  \
    {                                 \
      InterlockedIncrement((LONG*)&m_cRef);             \
      return m_cRef;                          \
    }                                 \
  STDMETHODIMP_(ULONG)  Release(void)                 \
    {                                 \
      if(InterlockedDecrement((LONG*)&m_cRef))            \
        return m_cRef;                        \
                                      \
      delete this;                          \
      return 0;                           \
    }

Definition at line 200 of file sampprov.h.

#define DEFINE_DEFAULT_IUNKNOWN_ADDREF_RELEASE
Value:
STDMETHODIMP_(ULONG)  AddRef(void)                  \
    {                                 \
      DEBUGCODE( ++m_cRef );                      \
      return m_pUnkOuter->AddRef();                 \
    }                                 \
  STDMETHODIMP_(ULONG)  Release(void)                 \
    {                                 \
      ASSERT( m_cRef > 0 );                     \
      DEBUGCODE( --m_cRef );                      \
      return m_pUnkOuter->Release();                  \
    }                                 \
  STDMETHODIMP      QueryInterface(REFIID riid, LPVOID *ppv)    \
    {                                 \
      return m_pUnkOuter->QueryInterface(riid, ppv);          \
    }

Definition at line 178 of file sampprov.h.

#define DEFINE_DEFAULT_IUNKNOWN_CTOR_DTOR | ( | BaseClass,
 |  | InterfaceClass
 | ) |
Value:
InterfaceClass( BaseClass *pObj, IUnknown *pUnkOuter )          \
    {                                 \
      DEBUGCODE(m_cRef = 0L);                     \
      m_pObj    = pObj;                       \
      m_pUnkOuter = pUnkOuter;                    \
    }                                 \
  ~InterfaceClass()                           \
    {                                 \
    }

Definition at line 163 of file sampprov.h.

#define DEFINE_DEFAULT_IUNKNOWN_MEMBER_DATA ( BaseClass )
Value:
DEBUGCODE(ULONG m_cRef);                      \
    BaseClass   *m_pObj;                      \
    LPUNKNOWN   m_pUnkOuter;

Definition at line 151 of file sampprov.h.

#define EOL '\0'

Definition at line 69 of file sampprov.h.

#define GLOBAL_ | ( | type,
 |  | name,
 |  | val |
 | ) |  | extern type name

Definition at line 19 of file sampprov.h.

#define INT_DISPLAY_SIZE 80

Definition at line 71 of file sampprov.h.

#define MAX | ( | a,
 |  | b |
 | ) |  | ( (a) > (b) ? (a) : (b) )

Definition at line 27 of file sampprov.h.

#define MAX_BIND_LEN (MAX_IBUFFER_SIZE/10)

Definition at line 66 of file sampprov.h.

#define MAX_HEAP_SIZE 128000

Definition at line 63 of file sampprov.h.

#define MAX_IBUFFER_SIZE 2000000

Definition at line 65 of file sampprov.h.

#define MAX_QUERY_LEN 4096

Definition at line 68 of file sampprov.h.

#define MAX_TOTAL_ROWBUFF_SIZE (10*1024*1024)

Definition at line 64 of file sampprov.h.

#define MIN | ( | a,
 |  | b |
 | ) |  | ( (a) < (b) ? (a) : (b) )

Definition at line 26 of file sampprov.h.

#define NUMELEM ( x ) (sizeof(x)/sizeof(*x))

Definition at line 60 of file sampprov.h.

#define OBJECT_CONSTRUCTED ( ) InterlockedIncrement(&g_cObj);

Definition at line 22 of file sampprov.h.

#define OBJECT_DESTRUCTED ( ) InterlockedDecrement(&g_cObj);

Definition at line 23 of file sampprov.h.

#define PROVIDER_ALLOC ( cb ) CoTaskMemAlloc((ULONG)(cb));

Definition at line 39 of file sampprov.h.

#define PROVIDER_REALLOC | ( | pv,
 |  | cb |
 | ) |  | CoTaskMemRealloc(pv, (ULONG)(cb));

Definition at line 40 of file sampprov.h.

#define ROUND_DOWN | ( | Size,
 |  | Amount |
 | ) |  | ((DBLENGTH)(Size) & ~((Amount) - 1))

Definition at line 84 of file sampprov.h.

#define ROUND_UP | ( | Size,
 |  | Amount |
 | ) |  | (((DBLENGTH)(Size) + ((Amount) - 1)) & ~((Amount) - 1))

Definition at line 85 of file sampprov.h.

#define SAFE_ADDREF ( pv ) if((pv)) { ((IUnknown*)pv)->AddRef(); }

Definition at line 54 of file sampprov.h.

#define SAFE_ALLOC | ( | pv,
 |  | type,
 |  | cb |
 | ) |  | { pv = (type*)CoTaskMemAlloc((ULONG)(cb)*sizeof(type)); CHECK_MEMORY(pv); }

Definition at line 42 of file sampprov.h.

#define SAFE_DELETE ( pv ) { if(pv) delete (pv); pv = NULL; }

Definition at line 49 of file sampprov.h.

#define SAFE_DELETE_ARRAY ( pv ) { if(pv) delete [] (pv); pv = NULL; }

Definition at line 50 of file sampprov.h.

#define SAFE_FREE ( pv ) { CoTaskMemFree(pv); pv = NULL; }

Definition at line 46 of file sampprov.h.

#define SAFE_REALLOC | ( | pv,
 |  | type,
 |  | cb |
 | ) |  | { pv = (type*)CoTaskMemRealloc(pv, (ULONG)(cb)*sizeof(type)); CHECK_MEMORY(pv);}

Definition at line 43 of file sampprov.h.

#define SAFE_RELEASE ( pv ) if((pv)) { ((IUnknown*)pv)->Release(); (pv) = NULL; }

Definition at line 53 of file sampprov.h.

#define SAFE_SYSALLOC | ( | pv,
 |  | bstr |
 | ) |  | { pv = SysAllocString(bstr); CHECK_MEMORY(pv); }

Definition at line 44 of file sampprov.h.

#define SAFE_SYSFREE ( bstr ) { SysFreeString(bstr); bstr = NULL;}

Definition at line 47 of file sampprov.h.

#define SAMPPROV_URL_PREFIX L"sampprov"

Definition at line 30 of file sampprov.h.

#define STAT_ENDOFCURSOR 0x00000100

Definition at line 73 of file sampprov.h.

#define TEST ( exp ) { if(FAILED(exp)) { ASSERT(!#exp); } }

Definition at line 57 of file sampprov.h.

#define TESTC ( exp ) { if(FAILED(exp)) { goto CLEANUP; } }

Definition at line 58 of file sampprov.h.

#define wEOL L'\0'

Definition at line 70 of file sampprov.h.

Typedef Documentation

typedef struct tagACCESSOR ACCESSOR
typedef VOID** LPLPVOID

Definition at line 104 of file sampprov.h.

typedef struct tagACCESSOR * PACCESSOR
typedef long int SDWORD

Definition at line 106 of file sampprov.h.

typedef signed long SLONG

Definition at line 110 of file sampprov.h.

typedef short int SWORD

Definition at line 107 of file sampprov.h.

typedef unsigned long int UDWORD

Definition at line 108 of file sampprov.h.

typedef unsigned long ULONG

Definition at line 111 of file sampprov.h.

typedef unsigned short USHORT

Definition at line 112 of file sampprov.h.

typedef unsigned short int UWORD

Definition at line 109 of file sampprov.h.

Function Documentation

GLOBAL_ | ( | LONG | ,
 |  | g_cObj | ,
 |  | 0L |
 | ) |  |
GLOBAL_ | ( | IDataConvert * | ,
 |  | g_pIDataConvert | ,
 |  | NULL |
 | ) |  |
GLOBAL_ | ( | HINSTANCE | ,
 |  | g_hInstance | ,
 |  | 0L |
 | ) |  |
GLOBAL_ | ( | DWORD | ,
 |  | g_dwPageSize | ,
 |  | 0L |
 | ) |  |
GLOBAL_ | ( | DWORD | ,
 |  | g_cAttachedProcesses | ,
 |  | 0L |
 | ) |  |
GLOBAL_ | ( | LONG | ,
 |  | g_cLock | ,
 |  | 0L |
 | ) |  |

Variable Documentation

WCHAR g_wszDataSourceKeyword[]

Definition at line 16 of file binder.cpp.

WCHAR g_wszFileKeyword[]

Definition at line 17 of file binder.cpp.

WCHAR g_wszRowKeyword[]

Definition at line 18 of file binder.cpp.

Generated on Wed Nov 13 2024 16:53:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/sampver.h File Reference

  • Dataaccess
  • oledb
  • sampprov
Defines

sampver.h File Reference

Go to the source code of this file.

Defines

#define | IDS_RESDLL_VER 1
#define | VER_COMPANYNAME_STR "Microsoft Corporation\0"
#define | VER_FILEFLAGS (0)
#define | VER_FILEFLAGSMASK (VS_FF_DEBUG | VS_FF_PRERELEASE)
#define | VER_FILEOS VOS_NT_WINDOWS32
#define | VER_FILEVERSION 2,50,4809.0
#define | VER_FILEVERSION_STR "2.50.4809.0\0"
#define | VER_LEGALCOPYRIGHT_STR "Copyright \251 Microsoft Corporation 1991-1999\0"
#define | VER_PRODUCTNAME_STR "Microsoft OLE DB\0"
#define | VER_PRODUCTVERSION 2,50,4809.0
#define | VER_PRODUCTVERSION_STR "2.50.4809.0\0"

Define Documentation

#define IDS_RESDLL_VER 1

Definition at line 34 of file sampver.h.

#define VER_COMPANYNAME_STR "Microsoft Corporation\0"

Definition at line 29 of file sampver.h.

#define VER_FILEFLAGS (0)

Definition at line 24 of file sampver.h.

#define VER_FILEFLAGSMASK (VS_FF_DEBUG | VS_FF_PRERELEASE)

Definition at line 20 of file sampver.h.

#define VER_FILEOS VOS_NT_WINDOWS32

Definition at line 27 of file sampver.h.

#define VER_FILEVERSION 2,50,4809.0

Definition at line 15 of file sampver.h.

#define VER_FILEVERSION_STR "2.50.4809.0\0"

Definition at line 16 of file sampver.h.

#define VER_LEGALCOPYRIGHT_STR "Copyright \251 Microsoft Corporation 1991-1999\0"

Definition at line 31 of file sampver.h.

#define VER_PRODUCTNAME_STR "Microsoft OLE DB\0"

Definition at line 30 of file sampver.h.

#define VER_PRODUCTVERSION 2,50,4809.0

Definition at line 17 of file sampver.h.

#define VER_PRODUCTVERSION_STR "2.50.4809.0\0"

Definition at line 18 of file sampver.h.

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/stream.cpp File Reference

  • Dataaccess
  • oledb
  • sampprov
Functions

stream.cpp File Reference

#include "headers.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CStream

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 168 of file stream.cpp.

{
    if (!--m_cRef)
        {
        delete this;
        return 0;
        }

    return m_cRef;
}

Generated on Wed Nov 13 2024 16:53:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/stream.h File Reference

  • Dataaccess
  • oledb
  • sampprov
Classes

stream.h File Reference

#include "baseobj.h"

Go to the source code of this file.

Classes

class | CImpIGetSourceRow
class | CImpIStream
class | CStream
Generated on Wed Nov 13 2024 16:53:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/utilprop.cpp File Reference

  • Dataaccess
  • oledb
  • sampprov
Defines | Variables

utilprop.cpp File Reference

#include "headers.h"
#include "sampver.h"

Go to the source code of this file.

Defines

#define | __T(x) L ## x
#define | _TEXT(x) __T(x)

Variables

PROPSTRUCT s_rgprop []

Define Documentation

#define __T ( x ) L ## x

Definition at line 33 of file utilprop.cpp.

#define _TEXT ( x ) __T(x)

Definition at line 34 of file utilprop.cpp.

Variable Documentation

PROPSTRUCT s_rgprop[]

Definition at line 39 of file utilprop.cpp.

Generated on Wed Nov 13 2024 16:53:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/sampprov/utilprop.h File Reference

  • Dataaccess
  • oledb
  • sampprov
Classes | Defines | Typedefs | Variables

utilprop.h File Reference

Go to the source code of this file.

Classes

struct | _tagPROPSTRUCT
class | CUtilProp

Defines

#define | CCH_GETPROPERTYINFO_DESCRIP_BUFFER_SIZE 25
#define | NUMBER_OF_SUPPORTED_DATASOURCEINFO_PROPERTIES 8
#define | NUMBER_OF_SUPPORTED_DBINIT_PROPERTIES 3
#define | NUMBER_OF_SUPPORTED_PROPERTIES
#define | NUMBER_OF_SUPPORTED_PROPERTY_SETS 4
#define | NUMBER_OF_SUPPORTED_ROWSET_PROPERTIES 15
#define | NUMBER_OF_SUPPORTED_SESSION_PROPERTIES 1
#define | START_OF_SUPPORTED_DATASOURCEINFO_PROPERTIES
#define | START_OF_SUPPORTED_DBINIT_PROPERTIES
#define | START_OF_SUPPORTED_ROWSET_PROPERTIES 0
#define | START_OF_SUPPORTED_SESSION_PROPERTIES NUMBER_OF_SUPPORTED_ROWSET_PROPERTIES

Typedefs

typedef CUtilProp * | PCUTILPROP
typedef struct _tagPROPSTRUCT | PROPSTRUCT

Variables

const DWORD | PROPSET_DSO = 0x0001
const DWORD | PROPSET_DSOINIT = PROPSET_DSO | PROPSET_INIT
const DWORD | PROPSET_INIT = 0x0002
const DWORD | PROPSET_ROWSET = 0x0008
const DWORD | PROPSET_SESSION = 0x0004

Define Documentation

#define CCH_GETPROPERTYINFO_DESCRIP_BUFFER_SIZE 25

Definition at line 60 of file utilprop.h.

#define NUMBER_OF_SUPPORTED_DATASOURCEINFO_PROPERTIES 8

Definition at line 51 of file utilprop.h.

#define NUMBER_OF_SUPPORTED_DBINIT_PROPERTIES 3

Definition at line 50 of file utilprop.h.

#define NUMBER_OF_SUPPORTED_PROPERTIES
Value:
(NUMBER_OF_SUPPORTED_DBINIT_PROPERTIES +     \
                               NUMBER_OF_SUPPORTED_DATASOURCEINFO_PROPERTIES + \
                               NUMBER_OF_SUPPORTED_SESSION_PROPERTIES +    \
                               NUMBER_OF_SUPPORTED_ROWSET_PROPERTIES)

Definition at line 54 of file utilprop.h.

#define NUMBER_OF_SUPPORTED_PROPERTY_SETS 4

Definition at line 35 of file utilprop.h.

#define NUMBER_OF_SUPPORTED_ROWSET_PROPERTIES 15

Definition at line 53 of file utilprop.h.

#define NUMBER_OF_SUPPORTED_SESSION_PROPERTIES 1

Definition at line 52 of file utilprop.h.

#define START_OF_SUPPORTED_DATASOURCEINFO_PROPERTIES
Value:
(NUMBER_OF_SUPPORTED_ROWSET_PROPERTIES +    \
                               NUMBER_OF_SUPPORTED_SESSION_PROPERTIES)

Definition at line 42 of file utilprop.h.

#define START_OF_SUPPORTED_DBINIT_PROPERTIES
Value:
(NUMBER_OF_SUPPORTED_ROWSET_PROPERTIES +    \
                               NUMBER_OF_SUPPORTED_SESSION_PROPERTIES +   \
                               NUMBER_OF_SUPPORTED_DATASOURCEINFO_PROPERTIES)

Definition at line 45 of file utilprop.h.

#define START_OF_SUPPORTED_ROWSET_PROPERTIES 0

Definition at line 38 of file utilprop.h.

#define START_OF_SUPPORTED_SESSION_PROPERTIES NUMBER_OF_SUPPORTED_ROWSET_PROPERTIES

Definition at line 40 of file utilprop.h.

Typedef Documentation

typedef CUtilProp* PCUTILPROP

Definition at line 156 of file utilprop.h.

typedef struct _tagPROPSTRUCT PROPSTRUCT

Variable Documentation

const DWORD PROPSET_DSO = 0x0001

Definition at line 63 of file utilprop.h.

const DWORD PROPSET_DSOINIT = PROPSET_DSO | PROPSET_INIT

Definition at line 65 of file utilprop.h.

const DWORD PROPSET_INIT = 0x0002

Definition at line 64 of file utilprop.h.

const DWORD PROPSET_ROWSET = 0x0008

Definition at line 67 of file utilprop.h.

const DWORD PROPSET_SESSION = 0x0004

Definition at line 66 of file utilprop.h.

Generated on Wed Nov 13 2024 16:53:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/tablecopy/common.cpp File Reference

  • Dataaccess
  • oledb
  • tablecopy
Classes | Defines | Typedefs | Functions | Variables

common.cpp File Reference

#include "winmain.h"
#include "common.h"
#include "tablecopy.h"
#include "table.h"

Go to the source code of this file.

Classes

struct | _TYPEMAP

Defines

#define | VALUE_WCHAR(value) value, L#value

Typedefs

typedef struct _TYPEMAP | TYPEMAP

Functions

HRESULT | ConvertToMBCS (WCHAR *pwsz, CHAR *psz, ULONG cStrLen)
HRESULT | ConvertToWCHAR (CHAR *psz, WCHAR *pwsz, ULONG cStrLen)
BOOL | FreeBindingData (ULONG cBindings, DBBINDING *rgBindings, void *pData)
BOOL | FreeBindings (ULONG cBindings, DBBINDING *rgBindings)
ULONG | GetCreateParams (WCHAR *pwszCreateParam)
WCHAR * | GetDBTypeName (DBTYPE wType)
BOOL | GetPromotedType (DBTYPE *pwType)
BOOL | IsFixedType (DBTYPE wType)
BOOL | IsNumericType (DBTYPE wType)
BOOL | IsVariableType (DBTYPE wType)
WCHAR * | wcsDuplicate (WCHAR *pwsz)

Variables

TYPEMAP rgDBTypes []
WCHAR | wsz_ASK_DROP_TABLE_ [] = "%s %s already exists. Would you like to drop it?"
WCHAR | wsz_BOGUS_WHERE [] = " WHERE 0 = 1"
WCHAR | wsz_CANCEL [] = "Microsoft OLE DB TableCopy - Cancel"
WCHAR | wsz_CANCEL_OP [] = "Do you want to cancel?"
WCHAR | wsz_COMMA [] = ", "
WCHAR | wsz_CONNECT_STRING_ [] = "%s %s %s %s %s %s"
WCHAR | wsz_COPIED_RECORDS [] = "%lu records copied"
WCHAR | wsz_COPY_FAILURE [] = "Copy failed!"
WCHAR | wsz_COPY_SUCCESS [] = "Copy succeeded, %lu records copied!"
WCHAR | wsz_COPYING [] = "Copying records"
WCHAR | wsz_CREATE_INDEX_ [] = "CREATE%sINDEX "
WCHAR | wsz_CREATE_TABLE [] = "CREATE TABLE "
WCHAR | wsz_DROP_TABLE_ [] = "DROP TABLE %s "
WCHAR | wsz_ERROR [] = "Microsoft OLE DB TableCopy - Error"
WCHAR | wsz_ERRORINFO [] = "Microsoft OLE DB TableCopy - IErrorInfo"
WCHAR | wsz_FROM [] = " FROM "
WCHAR | wsz_FROMQUALTABLE_ [] = "%s, %d Column(s)"
WCHAR | wsz_FROMTABLEHELP_ [] = "Select Desired %s and Columns to Copy"
WCHAR | wsz_INDEX_DESC [] = " DESC "
WCHAR | wsz_INDEX_FAILED_ [] = "INDEX %s failed to be created. Would you like to Continue?"
WCHAR | wsz_INFO [] = "Microsoft OLE DB TableCopy - Info"
WCHAR | wsz_INSERT_INTO [] = "INSERT INTO "
WCHAR | wsz_INVALID_VALUE_ [] = "Invalid Value '%s' specified. Please specify a value >= %lu and <= %lu."
WCHAR | wsz_LPAREN [] = " ( "
WCHAR | wsz_NO_TYPE_FOUND_ [] = "Source Data type not found for %s type"
WCHAR | wsz_NO_TYPE_MATCH_ [] = "Target Data type not found for %s type"
WCHAR | wsz_NOT_CONNECTED [] = "Not Connected: Press Connect to establish a connection"
WCHAR | wsz_OLEDB [] = "Microsoft OLE DB TableCopy"
WCHAR | wsz_PARAM [] = "?"
WCHAR | wsz_PERIOD [] = "."
WCHAR | wsz_PRIMARY_KEY [] = " PRIMARY KEY"
WCHAR | wsz_PROVIDER_INFO_ [] = "%s"
WCHAR | wsz_READONLY_DATASOURCE_ [] = "Datasource %s is marked as read only, it may not be updateable."
WCHAR | wsz_RPAREN [] = " ) "
WCHAR | wsz_SAME_TABLE_NAME [] = "Target %s name must be different on the same DataSource"
WCHAR | wsz_SELECT [] = " SELECT "
WCHAR | wsz_SHOW_SQL_ [] = "DSN = %s\n\nSQL = %s"
WCHAR | wsz_SPACE [] = " "
WCHAR | wsz_SUCCESS [] = "Microsoft OLE DB TableCopy - Success"
WCHAR | wsz_TOTABLEHELP_ [] = "Select Target %s Name"
WCHAR | wsz_TYPEMAPPING_FAILURE [] = "Mapping of Data Types Failed!"
WCHAR | wsz_TYPES_STRING_ [] = "%s %s %s=%s"
WCHAR | wsz_UNIQUE_INDEX [] = " UNIQUE "
WCHAR | wsz_VALUES_CLAUSE [] = " ) VALUES ( "
WCHAR | wsz_WARNING [] = "Microsoft OLE DB TableCopy - Warning"

Define Documentation

#define VALUE_WCHAR ( value ) value, L#value

Definition at line 27 of file common.cpp.

Typedef Documentation

typedef struct _TYPEMAP TYPEMAP

Function Documentation

HRESULT ConvertToMBCS | ( | WCHAR * | pwsz,
 |  | CHAR * | psz,
 |  | ULONG | cStrLen
 | ) |  |

Definition at line 74 of file common.cpp.

{
  ASSERT(pwsz && psz);

  //Convert the string to MBCS
  INT iResult = WideCharToMultiByte(CP_ACP, 0, pwsz, -1, psz, cStrLen, NULL, NULL);
  return iResult ? S_OK : E_FAIL;
}

HRESULT ConvertToWCHAR | ( | CHAR * | psz,
 |  | WCHAR * | pwsz,
 |  | ULONG | cStrLen
 | ) |  |

Definition at line 87 of file common.cpp.

{
  ASSERT(psz && pwsz);

  //Convert the string to MBCS
  INT iResult = MultiByteToWideChar(CP_ACP, 0, psz, -1, pwsz, cStrLen);
  return iResult ? S_OK : E_FAIL;
}

BOOL FreeBindingData | ( | ULONG | cBindings,
 |  | DBBINDING * | rgBindings,
 |  | void * | pData
 | ) |  |

Definition at line 332 of file common.cpp.

{
  ASSERT(pData);

  //Need to walk the array and free any other alloc memory
  for(ULONG i=0; i<cBindings; i++)
  {
    //Free any "out-of-line" memory
    //VARIANT
    if(rgBindings[i].wType == DBTYPE_VARIANT)
    {
      VARIANT* pVariant = (VARIANT*)&BINDING_VALUE(rgBindings[i], pData);
      FreeVariants(1, pVariant);
    }

    //Free any pObjects
    SAFE_FREE(rgBindings[i].pObject);
  }

  return TRUE;
}

BOOL FreeBindings | ( | ULONG | cBindings,
 |  | DBBINDING * | rgBindings
 | ) |  |

Definition at line 359 of file common.cpp.

{
  //Need to walk the array and free any other alloc memory
  for(ULONG i=0; i<cBindings; i++)
  {
    //Free any pObjects
    SAFE_FREE(rgBindings[i].pObject);
  }

  //Now we can free the outer struct
  SAFE_FREE(rgBindings);
  return TRUE;
}

ULONG GetCreateParams ( WCHAR * pwszCreateParam )

Definition at line 127 of file common.cpp.

{
  ASSERT(pwszCreateParam);

  ULONG ulType = 0;

  if(wcsstr(pwszCreateParam, L"precision") || wcsstr(pwszCreateParam, L"PRECISION"))
    ulType |= CP_PRECISION;
  if(wcsstr(pwszCreateParam, L"scale") || wcsstr(pwszCreateParam, L"SCALE"))
    ulType |= CP_SCALE;
  if(wcsstr(pwszCreateParam, L"length") || wcsstr(pwszCreateParam, L"LENGTH"))
    ulType |= CP_LENGTH;
  if(wcsstr(pwszCreateParam, L"max length") || wcsstr(pwszCreateParam, L"MAX LENGTH"))
    ulType |= CP_MAXLENGTH;

  return ulType;
}

WCHAR* GetDBTypeName ( DBTYPE wType )

Definition at line 204 of file common.cpp.

{
  // Do a table look-up on the type
  for(ULONG i=0; i<NUMELE(rgDBTypes); i++)
  {
    if(wType == rgDBTypes[i].wType)
      return rgDBTypes[i].pwszTypeName;
  }

  return rgDBTypes[0].pwszTypeName;
}

BOOL GetPromotedType ( DBTYPE * pwType )

Definition at line 221 of file common.cpp.

{
  ASSERT(pwType);

  //For fixed types we first consider promoting signed types
  //to unsigned types first, before promoting up to the
  //next actual type.  Like DBTYPE_I1 -> DBTYPE_UI1,
  //instead of going directly to DBTYPE_I2.

  switch(*pwType)
  {

    // Integer family
    case DBTYPE_BOOL:
      *pwType = DBTYPE_I1;
      break;

    case DBTYPE_I1:
      *pwType = DBTYPE_UI1;
      break;

    case DBTYPE_UI1:
      *pwType = DBTYPE_I2;
      break;

    case DBTYPE_I2:
      *pwType = DBTYPE_UI2;
      break;

    case DBTYPE_UI2:
      *pwType = DBTYPE_I4;
      break;

    case DBTYPE_I4:
      *pwType = DBTYPE_UI4;
      break;

    case DBTYPE_UI4:
    case DBTYPE_CY:
      *pwType = DBTYPE_I8;
      break;

    case DBTYPE_I8:
      *pwType = DBTYPE_UI8;
      break;

    case DBTYPE_UI8:
      *pwType = DBTYPE_NUMERIC;
      break;

    // Floating-point type family.  FLOAT and DOUBLE actually
    // have the same precision, so do a mutual promotion (that
    // is, allow FLOAT to become DOUBLE and DOUBLE to become
    // FLOAT) before going to CHAR.
    //
    case DBTYPE_R4:
      *pwType = DBTYPE_R8;
      break;

    // Fixed-point exact numerics. Ordering of the two types
    // is unimportant--for our purposes they have exactly the
    // same semantics.
    //
    case DBTYPE_NUMERIC:
      *pwType = DBTYPE_DECIMAL;
      break;

    case DBTYPE_DECIMAL:
      *pwType = DBTYPE_R8;
      break;

    // Binary types
    case DBTYPE_BYTES:
      *pwType = DBTYPE_STR;
      break;

    // Date/Time family
    case DBTYPE_DATE:
    case DBTYPE_DBTIME:
    case DBTYPE_DBDATE:
      *pwType = DBTYPE_DBTIMESTAMP;
      break;

    case DBTYPE_R8:
    case DBTYPE_DBTIMESTAMP:
      *pwType = DBTYPE_BYTES;
      break;

    // Allow WSTR to STR.
    case DBTYPE_WSTR:
      *pwType = DBTYPE_STR;
      break;

    case DBTYPE_VARIANT:
      *pwType = DBTYPE_STR;
      break;

    default:
      return FALSE;
  }

  return TRUE;
}

BOOL IsFixedType ( DBTYPE wType )

Definition at line 168 of file common.cpp.

{
  return !IsVariableType(wType);
}

BOOL IsNumericType ( DBTYPE wType )

Definition at line 177 of file common.cpp.

{
  //According to OLEDB Spec Appendix A (Numeric Data Types)
  switch(wType)
  {
    case DBTYPE_I1:
    case DBTYPE_I2:
    case DBTYPE_I4:
    case DBTYPE_I8:
    case DBTYPE_UI1:
    case DBTYPE_UI2:
    case DBTYPE_UI4:
    case DBTYPE_UI8:
    case DBTYPE_R4:
    case DBTYPE_R8:
    case DBTYPE_CY:
    case DBTYPE_DECIMAL:
    case DBTYPE_NUMERIC:
      return TRUE;
  }
  return FALSE;
}

BOOL IsVariableType ( DBTYPE wType )

Definition at line 150 of file common.cpp.

{
  //According to OLEDB Spec Appendix A (Variable-Length Data Types)
  switch(wType)
  {
    case DBTYPE_STR:
    case DBTYPE_WSTR:
    case DBTYPE_BYTES:
      return TRUE;
  }
  return FALSE;
}

WCHAR* wcsDuplicate ( WCHAR * pwsz )

Definition at line 101 of file common.cpp.

{
  ASSERT(pwsz);

  //no-op case
  if(!pwsz)
    return NULL;

  ULONG cLen  = wcslen(pwsz);

  //Allocate space for the string
  WCHAR* pwszBuffer = NULL;
  SAFE_ALLOC(pwszBuffer, WCHAR, cLen+1);

  //Now copy the string
  wcscpy(pwszBuffer, pwsz);

CLEANUP:
  return pwszBuffer;
}

Variable Documentation

TYPEMAP rgDBTypes[]

Definition at line 35 of file common.cpp.

WCHAR wsz_ASK_DROP_TABLE_[] = "%s %s already exists. Would you like to drop it?"
WCHAR wsz_BOGUS_WHERE[] = " WHERE 0 = 1"
WCHAR wsz_CANCEL[] = "Microsoft OLE DB TableCopy - Cancel"
WCHAR wsz_CANCEL_OP[] = "Do you want to cancel?"
WCHAR wsz_COMMA[] = ", "
WCHAR wsz_CONNECT_STRING_[] = "%s %s %s %s %s %s"
WCHAR wsz_COPIED_RECORDS[] = "%lu records copied"
WCHAR wsz_COPY_FAILURE[] = "Copy failed!"
WCHAR wsz_COPY_SUCCESS[] = "Copy succeeded, %lu records copied!"
WCHAR wsz_COPYING[] = "Copying records"
WCHAR wsz_CREATE_INDEX_[] = "CREATE%sINDEX "
WCHAR wsz_CREATE_TABLE[] = "CREATE TABLE "
WCHAR wsz_DROP_TABLE_[] = "DROP TABLE %s "
WCHAR wsz_ERROR[] = "Microsoft OLE DB TableCopy - Error"
WCHAR wsz_ERRORINFO[] = "Microsoft OLE DB TableCopy - IErrorInfo"
WCHAR wsz_FROM[] = " FROM "
WCHAR wsz_FROMQUALTABLE_[] = "%s, %d Column(s)"
WCHAR wsz_FROMTABLEHELP_[] = "Select Desired %s and Columns to Copy"
WCHAR wsz_INDEX_DESC[] = " DESC "
WCHAR wsz_INDEX_FAILED_[] = "INDEX %s failed to be created. Would you like to Continue?"
WCHAR wsz_INFO[] = "Microsoft OLE DB TableCopy - Info"
WCHAR wsz_INSERT_INTO[] = "INSERT INTO "
WCHAR wsz_INVALID_VALUE_[] = "Invalid Value '%s' specified. Please specify a value >= %lu and <= %lu."
WCHAR wsz_LPAREN[] = " ( "
WCHAR wsz_NO_TYPE_FOUND_[] = "Source Data type not found for %s type"
WCHAR wsz_NO_TYPE_MATCH_[] = "Target Data type not found for %s type"
WCHAR wsz_NOT_CONNECTED[] = "Not Connected: Press Connect to establish a connection"
WCHAR wsz_OLEDB[] = "Microsoft OLE DB TableCopy"
WCHAR wsz_PARAM[] = "?"
WCHAR wsz_PERIOD[] = "."
WCHAR wsz_PRIMARY_KEY[] = " PRIMARY KEY"
WCHAR wsz_PROVIDER_INFO_[] = "%s"
WCHAR wsz_READONLY_DATASOURCE_[] = "Datasource %s is marked as read only, it may not be updateable."
WCHAR wsz_RPAREN[] = " ) "
WCHAR wsz_SAME_TABLE_NAME[] = "Target %s name must be different on the same DataSource"
WCHAR wsz_SELECT[] = " SELECT "
WCHAR wsz_SHOW_SQL_[] = "DSN = %s\n\nSQL = %s"
WCHAR wsz_SPACE[] = " "
WCHAR wsz_SUCCESS[] = "Microsoft OLE DB TableCopy - Success"
WCHAR wsz_TOTABLEHELP_[] = "Select Target %s Name"
WCHAR wsz_TYPEMAPPING_FAILURE[] = "Mapping of Data Types Failed!"
WCHAR wsz_TYPES_STRING_[] = "%s %s %s=%s"
WCHAR wsz_UNIQUE_INDEX[] = " UNIQUE "
WCHAR wsz_VALUES_CLAUSE[] = " ) VALUES ( "
WCHAR wsz_WARNING[] = "Microsoft OLE DB TableCopy - Warning"
Generated on Wed Nov 13 2024 16:53:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/tablecopy/common.h File Reference

  • Dataaccess
  • oledb
  • tablecopy
Defines | Functions | Variables

common.h File Reference

#include "winmain.h"
#include "oledb.h"
#include "oledberr.h"
#include "error.h"
#include "tablecopy.h"
#include "error.h"

Go to the source code of this file.

Defines

#define | __WIDESTRING(str) L##str
#define | ADJUST_SIZE(Size, MaxSize) ((Size) = min((Size), (MaxSize)))
#define | BINDING_LENGTH(Binding, pv) (*(ULONG*)((BYTE*)pv + Binding.obLength))
#define | BINDING_STATUS(Binding, pv) (*(ULONG*)((BYTE*)pv + Binding.obStatus))
#define | BINDING_VALUE(Binding, pv) (*(ULONG*)((BYTE*)pv + Binding.obValue ))
#define | CHECKC(exp) { if(!(exp)) { ASSERT(!#exp); goto CLEANUP; } }
#define | DISP_FILE_LINE
#define | EOL L'\0'
#define | LENGTH_IS_BOUND(Binding) ( Binding.dwPart & DBPART_LENGTH )
#define | NUMELE(rgEle) (sizeof(rgEle) / sizeof(rgEle[0]))
#define | QTESTC(exp) { if(FAILED(exp)) goto CLEANUP; }
#define | ROUNDUP(size) ROUNDUP_(size, ROUNDUP_AMOUNT)
#define | ROUNDUP_(size, amount) (((ULONG)(size)+((amount)-1))&~((amount)-1))
#define | ROUNDUP_AMOUNT 8
#define | SAFE_ADDREF(pv) if(pv) { ((IUnknown*)(pv))->AddRef(); }
#define | SAFE_ALLOC(pv, type, cb) { DISP_FILE_LINE; pv = (type*)CoTaskMemAlloc((cb)*sizeof(type)); CHECK_MEMORY(pv); }
#define | SAFE_FREE(pv) { CoTaskMemFree(pv); pv = NULL; }
#define | SAFE_REALLOC(pv, type, cb) { DISP_FILE_LINE; pv = (type*)CoTaskMemRealloc(pv, (cb)*sizeof(type)); CHECK_MEMORY(pv); }
#define | SAFE_RELEASE(pv) if(pv) { ((IUnknown*)(pv))->Release(); pv = NULL; }
#define | SAFE_SYSALLOC(pv, bstr) { pv = SysAllocString(bstr); CHECK_MEMORY(pv); }
#define | SAFE_SYSFREE(bstr) { SysFreeString(bstr); bstr = NULL; }
#define | SPACE L' '
#define | STATUS_IS_BOUND(Binding) ( Binding.dwPart & DBPART_STATUS )
#define | UNDERSCORE L'_'
#define | VALUE_IS_BOUND(Binding) ( Binding.dwPart & DBPART_VALUE )
#define | WIDESTRING(str) __WIDESTRING(str)
#define | XTEST(exp) { HRESULT Internalhr = exp; if(FAILED(Internalhr)) { DisplayAllErrors(NULL, Internalhr, WIDESTRING(__FILE__), __LINE__); }}
#define | XTESTC(exp) { HRESULT Internalhr = exp; if(FAILED(Internalhr)) { DisplayAllErrors(NULL, Internalhr, WIDESTRING(__FILE__), __LINE__); goto CLEANUP; }}

Functions

HRESULT | ConvertToMBCS (WCHAR *pwsz, CHAR *psz, ULONG cbStrLen)
HRESULT | ConvertToWCHAR (CHAR *psz, WCHAR *pwsz, ULONG cbStrLen)
BOOL | FreeBindingData (ULONG cBindings, DBBINDING *rgBindings, void *pData)
BOOL | FreeBindings (ULONG cBindings, DBBINDING *rgBindings)
ULONG | GetCreateParams (WCHAR *pwszCreateParam)
WCHAR * | GetDBTypeName (DBTYPE wType)
BOOL | GetPromotedType (DBTYPE *pwType)
BOOL | IsFixedType (DBTYPE wType)
BOOL | IsNumericType (DBTYPE wType)
BOOL | IsVariableType (DBTYPE wType)
WCHAR * | wcsDuplicate (WCHAR *pwsz)

Variables

WCHAR | wsz_ASK_DROP_TABLE_ []
WCHAR | wsz_BOGUS_WHERE []
WCHAR | wsz_CANCEL []
WCHAR | wsz_CANCEL_OP []
WCHAR | wsz_COMMA []
WCHAR | wsz_CONNECT_STRING_ []
WCHAR | wsz_COPIED_RECORDS []
WCHAR | wsz_COPY_FAILURE []
WCHAR | wsz_COPY_SUCCESS []
WCHAR | wsz_COPYING []
WCHAR | wsz_CREATE_INDEX_ []
WCHAR | wsz_CREATE_TABLE []
WCHAR | wsz_DROP_TABLE_ []
WCHAR | wsz_ERROR []
WCHAR | wsz_ERRORINFO []
WCHAR | wsz_FROM []
WCHAR | wsz_FROMQUALTABLE_ []
WCHAR | wsz_FROMTABLEHELP_ []
WCHAR | wsz_INDEX_DESC []
WCHAR | wsz_INDEX_FAILED_ []
WCHAR | wsz_INFO []
WCHAR | wsz_INSERT_INTO []
WCHAR | wsz_INVALID_VALUE_ []
WCHAR | wsz_LPAREN []
WCHAR | wsz_NO_TYPE_FOUND_ []
WCHAR | wsz_NO_TYPE_MATCH_ []
WCHAR | wsz_NOT_CONNECTED []
WCHAR | wsz_OLEDB []
WCHAR | wsz_PARAM []
WCHAR | wsz_PERIOD []
WCHAR | wsz_PRIMARY_KEY []
WCHAR | wsz_PROVIDER_INFO_ []
WCHAR | wsz_READONLY_DATASOURCE_ []
WCHAR | wsz_RPAREN []
WCHAR | wsz_SAME_TABLE_NAME []
WCHAR | wsz_SELECT []
WCHAR | wsz_SHOW_SQL_ []
WCHAR | wsz_SPACE []
WCHAR | wsz_SUCCESS []
WCHAR | wsz_TOTABLEHELP_ []
WCHAR | wsz_TYPEMAPPING_FAILURE []
WCHAR | wsz_TYPES_STRING_ []
WCHAR | wsz_UNIQUE_INDEX []
WCHAR | wsz_VALUES_CLAUSE []
WCHAR | wsz_WARNING []

Define Documentation

#define __WIDESTRING ( str ) L##str

Definition at line 33 of file common.h.

#define ADJUST_SIZE | ( | Size,
 |  | MaxSize |
 | ) |  | ((Size) = min((Size), (MaxSize)))

Definition at line 68 of file common.h.

#define BINDING_LENGTH | ( | Binding,
 |  | pv |
 | ) |  | (*(ULONG*)((BYTE*)pv + Binding.obLength))

Definition at line 76 of file common.h.

#define BINDING_STATUS | ( | Binding,
 |  | pv |
 | ) |  | (*(ULONG*)((BYTE*)pv + Binding.obStatus))

Definition at line 72 of file common.h.

#define BINDING_VALUE | ( | Binding,
 |  | pv |
 | ) |  | (*(ULONG*)((BYTE*)pv + Binding.obValue ))

Definition at line 80 of file common.h.

#define CHECKC ( exp ) { if(!(exp)) { ASSERT(!#exp); goto CLEANUP; } }

Definition at line 56 of file common.h.

#define DISP_FILE_LINE

Definition at line 40 of file common.h.

#define EOL L'\0'

Definition at line 183 of file common.h.

#define LENGTH_IS_BOUND ( Binding ) ( Binding.dwPart & DBPART_LENGTH )

Definition at line 75 of file common.h.

#define NUMELE ( rgEle ) (sizeof(rgEle) / sizeof(rgEle[0]))

Definition at line 32 of file common.h.

#define QTESTC ( exp ) { if(FAILED(exp)) goto CLEANUP; }

Definition at line 57 of file common.h.

#define ROUNDUP ( size ) ROUNDUP_(size, ROUNDUP_AMOUNT)

Definition at line 85 of file common.h.

#define ROUNDUP_ | ( | size,
 |  | amount |
 | ) |  | (((ULONG)(size)+((amount)-1))&~((amount)-1))

Definition at line 84 of file common.h.

#define ROUNDUP_AMOUNT 8

Definition at line 83 of file common.h.

#define SAFE_ADDREF ( pv ) if(pv) { ((IUnknown*)(pv))->AddRef(); }

Definition at line 52 of file common.h.

#define SAFE_ALLOC | ( | pv,
 |  | type,
 |  | cb |
 | ) |  | { DISP_FILE_LINE; pv = (type*)CoTaskMemAlloc((cb)*sizeof(type)); CHECK_MEMORY(pv); }

Definition at line 44 of file common.h.

#define SAFE_FREE ( pv ) { CoTaskMemFree(pv); pv = NULL; }

Definition at line 48 of file common.h.

#define SAFE_REALLOC | ( | pv,
 |  | type,
 |  | cb |
 | ) |  | { DISP_FILE_LINE; pv = (type*)CoTaskMemRealloc(pv, (cb)*sizeof(type)); CHECK_MEMORY(pv); }

Definition at line 45 of file common.h.

#define SAFE_RELEASE ( pv ) if(pv) { ((IUnknown*)(pv))->Release(); pv = NULL; }

Definition at line 53 of file common.h.

#define SAFE_SYSALLOC | ( | pv,
 |  | bstr |
 | ) |  | { pv = SysAllocString(bstr); CHECK_MEMORY(pv); }

Definition at line 46 of file common.h.

#define SAFE_SYSFREE ( bstr ) { SysFreeString(bstr); bstr = NULL; }

Definition at line 49 of file common.h.

#define SPACE L' '

Definition at line 184 of file common.h.

#define STATUS_IS_BOUND ( Binding ) ( Binding.dwPart & DBPART_STATUS )

Definition at line 71 of file common.h.

#define UNDERSCORE L'_'

Definition at line 185 of file common.h.

#define VALUE_IS_BOUND ( Binding ) ( Binding.dwPart & DBPART_VALUE )

Definition at line 79 of file common.h.

#define WIDESTRING ( str ) __WIDESTRING(str)

Definition at line 34 of file common.h.

#define XTEST ( exp ) { HRESULT Internalhr = exp; if(FAILED(Internalhr)) { DisplayAllErrors(NULL, Internalhr, WIDESTRING(__FILE__), __LINE__); }}

Definition at line 59 of file common.h.

#define XTESTC ( exp ) { HRESULT Internalhr = exp; if(FAILED(Internalhr)) { DisplayAllErrors(NULL, Internalhr, WIDESTRING(__FILE__), __LINE__); goto CLEANUP; }}

Definition at line 60 of file common.h.

Function Documentation

HRESULT ConvertToMBCS | ( | WCHAR * | pwsz,
 |  | CHAR * | psz,
 |  | ULONG | cbStrLen
 | ) |  |

Definition at line 47 of file asserts.cpp.

{
  ASSERT(psz);

  //No-op
  if(pwsz==NULL)
  {
    psz[0] = EOL;
    return S_FALSE;
  }

  //Convert the string to MBCS
  //NOTE:  WideCharToMultiByte returns 0 if truncation occurs!  So when iResult = 0
  //you can be assured the amount copied is the maximum length of the buffer...
  INT iResult = WideCharToMultiByte(CP_OEMCP, 0, pwsz, -1, psz, cStrLen, NULL, NULL);
  return iResult ? S_OK : E_FAIL;
}

HRESULT ConvertToWCHAR | ( | CHAR * | psz,
 |  | WCHAR * | pwsz,
 |  | ULONG | cbStrLen
 | ) |  |

Definition at line 69 of file asserts.cpp.

{
  ASSERT(pwsz);

  //No-op
  if(psz==NULL)
  {
    pwsz[0] = wEOL;
    return S_FALSE;
  }

  //Convert the string to MBCS
  //NOTE:  MultiByteToWideChar returns 0 if truncation occurs!  So when iResult = 0
  //you can be assured the amount copied is the maximum length of the buffer...
  INT iResult = MultiByteToWideChar(CP_OEMCP, 0, psz, -1, pwsz, cStrLen);
  return iResult ? S_OK : E_FAIL;
}

BOOL FreeBindingData | ( | ULONG | cBindings,
 |  | DBBINDING * | rgBindings,
 |  | void * | pData
 | ) |  |

Definition at line 332 of file common.cpp.

{
  ASSERT(pData);

  //Need to walk the array and free any other alloc memory
  for(ULONG i=0; i<cBindings; i++)
  {
    //Free any "out-of-line" memory
    //VARIANT
    if(rgBindings[i].wType == DBTYPE_VARIANT)
    {
      VARIANT* pVariant = (VARIANT*)&BINDING_VALUE(rgBindings[i], pData);
      FreeVariants(1, pVariant);
    }

    //Free any pObjects
    SAFE_FREE(rgBindings[i].pObject);
  }

  return TRUE;
}

BOOL FreeBindings | ( | ULONG | cBindings,
 |  | DBBINDING * | rgBindings
 | ) |  |

Definition at line 359 of file common.cpp.

{
  //Need to walk the array and free any other alloc memory
  for(ULONG i=0; i<cBindings; i++)
  {
    //Free any pObjects
    SAFE_FREE(rgBindings[i].pObject);
  }

  //Now we can free the outer struct
  SAFE_FREE(rgBindings);
  return TRUE;
}

ULONG GetCreateParams ( WCHAR * pwszCreateParam )

Definition at line 127 of file common.cpp.

{
  ASSERT(pwszCreateParam);

  ULONG ulType = 0;

  if(wcsstr(pwszCreateParam, L"precision") || wcsstr(pwszCreateParam, L"PRECISION"))
    ulType |= CP_PRECISION;
  if(wcsstr(pwszCreateParam, L"scale") || wcsstr(pwszCreateParam, L"SCALE"))
    ulType |= CP_SCALE;
  if(wcsstr(pwszCreateParam, L"length") || wcsstr(pwszCreateParam, L"LENGTH"))
    ulType |= CP_LENGTH;
  if(wcsstr(pwszCreateParam, L"max length") || wcsstr(pwszCreateParam, L"MAX LENGTH"))
    ulType |= CP_MAXLENGTH;

  return ulType;
}

WCHAR* GetDBTypeName ( DBTYPE wType )

Definition at line 2155 of file common.cpp.

{
  return GetBitMapName(wType, g_cDBTypes, g_rgDBTypes, DBTYPE_VECTOR | DBTYPE_ARRAY | DBTYPE_BYREF | DBTYPE_RESERVED/*dwBitStart*/);
}

BOOL GetPromotedType ( DBTYPE * pwType )

Definition at line 221 of file common.cpp.

{
  ASSERT(pwType);

  //For fixed types we first consider promoting signed types
  //to unsigned types first, before promoting up to the
  //next actual type.  Like DBTYPE_I1 -> DBTYPE_UI1,
  //instead of going directly to DBTYPE_I2.

  switch(*pwType)
  {

    // Integer family
    case DBTYPE_BOOL:
      *pwType = DBTYPE_I1;
      break;

    case DBTYPE_I1:
      *pwType = DBTYPE_UI1;
      break;

    case DBTYPE_UI1:
      *pwType = DBTYPE_I2;
      break;

    case DBTYPE_I2:
      *pwType = DBTYPE_UI2;
      break;

    case DBTYPE_UI2:
      *pwType = DBTYPE_I4;
      break;

    case DBTYPE_I4:
      *pwType = DBTYPE_UI4;
      break;

    case DBTYPE_UI4:
    case DBTYPE_CY:
      *pwType = DBTYPE_I8;
      break;

    case DBTYPE_I8:
      *pwType = DBTYPE_UI8;
      break;

    case DBTYPE_UI8:
      *pwType = DBTYPE_NUMERIC;
      break;

    // Floating-point type family.  FLOAT and DOUBLE actually
    // have the same precision, so do a mutual promotion (that
    // is, allow FLOAT to become DOUBLE and DOUBLE to become
    // FLOAT) before going to CHAR.
    //
    case DBTYPE_R4:
      *pwType = DBTYPE_R8;
      break;

    // Fixed-point exact numerics. Ordering of the two types
    // is unimportant--for our purposes they have exactly the
    // same semantics.
    //
    case DBTYPE_NUMERIC:
      *pwType = DBTYPE_DECIMAL;
      break;

    case DBTYPE_DECIMAL:
      *pwType = DBTYPE_R8;
      break;

    // Binary types
    case DBTYPE_BYTES:
      *pwType = DBTYPE_STR;
      break;

    // Date/Time family
    case DBTYPE_DATE:
    case DBTYPE_DBTIME:
    case DBTYPE_DBDATE:
      *pwType = DBTYPE_DBTIMESTAMP;
      break;

    case DBTYPE_R8:
    case DBTYPE_DBTIMESTAMP:
      *pwType = DBTYPE_BYTES;
      break;

    // Allow WSTR to STR.
    case DBTYPE_WSTR:
      *pwType = DBTYPE_STR;
      break;

    case DBTYPE_VARIANT:
      *pwType = DBTYPE_STR;
      break;

    default:
      return FALSE;
  }

  return TRUE;
}

BOOL IsFixedType ( DBTYPE wType )

Definition at line 1955 of file common.cpp.

{
  return !IsVariableType(wType);
}

BOOL IsNumericType ( DBTYPE wType )

Definition at line 1964 of file common.cpp.

{
  //According to OLE DB Spec Appendix A (Numeric Data Types)
  switch(wType)
  {
    case DBTYPE_I1:
    case DBTYPE_I2:
    case DBTYPE_I4:
    case DBTYPE_I8:
    case DBTYPE_UI1:
    case DBTYPE_UI2:
    case DBTYPE_UI4:
    case DBTYPE_UI8:
    case DBTYPE_R4:
    case DBTYPE_R8:
    case DBTYPE_CY:
    case DBTYPE_DECIMAL:
    case DBTYPE_NUMERIC:
      return TRUE;
  }
  return FALSE;
}

BOOL IsVariableType ( DBTYPE wType )

Definition at line 1936 of file common.cpp.

{
  //According to OLE DB Spec Appendix A (Variable-Length Data Types)
  switch(wType)
  {
    case DBTYPE_STR:
    case DBTYPE_WSTR:
    case DBTYPE_BYTES:
    case DBTYPE_VARNUMERIC:
      return TRUE;
  }
  return FALSE;
}

WCHAR* wcsDuplicate ( WCHAR * pwsz )

Definition at line 101 of file common.cpp.

{
  ASSERT(pwsz);

  //no-op case
  if(!pwsz)
    return NULL;

  ULONG cLen  = wcslen(pwsz);

  //Allocate space for the string
  WCHAR* pwszBuffer = NULL;
  SAFE_ALLOC(pwszBuffer, WCHAR, cLen+1);

  //Now copy the string
  wcscpy(pwszBuffer, pwsz);

CLEANUP:
  return pwszBuffer;
}

Variable Documentation

WCHAR wsz_ASK_DROP_TABLE_[]
WCHAR wsz_BOGUS_WHERE[]
WCHAR wsz_CANCEL[]
WCHAR wsz_CANCEL_OP[]
WCHAR wsz_COMMA[]
WCHAR wsz_CONNECT_STRING_[]
WCHAR wsz_COPIED_RECORDS[]
WCHAR wsz_COPY_FAILURE[]
WCHAR wsz_COPY_SUCCESS[]
WCHAR wsz_COPYING[]
WCHAR wsz_CREATE_INDEX_[]
WCHAR wsz_CREATE_TABLE[]
WCHAR wsz_DROP_TABLE_[]
WCHAR wsz_ERROR[]
WCHAR wsz_ERRORINFO[]
WCHAR wsz_FROM[]
WCHAR wsz_FROMQUALTABLE_[]
WCHAR wsz_FROMTABLEHELP_[]
WCHAR wsz_INDEX_DESC[]
WCHAR wsz_INDEX_FAILED_[]
WCHAR wsz_INFO[]
WCHAR wsz_INSERT_INTO[]
WCHAR wsz_INVALID_VALUE_[]
WCHAR wsz_LPAREN[]
WCHAR wsz_NO_TYPE_FOUND_[]
WCHAR wsz_NO_TYPE_MATCH_[]
WCHAR wsz_NOT_CONNECTED[]
WCHAR wsz_OLEDB[]
WCHAR wsz_PARAM[]
WCHAR wsz_PERIOD[]
WCHAR wsz_PRIMARY_KEY[]
WCHAR wsz_PROVIDER_INFO_[]
WCHAR wsz_READONLY_DATASOURCE_[]
WCHAR wsz_RPAREN[]
WCHAR wsz_SAME_TABLE_NAME[]
WCHAR wsz_SELECT[]
WCHAR wsz_SHOW_SQL_[]
WCHAR wsz_SPACE[]
WCHAR wsz_SUCCESS[]
WCHAR wsz_TOTABLEHELP_[]
WCHAR wsz_TYPEMAPPING_FAILURE[]
WCHAR wsz_TYPES_STRING_[]
WCHAR wsz_UNIQUE_INDEX[]
WCHAR wsz_VALUES_CLAUSE[]
WCHAR wsz_WARNING[]
Generated on Wed Nov 13 2024 16:53:11 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/tablecopy/datasource.cpp File Reference

  • Dataaccess
  • oledb
  • tablecopy

datasource.cpp File Reference

#include "WinMain.h"
#include "Common.h"
#include "DataSource.h"
#include "msdaguid.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/tablecopy/datasource.h File Reference

  • Dataaccess
  • oledb
  • tablecopy
Classes

datasource.h File Reference

#include "Property.h"
#include "Property.h"

Go to the source code of this file.

Classes

class | CDataSource
struct | PROVIDERINFO
Generated on Wed Nov 13 2024 16:53:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/tablecopy/error.cpp File Reference

  • Dataaccess
  • oledb
  • tablecopy
Classes | Defines | Typedefs | Functions | Variables

error.cpp File Reference

#include "WinMain.h"
#include "Error.h"
#include <olectl.h>

Go to the source code of this file.

Classes

struct | _ERRORMAP
struct | _INTERFACEMAP

Defines

#define | VALUE_WCHAR(value) value, L#value

Typedefs

typedef struct _ERRORMAP | ERRORMAP
typedef struct _INTERFACEMAP | INTERFACEMAP

Functions

HRESULT | DisplayAllErrors (HWND hWnd, HRESULT Actualhr, WCHAR *pwszFile, ULONG ulLine)
HRESULT | DisplayErrorRecords (HWND hWnd, ULONG cRecords, IErrorRecords *pIErrorRecords, WCHAR *pwszFile, ULONG ulLine)
WCHAR * | GetErrorName (HRESULT hr)
HRESULT | GetErrorRecords (ULONG *pcRecords, IErrorRecords **ppIErrorRecords)
WCHAR * | GetInterfaceName (REFIID riid)
HRESULT | GetSqlErrorInfo (ULONG iRecord, IErrorRecords *pIErrorRecords, BSTR *pBstr)

Variables

ERRORMAP rgErrorMap []
INTERFACEMAP rgInterfaceMap []

Define Documentation

#define VALUE_WCHAR ( value ) value, L#value

Definition at line 27 of file error.cpp.

Typedef Documentation

typedef struct _ERRORMAP ERRORMAP
typedef struct _INTERFACEMAP INTERFACEMAP

Function Documentation

HRESULT DisplayAllErrors | ( | HWND | hWnd,
 |  | HRESULT | Actualhr,
 |  | WCHAR * | pwszFile,
 |  | ULONG | ulLine
 | ) |  |

Definition at line 336 of file error.cpp.

{
  HRESULT hr = S_OK;

  ULONG cRecords = 0;
  IErrorRecords* pIErrorRecords = NULL;

  //Try to display Extened ErrorInfo
  if((hr = GetErrorRecords(&cRecords, &pIErrorRecords))==S_OK)
  {
    hr = DisplayErrorRecords(hWnd, cRecords, pIErrorRecords, pwszFile, ulLine);
  }
  //If not available, display MSG Box with info
  else
  {
    //display the Error
    wMessageBox(hWnd, (hWnd ? MB_APPLMODAL : MB_TASKMODAL) | MB_ICONEXCLAMATION | MB_OK, wsz_ERRORINFO,
      L"Interface: %s\nResult: %x = %s\n\nIErrorInfo: %s\n\nFile: %s\nLine: %d", L"Unknown", Actualhr, GetErrorName(Actualhr), L"Error Object not available", pwszFile, ulLine);
  }

  SAFE_RELEASE(pIErrorRecords);
  return hr;
}

HRESULT DisplayErrorRecords | ( | HWND | hWnd,
 |  | ULONG | cRecords,
 |  | IErrorRecords * | pIErrorRecords,
 |  | WCHAR * | pwszFile,
 |  | ULONG | ulLine
 | ) |  |

Definition at line 366 of file error.cpp.

{
  HRESULT hr = S_OK;

  IErrorInfo* pIErrorInfo = NULL;
  BSTR bstrErrorInfo = NULL;
  BSTR bstrSQLInfo = NULL;

  LCID lcid = GetSystemDefaultLCID();

  //Get the Error Records
  if(cRecords && pIErrorRecords)
  {
    LONG lNativeError = 0;
    ERRORINFO ErrorInfo;

    //Loop through the records
    for(ULONG i=0; i<cRecords; i++)
    {
      //GetErrorInfo
      XTESTC(hr = pIErrorRecords->GetErrorInfo(i,lcid,&pIErrorInfo));

      //Get the Description
      XTESTC(hr = pIErrorInfo->GetDescription(&bstrErrorInfo));

      //Get the Basic ErrorInfo
      XTESTC(hr = pIErrorRecords->GetBasicErrorInfo(i,&ErrorInfo));

      //Get the SQL Info
      GetSqlErrorInfo(i, pIErrorRecords, &bstrSQLInfo);

      //Display the Error
      if(bstrSQLInfo)
        wMessageBox(hWnd, (hWnd ? MB_APPLMODAL : MB_TASKMODAL) | MB_ICONEXCLAMATION | MB_OK, wsz_ERRORINFO, L"Interface: %s\nResult: %x = %s\n\nIErrorInfo: [%s] %s\n\nFile: %s\nLine: %d", GetInterfaceName(ErrorInfo.iid), ErrorInfo.hrError, GetErrorName(ErrorInfo.hrError), bstrSQLInfo, bstrErrorInfo, pwszFile, ulLine);
      else
        wMessageBox(hWnd, (hWnd ? MB_APPLMODAL : MB_TASKMODAL) | MB_ICONEXCLAMATION | MB_OK, wsz_ERRORINFO, L"Interface: %s\nResult: %x = %s\n\nIErrorInfo: %s\n\nFile: %s\nLine: %d", GetInterfaceName(ErrorInfo.iid), ErrorInfo.hrError, GetErrorName(ErrorInfo.hrError), bstrErrorInfo, pwszFile, ulLine);

      SAFE_RELEASE(pIErrorInfo);
      SAFE_SYSFREE(bstrErrorInfo);
      SAFE_SYSFREE(bstrSQLInfo);
    }
  }

CLEANUP:
  SAFE_RELEASE(pIErrorInfo);
  SAFE_SYSFREE(bstrErrorInfo);
  SAFE_SYSFREE(bstrSQLInfo);
  return hr;
}

WCHAR* GetErrorName ( HRESULT hr )

Definition at line 237 of file error.cpp.

{
  for(ULONG i=0; i<NUMELE(rgErrorMap); i++)
  {
    if(hr == rgErrorMap[i].hr)
      return rgErrorMap[i].pwszError;
  }

  //Otherwise just return Unknown
  return rgErrorMap[0].pwszError;
}

HRESULT GetErrorRecords | ( | ULONG * | pcRecords,
 |  | IErrorRecords ** | ppIErrorRecords
 | ) |  |

Definition at line 272 of file error.cpp.

{
  ASSERT(pcRecords && ppIErrorRecords);
  HRESULT hr;

  //NULL output params
  *pcRecords = 0;
  *ppIErrorRecords = NULL;

  ISupportErrorInfo* pISupportErrorInfo = NULL;
  IErrorInfo* pIErrorInfo = NULL;

  //See if this interface supports ErrorInfo
  //If not there is no reason to display any error
  if((hr = GetErrorInfo(0, &pIErrorInfo))==S_OK && pIErrorInfo)
  {
    //IErrorRecords may not be supported on the existing error object.
    //Some other things could have posted an error object (VB) for example...
    QTESTC(hr = pIErrorInfo->QueryInterface(IID_IErrorRecords, (void**)ppIErrorRecords));
    XTESTC(hr = (*ppIErrorRecords)->GetRecordCount(pcRecords));
  }

CLEANUP:
  SAFE_RELEASE(pISupportErrorInfo);
  SAFE_RELEASE(pIErrorInfo);
  return hr;
}

WCHAR* GetInterfaceName ( REFIID riid )

Definition at line 254 of file error.cpp.

{
  for(ULONG i=0; i<NUMELE(rgInterfaceMap); i++)
  {
    if(riid == *(rgInterfaceMap[i].pIID))
      return rgInterfaceMap[i].pwszInterface;
  }

  //Otherwise just return IUnknown
  return rgInterfaceMap[0].pwszInterface;
}

HRESULT GetSqlErrorInfo | ( | ULONG | iRecord,
 |  | IErrorRecords * | pIErrorRecords,
 |  | BSTR * | pBstr
 | ) |  |

Definition at line 306 of file error.cpp.

{
  ASSERT(pBstr);
  HRESULT hr = S_OK;

  ISQLErrorInfo* pISQLErrorInfo = NULL;
  LONG lNativeError = 0;

  //Get the Error Records
  if(pIErrorRecords)
  {
    //If there is ErrorInfo, GetSQLInfo for the desired record
    //ISQLErrorInfo is not mandatory
    QTESTC(hr = pIErrorRecords->GetCustomErrorObject(iRecord, IID_ISQLErrorInfo, (IUnknown**)&pISQLErrorInfo));

    //If there was a CustomErrorObject
    if(pISQLErrorInfo)
      hr = pISQLErrorInfo->GetSQLInfo(pBstr, &lNativeError);
  }

CLEANUP:
  SAFE_RELEASE(pISQLErrorInfo);
  return hr;
}

Variable Documentation

ERRORMAP rgErrorMap[]

Definition at line 111 of file error.cpp.

INTERFACEMAP rgInterfaceMap[]

Definition at line 37 of file error.cpp.

Generated on Wed Nov 13 2024 16:53:28 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/tablecopy/error.h File Reference

  • Dataaccess
  • oledb
  • tablecopy
Functions

error.h File Reference

#include "common.h"

Go to the source code of this file.

Functions

HRESULT | DisplayAllErrors (HWND hWnd, HRESULT hr, WCHAR *pwszFile=L"Unknown", ULONG ulLine=0)
HRESULT | DisplayErrorRecords (HWND hWnd, ULONG cRecords, IErrorRecords *pIErrorRecords, WCHAR *pwszFile=L"Unknown", ULONG ulLine=0)
WCHAR * | GetErrorName (HRESULT hr)
HRESULT | GetErrorRecords (ULONG *pcRecords, IErrorRecords **ppIErrorRecords)
HRESULT | GetSqlErrorInfo (ULONG iRecord, IErrorRecords *pIErrorRecords, BSTR *pBstr)

Function Documentation

HRESULT DisplayAllErrors | ( | HWND | hWnd,
 |  | HRESULT | hr,
 |  | WCHAR * | pwszFile = L"Unknown",
 |  | ULONG | ulLine = 0
 | ) |  |

Definition at line 336 of file error.cpp.

{
  HRESULT hr = S_OK;

  ULONG cRecords = 0;
  IErrorRecords* pIErrorRecords = NULL;

  //Try to display Extened ErrorInfo
  if((hr = GetErrorRecords(&cRecords, &pIErrorRecords))==S_OK)
  {
    hr = DisplayErrorRecords(hWnd, cRecords, pIErrorRecords, pwszFile, ulLine);
  }
  //If not available, display MSG Box with info
  else
  {
    //display the Error
    wMessageBox(hWnd, (hWnd ? MB_APPLMODAL : MB_TASKMODAL) | MB_ICONEXCLAMATION | MB_OK, wsz_ERRORINFO,
      L"Interface: %s\nResult: %x = %s\n\nIErrorInfo: %s\n\nFile: %s\nLine: %d", L"Unknown", Actualhr, GetErrorName(Actualhr), L"Error Object not available", pwszFile, ulLine);
  }

  SAFE_RELEASE(pIErrorRecords);
  return hr;
}

HRESULT DisplayErrorRecords | ( | HWND | hWnd,
 |  | ULONG | cRecords,
 |  | IErrorRecords * | pIErrorRecords,
 |  | WCHAR * | pwszFile = L"Unknown",
 |  | ULONG | ulLine = 0
 | ) |  |

Definition at line 366 of file error.cpp.

{
  HRESULT hr = S_OK;

  IErrorInfo* pIErrorInfo = NULL;
  BSTR bstrErrorInfo = NULL;
  BSTR bstrSQLInfo = NULL;

  LCID lcid = GetSystemDefaultLCID();

  //Get the Error Records
  if(cRecords && pIErrorRecords)
  {
    LONG lNativeError = 0;
    ERRORINFO ErrorInfo;

    //Loop through the records
    for(ULONG i=0; i<cRecords; i++)
    {
      //GetErrorInfo
      XTESTC(hr = pIErrorRecords->GetErrorInfo(i,lcid,&pIErrorInfo));

      //Get the Description
      XTESTC(hr = pIErrorInfo->GetDescription(&bstrErrorInfo));

      //Get the Basic ErrorInfo
      XTESTC(hr = pIErrorRecords->GetBasicErrorInfo(i,&ErrorInfo));

      //Get the SQL Info
      GetSqlErrorInfo(i, pIErrorRecords, &bstrSQLInfo);

      //Display the Error
      if(bstrSQLInfo)
        wMessageBox(hWnd, (hWnd ? MB_APPLMODAL : MB_TASKMODAL) | MB_ICONEXCLAMATION | MB_OK, wsz_ERRORINFO, L"Interface: %s\nResult: %x = %s\n\nIErrorInfo: [%s] %s\n\nFile: %s\nLine: %d", GetInterfaceName(ErrorInfo.iid), ErrorInfo.hrError, GetErrorName(ErrorInfo.hrError), bstrSQLInfo, bstrErrorInfo, pwszFile, ulLine);
      else
        wMessageBox(hWnd, (hWnd ? MB_APPLMODAL : MB_TASKMODAL) | MB_ICONEXCLAMATION | MB_OK, wsz_ERRORINFO, L"Interface: %s\nResult: %x = %s\n\nIErrorInfo: %s\n\nFile: %s\nLine: %d", GetInterfaceName(ErrorInfo.iid), ErrorInfo.hrError, GetErrorName(ErrorInfo.hrError), bstrErrorInfo, pwszFile, ulLine);

      SAFE_RELEASE(pIErrorInfo);
      SAFE_SYSFREE(bstrErrorInfo);
      SAFE_SYSFREE(bstrSQLInfo);
    }
  }

CLEANUP:
  SAFE_RELEASE(pIErrorInfo);
  SAFE_SYSFREE(bstrErrorInfo);
  SAFE_SYSFREE(bstrSQLInfo);
  return hr;
}

WCHAR* GetErrorName ( HRESULT hr )

Definition at line 2686 of file error.cpp.

{
  return GetMapName(hr, NUMELE(g_rgErrorMap), g_rgErrorMap);
}

HRESULT GetErrorRecords | ( | ULONG * | pcRecords,
 |  | IErrorRecords ** | ppIErrorRecords
 | ) |  |

Definition at line 272 of file error.cpp.

{
  ASSERT(pcRecords && ppIErrorRecords);
  HRESULT hr;

  //NULL output params
  *pcRecords = 0;
  *ppIErrorRecords = NULL;

  ISupportErrorInfo* pISupportErrorInfo = NULL;
  IErrorInfo* pIErrorInfo = NULL;

  //See if this interface supports ErrorInfo
  //If not there is no reason to display any error
  if((hr = GetErrorInfo(0, &pIErrorInfo))==S_OK && pIErrorInfo)
  {
    //IErrorRecords may not be supported on the existing error object.
    //Some other things could have posted an error object (VB) for example...
    QTESTC(hr = pIErrorInfo->QueryInterface(IID_IErrorRecords, (void**)ppIErrorRecords));
    XTESTC(hr = (*ppIErrorRecords)->GetRecordCount(pcRecords));
  }

CLEANUP:
  SAFE_RELEASE(pISupportErrorInfo);
  SAFE_RELEASE(pIErrorInfo);
  return hr;
}

HRESULT GetSqlErrorInfo | ( | ULONG | iRecord,
 |  | IErrorRecords * | pIErrorRecords,
 |  | BSTR * | pBstr
 | ) |  |

Definition at line 306 of file error.cpp.

{
  ASSERT(pBstr);
  HRESULT hr = S_OK;

  ISQLErrorInfo* pISQLErrorInfo = NULL;
  LONG lNativeError = 0;

  //Get the Error Records
  if(pIErrorRecords)
  {
    //If there is ErrorInfo, GetSQLInfo for the desired record
    //ISQLErrorInfo is not mandatory
    QTESTC(hr = pIErrorRecords->GetCustomErrorObject(iRecord, IID_ISQLErrorInfo, (IUnknown**)&pISQLErrorInfo));

    //If there was a CustomErrorObject
    if(pISQLErrorInfo)
      hr = pISQLErrorInfo->GetSQLInfo(pBstr, &lNativeError);
  }

CLEANUP:
  SAFE_RELEASE(pISQLErrorInfo);
  return hr;
}

Generated on Wed Nov 13 2024 16:53:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/tablecopy/list.h File Reference

  • Dataaccess
  • oledb
  • tablecopy
Classes | Typedefs

list.h File Reference

Go to the source code of this file.

Classes

class | CList< TYPE, ARG_TYPE >
class | CNode< TYPE >

Typedefs

typedef void * | LISTPOS

Typedef Documentation

typedef void* LISTPOS

Definition at line 23 of file list.h.

Generated on Wed Nov 13 2024 16:53:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/tablecopy/progress.cpp File Reference

  • Dataaccess
  • oledb
  • tablecopy

progress.cpp File Reference

#include "progress.h"
#include "common.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/tablecopy/progress.h File Reference

  • Dataaccess
  • oledb
  • tablecopy
Classes

progress.h File Reference

#include "wizard.h"

Go to the source code of this file.

Classes

class CProgress
Generated on Wed Nov 13 2024 16:53:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/tablecopy/property.cpp File Reference

  • Dataaccess
  • oledb
  • tablecopy
Functions

property.cpp File Reference

#include "WinMain.h"
#include "Property.h"

Go to the source code of this file.

Functions

HRESULT | FreeProperties (ULONG cProperties, DBPROP *rgProperties)
HRESULT | FreeProperties (ULONG cPropSets, DBPROPSET *rgPropSets)
HRESULT | FreeVariants (ULONG cVariants, VARIANT *rgVariants)
HRESULT | GetProperty (IUnknown *pIUnknown, DBPROPID PropertyID, GUID guidPropertySet, WCHAR **ppwszValue)
HRESULT | GetProperty (IUnknown *pIUnknown, DBPROPID PropertyID, GUID guidPropertySet, ULONG *pcValue)
HRESULT | GetProperty (IUnknown *pIUnknown, DBPROPID PropertyID, GUID guidPropertySet, BOOL *pbValue)
HRESULT | GetProperty (IUnknown *pIUnknown, DBPROPID PropertyID, GUID guidPropertySet, WCHAR *pwszValue)
HRESULT | GetProperty (IUnknown *pIUnknown, DBPROPID PropertyID, GUID guidPropertySet, DBPROP **ppProperty)
HRESULT | GetPropInfo (IUnknown *pIUnknown, DBPROPID PropertyID, GUID guidPropertySet, DBPROPINFO **ppPropInfo)
DBPROPFLAGS | GetPropInfoFlags (IUnknown *pIUnknown, DBPROPID PropertyID, GUID guidPropertySet)
HRESULT | InitVariants (ULONG cVariants, VARIANT *rgVariants)
BOOL | IsSettableProperty (IUnknown *pIUnknown, DBPROPID PropertyID, GUID guidPropertySet)
BOOL | IsSupportedProperty (IUnknown *pIUnknown, DBPROPID PropertyID, GUID guidPropertySet)
HRESULT | SetProperty (DBPROPID PropertyID, GUID guidPropertySet, ULONG *pcPropSets, DBPROPSET **prgPropSets, DBTYPE wType, void *pv, DBPROPOPTIONS dwOptions, DBID colid)
HRESULT | SetProperty (DBPROPID PropertyID, GUID guidPropertySet, ULONG *pcPropSets, DBPROPSET **prgPropSets, DBTYPE wType, ULONG ulValue, DBPROPOPTIONS dwOptions, DBID colid)
HRESULT | SetRestriction (VARIANT *pRestriction, WCHAR *pwszValue)

Function Documentation

HRESULT FreeProperties | ( | ULONG | cProperties,
 |  | DBPROP * | rgProperties
 | ) |  |

Definition at line 442 of file property.cpp.

{
  HRESULT hr = S_OK;

  //no-op case
  if(cProperties==0 || rgProperties==NULL)
    return S_OK;

  //Free the inner variants first
  for(ULONG i=0; i<cProperties; i++)
  {
    //if DBPROPSTATUS_NOTSUPPORTED then vValue is undefined
    if(rgProperties[i].dwStatus != DBPROPSTATUS_NOTSUPPORTED)
      XTEST(hr = VariantClear(&rgProperties[i].vValue));
  }

  //Now free the set
  SAFE_FREE(rgProperties);
  return hr;
}

HRESULT FreeProperties | ( | ULONG | cPropSets,
 |  | DBPROPSET * | rgPropSets
 | ) |  |

Definition at line 467 of file property.cpp.

{
  HRESULT hr = S_OK;

  //Loop over all the property sets
  for(ULONG i=0; i<cPropSets; i++)
    FreeProperties(rgPropSets[i].cProperties, rgPropSets[i].rgProperties);

  //Now free the outer set
  SAFE_FREE(rgPropSets);
  return hr;
}

HRESULT FreeVariants | ( | ULONG | cVariants,
 |  | VARIANT * | rgVariants
 | ) |  |

Definition at line 426 of file property.cpp.

{
  HRESULT hr = S_OK;

  //Free the inner variants first
  for(ULONG i=0; i<cVariants; i++)
    XTEST(hr = VariantClear(&rgVariants[i]));

  return hr;
}

HRESULT GetProperty | ( | IUnknown * | pIUnknown,
 |  | DBPROPID | PropertyID,
 |  | GUID | guidPropertySet,
 |  | WCHAR ** | ppwszValue
 | ) |  |

Definition at line 103 of file property.cpp.

{
  ASSERT(pIUnknown && ppwszValue);
  HRESULT hr;

  DBPROP* pProperty = NULL;
  *ppwszValue = NULL;

  //Property might not be supported
  hr = GetProperty(pIUnknown, PropertyID, guidPropertySet, &pProperty);

  //Copy the value
  //GetProperty might return VT_EMPTY for no default string
  if(SUCCEEDED(hr) && pProperty && pProperty->vValue.vt == VT_BSTR)
    (*ppwszValue) = wcsDuplicate(V_BSTR(&pProperty->vValue));

  if(*ppwszValue == NULL)
  {
    SAFE_ALLOC(*ppwszValue, WCHAR, 1);
    (*ppwszValue)[0] = EOL;
  }

CLEANUP:
  FreeProperties(1, pProperty);
  return hr;
}

HRESULT GetProperty | ( | IUnknown * | pIUnknown,
 |  | DBPROPID | PropertyID,
 |  | GUID | guidPropertySet,
 |  | ULONG * | pcValue
 | ) |  |

Definition at line 158 of file property.cpp.

{
  ASSERT(pIUnknown && pcValue);
  HRESULT hr;

  DBPROP* pProperty = NULL;
  *pcValue = 0;

  //Might not be supported
  hr = GetProperty(pIUnknown, PropertyID, guidPropertySet, &pProperty);

  //Copy the value
  //GetProperty might return VT_EMPTY for no default string
  if(SUCCEEDED(hr) && pProperty && pProperty->vValue.vt == VT_I4)
    *pcValue = V_I4(&pProperty->vValue);

  FreeProperties(1, pProperty);
  return hr;
}

HRESULT GetProperty | ( | IUnknown * | pIUnknown,
 |  | DBPROPID | PropertyID,
 |  | GUID | guidPropertySet,
 |  | BOOL * | pbValue
 | ) |  |

Definition at line 182 of file property.cpp.

{
  ASSERT(pIUnknown && pbValue);
  HRESULT hr;

  DBPROP* pProperty = NULL;
  *pbValue = FALSE;

  //Might not be supported
  hr = GetProperty(pIUnknown, PropertyID, guidPropertySet, &pProperty);

  //Copy the value
  //GetProperty might return VT_EMPTY for no default string
  if(SUCCEEDED(hr) && pProperty && pProperty->vValue.vt == VT_BOOL)
    *pbValue = V_BOOL(&pProperty->vValue) == VARIANT_TRUE;

  FreeProperties(1, pProperty);
  return hr;
}

HRESULT GetProperty | ( | IUnknown * | pIUnknown,
 |  | DBPROPID | PropertyID,
 |  | GUID | guidPropertySet,
 |  | WCHAR * | pwszValue
 | ) |  |

Definition at line 134 of file property.cpp.

{
  ASSERT(pIUnknown && pwszValue);
  HRESULT hr;

  DBPROP* pProperty = NULL;
  *pwszValue = EOL;

  //Might not be supported
  hr = GetProperty(pIUnknown, PropertyID, guidPropertySet, &pProperty);

  //Copy the value
  //GetProperty might return VT_EMPTY for no default string
  if(SUCCEEDED(hr) && pProperty && pProperty->vValue.vt == VT_BSTR)
    wcscpy(pwszValue, V_BSTR(&pProperty->vValue));

  FreeProperties(1, pProperty);
  return hr;
}

HRESULT GetProperty | ( | IUnknown * | pIUnknown,
 |  | DBPROPID | PropertyID,
 |  | GUID | guidPropertySet,
 |  | DBPROP ** | ppProperty
 | ) |  |

Definition at line 28 of file property.cpp.

{
  ASSERT(pIUnknown && ppProperty);
  *ppProperty = NULL;

  HRESULT hr = S_OK;

  IDBProperties* pIDBProperties = NULL;
  ICommandProperties* pICommandProperties = NULL;
  IRowsetInfo* pIRowsetInfo = NULL;

  ULONG   cPropSets = 0;
  DBPROPSET*  rgPropSets = NULL;

  const ULONG   cPropertyIDSets = 1;
  DBPROPIDSET   rgPropertyIDSets[cPropertyIDSets];

  //SetUp input DBPROPIDSET struct (all static)
  rgPropertyIDSets[0].cPropertyIDs = cPropertyIDSets;
  rgPropertyIDSets[0].rgPropertyIDs = &PropertyID;
  rgPropertyIDSets[0].guidPropertySet = guidPropertySet;

  //Need to figure out which Interface was passed in
  //IDBInitialize, or ICommand, or IRowset, all three allow GetProperties
  if(SUCCEEDED(hr = pIUnknown->QueryInterface(IID_IDBProperties,(void **)&pIDBProperties)))
  {
    //GetProperties
    //Property might not be supported
    hr = pIDBProperties->GetProperties(cPropertyIDSets, rgPropertyIDSets, &cPropSets, &rgPropSets);
  }
  else if(SUCCEEDED(hr = pIUnknown->QueryInterface(IID_ICommandProperties,(void **)&pICommandProperties)))
  {
    //GetProperties
    //Property might not be supported
    hr = pICommandProperties->GetProperties(cPropertyIDSets, rgPropertyIDSets, &cPropSets, &rgPropSets);
  }
  else
  {
    XTESTC(hr = pIUnknown->QueryInterface(IID_IRowsetInfo, (void **)&pIRowsetInfo));

    //GetProperties
    //Property might not be supported
    hr = pIRowsetInfo->GetProperties(cPropertyIDSets, rgPropertyIDSets, &cPropSets, &rgPropSets);
  }

  //Check return result
  //Can be DB_S_ / DB_E_ERRORSOCCURRED if notsupported property...
  if(FAILED(hr) && hr != DB_E_ERRORSOCCURRED)
    XTESTC(hr);

  //Verify results
  CHECKC(cPropSets==1 && rgPropSets!=NULL);
  CHECKC(rgPropSets[0].cProperties==1 && rgPropSets[0].rgProperties!=NULL);
  CHECKC(rgPropSets[0].rgProperties[0].dwPropertyID == PropertyID);

  //Return the property to the user
  *ppProperty = rgPropSets[0].rgProperties;
  hr = S_OK;

CLEANUP:
  //Just Free the outer Struct,
  //since we return the inner Property for the user to free
  SAFE_FREE(rgPropSets);

  SAFE_RELEASE(pIDBProperties);
  SAFE_RELEASE(pICommandProperties);
  SAFE_RELEASE(pIRowsetInfo);
  return hr;
}

HRESULT GetPropInfo | ( | IUnknown * | pIUnknown,
 |  | DBPROPID | PropertyID,
 |  | GUID | guidPropertySet,
 |  | DBPROPINFO ** | ppPropInfo
 | ) |  |

Definition at line 207 of file property.cpp.

{
  ASSERT(pIUnknown && ppPropInfo);
  HRESULT hr;
  IDBProperties* pIDBProperties = NULL;

  const ULONG cPropIDSets = 1;
  DBPROPIDSET rgPropIDSets[cPropIDSets];

  ULONG cPropInfoSets = 0;
  DBPROPINFOSET* rgPropInfoSets = NULL;

  //Construct the DBPROPIDSET structure
  rgPropIDSets[0].cPropertyIDs = 1;
  rgPropIDSets[0].rgPropertyIDs = &PropertyID;
  rgPropIDSets[0].guidPropertySet = guidPropertySet;

  //Obtain IDBProperties
  XTESTC(hr = pIUnknown->QueryInterface(IID_IDBProperties,(void**)&pIDBProperties));

  //Don't display dialog if errors occurred.
  //Errors can occur if properties are not supported by the provider
  QTESTC(hr = pIDBProperties->GetPropertyInfo(cPropIDSets,rgPropIDSets,&cPropInfoSets,&rgPropInfoSets,NULL));

CLEANUP:
  *ppPropInfo = rgPropInfoSets ? rgPropInfoSets[0].rgPropertyInfos  : NULL;
  SAFE_FREE(rgPropInfoSets);
  SAFE_RELEASE(pIDBProperties);
  return hr;
}

DBPROPFLAGS GetPropInfoFlags | ( | IUnknown * | pIUnknown,
 |  | DBPROPID | PropertyID,
 |  | GUID | guidPropertySet
 | ) |  |

Definition at line 243 of file property.cpp.

{
  ASSERT(pIUnknown);
  DBPROPINFO* pPropInfo = NULL;
  DBPROPFLAGS dwFlags = DBPROPFLAGS_NOTSUPPORTED;

  //GetPropInfo
  QTESTC(GetPropInfo(pIUnknown, PropertyID, guidPropertySet, &pPropInfo))
  if(pPropInfo)
    dwFlags = pPropInfo->dwFlags;

CLEANUP:
  SAFE_FREE(pPropInfo);
  return dwFlags;
}

HRESULT InitVariants | ( | ULONG | cVariants,
 |  | VARIANT * | rgVariants
 | ) |  |

Definition at line 410 of file property.cpp.

{
  HRESULT hr = S_OK;

  //Free all variants
  for(ULONG i=0; i<cVariants; i++)
    VariantInit(&rgVariants[i]);

  return hr;
}

BOOL IsSettableProperty | ( | IUnknown * | pIUnknown,
 |  | DBPROPID | PropertyID,
 |  | GUID | guidPropertySet
 | ) |  |

Definition at line 274 of file property.cpp.

{
  return GetPropInfoFlags(pIUnknown, PropertyID, guidPropertySet) & DBPROPFLAGS_WRITE;
}

BOOL IsSupportedProperty | ( | IUnknown * | pIUnknown,
 |  | DBPROPID | PropertyID,
 |  | GUID | guidPropertySet
 | ) |  |

Definition at line 264 of file property.cpp.

{
  return GetPropInfoFlags(pIUnknown, PropertyID, guidPropertySet) != DBPROPFLAGS_NOTSUPPORTED;
}

HRESULT SetProperty | ( | DBPROPID | PropertyID,
 |  | GUID | guidPropertySet,
 |  | ULONG * | pcPropSets,
 |  | DBPROPSET ** | prgPropSets,
 |  | DBTYPE | wType,
 |  | void * | pv,
 |  | DBPROPOPTIONS | dwOptions,
 |  | DBID | colid
 | ) |  |

Definition at line 296 of file property.cpp.

{
  ASSERT(PropertyID && prgPropSets && pcPropSets && pv);
  HRESULT hr = S_OK;

  ULONG cProperties = 0;
  DBPROP* rgProperties = NULL;

  //Make our lives a little easier
  ULONG cPropSets = *pcPropSets;
  DBPROPSET* rgPropSets = *prgPropSets;

  ULONG iPropSet = ULONG_MAX;

  //Find the correct PropSet structure to add the property to
  for(ULONG i=0; i<cPropSets; i++)
    if(guidPropertySet == rgPropSets[i].guidPropertySet)
      iPropSet = i;

  //Do we need to create another PropSets structure for this property
  if(iPropSet==ULONG_MAX)
  {
    iPropSet = cPropSets;
    SAFE_REALLOC(rgPropSets, DBPROPSET, cPropSets+1);
    rgPropSets[iPropSet].cProperties = 0;
    rgPropSets[iPropSet].rgProperties = NULL;
    rgPropSets[iPropSet].guidPropertySet = guidPropertySet;
    cPropSets++;
  }

  //Now make our lives really easy
  cProperties = rgPropSets[iPropSet].cProperties;
  rgProperties = rgPropSets[iPropSet].rgProperties;

  //do we need to enlarge the list
  SAFE_REALLOC(rgProperties, DBPROP, cProperties+1);

  //Add the new property to the list
  rgProperties[cProperties].dwPropertyID = PropertyID;
  rgProperties[cProperties].dwOptions    = dwOptions;
  rgProperties[cProperties].dwStatus     = DBPROPSTATUS_OK;
  rgProperties[cProperties].colid        = colid;
  VariantInit(&rgProperties[cProperties].vValue);

  switch(wType)
  {
    case DBTYPE_BOOL:
      rgProperties[cProperties].vValue.vt          = VT_BOOL;
      V_BOOL(&(rgProperties[cProperties].vValue))  = *(VARIANT_BOOL*)pv;
      break;

    case DBTYPE_I2:
      rgProperties[cProperties].vValue.vt     = VT_I2;
      V_I2(&(rgProperties[cProperties].vValue)) = *(SHORT*)pv;
      break;

    case DBTYPE_I4:
      rgProperties[cProperties].vValue.vt     = VT_I4;
      V_I4(&(rgProperties[cProperties].vValue)) = *(LONG*)pv;
      break;

    case DBTYPE_WSTR:
    case DBTYPE_BSTR:
      rgProperties[cProperties].vValue.vt          = VT_BSTR;
      V_BSTR(&(rgProperties[cProperties].vValue))  = SysAllocString((BSTR)pv);
      break;

    case DBTYPE_VARIANT:
      VariantCopy(&rgProperties[cProperties].vValue, (VARIANT*)pv);
      break;

    default:
      ASSERT(FALSE); //Unhandled property type
      break;
  }

  //Increment the number of properties
  cProperties++;

CLEANUP:
  //Now go back to the rediculous property structures
  rgPropSets[iPropSet].cProperties  = cProperties;
  rgPropSets[iPropSet].rgProperties = rgProperties;
  *pcPropSets = cPropSets;
  *prgPropSets = rgPropSets;
  return hr;
}

HRESULT SetProperty | ( | DBPROPID | PropertyID,
 |  | GUID | guidPropertySet,
 |  | ULONG * | pcPropSets,
 |  | DBPROPSET ** | prgPropSets,
 |  | DBTYPE | wType,
 |  | ULONG | ulValue,
 |  | DBPROPOPTIONS | dwOptions,
 |  | DBID | colid
 | ) |  |

Definition at line 284 of file property.cpp.

{
  if(wType == DBTYPE_BOOL)
    ulValue = ulValue ? VARIANT_TRUE : VARIANT_FALSE;
  return SetProperty(PropertyID, guidPropertySet, pcPropSets, prgPropSets, wType, &ulValue, dwOptions, colid);
}

HRESULT SetRestriction | ( | VARIANT * | pRestriction,
 |  | WCHAR * | pwszValue
 | ) |  |

Definition at line 389 of file property.cpp.

{
  ASSERT(pRestriction);
  ASSERT(pwszValue);

  //VT_BSTR case
  if(pwszValue && pwszValue[0])
  {
    pRestriction->vt = VT_BSTR;
    SAFE_SYSALLOC(V_BSTR(pRestriction), pwszValue);
  }

CLEANUP:
  return S_OK;
}

Generated on Wed Nov 13 2024 16:53:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/tablecopy/property.h File Reference

  • Dataaccess
  • oledb
  • tablecopy
Functions

property.h File Reference

#include "common.h"

Go to the source code of this file.

Functions

HRESULT | FreeProperties (ULONG cPropSets, DBPROPSET *rgPropSets)
HRESULT | FreeProperties (ULONG cProperties, DBPROP *rgProperties)
HRESULT | FreeVariants (ULONG cVariants, VARIANT *rgVariants)
HRESULT | GetProperty (IUnknown *pIUnknown, DBPROPID PropertyID, GUID guidPropertySet, ULONG *pcValue)
HRESULT | GetProperty (IUnknown *pIUnknown, DBPROPID PropertyID, GUID guidPropertySet, BOOL *pbValue)
HRESULT | GetProperty (IUnknown *pIUnknown, DBPROPID PropertyID, GUID guidPropertySet, WCHAR **ppwszValue)
HRESULT | GetProperty (IUnknown *pIUnknown, DBPROPID PropertyID, GUID guidPropertySet, DBPROP **ppProperty)
HRESULT | GetProperty (IUnknown *pIUnknown, DBPROPID PropertyID, GUID guidPropertySet, WCHAR *pwszValue)
HRESULT | GetPropInfo (IUnknown *pIUnknown, DBPROPID PropertyID, GUID guidPropertySet, DBPROPINFO **ppPropInfo)
DBPROPFLAGS | GetPropInfoFlags (IUnknown *pIUnknown, DBPROPID PropertyID, GUID guidPropertySet)
HRESULT | InitVariants (ULONG cVariants, VARIANT *rgVariants)
BOOL | IsSettableProperty (IUnknown *pIUnknown, DBPROPID PropertyID, GUID guidPropertySet)
BOOL | IsSupportedProperty (IUnknown *pIUnknown, DBPROPID PropertyID, GUID guidPropertySet)
HRESULT | SetProperty (DBPROPID PropertyID, GUID guidPropertySet, ULONG *pcPropSets, DBPROPSET **prgPropSets, DBTYPE wType, void *pv, DBPROPOPTIONS dwOptions=DBPROPOPTIONS_REQUIRED, DBID colid=DB_NULLID)
HRESULT | SetProperty (DBPROPID PropertyID, GUID guidPropertySet, ULONG *pcPropSets, DBPROPSET **prgPropSets, DBTYPE wType, ULONG ulValue, DBPROPOPTIONS dwOptions=DBPROPOPTIONS_REQUIRED, DBID colid=DB_NULLID)
HRESULT | SetRestriction (VARIANT *pRestriction, WCHAR *pwszValue)

Function Documentation

HRESULT FreeProperties | ( | ULONG | cPropSets,
 |  | DBPROPSET * | rgPropSets
 | ) |  |

Definition at line 467 of file property.cpp.

{
  HRESULT hr = S_OK;

  //Loop over all the property sets
  for(ULONG i=0; i<cPropSets; i++)
    FreeProperties(rgPropSets[i].cProperties, rgPropSets[i].rgProperties);

  //Now free the outer set
  SAFE_FREE(rgPropSets);
  return hr;
}

HRESULT FreeProperties | ( | ULONG | cProperties,
 |  | DBPROP * | rgProperties
 | ) |  |

Definition at line 442 of file property.cpp.

{
  HRESULT hr = S_OK;

  //no-op case
  if(cProperties==0 || rgProperties==NULL)
    return S_OK;

  //Free the inner variants first
  for(ULONG i=0; i<cProperties; i++)
  {
    //if DBPROPSTATUS_NOTSUPPORTED then vValue is undefined
    if(rgProperties[i].dwStatus != DBPROPSTATUS_NOTSUPPORTED)
      XTEST(hr = VariantClear(&rgProperties[i].vValue));
  }

  //Now free the set
  SAFE_FREE(rgProperties);
  return hr;
}

HRESULT FreeVariants | ( | ULONG | cVariants,
 |  | VARIANT * | rgVariants
 | ) |  |

Definition at line 426 of file property.cpp.

{
  HRESULT hr = S_OK;

  //Free the inner variants first
  for(ULONG i=0; i<cVariants; i++)
    XTEST(hr = VariantClear(&rgVariants[i]));

  return hr;
}

HRESULT GetProperty | ( | IUnknown * | pIUnknown,
 |  | DBPROPID | PropertyID,
 |  | GUID | guidPropertySet,
 |  | ULONG * | pcValue
 | ) |  |

Definition at line 158 of file property.cpp.

{
  ASSERT(pIUnknown && pcValue);
  HRESULT hr;

  DBPROP* pProperty = NULL;
  *pcValue = 0;

  //Might not be supported
  hr = GetProperty(pIUnknown, PropertyID, guidPropertySet, &pProperty);

  //Copy the value
  //GetProperty might return VT_EMPTY for no default string
  if(SUCCEEDED(hr) && pProperty && pProperty->vValue.vt == VT_I4)
    *pcValue = V_I4(&pProperty->vValue);

  FreeProperties(1, pProperty);
  return hr;
}

HRESULT GetProperty | ( | IUnknown * | pIUnknown,
 |  | DBPROPID | PropertyID,
 |  | GUID | guidPropertySet,
 |  | BOOL * | pbValue
 | ) |  |

Definition at line 182 of file property.cpp.

{
  ASSERT(pIUnknown && pbValue);
  HRESULT hr;

  DBPROP* pProperty = NULL;
  *pbValue = FALSE;

  //Might not be supported
  hr = GetProperty(pIUnknown, PropertyID, guidPropertySet, &pProperty);

  //Copy the value
  //GetProperty might return VT_EMPTY for no default string
  if(SUCCEEDED(hr) && pProperty && pProperty->vValue.vt == VT_BOOL)
    *pbValue = V_BOOL(&pProperty->vValue) == VARIANT_TRUE;

  FreeProperties(1, pProperty);
  return hr;
}

HRESULT GetProperty | ( | IUnknown * | pIUnknown,
 |  | DBPROPID | PropertyID,
 |  | GUID | guidPropertySet,
 |  | WCHAR ** | ppwszValue
 | ) |  |

Definition at line 103 of file property.cpp.

{
  ASSERT(pIUnknown && ppwszValue);
  HRESULT hr;

  DBPROP* pProperty = NULL;
  *ppwszValue = NULL;

  //Property might not be supported
  hr = GetProperty(pIUnknown, PropertyID, guidPropertySet, &pProperty);

  //Copy the value
  //GetProperty might return VT_EMPTY for no default string
  if(SUCCEEDED(hr) && pProperty && pProperty->vValue.vt == VT_BSTR)
    (*ppwszValue) = wcsDuplicate(V_BSTR(&pProperty->vValue));

  if(*ppwszValue == NULL)
  {
    SAFE_ALLOC(*ppwszValue, WCHAR, 1);
    (*ppwszValue)[0] = EOL;
  }

CLEANUP:
  FreeProperties(1, pProperty);
  return hr;
}

HRESULT GetProperty | ( | IUnknown * | pIUnknown,
 |  | DBPROPID | PropertyID,
 |  | GUID | guidPropertySet,
 |  | DBPROP ** | ppProperty
 | ) |  |

Definition at line 28 of file property.cpp.

{
  ASSERT(pIUnknown && ppProperty);
  *ppProperty = NULL;

  HRESULT hr = S_OK;

  IDBProperties* pIDBProperties = NULL;
  ICommandProperties* pICommandProperties = NULL;
  IRowsetInfo* pIRowsetInfo = NULL;

  ULONG   cPropSets = 0;
  DBPROPSET*  rgPropSets = NULL;

  const ULONG   cPropertyIDSets = 1;
  DBPROPIDSET   rgPropertyIDSets[cPropertyIDSets];

  //SetUp input DBPROPIDSET struct (all static)
  rgPropertyIDSets[0].cPropertyIDs = cPropertyIDSets;
  rgPropertyIDSets[0].rgPropertyIDs = &PropertyID;
  rgPropertyIDSets[0].guidPropertySet = guidPropertySet;

  //Need to figure out which Interface was passed in
  //IDBInitialize, or ICommand, or IRowset, all three allow GetProperties
  if(SUCCEEDED(hr = pIUnknown->QueryInterface(IID_IDBProperties,(void **)&pIDBProperties)))
  {
    //GetProperties
    //Property might not be supported
    hr = pIDBProperties->GetProperties(cPropertyIDSets, rgPropertyIDSets, &cPropSets, &rgPropSets);
  }
  else if(SUCCEEDED(hr = pIUnknown->QueryInterface(IID_ICommandProperties,(void **)&pICommandProperties)))
  {
    //GetProperties
    //Property might not be supported
    hr = pICommandProperties->GetProperties(cPropertyIDSets, rgPropertyIDSets, &cPropSets, &rgPropSets);
  }
  else
  {
    XTESTC(hr = pIUnknown->QueryInterface(IID_IRowsetInfo, (void **)&pIRowsetInfo));

    //GetProperties
    //Property might not be supported
    hr = pIRowsetInfo->GetProperties(cPropertyIDSets, rgPropertyIDSets, &cPropSets, &rgPropSets);
  }

  //Check return result
  //Can be DB_S_ / DB_E_ERRORSOCCURRED if notsupported property...
  if(FAILED(hr) && hr != DB_E_ERRORSOCCURRED)
    XTESTC(hr);

  //Verify results
  CHECKC(cPropSets==1 && rgPropSets!=NULL);
  CHECKC(rgPropSets[0].cProperties==1 && rgPropSets[0].rgProperties!=NULL);
  CHECKC(rgPropSets[0].rgProperties[0].dwPropertyID == PropertyID);

  //Return the property to the user
  *ppProperty = rgPropSets[0].rgProperties;
  hr = S_OK;

CLEANUP:
  //Just Free the outer Struct,
  //since we return the inner Property for the user to free
  SAFE_FREE(rgPropSets);

  SAFE_RELEASE(pIDBProperties);
  SAFE_RELEASE(pICommandProperties);
  SAFE_RELEASE(pIRowsetInfo);
  return hr;
}

HRESULT GetProperty | ( | IUnknown * | pIUnknown,
 |  | DBPROPID | PropertyID,
 |  | GUID | guidPropertySet,
 |  | WCHAR * | pwszValue
 | ) |  |

Definition at line 134 of file property.cpp.

{
  ASSERT(pIUnknown && pwszValue);
  HRESULT hr;

  DBPROP* pProperty = NULL;
  *pwszValue = EOL;

  //Might not be supported
  hr = GetProperty(pIUnknown, PropertyID, guidPropertySet, &pProperty);

  //Copy the value
  //GetProperty might return VT_EMPTY for no default string
  if(SUCCEEDED(hr) && pProperty && pProperty->vValue.vt == VT_BSTR)
    wcscpy(pwszValue, V_BSTR(&pProperty->vValue));

  FreeProperties(1, pProperty);
  return hr;
}

HRESULT GetPropInfo | ( | IUnknown * | pIUnknown,
 |  | DBPROPID | PropertyID,
 |  | GUID | guidPropertySet,
 |  | DBPROPINFO ** | ppPropInfo
 | ) |  |

Definition at line 207 of file property.cpp.

{
  ASSERT(pIUnknown && ppPropInfo);
  HRESULT hr;
  IDBProperties* pIDBProperties = NULL;

  const ULONG cPropIDSets = 1;
  DBPROPIDSET rgPropIDSets[cPropIDSets];

  ULONG cPropInfoSets = 0;
  DBPROPINFOSET* rgPropInfoSets = NULL;

  //Construct the DBPROPIDSET structure
  rgPropIDSets[0].cPropertyIDs = 1;
  rgPropIDSets[0].rgPropertyIDs = &PropertyID;
  rgPropIDSets[0].guidPropertySet = guidPropertySet;

  //Obtain IDBProperties
  XTESTC(hr = pIUnknown->QueryInterface(IID_IDBProperties,(void**)&pIDBProperties));

  //Don't display dialog if errors occurred.
  //Errors can occur if properties are not supported by the provider
  QTESTC(hr = pIDBProperties->GetPropertyInfo(cPropIDSets,rgPropIDSets,&cPropInfoSets,&rgPropInfoSets,NULL));

CLEANUP:
  *ppPropInfo = rgPropInfoSets ? rgPropInfoSets[0].rgPropertyInfos  : NULL;
  SAFE_FREE(rgPropInfoSets);
  SAFE_RELEASE(pIDBProperties);
  return hr;
}

DBPROPFLAGS GetPropInfoFlags | ( | IUnknown * | pIUnknown,
 |  | DBPROPID | PropertyID,
 |  | GUID | guidPropertySet
 | ) |  |

Definition at line 243 of file property.cpp.

{
  ASSERT(pIUnknown);
  DBPROPINFO* pPropInfo = NULL;
  DBPROPFLAGS dwFlags = DBPROPFLAGS_NOTSUPPORTED;

  //GetPropInfo
  QTESTC(GetPropInfo(pIUnknown, PropertyID, guidPropertySet, &pPropInfo))
  if(pPropInfo)
    dwFlags = pPropInfo->dwFlags;

CLEANUP:
  SAFE_FREE(pPropInfo);
  return dwFlags;
}

HRESULT InitVariants | ( | ULONG | cVariants,
 |  | VARIANT * | rgVariants
 | ) |  |

Definition at line 410 of file property.cpp.

{
  HRESULT hr = S_OK;

  //Free all variants
  for(ULONG i=0; i<cVariants; i++)
    VariantInit(&rgVariants[i]);

  return hr;
}

BOOL IsSettableProperty | ( | IUnknown * | pIUnknown,
 |  | DBPROPID | PropertyID,
 |  | GUID | guidPropertySet
 | ) |  |

Definition at line 274 of file property.cpp.

{
  return GetPropInfoFlags(pIUnknown, PropertyID, guidPropertySet) & DBPROPFLAGS_WRITE;
}

BOOL IsSupportedProperty | ( | IUnknown * | pIUnknown,
 |  | DBPROPID | PropertyID,
 |  | GUID | guidPropertySet
 | ) |  |

Definition at line 264 of file property.cpp.

{
  return GetPropInfoFlags(pIUnknown, PropertyID, guidPropertySet) != DBPROPFLAGS_NOTSUPPORTED;
}

HRESULT SetProperty | ( | DBPROPID | PropertyID,
 |  | GUID | guidPropertySet,
 |  | ULONG * | pcPropSets,
 |  | DBPROPSET ** | prgPropSets,
 |  | DBTYPE | wType,
 |  | void * | pv,
 |  | DBPROPOPTIONS | dwOptions = DBPROPOPTIONS_REQUIRED,
 |  | DBID | colid = DB_NULLID
 | ) |  |

Definition at line 296 of file property.cpp.

{
  ASSERT(PropertyID && prgPropSets && pcPropSets && pv);
  HRESULT hr = S_OK;

  ULONG cProperties = 0;
  DBPROP* rgProperties = NULL;

  //Make our lives a little easier
  ULONG cPropSets = *pcPropSets;
  DBPROPSET* rgPropSets = *prgPropSets;

  ULONG iPropSet = ULONG_MAX;

  //Find the correct PropSet structure to add the property to
  for(ULONG i=0; i<cPropSets; i++)
    if(guidPropertySet == rgPropSets[i].guidPropertySet)
      iPropSet = i;

  //Do we need to create another PropSets structure for this property
  if(iPropSet==ULONG_MAX)
  {
    iPropSet = cPropSets;
    SAFE_REALLOC(rgPropSets, DBPROPSET, cPropSets+1);
    rgPropSets[iPropSet].cProperties = 0;
    rgPropSets[iPropSet].rgProperties = NULL;
    rgPropSets[iPropSet].guidPropertySet = guidPropertySet;
    cPropSets++;
  }

  //Now make our lives really easy
  cProperties = rgPropSets[iPropSet].cProperties;
  rgProperties = rgPropSets[iPropSet].rgProperties;

  //do we need to enlarge the list
  SAFE_REALLOC(rgProperties, DBPROP, cProperties+1);

  //Add the new property to the list
  rgProperties[cProperties].dwPropertyID = PropertyID;
  rgProperties[cProperties].dwOptions    = dwOptions;
  rgProperties[cProperties].dwStatus     = DBPROPSTATUS_OK;
  rgProperties[cProperties].colid        = colid;
  VariantInit(&rgProperties[cProperties].vValue);

  switch(wType)
  {
    case DBTYPE_BOOL:
      rgProperties[cProperties].vValue.vt          = VT_BOOL;
      V_BOOL(&(rgProperties[cProperties].vValue))  = *(VARIANT_BOOL*)pv;
      break;

    case DBTYPE_I2:
      rgProperties[cProperties].vValue.vt     = VT_I2;
      V_I2(&(rgProperties[cProperties].vValue)) = *(SHORT*)pv;
      break;

    case DBTYPE_I4:
      rgProperties[cProperties].vValue.vt     = VT_I4;
      V_I4(&(rgProperties[cProperties].vValue)) = *(LONG*)pv;
      break;

    case DBTYPE_WSTR:
    case DBTYPE_BSTR:
      rgProperties[cProperties].vValue.vt          = VT_BSTR;
      V_BSTR(&(rgProperties[cProperties].vValue))  = SysAllocString((BSTR)pv);
      break;

    case DBTYPE_VARIANT:
      VariantCopy(&rgProperties[cProperties].vValue, (VARIANT*)pv);
      break;

    default:
      ASSERT(FALSE); //Unhandled property type
      break;
  }

  //Increment the number of properties
  cProperties++;

CLEANUP:
  //Now go back to the rediculous property structures
  rgPropSets[iPropSet].cProperties  = cProperties;
  rgPropSets[iPropSet].rgProperties = rgProperties;
  *pcPropSets = cPropSets;
  *prgPropSets = rgPropSets;
  return hr;
}

HRESULT SetProperty | ( | DBPROPID | PropertyID,
 |  | GUID | guidPropertySet,
 |  | ULONG * | pcPropSets,
 |  | DBPROPSET ** | prgPropSets,
 |  | DBTYPE | wType,
 |  | ULONG | ulValue,
 |  | DBPROPOPTIONS | dwOptions = DBPROPOPTIONS_REQUIRED,
 |  | DBID | colid = DB_NULLID
 | ) |  |

Definition at line 284 of file property.cpp.

{
  if(wType == DBTYPE_BOOL)
    ulValue = ulValue ? VARIANT_TRUE : VARIANT_FALSE;
  return SetProperty(PropertyID, guidPropertySet, pcPropSets, prgPropSets, wType, &ulValue, dwOptions, colid);
}

HRESULT SetRestriction | ( | VARIANT * | pRestriction,
 |  | WCHAR * | pwszValue
 | ) |  |

Definition at line 389 of file property.cpp.

{
  ASSERT(pRestriction);
  ASSERT(pwszValue);

  //VT_BSTR case
  if(pwszValue && pwszValue[0])
  {
    pRestriction->vt = VT_BSTR;
    SAFE_SYSALLOC(V_BSTR(pRestriction), pwszValue);
  }

CLEANUP:
  return S_OK;
}

Generated on Wed Nov 13 2024 16:53:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/tablecopy/resource.h File Reference

  • Dataaccess
  • oledb
  • tablecopy
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | ID_TBLCPY_MENU 102
#define | IDB_FINISH 1013
#define | IDB_FROM_CONNECT 1000
#define | IDB_PREV 1004
#define | IDB_SELECTALL 4
#define | IDB_TO_CONNECT 1025
#define | IDB_UNSELECTALL 3
#define | IDC_PROVIDER_NAME 1082
#define | IDC_STATIC -1
#define | IDD_DATA_TYPES 107
#define | IDD_DIALOG1 109
#define | IDD_DIALOG2 110
#define | IDD_FROM_INFO 101
#define | IDD_INDEX_INFO 105
#define | IDD_OPTIONS 103
#define | IDD_PROGRESS 108
#define | IDD_SHOW_TYPES 106
#define | IDD_TO_INFO 125
#define | IDE_BLOB_SIZE 1018
#define | IDE_FROM_TABLE 1096
#define | IDE_PARAM_SETS 1019
#define | IDE_ROW_COUNT 1017
#define | IDE_TO_TABLE 1012
#define | IDI_CATALOG 161
#define | IDI_COLUMN 140
#define | IDI_COLUMNLONG 145
#define | IDI_COLUMNREAD 144
#define | IDI_FOLDER 127
#define | IDI_INDEX 141
#define | IDI_OPENFOLDER 150
#define | IDI_PRIMARYKEY 142
#define | IDI_SCHEMA 156
#define | IDI_SELTABLE 154
#define | IDI_SYNONYM 173
#define | IDI_SYSTABLE 174
#define | IDI_TABLE 166
#define | IDI_TABLE_COPY 105
#define | IDI_TABLES 153
#define | IDI_TABLESYN 137
#define | IDI_TABLESYS 136
#define | IDI_TABLEVIEW 134
#define | IDI_TYPE 169
#define | IDI_VIEW 170
#define | IDL_COLUMNS 1009
#define | IDL_FROM_TYPES 1028
#define | IDL_INDEXES 1023
#define | IDL_TABLES 1008
#define | IDL_TO_TYPES 1030
#define | IDM_FILE_COPYTABLE 40001
#define | IDM_FILE_EXIT 40002
#define | IDM_HELP_ABOUT 40003
#define | IDM_HELP_HELP 40004
#define | IDR_ALL_ROWS 1035
#define | IDR_BLOB_SIZE 1037
#define | IDR_INSERTROW_BUFFERED 1041
#define | IDR_INSERTROW_IMMEDIATE 1040
#define | IDR_ISEQ_STREAM 1038
#define | IDR_PARAM_SETS 1039
#define | IDR_ROW_COUNT 1036
#define | IDS_FROM_DSN 1037
#define | IDSELECTALL 4
#define | IDT_COLUMN_LIST 1021
#define | IDT_CONNECT 1010
#define | IDT_CONNECTSTATUS 1101
#define | IDT_FROM_CONNECT 1013
#define | IDT_FROM_INFO 1011
#define | IDT_FROM_PROVIDER 1106
#define | IDT_FROMTABLEHELP 1111
#define | IDT_INDEXES 1022
#define | IDT_INDEXMSG 1097
#define | IDT_MAX_ROWS 1018
#define | IDT_OPTIONMSG 1110
#define | IDT_SHOW_GROUP 1019
#define | IDT_SOURCE 1107
#define | IDT_STAT_INFO 1033
#define | IDT_STATUS 1031
#define | IDT_TABLE_LIST 1020
#define | IDT_TARGET 1108
#define | IDT_TO_CONNECT 1104
#define | IDT_TO_PROVIDER 1105
#define | IDT_TO_TITLE 1024
#define | IDT_TOTABLEHELP 1011
#define | IDUNSELECTALL 3
#define | IDX_COPY_DATA 1015
#define | IDX_COPY_INDEXES 1016
#define | IDX_COPY_PRIMARYKEYS 1020
#define | IDX_COPY_SCHEMA 1014
#define | IDX_COPY_TABLE 1014
#define | IDX_SHOW_SQL 1034

Define Documentation

#define ID_TBLCPY_MENU 102

Definition at line 10 of file resource.h.

#define IDB_FINISH 1013

Definition at line 47 of file resource.h.

#define IDB_FROM_CONNECT 1000

Definition at line 39 of file resource.h.

#define IDB_PREV 1004

Definition at line 40 of file resource.h.

#define IDB_SELECTALL 4

Definition at line 8 of file resource.h.

#define IDB_TO_CONNECT 1025

Definition at line 64 of file resource.h.

#define IDB_UNSELECTALL 3

Definition at line 6 of file resource.h.

#define IDC_PROVIDER_NAME 1082

Definition at line 78 of file resource.h.

#define IDC_STATIC -1

Definition at line 93 of file resource.h.

#define IDD_DATA_TYPES 107

Definition at line 15 of file resource.h.

#define IDD_DIALOG1 109

Definition at line 17 of file resource.h.

#define IDD_DIALOG2 110

Definition at line 18 of file resource.h.

#define IDD_FROM_INFO 101

Definition at line 9 of file resource.h.

#define IDD_INDEX_INFO 105

Definition at line 12 of file resource.h.

#define IDD_OPTIONS 103

Definition at line 11 of file resource.h.

#define IDD_PROGRESS 108

Definition at line 16 of file resource.h.

#define IDD_SHOW_TYPES 106

Definition at line 14 of file resource.h.

#define IDD_TO_INFO 125

Definition at line 19 of file resource.h.

#define IDE_BLOB_SIZE 1018

Definition at line 55 of file resource.h.

#define IDE_FROM_TABLE 1096

Definition at line 79 of file resource.h.

#define IDE_PARAM_SETS 1019

Definition at line 57 of file resource.h.

#define IDE_ROW_COUNT 1017

Definition at line 53 of file resource.h.

#define IDE_TO_TABLE 1012

Definition at line 46 of file resource.h.

#define IDI_CATALOG 161

Definition at line 33 of file resource.h.

#define IDI_COLUMN 140

Definition at line 24 of file resource.h.

#define IDI_COLUMNLONG 145

Definition at line 28 of file resource.h.

#define IDI_COLUMNREAD 144

Definition at line 27 of file resource.h.

#define IDI_FOLDER 127

Definition at line 20 of file resource.h.

#define IDI_INDEX 141

Definition at line 25 of file resource.h.

#define IDI_OPENFOLDER 150

Definition at line 29 of file resource.h.

#define IDI_PRIMARYKEY 142

Definition at line 26 of file resource.h.

#define IDI_SCHEMA 156

Definition at line 32 of file resource.h.

#define IDI_SELTABLE 154

Definition at line 31 of file resource.h.

#define IDI_SYNONYM 173

Definition at line 37 of file resource.h.

#define IDI_SYSTABLE 174

Definition at line 38 of file resource.h.

#define IDI_TABLE 166

Definition at line 34 of file resource.h.

#define IDI_TABLE_COPY 105

Definition at line 13 of file resource.h.

#define IDI_TABLES 153

Definition at line 30 of file resource.h.

#define IDI_TABLESYN 137

Definition at line 23 of file resource.h.

#define IDI_TABLESYS 136

Definition at line 22 of file resource.h.

#define IDI_TABLEVIEW 134

Definition at line 21 of file resource.h.

#define IDI_TYPE 169

Definition at line 35 of file resource.h.

#define IDI_VIEW 170

Definition at line 36 of file resource.h.

#define IDL_COLUMNS 1009

Definition at line 42 of file resource.h.

#define IDL_FROM_TYPES 1028

Definition at line 65 of file resource.h.

#define IDL_INDEXES 1023

Definition at line 62 of file resource.h.

#define IDL_TABLES 1008

Definition at line 41 of file resource.h.

#define IDL_TO_TYPES 1030

Definition at line 66 of file resource.h.

#define IDM_FILE_COPYTABLE 40001

Definition at line 89 of file resource.h.

#define IDM_FILE_EXIT 40002

Definition at line 90 of file resource.h.

#define IDM_HELP_ABOUT 40003

Definition at line 91 of file resource.h.

#define IDM_HELP_HELP 40004

Definition at line 92 of file resource.h.

#define IDR_ALL_ROWS 1035

Definition at line 70 of file resource.h.

#define IDR_BLOB_SIZE 1037

Definition at line 73 of file resource.h.

#define IDR_INSERTROW_BUFFERED 1041

Definition at line 77 of file resource.h.

#define IDR_INSERTROW_IMMEDIATE 1040

Definition at line 76 of file resource.h.

#define IDR_ISEQ_STREAM 1038

Definition at line 74 of file resource.h.

#define IDR_PARAM_SETS 1039

Definition at line 75 of file resource.h.

#define IDR_ROW_COUNT 1036

Definition at line 71 of file resource.h.

#define IDS_FROM_DSN 1037

Definition at line 72 of file resource.h.

#define IDSELECTALL 4

Definition at line 7 of file resource.h.

#define IDT_COLUMN_LIST 1021

Definition at line 60 of file resource.h.

#define IDT_CONNECT 1010

Definition at line 43 of file resource.h.

#define IDT_CONNECTSTATUS 1101

Definition at line 81 of file resource.h.

#define IDT_FROM_CONNECT 1013

Definition at line 48 of file resource.h.

#define IDT_FROM_INFO 1011

Definition at line 44 of file resource.h.

#define IDT_FROM_PROVIDER 1106

Definition at line 84 of file resource.h.

#define IDT_FROMTABLEHELP 1111

Definition at line 88 of file resource.h.

#define IDT_INDEXES 1022

Definition at line 61 of file resource.h.

#define IDT_INDEXMSG 1097

Definition at line 80 of file resource.h.

#define IDT_MAX_ROWS 1018

Definition at line 54 of file resource.h.

#define IDT_OPTIONMSG 1110

Definition at line 87 of file resource.h.

#define IDT_SHOW_GROUP 1019

Definition at line 56 of file resource.h.

#define IDT_SOURCE 1107

Definition at line 85 of file resource.h.

#define IDT_STAT_INFO 1033

Definition at line 68 of file resource.h.

#define IDT_STATUS 1031

Definition at line 67 of file resource.h.

#define IDT_TABLE_LIST 1020

Definition at line 58 of file resource.h.

#define IDT_TARGET 1108

Definition at line 86 of file resource.h.

#define IDT_TO_CONNECT 1104

Definition at line 82 of file resource.h.

#define IDT_TO_PROVIDER 1105

Definition at line 83 of file resource.h.

#define IDT_TO_TITLE 1024

Definition at line 63 of file resource.h.

#define IDT_TOTABLEHELP 1011

Definition at line 45 of file resource.h.

#define IDUNSELECTALL 3

Definition at line 5 of file resource.h.

#define IDX_COPY_DATA 1015

Definition at line 51 of file resource.h.

#define IDX_COPY_INDEXES 1016

Definition at line 52 of file resource.h.

#define IDX_COPY_PRIMARYKEYS 1020

Definition at line 59 of file resource.h.

#define IDX_COPY_SCHEMA 1014

Definition at line 49 of file resource.h.

#define IDX_COPY_TABLE 1014

Definition at line 50 of file resource.h.

#define IDX_SHOW_SQL 1034

Definition at line 69 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/tablecopy/spy.cpp File Reference

  • Dataaccess
  • oledb
  • tablecopy
Defines | Functions | Variables

spy.cpp File Reference

#include "common.h"
#include "spy.h"

Go to the source code of this file.

Defines

#define | BUFFER_ID(pActual) (*(ULONG*)ID_OFFSET(pActual))
#define | BUFFER_LENGTH(pActual) (*(ULONG*)LENGTH_OFFSET(pActual))
#define | HEAD_OFFSET(pActual) ((BYTE*)pActual)
#define | HEAD_SIGNITURE(pActual) (*(ULONG*)HEAD_OFFSET(pActual))
#define | HEADER_OFFSET(pRequest) ((BYTE*)(pRequest) - HEADERSIZE)
#define | ID_OFFSET(pActual) (LENGTH_OFFSET(pActual) + LENGTHSIZE)
#define | LENGTH_OFFSET(pActual) (HEAD_OFFSET(pActual) + HEADSIZE)
#define | TAIL_OFFSET(pActual) (USERS_OFFSET(pActual)+BUFFER_LENGTH(pActual))
#define | TAIL_SIGNITURE(pActual) (*(BYTE*)TAIL_OFFSET(pActual))
#define | USERS_OFFSET(pActual) (HEAD_OFFSET(pActual) + HEADERSIZE)

Functions

HRESULT | MallocSpyDump (CMallocSpy *pCMallocSpy)
HRESULT | MallocSpyRegister (CMallocSpy **ppCMallocSpy)
HRESULT | MallocSpyUnRegister (CMallocSpy *pCMallocSpy)

Variables

const BYTE | ALLOCSIGN = '$'
const ULONG | FOOTERSIZE = TAILSIZE
const BYTE | FREESIGN = 'Z'
const ULONG | HEADERSIZE = ROUNDUP(HEADSIZE + LENGTHSIZE + IDSIZE)
const BYTE | HEADSIGN = '{'
const ULONG | HEADSIZE = sizeof(ULONG)
const ULONG | IDSIZE = sizeof(ULONG)
const ULONG | LENGTHSIZE = sizeof(ULONG)
const BYTE | TAILSIGN = '}'
const ULONG | TAILSIZE = sizeof(BYTE)

Define Documentation

#define BUFFER_ID ( pActual ) (*(ULONG*)ID_OFFSET(pActual))

Definition at line 58 of file spy.cpp.

#define BUFFER_LENGTH ( pActual ) (*(ULONG*)LENGTH_OFFSET(pActual))

Definition at line 55 of file spy.cpp.

#define HEAD_OFFSET ( pActual ) ((BYTE*)pActual)

Definition at line 48 of file spy.cpp.

#define HEAD_SIGNITURE ( pActual ) (*(ULONG*)HEAD_OFFSET(pActual))

Definition at line 60 of file spy.cpp.

#define HEADER_OFFSET ( pRequest ) ((BYTE*)(pRequest) - HEADERSIZE)

Definition at line 52 of file spy.cpp.

#define ID_OFFSET ( pActual ) (LENGTH_OFFSET(pActual) + LENGTHSIZE)

Definition at line 57 of file spy.cpp.

#define LENGTH_OFFSET ( pActual ) (HEAD_OFFSET(pActual) + HEADSIZE)

Definition at line 54 of file spy.cpp.

#define TAIL_OFFSET ( pActual ) (USERS_OFFSET(pActual)+BUFFER_LENGTH(pActual))

Definition at line 49 of file spy.cpp.

#define TAIL_SIGNITURE ( pActual ) (*(BYTE*)TAIL_OFFSET(pActual))

Definition at line 61 of file spy.cpp.

#define USERS_OFFSET ( pActual ) (HEAD_OFFSET(pActual) + HEADERSIZE)

Definition at line 51 of file spy.cpp.

Function Documentation

HRESULT MallocSpyDump ( CMallocSpy * pCMallocSpy )

Definition at line 491 of file spy.cpp.

{ return S_OK; };

HRESULT MallocSpyRegister ( CMallocSpy ** ppCMallocSpy )

Definition at line 489 of file spy.cpp.

{ return S_OK; };

HRESULT MallocSpyUnRegister ( CMallocSpy * pCMallocSpy )

Definition at line 490 of file spy.cpp.

{ return S_OK; };

Variable Documentation

const BYTE ALLOCSIGN = '$'

Definition at line 45 of file spy.cpp.

const ULONG FOOTERSIZE = TAILSIZE

Definition at line 40 of file spy.cpp.

const BYTE FREESIGN = 'Z'

Definition at line 46 of file spy.cpp.

const ULONG HEADERSIZE = ROUNDUP(HEADSIZE + LENGTHSIZE + IDSIZE)

Definition at line 39 of file spy.cpp.

const BYTE HEADSIGN = '{'

Definition at line 42 of file spy.cpp.

const ULONG HEADSIZE = sizeof(ULONG)

Definition at line 34 of file spy.cpp.

const ULONG IDSIZE = sizeof(ULONG)

Definition at line 36 of file spy.cpp.

const ULONG LENGTHSIZE = sizeof(ULONG)

Definition at line 35 of file spy.cpp.

const BYTE TAILSIGN = '}'

Definition at line 43 of file spy.cpp.

const ULONG TAILSIZE = sizeof(BYTE)

Definition at line 37 of file spy.cpp.

Generated on Wed Nov 13 2024 16:53:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/tablecopy/spy.h File Reference

  • Dataaccess
  • oledb
  • tablecopy
Classes | Functions

spy.h File Reference

#include "objidl.h"
#include "Common.h"
#include "List.h"
#include "List.h"

Go to the source code of this file.

Classes

class | CMallocSpy

Functions

HRESULT | MallocSpyDump (CMallocSpy *pCMallocSpy)
HRESULT | MallocSpyRegister (CMallocSpy **ppCMallocSpy)
HRESULT | MallocSpyUnRegister (CMallocSpy *pCMallocSpy)

Function Documentation

HRESULT MallocSpyDump ( CMallocSpy * pCMallocSpy )

Definition at line 491 of file spy.cpp.

{ return S_OK; };

HRESULT MallocSpyRegister ( CMallocSpy ** ppCMallocSpy )

Definition at line 489 of file spy.cpp.

{ return S_OK; };

HRESULT MallocSpyUnRegister ( CMallocSpy * pCMallocSpy )

Definition at line 490 of file spy.cpp.

{ return S_OK; };

Generated on Wed Nov 13 2024 16:53:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/tablecopy/step1.cpp File Reference

  • Dataaccess
  • oledb
  • tablecopy
Enumerations

step1.cpp File Reference

#include "wizard.h"
#include "common.h"
#include "table.h"

Go to the source code of this file.

Enumerations

enum COL_HEADERS {
COL_COLNAME = 0, COL_COLTYPE = 1, COL_COLORDINAL = 2, COL_COLSIZE = 3,
COL_COLPREC = 4, COL_COLSCALE = 5, COL_COLISFIXED = 6, COL_COLISLONG = 7,
COL_COLISNULLABLE = 8, COL_COLWRITE = 9, COL_COLISROWID = 10, COL_COLISROWVER = 11,
COL_INDEXNAME = 0, COL_INDEXCOLNAME = 1, COL_UNIQUE = 2, COL_PRIMARYKEY = 3,
COL_COLLATION = 4, COL_AUTOUPDATE = 5, COL_NULLS = 6, COL_COLNAME = 0,
COL_COLTYPENAME = 1, COL_COLTYPE = 2, COL_COLORDINAL = 3, COL_COLSIZE = 4,
COL_COLPREC = 5, COL_COLSCALE = 6, COL_COLISFIXED = 7, COL_COLISLONG = 8,
COL_COLISNULLABLE = 9, COL_COLWRITE = 10, COL_COLISROWID = 11, COL_COLISROWVER = 12
}
enum EICON {
ICON_CATALOG = 0, ICON_SCHEMA = 1, ICON_TYPE = 2, ICON_TABLE = 3,
ICON_SYSTABLE = 4, ICON_VIEW = 5, ICON_SYNONYM = 6, ICON_COLUMN = 0,
ICON_READONLY = 1, ICON_LONG = 2, ICON_COLUMN = 0, ICON_READONLY = 1,
ICON_LONG = 2
}

Enumeration Type Documentation

enum COL_HEADERS
Enumerator:
COL_COLNAME
COL_COLTYPE
COL_COLORDINAL
COL_COLSIZE
COL_COLPREC
COL_COLSCALE
COL_COLISFIXED
COL_COLISLONG
COL_COLISNULLABLE
COL_COLWRITE
COL_COLISROWID
COL_COLISROWVER
COL_INDEXNAME
COL_INDEXCOLNAME
COL_UNIQUE
COL_PRIMARYKEY
COL_COLLATION
COL_AUTOUPDATE
COL_NULLS
COL_COLNAME
COL_COLTYPENAME
COL_COLTYPE
COL_COLORDINAL
COL_COLSIZE
COL_COLPREC
COL_COLSCALE
COL_COLISFIXED
COL_COLISLONG
COL_COLISNULLABLE
COL_COLWRITE
COL_COLISROWID
COL_COLISROWVER

Definition at line 25 of file step1.cpp.

{
  //IDL_COLUMNS
  COL_COLNAME     = 0,  //ColInfo.pwszName
  COL_COLTYPE     = 1,  //ColInfo.wType
  COL_COLORDINAL    = 2,  //ColInfo.iOrdinal
  COL_COLSIZE     = 3,  //ColInfo.ulColumnSize
  COL_COLPREC     = 4,  //ColInfo.bPrecision
  COL_COLSCALE    = 5,  //ColInfo.bScale
  COL_COLISFIXED    = 6,  //ColInfo.dwFlags ISFIXEDLENGTH
  COL_COLISLONG   = 7,  //ColInfo.dwFlags ISLONG
  COL_COLISNULLABLE = 8,  //ColInfo.dwFlags ISNULLABLE
  COL_COLWRITE    = 9,  //ColInfo.dwFlags WRITE
  COL_COLISROWID    =10,  //ColInfo.dwFlags ISROWID
  COL_COLISROWVER   =11,  //ColInfo.dwFlags ISROWVER
};

enum EICON
Enumerator:
ICON_CATALOG
ICON_SCHEMA
ICON_TYPE
ICON_TABLE
ICON_SYSTABLE
ICON_VIEW
ICON_SYNONYM
ICON_COLUMN
ICON_READONLY
ICON_LONG
ICON_COLUMN
ICON_READONLY
ICON_LONG

Definition at line 42 of file step1.cpp.

{
  ICON_CATALOG    = 0,
  ICON_SCHEMA     = 1,
  ICON_TYPE     = 2,
  ICON_TABLE      = 3,
  ICON_SYSTABLE   = 4,
  ICON_VIEW     = 5,
  ICON_SYNONYM    = 6,

  ICON_COLUMN     = 0,
  ICON_READONLY   = 1,
  ICON_LONG     = 2,
};

Generated on Wed Nov 13 2024 16:53:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/tablecopy/step2.cpp File Reference

  • Dataaccess
  • oledb
  • tablecopy
Enumerations

step2.cpp File Reference

#include "wizard.h"
#include "common.h"
#include "tablecopy.h"
#include "table.h"

Go to the source code of this file.

Enumerations

enum COL_HEADERS {
COL_COLNAME = 0, COL_COLTYPE = 1, COL_COLORDINAL = 2, COL_COLSIZE = 3,
COL_COLPREC = 4, COL_COLSCALE = 5, COL_COLISFIXED = 6, COL_COLISLONG = 7,
COL_COLISNULLABLE = 8, COL_COLWRITE = 9, COL_COLISROWID = 10, COL_COLISROWVER = 11,
COL_INDEXNAME = 0, COL_INDEXCOLNAME = 1, COL_UNIQUE = 2, COL_PRIMARYKEY = 3,
COL_COLLATION = 4, COL_AUTOUPDATE = 5, COL_NULLS = 6, COL_COLNAME = 0,
COL_COLTYPENAME = 1, COL_COLTYPE = 2, COL_COLORDINAL = 3, COL_COLSIZE = 4,
COL_COLPREC = 5, COL_COLSCALE = 6, COL_COLISFIXED = 7, COL_COLISLONG = 8,
COL_COLISNULLABLE = 9, COL_COLWRITE = 10, COL_COLISROWID = 11, COL_COLISROWVER = 12
}
enum INDEX_TYPE { INDEXTYPE_INDEX = 0, INDEXTYPE_PRIMARYKEY = 1 }

Enumeration Type Documentation

enum COL_HEADERS
Enumerator:
COL_COLNAME
COL_COLTYPE
COL_COLORDINAL
COL_COLSIZE
COL_COLPREC
COL_COLSCALE
COL_COLISFIXED
COL_COLISLONG
COL_COLISNULLABLE
COL_COLWRITE
COL_COLISROWID
COL_COLISROWVER
COL_INDEXNAME
COL_INDEXCOLNAME
COL_UNIQUE
COL_PRIMARYKEY
COL_COLLATION
COL_AUTOUPDATE
COL_NULLS
COL_COLNAME
COL_COLTYPENAME
COL_COLTYPE
COL_COLORDINAL
COL_COLSIZE
COL_COLPREC
COL_COLSCALE
COL_COLISFIXED
COL_COLISLONG
COL_COLISNULLABLE
COL_COLWRITE
COL_COLISROWID
COL_COLISROWVER

Definition at line 28 of file step2.cpp.

{
  //IDL_INDEXES
  COL_INDEXNAME   = 0,  //IndexInfo.wszIndexName
  COL_INDEXCOLNAME  = 1,  //IndexInfo.wszColName
  COL_UNIQUE      = 2,  //IndexInfo.fUnique
  COL_PRIMARYKEY    = 3,  //IndexInfo.fIsPrimaryKey
  COL_COLLATION   = 4,  //IndexInfo.dwCollation
  COL_AUTOUPDATE    = 5,  //IndexInfo.fAutoUpdate
  COL_NULLS     = 6,  //IndexInfo.dwNulls
};

enum INDEX_TYPE
Enumerator:
INDEXTYPE_INDEX
INDEXTYPE_PRIMARYKEY

Definition at line 40 of file step2.cpp.

{
  INDEXTYPE_INDEX     = 0,
  INDEXTYPE_PRIMARYKEY  = 1,
};

Generated on Wed Nov 13 2024 16:53:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/tablecopy/step3.cpp File Reference

  • Dataaccess
  • oledb
  • tablecopy

step3.cpp File Reference

#include "wizard.h"
#include "common.h"
#include "Tablecopy.h"
#include "Table.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/tablecopy/step4.cpp File Reference

  • Dataaccess
  • oledb
  • tablecopy
Enumerations

step4.cpp File Reference

#include "wizard.h"
#include "common.h"
#include "tablecopy.h"
#include "table.h"

Go to the source code of this file.

Enumerations

enum COL_HEADERS {
COL_COLNAME = 0, COL_COLTYPE = 1, COL_COLORDINAL = 2, COL_COLSIZE = 3,
COL_COLPREC = 4, COL_COLSCALE = 5, COL_COLISFIXED = 6, COL_COLISLONG = 7,
COL_COLISNULLABLE = 8, COL_COLWRITE = 9, COL_COLISROWID = 10, COL_COLISROWVER = 11,
COL_INDEXNAME = 0, COL_INDEXCOLNAME = 1, COL_UNIQUE = 2, COL_PRIMARYKEY = 3,
COL_COLLATION = 4, COL_AUTOUPDATE = 5, COL_NULLS = 6, COL_COLNAME = 0,
COL_COLTYPENAME = 1, COL_COLTYPE = 2, COL_COLORDINAL = 3, COL_COLSIZE = 4,
COL_COLPREC = 5, COL_COLSCALE = 6, COL_COLISFIXED = 7, COL_COLISLONG = 8,
COL_COLISNULLABLE = 9, COL_COLWRITE = 10, COL_COLISROWID = 11, COL_COLISROWVER = 12
}
enum EICON {
ICON_CATALOG = 0, ICON_SCHEMA = 1, ICON_TYPE = 2, ICON_TABLE = 3,
ICON_SYSTABLE = 4, ICON_VIEW = 5, ICON_SYNONYM = 6, ICON_COLUMN = 0,
ICON_READONLY = 1, ICON_LONG = 2, ICON_COLUMN = 0, ICON_READONLY = 1,
ICON_LONG = 2
}

Enumeration Type Documentation

enum COL_HEADERS
Enumerator:
COL_COLNAME
COL_COLTYPE
COL_COLORDINAL
COL_COLSIZE
COL_COLPREC
COL_COLSCALE
COL_COLISFIXED
COL_COLISLONG
COL_COLISNULLABLE
COL_COLWRITE
COL_COLISROWID
COL_COLISROWVER
COL_INDEXNAME
COL_INDEXCOLNAME
COL_UNIQUE
COL_PRIMARYKEY
COL_COLLATION
COL_AUTOUPDATE
COL_NULLS
COL_COLNAME
COL_COLTYPENAME
COL_COLTYPE
COL_COLORDINAL
COL_COLSIZE
COL_COLPREC
COL_COLSCALE
COL_COLISFIXED
COL_COLISLONG
COL_COLISNULLABLE
COL_COLWRITE
COL_COLISROWID
COL_COLISROWVER

Definition at line 26 of file step4.cpp.

{
  //IDL_FROM_TYPES
  //ID_TO_TYPES
  COL_COLNAME     = 0,  //ColInfo.pwszName
  COL_COLTYPENAME   = 1,  //TypeInfo.pwszTypeName
  COL_COLTYPE     = 2,  //ColInfo.wType
  COL_COLORDINAL    = 3,  //ColInfo.iOrdinal
  COL_COLSIZE     = 4,  //ColInfo.ulColumnSize
  COL_COLPREC     = 5,  //ColInfo.bPrecision
  COL_COLSCALE    = 6,  //ColInfo.bScale
  COL_COLISFIXED    = 7,  //ColInfo.dwFlags ISFIXEDLENGTH
  COL_COLISLONG   = 8,  //ColInfo.dwFlags ISLONG
  COL_COLISNULLABLE = 9,  //ColInfo.dwFlags ISNULLABLE
  COL_COLWRITE    =10,  //ColInfo.dwFlags WRITE
  COL_COLISROWID    =11,  //ColInfo.dwFlags ISROWID
  COL_COLISROWVER   =12,  //ColInfo.dwFlags ISROWVER
};

enum EICON
Enumerator:
ICON_CATALOG
ICON_SCHEMA
ICON_TYPE
ICON_TABLE
ICON_SYSTABLE
ICON_VIEW
ICON_SYNONYM
ICON_COLUMN
ICON_READONLY
ICON_LONG
ICON_COLUMN
ICON_READONLY
ICON_LONG

Definition at line 45 of file step4.cpp.

{
  ICON_COLUMN     = 0,
  ICON_READONLY   = 1,
  ICON_LONG     = 2,
};

Generated on Wed Nov 13 2024 16:53:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/tablecopy/table.cpp File Reference

  • Dataaccess
  • oledb
  • tablecopy
Defines

table.cpp File Reference

#include "winmain.h"
#include "common.h"
#include "tablecopy.h"
#include "table.h"
#include "wizard.h"
#include "progress.h"

Go to the source code of this file.

Defines

#define | MATCH_DEFAULT 0x0008
#define | MATCH_EXACT 0x0001
#define | MATCH_SIZE 0x0004
#define | MATCH_TYPE 0x0002
#define | NO_MATCH 0x0000

Define Documentation

#define MATCH_DEFAULT 0x0008

Definition at line 31 of file table.cpp.

#define MATCH_EXACT 0x0001

Definition at line 28 of file table.cpp.

#define MATCH_SIZE 0x0004

Definition at line 30 of file table.cpp.

#define MATCH_TYPE 0x0002

Definition at line 29 of file table.cpp.

#define NO_MATCH 0x0000

Definition at line 27 of file table.cpp.

Generated on Wed Nov 13 2024 16:53:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/tablecopy/table.h File Reference

  • Dataaccess
  • oledb
  • tablecopy
Classes | Enumerations

table.h File Reference

#include "DataSource.h"
#include "TableCopy.h"

Go to the source code of this file.

Classes

struct | BINDINGINFO
class | CISeqStream
struct | COLDESC
class | CTable
struct | INDEXINFO
struct | PRIMARYKEY
struct | TABLEINFO
struct | TYPEINFO

Enumerations

enum | ESQL_STMT { ESQL_SELECT, ESQL_INSERT, ESQL_CREATE_TABLE, ESQL_DROP_TABLE }

Enumeration Type Documentation

enum ESQL_STMT
Enumerator:
ESQL_SELECT
ESQL_INSERT
ESQL_CREATE_TABLE
ESQL_DROP_TABLE

Definition at line 27 of file table.h.

{
  ESQL_SELECT,
  ESQL_INSERT,
  ESQL_CREATE_TABLE,
  ESQL_DROP_TABLE
};

Generated on Wed Nov 13 2024 16:53:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/tablecopy/tablecopy.cpp File Reference

  • Dataaccess
  • oledb
  • tablecopy
Defines

tablecopy.cpp File Reference

#include "winmain.h"
#include "common.h"
#include "tablecopy.h"
#include "table.h"
#include "wizard.h"
#include "msdaguid.h"

Go to the source code of this file.

Defines

#define | DBINITCONSTANTS
#define | INITGUID

Define Documentation

#define DBINITCONSTANTS

Definition at line 16 of file tablecopy.cpp.

#define INITGUID

Definition at line 17 of file tablecopy.cpp.

Generated on Wed Nov 13 2024 16:53:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/tablecopy/tablecopy.h File Reference

  • Dataaccess
  • oledb
  • tablecopy
Classes | Defines

tablecopy.h File Reference

#include "oledb.h"

Go to the source code of this file.

Classes

class | CTableCopy

Defines

#define | COLINFO_SIZE(ColInfo) (IsNumericType(ColInfo.wType) ? ColInfo.bPrecision : ColInfo.ulColumnSize)
#define | CP_LENGTH 0x0004
#define | CP_MAXLENGTH 0x0008
#define | CP_PRECISION 0x0001
#define | CP_SCALE 0x0002
#define | MAX_BLOCK_SIZE 20
#define | MAX_COL_SIZE 50000
#define | MAX_NAME_LEN 256
#define | MAX_QUERY_LEN 4096
#define | MAX_STREAM_BLOCK_SIZE 2000

Define Documentation

#define COLINFO_SIZE ( ColInfo ) (IsNumericType(ColInfo.wType) ? ColInfo.bPrecision : ColInfo.ulColumnSize)

Definition at line 49 of file tablecopy.h.

#define CP_LENGTH 0x0004

Definition at line 44 of file tablecopy.h.

#define CP_MAXLENGTH 0x0008

Definition at line 45 of file tablecopy.h.

#define CP_PRECISION 0x0001

Definition at line 42 of file tablecopy.h.

#define CP_SCALE 0x0002

Definition at line 43 of file tablecopy.h.

#define MAX_BLOCK_SIZE 20

Definition at line 38 of file tablecopy.h.

#define MAX_COL_SIZE 50000

Definition at line 37 of file tablecopy.h.

#define MAX_NAME_LEN 256

Definition at line 35 of file tablecopy.h.

#define MAX_QUERY_LEN 4096

Definition at line 34 of file tablecopy.h.

#define MAX_STREAM_BLOCK_SIZE 2000

Definition at line 39 of file tablecopy.h.

Generated on Wed Nov 13 2024 16:53:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/tablecopy/version.h File Reference

  • Dataaccess
  • oledb
  • tablecopy
Defines

version.h File Reference

Go to the source code of this file.

Defines

#define | IDS_RESDLL_VER 1
#define | VER_COMPANYNAME_STR "Microsoft Corporation\0"
#define | VER_FILEFLAGS (0)
#define | VER_FILEFLAGSMASK (VS_FF_DEBUG | VS_FF_PRERELEASE)
#define | VER_FILEOS VOS_NT_WINDOWS32
#define | VER_FILEVERSION 2,50,4809.0
#define | VER_FILEVERSION_STR "2.50.4809.0\0"
#define | VER_LEGALCOPYRIGHT_STR "Copyright \251 Microsoft Corporation 1991-2000\0"
#define | VER_PRODUCTNAME_STR "Microsoft OLE DB\0"
#define | VER_PRODUCTVERSION 2,50,4809.0
#define | VER_PRODUCTVERSION_STR "2.50.4809.0\0"

Define Documentation

#define IDS_RESDLL_VER 1

Definition at line 34 of file version.h.

#define VER_COMPANYNAME_STR "Microsoft Corporation\0"

Definition at line 29 of file version.h.

#define VER_FILEFLAGS (0)

Definition at line 24 of file version.h.

#define VER_FILEFLAGSMASK (VS_FF_DEBUG | VS_FF_PRERELEASE)

Definition at line 20 of file version.h.

#define VER_FILEOS VOS_NT_WINDOWS32

Definition at line 27 of file version.h.

#define VER_FILEVERSION 2,50,4809.0

Definition at line 15 of file version.h.

#define VER_FILEVERSION_STR "2.50.4809.0\0"

Definition at line 16 of file version.h.

#define VER_LEGALCOPYRIGHT_STR "Copyright \251 Microsoft Corporation 1991-2000\0"

Definition at line 31 of file version.h.

#define VER_PRODUCTNAME_STR "Microsoft OLE DB\0"

Definition at line 30 of file version.h.

#define VER_PRODUCTVERSION 2,50,4809.0

Definition at line 17 of file version.h.

#define VER_PRODUCTVERSION_STR "2.50.4809.0\0"

Definition at line 18 of file version.h.

Generated on Wed Nov 13 2024 16:53:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/tablecopy/winmain.cpp File Reference

  • Dataaccess
  • oledb
  • tablecopy
Functions

winmain.cpp File Reference

#include "winmain.h"
#include "wizard.h"
#include "common.h"
#include "tablecopy.h"
#include "table.h"
#include "spy.h"

Go to the source code of this file.

Functions

void | Busy (BOOL bValue)
BOOL | CenterDialog (HWND hdlg)
BOOL | GetEditBoxValue (HWND hEditWnd, ULONG ulMin, ULONG ulMax, ULONG *pulCount)
int | InternalAssert (char *pszExp, char *pszFile, UINT iLine)
void | InternalTrace (WCHAR *pwszFmt,...)
void | InternalTrace (CHAR *pszFmt,...)
LONG | LV_FindItem (HWND hWnd, CHAR *szName, LONG iStart)
LONG | LV_InsertColumn (HWND hWnd, LONG iColumn, CHAR *szName)
LONG | LV_InsertItem (HWND hWnd, LONG iItem, LONG iSubItem, CHAR *szName, LONG iParam, LONG iImage)
LONG | LV_SetItemState (HWND hWnd, LONG iItem, LONG iSubItem, LONG lState, LONG lStateMask)
LONG | LV_SetItemText (HWND hWnd, LONG iItem, LONG iSubItem, CHAR *szName)
void | OutOfMemory (HWND hWnd)
void | SyncSibling (HWND hToWnd, HWND hFromWnd)
HTREEITEM | TV_InsertItem (HWND hWnd, HTREEITEM hParent, HTREEITEM hInsAfter, CHAR *szName, LONG iParam, LONG iImage, LONG iSelectedImage)
UINT | wGetDlgItemText (HWND hWnd, INT DlgItem, WCHAR *pwsz, INT nMaxSize)
int WINAPI | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, CHAR *pszCmdLine, INT nCmdShow)
INT | wMessageBox (HWND hwnd, UINT uiStyle, WCHAR *pwszTitle, WCHAR *pwszFmt,...)
LRESULT | wSendMessage (HWND hWnd, UINT Msg, WPARAM wParam, WCHAR *pwszBuffer)
void | wSetDlgItemText (HWND hWnd, INT DlgItem, WCHAR *pwszFmt,...)

Function Documentation

void Busy ( BOOL bValue )

Definition at line 187 of file winmain.cpp.

{
  static HCURSOR  hWaitCursor = LoadCursor(NULL, IDC_WAIT);

  if(bValue)
    SetCursor(hWaitCursor);
  else
    SetCursor(NULL);
}

BOOL CenterDialog ( HWND hdlg )

Definition at line 213 of file winmain.cpp.

{
  RECT  rcParent;                         // Parent window client rect
  RECT  rcDlg;                            // Dialog window rect
  int   nLeft, nTop;                      // Top-left coordinates
  int   cWidth, cHeight;                  // Width and height
  HWND  hwnd;

  // Get frame window client rect in screen coordinates
  hwnd = GetParent(hdlg);
  if(hwnd == NULL || hwnd == GetDesktopWindow())
  {
    rcParent.top = rcParent.left = 0;
    rcParent.right = GetSystemMetrics(SM_CXFULLSCREEN);
    rcParent.bottom = GetSystemMetrics(SM_CYFULLSCREEN);
  }
  else
    GetWindowRect(hwnd, &rcParent);

  // Determine the top-left point for the dialog to be centered
  GetWindowRect(hdlg, &rcDlg);
  cWidth  = rcDlg.right  - rcDlg.left;
  cHeight = rcDlg.bottom - rcDlg.top;
  nLeft   = rcParent.left +
            (((rcParent.right  - rcParent.left) - cWidth ) / 2);
  nTop    = rcParent.top  +
            (((rcParent.bottom - rcParent.top ) - cHeight) / 2);
  if (nLeft < 0) nLeft = 0;
  if (nTop  < 0) nTop  = 0;

  // Place the dialog
  return MoveWindow(hdlg, nLeft, nTop, cWidth, cHeight, TRUE);
}

BOOL GetEditBoxValue | ( | HWND | hEditWnd,
 |  | ULONG | ulMin,
 |  | ULONG | ulMax,
 |  | ULONG * | pulCount
 | ) |  |

Definition at line 358 of file winmain.cpp.

{
  ASSERT(hEditWnd);
  ASSERT(pulCount);

  ULONG ulCount = 0;
  WCHAR wszBuffer[MAX_NAME_LEN];
  WCHAR*  pwszEnd = NULL;

  //Get the EditText
  wSendMessage(hEditWnd, WM_GETTEXT, MAX_NAME_LEN, wszBuffer);

  //Convert to ULONG
  ulCount = wcstoul(wszBuffer, &pwszEnd, 10);
  if(!wszBuffer[0] || ulCount<ulMin || ulCount>ulMax || pwszEnd==NULL || pwszEnd[0]!=EOL)
  {
    wMessageBox(hEditWnd, MB_APPLMODAL | MB_ICONEXCLAMATION | MB_OK,  wsz_ERROR,
      wsz_INVALID_VALUE_, wszBuffer, ulMin, ulMax);
    SetFocus(hEditWnd);
    return FALSE;
  }

  *pulCount = ulCount;
  return TRUE;
}

int InternalAssert | ( | char * | pszExp,
 |  | char * | pszFile,
 |  | UINT | iLine
 | ) |  |

Definition at line 100 of file winmain.cpp.

{
  CHAR  szMsg[MAX_QUERY_LEN];
  _snprintf(szMsg, MAX_NAME_LEN, "Assertion Error!\n File '%s', Line '%lu'\n"
          "Expression '%s'\n\n"
          "Do you wish to Continue?  (Press 'OK' to ignore the assertion."
          "  Press 'Cancel to debug.)",pszFile, iLine, pszExp);

  //Popup a MessageBox
  LONG dwSelection = MessageBoxA(NULL, szMsg, "Microsoft OLE DB TableCopy - Error",
    MB_TASKMODAL | MB_ICONSTOP | MB_OKCANCEL | MB_DEFBUTTON1 );

  switch(dwSelection)
  {
    case IDOK:
      return 0;
    case IDCANCEL:
      return 1;
    default:
      ASSERT(!L"Unhandled Choice");
  }

  return 0;
}

void InternalTrace | ( | WCHAR * | pwszFmt,
 |  |  | ...
 | ) |  |

Definition at line 134 of file winmain.cpp.

{
  va_list   marker;
  WCHAR   wszBuffer[MAX_NAME_LEN];
  CHAR    szBuffer[MAX_NAME_LEN];

  // Use format and arguements as input
  //This version will not overwrite the stack, since it only copies
  //upto the max size of the array
  va_start(marker, pwszFmt);
  _vsnwprintf(wszBuffer, MAX_NAME_LEN, pwszFmt, marker);
  va_end(marker);

  //Make sure there is a NULL Terminator, vsnwprintf will not copy
  //the terminator if length==MAX_NAME_LEN
  wszBuffer[MAX_NAME_LEN-1] = EOL;

  //Convert to MBCS
  ConvertToMBCS(wszBuffer, szBuffer, MAX_NAME_LEN);

  //Output to the DebugWindow
  OutputDebugString(szBuffer);
}

void InternalTrace | ( | CHAR * | pszFmt,
 |  |  | ...
 | ) |  |

Definition at line 163 of file winmain.cpp.

{
  va_list   marker;
  CHAR    szBuffer[MAX_NAME_LEN];

  // Use format and arguements as input
  //This version will not overwrite the stack, since it only copies
  //upto the max size of the array
  va_start(marker, pszFmt);
  _vsnprintf(szBuffer, MAX_NAME_LEN, pszFmt, marker);
  va_end(marker);

  //Make sure there is a NULL Terminator, vsnwprintf will not copy
  //the terminator if length==MAX_NAME_LEN
  szBuffer[MAX_NAME_LEN-1] = '\0';

  OutputDebugStringA(szBuffer);
}

LONG LV_FindItem | ( | HWND | hWnd,
 |  | CHAR * | szName,
 |  | LONG | iStart
 | ) |  |

Definition at line 448 of file winmain.cpp.

{
  //LVM_FINDITEM
  LV_FINDINFO lvFindInfo = { LVFI_STRING, szName, 0, 0, 0};
  return SendMessage(hWnd, LVM_FINDITEM, (WPARAM)iStart, (LPARAM)&lvFindInfo);
}

LONG LV_InsertColumn | ( | HWND | hWnd,
 |  | LONG | iColumn,
 |  | CHAR * | szName
 | ) |  |

Definition at line 389 of file winmain.cpp.

{
  //Setup LV_COLUMNINFO
  LV_COLUMN lvColumnHeader = { LVCF_TEXT | LVCF_FMT | LVCF_SUBITEM, LVCFMT_LEFT, 0, szName, MAX_NAME_LEN, 0};

  //LVM_INSERTCOLUMN
  return SendMessage(hWnd, LVM_INSERTCOLUMN, (WPARAM)iColumn, (LPARAM)&lvColumnHeader);
}

LONG LV_InsertItem | ( | HWND | hWnd,
 |  | LONG | iItem,
 |  | LONG | iSubItem,
 |  | CHAR * | szName,
 |  | LONG | iParam,
 |  | LONG | iImage
 | ) |  |

Definition at line 403 of file winmain.cpp.

{
  //LVM_INSERTITEM
  if(iSubItem==0)
  {
    LV_ITEM lvItem = { LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM, iItem, iSubItem, 0, 0, szName, 0, iImage, iParam};
    return SendMessage(hWnd, LVM_INSERTITEM, (WPARAM)0, (LPARAM)&lvItem);
  }
  //LVM_SETITEM
  else
  {
    LV_ITEM lvItem = { LVIF_TEXT, iItem, iSubItem, 0, 0, szName, 0, 0, iParam};
    return SendMessage(hWnd, LVM_SETITEM, (WPARAM)0, (LPARAM)&lvItem);
  }
}

LONG LV_SetItemState | ( | HWND | hWnd,
 |  | LONG | iItem,
 |  | LONG | iSubItem,
 |  | LONG | lState,
 |  | LONG | lStateMask
 | ) |  |

Definition at line 424 of file winmain.cpp.

{
  //LVM_SETITEM
  LV_ITEM lvItem = { LVIF_STATE, iItem, iSubItem, lState, lStateMask, NULL, 0, 0, 0};
  return SendMessage(hWnd, LVM_SETITEMSTATE, (WPARAM)iItem, (LPARAM)&lvItem);
}

LONG LV_SetItemText | ( | HWND | hWnd,
 |  | LONG | iItem,
 |  | LONG | iSubItem,
 |  | CHAR * | szName
 | ) |  |

Definition at line 436 of file winmain.cpp.

{
  //LVM_SETITEM
  LV_ITEM lvItem = { LVIF_TEXT, iItem, iSubItem, 0, 0, szName, 0, 0, 0};
  return SendMessage(hWnd, LVM_SETITEMTEXT, (WPARAM)iItem, (LPARAM)&lvItem);
}

void OutOfMemory ( HWND hWnd )

Definition at line 202 of file winmain.cpp.

{
  //Unicode version is supported on Win95/WinNT
  MessageBoxW(hWnd, L"Out of memory", wsz_ERROR, MB_TASKMODAL | MB_OK);
}

void SyncSibling | ( | HWND | hToWnd,
 |  | HWND | hFromWnd
 | ) |  |

Definition at line 68 of file winmain.cpp.

{
  ASSERT(hToWnd && hFromWnd);

  //Make both windows synched,
  //Get the current selection from the Source
  LONG iItem = SendMessage(hFromWnd, LVM_GETNEXTITEM, (WPARAM)-1, (LPARAM)LVNI_SELECTED);

  //Tell the Target to select the same selection
  if(iItem != LVM_ERR)
  {
    //Get the current selection from the Target and Unselect it
    LONG iOldItem = SendMessage(hToWnd, LVM_GETNEXTITEM, (WPARAM)-1, (LPARAM)LVNI_SELECTED);
    if(iItem != iOldItem)
    {
      //Unselect previous one
      LV_SetItemState(hToWnd, iOldItem, 0, 0, LVIS_SELECTED);

      //Select the new one
      LV_SetItemState(hToWnd, iItem, 0, LVIS_SELECTED, LVNI_SELECTED);

      //Ensure that it is visible
      SendMessage(hToWnd, LVM_ENSUREVISIBLE, (WPARAM)iItem, (LPARAM)FALSE);
    }
  }
}

HTREEITEM TV_InsertItem | ( | HWND | hWnd,
 |  | HTREEITEM | hParent,
 |  | HTREEITEM | hInsAfter,
 |  | CHAR * | szName,
 |  | LONG | iParam,
 |  | LONG | iImage,
 |  | LONG | iSelectedImage
 | ) |  |

Definition at line 460 of file winmain.cpp.

{
  TV_INSERTSTRUCT tvInsertStruct = { hParent, hInsAfter, { TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM, 0, 0, 0, szName, 0, iImage, iSelectedImage, 0, iParam} };

  //TVM_INSERTITEM
  return (HTREEITEM)SendMessage(hWnd, TVM_INSERTITEM, (WPARAM)0, (LPARAM)&tvInsertStruct);
}

UINT wGetDlgItemText | ( | HWND | hWnd,
 |  | INT | DlgItem,
 |  | WCHAR * | pwsz,
 |  | INT | nMaxSize
 | ) |  |

Definition at line 313 of file winmain.cpp.

{
  ASSERT(pwsz);
  CHAR szBuffer[MAX_NAME_LEN];

  UINT iReturn = GetDlgItemTextA(hWnd, DlgItem, szBuffer, MAX_NAME_LEN);

  //convert to WCHAR
  ConvertToWCHAR(szBuffer, pwsz, MAX_NAME_LEN);
  return iReturn;
}

int WINAPI WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | CHAR * | pszCmdLine,
 |  | INT | nCmdShow
 | ) |  |

Definition at line 28 of file winmain.cpp.

{
  HRESULT hr = E_FAIL;
  CMallocSpy* pCMallocSpy = NULL;
  CWizard* pCWizard = NULL;

  //Register IMallocSpy
  XTESTC(hr = MallocSpyRegister(&pCMallocSpy));

  pCWizard = new CWizard(NULL, hInstance);

  //CoInitialize - COM/OLE
  XTESTC(hr = CoInitialize(NULL));

  //Initlialize Window Controls
  InitCommonControls();

  //Main Execution
  pCWizard->Display();

CLEANUP:
  delete pCWizard;
  MallocSpyUnRegister(pCMallocSpy);
  CoUninitialize();

  //Dump all the leaks
  MallocSpyDump(pCMallocSpy);
  delete pCMallocSpy;

  return (hr==S_OK);
}

INT wMessageBox | ( | HWND | hwnd,
 |  | UINT | uiStyle,
 |  | WCHAR * | pwszTitle,
 |  | WCHAR * | pwszFmt,
 |  |  | ...
 | ) |  |

Definition at line 252 of file winmain.cpp.

{
  va_list   marker;
  WCHAR   wszBuffer[MAX_QUERY_LEN];

  // Use format and arguements as input
  //This version will not overwrite the stack, since it only copies
  //upto the max size of the array
  va_start(marker, pwszFmt);
  _vsnwprintf(wszBuffer, MAX_QUERY_LEN, pwszFmt, marker);
  va_end(marker);

  //Make sure there is a NULL Terminator, vsnwprintf will not copy
  //the terminator if length==MAX_QUERY_LEN
  wszBuffer[MAX_QUERY_LEN-1] = EOL;

  //Unicode version is supported on both Win95 / WinNT do need to convert
  return MessageBoxW(hwnd, wszBuffer, pwszTitle, uiStyle);
}

LRESULT wSendMessage | ( | HWND | hWnd,
 |  | UINT | Msg,
 |  | WPARAM | wParam,
 |  | WCHAR * | pwszBuffer
 | ) |  |

Definition at line 331 of file winmain.cpp.

{
  CHAR szBuffer[MAX_NAME_LEN];
  szBuffer[0] = '\0';

  if(pwszBuffer && Msg != WM_GETTEXT && Msg != LVM_GETITEM && Msg != CB_GETLBTEXT)
  {
    //Convert to ANSI before sending, since we don't know if this was a GET/SET message
    ConvertToMBCS(pwszBuffer, szBuffer, MAX_NAME_LEN);
  }

  //Send the message with an ANSI Buffer
  LRESULT lResult = SendMessageA(hWnd, Msg, (WPARAM)wParam, (LPARAM)szBuffer);

  if(pwszBuffer && Msg == WM_GETTEXT || Msg == LVM_GETITEM || Msg == CB_GETLBTEXT)
  {
    //Now convert the result into the users WCHAR buffer
    ConvertToWCHAR(szBuffer, pwszBuffer, MAX_NAME_LEN);
  }
  return lResult;
}

void wSetDlgItemText | ( | HWND | hWnd,
 |  | INT | DlgItem,
 |  | WCHAR * | pwszFmt,
 |  |  | ...
 | ) |  |

Definition at line 285 of file winmain.cpp.

{
  va_list   marker;
  WCHAR   wszBuffer[MAX_NAME_LEN];
  CHAR    szBuffer[MAX_NAME_LEN];

  // Use format and arguements as input
  //This version will not overwrite the stack, since it only copies
  //upto the max size of the array
  va_start(marker, pwszFmt);
  _vsnwprintf(wszBuffer, MAX_NAME_LEN, pwszFmt, marker);
  va_end(marker);

  //Make sure there is a NULL Terminator, vsnwprintf will not copy
  //the terminator if length==MAX_NAME_LEN
  wszBuffer[MAX_NAME_LEN-1] = EOL;

  //convert to MBCS
  ConvertToMBCS(wszBuffer, szBuffer, MAX_NAME_LEN);

  SetDlgItemTextA(hWnd, DlgItem, szBuffer);
}

Generated on Wed Nov 13 2024 16:53:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/tablecopy/winmain.h File Reference

  • Dataaccess
  • oledb
  • tablecopy
Defines | Functions | Variables

winmain.h File Reference

#include <windows.h>
#include <windowsx.h>
#include <commctrl.h>
#include <stddef.h>
#include <stdio.h>
#include <limits.h>
#include <wchar.h>
#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Defines

#define | ASSERT(exp)
#define | CHECK_MEMORY(pv) if(!pv) { OutOfMemory(NULL); goto CLEANUP; }
#define | LVM_ERR (-1)
#define | STRICT
#define | TRACE if(0) InternalTrace

Functions

void | Busy (BOOL bValue=TRUE)
BOOL | CenterDialog (HWND hDlg)
BOOL | GetEditBoxValue (HWND hEditWnd, ULONG ulMin, ULONG ulMax, ULONG *pulCount)
int | InternalAssert (char *pszExp, char *pszFile, UINT iLine)
void | InternalTrace (CHAR *pszExp,...)
void | InternalTrace (WCHAR *pwszExp,...)
LONG | LV_FindItem (HWND hWnd, CHAR *szName, LONG iStart)
LONG | LV_InsertColumn (HWND hWnd, LONG iColumn, CHAR *szName)
LONG | LV_InsertItem (HWND hWnd, LONG iItem, LONG iSubItem, CHAR *szName, LONG iParam=0, LONG iIMage=NULL)
LONG | LV_SetItemState (HWND hWnd, LONG iItem, LONG iSubItem, LONG lState, LONG lStateMask)
LONG | LV_SetItemText (HWND hWnd, LONG iItem, LONG iSubItem, CHAR *szName)
void | OutOfMemory (HWND hwnd)
void | SyncSibling (HWND hwndLstChg, HWND hwndLstSrc)
HTREEITEM | TV_InsertItem (HWND hWnd, HTREEITEM hParent, HTREEITEM hInsAfter, CHAR *szName, LONG iParam=0, LONG iImage=0, LONG iSelectedImage=0)
UINT | wGetDlgItemText (HWND hWnd, INT DlgItem, WCHAR *pwsz, INT nMaxSize)
INT | wMessageBox (HWND hDlg, UINT uiStyle, WCHAR *pwszTitle, WCHAR *pwszFmt,...)
LRESULT | wSendMessage (HWND hWnd, UINT Msg, WPARAM wParam, WCHAR *pwszName)
void | wSetDlgItemText (HWND hWnd, INT DlgItem, WCHAR *pwszFmt,...)

Variables

const BOOL | HANDLED_MSG = TRUE
const BOOL | UNHANDLED_MSG = FALSE

Define Documentation

#define ASSERT ( exp )

Definition at line 115 of file winmain.h.

#define CHECK_MEMORY ( pv ) if(!pv) { OutOfMemory(NULL); goto CLEANUP; }

Definition at line 45 of file winmain.h.

#define LVM_ERR (-1)

Definition at line 52 of file winmain.h.

#define STRICT

Definition at line 21 of file winmain.h.

#define TRACE if(0) InternalTrace

Definition at line 116 of file winmain.h.

Function Documentation

void Busy ( BOOL bValue = TRUE )

Definition at line 187 of file winmain.cpp.

{
  static HCURSOR  hWaitCursor = LoadCursor(NULL, IDC_WAIT);

  if(bValue)
    SetCursor(hWaitCursor);
  else
    SetCursor(NULL);
}

BOOL CenterDialog ( HWND hDlg )

Definition at line 2784 of file common.cpp.

{
  RECT  rcParent;                         // Parent window client rect
  RECT  rcDlg;                            // Dialog window rect
  int   nLeft, nTop;                      // Top-left coordinates
  int   cWidth, cHeight;                  // Width and height
  HWND  hwnd;

  // Get frame window client rect in screen coordinates
  hwnd = GetParent(hdlg);
  if(hwnd == NULL || hwnd == GetDesktopWindow())
  {
    rcParent.top = rcParent.left = 0;
    rcParent.right = GetSystemMetrics(SM_CXFULLSCREEN);
    rcParent.bottom = GetSystemMetrics(SM_CYFULLSCREEN);
  }
  else
  {
    GetWindowRect(hwnd, &rcParent);
  }

  // Determine the top-left point for the dialog to be centered
  GetWindowRect(hdlg, &rcDlg);
  cWidth  = rcDlg.right  - rcDlg.left;
  cHeight = rcDlg.bottom - rcDlg.top;
  nLeft   = rcParent.left +
            (((rcParent.right  - rcParent.left) - cWidth ) / 2);
  nTop    = rcParent.top  +
            (((rcParent.bottom - rcParent.top ) - cHeight) / 2);
  if (nLeft < 0) nLeft = 0;
  if (nTop  < 0) nTop  = 0;

  // Place the dialog
  return MoveWindow(hdlg, nLeft, nTop, cWidth, cHeight, TRUE);
}

BOOL GetEditBoxValue | ( | HWND | hEditWnd,
 |  | ULONG | ulMin,
 |  | ULONG | ulMax,
 |  | ULONG * | pulCount
 | ) |  |

Definition at line 358 of file winmain.cpp.

{
  ASSERT(hEditWnd);
  ASSERT(pulCount);

  ULONG ulCount = 0;
  WCHAR wszBuffer[MAX_NAME_LEN];
  WCHAR*  pwszEnd = NULL;

  //Get the EditText
  wSendMessage(hEditWnd, WM_GETTEXT, MAX_NAME_LEN, wszBuffer);

  //Convert to ULONG
  ulCount = wcstoul(wszBuffer, &pwszEnd, 10);
  if(!wszBuffer[0] || ulCount<ulMin || ulCount>ulMax || pwszEnd==NULL || pwszEnd[0]!=EOL)
  {
    wMessageBox(hEditWnd, MB_APPLMODAL | MB_ICONEXCLAMATION | MB_OK,  wsz_ERROR,
      wsz_INVALID_VALUE_, wszBuffer, ulMin, ulMax);
    SetFocus(hEditWnd);
    return FALSE;
  }

  *pulCount = ulCount;
  return TRUE;
}

int InternalAssert | ( | char * | pszExp,
 |  | char * | pszFile,
 |  | UINT | iLine
 | ) |  |

Definition at line 100 of file winmain.cpp.

{
  CHAR  szMsg[MAX_QUERY_LEN];
  _snprintf(szMsg, MAX_NAME_LEN, "Assertion Error!\n File '%s', Line '%lu'\n"
          "Expression '%s'\n\n"
          "Do you wish to Continue?  (Press 'OK' to ignore the assertion."
          "  Press 'Cancel to debug.)",pszFile, iLine, pszExp);

  //Popup a MessageBox
  LONG dwSelection = MessageBoxA(NULL, szMsg, "Microsoft OLE DB TableCopy - Error",
    MB_TASKMODAL | MB_ICONSTOP | MB_OKCANCEL | MB_DEFBUTTON1 );

  switch(dwSelection)
  {
    case IDOK:
      return 0;
    case IDCANCEL:
      return 1;
    default:
      ASSERT(!L"Unhandled Choice");
  }

  return 0;
}

void InternalTrace | ( | CHAR * | pszExp,
 |  |  | ...
 | ) |  |

Definition at line 163 of file winmain.cpp.

{
  va_list   marker;
  CHAR    szBuffer[MAX_NAME_LEN];

  // Use format and arguements as input
  //This version will not overwrite the stack, since it only copies
  //upto the max size of the array
  va_start(marker, pszFmt);
  _vsnprintf(szBuffer, MAX_NAME_LEN, pszFmt, marker);
  va_end(marker);

  //Make sure there is a NULL Terminator, vsnwprintf will not copy
  //the terminator if length==MAX_NAME_LEN
  szBuffer[MAX_NAME_LEN-1] = '\0';

  OutputDebugStringA(szBuffer);
}

void InternalTrace | ( | WCHAR * | pwszExp,
 |  |  | ...
 | ) |  |

Definition at line 134 of file winmain.cpp.

{
  va_list   marker;
  WCHAR   wszBuffer[MAX_NAME_LEN];
  CHAR    szBuffer[MAX_NAME_LEN];

  // Use format and arguements as input
  //This version will not overwrite the stack, since it only copies
  //upto the max size of the array
  va_start(marker, pwszFmt);
  _vsnwprintf(wszBuffer, MAX_NAME_LEN, pwszFmt, marker);
  va_end(marker);

  //Make sure there is a NULL Terminator, vsnwprintf will not copy
  //the terminator if length==MAX_NAME_LEN
  wszBuffer[MAX_NAME_LEN-1] = EOL;

  //Convert to MBCS
  ConvertToMBCS(wszBuffer, szBuffer, MAX_NAME_LEN);

  //Output to the DebugWindow
  OutputDebugString(szBuffer);
}

LONG LV_FindItem | ( | HWND | hWnd,
 |  | CHAR * | szName,
 |  | LONG | iStart
 | ) |  |

Definition at line 448 of file winmain.cpp.

{
  //LVM_FINDITEM
  LV_FINDINFO lvFindInfo = { LVFI_STRING, szName, 0, 0, 0};
  return SendMessage(hWnd, LVM_FINDITEM, (WPARAM)iStart, (LPARAM)&lvFindInfo);
}

LONG LV_InsertColumn | ( | HWND | hWnd,
 |  | LONG | iColumn,
 |  | CHAR * | szName
 | ) |  |

Definition at line 389 of file winmain.cpp.

{
  //Setup LV_COLUMNINFO
  LV_COLUMN lvColumnHeader = { LVCF_TEXT | LVCF_FMT | LVCF_SUBITEM, LVCFMT_LEFT, 0, szName, MAX_NAME_LEN, 0};

  //LVM_INSERTCOLUMN
  return SendMessage(hWnd, LVM_INSERTCOLUMN, (WPARAM)iColumn, (LPARAM)&lvColumnHeader);
}

LONG LV_InsertItem | ( | HWND | hWnd,
 |  | LONG | iItem,
 |  | LONG | iSubItem,
 |  | CHAR * | szName,
 |  | LONG | iParam = 0,
 |  | LONG | iIMage = NULL
 | ) |  |

Definition at line 403 of file winmain.cpp.

{
  //LVM_INSERTITEM
  if(iSubItem==0)
  {
    LV_ITEM lvItem = { LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM, iItem, iSubItem, 0, 0, szName, 0, iImage, iParam};
    return SendMessage(hWnd, LVM_INSERTITEM, (WPARAM)0, (LPARAM)&lvItem);
  }
  //LVM_SETITEM
  else
  {
    LV_ITEM lvItem = { LVIF_TEXT, iItem, iSubItem, 0, 0, szName, 0, 0, iParam};
    return SendMessage(hWnd, LVM_SETITEM, (WPARAM)0, (LPARAM)&lvItem);
  }
}

LONG LV_SetItemState | ( | HWND | hWnd,
 |  | LONG | iItem,
 |  | LONG | iSubItem,
 |  | LONG | lState,
 |  | LONG | lStateMask
 | ) |  |

Definition at line 424 of file winmain.cpp.

{
  //LVM_SETITEM
  LV_ITEM lvItem = { LVIF_STATE, iItem, iSubItem, lState, lStateMask, NULL, 0, 0, 0};
  return SendMessage(hWnd, LVM_SETITEMSTATE, (WPARAM)iItem, (LPARAM)&lvItem);
}

LONG LV_SetItemText | ( | HWND | hWnd,
 |  | LONG | iItem,
 |  | LONG | iSubItem,
 |  | CHAR * | szName
 | ) |  |

Definition at line 436 of file winmain.cpp.

{
  //LVM_SETITEM
  LV_ITEM lvItem = { LVIF_TEXT, iItem, iSubItem, 0, 0, szName, 0, 0, 0};
  return SendMessage(hWnd, LVM_SETITEMTEXT, (WPARAM)iItem, (LPARAM)&lvItem);
}

void OutOfMemory ( HWND hwnd )

Definition at line 202 of file winmain.cpp.

{
  //Unicode version is supported on Win95/WinNT
  MessageBoxW(hWnd, L"Out of memory", wsz_ERROR, MB_TASKMODAL | MB_OK);
}

void SyncSibling | ( | HWND | hwndLstChg,
 |  | HWND | hwndLstSrc
 | ) |  |

Definition at line 2645 of file common.cpp.

{
  ASSERT(hToWnd && hFromWnd);

  //Make both windows synched,
  //Get the current selection from the Source
  INDEX iItem = (INDEX)SendMessage(hFromWnd, LVM_GETNEXTITEM, (WPARAM)-1, (LPARAM)LVNI_SELECTED);

  //Tell the Target to select the same selection
  if(iItem != LVM_ERR)
  {
    //Get the current selection from the Target and Unselect it
    INDEX iOldItem = (INDEX)SendMessage(hToWnd, LVM_GETNEXTITEM, (WPARAM)-1, (LPARAM)LVNI_SELECTED);
    if(iItem != iOldItem)
    {
      //Unselect previous one
      LV_SetItemState(hToWnd, iOldItem, 0, 0, LVIS_SELECTED);

      //Select the new one
      LV_SetItemState(hToWnd, iItem, 0, LVIS_SELECTED, LVNI_SELECTED);

      //Ensure that it is visible
      SendMessage(hToWnd, LVM_ENSUREVISIBLE, (WPARAM)iItem, (LPARAM)FALSE);
    }
  }
}

HTREEITEM TV_InsertItem | ( | HWND | hWnd,
 |  | HTREEITEM | hParent,
 |  | HTREEITEM | hInsAfter,
 |  | CHAR * | szName,
 |  | LONG | iParam = 0,
 |  | LONG | iImage = 0,
 |  | LONG | iSelectedImage = 0
 | ) |  |

Definition at line 460 of file winmain.cpp.

{
  TV_INSERTSTRUCT tvInsertStruct = { hParent, hInsAfter, { TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM, 0, 0, 0, szName, 0, iImage, iSelectedImage, 0, iParam} };

  //TVM_INSERTITEM
  return (HTREEITEM)SendMessage(hWnd, TVM_INSERTITEM, (WPARAM)0, (LPARAM)&tvInsertStruct);
}

UINT wGetDlgItemText | ( | HWND | hWnd,
 |  | INT | DlgItem,
 |  | WCHAR * | pwsz,
 |  | INT | nMaxSize
 | ) |  |

Definition at line 313 of file winmain.cpp.

{
  ASSERT(pwsz);
  CHAR szBuffer[MAX_NAME_LEN];

  UINT iReturn = GetDlgItemTextA(hWnd, DlgItem, szBuffer, MAX_NAME_LEN);

  //convert to WCHAR
  ConvertToWCHAR(szBuffer, pwsz, MAX_NAME_LEN);
  return iReturn;
}

INT wMessageBox | ( | HWND | hDlg,
 |  | UINT | uiStyle,
 |  | WCHAR * | pwszTitle,
 |  | WCHAR * | pwszFmt,
 |  |  | ...
 | ) |  |

Definition at line 2942 of file common.cpp.

{
  va_list   marker;
  WCHAR   wszBuffer[MAX_QUERY_LEN];

  // Use format and arguements as input
  //This version will not overwrite the stack, since it only copies
  //upto the max size of the array
  va_start(marker, pwszFmt);
  _vsnwprintf(wszBuffer, MAX_QUERY_LEN, pwszFmt, marker);
  va_end(marker);

  //Make sure there is a NULL Terminator, vsnwprintf will not copy
  //the terminator if length==MAX_QUERY_LEN
  wszBuffer[MAX_QUERY_LEN-1] = wEOL;

  //Unicode version is supported on both Win95/WinNT
  return MessageBoxW(hwnd, wszBuffer, pwszTitle, uiStyle);
}

LRESULT wSendMessage | ( | HWND | hWnd,
 |  | UINT | Msg,
 |  | WPARAM | wParam,
 |  | WCHAR * | pwszName
 | ) |  |

Definition at line 2973 of file common.cpp.

{
  LRESULT lResult = 0;
  HRESULT hr = S_OK;

  if(IsUnicodeOS())
  {
    //WinNT - Unicode, no need for conversions...
    lResult = SendMessageW(hWnd, Msg, (WPARAM)wParam, (LPARAM)pwszText);
  }
  else
  {
    //Win95 - Unicode not supported...
    CHAR szBuffer[MAX_QUERY_LEN] = { 0, 0, 0, 0 };
    ULONG ulDestSize = MAX_QUERY_LEN;
    CHAR* psz = szBuffer;

    //All messages that have [input] strings
    switch(Msg)
    {
      case EM_GETLINE:
        ((WORD*)psz)[0] = MAX_QUERY_LEN;
        break;

      case WM_GETTEXT:
        //We may need to dynamically allocate this...
        if(wParam > MAX_QUERY_LEN)
          SAFE_ALLOC(psz, CHAR, wParam);
        break;

      case EM_GETSELTEXT:
        ASSERT(wParam && "wSendMessage EM_GETSELTEXT requires a length so the conversion buffer so it doesn't overflow...");
        ulDestSize = (ULONG)wParam;

        //We may need to dynamically allocate this...
        if(wParam > MAX_QUERY_LEN)
          SAFE_ALLOC(psz, CHAR, wParam);
        wParam = 0;
        break;

      case SB_SETTEXTW:
        Msg = SB_SETTEXT;

      case WM_SETTEXT:
      case EM_REPLACESEL:
      case CB_FINDSTRINGEXACT:
      case CB_FINDSTRING:
      case CB_ADDSTRING:
      case LB_ADDSTRING:
      case SB_SETTEXTA:
        //Convert to ANSI before sending
        //We may need to dynamically allocate this...
        if(!ConvertToMBCS(pwszText, psz, MAX_QUERY_LEN))
          psz = ConvertToMBCS(pwszText);
        break;
    };

    //Send the message with an ANSI Buffer
    lResult = SendMessageA(hWnd, Msg, (WPARAM)wParam, (LPARAM)psz);

    //All messages that have [output] messages (return strings)
    switch(Msg)
    {
      case WM_GETTEXT:
        //Now convert the result into the users WCHAR buffer
        //wParam indicates the max length
        ConvertToWCHAR(psz, pwszText, (INT)wParam);
        break;

      case EM_GETLINE:
        //Now convert the result into the users WCHAR buffer
        ASSERT(pwszText);
        ConvertToWCHAR(psz, pwszText, ((WORD*)pwszText)[0]);
        break;

      case CB_GETLBTEXT:
      case EM_GETSELTEXT:
      case LB_GETTEXT:
        //Now convert the result into the users WCHAR buffer
        ConvertToWCHAR(psz, pwszText, ulDestSize);
        break;
    };

    //Free any dynamically allocated memory
    if(psz != szBuffer)
      SAFE_FREE(psz);
  }

CLEANUP:
  return lResult;
}

void wSetDlgItemText | ( | HWND | hWnd,
 |  | INT | DlgItem,
 |  | WCHAR * | pwszFmt,
 |  |  | ...
 | ) |  |

Definition at line 285 of file winmain.cpp.

{
  va_list   marker;
  WCHAR   wszBuffer[MAX_NAME_LEN];
  CHAR    szBuffer[MAX_NAME_LEN];

  // Use format and arguements as input
  //This version will not overwrite the stack, since it only copies
  //upto the max size of the array
  va_start(marker, pwszFmt);
  _vsnwprintf(wszBuffer, MAX_NAME_LEN, pwszFmt, marker);
  va_end(marker);

  //Make sure there is a NULL Terminator, vsnwprintf will not copy
  //the terminator if length==MAX_NAME_LEN
  wszBuffer[MAX_NAME_LEN-1] = EOL;

  //convert to MBCS
  ConvertToMBCS(wszBuffer, szBuffer, MAX_NAME_LEN);

  SetDlgItemTextA(hWnd, DlgItem, szBuffer);
}

Variable Documentation

const BOOL HANDLED_MSG = TRUE

Definition at line 50 of file winmain.h.

const BOOL UNHANDLED_MSG = FALSE

Definition at line 51 of file winmain.h.

Generated on Wed Nov 13 2024 16:53:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/tablecopy/wizard.cpp File Reference

  • Dataaccess
  • oledb
  • tablecopy

wizard.cpp File Reference

#include "common.h"
#include "tablecopy.h"
#include "wizard.h"
#include "progress.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/oledb/tablecopy/wizard.h File Reference

  • Dataaccess
  • oledb
  • tablecopy
Classes | Enumerations

wizard.h File Reference

#include "winmain.h"
#include "Table.h"

Go to the source code of this file.

Classes

class | CDialogBase
class | CS1Dialog
class | CS2Dialog
class | CS3Dialog
class | CS4Dialog
class | CTypesDialog
class | CWizard
struct | TREEINFO

Enumerations

enum WIZ_STEP {
WIZ_STEP1 = 0, WIZ_STEP2 = 1, WIZ_STEP3 = 2, WIZ_STEP4 = 3,
WIZ_TYPES = 4, END_WIZ = 5
}

Enumeration Type Documentation

enum WIZ_STEP
Enumerator:
WIZ_STEP1
WIZ_STEP2
WIZ_STEP3
WIZ_STEP4
WIZ_TYPES
END_WIZ

Definition at line 26 of file wizard.h.

{
  WIZ_STEP1 = 0,
  WIZ_STEP2 = 1,
  WIZ_STEP3 = 2,
  WIZ_STEP4 = 3,
  WIZ_TYPES = 4,
  END_WIZ   = 5
};

Generated on Wed Nov 13 2024 16:53:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/osp/vc/cexlist.h File Reference

  • Dataaccess
  • osp
  • vc
Classes | Typedefs

cexlist.h File Reference

Go to the source code of this file.

Classes

class | CExList< TYPE >
class | CNode< TYPE >

Typedefs

typedef void * | POS

Typedef Documentation

typedef void* POS

Definition at line 23 of file cexlist.h.

Generated on Wed Nov 13 2024 16:53:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/osp/vc/common.cpp File Reference

  • Dataaccess
  • osp
  • vc
Defines | Functions

common.cpp File Reference

#include "Common.h"

Go to the source code of this file.

Defines

#define | DBINITCONSTANTS
#define | INITGUID

Functions

BOOL | CompareVariant (VARIANT *pVar1, VARIANT *pVar2, BOOL fCaseSensitive)
HRESULT | ConvertToMBCS (WCHAR *pwsz, CHAR *psz, ULONG cbStrLen)
HRESULT | ConvertToWCHAR (CHAR *psz, WCHAR *pwsz, ULONG cbStrLen)
HRESULT | DelRegEntry (HKEY hRootKey, CHAR *pszKeyName)
HRESULT | DelRegEntry (REGENTRY *pRegEntry)
HRESULT | GetRegEntry (REGENTRY *pRegEntry, CHAR *pszValue, ULONG cBytes)
HRESULT | GetRegEntry (HKEY hRootKey, CHAR *pszKeyName, CHAR *pszValueName, CHAR *pszValue, ULONG cBytes)
HRESULT | SetRegEntry (REGENTRY *pRegEntry)
HRESULT | SetRegEntry (HKEY hRootKey, CHAR *pszKeyName, CHAR *pszValueName, CHAR *pszValue)

Define Documentation

#define DBINITCONSTANTS

Definition at line 14 of file common.cpp.

#define INITGUID

Definition at line 13 of file common.cpp.

Function Documentation

BOOL CompareVariant | ( | VARIANT * | pVar1,
 |  | VARIANT * | pVar2,
 |  | BOOL | fCaseSensitive
 | ) |  |

Definition at line 24 of file common.cpp.

                              : Pointer to the variant in the consumer's buffer.
  VARIANT *pVar2, //@parm [in]: Pointer to the variant at the backend.
  BOOL fCaseSensitive
)
{
  //Handle NULL cases...
  if(pVar1==NULL || pVar2==NULL)
  {
    if(pVar1 == pVar2)
      return TRUE;
    return FALSE;
  }

  // The variant has to be the same type
  if (V_VT(pVar1) != V_VT(pVar2))
    return FALSE;

  // Return FALSE if vt is ORed with VT_RESERVED
  if (V_VT(pVar1) & VT_RESERVED)
    return FALSE;

  // Return TRUE is the vt is VT_EMPTY or VT_NULL
  if (V_VT(pVar1)==VT_EMPTY || V_VT(pVar1)==VT_NULL)
    return TRUE;

  switch(V_VT(pVar1))
  {
    case VT_UI1:
      return V_UI1(pVar1) == V_UI1(pVar2);

    case VT_I2:
      return V_I2(pVar1) == V_I2(pVar2);

    case VT_I4:
      return V_I4(pVar1) == V_I4(pVar2);

    case VT_R4:
      return V_R4(pVar1) == V_R4(pVar2);

    case VT_R8:
      return V_R8(pVar1) == V_R8(pVar2);

    case VT_BOOL:
      return V_BOOL(pVar1) == V_BOOL(pVar2);

    case VT_ERROR:
      return V_ERROR(pVar1) == V_ERROR(pVar2);

    case VT_CY:
      return memcmp(&V_CY(pVar1), &V_CY(pVar2),8)==0;

    case VT_DATE:
      return V_DATE(pVar1) == V_DATE(pVar2);

    case VT_BSTR:
      if(fCaseSensitive)
        return wcscmp(V_BSTR(pVar1), V_BSTR(pVar2));
      else
        return _wcsicmp(V_BSTR(pVar1), V_BSTR(pVar2));

    // As we are not testing OLE object, return FALSE for VT_UNKNOWN
    case VT_UNKNOWN:
      return FALSE;

    // As we are not testing OLE object, return FALSE for VT_DISPATCH
    case VT_DISPATCH:
      return FALSE;

    case VT_I2 | VT_BYREF:
      return *V_I2REF(pVar1) == *V_I2REF(pVar2);

    case VT_I4 | VT_BYREF:
      return *V_I4REF(pVar1) == *V_I4REF(pVar2);

    case VT_R4 | VT_BYREF:
      return *V_R4REF(pVar1) == *V_R4REF(pVar2);

    case VT_R8 | VT_BYREF:
      return *V_R8REF(pVar1) == *V_R8REF(pVar2);

    case VT_BOOL | VT_BYREF:
      return *V_BOOLREF(pVar1) == *V_BOOLREF(pVar2);

    case VT_ERROR | VT_BYREF:
      return *V_ERRORREF(pVar1) == *V_ERRORREF(pVar2);

    case VT_CY | VT_BYREF:
      return memcmp(V_CYREF(pVar1), V_CYREF(pVar2),8)==0;

    case VT_DATE | VT_BYREF:
      return *V_DATEREF(pVar1) == *V_DATEREF(pVar2);

    case VT_BSTR | VT_BYREF:
      if(fCaseSensitive)
        return wcscmp(*V_BSTRREF(pVar1), *V_BSTRREF(pVar2));
      else
        return _wcsicmp(*V_BSTRREF(pVar1), *V_BSTRREF(pVar2));

    // As we are not testing OLE object, return FALSE for VT_UNKNOWN
    case VT_UNKNOWN | VT_BYREF:
      return FALSE;

    // As we are not testing OLE object, return FALSE for VT_DISPATCH
    case VT_DISPATCH | VT_BYREF:
      return FALSE;
  }

  return FALSE;
}

HRESULT ConvertToMBCS | ( | WCHAR * | pwsz,
 |  | CHAR * | psz,
 |  | ULONG | cbStrLen
 | ) |  |

Definition at line 257 of file common.cpp.

{
  //Convert the string to MBCS
  INT iResult = WideCharToMultiByte(CP_ACP, 0, pwsz, -1, psz, cbStrLen, NULL, NULL);
  return iResult ? S_OK : E_FAIL;
}

HRESULT ConvertToWCHAR | ( | CHAR * | psz,
 |  | WCHAR * | pwsz,
 |  | ULONG | cbStrLen
 | ) |  |

Definition at line 268 of file common.cpp.

{
  //Convert the string to MBCS
  INT iResult = MultiByteToWideChar(CP_ACP, 0, psz, -1, pwsz, cbStrLen);
  return iResult ? S_OK : E_FAIL;
}

HRESULT DelRegEntry | ( | HKEY | hRootKey,
 |  | CHAR * | pszKeyName
 | ) |  |

Definition at line 229 of file common.cpp.

{
  HKEY hKey = NULL;
  HRESULT hr;

  //no-op
  if(!pszKeyName)
    return E_FAIL;

  //Delete the Key for HKEY_CLASSES_ROOT\"SubKey"
  hr = RegDeleteKey(hRootKey, pszKeyName);

  //Entry successfully deleted - return S_OK
  if(hr==ERROR_SUCCESS)
    return S_OK;

  //Entry not found - return S_FALSE
  if(hr==ERROR_FILE_NOT_FOUND)
    return S_FALSE;

  return E_FAIL;
}

HRESULT DelRegEntry ( REGENTRY * pRegEntry )

Definition at line 220 of file common.cpp.

{
  return DelRegEntry(pRegEntry->hRootKey, pRegEntry->szKeyName);
}

HRESULT GetRegEntry | ( | REGENTRY * | pRegEntry,
 |  | CHAR * | pszValue,
 |  | ULONG | cBytes
 | ) |  |

Definition at line 139 of file common.cpp.

{
  return GetRegEntry(pRegEntry->hRootKey, pRegEntry->szKeyName, pRegEntry->szValueName, pszValue, cBytes);
}

HRESULT GetRegEntry | ( | HKEY | hRootKey,
 |  | CHAR * | pszKeyName,
 |  | CHAR * | pszValueName,
 |  | CHAR * | pszValue,
 |  | ULONG | cBytes
 | ) |  |

Definition at line 149 of file common.cpp.

{
  HRESULT hr = E_FAIL;
  HKEY hKey = NULL;

  //no-op, pszValueName is not required
  if(!pszKeyName || !pszValue)
    return E_FAIL;

  //Obtain the Key for HKEY_CLASSES_ROOT\"SubKey"
  if(ERROR_SUCCESS != RegOpenKeyEx(hRootKey, pszKeyName, 0, KEY_READ, &hKey))
    goto CLEANUP;

  //Obtain the Data for the above key
  if(ERROR_SUCCESS == RegQueryValueEx(hKey, pszValueName, NULL, NULL, (LPBYTE)pszValue, &cBytes))
    hr = S_OK;

CLEANUP:
  if(hKey)
    RegCloseKey(hKey);

  return hr;
}

HRESULT SetRegEntry ( REGENTRY * pRegEntry )

Definition at line 178 of file common.cpp.

{
  return SetRegEntry(pRegEntry->hRootKey, pRegEntry->szKeyName, pRegEntry->szValueName, pRegEntry->szValue);
}

HRESULT SetRegEntry | ( | HKEY | hRootKey,
 |  | CHAR * | pszKeyName,
 |  | CHAR * | pszValueName,
 |  | CHAR * | pszValue
 | ) |  |

Definition at line 188 of file common.cpp.

{
  HRESULT hr = E_FAIL;
  HKEY hKey = NULL;
  ULONG dwDisposition;

  //no-op, pszValueName is not required
  if(!pszKeyName || !pszValue)
    return E_FAIL;

  //Create the Key for HKEY_CLASSES_ROOT\"SubKey"
    if(ERROR_SUCCESS != RegCreateKeyEx(hRootKey, pszKeyName, 0, NULL,
      REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &dwDisposition))
      goto CLEANUP;

  //Set the data for the above key
    if(ERROR_SUCCESS == RegSetValueEx(hKey, pszValueName, 0, REG_SZ,
            (BYTE*)pszValue, strlen(pszValue) + sizeof(CHAR)))
    hr = S_OK;

CLEANUP:
  if(hKey)
    RegCloseKey(hKey);

  return hr;
}

Generated on Wed Nov 13 2024 16:53:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/osp/vc/common.h File Reference

  • Dataaccess
  • osp
  • vc
Classes | Defines | Functions | Variables

common.h File Reference

#include "oledb.h"
#include "oledberr.h"
#include "msdaosp.h"
#include <ocidl.h>

Go to the source code of this file.

Classes

struct | REGENTRY

Defines

#define | CHECK_MEMORY(pv) if(!(pv)) goto CLEANUP
#define | EQUAL (0)
#define | GREATERTHAN (1)
#define | LESSTHAN (-1)
#define | MAX_BLOCK_SIZE 50
#define | MAX_NAME_LEN 256
#define | NOTEQUAL (-2)
#define | NUMELEM(x) (sizeof(x)/sizeof(*x))
#define | SAFE_ADDREF(pv) if((pv)) { (pv)->AddRef(); }
#define | SAFE_ALLOC(pv, type, cb) { pv = (type*)CoTaskMemAlloc((cb)*sizeof(type)); CHECK_MEMORY(pv); }
#define | SAFE_FREE(pv) { CoTaskMemFree(pv); pv = NULL; }
#define | SAFE_REALLOC(pv, type, cb) { pv = (type*)CoTaskMemRealloc(pv, (cb)*sizeof(type)); CHECK_MEMORY(pv);}
#define | SAFE_RELEASE(pv) if((pv)) { (pv)->Release(); (pv) = NULL; }
#define | SAFE_SYSALLOC(pv, bstr) { pv = SysAllocString(bstr); CHECK_MEMORY(pv); }
#define | SAFE_SYSFREE(bstr) { SysFreeString(bstr); bstr = NULL;}
#define | TEST(exp) { if(FAILED(exp)) { ASSERT(!#exp); } }
#define | TESTC(exp) { if(FAILED(exp)) { goto CLEANUP; } }

Functions

BOOL | CompareVariant (VARIANT *pVar1, VARIANT *pVar2, BOOL fCaseSensitive)
HRESULT | ConvertToMBCS (WCHAR *pwsz, CHAR *psz, ULONG cbStrLen)
HRESULT | ConvertToWCHAR (CHAR *psz, WCHAR *pwsz, ULONG cbStrLen)
HRESULT | DelRegEntry (HKEY hRootKey, CHAR *pszKeyName)
HRESULT | DelRegEntry (REGENTRY *pRegEntry)
HRESULT | GetRegEntry (REGENTRY *pRegEntry, CHAR *pszData, ULONG cBytes)
HRESULT | GetRegEntry (HKEY hRootKey, CHAR *pszKeyName, CHAR *pszValueName, CHAR *pszValue, ULONG cBytes)
HRESULT | SetRegEntry (REGENTRY *pRegEntry)
HRESULT | SetRegEntry (HKEY hRootKey, CHAR *pszKeyName, CHAR *pszValueName, CHAR *pszValue)

Variables

const IID | IID_DataSourceListener
const IID | IID_OLEDBSimpleProvider
const IID | IID_OLEDBSimpleProviderListener

Define Documentation

#define CHECK_MEMORY ( pv ) if(!(pv)) goto CLEANUP

Definition at line 29 of file common.h.

#define EQUAL (0)

Definition at line 51 of file common.h.

#define GREATERTHAN (1)

Definition at line 53 of file common.h.

#define LESSTHAN (-1)

Definition at line 52 of file common.h.

#define MAX_BLOCK_SIZE 50

Definition at line 49 of file common.h.

#define MAX_NAME_LEN 256

Definition at line 48 of file common.h.

#define NOTEQUAL (-2)

Definition at line 54 of file common.h.

#define NUMELEM ( x ) (sizeof(x)/sizeof(*x))

Definition at line 46 of file common.h.

#define SAFE_ADDREF ( pv ) if((pv)) { (pv)->AddRef(); }

Definition at line 40 of file common.h.

#define SAFE_ALLOC | ( | pv,
 |  | type,
 |  | cb |
 | ) |  | { pv = (type*)CoTaskMemAlloc((cb)*sizeof(type)); CHECK_MEMORY(pv); }

Definition at line 31 of file common.h.

#define SAFE_FREE ( pv ) { CoTaskMemFree(pv); pv = NULL; }

Definition at line 35 of file common.h.

#define SAFE_REALLOC | ( | pv,
 |  | type,
 |  | cb |
 | ) |  | { pv = (type*)CoTaskMemRealloc(pv, (cb)*sizeof(type)); CHECK_MEMORY(pv);}

Definition at line 32 of file common.h.

#define SAFE_RELEASE ( pv ) if((pv)) { (pv)->Release(); (pv) = NULL; }

Definition at line 39 of file common.h.

#define SAFE_SYSALLOC | ( | pv,
 |  | bstr |
 | ) |  | { pv = SysAllocString(bstr); CHECK_MEMORY(pv); }

Definition at line 33 of file common.h.

#define SAFE_SYSFREE ( bstr ) { SysFreeString(bstr); bstr = NULL;}

Definition at line 36 of file common.h.

#define TEST ( exp ) { if(FAILED(exp)) { ASSERT(!#exp); } }

Definition at line 43 of file common.h.

#define TESTC ( exp ) { if(FAILED(exp)) { goto CLEANUP; } }

Definition at line 44 of file common.h.

Function Documentation

BOOL CompareVariant | ( | VARIANT * | pVar1,
 |  | VARIANT * | pVar2,
 |  | BOOL | fCaseSensitive
 | ) |  |

Definition at line 24 of file common.cpp.

                              : Pointer to the variant in the consumer's buffer.
  VARIANT *pVar2, //@parm [in]: Pointer to the variant at the backend.
  BOOL fCaseSensitive
)
{
  //Handle NULL cases...
  if(pVar1==NULL || pVar2==NULL)
  {
    if(pVar1 == pVar2)
      return TRUE;
    return FALSE;
  }

  // The variant has to be the same type
  if (V_VT(pVar1) != V_VT(pVar2))
    return FALSE;

  // Return FALSE if vt is ORed with VT_RESERVED
  if (V_VT(pVar1) & VT_RESERVED)
    return FALSE;

  // Return TRUE is the vt is VT_EMPTY or VT_NULL
  if (V_VT(pVar1)==VT_EMPTY || V_VT(pVar1)==VT_NULL)
    return TRUE;

  switch(V_VT(pVar1))
  {
    case VT_UI1:
      return V_UI1(pVar1) == V_UI1(pVar2);

    case VT_I2:
      return V_I2(pVar1) == V_I2(pVar2);

    case VT_I4:
      return V_I4(pVar1) == V_I4(pVar2);

    case VT_R4:
      return V_R4(pVar1) == V_R4(pVar2);

    case VT_R8:
      return V_R8(pVar1) == V_R8(pVar2);

    case VT_BOOL:
      return V_BOOL(pVar1) == V_BOOL(pVar2);

    case VT_ERROR:
      return V_ERROR(pVar1) == V_ERROR(pVar2);

    case VT_CY:
      return memcmp(&V_CY(pVar1), &V_CY(pVar2),8)==0;

    case VT_DATE:
      return V_DATE(pVar1) == V_DATE(pVar2);

    case VT_BSTR:
      if(fCaseSensitive)
        return wcscmp(V_BSTR(pVar1), V_BSTR(pVar2));
      else
        return _wcsicmp(V_BSTR(pVar1), V_BSTR(pVar2));

    // As we are not testing OLE object, return FALSE for VT_UNKNOWN
    case VT_UNKNOWN:
      return FALSE;

    // As we are not testing OLE object, return FALSE for VT_DISPATCH
    case VT_DISPATCH:
      return FALSE;

    case VT_I2 | VT_BYREF:
      return *V_I2REF(pVar1) == *V_I2REF(pVar2);

    case VT_I4 | VT_BYREF:
      return *V_I4REF(pVar1) == *V_I4REF(pVar2);

    case VT_R4 | VT_BYREF:
      return *V_R4REF(pVar1) == *V_R4REF(pVar2);

    case VT_R8 | VT_BYREF:
      return *V_R8REF(pVar1) == *V_R8REF(pVar2);

    case VT_BOOL | VT_BYREF:
      return *V_BOOLREF(pVar1) == *V_BOOLREF(pVar2);

    case VT_ERROR | VT_BYREF:
      return *V_ERRORREF(pVar1) == *V_ERRORREF(pVar2);

    case VT_CY | VT_BYREF:
      return memcmp(V_CYREF(pVar1), V_CYREF(pVar2),8)==0;

    case VT_DATE | VT_BYREF:
      return *V_DATEREF(pVar1) == *V_DATEREF(pVar2);

    case VT_BSTR | VT_BYREF:
      if(fCaseSensitive)
        return wcscmp(*V_BSTRREF(pVar1), *V_BSTRREF(pVar2));
      else
        return _wcsicmp(*V_BSTRREF(pVar1), *V_BSTRREF(pVar2));

    // As we are not testing OLE object, return FALSE for VT_UNKNOWN
    case VT_UNKNOWN | VT_BYREF:
      return FALSE;

    // As we are not testing OLE object, return FALSE for VT_DISPATCH
    case VT_DISPATCH | VT_BYREF:
      return FALSE;
  }

  return FALSE;
}

HRESULT ConvertToMBCS | ( | WCHAR * | pwsz,
 |  | CHAR * | psz,
 |  | ULONG | cbStrLen
 | ) |  |

Definition at line 47 of file asserts.cpp.

{
  ASSERT(psz);

  //No-op
  if(pwsz==NULL)
  {
    psz[0] = EOL;
    return S_FALSE;
  }

  //Convert the string to MBCS
  //NOTE:  WideCharToMultiByte returns 0 if truncation occurs!  So when iResult = 0
  //you can be assured the amount copied is the maximum length of the buffer...
  INT iResult = WideCharToMultiByte(CP_OEMCP, 0, pwsz, -1, psz, cStrLen, NULL, NULL);
  return iResult ? S_OK : E_FAIL;
}

HRESULT ConvertToWCHAR | ( | CHAR * | psz,
 |  | WCHAR * | pwsz,
 |  | ULONG | cbStrLen
 | ) |  |

Definition at line 69 of file asserts.cpp.

{
  ASSERT(pwsz);

  //No-op
  if(psz==NULL)
  {
    pwsz[0] = wEOL;
    return S_FALSE;
  }

  //Convert the string to MBCS
  //NOTE:  MultiByteToWideChar returns 0 if truncation occurs!  So when iResult = 0
  //you can be assured the amount copied is the maximum length of the buffer...
  INT iResult = MultiByteToWideChar(CP_OEMCP, 0, psz, -1, pwsz, cStrLen);
  return iResult ? S_OK : E_FAIL;
}

HRESULT DelRegEntry | ( | HKEY | hRootKey,
 |  | CHAR * | pszKeyName
 | ) |  |

Definition at line 229 of file common.cpp.

{
  HKEY hKey = NULL;
  HRESULT hr;

  //no-op
  if(!pszKeyName)
    return E_FAIL;

  //Delete the Key for HKEY_CLASSES_ROOT\"SubKey"
  hr = RegDeleteKey(hRootKey, pszKeyName);

  //Entry successfully deleted - return S_OK
  if(hr==ERROR_SUCCESS)
    return S_OK;

  //Entry not found - return S_FALSE
  if(hr==ERROR_FILE_NOT_FOUND)
    return S_FALSE;

  return E_FAIL;
}

HRESULT DelRegEntry ( REGENTRY * pRegEntry )

Definition at line 220 of file common.cpp.

{
  return DelRegEntry(pRegEntry->hRootKey, pRegEntry->szKeyName);
}

HRESULT GetRegEntry | ( | REGENTRY * | pRegEntry,
 |  | CHAR * | pszData,
 |  | ULONG | cBytes
 | ) |  |

Definition at line 139 of file common.cpp.

{
  return GetRegEntry(pRegEntry->hRootKey, pRegEntry->szKeyName, pRegEntry->szValueName, pszValue, cBytes);
}

HRESULT GetRegEntry | ( | HKEY | hRootKey,
 |  | CHAR * | pszKeyName,
 |  | CHAR * | pszValueName,
 |  | CHAR * | pszValue,
 |  | ULONG | cBytes
 | ) |  |

Definition at line 149 of file common.cpp.

{
  HRESULT hr = E_FAIL;
  HKEY hKey = NULL;

  //no-op, pszValueName is not required
  if(!pszKeyName || !pszValue)
    return E_FAIL;

  //Obtain the Key for HKEY_CLASSES_ROOT\"SubKey"
  if(ERROR_SUCCESS != RegOpenKeyEx(hRootKey, pszKeyName, 0, KEY_READ, &hKey))
    goto CLEANUP;

  //Obtain the Data for the above key
  if(ERROR_SUCCESS == RegQueryValueEx(hKey, pszValueName, NULL, NULL, (LPBYTE)pszValue, &cBytes))
    hr = S_OK;

CLEANUP:
  if(hKey)
    RegCloseKey(hKey);

  return hr;
}

HRESULT SetRegEntry ( REGENTRY * pRegEntry )

Definition at line 178 of file common.cpp.

{
  return SetRegEntry(pRegEntry->hRootKey, pRegEntry->szKeyName, pRegEntry->szValueName, pRegEntry->szValue);
}

HRESULT SetRegEntry | ( | HKEY | hRootKey,
 |  | CHAR * | pszKeyName,
 |  | CHAR * | pszValueName,
 |  | CHAR * | pszValue
 | ) |  |

Definition at line 188 of file common.cpp.

{
  HRESULT hr = E_FAIL;
  HKEY hKey = NULL;
  ULONG dwDisposition;

  //no-op, pszValueName is not required
  if(!pszKeyName || !pszValue)
    return E_FAIL;

  //Create the Key for HKEY_CLASSES_ROOT\"SubKey"
    if(ERROR_SUCCESS != RegCreateKeyEx(hRootKey, pszKeyName, 0, NULL,
      REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &dwDisposition))
      goto CLEANUP;

  //Set the data for the above key
    if(ERROR_SUCCESS == RegSetValueEx(hKey, pszValueName, 0, REG_SZ,
            (BYTE*)pszValue, strlen(pszValue) + sizeof(CHAR)))
    hr = S_OK;

CLEANUP:
  if(hKey)
    RegCloseKey(hKey);

  return hr;
}

Variable Documentation

const IID IID_DataSourceListener
const IID IID_OLEDBSimpleProvider
const IID IID_OLEDBSimpleProviderListener
Generated on Wed Nov 13 2024 16:53:11 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/osp/vc/myclassfactory.cpp File Reference

  • Dataaccess
  • osp
  • vc
Functions | Variables

myclassfactory.cpp File Reference

#include "Common.h"
#include "MyClassFactory.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
HRESULT CALLBACK | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)
BOOL WINAPI | DllMain (HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)
STDAPI | DllRegisterServer ()
STDAPI | DllUnregisterServer ()

Variables

const GUID | CLSID_ospsampc = {0x1e79b2c1,0x77b,0x11d1,{0xb3,0xae,0x0,0xaa,0x0,0xc1,0xa9,0x24}}
DWORD | g_cAttachedProcesses = 0L
LONG | g_cLock = 0L
LONG | g_cObj = 0L
HINSTANCE | g_hInstance = NULL
REGENTRY rgRegInfo []

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 242 of file myclassfactory.cpp.

{
    if (!g_cObj && !g_cLock)
        return S_OK;
    else
        return S_FALSE;
}

HRESULT CALLBACK DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 200 of file myclassfactory.cpp.

{
    MyClassFactory * pClassFactory;
  HRESULT         hr;

    // Check for valid ppvObj pointer
    if (!ppvObj)
        return E_INVALIDARG;

    // In case we fail, we need to zero output arguments
    *ppvObj = NULL;

    // We only service CLSID_SampleOSProvider
    if (rclsid != CLSID_ospsampc)
        return CLASS_E_CLASSNOTAVAILABLE;

    // We only support the IUnknown and IClassFactory interfaces
    if (riid != IID_IUnknown &&
        riid != IID_IClassFactory)
        return E_NOINTERFACE;

    // Create our ClassFactory object
    if(!(pClassFactory = new MyClassFactory()))
        return E_OUTOFMEMORY;

    // Get the desired interface on this object
    hr = pClassFactory->QueryInterface( riid, ppvObj );
    if(FAILED(hr))
        delete pClassFactory;

  return hr;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstDLL,
 |  | DWORD | fdwReason,
 |  | LPVOID | lpvReserved
 | ) |  |

Definition at line 144 of file myclassfactory.cpp.

{
    BOOL  fRetVal = FALSE;

    switch(fdwReason)
    {
    case DLL_PROCESS_ATTACH:

      // Assume successfully initialized
      fRetVal = TRUE;

      // Do one-time initialization when first process attaches
      if (!g_cAttachedProcesses)
      {
        g_hInstance = hInstDLL;
      }

      // Do per-process initialization here...

      // Remember that another process successfully attached
      g_cAttachedProcesses++;
      break;

    case DLL_PROCESS_DETACH:
      // Clean up when the last process is going away
      if (g_cAttachedProcesses == 1)
      {
      }

      // Do per-process clean up here...

      // Remember that a process has detached
      g_cAttachedProcesses--;
      break;

    case DLL_THREAD_ATTACH:
      break;

    case DLL_THREAD_DETACH:
      break;
    }

    return fRetVal;
}

STDAPI DllRegisterServer ( void )

Definition at line 278 of file myclassfactory.cpp.

{
  HRESULT   hr;
    HMODULE     hModule;
    CHAR    szBuffer[MAX_NAME_LEN];
  CHAR    szFullFileName[MAX_PATH+1];

    // Get the full path name for this DLL.
    if (NULL == (hModule = GetModuleHandle( "ospsampc" )))
        return E_FAIL;
    if (0 == GetModuleFileName( hModule, szFullFileName, MAX_PATH+1))
        return E_FAIL;

    // Make a clean start
    DllUnregisterServer();

    // Loop through s_rgRegInfo, and put everything in it.
    // Every entry is based on HKEY_CLASSES_ROOT.
    for (int i=0; i<NUMELEM(rgRegInfo); i++)
    {
        // Fill in any "%s" arguments with the name of this DLL.
        wsprintf(szBuffer, rgRegInfo[i].szValue, szFullFileName );
    rgRegInfo[i].szValue = szBuffer;

    //Set the Registry Entry for this Key
        if(FAILED(hr = SetRegEntry(&rgRegInfo[i])))
      goto CLEANUP;
  }

CLEANUP:
    return hr;
}

STDAPI DllUnregisterServer ( void )

Definition at line 256 of file myclassfactory.cpp.

{
    int     iNumErrors = 0;

    // Delete all table entries.  Loop in reverse order, since they
    // are entered in a basic-to-complex order.
    // We cannot delete a key that has subkeys.
    // Ignore errors.
    for (int i=NUMELEM(rgRegInfo)-1; i>=0; i--)
    {
    if(FAILED(DelRegEntry(&rgRegInfo[i])))
      iNumErrors++;
  }

    return iNumErrors ? E_FAIL : S_OK;
}

Variable Documentation

const GUID CLSID_ospsampc = {0x1e79b2c1,0x77b,0x11d1,{0xb3,0xae,0x0,0xaa,0x0,0xc1,0xa9,0x24}}

Definition at line 20 of file myclassfactory.cpp.

DWORD g_cAttachedProcesses = 0L

Definition at line 28 of file myclassfactory.cpp.

LONG g_cLock = 0L

Definition at line 27 of file myclassfactory.cpp.

LONG g_cObj = 0L

Definition at line 26 of file myclassfactory.cpp.

HINSTANCE g_hInstance = NULL

Definition at line 29 of file myclassfactory.cpp.

REGENTRY rgRegInfo[]
Initial value:
{

    { HKEY_CLASSES_ROOT, "ospsampc",      NULL, "Microsoft Sample OLE DB Simple Provider DLL (C++)"             },

    { HKEY_CLASSES_ROOT, "ospsampc\\Clsid",   NULL, "{1E79B2C1-077B-11d1-B3AE-00AA00C1A924}"                  },
    { HKEY_CLASSES_ROOT, "CLSID\\{1E79B2C1-077B-11d1-B3AE-00AA00C1A924}",             NULL,       "ospsampc"  },
    { HKEY_CLASSES_ROOT, "CLSID\\{1E79B2C1-077B-11d1-B3AE-00AA00C1A924}\\ProgID",         NULL,       "ospsampc"  },
    { HKEY_CLASSES_ROOT, "CLSID\\{1E79B2C1-077B-11d1-B3AE-00AA00C1A924}\\VersionIndependentProgID", NULL,       "ospsampc"  },
    { HKEY_CLASSES_ROOT, "CLSID\\{1E79B2C1-077B-11d1-B3AE-00AA00C1A924}\\InprocServer32",     "ThreadingModel", "Both"    },
    { HKEY_CLASSES_ROOT, "CLSID\\{1E79B2C1-077B-11d1-B3AE-00AA00C1A924}\\InprocServer32",     NULL,       "%s"    },
}

Definition at line 32 of file myclassfactory.cpp.

Generated on Wed Nov 13 2024 16:53:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/osp/vc/myclassfactory.h File Reference

  • Dataaccess
  • osp
  • vc
Classes

myclassfactory.h File Reference

#include "MyDataSource.h"

Go to the source code of this file.

Classes

class MyClassFactory
Generated on Wed Nov 13 2024 16:53:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/osp/vc/mydatasource.cpp File Reference

  • Dataaccess
  • osp
  • vc

mydatasource.cpp File Reference

#include "Common.h"
#include "MyDataSource.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/osp/vc/mydatasource.h File Reference

  • Dataaccess
  • osp
  • vc
Classes

mydatasource.h File Reference

#include "msdaosp.h"
#include "MyOSPObject.h"
#include "CExList.h"

Go to the source code of this file.

Classes

class MyDataSource
.register ( clsid=81C75D38-790A-11D2-8A61-0060088F441E, typelib=81C75D37-790A-11D2-8A61-0060088F441E ) More...
Generated on Wed Nov 13 2024 16:53:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/osp/vc/myospobject.cpp File Reference

  • Dataaccess
  • osp
  • vc

myospobject.cpp File Reference

#include "Common.h"
#include "MyOSPObject.h"
#include <fstream.h>
#include <stdio.h>
#include <tchar.h>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/osp/vc/myospobject.h File Reference

  • Dataaccess
  • osp
  • vc
Classes | Defines | Enumerations

myospobject.h File Reference

#include "msdaosp.h"
#include "CExList.h"

Go to the source code of this file.

Classes

class | MyOSPObject

Defines

#define | MAX_INPUT_BUFFER 2048
#define | MAX_OUTPUT_BUFFER 4096
#define | MAX_WIDE_BUFFER 4096

Enumerations

enum EOSPEVENTS {
CHANGECELL_ABOUTTODO, CHANGECELL_DIDEVENT, DELETEROWS_ABOUTTODO, DELETEROWS_DIDEVENT,
INSERTROWS_ABOUTTODO, INSERTROWS_DIDEVENT, ROWSAVAILABLE_DIDEVENT, TRANSFERCOMPLETE_DIDEVENT,
TRANSFERCOMPLETE_FAILEDTODO
}

Define Documentation

#define MAX_INPUT_BUFFER 2048

Definition at line 25 of file myospobject.h.

#define MAX_OUTPUT_BUFFER 4096

Definition at line 26 of file myospobject.h.

#define MAX_WIDE_BUFFER 4096

Definition at line 27 of file myospobject.h.

Enumeration Type Documentation

enum EOSPEVENTS
Enumerator:
CHANGECELL_ABOUTTODO
CHANGECELL_DIDEVENT
DELETEROWS_ABOUTTODO
DELETEROWS_DIDEVENT
INSERTROWS_ABOUTTODO
INSERTROWS_DIDEVENT
ROWSAVAILABLE_DIDEVENT
TRANSFERCOMPLETE_DIDEVENT
TRANSFERCOMPLETE_FAILEDTODO

Definition at line 29 of file myospobject.h.

{
  //Change notifcations
  CHANGECELL_ABOUTTODO,
  CHANGECELL_DIDEVENT,
  DELETEROWS_ABOUTTODO,
  DELETEROWS_DIDEVENT,
  INSERTROWS_ABOUTTODO,
  INSERTROWS_DIDEVENT,

  //Asynch Notifications
  ROWSAVAILABLE_DIDEVENT,
  TRANSFERCOMPLETE_DIDEVENT,
  TRANSFERCOMPLETE_FAILEDTODO,
};

Generated on Wed Nov 13 2024 16:53:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/osp/vj/mydatasource.java File Reference

  • Dataaccess
  • osp
  • vj
Classes

mydatasource.java File Reference

Go to the source code of this file.

Classes

class MyDataSource
.register ( clsid=81C75D38-790A-11D2-8A61-0060088F441E, typelib=81C75D37-790A-11D2-8A61-0060088F441E ) More...
Generated on Wed Nov 13 2024 16:53:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/osp/vj/myospobject.java File Reference

  • Dataaccess
  • osp
  • vj
Classes

myospobject.java File Reference

Go to the source code of this file.

Classes

class MyOSPObject
Generated on Wed Nov 13 2024 16:53:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/rds/ADOVBS.inc File Reference

  • Dataaccess
  • rds

ADOVBS.inc File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/rds/handler/vc/adoid.h File Reference

  • Dataaccess
  • rds
  • handler
  • vc
Defines | Functions

adoid.h File Reference

Go to the source code of this file.

Defines

#define | ADO_MAJOR 2
#define | DEFINE_DAOGUID(name, l) DEFINE_GUID(name, l, 0, 0x10, 0x80,0,0,0xAA,0,0x6D,0x2E,0xA4)

Functions

DEFINE_DAOGUID (LIBID_CADO10, 0x00000200)
DEFINE_DAOGUID (IID_EnumMarshalOptions, 0x00000540)
DEFINE_DAOGUID (IID_EnumSchema, 0x00000533)
DEFINE_DAOGUID (IID_EnumObjectState, 0x00000532)
DEFINE_DAOGUID (IID_EnumEventReason, 0x00000531)
DEFINE_DAOGUID (IID_EnumEventStatus, 0x00000530)
DEFINE_DAOGUID (IID_EnumCursorLocation, 0x0000052F)
DEFINE_DAOGUID (IID_EnumCommandType, 0x0000052E)
DEFINE_DAOGUID (IID_EnumFilterCriteria, 0x0000052D)
DEFINE_DAOGUID (IID_EnumParameterDirection, 0x0000052C)
DEFINE_DAOGUID (IID_EnumParameterAttributes, 0x0000052B)
DEFINE_DAOGUID (IID_EnumErrorValue, 0x0000052A)
DEFINE_DAOGUID (IID_EnumPropertyAttributes, 0x00000529)
DEFINE_DAOGUID (IID_EnumPosition, 0x00000528)
DEFINE_DAOGUID (IID_EnumRecordStatus, 0x00000527)
DEFINE_DAOGUID (IID_EnumEditMode, 0x00000526)
DEFINE_DAOGUID (IID_EnumFieldAttribute, 0x00000525)
DEFINE_DAOGUID (IID_EnumXactAttribute, 0x00000524)
DEFINE_DAOGUID (IID_EnumIsolationLevel, 0x00000523)
DEFINE_DAOGUID (IID_EnumPrepareOption, 0x00000522)
DEFINE_DAOGUID (IID_EnumConnectMode, 0x00000521)
DEFINE_DAOGUID (IID_EnumConnectPrompt, 0x00000520)
DEFINE_DAOGUID (IID_EnumDataType, 0x0000051F)
DEFINE_DAOGUID (IID_EnumExecuteOption, 0x0000051E)
DEFINE_DAOGUID (IID_EnumLockType, 0x0000051D)
DEFINE_DAOGUID (IID_EnumCursorOption, 0x0000051C)
DEFINE_DAOGUID (IID_EnumCursorType, 0x0000051B)
DEFINE_DAOGUID (IID_IADOConnections, 0x00000518)
DEFINE_DAOGUID (IID_IADOConnection, 0x00000515)
DEFINE_DAOGUID (CLSID_CADOConnection, 0x00000514)
DEFINE_DAOGUID (IID_IADODynaCollection, 0x00000513)
DEFINE_DAOGUID (IID_IADOCollection, 0x00000512)
DEFINE_DAOGUID (IID_IADORecordsetConstruction, 0x00000283)
DEFINE_DAOGUID (IID_IADORecordsets, 0x0000050F)
DEFINE_DAOGUID (IID_IADORecordset, 0x0000050E)
DEFINE_DAOGUID (CLSID_CADORecordset, 0x00000535)
DEFINE_DAOGUID (IID_IADOParameters, 0x0000050D)
DEFINE_DAOGUID (IID_IADOParameter, 0x0000050C)
DEFINE_DAOGUID (CLSID_CADOParameter, 0x0000050B)
DEFINE_DAOGUID (IID_IADOCommands, 0x00000509)
DEFINE_DAOGUID (IID_IADOCommand, 0x00000508)
DEFINE_DAOGUID (CLSID_CADOCommand, 0x00000507)
DEFINE_DAOGUID (IID_IADOFields, 0x00000506)
DEFINE_DAOGUID (IID_IADOField, 0x00000505)
DEFINE_DAOGUID (IID_IADOProperties, 0x00000504)
DEFINE_DAOGUID (IID_IADOProperty, 0x00000503)
DEFINE_DAOGUID (IID_IADOErrors, 0x00000501)
DEFINE_DAOGUID (IID_IADOError, 0x00000500)
DEFINE_DAOGUID (LIBID_CADOR10, 0x00000300)

Define Documentation

#define ADO_MAJOR 2

Definition at line 24 of file adoid.h.

#define DEFINE_DAOGUID | ( | name,
 |  | l |
 | ) |  | DEFINE_GUID(name, l, 0, 0x10, 0x80,0,0,0xAA,0,0x6D,0x2E,0xA4)

Definition at line 20 of file adoid.h.

Function Documentation

DEFINE_DAOGUID | ( | LIBID_CADO10 | ,
 |  | 0x00000200 |
 | ) |  |
DEFINE_DAOGUID | ( | IID_EnumMarshalOptions | ,
 |  | 0x00000540 |
 | ) |  |
DEFINE_DAOGUID | ( | IID_EnumSchema | ,
 |  | 0x00000533 |
 | ) |  |
DEFINE_DAOGUID | ( | IID_EnumObjectState | ,
 |  | 0x00000532 |
 | ) |  |
DEFINE_DAOGUID | ( | IID_EnumEventReason | ,
 |  | 0x00000531 |
 | ) |  |
DEFINE_DAOGUID | ( | IID_EnumEventStatus | ,
 |  | 0x00000530 |
 | ) |  |
DEFINE_DAOGUID | ( | IID_EnumCursorLocation | ,
 |  | 0x0000052F |
 | ) |  |
DEFINE_DAOGUID | ( | IID_EnumCommandType | ,
 |  | 0x0000052E |
 | ) |  |
DEFINE_DAOGUID | ( | IID_EnumFilterCriteria | ,
 |  | 0x0000052D |
 | ) |  |
DEFINE_DAOGUID | ( | IID_EnumParameterDirection | ,
 |  | 0x0000052C |
 | ) |  |
DEFINE_DAOGUID | ( | IID_EnumParameterAttributes | ,
 |  | 0x0000052B |
 | ) |  |
DEFINE_DAOGUID | ( | IID_EnumErrorValue | ,
 |  | 0x0000052A |
 | ) |  |
DEFINE_DAOGUID | ( | IID_EnumPropertyAttributes | ,
 |  | 0x00000529 |
 | ) |  |
DEFINE_DAOGUID | ( | IID_EnumPosition | ,
 |  | 0x00000528 |
 | ) |  |
DEFINE_DAOGUID | ( | IID_EnumRecordStatus | ,
 |  | 0x00000527 |
 | ) |  |
DEFINE_DAOGUID | ( | IID_EnumEditMode | ,
 |  | 0x00000526 |
 | ) |  |
DEFINE_DAOGUID | ( | IID_EnumFieldAttribute | ,
 |  | 0x00000525 |
 | ) |  |
DEFINE_DAOGUID | ( | IID_EnumXactAttribute | ,
 |  | 0x00000524 |
 | ) |  |
DEFINE_DAOGUID | ( | IID_EnumIsolationLevel | ,
 |  | 0x00000523 |
 | ) |  |
DEFINE_DAOGUID | ( | IID_EnumPrepareOption | ,
 |  | 0x00000522 |
 | ) |  |
DEFINE_DAOGUID | ( | IID_EnumConnectMode | ,
 |  | 0x00000521 |
 | ) |  |
DEFINE_DAOGUID | ( | IID_EnumConnectPrompt | ,
 |  | 0x00000520 |
 | ) |  |
DEFINE_DAOGUID | ( | IID_EnumDataType | ,
 |  | 0x0000051F |
 | ) |  |
DEFINE_DAOGUID | ( | IID_EnumExecuteOption | ,
 |  | 0x0000051E |
 | ) |  |
DEFINE_DAOGUID | ( | IID_EnumLockType | ,
 |  | 0x0000051D |
 | ) |  |
DEFINE_DAOGUID | ( | IID_EnumCursorOption | ,
 |  | 0x0000051C |
 | ) |  |
DEFINE_DAOGUID | ( | IID_EnumCursorType | ,
 |  | 0x0000051B |
 | ) |  |
DEFINE_DAOGUID | ( | IID_IADOConnections | ,
 |  | 0x00000518 |
 | ) |  |
DEFINE_DAOGUID | ( | IID_IADOConnection | ,
 |  | 0x00000515 |
 | ) |  |
DEFINE_DAOGUID | ( | CLSID_CADOConnection | ,
 |  | 0x00000514 |
 | ) |  |
DEFINE_DAOGUID | ( | IID_IADODynaCollection | ,
 |  | 0x00000513 |
 | ) |  |
DEFINE_DAOGUID | ( | IID_IADOCollection | ,
 |  | 0x00000512 |
 | ) |  |
DEFINE_DAOGUID | ( | IID_IADORecordsetConstruction | ,
 |  | 0x00000283 |
 | ) |  |
DEFINE_DAOGUID | ( | IID_IADORecordsets | ,
 |  | 0x0000050F |
 | ) |  |
DEFINE_DAOGUID | ( | IID_IADORecordset | ,
 |  | 0x0000050E |
 | ) |  |
DEFINE_DAOGUID | ( | CLSID_CADORecordset | ,
 |  | 0x00000535 |
 | ) |  |
DEFINE_DAOGUID | ( | IID_IADOParameters | ,
 |  | 0x0000050D |
 | ) |  |
DEFINE_DAOGUID | ( | IID_IADOParameter | ,
 |  | 0x0000050C |
 | ) |  |
DEFINE_DAOGUID | ( | CLSID_CADOParameter | ,
 |  | 0x0000050B |
 | ) |  |
DEFINE_DAOGUID | ( | IID_IADOCommands | ,
 |  | 0x00000509 |
 | ) |  |
DEFINE_DAOGUID | ( | IID_IADOCommand | ,
 |  | 0x00000508 |
 | ) |  |
DEFINE_DAOGUID | ( | CLSID_CADOCommand | ,
 |  | 0x00000507 |
 | ) |  |
DEFINE_DAOGUID | ( | IID_IADOFields | ,
 |  | 0x00000506 |
 | ) |  |
DEFINE_DAOGUID | ( | IID_IADOField | ,
 |  | 0x00000505 |
 | ) |  |
DEFINE_DAOGUID | ( | IID_IADOProperties | ,
 |  | 0x00000504 |
 | ) |  |
DEFINE_DAOGUID | ( | IID_IADOProperty | ,
 |  | 0x00000503 |
 | ) |  |
DEFINE_DAOGUID | ( | IID_IADOErrors | ,
 |  | 0x00000501 |
 | ) |  |
DEFINE_DAOGUID | ( | IID_IADOError | ,
 |  | 0x00000500 |
 | ) |  |
DEFINE_DAOGUID | ( | LIBID_CADOR10 | ,
 |  | 0x00000300 |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/rds/handler/vc/adoint.h File Reference

  • Dataaccess
  • rds
  • handler
  • vc
Classes | Defines | Typedefs | Enumerations | Functions | Variables

adoint.h File Reference

#include <tchar.h>
#include "rpc.h"
#include "rpcndr.h"

Go to the source code of this file.

Classes

struct | _ADOCollectionVtbl
struct | _ADODynaCollectionVtbl
struct | _ADOVtbl
struct | _CommandVtbl
struct | _ConnectionVtbl
struct | _ParameterVtbl
struct | _RecordsetVtbl
struct | ADOConnectionConstructionVtbl
struct | ADORecordsetConstructionVtbl
struct | ErrorsVtbl
struct | ErrorVtbl
struct | FieldsVtbl
struct | FieldVtbl
struct | ParametersVtbl
struct | PropertiesVtbl
struct | PropertyVtbl

Defines

#define | ___ADO_FWD_DEFINED__
#define | ___ADO_INTERFACE_DEFINED__
#define | ___ADOCollection_FWD_DEFINED__
#define | ___ADOCollection_INTERFACE_DEFINED__
#define | ___ADODynaCollection_FWD_DEFINED__
#define | ___ADODynaCollection_INTERFACE_DEFINED__
#define | ___Command_FWD_DEFINED__
#define | ___Command_INTERFACE_DEFINED__
#define | ___Connection_FWD_DEFINED__
#define | ___Connection_INTERFACE_DEFINED__
#define | ___Parameter_FWD_DEFINED__
#define | ___Parameter_INTERFACE_DEFINED__
#define | ___Recordset_FWD_DEFINED__
#define | ___Recordset_INTERFACE_DEFINED__
#define | __ADOConnectionConstruction_FWD_DEFINED__
#define | __ADOConnectionConstruction_INTERFACE_DEFINED__
#define | __ADODB_LIBRARY_DEFINED__
#define | __ADORecordsetConstruction_FWD_DEFINED__
#define | __ADORecordsetConstruction_INTERFACE_DEFINED__
#define | __Command_FWD_DEFINED__
#define | __Connection_FWD_DEFINED__
#define | __Error_FWD_DEFINED__
#define | __Error_INTERFACE_DEFINED__
#define | __Errors_FWD_DEFINED__
#define | __Errors_INTERFACE_DEFINED__
#define | __Field_FWD_DEFINED__
#define | __Field_INTERFACE_DEFINED__
#define | __Fields_FWD_DEFINED__
#define | __Fields_INTERFACE_DEFINED__
#define | __m_bobj_h__
#define | __Parameter_FWD_DEFINED__
#define | __Parameters_FWD_DEFINED__
#define | __Parameters_INTERFACE_DEFINED__
#define | __Properties_FWD_DEFINED__
#define | __Properties_INTERFACE_DEFINED__
#define | __Property_FWD_DEFINED__
#define | __Property_INTERFACE_DEFINED__
#define | __Recordset_FWD_DEFINED__
#define | ADOCollection _ADOCollection
#define | ADOCommand _ADOCommand
#define | ADOConnection _ADOConnection
#define | ADODynaCollection _ADODynaCollection
#define | ADOParameter _ADOParameter
#define | ADORecordset _ADORecordset
#define | DECLSPEC_UUID(x)

Typedefs

typedef interface _ADO | _ADO
typedef interface _ADOCollection | _ADOCollection
typedef struct _ADOCollectionVtbl | _ADOCollectionVtbl
typedef interface
_ADODynaCollection 		_ADODynaCollection
typedef struct
_ADODynaCollectionVtbl 		_ADODynaCollectionVtbl
typedef struct _ADOVtbl | _ADOVtbl
typedef interface _ADOCommand | _Command
typedef struct _CommandVtbl | _CommandVtbl
typedef interface _ADOConnection | _Connection
typedef struct _ConnectionVtbl | _ConnectionVtbl
typedef interface _ADOParameter | _Parameter
typedef struct _ParameterVtbl | _ParameterVtbl
typedef interface _ADORecordset | _Recordset
typedef struct _RecordsetVtbl | _RecordsetVtbl
typedef interface
ADOConnectionConstruction 		ADOConnectionConstruction
typedef struct
ADOConnectionConstructionVtbl 		ADOConnectionConstructionVtbl
typedef interface
ADORecordsetConstruction 		ADORecordsetConstruction
typedef struct
ADORecordsetConstructionVtbl 		ADORecordsetConstructionVtbl
typedef enum AffectEnum | AffectEnum
typedef enum BookmarkEnum | BookmarkEnum
typedef struct ADOCommand | Command
typedef enum CommandTypeEnum | CommandTypeEnum
typedef struct ADOConnection | Connection
typedef enum ConnectModeEnum | ConnectModeEnum
typedef enum ConnectPromptEnum | ConnectPromptEnum
typedef enum CursorLocationEnum | CursorLocationEnum
typedef enum CursorOptionEnum | CursorOptionEnum
typedef enum CursorTypeEnum | CursorTypeEnum
typedef enum DataTypeEnum | DataTypeEnum
typedef enum EditModeEnum | EditModeEnum
typedef interface ADOError | Error
typedef interface ADOErrors | Errors
typedef struct ErrorsVtbl | ErrorsVtbl
typedef enum ErrorValueEnum | ErrorValueEnum
typedef struct ErrorVtbl | ErrorVtbl
typedef enum ExecuteOptionEnum | ExecuteOptionEnum
typedef interface ADOField | Field
typedef enum FieldAttributeEnum | FieldAttributeEnum
typedef interface ADOFields | Fields
typedef struct FieldsVtbl | FieldsVtbl
typedef struct FieldVtbl | FieldVtbl
typedef enum FilterGroupEnum | FilterGroupEnum
typedef enum GetRowsOptionEnum | GetRowsOptionEnum
typedef enum IsolationLevelEnum | IsolationLevelEnum
typedef enum LockTypeEnum | LockTypeEnum
typedef enum MarshalOptionsEnum | MarshalOptionsEnum
typedef enum ObjectStateEnum | ObjectStateEnum
typedef struct ADOParameter | Parameter
typedef enum
ParameterAttributesEnum 		ParameterAttributesEnum
typedef enum ParameterDirectionEnum | ParameterDirectionEnum
typedef interface ADOParameters | Parameters
typedef struct ParametersVtbl | ParametersVtbl
typedef enum PositionEnum | PositionEnum
typedef interface ADOProperties | Properties
typedef struct PropertiesVtbl | PropertiesVtbl
typedef interface ADOProperty | Property
typedef enum PropertyAttributesEnum | PropertyAttributesEnum
typedef struct PropertyVtbl | PropertyVtbl
typedef struct ADORecordset | Recordset
typedef enum RecordStatusEnum | RecordStatusEnum
typedef enum SchemaEnum | SchemaEnum
typedef enum SearchDirection | SearchDirectionEnum
typedef enum XactAttributeEnum | XactAttributeEnum

Enumerations

enum | AffectEnum { adAffectCurrent = 1, adAffectGroup = 2, adAffectAll = 3 }
enum | BookmarkEnum { adBookmarkCurrent = 0, adBookmarkFirst = 1, adBookmarkLast = 2 }
enum CommandTypeEnum {
adCmdUnspecified = -1, adCmdUnknown = 0x8, adCmdText = 0x1, adCmdTable = 0x2,
adCmdStoredProc = 0x4
}
enum ConnectModeEnum {
adModeUnknown = 0, adModeRead = 1, adModeWrite = 2, adModeReadWrite = 3,
adModeShareDenyRead = 4, adModeShareDenyWrite = 8, adModeShareExclusive = 0xc, adModeShareDenyNone = 0x10
}
enum | ConnectPromptEnum { adPromptAlways = 1, adPromptComplete = 2, adPromptCompleteRequired = 3, adPromptNever = 4 }
enum | CursorLocationEnum { adUseNone = 1, adUseServer = 2, adUseClient = 3, adUseClientBatch = 3 }
enum CursorOptionEnum {
adHoldRecords = 0x100, adMovePrevious = 0x200, adAddNew = 0x1000400, adDelete = 0x1000800,
adUpdate = 0x1008000, adBookmark = 0x2000, adApproxPosition = 0x4000, adUpdateBatch = 0x10000,
adResync = 0x20000, adNotify = 0x40000
}
enum CursorTypeEnum {
adOpenUnspecified = -1, adOpenForwardOnly = 0, adOpenKeyset = 1, adOpenDynamic = 2,
adOpenStatic = 3
}
enum DataTypeEnum {
adEmpty = 0, adTinyInt = 16, adSmallInt = 2, adInteger = 3,
adBigInt = 20, adUnsignedTinyInt = 17, adUnsignedSmallInt = 18, adUnsignedInt = 19,
adUnsignedBigInt = 21, adSingle = 4, adDouble = 5, adCurrency = 6,
adDecimal = 14, adNumeric = 131, adBoolean = 11, adError = 10,
adUserDefined = 132, adVariant = 12, adIDispatch = 9, adIUnknown = 13,
adGUID = 72, adDate = 7, adDBDate = 133, adDBTime = 134,
adDBTimeStamp = 135, adBSTR = 8, adChar = 129, adVarChar = 200,
adLongVarChar = 201, adWChar = 130, adVarWChar = 202, adLongVarWChar = 203,
adBinary = 128, adVarBinary = 204, adLongVarBinary = 205
}
enum | EditModeEnum { adEditNone = 0, adEditInProgress = 0x1, adEditAdd = 0x2 }
enum ErrorValueEnum {
adErrInvalidArgument = MAKE_HRESULT(SEVERITY_ERROR, FACILITY_CONTROL, 0xbb9), adErrNoCurrentRecord = MAKE_HRESULT(SEVERITY_ERROR, FACILITY_CONTROL, 0xbcd), adErrIllegalOperation = MAKE_HRESULT(SEVERITY_ERROR, FACILITY_CONTROL, 0xc93), adErrInTransaction = MAKE_HRESULT(SEVERITY_ERROR, FACILITY_CONTROL, 0xcae),
adErrFeatureNotAvailable = MAKE_HRESULT(SEVERITY_ERROR, FACILITY_CONTROL, 0xcb3), adErrItemNotFound = MAKE_HRESULT(SEVERITY_ERROR, FACILITY_CONTROL, 0xcc1), adErrObjectInADOCollection = MAKE_HRESULT(SEVERITY_ERROR, FACILITY_CONTROL, 0xd27), adErrObjectNotSet = MAKE_HRESULT(SEVERITY_ERROR, FACILITY_CONTROL, 0xd5c),
adErrDataConversion = MAKE_HRESULT(SEVERITY_ERROR, FACILITY_CONTROL, 0xd5d), adErrObjectClosed = MAKE_HRESULT(SEVERITY_ERROR, FACILITY_CONTROL, 0xe78), adErrObjectOpen = 0xe79, adErrProviderNotFound = MAKE_HRESULT(SEVERITY_ERROR, FACILITY_CONTROL, 0xe7a),
adErrBoundToCommand = MAKE_HRESULT(SEVERITY_ERROR, FACILITY_CONTROL, 0xe7b), adErrInvalidParamInfo = MAKE_HRESULT(SEVERITY_ERROR, FACILITY_CONTROL, 0xe7c), adErrInvalidConnection = MAKE_HRESULT(SEVERITY_ERROR, FACILITY_CONTROL, 0xe7d), adErrStillExecuting = MAKE_HRESULT(SEVERITY_ERROR, FACILITY_CONTROL, 0xe7f),
adErrStillConnecting = MAKE_HRESULT(SEVERITY_ERROR, FACILITY_CONTROL, 0xe81)
}
enum | ExecuteOptionEnum { adOptionUnspecified = -1, adRunAsync = 0x10 }
enum FieldAttributeEnum {
adFldMayDefer = 0x2, adFldUpdatable = 0x4, adFldUnknownUpdatable = 0x8, adFldFixed = 0x10,
adFldIsNullable = 0x20, adFldMayBeNull = 0x40, adFldLong = 0x80, adFldRowID = 0x100,
adFldRowVersion = 0x200, adFldCacheDeferred = 0x1000
}
enum FilterGroupEnum {
adFilterNone = 0, adFilterPendingRecords = 1, adFilterAffectedRecords = 2, adFilterFetchedRecords = 3,
adFilterPredicate = 4
}
enum | GetRowsOptionEnum { adGetRowsRest = -1 }
enum IsolationLevelEnum {
adXactUnspecified = 0xffffffff, adXactChaos = 0x10, adXactReadUncommitted = 0x100, adXactBrowse = 0x100,
adXactCursorStability = 0x1000, adXactReadCommitted = 0x1000, adXactRepeatableRead = 0x10000, adXactSerializable = 0x100000,
adXactIsolated = 0x100000
}
enum LockTypeEnum {
adLockUnspecified = -1, adLockReadOnly = 1, adLockPessimistic = 2, adLockOptimistic = 3,
adLockBatchOptimistic = 4
}
enum | MarshalOptionsEnum { adMarshalAll = 0, adMarshalModifiedOnly = 1 }
enum | ObjectStateEnum { adStateClosed = 0, adStateOpen = 0x1, adStateConnecting = 0x2, adStateExecuting = 0x4 }
enum | ParameterAttributesEnum { adParamSigned = 0x10, adParamNullable = 0x40, adParamLong = 0x80 }
enum ParameterDirectionEnum {
adParamUnknown = 0, adParamInput = 0x1, adParamOutput = 0x2, adParamInputOutput = 0x3,
adParamReturnValue = 0x4
}
enum | PositionEnum { adPosUnknown = -1, adPosBOF = -2, adPosEOF = -3 }
enum PropertyAttributesEnum {
adPropNotSupported = 0, adPropRequired = 0x1, adPropOptional = 0x2, adPropRead = 0x200,
adPropWrite = 0x400
}
enum RecordStatusEnum {
adRecOK = 0, adRecNew = 0x1, adRecModified = 0x2, adRecDeleted = 0x4,
adRecUnmodified = 0x8, adRecInvalid = 0x10, adRecMultipleChanges = 0x40, adRecPendingChanges = 0x80,
adRecCanceled = 0x100, adRecCantRelease = 0x400, adRecConcurrencyViolation = 0x800, adRecIntegrityViolation = 0x1000,
adRecMaxChangesExceeded = 0x2000, adRecObjectOpen = 0x4000, adRecOutOfMemory = 0x8000, adRecPermissionDenied = 0x10000,
adRecSchemaViolation = 0x20000, adRecDBDeleted = 0x40000
}
enum SchemaEnum {
adSchemaProviderSpecific = -1, adSchemaAsserts = 0, adSchemaCatalogs = 1, adSchemaCharacterSets = 2,
adSchemaCollations = 3, adSchemaColumns = 4, adSchemaCheckConstraints = 5, adSchemaConstraintColumnUsage = 6,
adSchemaConstraintTableUsage = 7, adSchemaKeyColumnUsage = 8, adSchemaReferentialContraints = 9, adSchemaTableConstraints = 10,
adSchemaColumnsDomainUsage = 11, adSchemaIndexes = 12, adSchemaColumnPrivileges = 13, adSchemaTablePrivileges = 14,
adSchemaUsagePrivileges = 15, adSchemaProcedures = 16, adSchemaSchemata = 17, adSchemaSQLLanguages = 18,
adSchemaStatistics = 19, adSchemaTables = 20, adSchemaTranslations = 21, adSchemaProviderTypes = 22,
adSchemaViews = 23, adSchemaViewColumnUsage = 24, adSchemaViewTableUsage = 25, adSchemaProcedureParameters = 26,
adSchemaForeignKeys = 27, adSchemaPrimaryKeys = 28, adSchemaProcedureColumns = 29
}
enum | SearchDirection { adSearchForward = 0, adSearchBackward = 1 }
enum | XactAttributeEnum { adXactCommitRetaining = 0x20000, adXactAbortRetaining = 0x40000 }

Functions

HRESULT STDMETHODCALLTYPE | _ADO_get_Properties_Proxy (_ADO __RPC_FAR *This, ADOProperties __RPC_FAR *__RPC_FAR *ppvObject)
void __RPC_STUB | _ADO_get_Properties_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _ADOCollection__NewEnum_Proxy (_ADOCollection __RPC_FAR *This, IUnknown __RPC_FAR *__RPC_FAR *ppvObject)
void __RPC_STUB | _ADOCollection__NewEnum_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _ADOCollection_Refresh_Proxy (_ADOCollection __RPC_FAR *This)
void __RPC_STUB | _ADOCollection_Refresh_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _ADODynaCollection_Append_Proxy (_ADODynaCollection __RPC_FAR *This, IDispatch __RPC_FAR *Object)
void __RPC_STUB | _ADODynaCollection_Append_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _ADODynaCollection_Delete_Proxy (_ADODynaCollection __RPC_FAR *This, VARIANT Index)
void __RPC_STUB | _ADODynaCollection_Delete_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Collection_get_Count_Proxy (_ADOCollection __RPC_FAR *This, long __RPC_FAR *c)
void __RPC_STUB | _Collection_get_Count_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Command_Cancel_Proxy (_ADOCommand __RPC_FAR *This)
void __RPC_STUB | _Command_Cancel_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Command_CreateParameter_Proxy (_ADOCommand __RPC_FAR *This, BSTR Name, DataTypeEnum Type, ParameterDirectionEnum Direction, long Size, VARIANT Value, _ADOParameter __RPC_FAR *__RPC_FAR *ppiprm)
void __RPC_STUB | _Command_CreateParameter_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Command_Execute_Proxy (_ADOCommand __RPC_FAR *This, VARIANT __RPC_FAR *RecordsAffected, VARIANT __RPC_FAR *Parameters, long Options, _ADORecordset __RPC_FAR *__RPC_FAR *ppirs)
void __RPC_STUB | _Command_Execute_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Command_get_ActiveConnection_Proxy (_ADOCommand __RPC_FAR *This, _ADOConnection __RPC_FAR *__RPC_FAR *ppvObject)
void __RPC_STUB | _Command_get_ActiveConnection_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Command_get_CommandText_Proxy (_ADOCommand __RPC_FAR *This, BSTR __RPC_FAR *pbstr)
void __RPC_STUB | _Command_get_CommandText_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Command_get_CommandTimeout_Proxy (_ADOCommand __RPC_FAR *This, LONG __RPC_FAR *pl)
void __RPC_STUB | _Command_get_CommandTimeout_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Command_get_CommandType_Proxy (_ADOCommand __RPC_FAR *This, CommandTypeEnum __RPC_FAR *plCmdType)
void __RPC_STUB | _Command_get_CommandType_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Command_get_Name_Proxy (_ADOCommand __RPC_FAR *This, BSTR __RPC_FAR *pbstrName)
void __RPC_STUB | _Command_get_Name_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Command_get_Parameters_Proxy (_ADOCommand __RPC_FAR *This, ADOParameters __RPC_FAR *__RPC_FAR *ppvObject)
void __RPC_STUB | _Command_get_Parameters_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Command_get_Prepared_Proxy (_ADOCommand __RPC_FAR *This, VARIANT_BOOL __RPC_FAR *pfPrepared)
void __RPC_STUB | _Command_get_Prepared_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Command_get_State_Proxy (_ADOCommand __RPC_FAR *This, LONG __RPC_FAR *plObjState)
void __RPC_STUB | _Command_get_State_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Command_put_ActiveConnection_Proxy (_ADOCommand __RPC_FAR *This, VARIANT vConn)
void __RPC_STUB | _Command_put_ActiveConnection_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Command_put_CommandText_Proxy (_ADOCommand __RPC_FAR *This, BSTR bstr)
void __RPC_STUB | _Command_put_CommandText_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Command_put_CommandTimeout_Proxy (_ADOCommand __RPC_FAR *This, LONG Timeout)
void __RPC_STUB | _Command_put_CommandTimeout_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Command_put_CommandType_Proxy (_ADOCommand __RPC_FAR *This, CommandTypeEnum lCmdType)
void __RPC_STUB | _Command_put_CommandType_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Command_put_Name_Proxy (_ADOCommand __RPC_FAR *This, BSTR bstrName)
void __RPC_STUB | _Command_put_Name_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Command_put_Prepared_Proxy (_ADOCommand __RPC_FAR *This, VARIANT_BOOL fPrepared)
void __RPC_STUB | _Command_put_Prepared_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Command_putref_ActiveConnection_Proxy (_ADOCommand __RPC_FAR *This, _ADOConnection __RPC_FAR *pCon)
void __RPC_STUB | _Command_putref_ActiveConnection_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Connection_BeginTrans_Proxy (_ADOConnection __RPC_FAR *This, long __RPC_FAR *TransactionLevel)
void __RPC_STUB | _Connection_BeginTrans_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Connection_Cancel_Proxy (_ADOConnection __RPC_FAR *This)
void __RPC_STUB | _Connection_Cancel_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Connection_Close_Proxy (_ADOConnection __RPC_FAR *This)
void __RPC_STUB | _Connection_Close_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Connection_CommitTrans_Proxy (_ADOConnection __RPC_FAR *This)
void __RPC_STUB | _Connection_CommitTrans_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Connection_Execute_Proxy (_ADOConnection __RPC_FAR *This, BSTR CommandText, VARIANT __RPC_FAR *RecordsAffected, long Options, _ADORecordset __RPC_FAR *__RPC_FAR *ppiRset)
void __RPC_STUB | _Connection_Execute_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Connection_get_Attributes_Proxy (_ADOConnection __RPC_FAR *This, long __RPC_FAR *plAttr)
void __RPC_STUB | _Connection_get_Attributes_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Connection_get_CommandTimeout_Proxy (_ADOConnection __RPC_FAR *This, LONG __RPC_FAR *plTimeout)
void __RPC_STUB | _Connection_get_CommandTimeout_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Connection_get_ConnectionString_Proxy (_ADOConnection __RPC_FAR *This, BSTR __RPC_FAR *pbstr)
void __RPC_STUB | _Connection_get_ConnectionString_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Connection_get_ConnectionTimeout_Proxy (_ADOConnection __RPC_FAR *This, LONG __RPC_FAR *plTimeout)
void __RPC_STUB | _Connection_get_ConnectionTimeout_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Connection_get_CursorLocation_Proxy (_ADOConnection __RPC_FAR *This, CursorLocationEnum __RPC_FAR *plCursorLoc)
void __RPC_STUB | _Connection_get_CursorLocation_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Connection_get_DefaultDatabase_Proxy (_ADOConnection __RPC_FAR *This, BSTR __RPC_FAR *pbstr)
void __RPC_STUB | _Connection_get_DefaultDatabase_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Connection_get_Errors_Proxy (_ADOConnection __RPC_FAR *This, ADOErrors __RPC_FAR *__RPC_FAR *ppvObject)
void __RPC_STUB | _Connection_get_Errors_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Connection_get_IsolationLevel_Proxy (_ADOConnection __RPC_FAR *This, IsolationLevelEnum __RPC_FAR *Level)
void __RPC_STUB | _Connection_get_IsolationLevel_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Connection_get_Mode_Proxy (_ADOConnection __RPC_FAR *This, ConnectModeEnum __RPC_FAR *plMode)
void __RPC_STUB | _Connection_get_Mode_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Connection_get_Provider_Proxy (_ADOConnection __RPC_FAR *This, BSTR __RPC_FAR *pbstr)
void __RPC_STUB | _Connection_get_Provider_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Connection_get_State_Proxy (_ADOConnection __RPC_FAR *This, LONG __RPC_FAR *plObjState)
void __RPC_STUB | _Connection_get_State_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Connection_get_Version_Proxy (_ADOConnection __RPC_FAR *This, BSTR __RPC_FAR *pbstr)
void __RPC_STUB | _Connection_get_Version_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Connection_Open_Proxy (_ADOConnection __RPC_FAR *This, BSTR ConnectionString, BSTR UserID, BSTR Password, long Options)
void __RPC_STUB | _Connection_Open_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Connection_OpenSchema_Proxy (_ADOConnection __RPC_FAR *This, SchemaEnum Schema, VARIANT Restrictions, VARIANT SchemaID, _ADORecordset __RPC_FAR *__RPC_FAR *pprset)
void __RPC_STUB | _Connection_OpenSchema_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Connection_put_Attributes_Proxy (_ADOConnection __RPC_FAR *This, long lAttr)
void __RPC_STUB | _Connection_put_Attributes_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Connection_put_CommandTimeout_Proxy (_ADOConnection __RPC_FAR *This, LONG lTimeout)
void __RPC_STUB | _Connection_put_CommandTimeout_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Connection_put_ConnectionString_Proxy (_ADOConnection __RPC_FAR *This, BSTR bstr)
void __RPC_STUB | _Connection_put_ConnectionString_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Connection_put_ConnectionTimeout_Proxy (_ADOConnection __RPC_FAR *This, LONG lTimeout)
void __RPC_STUB | _Connection_put_ConnectionTimeout_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Connection_put_CursorLocation_Proxy (_ADOConnection __RPC_FAR *This, CursorLocationEnum lCursorLoc)
void __RPC_STUB | _Connection_put_CursorLocation_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Connection_put_DefaultDatabase_Proxy (_ADOConnection __RPC_FAR *This, BSTR bstr)
void __RPC_STUB | _Connection_put_DefaultDatabase_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Connection_put_IsolationLevel_Proxy (_ADOConnection __RPC_FAR *This, IsolationLevelEnum Level)
void __RPC_STUB | _Connection_put_IsolationLevel_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Connection_put_Mode_Proxy (_ADOConnection __RPC_FAR *This, ConnectModeEnum lMode)
void __RPC_STUB | _Connection_put_Mode_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Connection_put_Provider_Proxy (_ADOConnection __RPC_FAR *This, BSTR Provider)
void __RPC_STUB | _Connection_put_Provider_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Connection_RollbackTrans_Proxy (_ADOConnection __RPC_FAR *This)
void __RPC_STUB | _Connection_RollbackTrans_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Parameter_AppendChunk_Proxy (_ADOParameter __RPC_FAR *This, VARIANT Val)
void __RPC_STUB | _Parameter_AppendChunk_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Parameter_get_Attributes_Proxy (_ADOParameter __RPC_FAR *This, LONG __RPC_FAR *plParmAttribs)
void __RPC_STUB | _Parameter_get_Attributes_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Parameter_get_Direction_Proxy (_ADOParameter __RPC_FAR *This, ParameterDirectionEnum __RPC_FAR *plParmDirection)
void __RPC_STUB | _Parameter_get_Direction_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Parameter_get_Name_Proxy (_ADOParameter __RPC_FAR *This, BSTR __RPC_FAR *pbstr)
void __RPC_STUB | _Parameter_get_Name_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Parameter_get_NumericScale_Proxy (_ADOParameter __RPC_FAR *This, BYTE __RPC_FAR *pbScale)
void __RPC_STUB | _Parameter_get_NumericScale_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Parameter_get_Precision_Proxy (_ADOParameter __RPC_FAR *This, BYTE __RPC_FAR *pbPrecision)
void __RPC_STUB | _Parameter_get_Precision_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Parameter_get_Size_Proxy (_ADOParameter __RPC_FAR *This, long __RPC_FAR *pl)
void __RPC_STUB | _Parameter_get_Size_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Parameter_get_Type_Proxy (_ADOParameter __RPC_FAR *This, DataTypeEnum __RPC_FAR *psDataType)
void __RPC_STUB | _Parameter_get_Type_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Parameter_get_Value_Proxy (_ADOParameter __RPC_FAR *This, VARIANT __RPC_FAR *pvar)
void __RPC_STUB | _Parameter_get_Value_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Parameter_put_Attributes_Proxy (_ADOParameter __RPC_FAR *This, LONG lParmAttribs)
void __RPC_STUB | _Parameter_put_Attributes_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Parameter_put_Direction_Proxy (_ADOParameter __RPC_FAR *This, ParameterDirectionEnum lParmDirection)
void __RPC_STUB | _Parameter_put_Direction_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Parameter_put_Name_Proxy (_ADOParameter __RPC_FAR *This, BSTR bstr)
void __RPC_STUB | _Parameter_put_Name_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Parameter_put_NumericScale_Proxy (_ADOParameter __RPC_FAR *This, BYTE bScale)
void __RPC_STUB | _Parameter_put_NumericScale_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Parameter_put_Precision_Proxy (_ADOParameter __RPC_FAR *This, BYTE bPrecision)
void __RPC_STUB | _Parameter_put_Precision_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Parameter_put_Size_Proxy (_ADOParameter __RPC_FAR *This, long l)
void __RPC_STUB | _Parameter_put_Size_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Parameter_put_Type_Proxy (_ADOParameter __RPC_FAR *This, DataTypeEnum sDataType)
void __RPC_STUB | _Parameter_put_Type_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Parameter_put_Value_Proxy (_ADOParameter __RPC_FAR *This, VARIANT val)
void __RPC_STUB | _Parameter_put_Value_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_AddNew_Proxy (_ADORecordset __RPC_FAR *This, VARIANT FieldList, VARIANT Values)
void __RPC_STUB | _Recordset_AddNew_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_Cancel_Proxy (_ADORecordset __RPC_FAR *This)
void __RPC_STUB | _Recordset_Cancel_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_CancelBatch_Proxy (_ADORecordset __RPC_FAR *This, AffectEnum AffectRecords)
void __RPC_STUB | _Recordset_CancelBatch_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_CancelUpdate_Proxy (_ADORecordset __RPC_FAR *This)
void __RPC_STUB | _Recordset_CancelUpdate_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_Clone_Proxy (_ADORecordset __RPC_FAR *This, _ADORecordset __RPC_FAR *__RPC_FAR *ppvObject)
void __RPC_STUB | _Recordset_Clone_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_Close_Proxy (_ADORecordset __RPC_FAR *This)
void __RPC_STUB | _Recordset_Close_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_Delete_Proxy (_ADORecordset __RPC_FAR *This, AffectEnum AffectRecords)
void __RPC_STUB | _Recordset_Delete_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_Find_Proxy (_ADORecordset __RPC_FAR *This, BSTR Criteria, VARIANT_BOOL SkipCurrent, SearchDirectionEnum SearchDirection, VARIANT Start)
void __RPC_STUB | _Recordset_Find_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_get_AbsolutePage_Proxy (_ADORecordset __RPC_FAR *This, PositionEnum __RPC_FAR *pl)
void __RPC_STUB | _Recordset_get_AbsolutePage_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_get_AbsolutePosition_Proxy (_ADORecordset __RPC_FAR *This, PositionEnum __RPC_FAR *pl)
void __RPC_STUB | _Recordset_get_AbsolutePosition_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_get_ActiveConnection_Proxy (_ADORecordset __RPC_FAR *This, VARIANT __RPC_FAR *pvar)
void __RPC_STUB | _Recordset_get_ActiveConnection_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_get_BOF_Proxy (_ADORecordset __RPC_FAR *This, VARIANT_BOOL __RPC_FAR *pb)
void __RPC_STUB | _Recordset_get_BOF_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_get_Bookmark_Proxy (_ADORecordset __RPC_FAR *This, VARIANT __RPC_FAR *pvBookmark)
void __RPC_STUB | _Recordset_get_Bookmark_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_get_CacheSize_Proxy (_ADORecordset __RPC_FAR *This, long __RPC_FAR *pl)
void __RPC_STUB | _Recordset_get_CacheSize_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_get_Collect_Proxy (_ADORecordset __RPC_FAR *This, VARIANT Index, VARIANT __RPC_FAR *pvar)
void __RPC_STUB | _Recordset_get_Collect_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_get_CursorLocation_Proxy (_ADORecordset __RPC_FAR *This, CursorLocationEnum __RPC_FAR *plCursorLoc)
void __RPC_STUB | _Recordset_get_CursorLocation_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_get_CursorType_Proxy (_ADORecordset __RPC_FAR *This, CursorTypeEnum __RPC_FAR *plCursorType)
void __RPC_STUB | _Recordset_get_CursorType_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_get_EditMode_Proxy (_ADORecordset __RPC_FAR *This, EditModeEnum __RPC_FAR *pl)
void __RPC_STUB | _Recordset_get_EditMode_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_get_EOF_Proxy (_ADORecordset __RPC_FAR *This, VARIANT_BOOL __RPC_FAR *pb)
void __RPC_STUB | _Recordset_get_EOF_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_get_Fields_Proxy (_ADORecordset __RPC_FAR *This, ADOFields __RPC_FAR *__RPC_FAR *ppvObject)
void __RPC_STUB | _Recordset_get_Fields_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_get_Filter_Proxy (_ADORecordset __RPC_FAR *This, VARIANT __RPC_FAR *Criteria)
void __RPC_STUB | _Recordset_get_Filter_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_get_LockType_Proxy (_ADORecordset __RPC_FAR *This, LockTypeEnum __RPC_FAR *plLockType)
void __RPC_STUB | _Recordset_get_LockType_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_get_MarshalOptions_Proxy (_ADORecordset __RPC_FAR *This, MarshalOptionsEnum __RPC_FAR *peMarshal)
void __RPC_STUB | _Recordset_get_MarshalOptions_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_get_MaxRecords_Proxy (_ADORecordset __RPC_FAR *This, long __RPC_FAR *plMaxRecords)
void __RPC_STUB | _Recordset_get_MaxRecords_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_get_PageCount_Proxy (_ADORecordset __RPC_FAR *This, long __RPC_FAR *pl)
void __RPC_STUB | _Recordset_get_PageCount_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_get_PageSize_Proxy (_ADORecordset __RPC_FAR *This, long __RPC_FAR *pl)
void __RPC_STUB | _Recordset_get_PageSize_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_get_RecordCount_Proxy (_ADORecordset __RPC_FAR *This, long __RPC_FAR *pl)
void __RPC_STUB | _Recordset_get_RecordCount_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_get_Sort_Proxy (_ADORecordset __RPC_FAR *This, BSTR __RPC_FAR *Criteria)
void __RPC_STUB | _Recordset_get_Sort_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_get_Source_Proxy (_ADORecordset __RPC_FAR *This, VARIANT __RPC_FAR *pvSource)
void __RPC_STUB | _Recordset_get_Source_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_get_State_Proxy (_ADORecordset __RPC_FAR *This, LONG __RPC_FAR *plObjState)
void __RPC_STUB | _Recordset_get_State_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_get_Status_Proxy (_ADORecordset __RPC_FAR *This, long __RPC_FAR *pl)
void __RPC_STUB | _Recordset_get_Status_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_GetRows_Proxy (_ADORecordset __RPC_FAR *This, long Rows, VARIANT Start, VARIANT Fields, VARIANT __RPC_FAR *pvar)
void __RPC_STUB | _Recordset_GetRows_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_Move_Proxy (_ADORecordset __RPC_FAR *This, long NumRecords, VARIANT Start)
void __RPC_STUB | _Recordset_Move_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_MoveFirst_Proxy (_ADORecordset __RPC_FAR *This)
void __RPC_STUB | _Recordset_MoveFirst_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_MoveLast_Proxy (_ADORecordset __RPC_FAR *This)
void __RPC_STUB | _Recordset_MoveLast_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_MoveNext_Proxy (_ADORecordset __RPC_FAR *This)
void __RPC_STUB | _Recordset_MoveNext_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_MovePrevious_Proxy (_ADORecordset __RPC_FAR *This)
void __RPC_STUB | _Recordset_MovePrevious_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_NextRecordset_Proxy (_ADORecordset __RPC_FAR *This, VARIANT __RPC_FAR *RecordsAffected, _ADORecordset __RPC_FAR *__RPC_FAR *ppiRs)
void __RPC_STUB | _Recordset_NextRecordset_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_Open_Proxy (_ADORecordset __RPC_FAR *This, VARIANT Source, VARIANT ActiveConnection, CursorTypeEnum CursorType, LockTypeEnum LockType, LONG Options)
void __RPC_STUB | _Recordset_Open_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_put_AbsolutePage_Proxy (_ADORecordset __RPC_FAR *This, PositionEnum Page)
void __RPC_STUB | _Recordset_put_AbsolutePage_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_put_AbsolutePosition_Proxy (_ADORecordset __RPC_FAR *This, PositionEnum Position)
void __RPC_STUB | _Recordset_put_AbsolutePosition_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_put_ActiveConnection_Proxy (_ADORecordset __RPC_FAR *This, VARIANT vConn)
void __RPC_STUB | _Recordset_put_ActiveConnection_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_put_Bookmark_Proxy (_ADORecordset __RPC_FAR *This, VARIANT vBookmark)
void __RPC_STUB | _Recordset_put_Bookmark_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_put_CacheSize_Proxy (_ADORecordset __RPC_FAR *This, long CacheSize)
void __RPC_STUB | _Recordset_put_CacheSize_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_put_Collect_Proxy (_ADORecordset __RPC_FAR *This, VARIANT Index, VARIANT value)
void __RPC_STUB | _Recordset_put_Collect_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_put_CursorLocation_Proxy (_ADORecordset __RPC_FAR *This, CursorLocationEnum lCursorLoc)
void __RPC_STUB | _Recordset_put_CursorLocation_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_put_CursorType_Proxy (_ADORecordset __RPC_FAR *This, CursorTypeEnum lCursorType)
void __RPC_STUB | _Recordset_put_CursorType_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_put_Filter_Proxy (_ADORecordset __RPC_FAR *This, VARIANT Criteria)
void __RPC_STUB | _Recordset_put_Filter_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_put_LockType_Proxy (_ADORecordset __RPC_FAR *This, LockTypeEnum lLockType)
void __RPC_STUB | _Recordset_put_LockType_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_put_MarshalOptions_Proxy (_ADORecordset __RPC_FAR *This, MarshalOptionsEnum eMarshal)
void __RPC_STUB | _Recordset_put_MarshalOptions_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_put_MaxRecords_Proxy (_ADORecordset __RPC_FAR *This, long lMaxRecords)
void __RPC_STUB | _Recordset_put_MaxRecords_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_put_PageSize_Proxy (_ADORecordset __RPC_FAR *This, long PageSize)
void __RPC_STUB | _Recordset_put_PageSize_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_put_Sort_Proxy (_ADORecordset __RPC_FAR *This, BSTR Criteria)
void __RPC_STUB | _Recordset_put_Sort_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_put_Source_Proxy (_ADORecordset __RPC_FAR *This, BSTR bstrConn)
void __RPC_STUB | _Recordset_put_Source_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_putref_ActiveConnection_Proxy (_ADORecordset __RPC_FAR *This, IDispatch __RPC_FAR *pconn)
void __RPC_STUB | _Recordset_putref_ActiveConnection_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_putref_Source_Proxy (_ADORecordset __RPC_FAR *This, IDispatch __RPC_FAR *pcmd)
void __RPC_STUB | _Recordset_putref_Source_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_Requery_Proxy (_ADORecordset __RPC_FAR *This, LONG Options)
void __RPC_STUB | _Recordset_Requery_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_Resync_Proxy (_ADORecordset __RPC_FAR *This, AffectEnum AffectRecords)
void __RPC_STUB | _Recordset_Resync_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_Supports_Proxy (_ADORecordset __RPC_FAR *This, CursorOptionEnum CursorOptions, VARIANT_BOOL __RPC_FAR *pb)
void __RPC_STUB | _Recordset_Supports_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_Update_Proxy (_ADORecordset __RPC_FAR *This, VARIANT Fields, VARIANT Values)
void __RPC_STUB | _Recordset_Update_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | _Recordset_UpdateBatch_Proxy (_ADORecordset __RPC_FAR *This, AffectEnum AffectRecords)
void __RPC_STUB | _Recordset_UpdateBatch_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ADOConnectionConstruction_get_DSO_Proxy (ADOConnectionConstruction __RPC_FAR *This, IUnknown __RPC_FAR *__RPC_FAR *ppDSO)
void __RPC_STUB | ADOConnectionConstruction_get_DSO_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ADOConnectionConstruction_get_Session_Proxy (ADOConnectionConstruction __RPC_FAR *This, IUnknown __RPC_FAR *__RPC_FAR *ppSession)
void __RPC_STUB | ADOConnectionConstruction_get_Session_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ADORecordsetConstruction_get_Chapter_Proxy (ADORecordsetConstruction __RPC_FAR *This, LONG __RPC_FAR *plChapter)
void __RPC_STUB | ADORecordsetConstruction_get_Chapter_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ADORecordsetConstruction_get_RowPosition_Proxy (ADORecordsetConstruction __RPC_FAR *This, IUnknown __RPC_FAR *__RPC_FAR *ppRowPos)
void __RPC_STUB | ADORecordsetConstruction_get_RowPosition_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ADORecordsetConstruction_get_Rowset_Proxy (ADORecordsetConstruction __RPC_FAR *This, IUnknown __RPC_FAR *__RPC_FAR *ppRowset)
void __RPC_STUB | ADORecordsetConstruction_get_Rowset_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ADORecordsetConstruction_put_Chapter_Proxy (ADORecordsetConstruction __RPC_FAR *This, LONG lChapter)
void __RPC_STUB | ADORecordsetConstruction_put_Chapter_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ADORecordsetConstruction_put_RowPosition_Proxy (ADORecordsetConstruction __RPC_FAR *This, IUnknown __RPC_FAR *pRowPos)
void __RPC_STUB | ADORecordsetConstruction_put_RowPosition_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | ADORecordsetConstruction_put_Rowset_Proxy (ADORecordsetConstruction __RPC_FAR *This, IUnknown __RPC_FAR *pRowset)
void __RPC_STUB | ADORecordsetConstruction_put_Rowset_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | Error_get_Description_Proxy (ADOError __RPC_FAR *This, BSTR __RPC_FAR *pbstr)
void __RPC_STUB | Error_get_Description_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | Error_get_HelpContext_Proxy (ADOError __RPC_FAR *This, long __RPC_FAR *pl)
void __RPC_STUB | Error_get_HelpContext_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | Error_get_HelpFile_Proxy (ADOError __RPC_FAR *This, BSTR __RPC_FAR *pbstr)
void __RPC_STUB | Error_get_HelpFile_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | Error_get_NativeError_Proxy (ADOError __RPC_FAR *This, long __RPC_FAR *pl)
void __RPC_STUB | Error_get_NativeError_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | Error_get_Number_Proxy (ADOError __RPC_FAR *This, long __RPC_FAR *pl)
void __RPC_STUB | Error_get_Number_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | Error_get_Source_Proxy (ADOError __RPC_FAR *This, BSTR __RPC_FAR *pbstr)
void __RPC_STUB | Error_get_Source_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | Error_get_SQLState_Proxy (ADOError __RPC_FAR *This, BSTR __RPC_FAR *pbstr)
void __RPC_STUB | Error_get_SQLState_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | Errors_Clear_Proxy (ADOErrors __RPC_FAR *This)
void __RPC_STUB | Errors_Clear_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | Errors_get_Item_Proxy (ADOErrors __RPC_FAR *This, VARIANT Index, ADOError __RPC_FAR *__RPC_FAR *ppvObject)
void __RPC_STUB | Errors_get_Item_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | Field_AppendChunk_Proxy (ADOField __RPC_FAR *This, VARIANT Data)
void __RPC_STUB | Field_AppendChunk_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | Field_get_ActualSize_Proxy (ADOField __RPC_FAR *This, long __RPC_FAR *pl)
void __RPC_STUB | Field_get_ActualSize_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | Field_get_Attributes_Proxy (ADOField __RPC_FAR *This, long __RPC_FAR *pl)
void __RPC_STUB | Field_get_Attributes_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | Field_get_DefinedSize_Proxy (ADOField __RPC_FAR *This, long __RPC_FAR *pl)
void __RPC_STUB | Field_get_DefinedSize_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | Field_get_Name_Proxy (ADOField __RPC_FAR *This, BSTR __RPC_FAR *pbstr)
void __RPC_STUB | Field_get_Name_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | Field_get_NumericScale_Proxy (ADOField __RPC_FAR *This, BYTE __RPC_FAR *pbNumericScale)
void __RPC_STUB | Field_get_NumericScale_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | Field_get_OriginalValue_Proxy (ADOField __RPC_FAR *This, VARIANT __RPC_FAR *pvar)
void __RPC_STUB | Field_get_OriginalValue_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | Field_get_Precision_Proxy (ADOField __RPC_FAR *This, BYTE __RPC_FAR *pbPrecision)
void __RPC_STUB | Field_get_Precision_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | Field_get_Type_Proxy (ADOField __RPC_FAR *This, DataTypeEnum __RPC_FAR *pDataType)
void __RPC_STUB | Field_get_Type_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | Field_get_UnderlyingValue_Proxy (ADOField __RPC_FAR *This, VARIANT __RPC_FAR *pvar)
void __RPC_STUB | Field_get_UnderlyingValue_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | Field_get_Value_Proxy (ADOField __RPC_FAR *This, VARIANT __RPC_FAR *pvar)
void __RPC_STUB | Field_get_Value_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | Field_GetChunk_Proxy (ADOField __RPC_FAR *This, long Length, VARIANT __RPC_FAR *pvar)
void __RPC_STUB | Field_GetChunk_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | Field_put_Value_Proxy (ADOField __RPC_FAR *This, VARIANT Val)
void __RPC_STUB | Field_put_Value_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | Fields_get_Item_Proxy (ADOFields __RPC_FAR *This, VARIANT Index, ADOField __RPC_FAR *__RPC_FAR *ppvObject)
void __RPC_STUB | Fields_get_Item_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
void __RPC_FAR *__RPC_USER | MIDL_user_allocate (size_t)
void __RPC_USER | MIDL_user_free (void __RPC_FAR *)
HRESULT STDMETHODCALLTYPE | Parameters_get_Item_Proxy (ADOParameters __RPC_FAR *This, VARIANT Index, _ADOParameter __RPC_FAR *__RPC_FAR *ppvObject)
void __RPC_STUB | Parameters_get_Item_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | Properties_get_Item_Proxy (ADOProperties __RPC_FAR *This, VARIANT Index, ADOProperty __RPC_FAR *__RPC_FAR *ppvObject)
void __RPC_STUB | Properties_get_Item_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | Property_get_Attributes_Proxy (ADOProperty __RPC_FAR *This, long __RPC_FAR *plAttributes)
void __RPC_STUB | Property_get_Attributes_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | Property_get_Name_Proxy (ADOProperty __RPC_FAR *This, BSTR __RPC_FAR *pbstr)
void __RPC_STUB | Property_get_Name_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | Property_get_Type_Proxy (ADOProperty __RPC_FAR *This, DataTypeEnum __RPC_FAR *ptype)
void __RPC_STUB | Property_get_Type_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | Property_get_Value_Proxy (ADOProperty __RPC_FAR *This, VARIANT __RPC_FAR *pval)
void __RPC_STUB | Property_get_Value_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | Property_put_Attributes_Proxy (ADOProperty __RPC_FAR *This, long lAttributes)
void __RPC_STUB | Property_put_Attributes_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | Property_put_Value_Proxy (ADOProperty __RPC_FAR *This, VARIANT val)
void __RPC_STUB | Property_put_Value_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)

Variables

RPC_IF_HANDLE | __MIDL_itf_m_bobj_0000_v0_0_c_ifspec
RPC_IF_HANDLE | __MIDL_itf_m_bobj_0000_v0_0_s_ifspec
EXTERN_C const IID | IID__ADO
EXTERN_C const IID | IID__ADOCollection
EXTERN_C const IID | IID__ADODynaCollection
EXTERN_C const IID | IID__Command
EXTERN_C const IID | IID__Connection
EXTERN_C const IID | IID__Parameter
EXTERN_C const IID | IID__Recordset
EXTERN_C const IID | IID_ADOConnectionConstruction
EXTERN_C const IID | IID_ADORecordsetConstruction
EXTERN_C const IID | IID_Error
EXTERN_C const IID | IID_Errors
EXTERN_C const IID | IID_Field
EXTERN_C const IID | IID_Fields
EXTERN_C const IID | IID_Parameters
EXTERN_C const IID | IID_Properties
EXTERN_C const IID | IID_Property
EXTERN_C const IID | LIBID_ADODB
interface _ADOCollection
CONST_VTBL struct
_ADOCollectionVtbl __RPC_FAR * 		lpVtbl

Define Documentation

#define ___ADO_FWD_DEFINED__

Definition at line 53 of file adoint.h.

#define ___ADO_INTERFACE_DEFINED__

Definition at line 718 of file adoint.h.

#define ___ADOCollection_FWD_DEFINED__

Definition at line 45 of file adoint.h.

#define ___ADOCollection_INTERFACE_DEFINED__

Definition at line 445 of file adoint.h.

#define ___ADODynaCollection_FWD_DEFINED__

Definition at line 49 of file adoint.h.

#define ___ADODynaCollection_INTERFACE_DEFINED__

Definition at line 580 of file adoint.h.

#define ___Command_FWD_DEFINED__

Definition at line 65 of file adoint.h.

#define ___Command_INTERFACE_DEFINED__

Definition at line 1166 of file adoint.h.

#define ___Connection_FWD_DEFINED__

Definition at line 69 of file adoint.h.

#define ___Connection_INTERFACE_DEFINED__

Definition at line 1586 of file adoint.h.

#define ___Parameter_FWD_DEFINED__

Definition at line 117 of file adoint.h.

#define ___Parameter_INTERFACE_DEFINED__

Definition at line 4073 of file adoint.h.

#define ___Recordset_FWD_DEFINED__

Definition at line 93 of file adoint.h.

#define ___Recordset_INTERFACE_DEFINED__

Definition at line 2279 of file adoint.h.

#define __ADOConnectionConstruction_FWD_DEFINED__

Definition at line 73 of file adoint.h.

#define __ADOConnectionConstruction_INTERFACE_DEFINED__

Definition at line 2187 of file adoint.h.

#define __ADODB_LIBRARY_DEFINED__

Definition at line 151 of file adoint.h.

#define __ADORecordsetConstruction_FWD_DEFINED__

Definition at line 105 of file adoint.h.

#define __ADORecordsetConstruction_INTERFACE_DEFINED__

Definition at line 3443 of file adoint.h.

#define __Command_FWD_DEFINED__

Definition at line 85 of file adoint.h.

#define __Connection_FWD_DEFINED__

Definition at line 77 of file adoint.h.

#define __Error_FWD_DEFINED__

Definition at line 57 of file adoint.h.

#define __Error_INTERFACE_DEFINED__

Definition at line 822 of file adoint.h.

#define __Errors_FWD_DEFINED__

Definition at line 61 of file adoint.h.

#define __Errors_INTERFACE_DEFINED__

Definition at line 1028 of file adoint.h.

#define __Field_FWD_DEFINED__

Definition at line 109 of file adoint.h.

#define __Field_INTERFACE_DEFINED__

Definition at line 3632 of file adoint.h.

#define __Fields_FWD_DEFINED__

Definition at line 113 of file adoint.h.

#define __Fields_INTERFACE_DEFINED__

Definition at line 3949 of file adoint.h.

#define __m_bobj_h__

Definition at line 39 of file adoint.h.

#define __Parameter_FWD_DEFINED__

Definition at line 121 of file adoint.h.

#define __Parameters_FWD_DEFINED__

Definition at line 129 of file adoint.h.

#define __Parameters_INTERFACE_DEFINED__

Definition at line 4459 of file adoint.h.

#define __Properties_FWD_DEFINED__

Definition at line 137 of file adoint.h.

#define __Properties_INTERFACE_DEFINED__

Definition at line 4784 of file adoint.h.

#define __Property_FWD_DEFINED__

Definition at line 133 of file adoint.h.

#define __Property_INTERFACE_DEFINED__

Definition at line 4595 of file adoint.h.

#define __Recordset_FWD_DEFINED__

Definition at line 97 of file adoint.h.

#define ADOCollection _ADOCollection

Definition at line 4918 of file adoint.h.

#define ADOCommand _ADOCommand

Definition at line 4914 of file adoint.h.

#define ADOConnection _ADOConnection

Definition at line 4917 of file adoint.h.

#define ADODynaCollection _ADODynaCollection

Definition at line 4919 of file adoint.h.

#define ADOParameter _ADOParameter

Definition at line 4916 of file adoint.h.

#define ADORecordset _ADORecordset

Definition at line 4915 of file adoint.h.

#define DECLSPEC_UUID ( x )

Definition at line 23 of file adoint.h.

Typedef Documentation

typedef interface _ADO _ADO

Definition at line 54 of file adoint.h.

typedef interface _ADOCollection _ADOCollection

Definition at line 46 of file adoint.h.

typedef struct _ADOCollectionVtbl _ADOCollectionVtbl
typedef interface _ADODynaCollection _ADODynaCollection

Definition at line 50 of file adoint.h.

typedef struct _ADODynaCollectionVtbl _ADODynaCollectionVtbl
typedef struct _ADOVtbl _ADOVtbl
typedef interface _ADOCommand _Command

Definition at line 66 of file adoint.h.

typedef struct _CommandVtbl _CommandVtbl
typedef interface _ADOConnection _Connection

Definition at line 70 of file adoint.h.

typedef struct _ConnectionVtbl _ConnectionVtbl
typedef interface _ADOParameter _Parameter

Definition at line 118 of file adoint.h.

typedef struct _ParameterVtbl _ParameterVtbl
typedef interface _ADORecordset _Recordset

Definition at line 94 of file adoint.h.

typedef struct _RecordsetVtbl _RecordsetVtbl
typedef interface ADOConnectionConstruction ADOConnectionConstruction

Definition at line 74 of file adoint.h.

typedef struct ADOConnectionConstructionVtbl ADOConnectionConstructionVtbl
typedef interface ADORecordsetConstruction ADORecordsetConstruction

Definition at line 106 of file adoint.h.

typedef struct ADORecordsetConstructionVtbl ADORecordsetConstructionVtbl
typedef enum AffectEnum AffectEnum
typedef enum BookmarkEnum BookmarkEnum
typedef struct ADOCommand Command

Definition at line 89 of file adoint.h.

typedef enum CommandTypeEnum CommandTypeEnum
typedef struct ADOConnection Connection

Definition at line 81 of file adoint.h.

typedef enum ConnectModeEnum ConnectModeEnum
typedef enum ConnectPromptEnum ConnectPromptEnum
typedef enum CursorLocationEnum CursorLocationEnum
typedef enum CursorOptionEnum CursorOptionEnum
typedef enum CursorTypeEnum CursorTypeEnum
typedef enum DataTypeEnum DataTypeEnum
typedef enum EditModeEnum EditModeEnum
void Error

Definition at line 58 of file adoint.h.

typedef interface ADOErrors Errors

Definition at line 62 of file adoint.h.

typedef struct ErrorsVtbl ErrorsVtbl
typedef enum ErrorValueEnum ErrorValueEnum
typedef struct ErrorVtbl ErrorVtbl
typedef enum ExecuteOptionEnum ExecuteOptionEnum
HRESULT Field [get, set]

Definition at line 110 of file adoint.h.

typedef enum FieldAttributeEnum FieldAttributeEnum
typedef interface ADOFields Fields

Definition at line 114 of file adoint.h.

typedef struct FieldsVtbl FieldsVtbl
typedef struct FieldVtbl FieldVtbl
typedef enum FilterGroupEnum FilterGroupEnum
typedef enum GetRowsOptionEnum GetRowsOptionEnum
typedef enum IsolationLevelEnum IsolationLevelEnum
typedef enum LockTypeEnum LockTypeEnum
typedef enum MarshalOptionsEnum MarshalOptionsEnum
typedef enum ObjectStateEnum ObjectStateEnum
typedef struct ADOParameter Parameter

Definition at line 125 of file adoint.h.

typedef enum ParameterAttributesEnum ParameterAttributesEnum
typedef enum ParameterDirectionEnum ParameterDirectionEnum
typedef interface ADOParameters Parameters

Definition at line 130 of file adoint.h.

typedef struct ParametersVtbl ParametersVtbl
typedef enum PositionEnum PositionEnum
typedef interface ADOProperties Properties

Definition at line 138 of file adoint.h.

typedef struct PropertiesVtbl PropertiesVtbl
typedef interface ADOProperty Property

Definition at line 134 of file adoint.h.

typedef enum PropertyAttributesEnum PropertyAttributesEnum
typedef struct PropertyVtbl PropertyVtbl
HRESULT Recordset [set]

Definition at line 101 of file adoint.h.

typedef enum RecordStatusEnum RecordStatusEnum
typedef enum SchemaEnum SchemaEnum
typedef enum SearchDirection SearchDirectionEnum
typedef enum XactAttributeEnum XactAttributeEnum

Enumeration Type Documentation

enum AffectEnum
Enumerator:
adAffectCurrent
adAffectGroup
adAffectAll

Definition at line 305 of file adoint.h.

    { adAffectCurrent = 1,
  adAffectGroup = 2,
  adAffectAll = 3
    } AffectEnum;

enum BookmarkEnum
Enumerator:
adBookmarkCurrent
adBookmarkFirst
adBookmarkLast

Definition at line 294 of file adoint.h.

    { adBookmarkCurrent = 0,
  adBookmarkFirst = 1,
  adBookmarkLast  = 2
    } BookmarkEnum;

enum CommandTypeEnum
Enumerator:
adCmdUnspecified
adCmdUnknown
adCmdText
adCmdTable
adCmdStoredProc

Definition at line 402 of file adoint.h.

    { adCmdUnspecified  = -1,
  adCmdUnknown  = 0x8,
  adCmdText = 0x1,
  adCmdTable  = 0x2,
  adCmdStoredProc = 0x4
    } CommandTypeEnum;

enum ConnectModeEnum
Enumerator:
adModeUnknown
adModeRead
adModeWrite
adModeReadWrite
adModeShareDenyRead
adModeShareDenyWrite
adModeShareExclusive
adModeShareDenyNone

Definition at line 332 of file adoint.h.

    { adModeUnknown = 0,
  adModeRead  = 1,
  adModeWrite = 2,
  adModeReadWrite = 3,
  adModeShareDenyRead = 4,
  adModeShareDenyWrite  = 8,
  adModeShareExclusive  = 0xc,
  adModeShareDenyNone = 0x10
    } ConnectModeEnum;

enum ConnectPromptEnum
Enumerator:
adPromptAlways
adPromptComplete
adPromptCompleteRequired
adPromptNever

Definition at line 325 of file adoint.h.

    { adPromptAlways  = 1,
  adPromptComplete  = 2,
  adPromptCompleteRequired  = 3,
  adPromptNever = 4
    } ConnectPromptEnum;

enum CursorLocationEnum
Enumerator:
adUseNone
adUseServer
adUseClient
adUseClientBatch

Definition at line 200 of file adoint.h.

    { adUseNone = 1,
  adUseServer = 2,
  adUseClient = 3,
  adUseClientBatch  = 3
    } CursorLocationEnum;

enum CursorOptionEnum
Enumerator:
adHoldRecords
adMovePrevious
adAddNew
adDelete
adUpdate
adBookmark
adApproxPosition
adUpdateBatch
adResync
adNotify

Definition at line 167 of file adoint.h.

    { adHoldRecords = 0x100,
  adMovePrevious  = 0x200,
  adAddNew  = 0x1000400,
  adDelete  = 0x1000800,
  adUpdate  = 0x1008000,
  adBookmark  = 0x2000,
  adApproxPosition  = 0x4000,
  adUpdateBatch = 0x10000,
  adResync  = 0x20000,
  adNotify  = 0x40000
    } CursorOptionEnum;

enum CursorTypeEnum
Enumerator:
adOpenUnspecified
adOpenForwardOnly
adOpenKeyset
adOpenDynamic
adOpenStatic

Definition at line 159 of file adoint.h.

    { adOpenUnspecified = -1,
  adOpenForwardOnly = 0,
  adOpenKeyset  = 1,
  adOpenDynamic = 2,
  adOpenStatic  = 3
    } CursorTypeEnum;

enum DataTypeEnum
Enumerator:
adEmpty
adTinyInt
adSmallInt
adInteger
adBigInt
adUnsignedTinyInt
adUnsignedSmallInt
adUnsignedInt
adUnsignedBigInt
adSingle
adDouble
adCurrency
adDecimal
adNumeric
adBoolean
adError
adUserDefined
adVariant
adIDispatch
adIUnknown
adGUID
adDate
adDBDate
adDBTime
adDBTimeStamp
adBSTR
adChar
adVarChar
adLongVarChar
adWChar
adVarWChar
adLongVarWChar
adBinary
adVarBinary
adLongVarBinary

Definition at line 207 of file adoint.h.

    { adEmpty = 0,
  adTinyInt = 16,
  adSmallInt  = 2,
  adInteger = 3,
  adBigInt  = 20,
  adUnsignedTinyInt = 17,
  adUnsignedSmallInt  = 18,
  adUnsignedInt = 19,
  adUnsignedBigInt  = 21,
  adSingle  = 4,
  adDouble  = 5,
  adCurrency  = 6,
  adDecimal = 14,
  adNumeric = 131,
  adBoolean = 11,
  adError = 10,
  adUserDefined = 132,
  adVariant = 12,
  adIDispatch = 9,
  adIUnknown  = 13,
  adGUID  = 72,
  adDate  = 7,
  adDBDate  = 133,
  adDBTime  = 134,
  adDBTimeStamp = 135,
  adBSTR  = 8,
  adChar  = 129,
  adVarChar = 200,
  adLongVarChar = 201,
  adWChar = 130,
  adVarWChar  = 202,
  adLongVarWChar  = 203,
  adBinary  = 128,
  adVarBinary = 204,
  adLongVarBinary = 205
    } DataTypeEnum;

enum EditModeEnum
Enumerator:
adEditNone
adEditInProgress
adEditAdd

Definition at line 258 of file adoint.h.

    { adEditNone  = 0,
  adEditInProgress  = 0x1,
  adEditAdd = 0x2
    } EditModeEnum;

enum ErrorValueEnum
Enumerator:
adErrInvalidArgument
adErrNoCurrentRecord
adErrIllegalOperation
adErrInTransaction
adErrFeatureNotAvailable
adErrItemNotFound
adErrObjectInADOCollection
adErrObjectNotSet
adErrDataConversion
adErrObjectClosed
adErrObjectOpen
adErrProviderNotFound
adErrBoundToCommand
adErrInvalidParamInfo
adErrInvalidConnection
adErrStillExecuting
adErrStillConnecting

Definition at line 368 of file adoint.h.

    { adErrInvalidArgument  =     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_CONTROL, 0xbb9),
  adErrNoCurrentRecord  =     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_CONTROL, 0xbcd),
  adErrIllegalOperation =     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_CONTROL, 0xc93),
  adErrInTransaction  =     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_CONTROL, 0xcae),
  adErrFeatureNotAvailable  =     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_CONTROL, 0xcb3),
  adErrItemNotFound =     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_CONTROL, 0xcc1),
  adErrObjectInADOCollection  =     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_CONTROL, 0xd27),
  adErrObjectNotSet =     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_CONTROL, 0xd5c),
  adErrDataConversion =     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_CONTROL, 0xd5d),
  adErrObjectClosed =     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_CONTROL, 0xe78),
  adErrObjectOpen = 0xe79,
  adErrProviderNotFound =     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_CONTROL, 0xe7a),
  adErrBoundToCommand =     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_CONTROL, 0xe7b),
  adErrInvalidParamInfo =     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_CONTROL, 0xe7c),
  adErrInvalidConnection  =     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_CONTROL, 0xe7d),
  adErrStillExecuting =     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_CONTROL, 0xe7f),
  adErrStillConnecting  =     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_CONTROL, 0xe81),
    } ErrorValueEnum;

enum ExecuteOptionEnum
Enumerator:
adOptionUnspecified
adRunAsync

Definition at line 188 of file adoint.h.

    { adOptionUnspecified = -1,
  adRunAsync  = 0x10
    } ExecuteOptionEnum;

enum FieldAttributeEnum
Enumerator:
adFldMayDefer
adFldUpdatable
adFldUnknownUpdatable
adFldFixed
adFldIsNullable
adFldMayBeNull
adFldLong
adFldRowID
adFldRowVersion
adFldCacheDeferred

Definition at line 245 of file adoint.h.

    { adFldMayDefer = 0x2,
  adFldUpdatable  = 0x4,
  adFldUnknownUpdatable = 0x8,
  adFldFixed  = 0x10,
  adFldIsNullable = 0x20,
  adFldMayBeNull  = 0x40,
  adFldLong = 0x80,
  adFldRowID  = 0x100,
  adFldRowVersion = 0x200,
  adFldCacheDeferred  = 0x1000
    } FieldAttributeEnum;

enum FilterGroupEnum
Enumerator:
adFilterNone
adFilterPendingRecords
adFilterAffectedRecords
adFilterFetchedRecords
adFilterPredicate

Definition at line 311 of file adoint.h.

    { adFilterNone  = 0,
  adFilterPendingRecords  = 1,
  adFilterAffectedRecords = 2,
  adFilterFetchedRecords  = 3,
  adFilterPredicate = 4
    } FilterGroupEnum;

enum GetRowsOptionEnum
Enumerator:
adGetRowsRest

Definition at line 284 of file adoint.h.

    { adGetRowsRest = -1
    } GetRowsOptionEnum;

enum IsolationLevelEnum
Enumerator:
adXactUnspecified
adXactChaos
adXactReadUncommitted
adXactBrowse
adXactCursorStability
adXactReadCommitted
adXactRepeatableRead
adXactSerializable
adXactIsolated

Definition at line 343 of file adoint.h.

    { adXactUnspecified = 0xffffffff,
  adXactChaos = 0x10,
  adXactReadUncommitted = 0x100,
  adXactBrowse  = 0x100,
  adXactCursorStability = 0x1000,
  adXactReadCommitted = 0x1000,
  adXactRepeatableRead  = 0x10000,
  adXactSerializable  = 0x100000,
  adXactIsolated  = 0x100000
    } IsolationLevelEnum;

enum LockTypeEnum
Enumerator:
adLockUnspecified
adLockReadOnly
adLockPessimistic
adLockOptimistic
adLockBatchOptimistic

Definition at line 180 of file adoint.h.

    { adLockUnspecified = -1,
  adLockReadOnly  = 1,
  adLockPessimistic = 2,
  adLockOptimistic  = 3,
  adLockBatchOptimistic = 4
    } LockTypeEnum;

enum MarshalOptionsEnum
Enumerator:
adMarshalAll
adMarshalModifiedOnly

Definition at line 301 of file adoint.h.

    { adMarshalAll  = 0,
  adMarshalModifiedOnly = 1
    } MarshalOptionsEnum;

enum ObjectStateEnum
Enumerator:
adStateClosed
adStateOpen
adStateConnecting
adStateExecuting

Definition at line 193 of file adoint.h.

    { adStateClosed = 0,
  adStateOpen = 0x1,
  adStateConnecting = 0x2,
  adStateExecuting  = 0x4
    } ObjectStateEnum;

enum ParameterAttributesEnum
Enumerator:
adParamSigned
adParamNullable
adParamLong

Definition at line 388 of file adoint.h.

    { adParamSigned = 0x10,
  adParamNullable = 0x40,
  adParamLong = 0x80
    } ParameterAttributesEnum;

enum ParameterDirectionEnum
Enumerator:
adParamUnknown
adParamInput
adParamOutput
adParamInputOutput
adParamReturnValue

Definition at line 394 of file adoint.h.

    { adParamUnknown  = 0,
  adParamInput  = 0x1,
  adParamOutput = 0x2,
  adParamInputOutput  = 0x3,
  adParamReturnValue  = 0x4
    } ParameterDirectionEnum;

enum PositionEnum
Enumerator:
adPosUnknown
adPosBOF
adPosEOF

Definition at line 289 of file adoint.h.

    { adPosUnknown  = -1,
  adPosBOF  = -2,
  adPosEOF  = -3
    } PositionEnum;

enum PropertyAttributesEnum
Enumerator:
adPropNotSupported
adPropRequired
adPropOptional
adPropRead
adPropWrite

Definition at line 360 of file adoint.h.

    { adPropNotSupported  = 0,
  adPropRequired  = 0x1,
  adPropOptional  = 0x2,
  adPropRead  = 0x200,
  adPropWrite = 0x400
    } PropertyAttributesEnum;

enum RecordStatusEnum
Enumerator:
adRecOK
adRecNew
adRecModified
adRecDeleted
adRecUnmodified
adRecInvalid
adRecMultipleChanges
adRecPendingChanges
adRecCanceled
adRecCantRelease
adRecConcurrencyViolation
adRecIntegrityViolation
adRecMaxChangesExceeded
adRecObjectOpen
adRecOutOfMemory
adRecPermissionDenied
adRecSchemaViolation
adRecDBDeleted

Definition at line 264 of file adoint.h.

    { adRecOK = 0,
  adRecNew  = 0x1,
  adRecModified = 0x2,
  adRecDeleted  = 0x4,
  adRecUnmodified = 0x8,
  adRecInvalid  = 0x10,
  adRecMultipleChanges  = 0x40,
  adRecPendingChanges = 0x80,
  adRecCanceled = 0x100,
  adRecCantRelease  = 0x400,
  adRecConcurrencyViolation = 0x800,
  adRecIntegrityViolation = 0x1000,
  adRecMaxChangesExceeded = 0x2000,
  adRecObjectOpen = 0x4000,
  adRecOutOfMemory  = 0x8000,
  adRecPermissionDenied = 0x10000,
  adRecSchemaViolation  = 0x20000,
  adRecDBDeleted  = 0x40000
    } RecordStatusEnum;

enum SchemaEnum
Enumerator:
adSchemaProviderSpecific
adSchemaAsserts
adSchemaCatalogs
adSchemaCharacterSets
adSchemaCollations
adSchemaColumns
adSchemaCheckConstraints
adSchemaConstraintColumnUsage
adSchemaConstraintTableUsage
adSchemaKeyColumnUsage
adSchemaReferentialContraints
adSchemaTableConstraints
adSchemaColumnsDomainUsage
adSchemaIndexes
adSchemaColumnPrivileges
adSchemaTablePrivileges
adSchemaUsagePrivileges
adSchemaProcedures
adSchemaSchemata
adSchemaSQLLanguages
adSchemaStatistics
adSchemaTables
adSchemaTranslations
adSchemaProviderTypes
adSchemaViews
adSchemaViewColumnUsage
adSchemaViewTableUsage
adSchemaProcedureParameters
adSchemaForeignKeys
adSchemaPrimaryKeys
adSchemaProcedureColumns

Definition at line 410 of file adoint.h.

    { adSchemaProviderSpecific  = -1,
  adSchemaAsserts = 0,
  adSchemaCatalogs  = 1,
  adSchemaCharacterSets = 2,
  adSchemaCollations  = 3,
  adSchemaColumns = 4,
  adSchemaCheckConstraints  = 5,
  adSchemaConstraintColumnUsage = 6,
  adSchemaConstraintTableUsage  = 7,
  adSchemaKeyColumnUsage  = 8,
  adSchemaReferentialContraints = 9,
  adSchemaTableConstraints  = 10,
  adSchemaColumnsDomainUsage  = 11,
  adSchemaIndexes = 12,
  adSchemaColumnPrivileges  = 13,
  adSchemaTablePrivileges = 14,
  adSchemaUsagePrivileges = 15,
  adSchemaProcedures  = 16,
  adSchemaSchemata  = 17,
  adSchemaSQLLanguages  = 18,
  adSchemaStatistics  = 19,
  adSchemaTables  = 20,
  adSchemaTranslations  = 21,
  adSchemaProviderTypes = 22,
  adSchemaViews = 23,
  adSchemaViewColumnUsage = 24,
  adSchemaViewTableUsage  = 25,
  adSchemaProcedureParameters = 26,
  adSchemaForeignKeys = 27,
  adSchemaPrimaryKeys = 28,
  adSchemaProcedureColumns  = 29
    } SchemaEnum;

enum SearchDirection
Enumerator:
adSearchForward
adSearchBackward

Definition at line 320 of file adoint.h.

    { adSearchForward = 0,
  adSearchBackward  = 1
    } SearchDirectionEnum;

enum XactAttributeEnum
Enumerator:
adXactCommitRetaining
adXactAbortRetaining

Definition at line 355 of file adoint.h.

    { adXactCommitRetaining = 0x20000,
  adXactAbortRetaining  = 0x40000
    } XactAttributeEnum;

Function Documentation

HRESULT STDMETHODCALLTYPE _ADO_get_Properties_Proxy | ( | _ADO __RPC_FAR * | This,
 |  | ADOProperties __RPC_FAR *__RPC_FAR * | ppvObject
 | ) |  |
void __RPC_STUB _ADO_get_Properties_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _ADOCollection__NewEnum_Proxy | ( | _ADOCollection __RPC_FAR * | This,
 |  | IUnknown __RPC_FAR *__RPC_FAR * | ppvObject
 | ) |  |
void __RPC_STUB _ADOCollection__NewEnum_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _ADOCollection_Refresh_Proxy ( _ADOCollection __RPC_FAR * This )
void __RPC_STUB _ADOCollection_Refresh_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _ADODynaCollection_Append_Proxy | ( | _ADODynaCollection __RPC_FAR * | This,
 |  | IDispatch __RPC_FAR * | Object
 | ) |  |
void __RPC_STUB _ADODynaCollection_Append_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _ADODynaCollection_Delete_Proxy | ( | _ADODynaCollection __RPC_FAR * | This,
 |  | VARIANT | Index
 | ) |  |
void __RPC_STUB _ADODynaCollection_Delete_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Collection_get_Count_Proxy | ( | _ADOCollection __RPC_FAR * | This,
 |  | long __RPC_FAR * | c
 | ) |  |
void __RPC_STUB _Collection_get_Count_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Command_Cancel_Proxy ( _ADOCommand __RPC_FAR * This )
void __RPC_STUB _Command_Cancel_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Command_CreateParameter_Proxy | ( | _ADOCommand __RPC_FAR * | This,
 |  | BSTR | Name,
 |  | DataTypeEnum | Type,
 |  | ParameterDirectionEnum | Direction,
 |  | long | Size,
 |  | VARIANT | Value,
 |  | _ADOParameter __RPC_FAR *__RPC_FAR * | ppiprm
 | ) |  |
void __RPC_STUB _Command_CreateParameter_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Command_Execute_Proxy | ( | _ADOCommand __RPC_FAR * | This,
 |  | VARIANT __RPC_FAR * | RecordsAffected,
 |  | VARIANT __RPC_FAR * | Parameters,
 |  | long | Options,
 |  | _ADORecordset __RPC_FAR *__RPC_FAR * | ppirs
 | ) |  |
void __RPC_STUB _Command_Execute_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Command_get_ActiveConnection_Proxy | ( | _ADOCommand __RPC_FAR * | This,
 |  | _ADOConnection __RPC_FAR *__RPC_FAR * | ppvObject
 | ) |  |
void __RPC_STUB _Command_get_ActiveConnection_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Command_get_CommandText_Proxy | ( | _ADOCommand __RPC_FAR * | This,
 |  | BSTR __RPC_FAR * | pbstr
 | ) |  |
void __RPC_STUB _Command_get_CommandText_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Command_get_CommandTimeout_Proxy | ( | _ADOCommand __RPC_FAR * | This,
 |  | LONG __RPC_FAR * | pl
 | ) |  |
void __RPC_STUB _Command_get_CommandTimeout_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Command_get_CommandType_Proxy | ( | _ADOCommand __RPC_FAR * | This,
 |  | CommandTypeEnum __RPC_FAR * | plCmdType
 | ) |  |
void __RPC_STUB _Command_get_CommandType_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Command_get_Name_Proxy | ( | _ADOCommand __RPC_FAR * | This,
 |  | BSTR __RPC_FAR * | pbstrName
 | ) |  |
void __RPC_STUB _Command_get_Name_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Command_get_Parameters_Proxy | ( | _ADOCommand __RPC_FAR * | This,
 |  | ADOParameters __RPC_FAR *__RPC_FAR * | ppvObject
 | ) |  |
void __RPC_STUB _Command_get_Parameters_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Command_get_Prepared_Proxy | ( | _ADOCommand __RPC_FAR * | This,
 |  | VARIANT_BOOL __RPC_FAR * | pfPrepared
 | ) |  |
void __RPC_STUB _Command_get_Prepared_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Command_get_State_Proxy | ( | _ADOCommand __RPC_FAR * | This,
 |  | LONG __RPC_FAR * | plObjState
 | ) |  |
void __RPC_STUB _Command_get_State_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Command_put_ActiveConnection_Proxy | ( | _ADOCommand __RPC_FAR * | This,
 |  | VARIANT | vConn
 | ) |  |
void __RPC_STUB _Command_put_ActiveConnection_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Command_put_CommandText_Proxy | ( | _ADOCommand __RPC_FAR * | This,
 |  | BSTR | bstr
 | ) |  |
void __RPC_STUB _Command_put_CommandText_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Command_put_CommandTimeout_Proxy | ( | _ADOCommand __RPC_FAR * | This,
 |  | LONG | Timeout
 | ) |  |
void __RPC_STUB _Command_put_CommandTimeout_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Command_put_CommandType_Proxy | ( | _ADOCommand __RPC_FAR * | This,
 |  | CommandTypeEnum | lCmdType
 | ) |  |
void __RPC_STUB _Command_put_CommandType_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Command_put_Name_Proxy | ( | _ADOCommand __RPC_FAR * | This,
 |  | BSTR | bstrName
 | ) |  |
void __RPC_STUB _Command_put_Name_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Command_put_Prepared_Proxy | ( | _ADOCommand __RPC_FAR * | This,
 |  | VARIANT_BOOL | fPrepared
 | ) |  |
void __RPC_STUB _Command_put_Prepared_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Command_putref_ActiveConnection_Proxy | ( | _ADOCommand __RPC_FAR * | This,
 |  | _ADOConnection __RPC_FAR * | pCon
 | ) |  |
void __RPC_STUB _Command_putref_ActiveConnection_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Connection_BeginTrans_Proxy | ( | _ADOConnection __RPC_FAR * | This,
 |  | long __RPC_FAR * | TransactionLevel
 | ) |  |
void __RPC_STUB _Connection_BeginTrans_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Connection_Cancel_Proxy ( _ADOConnection __RPC_FAR * This )
void __RPC_STUB _Connection_Cancel_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Connection_Close_Proxy ( _ADOConnection __RPC_FAR * This )
void __RPC_STUB _Connection_Close_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Connection_CommitTrans_Proxy ( _ADOConnection __RPC_FAR * This )
void __RPC_STUB _Connection_CommitTrans_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Connection_Execute_Proxy | ( | _ADOConnection __RPC_FAR * | This,
 |  | BSTR | CommandText,
 |  | VARIANT __RPC_FAR * | RecordsAffected,
 |  | long | Options,
 |  | _ADORecordset __RPC_FAR *__RPC_FAR * | ppiRset
 | ) |  |
void __RPC_STUB _Connection_Execute_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Connection_get_Attributes_Proxy | ( | _ADOConnection __RPC_FAR * | This,
 |  | long __RPC_FAR * | plAttr
 | ) |  |
void __RPC_STUB _Connection_get_Attributes_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Connection_get_CommandTimeout_Proxy | ( | _ADOConnection __RPC_FAR * | This,
 |  | LONG __RPC_FAR * | plTimeout
 | ) |  |
void __RPC_STUB _Connection_get_CommandTimeout_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Connection_get_ConnectionString_Proxy | ( | _ADOConnection __RPC_FAR * | This,
 |  | BSTR __RPC_FAR * | pbstr
 | ) |  |
void __RPC_STUB _Connection_get_ConnectionString_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Connection_get_ConnectionTimeout_Proxy | ( | _ADOConnection __RPC_FAR * | This,
 |  | LONG __RPC_FAR * | plTimeout
 | ) |  |
void __RPC_STUB _Connection_get_ConnectionTimeout_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Connection_get_CursorLocation_Proxy | ( | _ADOConnection __RPC_FAR * | This,
 |  | CursorLocationEnum __RPC_FAR * | plCursorLoc
 | ) |  |
void __RPC_STUB _Connection_get_CursorLocation_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Connection_get_DefaultDatabase_Proxy | ( | _ADOConnection __RPC_FAR * | This,
 |  | BSTR __RPC_FAR * | pbstr
 | ) |  |
void __RPC_STUB _Connection_get_DefaultDatabase_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Connection_get_Errors_Proxy | ( | _ADOConnection __RPC_FAR * | This,
 |  | ADOErrors __RPC_FAR *__RPC_FAR * | ppvObject
 | ) |  |
void __RPC_STUB _Connection_get_Errors_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Connection_get_IsolationLevel_Proxy | ( | _ADOConnection __RPC_FAR * | This,
 |  | IsolationLevelEnum __RPC_FAR * | Level
 | ) |  |
void __RPC_STUB _Connection_get_IsolationLevel_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Connection_get_Mode_Proxy | ( | _ADOConnection __RPC_FAR * | This,
 |  | ConnectModeEnum __RPC_FAR * | plMode
 | ) |  |
void __RPC_STUB _Connection_get_Mode_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Connection_get_Provider_Proxy | ( | _ADOConnection __RPC_FAR * | This,
 |  | BSTR __RPC_FAR * | pbstr
 | ) |  |
void __RPC_STUB _Connection_get_Provider_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Connection_get_State_Proxy | ( | _ADOConnection __RPC_FAR * | This,
 |  | LONG __RPC_FAR * | plObjState
 | ) |  |
void __RPC_STUB _Connection_get_State_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Connection_get_Version_Proxy | ( | _ADOConnection __RPC_FAR * | This,
 |  | BSTR __RPC_FAR * | pbstr
 | ) |  |
void __RPC_STUB _Connection_get_Version_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Connection_Open_Proxy | ( | _ADOConnection __RPC_FAR * | This,
 |  | BSTR | ConnectionString,
 |  | BSTR | UserID,
 |  | BSTR | Password,
 |  | long | Options
 | ) |  |
void __RPC_STUB _Connection_Open_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Connection_OpenSchema_Proxy | ( | _ADOConnection __RPC_FAR * | This,
 |  | SchemaEnum | Schema,
 |  | VARIANT | Restrictions,
 |  | VARIANT | SchemaID,
 |  | _ADORecordset __RPC_FAR *__RPC_FAR * | pprset
 | ) |  |
void __RPC_STUB _Connection_OpenSchema_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Connection_put_Attributes_Proxy | ( | _ADOConnection __RPC_FAR * | This,
 |  | long | lAttr
 | ) |  |
void __RPC_STUB _Connection_put_Attributes_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Connection_put_CommandTimeout_Proxy | ( | _ADOConnection __RPC_FAR * | This,
 |  | LONG | lTimeout
 | ) |  |
void __RPC_STUB _Connection_put_CommandTimeout_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Connection_put_ConnectionString_Proxy | ( | _ADOConnection __RPC_FAR * | This,
 |  | BSTR | bstr
 | ) |  |
void __RPC_STUB _Connection_put_ConnectionString_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Connection_put_ConnectionTimeout_Proxy | ( | _ADOConnection __RPC_FAR * | This,
 |  | LONG | lTimeout
 | ) |  |
void __RPC_STUB _Connection_put_ConnectionTimeout_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Connection_put_CursorLocation_Proxy | ( | _ADOConnection __RPC_FAR * | This,
 |  | CursorLocationEnum | lCursorLoc
 | ) |  |
void __RPC_STUB _Connection_put_CursorLocation_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Connection_put_DefaultDatabase_Proxy | ( | _ADOConnection __RPC_FAR * | This,
 |  | BSTR | bstr
 | ) |  |
void __RPC_STUB _Connection_put_DefaultDatabase_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Connection_put_IsolationLevel_Proxy | ( | _ADOConnection __RPC_FAR * | This,
 |  | IsolationLevelEnum | Level
 | ) |  |
void __RPC_STUB _Connection_put_IsolationLevel_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Connection_put_Mode_Proxy | ( | _ADOConnection __RPC_FAR * | This,
 |  | ConnectModeEnum | lMode
 | ) |  |
void __RPC_STUB _Connection_put_Mode_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Connection_put_Provider_Proxy | ( | _ADOConnection __RPC_FAR * | This,
 |  | BSTR | Provider
 | ) |  |
void __RPC_STUB _Connection_put_Provider_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Connection_RollbackTrans_Proxy ( _ADOConnection __RPC_FAR * This )
void __RPC_STUB _Connection_RollbackTrans_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Parameter_AppendChunk_Proxy | ( | _ADOParameter __RPC_FAR * | This,
 |  | VARIANT | Val
 | ) |  |
void __RPC_STUB _Parameter_AppendChunk_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Parameter_get_Attributes_Proxy | ( | _ADOParameter __RPC_FAR * | This,
 |  | LONG __RPC_FAR * | plParmAttribs
 | ) |  |
void __RPC_STUB _Parameter_get_Attributes_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Parameter_get_Direction_Proxy | ( | _ADOParameter __RPC_FAR * | This,
 |  | ParameterDirectionEnum __RPC_FAR * | plParmDirection
 | ) |  |
void __RPC_STUB _Parameter_get_Direction_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Parameter_get_Name_Proxy | ( | _ADOParameter __RPC_FAR * | This,
 |  | BSTR __RPC_FAR * | pbstr
 | ) |  |
void __RPC_STUB _Parameter_get_Name_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Parameter_get_NumericScale_Proxy | ( | _ADOParameter __RPC_FAR * | This,
 |  | BYTE __RPC_FAR * | pbScale
 | ) |  |
void __RPC_STUB _Parameter_get_NumericScale_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Parameter_get_Precision_Proxy | ( | _ADOParameter __RPC_FAR * | This,
 |  | BYTE __RPC_FAR * | pbPrecision
 | ) |  |
void __RPC_STUB _Parameter_get_Precision_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Parameter_get_Size_Proxy | ( | _ADOParameter __RPC_FAR * | This,
 |  | long __RPC_FAR * | pl
 | ) |  |
void __RPC_STUB _Parameter_get_Size_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Parameter_get_Type_Proxy | ( | _ADOParameter __RPC_FAR * | This,
 |  | DataTypeEnum __RPC_FAR * | psDataType
 | ) |  |
void __RPC_STUB _Parameter_get_Type_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Parameter_get_Value_Proxy | ( | _ADOParameter __RPC_FAR * | This,
 |  | VARIANT __RPC_FAR * | pvar
 | ) |  |
void __RPC_STUB _Parameter_get_Value_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Parameter_put_Attributes_Proxy | ( | _ADOParameter __RPC_FAR * | This,
 |  | LONG | lParmAttribs
 | ) |  |
void __RPC_STUB _Parameter_put_Attributes_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Parameter_put_Direction_Proxy | ( | _ADOParameter __RPC_FAR * | This,
 |  | ParameterDirectionEnum | lParmDirection
 | ) |  |
void __RPC_STUB _Parameter_put_Direction_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Parameter_put_Name_Proxy | ( | _ADOParameter __RPC_FAR * | This,
 |  | BSTR | bstr
 | ) |  |
void __RPC_STUB _Parameter_put_Name_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Parameter_put_NumericScale_Proxy | ( | _ADOParameter __RPC_FAR * | This,
 |  | BYTE | bScale
 | ) |  |
void __RPC_STUB _Parameter_put_NumericScale_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Parameter_put_Precision_Proxy | ( | _ADOParameter __RPC_FAR * | This,
 |  | BYTE | bPrecision
 | ) |  |
void __RPC_STUB _Parameter_put_Precision_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Parameter_put_Size_Proxy | ( | _ADOParameter __RPC_FAR * | This,
 |  | long | l
 | ) |  |
void __RPC_STUB _Parameter_put_Size_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Parameter_put_Type_Proxy | ( | _ADOParameter __RPC_FAR * | This,
 |  | DataTypeEnum | sDataType
 | ) |  |
void __RPC_STUB _Parameter_put_Type_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Parameter_put_Value_Proxy | ( | _ADOParameter __RPC_FAR * | This,
 |  | VARIANT | val
 | ) |  |
void __RPC_STUB _Parameter_put_Value_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_AddNew_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | VARIANT | FieldList,
 |  | VARIANT | Values
 | ) |  |
void __RPC_STUB _Recordset_AddNew_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_Cancel_Proxy ( _ADORecordset __RPC_FAR * This )
void __RPC_STUB _Recordset_Cancel_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_CancelBatch_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | AffectEnum | AffectRecords
 | ) |  |
void __RPC_STUB _Recordset_CancelBatch_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_CancelUpdate_Proxy ( _ADORecordset __RPC_FAR * This )
void __RPC_STUB _Recordset_CancelUpdate_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_Clone_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | _ADORecordset __RPC_FAR *__RPC_FAR * | ppvObject
 | ) |  |
void __RPC_STUB _Recordset_Clone_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_Close_Proxy ( _ADORecordset __RPC_FAR * This )
void __RPC_STUB _Recordset_Close_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_Delete_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | AffectEnum | AffectRecords
 | ) |  |
void __RPC_STUB _Recordset_Delete_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_Find_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | BSTR | Criteria,
 |  | VARIANT_BOOL | SkipCurrent,
 |  | SearchDirectionEnum | SearchDirection,
 |  | VARIANT | Start
 | ) |  |
void __RPC_STUB _Recordset_Find_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_get_AbsolutePage_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | PositionEnum __RPC_FAR * | pl
 | ) |  |
void __RPC_STUB _Recordset_get_AbsolutePage_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_get_AbsolutePosition_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | PositionEnum __RPC_FAR * | pl
 | ) |  |
void __RPC_STUB _Recordset_get_AbsolutePosition_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_get_ActiveConnection_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | VARIANT __RPC_FAR * | pvar
 | ) |  |
void __RPC_STUB _Recordset_get_ActiveConnection_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_get_BOF_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | VARIANT_BOOL __RPC_FAR * | pb
 | ) |  |
void __RPC_STUB _Recordset_get_BOF_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_get_Bookmark_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | VARIANT __RPC_FAR * | pvBookmark
 | ) |  |
void __RPC_STUB _Recordset_get_Bookmark_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_get_CacheSize_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | long __RPC_FAR * | pl
 | ) |  |
void __RPC_STUB _Recordset_get_CacheSize_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_get_Collect_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | VARIANT | Index,
 |  | VARIANT __RPC_FAR * | pvar
 | ) |  |
void __RPC_STUB _Recordset_get_Collect_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_get_CursorLocation_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | CursorLocationEnum __RPC_FAR * | plCursorLoc
 | ) |  |
void __RPC_STUB _Recordset_get_CursorLocation_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_get_CursorType_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | CursorTypeEnum __RPC_FAR * | plCursorType
 | ) |  |
void __RPC_STUB _Recordset_get_CursorType_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_get_EditMode_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | EditModeEnum __RPC_FAR * | pl
 | ) |  |
void __RPC_STUB _Recordset_get_EditMode_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_get_EOF_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | VARIANT_BOOL __RPC_FAR * | pb
 | ) |  |
void __RPC_STUB _Recordset_get_EOF_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_get_Fields_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | ADOFields __RPC_FAR *__RPC_FAR * | ppvObject
 | ) |  |
void __RPC_STUB _Recordset_get_Fields_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_get_Filter_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | VARIANT __RPC_FAR * | Criteria
 | ) |  |
void __RPC_STUB _Recordset_get_Filter_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_get_LockType_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | LockTypeEnum __RPC_FAR * | plLockType
 | ) |  |
void __RPC_STUB _Recordset_get_LockType_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_get_MarshalOptions_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | MarshalOptionsEnum __RPC_FAR * | peMarshal
 | ) |  |
void __RPC_STUB _Recordset_get_MarshalOptions_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_get_MaxRecords_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | long __RPC_FAR * | plMaxRecords
 | ) |  |
void __RPC_STUB _Recordset_get_MaxRecords_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_get_PageCount_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | long __RPC_FAR * | pl
 | ) |  |
void __RPC_STUB _Recordset_get_PageCount_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_get_PageSize_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | long __RPC_FAR * | pl
 | ) |  |
void __RPC_STUB _Recordset_get_PageSize_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_get_RecordCount_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | long __RPC_FAR * | pl
 | ) |  |
void __RPC_STUB _Recordset_get_RecordCount_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_get_Sort_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | BSTR __RPC_FAR * | Criteria
 | ) |  |
void __RPC_STUB _Recordset_get_Sort_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_get_Source_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | VARIANT __RPC_FAR * | pvSource
 | ) |  |
void __RPC_STUB _Recordset_get_Source_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_get_State_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | LONG __RPC_FAR * | plObjState
 | ) |  |
void __RPC_STUB _Recordset_get_State_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_get_Status_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | long __RPC_FAR * | pl
 | ) |  |
void __RPC_STUB _Recordset_get_Status_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_GetRows_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | long | Rows,
 |  | VARIANT | Start,
 |  | VARIANT | Fields,
 |  | VARIANT __RPC_FAR * | pvar
 | ) |  |
void __RPC_STUB _Recordset_GetRows_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_Move_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | long | NumRecords,
 |  | VARIANT | Start
 | ) |  |
void __RPC_STUB _Recordset_Move_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_MoveFirst_Proxy ( _ADORecordset __RPC_FAR * This )
void __RPC_STUB _Recordset_MoveFirst_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_MoveLast_Proxy ( _ADORecordset __RPC_FAR * This )
void __RPC_STUB _Recordset_MoveLast_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_MoveNext_Proxy ( _ADORecordset __RPC_FAR * This )
void __RPC_STUB _Recordset_MoveNext_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_MovePrevious_Proxy ( _ADORecordset __RPC_FAR * This )
void __RPC_STUB _Recordset_MovePrevious_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_NextRecordset_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | VARIANT __RPC_FAR * | RecordsAffected,
 |  | _ADORecordset __RPC_FAR *__RPC_FAR * | ppiRs
 | ) |  |
void __RPC_STUB _Recordset_NextRecordset_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_Open_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | VARIANT | Source,
 |  | VARIANT | ActiveConnection,
 |  | CursorTypeEnum | CursorType,
 |  | LockTypeEnum | LockType,
 |  | LONG | Options
 | ) |  |
void __RPC_STUB _Recordset_Open_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_put_AbsolutePage_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | PositionEnum | Page
 | ) |  |
void __RPC_STUB _Recordset_put_AbsolutePage_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_put_AbsolutePosition_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | PositionEnum | Position
 | ) |  |
void __RPC_STUB _Recordset_put_AbsolutePosition_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_put_ActiveConnection_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | VARIANT | vConn
 | ) |  |
void __RPC_STUB _Recordset_put_ActiveConnection_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_put_Bookmark_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | VARIANT | vBookmark
 | ) |  |
void __RPC_STUB _Recordset_put_Bookmark_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_put_CacheSize_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | long | CacheSize
 | ) |  |
void __RPC_STUB _Recordset_put_CacheSize_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_put_Collect_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | VARIANT | Index,
 |  | VARIANT | value
 | ) |  |
void __RPC_STUB _Recordset_put_Collect_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_put_CursorLocation_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | CursorLocationEnum | lCursorLoc
 | ) |  |
void __RPC_STUB _Recordset_put_CursorLocation_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_put_CursorType_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | CursorTypeEnum | lCursorType
 | ) |  |
void __RPC_STUB _Recordset_put_CursorType_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_put_Filter_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | VARIANT | Criteria
 | ) |  |
void __RPC_STUB _Recordset_put_Filter_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_put_LockType_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | LockTypeEnum | lLockType
 | ) |  |
void __RPC_STUB _Recordset_put_LockType_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_put_MarshalOptions_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | MarshalOptionsEnum | eMarshal
 | ) |  |
void __RPC_STUB _Recordset_put_MarshalOptions_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_put_MaxRecords_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | long | lMaxRecords
 | ) |  |
void __RPC_STUB _Recordset_put_MaxRecords_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_put_PageSize_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | long | PageSize
 | ) |  |
void __RPC_STUB _Recordset_put_PageSize_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_put_Sort_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | BSTR | Criteria
 | ) |  |
void __RPC_STUB _Recordset_put_Sort_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_put_Source_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | BSTR | bstrConn
 | ) |  |
void __RPC_STUB _Recordset_put_Source_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_putref_ActiveConnection_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | IDispatch __RPC_FAR * | pconn
 | ) |  |
void __RPC_STUB _Recordset_putref_ActiveConnection_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_putref_Source_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | IDispatch __RPC_FAR * | pcmd
 | ) |  |
void __RPC_STUB _Recordset_putref_Source_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_Requery_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | LONG | Options
 | ) |  |
void __RPC_STUB _Recordset_Requery_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_Resync_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | AffectEnum | AffectRecords
 | ) |  |
void __RPC_STUB _Recordset_Resync_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_Supports_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | CursorOptionEnum | CursorOptions,
 |  | VARIANT_BOOL __RPC_FAR * | pb
 | ) |  |
void __RPC_STUB _Recordset_Supports_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_Update_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | VARIANT | Fields,
 |  | VARIANT | Values
 | ) |  |
void __RPC_STUB _Recordset_Update_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE _Recordset_UpdateBatch_Proxy | ( | _ADORecordset __RPC_FAR * | This,
 |  | AffectEnum | AffectRecords
 | ) |  |
void __RPC_STUB _Recordset_UpdateBatch_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE ADOConnectionConstruction_get_DSO_Proxy | ( | ADOConnectionConstruction __RPC_FAR * | This,
 |  | IUnknown __RPC_FAR *__RPC_FAR * | ppDSO
 | ) |  |
void __RPC_STUB ADOConnectionConstruction_get_DSO_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE ADOConnectionConstruction_get_Session_Proxy | ( | ADOConnectionConstruction __RPC_FAR * | This,
 |  | IUnknown __RPC_FAR *__RPC_FAR * | ppSession
 | ) |  |
void __RPC_STUB ADOConnectionConstruction_get_Session_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE ADORecordsetConstruction_get_Chapter_Proxy | ( | ADORecordsetConstruction __RPC_FAR * | This,
 |  | LONG __RPC_FAR * | plChapter
 | ) |  |
void __RPC_STUB ADORecordsetConstruction_get_Chapter_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE ADORecordsetConstruction_get_RowPosition_Proxy | ( | ADORecordsetConstruction __RPC_FAR * | This,
 |  | IUnknown __RPC_FAR *__RPC_FAR * | ppRowPos
 | ) |  |
void __RPC_STUB ADORecordsetConstruction_get_RowPosition_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE ADORecordsetConstruction_get_Rowset_Proxy | ( | ADORecordsetConstruction __RPC_FAR * | This,
 |  | IUnknown __RPC_FAR *__RPC_FAR * | ppRowset
 | ) |  |
void __RPC_STUB ADORecordsetConstruction_get_Rowset_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE ADORecordsetConstruction_put_Chapter_Proxy | ( | ADORecordsetConstruction __RPC_FAR * | This,
 |  | LONG | lChapter
 | ) |  |
void __RPC_STUB ADORecordsetConstruction_put_Chapter_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE ADORecordsetConstruction_put_RowPosition_Proxy | ( | ADORecordsetConstruction __RPC_FAR * | This,
 |  | IUnknown __RPC_FAR * | pRowPos
 | ) |  |
void __RPC_STUB ADORecordsetConstruction_put_RowPosition_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE ADORecordsetConstruction_put_Rowset_Proxy | ( | ADORecordsetConstruction __RPC_FAR * | This,
 |  | IUnknown __RPC_FAR * | pRowset
 | ) |  |
void __RPC_STUB ADORecordsetConstruction_put_Rowset_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE Error_get_Description_Proxy | ( | ADOError __RPC_FAR * | This,
 |  | BSTR __RPC_FAR * | pbstr
 | ) |  |
void __RPC_STUB Error_get_Description_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE Error_get_HelpContext_Proxy | ( | ADOError __RPC_FAR * | This,
 |  | long __RPC_FAR * | pl
 | ) |  |
void __RPC_STUB Error_get_HelpContext_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE Error_get_HelpFile_Proxy | ( | ADOError __RPC_FAR * | This,
 |  | BSTR __RPC_FAR * | pbstr
 | ) |  |
void __RPC_STUB Error_get_HelpFile_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE Error_get_NativeError_Proxy | ( | ADOError __RPC_FAR * | This,
 |  | long __RPC_FAR * | pl
 | ) |  |
void __RPC_STUB Error_get_NativeError_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE Error_get_Number_Proxy | ( | ADOError __RPC_FAR * | This,
 |  | long __RPC_FAR * | pl
 | ) |  |
void __RPC_STUB Error_get_Number_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE Error_get_Source_Proxy | ( | ADOError __RPC_FAR * | This,
 |  | BSTR __RPC_FAR * | pbstr
 | ) |  |
void __RPC_STUB Error_get_Source_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE Error_get_SQLState_Proxy | ( | ADOError __RPC_FAR * | This,
 |  | BSTR __RPC_FAR * | pbstr
 | ) |  |
void __RPC_STUB Error_get_SQLState_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE Errors_Clear_Proxy ( ADOErrors __RPC_FAR * This )
void __RPC_STUB Errors_Clear_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE Errors_get_Item_Proxy | ( | ADOErrors __RPC_FAR * | This,
 |  | VARIANT | Index,
 |  | ADOError __RPC_FAR *__RPC_FAR * | ppvObject
 | ) |  |
void __RPC_STUB Errors_get_Item_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE Field_AppendChunk_Proxy | ( | ADOField __RPC_FAR * | This,
 |  | VARIANT | Data
 | ) |  |
void __RPC_STUB Field_AppendChunk_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE Field_get_ActualSize_Proxy | ( | ADOField __RPC_FAR * | This,
 |  | long __RPC_FAR * | pl
 | ) |  |
void __RPC_STUB Field_get_ActualSize_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE Field_get_Attributes_Proxy | ( | ADOField __RPC_FAR * | This,
 |  | long __RPC_FAR * | pl
 | ) |  |
void __RPC_STUB Field_get_Attributes_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE Field_get_DefinedSize_Proxy | ( | ADOField __RPC_FAR * | This,
 |  | long __RPC_FAR * | pl
 | ) |  |
void __RPC_STUB Field_get_DefinedSize_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE Field_get_Name_Proxy | ( | ADOField __RPC_FAR * | This,
 |  | BSTR __RPC_FAR * | pbstr
 | ) |  |
void __RPC_STUB Field_get_Name_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE Field_get_NumericScale_Proxy | ( | ADOField __RPC_FAR * | This,
 |  | BYTE __RPC_FAR * | pbNumericScale
 | ) |  |
void __RPC_STUB Field_get_NumericScale_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE Field_get_OriginalValue_Proxy | ( | ADOField __RPC_FAR * | This,
 |  | VARIANT __RPC_FAR * | pvar
 | ) |  |
void __RPC_STUB Field_get_OriginalValue_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE Field_get_Precision_Proxy | ( | ADOField __RPC_FAR * | This,
 |  | BYTE __RPC_FAR * | pbPrecision
 | ) |  |
void __RPC_STUB Field_get_Precision_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE Field_get_Type_Proxy | ( | ADOField __RPC_FAR * | This,
 |  | DataTypeEnum __RPC_FAR * | pDataType
 | ) |  |
void __RPC_STUB Field_get_Type_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE Field_get_UnderlyingValue_Proxy | ( | ADOField __RPC_FAR * | This,
 |  | VARIANT __RPC_FAR * | pvar
 | ) |  |
void __RPC_STUB Field_get_UnderlyingValue_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE Field_get_Value_Proxy | ( | ADOField __RPC_FAR * | This,
 |  | VARIANT __RPC_FAR * | pvar
 | ) |  |
void __RPC_STUB Field_get_Value_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE Field_GetChunk_Proxy | ( | ADOField __RPC_FAR * | This,
 |  | long | Length,
 |  | VARIANT __RPC_FAR * | pvar
 | ) |  |
void __RPC_STUB Field_GetChunk_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE Field_put_Value_Proxy | ( | ADOField __RPC_FAR * | This,
 |  | VARIANT | Val
 | ) |  |
void __RPC_STUB Field_put_Value_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE Fields_get_Item_Proxy | ( | ADOFields __RPC_FAR * | This,
 |  | VARIANT | Index,
 |  | ADOField __RPC_FAR *__RPC_FAR * | ppvObject
 | ) |  |
void __RPC_STUB Fields_get_Item_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
void __RPC_FAR* __RPC_USER MIDL_user_allocate ( size_t )

Definition at line 364 of file Picklpc.c.

{
    unsigned char * pcAllocated;
    unsigned char * pcUserPtr;

    pcAllocated = (unsigned char *) malloc( s + 15 );
    pcUserPtr =  ALIGN_TO8( pcAllocated );
    if ( pcUserPtr == pcAllocated )
        pcUserPtr = pcAllocated + 8;

    *(pcUserPtr - 1) = (char) (pcUserPtr - pcAllocated);

    return( pcUserPtr );
}

void __RPC_USER MIDL_user_free ( void __RPC_FAR * )

Definition at line 379 of file Picklpc.c.

{
    unsigned char * pcAllocated;
    unsigned char * pcUserPtr;

    pcUserPtr = (unsigned char *) f;
    pcAllocated = pcUserPtr - *(pcUserPtr - 1);

    free( pcAllocated );
}

HRESULT STDMETHODCALLTYPE Parameters_get_Item_Proxy | ( | ADOParameters __RPC_FAR * | This,
 |  | VARIANT | Index,
 |  | _ADOParameter __RPC_FAR *__RPC_FAR * | ppvObject
 | ) |  |
void __RPC_STUB Parameters_get_Item_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE Properties_get_Item_Proxy | ( | ADOProperties __RPC_FAR * | This,
 |  | VARIANT | Index,
 |  | ADOProperty __RPC_FAR *__RPC_FAR * | ppvObject
 | ) |  |
void __RPC_STUB Properties_get_Item_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE Property_get_Attributes_Proxy | ( | ADOProperty __RPC_FAR * | This,
 |  | long __RPC_FAR * | plAttributes
 | ) |  |
void __RPC_STUB Property_get_Attributes_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE Property_get_Name_Proxy | ( | ADOProperty __RPC_FAR * | This,
 |  | BSTR __RPC_FAR * | pbstr
 | ) |  |
void __RPC_STUB Property_get_Name_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE Property_get_Type_Proxy | ( | ADOProperty __RPC_FAR * | This,
 |  | DataTypeEnum __RPC_FAR * | ptype
 | ) |  |
void __RPC_STUB Property_get_Type_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE Property_get_Value_Proxy | ( | ADOProperty __RPC_FAR * | This,
 |  | VARIANT __RPC_FAR * | pval
 | ) |  |
void __RPC_STUB Property_get_Value_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE Property_put_Attributes_Proxy | ( | ADOProperty __RPC_FAR * | This,
 |  | long | lAttributes
 | ) |  |
void __RPC_STUB Property_put_Attributes_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE Property_put_Value_Proxy | ( | ADOProperty __RPC_FAR * | This,
 |  | VARIANT | val
 | ) |  |
void __RPC_STUB Property_put_Value_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |

Variable Documentation

RPC_IF_HANDLE __MIDL_itf_m_bobj_0000_v0_0_c_ifspec
RPC_IF_HANDLE __MIDL_itf_m_bobj_0000_v0_0_s_ifspec
EXTERN_C const IID IID__ADO

Definition at line 725 of file adoint.h.

EXTERN_C const IID IID__ADOCollection

Definition at line 452 of file adoint.h.

EXTERN_C const IID IID__ADODynaCollection

Definition at line 587 of file adoint.h.

EXTERN_C const IID IID__Command

Definition at line 1173 of file adoint.h.

EXTERN_C const IID IID__Connection

Definition at line 1593 of file adoint.h.

EXTERN_C const IID IID__Parameter

Definition at line 4080 of file adoint.h.

EXTERN_C const IID IID__Recordset

Definition at line 2286 of file adoint.h.

EXTERN_C const IID IID_ADOConnectionConstruction

Definition at line 2194 of file adoint.h.

EXTERN_C const IID IID_ADORecordsetConstruction

Definition at line 3450 of file adoint.h.

EXTERN_C const IID IID_Error

Definition at line 829 of file adoint.h.

EXTERN_C const IID IID_Errors

Definition at line 1035 of file adoint.h.

EXTERN_C const IID IID_Field

Definition at line 3639 of file adoint.h.

EXTERN_C const IID IID_Fields

Definition at line 3956 of file adoint.h.

EXTERN_C const IID IID_Parameters

Definition at line 4466 of file adoint.h.

EXTERN_C const IID IID_Properties

Definition at line 4791 of file adoint.h.

EXTERN_C const IID IID_Property

Definition at line 4602 of file adoint.h.

EXTERN_C const IID LIBID_ADODB

Definition at line 443 of file adoint.h.

interface _ADOCollection CONST_VTBL struct _ADOCollectionVtbl __RPC_FAR* lpVtbl

Definition at line 529 of file adoint.h.

Generated on Wed Nov 13 2024 16:53:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/rds/handler/vc/const.cpp File Reference

  • Dataaccess
  • rds
  • handler
  • vc
Defines

const.cpp File Reference

#include <objbase.h>
#include <initguid.h>
#include "adoid.h"

Go to the source code of this file.

Defines

#define INITGUID

Define Documentation

#define INITGUID

Definition at line 13 of file const.cpp.

Generated on Wed Nov 13 2024 16:53:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/rds/handler/vc/handler.cpp File Reference

  • Dataaccess
  • rds
  • handler
  • vc

handler.cpp File Reference

#include "stdafx.h"
#include <assert.h>
#include "adoint.h"
#include "adoid.h"
#include "Handler.h"
#include "util.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/rds/handler/vc/handler.h File Reference

  • Dataaccess
  • rds
  • handler
  • vc
Classes | Defines

handler.h File Reference

#include "resource.h"
#include "adoint.h"
#include "msdfhdl.h"
#include "msdfmap.h"
#include "resource.h"

Go to the source code of this file.

Classes

class | CHandler

Defines

#define | MSDFMAP_PROGID "MSDFMAP_VC.Handler"
#define | MSDFMAP_PROGIDVER "MSDFMAP_VC.Handler.1"

Define Documentation

#define MSDFMAP_PROGID "MSDFMAP_VC.Handler"

Definition at line 25 of file handler.h.

#define MSDFMAP_PROGIDVER "MSDFMAP_VC.Handler.1"

Definition at line 26 of file handler.h.

Generated on Wed Nov 13 2024 16:53:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/rds/handler/vc/msdfhdl.idl File Reference

  • Dataaccess
  • rds
  • handler
  • vc
Classes | Namespaces | Functions

msdfhdl.idl File Reference

Go to the source code of this file.

Classes

interface | MSDFHDL::IDataFactoryHandler

Namespaces

namespace | MSDFHDL

Functions

MSDFHDL::importlib ("stdole32.tlb")
MSDFHDL::importlib ("C:\Program Files\Common Files\System\ado\msado15.dll")
MSDFHDL::importlib ("stdole.tlb")
Generated on Wed Nov 13 2024 16:53:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/rds/handler/vc/msdfmap.cpp File Reference

  • Dataaccess
  • rds
  • handler
  • vc
Functions | Variables

msdfmap.cpp File Reference

#include "stdafx.h"
#include <initguid.h>
#include "resource.h"
#include "msdfmap.h"
#include "msdfmap_i.cpp"
#include "HANDLER.h"
#include "msdfhdl.cpp"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 48 of file msdfmap.cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 56 of file msdfmap.cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 33 of file msdfmap.cpp.

{
  if (dwReason == DLL_PROCESS_ATTACH)
  {
    _Module.Init(ObjectMap, hInstance);
    DisableThreadLibraryCalls(hInstance);
  }
  else if (dwReason == DLL_PROCESS_DETACH)
    _Module.Term();
  return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 64 of file msdfmap.cpp.

{
  // registers object, typelib and all interfaces in typelib
  return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 73 of file msdfmap.cpp.

{
  _Module.UnregisterServer();
  return S_OK;
}

Variable Documentation

CComModule _Module

Definition at line 22 of file msdfmap.cpp.

Generated on Wed Nov 13 2024 16:53:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/rds/handler/vc/msdfmap.idl File Reference

  • Dataaccess
  • rds
  • handler
  • vc
Classes | Namespaces | Functions

msdfmap.idl File Reference

Go to the source code of this file.

Classes

class | MSDFMAPLib::Handler

Namespaces

namespace | MSDFMAPLib

Functions

MSDFMAPLib::importlib ("stdole32.tlb")
MSDFMAPLib::importlib ("msdfhdl.tlb")
MSDFMAPLib::importlib ("stdole.tlb")
Generated on Wed Nov 13 2024 16:53:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/rds/handler/vc/resource.h File Reference

  • Dataaccess
  • rds
  • handler
  • vc
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_Handler1 104
#define | IDS_HANDLER_DESC1 103
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_Handler1 104

Definition at line 18 of file resource.h.

#define IDS_HANDLER_DESC1 103

Definition at line 17 of file resource.h.

#define IDS_PROJNAME 100

Definition at line 16 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/rds/handler/vc/stdafx.cpp File Reference

  • Dataaccess
  • rds
  • handler
  • vc

stdafx.cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/rds/handler/vc/stdafx.h File Reference

  • Dataaccess
  • rds
  • handler
  • vc
Defines | Variables

stdafx.h File Reference

#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Defines

#define | _ATL_FREE_THREADED
#define | _WIN32_WINNT 0x0400
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_FREE_THREADED

Definition at line 27 of file stdafx.h.

#define _WIN32_WINNT 0x0400

Definition at line 25 of file stdafx.h.

#define STRICT

Definition at line 22 of file stdafx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/rds/handler/vc/stdafxx.cpp File Reference

  • Dataaccess
  • rds
  • handler
  • vc

stdafxx.cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/rds/handler/vc/util.cpp File Reference

  • Dataaccess
  • rds
  • handler
  • vc

util.cpp File Reference

#include "stdafx.h"
#include <assert.h>
#include <stdio.h>
#include <time.h>
#include "util.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/rds/handler/vc/util.h File Reference

  • Dataaccess
  • rds
  • handler
  • vc
Classes | Defines | Functions | Variables

util.h File Reference

#include <assert.h>

Go to the source code of this file.

Classes

class | CUtil
class | CUtilBSTR
class | CUtilComPtr< T >
class | CUtilString

Defines

#define | UTIL_NOACCESS 0
#define | UTIL_READONLY 2
#define | UTIL_READWRITE 3

Functions

void | ThrowHR (HRESULT hr)

Variables

const DWORD | CUtilString_padsize = 1024

Define Documentation

#define UTIL_NOACCESS 0

Definition at line 18 of file util.h.

#define UTIL_READONLY 2

Definition at line 19 of file util.h.

#define UTIL_READWRITE 3

Definition at line 20 of file util.h.

Function Documentation

void ThrowHR ( HRESULT hr )

Variable Documentation

const DWORD CUtilString_padsize = 1024

Definition at line 25 of file util.h.

Generated on Wed Nov 13 2024 16:53:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Dataaccess/rds/handler/vc/utiltest.cpp File Reference

  • Dataaccess
  • rds
  • handler
  • vc
Defines | Functions

utiltest.cpp File Reference

#include <stdio.h>

Go to the source code of this file.

Defines

#define | dump(x) printf("%s = \"",#x); DumpWChar(x); printf("\"\n")

Functions

void | main (void)

Define Documentation

#define dump ( x ) printf("%s = \"",#x); DumpWChar(x); printf("\"\n")

Definition at line 15 of file utiltest.cpp.

Function Documentation

void main ( void )

Definition at line 30 of file utiltest.cpp.

{
  CUtil util;
  WCHAR * conn = L"name1=value1;Data Source=CustomerDatabase;name2=value2";
  WCHAR * sql = L"CustomerById(2)";

  dump(conn);
  dump(sql);
  util.SetConn(conn);
  printf("GetUsername=%s\n", util.GetUsername());
  printf("HasReadAccess=%d\n", util.HasReadAccess());
  printf("HasWriteAccess=%d\n", util.HasWriteAccess());
  util.SetSql(sql);
  dump(util.GetConn());
  dump(util.GetSql());
}

Generated on Wed Nov 13 2024 16:53:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Audio/MciPlay/MciPlay.c File Reference

  • Multimedia
  • Audio
  • MciPlay
Defines | Functions | Variables

MciPlay.c File Reference

#include <windows.h>
#include <windowsx.h>
#include <commdlg.h>
#include <vfw.h>
#include "mciplay.h"

Go to the source code of this file.

Defines

#define | BUFSIZE 260
#define | INC_OLE2
#define | ISCHECKED(hwnd, id) (BOOL)(GetMenuState(GetMenu(hwnd), id, 0) & MF_CHECKED)
#define | MCIPLAY_APP_CLASS "MCIPlay_App"
#define | MCIPLAY_DOC_CLASS MCIWND_WINDOW_CLASS
#define | STRICT

Functions

BOOL CALLBACK | AppAbout (HWND, UINT, WPARAM, LPARAM)
LRESULT CALLBACK | AppWndProc (HWND, UINT, WPARAM, LPARAM)
int PASCAL | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLine, int sw)

Variables

HACCEL | ghAccelApp
HINSTANCE | ghInstApp
HWND | ghwndApp
HWND | ghwndMdi
char | gszBuffer [BUFSIZE]

Define Documentation

#define BUFSIZE 260

Definition at line 32 of file MciPlay.c.

#define INC_OLE2

Definition at line 24 of file MciPlay.c.

#define ISCHECKED | ( | hwnd,
 |  | id |
 | ) |  | (BOOL)(GetMenuState(GetMenu(hwnd), id, 0) & MF_CHECKED)

Definition at line 38 of file MciPlay.c.

#define MCIPLAY_APP_CLASS "MCIPlay_App"

Definition at line 33 of file MciPlay.c.

#define MCIPLAY_DOC_CLASS MCIWND_WINDOW_CLASS

Definition at line 34 of file MciPlay.c.

#define STRICT

Definition at line 23 of file MciPlay.c.

Function Documentation

BOOL CALLBACK AppAbout | ( | HWND | hwnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 87 of file MciPlay.c.

{
    switch (msg) {
        case WM_COMMAND:
        EndDialog(hwnd,TRUE);
        return TRUE;
    }
    return FALSE;
}

LRESULT CALLBACK AppWndProc | ( | HWND | hwnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 656 of file MciPlay.c.

{

    switch (msg) {
       case WM_CREATE:
        ghwndMdi = mdiCreateClient(hwnd, GetSubMenu(GetMenu(hwnd), GetMenuItemCount(GetMenu(hwnd))-1));
        break;

        case WM_COMMAND:
            HANDLE_WM_COMMAND(hwnd, wParam, lParam, MCI_OnCommand);
            break;

    case WM_PALETTECHANGED:
        mdiSendMessage(ghwndMdi, (HWND)-1, msg, wParam, lParam);
        break;

    case WM_QUERYNEWPALETTE:
        return mdiSendMessage(ghwndMdi, NULL, msg, wParam, lParam);
            break;

        case WM_INITMENUPOPUP:
        HANDLE_WM_INITMENUPOPUP(hwnd, wParam, lParam, MCI_OnInitMenuPopup);
        break;

    case WM_SIZE:
        HANDLE_WM_SIZE(hwnd, wParam, lParam, MCI_OnSize);
        break;

    case WM_DESTROY:
        PostQuitMessage(0);
        return (0);
    }
    return DefFrameProc(hwnd,ghwndMdi,msg,wParam,lParam);
}

int PASCAL WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | szCmdLine,
 |  | int | sw
 | ) |  |

Definition at line 203 of file MciPlay.c.

{
    MSG msg;

    if (!AppInit(hInstance,hPrevInstance,szCmdLine,sw))
        return FALSE;

    //Polling messages from event queue
    for (;;) {
        if (PeekMessage(&msg, NULL, 0, 0,PM_REMOVE)) {
            if (msg.message == WM_QUIT)
                break;

            if (ghAccelApp && ghwndApp && TranslateAccelerator(ghwndApp, ghAccelApp, &msg))
                continue;

            if(!TranslateMDISysAccel(ghwndMdi, &msg)) {
                TranslateMessage(&msg);
                DispatchMessage(&msg);
            }
        } else {
            // idle time here, DONT BE A PIG!
            WaitMessage();
        }
    }
    return msg.wParam;
}

Variable Documentation

HACCEL ghAccelApp

Definition at line 47 of file MciPlay.c.

HINSTANCE ghInstApp

Definition at line 46 of file MciPlay.c.

HWND ghwndApp

Definition at line 48 of file MciPlay.c.

HWND ghwndMdi

Definition at line 49 of file MciPlay.c.

char gszBuffer[BUFSIZE]

Definition at line 50 of file MciPlay.c.

Generated on Wed Nov 13 2024 16:53:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Audio/MciPlay/MciPlay.h File Reference

  • Multimedia
  • Audio
  • MciPlay
Defines

MciPlay.h File Reference

Go to the source code of this file.

Defines

#define | ABOUTBOX 1
#define | IDM_END 12
#define | IDM_HOME 11
#define | IDM_PAUSE 16
#define | IDM_PLAY 10
#define | IDM_RPLAY 15
#define | IDM_RSTEP 14
#define | IDM_SAutosizeMovie 18
#define | IDM_SAutosizeWindow 17
#define | IDM_SErrorDlg 29
#define | IDM_SMenu 20
#define | IDM_SNotifyMedia 24
#define | IDM_SNotifyMode 25
#define | IDM_SNotifyPos 26
#define | IDM_SNotifySize 27
#define | IDM_SPlaybar 19
#define | IDM_SRecord 28
#define | IDM_SShowMode 22
#define | IDM_SShowName 21
#define | IDM_SShowPos 23
#define | IDM_STEP 13
#define | IDM_STOP 9
#define | IDS_APPERR 2
#define | IDS_APPNAME 1
#define | IDS_FILTERSTRING 6
#define | IDS_NOOPEN 5
#define | IDS_UNTITLLED 4
#define | IDS_VFWTOOOLD 3
#define | MENU_ABOUT 1000
#define | MENU_CLOSE 1003
#define | MENU_EXIT 1001
#define | MENU_NEW 1002
#define | MENU_OPEN 1004

Define Documentation

#define ABOUTBOX 1

Definition at line 13 of file MciPlay.h.

#define IDM_END 12

Definition at line 27 of file MciPlay.h.

#define IDM_HOME 11

Definition at line 26 of file MciPlay.h.

#define IDM_PAUSE 16

Definition at line 31 of file MciPlay.h.

#define IDM_PLAY 10

Definition at line 25 of file MciPlay.h.

#define IDM_RPLAY 15

Definition at line 30 of file MciPlay.h.

#define IDM_RSTEP 14

Definition at line 29 of file MciPlay.h.

#define IDM_SAutosizeMovie 18

Definition at line 34 of file MciPlay.h.

#define IDM_SAutosizeWindow 17

Definition at line 33 of file MciPlay.h.

#define IDM_SErrorDlg 29

Definition at line 45 of file MciPlay.h.

#define IDM_SMenu 20

Definition at line 36 of file MciPlay.h.

#define IDM_SNotifyMedia 24

Definition at line 40 of file MciPlay.h.

#define IDM_SNotifyMode 25

Definition at line 41 of file MciPlay.h.

#define IDM_SNotifyPos 26

Definition at line 42 of file MciPlay.h.

#define IDM_SNotifySize 27

Definition at line 43 of file MciPlay.h.

#define IDM_SPlaybar 19

Definition at line 35 of file MciPlay.h.

#define IDM_SRecord 28

Definition at line 44 of file MciPlay.h.

#define IDM_SShowMode 22

Definition at line 38 of file MciPlay.h.

#define IDM_SShowName 21

Definition at line 37 of file MciPlay.h.

#define IDM_SShowPos 23

Definition at line 39 of file MciPlay.h.

#define IDM_STEP 13

Definition at line 28 of file MciPlay.h.

#define IDM_STOP 9

Definition at line 24 of file MciPlay.h.

#define IDS_APPERR 2

Definition at line 50 of file MciPlay.h.

#define IDS_APPNAME 1

Definition at line 49 of file MciPlay.h.

#define IDS_FILTERSTRING 6

Definition at line 54 of file MciPlay.h.

#define IDS_NOOPEN 5

Definition at line 53 of file MciPlay.h.

#define IDS_UNTITLLED 4

Definition at line 52 of file MciPlay.h.

#define IDS_VFWTOOOLD 3

Definition at line 51 of file MciPlay.h.

#define MENU_ABOUT 1000

Definition at line 17 of file MciPlay.h.

#define MENU_CLOSE 1003

Definition at line 20 of file MciPlay.h.

#define MENU_EXIT 1001

Definition at line 18 of file MciPlay.h.

#define MENU_NEW 1002

Definition at line 19 of file MciPlay.h.

#define MENU_OPEN 1004

Definition at line 21 of file MciPlay.h.

Generated on Wed Nov 13 2024 16:53:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Audio/MidiPlyr/Debug.c File Reference

  • Multimedia
  • Audio
  • MidiPlyr

Debug.c File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Audio/MidiPlyr/Debug.h File Reference

  • Multimedia
  • Audio
  • MidiPlyr
Defines

Debug.h File Reference

Go to the source code of this file.

Defines

#define | assert(exp) ((void)0)
#define | D1(sz)
#define | D2(sz)
#define | D3(sz)
#define | D4(sz)
#define | DbgEnable(x) FALSE
#define | DbgInitialize(x) 0
#define | DbgSetLevel(x) 0
#define | DEBUG_MAX_LINE_LEN 255
#define | DEBUG_MODULE_NAME "MIDIPLYR"
#define | DEBUG_SECTION "debug"
#define | DPF 1 ? (void)0 : (void)
#define | DRV_ENABLE_DEBUG (DRV_USER+1)
#define | DRV_SET_DEBUG_LEVEL (DRV_USER+2)
#define | ISRDEBUG 1

Define Documentation

#define assert ( exp ) ((void)0)

Definition at line 51 of file Debug.h.

#define D1 ( sz )

Definition at line 59 of file Debug.h.

#define D2 ( sz )

Definition at line 60 of file Debug.h.

#define D3 ( sz )

Definition at line 61 of file Debug.h.

#define D4 ( sz )

Definition at line 62 of file Debug.h.

#define DbgEnable ( x ) FALSE

Definition at line 53 of file Debug.h.

#define DbgInitialize ( x ) 0

Definition at line 55 of file Debug.h.

#define DbgSetLevel ( x ) 0

Definition at line 54 of file Debug.h.

#define DEBUG_MAX_LINE_LEN 255

Definition at line 28 of file Debug.h.

#define DEBUG_MODULE_NAME "MIDIPLYR"

Definition at line 27 of file Debug.h.

#define DEBUG_SECTION "debug"

Definition at line 26 of file Debug.h.

#define DPF 1 ? (void)0 : (void)

Definition at line 57 of file Debug.h.

#define DRV_ENABLE_DEBUG (DRV_USER+1)

Definition at line 30 of file Debug.h.

#define DRV_SET_DEBUG_LEVEL (DRV_USER+2)

Definition at line 31 of file Debug.h.

#define ISRDEBUG 1

Definition at line 25 of file Debug.h.

Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Audio/MidiPlyr/GLOBAL.h File Reference

  • Multimedia
  • Audio
  • MidiPlyr
Defines

GLOBAL.h File Reference

Go to the source code of this file.

Defines

#define | BCODE __based(__segname("_CODE"))
#define | BSEG(x) __based(__segname(x))
#define | BSTACK __based(__segname("_STACK"))
#define | FNEXPORT FAR PASCAL __export __loadds
#define | FNGLOBAL FAR PASCAL
#define | FNLOCAL NEAR PASCAL
#define | HUGE __huge
#define | PRIVATE static
#define | PUBLIC

Define Documentation

#define BCODE __based(__segname("_CODE"))

Definition at line 22 of file GLOBAL.h.

#define BSEG ( x ) __based(__segname(x))

Definition at line 24 of file GLOBAL.h.

#define BSTACK __based(__segname("_STACK"))

Definition at line 23 of file GLOBAL.h.

#define FNEXPORT FAR PASCAL __export __loadds

Definition at line 45 of file GLOBAL.h.

#define FNGLOBAL FAR PASCAL

Definition at line 44 of file GLOBAL.h.

#define FNLOCAL NEAR PASCAL

Definition at line 43 of file GLOBAL.h.

#define HUGE __huge

Definition at line 25 of file GLOBAL.h.

#define PRIVATE static

Definition at line 40 of file GLOBAL.h.

#define PUBLIC

Definition at line 39 of file GLOBAL.h.

Generated on Wed Nov 13 2024 16:53:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Audio/MidiPlyr/MainWND.c File Reference

  • Multimedia
  • Audio
  • MidiPlyr
Defines | Functions | Variables

MainWND.c File Reference

#include <windows.h>
#include <shellapi.h>
#include <windowsx.h>
#include <mmsystem.h>
#include <commdlg.h>
#include <commctrl.h>
#include <ctype.h>
#include "debug.h"
#include "MIDIPlyr.H"

Go to the source code of this file.

Defines

#define | _INC_SHELLAPI
#define | BITMAP_COUNT 6
#define | BUTTON_COUNT (sizeof(gatbButton)/sizeof(gatbButton[0]))
#define | SUI_F_CANPAUSE 0x0002
#define | SUI_F_CANPLAY 0x0001
#define | SUI_F_CANSELDEVICE 0x0008
#define | SUI_F_CANSTOP 0x0004

Functions

PRIVATE VOID FNLOCAL | AttemptFileOpen (HWND hWnd)
PRIVATE VOID FNLOCAL | InitStatusBar (HWND hWnd)
PRIVATE VOID FNLOCAL | InitToolbar (HWND hWnd)
PRIVATE VOID FNLOCAL | MWnd_OnCommand (HWND hWnd, int id, HWND hWndCtl, UINT codeNotify)
PRIVATE VOID FNLOCAL | MWnd_OnCommandToggleChild (HWND hWnd, UINT id)
PRIVATE BOOL FNLOCAL | MWnd_OnCreate (HWND hWnd, CREATESTRUCT FAR *lpCreateStruct)
PRIVATE VOID FNLOCAL | MWnd_OnDestroy (HWND hWnd)
PRIVATE VOID FNLOCAL | MWnd_OnDropFiles (HWND hWnd, HDROP hDrop)
PRIVATE VOID FNLOCAL | MWnd_OnFileOpen (HWND hWnd)
PRIVATE VOID FNLOCAL | MWnd_OnGetMinMaxInfo (HWND hWnd, MINMAXINFO FAR *lpMinMaxInfo)
PRIVATE VOID FNLOCAL | MWnd_OnPaint (HWND hWnd)
PRIVATE VOID FNLOCAL | MWnd_OnSize (HWND hWnd, UINT state, int cx, int cy)
LRESULT CALLBACK | MWnd_WndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
PRIVATE BOOL FNLOCAL | PrerollAndWait (HWND hWnd)
PRIVATE VOID FNLOCAL | ResizeStatusBar (HWND hWnd)
PRIVATE VOID FNLOCAL | SetOneAction (HWND hWnd, int nMenuID, BOOL fEnable)
PRIVATE VOID FNLOCAL | SyncUI (HWND hWnd)

Variables

PRIVATE TBBUTTON | gatbButton []
PRIVATE BOOL | gbAutoPlay = TRUE
PRIVATE HWND | ghWndStatus = NULL
PRIVATE HWND | ghWndTime = NULL
PRIVATE HWND | ghWndToolbar = NULL
PRIVATE int | gnSB_TFPaneSize = 0
PRIVATE char | gszAppTitle [80] = ""
PRIVATE char BCODE | gszDefExtension [] = "MID"
PRIVATE char BCODE | gszFilter [] = "All Files (*.*)\0*.*\0"
PRIVATE char | gszOpenName [MAX_FILEPATH] = ""
PRIVATE char | gszOpenTitle [MAX_FILEPATH] = ""
PRIVATE UINT | guDevice = 0

Define Documentation

#define _INC_SHELLAPI

Definition at line 20 of file MainWND.c.

#define BITMAP_COUNT 6

Definition at line 35 of file MainWND.c.

#define BUTTON_COUNT (sizeof(gatbButton)/sizeof(gatbButton[0]))

Definition at line 62 of file MainWND.c.

#define SUI_F_CANPAUSE 0x0002

Definition at line 222 of file MainWND.c.

#define SUI_F_CANPLAY 0x0001

Definition at line 221 of file MainWND.c.

#define SUI_F_CANSELDEVICE 0x0008

Definition at line 224 of file MainWND.c.

#define SUI_F_CANSTOP 0x0004

Definition at line 223 of file MainWND.c.

Function Documentation

PRIVATE VOID FNLOCAL AttemptFileOpen ( HWND hWnd )

Definition at line 329 of file MainWND.c.

{
    MMRESULT                mmrc;
    PSTR                    pStrFile    = gszUntitled;

    /* Stop, close, etc. if we're still playing
    */
    DPF(1, "AttemptFileOpen: Calling seqStop(); state = %u", gpSeq->uState);

    mmrc = seqStop(gpSeq);
  if (mmrc != MMSYSERR_NOERROR)
  {
    Error(hWnd, IDS_STOPFAILED, mmrc);
    return;
  }

    DPF(1, "Calling seqCloseFile(); state = %u", gpSeq->uState);
    seqCloseFile(gpSeq);

    DPF(1, "Calling seqOpenFile(); state = %u", gpSeq->uState);
    /* Open new file
    */

    gpSeq->pstrFile = gszOpenName;
    mmrc = seqOpenFile(gpSeq);
    if (mmrc != MMSYSERR_NOERROR)
    {
        Error(hWnd, IDS_OPENFAILED, mmrc);
        return;
    }

    pStrFile = gszOpenTitle;

    wsprintf(gszAppTitle, gszAppTitleMask, (LPSTR)pStrFile);
    SetWindowText(hWnd, gszAppTitle);

    SyncUI(hWnd);
}

PRIVATE VOID FNLOCAL InitStatusBar ( HWND hWnd )

Definition at line 123 of file MainWND.c.

{
    HWND                    hWndDesktop;
    HFONT                   hFontStat;
    HDC                     hDC;
    UINT                    idx;
    SIZE                    size;

    ghWndStatus = CreateStatusWindow(WS_CHILD|SBARS_SIZEGRIP,
                                     "",
                                     hWnd,
                                     IDC_STATBAR);

    if (ghWndStatus)
    {
        hWndDesktop = GetDesktopWindow();
        hFontStat = (HFONT)SendMessage(ghWndStatus, WM_GETFONT, 0, 0L);
        hDC = GetDC(hWndDesktop);

        if (hFontStat != (HFONT)NULL && hDC != (HDC)NULL)
        {
            hFontStat = (HFONT)SelectObject(hDC, hFontStat);

            gnSB_TFPaneSize = 0;
            for (idx = 0; idx < N_TIME_FORMATS; idx++)
            {
                GetTextExtentPoint(hDC,
                                   grgszTimeFormats[idx],
                                   lstrlen(grgszTimeFormats[idx]),
                                   &size);

                gnSB_TFPaneSize = max(gnSB_TFPaneSize, size.cx);
            }

            SelectObject(hDC, hFontStat);

            gnSB_TFPaneSize *= 2;
        }

        if (hDC != (HDC)NULL)
            ReleaseDC(hWndDesktop, hDC);

        ResizeStatusBar(hWnd);

        FORWARD_WM_COMMAND(hWnd, gnTimeFormat, 0, 0, SendMessage);
        ShowWindow(ghWndStatus, SW_RESTORE);
    }
}

VOID FNLOCAL InitToolbar ( HWND hWnd )

Definition at line 93 of file MainWND.c.

{
    ghWndToolbar = CreateToolbarEx(hWnd,
                                   WS_CHILD|WS_CLIPSIBLINGS|WS_CLIPCHILDREN,
                                   IDC_TOOLBAR,
                                   BITMAP_COUNT,
                                   ghInst,
                                   IDB_TOOLBAR,
                                   gatbButton,
                                   BUTTON_COUNT,
                                   0,  0,
                                   0,  0,
                                   sizeof(TBBUTTON));

    if (ghWndToolbar)
        ShowWindow(ghWndToolbar, SW_RESTORE);
}

PRIVATE VOID FNLOCAL MWnd_OnCommand | ( | HWND | hWnd,
 |  | int | id,
 |  | HWND | hWndCtl,
 |  | UINT | codeNotify
 | ) |  |

Definition at line 789 of file MainWND.c.

{
    HMENU                   hMenu;
    int                     nIdxFormat;
    LPSTR                   lpstr;

    if (id >= IDS_TF_FIRST && id <= IDS_TF_LAST)
    {
        if (NULL != ghWndStatus)
        {
            nIdxFormat = id - IDS_TF_FIRST;

            lpstr = (LPSTR)(grgszTimeFormats[nIdxFormat]);

            SendMessage(ghWndStatus,
                        SB_SETTEXT,
                        SB_PANE_TFMT,
                        (LPARAM)lpstr);

        }

        hMenu = GetMenu(hWnd);

        CheckMenuItem(hMenu, gnTimeFormat, MF_UNCHECKED|MF_BYCOMMAND);
        CheckMenuItem(hMenu, id, MF_CHECKED|MF_BYCOMMAND);

        gnTimeFormat = id;

        /* Force time window to update font and repaint entire time string
         */

        if(ghWndTime) // for when WM_COMMAND is called before WM_CREATE
          FORWARD_WM_SIZE(ghWndTime, SIZE_RESTORED, 0, 0, SendMessage);
    }
    else if (id >= IDM_DEVMIN && id <= IDM_DEVMAX)
    {
        hMenu = GetMenu(hWnd);

        CheckMenuItem(hMenu, guDevice + IDM_DEVICES, MF_UNCHECKED|MF_BYCOMMAND);
        guDevice = id - IDM_DEVICES;
        CheckMenuItem(hMenu, guDevice + IDM_DEVICES, MF_CHECKED|MF_BYCOMMAND);
    }
    else switch(id)
    {
        case IDM_OPEN:
            MWnd_OnFileOpen(hWnd);
            break;

        case IDM_TOOLBAR:
        case IDM_STATUS:
            MWnd_OnCommandToggleChild(hWnd, id);
            break;

        case IDM_AUTOPLAY:
            gbAutoPlay = !gbAutoPlay;
            CheckMenuItem(GetMenu(hWnd),
                          IDM_AUTOPLAY,
                          MF_BYCOMMAND|(gbAutoPlay ? MF_CHECKED : MF_UNCHECKED));
            break;

        case IDM_PLAY:
            FORWARD_WM_COMMAND(ghWndTime, IDM_PLAY, 0, 0, SendMessage);

      if (gpSeq->uState != SEQ_S_OPENED)
        DPF(1, "IDM_PLAY: State %u", gpSeq->uState);

            if (PrerollAndWait(hWnd))
              seqStart(gpSeq);

            SyncUI(hWnd);
            break;

        case IDM_STOP:
            FORWARD_WM_COMMAND(ghWndTime, IDM_STOP, 0, 0, SendMessage);

            seqStop(gpSeq);
            SyncUI(hWnd);
            break;

        case IDM_PAUSE:
            if (gpSeq->uState == SEQ_S_PAUSED)
            {
                seqRestart(gpSeq);
            }
            else
            {
                seqPause(gpSeq);
            }

            SyncUI(hWnd);
            break;

        case IDM_SYNCUI:
            SyncUI(hWnd);
            break;

        case IDM_EXIT:
            SendMessage(hWnd, WM_CLOSE, 0, 0L);
            break;
    }
}

PRIVATE VOID FNLOCAL MWnd_OnCommandToggleChild | ( | HWND | hWnd,
 |  | UINT | id
 | ) |  |

Definition at line 736 of file MainWND.c.

{
    HMENU                   hMenu;
    UINT                    uState;
    HWND*                   phWnd;

    phWnd = (id == IDM_TOOLBAR) ? &ghWndToolbar : &ghWndStatus;

    hMenu = GetMenu(hWnd);
    uState = GetMenuState(hMenu, id, MF_BYCOMMAND);
    if (uState & MF_CHECKED)
    {
        DestroyWindow(*phWnd);
        *phWnd = NULL;
    }
    else
    {
        if (id == IDM_TOOLBAR)
            InitToolbar(hWnd);
        else
            InitStatusBar(hWnd);
    }

    SendMessage(hWnd, WM_SIZE, 0, 0L);

    uState ^= MF_CHECKED;
    uState &= MF_CHECKED;
    CheckMenuItem(hMenu, id, MF_BYCOMMAND|uState);

    SyncUI(hWnd);
}

PRIVATE BOOL FNLOCAL MWnd_OnCreate | ( | HWND | hWnd,
 |  | CREATESTRUCT FAR * | lpCreateStruct
 | ) |  |

Definition at line 421 of file MainWND.c.

{
    HMENU                   hMenu;
    HMENU                   hMenuOptions;
    HMENU                   hMenuPlayThru;
    UINT                    cDevs;
    UINT                    idx;
    RECT                    rc;
    MIDIOUTCAPS             moutCaps;

    gnTimeFormat = IDS_TF_FIRST;

    InitToolbar(hWnd);
    InitStatusBar(hWnd);

    hMenu = GetMenu(hWnd);
    hMenuOptions = GetSubMenu(hMenu, POS_OPTIONS);
    hMenuPlayThru = GetSubMenu(hMenu, POS_PLAYTHRU);

    AppendMenu(hMenuOptions, MF_SEPARATOR, 0, NULL);

    for (idx = 0; idx < N_TIME_FORMATS; idx++)
    {
        AppendMenu(hMenuOptions,
                   MF_ENABLED|MF_STRING,
                   IDS_TF_FIRST + idx,
                   grgszTimeFormats[idx]);
    }

    cDevs = midiOutGetNumDevs();
    if (cDevs)
        AppendMenu(hMenuPlayThru, MF_SEPARATOR, 0, NULL);

    for (idx = 0; idx < cDevs; idx++)
    {
        if (midiOutGetDevCaps(idx, &moutCaps, sizeof(moutCaps)) == MMSYSERR_NOERROR)
        {
            AppendMenu(hMenuPlayThru,
                       MF_ENABLED|MF_STRING,
                       IDM_DEVICES + idx,
                       moutCaps.szPname);
        }
    }

    CheckMenuItem(hMenu, IDM_TOOLBAR, MF_BYCOMMAND|MF_CHECKED);
    CheckMenuItem(hMenu, IDM_STATUS,  MF_BYCOMMAND|MF_CHECKED);
    CheckMenuItem(hMenu, IDM_AUTOPLAY,MF_BYCOMMAND|MF_CHECKED);
    CheckMenuItem(hMenu, gnTimeFormat,MF_BYCOMMAND|MF_CHECKED);
    CheckMenuItem(hMenu, IDM_DEVICES,  MF_BYCOMMAND|MF_CHECKED);

    GetClientRect(hWnd, &rc);

    ghWndTime = CreateWindow(
        gszTWndClass,
        NULL,
        WS_CHILD,
        rc.left, rc.top,
        rc.right-rc.left, rc.bottom-rc.top,
        hWnd,
        NULL,
        lpCreateStruct->hInstance,
        NULL);

    ShowWindow(ghWndTime, SW_RESTORE);

    wsprintf(gszAppTitle, gszAppTitleMask, (LPSTR)gszUntitled);
    SetWindowText(hWnd, gszAppTitle);

    DragAcceptFiles(hWnd, TRUE);

    SyncUI(hWnd);

    return TRUE;
}

PRIVATE VOID FNLOCAL MWnd_OnDestroy ( HWND hWnd )

Definition at line 907 of file MainWND.c.

{
    seqStop(gpSeq);
    PostQuitMessage(0);
}

PRIVATE VOID FNLOCAL MWnd_OnDropFiles | ( | HWND | hWnd,
 |  | HDROP | hDrop
 | ) |  |

Definition at line 648 of file MainWND.c.

{
    PSTR                    pStr;

    /* For multiple selections, we only accept the first file
    */
    DragQueryFile(hDrop, 0, gszOpenName, sizeof(gszOpenName));
    DragFinish(hDrop);

    /* We don't get OpenTitle like we do from GetOpenFileName; need to
    ** figure this out for ourselves
    */
    pStr = gszOpenName + lstrlen(gszOpenName) - 1;

    while (pStr >= gszOpenName && *pStr != '/' && *pStr != '\\' && *pStr != ':')
        pStr--;

    pStr++;
    lstrcpyn(gszOpenTitle, pStr, MAX_FILEPATH);

    AttemptFileOpen(hWnd);

    if (gbAutoPlay && gpSeq->uState == SEQ_S_OPENED)
        FORWARD_WM_COMMAND(hWnd, IDM_PLAY, (HWND)NULL, 0, SendMessage);
}

PRIVATE VOID FNLOCAL MWnd_OnFileOpen ( HWND hWnd )

Definition at line 689 of file MainWND.c.

{
    OPENFILENAME            ofn;

    *gszOpenName = '\0';

  ofn.lStructSize     = sizeof(OPENFILENAME);
  ofn.hwndOwner     = hWnd;
  ofn.lpstrFilter     = gszFilter;
  ofn.lpstrCustomFilter = (LPSTR)NULL;
  ofn.nMaxCustFilter    = 0L;
  ofn.nFilterIndex    = 1L;
  ofn.lpstrFile     = gszOpenName;
  ofn.nMaxFile      = MAX_FILEPATH;
  ofn.lpstrFileTitle    = gszOpenTitle;
  ofn.nMaxFileTitle   = MAX_FILEPATH;
  ofn.lpstrTitle      = (LPSTR)NULL;
  ofn.lpstrInitialDir   = (LPSTR)NULL;
  ofn.Flags       = OFN_HIDEREADONLY|OFN_FILEMUSTEXIST;
  ofn.nFileOffset     = 0;
  ofn.nFileExtension    = 0;
  ofn.lpstrDefExt     = gszDefExtension;

    if (!GetOpenFileName(&ofn))
        return;

    AttemptFileOpen(hWnd);
}

PRIVATE VOID FNLOCAL MWnd_OnGetMinMaxInfo | ( | HWND | hWnd,
 |  | MINMAXINFO FAR * | lpMinMaxInfo
 | ) |  |

Definition at line 516 of file MainWND.c.

{
    RECT                    rc;

    GetWindowRect(hWnd, &rc);

    /* Only go small enough that our client area after children is zero.
    */
    lpMinMaxInfo->ptMinTrackSize.y =
        (rc.bottom - rc.top) -
        (grcTWnd.bottom - grcTWnd.top);
}

PRIVATE VOID FNLOCAL MWnd_OnPaint ( HWND hWnd )

Definition at line 622 of file MainWND.c.

{
    PAINTSTRUCT             ps;
    HDC                     hDC;

    hDC = BeginPaint(hWnd, &ps);
    EndPaint(hWnd, &ps);
}

PRIVATE VOID FNLOCAL MWnd_OnSize | ( | HWND | hWnd,
 |  | UINT | state,
 |  | int | cx,
 |  | int | cy
 | ) |  |

Definition at line 549 of file MainWND.c.

{
    RECT                    rc;
    RECT                    rcClient;

    GetClientRect(hWnd, &rcClient);
    if (ghWndToolbar != NULL)
    {
        /* Cause the toolbar to be aware of the size change
        */
        FORWARD_WM_SIZE(ghWndToolbar, SIZE_RESTORED, 0, 0, SendMessage);

        GetWindowRect(ghWndToolbar, &rc);
        rcClient.top += (rc.bottom - rc.top);
    }

    if (ghWndStatus != NULL)
    {
        ResizeStatusBar(hWnd);

        /* Cause the status bar to be aware of the size change
        */
        FORWARD_WM_SIZE(ghWndStatus, SIZE_RESTORED, 0, 0, SendMessage);

        GetWindowRect(ghWndStatus, &rc);
        rcClient.bottom -= (rc.bottom - rc.top);
    }

    /* Do we need to resize entire window so the tool/status bars
    ** don't overlap? (The only case where this can happen is
    ** on creation of one of the two -- we set minimum tracking so
    ** a user can't manually resize the window to cause this
    ** condition).
    */
    if (rcClient.bottom < rcClient.top)
    {
        GetWindowRect(hWnd, &rc);
        SetWindowPos(hWnd,
                     (HWND)NULL,
                     0, 0,
                     rc.right - rc.left + 1,
                     rc.bottom - rc.top + 1 - rcClient.top - rcClient.bottom,
                     SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOZORDER);
    }

    SetWindowPos(ghWndTime,
                 (HWND)NULL,
                 rcClient.left,
                 rcClient.top,
                 rcClient.right - rcClient.left,
                 rcClient.bottom - rcClient.top,
                 SWP_NOACTIVATE|SWP_NOZORDER);

    FORWARD_WM_SIZE(ghWndTime, SIZE_RESTORED, 0, 0, SendMessage);
}

LRESULT CALLBACK MWnd_WndProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 934 of file MainWND.c.

{
    switch( msg )
    {
        HANDLE_MSG(hWnd, WM_CREATE,         MWnd_OnCreate);
        HANDLE_MSG(hWnd, WM_GETMINMAXINFO,  MWnd_OnGetMinMaxInfo);
        HANDLE_MSG(hWnd, WM_SIZE,           MWnd_OnSize);
        HANDLE_MSG(hWnd, WM_PAINT,          MWnd_OnPaint);
        HANDLE_MSG(hWnd, WM_DROPFILES,      MWnd_OnDropFiles);
        HANDLE_MSG(hWnd, WM_COMMAND,        MWnd_OnCommand);
        HANDLE_MSG(hWnd, WM_DESTROY,        MWnd_OnDestroy);

        case MMSG_DONE:
            FORWARD_WM_COMMAND(ghWndTime, IDM_STOP, 0, 0, SendMessage);

      if (gpSeq->uState != SEQ_S_OPENED)
        DPF(1, "MMSG_DONE and state %u", gpSeq->uState);

            SyncUI(hWnd);
            break;

        default:
            return DefWindowProc(hWnd, msg, wParam, lParam);
    }

    return 0;
}

PRIVATE BOOL FNLOCAL PrerollAndWait ( HWND hWnd )

Definition at line 380 of file MainWND.c.

{
    PREROLL                 preroll;
    MMRESULT                mmrc;

    preroll.tkBase = 0;
    preroll.tkEnd  = gpSeq->tkLength;

    gpSeq->uDeviceID = guDevice;

    if (MMSYSERR_NOERROR != (mmrc = seqPreroll(gpSeq, &preroll)))
  {
        Error(hWnd, IDS_PREROLLFAILED, mmrc);
        return FALSE;
  }

  return TRUE;
}

PRIVATE VOID FNLOCAL ResizeStatusBar ( HWND hWnd )

Definition at line 184 of file MainWND.c.

{
    RECT                    rc;
    int                     rnPaneEdge[SB_N_PANES];

    GetClientRect(hWnd, &rc);

    /* SB_SETPARTS expects:
    **  wParam == Number of panes in status bar.
    **  lParam == Pointer to an array of int's indicating the right-hand
    **            coordinate of each pane.
    */
    rnPaneEdge[SB_PANE_STATE] = rc.right - gnSB_TFPaneSize;
    rnPaneEdge[SB_PANE_TFMT]  = -1;

    SendMessage(ghWndStatus,
                SB_SETPARTS,
                SB_N_PANES,
                (DWORD)(INT_PTR)(rnPaneEdge));
}

PRIVATE VOID FNLOCAL SetOneAction | ( | HWND | hWnd,
 |  | int | nMenuID,
 |  | BOOL | fEnable
 | ) |  |

Definition at line 299 of file MainWND.c.

{
    EnableMenuItem(GetMenu(hWnd),
                   nMenuID,
                   MF_BYCOMMAND|(fEnable ? MF_ENABLED : MF_DISABLED));

    SendMessage(ghWndToolbar,
                TB_ENABLEBUTTON,
                nMenuID,
                (DWORD)fEnable);
}

PRIVATE VOID FNLOCAL SyncUI ( HWND hWnd )

Definition at line 226 of file MainWND.c.

{
    WORD                    wActionFlags;
    UINT                    uState;
    char                    szState[40];
    BOOL                    fPress;

    wActionFlags = 0;
    uState = SEQ_S_NOFILE;

    if (gpSeq != NULL)
    {
        uState = gpSeq->uState;
        switch (uState)
        {
        case SEQ_S_NOFILE:
            wActionFlags = SUI_F_CANSELDEVICE;
            break;

        case SEQ_S_OPENED:
        case SEQ_S_PREROLLED:
            wActionFlags = SUI_F_CANPLAY|SUI_F_CANSELDEVICE;
            break;

        case SEQ_S_PAUSED:
        case SEQ_S_PLAYING:
            wActionFlags = SUI_F_CANPAUSE|SUI_F_CANSTOP;
            break;

        case SEQ_S_PREROLLING:
        case SEQ_S_STOPPING:
//            assert(0);
            wActionFlags = 0;
            break;
        }
    }

    fPress = (gpSeq->uState == SEQ_S_PAUSED);
    SendMessage(ghWndToolbar,
                TB_PRESSBUTTON,
                IDM_PAUSE,
                fPress);

    SetOneAction(hWnd, IDM_PLAY,   wActionFlags & SUI_F_CANPLAY);
    SetOneAction(hWnd, IDM_PAUSE,  wActionFlags & SUI_F_CANPAUSE);
    SetOneAction(hWnd, IDM_STOP,   wActionFlags & SUI_F_CANSTOP);

    EnableMenuItem(GetMenu(hWnd),
                   POS_PLAYTHRU,
                   MF_BYPOSITION|((wActionFlags & SUI_F_CANSELDEVICE) ? MF_ENABLED : MF_DISABLED));

    DrawMenuBar(hWnd);

    szState[0] = '\0';
    LoadString(ghInst, IDS_STATES + uState, szState, sizeof(szState));
    SendMessage(ghWndStatus, SB_SETTEXT, SB_PANE_STATE, (LPARAM)(LPSTR)szState);

    InvalidateRect(ghWndTime, NULL, TRUE);
}

Variable Documentation

PRIVATE TBBUTTON gatbButton[]
Initial value:
{
    {0, -1,             TBSTATE_ENABLED, TBSTYLE_SEP,    0, 0,  0, -1},
    {0, IDM_OPEN,       TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0,  0, -1},
    {0, -1,             TBSTATE_ENABLED, TBSTYLE_SEP,    0, 0,  0, -1},
    {2, IDM_PLAY,       0,               TBSTYLE_BUTTON, 0, 0,  0, -1},
    {3, IDM_STOP,       0,               TBSTYLE_BUTTON, 0, 0,  0, -1},
    {4, IDM_PAUSE,      0,               TBSTYLE_BUTTON, 0, 0,  0, -1},
}

Definition at line 52 of file MainWND.c.

PRIVATE BOOL gbAutoPlay = TRUE

Definition at line 49 of file MainWND.c.

PRIVATE HWND ghWndStatus = NULL

Definition at line 38 of file MainWND.c.

PRIVATE HWND ghWndTime = NULL

Definition at line 39 of file MainWND.c.

PRIVATE HWND ghWndToolbar = NULL

Definition at line 37 of file MainWND.c.

PRIVATE int gnSB_TFPaneSize = 0

Definition at line 41 of file MainWND.c.

PRIVATE char gszAppTitle[80] = ""

Definition at line 40 of file MainWND.c.

PRIVATE char BCODE gszDefExtension[] = "MID"

Definition at line 48 of file MainWND.c.

PRIVATE char BCODE gszFilter[] = "All Files (*.*)\0*.*\0"

Definition at line 44 of file MainWND.c.

PRIVATE char gszOpenName[MAX_FILEPATH] = ""

Definition at line 42 of file MainWND.c.

PRIVATE char gszOpenTitle[MAX_FILEPATH] = ""

Definition at line 43 of file MainWND.c.

PRIVATE UINT guDevice = 0

Definition at line 50 of file MainWND.c.

Generated on Wed Nov 13 2024 16:53:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Audio/MidiPlyr/MidiPlyr.c File Reference

  • Multimedia
  • Audio
  • MidiPlyr
Defines | Functions | Variables

MidiPlyr.c File Reference

#include <windows.h>
#include <shellapi.h>
#include <windowsx.h>
#include <mmsystem.h>
#include <commdlg.h>
#include <commctrl.h>
#include <ctype.h>
#include "debug.h"
#include "MIDIPlyr.H"

Go to the source code of this file.

Defines

#define | _INC_SHELLAPI

Functions

PRIVATE BOOL FNLOCAL | InitApp (HINSTANCE hInst)
PRIVATE BOOL FNLOCAL | InitInstance (HINSTANCE hInst, int nCmdShow)
PRIVATE VOID FNLOCAL | TerminateInstance (VOID)
int PASCAL | WinMain (HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpstrCmdLine, int nCmdShow)

Variables

PUBLIC HINSTANCE | ghInst = NULL
PUBLIC int | gnTimeFormat = 0
PUBLIC PSEQ | gpSeq = NULL
PUBLIC RECT | grcTWnd = {0, 0, 0, 0}
PUBLIC char | grgszTimeFormats [N_TIME_FORMATS][CB_TIME_FORMATS] = {0}
PUBLIC char | gszAppLongName [80] = ""
PUBLIC char | gszAppTitleMask [80] = ""
PUBLIC char BCODE | gszMWndClass [] = "MIDIPlyrMWnd"
PUBLIC char BCODE | gszTWndClass [] = "MIDIPlyrTWnd"
PUBLIC char | gszUntitled [80] = ""

Define Documentation

#define _INC_SHELLAPI

Definition at line 20 of file MidiPlyr.c.

Function Documentation

BOOL FNLOCAL InitApp ( HINSTANCE hInst )

Definition at line 110 of file MidiPlyr.c.

{
    WNDCLASS                wc;

    InitCommonControls();

    /* Don't specify CS_HREDRAW or CS_VREDRAW if you're going to use the
    ** commctrl status or toolbar -- invalidate the (remaining) client
    ** area yourself if you want this behavior. This will allow the child
    ** control redraws to be much more efficient.
    */
    wc.style =          0;
    wc.lpfnWndProc =    MWnd_WndProc;
    wc.cbClsExtra =     0;
    wc.cbWndExtra =     0;
    wc.hInstance =      hInst;
    wc.hIcon =          LoadIcon(hInst, MAKEINTRESOURCE(ID_ICON));
    wc.hCursor =        LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground =  (HBRUSH)(COLOR_BTNFACE+1);
    wc.lpszMenuName =   MAKEINTRESOURCE(ID_MENU);
    wc.lpszClassName =  (LPCSTR)gszMWndClass;

    RegisterClass(&wc);

    wc.style =          CS_HREDRAW|CS_VREDRAW;
    wc.lpfnWndProc =    TWnd_WndProc;
    wc.cbClsExtra =     0;
    wc.cbWndExtra =     0;
    wc.hInstance =      hInst;
    wc.hIcon =          LoadIcon(hInst, MAKEINTRESOURCE(ID_ICON));
    wc.hCursor =        LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground =  (HBRUSH)(COLOR_WINDOW+1);
    wc.lpszMenuName =   NULL;
    wc.lpszClassName =  (LPCSTR)gszTWndClass;

    RegisterClass(&wc);

    return TRUE;
}

PRIVATE BOOL FNLOCAL InitInstance | ( | HINSTANCE | hInst,
 |  | int | nCmdShow
 | ) |  |

Definition at line 171 of file MidiPlyr.c.

{
    HWND                    hWnd;
    int                     idx;

    DbgInitialize(TRUE);

    ghInst = hInst;

    LoadString(hInst, IDS_APPTITLEMASK, gszAppTitleMask, sizeof(gszAppTitleMask));
    LoadString(hInst, IDS_APPNAME,      gszAppLongName,  sizeof(gszAppLongName));
    LoadString(hInst, IDS_UNTITLED,     gszUntitled,     sizeof(gszUntitled));

    for (idx = 0; idx < N_TIME_FORMATS; idx++)
    {
        *grgszTimeFormats[idx] = '\0';
        LoadString(hInst,
                   IDS_TF_FIRST+idx,
                   grgszTimeFormats[idx],
                   sizeof(grgszTimeFormats[idx]));
    }

    if ((gpSeq = (PSEQ)LocalAlloc(LPTR, sizeof(SEQ))) == NULL)
        return FALSE;

    gpSeq->cBuffer  = C_MIDI_BUFFERS;
    gpSeq->cbBuffer = CB_MIDI_BUFFERS;

    if (seqAllocBuffers(gpSeq) != MMSYSERR_NOERROR)
        return FALSE;

    hWnd = CreateWindow(
        gszMWndClass,
        NULL,
        WS_OVERLAPPEDWINDOW|WS_CLIPCHILDREN,
        CW_USEDEFAULT,CW_USEDEFAULT,
        CW_USEDEFAULT,CW_USEDEFAULT,
        HWND_DESKTOP,
        NULL,
        hInst,
        NULL);

    if (hWnd == (HWND)NULL)
        return FALSE;

    gpSeq->hWnd = hWnd;

    ShowWindow(hWnd, nCmdShow);

    return TRUE;
}

VOID FNLOCAL TerminateInstance ( VOID )

Definition at line 232 of file MidiPlyr.c.

{
    if (gpSeq != NULL)
    {
        seqFreeBuffers(gpSeq);
        LocalFree((HLOCAL)gpSeq);
        gpSeq = NULL;
    }
}

int PASCAL WinMain | ( | HINSTANCE | hInst,
 |  | HINSTANCE | hPrevInst,
 |  | LPSTR | lpstrCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 68 of file MidiPlyr.c.

{
    MSG                     msg;

    if (hPrevInst == NULL)
        if (!InitApp(hInst))
            return 0;

    if (!InitInstance(hInst, nCmdShow))
    {
        TerminateInstance();
        return 0;
    }

    while (GetMessage(&msg, NULL, 0, 0))
    {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }

    TerminateInstance();

    return (int) msg.wParam;
}

Variable Documentation

PUBLIC HINSTANCE ghInst = NULL

Name of app.

Definition at line 37 of file MidiPlyr.c.

PUBLIC int gnTimeFormat = 0

Definition at line 44 of file MidiPlyr.c.

PUBLIC PSEQ gpSeq = NULL

Definition at line 38 of file MidiPlyr.c.

PUBLIC RECT grcTWnd = {0, 0, 0, 0}

Definition at line 43 of file MidiPlyr.c.

PUBLIC char grgszTimeFormats[N_TIME_FORMATS][CB_TIME_FORMATS] = {0}

Definition at line 42 of file MidiPlyr.c.

PUBLIC char gszAppLongName[80] = ""

Definition at line 40 of file MidiPlyr.c.

PUBLIC char gszAppTitleMask[80] = ""

Definition at line 41 of file MidiPlyr.c.

PUBLIC char BCODE gszMWndClass[] = "MIDIPlyrMWnd"

Definition at line 35 of file MidiPlyr.c.

PUBLIC char BCODE gszTWndClass[] = "MIDIPlyrTWnd"

Definition at line 36 of file MidiPlyr.c.

PUBLIC char gszUntitled[80] = ""

Definition at line 39 of file MidiPlyr.c.

Generated on Wed Nov 13 2024 16:53:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Audio/MidiPlyr/MidiPlyr.h File Reference

  • Multimedia
  • Audio
  • MidiPlyr
Defines | Functions | Variables

MidiPlyr.h File Reference

#include "seq.h"

Go to the source code of this file.

Defines

#define | C_MIDI_BUFFERS 4
#define | CB_MIDI_BUFFERS 1024
#define | CB_TIME_FORMATS 40
#define | ID_ICON 50
#define | ID_MENU 51
#define | IDB_TOOLBAR 200
#define | IDC_STATBAR 301
#define | IDC_TOOLBAR 300
#define | IDM_ABOUT 101
#define | IDM_AUTOPLAY 108
#define | IDM_DEVICES 130
#define | IDM_DEVMAX 149
#define | IDM_DEVMIN 129
#define | IDM_EXIT 100
#define | IDM_MAPPER 129
#define | IDM_OPEN 102
#define | IDM_PAUSE 104
#define | IDM_PLAY 103
#define | IDM_STATUS 107
#define | IDM_STOP 105
#define | IDM_SYNCUI 150
#define | IDM_TOOLBAR 106
#define | IDS_APPNAME 1001
#define | IDS_APPTITLEMASK 1000
#define | IDS_HMS 1010
#define | IDS_NOFILE (IDS_STATES + SEQ_S_NOFILE)
#define | IDS_OPENED (IDS_STATES + SEQ_S_OPENED)
#define | IDS_OPENFAILED 1050
#define | IDS_PAUSED (IDS_STATES + SEQ_S_PAUSED)
#define | IDS_PLAYING (IDS_STATES + SEQ_S_PLAYING)
#define | IDS_PREROLLED (IDS_STATES + SEQ_S_PREROLLED)
#define | IDS_PREROLLFAILED 1051
#define | IDS_PREROLLING (IDS_STATES + SEQ_S_PREROLLING)
#define | IDS_STATES 1020
#define | IDS_STOPFAILED 1053
#define | IDS_STOPPING (IDS_STATES + SEQ_S_STOPPING)
#define | IDS_TESTERR 1052
#define | IDS_TF_FIRST 1010
#define | IDS_TF_LAST 1011
#define | IDS_TICKS 1011
#define | IDS_UNTITLED 1002
#define | MAX_FILEPATH 256
#define | N_TIME_FORMATS (IDS_TF_LAST - IDS_TF_FIRST + 1)
#define | POS_ACTIONS 1
#define | POS_FILE 0
#define | POS_OPTIONS 2
#define | POS_PLAYTHRU 3
#define | SB_N_PANES 2
#define | SB_PANE_STATE 0
#define | SB_PANE_TFMT 1

Functions

HFONT FNLOCAL | CreateScaledFont (HDC hDC, LPRECT lpRect, LPSTR lpszFormat, int anPosX[], int *nPosY)
VOID FNLOCAL | EmbossedTextOut (HDC hDC, int x, int y, LPSTR lpsz, UINT cb, COLORREF crText, COLORREF crShadow, int cx, int cy)
VOID FNLOCAL | Error (HWND hWnd, int nErrDesc, MMRESULT mmrc)
VOID FNLOCAL | InitToolbar (HWND hWnd)
VOID FNLOCAL | MessagePump (VOID)
LRESULT CALLBACK | MWnd_WndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
LRESULT CALLBACK | TWnd_WndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)

Variables

HINSTANCE | ghInst
int | gnTimeFormat
PSEQ gpSeq
RECT | grcTWnd
char | grgszTimeFormats [N_TIME_FORMATS][CB_TIME_FORMATS]
char | gszAppLongName [80]
char | gszAppTitleMask [80]
char BCODE | gszMWndClass []
char BCODE | gszTWndClass []
char | gszUntitled [80]

Define Documentation

#define C_MIDI_BUFFERS 4

Definition at line 27 of file MidiPlyr.h.

#define CB_MIDI_BUFFERS 1024

Definition at line 28 of file MidiPlyr.h.

#define CB_TIME_FORMATS 40

Definition at line 97 of file MidiPlyr.h.

#define ID_ICON 50

Definition at line 46 of file MidiPlyr.h.

#define ID_MENU 51

Definition at line 47 of file MidiPlyr.h.

#define IDB_TOOLBAR 200

Definition at line 66 of file MidiPlyr.h.

#define IDC_STATBAR 301

Definition at line 69 of file MidiPlyr.h.

#define IDC_TOOLBAR 300

Definition at line 68 of file MidiPlyr.h.

#define IDM_ABOUT 101

Definition at line 50 of file MidiPlyr.h.

#define IDM_AUTOPLAY 108

Definition at line 57 of file MidiPlyr.h.

#define IDM_DEVICES 130

Definition at line 61 of file MidiPlyr.h.

#define IDM_DEVMAX 149

Definition at line 62 of file MidiPlyr.h.

#define IDM_DEVMIN 129

Definition at line 59 of file MidiPlyr.h.

#define IDM_EXIT 100

Definition at line 49 of file MidiPlyr.h.

#define IDM_MAPPER 129

Definition at line 60 of file MidiPlyr.h.

#define IDM_OPEN 102

Definition at line 51 of file MidiPlyr.h.

#define IDM_PAUSE 104

Definition at line 53 of file MidiPlyr.h.

#define IDM_PLAY 103

Definition at line 52 of file MidiPlyr.h.

#define IDM_STATUS 107

Definition at line 56 of file MidiPlyr.h.

#define IDM_STOP 105

Definition at line 54 of file MidiPlyr.h.

#define IDM_SYNCUI 150

Definition at line 64 of file MidiPlyr.h.

#define IDM_TOOLBAR 106

Definition at line 55 of file MidiPlyr.h.

#define IDS_APPNAME 1001

Definition at line 72 of file MidiPlyr.h.

#define IDS_APPTITLEMASK 1000

Definition at line 71 of file MidiPlyr.h.

#define IDS_HMS 1010

Definition at line 79 of file MidiPlyr.h.

#define IDS_NOFILE (IDS_STATES + SEQ_S_NOFILE)

Definition at line 88 of file MidiPlyr.h.

#define IDS_OPENED (IDS_STATES + SEQ_S_OPENED)

Definition at line 89 of file MidiPlyr.h.

#define IDS_OPENFAILED 1050

Definition at line 99 of file MidiPlyr.h.

#define IDS_PAUSED (IDS_STATES + SEQ_S_PAUSED)

Definition at line 93 of file MidiPlyr.h.

#define IDS_PLAYING (IDS_STATES + SEQ_S_PLAYING)

Definition at line 92 of file MidiPlyr.h.

#define IDS_PREROLLED (IDS_STATES + SEQ_S_PREROLLED)

Definition at line 91 of file MidiPlyr.h.

#define IDS_PREROLLFAILED 1051

Definition at line 100 of file MidiPlyr.h.

#define IDS_PREROLLING (IDS_STATES + SEQ_S_PREROLLING)

Definition at line 90 of file MidiPlyr.h.

#define IDS_STATES 1020

Definition at line 87 of file MidiPlyr.h.

#define IDS_STOPFAILED 1053

Definition at line 102 of file MidiPlyr.h.

#define IDS_STOPPING (IDS_STATES + SEQ_S_STOPPING)

Definition at line 94 of file MidiPlyr.h.

#define IDS_TESTERR 1052

Definition at line 101 of file MidiPlyr.h.

#define IDS_TF_FIRST 1010

Definition at line 78 of file MidiPlyr.h.

#define IDS_TF_LAST 1011

Definition at line 81 of file MidiPlyr.h.

#define IDS_TICKS 1011

Definition at line 80 of file MidiPlyr.h.

#define IDS_UNTITLED 1002

Definition at line 73 of file MidiPlyr.h.

#define MAX_FILEPATH 256

Definition at line 23 of file MidiPlyr.h.

#define N_TIME_FORMATS (IDS_TF_LAST - IDS_TF_FIRST + 1)

Definition at line 96 of file MidiPlyr.h.

#define POS_ACTIONS 1

Definition at line 34 of file MidiPlyr.h.

#define POS_FILE 0

Definition at line 33 of file MidiPlyr.h.

#define POS_OPTIONS 2

Definition at line 35 of file MidiPlyr.h.

#define POS_PLAYTHRU 3

Definition at line 36 of file MidiPlyr.h.

#define SB_N_PANES 2

Definition at line 40 of file MidiPlyr.h.

#define SB_PANE_STATE 0

Definition at line 41 of file MidiPlyr.h.

#define SB_PANE_TFMT 1

Definition at line 42 of file MidiPlyr.h.

Function Documentation

HFONT FNLOCAL CreateScaledFont | ( | HDC | hDC,
 |  | LPRECT | lpRect,
 |  | LPSTR | lpszFormat,
 |  | int | anPosX[],
 |  | int * | nPosY
 | ) |  |

Definition at line 193 of file UIUTILS.c.

{
    LOGFONT                 lf;
    HFONT                   hFont;
    HFONT                   h;
    LONG                    FormatWidth;
    LONG                    ScaledClientWidth;
    LONG                    ScaledClientHeight;
    LONG                    AspectN;
    LONG                    AspectD;
    int                     nPosX;
    UINT                    cb;
    UINT                    ii;
    UINT                    jj;
    SIZE                    size;

    ScaledClientHeight =  ((lpRect->bottom - lpRect->top)) * 3 / 4;
    ScaledClientWidth  =  ((lpRect->right  - lpRect->left)) * 3 / 4;

    _fmemset(&lf, 0, sizeof(lf));
    lf.lfHeight         = -(int)ScaledClientHeight;
    lf.lfWeight         = FW_BOLD;
    lf.lfCharSet        = ANSI_CHARSET;
    lf.lfClipPrecision  = CLIP_DEFAULT_PRECIS;
    lf.lfQuality        = PROOF_QUALITY;
    lf.lfPitchAndFamily = FF_ROMAN|DEFAULT_PITCH;
    lstrcpyn(lf.lfFaceName, gszFace, sizeof(lf.lfFaceName) / sizeof(lf.lfFaceName[0]));

    hFont = CreateFontIndirect(&lf);
    h = SelectObject(hDC, hFont);

    cb = lstrlen(lpszFormat);
    GetTextExtentPoint(hDC, lpszFormat, cb, &size);

    AspectN = (LONG)size.cx;
    AspectD = (LONG)size.cy;

    FormatWidth = (ScaledClientHeight*AspectN)/AspectD;

    if (FormatWidth > ScaledClientWidth)
    {
        ScaledClientHeight =
            (ScaledClientWidth*AspectD)/AspectN;
      SelectObject(hDC, h);
        DeleteObject(hFont);

        lf.lfHeight = -(int)ScaledClientHeight;

        hFont = CreateFontIndirect(&lf);

        SelectObject(hDC, hFont);
        GetTextExtentPoint(hDC, lpszFormat, cb, &size);
    }

    *nPosY  = grcTWnd.top  + (grcTWnd.bottom- grcTWnd.top  - size.cy)/2;
    nPosX   = grcTWnd.left + (grcTWnd.right - grcTWnd.left - size.cx)/2;

    ii = 0;
    for (jj=0; jj < cb; jj++)
    {
        if (jj != 0)
            GetTextExtentPoint(hDC, lpszFormat, jj, &size);
        else
            size.cx = 0;

        anPosX[ii++] = nPosX + size.cx;
    }

    SelectObject(hDC, h);

    return hFont;
}

VOID FNLOCAL EmbossedTextOut | ( | HDC | hDC,
 |  | int | x,
 |  | int | y,
 |  | LPSTR | lpsz,
 |  | UINT | cb,
 |  | COLORREF | crText,
 |  | COLORREF | crShadow,
 |  | int | cx,
 |  | int | cy
 | ) |  |

Definition at line 122 of file UIUTILS.c.

{
    COLORREF                crOld;
    UINT                    uMode;
    SIZE                    sizeText;
    RECT                    rcText;

    /* If text length is -1, use lstrlen to get the length
    ** of the text.
    */
    if (cb == -1)
        cb = lstrlen(lpsz);

    /* If the shadow or text color is -1, use the
    ** system color for that one.
    */
    if (crShadow == (COLORREF)-1)
        crShadow = GetSysColor (COLOR_BTNSHADOW);
    if (crText == (COLORREF)-1)
        crText = GetSysColor (COLOR_BTNTEXT);

    /* setup the DC, saving off the old values
    */
    uMode = SetBkMode(hDC, OPAQUE);
    crOld = SetTextColor(hDC, crShadow);

    /* Draw the text at the desired offset using the
    ** shadow color, then again at the normal position
    ** using the text color.  This will the text an 'Embossed'
    ** or 'drop shadowed' look depending on what shadow color
    ** and offset are used.
    */
    GetTextExtentPoint32(hDC, lpsz, cb, &sizeText);
    rcText.left   = x;    rcText.right  = x+cx+sizeText.cx;
    rcText.top    = y;    rcText.bottom = y+cy+sizeText.cy;
    ExtTextOut(hDC, x+cx, y+cy, ETO_OPAQUE, &rcText, lpsz, cb, NULL);
    SetBkMode(hDC, TRANSPARENT);
    SetTextColor(hDC, crText);
    ExtTextOut(hDC, x, y, 0, NULL, lpsz, cb, NULL);

    /* restore the DC
    */
    SetTextColor(hDC, crOld);
    SetBkMode(hDC, uMode);
}

VOID FNLOCAL Error | ( | HWND | hWnd,
 |  | int | nErrDesc,
 |  | MMRESULT | mmrc
 | ) |  |

Definition at line 59 of file UIUTILS.c.

{
    LoadString(ghInst, nErrDesc, gszErrDescTxt, sizeof(gszErrDescTxt));
    mciGetErrorString(mmrc, gszErrCodeTxt, sizeof(gszErrCodeTxt));

    wsprintf(gszErrStr, gszErrFmt, (LPSTR)gszErrDescTxt, (LPSTR)gszErrCodeTxt);
    MessageBox(hWnd, gszErrStr, gszAppLongName, MB_ICONEXCLAMATION|MB_OK);
}

VOID FNLOCAL InitToolbar ( HWND hWnd )

Definition at line 93 of file MainWND.c.

{
    ghWndToolbar = CreateToolbarEx(hWnd,
                                   WS_CHILD|WS_CLIPSIBLINGS|WS_CLIPCHILDREN,
                                   IDC_TOOLBAR,
                                   BITMAP_COUNT,
                                   ghInst,
                                   IDB_TOOLBAR,
                                   gatbButton,
                                   BUTTON_COUNT,
                                   0,  0,
                                   0,  0,
                                   sizeof(TBBUTTON));

    if (ghWndToolbar)
        ShowWindow(ghWndToolbar, SW_RESTORE);
}

VOID FNLOCAL MessagePump ( VOID )

Definition at line 87 of file UIUTILS.c.

{
    MSG                     msg;

    while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
    {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }
}

LRESULT CALLBACK MWnd_WndProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 934 of file MainWND.c.

{
    switch( msg )
    {
        HANDLE_MSG(hWnd, WM_CREATE,         MWnd_OnCreate);
        HANDLE_MSG(hWnd, WM_GETMINMAXINFO,  MWnd_OnGetMinMaxInfo);
        HANDLE_MSG(hWnd, WM_SIZE,           MWnd_OnSize);
        HANDLE_MSG(hWnd, WM_PAINT,          MWnd_OnPaint);
        HANDLE_MSG(hWnd, WM_DROPFILES,      MWnd_OnDropFiles);
        HANDLE_MSG(hWnd, WM_COMMAND,        MWnd_OnCommand);
        HANDLE_MSG(hWnd, WM_DESTROY,        MWnd_OnDestroy);

        case MMSG_DONE:
            FORWARD_WM_COMMAND(ghWndTime, IDM_STOP, 0, 0, SendMessage);

      if (gpSeq->uState != SEQ_S_OPENED)
        DPF(1, "MMSG_DONE and state %u", gpSeq->uState);

            SyncUI(hWnd);
            break;

        default:
            return DefWindowProc(hWnd, msg, wParam, lParam);
    }

    return 0;
}

LRESULT CALLBACK TWnd_WndProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 445 of file TIMEWND.c.

{
    switch( msg )
    {
        HANDLE_MSG(hWnd, WM_CREATE,         TWnd_OnCreate);
        HANDLE_MSG(hWnd, WM_SIZE,           TWnd_OnSize);
        HANDLE_MSG(hWnd, WM_PAINT,          TWnd_OnPaint);
        HANDLE_MSG(hWnd, WM_COMMAND,        TWnd_OnCommand);
        HANDLE_MSG(hWnd, WM_DESTROY,        TWnd_OnDestroy);
        HANDLE_MSG(hWnd, WM_TIMER,          TWnd_OnTimer);

        default:
            return DefWindowProc(hWnd, msg, wParam, lParam);
    }

    return 0;
}

Variable Documentation

HINSTANCE ghInst

Definition at line 24 of file ole2ui.c.

int gnTimeFormat

Definition at line 44 of file MidiPlyr.c.

PSEQ gpSeq

Definition at line 38 of file MidiPlyr.c.

RECT grcTWnd

Definition at line 43 of file MidiPlyr.c.

char grgszTimeFormats[N_TIME_FORMATS][CB_TIME_FORMATS]

Definition at line 42 of file MidiPlyr.c.

char gszAppLongName[80]

Definition at line 40 of file MidiPlyr.c.

char gszAppTitleMask[80]

Definition at line 41 of file MidiPlyr.c.

char BCODE gszMWndClass[]

Definition at line 35 of file MidiPlyr.c.

char BCODE gszTWndClass[]

Definition at line 36 of file MidiPlyr.c.

char gszUntitled[80]

Definition at line 39 of file MidiPlyr.c.

Generated on Wed Nov 13 2024 16:53:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Audio/MidiPlyr/MulDiv32.h File Reference

  • Multimedia
  • Audio
  • MidiPlyr
Defines | Functions

MulDiv32.h File Reference

Go to the source code of this file.

Defines

#define | INLINE __inline
#define | muldiv32 MulDivRN
#define | muldivrd32 MulDivRD
#define | muldivru32 MulDivRU

Functions

INLINE LONG | MulDiv32 (LONG a, LONG b, LONG c)
INLINE DWORD | MulDivRD (DWORD a, DWORD b, DWORD c)
INLINE DWORD | MulDivRN (DWORD a, DWORD b, DWORD c)
INLINE DWORD | MulDivRU (DWORD a, DWORD b, DWORD c)

Define Documentation

#define INLINE __inline

Definition at line 30 of file MulDiv32.h.

#define muldiv32 MulDivRN

Definition at line 235 of file MulDiv32.h.

#define muldivrd32 MulDivRD

Definition at line 236 of file MulDiv32.h.

#define muldivru32 MulDivRU

Definition at line 237 of file MulDiv32.h.

Function Documentation

INLINE LONG MulDiv32 | ( | LONG | a,
 |  | LONG | b,
 |  | LONG | c
 | ) |  |

Definition at line 158 of file MulDiv32.h.

    {
        _asm _emit 0x66 _asm    mov     ax,word ptr a   //  mov  eax, a
        _asm _emit 0x66 _asm    mov     bx,word ptr b   //  mov  ebx, b
        _asm _emit 0x66 _asm    mov     cx,word ptr c   //  mov  ecx, c
        _asm _emit 0x66 _asm    imul    bx              //  imul ebx
        _asm _emit 0x66 _asm    idiv    cx              //  idiv ecx
        _asm _emit 0x66                                 //  shld edx, eax, 16
        _asm _emit 0x0F
        _asm _emit 0xA4
        _asm _emit 0xC2
        _asm _emit 0x10

    } // MulDiv32()

INLINE DWORD MulDivRD | ( | DWORD | a,
 |  | DWORD | b,
 |  | DWORD | c
 | ) |  |

Definition at line 212 of file MulDiv32.h.

    {
        _asm _emit 0x66 _asm    mov     ax,word ptr a   //  mov  eax, a
        _asm _emit 0x66 _asm    mov     bx,word ptr b   //  mov  ebx, b
        _asm _emit 0x66 _asm    mov     cx,word ptr c   //  mov  ecx, c
        _asm _emit 0x66 _asm    mul     bx              //  mul  ebx
        _asm _emit 0x66 _asm    div     cx              //  div  ecx
        _asm _emit 0x66                                 //  shld edx, eax, 16
        _asm _emit 0x0F
        _asm _emit 0xA4
        _asm _emit 0xC2
        _asm _emit 0x10

    } // MulDivRD32()

INLINE DWORD MulDivRN | ( | DWORD | a,
 |  | DWORD | b,
 |  | DWORD | c
 | ) |  |

Definition at line 173 of file MulDiv32.h.

    {
        _asm _emit 0x66 _asm    mov     ax,word ptr a   //  mov  eax, a
        _asm _emit 0x66 _asm    mov     bx,word ptr b   //  mov  ebx, b
        _asm _emit 0x66 _asm    mov     cx,word ptr c   //  mov  ecx, c
        _asm _emit 0x66 _asm    mul     bx              //  mul  ebx
        _asm _emit 0x66 _asm    mov     bx,cx           //  mov  ebx,ecx
        _asm _emit 0x66 _asm    shr     bx,1            //  sar  ebx,1
        _asm _emit 0x66 _asm    add     ax,bx           //  add  eax,ebx
        _asm _emit 0x66 _asm    adc     dx,0            //  adc  edx,0
        _asm _emit 0x66 _asm    div     cx              //  div  ecx
        _asm _emit 0x66                                 //  shld edx, eax, 16
        _asm _emit 0x0F
        _asm _emit 0xA4
        _asm _emit 0xC2
        _asm _emit 0x10

    } // MulDiv32()

INLINE DWORD MulDivRU | ( | DWORD | a,
 |  | DWORD | b,
 |  | DWORD | c
 | ) |  |

Definition at line 192 of file MulDiv32.h.

    {
        _asm _emit 0x66 _asm    mov     ax,word ptr a   //  mov  eax, a
        _asm _emit 0x66 _asm    mov     bx,word ptr b   //  mov  ebx, b
        _asm _emit 0x66 _asm    mov     cx,word ptr c   //  mov  ecx, c
        _asm _emit 0x66 _asm    mul     bx              //  mul  ebx
        _asm _emit 0x66 _asm    mov     bx,cx           //  mov  ebx,ecx
        _asm _emit 0x66 _asm    dec     bx              //  dec  ebx
        _asm _emit 0x66 _asm    add     ax,bx           //  add  eax,ebx
        _asm _emit 0x66 _asm    adc     dx,0            //  adc  edx,0
        _asm _emit 0x66 _asm    div     cx              //  div  ecx
        _asm _emit 0x66                                 //  shld edx, eax, 16
        _asm _emit 0x0F
        _asm _emit 0xA4
        _asm _emit 0xC2
        _asm _emit 0x10

    } // MulDivRU32()

Generated on Wed Nov 13 2024 16:53:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Audio/MidiPlyr/SEQ.h File Reference

  • Multimedia
  • Audio
  • MidiPlyr
Classes | Defines | Typedefs | Functions

SEQ.h File Reference

#include "global.h"
#include "smf.h"
#include "global.h"

Go to the source code of this file.

Classes

struct | tag_preroll
struct | tag_seq

Defines

#define | MMSG_DONE (WM_USER+20)
#define | SEQ_F_COLONIZED 0x00000002L
#define | SEQ_F_EOF 0x00000001L
#define | SEQ_F_WAITING 0x00000004L
#define | SEQ_S_NOFILE 0
#define | SEQ_S_OPENED 1
#define | SEQ_S_PAUSED 5
#define | SEQ_S_PLAYING 4
#define | SEQ_S_PREROLLED 3
#define | SEQ_S_PREROLLING 2
#define | SEQ_S_RESET 7
#define | SEQ_S_STOPPING 6
#define | SEQ_VERSION ((DWORD)(WORD)((BYTE)VERSION_MINOR | (((WORD)(BYTE)VERSION_MAJOR) << 8)))
#define | VERSION_MAJOR 0x04
#define | VERSION_MINOR 0x00

Typedefs

typedef struct tag_preroll * | LPPREROLL
typedef struct tag_preroll | PREROLL
typedef struct tag_seq NEAR * | PSEQ
typedef struct tag_seq | SEQ

Functions

MMRESULT FNLOCAL | seqAllocBuffers (PSEQ pseq)
MMRESULT FNLOCAL | seqCloseFile (PSEQ pseq)
VOID FNLOCAL | seqFreeBuffers (PSEQ pseq)
TICKS FNLOCAL | seqMillisecsToTicks (PSEQ pseq, DWORD msOffset)
MMRESULT FNLOCAL | seqOpenFile (PSEQ pseq)
MMRESULT FNLOCAL | seqPause (PSEQ pseq)
MMRESULT FNLOCAL | seqPreroll (PSEQ pseq, LPPREROLL lppreroll)
MMRESULT FNLOCAL | seqRestart (PSEQ pseq)
MMRESULT FNLOCAL | seqStart (PSEQ pseq)
MMRESULT FNLOCAL | seqStop (PSEQ pseq)
DWORD FNLOCAL | seqTicksToMillisecs (PSEQ pseq, TICKS tkOffset)
MMRESULT FNLOCAL | seqTime (PSEQ pseq, PTICKS pTicks)

Define Documentation

#define MMSG_DONE (WM_USER+20)

Definition at line 41 of file SEQ.h.

#define SEQ_F_COLONIZED 0x00000002L

Definition at line 29 of file SEQ.h.

#define SEQ_F_EOF 0x00000001L

Definition at line 28 of file SEQ.h.

#define SEQ_F_WAITING 0x00000004L

Definition at line 30 of file SEQ.h.

#define SEQ_S_NOFILE 0

Definition at line 32 of file SEQ.h.

#define SEQ_S_OPENED 1

Definition at line 33 of file SEQ.h.

#define SEQ_S_PAUSED 5

Definition at line 37 of file SEQ.h.

#define SEQ_S_PLAYING 4

Definition at line 36 of file SEQ.h.

#define SEQ_S_PREROLLED 3

Definition at line 35 of file SEQ.h.

#define SEQ_S_PREROLLING 2

Definition at line 34 of file SEQ.h.

#define SEQ_S_RESET 7

Definition at line 39 of file SEQ.h.

#define SEQ_S_STOPPING 6

Definition at line 38 of file SEQ.h.

#define SEQ_VERSION ((DWORD)(WORD)((BYTE)VERSION_MINOR | (((WORD)(BYTE)VERSION_MAJOR) << 8)))

Definition at line 26 of file SEQ.h.

#define VERSION_MAJOR 0x04

Definition at line 25 of file SEQ.h.

#define VERSION_MINOR 0x00

Definition at line 24 of file SEQ.h.

Typedef Documentation

typedef struct tag_preroll* LPPREROLL
typedef struct tag_preroll PREROLL
typedef struct tag_seq * PSEQ

Definition at line 50 of file SEQ.h.

typedef struct tag_seq SEQ

Function Documentation

MMRESULT FNLOCAL seqAllocBuffers ( PSEQ pseq )

Definition at line 54 of file SEQUENCE.c.

{
    DWORD                   dwEachBufferSize;
    DWORD                   dwAlloc;
    UINT                    i;
    LPBYTE                  lpbWork;

    assert(pSeq != NULL);

    pSeq->uState    = SEQ_S_NOFILE;
    pSeq->lpmhFree  = NULL;
    pSeq->lpbAlloc  = NULL;
    pSeq->hSmf      = (HSMF)NULL;

    /* First make sure we can allocate the buffers they asked for
    */
    dwEachBufferSize = sizeof(MIDIHDR) + (DWORD)(pSeq->cbBuffer);
    dwAlloc          = dwEachBufferSize * (DWORD)(pSeq->cBuffer);

    pSeq->lpbAlloc = GlobalAllocPtr(GMEM_MOVEABLE|GMEM_SHARE, dwAlloc);
    if (NULL == pSeq->lpbAlloc)
        return MCIERR_OUT_OF_MEMORY;

    /* Initialize all MIDIHDR's and throw them into a free list
    */
    pSeq->lpmhFree = NULL;

    lpbWork = pSeq->lpbAlloc;
    for (i=0; i < pSeq->cBuffer; i++)
    {
        ((LPMIDIHDR)lpbWork)->lpNext            = pSeq->lpmhFree;

        ((LPMIDIHDR)lpbWork)->lpData            = lpbWork + sizeof(MIDIHDR);
        ((LPMIDIHDR)lpbWork)->dwBufferLength    = pSeq->cbBuffer;
        ((LPMIDIHDR)lpbWork)->dwBytesRecorded   = 0;
        ((LPMIDIHDR)lpbWork)->dwUser            = (DWORD)(UINT)pSeq;
        ((LPMIDIHDR)lpbWork)->dwFlags           = 0;

        pSeq->lpmhFree = (LPMIDIHDR)lpbWork;

        lpbWork += dwEachBufferSize;
    }

    return MMSYSERR_NOERROR;
}

MMRESULT FNLOCAL seqCloseFile ( PSEQ pseq )

Definition at line 228 of file SEQUENCE.c.

{
    LPMIDIHDR               lpmh;

    assert(pSeq != NULL);

    if (SEQ_S_OPENED != pSeq->uState)
        return MCIERR_UNSUPPORTED_FUNCTION;

    if ((HSMF)NULL != pSeq->hSmf)
    {
        smfCloseFile(pSeq->hSmf);
        pSeq->hSmf = (HSMF)NULL;
    }

    /* If we were prerolled, need to clean up -- have an open MIDI handle
    ** and buffers in the ready queue
    */

    for (lpmh = pSeq->lpmhFree; lpmh; lpmh = lpmh->lpNext)
        midiOutUnprepareHeader(pSeq->hmidi, lpmh, sizeof(*lpmh));

    if (pSeq->lpmhPreroll)
        midiOutUnprepareHeader(pSeq->hmidi, pSeq->lpmhPreroll, sizeof(*pSeq->lpmhPreroll));

    if (pSeq->hmidi != NULL)
    {
        midiStreamClose((HMIDISTRM)(pSeq->hmidi));
        pSeq->hmidi = NULL;
    }

    pSeq->uState = SEQ_S_NOFILE;

    return MMSYSERR_NOERROR;
}

VOID FNLOCAL seqFreeBuffers ( PSEQ pseq )

Definition at line 114 of file SEQUENCE.c.

{
    LPMIDIHDR               lpmh;

    assert(pSeq != NULL);

    if (NULL != pSeq->lpbAlloc)
    {
        lpmh = (LPMIDIHDR)pSeq->lpbAlloc;
        assert(!(lpmh->dwFlags & MHDR_PREPARED));

        GlobalFreePtr(pSeq->lpbAlloc);
    }
}

TICKS FNLOCAL seqMillisecsToTicks | ( | PSEQ | pseq,
 |  | DWORD | msOffset
 | ) |  |

Definition at line 727 of file SEQUENCE.c.

{
    return smfMillisecsToTicks(pSeq->hSmf, msOffset);
}

MMRESULT FNLOCAL seqOpenFile ( PSEQ pseq )

Definition at line 160 of file SEQUENCE.c.

{
    MMRESULT                rc      = MMSYSERR_NOERROR;
    SMFOPENFILESTRUCT       sofs;
    SMFFILEINFO             sfi;
    SMFRESULT               smfrc;
    DWORD                   cbBuffer;

    assert(pSeq != NULL);

    if (pSeq->uState != SEQ_S_NOFILE)
    {
        return MCIERR_UNSUPPORTED_FUNCTION;
    }

    assert(pSeq->pstrFile != NULL);

    sofs.pstrName     = pSeq->pstrFile;

    smfrc = smfOpenFile(&sofs);
    if (SMF_SUCCESS != smfrc)
    {
        rc = XlatSMFErr(smfrc);
        goto Seq_Open_File_Cleanup;
    }

    pSeq->hSmf = sofs.hSmf;
    smfGetFileInfo(pSeq->hSmf, &sfi);

    pSeq->dwTimeDivision = sfi.dwTimeDivision;
    pSeq->tkLength       = sfi.tkLength;
    pSeq->cTrk           = sfi.dwTracks;

    /* Track buffers must be big enough to hold the state data returned
    ** by smfSeek()
    */
    cbBuffer = min(pSeq->cbBuffer, smfGetStateMaxSize());

Seq_Open_File_Cleanup:
    if (MMSYSERR_NOERROR != rc)
        seqCloseFile(pSeq);
    else
        pSeq->uState = SEQ_S_OPENED;

    return rc;
}

MMRESULT FNLOCAL seqPause ( PSEQ pseq )

Definition at line 556 of file SEQUENCE.c.

{
    assert(NULL != pSeq);

    if (SEQ_S_PLAYING != pSeq->uState)
        return MCIERR_UNSUPPORTED_FUNCTION;

    pSeq->uState = SEQ_S_PAUSED;
    midiStreamPause((HMIDISTRM)pSeq->hmidi);

    return MMSYSERR_NOERROR;
}

MMRESULT FNLOCAL seqPreroll | ( | PSEQ | pseq,
 |  | LPPREROLL | lppreroll
 | ) |  |

Definition at line 295 of file SEQUENCE.c.

{
    SMFRESULT           smfrc;
    MMRESULT            mmrc        = MMSYSERR_NOERROR;
    MIDIPROPTIMEDIV     mptd;
    LPMIDIHDR           lpmh = NULL;
    LPMIDIHDR           lpmhPreroll = NULL;
    DWORD               cbPrerollBuffer;
    UINT                uDeviceID;

    assert(pSeq != NULL);

    pSeq->mmrcLastErr = MMSYSERR_NOERROR;

    if (pSeq->uState != SEQ_S_OPENED &&
        pSeq->uState != SEQ_S_PREROLLED)
        return MCIERR_UNSUPPORTED_FUNCTION;

  pSeq->tkBase = lpPreroll->tkBase;
  pSeq->tkEnd = lpPreroll->tkEnd;

    if (pSeq->hmidi)
    {
        // Recollect buffers from MMSYSTEM back into free queue
        //
        pSeq->uState = SEQ_S_RESET;
        midiOutReset(pSeq->hmidi);

    while (pSeq->uBuffersInMMSYSTEM)
      Sleep(0);
    }

    pSeq->uBuffersInMMSYSTEM = 0;
    pSeq->uState = SEQ_S_PREROLLING;

    //
    // We've successfully opened the file and all of the tracks; now
    // open the MIDI device and set the time division.
    //
    // NOTE: seqPreroll is equivalent to seek; device might already be open
    //
    if (NULL == pSeq->hmidi)
    {
        uDeviceID = pSeq->uDeviceID;
        if ((mmrc = midiStreamOpen(&(HMIDISTRM)pSeq->hmidi,
                                   &uDeviceID,
                                   1,
                                   (DWORD)seqMIDICallback,
                                   0,
                                   CALLBACK_FUNCTION)) != MMSYSERR_NOERROR)
        {
            pSeq->hmidi = NULL;
            goto seq_Preroll_Cleanup;
        }

        mptd.cbStruct  = sizeof(mptd);
        mptd.dwTimeDiv = pSeq->dwTimeDivision;
        if ((mmrc = midiStreamProperty(
                                       (HMIDISTRM)pSeq->hmidi,
                                       (LPBYTE)&mptd,
                                       MIDIPROP_SET|MIDIPROP_TIMEDIV)) != MMSYSERR_NOERROR)
        {
            DPF(1, "midiStreamProperty() -> %04X", (WORD)mmrc);
            midiStreamClose((HMIDISTRM)pSeq->hmidi);
            pSeq->hmidi = NULL;
            mmrc = MCIERR_DEVICE_NOT_READY;
            goto seq_Preroll_Cleanup;
        }
    }

    mmrc = MMSYSERR_NOERROR;

    //
    //  Allocate a preroll buffer.  Then if we don't have enough room for
    //  all the preroll info, we make the buffer larger.
    //
    if (!pSeq->lpmhPreroll)
    {
        cbPrerollBuffer = 4096;
        lpmhPreroll = (LPMIDIHDR)GlobalAllocPtr(GMEM_MOVEABLE|GMEM_SHARE,
                                                            cbPrerollBuffer);
    }
    else
    {
        cbPrerollBuffer = pSeq->cbPreroll;
        lpmhPreroll = pSeq->lpmhPreroll;
    }

    lpmhPreroll->lpNext            = pSeq->lpmhFree;
    lpmhPreroll->lpData            = (LPBYTE)lpmhPreroll + sizeof(MIDIHDR);
    lpmhPreroll->dwBufferLength    = cbPrerollBuffer - sizeof(MIDIHDR);
    lpmhPreroll->dwBytesRecorded   = 0;
    lpmhPreroll->dwUser            = (DWORD)(UINT)pSeq;
    lpmhPreroll->dwFlags           = 0;

    do
    {
        smfrc = smfSeek(pSeq->hSmf, pSeq->tkBase, lpmhPreroll);
        if( SMF_SUCCESS != smfrc )
        {
            if( ( SMF_NO_MEMORY != smfrc )  ||
                ( cbPrerollBuffer >= 32768L ) )
            {
                DPF(1, "smfSeek() returned %lu", (DWORD)smfrc);

                GlobalFreePtr(lpmhPreroll);
                pSeq->lpmhPreroll = NULL;

                mmrc = XlatSMFErr(smfrc);
                goto seq_Preroll_Cleanup;
            }
            else   //  Try to grow buffer.
            {
                cbPrerollBuffer *= 2;
                lpmh = (LPMIDIHDR)GlobalReAllocPtr( lpmhPreroll, cbPrerollBuffer, 0 );
                if( NULL == lpmh )
                {
                    DPF(2,"seqPreroll - realloc failed, aborting preroll.");
                    mmrc = MCIERR_OUT_OF_MEMORY;
                    goto seq_Preroll_Cleanup;
                }

                lpmhPreroll = lpmh;
                lpmhPreroll->lpData = (LPBYTE)lpmhPreroll + sizeof(MIDIHDR);
                lpmhPreroll->dwBufferLength = cbPrerollBuffer - sizeof(MIDIHDR);

                pSeq->lpmhPreroll = lpmhPreroll;
                pSeq->cbPreroll = cbPrerollBuffer;
            }
        }
    } while( SMF_SUCCESS != smfrc );

    if (MMSYSERR_NOERROR != (mmrc = midiOutPrepareHeader(pSeq->hmidi, lpmhPreroll, sizeof(MIDIHDR))))
    {
        DPF(1, "midiOutPrepare(preroll) -> %lu!", (DWORD)mmrc);

        mmrc = MCIERR_DEVICE_NOT_READY;
        goto seq_Preroll_Cleanup;
    }

    ++pSeq->uBuffersInMMSYSTEM;

    if (MMSYSERR_NOERROR != (mmrc = midiStreamOut((HMIDISTRM)pSeq->hmidi, lpmhPreroll, sizeof(MIDIHDR))))
    {
        DPF(1, "midiStreamOut(preroll) -> %lu!", (DWORD)mmrc);

        mmrc = MCIERR_DEVICE_NOT_READY;
        --pSeq->uBuffersInMMSYSTEM;
        goto seq_Preroll_Cleanup;
    }
    DPF(3,"seqPreroll: midiStreamOut(0x%x,0x%lx,%u) returned %u.",pSeq->hmidi,lpmhPreroll,sizeof(MIDIHDR),mmrc);

    pSeq->fdwSeq &= ~SEQ_F_EOF;
    while (pSeq->lpmhFree)
    {
        lpmh = pSeq->lpmhFree;
        pSeq->lpmhFree = lpmh->lpNext;

        smfrc = smfReadEvents(pSeq->hSmf, lpmh, pSeq->tkEnd);
        if (SMF_SUCCESS != smfrc && SMF_END_OF_FILE != smfrc)
        {
            DPF(1, "SFP: smfReadEvents() -> %u", (UINT)smfrc);
            mmrc = XlatSMFErr(smfrc);
            goto seq_Preroll_Cleanup;
        }

        if (MMSYSERR_NOERROR != (mmrc = midiOutPrepareHeader(pSeq->hmidi, lpmh, sizeof(*lpmh))))
        {
            DPF(1, "SFP: midiOutPrepareHeader failed");
            goto seq_Preroll_Cleanup;
        }

        if (MMSYSERR_NOERROR != (mmrc = midiStreamOut((HMIDISTRM)pSeq->hmidi, lpmh, sizeof(*lpmh))))
        {
            DPF(1, "SFP: midiStreamOut failed");
            goto seq_Preroll_Cleanup;
        }

        ++pSeq->uBuffersInMMSYSTEM;

        if (SMF_END_OF_FILE == smfrc)
        {
            pSeq->fdwSeq |= SEQ_F_EOF;
            break;
        }
    }

seq_Preroll_Cleanup:
    if (MMSYSERR_NOERROR != mmrc)
    {
        pSeq->uState = SEQ_S_OPENED;
        pSeq->fdwSeq &= ~SEQ_F_WAITING;
    }
    else
    {
        pSeq->uState = SEQ_S_PREROLLED;
    }

    return mmrc;
}

MMRESULT FNLOCAL seqRestart ( PSEQ pseq )

Definition at line 587 of file SEQUENCE.c.

{
    assert(NULL != pSeq);

    if (SEQ_S_PAUSED != pSeq->uState)
        return MCIERR_UNSUPPORTED_FUNCTION;

    pSeq->uState = SEQ_S_PLAYING;
    midiStreamRestart((HMIDISTRM)pSeq->hmidi);

    return MMSYSERR_NOERROR;
}

MMRESULT FNLOCAL seqStart ( PSEQ pseq )

Definition at line 520 of file SEQUENCE.c.

{
    assert(NULL != pSeq);

    if (SEQ_S_PREROLLED != pSeq->uState)
    {
        DPF(1, "seqStart(): State is wrong! [%u]", pSeq->uState);
        return MCIERR_UNSUPPORTED_FUNCTION;
    }

    pSeq->uState = SEQ_S_PLAYING;

    return midiStreamRestart((HMIDISTRM)pSeq->hmidi);
}

MMRESULT FNLOCAL seqStop ( PSEQ pseq )

Definition at line 618 of file SEQUENCE.c.

{
    assert(NULL != pSeq);

    /* Automatic success if we're already stopped
    */
    if (SEQ_S_PLAYING != pSeq->uState &&
        SEQ_S_PAUSED != pSeq->uState)
    {
        pSeq->fdwSeq &= ~SEQ_F_WAITING;
        return MMSYSERR_NOERROR;
    }

    pSeq->uState = SEQ_S_STOPPING;
    pSeq->fdwSeq |= SEQ_F_WAITING;

    if (MMSYSERR_NOERROR != (pSeq->mmrcLastErr = midiStreamStop((HMIDISTRM)pSeq->hmidi)))
    {
        DPF(1, "midiOutStop() returned %lu in seqStop()!", (DWORD)pSeq->mmrcLastErr);

        pSeq->fdwSeq &= ~SEQ_F_WAITING;
        return MCIERR_DEVICE_NOT_READY;
    }

  while (pSeq->uBuffersInMMSYSTEM)
    Sleep(0);

    return MMSYSERR_NOERROR;
}

DWORD FNLOCAL seqTicksToMillisecs | ( | PSEQ | pseq,
 |  | TICKS | tkOffset
 | ) |  |

Definition at line 748 of file SEQUENCE.c.

{
    return smfTicksToMillisecs(pSeq->hSmf, tkOffset);
}

MMRESULT FNLOCAL seqTime | ( | PSEQ | pseq,
 |  | PTICKS | pTicks
 | ) |  |

Definition at line 673 of file SEQUENCE.c.

{
    MMRESULT                mmr;
    MMTIME                  mmt;

    assert(pSeq != NULL);

    if (SEQ_S_PLAYING != pSeq->uState &&
        SEQ_S_PAUSED != pSeq->uState &&
        SEQ_S_PREROLLING != pSeq->uState &&
        SEQ_S_PREROLLED != pSeq->uState &&
        SEQ_S_OPENED != pSeq->uState)
    {
        DPF(1, "seqTime(): State wrong! [is %u]", pSeq->uState);
        return MCIERR_UNSUPPORTED_FUNCTION;
    }

    *pTicks = 0;
    if (SEQ_S_OPENED != pSeq->uState)
    {
        *pTicks = pSeq->tkBase;
        if (SEQ_S_PREROLLED != pSeq->uState)
        {
            mmt.wType = TIME_TICKS;
            mmr = midiStreamPosition((HMIDISTRM)pSeq->hmidi, &mmt, sizeof(mmt));
            if (MMSYSERR_NOERROR != mmr)
            {
                DPF(1, "midiStreamPosition() returned %lu", (DWORD)mmr);
                return MCIERR_DEVICE_NOT_READY;
            }

            *pTicks += mmt.u.ticks;
        }
    }

    return MMSYSERR_NOERROR;
}

Generated on Wed Nov 13 2024 16:53:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Audio/MidiPlyr/SEQUENCE.c File Reference

  • Multimedia
  • Audio
  • MidiPlyr
Functions

SEQUENCE.c File Reference

#include <windows.h>
#include <windowsx.h>
#include <mmsystem.h>
#include <limits.h>
#include "debug.h"
#include "seq.h"

Go to the source code of this file.

Functions

MMRESULT FNLOCAL | seqAllocBuffers (PSEQ pSeq)
MMRESULT FNLOCAL | seqCloseFile (PSEQ pSeq)
VOID FNLOCAL | seqFreeBuffers (PSEQ pSeq)
PRIVATE void FAR PASCAL | seqMIDICallback (HMIDISTRM hms, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2)
TICKS FNLOCAL | seqMillisecsToTicks (PSEQ pSeq, DWORD msOffset)
MMRESULT FNLOCAL | seqOpenFile (PSEQ pSeq)
MMRESULT FNLOCAL | seqPause (PSEQ pSeq)
MMRESULT FNLOCAL | seqPreroll (PSEQ pSeq, LPPREROLL lpPreroll)
MMRESULT FNLOCAL | seqRestart (PSEQ pSeq)
MMRESULT FNLOCAL | seqStart (PSEQ pSeq)
MMRESULT FNLOCAL | seqStop (PSEQ pSeq)
DWORD FNLOCAL | seqTicksToMillisecs (PSEQ pSeq, TICKS tkOffset)
MMRESULT FNLOCAL | seqTime (PSEQ pSeq, PTICKS pTicks)
PRIVATE MMRESULT FNLOCAL | XlatSMFErr (SMFRESULT smfrc)

Function Documentation

MMRESULT FNLOCAL seqAllocBuffers ( PSEQ pSeq )

Definition at line 54 of file SEQUENCE.c.

{
    DWORD                   dwEachBufferSize;
    DWORD                   dwAlloc;
    UINT                    i;
    LPBYTE                  lpbWork;

    assert(pSeq != NULL);

    pSeq->uState    = SEQ_S_NOFILE;
    pSeq->lpmhFree  = NULL;
    pSeq->lpbAlloc  = NULL;
    pSeq->hSmf      = (HSMF)NULL;

    /* First make sure we can allocate the buffers they asked for
    */
    dwEachBufferSize = sizeof(MIDIHDR) + (DWORD)(pSeq->cbBuffer);
    dwAlloc          = dwEachBufferSize * (DWORD)(pSeq->cBuffer);

    pSeq->lpbAlloc = GlobalAllocPtr(GMEM_MOVEABLE|GMEM_SHARE, dwAlloc);
    if (NULL == pSeq->lpbAlloc)
        return MCIERR_OUT_OF_MEMORY;

    /* Initialize all MIDIHDR's and throw them into a free list
    */
    pSeq->lpmhFree = NULL;

    lpbWork = pSeq->lpbAlloc;
    for (i=0; i < pSeq->cBuffer; i++)
    {
        ((LPMIDIHDR)lpbWork)->lpNext            = pSeq->lpmhFree;

        ((LPMIDIHDR)lpbWork)->lpData            = lpbWork + sizeof(MIDIHDR);
        ((LPMIDIHDR)lpbWork)->dwBufferLength    = pSeq->cbBuffer;
        ((LPMIDIHDR)lpbWork)->dwBytesRecorded   = 0;
        ((LPMIDIHDR)lpbWork)->dwUser            = (DWORD)(UINT)pSeq;
        ((LPMIDIHDR)lpbWork)->dwFlags           = 0;

        pSeq->lpmhFree = (LPMIDIHDR)lpbWork;

        lpbWork += dwEachBufferSize;
    }

    return MMSYSERR_NOERROR;
}

MMRESULT FNLOCAL seqCloseFile ( PSEQ pSeq )

Definition at line 228 of file SEQUENCE.c.

{
    LPMIDIHDR               lpmh;

    assert(pSeq != NULL);

    if (SEQ_S_OPENED != pSeq->uState)
        return MCIERR_UNSUPPORTED_FUNCTION;

    if ((HSMF)NULL != pSeq->hSmf)
    {
        smfCloseFile(pSeq->hSmf);
        pSeq->hSmf = (HSMF)NULL;
    }

    /* If we were prerolled, need to clean up -- have an open MIDI handle
    ** and buffers in the ready queue
    */

    for (lpmh = pSeq->lpmhFree; lpmh; lpmh = lpmh->lpNext)
        midiOutUnprepareHeader(pSeq->hmidi, lpmh, sizeof(*lpmh));

    if (pSeq->lpmhPreroll)
        midiOutUnprepareHeader(pSeq->hmidi, pSeq->lpmhPreroll, sizeof(*pSeq->lpmhPreroll));

    if (pSeq->hmidi != NULL)
    {
        midiStreamClose((HMIDISTRM)(pSeq->hmidi));
        pSeq->hmidi = NULL;
    }

    pSeq->uState = SEQ_S_NOFILE;

    return MMSYSERR_NOERROR;
}

VOID FNLOCAL seqFreeBuffers ( PSEQ pSeq )

Definition at line 114 of file SEQUENCE.c.

{
    LPMIDIHDR               lpmh;

    assert(pSeq != NULL);

    if (NULL != pSeq->lpbAlloc)
    {
        lpmh = (LPMIDIHDR)pSeq->lpbAlloc;
        assert(!(lpmh->dwFlags & MHDR_PREPARED));

        GlobalFreePtr(pSeq->lpbAlloc);
    }
}

PRIVATE void FAR PASCAL seqMIDICallback | ( | HMIDISTRM | hms,
 |  | UINT | uMsg,
 |  | DWORD | dwUser,
 |  | DWORD | dw1,
 |  | DWORD | dw2
 | ) |  |

Definition at line 764 of file SEQUENCE.c.

{
  LPMIDIHDR         lpmh    = (LPMIDIHDR)dw1;
    PSEQ                    pSeq;
    MMRESULT                mmrc;
    SMFRESULT               smfrc;

  if (uMsg != MOM_DONE)
    return;

  assert(NULL != lpmh);

    pSeq = (PSEQ)(lpmh->dwUser);

    assert(pSeq != NULL);

    --pSeq->uBuffersInMMSYSTEM;

    if (SEQ_S_RESET == pSeq->uState)
    {
        // We're recollecting buffers from MMSYSTEM
        //
    if (lpmh != pSeq->lpmhPreroll)
    {
          lpmh->lpNext   = pSeq->lpmhFree;
          pSeq->lpmhFree = lpmh;
    }

        return;
    }

    if ((SEQ_S_STOPPING == pSeq->uState) || (pSeq->fdwSeq & SEQ_F_EOF))
    {
        /*
        ** Reached EOF, just put the buffer back on the free
        ** list
        */
    if (lpmh != pSeq->lpmhPreroll)
    {
          lpmh->lpNext   = pSeq->lpmhFree;
          pSeq->lpmhFree = lpmh;
    }

        if (MMSYSERR_NOERROR != (mmrc = midiOutUnprepareHeader(pSeq->hmidi, lpmh, sizeof(*lpmh))))
        {
            DPF(1, "midiOutUnprepareHeader failed in seqBufferDone! (%lu)", (DWORD)mmrc);
        }

        if (0 == pSeq->uBuffersInMMSYSTEM)
        {
            DPF(1, "seqBufferDone: normal sequencer shutdown.");

            /* Totally done! Free device and notify.
            */
            midiStreamClose((HMIDISTRM)pSeq->hmidi);

            pSeq->hmidi = NULL;
            pSeq->uState = SEQ_S_OPENED;
            pSeq->mmrcLastErr = MMSYSERR_NOERROR;
            pSeq->fdwSeq &= ~SEQ_F_WAITING;

          // lParam indicates whether or not to preroll again. Don't if we were explicitly
          // stopped.
          //
            PostMessage(pSeq->hWnd, MMSG_DONE, (WPARAM)pSeq, (LPARAM)(SEQ_S_STOPPING != pSeq->uState));
        }
    }
    else
    {
        /*
        ** Not EOF yet; attempt to fill another buffer
        */
        smfrc = smfReadEvents(pSeq->hSmf, lpmh, pSeq->tkEnd);

        switch(smfrc)
        {
            case SMF_SUCCESS:
                break;

            case SMF_END_OF_FILE:
                pSeq->fdwSeq |= SEQ_F_EOF;
                smfrc = SMF_SUCCESS;
                break;

            default:
                DPF(1, "smfReadEvents returned %lu in callback!", (DWORD)smfrc);
                pSeq->uState = SEQ_S_STOPPING;
                break;
        }

        if (SMF_SUCCESS == smfrc)
        {
            ++pSeq->uBuffersInMMSYSTEM;
            mmrc = midiStreamOut((HMIDISTRM)pSeq->hmidi, lpmh, sizeof(*lpmh));
            if (MMSYSERR_NOERROR != mmrc)
            {
                DPF(1, "seqBufferDone(): midiStreamOut() returned %lu!", (DWORD)mmrc);

                --pSeq->uBuffersInMMSYSTEM;
                pSeq->uState = SEQ_S_STOPPING;
            }
        }
    }
}

TICKS FNLOCAL seqMillisecsToTicks | ( | PSEQ | pSeq,
 |  | DWORD | msOffset
 | ) |  |

Definition at line 727 of file SEQUENCE.c.

{
    return smfMillisecsToTicks(pSeq->hSmf, msOffset);
}

MMRESULT FNLOCAL seqOpenFile ( PSEQ pSeq )

Definition at line 160 of file SEQUENCE.c.

{
    MMRESULT                rc      = MMSYSERR_NOERROR;
    SMFOPENFILESTRUCT       sofs;
    SMFFILEINFO             sfi;
    SMFRESULT               smfrc;
    DWORD                   cbBuffer;

    assert(pSeq != NULL);

    if (pSeq->uState != SEQ_S_NOFILE)
    {
        return MCIERR_UNSUPPORTED_FUNCTION;
    }

    assert(pSeq->pstrFile != NULL);

    sofs.pstrName     = pSeq->pstrFile;

    smfrc = smfOpenFile(&sofs);
    if (SMF_SUCCESS != smfrc)
    {
        rc = XlatSMFErr(smfrc);
        goto Seq_Open_File_Cleanup;
    }

    pSeq->hSmf = sofs.hSmf;
    smfGetFileInfo(pSeq->hSmf, &sfi);

    pSeq->dwTimeDivision = sfi.dwTimeDivision;
    pSeq->tkLength       = sfi.tkLength;
    pSeq->cTrk           = sfi.dwTracks;

    /* Track buffers must be big enough to hold the state data returned
    ** by smfSeek()
    */
    cbBuffer = min(pSeq->cbBuffer, smfGetStateMaxSize());

Seq_Open_File_Cleanup:
    if (MMSYSERR_NOERROR != rc)
        seqCloseFile(pSeq);
    else
        pSeq->uState = SEQ_S_OPENED;

    return rc;
}

MMRESULT FNLOCAL seqPause ( PSEQ pSeq )

Definition at line 556 of file SEQUENCE.c.

{
    assert(NULL != pSeq);

    if (SEQ_S_PLAYING != pSeq->uState)
        return MCIERR_UNSUPPORTED_FUNCTION;

    pSeq->uState = SEQ_S_PAUSED;
    midiStreamPause((HMIDISTRM)pSeq->hmidi);

    return MMSYSERR_NOERROR;
}

MMRESULT FNLOCAL seqPreroll | ( | PSEQ | pSeq,
 |  | LPPREROLL | lpPreroll
 | ) |  |

Definition at line 295 of file SEQUENCE.c.

{
    SMFRESULT           smfrc;
    MMRESULT            mmrc        = MMSYSERR_NOERROR;
    MIDIPROPTIMEDIV     mptd;
    LPMIDIHDR           lpmh = NULL;
    LPMIDIHDR           lpmhPreroll = NULL;
    DWORD               cbPrerollBuffer;
    UINT                uDeviceID;

    assert(pSeq != NULL);

    pSeq->mmrcLastErr = MMSYSERR_NOERROR;

    if (pSeq->uState != SEQ_S_OPENED &&
        pSeq->uState != SEQ_S_PREROLLED)
        return MCIERR_UNSUPPORTED_FUNCTION;

  pSeq->tkBase = lpPreroll->tkBase;
  pSeq->tkEnd = lpPreroll->tkEnd;

    if (pSeq->hmidi)
    {
        // Recollect buffers from MMSYSTEM back into free queue
        //
        pSeq->uState = SEQ_S_RESET;
        midiOutReset(pSeq->hmidi);

    while (pSeq->uBuffersInMMSYSTEM)
      Sleep(0);
    }

    pSeq->uBuffersInMMSYSTEM = 0;
    pSeq->uState = SEQ_S_PREROLLING;

    //
    // We've successfully opened the file and all of the tracks; now
    // open the MIDI device and set the time division.
    //
    // NOTE: seqPreroll is equivalent to seek; device might already be open
    //
    if (NULL == pSeq->hmidi)
    {
        uDeviceID = pSeq->uDeviceID;
        if ((mmrc = midiStreamOpen(&(HMIDISTRM)pSeq->hmidi,
                                   &uDeviceID,
                                   1,
                                   (DWORD)seqMIDICallback,
                                   0,
                                   CALLBACK_FUNCTION)) != MMSYSERR_NOERROR)
        {
            pSeq->hmidi = NULL;
            goto seq_Preroll_Cleanup;
        }

        mptd.cbStruct  = sizeof(mptd);
        mptd.dwTimeDiv = pSeq->dwTimeDivision;
        if ((mmrc = midiStreamProperty(
                                       (HMIDISTRM)pSeq->hmidi,
                                       (LPBYTE)&mptd,
                                       MIDIPROP_SET|MIDIPROP_TIMEDIV)) != MMSYSERR_NOERROR)
        {
            DPF(1, "midiStreamProperty() -> %04X", (WORD)mmrc);
            midiStreamClose((HMIDISTRM)pSeq->hmidi);
            pSeq->hmidi = NULL;
            mmrc = MCIERR_DEVICE_NOT_READY;
            goto seq_Preroll_Cleanup;
        }
    }

    mmrc = MMSYSERR_NOERROR;

    //
    //  Allocate a preroll buffer.  Then if we don't have enough room for
    //  all the preroll info, we make the buffer larger.
    //
    if (!pSeq->lpmhPreroll)
    {
        cbPrerollBuffer = 4096;
        lpmhPreroll = (LPMIDIHDR)GlobalAllocPtr(GMEM_MOVEABLE|GMEM_SHARE,
                                                            cbPrerollBuffer);
    }
    else
    {
        cbPrerollBuffer = pSeq->cbPreroll;
        lpmhPreroll = pSeq->lpmhPreroll;
    }

    lpmhPreroll->lpNext            = pSeq->lpmhFree;
    lpmhPreroll->lpData            = (LPBYTE)lpmhPreroll + sizeof(MIDIHDR);
    lpmhPreroll->dwBufferLength    = cbPrerollBuffer - sizeof(MIDIHDR);
    lpmhPreroll->dwBytesRecorded   = 0;
    lpmhPreroll->dwUser            = (DWORD)(UINT)pSeq;
    lpmhPreroll->dwFlags           = 0;

    do
    {
        smfrc = smfSeek(pSeq->hSmf, pSeq->tkBase, lpmhPreroll);
        if( SMF_SUCCESS != smfrc )
        {
            if( ( SMF_NO_MEMORY != smfrc )  ||
                ( cbPrerollBuffer >= 32768L ) )
            {
                DPF(1, "smfSeek() returned %lu", (DWORD)smfrc);

                GlobalFreePtr(lpmhPreroll);
                pSeq->lpmhPreroll = NULL;

                mmrc = XlatSMFErr(smfrc);
                goto seq_Preroll_Cleanup;
            }
            else   //  Try to grow buffer.
            {
                cbPrerollBuffer *= 2;
                lpmh = (LPMIDIHDR)GlobalReAllocPtr( lpmhPreroll, cbPrerollBuffer, 0 );
                if( NULL == lpmh )
                {
                    DPF(2,"seqPreroll - realloc failed, aborting preroll.");
                    mmrc = MCIERR_OUT_OF_MEMORY;
                    goto seq_Preroll_Cleanup;
                }

                lpmhPreroll = lpmh;
                lpmhPreroll->lpData = (LPBYTE)lpmhPreroll + sizeof(MIDIHDR);
                lpmhPreroll->dwBufferLength = cbPrerollBuffer - sizeof(MIDIHDR);

                pSeq->lpmhPreroll = lpmhPreroll;
                pSeq->cbPreroll = cbPrerollBuffer;
            }
        }
    } while( SMF_SUCCESS != smfrc );

    if (MMSYSERR_NOERROR != (mmrc = midiOutPrepareHeader(pSeq->hmidi, lpmhPreroll, sizeof(MIDIHDR))))
    {
        DPF(1, "midiOutPrepare(preroll) -> %lu!", (DWORD)mmrc);

        mmrc = MCIERR_DEVICE_NOT_READY;
        goto seq_Preroll_Cleanup;
    }

    ++pSeq->uBuffersInMMSYSTEM;

    if (MMSYSERR_NOERROR != (mmrc = midiStreamOut((HMIDISTRM)pSeq->hmidi, lpmhPreroll, sizeof(MIDIHDR))))
    {
        DPF(1, "midiStreamOut(preroll) -> %lu!", (DWORD)mmrc);

        mmrc = MCIERR_DEVICE_NOT_READY;
        --pSeq->uBuffersInMMSYSTEM;
        goto seq_Preroll_Cleanup;
    }
    DPF(3,"seqPreroll: midiStreamOut(0x%x,0x%lx,%u) returned %u.",pSeq->hmidi,lpmhPreroll,sizeof(MIDIHDR),mmrc);

    pSeq->fdwSeq &= ~SEQ_F_EOF;
    while (pSeq->lpmhFree)
    {
        lpmh = pSeq->lpmhFree;
        pSeq->lpmhFree = lpmh->lpNext;

        smfrc = smfReadEvents(pSeq->hSmf, lpmh, pSeq->tkEnd);
        if (SMF_SUCCESS != smfrc && SMF_END_OF_FILE != smfrc)
        {
            DPF(1, "SFP: smfReadEvents() -> %u", (UINT)smfrc);
            mmrc = XlatSMFErr(smfrc);
            goto seq_Preroll_Cleanup;
        }

        if (MMSYSERR_NOERROR != (mmrc = midiOutPrepareHeader(pSeq->hmidi, lpmh, sizeof(*lpmh))))
        {
            DPF(1, "SFP: midiOutPrepareHeader failed");
            goto seq_Preroll_Cleanup;
        }

        if (MMSYSERR_NOERROR != (mmrc = midiStreamOut((HMIDISTRM)pSeq->hmidi, lpmh, sizeof(*lpmh))))
        {
            DPF(1, "SFP: midiStreamOut failed");
            goto seq_Preroll_Cleanup;
        }

        ++pSeq->uBuffersInMMSYSTEM;

        if (SMF_END_OF_FILE == smfrc)
        {
            pSeq->fdwSeq |= SEQ_F_EOF;
            break;
        }
    }

seq_Preroll_Cleanup:
    if (MMSYSERR_NOERROR != mmrc)
    {
        pSeq->uState = SEQ_S_OPENED;
        pSeq->fdwSeq &= ~SEQ_F_WAITING;
    }
    else
    {
        pSeq->uState = SEQ_S_PREROLLED;
    }

    return mmrc;
}

MMRESULT FNLOCAL seqRestart ( PSEQ pSeq )

Definition at line 587 of file SEQUENCE.c.

{
    assert(NULL != pSeq);

    if (SEQ_S_PAUSED != pSeq->uState)
        return MCIERR_UNSUPPORTED_FUNCTION;

    pSeq->uState = SEQ_S_PLAYING;
    midiStreamRestart((HMIDISTRM)pSeq->hmidi);

    return MMSYSERR_NOERROR;
}

MMRESULT FNLOCAL seqStart ( PSEQ pSeq )

Definition at line 520 of file SEQUENCE.c.

{
    assert(NULL != pSeq);

    if (SEQ_S_PREROLLED != pSeq->uState)
    {
        DPF(1, "seqStart(): State is wrong! [%u]", pSeq->uState);
        return MCIERR_UNSUPPORTED_FUNCTION;
    }

    pSeq->uState = SEQ_S_PLAYING;

    return midiStreamRestart((HMIDISTRM)pSeq->hmidi);
}

MMRESULT FNLOCAL seqStop ( PSEQ pSeq )

Definition at line 618 of file SEQUENCE.c.

{
    assert(NULL != pSeq);

    /* Automatic success if we're already stopped
    */
    if (SEQ_S_PLAYING != pSeq->uState &&
        SEQ_S_PAUSED != pSeq->uState)
    {
        pSeq->fdwSeq &= ~SEQ_F_WAITING;
        return MMSYSERR_NOERROR;
    }

    pSeq->uState = SEQ_S_STOPPING;
    pSeq->fdwSeq |= SEQ_F_WAITING;

    if (MMSYSERR_NOERROR != (pSeq->mmrcLastErr = midiStreamStop((HMIDISTRM)pSeq->hmidi)))
    {
        DPF(1, "midiOutStop() returned %lu in seqStop()!", (DWORD)pSeq->mmrcLastErr);

        pSeq->fdwSeq &= ~SEQ_F_WAITING;
        return MCIERR_DEVICE_NOT_READY;
    }

  while (pSeq->uBuffersInMMSYSTEM)
    Sleep(0);

    return MMSYSERR_NOERROR;
}

DWORD FNLOCAL seqTicksToMillisecs | ( | PSEQ | pSeq,
 |  | TICKS | tkOffset
 | ) |  |

Definition at line 748 of file SEQUENCE.c.

{
    return smfTicksToMillisecs(pSeq->hSmf, tkOffset);
}

MMRESULT FNLOCAL seqTime | ( | PSEQ | pSeq,
 |  | PTICKS | pTicks
 | ) |  |

Definition at line 673 of file SEQUENCE.c.

{
    MMRESULT                mmr;
    MMTIME                  mmt;

    assert(pSeq != NULL);

    if (SEQ_S_PLAYING != pSeq->uState &&
        SEQ_S_PAUSED != pSeq->uState &&
        SEQ_S_PREROLLING != pSeq->uState &&
        SEQ_S_PREROLLED != pSeq->uState &&
        SEQ_S_OPENED != pSeq->uState)
    {
        DPF(1, "seqTime(): State wrong! [is %u]", pSeq->uState);
        return MCIERR_UNSUPPORTED_FUNCTION;
    }

    *pTicks = 0;
    if (SEQ_S_OPENED != pSeq->uState)
    {
        *pTicks = pSeq->tkBase;
        if (SEQ_S_PREROLLED != pSeq->uState)
        {
            mmt.wType = TIME_TICKS;
            mmr = midiStreamPosition((HMIDISTRM)pSeq->hmidi, &mmt, sizeof(mmt));
            if (MMSYSERR_NOERROR != mmr)
            {
                DPF(1, "midiStreamPosition() returned %lu", (DWORD)mmr);
                return MCIERR_DEVICE_NOT_READY;
            }

            *pTicks += mmt.u.ticks;
        }
    }

    return MMSYSERR_NOERROR;
}

PRIVATE MMRESULT FNLOCAL XlatSMFErr ( SMFRESULT smfrc )

Definition at line 882 of file SEQUENCE.c.

{
    switch(smfrc)
    {
        case SMF_SUCCESS:
            return MMSYSERR_NOERROR;

        case SMF_NO_MEMORY:
            return MCIERR_OUT_OF_MEMORY;

        case SMF_INVALID_FILE:
        case SMF_OPEN_FAILED:
        case SMF_INVALID_TRACK:
            return MCIERR_INVALID_FILE;

        default:
            return MCIERR_UNSUPPORTED_FUNCTION;
    }
}

Generated on Wed Nov 13 2024 16:53:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Audio/MidiPlyr/SMF.c File Reference

  • Multimedia
  • Audio
  • MidiPlyr
Classes | Defines | Typedefs | Functions

SMF.c File Reference

#include <windows.h>
#include <windowsx.h>
#include <mmsystem.h>
#include <memory.h>
#include "muldiv32.h"
#include "smf.h"
#include "smfi.h"
#include "debug.h"

Go to the source code of this file.

Classes

struct | tag_keyframe

Defines

#define | KF_EMPTY ((BYTE)0xFF)

Typedefs

typedef struct tag_keyframe | KEYFRAME
typedef struct tag_keyframe * | PKEYFRAME

Functions

SMFRESULT FNLOCAL | smfCloseFile (HSMF hSmf)
SMFRESULT FNLOCAL | smfGetFileInfo (HSMF hSmf, PSMFFILEINFO psfi)
DWORD FNLOCAL | smfGetStateMaxSize (VOID)
PRIVATE SMFRESULT FNLOCAL | smfInsertParmData (PSMF pSmf, TICKS tkDelta, LPMIDIHDR lpmh)
TICKS FNLOCAL | smfMillisecsToTicks (HSMF hSmf, DWORD msOffset)
SMFRESULT FNLOCAL | smfOpenFile (PSMFOPENFILESTRUCT psofs)
SMFRESULT FNLOCAL | smfReadEvents (HSMF hSmf, LPMIDIHDR lpmh, TICKS tkMax)
SMFRESULT FNLOCAL | smfSeek (HSMF hSmf, TICKS tkPosition, LPMIDIHDR lpmh)
DWORD FNLOCAL | smfTicksToMillisecs (HSMF hSmf, TICKS tkOffset)

Define Documentation

#define KF_EMPTY ((BYTE)0xFF)

Definition at line 714 of file SMF.c.

Typedef Documentation

typedef struct tag_keyframe KEYFRAME
typedef struct tag_keyframe* PKEYFRAME

Function Documentation

SMFRESULT FNLOCAL smfCloseFile ( HSMF hSmf )

Definition at line 184 of file SMF.c.

{
    PSMF                    pSmf        = (PSMF)hSmf;

    assert(pSmf != NULL);

    /*
    ** Free up handle memory
    */

    if (NULL != pSmf->hpbImage)
        GlobalFreePtr(pSmf->hpbImage);

    LocalFree((HLOCAL)pSmf);

    return SMF_SUCCESS;
}

SMFRESULT FNLOCAL smfGetFileInfo | ( | HSMF | hSmf,
 |  | PSMFFILEINFO | psfi
 | ) |  |

Definition at line 217 of file SMF.c.

{
    PSMF                    pSmf = (PSMF)hSmf;

    assert(pSmf != NULL);
    assert(psfi != NULL);

    /*
    ** Just fill in the structure with useful information.
    */
    psfi->dwTracks      = pSmf->dwTracks;
    psfi->dwFormat      = pSmf->dwFormat;
    psfi->dwTimeDivision= pSmf->dwTimeDivision;
    psfi->tkLength      = pSmf->tkLength;

    return SMF_SUCCESS;
}

DWORD FNLOCAL smfGetStateMaxSize ( VOID )

Definition at line 878 of file SMF.c.

{
    return  3*sizeof(DWORD) +           /* Tempo                */
            3*16*sizeof(DWORD) +        /* Patch changes        */
            3*16*120*sizeof(DWORD) +    /* Controller changes   */
            3*sizeof(DWORD);            /* Time alignment NOP   */
}

PRIVATE SMFRESULT FNLOCAL smfInsertParmData | ( | PSMF | pSmf,
 |  | TICKS | tkDelta,
 |  | LPMIDIHDR | lpmh
 | ) |  |

Definition at line 587 of file SMF.c.

{
    DWORD                   dwLength;
    DWORD                   dwRounded;
    LPDWORD                 lpdw;

    assert(pSmf != NULL);
    assert(lpmh != NULL);

    /* Can't fit 4 DWORD's? (tkDelta + stream-id + event + some data)
    ** Can't do anything.
    */
    assert(lpmh->dwBufferLength >= lpmh->dwBytesRecorded);

    if (lpmh->dwBufferLength - lpmh->dwBytesRecorded < 4*sizeof(DWORD))
    {
        if (0 == tkDelta)
            return SMF_SUCCESS;

        /* If we got here with a real delta, that means smfReadEvents screwed
        ** up calculating left space and we should flag it somehow.
        */
        DPF(1, "Can't fit initial piece of SysEx into buffer!");
        return SMF_INVALID_FILE;
    }

    lpdw = (LPDWORD)(lpmh->lpData + lpmh->dwBytesRecorded);

    dwLength = lpmh->dwBufferLength - lpmh->dwBytesRecorded - 3*sizeof(DWORD);
    dwLength = min(dwLength, pSmf->cbPendingUserEvent);

    *lpdw++ = (DWORD)tkDelta;
    *lpdw++ = 0L;
    *lpdw++ = (pSmf->dwPendingUserEvent & 0xFF000000L) | (dwLength & 0x00FFFFFFL);

    dwRounded = (dwLength + 3) & (~3L);

    if (pSmf->fdwSMF & SMF_F_INSERTSYSEX)
    {
        *((LPBYTE)lpdw)++ = MIDI_SYSEX;
        pSmf->fdwSMF &= ~SMF_F_INSERTSYSEX;
        --dwLength;
        --pSmf->cbPendingUserEvent;
    }

    if (dwLength & 0x80000000L)
    {
        DPF(1, "dwLength %08lX  dwBytesRecorded %08lX  dwBufferLength %08lX", dwLength, lpmh->dwBytesRecorded, lpmh->dwBufferLength);
        DPF(1, "cbPendingUserEvent %08lX  dwPendingUserEvent %08lX dwRounded %08lX", pSmf->cbPendingUserEvent, pSmf->dwPendingUserEvent, dwRounded);
        DPF(1, "Offset into MIDI image %08lX", (DWORD)(pSmf->hpbPendingUserEvent - pSmf->hpbImage));
        DPF(1, "!hmemcpy is about to fault");
    }

    hmemcpy(lpdw, pSmf->hpbPendingUserEvent, dwLength);
    if (0 == (pSmf->cbPendingUserEvent -= dwLength))
        pSmf->dwPendingUserEvent = 0;

    lpmh->dwBytesRecorded += 3*sizeof(DWORD) + dwRounded;

    return SMF_SUCCESS;
}

TICKS FNLOCAL smfMillisecsToTicks | ( | HSMF | hSmf,
 |  | DWORD | msOffset
 | ) |  |

Definition at line 336 of file SMF.c.

{
    PSMF                    pSmf            = (PSMF)hSmf;
    PTEMPOMAPENTRY          pTempo;
    UINT                    idx;
    UINT                    uSMPTE;
    DWORD                   dwTicksPerSec;
    TICKS                   tkOffset;

    assert(pSmf != NULL);

    /* SMPTE time is easy -- no tempo map, just linear conversion
    ** Note that 30-Drop means nothing to us here since we're not
    ** converting to a colonized format, which is where dropping
    ** happens.
    */
    if (pSmf->dwTimeDivision & 0x8000)
    {
        uSMPTE = -(int)(char)((pSmf->dwTimeDivision >> 8)&0xFF);
        if (29 == uSMPTE)
            uSMPTE = 30;

        dwTicksPerSec = (DWORD)uSMPTE *
                        (DWORD)(BYTE)(pSmf->dwTimeDivision & 0xFF);

        return (DWORD)muldiv32(msOffset, dwTicksPerSec, 1000L);
    }

    /* Walk the tempo map and find the nearest millisecond position. Linearly
    ** calculate the rest (using MATH.ASM)
    */
    pTempo = pSmf->pTempoMap;
    assert(pTempo != NULL);

    for (idx = 0; idx < pSmf->cTempoMap; idx++, pTempo++)
        if (msOffset < pTempo->msBase)
            break;
    pTempo--;

    /* pTempo is the tempo map entry preceding the requested tick offset.
    */

    tkOffset = pTempo->tkTempo + muldiv32(msOffset-pTempo->msBase,
                                     1000L*pSmf->dwTimeDivision,
                                     pTempo->dwTempo);

    if (tkOffset > pSmf->tkLength)
    {
        DPF(1, "sMTT: Clipping ticks to file length!");
        tkOffset = pSmf->tkLength;
    }

    return tkOffset;
}

SMFRESULT FNLOCAL smfOpenFile ( PSMFOPENFILESTRUCT psofs )

Definition at line 55 of file SMF.c.

{
    HMMIO                   hmmio = (HMMIO)NULL;
    PSMF                    pSmf;
    SMFRESULT               smfrc = SMF_SUCCESS;
    MMIOINFO                mmioinfo;
    MMCKINFO                ckRIFF;
    MMCKINFO                ckDATA;

    assert(psofs != NULL);
    assert(psofs->pstrName != NULL);

    /* Verify that the file can be opened or created
    */
    _fmemset(&mmioinfo, 0, sizeof(mmioinfo));

    hmmio = mmioOpen(psofs->pstrName, &mmioinfo, MMIO_READ|MMIO_ALLOCBUF);
    if ((HMMIO)NULL == hmmio)
    {
        DPF(1, "smfOpenFile: mmioOpen failed!");
        return SMF_OPEN_FAILED;
    }

    /* Now see if we can create the handle structure
    */
    pSmf = (PSMF)LocalAlloc(LPTR, sizeof(SMF));
    if (NULL == pSmf)
    {
        DPF(1, "smfOpenFile: LocalAlloc failed!");
        smfrc = SMF_NO_MEMORY;
        goto smf_Open_File_Cleanup;
    }

    lstrcpyn(pSmf->szName, psofs->pstrName, 128);
    pSmf->fdwSMF = 0;
    pSmf->pTempoMap = NULL;

    /* Pull the entire file into a block of memory.
    */
    _fmemset(&ckRIFF, 0, sizeof(ckRIFF));

    if (0 == mmioDescend(hmmio, &ckRIFF, NULL, MMIO_FINDRIFF) &&
        ckRIFF.fccType == FOURCC_RMID)
    {
        ckDATA.ckid = FOURCC_data;

        if (0 == mmioDescend(hmmio, &ckDATA, &ckRIFF, MMIO_FINDCHUNK))
        {
            pSmf->cbImage   = ckDATA.cksize;
        }
        else
        {
            DPF(1, "smfOpenFile: Could not descend into RIFF DATA chunk!");
            smfrc = SMF_INVALID_FILE;
            goto smf_Open_File_Cleanup;
        }
    }
    else
    {
        mmioSeek(hmmio, 0L, SEEK_SET);

        pSmf->cbImage = mmioSeek(hmmio, 0L, SEEK_END);
        mmioSeek(hmmio, 0L, SEEK_SET);
    }

    if (NULL == (pSmf->hpbImage = GlobalAllocPtr(GMEM_MOVEABLE|GMEM_SHARE, pSmf->cbImage)))
    {
        DPF(1, "smfOpenFile: No memory for image! [%08lX]", pSmf->cbImage);
        smfrc = SMF_NO_MEMORY;
        goto smf_Open_File_Cleanup;
    }

    if (pSmf->cbImage != (DWORD)mmioRead(hmmio, pSmf->hpbImage, pSmf->cbImage))
    {
        DPF(1, "smfOpenFile: Read error on image!");
        smfrc = SMF_INVALID_FILE;
        goto smf_Open_File_Cleanup;
    }

    /* If the file exists, parse it just enough to pull out the header and
    ** build a track index.
    */
    smfrc = smfBuildFileIndex((PSMF BSTACK *)&pSmf);
    if (MMSYSERR_NOERROR != smfrc)
    {
        DPF(1, "smfOpenFile: smfBuildFileIndex failed! [%lu]", (DWORD)smfrc);
    }

smf_Open_File_Cleanup:

    mmioClose(hmmio, 0);

    if (SMF_SUCCESS != smfrc)
    {
        if (NULL != pSmf)
        {
            if (NULL != pSmf->hpbImage)
            {
                GlobalFreePtr(pSmf->hpbImage);
            }

            LocalFree((HLOCAL)pSmf);
        }
    }
    else
    {
        psofs->hSmf = (HSMF)pSmf;
    }

    return smfrc;
}

SMFRESULT FNLOCAL smfReadEvents | ( | HSMF | hSmf,
 |  | LPMIDIHDR | lpmh,
 |  | TICKS | tkMax
 | ) |  |

Definition at line 413 of file SMF.c.

{
    PSMF                    pSmf = (PSMF)hSmf;
    SMFRESULT               smfrc;
    EVENT                   event;
    LPDWORD                 lpdw;
    DWORD                   dwTempo;

    assert(pSmf != NULL);
    assert(lpmh != NULL);

    /*
    ** Read events from the track and pack them into the buffer in polymsg
    ** format.
    **
    ** If a SysEx or meta would go over a buffer boundry, split it.
    */
    lpmh->dwBytesRecorded = 0;
    if (pSmf->dwPendingUserEvent)
    {
        smfrc = smfInsertParmData(pSmf, (TICKS)0, lpmh);
        if (SMF_SUCCESS != smfrc)
        {
            DPF(1, "smfInsertParmData() -> %u", (UINT)smfrc);
            return smfrc;
        }
    }

    lpdw = (LPDWORD)(lpmh->lpData + lpmh->dwBytesRecorded);

    if (pSmf->fdwSMF & SMF_F_EOF)
    {
        return SMF_END_OF_FILE;
    }

    while(TRUE)
    {
        assert(lpmh->dwBytesRecorded <= lpmh->dwBufferLength);

        /* If we know ahead of time we won't have room for the
        ** event, just break out now. We need 2 DWORD's for the
        ** terminator event and at least 2 DWORD's for any
        ** event we might store - this will allow us a full
        ** short event or the delta time and stub for a long
        ** event to be split.
        */
        if (lpmh->dwBufferLength - lpmh->dwBytesRecorded < 4*sizeof(DWORD))
        {
            break;
        }

        smfrc = smfGetNextEvent(pSmf, (SPEVENT)&event, tkMax);
        if (SMF_SUCCESS != smfrc)
        {
            /* smfGetNextEvent doesn't set this because smfSeek uses it
            ** as well and needs to distinguish between reaching the
            ** seek point and reaching end-of-file.
            **
            ** To the user, however, we present the selection between
            ** their given tkBase and tkEnd as the entire file, therefore
            ** we want to translate this into EOF.
            */
            if (SMF_REACHED_TKMAX == smfrc)
            {
                pSmf->fdwSMF |= SMF_F_EOF;
            }

            DPF(1, "smfReadEvents: smfGetNextEvent() -> %u", (UINT)smfrc);
            break;
        }

        if (MIDI_SYSEX > EVENT_TYPE(event))
        {
            *lpdw++ = (DWORD)event.tkDelta;
            *lpdw++ = 0;
            *lpdw++ = (((DWORD)MEVT_SHORTMSG)<<24) |
                      ((DWORD)EVENT_TYPE(event)) |
                      (((DWORD)EVENT_CH_B1(event)) << 8) |
                      (((DWORD)EVENT_CH_B2(event)) << 16);

            lpmh->dwBytesRecorded += 3*sizeof(DWORD);
        }
        else if (MIDI_META == EVENT_TYPE(event) &&
                 MIDI_META_EOT == EVENT_META_TYPE(event))
        {
            /* These are ignoreable since smfReadNextEvent()
            ** takes care of track merging
            */
        }
        else if (MIDI_META == EVENT_TYPE(event) &&
                 MIDI_META_TEMPO == EVENT_META_TYPE(event))
        {
            if (event.cbParm != 3)
            {
                DPF(1, "smfReadEvents: Corrupt tempo event");
                return SMF_INVALID_FILE;
            }

            dwTempo = (((DWORD)MEVT_TEMPO)<<24)|
                      (((DWORD)event.hpbParm[0])<<16)|
                      (((DWORD)event.hpbParm[1])<<8)|
                      ((DWORD)event.hpbParm[2]);

            *lpdw++ = (DWORD)event.tkDelta;
            *lpdw++ = 0;
            *lpdw++ = dwTempo;

            lpmh->dwBytesRecorded += 3*sizeof(DWORD);
        }
        else if (MIDI_META != EVENT_TYPE(event))
        {
            /* Must be F0 or F7 system exclusive or FF meta
            ** that we didn't recognize
            */
            pSmf->cbPendingUserEvent = event.cbParm;
            pSmf->hpbPendingUserEvent = event.hpbParm;
            pSmf->fdwSMF &= ~SMF_F_INSERTSYSEX;

            switch(EVENT_TYPE(event))
            {
                case MIDI_SYSEX:
                    pSmf->fdwSMF |= SMF_F_INSERTSYSEX;

                    ++pSmf->cbPendingUserEvent;

                    /* Falling through...
                    */

                case MIDI_SYSEXEND:
                    pSmf->dwPendingUserEvent = ((DWORD)MEVT_LONGMSG) << 24;
                    break;
            }

            smfrc = smfInsertParmData(pSmf, event.tkDelta, lpmh);
            if (SMF_SUCCESS != smfrc)
            {
                DPF(1, "smfInsertParmData[2] %u", (UINT)smfrc);
                return smfrc;
            }

            lpdw = (LPDWORD)(lpmh->lpData + lpmh->dwBytesRecorded);
        }
    }

    return (pSmf->fdwSMF & SMF_F_EOF) ? SMF_END_OF_FILE : SMF_SUCCESS;
}

SMFRESULT FNLOCAL smfSeek | ( | HSMF | hSmf,
 |  | TICKS | tkPosition,
 |  | LPMIDIHDR | lpmh
 | ) |  |

Definition at line 716 of file SMF.c.

{
    PSMF                    pSmf    = (PSMF)hSmf;
    PTRACK                  ptrk;
    DWORD                   idxTrack;
    SMFRESULT               smfrc;
    EVENT                   event;
    LPDWORD                 lpdw;
    BYTE                    bEvent;
    UINT                    idx;
    UINT                    idxChannel;
    UINT                    idxController;

    static KEYFRAME         kf;

    _fmemset(&kf, 0xFF, sizeof(kf));

    pSmf->tkPosition = 0;
    pSmf->fdwSMF &= ~SMF_F_EOF;

    for (ptrk = pSmf->rTracks, idxTrack = pSmf->dwTracks; idxTrack--; ptrk++)
    {
        ptrk->pSmf              = pSmf;
        ptrk->tkPosition        = 0;
        ptrk->cbLeft            = ptrk->smti.cbLength;
        ptrk->hpbImage          = pSmf->hpbImage + ptrk->idxTrack;
        ptrk->bRunningStatus    = 0;
        ptrk->fdwTrack          = 0;
    }

    while (SMF_SUCCESS == (smfrc = smfGetNextEvent(pSmf, (SPEVENT)&event, tkPosition)))
    {
        if (MIDI_META == (bEvent = EVENT_TYPE(event)))
        {
            if (EVENT_META_TYPE(event) == MIDI_META_TEMPO)
            {
                if (event.cbParm != sizeof(kf.rbTempo))
                    return SMF_INVALID_FILE;

                hmemcpy((HPBYTE)kf.rbTempo, event.hpbParm, event.cbParm);
            }
        }
        else switch(bEvent & 0xF0)
        {
            case MIDI_PROGRAMCHANGE:
                kf.rbProgram[bEvent & 0x0F] = EVENT_CH_B1(event);
                break;

            case MIDI_CONTROLCHANGE:
                kf.rbControl[(((WORD)bEvent & 0x0F)*120) + EVENT_CH_B1(event)] =
                    EVENT_CH_B2(event);
                break;
        }
    }

    if (SMF_REACHED_TKMAX != smfrc)
    {
        return smfrc;
    }

    /* Build lpmh from keyframe
    */
    lpmh->dwBytesRecorded = 0;
    lpdw = (LPDWORD)lpmh->lpData;

    /* Tempo change event?
    */
    if (KF_EMPTY != kf.rbTempo[0] ||
        KF_EMPTY != kf.rbTempo[1] ||
        KF_EMPTY != kf.rbTempo[2])
    {
        if (lpmh->dwBufferLength - lpmh->dwBytesRecorded < 3*sizeof(DWORD))
            return SMF_NO_MEMORY;

        *lpdw++ = 0;
        *lpdw++ = 0;
        *lpdw++ = (((DWORD)kf.rbTempo[0])<<16)|
                  (((DWORD)kf.rbTempo[1])<<8)|
                  ((DWORD)kf.rbTempo[2])|
                  (((DWORD)MEVT_TEMPO) << 24);

        lpmh->dwBytesRecorded += 3*sizeof(DWORD);
    }

    /* Program change events?
    */
    for (idx = 0; idx < 16; idx++)
    {
        if (KF_EMPTY != kf.rbProgram[idx])
        {
            if (lpmh->dwBufferLength - lpmh->dwBytesRecorded < 3*sizeof(DWORD))
                return SMF_NO_MEMORY;

            *lpdw++ = 0;
            *lpdw++ = 0;
            *lpdw++ = (((DWORD)MEVT_SHORTMSG) << 24)      |
                      ((DWORD)MIDI_PROGRAMCHANGE)         |
                      ((DWORD)idx)                        |
                      (((DWORD)kf.rbProgram[idx]) << 8);

            lpmh->dwBytesRecorded += 3*sizeof(DWORD);
        }
    }

    /* Controller events?
    */
    idx = 0;
    for (idxChannel = 0; idxChannel < 16; idxChannel++)
    {
        for (idxController = 0; idxController < 120; idxController++)
        {
            if (KF_EMPTY != kf.rbControl[idx])
            {
                if (lpmh->dwBufferLength - lpmh->dwBytesRecorded < 3*sizeof(DWORD))
                    return SMF_NO_MEMORY;

                *lpdw++ = 0;
                *lpdw++ = 0;
                *lpdw++ = (((DWORD)MEVT_SHORTMSG << 24)     |
                          ((DWORD)MIDI_CONTROLCHANGE)       |
                          ((DWORD)idxChannel)               |
                          (((DWORD)idxController) << 8)     |
                          (((DWORD)kf.rbControl[idx]) << 16));

                lpmh->dwBytesRecorded += 3*sizeof(DWORD);
            }

            idx++;
        }
    }

    /* Force all tracks to be at tkPosition. We are guaranteed that
    ** all tracks will be past the event immediately preceding tkPosition;
    ** this will force correct delta-ticks to be generated so that events
    ** on all tracks will line up properly on a seek into the middle of the
    ** file.
    */
    for (ptrk = pSmf->rTracks, idxTrack = pSmf->dwTracks; idxTrack--; ptrk++)
    {
        ptrk->tkPosition        = tkPosition;
    }

    return SMF_SUCCESS;
}

DWORD FNLOCAL smfTicksToMillisecs | ( | HSMF | hSmf,
 |  | TICKS | tkOffset
 | ) |  |

Definition at line 257 of file SMF.c.

{
    PSMF                    pSmf            = (PSMF)hSmf;
    PTEMPOMAPENTRY          pTempo;
    UINT                    idx;
    UINT                    uSMPTE;
    DWORD                   dwTicksPerSec;

    assert(pSmf != NULL);

    if (tkOffset > pSmf->tkLength)
    {
        DPF(1, "sTTM: Clipping ticks to file length!");
        tkOffset = pSmf->tkLength;
    }

    /* SMPTE time is easy -- no tempo map, just linear conversion
    ** Note that 30-Drop means nothing to us here since we're not
    ** converting to a colonized format, which is where dropping
    ** happens.
    */
    if (pSmf->dwTimeDivision & 0x8000)
    {
        uSMPTE = -(int)(char)((pSmf->dwTimeDivision >> 8)&0xFF);
        if (29 == uSMPTE)
            uSMPTE = 30;

        dwTicksPerSec = (DWORD)uSMPTE *
                        (DWORD)(BYTE)(pSmf->dwTimeDivision & 0xFF);

        return (DWORD)muldiv32(tkOffset, 1000L, dwTicksPerSec);
    }

    /* Walk the tempo map and find the nearest tick position. Linearly
    ** calculate the rest (using MATH.ASM)
    */

    pTempo = pSmf->pTempoMap;
    assert(pTempo != NULL);

    for (idx = 0; idx < pSmf->cTempoMap; idx++, pTempo++)
        if (tkOffset < pTempo->tkTempo)
            break;
    pTempo--;

    /* pTempo is the tempo map entry preceding the requested tick offset.
    */

    return pTempo->msBase + muldiv32(tkOffset-pTempo->tkTempo,
                                     pTempo->dwTempo,
                                     1000L*pSmf->dwTimeDivision);

}

Generated on Wed Nov 13 2024 16:53:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Audio/MidiPlyr/SMF.h File Reference

  • Multimedia
  • Audio
  • MidiPlyr
Classes | Defines | Typedefs | Functions

SMF.h File Reference

#include "global.h"

Go to the source code of this file.

Classes

struct | tag_smffileinfo
struct | tag_smfopenstruct

Defines

#define | MAX_TICKS ((TICKS)0xFFFFFFFFL)
#define | PMSG_META ((BYTE)0xC0)
#define | SMF_ALREADY_OPEN (6L)
#define | SMF_END_OF_FILE (11L)
#define | SMF_END_OF_TRACK (7L)
#define | SMF_INVALID_BUFFER (10L)
#define | SMF_INVALID_FILE (1L)
#define | SMF_INVALID_PARM (9L)
#define | SMF_INVALID_TRACK (4L)
#define | SMF_META_PENDING (5L)
#define | SMF_NO_MEMORY (2L)
#define | SMF_NO_META (8L)
#define | SMF_OPEN_FAILED (3L)
#define | SMF_REACHED_TKMAX (12L)
#define | SMF_SUCCESS (0L)

Typedefs

typedef BYTE HUGE * | HPBYTE
typedef struct tag_smffileinfo * | PSMFFILEINFO
typedef struct tag_smfopenstruct * | PSMFOPENFILESTRUCT
typedef TICKS FAR * | PTICKS
typedef struct tag_smffileinfo | SMFFILEINFO
typedef struct tag_smfopenstruct | SMFOPENFILESTRUCT
typedef DWORD | SMFRESULT
typedef DWORD | TICKS

Functions

DECLARE_HANDLE (HSMF)
SMFRESULT FNLOCAL | smfCloseFile (HSMF hsmf)
SMFRESULT FNLOCAL | smfGetFileInfo (HSMF hsmf, PSMFFILEINFO psfi)
DWORD FNLOCAL | smfGetStateMaxSize (void)
DWORD FNLOCAL | smfMillisecsToTicks (HSMF hsmf, DWORD msOffset)
SMFRESULT FNLOCAL | smfOpenFile (PSMFOPENFILESTRUCT psofs)
SMFRESULT FNLOCAL | smfReadEvents (HSMF hsmf, LPMIDIHDR lpmh, TICKS tkMax)
SMFRESULT FNLOCAL | smfSeek (HSMF hsmf, TICKS tkPosition, LPMIDIHDR lpmh)
DWORD FNLOCAL | smfTicksToMillisecs (HSMF hsmf, TICKS tkOffset)

Define Documentation

#define MAX_TICKS ((TICKS)0xFFFFFFFFL)

Definition at line 28 of file SMF.h.

#define PMSG_META ((BYTE)0xC0)

Definition at line 98 of file SMF.h.

#define SMF_ALREADY_OPEN (6L)

Definition at line 36 of file SMF.h.

#define SMF_END_OF_FILE (11L)

Definition at line 41 of file SMF.h.

#define SMF_END_OF_TRACK (7L)

Definition at line 37 of file SMF.h.

#define SMF_INVALID_BUFFER (10L)

Definition at line 40 of file SMF.h.

#define SMF_INVALID_FILE (1L)

Definition at line 31 of file SMF.h.

#define SMF_INVALID_PARM (9L)

Definition at line 39 of file SMF.h.

#define SMF_INVALID_TRACK (4L)

Definition at line 34 of file SMF.h.

#define SMF_META_PENDING (5L)

Definition at line 35 of file SMF.h.

#define SMF_NO_MEMORY (2L)

Definition at line 32 of file SMF.h.

#define SMF_NO_META (8L)

Definition at line 38 of file SMF.h.

#define SMF_OPEN_FAILED (3L)

Definition at line 33 of file SMF.h.

#define SMF_REACHED_TKMAX (12L)

Definition at line 42 of file SMF.h.

#define SMF_SUCCESS (0L)

Definition at line 30 of file SMF.h.

Typedef Documentation

typedef BYTE HUGE* HPBYTE

Definition at line 26 of file SMF.h.

typedef struct tag_smffileinfo* PSMFFILEINFO
typedef struct tag_smfopenstruct* PSMFOPENFILESTRUCT
typedef TICKS FAR* PTICKS

Definition at line 25 of file SMF.h.

typedef struct tag_smffileinfo SMFFILEINFO
typedef struct tag_smfopenstruct SMFOPENFILESTRUCT
typedef DWORD SMFRESULT

Definition at line 23 of file SMF.h.

typedef DWORD TICKS

Definition at line 24 of file SMF.h.

Function Documentation

DECLARE_HANDLE ( HSMF )
SMFRESULT FNLOCAL smfCloseFile ( HSMF hsmf )

Definition at line 184 of file SMF.c.

{
    PSMF                    pSmf        = (PSMF)hSmf;

    assert(pSmf != NULL);

    /*
    ** Free up handle memory
    */

    if (NULL != pSmf->hpbImage)
        GlobalFreePtr(pSmf->hpbImage);

    LocalFree((HLOCAL)pSmf);

    return SMF_SUCCESS;
}

SMFRESULT FNLOCAL smfGetFileInfo | ( | HSMF | hsmf,
 |  | PSMFFILEINFO | psfi
 | ) |  |

Definition at line 217 of file SMF.c.

{
    PSMF                    pSmf = (PSMF)hSmf;

    assert(pSmf != NULL);
    assert(psfi != NULL);

    /*
    ** Just fill in the structure with useful information.
    */
    psfi->dwTracks      = pSmf->dwTracks;
    psfi->dwFormat      = pSmf->dwFormat;
    psfi->dwTimeDivision= pSmf->dwTimeDivision;
    psfi->tkLength      = pSmf->tkLength;

    return SMF_SUCCESS;
}

DWORD FNLOCAL smfGetStateMaxSize ( void )
DWORD FNLOCAL smfMillisecsToTicks | ( | HSMF | hsmf,
 |  | DWORD | msOffset
 | ) |  |

Definition at line 336 of file SMF.c.

{
    PSMF                    pSmf            = (PSMF)hSmf;
    PTEMPOMAPENTRY          pTempo;
    UINT                    idx;
    UINT                    uSMPTE;
    DWORD                   dwTicksPerSec;
    TICKS                   tkOffset;

    assert(pSmf != NULL);

    /* SMPTE time is easy -- no tempo map, just linear conversion
    ** Note that 30-Drop means nothing to us here since we're not
    ** converting to a colonized format, which is where dropping
    ** happens.
    */
    if (pSmf->dwTimeDivision & 0x8000)
    {
        uSMPTE = -(int)(char)((pSmf->dwTimeDivision >> 8)&0xFF);
        if (29 == uSMPTE)
            uSMPTE = 30;

        dwTicksPerSec = (DWORD)uSMPTE *
                        (DWORD)(BYTE)(pSmf->dwTimeDivision & 0xFF);

        return (DWORD)muldiv32(msOffset, dwTicksPerSec, 1000L);
    }

    /* Walk the tempo map and find the nearest millisecond position. Linearly
    ** calculate the rest (using MATH.ASM)
    */
    pTempo = pSmf->pTempoMap;
    assert(pTempo != NULL);

    for (idx = 0; idx < pSmf->cTempoMap; idx++, pTempo++)
        if (msOffset < pTempo->msBase)
            break;
    pTempo--;

    /* pTempo is the tempo map entry preceding the requested tick offset.
    */

    tkOffset = pTempo->tkTempo + muldiv32(msOffset-pTempo->msBase,
                                     1000L*pSmf->dwTimeDivision,
                                     pTempo->dwTempo);

    if (tkOffset > pSmf->tkLength)
    {
        DPF(1, "sMTT: Clipping ticks to file length!");
        tkOffset = pSmf->tkLength;
    }

    return tkOffset;
}

SMFRESULT FNLOCAL smfOpenFile ( PSMFOPENFILESTRUCT psofs )

Definition at line 55 of file SMF.c.

{
    HMMIO                   hmmio = (HMMIO)NULL;
    PSMF                    pSmf;
    SMFRESULT               smfrc = SMF_SUCCESS;
    MMIOINFO                mmioinfo;
    MMCKINFO                ckRIFF;
    MMCKINFO                ckDATA;

    assert(psofs != NULL);
    assert(psofs->pstrName != NULL);

    /* Verify that the file can be opened or created
    */
    _fmemset(&mmioinfo, 0, sizeof(mmioinfo));

    hmmio = mmioOpen(psofs->pstrName, &mmioinfo, MMIO_READ|MMIO_ALLOCBUF);
    if ((HMMIO)NULL == hmmio)
    {
        DPF(1, "smfOpenFile: mmioOpen failed!");
        return SMF_OPEN_FAILED;
    }

    /* Now see if we can create the handle structure
    */
    pSmf = (PSMF)LocalAlloc(LPTR, sizeof(SMF));
    if (NULL == pSmf)
    {
        DPF(1, "smfOpenFile: LocalAlloc failed!");
        smfrc = SMF_NO_MEMORY;
        goto smf_Open_File_Cleanup;
    }

    lstrcpyn(pSmf->szName, psofs->pstrName, 128);
    pSmf->fdwSMF = 0;
    pSmf->pTempoMap = NULL;

    /* Pull the entire file into a block of memory.
    */
    _fmemset(&ckRIFF, 0, sizeof(ckRIFF));

    if (0 == mmioDescend(hmmio, &ckRIFF, NULL, MMIO_FINDRIFF) &&
        ckRIFF.fccType == FOURCC_RMID)
    {
        ckDATA.ckid = FOURCC_data;

        if (0 == mmioDescend(hmmio, &ckDATA, &ckRIFF, MMIO_FINDCHUNK))
        {
            pSmf->cbImage   = ckDATA.cksize;
        }
        else
        {
            DPF(1, "smfOpenFile: Could not descend into RIFF DATA chunk!");
            smfrc = SMF_INVALID_FILE;
            goto smf_Open_File_Cleanup;
        }
    }
    else
    {
        mmioSeek(hmmio, 0L, SEEK_SET);

        pSmf->cbImage = mmioSeek(hmmio, 0L, SEEK_END);
        mmioSeek(hmmio, 0L, SEEK_SET);
    }

    if (NULL == (pSmf->hpbImage = GlobalAllocPtr(GMEM_MOVEABLE|GMEM_SHARE, pSmf->cbImage)))
    {
        DPF(1, "smfOpenFile: No memory for image! [%08lX]", pSmf->cbImage);
        smfrc = SMF_NO_MEMORY;
        goto smf_Open_File_Cleanup;
    }

    if (pSmf->cbImage != (DWORD)mmioRead(hmmio, pSmf->hpbImage, pSmf->cbImage))
    {
        DPF(1, "smfOpenFile: Read error on image!");
        smfrc = SMF_INVALID_FILE;
        goto smf_Open_File_Cleanup;
    }

    /* If the file exists, parse it just enough to pull out the header and
    ** build a track index.
    */
    smfrc = smfBuildFileIndex((PSMF BSTACK *)&pSmf);
    if (MMSYSERR_NOERROR != smfrc)
    {
        DPF(1, "smfOpenFile: smfBuildFileIndex failed! [%lu]", (DWORD)smfrc);
    }

smf_Open_File_Cleanup:

    mmioClose(hmmio, 0);

    if (SMF_SUCCESS != smfrc)
    {
        if (NULL != pSmf)
        {
            if (NULL != pSmf->hpbImage)
            {
                GlobalFreePtr(pSmf->hpbImage);
            }

            LocalFree((HLOCAL)pSmf);
        }
    }
    else
    {
        psofs->hSmf = (HSMF)pSmf;
    }

    return smfrc;
}

SMFRESULT FNLOCAL smfReadEvents | ( | HSMF | hsmf,
 |  | LPMIDIHDR | lpmh,
 |  | TICKS | tkMax
 | ) |  |

Definition at line 413 of file SMF.c.

{
    PSMF                    pSmf = (PSMF)hSmf;
    SMFRESULT               smfrc;
    EVENT                   event;
    LPDWORD                 lpdw;
    DWORD                   dwTempo;

    assert(pSmf != NULL);
    assert(lpmh != NULL);

    /*
    ** Read events from the track and pack them into the buffer in polymsg
    ** format.
    **
    ** If a SysEx or meta would go over a buffer boundry, split it.
    */
    lpmh->dwBytesRecorded = 0;
    if (pSmf->dwPendingUserEvent)
    {
        smfrc = smfInsertParmData(pSmf, (TICKS)0, lpmh);
        if (SMF_SUCCESS != smfrc)
        {
            DPF(1, "smfInsertParmData() -> %u", (UINT)smfrc);
            return smfrc;
        }
    }

    lpdw = (LPDWORD)(lpmh->lpData + lpmh->dwBytesRecorded);

    if (pSmf->fdwSMF & SMF_F_EOF)
    {
        return SMF_END_OF_FILE;
    }

    while(TRUE)
    {
        assert(lpmh->dwBytesRecorded <= lpmh->dwBufferLength);

        /* If we know ahead of time we won't have room for the
        ** event, just break out now. We need 2 DWORD's for the
        ** terminator event and at least 2 DWORD's for any
        ** event we might store - this will allow us a full
        ** short event or the delta time and stub for a long
        ** event to be split.
        */
        if (lpmh->dwBufferLength - lpmh->dwBytesRecorded < 4*sizeof(DWORD))
        {
            break;
        }

        smfrc = smfGetNextEvent(pSmf, (SPEVENT)&event, tkMax);
        if (SMF_SUCCESS != smfrc)
        {
            /* smfGetNextEvent doesn't set this because smfSeek uses it
            ** as well and needs to distinguish between reaching the
            ** seek point and reaching end-of-file.
            **
            ** To the user, however, we present the selection between
            ** their given tkBase and tkEnd as the entire file, therefore
            ** we want to translate this into EOF.
            */
            if (SMF_REACHED_TKMAX == smfrc)
            {
                pSmf->fdwSMF |= SMF_F_EOF;
            }

            DPF(1, "smfReadEvents: smfGetNextEvent() -> %u", (UINT)smfrc);
            break;
        }

        if (MIDI_SYSEX > EVENT_TYPE(event))
        {
            *lpdw++ = (DWORD)event.tkDelta;
            *lpdw++ = 0;
            *lpdw++ = (((DWORD)MEVT_SHORTMSG)<<24) |
                      ((DWORD)EVENT_TYPE(event)) |
                      (((DWORD)EVENT_CH_B1(event)) << 8) |
                      (((DWORD)EVENT_CH_B2(event)) << 16);

            lpmh->dwBytesRecorded += 3*sizeof(DWORD);
        }
        else if (MIDI_META == EVENT_TYPE(event) &&
                 MIDI_META_EOT == EVENT_META_TYPE(event))
        {
            /* These are ignoreable since smfReadNextEvent()
            ** takes care of track merging
            */
        }
        else if (MIDI_META == EVENT_TYPE(event) &&
                 MIDI_META_TEMPO == EVENT_META_TYPE(event))
        {
            if (event.cbParm != 3)
            {
                DPF(1, "smfReadEvents: Corrupt tempo event");
                return SMF_INVALID_FILE;
            }

            dwTempo = (((DWORD)MEVT_TEMPO)<<24)|
                      (((DWORD)event.hpbParm[0])<<16)|
                      (((DWORD)event.hpbParm[1])<<8)|
                      ((DWORD)event.hpbParm[2]);

            *lpdw++ = (DWORD)event.tkDelta;
            *lpdw++ = 0;
            *lpdw++ = dwTempo;

            lpmh->dwBytesRecorded += 3*sizeof(DWORD);
        }
        else if (MIDI_META != EVENT_TYPE(event))
        {
            /* Must be F0 or F7 system exclusive or FF meta
            ** that we didn't recognize
            */
            pSmf->cbPendingUserEvent = event.cbParm;
            pSmf->hpbPendingUserEvent = event.hpbParm;
            pSmf->fdwSMF &= ~SMF_F_INSERTSYSEX;

            switch(EVENT_TYPE(event))
            {
                case MIDI_SYSEX:
                    pSmf->fdwSMF |= SMF_F_INSERTSYSEX;

                    ++pSmf->cbPendingUserEvent;

                    /* Falling through...
                    */

                case MIDI_SYSEXEND:
                    pSmf->dwPendingUserEvent = ((DWORD)MEVT_LONGMSG) << 24;
                    break;
            }

            smfrc = smfInsertParmData(pSmf, event.tkDelta, lpmh);
            if (SMF_SUCCESS != smfrc)
            {
                DPF(1, "smfInsertParmData[2] %u", (UINT)smfrc);
                return smfrc;
            }

            lpdw = (LPDWORD)(lpmh->lpData + lpmh->dwBytesRecorded);
        }
    }

    return (pSmf->fdwSMF & SMF_F_EOF) ? SMF_END_OF_FILE : SMF_SUCCESS;
}

SMFRESULT FNLOCAL smfSeek | ( | HSMF | hsmf,
 |  | TICKS | tkPosition,
 |  | LPMIDIHDR | lpmh
 | ) |  |

Definition at line 716 of file SMF.c.

{
    PSMF                    pSmf    = (PSMF)hSmf;
    PTRACK                  ptrk;
    DWORD                   idxTrack;
    SMFRESULT               smfrc;
    EVENT                   event;
    LPDWORD                 lpdw;
    BYTE                    bEvent;
    UINT                    idx;
    UINT                    idxChannel;
    UINT                    idxController;

    static KEYFRAME         kf;

    _fmemset(&kf, 0xFF, sizeof(kf));

    pSmf->tkPosition = 0;
    pSmf->fdwSMF &= ~SMF_F_EOF;

    for (ptrk = pSmf->rTracks, idxTrack = pSmf->dwTracks; idxTrack--; ptrk++)
    {
        ptrk->pSmf              = pSmf;
        ptrk->tkPosition        = 0;
        ptrk->cbLeft            = ptrk->smti.cbLength;
        ptrk->hpbImage          = pSmf->hpbImage + ptrk->idxTrack;
        ptrk->bRunningStatus    = 0;
        ptrk->fdwTrack          = 0;
    }

    while (SMF_SUCCESS == (smfrc = smfGetNextEvent(pSmf, (SPEVENT)&event, tkPosition)))
    {
        if (MIDI_META == (bEvent = EVENT_TYPE(event)))
        {
            if (EVENT_META_TYPE(event) == MIDI_META_TEMPO)
            {
                if (event.cbParm != sizeof(kf.rbTempo))
                    return SMF_INVALID_FILE;

                hmemcpy((HPBYTE)kf.rbTempo, event.hpbParm, event.cbParm);
            }
        }
        else switch(bEvent & 0xF0)
        {
            case MIDI_PROGRAMCHANGE:
                kf.rbProgram[bEvent & 0x0F] = EVENT_CH_B1(event);
                break;

            case MIDI_CONTROLCHANGE:
                kf.rbControl[(((WORD)bEvent & 0x0F)*120) + EVENT_CH_B1(event)] =
                    EVENT_CH_B2(event);
                break;
        }
    }

    if (SMF_REACHED_TKMAX != smfrc)
    {
        return smfrc;
    }

    /* Build lpmh from keyframe
    */
    lpmh->dwBytesRecorded = 0;
    lpdw = (LPDWORD)lpmh->lpData;

    /* Tempo change event?
    */
    if (KF_EMPTY != kf.rbTempo[0] ||
        KF_EMPTY != kf.rbTempo[1] ||
        KF_EMPTY != kf.rbTempo[2])
    {
        if (lpmh->dwBufferLength - lpmh->dwBytesRecorded < 3*sizeof(DWORD))
            return SMF_NO_MEMORY;

        *lpdw++ = 0;
        *lpdw++ = 0;
        *lpdw++ = (((DWORD)kf.rbTempo[0])<<16)|
                  (((DWORD)kf.rbTempo[1])<<8)|
                  ((DWORD)kf.rbTempo[2])|
                  (((DWORD)MEVT_TEMPO) << 24);

        lpmh->dwBytesRecorded += 3*sizeof(DWORD);
    }

    /* Program change events?
    */
    for (idx = 0; idx < 16; idx++)
    {
        if (KF_EMPTY != kf.rbProgram[idx])
        {
            if (lpmh->dwBufferLength - lpmh->dwBytesRecorded < 3*sizeof(DWORD))
                return SMF_NO_MEMORY;

            *lpdw++ = 0;
            *lpdw++ = 0;
            *lpdw++ = (((DWORD)MEVT_SHORTMSG) << 24)      |
                      ((DWORD)MIDI_PROGRAMCHANGE)         |
                      ((DWORD)idx)                        |
                      (((DWORD)kf.rbProgram[idx]) << 8);

            lpmh->dwBytesRecorded += 3*sizeof(DWORD);
        }
    }

    /* Controller events?
    */
    idx = 0;
    for (idxChannel = 0; idxChannel < 16; idxChannel++)
    {
        for (idxController = 0; idxController < 120; idxController++)
        {
            if (KF_EMPTY != kf.rbControl[idx])
            {
                if (lpmh->dwBufferLength - lpmh->dwBytesRecorded < 3*sizeof(DWORD))
                    return SMF_NO_MEMORY;

                *lpdw++ = 0;
                *lpdw++ = 0;
                *lpdw++ = (((DWORD)MEVT_SHORTMSG << 24)     |
                          ((DWORD)MIDI_CONTROLCHANGE)       |
                          ((DWORD)idxChannel)               |
                          (((DWORD)idxController) << 8)     |
                          (((DWORD)kf.rbControl[idx]) << 16));

                lpmh->dwBytesRecorded += 3*sizeof(DWORD);
            }

            idx++;
        }
    }

    /* Force all tracks to be at tkPosition. We are guaranteed that
    ** all tracks will be past the event immediately preceding tkPosition;
    ** this will force correct delta-ticks to be generated so that events
    ** on all tracks will line up properly on a seek into the middle of the
    ** file.
    */
    for (ptrk = pSmf->rTracks, idxTrack = pSmf->dwTracks; idxTrack--; ptrk++)
    {
        ptrk->tkPosition        = tkPosition;
    }

    return SMF_SUCCESS;
}

DWORD FNLOCAL smfTicksToMillisecs | ( | HSMF | hsmf,
 |  | TICKS | tkOffset
 | ) |  |

Definition at line 257 of file SMF.c.

{
    PSMF                    pSmf            = (PSMF)hSmf;
    PTEMPOMAPENTRY          pTempo;
    UINT                    idx;
    UINT                    uSMPTE;
    DWORD                   dwTicksPerSec;

    assert(pSmf != NULL);

    if (tkOffset > pSmf->tkLength)
    {
        DPF(1, "sTTM: Clipping ticks to file length!");
        tkOffset = pSmf->tkLength;
    }

    /* SMPTE time is easy -- no tempo map, just linear conversion
    ** Note that 30-Drop means nothing to us here since we're not
    ** converting to a colonized format, which is where dropping
    ** happens.
    */
    if (pSmf->dwTimeDivision & 0x8000)
    {
        uSMPTE = -(int)(char)((pSmf->dwTimeDivision >> 8)&0xFF);
        if (29 == uSMPTE)
            uSMPTE = 30;

        dwTicksPerSec = (DWORD)uSMPTE *
                        (DWORD)(BYTE)(pSmf->dwTimeDivision & 0xFF);

        return (DWORD)muldiv32(tkOffset, 1000L, dwTicksPerSec);
    }

    /* Walk the tempo map and find the nearest tick position. Linearly
    ** calculate the rest (using MATH.ASM)
    */

    pTempo = pSmf->pTempoMap;
    assert(pTempo != NULL);

    for (idx = 0; idx < pSmf->cTempoMap; idx++, pTempo++)
        if (tkOffset < pTempo->tkTempo)
            break;
    pTempo--;

    /* pTempo is the tempo map entry preceding the requested tick offset.
    */

    return pTempo->msBase + muldiv32(tkOffset-pTempo->tkTempo,
                                     pTempo->dwTempo,
                                     1000L*pSmf->dwTimeDivision);

}

Generated on Wed Nov 13 2024 16:53:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Audio/MidiPlyr/SMFI.h File Reference

  • Multimedia
  • Audio
  • MidiPlyr
Classes | Defines | Typedefs | Functions

SMFI.h File Reference

Go to the source code of this file.

Classes

struct | tag_chunkhdr
struct | tag_filehdr
struct | tag_smf
struct | tag_tempomapentry
struct | tag_track
struct | tagEVENT

Defines

#define | C_TEMPO_MAP_CHK 16
#define | DWORDSWAP(dw)
#define | EVENT_CH_B1(event) ((event).abEvent[1])
#define | EVENT_CH_B2(event) ((event).abEvent[2])
#define | EVENT_META_TYPE(event) ((event).abEvent[1])
#define | EVENT_TYPE(event) ((event).abEvent[0])
#define | FOURCC_data mmioFOURCC('d','a','t','a')
#define | FOURCC_MThd mmioFOURCC('M','T','h','d')
#define | FOURCC_MTrk mmioFOURCC('M','T','r','k')
#define | FOURCC_RMID mmioFOURCC('R','M','I','D')
#define | MIDI_CHANPRESSURE ((BYTE)0xD0)
#define | MIDI_CONTROLCHANGE ((BYTE)0xB0)
#define | MIDI_DEFAULT_TEMPO (500000L)
#define | MIDI_META ((BYTE)0xFF)
#define | MIDI_META_EOT ((BYTE)0x2F)
#define | MIDI_META_KEYSIG ((BYTE)0x59)
#define | MIDI_META_SEQSPECIFIC ((BYTE)0x7F)
#define | MIDI_META_TEMPO ((BYTE)0x51)
#define | MIDI_META_TIMESIG ((BYTE)0x58)
#define | MIDI_META_TRACKNAME ((BYTE)0x03)
#define | MIDI_MSG ((BYTE)0x80)
#define | MIDI_NOTEOFF ((BYTE)0x80)
#define | MIDI_NOTEON ((BYTE)0x90)
#define | MIDI_PITCHBEND ((BYTE)0xE0)
#define | MIDI_POLYPRESSURE ((BYTE)0xA0)
#define | MIDI_PROGRAMCHANGE ((BYTE)0xC0)
#define | MIDI_SYSEX ((BYTE)0xF0)
#define | MIDI_SYSEXEND ((BYTE)0xF7)
#define | SMF_F_EOF 0x00000001L
#define | SMF_F_INSERTSYSEX 0x00000002L
#define | SMF_TF_EOT 0x00000001L
#define | SMF_TF_INVALID 0x00000002L
#define | WORDSWAP(w)

Typedefs

typedef struct tag_chunkhdr | CHUNKHDR
typedef struct tagEVENT | EVENT
typedef struct tag_filehdr | FILEHDR
typedef struct tag_chunkhdr * | PCHUNKHDR
typedef struct tag_filehdr * | PFILEHDR
typedef struct tag_smf * | PSMF
typedef struct tag_tempomapentry * | PTEMPOMAPENTRY
typedef struct tag_track * | PTRACK
typedef struct tag_smf | SMF
typedef struct tagEVENT * | SPEVENT
typedef struct tag_tempomapentry | TEMPOMAPENTRY
typedef struct tag_track | TRACK

Functions

SMFRESULT FNLOCAL | smfBuildFileIndex (PSMF BSTACK *ppsmf)
SMFRESULT FNLOCAL | smfGetNextEvent (PSMF psmf, SPEVENT pevent, TICKS tkMax)
DWORD FNLOCAL | smfGetVDword (HPBYTE hpbImage, DWORD dwLeft, DWORD BSTACK *pdw)

Define Documentation

#define C_TEMPO_MAP_CHK 16

Definition at line 56 of file SMFI.h.

#define DWORDSWAP ( dw )
Value:
((((dw)>>24)&0x000000FFL)|\
    (((dw)>>8)&0x0000FF00L)|\
    (((dw)<<8)&0x00FF0000L)|\
    (((dw)<<24)&0xFF000000L))

Definition at line 117 of file SMFI.h.

#define EVENT_CH_B1 ( event ) ((event).abEvent[1])

Definition at line 96 of file SMFI.h.

#define EVENT_CH_B2 ( event ) ((event).abEvent[2])

Definition at line 97 of file SMFI.h.

#define EVENT_META_TYPE ( event ) ((event).abEvent[1])

Definition at line 99 of file SMFI.h.

#define EVENT_TYPE ( event ) ((event).abEvent[0])

Definition at line 95 of file SMFI.h.

#define FOURCC_data mmioFOURCC('d','a','t','a')

Definition at line 128 of file SMFI.h.

#define FOURCC_MThd mmioFOURCC('M','T','h','d')

Definition at line 129 of file SMFI.h.

#define FOURCC_MTrk mmioFOURCC('M','T','r','k')

Definition at line 130 of file SMFI.h.

#define FOURCC_RMID mmioFOURCC('R','M','I','D')

Definition at line 127 of file SMFI.h.

#define MIDI_CHANPRESSURE ((BYTE)0xD0)

Definition at line 160 of file SMFI.h.

#define MIDI_CONTROLCHANGE ((BYTE)0xB0)

Definition at line 158 of file SMFI.h.

#define MIDI_DEFAULT_TEMPO (500000L)

Definition at line 152 of file SMFI.h.

#define MIDI_META ((BYTE)0xFF)

Definition at line 162 of file SMFI.h.

#define MIDI_META_EOT ((BYTE)0x2F)

Definition at line 167 of file SMFI.h.

#define MIDI_META_KEYSIG ((BYTE)0x59)

Definition at line 170 of file SMFI.h.

#define MIDI_META_SEQSPECIFIC ((BYTE)0x7F)

Definition at line 171 of file SMFI.h.

#define MIDI_META_TEMPO ((BYTE)0x51)

Definition at line 168 of file SMFI.h.

#define MIDI_META_TIMESIG ((BYTE)0x58)

Definition at line 169 of file SMFI.h.

#define MIDI_META_TRACKNAME ((BYTE)0x03)

Definition at line 166 of file SMFI.h.

#define MIDI_MSG ((BYTE)0x80)

Definition at line 154 of file SMFI.h.

#define MIDI_NOTEOFF ((BYTE)0x80)

Definition at line 155 of file SMFI.h.

#define MIDI_NOTEON ((BYTE)0x90)

Definition at line 156 of file SMFI.h.

#define MIDI_PITCHBEND ((BYTE)0xE0)

Definition at line 161 of file SMFI.h.

#define MIDI_POLYPRESSURE ((BYTE)0xA0)

Definition at line 157 of file SMFI.h.

#define MIDI_PROGRAMCHANGE ((BYTE)0xC0)

Definition at line 159 of file SMFI.h.

#define MIDI_SYSEX ((BYTE)0xF0)

Definition at line 163 of file SMFI.h.

#define MIDI_SYSEXEND ((BYTE)0xF7)

Definition at line 164 of file SMFI.h.

#define SMF_F_EOF 0x00000001L

Definition at line 53 of file SMFI.h.

#define SMF_F_INSERTSYSEX 0x00000002L

Definition at line 54 of file SMFI.h.

#define SMF_TF_EOT 0x00000001L

Definition at line 17 of file SMFI.h.

#define SMF_TF_INVALID 0x00000002L

Definition at line 18 of file SMFI.h.

#define WORDSWAP ( w )
Value:
((((w)>>8)&0x00FF)|\
    (((w)<<8)&0xFF00))

Definition at line 123 of file SMFI.h.

Typedef Documentation

typedef struct tag_chunkhdr CHUNKHDR
typedef struct tagEVENT EVENT
typedef struct tag_filehdr FILEHDR
typedef struct tag_chunkhdr * PCHUNKHDR
typedef struct tag_filehdr * PFILEHDR
typedef struct tag_smf* PSMF

Definition at line 28 of file SMFI.h.

typedef struct tag_tempomapentry * PTEMPOMAPENTRY
typedef struct tag_track * PTRACK
typedef struct tag_smf SMF
typedef struct tagEVENT* SPEVENT
typedef struct tag_tempomapentry TEMPOMAPENTRY
typedef struct tag_track TRACK

Function Documentation

SMFRESULT FNLOCAL smfBuildFileIndex ( PSMF BSTACK * ppsmf )

Definition at line 69 of file SMFREAD.c.

{
    SMFRESULT               smfrc;
    UNALIGNED CHUNKHDR *    pCh;
    FILEHDR FAR *           pFh;
    DWORD                   idx;
    PSMF                    pSmf,
                            pSmfTemp;
    PTRACK                  pTrk;
    WORD                    wMemory;
    DWORD                   dwLeft;
    HPBYTE                  hpbImage;

    DWORD                   idxTrack;
    EVENT                   event;
    BOOL                    fFirst;
    DWORD                   dwLength;
    HLOCAL                  hLocal;
    PTEMPOMAPENTRY          pTempo;

    assert(ppSmf != NULL);

    pSmf = *ppSmf;

    assert(pSmf != NULL);

    /* MIDI data image is already in hpbImage (already extracted from
    ** RIFF header if necessary).
    */

    /* Validate MIDI header
    */
    dwLeft   = pSmf->cbImage;
    hpbImage = pSmf->hpbImage;

    if (dwLeft < sizeof(CHUNKHDR))
        return SMF_INVALID_FILE;

    pCh = (CHUNKHDR FAR *)hpbImage;

    dwLeft   -= sizeof(CHUNKHDR);
    hpbImage += sizeof(CHUNKHDR);

    if (pCh->fourccType != FOURCC_MThd)
        return SMF_INVALID_FILE;

    dwLength = DWORDSWAP(pCh->dwLength);
    if (dwLength < sizeof(FILEHDR) || dwLength > dwLeft)
        return SMF_INVALID_FILE;

    pFh = (FILEHDR FAR *)hpbImage;

    dwLeft   -= dwLength;
    hpbImage += dwLength;

    pSmf->dwFormat       = (DWORD)(WORDSWAP(pFh->wFormat));
    pSmf->dwTracks       = (DWORD)(WORDSWAP(pFh->wTracks));
    pSmf->dwTimeDivision = (DWORD)(WORDSWAP(pFh->wDivision));

    /*
    ** We've successfully parsed the header. Now try to build the track
    ** index.
    **
    ** We only check out the track header chunk here; the track will be
    ** preparsed after we do a quick integretiy check.
    */
    wMemory = sizeof(SMF) + (WORD)(pSmf->dwTracks*sizeof(TRACK));
    pSmfTemp = (PSMF)LocalReAlloc((HLOCAL)pSmf, wMemory, LMEM_MOVEABLE|LMEM_ZEROINIT);

    if (NULL == pSmfTemp)
    {
        DPF(1, "No memory for extended pSmf");
        return SMF_NO_MEMORY;
    }

    pSmf = *ppSmf = pSmfTemp;
    pTrk = pSmf->rTracks;

    for (idx=0; idx<pSmf->dwTracks; idx++)
    {
        if (dwLeft < sizeof(CHUNKHDR))
            return SMF_INVALID_FILE;

        pCh = (CHUNKHDR FAR *)hpbImage;

        dwLeft   -= sizeof(CHUNKHDR);
        hpbImage += sizeof(CHUNKHDR);

        if (pCh->fourccType != FOURCC_MTrk)
            return SMF_INVALID_FILE;

        pTrk->idxTrack      = (DWORD)(hpbImage - pSmf->hpbImage);
        pTrk->smti.cbLength = DWORDSWAP(pCh->dwLength);

        if (pTrk->smti.cbLength > dwLeft)
        {
            DPF(1, "Track longer than file!");
            return SMF_INVALID_FILE;
        }

        dwLeft   -= pTrk->smti.cbLength;
        hpbImage += pTrk->smti.cbLength;

        pTrk++;
    }

    /* File looks OK. Now preparse, doing the following:
    ** (1) Build tempo map so we can convert to/from ticks quickly
    ** (2) Determine actual tick length of file
    ** (3) Validate all events in all tracks
    */
    pSmf->tkPosition = 0;
    pSmf->fdwSMF &= ~SMF_F_EOF;

    for (pTrk = pSmf->rTracks, idxTrack = pSmf->dwTracks; idxTrack--; pTrk++)
    {
        pTrk->pSmf              = pSmf;
        pTrk->tkPosition        = 0;
        pTrk->cbLeft            = pTrk->smti.cbLength;
        pTrk->hpbImage          = pSmf->hpbImage + pTrk->idxTrack;
        pTrk->bRunningStatus    = 0;
        pTrk->fdwTrack          = 0;
    }

    while (SMF_SUCCESS == (smfrc = smfGetNextEvent(pSmf, (EVENT BSTACK *)&event, MAX_TICKS)))
    {
        if (MIDI_META == event.abEvent[0] &&
            MIDI_META_TEMPO == event.abEvent[1])
        {
            if (3 != event.cbParm)
            {
                return SMF_INVALID_FILE;
            }

            if (pSmf->cTempoMap == pSmf->cTempoMapAlloc)
            {
                if (NULL != pSmf->hTempoMap)
                {
                    LocalUnlock(pSmf->hTempoMap);
                }

                pSmf->cTempoMapAlloc += C_TEMPO_MAP_CHK;
                fFirst = FALSE;
                if (0 == pSmf->cTempoMap)
                {
                    hLocal = LocalAlloc(LHND, (UINT)(pSmf->cTempoMapAlloc*sizeof(TEMPOMAPENTRY)));
                    fFirst = TRUE;
                }
                else
                {
                    hLocal = LocalReAlloc(pSmf->hTempoMap, (UINT)(pSmf->cTempoMapAlloc*sizeof(TEMPOMAPENTRY)), LHND);
                }

                if (NULL == hLocal)
                {
                    return SMF_NO_MEMORY;
                }

                pSmf->pTempoMap = (PTEMPOMAPENTRY)LocalLock(pSmf->hTempoMap = hLocal);
            }

            if (fFirst && pSmf->tkPosition != 0)
            {
                /* Inserting first event and the absolute time is zero.
                ** Use defaults of 500,000 uSec/qn from MIDI spec
                */

                pTempo = &pSmf->pTempoMap[pSmf->cTempoMap++];

                pTempo->tkTempo = 0;
                pTempo->msBase  = 0;
                pTempo->dwTempo = MIDI_DEFAULT_TEMPO;

                fFirst = FALSE;
            }

            pTempo = &pSmf->pTempoMap[pSmf->cTempoMap++];

            pTempo->tkTempo = pSmf->tkPosition;
            if (fFirst)
                pTempo->msBase = 0;
            else
            {
                /* NOTE: Better not be here unless we're q/n format!
                */
                pTempo->msBase = (pTempo-1)->msBase +
                                 muldiv32(pTempo->tkTempo-((pTempo-1)->tkTempo),
                                          (pTempo-1)->dwTempo,
                                          1000L*pSmf->dwTimeDivision);
            }
            pTempo->dwTempo = (((DWORD)event.hpbParm[0])<<16)|
                              (((DWORD)event.hpbParm[1])<<8)|
                              ((DWORD)event.hpbParm[2]);
        }
    }

  if (0 == pSmf->cTempoMap)
  {
    DPF(1, "File contains no tempo map! Insert default tempo.");

    hLocal = LocalAlloc(LHND, sizeof(TEMPOMAPENTRY));
    if (!hLocal)
      return SMF_NO_MEMORY;

        pSmf->pTempoMap = (PTEMPOMAPENTRY)LocalLock(pSmf->hTempoMap = hLocal);
    pSmf->cTempoMap = 1;
    pSmf->cTempoMapAlloc = 1;

    pSmf->pTempoMap->tkTempo = 0;
        pSmf->pTempoMap->msBase  = 0;
        pSmf->pTempoMap->dwTempo = MIDI_DEFAULT_TEMPO;
  }

    if (SMF_END_OF_FILE == smfrc || SMF_SUCCESS == smfrc)
    {
        pSmf->tkLength = pSmf->tkPosition;
        smfrc = SMF_SUCCESS;
    }

    return smfrc;
}

SMFRESULT FNLOCAL smfGetNextEvent | ( | PSMF | psmf,
 |  | SPEVENT | pevent,
 |  | TICKS | tkMax
 | ) |  |
DWORD FNLOCAL smfGetVDword | ( | HPBYTE | hpbImage,
 |  | DWORD | dwLeft,
 |  | DWORD BSTACK * | pdw
 | ) |  |

Definition at line 550 of file SMFREAD.c.

{
    BYTE                    b;
    DWORD                   dwUsed  = 0;

    assert(hpbImage != NULL);
    assert(pDw != NULL);

    *pDw = 0;

    do
    {
        if (!dwLeft)
        {
            return 0;
        }

        b = *hpbImage++;
        dwLeft--;
        dwUsed++;

        *pDw = (*pDw << 7) | (b & 0x7F);
    } while (b&0x80);

    return dwUsed;
}

Generated on Wed Nov 13 2024 16:53:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Audio/MidiPlyr/SMFREAD.c File Reference

  • Multimedia
  • Audio
  • MidiPlyr
Functions | Variables

SMFREAD.c File Reference

#include <windows.h>
#include <windowsx.h>
#include <mmsystem.h>
#include <memory.h>
#include "muldiv32.h"
#include "smf.h"
#include "smfi.h"
#include "debug.h"

Go to the source code of this file.

Functions

SMFRESULT FNLOCAL | smfBuildFileIndex (PSMF BSTACK *ppSmf)
SMFRESULT FNLOCAL | smfGetNextEvent (PSMF pSmf, EVENT BSTACK *pEvent, TICKS tkMax)
DWORD FNLOCAL | smfGetVDword (HPBYTE hpbImage, DWORD dwLeft, DWORD BSTACK *pDw)

Variables

PRIVATE UINT | grbChanMsgLen []

Function Documentation

SMFRESULT FNLOCAL smfBuildFileIndex ( PSMF BSTACK * ppSmf )

Definition at line 69 of file SMFREAD.c.

{
    SMFRESULT               smfrc;
    UNALIGNED CHUNKHDR *    pCh;
    FILEHDR FAR *           pFh;
    DWORD                   idx;
    PSMF                    pSmf,
                            pSmfTemp;
    PTRACK                  pTrk;
    WORD                    wMemory;
    DWORD                   dwLeft;
    HPBYTE                  hpbImage;

    DWORD                   idxTrack;
    EVENT                   event;
    BOOL                    fFirst;
    DWORD                   dwLength;
    HLOCAL                  hLocal;
    PTEMPOMAPENTRY          pTempo;

    assert(ppSmf != NULL);

    pSmf = *ppSmf;

    assert(pSmf != NULL);

    /* MIDI data image is already in hpbImage (already extracted from
    ** RIFF header if necessary).
    */

    /* Validate MIDI header
    */
    dwLeft   = pSmf->cbImage;
    hpbImage = pSmf->hpbImage;

    if (dwLeft < sizeof(CHUNKHDR))
        return SMF_INVALID_FILE;

    pCh = (CHUNKHDR FAR *)hpbImage;

    dwLeft   -= sizeof(CHUNKHDR);
    hpbImage += sizeof(CHUNKHDR);

    if (pCh->fourccType != FOURCC_MThd)
        return SMF_INVALID_FILE;

    dwLength = DWORDSWAP(pCh->dwLength);
    if (dwLength < sizeof(FILEHDR) || dwLength > dwLeft)
        return SMF_INVALID_FILE;

    pFh = (FILEHDR FAR *)hpbImage;

    dwLeft   -= dwLength;
    hpbImage += dwLength;

    pSmf->dwFormat       = (DWORD)(WORDSWAP(pFh->wFormat));
    pSmf->dwTracks       = (DWORD)(WORDSWAP(pFh->wTracks));
    pSmf->dwTimeDivision = (DWORD)(WORDSWAP(pFh->wDivision));

    /*
    ** We've successfully parsed the header. Now try to build the track
    ** index.
    **
    ** We only check out the track header chunk here; the track will be
    ** preparsed after we do a quick integretiy check.
    */
    wMemory = sizeof(SMF) + (WORD)(pSmf->dwTracks*sizeof(TRACK));
    pSmfTemp = (PSMF)LocalReAlloc((HLOCAL)pSmf, wMemory, LMEM_MOVEABLE|LMEM_ZEROINIT);

    if (NULL == pSmfTemp)
    {
        DPF(1, "No memory for extended pSmf");
        return SMF_NO_MEMORY;
    }

    pSmf = *ppSmf = pSmfTemp;
    pTrk = pSmf->rTracks;

    for (idx=0; idx<pSmf->dwTracks; idx++)
    {
        if (dwLeft < sizeof(CHUNKHDR))
            return SMF_INVALID_FILE;

        pCh = (CHUNKHDR FAR *)hpbImage;

        dwLeft   -= sizeof(CHUNKHDR);
        hpbImage += sizeof(CHUNKHDR);

        if (pCh->fourccType != FOURCC_MTrk)
            return SMF_INVALID_FILE;

        pTrk->idxTrack      = (DWORD)(hpbImage - pSmf->hpbImage);
        pTrk->smti.cbLength = DWORDSWAP(pCh->dwLength);

        if (pTrk->smti.cbLength > dwLeft)
        {
            DPF(1, "Track longer than file!");
            return SMF_INVALID_FILE;
        }

        dwLeft   -= pTrk->smti.cbLength;
        hpbImage += pTrk->smti.cbLength;

        pTrk++;
    }

    /* File looks OK. Now preparse, doing the following:
    ** (1) Build tempo map so we can convert to/from ticks quickly
    ** (2) Determine actual tick length of file
    ** (3) Validate all events in all tracks
    */
    pSmf->tkPosition = 0;
    pSmf->fdwSMF &= ~SMF_F_EOF;

    for (pTrk = pSmf->rTracks, idxTrack = pSmf->dwTracks; idxTrack--; pTrk++)
    {
        pTrk->pSmf              = pSmf;
        pTrk->tkPosition        = 0;
        pTrk->cbLeft            = pTrk->smti.cbLength;
        pTrk->hpbImage          = pSmf->hpbImage + pTrk->idxTrack;
        pTrk->bRunningStatus    = 0;
        pTrk->fdwTrack          = 0;
    }

    while (SMF_SUCCESS == (smfrc = smfGetNextEvent(pSmf, (EVENT BSTACK *)&event, MAX_TICKS)))
    {
        if (MIDI_META == event.abEvent[0] &&
            MIDI_META_TEMPO == event.abEvent[1])
        {
            if (3 != event.cbParm)
            {
                return SMF_INVALID_FILE;
            }

            if (pSmf->cTempoMap == pSmf->cTempoMapAlloc)
            {
                if (NULL != pSmf->hTempoMap)
                {
                    LocalUnlock(pSmf->hTempoMap);
                }

                pSmf->cTempoMapAlloc += C_TEMPO_MAP_CHK;
                fFirst = FALSE;
                if (0 == pSmf->cTempoMap)
                {
                    hLocal = LocalAlloc(LHND, (UINT)(pSmf->cTempoMapAlloc*sizeof(TEMPOMAPENTRY)));
                    fFirst = TRUE;
                }
                else
                {
                    hLocal = LocalReAlloc(pSmf->hTempoMap, (UINT)(pSmf->cTempoMapAlloc*sizeof(TEMPOMAPENTRY)), LHND);
                }

                if (NULL == hLocal)
                {
                    return SMF_NO_MEMORY;
                }

                pSmf->pTempoMap = (PTEMPOMAPENTRY)LocalLock(pSmf->hTempoMap = hLocal);
            }

            if (fFirst && pSmf->tkPosition != 0)
            {
                /* Inserting first event and the absolute time is zero.
                ** Use defaults of 500,000 uSec/qn from MIDI spec
                */

                pTempo = &pSmf->pTempoMap[pSmf->cTempoMap++];

                pTempo->tkTempo = 0;
                pTempo->msBase  = 0;
                pTempo->dwTempo = MIDI_DEFAULT_TEMPO;

                fFirst = FALSE;
            }

            pTempo = &pSmf->pTempoMap[pSmf->cTempoMap++];

            pTempo->tkTempo = pSmf->tkPosition;
            if (fFirst)
                pTempo->msBase = 0;
            else
            {
                /* NOTE: Better not be here unless we're q/n format!
                */
                pTempo->msBase = (pTempo-1)->msBase +
                                 muldiv32(pTempo->tkTempo-((pTempo-1)->tkTempo),
                                          (pTempo-1)->dwTempo,
                                          1000L*pSmf->dwTimeDivision);
            }
            pTempo->dwTempo = (((DWORD)event.hpbParm[0])<<16)|
                              (((DWORD)event.hpbParm[1])<<8)|
                              ((DWORD)event.hpbParm[2]);
        }
    }

  if (0 == pSmf->cTempoMap)
  {
    DPF(1, "File contains no tempo map! Insert default tempo.");

    hLocal = LocalAlloc(LHND, sizeof(TEMPOMAPENTRY));
    if (!hLocal)
      return SMF_NO_MEMORY;

        pSmf->pTempoMap = (PTEMPOMAPENTRY)LocalLock(pSmf->hTempoMap = hLocal);
    pSmf->cTempoMap = 1;
    pSmf->cTempoMapAlloc = 1;

    pSmf->pTempoMap->tkTempo = 0;
        pSmf->pTempoMap->msBase  = 0;
        pSmf->pTempoMap->dwTempo = MIDI_DEFAULT_TEMPO;
  }

    if (SMF_END_OF_FILE == smfrc || SMF_SUCCESS == smfrc)
    {
        pSmf->tkLength = pSmf->tkPosition;
        smfrc = SMF_SUCCESS;
    }

    return smfrc;
}

SMFRESULT FNLOCAL smfGetNextEvent | ( | PSMF | pSmf,
 |  | EVENT BSTACK * | pEvent,
 |  | TICKS | tkMax
 | ) |  |

Definition at line 370 of file SMFREAD.c.

{
    PTRACK                  pTrk;
    PTRACK                  pTrkFound;
    DWORD                   idxTrack;
    TICKS                   tkEventDelta;
    TICKS                   tkRelTime;
    TICKS                   tkMinRelTime;
    BYTE                    bEvent;
    DWORD                   dwGotTotal;
    DWORD                   dwGot;
    DWORD                   cbEvent;

    assert(pSmf != NULL);
    assert(pEvent != NULL);

    if (pSmf->fdwSMF & SMF_F_EOF)
    {
        return SMF_END_OF_FILE;
    }

    pTrkFound       = NULL;
    tkMinRelTime    = MAX_TICKS;

    for (pTrk = pSmf->rTracks, idxTrack = pSmf->dwTracks; idxTrack--; pTrk++)
    {
        if (pTrk->fdwTrack & SMF_TF_EOT)
            continue;

        if (!smfGetVDword(pTrk->hpbImage, pTrk->cbLeft, (DWORD BSTACK *)&tkEventDelta))
        {
            DPF(1, "Hit end of track w/o end marker!");
            return SMF_INVALID_FILE;
        }

        tkRelTime = pTrk->tkPosition + tkEventDelta - pSmf->tkPosition;

        if (tkRelTime < tkMinRelTime)
        {
            tkMinRelTime = tkRelTime;
            pTrkFound = pTrk;
        }
    }

    if (!pTrkFound)
    {
        pSmf->fdwSMF |= SMF_F_EOF;
        return SMF_END_OF_FILE;
    }

    pTrk = pTrkFound;

    if (pSmf->tkPosition + tkMinRelTime >= tkMax)
    {
        return SMF_REACHED_TKMAX;
    }

    pTrk->hpbImage += (dwGot = smfGetVDword(pTrk->hpbImage, pTrk->cbLeft, (DWORD BSTACK *)&tkEventDelta));
    pTrk->cbLeft   -= dwGot;

    /* We MUST have at least three bytes here (cause we haven't hit
    ** the end-of-track meta yet, which is three bytes long). Checking
    ** against three means we don't have to check how much is left
    ** in the track again for any short event, which is most cases.
    */
    if (pTrk->cbLeft < 3)
    {
        return SMF_INVALID_FILE;
    }

    pTrk->tkPosition += tkEventDelta;
    pEvent->tkDelta = pTrk->tkPosition - pSmf->tkPosition;
    pSmf->tkPosition = pTrk->tkPosition;

    bEvent = *pTrk->hpbImage++;

    if (MIDI_MSG > bEvent)
    {
        if (0 == pTrk->bRunningStatus)
        {
            return SMF_INVALID_FILE;
        }

        dwGotTotal = 1;
        pEvent->abEvent[0] = pTrk->bRunningStatus;
        pEvent->abEvent[1] = bEvent;
        if (3 == grbChanMsgLen[(pTrk->bRunningStatus >> 4) & 0x0F])
        {
            pEvent->abEvent[2] = *pTrk->hpbImage++;
            dwGotTotal++;
        }
    }
    else if (MIDI_SYSEX > bEvent)
    {
        pTrk->bRunningStatus = bEvent;

        dwGotTotal = 2;
        pEvent->abEvent[0] = bEvent;
        pEvent->abEvent[1] = *pTrk->hpbImage++;
        if (3 == grbChanMsgLen[(bEvent >> 4) & 0x0F])
        {
            pEvent->abEvent[2] = *pTrk->hpbImage++;
            dwGotTotal++;
        }
    }
    else
    {
        pTrk->bRunningStatus = 0;
        if (MIDI_META == bEvent)
        {
            pEvent->abEvent[0] = MIDI_META;
            if (MIDI_META_EOT == (pEvent->abEvent[1] = *pTrk->hpbImage++))
            {
                pTrk->fdwTrack |= SMF_TF_EOT;
            }

            dwGotTotal = 2;
        }
        else if (MIDI_SYSEX == bEvent || MIDI_SYSEXEND == bEvent)
        {
            pEvent->abEvent[0] = bEvent;
            dwGotTotal = 1;
        }
        else
        {
            return SMF_INVALID_FILE;
        }

        if (0 == (dwGot = smfGetVDword(pTrk->hpbImage, pTrk->cbLeft - 2, (DWORD BSTACK *)&cbEvent)))
        {
            return SMF_INVALID_FILE;
        }

        pTrk->hpbImage  += dwGot;
        dwGotTotal      += dwGot;

        if (dwGotTotal + cbEvent > pTrk->cbLeft)
        {
            return SMF_INVALID_FILE;
        }

        pEvent->cbParm  = cbEvent;
        pEvent->hpbParm = pTrk->hpbImage;

        pTrk->hpbImage += cbEvent;
        dwGotTotal     += cbEvent;
    }

    assert(pTrk->cbLeft >= dwGotTotal);

    pTrk->cbLeft -= dwGotTotal;

    return SMF_SUCCESS;
}

DWORD FNLOCAL smfGetVDword | ( | HPBYTE | hpbImage,
 |  | DWORD | dwLeft,
 |  | DWORD BSTACK * | pDw
 | ) |  |

Definition at line 550 of file SMFREAD.c.

{
    BYTE                    b;
    DWORD                   dwUsed  = 0;

    assert(hpbImage != NULL);
    assert(pDw != NULL);

    *pDw = 0;

    do
    {
        if (!dwLeft)
        {
            return 0;
        }

        b = *hpbImage++;
        dwLeft--;
        dwUsed++;

        *pDw = (*pDw << 7) | (b & 0x7F);
    } while (b&0x80);

    return dwUsed;
}

Variable Documentation

PRIVATE UINT grbChanMsgLen[]
Initial value:
{
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    3,
    3,
    3,
    3,
    2,
    2,
    3,
    0,
}

Definition at line 26 of file SMFREAD.c.

Generated on Wed Nov 13 2024 16:53:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Audio/MidiPlyr/TIMEWND.c File Reference

  • Multimedia
  • Audio
  • MidiPlyr
Defines | Functions | Variables

TIMEWND.c File Reference

#include <windows.h>
#include <shellapi.h>
#include <windowsx.h>
#include <mmsystem.h>
#include <commdlg.h>
#include <commctrl.h>
#include <ctype.h>
#include "debug.h"
#include "MIDIPlyr.H"

Go to the source code of this file.

Defines

#define | _INC_SHELLAPI
#define | HOUR_INDEX 0
#define | MAX_CBFMT (max(sizeof(gszFormatHMS), sizeof(gszFormatTicks)))
#define | MIN_INDEX 3
#define | MIN_SEP_INDEX 2
#define | SEC_INDEX 6
#define | SEC_SEP_INDEX 5
#define | TIMER_ID 0
#define | TIMER_INTERVAL 100

Functions

PRIVATE VOID NEAR PASCAL | PaintTime (HDC hDC)
PRIVATE VOID NEAR PASCAL | TWnd_OnCommand (HWND hWnd, int id, HWND hWndCtl, UINT codeNotify)
PRIVATE BOOL NEAR PASCAL | TWnd_OnCreate (HWND hWnd, CREATESTRUCT FAR *lpCreateStruct)
PRIVATE VOID NEAR PASCAL | TWnd_OnDestroy (HWND hWnd)
PRIVATE VOID NEAR PASCAL | TWnd_OnPaint (HWND hWnd)
PRIVATE VOID NEAR PASCAL | TWnd_OnSize (HWND hWnd, UINT state, int cx, int cy)
PRIVATE VOID NEAR PASCAL | TWnd_OnTimer (HWND hWnd, UINT id)
LRESULT CALLBACK | TWnd_WndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)

Variables

PRIVATE int | ganPosX [MAX_CBFMT]
PRIVATE BOOL | gbRepaint = TRUE
PRIVATE HFONT | ghFont = NULL
PRIVATE int | gnPosY
PRIVATE int | gnTimerOn = 0
PRIVATE char BCODE | gszFormatHMS [] = "44:44:44"
PRIVATE char BCODE | gszFormatTicks [] = "444444444"

Define Documentation

#define _INC_SHELLAPI

Definition at line 20 of file TIMEWND.c.

#define HOUR_INDEX 0

Definition at line 37 of file TIMEWND.c.

#define MAX_CBFMT (max(sizeof(gszFormatHMS), sizeof(gszFormatTicks)))

Definition at line 51 of file TIMEWND.c.

#define MIN_INDEX 3

Definition at line 38 of file TIMEWND.c.

#define MIN_SEP_INDEX 2

Definition at line 41 of file TIMEWND.c.

#define SEC_INDEX 6

Definition at line 39 of file TIMEWND.c.

#define SEC_SEP_INDEX 5

Definition at line 42 of file TIMEWND.c.

#define TIMER_ID 0

Definition at line 44 of file TIMEWND.c.

#define TIMER_INTERVAL 100

Definition at line 45 of file TIMEWND.c.

Function Documentation

PRIVATE VOID NEAR PASCAL PaintTime ( HDC hDC )

Definition at line 86 of file TIMEWND.c.

{
    TICKS                   tkTime;
    DWORD                   msTime;
    int                     ii;
    int                     cb;
    char                    szWork[MAX_CBFMT];
    HFONT                   hFont;
    UINT                    h;
    UINT                    m;
    UINT                    s;
    BOOL                    fRepaintedSec;
    BOOL                    fRepaintedMin;

    if (MMSYSERR_NOERROR != seqTime(gpSeq, &tkTime))
        return;

    SetBkColor(hDC, RGB(0xFF, 0xFF, 0xFF));
    hFont = SelectObject(hDC, ghFont);

    if (gnTimeFormat == IDS_TICKS)
    {
        wsprintf(szWork, "%9lu", (DWORD)tkTime);

        for (ii = 0; ii < 9; ii++)
        {
            if (gbRepaint || szOldTicks[ii] != szWork[ii])
                EmbossedTextOut(
                                hDC,
                                ganPosX[ii],
                                gnPosY,
                                szWork+ii,
                                1,
                                (COLORREF)-1,
                                (COLORREF)-1,
                                3,
                                3);
            szOldTicks[ii] = szWork[ii];
        }
    }
    else
    {
        msTime = seqTicksToMillisecs(gpSeq, tkTime) / 1000L;

        h = (UINT)(msTime / 3600L);    msTime %= 3600L;
        m = (UINT)(msTime / 60L);      msTime %= 60L;
        s = (UINT)msTime;

        cb = lstrlen(gszFormatHMS);

        if (gbRepaint || h != oldh)
        {
            szWork[0] = '0' + (char)(h / 10);
            szWork[1] = '0' + (char)(h % 10);
            EmbossedTextOut(
                            hDC,
                            ganPosX[HOUR_INDEX],
                            gnPosY,
                            szWork,
                            2,
                            (COLORREF)-1,
                            (COLORREF)-1,
                            3,
                            3);
            oldh = h;
        }

        fRepaintedMin = FALSE;
        if (gbRepaint || m != oldm)
        {
            szWork[0] = gszFormatHMS[MIN_SEP_INDEX];
            szWork[1] = '0' + (char)(m / 10);
            szWork[2] = '0' + (char)(m % 10);
            EmbossedTextOut(
                            hDC,
                            ganPosX[MIN_SEP_INDEX],
                            gnPosY,
                            szWork,
                            3,
                            (COLORREF)-1,
                            (COLORREF)-1,
                            3,
                            3);
            oldm = m;
            fRepaintedMin = TRUE;
        }

        fRepaintedSec = FALSE;
        if (gbRepaint || s != olds)
        {
            szWork[0] = gszFormatHMS[SEC_SEP_INDEX];
            szWork[1] = '0' + (char)(s / 10);
            szWork[2] = '0' + (char)(s % 10);
            EmbossedTextOut(
                            hDC,
                            ganPosX[SEC_SEP_INDEX],
                            gnPosY,
                            szWork,
                            3,
                            (COLORREF)-1,
                            (COLORREF)-1,
                            3,
                            3);
            olds = s;
            fRepaintedSec = TRUE;
        }

        /* If we're doing a full repaint, then update the separators
         */
        if (gbRepaint)
            for (ii=0; ii < cb; ii++)
                if (!isdigit(gszFormatHMS[ii]))
                {
                    if (SEC_SEP_INDEX == ii && fRepaintedSec)
                        continue;

                    if (MIN_SEP_INDEX == ii && fRepaintedMin)
                        continue;

                    EmbossedTextOut(
                                    hDC,
                                    ganPosX[ii],
                                    gnPosY,
                                    gszFormatHMS+ii,
                                    1,
                                    (COLORREF)-1,
                                    (COLORREF)-1,
                                    3,
                                    3);
                }
    }

    gbRepaint = FALSE;
    SelectObject(hDC, hFont);
}

VOID NEAR PASCAL TWnd_OnCommand | ( | HWND | hWnd,
 |  | int | id,
 |  | HWND | hWndCtl,
 |  | UINT | codeNotify
 | ) |  |

Definition at line 352 of file TIMEWND.c.

{
    switch(id)
    {
        case IDM_PLAY:
            if (0 == gnTimerOn)
            {
                gnTimerOn++;
                SetTimer(hWnd, TIMER_ID, TIMER_INTERVAL, 0);
            }

            UpdateWindow(hWnd);
            break;

        case IDM_STOP:
            if (0 == gnTimerOn)
            {
                gnTimerOn--;
                KillTimer(hWnd, TIMER_ID);
            }

            UpdateWindow(hWnd);
            break;
    }
}

BOOL NEAR PASCAL TWnd_OnCreate | ( | HWND | hWnd,
 |  | CREATESTRUCT FAR * | lpCreateStruct
 | ) |  |

Definition at line 239 of file TIMEWND.c.

{
    return TRUE;
}

VOID NEAR PASCAL TWnd_OnDestroy ( HWND hWnd )

Definition at line 393 of file TIMEWND.c.

{
    if (gnTimerOn)
    {
        KillTimer(hWnd, TIMER_ID);
    }
}

VOID NEAR PASCAL TWnd_OnPaint ( HWND hWnd )

Definition at line 300 of file TIMEWND.c.

                                          { PAINTSTRUCT ps; HDC hDC;
HBRUSH hBrOld; int nWidth; int nHeight;

    RECT                    rc;

    GetClientRect(hWnd, &rc);
    nWidth  = rc.right;
    nHeight = rc.bottom;

    hDC = BeginPaint(hWnd, &ps);

    hBrOld = (HBRUSH)SelectObject(hDC, GetStockObject(GRAY_BRUSH));
    PatBlt(hDC, 0, 0, 1, nHeight-1, PATCOPY);
    PatBlt(hDC, 1, 0, nWidth-2, 1, PATCOPY);

    SelectObject(hDC, GetStockObject(BLACK_BRUSH));
    PatBlt(hDC, 1, 1, 1, nHeight-3, PATCOPY);
    PatBlt(hDC, 2, 1, nWidth-4, 1, PATCOPY);

    SelectObject(hDC, GetStockObject(WHITE_BRUSH));
    PatBlt(hDC, rc.right-1, 0, 1, nHeight-1, PATCOPY);
    PatBlt(hDC, 0, rc.bottom-1, nWidth, 1, PATCOPY);

    SelectObject(hDC, GetStockObject(LTGRAY_BRUSH));
    PatBlt(hDC, rc.right-2, 1, 1, nHeight-2, PATCOPY);
    PatBlt(hDC, 1, rc.bottom-2, nWidth-2, 1, PATCOPY);

    SelectObject(hDC, hBrOld);

    gbRepaint = TRUE;
    PaintTime(hDC);

    EndPaint(hWnd, &ps);
}

VOID NEAR PASCAL TWnd_OnSize | ( | HWND | hWnd,
 |  | UINT | state,
 |  | int | cx,
 |  | int | cy
 | ) |  |

Definition at line 262 of file TIMEWND.c.

{
    HDC                     hDC;

    GetClientRect(hWnd, &grcTWnd);

    if (ghFont != (HFONT)NULL)
        DeleteObject(ghFont);

    hDC = GetDC(hWnd);
    ghFont = CreateScaledFont(hDC,
                              &grcTWnd,
                              (gnTimeFormat == IDS_TICKS) ? gszFormatTicks : gszFormatHMS,
                              ganPosX,
                              &gnPosY);
    ReleaseDC(hWnd, hDC);

    gbRepaint = TRUE;
    InvalidateRect(hWnd, NULL, TRUE);
}

PRIVATE VOID NEAR PASCAL TWnd_OnTimer | ( | HWND | hWnd,
 |  | UINT | id
 | ) |  |

Definition at line 414 of file TIMEWND.c.

{
    HDC                     hDC;

    hDC = GetDC(hWnd);
    PaintTime(hDC);
    ReleaseDC(hWnd, hDC);
}

LRESULT CALLBACK TWnd_WndProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 445 of file TIMEWND.c.

{
    switch( msg )
    {
        HANDLE_MSG(hWnd, WM_CREATE,         TWnd_OnCreate);
        HANDLE_MSG(hWnd, WM_SIZE,           TWnd_OnSize);
        HANDLE_MSG(hWnd, WM_PAINT,          TWnd_OnPaint);
        HANDLE_MSG(hWnd, WM_COMMAND,        TWnd_OnCommand);
        HANDLE_MSG(hWnd, WM_DESTROY,        TWnd_OnDestroy);
        HANDLE_MSG(hWnd, WM_TIMER,          TWnd_OnTimer);

        default:
            return DefWindowProc(hWnd, msg, wParam, lParam);
    }

    return 0;
}

Variable Documentation

PRIVATE int ganPosX[MAX_CBFMT]

Definition at line 55 of file TIMEWND.c.

PRIVATE BOOL gbRepaint = TRUE

Definition at line 53 of file TIMEWND.c.

PRIVATE HFONT ghFont = NULL

Definition at line 47 of file TIMEWND.c.

PRIVATE int gnPosY

Definition at line 54 of file TIMEWND.c.

PRIVATE int gnTimerOn = 0

Definition at line 57 of file TIMEWND.c.

PRIVATE char BCODE gszFormatHMS[] = "44:44:44"

Definition at line 48 of file TIMEWND.c.

PRIVATE char BCODE gszFormatTicks[] = "444444444"

Definition at line 49 of file TIMEWND.c.

Generated on Wed Nov 13 2024 16:53:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Audio/MidiPlyr/UIUTILS.c File Reference

  • Multimedia
  • Audio
  • MidiPlyr
Defines | Functions

UIUTILS.c File Reference

#include <windows.h>
#include <shellapi.h>
#include <windowsx.h>
#include <mmsystem.h>
#include <commdlg.h>
#include <commctrl.h>
#include <ctype.h>
#include "debug.h"
#include "MIDIPlyr.H"

Go to the source code of this file.

Defines

#define | _INC_SHELLAPI

Functions

HFONT NEAR PASCAL | CreateScaledFont (HDC hDC, LPRECT lpRect, LPSTR lpszFormat, int anPosX[], int *nPosY)
VOID NEAR PASCAL | EmbossedTextOut (HDC hDC, int x, int y, LPSTR lpsz, UINT cb, COLORREF crText, COLORREF crShadow, int cx, int cy)
VOID FNLOCAL | Error (HWND hWnd, int nErrDesc, MMRESULT mmrc)
VOID NEAR PASCAL | MessagePump (VOID)

Define Documentation

#define _INC_SHELLAPI

Definition at line 20 of file UIUTILS.c.

Function Documentation

HFONT NEAR PASCAL CreateScaledFont | ( | HDC | hDC,
 |  | LPRECT | lpRect,
 |  | LPSTR | lpszFormat,
 |  | int | anPosX[],
 |  | int * | nPosY
 | ) |  |

Definition at line 193 of file UIUTILS.c.

{
    LOGFONT                 lf;
    HFONT                   hFont;
    HFONT                   h;
    LONG                    FormatWidth;
    LONG                    ScaledClientWidth;
    LONG                    ScaledClientHeight;
    LONG                    AspectN;
    LONG                    AspectD;
    int                     nPosX;
    UINT                    cb;
    UINT                    ii;
    UINT                    jj;
    SIZE                    size;

    ScaledClientHeight =  ((lpRect->bottom - lpRect->top)) * 3 / 4;
    ScaledClientWidth  =  ((lpRect->right  - lpRect->left)) * 3 / 4;

    _fmemset(&lf, 0, sizeof(lf));
    lf.lfHeight         = -(int)ScaledClientHeight;
    lf.lfWeight         = FW_BOLD;
    lf.lfCharSet        = ANSI_CHARSET;
    lf.lfClipPrecision  = CLIP_DEFAULT_PRECIS;
    lf.lfQuality        = PROOF_QUALITY;
    lf.lfPitchAndFamily = FF_ROMAN|DEFAULT_PITCH;
    lstrcpyn(lf.lfFaceName, gszFace, sizeof(lf.lfFaceName) / sizeof(lf.lfFaceName[0]));

    hFont = CreateFontIndirect(&lf);
    h = SelectObject(hDC, hFont);

    cb = lstrlen(lpszFormat);
    GetTextExtentPoint(hDC, lpszFormat, cb, &size);

    AspectN = (LONG)size.cx;
    AspectD = (LONG)size.cy;

    FormatWidth = (ScaledClientHeight*AspectN)/AspectD;

    if (FormatWidth > ScaledClientWidth)
    {
        ScaledClientHeight =
            (ScaledClientWidth*AspectD)/AspectN;
      SelectObject(hDC, h);
        DeleteObject(hFont);

        lf.lfHeight = -(int)ScaledClientHeight;

        hFont = CreateFontIndirect(&lf);

        SelectObject(hDC, hFont);
        GetTextExtentPoint(hDC, lpszFormat, cb, &size);
    }

    *nPosY  = grcTWnd.top  + (grcTWnd.bottom- grcTWnd.top  - size.cy)/2;
    nPosX   = grcTWnd.left + (grcTWnd.right - grcTWnd.left - size.cx)/2;

    ii = 0;
    for (jj=0; jj < cb; jj++)
    {
        if (jj != 0)
            GetTextExtentPoint(hDC, lpszFormat, jj, &size);
        else
            size.cx = 0;

        anPosX[ii++] = nPosX + size.cx;
    }

    SelectObject(hDC, h);

    return hFont;
}

VOID NEAR PASCAL EmbossedTextOut | ( | HDC | hDC,
 |  | int | x,
 |  | int | y,
 |  | LPSTR | lpsz,
 |  | UINT | cb,
 |  | COLORREF | crText,
 |  | COLORREF | crShadow,
 |  | int | cx,
 |  | int | cy
 | ) |  |

Definition at line 122 of file UIUTILS.c.

{
    COLORREF                crOld;
    UINT                    uMode;
    SIZE                    sizeText;
    RECT                    rcText;

    /* If text length is -1, use lstrlen to get the length
    ** of the text.
    */
    if (cb == -1)
        cb = lstrlen(lpsz);

    /* If the shadow or text color is -1, use the
    ** system color for that one.
    */
    if (crShadow == (COLORREF)-1)
        crShadow = GetSysColor (COLOR_BTNSHADOW);
    if (crText == (COLORREF)-1)
        crText = GetSysColor (COLOR_BTNTEXT);

    /* setup the DC, saving off the old values
    */
    uMode = SetBkMode(hDC, OPAQUE);
    crOld = SetTextColor(hDC, crShadow);

    /* Draw the text at the desired offset using the
    ** shadow color, then again at the normal position
    ** using the text color.  This will the text an 'Embossed'
    ** or 'drop shadowed' look depending on what shadow color
    ** and offset are used.
    */
    GetTextExtentPoint32(hDC, lpsz, cb, &sizeText);
    rcText.left   = x;    rcText.right  = x+cx+sizeText.cx;
    rcText.top    = y;    rcText.bottom = y+cy+sizeText.cy;
    ExtTextOut(hDC, x+cx, y+cy, ETO_OPAQUE, &rcText, lpsz, cb, NULL);
    SetBkMode(hDC, TRANSPARENT);
    SetTextColor(hDC, crText);
    ExtTextOut(hDC, x, y, 0, NULL, lpsz, cb, NULL);

    /* restore the DC
    */
    SetTextColor(hDC, crOld);
    SetBkMode(hDC, uMode);
}

VOID FNLOCAL Error | ( | HWND | hWnd,
 |  | int | nErrDesc,
 |  | MMRESULT | mmrc
 | ) |  |

Definition at line 59 of file UIUTILS.c.

{
    LoadString(ghInst, nErrDesc, gszErrDescTxt, sizeof(gszErrDescTxt));
    mciGetErrorString(mmrc, gszErrCodeTxt, sizeof(gszErrCodeTxt));

    wsprintf(gszErrStr, gszErrFmt, (LPSTR)gszErrDescTxt, (LPSTR)gszErrCodeTxt);
    MessageBox(hWnd, gszErrStr, gszAppLongName, MB_ICONEXCLAMATION|MB_OK);
}

VOID NEAR PASCAL MessagePump ( VOID )

Definition at line 87 of file UIUTILS.c.

{
    MSG                     msg;

    while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
    {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }
}

Generated on Wed Nov 13 2024 16:53:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Audio/multichan/childview.cpp File Reference

  • Multimedia
  • Audio
  • multichan
Functions | Variables

childview.cpp File Reference

#include "stdafx.h"
#include "multichan.h"
#include "dlgdest.h"
#include "ChildView.h"

Go to the source code of this file.

Functions

BOOL | dlgproc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)

Variables

HWAVEOUT | g_hwo = 0
CList< CDlgSrc *, CDlgSrc * > g_listSources
CChildView * | g_pChildView = 0
CDlgDest * | g_pdlgDest = 0

Function Documentation

BOOL dlgproc | ( | HWND | hwndDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 85 of file childview.cpp.

{
    return 0;
}

Variable Documentation

HWAVEOUT g_hwo = 0

Definition at line 22 of file childview.cpp.

CList<CDlgSrc*,CDlgSrc*> g_listSources

Definition at line 21 of file childview.cpp.

CChildView* g_pChildView = 0

Definition at line 19 of file childview.cpp.

CDlgDest* g_pdlgDest = 0

Definition at line 20 of file childview.cpp.

Generated on Wed Nov 13 2024 16:53:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Audio/multichan/childview.h File Reference

  • Multimedia
  • Audio
  • multichan
Classes | Defines | Variables

childview.h File Reference

#include "dlgdest.h"
#include "dlgsrc.h"
#include "wave.h"

Go to the source code of this file.

Classes

class | CChildView

Defines

#define | SPEAKER_NOT_SPECIFIED 0x40000
#define | SPEAKERS_USED 0x12
#define | WM_START_PLAYBACK (WM_APP + 1)
#define | WM_STOP_PLAYBACK (WM_APP + 2)

Variables

CChildView * g_pChildView

Define Documentation

#define SPEAKER_NOT_SPECIFIED 0x40000

Definition at line 75 of file childview.h.

#define SPEAKERS_USED 0x12

Definition at line 76 of file childview.h.

#define WM_START_PLAYBACK (WM_APP + 1)

Definition at line 82 of file childview.h.

#define WM_STOP_PLAYBACK (WM_APP + 2)

Definition at line 83 of file childview.h.

Variable Documentation

CChildView* g_pChildView

Definition at line 19 of file childview.cpp.

Generated on Wed Nov 13 2024 16:53:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Audio/multichan/dlgdest.cpp File Reference

  • Multimedia
  • Audio
  • multichan
Variables

dlgdest.cpp File Reference

#include "stdafx.h"
#include "multichan.h"
#include "DlgDest.h"
#include "dlgsrc.h"
#include "childview.h"
#include <initguid.h>
#include <mmreg.h>
#include <msacm.h>

Go to the source code of this file.

Variables

CONST_GUID_REP cgrFormats []
UINT | rgnBitDepth [] = { 8, 16, 24, 32 }
UINT | rgnSampleRate [] = { 8000, 11025, 16000, 22050, 32000, 44100, 48000, 96000 }

Variable Documentation

CONST_GUID_REP cgrFormats[]
Initial value:
{
    &GUID_NULL,                 "GUID_NULL",
    &KSDATAFORMAT_SUBTYPE_PCM,  "KSDATAFORMAT_SUBTYPE_PCM"
}

Definition at line 137 of file dlgdest.cpp.

UINT rgnBitDepth[] = { 8, 16, 24, 32 }

Definition at line 144 of file dlgdest.cpp.

UINT rgnSampleRate[] = { 8000, 11025, 16000, 22050, 32000, 44100, 48000, 96000 }

Definition at line 143 of file dlgdest.cpp.

Generated on Wed Nov 13 2024 16:53:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Audio/multichan/dlgdest.h File Reference

  • Multimedia
  • Audio
  • multichan
Classes | Variables

dlgdest.h File Reference

Go to the source code of this file.

Classes

class | CDlgDest

Variables

HWAVEOUT | g_hwo
CDlgDest * g_pdlgDest

Variable Documentation

HWAVEOUT g_hwo

Definition at line 22 of file childview.cpp.

CDlgDest* g_pdlgDest

Definition at line 20 of file childview.cpp.

Generated on Wed Nov 13 2024 16:53:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Audio/multichan/dlgsrc.cpp File Reference

  • Multimedia
  • Audio
  • multichan
Variables

dlgsrc.cpp File Reference

#include <guiddef.h>
#include "stdafx.h"
#include "multichan.h"
#include "childview.h"
#include "DlgSrc.h"
#include <ks.h>
#include <ksmedia.h>

Go to the source code of this file.

Variables

CONST_DWORD_REP cdrSpeakers []

Variable Documentation

CONST_DWORD_REP cdrSpeakers[]
Initial value:
{
    {SPEAKER_FRONT_LEFT,                "SPEAKER_FRONT_LEFT" } ,
    {SPEAKER_FRONT_RIGHT,               "SPEAKER_FRONT_RIGHT" } ,
    {SPEAKER_FRONT_CENTER,              "SPEAKER_FRONT_CENTER" } ,
    {SPEAKER_LOW_FREQUENCY,             "SPEAKER_LOW_FREQUENCY" } ,
    {SPEAKER_BACK_LEFT,                 "SPEAKER_BACK_LEFT" } ,
    {SPEAKER_BACK_RIGHT,                "SPEAKER_BACK_RIGHT" } ,
    {SPEAKER_FRONT_LEFT_OF_CENTER,      "SPEAKER_FRONT_LEFT_OF_CENTER" } ,
    {SPEAKER_FRONT_RIGHT_OF_CENTER,     "SPEAKER_FRONT_RIGHT_OF_CENTER" } ,
    {SPEAKER_BACK_CENTER,               "SPEAKER_BACK_CENTER" } ,
    {SPEAKER_SIDE_LEFT,                 "SPEAKER_SIDE_LEFT" } ,
    {SPEAKER_SIDE_RIGHT,                "SPEAKER_SIDE_RIGHT" } ,
    {SPEAKER_TOP_CENTER,                "SPEAKER_TOP_CENTER" } ,
    {SPEAKER_TOP_FRONT_LEFT,            "SPEAKER_TOP_FRONT_LEFT" } ,
    {SPEAKER_TOP_FRONT_CENTER,          "SPEAKER_TOP_FRONT_CENTER" } ,
    {SPEAKER_TOP_FRONT_RIGHT,           "SPEAKER_TOP_FRONT_RIGHT" } ,
    {SPEAKER_TOP_BACK_LEFT,             "SPEAKER_TOP_BACK_LEFT" } ,
    {SPEAKER_TOP_BACK_CENTER,           "SPEAKER_TOP_BACK_CENTER" } ,
    {SPEAKER_TOP_BACK_RIGHT,            "SPEAKER_TOP_BACK_RIGHT" } ,
    {SPEAKER_NOT_SPECIFIED,             "No specified speaker" }
}

Definition at line 32 of file dlgsrc.cpp.

Generated on Wed Nov 13 2024 16:53:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Audio/multichan/dlgsrc.h File Reference

  • Multimedia
  • Audio
  • multichan
Classes | Variables

dlgsrc.h File Reference

Go to the source code of this file.

Classes

class CDlgSrc

Variables

CList< CDlgSrc *, CDlgSrc * > g_listSources

Variable Documentation

CList<CDlgSrc*,CDlgSrc*> g_listSources

Definition at line 21 of file childview.cpp.

Generated on Wed Nov 13 2024 16:53:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Audio/multichan/mainfrm.cpp File Reference

  • Multimedia
  • Audio
  • multichan

mainfrm.cpp File Reference

#include "stdafx.h"
#include "multichan.h"
#include "MainFrm.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Audio/multichan/mainfrm.h File Reference

  • Multimedia
  • Audio
  • multichan
Classes

mainfrm.h File Reference

#include "ChildView.h"

Go to the source code of this file.

Classes

class CMainFrame
Generated on Wed Nov 13 2024 16:53:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Audio/multichan/multichan.cpp File Reference

  • Multimedia
  • Audio
  • multichan
Variables

multichan.cpp File Reference

#include "stdafx.h"
#include "multichan.h"
#include "MainFrm.h"
#include "resource.h"

Go to the source code of this file.

Variables

CMultichanApp theApp

Variable Documentation

CMultichanApp theApp

Definition at line 63 of file multichan.cpp.

Generated on Wed Nov 13 2024 16:53:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Audio/multichan/multichan.h File Reference

  • Multimedia
  • Audio
  • multichan
Classes

multichan.h File Reference

#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Classes

class CMultichanApp
Generated on Wed Nov 13 2024 16:53:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Audio/multichan/resource.h File Reference

  • Multimedia
  • Audio
  • multichan
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_AVEBITS 1026
#define | IDC_BITDEPTH 1005
#define | IDC_CHANNELNUM 1015
#define | IDC_CHANNELS 1004
#define | IDC_COMBO_BITDEPTH 1014
#define | IDC_COMBO_CHANNEL 1000
#define | IDC_COMBO_GUIDFORMAT 1013
#define | IDC_COMBO_SAMPLERATE 1015
#define | IDC_COMBO_SPEAKER 1001
#define | IDC_COMBO_WAVEFORMAT 1012
#define | IDC_EDIT_AVEBITS 1006
#define | IDC_EDIT_VALIDBITS 1007
#define | IDC_INPUT 1025
#define | IDC_OUTPUT 1024
#define | IDC_PLAY 1011
#define | IDC_REMIX 1010
#define | IDC_SAMPLERATE 1008
#define | IDC_SPEAKERFLAGS 1009
#define | IDC_STOP 1016
#define | IDC_USE 1003
#define | IDC_VALIDBITS 1007
#define | IDD_ABOUTBOX 100
#define | IDD_DST 203
#define | IDD_SRC 202
#define | IDI_CHECK 129
#define | IDM_MIXER_MERGE 200
#define | IDM_MIXER_OPTIONS 201
#define | IDM_MIXER_PLAY 32773
#define | IDM_MIXER_STOP 32774
#define | IDR_MAINFRAME 128
#define | IDR_MULTICTYPE 130
#define | IDR_WAVEHEAD 206

Define Documentation

#define IDC_AVEBITS 1026

Definition at line 38 of file resource.h.

#define IDC_BITDEPTH 1005

Definition at line 22 of file resource.h.

#define IDC_CHANNELNUM 1015

Definition at line 35 of file resource.h.

#define IDC_CHANNELS 1004

Definition at line 21 of file resource.h.

#define IDC_COMBO_BITDEPTH 1014

Definition at line 33 of file resource.h.

#define IDC_COMBO_CHANNEL 1000

Definition at line 18 of file resource.h.

#define IDC_COMBO_GUIDFORMAT 1013

Definition at line 32 of file resource.h.

#define IDC_COMBO_SAMPLERATE 1015

Definition at line 34 of file resource.h.

#define IDC_COMBO_SPEAKER 1001

Definition at line 19 of file resource.h.

#define IDC_COMBO_WAVEFORMAT 1012

Definition at line 31 of file resource.h.

#define IDC_EDIT_AVEBITS 1006

Definition at line 23 of file resource.h.

#define IDC_EDIT_VALIDBITS 1007

Definition at line 25 of file resource.h.

#define IDC_INPUT 1025

Definition at line 37 of file resource.h.

#define IDC_OUTPUT 1024

Definition at line 36 of file resource.h.

#define IDC_PLAY 1011

Definition at line 29 of file resource.h.

#define IDC_REMIX 1010

Definition at line 28 of file resource.h.

#define IDC_SAMPLERATE 1008

Definition at line 26 of file resource.h.

#define IDC_SPEAKERFLAGS 1009

Definition at line 27 of file resource.h.

#define IDC_STOP 1016

Definition at line 30 of file resource.h.

#define IDC_USE 1003

Definition at line 20 of file resource.h.

#define IDC_VALIDBITS 1007

Definition at line 24 of file resource.h.

#define IDD_ABOUTBOX 100

Definition at line 9 of file resource.h.

#define IDD_DST 203

Definition at line 16 of file resource.h.

#define IDD_SRC 202

Definition at line 15 of file resource.h.

#define IDI_CHECK 129

Definition at line 11 of file resource.h.

#define IDM_MIXER_MERGE 200

Definition at line 13 of file resource.h.

#define IDM_MIXER_OPTIONS 201

Definition at line 14 of file resource.h.

#define IDM_MIXER_PLAY 32773

Definition at line 39 of file resource.h.

#define IDM_MIXER_STOP 32774

Definition at line 40 of file resource.h.

#define IDR_MAINFRAME 128

Definition at line 10 of file resource.h.

#define IDR_MULTICTYPE 130

Definition at line 12 of file resource.h.

#define IDR_WAVEHEAD 206

Definition at line 17 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Audio/multichan/stdafx.cpp File Reference

  • Multimedia
  • Audio
  • multichan

stdafx.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Audio/multichan/stdafx.h File Reference

  • Multimedia
  • Audio
  • multichan
Classes | Defines | Typedefs | Variables

stdafx.h File Reference

#include <afxwin.h>
#include <afxext.h>
#include <afxcmn.h>
#include <afxtempl.h>
#include <mmsystem.h>
#include <ks.h>
#include <ksmedia.h>

Go to the source code of this file.

Classes

struct | CONST_DWORD_REP
struct | CONST_GUID_REP
struct | CONST_WORD_REP

Defines

#define | ARRAY_ELEMENTS(a) (sizeof((a)) / sizeof((a)[0]))
#define | IsValidHandle(h) ((h) != NULL && (h) != INVALID_HANDLE_VALUE)
#define | SafeCloseHandle(h) if(IsValidHandle((h))) CloseHandle((h)); (h) = NULL
#define | SafeLocalFree(p) if((p)) LocalFree((p)); (p) = NULL
#define | VC_EXTRALEAN

Typedefs

typedef struct CONST_DWORD_REP * | PCONST_DWORD_REP
typedef struct CONST_GUID_REP * | PCONST_GUID_REP
typedef struct CONST_WORD_REP * | PCONST_WORD_REP

Variables

CONST_DWORD_REP cdrSpeakers []

Define Documentation

#define ARRAY_ELEMENTS ( a ) (sizeof((a)) / sizeof((a)[0]))

Definition at line 39 of file stdafx.h.

#define IsValidHandle ( h ) ((h) != NULL && (h) != INVALID_HANDLE_VALUE)

Definition at line 33 of file stdafx.h.

#define SafeCloseHandle ( h ) if(IsValidHandle((h))) CloseHandle((h)); (h) = NULL

Definition at line 35 of file stdafx.h.

#define SafeLocalFree ( p ) if((p)) LocalFree((p)); (p) = NULL

Definition at line 37 of file stdafx.h.

#define VC_EXTRALEAN

Definition at line 17 of file stdafx.h.

Typedef Documentation

typedef struct CONST_DWORD_REP * PCONST_DWORD_REP
typedef struct CONST_GUID_REP * PCONST_GUID_REP
typedef struct CONST_WORD_REP * PCONST_WORD_REP

Variable Documentation

CONST_DWORD_REP cdrSpeakers[]

Definition at line 32 of file dlgsrc.cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Audio/multichan/wave.cpp File Reference

  • Multimedia
  • Audio
  • multichan
Functions

wave.cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include "wave.h"
#include <mmreg.h>
#include "ChildView.h"
#include <msacm.h>

Go to the source code of this file.

Functions

BOOL | TrapMMError (MMRESULT mmRes, LPCSTR szAPI)
HANDLE | WaveOpenFile (IN LPCSTR szFileName, OUT WAVEFORMATEX **ppWaveFormatEx, OUT PULONG pcbData)
void CALLBACK | WavePlayFileCB (HWAVEOUT hwo, UINT uMsg, DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
BOOL | WaveSaveFile (IN LPCSTR szFileName, OUT WAVEFORMATEX *pWaveFormatEx, IN PVOID pvData, IN ULONG cbData)
void | WaveTogglePlayback (CDlgSrc *pdlgSelf, const BOOL fSwitch)

Function Documentation

BOOL TrapMMError | ( | MMRESULT | mmRes,
 |  | LPCSTR | szAPI
 | ) |  |

Definition at line 380 of file wave.cpp.

{
  //  no error
    if(MMSYSERR_NOERROR == mmRes)
    {
        return( TRUE );
    }

    HWND    hwndMain        = AfxGetMainWnd()->m_hWnd;
    char    szError[128]  = "";
    char    szErrMsg[128] = "";

  //  basic mmsys error
  if( MMSYSERR_LASTERROR >= mmRes )
  {
    if( MMSYSERR_NOMEM == waveOutGetErrorText( mmRes, szError, 128 ) )
    {
      _snprintf( szErrMsg, 128, "Insufficient memory to complete the task.");
    }
        else
        {
        _snprintf( szErrMsg, 128, "ERROR : %s returned : %s", szAPI, szError );
        }
  }
    else
    {
      //  other errors
      switch( mmRes )
      {
        case  WAVERR_BADFORMAT  :
        {
          strcpy( szError, " : Attempt to open an unsupported waveform-audio format." );
          break;
        }

        case  WAVERR_STILLPLAYING :
        {
          strcpy( szError, " : There is another waveform resource still playing." );
          break;
        }

        case  WAVERR_UNPREPARED :
        {
          strcpy( szError, " : Header is not prepared." );
          break;
        }

        case  WAVERR_SYNC     :
        {
          strcpy( szError, " : Device is synchronous." );
          break;
        }

        case  ACMERR_NOTPOSSIBLE  :
        {
          strcpy( szError, " : The specified action is not possible in the current context." );
          break;
        }

        case  ACMERR_BUSY :
        {
          strcpy( szError, " : The driver is currently in use and cannot be reused." );
          break;
        }

        case  ACMERR_UNPREPARED :
        {
          strcpy( szError, " : The stream header is not currently prepared." );
          break;
        }

        case  ACMERR_CANCELED   :
        {
          strcpy( szError, " : The action has been canceled." );
          break;
        }

        default :
        {
          //  default
          _snprintf( szError, 128, "an unrecognized error code (%d).", mmRes );
          break;
        }
        } //  switch

    _snprintf( szErrMsg, 128, "ERROR : %s returned %s.", szAPI, szError );
  }

    // Display the string.
  MessageBox(hwndMain, szErrMsg, "MultiChan : Error!", MB_ICONEXCLAMATION | MB_OK);

  return( FALSE );
}

HANDLE WaveOpenFile | ( | IN LPCSTR | szFileName,
 |  | OUT WAVEFORMATEX ** | ppWaveFormatEx,
 |  | OUT PULONG | pcbData
 | ) |  |

Definition at line 20 of file wave.cpp.

{
    HMMIO         hmmio;              // mmio style file handle
    MMCKINFO        mmckinfoParent;     // parent chunk info struct
    MMCKINFO        mmckinfoSubchunk; // sub chunk
    HWND            hwnd = AfxGetMainWnd()->m_hWnd;

    HANDLE          hFile = INVALID_HANDLE_VALUE;
    ULONG         cbFormat = 0;
    LONG            lDataPos = 0;

    // open the file
    if(!(hmmio = mmioOpen((LPSTR)szFileName, NULL, MMIO_READ | MMIO_ALLOCBUF)))
    {
        return FALSE;
    }

    // verify that the file is of type "WAVE"
    mmckinfoParent.fccType = MAKEFOURCC('W', 'A', 'V', 'E');
    if(mmioDescend(hmmio, (LPMMCKINFO)&mmckinfoParent, NULL, MMIO_FINDRIFF))
    {
        // not a "WAVE" file!!
        MessageBox(hwnd, "WaveOpenFile:  Missing 'WAVE' chunk.This does not appear to be a wave file.", "MultiChan : Error opening wave file!", MB_ICONEXCLAMATION | MB_OK);
        goto _error_;
    }

    // find the "fmt " chunk (must be a subchunk of the "WAVE" chunk)
    mmckinfoSubchunk.ckid = MAKEFOURCC('f', 'm', 't', ' ');
    if(mmioDescend(hmmio, (LPMMCKINFO)&mmckinfoSubchunk, (LPMMCKINFO)&mmckinfoParent, MMIO_FINDCHUNK))
    {
        // file has no "fmt " chunk
        MessageBox(hwnd, "WaveOpenFile:  Missing 'fmt ' chunk", "MultiChan : Error opening wave file!", MB_ICONEXCLAMATION | MB_OK);
        goto _error_;
    }

    // get the size of the "fmt " chunk
    cbFormat = mmckinfoSubchunk.cksize;

    // allocate waveformat.  The "max" part ensures that the cbSize member of the WAVEFORMATEX exists and = 0
    *ppWaveFormatEx = (LPWAVEFORMATEX)LocalAlloc(LPTR, max(cbFormat, sizeof(WAVEFORMATEX)));
    if(!*ppWaveFormatEx)
    {
        // failed to allocate
        MessageBox(hwnd, "WaveOpenFile:  Failed to allocate memory", "MultiChan : Error opening wave file!", MB_ICONEXCLAMATION | MB_OK);
        goto _error_;
    }

    // read the "fmt " chunk
    if(mmioRead(hmmio, (HPSTR)*ppWaveFormatEx, cbFormat) != (LONG)cbFormat)
    {
        // failed to read the "fmt " chunk
        MessageBox(hwnd, "WaveOpenFile:  Error reading 'fmt ' chunk", "MultiChan : Error opening wave file!", MB_ICONEXCLAMATION | MB_OK);
        goto _error_;
    }

    // ascend out o' the "fmt " chunk
    mmioAscend(hmmio, &mmckinfoSubchunk, 0);

    // and find the data subchunk.  (current file pos should be at the beginning of the
    // data chunk, but when you assume...)
    mmckinfoSubchunk.ckid = MAKEFOURCC('d', 'a', 't', 'a');
    if(mmioDescend(hmmio, &mmckinfoSubchunk, &mmckinfoParent, MMIO_FINDCHUNK))
    {
        // wave file doesn't appear to have a data chunk
        MessageBox(hwnd, "WaveOpenFile:  Missing 'data' chunk", "MultiChan : Error opening wave file!", MB_ICONEXCLAMATION | MB_OK);
        goto _error_;
    }

    // get the size of the "data" subchunk
    *pcbData = mmckinfoSubchunk.cksize;
    if(0L == *pcbData)
    {
        // the data chunk contains no data
        MessageBox(hwnd, "WaveOpenFile:  Error reading 'data' chunk", "MultiChan : Error opening wave file!", MB_ICONEXCLAMATION | MB_OK);
        goto _error_;
    }

    // remember the data
    lDataPos = mmioSeek(hmmio, 0, SEEK_CUR);
    mmioClose(hmmio, 0);

    //
    // now we are done with the mmio functions.  Reopen the file and seek to the data chunk using normal
    // file io routines
    //

    __try
    {
        hFile =
            CreateFile
            (
                szFileName,
                GENERIC_READ,
                FILE_SHARE_READ,
                NULL,
                OPEN_EXISTING,
                FILE_ATTRIBUTE_NORMAL,
                NULL
            );
    }
    __except(EXCEPTION_EXECUTE_HANDLER)
    {
        MessageBox(hwnd, "WaveOpenFile : Handling exception thrown by CreateFile!", "MultiChan : Error opening wave file!", MB_ICONEXCLAMATION | MB_OK);
        goto _error_;
    }

    if (!IsValidHandle(hFile))
    {
        goto _error_;
    }

    SetFilePointer
    (
        hFile,
        lDataPos,
        NULL,
        FILE_BEGIN
    );

    return hFile;

_error_:
    SafeCloseHandle(hFile);
    if(hmmio)
    {
        mmioClose(hmmio, 0);
    }

    return INVALID_HANDLE_VALUE;
}

void CALLBACK WavePlayFileCB | ( | HWAVEOUT | hwo,
 |  | UINT | uMsg,
 |  | DWORD_PTR | dwInstance,
 |  | DWORD_PTR | dwParam1,
 |  | DWORD_PTR | dwParam2
 | ) |  |

Definition at line 267 of file wave.cpp.

{
    DWORD       mmr = MMSYSERR_BASE;

    ASSERT( ( CDialog * )dwInstance );

    switch( uMsg )
    {
        case    WOM_OPEN:
            {
                //
                //  notify window
                //
                (( CDialog * )dwInstance)->PostMessage( WM_START_PLAYBACK, 0, 0 );

                break;
            }
        case    WOM_DONE:
            {
                //
                //  notify window
                //
                (( CDialog * )dwInstance)->PostMessage( WM_STOP_PLAYBACK, 0, 0 );

                break;
            }

        case    WOM_CLOSE:
            {

                break;
            }

        default:
            ASSERT(0);
    }
    return;
}

BOOL WaveSaveFile | ( | IN LPCSTR | szFileName,
 |  | OUT WAVEFORMATEX * | pWaveFormatEx,
 |  | IN PVOID | pvData,
 |  | IN ULONG | cbData
 | ) |  |

Definition at line 161 of file wave.cpp.

{
    HANDLE          hFile   = INVALID_HANDLE_VALUE;
    ULONG           cbWritten;
  HRSRC           hrsrc   = (HRSRC)INVALID_HANDLE_VALUE;
    void*           pv      = NULL;

    //
    // now we are done with the mmio functions.  Reopen the file and seek to the data chunk using normal
    // file io routines
    //

    __try
    {
        hFile =
            CreateFile
            (
                szFileName,
                GENERIC_WRITE,
                0,
                NULL,
                CREATE_ALWAYS,
                FILE_ATTRIBUTE_NORMAL,
                NULL
            );
    }
    __except(EXCEPTION_EXECUTE_HANDLER)
    {
        MessageBox(AfxGetMainWnd()->m_hWnd, "WaveSaveFile : Handling exception thrown by CreateFile!", "MultiChan : Error creating wave file", MB_ICONEXCLAMATION | MB_OK);
        goto _error_;
    }

    if (!IsValidHandle(hFile))
        goto _error_;

  //
  // write file header
  //

    // standard wave goo
    struct
    {
        DWORD   fourccData;
        DWORD   dwDataLength;
    } DataHeader;

    DataHeader.fourccData         = MAKEFOURCC('d','a','t','a');
    DataHeader.dwDataLength       = cbData;

    struct
    {
        DWORD       dwRiff;
        DWORD       dwFileSize;
        DWORD       dwWave;
        DWORD       dwFormat;
        DWORD       dwFormatLength;
    } FileHeader;

    FileHeader.dwRiff             = MAKEFOURCC('R','I','F','F');
    FileHeader.dwWave             = MAKEFOURCC('W','A','V','E');
    FileHeader.dwFormat           = MAKEFOURCC('f','m','t',' ');
    FileHeader.dwFormatLength     = sizeof(WAVEFORMATEX) + pWaveFormatEx->cbSize;
    FileHeader.dwFileSize         = sizeof(FileHeader) + FileHeader.dwFormatLength + sizeof(DataHeader) + cbData;

    if(!WriteFile(hFile, &FileHeader, sizeof(FileHeader), &cbWritten, NULL))
        goto _error_;

    // wave format
    if(!WriteFile(hFile, pWaveFormatEx, sizeof(WAVEFORMATEX) + pWaveFormatEx->cbSize, &cbWritten, NULL))
        goto _error_;

    // data chuck
    if(!WriteFile(hFile, &DataHeader, sizeof(DataHeader), &cbWritten, NULL))
        goto _error_;

    //
    // Write wave data
    //
    if(!WriteFile(hFile, pvData, cbData, &cbWritten, NULL))
        goto _error_;

    SafeCloseHandle( hFile );
    return TRUE;

_error_:
    MessageBox(NULL, "WaveSaveFile : Error Writing File", "MultiChan : Error!", MB_ICONEXCLAMATION | MB_OK);
    SafeCloseHandle( hFile );
    return FALSE;
}

void WaveTogglePlayback | ( | CDlgSrc * | pdlgSelf,
 |  | const BOOL | fSwitch
 | ) |  |

Definition at line 319 of file wave.cpp.

{
  CDlgSrc * pdlgSrc = 0;
  //
  //  fSwitch toggles between disable (FALSE) and allow (TRUE)
  //

  for
  (
    POSITION  position = g_listSources.GetHeadPosition();
    position;
  )
  {
    pdlgSrc = g_listSources.GetNext( position );
    //
    //  disable/enable the play button. the stop button is unaffected
    //
    pdlgSrc->m_fPlayable = fSwitch;
    (pdlgSrc->m_butPlay).EnableWindow( fSwitch );
  }

  //
  //  check target
  //
  if( pdlgSelf )
  {
    //  allow stop
    (pdlgSelf->m_butStop).EnableWindow( !fSwitch );

    //  destination may not be mixed already
    if( g_pdlgDest->m_fPlayable )
    {
      g_pdlgDest->m_fPlayable = fSwitch;
      (g_pdlgDest->m_butPlay).EnableWindow( fSwitch );
    }
    else
    {
      g_pdlgDest->m_fPlayable = fSwitch & (0 != g_pdlgDest->m_pbData);
      (g_pdlgDest->m_butPlay).EnableWindow( g_pdlgDest->m_fPlayable );
    }
  }
  else
  {
    g_pdlgDest->m_fPlayable = fSwitch;
    (g_pdlgDest->m_butPlay).EnableWindow( fSwitch );
    (g_pdlgDest->m_butStop).EnableWindow( !fSwitch );
  }

} //  WaveTogglePlayback

Generated on Wed Nov 13 2024 16:53:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Audio/multichan/wave.h File Reference

  • Multimedia
  • Audio
  • multichan
Defines | Functions | Variables

wave.h File Reference

#include "DlgSrc.h"

Go to the source code of this file.

Defines

#define | WAVE_TOGGLE_ALLOW 1
#define | WAVE_TOGGLE_DESTINATION 0
#define | WAVE_TOGGLE_DISABLE 0

Functions

BOOL | TrapMMError (MMRESULT, LPCSTR)
HANDLE | WaveOpenFile (LPCSTR, WAVEFORMATEX **, PULONG)
void CALLBACK | WavePlayFileCB (HWAVEOUT, UINT, DWORD_PTR, DWORD_PTR, DWORD_PTR)
BOOL | WaveSaveFile (LPCSTR, WAVEFORMATEX *, PVOID, ULONG)
void | WaveTogglePlayback (CDlgSrc *, const BOOL)

Variables

HWAVEOUT | g_hwo

Define Documentation

#define WAVE_TOGGLE_ALLOW 1

Definition at line 18 of file wave.h.

#define WAVE_TOGGLE_DESTINATION 0

Definition at line 16 of file wave.h.

#define WAVE_TOGGLE_DISABLE 0

Definition at line 17 of file wave.h.

Function Documentation

BOOL TrapMMError | ( | MMRESULT | ,
 |  | LPCSTR |
 | ) |  |

Definition at line 380 of file wave.cpp.

{
  //  no error
    if(MMSYSERR_NOERROR == mmRes)
    {
        return( TRUE );
    }

    HWND    hwndMain        = AfxGetMainWnd()->m_hWnd;
    char    szError[128]  = "";
    char    szErrMsg[128] = "";

  //  basic mmsys error
  if( MMSYSERR_LASTERROR >= mmRes )
  {
    if( MMSYSERR_NOMEM == waveOutGetErrorText( mmRes, szError, 128 ) )
    {
      _snprintf( szErrMsg, 128, "Insufficient memory to complete the task.");
    }
        else
        {
        _snprintf( szErrMsg, 128, "ERROR : %s returned : %s", szAPI, szError );
        }
  }
    else
    {
      //  other errors
      switch( mmRes )
      {
        case  WAVERR_BADFORMAT  :
        {
          strcpy( szError, " : Attempt to open an unsupported waveform-audio format." );
          break;
        }

        case  WAVERR_STILLPLAYING :
        {
          strcpy( szError, " : There is another waveform resource still playing." );
          break;
        }

        case  WAVERR_UNPREPARED :
        {
          strcpy( szError, " : Header is not prepared." );
          break;
        }

        case  WAVERR_SYNC     :
        {
          strcpy( szError, " : Device is synchronous." );
          break;
        }

        case  ACMERR_NOTPOSSIBLE  :
        {
          strcpy( szError, " : The specified action is not possible in the current context." );
          break;
        }

        case  ACMERR_BUSY :
        {
          strcpy( szError, " : The driver is currently in use and cannot be reused." );
          break;
        }

        case  ACMERR_UNPREPARED :
        {
          strcpy( szError, " : The stream header is not currently prepared." );
          break;
        }

        case  ACMERR_CANCELED   :
        {
          strcpy( szError, " : The action has been canceled." );
          break;
        }

        default :
        {
          //  default
          _snprintf( szError, 128, "an unrecognized error code (%d).", mmRes );
          break;
        }
        } //  switch

    _snprintf( szErrMsg, 128, "ERROR : %s returned %s.", szAPI, szError );
  }

    // Display the string.
  MessageBox(hwndMain, szErrMsg, "MultiChan : Error!", MB_ICONEXCLAMATION | MB_OK);

  return( FALSE );
}

HANDLE WaveOpenFile | ( | LPCSTR | ,
 |  | WAVEFORMATEX ** | ,
 |  | PULONG |
 | ) |  |
void CALLBACK WavePlayFileCB | ( | HWAVEOUT | ,
 |  | UINT | ,
 |  | DWORD_PTR | ,
 |  | DWORD_PTR | ,
 |  | DWORD_PTR |
 | ) |  |

Definition at line 267 of file wave.cpp.

{
    DWORD       mmr = MMSYSERR_BASE;

    ASSERT( ( CDialog * )dwInstance );

    switch( uMsg )
    {
        case    WOM_OPEN:
            {
                //
                //  notify window
                //
                (( CDialog * )dwInstance)->PostMessage( WM_START_PLAYBACK, 0, 0 );

                break;
            }
        case    WOM_DONE:
            {
                //
                //  notify window
                //
                (( CDialog * )dwInstance)->PostMessage( WM_STOP_PLAYBACK, 0, 0 );

                break;
            }

        case    WOM_CLOSE:
            {

                break;
            }

        default:
            ASSERT(0);
    }
    return;
}

BOOL WaveSaveFile | ( | LPCSTR | ,
 |  | WAVEFORMATEX * | ,
 |  | PVOID | ,
 |  | ULONG |
 | ) |  |
void WaveTogglePlayback | ( | CDlgSrc * | ,
 |  | const | BOOL
 | ) |  |

Definition at line 319 of file wave.cpp.

{
  CDlgSrc * pdlgSrc = 0;
  //
  //  fSwitch toggles between disable (FALSE) and allow (TRUE)
  //

  for
  (
    POSITION  position = g_listSources.GetHeadPosition();
    position;
  )
  {
    pdlgSrc = g_listSources.GetNext( position );
    //
    //  disable/enable the play button. the stop button is unaffected
    //
    pdlgSrc->m_fPlayable = fSwitch;
    (pdlgSrc->m_butPlay).EnableWindow( fSwitch );
  }

  //
  //  check target
  //
  if( pdlgSelf )
  {
    //  allow stop
    (pdlgSelf->m_butStop).EnableWindow( !fSwitch );

    //  destination may not be mixed already
    if( g_pdlgDest->m_fPlayable )
    {
      g_pdlgDest->m_fPlayable = fSwitch;
      (g_pdlgDest->m_butPlay).EnableWindow( fSwitch );
    }
    else
    {
      g_pdlgDest->m_fPlayable = fSwitch & (0 != g_pdlgDest->m_pbData);
      (g_pdlgDest->m_butPlay).EnableWindow( g_pdlgDest->m_fPlayable );
    }
  }
  else
  {
    g_pdlgDest->m_fPlayable = fSwitch;
    (g_pdlgDest->m_butPlay).EnableWindow( fSwitch );
    (g_pdlgDest->m_butStop).EnableWindow( !fSwitch );
  }

} //  WaveTogglePlayback

Variable Documentation

HWAVEOUT g_hwo

Definition at line 22 of file childview.cpp.

Generated on Wed Nov 13 2024 16:53:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/Fonts/FontView/Dialogs.c File Reference

  • Multimedia
  • Gdi
  • Fonts
  • FontView
Classes | Defines | Typedefs | Functions

Dialogs.c File Reference

#include <windows.h>
#include <stdio.h>
#include "FontView.h"
#include <stdlib.h>

Go to the source code of this file.

Classes

struct | FONTENUM
struct | FONTLIST

Defines

#define | APIENTRY FAR PASCAL
#define | NOMINMAX

Typedefs

typedef struct FONTLIST | FONTLIST
typedef struct FONTENUM | FONTSTRUCT
typedef FONTLIST FAR * | LPFONTLIST
typedef FONTSTRUCT FAR * | LPFONTSTRUCT
typedef FONTLIST NEAR * | NPFONTLIST
typedef FONTSTRUCT NEAR * | NPFONTSTRUCT
typedef FONTLIST * | PFONTLIST
typedef FONTSTRUCT * | PFONTSTRUCT

Functions

BOOL | CenterWindow (HWND, HWND)
BOOL APIENTRY | CreateDlgProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
BOOL FAR PASCAL | DlgEnumFontNames (LPLOGFONT lpLogFont, LPTEXTMETRIC lpTextMetric, short nFontType, LPHANDLE lpData)
BOOL FAR PASCAL | DlgEnumFontSizes (LPLOGFONT lpLogFont, LPTEXTMETRIC lpTextMetric, short nFontType, LPHANDLE lpData)
BOOL | DrawSample (HWND hwnd, LPLOGFONT plf)
BOOL APIENTRY | EnumDlgProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
BOOL | FillEnumFields (HWND hwnd, int iType, LPTEXTMETRIC ptm, LPLOGFONT plf, int nBase)
BOOL APIENTRY | MetricsDlgProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
void | SetDlgItemValue (HWND hDlg, int nIDDlgItem, int wValue, BOOL bSigned, int nBase)
BOOL APIENTRY | SimpleDlgProc (HWND hwnd, UINT msg, UINT wParam, LONG lParam)

Define Documentation

#define APIENTRY FAR PASCAL

Definition at line 20 of file Dialogs.c.

#define NOMINMAX

Definition at line 12 of file Dialogs.c.

Typedef Documentation

typedef struct FONTLIST FONTLIST
typedef struct FONTENUM FONTSTRUCT
typedef FONTLIST FAR* LPFONTLIST

Definition at line 41 of file Dialogs.c.

typedef FONTSTRUCT FAR* LPFONTSTRUCT

Definition at line 33 of file Dialogs.c.

typedef FONTLIST NEAR* NPFONTLIST

Definition at line 40 of file Dialogs.c.

typedef FONTSTRUCT NEAR* NPFONTSTRUCT

Definition at line 32 of file Dialogs.c.

typedef FONTLIST* PFONTLIST

Definition at line 39 of file Dialogs.c.

typedef FONTSTRUCT* PFONTSTRUCT

Definition at line 31 of file Dialogs.c.

Function Documentation

BOOL CenterWindow | ( | HWND | ,
 |  | HWND |
 | ) |  |

Definition at line 676 of file Generic.C.

{
   RECT    rChild, rParent, rWorkArea;
   int     wChild, hChild, wParent, hParent;
   int     xNew, yNew;
   BOOL  bResult;

   // Get the Height and Width of the child window
   GetWindowRect (hwndChild, &rChild);
   wChild = rChild.right - rChild.left;
   hChild = rChild.bottom - rChild.top;

   // Get the Height and Width of the parent window
   GetWindowRect (hwndParent, &rParent);
   wParent = rParent.right - rParent.left;
   hParent = rParent.bottom - rParent.top;

   // Get the limits of the 'workarea'
   bResult = SystemParametersInfo(
      SPI_GETWORKAREA,  // system parameter to query or set
      sizeof(RECT),
      &rWorkArea,
      0);
   if (!bResult) {
      rWorkArea.left = rWorkArea.top = 0;
      rWorkArea.right = GetSystemMetrics(SM_CXSCREEN);
      rWorkArea.bottom = GetSystemMetrics(SM_CYSCREEN);
   }

   // Calculate new X position, then adjust for workarea
   xNew = rParent.left + ((wParent - wChild) /2);
   if (xNew < rWorkArea.left) {
      xNew = rWorkArea.left;
   } else if ((xNew+wChild) > rWorkArea.right) {
      xNew = rWorkArea.right - wChild;
   }

   // Calculate new Y position, then adjust for workarea
   yNew = rParent.top  + ((hParent - hChild) /2);
   if (yNew < rWorkArea.top) {
      yNew = rWorkArea.top;
   } else if ((yNew+hChild) > rWorkArea.bottom) {
      yNew = rWorkArea.bottom - hChild;
   }

   // Set it, and return
   return SetWindowPos (hwndChild, NULL, xNew, yNew, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
}

BOOL APIENTRY CreateDlgProc | ( | HWND | hwnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 209 of file Dialogs.c.

{
    int wmId, i;
    BOOL bDone;
    static LOGFONT lfDlg;
    static LPLOGFONT lplf;

    switch (msg) {
        case WM_INITDIALOG:
            CenterWindow (hwnd, GetWindow (hwnd, GW_OWNER));
            lplf = (LOGFONT *)lParam;
            if (!lplf) {
                return FALSE;
            }
            lfDlg = *lplf;
            SetDlgItemInt (hwnd, CFD_HEIGHT, (int)lfDlg.lfHeight, TRUE);
            SetDlgItemInt (hwnd, CFD_WIDTH, (int)lfDlg.lfWidth, TRUE);
            SetDlgItemInt (hwnd, CFD_ESCAPEMENT, (int)lfDlg.lfEscapement, TRUE);
            SetDlgItemInt (hwnd, CFD_ORIENTATION, (int)lfDlg.lfOrientation, TRUE);
            SetDlgItemInt (hwnd, CFD_WEIGHT, (int)lfDlg.lfWeight, FALSE);
            SetDlgItemInt (hwnd, CFD_ITALIC, (int)lfDlg.lfItalic, FALSE);
            SetDlgItemInt (hwnd, CFD_UNDERLINE, (int)lfDlg.lfUnderline, FALSE);
            SetDlgItemInt (hwnd, CFD_STRIKEOUT, (int)lfDlg.lfStrikeOut, FALSE);
            SetDlgItemInt (hwnd, CFD_CHARSET, (int)lfDlg.lfCharSet, FALSE);
            SetDlgItemInt (hwnd, CFD_OUTPUTPRECISION, (int)lfDlg.lfOutPrecision, FALSE);
            SetDlgItemInt (hwnd, CFD_CLIPPRECISION, (int)lfDlg.lfClipPrecision, FALSE);
            SetDlgItemInt (hwnd, CFD_QUALITY, (int)lfDlg.lfQuality, FALSE);
            SetDlgItemInt (hwnd, CFD_PITCHANDFAMILY, (int)lfDlg.lfPitchAndFamily, FALSE);
            SetDlgItemText(hwnd, CFD_FACENAME, lfDlg.lfFaceName);

            return (TRUE);

        case WM_COMMAND:
            wmId = LOWORD(wParam);
            switch (wmId) {
                case CFD_DEFAULT:
                    // Set all elements to ZERO. This will give us a 'default' font
                    for (i=CFD_BASE; i<=CFD_PITCHANDFAMILY; i++) {
                        SetDlgItemInt (hwnd, i, 0, FALSE);
                    }
                    SetDlgItemText (hwnd, CFD_FACENAME, "");
                    break;

                case IDOK:
                    // Get the data from the edit control, we will then use this for a 'CreatFont' call
                    lfDlg.lfHeight = GetDlgItemInt (hwnd, CFD_HEIGHT, &bDone, TRUE);
                    lfDlg.lfWidth = GetDlgItemInt (hwnd, CFD_WIDTH, &bDone, TRUE);
                    lfDlg.lfEscapement = GetDlgItemInt (hwnd, CFD_ESCAPEMENT, &bDone, TRUE);
                    lfDlg.lfOrientation = GetDlgItemInt (hwnd, CFD_ORIENTATION, &bDone, TRUE);
                    lfDlg.lfWeight = GetDlgItemInt (hwnd, CFD_WEIGHT, &bDone, FALSE);
                    lfDlg.lfItalic = (BYTE)GetDlgItemInt (hwnd, CFD_ITALIC, &bDone, FALSE);
                    lfDlg.lfUnderline = (BYTE)GetDlgItemInt (hwnd, CFD_UNDERLINE, &bDone, FALSE);
                    lfDlg.lfStrikeOut = (BYTE)GetDlgItemInt (hwnd, CFD_STRIKEOUT, &bDone, FALSE);
                    lfDlg.lfCharSet = (BYTE)GetDlgItemInt (hwnd, CFD_CHARSET, &bDone, FALSE);
                    lfDlg.lfOutPrecision = (BYTE)GetDlgItemInt (hwnd, CFD_OUTPUTPRECISION, &bDone, FALSE);
                    lfDlg.lfClipPrecision = (BYTE)GetDlgItemInt (hwnd, CFD_CLIPPRECISION, &bDone, FALSE);
                    lfDlg.lfQuality = (BYTE)GetDlgItemInt (hwnd, CFD_QUALITY, &bDone, FALSE);
                    lfDlg.lfPitchAndFamily = (BYTE)GetDlgItemInt (hwnd, CFD_PITCHANDFAMILY, &bDone, FALSE);
                    GetDlgItemText(hwnd, CFD_FACENAME, lfDlg.lfFaceName,20);
                    // and copy the data into our external structure
                    *lplf = lfDlg;
                    EndDialog(hwnd, TRUE);
                    return TRUE;

                case IDCANCEL:
                    // Exit without changing anything
                    EndDialog(hwnd, TRUE);
                    return TRUE;

            }
            break;
    }
    return FALSE;

    lParam; //unreferenced formal paramter
}

BOOL FAR PASCAL DlgEnumFontNames | ( | LPLOGFONT | lpLogFont,
 |  | LPTEXTMETRIC | lpTextMetric,
 |  | short | nFontType,
 |  | LPHANDLE | lpData
 | ) |  |

Definition at line 108 of file Dialogs.c.

{
    HDC  hdc;
    HWND hwnd;
    HANDLE hInst;
    FARPROC lpFontEnumProc;

/*
   This function is just a pass through. For each face encountered, it will in turn enumerate all
   sizes available. the lpData, which is a FAR * to a FONTSTRUCT structure will simply be passed
   on to the second enumeration procedure which will fill it in.
 */
    hwnd = GetFocus();
    hInst = (HANDLE)GetWindowLongPtr (hwnd, GWLP_HINSTANCE);

    lpFontEnumProc = MakeProcInstance((FARPROC)DlgEnumFontSizes, hInst);
    if (lpFontEnumProc) {
        hdc  = GetDC(hwnd);
        EnumFonts (hdc, lpLogFont->lfFaceName, (FONTENUMPROC)lpFontEnumProc, (LPARAM)lpData);
        ReleaseDC(hwnd, hdc);
        FreeProcInstance (lpFontEnumProc);
    } else {
        MessageBox (GetFocus(), "Couldn't create a proc instance", "FontView", MB_OK);
        return FALSE;
    }
    return TRUE;

    lpTextMetric;  // unreferenced formal parameter
    nFontType;     // unreferenced formal parameter
}

BOOL FAR PASCAL DlgEnumFontSizes | ( | LPLOGFONT | lpLogFont,
 |  | LPTEXTMETRIC | lpTextMetric,
 |  | short | nFontType,
 |  | LPHANDLE | lpData
 | ) |  |

Definition at line 69 of file Dialogs.c.

{
    HANDLE hFonts;
    LPFONTSTRUCT pFS;
    LPFONTLIST pFL;

    /*
        This function will lock down the incoming handle, properly alloc, and realloc the
        handle within it to hold the data of the fonts enumerated, then unlock the handle.
    */
    hFonts = *lpData;
    pFL = (LPFONTLIST)GlobalLock (hFonts);
    if (!pFL) {
        return FALSE;
    } else if (pFL->count == 0) {
        pFL->hList = GlobalAlloc (GHND, sizeof(FONTSTRUCT));
    } else {
        pFL->hList = GlobalReAlloc (pFL->hList, sizeof(FONTSTRUCT)*(1+pFL->count), GMEM_MOVEABLE);
    }

    if (pFL->hList) {
        pFS = (LPFONTSTRUCT)GlobalLock (pFL->hList);
        if (pFS) {
            pFS[pFL->count].ft = nFontType;
            pFS[pFL->count].tm = *lpTextMetric;
            pFS[pFL->count].lf = *lpLogFont;
            GlobalUnlock (pFL->hList);
            pFL->count++;
        }
        GlobalUnlock (hFonts);

    } else {
        GlobalUnlock (hFonts);
        return FALSE;
    }

    return TRUE;
}

BOOL DrawSample | ( | HWND | hwnd,
 |  | LPLOGFONT | plf
 | ) |  |

Definition at line 487 of file Dialogs.c.

{
    HFONT   hfont, hfontPrev;
    HDC     hdc;
    RECT    r;

    hfont = CreateFontIndirect (plf);
    hdc = GetDC (hwnd);
    hfontPrev = SelectObject (hdc, hfont);
    GetWindowRect (hwnd, &r);
    ScreenToClient (hwnd, (LPPOINT)&r.left);
    ScreenToClient (hwnd, (LPPOINT)&r.right);

    Rectangle (hdc, r.left, r.top, r.right, r.bottom);

    InflateRect (&r, -1, -1);
    SetTextAlign (hdc, TA_BOTTOM | TA_CENTER);
    ExtTextOut (hdc, r.left + ((r.right-r.left)/2), r.bottom, ETO_CLIPPED, &r,"AaBbCcDdEe 012345", 17, NULL);

    SelectObject (hdc, hfontPrev);
    DeleteObject (hfont);
    ReleaseDC (hwnd, hdc);
    return TRUE;
}

BOOL APIENTRY EnumDlgProc | ( | HWND | hwnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 519 of file Dialogs.c.

{
    static HANDLE /*TO FONTLIST*/ hFonts;
    static int iLoc=0;
    static int count=0;
    static BOOL bHex = FALSE;
    static LOGFONT *lplf;
    static LOGFONT lfDlg;
    int wmId, i, j;
    HANDLE hInst;
    HWND   hwndItem;
    HDC hdc;
    FARPROC lpEnumFonts;
    LPFONTLIST    pFL;
    LPFONTSTRUCT  pFS;
    char szTmp[80];
    HFONT hfont, hfontPrev;
    BOOL bDone;
    TEXTMETRIC tmTmp;

    switch (msg) {
        case WM_INITDIALOG:
            lplf = (LOGFONT *)lParam;
            if (!lplf)
            {
                return FALSE;
            }

            lfDlg = *lplf;
            iLoc = 0;
            count = 0;
            bHex = FALSE;
            /* First, lets enumerate ALL fonts, and store them in our list */
            hFonts = GlobalAlloc (GHND, sizeof(FONTLIST));
            if (hFonts) {
                hInst = (HANDLE)GetWindowLongPtr (hwnd, GWLP_HINSTANCE);
                lpEnumFonts = MakeProcInstance((FARPROC)DlgEnumFontNames, hInst);

                if (lpEnumFonts) {
                    hdc  = GetDC(hwnd);
                    // The enumeration function will lock down the handle
                    EnumFonts (hdc, NULL, (FONTENUMPROC)lpEnumFonts, (LPARAM)&hFonts);
                    // The handle will come back to us properly unlocked
                    ReleaseDC(hwnd, hdc);
                    FreeProcInstance (lpEnumFonts);
                 }
            }
            pFL = (LPFONTLIST)GlobalLock (hFonts);
            if (pFL) {
                pFS = (LPFONTSTRUCT)GlobalLock (pFL->hList);
                if (pFS) {
                    iLoc = 0;
                    j = 100;
                    for (i=0; i<pFL->count; i++) {
                        if (lstrcmp(lfDlg.lfFaceName, pFS[i].lf.lfFaceName) == 0) {
                            if (abs(lfDlg.lfHeight-pFS[i].lf.lfHeight) < j) {
                                j = abs(lfDlg.lfHeight-pFS[i].lf.lfHeight);
                                iLoc = i;
                            }
                        }
                    }
                    FillEnumFields (hwnd, pFS[iLoc].ft, &pFS[iLoc].tm, &pFS[iLoc].lf, (bHex?16:10));
                    hwndItem = GetDlgItem (hwnd, ED_SAMPLE);
                    DrawSample (hwndItem, &pFS[iLoc].lf);
                    GlobalUnlock (pFL->hList);

                }
                count = pFL->count;
                GlobalUnlock (hFonts);

            }
            /* now fill in the dialog values */
            if (_snprintf (szTmp, sizeof(szTmp) - 1, "EnumFonts %d of %d", iLoc+1, count) > 0)
            {
                szTmp[sizeof(szTmp) - 1] = '\0';
                SetWindowText (hwnd, szTmp);
            }
            CenterWindow (hwnd, GetWindow (hwnd, GW_OWNER));

            return TRUE;

        case WM_PAINT:
            pFL = (LPFONTLIST)GlobalLock (hFonts);
            if (pFL) {
                pFS = (LPFONTSTRUCT)GlobalLock (pFL->hList);
                if (pFS) {
                    FillEnumFields (hwnd, pFS[iLoc].ft, &pFS[iLoc].tm, &pFS[iLoc].lf, (bHex?16:10));
                    hwndItem = GetDlgItem (hwnd, ED_SAMPLE);
                    DrawSample (hwndItem, &pFS[iLoc].lf);
                    GlobalUnlock (pFL->hList);
                }
                GlobalUnlock (hFonts);
            }
            return TRUE;

        case WM_COMMAND:
            wmId = LOWORD(wParam);
            switch (wmId) {

                case ED_HEX:
                    // Display the data in either Hex mode or Dec mode.
                    bHex = !bHex;
                    CheckDlgButton (hwnd, wmId, bHex);
                    pFL = (LPFONTLIST)GlobalLock (hFonts);
                    if (pFL) {
                        pFS = (LPFONTSTRUCT)GlobalLock (pFL->hList);
                        if (pFS) {
                            FillEnumFields (hwnd, pFS[iLoc].ft, &pFS[iLoc].tm, &pFS[iLoc].lf, (bHex?16:10));
                            if (GlobalUnlock (pFL->hList)) {
                                MessageBox (GetFocus(), "In HEX", "Unlock pFL->hList", MB_OK);
                            }
                        }
                        if (GlobalUnlock (hFonts)) {
                            MessageBox (GetFocus(), "In HEX", "Unlock hFonts", MB_OK);
                        }

                    }
                    break;

                case ED_PREV:
                    pFL = (LPFONTLIST)GlobalLock (hFonts);
                    if (pFL) {
                        if (iLoc > 0) {
                            iLoc--;
                            pFS = (LPFONTSTRUCT)GlobalLock (pFL->hList);
                            if (pFS) {
                                FillEnumFields (hwnd, pFS[iLoc].ft, &pFS[iLoc].tm, &pFS[iLoc].lf, (bHex?16:10));
                                hwndItem = GetDlgItem (hwnd, ED_SAMPLE);
                                DrawSample (hwndItem, &pFS[iLoc].lf);
                                GlobalUnlock (pFL->hList);
                            }
                        }
                        GlobalUnlock (hFonts);
                    }

                    if (_snprintf (szTmp, sizeof(szTmp) - 1, "EnumFonts %d of %d", iLoc+1, count) > 0 )
                    {
                        szTmp[sizeof(szTmp) - 1] = '\0';
                        SetWindowText (hwnd, szTmp);
                    }
                    break;

                case ED_NEXT:
                    pFL = (LPFONTLIST)GlobalLock (hFonts);
                    if (pFL) {
                        if ((pFL->count-1) > iLoc) {
                            iLoc++;
                            pFS = (LPFONTSTRUCT)GlobalLock (pFL->hList);
                            if (pFS) {
                                FillEnumFields (hwnd, pFS[iLoc].ft, &pFS[iLoc].tm, &pFS[iLoc].lf, (bHex?16:10));
                                hwndItem = GetDlgItem (hwnd, ED_SAMPLE);
                                DrawSample (hwndItem, &pFS[iLoc].lf);
                                GlobalUnlock (pFL->hList);
                            }

                        }
                        GlobalUnlock (hFonts);
                    }

                    if (_snprintf (szTmp, sizeof(szTmp) - 1, "EnumFonts %d of %d", iLoc+1, count) > 0 )
                    {
                        szTmp[sizeof(szTmp) - 1] = '\0';
                        SetWindowText (hwnd, szTmp);
                    }
                    break;

                case IDOK:
                    // Copy the LOGFONT structure from the enumeration list, into our private LF
                    pFL = (LPFONTLIST)GlobalLock (hFonts);
                    bDone = FALSE;
                    if (pFL) {
                        if ((pFL->count-1) >= iLoc) {
                            pFS = (LPFONTSTRUCT)GlobalLock (pFL->hList);
                            if (pFS) {
                                lfDlg = pFS[iLoc].lf;

                                // Lets create a font with this new data
                                hfont = CreateFontIndirect (&lfDlg);
                                hdc = GetDC (hwnd);
                                hfontPrev = SelectObject (hdc, hfont);
                                GetTextMetrics (hdc, &tmTmp);
                                // Get the face name
                                GetTextFace    (hdc, sizeof(szTmp), szTmp);
                                SelectObject (hdc, hfontPrev);
                                DeleteObject (hfont);
                                ReleaseDC (hwnd, hdc);

                                // And verify that we did indeed get the same font.
                                bDone = TRUE;
                                bDone = bDone && (pFS[iLoc].tm.tmHeight==tmTmp.tmHeight);
                                bDone = bDone && (pFS[iLoc].tm.tmAscent==tmTmp.tmAscent);
                                bDone = bDone && (pFS[iLoc].tm.tmDescent==tmTmp.tmDescent);
                                bDone = bDone && (pFS[iLoc].tm.tmInternalLeading==tmTmp.tmInternalLeading);
                                bDone = bDone && (pFS[iLoc].tm.tmExternalLeading==tmTmp.tmExternalLeading);
                                bDone = bDone && (pFS[iLoc].tm.tmAveCharWidth==tmTmp.tmAveCharWidth);
                                bDone = bDone && (pFS[iLoc].tm.tmMaxCharWidth==tmTmp.tmMaxCharWidth);
                                bDone = bDone && (pFS[iLoc].tm.tmWeight==tmTmp.tmWeight);
                                bDone = bDone && (pFS[iLoc].tm.tmItalic==tmTmp.tmItalic);
                                bDone = bDone && (pFS[iLoc].tm.tmUnderlined==tmTmp.tmUnderlined);
                                bDone = bDone && (pFS[iLoc].tm.tmStruckOut==tmTmp.tmStruckOut);
                                bDone = bDone && (pFS[iLoc].tm.tmFirstChar==tmTmp.tmFirstChar);
                                bDone = bDone && (pFS[iLoc].tm.tmLastChar==tmTmp.tmLastChar);
                                bDone = bDone && (pFS[iLoc].tm.tmDefaultChar==tmTmp.tmDefaultChar);
                                bDone = bDone && (pFS[iLoc].tm.tmBreakChar==tmTmp.tmBreakChar);
                                bDone = bDone && (pFS[iLoc].tm.tmPitchAndFamily==tmTmp.tmPitchAndFamily);
                                bDone = bDone && (pFS[iLoc].tm.tmCharSet==tmTmp.tmCharSet);
                                // Did it work?
                                if (bDone) {
                                    *lplf = lfDlg;
                                    //EndDialog(hwnd, TRUE);
                                    //return (TRUE);
                                } else {
                                    // Again, font verification code is'nt quite up to
                                    // snuff yet, so just Select the font anyway:
                                    *lplf = lfDlg;

                                    // ...and this is what we want to do once we fix the
                                    // font verification code:
                                    //lfDlg = *lplf;
                                    //MessageBox (GetFocus(),
                                    //    "Unable to re-create font from TextMetrics",
                                    //    "FontView", MB_OK);
                                }

                                GlobalUnlock (pFL->hList);
                            }
                        }
                        GlobalUnlock (hFonts);
                    }

                    // Now set our master lf to this value. This way, we 'could' verify that the
                    // LOGFONT structure will in fact select this particular font, we just aren't yet
                    // *lplf = lfDlg;

                    pFL = (LPFONTLIST)GlobalLock (hFonts);
                    if (pFL) {
                        if (GlobalFree (pFL->hList)) {
                            MessageBox (GetFocus(), "Failed To Free", "pFL->hList", MB_OK);
                        } else {
                            GlobalUnlock (hFonts);
                            if (GlobalFree (hFonts)) {
                                MessageBox (GetFocus(), "Failed To Free", "hFonts", MB_OK);
                            }
                        }
                    }
                    EndDialog(hwnd, TRUE);
                    return bDone;

                case IDCANCEL:
                    pFL = (LPFONTLIST)GlobalLock (hFonts);
                    if (pFL) {
                        if (GlobalFree (pFL->hList)) {
                            MessageBox (GetFocus(), "Failed To Free", "pFL->hList", MB_OK);
                        } else {
                            GlobalUnlock (hFonts);
                            if (GlobalFree (hFonts)) {
                                MessageBox (GetFocus(), "Failed To Free", "hFonts", MB_OK);
                            }
                        }
                    }
                    EndDialog(hwnd, TRUE);
                    return TRUE;
            }
            break;
    }
    return FALSE;

    lParam; // unreferenced formal parameter
}

BOOL FillEnumFields | ( | HWND | hwnd,
 |  | int | iType,
 |  | LPTEXTMETRIC | ptm,
 |  | LPLOGFONT | plf,
 |  | int | nBase
 | ) |  |

Definition at line 435 of file Dialogs.c.

{
            if (!ptm)
            {
                return FALSE;
            }
            SetDlgItemValue (hwnd, TMD_HEIGHT, (int)ptm->tmHeight, TRUE, nBase);
            SetDlgItemValue (hwnd, TMD_ASCENT, (int)ptm->tmAscent, TRUE, nBase);
            SetDlgItemValue (hwnd, TMD_DESCENT, (int)ptm->tmDescent, TRUE, nBase);
            SetDlgItemValue (hwnd, TMD_INTERNAL, (int)ptm->tmInternalLeading, TRUE, nBase);
            SetDlgItemValue (hwnd, TMD_EXTERNAL, (int)ptm->tmExternalLeading, TRUE, nBase);
            SetDlgItemValue (hwnd, TMD_AVEWIDTH, (int)ptm->tmAveCharWidth, TRUE, nBase);
            SetDlgItemValue (hwnd, TMD_MAXWIDTH, (int)ptm->tmMaxCharWidth, TRUE, nBase);
            SetDlgItemValue (hwnd, TMD_WEIGHT, (int)ptm->tmWeight, TRUE, nBase);
            SetDlgItemValue (hwnd, TMD_ITALIC, (int)ptm->tmItalic, FALSE, nBase);
            SetDlgItemValue (hwnd, TMD_UNDERLINE, (int)ptm->tmUnderlined, FALSE, nBase);
            SetDlgItemValue (hwnd, TMD_STRUCKOUT, (int)ptm->tmStruckOut, FALSE, nBase);
            SetDlgItemValue (hwnd, TMD_FIRSTCHAR, (int)ptm->tmFirstChar, FALSE, nBase);
            SetDlgItemValue (hwnd, TMD_LASTCHAR, (int)ptm->tmLastChar, FALSE, nBase);
            SetDlgItemValue (hwnd, TMD_DEFAULTCHAR, (int)ptm->tmDefaultChar, FALSE, nBase);
            SetDlgItemValue (hwnd, TMD_BREAKCHAR, (int)ptm->tmBreakChar, FALSE, nBase);
            SetDlgItemValue (hwnd, TMD_PITCHANDFAMILY, (int)ptm->tmPitchAndFamily, FALSE, nBase);
            SetDlgItemValue (hwnd, TMD_CHARSET, (int)ptm->tmCharSet, FALSE, nBase);
            SetDlgItemValue (hwnd, TMD_OVERHANG, (int)ptm->tmOverhang, TRUE, nBase);
            SetDlgItemValue (hwnd, TMD_DIGITIZEDASPECTX, (int)ptm->tmDigitizedAspectX, TRUE, nBase);
            SetDlgItemValue (hwnd, TMD_DIGITIZEDASPECTY, (int)ptm->tmDigitizedAspectY, TRUE, nBase);

            if (!plf)
            {
                return FALSE;
            }
            SetDlgItemValue (hwnd, CFD_HEIGHT, (int)plf->lfHeight, TRUE, nBase);
            SetDlgItemValue (hwnd, CFD_WIDTH, (int)plf->lfWidth, TRUE, nBase);
            SetDlgItemValue (hwnd, CFD_ESCAPEMENT, (int)plf->lfEscapement, TRUE, nBase);
            SetDlgItemValue (hwnd, CFD_ORIENTATION, (int)plf->lfOrientation, TRUE, nBase);
            SetDlgItemValue (hwnd, CFD_WEIGHT, (int)plf->lfWeight, FALSE, nBase);
            SetDlgItemValue (hwnd, CFD_ITALIC, (int)plf->lfItalic, FALSE, nBase);
            SetDlgItemValue (hwnd, CFD_UNDERLINE, (int)plf->lfUnderline, FALSE, nBase);
            SetDlgItemValue (hwnd, CFD_STRIKEOUT, (int)plf->lfStrikeOut, FALSE, nBase);
            SetDlgItemValue (hwnd, CFD_CHARSET, (int)plf->lfCharSet, FALSE, nBase);
            SetDlgItemValue (hwnd, CFD_OUTPUTPRECISION, (int)plf->lfOutPrecision, FALSE, nBase);
            SetDlgItemValue (hwnd, CFD_CLIPPRECISION, (int)plf->lfClipPrecision, FALSE, nBase);
            SetDlgItemValue (hwnd, CFD_QUALITY, (int)plf->lfQuality, FALSE, nBase);
            SetDlgItemValue (hwnd, CFD_PITCHANDFAMILY, (int)plf->lfPitchAndFamily, FALSE, nBase);
            SetDlgItemText(hwnd, CFD_FACENAME, plf->lfFaceName);

            SetDlgItemValue (hwnd, ED_TYPE, (int)iType, FALSE, nBase);

            return TRUE;
}

BOOL APIENTRY MetricsDlgProc | ( | HWND | hwnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 291 of file Dialogs.c.

{
static LOGFONT lfDlg;
static LPLOGFONT lplf;
static TEXTMETRIC tm;
static char szFacename[LF_FACESIZE];
    int wmId;
    BOOL bDone;
    TEXTMETRIC tmTmp;
    HFONT hfont, hfontPrev;
    HDC   hdc;
    char szBuffer[LF_FACESIZE+15];

    switch (msg) {
        case WM_INITDIALOG:
            CenterWindow (hwnd, GetWindow (hwnd, GW_OWNER));
            lplf = (LOGFONT *)lParam;
            lfDlg = *lplf;

            hfont = CreateFontIndirect (&lfDlg);
            hdc = GetDC (hwnd);
            hfontPrev = SelectObject (hdc, hfont);
            GetTextMetrics (hdc, &tm);
            GetTextFace    (hdc, sizeof(szFacename), szFacename);
            SelectObject (hdc, hfontPrev);
            DeleteObject (hfont);
            ReleaseDC (hwnd, hdc);

            if (_snprintf (szBuffer, sizeof(szBuffer) - 1, "TextMetrics: %s", (LPSTR)szFacename) > 0 )
            {
                szBuffer[sizeof(szBuffer) - 1] = '\0';
                SetWindowText (hwnd, szBuffer);
            }

            SetDlgItemInt (hwnd, TMD_HEIGHT, (int)tm.tmHeight, TRUE);
            SetDlgItemInt (hwnd, TMD_ASCENT, (int)tm.tmAscent, TRUE);
            SetDlgItemInt (hwnd, TMD_DESCENT, (int)tm.tmDescent, TRUE);
            SetDlgItemInt (hwnd, TMD_INTERNAL, (int)tm.tmInternalLeading, TRUE);
            SetDlgItemInt (hwnd, TMD_EXTERNAL, (int)tm.tmExternalLeading, TRUE);
            SetDlgItemInt (hwnd, TMD_AVEWIDTH, (int)tm.tmAveCharWidth, TRUE);
            SetDlgItemInt (hwnd, TMD_MAXWIDTH, (int)tm.tmMaxCharWidth, TRUE);
            SetDlgItemInt (hwnd, TMD_WEIGHT, (int)tm.tmWeight, TRUE);
            SetDlgItemInt (hwnd, TMD_ITALIC, (int)tm.tmItalic, FALSE);
            SetDlgItemInt (hwnd, TMD_UNDERLINE, (int)tm.tmUnderlined, FALSE);
            SetDlgItemInt (hwnd, TMD_STRUCKOUT, (int)tm.tmStruckOut, FALSE);
            SetDlgItemInt (hwnd, TMD_FIRSTCHAR, (int)tm.tmFirstChar, FALSE);
            SetDlgItemInt (hwnd, TMD_LASTCHAR, (int)tm.tmLastChar, FALSE);
            SetDlgItemInt (hwnd, TMD_DEFAULTCHAR, (int)tm.tmDefaultChar, FALSE);
            SetDlgItemInt (hwnd, TMD_BREAKCHAR, (int)tm.tmBreakChar, FALSE);
            SetDlgItemInt (hwnd, TMD_PITCHANDFAMILY, (int)tm.tmPitchAndFamily, FALSE);
            SetDlgItemInt (hwnd, TMD_CHARSET, (int)tm.tmCharSet, FALSE);
            SetDlgItemInt (hwnd, TMD_OVERHANG, (int)tm.tmOverhang, TRUE);
            SetDlgItemInt (hwnd, TMD_DIGITIZEDASPECTX, (int)tm.tmDigitizedAspectX, TRUE);
            SetDlgItemInt (hwnd, TMD_DIGITIZEDASPECTY, (int)tm.tmDigitizedAspectY, TRUE);

            return TRUE;

        case WM_COMMAND:
            wmId = LOWORD(wParam);
            switch (wmId) {
                case IDOK:
                    // Lets pull in as much data from the TEXTMETRIC structure as possible...
                    lfDlg.lfHeight         = tm.tmHeight;
                    lfDlg.lfWidth          = tm.tmAveCharWidth;
                    //lfDlg.lfEscapement - No Use
                    //lfDlg.lfOrientation - No Use
                    lfDlg.lfWeight         = tm.tmWeight;
                    lfDlg.lfItalic         = tm.tmItalic;
                    lfDlg.lfUnderline      = tm.tmUnderlined;
                    lfDlg.lfStrikeOut      = tm.tmStruckOut;
                    lfDlg.lfCharSet        = tm.tmCharSet;
                    //lfDlg.lfOutPrecision - No Use
                    //lfDlg.lfClipPrecision - No Use
                    //lfDlg.lfQuality - No Use
                    lfDlg.lfPitchAndFamily = tm.tmPitchAndFamily;
                    lstrcpyn(lfDlg.lfFaceName, szFacename, LF_FACESIZE);

                    // Lets create a font with this new data
                    hfont = CreateFontIndirect (&lfDlg);
                    hdc = GetDC (hwnd);
                    hfontPrev = SelectObject (hdc, hfont);
                    GetTextMetrics (hdc, &tmTmp);
                    // Get the face name
                    GetTextFace    (hdc, sizeof(szBuffer), szBuffer);
                    SelectObject (hdc, hfontPrev);
                    DeleteObject (hfont);
                    ReleaseDC (hwnd, hdc);

                    // And verify that we did indeed get the same font.
                    bDone = TRUE;
                    bDone = bDone && (tm.tmHeight==tmTmp.tmHeight);
                    bDone = bDone && (tm.tmAscent==tmTmp.tmAscent);
                    bDone = bDone && (tm.tmDescent==tmTmp.tmDescent);
                    bDone = bDone && (tm.tmInternalLeading==tmTmp.tmInternalLeading);
                    bDone = bDone && (tm.tmExternalLeading==tmTmp.tmExternalLeading);
                    bDone = bDone && (tm.tmAveCharWidth==tmTmp.tmAveCharWidth);
                    bDone = bDone && (tm.tmMaxCharWidth==tmTmp.tmMaxCharWidth);
                    bDone = bDone && (tm.tmWeight==tmTmp.tmWeight);
                    bDone = bDone && (tm.tmItalic==tmTmp.tmItalic);
                    bDone = bDone && (tm.tmUnderlined==tmTmp.tmUnderlined);
                    bDone = bDone && (tm.tmStruckOut==tmTmp.tmStruckOut);
                    bDone = bDone && (tm.tmFirstChar==tmTmp.tmFirstChar);
                    bDone = bDone && (tm.tmLastChar==tmTmp.tmLastChar);
                    bDone = bDone && (tm.tmDefaultChar==tmTmp.tmDefaultChar);
                    bDone = bDone && (tm.tmBreakChar==tmTmp.tmBreakChar);
                    bDone = bDone && (tm.tmPitchAndFamily==tmTmp.tmPitchAndFamily);
                    bDone = bDone && (tm.tmCharSet==tmTmp.tmCharSet);
                    // Did it work?
                    if (bDone) {
                        *lplf = lfDlg;
                        EndDialog(hwnd, TRUE);
                        return TRUE;
                    } else {
                        // We need to take a close look at the font verification
                        // code. Currently, it sometimes will report that the
                        // font didn't get properly selected, even if it did.
                        *lplf = lfDlg;
                        EndDialog(hwnd, TRUE);
                        return TRUE;

                        // This is what we want to do once we beef up the font
                        // verification code:
                        //lfDlg = *lplf;
                        //MessageBox (GetFocus(),
                        //    "Unable to re-create font from TextMetrics",
                        //    "FontView", MB_OK);
                    }
                    break;

                case IDCANCEL:
                    EndDialog(hwnd, TRUE);
                    return TRUE;

            }
            break;
    }
    return FALSE;

    /* Just For Reference */
    lParam;
}

void SetDlgItemValue | ( | HWND | hDlg,
 |  | int | nIDDlgItem,
 |  | int | wValue,
 |  | BOOL | bSigned,
 |  | int | nBase
 | ) |  |

Definition at line 44 of file Dialogs.c.

{
    char szValue[32];

    switch (nBase) {
        case 8:
            if (_snprintf (szValue, sizeof(szValue) - 1, "0o%o", wValue) > 0)
            {
                szValue[sizeof(szValue) - 1] = '\0';
                SetDlgItemText (hDlg, nIDDlgItem, szValue);
            }
            break;
        case 16:
            if (_snprintf (szValue, sizeof(szValue) - 1, "0x%x", wValue) > 0 )
            {
                szValue[sizeof(szValue) - 1] = '\0';
                SetDlgItemText (hDlg, nIDDlgItem, szValue);
            }
            break;
        default:
            SetDlgItemInt (hDlg, nIDDlgItem, wValue, bSigned);
            break;
    }
}

BOOL APIENTRY SimpleDlgProc | ( | HWND | hwnd,
 |  | UINT | msg,
 |  | UINT | wParam,
 |  | LONG | lParam
 | ) |  |

Definition at line 141 of file Dialogs.c.

{
    int wmId;
    static HBITMAP hbmFontView;
    static BITMAP bmFontView;
    RECT rect;
    HDC hdc, hdcSrc;
    HBITMAP hbmOld;
    PAINTSTRUCT ps;
    HANDLE hInst;

    hInst = (HANDLE)GetWindowLongPtr (hwnd, GWLP_HINSTANCE);

    switch (msg) {
        case WM_INITDIALOG:
            CenterWindow (hwnd, GetWindow (hwnd, GW_OWNER));
            hbmFontView = LoadBitmap (hInst, "FONTVIEW");
            GetObject (hbmFontView,sizeof(BITMAP), &bmFontView);
            if (!hbmFontView) {
                MessageBeep(0);
            }
            return TRUE;

        case WM_DESTROY:
            DeleteObject (hbmFontView);
            break;

        case WM_PAINT:
            hdc = BeginPaint (hwnd, &ps);
            GetWindowRect (hwnd, &rect);
            ScreenToClient (hwnd, (LPPOINT)&rect.left);
            ScreenToClient (hwnd, (LPPOINT)&rect.right);
            hdc = GetDC (hwnd);
            hdcSrc = CreateCompatibleDC (hdc);
            hbmOld = SelectObject (hdcSrc, hbmFontView);
            if (!BitBlt (hdc, 0, 0, bmFontView.bmWidth, bmFontView.bmHeight, hdcSrc, 0, 0, SRCCOPY)) {
                MessageBeep(0);
            }
            SelectObject (hdcSrc, hbmOld);
            DeleteDC (hdcSrc);
            EndPaint (hwnd, &ps);
            break;

        case WM_COMMAND:
            wmId = LOWORD(wParam);
            switch (wmId) {

                case IDOK:
                    EndDialog(hwnd, TRUE);
                    return TRUE;

                case IDCANCEL:
                    EndDialog(hwnd, TRUE);
                    return TRUE;
            }
            break;
    }
    return FALSE;

    lParam; // unreferenced formal parameter
}

Generated on Wed Nov 13 2024 16:53:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/Fonts/FontView/Display.c File Reference

  • Multimedia
  • Gdi
  • Fonts
  • FontView
Functions | Variables

Display.c File Reference

#include <windows.h>
#include <string.h>
#include <stdio.h>
#include <math.h>

Go to the source code of this file.

Functions

void | CalcRot (double x, double y, double ang, double *x1, double *y1)
BOOL | CircleBlt (HDC hdcDest, int xDst, int yDst, int iWidthDst, int iHeightDst, HDC hdcSrc, int xSrc, int ySrc, int iWidthSrc, int iHeightSrc, DWORD dwROP)
void | DrawAscii (HDC hdc, RECT *pRect, WORD direction)
void | DrawGlyph (HDC hdc, RECT *pRect, BYTE glyph, HFONT hfont)
BYTE | FindChar (HDC hdc, RECT *pRect, int x, int y)
double | Radian (double ang)

Variables

char | ascii []

Function Documentation

void CalcRot | ( | double | x,
 |  | double | y,
 |  | double | ang,
 |  | double * | x1,
 |  | double * | y1
 | ) |  |

Definition at line 215 of file Display.c.

{
        ang = Radian(-ang);
        *x1 = (x * cos(ang)) - (y * sin(ang));
        *y1 = (x * sin(ang)) + (y * cos(ang));
}

BOOL CircleBlt | ( | HDC | hdcDest,
 |  | int | xDst,
 |  | int | yDst,
 |  | int | iWidthDst,
 |  | int | iHeightDst,
 |  | HDC | hdcSrc,
 |  | int | xSrc,
 |  | int | ySrc,
 |  | int | iWidthSrc,
 |  | int | iHeightSrc,
 |  | DWORD | dwROP
 | ) |  |

Definition at line 170 of file Display.c.

{
    int x, y, x1, y1, x2, y2;
    DWORD rgb;
    float fXUnit, fYUnit;
    HBRUSH hbrush, hbrushOld;

    if (iWidthSrc != 0){
        fXUnit = (float)iWidthDst / (float)iWidthSrc;
    } else {
        fXUnit = (float)iWidthDst;
    }
    if (iHeightSrc != 0) {
        fYUnit = (float)iHeightDst / (float)iHeightSrc;
    } else {
        fYUnit = (float)iHeightDst;
    }

    for (y=ySrc; y<(ySrc+iHeightSrc); y++) {
        for (x=xSrc; x<(xSrc+iWidthSrc); x++) {

            rgb = GetPixel (hdcSrc, x, y);
            if (rgb != -1 && rgb != 0x00FFFFFF) {
                hbrush = CreateSolidBrush (rgb);
                hbrushOld = SelectObject (hdcDest, hbrush);
                x1 = xDst + (int)((x-xSrc)*fXUnit);
                y1 = yDst + (int)((y-ySrc)*fYUnit);
                x2 = xDst + (int)(((x-xSrc)+1)*fXUnit)+1;
                y2 = yDst + (int)(((y-ySrc)+1)*fYUnit)+1;
                Ellipse (hdcDest, x1, y1, x2, y2);
                DeleteObject(SelectObject(hdcDest, hbrushOld));
            }
        }
    }

    return TRUE;

    dwROP;
}

void DrawAscii | ( | HDC | hdc,
 |  | RECT * | pRect,
 |  | WORD | direction
 | ) |  |

Definition at line 69 of file Display.c.

{
    BYTE *pch;
    int h, w, incx, incy, width;
    unsigned int  wDisplay;
    POINT pt;
    TEXTMETRIC tm;

    GetTextMetrics (hdc, &tm);
    h = tm.tmHeight;
    w = tm.tmMaxCharWidth;

    incx = 0;
    incy = h;
    pt.x = 0;
    pt.y = 0;

    //
    pt.y = tm.tmAscent + tm.tmExternalLeading;
    //

    pch = (BYTE*)&(ascii[tm.tmFirstChar]);

    if (!pRect)     // check pRect validity
    {
        return;
    }

    wDisplay = pRect->right -pRect->left;

    //
    SetTextAlign (hdc, TA_BASELINE | TA_CENTER);
    SetBkMode (hdc, TRANSPARENT);
    //

    while (pch[0] && (pch[0]<=tm.tmLastChar)) {
        SIZE size;
        GetTextExtentPoint (hdc, (LPCTSTR)pch, 1, &size);
        width = size.cx;
        if ((unsigned)(pt.x + width) > wDisplay) {
            pt.x = 0;
            pt.y += incy;
        }
        TextOut (hdc, pt.x + (width/2), pt.y, (LPCTSTR)pch, 1);
        pt.x += width;
        pch++;
    }
    return;

    direction;
}

void DrawGlyph | ( | HDC | hdc,
 |  | RECT * | pRect,
 |  | BYTE | glyph,
 |  | HFONT | hfont
 | ) |  |

Definition at line 222 of file Display.c.

{
    TEXTMETRIC tm;
    LOGFONT lf;
    int wChar, h1, h2, w1, w2, x, y;
    double xTL, yTL, xTR, yTR, xBL, yBL, xBR, yBR, xML, yML, xMR, yMR;
    int cWidth, cExtentW, cExtentH;
    int unit, margin;
    RECT rect, rectChar;
    HDC hdcMem;
    HBITMAP hbitmap, hbitmapOld;
    HFONT hfontOld, hfontTmp;
    char szText[80];
    double fAng, fWa, fWb, fHa, fHb, fHeight, fWidth;
    BOOL bRotateable;
    double fxOff, fyOff;
#if defined(TT_AVAILABLE)
    ABC abc;
#endif

    GetTextMetrics (hdc, &tm);
    hfontTmp = SelectObject (hdc, GetStockObject(SYSTEM_FONT));
    GetObject (hfontTmp, sizeof(LOGFONT), &lf);

// Some fields of 'lf' need to be whacked out depending on the type of
// font involved. For instance, lfEscapement should only be non-zero for
// rotatable fonts.
        bRotateable = FALSE;
#if defined (TMPF_VECTOR)
        bRotateable = (tm.tmPitchAndFamily & TMPF_VECTOR);
#endif
#if defined (TMPF_TRUETYPE)
        bRotateable |= (tm.tmPitchAndFamily & TMPF_TRUETYPE);
#endif
        if (!bRotateable) {
                lf.lfEscapement = 0;
        }

    SelectObject (hdc, hfontTmp);
    GetCharWidth (hdc, glyph, glyph, &cWidth);

    {
        SIZE size;
        GetTextExtentPoint (hdc, (LPSTR)&glyph, 1, &size);
        cExtentW = size.cx;
        cExtentH = size.cy;
    }

    wChar = max(cWidth, cExtentW);

#if defined(TT_AVAILABLE)
    if (GetCharABCWidths (hdc, (UINT)glyph, (UINT)glyph, &abc)) {
        wChar = abc.abcA + abc.abcB + abc.abcC;
        wChar = max(abc.abcA,0) + max (abc.abcB,0) + max (abc.abcC,0);
    } else {
        abc.abcA = 0;
        abc.abcB = wChar;
        abc.abcC = 0;
    }
#endif

// ****
        // Lets figure out how large of a bitmap we need to draw this character into.
        // This will take lfEscapement into account.

        // Turn the 'escapement' value into a valid angle
    fAng = 90.0 - ((double)lf.lfEscapement/10.0);

    // We now need to calculate two values for height and width. These
    // represent the bases of the triangles that are formed as the
    // character cell rotates. Thus fWa+fWb is the 'width' of the space
    // required by the given character at the current rotation.
    // At 0, 90, 180, 270 and 360, one of the two values will be '0'.
    fWa = (double)cExtentW * sin(Radian(fAng));
    fHa = (double)cExtentW * sin(Radian((double)lf.lfEscapement/10.0));
    fHb = (double)cExtentH * sin(Radian(fAng));
    fWb = (double)cExtentH * sin(Radian((double)lf.lfEscapement/10.0));

    // This gives us a width/height of:
    fHeight = fabs(fHa) + fabs(fHb);
    fWidth = fabs(fWa) + fabs(fWb);
// ****

    if (!pRect) //check for pRect validity
    {
        return;
    }

    h1 = pRect->bottom - pRect->top;
    h2 = tm.tmHeight + tm.tmExternalLeading;
    h2 = (int)fHeight;
    if (h2 == 0) {
        MessageBeep (0);
        h2 = 10;
    }

    w1 = pRect->right - pRect->left;
    w2 = (int)fWidth;

    unit = (h1 / h2);

    margin = (h1 - (unit * h2)) / 2;
    margin = 0;
    // Define a rectangle that will enclose our drawing area
    SetRect (&rect, 0, 0, wChar*unit, (tm.tmHeight*unit) + (tm.tmExternalLeading*unit));
    OffsetRect (&rect, margin, margin);
    // Define a rectangle that will define the bounding box of the character
    SetRect (&rectChar, 0, 0, wChar*unit, tm.tmHeight*unit);
    OffsetRect (&rectChar, margin, margin + (tm.tmExternalLeading*unit));

// ****
    // These are floating point values.
    SetRect (&rect, 0, 0, (int)(fWidth)*unit, ((int)(fHeight)*unit) + (tm.tmExternalLeading*unit));
    OffsetRect (&rect, margin, margin);
    // Define a rectangle that will define the bounding box of the character
    SetRect (&rectChar, 0, 0, (int)(fWidth)*unit, ((int)(fHeight)*unit));
    OffsetRect (&rectChar, margin, margin + (tm.tmExternalLeading*unit));

    // Calculate the points of the 'character cell'. This will take full
    // rotation into consideration.
        CalcRot (0, 0, (double)lf.lfEscapement/10.0, &xTL, &yTL);
        CalcRot ((double)cExtentW, 0, (double)lf.lfEscapement/10.0, &xTR, &yTR);
        CalcRot (0, (double)cExtentH, (double)lf.lfEscapement/10.0, &xBL, &yBL);
        CalcRot ((double)cExtentW, (double)cExtentH, (double)lf.lfEscapement/10.0, &xBR, &yBR);
        CalcRot (0, (double)tm.tmAscent, (double)lf.lfEscapement/10.0, &xML, &yML);
        CalcRot ((double)cExtentW, (double)tm.tmAscent, (double)lf.lfEscapement/10.0, &xMR, &yMR);

        fxOff = min(xTL, min(xTR, min(xBL, xBR)));
        fyOff = min(yTL, min(yTR, min(yBL, yBR)));

// Draw a rectangle around the drawing limits of the character.
    MoveToEx (hdc, (int)((xTL-fxOff)*(double)unit), (int)((yTL-fyOff)*(double)unit), NULL);
    LineTo (hdc, (int)((xTR-fxOff)*(double)unit), (int)((yTR-fyOff)*(double)unit));
    LineTo (hdc, (int)((xBR-fxOff)*(double)unit), (int)((yBR-fyOff)*(double)unit));
    LineTo (hdc, (int)((xBL-fxOff)*(double)unit), (int)((yBL-fyOff)*(double)unit));
    LineTo (hdc, (int)((xTL-fxOff)*(double)unit), (int)((yTL-fyOff)*(double)unit));

// Draw the baseline, which indicates the advance width of the character
    MoveToEx (hdc, (int)((xML-fxOff)*(double)unit), (int)((yML-fyOff)*(double)unit), NULL);
    LineTo (hdc, (int)((xMR-fxOff)*(double)unit), (int)((yMR-fyOff)*(double)unit));

    hdcMem = CreateCompatibleDC (hdc);
    if (hdcMem) {
        hbitmap = CreateCompatibleBitmap (hdc, (int)(fWidth), (int)(fHeight));
        if (hbitmap) {
            hbitmapOld = SelectObject (hdcMem, hbitmap);
            BitBlt (hdcMem, 0, 0, (int)(fWidth), (int)(fHeight), NULL, 0, 0, WHITENESS);
            hfontOld = SelectObject (hdcMem, hfont);

            SetTextAlign (hdcMem, TA_LEFT | TA_BASELINE);
            if (TextOut (hdcMem, (int)(xML-fxOff), (int)(yML-fyOff), (LPSTR)&glyph, 1)) {

                                /*
                // Just for debugging, lets mark some special pixels
                        SetPixel (hdcMem, (int)(xML-fxOff), (int)(yML-fyOff), 0x808080); // Base Lft
                        SetPixel (hdcMem, (int)(xTL-fxOff), (int)(yTL-fyOff), 0x808080); // Top Left
                        SetPixel (hdcMem, (int)(xTR-fxOff), (int)(yTR-fyOff), 0x808080); // Top Right
                        SetPixel (hdcMem, (int)(xBL-fxOff), (int)(yBL-fyOff), 0x808080); // Btm Left
                        SetPixel (hdcMem, (int)(xBR-fxOff), (int)(yBR-fyOff), 0x808080); // Btm Right
                        SetPixel (hdcMem, (int)(xML-fxOff), (int)(yML-fyOff), 0x808080); // Base Lft
                        SetPixel (hdcMem, (int)(xMR-fxOff), (int)(yMR-fyOff), 0x808080); // Base Rt
                */

                CircleBlt(hdc, margin, margin,
                    rectChar.right-rectChar.left, rectChar.bottom-rectChar.top,
                    hdcMem, 0, 0, (int)(fWidth), (int)(fHeight), SRCPAINT);

            } else {
                MessageBox (GetFocus(),
                        "Unable to perform TextOut", "DisplayGlyph", MB_OK);
            }
            SelectObject (hdcMem, hbitmapOld);
            SelectObject (hdcMem, hfontOld);
            DeleteObject (hbitmap);
        } else {
            MessageBox (GetFocus(), "Unable To create Bitmap", "DisplayGlyph", MB_OK);
        }
        DeleteDC (hdcMem);
    } else {
        MessageBox (GetFocus(), "Unable to create DC", "DisplayGlyph", MB_OK);
    }

    hfontTmp = CreateFont(14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, VARIABLE_PITCH | FF_SWISS, "");

    if (hfontTmp) {
        hfontOld = SelectObject (hdc, hfontTmp);
        x = rect.right + 10;
        GetTextMetrics (hdc, &tm);

        y = tm.tmHeight + tm.tmExternalLeading;

        y += tm.tmHeight + tm.tmExternalLeading;
        _snprintf (szText, sizeof(szText) - 1, "Character = '%c' %u (0x%X)", (char)glyph, (int)glyph, (int)glyph);
        szText[sizeof(szText) - 1] = '\0';
        TextOut (hdc, x, y, szText, lstrlen(szText));

        y += tm.tmHeight + tm.tmExternalLeading;
        _snprintf (szText, sizeof(szText) - 1, "CharWidth = %i", cWidth);
        szText[sizeof(szText) - 1] = '\0';
        TextOut (hdc, x, y, szText, lstrlen(szText));

                // ABC Width - Eventually, I want to 'draw' this into the character
                // cell, but for now, this at least makes the information easily
                // available:
#if defined (TT_AVAILABLE)
        y += tm.tmHeight + tm.tmExternalLeading;
        _snprintf (szText, sizeof(szText) - 1, "A|B|C = %i | %u | %i", abc.abcA, abc.abcB, abc.abcC);
        szText[sizeof(szText) - 1] = '\0';
        TextOut (hdc, x, y, szText, lstrlen(szText));
#endif

        y += tm.tmHeight + tm.tmExternalLeading;
        _snprintf (szText, sizeof(szText) - 1, "CharExtentW = %i", cExtentW);
        szText[sizeof(szText) - 1] = '\0';
        TextOut (hdc, x, y, szText, lstrlen(szText));

        y += tm.tmHeight + tm.tmExternalLeading;
        _snprintf (szText, sizeof(szText) - 1, "CharExtentH = %i", cExtentH);
        szText[sizeof(szText) - 1] = '\0';
        TextOut (hdc, x, y, szText, lstrlen(szText));

                // These are for some values I was using to debug the character
                // cell rotation calculation:

        //y += tm.tmHeight + tm.tmExternalLeading;
        //wsprintf (szText, "(%i,%i) : (%i,%i) [%i]", (int)xTL, (int)yTL, (int)xTR, (int)yTR,(int)(((double)lf.lfEscapement/10.0)*10));
        //TextOut (hdc, x, y, szText, lstrlen(szText));

        //y += tm.tmHeight + tm.tmExternalLeading;
        //wsprintf (szText, "(%i,%i) : (%i,%i)", (int)xML, (int)yML, (int)xMR, (int)yMR);
        //TextOut (hdc, x, y, szText, lstrlen(szText));

        //y += tm.tmHeight + tm.tmExternalLeading;
        //wsprintf (szText, "(%i,%i) : (%i,%i)", (int)xBL, (int)yBL, (int)xBR, (int)yBR);
        //TextOut (hdc, x, y, szText, lstrlen(szText));

        //y += tm.tmHeight + tm.tmExternalLeading;
        //wsprintf (szText, "fAng = %i", (int)(fAng));
        //TextOut (hdc, x, y, szText, lstrlen(szText));

        //y += tm.tmHeight + tm.tmExternalLeading;
        //wsprintf (szText, "fHa = %i", (int)(fHa));
        //TextOut (hdc, x, y, szText, lstrlen(szText));

        //y += tm.tmHeight + tm.tmExternalLeading;
        //wsprintf (szText, "fHb = %i", (int)(fHb));
        //TextOut (hdc, x, y, szText, lstrlen(szText));

        //y += tm.tmHeight + tm.tmExternalLeading;
        //wsprintf (szText, "fWa = %i", (int)(fWa));
        //TextOut (hdc, x, y, szText, lstrlen(szText));

        //y += tm.tmHeight + tm.tmExternalLeading;
        //wsprintf (szText, "fWb = %i", (int)(fWb));
        //TextOut (hdc, x, y, szText, lstrlen(szText));

        //y += tm.tmHeight + tm.tmExternalLeading;
        //wsprintf (szText, "fWd = %i", (int)(fWd));
        //TextOut (hdc, x, y, szText, lstrlen(szText));

        //y += tm.tmHeight + tm.tmExternalLeading;
        //wsprintf (szText, "fHd = %i", (int)(fHd));
        //TextOut (hdc, x, y, szText, lstrlen(szText));

        //y += tm.tmHeight + tm.tmExternalLeading;
        //wsprintf (szText, "fHeight = %i", (int)(fHeight));
        //TextOut (hdc, x, y, szText, lstrlen(szText));

        //y += tm.tmHeight + tm.tmExternalLeading;
        //wsprintf (szText, "fWidth = %i", (int)(fWidth));
        //TextOut (hdc, x, y, szText, lstrlen(szText));

        SelectObject (hdc, hfontOld);
        DeleteObject (hfontTmp);
    }
}

BYTE FindChar | ( | HDC | hdc,
 |  | RECT * | pRect,
 |  | int | x,
 |  | int | y
 | ) |  |

Definition at line 125 of file Display.c.

{
    BYTE *pch;
    int h, w, incx, incy, width;
    unsigned int wDisplay;
    POINT pt;
    TEXTMETRIC tm;

    GetTextMetrics (hdc, &tm);
    h = tm.tmHeight;
    w = tm.tmMaxCharWidth;

    incx = 0;
    incy = h;
    pt.x = 0;
    pt.y = 0;

    pch = (BYTE*)&(ascii[tm.tmFirstChar]);

    if (!pRect)
    {
        return 0xFF;
    }

    wDisplay = pRect->right -pRect->left;

    while (pch[0] && (pch[0]<=tm.tmLastChar)) {
    SIZE size;
        GetTextExtentPoint (hdc, (LPCTSTR)pch, 1, &size);
        width = size.cx;
        if ((unsigned)(pt.x + width) > wDisplay) {
            pt.x = 0;
            pt.y += incy;
        }
        if ((x>=pt.x) && (x <=(pt.x+width)) && (y>=pt.y) && (y<=pt.y+incy)) {
            return pch[0];
        }
        pt.x += width;
        pch++;
    }
    return 0;
}

double Radian ( double ang )

Definition at line 210 of file Display.c.

{
        return ang * (double)3.1415926535 / (double)180.0;
}

Variable Documentation

char ascii[]

Definition at line 24 of file Display.c.

Generated on Wed Nov 13 2024 16:53:37 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/Fonts/FontView/FontView.c File Reference

  • Multimedia
  • Gdi
  • Fonts
  • FontView
Defines | Functions | Variables

FontView.c File Reference

#include <windows.h>
#include <stdio.h>
#include "FontView.H"
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

Go to the source code of this file.

Defines

#define | HOUR (datetime->tm_hour)
#define | MIN (datetime->tm_min)
#define | NOMINMAX
#define | SEC (datetime->tm_sec)

Functions

HWND | AddStatusField (HANDLE, int, int, int, BOOL)
HWND | AddToolButton (HANDLE, int, LPSTR, int, int, DWORD)
HWND | AddToolCombo (HANDLE, int, int, DWORD)
HWND | AddToolLabel (HANDLE, int, LPSTR, int, DWORD)
BOOL | AddToolSpace (int, int)
BOOL | AdjustStatusBar (HWND)
BOOL | AdjustToolBar (HWND)
BOOL | CenterWindow (HWND hwndChild, HWND hwndParent)
LONG_PTR APIENTRY | ClientCharSetProc (HWND, UINT, WPARAM, LPARAM)
LONG_PTR APIENTRY | ClientGlyphProc (HWND, UINT, WPARAM, LPARAM)
LONG_PTR APIENTRY | ClientProc (HWND, UINT, WPARAM, LPARAM)
BOOL APIENTRY | CreateDlgProc (HWND, UINT, WPARAM, LPARAM)
BOOL | CreateStatusBar (HWND, HANDLE, int)
BOOL | CreateToolBar (HWND, HANDLE, int)
void | DrawAscii (HDC hdc, RECT *pRect, WORD direction)
void | DrawGlyph (HDC hdc, RECT *pRect, BYTE glyph, HFONT hfont)
BOOL APIENTRY | EnumDlgProc (HWND, UINT, WPARAM, LPARAM)
int FAR PASCAL | EnumFontNames (LPLOGFONT, LPTEXTMETRIC, DWORD, LPARAM)
BOOL | FillInParam (HWND, int)
BOOL | FillInValue (HWND, int)
BYTE | FindChar (HDC hdc, RECT *pRect, int x, int y)
BOOL InitStatusBar (HANDLE)
BOOL InitToolBar (HANDLE)
BOOL APIENTRY | MetricsDlgProc (HWND, UINT, WPARAM, LPARAM)
BOOL APIENTRY | SimpleDlgProc (HWND, UINT, WPARAM, LPARAM)
int | StatusBarHeight (HWND)
int | ToolBarHeight (HWND)
int APIENTRY | WinMain (HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow)
LONG_PTR APIENTRY | WndProc (HWND, UINT, WPARAM, LPARAM)

Variables

BOOL | bZoomed = FALSE
WNDPROC | fpCharSetProc = 0
WNDPROC | fpGlyphProc = 0
HMENU | hEditMenu = (HMENU)NULL
HMENU | hFileMenu = (HMENU)NULL
HMENU | hHelpMenu = (HMENU)NULL
HMENU | hMenu = (HMENU)NULL
HMENU | hMetricsMenu = (HMENU)NULL
HMENU | hSysMenuAdv = (HMENU)NULL
HMENU | hSysMenuMain = (HMENU)NULL
HMENU | hViewMenu = (HMENU)NULL
HWND | hwndClient
HWND | hwndCreateParam
HWND | hwndCreateValue
HWND | hwndLabel1
HWND | hwndMain
HWND | hwndMenuField
HWND | hwndTimeField
HWND | hwndZoom
LOGFONT | lf = {0,0,0,0,0,0,0,0,0,0,0,0,0,""}
char | szAppName [] = "FontView"
char | szAppTitle [] = "FontView - A Font Examination Utility"

Define Documentation

#define HOUR (datetime->tm_hour)
#define MIN (datetime->tm_min)
#define NOMINMAX

Definition at line 12 of file FontView.c.

#define SEC (datetime->tm_sec)

Function Documentation

HWND AddStatusField | ( | HANDLE | ,
 |  | int | ,
 |  | int | ,
 |  | int | ,
 |  | BOOL |
 | ) |  |

Definition at line 113 of file Status.c.

{
    LONG lStyle;

    if (cntStatusField >= MAXSTATUS) return (HWND)0; // No room left in our fixed array

    statusField[cntStatusField].hwnd = CreateWindow ("StatusField", "",
        WS_CHILD | WS_VISIBLE,
        0, 0, 0, 0,
        hwndStatus, (HMENU)(INT_PTR)iId, hInst, NULL);

    if (!statusField[cntStatusField].hwnd) return (HWND)0; // CreateWindow failed for some reason

    if (iMin < 0) {
    statusField[cntStatusField].iMinWidth = tmStatusFont.tmAveCharWidth*abs(iMin);
    } else {
    statusField[cntStatusField].iMinWidth = iMin;
    }

    if (iMax < 0) {
    statusField[cntStatusField].iMaxWidth = tmStatusFont.tmAveCharWidth*abs(iMax);
    } else {
    statusField[cntStatusField].iMaxWidth = iMax;
    }

    if (bNewGroup) {
        lStyle = (LONG)GetWindowLongPtr (statusField[cntStatusField].hwnd, GWL_STYLE);
        lStyle |= WS_GROUP;
        SetWindowLongPtr (statusField[cntStatusField].hwnd, GWL_STYLE, lStyle);
    }

    return statusField[cntStatusField++].hwnd;
}

HWND AddToolButton | ( | HANDLE | ,
 |  | int | ,
 |  | LPSTR | ,
 |  | int | ,
 |  | int | ,
 |  | DWORD |
 | ) |  |

Definition at line 272 of file Tools.c.

{
        HDC hdc;

        if (cntToolCtrls >= MAXCTRLS) return (HWND)0; // No room left in our fixed array

        if (dwStyle == 0) dwStyle = BS_PUSHBUTTON;
        toolCtrl[cntToolCtrls].hwnd = CreateWindow ("BUTTON", szLabel,
                WS_CHILD | WS_VISIBLE | dwStyle,
                0, 0, 0, 0,
                hwndTools, (HMENU)(INT_PTR)iId, hInst, NULL);

        if (!toolCtrl[cntToolCtrls].hwnd) return (HWND)0; // CreateWindow failed for some reason

        SendMessage (toolCtrl[cntToolCtrls].hwnd, WM_SETFONT, (UINT_PTR)hfontTools, MAKELONG (TRUE, 0));
        toolCtrl[cntToolCtrls].wType = TC_BUTTON;

        hdc = GetDC (hwndTools);
        SelectObject (hdc, hfontTools);
        if (iWidth < 0) {
                toolCtrl[cntToolCtrls].iWidth = tmToolFont.tmAveCharWidth * abs(iWidth);
                toolCtrl[cntToolCtrls].iWidth += (6*cxToolBorder);
        } else if (iWidth == 0) {
                SIZE size;
                GetTextExtentPoint (hdc, szLabel, lstrlen(szLabel), &size);
                toolCtrl[cntToolCtrls].iWidth = size.cx;
                toolCtrl[cntToolCtrls].iWidth += (6*cxToolBorder);
        } else {
                toolCtrl[cntToolCtrls].iWidth = iWidth;
        }
        if (iHeight < 0) {
                toolCtrl[cntToolCtrls].iHeight = tmToolFont.tmHeight;
                toolCtrl[cntToolCtrls].iHeight += (6*cyToolBorder);
        } else if (iHeight==0) {
                toolCtrl[cntToolCtrls].iHeight = dyTools - (6*cyToolBorder);
        } else {
                toolCtrl[cntToolCtrls].iHeight = iHeight;
        }

        if ((toolCtrl[cntToolCtrls].iHeight + (6*cyToolBorder)) > dyTools) {
                dyTools = (toolCtrl[cntToolCtrls].iHeight + (6*cyToolBorder));
        }

        if (dwStyle & BS_OWNERDRAW) {
                toolCtrl[cntToolCtrls].hIcon = LoadIcon (hInst, szLabel);
        } else {
                toolCtrl[cntToolCtrls].hIcon = NULL;
        }

        ReleaseDC (hwndTools, hdc);
        UpdatePositions();
        return toolCtrl[cntToolCtrls++].hwnd;
}

HWND AddToolCombo | ( | HANDLE | ,
 |  | int | ,
 |  | int | ,
 |  | DWORD |
 | ) |  |

Definition at line 238 of file Tools.c.

{

        if (cntToolCtrls >= MAXCTRLS) return (HWND)0; // No room left in our fixed array

        if (dwStyle==0) dwStyle = CBS_DROPDOWNLIST;
        toolCtrl[cntToolCtrls].hwnd = CreateWindow ("COMBOBOX", "",
                WS_CHILD | WS_VISIBLE | dwStyle,
                0, 0, 0, 0,
                hwndTools, (HMENU)(INT_PTR)iId, hInst, NULL);

        if (!toolCtrl[cntToolCtrls].hwnd) return (HWND)0; // CreateWindow failed for some reason

        SendMessage (toolCtrl[cntToolCtrls].hwnd, WM_SETFONT, (UINT_PTR)hfontTools, MAKELONG (TRUE, 0));
        toolCtrl[cntToolCtrls].wType = TC_COMBO;

        if (iWidth < 0) {
                toolCtrl[cntToolCtrls].iWidth = tmToolFont.tmAveCharWidth * abs(iWidth);
        } else if (iWidth == 0) {
                toolCtrl[cntToolCtrls].iWidth = tmToolFont.tmAveCharWidth * 15; // just a default width
        } else {
                toolCtrl[cntToolCtrls].iWidth = iWidth;
        }
        toolCtrl[cntToolCtrls].iHeight = dyCombo;

        if ((toolCtrl[cntToolCtrls].iHeight + (6*cyToolBorder)) > dyTools) {
                dyTools = (toolCtrl[cntToolCtrls].iHeight + (6*cyToolBorder));
        }

        UpdatePositions();
        return toolCtrl[cntToolCtrls++].hwnd;
}

HWND AddToolLabel | ( | HANDLE | ,
 |  | int | ,
 |  | LPSTR | ,
 |  | int | ,
 |  | DWORD |
 | ) |  |

Definition at line 201 of file Tools.c.

{
        HDC hdc;

        if (cntToolCtrls >= MAXCTRLS) return (HWND)0; // No room left in our fixed array

        toolCtrl[cntToolCtrls].hwnd = CreateWindow ("STATIC", szLabel,
                WS_CHILD | WS_VISIBLE | dwStyle,
                0, 0, 0, 0,
                hwndTools, (HMENU)(INT_PTR)iId, hInst, NULL);

        if (!toolCtrl[cntToolCtrls].hwnd) return (HWND)0; // CreateWindow failed for some reason

        SendMessage (toolCtrl[cntToolCtrls].hwnd, WM_SETFONT, (UINT_PTR)hfontTools, (LONG_PTR)MAKELONG (TRUE, 0));
        toolCtrl[cntToolCtrls].wType = TC_LABEL;

        hdc = GetDC (hwndTools);
        if (iWidth < 0) {
                toolCtrl[cntToolCtrls].iWidth = tmToolFont.tmAveCharWidth * abs(iWidth);
        } else if (iWidth == 0) {
                SIZE size;
                GetTextExtentPoint (hdc, szLabel, lstrlen(szLabel), &size);
                toolCtrl[cntToolCtrls].iWidth = size.cx;
        } else {
                toolCtrl[cntToolCtrls].iWidth = iWidth;
        }
        toolCtrl[cntToolCtrls].iHeight = tmToolFont.tmHeight;

        if ((toolCtrl[cntToolCtrls].iHeight + (6*cyToolBorder)) > dyTools) {
                dyTools = (toolCtrl[cntToolCtrls].iHeight + (6*cyToolBorder));
        }

        ReleaseDC (hwndTools, hdc);
        UpdatePositions();
        return toolCtrl[cntToolCtrls++].hwnd;
}

BOOL AddToolSpace | ( | int | ,
 |  | int |
 | ) |  |

Definition at line 186 of file Tools.c.

{
        if (cntToolCtrls >= MAXCTRLS) return FALSE;
        toolCtrl[cntToolCtrls].hwnd = 0;
        toolCtrl[cntToolCtrls].wType = TC_SPACE;
        toolCtrl[cntToolCtrls].iWidth = iWidth;
        toolCtrl[cntToolCtrls].iHeight = iHeight;
        if ((toolCtrl[cntToolCtrls].iHeight + (6*cyToolBorder)) > dyTools) {
                dyTools = (toolCtrl[cntToolCtrls].iHeight + (6*cyToolBorder));
        }
        UpdatePositions();
        cntToolCtrls++;
        return TRUE;
}

BOOL AdjustStatusBar ( HWND )

Definition at line 100 of file Status.c.

{
    RECT rect;
    GetClientRect (hwnd, &rect);
    MoveWindow (hwndStatus,
        rect.left-cxStatusBorder,
        rect.bottom - dyStatus + cyStatusBorder,
        rect.right - rect.left + (cxStatusBorder*2),
        dyStatus,
    TRUE);
    return TRUE;
}

BOOL AdjustToolBar ( HWND )

Definition at line 128 of file Tools.c.

{
        RECT rect;

        GetClientRect (hwnd, &rect);
        MoveWindow (hwndTools,
                rect.left-cxToolBorder,
                rect.top - cyToolBorder,
                rect.right - rect.left + (cxToolBorder*2),
                dyTools,
                TRUE);
        return TRUE;
}

BOOL CenterWindow | ( | HWND | hwndChild,
 |  | HWND | hwndParent
 | ) |  |

Definition at line 635 of file FontView.c.

{
    RECT    rChild, rParent;
    int     wChild, hChild, wParent, hParent;
    int     wScreen, hScreen, xNew, yNew;
    HDC     hdc;

    GetWindowRect (hwndChild, &rChild);
    wChild = rChild.right - rChild.left;
    hChild = rChild.bottom - rChild.top;

    GetWindowRect (hwndParent, &rParent);
    wParent = rParent.right - rParent.left;
    hParent = rParent.bottom - rParent.top;

    hdc = GetDC (hwndChild);
    wScreen = GetDeviceCaps (hdc, HORZRES);
    hScreen = GetDeviceCaps (hdc, VERTRES);
    ReleaseDC (hwndChild, hdc);

    xNew = rParent.left + ((wParent - wChild) /2);
    if (xNew < 0) {
        xNew = 0;
    } else if ((xNew+wChild) > wScreen) {
        xNew = wScreen - wChild;
    }

    yNew = rParent.top  + ((hParent - hChild) /2);
    if (yNew < 0) {
        yNew = 0;
    } else if ((yNew+hChild) > hScreen) {
        yNew = hScreen - hChild;
    }

    return SetWindowPos (hwndChild, NULL, xNew, yNew, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
}

LONG_PTR APIENTRY ClientCharSetProc | ( | HWND | hwnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 1148 of file FontView.c.

{
    HINSTANCE hInst;
    PAINTSTRUCT ps;
    HFONT hfont, hfontPrev;
    RECT rect;
    HDC hdc;
    int x, y;
    BYTE glyph;

        if (hwnd) {
        hInst = (HINSTANCE)GetWindowLongPtr (hwnd, GWLP_HINSTANCE);
        }
    switch (msg) {
        case WM_PAINT:
            hdc = BeginPaint (hwnd, &ps);
            hfont = CreateFontIndirect (&lf);
            hfontPrev = SelectObject (hdc, hfont);
            GetClientRect (hwnd, &rect);
            DrawAscii (hdc, &rect, 0);
            SelectObject (hdc, hfontPrev);
            DeleteObject (hfont);
            EndPaint (hwnd, &ps);
            break;

        case WM_LBUTTONDBLCLK:
            x = LOWORD(lParam);
            y = HIWORD(lParam);
            //OutputDebugString ("WM_LBUTTONDOWN\n\r");
            hdc = GetWindowDC (hwnd);
            hfont = CreateFontIndirect (&lf);
            hfontPrev = SelectObject (hdc, hfont);
            GetClientRect (hwnd, &rect);

            glyph = FindChar (hdc, &rect, x, y);
            if (glyph) {
                SetWindowLongPtr (hwndClient, GWLP_WNDPROC, (LONG_PTR)fpGlyphProc);
                bZoomed = TRUE;
                SendMessage (hwndClient, WM_USER, (UINT)glyph, 0);
                InvalidateRect (hwndClient, NULL, TRUE);
            }

            SelectObject (hdc, hfontPrev);
            DeleteObject (hfont);
            ReleaseDC (hwnd, hdc);
            break;

        default:
            return DefWindowProc (hwnd, msg, wParam, lParam);
    }
    return 0L;
}

LONG_PTR APIENTRY ClientGlyphProc | ( | HWND | hwnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 1202 of file FontView.c.

{
    HINSTANCE hInst;
    PAINTSTRUCT ps;
    HFONT hfont, hfontPrev;
    RECT rect;
    HDC hdc;
    TEXTMETRIC tm;
    static BYTE glyph = 'A';

        if (hwnd) {
        hInst = (HINSTANCE)GetWindowLongPtr (hwnd, GWLP_HINSTANCE);
        }

    switch (msg) {
        case WM_LBUTTONDBLCLK:
        case WM_LBUTTONDOWN:
            glyph--;
            InvalidateRect (hwnd, NULL, TRUE);
            break;

        case WM_RBUTTONDBLCLK:
        case WM_RBUTTONDOWN:
            glyph++;
            InvalidateRect (hwnd, NULL, TRUE);
            break;

        case WM_USER:
            glyph = (BYTE)wParam;
            break;

        case WM_PAINT:
            hdc = BeginPaint (hwnd, &ps);
            hfont = CreateFontIndirect (&lf);
            hfontPrev = SelectObject (hdc, hfont);
            GetClientRect (hwnd, &rect);

            GetTextMetrics (hdc, &tm);
            if (glyph < tm.tmFirstChar) {
                MessageBeep (0);
                glyph = tm.tmFirstChar;
            }
            if (glyph > tm.tmLastChar) {
                MessageBeep(0);
                glyph = tm.tmLastChar;
            }

            DrawGlyph (hdc, &rect, glyph, hfont);
            SelectObject (hdc, hfontPrev);
            DeleteObject (hfont);
            EndPaint (hwnd, &ps);
            break;

        default:
            return DefWindowProc (hwnd, msg, wParam, lParam);
    }
    return 0L;
}

LONG_PTR APIENTRY ClientProc | ( | HWND | hwnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 1139 of file FontView.c.

{
    switch (msg) {
        default:
            return DefWindowProc (hwnd, msg, wParam, lParam);
    }
}

BOOL APIENTRY CreateDlgProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 209 of file Dialogs.c.

{
    int wmId, i;
    BOOL bDone;
    static LOGFONT lfDlg;
    static LPLOGFONT lplf;

    switch (msg) {
        case WM_INITDIALOG:
            CenterWindow (hwnd, GetWindow (hwnd, GW_OWNER));
            lplf = (LOGFONT *)lParam;
            if (!lplf) {
                return FALSE;
            }
            lfDlg = *lplf;
            SetDlgItemInt (hwnd, CFD_HEIGHT, (int)lfDlg.lfHeight, TRUE);
            SetDlgItemInt (hwnd, CFD_WIDTH, (int)lfDlg.lfWidth, TRUE);
            SetDlgItemInt (hwnd, CFD_ESCAPEMENT, (int)lfDlg.lfEscapement, TRUE);
            SetDlgItemInt (hwnd, CFD_ORIENTATION, (int)lfDlg.lfOrientation, TRUE);
            SetDlgItemInt (hwnd, CFD_WEIGHT, (int)lfDlg.lfWeight, FALSE);
            SetDlgItemInt (hwnd, CFD_ITALIC, (int)lfDlg.lfItalic, FALSE);
            SetDlgItemInt (hwnd, CFD_UNDERLINE, (int)lfDlg.lfUnderline, FALSE);
            SetDlgItemInt (hwnd, CFD_STRIKEOUT, (int)lfDlg.lfStrikeOut, FALSE);
            SetDlgItemInt (hwnd, CFD_CHARSET, (int)lfDlg.lfCharSet, FALSE);
            SetDlgItemInt (hwnd, CFD_OUTPUTPRECISION, (int)lfDlg.lfOutPrecision, FALSE);
            SetDlgItemInt (hwnd, CFD_CLIPPRECISION, (int)lfDlg.lfClipPrecision, FALSE);
            SetDlgItemInt (hwnd, CFD_QUALITY, (int)lfDlg.lfQuality, FALSE);
            SetDlgItemInt (hwnd, CFD_PITCHANDFAMILY, (int)lfDlg.lfPitchAndFamily, FALSE);
            SetDlgItemText(hwnd, CFD_FACENAME, lfDlg.lfFaceName);

            return (TRUE);

        case WM_COMMAND:
            wmId = LOWORD(wParam);
            switch (wmId) {
                case CFD_DEFAULT:
                    // Set all elements to ZERO. This will give us a 'default' font
                    for (i=CFD_BASE; i<=CFD_PITCHANDFAMILY; i++) {
                        SetDlgItemInt (hwnd, i, 0, FALSE);
                    }
                    SetDlgItemText (hwnd, CFD_FACENAME, "");
                    break;

                case IDOK:
                    // Get the data from the edit control, we will then use this for a 'CreatFont' call
                    lfDlg.lfHeight = GetDlgItemInt (hwnd, CFD_HEIGHT, &bDone, TRUE);
                    lfDlg.lfWidth = GetDlgItemInt (hwnd, CFD_WIDTH, &bDone, TRUE);
                    lfDlg.lfEscapement = GetDlgItemInt (hwnd, CFD_ESCAPEMENT, &bDone, TRUE);
                    lfDlg.lfOrientation = GetDlgItemInt (hwnd, CFD_ORIENTATION, &bDone, TRUE);
                    lfDlg.lfWeight = GetDlgItemInt (hwnd, CFD_WEIGHT, &bDone, FALSE);
                    lfDlg.lfItalic = (BYTE)GetDlgItemInt (hwnd, CFD_ITALIC, &bDone, FALSE);
                    lfDlg.lfUnderline = (BYTE)GetDlgItemInt (hwnd, CFD_UNDERLINE, &bDone, FALSE);
                    lfDlg.lfStrikeOut = (BYTE)GetDlgItemInt (hwnd, CFD_STRIKEOUT, &bDone, FALSE);
                    lfDlg.lfCharSet = (BYTE)GetDlgItemInt (hwnd, CFD_CHARSET, &bDone, FALSE);
                    lfDlg.lfOutPrecision = (BYTE)GetDlgItemInt (hwnd, CFD_OUTPUTPRECISION, &bDone, FALSE);
                    lfDlg.lfClipPrecision = (BYTE)GetDlgItemInt (hwnd, CFD_CLIPPRECISION, &bDone, FALSE);
                    lfDlg.lfQuality = (BYTE)GetDlgItemInt (hwnd, CFD_QUALITY, &bDone, FALSE);
                    lfDlg.lfPitchAndFamily = (BYTE)GetDlgItemInt (hwnd, CFD_PITCHANDFAMILY, &bDone, FALSE);
                    GetDlgItemText(hwnd, CFD_FACENAME, lfDlg.lfFaceName,20);
                    // and copy the data into our external structure
                    *lplf = lfDlg;
                    EndDialog(hwnd, TRUE);
                    return TRUE;

                case IDCANCEL:
                    // Exit without changing anything
                    EndDialog(hwnd, TRUE);
                    return TRUE;

            }
            break;
    }
    return FALSE;

    lParam; //unreferenced formal paramter
}

BOOL CreateStatusBar | ( | HWND | ,
 |  | HANDLE | ,
 |  | int |
 | ) |  |

Definition at line 75 of file Status.c.

{
    cxStatusBorder = GetSystemMetrics (SM_CXBORDER);
    cyStatusBorder = GetSystemMetrics (SM_CYBORDER);

    hwndStatus = CreateWindow ("SamplerStatus", "SamplerStatus",
        WS_CHILD | WS_BORDER | WS_VISIBLE,
        0, 0, 0, 0,
        hwnd, (HMENU)(INT_PTR)iId, hInst, NULL);

    if (!hwndStatus) {
        return FALSE;
    }
    return TRUE;
}

BOOL CreateToolBar | ( | HWND | ,
 |  | HANDLE | ,
 |  | int |
 | ) |  |

Definition at line 71 of file Tools.c.

{
        HWND hwndTmp;
        RECT rect;

        hInst = (HANDLE)GetWindowLongPtr (hwnd, GWLP_HINSTANCE);

        if (hbrBtnFace==0) {
                hbrBtnFace = CreateSolidBrush(GetSysColor(COLOR_BTNFACE));
        }
        if (hbrWindow==0) {
                hbrWindow = CreateSolidBrush(GetSysColor(COLOR_WINDOW));
        }

        cxToolBorder = GetSystemMetrics (SM_CXBORDER);
        cyToolBorder = GetSystemMetrics (SM_CYBORDER);

        hwndTools = CreateWindow ("SamplerTools", "SamplerTools",
                WS_CHILD | WS_CLIPSIBLINGS | WS_BORDER | WS_VISIBLE,
                0, 0, 0, 0,
        hwnd, (HMENU)(INT_PTR)iId, hInst, NULL);
        if (!hwndTools) {
                return FALSE;
        }

        /* Lets find out how big a combo box is... */
        hwndTmp = CreateWindow ("COMBOBOX", "Combo",
                        WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST,
                        0, 0, 0, 0,
                        hwndTools, NULL, hInst, NULL);
        if (hwndTmp) {
                SendMessage (hwndTmp, WM_SETFONT, (UINT_PTR)hfontTools, (LONG_PTR)MAKELONG (TRUE, 0));
                GetClientRect (hwndTmp, &rect);
                dyCombo = rect.bottom - rect.top;
                DestroyWindow (hwndTmp);
        } else {
                dyCombo = 30; // Just for a default value
        }

        hwndMain = hwnd; // So we can pass WM_CONTROL messages back to the master parent

        return TRUE;

        hInstance; // unreferenced formal parameter
}

void DrawAscii | ( | HDC | hdc,
 |  | RECT * | pRect,
 |  | WORD | direction
 | ) |  |

Definition at line 69 of file Display.c.

{
    BYTE *pch;
    int h, w, incx, incy, width;
    unsigned int  wDisplay;
    POINT pt;
    TEXTMETRIC tm;

    GetTextMetrics (hdc, &tm);
    h = tm.tmHeight;
    w = tm.tmMaxCharWidth;

    incx = 0;
    incy = h;
    pt.x = 0;
    pt.y = 0;

    //
    pt.y = tm.tmAscent + tm.tmExternalLeading;
    //

    pch = (BYTE*)&(ascii[tm.tmFirstChar]);

    if (!pRect)     // check pRect validity
    {
        return;
    }

    wDisplay = pRect->right -pRect->left;

    //
    SetTextAlign (hdc, TA_BASELINE | TA_CENTER);
    SetBkMode (hdc, TRANSPARENT);
    //

    while (pch[0] && (pch[0]<=tm.tmLastChar)) {
        SIZE size;
        GetTextExtentPoint (hdc, (LPCTSTR)pch, 1, &size);
        width = size.cx;
        if ((unsigned)(pt.x + width) > wDisplay) {
            pt.x = 0;
            pt.y += incy;
        }
        TextOut (hdc, pt.x + (width/2), pt.y, (LPCTSTR)pch, 1);
        pt.x += width;
        pch++;
    }
    return;

    direction;
}

void DrawGlyph | ( | HDC | hdc,
 |  | RECT * | pRect,
 |  | BYTE | glyph,
 |  | HFONT | hfont
 | ) |  |

Definition at line 222 of file Display.c.

{
    TEXTMETRIC tm;
    LOGFONT lf;
    int wChar, h1, h2, w1, w2, x, y;
    double xTL, yTL, xTR, yTR, xBL, yBL, xBR, yBR, xML, yML, xMR, yMR;
    int cWidth, cExtentW, cExtentH;
    int unit, margin;
    RECT rect, rectChar;
    HDC hdcMem;
    HBITMAP hbitmap, hbitmapOld;
    HFONT hfontOld, hfontTmp;
    char szText[80];
    double fAng, fWa, fWb, fHa, fHb, fHeight, fWidth;
    BOOL bRotateable;
    double fxOff, fyOff;
#if defined(TT_AVAILABLE)
    ABC abc;
#endif

    GetTextMetrics (hdc, &tm);
    hfontTmp = SelectObject (hdc, GetStockObject(SYSTEM_FONT));
    GetObject (hfontTmp, sizeof(LOGFONT), &lf);

// Some fields of 'lf' need to be whacked out depending on the type of
// font involved. For instance, lfEscapement should only be non-zero for
// rotatable fonts.
        bRotateable = FALSE;
#if defined (TMPF_VECTOR)
        bRotateable = (tm.tmPitchAndFamily & TMPF_VECTOR);
#endif
#if defined (TMPF_TRUETYPE)
        bRotateable |= (tm.tmPitchAndFamily & TMPF_TRUETYPE);
#endif
        if (!bRotateable) {
                lf.lfEscapement = 0;
        }

    SelectObject (hdc, hfontTmp);
    GetCharWidth (hdc, glyph, glyph, &cWidth);

    {
        SIZE size;
        GetTextExtentPoint (hdc, (LPSTR)&glyph, 1, &size);
        cExtentW = size.cx;
        cExtentH = size.cy;
    }

    wChar = max(cWidth, cExtentW);

#if defined(TT_AVAILABLE)
    if (GetCharABCWidths (hdc, (UINT)glyph, (UINT)glyph, &abc)) {
        wChar = abc.abcA + abc.abcB + abc.abcC;
        wChar = max(abc.abcA,0) + max (abc.abcB,0) + max (abc.abcC,0);
    } else {
        abc.abcA = 0;
        abc.abcB = wChar;
        abc.abcC = 0;
    }
#endif

// ****
        // Lets figure out how large of a bitmap we need to draw this character into.
        // This will take lfEscapement into account.

        // Turn the 'escapement' value into a valid angle
    fAng = 90.0 - ((double)lf.lfEscapement/10.0);

    // We now need to calculate two values for height and width. These
    // represent the bases of the triangles that are formed as the
    // character cell rotates. Thus fWa+fWb is the 'width' of the space
    // required by the given character at the current rotation.
    // At 0, 90, 180, 270 and 360, one of the two values will be '0'.
    fWa = (double)cExtentW * sin(Radian(fAng));
    fHa = (double)cExtentW * sin(Radian((double)lf.lfEscapement/10.0));
    fHb = (double)cExtentH * sin(Radian(fAng));
    fWb = (double)cExtentH * sin(Radian((double)lf.lfEscapement/10.0));

    // This gives us a width/height of:
    fHeight = fabs(fHa) + fabs(fHb);
    fWidth = fabs(fWa) + fabs(fWb);
// ****

    if (!pRect) //check for pRect validity
    {
        return;
    }

    h1 = pRect->bottom - pRect->top;
    h2 = tm.tmHeight + tm.tmExternalLeading;
    h2 = (int)fHeight;
    if (h2 == 0) {
        MessageBeep (0);
        h2 = 10;
    }

    w1 = pRect->right - pRect->left;
    w2 = (int)fWidth;

    unit = (h1 / h2);

    margin = (h1 - (unit * h2)) / 2;
    margin = 0;
    // Define a rectangle that will enclose our drawing area
    SetRect (&rect, 0, 0, wChar*unit, (tm.tmHeight*unit) + (tm.tmExternalLeading*unit));
    OffsetRect (&rect, margin, margin);
    // Define a rectangle that will define the bounding box of the character
    SetRect (&rectChar, 0, 0, wChar*unit, tm.tmHeight*unit);
    OffsetRect (&rectChar, margin, margin + (tm.tmExternalLeading*unit));

// ****
    // These are floating point values.
    SetRect (&rect, 0, 0, (int)(fWidth)*unit, ((int)(fHeight)*unit) + (tm.tmExternalLeading*unit));
    OffsetRect (&rect, margin, margin);
    // Define a rectangle that will define the bounding box of the character
    SetRect (&rectChar, 0, 0, (int)(fWidth)*unit, ((int)(fHeight)*unit));
    OffsetRect (&rectChar, margin, margin + (tm.tmExternalLeading*unit));

    // Calculate the points of the 'character cell'. This will take full
    // rotation into consideration.
        CalcRot (0, 0, (double)lf.lfEscapement/10.0, &xTL, &yTL);
        CalcRot ((double)cExtentW, 0, (double)lf.lfEscapement/10.0, &xTR, &yTR);
        CalcRot (0, (double)cExtentH, (double)lf.lfEscapement/10.0, &xBL, &yBL);
        CalcRot ((double)cExtentW, (double)cExtentH, (double)lf.lfEscapement/10.0, &xBR, &yBR);
        CalcRot (0, (double)tm.tmAscent, (double)lf.lfEscapement/10.0, &xML, &yML);
        CalcRot ((double)cExtentW, (double)tm.tmAscent, (double)lf.lfEscapement/10.0, &xMR, &yMR);

        fxOff = min(xTL, min(xTR, min(xBL, xBR)));
        fyOff = min(yTL, min(yTR, min(yBL, yBR)));

// Draw a rectangle around the drawing limits of the character.
    MoveToEx (hdc, (int)((xTL-fxOff)*(double)unit), (int)((yTL-fyOff)*(double)unit), NULL);
    LineTo (hdc, (int)((xTR-fxOff)*(double)unit), (int)((yTR-fyOff)*(double)unit));
    LineTo (hdc, (int)((xBR-fxOff)*(double)unit), (int)((yBR-fyOff)*(double)unit));
    LineTo (hdc, (int)((xBL-fxOff)*(double)unit), (int)((yBL-fyOff)*(double)unit));
    LineTo (hdc, (int)((xTL-fxOff)*(double)unit), (int)((yTL-fyOff)*(double)unit));

// Draw the baseline, which indicates the advance width of the character
    MoveToEx (hdc, (int)((xML-fxOff)*(double)unit), (int)((yML-fyOff)*(double)unit), NULL);
    LineTo (hdc, (int)((xMR-fxOff)*(double)unit), (int)((yMR-fyOff)*(double)unit));

    hdcMem = CreateCompatibleDC (hdc);
    if (hdcMem) {
        hbitmap = CreateCompatibleBitmap (hdc, (int)(fWidth), (int)(fHeight));
        if (hbitmap) {
            hbitmapOld = SelectObject (hdcMem, hbitmap);
            BitBlt (hdcMem, 0, 0, (int)(fWidth), (int)(fHeight), NULL, 0, 0, WHITENESS);
            hfontOld = SelectObject (hdcMem, hfont);

            SetTextAlign (hdcMem, TA_LEFT | TA_BASELINE);
            if (TextOut (hdcMem, (int)(xML-fxOff), (int)(yML-fyOff), (LPSTR)&glyph, 1)) {

                                /*
                // Just for debugging, lets mark some special pixels
                        SetPixel (hdcMem, (int)(xML-fxOff), (int)(yML-fyOff), 0x808080); // Base Lft
                        SetPixel (hdcMem, (int)(xTL-fxOff), (int)(yTL-fyOff), 0x808080); // Top Left
                        SetPixel (hdcMem, (int)(xTR-fxOff), (int)(yTR-fyOff), 0x808080); // Top Right
                        SetPixel (hdcMem, (int)(xBL-fxOff), (int)(yBL-fyOff), 0x808080); // Btm Left
                        SetPixel (hdcMem, (int)(xBR-fxOff), (int)(yBR-fyOff), 0x808080); // Btm Right
                        SetPixel (hdcMem, (int)(xML-fxOff), (int)(yML-fyOff), 0x808080); // Base Lft
                        SetPixel (hdcMem, (int)(xMR-fxOff), (int)(yMR-fyOff), 0x808080); // Base Rt
                */

                CircleBlt(hdc, margin, margin,
                    rectChar.right-rectChar.left, rectChar.bottom-rectChar.top,
                    hdcMem, 0, 0, (int)(fWidth), (int)(fHeight), SRCPAINT);

            } else {
                MessageBox (GetFocus(),
                        "Unable to perform TextOut", "DisplayGlyph", MB_OK);
            }
            SelectObject (hdcMem, hbitmapOld);
            SelectObject (hdcMem, hfontOld);
            DeleteObject (hbitmap);
        } else {
            MessageBox (GetFocus(), "Unable To create Bitmap", "DisplayGlyph", MB_OK);
        }
        DeleteDC (hdcMem);
    } else {
        MessageBox (GetFocus(), "Unable to create DC", "DisplayGlyph", MB_OK);
    }

    hfontTmp = CreateFont(14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, VARIABLE_PITCH | FF_SWISS, "");

    if (hfontTmp) {
        hfontOld = SelectObject (hdc, hfontTmp);
        x = rect.right + 10;
        GetTextMetrics (hdc, &tm);

        y = tm.tmHeight + tm.tmExternalLeading;

        y += tm.tmHeight + tm.tmExternalLeading;
        _snprintf (szText, sizeof(szText) - 1, "Character = '%c' %u (0x%X)", (char)glyph, (int)glyph, (int)glyph);
        szText[sizeof(szText) - 1] = '\0';
        TextOut (hdc, x, y, szText, lstrlen(szText));

        y += tm.tmHeight + tm.tmExternalLeading;
        _snprintf (szText, sizeof(szText) - 1, "CharWidth = %i", cWidth);
        szText[sizeof(szText) - 1] = '\0';
        TextOut (hdc, x, y, szText, lstrlen(szText));

                // ABC Width - Eventually, I want to 'draw' this into the character
                // cell, but for now, this at least makes the information easily
                // available:
#if defined (TT_AVAILABLE)
        y += tm.tmHeight + tm.tmExternalLeading;
        _snprintf (szText, sizeof(szText) - 1, "A|B|C = %i | %u | %i", abc.abcA, abc.abcB, abc.abcC);
        szText[sizeof(szText) - 1] = '\0';
        TextOut (hdc, x, y, szText, lstrlen(szText));
#endif

        y += tm.tmHeight + tm.tmExternalLeading;
        _snprintf (szText, sizeof(szText) - 1, "CharExtentW = %i", cExtentW);
        szText[sizeof(szText) - 1] = '\0';
        TextOut (hdc, x, y, szText, lstrlen(szText));

        y += tm.tmHeight + tm.tmExternalLeading;
        _snprintf (szText, sizeof(szText) - 1, "CharExtentH = %i", cExtentH);
        szText[sizeof(szText) - 1] = '\0';
        TextOut (hdc, x, y, szText, lstrlen(szText));

                // These are for some values I was using to debug the character
                // cell rotation calculation:

        //y += tm.tmHeight + tm.tmExternalLeading;
        //wsprintf (szText, "(%i,%i) : (%i,%i) [%i]", (int)xTL, (int)yTL, (int)xTR, (int)yTR,(int)(((double)lf.lfEscapement/10.0)*10));
        //TextOut (hdc, x, y, szText, lstrlen(szText));

        //y += tm.tmHeight + tm.tmExternalLeading;
        //wsprintf (szText, "(%i,%i) : (%i,%i)", (int)xML, (int)yML, (int)xMR, (int)yMR);
        //TextOut (hdc, x, y, szText, lstrlen(szText));

        //y += tm.tmHeight + tm.tmExternalLeading;
        //wsprintf (szText, "(%i,%i) : (%i,%i)", (int)xBL, (int)yBL, (int)xBR, (int)yBR);
        //TextOut (hdc, x, y, szText, lstrlen(szText));

        //y += tm.tmHeight + tm.tmExternalLeading;
        //wsprintf (szText, "fAng = %i", (int)(fAng));
        //TextOut (hdc, x, y, szText, lstrlen(szText));

        //y += tm.tmHeight + tm.tmExternalLeading;
        //wsprintf (szText, "fHa = %i", (int)(fHa));
        //TextOut (hdc, x, y, szText, lstrlen(szText));

        //y += tm.tmHeight + tm.tmExternalLeading;
        //wsprintf (szText, "fHb = %i", (int)(fHb));
        //TextOut (hdc, x, y, szText, lstrlen(szText));

        //y += tm.tmHeight + tm.tmExternalLeading;
        //wsprintf (szText, "fWa = %i", (int)(fWa));
        //TextOut (hdc, x, y, szText, lstrlen(szText));

        //y += tm.tmHeight + tm.tmExternalLeading;
        //wsprintf (szText, "fWb = %i", (int)(fWb));
        //TextOut (hdc, x, y, szText, lstrlen(szText));

        //y += tm.tmHeight + tm.tmExternalLeading;
        //wsprintf (szText, "fWd = %i", (int)(fWd));
        //TextOut (hdc, x, y, szText, lstrlen(szText));

        //y += tm.tmHeight + tm.tmExternalLeading;
        //wsprintf (szText, "fHd = %i", (int)(fHd));
        //TextOut (hdc, x, y, szText, lstrlen(szText));

        //y += tm.tmHeight + tm.tmExternalLeading;
        //wsprintf (szText, "fHeight = %i", (int)(fHeight));
        //TextOut (hdc, x, y, szText, lstrlen(szText));

        //y += tm.tmHeight + tm.tmExternalLeading;
        //wsprintf (szText, "fWidth = %i", (int)(fWidth));
        //TextOut (hdc, x, y, szText, lstrlen(szText));

        SelectObject (hdc, hfontOld);
        DeleteObject (hfontTmp);
    }
}

BOOL APIENTRY EnumDlgProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 519 of file Dialogs.c.

{
    static HANDLE /*TO FONTLIST*/ hFonts;
    static int iLoc=0;
    static int count=0;
    static BOOL bHex = FALSE;
    static LOGFONT *lplf;
    static LOGFONT lfDlg;
    int wmId, i, j;
    HANDLE hInst;
    HWND   hwndItem;
    HDC hdc;
    FARPROC lpEnumFonts;
    LPFONTLIST    pFL;
    LPFONTSTRUCT  pFS;
    char szTmp[80];
    HFONT hfont, hfontPrev;
    BOOL bDone;
    TEXTMETRIC tmTmp;

    switch (msg) {
        case WM_INITDIALOG:
            lplf = (LOGFONT *)lParam;
            if (!lplf)
            {
                return FALSE;
            }

            lfDlg = *lplf;
            iLoc = 0;
            count = 0;
            bHex = FALSE;
            /* First, lets enumerate ALL fonts, and store them in our list */
            hFonts = GlobalAlloc (GHND, sizeof(FONTLIST));
            if (hFonts) {
                hInst = (HANDLE)GetWindowLongPtr (hwnd, GWLP_HINSTANCE);
                lpEnumFonts = MakeProcInstance((FARPROC)DlgEnumFontNames, hInst);

                if (lpEnumFonts) {
                    hdc  = GetDC(hwnd);
                    // The enumeration function will lock down the handle
                    EnumFonts (hdc, NULL, (FONTENUMPROC)lpEnumFonts, (LPARAM)&hFonts);
                    // The handle will come back to us properly unlocked
                    ReleaseDC(hwnd, hdc);
                    FreeProcInstance (lpEnumFonts);
                 }
            }
            pFL = (LPFONTLIST)GlobalLock (hFonts);
            if (pFL) {
                pFS = (LPFONTSTRUCT)GlobalLock (pFL->hList);
                if (pFS) {
                    iLoc = 0;
                    j = 100;
                    for (i=0; i<pFL->count; i++) {
                        if (lstrcmp(lfDlg.lfFaceName, pFS[i].lf.lfFaceName) == 0) {
                            if (abs(lfDlg.lfHeight-pFS[i].lf.lfHeight) < j) {
                                j = abs(lfDlg.lfHeight-pFS[i].lf.lfHeight);
                                iLoc = i;
                            }
                        }
                    }
                    FillEnumFields (hwnd, pFS[iLoc].ft, &pFS[iLoc].tm, &pFS[iLoc].lf, (bHex?16:10));
                    hwndItem = GetDlgItem (hwnd, ED_SAMPLE);
                    DrawSample (hwndItem, &pFS[iLoc].lf);
                    GlobalUnlock (pFL->hList);

                }
                count = pFL->count;
                GlobalUnlock (hFonts);

            }
            /* now fill in the dialog values */
            if (_snprintf (szTmp, sizeof(szTmp) - 1, "EnumFonts %d of %d", iLoc+1, count) > 0)
            {
                szTmp[sizeof(szTmp) - 1] = '\0';
                SetWindowText (hwnd, szTmp);
            }
            CenterWindow (hwnd, GetWindow (hwnd, GW_OWNER));

            return TRUE;

        case WM_PAINT:
            pFL = (LPFONTLIST)GlobalLock (hFonts);
            if (pFL) {
                pFS = (LPFONTSTRUCT)GlobalLock (pFL->hList);
                if (pFS) {
                    FillEnumFields (hwnd, pFS[iLoc].ft, &pFS[iLoc].tm, &pFS[iLoc].lf, (bHex?16:10));
                    hwndItem = GetDlgItem (hwnd, ED_SAMPLE);
                    DrawSample (hwndItem, &pFS[iLoc].lf);
                    GlobalUnlock (pFL->hList);
                }
                GlobalUnlock (hFonts);
            }
            return TRUE;

        case WM_COMMAND:
            wmId = LOWORD(wParam);
            switch (wmId) {

                case ED_HEX:
                    // Display the data in either Hex mode or Dec mode.
                    bHex = !bHex;
                    CheckDlgButton (hwnd, wmId, bHex);
                    pFL = (LPFONTLIST)GlobalLock (hFonts);
                    if (pFL) {
                        pFS = (LPFONTSTRUCT)GlobalLock (pFL->hList);
                        if (pFS) {
                            FillEnumFields (hwnd, pFS[iLoc].ft, &pFS[iLoc].tm, &pFS[iLoc].lf, (bHex?16:10));
                            if (GlobalUnlock (pFL->hList)) {
                                MessageBox (GetFocus(), "In HEX", "Unlock pFL->hList", MB_OK);
                            }
                        }
                        if (GlobalUnlock (hFonts)) {
                            MessageBox (GetFocus(), "In HEX", "Unlock hFonts", MB_OK);
                        }

                    }
                    break;

                case ED_PREV:
                    pFL = (LPFONTLIST)GlobalLock (hFonts);
                    if (pFL) {
                        if (iLoc > 0) {
                            iLoc--;
                            pFS = (LPFONTSTRUCT)GlobalLock (pFL->hList);
                            if (pFS) {
                                FillEnumFields (hwnd, pFS[iLoc].ft, &pFS[iLoc].tm, &pFS[iLoc].lf, (bHex?16:10));
                                hwndItem = GetDlgItem (hwnd, ED_SAMPLE);
                                DrawSample (hwndItem, &pFS[iLoc].lf);
                                GlobalUnlock (pFL->hList);
                            }
                        }
                        GlobalUnlock (hFonts);
                    }

                    if (_snprintf (szTmp, sizeof(szTmp) - 1, "EnumFonts %d of %d", iLoc+1, count) > 0 )
                    {
                        szTmp[sizeof(szTmp) - 1] = '\0';
                        SetWindowText (hwnd, szTmp);
                    }
                    break;

                case ED_NEXT:
                    pFL = (LPFONTLIST)GlobalLock (hFonts);
                    if (pFL) {
                        if ((pFL->count-1) > iLoc) {
                            iLoc++;
                            pFS = (LPFONTSTRUCT)GlobalLock (pFL->hList);
                            if (pFS) {
                                FillEnumFields (hwnd, pFS[iLoc].ft, &pFS[iLoc].tm, &pFS[iLoc].lf, (bHex?16:10));
                                hwndItem = GetDlgItem (hwnd, ED_SAMPLE);
                                DrawSample (hwndItem, &pFS[iLoc].lf);
                                GlobalUnlock (pFL->hList);
                            }

                        }
                        GlobalUnlock (hFonts);
                    }

                    if (_snprintf (szTmp, sizeof(szTmp) - 1, "EnumFonts %d of %d", iLoc+1, count) > 0 )
                    {
                        szTmp[sizeof(szTmp) - 1] = '\0';
                        SetWindowText (hwnd, szTmp);
                    }
                    break;

                case IDOK:
                    // Copy the LOGFONT structure from the enumeration list, into our private LF
                    pFL = (LPFONTLIST)GlobalLock (hFonts);
                    bDone = FALSE;
                    if (pFL) {
                        if ((pFL->count-1) >= iLoc) {
                            pFS = (LPFONTSTRUCT)GlobalLock (pFL->hList);
                            if (pFS) {
                                lfDlg = pFS[iLoc].lf;

                                // Lets create a font with this new data
                                hfont = CreateFontIndirect (&lfDlg);
                                hdc = GetDC (hwnd);
                                hfontPrev = SelectObject (hdc, hfont);
                                GetTextMetrics (hdc, &tmTmp);
                                // Get the face name
                                GetTextFace    (hdc, sizeof(szTmp), szTmp);
                                SelectObject (hdc, hfontPrev);
                                DeleteObject (hfont);
                                ReleaseDC (hwnd, hdc);

                                // And verify that we did indeed get the same font.
                                bDone = TRUE;
                                bDone = bDone && (pFS[iLoc].tm.tmHeight==tmTmp.tmHeight);
                                bDone = bDone && (pFS[iLoc].tm.tmAscent==tmTmp.tmAscent);
                                bDone = bDone && (pFS[iLoc].tm.tmDescent==tmTmp.tmDescent);
                                bDone = bDone && (pFS[iLoc].tm.tmInternalLeading==tmTmp.tmInternalLeading);
                                bDone = bDone && (pFS[iLoc].tm.tmExternalLeading==tmTmp.tmExternalLeading);
                                bDone = bDone && (pFS[iLoc].tm.tmAveCharWidth==tmTmp.tmAveCharWidth);
                                bDone = bDone && (pFS[iLoc].tm.tmMaxCharWidth==tmTmp.tmMaxCharWidth);
                                bDone = bDone && (pFS[iLoc].tm.tmWeight==tmTmp.tmWeight);
                                bDone = bDone && (pFS[iLoc].tm.tmItalic==tmTmp.tmItalic);
                                bDone = bDone && (pFS[iLoc].tm.tmUnderlined==tmTmp.tmUnderlined);
                                bDone = bDone && (pFS[iLoc].tm.tmStruckOut==tmTmp.tmStruckOut);
                                bDone = bDone && (pFS[iLoc].tm.tmFirstChar==tmTmp.tmFirstChar);
                                bDone = bDone && (pFS[iLoc].tm.tmLastChar==tmTmp.tmLastChar);
                                bDone = bDone && (pFS[iLoc].tm.tmDefaultChar==tmTmp.tmDefaultChar);
                                bDone = bDone && (pFS[iLoc].tm.tmBreakChar==tmTmp.tmBreakChar);
                                bDone = bDone && (pFS[iLoc].tm.tmPitchAndFamily==tmTmp.tmPitchAndFamily);
                                bDone = bDone && (pFS[iLoc].tm.tmCharSet==tmTmp.tmCharSet);
                                // Did it work?
                                if (bDone) {
                                    *lplf = lfDlg;
                                    //EndDialog(hwnd, TRUE);
                                    //return (TRUE);
                                } else {
                                    // Again, font verification code is'nt quite up to
                                    // snuff yet, so just Select the font anyway:
                                    *lplf = lfDlg;

                                    // ...and this is what we want to do once we fix the
                                    // font verification code:
                                    //lfDlg = *lplf;
                                    //MessageBox (GetFocus(),
                                    //    "Unable to re-create font from TextMetrics",
                                    //    "FontView", MB_OK);
                                }

                                GlobalUnlock (pFL->hList);
                            }
                        }
                        GlobalUnlock (hFonts);
                    }

                    // Now set our master lf to this value. This way, we 'could' verify that the
                    // LOGFONT structure will in fact select this particular font, we just aren't yet
                    // *lplf = lfDlg;

                    pFL = (LPFONTLIST)GlobalLock (hFonts);
                    if (pFL) {
                        if (GlobalFree (pFL->hList)) {
                            MessageBox (GetFocus(), "Failed To Free", "pFL->hList", MB_OK);
                        } else {
                            GlobalUnlock (hFonts);
                            if (GlobalFree (hFonts)) {
                                MessageBox (GetFocus(), "Failed To Free", "hFonts", MB_OK);
                            }
                        }
                    }
                    EndDialog(hwnd, TRUE);
                    return bDone;

                case IDCANCEL:
                    pFL = (LPFONTLIST)GlobalLock (hFonts);
                    if (pFL) {
                        if (GlobalFree (pFL->hList)) {
                            MessageBox (GetFocus(), "Failed To Free", "pFL->hList", MB_OK);
                        } else {
                            GlobalUnlock (hFonts);
                            if (GlobalFree (hFonts)) {
                                MessageBox (GetFocus(), "Failed To Free", "hFonts", MB_OK);
                            }
                        }
                    }
                    EndDialog(hwnd, TRUE);
                    return TRUE;
            }
            break;
    }
    return FALSE;

    lParam; // unreferenced formal parameter
}

int FAR PASCAL EnumFontNames | ( | LPLOGFONT | lpLogFont,
 |  | LPTEXTMETRIC | lpTextMetric,
 |  | DWORD | nFontType,
 |  | LPARAM | lData
 | ) |  |

Definition at line 601 of file FontView.c.

{
    HWND hwnd;
    FARPROC lpFontEnumProc;
    HDC  hdc;
    ATOM atom;
    HWND hwndCombo;
    int  index;

    hwnd = GetFocus();
    hdc  = GetDC(hwnd);
    hwndCombo = (HWND)lData;

    atom = GlobalFindAtom ((LPSTR)lpLogFont->lfFaceName);
    if (atom == (ATOM)0) {
        atom = GlobalAddAtom (lpLogFont->lfFaceName);
    }
    index = (int) SendMessage(hwndCombo, CB_FINDSTRING, (UINT)-1, (LONG_PTR)(LPSTR)lpLogFont->lfFaceName);
    if (index == CB_ERR) {
        index = (int)SendMessage (hwndCombo, CB_ADDSTRING, 0, (LONG_PTR)(LPSTR)lpLogFont->lfFaceName);
        SendMessage (hwndCombo, CB_SETITEMDATA, index, atom);
    }

    ReleaseDC(hwnd, hdc);

    return TRUE;

    lpTextMetric;   // unreferenced formal paramater
    nFontType;      // unreferenced formal parameter
    lpFontEnumProc; // unreferenced formal parameter
}

BOOL FillInParam | ( | HWND | hwnd,
 |  | int | focus
 | ) |  |

Definition at line 213 of file FontView.c.

{
    int index;

    index = 0;
    SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"nHeight");
    SendMessage (hwnd, CB_SETITEMDATA, index++, CFP_HEIGHT);
    SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"nWidth");
    SendMessage (hwnd, CB_SETITEMDATA, index++, CFP_WIDTH);
    SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"nEscapement");
    SendMessage (hwnd, CB_SETITEMDATA, index++, CFP_ESCAPEMENT);
    SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"nOrientation");
    SendMessage (hwnd, CB_SETITEMDATA, index++, CFP_ORIENTATION);
    SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"nWeight");
    SendMessage (hwnd, CB_SETITEMDATA, index++, CFP_WEIGHT);
    SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"cItalic");
    SendMessage (hwnd, CB_SETITEMDATA, index++, CFP_ITALIC);
    SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"cUnderline");
    SendMessage (hwnd, CB_SETITEMDATA, index++, CFP_UNDERLINE);
    SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"cStrikeOut");
    SendMessage (hwnd, CB_SETITEMDATA, index++, CFP_STRIKEOUT);
    SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"cCharSet");
    SendMessage (hwnd, CB_SETITEMDATA, index++, CFP_CHARSET);
    SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"cOutputPrecision");
    SendMessage (hwnd, CB_SETITEMDATA, index++, CFP_OUTPUTPRECISION);
    SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"cClipPrecision");
    SendMessage (hwnd, CB_SETITEMDATA, index++, CFP_CLIPPRECISION);
    SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"cQuality");
    SendMessage (hwnd, CB_SETITEMDATA, index++, CFP_QUALITY);
    SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"cPitch...");
    SendMessage (hwnd, CB_SETITEMDATA, index++, CFP_PITCH);
    SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"c...Family");
    SendMessage (hwnd, CB_SETITEMDATA, index++, CFP_FAMILY);
    SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"lpFacename");
    SendMessage (hwnd, CB_SETITEMDATA, index++, CFP_FACENAME);
    SendMessage (hwnd, CB_SETCURSEL, focus, 0);
    return TRUE;
}

BOOL FillInValue | ( | HWND | hwnd,
 |  | int | param
 | ) |  |

Definition at line 255 of file FontView.c.

{
    int i, index, focus;
    LONG_PTR data;
    char szTmp[80];
    ATOM atom;
    HDC  hdc;
    FARPROC lpEnumFonts;
    HINSTANCE hInst;

    SendMessage (hwnd, CB_RESETCONTENT, 0, 0);
    focus = -1;
    index = 0;

    // Each of the following cases will contain two different 'loops', the first one will fill the
    // combo box with values, the second will locate the current setting in the combobox and set
    // the focus to it. If the value is not currently in the combobox, then it will be inserted at
    // the proper location.

    switch (param) {
        case CFP_HEIGHT:
            // Lets just toss in a range of heights, from -72 to 72, by twos
            // If the user wants to enter in a custom value, they need to use
            // the 'CreateFont' dialog for now.
            for (i=-72; i<72; i+=2) {
                if (i < 0) {
                    _snprintf (szTmp, sizeof(szTmp), "%d = cell height = %u", i, abs(i));
                } else if (i == 0) {
                    _snprintf (szTmp,sizeof(szTmp), "%u = default", i);
                } else {
                    _snprintf (szTmp, sizeof(szTmp), "%u = character height", i);
                }
                SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)szTmp);
                SendMessage (hwnd, CB_SETITEMDATA, index++, (DWORD)i);
            }

            for (i=0; i<index; i++) {
                data = (long)SendMessage (hwnd, CB_GETITEMDATA, i, 0);
                if (data == lf.lfHeight) {
                    focus = i;
                    break;
                } else if (data > lf.lfHeight) {
                    _snprintf (szTmp, sizeof(szTmp), "%u", lf.lfHeight);
                    SendMessage (hwnd, CB_INSERTSTRING, i, (DWORD_PTR)(LPSTR)szTmp);
                    SendMessage (hwnd, CB_SETITEMDATA, i, (DWORD_PTR)lf.lfHeight);
                    focus = i;
                    break;
                }
            }
            if (focus == -1) {
                _snprintf (szTmp, sizeof(szTmp), "%u", lf.lfHeight);
                focus = (int)SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)szTmp);
                SendMessage (hwnd, CB_SETITEMDATA, focus, (DWORD_PTR)lf.lfHeight);
            }

            break;

        case CFP_WIDTH:
            // Lets just toss in a range of widths, from 0 to 72, by twos
            // If the user wants to enter in a custom value, they need to use
            // the 'CreateFont' dialog for now.
            for (i=0; i<72; i+=2) {
                if (i==0) {
                    _snprintf (szTmp, sizeof(szTmp), "%u = default aspect", i);
                } else {
                    _snprintf (szTmp, sizeof(szTmp), "%u", i);
                }
                SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)szTmp);
                SendMessage (hwnd, CB_SETITEMDATA, index++, (DWORD_PTR)i);
            }
            for (i=0; i<index; i++) {
                data = SendMessage (hwnd, CB_GETITEMDATA, i, 0);
                if (data == lf.lfWidth) {
                    focus = i;
                    break;
                } else if (data > lf.lfWidth) {
                    _snprintf (szTmp, sizeof(szTmp), "%u", lf.lfWidth);
                    SendMessage (hwnd, CB_INSERTSTRING, i, (DWORD_PTR)(LPSTR)szTmp);
                    SendMessage (hwnd, CB_SETITEMDATA, i, (DWORD_PTR)lf.lfWidth);
                    focus = i;
                    break;
                }
            }
            break;

        case CFP_ESCAPEMENT:
            for (i=0; i<4500; i+=10) {
                _snprintf (szTmp, sizeof(szTmp), "%u = (%u/10 degrees)", i, i);
                SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)szTmp);
                SendMessage (hwnd, CB_SETITEMDATA, index++, (DWORD_PTR)i);
            }
            for (i=0; i<index; i++) {
                data = SendMessage (hwnd, CB_GETITEMDATA, i, 0);
                if (data == lf.lfEscapement) {
                    focus = i;
                    break;
                } else if (data > lf.lfEscapement) {
                    _snprintf (szTmp, sizeof(szTmp), "%u = (%u/10 degrees)", lf.lfEscapement, data);
                    SendMessage (hwnd, CB_INSERTSTRING, i, (DWORD_PTR)(LPSTR)szTmp);
                    SendMessage (hwnd, CB_SETITEMDATA, i, (DWORD_PTR)lf.lfEscapement);
                    focus = i;
                    break;
                }
            }
            break;

        case CFP_ORIENTATION:
            for (i=0; i<4500; i+=10) {
                _snprintf (szTmp, sizeof(szTmp), "%u = (%u/10 degrees)", i, i);
                SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)szTmp);
                SendMessage (hwnd, CB_SETITEMDATA, index++, (DWORD_PTR)i);
            }
            for (i=0; i<index; i++) {
                data = SendMessage (hwnd, CB_GETITEMDATA, i, 0);
                if (data == lf.lfOrientation) {
                    focus = i;
                    break;
                } else if (data > lf.lfOrientation) {
                    _snprintf (szTmp, sizeof(szTmp), "%u = (%u/10 degrees)", lf.lfOrientation, data);
                    SendMessage (hwnd, CB_INSERTSTRING, i, (DWORD_PTR)(LPSTR)szTmp);
                    SendMessage (hwnd, CB_SETITEMDATA, i, (DWORD_PTR)lf.lfOrientation);
                    focus = i;
                    break;
                }
            }
            break;

        case CFP_WEIGHT:
            index = 0;
            SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"0 = FW_DONTCARE");
            SendMessage (hwnd, CB_SETITEMDATA, index++, 0);
            SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"100 = FW_THIN");
            SendMessage (hwnd, CB_SETITEMDATA, index++, 100);
            SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"200 = FW_EXTRALIGHT");
            SendMessage (hwnd, CB_SETITEMDATA, index++, 200);
            SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"300 = FW_LIGHT");
            SendMessage (hwnd, CB_SETITEMDATA, index++, 300);
            SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"400 = FW_NORMAL");
            SendMessage (hwnd, CB_SETITEMDATA, index++, 400);
            SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"500 = FW_MEDIUM");
            SendMessage (hwnd, CB_SETITEMDATA, index++, 500);
            SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"600 = FW_SEMIBOLD");
            SendMessage (hwnd, CB_SETITEMDATA, index++, 600);
            SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"700 = FW_BOLD");
            SendMessage (hwnd, CB_SETITEMDATA, index++, 700);
            SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"800 = FW_EXTRABOLD");
            SendMessage (hwnd, CB_SETITEMDATA, index++, 800);
            SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"900 = FW_HEAVY");
            SendMessage (hwnd, CB_SETITEMDATA, index++, 900);

            for (i=0; i<index; i++) {
                data = SendMessage (hwnd, CB_GETITEMDATA, i, 0);
                if (data == lf.lfWeight) {
                    focus = i;
                    break;
                } else if (data > lf.lfWeight) {
                    _snprintf (szTmp, sizeof(szTmp), "%u", lf.lfWeight);
                    SendMessage (hwnd, CB_INSERTSTRING, i, (DWORD_PTR)(LPSTR)szTmp);
                    focus = i;
                    break;
                }
            }
            break;

        case CFP_ITALIC:
            SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"FALSE");
            SendMessage (hwnd, CB_SETITEMDATA, 0, (DWORD_PTR)FALSE);
            SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"TRUE");
            SendMessage (hwnd, CB_SETITEMDATA, 1, (DWORD_PTR)TRUE);
            focus = (lf.lfItalic?1:0);
            break;

        case CFP_UNDERLINE:
            index=0;
            SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"FALSE");
            SendMessage (hwnd, CB_SETITEMDATA, index++, (DWORD_PTR)FALSE);
            SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"TRUE");
            SendMessage (hwnd, CB_SETITEMDATA, index++, (DWORD_PTR)TRUE);
            focus = (lf.lfUnderline?1:0);
            break;

        case CFP_STRIKEOUT:
            index=0;
            SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"FALSE");
            SendMessage (hwnd, CB_SETITEMDATA, index++, (DWORD_PTR)FALSE);
            SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"TRUE");
            SendMessage (hwnd, CB_SETITEMDATA, index++, (DWORD_PTR)TRUE);  \
            focus = (lf.lfStrikeOut?1:0);
            break;

        case CFP_CHARSET:
            index = 0;
            SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"0 = ANSI_CHARSET");
            SendMessage (hwnd, CB_SETITEMDATA, index++, (DWORD_PTR)ANSI_CHARSET);
            SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"SYMBOL_CHARSET");
            SendMessage (hwnd, CB_SETITEMDATA, index++, (DWORD_PTR)SYMBOL_CHARSET);
            SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"SHIFTJIS_CHARSET");
            SendMessage (hwnd, CB_SETITEMDATA, index++, (DWORD_PTR)SHIFTJIS_CHARSET);
            SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"OEM_CHARSET");
            SendMessage (hwnd, CB_SETITEMDATA, index++, (DWORD_PTR)OEM_CHARSET);
            for (i=0; i<index; i++) {
                data = SendMessage (hwnd, CB_GETITEMDATA, i, 0);
                if (data == (long)lf.lfCharSet) {
                    focus = i;
                    break;
                }
            }
            break;

            break;

        case CFP_OUTPUTPRECISION:
            index=0;
            SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"0 = OUT_DEFAULT_PRECIS");
            SendMessage (hwnd, CB_SETITEMDATA, index++, (DWORD_PTR)OUT_DEFAULT_PRECIS);
            SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"OUT_STRING_PRECIS");
            SendMessage (hwnd, CB_SETITEMDATA, index++, (DWORD_PTR)OUT_STRING_PRECIS);
            SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"OUT_CHARACTER_PRECIS");
            SendMessage (hwnd, CB_SETITEMDATA, index++, (DWORD_PTR)OUT_CHARACTER_PRECIS);
            SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"OUT_STROKE_PRECIS");
            SendMessage (hwnd, CB_SETITEMDATA, index++, (DWORD_PTR)OUT_STROKE_PRECIS);
            for (i=0; i<index; i++) {
                data = SendMessage (hwnd, CB_GETITEMDATA, i, 0);
                if (data == (long)lf.lfOutPrecision) {
                    focus = i;
                    break;
                }
            }
            break;

        case CFP_CLIPPRECISION:
            index=0;
            SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"0 = CLIP_DEFAULT_PRECIS");
            SendMessage (hwnd, CB_SETITEMDATA, index++, (DWORD_PTR)CLIP_DEFAULT_PRECIS);
            SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"CLIP_CHARACTER_PRECIS");
            SendMessage (hwnd, CB_SETITEMDATA, index++, (DWORD_PTR)CLIP_CHARACTER_PRECIS);
            SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"CLIP_STROKE_PRECIS");
            SendMessage (hwnd, CB_SETITEMDATA, index++, (DWORD_PTR)CLIP_STROKE_PRECIS);
            for (i=0; i<index; i++) {
                data = SendMessage (hwnd, CB_GETITEMDATA, i, 0);
                if (data == (long)lf.lfClipPrecision) {
                    focus = i;
                    break;
                }
            }
            break;

        case CFP_QUALITY:
            index=0;
            SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"0 = DEFAULT_QUALITY");
            SendMessage (hwnd, CB_SETITEMDATA, index++, (DWORD_PTR)DEFAULT_QUALITY);
            SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"DRAFT_QUALITY");
            SendMessage (hwnd, CB_SETITEMDATA, index++, (DWORD_PTR)DRAFT_QUALITY);
            SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"PROOF_QUALITY");
            SendMessage (hwnd, CB_SETITEMDATA, index++, (DWORD_PTR)PROOF_QUALITY);
            for (i=0; i<index; i++) {
                data = SendMessage (hwnd, CB_GETITEMDATA, i, 0);
                if (data == (long)lf.lfQuality) {
                    focus = i;
                    break;
                }
            }
            break;

        case CFP_PITCH:
            index=0;
            SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"0 = DEFAULT_PITCH");
            SendMessage (hwnd, CB_SETITEMDATA, index++, (DWORD)DEFAULT_PITCH);
            SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"FIXED_PITCH");
            SendMessage (hwnd, CB_SETITEMDATA, index++, (DWORD_PTR)FIXED_PITCH);
            SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"VARIABLE_PITCH");
            SendMessage (hwnd, CB_SETITEMDATA, index++, (DWORD_PTR)VARIABLE_PITCH);
            for (i=0; i<index; i++) {
                data = SendMessage (hwnd, CB_GETITEMDATA, i, 0);
                if (data == (long)(0x03&lf.lfPitchAndFamily)) {
                    focus = i;
                    break;
                }
            }
            break;

        case CFP_FAMILY:
            index=0;
            SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"0 = FF_DONTCARE");
            SendMessage (hwnd, CB_SETITEMDATA, index++, (DWORD_PTR)FF_DONTCARE);
            SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"FF_ROMAN");
            SendMessage (hwnd, CB_SETITEMDATA, index++, (DWORD)FF_ROMAN);
            SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"FF_SWISS");
            SendMessage (hwnd, CB_SETITEMDATA, index++, (DWORD_PTR)FF_SWISS);
            SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"FF_MODERN");
            SendMessage (hwnd, CB_SETITEMDATA, index++, (DWORD)FF_MODERN);
            SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"FF_SCRIPT");
            SendMessage (hwnd, CB_SETITEMDATA, index++, (DWORD_PTR)FF_SCRIPT);
            SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"FF_DECORATIVE");
            SendMessage (hwnd, CB_SETITEMDATA, index++, (DWORD_PTR)FF_DECORATIVE);
            for (i=0; i<index; i++) {
                data = SendMessage (hwnd, CB_GETITEMDATA, i, 0);
                if (data == (long)(0xFC&lf.lfPitchAndFamily)) {
                    focus = i;
                    break;
                }
            }
            break;

        case CFP_FACENAME:
            index = (int)SendMessage (hwnd, CB_ADDSTRING, 0, (DWORD_PTR)(LPSTR)"(none)");
            SendMessage (hwnd, CB_SETITEMDATA, index, 0);
            if (lstrcmp(lf.lfFaceName, "(none)") == 0) {
                lf.lfFaceName[0] = 0;
            }
            hdc = GetDC (hwnd);

            hInst = (HINSTANCE)GetWindowLongPtr (hwnd, GWLP_HINSTANCE);
            lpEnumFonts = MakeProcInstance ((FARPROC)EnumFontNames, hInst);
            EnumFonts (hdc, NULL, (FONTENUMPROC)lpEnumFonts, (LPARAM)&hwnd);
            FreeProcInstance (lpEnumFonts);
            ReleaseDC (hwnd, hdc);
            atom = GlobalFindAtom ((LPSTR)lf.lfFaceName);
            if (atom == (ATOM)0 && (lstrlen (lf.lfFaceName)>0)) {
                index = (int)SendMessage (hwnd, CB_ADDSTRING, 0, (LONG_PTR)(LPSTR)lf.lfFaceName);
                focus = index;
            } else if (lstrlen(lf.lfFaceName)==0) {
                index = (int)SendMessage (hwnd, CB_FINDSTRING, (UINT)-1, (LONG_PTR)(LPSTR)"(none)");
                focus = index;
            } else {
                index = (int)SendMessage (hwnd, CB_GETCOUNT, 0, 0);
                for (i=0; i<index; i++) {
                    data = SendMessage (hwnd, CB_GETITEMDATA, i, 0);
                    if ((DWORD)data == (DWORD)atom) {
                        focus = i;
                        break;
                    }
                }
            }
            break;
    }
    if (focus >= 0) {
        SendMessage (hwnd, CB_SETCURSEL, focus, 0);
    } else {
        SendMessage (hwnd, CB_SETCURSEL, 0, 0);
    }
    return TRUE;
}

BYTE FindChar | ( | HDC | hdc,
 |  | RECT * | pRect,
 |  | int | x,
 |  | int | y
 | ) |  |

Definition at line 125 of file Display.c.

{
    BYTE *pch;
    int h, w, incx, incy, width;
    unsigned int wDisplay;
    POINT pt;
    TEXTMETRIC tm;

    GetTextMetrics (hdc, &tm);
    h = tm.tmHeight;
    w = tm.tmMaxCharWidth;

    incx = 0;
    incy = h;
    pt.x = 0;
    pt.y = 0;

    pch = (BYTE*)&(ascii[tm.tmFirstChar]);

    if (!pRect)
    {
        return 0xFF;
    }

    wDisplay = pRect->right -pRect->left;

    while (pch[0] && (pch[0]<=tm.tmLastChar)) {
    SIZE size;
        GetTextExtentPoint (hdc, (LPCTSTR)pch, 1, &size);
        width = size.cx;
        if ((unsigned)(pt.x + width) > wDisplay) {
            pt.x = 0;
            pt.y += incy;
        }
        if ((x>=pt.x) && (x <=(pt.x+width)) && (y>=pt.y) && (y<=pt.y+incy)) {
            return pch[0];
        }
        pt.x += width;
        pch++;
    }
    return 0;
}

BOOL InitStatusBar ( HANDLE )

Definition at line 38 of file Status.c.

{
    WNDCLASS    wndclass;

    hbrBtnFace = CreateSolidBrush(GetSysColor(COLOR_BTNFACE));

    wndclass.style         = CS_HREDRAW | CS_VREDRAW;
    wndclass.lpfnWndProc   = (WNDPROC)StatusProc;
    wndclass.cbClsExtra    = 0;
    wndclass.cbWndExtra    = 0;
    wndclass.hInstance      = hInstance;
    wndclass.hIcon     = NULL;
    wndclass.hCursor       = LoadCursor (NULL, IDC_ARROW);
    wndclass.hbrBackground = hbrBtnFace;
    wndclass.lpszMenuName  = NULL;
    wndclass.lpszClassName = "SamplerStatus";

    if (!RegisterClass (&wndclass))
        return FALSE;

    wndclass.style         = CS_HREDRAW | CS_VREDRAW;
    wndclass.lpfnWndProc   = (WNDPROC)StatusFieldProc;
    wndclass.cbClsExtra    = 0;
    wndclass.cbWndExtra    = 0;
    wndclass.hInstance      = hInstance;
    wndclass.hIcon     = NULL;
    wndclass.hCursor       = LoadCursor (NULL, IDC_ARROW);
    wndclass.hbrBackground = hbrBtnFace;
    wndclass.lpszMenuName  = NULL;
    wndclass.lpszClassName = "StatusField";

    if (!RegisterClass (&wndclass))
        return FALSE;

  return TRUE;
}

BOOL InitToolBar ( HANDLE )

Definition at line 45 of file Tools.c.

{
        WNDCLASS    wndclass;

        hbrBtnFace = CreateSolidBrush(GetSysColor(COLOR_BTNFACE));
        hbrWindow = CreateSolidBrush(GetSysColor(COLOR_WINDOW));

        wndclass.style         = CS_HREDRAW | CS_VREDRAW;
        wndclass.lpfnWndProc   = (WNDPROC)ToolsProc;
        wndclass.cbClsExtra    = 0;
        wndclass.cbWndExtra    = 0;
        wndclass.hInstance      = hInstance;
        wndclass.hIcon     = NULL;
        wndclass.hbrBackground = hbrBtnFace;
        wndclass.hCursor       = LoadCursor (NULL, IDC_ARROW);
        wndclass.lpszMenuName  = NULL;
        wndclass.lpszClassName = "SamplerTools";

        if (!RegisterClass (&wndclass))
        {
            return FALSE;
        }

        return TRUE;
}

BOOL APIENTRY MetricsDlgProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 291 of file Dialogs.c.

{
static LOGFONT lfDlg;
static LPLOGFONT lplf;
static TEXTMETRIC tm;
static char szFacename[LF_FACESIZE];
    int wmId;
    BOOL bDone;
    TEXTMETRIC tmTmp;
    HFONT hfont, hfontPrev;
    HDC   hdc;
    char szBuffer[LF_FACESIZE+15];

    switch (msg) {
        case WM_INITDIALOG:
            CenterWindow (hwnd, GetWindow (hwnd, GW_OWNER));
            lplf = (LOGFONT *)lParam;
            lfDlg = *lplf;

            hfont = CreateFontIndirect (&lfDlg);
            hdc = GetDC (hwnd);
            hfontPrev = SelectObject (hdc, hfont);
            GetTextMetrics (hdc, &tm);
            GetTextFace    (hdc, sizeof(szFacename), szFacename);
            SelectObject (hdc, hfontPrev);
            DeleteObject (hfont);
            ReleaseDC (hwnd, hdc);

            if (_snprintf (szBuffer, sizeof(szBuffer) - 1, "TextMetrics: %s", (LPSTR)szFacename) > 0 )
            {
                szBuffer[sizeof(szBuffer) - 1] = '\0';
                SetWindowText (hwnd, szBuffer);
            }

            SetDlgItemInt (hwnd, TMD_HEIGHT, (int)tm.tmHeight, TRUE);
            SetDlgItemInt (hwnd, TMD_ASCENT, (int)tm.tmAscent, TRUE);
            SetDlgItemInt (hwnd, TMD_DESCENT, (int)tm.tmDescent, TRUE);
            SetDlgItemInt (hwnd, TMD_INTERNAL, (int)tm.tmInternalLeading, TRUE);
            SetDlgItemInt (hwnd, TMD_EXTERNAL, (int)tm.tmExternalLeading, TRUE);
            SetDlgItemInt (hwnd, TMD_AVEWIDTH, (int)tm.tmAveCharWidth, TRUE);
            SetDlgItemInt (hwnd, TMD_MAXWIDTH, (int)tm.tmMaxCharWidth, TRUE);
            SetDlgItemInt (hwnd, TMD_WEIGHT, (int)tm.tmWeight, TRUE);
            SetDlgItemInt (hwnd, TMD_ITALIC, (int)tm.tmItalic, FALSE);
            SetDlgItemInt (hwnd, TMD_UNDERLINE, (int)tm.tmUnderlined, FALSE);
            SetDlgItemInt (hwnd, TMD_STRUCKOUT, (int)tm.tmStruckOut, FALSE);
            SetDlgItemInt (hwnd, TMD_FIRSTCHAR, (int)tm.tmFirstChar, FALSE);
            SetDlgItemInt (hwnd, TMD_LASTCHAR, (int)tm.tmLastChar, FALSE);
            SetDlgItemInt (hwnd, TMD_DEFAULTCHAR, (int)tm.tmDefaultChar, FALSE);
            SetDlgItemInt (hwnd, TMD_BREAKCHAR, (int)tm.tmBreakChar, FALSE);
            SetDlgItemInt (hwnd, TMD_PITCHANDFAMILY, (int)tm.tmPitchAndFamily, FALSE);
            SetDlgItemInt (hwnd, TMD_CHARSET, (int)tm.tmCharSet, FALSE);
            SetDlgItemInt (hwnd, TMD_OVERHANG, (int)tm.tmOverhang, TRUE);
            SetDlgItemInt (hwnd, TMD_DIGITIZEDASPECTX, (int)tm.tmDigitizedAspectX, TRUE);
            SetDlgItemInt (hwnd, TMD_DIGITIZEDASPECTY, (int)tm.tmDigitizedAspectY, TRUE);

            return TRUE;

        case WM_COMMAND:
            wmId = LOWORD(wParam);
            switch (wmId) {
                case IDOK:
                    // Lets pull in as much data from the TEXTMETRIC structure as possible...
                    lfDlg.lfHeight         = tm.tmHeight;
                    lfDlg.lfWidth          = tm.tmAveCharWidth;
                    //lfDlg.lfEscapement - No Use
                    //lfDlg.lfOrientation - No Use
                    lfDlg.lfWeight         = tm.tmWeight;
                    lfDlg.lfItalic         = tm.tmItalic;
                    lfDlg.lfUnderline      = tm.tmUnderlined;
                    lfDlg.lfStrikeOut      = tm.tmStruckOut;
                    lfDlg.lfCharSet        = tm.tmCharSet;
                    //lfDlg.lfOutPrecision - No Use
                    //lfDlg.lfClipPrecision - No Use
                    //lfDlg.lfQuality - No Use
                    lfDlg.lfPitchAndFamily = tm.tmPitchAndFamily;
                    lstrcpyn(lfDlg.lfFaceName, szFacename, LF_FACESIZE);

                    // Lets create a font with this new data
                    hfont = CreateFontIndirect (&lfDlg);
                    hdc = GetDC (hwnd);
                    hfontPrev = SelectObject (hdc, hfont);
                    GetTextMetrics (hdc, &tmTmp);
                    // Get the face name
                    GetTextFace    (hdc, sizeof(szBuffer), szBuffer);
                    SelectObject (hdc, hfontPrev);
                    DeleteObject (hfont);
                    ReleaseDC (hwnd, hdc);

                    // And verify that we did indeed get the same font.
                    bDone = TRUE;
                    bDone = bDone && (tm.tmHeight==tmTmp.tmHeight);
                    bDone = bDone && (tm.tmAscent==tmTmp.tmAscent);
                    bDone = bDone && (tm.tmDescent==tmTmp.tmDescent);
                    bDone = bDone && (tm.tmInternalLeading==tmTmp.tmInternalLeading);
                    bDone = bDone && (tm.tmExternalLeading==tmTmp.tmExternalLeading);
                    bDone = bDone && (tm.tmAveCharWidth==tmTmp.tmAveCharWidth);
                    bDone = bDone && (tm.tmMaxCharWidth==tmTmp.tmMaxCharWidth);
                    bDone = bDone && (tm.tmWeight==tmTmp.tmWeight);
                    bDone = bDone && (tm.tmItalic==tmTmp.tmItalic);
                    bDone = bDone && (tm.tmUnderlined==tmTmp.tmUnderlined);
                    bDone = bDone && (tm.tmStruckOut==tmTmp.tmStruckOut);
                    bDone = bDone && (tm.tmFirstChar==tmTmp.tmFirstChar);
                    bDone = bDone && (tm.tmLastChar==tmTmp.tmLastChar);
                    bDone = bDone && (tm.tmDefaultChar==tmTmp.tmDefaultChar);
                    bDone = bDone && (tm.tmBreakChar==tmTmp.tmBreakChar);
                    bDone = bDone && (tm.tmPitchAndFamily==tmTmp.tmPitchAndFamily);
                    bDone = bDone && (tm.tmCharSet==tmTmp.tmCharSet);
                    // Did it work?
                    if (bDone) {
                        *lplf = lfDlg;
                        EndDialog(hwnd, TRUE);
                        return TRUE;
                    } else {
                        // We need to take a close look at the font verification
                        // code. Currently, it sometimes will report that the
                        // font didn't get properly selected, even if it did.
                        *lplf = lfDlg;
                        EndDialog(hwnd, TRUE);
                        return TRUE;

                        // This is what we want to do once we beef up the font
                        // verification code:
                        //lfDlg = *lplf;
                        //MessageBox (GetFocus(),
                        //    "Unable to re-create font from TextMetrics",
                        //    "FontView", MB_OK);
                    }
                    break;

                case IDCANCEL:
                    EndDialog(hwnd, TRUE);
                    return TRUE;

            }
            break;
    }
    return FALSE;

    /* Just For Reference */
    lParam;
}

BOOL APIENTRY SimpleDlgProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |
int StatusBarHeight ( HWND )

Definition at line 91 of file Status.c.

{
    RECT rect;
    GetClientRect (hwndStatus, &rect);
    return rect.bottom-rect.top;

    hwnd; // unreferenced formal parameter
}

int ToolBarHeight ( HWND )

Definition at line 119 of file Tools.c.

{
        RECT rect;
        GetClientRect (hwndTools, &rect);
        return rect.bottom-rect.top;

        hwnd; //unreferenced formal parameter
}

int APIENTRY WinMain | ( | HINSTANCE | hInst,
 |  | HINSTANCE | hPrevInst,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 84 of file FontView.c.

{

    MSG         msg;
    WNDCLASS    wndclass;
    HANDLE      hAccelTable;

    if (!hPrevInst) {
        wndclass.style         = CS_HREDRAW | CS_VREDRAW;
        wndclass.lpfnWndProc   = (WNDPROC)WndProc;
        wndclass.cbClsExtra    = 0;
        wndclass.cbWndExtra    = 0;
        wndclass.hInstance     = hInst;
        wndclass.hIcon         = LoadIcon (hInst, szAppName);
        wndclass.hCursor       = LoadCursor (NULL, IDC_ARROW);
        wndclass.hbrBackground = (HBRUSH)(COLOR_APPWORKSPACE+1);
        wndclass.lpszMenuName  = szAppName;
        wndclass.lpszClassName = szAppName;

        if (!RegisterClass (&wndclass)) {
            return FALSE;
        }

        wndclass.style         = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
        wndclass.lpfnWndProc   = (WNDPROC)ClientProc;
        wndclass.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
        wndclass.lpszMenuName  = NULL;
        wndclass.lpszClassName = "FontClient";

        if (!RegisterClass (&wndclass)) {
            return FALSE;
        }

        fpCharSetProc = MakeProcInstance ((WNDPROC)ClientCharSetProc, hInst);
        fpGlyphProc   = MakeProcInstance ((WNDPROC)ClientGlyphProc, hInst);

        if (!InitToolBar (hInst)) {
            return FALSE;
        }

        if (!InitStatusBar (hInst)) {
            return FALSE;
        }
    }

    hwndMain = CreateWindow (szAppName, szAppName,
        WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
        CW_USEDEFAULT, 0,
        CW_USEDEFAULT, 0,
        NULL, NULL, hInst, NULL);

    if (!hwndMain) {
        return FALSE;
    }
    /* Get handles to the various menus. Some of these we will use later */
    /* to display menu descriptions in the status bar */
        hSysMenuMain = GetSystemMenu(hwndMain,FALSE);
    hMenu = GetMenu(hwndMain);
    if (hMenu) {
        hFileMenu = GetSubMenu(hMenu,0);
        hEditMenu = GetSubMenu(hMenu,1);
        hViewMenu = GetSubMenu(hMenu, 2);
        hMetricsMenu = GetSubMenu(hMenu,3);
        hHelpMenu = GetSubMenu(hMenu,4);
    }

    if (CreateToolBar (hwndMain, hInst, ID_TOOLBAR)) {
        hwndLabel1 = AddToolLabel (hInst, 0, "CreateFont:", 0, SS_RIGHT);
        AddToolSpace (6, 0);
        hwndCreateParam = AddToolCombo (hInst, ID_CREATEPARAM, -25, CBS_DROPDOWN | WS_VSCROLL);
        FillInParam (hwndCreateParam, 0);

        AddToolSpace (10, 0);
        hwndCreateValue = AddToolCombo (hInst, ID_CREATEVALUE, -30, CBS_DROPDOWN | WS_VSCROLL);
        FillInValue (hwndCreateValue, CFP_BASE+0);

        AddToolSpace (10, 0);
        hwndZoom = AddToolButton (hInst, ID_ZOOM, "ZOOM", 24, 0, BS_OWNERDRAW);

    } else {
        return FALSE;
    }

    if (CreateStatusBar (hwndMain, hInst, ID_STATUSBAR)) {
        hwndMenuField = AddStatusField (hInst, ID_MENUFIELD, 100, 0, FALSE);
        hwndTimeField = AddStatusField (hInst, ID_TIMEFIELD, -13, -13, TRUE);
        if (hwndTimeField) {
            SetTimer (hwndMain, 1, 1000, NULL);
        }
    } else {
        return FALSE;
    }

    hwndClient = CreateWindow ("FontClient", "FontClient",
        WS_CHILD | WS_CLIPSIBLINGS | WS_BORDER | WS_VISIBLE,
        0, 0, 0, 0,
        hwndMain,(HMENU)666, hInst, NULL);

    SetWindowLongPtr (hwndClient, GWLP_WNDPROC, (DWORD_PTR)fpCharSetProc);
    bZoomed = FALSE;

    if (!hwndMain) {
        return FALSE;
    }

    ShowWindow (hwndMain, nCmdShow);
    InvalidateRect (hwndZoom, NULL, TRUE);

    hAccelTable = LoadAccelerators (hInst, szAppName);

    while (GetMessage (&msg, NULL, 0, 0)) {
        if (!TranslateAccelerator (hwndMain, hAccelTable, &msg)) {
            TranslateMessage (&msg);
            DispatchMessage (&msg);
        }
    }

    return (int)msg.wParam;

    lpCmdLine; // Just to resolve reference
}

LONG_PTR APIENTRY WndProc | ( | HWND | hwnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 673 of file FontView.c.

{
    HINSTANCE hInst = 0;
    HDC hdc;
    PAINTSTRUCT ps;
    FARPROC lpDlgFunc;
    char    szMsg [80];
    time_t  lTime;
    struct tm *datetime;

#define HOUR (datetime->tm_hour)
#define MIN (datetime->tm_min)
#define SEC (datetime->tm_sec)

    char    szTime [20];
    int     index;
    RECT rect;

static INT_PTR  idMenuSelect;
    INT_PTR     tmp;
    LONG_PTR wmEvent, wmId;
    HWND    wmhWnd;
    POINT   point;
    BOOL bRedraw;
    INT_PTR wmMenuCmd, wmFlags;
    HMENU wmhMenu;

        if (hwnd) {
        hInst = (HINSTANCE)GetWindowLongPtr (hwnd, GWLP_HINSTANCE);
        }

    switch (msg) {
    case WM_CREATE:
            return DefWindowProc (hwnd, msg, wParam, lParam);
            break;

        case WM_TIMER:
            time (&lTime);
            datetime = localtime (&lTime);
            _snprintf (szTime, sizeof(szTime), "%02d:%02d:%02d %s",
            (HOUR%12?HOUR%12:12), MIN, SEC, (LPSTR)(HOUR/12?"PM":"AM"));
            SetWindowText (hwndTimeField, szTime);
            break;

        case WM_SIZE:
            AdjustToolBar (hwnd);
            AdjustStatusBar (hwnd);
            GetClientRect (hwnd, &rect);
            rect.top += ToolBarHeight (hwnd);
            rect.bottom -= StatusBarHeight (hwnd);
            SetWindowPos (hwndClient, NULL, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, SWP_NOZORDER);
            break;

        case WM_CHAR:
            switch (wParam) {
                case VK_F10:
                    wParam = VK_MENU;
                    return DefWindowProc (hwnd, msg, wParam, lParam);
                    break;
            }
            break;

        case WM_PARENTNOTIFY:
            wmEvent = wParam;
            point.x = (int)LOWORD(lParam);
            point.y = (int)HIWORD(lParam);

            ClientToScreen (hwnd, &point);
            wmhWnd  = WindowFromPoint(point);
            if (wmhWnd) {
                wmId = GetWindowLongPtr (wmhWnd, GWLP_ID);
                        } else {
                                break;
                        }
            switch (wmEvent) {
                case WM_LBUTTONDOWN:
                case WM_MBUTTONDOWN:
                case WM_RBUTTONDOWN:
                    if (!LoadString (hInst, (UINT)wmId, szMsg, sizeof(szMsg))) {
                        _snprintf ((LPSTR)szMsg, sizeof(szMsg), "Unable to load ParentNotify string #%u", wmId);
                    }
                    SetWindowText (hwndMenuField, szMsg);
                    break;
            }
            break;

        case WM_COMMAND:
            wmId = LOWORD(wParam);
            wmEvent = HIWORD(wParam);
            switch (wmId) {
                case ID_CREATEPARAM:

                    switch (wmEvent) {
                        case CBN_SETFOCUS: //Indicates that the combo box has received input focus.
                        case CBN_DROPDOWN: //Informs the owner of the combo box that its list box is about to be dropped down.
                            if (!LoadString (hInst, (UINT) wmId, szMsg, sizeof(szMsg))) {
                                _snprintf ((LPSTR)szMsg, sizeof(szMsg), "Unable to load FontName string #%u", wmId);
                            }
                            SetWindowText (hwndMenuField, szMsg);
                            break;

                        case CBN_SELCHANGE: //Sent when the selection has been changed.
                            index = (int)SendMessage (hwndCreateParam, CB_GETCURSEL, 0, 0);
                            if (index != CB_ERR) {
                                SendMessage (hwndCreateParam, CB_GETLBTEXT, index, (LONG_PTR)(LPSTR)szMsg);
                                FillInValue (hwndCreateValue, CFP_BASE+index);
                            } else {
                                _snprintf (szMsg, sizeof(szMsg), "FontName: CB_ERR while retrieving text");
                            }
                            SetWindowText (hwndMenuField, szMsg);
                            break;
                    }
                    break;

                case ID_CREATEVALUE:
                    switch (wmEvent){
                        int iCreateParam;
                        int iParamValue;

                        case CBN_SETFOCUS: //Indicates that the combo box has received input focus.
                        case CBN_DROPDOWN: //Informs the owner of the combo box that its list box is about to be dropped down.
                            if (!LoadString (hInst, (UINT)wmId, szMsg, sizeof(szMsg))) {
                                _snprintf (szMsg, sizeof(szMsg), "Unable to load FontSize string #%u", wmId);
                            }
                            break;

                        case CBN_SELCHANGE: //Sent when the selection has been changed.
                            index = (int)SendMessage (hwndCreateValue, CB_GETCURSEL, 0, 0);
                            bRedraw = FALSE;
                            if (index != CB_ERR) {
                                SendMessage (hwndCreateValue, CB_GETLBTEXT, index, (LONG_PTR)(LPSTR)szMsg);
                                iCreateParam =
                                    (int)SendMessage (hwndCreateParam, CB_GETITEMDATA,
                                        (DWORD_PTR)SendMessage (hwndCreateParam, CB_GETCURSEL, 0, (DWORD_PTR)0),
                                    (DWORD_PTR)0);
                                iParamValue = (int)SendMessage (hwndCreateValue, CB_GETITEMDATA, index, 0);

                                switch (iCreateParam) {
                                    BYTE tmpByte;

                                    case CFP_HEIGHT:
                                        if (lf.lfHeight != iParamValue) {
                                            lf.lfHeight = iParamValue;
                                            bRedraw = TRUE;
                                        }
                                        break;

                                    case CFP_WIDTH:
                                        if (lf.lfWidth != iParamValue) {
                                            lf.lfWidth = iParamValue;
                                            bRedraw = TRUE;
                                        }
                                        break;

                                    case CFP_ESCAPEMENT:
                                        if (lf.lfEscapement != iParamValue) {
                                            lf.lfEscapement= iParamValue;
                                            bRedraw = TRUE;
                                        }
                                        break;

                                    case CFP_ORIENTATION:
                                        if (lf.lfOrientation!= iParamValue) {
                                            lf.lfOrientation= iParamValue;
                                            bRedraw = TRUE;
                                        }
                                        break;

                                    case CFP_WEIGHT:
                                        if (lf.lfWeight != iParamValue) {
                                            lf.lfWeight= iParamValue;
                                            bRedraw = TRUE;
                                        }
                                        break;

                                    case CFP_ITALIC:
                                        if ((int)lf.lfItalic != iParamValue) {
                                            lf.lfItalic = (BYTE)iParamValue;
                                            bRedraw = TRUE;
                                        }
                                        break;

                                    case CFP_UNDERLINE:
                                        if (lf.lfUnderline != (BYTE)iParamValue) {
                                            lf.lfUnderline= (BYTE)iParamValue;
                                            bRedraw = TRUE;
                                        }
                                        break;

                                    case CFP_STRIKEOUT:
                                        if (lf.lfStrikeOut != (BYTE)iParamValue) {
                                            lf.lfStrikeOut= (BYTE)iParamValue;
                                            bRedraw = TRUE;
                                        }
                                        break;

                                    case CFP_CHARSET:
                                        if (lf.lfCharSet != (BYTE)iParamValue) {
                                            lf.lfCharSet= (BYTE)iParamValue;
                                            bRedraw = TRUE;
                                        }
                                        break;

                                    case CFP_OUTPUTPRECISION:
                                        if (lf.lfOutPrecision != (BYTE)iParamValue) {
                                            lf.lfOutPrecision = (BYTE)iParamValue;
                                            bRedraw = TRUE;
                                        }
                                        break;

                                    case CFP_CLIPPRECISION:
                                        if (lf.lfClipPrecision != (BYTE)iParamValue) {
                                            lf.lfClipPrecision = (BYTE)iParamValue;
                                            bRedraw = TRUE;
                                        }
                                        break;

                                    case CFP_QUALITY:
                                        if (lf.lfQuality != (BYTE)iParamValue) {
                                            lf.lfQuality = (BYTE)iParamValue;
                                            bRedraw = TRUE;
                                        }
                                        break;

                                    case CFP_PITCH:
                                        tmpByte = lf.lfPitchAndFamily;
                                        tmpByte &= 0xFC;
                                        tmpByte |= iParamValue;
                                        if (tmpByte != lf.lfPitchAndFamily) {
                                            lf.lfPitchAndFamily = tmpByte;
                                            bRedraw = TRUE;
                                        }
                                        break;

                                    case CFP_FAMILY:
                                        tmpByte = lf.lfPitchAndFamily;
                                        tmpByte &= 0x03;
                                        tmpByte |= iParamValue;
                                        if (tmpByte != lf.lfPitchAndFamily) {
                                            lf.lfPitchAndFamily = tmpByte;
                                            bRedraw = TRUE;
                                        }
                                        break;

                                    case CFP_FACENAME:
                                        if (lstrcmp (lf.lfFaceName, szMsg)!=0) {
                                            if (lstrcmp(lf.lfFaceName, "(none)") == 0) {
                                                lf.lfFaceName[0] = 0;
                                            } else {
                                                _snprintf (lf.lfFaceName, sizeof(lf.lfFaceName)/sizeof(TCHAR), "%s",(LPSTR)szMsg);
                                                bRedraw = TRUE;
                                            }
                                        }
                                        break;
                                }
                            } else {
                                _snprintf (szMsg, sizeof(szMsg), "CreateValue: CB_ERR while retrieving text");
                            }
                            if (bRedraw) {
                                InvalidateRect (hwndClient, NULL, TRUE);
                            }
                            SetWindowText (hwndMenuField, szMsg);
                            break;
                    }
                    break;

                // The Menu Selections
                case IDM_NEW:
                case IDM_OPEN:
                case IDM_CLOSE:
                case IDM_SAVE:
                case IDM_SAVEAS:
                case IDM_PRINT:
                case IDM_PRINTSET:
                    SetWindowText (hwndMenuField, "This command is not yet implemented.");
                    break;

                case IDM_EXIT:
                    DestroyWindow(hwnd);
                    break;

                case IDM_UNDO:
                case IDM_CUT:
                case IDM_COPY:
                case IDM_PASTE:
                case IDM_DELETE:
                case IDM_FIND:
                case IDM_REPLACE:
                    SetWindowText (hwndMenuField, "This command is not yet implemented.");
                    break;

                                case ID_ZOOM:
                                        if (bZoomed) {
                        SetWindowLongPtr (hwndClient, GWLP_WNDPROC, (LONG_PTR)fpCharSetProc);
                        bZoomed = FALSE;
                    } else {
                        SetWindowLongPtr (hwndClient, GWLP_WNDPROC, (LONG_PTR)fpGlyphProc);
                        bZoomed = TRUE;
                    }
                    InvalidateRect (hwndClient, NULL, TRUE);
                    break;

                case IDM_CHARSET: // Display the full characater set
                    SetWindowLongPtr (hwndClient, GWLP_WNDPROC, (LONG_PTR)fpCharSetProc);
                    InvalidateRect (hwndClient, NULL, TRUE);
                    bZoomed = FALSE;
                    break;

                case IDM_GLYPH: // Display a single glyph from the font
                    SetWindowLongPtr (hwndClient, GWLP_WNDPROC, (LONG_PTR)fpGlyphProc);
                    InvalidateRect (hwndClient, NULL, TRUE);
                    bZoomed = TRUE;
                    break;

                    break;

                case IDM_TOOLBAR: // This would hide the tool bar
                    SetWindowText (hwndMenuField, "This command is not yet implemented.");
                    break;

                case IDM_STATUSBAR: // This would hide the status bar
                    SetWindowText (hwndMenuField, "This command is not yet implemented.");
                    break;

                case IDM_CREATEFONT:
                    lpDlgFunc = MakeProcInstance((FARPROC) CreateDlgProc, hInst);
                    DialogBoxParam(hInst, "CreateFont", hwnd, (DLGPROC)lpDlgFunc, (DWORD_PTR)(LPLOGFONT)&lf);
                    FreeProcInstance(lpDlgFunc);
                    index = (int)SendMessage (hwndCreateParam, CB_GETCURSEL, 0, 0);
                    if (index != CB_ERR) {
                        FillInValue (hwndCreateValue, CFP_BASE+index);
                    } else {
                        _snprintf (szMsg, sizeof(szMsg), "CreateFont: CB_ERR while setting values");
                    }
                    InvalidateRect (hwndClient, NULL, TRUE);

                    break;

                case IDM_TEXTMETRIC:
                    lpDlgFunc = MakeProcInstance((FARPROC) MetricsDlgProc, hInst);
                    DialogBoxParam(hInst, "TextMetric", hwnd, (DLGPROC)lpDlgFunc, (DWORD_PTR)(LPLOGFONT)&lf);
                    FreeProcInstance(lpDlgFunc);
                    index = (int)SendMessage (hwndCreateParam, CB_GETCURSEL, 0, 0);
                    if (index != CB_ERR) {
                        FillInValue (hwndCreateValue, CFP_BASE+index);
                    } else {
                        _snprintf (szMsg, sizeof(szMsg), "CreateFont: CB_ERR while setting values");
                    }
                    InvalidateRect (hwndClient, NULL, TRUE);
                    break;

                case IDM_ENUMFONTS:
                    lpDlgFunc = MakeProcInstance((FARPROC) EnumDlgProc, hInst);
                    DialogBoxParam(hInst, "EnumFonts", hwnd, (DLGPROC)lpDlgFunc, (DWORD_PTR)(LPLOGFONT)&lf);
                    FreeProcInstance(lpDlgFunc);
                    index = (int)SendMessage (hwndCreateParam, CB_GETCURSEL, 0, 0);
                    if (index != CB_ERR) {
                        FillInValue (hwndCreateValue, CFP_BASE+index);
                    } else {
                        _snprintf (szMsg, sizeof(szMsg), "CreateFont: CB_ERR while setting values");
                    }
                    InvalidateRect (hwndClient, NULL, TRUE);
                    break;

                case IDM_OUTLINEMETRICS:
                    SetWindowText (hwndMenuField, "This command is not yet implemented.");
                    break;

                case IDM_HELP_CONTENTS:
                    WinHelp (hwnd, "FontView.HLP", HELP_KEY, (DWORD_PTR)(LPSTR)"CONTENTS");
                    break;
                case IDM_HELP_INDEX:
                    WinHelp (hwnd, "FontView.HLP", HELP_KEY, (DWORD_PTR)(LPSTR)"INDEX");
                    break;
                case IDM_HELP_OVERVIEW:
                    WinHelp (hwnd, "FontView.HLP", HELP_KEY, (DWORD_PTR)(LPSTR)"OVERVIEW");
                    break;
                case IDM_HELP_GLOSSARY:
                    WinHelp (hwnd, "FontView.HLP", HELP_KEY, (DWORD_PTR)(LPSTR)"GLOSSARY");
                    break;
                case IDM_HELP_TUTORIAL:
                    WinHelp (hwnd, "FontView.HLP", HELP_KEY, (DWORD_PTR)(LPSTR)"TUTORIAL");
                    break;
                case IDM_HELP_DEMO:
                    WinHelp (hwnd, "FontView.HLP", HELP_KEY, (DWORD_PTR)(LPSTR)"DEMO");
                    break;
                case IDM_HELP_HELP:
                    WinHelp (hwnd, "FontView.HLP", HELP_KEY, (DWORD_PTR)(LPSTR)"HELP");
                    break;

                case IDM_ABOUT:
                    lpDlgFunc = MakeProcInstance((FARPROC) SimpleDlgProc, hInst);
                    DialogBox(hInst,
                        (wmId==IDM_ABOUT)?"FONTVIEW":"UsageBox",
                        hwnd,
                        (DLGPROC)lpDlgFunc);
                    FreeProcInstance(lpDlgFunc);
                    break;

            }
            break;

    case WM_PAINT:
        hdc = BeginPaint (hwnd, &ps);
        EndPaint (hwnd, &ps);
        break;

    case WM_MENUSELECT:
        /* A menu item is hilited, get description text for status bar */
        tmp = idMenuSelect;

        wmMenuCmd = LOWORD(wParam);
        wmFlags = HIWORD(wParam);
        wmhMenu = (HMENU)lParam;

        if((wmhMenu == 0) && (wmFlags == -1)) {
                tmp = idMenuSelect = 0;
                SetWindowText(hwndMenuField, "Ready...");
        } else if(wmhMenu == 0) {
            /* don't do anything for this */
        } else if(wmFlags & MF_POPUP) {
            if((HMENU)wmMenuCmd == hSysMenuMain)
                    idMenuSelect = IDM_SYSMENU;
            else if((HMENU)wmMenuCmd == hFileMenu)
                    idMenuSelect = IDM_FILE;
            else if((HMENU)wmMenuCmd == hEditMenu)
                    idMenuSelect = IDM_EDIT;
            else if((HMENU)wmMenuCmd == hViewMenu)
                    idMenuSelect = IDM_VIEW;
            else if((HMENU)wmMenuCmd == hMetricsMenu)
                    idMenuSelect = IDM_DIALOG;
            else if((HMENU)wmMenuCmd == hHelpMenu)
                    idMenuSelect = IDM_HELP;
        } else {
            if(wmMenuCmd != 0) {            /* separators have wparam of 0 */
                idMenuSelect = wmMenuCmd;
            }
        }

        if (idMenuSelect != tmp) {
            if (!LoadString ( hInst, (int)idMenuSelect, szMsg, sizeof(szMsg))) {
                _snprintf ((LPSTR)szMsg, sizeof(szMsg), "Unable to load menu string #%u", idMenuSelect);
            }
            SetWindowText (hwndMenuField, szMsg);
        }
        break;

        case WM_QUERYENDSESSION:
            return (MessageBox (GetFocus(), "Exit Application?", szAppTitle,
                MB_ICONQUESTION | MB_YESNO) == IDYES);

        case WM_DESTROY:
            if (hwnd == hwndMain) {
                PostQuitMessage (0);
            }
            break;

        default:
            return DefWindowProc (hwnd, msg, wParam, lParam);
    }
    return 0L;
}

Variable Documentation

BOOL bZoomed = FALSE

Definition at line 26 of file FontView.c.

WNDPROC fpCharSetProc = 0

Definition at line 52 of file FontView.c.

WNDPROC fpGlyphProc = 0

Definition at line 53 of file FontView.c.

HMENU hEditMenu = (HMENU)NULL

Definition at line 36 of file FontView.c.

HMENU hFileMenu = (HMENU)NULL

Definition at line 35 of file FontView.c.

HMENU hHelpMenu = (HMENU)NULL

Definition at line 39 of file FontView.c.

HMENU hMenu = (HMENU)NULL

Definition at line 41 of file FontView.c.

HMENU hMetricsMenu = (HMENU)NULL

Definition at line 38 of file FontView.c.

HMENU hSysMenuAdv = (HMENU)NULL

Definition at line 40 of file FontView.c.

HMENU hSysMenuMain = (HMENU)NULL

Definition at line 34 of file FontView.c.

HMENU hViewMenu = (HMENU)NULL

Definition at line 37 of file FontView.c.

HWND hwndClient

Definition at line 28 of file FontView.c.

HWND hwndCreateParam

Definition at line 30 of file FontView.c.

HWND hwndCreateValue

Definition at line 30 of file FontView.c.

HWND hwndLabel1

Definition at line 30 of file FontView.c.

HWND hwndMain

Definition at line 28 of file FontView.c.

HWND hwndMenuField

Definition at line 29 of file FontView.c.

HWND hwndTimeField

Definition at line 29 of file FontView.c.

HWND hwndZoom

Definition at line 30 of file FontView.c.

LOGFONT lf = {0,0,0,0,0,0,0,0,0,0,0,0,0,""}

Definition at line 32 of file FontView.c.

char szAppName[] = "FontView"

Definition at line 23 of file FontView.c.

char szAppTitle[] = "FontView - A Font Examination Utility"

Definition at line 24 of file FontView.c.

Generated on Wed Nov 13 2024 16:53:37 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/Fonts/FontView/FontView.h File Reference

  • Multimedia
  • Gdi
  • Fonts
  • FontView
Defines

FontView.h File Reference

Go to the source code of this file.

Defines

#define | CFD_BASE 220
#define | CFD_CHARSET CFD_BASE+8
#define | CFD_CLIPPRECISION CFD_BASE+10
#define | CFD_DEFAULT CFD_BASE+14
#define | CFD_ESCAPEMENT CFD_BASE+2
#define | CFD_FACENAME CFD_BASE+13
#define | CFD_HEIGHT CFD_BASE+0
#define | CFD_ITALIC CFD_BASE+5
#define | CFD_ORIENTATION CFD_BASE+3
#define | CFD_OUTPUTPRECISION CFD_BASE+9
#define | CFD_PITCHANDFAMILY CFD_BASE+12
#define | CFD_QUALITY CFD_BASE+11
#define | CFD_STRIKEOUT CFD_BASE+7
#define | CFD_UNDERLINE CFD_BASE+6
#define | CFD_WEIGHT CFD_BASE+4
#define | CFD_WIDTH CFD_BASE+1
#define | CFP_BASE 200
#define | CFP_CHARSET CFP_BASE+8
#define | CFP_CLIPPRECISION CFP_BASE+10
#define | CFP_ESCAPEMENT CFP_BASE+2
#define | CFP_FACENAME CFP_BASE+14
#define | CFP_FAMILY CFP_BASE+13
#define | CFP_HEIGHT CFP_BASE+0
#define | CFP_ITALIC CFP_BASE+5
#define | CFP_ORIENTATION CFP_BASE+3
#define | CFP_OUTPUTPRECISION CFP_BASE+9
#define | CFP_PITCH CFP_BASE+12
#define | CFP_QUALITY CFP_BASE+11
#define | CFP_STRIKEOUT CFP_BASE+7
#define | CFP_UNDERLINE CFP_BASE+6
#define | CFP_WEIGHT CFP_BASE+4
#define | CFP_WIDTH CFP_BASE+1
#define | ED_BASE 260
#define | ED_HEX ED_BASE+4
#define | ED_NEXT ED_BASE+1
#define | ED_PREV ED_BASE+0
#define | ED_SAMPLE ED_BASE+5
#define | ED_SET ED_BASE+3
#define | ED_TYPE ED_BASE+2
#define | ID_CAPSFIELD ID_STATUSBAR+6
#define | ID_CREATEPARAM ID_TOOLBAR+1
#define | ID_CREATEVALUE ID_TOOLBAR+2
#define | ID_MENUFIELD ID_STATUSBAR+1
#define | ID_NUMFIELD ID_STATUSBAR+3
#define | ID_OVRFIELD ID_STATUSBAR+4
#define | ID_SCROLLFIELD ID_STATUSBAR+5
#define | ID_STATUSBAR 160
#define | ID_TIMEFIELD ID_STATUSBAR+2
#define | ID_TOOLBAR 150
#define | ID_ZOOM ID_TOOLBAR+3
#define | IDM_ABOUT IDM_HELP+8
#define | IDM_CHARSET IDM_VIEW+1
#define | IDM_CLOSE IDM_FILE+3
#define | IDM_COPY IDM_EDIT+3
#define | IDM_CREATEFONT IDM_DIALOG+1
#define | IDM_CUT IDM_EDIT+2
#define | IDM_DELETE IDM_EDIT+5
#define | IDM_DIALOG 130
#define | IDM_EDIT 110
#define | IDM_ENUMFONTS IDM_DIALOG+3
#define | IDM_EXIT IDM_FILE+8
#define | IDM_FILE 100
#define | IDM_FIND IDM_EDIT+6
#define | IDM_GLYPH IDM_VIEW+2
#define | IDM_HELP 140
#define | IDM_HELP_CONTENTS IDM_HELP+1
#define | IDM_HELP_DEMO IDM_HELP+6
#define | IDM_HELP_GLOSSARY IDM_HELP+4
#define | IDM_HELP_HELP IDM_HELP+7
#define | IDM_HELP_INDEX IDM_HELP+2
#define | IDM_HELP_OVERVIEW IDM_HELP+3
#define | IDM_HELP_TUTORIAL IDM_HELP+5
#define | IDM_NEW IDM_FILE+1
#define | IDM_OPEN IDM_FILE+2
#define | IDM_OUTLINEMETRICS IDM_DIALOG+4
#define | IDM_PASTE IDM_EDIT+4
#define | IDM_PRINT IDM_FILE+6
#define | IDM_PRINTSET IDM_FILE+7
#define | IDM_REPLACE IDM_EDIT+7
#define | IDM_SAVE IDM_FILE+4
#define | IDM_SAVEAS IDM_FILE+5
#define | IDM_STATUSBAR IDM_VIEW+4
#define | IDM_SYSMENU 666
#define | IDM_TEXTMETRIC IDM_DIALOG+2
#define | IDM_TOOLBAR IDM_VIEW+3
#define | IDM_UNDO IDM_EDIT+1
#define | IDM_VIEW 120
#define | TMD_ASCENT TMD_BASE+1
#define | TMD_AVEWIDTH TMD_BASE+5
#define | TMD_BASE 240
#define | TMD_BREAKCHAR TMD_BASE+14
#define | TMD_CHARSET TMD_BASE+16
#define | TMD_DEFAULTCHAR TMD_BASE+13
#define | TMD_DESCENT TMD_BASE+2
#define | TMD_DIGITIZEDASPECTX TMD_BASE+18
#define | TMD_DIGITIZEDASPECTY TMD_BASE+19
#define | TMD_EXTERNAL TMD_BASE+4
#define | TMD_FIRSTCHAR TMD_BASE+11
#define | TMD_HEIGHT TMD_BASE+0
#define | TMD_INTERNAL TMD_BASE+3
#define | TMD_ITALIC TMD_BASE+8
#define | TMD_LASTCHAR TMD_BASE+12
#define | TMD_MAXWIDTH TMD_BASE+6
#define | TMD_OVERHANG TMD_BASE+17
#define | TMD_PITCHANDFAMILY TMD_BASE+15
#define | TMD_SET TMD_BASE+20
#define | TMD_STRUCKOUT TMD_BASE+10
#define | TMD_UNDERLINE TMD_BASE+9
#define | TMD_WEIGHT TMD_BASE+7

Define Documentation

#define CFD_BASE 220

Definition at line 85 of file FontView.h.

#define CFD_CHARSET CFD_BASE+8

Definition at line 94 of file FontView.h.

#define CFD_CLIPPRECISION CFD_BASE+10

Definition at line 96 of file FontView.h.

#define CFD_DEFAULT CFD_BASE+14

Definition at line 101 of file FontView.h.

#define CFD_ESCAPEMENT CFD_BASE+2

Definition at line 88 of file FontView.h.

#define CFD_FACENAME CFD_BASE+13

Definition at line 99 of file FontView.h.

#define CFD_HEIGHT CFD_BASE+0

Definition at line 86 of file FontView.h.

#define CFD_ITALIC CFD_BASE+5

Definition at line 91 of file FontView.h.

#define CFD_ORIENTATION CFD_BASE+3

Definition at line 89 of file FontView.h.

#define CFD_OUTPUTPRECISION CFD_BASE+9

Definition at line 95 of file FontView.h.

#define CFD_PITCHANDFAMILY CFD_BASE+12

Definition at line 98 of file FontView.h.

#define CFD_QUALITY CFD_BASE+11

Definition at line 97 of file FontView.h.

#define CFD_STRIKEOUT CFD_BASE+7

Definition at line 93 of file FontView.h.

#define CFD_UNDERLINE CFD_BASE+6

Definition at line 92 of file FontView.h.

#define CFD_WEIGHT CFD_BASE+4

Definition at line 90 of file FontView.h.

#define CFD_WIDTH CFD_BASE+1

Definition at line 87 of file FontView.h.

#define CFP_BASE 200

Definition at line 68 of file FontView.h.

#define CFP_CHARSET CFP_BASE+8

Definition at line 77 of file FontView.h.

#define CFP_CLIPPRECISION CFP_BASE+10

Definition at line 79 of file FontView.h.

#define CFP_ESCAPEMENT CFP_BASE+2

Definition at line 71 of file FontView.h.

#define CFP_FACENAME CFP_BASE+14

Definition at line 83 of file FontView.h.

#define CFP_FAMILY CFP_BASE+13

Definition at line 82 of file FontView.h.

#define CFP_HEIGHT CFP_BASE+0

Definition at line 69 of file FontView.h.

#define CFP_ITALIC CFP_BASE+5

Definition at line 74 of file FontView.h.

#define CFP_ORIENTATION CFP_BASE+3

Definition at line 72 of file FontView.h.

#define CFP_OUTPUTPRECISION CFP_BASE+9

Definition at line 78 of file FontView.h.

#define CFP_PITCH CFP_BASE+12

Definition at line 81 of file FontView.h.

#define CFP_QUALITY CFP_BASE+11

Definition at line 80 of file FontView.h.

#define CFP_STRIKEOUT CFP_BASE+7

Definition at line 76 of file FontView.h.

#define CFP_UNDERLINE CFP_BASE+6

Definition at line 75 of file FontView.h.

#define CFP_WEIGHT CFP_BASE+4

Definition at line 73 of file FontView.h.

#define CFP_WIDTH CFP_BASE+1

Definition at line 70 of file FontView.h.

#define ED_BASE 260

Definition at line 128 of file FontView.h.

#define ED_HEX ED_BASE+4

Definition at line 133 of file FontView.h.

#define ED_NEXT ED_BASE+1

Definition at line 130 of file FontView.h.

#define ED_PREV ED_BASE+0

Definition at line 129 of file FontView.h.

#define ED_SAMPLE ED_BASE+5

Definition at line 134 of file FontView.h.

#define ED_SET ED_BASE+3

Definition at line 132 of file FontView.h.

#define ED_TYPE ED_BASE+2

Definition at line 131 of file FontView.h.

#define ID_CAPSFIELD ID_STATUSBAR+6

Definition at line 66 of file FontView.h.

#define ID_CREATEPARAM ID_TOOLBAR+1

Definition at line 56 of file FontView.h.

#define ID_CREATEVALUE ID_TOOLBAR+2

Definition at line 57 of file FontView.h.

#define ID_MENUFIELD ID_STATUSBAR+1

Definition at line 61 of file FontView.h.

#define ID_NUMFIELD ID_STATUSBAR+3

Definition at line 63 of file FontView.h.

#define ID_OVRFIELD ID_STATUSBAR+4

Definition at line 64 of file FontView.h.

#define ID_SCROLLFIELD ID_STATUSBAR+5

Definition at line 65 of file FontView.h.

#define ID_STATUSBAR 160

Definition at line 60 of file FontView.h.

#define ID_TIMEFIELD ID_STATUSBAR+2

Definition at line 62 of file FontView.h.

#define ID_TOOLBAR 150

Definition at line 55 of file FontView.h.

#define ID_ZOOM ID_TOOLBAR+3

Definition at line 58 of file FontView.h.

#define IDM_ABOUT IDM_HELP+8

Definition at line 53 of file FontView.h.

#define IDM_CHARSET IDM_VIEW+1

Definition at line 34 of file FontView.h.

#define IDM_CLOSE IDM_FILE+3

Definition at line 17 of file FontView.h.

#define IDM_COPY IDM_EDIT+3

Definition at line 27 of file FontView.h.

#define IDM_CREATEFONT IDM_DIALOG+1

Definition at line 40 of file FontView.h.

#define IDM_CUT IDM_EDIT+2

Definition at line 26 of file FontView.h.

#define IDM_DELETE IDM_EDIT+5

Definition at line 29 of file FontView.h.

#define IDM_DIALOG 130

Definition at line 39 of file FontView.h.

#define IDM_EDIT 110

Definition at line 24 of file FontView.h.

#define IDM_ENUMFONTS IDM_DIALOG+3

Definition at line 42 of file FontView.h.

#define IDM_EXIT IDM_FILE+8

Definition at line 22 of file FontView.h.

#define IDM_FILE 100

Definition at line 14 of file FontView.h.

#define IDM_FIND IDM_EDIT+6

Definition at line 30 of file FontView.h.

#define IDM_GLYPH IDM_VIEW+2

Definition at line 35 of file FontView.h.

#define IDM_HELP 140

Definition at line 45 of file FontView.h.

#define IDM_HELP_CONTENTS IDM_HELP+1

Definition at line 46 of file FontView.h.

#define IDM_HELP_DEMO IDM_HELP+6

Definition at line 51 of file FontView.h.

#define IDM_HELP_GLOSSARY IDM_HELP+4

Definition at line 49 of file FontView.h.

#define IDM_HELP_HELP IDM_HELP+7

Definition at line 52 of file FontView.h.

#define IDM_HELP_INDEX IDM_HELP+2

Definition at line 47 of file FontView.h.

#define IDM_HELP_OVERVIEW IDM_HELP+3

Definition at line 48 of file FontView.h.

#define IDM_HELP_TUTORIAL IDM_HELP+5

Definition at line 50 of file FontView.h.

#define IDM_NEW IDM_FILE+1

Definition at line 15 of file FontView.h.

#define IDM_OPEN IDM_FILE+2

Definition at line 16 of file FontView.h.

#define IDM_OUTLINEMETRICS IDM_DIALOG+4

Definition at line 43 of file FontView.h.

#define IDM_PASTE IDM_EDIT+4

Definition at line 28 of file FontView.h.

#define IDM_PRINT IDM_FILE+6

Definition at line 20 of file FontView.h.

#define IDM_PRINTSET IDM_FILE+7

Definition at line 21 of file FontView.h.

#define IDM_REPLACE IDM_EDIT+7

Definition at line 31 of file FontView.h.

#define IDM_SAVE IDM_FILE+4

Definition at line 18 of file FontView.h.

#define IDM_SAVEAS IDM_FILE+5

Definition at line 19 of file FontView.h.

#define IDM_STATUSBAR IDM_VIEW+4

Definition at line 37 of file FontView.h.

#define IDM_SYSMENU 666

Definition at line 12 of file FontView.h.

#define IDM_TEXTMETRIC IDM_DIALOG+2

Definition at line 41 of file FontView.h.

#define IDM_TOOLBAR IDM_VIEW+3

Definition at line 36 of file FontView.h.

#define IDM_UNDO IDM_EDIT+1

Definition at line 25 of file FontView.h.

#define IDM_VIEW 120

Definition at line 33 of file FontView.h.

#define TMD_ASCENT TMD_BASE+1

Definition at line 105 of file FontView.h.

#define TMD_AVEWIDTH TMD_BASE+5

Definition at line 109 of file FontView.h.

#define TMD_BASE 240

Definition at line 103 of file FontView.h.

#define TMD_BREAKCHAR TMD_BASE+14

Definition at line 118 of file FontView.h.

#define TMD_CHARSET TMD_BASE+16

Definition at line 120 of file FontView.h.

#define TMD_DEFAULTCHAR TMD_BASE+13

Definition at line 117 of file FontView.h.

#define TMD_DESCENT TMD_BASE+2

Definition at line 106 of file FontView.h.

#define TMD_DIGITIZEDASPECTX TMD_BASE+18

Definition at line 122 of file FontView.h.

#define TMD_DIGITIZEDASPECTY TMD_BASE+19

Definition at line 123 of file FontView.h.

#define TMD_EXTERNAL TMD_BASE+4

Definition at line 108 of file FontView.h.

#define TMD_FIRSTCHAR TMD_BASE+11

Definition at line 115 of file FontView.h.

#define TMD_HEIGHT TMD_BASE+0

Definition at line 104 of file FontView.h.

#define TMD_INTERNAL TMD_BASE+3

Definition at line 107 of file FontView.h.

#define TMD_ITALIC TMD_BASE+8

Definition at line 112 of file FontView.h.

#define TMD_LASTCHAR TMD_BASE+12

Definition at line 116 of file FontView.h.

#define TMD_MAXWIDTH TMD_BASE+6

Definition at line 110 of file FontView.h.

#define TMD_OVERHANG TMD_BASE+17

Definition at line 121 of file FontView.h.

#define TMD_PITCHANDFAMILY TMD_BASE+15

Definition at line 119 of file FontView.h.

#define TMD_SET TMD_BASE+20

Definition at line 125 of file FontView.h.

#define TMD_STRUCKOUT TMD_BASE+10

Definition at line 114 of file FontView.h.

#define TMD_UNDERLINE TMD_BASE+9

Definition at line 113 of file FontView.h.

#define TMD_WEIGHT TMD_BASE+7

Definition at line 111 of file FontView.h.

Generated on Wed Nov 13 2024 16:53:37 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/Fonts/FontView/Status.c File Reference

  • Multimedia
  • Gdi
  • Fonts
  • FontView
Classes | Defines | Typedefs | Functions | Variables

Status.c File Reference

#include <windows.h>
#include <stdlib.h>

Go to the source code of this file.

Classes

struct | _tagStatus

Defines

#define | APIENTRY FAR PASCAL
#define | MAXSTATUS 10
#define | NOMINMAX

Typedefs

typedef struct _tagStatus | Status

Functions

HWND | AddStatusField (HANDLE hInst, int iId, int iMin, int iMax, BOOL bNewGroup)
BOOL | AdjustStatusBar (HWND hwnd)
BOOL | CreateStatusBar (HWND hwnd, HANDLE hInst, int iId)
BOOL | DestroyStatusBar (void)
BOOL | InitStatusBar (HANDLE hInstance)
int | StatusBarHeight (HWND hwnd)
LONG_PTR APIENTRY | StatusFieldProc (HWND, UINT, WPARAM, LPARAM)
LONG_PTR APIENTRY | StatusProc (HWND, UINT, WPARAM, LPARAM)

Variables

int | cntStatusField = 0
int | cxFrame
int | cxStatusBorder
int | cyFrame
int | cyStatusBorder
int | dyField
int | dyStatus
HBRUSH | hbrBtnFace
HFONT | hfontStatus
HWND | hwndStatus
Status | statusField [MAXSTATUS]
TEXTMETRIC | tmStatusFont

Define Documentation

#define APIENTRY FAR PASCAL

Definition at line 18 of file Status.c.

#define MAXSTATUS 10

Definition at line 21 of file Status.c.

#define NOMINMAX

Definition at line 12 of file Status.c.

Typedef Documentation

typedef struct _tagStatus Status

Function Documentation

HWND AddStatusField | ( | HANDLE | hInst,
 |  | int | iId,
 |  | int | iMin,
 |  | int | iMax,
 |  | BOOL | bNewGroup
 | ) |  |

Definition at line 113 of file Status.c.

{
    LONG lStyle;

    if (cntStatusField >= MAXSTATUS) return (HWND)0; // No room left in our fixed array

    statusField[cntStatusField].hwnd = CreateWindow ("StatusField", "",
        WS_CHILD | WS_VISIBLE,
        0, 0, 0, 0,
        hwndStatus, (HMENU)(INT_PTR)iId, hInst, NULL);

    if (!statusField[cntStatusField].hwnd) return (HWND)0; // CreateWindow failed for some reason

    if (iMin < 0) {
    statusField[cntStatusField].iMinWidth = tmStatusFont.tmAveCharWidth*abs(iMin);
    } else {
    statusField[cntStatusField].iMinWidth = iMin;
    }

    if (iMax < 0) {
    statusField[cntStatusField].iMaxWidth = tmStatusFont.tmAveCharWidth*abs(iMax);
    } else {
    statusField[cntStatusField].iMaxWidth = iMax;
    }

    if (bNewGroup) {
        lStyle = (LONG)GetWindowLongPtr (statusField[cntStatusField].hwnd, GWL_STYLE);
        lStyle |= WS_GROUP;
        SetWindowLongPtr (statusField[cntStatusField].hwnd, GWL_STYLE, lStyle);
    }

    return statusField[cntStatusField++].hwnd;
}

BOOL AdjustStatusBar ( HWND hwnd )

Definition at line 100 of file Status.c.

{
    RECT rect;
    GetClientRect (hwnd, &rect);
    MoveWindow (hwndStatus,
        rect.left-cxStatusBorder,
        rect.bottom - dyStatus + cyStatusBorder,
        rect.right - rect.left + (cxStatusBorder*2),
        dyStatus,
    TRUE);
    return TRUE;
}

BOOL CreateStatusBar | ( | HWND | hwnd,
 |  | HANDLE | hInst,
 |  | int | iId
 | ) |  |

Definition at line 75 of file Status.c.

{
    cxStatusBorder = GetSystemMetrics (SM_CXBORDER);
    cyStatusBorder = GetSystemMetrics (SM_CYBORDER);

    hwndStatus = CreateWindow ("SamplerStatus", "SamplerStatus",
        WS_CHILD | WS_BORDER | WS_VISIBLE,
        0, 0, 0, 0,
        hwnd, (HMENU)(INT_PTR)iId, hInst, NULL);

    if (!hwndStatus) {
        return FALSE;
    }
    return TRUE;
}

BOOL DestroyStatusBar ( void )

Definition at line 147 of file Status.c.

{
    return DeleteObject (hbrBtnFace);
}

BOOL InitStatusBar ( HANDLE hInstance )

Definition at line 38 of file Status.c.

{
    WNDCLASS    wndclass;

    hbrBtnFace = CreateSolidBrush(GetSysColor(COLOR_BTNFACE));

    wndclass.style         = CS_HREDRAW | CS_VREDRAW;
    wndclass.lpfnWndProc   = (WNDPROC)StatusProc;
    wndclass.cbClsExtra    = 0;
    wndclass.cbWndExtra    = 0;
    wndclass.hInstance      = hInstance;
    wndclass.hIcon     = NULL;
    wndclass.hCursor       = LoadCursor (NULL, IDC_ARROW);
    wndclass.hbrBackground = hbrBtnFace;
    wndclass.lpszMenuName  = NULL;
    wndclass.lpszClassName = "SamplerStatus";

    if (!RegisterClass (&wndclass))
        return FALSE;

    wndclass.style         = CS_HREDRAW | CS_VREDRAW;
    wndclass.lpfnWndProc   = (WNDPROC)StatusFieldProc;
    wndclass.cbClsExtra    = 0;
    wndclass.cbWndExtra    = 0;
    wndclass.hInstance      = hInstance;
    wndclass.hIcon     = NULL;
    wndclass.hCursor       = LoadCursor (NULL, IDC_ARROW);
    wndclass.hbrBackground = hbrBtnFace;
    wndclass.lpszMenuName  = NULL;
    wndclass.lpszClassName = "StatusField";

    if (!RegisterClass (&wndclass))
        return FALSE;

  return TRUE;
}

int StatusBarHeight ( HWND hwnd )

Definition at line 91 of file Status.c.

{
    RECT rect;
    GetClientRect (hwndStatus, &rect);
    return rect.bottom-rect.top;

    hwnd; // unreferenced formal parameter
}

LONG_PTR APIENTRY StatusFieldProc | ( | HWND | hwnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 317 of file Status.c.

{
    HDC     hdc;
    PAINTSTRUCT ps;
    RECT    rect, border;
    HBRUSH  hBrush;
    HFONT   hTmp;
    char szText[80];
    int len;

    switch (msg) {
        case WM_PAINT:
            hdc = BeginPaint (hwnd, &ps);
            GetClientRect (hwnd, &rect);

            hBrush = CreateSolidBrush(GetSysColor(COLOR_BTNSHADOW));
            border = rect;
            border.bottom = border.top + cyStatusBorder;
            FillRect (hdc, &border, hBrush);
            border = rect;
            border.right = border.left + cxStatusBorder;
            FillRect (hdc, &border, hBrush);
            DeleteObject (hBrush);

            hBrush = CreateSolidBrush(GetSysColor(COLOR_WINDOW));
            border = rect;
            border.top = border.bottom - cyStatusBorder;
            FillRect (hdc, &border, hBrush);
            border = rect;
            border.left = border.right - cxStatusBorder;
            FillRect (hdc, &border, hBrush);
            DeleteObject (hBrush);

            len = GetWindowText(hwnd, szText, sizeof (szText));
            if (len) {
                hTmp = SelectObject(hdc, hfontStatus);

                SetTextColor(hdc, GetSysColor(COLOR_BTNTEXT));
                SetBkColor(hdc, GetSysColor(COLOR_BTNFACE));

                InflateRect (&rect, -(cxStatusBorder*2), -cyStatusBorder);
                ExtTextOut(hdc, rect.left, rect.top,
                    ETO_OPAQUE | ETO_CLIPPED,
                    &rect,
                    (LPSTR)szText,
                    len, NULL);

                SelectObject (hdc, hTmp);
            }

            EndPaint (hwnd, &ps);
            break;

        case WM_SETTEXT:
            InvalidateRect (hwnd, NULL, TRUE);
            return DefWindowProc (hwnd, msg, wParam, lParam);

        default:
            return DefWindowProc (hwnd, msg, wParam, lParam);
    }
    return 0L;
}

LONG_PTR APIENTRY StatusProc | ( | HWND | hwnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 152 of file Status.c.

{
    HDC hdc;
    PAINTSTRUCT ps;
    int x, y, i;
    int wAvailWidth, wFlexWidth, cntFlexWidth, wNeedWidth, cntNeedWidth;
    RECT    rect, border;
    HBRUSH  hBrush;
    LOGFONT lfTmp;

    switch (msg) {
        case WM_CREATE:
            hfontStatus = CreateFont(14, 0, 0, 0, 0, 0, 0, 0,
                0, 0, 0, 0,
                VARIABLE_PITCH | FF_SWISS, "");

                        if (GetObject (hfontStatus, sizeof(LOGFONT), &lfTmp)) {
                                if ((lfTmp.lfPitchAndFamily & VARIABLE_PITCH) &&
                                   (lfTmp.lfPitchAndFamily & FF_SWISS)) {
                                } else {
                                        MessageBox (GetFocus(),
                                                "Unable to get an unnamed variable pitch swiss font",
                                                "Status Bar CreateFont Error",
                                                MB_OK);

                                        hfontStatus = CreateFont(14, 0, 0, 0, 0, 0, 0, 0,
                                                                        0, 0, 0, 0,
                                                                        VARIABLE_PITCH | FF_SWISS, "Arial");
                                }
                        }

            if (!hfontStatus) {
                MessageBox (GetFocus(), "Failed To Create Font", "StatusProc", MB_OK);
            }
            hdc = GetDC (hwnd);
            SelectObject (hdc, hfontStatus);
            GetTextMetrics (hdc, &tmStatusFont);
            cxStatusBorder = GetSystemMetrics (SM_CXBORDER);
            cyStatusBorder = GetSystemMetrics (SM_CYBORDER);
            cxFrame = 3*cxStatusBorder;
            cyFrame = 3*cyStatusBorder;
            dyField = tmStatusFont.tmHeight + (2*cyStatusBorder);
            dyStatus = dyField + (2*cyFrame);
            ReleaseDC (hwnd, hdc);
            return DefWindowProc (hwnd, msg, wParam, lParam);

        case WM_DESTROY:
            if (hfontStatus) {
                DeleteObject (hfontStatus);
            }
            break;

        case WM_SIZE:
        if (cntStatusField) {
                GetClientRect (hwnd, &rect);
                wAvailWidth = rect.right - rect.left - (cxStatusBorder*8);
                wNeedWidth = 0;
                cntNeedWidth = 0;
                cntFlexWidth = 0;

                /* First Pass: Dole out to fields that have a minimum need */
                for (i=0; i<cntStatusField; i++) {
                    statusField[i].iGiveWidth = 0; // Make sure all are initialized to 0
                    if (statusField[i].iMinWidth) {
                        /* (n, ?) */
                        statusField[i].iGiveWidth = statusField[i].iMinWidth;
                        wAvailWidth -= (statusField[i].iGiveWidth + cxStatusBorder*2);
                        if (GetWindowLongPtr(statusField[i].hwnd, GWL_STYLE) & WS_GROUP) {
                            wAvailWidth -= cxStatusBorder*4;
                        }
                    } else {
                        /* They didn't specify a minimum... don't give them anything yet */
                        /* (0, ?) */
                        statusField[i].iGiveWidth = 0;
                    }

                    /* For those that have a minimum, but can grow to be as large as possible...*/
                    /* (n, 0) */
                    if ((statusField[i].iMinWidth >0) && (statusField[i].iMaxWidth ==0)) {
                        ++cntFlexWidth;
                    }

                    /* For those that have a max that is greater then their min... */
                    /* Includes (0,n) and (n,>n) */
                    if (statusField[i].iMaxWidth > statusField[i].iGiveWidth) {
                        wNeedWidth += (statusField[i].iMaxWidth - statusField[i].iGiveWidth);
                        ++cntNeedWidth;
                    }
                }

                /* Second Pass: Dole out to fields that have a stated maximum need */
                /* This will also hit those who had no minimum, but did have a maximum */
                /* It will still not give anything to those with no min, no max */
                if ((cntNeedWidth > 0) && (wAvailWidth > 0)) {
                    if (wNeedWidth > wAvailWidth) {
                        wNeedWidth = wAvailWidth;
                    }
                    wNeedWidth = wNeedWidth / cntNeedWidth;
                    for (i=0; i<cntStatusField; i++) {
                        if (statusField[i].iMaxWidth > statusField[i].iGiveWidth) {
                            statusField[i].iGiveWidth += wNeedWidth;
                            wAvailWidth -= (statusField[i].iGiveWidth + cxStatusBorder*2);
                            if (GetWindowLongPtr(statusField[i].hwnd, GWL_STYLE) & WS_GROUP) {
                                wAvailWidth -= cxStatusBorder*4;
                            }
                        }
                    }
                }

                /* Third Pass: Dole out the remaining to fields that want all they can get */
                /* This includes those who had a minimum, but no maximum */
                if ((cntFlexWidth > 0) && (wAvailWidth > 0)) {
                    wFlexWidth = wAvailWidth / cntFlexWidth;
                    for (i=0; i<cntStatusField; i++) {
                        if (statusField[i].iMaxWidth==0) {
                            statusField[i].iGiveWidth += wFlexWidth;
                            wAvailWidth -= ((wFlexWidth - statusField[i].iMinWidth) + cxStatusBorder*2);
                            if (GetWindowLongPtr(statusField[i].hwnd, GWL_STYLE) & WS_GROUP) {
                                wAvailWidth -= cxStatusBorder*4;
                            }
                        }
                    }
                }

                x = cxStatusBorder*4;
                y = rect.top + (2*cyStatusBorder);
                for (i=0; i<cntStatusField; i++) {
                    if (GetWindowLongPtr (statusField[i].hwnd, GWL_STYLE) & WS_GROUP) {
                        x += (cxStatusBorder*4);
                    }
                    MoveWindow (statusField[i].hwnd, x, y, statusField[i].iGiveWidth, dyField, TRUE);
                    x += statusField[i].iGiveWidth + (cxStatusBorder*2);
                }
            }
            break;

        case WM_PAINT:
            hdc = BeginPaint (hwnd, &ps);
            GetClientRect (hwnd, &rect);

            hBrush = CreateSolidBrush(GetSysColor(COLOR_WINDOW));
            border = rect;
            border.bottom = border.top + cyStatusBorder;
            FillRect (hdc, &border, hBrush);
            DeleteObject (hBrush);

            hBrush = CreateSolidBrush(GetSysColor(COLOR_BTNSHADOW));
            border = rect;
            border.top = border.bottom - cyStatusBorder;
            FillRect (hdc, &border, hBrush);
            DeleteObject (hBrush);

            EndPaint (hwnd, &ps);

            return DefWindowProc (hwnd, msg, wParam, lParam);

        default:
            return DefWindowProc (hwnd, msg, wParam, lParam);
    }
    return 0L;
}

Variable Documentation

int cntStatusField = 0

Definition at line 29 of file Status.c.

int cxFrame

Definition at line 30 of file Status.c.

int cxStatusBorder

Definition at line 30 of file Status.c.

int cyFrame

Definition at line 30 of file Status.c.

int cyStatusBorder

Definition at line 30 of file Status.c.

int dyField

Definition at line 30 of file Status.c.

int dyStatus

Definition at line 30 of file Status.c.

HBRUSH hbrBtnFace

Definition at line 33 of file Status.c.

HFONT hfontStatus

Definition at line 31 of file Status.c.

HWND hwndStatus

Definition at line 28 of file Status.c.

Status statusField[MAXSTATUS]

Definition at line 26 of file Status.c.

TEXTMETRIC tmStatusFont

Definition at line 32 of file Status.c.

Generated on Wed Nov 13 2024 16:53:37 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/Fonts/FontView/Tools.c File Reference

  • Multimedia
  • Gdi
  • Fonts
  • FontView
Classes | Defines | Typedefs | Functions | Variables

Tools.c File Reference

#include <windows.h>
#include <stdlib.h>

Go to the source code of this file.

Classes

struct | _tagTools

Defines

#define | APIENTRY FAR PASCAL
#define | MAXCTRLS 25
#define | NOMINMAX
#define | TC_BUTTON 3
#define | TC_COMBO 2
#define | TC_LABEL 1
#define | TC_SPACE 0

Typedefs

typedef struct _tagTools | Tools

Functions

HWND | AddToolButton (HANDLE hInst, int iId, LPSTR szLabel, int iWidth, int iHeight, DWORD dwStyle)
HWND | AddToolCombo (HANDLE hInst, int iId, int iWidth, DWORD dwStyle)
HWND | AddToolLabel (HANDLE hInst, int iId, LPSTR szLabel, int iWidth, DWORD dwStyle)
BOOL | AddToolSpace (int iWidth, int iHeight)
BOOL | AdjustToolBar (HWND hwnd)
BOOL | CreateToolBar (HWND hwnd, HANDLE hInstance, int iId)
BOOL | DestroyToolBar (void)
void | DrawButton (HDC hdc, RECT rect, BOOL bDown, HICON hIcon)
BOOL | InitToolBar (HANDLE hInstance)
LONG APIENTRY | MyComboProc (HWND, UINT, UINT, LONG)
int | ToolBarHeight (HWND hwnd)
LONG_PTR APIENTRY | ToolsProc (HWND, UINT, WPARAM, LPARAM)
void | UpdatePositions (void)

Variables

int | cntToolCtrls = 0
int | cxToolBorder
int | cyToolBorder
int | dyCombo
int | dyTools = 0
HBRUSH | hbrBtnFace = 0
HBRUSH | hbrWindow = 0
HFONT | hfontTools = 0
HANDLE | hInst = 0
HWND | hwndMain
HWND | hwndToolButton
HWND | hwndToolCombo
HWND | hwndTools
HWND | hwndToolText
TEXTMETRIC | tmToolFont
Tools | toolCtrl [MAXCTRLS]
int | xCurrent = 10

Define Documentation

#define APIENTRY FAR PASCAL

Definition at line 18 of file Tools.c.

#define MAXCTRLS 25

Definition at line 29 of file Tools.c.

#define NOMINMAX

Definition at line 12 of file Tools.c.

#define TC_BUTTON 3

Definition at line 33 of file Tools.c.

#define TC_COMBO 2

Definition at line 32 of file Tools.c.

#define TC_LABEL 1

Definition at line 31 of file Tools.c.

#define TC_SPACE 0

Definition at line 30 of file Tools.c.

Typedef Documentation

typedef struct _tagTools Tools

Function Documentation

HWND AddToolButton | ( | HANDLE | hInst,
 |  | int | iId,
 |  | LPSTR | szLabel,
 |  | int | iWidth,
 |  | int | iHeight,
 |  | DWORD | dwStyle
 | ) |  |

Definition at line 272 of file Tools.c.

{
        HDC hdc;

        if (cntToolCtrls >= MAXCTRLS) return (HWND)0; // No room left in our fixed array

        if (dwStyle == 0) dwStyle = BS_PUSHBUTTON;
        toolCtrl[cntToolCtrls].hwnd = CreateWindow ("BUTTON", szLabel,
                WS_CHILD | WS_VISIBLE | dwStyle,
                0, 0, 0, 0,
                hwndTools, (HMENU)(INT_PTR)iId, hInst, NULL);

        if (!toolCtrl[cntToolCtrls].hwnd) return (HWND)0; // CreateWindow failed for some reason

        SendMessage (toolCtrl[cntToolCtrls].hwnd, WM_SETFONT, (UINT_PTR)hfontTools, MAKELONG (TRUE, 0));
        toolCtrl[cntToolCtrls].wType = TC_BUTTON;

        hdc = GetDC (hwndTools);
        SelectObject (hdc, hfontTools);
        if (iWidth < 0) {
                toolCtrl[cntToolCtrls].iWidth = tmToolFont.tmAveCharWidth * abs(iWidth);
                toolCtrl[cntToolCtrls].iWidth += (6*cxToolBorder);
        } else if (iWidth == 0) {
                SIZE size;
                GetTextExtentPoint (hdc, szLabel, lstrlen(szLabel), &size);
                toolCtrl[cntToolCtrls].iWidth = size.cx;
                toolCtrl[cntToolCtrls].iWidth += (6*cxToolBorder);
        } else {
                toolCtrl[cntToolCtrls].iWidth = iWidth;
        }
        if (iHeight < 0) {
                toolCtrl[cntToolCtrls].iHeight = tmToolFont.tmHeight;
                toolCtrl[cntToolCtrls].iHeight += (6*cyToolBorder);
        } else if (iHeight==0) {
                toolCtrl[cntToolCtrls].iHeight = dyTools - (6*cyToolBorder);
        } else {
                toolCtrl[cntToolCtrls].iHeight = iHeight;
        }

        if ((toolCtrl[cntToolCtrls].iHeight + (6*cyToolBorder)) > dyTools) {
                dyTools = (toolCtrl[cntToolCtrls].iHeight + (6*cyToolBorder));
        }

        if (dwStyle & BS_OWNERDRAW) {
                toolCtrl[cntToolCtrls].hIcon = LoadIcon (hInst, szLabel);
        } else {
                toolCtrl[cntToolCtrls].hIcon = NULL;
        }

        ReleaseDC (hwndTools, hdc);
        UpdatePositions();
        return toolCtrl[cntToolCtrls++].hwnd;
}

HWND AddToolCombo | ( | HANDLE | hInst,
 |  | int | iId,
 |  | int | iWidth,
 |  | DWORD | dwStyle
 | ) |  |

Definition at line 238 of file Tools.c.

{

        if (cntToolCtrls >= MAXCTRLS) return (HWND)0; // No room left in our fixed array

        if (dwStyle==0) dwStyle = CBS_DROPDOWNLIST;
        toolCtrl[cntToolCtrls].hwnd = CreateWindow ("COMBOBOX", "",
                WS_CHILD | WS_VISIBLE | dwStyle,
                0, 0, 0, 0,
                hwndTools, (HMENU)(INT_PTR)iId, hInst, NULL);

        if (!toolCtrl[cntToolCtrls].hwnd) return (HWND)0; // CreateWindow failed for some reason

        SendMessage (toolCtrl[cntToolCtrls].hwnd, WM_SETFONT, (UINT_PTR)hfontTools, MAKELONG (TRUE, 0));
        toolCtrl[cntToolCtrls].wType = TC_COMBO;

        if (iWidth < 0) {
                toolCtrl[cntToolCtrls].iWidth = tmToolFont.tmAveCharWidth * abs(iWidth);
        } else if (iWidth == 0) {
                toolCtrl[cntToolCtrls].iWidth = tmToolFont.tmAveCharWidth * 15; // just a default width
        } else {
                toolCtrl[cntToolCtrls].iWidth = iWidth;
        }
        toolCtrl[cntToolCtrls].iHeight = dyCombo;

        if ((toolCtrl[cntToolCtrls].iHeight + (6*cyToolBorder)) > dyTools) {
                dyTools = (toolCtrl[cntToolCtrls].iHeight + (6*cyToolBorder));
        }

        UpdatePositions();
        return toolCtrl[cntToolCtrls++].hwnd;
}

HWND AddToolLabel | ( | HANDLE | hInst,
 |  | int | iId,
 |  | LPSTR | szLabel,
 |  | int | iWidth,
 |  | DWORD | dwStyle
 | ) |  |

Definition at line 201 of file Tools.c.

{
        HDC hdc;

        if (cntToolCtrls >= MAXCTRLS) return (HWND)0; // No room left in our fixed array

        toolCtrl[cntToolCtrls].hwnd = CreateWindow ("STATIC", szLabel,
                WS_CHILD | WS_VISIBLE | dwStyle,
                0, 0, 0, 0,
                hwndTools, (HMENU)(INT_PTR)iId, hInst, NULL);

        if (!toolCtrl[cntToolCtrls].hwnd) return (HWND)0; // CreateWindow failed for some reason

        SendMessage (toolCtrl[cntToolCtrls].hwnd, WM_SETFONT, (UINT_PTR)hfontTools, (LONG_PTR)MAKELONG (TRUE, 0));
        toolCtrl[cntToolCtrls].wType = TC_LABEL;

        hdc = GetDC (hwndTools);
        if (iWidth < 0) {
                toolCtrl[cntToolCtrls].iWidth = tmToolFont.tmAveCharWidth * abs(iWidth);
        } else if (iWidth == 0) {
                SIZE size;
                GetTextExtentPoint (hdc, szLabel, lstrlen(szLabel), &size);
                toolCtrl[cntToolCtrls].iWidth = size.cx;
        } else {
                toolCtrl[cntToolCtrls].iWidth = iWidth;
        }
        toolCtrl[cntToolCtrls].iHeight = tmToolFont.tmHeight;

        if ((toolCtrl[cntToolCtrls].iHeight + (6*cyToolBorder)) > dyTools) {
                dyTools = (toolCtrl[cntToolCtrls].iHeight + (6*cyToolBorder));
        }

        ReleaseDC (hwndTools, hdc);
        UpdatePositions();
        return toolCtrl[cntToolCtrls++].hwnd;
}

BOOL AddToolSpace | ( | int | iWidth,
 |  | int | iHeight
 | ) |  |

Definition at line 186 of file Tools.c.

{
        if (cntToolCtrls >= MAXCTRLS) return FALSE;
        toolCtrl[cntToolCtrls].hwnd = 0;
        toolCtrl[cntToolCtrls].wType = TC_SPACE;
        toolCtrl[cntToolCtrls].iWidth = iWidth;
        toolCtrl[cntToolCtrls].iHeight = iHeight;
        if ((toolCtrl[cntToolCtrls].iHeight + (6*cyToolBorder)) > dyTools) {
                dyTools = (toolCtrl[cntToolCtrls].iHeight + (6*cyToolBorder));
        }
        UpdatePositions();
        cntToolCtrls++;
        return TRUE;
}

BOOL AdjustToolBar ( HWND hwnd )

Definition at line 128 of file Tools.c.

{
        RECT rect;

        GetClientRect (hwnd, &rect);
        MoveWindow (hwndTools,
                rect.left-cxToolBorder,
                rect.top - cyToolBorder,
                rect.right - rect.left + (cxToolBorder*2),
                dyTools,
                TRUE);
        return TRUE;
}

BOOL CreateToolBar | ( | HWND | hwnd,
 |  | HANDLE | hInstance,
 |  | int | iId
 | ) |  |

Definition at line 71 of file Tools.c.

{
        HWND hwndTmp;
        RECT rect;

        hInst = (HANDLE)GetWindowLongPtr (hwnd, GWLP_HINSTANCE);

        if (hbrBtnFace==0) {
                hbrBtnFace = CreateSolidBrush(GetSysColor(COLOR_BTNFACE));
        }
        if (hbrWindow==0) {
                hbrWindow = CreateSolidBrush(GetSysColor(COLOR_WINDOW));
        }

        cxToolBorder = GetSystemMetrics (SM_CXBORDER);
        cyToolBorder = GetSystemMetrics (SM_CYBORDER);

        hwndTools = CreateWindow ("SamplerTools", "SamplerTools",
                WS_CHILD | WS_CLIPSIBLINGS | WS_BORDER | WS_VISIBLE,
                0, 0, 0, 0,
        hwnd, (HMENU)(INT_PTR)iId, hInst, NULL);
        if (!hwndTools) {
                return FALSE;
        }

        /* Lets find out how big a combo box is... */
        hwndTmp = CreateWindow ("COMBOBOX", "Combo",
                        WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST,
                        0, 0, 0, 0,
                        hwndTools, NULL, hInst, NULL);
        if (hwndTmp) {
                SendMessage (hwndTmp, WM_SETFONT, (UINT_PTR)hfontTools, (LONG_PTR)MAKELONG (TRUE, 0));
                GetClientRect (hwndTmp, &rect);
                dyCombo = rect.bottom - rect.top;
                DestroyWindow (hwndTmp);
        } else {
                dyCombo = 30; // Just for a default value
        }

        hwndMain = hwnd; // So we can pass WM_CONTROL messages back to the master parent

        return TRUE;

        hInstance; // unreferenced formal parameter
}

BOOL DestroyToolBar ( void )

Definition at line 327 of file Tools.c.

{
        return DeleteObject (hbrBtnFace);
}

void DrawButton | ( | HDC | hdc,
 |  | RECT | rect,
 |  | BOOL | bDown,
 |  | HICON | hIcon
 | ) |  |

Definition at line 332 of file Tools.c.

{
        HBRUSH  hBrush, hbrFrame, hbrFace, hbrHilite, hbrShadow;
        RECT    border;
        int     i;

        hbrFrame = CreateSolidBrush(GetSysColor(COLOR_WINDOWFRAME));
        hbrFace = CreateSolidBrush(GetSysColor(COLOR_BTNFACE));
        hbrHilite = CreateSolidBrush(GetSysColor(COLOR_WINDOW));
        hbrShadow = CreateSolidBrush(GetSysColor(COLOR_BTNSHADOW));

        FillRect (hdc, &rect, hbrFace);

        if (hIcon) {
                if (bDown) {
                        DrawIcon (hdc, rect.left + (4*cyToolBorder), rect.top + (4*cyToolBorder), hIcon);
                } else {
                        DrawIcon (hdc, rect.left + (3*cyToolBorder), rect.top + (3*cyToolBorder), hIcon);
                }
        }

        hBrush = hbrFrame;
        border = rect; border.bottom = border.top + cyToolBorder;
        FillRect (hdc, &border, hBrush);
        border = rect; border.right = border.left + cxToolBorder;
        FillRect (hdc, &border, hBrush);
        border = rect; border.top = border.bottom - cyToolBorder;
        FillRect (hdc, &border, hBrush);
        border = rect; border.left = border.right - cxToolBorder;
        FillRect (hdc, &border, hBrush);

        for (i= 0; i<2; i++) {
                InflateRect (&rect, -cxToolBorder, -cyToolBorder);
                hBrush = (bDown?hbrShadow:hbrHilite);
                border = rect; border.bottom = border.top + cyToolBorder;
                FillRect (hdc, &border, hBrush);
                border = rect; border.right = border.left + cxToolBorder;
                FillRect (hdc, &border, hBrush);
                if (!bDown) {
                        hBrush = hbrShadow;
                        border = rect; border.top = border.bottom - cyToolBorder;
                        FillRect (hdc, &border, hBrush);
                        border = rect; border.left = border.right - cxToolBorder;
                        FillRect (hdc, &border, hBrush);
                }
        }

        DeleteObject (hbrFrame);
        DeleteObject (hbrFace);
        DeleteObject (hbrHilite);
        DeleteObject (hbrShadow);

}

BOOL InitToolBar ( HANDLE hInstance )

Definition at line 45 of file Tools.c.

{
        WNDCLASS    wndclass;

        hbrBtnFace = CreateSolidBrush(GetSysColor(COLOR_BTNFACE));
        hbrWindow = CreateSolidBrush(GetSysColor(COLOR_WINDOW));

        wndclass.style         = CS_HREDRAW | CS_VREDRAW;
        wndclass.lpfnWndProc   = (WNDPROC)ToolsProc;
        wndclass.cbClsExtra    = 0;
        wndclass.cbWndExtra    = 0;
        wndclass.hInstance      = hInstance;
        wndclass.hIcon     = NULL;
        wndclass.hbrBackground = hbrBtnFace;
        wndclass.hCursor       = LoadCursor (NULL, IDC_ARROW);
        wndclass.lpszMenuName  = NULL;
        wndclass.lpszClassName = "SamplerTools";

        if (!RegisterClass (&wndclass))
        {
            return FALSE;
        }

        return TRUE;
}

LONG APIENTRY MyComboProc | ( | HWND | ,
 |  | UINT | ,
 |  | UINT | ,
 |  | LONG |
 | ) |  |
int ToolBarHeight ( HWND hwnd )

Definition at line 119 of file Tools.c.

{
        RECT rect;
        GetClientRect (hwndTools, &rect);
        return rect.bottom-rect.top;

        hwnd; //unreferenced formal parameter
}

LONG_PTR APIENTRY ToolsProc | ( | HWND | hwnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 387 of file Tools.c.

{
        HDC          hdc;
        PAINTSTRUCT      ps;
        int          iType, idCtrl, msgCtrl, i;
        RECT         rect, border;
        COLORREF         clrColor;
        HWND         hwndCtl;
        LONG         lStyle;
        HBRUSH       hBrush;
        LPDRAWITEMSTRUCT lpdi;
        HICON        hIcon;
        LOGFONT     lfTmp ={0,0,0,0,0,0,0,0,0,0,0,0,0,0};

        switch (msg) {
                case WM_CREATE:
                        lfTmp.lfHeight = 14;
                        lfTmp.lfPitchAndFamily = VARIABLE_PITCH | FF_SWISS;
                        hfontTools = CreateFontIndirect (&lfTmp);
                        if (!hfontTools) {
                                MessageBox (GetFocus(),
                                        "Unable to get an unnamed variable pitch swiss font",
                                        "Tool Bar CreateFont Error",
                                         MB_OK);
                                hfontTools = CreateFont(14, 0, 0, 0, 0, 0, 0, 0,
                                        0, 0, 0, 0,
                                        VARIABLE_PITCH | FF_SWISS, "Arial");
                        }

                        if (!hfontTools) {
                                MessageBox (GetFocus(), "Failed To Create Font", "StatusProc", MB_OK);
                        }
                        hdc = GetDC (hwnd);
                        SelectObject (hdc, hfontTools);
                        GetTextMetrics (hdc, &tmToolFont);
                        ReleaseDC (hwnd, hdc);
                        return DefWindowProc (hwnd, msg, wParam, lParam);

                case WM_DESTROY:
                        if (hfontTools) {
                                DeleteObject (hfontTools);
                        }
                        break;

                case WM_SIZE:
                        UpdatePositions();
                        break;

                case WM_CTLCOLORLISTBOX:
                case WM_CTLCOLOREDIT:
                case WM_CTLCOLORSTATIC:
                case WM_CTLCOLORBTN:
                case WM_CTLCOLORDLG:
                case WM_CTLCOLORMSGBOX:
                case WM_CTLCOLORSCROLLBAR:
                        iType   = msg - WM_CTLCOLORMSGBOX;
                        hdc     = (HDC)wParam;
                        hwndCtl = (HWND)lParam;
                        switch (iType) {
                                case CTLCOLOR_EDIT: //Edit control
                                        clrColor = GetSysColor (COLOR_BTNFACE);
                                        hBrush = hbrWindow;
                                        break;

                                case CTLCOLOR_LISTBOX: //List-box control
                                        lStyle = (LONG)GetWindowLongPtr (hwndCtl, GWL_STYLE);
                                        if (lStyle & CBS_SIMPLE) {
                                                clrColor = GetSysColor (COLOR_WINDOW);
                                                hBrush = hbrWindow;
                                        } else {
                                                clrColor = GetSysColor (COLOR_BTNFACE);
                                                hBrush = hbrBtnFace;
                                        }
                                        break;

                                case CTLCOLOR_STATIC:
                                        clrColor = GetSysColor (COLOR_BTNFACE);
                                        hBrush = hbrBtnFace;
                                        break;

                                case CTLCOLOR_BTN:
                                        clrColor = GetSysColor (COLOR_BTNFACE);
                                        hBrush = hbrBtnFace;
                                        break;

                                case CTLCOLOR_SCROLLBAR:
                                case CTLCOLOR_DLG:
                                case CTLCOLOR_MSGBOX:
                                default:
                                        return DefWindowProc (hwnd, msg, wParam, lParam);
                        }
                        SetBkColor(hdc, clrColor);
                return (LONG_PTR)hBrush;

                case WM_PAINT:
                        hdc = BeginPaint (hwnd, &ps);
                        GetClientRect (hwnd, &rect);

                        /* Shade the top of the bar white */
                        hBrush = CreateSolidBrush(GetSysColor(COLOR_WINDOW));
                        border = rect;
                        border.bottom = border.top + cyToolBorder;
                        FillRect (hdc, &border, hBrush);
                        DeleteObject (hBrush);

                        /* Shade the bottom of the bar dark gray */
                        hBrush = CreateSolidBrush(GetSysColor(COLOR_BTNSHADOW));
                        border = rect;
                        border.top = border.bottom - cyToolBorder;
                        FillRect (hdc, &border, hBrush);
                        DeleteObject (hBrush);

                        EndPaint (hwnd, &ps);

                        return DefWindowProc (hwnd, msg, wParam, lParam);

                case WM_DRAWITEM: // Indicates that an owner-draw control needs to be redrawn.
                        lpdi = (LPDRAWITEMSTRUCT)lParam;

                        switch (lpdi->itemAction) {
                                // handle normal drawing of button, but check if its selected or focus
                                case ODA_SELECT:
                                case ODA_DRAWENTIRE:
                                        // handle button pressed down select state -- button down bitmap
                                        //   text is right & down 2 pixels
                                                                                hIcon = NULL;
                                        for (i=0; i< cntToolCtrls; i++) {
                                                if (toolCtrl[i].hwnd == lpdi->hwndItem) {
                                                        hIcon = toolCtrl[i].hIcon;
                                                }
                                        }
                                        if (lpdi->itemState & ODS_SELECTED) {
                                                DrawButton (lpdi->hDC,lpdi->rcItem, TRUE, hIcon);
                                        } else { // not selected -- button up; text is in normal position
                                                DrawButton (lpdi->hDC,lpdi->rcItem, FALSE, hIcon);
                                        }
                                        return TRUE;
                        }
                        break;

                case WM_COMMAND:
                        idCtrl = LOWORD(wParam);
                        msgCtrl = HIWORD(wParam);
                        hwndCtl = (HWND)lParam;

                        if (GetWindowLongPtr (hwndCtl, GWL_STYLE) & BS_OWNERDRAW) {
                                if (msgCtrl == BN_DOUBLECLICKED) {
                                        PostMessage (hwndCtl, WM_LBUTTONDOWN, 0, 0);
                                        return TRUE;
                                }
                        }
                        PostMessage (hwndMain, msg, wParam, lParam);
                        return DefWindowProc (hwnd, msg, wParam, lParam);

                default:
                        return DefWindowProc (hwnd, msg, wParam, lParam);
        }
        return 0L;
}

void UpdatePositions ( void )

Definition at line 142 of file Tools.c.

{
        int i, x, y = 0, dx, dy = 0, cnt;

        x = 10;
        for (i=0; i<cntToolCtrls; i++) {
                switch (toolCtrl[i].wType) {
                        case TC_SPACE:
                                dx = toolCtrl[i].iWidth;
                                break;
                        case TC_LABEL:
                                dy = toolCtrl[i].iHeight;
                                y = (dyTools/2) - (dy/2) - 1;
                                dx = toolCtrl[i].iWidth;
                                break;
                        case TC_COMBO:
                                dy = toolCtrl[i].iHeight;
                                y = (dyTools/2) - (dy/2) - 1;
                                dx = toolCtrl[i].iWidth;
                                cnt = (int)SendMessage (toolCtrl[i].hwnd, CB_GETCOUNT, (UINT)0, (LONG)0);
                                if (cnt > 5) cnt = 5;
                                dy = dy * cnt;
                                break;
                        case TC_BUTTON:
                                dy = toolCtrl[i].iHeight;
                                y = (dyTools/2) - (dy/2) - 1;
                                dx = toolCtrl[i].iWidth;
                                break;
                        default:
                                dy = toolCtrl[i].iHeight;
                                y = (dyTools/2) - (dy/2) - 1;
                                dx = toolCtrl[i].iWidth;
                                break;
                }
                if (toolCtrl[i].wType != TC_SPACE) {
                        MoveWindow (toolCtrl[i].hwnd, x, y, dx, dy, FALSE);
                }
                x += dx;
        }
        if (hwndTools) {
                UpdateWindow (hwndTools);
        }
}

Variable Documentation

int cntToolCtrls = 0

Definition at line 24 of file Tools.c.

int cxToolBorder

Definition at line 24 of file Tools.c.

int cyToolBorder

Definition at line 24 of file Tools.c.

int dyCombo

Definition at line 24 of file Tools.c.

int dyTools = 0

Definition at line 24 of file Tools.c.

HBRUSH hbrBtnFace = 0

Definition at line 26 of file Tools.c.

HBRUSH hbrWindow = 0

Definition at line 26 of file Tools.c.

HFONT hfontTools = 0

Definition at line 22 of file Tools.c.

HANDLE hInst = 0

Definition at line 27 of file Tools.c.

HWND hwndMain

Definition at line 21 of file Tools.c.

HWND hwndToolButton

Definition at line 21 of file Tools.c.

HWND hwndToolCombo

Definition at line 21 of file Tools.c.

HWND hwndTools

Definition at line 21 of file Tools.c.

HWND hwndToolText

Definition at line 21 of file Tools.c.

TEXTMETRIC tmToolFont

Definition at line 23 of file Tools.c.

Tools toolCtrl[MAXCTRLS]

Definition at line 40 of file Tools.c.

int xCurrent = 10

Definition at line 25 of file Tools.c.

Generated on Wed Nov 13 2024 16:53:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/Fonts/GridFont/APP.Cxx File Reference

  • Multimedia
  • Gdi
  • Fonts
  • GridFont
Classes | Functions | Variables

APP.Cxx File Reference

#include <windows.h>
#include <windowsx.h>
#include "app.hxx"

Go to the source code of this file.

Classes

struct | t_Ctype

Functions

BOOL CALLBACK | AbortProc (HDC hdcPrn, short nCode)
BOOL CALLBACK | AboutDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
void | MakeWindowClass (WNDPROC WndProc, LPTSTR szAppName, HINSTANCE hInst)
BOOL CALLBACK | PrintDlgProc (HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
BOOL CALLBACK | PropDlgProc (HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
int WINAPI | WinMain (HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR cmdParam, int cmdShow)
LRESULT CALLBACK | WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)

Variables

CCTypeSet * | pCSet = NULL
CPrintAux PrGlobal
struct t_Ctype | vCtype []

Function Documentation

BOOL CALLBACK AbortProc | ( | HDC | hdcPrn,
 |  | short | nCode
 | ) |  |

Definition at line 517 of file APP.Cxx.

{
    MSG   msg ;

    while (!PrGlobal._bUserAbort && PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
    {
        if (!PrGlobal._hDlgPrint
                ||
            !IsDialogMessage (PrGlobal._hDlgPrint, &msg))
        {
            TranslateMessage (&msg) ;
            DispatchMessage (&msg) ;
        }
    }
    return !PrGlobal._bUserAbort ;
}

BOOL CALLBACK AboutDlgProc | ( | HWND | hwnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 471 of file APP.Cxx.

{

    switch(message)
    {
       case WM_INITDIALOG:
            return TRUE;
       case WM_COMMAND:
            switch (wParam) //Command ID
            {
               case IDOK:
               case IDCANCEL:
                    EndDialog(hwnd, 0);
                    return TRUE;
            }
            break;
    }
    return FALSE;
}

void MakeWindowClass | ( | WNDPROC | WndProc,
 |  | LPTSTR | szAppName,
 |  | HINSTANCE | hInst
 | ) |  |

Definition at line 401 of file APP.Cxx.

{
    WNDCLASS cl;

    cl.style = CS_HREDRAW | CS_VREDRAW;
    cl.lpfnWndProc = WndProc;
    cl.cbClsExtra = 0;
    cl.cbWndExtra = 0;
    cl.hInstance = hInst;
    cl.hIcon = LoadIcon ( hInst, szAppName );
    cl.hCursor = LoadCursor ( NULL, IDC_ARROW );
    cl.hbrBackground = GetStockBrush ( WHITE_BRUSH );
    cl.lpszMenuName = szAppName;
    cl.lpszClassName = szAppName;

    RegisterClass (&cl);
}

BOOL CALLBACK PrintDlgProc | ( | HWND | hwndDlg,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 496 of file APP.Cxx.

{
    switch (message)
    {
        case WM_INITDIALOG:
             SetWindowText (hwndDlg, (TCHAR *)lParam) ;
             EnableMenuItem (GetSystemMenu (hwndDlg, FALSE), SC_CLOSE, MF_GRAYED) ;
             return TRUE ;

        case WM_COMMAND:
             PrGlobal._bUserAbort = TRUE ;
             EnableWindow (GetParent (hwndDlg), TRUE) ;
             DestroyWindow (hwndDlg) ;
             PrGlobal._hDlgPrint = 0 ;
             return TRUE ;
    }
    return FALSE ;
}

BOOL CALLBACK PropDlgProc | ( | HWND | hwndDlg,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 579 of file APP.Cxx.

{
  INT_PTR i;
    switch (message)
    {
       case WM_INITDIALOG:
        for( i=0; i<sizeof vCtype/sizeof t_Ctype; i++)
      {
          SendDlgItemMessage(hwndDlg, IDC_PROPLIST, LB_ADDSTRING, i, (LPARAM) vCtype[i].pszName);
      }
            return TRUE;
       case WM_COMMAND:
            switch (wParam) //Command ID
            {
               case IDOK:
            if( pCSet )
            {
            delete pCSet;
          }
            i = SendDlgItemMessage(hwndDlg, IDC_PROPLIST, LB_GETCARETINDEX, 0, 0);
            pCSet = new CCTypeSet(vCtype[i].fVal[0],vCtype[i].fVal[1], vCtype[i].fVal[2]);
                    EndDialog(hwndDlg, 0);
          return TRUE;
               case IDCANCEL:
            if( pCSet )
          {
            delete pCSet;
          }
                    EndDialog(hwndDlg, 0);
                    return TRUE;
            }
            break;
    }
    return FALSE ;
}

int WINAPI WinMain | ( | HINSTANCE | hInst,
 |  | HINSTANCE | hPrevInst,
 |  | LPSTR | cmdParam,
 |  | int | cmdShow
 | ) |  |

Definition at line 370 of file APP.Cxx.

{
    TCHAR  szAppName [] = TEXT("Grid") ;
    TCHAR  szCaption [] = TEXT("Character Grid") ;

    // Create Window Class

    if ( hPrevInst == 0 )
    {
        MakeWindowClass ( WndProc, szAppName, hInst );
    }

    // Create Window

    CWindow win ( szCaption, szAppName, hInst );

    win.Show ( cmdShow );

    MSG  msg;

    while ( GetMessage (&msg, NULL, 0, 0 ) )
    {
        TranslateMessage ( &msg );
        DispatchMessage ( &msg );
    }

    return (int)msg.wParam;
}

LRESULT CALLBACK WndProc | ( | HWND | hwnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 422 of file APP.Cxx.

{
    static CController ctrl;

    switch (message)
    {
        case WM_CREATE:
            ctrl.Create(hwnd, lParam);
            return 0;
        case WM_SIZE:
            ctrl.Size(lParam);
            return 0;
        case WM_PAINT:
            ctrl.Paint(hwnd);
            return 0;
        case WM_COMMAND:
            ctrl.Command(hwnd, wParam);
            return 0;
        case WM_LBUTTONUP:
            ctrl.ButtonUp(hwnd, lParam);
            return 0;
        case WM_LBUTTONDOWN:
            ctrl.ButtonDown(hwnd, lParam);
            return 0;
        case WM_KEYUP:
            ctrl.KeyUp(hwnd, wParam, lParam);
            return 0;
        case WM_KEYDOWN:
            ctrl.KeyDown(hwnd, wParam, lParam);
            return 0;
        case WM_VSCROLL:
            ctrl.VScroll(hwnd, wParam, lParam );
            return 0;
        case WM_HSCROLL:
            ctrl.HScroll(hwnd, wParam, lParam );
            return 0;
        case WM_DESTROY:
            ctrl.Destroy();
            return 0;

    }
    return DefWindowProc (hwnd, message, wParam, lParam );
}

Variable Documentation

CCTypeSet* pCSet = NULL

Definition at line 20 of file APP.Cxx.

CPrintAux PrGlobal

Definition at line 245 of file View.Cxx.

struct t_Ctype vCtype[]
Generated on Wed Nov 13 2024 16:53:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/Fonts/GridFont/APP.h File Reference

  • Multimedia
  • Gdi
  • Fonts
  • GridFont
Defines

APP.h File Reference

#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Defines

#define | CHAR char
#define | COORD int
#define | DONE TRUE
#define | IDM_ABOUT 12
#define | IDM_ALLPAGES 13
#define | IDM_DECIMAL 10
#define | IDM_EXIT 2
#define | IDM_FIRSTPAGE 200
#define | IDM_FONT 9
#define | IDM_HELP 11
#define | IDM_LASTPAGE 201
#define | IDM_NEXTPAGE 3
#define | IDM_NEXTSECTION 5
#define | IDM_PREVPAGE 4
#define | IDM_PREVSECTION 6
#define | IDM_PRINT 1
#define | IDM_ZOOMIN 7
#define | IDM_ZOOMOUT 8
#define | IDS_ANSIFONT 1027
#define | IDS_CLASSNAME 1024
#define | IDS_HEADERFONT 1029
#define | IDS_LABELFONT 1028
#define | IDS_MSGCAPTION 1025
#define | IDS_NOTIMPLEM 1031
#define | IDS_PRINTERR 1030
#define | IDS_UCFONT 1026
#define | INCH1 1440
#define | INCH10 144
#define | INCH2 720
#define | INCH4 360
#define | INCH8 180
#define | LPTSTR LPSTR
#define | PAGEHEIGHT (11*INCH1)
#define | PAGEWIDTH (8*INCH1+INCH2)
#define | TCHAR CHAR
#define | TEXT(x) x
#define | UCHAR unsigned char

Define Documentation

#define CHAR char

Definition at line 15 of file APP.h.

#define COORD int

Definition at line 20 of file APP.h.

#define DONE TRUE

Definition at line 56 of file APP.h.

#define IDM_ABOUT 12

Definition at line 39 of file APP.h.

#define IDM_ALLPAGES 13

Definition at line 40 of file APP.h.

#define IDM_DECIMAL 10

Definition at line 37 of file APP.h.

#define IDM_EXIT 2

Definition at line 29 of file APP.h.

#define IDM_FIRSTPAGE 200

Definition at line 42 of file APP.h.

#define IDM_FONT 9

Definition at line 36 of file APP.h.

#define IDM_HELP 11

Definition at line 38 of file APP.h.

#define IDM_LASTPAGE 201

Definition at line 43 of file APP.h.

#define IDM_NEXTPAGE 3

Definition at line 30 of file APP.h.

#define IDM_NEXTSECTION 5

Definition at line 32 of file APP.h.

#define IDM_PREVPAGE 4

Definition at line 31 of file APP.h.

#define IDM_PREVSECTION 6

Definition at line 33 of file APP.h.

#define IDM_PRINT 1

Definition at line 28 of file APP.h.

#define IDM_ZOOMIN 7

Definition at line 34 of file APP.h.

#define IDM_ZOOMOUT 8

Definition at line 35 of file APP.h.

#define IDS_ANSIFONT 1027

Definition at line 49 of file APP.h.

#define IDS_CLASSNAME 1024

Definition at line 46 of file APP.h.

#define IDS_HEADERFONT 1029

Definition at line 51 of file APP.h.

#define IDS_LABELFONT 1028

Definition at line 50 of file APP.h.

#define IDS_MSGCAPTION 1025

Definition at line 47 of file APP.h.

#define IDS_NOTIMPLEM 1031

Definition at line 53 of file APP.h.

#define IDS_PRINTERR 1030

Definition at line 52 of file APP.h.

#define IDS_UCFONT 1026

Definition at line 48 of file APP.h.

#define INCH1 1440

Definition at line 57 of file APP.h.

#define INCH10 144

Definition at line 61 of file APP.h.

#define INCH2 720

Definition at line 58 of file APP.h.

#define INCH4 360

Definition at line 59 of file APP.h.

#define INCH8 180

Definition at line 60 of file APP.h.

#define LPTSTR LPSTR

Definition at line 18 of file APP.h.

#define PAGEHEIGHT (11*INCH1)

Definition at line 65 of file APP.h.

#define PAGEWIDTH (8*INCH1+INCH2)

Definition at line 64 of file APP.h.

#define TCHAR CHAR

Definition at line 17 of file APP.h.

#define TEXT ( x ) x

Definition at line 19 of file APP.h.

#define UCHAR unsigned char

Definition at line 16 of file APP.h.

Generated on Wed Nov 13 2024 16:53:16 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/Fonts/GridFont/APP.Hxx File Reference

  • Multimedia
  • Gdi
  • Fonts
  • GridFont
Classes | Functions

APP.Hxx File Reference

#include <string.h>
#include "app.h"
#include "view.hxx"
#include "grid.hxx"
#include "box.hxx"

Go to the source code of this file.

Classes

class | CController
class | CWindow

Functions

BOOL CALLBACK | AboutDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
void | MakeWindowClass (WNDPROC WndProc, LPTSTR szAppName, HINSTANCE hInst)
BOOL CALLBACK | PropDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
int WINAPI | WinMain (HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR cmdParam, int cmdShow)
LRESULT CALLBACK | WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)

Function Documentation

BOOL CALLBACK AboutDlgProc | ( | HWND | hwnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 471 of file APP.Cxx.

{

    switch(message)
    {
       case WM_INITDIALOG:
            return TRUE;
       case WM_COMMAND:
            switch (wParam) //Command ID
            {
               case IDOK:
               case IDCANCEL:
                    EndDialog(hwnd, 0);
                    return TRUE;
            }
            break;
    }
    return FALSE;
}

void MakeWindowClass | ( | WNDPROC | WndProc,
 |  | LPTSTR | szAppName,
 |  | HINSTANCE | hInst
 | ) |  |

Definition at line 401 of file APP.Cxx.

{
    WNDCLASS cl;

    cl.style = CS_HREDRAW | CS_VREDRAW;
    cl.lpfnWndProc = WndProc;
    cl.cbClsExtra = 0;
    cl.cbWndExtra = 0;
    cl.hInstance = hInst;
    cl.hIcon = LoadIcon ( hInst, szAppName );
    cl.hCursor = LoadCursor ( NULL, IDC_ARROW );
    cl.hbrBackground = GetStockBrush ( WHITE_BRUSH );
    cl.lpszMenuName = szAppName;
    cl.lpszClassName = szAppName;

    RegisterClass (&cl);
}

BOOL CALLBACK PropDlgProc | ( | HWND | hwnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 579 of file APP.Cxx.

{
  INT_PTR i;
    switch (message)
    {
       case WM_INITDIALOG:
        for( i=0; i<sizeof vCtype/sizeof t_Ctype; i++)
      {
          SendDlgItemMessage(hwndDlg, IDC_PROPLIST, LB_ADDSTRING, i, (LPARAM) vCtype[i].pszName);
      }
            return TRUE;
       case WM_COMMAND:
            switch (wParam) //Command ID
            {
               case IDOK:
            if( pCSet )
            {
            delete pCSet;
          }
            i = SendDlgItemMessage(hwndDlg, IDC_PROPLIST, LB_GETCARETINDEX, 0, 0);
            pCSet = new CCTypeSet(vCtype[i].fVal[0],vCtype[i].fVal[1], vCtype[i].fVal[2]);
                    EndDialog(hwndDlg, 0);
          return TRUE;
               case IDCANCEL:
            if( pCSet )
          {
            delete pCSet;
          }
                    EndDialog(hwndDlg, 0);
                    return TRUE;
            }
            break;
    }
    return FALSE ;
}

int WINAPI WinMain | ( | HINSTANCE | hInst,
 |  | HINSTANCE | hPrevInst,
 |  | LPSTR | cmdParam,
 |  | int | cmdShow
 | ) |  |

_tWinMain - Application entry point and dispatch loop

Definition at line 48 of file Demo.c.

{

    HWND hWnd;
    MSG msg;
    CHAR szAppName[64];

    UNREFERENCED_PARAMETER(lpCmdLine);

    if (!hPrevInstance)
        if (!DemoInit(hInstance))
            return (0);

    hInst = hInstance;
    LoadString(hInstance, IDS_APPNAME, szAppName, sizeof(szAppName));

    hWnd = CreateWindow("Demo",
        szAppName,
        WS_OVERLAPPEDWINDOW,
        CW_USEDEFAULT,
        CW_USEDEFAULT,
        CW_USEDEFAULT,
        CW_USEDEFAULT,
        NULL,
        NULL,
        hInstance,
        NULL);

    if (!hWnd)
        return (0);

    ShowWindow(hWnd, nCmdShow);
    UpdateWindow(hWnd);

    while (GetMessage(&msg, NULL, 0, 0)) {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }
    return (int)(msg.wParam);
}

LRESULT CALLBACK WndProc | ( | HWND | hwnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 290 of file Generic.C.

{
   int wmId, wmEvent;
   PAINTSTRUCT ps;
   HDC hdc;
      POINT pnt;
   HMENU hMenu;
      BOOL bGotHelp;

   switch (message) {

      case WM_COMMAND:
         wmId    = LOWORD(wParam); // Remember, these are...
         wmEvent = HIWORD(wParam); // ...different for Win32!

         //Parse the menu selections:
         switch (wmId) {

            case IDM_ABOUT:
               DialogBox(hInst, "AboutBox", hWnd, (DLGPROC)About);
               break;

            case IDM_EXIT:
               DestroyWindow (hWnd);
               break;

            case IDM_HELPTOPICS: // Only called in Windows 95
               bGotHelp = WinHelp (hWnd, APPNAME".HLP", HELP_FINDER,(DWORD)0);
               if (!bGotHelp)
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            case IDM_HELPCONTENTS: // Not called in Windows 95
               bGotHelp = WinHelp (hWnd, APPNAME".HLP", HELP_CONTENTS,(DWORD)0);
               if (!bGotHelp)
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            case IDM_HELPSEARCH: // Not called in Windows 95
               if (!WinHelp(hWnd, APPNAME".HLP", HELP_PARTIALKEY,
                           (ULONG_PTR)(LPSTR)""))
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            case IDM_HELPHELP: // Not called in Windows 95
               if(!WinHelp(hWnd, (LPSTR)NULL, HELP_HELPONHELP, 0))
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            // Here are all the other possible menu options,
            // all of these are currently disabled:
            case IDM_NEW:
            case IDM_OPEN:
            case IDM_SAVE:
            case IDM_SAVEAS:
            case IDM_UNDO:
            case IDM_CUT:
            case IDM_COPY:
            case IDM_PASTE:
            case IDM_LINK:
            case IDM_LINKS:

            default:
               return (DefWindowProc(hWnd, message, wParam, lParam));
         }
         break;

      case WM_NCRBUTTONUP: // RightClick on windows non-client area...
         if (IS_WIN95 && SendMessage(hWnd, WM_NCHITTEST, 0, lParam) == HTSYSMENU)
         {
            // The user has clicked the right button on the applications
            // 'System Menu'. Here is where you would alter the default
            // system menu to reflect your application. Notice how the
            // explorer deals with this. For this app, we aren't doing
            // anything
            return (DefWindowProc(hWnd, message, wParam, lParam));
         } else {
            // Nothing we are interested in, allow default handling...
            return (DefWindowProc(hWnd, message, wParam, lParam));
         }
            break;

        case WM_RBUTTONDOWN: // RightClick in windows client area...
            pnt.x = LOWORD(lParam);
            pnt.y = HIWORD(lParam);
            ClientToScreen(hWnd, (LPPOINT) &pnt);
      // This is where you would determine the appropriate 'context'
      // menu to bring up. Since this app has no real functionality,
      // we will just bring up the 'Help' menu:
            hMenu = GetSubMenu (GetMenu (hWnd), 2);
            if (hMenu) {
                TrackPopupMenu (hMenu, 0, pnt.x, pnt.y, 0, hWnd, NULL);
            } else {
            // Couldn't find the menu...
                MessageBeep(0);
            }
            break;

      case WM_DISPLAYCHANGE: // Only comes through on plug'n'play systems
      {
         SIZE  szScreen;
         DWORD dwBitsPerPixel = (DWORD)wParam;

         szScreen.cx = LOWORD(lParam);
         szScreen.cy = HIWORD(lParam);

         MessageBox (GetFocus(), GetStringRes(IDS_DISPLAYCHANGED),
                     szAppName, 0);
      }
      break;

      case WM_PAINT:
         hdc = BeginPaint (hWnd, &ps);
         // Add any drawing code here...
         EndPaint (hWnd, &ps);
         break;

      case WM_DESTROY:
         // Tell WinHelp we don't need it any more...
               WinHelp (hWnd, APPNAME".HLP", HELP_QUIT,(DWORD)0);
         PostQuitMessage(0);
         break;

      default:
         return (DefWindowProc(hWnd, message, wParam, lParam));
   }
   return (0);
}

Generated on Wed Nov 13 2024 16:53:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/Fonts/GridFont/Box.Cxx File Reference

  • Multimedia
  • Gdi
  • Fonts
  • GridFont

Box.Cxx File Reference

#include <windows.h>
#include <windowsx.h>
#include "app.h"
#include "box.hxx"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/Fonts/GridFont/Box.Hxx File Reference

  • Multimedia
  • Gdi
  • Fonts
  • GridFont
Classes

Box.Hxx File Reference

#include "font.hxx"
#include "grid.hxx"

Go to the source code of this file.

Classes

class | CBox
class | CBoxFormat
class | CTextField
Generated on Wed Nov 13 2024 16:53:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/Fonts/GridFont/Canvas.Hxx File Reference

  • Multimedia
  • Gdi
  • Fonts
  • GridFont
Classes

Canvas.Hxx File Reference

Go to the source code of this file.

Classes

class | CCanvas
class | CPaintCanvas
class | CPoint
class | CScreenCanvas
Generated on Wed Nov 13 2024 16:53:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/Fonts/GridFont/Cset.Cxx File Reference

  • Multimedia
  • Gdi
  • Fonts
  • GridFont

Cset.Cxx File Reference

#include <windows.h>
#include <windowsx.h>
#include <string.h>
#include "app.h"
#include "cset.hxx"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/Fonts/GridFont/Cset.Hxx File Reference

  • Multimedia
  • Gdi
  • Fonts
  • GridFont
Classes

Cset.Hxx File Reference

Go to the source code of this file.

Classes

class | CCTypeSet
class | CFontSet
class | CSet
Generated on Wed Nov 13 2024 16:53:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/Fonts/GridFont/Font.Cxx File Reference

  • Multimedia
  • Gdi
  • Fonts
  • GridFont

Font.Cxx File Reference

#include <windows.h>
#include <windowsx.h>
#include <commdlg.h>
#include <string.h>
#include <memory.h>
#include "app.h"
#include "font.hxx"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/Fonts/GridFont/Font.Hxx File Reference

  • Multimedia
  • Gdi
  • Fonts
  • GridFont
Classes

Font.Hxx File Reference

#include "canvas.hxx"

Go to the source code of this file.

Classes

class | CBlackPen
class | CBrush
class | CFont
class | CFontSelect
Generated on Wed Nov 13 2024 16:53:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/Fonts/GridFont/Grid.Cxx File Reference

  • Multimedia
  • Gdi
  • Fonts
  • GridFont
Defines | Variables

Grid.Cxx File Reference

#include <windows.h>
#include <windowsx.h>
#include <string.h>
#include <tchar.h>
#include <stdio.h>
#include "app.h"
#include "grid.hxx"

Go to the source code of this file.

Defines

#define | CMAPHEX 0x70616d63
#define | MBERROR TEXT("Application Error.")
#define | MBERRORFLAGS MB_OK | MB_ICONHAND
#define | NBSP 0x00A0
#define | NBYTES 256
#define | OFFSETERROR 0

Variables

USHORT * vEndCount
CSet * vpCSet
int | vSegCount
USHORT * vStartCount

Define Documentation

#define CMAPHEX 0x70616d63
#define MBERROR TEXT("Application Error.")
#define MBERRORFLAGS MB_OK | MB_ICONHAND
#define NBSP 0x00A0

Definition at line 184 of file Grid.Cxx.

#define NBYTES 256
#define OFFSETERROR 0

Variable Documentation

USHORT* vEndCount

Definition at line 16 of file Grid.Cxx.

CSet* vpCSet

Definition at line 18 of file Grid.Cxx.

int vSegCount

Definition at line 14 of file Grid.Cxx.

USHORT* vStartCount

Definition at line 15 of file Grid.Cxx.

Generated on Wed Nov 13 2024 16:53:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/Fonts/GridFont/Grid.Hxx File Reference

  • Multimedia
  • Gdi
  • Fonts
  • GridFont
Classes | Defines

Grid.Hxx File Reference

#include "canvas.hxx"
#include "cset.hxx"
#include "font.hxx"

Go to the source code of this file.

Classes

class | CBlockFormat
class | CBlockFrame
class | CCharBlock
class | CCharGrid
class | CCodeGrid
class | CFontRange
class | CFrameFormat
class | CGrid
class | CGridIt
class | CLineGrid
class | CModel
class | CPage
class | CPageFormat
class | CTextGrid

Defines

#define | ALLPAGES 1
#define | DECIMAL 1
#define | HEXADECIMAL 0
#define | MASKROOT 1
#define | PAGEELEMS 2
#define | PAGEPRINT 4
#define | USEDONLY 0

Define Documentation

#define ALLPAGES 1

Definition at line 265 of file Grid.Hxx.

#define DECIMAL 1

Definition at line 122 of file Grid.Hxx.

#define HEXADECIMAL 0

Definition at line 121 of file Grid.Hxx.

#define MASKROOT 1

Definition at line 123 of file Grid.Hxx.

#define PAGEELEMS 2

Definition at line 164 of file Grid.Hxx.

#define PAGEPRINT 4

Definition at line 165 of file Grid.Hxx.

#define USEDONLY 0

Definition at line 264 of file Grid.Hxx.

Generated on Wed Nov 13 2024 16:53:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/Fonts/GridFont/Resource.h File Reference

  • Multimedia
  • Gdi
  • Fonts
  • GridFont
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_PROPLIST 1000
#define | IDC_STATIC -1
#define | IDM_SHOWPROP 40001

Define Documentation

#define IDC_PROPLIST 1000

Definition at line 5 of file Resource.h.

#define IDC_STATIC -1

Definition at line 7 of file Resource.h.

#define IDM_SHOWPROP 40001

Definition at line 6 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/Fonts/GridFont/View.Cxx File Reference

  • Multimedia
  • Gdi
  • Fonts
  • GridFont
Variables

View.Cxx File Reference

#include <windows.h>
#include <windowsx.h>
#include <commdlg.h>
#include "app.h"
#include "view.hxx"
#include "grid.hxx"

Go to the source code of this file.

Variables

CPrintAux PrGlobal

Variable Documentation

CPrintAux PrGlobal

Definition at line 245 of file View.Cxx.

Generated on Wed Nov 13 2024 16:53:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/Fonts/GridFont/View.Hxx File Reference

  • Multimedia
  • Gdi
  • Fonts
  • GridFont
Classes | Defines | Functions

View.Hxx File Reference

#include "canvas.hxx"

Go to the source code of this file.

Classes

class | CPrintAux
class | CPrintCanvas
class | CPrintRequest
class | CScrollableView
class | CView

Defines

#define | PREQ_CANCEL 1
#define | PREQ_ERRENDPAGE 4
#define | PREQ_ERROR 32
#define | PREQ_ERRSTARTDOC 16
#define | PREQ_ERRSTARTPAGE 8
#define | PREQ_SUCCESS NULL
#define | PREQ_USERABORT 2

Functions

BOOL CALLBACK | AbortProc (HDC hdcPrn, short nCode)
BOOL CALLBACK | PrintDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)

Define Documentation

#define PREQ_CANCEL 1

Definition at line 73 of file View.Hxx.

#define PREQ_ERRENDPAGE 4

Definition at line 75 of file View.Hxx.

#define PREQ_ERROR 32

Definition at line 78 of file View.Hxx.

#define PREQ_ERRSTARTDOC 16

Definition at line 77 of file View.Hxx.

#define PREQ_ERRSTARTPAGE 8

Definition at line 76 of file View.Hxx.

#define PREQ_SUCCESS NULL

Definition at line 72 of file View.Hxx.

#define PREQ_USERABORT 2

Definition at line 74 of file View.Hxx.

Function Documentation

BOOL CALLBACK AbortProc | ( | HDC | hdcPrn,
 |  | short | nCode
 | ) |  |

Definition at line 517 of file APP.Cxx.

{
    MSG   msg ;

    while (!PrGlobal._bUserAbort && PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
    {
        if (!PrGlobal._hDlgPrint
                ||
            !IsDialogMessage (PrGlobal._hDlgPrint, &msg))
        {
            TranslateMessage (&msg) ;
            DispatchMessage (&msg) ;
        }
    }
    return !PrGlobal._bUserAbort ;
}

BOOL CALLBACK PrintDlgProc | ( | HWND | hwnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 496 of file APP.Cxx.

{
    switch (message)
    {
        case WM_INITDIALOG:
             SetWindowText (hwndDlg, (TCHAR *)lParam) ;
             EnableMenuItem (GetSystemMenu (hwndDlg, FALSE), SC_CLOSE, MF_GRAYED) ;
             return TRUE ;

        case WM_COMMAND:
             PrGlobal._bUserAbort = TRUE ;
             EnableWindow (GetParent (hwndDlg), TRUE) ;
             DestroyWindow (hwndDlg) ;
             PrGlobal._hDlgPrint = 0 ;
             return TRUE ;
    }
    return FALSE ;
}

Generated on Wed Nov 13 2024 16:53:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/fontsize/Fontsize.c File Reference

  • Multimedia
  • Gdi
  • fontsize
Defines | Functions

Fontsize.c File Reference

#include <windows.h>
#include <stdio.h>

Go to the source code of this file.

Defines

#define | STRICT

Functions

int WINAPI | WinMain (HINSTANCE hinst, HINSTANCE hinstPrev, LPSTR pszCmdLine, int nCmdShow)

Define Documentation

#define STRICT

Definition at line 17 of file Fontsize.c.

Function Documentation

int WINAPI WinMain | ( | HINSTANCE | hinst,
 |  | HINSTANCE | hinstPrev,
 |  | LPSTR | pszCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 64 of file Fontsize.c.

{
    HDC hdc;
    int iDPI;
    char sz[1024];

    hdc = GetDC(NULL);                  /* Get DC for screen */
    iDPI = GetDeviceCaps(hdc, LOGPIXELSX);
    ReleaseDC(NULL, hdc);

    if (iDPI < 96)
    {
        _snprintf(sz, sizeof(sz), "%d DPI - Even smaller than Small fonts", iDPI);
    }
    else if (iDPI == 96)
    {
        _snprintf(sz, sizeof(sz), "%d DPI - Small fonts", iDPI);
    }
    else if (iDPI < 120)
    {
        _snprintf(sz, sizeof(sz), "%d DPI - Between Small fonts and Large fonts", iDPI);
    }
    else if (iDPI == 120)
    {
        _snprintf(sz, sizeof(sz), "%d DPI - Large fonts", iDPI);
    }
    else
    {
        _snprintf(sz, sizeof(sz), "%d DPI - Even larger than Large fonts", iDPI);
    }

    MessageBox(NULL, sz, "FontSize", MB_OK);

    return 0;
}

Generated on Wed Nov 13 2024 16:53:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/GdiDemo/Bounce.c File Reference

  • Multimedia
  • Gdi
  • GdiDemo
Functions

Bounce.c File Reference

#include <windows.h>
#include "gdidemo.h"
#include "bounce.h"

Go to the source code of this file.

Functions

VOID | ballBounce (HANDLE hBall)
HANDLE | ballCreate (HWND hWnd, int nWidth, int nHeight, COLORREF crColor)
BOOL | ballDestroy (HANDLE hBall)
BOOL | ballGetDimensions (HANDLE hBall, LPPOINT pDimension)
BOOL | ballGetDirection (HANDLE hBall, LPPOINT pDirection)
BOOL | ballGetPosition (HANDLE hBall, LPPOINT pPosition)
BOOL | ballSetDimensions (HANDLE hBall, int nWidth, int nHeight)
BOOL | ballSetDirection (HANDLE hBall, int xDirection, int yDirection)
BOOL | ballSetPosition (HANDLE hBall, int x, int y)
BOOL | BounceCommandProc (HWND hWnd, WPARAM wParam, LPARAM lParam)
BOOL | BounceCreateProc (HWND hWnd)
VOID | BounceDestroyProc (HWND hWnd)
VOID | BounceObjects (HWND hWnd)
VOID | BouncePaintProc (HWND hWnd)
LRESULT CALLBACK | BounceProc (HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam)
VOID | BounceRefresh (HWND hWnd)
VOID | CheckEdgePosition (HWND hWnd, HANDLE hBall)
HWND FAR | CreateBounceWindow (HWND hWndClient, int nItem)
VOID | XFormClear (PMYXFORM)
VOID | XFormPoint (PMYXFORM, LPPOINT)
VOID | XFormScale (PMYXFORM, int, int)
VOID | XFormTrans (PMYXFORM, int, int)

Function Documentation

VOID ballBounce ( HANDLE hBall )

Definition at line 431 of file Bounce.c.

{
    PBALLDATA pbd;
    HDC       hDC;
    HBRUSH    hBrush;
    POINT     pOrg,pExt;
    HRGN      hTmp,hOld,hNew;

    if(pbd = (PBALLDATA)LocalLock(hBall))
    {
        /*
        ** Create old ball object.
        */
        pOrg.x = 0;
        pOrg.y = 0;
        pExt.x = pbd->nWidth;
        pExt.y = pbd->nHeight;
        XFormPoint(&pbd->xForm,&pOrg);
        XFormPoint(&pbd->xForm,&pExt);
        hOld = CreateEllipticRgn(pOrg.x,pOrg.y,pExt.x,pExt.y);

        /*
        ** Create new ball object.
        */
        if(pbd->bNewPosition)
        {
            pbd->bNewPosition = FALSE;
            XFormClear(&pbd->xForm);
            XFormTrans(&pbd->xForm,pbd->xPosition,pbd->yPosition);
        }
        else
            XFormTrans(&pbd->xForm,pbd->xDirection,pbd->yDirection);
        pOrg.x = 0;
        pOrg.y = 0;
        pExt.x = pbd->nWidth;
        pExt.y = pbd->nHeight;
        XFormPoint(&pbd->xForm,&pOrg);
        XFormPoint(&pbd->xForm,&pExt);
        hNew = CreateEllipticRgn(pOrg.x,pOrg.y,pExt.x,pExt.y);

        if(hDC = GetDC(pbd->hWnd))
        {
            hTmp = CreateRectRgn(1,1,2,2);
            CombineRgn(hTmp,hOld,hNew,RGN_DIFF);
            FillRgn(hDC,hTmp,GETCLASSBRUSH(pbd->hWnd));

            hBrush = CreateSolidBrush(pbd->crColor);
            FillRgn(hDC,hNew,hBrush);
            DeleteObject(hBrush);

            ReleaseDC(pbd->hWnd,hDC);

            DeleteObject(hTmp);
        }

        DeleteObject(hOld);
        DeleteObject(hNew);

        LocalUnlock(hBall);
    }
    return;
}

HANDLE ballCreate | ( | HWND | hWnd,
 |  | int | nWidth,
 |  | int | nHeight,
 |  | COLORREF | crColor
 | ) |  |

Definition at line 394 of file Bounce.c.

{
    HANDLE    hBall;
    PBALLDATA pbd;

    if(hBall = LocalAlloc(LHND,sizeof(BALLDATA)))
    {
        if(pbd = (PBALLDATA)LocalLock(hBall))
        {
            pbd->hWnd         = hWnd;
            pbd->nWidth       = nWidth;
            pbd->nHeight      = nHeight;
            pbd->xDirection   = 0;
            pbd->yDirection   = 0;
            pbd->bNewPosition = FALSE;
            pbd->xPosition    = 0;
            pbd->yPosition    = 0;
            pbd->crColor      = crColor;
            XFormClear(&pbd->xForm);

            LocalUnlock(hBall);
            return(hBall);
        }
        LocalFree(hBall);
    }
    return(NULL);
}

BOOL ballDestroy ( HANDLE hBall )

Definition at line 423 of file Bounce.c.

{
    if(LocalFree(hBall))
        return(FALSE);
    return(TRUE);
}

BOOL ballGetDimensions | ( | HANDLE | hBall,
 |  | LPPOINT | pDimension
 | ) |  |

Definition at line 499 of file Bounce.c.

{
    PBALLDATA pbd;
    BOOL      bOK;

    bOK = FALSE;
    if(pbd = (PBALLDATA)LocalLock(hBall))
    {
        pDimension->x = pbd->nWidth;
        pDimension->y = pbd->nHeight;

        bOK = TRUE;
        LocalUnlock(hBall);
    }
    return(bOK);
}

BOOL ballGetDirection | ( | HANDLE | hBall,
 |  | LPPOINT | pDirection
 | ) |  |

Definition at line 537 of file Bounce.c.

{
    PBALLDATA pbd;
    BOOL      bOK;

    bOK = FALSE;
    if(pbd = (PBALLDATA)LocalLock(hBall))
    {
        pDirection->x = pbd->xDirection;
        pDirection->y = pbd->yDirection;

        bOK = TRUE;
        LocalUnlock(hBall);
    }
    return(bOK);
}

BOOL ballGetPosition | ( | HANDLE | hBall,
 |  | LPPOINT | pPosition
 | ) |  |

Definition at line 575 of file Bounce.c.

{
    PBALLDATA pbd;
    BOOL      bOK;
    POINT     pOrg;

    bOK = FALSE;
    if(pbd = (PBALLDATA)LocalLock(hBall))
    {
        pOrg.x = 0;
        pOrg.y = 0;
        XFormPoint(&pbd->xForm,&pOrg);

        pPosition->x = pOrg.x;
        pPosition->y = pOrg.y;

        bOK = TRUE;
        LocalUnlock(hBall);
    }
    return(bOK);
}

BOOL ballSetDimensions | ( | HANDLE | hBall,
 |  | int | nWidth,
 |  | int | nHeight
 | ) |  |

Definition at line 518 of file Bounce.c.

{
    PBALLDATA pbd;
    BOOL      bOK;

    bOK = FALSE;
    if(pbd = (PBALLDATA)LocalLock(hBall))
    {
        pbd->nWidth  = nWidth;
        pbd->nHeight = nHeight;

        bOK = TRUE;
        LocalUnlock(hBall);
    }
    return(bOK);
}

BOOL ballSetDirection | ( | HANDLE | hBall,
 |  | int | xDirection,
 |  | int | yDirection
 | ) |  |

Definition at line 556 of file Bounce.c.

{
    PBALLDATA pbd;
    BOOL      bOK;

    bOK = FALSE;
    if(pbd = (PBALLDATA)LocalLock(hBall))
    {
        pbd->xDirection = xDirection;
        pbd->yDirection = yDirection;

        bOK = TRUE;
        LocalUnlock(hBall);
    }
    return(bOK);
}

BOOL ballSetPosition | ( | HANDLE | hBall,
 |  | int | x,
 |  | int | y
 | ) |  |

Definition at line 599 of file Bounce.c.

{
    PBALLDATA pbd;
    BOOL      bOK;

    bOK = FALSE;
    if(pbd = (PBALLDATA)LocalLock(hBall))
    {
        pbd->bNewPosition = TRUE;
        pbd->xPosition    = x;
        pbd->yPosition    = y;

        bOK = TRUE;
        LocalUnlock(hBall);
    }
    return(bOK);
}

BOOL BounceCommandProc | ( | HWND | hWnd,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 132 of file Bounce.c.

{
    hWnd   = hWnd;
    wParam = wParam;
    lParam = lParam;

    return(TRUE);
}

BOOL BounceCreateProc ( HWND hWnd )

Definition at line 103 of file Bounce.c.

{
    PBOUNCEDATA pbd;

    if(AllocWindowInfo(hWnd,sizeof(BOUNCEDATA)))
    {
        if(pbd = (PBOUNCEDATA)LockWindowInfo(hWnd))
        {
            pbd->hBall1 = ballCreate(hWnd,20,20,RGB(255,0,0));
            pbd->hBall2 = ballCreate(hWnd,20,20,RGB(0,0,255));
            pbd->hBall3 = ballCreate(hWnd,20,20,RGB(0,255,0));
            pbd->hBall4 = ballCreate(hWnd,20,20,RGB(255,0,255));

            UnlockWindowInfo(hWnd);

            SetTimer(hWnd,1,50,NULL);
            return(TRUE);
        }
        FreeWindowInfo(hWnd);
    }
    return(FALSE);
}

VOID BounceDestroyProc ( HWND hWnd )

Definition at line 165 of file Bounce.c.

{
    PBOUNCEDATA pbd;

    KillTimer(hWnd,1);
    if(pbd = (PBOUNCEDATA)LockWindowInfo(hWnd))
    {
        ballDestroy(pbd->hBall1);
        ballDestroy(pbd->hBall2);
        ballDestroy(pbd->hBall3);
        ballDestroy(pbd->hBall4);

        UnlockWindowInfo(hWnd);
    }
    FreeWindowInfo(hWnd);
    return;
}

VOID BounceObjects ( HWND hWnd )

Definition at line 246 of file Bounce.c.

{
    PBOUNCEDATA pbd;

    if(pbd = (PBOUNCEDATA)LockWindowInfo(hWnd))
    {
        /*
        ** Determine if the balls hit any of the edges of the display.  If
        ** they do, then these functions reset their position to something
        ** more desireable and re-do their direction.
        */
        CheckEdgePosition(hWnd,pbd->hBall1);
        CheckEdgePosition(hWnd,pbd->hBall2);
        CheckEdgePosition(hWnd,pbd->hBall3);
        CheckEdgePosition(hWnd,pbd->hBall4);

        ballBounce(pbd->hBall1);
        ballBounce(pbd->hBall2);
        ballBounce(pbd->hBall3);
        ballBounce(pbd->hBall4);

        UnlockWindowInfo(hWnd);
    }
    return;
}

VOID BouncePaintProc ( HWND hWnd )

Definition at line 146 of file Bounce.c.

{
    HDC         hDC;
    PAINTSTRUCT ps;

    if(hDC = BeginPaint(hWnd,&ps))
        EndPaint(hWnd,&ps);

    BounceRefresh(hWnd);

    return;
}

LRESULT CALLBACK BounceProc | ( | HWND | hWnd,
 |  | UINT | wMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 63 of file Bounce.c.

{
    switch(wMsg)
    {
        case WM_CREATE:
            BounceCreateProc(hWnd);
            break;

        case WM_MOVE:
            BounceRefresh(hWnd);
            break;

        case WM_COMMAND:
            BounceCommandProc(hWnd,wParam,lParam);
            break;

        case WM_TIMER:
            BounceObjects(hWnd);
            break;

        case WM_PAINT:
            BouncePaintProc(hWnd);
            break;

        case WM_DESTROY:
            BounceDestroyProc(hWnd);
            break;

        default:
            return(DefMDIChildProc(hWnd,wMsg,wParam,lParam));
    }
    return(0l);
}

VOID BounceRefresh ( HWND hWnd )

Definition at line 189 of file Bounce.c.

{
    PBOUNCEDATA pbd;
    RECT        rect;
    HDC         hDC;
    POINT       pDimensions;
    int         xDirection,yDirection;

    if(pbd = (PBOUNCEDATA)LockWindowInfo(hWnd))
    {
        if(hDC = GetDC(hWnd))
        {
            GetClientRect(hWnd,&rect);
            FillRect(hDC,&rect,GETCLASSBRUSH(hWnd));

            xDirection = ((lRandom() % 5)+5);
            yDirection = ((lRandom() % 5)+5);
            ballSetPosition(pbd->hBall1,0,0);
            ballSetDirection(pbd->hBall1,xDirection,yDirection);

            ballGetDimensions(pbd->hBall2,&pDimensions);
            ballSetPosition(pbd->hBall2,rect.right-pDimensions.x,0);
            xDirection = -(((int)lRandom() % 5)+5);
            yDirection =  ((lRandom() % 5)+5);
            ballSetDirection(pbd->hBall2,xDirection,yDirection);

            ballGetDimensions(pbd->hBall3,&pDimensions);
            ballSetPosition(pbd->hBall3,0,rect.bottom-pDimensions.y);
            xDirection =  ((lRandom() % 5)+5);
            yDirection = -((int)(lRandom() % 5)+5);
            ballSetDirection(pbd->hBall3,xDirection,yDirection);

            ballGetDimensions(pbd->hBall4,&pDimensions);
            ballSetPosition(pbd->hBall4,rect.right-pDimensions.x,rect.bottom-pDimensions.y);
            xDirection = -((int)(lRandom() % 5)+5);
            yDirection = -((int)(lRandom() % 5)+5);
            ballSetDirection(pbd->hBall4,xDirection,yDirection);

            ballBounce(pbd->hBall1);
            ballBounce(pbd->hBall2);
            ballBounce(pbd->hBall3);
            ballBounce(pbd->hBall4);

            ReleaseDC(hWnd,hDC);
        }
        UnlockWindowInfo(hWnd);
    }
    return;
}

VOID CheckEdgePosition | ( | HWND | hWnd,
 |  | HANDLE | hBall
 | ) |  |

Definition at line 275 of file Bounce.c.

{
    POINT pPos,pDir,pDim;
    int   xNewPos,yNewPos,xNewDir,yNewDir;
    RECT  rect;

    ballGetPosition(hBall,&pPos);
    ballGetDirection(hBall,&pDir);
    ballGetDimensions(hBall,&pDim);

    GetClientRect(hWnd,&rect);

    /*
    ** Check each edge of the client rectagle.  If the ball goes past the
    ** boundries, reset the position and give it a new direction.
    */
    xNewDir = pDir.x;
    yNewDir = pDir.y;
    xNewPos = pPos.x+pDir.x;
    yNewPos = pPos.y+pDir.y;

    if(xNewPos < rect.left)
    {
        xNewDir = ((lRandom() % 5)+5);
        ballSetPosition(hBall,rect.left,pPos.y);
    }
    if((xNewPos+pDim.x) > rect.right)
    {
        xNewDir = -(((int)lRandom() % 5)+5);
        ballSetPosition(hBall,rect.right-pDim.x,pPos.y);
    }
    if(yNewPos < rect.top)
    {
        yNewDir = ((lRandom() % 5)+5);
        ballSetPosition(hBall,pPos.x,rect.top);
    }
    if((yNewPos+pDim.y) > rect.bottom)
    {
        yNewDir = -(((int)lRandom() % 5)+5);
        ballSetPosition(hBall,pPos.x,rect.bottom-pDim.y);
    }
    ballSetDirection(hBall,xNewDir,yNewDir);

    return;
}

HWND FAR CreateBounceWindow | ( | HWND | hWndClient,
 |  | int | nItem
 | ) |  |

Definition at line 31 of file Bounce.c.

{
    HANDLE          hInstance;
    MDICREATESTRUCT mcs;
    static char buffer[256];

    hInstance = GETINSTANCE(hWndClient);
    LoadString (hInstance, BOUNCETITLE, buffer, 256);

    /*
    ** Initialize the MDI create struct for creation of the
    ** test window.
    */
    mcs.szClass = BOUNCECLASS;
    mcs.szTitle = buffer;
    mcs.hOwner  = hInstance;
    mcs.x       = CW_USEDEFAULT;
    mcs.y       = CW_USEDEFAULT;
    mcs.cx      = CW_USEDEFAULT;
    mcs.cy      = CW_USEDEFAULT;
    mcs.style   = 0l;
    mcs.lParam  = (LONG)nItem;

    return((HWND)SendMessage(hWndClient,WM_MDICREATE,0,(LPARAM)(LPMDICREATESTRUCT)&mcs));
}

VOID XFormClear ( PMYXFORM pXForm )

Definition at line 329 of file Bounce.c.

{
    int Row,Col;

    for(Row=0; Row < 3; Row++)
        for(Col=0; Col < 3; Col++)
            if(Row == Col)
                pXForm->xForm[Row][Col] = 1;
            else
                pXForm->xForm[Row][Col] = 0;
    return;
}

VOID XFormPoint | ( | PMYXFORM | pXForm,
 |  | LPPOINT | pPoint
 | ) |  |

Definition at line 373 of file Bounce.c.

{
    int x,y;

    x = (pXForm->xForm[0][0] * pPoint->x) + (pXForm->xForm[1][0] * pPoint->y) + pXForm->xForm[2][0];
    y = (pXForm->xForm[0][1] * pPoint->x) + (pXForm->xForm[1][1] * pPoint->y) + pXForm->xForm[2][1];

    pPoint->x = x;
    pPoint->y = y;

    return;
}

VOID XFormScale | ( | PMYXFORM | pXForm,
 |  | int | xScale,
 |  | int | yScale
 | ) |  |

Definition at line 348 of file Bounce.c.

{
    int idx;

    for(idx=0; idx < 3; idx++)
    {
        pXForm->xForm[idx][0] = pXForm->xForm[idx][0] * xScale;
        pXForm->xForm[idx][1] = pXForm->xForm[idx][1] * yScale;
    }
    return;
}

VOID XFormTrans | ( | PMYXFORM | pXForm,
 |  | int | xTrans,
 |  | int | yTrans
 | ) |  |

Definition at line 363 of file Bounce.c.

{
    pXForm->xForm[2][0] = pXForm->xForm[2][0] + xTrans;
    pXForm->xForm[2][1] = pXForm->xForm[2][1] + yTrans;

    return;
}

Generated on Wed Nov 13 2024 16:53:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/GdiDemo/Bounce.h File Reference

  • Multimedia
  • Gdi
  • GdiDemo
Classes | Defines | Typedefs | Functions

Bounce.h File Reference

Go to the source code of this file.

Classes

struct | _BALLDATA
struct | _BOUNCEDATA
struct | _MYXFORM

Defines

#define | BOUNCECLASS "BOUNCEDEMO"

Typedefs

typedef struct _BALLDATA | BALLDATA
typedef struct _BOUNCEDATA | BOUNCEDATA
typedef BALLDATA FAR * | LPBALLDATA
typedef BOUNCEDATA FAR * | LPBOUNCEDATA
typedef MYXFORM FAR * | LPMYXFORM
typedef struct _MYXFORM | MYXFORM
typedef BALLDATA NEAR * | NPBALLDATA
typedef BOUNCEDATA NEAR * | NPBOUNCEDATA
typedef MYXFORM NEAR * | NPMYXFORM
typedef BALLDATA * | PBALLDATA
typedef BOUNCEDATA * | PBOUNCEDATA
typedef MYXFORM * | PMYXFORM

Functions

VOID | ballBounce (HANDLE)
HANDLE | ballCreate (HWND, int, int, COLORREF)
BOOL ballDestroy (HANDLE)
BOOL | ballGetDimensions (HANDLE, LPPOINT)
BOOL | ballGetDirection (HANDLE, LPPOINT)
BOOL | ballGetPosition (HANDLE, LPPOINT)
BOOL | ballSetDimensions (HANDLE, int, int)
BOOL | ballSetDirection (HANDLE, int, int)
BOOL | ballSetPosition (HANDLE, int, int)
BOOL | BounceCommandProc (HWND, WPARAM, LPARAM)
BOOL | BounceCreateProc (HWND)
VOID | BounceDestroyProc (HWND)
VOID | BounceObjects (HWND)
VOID | BouncePaintProc (HWND)
LRESULT CALLBACK | BounceProc (HWND, UINT, WPARAM, LPARAM)
VOID | BounceRefresh (HWND)
VOID | CheckEdgePosition (HWND, HANDLE)
HWND FAR | CreateBounceWindow (HWND, int)

Define Documentation

#define BOUNCECLASS "BOUNCEDEMO"

Definition at line 18 of file Bounce.h.

Typedef Documentation

typedef struct _BALLDATA BALLDATA
typedef struct _BOUNCEDATA BOUNCEDATA
typedef BALLDATA FAR* LPBALLDATA

Definition at line 48 of file Bounce.h.

typedef BOUNCEDATA FAR* LPBOUNCEDATA

Definition at line 72 of file Bounce.h.

typedef MYXFORM FAR* LPMYXFORM

Definition at line 27 of file Bounce.h.

typedef struct _MYXFORM MYXFORM
typedef BALLDATA NEAR* NPBALLDATA

Definition at line 47 of file Bounce.h.

typedef BOUNCEDATA NEAR* NPBOUNCEDATA

Definition at line 71 of file Bounce.h.

typedef MYXFORM NEAR* NPMYXFORM

Definition at line 26 of file Bounce.h.

typedef BALLDATA* PBALLDATA

Definition at line 46 of file Bounce.h.

typedef BOUNCEDATA* PBOUNCEDATA

Definition at line 70 of file Bounce.h.

typedef MYXFORM* PMYXFORM

Definition at line 25 of file Bounce.h.

Function Documentation

VOID ballBounce ( HANDLE )

Definition at line 431 of file Bounce.c.

{
    PBALLDATA pbd;
    HDC       hDC;
    HBRUSH    hBrush;
    POINT     pOrg,pExt;
    HRGN      hTmp,hOld,hNew;

    if(pbd = (PBALLDATA)LocalLock(hBall))
    {
        /*
        ** Create old ball object.
        */
        pOrg.x = 0;
        pOrg.y = 0;
        pExt.x = pbd->nWidth;
        pExt.y = pbd->nHeight;
        XFormPoint(&pbd->xForm,&pOrg);
        XFormPoint(&pbd->xForm,&pExt);
        hOld = CreateEllipticRgn(pOrg.x,pOrg.y,pExt.x,pExt.y);

        /*
        ** Create new ball object.
        */
        if(pbd->bNewPosition)
        {
            pbd->bNewPosition = FALSE;
            XFormClear(&pbd->xForm);
            XFormTrans(&pbd->xForm,pbd->xPosition,pbd->yPosition);
        }
        else
            XFormTrans(&pbd->xForm,pbd->xDirection,pbd->yDirection);
        pOrg.x = 0;
        pOrg.y = 0;
        pExt.x = pbd->nWidth;
        pExt.y = pbd->nHeight;
        XFormPoint(&pbd->xForm,&pOrg);
        XFormPoint(&pbd->xForm,&pExt);
        hNew = CreateEllipticRgn(pOrg.x,pOrg.y,pExt.x,pExt.y);

        if(hDC = GetDC(pbd->hWnd))
        {
            hTmp = CreateRectRgn(1,1,2,2);
            CombineRgn(hTmp,hOld,hNew,RGN_DIFF);
            FillRgn(hDC,hTmp,GETCLASSBRUSH(pbd->hWnd));

            hBrush = CreateSolidBrush(pbd->crColor);
            FillRgn(hDC,hNew,hBrush);
            DeleteObject(hBrush);

            ReleaseDC(pbd->hWnd,hDC);

            DeleteObject(hTmp);
        }

        DeleteObject(hOld);
        DeleteObject(hNew);

        LocalUnlock(hBall);
    }
    return;
}

HANDLE ballCreate | ( | HWND | ,
 |  | int | ,
 |  | int | ,
 |  | COLORREF |
 | ) |  |

Definition at line 394 of file Bounce.c.

{
    HANDLE    hBall;
    PBALLDATA pbd;

    if(hBall = LocalAlloc(LHND,sizeof(BALLDATA)))
    {
        if(pbd = (PBALLDATA)LocalLock(hBall))
        {
            pbd->hWnd         = hWnd;
            pbd->nWidth       = nWidth;
            pbd->nHeight      = nHeight;
            pbd->xDirection   = 0;
            pbd->yDirection   = 0;
            pbd->bNewPosition = FALSE;
            pbd->xPosition    = 0;
            pbd->yPosition    = 0;
            pbd->crColor      = crColor;
            XFormClear(&pbd->xForm);

            LocalUnlock(hBall);
            return(hBall);
        }
        LocalFree(hBall);
    }
    return(NULL);
}

BOOL ballDestroy ( HANDLE )

Definition at line 423 of file Bounce.c.

{
    if(LocalFree(hBall))
        return(FALSE);
    return(TRUE);
}

BOOL ballGetDimensions | ( | HANDLE | ,
 |  | LPPOINT |
 | ) |  |

Definition at line 499 of file Bounce.c.

{
    PBALLDATA pbd;
    BOOL      bOK;

    bOK = FALSE;
    if(pbd = (PBALLDATA)LocalLock(hBall))
    {
        pDimension->x = pbd->nWidth;
        pDimension->y = pbd->nHeight;

        bOK = TRUE;
        LocalUnlock(hBall);
    }
    return(bOK);
}

BOOL ballGetDirection | ( | HANDLE | ,
 |  | LPPOINT |
 | ) |  |

Definition at line 537 of file Bounce.c.

{
    PBALLDATA pbd;
    BOOL      bOK;

    bOK = FALSE;
    if(pbd = (PBALLDATA)LocalLock(hBall))
    {
        pDirection->x = pbd->xDirection;
        pDirection->y = pbd->yDirection;

        bOK = TRUE;
        LocalUnlock(hBall);
    }
    return(bOK);
}

BOOL ballGetPosition | ( | HANDLE | ,
 |  | LPPOINT |
 | ) |  |

Definition at line 575 of file Bounce.c.

{
    PBALLDATA pbd;
    BOOL      bOK;
    POINT     pOrg;

    bOK = FALSE;
    if(pbd = (PBALLDATA)LocalLock(hBall))
    {
        pOrg.x = 0;
        pOrg.y = 0;
        XFormPoint(&pbd->xForm,&pOrg);

        pPosition->x = pOrg.x;
        pPosition->y = pOrg.y;

        bOK = TRUE;
        LocalUnlock(hBall);
    }
    return(bOK);
}

BOOL ballSetDimensions | ( | HANDLE | ,
 |  | int | ,
 |  | int |
 | ) |  |

Definition at line 518 of file Bounce.c.

{
    PBALLDATA pbd;
    BOOL      bOK;

    bOK = FALSE;
    if(pbd = (PBALLDATA)LocalLock(hBall))
    {
        pbd->nWidth  = nWidth;
        pbd->nHeight = nHeight;

        bOK = TRUE;
        LocalUnlock(hBall);
    }
    return(bOK);
}

BOOL ballSetDirection | ( | HANDLE | ,
 |  | int | ,
 |  | int |
 | ) |  |

Definition at line 556 of file Bounce.c.

{
    PBALLDATA pbd;
    BOOL      bOK;

    bOK = FALSE;
    if(pbd = (PBALLDATA)LocalLock(hBall))
    {
        pbd->xDirection = xDirection;
        pbd->yDirection = yDirection;

        bOK = TRUE;
        LocalUnlock(hBall);
    }
    return(bOK);
}

BOOL ballSetPosition | ( | HANDLE | ,
 |  | int | ,
 |  | int |
 | ) |  |

Definition at line 599 of file Bounce.c.

{
    PBALLDATA pbd;
    BOOL      bOK;

    bOK = FALSE;
    if(pbd = (PBALLDATA)LocalLock(hBall))
    {
        pbd->bNewPosition = TRUE;
        pbd->xPosition    = x;
        pbd->yPosition    = y;

        bOK = TRUE;
        LocalUnlock(hBall);
    }
    return(bOK);
}

BOOL BounceCommandProc | ( | HWND | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 132 of file Bounce.c.

{
    hWnd   = hWnd;
    wParam = wParam;
    lParam = lParam;

    return(TRUE);
}

BOOL BounceCreateProc ( HWND )

Definition at line 103 of file Bounce.c.

{
    PBOUNCEDATA pbd;

    if(AllocWindowInfo(hWnd,sizeof(BOUNCEDATA)))
    {
        if(pbd = (PBOUNCEDATA)LockWindowInfo(hWnd))
        {
            pbd->hBall1 = ballCreate(hWnd,20,20,RGB(255,0,0));
            pbd->hBall2 = ballCreate(hWnd,20,20,RGB(0,0,255));
            pbd->hBall3 = ballCreate(hWnd,20,20,RGB(0,255,0));
            pbd->hBall4 = ballCreate(hWnd,20,20,RGB(255,0,255));

            UnlockWindowInfo(hWnd);

            SetTimer(hWnd,1,50,NULL);
            return(TRUE);
        }
        FreeWindowInfo(hWnd);
    }
    return(FALSE);
}

VOID BounceDestroyProc ( HWND )

Definition at line 165 of file Bounce.c.

{
    PBOUNCEDATA pbd;

    KillTimer(hWnd,1);
    if(pbd = (PBOUNCEDATA)LockWindowInfo(hWnd))
    {
        ballDestroy(pbd->hBall1);
        ballDestroy(pbd->hBall2);
        ballDestroy(pbd->hBall3);
        ballDestroy(pbd->hBall4);

        UnlockWindowInfo(hWnd);
    }
    FreeWindowInfo(hWnd);
    return;
}

VOID BounceObjects ( HWND )

Definition at line 246 of file Bounce.c.

{
    PBOUNCEDATA pbd;

    if(pbd = (PBOUNCEDATA)LockWindowInfo(hWnd))
    {
        /*
        ** Determine if the balls hit any of the edges of the display.  If
        ** they do, then these functions reset their position to something
        ** more desireable and re-do their direction.
        */
        CheckEdgePosition(hWnd,pbd->hBall1);
        CheckEdgePosition(hWnd,pbd->hBall2);
        CheckEdgePosition(hWnd,pbd->hBall3);
        CheckEdgePosition(hWnd,pbd->hBall4);

        ballBounce(pbd->hBall1);
        ballBounce(pbd->hBall2);
        ballBounce(pbd->hBall3);
        ballBounce(pbd->hBall4);

        UnlockWindowInfo(hWnd);
    }
    return;
}

VOID BouncePaintProc ( HWND )

Definition at line 146 of file Bounce.c.

{
    HDC         hDC;
    PAINTSTRUCT ps;

    if(hDC = BeginPaint(hWnd,&ps))
        EndPaint(hWnd,&ps);

    BounceRefresh(hWnd);

    return;
}

LRESULT CALLBACK BounceProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 63 of file Bounce.c.

{
    switch(wMsg)
    {
        case WM_CREATE:
            BounceCreateProc(hWnd);
            break;

        case WM_MOVE:
            BounceRefresh(hWnd);
            break;

        case WM_COMMAND:
            BounceCommandProc(hWnd,wParam,lParam);
            break;

        case WM_TIMER:
            BounceObjects(hWnd);
            break;

        case WM_PAINT:
            BouncePaintProc(hWnd);
            break;

        case WM_DESTROY:
            BounceDestroyProc(hWnd);
            break;

        default:
            return(DefMDIChildProc(hWnd,wMsg,wParam,lParam));
    }
    return(0l);
}

VOID BounceRefresh ( HWND )

Definition at line 189 of file Bounce.c.

{
    PBOUNCEDATA pbd;
    RECT        rect;
    HDC         hDC;
    POINT       pDimensions;
    int         xDirection,yDirection;

    if(pbd = (PBOUNCEDATA)LockWindowInfo(hWnd))
    {
        if(hDC = GetDC(hWnd))
        {
            GetClientRect(hWnd,&rect);
            FillRect(hDC,&rect,GETCLASSBRUSH(hWnd));

            xDirection = ((lRandom() % 5)+5);
            yDirection = ((lRandom() % 5)+5);
            ballSetPosition(pbd->hBall1,0,0);
            ballSetDirection(pbd->hBall1,xDirection,yDirection);

            ballGetDimensions(pbd->hBall2,&pDimensions);
            ballSetPosition(pbd->hBall2,rect.right-pDimensions.x,0);
            xDirection = -(((int)lRandom() % 5)+5);
            yDirection =  ((lRandom() % 5)+5);
            ballSetDirection(pbd->hBall2,xDirection,yDirection);

            ballGetDimensions(pbd->hBall3,&pDimensions);
            ballSetPosition(pbd->hBall3,0,rect.bottom-pDimensions.y);
            xDirection =  ((lRandom() % 5)+5);
            yDirection = -((int)(lRandom() % 5)+5);
            ballSetDirection(pbd->hBall3,xDirection,yDirection);

            ballGetDimensions(pbd->hBall4,&pDimensions);
            ballSetPosition(pbd->hBall4,rect.right-pDimensions.x,rect.bottom-pDimensions.y);
            xDirection = -((int)(lRandom() % 5)+5);
            yDirection = -((int)(lRandom() % 5)+5);
            ballSetDirection(pbd->hBall4,xDirection,yDirection);

            ballBounce(pbd->hBall1);
            ballBounce(pbd->hBall2);
            ballBounce(pbd->hBall3);
            ballBounce(pbd->hBall4);

            ReleaseDC(hWnd,hDC);
        }
        UnlockWindowInfo(hWnd);
    }
    return;
}

VOID CheckEdgePosition | ( | HWND | ,
 |  | HANDLE |
 | ) |  |

Definition at line 275 of file Bounce.c.

{
    POINT pPos,pDir,pDim;
    int   xNewPos,yNewPos,xNewDir,yNewDir;
    RECT  rect;

    ballGetPosition(hBall,&pPos);
    ballGetDirection(hBall,&pDir);
    ballGetDimensions(hBall,&pDim);

    GetClientRect(hWnd,&rect);

    /*
    ** Check each edge of the client rectagle.  If the ball goes past the
    ** boundries, reset the position and give it a new direction.
    */
    xNewDir = pDir.x;
    yNewDir = pDir.y;
    xNewPos = pPos.x+pDir.x;
    yNewPos = pPos.y+pDir.y;

    if(xNewPos < rect.left)
    {
        xNewDir = ((lRandom() % 5)+5);
        ballSetPosition(hBall,rect.left,pPos.y);
    }
    if((xNewPos+pDim.x) > rect.right)
    {
        xNewDir = -(((int)lRandom() % 5)+5);
        ballSetPosition(hBall,rect.right-pDim.x,pPos.y);
    }
    if(yNewPos < rect.top)
    {
        yNewDir = ((lRandom() % 5)+5);
        ballSetPosition(hBall,pPos.x,rect.top);
    }
    if((yNewPos+pDim.y) > rect.bottom)
    {
        yNewDir = -(((int)lRandom() % 5)+5);
        ballSetPosition(hBall,pPos.x,rect.bottom-pDim.y);
    }
    ballSetDirection(hBall,xNewDir,yNewDir);

    return;
}

HWND FAR CreateBounceWindow | ( | HWND | ,
 |  | int |
 | ) |  |

Definition at line 31 of file Bounce.c.

{
    HANDLE          hInstance;
    MDICREATESTRUCT mcs;
    static char buffer[256];

    hInstance = GETINSTANCE(hWndClient);
    LoadString (hInstance, BOUNCETITLE, buffer, 256);

    /*
    ** Initialize the MDI create struct for creation of the
    ** test window.
    */
    mcs.szClass = BOUNCECLASS;
    mcs.szTitle = buffer;
    mcs.hOwner  = hInstance;
    mcs.x       = CW_USEDEFAULT;
    mcs.y       = CW_USEDEFAULT;
    mcs.cx      = CW_USEDEFAULT;
    mcs.cy      = CW_USEDEFAULT;
    mcs.style   = 0l;
    mcs.lParam  = (LONG)nItem;

    return((HWND)SendMessage(hWndClient,WM_MDICREATE,0,(LPARAM)(LPMDICREATESTRUCT)&mcs));
}

Generated on Wed Nov 13 2024 16:53:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/GdiDemo/Dialog.c File Reference

  • Multimedia
  • Gdi
  • GdiDemo
Functions

Dialog.c File Reference

#include <windows.h>
#include "gdidemo.h"

Go to the source code of this file.

Functions

BOOL APIENTRY | AboutDlgProc (HWND hDlg, UINT wMsg, WPARAM wParam, LONG lParam)
HPALETTE | CreateColorScalePalette (HDC hDC, int nColor)
INT_PTR FAR | DisplayDialogBox (HWND hWnd, LPSTR lpszTemplate, WNDPROC lpfFunction, LONG lExtra)
VOID | PaintWindow (HWND hWnd, int nColor)

Function Documentation

BOOL APIENTRY AboutDlgProc | ( | HWND | hDlg,
 |  | UINT | wMsg,
 |  | WPARAM | wParam,
 |  | LONG | lParam
 | ) |  |

Definition at line 50 of file Dialog.c.

{
    lParam = lParam;

    switch(wMsg)
    {
        /*
        ** Set the focus to the OK button.
        */
        case WM_INITDIALOG:
            SetFocus(GetDlgItem(hDlg,IDOK));
            break;

        /*
        ** Look for an ESC or RETURN event.
        */
        case WM_COMMAND:
            switch(wParam)
            {
                case IDOK:
                case IDCANCEL:
                    EndDialog(hDlg,TRUE);
                    break;

                default:
                    return(FALSE);
            }
            break;

        /*
        ** Wash the background of the aboutbox to give it a nice blue-scaling
        ** effect.  Invalidate the OK button to force it to the top.  This
        ** seems to be necessary since the OK button gets overwritten during
        ** the washing.
        */
        case WM_PAINT:
            PaintWindow(hDlg,COLOR_SCALE_BLUE);
            InvalidateRect(GetDlgItem(hDlg,IDOK),NULL,TRUE);

        /*
        ** Default handler.
        */
        default:
            return(FALSE);
    }
    return(TRUE);
}

HPALETTE CreateColorScalePalette | ( | HDC | hDC,
 |  | int | nColor
 | ) |  |

Definition at line 202 of file Dialog.c.

{
    HPALETTE     hPalette;
    GLOBALHANDLE hMem;
    LPLOGPALETTE lpMem;
    int          idx,nReserved,nSize;

    hPalette = NULL;
    if(GetDeviceCaps(hDC,RASTERCAPS) & RC_PALETTE)
    {
        nReserved = GetDeviceCaps(hDC,NUMRESERVED);
        nSize     = GetDeviceCaps(hDC,SIZEPALETTE) - nReserved;

        if(hMem = GlobalAlloc(GHND,(DWORD)sizeof(LOGPALETTE)+(sizeof(PALETTEENTRY)*nSize)))
        {
            if(lpMem = (LPLOGPALETTE)GlobalLock(hMem))
            {
                lpMem->palNumEntries = (WORD)nSize;
                lpMem->palVersion    = (WORD)0x0300;

                switch(nColor)
                {
                    case COLOR_SCALE_RED:
                        for(idx=0; idx < nSize; idx++)
                        {
                            lpMem->palPalEntry[idx].peRed   = (BYTE)idx;
                            lpMem->palPalEntry[idx].peGreen = 0;
                            lpMem->palPalEntry[idx].peBlue  = 0;
                            lpMem->palPalEntry[idx].peFlags = PC_RESERVED;
                        }
                        break;

                    case COLOR_SCALE_GREEN:
                        for(idx=0; idx < nSize; idx++)
                        {
                            lpMem->palPalEntry[idx].peRed   = 0;
                            lpMem->palPalEntry[idx].peGreen = (BYTE)idx;
                            lpMem->palPalEntry[idx].peBlue  = 0;
                            lpMem->palPalEntry[idx].peFlags = PC_RESERVED;
                        }
                        break;

                    case COLOR_SCALE_BLUE:
                        for(idx=0; idx < nSize; idx++)
                        {
                            lpMem->palPalEntry[idx].peRed   = 0;
                            lpMem->palPalEntry[idx].peGreen = 0;
                            lpMem->palPalEntry[idx].peBlue  = (BYTE)idx;
                            lpMem->palPalEntry[idx].peFlags = PC_RESERVED;
                        }
                        break;

                    default:
                    case COLOR_SCALE_GRAY:
                        for(idx=0; idx < nSize; idx++)
                        {
                            lpMem->palPalEntry[idx].peRed   = (BYTE)idx;
                            lpMem->palPalEntry[idx].peGreen = (BYTE)idx;
                            lpMem->palPalEntry[idx].peBlue  = (BYTE)idx;
                            lpMem->palPalEntry[idx].peFlags = PC_RESERVED;
                        }
                        break;
                }

                hPalette = CreatePalette(lpMem);

                GlobalUnlock(hMem);
            }
            GlobalFree(hMem);
        }
    }
    return(hPalette);
}

INT_PTR FAR DisplayDialogBox | ( | HWND | hWnd,
 |  | LPSTR | lpszTemplate,
 |  | WNDPROC | lpfFunction,
 |  | LONG | lExtra
 | ) |  |

Definition at line 25 of file Dialog.c.

{
    HANDLE  hInstance;
    WNDPROC lpfDlg;
    INT_PTR nRet;

    nRet = -1;
    if(hInstance = GETINSTANCE(hWnd))
    {
        if(lpfDlg = MakeProcInstance(lpfFunction,hInstance))
        {
            nRet = DialogBoxParam(hInstance,lpszTemplate,hWnd,(DLGPROC)lpfDlg,lExtra);
            FreeProcInstance(lpfDlg);
        }
    }
    return(nRet);
}

VOID PaintWindow | ( | HWND | hWnd,
 |  | int | nColor
 | ) |  |

Definition at line 107 of file Dialog.c.

{
    HDC         hDC;
    int         nMapMode,idx,nSize,nReserved,nLoop;
    RECT        rect;
    HBRUSH      hBrush;
    PAINTSTRUCT ps;
    HPALETTE    hPal;

    if(hDC = BeginPaint(hWnd,&ps))
    {
        GetClientRect(hWnd,&rect);
        nMapMode = SetMapMode(hDC,MM_ANISOTROPIC);

        if(GetDeviceCaps(hDC,RASTERCAPS) & RC_PALETTE)
        {
            nReserved = GetDeviceCaps(hDC,NUMRESERVED);
            nSize     = GetDeviceCaps(hDC,SIZEPALETTE) - nReserved;

            if(hPal = CreateColorScalePalette(hDC,nColor))
            {
                hPal = SelectPalette(hDC,hPal,FALSE);
                RealizePalette(hDC);

#ifdef WIN16
                SetWindowExtEx(hDC,nSize,nSize);
                SetViewportExtEx(hDC,rect.right,-rect.bottom);
                SetViewportOrgEx(hDC,0,rect.bottom);
#else

                SetWindowExtEx(hDC,nSize,nSize,NULL);
                SetViewportExtEx(hDC,rect.right,-rect.bottom,NULL);
                SetViewportOrgEx(hDC,0,rect.bottom,NULL);

#endif

                nLoop = nSize >> 1;
                for(idx=0; idx < nLoop; idx++)
                {
                    hBrush = CreateSolidBrush(PALETTEINDEX(idx+nLoop));
                    SetRect(&rect,idx,idx,nSize-idx,nSize-idx);
                    FillRect(hDC,&rect,hBrush);
                    DeleteObject(hBrush);
                }
                DeleteObject(SelectPalette(hDC,hPal,FALSE));
                RealizePalette(hDC);
            }
        }
        else
        {

#ifdef WIN16

            SetWindowExtEx(hDC,512,512);
            SetViewportExtEx(hDC,rect.right,-rect.bottom);
            SetViewportOrgEx(hDC,0,rect.bottom);

#else

            SetWindowExtEx(hDC,512,512,NULL);
            SetViewportExtEx(hDC,rect.right,-rect.bottom,NULL);
            SetViewportOrgEx(hDC,0,rect.bottom,NULL);

#endif

            for(idx=0; idx < 256; idx++)
            {
                hBrush = CreateSolidBrush(RGB(0,0,idx));
                SetRect(&rect,idx,idx,512-idx,512-idx);
                FillRect(hDC,&rect,hBrush);
                DeleteObject(hBrush);
            }
        }

        SetMapMode(hDC,nMapMode);

        EndPaint(hWnd,&ps);
    }
    return;
}

Generated on Wed Nov 13 2024 16:53:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/GdiDemo/Draw.c File Reference

  • Multimedia
  • Gdi
  • GdiDemo
Functions

Draw.c File Reference

#include <windows.h>
#include <stdio.h>
#include "gdidemo.h"
#include "draw.h"

Go to the source code of this file.

Functions

HWND FAR | CreateDrawWindow (HWND hWndClient, int nItem)
BOOL | DrawCommandProc (HWND hWnd, WPARAM wParam, LPARAM lParam)
BOOL | DrawCreateProc (HWND hWnd)
VOID | DrawDestroyProc (HWND hWnd)
VOID | DrawObject (HWND hWnd)
VOID | DrawPaintProc (HWND hWnd)
LRESULT CALLBACK | DrawProc (HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam)

Function Documentation

HWND FAR CreateDrawWindow | ( | HWND | hWndClient,
 |  | int | nItem
 | ) |  |

Definition at line 23 of file Draw.c.

{
    HANDLE          hInstance;
    MDICREATESTRUCT mcs;
    static char buffer[256];

    hInstance = GETINSTANCE(hWndClient);
    LoadString (hInstance, DRAWTITLE, buffer, 256);

    /*
    ** Initialize the MDI create struct for creation of the
    ** test window.
    */
    mcs.szClass = DRAWCLASS;
    mcs.szTitle = buffer;
    mcs.hOwner  = hInstance;
    mcs.x       = CW_USEDEFAULT;
    mcs.y       = CW_USEDEFAULT;
    mcs.cx      = CW_USEDEFAULT;
    mcs.cy      = CW_USEDEFAULT;
    mcs.style   = 0l;
    mcs.lParam  = (LONG)nItem;

    return((HWND)SendMessage(hWndClient,WM_MDICREATE,0,(LPARAM)(LPMDICREATESTRUCT)&mcs));
}

BOOL DrawCommandProc | ( | HWND | hWnd,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 118 of file Draw.c.

{
    hWnd   = hWnd;
    wParam = wParam;
    lParam = lParam;

    return(TRUE);
}

BOOL DrawCreateProc ( HWND hWnd )

Definition at line 93 of file Draw.c.

{
    PDRAWDATA pdd;

    if(AllocWindowInfo(hWnd,sizeof(DRAWDATA)))
    {
        if(pdd = (PDRAWDATA)LockWindowInfo(hWnd))
        {
            pdd->nObject = 0;

            UnlockWindowInfo(hWnd);

            SetTimer(hWnd,1,50,NULL);
            return(TRUE);
        }
        FreeWindowInfo(hWnd);
    }
    return(FALSE);
}

VOID DrawDestroyProc ( HWND hWnd )

Definition at line 147 of file Draw.c.

{
    KillTimer(hWnd,1);
    FreeWindowInfo(hWnd);
    return;
}

VOID DrawObject ( HWND hWnd )

Definition at line 155 of file Draw.c.

{
    PDRAWDATA pdd;
    RECT      rect;
    HDC       hDC;
    int       x1,y1,x2,y2,x3,y3,x4,y4,r,g,b,nObject;
    HBRUSH    hBrush;
    char      szDebug[80];

    if(pdd = (PDRAWDATA)LockWindowInfo(hWnd))
    {
        if(hDC = GetDC(hWnd))
        {
            GetClientRect(hWnd,&rect);

            // avoid divide by zero errors when the window is small.
            if ( rect.right== 0) rect.right++;
            if ( rect.bottom== 0) rect.bottom++;

            r = lRandom() % 255;
            g = lRandom() % 255;
            b = lRandom() % 255;

            if(hBrush = SelectObject(hDC,CreateSolidBrush(RGB(r,g,b))))
            {
                x1 = lRandom() % rect.right;
                y1 = lRandom() % rect.bottom;
                x2 = lRandom() % rect.right;
                y2 = lRandom() % rect.bottom;
                x3 = lRandom() % rect.right;
                y3 = lRandom() % rect.bottom;
                x4 = lRandom() % rect.right;
                y4 = lRandom() % rect.bottom;

                nObject = lRandom() % 5;

                switch(nObject)
                {
                    default:
                    case OBJ_RECTANGLE:
                        _snprintf(szDebug,sizeof(szDebug)-1,"Rectangle(%d,%d,%d,%d)\n",x1,y1,x2,y2);
                        szDebug[sizeof(szDebug)-1] = '\0';

                        DEBUGOUT(szDebug);
                        Rectangle(hDC,x1,y1,x2,y2);
                        break;

                    case OBJ_ELLIPSE:
                        _snprintf(szDebug,sizeof(szDebug)-1,"Ellipse(%d,%d,%d,%d)\n",x1,y1,x2,y2);
                        szDebug[sizeof(szDebug)-1] = '\0';

                        DEBUGOUT(szDebug);
                        Ellipse(hDC,x1,y1,x2,y2);
                        break;

                    case OBJ_ROUNDRECT:
                        _snprintf(szDebug,sizeof(szDebug)-1,"RoundRect(%d,%d,%d,%d,%d,%d)\n",x1,y1,x2,y2,x3,y3);
                        szDebug[sizeof(szDebug)-1] = '\0';

                        DEBUGOUT(szDebug);
                        RoundRect(hDC,x1,y1,x2,y2,x3,y3);
                        break;

                    case OBJ_CHORD:
                        _snprintf(szDebug,sizeof(szDebug)-1,"Chord(%d,%d,%d,%d,%d,%d,%d,%d)\n",x1,y1,x2,y2,x3,y3,x4,y4);
                        szDebug[sizeof(szDebug)-1] = '\0';

                        DEBUGOUT(szDebug);
                        Chord(hDC,x1,y1,x2,y2,x3,y3,x4,y4);
                        break;

                    case OBJ_PIE:
                        _snprintf(szDebug,sizeof(szDebug)-1,"Pie(%d,%d,%d,%d,%d,%d,%d,%d)\n",x1,y1,x2,y2,x3,y3,x4,y4);
                        szDebug[sizeof(szDebug)-1] = '\0';

                        DEBUGOUT(szDebug);
                        Pie(hDC,x1,y1,x2,y2,x3,y3,x4,y4);
                        break;

                }

                DeleteObject(SelectObject(hDC,hBrush));
            }
            ReleaseDC(hWnd,hDC);
        }
        UnlockWindowInfo(hWnd);
    }
    return;
}

VOID DrawPaintProc ( HWND hWnd )

Definition at line 131 of file Draw.c.

{
    HDC         hDC;
    PAINTSTRUCT ps;

    if(hDC = BeginPaint(hWnd,&ps))
        EndPaint(hWnd,&ps);

    return;
}

LRESULT CALLBACK DrawProc | ( | HWND | hWnd,
 |  | UINT | wMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 54 of file Draw.c.

{
    switch(wMsg)
    {
        case WM_CREATE:
            DrawCreateProc(hWnd);
            break;

        case WM_COMMAND:
            DrawCommandProc(hWnd,wParam,lParam);
            break;

        case WM_TIMER:
            DrawObject(hWnd);
            break;

        case WM_PAINT:
            DrawPaintProc(hWnd);
            break;

        case WM_DESTROY:
            DrawDestroyProc(hWnd);
            break;

        default:
            return(DefMDIChildProc(hWnd,wMsg,wParam,lParam));
    }
    return(0l);
}

Generated on Wed Nov 13 2024 16:53:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/GdiDemo/Draw.h File Reference

  • Multimedia
  • Gdi
  • GdiDemo
Classes | Defines | Typedefs | Functions

Draw.h File Reference

Go to the source code of this file.

Classes

struct | _DRAWDATA

Defines

#define | DRAWCLASS "DRAWDEMO"
#define | OBJ_CHORD 3
#define | OBJ_ELLIPSE 1
#define | OBJ_PIE 4
#define | OBJ_RECTANGLE 0
#define | OBJ_ROUNDRECT 2

Typedefs

typedef struct _DRAWDATA | DRAWDATA
typedef DRAWDATA FAR * | LPDRAWDATA
typedef DRAWDATA NEAR * | NPDRAWDATA
typedef DRAWDATA * | PDRAWDATA

Functions

HWND FAR | CreateDrawWindow (HWND, int)
BOOL | DrawCommandProc (HWND, WPARAM, LPARAM)
BOOL | DrawCreateProc (HWND)
VOID | DrawDestroyProc (HWND)
VOID | DrawObject (HWND)
VOID | DrawPaintProc (HWND)
LRESULT CALLBACK | DrawProc (HWND, UINT, WPARAM, LPARAM)

Define Documentation

#define DRAWCLASS "DRAWDEMO"

Definition at line 20 of file Draw.h.

#define OBJ_CHORD 3

Definition at line 26 of file Draw.h.

#define OBJ_ELLIPSE 1

Definition at line 24 of file Draw.h.

#define OBJ_PIE 4

Definition at line 27 of file Draw.h.

#define OBJ_RECTANGLE 0

Definition at line 23 of file Draw.h.

#define OBJ_ROUNDRECT 2

Definition at line 25 of file Draw.h.

Typedef Documentation

typedef struct _DRAWDATA DRAWDATA
typedef DRAWDATA FAR* LPDRAWDATA

Definition at line 36 of file Draw.h.

typedef DRAWDATA NEAR* NPDRAWDATA

Definition at line 35 of file Draw.h.

typedef DRAWDATA* PDRAWDATA

Definition at line 34 of file Draw.h.

Function Documentation

HWND FAR CreateDrawWindow | ( | HWND | ,
 |  | int |
 | ) |  |

Definition at line 23 of file Draw.c.

{
    HANDLE          hInstance;
    MDICREATESTRUCT mcs;
    static char buffer[256];

    hInstance = GETINSTANCE(hWndClient);
    LoadString (hInstance, DRAWTITLE, buffer, 256);

    /*
    ** Initialize the MDI create struct for creation of the
    ** test window.
    */
    mcs.szClass = DRAWCLASS;
    mcs.szTitle = buffer;
    mcs.hOwner  = hInstance;
    mcs.x       = CW_USEDEFAULT;
    mcs.y       = CW_USEDEFAULT;
    mcs.cx      = CW_USEDEFAULT;
    mcs.cy      = CW_USEDEFAULT;
    mcs.style   = 0l;
    mcs.lParam  = (LONG)nItem;

    return((HWND)SendMessage(hWndClient,WM_MDICREATE,0,(LPARAM)(LPMDICREATESTRUCT)&mcs));
}

BOOL DrawCommandProc | ( | HWND | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 118 of file Draw.c.

{
    hWnd   = hWnd;
    wParam = wParam;
    lParam = lParam;

    return(TRUE);
}

BOOL DrawCreateProc ( HWND )

Definition at line 93 of file Draw.c.

{
    PDRAWDATA pdd;

    if(AllocWindowInfo(hWnd,sizeof(DRAWDATA)))
    {
        if(pdd = (PDRAWDATA)LockWindowInfo(hWnd))
        {
            pdd->nObject = 0;

            UnlockWindowInfo(hWnd);

            SetTimer(hWnd,1,50,NULL);
            return(TRUE);
        }
        FreeWindowInfo(hWnd);
    }
    return(FALSE);
}

VOID DrawDestroyProc ( HWND )

Definition at line 147 of file Draw.c.

{
    KillTimer(hWnd,1);
    FreeWindowInfo(hWnd);
    return;
}

VOID DrawObject ( HWND )

Definition at line 155 of file Draw.c.

{
    PDRAWDATA pdd;
    RECT      rect;
    HDC       hDC;
    int       x1,y1,x2,y2,x3,y3,x4,y4,r,g,b,nObject;
    HBRUSH    hBrush;
    char      szDebug[80];

    if(pdd = (PDRAWDATA)LockWindowInfo(hWnd))
    {
        if(hDC = GetDC(hWnd))
        {
            GetClientRect(hWnd,&rect);

            // avoid divide by zero errors when the window is small.
            if ( rect.right== 0) rect.right++;
            if ( rect.bottom== 0) rect.bottom++;

            r = lRandom() % 255;
            g = lRandom() % 255;
            b = lRandom() % 255;

            if(hBrush = SelectObject(hDC,CreateSolidBrush(RGB(r,g,b))))
            {
                x1 = lRandom() % rect.right;
                y1 = lRandom() % rect.bottom;
                x2 = lRandom() % rect.right;
                y2 = lRandom() % rect.bottom;
                x3 = lRandom() % rect.right;
                y3 = lRandom() % rect.bottom;
                x4 = lRandom() % rect.right;
                y4 = lRandom() % rect.bottom;

                nObject = lRandom() % 5;

                switch(nObject)
                {
                    default:
                    case OBJ_RECTANGLE:
                        _snprintf(szDebug,sizeof(szDebug)-1,"Rectangle(%d,%d,%d,%d)\n",x1,y1,x2,y2);
                        szDebug[sizeof(szDebug)-1] = '\0';

                        DEBUGOUT(szDebug);
                        Rectangle(hDC,x1,y1,x2,y2);
                        break;

                    case OBJ_ELLIPSE:
                        _snprintf(szDebug,sizeof(szDebug)-1,"Ellipse(%d,%d,%d,%d)\n",x1,y1,x2,y2);
                        szDebug[sizeof(szDebug)-1] = '\0';

                        DEBUGOUT(szDebug);
                        Ellipse(hDC,x1,y1,x2,y2);
                        break;

                    case OBJ_ROUNDRECT:
                        _snprintf(szDebug,sizeof(szDebug)-1,"RoundRect(%d,%d,%d,%d,%d,%d)\n",x1,y1,x2,y2,x3,y3);
                        szDebug[sizeof(szDebug)-1] = '\0';

                        DEBUGOUT(szDebug);
                        RoundRect(hDC,x1,y1,x2,y2,x3,y3);
                        break;

                    case OBJ_CHORD:
                        _snprintf(szDebug,sizeof(szDebug)-1,"Chord(%d,%d,%d,%d,%d,%d,%d,%d)\n",x1,y1,x2,y2,x3,y3,x4,y4);
                        szDebug[sizeof(szDebug)-1] = '\0';

                        DEBUGOUT(szDebug);
                        Chord(hDC,x1,y1,x2,y2,x3,y3,x4,y4);
                        break;

                    case OBJ_PIE:
                        _snprintf(szDebug,sizeof(szDebug)-1,"Pie(%d,%d,%d,%d,%d,%d,%d,%d)\n",x1,y1,x2,y2,x3,y3,x4,y4);
                        szDebug[sizeof(szDebug)-1] = '\0';

                        DEBUGOUT(szDebug);
                        Pie(hDC,x1,y1,x2,y2,x3,y3,x4,y4);
                        break;

                }

                DeleteObject(SelectObject(hDC,hBrush));
            }
            ReleaseDC(hWnd,hDC);
        }
        UnlockWindowInfo(hWnd);
    }
    return;
}

VOID DrawPaintProc ( HWND )

Definition at line 131 of file Draw.c.

{
    HDC         hDC;
    PAINTSTRUCT ps;

    if(hDC = BeginPaint(hWnd,&ps))
        EndPaint(hWnd,&ps);

    return;
}

LRESULT CALLBACK DrawProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 54 of file Draw.c.

{
    switch(wMsg)
    {
        case WM_CREATE:
            DrawCreateProc(hWnd);
            break;

        case WM_COMMAND:
            DrawCommandProc(hWnd,wParam,lParam);
            break;

        case WM_TIMER:
            DrawObject(hWnd);
            break;

        case WM_PAINT:
            DrawPaintProc(hWnd);
            break;

        case WM_DESTROY:
            DrawDestroyProc(hWnd);
            break;

        default:
            return(DefMDIChildProc(hWnd,wMsg,wParam,lParam));
    }
    return(0l);
}

Generated on Wed Nov 13 2024 16:53:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/GdiDemo/GdiDemo.c File Reference

  • Multimedia
  • Gdi
  • GdiDemo
Functions | Variables

GdiDemo.c File Reference

#include <windows.h>
#include "gdidemo.h"
#include "poly.h"
#include "xform.h"
#include "maze.h"
#include "draw.h"
#include "bounce.h"

Go to the source code of this file.

Functions

BOOL | CommandProc (HWND hWndFrame, WPARAM wParam, LPARAM lParam)
BOOL | CreateProc (HWND hWndFrame)
VOID | DestroyProc (HWND hWndFrame)
DWORD FAR | lRandom (VOID)
VOID | PaintProc (HWND hWndFrame)
int PASCAL | WinMain (HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpszLine, int nShow)
LRESULT CALLBACK | WndProc (HWND hWndFrame, UINT wMsg, WPARAM wParam, LPARAM lParam)

Variables

HWND | hWndMDIClient = NULL

Function Documentation

BOOL CommandProc | ( | HWND | hWndFrame,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 167 of file GdiDemo.c.

{
    HWND hWndClient;

    lParam = lParam;

    switch(wParam)
    {
        /*
        ** Demo the poly-bezier window.
        */
        case IDM_DEMO_POLYBEZIER:
            if(hWndClient = (HWND)GetWindowLongPtr(hWndFrame,CLIENTWND))
                CreatePolyWindow(hWndClient,0);
            break;

        /*
        ** Demo the xform's.
        */
        case IDM_DEMO_XFORM:
            if(hWndClient = (HWND)GetWindowLongPtr(hWndFrame,CLIENTWND))
                CreateXFormWindow(hWndClient,0);
            break;

        /*
        ** Demo the maze.
        */
        case IDM_DEMO_MAZE:
            if(hWndClient = (HWND)GetWindowLongPtr(hWndFrame,CLIENTWND))
                CreateMazeWindow(hWndClient,0);
            break;

        /*
        ** Demo random drawing objects.
        */
        case IDM_DEMO_DRAW:
            if(hWndClient = (HWND)GetWindowLongPtr(hWndFrame,CLIENTWND))
                CreateDrawWindow(hWndClient,0);
            break;

        /*
        ** Demo bouncing region balls.
        */
        case IDM_DEMO_BOUNCE:
            if(hWndClient = (HWND)GetWindowLongPtr(hWndFrame,CLIENTWND))
                CreateBounceWindow(hWndClient,0);
            break;

        /*
        ** MDI cascade the demo windows.
        */
        case IDM_WINDOW_CASCADE:
            if(hWndClient = (HWND)GetWindowLongPtr(hWndFrame,CLIENTWND))
                SendMessage(hWndClient,WM_MDICASCADE,0,0l);
            break;

        /*
        ** MDI tile the demo windows.
        */
        case IDM_WINDOW_TILE:
            if(hWndClient = (HWND)GetWindowLongPtr(hWndFrame,CLIENTWND))
                SendMessage(hWndClient,WM_MDITILE,0,0l);
            break;

        /*
        ** MDI arrange the MDI icons.
        */
        case IDM_WINDOW_ICON:
            if(hWndClient = (HWND)GetWindowLongPtr(hWndFrame,CLIENTWND))
                SendMessage(hWndClient,WM_MDIICONARRANGE,0,0l);
            break;

        /*
        ** Display the about box.
        */
        case IDM_HELP_ABOUT:
      DisplayDialogBox(hWndFrame,MAKEINTRESOURCE(ABOUTBOX),(WNDPROC)AboutDlgProc,0l);
            break;

        /*
        ** Command not recognized.
        */
        default:
            return(FALSE);
    }
    return(TRUE);
}

BOOL CreateProc ( HWND hWndFrame )

Definition at line 149 of file GdiDemo.c.

{
    /*
    ** Set the window information to contain the child window.
    */
    if(hWndMDIClient = CreateMDIClientWindow(hWndFrame))
        SetWindowLongPtr(hWndFrame,CLIENTWND,(LONG_PTR)hWndMDIClient);

    return(TRUE);
}

VOID DestroyProc ( HWND hWndFrame )

Definition at line 287 of file GdiDemo.c.

{
    hWndFrame = hWndFrame;

    PostQuitMessage(0);

    return;
}

DWORD FAR lRandom ( VOID )

Definition at line 298 of file GdiDemo.c.

{
    static DWORD glSeed = (DWORD)-365387184;

    glSeed *= 69069;
    return(++glSeed);
}

VOID PaintProc ( HWND hWndFrame )

Definition at line 269 of file GdiDemo.c.

{
    HDC         hDC;
    PAINTSTRUCT ps;

    if(hDC = BeginPaint(hWndFrame,&ps))
        EndPaint(hWndFrame,&ps);

    return;
}

int PASCAL WinMain | ( | HINSTANCE | hInst,
 |  | HINSTANCE | hPrevInst,
 |  | LPSTR | lpszLine,
 |  | int | nShow
 | ) |  |

Definition at line 34 of file GdiDemo.c.

{
    HWND hWndFrame;
    MSG  msg;

    lpszLine = lpszLine;

    /*
    ** If there's a previous instance of this application, then we do not need
    ** to register it again.
    */
    if(!hPrevInst)
        if(!RegisterAppClass(hInst))
            return(1);

    /*
    ** Enter the application message-polling loop.  This is the anchor for
    ** the application.
    */
    msg.wParam = 1;
    if(hWndFrame = CreateAppWindow(hInst))
    {
  ShowWindow(hWndFrame,nShow);
        UpdateWindow(hWndFrame);

        while(GetMessage(&msg,NULL,0,0))
        {
            if(!TranslateMDISysAccel(hWndMDIClient,&msg)) {
                TranslateMessage(&msg);
                DispatchMessage(&msg);
            }
        }
    }
    UnregisterAppClass(hInst);

    return((int) msg.wParam);
}

LRESULT CALLBACK WndProc | ( | HWND | hWndFrame,
 |  | UINT | wMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 80 of file GdiDemo.c.

{
    HWND hWndClient;

    switch(wMsg)
    {
        /*
        ** Set up any pre-display stuff.  This is where we create the MDI
        ** control window.
        */
        case WM_CREATE:
            CreateProc(hWndFrame);
/*
** DEMO MODE - These PostMessages Are for Demonstration Only
*/
            PostMessage(hWndFrame,WM_COMMAND,IDM_DEMO_DRAW,0);
            PostMessage(hWndFrame,WM_COMMAND,IDM_DEMO_POLYBEZIER,0);
            PostMessage(hWndFrame,WM_COMMAND,IDM_DEMO_BOUNCE,0);
            PostMessage(hWndFrame,WM_COMMAND,IDM_WINDOW_TILE,0);

            break;

        /*
        ** Paint the background of the frame.  This really is a NOP since
        ** the MDI control is displayed over the frame's client window.
        */
        case WM_PAINT:
            PaintProc(hWndFrame);
            break;

        /*
        ** Time to die.
        */
        case WM_DESTROY:
            DestroyProc(hWndFrame);
            break;

        /*
        ** Process the frame-commands.  We need to let the default handler
        ** have this event, since the MDI control handles the
        ** commands as well.
        */
        case WM_COMMAND:
            CommandProc(hWndFrame,wParam,lParam);

        /*
        ** Since this is the frame-window, we need to grab the MDI client
        ** control window to pass to the MDI control.  We store this as
        ** part of the extra-object information for the frame-window.
        */
        default:
            hWndClient = (HWND)GetWindowLongPtr(hWndFrame,CLIENTWND);
            return(DefFrameProc(hWndFrame,hWndClient,wMsg,wParam,lParam));
    }
    return(0l);
}

Variable Documentation

HWND hWndMDIClient = NULL

Definition at line 27 of file GdiDemo.c.

Generated on Wed Nov 13 2024 16:53:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/GdiDemo/GdiDemo.h File Reference

  • Multimedia
  • Gdi
  • GdiDemo
Defines | Functions

GdiDemo.h File Reference

Go to the source code of this file.

Defines

#define | ABOUTBOX 1002
#define | APPCLASS "GDIDEMO"
#define | APPICON 1001
#define | APPMENU 1000
#define | APPTITLE "Windows GDI Demonstration"
#define | BOUNCETITLE 1
#define | CLIENTWND 0
#define | COLOR_SCALE_BLUE 3
#define | COLOR_SCALE_GRAY 4
#define | COLOR_SCALE_GREEN 2
#define | COLOR_SCALE_RED 1
#define | DEBUGOUT(lpszString) {}
#define | DRAWTITLE 2
#define | GETCLASSBRUSH(hWnd) (HBRUSH)GetClassWord(hWnd,GCW_HBRBACKGROUND)
#define | GETINSTANCE(hWnd) (HANDLE)GetWindowWord(hWnd,GWW_HINSTANCE)
#define | IDM_DEMO_BOUNCE 104
#define | IDM_DEMO_DRAW 103
#define | IDM_DEMO_MAZE 102
#define | IDM_DEMO_POLYBEZIER 100
#define | IDM_DEMO_XFORM 101
#define | IDM_HELP_ABOUT 900
#define | IDM_WINDOW_CASCADE 200
#define | IDM_WINDOW_ICON 202
#define | IDM_WINDOW_TILE 201
#define | MAZETITLE 3
#define | POLYTITLE 4
#define | XFORMTITLE 5

Functions

BOOL APIENTRY | AboutDlgProc (HWND, UINT, WPARAM, LONG)
BOOL FAR | AllocWindowInfo (HWND, WORD)
BOOL | CommandProc (HWND, WPARAM, LPARAM)
HWND FAR | CreateAppWindow (HANDLE)
HPALETTE | CreateColorScalePalette (HDC, int)
HWND FAR | CreateMDIClientWindow (HWND)
BOOL | CreateProc (HWND)
VOID | DestroyProc (HWND)
INT_PTR FAR | DisplayDialogBox (HWND, LPSTR, WNDPROC, LONG)
BOOL FAR | FreeWindowInfo (HWND)
PVOID FAR | LockWindowInfo (HWND)
DWORD FAR | lRandom (VOID)
VOID | PaintProc (HWND)
VOID | PaintWindow (HWND, int)
BOOL FAR | RegisterAppClass (HANDLE)
BOOL FAR | UnlockWindowInfo (HWND)
VOID FAR | UnregisterAppClass (HANDLE)
LRESULT CALLBACK | WndProc (HWND, UINT, WPARAM, LPARAM)

Define Documentation

#define ABOUTBOX 1002

Definition at line 26 of file GdiDemo.h.

#define APPCLASS "GDIDEMO"

Definition at line 20 of file GdiDemo.h.

#define APPICON 1001

Definition at line 25 of file GdiDemo.h.

#define APPMENU 1000

Definition at line 24 of file GdiDemo.h.

#define APPTITLE "Windows GDI Demonstration"

Definition at line 21 of file GdiDemo.h.

#define BOUNCETITLE 1

Definition at line 48 of file GdiDemo.h.

#define CLIENTWND 0

Definition at line 45 of file GdiDemo.h.

#define COLOR_SCALE_BLUE 3

Definition at line 42 of file GdiDemo.h.

#define COLOR_SCALE_GRAY 4

Definition at line 43 of file GdiDemo.h.

#define COLOR_SCALE_GREEN 2

Definition at line 41 of file GdiDemo.h.

#define COLOR_SCALE_RED 1

Definition at line 40 of file GdiDemo.h.

#define DEBUGOUT ( lpszString ) {}

Definition at line 102 of file GdiDemo.h.

#define DRAWTITLE 2

Definition at line 49 of file GdiDemo.h.

#define GETCLASSBRUSH ( hWnd ) (HBRUSH)GetClassWord(hWnd,GCW_HBRBACKGROUND)

Definition at line 114 of file GdiDemo.h.

#define GETINSTANCE ( hWnd ) (HANDLE)GetWindowWord(hWnd,GWW_HINSTANCE)

Definition at line 113 of file GdiDemo.h.

#define IDM_DEMO_BOUNCE 104

Definition at line 32 of file GdiDemo.h.

#define IDM_DEMO_DRAW 103

Definition at line 31 of file GdiDemo.h.

#define IDM_DEMO_MAZE 102

Definition at line 30 of file GdiDemo.h.

#define IDM_DEMO_POLYBEZIER 100

Definition at line 28 of file GdiDemo.h.

#define IDM_DEMO_XFORM 101

Definition at line 29 of file GdiDemo.h.

#define IDM_HELP_ABOUT 900

Definition at line 37 of file GdiDemo.h.

#define IDM_WINDOW_CASCADE 200

Definition at line 34 of file GdiDemo.h.

#define IDM_WINDOW_ICON 202

Definition at line 36 of file GdiDemo.h.

#define IDM_WINDOW_TILE 201

Definition at line 35 of file GdiDemo.h.

#define MAZETITLE 3

Definition at line 50 of file GdiDemo.h.

#define POLYTITLE 4

Definition at line 51 of file GdiDemo.h.

#define XFORMTITLE 5

Definition at line 52 of file GdiDemo.h.

Function Documentation

BOOL APIENTRY AboutDlgProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LONG |
 | ) |  |

Definition at line 50 of file Dialog.c.

{
    lParam = lParam;

    switch(wMsg)
    {
        /*
        ** Set the focus to the OK button.
        */
        case WM_INITDIALOG:
            SetFocus(GetDlgItem(hDlg,IDOK));
            break;

        /*
        ** Look for an ESC or RETURN event.
        */
        case WM_COMMAND:
            switch(wParam)
            {
                case IDOK:
                case IDCANCEL:
                    EndDialog(hDlg,TRUE);
                    break;

                default:
                    return(FALSE);
            }
            break;

        /*
        ** Wash the background of the aboutbox to give it a nice blue-scaling
        ** effect.  Invalidate the OK button to force it to the top.  This
        ** seems to be necessary since the OK button gets overwritten during
        ** the washing.
        */
        case WM_PAINT:
            PaintWindow(hDlg,COLOR_SCALE_BLUE);
            InvalidateRect(GetDlgItem(hDlg,IDOK),NULL,TRUE);

        /*
        ** Default handler.
        */
        default:
            return(FALSE);
    }
    return(TRUE);
}

BOOL FAR AllocWindowInfo | ( | HWND | ,
 |  | WORD |
 | ) |  |

Definition at line 28 of file Wininfo.c.

{
    HANDLE hsd;

    if(hsd = LocalAlloc(LHND,(WORD)wSize))
    {
        SetWindowLongPtr(hWnd,0,(LONG_PTR)hsd);
        return(TRUE);
    }
    return(FALSE);
}

BOOL CommandProc | ( | HWND | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 167 of file GdiDemo.c.

{
    HWND hWndClient;

    lParam = lParam;

    switch(wParam)
    {
        /*
        ** Demo the poly-bezier window.
        */
        case IDM_DEMO_POLYBEZIER:
            if(hWndClient = (HWND)GetWindowLongPtr(hWndFrame,CLIENTWND))
                CreatePolyWindow(hWndClient,0);
            break;

        /*
        ** Demo the xform's.
        */
        case IDM_DEMO_XFORM:
            if(hWndClient = (HWND)GetWindowLongPtr(hWndFrame,CLIENTWND))
                CreateXFormWindow(hWndClient,0);
            break;

        /*
        ** Demo the maze.
        */
        case IDM_DEMO_MAZE:
            if(hWndClient = (HWND)GetWindowLongPtr(hWndFrame,CLIENTWND))
                CreateMazeWindow(hWndClient,0);
            break;

        /*
        ** Demo random drawing objects.
        */
        case IDM_DEMO_DRAW:
            if(hWndClient = (HWND)GetWindowLongPtr(hWndFrame,CLIENTWND))
                CreateDrawWindow(hWndClient,0);
            break;

        /*
        ** Demo bouncing region balls.
        */
        case IDM_DEMO_BOUNCE:
            if(hWndClient = (HWND)GetWindowLongPtr(hWndFrame,CLIENTWND))
                CreateBounceWindow(hWndClient,0);
            break;

        /*
        ** MDI cascade the demo windows.
        */
        case IDM_WINDOW_CASCADE:
            if(hWndClient = (HWND)GetWindowLongPtr(hWndFrame,CLIENTWND))
                SendMessage(hWndClient,WM_MDICASCADE,0,0l);
            break;

        /*
        ** MDI tile the demo windows.
        */
        case IDM_WINDOW_TILE:
            if(hWndClient = (HWND)GetWindowLongPtr(hWndFrame,CLIENTWND))
                SendMessage(hWndClient,WM_MDITILE,0,0l);
            break;

        /*
        ** MDI arrange the MDI icons.
        */
        case IDM_WINDOW_ICON:
            if(hWndClient = (HWND)GetWindowLongPtr(hWndFrame,CLIENTWND))
                SendMessage(hWndClient,WM_MDIICONARRANGE,0,0l);
            break;

        /*
        ** Display the about box.
        */
        case IDM_HELP_ABOUT:
      DisplayDialogBox(hWndFrame,MAKEINTRESOURCE(ABOUTBOX),(WNDPROC)AboutDlgProc,0l);
            break;

        /*
        ** Command not recognized.
        */
        default:
            return(FALSE);
    }
    return(TRUE);
}

HWND FAR CreateAppWindow ( HANDLE )

Definition at line 180 of file Init.c.

{
    /*
    ** Upon creation of the window, initialize the extra object information.
    */
    return(CreateWindow(APPCLASS,APPTITLE,WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
            CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,
            NULL,NULL,hInstance,NULL));
}

HPALETTE CreateColorScalePalette | ( | HDC | ,
 |  | int |
 | ) |  |

Definition at line 358 of file AppUtil.Cpp.

{
  HPALETTE     hPalette;
  GLOBALHANDLE hMem;
  LPLOGPALETTE lpMem;
  int          idx,nReserved,nSize;

  hPalette = NULL;
  if(GetDeviceCaps(hDC,RASTERCAPS) & RC_PALETTE)
  {
    nReserved = GetDeviceCaps(hDC,NUMRESERVED);
    nSize     = GetDeviceCaps(hDC,SIZEPALETTE) - nReserved;

    hMem = GlobalAlloc(
             GHND,
             (DWORD)sizeof(LOGPALETTE)+(sizeof(PALETTEENTRY)*nSize));
    if(hMem)
    {
      if(lpMem = (LPLOGPALETTE)GlobalLock(hMem))
      {
        lpMem->palNumEntries = (WORD)nSize;
        lpMem->palVersion    = (WORD)0x0300;
        switch(nColor)
        {
          case COLOR_SCALE_RED:
            for(idx=0; idx < nSize; idx++)
            {
              lpMem->palPalEntry[idx].peRed   = (BYTE)idx;
              lpMem->palPalEntry[idx].peGreen = 0;
              lpMem->palPalEntry[idx].peBlue  = 0;
              lpMem->palPalEntry[idx].peFlags = PC_RESERVED;
            }
            break;

          case COLOR_SCALE_GREEN:
            for(idx=0; idx < nSize; idx++)
            {
              lpMem->palPalEntry[idx].peRed   = 0;
              lpMem->palPalEntry[idx].peGreen = (BYTE)idx;
              lpMem->palPalEntry[idx].peBlue  = 0;
              lpMem->palPalEntry[idx].peFlags = PC_RESERVED;
            }
            break;

          case COLOR_SCALE_BLUE:
            for(idx=0; idx < nSize; idx++)
            {
              lpMem->palPalEntry[idx].peRed   = 0;
              lpMem->palPalEntry[idx].peGreen = 0;
              lpMem->palPalEntry[idx].peBlue  = (BYTE)idx;
              lpMem->palPalEntry[idx].peFlags = PC_RESERVED;
            }
            break;

          default:
          case COLOR_SCALE_GRAY:
            for(idx=0; idx < nSize; idx++)
            {
              lpMem->palPalEntry[idx].peRed   = (BYTE)idx;
              lpMem->palPalEntry[idx].peGreen = (BYTE)idx;
              lpMem->palPalEntry[idx].peBlue  = (BYTE)idx;
              lpMem->palPalEntry[idx].peFlags = PC_RESERVED;
            }
            break;
        }

        hPalette = CreatePalette(lpMem);

        GlobalUnlock(hMem);
      }
      GlobalFree(hMem);
    }
  }

  return(hPalette);
}

HWND FAR CreateMDIClientWindow ( HWND )

Definition at line 197 of file Init.c.

{
    HWND               hWndClient;
    HANDLE             hInstance;
    CLIENTCREATESTRUCT ccs;

    /*
    ** Initialize the client struct to point to define the menu and child
    ** identifiers.  The menu item specifies the parent menu in which the
    ** the list of MDI childs will be appended to this menu.
    */
    ccs.hWindowMenu  = NULL;
    ccs.idFirstChild = 0;

    hInstance = GETINSTANCE(hWndFrame);

    hWndClient = CreateWindow("MDICLIENT",NULL,WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE,
            0,0,1,1,hWndFrame,NULL,hInstance,(LPVOID)&ccs);

    return(hWndClient);
}

BOOL CreateProc ( HWND )

Definition at line 149 of file GdiDemo.c.

{
    /*
    ** Set the window information to contain the child window.
    */
    if(hWndMDIClient = CreateMDIClientWindow(hWndFrame))
        SetWindowLongPtr(hWndFrame,CLIENTWND,(LONG_PTR)hWndMDIClient);

    return(TRUE);
}

VOID DestroyProc ( HWND )

Definition at line 287 of file GdiDemo.c.

{
    hWndFrame = hWndFrame;

    PostQuitMessage(0);

    return;
}

INT_PTR FAR DisplayDialogBox | ( | HWND | ,
 |  | LPSTR | ,
 |  | WNDPROC | ,
 |  | LONG |
 | ) |  |

Definition at line 25 of file Dialog.c.

{
    HANDLE  hInstance;
    WNDPROC lpfDlg;
    INT_PTR nRet;

    nRet = -1;
    if(hInstance = GETINSTANCE(hWnd))
    {
        if(lpfDlg = MakeProcInstance(lpfFunction,hInstance))
        {
            nRet = DialogBoxParam(hInstance,lpszTemplate,hWnd,(DLGPROC)lpfDlg,lExtra);
            FreeProcInstance(lpfDlg);
        }
    }
    return(nRet);
}

BOOL FAR FreeWindowInfo ( HWND )

Definition at line 82 of file Wininfo.c.

{
    LOCALHANDLE hMem;

    if(hMem = (HANDLE)GetWindowLongPtr(hWnd,0))
        LocalFree(hMem);
    return(TRUE);
}

PVOID FAR LockWindowInfo ( HWND )

Definition at line 47 of file Wininfo.c.

{
    HANDLE hMem;
    PVOID  pMem;

    pMem = NULL;
    if(hMem = (HANDLE)GetWindowLongPtr(hWnd,0))
        pMem = (PVOID)LocalLock(hMem);

    return(pMem);
}

DWORD FAR lRandom ( VOID )

Definition at line 298 of file GdiDemo.c.

{
    static DWORD glSeed = (DWORD)-365387184;

    glSeed *= 69069;
    return(++glSeed);
}

VOID PaintProc ( HWND )

Definition at line 269 of file GdiDemo.c.

{
    HDC         hDC;
    PAINTSTRUCT ps;

    if(hDC = BeginPaint(hWndFrame,&ps))
        EndPaint(hWndFrame,&ps);

    return;
}

VOID PaintWindow | ( | HWND | ,
 |  | int |
 | ) |  |

Definition at line 451 of file AppUtil.Cpp.

{
  HDC         hDC;
  int         nMapMode,idx,nSize,nReserved,nLoop;
  RECT        rect;
  HBRUSH      hBrush;
  PAINTSTRUCT ps;
  HPALETTE    hPal;

  if(hDC = BeginPaint(hWnd,&ps))
  {
    GetClientRect(hWnd,&rect);
    nMapMode = SetMapMode(hDC,MM_ANISOTROPIC);

    if(GetDeviceCaps(hDC,RASTERCAPS) & RC_PALETTE)
    {
      nReserved = GetDeviceCaps(hDC,NUMRESERVED);
      nSize     = GetDeviceCaps(hDC,SIZEPALETTE) - nReserved;

      if(hPal = CreateColorScalePalette(hDC,nColor))
      {
        hPal = SelectPalette(hDC,hPal,FALSE);
        RealizePalette(hDC);

        SetWindowExtEx(hDC,nSize,nSize,NULL);
        SetViewportExtEx(hDC,rect.right,-rect.bottom,NULL);
        SetViewportOrgEx(hDC,0,rect.bottom,NULL);

        nLoop = nSize >> 1;
        for(idx=0; idx < nLoop; idx++)
        {
          hBrush = CreateSolidBrush(PALETTEINDEX(idx+nLoop));
          SetRect(&rect,idx,idx,nSize-idx,nSize-idx);
          FillRect(hDC,&rect,hBrush);
          DeleteObject(hBrush);
        }
        DeleteObject(SelectPalette(hDC,hPal,FALSE));
        RealizePalette(hDC);
      }
    }
    else
    {
      SetWindowExtEx(hDC,512,512,NULL);
      SetViewportExtEx(hDC,rect.right,-rect.bottom,NULL);
      SetViewportOrgEx(hDC,0,rect.bottom,NULL);

      for(idx=0; idx < 256; idx++)
      {
        hBrush = CreateSolidBrush(RGB(0,0,idx));
        SetRect(&rect,idx,idx,512-idx,512-idx);
        FillRect(hDC,&rect,hBrush);
        DeleteObject(hBrush);
      }
    }

    SetMapMode(hDC,nMapMode);

    EndPaint(hWnd,&ps);
  }

  return;
}

BOOL FAR RegisterAppClass ( HANDLE )

Definition at line 36 of file Init.c.

{
    WNDCLASS wndClass;

    /*
    ** Set the common wndClass information.  This is common to all windows
    ** of this application.
    */
    wndClass.style         = CS_HREDRAW | CS_VREDRAW;
    wndClass.cbClsExtra    = 0;
    wndClass.cbWndExtra    = sizeof(LONG_PTR);
    wndClass.hCursor       = LoadCursor(NULL,IDC_ARROW);
    wndClass.hInstance     = hInstance;

    /*
    ** Register the main top-level window (frame).
    */
    wndClass.lpfnWndProc   = WndProc;
    wndClass.hIcon         = LoadIcon(hInstance,MAKEINTRESOURCE(APPICON));
    wndClass.hbrBackground = GetStockObject(WHITE_BRUSH);
    wndClass.lpszMenuName  = MAKEINTRESOURCE(APPMENU);
    wndClass.lpszClassName = APPCLASS;

    if(!RegisterClass(&wndClass))
        return(FALSE);

    /*
    ** Register the polybezier demo window.
    */
    wndClass.lpfnWndProc   = PolyProc;
    wndClass.hIcon         = LoadIcon(NULL,IDI_APPLICATION);
    wndClass.hbrBackground = GetStockObject(BLACK_BRUSH);
    wndClass.lpszMenuName  = NULL;
    wndClass.lpszClassName = POLYCLASS;

    if(!RegisterClass(&wndClass))
    {
        UnregisterClass(APPCLASS,hInstance);
        return(FALSE);
    }

    /*
    ** Register the xform demo window.
    */
    wndClass.lpfnWndProc   = XFormProc;
    wndClass.hIcon         = LoadIcon(NULL,IDI_APPLICATION);
    wndClass.hbrBackground = GetStockObject(BLACK_BRUSH);
    wndClass.lpszMenuName  = NULL;
    wndClass.lpszClassName = XFORMCLASS;

    if(!RegisterClass(&wndClass))
    {
        UnregisterClass(APPCLASS ,hInstance);
        UnregisterClass(POLYCLASS,hInstance);
        return(FALSE);
    }

    /*
    ** Register the maze demo window.
    */
    wndClass.lpfnWndProc   = MazeProc;
    wndClass.hIcon         = LoadIcon(NULL,IDI_APPLICATION);
    wndClass.hbrBackground = GetStockObject(BLACK_BRUSH);
    wndClass.lpszMenuName  = NULL;
    wndClass.lpszClassName = MAZECLASS;

    if(!RegisterClass(&wndClass))
    {
        UnregisterClass(APPCLASS  ,hInstance);
        UnregisterClass(POLYCLASS ,hInstance);
        UnregisterClass(XFORMCLASS,hInstance);
        return(FALSE);
    }

    /*
    ** Register the random draw demo window.
    */
    wndClass.lpfnWndProc   = DrawProc;
    wndClass.hIcon         = LoadIcon(NULL,IDI_APPLICATION);
    wndClass.hbrBackground = GetStockObject(WHITE_BRUSH);
    wndClass.lpszMenuName  = NULL;
    wndClass.lpszClassName = DRAWCLASS;

    if(!RegisterClass(&wndClass))
    {
        UnregisterClass(APPCLASS  ,hInstance);
        UnregisterClass(POLYCLASS ,hInstance);
        UnregisterClass(XFORMCLASS,hInstance);
        UnregisterClass(MAZECLASS ,hInstance);
        return(FALSE);
    }

    /*
    ** Register the bouncing ball demo window.
    */
    wndClass.lpfnWndProc   = BounceProc;
    wndClass.hIcon         = LoadIcon(NULL,IDI_APPLICATION);
    wndClass.hbrBackground = GetStockObject(WHITE_BRUSH);
    wndClass.lpszMenuName  = NULL;
    wndClass.lpszClassName = BOUNCECLASS;

    if(!RegisterClass(&wndClass))
    {
        UnregisterClass(APPCLASS  ,hInstance);
        UnregisterClass(POLYCLASS ,hInstance);
        UnregisterClass(XFORMCLASS,hInstance);
        UnregisterClass(MAZECLASS ,hInstance);
        UnregisterClass(DRAWCLASS ,hInstance);
        return(FALSE);
    }

    return(TRUE);
}

BOOL FAR UnlockWindowInfo ( HWND )

Definition at line 65 of file Wininfo.c.

{
    HANDLE hMem;

    if(hMem = (HANDLE)GetWindowLongPtr(hWnd,0))
        if(!LocalUnlock(hMem))
            return(TRUE);

    return(FALSE);
}

VOID FAR UnregisterAppClass ( HANDLE )

Definition at line 163 of file Init.c.

{
    UnregisterClass(APPCLASS   ,hInstance);
    UnregisterClass(POLYCLASS  ,hInstance);
    UnregisterClass(XFORMCLASS ,hInstance);
    UnregisterClass(MAZECLASS  ,hInstance);
    UnregisterClass(DRAWCLASS  ,hInstance);
    UnregisterClass(BOUNCECLASS,hInstance);

    return;
}

LRESULT CALLBACK WndProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 290 of file Generic.C.

{
   int wmId, wmEvent;
   PAINTSTRUCT ps;
   HDC hdc;
      POINT pnt;
   HMENU hMenu;
      BOOL bGotHelp;

   switch (message) {

      case WM_COMMAND:
         wmId    = LOWORD(wParam); // Remember, these are...
         wmEvent = HIWORD(wParam); // ...different for Win32!

         //Parse the menu selections:
         switch (wmId) {

            case IDM_ABOUT:
               DialogBox(hInst, "AboutBox", hWnd, (DLGPROC)About);
               break;

            case IDM_EXIT:
               DestroyWindow (hWnd);
               break;

            case IDM_HELPTOPICS: // Only called in Windows 95
               bGotHelp = WinHelp (hWnd, APPNAME".HLP", HELP_FINDER,(DWORD)0);
               if (!bGotHelp)
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            case IDM_HELPCONTENTS: // Not called in Windows 95
               bGotHelp = WinHelp (hWnd, APPNAME".HLP", HELP_CONTENTS,(DWORD)0);
               if (!bGotHelp)
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            case IDM_HELPSEARCH: // Not called in Windows 95
               if (!WinHelp(hWnd, APPNAME".HLP", HELP_PARTIALKEY,
                           (ULONG_PTR)(LPSTR)""))
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            case IDM_HELPHELP: // Not called in Windows 95
               if(!WinHelp(hWnd, (LPSTR)NULL, HELP_HELPONHELP, 0))
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            // Here are all the other possible menu options,
            // all of these are currently disabled:
            case IDM_NEW:
            case IDM_OPEN:
            case IDM_SAVE:
            case IDM_SAVEAS:
            case IDM_UNDO:
            case IDM_CUT:
            case IDM_COPY:
            case IDM_PASTE:
            case IDM_LINK:
            case IDM_LINKS:

            default:
               return (DefWindowProc(hWnd, message, wParam, lParam));
         }
         break;

      case WM_NCRBUTTONUP: // RightClick on windows non-client area...
         if (IS_WIN95 && SendMessage(hWnd, WM_NCHITTEST, 0, lParam) == HTSYSMENU)
         {
            // The user has clicked the right button on the applications
            // 'System Menu'. Here is where you would alter the default
            // system menu to reflect your application. Notice how the
            // explorer deals with this. For this app, we aren't doing
            // anything
            return (DefWindowProc(hWnd, message, wParam, lParam));
         } else {
            // Nothing we are interested in, allow default handling...
            return (DefWindowProc(hWnd, message, wParam, lParam));
         }
            break;

        case WM_RBUTTONDOWN: // RightClick in windows client area...
            pnt.x = LOWORD(lParam);
            pnt.y = HIWORD(lParam);
            ClientToScreen(hWnd, (LPPOINT) &pnt);
      // This is where you would determine the appropriate 'context'
      // menu to bring up. Since this app has no real functionality,
      // we will just bring up the 'Help' menu:
            hMenu = GetSubMenu (GetMenu (hWnd), 2);
            if (hMenu) {
                TrackPopupMenu (hMenu, 0, pnt.x, pnt.y, 0, hWnd, NULL);
            } else {
            // Couldn't find the menu...
                MessageBeep(0);
            }
            break;

      case WM_DISPLAYCHANGE: // Only comes through on plug'n'play systems
      {
         SIZE  szScreen;
         DWORD dwBitsPerPixel = (DWORD)wParam;

         szScreen.cx = LOWORD(lParam);
         szScreen.cy = HIWORD(lParam);

         MessageBox (GetFocus(), GetStringRes(IDS_DISPLAYCHANGED),
                     szAppName, 0);
      }
      break;

      case WM_PAINT:
         hdc = BeginPaint (hWnd, &ps);
         // Add any drawing code here...
         EndPaint (hWnd, &ps);
         break;

      case WM_DESTROY:
         // Tell WinHelp we don't need it any more...
               WinHelp (hWnd, APPNAME".HLP", HELP_QUIT,(DWORD)0);
         PostQuitMessage(0);
         break;

      default:
         return (DefWindowProc(hWnd, message, wParam, lParam));
   }
   return (0);
}

Generated on Wed Nov 13 2024 16:53:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/GdiDemo/Init.c File Reference

  • Multimedia
  • Gdi
  • GdiDemo
Functions

Init.c File Reference

#include <windows.h>
#include "gdidemo.h"
#include "poly.h"
#include "xform.h"
#include "maze.h"
#include "draw.h"
#include "bounce.h"

Go to the source code of this file.

Functions

HWND FAR | CreateAppWindow (HANDLE hInstance)
HWND FAR | CreateMDIClientWindow (HWND hWndFrame)
BOOL FAR | RegisterAppClass (HANDLE hInstance)
VOID FAR | UnregisterAppClass (HANDLE hInstance)

Function Documentation

HWND FAR CreateAppWindow ( HANDLE hInstance )

Definition at line 180 of file Init.c.

{
    /*
    ** Upon creation of the window, initialize the extra object information.
    */
    return(CreateWindow(APPCLASS,APPTITLE,WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
            CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,
            NULL,NULL,hInstance,NULL));
}

HWND FAR CreateMDIClientWindow ( HWND hWndFrame )

Definition at line 197 of file Init.c.

{
    HWND               hWndClient;
    HANDLE             hInstance;
    CLIENTCREATESTRUCT ccs;

    /*
    ** Initialize the client struct to point to define the menu and child
    ** identifiers.  The menu item specifies the parent menu in which the
    ** the list of MDI childs will be appended to this menu.
    */
    ccs.hWindowMenu  = NULL;
    ccs.idFirstChild = 0;

    hInstance = GETINSTANCE(hWndFrame);

    hWndClient = CreateWindow("MDICLIENT",NULL,WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE,
            0,0,1,1,hWndFrame,NULL,hInstance,(LPVOID)&ccs);

    return(hWndClient);
}

BOOL FAR RegisterAppClass ( HANDLE hInstance )

Definition at line 36 of file Init.c.

{
    WNDCLASS wndClass;

    /*
    ** Set the common wndClass information.  This is common to all windows
    ** of this application.
    */
    wndClass.style         = CS_HREDRAW | CS_VREDRAW;
    wndClass.cbClsExtra    = 0;
    wndClass.cbWndExtra    = sizeof(LONG_PTR);
    wndClass.hCursor       = LoadCursor(NULL,IDC_ARROW);
    wndClass.hInstance     = hInstance;

    /*
    ** Register the main top-level window (frame).
    */
    wndClass.lpfnWndProc   = WndProc;
    wndClass.hIcon         = LoadIcon(hInstance,MAKEINTRESOURCE(APPICON));
    wndClass.hbrBackground = GetStockObject(WHITE_BRUSH);
    wndClass.lpszMenuName  = MAKEINTRESOURCE(APPMENU);
    wndClass.lpszClassName = APPCLASS;

    if(!RegisterClass(&wndClass))
        return(FALSE);

    /*
    ** Register the polybezier demo window.
    */
    wndClass.lpfnWndProc   = PolyProc;
    wndClass.hIcon         = LoadIcon(NULL,IDI_APPLICATION);
    wndClass.hbrBackground = GetStockObject(BLACK_BRUSH);
    wndClass.lpszMenuName  = NULL;
    wndClass.lpszClassName = POLYCLASS;

    if(!RegisterClass(&wndClass))
    {
        UnregisterClass(APPCLASS,hInstance);
        return(FALSE);
    }

    /*
    ** Register the xform demo window.
    */
    wndClass.lpfnWndProc   = XFormProc;
    wndClass.hIcon         = LoadIcon(NULL,IDI_APPLICATION);
    wndClass.hbrBackground = GetStockObject(BLACK_BRUSH);
    wndClass.lpszMenuName  = NULL;
    wndClass.lpszClassName = XFORMCLASS;

    if(!RegisterClass(&wndClass))
    {
        UnregisterClass(APPCLASS ,hInstance);
        UnregisterClass(POLYCLASS,hInstance);
        return(FALSE);
    }

    /*
    ** Register the maze demo window.
    */
    wndClass.lpfnWndProc   = MazeProc;
    wndClass.hIcon         = LoadIcon(NULL,IDI_APPLICATION);
    wndClass.hbrBackground = GetStockObject(BLACK_BRUSH);
    wndClass.lpszMenuName  = NULL;
    wndClass.lpszClassName = MAZECLASS;

    if(!RegisterClass(&wndClass))
    {
        UnregisterClass(APPCLASS  ,hInstance);
        UnregisterClass(POLYCLASS ,hInstance);
        UnregisterClass(XFORMCLASS,hInstance);
        return(FALSE);
    }

    /*
    ** Register the random draw demo window.
    */
    wndClass.lpfnWndProc   = DrawProc;
    wndClass.hIcon         = LoadIcon(NULL,IDI_APPLICATION);
    wndClass.hbrBackground = GetStockObject(WHITE_BRUSH);
    wndClass.lpszMenuName  = NULL;
    wndClass.lpszClassName = DRAWCLASS;

    if(!RegisterClass(&wndClass))
    {
        UnregisterClass(APPCLASS  ,hInstance);
        UnregisterClass(POLYCLASS ,hInstance);
        UnregisterClass(XFORMCLASS,hInstance);
        UnregisterClass(MAZECLASS ,hInstance);
        return(FALSE);
    }

    /*
    ** Register the bouncing ball demo window.
    */
    wndClass.lpfnWndProc   = BounceProc;
    wndClass.hIcon         = LoadIcon(NULL,IDI_APPLICATION);
    wndClass.hbrBackground = GetStockObject(WHITE_BRUSH);
    wndClass.lpszMenuName  = NULL;
    wndClass.lpszClassName = BOUNCECLASS;

    if(!RegisterClass(&wndClass))
    {
        UnregisterClass(APPCLASS  ,hInstance);
        UnregisterClass(POLYCLASS ,hInstance);
        UnregisterClass(XFORMCLASS,hInstance);
        UnregisterClass(MAZECLASS ,hInstance);
        UnregisterClass(DRAWCLASS ,hInstance);
        return(FALSE);
    }

    return(TRUE);
}

VOID FAR UnregisterAppClass ( HANDLE hInstance )

Definition at line 163 of file Init.c.

{
    UnregisterClass(APPCLASS   ,hInstance);
    UnregisterClass(POLYCLASS  ,hInstance);
    UnregisterClass(XFORMCLASS ,hInstance);
    UnregisterClass(MAZECLASS  ,hInstance);
    UnregisterClass(DRAWCLASS  ,hInstance);
    UnregisterClass(BOUNCECLASS,hInstance);

    return;
}

Generated on Wed Nov 13 2024 16:53:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/GdiDemo/Maze.c File Reference

  • Multimedia
  • Gdi
  • GdiDemo
Functions

Maze.c File Reference

#include <windows.h>
#include "gdidemo.h"
#include "maze.h"

Go to the source code of this file.

Functions

HWND FAR | CreateMazeWindow (HWND hWndClient, int nItem)
VOID | DrawMaze (HWND hWnd)
BOOL | MazeCommandProc (HWND hWnd, WPARAM wParam, LPARAM lParam)
BOOL | MazeCreateProc (HWND hWnd)
VOID | MazeDestroyProc (HWND hWnd)
VOID | MazePaintProc (HWND hWnd)
LRESULT CALLBACK | MazeProc (HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam)

Function Documentation

HWND FAR CreateMazeWindow | ( | HWND | hWndClient,
 |  | int | nItem
 | ) |  |

Definition at line 23 of file Maze.c.

{
    HANDLE          hInstance;
    MDICREATESTRUCT mcs;
    static char buffer[256];

    hInstance = GETINSTANCE(hWndClient);
    LoadString (hInstance, MAZETITLE, buffer, 256);

    /*
    ** Initialize the MDI create struct for creation of the
    ** test window.
    */
    mcs.szClass = MAZECLASS;
    mcs.szTitle = buffer;
    mcs.hOwner  = hInstance;
    mcs.x       = CW_USEDEFAULT;
    mcs.y       = CW_USEDEFAULT;
    mcs.cx      = CW_USEDEFAULT;
    mcs.cy      = CW_USEDEFAULT;
    mcs.style   = 0l;
    mcs.lParam  = (LONG)nItem;

    return((HWND)SendMessage(hWndClient,WM_MDICREATE,0,(LPARAM)(LPMDICREATESTRUCT)&mcs));
}

VOID DrawMaze ( HWND hWnd )

Definition at line 150 of file Maze.c.

{
    hWnd = hWnd;

    return;
}

BOOL MazeCommandProc | ( | HWND | hWnd,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 113 of file Maze.c.

{
    hWnd   = hWnd;
    wParam = wParam;
    lParam = lParam;

    return(TRUE);
}

BOOL MazeCreateProc ( HWND hWnd )

Definition at line 92 of file Maze.c.

{
    PMAZEDATA ppd;

    if(AllocWindowInfo(hWnd,sizeof(MAZEDATA)))
    {
        if(ppd = (PMAZEDATA)LockWindowInfo(hWnd))
        {
            UnlockWindowInfo(hWnd);
            return(TRUE);
        }
        FreeWindowInfo(hWnd);
    }
    return(FALSE);
}

VOID MazeDestroyProc ( HWND hWnd )

Definition at line 142 of file Maze.c.

{
    KillTimer(hWnd,1);
    FreeWindowInfo(hWnd);
    return;
}

VOID MazePaintProc ( HWND hWnd )

Definition at line 126 of file Maze.c.

{
    HDC         hDC;
    PAINTSTRUCT ps;

    if(hDC = BeginPaint(hWnd,&ps))
        EndPaint(hWnd,&ps);

    return;
}

LRESULT CALLBACK MazeProc | ( | HWND | hWnd,
 |  | UINT | wMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 54 of file Maze.c.

{
    switch(wMsg)
    {
        case WM_CREATE:
            MazeCreateProc(hWnd);
            break;

        case WM_COMMAND:
            MazeCommandProc(hWnd,wParam,lParam);
            break;

        case WM_TIMER:
            DrawMaze(hWnd);
            break;

        case WM_PAINT:
            MazePaintProc(hWnd);
            break;

        case WM_DESTROY:
            MazeDestroyProc(hWnd);
            break;

        default:
            return(DefMDIChildProc(hWnd,wMsg,wParam,lParam));
    }
    return(0l);
}

Generated on Wed Nov 13 2024 16:53:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/GdiDemo/Maze.h File Reference

  • Multimedia
  • Gdi
  • GdiDemo
Classes | Defines | Typedefs | Functions

Maze.h File Reference

Go to the source code of this file.

Classes

struct | _MAZEDATA

Defines

#define | MAZECLASS "MAZEDEMO"

Typedefs

typedef MAZEDATA FAR * | LPMAZEDATA
typedef struct _MAZEDATA | MAZEDATA
typedef MAZEDATA NEAR * | NPMAZEDATA
typedef MAZEDATA * | PMAZEDATA

Functions

HWND FAR | CreateMazeWindow (HWND, int)
VOID | DrawMaze (HWND)
BOOL | MazeCommandProc (HWND, WPARAM, LPARAM)
BOOL | MazeCreateProc (HWND)
VOID | MazeDestroyProc (HWND)
VOID | MazePaintProc (HWND)
LRESULT CALLBACK | MazeProc (HWND, UINT, WPARAM, LPARAM)

Define Documentation

#define MAZECLASS "MAZEDEMO"

Definition at line 21 of file Maze.h.

Typedef Documentation

typedef MAZEDATA FAR* LPMAZEDATA

Definition at line 30 of file Maze.h.

typedef struct _MAZEDATA MAZEDATA
typedef MAZEDATA NEAR* NPMAZEDATA

Definition at line 29 of file Maze.h.

typedef MAZEDATA* PMAZEDATA

Definition at line 28 of file Maze.h.

Function Documentation

HWND FAR CreateMazeWindow | ( | HWND | ,
 |  | int |
 | ) |  |

Definition at line 23 of file Maze.c.

{
    HANDLE          hInstance;
    MDICREATESTRUCT mcs;
    static char buffer[256];

    hInstance = GETINSTANCE(hWndClient);
    LoadString (hInstance, MAZETITLE, buffer, 256);

    /*
    ** Initialize the MDI create struct for creation of the
    ** test window.
    */
    mcs.szClass = MAZECLASS;
    mcs.szTitle = buffer;
    mcs.hOwner  = hInstance;
    mcs.x       = CW_USEDEFAULT;
    mcs.y       = CW_USEDEFAULT;
    mcs.cx      = CW_USEDEFAULT;
    mcs.cy      = CW_USEDEFAULT;
    mcs.style   = 0l;
    mcs.lParam  = (LONG)nItem;

    return((HWND)SendMessage(hWndClient,WM_MDICREATE,0,(LPARAM)(LPMDICREATESTRUCT)&mcs));
}

VOID DrawMaze ( HWND )

Definition at line 150 of file Maze.c.

{
    hWnd = hWnd;

    return;
}

BOOL MazeCommandProc | ( | HWND | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 113 of file Maze.c.

{
    hWnd   = hWnd;
    wParam = wParam;
    lParam = lParam;

    return(TRUE);
}

BOOL MazeCreateProc ( HWND )

Definition at line 92 of file Maze.c.

{
    PMAZEDATA ppd;

    if(AllocWindowInfo(hWnd,sizeof(MAZEDATA)))
    {
        if(ppd = (PMAZEDATA)LockWindowInfo(hWnd))
        {
            UnlockWindowInfo(hWnd);
            return(TRUE);
        }
        FreeWindowInfo(hWnd);
    }
    return(FALSE);
}

VOID MazeDestroyProc ( HWND )

Definition at line 142 of file Maze.c.

{
    KillTimer(hWnd,1);
    FreeWindowInfo(hWnd);
    return;
}

VOID MazePaintProc ( HWND )

Definition at line 126 of file Maze.c.

{
    HDC         hDC;
    PAINTSTRUCT ps;

    if(hDC = BeginPaint(hWnd,&ps))
        EndPaint(hWnd,&ps);

    return;
}

LRESULT CALLBACK MazeProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 54 of file Maze.c.

{
    switch(wMsg)
    {
        case WM_CREATE:
            MazeCreateProc(hWnd);
            break;

        case WM_COMMAND:
            MazeCommandProc(hWnd,wParam,lParam);
            break;

        case WM_TIMER:
            DrawMaze(hWnd);
            break;

        case WM_PAINT:
            MazePaintProc(hWnd);
            break;

        case WM_DESTROY:
            MazeDestroyProc(hWnd);
            break;

        default:
            return(DefMDIChildProc(hWnd,wMsg,wParam,lParam));
    }
    return(0l);
}

Generated on Wed Nov 13 2024 16:53:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/GdiDemo/Poly.c File Reference

  • Multimedia
  • Gdi
  • GdiDemo
Functions

Poly.c File Reference

#include <windows.h>
#include "gdidemo.h"
#include "poly.h"

Go to the source code of this file.

Functions

HWND FAR | CreatePolyWindow (HWND hWndClient, int nItem)
BOOL | PolyCommandProc (HWND hWnd, WPARAM wParam, LPARAM lParam)
BOOL | PolyCreateProc (HWND hWnd)
VOID | PolyDestroyProc (HWND hWnd)
VOID | PolyDrawBez (HWND hWnd)
VOID | PolyInitPoints (HWND hWnd)
int | PolyNewVel (int i)
VOID | PolyPaintProc (HWND hWnd)
LRESULT CALLBACK | PolyProc (HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam)
VOID | PolyRedraw (HWND hWnd)

Function Documentation

HWND FAR CreatePolyWindow | ( | HWND | hWndClient,
 |  | int | nItem
 | ) |  |

Definition at line 25 of file Poly.c.

{
    HANDLE          hInstance;
    MDICREATESTRUCT mcs;
    static char buffer[256];

    hInstance = GETINSTANCE(hWndClient);
    LoadString (hInstance, POLYTITLE, buffer, 256);

    /*
    ** Initialize the MDI create struct for creation of the
    ** test window.
    */
    mcs.szClass = POLYCLASS;
    mcs.szTitle = buffer;
    mcs.hOwner  = hInstance;
    mcs.x       = CW_USEDEFAULT;
    mcs.y       = CW_USEDEFAULT;
    mcs.cx      = CW_USEDEFAULT;
    mcs.cy      = CW_USEDEFAULT;
    mcs.style   = 0l;
    mcs.lParam  = (LONG)nItem;

    return((HWND)SendMessage(hWndClient,WM_MDICREATE,0,(LPARAM)(LPMDICREATESTRUCT)&mcs));
}

BOOL PolyCommandProc | ( | HWND | hWnd,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 140 of file Poly.c.

{
    hWnd   = hWnd;
    wParam = wParam;
    lParam = lParam;

    return(TRUE);
}

BOOL PolyCreateProc ( HWND hWnd )

Definition at line 103 of file Poly.c.

{
    PPOLYDATA ppd;

    if(AllocWindowInfo(hWnd,sizeof(POLYDATA)))
    {
        if(ppd = (PPOLYDATA)LockWindowInfo(hWnd))
        {
            ppd->nBezTotal  = 20;
            ppd->nBezCurr   = 0;
            ppd->nColor     = 0;
            ppd->hBezBuffer = GlobalAlloc(GHND,(DWORD)(sizeof(BEZBUFFER) * MAX_BEZIER));

            UnlockWindowInfo(hWnd);
           if ( !ppd->hBezBuffer )
           {
               FreeWindowInfo(hWnd);
               return(FALSE);
           }

            PolyInitPoints(hWnd);

            SetTimer(hWnd,1,50,NULL);
            return(TRUE);
        }
        FreeWindowInfo(hWnd);
    }
    return(FALSE);
}

VOID PolyDestroyProc ( HWND hWnd )

Definition at line 175 of file Poly.c.

{
    PPOLYDATA ppd;

    KillTimer(hWnd,1);
    if(ppd = (PPOLYDATA)LockWindowInfo(hWnd))
    {
        GlobalFree(ppd->hBezBuffer);
        UnlockWindowInfo(hWnd);
    }
    FreeWindowInfo(hWnd);

    return;
}

VOID PolyDrawBez ( HWND hWnd )

Definition at line 318 of file Poly.c.

{
    PPOLYDATA   ppd;
    LPBEZBUFFER lpBez,lpCurr,lpPrev;
    int         idx,x,y;
    RECT        rect;
    HDC         hDC;
    HPEN        hPen;

static COLORREF crColor[] = {0x000000FF,0x0000FF00,0x00FF0000,0x0000FFFF,
                             0x00FF00FF,0x00FFFF00,0x00FFFFFF,0x00000080,
                             0x00008000,0x00800000,0x00008080,0x00800080,
                             0x00808000,0x00808080,0x000000FF,0x0000FF00,
                             0x00FF0000,0x0000FFFF,0x00FF00FF,0x00FFFF00};

    if(ppd = (PPOLYDATA)LockWindowInfo(hWnd))
    {
        if(lpBez = (LPBEZBUFFER)GlobalLock(ppd->hBezBuffer))
        {
            if(hDC = GetDC(hWnd))
            {
                GetClientRect(hWnd,&rect);

                lpPrev = lpBez+ppd->nBezCurr;

                ppd->nBezCurr += 1;

                if(ppd->nBezCurr >= ppd->nBezTotal)
                {
                    ppd->nBezCurr = 0;

                   ppd->nColor  = (++ppd->nColor % 20);
                }
                lpCurr = lpBez+ppd->nBezCurr;

                if(lpCurr->pPts[0].x != -1)
                {
                    hPen = SelectObject(hDC,GetStockObject(BLACK_PEN));
#if defined(_WIN32) && defined(WIN32)
                    PolyBezier(hDC,lpCurr->pPts,BEZ_PTS);
#else
                    Polyline(hDC,lpCurr->pPts,BEZ_PTS);
#endif
                    SelectObject(hDC,hPen);
                }

                for(idx=0; idx < BEZ_PTS; idx++)
                {
                    x  = lpPrev->pPts[idx].x;
                    y  = lpPrev->pPts[idx].y;
                    x += ppd->pVel[idx].x;
                    y += ppd->pVel[idx].y;

                    if(x >= rect.right)
                    {
                        x = rect.right - ((x - rect.right)+1);

                       ppd->pVel[idx].x = -PolyNewVel(idx);
                    }

                    if(x <= rect.left)
                    {
                        x = rect.left + ((rect.left - x)+1);
                        ppd->pVel[idx].x = PolyNewVel(idx);
                    }

                    if(y >= rect.bottom)
                    {
                        y = rect.bottom - ((y - rect.bottom)+1);
                        ppd->pVel[idx].y = -PolyNewVel(idx);
                    }

                    if(y <= rect.top)
                    {
                        y = rect.top + ((rect.top - y)+1);
                        ppd->pVel[idx].y = PolyNewVel(idx);
                    }

                    lpCurr->pPts[idx].x = x;
                    lpCurr->pPts[idx].y = y;

                }

               hPen = SelectObject(hDC,CreatePen(PS_SOLID,1,crColor[ppd->nColor]));
#if defined(_WIN32) && defined(WIN32)
                PolyBezier(hDC,lpCurr->pPts,BEZ_PTS);
#else
                Polyline(hDC,lpCurr->pPts,BEZ_PTS);
#endif
                DeleteObject(SelectObject(hDC,hPen));

#if defined(_WIN32) && defined(WIN32)
                SetROP2(hDC,R2_COPYPEN);
#endif
                ReleaseDC(hWnd,hDC);
            }
            GlobalUnlock(ppd->hBezBuffer);
        }
        UnlockWindowInfo(hWnd);
    }
}

VOID PolyInitPoints ( HWND hWnd )

Definition at line 217 of file Poly.c.

{
    PPOLYDATA   ppd;
    LPBEZBUFFER lpBez;
    int         idx;
    RECT        rect;

    if(ppd = (PPOLYDATA)LockWindowInfo(hWnd))
    {
        if(lpBez = (LPBEZBUFFER)GlobalLock(ppd->hBezBuffer))
        {
            GetClientRect(hWnd,&rect);

            for(idx=0; idx < BEZ_PTS-1; idx++)
            {
                lpBez->pPts[idx].x = lRandom() % rect.right;
                lpBez->pPts[idx].y = lRandom() % rect.bottom;

                ppd->pVel[idx].x = PolyNewVel(idx);
                ppd->pVel[idx].y = PolyNewVel(idx);
            }
            GlobalUnlock(ppd->hBezBuffer);
        }
        UnlockWindowInfo(hWnd);
    }
    return;
}

int PolyNewVel ( int i )

Definition at line 198 of file Poly.c.

{
    int nRet;

    if ((i == 1) || (i == 2))
        nRet = (int)((lRandom() % VELMAX) / 3) + VELMIN;
    else
        nRet = (int)(lRandom() % VELMAX) + VELMIN;

    return((nRet < 0) ? -nRet : nRet);
}

VOID PolyPaintProc ( HWND hWnd )

Definition at line 155 of file Poly.c.

{
    HDC         hDC;
    PAINTSTRUCT ps;

    if(hDC = BeginPaint(hWnd,&ps))
        EndPaint(hWnd,&ps);

    PolyRedraw(hWnd);

    return;
}

LRESULT CALLBACK PolyProc | ( | HWND | hWnd,
 |  | UINT | wMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 57 of file Poly.c.

{
    switch(wMsg)
    {
        case WM_CREATE:
            PolyCreateProc(hWnd);
            break;

        case WM_COMMAND:
            PolyCommandProc(hWnd,wParam,lParam);
            break;

        case WM_MOVE:
            PolyRedraw(hWnd);
            break;

        case WM_TIMER:
            PolyDrawBez(hWnd);
            break;

        case WM_PAINT:
            PolyPaintProc(hWnd);
            break;

        case WM_DESTROY:
            PolyDestroyProc(hWnd);
            break;

        default:
            return(DefMDIChildProc(hWnd,wMsg,wParam,lParam));
    }
    return(0l);
}

VOID PolyRedraw ( HWND hWnd )

Definition at line 252 of file Poly.c.

{
    PPOLYDATA   ppd;
    LPBEZBUFFER lpBez,lpCurr;
    HDC         hDC;
    int         i,j;
    RECT        rect;

    if(ppd = (PPOLYDATA)LockWindowInfo(hWnd))
    {
        if(lpBez = (LPBEZBUFFER)GlobalLock(ppd->hBezBuffer))
        {
            if(hDC = GetDC(hWnd))
            {
                /*
                ** Save the current bezier.  Set the first bezier in the
                ** array to that curve, and use it as a basis for the next
                ** series.
                */
                lpCurr        = lpBez+ppd->nBezCurr;
                *lpBez        = *lpCurr;
                ppd->nBezCurr = 0;

                /*
                ** Clean the curves (all but the first curve).
                */
                for(j=1; j < ppd->nBezTotal; j++)
                {
                    for(i=0; i < BEZ_PTS; i++)
                    {
                        (lpBez+j)->pPts[i].x = -1;
                        (lpBez+j)->pPts[i].y = 0;
                    }
                }

                /*
                ** Clear the display.
                */
                GetClientRect(hWnd,&rect);
                BitBlt(hDC,0,0,rect.right, rect.bottom,(HDC)0,0,0,0);

                /*
                ** Draw the first curve in the bezier array.
                */
#if defined(_WIN32) && defined(WIN32)
                PolyBezier(hDC,lpBez->pPts,BEZ_PTS);
#else
                Polyline(hDC,lpBez->pPts,BEZ_PTS);
#endif
                ReleaseDC(hWnd,hDC);
            }
            GlobalUnlock(ppd->hBezBuffer);
        }
        UnlockWindowInfo(hWnd);
    }
    return;
}

Generated on Wed Nov 13 2024 16:53:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/GdiDemo/Poly.h File Reference

  • Multimedia
  • Gdi
  • GdiDemo
Classes | Defines | Typedefs | Functions

Poly.h File Reference

Go to the source code of this file.

Classes

struct | _BEZBUFFER
struct | _POLYDATA

Defines

#define | BEZ_CURVES 1
#define | BEZ_PTS 3*BEZ_CURVES+1
#define | MAX_BEZIER 80
#define | POLYCLASS "POLYDEMO"
#define | VELMAX 10
#define | VELMIN 2

Typedefs

typedef struct _BEZBUFFER | BEZBUFFER
typedef BEZBUFFER FAR * | LPBEZBUFFER
typedef POLYDATA FAR * | LPPOLYDATA
typedef BEZBUFFER NEAR * | NPBEZBUFFER
typedef POLYDATA NEAR * | NPPOLYDATA
typedef BEZBUFFER * | PBEZBUFFER
typedef struct _POLYDATA | POLYDATA
typedef POLYDATA * | PPOLYDATA

Functions

HWND FAR | CreatePolyWindow (HWND, int)
BOOL | PolyCommandProc (HWND, WPARAM, LPARAM)
BOOL | PolyCreateProc (HWND)
VOID | PolyDestroyProc (HWND)
VOID | PolyDrawBez (HWND)
VOID | PolyInitPoints (HWND)
int | PolyNewVel (int)
VOID | PolyPaintProc (HWND)
LRESULT CALLBACK | PolyProc (HWND, UINT, WPARAM, LPARAM)
VOID | PolyRedraw (HWND)

Define Documentation

#define BEZ_CURVES 1

Definition at line 26 of file Poly.h.

#define BEZ_PTS 3*BEZ_CURVES+1

Definition at line 27 of file Poly.h.

#define MAX_BEZIER 80

Definition at line 23 of file Poly.h.

#define POLYCLASS "POLYDEMO"

Definition at line 21 of file Poly.h.

#define VELMAX 10

Definition at line 24 of file Poly.h.

#define VELMIN 2

Definition at line 25 of file Poly.h.

Typedef Documentation

typedef struct _BEZBUFFER BEZBUFFER
typedef BEZBUFFER FAR* LPBEZBUFFER

Definition at line 40 of file Poly.h.

typedef POLYDATA FAR* LPPOLYDATA

Definition at line 57 of file Poly.h.

typedef BEZBUFFER NEAR* NPBEZBUFFER

Definition at line 39 of file Poly.h.

typedef POLYDATA NEAR* NPPOLYDATA

Definition at line 56 of file Poly.h.

typedef BEZBUFFER* PBEZBUFFER

Definition at line 38 of file Poly.h.

typedef struct _POLYDATA POLYDATA
typedef POLYDATA* PPOLYDATA

Definition at line 55 of file Poly.h.

Function Documentation

HWND FAR CreatePolyWindow | ( | HWND | ,
 |  | int |
 | ) |  |

Definition at line 25 of file Poly.c.

{
    HANDLE          hInstance;
    MDICREATESTRUCT mcs;
    static char buffer[256];

    hInstance = GETINSTANCE(hWndClient);
    LoadString (hInstance, POLYTITLE, buffer, 256);

    /*
    ** Initialize the MDI create struct for creation of the
    ** test window.
    */
    mcs.szClass = POLYCLASS;
    mcs.szTitle = buffer;
    mcs.hOwner  = hInstance;
    mcs.x       = CW_USEDEFAULT;
    mcs.y       = CW_USEDEFAULT;
    mcs.cx      = CW_USEDEFAULT;
    mcs.cy      = CW_USEDEFAULT;
    mcs.style   = 0l;
    mcs.lParam  = (LONG)nItem;

    return((HWND)SendMessage(hWndClient,WM_MDICREATE,0,(LPARAM)(LPMDICREATESTRUCT)&mcs));
}

BOOL PolyCommandProc | ( | HWND | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 140 of file Poly.c.

{
    hWnd   = hWnd;
    wParam = wParam;
    lParam = lParam;

    return(TRUE);
}

BOOL PolyCreateProc ( HWND )

Definition at line 103 of file Poly.c.

{
    PPOLYDATA ppd;

    if(AllocWindowInfo(hWnd,sizeof(POLYDATA)))
    {
        if(ppd = (PPOLYDATA)LockWindowInfo(hWnd))
        {
            ppd->nBezTotal  = 20;
            ppd->nBezCurr   = 0;
            ppd->nColor     = 0;
            ppd->hBezBuffer = GlobalAlloc(GHND,(DWORD)(sizeof(BEZBUFFER) * MAX_BEZIER));

            UnlockWindowInfo(hWnd);
           if ( !ppd->hBezBuffer )
           {
               FreeWindowInfo(hWnd);
               return(FALSE);
           }

            PolyInitPoints(hWnd);

            SetTimer(hWnd,1,50,NULL);
            return(TRUE);
        }
        FreeWindowInfo(hWnd);
    }
    return(FALSE);
}

VOID PolyDestroyProc ( HWND )

Definition at line 175 of file Poly.c.

{
    PPOLYDATA ppd;

    KillTimer(hWnd,1);
    if(ppd = (PPOLYDATA)LockWindowInfo(hWnd))
    {
        GlobalFree(ppd->hBezBuffer);
        UnlockWindowInfo(hWnd);
    }
    FreeWindowInfo(hWnd);

    return;
}

VOID PolyDrawBez ( HWND )

Definition at line 318 of file Poly.c.

{
    PPOLYDATA   ppd;
    LPBEZBUFFER lpBez,lpCurr,lpPrev;
    int         idx,x,y;
    RECT        rect;
    HDC         hDC;
    HPEN        hPen;

static COLORREF crColor[] = {0x000000FF,0x0000FF00,0x00FF0000,0x0000FFFF,
                             0x00FF00FF,0x00FFFF00,0x00FFFFFF,0x00000080,
                             0x00008000,0x00800000,0x00008080,0x00800080,
                             0x00808000,0x00808080,0x000000FF,0x0000FF00,
                             0x00FF0000,0x0000FFFF,0x00FF00FF,0x00FFFF00};

    if(ppd = (PPOLYDATA)LockWindowInfo(hWnd))
    {
        if(lpBez = (LPBEZBUFFER)GlobalLock(ppd->hBezBuffer))
        {
            if(hDC = GetDC(hWnd))
            {
                GetClientRect(hWnd,&rect);

                lpPrev = lpBez+ppd->nBezCurr;

                ppd->nBezCurr += 1;

                if(ppd->nBezCurr >= ppd->nBezTotal)
                {
                    ppd->nBezCurr = 0;

                   ppd->nColor  = (++ppd->nColor % 20);
                }
                lpCurr = lpBez+ppd->nBezCurr;

                if(lpCurr->pPts[0].x != -1)
                {
                    hPen = SelectObject(hDC,GetStockObject(BLACK_PEN));
#if defined(_WIN32) && defined(WIN32)
                    PolyBezier(hDC,lpCurr->pPts,BEZ_PTS);
#else
                    Polyline(hDC,lpCurr->pPts,BEZ_PTS);
#endif
                    SelectObject(hDC,hPen);
                }

                for(idx=0; idx < BEZ_PTS; idx++)
                {
                    x  = lpPrev->pPts[idx].x;
                    y  = lpPrev->pPts[idx].y;
                    x += ppd->pVel[idx].x;
                    y += ppd->pVel[idx].y;

                    if(x >= rect.right)
                    {
                        x = rect.right - ((x - rect.right)+1);

                       ppd->pVel[idx].x = -PolyNewVel(idx);
                    }

                    if(x <= rect.left)
                    {
                        x = rect.left + ((rect.left - x)+1);
                        ppd->pVel[idx].x = PolyNewVel(idx);
                    }

                    if(y >= rect.bottom)
                    {
                        y = rect.bottom - ((y - rect.bottom)+1);
                        ppd->pVel[idx].y = -PolyNewVel(idx);
                    }

                    if(y <= rect.top)
                    {
                        y = rect.top + ((rect.top - y)+1);
                        ppd->pVel[idx].y = PolyNewVel(idx);
                    }

                    lpCurr->pPts[idx].x = x;
                    lpCurr->pPts[idx].y = y;

                }

               hPen = SelectObject(hDC,CreatePen(PS_SOLID,1,crColor[ppd->nColor]));
#if defined(_WIN32) && defined(WIN32)
                PolyBezier(hDC,lpCurr->pPts,BEZ_PTS);
#else
                Polyline(hDC,lpCurr->pPts,BEZ_PTS);
#endif
                DeleteObject(SelectObject(hDC,hPen));

#if defined(_WIN32) && defined(WIN32)
                SetROP2(hDC,R2_COPYPEN);
#endif
                ReleaseDC(hWnd,hDC);
            }
            GlobalUnlock(ppd->hBezBuffer);
        }
        UnlockWindowInfo(hWnd);
    }
}

VOID PolyInitPoints ( HWND )

Definition at line 217 of file Poly.c.

{
    PPOLYDATA   ppd;
    LPBEZBUFFER lpBez;
    int         idx;
    RECT        rect;

    if(ppd = (PPOLYDATA)LockWindowInfo(hWnd))
    {
        if(lpBez = (LPBEZBUFFER)GlobalLock(ppd->hBezBuffer))
        {
            GetClientRect(hWnd,&rect);

            for(idx=0; idx < BEZ_PTS-1; idx++)
            {
                lpBez->pPts[idx].x = lRandom() % rect.right;
                lpBez->pPts[idx].y = lRandom() % rect.bottom;

                ppd->pVel[idx].x = PolyNewVel(idx);
                ppd->pVel[idx].y = PolyNewVel(idx);
            }
            GlobalUnlock(ppd->hBezBuffer);
        }
        UnlockWindowInfo(hWnd);
    }
    return;
}

int PolyNewVel ( int )

Definition at line 198 of file Poly.c.

{
    int nRet;

    if ((i == 1) || (i == 2))
        nRet = (int)((lRandom() % VELMAX) / 3) + VELMIN;
    else
        nRet = (int)(lRandom() % VELMAX) + VELMIN;

    return((nRet < 0) ? -nRet : nRet);
}

VOID PolyPaintProc ( HWND )

Definition at line 155 of file Poly.c.

{
    HDC         hDC;
    PAINTSTRUCT ps;

    if(hDC = BeginPaint(hWnd,&ps))
        EndPaint(hWnd,&ps);

    PolyRedraw(hWnd);

    return;
}

LRESULT CALLBACK PolyProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 57 of file Poly.c.

{
    switch(wMsg)
    {
        case WM_CREATE:
            PolyCreateProc(hWnd);
            break;

        case WM_COMMAND:
            PolyCommandProc(hWnd,wParam,lParam);
            break;

        case WM_MOVE:
            PolyRedraw(hWnd);
            break;

        case WM_TIMER:
            PolyDrawBez(hWnd);
            break;

        case WM_PAINT:
            PolyPaintProc(hWnd);
            break;

        case WM_DESTROY:
            PolyDestroyProc(hWnd);
            break;

        default:
            return(DefMDIChildProc(hWnd,wMsg,wParam,lParam));
    }
    return(0l);
}

VOID PolyRedraw ( HWND )

Definition at line 252 of file Poly.c.

{
    PPOLYDATA   ppd;
    LPBEZBUFFER lpBez,lpCurr;
    HDC         hDC;
    int         i,j;
    RECT        rect;

    if(ppd = (PPOLYDATA)LockWindowInfo(hWnd))
    {
        if(lpBez = (LPBEZBUFFER)GlobalLock(ppd->hBezBuffer))
        {
            if(hDC = GetDC(hWnd))
            {
                /*
                ** Save the current bezier.  Set the first bezier in the
                ** array to that curve, and use it as a basis for the next
                ** series.
                */
                lpCurr        = lpBez+ppd->nBezCurr;
                *lpBez        = *lpCurr;
                ppd->nBezCurr = 0;

                /*
                ** Clean the curves (all but the first curve).
                */
                for(j=1; j < ppd->nBezTotal; j++)
                {
                    for(i=0; i < BEZ_PTS; i++)
                    {
                        (lpBez+j)->pPts[i].x = -1;
                        (lpBez+j)->pPts[i].y = 0;
                    }
                }

                /*
                ** Clear the display.
                */
                GetClientRect(hWnd,&rect);
                BitBlt(hDC,0,0,rect.right, rect.bottom,(HDC)0,0,0,0);

                /*
                ** Draw the first curve in the bezier array.
                */
#if defined(_WIN32) && defined(WIN32)
                PolyBezier(hDC,lpBez->pPts,BEZ_PTS);
#else
                Polyline(hDC,lpBez->pPts,BEZ_PTS);
#endif
                ReleaseDC(hWnd,hDC);
            }
            GlobalUnlock(ppd->hBezBuffer);
        }
        UnlockWindowInfo(hWnd);
    }
    return;
}

Generated on Wed Nov 13 2024 16:53:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/GdiDemo/Wininfo.c File Reference

  • Multimedia
  • Gdi
  • GdiDemo
Functions

Wininfo.c File Reference

#include <windows.h>
#include "gdidemo.h"

Go to the source code of this file.

Functions

BOOL FAR | AllocWindowInfo (HWND hWnd, WORD wSize)
BOOL FAR | FreeWindowInfo (HWND hWnd)
PVOID FAR | LockWindowInfo (HWND hWnd)
BOOL FAR | UnlockWindowInfo (HWND hWnd)

Function Documentation

BOOL FAR AllocWindowInfo | ( | HWND | hWnd,
 |  | WORD | wSize
 | ) |  |

Definition at line 28 of file Wininfo.c.

{
    HANDLE hsd;

    if(hsd = LocalAlloc(LHND,(WORD)wSize))
    {
        SetWindowLongPtr(hWnd,0,(LONG_PTR)hsd);
        return(TRUE);
    }
    return(FALSE);
}

BOOL FAR FreeWindowInfo ( HWND hWnd )

Definition at line 82 of file Wininfo.c.

{
    LOCALHANDLE hMem;

    if(hMem = (HANDLE)GetWindowLongPtr(hWnd,0))
        LocalFree(hMem);
    return(TRUE);
}

PVOID FAR LockWindowInfo ( HWND hWnd )

Definition at line 47 of file Wininfo.c.

{
    HANDLE hMem;
    PVOID  pMem;

    pMem = NULL;
    if(hMem = (HANDLE)GetWindowLongPtr(hWnd,0))
        pMem = (PVOID)LocalLock(hMem);

    return(pMem);
}

BOOL FAR UnlockWindowInfo ( HWND hWnd )

Definition at line 65 of file Wininfo.c.

{
    HANDLE hMem;

    if(hMem = (HANDLE)GetWindowLongPtr(hWnd,0))
        if(!LocalUnlock(hMem))
            return(TRUE);

    return(FALSE);
}

Generated on Wed Nov 13 2024 16:53:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/GdiDemo/XForm.c File Reference

  • Multimedia
  • Gdi
  • GdiDemo
Functions

XForm.c File Reference

#include <windows.h>
#include "gdidemo.h"
#include "xform.h"

Go to the source code of this file.

Functions

HWND FAR | CreateXFormWindow (HWND hWndClient, int nItem)
VOID | DrawXForm (HWND)
VOID | ResetXForm (HWND)
BOOL | XFormCommandProc (HWND hWnd, WPARAM wParam, LPARAM lParam)
BOOL | XFormCreateProc (HWND hWnd)
VOID | XFormDestroyProc (HWND hWnd)
VOID | XFormPaintProc (HWND hWnd)
LRESULT CALLBACK | XFormProc (HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam)

Function Documentation

HWND FAR CreateXFormWindow | ( | HWND | hWndClient,
 |  | int | nItem
 | ) |  |

Definition at line 27 of file XForm.c.

{
    HANDLE          hInstance;
    MDICREATESTRUCT mcs;
    static char buffer[256];

    hInstance = GETINSTANCE(hWndClient);
    LoadString (hInstance, XFORMTITLE, buffer, 256);

    /*
    ** Initialize the MDI create struct for creation of the
    ** test window.
    */
    mcs.szClass = XFORMCLASS;
    mcs.szTitle = buffer;
    mcs.hOwner  = hInstance;
    mcs.x       = CW_USEDEFAULT;
    mcs.y       = CW_USEDEFAULT;
    mcs.cx      = CW_USEDEFAULT;
    mcs.cy      = CW_USEDEFAULT;
    mcs.style   = 0l;
    mcs.lParam  = (LONG)nItem;

    return((HWND)SendMessage(hWndClient,WM_MDICREATE,0,(LPARAM)(LPMDICREATESTRUCT)&mcs));
}

VOID DrawXForm ( HWND hWnd )

Definition at line 242 of file XForm.c.

{
    PXFORMDATA pxd;
    HDC        hDC;
#ifndef NOT_IMPLEMENTED
    XFORM      xForm;
    RECT       rect;
#endif

    if(pxd = (PXFORMDATA)LockWindowInfo(hWnd))
    {
        if(hDC = GetDC(hWnd))
        {

#ifndef NOT_IMPLEMENTED

            GetClientRect(hWnd,&rect);
            SetViewportOrgEx(hDC,rect.right >> 1, rect.bottom >> 1,NULL);

            SetWorldTransform(hDC,(LPXFORM)&pxd->xForm);
            Polyline(hDC,pxd->pObject,pxd->nObject);

            ModifyWorldTransform(hDC,(LPXFORM)&pxd->xForm,MWT_RIGHTMULTIPLY);
            Polyline(hDC,pxd->pObject,pxd->nObject);

            GetWorldTransform(hDC,(LPXFORM)&xForm);
            pxd->xForm.eM11 = xForm.eM11;
            pxd->xForm.eM12 = xForm.eM12;
            pxd->xForm.eM21 = xForm.eM21;
            pxd->xForm.eM22 = xForm.eM22;
            pxd->xForm.eDx  = xForm.eDx;
            pxd->xForm.eDy  = xForm.eDy;

            ModifyWorldTransform(hDC,(LPXFORM)&pxd->xForm,MWT_IDENTITY);

            // I have to put this in since GDI currently doesn't
            // reset the drawing attributes -- 5/24/91
            //
            SetViewportOrgEx(hDC,0,0,NULL);

#endif
            ReleaseDC(hWnd,hDC);
        }
        UnlockWindowInfo(hWnd);
    }
    return;
}

VOID ResetXForm ( HWND hWnd )

Definition at line 199 of file XForm.c.

{
    PXFORMDATA pxd;
    HDC        hDC;

#ifndef NOT_IMPLEMENTED

    RECT       rect;

#endif

    if(pxd = (PXFORMDATA)LockWindowInfo(hWnd))
    {
        if(hDC = GetDC(hWnd))
        {

#ifndef NOT_IMPLEMENTED

            GetClientRect(hWnd,&rect);
            BitBlt(hDC,0,0,rect.right,rect.bottom,(HDC)0,0,0,0);

            SetViewportOrgEx(hDC,rect.right >> 1,rect.bottom >> 1,NULL);
            SetWorldTransform(hDC,(LPXFORM)&pxd->xForm);
            Polyline(hDC,pxd->pObject,pxd->nObject);
            ModifyWorldTransform(hDC,(LPXFORM)&pxd->xForm,MWT_IDENTITY);

            // I have to put this in since GDI currently doesn't
            // reset the drawing attributes -- 5/24/91
            //
            SetViewportOrgEx(hDC,0,0,NULL);

#endif

            ReleaseDC(hWnd,hDC);
        }
        UnlockWindowInfo(hWnd);
    }
    return;
}

BOOL XFormCommandProc | ( | HWND | hWnd,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 159 of file XForm.c.

{
    hWnd   = hWnd;
    wParam = wParam;
    lParam = lParam;

    return(TRUE);
}

BOOL XFormCreateProc ( HWND hWnd )

Definition at line 102 of file XForm.c.

{
    PXFORMDATA pxd;

#ifndef NOT_IMPLEMENTED

    RECT       rect;
    int        dx,dy;

#endif

    if(AllocWindowInfo(hWnd,sizeof(XFORMDATA)))
    {
        if(pxd = (PXFORMDATA)LockWindowInfo(hWnd))
        {

#ifndef NOT_IMPLEMENTED

            GetClientRect(hWnd,&rect);

            dx = (rect.right + rect.left) >> 4;
            dy = (rect.bottom + rect.top) >> 4;

            pxd->pObject[0].x = dx << 1;
            pxd->pObject[0].y = 0;
            pxd->pObject[1].x = dx;
            pxd->pObject[1].y = dy;
            pxd->pObject[2].x = 0;
            pxd->pObject[2].y = dy;
            pxd->pObject[3].x = dx << 1;
            pxd->pObject[3].y = 0;
            pxd->nObject      = 4;

            pxd->xForm.eM11 = (float) 0.866;
            pxd->xForm.eM12 = (float) 0.5;
            pxd->xForm.eM21 = (float)-0.5;
            pxd->xForm.eM22 = (float) 0.866;
            pxd->xForm.eDx  = (float) 0;
            pxd->xForm.eDy  = (float) 0;

#endif

            UnlockWindowInfo(hWnd);

            SetTimer(hWnd,1,500,NULL);

            return(TRUE);
        }
        FreeWindowInfo(hWnd);
    }
    return(FALSE);
}

VOID XFormDestroyProc ( HWND hWnd )

Definition at line 190 of file XForm.c.

{
    KillTimer(hWnd,1);
    FreeWindowInfo(hWnd);
    return;
}

VOID XFormPaintProc ( HWND hWnd )

Definition at line 172 of file XForm.c.

{
    HDC         hDC;
    PAINTSTRUCT ps;

    if(hDC = BeginPaint(hWnd,&ps))
        EndPaint(hWnd,&ps);

    ResetXForm(hWnd);

    return;
}

LRESULT CALLBACK XFormProc | ( | HWND | hWnd,
 |  | UINT | wMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 58 of file XForm.c.

{
    switch(wMsg)
    {
        case WM_CREATE:
            XFormCreateProc(hWnd);
            break;

        case WM_MOVE:
            ResetXForm(hWnd);
            break;

        case WM_TIMER:
            DrawXForm(hWnd);
            break;

        case WM_COMMAND:
            XFormCommandProc(hWnd,wParam,lParam);
            break;

        case WM_PAINT:
            XFormPaintProc(hWnd);
            break;

        case WM_DESTROY:
            XFormDestroyProc(hWnd);
            break;

        default:
            return(DefMDIChildProc(hWnd,wMsg,wParam,lParam));
    }
    return(0l);
}

Generated on Wed Nov 13 2024 16:53:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/GdiDemo/XForm.h File Reference

  • Multimedia
  • Gdi
  • GdiDemo
Classes | Defines | Typedefs | Functions

XForm.h File Reference

Go to the source code of this file.

Classes

struct | _XFORMDATA

Defines

#define | XFORMCLASS "XFORMDEMO"

Typedefs

typedef XFORMDATA FAR * | LPXFORMDATA
typedef XFORMDATA NEAR * | NPXFORMDATA
typedef XFORMDATA * | PXFORMDATA
typedef struct _XFORMDATA | XFORMDATA

Functions

HWND FAR | CreateXFormWindow (HWND, int)
BOOL | XFormCommandProc (HWND, WPARAM, LPARAM)
BOOL | XFormCreateProc (HWND)
VOID | XFormDestroyProc (HWND)
VOID | XFormPaintProc (HWND)
LRESULT CALLBACK | XFormProc (HWND, UINT, WPARAM, LPARAM)

Define Documentation

#define XFORMCLASS "XFORMDEMO"

Definition at line 21 of file XForm.h.

Typedef Documentation

typedef XFORMDATA FAR* LPXFORMDATA

Definition at line 33 of file XForm.h.

typedef XFORMDATA NEAR* NPXFORMDATA

Definition at line 32 of file XForm.h.

typedef XFORMDATA* PXFORMDATA

Definition at line 31 of file XForm.h.

typedef struct _XFORMDATA XFORMDATA

Function Documentation

HWND FAR CreateXFormWindow | ( | HWND | ,
 |  | int |
 | ) |  |

Definition at line 27 of file XForm.c.

{
    HANDLE          hInstance;
    MDICREATESTRUCT mcs;
    static char buffer[256];

    hInstance = GETINSTANCE(hWndClient);
    LoadString (hInstance, XFORMTITLE, buffer, 256);

    /*
    ** Initialize the MDI create struct for creation of the
    ** test window.
    */
    mcs.szClass = XFORMCLASS;
    mcs.szTitle = buffer;
    mcs.hOwner  = hInstance;
    mcs.x       = CW_USEDEFAULT;
    mcs.y       = CW_USEDEFAULT;
    mcs.cx      = CW_USEDEFAULT;
    mcs.cy      = CW_USEDEFAULT;
    mcs.style   = 0l;
    mcs.lParam  = (LONG)nItem;

    return((HWND)SendMessage(hWndClient,WM_MDICREATE,0,(LPARAM)(LPMDICREATESTRUCT)&mcs));
}

BOOL XFormCommandProc | ( | HWND | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 159 of file XForm.c.

{
    hWnd   = hWnd;
    wParam = wParam;
    lParam = lParam;

    return(TRUE);
}

BOOL XFormCreateProc ( HWND )

Definition at line 102 of file XForm.c.

{
    PXFORMDATA pxd;

#ifndef NOT_IMPLEMENTED

    RECT       rect;
    int        dx,dy;

#endif

    if(AllocWindowInfo(hWnd,sizeof(XFORMDATA)))
    {
        if(pxd = (PXFORMDATA)LockWindowInfo(hWnd))
        {

#ifndef NOT_IMPLEMENTED

            GetClientRect(hWnd,&rect);

            dx = (rect.right + rect.left) >> 4;
            dy = (rect.bottom + rect.top) >> 4;

            pxd->pObject[0].x = dx << 1;
            pxd->pObject[0].y = 0;
            pxd->pObject[1].x = dx;
            pxd->pObject[1].y = dy;
            pxd->pObject[2].x = 0;
            pxd->pObject[2].y = dy;
            pxd->pObject[3].x = dx << 1;
            pxd->pObject[3].y = 0;
            pxd->nObject      = 4;

            pxd->xForm.eM11 = (float) 0.866;
            pxd->xForm.eM12 = (float) 0.5;
            pxd->xForm.eM21 = (float)-0.5;
            pxd->xForm.eM22 = (float) 0.866;
            pxd->xForm.eDx  = (float) 0;
            pxd->xForm.eDy  = (float) 0;

#endif

            UnlockWindowInfo(hWnd);

            SetTimer(hWnd,1,500,NULL);

            return(TRUE);
        }
        FreeWindowInfo(hWnd);
    }
    return(FALSE);
}

VOID XFormDestroyProc ( HWND )

Definition at line 190 of file XForm.c.

{
    KillTimer(hWnd,1);
    FreeWindowInfo(hWnd);
    return;
}

VOID XFormPaintProc ( HWND )

Definition at line 172 of file XForm.c.

{
    HDC         hDC;
    PAINTSTRUCT ps;

    if(hDC = BeginPaint(hWnd,&ps))
        EndPaint(hWnd,&ps);

    ResetXForm(hWnd);

    return;
}

LRESULT CALLBACK XFormProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 58 of file XForm.c.

{
    switch(wMsg)
    {
        case WM_CREATE:
            XFormCreateProc(hWnd);
            break;

        case WM_MOVE:
            ResetXForm(hWnd);
            break;

        case WM_TIMER:
            DrawXForm(hWnd);
            break;

        case WM_COMMAND:
            XFormCommandProc(hWnd,wParam,lParam);
            break;

        case WM_PAINT:
            XFormPaintProc(hWnd);
            break;

        case WM_DESTROY:
            XFormDestroyProc(hWnd);
            break;

        default:
            return(DefMDIChildProc(hWnd,wMsg,wParam,lParam));
    }
    return(0l);
}

Generated on Wed Nov 13 2024 16:53:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/Metafile/MfEdit/MfEdit.c File Reference

  • Multimedia
  • Gdi
  • Metafile
  • MfEdit
Defines | Functions

MfEdit.c File Reference

#include "precomp.h"

Go to the source code of this file.

Defines

#define | MYDBG 0
#define | SwapPalE(i, j)

Functions

BOOL CALLBACK | About (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
BOOL | bChooseNewColor (HWND hwnd, LPDWORD lpdwRGB)
BOOL | bChooseNewFont (HWND hwnd, PLOGFONT plf, COLORREF *pClrRef)
BOOL | bCleanUpRC (VOID)
BOOL APIENTRY | bDoHitTest (HDC hDC, LPHANDLETABLE lpHandleTable, LPENHMETARECORD lpEnhMetaRecord, UINT nHandles, LPVOID lpData)
BOOL | bDrawStuff (HDC hDC, INT OrgX, INT OrgY, INT NextX, INT NextY, BOOL bErase, BOOL bMove, BOOL bCntPt, LPSTR lpstr)
BOOL | bFreeDibFile (PDIBDATA pDibData)
BOOL | bGetBMP (HWND hwnd, BOOL bMask)
BOOL | bGetEPSBounds (LPVOID lpData, RECTL *prctl)
BOOL | bGetWord (LPVOID lpData, char *str, int *pi)
BOOL | bGoNextLine (LPVOID lpData, int *pi)
BOOL | bHitTest (HDC hDC, INT x, INT y)
BOOL | bIsAdobe (char *szStr)
BOOL | bIsBndBox (char *szStr)
BOOL | bIsEOF (char *szStr)
BOOL | bIsEPS (char *szStr)
BOOL APIENTRY | bPlayRecord (HDC hDC, LPHANDLETABLE lpHandleTable, LPENHMETARECORD lpEnhMetaRecord, UINT nHandles, LPVOID lpData)
BOOL | bPlgBlt (HDC hDC, LPPOINT rgPtsBMP)
BOOL | bPrintMf (PPRTDATA pPD)
BOOL | bSelectDIBPal (HDC hDC, LPBITMAPINFO pbmi, BOOL bCoreHdr)
BOOL | bSetAdvancedGraphics (HDC hdc)
BOOL | bSetRC2MatchEmfRC (HDC hDC, ENHMETAHEADER EnhMetaHdr, HENHMETAFILE hEnhMf, PIXELFORMATDESCRIPTOR *ppfd)
BOOL | bSetupRC (HDC hDC, PIXELFORMATDESCRIPTOR *ppfdIn)
LPTSTR | BuildFilterStrs (int id)
HPALETTE | CopyPalette (HPALETTE hPalSrc)
LONG_PTR APIENTRY | CtrlPanelDlgProc (HWND hwnd, UINT msg, WPARAM dwParam, LPARAM lParam)
LONG_PTR APIENTRY | DrawSurfWndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
HLOCAL | Free (CMTMLTFMT *pMfmt)
LPTSTR | GetStringRes (int id)
LPTSTR | GetStringRes2 (int id)
HBITMAP | hBmpLoadBitmapFile (HDC hDC, PSTR pszFileName)
HBRUSH | hBrCreateBrush (HDC hDC, DWORD dwRGB)
HPALETTE | hCreateRGBPalette (HDC hDC, int index)
HDC | hDCRecordMetafileAs (HWND hwnd, LPSTR szFilename)
HENHMETAFILE | hemfLoadMetafile (HWND hwnd)
BOOL | InitializeApp (void)
int CALLBACK | iTT (LPLOGFONT lpLF, LPTEXTMETRIC lpTM, DWORD dwFontType, LPARAM lpData)
LONG | lProcessDIDClear (VOID)
LONG | lProcessDIDFf (BOOL *pbReset)
LONG | lProcessDIDOpen (HWND hwnd, CHAR *szLoadedMetaf, BOOL *pbReset)
LONG | lProcessDIDPlay (char *szLoadedMetaf)
LONG | lProcessDIDPlayStep (WPARAM wParam, INT *piPlus)
LONG | lProcessDIDPlayTenPlus (INT *piPlus)
LONG | lProcessDIDRec (HWND hwnd, INT *piMetafCnt, char *szFilename)
LONG | lProcessDIDStop (VOID)
LONG | lProcessMMAbout (VOID)
LONG | lProcessMMBrush (HWND hwnd)
LONG | lProcessMMCopy (VOID)
LONG | lProcessMMDel (VOID)
LONG | lProcessMMExport3X (VOID)
LONG | lProcessMMFit2Wnd (VOID)
LONG | lProcessMMFont (VOID)
LONG | lProcessMMHittest (VOID)
LONG | lProcessMMImport3X (VOID)
LONG | lProcessMMLEAbout (VOID)
LONG | lProcessMMLoadBmp (HWND hwnd)
LONG | lProcessMMLoadMaskBmp (HWND hwnd)
LONG | lProcessMMMltfmts (VOID)
LONG | lProcessMMPaste (HWND hwnd, BOOL *pbReset)
LONG | lProcessMMPen (HWND hwnd)
LONG | lProcessMMPolyDraw (VOID)
LONG | lProcessMMPrint (VOID)
LONG | lProcessMMRec (HWND hwnd, CHAR *szFilename)
LONG | lProcessMMSaveBmp (VOID)
LONG | lProcessMMStrokeFill (VOID)
LONG_PTR | lProcessWmCommand (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, INT *piMetafCnt, BOOL *pbReset, char *szFilename, char *szLoadedMetaf)
LONG | lProcessWmCreate (HWND hWnd)
LONG | lProcessWmDestroy (VOID)
LONG_PTR | lProcessWmDrawClip (UINT message, WPARAM wParam, LPARAM lParam)
LRESULT | lProcessWmSize (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
LONG_PTR APIENTRY | MainWndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
CMTMLTFMT * | pLoadMltFmtFile (VOID)
BOOL | PolyDraw95 (HDC hdc, CONST LPPOINT lppt, CONST LPBYTE lpbTypes, int cCount)
VOID | SaveStaticEntries (HDC hDC)
LONG_PTR APIENTRY | TextWndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
void | vErrOut (char errstring[MAX_ERR_STRING])
int WINAPI | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)

Define Documentation

#define MYDBG 0

Definition at line 5851 of file MfEdit.c.

#define SwapPalE | ( | i,
 |  | j
 | ) |
Value:
{ \
    PALETTEENTRY palE; \
    palE = pPal->palPalEntry[i]; \
    pPal->palPalEntry[i] = pPal->palPalEntry[j]; \
    pPal->palPalEntry[j] = palE; }

Definition at line 391 of file MfEdit.c.

Function Documentation

BOOL CALLBACK About | ( | HWND | hDlg,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 3191 of file MfEdit.c.

{
    switch (message) {
    case WM_INITDIALOG:
        return TRUE;

    case WM_COMMAND:
        if (wParam == IDOK)
            EndDialog(hDlg, wParam);
        break;
    }

    return FALSE;

    UNREFERENCED_PARAMETER(lParam);
    UNREFERENCED_PARAMETER(hDlg);
}

BOOL bChooseNewColor | ( | HWND | hwnd,
 |  | LPDWORD | lpdwRGB
 | ) |  |

Definition at line 5140 of file MfEdit.c.

                                                 {
    static DWORD argbCust[16] = {
        RGB(255, 255, 255), RGB(255, 255, 255),
        RGB(255, 255, 255), RGB(255, 255, 255),
        RGB(255, 255, 255), RGB(255, 255, 255),
        RGB(255, 255, 255), RGB(255, 255, 255),
        RGB(255, 255, 255), RGB(255, 255, 255),
        RGB(255, 255, 255), RGB(255, 255, 255),
        RGB(255, 255, 255), RGB(255, 255, 255),
        RGB(255, 255, 255), RGB(255, 255, 255)
    };
    CHOOSECOLOR cc;
    BOOL bResult;

    cc.lStructSize = sizeof(CHOOSECOLOR);
    cc.hwndOwner = hwnd;
    cc.hInstance = ghModule;
    cc.rgbResult = *lpdwRGB;
    cc.lpCustColors = argbCust;
    cc.Flags = CC_RGBINIT | CC_SHOWHELP;
    cc.lCustData = 0;
    cc.lpfnHook = NULL;
    cc.lpTemplateName = NULL;

    bResult = ChooseColor(&cc);

    if (bResult) {
        *lpdwRGB = cc.rgbResult;
        return TRUE;
    }

    return FALSE;
}

BOOL bChooseNewFont | ( | HWND | hwnd,
 |  | PLOGFONT | plf,
 |  | COLORREF * | pClrRef
 | ) |  |

Definition at line 5088 of file MfEdit.c.

                                                                {
   HDC                  hDC=NULL;
   static CHOOSEFONT    chf;
   static BOOL          bInit=TRUE;

   if (bInit) {
        bInit = FALSE;

        hDC = GetDC( hwnd );
        chf.hDC = CreateCompatibleDC( hDC );
        ReleaseDC( hwnd, hDC );

        chf.lStructSize = sizeof(CHOOSEFONT);
        chf.hwndOwner = hwnd;
        chf.lpLogFont = plf;
        chf.Flags = CF_SCREENFONTS | CF_EFFECTS | CF_INITTOLOGFONTSTRUCT;
        chf.rgbColors = *pClrRef;
        chf.lCustData = 0;
        chf.hInstance = (HANDLE)NULL;
        chf.lpszStyle = (LPSTR)NULL;
        chf.nFontType = SCREEN_FONTTYPE;
        chf.nSizeMin = 0;
        chf.nSizeMax = 0;
        chf.lpfnHook = (LPCFHOOKPROC)NULL;
        chf.lpTemplateName = (LPSTR)NULL;
   }

   if (ChooseFont( &chf ) == FALSE ) {
        if (hDC)
            DeleteDC( hDC );
    return FALSE;
   }

   *pClrRef = chf.rgbColors;

   if (hDC)
       DeleteDC( hDC );
   return (TRUE);
}

BOOL bCleanUpRC ( VOID )

Definition at line 856 of file MfEdit.c.

{
    return TRUE;
}

BOOL APIENTRY bDoHitTest | ( | HDC | hDC,
 |  | LPHANDLETABLE | lpHandleTable,
 |  | LPENHMETARECORD | lpEnhMetaRecord,
 |  | UINT | nHandles,
 |  | LPVOID | lpData
 | ) |  |

Definition at line 4861 of file MfEdit.c.

                                                 {
    BOOL            bSuccess;
    char            ach[128];
    char            achTmp[128];
    POINT           PtOrg;
    LONG            lNumDword;
    XFORM           xfSave;
    SIZE            SizeWndEx, SizeViewEx;
    POINT           ptWndOrgin, ptViewOrgin;
    int             i, iMode;
    HRGN            hRgn;
    PPOINT          pPt, pPtTmp;
    static HGDIOBJ  hObjOld=NULL;
    static LONG     lCurX=0;
    static LONG     lCurY=0;
    static BOOL     bXform=FALSE;
    static int      iCnt=0;

    iCnt++;

    //
    // select a wide pen for widen path later on
    //
    hObjOld = SelectObject(hDC, ghpnWide);

    //
    // save the mouse hit position, this was passed in as a POINT structure
    //
    PtOrg.x = (((HTDATA *)lpData)->point).x;
    PtOrg.y = (((HTDATA *)lpData)->point).y;

    //
    // save the number of parameters for the GDI fcn concerned in DWORD.
    // This is the total size of metafile record in question less the
    // size of the GDI function
    //
    lNumDword = (lpEnhMetaRecord->nSize-8) / 4;

    switch (lpEnhMetaRecord->iType) {
    case EMR_SETWINDOWEXTEX:
    case EMR_SETWINDOWORGEX:
    case EMR_SETVIEWPORTEXTEX:
    case EMR_SETVIEWPORTORGEX:
    case EMR_SETMAPMODE:
    case EMR_SCALEVIEWPORTEXTEX:
    case EMR_SCALEWINDOWEXTEX:
    case EMR_SETMETARGN:
    case EMR_SAVEDC:
    case EMR_RESTOREDC:
    case EMR_SETWORLDTRANSFORM:
    case EMR_MODIFYWORLDTRANSFORM: {
        //
        // play all records related to transformation & font
        //
        PlayEnhMetaFileRecord(hDC, lpHandleTable,
                                   lpEnhMetaRecord, nHandles);
        bXform = TRUE;
        return TRUE;
    }
    //
    // convert the following GDI calls to path for hit testing
    //
    case EMR_RECTANGLE: {
        BeginPath(hDC);
        Rectangle(hDC, lpEnhMetaRecord->dParm[0], lpEnhMetaRecord->dParm[1],
                       lpEnhMetaRecord->dParm[2], lpEnhMetaRecord->dParm[3]);
        EndPath(hDC);
        break;
    }
    case EMR_ELLIPSE: {
        BeginPath(hDC);
        Ellipse(hDC, lpEnhMetaRecord->dParm[0], lpEnhMetaRecord->dParm[1],
                     lpEnhMetaRecord->dParm[2], lpEnhMetaRecord->dParm[3]);
        EndPath(hDC);
        break;
    }
    case EMR_MOVETOEX: {
        //
        // Remember our current position
        //
        lCurX = lpEnhMetaRecord->dParm[0];
        lCurY = lpEnhMetaRecord->dParm[1];
        return TRUE;
    }
    case EMR_LINETO: {
        BeginPath(hDC);
        MoveToEx(hDC, lCurX, lCurY, NULL);
        LineTo(hDC, lpEnhMetaRecord->dParm[0], lpEnhMetaRecord->dParm[1]);
        EndPath(hDC);
        break;
    }
    case EMR_POLYBEZIER16: {
        int         j;
        LONG        lSize;
        LONG        lPtCnt;

        lPtCnt = lpEnhMetaRecord->dParm[4];
        lSize = lPtCnt * sizeof(POINTL);

        if ((pPt = (PPOINT) LocalAlloc(LMEM_FIXED, lSize)) == NULL) {
            SetWindowText(ghTextWnd, GetStringRes(IDS_MALLOCFAILNOHIT));
            return TRUE;
        }

        pPtTmp = pPt;

        for (j=0; j < (INT) lPtCnt; j++, pPtTmp++) {
            pPtTmp->x = (LONG)(LOWORD(lpEnhMetaRecord->dParm[j+5]));
            pPtTmp->y = (LONG)(HIWORD(lpEnhMetaRecord->dParm[j+5]));
        }

        BeginPath(hDC);
        PolyBezier(hDC, (LPPOINT)pPt, (DWORD) lPtCnt);
        EndPath(hDC);
        LocalFree(pPt);
        break;
    }
    default:
        _sntprintf((LPSTR) ach, 127, GetStringRes(IDS_FMT_NOHTST), rgMetaName[lpEnhMetaRecord->iType]);
    ach [127] = '\0';
        SetWindowText(ghTextWnd, ach);
        return TRUE;
    }   //switch

    if (bXform) {
        //
        // Set World transform to identity temporarily so that pen width
        // is not affected by world to page transformation
        //
        GetWorldTransform(hDC, &xfSave);
        ModifyWorldTransform(hDC, NULL, MWT_IDENTITY);

        //
        // Set Page transform to identity temporarily so that pen width
        // is not affected by page to device transformation
        //
        iMode = GetMapMode(hDC);

        if ((iMode == MM_ISOTROPIC) || (iMode == MM_ANISOTROPIC)) {
            GetWindowOrgEx(hDC, &ptWndOrgin);
            GetWindowExtEx(hDC, &SizeWndEx);
            GetViewportExtEx(hDC, &SizeViewEx);
            GetViewportOrgEx(hDC, &ptViewOrgin);
        }

        SetMapMode(hDC, MM_TEXT);
    }

    WidenPath(hDC);

    hRgn = PathToRegion(hDC);

    if (hRgn == 0) {
        SetWindowText(ghTextWnd, GetStringRes(IDS_NULLRGNHTSTFAIL));
        DeleteObject(hRgn);
        return TRUE;
    }
    //DPtoLP(hDC, &PtOrg, 1);
    //SetPixel(hDC, PtOrg.x, PtOrg.y, RGB(0, 255, 0));
    //
    // test if mouse hit position is in region
    //
    bSuccess = PtInRegion(hRgn, PtOrg.x, PtOrg.y);
    //Temporily comment this out
    FillRgn(hDC, hRgn, ghbrRed);
    DeleteObject(hRgn);
    //
    // Set transform back.
    //
    if (bXform) {
        SetWorldTransform(hDC, &xfSave);
        SetMapMode(hDC, iMode);

        if ((iMode == MM_ISOTROPIC) || (iMode == MM_ANISOTROPIC)) {
            SetWindowOrgEx(hDC, ptWndOrgin.x, ptWndOrgin.y, NULL);
            SetWindowExtEx(hDC, SizeWndEx.cx, SizeWndEx.cy, NULL);
            SetViewportExtEx(hDC, SizeViewEx.cx, SizeViewEx.cy, NULL);
            SetViewportOrgEx(hDC, ptViewOrgin.x, ptViewOrgin.y, NULL);
        }
    }

    if (bSuccess) {
        Beep(440, 500);
        //
        // Reporting the metafile record number.  Then reset counter.
        //
        SetDlgItemInt(ghwndCtrlPanel, DID_COUNTER, iCnt, FALSE);
        iCnt=0;
        _sntprintf((LPSTR) ach, 127,GetStringRes(IDS_FMT_HIT), rgMetaName[lpEnhMetaRecord->iType]);
    ach [127] = '\0';
        for (i=0; i < lNumDword; i++) {
            _sntprintf((LPSTR) achTmp, 127,"%ld ", lpEnhMetaRecord->dParm[i]);
            ach [127] = '\0'; // make sure null terminated for strlen
            achTmp [127] = '\0';
            if ((strlen(ach)+strlen(achTmp))/sizeof(char) >= 128)
                break;
            strncat(ach, achTmp, sizeof (ach) - strlen (ach));
        }

        SetWindowText(ghTextWnd, ach);
        SelectObject(hDC, hObjOld);
        bXform = FALSE;
        return FALSE;
    }
    SetWindowText(ghTextWnd, GetStringRes(IDS_NOHIT));
    if (iCnt >= ((HTDATA *)lpData)->iRecord)
        iCnt = 0;
    return TRUE;

    UNREFERENCED_PARAMETER(lpHandleTable);
    UNREFERENCED_PARAMETER(nHandles);

}

BOOL bDrawStuff | ( | HDC | hDC,
 |  | INT | OrgX,
 |  | INT | OrgY,
 |  | INT | NextX,
 |  | INT | NextY,
 |  | BOOL | bErase,
 |  | BOOL | bMove,
 |  | BOOL | bCntPt,
 |  | LPSTR | lpstr
 | ) |  |

Definition at line 3540 of file MfEdit.c.

                                      {
    BOOL bSuccess;
    HGDIOBJ hObjOld;
    static POINT rgPts[MAX_POINTS], rgPtsMF[MAX_POINTS_MF], rgPtsBMP[MAX_POINTS_BMP];
    static int   iCnt=0, iCntMF=0, iCntBMP=0;
    static BOOL  bCaretShown=FALSE;

    bSuccess = TRUE;
    if (bCaretShown) {
        HideCaret(ghwndDrawSurf);
        bCaretShown = FALSE;
    }

    switch (gdwCurTool) {
        case DID_PEN:
            if (bErase) {
                MoveToEx(hDC, NextX, NextY, NULL);
            } else {
                //
                // Override the ROP2 st. the pen won't erase its track
                //
                SetROP2(hDC, R2_COPYPEN);
                LineTo(hDC, NextX, NextY);
            }
            break;
        case DID_TEXT: {
            POINT   Pt;
#if 0
        HDC hDCMem;
#endif

            if (lpstr == NULL) {
                ShowCaret(ghwndDrawSurf);
                bCaretShown = TRUE;
                SetCaretPos(NextX, NextY-CARET_HEIGHT);
                MoveToEx(hDC, NextX, NextY, NULL);

#if 0
        StretchDIBits(hDC, 20, 20+120, 64, 64, 0, 64, 64, -64, &dib,
                            (LPBITMAPINFO)&DIBHdr, DIB_PAL_COLORS, SRCCOPY);

        hDCMem = CreateCompatibleDC(hDC);
        SelectPalette(hDCMem, hPal, FALSE);
        RealizePalette(hDCMem);
        SelectObject(hDCMem, hbmp);
        BitBlt(hDC, 0,0,64,64,hDCMem, 0,0,SRCCOPY);
        DeleteDC(hDCMem);
#endif

            SetFocus(ghwndDrawSurf);
            break;
            }

            SetTextAlign(hDC, TA_BASELINE | TA_LEFT | TA_UPDATECP);
            hObjOld = SelectObject(hDC, ghCurFont);
            SetTextColor(hDC, gCrText);

            if ((gbSFOutln || gbPDOutln) && gbTT) {
                // get rid of the char box
                SetBkMode(hDC, TRANSPARENT);
                BeginPath(hDC);
                TextOut(hDC, NextX, NextY, lpstr, IsDBCSLeadByte((BYTE)*lpstr) ? 2 : 1);
                EndPath(hDC);

                if (gbSFOutln) {
                    StrokeAndFillPath(hDC);
                    goto DT_UPDATE;
                }

                //
                // Get path and polydraw
                //
                {
                int     iNumPt;
                PBYTE   pjTypes;
                PPOINT  pPts;

                if (iNumPt = GetPath(hDC, NULL, NULL, 0)) {
                    if ((pPts = (PPOINT)GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT,
                                                sizeof(POINT)*iNumPt )) == NULL) {
                        MessageBox(ghwndMain, GetStringRes(IDS_CREPNTFAIL),
                            GetStringRes(IDS_ERROR), MB_OK);
                        break;
                    }

                    if ((pjTypes = (PBYTE)GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT,
                                                sizeof(BYTE)*iNumPt )) == NULL) {
                        MessageBox(ghwndMain, GetStringRes(IDS_CREPBYTEFAIL),
                            GetStringRes(IDS_ERROR), MB_OK);
                        goto GP_EXIT1;
                    }

                    GetPath(hDC, pPts, pjTypes, iNumPt);
                }
                PolyDraw95(hDC, pPts, pjTypes, iNumPt);
                GlobalFree(pjTypes);

GP_EXIT1:
                GlobalFree(pPts);

                }

            } else {
                TextOut(hDC, NextX, NextY, lpstr, IsDBCSLeadByte((BYTE)*lpstr) ? 2 : 1);
            }
DT_UPDATE:
            //
            // Updating current position
            //
            {
            LONG    lHeight;
            LONG    lWidth;
            TEXTMETRIC     tm;

                if (GetTextMetrics(hDC, &tm)) {
                    lHeight = tm.tmHeight;
                    lWidth  = tm.tmMaxCharWidth;
                }

                GetCurrentPositionEx(hDC, (LPPOINT) &Pt);
                SetCaretPos(Pt.x, Pt.y-CARET_HEIGHT);

            }
            ShowCaret(ghwndDrawSurf);
            bCaretShown = TRUE;

            break;

#if 0

#define PT_LINECLOSE     (PT_LINETO | PT_CLOSEFIGURE)
#define PT_BEZIERCLOSE (PT_BEZIERTO | PT_CLOSEFIGURE)

            hpnRed = CreatePen(PS_SOLID, 0, RGB(255,0,0));
            SelectObject(hDC, hpnRed);

            while (iNumPt--) {
                static POINT pPnt[3];
                static int   iCnt=0;

                switch (*pjTypes++) {
                    case PT_MOVETO: {
                        MoveToEx(hDC, pPts->x, pPts->y, NULL);
                        pPts++;
                        break;
                    }
                    case PT_LINETO: {
                        LineTo(hDC, pPts->x, pPts->y);
                        pPts++;
                        break;

                    }
                    case PT_LINECLOSE: {
                        LineTo(hDC, pPts->x, pPts->y);
                        pPts++;
                        goto GP_EXIT2;
                    }
                    case PT_BEZIERTO: {
                        pPnt[iCnt].x = pPts->x;
                        pPnt[iCnt].y = pPts->y;
                        pPts++;

                        if (iCnt < 2) {
                            iCnt++;
                        } else {
                            PolyBezierTo(hDC, pPnt, 3);
                            iCnt = 0;
                        }
                        break;
                    }
                    case PT_BEZIERCLOSE: {
                        pPnt[iCnt].x = pPts->x;
                        pPnt[iCnt].y = pPts->y;
                        pPts++;

                        if (iCnt < 2) {
                            iCnt++;
                        } else {
                            PolyBezierTo(hDC, pPnt, 3);
                            iCnt = 0;
                        }
                        goto GP_EXIT2;
                    }

                    default:
                        break;
                }

            }

#endif
        }
        case DID_RECT:
            hObjOld = SelectObject(hDC, GetStockObject(NULL_BRUSH));
            Rectangle(hDC, OrgX, OrgY, NextX, NextY);
            SelectObject(hDC, hObjOld);
            break;
        case DID_FILLRECT:
            Rectangle(hDC, OrgX, OrgY, NextX, NextY);
            break;
        case DID_ELLIPSE:
            hObjOld = SelectObject(hDC, GetStockObject(NULL_BRUSH));
            Ellipse(hDC, OrgX, OrgY, NextX, NextY);
            SelectObject(hDC, hObjOld);
            break;
        case DID_FILLELLIPSE:
            Ellipse(hDC, OrgX, OrgY, NextX, NextY);
            break;
        case DID_LINE:
            MoveToEx(hDC, OrgX, OrgY, NULL);
            LineTo(hDC, NextX, NextY);
            break;
        case DID_BEZIER:
            if (bErase || bMove)
                return bSuccess;

            if (bCntPt) {
                rgPts[iCnt].x = NextX;
                rgPts[iCnt].y = NextY;
                iCnt++;

                if (iCnt == MAX_POINTS - 1)
                    iCnt = 0;
            }

            if ((iCnt % 3) == 1) {              // (iCnt + 1) % 3 == 1
                //
                // Override the ROP2 st. the pen won't erase its track
                //
                SetROP2(hDC, R2_COPYPEN);
                PolyBezier(hDC, (LPPOINT)&rgPts, (DWORD) iCnt);
            }
            return bSuccess;

        case DID_BMPOBJ: {
            static BOOL          bBltReady = FALSE;

            if (bErase || bMove)
                return bSuccess;

            if (ghBmp == NULL) {
                SetWindowText(ghTextWnd, GetStringRes(IDS_NOBMFOREMBED));
                return bSuccess;
            }

            if (bCntPt) {
                bBltReady = FALSE;
                rgPtsBMP[iCntBMP].x = NextX;
                rgPtsBMP[iCntBMP].y = NextY;
                iCntBMP++;

                if (iCntBMP < MAX_POINTS_BMP) {
                    return bSuccess;
                }
            } else {
                //
                // Caller don't want to increment counter, so must be doing
                // recording, so we just Blt again...
                //
                // But, if the Blt data is no good, bail out...
                //
                if (!bBltReady) {
                    return bSuccess;
                }
                bPlgBlt(hDC, rgPtsBMP);
                return bSuccess;
            }
            bBltReady = TRUE;

            bPlgBlt(hDC, rgPtsBMP);
            iCntBMP = 0;                         // reset
            return bSuccess;
        }

        case DID_METAF: {
            ENHMETAHEADER EnhMetaHdr;
            RECT          rcClientDS;
            static XFORM         xform;
            static BOOL          bXformReady = FALSE;
            int           iEntries;
            PLOGPALETTE     plogPal;
            PBYTE           pjTmp;
            HPALETTE        hPal;
            static BOOL     bRCSet = FALSE;

            if (bErase || bMove)
                return bSuccess;

            if (ghMetaf == NULL) {
                SetWindowText(ghTextWnd, GetStringRes(IDS_NOMFFOREMBED));
                return bSuccess;
            }

            if (bCntPt) {
                bXformReady = FALSE;
                rgPtsMF[iCntMF].x = NextX;
                rgPtsMF[iCntMF].y = NextY;
                iCntMF++;

                if (iCntMF < MAX_POINTS_MF) {
                    return bSuccess;
                }
            } else {
                //
                // Caller don't want to increment counter, so must be doing
                // recording, so we just set xform and play it again...
                //
                // But, if the xform data is no good, bail out...
                //
                if (!bXformReady) {
                    return bSuccess;
                }

                GetEnhMetaFileHeader(ghMetaf, sizeof(ENHMETAHEADER), &EnhMetaHdr);
                SetWorldTransform(hDC, &xform);
                GetClientRect(ghwndDrawSurf, &rcClientDS);

                iEntries = GetEnhMetaFilePaletteEntries(ghMetaf, 0, NULL);

                if (iEntries) {
                    if ((plogPal = (PLOGPALETTE)GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT,
                            sizeof(DWORD) + sizeof(PALETTEENTRY)*iEntries )) == NULL) {
                        MessageBox(ghwndMain, GetStringRes(IDS_CREPALFAIL),
                            GetStringRes(IDS_ERROR), MB_OK);
                    }

                    plogPal->palVersion = 0x300;
                    plogPal->palNumEntries = (WORD) iEntries;
                    pjTmp = (PBYTE) plogPal;
                    pjTmp += 4;

                    GetEnhMetaFilePaletteEntries(ghMetaf, iEntries, (PPALETTEENTRY)pjTmp);
                    hPal = CreatePalette(plogPal);
                    GlobalFree(plogPal);

                    SelectPalette(hDC, hPal, FALSE);
                    RealizePalette(hDC);
                }

                bRCSet = bSetRC2MatchEmfRC(hDC, EnhMetaHdr, ghMetaf, NULL);
                if (!bRCSet) {
                    vErrOut("DID_METAF failed");
                }

                //PlayEnhMetaFile(hDC, ghMetaf, (LPRECT) &rcClientDS);
                {
                RECT rc;

                rc.top = rc.left = 0;
                rc.right = EnhMetaHdr.rclBounds.right - EnhMetaHdr.rclBounds.left;
                rc.bottom = EnhMetaHdr.rclBounds.bottom - EnhMetaHdr.rclBounds.top;
                if (!PlayEnhMetaFile(hDC, ghMetaf, (LPRECT) &rc)) {
                    char    text[128];

                    _sntprintf(text, 127, GetStringRes(IDS_FMT_PLAYEMFFAIL), GetLastError());
                    text [127] = '\0';
          OutputDebugString(text);
                } else {
                    if (gbDB)
                       SwapBuffers(hDC);
                }

                }
                ModifyWorldTransform(hDC, NULL, MWT_IDENTITY);

                if (bRCSet) {
                    bCleanUpRC();
                    bRCSet = FALSE;
                }

                return bSuccess;
            }

            GetEnhMetaFileHeader(ghMetaf, sizeof(ENHMETAHEADER), &EnhMetaHdr);
            //
            // Based on the three points, top-left, top-right and bottom-left
            // (in this order), of the destination, solve equations for the
            // elements of the transformation matrix.
            //
            xform.eDx = (float) rgPtsMF[0].x;
            xform.eDy = (float) rgPtsMF[0].y;
            xform.eM11 = (rgPtsMF[1].x - xform.eDx)/(EnhMetaHdr.rclBounds.right - EnhMetaHdr.rclBounds.left);
            xform.eM12 = (rgPtsMF[1].y - xform.eDy)/(EnhMetaHdr.rclBounds.right - EnhMetaHdr.rclBounds.left);
            xform.eM21 = (rgPtsMF[2].x - xform.eDx)/(EnhMetaHdr.rclBounds.bottom - EnhMetaHdr.rclBounds.top);
            xform.eM22 = (rgPtsMF[2].y - xform.eDy)/(EnhMetaHdr.rclBounds.bottom - EnhMetaHdr.rclBounds.top);

            bXformReady = TRUE;
            SetWorldTransform(hDC, &xform);
            GetClientRect(ghwndDrawSurf, &rcClientDS);

            iEntries = GetEnhMetaFilePaletteEntries(ghMetaf, 0, NULL);

            if (iEntries) {
                if ((plogPal = (PLOGPALETTE)GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT,
                        sizeof(DWORD) + sizeof(PALETTEENTRY)*iEntries )) == NULL) {
                    MessageBox(ghwndMain, GetStringRes(IDS_CREPALFAIL),
                        GetStringRes(IDS_ERROR), MB_OK);
                }

                plogPal->palVersion = 0x300;
                plogPal->palNumEntries = (WORD) iEntries;
                pjTmp = (PBYTE) plogPal;
                pjTmp += 4;

                GetEnhMetaFilePaletteEntries(ghMetaf, iEntries, (PPALETTEENTRY)pjTmp);
                hPal = CreatePalette(plogPal);
                GlobalFree(plogPal);

                SelectPalette(hDC, hPal, FALSE);
                RealizePalette(hDC);
            }

            if (!bRCSet) {
                bRCSet = bSetRC2MatchEmfRC(hDC, EnhMetaHdr, ghMetaf, NULL);
                if (!bRCSet) {
                    vErrOut("DID_METAF failed");
                }
            }

            //PlayEnhMetaFile(hDC, ghMetaf, (LPRECT) &rcClientDS);
            {
            RECT rc;

            rc.top = rc.left = 0;
            rc.right = EnhMetaHdr.rclBounds.right - EnhMetaHdr.rclBounds.left;
            rc.bottom = EnhMetaHdr.rclBounds.bottom - EnhMetaHdr.rclBounds.top;
            if (!PlayEnhMetaFile(hDC, ghMetaf, (LPRECT) &rc)) {
                 char    text[128];

                 _sntprintf(text, 127,GetStringRes(IDS_FMT_PLAYEMFFAIL), GetLastError());
                 text [127] = '\0';
         OutputDebugString(text);
            } else {
                if (gbDB)
                   SwapBuffers(hDC);
            }

            }
            ModifyWorldTransform(hDC, NULL, MWT_IDENTITY);
            iCntMF = 0;                         // reset
            if (bRCSet) {
                bCleanUpRC();
                bRCSet = FALSE;
            }
            return bSuccess;
        }
        default:
            break;
    }
    //
    // Reset counter, user has selected other tools.
    //
    iCnt = 0;
    iCntMF = 0;
    iCntBMP = 0;
    return bSuccess;
}

BOOL bFreeDibFile ( PDIBDATA pDibData )

Definition at line 4706 of file MfEdit.c.

{
    ULONG               ulFiles;
    ULONG               ulFrames;
    ULONG               i;
    PFILEINFO           pFileInfo;

    ulFiles = pDibData->ulFiles;
    ulFrames = pDibData->ulFrames;

    for (i = 0; i < ulFrames; i++) {
        LocalFree(pDibData->rgpjFrame[i]);
        LocalFree(pDibData->rgpbmi[i]);
    }

    for (i = 0; i < ulFiles; i++) {
        pFileInfo = &(pDibData->rgFileInfo[i]);
        CloseHandle(pFileInfo->hFile);
        CloseHandle(pFileInfo->hMapFile);
        UnmapViewOfFile(pFileInfo->lpvMapView);
    }

    pDibData->ulFiles = 0;
    pDibData->ulFrames = 0;
    return TRUE;
}

BOOL bGetBMP | ( | HWND | hwnd,
 |  | BOOL | bMask
 | ) |  |

Definition at line 4747 of file MfEdit.c.

                                    {
    OPENFILENAME    ofn;
    char            szFile[MAX_ARRAYSIZE], szFileTitle[MAX_ARRAYSIZE];
    static char     *szFilter;
    BOOL            bSuccess;
    HDC             hDC;

    bSuccess = FALSE;

    BuildFilterStrs(-1);
    BuildFilterStrs(IDS_FT_DIB);
    szFilter = BuildFilterStrs(IDS_FT_RLE);

    strncpy( szFile, "*.bmp\0", MAX_ARRAYSIZE - 1);
  szFile [MAX_ARRAYSIZE - 1] = '\0';
    ofn.lStructSize = sizeof(OPENFILENAME);
    ofn.hwndOwner = hwnd;
    ofn.lpstrFilter = szFilter;
    ofn.lpstrCustomFilter = (LPSTR) NULL;
    ofn.nMaxCustFilter = 0L;
    ofn.nFilterIndex = 1;
    ofn.lpstrFile = szFile;
    ofn.nMaxFile = sizeof(szFile);
    ofn.lpstrFileTitle = szFileTitle;
    ofn.nMaxFileTitle = sizeof(szFileTitle);
    ofn.lpstrInitialDir = NULL;
    ofn.lpstrTitle = (bMask ? GetStringRes(IDS_LDMSK) : "Load Bitmap");
    ofn.Flags = 0L;
    ofn.nFileOffset = 0;
    ofn.nFileExtension = 0;
    ofn.lpstrDefExt = "BMP";

    if (!GetOpenFileName(&ofn))
        return 0L;

    hDC = GetDC(ghwndDrawSurf);
    if (bMask) {
        ghBmpMask = hBmpLoadBitmapFile(hDC, szFile);
        if (ghBmpMask != NULL)
            bSuccess = TRUE;
    } else {
        ghBmp = hBmpLoadBitmapFile(hDC, szFile);
        if (ghBmp != NULL)
            bSuccess = TRUE;
    }
    ReleaseDC(ghwndDrawSurf, hDC);

    return bSuccess;
}

BOOL bGetEPSBounds | ( | LPVOID | lpData,
 |  | RECTL * | prctl
 | ) |  |

Definition at line 5887 of file MfEdit.c.

{
    char szKeyWord[128], szValue[128];
    int  index;

    if (lpData == NULL) {
#if MYDBG
        MessageBox(GetFocus(), GetStringRes(IDS_NULLPTR),
            GetStringRes(IDS_ERROR), MB_OK);
#endif
        return FALSE;
    }

    index = 0;

    if (!bGetWord(lpData, szKeyWord, &index))
        return FALSE;

    if (!bIsAdobe(szKeyWord)) {
        MessageBox(GetFocus(), GetStringRes(IDS_NOTADOBE),
            GetStringRes(IDS_ERROR), MB_OK);
        return FALSE;
    }

    if (!bGetWord(lpData, szValue, &index))
        return FALSE;

    if (!bIsEPS(szValue)) {
        MessageBox(GetFocus(), "Not EPS!",
            GetStringRes(IDS_ERROR), MB_OK);
        return FALSE;
    }

    if (!bGoNextLine(lpData, &index))
        return FALSE;

    while ((bGetWord(lpData, szKeyWord, &index)) &&
           (!bIsBndBox(szKeyWord))) {
#if MYDBG
        MessageBox(GetFocus(), GetStringRes(IDS_SKPTOEOL),
            GetStringRes(IDS_ERROR), MB_OK);
#endif
        if (!bGoNextLine(lpData, &index)) {
            MessageBox(GetFocus(), GetStringRes(IDS_MUSTNOTEOF),
                GetStringRes(IDS_ERROR), MB_OK);
            return FALSE;
        }
    }

    if (bIsBndBox(szKeyWord)) {
        if (bGetWord(lpData, szValue, &index))
            prctl->left    = atol(szValue);
        else {
            MessageBox(GetFocus(), GetStringRes(IDS_GETBNDLFTFAIL),
                GetStringRes(IDS_ERROR), MB_OK);
            return FALSE;
        }

        if (bGetWord(lpData, szValue, &index))
            prctl->top     = atol(szValue);
        else {
            MessageBox(GetFocus(), GetStringRes(IDS_GETBNDTOPFAIL),
                GetStringRes(IDS_ERROR), MB_OK);
            return FALSE;
        }

        if (bGetWord(lpData, szValue, &index))
            prctl->right   = atol(szValue);
        else {
            MessageBox(GetFocus(), GetStringRes(IDS_GETBNDRGTFAIL),
                GetStringRes(IDS_ERROR), MB_OK);
            return FALSE;
        }

        if (bGetWord(lpData, szValue, &index))
            prctl->bottom  = atol(szValue);
        else {
            MessageBox(GetFocus(), GetStringRes(IDS_GETBNDBOTFAIL),
                GetStringRes(IDS_ERROR), MB_OK);
            return FALSE;
        }
    }

    return TRUE;

}

BOOL bGetWord | ( | LPVOID | lpData,
 |  | char * | str,
 |  | int * | pi
 | ) |  |

Definition at line 5976 of file MfEdit.c.

{
    char *pstr;

    pstr = str;

    while (((char *)lpData)[*pi] == ' ')
        (*pi)++;

    while ((((char *)lpData)[*pi] != ' ') &&
           (((char *)lpData)[*pi] != '\n') &&
           (((char *)lpData)[*pi] != '\r')) {
        *str++ = ((char *)lpData)[(*pi)++];
    }
    *str++ = '\0';

#if MYDBG
    {
    char text[128];

    _sntprintf(text,127, "bGetWord gets %s", pstr);
    text [127] = '\0';
  MessageBox(GetFocus(), text, "Info", MB_OK);
    }
#endif

    return TRUE;
}

BOOL bGoNextLine | ( | LPVOID | lpData,
 |  | int * | pi
 | ) |  |

Definition at line 6006 of file MfEdit.c.

{
    char tmp[128];
    int  q;

    while ((((char *)lpData)[*pi] != '\n') &&
           (((char *)lpData)[*pi] != '\r'))
        (*pi)++;

    //
    // skip them
    //
    *pi += 2;

    q = *pi;

    if ((bGetWord(lpData, tmp, &q)) && (bIsEOF(tmp)) )
        return FALSE;

    return TRUE;
}

BOOL bHitTest | ( | HDC | hDC,
 |  | INT | x,
 |  | INT | y
 | ) |  |

Definition at line 4809 of file MfEdit.c.

                                     {
    BOOL          bSuccess;
    ENHMETAHEADER EnhMetaHdr;
    RECT          rcClientDS;
    HTDATA        htData;
    static        HCURSOR hCurHT, hCurWait;

    bSuccess = TRUE;

    if (ghMetaf == 0)
        return 0L;

    hCurHT = LoadCursor(NULL, IDC_CROSS);
    hCurWait = LoadCursor(NULL, IDC_WAIT);

    GetEnhMetaFileHeader(ghMetaf, sizeof(EnhMetaHdr), &EnhMetaHdr);

    htData.point.x = x;
    htData.point.y = y;
    htData.iRecord = EnhMetaHdr.nRecords;

    SetCursor(hCurWait);
    if (gbFit2Wnd) {
        GetClientRect(ghwndDrawSurf, &rcClientDS);
        EnumEnhMetaFile(hDC, ghMetaf, (ENHMFENUMPROC)bDoHitTest, (LPVOID) &htData, (LPRECT)&rcClientDS);
    } else {
        RECT rc;

        rc.top = rc.left = 0;
        rc.right = EnhMetaHdr.rclBounds.right - EnhMetaHdr.rclBounds.left;
        rc.bottom = EnhMetaHdr.rclBounds.bottom - EnhMetaHdr.rclBounds.top;
        EnumEnhMetaFile(hDC, ghMetaf, (ENHMFENUMPROC)bDoHitTest, (LPVOID) &htData, (LPRECT)&rc);
    }
    SetCursor(hCurHT);

    return bSuccess;
}

BOOL bIsAdobe ( char * szStr )

Definition at line 5853 of file MfEdit.c.

{
    if (strcmp(szStr, "%!PS-Adobe-3.0") == 0)
        return TRUE;
    else
        return FALSE;
}

BOOL bIsBndBox ( char * szStr )

Definition at line 5870 of file MfEdit.c.

{
    if (strcmp(szStr, "%%BoundingBox:") == 0)
        return TRUE;
    else
        return FALSE;
}

BOOL bIsEOF ( char * szStr )

Definition at line 5878 of file MfEdit.c.

{
    if (strcmp(szStr, "%%EOF") == 0)
        return TRUE;
    else
        return FALSE;
}

BOOL bIsEPS ( char * szStr )

Definition at line 5861 of file MfEdit.c.

{
    if ((strcmp(szStr, "EPSF-3.0") == 0) ||
        (strcmp(szStr, "EPSF-2.0") == 0))
        return TRUE;
    else
        return FALSE;
}

BOOL APIENTRY bPlayRecord | ( | HDC | hDC,
 |  | LPHANDLETABLE | lpHandleTable,
 |  | LPENHMETARECORD | lpEnhMetaRecord,
 |  | UINT | nHandles,
 |  | LPVOID | lpData
 | ) |  |

Definition at line 4382 of file MfEdit.c.

                                                  {
    BOOL bSuccess;
    static int  iCnt=0;
    int         i;
    char        ach[128];
    char        achTmp[128];
    LONG        lNumDword;

    bSuccess = TRUE;

    lNumDword = (lpEnhMetaRecord->nSize-8) / 4;

    iCnt++;
    if (((PLAYINFO *) lpData)->bPlayContinuous) {
        bSuccess = PlayEnhMetaFileRecord(hDC, lpHandleTable,
                                             lpEnhMetaRecord, nHandles);
        if (iCnt == ((PLAYINFO *) lpData)->iRecord) {
            strncpy( (LPSTR) ach, rgMetaName[lpEnhMetaRecord->iType].szGDIName, 127 );
      ach [127] = '\0';
            for (i=0; i < lNumDword; i++) {
                _sntprintf((LPSTR) achTmp,127, "%ld ", lpEnhMetaRecord->dParm[i]);
                ach [127] = '\0'; // make sure null terminated for strlen
                achTmp [127] = '\0';
                if ((strlen(ach)+strlen(achTmp))/sizeof(char) >= 128)
                    break;
                strncat(ach, achTmp, sizeof (ach) - strlen (ach));
            }
        SetWindowText(ghTextWnd, ach);
        }
    } else {

        switch (lpEnhMetaRecord->iType) {
            case EMR_SETWINDOWEXTEX:
            case EMR_SETWINDOWORGEX:
            case EMR_SETVIEWPORTEXTEX:
            case EMR_SETVIEWPORTORGEX:
            case EMR_SETBRUSHORGEX:
            case EMR_SETMAPMODE:
            case EMR_SETBKMODE:
            case EMR_SETPOLYFILLMODE:
            case EMR_SETROP2:
            case EMR_SETSTRETCHBLTMODE:
            case EMR_SETTEXTALIGN:
            case EMR_SETTEXTCOLOR:
            case EMR_SETBKCOLOR:
            case EMR_OFFSETCLIPRGN:
            case EMR_MOVETOEX:
            case EMR_SETMETARGN:
            case EMR_EXCLUDECLIPRECT:
            case EMR_INTERSECTCLIPRECT:
            case EMR_SCALEVIEWPORTEXTEX:
            case EMR_SCALEWINDOWEXTEX:
            case EMR_SAVEDC:
            case EMR_RESTOREDC:
            case EMR_SETWORLDTRANSFORM:
            case EMR_MODIFYWORLDTRANSFORM:
            case EMR_SELECTOBJECT:
            case EMR_CREATEPEN:
            case EMR_CREATEBRUSHINDIRECT:
            case EMR_DELETEOBJECT:
            case EMR_SELECTPALETTE:
            case EMR_CREATEPALETTE:
            case EMR_SETPALETTEENTRIES:
            case EMR_RESIZEPALETTE:
            case EMR_REALIZEPALETTE:
            case EMR_SETARCDIRECTION:
            case EMR_SETMITERLIMIT:
            case EMR_BEGINPATH:
            case EMR_ENDPATH:
            case EMR_CLOSEFIGURE:
            case EMR_SELECTCLIPPATH:
            case EMR_ABORTPATH:
            case EMR_EXTCREATEFONTINDIRECTW:
            case EMR_CREATEMONOBRUSH:
            case EMR_CREATEDIBPATTERNBRUSHPT:
            case EMR_EXTCREATEPEN:
                goto PlayRec;
            default:
                break;
        } //switch

        if (iCnt == ((PLAYINFO *) lpData)->iRecord) {
PlayRec:
            bSuccess = PlayEnhMetaFileRecord(hDC, lpHandleTable,
                                             lpEnhMetaRecord, nHandles);
            strncpy((LPSTR) ach, rgMetaName[lpEnhMetaRecord->iType].szGDIName, 127);
      ach [127] = '\0';
            for (i=0; i < lNumDword; i++) {
                _sntprintf((LPSTR) achTmp, 127, "%ld ", lpEnhMetaRecord->dParm[i]);
                ach [127] = '\0'; // make sure null terminated for strlen
                achTmp [127] = '\0';
                if ((strlen(ach)+strlen(achTmp))/sizeof(char) >= 128)
                    break;
                strncat(ach, achTmp, sizeof (ach) - strlen (ach));
            }
            SetWindowText(ghTextWnd, ach);
        }
    }

    if (iCnt == ((PLAYINFO *) lpData)->iRecord) {
        iCnt = 0;

        if (gbDB)
            SwapBuffers(hDC);

        return FALSE;
    }
    return bSuccess;
}

BOOL bPlgBlt | ( | HDC | hDC,
 |  | LPPOINT | rgPtsBMP
 | ) |  |

Definition at line 5472 of file MfEdit.c.

{
    HDC                  hDCRef;
    HDC                  hDCSrn;                // hDC can be metaf DC
    HGDIOBJ              hObjOld, hBmpMem=NULL;
    BITMAP               bm;
    INT                  iBpp;
    WORD                 wBitCnt;

    hDCSrn = GetDC(ghwndDrawSurf);
    hDCRef = CreateCompatibleDC(hDC);

    if (gbUseDIB) {
        int         cx, cy, dx, dy;
        PBITMAPINFO pbmi;

        pbmi = (gDib.rgpbmi[0]);
        dx = rgPtsBMP[0].x - rgPtsBMP[1].x;
        dy = rgPtsBMP[0].y - rgPtsBMP[1].y;
        cx = (INT) sqrt( dx * dx + dy * dy );

        dx = rgPtsBMP[0].x - rgPtsBMP[2].x;
        dy = rgPtsBMP[0].y - rgPtsBMP[2].y;
        cy = (INT) sqrt( dx * dx + dy * dy );

        iBpp = GetDeviceCaps(hDC, BITSPIXEL);

        if (gDib.rgbCoreHdr[0]) {
            wBitCnt = ((LPBITMAPCOREINFO)pbmi)->bmciHeader.bcBitCount;
        } else {
            wBitCnt = pbmi->bmiHeader.biBitCount;
        }

        if (iBpp < wBitCnt) {   // Do Halftone
            SetStretchBltMode(hDCRef, HALFTONE);
            if (ghHT) {
                SelectPalette(hDCRef, ghHT, FALSE);
                SelectPalette(hDC, ghHT, FALSE);
                SelectPalette(hDCSrn, ghHT, FALSE); // hDC can be metaf DC
                RealizePalette(hDCSrn);             // always realize the srn DC

                // Don't have to realize the palette in hDCRef
                // RealizePalette(hDCRef);

                // has to be compatible with screen DC, cannot be hDCRef
                // memory DC has no bitmap by default?
                // hDC may be a metafile DC, so use hDCSrn
                hBmpMem = CreateCompatibleBitmap(hDCSrn, cx, cy);
                SelectObject(hDCRef, hBmpMem);
            } else {
                MessageBox(ghwndMain, GetStringRes(IDS_HFTONEPALNULL),
                    GetStringRes(IDS_ERROR), MB_OK);
            }
        } else {
            SetStretchBltMode(hDCRef, COLORONCOLOR);
            if (ghPal) {
                if (ghDCMetaf == hDC)
                    CopyPalette(ghPal);
                SelectPalette(hDCRef, ghPal, FALSE);
                SelectPalette(hDC, ghPal, FALSE);
                SelectPalette(hDCSrn, ghPal, FALSE); // hDC can be metaf DC
                RealizePalette(hDCSrn);             // always realize the srn DC

                // Don't have to realize the palette in hDCRef
                // RealizePalette(hDCRef);

                // has to be compatible with screen DC, cannot be hDCRef
                // memory DC has no bitmap by default?
                // hDC may be a metafile DC, so use hDCSrn
                hBmpMem = CreateCompatibleBitmap(hDCSrn, cx, cy);
                SelectObject(hDCRef, hBmpMem);
            } else {
                MessageBox(ghwndMain, GetStringRes(IDS_PALNULL),
                    GetStringRes(IDS_ERROR), MB_OK);
            }
        }

        if (gDib.rgbCoreHdr[0]) {
            StretchDIBits(hDCRef, 0,0, cx, cy,
                          0,0, ((LPBITMAPCOREINFO)pbmi)->bmciHeader.bcWidth, ((LPBITMAPCOREINFO)pbmi)->bmciHeader.bcHeight,
                          gDib.rgpjFrame[0], pbmi, DIB_RGB_COLORS, SRCCOPY);
        } else {
            StretchDIBits(hDCRef, 0,0, cx, cy,
                          0,0, pbmi->bmiHeader.biWidth, pbmi->bmiHeader.biHeight,
                          gDib.rgpjFrame[0], pbmi, DIB_RGB_COLORS, SRCCOPY);
        }

        PlgBlt(hDC, rgPtsBMP, hDCRef, 0, 0, cx, cy,
               ghBmpMask, 0, 0);

        if (hBmpMem)
            DeleteObject(hBmpMem);

    } else {
        hObjOld = SelectObject(hDCRef, ghBmp);

        GetObject(ghBmpMask, sizeof(BITMAP), (LPSTR)&bm);
        if (bm.bmBitsPixel != 1) {
            SetWindowText(ghTextWnd, GetStringRes(IDS_MUSTMSKMCHROMEBM));
            ghBmpMask = NULL;
        }

        GetObject(ghBmp, sizeof(BITMAP), (LPSTR)&bm);

        if (ghPal) {
            SelectPalette(hDC, ghPal, FALSE);
            RealizePalette(hDC);
            SetStretchBltMode(hDC, COLORONCOLOR);
        }
        PlgBlt(hDC, rgPtsBMP, hDCRef, 0, 0, bm.bmWidth, bm.bmHeight,
               ghBmpMask, 0, 0);

        SelectObject(hDCRef, hObjOld);
    }

    DeleteDC(hDCRef);
    ReleaseDC(ghwndDrawSurf, hDCSrn);
    return TRUE;

}

BOOL bPrintMf ( PPRTDATA pPD )

Definition at line 5237 of file MfEdit.c.

                            {
    DOCINFO         DocInfo;
    HDC             hDCPrinter;
    ENHMETAHEADER   EnhMetaHdr;
    HENHMETAFILE    hEnhMf;
    TCHAR           buf[128];
    PRINTDLG        pd;
    BOOL            bSuccess;
    int             iEntries;
    PLOGPALETTE     plogPal;
    PBYTE           pjTmp;
    HPALETTE        hPal;
    BOOL            bRCSet = FALSE;

    bSuccess = TRUE;

    if (pPD->hMetaf == 0) {
        SetWindowText(ghTextWnd, GetStringRes(IDS_NOMFTOPRT));
        goto PMF_EXIT;
        bSuccess = FALSE;
    }

    hEnhMf = CopyEnhMetaFile(pPD->hMetaf, NULL);
    memset(&pd, 0, sizeof(PRINTDLG));
    pd.lStructSize = sizeof(PRINTDLG);
    pd.hwndOwner   = ghwndMain;
    pd.Flags       = PD_RETURNDC;
    pd.hInstance   = ghModule;

    if (!PrintDlg(&pd)) {
        SetWindowText(ghTextWnd, GetStringRes(IDS_ESCPRT));
        goto PMF_EXIT;
        bSuccess = FALSE;
    }

    if (pd.hDC == NULL) {
        SetWindowText(ghTextWnd, GetStringRes(IDS_CREPRTDCFAIL));
        goto PMF_EXIT;
        bSuccess = FALSE;
    }

    hDCPrinter = pd.hDC;
    if (GetEnhMetaFileDescription(hEnhMf, 128, (LPTSTR)buf) == 0) {
        strncpy(buf, "No Title", 127);
    buf [127] = '\0';
    }

    memset(&DocInfo, 0, sizeof(DOCINFO));
    DocInfo.cbSize      = sizeof(DOCINFO);
    DocInfo.lpszDocName = (LPTSTR) buf;
    DocInfo.lpszOutput  = NULL;
    StartDoc(hDCPrinter, &DocInfo);
    StartPage(hDCPrinter);

    SetWindowText(ghTextWnd, GetStringRes(IDS_PRT));

    iEntries = GetEnhMetaFilePaletteEntries(hEnhMf, 0, NULL);

    if (iEntries) {
        if ((plogPal = (PLOGPALETTE)GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT,
                sizeof(DWORD) + sizeof(PALETTEENTRY)*iEntries )) == NULL) {
            MessageBox(ghwndMain, GetStringRes(IDS_CREPALFAIL),
                GetStringRes(IDS_ERROR), MB_OK);
        }

        plogPal->palVersion = 0x300;
        plogPal->palNumEntries = (WORD) iEntries;
        pjTmp = (PBYTE) plogPal;
        pjTmp += 4;

        GetEnhMetaFilePaletteEntries(hEnhMf, iEntries, (PPALETTEENTRY)pjTmp);
        hPal = CreatePalette(plogPal);
        GlobalFree(plogPal);

        SelectPalette(hDCPrinter, hPal, FALSE);
        RealizePalette(hDCPrinter);
    }

    GetEnhMetaFileHeader(hEnhMf, sizeof(ENHMETAHEADER), &EnhMetaHdr);

    bRCSet = bSetRC2MatchEmfRC(hDCPrinter, EnhMetaHdr, hEnhMf, NULL);
    if (!bRCSet) {
        vErrOut("bPrintMF: failed");
    }

    if (pPD->bFit2Wnd) {
        int     iWidth, iHeight;
        RECT    rc;

        iWidth = GetDeviceCaps(hDCPrinter, HORZRES);
        iHeight = GetDeviceCaps(hDCPrinter, VERTRES);
        rc.left = rc.top = 0;
        rc.right = iWidth;
        rc.bottom = iHeight;
        bSuccess = PlayEnhMetaFile(hDCPrinter, hEnhMf, (LPRECT) &rc);
        if (!bSuccess) {
            char    text[128];

            _sntprintf(text, 127,GetStringRes(IDS_FMT_PLAYEMFFAIL), GetLastError());
      text [127] = '\0';
            OutputDebugString(text);
        }

    } else {
        RECT rc;

        rc.top = rc.left = 0;
        rc.right = EnhMetaHdr.rclBounds.right - EnhMetaHdr.rclBounds.left;
        rc.bottom = EnhMetaHdr.rclBounds.bottom - EnhMetaHdr.rclBounds.top;
        bSuccess = PlayEnhMetaFile(hDCPrinter, hEnhMf, (LPRECT) &rc);
        if (!bSuccess) {
            char    text[128];

            _sntprintf(text, 127, GetStringRes(IDS_FMT_PLAYEMFFAIL), GetLastError());
            text [127] = '\0';
      OutputDebugString(text);
        }
    }

//    if (gbDB && bSuccess)
//       SwapBuffers(hDCPrinter);

    EndPage(hDCPrinter);
    EndDoc(hDCPrinter);
    SetWindowText(ghTextWnd, GetStringRes(IDS_PRTTHRDDONE));

    if (bRCSet) {
        bCleanUpRC();
    }

PMF_EXIT:

    ExitThread(0);
    return bSuccess;

}

BOOL bSelectDIBPal | ( | HDC | hDC,
 |  | LPBITMAPINFO | pbmi,
 |  | BOOL | bCoreHdr
 | ) |  |

Definition at line 5391 of file MfEdit.c.

{
  LOGPALETTE    *plogPal;
  UINT          uiSizPal;
  INT           i, iNumClr;
  WORD          wBitCount;

  if (bCoreHdr) {
    wBitCount = ((LPBITMAPCOREINFO)pbmi)->bmciHeader.bcBitCount;
  } else {
    wBitCount = pbmi->bmiHeader.biBitCount;
  }

  switch (wBitCount) {
    case 16:
    case 24:
    case 32:                            // Does PM supports these?
        return FALSE;
    default:
        iNumClr = (1 << wBitCount);
        break;
  }

  uiSizPal = sizeof(WORD)*2 + sizeof(PALETTEENTRY)*iNumClr;
  if ((plogPal = (LOGPALETTE *) LocalAlloc(LMEM_FIXED,uiSizPal)) == NULL) {
      MessageBox(ghwndMain, GetStringRes(IDS_ALLOCPALFAIL),
            GetStringRes(IDS_ERROR), MB_OK);
      ghPal = NULL;
      return FALSE;
  }

  plogPal->palVersion = 0x300;
  plogPal->palNumEntries = (WORD) iNumClr;

  if (bCoreHdr) {
    for (i=0; i<iNumClr; i++) {
        plogPal->palPalEntry[i].peRed   = ((LPBITMAPCOREINFO)pbmi)->bmciColors[i].rgbtRed;
        plogPal->palPalEntry[i].peGreen = ((LPBITMAPCOREINFO)pbmi)->bmciColors[i].rgbtGreen;
        plogPal->palPalEntry[i].peBlue  = ((LPBITMAPCOREINFO)pbmi)->bmciColors[i].rgbtBlue;
        plogPal->palPalEntry[i].peFlags = PC_RESERVED;
    }
  } else {
    for (i=0; i<iNumClr; i++) {
        plogPal->palPalEntry[i].peRed   = pbmi->bmiColors[i].rgbRed;
        plogPal->palPalEntry[i].peGreen = pbmi->bmiColors[i].rgbGreen;
        plogPal->palPalEntry[i].peBlue  = pbmi->bmiColors[i].rgbBlue;
        plogPal->palPalEntry[i].peFlags = PC_RESERVED;
    }
  }

  DeleteObject(ghPal);
  ghPal = CreatePalette((LPLOGPALETTE)plogPal);
  if ((ghPal) == NULL) {
      MessageBox(ghwndMain, GetStringRes(IDS_CREPALFAIL),
            GetStringRes(IDS_ERROR), MB_OK);
      return FALSE;
  }

  if ((GetDeviceCaps(hDC, RASTERCAPS)) & RC_PALETTE) {
    SelectPalette(hDC, ghPal, FALSE);
    RealizePalette(hDC);
  }

  LocalFree(plogPal);

  return TRUE;
}

BOOL bSetAdvancedGraphics ( HDC hdc )

Definition at line 6037 of file MfEdit.c.

{
    OSVERSIONINFO osvi;
    osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);

    GetVersionEx (&osvi);
    if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT)

      if ((SetGraphicsMode(hdc, GM_ADVANCED)) == 0) {
     MessageBox(ghwndMain, GetStringRes(IDS_SETADVGRPHMDFAIL), NULL, MB_OK);
      }
    return TRUE;
}

BOOL bSetRC2MatchEmfRC | ( | HDC | hDC,
 |  | ENHMETAHEADER | EnhMetaHdr,
 |  | HENHMETAFILE | hEnhMf,
 |  | PIXELFORMATDESCRIPTOR * | ppfd
 | ) |  |

Definition at line 848 of file MfEdit.c.

{
    return TRUE;
}

BOOL bSetupRC | ( | HDC | hDC,
 |  | PIXELFORMATDESCRIPTOR * | ppfdIn
 | ) |  |

Definition at line 843 of file MfEdit.c.

{
    return TRUE;
}

LPTSTR BuildFilterStrs ( int id )

Definition at line 6091 of file MfEdit.c.

{
  static TCHAR buffer[1024];
  static TCHAR *pBuf;
  int delimIndex;

  if ((id == -1) || (!pBuf)) // to make sure the first time its called, pBuf is not used without initialization
  {
    pBuf = buffer;
  }
  else
  {
    delimIndex = LoadString(GetModuleHandle (NULL), id, pBuf, 1024 - (int)(pBuf-buffer));
    if (!delimIndex)
        return buffer;
    if (1024 - (int)(pBuf - buffer) > delimIndex)
        pBuf += delimIndex + 1;

    delimIndex = LoadString(GetModuleHandle (NULL), id + 1, pBuf, 1024 - (int)(pBuf-buffer));
    if (!delimIndex)
        return buffer;
    if (1024 - (int)(pBuf - buffer) > delimIndex)
        pBuf += delimIndex + 1;
  }

  *pBuf = 0;
  *(pBuf+1) = 0;
  return buffer;
}

HPALETTE CopyPalette ( HPALETTE hPalSrc )

Definition at line 5606 of file MfEdit.c.

{
    PLOGPALETTE     plogPal;
    PBYTE           pjTmp;
    int             iNumEntries=0;
    HPALETTE        hPal;

    if ((iNumEntries = GetPaletteEntries(hPalSrc, 0, iNumEntries, NULL)) == 0) {
        MessageBox(ghwndMain, GetStringRes(IDS_NOPALENTRYFORCPY),
            GetStringRes(IDS_ERROR), MB_OK);
        return (HPALETTE) NULL;
    }

    if ((plogPal = (PLOGPALETTE)GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT,
            sizeof(DWORD) + sizeof(PALETTEENTRY)*iNumEntries )) == NULL) {
        MessageBox(ghwndMain, GetStringRes(IDS_CPYPALFAIL),
            GetStringRes(IDS_ERROR), MB_OK);
        return (HPALETTE) NULL;
    }

    plogPal->palVersion = 0x300;
    plogPal->palNumEntries = (WORD) iNumEntries;
    pjTmp = (PBYTE) plogPal;
    pjTmp += 4;
    GetPaletteEntries(hPalSrc, 0, iNumEntries, (PPALETTEENTRY)pjTmp);
    hPal = CreatePalette(plogPal);

    GlobalFree(plogPal);

    return hPal;
}

LONG_PTR APIENTRY CtrlPanelDlgProc | ( | HWND | hwnd,
 |  | UINT | msg,
 |  | WPARAM | dwParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 3329 of file MfEdit.c.

{
    switch (msg) {
        case WM_INITDIALOG: {
            int index;

            for (index = 0; index < OD_BTN_CNT; index++) {
                grHwndCtrlBtn[index] = (PVOID)GetDlgItem(hwnd, (INT)(ID_OD_BTN_BASE+index));
            }
            for (index = 0; index < OD_TOOL_CNT; index++) {
                grHwndToolBtn[index] = (PVOID)GetDlgItem(hwnd, (INT)(ID_OD_TOOL_BASE+index));
            }
            return TRUE;
        }

        case WM_DRAWITEM: {
            PDRAWITEMSTRUCT pDIS = (PDRAWITEMSTRUCT) lParam;
            HBITMAP hBmpOld;
            BITMAP  bm;
            HANDLE  hCtl;
            HDC     hDCCtl;

            if (pDIS->CtlID == gdwCurCtrl) {
                GetObject((HBITMAP) ghBmpDn[pDIS->CtlID - ID_OD_BTN_BASE], sizeof(BITMAP), (LPSTR)&bm);
                hBmpOld = SelectObject(ghDCMem, (HBITMAP) ghBmpDn[pDIS->CtlID - ID_OD_BTN_BASE]);
            }

            if (pDIS->CtlID == gdwCurTool) {
                GetObject((HBITMAP)ghToolBmpDn[pDIS->CtlID - ID_OD_TOOL_BASE], sizeof(BITMAP), (LPSTR)&bm);
                hBmpOld = SelectObject(ghDCMem, (HBITMAP)ghToolBmpDn[pDIS->CtlID - ID_OD_TOOL_BASE]);
            }

            if ((pDIS->CtlID < ID_OD_TOOL_BASE) && (pDIS->CtlID != gdwCurCtrl)) {
                GetObject((HBITMAP)ghBmpUp[pDIS->CtlID - ID_OD_BTN_BASE], sizeof(BITMAP), (LPSTR)&bm);
                hBmpOld = SelectObject(ghDCMem, (HBITMAP)ghBmpUp[pDIS->CtlID - ID_OD_BTN_BASE]);
            }

            if ((pDIS->CtlID >= ID_OD_TOOL_BASE) && (pDIS->CtlID != gdwCurTool)) {
                GetObject((HBITMAP)ghToolBmpUp[pDIS->CtlID - ID_OD_TOOL_BASE], sizeof(BITMAP), (LPSTR)&bm);
                hBmpOld = SelectObject(ghDCMem, (HBITMAP)ghToolBmpUp[pDIS->CtlID - ID_OD_TOOL_BASE]);
            }

            //
            // pDIS->hDC is clipped to the update region but unfortunately
            // that doesn't work well with StretchBlt.  StretchBlt is used
            // because I don't have to make sure that the bitmap size is
            // exactly the same as the size of the button.
            //
            hCtl   = GetDlgItem(hwnd, pDIS->CtlID);
            hDCCtl = GetDC(hCtl);
            StretchBlt(hDCCtl,                                //pDIS->hDC,
                   pDIS->rcItem.left, pDIS->rcItem.top,
                   pDIS->rcItem.right - pDIS->rcItem.left,
                   pDIS->rcItem.bottom - pDIS->rcItem.top,
                   ghDCMem, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
            ReleaseDC(hCtl, hDCCtl);
            SelectObject(ghDCMem, hBmpOld);
            break;
        }

        case WM_COMMAND: {
            DWORD_PTR dwOldCtrl = gdwCurCtrl;
            DWORD_PTR dwOldTool = gdwCurTool;

            switch (dwParam) {
                case DID_ONE:
                case DID_TWO:
                case DID_THREE:
                case DID_FOUR:
                case DID_FIVE:
                case DID_SIX:
                case DID_SEVEN:
                case DID_EIGHT:
                case DID_NINE:
                case DID_ZERO:
                case DID_TEN_PLUS:
                    //SetDlgItemInt(ghwndCtrlPanel, DID_COUNTER, dwParam - DID_ZERO, FALSE);
                    SendMessage(ghwndMain, WM_COMMAND, dwParam, lParam);
                    break;
                case DID_OPEN:
                case DID_RECORD:
                case DID_STOP:
                case DID_PLAY:
                case DID_FF:
                    SendMessage(ghwndMain, WM_COMMAND, dwParam, lParam);
                    gdwCurCtrl = dwParam;
                    InvalidateRect((HWND)grHwndCtrlBtn[dwOldCtrl - ID_OD_BTN_BASE], NULL, FALSE);
                    InvalidateRect((HWND)grHwndCtrlBtn[gdwCurCtrl - ID_OD_BTN_BASE], NULL, FALSE);
                    break;
                case DID_CLEAR:
                    SendMessage(ghwndMain, WM_COMMAND, dwParam, lParam);
                    break;
                case DID_TEXT:
                case DID_PEN:
                case DID_RECT:
                case DID_FILLRECT:
                case DID_ELLIPSE:
                case DID_FILLELLIPSE:
                case DID_LINE:
                case DID_BEZIER:
                case DID_BMPOBJ:
                case DID_METAF:
                    SendMessage(ghwndMain, WM_COMMAND, dwParam, lParam);
                    gdwCurTool = dwParam;
                    InvalidateRect((HWND)grHwndToolBtn[dwOldTool - ID_OD_TOOL_BASE], NULL, FALSE);
                    InvalidateRect((HWND)grHwndToolBtn[gdwCurTool - ID_OD_TOOL_BASE], NULL, FALSE);
                    break;
            }
            break;
        }

        case WM_PAINT:
            {
                HDC hdc;
                RECT rc, rcDlg;
                PAINTSTRUCT ps;
                HPEN hpenWindowFrame, hpenDarkGray;
                int  icyDlg;
                int  icyBorder;

                icyBorder = GetSystemMetrics(SM_CYBORDER);

                GetWindowRect(hwnd, &rcDlg);
                icyDlg = rcDlg.right - rcDlg.left;

                /*
                 * Draw our border lines.
                 */
                GetClientRect(hwnd, &rc);
                hdc = BeginPaint(hwnd, &ps);

                SelectObject(hdc, GetStockObject(WHITE_PEN));
                MoveToEx(hdc, rc.left, rc.top, NULL);
                LineTo(hdc, rc.right, rc.top);

                hpenDarkGray = CreatePen(PS_SOLID, 1, DARKGRAY);
                SelectObject(hdc, hpenDarkGray);
                MoveToEx(hdc, rc.left, (rc.top + icyDlg) - icyBorder - 1, NULL);
                LineTo(hdc, rc.right, (rc.top + icyDlg) - icyBorder - 1);

                hpenWindowFrame = CreatePen(PS_SOLID, icyBorder,
                        GetSysColor(COLOR_WINDOWFRAME));
                SelectObject(hdc, hpenWindowFrame);
                MoveToEx(hdc, rc.left, (rc.top + icyDlg) - icyBorder, NULL);
                LineTo(hdc, rc.right, (rc.top + icyDlg) - icyBorder);

                EndPaint(hwnd, &ps);
                DeleteObject(hpenWindowFrame);
                DeleteObject(hpenDarkGray);
            }

            break;

        //case WM_CTLCOLOR:
        case WM_CTLCOLORDLG:
        //case WM_CTLCOLORLISTBOX:
        case WM_CTLCOLORSTATIC:
            switch (GET_WM_CTLCOLOR_TYPE(dwParam, lParam, msg)) {
                case CTLCOLOR_DLG:
                //case CTLCOLOR_LISTBOX:
                    return (BOOL)(INT_PTR)GetStockObject(LTGRAY_BRUSH);

                case CTLCOLOR_STATIC:
                    SetBkMode(GET_WM_CTLCOLOR_HDC(dwParam, lParam, msg),
                              TRANSPARENT);
                //    SetTextColor(GET_WM_CTLCOLOR_HDC(dwParam, lParam, msg),
                //              RGB(255,0,0));
                //    SetBkColor(GET_WM_CTLCOLOR_HDC(dwParam, lParam, msg),
                //            LIGHTGRAY);
                //              RGB(255, 255,0));
                    return (BOOL)(INT_PTR)GetStockObject(DKGRAY_BRUSH);
            }
            //return (BOOL)NULL;
            return (BOOL)(INT_PTR)GetStockObject(LTGRAY_BRUSH);

        default:
            return FALSE;
    }

    return FALSE;
}

LONG_PTR APIENTRY DrawSurfWndProc | ( | HWND | hwnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 2917 of file MfEdit.c.

{
    static BOOL    bTrack = FALSE;
    static int     OrgX, OrgY;
    static int     PrevX, PrevY;
    static HDC     hDC;
    static HCURSOR hCurArrow, hCurHT;
    static BOOL    b3DSetup = FALSE;

    switch (message) {
    case WM_CREATE: {
        RECT                    rect;

        hDC = GetDC(hwnd);

            {
            char text[128];

            _sntprintf(text, 127, "DrawSurfWndProc: hDC=%p", hDC);
            text [127] = '\0';
      vErrOut(text);
            }

            bSetAdvancedGraphics(hDC);

            if (gb3D)
                b3DSetup = bSetupRC(hDC, NULL);

        ReleaseDC(hwnd, hDC);

        GetClientRect(GetParent(hwnd), &rect);

        SetWindowPos(hwnd, NULL,
            0,
            30,
            rect.right-rect.left,
            rect.bottom-rect.top-30,
            SWP_NOZORDER | SWP_NOMOVE);
            CreateCaret(hwnd, NULL, 1, CARET_HEIGHT);
#if 0
        //CreateCaret(hwnd, NULL, 1, 12);
        //hbmp = LoadBitmap(ghModule, (LPCSTR)MAKEINTRESOURCE(BMID_TOOLBASED));

        hPal = CreatePalette((LOGPALETTE *)&LogPal);
        hDC = GetDC(hwnd);
        hOldPal = SelectPalette(hDC, hPal, FALSE);
        RealizePalette(hDC);

        hbmp = CreateDIBitmap(hDC, (LPBITMAPINFOHEADER)&DIBHdr, CBM_CREATEDIB, &dib, (LPBITMAPINFO)&DIBHdr, DIB_PAL_COLORS);
        CreateCaret(hwnd, hbmp, 1, 12);

        ReleaseDC(hwnd, hDC);
#endif

        ghCurFont = GetStockObject(SYSTEM_FONT);
        GetObject(ghCurFont, sizeof(LOGFONT), &glf);
        hCurArrow = LoadCursor(NULL, IDC_ARROW);
        hCurHT = LoadCursor(NULL, IDC_CROSS);
        break;
    }

    case WM_LBUTTONDOWN: {
        int    x, y;

        x = (int) LOWORD(lParam);
        y = (int) HIWORD(lParam);

        if (gbHitTest) {
        hDC = GetDC(hwnd);
        bHitTest(hDC, x, y);
        ReleaseDC(hwnd, hDC);
        break;
        }

        bTrack = TRUE;
        OrgX = PrevX = x;
        OrgY = PrevY = y;

        hDC = GetDC(hwnd);
        SetCapture(hwnd);
        break;
    }

    case WM_MOUSEMOVE: {
        RECT rectClient;
        int NextX;
        int NextY;

        if (gbHitTest) {
        SetCursor(hCurHT);
        } else {
        SetCursor(hCurArrow);
        }

        // Update the selection region
        if (bTrack) {
        NextX = (SHORT) LOWORD(lParam);
        NextY = (SHORT) HIWORD(lParam);

        // Do not draw outside the window's client area

        GetClientRect (hwnd, &rectClient);
        if (NextX < rectClient.left) {
            NextX = rectClient.left;
        } else if (NextX >= rectClient.right) {
            NextX = rectClient.right - 1;
        }
        if (NextY < rectClient.top) {
            NextY = rectClient.top;
        } else if (NextY >= rectClient.bottom) {
            NextY = rectClient.bottom - 1;
        }
        if ((NextX != PrevX) || (NextY != PrevY)) {
           SetROP2(hDC, R2_NOT);       // Erases the previous box
           bDrawStuff(hDC, OrgX, OrgY, PrevX, PrevY, TRUE, TRUE, FALSE, NULL);

           //
           // Optimization.  Do not record in metafile DC if it is going
           // to be erased.  So only call bDrawStuff with the PEN tool.
           //
           if (gbRecording && (ghDCMetaf != NULL) && (gdwCurTool == DID_PEN)) {
               bDrawStuff(ghDCMetaf, OrgX, OrgY, PrevX, PrevY, TRUE, TRUE, FALSE, NULL);
           }

        // Get the current mouse position
           PrevX = NextX;
           PrevY = NextY;

           //
           // SetROP2(hDC, R2_COPYPEN);
           //   This is commented out because we don't want to erase
           //   the background as it sweeps.
           //
           bDrawStuff(hDC, OrgX, OrgY, PrevX, PrevY, FALSE, TRUE, FALSE, NULL);

           if (gbRecording && (ghDCMetaf != NULL) && (gdwCurTool == DID_PEN)) {
               bDrawStuff(ghDCMetaf, OrgX, OrgY, PrevX, PrevY, FALSE, TRUE, FALSE, NULL);
           }

        }
        }
        break;

    }

      case WM_LBUTTONUP: {
        int NextX;
        int NextY;

        if (!bTrack)
           break;

        // End the selection
           ReleaseCapture();
           bTrack = FALSE;

        // Erases the box
           //
           // SetROP2(hDC, R2_NOT);
           //   This is assumed to be R2_NOT, thus unnecessary
           //
           bDrawStuff(hDC, OrgX, OrgY, PrevX, PrevY, TRUE, FALSE, FALSE, NULL);

           if (gbRecording && (ghDCMetaf != NULL) && (gdwCurTool == DID_PEN)) {
               bDrawStuff(ghDCMetaf, OrgX, OrgY, PrevX, PrevY, TRUE, FALSE, FALSE, NULL);
           }

           //
           // Apparently, at buttonup time, the mouse location is not clamped to
           // the client area.  So, the final ellipse or rectangle will be extended
           // outside the client area.
           //
           // NextX = (SHORT) LOWORD(lParam);
           // NextY = (SHORT) HIWORD(lParam);
           NextX = PrevX;
           NextY = PrevY;

        // Draws the new box
           SetROP2(hDC, R2_COPYPEN);
           bDrawStuff(hDC, OrgX, OrgY, NextX, NextY, FALSE, FALSE, TRUE, NULL);

           ReleaseDC(hwnd, hDC);

           if (gbRecording && (ghDCMetaf != NULL)) {
                bDrawStuff(ghDCMetaf, OrgX, OrgY, NextX, NextY, FALSE, FALSE, FALSE, NULL);
           }

        break;
      } // case WM_LBUTTONUP

#ifdef JAPAN
      case WM_IME_REPORT:
        if (IR_STRING == wParam) {
            LPSTR   lpsz, lpszMeta;

            if (!(lpsz = lpszMeta = GlobalLock((HANDLE)lParam))) {
                return FALSE;
            }
            hDC = GetDC(hwnd);
        while(*lpsz) { // Draw all characters in the string
        bDrawStuff(hDC, 0, 0, 0, 0, TRUE, FALSE, FALSE, lpsz);
        IsDBCSLeadByte((BYTE)*lpsz) ? lpsz += 2 : ++lpsz;
        }
            ReleaseDC(hwnd, hDC);
            if (gbRecording && (ghDCMetaf != NULL)) {
        while(*lpszMeta) { // Draw all characters in the string
            bDrawStuff(ghDCMetaf, 0, 0, 0, 0, TRUE, FALSE, FALSE, lpszMeta);
            IsDBCSLeadByte((BYTE)*lpszMeta) ? lpszMeta += 2 : ++lpszMeta;
        }
            }
            GlobalUnlock((HANDLE)lParam);
            return TRUE;
        }
    return DefWindowProc(hwnd, message, wParam, lParam);
        break;
#endif

      case WM_CHAR: {

        if (gdwCurTool != DID_TEXT)
            break;

        hDC = GetDC(hwnd);
        bDrawStuff(hDC, 0, 0, 0, 0, TRUE, FALSE, FALSE, (LPSTR)&wParam);
        ReleaseDC(hwnd, hDC);

        if (gbRecording && (ghDCMetaf != NULL)) {
            bDrawStuff(ghDCMetaf, 0, 0, 0, 0, TRUE, FALSE, FALSE, (LPSTR)&wParam);
        }

        break;
      }

      case WM_DESTROY: {
        HDC         hDCt;
        HPALETTE    hPal;

        DestroyCaret();
        DeleteObject(ghCurFont);

        if (gb3D && b3DSetup) {
            bCleanUpRC();
        }

        hDCt = GetDC(hwnd);
        hPal = SelectObject(hDCt, GetStockObject(DEFAULT_PALETTE));
        DeleteObject(hPal);
        ReleaseDC(hwnd, hDCt);

    PostQuitMessage(0);
    return 0L;
      }

      default:
    return DefWindowProc(hwnd, message, wParam, lParam);
    }

    return 0;

}

HLOCAL Free ( CMTMLTFMT * pMfmt )

Definition at line 5847 of file MfEdit.c.

                              {
    return LocalFree(pMfmt);
}

LPTSTR GetStringRes ( int id )

Definition at line 6061 of file MfEdit.c.

{
  static TCHAR buffer[MAX_PATH];

  buffer[0]=0;
  LoadString (GetModuleHandle (NULL), id, buffer, MAX_PATH);
  return buffer;
}

LPTSTR GetStringRes2 ( int id )

Definition at line 6070 of file MfEdit.c.

{
  static TCHAR buffer[MAX_PATH];

  buffer[0]=0;
  LoadString (GetModuleHandle (NULL), id, buffer, MAX_PATH);
  return buffer;
}

HBITMAP hBmpLoadBitmapFile | ( | HDC | hDC,
 |  | PSTR | pszFileName
 | ) |  |

Definition at line 4505 of file MfEdit.c.

{
    HANDLE              hFile, hMapFile;
    LPVOID              pMapFile, pMapFileTmp;
    LPBITMAPINFOHEADER  pbmh;
    LPBITMAPINFO        pbmi;
    PBYTE               pjTmp;
    ULONG               sizBMI;
    HBITMAP             hBitmap;
    INT                 iNumClr;
    BOOL                bCoreHdr;
    WORD                wBitCount;
    PFILEINFO           pFileInfo;

    hBitmap = NULL;

    if ((hFile = CreateFile(pszFileName, GENERIC_READ, FILE_SHARE_READ, NULL,
            OPEN_EXISTING, FILE_ATTRIBUTE_READONLY | SECURITY_SQOS_PRESENT | SECURITY_ANONYMOUS,
            NULL)) == INVALID_HANDLE_VALUE) {
        SetWindowText(ghTextWnd, GetStringRes(IDS_FILEOPNFAIL));
        goto ErrExit1;
    }
    if ( GetFileType(hFile) != FILE_TYPE_DISK )
    {
        goto ErrExit2;
    }

    //
    // Create a map file of the opened file
    //
    if ((hMapFile = CreateFileMapping(hFile, NULL,
                             PAGE_READONLY, 0, 0, NULL)) == INVALID_HANDLE_VALUE) {
        SetWindowText(ghTextWnd, GetStringRes(IDS_CREMAPFILEFAIL));
        goto ErrExit2;

    }

    //
    // Map a view of the whole file
    //
    if ((pMapFile = MapViewOfFile(hMapFile, FILE_MAP_READ, 0, 0, 0)) == NULL) {
        SetWindowText(ghTextWnd, GetStringRes(IDS_MAPVWOFMAPFOFAIL));
        goto ErrExit3;
    }

    pMapFileTmp = pMapFile;

    //
    // First check that it is a bitmap file
    //
    if (*((PWORD)pMapFile) != 0x4d42) {              // 'BM'
        MessageBox(ghwndMain, GetStringRes(IDS_NOTDIBBMFILE),
            GetStringRes(IDS_ERROR), MB_OK);
        goto ErrExit3;
    }

    //
    // The file header doesn't end on DWORD boundary...
    //
    pbmh = (LPBITMAPINFOHEADER)((PBYTE)pMapFile + sizeof(BITMAPFILEHEADER));

    {
        BITMAPCOREHEADER bmch, *pbmch;
        BITMAPINFOHEADER bmih, *pbmih;
        PBYTE            pjTmp1;
        ULONG            ulSiz;

        pbmch = &bmch;
        pbmih = &bmih;

        pjTmp1 = (PBYTE)pbmh;
        ulSiz  = sizeof(BITMAPCOREHEADER);
        while (ulSiz--) {
            *(((PBYTE)pbmch)++) = *(((PBYTE)pjTmp1)++);
        }

        pjTmp1 = (PBYTE)pbmh;
        ulSiz = sizeof(BITMAPINFOHEADER);
        while (ulSiz--) {
            *(((PBYTE)pbmih)++) = *(((PBYTE)pjTmp1)++);
        }

        //
        // Use the size to determine if it is a BitmapCoreHeader or
        // BitmapInfoHeader
        //
        // Does PM supports 16 and 32 bpp? How?
        //
        if (bmch.bcSize == sizeof(BITMAPCOREHEADER))
        {
            wBitCount = bmch.bcBitCount;
            iNumClr = ((wBitCount == 24) ? 0 : (1 << wBitCount));
            sizBMI = sizeof(BITMAPCOREHEADER)+sizeof(RGBTRIPLE)*iNumClr;
            bCoreHdr = TRUE;
        }
        else            // BITMAPINFOHEADER
        {
            wBitCount = bmih.biBitCount;
            switch (wBitCount) {
                case 16:
                case 32:
                    sizBMI = sizeof(BITMAPINFOHEADER)+sizeof(DWORD)*3;
                    break;
                case 24:
                    sizBMI = sizeof(BITMAPINFOHEADER);
                    break;
                default:
                    iNumClr = (1 << wBitCount);
                    sizBMI = sizeof(BITMAPINFOHEADER)+sizeof(RGBQUAD)*iNumClr;
                    break;
            }
            bCoreHdr = FALSE;
        }
    }

    if ((pbmi = (LPBITMAPINFO) LocalAlloc(LMEM_FIXED,sizBMI)) == NULL) {
        MessageBox(ghwndMain, GetStringRes(IDS_MALLOCFAIL),
            GetStringRes(IDS_ERROR), MB_OK);
        goto ErrExit3;
    }

    //
    // Make sure we pass in a DWORD aligned BitmapInfo to CreateDIBitmap
    // Otherwise, exception on the MIPS platform
    // CR!!!  Equivalent to memcpy
    //
    pjTmp = (PBYTE)pbmi;

    while(sizBMI--)
    {
        *(((PBYTE)pjTmp)++) = *(((PBYTE)pbmh)++);
    }

    pMapFile = (PBYTE)pMapFile + ((BITMAPFILEHEADER *)pMapFile)->bfOffBits;

// !!! Use CreateBitmap for monochrome bitmap?

    //
    // Select the palette into the DC first before CreateDIBitmap()
    //
    bSelectDIBPal(hDC, pbmi, bCoreHdr);

// !!! We always pass a screen DC to this routine.
// !!! Maybe we should pass a metafile DC to this routine too.
// !!! The bitmap handle created for the screen DC won't give correct
// !!! color for the metafile DC.  So now, we always use the original
// !!! DIB info.
    if ((hBitmap = CreateDIBitmap(hDC, (LPBITMAPINFOHEADER)pbmi,
                        CBM_INIT, pMapFile, pbmi, DIB_RGB_COLORS)) == NULL) {
        SetWindowText(ghTextWnd, "Fail in creating DIB bitmap from file!");
        goto ErrExit4;
    }

    // reset gbUseDIB flag, now that we have opened up a new DIB
    gbUseDIB = FALSE;

// !!! Always use the DIB info o.w. metafile DC don't get the right color.
#if 0
    if (GetDeviceCaps(hDC, BITSPIXEL) < wBitCount) {
#endif
        gbUseDIB = TRUE;
        bFreeDibFile(&gDib);
        pFileInfo = &(gDib.rgFileInfo[0]);
        pFileInfo->hFile        = hFile;
        pFileInfo->hMapFile     = hMapFile;
        pFileInfo->lpvMapView   = pMapFileTmp;

        gDib.rgpjFrame[0]       = pMapFile;
        gDib.rgpbmi[0]          = pbmi;
        gDib.rgbCoreHdr[0]      = bCoreHdr;
        gDib.ulFrames           =
        gDib.ulFiles            = 1;
        return (hBitmap);
#if 0
    }
#endif

ErrExit4:
    LocalFree(pbmi);
ErrExit3:
    CloseHandle(hMapFile);
ErrExit2:
    CloseHandle(hFile);
ErrExit1:

    return (hBitmap);

}

HBRUSH hBrCreateBrush | ( | HDC | hDC,
 |  | DWORD | dwRGB
 | ) |  |

Definition at line 5185 of file MfEdit.c.

{
    HDC hdcMem;
    HBRUSH hbr;
    HBRUSH hbrOld;
    HBITMAP hbmPat;
    HBITMAP hbmOld;

    hbr = CreateSolidBrush(dwRGB);
    hdcMem = CreateCompatibleDC(hDC);

    //
    // Minimum size for a bitmap to be used in a fill pattern is 8x8
    //
    hbmPat = CreateCompatibleBitmap(hDC, 8, 8);

    hbmOld = SelectObject(hdcMem, hbmPat);
    hbrOld = SelectObject(hdcMem, hbr);
    PatBlt(hdcMem, 0, 0, 8, 8, PATCOPY);

    //
    // Deselect hbmPat and hbr
    //
    SelectObject(hdcMem, hbmOld);
    SelectObject(hdcMem, hbrOld);

    DeleteDC(hdcMem);
    DeleteObject(hbr);

    hbr = CreatePatternBrush(hbmPat);

    DeleteObject(hbmPat);

    return hbr;
}

HPALETTE hCreateRGBPalette | ( | HDC | hDC,
 |  | int | index
 | ) |  |

Definition at line 436 of file MfEdit.c.

{
    PIXELFORMATDESCRIPTOR   pfd;
    PLOGPALETTE             pLogPal, pPal;
    WORD                    nClr, i, n;
    HPALETTE                hPal;
    BOOL                    bUseStaticClr;

    if (DescribePixelFormat(hDC, index, sizeof(PIXELFORMATDESCRIPTOR), &pfd) == 0) {
        return (HPALETTE)NULL;
    }

    bUseStaticClr = pfd.dwFlags & PFD_NEED_SYSTEM_PALETTE;

    if (pfd.dwFlags & PFD_NEED_PALETTE) {
        nClr = 1 << pfd.cColorBits;

        if ((pLogPal = (PLOGPALETTE) LocalAlloc(LMEM_FIXED, sizeof(LOGPALETTE) +
                        (nClr-1) * sizeof(PALETTEENTRY))) != NULL) {

            pLogPal->palVersion = 0x300;
            pLogPal->palNumEntries = nClr;

            for (i = 0; i < nClr; i++) {
                pLogPal->palPalEntry[i].peRed   =
            ComponentFromIndex(i, pfd.cRedBits, pfd.cRedShift);
                pLogPal->palPalEntry[i].peGreen =
            ComponentFromIndex(i, pfd.cGreenBits, pfd.cGreenShift);
                pLogPal->palPalEntry[i].peBlue  =
            ComponentFromIndex(i, pfd.cBlueBits, pfd.cBlueShift);
                pLogPal->palPalEntry[i].peFlags = PC_NOCOLLAPSE;
            }

            if ( nClr == 256) {
                if (bUseStaticClr) {
                    pLogPal->palPalEntry[0].peFlags = 0;
                    pLogPal->palPalEntry[255].peFlags = 0;

                    SaveStaticEntries(hDC);
                    SetSystemPaletteUse(hDC, SYSPAL_NOSTATIC);
                } else {
                    if ((pfd.cRedBits   == 3) && (pfd.cRedShift   == 0) &&
                        (pfd.cGreenBits == 3) && (pfd.cGreenShift == 3) &&
                        (pfd.cBlueBits  == 2) && (pfd.cBlueShift  == 6)) {
                        UpdateStaticMapping(pLogPal->palPalEntry);

                        for (i = 0; i < 20; i++) {
                            pLogPal->palPalEntry[aiDefaultOverride[i]] =
                                apeDefaultPalEntry[i];
                        }

                    }
                }
            }

            FlushPalette(hDC, nClr);

            hPal = CreatePalette(pLogPal);
            LocalFree(pLogPal);
            SelectPalette(hDC, hPal, FALSE);
            RealizePalette(hDC);

            if (bUseStaticClr)
                UseStaticEntries(hDC);

        }
    }
    // set up logical indices for CI mode
    else if( pfd.iPixelType == PFD_TYPE_COLORINDEX ) {
        if (pfd.cColorBits == 4) {

            // for 4-bit, create a logical palette with 16 entries

            n = 16;
            if ( (pPal = (PLOGPALETTE)LocalAlloc(LMEM_FIXED, sizeof(LOGPALETTE) +
        (n-1) * sizeof(PALETTEENTRY))) != NULL ){
        pPal->palVersion = 0x300;
        pPal->palNumEntries = n;

        for( i = 0; i < 8; i ++) {
          pPal->palPalEntry[i] = apeDefaultPalEntry[i];
        }
        for (i = 8; i < 16; i++) {
          pPal->palPalEntry[i] = apeDefaultPalEntry[i+4];
        }

        // conform expects indices 0..3 to be BLACK,RED,GREEN,BLUE, so
        //  we rearrange the table for now.

        SwapPalE(1,9)
        SwapPalE(2,10)
        SwapPalE(3,12)
      }

    }
    else if (pfd.cColorBits == 8) {

            // for 8-bit, create a logical palette with 256 entries, making
            // sure that the 20 system colors exist in the palette

            n = 256;
            if ((pPal = (PLOGPALETTE)LocalAlloc(LMEM_FIXED, sizeof(LOGPALETTE) +
        (n-1) * sizeof(PALETTEENTRY))) != NULL){
        pPal->palVersion = 0x300;
        pPal->palNumEntries = n;

        hPal = GetStockObject (DEFAULT_PALETTE);

        // start by copying default palette into new one

        GetPaletteEntries( hPal, 0, 20, pPal->palPalEntry);

        // conform expects indices 0..3 to be BLACK,RED,GREEN,BLUE, so
        // we rearrange the table for now.

        SwapPalE(1,13)
        SwapPalE(2,14)
        SwapPalE(3,16)

        for( i = 20; i < n; i ++) {
          pPal->palPalEntry[i].peRed   = (BYTE) (i - 1);
          pPal->palPalEntry[i].peGreen = (BYTE) (i - 2);
          pPal->palPalEntry[i].peBlue  = (BYTE) (i - 3);
          pPal->palPalEntry[i].peFlags = (BYTE) 0;
        }

        // If we are taking possession of the system colors,
        // must guarantee that 0 and 255 are black and white
        // (respectively), so that they can remap to the
        // remaining two static colors.  All other entries must
        // be marked as PC_NOCOLLAPSE.

        if ( gbUseStaticColors )
        {
          pPal->palPalEntry[0].peRed =
          pPal->palPalEntry[0].peGreen =
          pPal->palPalEntry[0].peBlue = 0x00;

          pPal->palPalEntry[255].peRed =
          pPal->palPalEntry[255].peGreen =
          pPal->palPalEntry[255].peBlue = 0xFF;

                  pPal->palPalEntry[0].peFlags =
                pPal->palPalEntry[255].peFlags = 0;

              for ( i = 1 ; i < 255 ; i++ )
            {
              pPal->palPalEntry[i].peFlags = PC_NOCOLLAPSE;

                // This is a workaround for a GDI palette "feature".  If
              // any of the static colors are repeated in the palette,
            // those colors will map to the first occurance.  So, for
          // our case where there are only two static colors (black
                  // and white), if a white color appears anywhere in the
                // palette other than in the last  entry, the static white
              // will remap to the first white.  This destroys the nice
            // one-to-one mapping we are trying to achieve.
          //
                  // There are two ways to workaround this.  The first is to
              // simply not allow a pure white anywhere but in the last
                // entry.  Such requests are replaced with an attenuated
            // white of (0xFE, 0xFE, 0xFE).
                  //
                // The other way is to mark these extra whites with
              // PC_RESERVED which will cause GDI to skip these entries
            // when mapping colors.  This way the app gets the actual
          // colors requested, but can have side effects on other
          // apps.

            if ( pPal->palPalEntry[i].peRed   == 0xFF &&
              pPal->palPalEntry[i].peGreen == 0xFF &&
              pPal->palPalEntry[i].peBlue  == 0xFF )
            {
              pPal->palPalEntry[i].peFlags |= PC_RESERVED;
            }
          }

          SaveStaticEntries(hDC);
          SetSystemPaletteUse(hDC, SYSPAL_NOSTATIC);
        }
      } // not null

        } else {
            // for pixel formats > 8 bits deep, create a logical palette with
            // 4096 entries

            n = 4096;
            if ((pPal = (PLOGPALETTE)LocalAlloc(LMEM_FIXED, sizeof(LOGPALETTE) +
        (n-1) * sizeof(PALETTEENTRY))) != NULL ){
              pPal->palVersion = 0x300;
            pPal->palNumEntries = n;

            for( i = 0; i < n; i ++) {
              pPal->palPalEntry[i].peRed   = (BYTE) ((i & 0x000f) << 4);
            pPal->palPalEntry[i].peGreen = (BYTE) (i & 0x00f0);
          pPal->palPalEntry[i].peBlue  = (BYTE) ((i & 0x0f00) >> 4);
          pPal->palPalEntry[i].peFlags = (BYTE) 0;
        }

              // conform expects indices 0..3 to be BLACK,RED,GREEN,BLUE, so
            //  we rearrange the table for now.
      }

      SwapPalE(1,0xf)
      SwapPalE(2,0xf0)
      SwapPalE(3,0xf00)
    }
    if (pPal){
      hPal = CreatePalette(pPal);
      LocalFree(pPal);

      FlushPalette(hDC, n);

      SelectPalette(hDC, hPal, FALSE);
      RealizePalette(hDC);

      if ( gbUseStaticColors )
        UseStaticEntries(hDC);
    }
  }

    return hPal;
}

HDC hDCRecordMetafileAs | ( | HWND | hwnd,
 |  | LPSTR | szFilename
 | ) |  |

Definition at line 4264 of file MfEdit.c.

                                                     {
    OPENFILENAME ofn;
    char szFile[MAX_ARRAYSIZE], szFileTitle[MAX_ARRAYSIZE];
    static char *szFilter;
    char *szTmp, szTmp2[MAX_ARRAYSIZE];
    HDC  hDCMeta;

    int iWidthMM, iHeightMM, iWidthPels, iHeightPels, iMMPerPelX, iMMPerPelY;
    RECT rc;
    HDC hDC;

    BuildFilterStrs(-1);
    szFilter = BuildFilterStrs(IDS_FT_EMF);
    strncpy( szFile, "*.emf\0", MAX_ARRAYSIZE -1);
  szFile [MAX_ARRAYSIZE - 1] = '\0';
    ofn.lStructSize = sizeof(OPENFILENAME);
    ofn.hwndOwner = hwnd;
    ofn.lpstrFilter = szFilter;
    ofn.lpstrCustomFilter = (LPSTR) NULL;
    ofn.nMaxCustFilter = 0L;
    ofn.nFilterIndex = 0L;
    ofn.lpstrFile = szFile;
    ofn.nMaxFile = sizeof(szFile);
    ofn.lpstrFileTitle = szFileTitle;
    ofn.nMaxFileTitle = sizeof(szFileTitle);
    ofn.lpstrInitialDir = NULL;
    ofn.lpstrTitle = GetStringRes(IDS_SAVEMFAS);
    ofn.Flags = OFN_SHOWHELP | OFN_OVERWRITEPROMPT;
    ofn.nFileOffset = 0;
    ofn.nFileExtension = 0;
    ofn.lpstrDefExt = (LPSTR)NULL;

    if (!GetSaveFileName(&ofn)) {
        return 0L;
    }

    hDC = GetDC(hwnd);
    iWidthMM = GetDeviceCaps(hDC, HORZSIZE);
    iHeightMM = GetDeviceCaps(hDC, VERTSIZE);
    iWidthPels = GetDeviceCaps(hDC, HORZRES);
    iHeightPels = GetDeviceCaps(hDC, VERTRES);
    ReleaseDC(hwnd, hDC);
    iMMPerPelX = (iWidthMM * 100)/iWidthPels;
    iMMPerPelY = (iHeightMM * 100)/iHeightPels;
    GetClientRect(ghwndDrawSurf, &rc);
    rc.left = rc.left * iMMPerPelX;
    rc.top = rc.top * iMMPerPelY;
    rc.right = rc.right * iMMPerPelX;
    rc.bottom = rc.bottom * iMMPerPelY;

    //hDCMeta = CreateEnhMetaFile((HDC)NULL, szFile, (LPRECT)NULL, (LPSTR)NULL);
    {
        CHAR    szDesc[MAX_ARRAYSIZE];

        _sntprintf(szDesc, MAX_ARRAYSIZE - 1, "SDK Enhanced Metafile Editor\\0%s\\0\\0", szFileTitle);
    szDesc [MAX_ARRAYSIZE - 1] = '\0';
        hDCMeta = CreateEnhMetaFile((HDC)NULL, szFile, (LPRECT)&rc, (LPSTR)szDesc);

        if (gb3D)
            gbRCSet = bSetupRC(hDCMeta, NULL);

        bSetAdvancedGraphics(hDCMeta);
    }

    //
    // parses the new filename, removes the extension and copy it into
    // szFilename
    //
    strncpy( szFilename, "", MAX_ARRAYSIZE - 1);
  szFilename [MAX_ARRAYSIZE - 1] = '\0';
    szTmp = (char *)My_mbstok(szFile, "\\");
    strncpy( szTmp2, szTmp, MAX_ARRAYSIZE - 1 );
  szTmp2 [MAX_ARRAYSIZE - 1] = '\0';
    while (szTmp != NULL) {
        szTmp = (char *)My_mbstok(NULL, "\\");
        if (szTmp != NULL) {
            szFilename [MAX_ARRAYSIZE - 1] = '\0'; // make sure null terminated for strlen
            szTmp2 [sizeof (szTmp2) - 1] = '\0';   // make sure null terminated for strlen
            if ((strlen(szFilename)+strlen(szTmp2))/sizeof(char) >= MAX_ARRAYSIZE - 1) // check for this and next strcat
                return 0L;
            else
                strncat(szFilename, szTmp2, MAX_ARRAYSIZE - strlen (szFilename));
            strncpy( szTmp2, szTmp, MAX_ARRAYSIZE - 1);
      szTmp2 [MAX_ARRAYSIZE - 1] = '\0';
            strncat(szFilename, "\\", MAX_ARRAYSIZE - strlen (szFilename));
        }
    }
    szTmp = (char *)My_mbstok(szTmp2, ".");
    szTmp [sizeof (szTmp) - 1] = '\0';
    szFilename [MAX_ARRAYSIZE - 1] = '\0';
    if ((strlen(szFilename)+strlen(szTmp))/sizeof(char) >= MAX_ARRAYSIZE)
        return 0L;
    else
        strncat(szFilename, szTmp, MAX_ARRAYSIZE - strlen (szFilename));

    return hDCMeta;
}

HENHMETAFILE hemfLoadMetafile ( HWND hwnd )

Definition at line 4017 of file MfEdit.c.

                                         {
    OPENFILENAME    ofn;
    char            szFile[MAX_ARRAYSIZE], szFileTitle[MAX_ARRAYSIZE];
    static char     *szFilter;

    HMETAFILE       hmf;
    UINT            uiSize;
    LPVOID          pvData;
    HDC             hDCDrawSurf;
    HENHMETAFILE    hemf;

    HANDLE                  hFile, hMapFile;
    LPVOID                  pMapFile;
    LPENHMETAHEADER         pemh;

    BOOL        bSuccess;
    char            text[128];

    bSuccess = TRUE;

    BuildFilterStrs(-1);
    BuildFilterStrs(IDS_FT_EMF);
    szFilter = BuildFilterStrs(IDS_FT_WMF);

    strncpy( szFile, "*.emf\0", MAX_ARRAYSIZE - 1);
  szFile [MAX_ARRAYSIZE - 1] = '\0';
    ofn.lStructSize = sizeof(OPENFILENAME);
    ofn.hwndOwner = hwnd;
    ofn.lpstrFilter = szFilter;
    ofn.lpstrCustomFilter = (LPSTR) NULL;
    ofn.nMaxCustFilter = 0L;
    ofn.nFilterIndex = 1;
    ofn.lpstrFile = szFile;
    ofn.nMaxFile = sizeof(szFile);
    ofn.lpstrFileTitle = szFileTitle;
    ofn.nMaxFileTitle = sizeof(szFileTitle);
    ofn.lpstrInitialDir = NULL;
    ofn.lpstrTitle = GetStringRes(IDS_LDMF);
    ofn.Flags = 0L;
    ofn.nFileOffset = 0;
    ofn.nFileExtension = 0;
    ofn.lpstrDefExt = "EMF";

    if (!GetOpenFileName(&ofn))
        return 0L;

    if ((hFile = CreateFile(szFile, GENERIC_READ, FILE_SHARE_READ, NULL,
            OPEN_EXISTING, FILE_ATTRIBUTE_READONLY | SECURITY_SQOS_PRESENT | SECURITY_ANONYMOUS,
            NULL)) == INVALID_HANDLE_VALUE) {
        _sntprintf(text, 127, GetStringRes(IDS_FMT_FILEOPNFAIL), GetLastError());
    text [127] = '\0';
        MessageBox(ghwndMain, text, GetStringRes(IDS_ERROR), MB_OK);
        return 0L;
    }
    if ( GetFileType(hFile) != FILE_TYPE_DISK )
    {
        CloseHandle(hFile);
        return 0L;
    }

    //
    // Create a map file of the opened file
    //
    if ((hMapFile = CreateFileMapping(hFile, NULL,
                             PAGE_READONLY, 0, 0, "MapF")) == NULL) {
        _sntprintf(text, 127, GetStringRes(IDS_FMT_CREMAPFILEFAIL), GetLastError());
    text [127] = '\0';
        MessageBox(ghwndMain, text, GetStringRes(IDS_ERROR), MB_OK);
        bSuccess = FALSE;
        goto ErrorExit1;
    }

    //
    // Map a view of the whole file
    //
    if ((pMapFile = MapViewOfFile(hMapFile, FILE_MAP_READ, 0, 0, 0)) == NULL) {
        _sntprintf(text, 127, GetStringRes(IDS_FMT_MAPVWMAPFOFAIL), GetLastError());
    text [127] = '\0';
        MessageBox(ghwndMain, text, GetStringRes(IDS_ERROR), MB_OK);
        bSuccess = FALSE;
        goto ErrorExit2;
    }

    //
    // First check that if it is an enhanced metafile
    //
    pemh = (LPENHMETAHEADER) pMapFile;
    if (pemh->dSignature == META32_SIGNATURE) {
        hemf = GetEnhMetaFile(szFile);
        goto HLM_EXIT;
    }

    //
    // If it has an ALDUS header skip it
    // Notice: APMSIZE is used because the HANDLE and RECT of the structure
    //         depends on the environment
    //
    if (*((LPDWORD)pemh) == ALDUS_ID) {
        //METAFILEPICT    mfp;

        MessageBox(ghwndMain, GetStringRes(IDS_ALDUSMF), "Hey!", MB_OK);
        uiSize = *((LPDWORD) ((PBYTE)pMapFile + APMSIZE + 6));
        hDCDrawSurf = GetDC(ghwndDrawSurf);

        // Notice: mtSize is size of the file in word.
        // if LPMETAFILEPICT is NULL
        //    MM_ANISOTROPIC mode and default device size will be used.
        hemf = SetWinMetaFileBits(uiSize*2L, (PBYTE)pMapFile + APMSIZE, hDCDrawSurf, NULL);
#if 0
        switch ( ((PAPMFILEHEADER) pMapFile)->inch ) {
            // !!! End up in an upside down image
            //
            case 1440:
                mfp.mm = MM_TWIPS;
                OutputDebugString("MM_TWIPS\n");
                break;
            case 2540:
                OutputDebugString("MM_HIMETRIC\n");
                mfp.mm = MM_HIMETRIC;
                break;
            case 254:
                OutputDebugString("MM_LOMETRIC\n");
                mfp.mm = MM_LOMETRIC;
                break;
            case 1000:
                OutputDebugString("MM_HIENGLISH\n");
                mfp.mm = MM_HIENGLISH;
                break;
            case 100:
                OutputDebugString("MM_LOENGLISH\n");
                mfp.mm = MM_LOENGLISH;
                break;
            default:
                // !!! In addition, text is too small
                //
                OutputDebugString("MM_ANISOTROPIC\n");
                mfp.mm = MM_ANISOTROPIC;
                mfp.xExt = (((PAPMFILEHEADER) pMapFile)->bbox.Right - ((PAPMFILEHEADER) pMapFile)->bbox.Left)
                           * ((PAPMFILEHEADER) pMapFile)->inch * 2560;
                mfp.yExt = (((PAPMFILEHEADER) pMapFile)->bbox.Bottom - ((PAPMFILEHEADER) pMapFile)->bbox.Top)
                           * ((PAPMFILEHEADER) pMapFile)->inch * 2560;
                break;
        }
        mfp.hMF = 0;
        hemf = SetWinMetaFileBits(uiSize*2L, (PBYTE)pMapFile + APMSIZE, hDCDrawSurf, &mfp);
#endif

        if (!hemf) {
            char textbuf[MAX_ARRAYSIZE];

            _sntprintf(textbuf, MAX_ARRAYSIZE - 1,GetStringRes(IDS_FMT_SETWMFBTSFAIL), GetLastError());
      textbuf [MAX_ARRAYSIZE - 1] = '\0';
            MessageBox(ghwndMain, textbuf, GetStringRes(IDS_ERROR), MB_OK);
        }

        ghmf = SetMetaFileBitsEx(uiSize*2L, (PBYTE)pMapFile + APMSIZE);
        if (!ghmf) {
            char textbuf[MAX_ARRAYSIZE];

            _sntprintf(textbuf,MAX_ARRAYSIZE - 1, GetStringRes(IDS_FMT_SETWMFBTSXFAIL), GetLastError());
      textbuf [MAX_ARRAYSIZE - 1] = '\0';
            MessageBox(ghwndMain, textbuf, GetStringRes(IDS_ERROR), MB_OK);
        }

// !!! Displaying the Windows format metafile
//if (!PlayMetaFile(hDCDrawSurf, ghmf)) {
//    wsprintf(text, GetStringRes(IDS_FMT_PLAYMFFAIL), GetLastError());
//    MessageBox(ghwndMain, text, GetStringRes(IDS_ERROR), MB_OK);
//}
        ReleaseDC(ghwndDrawSurf, hDCDrawSurf);
        goto HLM_EXIT;
    }

    //
    // It is a Windows 3x format metafile (hopefully)
    //
    if (!(hmf = GetMetaFile((LPCSTR)szFile))) {
        char textbuf[MAX_ARRAYSIZE];

        _sntprintf(textbuf, MAX_ARRAYSIZE -1, GetStringRes(IDS_FMT_GETMFFAIL), GetLastError());
    textbuf [MAX_ARRAYSIZE - 1] = '\0';
        MessageBox(ghwndMain, textbuf, GetStringRes(IDS_ERROR), MB_OK);
        bSuccess = FALSE;
        goto ErrorExit3;
    }

    if (!(uiSize = GetMetaFileBitsEx(hmf, 0, NULL))) {
        MessageBox(ghwndMain, GetStringRes(IDS_GETMFBTSXFAIL),
            GetStringRes(IDS_ERROR), MB_OK);
        return NULL;
    }

    if ((pvData = (LPVOID) LocalAlloc(LMEM_FIXED, uiSize)) == NULL) {
        MessageBox(ghwndMain, GetStringRes(IDS_MALLOCFAIL),
            GetStringRes(IDS_ERROR), MB_OK);
        bSuccess = FALSE;
        goto ErrorExit3;
    }

    if (!(uiSize = GetMetaFileBitsEx(hmf, uiSize, pvData))) {
        MessageBox(ghwndMain, GetStringRes(IDS_GETMFBTSXFAIL2),
            GetStringRes(IDS_ERROR), MB_OK);
        bSuccess = FALSE;
        goto ErrorExit3;
    }

    DeleteMetaFile(hmf);

    hDCDrawSurf = GetDC(ghwndDrawSurf);
    hemf = SetWinMetaFileBits(uiSize, (LPBYTE)pvData, hDCDrawSurf, NULL);
    ghmf = SetMetaFileBitsEx(uiSize, (LPBYTE) pvData);

    LocalFree(pvData);

    ReleaseDC(ghwndDrawSurf ,hDCDrawSurf);

HLM_EXIT:
ErrorExit3:
    UnmapViewOfFile(pMapFile);

ErrorExit2:
    CloseHandle(hMapFile);
ErrorExit1:
    CloseHandle(hFile);

    if (bSuccess)
        return hemf;
    else
        return 0L;
}

BOOL InitializeApp ( void )

Definition at line 949 of file MfEdit.c.

{
    WNDCLASS wc;
    int index;
    HDC hDC;

    wc.style            = CS_DBLCLKS;
    wc.lpfnWndProc      = (WNDPROC)MainWndProc;
    wc.cbClsExtra       = 0;
    wc.cbWndExtra   = sizeof(DWORD_PTR);
    wc.hInstance        = ghModule;
    wc.hIcon            = LoadIcon(ghModule, MAKEINTRESOURCE(APP_ICON));
    wc.hCursor          = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground    = (HBRUSH)(COLOR_APPWORKSPACE + 1);
    wc.lpszMenuName     = "MainMenu";
    wc.lpszClassName    = "MetafDemoClass";

    if (!RegisterClass(&wc))
    return FALSE;

    wc.style            = CS_OWNDC | CS_SAVEBITS;
    wc.lpfnWndProc      = (WNDPROC)DrawSurfWndProc;
    wc.hIcon            = NULL;
    wc.hCursor          = NULL;
    wc.hbrBackground    = (HBRUSH)(COLOR_WINDOW + 1);
    wc.lpszMenuName     = NULL;
    wc.lpszClassName    = "DrawSurfClass";

    if (!RegisterClass(&wc))
    return FALSE;

    wc.style        = CS_OWNDC | CS_HREDRAW | CS_VREDRAW;
    wc.lpfnWndProc  = (WNDPROC)TextWndProc;
    wc.hIcon        = NULL;
    wc.hCursor          = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground    = (HBRUSH)(COLOR_BTNFACE + 1);
    wc.lpszMenuName = NULL;
    wc.lpszClassName    = "Text";

    if (!RegisterClass(&wc))
            return FALSE;

    hMenu   = LoadMenu(ghModule, "MainMenu");

    for (index = 0; index < OD_BTN_CNT; index++) {
        ghBmpDn[index] = (PVOID)LoadBitmap(ghModule, (LPCSTR)MAKEINTRESOURCE(BMID_BASED+index));
        ghBmpUp[index] = (PVOID)LoadBitmap(ghModule, (LPCSTR)MAKEINTRESOURCE(BMID_BASEU+index));
    }
    for (index = 0; index < OD_TOOL_CNT; index++) {
        ghToolBmpDn[index] = (PVOID)LoadBitmap(ghModule, (LPCSTR)MAKEINTRESOURCE(BMID_TOOLBASED+index));
        ghToolBmpUp[index] = (PVOID)LoadBitmap(ghModule, (LPCSTR)MAKEINTRESOURCE(BMID_TOOLBASEU+index));

    }

    ghwndMain = CreateWindowEx(0L,
            GetStringRes(IDS_MFDEMOCL), GetStringRes2(IDS_EMF),
        WS_OVERLAPPED   | WS_CAPTION     | WS_BORDER       |
        WS_THICKFRAME   | WS_MAXIMIZEBOX | WS_MINIMIZEBOX  |
        WS_CLIPCHILDREN | WS_VISIBLE     | WS_SYSMENU,
            80, 70, 600, 300,
        NULL, hMenu, ghModule, NULL);

    if (ghwndMain == NULL)
    return FALSE;

    SetWindowLongPtr(ghwndMain, GWLP_USERDATA, 0L);
    ghwndNext = SetClipboardViewer(ghwndMain);

    if (gbFit2Wnd)
        CheckMenuItem(hMenu, MM_FIT2WND, MF_CHECKED);
    else
        CheckMenuItem(hMenu, MM_FIT2WND, MF_UNCHECKED);

    if (gbImport3X)
        CheckMenuItem(hMenu, MM_IMPORT_3X, MF_CHECKED);
    else
        CheckMenuItem(hMenu, MM_IMPORT_3X, MF_UNCHECKED);

    if (gbExport3X)
        CheckMenuItem(hMenu, MM_EXPORT_3X, MF_CHECKED);
    else
        CheckMenuItem(hMenu, MM_EXPORT_3X, MF_UNCHECKED);

    SetFocus(ghwndMain);    /* set initial focus */

    gDib.ulFiles = gDib.ulFrames = 0;
    hDC = GetDC(NULL);
    ghHT = CreateHalftonePalette(hDC);
    ReleaseDC(NULL, hDC);

    return TRUE;
}

int CALLBACK iTT | ( | LPLOGFONT | lpLF,
 |  | LPTEXTMETRIC | lpTM,
 |  | DWORD | dwFontType,
 |  | LPARAM | lpData
 | ) |  |

Definition at line 5651 of file MfEdit.c.

{

    if (lpTM->tmPitchAndFamily & TMPF_TRUETYPE) {
        //OutputDebugString("TRUETYPE\n");
        *((BOOL *)lpData) = TRUE;
    } else {
        //OutputDebugString("NON-TRUETYPE\n");
        *((BOOL *)lpData) = FALSE;
    }

#if 0
    //
    // that's equivalent
    //
    if (dwFontType & TRUETYPE_FONTTYPE) {
        //OutputDebugString("TRUETYPE\n");
        *((BOOL *)lpData) = TRUE;
    } else {
        //OutputDebugString("NON-TRUETYPE\n");
        *((BOOL *)lpData) = FALSE;
    }
#endif
    return 0;

    UNREFERENCED_PARAMETER (lpLF);
    //UNREFERENCED_PARAMETER (lpTM);
    UNREFERENCED_PARAMETER (dwFontType);

}

LONG lProcessDIDClear ( VOID )

Definition at line 2566 of file MfEdit.c.

{
    HDC     hDCDrawSurf;
    HGDIOBJ hObjOld;
    RECT    rcDrawSurf;

    SetWindowText(ghTextWnd, GetStringRes(IDS_DRAWSFCLR));
    hDCDrawSurf = GetDC(ghwndDrawSurf);
    ghbrAppBkgd = CreateSolidBrush(GetSysColor(COLOR_WINDOW));
    hObjOld = SelectObject(hDCDrawSurf, ghbrAppBkgd);
    GetClientRect(ghwndDrawSurf, &rcDrawSurf);
    PatBlt(hDCDrawSurf, 0, 0, rcDrawSurf.right, rcDrawSurf.bottom, PATCOPY);
    ReleaseDC(ghwndDrawSurf, hDCDrawSurf);
    SelectObject(hDCDrawSurf, hObjOld);
    return 0L;
}

LONG lProcessDIDFf ( BOOL * pbReset )

Definition at line 2465 of file MfEdit.c.

{
    HDC         hDCDrawSurf;
    ENHMETAHEADER   EnhMetaHdr;
    RECT        rcClientDS;
    static int      iRecord = 0;
    PLAYINFO        PlayInfo;
    int         iEntries;
    PLOGPALETTE     plogPal;
    PBYTE       pjTmp;
    HPALETTE        hPal=NULL;
    static BOOL     bInitRC = FALSE;
    static BOOL     bRCSet = FALSE;
    BOOL        bHasPFD = FALSE;

    if (ghMetaf == 0)
    return 0L;

    PlayInfo.iRecord = ++iRecord;
    PlayInfo.bPlayContinuous = TRUE;

    GetEnhMetaFileHeader(ghMetaf, sizeof(EnhMetaHdr), &EnhMetaHdr);
    SetDlgItemInt(ghwndCtrlPanel, DID_COUNTER, iRecord, FALSE);
    if ((EnhMetaHdr.nRecords > 1) && (iRecord <= (INT)EnhMetaHdr.nRecords)) {
    hDCDrawSurf = GetDC(ghwndDrawSurf);

    iEntries = GetEnhMetaFilePaletteEntries(ghMetaf, 0, NULL);

    if (iEntries) {
        if ((plogPal = (PLOGPALETTE)GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT,
            sizeof(DWORD) + sizeof(PALETTEENTRY)*iEntries )) == NULL) {
        MessageBox(ghwndMain, GetStringRes(IDS_CREPALFAIL),
                    GetStringRes(IDS_ERROR), MB_OK);
        }
            else {
        plogPal->palVersion = 0x300;
        plogPal->palNumEntries = (WORD) iEntries;
        pjTmp = (PBYTE) plogPal;
        pjTmp += 4;

        GetEnhMetaFilePaletteEntries(ghMetaf, iEntries, (PPALETTEENTRY)pjTmp);
        hPal = CreatePalette(plogPal);
        GlobalFree(plogPal);

        SelectPalette(hDCDrawSurf, hPal, FALSE);
        RealizePalette(hDCDrawSurf);
        }
    }

        if (!bInitRC) {
            bRCSet = bSetRC2MatchEmfRC(hDCDrawSurf, EnhMetaHdr, ghMetaf, NULL);
            bInitRC = TRUE;
            if (!bRCSet) {
                vErrOut("lProcessDIDFf failed");
            }
        }

    if (gbFit2Wnd) {
        GetClientRect(ghwndDrawSurf, &rcClientDS);
        EnumEnhMetaFile(hDCDrawSurf, ghMetaf, (ENHMFENUMPROC)bPlayRecord, (LPVOID) &PlayInfo, (LPRECT) &rcClientDS);
    } else {
        EnumEnhMetaFile(hDCDrawSurf, ghMetaf, (ENHMFENUMPROC)bPlayRecord, (LPVOID) &PlayInfo, (LPRECT) &EnhMetaHdr.rclBounds);
    }
    //
    // Enabling the user to record a metafile records selectively
    //
    if ((gbRecording) && (ghDCMetaf != NULL) && (hPal != NULL)) {
        SelectPalette(ghDCMetaf, hPal, FALSE);
        RealizePalette(ghDCMetaf);
        EnumEnhMetaFile(ghDCMetaf, ghMetaf, (ENHMFENUMPROC)bPlayRecord, (LPVOID) &PlayInfo, (LPRECT)&EnhMetaHdr.rclBounds);
    }

    ReleaseDC(ghwndDrawSurf, hDCDrawSurf);
    }

    if ((iRecord == (INT) EnhMetaHdr.nRecords) || *pbReset) {
    iRecord = 0;
    if (*pbReset)
        SetDlgItemInt(ghwndCtrlPanel, DID_COUNTER, 0, FALSE);
    *pbReset = FALSE;

        if (bRCSet) {
            bCleanUpRC();
            bRCSet = FALSE;
        }

        bInitRC = FALSE;
    }
    return 0L;
}

LONG lProcessDIDOpen | ( | HWND | hwnd,
 |  | CHAR * | szLoadedMetaf,
 |  | BOOL * | pbReset
 | ) |  |

Definition at line 2054 of file MfEdit.c.

{
    ENHMETAHEADER EnhMetaHdr;
    HENHMETAFILE  hEmfTmp;

    SetWindowText(ghTextWnd, GetStringRes(IDS_LDMF));
    //
    // If user hit cancel, we still have the original metafile
    //
    //DeleteEnhMetaFile(ghMetaf);
    //ghMetaf = hemfLoadMetafile(hwnd);
    hEmfTmp = hemfLoadMetafile(hwnd);
    if (hEmfTmp != 0) {
    char     szDesc[MAX_ARRAYSIZE];

    if (ghMetaf != (HENHMETAFILE)NULL)
            DeleteEnhMetaFile(ghMetaf);
    ghMetaf = CopyEnhMetaFile(hEmfTmp, NULL);
    GetEnhMetaFileHeader(ghMetaf, sizeof(EnhMetaHdr), &EnhMetaHdr);
    SetDlgItemInt(ghwndCtrlPanel, DID_COUNTER, EnhMetaHdr.nRecords, FALSE);
    DeleteEnhMetaFile(hEmfTmp);
    EnableMenuItem(hMenu, MM_COPY,  MF_ENABLED);
    if (GetEnhMetaFileDescription(ghMetaf, 256, szDesc) != 0) {
        char    szText[MAX_ARRAYSIZE];
        char    *szTmp, szSource[MAX_ARRAYSIZE];

        szTmp = (char *)strtok(szDesc, "\\0");
        strncpy(szSource, szTmp, MAX_ARRAYSIZE - 1);
    szSource [MAX_ARRAYSIZE - 1] = '\0';
        szTmp = (char *)strtok(NULL, "\\0\\0");
        _sntprintf(szText, MAX_ARRAYSIZE - 1, "Source: %s  Title: %s", szSource, szTmp);
    szText [MAX_ARRAYSIZE - 1] = '\0';
        SetWindowText(ghTextWnd, szText);
        strncpy ( szLoadedMetaf, szTmp, MAX_ARRAYSIZE - 1);
    szLoadedMetaf [MAX_ARRAYSIZE - 1] = '\0';
    } else {
        strncpy (szLoadedMetaf, "", MAX_ARRAYSIZE - 1 );
    szLoadedMetaf [MAX_ARRAYSIZE - 1] = '\0';
    }
    //} else {
    //    SetDlgItemInt(ghwndCtrlPanel, DID_COUNTER, 0, FALSE);
    }
    *pbReset = TRUE;
    return 0L;
}

LONG lProcessDIDPlay ( char * szLoadedMetaf )

Definition at line 2312 of file MfEdit.c.

{
    HDC                     hDCDrawSurf;
    ENHMETAHEADER           EnhMetaHdr;
    RECT                    rcClientDS;
    int                     iEntries;
    PLOGPALETTE             plogPal;
    PBYTE                   pjTmp;
    HPALETTE                hPal=NULL;
    char                    szTmp[MAX_ARRAYSIZE];
    BOOL            bRCSet = FALSE;
#ifdef OPENGL_EMF
    PIXELFORMATDESCRIPTOR   pfd;
#endif
    BOOL                    bHasPFD = TRUE;

    _sntprintf(szTmp, MAX_ARRAYSIZE - 1, GetStringRes(IDS_FMT_PLAYMF), szLoadedMetaf);
  szTmp [MAX_ARRAYSIZE - 1] = '\0';
    SetWindowText(ghTextWnd, szTmp);
    if (ghMetaf != NULL) {
    hDCDrawSurf = GetDC(ghwndDrawSurf);
    GetEnhMetaFileHeader(ghMetaf, sizeof(ENHMETAHEADER), &EnhMetaHdr);

    iEntries = GetEnhMetaFilePaletteEntries(ghMetaf, 0, NULL);

    if (iEntries) {
        if ((plogPal = (PLOGPALETTE)GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT,
            sizeof(DWORD) + sizeof(PALETTEENTRY)*iEntries )) == NULL) {
        MessageBox(ghwndMain, GetStringRes(IDS_CREPALFAIL),
                    GetStringRes(IDS_ERROR), MB_OK);
        }
            else {
        plogPal->palVersion = 0x300;
        plogPal->palNumEntries = (WORD) iEntries;
        pjTmp = (PBYTE) plogPal;
        pjTmp += 4;

        GetEnhMetaFilePaletteEntries(ghMetaf, iEntries, (PPALETTEENTRY)pjTmp);
        hPal = CreatePalette(plogPal);
        GlobalFree(plogPal);

        SelectPalette(hDCDrawSurf, hPal, FALSE);
        RealizePalette(hDCDrawSurf);
            }
    }

#ifdef OPENGL_EMF
        bRCSet = bSetRC2MatchEmfRC(hDCDrawSurf, EnhMetaHdr, ghMetaf, &pfd);
        bHasPFD = (pfd.nSize != 0) ? TRUE : FALSE;
        if (!bRCSet) {
            vErrOut("lProcessDIDPlay (DspDC) failed");
        }
#endif
    if (gbFit2Wnd) {
        GetClientRect(ghwndDrawSurf, &rcClientDS);
        if (!PlayEnhMetaFile( hDCDrawSurf, ghMetaf, (LPRECT) &rcClientDS)) {
        char    text[128];

        _sntprintf(text, 127, GetStringRes(IDS_FMT_PLAYEMFFAIL), GetLastError());
    text [127] = '\0';
        OutputDebugString(text);
        } else {
                if (gbDB)
                   SwapBuffers(hDCDrawSurf);
            }
    } else {
        RECT rc;

        rc.top = rc.left = 0;
        rc.right = EnhMetaHdr.rclBounds.right - EnhMetaHdr.rclBounds.left;
        rc.bottom = EnhMetaHdr.rclBounds.bottom - EnhMetaHdr.rclBounds.top;
        if (!PlayEnhMetaFile( hDCDrawSurf, ghMetaf, (LPRECT) &rc)) {
        char    text[128];

        _sntprintf(text, 127, GetStringRes(IDS_FMT_PLAYEMFFAIL), GetLastError());
    text [127] = '\0';
        OutputDebugString(text);
        } else {
                if (gbDB)
                   SwapBuffers(hDCDrawSurf);
            }
    }

        if (bRCSet) {
            bCleanUpRC();
            bRCSet = FALSE;
        }

    //
    // Enabling the user to embed another metafile
    //
    if ((gbRecording) && (ghDCMetaf != NULL)) {
        if (hPal != (HPALETTE)NULL) {
        SelectPalette(ghDCMetaf, hPal, FALSE);
        RealizePalette(ghDCMetaf);
        }

#ifdef OPENGL_EMF
            if (EnhMetaHdr.bOpenGL && !gbRCSet) {
                char        text[128];

                bRCSet = bSetupRC(ghDCMetaf, (bHasPFD ? &pfd : NULL));
                _sntprintf(text,127,
                         "lProcessDIDPlay: (MetaDC) bRCSet=%ld, bHasPFD=%ld",
                         bRCSet, bHasPFD);
        text [127] = '\0';
                vErrOut(text);
            }
#endif
        {
        RECT rc;

        rc.top = rc.left = 0;
        rc.right = EnhMetaHdr.rclBounds.right - EnhMetaHdr.rclBounds.left;
        rc.bottom = EnhMetaHdr.rclBounds.bottom - EnhMetaHdr.rclBounds.top;
        if (!PlayEnhMetaFile( ghDCMetaf, ghMetaf, (LPRECT) &rc)) {
        char    text[128];

        _sntprintf(text, 127, GetStringRes(IDS_FMT_PLAYEMFFAIL), GetLastError());
    text [127] = '\0';
        OutputDebugString(text);
        } else {
                if (gbDB)
                   SwapBuffers(ghDCMetaf);
            }

            if (bRCSet) {
                bCleanUpRC();
            }

        }
    }

    ReleaseDC(ghwndDrawSurf, hDCDrawSurf);
    } else {
    SetWindowText(ghTextWnd, GetStringRes(IDS_NOMFFORPLAY));
    }

    return 0L;
}

LONG lProcessDIDPlayStep | ( | WPARAM | wParam,
 |  | INT * | piPlus
 | ) |  |

Definition at line 1195 of file MfEdit.c.

{
    HDC           hDCDrawSurf;
    ENHMETAHEADER EnhMetaHdr;
    RECT          rcClientDS;
    int           iRecord;
    PLAYINFO      PlayInfo;
    BOOL          bRCSet = FALSE;

    if (ghMetaf == 0)
        return 0L;

    GetEnhMetaFileHeader(ghMetaf, sizeof(EnhMetaHdr), &EnhMetaHdr);
    iRecord = LOWORD(wParam) - DID_ZERO + *piPlus;
    SetDlgItemInt(ghwndCtrlPanel, DID_COUNTER, iRecord, FALSE);
    PlayInfo.iRecord = iRecord;
    PlayInfo.bPlayContinuous = FALSE;
    *piPlus = 0;

    if ((EnhMetaHdr.nRecords > 1) && (iRecord > 0) &&
        (iRecord <= (INT) EnhMetaHdr.nRecords)) {
        hDCDrawSurf = GetDC(ghwndDrawSurf);

        bRCSet = bSetRC2MatchEmfRC(hDCDrawSurf, EnhMetaHdr, ghMetaf, NULL);
        if (!bRCSet) {
            vErrOut("lProcessDIDPlayStep failed");
        }

        if (gbFit2Wnd) {
            GetClientRect(ghwndDrawSurf, &rcClientDS);
            EnumEnhMetaFile(hDCDrawSurf, ghMetaf, (ENHMFENUMPROC)bPlayRecord, (LPVOID) &PlayInfo, &rcClientDS);
        } else {
            EnumEnhMetaFile(hDCDrawSurf, ghMetaf, (ENHMFENUMPROC)bPlayRecord, (LPVOID) &PlayInfo, (LPRECT)&EnhMetaHdr.rclBounds);
        }
        //
        // Enabling the user to record a metafile record selectively
        //

        if ((gbRecording) && (ghDCMetaf != NULL)) {
            EnumEnhMetaFile(ghDCMetaf, ghMetaf, (ENHMFENUMPROC)bPlayRecord, (LPVOID) &PlayInfo, (LPRECT)&EnhMetaHdr.rclBounds);
        }

        if (bRCSet) {
            bCleanUpRC();
        }

        ReleaseDC(ghwndDrawSurf, hDCDrawSurf);
    }
    return 0L;
}

LONG lProcessDIDPlayTenPlus ( INT * piPlus )

Definition at line 1256 of file MfEdit.c.

{
    if (ghMetaf == 0)
        return 0L;

    *piPlus += 10;
    SetDlgItemInt(ghwndCtrlPanel, DID_COUNTER, *piPlus, FALSE);
    return 0L;
}

LONG lProcessDIDRec | ( | HWND | hwnd,
 |  | INT * | piMetafCnt,
 |  | char * | szFilename
 | ) |  |

Definition at line 2176 of file MfEdit.c.

{
    int  iWidthMM, iHeightMM, iWidthPels, iHeightPels, iMMPerPelX, iMMPerPelY;
    char szComment[MAX_ARRAYSIZE];
    char szTitle[MAX_ARRAYSIZE];
    RECT rc;
    HDC  hDC;

    if (gbHitTest) {
    SetWindowText(ghTextWnd, GetStringRes(IDS_MUSTESCHTSTMD));
    return 0L;
    }

    SetWindowText(ghTextWnd, GetStringRes(IDS_REC));
    if (!gbRecording) {

    hDC = GetDC(hwnd);
    iWidthMM    = GetDeviceCaps(hDC, HORZSIZE);
    iHeightMM   = GetDeviceCaps(hDC, VERTSIZE);
    iWidthPels  = GetDeviceCaps(hDC, HORZRES);
    iHeightPels = GetDeviceCaps(hDC, VERTRES);
    ReleaseDC(hwnd, hDC);
    iMMPerPelX  = (iWidthMM * 100)/iWidthPels;
    iMMPerPelY  = (iHeightMM * 100)/iHeightPels;
    GetClientRect(ghwndDrawSurf, &rc);
    rc.left   = rc.left * iMMPerPelX;
    rc.top    = rc.top * iMMPerPelY;
    rc.right  = rc.right * iMMPerPelX;
    rc.bottom = rc.bottom * iMMPerPelY;

    {
       char szFilenameWithExt[MAX_ARRAYSIZE];
       char suffix[20];
       char szDesc[MAX_ARRAYSIZE];
       char *szTmp, szTmp2[MAX_ARRAYSIZE];

       //
       // assemble a new metafile name with the emf extension from
       // the generic szFilename
       //
       _sntprintf((LPSTR) suffix, 19, "%d.emf", *piMetafCnt);
     suffix [19] = '\0';
       (*piMetafCnt)++;
       strncpy(szFilenameWithExt, szFilename, MAX_ARRAYSIZE - 1);
       szFilenameWithExt [MAX_ARRAYSIZE - 1] = '\0'; // make sure its null terminated for strlen
       suffix [19] = '\0'; // make sure its null terminated for strlen
       if ((strlen(szFilenameWithExt)+strlen(suffix))/sizeof(char) >= MAX_ARRAYSIZE) // safe: both strings are null terminated
           return 0L;
       else
           strncat(szFilenameWithExt, suffix, sizeof (szFilenameWithExt) - strlen (szFilenameWithExt));
       //
       // parse szFilename for the title for description
       //
       szTmp = (char *)strtok(szFilename, "\\");
       strncpy( szTmp2, szTmp, MAX_ARRAYSIZE - 1);
     szTmp2 [MAX_ARRAYSIZE - 1] = '\0';
       while (szTmp != NULL) {
           szTmp = (char *)strtok(NULL, "\\");
           if (szTmp != NULL) {
            strncpy( szTmp2, szTmp, MAX_ARRAYSIZE - 1);
      szTmp2 [MAX_ARRAYSIZE - 1] = '\0';
           }
       }
       szTmp = (char *)strtok(szTmp2, ".");
       strncpy(szTitle, szTmp, MAX_ARRAYSIZE - 1);
     szTitle [MAX_ARRAYSIZE - 1] = '\0';
       _sntprintf(szDesc, MAX_ARRAYSIZE - 1, "SDK Enhanced Metafile Editor\\0%s\\0\\0", szTitle);
       szDesc [MAX_ARRAYSIZE - 1] = '\0';
     ghDCMetaf = CreateEnhMetaFile((HDC)NULL, szFilenameWithExt, (LPRECT)&rc, (LPSTR)szDesc);
           if (gb3D)
                bSetupRC(ghDCMetaf, NULL);
    }

        bSetAdvancedGraphics(ghDCMetaf);
    }

    if (ghDCMetaf == NULL) {
       SetWindowText(ghTextWnd, GetStringRes(IDS_CREMFDCFAIL));
       return 0L;
    }
    _sntprintf((LPSTR) szComment, MAX_ARRAYSIZE - 1,"MfEdit:\\0%s\\0\\0", szTitle);
  szComment [MAX_ARRAYSIZE - 1] = '\0';
#if 0
    if (!GdiComment(ghDCMetaf, 256, szComment)) {
    MessageBox(ghwndMain, GetStringRes(IDS_ADDCMNTFAIL),
            GetStringRes(IDS_ERROR), MB_OK);
    }
#endif
    gbRecording = TRUE;

    if (ghpnCur != NULL)
    SelectObject(ghDCMetaf, ghpnCur);

    if (ghbrCur != NULL)
    SelectObject(ghDCMetaf, ghbrCur);

    if (ghCurFont != NULL)
    SelectObject(ghDCMetaf, ghCurFont);

    return 0L;
}

LONG lProcessDIDStop ( VOID )

Definition at line 2290 of file MfEdit.c.

{
    SetWindowText(ghTextWnd, GetStringRes(IDS_STOP));
    if (gbRecording) {
        if (gb3D && gbRCSet)
            bCleanUpRC();
    ghMetaf = CloseEnhMetaFile(ghDCMetaf);
    gbRecording = FALSE;
    }
    return 0L;
}

LONG lProcessMMAbout ( VOID )

Definition at line 1986 of file MfEdit.c.

{
    if (DialogBox(ghModule, "AboutBox", ghwndMain, (DLGPROC)About) == -1)
       MessageBox(ghwndMain, GetStringRes(IDS_DLGABOUTCREFAIL),
            GetStringRes(IDS_ERROR), MB_OK);
    return 0L;
}

LONG lProcessMMBrush ( HWND hwnd )

Definition at line 1796 of file MfEdit.c.

{
    HDC     hDC;
    static DWORD   dwRGB=RGB(255, 255, 255);

    if (bChooseNewColor(hwnd, &dwRGB)) {
        hDC = GetDC(ghwndDrawSurf);
        if (ghbrCur != NULL)
            DeleteObject(ghbrCur);
        ghbrCur = hBrCreateBrush(hDC, dwRGB);
        SelectObject(hDC, ghbrCur);
        if (ghDCMetaf != NULL)
            SelectObject(ghDCMetaf, ghbrCur);
        ReleaseDC(ghwndDrawSurf, hDC);
    }
    return 0L;
}

LONG lProcessMMCopy ( VOID )

Definition at line 1276 of file MfEdit.c.

{
    if ((ghMetaf == 0) && (ghmf == 0)) {
        SetWindowText(ghTextWnd, GetStringRes(IDS_NOMFFORCPY));
        return 0L;
    }

    OpenClipboard(ghwndMain);
    EmptyClipboard();

    if (gbExport3X)
    {
        HGLOBAL         hmem;
        LPMETAFILEPICT  lpmfp;
        RECT            rcClientDS;
        DWORD           x, y, mm;
        HDC             hDCDrawSurf;
        LPBYTE          pjData;
        UINT            uiSize;

        hDCDrawSurf = GetDC(ghwndDrawSurf);

        if (ghmf == 0) {
            SetWindowText(ghTextWnd, GetStringRes(IDS_CNVEMFTO3X));

            if (!(uiSize = GetWinMetaFileBits(ghMetaf, 0, NULL, MM_ANISOTROPIC, hDCDrawSurf))) {
                MessageBox(ghwndMain, GetStringRes(IDS_GETWMFBTSFAIL),
                    GetStringRes(IDS_ERROR), MB_OK);
                goto COPY_3X_EXIT;
            }

            if ((pjData = (LPBYTE) LocalAlloc(LMEM_FIXED, uiSize)) == NULL) {
                MessageBox(ghwndMain, GetStringRes(IDS_MALLOCFAIL),
                    GetStringRes(IDS_ERROR), MB_OK);
                goto COPY_3X_EXIT;
            }

            if (!(uiSize = GetWinMetaFileBits(ghMetaf, uiSize, pjData, MM_ANISOTROPIC, hDCDrawSurf))) {
                MessageBox(ghwndMain, GetStringRes(IDS_GETWMFBTSFAIL2),
                    GetStringRes(IDS_ERROR), MB_OK);
                LocalFree(pjData);
                goto COPY_3X_EXIT;
            }

            ghmf = SetMetaFileBitsEx(uiSize, (LPBYTE) pjData);
            LocalFree(pjData);
        }

        if ((hmem = GlobalAlloc(GMEM_ZEROINIT | GMEM_MOVEABLE | GMEM_DDESHARE,
                            sizeof(METAFILEPICT))) == NULL) {

            SetWindowText(ghTextWnd, GetStringRes(IDS_MALLOCFAIL2));
            goto COPY_3X_EXIT;

        }

        lpmfp = (LPMETAFILEPICT)GlobalLock(hmem);
        lpmfp->mm = mm = MM_ANISOTROPIC;

        GetClientRect(ghwndDrawSurf, &rcClientDS);
        x = rcClientDS.right - rcClientDS.left;
        x *= 2540;
        x /= GetDeviceCaps(hDCDrawSurf, LOGPIXELSX);
        lpmfp->xExt = x;                                // ie. in 0.01mm

        y = rcClientDS.bottom - rcClientDS.top;
        y *= 2540;
        y /= GetDeviceCaps(hDCDrawSurf, LOGPIXELSY);
        lpmfp->yExt = y;                                // ie. in 0.01mm

        lpmfp->hMF = CopyMetaFile(ghmf, NULL);

        GlobalUnlock(hmem);
        SetWindowText(ghTextWnd, GetStringRes(IDS_CPY3XMFTOCLP));
        SetClipboardData(CF_METAFILEPICT, hmem);

COPY_3X_EXIT:
        ReleaseDC(ghwndDrawSurf, hDCDrawSurf);
        goto COPY_EXIT;

    }

    //
    // gbExport3X == FALSE
    //
    if (ghMetaf == 0)           // requires conversion
    {
        UINT            uiSize;
        LPVOID          pvData;
        HDC             hDCDrawSurf;

        SetWindowText(ghTextWnd, "Converting 3X Metafile to Enhanced Metafile format");
        if (!(uiSize = GetMetaFileBitsEx(ghmf, 0, NULL))) {
            MessageBox(ghwndMain, GetStringRes(IDS_GETMFBTSXFAIL),
                GetStringRes(IDS_ERROR), MB_OK);
            SetWindowText(ghTextWnd, GetStringRes(IDS_CNVFAIL));
            goto COPY_EXIT;
        }

        if ((pvData = (LPVOID) LocalAlloc(LMEM_FIXED, uiSize)) == NULL) {
            MessageBox(ghwndMain, GetStringRes(IDS_MALLOCFAIL),
                GetStringRes(IDS_ERROR), MB_OK);
            SetWindowText(ghTextWnd, GetStringRes(IDS_CNVFAIL));
            goto COPY_EXIT;
        }

        if (!(uiSize = GetMetaFileBitsEx(ghmf, uiSize, pvData))) {
            MessageBox(ghwndMain, GetStringRes(IDS_GETWMFBTSFAIL2X),
                GetStringRes(IDS_ERROR), MB_OK);
            goto COPY_ENH_EXIT;
        }

        hDCDrawSurf = GetDC(ghwndDrawSurf);

        // !!! provide the correct picture extents in the METAFILEPICT structure
        // where possible
        ghMetaf = SetWinMetaFileBits(uiSize, (LPBYTE)pvData, hDCDrawSurf, NULL);

COPY_ENH_EXIT:
        LocalFree(pvData);
        ReleaseDC(ghwndDrawSurf ,hDCDrawSurf);

        if (ghMetaf == 0) {
            SetWindowText(ghTextWnd, GetStringRes(IDS_CNVFAIL));
            goto COPY_EXIT;
        }

    }

    //
    // No Conversion required
    //
    {

        HENHMETAFILE hEmfTmp;

        hEmfTmp = CopyEnhMetaFile(ghMetaf, NULL);

        if (hEmfTmp) {
            SetWindowText(ghTextWnd, GetStringRes(IDS_CPYEMFTOCLP));
            SetClipboardData(CF_ENHMETAFILE, hEmfTmp);
            DeleteEnhMetaFile(hEmfTmp);
        }

    }

COPY_EXIT:

    CloseClipboard();
    return 0L;
}

LONG lProcessMMDel ( VOID )

Definition at line 1750 of file MfEdit.c.

{
    OpenClipboard(ghwndMain);
    EmptyClipboard();
    CloseClipboard();
    return 0L;
}

LONG lProcessMMExport3X ( VOID )

Definition at line 2614 of file MfEdit.c.

{
    gbExport3X = (gbExport3X ? FALSE : TRUE);

    if (gbExport3X)
    CheckMenuItem(hMenu, MM_EXPORT_3X, MF_CHECKED);
    else
    CheckMenuItem(hMenu, MM_EXPORT_3X, MF_UNCHECKED);
    return 0L;
}

LONG lProcessMMFit2Wnd ( VOID )

Definition at line 2635 of file MfEdit.c.

{
    gbFit2Wnd = (gbFit2Wnd ? FALSE : TRUE);

    if (gbFit2Wnd)
    CheckMenuItem(hMenu, MM_FIT2WND, MF_CHECKED);
    else
    CheckMenuItem(hMenu, MM_FIT2WND, MF_UNCHECKED);
    return 0L;
}

LONG lProcessMMFont ( VOID )

Definition at line 1824 of file MfEdit.c.

{
    HDC     hDC;
    char    text[128];

    if (bChooseNewFont(ghwndMain, &glf, &gCrText)) {
        ghCurFont = CreateFontIndirect(&glf);

        hDC = GetDC(ghwndDrawSurf);
        EnumFonts(hDC, glf.lfFaceName, (FONTENUMPROC)iTT, (LPARAM)&gbTT);
        _sntprintf(text, 127, "gbTT = %d\n", gbTT);
    text [127] = '\0';
        //OutputDebugString(text);
        ReleaseDC(ghwndDrawSurf, hDC);

        if (ghDCMetaf != NULL)
            SelectObject(ghDCMetaf, ghCurFont);
    }
    return 0L;
}

LONG lProcessMMHittest ( VOID )

Definition at line 1931 of file MfEdit.c.

{
    static BOOL bHitTest=FALSE;
    HWND    hwndRecBtn;

    bHitTest = (bHitTest ? FALSE : TRUE);
    hwndRecBtn = GetDlgItem(ghwndCtrlPanel, DID_RECORD);
    if (bHitTest) {
    CheckMenuItem(hMenu, MM_HITTEST, MF_CHECKED);
    EnableMenuItem(hMenu, MM_RECORD, MF_GRAYED);
    EnableWindow(hwndRecBtn, FALSE);
    gbHitTest = TRUE;
    } else {
    CheckMenuItem(hMenu, MM_HITTEST, MF_UNCHECKED);
    EnableMenuItem(hMenu, MM_RECORD, MF_ENABLED);
    EnableWindow(hwndRecBtn, TRUE);
    gbHitTest = FALSE;
    return 0L;
    }

    if (ghMetaf == 0) {
    SetWindowText(ghTextWnd, GetStringRes(IDS_NOMFLDFORHTST));
    return 0L;
    }
    return 0L;
}

LONG lProcessMMImport3X ( VOID )

Definition at line 2593 of file MfEdit.c.

{
    gbImport3X = (gbImport3X ? FALSE : TRUE);

    if (gbImport3X)
    CheckMenuItem(hMenu, MM_IMPORT_3X, MF_CHECKED);
    else
    CheckMenuItem(hMenu, MM_IMPORT_3X, MF_UNCHECKED);
    return 0L;
}

LONG lProcessMMLEAbout ( VOID )

Definition at line 1968 of file MfEdit.c.

{
    if (DialogBox(ghModule, (LPCSTR)"AboutBox", ghwndMain, (DLGPROC)About) == -1)
    MessageBox(ghwndMain, GetStringRes(IDS_DLGABOUTCREFAIL),
            GetStringRes(IDS_ERROR), MB_OK);
    return 0L;
}

LONG lProcessMMLoadBmp ( HWND hwnd )

Definition at line 2021 of file MfEdit.c.

{
    SetWindowText(ghTextWnd, GetStringRes(IDS_LDBM));
    bGetBMP(hwnd, FALSE);
    return 0L;
}

LONG lProcessMMLoadMaskBmp ( HWND hwnd )

Definition at line 2004 of file MfEdit.c.

{
    SetWindowText(ghTextWnd, GetStringRes(IDS_LDMSKBM));
    bGetBMP(hwnd, TRUE);
    return 0L;
}

LONG lProcessMMMltfmts ( VOID )

Definition at line 1900 of file MfEdit.c.

{
    CMTMLTFMT *pMfmt;

    if ((gbRecording) && (ghDCMetaf != NULL)) {
    if ((pMfmt = pLoadMltFmtFile()) != NULL) {
        GdiComment(ghDCMetaf,
               sizeof(CMTMLTFMT)+pMfmt->aemrformat[0].cbData,
               (CONST BYTE *) pMfmt);
        Free(pMfmt);
    }
    else
        MessageBox(ghwndMain,
                       GetStringRes(IDS_LDMFMTFILEFAIL),
               GetStringRes(IDS_ERROR),
               MB_OK);
    }

    return 0L;
}

LONG lProcessMMPaste | ( | HWND | hwnd,
 |  | BOOL * | pbReset
 | ) |  |

!! use memcpy...

Definition at line 1438 of file MfEdit.c.

{

    OpenClipboard(ghwndMain);

    if (gbImport3X)
    {
        HANDLE      hmem;
        DWORD       dwXSugExt, dwYSugExt, dwMM;
        HDC         hDCDrawSurf;
        RECT        rc;
        INT         iSavedDC;

        hmem = GetClipboardData(CF_METAFILEPICT);

        if (hmem)
        {
            LPMETAFILEPICT lpmfp;

            SetWindowText(ghTextWnd, GetStringRes(IDS_PST3XMF));
            lpmfp = (LPMETAFILEPICT)GlobalLock(hmem);
            ghmf  = lpmfp->hMF;
            dwMM  = lpmfp->mm;
            dwXSugExt = lpmfp->xExt;        // in 0.01 mm
            dwYSugExt = lpmfp->yExt;
            GlobalUnlock(hmem);

            hDCDrawSurf = GetDC(ghwndDrawSurf);

            iSavedDC = SaveDC(hDCDrawSurf);

            GetClientRect(ghwndDrawSurf, &rc);

            SetMapMode(hDCDrawSurf, dwMM);
            if ((dwXSugExt > 0 )&& (dwYSugExt > 0))
            {                               // suggested width & height of image
                DWORD x;
                DWORD y;

                // no. of pixels in x and y
                x = dwXSugExt;
                x *= GetDeviceCaps(hDCDrawSurf,LOGPIXELSX);
                x /= 2540;

                y = dwYSugExt;
                y *= GetDeviceCaps(hDCDrawSurf,LOGPIXELSY);
                y /= 2540;

                SetWindowExtEx(hDCDrawSurf, x, y, NULL);

                if (gbFit2Wnd)
                    SetViewportExtEx(hDCDrawSurf, rc.right, rc.bottom, NULL);
                else
                    SetViewportExtEx(hDCDrawSurf, x, y, NULL);

            } else {
                SetWindowText(ghTextWnd, GetStringRes(IDS_NOINFO3XMFX));
                SetWindowExtEx(hDCDrawSurf, rc.right, rc.bottom, NULL);
                SetViewportExtEx(hDCDrawSurf, rc.right, rc.bottom, NULL);
            }

            SetViewportOrgEx(hDCDrawSurf, 0, 0, NULL);
            SetWindowOrgEx(hDCDrawSurf, 0, 0, NULL);

            SetBoundsRect(hDCDrawSurf, NULL, DCB_ENABLE | DCB_SET);
            PlayMetaFile(hDCDrawSurf, ghmf);
            {
            UINT    uiRC;
            char    text[128];

            _sntprintf(text, 127,"dwMM = %d\n", dwMM);
      text [127] = '\0';
            OutputDebugString(text);
            _sntprintf(text, 127,"dwXSugExt = %d\n", dwXSugExt);
      text [127] = '\0';
            OutputDebugString(text);
            _sntprintf(text, 127,"dwYSugExt = %d\n", dwYSugExt);
      text [127] = '\0';
            OutputDebugString(text);
            uiRC = GetBoundsRect(hDCDrawSurf, &rc, DCB_RESET); // in logical coordinates
            _sntprintf(text, 127,"GetBoundsRect = %d\n", uiRC);
      text [127] = '\0';
            OutputDebugString(text);
            _sntprintf(text, 127,"left     = %d\n", rc.left);
      text [127] = '\0';
            OutputDebugString(text);
            _sntprintf(text, 127, "right    = %d\n", rc.right);
      text [127] = '\0';
            OutputDebugString(text);
            _sntprintf(text, 127, "top      = %d\n", rc.top);
            text [127] = '\0';
      OutputDebugString(text);
            _sntprintf(text, 127,"bottom   = %d\n", rc.bottom);
            text [127] = '\0';
      OutputDebugString(text);
            }

// !!!
// saving the wmf as an Aldus mf
//
{
OPENFILENAME    ofn;
char            szFile[MAX_ARRAYSIZE], szFileTitle[MAX_ARRAYSIZE];
static char     *szFilter;
UINT            uiSize;
HANDLE          hFile, hMapFile;
LPVOID          pMapFile;
DWORD           dwHigh, dwLow;

BuildFilterStrs(-1);
szFilter = BuildFilterStrs(IDS_FT_WMF);
strncpy ( szFile, "*.wmf\0", MAX_ARRAYSIZE - 1);
szFile [MAX_ARRAYSIZE - 1] = '\0';
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = hwnd;
ofn.lpstrFilter = szFilter;
ofn.lpstrCustomFilter = (LPSTR) NULL;
ofn.nMaxCustFilter = 0L;
ofn.nFilterIndex = 1;
ofn.lpstrFile = szFile;
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFileTitle = szFileTitle;
ofn.nMaxFileTitle = sizeof(szFileTitle);
ofn.lpstrInitialDir = NULL;
ofn.lpstrTitle = GetStringRes(IDS_SAVEMF);
ofn.Flags = 0L;
ofn.nFileOffset = 0;
ofn.nFileExtension = 0;
ofn.lpstrDefExt = "WMF";

if (!GetOpenFileName(&ofn))
    return 0L;

uiSize = GetMetaFileBitsEx(ghmf, 0, NULL);
dwHigh = 0;
dwLow  = uiSize;

if ((hFile = CreateFile(szFile, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL,
        CREATE_ALWAYS, SECURITY_SQOS_PRESENT | SECURITY_ANONYMOUS, NULL)) == INVALID_HANDLE_VALUE) {
    MessageBox(ghwndMain, GetStringRes(IDS_FILEOPNFAIL),
        GetStringRes(IDS_ERROR), MB_OK);
    return 0L;
}
if ( GetFileType(hFile) != FILE_TYPE_DISK )
{
        CloseHandle(hFile);
        return 0L;
}

//
// Create a map file of the opened file
//
if ((hMapFile = CreateFileMapping(hFile, NULL,
                         PAGE_READWRITE, dwHigh, dwLow, "MapF")) == NULL) {
    MessageBox(ghwndMain, GetStringRes(IDS_MAPFCREFAIL),
        GetStringRes(IDS_ERROR), MB_OK);
    goto ErrorExit1;
}

//
// Map a view of the whole file
//
if ((pMapFile = MapViewOfFile(hMapFile, FILE_MAP_WRITE, 0, 0, uiSize)) == NULL) {
    MessageBox(ghwndMain, GetStringRes(IDS_MAPVWMAPFOFAIL),
        GetStringRes(IDS_ERROR), MB_OK);
    goto ErrorExit2;
}

if (uiSize) {
    APMFILEHEADER   AldHdr;
    PAPMFILEHEADER  pAldHdr;
    PBYTE           pjTmp;
    INT             iSize;
    char            text[128];

    AldHdr.key = ALDUS_ID;
    AldHdr.hmf = 0;                                 // Unused; must be zero
    AldHdr.bbox.Left   = 0;                         // in metafile units
    AldHdr.bbox.Top    = 0;
    //AldHdr.bbox.Right  = rc.right - rc.left;        // in logical coordinates
    //AldHdr.bbox.Bottom = rc.bottom - rc.top;

    switch (dwMM) {
        case MM_HIENGLISH:
            AldHdr.inch = 1000;
            AldHdr.bbox.Right  = (SHORT)dwXSugExt;
            AldHdr.bbox.Bottom = (SHORT)dwYSugExt;
            break;
        case MM_HIMETRIC:
            AldHdr.inch = 1440;
            AldHdr.bbox.Right  = (SHORT)(dwXSugExt / 2540 * 1440);
            AldHdr.bbox.Bottom = (SHORT)(dwYSugExt / 2540 * 1440);
            break;
        case MM_LOENGLISH:
            AldHdr.inch = 100;
            AldHdr.bbox.Right  = (SHORT)dwXSugExt;
            AldHdr.bbox.Bottom = (SHORT)dwYSugExt;
            break;
        case MM_LOMETRIC:
            AldHdr.inch = 254;
            AldHdr.bbox.Right  = (SHORT)dwXSugExt;
            AldHdr.bbox.Bottom = (SHORT)dwYSugExt;
            break;
        case MM_TEXT:
            AldHdr.inch = (WORD) (GetDeviceCaps(hDCDrawSurf, HORZRES) * 25.4 /
                          GetDeviceCaps(hDCDrawSurf, HORZSIZE));
            AldHdr.bbox.Right  = (SHORT)dwXSugExt;
            AldHdr.bbox.Bottom = (SHORT)dwYSugExt;
            break;
        case MM_TWIPS:
            AldHdr.inch = 1440;
            AldHdr.bbox.Right  = (SHORT)dwXSugExt;
            AldHdr.bbox.Bottom = (SHORT)dwYSugExt;
            break;
        default:
            AldHdr.inch = 1440;
            AldHdr.bbox.Right  = (SHORT)(dwXSugExt / 2540 * 1440);
            AldHdr.bbox.Bottom = (SHORT)(dwYSugExt / 2540 * 1440);
            break;
    }

    _sntprintf(text,127, "MM           = %d\n", dwMM);
  text [127] = '\0';
    OutputDebugString(text);
    _sntprintf(text, 127, "AldHdr.inch  = %d\n", AldHdr.inch);
  text [127] = '\0';
    OutputDebugString(text);

    AldHdr.reserved = 0;
    AldHdr.checksum = 0;
    {
    WORD    *p;

    for (p = (WORD *)&AldHdr, AldHdr.checksum = 0;
            p < (WORD *)&(AldHdr.checksum); ++p)
        AldHdr.checksum ^= *p;
    }

    pAldHdr = &AldHdr;
    pjTmp = (PBYTE)pMapFile;

    iSize = 22;

    //!!! use memcpy...
    while (iSize--) {
        *(((PBYTE)pjTmp)++) = *(((PBYTE)pAldHdr)++);
    }

    pMapFile = (PBYTE)pMapFile + 22;
    GetMetaFileBitsEx(ghmf, uiSize, pMapFile);
}

UnmapViewOfFile(pMapFile);

ErrorExit2:
  CloseHandle(hMapFile);
ErrorExit1:
  CloseHandle(hFile);
}

            RestoreDC(hDCDrawSurf, iSavedDC);
            ReleaseDC(ghwndDrawSurf, hDCDrawSurf);

        } else {
            SetWindowText(ghTextWnd, GetStringRes(IDS_GET3XFRMCLPFAIL));
        }

        goto PASTE_EXIT;

    }

    //
    // gbImport3X == FALSE
    //
    {
        HENHMETAFILE hEmfTmp;
        ENHMETAHEADER EnhMetaHdr;

        hEmfTmp = GetClipboardData(CF_ENHMETAFILE);
        if (hEmfTmp) {
            SetWindowText(ghTextWnd, GetStringRes(IDS_PSTEMF));
            if (ghMetaf != (HENHMETAFILE)NULL)
                DeleteEnhMetaFile(ghMetaf);
            ghMetaf = CopyEnhMetaFile(hEmfTmp, NULL);
            DeleteEnhMetaFile(hEmfTmp);
            GetEnhMetaFileHeader(ghMetaf, sizeof(EnhMetaHdr), &EnhMetaHdr);
            SetDlgItemInt(ghwndCtrlPanel, DID_COUNTER, EnhMetaHdr.nRecords, FALSE);
            *pbReset = TRUE;
        } else {
            SetWindowText(ghTextWnd, GetStringRes(IDS_GETEMFFROMCLPFAIL));
        }
    }
PASTE_EXIT:

    CloseClipboard();
    EnableMenuItem(hMenu, MM_COPY,  MF_ENABLED);
    return 0L;
}

LONG lProcessMMPen ( HWND hwnd )

Definition at line 1768 of file MfEdit.c.

{
    HDC     hDC;
    DWORD   dwRGB;

    if (bChooseNewColor(hwnd, &dwRGB)) {
        hDC = GetDC(ghwndDrawSurf);
        if (ghpnCur != NULL)
            DeleteObject(ghpnCur);
        ghpnCur = CreatePen(PS_SOLID, 1, dwRGB);
        SelectObject(hDC, ghpnCur);
        if (ghDCMetaf != NULL)
            SelectObject(ghDCMetaf, ghpnCur);
        ReleaseDC(ghwndDrawSurf, hDC);
    }
    return 0L;
}

LONG lProcessMMPolyDraw ( VOID )

Definition at line 1879 of file MfEdit.c.

{
    gbPDOutln = (gbPDOutln ? FALSE : TRUE);
    if (gbPDOutln) {
        CheckMenuItem(hMenu, MM_TTOUTLN_STROKEFILL, MF_UNCHECKED);
        CheckMenuItem(hMenu, MM_TTOUTLN_POLYDRAW, MF_CHECKED);
        gbSFOutln = FALSE;
    }
    return 0L;
}

LONG lProcessMMPrint ( VOID )

Definition at line 2656 of file MfEdit.c.

{
    DWORD   dwThrdID;
    HANDLE  hThrd;
    PPRTDATA pPrtData;

    if (ghMetaf == 0) {
    SetWindowText(ghTextWnd, GetStringRes(IDS_NOMFFORPRT));
    return 0L;
    }

    //
    // bPrintMf is supposed to free up the memory when done.
    //
    if ((pPrtData = (PPRTDATA) GlobalAlloc(GPTR, sizeof(PRTDATA))) == NULL) {
    SetWindowText(ghTextWnd, GetStringRes(IDS_MALLOCFAIL2));
    return 0L;
    }

    pPrtData->hMetaf = ghMetaf;
    pPrtData->bFit2Wnd = gbFit2Wnd;

    hThrd = CreateThread(NULL, 0,
         (LPTHREAD_START_ROUTINE)bPrintMf,
         pPrtData, STANDARD_RIGHTS_REQUIRED,
         &dwThrdID);

    //
    // Free the memory if CreateThread fails...
    //
    if (hThrd == NULL) {
    SetWindowText(ghTextWnd, GetStringRes(IDS_CREPRTTHRDFAIL));
    GlobalFree(pPrtData);
    }

    return 0L;
}

LONG lProcessMMRec | ( | HWND | hwnd,
 |  | CHAR * | szFilename
 | ) |  |

Definition at line 2110 of file MfEdit.c.

{
    if (gbHitTest) {
    SetWindowText(ghTextWnd, GetStringRes(IDS_MUSTESCHTSTMD));
    return 0L;
    }

    SetWindowText(ghTextWnd, GetStringRes(IDS_REC));
    if (!gbRecording) {
    ghDCMetaf = hDCRecordMetafileAs(hwnd, szFilename);
    }

    if (ghDCMetaf == NULL) {
       SetWindowText(ghTextWnd, GetStringRes(IDS_CREMFDCFAIL));
       return 0L;
    }

    // Parse the szFilename for the title and GdiComment the metafile with it.
    {
    char    szComment[MAX_ARRAYSIZE];
    char    *szTmp, szTmp2[MAX_ARRAYSIZE];

    szTmp = (char *)strtok(szFilename, "\\");
    strncpy( szTmp2, szTmp, MAX_ARRAYSIZE -1 );
  szTmp2 [MAX_ARRAYSIZE - 1] = '\0';
    while (szTmp != NULL) {
        szTmp = (char *)strtok(NULL, "\\");
        if (szTmp != NULL) {
        strncpy( szTmp2, szTmp, MAX_ARRAYSIZE -1 );
    szTmp2 [MAX_ARRAYSIZE - 1] = '\0';
        }
    }
    szTmp = (char *)strtok(szTmp2, ".");
    _sntprintf((LPSTR) szComment,MAX_ARRAYSIZE - 1, "MfEdit:\\0%s\\0\\0", szTmp);
  szComment [MAX_ARRAYSIZE - 1] = '\0';
#if 0
    if (!GdiComment(ghDCMetaf, 256, szComment)) {
        MessageBox(ghwndMain, GetStringRes(IDS_ADDCMNTFAIL),
                GetStringRes(IDS_ERROR), MB_OK);
    }
#endif
    }

    gbRecording = TRUE;

    if (ghpnCur != NULL)
    SelectObject(ghDCMetaf, ghpnCur);

    if (ghbrCur != NULL)
    SelectObject(ghDCMetaf, ghbrCur);

    if (ghCurFont != NULL)
    SelectObject(ghDCMetaf, ghCurFont);
    return 0L;
}

LONG lProcessMMSaveBmp ( VOID )

Definition at line 2038 of file MfEdit.c.

{
    SetWindowText(ghTextWnd, GetStringRes(IDS_SVDRAWSFASBM));
    return 0L;
}

LONG lProcessMMStrokeFill ( VOID )

Definition at line 1858 of file MfEdit.c.

{
    gbSFOutln = (gbSFOutln ? FALSE : TRUE);
    if (gbSFOutln) {
        CheckMenuItem(hMenu, MM_TTOUTLN_STROKEFILL, MF_CHECKED);
        CheckMenuItem(hMenu, MM_TTOUTLN_POLYDRAW, MF_UNCHECKED);
        gbPDOutln = FALSE;
    }
    return 0L;
}

LONG_PTR lProcessWmCommand | ( | HWND | hwnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam,
 |  | INT * | piMetafCnt,
 |  | BOOL * | pbReset,
 |  | char * | szFilename,
 |  | char * | szLoadedMetaf
 | ) |  |

Definition at line 2704 of file MfEdit.c.

{
    static int     iPlus=0;

    switch (LOWORD(wParam)) {
        case DID_ZERO:
        case DID_ONE:
        case DID_TWO:
        case DID_THREE:
        case DID_FOUR:
        case DID_FIVE:
        case DID_SIX:
        case DID_SEVEN:
        case DID_EIGHT:
        case DID_NINE:
            return lProcessDIDPlayStep(wParam, &iPlus);

        case DID_TEN_PLUS:
            return lProcessDIDPlayTenPlus(&iPlus);

        case MM_PAGESETUP:
        case MM_CUT:
            return 0L;

        case MM_COPY:
            return lProcessMMCopy();

        case MM_PASTE:
            return lProcessMMPaste(hwnd, pbReset);

        case MM_DEL:
            return lProcessMMDel();

        case MM_PEN:
            return lProcessMMPen(hwnd);

        case MM_BRUSH:
            return lProcessMMBrush(hwnd);

        case MM_FONT:
            return lProcessMMFont();

        case MM_TTOUTLN_STROKEFILL:
            return lProcessMMStrokeFill();

        case MM_TTOUTLN_POLYDRAW:
            return lProcessMMPolyDraw();

        case MM_C_WND_MF:
        return 0L;

        case MM_C_BEGIN_GP:
        case MM_C_END_GP:
        return 0L;

    case MM_C_MLTFMTS:
        return lProcessMMMltfmts();

    case MM_HITTEST:
        return lProcessMMHittest();

    case MM_LEABOUT:
        return lProcessMMLEAbout();

    case MM_ABOUT:
        return lProcessMMAbout();

    case MM_LOAD_MASKBMP:
        return lProcessMMLoadMaskBmp(hwnd);

    case MM_LOAD_BMP:
        return lProcessMMLoadBmp(hwnd);

    case MM_SAVE_BMP:
        return lProcessMMSaveBmp();

        case MM_LOAD:
    case DID_OPEN:
        return lProcessDIDOpen(hwnd, szLoadedMetaf, pbReset);

    case MM_RECORD:
        return lProcessMMRec(hwnd, szFilename);

    case DID_RECORD:
        return lProcessDIDRec(hwnd, piMetafCnt, szFilename);

    case DID_STOP:
        return lProcessDIDStop();

    case DID_PLAY:
        return lProcessDIDPlay(szLoadedMetaf);

    case DID_FF:
        return lProcessDIDFf(pbReset);

    case DID_CLEAR:
        return lProcessDIDClear();

        case DID_PEN:
            SetWindowText(ghTextWnd, "Pen");
            return 0L;
        case DID_TEXT:
            SetWindowText(ghTextWnd, "Text");
            return 0L;
        case DID_RECT:
            SetWindowText(ghTextWnd, "Rectangle");
            return 0L;
        case DID_FILLRECT:
            SetWindowText(ghTextWnd, "Filled Rectangle");
            return 0L;
        case DID_ELLIPSE:
            SetWindowText(ghTextWnd, "Ellipse");
            return 0L;
        case DID_FILLELLIPSE:
            SetWindowText(ghTextWnd, "Filled Ellipse");
            return 0L;
        case DID_LINE:
            SetWindowText(ghTextWnd, "Line");
            return 0L;
        case DID_BEZIER:
            SetWindowText(ghTextWnd,
                "Bezier: Click with Left button for placing control points");
            return 0L;
        case DID_BMPOBJ:
            SetWindowText(ghTextWnd,
                "Bitmap: Click three points for the destination of the bitmap");
            return 0L;
        case DID_METAF:
            SetWindowText(ghTextWnd,
                "External Metafile: Click three points for the destination of the Metafile");
            return 0L;
    case MM_IMPORT_3X:
        return lProcessMMImport3X();

    case MM_EXPORT_3X:
        return lProcessMMExport3X();

    case MM_FIT2WND:
        return lProcessMMFit2Wnd();

    case MM_PRINT:
        return lProcessMMPrint();

    default:
            return DefWindowProc(hwnd, message, wParam, lParam);
    }
}

LONG lProcessWmCreate ( HWND hWnd )

Definition at line 1054 of file MfEdit.c.

{
    SetWindowLongPtr(hWnd, 0, (LONG_PTR)NULL);
    ghDCMem = CreateCompatibleDC(NULL);

    ghwndCtrlPanel = CreateDialog(ghModule,
                                    (LPCSTR)MAKEINTRESOURCE(DID_CTRLPANEL),
                                    hWnd,
                                    (DLGPROC) CtrlPanelDlgProc);

    ghwndDrawSurf = CreateWindow("DrawSurfClass",
                                    NULL,
                                    WS_BORDER | WS_CHILD | WS_VISIBLE,
                                    0, 0, 0, 0,
                                    hWnd,
                                    NULL,
                                    ghModule,
                                    NULL);

    ghTextWnd = CreateWindow("Text",
                                NULL,
                                WS_BORDER | SS_LEFT | WS_CHILD | WS_VISIBLE,
                                0, 0, 0, 0,
                                hWnd,
                                NULL,               //(HMENU) 2,
                                ghModule,
                                NULL);

    ghbrRed     = CreateSolidBrush(RGB(255, 0, 0));
    ghbrAppBkgd = CreateSolidBrush(GetSysColor(COLOR_BACKGROUND));
    ghpnWide    = CreatePen(PS_SOLID, 5, RGB(0, 0, 0));
    return 0L;
}

LONG lProcessWmDestroy ( VOID )

Definition at line 1165 of file MfEdit.c.

{
    if (ghDCMem != (HDC)NULL)
        DeleteDC(ghDCMem);
    if (ghMetaf != (HENHMETAFILE)NULL)
        DeleteEnhMetaFile(ghMetaf);
    DestroyWindow(ghwndCtrlPanel);
    DeleteObject(ghbrRed);
    DeleteObject(ghbrCur);
    DeleteObject(ghpnCur);
    DeleteObject(ghbrAppBkgd);
    DeleteObject(ghpnWide);
    if (ghHT)
        DeleteObject(ghHT);
    ChangeClipboardChain(ghwndMain, ghwndNext);
    bFreeDibFile(&gDib);
    PostQuitMessage(0);
    return 0L;
}

LONG_PTR lProcessWmDrawClip | ( | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 1099 of file MfEdit.c.

{
    if ((IsClipboardFormatAvailable(CF_METAFILEPICT)) ||
        (IsClipboardFormatAvailable(CF_ENHMETAFILE)) )
        EnableMenuItem(hMenu, MM_PASTE, MF_ENABLED);
    else
        EnableMenuItem(hMenu, MM_PASTE,  MF_GRAYED);

    if (ghwndNext)
        SendMessage(ghwndNext, message, wParam, lParam);
    return 0L;
}

LRESULT lProcessWmSize | ( | HWND | hWnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 1122 of file MfEdit.c.

{
    RECT        rc;
    LONG        lcyCtrlPanel, lcyDrawSurf;

    GetWindowRect(ghwndCtrlPanel, &rc);
    lcyCtrlPanel = rc.bottom-rc.top;
    lcyDrawSurf = HIWORD(lParam) - lcyCtrlPanel - glcyStatus;

    //
    // CR!! Alternatively, this window can be created with cy
    //      equals to cy of the screen and saving this call
    //      altogether.
    //
    MoveWindow(ghwndCtrlPanel,
               0, 0, LOWORD(lParam), lcyCtrlPanel, TRUE);

    //
    // This ordering guarantees the text window paints correctly
    //
    MoveWindow(ghTextWnd,
               0, lcyCtrlPanel + lcyDrawSurf,
               LOWORD(lParam),                    // cx of hwnd
               glcyStatus, TRUE);

    MoveWindow(ghwndDrawSurf,
               0, lcyCtrlPanel,
               LOWORD(lParam),                    // cx of hwnd
               lcyDrawSurf, TRUE);

    return DefWindowProc(hWnd, message, wParam, lParam);
}

LONG_PTR APIENTRY MainWndProc | ( | HWND | hwnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 2864 of file MfEdit.c.

{
    static int         iMetafCnt=0;
    static char        szFilename[MAX_ARRAYSIZE] = "c:\\metaf";
    static BOOL        bReset=FALSE;
    static char        szLoadedMetaf[MAX_ARRAYSIZE] = " ";

    switch (message) {

      case WM_CREATE: {
        return lProcessWmCreate(hwnd);
      }
      case WM_DRAWCLIPBOARD: {
        return lProcessWmDrawClip(message, wParam, lParam);
      }
      case WM_SIZE: {
        return lProcessWmSize(hwnd, message, wParam, lParam);
      }

      case WM_DESTROY: {
        return lProcessWmDestroy();
      }
      case WM_COMMAND: {
        return lProcessWmCommand(hwnd,
                                 message,
                                 wParam,
                                 lParam,
                                 &iMetafCnt,
                                 &bReset,
                                 szFilename,
                                 szLoadedMetaf);
      }
      default:
        return DefWindowProc(hwnd, message, wParam, lParam);
    }
}

CMTMLTFMT* pLoadMltFmtFile ( VOID )

Definition at line 5698 of file MfEdit.c.

{
    OPENFILENAME    ofn;
    char            szDirName[MAX_ARRAYSIZE];
    char            szFile[MAX_ARRAYSIZE], szFileTitle[MAX_ARRAYSIZE];
    static char     *szFilter;
    HANDLE          hFile, hMapFile;
    LPVOID          pMapFile;
    DWORD           dwFileSizeLow, dwFileSizeHigh;
    CMTMLTFMT       *pMfmt;

    pMfmt = (CMTMLTFMT*)NULL;

    BuildFilterStrs(-1);
    BuildFilterStrs(IDS_FT_EPS);
    szFilter = BuildFilterStrs(IDS_FT_EMF);

    GetSystemDirectory((LPSTR) szDirName, 256);
    strncpy( szFile, "*.eps\0", MAX_ARRAYSIZE - 1);
  szFile [MAX_ARRAYSIZE - 1] = '\0';
    ofn.lStructSize = sizeof(OPENFILENAME);
    ofn.hwndOwner = GetFocus();
    ofn.lpstrFilter = szFilter;
    ofn.lpstrCustomFilter = (LPSTR) NULL;
    ofn.nMaxCustFilter = 0L;
    ofn.nFilterIndex = 1;
    ofn.lpstrFile = szFile;
    ofn.nMaxFile = sizeof(szFile);
    ofn.lpstrFileTitle = szFileTitle;
    ofn.nMaxFileTitle = sizeof(szFileTitle);
    ofn.lpstrInitialDir = szDirName;
    ofn.lpstrTitle = (LPSTR) NULL;
    ofn.Flags = 0L;
    ofn.nFileOffset = 0;
    ofn.nFileExtension = 0;
    ofn.lpstrDefExt = "EPS";

    if (!GetOpenFileName(&ofn)) {
        goto EXIT;
    }

    if ((hFile = CreateFile(szFile, GENERIC_READ, FILE_SHARE_READ, NULL,
            OPEN_EXISTING, FILE_ATTRIBUTE_READONLY| SECURITY_SQOS_PRESENT | SECURITY_ANONYMOUS,
            NULL)) == INVALID_HANDLE_VALUE) {
        goto EXIT;
    }
    if ( GetFileType(hFile) != FILE_TYPE_DISK )
    {
        goto EXIT2;
    }

    dwFileSizeLow = GetFileSize(hFile, &dwFileSizeHigh);
    if ((dwFileSizeLow == 0xFFFFFFFF) && (GetLastError() != NO_ERROR)) {
        goto EXIT;
    }

    //
    // Create a map file of the opened file
    //
    if ((hMapFile = CreateFileMapping(hFile, NULL,
                             PAGE_READONLY, 0, 0, NULL)) == INVALID_HANDLE_VALUE) {
        goto EXIT2;
    }

    //
    // Map a view of the whole file
    //
    if ((pMapFile = MapViewOfFile(hMapFile, FILE_MAP_READ, 0, 0, 0)) == NULL) {
        goto EXIT3;
    }

//
// CR!! In future, change this to load different def of the picture...
//
  {
    ULONG       ulSize;
    PBYTE       pjTmp;
    RECTL       rectl;

    ulSize = dwFileSizeLow+sizeof(CMTMLTFMT);
    if ((pMfmt = (CMTMLTFMT *) LocalAlloc(LMEM_FIXED, ulSize)) == NULL) {
        MessageBox(GetFocus(), GetStringRes(IDS_MALLOCFAIL),
            GetStringRes(IDS_ERROR), MB_OK);
        goto EXIT3;
    }

    pMfmt->ident = GDICOMMENT_IDENTIFIER;
    pMfmt->iComment = GDICOMMENT_MULTIFORMATS;
    pMfmt->nFormats = 1;
    pMfmt->aemrformat[0].cbData = dwFileSizeLow;
    pMfmt->aemrformat[0].offData = 11*sizeof(DWORD);

    // parse for %!PS-Adobe-3.0 EPSF keyword
    //           Enhanced Metafile signature
    // set EMRFORMAT.dSignature appropiately

    if (((ENHMETAHEADER *) pMapFile)->dSignature == ENHMETA_SIGNATURE) {

        pMfmt->aemrformat[0].dSignature = ENHMETA_SIGNATURE;
        pMfmt->aemrformat[0].nVersion = 0;                    // not for emf
        pMfmt->rclOutput.left   = ((ENHMETAHEADER *) pMapFile)->rclBounds.left;
        pMfmt->rclOutput.top    = ((ENHMETAHEADER *) pMapFile)->rclBounds.top;
        pMfmt->rclOutput.right  = ((ENHMETAHEADER *) pMapFile)->rclBounds.right;
        pMfmt->rclOutput.bottom = ((ENHMETAHEADER *) pMapFile)->rclBounds.bottom;
    }
    else    //assume it is Adobe EPS
    if (bGetEPSBounds(pMapFile, &rectl)) {

        char text[128];

        pMfmt->aemrformat[0].dSignature = 0x46535045;
        pMfmt->aemrformat[0].nVersion = 1;
        pMfmt->rclOutput.left   = rectl.left;
        pMfmt->rclOutput.top    = rectl.top;
        pMfmt->rclOutput.right  = rectl.right;
        pMfmt->rclOutput.bottom = rectl.bottom;

        _sntprintf(text, 127, "Bounds = %d %d %d %d",
                 rectl.left, rectl.top, rectl.right, rectl.bottom);
    text [127] = '\0';
        MessageBox(GetFocus(), text, "Bounds", MB_OK);

    }
    else {
        // unknown file type
        Free(pMfmt);
        pMfmt = NULL;
        goto EXIT3;
    }

    pjTmp = (PBYTE)(((DWORD *)pMfmt->aemrformat)+4);
    while (dwFileSizeLow--) {
        *(((PBYTE)pjTmp)++) = *(((PBYTE)pMapFile)++);
    }

  }

EXIT3:
    CloseHandle(hMapFile);
EXIT2:
    CloseHandle(hFile);
EXIT:

    return pMfmt;
}

BOOL PolyDraw95 | ( | HDC | hdc,
 |  | CONST LPPOINT | lppt,
 |  | CONST LPBYTE | lpbTypes,
 |  | int | cCount
 | ) |  |

Definition at line 141 of file MfEdit.c.

{
  int i;

  for (i=0; i<cCount; i++)
    switch (lpbTypes[i]) {
      case PT_MOVETO :
         MoveToEx(hdc, lppt[i].x, lppt[i].y, NULL);
         break;

      case PT_LINETO | PT_CLOSEFIGURE:
      case PT_LINETO :
         LineTo(hdc, lppt[i].x, lppt[i].y);
         break;

      case PT_BEZIERTO | PT_CLOSEFIGURE:
      case PT_BEZIERTO :
        PolyBezierTo(hdc, &lppt[i], 3);
       i+=2;
         break;
    }

   return TRUE;
}

VOID SaveStaticEntries ( HDC hDC )

Definition at line 404 of file MfEdit.c.

{
    int i;

    if (gbSystemColorsInUse) {
        for (i = COLOR_SCROLLBAR; i <= COLOR_BTNHIGHLIGHT; i++)
            gacrSave[i - COLOR_SCROLLBAR] = GetSysColor(i);

        gbStaticSaved = TRUE;
    }
}

LONG_PTR APIENTRY TextWndProc | ( | HWND | hwnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 3221 of file MfEdit.c.

{
    static HFONT hFont = (HFONT) NULL;

    switch (message)
    {
    case WM_CREATE:
        {
        LOGFONT    lf;
        HDC        hDC;
        HFONT      hOldFont;
            TEXTMETRIC tm;
        //RECT       rect;

            SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(lf), (PVOID) &lf, (UINT)FALSE);

        hDC = GetDC(hwnd);
        // this is the height for 8 point size font in pixels
        lf.lfHeight = 8 * GetDeviceCaps(hDC, LOGPIXELSY) / 72;

        hFont = CreateFontIndirect(&lf);
        hOldFont = SelectObject(hDC, hFont);
        GetTextMetrics(hDC, &tm);

        // base the height of the window on size of text
        glcyStatus = tm.tmHeight+6*GetSystemMetrics(SM_CYBORDER)+2;
            ReleaseDC(hwnd, hDC);
            break;
        }

    case WM_DESTROY:
        if (hFont)
        DeleteObject(hFont);
        break;

    case WM_SETTEXT:
            DefWindowProc(hwnd, message, wParam, lParam);
            InvalidateRect(hwnd,NULL,FALSE);
            UpdateWindow(hwnd);
            return 0L;

    case WM_PAINT:
        {
            PAINTSTRUCT ps;
            RECT   rc;
            char   ach[128];
            int    len, nxBorder, nyBorder;
            HFONT  hOldFont = NULL;

            BeginPaint(hwnd, &ps);

            GetClientRect(hwnd,&rc);

            nxBorder = GetSystemMetrics(SM_CXBORDER);
        rc.left  += 9*nxBorder;
            rc.right -= 9*nxBorder;

            nyBorder = GetSystemMetrics(SM_CYBORDER);
        rc.top    += 3*nyBorder;
        rc.bottom -= 3*nyBorder;

        // 3D Text
            len = GetWindowText(hwnd, ach, sizeof(ach));
        SetBkColor(ps.hdc, GetSysColor(COLOR_BTNFACE));

        SetBkMode(ps.hdc, TRANSPARENT);
        SetTextColor(ps.hdc, RGB(64,96,96));
        if (hFont)
        hOldFont = SelectObject(ps.hdc, hFont);
        ExtTextOut(ps.hdc, rc.left+2*nxBorder+2, rc.top+2, ETO_OPAQUE | ETO_CLIPPED,
                    &rc, ach, len, NULL);

        SetTextColor(ps.hdc, RGB(128,128,128));
        if (hFont)
        hOldFont = SelectObject(ps.hdc, hFont);
        ExtTextOut(ps.hdc, rc.left+2*nxBorder+1, rc.top+1, ETO_CLIPPED,
            &rc, ach, len, NULL);

        SetTextColor(ps.hdc, RGB(255,255,255));
        if (hFont)
        hOldFont = SelectObject(ps.hdc, hFont);
        ExtTextOut(ps.hdc, rc.left+2*nxBorder, rc.top, ETO_CLIPPED,
            &rc, ach, len, NULL);

        SetBkMode(ps.hdc, OPAQUE);

        if (hOldFont)
        SelectObject(ps.hdc, hOldFont);

            EndPaint(hwnd, &ps);
            return 0L;
        }
    }
    return DefWindowProc(hwnd, message, wParam, lParam);
}

void vErrOut ( char errstring[MAX_ERR_STRING] )

Definition at line 179 of file MfEdit.c.

{
    DWORD   dwError, dwThrdId;
    char    str[MAX_ERR_STRING];

    if (gbDebug) {
        dwError = GetLastError();
        dwThrdId = GetCurrentThreadId();
        _sntprintf((LPSTR) str, MAX_ERR_STRING - 1, "%s, tid = %lx, Error code = %d\n",
                 errstring, dwThrdId, dwError);
    str [MAX_ERR_STRING - 1] = '\0';
        OutputDebugString((LPCTSTR)str);
        //MessageBox(GetFocus(), (LPSTR)str, "MfEdit Error", MB_OK);
    }
}

int WINAPI WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nShowCmd
 | ) |  |

Definition at line 875 of file MfEdit.c.

{
    MSG      msg;
    HANDLE   hAccel;
    HMODULE  hMod;
    TCHAR    libPath [MAX_ARRAYSIZE];
    UINT     pathSize;

    ghModule = GetModuleHandle(NULL);

//
// GDI32 may not support the OpenGL enhanced metafile (Win95 doesn't), in
// which case, the entry point doesn't exist, so we will do a GetProcAddress
// instead.
//

//  GDI32.dll should be picked up from the System directory.
    pathSize = GetSystemDirectory ( libPath, MAX_ARRAYSIZE - 1);
    if (!pathSize || (pathSize > MAX_ARRAYSIZE))
    {
        vErrOut("Main: GetSystemDirectory failed");
        return 0;
    }
    libPath [MAX_ARRAYSIZE - 1] = '\0';
    strncat ( libPath, "GDI32.DLL", MAX_ARRAYSIZE - strlen ( libPath ));
    hMod = LoadLibrary( libPath );
    if (hMod != (HMODULE)NULL) {

        gpfnGetEnhMetaFilePixelFormat =
                GetProcAddress(hMod, "GetEnhMetaFilePixelFormat");

        if (gpfnGetEnhMetaFilePixelFormat == (PROC)NULL)
            vErrOut("Main: GetProcAddress(GetEnhMetaFilePixelFormat) failed");

    } else {
        vErrOut("Main: LoadLibrary(GDI32) failed");
    }

    if (!InitializeApp()) {
        MessageBox(ghwndMain,
            GetStringRes(IDS_INITAPPFAIL), GetStringRes(IDS_ERROR), MB_OK);
        return 0;
    }

    if (!(hAccel = LoadAccelerators (ghModule, MAKEINTRESOURCE(ACCEL_ID))))
        MessageBox(ghwndMain,
            GetStringRes(IDS_LOADACCFAIL), GetStringRes(IDS_ERROR), MB_OK);

    while (GetMessage(&msg, NULL, 0, 0)) {
        if (!TranslateAccelerator( ghwndMain, hAccel, &msg) ) {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
    }

    return 1;

    UNREFERENCED_PARAMETER(lpCmdLine);
    UNREFERENCED_PARAMETER(nShowCmd);
    UNREFERENCED_PARAMETER(hInstance);
    UNREFERENCED_PARAMETER(hPrevInstance);
}

Generated on Wed Nov 13 2024 16:53:40 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/Metafile/MfEdit/MfEdit.h File Reference

  • Multimedia
  • Gdi
  • Metafile
  • MfEdit
Classes | Defines | Typedefs | Functions | Variables

MfEdit.h File Reference

Go to the source code of this file.

Classes

struct | _DIBDATA
struct | _FileInfo
struct | _htdata
struct | _metalookup
struct | _playinfo
struct | _PRTDATA
struct | APMFILEHEADER
struct | tagCMTMLTFMT
struct | tagMETA16HEADER

Defines

#define | ACCEL_ID 100
#define | ALDUS_ID 0x9AC6CDD7
#define | APMSIZE 22
#define | APP_ICON 100
#define | BLACK PALETTERGB(0,0,0)
#define | BMID_BASED 1011
#define | BMID_BASEU 2011
#define | BMID_BEZIERD 3008
#define | BMID_BEZIERU 4008
#define | BMID_BMPOBJD 3009
#define | BMID_BMPOBJU 4009
#define | BMID_ELLIPSED 3005
#define | BMID_ELLIPSEU 4005
#define | BMID_FFD 1015
#define | BMID_FFU 2015
#define | BMID_FILLELLIPSED 3006
#define | BMID_FILLELLIPSEU 4006
#define | BMID_FILLRECTD 3004
#define | BMID_FILLRECTU 4004
#define | BMID_LINED 3007
#define | BMID_LINEU 4007
#define | BMID_METAFD 3010
#define | BMID_METAFU 4010
#define | BMID_OPEND 1011
#define | BMID_OPENU 2011
#define | BMID_PEND 3001
#define | BMID_PENU 4001
#define | BMID_PLAYD 1014
#define | BMID_PLAYU 2014
#define | BMID_RECORDD 1012
#define | BMID_RECORDU 2012
#define | BMID_RECTD 3003
#define | BMID_RECTU 4003
#define | BMID_STOPD 1013
#define | BMID_STOPU 2013
#define | BMID_TEXTD 3002
#define | BMID_TEXTU 4002
#define | BMID_TOOLBASED 3001
#define | BMID_TOOLBASEU 4001
#define | CARET_HEIGHT 16
#define | COLOR_USED 1
#define | DARKGRAY RGB(128, 128, 128)
#define | DID_BEZIER 3008
#define | DID_BMPOBJ 3009
#define | DID_CLEAR 1016
#define | DID_COUNTER 1017
#define | DID_CTRLPANEL 100
#define | DID_EIGHT 1008
#define | DID_ELLIPSE 3005
#define | DID_FF 1015
#define | DID_FILLELLIPSE 3006
#define | DID_FILLRECT 3004
#define | DID_FIVE 1005
#define | DID_FOUR 1004
#define | DID_LINE 3007
#define | DID_METAF 3010
#define | DID_NINE 1009
#define | DID_ONE 1001
#define | DID_OPEN 1011
#define | DID_PEN 3001
#define | DID_PLAY 1014
#define | DID_RECORD 1012
#define | DID_RECT 3003
#define | DID_SEVEN 1007
#define | DID_SIX 1006
#define | DID_STOP 1013
#define | DID_TEN_PLUS 1010
#define | DID_TEXT 3002
#define | DID_THREE 1003
#define | DID_TMP 1018
#define | DID_TWO 1002
#define | DID_ZERO 1000
#define | EXACT_MATCH 1
#define | GAMMA_CORRECTION 14
#define | GDICOMMENT_IDENTIFIER 0x43494447
#define | GDICOMMENT_MULTIFORMATS 0x40000004
#define | GET_WM_CTLCOLOR_HDC(wp, lp, msg) (HDC)(wp)
#define | GET_WM_CTLCOLOR_HWND(wp, lp, msg) (HWND)(lp)
#define | GET_WM_CTLCOLOR_TYPE(wp, lp, msg) (WORD)(msg - WM_CTLCOLORMSGBOX)
#define | ID_OD_BTN_BASE 1011
#define | ID_OD_TOOL_BASE 3001
#define | IDS_ADDCMNTFAIL 50
#define | IDS_ALDUSMF 62
#define | IDS_ALLOCPALFAIL 112
#define | IDS_CNVEMFTO3X 20
#define | IDS_CNVFAIL 27
#define | IDS_CPY3XMFTOCLP 25
#define | IDS_CPYEMFTOCLP 28
#define | IDS_CPYPALFAIL 118
#define | IDS_CREMAPFILEFAIL 94
#define | IDS_CREMFDCFAIL 49
#define | IDS_CREPALFAIL 57
#define | IDS_CREPBYTEFAIL 78
#define | IDS_CREPNTFAIL 77
#define | IDS_CREPRTDCFAIL 107
#define | IDS_CREPRTTHRDFAIL 76
#define | IDS_DLGABOUTCREFAIL 41
#define | IDS_DRAWSFCLR 63
#define | IDS_ELLIPSE 68
#define | IDS_EMF 103
#define | IDS_ERROR 39
#define | IDS_ESCPRT 106
#define | IDS_FILEOPNFAIL 33
#define | IDS_FILLELLIPSE 69
#define | IDS_FILLRECT 67
#define | IDS_FM_DIB 82
#define | IDS_FM_EMF 88
#define | IDS_FM_EPS 86
#define | IDS_FM_RLE 84
#define | IDS_FM_WMF 90
#define | IDS_FMT_CREMAPFILEFAIL 135
#define | IDS_FMT_FILEOPNFAIL 134
#define | IDS_FMT_GETMFFAIL 140
#define | IDS_FMT_HIT 131
#define | IDS_FMT_MAPVWMAPFOFAIL 136
#define | IDS_FMT_NOHTST 132
#define | IDS_FMT_PLAYEMFFAIL 133
#define | IDS_FMT_PLAYMF 56
#define | IDS_FMT_PLAYMFFAIL 139
#define | IDS_FMT_SETWMFBTSFAIL 137
#define | IDS_FMT_SETWMFBTSXFAIL 138
#define | IDS_FT_DIB 81
#define | IDS_FT_EMF 87
#define | IDS_FT_EPS 85
#define | IDS_FT_RLE 83
#define | IDS_FT_WMF 89
#define | IDS_GET3XFRMCLPFAIL 36
#define | IDS_GETBNDBOTFAIL 128
#define | IDS_GETBNDLFTFAIL 125
#define | IDS_GETBNDRGTFAIL 127
#define | IDS_GETBNDTOPFAIL 126
#define | IDS_GETEMFFROMCLPFAIL 38
#define | IDS_GETMFBTSXFAIL 97
#define | IDS_GETMFBTSXFAIL2 98
#define | IDS_GETWMFBTSFAIL 21
#define | IDS_GETWMFBTSFAIL2 23
#define | IDS_GETWMFBTSFAIL2X 26
#define | IDS_HFTONEPALNULL 114
#define | IDS_INITAPPFAIL 16
#define | IDS_LDBM 44
#define | IDS_LDMF 46
#define | IDS_LDMFMTFILEFAIL 93
#define | IDS_LDMSK 99
#define | IDS_LDMSKBM 43
#define | IDS_LN 70
#define | IDS_LOADACCFAIL 17
#define | IDS_MALLOCFAIL 22
#define | IDS_MALLOCFAIL2 24
#define | IDS_MALLOCFAILNOHIT 100
#define | IDS_MAPFCREFAIL 34
#define | IDS_MAPVWMAPFOFAIL 35
#define | IDS_MAPVWOFMAPFOFAIL 95
#define | IDS_MFDEMOCL 18
#define | IDS_MSTLBCLKFORBZ 71
#define | IDS_MUST3CLKFORBM 72
#define | IDS_MUST3CLKFORXMF 73
#define | IDS_MUSTESCHTSTMD 47
#define | IDS_MUSTMSKMCHROMEBM 116
#define | IDS_MUSTNOTEOF 124
#define | IDS_NOBMFOREMBED 79
#define | IDS_NOHIT 104
#define | IDS_NOINFO3XMFX 30
#define | IDS_NOMFFORCPY 19
#define | IDS_NOMFFOREMBED 80
#define | IDS_NOMFFORPLAY 61
#define | IDS_NOMFFORPRT 74
#define | IDS_NOMFLDFORHTST 40
#define | IDS_NOMFTOPRT 105
#define | IDS_NOPALENTRYFORCPY 117
#define | IDS_NOTADOBE 122
#define | IDS_NOTDIBBMFILE 96
#define | IDS_NULLPTR 121
#define | IDS_NULLRGNHTSTFAIL 102
#define | IDS_PALNULL 115
#define | IDS_PEN 64
#define | IDS_PRT 108
#define | IDS_PRTTHRDDONE 111
#define | IDS_PST3XMF 29
#define | IDS_PSTEMF 37
#define | IDS_REC 48
#define | IDS_RECT 66
#define | IDS_SAVEMF 32
#define | IDS_SAVEMFAS 92
#define | IDS_SETADVGRPHMDFAIL 129
#define | IDS_SKPTOEOL 123
#define | IDS_STOP 55
#define | IDS_SVDRAWSFASBM 45
#define | IDS_TXT 65
#define | LIGHTGRAY RGB(192, 192, 192)
#define | MAX_ARRAYSIZE 256
#define | MAX_COL_DIST (3*256*256L)
#define | MAX_ERR_STRING 128
#define | MAX_FILE 800
#define | MAX_FRAME 800
#define | MAX_POINTS 256
#define | MAX_POINTS_BMP 3
#define | MAX_POINTS_MF 3
#define | META32_SIGNATURE 0x464D4520
#define | MM_ABOUT 7006
#define | MM_BRUSH 7022
#define | MM_C_BEGIN_GP 7031
#define | MM_C_END_GP 7032
#define | MM_C_MLTFMTS 7033
#define | MM_C_WND_MF 7030
#define | MM_COPY 7008
#define | MM_CUT 7007
#define | MM_DECREASE 7020
#define | MM_DEL 7010
#define | MM_EXPORT_3X 7027
#define | MM_FIT2WND 7025
#define | MM_FONT 7023
#define | MM_HITTEST 7016
#define | MM_IMPORT_3X 7026
#define | MM_INCREASE 7018
#define | MM_INSERT 7015
#define | MM_LEABOUT 7024
#define | MM_LOAD 7001
#define | MM_LOAD_BMP 7011
#define | MM_LOAD_MASKBMP 7013
#define | MM_NORMAL 7019
#define | MM_PAGESETUP 7004
#define | MM_PASTE 7009
#define | MM_PEN 7021
#define | MM_PRINT 7003
#define | MM_PRINTSETUP 7005
#define | MM_RECORD 7002
#define | MM_REMOVE 7014
#define | MM_REPEAT 7017
#define | MM_SAVE_BMP 7012
#define | MM_TTOUTLN_POLYDRAW 7029
#define | MM_TTOUTLN_STROKEFILL 7028
#define | NUM_STATIC_COLORS (COLOR_BTNHIGHLIGHT - COLOR_SCROLLBAR + 1)
#define | OD_BTN_CNT 5
#define | OD_TOOL_CNT 10
#define | SIZEOFCAPTIONTEXT 20
#define | STATIC_COLORS 20
#define | WHITE PALETTERGB(255,255,255)

Typedefs

typedef struct tagCMTMLTFMT | CMTMLTFMT
typedef struct _DIBDATA | DIBDATA
typedef struct _FileInfo | FILEINFO
typedef struct _htdata | HTDATA
typedef struct tagMETA16HEADER | LPMETA16HEADER
typedef struct tagMETA16HEADER | META16HEADER
typedef struct _metalookup | METALOOKUP
typedef APMFILEHEADER * | PAPMFILEHEADER
typedef struct _DIBDATA * | PDIBDATA
typedef struct _FileInfo * | PFILEINFO
typedef struct _playinfo | PLAYINFO
typedef struct _PRTDATA * | PPRTDATA
typedef struct _PRTDATA | PRTDATA

Functions

BOOL CALLBACK | About (HWND, UINT, WPARAM, LPARAM)
BOOL | bChooseNewColor (HWND, LPDWORD)
BOOL | bChooseNewFont (HWND, PLOGFONT, COLORREF *)
BOOL | bCleanUpRC (VOID)
BOOL APIENTRY | bDoHitTest (HDC, LPHANDLETABLE, LPENHMETARECORD, UINT, LPVOID)
BOOL | bDrawStuff (HDC, INT, INT, INT, INT, BOOL, BOOL, BOOL, LPSTR)
BOOL bFreeDibFile (PDIBDATA)
BOOL | bGetBMP (HWND, BOOL)
BOOL | bGetEPSBounds (LPVOID, RECTL *)
BOOL | bGetWord (LPVOID, char *, int *)
BOOL | bGoNextLine (LPVOID, int *)
BOOL | bHitTest (HDC, INT, INT)
BOOL | bIsAdobe (char *szStr)
BOOL | bIsBndBox (char *szStr)
BOOL | bIsEOF (char *szStr)
BOOL | bIsEPS (char *szStr)
BOOL APIENTRY | bPlayRecord (HDC, LPHANDLETABLE, LPENHMETARECORD, UINT, LPVOID)
BOOL | bPlgBlt (HDC, LPPOINT)
BOOL bPrintMf (PPRTDATA)
BOOL | bSelectDIBPal (HDC, LPBITMAPINFO, BOOL)
BOOL | bSetAdvancedGraphics (HDC hdc)
BOOL | bSetupRC (HDC hDC, PIXELFORMATDESCRIPTOR *ppfdIn)
LPTSTR | BuildFilterStrs (int)
HPALETTE | CopyPalette (HPALETTE hPalSrc)
LONG_PTR APIENTRY | CtrlPanelDlgProc (HWND, UINT, WPARAM, LPARAM)
LONG_PTR APIENTRY | DrawSurfWndProc (HWND, UINT, WPARAM, LPARAM)
HLOCAL | Free (CMTMLTFMT *pMfmt)
LPTSTR | GetStringRes (int)
LPTSTR | GetStringRes2 (int)
HBITMAP | hBmpLoadBitmapFile (HDC, PSTR)
HBRUSH | hBrCreateBrush (HDC, DWORD)
HDC | hDCRecordMetafileAs (HWND, LPSTR)
HENHMETAFILE | hemfLoadMetafile (HWND)
BOOL | InitializeApp (void)
int CALLBACK | iTT (LPLOGFONT, LPTEXTMETRIC, DWORD, LPARAM)
LONG_PTR APIENTRY | MainWndProc (HWND, UINT, WPARAM, LPARAM)
CMTMLTFMT * | pLoadMltFmtFile (VOID)
LONG_PTR APIENTRY | TextWndProc (HWND, UINT, WPARAM, LPARAM)

Variables

BOOL | gb3D = FALSE
BOOL | gbDB = FALSE
BOOL | gbDebug = FALSE
BOOL | gbExport3X = FALSE
BOOL | gbFit2Wnd = TRUE
BOOL | gbHitTest = FALSE
BOOL | gbImport3X = FALSE
BOOL | gbPDOutln = FALSE
BOOL | gbRCSet = FALSE
BOOL | gbRecording = FALSE
BOOL | gbSFOutln = FALSE
BOOL | gbTT = FALSE
BOOL | gbUseDIB = FALSE
BOOL | gbUseMfPFD = TRUE
COLORREF | gCrText = 0
DIBDATA gDib
DWORD_PTR | gdwCurCtrl = DID_STOP
DWORD_PTR | gdwCurTool = DID_PEN
HBITMAP | ghBmp = NULL
PVOID | ghBmpDn [OD_BTN_CNT]
HBITMAP | ghBmpMask = NULL
PVOID | ghBmpUp [OD_BTN_CNT]
HBRUSH | ghbrAppBkgd
HBRUSH | ghbrCur = (HBRUSH)NULL
HBRUSH | ghbrRed
HFONT | ghCurFont = (HFONT)NULL
HDC | ghDCMem
HDC | ghDCMetaf = (HDC) NULL
HPALETTE | ghHT = NULL
HENHMETAFILE | ghMetaf = NULL
HMETAFILE | ghmf = NULL
HANDLE ghModule
HPALETTE | ghPal = NULL
HPEN | ghpnCur = (HPEN)NULL
HPEN | ghpnWide
HWND | ghTextWnd = NULL
PVOID | ghToolBmpDn [OD_TOOL_CNT]
PVOID | ghToolBmpUp [OD_TOOL_CNT]
HWND | ghwndClient = NULL
HWND | ghwndCtrlPanel = NULL
HWND | ghwndDrawSurf = NULL
HWND | ghwndMain = NULL
HWND | ghwndNext = NULL
HWND | ghwndTools = NULL
LONG | glcyStatus
LOGFONT | glf
PROC | gpfnGetEnhMetaFilePixelFormat = (PROC)NULL
PVOID | grHwndCtrlBtn [OD_BTN_CNT]
PVOID | grHwndToolBtn [OD_TOOL_CNT]
HMENU | hChildMenu
HMENU | hChildMenuWindow
HMENU | hMenu
HMENU | hMenuWindow
METALOOKUP rgMetaName []

Define Documentation

#define ACCEL_ID 100

Definition at line 184 of file MfEdit.h.

#define ALDUS_ID 0x9AC6CDD7

Definition at line 279 of file MfEdit.h.

#define APMSIZE 22

Definition at line 293 of file MfEdit.h.

#define APP_ICON 100

Definition at line 185 of file MfEdit.h.

#define BLACK PALETTERGB(0,0,0)

Definition at line 539 of file MfEdit.h.

#define BMID_BASED 1011

Definition at line 216 of file MfEdit.h.

#define BMID_BASEU 2011

Definition at line 222 of file MfEdit.h.

#define BMID_BEZIERD 3008

Definition at line 256 of file MfEdit.h.

#define BMID_BEZIERU 4008

Definition at line 267 of file MfEdit.h.

#define BMID_BMPOBJD 3009

Definition at line 257 of file MfEdit.h.

#define BMID_BMPOBJU 4009

Definition at line 268 of file MfEdit.h.

#define BMID_ELLIPSED 3005

Definition at line 253 of file MfEdit.h.

#define BMID_ELLIPSEU 4005

Definition at line 264 of file MfEdit.h.

#define BMID_FFD 1015

Definition at line 221 of file MfEdit.h.

#define BMID_FFU 2015

Definition at line 227 of file MfEdit.h.

#define BMID_FILLELLIPSED 3006

Definition at line 254 of file MfEdit.h.

#define BMID_FILLELLIPSEU 4006

Definition at line 265 of file MfEdit.h.

#define BMID_FILLRECTD 3004

Definition at line 252 of file MfEdit.h.

#define BMID_FILLRECTU 4004

Definition at line 263 of file MfEdit.h.

#define BMID_LINED 3007

Definition at line 255 of file MfEdit.h.

#define BMID_LINEU 4007

Definition at line 266 of file MfEdit.h.

#define BMID_METAFD 3010

Definition at line 258 of file MfEdit.h.

#define BMID_METAFU 4010

Definition at line 269 of file MfEdit.h.

#define BMID_OPEND 1011

Definition at line 217 of file MfEdit.h.

#define BMID_OPENU 2011

Definition at line 223 of file MfEdit.h.

#define BMID_PEND 3001

Definition at line 249 of file MfEdit.h.

#define BMID_PENU 4001

Definition at line 260 of file MfEdit.h.

#define BMID_PLAYD 1014

Definition at line 220 of file MfEdit.h.

#define BMID_PLAYU 2014

Definition at line 226 of file MfEdit.h.

#define BMID_RECORDD 1012

Definition at line 218 of file MfEdit.h.

#define BMID_RECORDU 2012

Definition at line 224 of file MfEdit.h.

#define BMID_RECTD 3003

Definition at line 251 of file MfEdit.h.

#define BMID_RECTU 4003

Definition at line 262 of file MfEdit.h.

#define BMID_STOPD 1013

Definition at line 219 of file MfEdit.h.

#define BMID_STOPU 2013

Definition at line 225 of file MfEdit.h.

#define BMID_TEXTD 3002

Definition at line 250 of file MfEdit.h.

#define BMID_TEXTU 4002

Definition at line 261 of file MfEdit.h.

#define BMID_TOOLBASED 3001

Definition at line 248 of file MfEdit.h.

#define BMID_TOOLBASEU 4001

Definition at line 259 of file MfEdit.h.

#define CARET_HEIGHT 16

Definition at line 281 of file MfEdit.h.

#define COLOR_USED 1

Definition at line 551 of file MfEdit.h.

#define DARKGRAY RGB(128, 128, 128)

Definition at line 14 of file MfEdit.h.

#define DID_BEZIER 3008

Definition at line 241 of file MfEdit.h.

#define DID_BMPOBJ 3009

Definition at line 242 of file MfEdit.h.

#define DID_CLEAR 1016

Definition at line 209 of file MfEdit.h.

#define DID_COUNTER 1017

Definition at line 210 of file MfEdit.h.

#define DID_CTRLPANEL 100

Definition at line 191 of file MfEdit.h.

#define DID_EIGHT 1008

Definition at line 200 of file MfEdit.h.

#define DID_ELLIPSE 3005

Definition at line 238 of file MfEdit.h.

#define DID_FF 1015

Definition at line 208 of file MfEdit.h.

#define DID_FILLELLIPSE 3006

Definition at line 239 of file MfEdit.h.

#define DID_FILLRECT 3004

Definition at line 237 of file MfEdit.h.

#define DID_FIVE 1005

Definition at line 197 of file MfEdit.h.

#define DID_FOUR 1004

Definition at line 196 of file MfEdit.h.

#define DID_LINE 3007

Definition at line 240 of file MfEdit.h.

#define DID_METAF 3010

Definition at line 243 of file MfEdit.h.

#define DID_NINE 1009

Definition at line 201 of file MfEdit.h.

#define DID_ONE 1001

Definition at line 193 of file MfEdit.h.

#define DID_OPEN 1011

Definition at line 204 of file MfEdit.h.

#define DID_PEN 3001

Definition at line 234 of file MfEdit.h.

#define DID_PLAY 1014

Definition at line 207 of file MfEdit.h.

#define DID_RECORD 1012

Definition at line 205 of file MfEdit.h.

#define DID_RECT 3003

Definition at line 236 of file MfEdit.h.

#define DID_SEVEN 1007

Definition at line 199 of file MfEdit.h.

#define DID_SIX 1006

Definition at line 198 of file MfEdit.h.

#define DID_STOP 1013

Definition at line 206 of file MfEdit.h.

#define DID_TEN_PLUS 1010

Definition at line 202 of file MfEdit.h.

#define DID_TEXT 3002

Definition at line 235 of file MfEdit.h.

#define DID_THREE 1003

Definition at line 195 of file MfEdit.h.

#define DID_TMP 1018

Definition at line 211 of file MfEdit.h.

#define DID_TWO 1002

Definition at line 194 of file MfEdit.h.

#define DID_ZERO 1000

Definition at line 192 of file MfEdit.h.

#define EXACT_MATCH 1

Definition at line 550 of file MfEdit.h.

#define GAMMA_CORRECTION 14

Definition at line 552 of file MfEdit.h.

#define GDICOMMENT_IDENTIFIER 0x43494447

Definition at line 536 of file MfEdit.h.

#define GDICOMMENT_MULTIFORMATS 0x40000004

Definition at line 537 of file MfEdit.h.

#define GET_WM_CTLCOLOR_HDC | ( | wp,
 |  | lp,
 |  | msg |
 | ) |  | (HDC)(wp)

Definition at line 274 of file MfEdit.h.

#define GET_WM_CTLCOLOR_HWND | ( | wp,
 |  | lp,
 |  | msg |
 | ) |  | (HWND)(lp)

Definition at line 275 of file MfEdit.h.

#define GET_WM_CTLCOLOR_TYPE | ( | wp,
 |  | lp,
 |  | msg |
 | ) |  | (WORD)(msg - WM_CTLCOLORMSGBOX)

Definition at line 276 of file MfEdit.h.

#define ID_OD_BTN_BASE 1011

Definition at line 203 of file MfEdit.h.

#define ID_OD_TOOL_BASE 3001

Definition at line 233 of file MfEdit.h.

#define IDS_ADDCMNTFAIL 50

Definition at line 60 of file MfEdit.h.

#define IDS_ALDUSMF 62

Definition at line 67 of file MfEdit.h.

#define IDS_ALLOCPALFAIL 112

Definition at line 116 of file MfEdit.h.

#define IDS_CNVEMFTO3X 20

Definition at line 30 of file MfEdit.h.

#define IDS_CNVFAIL 27

Definition at line 37 of file MfEdit.h.

#define IDS_CPY3XMFTOCLP 25

Definition at line 35 of file MfEdit.h.

#define IDS_CPYEMFTOCLP 28

Definition at line 38 of file MfEdit.h.

#define IDS_CPYPALFAIL 118

Definition at line 122 of file MfEdit.h.

#define IDS_CREMAPFILEFAIL 94

Definition at line 99 of file MfEdit.h.

#define IDS_CREMFDCFAIL 49

Definition at line 59 of file MfEdit.h.

#define IDS_CREPALFAIL 57

Definition at line 64 of file MfEdit.h.

#define IDS_CREPBYTEFAIL 78

Definition at line 83 of file MfEdit.h.

#define IDS_CREPNTFAIL 77

Definition at line 82 of file MfEdit.h.

#define IDS_CREPRTDCFAIL 107

Definition at line 112 of file MfEdit.h.

#define IDS_CREPRTTHRDFAIL 76

Definition at line 81 of file MfEdit.h.

#define IDS_DLGABOUTCREFAIL 41

Definition at line 51 of file MfEdit.h.

#define IDS_DRAWSFCLR 63

Definition at line 68 of file MfEdit.h.

#define IDS_ELLIPSE 68

Definition at line 73 of file MfEdit.h.

#define IDS_EMF 103

Definition at line 108 of file MfEdit.h.

#define IDS_ERROR 39

Definition at line 49 of file MfEdit.h.

#define IDS_ESCPRT 106

Definition at line 111 of file MfEdit.h.

#define IDS_FILEOPNFAIL 33

Definition at line 43 of file MfEdit.h.

#define IDS_FILLELLIPSE 69

Definition at line 74 of file MfEdit.h.

#define IDS_FILLRECT 67

Definition at line 72 of file MfEdit.h.

#define IDS_FM_DIB 82

Definition at line 87 of file MfEdit.h.

#define IDS_FM_EMF 88

Definition at line 93 of file MfEdit.h.

#define IDS_FM_EPS 86

Definition at line 91 of file MfEdit.h.

#define IDS_FM_RLE 84

Definition at line 89 of file MfEdit.h.

#define IDS_FM_WMF 90

Definition at line 95 of file MfEdit.h.

#define IDS_FMT_CREMAPFILEFAIL 135

Definition at line 138 of file MfEdit.h.

#define IDS_FMT_FILEOPNFAIL 134

Definition at line 137 of file MfEdit.h.

#define IDS_FMT_GETMFFAIL 140

Definition at line 143 of file MfEdit.h.

#define IDS_FMT_HIT 131

Definition at line 134 of file MfEdit.h.

#define IDS_FMT_MAPVWMAPFOFAIL 136

Definition at line 139 of file MfEdit.h.

#define IDS_FMT_NOHTST 132

Definition at line 135 of file MfEdit.h.

#define IDS_FMT_PLAYEMFFAIL 133

Definition at line 136 of file MfEdit.h.

#define IDS_FMT_PLAYMF 56

Definition at line 63 of file MfEdit.h.

#define IDS_FMT_PLAYMFFAIL 139

Definition at line 142 of file MfEdit.h.

#define IDS_FMT_SETWMFBTSFAIL 137

Definition at line 140 of file MfEdit.h.

#define IDS_FMT_SETWMFBTSXFAIL 138

Definition at line 141 of file MfEdit.h.

#define IDS_FT_DIB 81

Definition at line 86 of file MfEdit.h.

#define IDS_FT_EMF 87

Definition at line 92 of file MfEdit.h.

#define IDS_FT_EPS 85

Definition at line 90 of file MfEdit.h.

#define IDS_FT_RLE 83

Definition at line 88 of file MfEdit.h.

#define IDS_FT_WMF 89

Definition at line 94 of file MfEdit.h.

#define IDS_GET3XFRMCLPFAIL 36

Definition at line 46 of file MfEdit.h.

#define IDS_GETBNDBOTFAIL 128

Definition at line 131 of file MfEdit.h.

#define IDS_GETBNDLFTFAIL 125

Definition at line 128 of file MfEdit.h.

#define IDS_GETBNDRGTFAIL 127

Definition at line 130 of file MfEdit.h.

#define IDS_GETBNDTOPFAIL 126

Definition at line 129 of file MfEdit.h.

#define IDS_GETEMFFROMCLPFAIL 38

Definition at line 48 of file MfEdit.h.

#define IDS_GETMFBTSXFAIL 97

Definition at line 102 of file MfEdit.h.

#define IDS_GETMFBTSXFAIL2 98

Definition at line 103 of file MfEdit.h.

#define IDS_GETWMFBTSFAIL 21

Definition at line 31 of file MfEdit.h.

#define IDS_GETWMFBTSFAIL2 23

Definition at line 33 of file MfEdit.h.

#define IDS_GETWMFBTSFAIL2X 26

Definition at line 36 of file MfEdit.h.

#define IDS_HFTONEPALNULL 114

Definition at line 118 of file MfEdit.h.

#define IDS_INITAPPFAIL 16

Definition at line 26 of file MfEdit.h.

#define IDS_LDBM 44

Definition at line 54 of file MfEdit.h.

#define IDS_LDMF 46

Definition at line 56 of file MfEdit.h.

#define IDS_LDMFMTFILEFAIL 93

Definition at line 98 of file MfEdit.h.

#define IDS_LDMSK 99

Definition at line 104 of file MfEdit.h.

#define IDS_LDMSKBM 43

Definition at line 53 of file MfEdit.h.

#define IDS_LN 70

Definition at line 75 of file MfEdit.h.

#define IDS_LOADACCFAIL 17

Definition at line 27 of file MfEdit.h.

#define IDS_MALLOCFAIL 22

Definition at line 32 of file MfEdit.h.

#define IDS_MALLOCFAIL2 24

Definition at line 34 of file MfEdit.h.

#define IDS_MALLOCFAILNOHIT 100

Definition at line 105 of file MfEdit.h.

#define IDS_MAPFCREFAIL 34

Definition at line 44 of file MfEdit.h.

#define IDS_MAPVWMAPFOFAIL 35

Definition at line 45 of file MfEdit.h.

#define IDS_MAPVWOFMAPFOFAIL 95

Definition at line 100 of file MfEdit.h.

#define IDS_MFDEMOCL 18

Definition at line 28 of file MfEdit.h.

#define IDS_MSTLBCLKFORBZ 71

Definition at line 76 of file MfEdit.h.

#define IDS_MUST3CLKFORBM 72

Definition at line 77 of file MfEdit.h.

#define IDS_MUST3CLKFORXMF 73

Definition at line 78 of file MfEdit.h.

#define IDS_MUSTESCHTSTMD 47

Definition at line 57 of file MfEdit.h.

#define IDS_MUSTMSKMCHROMEBM 116

Definition at line 120 of file MfEdit.h.

#define IDS_MUSTNOTEOF 124

Definition at line 127 of file MfEdit.h.

#define IDS_NOBMFOREMBED 79

Definition at line 84 of file MfEdit.h.

#define IDS_NOHIT 104

Definition at line 109 of file MfEdit.h.

#define IDS_NOINFO3XMFX 30

Definition at line 40 of file MfEdit.h.

#define IDS_NOMFFORCPY 19

Definition at line 29 of file MfEdit.h.

#define IDS_NOMFFOREMBED 80

Definition at line 85 of file MfEdit.h.

#define IDS_NOMFFORPLAY 61

Definition at line 66 of file MfEdit.h.

#define IDS_NOMFFORPRT 74

Definition at line 79 of file MfEdit.h.

#define IDS_NOMFLDFORHTST 40

Definition at line 50 of file MfEdit.h.

#define IDS_NOMFTOPRT 105

Definition at line 110 of file MfEdit.h.

#define IDS_NOPALENTRYFORCPY 117

Definition at line 121 of file MfEdit.h.

#define IDS_NOTADOBE 122

Definition at line 125 of file MfEdit.h.

#define IDS_NOTDIBBMFILE 96

Definition at line 101 of file MfEdit.h.

#define IDS_NULLPTR 121

Definition at line 124 of file MfEdit.h.

#define IDS_NULLRGNHTSTFAIL 102

Definition at line 107 of file MfEdit.h.

#define IDS_PALNULL 115

Definition at line 119 of file MfEdit.h.

#define IDS_PEN 64

Definition at line 69 of file MfEdit.h.

#define IDS_PRT 108

Definition at line 113 of file MfEdit.h.

#define IDS_PRTTHRDDONE 111

Definition at line 115 of file MfEdit.h.

#define IDS_PST3XMF 29

Definition at line 39 of file MfEdit.h.

#define IDS_PSTEMF 37

Definition at line 47 of file MfEdit.h.

#define IDS_REC 48

Definition at line 58 of file MfEdit.h.

#define IDS_RECT 66

Definition at line 71 of file MfEdit.h.

#define IDS_SAVEMF 32

Definition at line 42 of file MfEdit.h.

#define IDS_SAVEMFAS 92

Definition at line 97 of file MfEdit.h.

#define IDS_SETADVGRPHMDFAIL 129

Definition at line 132 of file MfEdit.h.

#define IDS_SKPTOEOL 123

Definition at line 126 of file MfEdit.h.

#define IDS_STOP 55

Definition at line 62 of file MfEdit.h.

#define IDS_SVDRAWSFASBM 45

Definition at line 55 of file MfEdit.h.

#define IDS_TXT 65

Definition at line 70 of file MfEdit.h.

#define LIGHTGRAY RGB(192, 192, 192)

Definition at line 13 of file MfEdit.h.

#define MAX_ARRAYSIZE 256

Definition at line 21 of file MfEdit.h.

#define MAX_COL_DIST (3*256*256L)

Definition at line 544 of file MfEdit.h.

#define MAX_ERR_STRING 128

Definition at line 20 of file MfEdit.h.

#define MAX_FILE 800

Definition at line 19 of file MfEdit.h.

#define MAX_FRAME 800

Definition at line 18 of file MfEdit.h.

#define MAX_POINTS 256

Definition at line 15 of file MfEdit.h.

#define MAX_POINTS_BMP 3

Definition at line 17 of file MfEdit.h.

#define MAX_POINTS_MF 3

Definition at line 16 of file MfEdit.h.

#define META32_SIGNATURE 0x464D4520

Definition at line 278 of file MfEdit.h.

#define MM_ABOUT 7006

Definition at line 153 of file MfEdit.h.

#define MM_BRUSH 7022

Definition at line 169 of file MfEdit.h.

#define MM_C_BEGIN_GP 7031

Definition at line 178 of file MfEdit.h.

#define MM_C_END_GP 7032

Definition at line 179 of file MfEdit.h.

#define MM_C_MLTFMTS 7033

Definition at line 180 of file MfEdit.h.

#define MM_C_WND_MF 7030

Definition at line 177 of file MfEdit.h.

#define MM_COPY 7008

Definition at line 155 of file MfEdit.h.

#define MM_CUT 7007

Definition at line 154 of file MfEdit.h.

#define MM_DECREASE 7020

Definition at line 167 of file MfEdit.h.

#define MM_DEL 7010

Definition at line 157 of file MfEdit.h.

#define MM_EXPORT_3X 7027

Definition at line 174 of file MfEdit.h.

#define MM_FIT2WND 7025

Definition at line 172 of file MfEdit.h.

#define MM_FONT 7023

Definition at line 170 of file MfEdit.h.

#define MM_HITTEST 7016

Definition at line 163 of file MfEdit.h.

#define MM_IMPORT_3X 7026

Definition at line 173 of file MfEdit.h.

#define MM_INCREASE 7018

Definition at line 165 of file MfEdit.h.

#define MM_INSERT 7015

Definition at line 162 of file MfEdit.h.

#define MM_LEABOUT 7024

Definition at line 171 of file MfEdit.h.

#define MM_LOAD 7001

Definition at line 148 of file MfEdit.h.

#define MM_LOAD_BMP 7011

Definition at line 158 of file MfEdit.h.

#define MM_LOAD_MASKBMP 7013

Definition at line 160 of file MfEdit.h.

#define MM_NORMAL 7019

Definition at line 166 of file MfEdit.h.

#define MM_PAGESETUP 7004

Definition at line 151 of file MfEdit.h.

#define MM_PASTE 7009

Definition at line 156 of file MfEdit.h.

#define MM_PEN 7021

Definition at line 168 of file MfEdit.h.

#define MM_PRINT 7003

Definition at line 150 of file MfEdit.h.

#define MM_PRINTSETUP 7005

Definition at line 152 of file MfEdit.h.

#define MM_RECORD 7002

Definition at line 149 of file MfEdit.h.

#define MM_REMOVE 7014

Definition at line 161 of file MfEdit.h.

#define MM_REPEAT 7017

Definition at line 164 of file MfEdit.h.

#define MM_SAVE_BMP 7012

Definition at line 159 of file MfEdit.h.

#define MM_TTOUTLN_POLYDRAW 7029

Definition at line 176 of file MfEdit.h.

#define MM_TTOUTLN_STROKEFILL 7028

Definition at line 175 of file MfEdit.h.

#define NUM_STATIC_COLORS (COLOR_BTNHIGHLIGHT - COLOR_SCROLLBAR + 1)

Definition at line 541 of file MfEdit.h.

#define OD_BTN_CNT 5

Definition at line 190 of file MfEdit.h.

#define OD_TOOL_CNT 10

Definition at line 232 of file MfEdit.h.

#define SIZEOFCAPTIONTEXT 20

Definition at line 182 of file MfEdit.h.

#define STATIC_COLORS 20

Definition at line 547 of file MfEdit.h.

#define WHITE PALETTERGB(255,255,255)

Definition at line 540 of file MfEdit.h.

Typedef Documentation

typedef struct tagCMTMLTFMT CMTMLTFMT
typedef struct _DIBDATA DIBDATA
typedef struct _FileInfo FILEINFO
typedef struct _htdata HTDATA
typedef struct tagMETA16HEADER LPMETA16HEADER
typedef struct tagMETA16HEADER META16HEADER
typedef struct _metalookup METALOOKUP
typedef APMFILEHEADER* PAPMFILEHEADER

Definition at line 292 of file MfEdit.h.

typedef struct _DIBDATA * PDIBDATA
typedef struct _FileInfo * PFILEINFO
typedef struct _playinfo PLAYINFO
typedef struct _PRTDATA * PPRTDATA
typedef struct _PRTDATA PRTDATA

Function Documentation

BOOL CALLBACK About | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 445 of file Generic.C.

{
   static  HFONT hfontDlg;    // Font for dialog text
   static   HFONT hFinePrint; // Font for 'fine print' in dialog
   DWORD   dwVerInfoSize;     // Size of version information block
   LPSTR   lpVersion;         // String pointer to 'version' text
   DWORD   dwVerHnd=0;        // An 'ignored' parameter, always '0'
   UINT    uVersionLen;
   WORD    wRootLen;
   BOOL    bRetCode;
   int     i;
   char    szFullPath[BUFFSIZE];
   char    szResult[BUFFSIZE];
   char    szGetName[BUFFSIZE];
   DWORD dwVersion;
   char  szVersion[40];
   DWORD dwResult;
   HRESULT hRes;

   switch (message) {
        case WM_INITDIALOG:
         ShowWindow (hDlg, SW_HIDE);

         if (PRIMARYLANGID(GetUserDefaultLangID()) == LANG_JAPANESE)
         {
            hfontDlg = CreateFont(14, 0, 0, 0, 0, 0, 0, 0, SHIFTJIS_CHARSET, 0, 0, 0,
                                  VARIABLE_PITCH | FF_DONTCARE, "");
            hFinePrint = CreateFont(11, 0, 0, 0, 0, 0, 0, 0, SHIFTJIS_CHARSET, 0, 0, 0,
                                    VARIABLE_PITCH | FF_DONTCARE, "");
         }
         else
         {
            hfontDlg = CreateFont(14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                  VARIABLE_PITCH | FF_SWISS, "");
            hFinePrint = CreateFont(11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                    VARIABLE_PITCH | FF_SWISS, "");
         }

         CenterWindow (hDlg, GetWindow (hDlg, GW_OWNER));
         GetModuleFileName (hInst, szFullPath, sizeof(szFullPath));

         // Now lets dive in and pull out the version information:
         dwVerInfoSize = GetFileVersionInfoSize(szFullPath, &dwVerHnd);
         if (dwVerInfoSize) {
            LPSTR   lpstrVffInfo;
            HANDLE  hMem;
            hMem = GlobalAlloc(GMEM_MOVEABLE, dwVerInfoSize);
            lpstrVffInfo  = GlobalLock(hMem);
            GetFileVersionInfo(szFullPath, dwVerHnd, dwVerInfoSize, lpstrVffInfo);
            // The below 'hex' value looks a little confusing, but
            // essentially what it is, is the hexidecimal representation
            // of a couple different values that represent the language
            // and character set that we are wanting string values for.
            // 040904E4 is a very common one, because it means:
            //   US English, Windows MultiLingual characterset
            // Or to pull it all apart:
            // 04------        = SUBLANG_ENGLISH_USA
            // --09----        = LANG_ENGLISH
            // --11----        = LANG_JAPANESE
            // ----04E4 = 1252 = Codepage for Windows:Multilingual

            // Use safe string handling
            szGetName[sizeof(szGetName) - 1] = '\0';
            lstrcpyn(szGetName, GetStringRes(IDS_VER_INFO_LANG), sizeof(szGetName) - 1);
            if (szGetName[sizeof(szGetName) - 1] != '\0') {
                return FALSE; // Buffer overflow error
            }

            wRootLen = (WORD) lstrlen(szGetName); // Save this position

            // Set the title of the dialog using safe string handling
            hRes = StringCchCatN(szGetName, sizeof(szGetName), "ProductName", sizeof("ProductName"));
            if (FAILED(hRes)) {
                return FALSE; // Buffer overflow error
            }

            bRetCode = VerQueryValue((LPVOID)lpstrVffInfo,
               (LPSTR)szGetName,
               (LPVOID)&lpVersion,
               (UINT *)&uVersionLen);

            // Notice order of version and string...
            if (PRIMARYLANGID(GetUserDefaultLangID()) == LANG_JAPANESE)
            {
                // Use safe string handling
                hRes = StringCchCopyN(szResult, sizeof(szResult), lpVersion, lstrlen(lpVersion));
                if (FAILED(hRes)) {
                    return FALSE; // Buffer overflow error
                }
                hRes = StringCchCatN(szResult, sizeof(szResult), " ‚Ìƒo[ƒWƒ‡ƒ“î•ñ", sizeof(" ‚Ìƒo[ƒWƒ‡ƒ“î•ñ"));
                if (FAILED(hRes)) {
                    return FALSE; // Buffer overflow error
                }
            }
            else
            {
                // Use safe string handling
                hRes = StringCchCopyN(szResult, sizeof(szResult), "About ", sizeof("About "));
                if (FAILED(hRes)) {
                    return FALSE; // Buffer overflow error
                }
                hRes = StringCchCatN(szResult, sizeof(szResult), lpVersion, lstrlen(lpVersion));
                if (FAILED(hRes)) {
                    return FALSE; // Buffer overflow error
                }
            }

            // -----------------------------------------------------

            SetWindowText (hDlg, szResult);

            // Walk through the dialog items that we want to replace:
            for (i = DLG_VERFIRST; i <= DLG_VERLAST; i++) {
               GetDlgItemText(hDlg, i, szResult, sizeof(szResult));
               szGetName[wRootLen] = (char)0;
               // Use safe sting handling
               hRes = StringCchCatN(szGetName, sizeof(szGetName), szResult, sizeof(szResult));
               if (FAILED(hRes)) {
                   return FALSE; // Buffer overflow error
               }
               uVersionLen   = 0;
               lpVersion     = NULL;
               bRetCode      =  VerQueryValue((LPVOID)lpstrVffInfo,
                  (LPSTR)szGetName,
                  (LPVOID)&lpVersion,
                  (UINT *)&uVersionLen);

               if ( bRetCode && uVersionLen && lpVersion) {
                   // Replace dialog item text with version info
                   // Use safe string handling
                   hRes = StringCchCopyN(szResult, sizeof(szResult), lpVersion, lstrlen(lpVersion));
                   if (FAILED(hRes)) {
                       return FALSE; // Buffer overflow error
                   }
                   SetDlgItemText(hDlg, i, szResult);
               }
               else
               {
                  dwResult = GetLastError();

                  // Use safe string handling
                  hRes = StringCchPrintf(szResult, sizeof(szResult), GetStringRes(IDS_VERSION_ERROR), dwResult);
                  if (FAILED(hRes)) {
                      return FALSE; // Buffer overflow error
                  }

                  SetDlgItemText (hDlg, i, szResult);
               }
               SendMessage (GetDlgItem (hDlg, i), WM_SETFONT,
                  (ULONG_PTR)((i==DLG_VERLAST)?hFinePrint:hfontDlg),
                  TRUE);
            } // for (i = DLG_VERFIRST; i <= DLG_VERLAST; i++)

            GlobalUnlock(hMem);
            GlobalFree(hMem);

         } else {
            // No version information available.
         } // if (dwVerInfoSize)

            SendMessage (GetDlgItem (hDlg, IDC_LABEL), WM_SETFONT,
            (WPARAM)hfontDlg,(LPARAM)TRUE);

         // We are  using GetVersion rather then GetVersionEx
         // because earlier versions of Windows NT and Win32s
         // didn't include GetVersionEx:
         dwVersion = GetVersion();

         if (dwVersion < 0x80000000) {
            // Windows NT
            // Use safe sting handling
            hRes = StringCchPrintf(szVersion, sizeof(szVersion), "Microsoft Windows NT %u.%u (Build: %u)",
                (DWORD)(LOBYTE(LOWORD(dwVersion))),
                (DWORD)(HIBYTE(LOWORD(dwVersion))),
                (DWORD)(HIWORD(dwVersion)) );
            if (FAILED(hRes)) {
                return FALSE; // Buffer overflow error
            }
         } else if (LOBYTE(LOWORD(dwVersion))<4) {
            // Win32s
            // Use safe sting handling
            hRes = StringCchPrintf(szVersion, sizeof(szVersion), "Microsoft Win32s %u.%u (Build: %u)",
                (DWORD)(LOBYTE(LOWORD(dwVersion))),
                (DWORD)(HIBYTE(LOWORD(dwVersion))),
                (DWORD)(HIWORD(dwVersion) & ~0x8000) );
            if (FAILED(hRes)) {
                return FALSE; // Buffer overflow error
            }
         } else {
            // Windows 95
            // Use safe sting handling
            hRes = StringCchPrintf(szVersion, sizeof(szVersion), "Microsoft Windows 95 %u.%u",
                (DWORD)(LOBYTE(LOWORD(dwVersion))),
                (DWORD)(HIBYTE(LOWORD(dwVersion))) );
            if (FAILED(hRes)) {
                return FALSE; // Buffer overflow error
            }
         }

          SetWindowText (GetDlgItem(hDlg, IDC_OSVERSION), szVersion);
         ShowWindow (hDlg, SW_SHOW);
         return (TRUE);

      case WM_COMMAND:
         if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) {
            EndDialog(hDlg, TRUE);
            DeleteObject (hfontDlg);
            DeleteObject (hFinePrint);
            return (TRUE);
         }
         break;
   }

    return FALSE;
}

BOOL bChooseNewColor | ( | HWND | ,
 |  | LPDWORD |
 | ) |  |

Definition at line 5140 of file MfEdit.c.

                                                 {
    static DWORD argbCust[16] = {
        RGB(255, 255, 255), RGB(255, 255, 255),
        RGB(255, 255, 255), RGB(255, 255, 255),
        RGB(255, 255, 255), RGB(255, 255, 255),
        RGB(255, 255, 255), RGB(255, 255, 255),
        RGB(255, 255, 255), RGB(255, 255, 255),
        RGB(255, 255, 255), RGB(255, 255, 255),
        RGB(255, 255, 255), RGB(255, 255, 255),
        RGB(255, 255, 255), RGB(255, 255, 255)
    };
    CHOOSECOLOR cc;
    BOOL bResult;

    cc.lStructSize = sizeof(CHOOSECOLOR);
    cc.hwndOwner = hwnd;
    cc.hInstance = ghModule;
    cc.rgbResult = *lpdwRGB;
    cc.lpCustColors = argbCust;
    cc.Flags = CC_RGBINIT | CC_SHOWHELP;
    cc.lCustData = 0;
    cc.lpfnHook = NULL;
    cc.lpTemplateName = NULL;

    bResult = ChooseColor(&cc);

    if (bResult) {
        *lpdwRGB = cc.rgbResult;
        return TRUE;
    }

    return FALSE;
}

BOOL bChooseNewFont | ( | HWND | ,
 |  | PLOGFONT | ,
 |  | COLORREF * |
 | ) |  |

Definition at line 5088 of file MfEdit.c.

                                                                {
   HDC                  hDC=NULL;
   static CHOOSEFONT    chf;
   static BOOL          bInit=TRUE;

   if (bInit) {
        bInit = FALSE;

        hDC = GetDC( hwnd );
        chf.hDC = CreateCompatibleDC( hDC );
        ReleaseDC( hwnd, hDC );

        chf.lStructSize = sizeof(CHOOSEFONT);
        chf.hwndOwner = hwnd;
        chf.lpLogFont = plf;
        chf.Flags = CF_SCREENFONTS | CF_EFFECTS | CF_INITTOLOGFONTSTRUCT;
        chf.rgbColors = *pClrRef;
        chf.lCustData = 0;
        chf.hInstance = (HANDLE)NULL;
        chf.lpszStyle = (LPSTR)NULL;
        chf.nFontType = SCREEN_FONTTYPE;
        chf.nSizeMin = 0;
        chf.nSizeMax = 0;
        chf.lpfnHook = (LPCFHOOKPROC)NULL;
        chf.lpTemplateName = (LPSTR)NULL;
   }

   if (ChooseFont( &chf ) == FALSE ) {
        if (hDC)
            DeleteDC( hDC );
    return FALSE;
   }

   *pClrRef = chf.rgbColors;

   if (hDC)
       DeleteDC( hDC );
   return (TRUE);
}

BOOL bCleanUpRC ( VOID )

Definition at line 856 of file MfEdit.c.

{
    return TRUE;
}

BOOL APIENTRY bDoHitTest | ( | HDC | ,
 |  | LPHANDLETABLE | ,
 |  | LPENHMETARECORD | ,
 |  | UINT | ,
 |  | LPVOID |
 | ) |  |

Definition at line 4861 of file MfEdit.c.

                                                 {
    BOOL            bSuccess;
    char            ach[128];
    char            achTmp[128];
    POINT           PtOrg;
    LONG            lNumDword;
    XFORM           xfSave;
    SIZE            SizeWndEx, SizeViewEx;
    POINT           ptWndOrgin, ptViewOrgin;
    int             i, iMode;
    HRGN            hRgn;
    PPOINT          pPt, pPtTmp;
    static HGDIOBJ  hObjOld=NULL;
    static LONG     lCurX=0;
    static LONG     lCurY=0;
    static BOOL     bXform=FALSE;
    static int      iCnt=0;

    iCnt++;

    //
    // select a wide pen for widen path later on
    //
    hObjOld = SelectObject(hDC, ghpnWide);

    //
    // save the mouse hit position, this was passed in as a POINT structure
    //
    PtOrg.x = (((HTDATA *)lpData)->point).x;
    PtOrg.y = (((HTDATA *)lpData)->point).y;

    //
    // save the number of parameters for the GDI fcn concerned in DWORD.
    // This is the total size of metafile record in question less the
    // size of the GDI function
    //
    lNumDword = (lpEnhMetaRecord->nSize-8) / 4;

    switch (lpEnhMetaRecord->iType) {
    case EMR_SETWINDOWEXTEX:
    case EMR_SETWINDOWORGEX:
    case EMR_SETVIEWPORTEXTEX:
    case EMR_SETVIEWPORTORGEX:
    case EMR_SETMAPMODE:
    case EMR_SCALEVIEWPORTEXTEX:
    case EMR_SCALEWINDOWEXTEX:
    case EMR_SETMETARGN:
    case EMR_SAVEDC:
    case EMR_RESTOREDC:
    case EMR_SETWORLDTRANSFORM:
    case EMR_MODIFYWORLDTRANSFORM: {
        //
        // play all records related to transformation & font
        //
        PlayEnhMetaFileRecord(hDC, lpHandleTable,
                                   lpEnhMetaRecord, nHandles);
        bXform = TRUE;
        return TRUE;
    }
    //
    // convert the following GDI calls to path for hit testing
    //
    case EMR_RECTANGLE: {
        BeginPath(hDC);
        Rectangle(hDC, lpEnhMetaRecord->dParm[0], lpEnhMetaRecord->dParm[1],
                       lpEnhMetaRecord->dParm[2], lpEnhMetaRecord->dParm[3]);
        EndPath(hDC);
        break;
    }
    case EMR_ELLIPSE: {
        BeginPath(hDC);
        Ellipse(hDC, lpEnhMetaRecord->dParm[0], lpEnhMetaRecord->dParm[1],
                     lpEnhMetaRecord->dParm[2], lpEnhMetaRecord->dParm[3]);
        EndPath(hDC);
        break;
    }
    case EMR_MOVETOEX: {
        //
        // Remember our current position
        //
        lCurX = lpEnhMetaRecord->dParm[0];
        lCurY = lpEnhMetaRecord->dParm[1];
        return TRUE;
    }
    case EMR_LINETO: {
        BeginPath(hDC);
        MoveToEx(hDC, lCurX, lCurY, NULL);
        LineTo(hDC, lpEnhMetaRecord->dParm[0], lpEnhMetaRecord->dParm[1]);
        EndPath(hDC);
        break;
    }
    case EMR_POLYBEZIER16: {
        int         j;
        LONG        lSize;
        LONG        lPtCnt;

        lPtCnt = lpEnhMetaRecord->dParm[4];
        lSize = lPtCnt * sizeof(POINTL);

        if ((pPt = (PPOINT) LocalAlloc(LMEM_FIXED, lSize)) == NULL) {
            SetWindowText(ghTextWnd, GetStringRes(IDS_MALLOCFAILNOHIT));
            return TRUE;
        }

        pPtTmp = pPt;

        for (j=0; j < (INT) lPtCnt; j++, pPtTmp++) {
            pPtTmp->x = (LONG)(LOWORD(lpEnhMetaRecord->dParm[j+5]));
            pPtTmp->y = (LONG)(HIWORD(lpEnhMetaRecord->dParm[j+5]));
        }

        BeginPath(hDC);
        PolyBezier(hDC, (LPPOINT)pPt, (DWORD) lPtCnt);
        EndPath(hDC);
        LocalFree(pPt);
        break;
    }
    default:
        _sntprintf((LPSTR) ach, 127, GetStringRes(IDS_FMT_NOHTST), rgMetaName[lpEnhMetaRecord->iType]);
    ach [127] = '\0';
        SetWindowText(ghTextWnd, ach);
        return TRUE;
    }   //switch

    if (bXform) {
        //
        // Set World transform to identity temporarily so that pen width
        // is not affected by world to page transformation
        //
        GetWorldTransform(hDC, &xfSave);
        ModifyWorldTransform(hDC, NULL, MWT_IDENTITY);

        //
        // Set Page transform to identity temporarily so that pen width
        // is not affected by page to device transformation
        //
        iMode = GetMapMode(hDC);

        if ((iMode == MM_ISOTROPIC) || (iMode == MM_ANISOTROPIC)) {
            GetWindowOrgEx(hDC, &ptWndOrgin);
            GetWindowExtEx(hDC, &SizeWndEx);
            GetViewportExtEx(hDC, &SizeViewEx);
            GetViewportOrgEx(hDC, &ptViewOrgin);
        }

        SetMapMode(hDC, MM_TEXT);
    }

    WidenPath(hDC);

    hRgn = PathToRegion(hDC);

    if (hRgn == 0) {
        SetWindowText(ghTextWnd, GetStringRes(IDS_NULLRGNHTSTFAIL));
        DeleteObject(hRgn);
        return TRUE;
    }
    //DPtoLP(hDC, &PtOrg, 1);
    //SetPixel(hDC, PtOrg.x, PtOrg.y, RGB(0, 255, 0));
    //
    // test if mouse hit position is in region
    //
    bSuccess = PtInRegion(hRgn, PtOrg.x, PtOrg.y);
    //Temporily comment this out
    FillRgn(hDC, hRgn, ghbrRed);
    DeleteObject(hRgn);
    //
    // Set transform back.
    //
    if (bXform) {
        SetWorldTransform(hDC, &xfSave);
        SetMapMode(hDC, iMode);

        if ((iMode == MM_ISOTROPIC) || (iMode == MM_ANISOTROPIC)) {
            SetWindowOrgEx(hDC, ptWndOrgin.x, ptWndOrgin.y, NULL);
            SetWindowExtEx(hDC, SizeWndEx.cx, SizeWndEx.cy, NULL);
            SetViewportExtEx(hDC, SizeViewEx.cx, SizeViewEx.cy, NULL);
            SetViewportOrgEx(hDC, ptViewOrgin.x, ptViewOrgin.y, NULL);
        }
    }

    if (bSuccess) {
        Beep(440, 500);
        //
        // Reporting the metafile record number.  Then reset counter.
        //
        SetDlgItemInt(ghwndCtrlPanel, DID_COUNTER, iCnt, FALSE);
        iCnt=0;
        _sntprintf((LPSTR) ach, 127,GetStringRes(IDS_FMT_HIT), rgMetaName[lpEnhMetaRecord->iType]);
    ach [127] = '\0';
        for (i=0; i < lNumDword; i++) {
            _sntprintf((LPSTR) achTmp, 127,"%ld ", lpEnhMetaRecord->dParm[i]);
            ach [127] = '\0'; // make sure null terminated for strlen
            achTmp [127] = '\0';
            if ((strlen(ach)+strlen(achTmp))/sizeof(char) >= 128)
                break;
            strncat(ach, achTmp, sizeof (ach) - strlen (ach));
        }

        SetWindowText(ghTextWnd, ach);
        SelectObject(hDC, hObjOld);
        bXform = FALSE;
        return FALSE;
    }
    SetWindowText(ghTextWnd, GetStringRes(IDS_NOHIT));
    if (iCnt >= ((HTDATA *)lpData)->iRecord)
        iCnt = 0;
    return TRUE;

    UNREFERENCED_PARAMETER(lpHandleTable);
    UNREFERENCED_PARAMETER(nHandles);

}

BOOL bDrawStuff | ( | HDC | ,
 |  | INT | ,
 |  | INT | ,
 |  | INT | ,
 |  | INT | ,
 |  | BOOL | ,
 |  | BOOL | ,
 |  | BOOL | ,
 |  | LPSTR |
 | ) |  |

Definition at line 3540 of file MfEdit.c.

                                      {
    BOOL bSuccess;
    HGDIOBJ hObjOld;
    static POINT rgPts[MAX_POINTS], rgPtsMF[MAX_POINTS_MF], rgPtsBMP[MAX_POINTS_BMP];
    static int   iCnt=0, iCntMF=0, iCntBMP=0;
    static BOOL  bCaretShown=FALSE;

    bSuccess = TRUE;
    if (bCaretShown) {
        HideCaret(ghwndDrawSurf);
        bCaretShown = FALSE;
    }

    switch (gdwCurTool) {
        case DID_PEN:
            if (bErase) {
                MoveToEx(hDC, NextX, NextY, NULL);
            } else {
                //
                // Override the ROP2 st. the pen won't erase its track
                //
                SetROP2(hDC, R2_COPYPEN);
                LineTo(hDC, NextX, NextY);
            }
            break;
        case DID_TEXT: {
            POINT   Pt;
#if 0
        HDC hDCMem;
#endif

            if (lpstr == NULL) {
                ShowCaret(ghwndDrawSurf);
                bCaretShown = TRUE;
                SetCaretPos(NextX, NextY-CARET_HEIGHT);
                MoveToEx(hDC, NextX, NextY, NULL);

#if 0
        StretchDIBits(hDC, 20, 20+120, 64, 64, 0, 64, 64, -64, &dib,
                            (LPBITMAPINFO)&DIBHdr, DIB_PAL_COLORS, SRCCOPY);

        hDCMem = CreateCompatibleDC(hDC);
        SelectPalette(hDCMem, hPal, FALSE);
        RealizePalette(hDCMem);
        SelectObject(hDCMem, hbmp);
        BitBlt(hDC, 0,0,64,64,hDCMem, 0,0,SRCCOPY);
        DeleteDC(hDCMem);
#endif

            SetFocus(ghwndDrawSurf);
            break;
            }

            SetTextAlign(hDC, TA_BASELINE | TA_LEFT | TA_UPDATECP);
            hObjOld = SelectObject(hDC, ghCurFont);
            SetTextColor(hDC, gCrText);

            if ((gbSFOutln || gbPDOutln) && gbTT) {
                // get rid of the char box
                SetBkMode(hDC, TRANSPARENT);
                BeginPath(hDC);
                TextOut(hDC, NextX, NextY, lpstr, IsDBCSLeadByte((BYTE)*lpstr) ? 2 : 1);
                EndPath(hDC);

                if (gbSFOutln) {
                    StrokeAndFillPath(hDC);
                    goto DT_UPDATE;
                }

                //
                // Get path and polydraw
                //
                {
                int     iNumPt;
                PBYTE   pjTypes;
                PPOINT  pPts;

                if (iNumPt = GetPath(hDC, NULL, NULL, 0)) {
                    if ((pPts = (PPOINT)GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT,
                                                sizeof(POINT)*iNumPt )) == NULL) {
                        MessageBox(ghwndMain, GetStringRes(IDS_CREPNTFAIL),
                            GetStringRes(IDS_ERROR), MB_OK);
                        break;
                    }

                    if ((pjTypes = (PBYTE)GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT,
                                                sizeof(BYTE)*iNumPt )) == NULL) {
                        MessageBox(ghwndMain, GetStringRes(IDS_CREPBYTEFAIL),
                            GetStringRes(IDS_ERROR), MB_OK);
                        goto GP_EXIT1;
                    }

                    GetPath(hDC, pPts, pjTypes, iNumPt);
                }
                PolyDraw95(hDC, pPts, pjTypes, iNumPt);
                GlobalFree(pjTypes);

GP_EXIT1:
                GlobalFree(pPts);

                }

            } else {
                TextOut(hDC, NextX, NextY, lpstr, IsDBCSLeadByte((BYTE)*lpstr) ? 2 : 1);
            }
DT_UPDATE:
            //
            // Updating current position
            //
            {
            LONG    lHeight;
            LONG    lWidth;
            TEXTMETRIC     tm;

                if (GetTextMetrics(hDC, &tm)) {
                    lHeight = tm.tmHeight;
                    lWidth  = tm.tmMaxCharWidth;
                }

                GetCurrentPositionEx(hDC, (LPPOINT) &Pt);
                SetCaretPos(Pt.x, Pt.y-CARET_HEIGHT);

            }
            ShowCaret(ghwndDrawSurf);
            bCaretShown = TRUE;

            break;

#if 0

#define PT_LINECLOSE     (PT_LINETO | PT_CLOSEFIGURE)
#define PT_BEZIERCLOSE (PT_BEZIERTO | PT_CLOSEFIGURE)

            hpnRed = CreatePen(PS_SOLID, 0, RGB(255,0,0));
            SelectObject(hDC, hpnRed);

            while (iNumPt--) {
                static POINT pPnt[3];
                static int   iCnt=0;

                switch (*pjTypes++) {
                    case PT_MOVETO: {
                        MoveToEx(hDC, pPts->x, pPts->y, NULL);
                        pPts++;
                        break;
                    }
                    case PT_LINETO: {
                        LineTo(hDC, pPts->x, pPts->y);
                        pPts++;
                        break;

                    }
                    case PT_LINECLOSE: {
                        LineTo(hDC, pPts->x, pPts->y);
                        pPts++;
                        goto GP_EXIT2;
                    }
                    case PT_BEZIERTO: {
                        pPnt[iCnt].x = pPts->x;
                        pPnt[iCnt].y = pPts->y;
                        pPts++;

                        if (iCnt < 2) {
                            iCnt++;
                        } else {
                            PolyBezierTo(hDC, pPnt, 3);
                            iCnt = 0;
                        }
                        break;
                    }
                    case PT_BEZIERCLOSE: {
                        pPnt[iCnt].x = pPts->x;
                        pPnt[iCnt].y = pPts->y;
                        pPts++;

                        if (iCnt < 2) {
                            iCnt++;
                        } else {
                            PolyBezierTo(hDC, pPnt, 3);
                            iCnt = 0;
                        }
                        goto GP_EXIT2;
                    }

                    default:
                        break;
                }

            }

#endif
        }
        case DID_RECT:
            hObjOld = SelectObject(hDC, GetStockObject(NULL_BRUSH));
            Rectangle(hDC, OrgX, OrgY, NextX, NextY);
            SelectObject(hDC, hObjOld);
            break;
        case DID_FILLRECT:
            Rectangle(hDC, OrgX, OrgY, NextX, NextY);
            break;
        case DID_ELLIPSE:
            hObjOld = SelectObject(hDC, GetStockObject(NULL_BRUSH));
            Ellipse(hDC, OrgX, OrgY, NextX, NextY);
            SelectObject(hDC, hObjOld);
            break;
        case DID_FILLELLIPSE:
            Ellipse(hDC, OrgX, OrgY, NextX, NextY);
            break;
        case DID_LINE:
            MoveToEx(hDC, OrgX, OrgY, NULL);
            LineTo(hDC, NextX, NextY);
            break;
        case DID_BEZIER:
            if (bErase || bMove)
                return bSuccess;

            if (bCntPt) {
                rgPts[iCnt].x = NextX;
                rgPts[iCnt].y = NextY;
                iCnt++;

                if (iCnt == MAX_POINTS - 1)
                    iCnt = 0;
            }

            if ((iCnt % 3) == 1) {              // (iCnt + 1) % 3 == 1
                //
                // Override the ROP2 st. the pen won't erase its track
                //
                SetROP2(hDC, R2_COPYPEN);
                PolyBezier(hDC, (LPPOINT)&rgPts, (DWORD) iCnt);
            }
            return bSuccess;

        case DID_BMPOBJ: {
            static BOOL          bBltReady = FALSE;

            if (bErase || bMove)
                return bSuccess;

            if (ghBmp == NULL) {
                SetWindowText(ghTextWnd, GetStringRes(IDS_NOBMFOREMBED));
                return bSuccess;
            }

            if (bCntPt) {
                bBltReady = FALSE;
                rgPtsBMP[iCntBMP].x = NextX;
                rgPtsBMP[iCntBMP].y = NextY;
                iCntBMP++;

                if (iCntBMP < MAX_POINTS_BMP) {
                    return bSuccess;
                }
            } else {
                //
                // Caller don't want to increment counter, so must be doing
                // recording, so we just Blt again...
                //
                // But, if the Blt data is no good, bail out...
                //
                if (!bBltReady) {
                    return bSuccess;
                }
                bPlgBlt(hDC, rgPtsBMP);
                return bSuccess;
            }
            bBltReady = TRUE;

            bPlgBlt(hDC, rgPtsBMP);
            iCntBMP = 0;                         // reset
            return bSuccess;
        }

        case DID_METAF: {
            ENHMETAHEADER EnhMetaHdr;
            RECT          rcClientDS;
            static XFORM         xform;
            static BOOL          bXformReady = FALSE;
            int           iEntries;
            PLOGPALETTE     plogPal;
            PBYTE           pjTmp;
            HPALETTE        hPal;
            static BOOL     bRCSet = FALSE;

            if (bErase || bMove)
                return bSuccess;

            if (ghMetaf == NULL) {
                SetWindowText(ghTextWnd, GetStringRes(IDS_NOMFFOREMBED));
                return bSuccess;
            }

            if (bCntPt) {
                bXformReady = FALSE;
                rgPtsMF[iCntMF].x = NextX;
                rgPtsMF[iCntMF].y = NextY;
                iCntMF++;

                if (iCntMF < MAX_POINTS_MF) {
                    return bSuccess;
                }
            } else {
                //
                // Caller don't want to increment counter, so must be doing
                // recording, so we just set xform and play it again...
                //
                // But, if the xform data is no good, bail out...
                //
                if (!bXformReady) {
                    return bSuccess;
                }

                GetEnhMetaFileHeader(ghMetaf, sizeof(ENHMETAHEADER), &EnhMetaHdr);
                SetWorldTransform(hDC, &xform);
                GetClientRect(ghwndDrawSurf, &rcClientDS);

                iEntries = GetEnhMetaFilePaletteEntries(ghMetaf, 0, NULL);

                if (iEntries) {
                    if ((plogPal = (PLOGPALETTE)GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT,
                            sizeof(DWORD) + sizeof(PALETTEENTRY)*iEntries )) == NULL) {
                        MessageBox(ghwndMain, GetStringRes(IDS_CREPALFAIL),
                            GetStringRes(IDS_ERROR), MB_OK);
                    }

                    plogPal->palVersion = 0x300;
                    plogPal->palNumEntries = (WORD) iEntries;
                    pjTmp = (PBYTE) plogPal;
                    pjTmp += 4;

                    GetEnhMetaFilePaletteEntries(ghMetaf, iEntries, (PPALETTEENTRY)pjTmp);
                    hPal = CreatePalette(plogPal);
                    GlobalFree(plogPal);

                    SelectPalette(hDC, hPal, FALSE);
                    RealizePalette(hDC);
                }

                bRCSet = bSetRC2MatchEmfRC(hDC, EnhMetaHdr, ghMetaf, NULL);
                if (!bRCSet) {
                    vErrOut("DID_METAF failed");
                }

                //PlayEnhMetaFile(hDC, ghMetaf, (LPRECT) &rcClientDS);
                {
                RECT rc;

                rc.top = rc.left = 0;
                rc.right = EnhMetaHdr.rclBounds.right - EnhMetaHdr.rclBounds.left;
                rc.bottom = EnhMetaHdr.rclBounds.bottom - EnhMetaHdr.rclBounds.top;
                if (!PlayEnhMetaFile(hDC, ghMetaf, (LPRECT) &rc)) {
                    char    text[128];

                    _sntprintf(text, 127, GetStringRes(IDS_FMT_PLAYEMFFAIL), GetLastError());
                    text [127] = '\0';
          OutputDebugString(text);
                } else {
                    if (gbDB)
                       SwapBuffers(hDC);
                }

                }
                ModifyWorldTransform(hDC, NULL, MWT_IDENTITY);

                if (bRCSet) {
                    bCleanUpRC();
                    bRCSet = FALSE;
                }

                return bSuccess;
            }

            GetEnhMetaFileHeader(ghMetaf, sizeof(ENHMETAHEADER), &EnhMetaHdr);
            //
            // Based on the three points, top-left, top-right and bottom-left
            // (in this order), of the destination, solve equations for the
            // elements of the transformation matrix.
            //
            xform.eDx = (float) rgPtsMF[0].x;
            xform.eDy = (float) rgPtsMF[0].y;
            xform.eM11 = (rgPtsMF[1].x - xform.eDx)/(EnhMetaHdr.rclBounds.right - EnhMetaHdr.rclBounds.left);
            xform.eM12 = (rgPtsMF[1].y - xform.eDy)/(EnhMetaHdr.rclBounds.right - EnhMetaHdr.rclBounds.left);
            xform.eM21 = (rgPtsMF[2].x - xform.eDx)/(EnhMetaHdr.rclBounds.bottom - EnhMetaHdr.rclBounds.top);
            xform.eM22 = (rgPtsMF[2].y - xform.eDy)/(EnhMetaHdr.rclBounds.bottom - EnhMetaHdr.rclBounds.top);

            bXformReady = TRUE;
            SetWorldTransform(hDC, &xform);
            GetClientRect(ghwndDrawSurf, &rcClientDS);

            iEntries = GetEnhMetaFilePaletteEntries(ghMetaf, 0, NULL);

            if (iEntries) {
                if ((plogPal = (PLOGPALETTE)GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT,
                        sizeof(DWORD) + sizeof(PALETTEENTRY)*iEntries )) == NULL) {
                    MessageBox(ghwndMain, GetStringRes(IDS_CREPALFAIL),
                        GetStringRes(IDS_ERROR), MB_OK);
                }

                plogPal->palVersion = 0x300;
                plogPal->palNumEntries = (WORD) iEntries;
                pjTmp = (PBYTE) plogPal;
                pjTmp += 4;

                GetEnhMetaFilePaletteEntries(ghMetaf, iEntries, (PPALETTEENTRY)pjTmp);
                hPal = CreatePalette(plogPal);
                GlobalFree(plogPal);

                SelectPalette(hDC, hPal, FALSE);
                RealizePalette(hDC);
            }

            if (!bRCSet) {
                bRCSet = bSetRC2MatchEmfRC(hDC, EnhMetaHdr, ghMetaf, NULL);
                if (!bRCSet) {
                    vErrOut("DID_METAF failed");
                }
            }

            //PlayEnhMetaFile(hDC, ghMetaf, (LPRECT) &rcClientDS);
            {
            RECT rc;

            rc.top = rc.left = 0;
            rc.right = EnhMetaHdr.rclBounds.right - EnhMetaHdr.rclBounds.left;
            rc.bottom = EnhMetaHdr.rclBounds.bottom - EnhMetaHdr.rclBounds.top;
            if (!PlayEnhMetaFile(hDC, ghMetaf, (LPRECT) &rc)) {
                 char    text[128];

                 _sntprintf(text, 127,GetStringRes(IDS_FMT_PLAYEMFFAIL), GetLastError());
                 text [127] = '\0';
         OutputDebugString(text);
            } else {
                if (gbDB)
                   SwapBuffers(hDC);
            }

            }
            ModifyWorldTransform(hDC, NULL, MWT_IDENTITY);
            iCntMF = 0;                         // reset
            if (bRCSet) {
                bCleanUpRC();
                bRCSet = FALSE;
            }
            return bSuccess;
        }
        default:
            break;
    }
    //
    // Reset counter, user has selected other tools.
    //
    iCnt = 0;
    iCntMF = 0;
    iCntBMP = 0;
    return bSuccess;
}

BOOL bFreeDibFile ( PDIBDATA )

Definition at line 4706 of file MfEdit.c.

{
    ULONG               ulFiles;
    ULONG               ulFrames;
    ULONG               i;
    PFILEINFO           pFileInfo;

    ulFiles = pDibData->ulFiles;
    ulFrames = pDibData->ulFrames;

    for (i = 0; i < ulFrames; i++) {
        LocalFree(pDibData->rgpjFrame[i]);
        LocalFree(pDibData->rgpbmi[i]);
    }

    for (i = 0; i < ulFiles; i++) {
        pFileInfo = &(pDibData->rgFileInfo[i]);
        CloseHandle(pFileInfo->hFile);
        CloseHandle(pFileInfo->hMapFile);
        UnmapViewOfFile(pFileInfo->lpvMapView);
    }

    pDibData->ulFiles = 0;
    pDibData->ulFrames = 0;
    return TRUE;
}

BOOL bGetBMP | ( | HWND | ,
 |  | BOOL |
 | ) |  |

Definition at line 4747 of file MfEdit.c.

                                    {
    OPENFILENAME    ofn;
    char            szFile[MAX_ARRAYSIZE], szFileTitle[MAX_ARRAYSIZE];
    static char     *szFilter;
    BOOL            bSuccess;
    HDC             hDC;

    bSuccess = FALSE;

    BuildFilterStrs(-1);
    BuildFilterStrs(IDS_FT_DIB);
    szFilter = BuildFilterStrs(IDS_FT_RLE);

    strncpy( szFile, "*.bmp\0", MAX_ARRAYSIZE - 1);
  szFile [MAX_ARRAYSIZE - 1] = '\0';
    ofn.lStructSize = sizeof(OPENFILENAME);
    ofn.hwndOwner = hwnd;
    ofn.lpstrFilter = szFilter;
    ofn.lpstrCustomFilter = (LPSTR) NULL;
    ofn.nMaxCustFilter = 0L;
    ofn.nFilterIndex = 1;
    ofn.lpstrFile = szFile;
    ofn.nMaxFile = sizeof(szFile);
    ofn.lpstrFileTitle = szFileTitle;
    ofn.nMaxFileTitle = sizeof(szFileTitle);
    ofn.lpstrInitialDir = NULL;
    ofn.lpstrTitle = (bMask ? GetStringRes(IDS_LDMSK) : "Load Bitmap");
    ofn.Flags = 0L;
    ofn.nFileOffset = 0;
    ofn.nFileExtension = 0;
    ofn.lpstrDefExt = "BMP";

    if (!GetOpenFileName(&ofn))
        return 0L;

    hDC = GetDC(ghwndDrawSurf);
    if (bMask) {
        ghBmpMask = hBmpLoadBitmapFile(hDC, szFile);
        if (ghBmpMask != NULL)
            bSuccess = TRUE;
    } else {
        ghBmp = hBmpLoadBitmapFile(hDC, szFile);
        if (ghBmp != NULL)
            bSuccess = TRUE;
    }
    ReleaseDC(ghwndDrawSurf, hDC);

    return bSuccess;
}

BOOL bGetEPSBounds | ( | LPVOID | ,
 |  | RECTL * |
 | ) |  |

Definition at line 5887 of file MfEdit.c.

{
    char szKeyWord[128], szValue[128];
    int  index;

    if (lpData == NULL) {
#if MYDBG
        MessageBox(GetFocus(), GetStringRes(IDS_NULLPTR),
            GetStringRes(IDS_ERROR), MB_OK);
#endif
        return FALSE;
    }

    index = 0;

    if (!bGetWord(lpData, szKeyWord, &index))
        return FALSE;

    if (!bIsAdobe(szKeyWord)) {
        MessageBox(GetFocus(), GetStringRes(IDS_NOTADOBE),
            GetStringRes(IDS_ERROR), MB_OK);
        return FALSE;
    }

    if (!bGetWord(lpData, szValue, &index))
        return FALSE;

    if (!bIsEPS(szValue)) {
        MessageBox(GetFocus(), "Not EPS!",
            GetStringRes(IDS_ERROR), MB_OK);
        return FALSE;
    }

    if (!bGoNextLine(lpData, &index))
        return FALSE;

    while ((bGetWord(lpData, szKeyWord, &index)) &&
           (!bIsBndBox(szKeyWord))) {
#if MYDBG
        MessageBox(GetFocus(), GetStringRes(IDS_SKPTOEOL),
            GetStringRes(IDS_ERROR), MB_OK);
#endif
        if (!bGoNextLine(lpData, &index)) {
            MessageBox(GetFocus(), GetStringRes(IDS_MUSTNOTEOF),
                GetStringRes(IDS_ERROR), MB_OK);
            return FALSE;
        }
    }

    if (bIsBndBox(szKeyWord)) {
        if (bGetWord(lpData, szValue, &index))
            prctl->left    = atol(szValue);
        else {
            MessageBox(GetFocus(), GetStringRes(IDS_GETBNDLFTFAIL),
                GetStringRes(IDS_ERROR), MB_OK);
            return FALSE;
        }

        if (bGetWord(lpData, szValue, &index))
            prctl->top     = atol(szValue);
        else {
            MessageBox(GetFocus(), GetStringRes(IDS_GETBNDTOPFAIL),
                GetStringRes(IDS_ERROR), MB_OK);
            return FALSE;
        }

        if (bGetWord(lpData, szValue, &index))
            prctl->right   = atol(szValue);
        else {
            MessageBox(GetFocus(), GetStringRes(IDS_GETBNDRGTFAIL),
                GetStringRes(IDS_ERROR), MB_OK);
            return FALSE;
        }

        if (bGetWord(lpData, szValue, &index))
            prctl->bottom  = atol(szValue);
        else {
            MessageBox(GetFocus(), GetStringRes(IDS_GETBNDBOTFAIL),
                GetStringRes(IDS_ERROR), MB_OK);
            return FALSE;
        }
    }

    return TRUE;

}

BOOL bGetWord | ( | LPVOID | ,
 |  | char * | ,
 |  | int * |
 | ) |  |

Definition at line 5976 of file MfEdit.c.

{
    char *pstr;

    pstr = str;

    while (((char *)lpData)[*pi] == ' ')
        (*pi)++;

    while ((((char *)lpData)[*pi] != ' ') &&
           (((char *)lpData)[*pi] != '\n') &&
           (((char *)lpData)[*pi] != '\r')) {
        *str++ = ((char *)lpData)[(*pi)++];
    }
    *str++ = '\0';

#if MYDBG
    {
    char text[128];

    _sntprintf(text,127, "bGetWord gets %s", pstr);
    text [127] = '\0';
  MessageBox(GetFocus(), text, "Info", MB_OK);
    }
#endif

    return TRUE;
}

BOOL bGoNextLine | ( | LPVOID | ,
 |  | int * |
 | ) |  |

Definition at line 6006 of file MfEdit.c.

{
    char tmp[128];
    int  q;

    while ((((char *)lpData)[*pi] != '\n') &&
           (((char *)lpData)[*pi] != '\r'))
        (*pi)++;

    //
    // skip them
    //
    *pi += 2;

    q = *pi;

    if ((bGetWord(lpData, tmp, &q)) && (bIsEOF(tmp)) )
        return FALSE;

    return TRUE;
}

BOOL bHitTest | ( | HDC | ,
 |  | INT | ,
 |  | INT |
 | ) |  |

Definition at line 4809 of file MfEdit.c.

                                     {
    BOOL          bSuccess;
    ENHMETAHEADER EnhMetaHdr;
    RECT          rcClientDS;
    HTDATA        htData;
    static        HCURSOR hCurHT, hCurWait;

    bSuccess = TRUE;

    if (ghMetaf == 0)
        return 0L;

    hCurHT = LoadCursor(NULL, IDC_CROSS);
    hCurWait = LoadCursor(NULL, IDC_WAIT);

    GetEnhMetaFileHeader(ghMetaf, sizeof(EnhMetaHdr), &EnhMetaHdr);

    htData.point.x = x;
    htData.point.y = y;
    htData.iRecord = EnhMetaHdr.nRecords;

    SetCursor(hCurWait);
    if (gbFit2Wnd) {
        GetClientRect(ghwndDrawSurf, &rcClientDS);
        EnumEnhMetaFile(hDC, ghMetaf, (ENHMFENUMPROC)bDoHitTest, (LPVOID) &htData, (LPRECT)&rcClientDS);
    } else {
        RECT rc;

        rc.top = rc.left = 0;
        rc.right = EnhMetaHdr.rclBounds.right - EnhMetaHdr.rclBounds.left;
        rc.bottom = EnhMetaHdr.rclBounds.bottom - EnhMetaHdr.rclBounds.top;
        EnumEnhMetaFile(hDC, ghMetaf, (ENHMFENUMPROC)bDoHitTest, (LPVOID) &htData, (LPRECT)&rc);
    }
    SetCursor(hCurHT);

    return bSuccess;
}

BOOL bIsAdobe ( char * szStr )

Definition at line 5853 of file MfEdit.c.

{
    if (strcmp(szStr, "%!PS-Adobe-3.0") == 0)
        return TRUE;
    else
        return FALSE;
}

BOOL bIsBndBox ( char * szStr )

Definition at line 5870 of file MfEdit.c.

{
    if (strcmp(szStr, "%%BoundingBox:") == 0)
        return TRUE;
    else
        return FALSE;
}

BOOL bIsEOF ( char * szStr )

Definition at line 5878 of file MfEdit.c.

{
    if (strcmp(szStr, "%%EOF") == 0)
        return TRUE;
    else
        return FALSE;
}

BOOL bIsEPS ( char * szStr )

Definition at line 5861 of file MfEdit.c.

{
    if ((strcmp(szStr, "EPSF-3.0") == 0) ||
        (strcmp(szStr, "EPSF-2.0") == 0))
        return TRUE;
    else
        return FALSE;
}

BOOL APIENTRY bPlayRecord | ( | HDC | ,
 |  | LPHANDLETABLE | ,
 |  | LPENHMETARECORD | ,
 |  | UINT | ,
 |  | LPVOID |
 | ) |  |

Definition at line 4382 of file MfEdit.c.

                                                  {
    BOOL bSuccess;
    static int  iCnt=0;
    int         i;
    char        ach[128];
    char        achTmp[128];
    LONG        lNumDword;

    bSuccess = TRUE;

    lNumDword = (lpEnhMetaRecord->nSize-8) / 4;

    iCnt++;
    if (((PLAYINFO *) lpData)->bPlayContinuous) {
        bSuccess = PlayEnhMetaFileRecord(hDC, lpHandleTable,
                                             lpEnhMetaRecord, nHandles);
        if (iCnt == ((PLAYINFO *) lpData)->iRecord) {
            strncpy( (LPSTR) ach, rgMetaName[lpEnhMetaRecord->iType].szGDIName, 127 );
      ach [127] = '\0';
            for (i=0; i < lNumDword; i++) {
                _sntprintf((LPSTR) achTmp,127, "%ld ", lpEnhMetaRecord->dParm[i]);
                ach [127] = '\0'; // make sure null terminated for strlen
                achTmp [127] = '\0';
                if ((strlen(ach)+strlen(achTmp))/sizeof(char) >= 128)
                    break;
                strncat(ach, achTmp, sizeof (ach) - strlen (ach));
            }
        SetWindowText(ghTextWnd, ach);
        }
    } else {

        switch (lpEnhMetaRecord->iType) {
            case EMR_SETWINDOWEXTEX:
            case EMR_SETWINDOWORGEX:
            case EMR_SETVIEWPORTEXTEX:
            case EMR_SETVIEWPORTORGEX:
            case EMR_SETBRUSHORGEX:
            case EMR_SETMAPMODE:
            case EMR_SETBKMODE:
            case EMR_SETPOLYFILLMODE:
            case EMR_SETROP2:
            case EMR_SETSTRETCHBLTMODE:
            case EMR_SETTEXTALIGN:
            case EMR_SETTEXTCOLOR:
            case EMR_SETBKCOLOR:
            case EMR_OFFSETCLIPRGN:
            case EMR_MOVETOEX:
            case EMR_SETMETARGN:
            case EMR_EXCLUDECLIPRECT:
            case EMR_INTERSECTCLIPRECT:
            case EMR_SCALEVIEWPORTEXTEX:
            case EMR_SCALEWINDOWEXTEX:
            case EMR_SAVEDC:
            case EMR_RESTOREDC:
            case EMR_SETWORLDTRANSFORM:
            case EMR_MODIFYWORLDTRANSFORM:
            case EMR_SELECTOBJECT:
            case EMR_CREATEPEN:
            case EMR_CREATEBRUSHINDIRECT:
            case EMR_DELETEOBJECT:
            case EMR_SELECTPALETTE:
            case EMR_CREATEPALETTE:
            case EMR_SETPALETTEENTRIES:
            case EMR_RESIZEPALETTE:
            case EMR_REALIZEPALETTE:
            case EMR_SETARCDIRECTION:
            case EMR_SETMITERLIMIT:
            case EMR_BEGINPATH:
            case EMR_ENDPATH:
            case EMR_CLOSEFIGURE:
            case EMR_SELECTCLIPPATH:
            case EMR_ABORTPATH:
            case EMR_EXTCREATEFONTINDIRECTW:
            case EMR_CREATEMONOBRUSH:
            case EMR_CREATEDIBPATTERNBRUSHPT:
            case EMR_EXTCREATEPEN:
                goto PlayRec;
            default:
                break;
        } //switch

        if (iCnt == ((PLAYINFO *) lpData)->iRecord) {
PlayRec:
            bSuccess = PlayEnhMetaFileRecord(hDC, lpHandleTable,
                                             lpEnhMetaRecord, nHandles);
            strncpy((LPSTR) ach, rgMetaName[lpEnhMetaRecord->iType].szGDIName, 127);
      ach [127] = '\0';
            for (i=0; i < lNumDword; i++) {
                _sntprintf((LPSTR) achTmp, 127, "%ld ", lpEnhMetaRecord->dParm[i]);
                ach [127] = '\0'; // make sure null terminated for strlen
                achTmp [127] = '\0';
                if ((strlen(ach)+strlen(achTmp))/sizeof(char) >= 128)
                    break;
                strncat(ach, achTmp, sizeof (ach) - strlen (ach));
            }
            SetWindowText(ghTextWnd, ach);
        }
    }

    if (iCnt == ((PLAYINFO *) lpData)->iRecord) {
        iCnt = 0;

        if (gbDB)
            SwapBuffers(hDC);

        return FALSE;
    }
    return bSuccess;
}

BOOL bPlgBlt | ( | HDC | ,
 |  | LPPOINT |
 | ) |  |

Definition at line 5472 of file MfEdit.c.

{
    HDC                  hDCRef;
    HDC                  hDCSrn;                // hDC can be metaf DC
    HGDIOBJ              hObjOld, hBmpMem=NULL;
    BITMAP               bm;
    INT                  iBpp;
    WORD                 wBitCnt;

    hDCSrn = GetDC(ghwndDrawSurf);
    hDCRef = CreateCompatibleDC(hDC);

    if (gbUseDIB) {
        int         cx, cy, dx, dy;
        PBITMAPINFO pbmi;

        pbmi = (gDib.rgpbmi[0]);
        dx = rgPtsBMP[0].x - rgPtsBMP[1].x;
        dy = rgPtsBMP[0].y - rgPtsBMP[1].y;
        cx = (INT) sqrt( dx * dx + dy * dy );

        dx = rgPtsBMP[0].x - rgPtsBMP[2].x;
        dy = rgPtsBMP[0].y - rgPtsBMP[2].y;
        cy = (INT) sqrt( dx * dx + dy * dy );

        iBpp = GetDeviceCaps(hDC, BITSPIXEL);

        if (gDib.rgbCoreHdr[0]) {
            wBitCnt = ((LPBITMAPCOREINFO)pbmi)->bmciHeader.bcBitCount;
        } else {
            wBitCnt = pbmi->bmiHeader.biBitCount;
        }

        if (iBpp < wBitCnt) {   // Do Halftone
            SetStretchBltMode(hDCRef, HALFTONE);
            if (ghHT) {
                SelectPalette(hDCRef, ghHT, FALSE);
                SelectPalette(hDC, ghHT, FALSE);
                SelectPalette(hDCSrn, ghHT, FALSE); // hDC can be metaf DC
                RealizePalette(hDCSrn);             // always realize the srn DC

                // Don't have to realize the palette in hDCRef
                // RealizePalette(hDCRef);

                // has to be compatible with screen DC, cannot be hDCRef
                // memory DC has no bitmap by default?
                // hDC may be a metafile DC, so use hDCSrn
                hBmpMem = CreateCompatibleBitmap(hDCSrn, cx, cy);
                SelectObject(hDCRef, hBmpMem);
            } else {
                MessageBox(ghwndMain, GetStringRes(IDS_HFTONEPALNULL),
                    GetStringRes(IDS_ERROR), MB_OK);
            }
        } else {
            SetStretchBltMode(hDCRef, COLORONCOLOR);
            if (ghPal) {
                if (ghDCMetaf == hDC)
                    CopyPalette(ghPal);
                SelectPalette(hDCRef, ghPal, FALSE);
                SelectPalette(hDC, ghPal, FALSE);
                SelectPalette(hDCSrn, ghPal, FALSE); // hDC can be metaf DC
                RealizePalette(hDCSrn);             // always realize the srn DC

                // Don't have to realize the palette in hDCRef
                // RealizePalette(hDCRef);

                // has to be compatible with screen DC, cannot be hDCRef
                // memory DC has no bitmap by default?
                // hDC may be a metafile DC, so use hDCSrn
                hBmpMem = CreateCompatibleBitmap(hDCSrn, cx, cy);
                SelectObject(hDCRef, hBmpMem);
            } else {
                MessageBox(ghwndMain, GetStringRes(IDS_PALNULL),
                    GetStringRes(IDS_ERROR), MB_OK);
            }
        }

        if (gDib.rgbCoreHdr[0]) {
            StretchDIBits(hDCRef, 0,0, cx, cy,
                          0,0, ((LPBITMAPCOREINFO)pbmi)->bmciHeader.bcWidth, ((LPBITMAPCOREINFO)pbmi)->bmciHeader.bcHeight,
                          gDib.rgpjFrame[0], pbmi, DIB_RGB_COLORS, SRCCOPY);
        } else {
            StretchDIBits(hDCRef, 0,0, cx, cy,
                          0,0, pbmi->bmiHeader.biWidth, pbmi->bmiHeader.biHeight,
                          gDib.rgpjFrame[0], pbmi, DIB_RGB_COLORS, SRCCOPY);
        }

        PlgBlt(hDC, rgPtsBMP, hDCRef, 0, 0, cx, cy,
               ghBmpMask, 0, 0);

        if (hBmpMem)
            DeleteObject(hBmpMem);

    } else {
        hObjOld = SelectObject(hDCRef, ghBmp);

        GetObject(ghBmpMask, sizeof(BITMAP), (LPSTR)&bm);
        if (bm.bmBitsPixel != 1) {
            SetWindowText(ghTextWnd, GetStringRes(IDS_MUSTMSKMCHROMEBM));
            ghBmpMask = NULL;
        }

        GetObject(ghBmp, sizeof(BITMAP), (LPSTR)&bm);

        if (ghPal) {
            SelectPalette(hDC, ghPal, FALSE);
            RealizePalette(hDC);
            SetStretchBltMode(hDC, COLORONCOLOR);
        }
        PlgBlt(hDC, rgPtsBMP, hDCRef, 0, 0, bm.bmWidth, bm.bmHeight,
               ghBmpMask, 0, 0);

        SelectObject(hDCRef, hObjOld);
    }

    DeleteDC(hDCRef);
    ReleaseDC(ghwndDrawSurf, hDCSrn);
    return TRUE;

}

BOOL bPrintMf ( PPRTDATA )

Definition at line 5237 of file MfEdit.c.

                            {
    DOCINFO         DocInfo;
    HDC             hDCPrinter;
    ENHMETAHEADER   EnhMetaHdr;
    HENHMETAFILE    hEnhMf;
    TCHAR           buf[128];
    PRINTDLG        pd;
    BOOL            bSuccess;
    int             iEntries;
    PLOGPALETTE     plogPal;
    PBYTE           pjTmp;
    HPALETTE        hPal;
    BOOL            bRCSet = FALSE;

    bSuccess = TRUE;

    if (pPD->hMetaf == 0) {
        SetWindowText(ghTextWnd, GetStringRes(IDS_NOMFTOPRT));
        goto PMF_EXIT;
        bSuccess = FALSE;
    }

    hEnhMf = CopyEnhMetaFile(pPD->hMetaf, NULL);
    memset(&pd, 0, sizeof(PRINTDLG));
    pd.lStructSize = sizeof(PRINTDLG);
    pd.hwndOwner   = ghwndMain;
    pd.Flags       = PD_RETURNDC;
    pd.hInstance   = ghModule;

    if (!PrintDlg(&pd)) {
        SetWindowText(ghTextWnd, GetStringRes(IDS_ESCPRT));
        goto PMF_EXIT;
        bSuccess = FALSE;
    }

    if (pd.hDC == NULL) {
        SetWindowText(ghTextWnd, GetStringRes(IDS_CREPRTDCFAIL));
        goto PMF_EXIT;
        bSuccess = FALSE;
    }

    hDCPrinter = pd.hDC;
    if (GetEnhMetaFileDescription(hEnhMf, 128, (LPTSTR)buf) == 0) {
        strncpy(buf, "No Title", 127);
    buf [127] = '\0';
    }

    memset(&DocInfo, 0, sizeof(DOCINFO));
    DocInfo.cbSize      = sizeof(DOCINFO);
    DocInfo.lpszDocName = (LPTSTR) buf;
    DocInfo.lpszOutput  = NULL;
    StartDoc(hDCPrinter, &DocInfo);
    StartPage(hDCPrinter);

    SetWindowText(ghTextWnd, GetStringRes(IDS_PRT));

    iEntries = GetEnhMetaFilePaletteEntries(hEnhMf, 0, NULL);

    if (iEntries) {
        if ((plogPal = (PLOGPALETTE)GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT,
                sizeof(DWORD) + sizeof(PALETTEENTRY)*iEntries )) == NULL) {
            MessageBox(ghwndMain, GetStringRes(IDS_CREPALFAIL),
                GetStringRes(IDS_ERROR), MB_OK);
        }

        plogPal->palVersion = 0x300;
        plogPal->palNumEntries = (WORD) iEntries;
        pjTmp = (PBYTE) plogPal;
        pjTmp += 4;

        GetEnhMetaFilePaletteEntries(hEnhMf, iEntries, (PPALETTEENTRY)pjTmp);
        hPal = CreatePalette(plogPal);
        GlobalFree(plogPal);

        SelectPalette(hDCPrinter, hPal, FALSE);
        RealizePalette(hDCPrinter);
    }

    GetEnhMetaFileHeader(hEnhMf, sizeof(ENHMETAHEADER), &EnhMetaHdr);

    bRCSet = bSetRC2MatchEmfRC(hDCPrinter, EnhMetaHdr, hEnhMf, NULL);
    if (!bRCSet) {
        vErrOut("bPrintMF: failed");
    }

    if (pPD->bFit2Wnd) {
        int     iWidth, iHeight;
        RECT    rc;

        iWidth = GetDeviceCaps(hDCPrinter, HORZRES);
        iHeight = GetDeviceCaps(hDCPrinter, VERTRES);
        rc.left = rc.top = 0;
        rc.right = iWidth;
        rc.bottom = iHeight;
        bSuccess = PlayEnhMetaFile(hDCPrinter, hEnhMf, (LPRECT) &rc);
        if (!bSuccess) {
            char    text[128];

            _sntprintf(text, 127,GetStringRes(IDS_FMT_PLAYEMFFAIL), GetLastError());
      text [127] = '\0';
            OutputDebugString(text);
        }

    } else {
        RECT rc;

        rc.top = rc.left = 0;
        rc.right = EnhMetaHdr.rclBounds.right - EnhMetaHdr.rclBounds.left;
        rc.bottom = EnhMetaHdr.rclBounds.bottom - EnhMetaHdr.rclBounds.top;
        bSuccess = PlayEnhMetaFile(hDCPrinter, hEnhMf, (LPRECT) &rc);
        if (!bSuccess) {
            char    text[128];

            _sntprintf(text, 127, GetStringRes(IDS_FMT_PLAYEMFFAIL), GetLastError());
            text [127] = '\0';
      OutputDebugString(text);
        }
    }

//    if (gbDB && bSuccess)
//       SwapBuffers(hDCPrinter);

    EndPage(hDCPrinter);
    EndDoc(hDCPrinter);
    SetWindowText(ghTextWnd, GetStringRes(IDS_PRTTHRDDONE));

    if (bRCSet) {
        bCleanUpRC();
    }

PMF_EXIT:

    ExitThread(0);
    return bSuccess;

}

BOOL bSelectDIBPal | ( | HDC | ,
 |  | LPBITMAPINFO | ,
 |  | BOOL |
 | ) |  |

Definition at line 5391 of file MfEdit.c.

{
  LOGPALETTE    *plogPal;
  UINT          uiSizPal;
  INT           i, iNumClr;
  WORD          wBitCount;

  if (bCoreHdr) {
    wBitCount = ((LPBITMAPCOREINFO)pbmi)->bmciHeader.bcBitCount;
  } else {
    wBitCount = pbmi->bmiHeader.biBitCount;
  }

  switch (wBitCount) {
    case 16:
    case 24:
    case 32:                            // Does PM supports these?
        return FALSE;
    default:
        iNumClr = (1 << wBitCount);
        break;
  }

  uiSizPal = sizeof(WORD)*2 + sizeof(PALETTEENTRY)*iNumClr;
  if ((plogPal = (LOGPALETTE *) LocalAlloc(LMEM_FIXED,uiSizPal)) == NULL) {
      MessageBox(ghwndMain, GetStringRes(IDS_ALLOCPALFAIL),
            GetStringRes(IDS_ERROR), MB_OK);
      ghPal = NULL;
      return FALSE;
  }

  plogPal->palVersion = 0x300;
  plogPal->palNumEntries = (WORD) iNumClr;

  if (bCoreHdr) {
    for (i=0; i<iNumClr; i++) {
        plogPal->palPalEntry[i].peRed   = ((LPBITMAPCOREINFO)pbmi)->bmciColors[i].rgbtRed;
        plogPal->palPalEntry[i].peGreen = ((LPBITMAPCOREINFO)pbmi)->bmciColors[i].rgbtGreen;
        plogPal->palPalEntry[i].peBlue  = ((LPBITMAPCOREINFO)pbmi)->bmciColors[i].rgbtBlue;
        plogPal->palPalEntry[i].peFlags = PC_RESERVED;
    }
  } else {
    for (i=0; i<iNumClr; i++) {
        plogPal->palPalEntry[i].peRed   = pbmi->bmiColors[i].rgbRed;
        plogPal->palPalEntry[i].peGreen = pbmi->bmiColors[i].rgbGreen;
        plogPal->palPalEntry[i].peBlue  = pbmi->bmiColors[i].rgbBlue;
        plogPal->palPalEntry[i].peFlags = PC_RESERVED;
    }
  }

  DeleteObject(ghPal);
  ghPal = CreatePalette((LPLOGPALETTE)plogPal);
  if ((ghPal) == NULL) {
      MessageBox(ghwndMain, GetStringRes(IDS_CREPALFAIL),
            GetStringRes(IDS_ERROR), MB_OK);
      return FALSE;
  }

  if ((GetDeviceCaps(hDC, RASTERCAPS)) & RC_PALETTE) {
    SelectPalette(hDC, ghPal, FALSE);
    RealizePalette(hDC);
  }

  LocalFree(plogPal);

  return TRUE;
}

BOOL bSetAdvancedGraphics ( HDC hdc )

Definition at line 6037 of file MfEdit.c.

{
    OSVERSIONINFO osvi;
    osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);

    GetVersionEx (&osvi);
    if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT)

      if ((SetGraphicsMode(hdc, GM_ADVANCED)) == 0) {
     MessageBox(ghwndMain, GetStringRes(IDS_SETADVGRPHMDFAIL), NULL, MB_OK);
      }
    return TRUE;
}

BOOL bSetupRC | ( | HDC | hDC,
 |  | PIXELFORMATDESCRIPTOR * | ppfdIn
 | ) |  |

Definition at line 843 of file MfEdit.c.

{
    return TRUE;
}

LPTSTR BuildFilterStrs ( int )

Definition at line 6091 of file MfEdit.c.

{
  static TCHAR buffer[1024];
  static TCHAR *pBuf;
  int delimIndex;

  if ((id == -1) || (!pBuf)) // to make sure the first time its called, pBuf is not used without initialization
  {
    pBuf = buffer;
  }
  else
  {
    delimIndex = LoadString(GetModuleHandle (NULL), id, pBuf, 1024 - (int)(pBuf-buffer));
    if (!delimIndex)
        return buffer;
    if (1024 - (int)(pBuf - buffer) > delimIndex)
        pBuf += delimIndex + 1;

    delimIndex = LoadString(GetModuleHandle (NULL), id + 1, pBuf, 1024 - (int)(pBuf-buffer));
    if (!delimIndex)
        return buffer;
    if (1024 - (int)(pBuf - buffer) > delimIndex)
        pBuf += delimIndex + 1;
  }

  *pBuf = 0;
  *(pBuf+1) = 0;
  return buffer;
}

HPALETTE CopyPalette ( HPALETTE hPalSrc )

Definition at line 5606 of file MfEdit.c.

{
    PLOGPALETTE     plogPal;
    PBYTE           pjTmp;
    int             iNumEntries=0;
    HPALETTE        hPal;

    if ((iNumEntries = GetPaletteEntries(hPalSrc, 0, iNumEntries, NULL)) == 0) {
        MessageBox(ghwndMain, GetStringRes(IDS_NOPALENTRYFORCPY),
            GetStringRes(IDS_ERROR), MB_OK);
        return (HPALETTE) NULL;
    }

    if ((plogPal = (PLOGPALETTE)GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT,
            sizeof(DWORD) + sizeof(PALETTEENTRY)*iNumEntries )) == NULL) {
        MessageBox(ghwndMain, GetStringRes(IDS_CPYPALFAIL),
            GetStringRes(IDS_ERROR), MB_OK);
        return (HPALETTE) NULL;
    }

    plogPal->palVersion = 0x300;
    plogPal->palNumEntries = (WORD) iNumEntries;
    pjTmp = (PBYTE) plogPal;
    pjTmp += 4;
    GetPaletteEntries(hPalSrc, 0, iNumEntries, (PPALETTEENTRY)pjTmp);
    hPal = CreatePalette(plogPal);

    GlobalFree(plogPal);

    return hPal;
}

LONG_PTR APIENTRY CtrlPanelDlgProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 3329 of file MfEdit.c.

{
    switch (msg) {
        case WM_INITDIALOG: {
            int index;

            for (index = 0; index < OD_BTN_CNT; index++) {
                grHwndCtrlBtn[index] = (PVOID)GetDlgItem(hwnd, (INT)(ID_OD_BTN_BASE+index));
            }
            for (index = 0; index < OD_TOOL_CNT; index++) {
                grHwndToolBtn[index] = (PVOID)GetDlgItem(hwnd, (INT)(ID_OD_TOOL_BASE+index));
            }
            return TRUE;
        }

        case WM_DRAWITEM: {
            PDRAWITEMSTRUCT pDIS = (PDRAWITEMSTRUCT) lParam;
            HBITMAP hBmpOld;
            BITMAP  bm;
            HANDLE  hCtl;
            HDC     hDCCtl;

            if (pDIS->CtlID == gdwCurCtrl) {
                GetObject((HBITMAP) ghBmpDn[pDIS->CtlID - ID_OD_BTN_BASE], sizeof(BITMAP), (LPSTR)&bm);
                hBmpOld = SelectObject(ghDCMem, (HBITMAP) ghBmpDn[pDIS->CtlID - ID_OD_BTN_BASE]);
            }

            if (pDIS->CtlID == gdwCurTool) {
                GetObject((HBITMAP)ghToolBmpDn[pDIS->CtlID - ID_OD_TOOL_BASE], sizeof(BITMAP), (LPSTR)&bm);
                hBmpOld = SelectObject(ghDCMem, (HBITMAP)ghToolBmpDn[pDIS->CtlID - ID_OD_TOOL_BASE]);
            }

            if ((pDIS->CtlID < ID_OD_TOOL_BASE) && (pDIS->CtlID != gdwCurCtrl)) {
                GetObject((HBITMAP)ghBmpUp[pDIS->CtlID - ID_OD_BTN_BASE], sizeof(BITMAP), (LPSTR)&bm);
                hBmpOld = SelectObject(ghDCMem, (HBITMAP)ghBmpUp[pDIS->CtlID - ID_OD_BTN_BASE]);
            }

            if ((pDIS->CtlID >= ID_OD_TOOL_BASE) && (pDIS->CtlID != gdwCurTool)) {
                GetObject((HBITMAP)ghToolBmpUp[pDIS->CtlID - ID_OD_TOOL_BASE], sizeof(BITMAP), (LPSTR)&bm);
                hBmpOld = SelectObject(ghDCMem, (HBITMAP)ghToolBmpUp[pDIS->CtlID - ID_OD_TOOL_BASE]);
            }

            //
            // pDIS->hDC is clipped to the update region but unfortunately
            // that doesn't work well with StretchBlt.  StretchBlt is used
            // because I don't have to make sure that the bitmap size is
            // exactly the same as the size of the button.
            //
            hCtl   = GetDlgItem(hwnd, pDIS->CtlID);
            hDCCtl = GetDC(hCtl);
            StretchBlt(hDCCtl,                                //pDIS->hDC,
                   pDIS->rcItem.left, pDIS->rcItem.top,
                   pDIS->rcItem.right - pDIS->rcItem.left,
                   pDIS->rcItem.bottom - pDIS->rcItem.top,
                   ghDCMem, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
            ReleaseDC(hCtl, hDCCtl);
            SelectObject(ghDCMem, hBmpOld);
            break;
        }

        case WM_COMMAND: {
            DWORD_PTR dwOldCtrl = gdwCurCtrl;
            DWORD_PTR dwOldTool = gdwCurTool;

            switch (dwParam) {
                case DID_ONE:
                case DID_TWO:
                case DID_THREE:
                case DID_FOUR:
                case DID_FIVE:
                case DID_SIX:
                case DID_SEVEN:
                case DID_EIGHT:
                case DID_NINE:
                case DID_ZERO:
                case DID_TEN_PLUS:
                    //SetDlgItemInt(ghwndCtrlPanel, DID_COUNTER, dwParam - DID_ZERO, FALSE);
                    SendMessage(ghwndMain, WM_COMMAND, dwParam, lParam);
                    break;
                case DID_OPEN:
                case DID_RECORD:
                case DID_STOP:
                case DID_PLAY:
                case DID_FF:
                    SendMessage(ghwndMain, WM_COMMAND, dwParam, lParam);
                    gdwCurCtrl = dwParam;
                    InvalidateRect((HWND)grHwndCtrlBtn[dwOldCtrl - ID_OD_BTN_BASE], NULL, FALSE);
                    InvalidateRect((HWND)grHwndCtrlBtn[gdwCurCtrl - ID_OD_BTN_BASE], NULL, FALSE);
                    break;
                case DID_CLEAR:
                    SendMessage(ghwndMain, WM_COMMAND, dwParam, lParam);
                    break;
                case DID_TEXT:
                case DID_PEN:
                case DID_RECT:
                case DID_FILLRECT:
                case DID_ELLIPSE:
                case DID_FILLELLIPSE:
                case DID_LINE:
                case DID_BEZIER:
                case DID_BMPOBJ:
                case DID_METAF:
                    SendMessage(ghwndMain, WM_COMMAND, dwParam, lParam);
                    gdwCurTool = dwParam;
                    InvalidateRect((HWND)grHwndToolBtn[dwOldTool - ID_OD_TOOL_BASE], NULL, FALSE);
                    InvalidateRect((HWND)grHwndToolBtn[gdwCurTool - ID_OD_TOOL_BASE], NULL, FALSE);
                    break;
            }
            break;
        }

        case WM_PAINT:
            {
                HDC hdc;
                RECT rc, rcDlg;
                PAINTSTRUCT ps;
                HPEN hpenWindowFrame, hpenDarkGray;
                int  icyDlg;
                int  icyBorder;

                icyBorder = GetSystemMetrics(SM_CYBORDER);

                GetWindowRect(hwnd, &rcDlg);
                icyDlg = rcDlg.right - rcDlg.left;

                /*
                 * Draw our border lines.
                 */
                GetClientRect(hwnd, &rc);
                hdc = BeginPaint(hwnd, &ps);

                SelectObject(hdc, GetStockObject(WHITE_PEN));
                MoveToEx(hdc, rc.left, rc.top, NULL);
                LineTo(hdc, rc.right, rc.top);

                hpenDarkGray = CreatePen(PS_SOLID, 1, DARKGRAY);
                SelectObject(hdc, hpenDarkGray);
                MoveToEx(hdc, rc.left, (rc.top + icyDlg) - icyBorder - 1, NULL);
                LineTo(hdc, rc.right, (rc.top + icyDlg) - icyBorder - 1);

                hpenWindowFrame = CreatePen(PS_SOLID, icyBorder,
                        GetSysColor(COLOR_WINDOWFRAME));
                SelectObject(hdc, hpenWindowFrame);
                MoveToEx(hdc, rc.left, (rc.top + icyDlg) - icyBorder, NULL);
                LineTo(hdc, rc.right, (rc.top + icyDlg) - icyBorder);

                EndPaint(hwnd, &ps);
                DeleteObject(hpenWindowFrame);
                DeleteObject(hpenDarkGray);
            }

            break;

        //case WM_CTLCOLOR:
        case WM_CTLCOLORDLG:
        //case WM_CTLCOLORLISTBOX:
        case WM_CTLCOLORSTATIC:
            switch (GET_WM_CTLCOLOR_TYPE(dwParam, lParam, msg)) {
                case CTLCOLOR_DLG:
                //case CTLCOLOR_LISTBOX:
                    return (BOOL)(INT_PTR)GetStockObject(LTGRAY_BRUSH);

                case CTLCOLOR_STATIC:
                    SetBkMode(GET_WM_CTLCOLOR_HDC(dwParam, lParam, msg),
                              TRANSPARENT);
                //    SetTextColor(GET_WM_CTLCOLOR_HDC(dwParam, lParam, msg),
                //              RGB(255,0,0));
                //    SetBkColor(GET_WM_CTLCOLOR_HDC(dwParam, lParam, msg),
                //            LIGHTGRAY);
                //              RGB(255, 255,0));
                    return (BOOL)(INT_PTR)GetStockObject(DKGRAY_BRUSH);
            }
            //return (BOOL)NULL;
            return (BOOL)(INT_PTR)GetStockObject(LTGRAY_BRUSH);

        default:
            return FALSE;
    }

    return FALSE;
}

LONG_PTR APIENTRY DrawSurfWndProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 2917 of file MfEdit.c.

{
    static BOOL    bTrack = FALSE;
    static int     OrgX, OrgY;
    static int     PrevX, PrevY;
    static HDC     hDC;
    static HCURSOR hCurArrow, hCurHT;
    static BOOL    b3DSetup = FALSE;

    switch (message) {
    case WM_CREATE: {
        RECT                    rect;

        hDC = GetDC(hwnd);

            {
            char text[128];

            _sntprintf(text, 127, "DrawSurfWndProc: hDC=%p", hDC);
            text [127] = '\0';
      vErrOut(text);
            }

            bSetAdvancedGraphics(hDC);

            if (gb3D)
                b3DSetup = bSetupRC(hDC, NULL);

        ReleaseDC(hwnd, hDC);

        GetClientRect(GetParent(hwnd), &rect);

        SetWindowPos(hwnd, NULL,
            0,
            30,
            rect.right-rect.left,
            rect.bottom-rect.top-30,
            SWP_NOZORDER | SWP_NOMOVE);
            CreateCaret(hwnd, NULL, 1, CARET_HEIGHT);
#if 0
        //CreateCaret(hwnd, NULL, 1, 12);
        //hbmp = LoadBitmap(ghModule, (LPCSTR)MAKEINTRESOURCE(BMID_TOOLBASED));

        hPal = CreatePalette((LOGPALETTE *)&LogPal);
        hDC = GetDC(hwnd);
        hOldPal = SelectPalette(hDC, hPal, FALSE);
        RealizePalette(hDC);

        hbmp = CreateDIBitmap(hDC, (LPBITMAPINFOHEADER)&DIBHdr, CBM_CREATEDIB, &dib, (LPBITMAPINFO)&DIBHdr, DIB_PAL_COLORS);
        CreateCaret(hwnd, hbmp, 1, 12);

        ReleaseDC(hwnd, hDC);
#endif

        ghCurFont = GetStockObject(SYSTEM_FONT);
        GetObject(ghCurFont, sizeof(LOGFONT), &glf);
        hCurArrow = LoadCursor(NULL, IDC_ARROW);
        hCurHT = LoadCursor(NULL, IDC_CROSS);
        break;
    }

    case WM_LBUTTONDOWN: {
        int    x, y;

        x = (int) LOWORD(lParam);
        y = (int) HIWORD(lParam);

        if (gbHitTest) {
        hDC = GetDC(hwnd);
        bHitTest(hDC, x, y);
        ReleaseDC(hwnd, hDC);
        break;
        }

        bTrack = TRUE;
        OrgX = PrevX = x;
        OrgY = PrevY = y;

        hDC = GetDC(hwnd);
        SetCapture(hwnd);
        break;
    }

    case WM_MOUSEMOVE: {
        RECT rectClient;
        int NextX;
        int NextY;

        if (gbHitTest) {
        SetCursor(hCurHT);
        } else {
        SetCursor(hCurArrow);
        }

        // Update the selection region
        if (bTrack) {
        NextX = (SHORT) LOWORD(lParam);
        NextY = (SHORT) HIWORD(lParam);

        // Do not draw outside the window's client area

        GetClientRect (hwnd, &rectClient);
        if (NextX < rectClient.left) {
            NextX = rectClient.left;
        } else if (NextX >= rectClient.right) {
            NextX = rectClient.right - 1;
        }
        if (NextY < rectClient.top) {
            NextY = rectClient.top;
        } else if (NextY >= rectClient.bottom) {
            NextY = rectClient.bottom - 1;
        }
        if ((NextX != PrevX) || (NextY != PrevY)) {
           SetROP2(hDC, R2_NOT);       // Erases the previous box
           bDrawStuff(hDC, OrgX, OrgY, PrevX, PrevY, TRUE, TRUE, FALSE, NULL);

           //
           // Optimization.  Do not record in metafile DC if it is going
           // to be erased.  So only call bDrawStuff with the PEN tool.
           //
           if (gbRecording && (ghDCMetaf != NULL) && (gdwCurTool == DID_PEN)) {
               bDrawStuff(ghDCMetaf, OrgX, OrgY, PrevX, PrevY, TRUE, TRUE, FALSE, NULL);
           }

        // Get the current mouse position
           PrevX = NextX;
           PrevY = NextY;

           //
           // SetROP2(hDC, R2_COPYPEN);
           //   This is commented out because we don't want to erase
           //   the background as it sweeps.
           //
           bDrawStuff(hDC, OrgX, OrgY, PrevX, PrevY, FALSE, TRUE, FALSE, NULL);

           if (gbRecording && (ghDCMetaf != NULL) && (gdwCurTool == DID_PEN)) {
               bDrawStuff(ghDCMetaf, OrgX, OrgY, PrevX, PrevY, FALSE, TRUE, FALSE, NULL);
           }

        }
        }
        break;

    }

      case WM_LBUTTONUP: {
        int NextX;
        int NextY;

        if (!bTrack)
           break;

        // End the selection
           ReleaseCapture();
           bTrack = FALSE;

        // Erases the box
           //
           // SetROP2(hDC, R2_NOT);
           //   This is assumed to be R2_NOT, thus unnecessary
           //
           bDrawStuff(hDC, OrgX, OrgY, PrevX, PrevY, TRUE, FALSE, FALSE, NULL);

           if (gbRecording && (ghDCMetaf != NULL) && (gdwCurTool == DID_PEN)) {
               bDrawStuff(ghDCMetaf, OrgX, OrgY, PrevX, PrevY, TRUE, FALSE, FALSE, NULL);
           }

           //
           // Apparently, at buttonup time, the mouse location is not clamped to
           // the client area.  So, the final ellipse or rectangle will be extended
           // outside the client area.
           //
           // NextX = (SHORT) LOWORD(lParam);
           // NextY = (SHORT) HIWORD(lParam);
           NextX = PrevX;
           NextY = PrevY;

        // Draws the new box
           SetROP2(hDC, R2_COPYPEN);
           bDrawStuff(hDC, OrgX, OrgY, NextX, NextY, FALSE, FALSE, TRUE, NULL);

           ReleaseDC(hwnd, hDC);

           if (gbRecording && (ghDCMetaf != NULL)) {
                bDrawStuff(ghDCMetaf, OrgX, OrgY, NextX, NextY, FALSE, FALSE, FALSE, NULL);
           }

        break;
      } // case WM_LBUTTONUP

#ifdef JAPAN
      case WM_IME_REPORT:
        if (IR_STRING == wParam) {
            LPSTR   lpsz, lpszMeta;

            if (!(lpsz = lpszMeta = GlobalLock((HANDLE)lParam))) {
                return FALSE;
            }
            hDC = GetDC(hwnd);
        while(*lpsz) { // Draw all characters in the string
        bDrawStuff(hDC, 0, 0, 0, 0, TRUE, FALSE, FALSE, lpsz);
        IsDBCSLeadByte((BYTE)*lpsz) ? lpsz += 2 : ++lpsz;
        }
            ReleaseDC(hwnd, hDC);
            if (gbRecording && (ghDCMetaf != NULL)) {
        while(*lpszMeta) { // Draw all characters in the string
            bDrawStuff(ghDCMetaf, 0, 0, 0, 0, TRUE, FALSE, FALSE, lpszMeta);
            IsDBCSLeadByte((BYTE)*lpszMeta) ? lpszMeta += 2 : ++lpszMeta;
        }
            }
            GlobalUnlock((HANDLE)lParam);
            return TRUE;
        }
    return DefWindowProc(hwnd, message, wParam, lParam);
        break;
#endif

      case WM_CHAR: {

        if (gdwCurTool != DID_TEXT)
            break;

        hDC = GetDC(hwnd);
        bDrawStuff(hDC, 0, 0, 0, 0, TRUE, FALSE, FALSE, (LPSTR)&wParam);
        ReleaseDC(hwnd, hDC);

        if (gbRecording && (ghDCMetaf != NULL)) {
            bDrawStuff(ghDCMetaf, 0, 0, 0, 0, TRUE, FALSE, FALSE, (LPSTR)&wParam);
        }

        break;
      }

      case WM_DESTROY: {
        HDC         hDCt;
        HPALETTE    hPal;

        DestroyCaret();
        DeleteObject(ghCurFont);

        if (gb3D && b3DSetup) {
            bCleanUpRC();
        }

        hDCt = GetDC(hwnd);
        hPal = SelectObject(hDCt, GetStockObject(DEFAULT_PALETTE));
        DeleteObject(hPal);
        ReleaseDC(hwnd, hDCt);

    PostQuitMessage(0);
    return 0L;
      }

      default:
    return DefWindowProc(hwnd, message, wParam, lParam);
    }

    return 0;

}

HLOCAL Free ( CMTMLTFMT * pMfmt )

Definition at line 5847 of file MfEdit.c.

                              {
    return LocalFree(pMfmt);
}

LPTSTR GetStringRes ( int )

Definition at line 736 of file Generic.C.

{
  static TCHAR buffer[MAX_PATH];

  buffer[0]=0;
  LoadString (GetModuleHandle (NULL), id, buffer, MAX_PATH);
  return buffer;
}

LPTSTR GetStringRes2 ( int )

Definition at line 6070 of file MfEdit.c.

{
  static TCHAR buffer[MAX_PATH];

  buffer[0]=0;
  LoadString (GetModuleHandle (NULL), id, buffer, MAX_PATH);
  return buffer;
}

HBITMAP hBmpLoadBitmapFile | ( | HDC | ,
 |  | PSTR |
 | ) |  |

Definition at line 4505 of file MfEdit.c.

{
    HANDLE              hFile, hMapFile;
    LPVOID              pMapFile, pMapFileTmp;
    LPBITMAPINFOHEADER  pbmh;
    LPBITMAPINFO        pbmi;
    PBYTE               pjTmp;
    ULONG               sizBMI;
    HBITMAP             hBitmap;
    INT                 iNumClr;
    BOOL                bCoreHdr;
    WORD                wBitCount;
    PFILEINFO           pFileInfo;

    hBitmap = NULL;

    if ((hFile = CreateFile(pszFileName, GENERIC_READ, FILE_SHARE_READ, NULL,
            OPEN_EXISTING, FILE_ATTRIBUTE_READONLY | SECURITY_SQOS_PRESENT | SECURITY_ANONYMOUS,
            NULL)) == INVALID_HANDLE_VALUE) {
        SetWindowText(ghTextWnd, GetStringRes(IDS_FILEOPNFAIL));
        goto ErrExit1;
    }
    if ( GetFileType(hFile) != FILE_TYPE_DISK )
    {
        goto ErrExit2;
    }

    //
    // Create a map file of the opened file
    //
    if ((hMapFile = CreateFileMapping(hFile, NULL,
                             PAGE_READONLY, 0, 0, NULL)) == INVALID_HANDLE_VALUE) {
        SetWindowText(ghTextWnd, GetStringRes(IDS_CREMAPFILEFAIL));
        goto ErrExit2;

    }

    //
    // Map a view of the whole file
    //
    if ((pMapFile = MapViewOfFile(hMapFile, FILE_MAP_READ, 0, 0, 0)) == NULL) {
        SetWindowText(ghTextWnd, GetStringRes(IDS_MAPVWOFMAPFOFAIL));
        goto ErrExit3;
    }

    pMapFileTmp = pMapFile;

    //
    // First check that it is a bitmap file
    //
    if (*((PWORD)pMapFile) != 0x4d42) {              // 'BM'
        MessageBox(ghwndMain, GetStringRes(IDS_NOTDIBBMFILE),
            GetStringRes(IDS_ERROR), MB_OK);
        goto ErrExit3;
    }

    //
    // The file header doesn't end on DWORD boundary...
    //
    pbmh = (LPBITMAPINFOHEADER)((PBYTE)pMapFile + sizeof(BITMAPFILEHEADER));

    {
        BITMAPCOREHEADER bmch, *pbmch;
        BITMAPINFOHEADER bmih, *pbmih;
        PBYTE            pjTmp1;
        ULONG            ulSiz;

        pbmch = &bmch;
        pbmih = &bmih;

        pjTmp1 = (PBYTE)pbmh;
        ulSiz  = sizeof(BITMAPCOREHEADER);
        while (ulSiz--) {
            *(((PBYTE)pbmch)++) = *(((PBYTE)pjTmp1)++);
        }

        pjTmp1 = (PBYTE)pbmh;
        ulSiz = sizeof(BITMAPINFOHEADER);
        while (ulSiz--) {
            *(((PBYTE)pbmih)++) = *(((PBYTE)pjTmp1)++);
        }

        //
        // Use the size to determine if it is a BitmapCoreHeader or
        // BitmapInfoHeader
        //
        // Does PM supports 16 and 32 bpp? How?
        //
        if (bmch.bcSize == sizeof(BITMAPCOREHEADER))
        {
            wBitCount = bmch.bcBitCount;
            iNumClr = ((wBitCount == 24) ? 0 : (1 << wBitCount));
            sizBMI = sizeof(BITMAPCOREHEADER)+sizeof(RGBTRIPLE)*iNumClr;
            bCoreHdr = TRUE;
        }
        else            // BITMAPINFOHEADER
        {
            wBitCount = bmih.biBitCount;
            switch (wBitCount) {
                case 16:
                case 32:
                    sizBMI = sizeof(BITMAPINFOHEADER)+sizeof(DWORD)*3;
                    break;
                case 24:
                    sizBMI = sizeof(BITMAPINFOHEADER);
                    break;
                default:
                    iNumClr = (1 << wBitCount);
                    sizBMI = sizeof(BITMAPINFOHEADER)+sizeof(RGBQUAD)*iNumClr;
                    break;
            }
            bCoreHdr = FALSE;
        }
    }

    if ((pbmi = (LPBITMAPINFO) LocalAlloc(LMEM_FIXED,sizBMI)) == NULL) {
        MessageBox(ghwndMain, GetStringRes(IDS_MALLOCFAIL),
            GetStringRes(IDS_ERROR), MB_OK);
        goto ErrExit3;
    }

    //
    // Make sure we pass in a DWORD aligned BitmapInfo to CreateDIBitmap
    // Otherwise, exception on the MIPS platform
    // CR!!!  Equivalent to memcpy
    //
    pjTmp = (PBYTE)pbmi;

    while(sizBMI--)
    {
        *(((PBYTE)pjTmp)++) = *(((PBYTE)pbmh)++);
    }

    pMapFile = (PBYTE)pMapFile + ((BITMAPFILEHEADER *)pMapFile)->bfOffBits;

// !!! Use CreateBitmap for monochrome bitmap?

    //
    // Select the palette into the DC first before CreateDIBitmap()
    //
    bSelectDIBPal(hDC, pbmi, bCoreHdr);

// !!! We always pass a screen DC to this routine.
// !!! Maybe we should pass a metafile DC to this routine too.
// !!! The bitmap handle created for the screen DC won't give correct
// !!! color for the metafile DC.  So now, we always use the original
// !!! DIB info.
    if ((hBitmap = CreateDIBitmap(hDC, (LPBITMAPINFOHEADER)pbmi,
                        CBM_INIT, pMapFile, pbmi, DIB_RGB_COLORS)) == NULL) {
        SetWindowText(ghTextWnd, "Fail in creating DIB bitmap from file!");
        goto ErrExit4;
    }

    // reset gbUseDIB flag, now that we have opened up a new DIB
    gbUseDIB = FALSE;

// !!! Always use the DIB info o.w. metafile DC don't get the right color.
#if 0
    if (GetDeviceCaps(hDC, BITSPIXEL) < wBitCount) {
#endif
        gbUseDIB = TRUE;
        bFreeDibFile(&gDib);
        pFileInfo = &(gDib.rgFileInfo[0]);
        pFileInfo->hFile        = hFile;
        pFileInfo->hMapFile     = hMapFile;
        pFileInfo->lpvMapView   = pMapFileTmp;

        gDib.rgpjFrame[0]       = pMapFile;
        gDib.rgpbmi[0]          = pbmi;
        gDib.rgbCoreHdr[0]      = bCoreHdr;
        gDib.ulFrames           =
        gDib.ulFiles            = 1;
        return (hBitmap);
#if 0
    }
#endif

ErrExit4:
    LocalFree(pbmi);
ErrExit3:
    CloseHandle(hMapFile);
ErrExit2:
    CloseHandle(hFile);
ErrExit1:

    return (hBitmap);

}

HBRUSH hBrCreateBrush | ( | HDC | ,
 |  | DWORD |
 | ) |  |

Definition at line 5185 of file MfEdit.c.

{
    HDC hdcMem;
    HBRUSH hbr;
    HBRUSH hbrOld;
    HBITMAP hbmPat;
    HBITMAP hbmOld;

    hbr = CreateSolidBrush(dwRGB);
    hdcMem = CreateCompatibleDC(hDC);

    //
    // Minimum size for a bitmap to be used in a fill pattern is 8x8
    //
    hbmPat = CreateCompatibleBitmap(hDC, 8, 8);

    hbmOld = SelectObject(hdcMem, hbmPat);
    hbrOld = SelectObject(hdcMem, hbr);
    PatBlt(hdcMem, 0, 0, 8, 8, PATCOPY);

    //
    // Deselect hbmPat and hbr
    //
    SelectObject(hdcMem, hbmOld);
    SelectObject(hdcMem, hbrOld);

    DeleteDC(hdcMem);
    DeleteObject(hbr);

    hbr = CreatePatternBrush(hbmPat);

    DeleteObject(hbmPat);

    return hbr;
}

HDC hDCRecordMetafileAs | ( | HWND | ,
 |  | LPSTR |
 | ) |  |

Definition at line 4264 of file MfEdit.c.

                                                     {
    OPENFILENAME ofn;
    char szFile[MAX_ARRAYSIZE], szFileTitle[MAX_ARRAYSIZE];
    static char *szFilter;
    char *szTmp, szTmp2[MAX_ARRAYSIZE];
    HDC  hDCMeta;

    int iWidthMM, iHeightMM, iWidthPels, iHeightPels, iMMPerPelX, iMMPerPelY;
    RECT rc;
    HDC hDC;

    BuildFilterStrs(-1);
    szFilter = BuildFilterStrs(IDS_FT_EMF);
    strncpy( szFile, "*.emf\0", MAX_ARRAYSIZE -1);
  szFile [MAX_ARRAYSIZE - 1] = '\0';
    ofn.lStructSize = sizeof(OPENFILENAME);
    ofn.hwndOwner = hwnd;
    ofn.lpstrFilter = szFilter;
    ofn.lpstrCustomFilter = (LPSTR) NULL;
    ofn.nMaxCustFilter = 0L;
    ofn.nFilterIndex = 0L;
    ofn.lpstrFile = szFile;
    ofn.nMaxFile = sizeof(szFile);
    ofn.lpstrFileTitle = szFileTitle;
    ofn.nMaxFileTitle = sizeof(szFileTitle);
    ofn.lpstrInitialDir = NULL;
    ofn.lpstrTitle = GetStringRes(IDS_SAVEMFAS);
    ofn.Flags = OFN_SHOWHELP | OFN_OVERWRITEPROMPT;
    ofn.nFileOffset = 0;
    ofn.nFileExtension = 0;
    ofn.lpstrDefExt = (LPSTR)NULL;

    if (!GetSaveFileName(&ofn)) {
        return 0L;
    }

    hDC = GetDC(hwnd);
    iWidthMM = GetDeviceCaps(hDC, HORZSIZE);
    iHeightMM = GetDeviceCaps(hDC, VERTSIZE);
    iWidthPels = GetDeviceCaps(hDC, HORZRES);
    iHeightPels = GetDeviceCaps(hDC, VERTRES);
    ReleaseDC(hwnd, hDC);
    iMMPerPelX = (iWidthMM * 100)/iWidthPels;
    iMMPerPelY = (iHeightMM * 100)/iHeightPels;
    GetClientRect(ghwndDrawSurf, &rc);
    rc.left = rc.left * iMMPerPelX;
    rc.top = rc.top * iMMPerPelY;
    rc.right = rc.right * iMMPerPelX;
    rc.bottom = rc.bottom * iMMPerPelY;

    //hDCMeta = CreateEnhMetaFile((HDC)NULL, szFile, (LPRECT)NULL, (LPSTR)NULL);
    {
        CHAR    szDesc[MAX_ARRAYSIZE];

        _sntprintf(szDesc, MAX_ARRAYSIZE - 1, "SDK Enhanced Metafile Editor\\0%s\\0\\0", szFileTitle);
    szDesc [MAX_ARRAYSIZE - 1] = '\0';
        hDCMeta = CreateEnhMetaFile((HDC)NULL, szFile, (LPRECT)&rc, (LPSTR)szDesc);

        if (gb3D)
            gbRCSet = bSetupRC(hDCMeta, NULL);

        bSetAdvancedGraphics(hDCMeta);
    }

    //
    // parses the new filename, removes the extension and copy it into
    // szFilename
    //
    strncpy( szFilename, "", MAX_ARRAYSIZE - 1);
  szFilename [MAX_ARRAYSIZE - 1] = '\0';
    szTmp = (char *)My_mbstok(szFile, "\\");
    strncpy( szTmp2, szTmp, MAX_ARRAYSIZE - 1 );
  szTmp2 [MAX_ARRAYSIZE - 1] = '\0';
    while (szTmp != NULL) {
        szTmp = (char *)My_mbstok(NULL, "\\");
        if (szTmp != NULL) {
            szFilename [MAX_ARRAYSIZE - 1] = '\0'; // make sure null terminated for strlen
            szTmp2 [sizeof (szTmp2) - 1] = '\0';   // make sure null terminated for strlen
            if ((strlen(szFilename)+strlen(szTmp2))/sizeof(char) >= MAX_ARRAYSIZE - 1) // check for this and next strcat
                return 0L;
            else
                strncat(szFilename, szTmp2, MAX_ARRAYSIZE - strlen (szFilename));
            strncpy( szTmp2, szTmp, MAX_ARRAYSIZE - 1);
      szTmp2 [MAX_ARRAYSIZE - 1] = '\0';
            strncat(szFilename, "\\", MAX_ARRAYSIZE - strlen (szFilename));
        }
    }
    szTmp = (char *)My_mbstok(szTmp2, ".");
    szTmp [sizeof (szTmp) - 1] = '\0';
    szFilename [MAX_ARRAYSIZE - 1] = '\0';
    if ((strlen(szFilename)+strlen(szTmp))/sizeof(char) >= MAX_ARRAYSIZE)
        return 0L;
    else
        strncat(szFilename, szTmp, MAX_ARRAYSIZE - strlen (szFilename));

    return hDCMeta;
}

HENHMETAFILE hemfLoadMetafile ( HWND )

Definition at line 4017 of file MfEdit.c.

                                         {
    OPENFILENAME    ofn;
    char            szFile[MAX_ARRAYSIZE], szFileTitle[MAX_ARRAYSIZE];
    static char     *szFilter;

    HMETAFILE       hmf;
    UINT            uiSize;
    LPVOID          pvData;
    HDC             hDCDrawSurf;
    HENHMETAFILE    hemf;

    HANDLE                  hFile, hMapFile;
    LPVOID                  pMapFile;
    LPENHMETAHEADER         pemh;

    BOOL        bSuccess;
    char            text[128];

    bSuccess = TRUE;

    BuildFilterStrs(-1);
    BuildFilterStrs(IDS_FT_EMF);
    szFilter = BuildFilterStrs(IDS_FT_WMF);

    strncpy( szFile, "*.emf\0", MAX_ARRAYSIZE - 1);
  szFile [MAX_ARRAYSIZE - 1] = '\0';
    ofn.lStructSize = sizeof(OPENFILENAME);
    ofn.hwndOwner = hwnd;
    ofn.lpstrFilter = szFilter;
    ofn.lpstrCustomFilter = (LPSTR) NULL;
    ofn.nMaxCustFilter = 0L;
    ofn.nFilterIndex = 1;
    ofn.lpstrFile = szFile;
    ofn.nMaxFile = sizeof(szFile);
    ofn.lpstrFileTitle = szFileTitle;
    ofn.nMaxFileTitle = sizeof(szFileTitle);
    ofn.lpstrInitialDir = NULL;
    ofn.lpstrTitle = GetStringRes(IDS_LDMF);
    ofn.Flags = 0L;
    ofn.nFileOffset = 0;
    ofn.nFileExtension = 0;
    ofn.lpstrDefExt = "EMF";

    if (!GetOpenFileName(&ofn))
        return 0L;

    if ((hFile = CreateFile(szFile, GENERIC_READ, FILE_SHARE_READ, NULL,
            OPEN_EXISTING, FILE_ATTRIBUTE_READONLY | SECURITY_SQOS_PRESENT | SECURITY_ANONYMOUS,
            NULL)) == INVALID_HANDLE_VALUE) {
        _sntprintf(text, 127, GetStringRes(IDS_FMT_FILEOPNFAIL), GetLastError());
    text [127] = '\0';
        MessageBox(ghwndMain, text, GetStringRes(IDS_ERROR), MB_OK);
        return 0L;
    }
    if ( GetFileType(hFile) != FILE_TYPE_DISK )
    {
        CloseHandle(hFile);
        return 0L;
    }

    //
    // Create a map file of the opened file
    //
    if ((hMapFile = CreateFileMapping(hFile, NULL,
                             PAGE_READONLY, 0, 0, "MapF")) == NULL) {
        _sntprintf(text, 127, GetStringRes(IDS_FMT_CREMAPFILEFAIL), GetLastError());
    text [127] = '\0';
        MessageBox(ghwndMain, text, GetStringRes(IDS_ERROR), MB_OK);
        bSuccess = FALSE;
        goto ErrorExit1;
    }

    //
    // Map a view of the whole file
    //
    if ((pMapFile = MapViewOfFile(hMapFile, FILE_MAP_READ, 0, 0, 0)) == NULL) {
        _sntprintf(text, 127, GetStringRes(IDS_FMT_MAPVWMAPFOFAIL), GetLastError());
    text [127] = '\0';
        MessageBox(ghwndMain, text, GetStringRes(IDS_ERROR), MB_OK);
        bSuccess = FALSE;
        goto ErrorExit2;
    }

    //
    // First check that if it is an enhanced metafile
    //
    pemh = (LPENHMETAHEADER) pMapFile;
    if (pemh->dSignature == META32_SIGNATURE) {
        hemf = GetEnhMetaFile(szFile);
        goto HLM_EXIT;
    }

    //
    // If it has an ALDUS header skip it
    // Notice: APMSIZE is used because the HANDLE and RECT of the structure
    //         depends on the environment
    //
    if (*((LPDWORD)pemh) == ALDUS_ID) {
        //METAFILEPICT    mfp;

        MessageBox(ghwndMain, GetStringRes(IDS_ALDUSMF), "Hey!", MB_OK);
        uiSize = *((LPDWORD) ((PBYTE)pMapFile + APMSIZE + 6));
        hDCDrawSurf = GetDC(ghwndDrawSurf);

        // Notice: mtSize is size of the file in word.
        // if LPMETAFILEPICT is NULL
        //    MM_ANISOTROPIC mode and default device size will be used.
        hemf = SetWinMetaFileBits(uiSize*2L, (PBYTE)pMapFile + APMSIZE, hDCDrawSurf, NULL);
#if 0
        switch ( ((PAPMFILEHEADER) pMapFile)->inch ) {
            // !!! End up in an upside down image
            //
            case 1440:
                mfp.mm = MM_TWIPS;
                OutputDebugString("MM_TWIPS\n");
                break;
            case 2540:
                OutputDebugString("MM_HIMETRIC\n");
                mfp.mm = MM_HIMETRIC;
                break;
            case 254:
                OutputDebugString("MM_LOMETRIC\n");
                mfp.mm = MM_LOMETRIC;
                break;
            case 1000:
                OutputDebugString("MM_HIENGLISH\n");
                mfp.mm = MM_HIENGLISH;
                break;
            case 100:
                OutputDebugString("MM_LOENGLISH\n");
                mfp.mm = MM_LOENGLISH;
                break;
            default:
                // !!! In addition, text is too small
                //
                OutputDebugString("MM_ANISOTROPIC\n");
                mfp.mm = MM_ANISOTROPIC;
                mfp.xExt = (((PAPMFILEHEADER) pMapFile)->bbox.Right - ((PAPMFILEHEADER) pMapFile)->bbox.Left)
                           * ((PAPMFILEHEADER) pMapFile)->inch * 2560;
                mfp.yExt = (((PAPMFILEHEADER) pMapFile)->bbox.Bottom - ((PAPMFILEHEADER) pMapFile)->bbox.Top)
                           * ((PAPMFILEHEADER) pMapFile)->inch * 2560;
                break;
        }
        mfp.hMF = 0;
        hemf = SetWinMetaFileBits(uiSize*2L, (PBYTE)pMapFile + APMSIZE, hDCDrawSurf, &mfp);
#endif

        if (!hemf) {
            char textbuf[MAX_ARRAYSIZE];

            _sntprintf(textbuf, MAX_ARRAYSIZE - 1,GetStringRes(IDS_FMT_SETWMFBTSFAIL), GetLastError());
      textbuf [MAX_ARRAYSIZE - 1] = '\0';
            MessageBox(ghwndMain, textbuf, GetStringRes(IDS_ERROR), MB_OK);
        }

        ghmf = SetMetaFileBitsEx(uiSize*2L, (PBYTE)pMapFile + APMSIZE);
        if (!ghmf) {
            char textbuf[MAX_ARRAYSIZE];

            _sntprintf(textbuf,MAX_ARRAYSIZE - 1, GetStringRes(IDS_FMT_SETWMFBTSXFAIL), GetLastError());
      textbuf [MAX_ARRAYSIZE - 1] = '\0';
            MessageBox(ghwndMain, textbuf, GetStringRes(IDS_ERROR), MB_OK);
        }

// !!! Displaying the Windows format metafile
//if (!PlayMetaFile(hDCDrawSurf, ghmf)) {
//    wsprintf(text, GetStringRes(IDS_FMT_PLAYMFFAIL), GetLastError());
//    MessageBox(ghwndMain, text, GetStringRes(IDS_ERROR), MB_OK);
//}
        ReleaseDC(ghwndDrawSurf, hDCDrawSurf);
        goto HLM_EXIT;
    }

    //
    // It is a Windows 3x format metafile (hopefully)
    //
    if (!(hmf = GetMetaFile((LPCSTR)szFile))) {
        char textbuf[MAX_ARRAYSIZE];

        _sntprintf(textbuf, MAX_ARRAYSIZE -1, GetStringRes(IDS_FMT_GETMFFAIL), GetLastError());
    textbuf [MAX_ARRAYSIZE - 1] = '\0';
        MessageBox(ghwndMain, textbuf, GetStringRes(IDS_ERROR), MB_OK);
        bSuccess = FALSE;
        goto ErrorExit3;
    }

    if (!(uiSize = GetMetaFileBitsEx(hmf, 0, NULL))) {
        MessageBox(ghwndMain, GetStringRes(IDS_GETMFBTSXFAIL),
            GetStringRes(IDS_ERROR), MB_OK);
        return NULL;
    }

    if ((pvData = (LPVOID) LocalAlloc(LMEM_FIXED, uiSize)) == NULL) {
        MessageBox(ghwndMain, GetStringRes(IDS_MALLOCFAIL),
            GetStringRes(IDS_ERROR), MB_OK);
        bSuccess = FALSE;
        goto ErrorExit3;
    }

    if (!(uiSize = GetMetaFileBitsEx(hmf, uiSize, pvData))) {
        MessageBox(ghwndMain, GetStringRes(IDS_GETMFBTSXFAIL2),
            GetStringRes(IDS_ERROR), MB_OK);
        bSuccess = FALSE;
        goto ErrorExit3;
    }

    DeleteMetaFile(hmf);

    hDCDrawSurf = GetDC(ghwndDrawSurf);
    hemf = SetWinMetaFileBits(uiSize, (LPBYTE)pvData, hDCDrawSurf, NULL);
    ghmf = SetMetaFileBitsEx(uiSize, (LPBYTE) pvData);

    LocalFree(pvData);

    ReleaseDC(ghwndDrawSurf ,hDCDrawSurf);

HLM_EXIT:
ErrorExit3:
    UnmapViewOfFile(pMapFile);

ErrorExit2:
    CloseHandle(hMapFile);
ErrorExit1:
    CloseHandle(hFile);

    if (bSuccess)
        return hemf;
    else
        return 0L;
}

BOOL InitializeApp ( void )

Definition at line 949 of file MfEdit.c.

{
    WNDCLASS wc;
    int index;
    HDC hDC;

    wc.style            = CS_DBLCLKS;
    wc.lpfnWndProc      = (WNDPROC)MainWndProc;
    wc.cbClsExtra       = 0;
    wc.cbWndExtra   = sizeof(DWORD_PTR);
    wc.hInstance        = ghModule;
    wc.hIcon            = LoadIcon(ghModule, MAKEINTRESOURCE(APP_ICON));
    wc.hCursor          = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground    = (HBRUSH)(COLOR_APPWORKSPACE + 1);
    wc.lpszMenuName     = "MainMenu";
    wc.lpszClassName    = "MetafDemoClass";

    if (!RegisterClass(&wc))
    return FALSE;

    wc.style            = CS_OWNDC | CS_SAVEBITS;
    wc.lpfnWndProc      = (WNDPROC)DrawSurfWndProc;
    wc.hIcon            = NULL;
    wc.hCursor          = NULL;
    wc.hbrBackground    = (HBRUSH)(COLOR_WINDOW + 1);
    wc.lpszMenuName     = NULL;
    wc.lpszClassName    = "DrawSurfClass";

    if (!RegisterClass(&wc))
    return FALSE;

    wc.style        = CS_OWNDC | CS_HREDRAW | CS_VREDRAW;
    wc.lpfnWndProc  = (WNDPROC)TextWndProc;
    wc.hIcon        = NULL;
    wc.hCursor          = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground    = (HBRUSH)(COLOR_BTNFACE + 1);
    wc.lpszMenuName = NULL;
    wc.lpszClassName    = "Text";

    if (!RegisterClass(&wc))
            return FALSE;

    hMenu   = LoadMenu(ghModule, "MainMenu");

    for (index = 0; index < OD_BTN_CNT; index++) {
        ghBmpDn[index] = (PVOID)LoadBitmap(ghModule, (LPCSTR)MAKEINTRESOURCE(BMID_BASED+index));
        ghBmpUp[index] = (PVOID)LoadBitmap(ghModule, (LPCSTR)MAKEINTRESOURCE(BMID_BASEU+index));
    }
    for (index = 0; index < OD_TOOL_CNT; index++) {
        ghToolBmpDn[index] = (PVOID)LoadBitmap(ghModule, (LPCSTR)MAKEINTRESOURCE(BMID_TOOLBASED+index));
        ghToolBmpUp[index] = (PVOID)LoadBitmap(ghModule, (LPCSTR)MAKEINTRESOURCE(BMID_TOOLBASEU+index));

    }

    ghwndMain = CreateWindowEx(0L,
            GetStringRes(IDS_MFDEMOCL), GetStringRes2(IDS_EMF),
        WS_OVERLAPPED   | WS_CAPTION     | WS_BORDER       |
        WS_THICKFRAME   | WS_MAXIMIZEBOX | WS_MINIMIZEBOX  |
        WS_CLIPCHILDREN | WS_VISIBLE     | WS_SYSMENU,
            80, 70, 600, 300,
        NULL, hMenu, ghModule, NULL);

    if (ghwndMain == NULL)
    return FALSE;

    SetWindowLongPtr(ghwndMain, GWLP_USERDATA, 0L);
    ghwndNext = SetClipboardViewer(ghwndMain);

    if (gbFit2Wnd)
        CheckMenuItem(hMenu, MM_FIT2WND, MF_CHECKED);
    else
        CheckMenuItem(hMenu, MM_FIT2WND, MF_UNCHECKED);

    if (gbImport3X)
        CheckMenuItem(hMenu, MM_IMPORT_3X, MF_CHECKED);
    else
        CheckMenuItem(hMenu, MM_IMPORT_3X, MF_UNCHECKED);

    if (gbExport3X)
        CheckMenuItem(hMenu, MM_EXPORT_3X, MF_CHECKED);
    else
        CheckMenuItem(hMenu, MM_EXPORT_3X, MF_UNCHECKED);

    SetFocus(ghwndMain);    /* set initial focus */

    gDib.ulFiles = gDib.ulFrames = 0;
    hDC = GetDC(NULL);
    ghHT = CreateHalftonePalette(hDC);
    ReleaseDC(NULL, hDC);

    return TRUE;
}

int CALLBACK iTT | ( | LPLOGFONT | ,
 |  | LPTEXTMETRIC | ,
 |  | DWORD | ,
 |  | LPARAM |
 | ) |  |

Definition at line 5651 of file MfEdit.c.

{

    if (lpTM->tmPitchAndFamily & TMPF_TRUETYPE) {
        //OutputDebugString("TRUETYPE\n");
        *((BOOL *)lpData) = TRUE;
    } else {
        //OutputDebugString("NON-TRUETYPE\n");
        *((BOOL *)lpData) = FALSE;
    }

#if 0
    //
    // that's equivalent
    //
    if (dwFontType & TRUETYPE_FONTTYPE) {
        //OutputDebugString("TRUETYPE\n");
        *((BOOL *)lpData) = TRUE;
    } else {
        //OutputDebugString("NON-TRUETYPE\n");
        *((BOOL *)lpData) = FALSE;
    }
#endif
    return 0;

    UNREFERENCED_PARAMETER (lpLF);
    //UNREFERENCED_PARAMETER (lpTM);
    UNREFERENCED_PARAMETER (dwFontType);

}

LONG_PTR APIENTRY MainWndProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 3333 of file sdkdiff.cpp.

{
    char str[32];
    long ret;
    DWORD threadid;
  HRESULT hr;

    switch (message) {

        case WM_CREATE:

            /* initialise menu options to default/saved
             * option settings
             */

#define CHECKMENU(id, fChecked)  \
          CheckMenuItem(hMenu, (id), (fChecked) ? MF_CHECKED:MF_UNCHECKED)

            /* outline_include options */
            CHECKMENU(IDM_OUTLINE_INCSAME,   (outline_include & INCLUDE_SAME));
            CHECKMENU(IDM_OUTLINE_INCLEFT,   (outline_include & INCLUDE_LEFTONLY));
            CHECKMENU(IDM_OUTLINE_INCRIGHT,  (outline_include & INCLUDE_RIGHTONLY));
            CHECKMENU(IDM_OUTLINE_INCDIFFER, (outline_include & INCLUDE_DIFFER));

            /* expand_include options */
            CHECKMENU(IDM_EXPAND_INCSAME,         (expand_include & INCLUDE_SAME));
            CHECKMENU(IDM_EXPAND_INCLEFT,         (expand_include & INCLUDE_LEFTONLY));
            CHECKMENU(IDM_EXPAND_INCRIGHT,        (expand_include & INCLUDE_RIGHTONLY));
            CHECKMENU(IDM_EXPAND_INCMOVEDLEFT,    (expand_include & INCLUDE_MOVEDLEFT));
            CHECKMENU(IDM_EXPAND_INCMOVEDRIGHT,   (expand_include & INCLUDE_MOVEDRIGHT));
            CHECKMENU(IDM_EXPAND_INCSIMILARLEFT,  (expand_include & INCLUDE_SIMILARLEFT));
            CHECKMENU(IDM_EXPAND_INCSIMILARRIGHT, (expand_include & INCLUDE_SIMILARRIGHT));

            /* other options */
            CHECKMENU(line_numbers, TRUE);
            CHECKMENU(expand_mode, TRUE);
            CHECKMENU(IDM_IGNBLANKS, ignore_blanks);
            CHECKMENU(IDM_SHOWWHITESPACE, show_whitespace);
            CHECKMENU(IDM_ALG2, Algorithm2);
            CHECKMENU(IDM_MONOCOLS, mono_colours);
            CHECKMENU(IDM_PICTURE, picture_mode);
            CHECKMENU(IDM_HIDEMARK, hide_markedfiles);
#undef CHECKMENU

            /* nothing currently displayed */
            DisplayMode = MODE_NULL;

            break;

        case WM_SYSCOLORCHANGE:
            {
                HIGHCONTRAST hc;

                hc.cbSize = sizeof(hc);
                SystemParametersInfo(SPI_GETHIGHCONTRAST,0 ,&hc, 0);

                mono_colours = (hc.dwFlags & HCF_HIGHCONTRASTON);
                if (mono_colours) {
                    SetMonoColours();
                } else {
                    SetColours();
                }

                CheckMenuItem(hMenu, IDM_MONOCOLS,
                              mono_colours? MF_CHECKED:MF_UNCHECKED);
                hr = StringCchPrintf(str, 32, szD, mono_colours);
        if (FAILED(hr))
          OutputError(hr, IDS_SAFE_PRINTF);
                WriteProfileString(APPNAME, szMonoColours, str);
                SendMessage(hwndRCD, message, wParam, lParam);
                SendMessage(hwndStatus, message, wParam, lParam);
                SendMessage(hwndBar, message, wParam, lParam);

                /* The diffs are still valid, but force a re-display
                 * of bar window and main table.
                 */
                SendMessage(hwndBar, WM_COMMAND, IDM_MONOCOLS, 0);
                InvalidateRect(hwndBar, NULL, TRUE);
                view_changeviewoptions(current_view);
            }
            break;

        case WM_COMMAND:
            switch (GET_WM_COMMAND_ID(wParam, lParam)) {
                case IDM_EXIT:
                    if (ghThread!=NULL) {
                        bAbort = TRUE;
                        SetStatus(LoadRcString(IDS_ABORT_PENDING));
                        break;
                    }
                    if (!view_isexpanded(current_view)) {
                        /* save the current outline size and position */
                        WINDOWPLACEMENT wp;
                        wp.length = sizeof(wp);
                        if (GetWindowPlacement(hwndClient,&wp)) {
                            WriteProfileInt(APPNAME, szOutlineShowCmd, wp.showCmd);
                            WriteProfileInt(APPNAME, szOutlineMaxX, wp.ptMaxPosition.x);
                            WriteProfileInt(APPNAME, szOutlineMaxY, wp.ptMaxPosition.y);
                            WriteProfileInt(APPNAME, szOutlineNormLeft, wp.rcNormalPosition.left);
                            WriteProfileInt(APPNAME, szOutlineNormTop, wp.rcNormalPosition.top);
                            WriteProfileInt(APPNAME, szOutlineNormRight, wp.rcNormalPosition.right);
                            WriteProfileInt(APPNAME, szOutlineNormBottom, wp.rcNormalPosition.bottom);
                            WriteProfileInt(APPNAME, szOutlineSaved, 1);
                        }
                    } else {
                        /* save the current expanded size and position */
                        WINDOWPLACEMENT wp;
                        wp.length = sizeof(wp);
                        if (GetWindowPlacement(hwndClient,&wp)) {
                            WriteProfileInt(APPNAME, szExpandShowCmd, wp.showCmd);
                            WriteProfileInt(APPNAME, szExpandMaxX, wp.ptMaxPosition.x);
                            WriteProfileInt(APPNAME, szExpandMaxY, wp.ptMaxPosition.y);
                            WriteProfileInt(APPNAME, szExpandNormLeft, wp.rcNormalPosition.left);
                            WriteProfileInt(APPNAME, szExpandNormTop, wp.rcNormalPosition.top);
                            WriteProfileInt(APPNAME, szExpandNormRight, wp.rcNormalPosition.right);
                            WriteProfileInt(APPNAME, szExpandNormBottom, wp.rcNormalPosition.bottom);
                            WriteProfileInt(APPNAME, szExpandedSaved, 1);
                        }
                    }
                    DestroyWindow(hWnd);
                    break;

                case IDM_ABORT:
                    /* abort menu item, or status bar button.
                     * the status bar button text gives the appropriate
                     * action depending on our state - abort, outline
                     * or expand. But the command sent is always
                     * IDM_ABORT. Thus we need to check the state
                     * to see what to do. If we are busy, set the abort
                     * flag. If there is nothing to view,
                     * exit, otherwise switch outline<->expand
                     */
                    if (IsBusy()) {
                        bAbort = TRUE;
                        SetStatus(LoadRcString(IDS_ABORT_PENDING));
                    } else if (DisplayMode == MODE_NULL) {
                        DestroyWindow(hWnd);
                    } else if (DisplayMode == MODE_EXPAND) {
                        ToOutline(hWnd);
                    } else {
                        ToExpand(hWnd);
                    }
                    break;

                case IDM_FILE:
                    /* select two files and compare them */
                    if (SetBusy()) {

                        /* close the current view */
                        view_close(current_view);

                        /* make a new empty view */
                        current_view = view_new(hwndRCD);

                        /* make a COMPLIST using the files dialog,
                         * and notify the view
                         */
                        if (complist_filedialog(current_view) == NULL) {
                            view_close(current_view);
                        }

                        /* all done! */
                        SetNotBusy();
                    } else {
                        BusyError();
                    }
                    break;

                case IDM_DIR:

                    /* read two directory names, scan them and
                     * compare all the files and subdirs.
                     */
                    if (SetBusy()) {

                        /* close the current view */
                        view_close(current_view);

                        /* make a new empty view */
                        current_view = view_new(hwndRCD);

                        ghThread = CreateThread(NULL, 0, wd_dirdialog,
                                                (LPVOID) current_view, 0, &threadid);

                        if (ghThread == NULL)
                        {

                            /*
                             * either we are on WIN16, or the
                             * thread call failed. continue
                             * single-threaded.
                             */
                            wd_dirdialog( (LPVOID) current_view);

                        }

                    } else {
                        BusyError();
                    }
                    break;

                case IDM_CLOSE:
                    /* close the output list -
                     * discard all results so far
                     */
                    if (!IsBusy()) {
                        view_close(current_view);
                    }
                    break;

                case IDM_PRINT:
                    /* print the current view -
                     * either the outline list of filenames,
                     * or the currently expanded file.
                     */
                    if (!IsBusy()) {
                        DoPrint();
                    } else {
                        BusyError();
                    }
                    break;

                case IDM_TIME:
                    /* show time it took */
                    {       char msg[50];
                        DWORD tim;
                        if (IsBusy()) {
                            BusyError();
                        } else {
                            tim = complist_querytime();
                            hr = StringCchPrintf(msg, 50, LoadRcString(IDS_SECONDS), tim/1000, tim%1000);
              if (FAILED(hr))
                OutputError(hr, IDS_SAFE_PRINTF);
                            Trace_Status(msg);
                        }
                    }
                    break;

                case IDM_TRACE:
                    /* enable tracing */
                    bTrace = TRUE;
                    Trace_Status(LoadRcString(IDS_TRACING_ENABLED));
                    break;

                case IDM_TRACEOFF:
                    /* enable tracing */
                    bTrace = FALSE;
                    Trace_Status(LoadRcString(IDS_TRACING_DISABLED));
                    break;

                case IDM_SAVELIST:
                    /* allow user to save list of same/different files
                     * to a text file. dialog box to give filename
                     * and select which types of file to include
                     */
                    if (current_view == NULL) {
                        MessageBox(hWnd,
                                   LoadRcString(IDS_CREATE_DIFF_LIST),
                                   szSdkDiff, MB_OK|MB_ICONSTOP);
                        break;
                    }

                    complist_savelist(view_getcomplist(current_view), NULL, outline_include);
                    break;

                case IDM_COPYFILES:
                    /*
                     * copy files that are same/different to a new
                     * root directory. dialog box allows user
                     * to select new root and inclusion options
                     */
                    if (current_view == NULL) {
                        MessageBox(hWnd,
                                   LoadRcString(IDS_CREATE_DIFF_LIST),
                                   szSdkDiff, MB_OK|MB_ICONSTOP);
                        break;
                    }

                    if (SetBusy()) {
                        ghThread = CreateThread(NULL, 0, wd_copy,
                                                (LPVOID) current_view, 0, &threadid);
                        if (ghThread == NULL)
                        {
                            wd_copy( (LPVOID) current_view);
                        }

                    } else {
                        BusyError();
                    }

                    break;

                case IDM_ABOUT:
                    ShellAbout( hWnd,
                                (LPTSTR)szSdkDiff,
                                LoadRcString(IDS_TOOL_DESCRIPTION),
                                LoadIcon(hInst, szSdkDiff)
                              );
                    break;

                case IDM_CONTENTS:
                    /* Help contents */
          TCHAR pszHelp[MAX_PATH];
          memset(pszHelp, 0, MAX_PATH);
          hr = StringCchCopy(pszHelp, MAX_PATH, pszWorkingDirectoryName);
          if (FAILED(hr))
            OutputError(hr, IDS_SAFE_COPY);
          hr = StringCchCat(pszHelp, MAX_PATH, "sdkdiff.hlp");
          if (FAILED(hr))
            OutputError(hr, IDS_SAFE_CAT);
          WinHelp(hWnd, pszHelp, HELP_INDEX, 0);
                    break;

                    /* launch an editor on the current item - left, right or
                     * composite view
                     */
                case IDM_EDITLEFT:
                    do_editthread(current_view, CI_LEFT);
                    break;

                case IDM_EDITRIGHT:
                    do_editthread(current_view, CI_RIGHT);
                    break;

                case IDM_EDITCOMP:
                    {
                        COMPITEM item = view_getitem(current_view, selection);
                        FILEDATA fdLeft;
                        FILEDATA fdRight;

                        fdLeft = compitem_getleftfile(item);
                        fdRight = compitem_getrightfile(item);
                        if ((fdLeft && file_IsUnicode(fdLeft)) || (fdRight && file_IsUnicode(fdRight))) {
                            MessageBox(hWnd, LoadRcString(IDS_NOCOMPUNICODE),
                                       szSdkDiff, MB_OK);
                        } else {
                            do_editthread(current_view, CI_COMP);
                        }
                    }
                    break;

                    /* allow customisation of the editor command line */
                case IDM_SETEDIT:
                    if (StringInput(editor_cmdline, sizeof(editor_cmdline),
                                    LoadRcString(IDS_EDITOR_COMMAND),
                                    (LPSTR)szSdkDiff, editor_cmdline)) {
                        WriteProfileString(APPNAME, szEditor,
                                           editor_cmdline);
                    }
                    break;

                case IDM_SETTABWIDTH:
                    {
                        char sz[32];
                        int n;

LTabWidth_tryagain:
                        hr = StringCchPrintf(sz, 32, "%d", g_tabwidth);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        if (StringInput(sz, sizeof(sz),
                                        LoadRcString(IDS_TABWIDTH),
                                        (LPSTR)szSdkDiff, sz))
                        {
                            n = atoi(sz);
                            if (n <= 0 || n > 100)
                            {
                                MessageBox(hWnd,
                                           LoadRcString(IDS_BAD_TABWIDTH),
                                           szSdkDiff, MB_OK);
                                goto LTabWidth_tryagain;
                            }
                            WriteProfileInt(APPNAME, szTabWidth, n);
                            g_tabwidth = n;
                            SendMessage(hwndRCD, TM_SETTABWIDTH, 0, n);
                        }
                    }
                    break;

                case IDM_TABWIDTH4:
                case IDM_TABWIDTH8:
                    g_tabwidth = (GET_WM_COMMAND_ID(wParam, lParam) == IDM_TABWIDTH8) ? 8 : 4;
                    SendMessage(hwndRCD, TM_SETTABWIDTH, 0, g_tabwidth);
                    break;

                case IDM_SETFONT:
                    {
                        CHOOSEFONT cf;
                        LOGFONT lf;
                        char szFace[LF_FACESIZE];

                        hr = StringCchCopy(szFace, LF_FACESIZE, g_szFontFaceName);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_COPY);

                        memset(&lf, 0, sizeof(lf));
                        hr = StringCchCopy(lf.lfFaceName, LF_FACESIZE, szFace);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_COPY);
                        lf.lfWeight = g_fFontBold ? FW_BOLD : FW_DONTCARE;
                        lf.lfHeight = g_nFontHeight;
                        lf.lfCharSet = g_bFontCharSet;

                        memset(&cf, 0, sizeof(cf));
                        cf.lStructSize = sizeof(CHOOSEFONT);
                        cf.hwndOwner = hWnd;
                        cf.lpLogFont = &lf;
                        cf.Flags = CF_INITTOLOGFONTSTRUCT|CF_FORCEFONTEXIST|
                                CF_SCREENFONTS|CF_LIMITSIZE;
                        cf.nSizeMin = 8;
                        cf.nSizeMax = 36;
                        cf.lpszStyle = szFace;
                        if (ChooseFont(&cf))
                            {
                            hr = StringCchCopy(g_szFontFaceName, LF_FACESIZE, lf.lfFaceName);
              if (FAILED(hr))
                OutputError(hr, IDS_SAFE_COPY);
                            g_fFontBold = (lf.lfWeight == FW_BOLD);
                            g_nFontHeight = lf.lfHeight;
                            g_bFontCharSet = lf.lfCharSet;

                            WriteProfileString(APPNAME, szFontFaceName, g_szFontFaceName);
                            WriteProfileInt(APPNAME, szFontHeight, g_nFontHeight);
                            WriteProfileInt(APPNAME, szFontBold, g_fFontBold);
                            WriteProfileInt(APPNAME, szFontCharSet, g_bFontCharSet);

                            GetFontPref();

                            view_changeviewoptions(current_view);
                            }
                    }
                    break;

                case IDM_LNRS:
                case IDM_RNRS:
                case IDM_NONRS:

                    /* option selects whether the line nrs displayed
                     * in expand mode are the line nrs in the left
                     * file, the right file or none
                     */

                    CheckMenuItem(GetMenu(hWnd),
                                  line_numbers, MF_UNCHECKED);
                    line_numbers = GET_WM_COMMAND_ID(wParam, lParam);
                    CheckMenuItem(GetMenu(hWnd), line_numbers, MF_CHECKED);
                    hr = StringCchPrintf(str, 32, szD, line_numbers);
          if (FAILED(hr))
            OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szLineNumbers, str);

                    /* change the display to show the line nr style
                     * chosen
                     */

                    view_changeviewoptions(current_view);
                    break;

                /*
                 * options selecting which lines to include in the
                 * expand listing, based on their state
                 */
                case IDM_EXPAND_INCSAME:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_SAME;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCSAME,
                              (expand_include & INCLUDE_SAME) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCLEFT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_LEFTONLY;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCLEFT,
                              (expand_include & INCLUDE_LEFTONLY) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCRIGHT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_RIGHTONLY;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCRIGHT,
                              (expand_include & INCLUDE_RIGHTONLY) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCMOVEDLEFT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_MOVEDLEFT;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCMOVEDLEFT,
                              (expand_include & INCLUDE_MOVEDLEFT) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCMOVEDRIGHT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_MOVEDRIGHT;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCMOVEDRIGHT,
                              (expand_include & INCLUDE_MOVEDRIGHT) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCSIMILARLEFT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_SIMILARLEFT;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCSIMILARLEFT,
                              (expand_include & INCLUDE_SIMILARLEFT) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCSIMILARRIGHT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_SIMILARRIGHT;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCSIMILARRIGHT,
                              (expand_include & INCLUDE_SIMILARRIGHT) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                    /*
                     * options selecting which files to include in the
                     * outline listing, based on their state
                     */
                case IDM_OUTLINE_INCLEFT:

                    /* toggle flag in outline_include options */
                    outline_include ^= INCLUDE_LEFTONLY;

                    /* check/uncheck as necessary */
                    CheckMenuItem(hMenu, IDM_OUTLINE_INCLEFT,
                                  (outline_include & INCLUDE_LEFTONLY) ?
                                  MF_CHECKED:MF_UNCHECKED);

                    hr = StringCchPrintf(str, 32, szD, outline_include);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szFileInclude, str);
                    view_changeviewoptions(current_view);

                    break;

                case IDM_OUTLINE_INCRIGHT:

                    outline_include ^= INCLUDE_RIGHTONLY;

                    CheckMenuItem(hMenu, IDM_OUTLINE_INCRIGHT,
                                  (outline_include & INCLUDE_RIGHTONLY) ?
                                  MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, outline_include);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szFileInclude, str);
                    view_changeviewoptions(current_view);

                    break;

                case IDM_OUTLINE_INCSAME:

                    outline_include ^= INCLUDE_SAME;

                    CheckMenuItem(hMenu, IDM_OUTLINE_INCSAME,
                                  (outline_include & INCLUDE_SAME) ?
                                  MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, outline_include);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szFileInclude, str);
                    view_changeviewoptions(current_view);

                    break;

                case IDM_OUTLINE_INCDIFFER:

                    outline_include ^= INCLUDE_DIFFER;

                    CheckMenuItem(hMenu, IDM_OUTLINE_INCDIFFER,
                                  (outline_include & INCLUDE_DIFFER) ?
                                  MF_CHECKED:MF_UNCHECKED);

                    hr = StringCchPrintf(str, 32, szD, outline_include);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szFileInclude, str);
                    view_changeviewoptions(current_view);

                    break;

                case IDM_UPDATE:
                    OnUpdate( (COMPITEM) lParam);
                    break;

                case IDM_RESCAN:
                    RescanFile(hWnd);

                    /* do we need to force any repaints? */
                    // - no, as RescanFile sends a IDM_UPDATE
                    break;

                case IDM_LONLY:
                case IDM_RONLY:
                case IDM_BOTHFILES:
                    /* option selects whether the expanded file
                     * show is the combined file, or just one
                     * or other of the input files.
                     *
                     * if we are not in expand mode, this also
                     * causes us to expand the selection
                     */

                    CheckMenuItem(GetMenu(hWnd), expand_mode, MF_UNCHECKED);
                    expand_mode = GET_WM_COMMAND_ID(wParam, lParam);
                    CheckMenuItem(GetMenu(hWnd), expand_mode, MF_CHECKED);

                    /* change the current view to show only the lines
                     * of the selected type.
                     */
                    if (DisplayMode == MODE_OUTLINE) {
                        ToExpand(hWnd);
                    } else {
                        view_changeviewoptions(current_view);
                    }

                    break;

                case IDM_IGNBLANKS:

                    /* if selected, ignore all spaces and tabs on
                     * comparison - expand view only: outline view
                     * will still show that 'text files differ'
                     */

                    ignore_blanks = !ignore_blanks;
                    CheckMenuItem(hMenu, IDM_IGNBLANKS,
                                  ignore_blanks? MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, ignore_blanks);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szBlanks, str);

                    /* invalidate all diffs since we have
                     * changed diff options, and re-do and display the
                     * current diff if we are in expand mode.
                     */
                    view_changediffoptions(current_view);

                    /* force repaint of bar window */
                    InvalidateRect(hwndBar, NULL, TRUE);

                    break;

                case IDM_SHOWWHITESPACE:

                        /* if selected, display all spaces and tabs in
                           the expanded text view */
                        show_whitespace = !show_whitespace;
                        CheckMenuItem(hMenu, IDM_SHOWWHITESPACE,
                                show_whitespace ? MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, show_whitespace);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szShowWhitespace, str);

                        // change the current view to show only the lines
                        // of the selected type.
                        if (DisplayMode == MODE_EXPAND) {
                                view_changeviewoptions(current_view);
                        }

                        break;

                case IDM_ALG2:

                    /* if selected, do algorithm2 which does not accept
                     * unsafe matches.
                     */

                    Algorithm2 = !Algorithm2;
                    CheckMenuItem(hMenu, IDM_ALG2,
                                  Algorithm2? MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, Algorithm2);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szAlgorithm2, str);

                    /* invalidate all diffs since we have
                     * changed diff options, and re-do and display the
                     * current diff if we are in expand mode.
                     */
                    view_changediffoptions(current_view);

                    /* force repaint of bar window */
                    InvalidateRect(hwndBar, NULL, TRUE);

                    break;

                case IDM_MONOCOLS:

                    /* Use monochrome colours - toggle */

                    mono_colours = !mono_colours;
                    CheckMenuItem(hMenu, IDM_MONOCOLS,
                                  mono_colours? MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, mono_colours);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szMonoColours, str);
                    if (mono_colours)
                        SetMonoColours();
                    else
                        SetColours();

                    /* The diffs are still valid, but force a re-display
                     * of bar window and main table.
                     */
                    SendMessage(hwndBar, WM_COMMAND, IDM_MONOCOLS, 0);
                    InvalidateRect(hwndBar, NULL, TRUE);
                    view_changeviewoptions(current_view);

                    break;

                case IDM_PICTURE:
                    picture_mode = !picture_mode;
                    CheckMenuItem(hMenu, IDM_PICTURE,
                                  picture_mode? MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, picture_mode);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szPicture, str);
                    DoResize(hWnd);
                    break;

                case IDM_HIDEMARK:
                    // toggle state of marked files hidden or not
                    hide_markedfiles = !hide_markedfiles;
                    CheckMenuItem(hMenu, IDM_HIDEMARK,
                                  hide_markedfiles? MF_CHECKED : MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, hide_markedfiles);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szHideMark, str);

                    // rebuild view with new global option
                    // - note that marks only affect outline views
                    if (!view_isexpanded(current_view)) {
                        view_changeviewoptions(current_view);
                    }
                    break;

                case IDM_FIND:
                  {
                  int nRet = IDCANCEL;
                  DLGPROC lpProc = (DLGPROC) MakeProcInstance((WINPROCTYPE) FindDlgProc, hInst);
                  if (lpProc)
                    {
                    char *pszFind = NULL;
                    sdkdiff_UI(TRUE);
                    nRet = (BOOL) DialogBoxParam(hInst, (LPCTSTR) IDD_FIND, hwndClient, lpProc, 0L);
                    sdkdiff_UI(FALSE);
                    FreeProcInstance(lpProc);
                    }
                  }
                  break;

                case IDM_FINDNEXT:
                  {
                  const LONG iCol = (view_isexpanded(current_view)) ? 2 : 1;
                  FindString(hWnd, iCol, NULL, 1, 0);
                  break;
                  }

                case IDM_FINDPREV:
                  {
                  const LONG iCol = (view_isexpanded(current_view)) ? 2 : 1;
                  FindString(hWnd, iCol, NULL, -1, 0);
                  break;
                  }

                case IDM_GOTOLINE:
                  {
                  if (!view_getrowcount(current_view))
                    {
                    MessageBox(hWnd, LoadRcString(IDS_GOTOLINE_NOLINES), szSdkDiff, MB_OK|MB_ICONSTOP|MB_TASKMODAL);
                    }
                  else
                    {
                    DLGPROC lpProc = (DLGPROC) MakeProcInstance((WINPROCTYPE)GoToLineDlgProc, hInst);
                    if (lpProc)
                      {
                      sdkdiff_UI(TRUE);
                      DialogBoxParam(hInst, (LPCTSTR) IDD_GOTOLINE, hwndClient, lpProc, 0L);
                      sdkdiff_UI(FALSE);
                      FreeProcInstance(lpProc);
                      }
                    }
                  }
                  break;

                case IDM_EDITCOPY:
                    {
                        unsigned long cb = 0;
                        LPCSTR pszText = NULL;
                        long iRow = 0;
                        const BOOL fOutline = !view_isexpanded(current_view);

                        /* first count total data size */
                        for (iRow = 0; iRow < selection_nrows; iRow++) {
                            if (fOutline) {
                                pszText = view_gettext(current_view, selection + iRow, 1);
                                if (!pszText)
                                    break;
                                cb += (lstrlen(pszText) + 3) * sizeof(char);
                            }

                            pszText = view_gettext(current_view, selection + iRow, 2);
                            if (!pszText)
                                break;
                            cb += (lstrlen(pszText)) * sizeof(char);
                        }

                        if (cb && OpenClipboard(NULL)) {
                            /* space for trailing nul char */
                            cb++;

                            /* copy data to clipboard */
                            if (EmptyClipboard()) {
                                HGLOBAL hData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,  cb);

                                if (hData) {
                                    void *pv = hData;
                                    if (!pv) {
                                        HeapFree(GetProcessHeap(), NULL, hData);
                                    }
                                    else {
                                        LPSTR pszBuf = (LPSTR) pv;
                                        memset(pv, 0, cb);

                                        for (iRow = 0; iRow < selection_nrows; iRow++) {
                                            if (fOutline) {
                                                pszText = view_gettext(current_view, selection + iRow, 1);
                                                if (!pszText)
                                                    break;

                                                hr = StringCchCopy(pszBuf, cb, pszText);
                        if (FAILED(hr))
                          OutputError(hr, IDS_SAFE_COPY);
                                                pszBuf += lstrlen(pszBuf);
                                                *(pszBuf++) = '\t';
                                                *pszBuf = 0;
                                            }

                                            pszText = view_gettext(current_view, selection + iRow, 2);
                                            if (!pszText)
                                                break;

                                            hr = StringCchCopy(pszBuf, cb, pszText);
                      if (FAILED(hr))
                        OutputError(hr, IDS_SAFE_COPY);
                                            pszBuf += lstrlen(pszBuf);

                                            if (fOutline) {
                                                *(pszBuf++) = '\r';
                                                *(pszBuf++) = '\n';
                                                *pszBuf = 0;
                                            }
                                        }

                                        SetClipboardData(CF_TEXT, hData);
                                    }
                                }
                            }
                            CloseClipboard();
                        }
                    }
                    break;

                case IDM_MARK:
                    {
                        BOOL bChanged = FALSE;
                        int i;

                        // toggle the mark on the current selection
                        // note that the selection could be multiple rows
                        for (i = 0; i < selection_nrows; i++) {

                            if (view_setmarkstate(current_view, selection + i,
                                                  !view_getmarkstate(current_view, selection + i))) {

                                bChanged = TRUE;
                            }
                        }

                        if (bChanged) {
                            // yes the mark state was changed - need
                            // to rebuild the view.
                            if (!view_isexpanded(current_view)) {
                                view_changeviewoptions(current_view);
                            }
                        }
                        break;
                    }

                case IDM_TOGGLEMARK:
                    // toggle the state of all files: unmark all
                    // marked files and vice versa
                    complist_togglemark(view_getcomplist(current_view));

                    // rebuild view
                    if (!view_isexpanded(current_view)) {
                        view_changeviewoptions(current_view);
                    }
                    break;

                case IDM_MARKPATTERN:
                    // dialog to query the pattern, then set a mark on
                    // all compitems whose title matches that pattern
                    // returns TRUE if anything was changed
                    if (complist_markpattern(view_getcomplist(current_view))) {

                        // rebuild view
                        if (!view_isexpanded(current_view)) {
                            view_changeviewoptions(current_view);
                        }
                    }
                    break;

                case IDM_EXPAND:

                    /* show the expanded view of the
                     * selected file
                     */
                    if (current_view != NULL) {
                        ToExpand(hWnd);
                    }

                    break;

                case IDM_OUTLINE:
                    /* return to the outline view (list of filenames) */
                    ToOutline(hWnd);

                    break;

                case IDM_FCHANGE:
                    /* find the next line in the current view
                     * that is not the same in both files -
                     * in outline view, finds the next filename that
                     * is not identical
                     */
                    FindNextChange();
                    break;

                case IDM_FPCHANGE:
                    /* same as IDM_FCHANGE, but going backwards from
                     * current position
                     */
                    FindPrevChange();
                    break;

                case IDM_FCHANGE_LAURIE:
                    /* same as IDM_FCHANGE, but tries to keep cursor on same
                     * line.
                     */
                    _FindNextChange(TRUE, FALSE);
                    break;

                case IDM_FPCHANGE_LAURIE:
                    /* same as IDM_FPCHANGE, but tries to keep cursor on same
                     * line.
                     */
                    _FindPrevChange(TRUE, FALSE);
                    break;

                    // given a line that has been moved, jump to the
                    // other representation of the same line.
                    // this used to be available just through double-click
                    // but now is also available from a context menu
                case IDM_TOMOVED:
                    ToMoved(hWnd, TRUE);
                    break;
            }
            break;

        case WM_SIZE:
            DoResize(hWnd);
            break;

        case WM_SETFOCUS:
            /* set the focus on the table class so it can process
             * page-up /pagedown keys etc.
             */
            SetFocus(hwndRCD);
            break;

        case WM_KEYDOWN:
            /* although the table window has the focus, he passes
             * back to us any keys he doesn't understand
             * We handle escape here to mean 'return to outline view'
             */
            if (wParam == VK_ESCAPE) {
                ToOutline(hWnd);
            } else if (wParam == VK_APPS) {
                // Handle the context menu keyboard key
                POINT posCursor;
                GetCursorPos(&posCursor);
                ScreenToClient(hwndRCD, &posCursor);
                OnRightClick(hWnd, posCursor.x, posCursor.y);
            }
            break;

        case WM_RBUTTONDOWN:
            /*
             * the table window handles this by performing the
             * selection and then passing the message to us, allowing
             * us to put up a context menu.
             */
            OnRightClick(hWnd, LOWORD(lParam), HIWORD(lParam));
            break;

        case WM_CLOSE:
            SendMessage(hWnd, WM_COMMAND, IDM_EXIT, 0);
            return TRUE;

            /* don't allow close when busy - process this message in
             * order to ensure this
             */
            break;

        case WM_DESTROY:
      TCHAR pszHelp[MAX_PATH];
      memset(pszHelp, 0, MAX_PATH);
      hr = StringCchCopy(pszHelp, MAX_PATH, pszWorkingDirectoryName);
      if (FAILED(hr))
        OutputError(hr, IDS_SAFE_COPY);
      hr = StringCchCat(pszHelp, MAX_PATH, "sdkdiff.hlp");
      if (FAILED(hr))
        OutputError(hr, IDS_SAFE_COPY);
            DeleteTools();
            WinHelp(hWnd, pszHelp, HELP_QUIT, 0);
            PostQuitMessage(0);
            break;

        case TM_CURRENTVIEW:
            /* allow other people such as the bar window to query the
             * current view
             */
            return((INT_PTR) current_view);

#ifdef LATER
#ifdef WM_MOUSEWHEEL
        case WM_MOUSEWHEEL:
            if (LOWORD(wParam) & MK_MBUTTON) {
                if ((short)HIWORD(wParam) < 0) {
                    // The next occurence
                    _FindNextChange(FALSE, TRUE);
                }
                else {
                    _FindPrevChange(FALSE, TRUE);
                }
            }
            break;
#endif
#endif

        case WM_QUERYENDSESSION:
            if (IsBusy())
                return FALSE;
            return TRUE;

        case WM_ENDSESSION:
            SendMessage(hWnd, WM_CLOSE, 0, 0);
            break;

        default:
            /* handle registered table messages */
            if (message == table_msgcode) {
                ret = TableServer(hWnd, wParam, lParam);
                return(ret);
            }
            return(DefWindowProc(hWnd, message, wParam, lParam));
    }
    return(0);
}

CMTMLTFMT* pLoadMltFmtFile ( VOID )

Definition at line 5698 of file MfEdit.c.

{
    OPENFILENAME    ofn;
    char            szDirName[MAX_ARRAYSIZE];
    char            szFile[MAX_ARRAYSIZE], szFileTitle[MAX_ARRAYSIZE];
    static char     *szFilter;
    HANDLE          hFile, hMapFile;
    LPVOID          pMapFile;
    DWORD           dwFileSizeLow, dwFileSizeHigh;
    CMTMLTFMT       *pMfmt;

    pMfmt = (CMTMLTFMT*)NULL;

    BuildFilterStrs(-1);
    BuildFilterStrs(IDS_FT_EPS);
    szFilter = BuildFilterStrs(IDS_FT_EMF);

    GetSystemDirectory((LPSTR) szDirName, 256);
    strncpy( szFile, "*.eps\0", MAX_ARRAYSIZE - 1);
  szFile [MAX_ARRAYSIZE - 1] = '\0';
    ofn.lStructSize = sizeof(OPENFILENAME);
    ofn.hwndOwner = GetFocus();
    ofn.lpstrFilter = szFilter;
    ofn.lpstrCustomFilter = (LPSTR) NULL;
    ofn.nMaxCustFilter = 0L;
    ofn.nFilterIndex = 1;
    ofn.lpstrFile = szFile;
    ofn.nMaxFile = sizeof(szFile);
    ofn.lpstrFileTitle = szFileTitle;
    ofn.nMaxFileTitle = sizeof(szFileTitle);
    ofn.lpstrInitialDir = szDirName;
    ofn.lpstrTitle = (LPSTR) NULL;
    ofn.Flags = 0L;
    ofn.nFileOffset = 0;
    ofn.nFileExtension = 0;
    ofn.lpstrDefExt = "EPS";

    if (!GetOpenFileName(&ofn)) {
        goto EXIT;
    }

    if ((hFile = CreateFile(szFile, GENERIC_READ, FILE_SHARE_READ, NULL,
            OPEN_EXISTING, FILE_ATTRIBUTE_READONLY| SECURITY_SQOS_PRESENT | SECURITY_ANONYMOUS,
            NULL)) == INVALID_HANDLE_VALUE) {
        goto EXIT;
    }
    if ( GetFileType(hFile) != FILE_TYPE_DISK )
    {
        goto EXIT2;
    }

    dwFileSizeLow = GetFileSize(hFile, &dwFileSizeHigh);
    if ((dwFileSizeLow == 0xFFFFFFFF) && (GetLastError() != NO_ERROR)) {
        goto EXIT;
    }

    //
    // Create a map file of the opened file
    //
    if ((hMapFile = CreateFileMapping(hFile, NULL,
                             PAGE_READONLY, 0, 0, NULL)) == INVALID_HANDLE_VALUE) {
        goto EXIT2;
    }

    //
    // Map a view of the whole file
    //
    if ((pMapFile = MapViewOfFile(hMapFile, FILE_MAP_READ, 0, 0, 0)) == NULL) {
        goto EXIT3;
    }

//
// CR!! In future, change this to load different def of the picture...
//
  {
    ULONG       ulSize;
    PBYTE       pjTmp;
    RECTL       rectl;

    ulSize = dwFileSizeLow+sizeof(CMTMLTFMT);
    if ((pMfmt = (CMTMLTFMT *) LocalAlloc(LMEM_FIXED, ulSize)) == NULL) {
        MessageBox(GetFocus(), GetStringRes(IDS_MALLOCFAIL),
            GetStringRes(IDS_ERROR), MB_OK);
        goto EXIT3;
    }

    pMfmt->ident = GDICOMMENT_IDENTIFIER;
    pMfmt->iComment = GDICOMMENT_MULTIFORMATS;
    pMfmt->nFormats = 1;
    pMfmt->aemrformat[0].cbData = dwFileSizeLow;
    pMfmt->aemrformat[0].offData = 11*sizeof(DWORD);

    // parse for %!PS-Adobe-3.0 EPSF keyword
    //           Enhanced Metafile signature
    // set EMRFORMAT.dSignature appropiately

    if (((ENHMETAHEADER *) pMapFile)->dSignature == ENHMETA_SIGNATURE) {

        pMfmt->aemrformat[0].dSignature = ENHMETA_SIGNATURE;
        pMfmt->aemrformat[0].nVersion = 0;                    // not for emf
        pMfmt->rclOutput.left   = ((ENHMETAHEADER *) pMapFile)->rclBounds.left;
        pMfmt->rclOutput.top    = ((ENHMETAHEADER *) pMapFile)->rclBounds.top;
        pMfmt->rclOutput.right  = ((ENHMETAHEADER *) pMapFile)->rclBounds.right;
        pMfmt->rclOutput.bottom = ((ENHMETAHEADER *) pMapFile)->rclBounds.bottom;
    }
    else    //assume it is Adobe EPS
    if (bGetEPSBounds(pMapFile, &rectl)) {

        char text[128];

        pMfmt->aemrformat[0].dSignature = 0x46535045;
        pMfmt->aemrformat[0].nVersion = 1;
        pMfmt->rclOutput.left   = rectl.left;
        pMfmt->rclOutput.top    = rectl.top;
        pMfmt->rclOutput.right  = rectl.right;
        pMfmt->rclOutput.bottom = rectl.bottom;

        _sntprintf(text, 127, "Bounds = %d %d %d %d",
                 rectl.left, rectl.top, rectl.right, rectl.bottom);
    text [127] = '\0';
        MessageBox(GetFocus(), text, "Bounds", MB_OK);

    }
    else {
        // unknown file type
        Free(pMfmt);
        pMfmt = NULL;
        goto EXIT3;
    }

    pjTmp = (PBYTE)(((DWORD *)pMfmt->aemrformat)+4);
    while (dwFileSizeLow--) {
        *(((PBYTE)pjTmp)++) = *(((PBYTE)pMapFile)++);
    }

  }

EXIT3:
    CloseHandle(hMapFile);
EXIT2:
    CloseHandle(hFile);
EXIT:

    return pMfmt;
}

LONG_PTR APIENTRY TextWndProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 3221 of file MfEdit.c.

{
    static HFONT hFont = (HFONT) NULL;

    switch (message)
    {
    case WM_CREATE:
        {
        LOGFONT    lf;
        HDC        hDC;
        HFONT      hOldFont;
            TEXTMETRIC tm;
        //RECT       rect;

            SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(lf), (PVOID) &lf, (UINT)FALSE);

        hDC = GetDC(hwnd);
        // this is the height for 8 point size font in pixels
        lf.lfHeight = 8 * GetDeviceCaps(hDC, LOGPIXELSY) / 72;

        hFont = CreateFontIndirect(&lf);
        hOldFont = SelectObject(hDC, hFont);
        GetTextMetrics(hDC, &tm);

        // base the height of the window on size of text
        glcyStatus = tm.tmHeight+6*GetSystemMetrics(SM_CYBORDER)+2;
            ReleaseDC(hwnd, hDC);
            break;
        }

    case WM_DESTROY:
        if (hFont)
        DeleteObject(hFont);
        break;

    case WM_SETTEXT:
            DefWindowProc(hwnd, message, wParam, lParam);
            InvalidateRect(hwnd,NULL,FALSE);
            UpdateWindow(hwnd);
            return 0L;

    case WM_PAINT:
        {
            PAINTSTRUCT ps;
            RECT   rc;
            char   ach[128];
            int    len, nxBorder, nyBorder;
            HFONT  hOldFont = NULL;

            BeginPaint(hwnd, &ps);

            GetClientRect(hwnd,&rc);

            nxBorder = GetSystemMetrics(SM_CXBORDER);
        rc.left  += 9*nxBorder;
            rc.right -= 9*nxBorder;

            nyBorder = GetSystemMetrics(SM_CYBORDER);
        rc.top    += 3*nyBorder;
        rc.bottom -= 3*nyBorder;

        // 3D Text
            len = GetWindowText(hwnd, ach, sizeof(ach));
        SetBkColor(ps.hdc, GetSysColor(COLOR_BTNFACE));

        SetBkMode(ps.hdc, TRANSPARENT);
        SetTextColor(ps.hdc, RGB(64,96,96));
        if (hFont)
        hOldFont = SelectObject(ps.hdc, hFont);
        ExtTextOut(ps.hdc, rc.left+2*nxBorder+2, rc.top+2, ETO_OPAQUE | ETO_CLIPPED,
                    &rc, ach, len, NULL);

        SetTextColor(ps.hdc, RGB(128,128,128));
        if (hFont)
        hOldFont = SelectObject(ps.hdc, hFont);
        ExtTextOut(ps.hdc, rc.left+2*nxBorder+1, rc.top+1, ETO_CLIPPED,
            &rc, ach, len, NULL);

        SetTextColor(ps.hdc, RGB(255,255,255));
        if (hFont)
        hOldFont = SelectObject(ps.hdc, hFont);
        ExtTextOut(ps.hdc, rc.left+2*nxBorder, rc.top, ETO_CLIPPED,
            &rc, ach, len, NULL);

        SetBkMode(ps.hdc, OPAQUE);

        if (hOldFont)
        SelectObject(ps.hdc, hOldFont);

            EndPaint(hwnd, &ps);
            return 0L;
        }
    }
    return DefWindowProc(hwnd, message, wParam, lParam);
}

Variable Documentation

BOOL gb3D = FALSE

Definition at line 503 of file MfEdit.h.

BOOL gbDB = FALSE

Definition at line 507 of file MfEdit.h.

BOOL gbDebug = FALSE

Definition at line 505 of file MfEdit.h.

BOOL gbExport3X = FALSE

Definition at line 499 of file MfEdit.h.

BOOL gbFit2Wnd = TRUE

Definition at line 497 of file MfEdit.h.

BOOL gbHitTest = FALSE

Definition at line 458 of file MfEdit.h.

BOOL gbImport3X = FALSE

Definition at line 498 of file MfEdit.h.

BOOL gbPDOutln = FALSE

Definition at line 501 of file MfEdit.h.

BOOL gbRCSet = FALSE

Definition at line 504 of file MfEdit.h.

BOOL gbRecording = FALSE

Definition at line 457 of file MfEdit.h.

BOOL gbSFOutln = FALSE

Definition at line 500 of file MfEdit.h.

BOOL gbTT = FALSE

Definition at line 502 of file MfEdit.h.

BOOL gbUseDIB = FALSE

Definition at line 509 of file MfEdit.h.

BOOL gbUseMfPFD = TRUE

Definition at line 506 of file MfEdit.h.

COLORREF gCrText = 0

Definition at line 472 of file MfEdit.h.

DIBDATA gDib

Definition at line 526 of file MfEdit.h.

DWORD_PTR gdwCurCtrl = DID_STOP

Definition at line 467 of file MfEdit.h.

DWORD_PTR gdwCurTool = DID_PEN

Definition at line 468 of file MfEdit.h.

HBITMAP ghBmp = NULL

Definition at line 481 of file MfEdit.h.

PVOID ghBmpDn[OD_BTN_CNT]

Definition at line 487 of file MfEdit.h.

HBITMAP ghBmpMask = NULL

Definition at line 481 of file MfEdit.h.

PVOID ghBmpUp[OD_BTN_CNT]

Definition at line 487 of file MfEdit.h.

HBRUSH ghbrAppBkgd

Definition at line 493 of file MfEdit.h.

HBRUSH ghbrCur = (HBRUSH)NULL

Definition at line 491 of file MfEdit.h.

HBRUSH ghbrRed

Definition at line 490 of file MfEdit.h.

HFONT ghCurFont = (HFONT)NULL

Definition at line 470 of file MfEdit.h.

HDC ghDCMem

Definition at line 476 of file MfEdit.h.

HDC ghDCMetaf = (HDC) NULL

Definition at line 477 of file MfEdit.h.

HPALETTE ghHT = NULL

Definition at line 454 of file MfEdit.h.

HENHMETAFILE ghMetaf = NULL

Definition at line 478 of file MfEdit.h.

HMETAFILE ghmf = NULL

Definition at line 479 of file MfEdit.h.

HANDLE ghModule

Definition at line 446 of file MfEdit.h.

HPALETTE ghPal = NULL

Definition at line 453 of file MfEdit.h.

HPEN ghpnCur = (HPEN)NULL

Definition at line 492 of file MfEdit.h.

HPEN ghpnWide

Definition at line 494 of file MfEdit.h.

HWND ghTextWnd = NULL

Definition at line 452 of file MfEdit.h.

PVOID ghToolBmpDn[OD_TOOL_CNT]

Definition at line 488 of file MfEdit.h.

PVOID ghToolBmpUp[OD_TOOL_CNT]

Definition at line 488 of file MfEdit.h.

HWND ghwndClient = NULL

Definition at line 448 of file MfEdit.h.

HWND ghwndCtrlPanel = NULL

Definition at line 450 of file MfEdit.h.

HWND ghwndDrawSurf = NULL

Definition at line 449 of file MfEdit.h.

HWND ghwndMain = NULL

Definition at line 447 of file MfEdit.h.

HWND ghwndNext = NULL

Definition at line 496 of file MfEdit.h.

HWND ghwndTools = NULL

Definition at line 451 of file MfEdit.h.

LONG glcyStatus

Definition at line 456 of file MfEdit.h.

LOGFONT glf

Definition at line 471 of file MfEdit.h.

PROC gpfnGetEnhMetaFilePixelFormat = (PROC)NULL

Definition at line 444 of file MfEdit.h.

PVOID grHwndCtrlBtn[OD_BTN_CNT]

Definition at line 464 of file MfEdit.h.

PVOID grHwndToolBtn[OD_TOOL_CNT]

Definition at line 465 of file MfEdit.h.

HMENU hChildMenu

Definition at line 475 of file MfEdit.h.

HMENU hChildMenuWindow

Definition at line 475 of file MfEdit.h.

HMENU hMenu

Definition at line 474 of file MfEdit.h.

HMENU hMenuWindow

Definition at line 474 of file MfEdit.h.

METALOOKUP rgMetaName[]

Definition at line 328 of file MfEdit.h.

Generated on Wed Nov 13 2024 16:53:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/Metafile/MfEdit/Precomp.h File Reference

  • Multimedia
  • Gdi
  • Metafile
  • MfEdit
Defines

Precomp.h File Reference

#include <stdlib.h>
#include <windows.h>
#include <string.h>
#include <stdarg.h>
#include <tchar.h>
#include <stdio.h>
#include <commdlg.h>
#include <shellapi.h>
#include <math.h>
#include <gl\glaux.h>
#include <gl\gl.h>
#include <gl\glu.h>
#include "mfedit.h"

Go to the source code of this file.

Defines

#define My_mbstok strtok

Define Documentation

#define My_mbstok strtok

Definition at line 24 of file Precomp.h.

Generated on Wed Nov 13 2024 16:53:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/palette/Mypal.c File Reference

  • Multimedia
  • Gdi
  • palette
Functions | Variables

Mypal.c File Reference

#include <windows.h>
#include <tchar.h>
#include <stdio.h>
#include "mypal.h"

Go to the source code of this file.

Functions

BOOL InPaletteBasedVideoMode ()
VOID | ShowColor (HWND hWnd, HDC hDC)
int APIENTRY | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
LONG APIENTRY | WndProc (HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam)

Variables

BOOL bCaptureOn
DWORD dwIndex
DWORD dwNumColors
DWORD | dwPal [PALETTESIZE]
HDC | hDCGlobal
HANDLE hPal
INT | iGlobalXOffset
INT | iGlobalYOffset
INT | iRasterCaps
INT | iYMiddle
INT | nXBorder
INT | nXTitle
INT | nYTitle
RECT | rClientRect
CHAR | szTitlebuf [90]

Function Documentation

BOOL InPaletteBasedVideoMode ( )

Definition at line 56 of file Mypal.c.

{
    HDC hdc = GetDC(NULL);
    BOOL bRet;
    int iRasCaps;

    iRasCaps = GetDeviceCaps(hdc, RASTERCAPS);
    bRet = (iRasCaps & RC_PALETTE) ? TRUE : FALSE;

    ReleaseDC(NULL, hdc);

    return bRet;
}

VOID ShowColor | ( | HWND | hWnd,
 |  | HDC | hDC
 | ) |  |

Definition at line 78 of file Mypal.c.

{
     HBRUSH  hBrush, hOldBrush;

     hBrush    = CreateSolidBrush ( PALETTEINDEX(dwIndex) );
   if (!hBrush)
     return;
   hOldBrush = SelectObject (hDC,hBrush) ;

     GetWindowRect (hWnd, (LPRECT)&rClientRect);

     PatBlt ( hDC,
              rClientRect.left + nXTitle + nXBorder + 1,
              rClientRect.top + nXBorder,
              nXTitle,
              nYTitle,
              PATCOPY);

     PatBlt(hDC,
            rClientRect.right - ( 3 * nXTitle + nXBorder + 2),
            rClientRect.top + nXBorder,
            nXTitle,
            nYTitle,
            PATCOPY);
     SelectObject (hDC, hOldBrush);
     DeleteObject (hBrush) ;
}

int APIENTRY WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 115 of file Mypal.c.

{
     static CHAR szAppName [] = "MyPal";
     HWND        hWnd;
     WNDCLASS    wndclass;
     MSG         msg ;
     INT         xScreen;
     INT         yScreen;
     UNREFERENCED_PARAMETER( lpCmdLine );

     if (!hPrevInstance){
         wndclass.style         = CS_HREDRAW | CS_VREDRAW;
         wndclass.lpfnWndProc   = (WNDPROC) WndProc;
         wndclass.cbClsExtra    = 0;
         wndclass.cbWndExtra    = 0;
         wndclass.hInstance     = hInstance;
         wndclass.hIcon         = LoadIcon(hInstance, szAppName);
         wndclass.hCursor       = LoadCursor (NULL, IDC_ARROW);
         wndclass.hbrBackground = GetStockObject (BLACK_BRUSH);
         wndclass.lpszMenuName  = szAppName;
         wndclass.lpszClassName = szAppName;

         if (!RegisterClass (&wndclass))
             return FALSE ;
     }

     /* Do some global initializations */
     xScreen     = GetSystemMetrics (SM_CXSCREEN);
     yScreen     = GetSystemMetrics (SM_CYSCREEN);
     nXBorder    = (INT)GetSystemMetrics (SM_CXFRAME);
     nXTitle     = (INT)GetSystemMetrics (SM_CXSIZE);
     nYTitle     = (INT)GetSystemMetrics (SM_CYSIZE);
     dwIndex      = 0;
     bCaptureOn  = FALSE;

     hDCGlobal   = GetDC (NULL);
     iRasterCaps = GetDeviceCaps(hDCGlobal, RASTERCAPS);
     iRasterCaps = (iRasterCaps & RC_PALETTE) ? TRUE : FALSE;

     if (iRasterCaps)
         dwNumColors = GetDeviceCaps(hDCGlobal, SIZEPALETTE);
     else
         dwNumColors = GetDeviceCaps( hDCGlobal, NUMCOLORS);
     ReleaseDC (NULL,hDCGlobal);

     nSizeX = ((xScreen - 2*nXBorder) / PALETTESIZE) * PALETTESIZE;

     /* create the app. window */
     hWnd = CreateWindow (szAppName,
                          "My Physical Palette ",
                          WS_OVERLAPPEDWINDOW,
                          (xScreen-nSizeX) / 2 - nXBorder,
                          4 * GetSystemMetrics (SM_CYCAPTION),
                          nSizeX + 2 * nXBorder,
                          4 * GetSystemMetrics (SM_CYCAPTION),
                          NULL,
                          NULL,
                          hInstance,
                          NULL);
     ShowWindow (hWnd, nCmdShow);
     UpdateWindow (hWnd);

     while (GetMessage (&msg, NULL, 0, 0)){
           TranslateMessage (&msg) ;
           DispatchMessage (&msg) ;
     }

     return (int)msg.wParam ;
}

LONG APIENTRY WndProc | ( | HWND | hWnd,
 |  | UINT | iMessage,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 228 of file Mypal.c.

 {
     HDC           hDC;
     PAINTSTRUCT   ps;
     DWORD         dwLoop;
     INT           nStart;
     HBRUSH        hBrush;
     HBRUSH        hOldBrush;

     MPOINT        pt;
     static INT    nIncr;
     static DWORD  dwColor;
     static DWORD  dwLastColor;
     static DWORD  i, x;

   switch (iMessage) {
     case WM_DISPLAYCHANGE:
         // The video mode changed, update the number of colors
         dwNumColors = 1 << wParam;

         if (!InPaletteBasedVideoMode()) {  // Should we attempt to display a non palette mode
             MessageBox(hWnd, "<WM_DISPLAYCHANGE> The current video mode is not palette based.\nSwitch to a palette based video mode for this sample to work properly", NULL, MB_OK | MB_ICONHAND);
         }
         break;

     case WM_DESTROY:
         // delete the handle to the logical palette
         if (hPal)
             DeleteObject (hPal);
         PostQuitMessage (0) ;
         break ;

     case WM_CREATE:
         {
             NPLOGPALETTE    pLogPal;       /* Pointer to program's logical palette        */

             if (!InPaletteBasedVideoMode()) {  // Should we attempt to display a non palette mode
                 MessageBox(hWnd, "<WM_CREATE> The current video mode is not palette based.\nSwitch to a palette based video mode for this sample to work properly", NULL, MB_OK | MB_ICONHAND);
             }

             // Allocate enough memory for a logical palette with
             // PALETTESIZE entries and set the size and version fields
             // of the logical palette structure.
             pLogPal = (NPLOGPALETTE) LocalAlloc (LMEM_FIXED,
                 (sizeof (LOGPALETTE) +
                 (sizeof (PALETTEENTRY) * (PALETTESIZE))));

             if(!pLogPal){
                 MessageBox(hWnd, "<WM_CREATE> Not enough memory for palette.", NULL, MB_OK | MB_ICONHAND);
                 PostQuitMessage (0) ;
                 break;
             }

             pLogPal->palVersion    = 0x300;
             pLogPal->palNumEntries = PALETTESIZE;

             // fill in intensities for all palette entry colors
             for (dwLoop = 0; dwLoop < PALETTESIZE; dwLoop++) {
                 *((WORD *) (&pLogPal->palPalEntry[dwLoop].peRed)) = (WORD)dwLoop;
                 pLogPal->palPalEntry[dwLoop].peBlue  = 0;
                 pLogPal->palPalEntry[dwLoop].peFlags = PC_EXPLICIT;
             }

             //  create a logical color palette according the information
             //  in the LOGPALETTE structure.
             hPal = CreatePalette ((LPLOGPALETTE) pLogPal) ;

             LocalFree(pLogPal);
         }
         break;

     case WM_GETMINMAXINFO:

         ((LPRGPT)lParam)->iInfo[6] = nXBorder * 2 + PALETTESIZE;
         ((LPRGPT)lParam)->iInfo[7] = nXBorder * 2 + nYTitle*3;

         return (long) DefWindowProc (hWnd, iMessage, wParam, lParam) ;
         break;

     case WM_PAINT:
         GetClientRect(hWnd,(LPRECT) &rClientRect);

         if (!InPaletteBasedVideoMode()) {  // Should we attempt to display a palette
             hDC = BeginPaint(hWnd, &ps);

             PatBlt(hDC,0,0,rClientRect.right, rClientRect.bottom, BLACKNESS);
             SetWindowText (hWnd, (LPSTR)"The current video mode is not palette based.");

             EndPaint(hWnd,&ps);

             return 0;
         }

         // Divide client width into equal-sized parts, one per palette
         // entry, and re-calculate client width so that it will display
         // exactly as many vertical bars as there are palette entries.
         nSizeX = (rClientRect.right - rClientRect.left);
         nSizeX = (nSizeX/dwNumColors) * dwNumColors;

         nSizeY = rClientRect.bottom - rClientRect.top;
         GetWindowRect(hWnd,(LPRECT) &rClientRect);

         // Adjust window width so that it can display exactly
         // as many vertical bars( of equal width) as there are palette
         // colors.

         SetWindowPos( hWnd,
             (HWND)NULL,
             0,
             0,
             nSizeX + 2*nXBorder,
             rClientRect.bottom - rClientRect.top,
             SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);

         hDC = BeginPaint(hWnd, &ps);

         // Select the palette into the window device context and
         // make the Palette Manager map the logical palette to the
         // system palette (realize it).
         SelectPalette (hDC, hPal, 1);
         RealizePalette (hDC);

         // Calculate width of each color bar to be displayed
         nIncr = nSizeX / dwNumColors;

         // Paint the individual bars separately on the app. window
         for (nStart = dwLoop = 0; dwLoop < dwNumColors; dwLoop++) {

             // Since this app. uses a logical palette, use the
             // PALETTEINDEX macro to specify the palette entry
             // index instead of using an explicit RGB value.

             hBrush       = CreateSolidBrush (PALETTEINDEX (dwLoop));
       if (!hBrush)
         break;
             dwPal[dwLoop] = GetNearestColor (hDC, PALETTEINDEX (dwLoop) );
             hOldBrush    = SelectObject (hDC,hBrush) ;
             PatBlt (hDC, nStart, 0, nIncr, nSizeY, PATCOPY);
             nStart       += nIncr;
             SelectObject (hDC, hOldBrush);
             DeleteObject (hBrush) ;
         }
         _sntprintf (szTitlebuf, 89,"    MyPal Colors = %d", dwNumColors);
     szTitlebuf [89] = '\0';
         SetWindowText (hWnd, (LPSTR)szTitlebuf);

         EndPaint(hWnd,&ps);

         break ;

     case WM_MOUSEMOVE:
         // Are we in a palette based mode?
         if (!InPaletteBasedVideoMode())
             break;  // No, bail.

         if (wParam & MK_RBUTTON) {

             POINT pnt;

#ifdef WIN16
             /* Convert mouse position to screen coordinates */
             pnt.x = LOWORD(lParam);
             pnt.y = HIWORD(lParam);
#else
             LONG2POINT(lParam, pnt);
#endif
             ClientToScreen(hWnd, &pnt);

             /* Get RGB value (color) of pixel under mouse coordinate */
             dwColor = GetPixel(hDCGlobal, pnt.x, pnt.y);

             /* If color value already exists in palette lookup table,
             * obtain it's index.
             */
             for (i=0 ; i < dwNumColors ; i++)
                 if ( dwColor == dwPal[i] )
                     break;
                 dwIndex = i;

                 /* If previous color value was not identical to current one,
                 * display color boxes on either side of title bar,
                 * the R, G, B values and palette index of current color.
                 */
                 if (dwColor != dwLastColor) {
           _sntprintf ( szTitlebuf, 89,
                         "    MyPal Colors = %d  Index=%d  R=%3u G=%3u B=%3u",
                         dwNumColors,
                         dwIndex,
                         (WORD)(BYTE) GetRValue (dwColor),
                         (WORD)(BYTE) GetGValue (dwColor),
                         (WORD)(BYTE) GetBValue (dwColor));
           szTitlebuf [89] = '\0';
                     SetWindowText (hWnd, (LPSTR)szTitlebuf);
                     ShowColor (hWnd, hDCGlobal);
                     dwLastColor = dwColor;
                 }
         }
         break;

     case WM_RBUTTONDOWN:
         // Are we in a palette based mode?
         if (!InPaletteBasedVideoMode())
             break;  // No, bail.

         // Determine number of color bar under mouse, thus the index
         // of color in palette.
         x = LOWORD(lParam);
         dwIndex = (x / nIncr );

         _sntprintf ( szTitlebuf, 89,
             "    MyPal Colors = %d  Index=%d  PalSize=%d RasterCaps:%d",
             dwNumColors,
             dwIndex,
             dwNumColors,
             iRasterCaps );
         szTitlebuf [89] = '\0';
         SetWindowText (hWnd, (LPSTR)szTitlebuf);

         // Set mouse capture so that subsequent WM_MOUSEMOVEs
         // (with right mouse button depressed) will allow MyPal
         // to display RGB info anywhere on the screen without losing
         // the focus.
         SetCapture (hWnd);
         bCaptureOn = TRUE;
         hDCGlobal = GetDC(NULL);
         if (hPal) {
             SelectPalette (hDCGlobal, hPal, FALSE);
             RealizePalette (hDCGlobal);
         }
         break;

     case WM_RBUTTONUP:
         // Stops displaying RGB and palette info and releases mouse
         // capture
         ReleaseDC (NULL, hDCGlobal);
         bCaptureOn = FALSE;
         ReleaseCapture ();
         break;

     case WM_MOVE:
         // If you have a wide column, this adds 1/2 so X is centered
         iGlobalXOffset  = LOWORD (lParam);
         iGlobalYOffset  = HIWORD (lParam) + nXBorder;
         break;

     case WM_SIZE:
         iYMiddle = (HIWORD (lParam)/2);
         break;

     case WM_LBUTTONDOWN:
     case WM_KEYDOWN:
         // Are we in a palette based mode?
         if (!InPaletteBasedVideoMode())
             break;  // No, bail.

         if (iMessage == WM_LBUTTONDOWN){
             // determine which column was hit by the mouse
             x = LOWORD(lParam);
             dwIndex = (x / nIncr );
         }
         else{
             // Use arrow keys to step thro' the palette entries
             switch (wParam) {
             case VK_RIGHT:
             case VK_UP:
                 // go to next (higher) palette entry
                 dwIndex++;
                 break;
             case VK_LEFT:
             case VK_DOWN:
                 // go to previous (lower) palette entry
                 dwIndex--;
                 break;
             case VK_NEXT:
                 dwIndex += 10;
                 break;
             case VK_PRIOR:
                 dwIndex -= 10;
                 break;
             case VK_HOME:
                 // go to first palette entry
                 dwIndex = 0;
                 break;
             case VK_END:
                 // go to last palette entry
                 dwIndex = dwNumColors-1;
                 break;
             default:
                 return 0L;
                 break;
             }
             // Make sure the palette index is within range else
             // set it to the limiting values and give a warning beep.
             if (dwIndex > dwNumColors-1) {
                 dwIndex = dwNumColors-1;
                 MessageBeep(1);
             }

             pt.x = (SHORT)((dwIndex * nIncr) +
                 iGlobalXOffset   +
                 ((nIncr > 1) ? (nIncr / 2) : 1));
             pt.y = (SHORT)(iYMiddle + iGlobalYOffset);

             SetCursorPos (pt.x, pt.y);
         }

         if (TRUE == bCaptureOn) {
             MessageBeep(1);
             break;
         }

         // Select & realize the palette or the colors > 0x7
         // will not match up.
         hDC = GetDC(NULL);
     if (hPal)
         {
       SelectPalette  (hDC, hPal, 1);
       RealizePalette (hDC) ;
             dwColor = GetNearestColor (hDC, PALETTEINDEX (dwIndex));
             _sntprintf ( szTitlebuf, 89,
         "    MyPal Colors = %d  Index=%d  R=%3u G=%3u B=%3u",
         dwNumColors,
                 dwIndex,
                 (WORD)(BYTE)GetRValue (dwColor),
                 (WORD)(BYTE)GetGValue (dwColor),
                 (WORD)(BYTE)GetBValue (dwColor)
         );
             szTitlebuf [89] = '\0';

                 SetWindowText (hWnd, (LPSTR)szTitlebuf);
                 ShowColor (hWnd,hDC);
     }
         ReleaseDC(NULL, hDC);
         break;

     default:
         return (long) DefWindowProc (hWnd, iMessage, wParam, lParam) ;

    }
    return 0L ;
}

Variable Documentation

BOOL bCaptureOn

Definition at line 42 of file Mypal.c.

DWORD dwIndex

Definition at line 43 of file Mypal.c.

DWORD dwNumColors

Definition at line 46 of file Mypal.c.

DWORD dwPal[PALETTESIZE]

Definition at line 49 of file Mypal.c.

HDC hDCGlobal

Definition at line 45 of file Mypal.c.

HANDLE hPal

Definition at line 36 of file Mypal.c.

INT iGlobalXOffset

Definition at line 50 of file Mypal.c.

INT iGlobalYOffset

Definition at line 51 of file Mypal.c.

INT iRasterCaps

Definition at line 47 of file Mypal.c.

INT iYMiddle

Definition at line 52 of file Mypal.c.

INT nXBorder

Definition at line 39 of file Mypal.c.

INT nXTitle

Definition at line 40 of file Mypal.c.

INT nYTitle

Definition at line 41 of file Mypal.c.

RECT rClientRect

Definition at line 48 of file Mypal.c.

CHAR szTitlebuf[90]

Definition at line 44 of file Mypal.c.

Generated on Wed Nov 13 2024 16:53:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/palette/Mypal.h File Reference

  • Multimedia
  • Gdi
  • palette
Classes | Defines | Typedefs | Functions

Mypal.h File Reference

Go to the source code of this file.

Classes

struct | tagRGPT

Defines

#define | LONG2POINT(l, pt) ((pt).x = (INT)LOWORD(l), (pt).y = (INT)HIWORD(l))
#define | PALETTESIZE 256

Typedefs

typedef RGPT FAR * | LPRGPT
typedef POINT | MPOINT
typedef struct tagRGPT | RGPT

Functions

VOID | ShowColor (HWND, HDC)

Define Documentation

#define LONG2POINT | ( | l,
 |  | pt |
 | ) |  | ((pt).x = (INT)LOWORD(l), (pt).y = (INT)HIWORD(l))

Definition at line 19 of file Mypal.h.

#define PALETTESIZE 256

Definition at line 23 of file Mypal.h.

Typedef Documentation

typedef RGPT FAR* LPRGPT

Definition at line 28 of file Mypal.h.

typedef POINT MPOINT

Definition at line 18 of file Mypal.h.

typedef struct tagRGPT RGPT

Function Documentation

VOID ShowColor | ( | HWND | ,
 |  | HDC |
 | ) |  |

Definition at line 78 of file Mypal.c.

{
     HBRUSH  hBrush, hOldBrush;

     hBrush    = CreateSolidBrush ( PALETTEINDEX(dwIndex) );
   if (!hBrush)
     return;
   hOldBrush = SelectObject (hDC,hBrush) ;

     GetWindowRect (hWnd, (LPRECT)&rClientRect);

     PatBlt ( hDC,
              rClientRect.left + nXTitle + nXBorder + 1,
              rClientRect.top + nXBorder,
              nXTitle,
              nYTitle,
              PATCOPY);

     PatBlt(hDC,
            rClientRect.right - ( 3 * nXTitle + nXBorder + 2),
            rClientRect.top + nXBorder,
            nXTitle,
            nYTitle,
            PATCOPY);
     SelectObject (hDC, hOldBrush);
     DeleteObject (hBrush) ;
}

Generated on Wed Nov 13 2024 16:53:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/Printer/Common.h File Reference

  • Multimedia
  • Gdi
  • Printer
Defines | Functions

Common.h File Reference

Go to the source code of this file.

Defines

#define | ALLGRAPHICS 0x00000fff
#define | ARC 0x00000001
#define | BUFSIZE 256
#define | DRAWAXIS 0x80000000
#define | ELLIPSE 0x00000002
#define | ENUMFONTS 0x40000000
#define | ErrMsgBox(txt, title)
#define | LINETO 0x00000004
#define | MAIN_CLASS_NAME "PRINTER"
#define | MAIN_CLASS_STYLE CS_HREDRAW | CS_VREDRAW
#define | MAIN_MENU_NAME "MENU"
#define | MAIN_WND_STYLE WS_OVERLAPPEDWINDOW
#define | MAIN_WND_TITLE IDS_MAINWNDTITLE
#define | MAX_GRAPHICS 12
#define | PIE 0x00000008
#define | PLG_BLT 0x00000010
#define | POLYBEZIER 0x00000020
#define | POLYGON 0x00000040
#define | POLYLINE 0x00000080
#define | POLYPOLYGON 0x00000100
#define | RECTANGLE 0x00000200
#define | ROUNDRECT 0x00000400
#define | STRETCH_BLT 0x00000800

Functions

LRESULT CALLBACK | DevCapsXDlgProc (HWND, UINT, WPARAM, LPARAM)
LRESULT CALLBACK | EnumPrinterDriversDlgProc (HWND, UINT, WPARAM, LPARAM)
LRESULT CALLBACK | EnumPrintersDlgProc (HWND, UINT, WPARAM, LPARAM)
LRESULT CALLBACK | GetDeviceCapsDlgProc (HWND, UINT, WPARAM, LPARAM)
LRESULT CALLBACK | GetPrinterDriverDlgProc (HWND, UINT, WPARAM, LPARAM)
LPTSTR | GetStringRes (int id)
LPTSTR | GetStringRes2 (int id)
BOOL | Paint (HDC, LPRECT)

Define Documentation

#define ALLGRAPHICS 0x00000fff

Definition at line 36 of file Common.h.

#define ARC 0x00000001

Definition at line 23 of file Common.h.

#define BUFSIZE 256

Definition at line 43 of file Common.h.

#define DRAWAXIS 0x80000000

Definition at line 39 of file Common.h.

#define ELLIPSE 0x00000002

Definition at line 24 of file Common.h.

#define ENUMFONTS 0x40000000

Definition at line 38 of file Common.h.

#define ErrMsgBox | ( | txt,
 |  | title
 | ) |
Value:
MessageBox (ghwndMain, (LPCTSTR) txt,   \
                                         (LPCTSTR) title,            \
                                         MB_OK | MB_ICONEXCLAMATION);

Definition at line 58 of file Common.h.

#define LINETO 0x00000004

Definition at line 25 of file Common.h.

#define MAIN_CLASS_NAME "PRINTER"

Definition at line 47 of file Common.h.

#define MAIN_CLASS_STYLE CS_HREDRAW | CS_VREDRAW

Definition at line 49 of file Common.h.

#define MAIN_MENU_NAME "MENU"

Definition at line 46 of file Common.h.

#define MAIN_WND_STYLE WS_OVERLAPPEDWINDOW

Definition at line 50 of file Common.h.

#define MAIN_WND_TITLE IDS_MAINWNDTITLE

Definition at line 48 of file Common.h.

#define MAX_GRAPHICS 12

Definition at line 41 of file Common.h.

#define PIE 0x00000008

Definition at line 26 of file Common.h.

#define PLG_BLT 0x00000010

Definition at line 27 of file Common.h.

#define POLYBEZIER 0x00000020

Definition at line 28 of file Common.h.

#define POLYGON 0x00000040

Definition at line 29 of file Common.h.

#define POLYLINE 0x00000080

Definition at line 30 of file Common.h.

#define POLYPOLYGON 0x00000100

Definition at line 31 of file Common.h.

#define RECTANGLE 0x00000200

Definition at line 32 of file Common.h.

#define ROUNDRECT 0x00000400

Definition at line 33 of file Common.h.

#define STRETCH_BLT 0x00000800

Definition at line 34 of file Common.h.

Function Documentation

LRESULT CALLBACK DevCapsXDlgProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |
LRESULT CALLBACK EnumPrinterDriversDlgProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 593 of file Enumprt.c.

{
  switch (msg)
  {
    case WM_INITDIALOG:
    {
      BOOL bReturn;

      SetCursor (LoadCursor (NULL, IDC_WAIT));
      bReturn = DisplayPrinterDriversInfo (hwnd);
      SetCursor (LoadCursor (NULL, IDC_ARROW));

      if (!bReturn)

        EndDialog (hwnd, TRUE);

      else

        SetWindowText (hwnd, (LPCTSTR) "EnumPrinterDrivers");

      break;
    }

    case WM_COMMAND:

      switch (LOWORD (wParam))
      {
        case DID_OK:

          EndDialog (hwnd, TRUE);

          return 1;
      }
      break;
  }
  return 0;
}

LRESULT CALLBACK EnumPrintersDlgProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 49 of file Enumprt.c.

{
  switch (msg)
  {
    case WM_INITDIALOG:
    {
      BOOL bReturn;

      //
      // prompt user for EnumPrinters flags...
      //

      if (DialogBox (GetModuleHandle (NULL), (LPCTSTR) "EnumPrtOpt",
                     NULL, (DLGPROC) EnumPrintersOptionsDlgProc))
      {
        //
        // shove all the enum printer info in the list box
        //

        SetCursor (LoadCursor (NULL, IDC_WAIT));
        bReturn = DisplayEnumPrintersInfo (hwnd);
        SetCursor (LoadCursor (NULL, IDC_ARROW));

        if (!bReturn)

          EndDialog (hwnd, TRUE);

        else

          SetWindowText (hwnd, (LPCTSTR)"EnumPrinters");
      }
      else

          EndDialog (hwnd, TRUE);

      break;
    }

    case WM_COMMAND:

      switch (LOWORD (wParam))
      {
        case DID_OK:

          EndDialog (hwnd, TRUE);
          break;
      }
      break;
  }
  return 0;
}

LRESULT CALLBACK GetDeviceCapsDlgProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 46 of file Getcaps.c.

{
  switch (msg)
  {
    case WM_INITDIALOG:
    {
      BOOL bReturn;
      char buf[BUFSIZE];

      SendDlgItemMessage (hwnd, DID_LISTBOX, WM_SETFONT, (WPARAM)GetStockObject(ANSI_FIXED_FONT), (LPARAM)0);

    ghwndDevCaps = hwnd;

      //
      // shove all the caps info in the list box
      //

      SetCursor (LoadCursor (NULL, IDC_WAIT));
      bReturn = DisplayDeviceCapsInfo ();
      SetCursor (LoadCursor (NULL, IDC_ARROW));

      if (!bReturn)
      {
        EndDialog (hwnd, TRUE);
      }

      //
      // set window title to reflect current device
      //

      else
      {
        if ( _snprintf (buf, BUFSIZE-1, "GetDeviceCaps: %s;%s;%s", gszDeviceName, gszPort, gszDriverName) > 0 )
          SetWindowText (hwnd, (LPCSTR) buf);
      }

      break;
    }

    case WM_COMMAND:

      switch (LOWORD (wParam))
      {
        case DID_OK:

          EndDialog (hwnd, TRUE);
          return 1;
      }
      break;
  }
  return 0;
}

LRESULT CALLBACK GetPrinterDriverDlgProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 45 of file Getpdriv.c.

{
  switch (msg)
  {
    case WM_INITDIALOG:
    {
      BOOL bReturn;
      char buf[BUFSIZE];

    //
      // shove all the printer driver info in the list box
      //

      SetCursor (LoadCursor (NULL, IDC_WAIT));
      bReturn = DisplayPrinterDriverInfo (hwnd);
      SetCursor (LoadCursor (NULL, IDC_ARROW));

      if (!bReturn)
      {
        EndDialog (hwnd, TRUE);
      }

      //
      // set window title to reflect current device
      //

      else
      {
        if ( _snprintf (buf, BUFSIZE-1, "GetPrinterDriver: %s;%s;%s", gszDeviceName, gszPort, gszDriverName) > 0)
          SetWindowText (hwnd, (LPCSTR) buf);
      }

      break;
    }

    case WM_COMMAND:

      switch (LOWORD (wParam))
      {
        case DID_OK:

          EndDialog (hwnd, TRUE);
          return 1;
      }
      break;
  }
  return 0;
}

LPTSTR GetStringRes ( int id )

Definition at line 736 of file Generic.C.

{
  static TCHAR buffer[MAX_PATH];

  buffer[0]=0;
  LoadString (GetModuleHandle (NULL), id, buffer, MAX_PATH);
  return buffer;
}

LPTSTR GetStringRes2 ( int id )

Definition at line 6070 of file MfEdit.c.

{
  static TCHAR buffer[MAX_PATH];

  buffer[0]=0;
  LoadString (GetModuleHandle (NULL), id, buffer, MAX_PATH);
  return buffer;
}

BOOL Paint | ( | HDC | ,
 |  | LPRECT |
 | ) |  |

Definition at line 61 of file Paint.c.

{
  RECT  rect;
  HPEN  hpenSave;
  RECTI ri;

  if (gdwGraphicsOptions & DRAWAXIS)
  {
    //
    // draw axis
    //

    rect = *lpRect;

    hpenSave = SelectObject (hdc, GetStockObject (BLACK_PEN));

    //
    // if giMapMode == MM_TEXT, MM_ANISOTROPIC then (0,0) is upper left corner
    //

    if (giMapMode == MM_TEXT || giMapMode == MM_ANISOTROPIC)
    {
      MoveToEx (hdc, rect.left - glcyMenu/2, rect.bottom, NULL);
      LineTo   (hdc, rect.left,  rect.bottom + glcyMenu/2);
      LineTo   (hdc, rect.left + glcyMenu/2,  rect.bottom);

      MoveToEx (hdc, rect.left,  rect.bottom + glcyMenu/2, NULL);
      LineTo   (hdc, rect.left,  rect.top);
      LineTo   (hdc, rect.right + glcyMenu/2, rect.top);

      MoveToEx (hdc, rect.right, rect.top - glcyMenu/2, NULL);
      LineTo   (hdc, rect.right + glcyMenu/2,  rect.top);
      LineTo   (hdc, rect.right,  rect.top + glcyMenu/2);
    }

    //
    // else (0,0) is lower left corner
    //

    else
    {
      MoveToEx (hdc, rect.left - glcyMenu/2, rect.bottom, NULL);
      LineTo   (hdc, rect.left,  rect.bottom + glcyMenu/2);
      LineTo   (hdc, rect.left + glcyMenu/2,  rect.bottom);

      MoveToEx (hdc, rect.left,  rect.bottom + glcyMenu/2, NULL);
      LineTo   (hdc, rect.left,  rect.top);
      LineTo   (hdc, rect.right + glcyMenu/2, rect.top);

      MoveToEx (hdc, rect.right, rect.top + glcyMenu/2, NULL);
      LineTo   (hdc, rect.right + glcyMenu/2, rect.top);
      LineTo   (hdc, rect.right, rect.top - glcyMenu/2);
    }

    SelectObject (hdc, hpenSave);
  }

  //
  // look at bits in gdwGraphicsOptions & determine which graphics to draw
  //

  if (gdwGraphicsOptions & ENUMFONTS)
  {
    DrawFonts (hdc, lpRect);
    return TRUE;
  }

  giDeltaX = (int) ((lpRect->right - BORDER) / NUM_GRAPHICS_XSLOTS);
  giDeltaY = (int) ((lpRect->bottom - lpRect->top - BORDER)
    / NUM_GRAPHICS_YSLOTS);

  GetFirstGraphicSlot (lpRect, &ri);

  if (gdwGraphicsOptions & ARC)
  {
    Arc (hdc, ri.left, ri.top, ri.right, ri.bottom,
      ri.left, ri.top, ri.right-10, ri.bottom-10);
    GetNextGraphicSlot (&ri);
  }

  if (gdwGraphicsOptions & ELLIPSE)
  {
    Ellipse (hdc, ri.left, ri.top, ri.right, ri.bottom);
    GetNextGraphicSlot (&ri);
  }

  if (gdwGraphicsOptions & LINETO)
  {
    int i;

    for (i = PS_SOLID; i <= PS_DASHDOTDOT; i++)
    {
      MoveToEx (hdc, ri.left, ri.top + (i+1)*giDeltaY/7, NULL);
      LineTo   (hdc, ri.right, ri.top + (i+1)*giDeltaY/7);
    }
    GetNextGraphicSlot (&ri);
  }

  if (gdwGraphicsOptions & PIE)
  {
    Pie (hdc, ri.left, ri.top, ri.right, ri.bottom,
      ri.left, ri.top, ri.right-10, ri.bottom-10);
    GetNextGraphicSlot (&ri);
  }

  if (gdwGraphicsOptions & PLG_BLT)
  {
    HBITMAP hbm;
    BITMAP  bm;
    HDC     hdcMem;
    POINT   ap[3];

    hbm = LoadBitmap (ghInst, "printer");
    hdcMem = CreateCompatibleDC (hdc);
    SelectObject (hdcMem, hbm);

    GetObject (hbm, sizeof(BITMAP), (LPSTR)&bm);

    //
    // special case here because PlgBlt requires coordinates
    //   of upper left, upper right, & lower left
    //

    ap[0].x = (LONG) (ri.left + (ri.right - ri.left)/4);
    ap[0].y = (LONG) (ri.top + (ri.bottom - ri.top)/4);
    ap[1].x = (LONG) ri.right;
    ap[1].y = (LONG) ri.top;
    ap[2].x = (LONG) ri.left;
    ap[2].y = (LONG) ri.bottom;

    PlgBlt (hdc, ap, hdcMem, 0, 0, bm.bmWidth, bm.bmHeight, NULL, 0, 0);

    DeleteDC(hdcMem);
    DeleteObject(hbm);
    GetNextGraphicSlot (&ri);

  }

  if (gdwGraphicsOptions & POLYBEZIER)
  {
    POINT ap[4];

    ap[0].x  = (LONG) ri.left;    ap[0].y = (LONG) ri.top;
    ap[1].x  = (LONG) ri.left;    ap[1].y = (LONG) ri.bottom;
    ap[2].x  = (LONG) ri.right;   ap[2].y = (LONG) ri.top;
    ap[3].x  = (LONG) ri.right;   ap[3].y = (LONG) ri.bottom;

    PolyBezier (hdc, ap, 4);
    GetNextGraphicSlot (&ri);
  }

  if (gdwGraphicsOptions & POLYGON)
  {
    POINT ap[5];

    ap[0].x  = (LONG) ri.left;    ap[0].y = (LONG) ri.top;
    ap[1].x  = (LONG) ri.right;   ap[1].y = (LONG) ri.bottom;
    ap[2].x  = (LONG) ri.right;   ap[2].y = (LONG) ri.top;
    ap[3].x  = (LONG) ri.left;    ap[3].y = (LONG) ri.bottom;
    ap[4].x  = (LONG) ri.left;    ap[4].y = (LONG) ri.top;

    Polygon (hdc, ap, 4);
    GetNextGraphicSlot (&ri);
  }

  if (gdwGraphicsOptions & POLYLINE)
  {
    POINT ap[4];

    ap[0].x  = (LONG) ri.left;    ap[0].y = (LONG) ri.top;
    ap[1].x  = (LONG) ri.left;    ap[1].y = (LONG) ri.bottom;
    ap[2].x  = (LONG) ri.right;   ap[2].y = (LONG) ri.top;
    ap[3].x  = (LONG) ri.right;   ap[3].y = (LONG) ri.bottom;

    Polyline (hdc, ap, 4);
    GetNextGraphicSlot (&ri);
  }

  if (gdwGraphicsOptions & POLYPOLYGON)
  {
    POINT ap[8];
    int ai[2] = { 4, 4 };

    ap[0].x = (LONG)  ri.left;
    ap[0].y = (LONG)  ri.top;
    ap[1].x = (LONG) (ri.left + giDeltaX/4);
    ap[1].y = (LONG)  ri.top;
    ap[2].x = (LONG) (ri.left + giDeltaX/4);
    ap[2].y = (LONG) (ri.top  + giDeltaY/4);
    ap[3].x = (LONG)  ri.left;
    ap[3].y = (LONG) (ri.top  + giDeltaY/4);
    ap[4].x = (LONG) (ri.right  - 2*giDeltaX/3);
    ap[4].y = (LONG) (ri.bottom - 2*giDeltaY/3);
    ap[5].x = (LONG)  ri.right;
    ap[5].y = (LONG) (ri.bottom - 2*giDeltaY/3);
    ap[6].x = (LONG)  ri.right;
    ap[6].y = (LONG)  ri.bottom;
    ap[7].x = (LONG) (ri.right  - 2*giDeltaX/3);
    ap[7].y = (LONG)  ri.bottom;

    PolyPolygon (hdc, ap, ai, 2);
    GetNextGraphicSlot (&ri);
  }

  if (gdwGraphicsOptions & RECTANGLE)
  {
    Rectangle (hdc, ri.left, ri.top, ri.right, ri.bottom);
    GetNextGraphicSlot (&ri);
  }

  if (gdwGraphicsOptions & ROUNDRECT)
  {
    RoundRect (hdc, ri.left, ri.top, ri.right, ri.bottom, 15, 25);
    GetNextGraphicSlot (&ri);
  }

  if (gdwGraphicsOptions & STRETCH_BLT)
  {
    HBITMAP hbm;
    BITMAP  bm;
    HDC     hdcMem;

    hbm = LoadBitmap (ghInst, "printer");
    hdcMem = CreateCompatibleDC (hdc);
    SelectObject (hdcMem, hbm);

    GetObject (hbm, sizeof(BITMAP), (LPSTR)&bm);

    StretchBlt (hdc, ri.left, ri.top, ri.right-ri.left,
      ri.bottom - ri.top, hdcMem, 0, 0,
      bm.bmWidth, bm.bmHeight, SRCCOPY);

    DeleteDC(hdcMem);
    DeleteObject(hbm);
    GetNextGraphicSlot (&ri);
  }

  return TRUE;
}

Generated on Wed Nov 13 2024 16:53:11 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/Printer/Enumprt.c File Reference

  • Multimedia
  • Gdi
  • Printer
Functions

Enumprt.c File Reference

#include <windows.h>
#include <string.h>
#include <drivinit.h>
#include <stdio.h>
#include <winspool.h>
#include "common.h"
#include "enumprt.h"
#include "resource.h"

Go to the source code of this file.

Functions

void | ComplexEnumPrintersLine (HWND hwnd, char *pstr, ENUMPRTLOOKUP *pLkUp, int iMaxEntries, DWORD dwValue)
BOOL | DisplayEnumPrintersInfo (HWND hwnd)
BOOL | DisplayPrinterDriversInfo (HWND hwnd)
LRESULT CALLBACK | EnumPrinterDriversDlgProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
LRESULT CALLBACK | EnumPrintersDlgProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
LRESULT CALLBACK | EnumPrintersOptionsDlgProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
void | SetEnumPrintersDlgFields (HWND hwnd, DWORD dwMaxPrt, LPPRINTER_INFO_1 pPrtInfo1, LPPRINTER_INFO_2 pPrtInfo2)

Function Documentation

void ComplexEnumPrintersLine | ( | HWND | hwnd,
 |  | char * | pstr,
 |  | ENUMPRTLOOKUP * | pLkUp,
 |  | int | iMaxEntries,
 |  | DWORD | dwValue
 | ) |  |

Definition at line 547 of file Enumprt.c.

{
  char buf [BUFSIZE];
  int  i;
  BOOL bNewLine = FALSE;

  lstrcpyn  (buf, pstr, BUFSIZE);

  for (i = 0; i < iMaxEntries; i++)

    if (dwValue & (pLkUp + i)->dwValue)
    {
      if (bNewLine)
      {
        //
        // Keep the first symbolic constant on the same line as the
        //   cap type, eg:  "TECHNOLOGY:     DT_RASDISPLAY".
        //
        lstrcpyn (buf, BLANKS, BUFSIZE);
        strncat (buf, (pLkUp + i)->szValue, BUFSIZE - strlen(buf));
      }
      else
      {
        //
        // Put symbolic constant on new line, eg:
        //                  "                DT_RASPRINTER".
        //
    strncat (buf, (pLkUp + i)->szValue, BUFSIZE - strlen(buf));
        bNewLine = TRUE;
      }
      SendDlgItemMessage (hwnd, DID_LISTBOX, LB_INSERTSTRING,
                          (UINT)-1, (LONG_PTR) buf);
   }
}

BOOL DisplayEnumPrintersInfo ( HWND hwnd )

Definition at line 216 of file Enumprt.c.

{
    DWORD  dwBytesNeeded;
    DWORD  dwPrtRet1, dwPrtRet2;
    DWORD  dwMaxPrt;
    LPTSTR lpName = gdwEnumFlags & PRINTER_ENUM_NAME ? gszEnumName : NULL;

    LPPRINTER_INFO_1 pPrtInfo1 = NULL;
    LPPRINTER_INFO_2 pPrtInfo2 = NULL;

    BOOL   bReturn = TRUE;

    //
    // get byte count needed for buffer, alloc buffer, the enum the printers
    //
    EnumPrinters (gdwEnumFlags,   // types of printer objects to enumerate
                  lpName,         // name of printer object
                  1,              // specifies type of printer info structure
                  NULL,           // use NULL to get buffer size
                  0,              // size, in bytes, of array
                  &dwBytesNeeded, // pointer to variable with no. of bytes
                                  // copied (or required)
                  &dwPrtRet1);    // pointer to variable with no. of printer
                                  // info. structures copied
    //
    // (simple error checking, if these work assume rest will too)
    //

    // Allocate enough room for the returned data
    if (!(pPrtInfo1 = (LPPRINTER_INFO_1) LocalAlloc (LPTR, dwBytesNeeded)))
    {
        ErrMsgBox (GetStringRes(IDS_ENUMPRTLALLOCFAIL), GetStringRes2(ERR_MOD_NAME));

        return FALSE;  // Bail
    }

    if (!EnumPrinters(gdwEnumFlags,      // types of printer objects to enumerate
                      lpName,            // name of printer object
                      1,                 // specifies type of printer info structure
                      (LPBYTE)pPrtInfo1, // pointer to buffer to receive printer info
                                         // structures
                      dwBytesNeeded,     // size, in bytes, of array
                      &dwBytesNeeded,    // pointer to variable with no. of bytes
                                         // copied (or required)
                      &dwPrtRet1))       // pointer to variable with no. of printer
                                         // info. structures copied
    {
        TCHAR  tcBuffer[256];

        // Create and display our error message
        wsprintf (tcBuffer, "%s, 1, GetLastError: %d", GetStringRes2(ERR_MOD_NAME), GetLastError());
        ErrMsgBox (GetStringRes(IDS_ENUMPRT1FAIL), tcBuffer);

        // Free the buffer we allocated
        LocalFree(pPrtInfo1);

        return FALSE;  // Bail
    }

    //
    // If we don't get any printers from the Level == 1 call, there is
    //  no point in continuing... report it, free memory, and return.
    //
    if (dwPrtRet1 == 0) {

        MessageBox (ghwndMain,
            (LPCTSTR) "EnumPrinters (Level == 1) returned 0 printers",
            GetStringRes2(ERR_MOD_NAME),
            MB_OK);

        // Free the buffer we allocated
        LocalFree(pPrtInfo1);

        return FALSE;  // Bail
    }

    //
    // Call EnumPrinters again, this time with Level == 2.
    //
    // get byte count needed for buffer, alloc buffer, the enum the printers
    //
    EnumPrinters (gdwEnumFlags,     // types of printer objects to enumerate
                  lpName,           // name of printer object
                  2,                // specifies type of printer info structure
                  NULL,             // use NULL to get buffer size
                  0,                // size, in bytes, of array
                  &dwBytesNeeded,   // pointer to variable with no. of bytes
                                    // copied (or required)
                  &dwPrtRet2);      // pointer to variable with no. of printer
                                    // info. structures copied

    // Allocate enough room for the returned data
    if (!(pPrtInfo2 = (LPPRINTER_INFO_2) LocalAlloc (LPTR, dwBytesNeeded))) {
        ErrMsgBox (GetStringRes(IDS_ENUMPRTLALLOCFAIL), GetStringRes2(ERR_MOD_NAME));
    } else {

    if (!EnumPrinters (gdwEnumFlags,      // types of printer objects to enumerate
               lpName,            // name of printer object
               2,                 // specifies type of printer info structure
               (LPBYTE)pPrtInfo2, // pointer to buffer to receive printer info
                        // structures
               dwBytesNeeded,     // size, in bytes, of array
               &dwBytesNeeded,    // pointer to variable with no. of bytes
                        // copied (or required)
               &dwPrtRet2))       // pointer to variable with no. of printer
                        // info. structures copied
        dwPrtRet2 = 0;
    }

    //
    //  Calling EnumPrinters with Level == 2 frequently returns 0 printers.
    //  If so display only the PRINTER_INFO_1 structures we got before.
    //

    if (dwPrtRet2 == 0)
    {
        dwMaxPrt = dwPrtRet1;
        LocalFree (pPrtInfo2);
        pPrtInfo2 = NULL;
    } else {
        dwMaxPrt = dwPrtRet1 > dwPrtRet2 ? dwPrtRet2 : dwPrtRet1;
    }

    SetEnumPrintersDlgFields (hwnd, dwMaxPrt, pPrtInfo1, pPrtInfo2);

    if (pPrtInfo2)
        LocalFree (pPrtInfo2);

  if (pPrtInfo1)
        LocalFree (pPrtInfo1);

    return TRUE;
}

BOOL DisplayPrinterDriversInfo ( HWND hwnd )

Definition at line 648 of file Enumprt.c.

{
  DWORD         dwBytesNeeded, dwDrvRet, i;
  DRIVER_INFO_1 *pDriverInfo1;
  DRIVER_INFO_2 *pDriverInfo2;
  char          buf[BUFSIZE];
  BOOL          bReturn = TRUE;

  //
  // get byte count needed for buffer, alloc buffer, the enum the drivers
  //

  EnumPrinterDrivers ((LPTSTR) NULL, (LPTSTR) NULL, 1, NULL,
                      0, &dwBytesNeeded, &dwDrvRet);

  //
  // simple error checking, if these work assume rest will too
  //

  if (!(pDriverInfo1 = (DRIVER_INFO_1 *) LocalAlloc (LPTR, dwBytesNeeded)))
  {
    ErrMsgBox (GetStringRes(IDS_LALLOCFAIL), GetStringRes2(ERR_MOD_NAME));
    bReturn = FALSE;
    goto display_prt_drvs_info_done1;
  }

  if (!EnumPrinterDrivers ((LPTSTR) NULL, (LPTSTR) NULL, 1,
                           (LPBYTE) pDriverInfo1, dwBytesNeeded, &dwBytesNeeded,
                           &dwDrvRet))
  {
    ErrMsgBox (GetStringRes(IDS_ENUMPRTDRVRET0), GetStringRes2(ERR_MOD_NAME));
    bReturn = FALSE;
    goto display_prt_drvs_info_done2;
  }

  EnumPrinterDrivers ((LPTSTR) NULL,(LPTSTR) NULL, 2, NULL,
                      0, &dwBytesNeeded, &dwDrvRet);

  pDriverInfo2 = (DRIVER_INFO_2 *) LocalAlloc (LPTR, dwBytesNeeded);

  EnumPrinterDrivers ((LPTSTR) NULL, (LPTSTR) NULL, 2,
                      (LPBYTE) pDriverInfo2, dwBytesNeeded, &dwBytesNeeded,
                      &dwDrvRet);

  if (!dwDrvRet)
  {
    ErrMsgBox (GetStringRes(IDS_ENUMPRTDRVRET0), "");
    bReturn = FALSE;
    goto display_prt_drvs_info_done3;
  }

  //
  // insert formatted info into listbox
  //

  for (i = 0; i < dwDrvRet; i++)
  {
    if ( _snprintf (buf, BUFSIZE - 1, gaDriverInfo[0]) > 0 )
    outstr3();

    if ( _snprintf (buf, BUFSIZE - 1, gaDriverInfo[1], (pDriverInfo1 + i)->pName) > 0)
    outstr3();

    if ( _snprintf (buf, BUFSIZE - 1, gaDriverInfo[2]) > 0 )
    outstr3();

    if ( _snprintf (buf, BUFSIZE - 1, gaDriverInfo[3], (pDriverInfo2 + i)->cVersion) > 0 )
    outstr3();

    if ( _snprintf (buf, BUFSIZE - 1, gaDriverInfo[4], (pDriverInfo2 + i)->pName) > 0 )
    outstr3();

    if ( _snprintf (buf, BUFSIZE - 1, gaDriverInfo[5], (pDriverInfo2 + i)->pEnvironment) > 0 )
    outstr3();

    if ( _snprintf (buf, BUFSIZE - 1, gaDriverInfo[6], (pDriverInfo2 + i)->pDriverPath) > 0 )
    outstr3();

    if ( _snprintf (buf, BUFSIZE - 1, gaDriverInfo[7], (pDriverInfo2 + i)->pDataFile) > 0 )
    outstr3();

    if ( _snprintf (buf, BUFSIZE - 1, gaDriverInfo[8], (pDriverInfo2 + i)->pConfigFile) > 0 )
    outstr3();

  }

display_prt_drvs_info_done3:

  LocalFree (LocalHandle (pDriverInfo2));

display_prt_drvs_info_done2:

  LocalFree (LocalHandle (pDriverInfo1));

display_prt_drvs_info_done1:

  return bReturn;
}

LRESULT CALLBACK EnumPrinterDriversDlgProc | ( | HWND | hwnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 593 of file Enumprt.c.

{
  switch (msg)
  {
    case WM_INITDIALOG:
    {
      BOOL bReturn;

      SetCursor (LoadCursor (NULL, IDC_WAIT));
      bReturn = DisplayPrinterDriversInfo (hwnd);
      SetCursor (LoadCursor (NULL, IDC_ARROW));

      if (!bReturn)

        EndDialog (hwnd, TRUE);

      else

        SetWindowText (hwnd, (LPCTSTR) "EnumPrinterDrivers");

      break;
    }

    case WM_COMMAND:

      switch (LOWORD (wParam))
      {
        case DID_OK:

          EndDialog (hwnd, TRUE);

          return 1;
      }
      break;
  }
  return 0;
}

LRESULT CALLBACK EnumPrintersDlgProc | ( | HWND | hwnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 49 of file Enumprt.c.

{
  switch (msg)
  {
    case WM_INITDIALOG:
    {
      BOOL bReturn;

      //
      // prompt user for EnumPrinters flags...
      //

      if (DialogBox (GetModuleHandle (NULL), (LPCTSTR) "EnumPrtOpt",
                     NULL, (DLGPROC) EnumPrintersOptionsDlgProc))
      {
        //
        // shove all the enum printer info in the list box
        //

        SetCursor (LoadCursor (NULL, IDC_WAIT));
        bReturn = DisplayEnumPrintersInfo (hwnd);
        SetCursor (LoadCursor (NULL, IDC_ARROW));

        if (!bReturn)

          EndDialog (hwnd, TRUE);

        else

          SetWindowText (hwnd, (LPCTSTR)"EnumPrinters");
      }
      else

          EndDialog (hwnd, TRUE);

      break;
    }

    case WM_COMMAND:

      switch (LOWORD (wParam))
      {
        case DID_OK:

          EndDialog (hwnd, TRUE);
          break;
      }
      break;
  }
  return 0;
}

LRESULT CALLBACK EnumPrintersOptionsDlgProc | ( | HWND | hwnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 112 of file Enumprt.c.

{
  switch (msg)
  {
    case WM_INITDIALOG:

      gdwEnumFlags = 0;
      gszEnumName[0] = 0;
      break;

    case WM_COMMAND:

      switch (LOWORD (wParam))
      {
        case DID_OK:

          if (gdwEnumFlags)
          {
            if (gdwEnumFlags & PRINTER_ENUM_NAME)
            {
              GetDlgItemText (hwnd, DID_EDITTEXT, (LPTSTR)gszEnumName,
                              BUFSIZE);

#ifdef FORCE_VALID_NAME
              if (!strlen (gszEnumName))
              {
                MessageBox (hwnd,
                            (LPCTSTR) GetStringRes(IDS_ASKDOMSRVNM),
                            (LPCTSTR) "", MB_OK);
                SetFocus (GetDlgItem (hwnd, DID_EDITTEXT));
                break;
              }
#endif

            }

            EndDialog (hwnd, TRUE);
          }

          else

            EndDialog (hwnd, FALSE);

          break;

        case DID_CANCEL:

          EndDialog (hwnd, FALSE);
          break;

        default:

          if (HIWORD(wParam) == BN_CLICKED)
          {
            DWORD dwControlId = (DWORD) LOWORD (wParam);

            if (gdwEnumFlags & dwControlId)
            {
              //
              // remove that flag, if PRINTER_ENUM_NAME disable edittext
              //

              gdwEnumFlags &= ~dwControlId;

              if (dwControlId & PRINTER_ENUM_NAME)
              {
                SetDlgItemText (hwnd, DID_EDITTEXT, (LPCTSTR)"");
                EnableWindow   (GetDlgItem (hwnd, DID_EDITTEXT), FALSE);
              }
            }

            else
            {
              //
              // add that flag, if PRINTER_ENUM_NAME enable edittext
              //

              gdwEnumFlags |= dwControlId;

              if (dwControlId & PRINTER_ENUM_NAME)

                EnableWindow (GetDlgItem (hwnd, DID_EDITTEXT), TRUE);
            }
          }
          break;
      }
  }
  return 0;
}

void SetEnumPrintersDlgFields | ( | HWND | hwnd,
 |  | DWORD | dwMaxPrt,
 |  | LPPRINTER_INFO_1 | pPrtInfo1,
 |  | LPPRINTER_INFO_2 | pPrtInfo2
 | ) |  |

Definition at line 367 of file Enumprt.c.

{
  char  buf[256];
  WORD  i;
  DWORD j;

  SendDlgItemMessage (hwnd, DID_LISTBOX, LB_RESETCONTENT, 0, 0);
  SendDlgItemMessage (hwnd, DID_LISTBOX, WM_SETFONT, (WPARAM)GetStockObject(ANSI_FIXED_FONT), (LPARAM)0);

  for (j = 0; j < dwMaxPrt; j++) {
    //
    // Stick PRINTER_INFO_1  data in listbox
    //

    SendDlgItemMessage (hwnd, DID_LISTBOX, LB_INSERTSTRING, (UINT)-1,
      (LONG_PTR) gaEnumPrt[0]);

    outstr (gaEnumPrt[1], (pPrtInfo1 + j)->pDescription);
    outstr (gaEnumPrt[2], (pPrtInfo1 + j)->pName);
    outstr (gaEnumPrt[3], (pPrtInfo1 + j)->pComment);

    //
    // Stick PRINTER_INFO_2  data in listbox
    //

    if (pPrtInfo2 != NULL) {

      SendDlgItemMessage (hwnd, DID_LISTBOX, LB_INSERTSTRING, (UINT)-1,
                (LONG_PTR) gaEnumPrt[4]);

      outstr (gaEnumPrt[5],  (pPrtInfo2 + j)->pServerName);
      outstr (gaEnumPrt[6],  (pPrtInfo2 + j)->pPrinterName);
      outstr (gaEnumPrt[7],  (pPrtInfo2 + j)->pShareName);
      outstr (gaEnumPrt[8],  (pPrtInfo2 + j)->pPortName);
      outstr (gaEnumPrt[9],  (pPrtInfo2 + j)->pDriverName);
      outstr (gaEnumPrt[10], (pPrtInfo2 + j)->pComment);
      outstr (gaEnumPrt[11], (pPrtInfo2 + j)->pLocation);

      if ((pPrtInfo2 + j)->pDevMode)
      {
        DWORD dwFields;

        outstr (gaEnumPrt[12], "");
        outstr (gaEnumPrt[13], (pPrtInfo2 + j)->pDevMode->dmDeviceName);
        outnum (gaEnumPrt[14], (pPrtInfo2 + j)->pDevMode->dmSpecVersion);
        outnum (gaEnumPrt[15], (pPrtInfo2 + j)->pDevMode->dmDriverVersion);
        outnum (gaEnumPrt[16], (pPrtInfo2 + j)->pDevMode->dmSize);
        outnum (gaEnumPrt[17], (pPrtInfo2 + j)->pDevMode->dmDriverExtra);

        dwFields = (pPrtInfo2 + j)->pDevMode->dmFields;
        ComplexEnumPrintersLine (hwnd, gaEnumPrt[18], gaFields,
                     MAX_FIELDS,
                     dwFields);

        if (dwFields & DM_ORIENTATION) {
          ComplexEnumPrintersLine (hwnd, gaEnumPrt[19], gaOrientation,
                       MAX_ORIENTATION,
                       (DWORD)(pPrtInfo2 + j)->pDevMode->dmOrientation);
        }

        if (dwFields & DM_PAPERSIZE) {
          ComplexEnumPrintersLine (hwnd, gaEnumPrt[20], gaPaperSize,
                       MAX_PAPERSIZE,
                       (DWORD)(pPrtInfo2 + j)->pDevMode->dmPaperSize);
        }

        if (dwFields & DM_PAPERLENGTH)
          outnum (gaEnumPrt[21], (pPrtInfo2 + j)->pDevMode->dmPaperLength);

        if (dwFields & DM_PAPERWIDTH)
          outnum (gaEnumPrt[22], (pPrtInfo2 + j)->pDevMode->dmPaperWidth);

        if (dwFields & DM_SCALE)
          outnum (gaEnumPrt[23], (pPrtInfo2 + j)->pDevMode->dmScale);

        if (dwFields & DM_COPIES)
          outnum (gaEnumPrt[24], (pPrtInfo2 + j)->pDevMode->dmCopies);

        if (dwFields & DM_DEFAULTSOURCE) {
          ComplexEnumPrintersLine (hwnd, gaEnumPrt[25], gaDefaultSource,
                       MAX_DEFAULTSOURCE,
                       (DWORD)(pPrtInfo2 + j)->pDevMode->dmDefaultSource);
        }

        if (dwFields & DM_PRINTQUALITY) {
          ComplexEnumPrintersLine (hwnd, gaEnumPrt[26], gaPrintQuality,
                       MAX_PRINTQUALITY,
                       (DWORD)(pPrtInfo2 + j)->pDevMode->dmPrintQuality);
        }

        if (dwFields & DM_COLOR) {
          ComplexEnumPrintersLine (hwnd, gaEnumPrt[27], gaColor,
                       MAX_COLOR,
                       (DWORD)(pPrtInfo2 + j)->pDevMode->dmColor);
        }

        if (dwFields & DM_DUPLEX) {
          ComplexEnumPrintersLine (hwnd, gaEnumPrt[28], gaDuplex,
                       MAX_DUPLEX,
                       (DWORD)(pPrtInfo2 + j)->pDevMode->dmDuplex);
        }

        if (dwFields & DM_YRESOLUTION)
          outnum (gaEnumPrt[29], (DWORD)(pPrtInfo2 + j)->pDevMode->dmYResolution);

        if (dwFields & DM_TTOPTION)
          outnum (gaEnumPrt[30], (DWORD)(pPrtInfo2 + j)->pDevMode->dmTTOption);

        if (dwFields & DM_COLLATE)
          outnum (gaEnumPrt[31], (DWORD)(pPrtInfo2 + j)->pDevMode->dmCollate);

        if (dwFields & DM_FORMNAME)
          outstr (gaEnumPrt[32], (pPrtInfo2 + j)->pDevMode->dmFormName);
      }
      else
      {
        outstr (gaEnumPrt[12], NULL);
      }

      outstr (gaEnumPrt[33], (pPrtInfo2 + j)->pSepFile);
      outstr (gaEnumPrt[34], (pPrtInfo2 + j)->pPrintProcessor);
      outstr (gaEnumPrt[35], (pPrtInfo2 + j)->pDatatype);
      outstr (gaEnumPrt[36], (pPrtInfo2 + j)->pParameters);

      ComplexEnumPrintersLine (hwnd, gaEnumPrt[37], gaAttributes,
                   MAX_ATTRIBUTES,
                   (DWORD)(pPrtInfo2 + j)->Attributes);

      for (i = 0; i < MAX_PRIORITIES; i++) {
        if ((pPrtInfo2 + j)->Priority & gaPriorities[i].dwValue) {
          outstr (gaEnumPrt[38], gaPriorities[i].szValue);
          break;
        }
      }

      if (i == MAX_PRIORITIES) {
        outnum (gaEnumPrt[39], (pPrtInfo2 + j)->Priority);
      }

      outnum (gaEnumPrt[40], (pPrtInfo2 + j)->DefaultPriority);
      outnum (gaEnumPrt[41], (pPrtInfo2 + j)->StartTime);
      outnum (gaEnumPrt[42], (pPrtInfo2 + j)->UntilTime);

      ComplexEnumPrintersLine (hwnd, gaEnumPrt[43], gaStatus,
                   MAX_STATUS,
                   (DWORD)(pPrtInfo2 + j)->Status);

      outnum (gaEnumPrt[44], (pPrtInfo2 + j)->cJobs);
      outnum (gaEnumPrt[45], (pPrtInfo2 + j)->AveragePPM);
        }
    }
}

Generated on Wed Nov 13 2024 16:53:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/Printer/Enumprt.h File Reference

  • Multimedia
  • Gdi
  • Printer
Classes | Defines | Typedefs | Functions | Variables

Enumprt.h File Reference

Go to the source code of this file.

Classes

struct | tagENUMPRTLOOKUP

Defines

#define | BLANKS "\t\t\t"
#define | ERR_MOD_NAME IDS_ERR_ENUMPRT
#define | MAX_ATTRIBUTES 4
#define | MAX_COLOR 2
#define | MAX_DEFAULTSOURCE 16
#define | MAX_DUPLEX 3
#define | MAX_FIELDS 15
#define | MAX_ORIENTATION 2
#define | MAX_PAPERSIZE 41
#define | MAX_PRINTQUALITY 4
#define | MAX_PRIORITIES 4
#define | MAX_STATUS 3
#define | outnum(fmt, arg)
#define | outstr(fmt, arg)
#define | outstr2(buf)
#define | outstr3()

Typedefs

typedef struct tagENUMPRTLOOKUP | ENUMPRTLOOKUP

Functions

void | ComplexEnumPrintersLine (HWND, char *, ENUMPRTLOOKUP *, int, DWORD)
BOOL | DisplayEnumPrintersInfo (HWND)
BOOL | DisplayPrinterDriversInfo (HWND)
LRESULT CALLBACK | EnumPrintersOptionsDlgProc (HWND, UINT, WPARAM, LPARAM)
void | SetEnumPrintersDlgFields (HWND, DWORD, LPPRINTER_INFO_1, LPPRINTER_INFO_2)

Variables

ENUMPRTLOOKUP gaAttributes []
ENUMPRTLOOKUP gaColor []
ENUMPRTLOOKUP gaDefaultSource []
char * | gaDriverInfo []
ENUMPRTLOOKUP gaDuplex []
LPSTR gaEnumPrt []
ENUMPRTLOOKUP gaFields []
ENUMPRTLOOKUP gaOrientation []
ENUMPRTLOOKUP gaPaperSize []
ENUMPRTLOOKUP gaPrintQuality []
ENUMPRTLOOKUP gaPriorities []
ENUMPRTLOOKUP gaStatus []
DWORD gdwEnumFlags
HWND | ghwndEnumPrt
HWND | ghwndMain
char | gszEnumName [BUFSIZE]

Define Documentation

#define BLANKS "\t\t\t"

Definition at line 35 of file Enumprt.h.

#define ERR_MOD_NAME IDS_ERR_ENUMPRT

Definition at line 33 of file Enumprt.h.

#define MAX_ATTRIBUTES 4

Definition at line 22 of file Enumprt.h.

#define MAX_COLOR 2

Definition at line 30 of file Enumprt.h.

#define MAX_DEFAULTSOURCE 16

Definition at line 28 of file Enumprt.h.

#define MAX_DUPLEX 3

Definition at line 31 of file Enumprt.h.

#define MAX_FIELDS 15

Definition at line 25 of file Enumprt.h.

#define MAX_ORIENTATION 2

Definition at line 26 of file Enumprt.h.

#define MAX_PAPERSIZE 41

Definition at line 27 of file Enumprt.h.

#define MAX_PRINTQUALITY 4

Definition at line 29 of file Enumprt.h.

#define MAX_PRIORITIES 4

Definition at line 23 of file Enumprt.h.

#define MAX_STATUS 3

Definition at line 24 of file Enumprt.h.

#define outnum | ( | fmt,
 |  | arg
 | ) |
Value:
{ wsprintf(buf,fmt,arg);                         \
                           SendDlgItemMessage (hwnd, DID_LISTBOX,         \
                                               LB_INSERTSTRING, (UINT)-1, \
                                               (LONG_PTR) buf); }

Definition at line 272 of file Enumprt.h.

#define outstr | ( | fmt,
 |  | arg
 | ) |
Value:
{ wsprintf (buf,fmt,arg?arg:"(null)");           \
                           SendDlgItemMessage (hwnd, DID_LISTBOX,         \
                                               LB_INSERTSTRING, (UINT)-1, \
                                               (LONG_PTR) buf); }

Definition at line 259 of file Enumprt.h.

#define outstr2 ( buf )
Value:
SendDlgItemMessage (hwnd, DID_LISTBOX,         \
                                             LB_INSERTSTRING, (UINT)-1, \
                                             (LONG_PTR) buf);

Definition at line 264 of file Enumprt.h.

#define outstr3 ( )
Value:
SendDlgItemMessage (hwnd, DID_LISTBOX,         \
                                             LB_INSERTSTRING,           \
                                             (UINT)-1, (LONG_PTR) buf);

Definition at line 268 of file Enumprt.h.

Typedef Documentation

typedef struct tagENUMPRTLOOKUP ENUMPRTLOOKUP

Function Documentation

void ComplexEnumPrintersLine | ( | HWND | ,
 |  | char * | ,
 |  | ENUMPRTLOOKUP * | ,
 |  | int | ,
 |  | DWORD |
 | ) |  |

Definition at line 547 of file Enumprt.c.

{
  char buf [BUFSIZE];
  int  i;
  BOOL bNewLine = FALSE;

  lstrcpyn  (buf, pstr, BUFSIZE);

  for (i = 0; i < iMaxEntries; i++)

    if (dwValue & (pLkUp + i)->dwValue)
    {
      if (bNewLine)
      {
        //
        // Keep the first symbolic constant on the same line as the
        //   cap type, eg:  "TECHNOLOGY:     DT_RASDISPLAY".
        //
        lstrcpyn (buf, BLANKS, BUFSIZE);
        strncat (buf, (pLkUp + i)->szValue, BUFSIZE - strlen(buf));
      }
      else
      {
        //
        // Put symbolic constant on new line, eg:
        //                  "                DT_RASPRINTER".
        //
    strncat (buf, (pLkUp + i)->szValue, BUFSIZE - strlen(buf));
        bNewLine = TRUE;
      }
      SendDlgItemMessage (hwnd, DID_LISTBOX, LB_INSERTSTRING,
                          (UINT)-1, (LONG_PTR) buf);
   }
}

BOOL DisplayEnumPrintersInfo ( HWND )

Definition at line 216 of file Enumprt.c.

{
    DWORD  dwBytesNeeded;
    DWORD  dwPrtRet1, dwPrtRet2;
    DWORD  dwMaxPrt;
    LPTSTR lpName = gdwEnumFlags & PRINTER_ENUM_NAME ? gszEnumName : NULL;

    LPPRINTER_INFO_1 pPrtInfo1 = NULL;
    LPPRINTER_INFO_2 pPrtInfo2 = NULL;

    BOOL   bReturn = TRUE;

    //
    // get byte count needed for buffer, alloc buffer, the enum the printers
    //
    EnumPrinters (gdwEnumFlags,   // types of printer objects to enumerate
                  lpName,         // name of printer object
                  1,              // specifies type of printer info structure
                  NULL,           // use NULL to get buffer size
                  0,              // size, in bytes, of array
                  &dwBytesNeeded, // pointer to variable with no. of bytes
                                  // copied (or required)
                  &dwPrtRet1);    // pointer to variable with no. of printer
                                  // info. structures copied
    //
    // (simple error checking, if these work assume rest will too)
    //

    // Allocate enough room for the returned data
    if (!(pPrtInfo1 = (LPPRINTER_INFO_1) LocalAlloc (LPTR, dwBytesNeeded)))
    {
        ErrMsgBox (GetStringRes(IDS_ENUMPRTLALLOCFAIL), GetStringRes2(ERR_MOD_NAME));

        return FALSE;  // Bail
    }

    if (!EnumPrinters(gdwEnumFlags,      // types of printer objects to enumerate
                      lpName,            // name of printer object
                      1,                 // specifies type of printer info structure
                      (LPBYTE)pPrtInfo1, // pointer to buffer to receive printer info
                                         // structures
                      dwBytesNeeded,     // size, in bytes, of array
                      &dwBytesNeeded,    // pointer to variable with no. of bytes
                                         // copied (or required)
                      &dwPrtRet1))       // pointer to variable with no. of printer
                                         // info. structures copied
    {
        TCHAR  tcBuffer[256];

        // Create and display our error message
        wsprintf (tcBuffer, "%s, 1, GetLastError: %d", GetStringRes2(ERR_MOD_NAME), GetLastError());
        ErrMsgBox (GetStringRes(IDS_ENUMPRT1FAIL), tcBuffer);

        // Free the buffer we allocated
        LocalFree(pPrtInfo1);

        return FALSE;  // Bail
    }

    //
    // If we don't get any printers from the Level == 1 call, there is
    //  no point in continuing... report it, free memory, and return.
    //
    if (dwPrtRet1 == 0) {

        MessageBox (ghwndMain,
            (LPCTSTR) "EnumPrinters (Level == 1) returned 0 printers",
            GetStringRes2(ERR_MOD_NAME),
            MB_OK);

        // Free the buffer we allocated
        LocalFree(pPrtInfo1);

        return FALSE;  // Bail
    }

    //
    // Call EnumPrinters again, this time with Level == 2.
    //
    // get byte count needed for buffer, alloc buffer, the enum the printers
    //
    EnumPrinters (gdwEnumFlags,     // types of printer objects to enumerate
                  lpName,           // name of printer object
                  2,                // specifies type of printer info structure
                  NULL,             // use NULL to get buffer size
                  0,                // size, in bytes, of array
                  &dwBytesNeeded,   // pointer to variable with no. of bytes
                                    // copied (or required)
                  &dwPrtRet2);      // pointer to variable with no. of printer
                                    // info. structures copied

    // Allocate enough room for the returned data
    if (!(pPrtInfo2 = (LPPRINTER_INFO_2) LocalAlloc (LPTR, dwBytesNeeded))) {
        ErrMsgBox (GetStringRes(IDS_ENUMPRTLALLOCFAIL), GetStringRes2(ERR_MOD_NAME));
    } else {

    if (!EnumPrinters (gdwEnumFlags,      // types of printer objects to enumerate
               lpName,            // name of printer object
               2,                 // specifies type of printer info structure
               (LPBYTE)pPrtInfo2, // pointer to buffer to receive printer info
                        // structures
               dwBytesNeeded,     // size, in bytes, of array
               &dwBytesNeeded,    // pointer to variable with no. of bytes
                        // copied (or required)
               &dwPrtRet2))       // pointer to variable with no. of printer
                        // info. structures copied
        dwPrtRet2 = 0;
    }

    //
    //  Calling EnumPrinters with Level == 2 frequently returns 0 printers.
    //  If so display only the PRINTER_INFO_1 structures we got before.
    //

    if (dwPrtRet2 == 0)
    {
        dwMaxPrt = dwPrtRet1;
        LocalFree (pPrtInfo2);
        pPrtInfo2 = NULL;
    } else {
        dwMaxPrt = dwPrtRet1 > dwPrtRet2 ? dwPrtRet2 : dwPrtRet1;
    }

    SetEnumPrintersDlgFields (hwnd, dwMaxPrt, pPrtInfo1, pPrtInfo2);

    if (pPrtInfo2)
        LocalFree (pPrtInfo2);

  if (pPrtInfo1)
        LocalFree (pPrtInfo1);

    return TRUE;
}

BOOL DisplayPrinterDriversInfo ( HWND )

Definition at line 648 of file Enumprt.c.

{
  DWORD         dwBytesNeeded, dwDrvRet, i;
  DRIVER_INFO_1 *pDriverInfo1;
  DRIVER_INFO_2 *pDriverInfo2;
  char          buf[BUFSIZE];
  BOOL          bReturn = TRUE;

  //
  // get byte count needed for buffer, alloc buffer, the enum the drivers
  //

  EnumPrinterDrivers ((LPTSTR) NULL, (LPTSTR) NULL, 1, NULL,
                      0, &dwBytesNeeded, &dwDrvRet);

  //
  // simple error checking, if these work assume rest will too
  //

  if (!(pDriverInfo1 = (DRIVER_INFO_1 *) LocalAlloc (LPTR, dwBytesNeeded)))
  {
    ErrMsgBox (GetStringRes(IDS_LALLOCFAIL), GetStringRes2(ERR_MOD_NAME));
    bReturn = FALSE;
    goto display_prt_drvs_info_done1;
  }

  if (!EnumPrinterDrivers ((LPTSTR) NULL, (LPTSTR) NULL, 1,
                           (LPBYTE) pDriverInfo1, dwBytesNeeded, &dwBytesNeeded,
                           &dwDrvRet))
  {
    ErrMsgBox (GetStringRes(IDS_ENUMPRTDRVRET0), GetStringRes2(ERR_MOD_NAME));
    bReturn = FALSE;
    goto display_prt_drvs_info_done2;
  }

  EnumPrinterDrivers ((LPTSTR) NULL,(LPTSTR) NULL, 2, NULL,
                      0, &dwBytesNeeded, &dwDrvRet);

  pDriverInfo2 = (DRIVER_INFO_2 *) LocalAlloc (LPTR, dwBytesNeeded);

  EnumPrinterDrivers ((LPTSTR) NULL, (LPTSTR) NULL, 2,
                      (LPBYTE) pDriverInfo2, dwBytesNeeded, &dwBytesNeeded,
                      &dwDrvRet);

  if (!dwDrvRet)
  {
    ErrMsgBox (GetStringRes(IDS_ENUMPRTDRVRET0), "");
    bReturn = FALSE;
    goto display_prt_drvs_info_done3;
  }

  //
  // insert formatted info into listbox
  //

  for (i = 0; i < dwDrvRet; i++)
  {
    if ( _snprintf (buf, BUFSIZE - 1, gaDriverInfo[0]) > 0 )
    outstr3();

    if ( _snprintf (buf, BUFSIZE - 1, gaDriverInfo[1], (pDriverInfo1 + i)->pName) > 0)
    outstr3();

    if ( _snprintf (buf, BUFSIZE - 1, gaDriverInfo[2]) > 0 )
    outstr3();

    if ( _snprintf (buf, BUFSIZE - 1, gaDriverInfo[3], (pDriverInfo2 + i)->cVersion) > 0 )
    outstr3();

    if ( _snprintf (buf, BUFSIZE - 1, gaDriverInfo[4], (pDriverInfo2 + i)->pName) > 0 )
    outstr3();

    if ( _snprintf (buf, BUFSIZE - 1, gaDriverInfo[5], (pDriverInfo2 + i)->pEnvironment) > 0 )
    outstr3();

    if ( _snprintf (buf, BUFSIZE - 1, gaDriverInfo[6], (pDriverInfo2 + i)->pDriverPath) > 0 )
    outstr3();

    if ( _snprintf (buf, BUFSIZE - 1, gaDriverInfo[7], (pDriverInfo2 + i)->pDataFile) > 0 )
    outstr3();

    if ( _snprintf (buf, BUFSIZE - 1, gaDriverInfo[8], (pDriverInfo2 + i)->pConfigFile) > 0 )
    outstr3();

  }

display_prt_drvs_info_done3:

  LocalFree (LocalHandle (pDriverInfo2));

display_prt_drvs_info_done2:

  LocalFree (LocalHandle (pDriverInfo1));

display_prt_drvs_info_done1:

  return bReturn;
}

LRESULT CALLBACK EnumPrintersOptionsDlgProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 112 of file Enumprt.c.

{
  switch (msg)
  {
    case WM_INITDIALOG:

      gdwEnumFlags = 0;
      gszEnumName[0] = 0;
      break;

    case WM_COMMAND:

      switch (LOWORD (wParam))
      {
        case DID_OK:

          if (gdwEnumFlags)
          {
            if (gdwEnumFlags & PRINTER_ENUM_NAME)
            {
              GetDlgItemText (hwnd, DID_EDITTEXT, (LPTSTR)gszEnumName,
                              BUFSIZE);

#ifdef FORCE_VALID_NAME
              if (!strlen (gszEnumName))
              {
                MessageBox (hwnd,
                            (LPCTSTR) GetStringRes(IDS_ASKDOMSRVNM),
                            (LPCTSTR) "", MB_OK);
                SetFocus (GetDlgItem (hwnd, DID_EDITTEXT));
                break;
              }
#endif

            }

            EndDialog (hwnd, TRUE);
          }

          else

            EndDialog (hwnd, FALSE);

          break;

        case DID_CANCEL:

          EndDialog (hwnd, FALSE);
          break;

        default:

          if (HIWORD(wParam) == BN_CLICKED)
          {
            DWORD dwControlId = (DWORD) LOWORD (wParam);

            if (gdwEnumFlags & dwControlId)
            {
              //
              // remove that flag, if PRINTER_ENUM_NAME disable edittext
              //

              gdwEnumFlags &= ~dwControlId;

              if (dwControlId & PRINTER_ENUM_NAME)
              {
                SetDlgItemText (hwnd, DID_EDITTEXT, (LPCTSTR)"");
                EnableWindow   (GetDlgItem (hwnd, DID_EDITTEXT), FALSE);
              }
            }

            else
            {
              //
              // add that flag, if PRINTER_ENUM_NAME enable edittext
              //

              gdwEnumFlags |= dwControlId;

              if (dwControlId & PRINTER_ENUM_NAME)

                EnableWindow (GetDlgItem (hwnd, DID_EDITTEXT), TRUE);
            }
          }
          break;
      }
  }
  return 0;
}

void SetEnumPrintersDlgFields | ( | HWND | ,
 |  | DWORD | ,
 |  | LPPRINTER_INFO_1 | ,
 |  | LPPRINTER_INFO_2 |
 | ) |  |

Definition at line 367 of file Enumprt.c.

{
  char  buf[256];
  WORD  i;
  DWORD j;

  SendDlgItemMessage (hwnd, DID_LISTBOX, LB_RESETCONTENT, 0, 0);
  SendDlgItemMessage (hwnd, DID_LISTBOX, WM_SETFONT, (WPARAM)GetStockObject(ANSI_FIXED_FONT), (LPARAM)0);

  for (j = 0; j < dwMaxPrt; j++) {
    //
    // Stick PRINTER_INFO_1  data in listbox
    //

    SendDlgItemMessage (hwnd, DID_LISTBOX, LB_INSERTSTRING, (UINT)-1,
      (LONG_PTR) gaEnumPrt[0]);

    outstr (gaEnumPrt[1], (pPrtInfo1 + j)->pDescription);
    outstr (gaEnumPrt[2], (pPrtInfo1 + j)->pName);
    outstr (gaEnumPrt[3], (pPrtInfo1 + j)->pComment);

    //
    // Stick PRINTER_INFO_2  data in listbox
    //

    if (pPrtInfo2 != NULL) {

      SendDlgItemMessage (hwnd, DID_LISTBOX, LB_INSERTSTRING, (UINT)-1,
                (LONG_PTR) gaEnumPrt[4]);

      outstr (gaEnumPrt[5],  (pPrtInfo2 + j)->pServerName);
      outstr (gaEnumPrt[6],  (pPrtInfo2 + j)->pPrinterName);
      outstr (gaEnumPrt[7],  (pPrtInfo2 + j)->pShareName);
      outstr (gaEnumPrt[8],  (pPrtInfo2 + j)->pPortName);
      outstr (gaEnumPrt[9],  (pPrtInfo2 + j)->pDriverName);
      outstr (gaEnumPrt[10], (pPrtInfo2 + j)->pComment);
      outstr (gaEnumPrt[11], (pPrtInfo2 + j)->pLocation);

      if ((pPrtInfo2 + j)->pDevMode)
      {
        DWORD dwFields;

        outstr (gaEnumPrt[12], "");
        outstr (gaEnumPrt[13], (pPrtInfo2 + j)->pDevMode->dmDeviceName);
        outnum (gaEnumPrt[14], (pPrtInfo2 + j)->pDevMode->dmSpecVersion);
        outnum (gaEnumPrt[15], (pPrtInfo2 + j)->pDevMode->dmDriverVersion);
        outnum (gaEnumPrt[16], (pPrtInfo2 + j)->pDevMode->dmSize);
        outnum (gaEnumPrt[17], (pPrtInfo2 + j)->pDevMode->dmDriverExtra);

        dwFields = (pPrtInfo2 + j)->pDevMode->dmFields;
        ComplexEnumPrintersLine (hwnd, gaEnumPrt[18], gaFields,
                     MAX_FIELDS,
                     dwFields);

        if (dwFields & DM_ORIENTATION) {
          ComplexEnumPrintersLine (hwnd, gaEnumPrt[19], gaOrientation,
                       MAX_ORIENTATION,
                       (DWORD)(pPrtInfo2 + j)->pDevMode->dmOrientation);
        }

        if (dwFields & DM_PAPERSIZE) {
          ComplexEnumPrintersLine (hwnd, gaEnumPrt[20], gaPaperSize,
                       MAX_PAPERSIZE,
                       (DWORD)(pPrtInfo2 + j)->pDevMode->dmPaperSize);
        }

        if (dwFields & DM_PAPERLENGTH)
          outnum (gaEnumPrt[21], (pPrtInfo2 + j)->pDevMode->dmPaperLength);

        if (dwFields & DM_PAPERWIDTH)
          outnum (gaEnumPrt[22], (pPrtInfo2 + j)->pDevMode->dmPaperWidth);

        if (dwFields & DM_SCALE)
          outnum (gaEnumPrt[23], (pPrtInfo2 + j)->pDevMode->dmScale);

        if (dwFields & DM_COPIES)
          outnum (gaEnumPrt[24], (pPrtInfo2 + j)->pDevMode->dmCopies);

        if (dwFields & DM_DEFAULTSOURCE) {
          ComplexEnumPrintersLine (hwnd, gaEnumPrt[25], gaDefaultSource,
                       MAX_DEFAULTSOURCE,
                       (DWORD)(pPrtInfo2 + j)->pDevMode->dmDefaultSource);
        }

        if (dwFields & DM_PRINTQUALITY) {
          ComplexEnumPrintersLine (hwnd, gaEnumPrt[26], gaPrintQuality,
                       MAX_PRINTQUALITY,
                       (DWORD)(pPrtInfo2 + j)->pDevMode->dmPrintQuality);
        }

        if (dwFields & DM_COLOR) {
          ComplexEnumPrintersLine (hwnd, gaEnumPrt[27], gaColor,
                       MAX_COLOR,
                       (DWORD)(pPrtInfo2 + j)->pDevMode->dmColor);
        }

        if (dwFields & DM_DUPLEX) {
          ComplexEnumPrintersLine (hwnd, gaEnumPrt[28], gaDuplex,
                       MAX_DUPLEX,
                       (DWORD)(pPrtInfo2 + j)->pDevMode->dmDuplex);
        }

        if (dwFields & DM_YRESOLUTION)
          outnum (gaEnumPrt[29], (DWORD)(pPrtInfo2 + j)->pDevMode->dmYResolution);

        if (dwFields & DM_TTOPTION)
          outnum (gaEnumPrt[30], (DWORD)(pPrtInfo2 + j)->pDevMode->dmTTOption);

        if (dwFields & DM_COLLATE)
          outnum (gaEnumPrt[31], (DWORD)(pPrtInfo2 + j)->pDevMode->dmCollate);

        if (dwFields & DM_FORMNAME)
          outstr (gaEnumPrt[32], (pPrtInfo2 + j)->pDevMode->dmFormName);
      }
      else
      {
        outstr (gaEnumPrt[12], NULL);
      }

      outstr (gaEnumPrt[33], (pPrtInfo2 + j)->pSepFile);
      outstr (gaEnumPrt[34], (pPrtInfo2 + j)->pPrintProcessor);
      outstr (gaEnumPrt[35], (pPrtInfo2 + j)->pDatatype);
      outstr (gaEnumPrt[36], (pPrtInfo2 + j)->pParameters);

      ComplexEnumPrintersLine (hwnd, gaEnumPrt[37], gaAttributes,
                   MAX_ATTRIBUTES,
                   (DWORD)(pPrtInfo2 + j)->Attributes);

      for (i = 0; i < MAX_PRIORITIES; i++) {
        if ((pPrtInfo2 + j)->Priority & gaPriorities[i].dwValue) {
          outstr (gaEnumPrt[38], gaPriorities[i].szValue);
          break;
        }
      }

      if (i == MAX_PRIORITIES) {
        outnum (gaEnumPrt[39], (pPrtInfo2 + j)->Priority);
      }

      outnum (gaEnumPrt[40], (pPrtInfo2 + j)->DefaultPriority);
      outnum (gaEnumPrt[41], (pPrtInfo2 + j)->StartTime);
      outnum (gaEnumPrt[42], (pPrtInfo2 + j)->UntilTime);

      ComplexEnumPrintersLine (hwnd, gaEnumPrt[43], gaStatus,
                   MAX_STATUS,
                   (DWORD)(pPrtInfo2 + j)->Status);

      outnum (gaEnumPrt[44], (pPrtInfo2 + j)->cJobs);
      outnum (gaEnumPrt[45], (pPrtInfo2 + j)->AveragePPM);
        }
    }
}

Variable Documentation

ENUMPRTLOOKUP gaAttributes[]
Initial value:

    { { PRINTER_ATTRIBUTE_QUEUED       , "PRINTER_ATTRIBUTE_QUEUED  " },
      { PRINTER_ATTRIBUTE_DIRECT       , "PRINTER_ATTRIBUTE_DIRECT  " },
      { PRINTER_ATTRIBUTE_DEFAULT      , "PRINTER_ATTRIBUTE_DEFAULT " },
      { PRINTER_ATTRIBUTE_SHARED       , "PRINTER_ATTRIBUTE_SHARED  " } }

Definition at line 107 of file Enumprt.h.

ENUMPRTLOOKUP gaColor[]
Initial value:

    { { DMCOLOR_MONOCHROME, "DMCOLOR_MONOCHROME" },
      { DMCOLOR_COLOR     , "DMCOLOR_COLOR     " } }

Definition at line 221 of file Enumprt.h.

ENUMPRTLOOKUP gaDefaultSource[]
Initial value:

    { { DMBIN_FIRST        , "DMBIN_FIRST        " },
      { DMBIN_UPPER        , "DMBIN_UPPER        " },
      { DMBIN_ONLYONE      , "DMBIN_ONLYONE      " },
      { DMBIN_LOWER        , "DMBIN_LOWER        " },
      { DMBIN_MIDDLE       , "DMBIN_MIDDLE       " },
      { DMBIN_MANUAL       , "DMBIN_MANUAL       " },
      { DMBIN_ENVELOPE     , "DMBIN_ENVELOPE     " },
      { DMBIN_ENVMANUAL    , "DMBIN_ENVMANUAL    " },
      { DMBIN_AUTO         , "DMBIN_AUTO         " },
      { DMBIN_TRACTOR      , "DMBIN_TRACTOR      " },
      { DMBIN_SMALLFMT     , "DMBIN_SMALLFMT     " },
      { DMBIN_LARGEFMT     , "DMBIN_LARGEFMT     " },
      { DMBIN_LARGECAPACITY, "DMBIN_LARGECAPACITY" },
      { DMBIN_CASSETTE     , "DMBIN_CASSETTE     " },
      { DMBIN_LAST         , "DMBIN_LAST         " },
      { DMBIN_USER         , "DMBIN_USER         " } }

Definition at line 195 of file Enumprt.h.

char* gaDriverInfo[]
Initial value:

    {   "DRIVER_INFO_1",
        "  pName\t\t%s",

        "DRIVER_INFO_2",
        "  cVersion\t%ld",
        "  pName\t\t%s",
        "  pEnvironment\t%s",
        "  pDriverPath\t%s",
        "  pDataFile\t%s",
        "  pConfigFile\t%s" }

Definition at line 232 of file Enumprt.h.

ENUMPRTLOOKUP gaDuplex[]
Initial value:

    { { DMDUP_SIMPLEX   , "DMDUP_SIMPLEX   " },
      { DMDUP_VERTICAL  , "DMDUP_VERTICAL  " },
      { DMDUP_HORIZONTAL, "DMDUP_HORIZONTAL" } }

Definition at line 226 of file Enumprt.h.

LPSTR gaEnumPrt[]

Definition at line 58 of file Enumprt.h.

ENUMPRTLOOKUP gaFields[]
Initial value:

    { { DM_ORIENTATION  , "DM_ORIENTATION  " },
      { DM_PAPERSIZE    , "DM_PAPERSIZE    " },
      { DM_PAPERLENGTH  , "DM_PAPERLENGTH  " },
      { DM_PAPERWIDTH   , "DM_PAPERWIDTH   " },
      { DM_SCALE        , "DM_SCALE        " },
      { DM_COPIES       , "DM_COPIES       " },
      { DM_DEFAULTSOURCE, "DM_DEFAULTSOURCE" },
      { DM_PRINTQUALITY , "DM_PRINTQUALITY " },
      { DM_COLOR        , "DM_COLOR        " },
      { DM_DUPLEX       , "DM_DUPLEX       " },
      { DM_YRESOLUTION  , "DM_YRESOLUTION  " },
      { DM_TTOPTION     , "DM_TTOPTION     " },
      { DM_COLLATE      , "DM_COLLATE      " },
      { DM_FORMNAME     , "DM_FORMNAME     " },
      { 0               , "0               " } }

Definition at line 128 of file Enumprt.h.

ENUMPRTLOOKUP gaOrientation[]
Initial value:

    { { DMORIENT_PORTRAIT , "DMORIENT_PORTRAIT " },
      { DMORIENT_LANDSCAPE, "DMORIENT_LANDSCAPE" } }

Definition at line 146 of file Enumprt.h.

ENUMPRTLOOKUP gaPaperSize[]

Definition at line 151 of file Enumprt.h.

ENUMPRTLOOKUP gaPrintQuality[]
Initial value:

    { { (DWORD)DMRES_DRAFT , "DMRES_DRAFT " },
      { (DWORD)DMRES_LOW   , "DMRES_LOW   " },
      { (DWORD)DMRES_MEDIUM, "DMRES_MEDIUM" },
      { (DWORD)DMRES_HIGH  , "DMRES_HIGH  " } }

Definition at line 214 of file Enumprt.h.

ENUMPRTLOOKUP gaPriorities[]
Initial value:

    { { NO_PRIORITY                    , "NO_PRIORITY  " },
      { MAX_PRIORITY                   , "MAX_PRIORITY " },
      { MIN_PRIORITY                   , "MIN_PRIORITY " },
      { DEF_PRIORITY                   , "DEF_PRIORITY " } }

Definition at line 114 of file Enumprt.h.

ENUMPRTLOOKUP gaStatus[]
Initial value:

    { { PRINTER_STATUS_PAUSED          , "PRINTER_STATUS_PAUSED "          },
      { PRINTER_STATUS_ERROR           , "PRINTER_STATUS_ERROR  "          },
      { PRINTER_STATUS_PENDING_DELETION, "PRINTER_STATUS_PENDING_DELETION "},
      { 0                              , ""                                }}

Definition at line 121 of file Enumprt.h.

DWORD gdwEnumFlags

Definition at line 55 of file Enumprt.h.

HWND ghwndEnumPrt

Definition at line 54 of file Enumprt.h.

HWND ghwndMain

Definition at line 447 of file MfEdit.h.

char gszEnumName[BUFSIZE]

Definition at line 56 of file Enumprt.h.

Generated on Wed Nov 13 2024 16:53:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/Printer/Getcaps.c File Reference

  • Multimedia
  • Gdi
  • Printer
Functions

Getcaps.c File Reference

#include <windows.h>
#include <winspool.h>
#include <string.h>
#include <stdio.h>
#include "common.h"
#include "getcaps.h"
#include "resource.h"

Go to the source code of this file.

Functions

void | ComplexDeviceCapsLine (char *pbuf, CAPSLOOKUP *pLkUp, int iMaxEntries, int iValue, int iBuffSize)
BOOL DisplayDeviceCapsInfo ()
LRESULT CALLBACK | GetDeviceCapsDlgProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
void | TranslateDeviceCaps (int arrayIndex, int capIndex, int iValue)

Function Documentation

void ComplexDeviceCapsLine | ( | char * | pbuf,
 |  | CAPSLOOKUP * | pLkUp,
 |  | int | iMaxEntries,
 |  | int | iValue,
 |  | int | iBuffSize
 | ) |  |

Definition at line 261 of file Getcaps.c.

{
  int  i;
  BOOL bNewLine = FALSE;

  for (i = 0; i < iMaxEntries; i++)

    if (iValue & (pLkUp + i)->iValue)
    {
      if (bNewLine)
      {
        //
        // Keep the first symbolic constant on the same line as the
        //   cap type, eg:  "TECHNOLOGY:     DT_RASDISPLAY".
        //

        lstrcpyn (pbuf, BLANKS, iBuffSize);
        strncat (pbuf, (pLkUp + i)->szValue, iBuffSize - strlen(pbuf));
      }
      else
      {
        //
        // Put symbolic constant on new line, eg:
        //                  "                DT_RASPRINTER".
        //

        strncat (pbuf, (pLkUp + i)->szValue, iBuffSize - strlen(pbuf));
        bNewLine = TRUE;
      }
      SendDlgItemMessage (ghwndDevCaps, DID_LISTBOX, LB_INSERTSTRING,
                          (UINT)-1, (LONG_PTR) pbuf);
   }
}

BOOL DisplayDeviceCapsInfo ( void )

Definition at line 114 of file Getcaps.c.

{
  HDC hdc;
  int i, iValue;

  if (!strcmp (gszDeviceName, "Display"))
  {
    if (!(hdc = GetDC (ghwndDevCaps)))
    {
      ErrMsgBox (GetStringRes(IDS_GETDCFAIL), ERR_MOD_NAME);
      return FALSE;
    }
  }

  else
  {
    if (!(hdc = CreateDC (gszDriverName, gszDeviceName, gszPort, NULL)))
    {
      char buf[BUFSIZE];

      if (_snprintf (buf, BUFSIZE-1, GetStringRes(IDS_FMT_CREDCFAIL), gszDriverName, gszDeviceName, gszPort) > 0)
        ErrMsgBox (buf, ERR_MOD_NAME);

      return FALSE;
    }
  }

  for (i = 0; i < MAX_DEVICE_CAPS; i++)
  {
    iValue = GetDeviceCaps (hdc, gaCaps[i].iValue);
    TranslateDeviceCaps (i, gaCaps[i].iValue, iValue);
  }

  if (!strcmp (gszDeviceName, "Display"))
    ReleaseDC(ghwndDevCaps, hdc);
  else
    DeleteDC (hdc);

  return TRUE;
}

LRESULT CALLBACK GetDeviceCapsDlgProc | ( | HWND | hwnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 46 of file Getcaps.c.

{
  switch (msg)
  {
    case WM_INITDIALOG:
    {
      BOOL bReturn;
      char buf[BUFSIZE];

      SendDlgItemMessage (hwnd, DID_LISTBOX, WM_SETFONT, (WPARAM)GetStockObject(ANSI_FIXED_FONT), (LPARAM)0);

    ghwndDevCaps = hwnd;

      //
      // shove all the caps info in the list box
      //

      SetCursor (LoadCursor (NULL, IDC_WAIT));
      bReturn = DisplayDeviceCapsInfo ();
      SetCursor (LoadCursor (NULL, IDC_ARROW));

      if (!bReturn)
      {
        EndDialog (hwnd, TRUE);
      }

      //
      // set window title to reflect current device
      //

      else
      {
        if ( _snprintf (buf, BUFSIZE-1, "GetDeviceCaps: %s;%s;%s", gszDeviceName, gszPort, gszDriverName) > 0 )
          SetWindowText (hwnd, (LPCSTR) buf);
      }

      break;
    }

    case WM_COMMAND:

      switch (LOWORD (wParam))
      {
        case DID_OK:

          EndDialog (hwnd, TRUE);
          return 1;
      }
      break;
  }
  return 0;
}

void TranslateDeviceCaps | ( | int | arrayIndex,
 |  | int | capIndex,
 |  | int | iValue
 | ) |  |

Definition at line 173 of file Getcaps.c.

{
  char buf[BUFSIZE];

  lstrcpyn (buf, gaCaps[arrayIndex].szValue, BUFSIZE);

  switch (capIndex)
  {
    case TECHNOLOGY:
    {
      int     i;

      for (i = 0; i < MAX_TECHNOLOGY_CAPS; i++)
        if (iValue == (gaTechnologyCaps + i)->iValue)
        {
          strncat(buf, (gaTechnologyCaps + i)->szValue, BUFSIZE - strlen(buf));
          SendDlgItemMessage (ghwndDevCaps, DID_LISTBOX, LB_INSERTSTRING,
                              (UINT)-1, (LONG_PTR) buf);
          break;
        }

      break;
    }

    case CURVECAPS:

      ComplexDeviceCapsLine (buf, gaCurveCaps, MAX_CURVE_CAPS, iValue, BUFSIZE);
      break;

    case LINECAPS:

      ComplexDeviceCapsLine (buf, gaLineCaps, MAX_LINE_CAPS, iValue, BUFSIZE);
      break;

    case POLYGONALCAPS:

      ComplexDeviceCapsLine (buf, gaPolygonCaps, MAX_POLYGON_CAPS, iValue, BUFSIZE);
      break;

    case TEXTCAPS:

      ComplexDeviceCapsLine (buf, gaTextCaps, MAX_TEXT_CAPS, iValue, BUFSIZE);
      break;

    case CLIPCAPS:

      ComplexDeviceCapsLine (buf, gaClipCaps, MAX_CLIP_CAPS, iValue, BUFSIZE);
      break;

    case RASTERCAPS:

      ComplexDeviceCapsLine (buf, gaRasterCaps, MAX_RASTER_CAPS, iValue, BUFSIZE);
      break;

    default:

      wsprintf(buf, gaCaps[arrayIndex].szValue, iValue);

      SendDlgItemMessage (ghwndDevCaps, DID_LISTBOX, LB_INSERTSTRING,
                          (UINT)-1, (LONG_PTR) buf);
      break;
  }
}

Generated on Wed Nov 13 2024 16:53:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/Printer/Getcaps.h File Reference

  • Multimedia
  • Gdi
  • Printer
Classes | Defines | Typedefs | Functions | Variables

Getcaps.h File Reference

Go to the source code of this file.

Classes

struct | tagCAPSLOOKUP

Defines

#define | BLANKS " \t"
#define | ERR_MOD_NAME IDS_ERR_GETCAPS
#define | MAX_CLIP_CAPS 3
#define | MAX_CURVE_CAPS 10
#define | MAX_DEVICE_CAPS 34
#define | MAX_LINE_CAPS 8
#define | MAX_POLYGON_CAPS 10
#define | MAX_RASTER_CAPS 17
#define | MAX_TECHNOLOGY_CAPS 7
#define | MAX_TEXT_CAPS 16

Typedefs

typedef struct tagCAPSLOOKUP | CAPSLOOKUP

Functions

void | ComplexDeviceCapsLine (char *, CAPSLOOKUP *, int, int, int)
BOOL | DisplayDeviceCapsInfo (void)
void | TranslateDeviceCaps (int, int, int)

Variables

CAPSLOOKUP gaCaps []
CAPSLOOKUP gaClipCaps []
CAPSLOOKUP gaCurveCaps []
CAPSLOOKUP gaLineCaps []
CAPSLOOKUP gaPolygonCaps []
CAPSLOOKUP gaRasterCaps []
CAPSLOOKUP gaTechnologyCaps []
CAPSLOOKUP gaTextCaps []
HWND | ghwndDevCaps
HWND | ghwndMain
char | gszDeviceName []
char | gszDriverName []
char | gszPort []

Define Documentation

#define BLANKS " \t"

Definition at line 33 of file Getcaps.h.

#define ERR_MOD_NAME IDS_ERR_GETCAPS

Definition at line 35 of file Getcaps.h.

#define MAX_CLIP_CAPS 3

Definition at line 31 of file Getcaps.h.

#define MAX_CURVE_CAPS 10

Definition at line 26 of file Getcaps.h.

#define MAX_DEVICE_CAPS 34

Definition at line 23 of file Getcaps.h.

#define MAX_LINE_CAPS 8

Definition at line 27 of file Getcaps.h.

#define MAX_POLYGON_CAPS 10

Definition at line 28 of file Getcaps.h.

#define MAX_RASTER_CAPS 17

Definition at line 30 of file Getcaps.h.

#define MAX_TECHNOLOGY_CAPS 7

Definition at line 25 of file Getcaps.h.

#define MAX_TEXT_CAPS 16

Definition at line 29 of file Getcaps.h.

Typedef Documentation

typedef struct tagCAPSLOOKUP CAPSLOOKUP

Function Documentation

void ComplexDeviceCapsLine | ( | char * | ,
 |  | CAPSLOOKUP * | ,
 |  | int | ,
 |  | int | ,
 |  | int |
 | ) |  |

Definition at line 261 of file Getcaps.c.

{
  int  i;
  BOOL bNewLine = FALSE;

  for (i = 0; i < iMaxEntries; i++)

    if (iValue & (pLkUp + i)->iValue)
    {
      if (bNewLine)
      {
        //
        // Keep the first symbolic constant on the same line as the
        //   cap type, eg:  "TECHNOLOGY:     DT_RASDISPLAY".
        //

        lstrcpyn (pbuf, BLANKS, iBuffSize);
        strncat (pbuf, (pLkUp + i)->szValue, iBuffSize - strlen(pbuf));
      }
      else
      {
        //
        // Put symbolic constant on new line, eg:
        //                  "                DT_RASPRINTER".
        //

        strncat (pbuf, (pLkUp + i)->szValue, iBuffSize - strlen(pbuf));
        bNewLine = TRUE;
      }
      SendDlgItemMessage (ghwndDevCaps, DID_LISTBOX, LB_INSERTSTRING,
                          (UINT)-1, (LONG_PTR) pbuf);
   }
}

BOOL DisplayDeviceCapsInfo ( void )

Definition at line 114 of file Getcaps.c.

{
  HDC hdc;
  int i, iValue;

  if (!strcmp (gszDeviceName, "Display"))
  {
    if (!(hdc = GetDC (ghwndDevCaps)))
    {
      ErrMsgBox (GetStringRes(IDS_GETDCFAIL), ERR_MOD_NAME);
      return FALSE;
    }
  }

  else
  {
    if (!(hdc = CreateDC (gszDriverName, gszDeviceName, gszPort, NULL)))
    {
      char buf[BUFSIZE];

      if (_snprintf (buf, BUFSIZE-1, GetStringRes(IDS_FMT_CREDCFAIL), gszDriverName, gszDeviceName, gszPort) > 0)
        ErrMsgBox (buf, ERR_MOD_NAME);

      return FALSE;
    }
  }

  for (i = 0; i < MAX_DEVICE_CAPS; i++)
  {
    iValue = GetDeviceCaps (hdc, gaCaps[i].iValue);
    TranslateDeviceCaps (i, gaCaps[i].iValue, iValue);
  }

  if (!strcmp (gszDeviceName, "Display"))
    ReleaseDC(ghwndDevCaps, hdc);
  else
    DeleteDC (hdc);

  return TRUE;
}

void TranslateDeviceCaps | ( | int | ,
 |  | int | ,
 |  | int |
 | ) |  |

Definition at line 173 of file Getcaps.c.

{
  char buf[BUFSIZE];

  lstrcpyn (buf, gaCaps[arrayIndex].szValue, BUFSIZE);

  switch (capIndex)
  {
    case TECHNOLOGY:
    {
      int     i;

      for (i = 0; i < MAX_TECHNOLOGY_CAPS; i++)
        if (iValue == (gaTechnologyCaps + i)->iValue)
        {
          strncat(buf, (gaTechnologyCaps + i)->szValue, BUFSIZE - strlen(buf));
          SendDlgItemMessage (ghwndDevCaps, DID_LISTBOX, LB_INSERTSTRING,
                              (UINT)-1, (LONG_PTR) buf);
          break;
        }

      break;
    }

    case CURVECAPS:

      ComplexDeviceCapsLine (buf, gaCurveCaps, MAX_CURVE_CAPS, iValue, BUFSIZE);
      break;

    case LINECAPS:

      ComplexDeviceCapsLine (buf, gaLineCaps, MAX_LINE_CAPS, iValue, BUFSIZE);
      break;

    case POLYGONALCAPS:

      ComplexDeviceCapsLine (buf, gaPolygonCaps, MAX_POLYGON_CAPS, iValue, BUFSIZE);
      break;

    case TEXTCAPS:

      ComplexDeviceCapsLine (buf, gaTextCaps, MAX_TEXT_CAPS, iValue, BUFSIZE);
      break;

    case CLIPCAPS:

      ComplexDeviceCapsLine (buf, gaClipCaps, MAX_CLIP_CAPS, iValue, BUFSIZE);
      break;

    case RASTERCAPS:

      ComplexDeviceCapsLine (buf, gaRasterCaps, MAX_RASTER_CAPS, iValue, BUFSIZE);
      break;

    default:

      wsprintf(buf, gaCaps[arrayIndex].szValue, iValue);

      SendDlgItemMessage (ghwndDevCaps, DID_LISTBOX, LB_INSERTSTRING,
                          (UINT)-1, (LONG_PTR) buf);
      break;
  }
}

Variable Documentation

CAPSLOOKUP gaCaps[]

Definition at line 58 of file Getcaps.h.

CAPSLOOKUP gaClipCaps[]
Initial value:

    { { CP_NONE,         "CP_NONE "         },
      { CP_RECTANGLE,    "CP_RECTANGLE "    },
      { CP_REGION,       "CP_REGION "       } }

Definition at line 183 of file Getcaps.h.

CAPSLOOKUP gaCurveCaps[]
Initial value:

    { { CC_NONE,         "CC_NONE "         },
      { CC_CIRCLES,      "CC_CIRCLES "      },
      { CC_PIE,          "CC_PIE "          },
      { CC_CHORD,        "CC_CHORD "        },
      { CC_ELLIPSES,     "CC_ELLIPSES "     },
      { CC_WIDE,         "CC_WIDE "         },
      { CC_STYLED,       "CC_STYLED "       },
      { CC_WIDESTYLED,   "CC_WIDESTYLED "   },
      { CC_INTERIORS,    "CC_INTERIORS "    },
      { CC_ROUNDRECT,    "CC_ROUNDRECT "    } }

Definition at line 106 of file Getcaps.h.

CAPSLOOKUP gaLineCaps[]
Initial value:

    { { LC_NONE,         "LC_NONE "         },
      { LC_POLYLINE,     "LC_POLYLINE "     },
      { LC_MARKER,       "LC_MARKER "       },
      { LC_POLYMARKER,   "LC_POLYMARKER "   },
      { LC_WIDE,         "LC_WIDE "         },
      { LC_STYLED,       "LC_STYLED "       },
      { LC_WIDESTYLED,   "LC_WIDESTYLED "   },
      { LC_INTERIORS,    "LC_INTERIORS "    } }

Definition at line 119 of file Getcaps.h.

CAPSLOOKUP gaPolygonCaps[]
Initial value:

    { { PC_NONE,         "PC_NONE "         },
      { PC_POLYGON,      "PC_POLYGON "      },
      { PC_RECTANGLE,    "PC_RECTANGLE "    },
      { PC_WINDPOLYGON,  "PC_WINDPOLYGON"   },
      { PC_TRAPEZOID,    "PC_TRAPEZOID"     },
      { PC_SCANLINE,     "PC_SCANLINE"      },
      { PC_WIDE,         "PC_WIDE"          },
      { PC_STYLED,       "PC_STYLED"        },
      { PC_WIDESTYLED,   "PC_WIDESTYLED"    },
      { PC_INTERIORS,    "PC_INTERIORS"     } }

Definition at line 130 of file Getcaps.h.

CAPSLOOKUP gaRasterCaps[]
Initial value:

    { { 0,               "RC_NONE "         },
      { RC_BITBLT,       "RC_BITBLT "       },
      { RC_BANDING,      "RC_BANDING "      },
      { RC_SCALING,      "RC_SCALING "      },
      { RC_BITMAP64,     "RC_BITMAP64 "     },
      { RC_GDI20_OUTPUT, "RC_GDI20_OUTPUT " },
      { RC_GDI20_STATE,  "RC_GDI20_STATE "  },
      { RC_SAVEBITMAP,   "RC_SAVEBITMAP "   },
      { RC_DI_BITMAP,    "RC_DI_BITMAP "    },
      { RC_PALETTE,      "RC_PALETTE "      },
      { RC_DIBTODEV,     "RC_DIBTODEV "     },
      { RC_BIGFONT,      "RC_BIGFONT "      },
      { RC_STRETCHBLT,   "RC_STRETCHBLT "   },
      { RC_FLOODFILL,    "RC_FLOODFILL "    },
      { RC_STRETCHDIB,   "RC_STRETCHDIB "   },
      { RC_OP_DX_OUTPUT, "RC_OP_DX_OUTPUT " },
      { RC_DEVBITS,      "RC_DEVBITS "      } }

Definition at line 163 of file Getcaps.h.

CAPSLOOKUP gaTechnologyCaps[]
Initial value:

    { { DT_PLOTTER,      "DT_PLOTTER "      },
      { DT_RASDISPLAY,   "DT_RASDISPLAY "   },
      { DT_RASPRINTER,   "DT_RASPRINTER "   },
      { DT_RASCAMERA,    "DT_RASCAMERA "    },
      { DT_CHARSTREAM,   "DT_CHARSTREAM "   },
      { DT_METAFILE,     "DT_METAFILE "     },
      { DT_DISPFILE,     "DT_DISPFILE "     } }

Definition at line 96 of file Getcaps.h.

CAPSLOOKUP gaTextCaps[]
Initial value:

    { { TC_OP_CHARACTER, "TC_OP_CHARACTER"  },
      { TC_OP_STROKE,    "TC_OP_STROKE"     },
      { TC_CP_STROKE,    "TC_CP_STROKE"     },
      { TC_CR_90,        "TC_CR_90"         },
      { TC_CR_ANY,       "TC_CR_ANY"        },
      { TC_SF_X_YINDEP,  "TC_SF_X_YINDEP "  },
      { TC_SA_DOUBLE,    "TC_SA_DOUBLE "    },
      { TC_SA_INTEGER,   "TC_SA_INTEGER "   },
      { TC_SA_CONTIN,    "TC_SA_CONTIN "    },
      { TC_EA_DOUBLE,    "TC_EA_DOUBLE "    },
      { TC_IA_ABLE,      "TC_IA_ABLE "      },
      { TC_UA_ABLE,      "TC_UA_ABLE "      },
      { TC_SO_ABLE,      "TC_SO_ABLE "      },
      { TC_RA_ABLE,      "TC_RA_ABLE "      },
      { TC_VA_ABLE,      "TC_VA_ABLE "      },
      { TC_RESERVED,     "TC_RESERVED "     },
      { TC_SCROLLBLT,    "TC_SCROLLBLT "     } }

Definition at line 143 of file Getcaps.h.

HWND ghwndDevCaps

Definition at line 56 of file Getcaps.h.

HWND ghwndMain

Definition at line 447 of file MfEdit.h.

char gszDeviceName[]

Definition at line 86 of file Printer.h.

char gszDriverName[]

Definition at line 88 of file Printer.h.

char gszPort[]

Definition at line 87 of file Printer.h.

Generated on Wed Nov 13 2024 16:53:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/Printer/Getpdriv.c File Reference

  • Multimedia
  • Gdi
  • Printer
Functions

Getpdriv.c File Reference

#include <windows.h>
#include <winspool.h>
#include <string.h>
#include <stdio.h>
#include "common.h"
#include "getpdriv.h"
#include "resource.h"

Go to the source code of this file.

Functions

BOOL | DisplayPrinterDriverInfo (HWND hwnd)
LRESULT CALLBACK | GetPrinterDriverDlgProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)

Function Documentation

BOOL DisplayPrinterDriverInfo ( HWND hwnd )

Definition at line 109 of file Getpdriv.c.

{
  HANDLE        hPrinter;
  DWORD         dwBytesNeeded;
  DRIVER_INFO_1 *pDriverInfo1;
  DRIVER_INFO_2 *pDriverInfo2;
  char          buf[BUFSIZE];
  char          pEnvironment[BUFSIZE] = "";
  BOOL          bReturn = TRUE;

  //
  // open selected printer & alloc buffers & get sundry info, close printer
  //

  OpenPrinter (gszDeviceName, &hPrinter, NULL);

  if (!hPrinter)
  {
    char buf[BUFSIZE];

    _snprintf (buf, BUFSIZE-1, GetStringRes(IDS_FMT_OPNPRTFAIL), gszDeviceName);
    ErrMsgBox ((LPCSTR) buf, ERR_MOD_NAME);
    bReturn  = FALSE;
    goto display_prt_drv_info_done1;
  }

  GetPrinterDriver (hPrinter, pEnvironment, 1, NULL, 0, &dwBytesNeeded);

  //
  // simple error checking, if these work assume rest will too
  //

  if (!(pDriverInfo1 = (DRIVER_INFO_1 *) LocalAlloc (LPTR, dwBytesNeeded)))
  {
    ErrMsgBox (GetStringRes(IDS_LALLOCFAIL), ERR_MOD_NAME);
    bReturn = FALSE;
    goto display_prt_drv_info_done1;
  }

  if (!GetPrinterDriver (hPrinter, pEnvironment, 1, (LPBYTE) pDriverInfo1,
                         dwBytesNeeded, &dwBytesNeeded))
  {
    ErrMsgBox (GetStringRes(IDS_GETPRTDRVFAIL), ERR_MOD_NAME);
    bReturn = FALSE;
    goto display_prt_drv_info_done2;
  }

  GetPrinterDriver (hPrinter, pEnvironment, 2, NULL, 0, &dwBytesNeeded);
  pDriverInfo2 = (DRIVER_INFO_2 *) LocalAlloc (LPTR, dwBytesNeeded);
  GetPrinterDriver (hPrinter, pEnvironment, 2, (LPBYTE) pDriverInfo2,
                    dwBytesNeeded, &dwBytesNeeded);

  ClosePrinter (hPrinter);

  //
  // shove info in listbox
  //

  if ( _snprintf (buf, BUFSIZE-1, gaDrvInfo[0]) > 0 )
  outstr();

  if ( _snprintf (buf, BUFSIZE-1, gaDrvInfo[1], pDriverInfo1->pName) > 0 )
  outstr();

  if ( _snprintf (buf, BUFSIZE-1, gaDrvInfo[2]) > 0 )
  outstr();

  if ( _snprintf (buf, BUFSIZE-1, gaDrvInfo[3], pDriverInfo2->cVersion) > 0 )
  outstr();

  if ( _snprintf (buf, BUFSIZE-1, gaDrvInfo[4], pDriverInfo2->pName) > 0 )
  outstr();

  if ( _snprintf (buf, BUFSIZE-1, gaDrvInfo[5], pDriverInfo2->pEnvironment) > 0 )
  outstr();

  if ( _snprintf (buf, BUFSIZE-1, gaDrvInfo[6], pDriverInfo2->pDriverPath) > 0 )
  outstr();

  if ( _snprintf (buf, BUFSIZE-1, gaDrvInfo[7], pDriverInfo2->pDataFile) > 0 )
  outstr();

  if ( _snprintf (buf, BUFSIZE-1, gaDrvInfo[8], pDriverInfo2->pConfigFile) > 0 )
  outstr();

  LocalFree (LocalHandle (pDriverInfo2));

display_prt_drv_info_done2:

  LocalFree (LocalHandle (pDriverInfo1));

display_prt_drv_info_done1:

  return bReturn;
}

LRESULT CALLBACK GetPrinterDriverDlgProc | ( | HWND | hwnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 45 of file Getpdriv.c.

{
  switch (msg)
  {
    case WM_INITDIALOG:
    {
      BOOL bReturn;
      char buf[BUFSIZE];

    //
      // shove all the printer driver info in the list box
      //

      SetCursor (LoadCursor (NULL, IDC_WAIT));
      bReturn = DisplayPrinterDriverInfo (hwnd);
      SetCursor (LoadCursor (NULL, IDC_ARROW));

      if (!bReturn)
      {
        EndDialog (hwnd, TRUE);
      }

      //
      // set window title to reflect current device
      //

      else
      {
        if ( _snprintf (buf, BUFSIZE-1, "GetPrinterDriver: %s;%s;%s", gszDeviceName, gszPort, gszDriverName) > 0)
          SetWindowText (hwnd, (LPCSTR) buf);
      }

      break;
    }

    case WM_COMMAND:

      switch (LOWORD (wParam))
      {
        case DID_OK:

          EndDialog (hwnd, TRUE);
          return 1;
      }
      break;
  }
  return 0;
}

Generated on Wed Nov 13 2024 16:53:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/Printer/Getpdriv.h File Reference

  • Multimedia
  • Gdi
  • Printer
Defines | Functions | Variables

Getpdriv.h File Reference

Go to the source code of this file.

Defines

#define | ERR_MOD_NAME IDS_ERR_GETPDRIV
#define | outstr()

Functions

BOOL | DisplayPrinterDriverInfo (HWND)

Variables

char * | gaDrvInfo []
HWND | ghwndMain
char | gszDeviceName []
char | gszDriverName []
char | gszPort []

Define Documentation

#define ERR_MOD_NAME IDS_ERR_GETPDRIV

Definition at line 22 of file Getpdriv.h.

#define outstr ( )
Value:
SendDlgItemMessage (hwnd, DID_LISTBOX, LB_INSERTSTRING, \
                                      (WPARAM)-1, (LPARAM) buf);

Definition at line 60 of file Getpdriv.h.

Function Documentation

BOOL DisplayPrinterDriverInfo ( HWND )

Definition at line 109 of file Getpdriv.c.

{
  HANDLE        hPrinter;
  DWORD         dwBytesNeeded;
  DRIVER_INFO_1 *pDriverInfo1;
  DRIVER_INFO_2 *pDriverInfo2;
  char          buf[BUFSIZE];
  char          pEnvironment[BUFSIZE] = "";
  BOOL          bReturn = TRUE;

  //
  // open selected printer & alloc buffers & get sundry info, close printer
  //

  OpenPrinter (gszDeviceName, &hPrinter, NULL);

  if (!hPrinter)
  {
    char buf[BUFSIZE];

    _snprintf (buf, BUFSIZE-1, GetStringRes(IDS_FMT_OPNPRTFAIL), gszDeviceName);
    ErrMsgBox ((LPCSTR) buf, ERR_MOD_NAME);
    bReturn  = FALSE;
    goto display_prt_drv_info_done1;
  }

  GetPrinterDriver (hPrinter, pEnvironment, 1, NULL, 0, &dwBytesNeeded);

  //
  // simple error checking, if these work assume rest will too
  //

  if (!(pDriverInfo1 = (DRIVER_INFO_1 *) LocalAlloc (LPTR, dwBytesNeeded)))
  {
    ErrMsgBox (GetStringRes(IDS_LALLOCFAIL), ERR_MOD_NAME);
    bReturn = FALSE;
    goto display_prt_drv_info_done1;
  }

  if (!GetPrinterDriver (hPrinter, pEnvironment, 1, (LPBYTE) pDriverInfo1,
                         dwBytesNeeded, &dwBytesNeeded))
  {
    ErrMsgBox (GetStringRes(IDS_GETPRTDRVFAIL), ERR_MOD_NAME);
    bReturn = FALSE;
    goto display_prt_drv_info_done2;
  }

  GetPrinterDriver (hPrinter, pEnvironment, 2, NULL, 0, &dwBytesNeeded);
  pDriverInfo2 = (DRIVER_INFO_2 *) LocalAlloc (LPTR, dwBytesNeeded);
  GetPrinterDriver (hPrinter, pEnvironment, 2, (LPBYTE) pDriverInfo2,
                    dwBytesNeeded, &dwBytesNeeded);

  ClosePrinter (hPrinter);

  //
  // shove info in listbox
  //

  if ( _snprintf (buf, BUFSIZE-1, gaDrvInfo[0]) > 0 )
  outstr();

  if ( _snprintf (buf, BUFSIZE-1, gaDrvInfo[1], pDriverInfo1->pName) > 0 )
  outstr();

  if ( _snprintf (buf, BUFSIZE-1, gaDrvInfo[2]) > 0 )
  outstr();

  if ( _snprintf (buf, BUFSIZE-1, gaDrvInfo[3], pDriverInfo2->cVersion) > 0 )
  outstr();

  if ( _snprintf (buf, BUFSIZE-1, gaDrvInfo[4], pDriverInfo2->pName) > 0 )
  outstr();

  if ( _snprintf (buf, BUFSIZE-1, gaDrvInfo[5], pDriverInfo2->pEnvironment) > 0 )
  outstr();

  if ( _snprintf (buf, BUFSIZE-1, gaDrvInfo[6], pDriverInfo2->pDriverPath) > 0 )
  outstr();

  if ( _snprintf (buf, BUFSIZE-1, gaDrvInfo[7], pDriverInfo2->pDataFile) > 0 )
  outstr();

  if ( _snprintf (buf, BUFSIZE-1, gaDrvInfo[8], pDriverInfo2->pConfigFile) > 0 )
  outstr();

  LocalFree (LocalHandle (pDriverInfo2));

display_prt_drv_info_done2:

  LocalFree (LocalHandle (pDriverInfo1));

display_prt_drv_info_done1:

  return bReturn;
}

Variable Documentation

char* gaDrvInfo[]
Initial value:

    {   "DRIVER_INFO_1",
        "  pName\t\t%s",

        "DRIVER_INFO_2",
        "  cVersion\t%ld",
        "  pName\t\t%s",
        "  pEnvironment\t%s",
        "  pDriverPath\t%s",
        "  pDataFile\t%s",
        "  pConfigFile\t%s" }

Definition at line 30 of file Getpdriv.h.

HWND ghwndMain

Definition at line 447 of file MfEdit.h.

char gszDeviceName[]

Definition at line 86 of file Printer.h.

char gszDriverName[]

Definition at line 88 of file Printer.h.

char gszPort[]

Definition at line 87 of file Printer.h.

Generated on Wed Nov 13 2024 16:53:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/Printer/Paint.c File Reference

  • Multimedia
  • Gdi
  • Printer
Functions

Paint.c File Reference

#include <windows.h>
#include <string.h>
#include "common.h"
#include "paint.h"
#include "resource.h"

Go to the source code of this file.

Functions

PARFONTS | BuildFontList (HDC hdcIn)
void | DrawFonts (HDC hdc, LPRECT lpRect)
void | FreeFontList (PARFONTS paf)
void | GetFirstGraphicSlot (LPRECT lpRect, PRECTI pri)
void | GetNextGraphicSlot (PRECTI pri)
int CALLBACK | MyEnumCopy (LPLOGFONT lpLogFont, LPTEXTMETRIC lpTEXTMETRICs, DWORD fFontType, LPVOID lpData)
int CALLBACK | MyEnumCount (LPLOGFONT lpLogFont, LPTEXTMETRIC lpTEXTMETRICs, DWORD fFontType, LPVOID lpData)
int CALLBACK | MyEnumFaces (LPLOGFONT lpLogFont, LPTEXTMETRIC lpTEXTMETRICs, DWORD fFontType, LPVOID lpData)
BOOL | Paint (HDC hdc, LPRECT lpRect)

Function Documentation

PARFONTS BuildFontList ( HDC hdcIn )

Definition at line 538 of file Paint.c.

{
  nFaces = 0;

  hdcGlobal = hdcIn;

  //
  // count the total number of face names.
  //

  EnumFonts (hdcGlobal, NULL, (FONTENUMPROC)MyEnumCount, (LPARAM)&nFaces);

  //
  // allocate the pointer to the array of PArFont structures.
  //

  parFontsGlobal = (PARFONTS) LocalAlloc (LPTR, sizeof(ARFONTS) * (nFaces+1));

  //
  // step through all fonts again.  For each one fill a LOGFONT and
  //   a TEXTMETRIC stucture.
  //

  iFace = 0;
  EnumFonts (hdcGlobal, NULL, (FONTENUMPROC)MyEnumFaces, 0);

  return parFontsGlobal;
}

void DrawFonts | ( | HDC | hdc,
 |  | LPRECT | lpRect
 | ) |  |

Definition at line 365 of file Paint.c.

{
  int      i, j, xText, yText, iMaxStrLen = 0;
  PARFONTS paf;

  paf = BuildFontList (hdc);

  xText = yText = 2;

  //
  // set the appropriate text align mode depending on
  //   whether we're drawing from top down or bottom up
  //

  if ((giMapMode == MM_TEXT) || (giMapMode == MM_ANISOTROPIC))

    SetTextAlign (hdc, TA_TOP);

  else

    SetTextAlign (hdc, TA_BOTTOM);

  for (i = 0; i < nFaces; i++)
  {
    for (j = 0; j < (paf + i)->nFonts; j++)
    {
      HFONT      hFont, hSaveFont;
      SIZE       size;
      POINT      LogPtExtent;

      LogPtExtent.x = lpRect->right;
      LogPtExtent.y = lpRect->bottom;

      hFont = CreateFontIndirect ((paf + i)->lf + j);

      hSaveFont = SelectObject (hdc, hFont);

      TextOut (hdc, xText, yText, ((paf + i)->lf + j)->lfFaceName,
               (int) (strlen(((paf + i)->lf + j)->lfFaceName)));

      GetTextExtentPoint (hdc, ((paf + i)->lf + j)->lfFaceName,
                          (int) (strlen(((paf+i)->lf+j)->lfFaceName)),
                          &size);
      size.cx += 2;
      iMaxStrLen = iMaxStrLen > (int)size.cx ? iMaxStrLen: (int) size.cx;

      if (!(i == (nFaces - 1) && j == ((paf + i)->nFonts - 1)))
      {
        TEXTMETRIC *pNextTM;

        pNextTM = j < ((paf+i)->nFonts-1) ?
                          (paf+i)->tm+j+1 : (paf+i+1)->tm;

        //
        // add in the height of the face name we just drew
        //

        yText += (int) ((paf + i)->tm + j)->tmHeight;

        //
        // if the next facename will be drawn outside the bounding rect then
        //   start at first line of next column
        //

        if (yText + (int) pNextTM->tmHeight > (int) LogPtExtent.y)
        {
          yText = 2;
          xText += iMaxStrLen + 2;
          iMaxStrLen = 0;
        }
      }

      SelectObject (hdc, hSaveFont);
      DeleteObject (hFont);

      if (xText > (int) LogPtExtent.x)
      {
        if (GetDeviceCaps (hdc, TECHNOLOGY) & DT_RASDISPLAY)
        {
          //
          // If we're drawing to the screen & have run out of
          //   room then tell user how many fonts there are left
          //   (that we haven't displayed)
          //

          int   k;
          int   iFontsLeft = (paf + i)->nFonts - j - 1;
          char  buf[40];
          SIZE  size;

          for (k = i + 1; k < nFaces; k++)

            iFontsLeft += (paf + k)->nFonts;

          wsprintf (buf, GetStringRes(IDS_FMT_MOREDSPFNTNL),
                    iFontsLeft);

          GetTextExtentPoint (hdc, buf, (int) strlen(buf), &size);

          if ((xText = lpRect->right - size.cx) < glcyMenu + 1)

            xText = glcyMenu/2 + 1;

          TextOut (hdc, xText, lpRect->bottom, buf, (int) strlen(buf));

          goto done_enumfonts;
        }

        else
        {
          //
          // Else we're drawing to a printer & have filled up
          //   the first page. If there's any fonts left to draw
          //   then start a new page.
          //

          if (!(i == nFaces - 1 && j == (paf + i)->nFonts - 1))
          {
            EndPage   (hdc);
            xText = yText = 2;
            StartPage (hdc);
          }
        }
      }
    }
  }

done_enumfonts:

  FreeFontList (paf);
}

void FreeFontList ( PARFONTS paf )

Definition at line 670 of file Paint.c.

{
  int i;

  for (i = 0; i < nFaces; i++)
  {
    LocalFree (LocalHandle ((LPSTR) ((paf + i)->lf  )));
    LocalFree (LocalHandle ((LPSTR) ((paf + i)->tm  )));
    LocalFree (LocalHandle ((LPSTR) ((paf + i)->Type)));
  }
  LocalFree (LocalHandle ((LPSTR) paf));
}

void GetFirstGraphicSlot | ( | LPRECT | lpRect,
 |  | PRECTI | pri
 | ) |  |

Definition at line 311 of file Paint.c.

{
  pri->left   = BORDER;
  pri->top    = lpRect->top + BORDER;
  pri->right  = giDeltaX;
  pri->bottom = giDeltaY;

  giColumn = 1;
}

void GetNextGraphicSlot ( PRECTI pri )

Definition at line 331 of file Paint.c.

{
  if (++giColumn <= NUM_GRAPHICS_XSLOTS)
  {
    pri->left  += giDeltaX;
    pri->right += giDeltaX;
  }
  else
  {
    giColumn = 1;

    pri->left   =  BORDER;
    pri->top    += giDeltaY;
    pri->right  =  giDeltaX;
    pri->bottom += giDeltaY;
  }
}

int CALLBACK MyEnumCopy | ( | LPLOGFONT | lpLogFont,
 |  | LPTEXTMETRIC | lpTEXTMETRICs,
 |  | DWORD | fFontType,
 |  | LPVOID | lpData
 | ) |  |

Definition at line 624 of file Paint.c.

{
  LOGFONT    *lplf;
  TEXTMETRIC *lptm;
  int        *pType;

  lplf  = parFontsGlobal[iFace].lf;
  lptm  = parFontsGlobal[iFace].tm;
  pType = parFontsGlobal[iFace].Type;

  lplf[jFont]  = *lpLogFont;
  lptm[jFont]  = *lpTEXTMETRICs;
  pType[jFont] = fFontType;

  jFont++;
  return TRUE;
}

int CALLBACK MyEnumCount | ( | LPLOGFONT | lpLogFont,
 |  | LPTEXTMETRIC | lpTEXTMETRICs,
 |  | DWORD | fFontType,
 |  | LPVOID | lpData
 | ) |  |

Definition at line 653 of file Paint.c.

{
  (*(LPINT)lpData)++;
  return TRUE;
}

int CALLBACK MyEnumFaces | ( | LPLOGFONT | lpLogFont,
 |  | LPTEXTMETRIC | lpTEXTMETRICs,
 |  | DWORD | fFontType,
 |  | LPVOID | lpData
 | ) |  |

Definition at line 577 of file Paint.c.

{
  int nFonts;

  nFonts = 0;
  EnumFonts (hdcGlobal, lpLogFont->lfFaceName, (FONTENUMPROC)MyEnumCount,
             (LPARAM)&nFonts);

  parFontsGlobal[iFace].lf   = (LOGFONT *)    LocalAlloc (LPTR,
                                                          sizeof(LOGFONT) *
                                                            nFonts);
  parFontsGlobal[iFace].tm   = (TEXTMETRIC *) LocalAlloc (LPTR,
                                                          sizeof(TEXTMETRIC) *
                                                            nFonts);
  parFontsGlobal[iFace].Type = (int *)        LocalAlloc (LPTR,
                                                          sizeof(int) *
                                                            nFonts);

  if ((parFontsGlobal[iFace].lf   == NULL) ||
      (parFontsGlobal[iFace].tm   == NULL) ||
      (parFontsGlobal[iFace].Type == NULL))
  {
    ErrMsgBox (GetStringRes(IDS_LALLOCFAIL), ERR_MOD_NAME);
    return FALSE;
  }

  parFontsGlobal[iFace].nFonts = nFonts;

  jFont = 0;
  EnumFonts (hdcGlobal, lpLogFont->lfFaceName, (FONTENUMPROC)MyEnumCopy, 0);

  iFace++;

  return TRUE;
}

BOOL Paint | ( | HDC | hdc,
 |  | LPRECT | lpRect
 | ) |  |

Definition at line 61 of file Paint.c.

{
  RECT  rect;
  HPEN  hpenSave;
  RECTI ri;

  if (gdwGraphicsOptions & DRAWAXIS)
  {
    //
    // draw axis
    //

    rect = *lpRect;

    hpenSave = SelectObject (hdc, GetStockObject (BLACK_PEN));

    //
    // if giMapMode == MM_TEXT, MM_ANISOTROPIC then (0,0) is upper left corner
    //

    if (giMapMode == MM_TEXT || giMapMode == MM_ANISOTROPIC)
    {
      MoveToEx (hdc, rect.left - glcyMenu/2, rect.bottom, NULL);
      LineTo   (hdc, rect.left,  rect.bottom + glcyMenu/2);
      LineTo   (hdc, rect.left + glcyMenu/2,  rect.bottom);

      MoveToEx (hdc, rect.left,  rect.bottom + glcyMenu/2, NULL);
      LineTo   (hdc, rect.left,  rect.top);
      LineTo   (hdc, rect.right + glcyMenu/2, rect.top);

      MoveToEx (hdc, rect.right, rect.top - glcyMenu/2, NULL);
      LineTo   (hdc, rect.right + glcyMenu/2,  rect.top);
      LineTo   (hdc, rect.right,  rect.top + glcyMenu/2);
    }

    //
    // else (0,0) is lower left corner
    //

    else
    {
      MoveToEx (hdc, rect.left - glcyMenu/2, rect.bottom, NULL);
      LineTo   (hdc, rect.left,  rect.bottom + glcyMenu/2);
      LineTo   (hdc, rect.left + glcyMenu/2,  rect.bottom);

      MoveToEx (hdc, rect.left,  rect.bottom + glcyMenu/2, NULL);
      LineTo   (hdc, rect.left,  rect.top);
      LineTo   (hdc, rect.right + glcyMenu/2, rect.top);

      MoveToEx (hdc, rect.right, rect.top + glcyMenu/2, NULL);
      LineTo   (hdc, rect.right + glcyMenu/2, rect.top);
      LineTo   (hdc, rect.right, rect.top - glcyMenu/2);
    }

    SelectObject (hdc, hpenSave);
  }

  //
  // look at bits in gdwGraphicsOptions & determine which graphics to draw
  //

  if (gdwGraphicsOptions & ENUMFONTS)
  {
    DrawFonts (hdc, lpRect);
    return TRUE;
  }

  giDeltaX = (int) ((lpRect->right - BORDER) / NUM_GRAPHICS_XSLOTS);
  giDeltaY = (int) ((lpRect->bottom - lpRect->top - BORDER)
    / NUM_GRAPHICS_YSLOTS);

  GetFirstGraphicSlot (lpRect, &ri);

  if (gdwGraphicsOptions & ARC)
  {
    Arc (hdc, ri.left, ri.top, ri.right, ri.bottom,
      ri.left, ri.top, ri.right-10, ri.bottom-10);
    GetNextGraphicSlot (&ri);
  }

  if (gdwGraphicsOptions & ELLIPSE)
  {
    Ellipse (hdc, ri.left, ri.top, ri.right, ri.bottom);
    GetNextGraphicSlot (&ri);
  }

  if (gdwGraphicsOptions & LINETO)
  {
    int i;

    for (i = PS_SOLID; i <= PS_DASHDOTDOT; i++)
    {
      MoveToEx (hdc, ri.left, ri.top + (i+1)*giDeltaY/7, NULL);
      LineTo   (hdc, ri.right, ri.top + (i+1)*giDeltaY/7);
    }
    GetNextGraphicSlot (&ri);
  }

  if (gdwGraphicsOptions & PIE)
  {
    Pie (hdc, ri.left, ri.top, ri.right, ri.bottom,
      ri.left, ri.top, ri.right-10, ri.bottom-10);
    GetNextGraphicSlot (&ri);
  }

  if (gdwGraphicsOptions & PLG_BLT)
  {
    HBITMAP hbm;
    BITMAP  bm;
    HDC     hdcMem;
    POINT   ap[3];

    hbm = LoadBitmap (ghInst, "printer");
    hdcMem = CreateCompatibleDC (hdc);
    SelectObject (hdcMem, hbm);

    GetObject (hbm, sizeof(BITMAP), (LPSTR)&bm);

    //
    // special case here because PlgBlt requires coordinates
    //   of upper left, upper right, & lower left
    //

    ap[0].x = (LONG) (ri.left + (ri.right - ri.left)/4);
    ap[0].y = (LONG) (ri.top + (ri.bottom - ri.top)/4);
    ap[1].x = (LONG) ri.right;
    ap[1].y = (LONG) ri.top;
    ap[2].x = (LONG) ri.left;
    ap[2].y = (LONG) ri.bottom;

    PlgBlt (hdc, ap, hdcMem, 0, 0, bm.bmWidth, bm.bmHeight, NULL, 0, 0);

    DeleteDC(hdcMem);
    DeleteObject(hbm);
    GetNextGraphicSlot (&ri);

  }

  if (gdwGraphicsOptions & POLYBEZIER)
  {
    POINT ap[4];

    ap[0].x  = (LONG) ri.left;    ap[0].y = (LONG) ri.top;
    ap[1].x  = (LONG) ri.left;    ap[1].y = (LONG) ri.bottom;
    ap[2].x  = (LONG) ri.right;   ap[2].y = (LONG) ri.top;
    ap[3].x  = (LONG) ri.right;   ap[3].y = (LONG) ri.bottom;

    PolyBezier (hdc, ap, 4);
    GetNextGraphicSlot (&ri);
  }

  if (gdwGraphicsOptions & POLYGON)
  {
    POINT ap[5];

    ap[0].x  = (LONG) ri.left;    ap[0].y = (LONG) ri.top;
    ap[1].x  = (LONG) ri.right;   ap[1].y = (LONG) ri.bottom;
    ap[2].x  = (LONG) ri.right;   ap[2].y = (LONG) ri.top;
    ap[3].x  = (LONG) ri.left;    ap[3].y = (LONG) ri.bottom;
    ap[4].x  = (LONG) ri.left;    ap[4].y = (LONG) ri.top;

    Polygon (hdc, ap, 4);
    GetNextGraphicSlot (&ri);
  }

  if (gdwGraphicsOptions & POLYLINE)
  {
    POINT ap[4];

    ap[0].x  = (LONG) ri.left;    ap[0].y = (LONG) ri.top;
    ap[1].x  = (LONG) ri.left;    ap[1].y = (LONG) ri.bottom;
    ap[2].x  = (LONG) ri.right;   ap[2].y = (LONG) ri.top;
    ap[3].x  = (LONG) ri.right;   ap[3].y = (LONG) ri.bottom;

    Polyline (hdc, ap, 4);
    GetNextGraphicSlot (&ri);
  }

  if (gdwGraphicsOptions & POLYPOLYGON)
  {
    POINT ap[8];
    int ai[2] = { 4, 4 };

    ap[0].x = (LONG)  ri.left;
    ap[0].y = (LONG)  ri.top;
    ap[1].x = (LONG) (ri.left + giDeltaX/4);
    ap[1].y = (LONG)  ri.top;
    ap[2].x = (LONG) (ri.left + giDeltaX/4);
    ap[2].y = (LONG) (ri.top  + giDeltaY/4);
    ap[3].x = (LONG)  ri.left;
    ap[3].y = (LONG) (ri.top  + giDeltaY/4);
    ap[4].x = (LONG) (ri.right  - 2*giDeltaX/3);
    ap[4].y = (LONG) (ri.bottom - 2*giDeltaY/3);
    ap[5].x = (LONG)  ri.right;
    ap[5].y = (LONG) (ri.bottom - 2*giDeltaY/3);
    ap[6].x = (LONG)  ri.right;
    ap[6].y = (LONG)  ri.bottom;
    ap[7].x = (LONG) (ri.right  - 2*giDeltaX/3);
    ap[7].y = (LONG)  ri.bottom;

    PolyPolygon (hdc, ap, ai, 2);
    GetNextGraphicSlot (&ri);
  }

  if (gdwGraphicsOptions & RECTANGLE)
  {
    Rectangle (hdc, ri.left, ri.top, ri.right, ri.bottom);
    GetNextGraphicSlot (&ri);
  }

  if (gdwGraphicsOptions & ROUNDRECT)
  {
    RoundRect (hdc, ri.left, ri.top, ri.right, ri.bottom, 15, 25);
    GetNextGraphicSlot (&ri);
  }

  if (gdwGraphicsOptions & STRETCH_BLT)
  {
    HBITMAP hbm;
    BITMAP  bm;
    HDC     hdcMem;

    hbm = LoadBitmap (ghInst, "printer");
    hdcMem = CreateCompatibleDC (hdc);
    SelectObject (hdcMem, hbm);

    GetObject (hbm, sizeof(BITMAP), (LPSTR)&bm);

    StretchBlt (hdc, ri.left, ri.top, ri.right-ri.left,
      ri.bottom - ri.top, hdcMem, 0, 0,
      bm.bmWidth, bm.bmHeight, SRCCOPY);

    DeleteDC(hdcMem);
    DeleteObject(hbm);
    GetNextGraphicSlot (&ri);
  }

  return TRUE;
}

Generated on Wed Nov 13 2024 16:53:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/Printer/Paint.h File Reference

  • Multimedia
  • Gdi
  • Printer
Classes | Defines | Typedefs | Functions | Variables

Paint.h File Reference

Go to the source code of this file.

Classes

struct | RECTI
struct | tagArFonts

Defines

#define | BORDER 5
#define | ERR_MOD_NAME IDS_ERR_PAINT
#define | NUM_GRAPHICS_XSLOTS 4
#define | NUM_GRAPHICS_YSLOTS 3

Typedefs

typedef struct tagArFonts | ARFONTS
typedef struct tagArFonts * | PARFONTS
typedef struct RECTI * | PRECTI

Functions

PARFONTS | BuildFontList (HDC)
void | DrawFonts (HDC, LPRECT)
void | FreeFontList (PARFONTS)
void | GetFirstGraphicSlot (LPRECT, PRECTI)
void | GetNextGraphicSlot (PRECTI)
int CALLBACK | MyEnumCopy (LPLOGFONT, LPTEXTMETRIC, DWORD, LPVOID)
int CALLBACK | MyEnumCount (LPLOGFONT, LPTEXTMETRIC, DWORD, LPVOID)
int CALLBACK | MyEnumFaces (LPLOGFONT, LPTEXTMETRIC, DWORD, LPVOID)

Variables

DWORD gdwGraphicsOptions
HANDLE ghInst
HWND | ghwndMain
int | giColumn
int | giDeltaX
int | giDeltaY
int | giMapMode
LONG | glcyMenu
HDC | hdcGlobal
int | iFace
int | jFont
int | nFaces
PARFONTS parFontsGlobal

Define Documentation

#define BORDER 5

Definition at line 22 of file Paint.h.

#define ERR_MOD_NAME IDS_ERR_PAINT

Definition at line 27 of file Paint.h.

#define NUM_GRAPHICS_XSLOTS 4

Definition at line 24 of file Paint.h.

#define NUM_GRAPHICS_YSLOTS 3

Definition at line 25 of file Paint.h.

Typedef Documentation

typedef struct tagArFonts ARFONTS
typedef struct tagArFonts * PARFONTS
typedef struct RECTI * PRECTI

Function Documentation

PARFONTS BuildFontList ( HDC )

Definition at line 538 of file Paint.c.

{
  nFaces = 0;

  hdcGlobal = hdcIn;

  //
  // count the total number of face names.
  //

  EnumFonts (hdcGlobal, NULL, (FONTENUMPROC)MyEnumCount, (LPARAM)&nFaces);

  //
  // allocate the pointer to the array of PArFont structures.
  //

  parFontsGlobal = (PARFONTS) LocalAlloc (LPTR, sizeof(ARFONTS) * (nFaces+1));

  //
  // step through all fonts again.  For each one fill a LOGFONT and
  //   a TEXTMETRIC stucture.
  //

  iFace = 0;
  EnumFonts (hdcGlobal, NULL, (FONTENUMPROC)MyEnumFaces, 0);

  return parFontsGlobal;
}

void DrawFonts | ( | HDC | ,
 |  | LPRECT |
 | ) |  |

Definition at line 365 of file Paint.c.

{
  int      i, j, xText, yText, iMaxStrLen = 0;
  PARFONTS paf;

  paf = BuildFontList (hdc);

  xText = yText = 2;

  //
  // set the appropriate text align mode depending on
  //   whether we're drawing from top down or bottom up
  //

  if ((giMapMode == MM_TEXT) || (giMapMode == MM_ANISOTROPIC))

    SetTextAlign (hdc, TA_TOP);

  else

    SetTextAlign (hdc, TA_BOTTOM);

  for (i = 0; i < nFaces; i++)
  {
    for (j = 0; j < (paf + i)->nFonts; j++)
    {
      HFONT      hFont, hSaveFont;
      SIZE       size;
      POINT      LogPtExtent;

      LogPtExtent.x = lpRect->right;
      LogPtExtent.y = lpRect->bottom;

      hFont = CreateFontIndirect ((paf + i)->lf + j);

      hSaveFont = SelectObject (hdc, hFont);

      TextOut (hdc, xText, yText, ((paf + i)->lf + j)->lfFaceName,
               (int) (strlen(((paf + i)->lf + j)->lfFaceName)));

      GetTextExtentPoint (hdc, ((paf + i)->lf + j)->lfFaceName,
                          (int) (strlen(((paf+i)->lf+j)->lfFaceName)),
                          &size);
      size.cx += 2;
      iMaxStrLen = iMaxStrLen > (int)size.cx ? iMaxStrLen: (int) size.cx;

      if (!(i == (nFaces - 1) && j == ((paf + i)->nFonts - 1)))
      {
        TEXTMETRIC *pNextTM;

        pNextTM = j < ((paf+i)->nFonts-1) ?
                          (paf+i)->tm+j+1 : (paf+i+1)->tm;

        //
        // add in the height of the face name we just drew
        //

        yText += (int) ((paf + i)->tm + j)->tmHeight;

        //
        // if the next facename will be drawn outside the bounding rect then
        //   start at first line of next column
        //

        if (yText + (int) pNextTM->tmHeight > (int) LogPtExtent.y)
        {
          yText = 2;
          xText += iMaxStrLen + 2;
          iMaxStrLen = 0;
        }
      }

      SelectObject (hdc, hSaveFont);
      DeleteObject (hFont);

      if (xText > (int) LogPtExtent.x)
      {
        if (GetDeviceCaps (hdc, TECHNOLOGY) & DT_RASDISPLAY)
        {
          //
          // If we're drawing to the screen & have run out of
          //   room then tell user how many fonts there are left
          //   (that we haven't displayed)
          //

          int   k;
          int   iFontsLeft = (paf + i)->nFonts - j - 1;
          char  buf[40];
          SIZE  size;

          for (k = i + 1; k < nFaces; k++)

            iFontsLeft += (paf + k)->nFonts;

          wsprintf (buf, GetStringRes(IDS_FMT_MOREDSPFNTNL),
                    iFontsLeft);

          GetTextExtentPoint (hdc, buf, (int) strlen(buf), &size);

          if ((xText = lpRect->right - size.cx) < glcyMenu + 1)

            xText = glcyMenu/2 + 1;

          TextOut (hdc, xText, lpRect->bottom, buf, (int) strlen(buf));

          goto done_enumfonts;
        }

        else
        {
          //
          // Else we're drawing to a printer & have filled up
          //   the first page. If there's any fonts left to draw
          //   then start a new page.
          //

          if (!(i == nFaces - 1 && j == (paf + i)->nFonts - 1))
          {
            EndPage   (hdc);
            xText = yText = 2;
            StartPage (hdc);
          }
        }
      }
    }
  }

done_enumfonts:

  FreeFontList (paf);
}

void FreeFontList ( PARFONTS )

Definition at line 670 of file Paint.c.

{
  int i;

  for (i = 0; i < nFaces; i++)
  {
    LocalFree (LocalHandle ((LPSTR) ((paf + i)->lf  )));
    LocalFree (LocalHandle ((LPSTR) ((paf + i)->tm  )));
    LocalFree (LocalHandle ((LPSTR) ((paf + i)->Type)));
  }
  LocalFree (LocalHandle ((LPSTR) paf));
}

void GetFirstGraphicSlot | ( | LPRECT | ,
 |  | PRECTI |
 | ) |  |

Definition at line 311 of file Paint.c.

{
  pri->left   = BORDER;
  pri->top    = lpRect->top + BORDER;
  pri->right  = giDeltaX;
  pri->bottom = giDeltaY;

  giColumn = 1;
}

void GetNextGraphicSlot ( PRECTI )

Definition at line 331 of file Paint.c.

{
  if (++giColumn <= NUM_GRAPHICS_XSLOTS)
  {
    pri->left  += giDeltaX;
    pri->right += giDeltaX;
  }
  else
  {
    giColumn = 1;

    pri->left   =  BORDER;
    pri->top    += giDeltaY;
    pri->right  =  giDeltaX;
    pri->bottom += giDeltaY;
  }
}

int CALLBACK MyEnumCopy | ( | LPLOGFONT | ,
 |  | LPTEXTMETRIC | ,
 |  | DWORD | ,
 |  | LPVOID |
 | ) |  |

Definition at line 624 of file Paint.c.

{
  LOGFONT    *lplf;
  TEXTMETRIC *lptm;
  int        *pType;

  lplf  = parFontsGlobal[iFace].lf;
  lptm  = parFontsGlobal[iFace].tm;
  pType = parFontsGlobal[iFace].Type;

  lplf[jFont]  = *lpLogFont;
  lptm[jFont]  = *lpTEXTMETRICs;
  pType[jFont] = fFontType;

  jFont++;
  return TRUE;
}

int CALLBACK MyEnumCount | ( | LPLOGFONT | ,
 |  | LPTEXTMETRIC | ,
 |  | DWORD | ,
 |  | LPVOID |
 | ) |  |

Definition at line 653 of file Paint.c.

{
  (*(LPINT)lpData)++;
  return TRUE;
}

int CALLBACK MyEnumFaces | ( | LPLOGFONT | ,
 |  | LPTEXTMETRIC | ,
 |  | DWORD | ,
 |  | LPVOID |
 | ) |  |

Definition at line 577 of file Paint.c.

{
  int nFonts;

  nFonts = 0;
  EnumFonts (hdcGlobal, lpLogFont->lfFaceName, (FONTENUMPROC)MyEnumCount,
             (LPARAM)&nFonts);

  parFontsGlobal[iFace].lf   = (LOGFONT *)    LocalAlloc (LPTR,
                                                          sizeof(LOGFONT) *
                                                            nFonts);
  parFontsGlobal[iFace].tm   = (TEXTMETRIC *) LocalAlloc (LPTR,
                                                          sizeof(TEXTMETRIC) *
                                                            nFonts);
  parFontsGlobal[iFace].Type = (int *)        LocalAlloc (LPTR,
                                                          sizeof(int) *
                                                            nFonts);

  if ((parFontsGlobal[iFace].lf   == NULL) ||
      (parFontsGlobal[iFace].tm   == NULL) ||
      (parFontsGlobal[iFace].Type == NULL))
  {
    ErrMsgBox (GetStringRes(IDS_LALLOCFAIL), ERR_MOD_NAME);
    return FALSE;
  }

  parFontsGlobal[iFace].nFonts = nFonts;

  jFont = 0;
  EnumFonts (hdcGlobal, lpLogFont->lfFaceName, (FONTENUMPROC)MyEnumCopy, 0);

  iFace++;

  return TRUE;
}

Variable Documentation

DWORD gdwGraphicsOptions

Definition at line 81 of file Printer.h.

HANDLE ghInst

Definition at line 24 of file ole2ui.c.

HWND ghwndMain

Definition at line 447 of file MfEdit.h.

int giColumn

Definition at line 68 of file Paint.h.

int giDeltaX

Definition at line 66 of file Paint.h.

int giDeltaY

Definition at line 67 of file Paint.h.

int giMapMode

Definition at line 82 of file Printer.h.

LONG glcyMenu

Definition at line 80 of file Printer.h.

HDC hdcGlobal

Definition at line 61 of file Paint.h.

int iFace

Definition at line 63 of file Paint.h.

int jFont

Definition at line 63 of file Paint.h.

int nFaces

Definition at line 64 of file Paint.h.

PARFONTS parFontsGlobal

Definition at line 62 of file Paint.h.

Generated on Wed Nov 13 2024 16:53:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/Printer/Printer.c File Reference

  • Multimedia
  • Gdi
  • Printer
Defines | Functions

Printer.c File Reference

#include <windows.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <winspool.h>
#include <commdlg.h>
#include "common.h"
#include "resource.h"
#include "printer.h"

Go to the source code of this file.

Defines

#define | ASTRING "long printer name;long port name;long driver name"
#define | My_mbslen _mbstrlen

Functions

LRESULT CALLBACK | AbortDlgProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
BOOL CALLBACK | AbortProc (HDC hdc, int error)
LRESULT CALLBACK | AboutDlgProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
LPTSTR | GetStringRes (int id)
LPTSTR | GetStringRes2 (int id)
void | InvalidateClient ()
LRESULT CALLBACK | MainWndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
void | PrintThread (LPVOID wParam)
void | RefreshPrinterCombobox (HWND hwndCombobox)
int WINAPI | WinMain (HINSTANCE ghInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

Define Documentation

#define ASTRING "long printer name;long port name;long driver name"
#define My_mbslen _mbstrlen

Definition at line 69 of file Printer.c.

Function Documentation

LRESULT CALLBACK AbortDlgProc | ( | HWND | hwnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 1140 of file Printer.c.

{
  switch (msg) {
    case WM_INITDIALOG:
    EnableMenuItem (GetSystemMenu (hwnd, FALSE), SC_CLOSE, MF_GRAYED);
    return TRUE;

    case WM_COMMAND:   // There's only one
    switch (LOWORD (wParam)) {
    case DID_CANCEL:
      MessageBeep(MB_OK);
      gbAbort = TRUE;
      AbortDoc (ghdc);
      DestroyWindow (hwnd);
      break;
    }
    break;
  }
  return 0;
}

BOOL CALLBACK AbortProc | ( | HDC | hdc,
 |  | int | error
 | ) |  |

Definition at line 1114 of file Printer.c.

{
  MSG msg;

  while (!gbAbort && PeekMessage (&msg, NULL, 0, 0, PM_REMOVE)) {

    if (!IsDialogMessage (ghwndAbort, &msg)) {
      TranslateMessage (&msg);
      DispatchMessage (&msg);
    }

  }

  return !gbAbort;
}

LRESULT CALLBACK AboutDlgProc | ( | HWND | hwnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 831 of file Printer.c.

{
  switch (msg)
  {
    case WM_INITDIALOG:

      return TRUE;

    case WM_COMMAND:

      switch (LOWORD (wParam))
      {
        case IDOK:

          EndDialog (hwnd, TRUE);

          return 1;
      }
      break;
  }
  return 0;
}

LPTSTR GetStringRes ( int id )

Definition at line 1171 of file Printer.c.

{
  static TCHAR buffer[MAX_PATH];

  buffer[0]=0;
  LoadString (GetModuleHandle (NULL), id, buffer, MAX_PATH);
  return buffer;
}

LPTSTR GetStringRes2 ( int id )

Definition at line 1180 of file Printer.c.

{
  static TCHAR buffer[MAX_PATH];

  buffer[0]=0;
  LoadString (GetModuleHandle (NULL), id, buffer, MAX_PATH);
  return buffer;
}

void InvalidateClient ( void )

Definition at line 865 of file Printer.c.

{
  RECT rect;

  GetClientRect (ghwndMain, &rect);

  rect.top += 2*glcyMenu;

  InvalidateRect (ghwndMain, &rect, TRUE);
}

LRESULT CALLBACK MainWndProc | ( | HWND | hwnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 139 of file Printer.c.

{
  static HMENU hMappingModesSubMenu;
  static HMENU hGraphicsSubMenu;
  static HMENU hPenWidthSubMenu;
  static HMENU hPenStyleSubMenu;
  static HMENU hBrushStyleSubMenu;
  static HWND  hwndCombobox;
  static int   iComboboxWidth;
  static LONG  lTextHeight;

  int i;

  switch (msg)
  {
    case WM_COMMAND:

      switch (LOWORD (wParam))
      {
        case IDM_PRINT:
        case IDM_PRINTDLG:
        {
          DWORD  threadId;
      HANDLE hThread;

          if (!(hThread = CreateThread (NULL, 0,
                       (LPTHREAD_START_ROUTINE) PrintThread,
                             (LPVOID) wParam, 0, &threadId)))
            MessageBox (hwnd,
                        "MainWndProc(): Error creating print thread",
                        GetStringRes2(ERR_MOD_NAME), MB_OK | MB_ICONHAND);
      else
        CloseHandle(hThread);
          break;
        }

        case IDM_GETDEVICECAPS:

          DialogBox (ghInst, (LPCTSTR) "List", hwnd,
                     (DLGPROC) GetDeviceCapsDlgProc);
          break;

        case IDM_ENUMPRINTERS:

          DialogBox (ghInst, (LPCTSTR) "List", hwnd,
                     (DLGPROC) EnumPrintersDlgProc);
          break;

        case IDM_GETPRINTERDRIVER:

          if (strcmp (gszDeviceName, "Display"))

            DialogBox (ghInst, (LPCTSTR) "List", hwnd,
                       (DLGPROC) GetPrinterDriverDlgProc);
          else

            MessageBox (hwnd, (LPCTSTR) GetStringRes(IDS_ASKSELPRT),
                        (LPCTSTR) "PRINTER.EXE:", MB_OK);

          break;

        case IDM_ENUMPRINTERDRIVERS:

          DialogBox (ghInst, (LPCTSTR) "List", hwnd,
                     (DLGPROC) EnumPrinterDriversDlgProc);
          break;

        case IDM_REFRESH:

          RefreshPrinterCombobox (hwndCombobox);
          break;

        case IDM_ABOUT:

          DialogBox (ghInst, (LPCTSTR) "About", hwnd, (DLGPROC) AboutDlgProc);
          break;

    case IDM_EXIT:
      DestroyWindow (hwnd);
      break;

        case IDM_HIENGLISH:
        case IDM_HIMETRIC:
        case IDM_LOENGLISH:
        case IDM_LOMETRIC:
        case IDM_TWIPS:
        case IDM_ISOTROPIC:
        case IDM_ANISOTROPIC:
        case IDM_TEXT:

          //
          // Uncheck the last map mode menuitem, check the new map mode
          //   menuitem, set iMappingMode according to menu id, cause a
          //   repaint
          //

          for (i = 0; i < MAX_MAP_MODES; i++)

            if (giMapMode == gaMMLookup[i].iMapMode)
            {
              CheckMenuItem (hMappingModesSubMenu, gaMMLookup[i].wMenuItem,
                             MF_UNCHECKED | MF_BYCOMMAND);
              break;
            }

          CheckMenuItem (hMappingModesSubMenu, LOWORD (wParam),
                         MF_CHECKED | MF_BYCOMMAND);

          for (i = 0; i < MAX_MAP_MODES; i++)

            if (LOWORD (wParam) == gaMMLookup[i].wMenuItem)
            {
              giMapMode = gaMMLookup[i].iMapMode;
              break;
            }

          //
          // invalidate the entire client so toolbar text gets updated
          //

          InvalidateRect (hwnd, NULL, TRUE);
          break;

        case IDM_ARC:
        case IDM_ELLIPSE:
        case IDM_LINETO:
        case IDM_PIE:
        case IDM_PLGBLT:
        case IDM_POLYBEZIER:
        case IDM_POLYGON:
        case IDM_POLYLINE:
        case IDM_POLYPOLYGON:
        case IDM_RECTANGLE:
        case IDM_ROUNDRECT:
        case IDM_STRETCHBLT:
        {
          //
          // Retrieve the DWORD flag value for the particular menuitem,
          //   toggle (un/check) the menuitem, set/clear the flag in
          //   gdwGraphicsOptions, cause a repaint
          //

          DWORD dwGraphic;

          for (i = 0; i < MAX_GRAPHICS; i++)

            if (LOWORD (wParam) == gaGraphicLookup[i].wMenuItem)
            {
              dwGraphic = gaGraphicLookup[i].dwGraphic;
              break;
            }

          if (GetMenuState (hGraphicsSubMenu, LOWORD(wParam), MF_BYCOMMAND)
              & MF_CHECKED)

          {
            gdwGraphicsOptions &= ~dwGraphic;
            CheckMenuItem (hGraphicsSubMenu, LOWORD(wParam),
                            MF_UNCHECKED | MF_BYCOMMAND);
          }
          else
          {
            //
            // Clear/uncheck the ENUMFONTS flag/menuitem
            //

            gdwGraphicsOptions &= ~ENUMFONTS;
            CheckMenuItem (hGraphicsSubMenu, IDM_ENUMFONTS,
                           MF_UNCHECKED | MF_BYCOMMAND);

            gdwGraphicsOptions |= dwGraphic;
            CheckMenuItem (hGraphicsSubMenu, LOWORD(wParam),
                            MF_CHECKED | MF_BYCOMMAND);
          }
          InvalidateClient ();
          break;
        }

        case IDM_ALLGRAPHICS:

          //
          // Clear/uncheck the ENUMFONTS flag/menuitem, set/check all
          //   other graphics flags/menuitems, cause a repaint
          //

          CheckMenuItem (hGraphicsSubMenu, IDM_ENUMFONTS,
                          MF_UNCHECKED | MF_BYCOMMAND);

          for (i = 0; i < MAX_GRAPHICS; i++)

            CheckMenuItem (hGraphicsSubMenu, IDM_ARC + i,
                           MF_CHECKED | MF_BYCOMMAND);

          gdwGraphicsOptions = ALLGRAPHICS | (gdwGraphicsOptions & DRAWAXIS);

          InvalidateClient ();
          break;

        case IDM_NOGRAPHICS:

          //
          // Clear/uncheck all graphics flags/menuitems, cause a repaint
          //

          for (i = 0; i < MAX_GRAPHICS; i++)

            CheckMenuItem (hGraphicsSubMenu, IDM_ARC + i,
                           MF_UNCHECKED | MF_BYCOMMAND);

          gdwGraphicsOptions &= (DRAWAXIS | ENUMFONTS);

          InvalidateClient ();
          break;

        case IDM_ENUMFONTS:

          //
          // Set/clear ENUMFONTS flag, toggle (un/check) menuitem, if
          //   checking IDM_ENUMFONTS then uncheck all other items,
          //   cause a repaint
          //

          if (GetMenuState (hGraphicsSubMenu, IDM_ENUMFONTS, MF_BYCOMMAND)
                & MF_CHECKED)
          {
            gdwGraphicsOptions &= DRAWAXIS;

            CheckMenuItem (hGraphicsSubMenu, IDM_ENUMFONTS,
                           MF_UNCHECKED | MF_BYCOMMAND);
          }

          else
          {
            SendMessage (hwnd, WM_COMMAND, IDM_NOGRAPHICS, 0);

            gdwGraphicsOptions = ENUMFONTS | (gdwGraphicsOptions & DRAWAXIS);

            CheckMenuItem (hGraphicsSubMenu, IDM_ENUMFONTS,
                           MF_CHECKED | MF_BYCOMMAND);
          }
          InvalidateClient ();
          break;

        case IDM_DRAWAXIS:

          //
          // Set/clear DRAWAXIS flag, toggle (un/check) menuitem,
          //   cause a repaint
          //

          if (GetMenuState (hGraphicsSubMenu, IDM_DRAWAXIS, MF_BYCOMMAND)
                & MF_CHECKED)
          {
            gdwGraphicsOptions &= ~DRAWAXIS;

            CheckMenuItem (hGraphicsSubMenu, IDM_DRAWAXIS,
                           MF_UNCHECKED | MF_BYCOMMAND);
          }

          else
          {
            gdwGraphicsOptions |= DRAWAXIS;

            CheckMenuItem (hGraphicsSubMenu, IDM_DRAWAXIS,
                           MF_CHECKED | MF_BYCOMMAND);
          }
          InvalidateClient ();
          break;

        case IDM_SETPENCOLOR:
        case IDM_SETBRUSHCOLOR:
        case IDM_TEXTCOLOR:
        {
          CHOOSECOLOR cc;

          static DWORD adwCustColors[16];

          memset ((void *) &cc, 0, sizeof (CHOOSECOLOR));

          cc.lStructSize  = sizeof (CHOOSECOLOR);
          cc.hwndOwner    = hwnd;
          cc.Flags        = CC_RGBINIT;
          cc.lpCustColors = adwCustColors;

          if (LOWORD (wParam) == IDM_SETPENCOLOR)

            cc.rgbResult = gdwPenColor;

          else if (LOWORD (wParam) == IDM_SETBRUSHCOLOR)

            cc.rgbResult = gdwBrushColor;

          else

            cc.rgbResult = gdwTextColor;

          //
          // bring up choose color common dialog
          //

          ChooseColor (&cc);

          if (LOWORD (wParam) == IDM_SETPENCOLOR)

            gdwPenColor   = cc.rgbResult;

          else if (LOWORD (wParam) == IDM_SETBRUSHCOLOR)

            gdwBrushColor = cc.rgbResult;

          else

            gdwTextColor  = cc.rgbResult;

          InvalidateClient ();
          break;
        }

        case IDM_PENWIDTH_1:
        case IDM_PENWIDTH_2:
        case IDM_PENWIDTH_3:
        case IDM_PENWIDTH_4:
        case IDM_PENWIDTH_5:
        case IDM_PENWIDTH_6:
        case IDM_PENWIDTH_7:
        case IDM_PENWIDTH_8:

          //
          // uncheck old pen width menuitem, check new one, cause a repaint
          //

          for (i = 0; i < MAX_PENWIDTHS; i++)

            if (giPenWidth == gaPenWidths[i].iPenWidth)
            {
              CheckMenuItem (hPenWidthSubMenu, gaPenWidths[i].wMenuItem,
                             MF_UNCHECKED | MF_BYCOMMAND);
              break;
            }

          for (i = 0; i < MAX_PENWIDTHS; i++)

            if (LOWORD(wParam) == gaPenWidths[i].wMenuItem)
            {
              CheckMenuItem (hPenWidthSubMenu, gaPenWidths[i].wMenuItem,
                             MF_CHECKED | MF_BYCOMMAND);

              giPenWidth = gaPenWidths[i].iPenWidth;

              break;
            }

          InvalidateClient ();
          break;

        case IDM_PENCOLOR_SOLID:
        case IDM_PENCOLOR_DASH:
        case IDM_PENCOLOR_DOT:
        case IDM_PENCOLOR_DASHDOT:
        case IDM_PENCOLOR_DASHDOTDOT:
        case IDM_PENCOLOR_NULL:
        case IDM_PENCOLOR_INSIDEFRAME:

          //
          // uncheck old pen style menuitem, check new one, cause a repaint
          //

          for (i = 0; i < MAX_PENSTYLES; i++)

            if (giPenStyle == gaPenStyles[i].iPenStyle)
            {
              CheckMenuItem (hPenStyleSubMenu, gaPenStyles[i].wMenuItem,
                             MF_UNCHECKED | MF_BYCOMMAND);
              break;
            }

          for (i = 0; i < MAX_PENSTYLES; i++)

            if (LOWORD(wParam) == gaPenStyles[i].wMenuItem)
            {
              CheckMenuItem (hPenStyleSubMenu, gaPenStyles[i].wMenuItem,
                             MF_CHECKED | MF_BYCOMMAND);

              giPenStyle = gaPenStyles[i].iPenStyle;

              break;
            }

          InvalidateClient ();
          break;

        case IDM_BRUSHSTYLE_HORIZONTAL:
        case IDM_BRUSHSTYLE_VERTICAL:
        case IDM_BRUSHSTYLE_FDIAGONAL:
        case IDM_BRUSHSTYLE_BDIAGONAL:
        case IDM_BRUSHSTYLE_CROSS:
        case IDM_BRUSHSTYLE_DIAGCROSS:

            for (i = 0; i < MAX_BRUSHSTYLES; i++) {

        // Uncheck the old option
        if (giBrushStyle == gaBrushStyles[i].iBrushStyle) {
          CheckMenuItem (hBrushStyleSubMenu, gaBrushStyles[i].wMenuItem,
                   MF_UNCHECKED | MF_BYCOMMAND);
        }

        // Check the new option
        if (LOWORD(wParam) == gaBrushStyles[i].wMenuItem) {

          CheckMenuItem (hBrushStyleSubMenu, gaBrushStyles[i].wMenuItem,
                   MF_CHECKED | MF_BYCOMMAND);

          giBrushStyle = gaBrushStyles[i].iBrushStyle;
        }
      }

          InvalidateClient ();
          break;

        case ID_COMBOBOX:

          switch (HIWORD(wParam))
          {
            case CBN_SELCHANGE:
            {
              DWORD dwIndex;
              char  buf[BUFSIZE];

              //
              // User clicked on one of the items in the toolbar combobox;
              //   figure out which item, then parse the text apart and
              //   copy it to the gszDriverName, gszDeviceName, and gszPort
              //   variables.
              //

              dwIndex = (DWORD) SendMessage ((HWND) lParam,
                                             CB_GETCURSEL, 0, 0);
              SendMessage ((HWND) lParam, CB_GETLBTEXT, dwIndex,
                           (LONG_PTR) buf);

              if (!strcmp (buf, "Display"))
              {
                lstrcpyn (gszDeviceName, "Display", BUFSIZE);

                gszPort[0]       =
                gszDriverName[0] = '\0';
              }
              else
              {
                LPSTR   lpszSrc;
                LPSTR   lpszDst;

                for (lpszSrc = buf, lpszDst = gszDeviceName;
                    *lpszSrc && *lpszSrc != ';';    ) {
                    if (IsDBCSLeadByte(*lpszSrc)) {
                        *lpszDst++ = *lpszSrc++;
                    }
                    *lpszDst++ = *lpszSrc++;
                }
                *lpszDst = '\0';

                for (lpszSrc++, lpszDst = gszPort;
                    *lpszSrc && *lpszSrc != ';';    ) {
                    if (IsDBCSLeadByte(*lpszSrc)) {
                        *lpszDst++ = *lpszSrc++;
                    }
                    *lpszDst++ = *lpszSrc++;
                }
                *lpszDst = '\0';

                for (lpszSrc++, lpszDst = gszDriverName; *lpszSrc;    ) {
                    if (IsDBCSLeadByte(*lpszSrc)) {
                        *lpszDst++ = *lpszSrc++;
                    }
                    *lpszDst++ = *lpszSrc++;
                }
                *lpszDst = '\0';
              }
              break;
            }
          }
          break;
      }
      break;

    case WM_PAINT:
    {
      PAINTSTRUCT ps;
      RECT        rect;
      HRGN        hrgn;
      HPEN        hpen, hpenSave;
      HBRUSH      hbr;
      char        buf[BUFSIZE];
      POINT       p;

      BeginPaint (hwnd, &ps);

      //
      // paint 3d toolbar background & client size text
      //

      GetClientRect (hwnd, &rect);
      rect.bottom = 2*glcyMenu;
      FillRect (ps.hdc, &rect, GetStockObject (LTGRAY_BRUSH));
      SelectObject (ps.hdc, GetStockObject (WHITE_PEN));
      MoveToEx (ps.hdc, 0, 2*glcyMenu - 2, NULL);
      LineTo   (ps.hdc, 0, 0);
      LineTo   (ps.hdc, (int) rect.right, 0);
      hpen = CreatePen (PS_SOLID, 1, 0x808080);
      hpenSave = SelectObject (ps.hdc, hpen);
      MoveToEx (ps.hdc, 0, (int) 2*glcyMenu-1, NULL);
      LineTo   (ps.hdc, (int) rect.right - 1, (int) 2*glcyMenu-1);
      LineTo   (ps.hdc, (int) rect.right - 1, 1);
      SelectObject (ps.hdc, hpenSave);
      DeleteObject (hpen);

      GetClientRect (hwnd, &rect);

      //
      // positioning of the string based upon x,y,cx,cy of combobox
      //

      SetBkMode (ps.hdc, TRANSPARENT);

      p.x = rect.right;
      p.y = (rect.bottom - 2*glcyMenu < 0 ? 0 : rect.bottom - 2*glcyMenu);
      SetMapMode (ps.hdc, giMapMode);
      DPtoLP (ps.hdc, &p, 1);

      if ((giMapMode != MM_TEXT) && (giMapMode != MM_ANISOTROPIC))

        //
        // p.y will come out negative because we started with origin in
        //   upper left corner
        //

        p.y = -p.y;

      SetMapMode (ps.hdc, MM_TEXT);
      _snprintf (buf, BUFSIZE -1, "cxClient = %ld (%ld)", rect.right, p.x);
      TextOut (ps.hdc, iComboboxWidth + (int) 3*glcyMenu/2, (int) glcyMenu/8,
               buf, (int) strlen (buf));
      _snprintf (buf, BUFSIZE -1, "cyClient = %ld (%ld)",
               rect.bottom - 2*glcyMenu < 0 ? 0 : rect.bottom - 2*glcyMenu,
               p.y);
      TextOut (ps.hdc, iComboboxWidth + (int) 3*glcyMenu/2,
               (int) (glcyMenu/8 + lTextHeight),
               buf, (int) strlen (buf));

      //
      // paint graphics background white
      //

      rect.top    += 2*glcyMenu;
      FillRect (ps.hdc, &rect, GetStockObject (WHITE_BRUSH));

      if (rect.bottom <= 4*glcyMenu)

        //
        // we don't want to overpaint the toolbar, so just skip Paint() call
        //

        goto done_painting;

      //
      // set up a clip region so we don't draw all over our toolbar
      //

      GetClientRect (hwnd, &rect);
      rect.top += 2*glcyMenu;
      hrgn = CreateRectRgnIndirect (&rect);
      SelectClipRgn (ps.hdc, hrgn);
      DeleteObject (hrgn);

      //
      // set up view port, pens/brushes, & map mode, then paint
      //

      rect.top -= 2*glcyMenu;

      if (giMapMode == MM_TEXT || giMapMode == MM_ANISOTROPIC)

        SetViewportOrgEx (ps.hdc, glcyMenu, 3*glcyMenu, NULL);

      else

        SetViewportOrgEx (ps.hdc, glcyMenu, rect.bottom - glcyMenu, NULL);

      rect.bottom -= 4*glcyMenu;
      rect.right  -= 2*glcyMenu;

      hpen = CreatePen (giPenStyle, giPenWidth, gdwPenColor);
      SelectObject (ps.hdc, hpen);
      hbr  = CreateHatchBrush (giBrushStyle, gdwBrushColor);
      SelectObject (ps.hdc, hbr);

      SetTextColor (ps.hdc, gdwTextColor);

      SetMapMode (ps.hdc, giMapMode);
      Paint      (ps.hdc, &rect);

      DeleteObject (hpen);
      DeleteObject (hbr);

done_painting:

      EndPaint (hwnd, &ps);
      break;
    }

    case WM_CREATE:
    {
      HDC         hdc;
      TEXTMETRIC  tm;
      SIZE        size;
      HMENU       hmenu, hPenSubMenu, hBrushSubMenu;

      //
      // initialize the globals
      //

      glcyMenu = (LONG) GetSystemMetrics (SM_CYMENU);

      hmenu                = GetMenu (hwnd);
      hMappingModesSubMenu = GetSubMenu (hmenu, 2);
      hGraphicsSubMenu     = GetSubMenu (hmenu, 3);
      hPenSubMenu          = GetSubMenu (hmenu, 4);
      hPenWidthSubMenu     = GetSubMenu (hPenSubMenu, 1);
      hPenStyleSubMenu     = GetSubMenu (hPenSubMenu, 2);
      hBrushSubMenu        = GetSubMenu (hmenu, 5);
      hBrushStyleSubMenu   = GetSubMenu (hBrushSubMenu, 1);

      GetTextMetrics ((hdc = GetDC (hwnd)), &tm);
      lTextHeight = tm.tmHeight;

      //
      // create combobox to display current printers in. the width
      //   is caluculated by getting the text extent of a typical
      //   entry in the listbox.
      //

      #define ASTRING "long  printer  name;long  port  name;long  driver  name"

      GetTextExtentPoint (hdc, ASTRING, sizeof (ASTRING), &size);

      iComboboxWidth = (int) size.cx;

      ReleaseDC (hwnd, hdc);

      hwndCombobox = CreateWindow ((LPCSTR) "COMBOBOX", (LPCSTR) "",
                                   WS_CHILD | WS_VISIBLE | CBS_DROPDOWN | WS_VSCROLL,
                                   (int) glcyMenu/2,
                                   (int) glcyMenu/2 - 2,  // - 2 = fudge factor
                                   iComboboxWidth,
                                   (int) 6*glcyMenu,
                                   hwnd, NULL, ghInst, NULL);

      SetWindowLongPtr (hwndCombobox, GWLP_ID, ID_COMBOBOX);

      PostMessage (hwnd, WM_COMMAND,
                   (WPARAM) MAKELONG (IDM_REFRESH, 0),
                   (LPARAM) 0);
      PostMessage (hwnd, WM_COMMAND,
                   (WPARAM) MAKELONG (IDM_POLYPOLYGON, 0),
                   (LPARAM) 0);
      break;
    }

    case WM_DESTROY:

      PostQuitMessage (0);
      break;

    default:

      return (DefWindowProc (hwnd, msg, wParam, lParam));
  }
  return 0;
}

void PrintThread ( LPVOID wParam )

Definition at line 986 of file Printer.c.

{
  DOCINFO di;
  RECT    rect;
  HPEN    hpen;
  HBRUSH  hbr;

  switch (LOWORD((WPARAM) wParam)) {
    case IDM_PRINT:
    {
      if (!strcmp (gszDeviceName, "Display"))
      {
        MessageBox (ghwndMain, GetStringRes(IDS_ASKSELPRT),
                    "PRINTER.EXE:", MB_OK);
        return;
      }
      else if (!(ghdc = CreateDC (gszDriverName, gszDeviceName, gszPort, NULL)))
      {
        MessageBox (ghwndMain, "PrintThread(): CreateDC() failed",
                    GetStringRes2(ERR_MOD_NAME), MB_OK);
        return;
      }
      break;
    }

    case IDM_PRINTDLG:
    {
      PRINTDLG  pd;

      //
      // Initialize a PRINTDLG struct and call PrintDlg to allow user to
      //   specify various printing options...
      //

      memset ((void *) &pd, 0, sizeof(PRINTDLG));

      pd.lStructSize = sizeof(PRINTDLG);
      pd.hwndOwner   = ghwndMain;
      pd.Flags       = PD_RETURNDC;
      pd.hInstance   = NULL;

      PrintDlg(&pd);
      ghdc = pd.hDC;

      if (pd.hDevMode)

        GlobalFree (pd.hDevMode);

      if (pd.hDevNames)

        GlobalFree (pd.hDevNames);

      if (!ghdc)
      {
        MessageBox (ghwndMain, GetStringRes(IDS_PRTDLGFAIL),
                    GetStringRes2(ERR_MOD_NAME), MB_OK);
        return;
      }
    }
  }

  //
  // put up Abort & install the abort procedure
  //

  gbAbort = FALSE;
  ghwndAbort = CreateDialog (ghInst, (LPCTSTR) "Abort", ghwndMain,
    (DLGPROC) AbortDlgProc);
  EnableWindow (ghwndMain, FALSE);
  SetAbortProc (ghdc, AbortProc);

  //
  // create & select pen/brush
  //

  hpen = CreatePen (giPenStyle, giPenWidth, gdwPenColor);
  SelectObject (ghdc, hpen);

  hbr  = CreateHatchBrush (giBrushStyle, gdwBrushColor);
  SelectObject (ghdc, hbr);

  SetTextColor (ghdc, gdwTextColor);

  SetMapMode (ghdc, giMapMode);

  SetRect(&rect, 0,0, GetDeviceCaps (ghdc, HORZRES), GetDeviceCaps (ghdc, VERTRES));

  di.cbSize      = sizeof(DOCINFO);
  di.lpszDocName = GetStringRes(IDS_PRTTST);
  di.lpszOutput  = NULL;
  di.fwType      = 0; // Windows 95 only; ignored on Windows NT

  StartDoc  (ghdc, &di);

  if (gdwGraphicsOptions) {

    Paint (ghdc, &rect);

  } else {
    LPSTR pBuf = GetStringRes(IDS_BLANKPG);
    TextOut (ghdc, 5, 5, (LPCTSTR) pBuf, (int) My_mbslen(pBuf));
  }

  // If we didn't abort the job
  if (!gbAbort)
  {
    EndPage   (ghdc);
    EndDoc    (ghdc);

    DestroyWindow (ghwndAbort);
  }

  // Clean up
  DeleteDC  (ghdc);
  DeleteObject(hpen);
  DeleteObject(hbr);

  EnableWindow  (ghwndMain, TRUE);
}

void RefreshPrinterCombobox ( HWND hwndCombobox )

Definition at line 896 of file Printer.c.

{
  DWORD            dwFlags = PRINTER_ENUM_FAVORITE | PRINTER_ENUM_LOCAL;
  LPPRINTER_INFO_2 pPrinters;
  DWORD            cbPrinters;
  DWORD            cReturned, i;
  char             buf[BUFSIZE];

  SendMessage (hwndCombobox, CB_RESETCONTENT, 0, 0);

  //
  // add the "Display" option to the combobox
  //

  lstrcpyn (buf, "Display", BUFSIZE);
  SendMessage (hwndCombobox, CB_INSERTSTRING, (UINT)-1, (LONG_PTR) buf);

  //
  // get byte count needed for buffer, alloc buffer, the enum the printers
  //

  EnumPrinters (dwFlags, NULL, 2, NULL, 0, &cbPrinters,
                &cReturned);

  if (!(pPrinters = (LPPRINTER_INFO_2) LocalAlloc (LPTR, cbPrinters + 4)))
  {
    MessageBox (ghwndMain, (LPCTSTR) GetStringRes(IDS_LALLOCFAIL),
                (LPCTSTR)GetStringRes2(ERR_MOD_NAME), MB_OK | MB_ICONEXCLAMATION);
    goto done_refreshing;
  }

  if (!EnumPrinters (dwFlags, NULL, 2, (LPBYTE) pPrinters,
                     cbPrinters, &cbPrinters, &cReturned))
  {
    MessageBox (ghwndMain, (LPCTSTR) GetStringRes(IDS_ENUMPRTFAIL),
                (LPCTSTR) GetStringRes2(ERR_MOD_NAME), MB_OK | MB_ICONEXCLAMATION);
    goto done_refreshing;
  }

  if (cReturned > 0)

    for (i = 0; i < cReturned; i++)
    {
      //
      // for each printer in the PRINTER_INFO_2 array: build a string that
      //   looks like "DEVICE_NAME;PORT;DRIVER_NAME"
      //

      lstrcpyn (buf, (pPrinters + i)->pPrinterName, BUFSIZE);
      strncat (buf, ";", BUFSIZE - strlen(buf));
      strncat (buf, (pPrinters + i)->pPortName, BUFSIZE - strlen(buf));
      strncat (buf, ";", BUFSIZE - strlen(buf));
      strncat (buf, (pPrinters + i)->pDriverName, BUFSIZE - strlen(buf));

      SendMessage (hwndCombobox, CB_INSERTSTRING, (UINT)-1, (LONG_PTR) buf);
    }

  else

    MessageBox (ghwndMain, GetStringRes(IDS_NOPRTLST), "PRINTER.EXE", MB_OK);

done_refreshing:

  SendMessage (hwndCombobox, CB_SELECTSTRING, (UINT) -1, (LONG_PTR) buf);

  PostMessage (ghwndMain, WM_COMMAND,
               (WPARAM) MAKELONG (ID_COMBOBOX, CBN_SELCHANGE),
               (LPARAM) hwndCombobox);

  LocalFree (LocalHandle (pPrinters));
}

int WINAPI WinMain | ( | HINSTANCE | ghInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 79 of file Printer.c.

{
  MSG msg;

  ghInst = ghInstance;

  if (!hPrevInstance)
  {
    WNDCLASS wc;

    wc.style         = MAIN_CLASS_STYLE;
    wc.lpfnWndProc   = (WNDPROC) MainWndProc;
    wc.cbClsExtra    = 0;
    wc.cbWndExtra    = 0;
    wc.hInstance     = ghInst;
    wc.hIcon         = LoadIcon (ghInst, MAKEINTRESOURCE(MAIN_ICON));
    wc.hCursor       = LoadCursor (NULL, IDC_ARROW);
    wc.hbrBackground = NULL;
    wc.lpszMenuName  = (LPCSTR) MAIN_MENU_NAME;
    wc.lpszClassName = (LPCSTR) MAIN_CLASS_NAME;

    if (!RegisterClass (&wc))
    {
      MessageBox (NULL, "WinMain(): RegisterClass() failed",
                  GetStringRes2(ERR_MOD_NAME), MB_OK | MB_ICONHAND);

      return FALSE;
    }
  }

  if (!(ghwndMain = CreateWindow ((LPCSTR) MAIN_CLASS_NAME,
                                  (LPCSTR) GetStringRes(MAIN_WND_TITLE),
                                  MAIN_WND_STYLE,
                                  CW_USEDEFAULT, CW_USEDEFAULT,
                                  CW_USEDEFAULT, CW_USEDEFAULT,
                                  NULL, NULL, ghInst, NULL)))
    return FALSE;

  ShowWindow (ghwndMain, nCmdShow);

  while (GetMessage (&msg, NULL, 0, 0))
  {
    TranslateMessage (&msg);
    DispatchMessage  (&msg);
  }

  return (int)msg.wParam;
}

Generated on Wed Nov 13 2024 16:53:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/Printer/Printer.h File Reference

  • Multimedia
  • Gdi
  • Printer
Classes | Defines | Typedefs | Functions | Variables

Printer.h File Reference

Go to the source code of this file.

Classes

struct | tagBRUSHSTYLELOOKUP
struct | tagGRAPHICLOOKUP
struct | tagMAPMODELOOKUP
struct | tagPENSTYLELOOKUP
struct | tagPENWIDTHLOOKUP
struct | tagSTATUSBARLOOKUP

Defines

#define | ERR_MOD_NAME IDS_ERR_PRINTER
#define | MAX_BRUSHSTYLES 6
#define | MAX_MAP_MODES 8
#define | MAX_PENSTYLES 7
#define | MAX_PENWIDTHS 8

Typedefs

typedef struct tagBRUSHSTYLELOOKUP | BRUSHSTYLELOOKUP
typedef struct tagGRAPHICLOOKUP | GRAPHICLOOKUP
typedef struct tagMAPMODELOOKUP | MAPMODELOOKUP
typedef struct tagPENSTYLELOOKUP | PENSTYLELOOKUP
typedef struct tagPENWIDTHLOOKUP | PENWIDTHLOOKUP
typedef struct tagSTATUSBARLOOKUP | STATUSBARLOOKUP

Functions

LRESULT CALLBACK | AbortDlgProc (HWND, UINT, WPARAM, LPARAM)
BOOL CALLBACK | AbortProc (HDC, int)
LRESULT CALLBACK | AboutDlgProc (HWND, UINT, WPARAM, LPARAM)
void | InvalidateClient (void)
LRESULT CALLBACK | MainWndProc (HWND, UINT, WPARAM, LPARAM)
void | PrintThread (LPVOID)
void | RefreshPrinterCombobox (HWND)

Variables

BRUSHSTYLELOOKUP gaBrushStyles []
GRAPHICLOOKUP gaGraphicLookup []
MAPMODELOOKUP gaMMLookup []
PENSTYLELOOKUP gaPenStyles []
PENWIDTHLOOKUP gaPenWidths []
BOOL gbAbort
DWORD | gdwBrushColor = 0x0000ff
DWORD | gdwGraphicsOptions = DRAWAXIS
DWORD | gdwPenColor = 0x00ff00
DWORD | gdwTextColor = 0xff0000
HDC | ghdc
HANDLE ghInst
HWND | ghwndAbort
HWND | ghwndMain
int | giBrushStyle = HS_HORIZONTAL
int | giMapMode = MM_TEXT
int | giPenStyle = PS_SOLID
int | giPenWidth = 1
LONG | glcyMenu
char | gszDeviceName [BUFSIZE]
char | gszDriverName [BUFSIZE]
char | gszPort [BUFSIZE]

Define Documentation

#define ERR_MOD_NAME IDS_ERR_PRINTER

Definition at line 23 of file Printer.h.

#define MAX_BRUSHSTYLES 6

Definition at line 21 of file Printer.h.

#define MAX_MAP_MODES 8

Definition at line 18 of file Printer.h.

#define MAX_PENSTYLES 7

Definition at line 20 of file Printer.h.

#define MAX_PENWIDTHS 8

Definition at line 19 of file Printer.h.

Typedef Documentation

typedef struct tagBRUSHSTYLELOOKUP BRUSHSTYLELOOKUP
typedef struct tagGRAPHICLOOKUP GRAPHICLOOKUP
typedef struct tagMAPMODELOOKUP MAPMODELOOKUP
typedef struct tagPENSTYLELOOKUP PENSTYLELOOKUP
typedef struct tagPENWIDTHLOOKUP PENWIDTHLOOKUP
typedef struct tagSTATUSBARLOOKUP STATUSBARLOOKUP

Function Documentation

LRESULT CALLBACK AbortDlgProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 1140 of file Printer.c.

{
  switch (msg) {
    case WM_INITDIALOG:
    EnableMenuItem (GetSystemMenu (hwnd, FALSE), SC_CLOSE, MF_GRAYED);
    return TRUE;

    case WM_COMMAND:   // There's only one
    switch (LOWORD (wParam)) {
    case DID_CANCEL:
      MessageBeep(MB_OK);
      gbAbort = TRUE;
      AbortDoc (ghdc);
      DestroyWindow (hwnd);
      break;
    }
    break;
  }
  return 0;
}

BOOL CALLBACK AbortProc | ( | HDC | ,
 |  | int |
 | ) |  |

Definition at line 400 of file tprint.cpp.

{

    MSG msg;

    if (!hAbortWnd) {
        return(TRUE);
    }
    while (!g_bAbort && PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
        if (!IsDialogMessage(hAbortWnd, &msg)) {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
    }
    return(!g_bAbort);
}

LRESULT CALLBACK AboutDlgProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 471 of file APP.Cxx.

{

    switch(message)
    {
       case WM_INITDIALOG:
            return TRUE;
       case WM_COMMAND:
            switch (wParam) //Command ID
            {
               case IDOK:
               case IDCANCEL:
                    EndDialog(hwnd, 0);
                    return TRUE;
            }
            break;
    }
    return FALSE;
}

void InvalidateClient ( void )

Definition at line 865 of file Printer.c.

{
  RECT rect;

  GetClientRect (ghwndMain, &rect);

  rect.top += 2*glcyMenu;

  InvalidateRect (ghwndMain, &rect, TRUE);
}

LRESULT CALLBACK MainWndProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 3333 of file sdkdiff.cpp.

{
    char str[32];
    long ret;
    DWORD threadid;
  HRESULT hr;

    switch (message) {

        case WM_CREATE:

            /* initialise menu options to default/saved
             * option settings
             */

#define CHECKMENU(id, fChecked)  \
          CheckMenuItem(hMenu, (id), (fChecked) ? MF_CHECKED:MF_UNCHECKED)

            /* outline_include options */
            CHECKMENU(IDM_OUTLINE_INCSAME,   (outline_include & INCLUDE_SAME));
            CHECKMENU(IDM_OUTLINE_INCLEFT,   (outline_include & INCLUDE_LEFTONLY));
            CHECKMENU(IDM_OUTLINE_INCRIGHT,  (outline_include & INCLUDE_RIGHTONLY));
            CHECKMENU(IDM_OUTLINE_INCDIFFER, (outline_include & INCLUDE_DIFFER));

            /* expand_include options */
            CHECKMENU(IDM_EXPAND_INCSAME,         (expand_include & INCLUDE_SAME));
            CHECKMENU(IDM_EXPAND_INCLEFT,         (expand_include & INCLUDE_LEFTONLY));
            CHECKMENU(IDM_EXPAND_INCRIGHT,        (expand_include & INCLUDE_RIGHTONLY));
            CHECKMENU(IDM_EXPAND_INCMOVEDLEFT,    (expand_include & INCLUDE_MOVEDLEFT));
            CHECKMENU(IDM_EXPAND_INCMOVEDRIGHT,   (expand_include & INCLUDE_MOVEDRIGHT));
            CHECKMENU(IDM_EXPAND_INCSIMILARLEFT,  (expand_include & INCLUDE_SIMILARLEFT));
            CHECKMENU(IDM_EXPAND_INCSIMILARRIGHT, (expand_include & INCLUDE_SIMILARRIGHT));

            /* other options */
            CHECKMENU(line_numbers, TRUE);
            CHECKMENU(expand_mode, TRUE);
            CHECKMENU(IDM_IGNBLANKS, ignore_blanks);
            CHECKMENU(IDM_SHOWWHITESPACE, show_whitespace);
            CHECKMENU(IDM_ALG2, Algorithm2);
            CHECKMENU(IDM_MONOCOLS, mono_colours);
            CHECKMENU(IDM_PICTURE, picture_mode);
            CHECKMENU(IDM_HIDEMARK, hide_markedfiles);
#undef CHECKMENU

            /* nothing currently displayed */
            DisplayMode = MODE_NULL;

            break;

        case WM_SYSCOLORCHANGE:
            {
                HIGHCONTRAST hc;

                hc.cbSize = sizeof(hc);
                SystemParametersInfo(SPI_GETHIGHCONTRAST,0 ,&hc, 0);

                mono_colours = (hc.dwFlags & HCF_HIGHCONTRASTON);
                if (mono_colours) {
                    SetMonoColours();
                } else {
                    SetColours();
                }

                CheckMenuItem(hMenu, IDM_MONOCOLS,
                              mono_colours? MF_CHECKED:MF_UNCHECKED);
                hr = StringCchPrintf(str, 32, szD, mono_colours);
        if (FAILED(hr))
          OutputError(hr, IDS_SAFE_PRINTF);
                WriteProfileString(APPNAME, szMonoColours, str);
                SendMessage(hwndRCD, message, wParam, lParam);
                SendMessage(hwndStatus, message, wParam, lParam);
                SendMessage(hwndBar, message, wParam, lParam);

                /* The diffs are still valid, but force a re-display
                 * of bar window and main table.
                 */
                SendMessage(hwndBar, WM_COMMAND, IDM_MONOCOLS, 0);
                InvalidateRect(hwndBar, NULL, TRUE);
                view_changeviewoptions(current_view);
            }
            break;

        case WM_COMMAND:
            switch (GET_WM_COMMAND_ID(wParam, lParam)) {
                case IDM_EXIT:
                    if (ghThread!=NULL) {
                        bAbort = TRUE;
                        SetStatus(LoadRcString(IDS_ABORT_PENDING));
                        break;
                    }
                    if (!view_isexpanded(current_view)) {
                        /* save the current outline size and position */
                        WINDOWPLACEMENT wp;
                        wp.length = sizeof(wp);
                        if (GetWindowPlacement(hwndClient,&wp)) {
                            WriteProfileInt(APPNAME, szOutlineShowCmd, wp.showCmd);
                            WriteProfileInt(APPNAME, szOutlineMaxX, wp.ptMaxPosition.x);
                            WriteProfileInt(APPNAME, szOutlineMaxY, wp.ptMaxPosition.y);
                            WriteProfileInt(APPNAME, szOutlineNormLeft, wp.rcNormalPosition.left);
                            WriteProfileInt(APPNAME, szOutlineNormTop, wp.rcNormalPosition.top);
                            WriteProfileInt(APPNAME, szOutlineNormRight, wp.rcNormalPosition.right);
                            WriteProfileInt(APPNAME, szOutlineNormBottom, wp.rcNormalPosition.bottom);
                            WriteProfileInt(APPNAME, szOutlineSaved, 1);
                        }
                    } else {
                        /* save the current expanded size and position */
                        WINDOWPLACEMENT wp;
                        wp.length = sizeof(wp);
                        if (GetWindowPlacement(hwndClient,&wp)) {
                            WriteProfileInt(APPNAME, szExpandShowCmd, wp.showCmd);
                            WriteProfileInt(APPNAME, szExpandMaxX, wp.ptMaxPosition.x);
                            WriteProfileInt(APPNAME, szExpandMaxY, wp.ptMaxPosition.y);
                            WriteProfileInt(APPNAME, szExpandNormLeft, wp.rcNormalPosition.left);
                            WriteProfileInt(APPNAME, szExpandNormTop, wp.rcNormalPosition.top);
                            WriteProfileInt(APPNAME, szExpandNormRight, wp.rcNormalPosition.right);
                            WriteProfileInt(APPNAME, szExpandNormBottom, wp.rcNormalPosition.bottom);
                            WriteProfileInt(APPNAME, szExpandedSaved, 1);
                        }
                    }
                    DestroyWindow(hWnd);
                    break;

                case IDM_ABORT:
                    /* abort menu item, or status bar button.
                     * the status bar button text gives the appropriate
                     * action depending on our state - abort, outline
                     * or expand. But the command sent is always
                     * IDM_ABORT. Thus we need to check the state
                     * to see what to do. If we are busy, set the abort
                     * flag. If there is nothing to view,
                     * exit, otherwise switch outline<->expand
                     */
                    if (IsBusy()) {
                        bAbort = TRUE;
                        SetStatus(LoadRcString(IDS_ABORT_PENDING));
                    } else if (DisplayMode == MODE_NULL) {
                        DestroyWindow(hWnd);
                    } else if (DisplayMode == MODE_EXPAND) {
                        ToOutline(hWnd);
                    } else {
                        ToExpand(hWnd);
                    }
                    break;

                case IDM_FILE:
                    /* select two files and compare them */
                    if (SetBusy()) {

                        /* close the current view */
                        view_close(current_view);

                        /* make a new empty view */
                        current_view = view_new(hwndRCD);

                        /* make a COMPLIST using the files dialog,
                         * and notify the view
                         */
                        if (complist_filedialog(current_view) == NULL) {
                            view_close(current_view);
                        }

                        /* all done! */
                        SetNotBusy();
                    } else {
                        BusyError();
                    }
                    break;

                case IDM_DIR:

                    /* read two directory names, scan them and
                     * compare all the files and subdirs.
                     */
                    if (SetBusy()) {

                        /* close the current view */
                        view_close(current_view);

                        /* make a new empty view */
                        current_view = view_new(hwndRCD);

                        ghThread = CreateThread(NULL, 0, wd_dirdialog,
                                                (LPVOID) current_view, 0, &threadid);

                        if (ghThread == NULL)
                        {

                            /*
                             * either we are on WIN16, or the
                             * thread call failed. continue
                             * single-threaded.
                             */
                            wd_dirdialog( (LPVOID) current_view);

                        }

                    } else {
                        BusyError();
                    }
                    break;

                case IDM_CLOSE:
                    /* close the output list -
                     * discard all results so far
                     */
                    if (!IsBusy()) {
                        view_close(current_view);
                    }
                    break;

                case IDM_PRINT:
                    /* print the current view -
                     * either the outline list of filenames,
                     * or the currently expanded file.
                     */
                    if (!IsBusy()) {
                        DoPrint();
                    } else {
                        BusyError();
                    }
                    break;

                case IDM_TIME:
                    /* show time it took */
                    {       char msg[50];
                        DWORD tim;
                        if (IsBusy()) {
                            BusyError();
                        } else {
                            tim = complist_querytime();
                            hr = StringCchPrintf(msg, 50, LoadRcString(IDS_SECONDS), tim/1000, tim%1000);
              if (FAILED(hr))
                OutputError(hr, IDS_SAFE_PRINTF);
                            Trace_Status(msg);
                        }
                    }
                    break;

                case IDM_TRACE:
                    /* enable tracing */
                    bTrace = TRUE;
                    Trace_Status(LoadRcString(IDS_TRACING_ENABLED));
                    break;

                case IDM_TRACEOFF:
                    /* enable tracing */
                    bTrace = FALSE;
                    Trace_Status(LoadRcString(IDS_TRACING_DISABLED));
                    break;

                case IDM_SAVELIST:
                    /* allow user to save list of same/different files
                     * to a text file. dialog box to give filename
                     * and select which types of file to include
                     */
                    if (current_view == NULL) {
                        MessageBox(hWnd,
                                   LoadRcString(IDS_CREATE_DIFF_LIST),
                                   szSdkDiff, MB_OK|MB_ICONSTOP);
                        break;
                    }

                    complist_savelist(view_getcomplist(current_view), NULL, outline_include);
                    break;

                case IDM_COPYFILES:
                    /*
                     * copy files that are same/different to a new
                     * root directory. dialog box allows user
                     * to select new root and inclusion options
                     */
                    if (current_view == NULL) {
                        MessageBox(hWnd,
                                   LoadRcString(IDS_CREATE_DIFF_LIST),
                                   szSdkDiff, MB_OK|MB_ICONSTOP);
                        break;
                    }

                    if (SetBusy()) {
                        ghThread = CreateThread(NULL, 0, wd_copy,
                                                (LPVOID) current_view, 0, &threadid);
                        if (ghThread == NULL)
                        {
                            wd_copy( (LPVOID) current_view);
                        }

                    } else {
                        BusyError();
                    }

                    break;

                case IDM_ABOUT:
                    ShellAbout( hWnd,
                                (LPTSTR)szSdkDiff,
                                LoadRcString(IDS_TOOL_DESCRIPTION),
                                LoadIcon(hInst, szSdkDiff)
                              );
                    break;

                case IDM_CONTENTS:
                    /* Help contents */
          TCHAR pszHelp[MAX_PATH];
          memset(pszHelp, 0, MAX_PATH);
          hr = StringCchCopy(pszHelp, MAX_PATH, pszWorkingDirectoryName);
          if (FAILED(hr))
            OutputError(hr, IDS_SAFE_COPY);
          hr = StringCchCat(pszHelp, MAX_PATH, "sdkdiff.hlp");
          if (FAILED(hr))
            OutputError(hr, IDS_SAFE_CAT);
          WinHelp(hWnd, pszHelp, HELP_INDEX, 0);
                    break;

                    /* launch an editor on the current item - left, right or
                     * composite view
                     */
                case IDM_EDITLEFT:
                    do_editthread(current_view, CI_LEFT);
                    break;

                case IDM_EDITRIGHT:
                    do_editthread(current_view, CI_RIGHT);
                    break;

                case IDM_EDITCOMP:
                    {
                        COMPITEM item = view_getitem(current_view, selection);
                        FILEDATA fdLeft;
                        FILEDATA fdRight;

                        fdLeft = compitem_getleftfile(item);
                        fdRight = compitem_getrightfile(item);
                        if ((fdLeft && file_IsUnicode(fdLeft)) || (fdRight && file_IsUnicode(fdRight))) {
                            MessageBox(hWnd, LoadRcString(IDS_NOCOMPUNICODE),
                                       szSdkDiff, MB_OK);
                        } else {
                            do_editthread(current_view, CI_COMP);
                        }
                    }
                    break;

                    /* allow customisation of the editor command line */
                case IDM_SETEDIT:
                    if (StringInput(editor_cmdline, sizeof(editor_cmdline),
                                    LoadRcString(IDS_EDITOR_COMMAND),
                                    (LPSTR)szSdkDiff, editor_cmdline)) {
                        WriteProfileString(APPNAME, szEditor,
                                           editor_cmdline);
                    }
                    break;

                case IDM_SETTABWIDTH:
                    {
                        char sz[32];
                        int n;

LTabWidth_tryagain:
                        hr = StringCchPrintf(sz, 32, "%d", g_tabwidth);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        if (StringInput(sz, sizeof(sz),
                                        LoadRcString(IDS_TABWIDTH),
                                        (LPSTR)szSdkDiff, sz))
                        {
                            n = atoi(sz);
                            if (n <= 0 || n > 100)
                            {
                                MessageBox(hWnd,
                                           LoadRcString(IDS_BAD_TABWIDTH),
                                           szSdkDiff, MB_OK);
                                goto LTabWidth_tryagain;
                            }
                            WriteProfileInt(APPNAME, szTabWidth, n);
                            g_tabwidth = n;
                            SendMessage(hwndRCD, TM_SETTABWIDTH, 0, n);
                        }
                    }
                    break;

                case IDM_TABWIDTH4:
                case IDM_TABWIDTH8:
                    g_tabwidth = (GET_WM_COMMAND_ID(wParam, lParam) == IDM_TABWIDTH8) ? 8 : 4;
                    SendMessage(hwndRCD, TM_SETTABWIDTH, 0, g_tabwidth);
                    break;

                case IDM_SETFONT:
                    {
                        CHOOSEFONT cf;
                        LOGFONT lf;
                        char szFace[LF_FACESIZE];

                        hr = StringCchCopy(szFace, LF_FACESIZE, g_szFontFaceName);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_COPY);

                        memset(&lf, 0, sizeof(lf));
                        hr = StringCchCopy(lf.lfFaceName, LF_FACESIZE, szFace);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_COPY);
                        lf.lfWeight = g_fFontBold ? FW_BOLD : FW_DONTCARE;
                        lf.lfHeight = g_nFontHeight;
                        lf.lfCharSet = g_bFontCharSet;

                        memset(&cf, 0, sizeof(cf));
                        cf.lStructSize = sizeof(CHOOSEFONT);
                        cf.hwndOwner = hWnd;
                        cf.lpLogFont = &lf;
                        cf.Flags = CF_INITTOLOGFONTSTRUCT|CF_FORCEFONTEXIST|
                                CF_SCREENFONTS|CF_LIMITSIZE;
                        cf.nSizeMin = 8;
                        cf.nSizeMax = 36;
                        cf.lpszStyle = szFace;
                        if (ChooseFont(&cf))
                            {
                            hr = StringCchCopy(g_szFontFaceName, LF_FACESIZE, lf.lfFaceName);
              if (FAILED(hr))
                OutputError(hr, IDS_SAFE_COPY);
                            g_fFontBold = (lf.lfWeight == FW_BOLD);
                            g_nFontHeight = lf.lfHeight;
                            g_bFontCharSet = lf.lfCharSet;

                            WriteProfileString(APPNAME, szFontFaceName, g_szFontFaceName);
                            WriteProfileInt(APPNAME, szFontHeight, g_nFontHeight);
                            WriteProfileInt(APPNAME, szFontBold, g_fFontBold);
                            WriteProfileInt(APPNAME, szFontCharSet, g_bFontCharSet);

                            GetFontPref();

                            view_changeviewoptions(current_view);
                            }
                    }
                    break;

                case IDM_LNRS:
                case IDM_RNRS:
                case IDM_NONRS:

                    /* option selects whether the line nrs displayed
                     * in expand mode are the line nrs in the left
                     * file, the right file or none
                     */

                    CheckMenuItem(GetMenu(hWnd),
                                  line_numbers, MF_UNCHECKED);
                    line_numbers = GET_WM_COMMAND_ID(wParam, lParam);
                    CheckMenuItem(GetMenu(hWnd), line_numbers, MF_CHECKED);
                    hr = StringCchPrintf(str, 32, szD, line_numbers);
          if (FAILED(hr))
            OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szLineNumbers, str);

                    /* change the display to show the line nr style
                     * chosen
                     */

                    view_changeviewoptions(current_view);
                    break;

                /*
                 * options selecting which lines to include in the
                 * expand listing, based on their state
                 */
                case IDM_EXPAND_INCSAME:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_SAME;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCSAME,
                              (expand_include & INCLUDE_SAME) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCLEFT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_LEFTONLY;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCLEFT,
                              (expand_include & INCLUDE_LEFTONLY) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCRIGHT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_RIGHTONLY;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCRIGHT,
                              (expand_include & INCLUDE_RIGHTONLY) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCMOVEDLEFT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_MOVEDLEFT;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCMOVEDLEFT,
                              (expand_include & INCLUDE_MOVEDLEFT) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCMOVEDRIGHT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_MOVEDRIGHT;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCMOVEDRIGHT,
                              (expand_include & INCLUDE_MOVEDRIGHT) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCSIMILARLEFT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_SIMILARLEFT;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCSIMILARLEFT,
                              (expand_include & INCLUDE_SIMILARLEFT) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCSIMILARRIGHT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_SIMILARRIGHT;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCSIMILARRIGHT,
                              (expand_include & INCLUDE_SIMILARRIGHT) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                    /*
                     * options selecting which files to include in the
                     * outline listing, based on their state
                     */
                case IDM_OUTLINE_INCLEFT:

                    /* toggle flag in outline_include options */
                    outline_include ^= INCLUDE_LEFTONLY;

                    /* check/uncheck as necessary */
                    CheckMenuItem(hMenu, IDM_OUTLINE_INCLEFT,
                                  (outline_include & INCLUDE_LEFTONLY) ?
                                  MF_CHECKED:MF_UNCHECKED);

                    hr = StringCchPrintf(str, 32, szD, outline_include);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szFileInclude, str);
                    view_changeviewoptions(current_view);

                    break;

                case IDM_OUTLINE_INCRIGHT:

                    outline_include ^= INCLUDE_RIGHTONLY;

                    CheckMenuItem(hMenu, IDM_OUTLINE_INCRIGHT,
                                  (outline_include & INCLUDE_RIGHTONLY) ?
                                  MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, outline_include);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szFileInclude, str);
                    view_changeviewoptions(current_view);

                    break;

                case IDM_OUTLINE_INCSAME:

                    outline_include ^= INCLUDE_SAME;

                    CheckMenuItem(hMenu, IDM_OUTLINE_INCSAME,
                                  (outline_include & INCLUDE_SAME) ?
                                  MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, outline_include);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szFileInclude, str);
                    view_changeviewoptions(current_view);

                    break;

                case IDM_OUTLINE_INCDIFFER:

                    outline_include ^= INCLUDE_DIFFER;

                    CheckMenuItem(hMenu, IDM_OUTLINE_INCDIFFER,
                                  (outline_include & INCLUDE_DIFFER) ?
                                  MF_CHECKED:MF_UNCHECKED);

                    hr = StringCchPrintf(str, 32, szD, outline_include);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szFileInclude, str);
                    view_changeviewoptions(current_view);

                    break;

                case IDM_UPDATE:
                    OnUpdate( (COMPITEM) lParam);
                    break;

                case IDM_RESCAN:
                    RescanFile(hWnd);

                    /* do we need to force any repaints? */
                    // - no, as RescanFile sends a IDM_UPDATE
                    break;

                case IDM_LONLY:
                case IDM_RONLY:
                case IDM_BOTHFILES:
                    /* option selects whether the expanded file
                     * show is the combined file, or just one
                     * or other of the input files.
                     *
                     * if we are not in expand mode, this also
                     * causes us to expand the selection
                     */

                    CheckMenuItem(GetMenu(hWnd), expand_mode, MF_UNCHECKED);
                    expand_mode = GET_WM_COMMAND_ID(wParam, lParam);
                    CheckMenuItem(GetMenu(hWnd), expand_mode, MF_CHECKED);

                    /* change the current view to show only the lines
                     * of the selected type.
                     */
                    if (DisplayMode == MODE_OUTLINE) {
                        ToExpand(hWnd);
                    } else {
                        view_changeviewoptions(current_view);
                    }

                    break;

                case IDM_IGNBLANKS:

                    /* if selected, ignore all spaces and tabs on
                     * comparison - expand view only: outline view
                     * will still show that 'text files differ'
                     */

                    ignore_blanks = !ignore_blanks;
                    CheckMenuItem(hMenu, IDM_IGNBLANKS,
                                  ignore_blanks? MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, ignore_blanks);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szBlanks, str);

                    /* invalidate all diffs since we have
                     * changed diff options, and re-do and display the
                     * current diff if we are in expand mode.
                     */
                    view_changediffoptions(current_view);

                    /* force repaint of bar window */
                    InvalidateRect(hwndBar, NULL, TRUE);

                    break;

                case IDM_SHOWWHITESPACE:

                        /* if selected, display all spaces and tabs in
                           the expanded text view */
                        show_whitespace = !show_whitespace;
                        CheckMenuItem(hMenu, IDM_SHOWWHITESPACE,
                                show_whitespace ? MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, show_whitespace);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szShowWhitespace, str);

                        // change the current view to show only the lines
                        // of the selected type.
                        if (DisplayMode == MODE_EXPAND) {
                                view_changeviewoptions(current_view);
                        }

                        break;

                case IDM_ALG2:

                    /* if selected, do algorithm2 which does not accept
                     * unsafe matches.
                     */

                    Algorithm2 = !Algorithm2;
                    CheckMenuItem(hMenu, IDM_ALG2,
                                  Algorithm2? MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, Algorithm2);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szAlgorithm2, str);

                    /* invalidate all diffs since we have
                     * changed diff options, and re-do and display the
                     * current diff if we are in expand mode.
                     */
                    view_changediffoptions(current_view);

                    /* force repaint of bar window */
                    InvalidateRect(hwndBar, NULL, TRUE);

                    break;

                case IDM_MONOCOLS:

                    /* Use monochrome colours - toggle */

                    mono_colours = !mono_colours;
                    CheckMenuItem(hMenu, IDM_MONOCOLS,
                                  mono_colours? MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, mono_colours);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szMonoColours, str);
                    if (mono_colours)
                        SetMonoColours();
                    else
                        SetColours();

                    /* The diffs are still valid, but force a re-display
                     * of bar window and main table.
                     */
                    SendMessage(hwndBar, WM_COMMAND, IDM_MONOCOLS, 0);
                    InvalidateRect(hwndBar, NULL, TRUE);
                    view_changeviewoptions(current_view);

                    break;

                case IDM_PICTURE:
                    picture_mode = !picture_mode;
                    CheckMenuItem(hMenu, IDM_PICTURE,
                                  picture_mode? MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, picture_mode);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szPicture, str);
                    DoResize(hWnd);
                    break;

                case IDM_HIDEMARK:
                    // toggle state of marked files hidden or not
                    hide_markedfiles = !hide_markedfiles;
                    CheckMenuItem(hMenu, IDM_HIDEMARK,
                                  hide_markedfiles? MF_CHECKED : MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, hide_markedfiles);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szHideMark, str);

                    // rebuild view with new global option
                    // - note that marks only affect outline views
                    if (!view_isexpanded(current_view)) {
                        view_changeviewoptions(current_view);
                    }
                    break;

                case IDM_FIND:
                  {
                  int nRet = IDCANCEL;
                  DLGPROC lpProc = (DLGPROC) MakeProcInstance((WINPROCTYPE) FindDlgProc, hInst);
                  if (lpProc)
                    {
                    char *pszFind = NULL;
                    sdkdiff_UI(TRUE);
                    nRet = (BOOL) DialogBoxParam(hInst, (LPCTSTR) IDD_FIND, hwndClient, lpProc, 0L);
                    sdkdiff_UI(FALSE);
                    FreeProcInstance(lpProc);
                    }
                  }
                  break;

                case IDM_FINDNEXT:
                  {
                  const LONG iCol = (view_isexpanded(current_view)) ? 2 : 1;
                  FindString(hWnd, iCol, NULL, 1, 0);
                  break;
                  }

                case IDM_FINDPREV:
                  {
                  const LONG iCol = (view_isexpanded(current_view)) ? 2 : 1;
                  FindString(hWnd, iCol, NULL, -1, 0);
                  break;
                  }

                case IDM_GOTOLINE:
                  {
                  if (!view_getrowcount(current_view))
                    {
                    MessageBox(hWnd, LoadRcString(IDS_GOTOLINE_NOLINES), szSdkDiff, MB_OK|MB_ICONSTOP|MB_TASKMODAL);
                    }
                  else
                    {
                    DLGPROC lpProc = (DLGPROC) MakeProcInstance((WINPROCTYPE)GoToLineDlgProc, hInst);
                    if (lpProc)
                      {
                      sdkdiff_UI(TRUE);
                      DialogBoxParam(hInst, (LPCTSTR) IDD_GOTOLINE, hwndClient, lpProc, 0L);
                      sdkdiff_UI(FALSE);
                      FreeProcInstance(lpProc);
                      }
                    }
                  }
                  break;

                case IDM_EDITCOPY:
                    {
                        unsigned long cb = 0;
                        LPCSTR pszText = NULL;
                        long iRow = 0;
                        const BOOL fOutline = !view_isexpanded(current_view);

                        /* first count total data size */
                        for (iRow = 0; iRow < selection_nrows; iRow++) {
                            if (fOutline) {
                                pszText = view_gettext(current_view, selection + iRow, 1);
                                if (!pszText)
                                    break;
                                cb += (lstrlen(pszText) + 3) * sizeof(char);
                            }

                            pszText = view_gettext(current_view, selection + iRow, 2);
                            if (!pszText)
                                break;
                            cb += (lstrlen(pszText)) * sizeof(char);
                        }

                        if (cb && OpenClipboard(NULL)) {
                            /* space for trailing nul char */
                            cb++;

                            /* copy data to clipboard */
                            if (EmptyClipboard()) {
                                HGLOBAL hData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,  cb);

                                if (hData) {
                                    void *pv = hData;
                                    if (!pv) {
                                        HeapFree(GetProcessHeap(), NULL, hData);
                                    }
                                    else {
                                        LPSTR pszBuf = (LPSTR) pv;
                                        memset(pv, 0, cb);

                                        for (iRow = 0; iRow < selection_nrows; iRow++) {
                                            if (fOutline) {
                                                pszText = view_gettext(current_view, selection + iRow, 1);
                                                if (!pszText)
                                                    break;

                                                hr = StringCchCopy(pszBuf, cb, pszText);
                        if (FAILED(hr))
                          OutputError(hr, IDS_SAFE_COPY);
                                                pszBuf += lstrlen(pszBuf);
                                                *(pszBuf++) = '\t';
                                                *pszBuf = 0;
                                            }

                                            pszText = view_gettext(current_view, selection + iRow, 2);
                                            if (!pszText)
                                                break;

                                            hr = StringCchCopy(pszBuf, cb, pszText);
                      if (FAILED(hr))
                        OutputError(hr, IDS_SAFE_COPY);
                                            pszBuf += lstrlen(pszBuf);

                                            if (fOutline) {
                                                *(pszBuf++) = '\r';
                                                *(pszBuf++) = '\n';
                                                *pszBuf = 0;
                                            }
                                        }

                                        SetClipboardData(CF_TEXT, hData);
                                    }
                                }
                            }
                            CloseClipboard();
                        }
                    }
                    break;

                case IDM_MARK:
                    {
                        BOOL bChanged = FALSE;
                        int i;

                        // toggle the mark on the current selection
                        // note that the selection could be multiple rows
                        for (i = 0; i < selection_nrows; i++) {

                            if (view_setmarkstate(current_view, selection + i,
                                                  !view_getmarkstate(current_view, selection + i))) {

                                bChanged = TRUE;
                            }
                        }

                        if (bChanged) {
                            // yes the mark state was changed - need
                            // to rebuild the view.
                            if (!view_isexpanded(current_view)) {
                                view_changeviewoptions(current_view);
                            }
                        }
                        break;
                    }

                case IDM_TOGGLEMARK:
                    // toggle the state of all files: unmark all
                    // marked files and vice versa
                    complist_togglemark(view_getcomplist(current_view));

                    // rebuild view
                    if (!view_isexpanded(current_view)) {
                        view_changeviewoptions(current_view);
                    }
                    break;

                case IDM_MARKPATTERN:
                    // dialog to query the pattern, then set a mark on
                    // all compitems whose title matches that pattern
                    // returns TRUE if anything was changed
                    if (complist_markpattern(view_getcomplist(current_view))) {

                        // rebuild view
                        if (!view_isexpanded(current_view)) {
                            view_changeviewoptions(current_view);
                        }
                    }
                    break;

                case IDM_EXPAND:

                    /* show the expanded view of the
                     * selected file
                     */
                    if (current_view != NULL) {
                        ToExpand(hWnd);
                    }

                    break;

                case IDM_OUTLINE:
                    /* return to the outline view (list of filenames) */
                    ToOutline(hWnd);

                    break;

                case IDM_FCHANGE:
                    /* find the next line in the current view
                     * that is not the same in both files -
                     * in outline view, finds the next filename that
                     * is not identical
                     */
                    FindNextChange();
                    break;

                case IDM_FPCHANGE:
                    /* same as IDM_FCHANGE, but going backwards from
                     * current position
                     */
                    FindPrevChange();
                    break;

                case IDM_FCHANGE_LAURIE:
                    /* same as IDM_FCHANGE, but tries to keep cursor on same
                     * line.
                     */
                    _FindNextChange(TRUE, FALSE);
                    break;

                case IDM_FPCHANGE_LAURIE:
                    /* same as IDM_FPCHANGE, but tries to keep cursor on same
                     * line.
                     */
                    _FindPrevChange(TRUE, FALSE);
                    break;

                    // given a line that has been moved, jump to the
                    // other representation of the same line.
                    // this used to be available just through double-click
                    // but now is also available from a context menu
                case IDM_TOMOVED:
                    ToMoved(hWnd, TRUE);
                    break;
            }
            break;

        case WM_SIZE:
            DoResize(hWnd);
            break;

        case WM_SETFOCUS:
            /* set the focus on the table class so it can process
             * page-up /pagedown keys etc.
             */
            SetFocus(hwndRCD);
            break;

        case WM_KEYDOWN:
            /* although the table window has the focus, he passes
             * back to us any keys he doesn't understand
             * We handle escape here to mean 'return to outline view'
             */
            if (wParam == VK_ESCAPE) {
                ToOutline(hWnd);
            } else if (wParam == VK_APPS) {
                // Handle the context menu keyboard key
                POINT posCursor;
                GetCursorPos(&posCursor);
                ScreenToClient(hwndRCD, &posCursor);
                OnRightClick(hWnd, posCursor.x, posCursor.y);
            }
            break;

        case WM_RBUTTONDOWN:
            /*
             * the table window handles this by performing the
             * selection and then passing the message to us, allowing
             * us to put up a context menu.
             */
            OnRightClick(hWnd, LOWORD(lParam), HIWORD(lParam));
            break;

        case WM_CLOSE:
            SendMessage(hWnd, WM_COMMAND, IDM_EXIT, 0);
            return TRUE;

            /* don't allow close when busy - process this message in
             * order to ensure this
             */
            break;

        case WM_DESTROY:
      TCHAR pszHelp[MAX_PATH];
      memset(pszHelp, 0, MAX_PATH);
      hr = StringCchCopy(pszHelp, MAX_PATH, pszWorkingDirectoryName);
      if (FAILED(hr))
        OutputError(hr, IDS_SAFE_COPY);
      hr = StringCchCat(pszHelp, MAX_PATH, "sdkdiff.hlp");
      if (FAILED(hr))
        OutputError(hr, IDS_SAFE_COPY);
            DeleteTools();
            WinHelp(hWnd, pszHelp, HELP_QUIT, 0);
            PostQuitMessage(0);
            break;

        case TM_CURRENTVIEW:
            /* allow other people such as the bar window to query the
             * current view
             */
            return((INT_PTR) current_view);

#ifdef LATER
#ifdef WM_MOUSEWHEEL
        case WM_MOUSEWHEEL:
            if (LOWORD(wParam) & MK_MBUTTON) {
                if ((short)HIWORD(wParam) < 0) {
                    // The next occurence
                    _FindNextChange(FALSE, TRUE);
                }
                else {
                    _FindPrevChange(FALSE, TRUE);
                }
            }
            break;
#endif
#endif

        case WM_QUERYENDSESSION:
            if (IsBusy())
                return FALSE;
            return TRUE;

        case WM_ENDSESSION:
            SendMessage(hWnd, WM_CLOSE, 0, 0);
            break;

        default:
            /* handle registered table messages */
            if (message == table_msgcode) {
                ret = TableServer(hWnd, wParam, lParam);
                return(ret);
            }
            return(DefWindowProc(hWnd, message, wParam, lParam));
    }
    return(0);
}

void PrintThread ( LPVOID )

Definition at line 986 of file Printer.c.

{
  DOCINFO di;
  RECT    rect;
  HPEN    hpen;
  HBRUSH  hbr;

  switch (LOWORD((WPARAM) wParam)) {
    case IDM_PRINT:
    {
      if (!strcmp (gszDeviceName, "Display"))
      {
        MessageBox (ghwndMain, GetStringRes(IDS_ASKSELPRT),
                    "PRINTER.EXE:", MB_OK);
        return;
      }
      else if (!(ghdc = CreateDC (gszDriverName, gszDeviceName, gszPort, NULL)))
      {
        MessageBox (ghwndMain, "PrintThread(): CreateDC() failed",
                    GetStringRes2(ERR_MOD_NAME), MB_OK);
        return;
      }
      break;
    }

    case IDM_PRINTDLG:
    {
      PRINTDLG  pd;

      //
      // Initialize a PRINTDLG struct and call PrintDlg to allow user to
      //   specify various printing options...
      //

      memset ((void *) &pd, 0, sizeof(PRINTDLG));

      pd.lStructSize = sizeof(PRINTDLG);
      pd.hwndOwner   = ghwndMain;
      pd.Flags       = PD_RETURNDC;
      pd.hInstance   = NULL;

      PrintDlg(&pd);
      ghdc = pd.hDC;

      if (pd.hDevMode)

        GlobalFree (pd.hDevMode);

      if (pd.hDevNames)

        GlobalFree (pd.hDevNames);

      if (!ghdc)
      {
        MessageBox (ghwndMain, GetStringRes(IDS_PRTDLGFAIL),
                    GetStringRes2(ERR_MOD_NAME), MB_OK);
        return;
      }
    }
  }

  //
  // put up Abort & install the abort procedure
  //

  gbAbort = FALSE;
  ghwndAbort = CreateDialog (ghInst, (LPCTSTR) "Abort", ghwndMain,
    (DLGPROC) AbortDlgProc);
  EnableWindow (ghwndMain, FALSE);
  SetAbortProc (ghdc, AbortProc);

  //
  // create & select pen/brush
  //

  hpen = CreatePen (giPenStyle, giPenWidth, gdwPenColor);
  SelectObject (ghdc, hpen);

  hbr  = CreateHatchBrush (giBrushStyle, gdwBrushColor);
  SelectObject (ghdc, hbr);

  SetTextColor (ghdc, gdwTextColor);

  SetMapMode (ghdc, giMapMode);

  SetRect(&rect, 0,0, GetDeviceCaps (ghdc, HORZRES), GetDeviceCaps (ghdc, VERTRES));

  di.cbSize      = sizeof(DOCINFO);
  di.lpszDocName = GetStringRes(IDS_PRTTST);
  di.lpszOutput  = NULL;
  di.fwType      = 0; // Windows 95 only; ignored on Windows NT

  StartDoc  (ghdc, &di);

  if (gdwGraphicsOptions) {

    Paint (ghdc, &rect);

  } else {
    LPSTR pBuf = GetStringRes(IDS_BLANKPG);
    TextOut (ghdc, 5, 5, (LPCTSTR) pBuf, (int) My_mbslen(pBuf));
  }

  // If we didn't abort the job
  if (!gbAbort)
  {
    EndPage   (ghdc);
    EndDoc    (ghdc);

    DestroyWindow (ghwndAbort);
  }

  // Clean up
  DeleteDC  (ghdc);
  DeleteObject(hpen);
  DeleteObject(hbr);

  EnableWindow  (ghwndMain, TRUE);
}

void RefreshPrinterCombobox ( HWND )

Definition at line 896 of file Printer.c.

{
  DWORD            dwFlags = PRINTER_ENUM_FAVORITE | PRINTER_ENUM_LOCAL;
  LPPRINTER_INFO_2 pPrinters;
  DWORD            cbPrinters;
  DWORD            cReturned, i;
  char             buf[BUFSIZE];

  SendMessage (hwndCombobox, CB_RESETCONTENT, 0, 0);

  //
  // add the "Display" option to the combobox
  //

  lstrcpyn (buf, "Display", BUFSIZE);
  SendMessage (hwndCombobox, CB_INSERTSTRING, (UINT)-1, (LONG_PTR) buf);

  //
  // get byte count needed for buffer, alloc buffer, the enum the printers
  //

  EnumPrinters (dwFlags, NULL, 2, NULL, 0, &cbPrinters,
                &cReturned);

  if (!(pPrinters = (LPPRINTER_INFO_2) LocalAlloc (LPTR, cbPrinters + 4)))
  {
    MessageBox (ghwndMain, (LPCTSTR) GetStringRes(IDS_LALLOCFAIL),
                (LPCTSTR)GetStringRes2(ERR_MOD_NAME), MB_OK | MB_ICONEXCLAMATION);
    goto done_refreshing;
  }

  if (!EnumPrinters (dwFlags, NULL, 2, (LPBYTE) pPrinters,
                     cbPrinters, &cbPrinters, &cReturned))
  {
    MessageBox (ghwndMain, (LPCTSTR) GetStringRes(IDS_ENUMPRTFAIL),
                (LPCTSTR) GetStringRes2(ERR_MOD_NAME), MB_OK | MB_ICONEXCLAMATION);
    goto done_refreshing;
  }

  if (cReturned > 0)

    for (i = 0; i < cReturned; i++)
    {
      //
      // for each printer in the PRINTER_INFO_2 array: build a string that
      //   looks like "DEVICE_NAME;PORT;DRIVER_NAME"
      //

      lstrcpyn (buf, (pPrinters + i)->pPrinterName, BUFSIZE);
      strncat (buf, ";", BUFSIZE - strlen(buf));
      strncat (buf, (pPrinters + i)->pPortName, BUFSIZE - strlen(buf));
      strncat (buf, ";", BUFSIZE - strlen(buf));
      strncat (buf, (pPrinters + i)->pDriverName, BUFSIZE - strlen(buf));

      SendMessage (hwndCombobox, CB_INSERTSTRING, (UINT)-1, (LONG_PTR) buf);
    }

  else

    MessageBox (ghwndMain, GetStringRes(IDS_NOPRTLST), "PRINTER.EXE", MB_OK);

done_refreshing:

  SendMessage (hwndCombobox, CB_SELECTSTRING, (UINT) -1, (LONG_PTR) buf);

  PostMessage (ghwndMain, WM_COMMAND,
               (WPARAM) MAKELONG (ID_COMBOBOX, CBN_SELCHANGE),
               (LPARAM) hwndCombobox);

  LocalFree (LocalHandle (pPrinters));
}

Variable Documentation

BRUSHSTYLELOOKUP gaBrushStyles[]
Initial value:

    { { IDM_BRUSHSTYLE_HORIZONTAL     , HS_HORIZONTAL     },
      { IDM_BRUSHSTYLE_VERTICAL       , HS_VERTICAL       },
      { IDM_BRUSHSTYLE_FDIAGONAL      , HS_FDIAGONAL      },
      { IDM_BRUSHSTYLE_BDIAGONAL      , HS_BDIAGONAL      },
      { IDM_BRUSHSTYLE_CROSS          , HS_CROSS          },
      { IDM_BRUSHSTYLE_DIAGCROSS      , HS_DIAGCROSS      } }

Definition at line 145 of file Printer.h.

GRAPHICLOOKUP gaGraphicLookup[]
Initial value:

    { { IDM_ARC        , ARC         },
      { IDM_ELLIPSE    , ELLIPSE     },
      { IDM_LINETO     , LINETO      },
      { IDM_PIE        , PIE         },
      { IDM_PLGBLT     , PLG_BLT     },
      { IDM_POLYBEZIER , POLYBEZIER  },
      { IDM_POLYGON    , POLYGON     },
      { IDM_POLYLINE   , POLYLINE    },
      { IDM_POLYPOLYGON, POLYPOLYGON },
      { IDM_RECTANGLE  , RECTANGLE   },
      { IDM_ROUNDRECT  , ROUNDRECT   },
      { IDM_STRETCHBLT , STRETCH_BLT } }

Definition at line 109 of file Printer.h.

MAPMODELOOKUP gaMMLookup[]
Initial value:

    { { IDM_HIENGLISH  , MM_HIENGLISH   },
      { IDM_HIMETRIC   , MM_HIMETRIC    },
      { IDM_LOENGLISH  , MM_LOENGLISH   },
      { IDM_LOMETRIC   , MM_LOMETRIC    },
      { IDM_TWIPS      , MM_TWIPS       },
      { IDM_ISOTROPIC  , MM_ISOTROPIC   },
      { IDM_ANISOTROPIC, MM_ANISOTROPIC },
      { IDM_TEXT       , MM_TEXT        } }

Definition at line 98 of file Printer.h.

PENSTYLELOOKUP gaPenStyles[]
Initial value:

    { { IDM_PENCOLOR_SOLID      , PS_SOLID      },
      { IDM_PENCOLOR_DASH       , PS_DASH       },
      { IDM_PENCOLOR_DOT        , PS_DOT        },
      { IDM_PENCOLOR_DASHDOT    , PS_DASHDOT    },
      { IDM_PENCOLOR_DASHDOTDOT , PS_DASHDOTDOT },
      { IDM_PENCOLOR_NULL       , PS_NULL       },
      { IDM_PENCOLOR_INSIDEFRAME, PS_INSIDEFRAME} }

Definition at line 135 of file Printer.h.

PENWIDTHLOOKUP gaPenWidths[]
Initial value:

    { { IDM_PENWIDTH_1, 1 },
      { IDM_PENWIDTH_2, 2 },
      { IDM_PENWIDTH_3, 3 },
      { IDM_PENWIDTH_4, 4 },
      { IDM_PENWIDTH_5, 5 },
      { IDM_PENWIDTH_6, 6 },
      { IDM_PENWIDTH_7, 7 },
      { IDM_PENWIDTH_8, 8 } }

Definition at line 124 of file Printer.h.

BOOL gbAbort

Definition at line 84 of file Printer.h.

DWORD gdwBrushColor = 0x0000ff

Definition at line 91 of file Printer.h.

DWORD gdwGraphicsOptions = DRAWAXIS

Definition at line 81 of file Printer.h.

DWORD gdwPenColor = 0x00ff00

Definition at line 90 of file Printer.h.

DWORD gdwTextColor = 0xff0000

Definition at line 92 of file Printer.h.

HDC ghdc

Definition at line 83 of file Printer.h.

HANDLE ghInst

Name of app.

Definition at line 77 of file Printer.h.

HWND ghwndAbort

Definition at line 79 of file Printer.h.

HWND ghwndMain

Definition at line 78 of file Printer.h.

int giBrushStyle = HS_HORIZONTAL

Definition at line 96 of file Printer.h.

int giMapMode = MM_TEXT

Definition at line 82 of file Printer.h.

int giPenStyle = PS_SOLID

Definition at line 94 of file Printer.h.

int giPenWidth = 1

Definition at line 95 of file Printer.h.

LONG glcyMenu

Definition at line 80 of file Printer.h.

char gszDeviceName[BUFSIZE]

Definition at line 86 of file Printer.h.

char gszDriverName[BUFSIZE]

Definition at line 88 of file Printer.h.

char gszPort[BUFSIZE]

Definition at line 87 of file Printer.h.

Generated on Wed Nov 13 2024 16:53:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/Printer/Resource.h File Reference

  • Multimedia
  • Gdi
  • Printer
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | DID_CANCEL 503
#define | DID_EDITTEXT 504
#define | DID_LISTBOX 502
#define | DID_OK 501
#define | ID_COMBOBOX 701
#define | IDC_STATIC -1
#define | IDM_ABOUT 108
#define | IDM_ALLGRAPHICS 313
#define | IDM_ANISOTROPIC 207
#define | IDM_ARC 301
#define | IDM_BRUSHSTYLE_BDIAGONAL 505
#define | IDM_BRUSHSTYLE_CROSS 506
#define | IDM_BRUSHSTYLE_DIAGCROSS 507
#define | IDM_BRUSHSTYLE_FDIAGONAL 504
#define | IDM_BRUSHSTYLE_HORIZONTAL 502
#define | IDM_BRUSHSTYLE_VERTICAL 503
#define | IDM_DRAWAXIS 316
#define | IDM_ELLIPSE 302
#define | IDM_ENUMFONTS 315
#define | IDM_ENUMPRINTERDRIVERS 106
#define | IDM_ENUMPRINTERS 104
#define | IDM_EXIT 40001
#define | IDM_GETDEVICECAPS 103
#define | IDM_GETPRINTERDRIVER 105
#define | IDM_HIENGLISH 201
#define | IDM_HIMETRIC 202
#define | IDM_ISOTROPIC 206
#define | IDM_LINETO 303
#define | IDM_LOENGLISH 203
#define | IDM_LOMETRIC 204
#define | IDM_NOGRAPHICS 314
#define | IDM_PENCOLOR_DASH 411
#define | IDM_PENCOLOR_DASHDOT 413
#define | IDM_PENCOLOR_DASHDOTDOT 414
#define | IDM_PENCOLOR_DOT 412
#define | IDM_PENCOLOR_INSIDEFRAME 416
#define | IDM_PENCOLOR_NULL 415
#define | IDM_PENCOLOR_SOLID 410
#define | IDM_PENWIDTH_1 402
#define | IDM_PENWIDTH_2 403
#define | IDM_PENWIDTH_3 404
#define | IDM_PENWIDTH_4 405
#define | IDM_PENWIDTH_5 406
#define | IDM_PENWIDTH_6 407
#define | IDM_PENWIDTH_7 408
#define | IDM_PENWIDTH_8 409
#define | IDM_PIE 304
#define | IDM_PLGBLT 305
#define | IDM_POLYBEZIER 306
#define | IDM_POLYGON 307
#define | IDM_POLYLINE 308
#define | IDM_POLYPOLYGON 309
#define | IDM_PRINT 101
#define | IDM_PRINTDLG 102
#define | IDM_RECTANGLE 310
#define | IDM_REFRESH 107
#define | IDM_ROUNDRECT 311
#define | IDM_SETBRUSHCOLOR 501
#define | IDM_SETPENCOLOR 401
#define | IDM_STRETCHBLT 312
#define | IDM_TEXT 208
#define | IDM_TEXTCOLOR 601
#define | IDM_TWIPS 205
#define | IDS_ASKDOMSRVNM 25
#define | IDS_ASKSELPRT 32
#define | IDS_BLANKPG 37
#define | IDS_ENUMPRT1FAIL 27
#define | IDS_ENUMPRTDRVRET0 28
#define | IDS_ENUMPRTFAIL 33
#define | IDS_ENUMPRTLALLOCFAIL 26
#define | IDS_ERR_ENUMPRT 20
#define | IDS_ERR_GETCAPS 18
#define | IDS_ERR_GETPDRIV 19
#define | IDS_ERR_PAINT 17
#define | IDS_ERR_PRINTER 16
#define | IDS_FMT_CREDCFAIL 31
#define | IDS_FMT_MOREDSPFNTNL 29
#define | IDS_FMT_OPNPRTFAIL 22
#define | IDS_GETDCFAIL 30
#define | IDS_GETPRTDRVFAIL 24
#define | IDS_LALLOCFAIL 23
#define | IDS_MAINWNDTITLE 21
#define | IDS_NOPRTLST 34
#define | IDS_PRTDLGFAIL 35
#define | IDS_PRTTST 36
#define | MAIN_ICON 1

Define Documentation

#define DID_CANCEL 503

Definition at line 81 of file Resource.h.

#define DID_EDITTEXT 504

Definition at line 83 of file Resource.h.

#define DID_LISTBOX 502

Definition at line 79 of file Resource.h.

#define DID_OK 501

Definition at line 77 of file Resource.h.

#define ID_COMBOBOX 701

Definition at line 88 of file Resource.h.

#define IDC_STATIC -1

Definition at line 90 of file Resource.h.

#define IDM_ABOUT 108

Definition at line 35 of file Resource.h.

#define IDM_ALLGRAPHICS 313

Definition at line 56 of file Resource.h.

#define IDM_ANISOTROPIC 207

Definition at line 42 of file Resource.h.

#define IDM_ARC 301

Definition at line 44 of file Resource.h.

#define IDM_BRUSHSTYLE_BDIAGONAL 505

Definition at line 84 of file Resource.h.

#define IDM_BRUSHSTYLE_CROSS 506

Definition at line 85 of file Resource.h.

#define IDM_BRUSHSTYLE_DIAGCROSS 507

Definition at line 86 of file Resource.h.

#define IDM_BRUSHSTYLE_FDIAGONAL 504

Definition at line 82 of file Resource.h.

#define IDM_BRUSHSTYLE_HORIZONTAL 502

Definition at line 78 of file Resource.h.

#define IDM_BRUSHSTYLE_VERTICAL 503

Definition at line 80 of file Resource.h.

#define IDM_DRAWAXIS 316

Definition at line 59 of file Resource.h.

#define IDM_ELLIPSE 302

Definition at line 45 of file Resource.h.

#define IDM_ENUMFONTS 315

Definition at line 58 of file Resource.h.

#define IDM_ENUMPRINTERDRIVERS 106

Definition at line 33 of file Resource.h.

#define IDM_ENUMPRINTERS 104

Definition at line 31 of file Resource.h.

#define IDM_EXIT 40001

Definition at line 89 of file Resource.h.

#define IDM_GETDEVICECAPS 103

Definition at line 30 of file Resource.h.

#define IDM_GETPRINTERDRIVER 105

Definition at line 32 of file Resource.h.

#define IDM_HIENGLISH 201

Definition at line 36 of file Resource.h.

#define IDM_HIMETRIC 202

Definition at line 37 of file Resource.h.

#define IDM_ISOTROPIC 206

Definition at line 41 of file Resource.h.

#define IDM_LINETO 303

Definition at line 46 of file Resource.h.

#define IDM_LOENGLISH 203

Definition at line 38 of file Resource.h.

#define IDM_LOMETRIC 204

Definition at line 39 of file Resource.h.

#define IDM_NOGRAPHICS 314

Definition at line 57 of file Resource.h.

#define IDM_PENCOLOR_DASH 411

Definition at line 70 of file Resource.h.

#define IDM_PENCOLOR_DASHDOT 413

Definition at line 72 of file Resource.h.

#define IDM_PENCOLOR_DASHDOTDOT 414

Definition at line 73 of file Resource.h.

#define IDM_PENCOLOR_DOT 412

Definition at line 71 of file Resource.h.

#define IDM_PENCOLOR_INSIDEFRAME 416

Definition at line 75 of file Resource.h.

#define IDM_PENCOLOR_NULL 415

Definition at line 74 of file Resource.h.

#define IDM_PENCOLOR_SOLID 410

Definition at line 69 of file Resource.h.

#define IDM_PENWIDTH_1 402

Definition at line 61 of file Resource.h.

#define IDM_PENWIDTH_2 403

Definition at line 62 of file Resource.h.

#define IDM_PENWIDTH_3 404

Definition at line 63 of file Resource.h.

#define IDM_PENWIDTH_4 405

Definition at line 64 of file Resource.h.

#define IDM_PENWIDTH_5 406

Definition at line 65 of file Resource.h.

#define IDM_PENWIDTH_6 407

Definition at line 66 of file Resource.h.

#define IDM_PENWIDTH_7 408

Definition at line 67 of file Resource.h.

#define IDM_PENWIDTH_8 409

Definition at line 68 of file Resource.h.

#define IDM_PIE 304

Definition at line 47 of file Resource.h.

#define IDM_PLGBLT 305

Definition at line 48 of file Resource.h.

#define IDM_POLYBEZIER 306

Definition at line 49 of file Resource.h.

#define IDM_POLYGON 307

Definition at line 50 of file Resource.h.

#define IDM_POLYLINE 308

Definition at line 51 of file Resource.h.

#define IDM_POLYPOLYGON 309

Definition at line 52 of file Resource.h.

#define IDM_PRINT 101

Definition at line 28 of file Resource.h.

#define IDM_PRINTDLG 102

Definition at line 29 of file Resource.h.

#define IDM_RECTANGLE 310

Definition at line 53 of file Resource.h.

#define IDM_REFRESH 107

Definition at line 34 of file Resource.h.

#define IDM_ROUNDRECT 311

Definition at line 54 of file Resource.h.

#define IDM_SETBRUSHCOLOR 501

Definition at line 76 of file Resource.h.

#define IDM_SETPENCOLOR 401

Definition at line 60 of file Resource.h.

#define IDM_STRETCHBLT 312

Definition at line 55 of file Resource.h.

#define IDM_TEXT 208

Definition at line 43 of file Resource.h.

#define IDM_TEXTCOLOR 601

Definition at line 87 of file Resource.h.

#define IDM_TWIPS 205

Definition at line 40 of file Resource.h.

#define IDS_ASKDOMSRVNM 25

Definition at line 15 of file Resource.h.

#define IDS_ASKSELPRT 32

Definition at line 22 of file Resource.h.

#define IDS_BLANKPG 37

Definition at line 27 of file Resource.h.

#define IDS_ENUMPRT1FAIL 27

Definition at line 17 of file Resource.h.

#define IDS_ENUMPRTDRVRET0 28

Definition at line 18 of file Resource.h.

#define IDS_ENUMPRTFAIL 33

Definition at line 23 of file Resource.h.

#define IDS_ENUMPRTLALLOCFAIL 26

Definition at line 16 of file Resource.h.

#define IDS_ERR_ENUMPRT 20

Definition at line 10 of file Resource.h.

#define IDS_ERR_GETCAPS 18

Definition at line 8 of file Resource.h.

#define IDS_ERR_GETPDRIV 19

Definition at line 9 of file Resource.h.

#define IDS_ERR_PAINT 17

Definition at line 7 of file Resource.h.

#define IDS_ERR_PRINTER 16

Definition at line 6 of file Resource.h.

#define IDS_FMT_CREDCFAIL 31

Definition at line 21 of file Resource.h.

#define IDS_FMT_MOREDSPFNTNL 29

Definition at line 19 of file Resource.h.

#define IDS_FMT_OPNPRTFAIL 22

Definition at line 12 of file Resource.h.

#define IDS_GETDCFAIL 30

Definition at line 20 of file Resource.h.

#define IDS_GETPRTDRVFAIL 24

Definition at line 14 of file Resource.h.

#define IDS_LALLOCFAIL 23

Definition at line 13 of file Resource.h.

#define IDS_MAINWNDTITLE 21

Definition at line 11 of file Resource.h.

#define IDS_NOPRTLST 34

Definition at line 24 of file Resource.h.

#define IDS_PRTDLGFAIL 35

Definition at line 25 of file Resource.h.

#define IDS_PRTTST 36

Definition at line 26 of file Resource.h.

#define MAIN_ICON 1

Definition at line 5 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/PrintJob/dialogs.c File Reference

  • Multimedia
  • Gdi
  • PrintJob
Classes | Defines | Typedefs | Functions | Variables

dialogs.c File Reference

#include <windows.h>
#include "resource.h"
#include "PrintJob.h"
#include "Dialogs.h"

Go to the source code of this file.

Classes

struct | _stringstruct

Defines

#define | STRICT

Typedefs

typedef struct _stringstruct | STRSIZE

Functions

LRESULT CALLBACK | About (HWND hDlg, UINT message, WPARAM uParam, LPARAM lParam)
LRESULT CALLBACK | GetPrinterDlgProc (HWND hDlg, UINT message, WPARAM uParam, LPARAM lParam)
BOOL | GetPrinterPath (HWND hWnd, char *pszPrinter, short cchStrSize)

Variables

HINSTANCE | g_hInst

Define Documentation

#define STRICT

Definition at line 21 of file dialogs.c.

Typedef Documentation

typedef struct _stringstruct STRSIZE

Function Documentation

LRESULT CALLBACK About | ( | HWND | hDlg,
 |  | UINT | message,
 |  | WPARAM | uParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 163 of file dialogs.c.

{
    static  HFONT hfontDlg;
    LPSTR   lpVersion;
    DWORD   dwVerInfoSize;
    DWORD   dwVerHnd;
    UINT    uVersionLen;
    int     iRootLen;
    BOOL    bRetCode;
    int     i;
    char    szFullPath[256];
    char    szResult[256];
    char    szGetName[256];

    switch (message) {
        case WM_INITDIALOG:  // message: initialize dialog box
            // Center the dialog over the application window
            CenterWindow (hDlg, GetWindow (hDlg, GW_OWNER));

            // Get version information from the application
            GetModuleFileName (g_hInst, szFullPath, sizeof(szFullPath));
            dwVerInfoSize = GetFileVersionInfoSize(szFullPath, &dwVerHnd);
            if (dwVerInfoSize) {
                    // If we were able to get the information, process it:
                    LPSTR   lpstrVffInfo;
                    HANDLE  hMem;
                    hMem = GlobalAlloc(GMEM_MOVEABLE, dwVerInfoSize);
                    lpstrVffInfo  = GlobalLock(hMem);
                    GetFileVersionInfo(szFullPath, dwVerHnd, dwVerInfoSize, lpstrVffInfo);
                    lstrcpyn(szGetName, "\\StringFileInfo\\040904e4\\", 256);
                    iRootLen = lstrlen(szGetName);

                    // Walk through the dialog items that we want to replace:
                    for (i = IDC_FILEDESCRIPTION; i <= IDC_LEGALTRADEMARKS; i++) {
                            GetDlgItemText(hDlg, i, szResult, sizeof(szResult));
                            szGetName[iRootLen] = (char)0;
                            strncat (szGetName, szResult, 256 - strlen(szGetName));
                            uVersionLen   = 0;
                            lpVersion     = NULL;
                            bRetCode      =  VerQueryValue((LPVOID)lpstrVffInfo,
                                    (LPSTR)szGetName,
                                    (LPVOID)&lpVersion,
                                     &uVersionLen);

                            if ( bRetCode && uVersionLen && lpVersion) {
                                    // Replace dialog item text with version info
                                    lstrcpyn(szResult, lpVersion, 256);
                                    SetDlgItemText(hDlg, i, szResult);
                            }
                    }

                    GlobalUnlock(hMem);
                    GlobalFree(hMem);
            } // if (dwVerInfoSize)
            // Create a font to use
            hfontDlg = CreateFont(12, 0, 0, 0, 0, 0, 0, 0,
                    0, 0, 0, 0,
                    VARIABLE_PITCH | FF_SWISS, "");

            // Walk through the dialog items and change font
            for (i = IDC_FILEDESCRIPTION; i <= IDC_LEGALTRADEMARKS; i++)
                SendMessage (GetDlgItem (hDlg, i), WM_SETFONT, (WPARAM)hfontDlg, TRUE);

            return (TRUE);

        case WM_COMMAND:                      // message: received a command
            if (LOWORD(uParam) == IDOK        // "OK" box selected?
            || LOWORD(uParam) == IDCANCEL) {  // System menu close command?
                    EndDialog(hDlg, TRUE);        // Exit the dialog
                    DeleteObject (hfontDlg);
                    return (TRUE);
            }
            break;
    }
    return (FALSE); // Didn't process the message

    lParam; // This will prevent 'unused formal parameter' warnings

} /* end of function About */

LRESULT CALLBACK GetPrinterDlgProc | ( | HWND | hDlg,
 |  | UINT | message,
 |  | WPARAM | uParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 66 of file dialogs.c.

{
static  STRSIZE *pDlgParam;  /* keep the dialog's parameters around */

    switch (message)
    {
        case WM_INITDIALOG:  /* message: initialize dialog box*/
            CenterWindow (hDlg, GetWindow (hDlg, GW_OWNER));

            pDlgParam = (STRSIZE *)lParam;
            SetDlgItemText(hDlg, IDC_EDITSELECTPRINTER, pDlgParam->pszStr);

            return (TRUE);

        case WM_COMMAND:
            switch (LOWORD(uParam))
            {
                case IDOK:              /* "OK" button selected? */
                    GetDlgItemText(hDlg, IDC_EDITSELECTPRINTER, pDlgParam->pszStr, pDlgParam->cSize);
                    EndDialog(hDlg, TRUE);
                    return TRUE;

                case IDCANCEL:          /* Exit the dialog */
                    EndDialog(hDlg, FALSE);
                    return (TRUE);
            }
            break;
    }
    return (FALSE); /* Didn't process the message */

} /* end of function GetPrinterDialogProc */

BOOL GetPrinterPath | ( | HWND | hWnd,
 |  | char * | pszPrinter,
 |  | short | cchStrSize
 | ) |  |

Definition at line 125 of file dialogs.c.

{
    STRSIZE dlgParameters = {0};
  dlgParameters.pszStr = pszPrinter;
  dlgParameters.cSize = cchStrSize;

    return  (BOOL)  DialogBoxParam(g_hInst,              /* current instance of app */
          MAKEINTRESOURCE(IDD_SELECTPRINTER), /* dialog template */
          hWnd,                               /* parent of the dialog */
          (DLGPROC)GetPrinterDlgProc,         /* dialog procedure */
          (LPARAM)&dlgParameters);            /* the string for the printer's name */

} /* end of function GetPrinterPath */

Variable Documentation

HINSTANCE g_hInst

Definition at line 62 of file DoServer.Cpp.

Generated on Wed Nov 13 2024 16:53:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/PrintJob/dialogs.h File Reference

  • Multimedia
  • Gdi
  • PrintJob
Functions

dialogs.h File Reference

Go to the source code of this file.

Functions

LRESULT CALLBACK | About (HWND, UINT, WPARAM, LPARAM)
LRESULT CALLBACK | GetPrinterDlgProc (HWND hDlg, UINT message, WPARAM uParam, LPARAM lParam)
BOOL | GetPrinterPath (HWND hWnd, char *pszPrinter, short cchStrSize)

Function Documentation

LRESULT CALLBACK About | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 445 of file Generic.C.

{
   static  HFONT hfontDlg;    // Font for dialog text
   static   HFONT hFinePrint; // Font for 'fine print' in dialog
   DWORD   dwVerInfoSize;     // Size of version information block
   LPSTR   lpVersion;         // String pointer to 'version' text
   DWORD   dwVerHnd=0;        // An 'ignored' parameter, always '0'
   UINT    uVersionLen;
   WORD    wRootLen;
   BOOL    bRetCode;
   int     i;
   char    szFullPath[BUFFSIZE];
   char    szResult[BUFFSIZE];
   char    szGetName[BUFFSIZE];
   DWORD dwVersion;
   char  szVersion[40];
   DWORD dwResult;
   HRESULT hRes;

   switch (message) {
        case WM_INITDIALOG:
         ShowWindow (hDlg, SW_HIDE);

         if (PRIMARYLANGID(GetUserDefaultLangID()) == LANG_JAPANESE)
         {
            hfontDlg = CreateFont(14, 0, 0, 0, 0, 0, 0, 0, SHIFTJIS_CHARSET, 0, 0, 0,
                                  VARIABLE_PITCH | FF_DONTCARE, "");
            hFinePrint = CreateFont(11, 0, 0, 0, 0, 0, 0, 0, SHIFTJIS_CHARSET, 0, 0, 0,
                                    VARIABLE_PITCH | FF_DONTCARE, "");
         }
         else
         {
            hfontDlg = CreateFont(14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                  VARIABLE_PITCH | FF_SWISS, "");
            hFinePrint = CreateFont(11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                    VARIABLE_PITCH | FF_SWISS, "");
         }

         CenterWindow (hDlg, GetWindow (hDlg, GW_OWNER));
         GetModuleFileName (hInst, szFullPath, sizeof(szFullPath));

         // Now lets dive in and pull out the version information:
         dwVerInfoSize = GetFileVersionInfoSize(szFullPath, &dwVerHnd);
         if (dwVerInfoSize) {
            LPSTR   lpstrVffInfo;
            HANDLE  hMem;
            hMem = GlobalAlloc(GMEM_MOVEABLE, dwVerInfoSize);
            lpstrVffInfo  = GlobalLock(hMem);
            GetFileVersionInfo(szFullPath, dwVerHnd, dwVerInfoSize, lpstrVffInfo);
            // The below 'hex' value looks a little confusing, but
            // essentially what it is, is the hexidecimal representation
            // of a couple different values that represent the language
            // and character set that we are wanting string values for.
            // 040904E4 is a very common one, because it means:
            //   US English, Windows MultiLingual characterset
            // Or to pull it all apart:
            // 04------        = SUBLANG_ENGLISH_USA
            // --09----        = LANG_ENGLISH
            // --11----        = LANG_JAPANESE
            // ----04E4 = 1252 = Codepage for Windows:Multilingual

            // Use safe string handling
            szGetName[sizeof(szGetName) - 1] = '\0';
            lstrcpyn(szGetName, GetStringRes(IDS_VER_INFO_LANG), sizeof(szGetName) - 1);
            if (szGetName[sizeof(szGetName) - 1] != '\0') {
                return FALSE; // Buffer overflow error
            }

            wRootLen = (WORD) lstrlen(szGetName); // Save this position

            // Set the title of the dialog using safe string handling
            hRes = StringCchCatN(szGetName, sizeof(szGetName), "ProductName", sizeof("ProductName"));
            if (FAILED(hRes)) {
                return FALSE; // Buffer overflow error
            }

            bRetCode = VerQueryValue((LPVOID)lpstrVffInfo,
               (LPSTR)szGetName,
               (LPVOID)&lpVersion,
               (UINT *)&uVersionLen);

            // Notice order of version and string...
            if (PRIMARYLANGID(GetUserDefaultLangID()) == LANG_JAPANESE)
            {
                // Use safe string handling
                hRes = StringCchCopyN(szResult, sizeof(szResult), lpVersion, lstrlen(lpVersion));
                if (FAILED(hRes)) {
                    return FALSE; // Buffer overflow error
                }
                hRes = StringCchCatN(szResult, sizeof(szResult), " ‚Ìƒo[ƒWƒ‡ƒ“î•ñ", sizeof(" ‚Ìƒo[ƒWƒ‡ƒ“î•ñ"));
                if (FAILED(hRes)) {
                    return FALSE; // Buffer overflow error
                }
            }
            else
            {
                // Use safe string handling
                hRes = StringCchCopyN(szResult, sizeof(szResult), "About ", sizeof("About "));
                if (FAILED(hRes)) {
                    return FALSE; // Buffer overflow error
                }
                hRes = StringCchCatN(szResult, sizeof(szResult), lpVersion, lstrlen(lpVersion));
                if (FAILED(hRes)) {
                    return FALSE; // Buffer overflow error
                }
            }

            // -----------------------------------------------------

            SetWindowText (hDlg, szResult);

            // Walk through the dialog items that we want to replace:
            for (i = DLG_VERFIRST; i <= DLG_VERLAST; i++) {
               GetDlgItemText(hDlg, i, szResult, sizeof(szResult));
               szGetName[wRootLen] = (char)0;
               // Use safe sting handling
               hRes = StringCchCatN(szGetName, sizeof(szGetName), szResult, sizeof(szResult));
               if (FAILED(hRes)) {
                   return FALSE; // Buffer overflow error
               }
               uVersionLen   = 0;
               lpVersion     = NULL;
               bRetCode      =  VerQueryValue((LPVOID)lpstrVffInfo,
                  (LPSTR)szGetName,
                  (LPVOID)&lpVersion,
                  (UINT *)&uVersionLen);

               if ( bRetCode && uVersionLen && lpVersion) {
                   // Replace dialog item text with version info
                   // Use safe string handling
                   hRes = StringCchCopyN(szResult, sizeof(szResult), lpVersion, lstrlen(lpVersion));
                   if (FAILED(hRes)) {
                       return FALSE; // Buffer overflow error
                   }
                   SetDlgItemText(hDlg, i, szResult);
               }
               else
               {
                  dwResult = GetLastError();

                  // Use safe string handling
                  hRes = StringCchPrintf(szResult, sizeof(szResult), GetStringRes(IDS_VERSION_ERROR), dwResult);
                  if (FAILED(hRes)) {
                      return FALSE; // Buffer overflow error
                  }

                  SetDlgItemText (hDlg, i, szResult);
               }
               SendMessage (GetDlgItem (hDlg, i), WM_SETFONT,
                  (ULONG_PTR)((i==DLG_VERLAST)?hFinePrint:hfontDlg),
                  TRUE);
            } // for (i = DLG_VERFIRST; i <= DLG_VERLAST; i++)

            GlobalUnlock(hMem);
            GlobalFree(hMem);

         } else {
            // No version information available.
         } // if (dwVerInfoSize)

            SendMessage (GetDlgItem (hDlg, IDC_LABEL), WM_SETFONT,
            (WPARAM)hfontDlg,(LPARAM)TRUE);

         // We are  using GetVersion rather then GetVersionEx
         // because earlier versions of Windows NT and Win32s
         // didn't include GetVersionEx:
         dwVersion = GetVersion();

         if (dwVersion < 0x80000000) {
            // Windows NT
            // Use safe sting handling
            hRes = StringCchPrintf(szVersion, sizeof(szVersion), "Microsoft Windows NT %u.%u (Build: %u)",
                (DWORD)(LOBYTE(LOWORD(dwVersion))),
                (DWORD)(HIBYTE(LOWORD(dwVersion))),
                (DWORD)(HIWORD(dwVersion)) );
            if (FAILED(hRes)) {
                return FALSE; // Buffer overflow error
            }
         } else if (LOBYTE(LOWORD(dwVersion))<4) {
            // Win32s
            // Use safe sting handling
            hRes = StringCchPrintf(szVersion, sizeof(szVersion), "Microsoft Win32s %u.%u (Build: %u)",
                (DWORD)(LOBYTE(LOWORD(dwVersion))),
                (DWORD)(HIBYTE(LOWORD(dwVersion))),
                (DWORD)(HIWORD(dwVersion) & ~0x8000) );
            if (FAILED(hRes)) {
                return FALSE; // Buffer overflow error
            }
         } else {
            // Windows 95
            // Use safe sting handling
            hRes = StringCchPrintf(szVersion, sizeof(szVersion), "Microsoft Windows 95 %u.%u",
                (DWORD)(LOBYTE(LOWORD(dwVersion))),
                (DWORD)(HIBYTE(LOWORD(dwVersion))) );
            if (FAILED(hRes)) {
                return FALSE; // Buffer overflow error
            }
         }

          SetWindowText (GetDlgItem(hDlg, IDC_OSVERSION), szVersion);
         ShowWindow (hDlg, SW_SHOW);
         return (TRUE);

      case WM_COMMAND:
         if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) {
            EndDialog(hDlg, TRUE);
            DeleteObject (hfontDlg);
            DeleteObject (hFinePrint);
            return (TRUE);
         }
         break;
   }

    return FALSE;
}

LRESULT CALLBACK GetPrinterDlgProc | ( | HWND | hDlg,
 |  | UINT | message,
 |  | WPARAM | uParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 66 of file dialogs.c.

{
static  STRSIZE *pDlgParam;  /* keep the dialog's parameters around */

    switch (message)
    {
        case WM_INITDIALOG:  /* message: initialize dialog box*/
            CenterWindow (hDlg, GetWindow (hDlg, GW_OWNER));

            pDlgParam = (STRSIZE *)lParam;
            SetDlgItemText(hDlg, IDC_EDITSELECTPRINTER, pDlgParam->pszStr);

            return (TRUE);

        case WM_COMMAND:
            switch (LOWORD(uParam))
            {
                case IDOK:              /* "OK" button selected? */
                    GetDlgItemText(hDlg, IDC_EDITSELECTPRINTER, pDlgParam->pszStr, pDlgParam->cSize);
                    EndDialog(hDlg, TRUE);
                    return TRUE;

                case IDCANCEL:          /* Exit the dialog */
                    EndDialog(hDlg, FALSE);
                    return (TRUE);
            }
            break;
    }
    return (FALSE); /* Didn't process the message */

} /* end of function GetPrinterDialogProc */

BOOL GetPrinterPath | ( | HWND | hWnd,
 |  | char * | pszPrinter,
 |  | short | cchStrSize
 | ) |  |

Definition at line 125 of file dialogs.c.

{
    STRSIZE dlgParameters = {0};
  dlgParameters.pszStr = pszPrinter;
  dlgParameters.cSize = cchStrSize;

    return  (BOOL)  DialogBoxParam(g_hInst,              /* current instance of app */
          MAKEINTRESOURCE(IDD_SELECTPRINTER), /* dialog template */
          hWnd,                               /* parent of the dialog */
          (DLGPROC)GetPrinterDlgProc,         /* dialog procedure */
          (LPARAM)&dlgParameters);            /* the string for the printer's name */

} /* end of function GetPrinterPath */

Generated on Wed Nov 13 2024 16:53:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/PrintJob/errors.c File Reference

  • Multimedia
  • Gdi
  • PrintJob
Defines | Functions

errors.c File Reference

#include <Windows.h>
#include "Errors.h"

Go to the source code of this file.

Defines

#define | MAX_MSG_BUF_SIZE 512
#define | STRICT

Functions

void | ErrorBox (DWORD dwError, LPCSTR lpszString)

Define Documentation

#define MAX_MSG_BUF_SIZE 512
#define STRICT

Definition at line 20 of file errors.c.

Function Documentation

void ErrorBox | ( | DWORD | dwError,
 |  | LPCSTR | lpszString
 | ) |  |

Definition at line 38 of file errors.c.

{
#define MAX_MSG_BUF_SIZE 512
    char    *msgBuf;
    DWORD   cMsgLen;

    cMsgLen = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM |
                FORMAT_MESSAGE_ALLOCATE_BUFFER | 40,
                NULL, dwError,
                MAKELANGID(0, SUBLANG_ENGLISH_US),
                (LPTSTR) &msgBuf, MAX_MSG_BUF_SIZE,
                NULL);

    MessageBox( NULL, msgBuf, lpszString, MB_OK );

    LocalFree( msgBuf );
#undef MAX_MSG_BUF_SIZE
}

Generated on Wed Nov 13 2024 16:53:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/PrintJob/errors.h File Reference

  • Multimedia
  • Gdi
  • PrintJob
Functions

errors.h File Reference

Go to the source code of this file.

Functions

void ErrorBox (DWORD dwError, LPCSTR lpszString)

Function Documentation

void ErrorBox | ( | DWORD | dwError,
 |  | LPCSTR | lpszString
 | ) |  |

Definition at line 38 of file errors.c.

{
#define MAX_MSG_BUF_SIZE 512
    char    *msgBuf;
    DWORD   cMsgLen;

    cMsgLen = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM |
                FORMAT_MESSAGE_ALLOCATE_BUFFER | 40,
                NULL, dwError,
                MAKELANGID(0, SUBLANG_ENGLISH_US),
                (LPTSTR) &msgBuf, MAX_MSG_BUF_SIZE,
                NULL);

    MessageBox( NULL, msgBuf, lpszString, MB_OK );

    LocalFree( msgBuf );
#undef MAX_MSG_BUF_SIZE
}

Generated on Wed Nov 13 2024 16:53:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/PrintJob/printjob.c File Reference

  • Multimedia
  • Gdi
  • PrintJob
Defines | Functions | Variables

printjob.c File Reference

#include <windows.h>
#include "resource.h"
#include "Queue.h"
#include "QueList.h"
#include "Dialogs.h"
#include "Threads.h"
#include "PrintJob.h"
#include "QueCore.h"

Go to the source code of this file.

Defines

#define | IS_NT (BOOL)(GetVersion() < 0x80000000)
#define | PrinterNameSize 200
#define | STRICT

Functions

BOOL | CenterWindow (HWND hwndChild, HWND hwndParent)
BOOL CloseInstance (HANDLE)
BOOL | GetQueue (QUEUEDATA *pQueueData)
BOOL | InitApplication (HINSTANCE hInstance)
BOOL InitApplication (HANDLE)
BOOL | InitInstance (HANDLE, int)
BOOL | InitInstance (HINSTANCE hInstance, int nCmdShow)
BOOL | IsPrinterHandle (HANDLE hPrinter)
void | MakeJobStatusStr (char *szBuffer, short cchChars, DWORD dwStatus)
void | MakePrinterStatusStr (char *pBuffer, short nChars, DWORD dwStatus)
BOOL | OnPrinterNotificationOption (HWND hWnd, char *pszPrinterName, HANDLE *pThreadHandle)
BOOL | OnSelectPrinter (HWND hWnd, char *pszPrinterName, unsigned short cbNameSize, HANDLE *pThreadHandle)
void | Refresh (HWND hWnd, QUEUEDATA *pQueue)
BOOL | RefreshFromNotification (HWND hWnd, QUEUEDATA *pQueue, PRINTER_NOTIFY_INFO *pNotification)
BOOL | UpdateQueue (QUEUEDATA *pQueueData, PRINTER_NOTIFY_INFO *pPNI)
void | UpdateWindowTitle (HWND hWnd, QUEUEDATA *pQueue)
int CALLBACK | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
LRESULT CALLBACK | WndProc (HWND hWnd, UINT message, WPARAM uParam, LPARAM lParam)

Variables

HINSTANCE | g_hInst
char | g_szAppName [] = "PrintJob"
char | g_szTitle [] = "Print Job Viewer"

Define Documentation

#define IS_NT (BOOL)(GetVersion() < 0x80000000)

Definition at line 136 of file printjob.c.

#define PrinterNameSize 200

Definition at line 137 of file printjob.c.

#define STRICT

Definition at line 112 of file printjob.c.

Function Documentation

BOOL CenterWindow | ( | HWND | hwndChild,
 |  | HWND | hwndParent
 | ) |  |

Definition at line 765 of file printjob.c.

{
        RECT    rChild, rParent;
        int     wChild, hChild, wParent, hParent;
        int     wScreen, hScreen, xNew, yNew;
        HDC     hdc;

        // Get the Height and Width of the child window
        GetWindowRect (hwndChild, &rChild);
        wChild = rChild.right - rChild.left;
        hChild = rChild.bottom - rChild.top;

        // Get the Height and Width of the parent window
        GetWindowRect (hwndParent, &rParent);
        wParent = rParent.right - rParent.left;
        hParent = rParent.bottom - rParent.top;

        // Get the display limits
        hdc = GetDC (hwndChild);
        wScreen = GetDeviceCaps (hdc, HORZRES);
        hScreen = GetDeviceCaps (hdc, VERTRES);
        ReleaseDC (hwndChild, hdc);

        // Calculate new X position, then adjust for screen
        xNew = rParent.left + ((wParent - wChild) /2);
        if (xNew < 0)
        {
            xNew = 0;
        } else if ((xNew+wChild) > wScreen)
        {
            xNew = wScreen - wChild;
        }

        // Calculate new Y position, then adjust for screen
        yNew = rParent.top  + ((hParent - hChild) /2);
        if (yNew < 0)
        {
            yNew = 0;
        }
        else if ((yNew+hChild) > hScreen)
        {
            yNew = hScreen - hChild;
        }

        // Set it, and return
        return SetWindowPos (hwndChild,
                             NULL,
                             xNew,
                             yNew,
                             0,
                             0,
                             SWP_NOSIZE | SWP_NOZORDER);

} /* end of function CenterWindow */

BOOL CloseInstance ( HANDLE hInst )

Definition at line 358 of file printjob.c.

{

    DestroyThreadSyncResources();

    return TRUE;

} /* end of function CloseInstance */

BOOL GetQueue ( QUEUEDATA * pQueueData )

Definition at line 1234 of file printjob.c.

{
    DWORD               cByteNeeded,
                        cByteUsed,
                        i;
    int                 nReturned=0;
    JOB_INFO_2          *pJobStorage = NULL;
    PRINTER_INFO_2      *pPrinterInfo = NULL;
    HANDLE              hPrinter = pQueueData->Printer.hPrinter;

    if (hPrinter)
    {
        /* Get the buffer size needed */
        if (!GetPrinter(hPrinter, 2, NULL, 0, &cByteNeeded))
        {
            if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
                goto Fail;
        }

        pPrinterInfo = (PRINTER_INFO_2 *)malloc(cByteNeeded);
        if (!(pPrinterInfo))
            /* failure to allocate memory */
            goto Fail;

        /* get the printer info */
        if (!GetPrinter(hPrinter, 2, (LPBYTE)pPrinterInfo, cByteNeeded, &cByteUsed))
        {
            /* failure to access the printer */
            free(pPrinterInfo);
            pPrinterInfo = NULL;
            goto Fail;
        }

        /* Get job storage space */
        if (!EnumJobs(hPrinter,
                 0,
                 (pPrinterInfo)->cJobs,
                 2,
                 NULL,
                 0,
                 (LPDWORD)&cByteNeeded,
                 (LPDWORD)&nReturned))
        {
            if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
                goto Fail;
        }

        pJobStorage = (JOB_INFO_2 *)malloc(cByteNeeded);
        if (!pJobStorage)
            /* failure to allocate Job storage space */
            goto Fail;

        ZeroMemory(pJobStorage, cByteNeeded);

        /* get the list of jobs */
        if (!EnumJobs(hPrinter,
                 0,
                 (pPrinterInfo)->cJobs,
                 2,
                 (LPBYTE)pJobStorage,
                 cByteNeeded,
                 (LPDWORD)&cByteUsed,
                 (LPDWORD)&nReturned))
        {
            goto Fail;
        }

        /* Update the count of jobs
         * It is possible for cJobs != nReturned after this sequence so
         * we reset the printer data structure to only reflect what we
         * actually retrieved this time around
         */
        (pPrinterInfo)->cJobs = nReturned;

    }
    else
        goto Fail;

    SetPrinterQueueData(pQueueData, pPrinterInfo);

    /* Dump the existing data */
    FreeJobs(pQueueData);

    /* Fill in the Printer Queue with the jobs we retrieved */
    for (i = 0; i < pPrinterInfo->cJobs; i++)
        AddJobData(pQueueData, &pJobStorage[i]);

    free(pJobStorage);
    free(pPrinterInfo);

    return TRUE;

Fail:

    free(pJobStorage);
    free(pPrinterInfo);
    return FALSE;

} /* end of function GetQueue */

BOOL InitApplication ( HINSTANCE hInstance )

Definition at line 253 of file printjob.c.

{
        WNDCLASS  wc;

        // Fill in window class structure with parameters that describe the
        // main window.

        wc.style         = 0;                      // Class style(s).
        wc.lpfnWndProc   = (WNDPROC)WndProc;       // Window Procedure
        wc.cbClsExtra    = 0;                      // No per-class extra data.
        wc.cbWndExtra    = 0;                      // No per-window extra data.
        wc.hInstance     = hInstance;              // Owner of this class
        wc.hIcon         = LoadIcon (hInstance, MAKEINTRESOURCE(IDI_APP)); // Icon name from .RC
        wc.hCursor       = LoadCursor(NULL, IDC_ARROW);// Cursor
        wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);// Default color
        wc.lpszMenuName  = MAKEINTRESOURCE(IDR_PRINTJOB); // Menu from .RC
        wc.lpszClassName = g_szAppName;              // Name to register as

        // Register the window class and return success/failure code.
        return (RegisterClass(&wc));
} /* end of function InitApplication */

BOOL InitApplication ( HANDLE )

Definition at line 123 of file ClipText.c.

{
    WNDCLASS  wc = {0};

    wc.lpfnWndProc = (WNDPROC) MainWndProc;
    wc.hInstance = hInstance;
    wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
    wc.hCursor = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
    wc.lpszMenuName =  TEXT("CliptextMenu");
    wc.lpszClassName = TEXT("CliptextWClass");

    return (RegisterClass(&wc));
}

BOOL InitInstance | ( | HANDLE | ,
 |  | int |
 | ) |  |

Definition at line 126 of file ComDlg32.C.

{
    HWND            hWnd;

  // Save off the handle to the current instance.
    g_hInst = hInstance;

    // Create a main window for this application instance.
    hWnd = CreateWindow(
        "Comdlg32WClass",
        "Common Dialog Sample Application",
        WS_OVERLAPPEDWINDOW,            // Window style.
        CW_USEDEFAULT,                  // Default horizontal position.
        CW_USEDEFAULT,                  // Default vertical position.
        CW_USEDEFAULT,                  // Default width.
        CW_USEDEFAULT,                  // Default height.
        NULL,                           // Overlapped windows have no parent.
        NULL,                           // Use the window class menu.
        g_hInst,                        // This instance owns this window.
        NULL                            // Pointer not needed.
    );

    // If window could not be created, return "failure".
    if (!hWnd)
        return (FALSE);

    // Register the window messages to receive.
    cdmsgShareViolation = RegisterWindowMessage(szmsgSHAREVIOLATION);
    cdmsgFileOK         = RegisterWindowMessage(szmsgFILEOK);
    cdmsgHelp           = RegisterWindowMessage(szCommdlgHelp);

    // Make the window visible; update its client area; and return "success".
    ShowWindow(hWnd, nCmdShow);
    UpdateWindow(hWnd);
    return (TRUE);

}

BOOL InitInstance | ( | HINSTANCE | hInstance,
 |  | int | nCmdShow
 | ) |  |

Definition at line 293 of file printjob.c.

{
        HWND            hWnd; /* Main window handle. */

        // Save the instance handle in static variable, which will be used in
        // many subsequent calls from this application to Windows.

        g_hInst = hInstance; // Store instance handle in our global variable

        // This application uses common controls, make sure they are ready
        InitCommonControls();

        // Create synchronization objects, if not, return "failure"
        if (!CreateThreadSyncResources())
        {
            return (FALSE);
        }

        // Create a main window for this application instance.
        hWnd = CreateWindow(
                g_szAppName,           // See RegisterClass() call.
                g_szTitle,             // Text for window title bar.
                WS_OVERLAPPEDWINDOW, // Window style.
                CW_USEDEFAULT, 0,
                CW_USEDEFAULT, 0,    // Use default positioning but adjusted for size
                NULL,                // Overlapped windows have no parent.
                NULL,                // Use the window class menu.
                hInstance,           // This instance owns this window.
                NULL                 // We don't use any data in our WM_CREATE
        );

        // If window could not be created, return "failure"
        if (!hWnd)
        {
            DestroyThreadSyncResources();
            return (FALSE);
        }

        // Make the window visible; update its client area; and return "success"
        ShowWindow(hWnd, nCmdShow); // Show the window
        UpdateWindow(hWnd);         // Sends WM_PAINT message

        return (TRUE);              // We succeeded...

} /* end of function InitInstance */

BOOL IsPrinterHandle ( HANDLE hPrinter )

Definition at line 382 of file printjob.c.

{
    DWORD       cbNeeded;
    DWORD       Error;
    BOOL        fRet = TRUE;

    // Test if the handle is to a printer by asking how big
    // a buffer is needed to describe it.
    if( !GetPrinter(hPrinter, 2, (LPBYTE)NULL, 0, &cbNeeded ))
    {
        // The function failed so the handle might not be a printer
        Error = GetLastError( );
        fRet = FALSE;

        if( Error == ERROR_INSUFFICIENT_BUFFER )
        {
            // Apparently the handle was a printer, but as expected
            // We didn't give it a buffer
            fRet = TRUE;
        }
        // Else, the handle is not to a valid printer
    }
    return fRet;

} /* end of function IsPrinterHandle */

void MakeJobStatusStr | ( | char * | szBuffer,
 |  | short | cchChars,
 |  | DWORD | dwStatus
 | ) |  |

Definition at line 879 of file printjob.c.

{
    DWORD   dwClearBits = 0;
    char    szTmp[MAX_PATH];

    szTmp[0] = 0;

    /*
     * Accumulate a status string from the set bits.
     * Terminate when we have processed all of the bits.
     */
    while (dwStatus)
    {
        /* Seperate multiple status phrases with a hyphen */
        if (dwClearBits)
            strncat(szTmp, " - ", MAX_PATH - strlen(szTmp));

        if (JOB_STATUS_SPOOLING & dwStatus)
        {
            strncat(szTmp, "Spooling", MAX_PATH - strlen(szTmp));
            dwClearBits |= JOB_STATUS_SPOOLING;
        }
        else if (JOB_STATUS_PRINTING & dwStatus)
        {
            strncat(szTmp, "Printing", MAX_PATH - strlen(szTmp));
            dwClearBits |= JOB_STATUS_PRINTING;
        }
        else if (JOB_STATUS_DELETING & dwStatus)
        {
            strncat(szTmp, "Deleting", MAX_PATH - strlen(szTmp));
            dwClearBits |= JOB_STATUS_DELETING;
        }
        else if (JOB_STATUS_PAUSED & dwStatus)
        {
            strncat(szTmp, "Paused", MAX_PATH - strlen(szTmp));
            dwClearBits |= JOB_STATUS_PAUSED;
        }
        else if (JOB_STATUS_PRINTED & dwStatus)
        {
            strncat(szTmp, "Printed", MAX_PATH - strlen(szTmp));
            dwClearBits |= JOB_STATUS_PRINTED;
        }
        else if (JOB_STATUS_DELETED & dwStatus)
        {
            strncat(szTmp, "Deleted", MAX_PATH - strlen(szTmp));
            dwClearBits |= JOB_STATUS_DELETED;
        }
        else if (JOB_STATUS_ERROR & dwStatus)
        {
            strncat(szTmp, "Error", MAX_PATH - strlen(szTmp));
            dwClearBits |= JOB_STATUS_ERROR;
        }
        else if (JOB_STATUS_OFFLINE & dwStatus)
        {
            strncat(szTmp, "Offline", MAX_PATH - strlen(szTmp));
            dwClearBits |= JOB_STATUS_OFFLINE;
        }
        else if (JOB_STATUS_PAPEROUT & dwStatus)
        {
            strncat(szTmp, "Paper Out", MAX_PATH - strlen(szTmp));
            dwClearBits |= JOB_STATUS_PAPEROUT;
        }
        else if (JOB_STATUS_BLOCKED_DEVQ & dwStatus)
        {
            strncat(szTmp, "Blocked Device", MAX_PATH - strlen(szTmp));
            dwClearBits |= JOB_STATUS_BLOCKED_DEVQ;
        }
        else if (JOB_STATUS_USER_INTERVENTION & dwStatus)
        {
            strncat(szTmp, "Intervention Required", MAX_PATH - strlen(szTmp));
            dwClearBits |= JOB_STATUS_USER_INTERVENTION;
        }
        else if (JOB_STATUS_RESTART & dwStatus)
        {
            strncat(szTmp, "Restarting", MAX_PATH - strlen(szTmp));
            dwClearBits |= JOB_STATUS_RESTART;
        }
        else
        {
            /* if we get here, the OS knows more than us. */
            strncat(szTmp, "Unkown", MAX_PATH - strlen(szTmp));
            dwClearBits = dwStatus;
        }

        /* Clear whatever bit we just processed */
        dwStatus = dwStatus & ~dwClearBits;
    }

    lstrcpyn(szBuffer, szTmp, cchChars);
    szBuffer[cchChars-1] = 0;

} /* end of function MakeJobStatus */

void MakePrinterStatusStr | ( | char * | pBuffer,
 |  | short | nChars,
 |  | DWORD | dwStatus
 | ) |  |

Definition at line 991 of file printjob.c.

{
    char *  pszStr = NULL;

    /* Pick which string to use */
    switch(dwStatus)
    {
        case PRINTER_STATUS_PAUSED:
            pszStr = "Paused";
            break;
        case PRINTER_STATUS_OFFLINE:
            pszStr = "Offline";
            break;
        case PRINTER_STATUS_PAPER_OUT:
            pszStr = "Paper Out";
            break;
        case PRINTER_STATUS_PAPER_JAM:
            pszStr = "Paper Jam";
            break;
        case PRINTER_STATUS_PAPER_PROBLEM:
            pszStr = "Paper Problem";
            break;
        case PRINTER_STATUS_ERROR:
            pszStr = "Error";
            break;
        case PRINTER_STATUS_PRINTING:
            pszStr = "Printing";
            break;
        case PRINTER_STATUS_OUTPUT_BIN_FULL:
            pszStr = "Output Bin Full";
            break;
        case PRINTER_STATUS_USER_INTERVENTION:
            pszStr = "User Intervention Required";
            break;
        case PRINTER_STATUS_MANUAL_FEED:
            pszStr = "Manual Feed";
            break;
        case PRINTER_STATUS_IO_ACTIVE:
            pszStr = "IO Active";
            break;
        case PRINTER_STATUS_BUSY:
            pszStr = "Busy";
            break;
        case PRINTER_STATUS_NOT_AVAILABLE:
            pszStr = "Not Available";
            break;
        case PRINTER_STATUS_PENDING_DELETION:
            pszStr = "Deleting";
            break;
        case PRINTER_STATUS_WAITING:
            pszStr = "Waiting";
            break;
        case PRINTER_STATUS_PROCESSING:
            pszStr = "Processing";
            break;
        case PRINTER_STATUS_INITIALIZING:
            pszStr = "Initializing";
            break;
        case PRINTER_STATUS_WARMING_UP:
            pszStr = "Warming Up";
            break;
        case PRINTER_STATUS_TONER_LOW:
            pszStr = "Low Toner";
            break;
        case PRINTER_STATUS_NO_TONER:
            pszStr = "No Toner";
            break;
        case PRINTER_STATUS_PAGE_PUNT:
            pszStr = "Page Punt";
            break;
        case PRINTER_STATUS_OUT_OF_MEMORY:
            pszStr = "Out of Memory";
            break;
        case PRINTER_STATUS_DOOR_OPEN:
            pszStr = "Door Open";
            break;
        case PRINTER_STATUS_SERVER_UNKNOWN:
            pszStr = "Unknown Server";
            break;
        case PRINTER_STATUS_POWER_SAVE:
            pszStr = "Power Save";
            break;
        default:
            /* The OS knows more than us */
            pszStr = "Unkown Status";
            break;
    }

    /* Copy the string into the buffer */
    lstrcpyn(pBuffer, pszStr, cchChars);
    pBuffer[cchChars-1] = 0;

} /* end of function MakePrinterStatusStr */

BOOL OnPrinterNotificationOption | ( | HWND | hWnd,
 |  | char * | pszPrinterName,
 |  | HANDLE * | pThreadHandle
 | ) |  |

Definition at line 529 of file printjob.c.

{
    HMENU   hOptionsMenu;
    HANDLE  hNewPrinter;
    HANDLE  hThread = NULL;

    hOptionsMenu = GetSubMenu(GetMenu(hWnd), 1);
    hNewPrinter = NULL;

    /*
     * If we are currently running a thread,
     * get a new printer handle since the thread owns
     * the one we passed it and we are going to start
     * a new thread with the same printer.
     */
    if (ActiveUpdateThread())
    {
        if (!OpenPrinter(pszPrinterName, &hNewPrinter, NULL))
        {
            /* Bogus printer name */
            hNewPrinter = NULL;

            /* Bail */
            return FALSE;
        }

    }

    if (g_fUsePrinterChanges)
    {
        /* Switch back to polling */
        g_fUsePrinterChanges = FALSE;
        CheckMenuItem(hOptionsMenu, IDM_PRINTERNOTIFICATION, MF_UNCHECKED | MF_BYCOMMAND);
        if (hNewPrinter)
        {
            hThread = StartPolling(hWnd, hNewPrinter, *pThreadHandle);
        }

    }
    else
    {
        /* Switch to using Printer Change Notifictions on NT */
        g_fUsePrinterChanges = TRUE;
        CheckMenuItem(hOptionsMenu, IDM_PRINTERNOTIFICATION, MF_CHECKED | MF_BYCOMMAND);
        if (hNewPrinter)
        {
            hThread = StartNotifications(hWnd, hNewPrinter, *pThreadHandle);
        }
    }

    *pThreadHandle = hThread;
    return TRUE;

} /* end of function OnPrinterNotificationOption */

BOOL OnSelectPrinter | ( | HWND | hWnd,
 |  | char * | pszPrinterName,
 |  | unsigned short | cbNameSize,
 |  | HANDLE * | pThreadHandle
 | ) |  |

Definition at line 426 of file printjob.c.

{
    HANDLE hNewPrinter = NULL;
    HANDLE hThread;

    /*
     * Present the user with Printer Selection Dialog until success or cancel
     */

    // Loop unless dialog canceled
    while (GetPrinterPath(hWnd, pszPrinterName, cbNameSize))
    {
        // OK button pressed, see if the printer name is recognized.
        if (OpenPrinter(pszPrinterName, &hNewPrinter, NULL) && IsPrinterHandle ( hNewPrinter ))
        {
            /*
             * On NT, a valid printer name is the Printer Name or
             * a UNC share name. Note that for printer connections, the Printer
             * name appears in the printer folder in a parsed form:
             * "[PrinterName] on [Server]" corresponds to an actual pPrinterName of
             * "\\[Server]\[PrinterName]" - where [PrinterName] is the pPrinterName
             * on the Server.
             *
             * On Windows 95 a valid printer name is the port(e.g. LPTX:),
             * Printer name, or UNC share name. Printer Name and share name are
             * unambigous, but if a port is given, OpenPrinter returns a handle to
             * the first Printer it encounters using that port.
             */

            if (!g_fUsePrinterChanges)
            /* if application not using Printer Change Notification's, use polling */
            {
                /*
                 * Start a new polling thread to refresh the
                 * Job list.
                 */
                hThread = StartPolling(hWnd, hNewPrinter, *pThreadHandle);
            }
            else
            {
                /*
                 * On Windows NT, the application can use
                 * Printer Change Notifications which are more
                 * efficient.
                 */
                hThread = StartNotifications(hWnd, hNewPrinter, *pThreadHandle);
            }

            *pThreadHandle = hThread;
            return TRUE;
        }
        else // nope, user typed in something that was wrong
        {
            if (hNewPrinter)
                ClosePrinter ( hNewPrinter );
            /*
             * Tell the user we do not recognize their selection.
             */
            if (MessageBox(hWnd,
                "The printer name you specified cannot be found.",
                "Printer Selection Error", MB_OKCANCEL | MB_ICONSTOP)
                == IDCANCEL)
                // User asked to leave, break out of loop
                break;
        }

    }

    return FALSE;

} /* end of function OnSelecPrinter */

void Refresh | ( | HWND | hWnd,
 |  | QUEUEDATA * | pQueue
 | ) |  |

Definition at line 845 of file printjob.c.

{
    /* retrieve job info from the printer */
    if (GetQueue(pQueue))
    {
        /* update the list boxes */
        SetQueListContents(g_hWndJobList, pQueue);

        /* update queue status in window caption */
        UpdateWindowTitle(hWnd, pQueue);
    }

} /* end of function Refresh */

BOOL RefreshFromNotification | ( | HWND | hWnd,
 |  | QUEUEDATA * | pQueue,
 |  | PRINTER_NOTIFY_INFO * | pNotification
 | ) |  |

Definition at line 1106 of file printjob.c.

{

    if (pNotification)
    {
        /* Update Our Data */
        UpdateQueue(pQueue, pNotification);

        /* update the list boxes */
        SetQueListContents(g_hWndJobList, pQueue);

        /* Always Update the Window Title */
        UpdateWindowTitle(hWnd, pQueue);

    }

    return TRUE;

} /* end of function RefreshFromNotification */

BOOL UpdateQueue | ( | QUEUEDATA * | pQueueData,
 |  | PRINTER_NOTIFY_INFO * | pPNI
 | ) |  |

Definition at line 1205 of file printjob.c.

{
    unsigned int        i;

    for (i=0; i < pPNI->Count; i++)
    {
        if (!UpdateJobData(pQueueData, &pPNI->aData[i]))
            UpdatePrinterData(pQueueData, &pPNI->aData[i]);
    }

    return TRUE;
}

void UpdateWindowTitle | ( | HWND | hWnd,
 |  | QUEUEDATA * | pQueue
 | ) |  |

Definition at line 1144 of file printjob.c.

{
    char        WindowTitle[200];
    PRINTERDATA *pPd = &pQueue->Printer;

    /* Start with application title */
    lstrcpyn(WindowTitle, g_szTitle, 200);

    /* Append printer queue information */
    strncat(WindowTitle, ": ", 200-strlen(WindowTitle));

    if (pPd->pszPrinterName && lstrlen(pPd->pszPrinterName) > 0)
    {
        lstrcat(WindowTitle, pPd->pszPrinterName);
    }
    else if (pPd->pszServerName && pPd->pszShareName)
    {
        strncat(WindowTitle, pPd->pszServerName, 200-strlen(WindowTitle));
        strncat(WindowTitle, "\\", 200-strlen(WindowTitle));
        strncat(WindowTitle, pPd->pszShareName, 200-strlen(WindowTitle));
    }
    else
    {
        strncat(WindowTitle, "Unknown", 200-strlen(WindowTitle));
    }

    /* append status of the printer queue */
    if (pPd->dwStatus)
    {
        strncat(WindowTitle, " - ", 200-strlen(WindowTitle));

        /* insert the printer status after the "-" */
        MakePrinterStatusStr(&WindowTitle[lstrlen(WindowTitle)],
            (short)(sizeof(WindowTitle) - lstrlen(WindowTitle)),
            pPd->dwStatus);
    }

    SetWindowText(hWnd, WindowTitle);

} /* end of function UpdateWindowTitle */

int CALLBACK WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 185 of file printjob.c.

{

        MSG msg;
        HANDLE hAccelTable;

        if (!hPrevInstance) {       // Other instances of app running?
            if (!InitApplication(hInstance)) { // Initialize shared things
                return (FALSE);     // Exits if unable to initialize
            }
        }

        /* Perform initializations that apply to a specific instance */

        if (!InitInstance(hInstance, nCmdShow)) {
            return (FALSE);
        }

        hAccelTable = LoadAccelerators (hInstance, MAKEINTRESOURCE(IDR_PRINTJOB));

        /* Acquire and dispatch messages until a WM_QUIT message is received. */

        while (GetMessage(&msg, // message structure
            NULL,   // handle of window receiving the message
            0,      // lowest message to examine
            0))     // highest message to examine
        {
            if (!TranslateAccelerator (msg.hwnd, hAccelTable, &msg))
            {
                TranslateMessage(&msg);// Translates virtual key codes
                DispatchMessage(&msg); // Dispatches message to window
            }
        }

        CloseInstance(hInstance);

        return (int)(msg.wParam); // Returns the value from PostQuitMessage

        lpCmdLine; // This will prevent 'unused formal parameter' warnings

} /* end of function WinMain */

LRESULT CALLBACK WndProc | ( | HWND | hWnd,
 |  | UINT | message,
 |  | WPARAM | uParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 613 of file printjob.c.

{
        int     wmId, wmEvent;
static  char    PrinterName[PrinterNameSize]; // Name of Printer Selected, kept as a convenience to the user
static  HANDLE  hListUpdateThread = NULL;   // handle to thread which updates the job list

        switch (message)
        {
            case WM_CREATE:
            {
                HMENU   hOptionsMenu = GetSubMenu(GetMenu(hWnd), 1);

                /* Variable initialization */
                lstrcpyn(PrinterName, "", PrinterNameSize);

                /* Create the control to display printer info */
                g_hWndJobList = CreateQueList(hWnd);

                /*
                 * Enable use of the Printer Notifications Option on NT,
                 * the option is disabled by default in the resources.
                 */
                if (IS_NT)
                {
                    EnableMenuItem(hOptionsMenu, IDM_PRINTERNOTIFICATION, MF_ENABLED | MF_BYCOMMAND);
                }

                break;
            }

            case WM_SIZE:
            {
                /* resize list box windows to match main window */
                ResizeQueList(g_hWndJobList, hWnd);
                break;
            }
            case WM_ERASEBKGND:
            {
                /*
                 * Don't let the client area be painted since our
                 * list view control covers it entirely.
                 * This prevents disco flicker.
                 */
                break;
            }

            case WM_COMMAND:  // message: command from application menu
            {
                wmId    = LOWORD(uParam);
                wmEvent = HIWORD(uParam);

                switch (wmId)
                {
                    case IDM_ABOUT:
                    {
                        DialogBox(g_hInst,                      // current instance
                                MAKEINTRESOURCE(IDD_ABOUTBOX),  // dlg resource to use
                                hWnd,                           // parent handle
                                (DLGPROC)About);                // About() instance address
                        break;
                    }

                    case IDM_SELECTPRINTER:
                    {
                        OnSelectPrinter(hWnd, PrinterName, sizeof(PrinterName), &hListUpdateThread);
                        break;
                    }

                    case IDM_PRINTERNOTIFICATION:
                    {
                        if (IS_NT)
                        {
                            OnPrinterNotificationOption(hWnd, PrinterName, &hListUpdateThread);
                        }
                        break;
                    }

                    case IDM_EXIT:
                    {
                        PostMessage(hWnd, WM_CLOSE, 0, 0);
                        break;
                    }

                    case ID_FILE_REFRESH:
                    {
                        TriggerUpdateThreadRefresh();
                        break;
                    }

                    default:
                        return (DefWindowProc(hWnd, message, uParam, lParam));
                }
                break;
            }

            case WM_CLOSE:
            {
                /* Close any thread and free its resources */
                if (ActiveUpdateThread())
                {
                    /*
                     * Can't close down yet because a thread is running,
                     * ask the thread to terminate and close the app down
                     * when it is done.
                     */
                    StopUpdateThread(hListUpdateThread, TRUE);
                    break;
                }

                /*
                 * Otherwise, no thread running
                 */
                CloseHandle(hListUpdateThread);
                hListUpdateThread = NULL;
                DestroyWindow (hWnd);
                break;
            }

            case WM_DESTROY:  // message: window being destroyed
            {
                /* Quit the Message Loop */
                PostQuitMessage(0);
                break;
            }

            default:          // Passes it on if unproccessed
                return (DefWindowProc(hWnd, message, uParam, lParam));
        }
        return (0);

} /* end of function WndProc */

Variable Documentation

HINSTANCE g_hInst

Definition at line 125 of file printjob.c.

char g_szAppName[] = "PrintJob"

Definition at line 127 of file printjob.c.

char g_szTitle[] = "Print Job Viewer"

Definition at line 128 of file printjob.c.

Generated on Wed Nov 13 2024 16:53:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/PrintJob/printjob.h File Reference

  • Multimedia
  • Gdi
  • PrintJob
Functions

printjob.h File Reference

Go to the source code of this file.

Functions

BOOL | CenterWindow (HWND hwndChild, HWND hwndParent)
LRESULT CALLBACK | WndProc (HWND, UINT, WPARAM, LPARAM)

Function Documentation

BOOL CenterWindow | ( | HWND | hwndChild,
 |  | HWND | hwndParent
 | ) |  |

Definition at line 676 of file Generic.C.

{
   RECT    rChild, rParent, rWorkArea;
   int     wChild, hChild, wParent, hParent;
   int     xNew, yNew;
   BOOL  bResult;

   // Get the Height and Width of the child window
   GetWindowRect (hwndChild, &rChild);
   wChild = rChild.right - rChild.left;
   hChild = rChild.bottom - rChild.top;

   // Get the Height and Width of the parent window
   GetWindowRect (hwndParent, &rParent);
   wParent = rParent.right - rParent.left;
   hParent = rParent.bottom - rParent.top;

   // Get the limits of the 'workarea'
   bResult = SystemParametersInfo(
      SPI_GETWORKAREA,  // system parameter to query or set
      sizeof(RECT),
      &rWorkArea,
      0);
   if (!bResult) {
      rWorkArea.left = rWorkArea.top = 0;
      rWorkArea.right = GetSystemMetrics(SM_CXSCREEN);
      rWorkArea.bottom = GetSystemMetrics(SM_CYSCREEN);
   }

   // Calculate new X position, then adjust for workarea
   xNew = rParent.left + ((wParent - wChild) /2);
   if (xNew < rWorkArea.left) {
      xNew = rWorkArea.left;
   } else if ((xNew+wChild) > rWorkArea.right) {
      xNew = rWorkArea.right - wChild;
   }

   // Calculate new Y position, then adjust for workarea
   yNew = rParent.top  + ((hParent - hChild) /2);
   if (yNew < rWorkArea.top) {
      yNew = rWorkArea.top;
   } else if ((yNew+hChild) > rWorkArea.bottom) {
      yNew = rWorkArea.bottom - hChild;
   }

   // Set it, and return
   return SetWindowPos (hwndChild, NULL, xNew, yNew, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
}

LRESULT CALLBACK WndProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 290 of file Generic.C.

{
   int wmId, wmEvent;
   PAINTSTRUCT ps;
   HDC hdc;
      POINT pnt;
   HMENU hMenu;
      BOOL bGotHelp;

   switch (message) {

      case WM_COMMAND:
         wmId    = LOWORD(wParam); // Remember, these are...
         wmEvent = HIWORD(wParam); // ...different for Win32!

         //Parse the menu selections:
         switch (wmId) {

            case IDM_ABOUT:
               DialogBox(hInst, "AboutBox", hWnd, (DLGPROC)About);
               break;

            case IDM_EXIT:
               DestroyWindow (hWnd);
               break;

            case IDM_HELPTOPICS: // Only called in Windows 95
               bGotHelp = WinHelp (hWnd, APPNAME".HLP", HELP_FINDER,(DWORD)0);
               if (!bGotHelp)
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            case IDM_HELPCONTENTS: // Not called in Windows 95
               bGotHelp = WinHelp (hWnd, APPNAME".HLP", HELP_CONTENTS,(DWORD)0);
               if (!bGotHelp)
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            case IDM_HELPSEARCH: // Not called in Windows 95
               if (!WinHelp(hWnd, APPNAME".HLP", HELP_PARTIALKEY,
                           (ULONG_PTR)(LPSTR)""))
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            case IDM_HELPHELP: // Not called in Windows 95
               if(!WinHelp(hWnd, (LPSTR)NULL, HELP_HELPONHELP, 0))
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            // Here are all the other possible menu options,
            // all of these are currently disabled:
            case IDM_NEW:
            case IDM_OPEN:
            case IDM_SAVE:
            case IDM_SAVEAS:
            case IDM_UNDO:
            case IDM_CUT:
            case IDM_COPY:
            case IDM_PASTE:
            case IDM_LINK:
            case IDM_LINKS:

            default:
               return (DefWindowProc(hWnd, message, wParam, lParam));
         }
         break;

      case WM_NCRBUTTONUP: // RightClick on windows non-client area...
         if (IS_WIN95 && SendMessage(hWnd, WM_NCHITTEST, 0, lParam) == HTSYSMENU)
         {
            // The user has clicked the right button on the applications
            // 'System Menu'. Here is where you would alter the default
            // system menu to reflect your application. Notice how the
            // explorer deals with this. For this app, we aren't doing
            // anything
            return (DefWindowProc(hWnd, message, wParam, lParam));
         } else {
            // Nothing we are interested in, allow default handling...
            return (DefWindowProc(hWnd, message, wParam, lParam));
         }
            break;

        case WM_RBUTTONDOWN: // RightClick in windows client area...
            pnt.x = LOWORD(lParam);
            pnt.y = HIWORD(lParam);
            ClientToScreen(hWnd, (LPPOINT) &pnt);
      // This is where you would determine the appropriate 'context'
      // menu to bring up. Since this app has no real functionality,
      // we will just bring up the 'Help' menu:
            hMenu = GetSubMenu (GetMenu (hWnd), 2);
            if (hMenu) {
                TrackPopupMenu (hMenu, 0, pnt.x, pnt.y, 0, hWnd, NULL);
            } else {
            // Couldn't find the menu...
                MessageBeep(0);
            }
            break;

      case WM_DISPLAYCHANGE: // Only comes through on plug'n'play systems
      {
         SIZE  szScreen;
         DWORD dwBitsPerPixel = (DWORD)wParam;

         szScreen.cx = LOWORD(lParam);
         szScreen.cy = HIWORD(lParam);

         MessageBox (GetFocus(), GetStringRes(IDS_DISPLAYCHANGED),
                     szAppName, 0);
      }
      break;

      case WM_PAINT:
         hdc = BeginPaint (hWnd, &ps);
         // Add any drawing code here...
         EndPaint (hWnd, &ps);
         break;

      case WM_DESTROY:
         // Tell WinHelp we don't need it any more...
               WinHelp (hWnd, APPNAME".HLP", HELP_QUIT,(DWORD)0);
         PostQuitMessage(0);
         break;

      default:
         return (DefWindowProc(hWnd, message, wParam, lParam));
   }
   return (0);
}

Generated on Wed Nov 13 2024 16:53:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/PrintJob/quecore.h File Reference

  • Multimedia
  • Gdi
  • PrintJob
Functions

quecore.h File Reference

Go to the source code of this file.

Functions

void | MakeJobStatusStr (char *szBuffer, short cchChars, DWORD dwStatus)
void | Refresh (HWND hWnd, QUEUEDATA *pQueue)
BOOL | RefreshFromNotification (HWND hWnd, QUEUEDATA *pQueue, PRINTER_NOTIFY_INFO *pNotification)
void | UpdateWindowTitle (HWND hWnd, QUEUEDATA *pPd)

Function Documentation

void MakeJobStatusStr | ( | char * | szBuffer,
 |  | short | cchChars,
 |  | DWORD | dwStatus
 | ) |  |

Definition at line 879 of file printjob.c.

{
    DWORD   dwClearBits = 0;
    char    szTmp[MAX_PATH];

    szTmp[0] = 0;

    /*
     * Accumulate a status string from the set bits.
     * Terminate when we have processed all of the bits.
     */
    while (dwStatus)
    {
        /* Seperate multiple status phrases with a hyphen */
        if (dwClearBits)
            strncat(szTmp, " - ", MAX_PATH - strlen(szTmp));

        if (JOB_STATUS_SPOOLING & dwStatus)
        {
            strncat(szTmp, "Spooling", MAX_PATH - strlen(szTmp));
            dwClearBits |= JOB_STATUS_SPOOLING;
        }
        else if (JOB_STATUS_PRINTING & dwStatus)
        {
            strncat(szTmp, "Printing", MAX_PATH - strlen(szTmp));
            dwClearBits |= JOB_STATUS_PRINTING;
        }
        else if (JOB_STATUS_DELETING & dwStatus)
        {
            strncat(szTmp, "Deleting", MAX_PATH - strlen(szTmp));
            dwClearBits |= JOB_STATUS_DELETING;
        }
        else if (JOB_STATUS_PAUSED & dwStatus)
        {
            strncat(szTmp, "Paused", MAX_PATH - strlen(szTmp));
            dwClearBits |= JOB_STATUS_PAUSED;
        }
        else if (JOB_STATUS_PRINTED & dwStatus)
        {
            strncat(szTmp, "Printed", MAX_PATH - strlen(szTmp));
            dwClearBits |= JOB_STATUS_PRINTED;
        }
        else if (JOB_STATUS_DELETED & dwStatus)
        {
            strncat(szTmp, "Deleted", MAX_PATH - strlen(szTmp));
            dwClearBits |= JOB_STATUS_DELETED;
        }
        else if (JOB_STATUS_ERROR & dwStatus)
        {
            strncat(szTmp, "Error", MAX_PATH - strlen(szTmp));
            dwClearBits |= JOB_STATUS_ERROR;
        }
        else if (JOB_STATUS_OFFLINE & dwStatus)
        {
            strncat(szTmp, "Offline", MAX_PATH - strlen(szTmp));
            dwClearBits |= JOB_STATUS_OFFLINE;
        }
        else if (JOB_STATUS_PAPEROUT & dwStatus)
        {
            strncat(szTmp, "Paper Out", MAX_PATH - strlen(szTmp));
            dwClearBits |= JOB_STATUS_PAPEROUT;
        }
        else if (JOB_STATUS_BLOCKED_DEVQ & dwStatus)
        {
            strncat(szTmp, "Blocked Device", MAX_PATH - strlen(szTmp));
            dwClearBits |= JOB_STATUS_BLOCKED_DEVQ;
        }
        else if (JOB_STATUS_USER_INTERVENTION & dwStatus)
        {
            strncat(szTmp, "Intervention Required", MAX_PATH - strlen(szTmp));
            dwClearBits |= JOB_STATUS_USER_INTERVENTION;
        }
        else if (JOB_STATUS_RESTART & dwStatus)
        {
            strncat(szTmp, "Restarting", MAX_PATH - strlen(szTmp));
            dwClearBits |= JOB_STATUS_RESTART;
        }
        else
        {
            /* if we get here, the OS knows more than us. */
            strncat(szTmp, "Unkown", MAX_PATH - strlen(szTmp));
            dwClearBits = dwStatus;
        }

        /* Clear whatever bit we just processed */
        dwStatus = dwStatus & ~dwClearBits;
    }

    lstrcpyn(szBuffer, szTmp, cchChars);
    szBuffer[cchChars-1] = 0;

} /* end of function MakeJobStatus */

void Refresh | ( | HWND | hWnd,
 |  | QUEUEDATA * | pQueue
 | ) |  |

Definition at line 845 of file printjob.c.

{
    /* retrieve job info from the printer */
    if (GetQueue(pQueue))
    {
        /* update the list boxes */
        SetQueListContents(g_hWndJobList, pQueue);

        /* update queue status in window caption */
        UpdateWindowTitle(hWnd, pQueue);
    }

} /* end of function Refresh */

BOOL RefreshFromNotification | ( | HWND | hWnd,
 |  | QUEUEDATA * | pQueue,
 |  | PRINTER_NOTIFY_INFO * | pNotification
 | ) |  |

Definition at line 1106 of file printjob.c.

{

    if (pNotification)
    {
        /* Update Our Data */
        UpdateQueue(pQueue, pNotification);

        /* update the list boxes */
        SetQueListContents(g_hWndJobList, pQueue);

        /* Always Update the Window Title */
        UpdateWindowTitle(hWnd, pQueue);

    }

    return TRUE;

} /* end of function RefreshFromNotification */

void UpdateWindowTitle | ( | HWND | hWnd,
 |  | QUEUEDATA * | pPd
 | ) |  |

Definition at line 1144 of file printjob.c.

{
    char        WindowTitle[200];
    PRINTERDATA *pPd = &pQueue->Printer;

    /* Start with application title */
    lstrcpyn(WindowTitle, g_szTitle, 200);

    /* Append printer queue information */
    strncat(WindowTitle, ": ", 200-strlen(WindowTitle));

    if (pPd->pszPrinterName && lstrlen(pPd->pszPrinterName) > 0)
    {
        lstrcat(WindowTitle, pPd->pszPrinterName);
    }
    else if (pPd->pszServerName && pPd->pszShareName)
    {
        strncat(WindowTitle, pPd->pszServerName, 200-strlen(WindowTitle));
        strncat(WindowTitle, "\\", 200-strlen(WindowTitle));
        strncat(WindowTitle, pPd->pszShareName, 200-strlen(WindowTitle));
    }
    else
    {
        strncat(WindowTitle, "Unknown", 200-strlen(WindowTitle));
    }

    /* append status of the printer queue */
    if (pPd->dwStatus)
    {
        strncat(WindowTitle, " - ", 200-strlen(WindowTitle));

        /* insert the printer status after the "-" */
        MakePrinterStatusStr(&WindowTitle[lstrlen(WindowTitle)],
            (short)(sizeof(WindowTitle) - lstrlen(WindowTitle)),
            pPd->dwStatus);
    }

    SetWindowText(hWnd, WindowTitle);

} /* end of function UpdateWindowTitle */

Generated on Wed Nov 13 2024 16:53:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/PrintJob/quelist.c File Reference

  • Multimedia
  • Gdi
  • PrintJob
Defines | Functions | Variables

quelist.c File Reference

#include <windows.h>
#include "resource.h"
#include "Queue.h"
#include "QueList.h"

Go to the source code of this file.

Defines

#define | STRICT

Functions

HWND | CreateQueList (HWND hwndParent)
void | ResizeQueList (HWND hwndListView, HWND hwndParent)
void | SetQueListContents (HWND hwndListView, QUEUEDATA *pQueue)

Variables

HINSTANCE | g_hInst

Define Documentation

#define STRICT

Definition at line 28 of file quelist.c.

Function Documentation

HWND CreateQueList ( HWND hwndParent )

Definition at line 67 of file quelist.c.

{
    DWORD       dwStyle;
    HWND        hwndListView;

    /*
     * List View Styles for this control
     */
    dwStyle =   WS_TABSTOP |
                WS_CHILD |
                WS_BORDER |
                LVS_REPORT |
                WS_VISIBLE;

    hwndListView = CreateWindowEx(   WS_EX_CLIENTEDGE,          // ex style
                                     WC_LISTVIEW,               // class name - defined in commctrl.h
                                     "",                        // dummy text
                                     dwStyle,                   // style
                                     0,                         // x position
                                     0,                         // y position
                                     0,                         // width
                                     0,                         // height
                                     hwndParent,                // parent
                                     (HMENU)IDC_LISTVIEW,       // ID
                                     g_hInst,                   // instance
                                     NULL);                     // no extra data

    /* Very bad, Bail */
    if(!hwndListView)
       return NULL;

    /* Setup the control via resources */
    InitQueList(hwndListView);

    /* make the parent wide enough for the child window */
    ResizeWindowToControlWidth(hwndParent, hwndListView);

    return hwndListView;

} /* end of function CreateQueList */

void ResizeQueList | ( | HWND | hwndListView,
 |  | HWND | hwndParent
 | ) |  |

Definition at line 122 of file quelist.c.

{
    RECT  rc;

    GetClientRect(hwndParent, &rc);

    MoveWindow( hwndListView,
                rc.left,
                rc.top,
                rc.right - rc.left,
                rc.bottom - rc.top,
                TRUE);
} /* end of function ResizeQueList */

void SetQueListContents | ( | HWND | hwndListView,
 |  | QUEUEDATA * | pQueue
 | ) |  |

Definition at line 232 of file quelist.c.

{
    LV_ITEM         lvItem;
    unsigned int    i,          // Rows
                    j,          // Columns
                    nItems;     // Initial # of lines in the list view

    SendMessage(hwndListView, WM_SETREDRAW, FALSE, 0);

    /*
     * find out how many items already in the list view
     * that we can reuse.
     */
    nItems = ListView_GetItemCount(hwndListView);

    for(i = 0; i < pQueue->nJobs; i++)
    {
        /* refresh listbox contents */

        /* setup for the Row */
        lvItem.mask = LVIF_TEXT;
        lvItem.iImage = 0;
        lvItem.iItem = i;

        for (j=0; j< *g_pnColumns; j++)
        {
            if (IsChanged(&pQueue->pJobs[i], (WORD)j))
            {
                /* fill in the LV_ITEM structure for the item */
                lvItem.pszText = GetColumnData(&pQueue->pJobs[i], (unsigned short)j);
                lvItem.iSubItem = j;

                /* while we can reuse items, use SetItem for subitems */
                if (!j && i >= nItems)
                    ListView_InsertItem(hwndListView, &lvItem);
                else
                    ListView_SetItem(hwndListView, &lvItem);

                // we own the string passed back from GetColumnData
                free (lvItem.pszText);
            }

        }

        // Mark everything as current
        ClearChanges(&pQueue->pJobs[i]);

    }

    /* If the list shrunk, delete any remaining items. */
    for (; i < nItems; i++)
    {
        ListView_DeleteItem(hwndListView, i);
    }

    /* Update the window */
    SendMessage(hwndListView, WM_SETREDRAW, TRUE, 0);
    InvalidateRect(hwndListView, NULL, FALSE);

} /* end of function SetQueListContents */

Variable Documentation

HINSTANCE g_hInst

Definition at line 62 of file DoServer.Cpp.

Generated on Wed Nov 13 2024 16:53:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/PrintJob/quelist.h File Reference

  • Multimedia
  • Gdi
  • PrintJob
Defines | Functions

quelist.h File Reference

#include <commctrl.h>

Go to the source code of this file.

Defines

#define | ColumnHeadingSize 20

Functions

HWND | CreateQueList (HWND hwndParent)
void | ResizeQueList (HWND hwndListView, HWND hwndParent)
void | SetQueListContents (HWND hwndListView, QUEUEDATA *pQueue)

Define Documentation

#define ColumnHeadingSize 20

Definition at line 23 of file quelist.h.

Function Documentation

HWND CreateQueList ( HWND hwndParent )

Definition at line 67 of file quelist.c.

{
    DWORD       dwStyle;
    HWND        hwndListView;

    /*
     * List View Styles for this control
     */
    dwStyle =   WS_TABSTOP |
                WS_CHILD |
                WS_BORDER |
                LVS_REPORT |
                WS_VISIBLE;

    hwndListView = CreateWindowEx(   WS_EX_CLIENTEDGE,          // ex style
                                     WC_LISTVIEW,               // class name - defined in commctrl.h
                                     "",                        // dummy text
                                     dwStyle,                   // style
                                     0,                         // x position
                                     0,                         // y position
                                     0,                         // width
                                     0,                         // height
                                     hwndParent,                // parent
                                     (HMENU)IDC_LISTVIEW,       // ID
                                     g_hInst,                   // instance
                                     NULL);                     // no extra data

    /* Very bad, Bail */
    if(!hwndListView)
       return NULL;

    /* Setup the control via resources */
    InitQueList(hwndListView);

    /* make the parent wide enough for the child window */
    ResizeWindowToControlWidth(hwndParent, hwndListView);

    return hwndListView;

} /* end of function CreateQueList */

void ResizeQueList | ( | HWND | hwndListView,
 |  | HWND | hwndParent
 | ) |  |

Definition at line 122 of file quelist.c.

{
    RECT  rc;

    GetClientRect(hwndParent, &rc);

    MoveWindow( hwndListView,
                rc.left,
                rc.top,
                rc.right - rc.left,
                rc.bottom - rc.top,
                TRUE);
} /* end of function ResizeQueList */

void SetQueListContents | ( | HWND | hwndListView,
 |  | QUEUEDATA * | pQueue
 | ) |  |

Definition at line 232 of file quelist.c.

{
    LV_ITEM         lvItem;
    unsigned int    i,          // Rows
                    j,          // Columns
                    nItems;     // Initial # of lines in the list view

    SendMessage(hwndListView, WM_SETREDRAW, FALSE, 0);

    /*
     * find out how many items already in the list view
     * that we can reuse.
     */
    nItems = ListView_GetItemCount(hwndListView);

    for(i = 0; i < pQueue->nJobs; i++)
    {
        /* refresh listbox contents */

        /* setup for the Row */
        lvItem.mask = LVIF_TEXT;
        lvItem.iImage = 0;
        lvItem.iItem = i;

        for (j=0; j< *g_pnColumns; j++)
        {
            if (IsChanged(&pQueue->pJobs[i], (WORD)j))
            {
                /* fill in the LV_ITEM structure for the item */
                lvItem.pszText = GetColumnData(&pQueue->pJobs[i], (unsigned short)j);
                lvItem.iSubItem = j;

                /* while we can reuse items, use SetItem for subitems */
                if (!j && i >= nItems)
                    ListView_InsertItem(hwndListView, &lvItem);
                else
                    ListView_SetItem(hwndListView, &lvItem);

                // we own the string passed back from GetColumnData
                free (lvItem.pszText);
            }

        }

        // Mark everything as current
        ClearChanges(&pQueue->pJobs[i]);

    }

    /* If the list shrunk, delete any remaining items. */
    for (; i < nItems; i++)
    {
        ListView_DeleteItem(hwndListView, i);
    }

    /* Update the window */
    SendMessage(hwndListView, WM_SETREDRAW, TRUE, 0);
    InvalidateRect(hwndListView, NULL, FALSE);

} /* end of function SetQueListContents */

Generated on Wed Nov 13 2024 16:53:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/PrintJob/queue.c File Reference

  • Multimedia
  • Gdi
  • PrintJob
Defines | Functions

queue.c File Reference

#include <Windows.h>
#include "Queue.h"
#include "QueCore.h"
#include "QueList.H"

Go to the source code of this file.

Defines

#define | STRICT

Functions

void | AddChange (JOBDATA *pJob, WORD Change)
BOOL | AddJobData (QUEUEDATA *pQueueData, JOB_INFO_2 *pJI)
BOOL | AllocQueueData (QUEUEDATA *pQueueData, DWORD nJobs)
void | ClearChanges (JOBDATA *pJob)
void | FreeJobs (QUEUEDATA *pQueueData)
void | FreeQueueData (QUEUEDATA *pQueueData)
char * | GetColumnData (JOBDATA *pJob, unsigned short iCol)
BOOL | IsChanged (JOBDATA *pJob, WORD Change)
BOOL | SetJobData (QUEUEDATA *pQueueData, JOB_INFO_2 *pJI)
BOOL | SetPrinterQueueData (QUEUEDATA *pQueueData, PRINTER_INFO_2 *pPI)
BOOL | UpdateJobData (QUEUEDATA *pQueueData, PRINTER_NOTIFY_INFO_DATA *pPNID)
BOOL | UpdatePrinterData (QUEUEDATA *pQueueData, PRINTER_NOTIFY_INFO_DATA *pPNID)

Define Documentation

#define STRICT

Definition at line 62 of file queue.c.

Function Documentation

void AddChange | ( | JOBDATA * | pJob,
 |  | WORD | Change
 | ) |  |

Definition at line 244 of file queue.c.

{
    pJob->Changed[Change] = TRUE;

} /* end of function AddChange */

BOOL AddJobData | ( | QUEUEDATA * | pQueueData,
 |  | JOB_INFO_2 * | pJI
 | ) |  |

Definition at line 515 of file queue.c.

{

    /* allocated more space if necessary */
    if (pQueueData->nJobs == pQueueData->nAllocated)
        if (!AllocQueueData(pQueueData, pQueueData->nAllocated+1))
            return FALSE;

    /* Add the Job at the end */
    if (!NewJob(&pQueueData->pJobs[pQueueData->nJobs], pJI))
        return FALSE;

    pQueueData->nJobs++;

    return TRUE;

} /* end of function AddJobData */

BOOL AllocQueueData | ( | QUEUEDATA * | pQueueData,
 |  | DWORD | nJobs
 | ) |  |

Definition at line 382 of file queue.c.

{
    QUEUEDATA   NewData;

    /* if we are to realloc, it should be expansion */
    if (nJobs < pQueueData->nAllocated)
        return FALSE;

    /* short cut the trivial */
    if (nJobs == pQueueData->nAllocated)
        return TRUE;

    /* Allocate a new Queue */
    ZeroMemory(&NewData, sizeof(NewData));
    NewData.pJobs = (JOBDATA *)realloc(pQueueData->pJobs, sizeof(JOBDATA) * nJobs);
    if (NewData.pJobs == NULL && nJobs)
    {
        return FALSE;
    }
    NewData.nJobs = pQueueData->nJobs;
    NewData.nAllocated = nJobs;
    NewData.Printer = pQueueData->Printer;

    /* Initialize the new allocated data space */
    ZeroMemory(&NewData.pJobs[NewData.nJobs], sizeof(JOBDATA)*(NewData.nAllocated-NewData.nJobs));

    *pQueueData = NewData;

    return TRUE;

} /* end of function AllocQueueData */

void ClearChanges ( JOBDATA * pJob )

Definition at line 262 of file queue.c.

{
    ZeroMemory(pJob->Changed, sizeof(pJob->Changed));

} /* end of function ClearChanges */

void FreeJobs ( QUEUEDATA * pQueueData )

Definition at line 448 of file queue.c.

{
    DWORD   i;

    for (i=0; i < pQueueData->nJobs; i++)
    {
        FreeJob(&pQueueData->pJobs[i]);
    }
    free (pQueueData->pJobs);
    pQueueData->pJobs = NULL;
    pQueueData->nJobs = pQueueData->nAllocated = 0;
} /* end of function FreeJobs */

void FreeQueueData ( QUEUEDATA * pQueueData )

Definition at line 426 of file queue.c.

{
    FreeJobs(pQueueData);
    free (pQueueData->Printer.pszPrinterName);
    free (pQueueData->Printer.pszServerName);
    free (pQueueData->Printer.pszShareName);
    free (pQueueData->pJobs);
    ZeroMemory(pQueueData, sizeof(QUEUEDATA));
} /* end of function FreeQueueData */

char* GetColumnData | ( | JOBDATA * | pJob,
 |  | unsigned short | iCol
 | ) |  |

Definition at line 305 of file queue.c.

{
    char *pStr = NULL;
    char Buffer[100];

    switch (iCol)
    {
        case DOCUMENTNAME:
        {
            ReplaceString(&pStr, pJob->pszDocument);
            break;
        }
        case OWNERNAME:
        {
            ReplaceString(&pStr, pJob->pszOwner);
            break;
        }
        case STATUS:
        {
            if (pJob->pszStatus != NULL && lstrlen(pJob->pszStatus))
            {
                ReplaceString(&pStr, pJob->pszStatus);
            }
            else
            {
                MakeJobStatusStr(Buffer, sizeof(Buffer), pJob->dwStatus);
                ReplaceString(&pStr, Buffer);
            }
            break;
        }
        case SUBMITTED:
        {
            wsprintf(Buffer,
                    "%02u/%02u/%u - %02u:%02u",
                    pJob->Submitted.wMonth,
                    pJob->Submitted.wDay,
                    (pJob->Submitted.wYear-((pJob->Submitted.wYear/100)*100)),
                    pJob->Submitted.wHour,
                    pJob->Submitted.wMinute);
            ReplaceString(&pStr, Buffer);
            break;
        }
        case PROGRESS:
        {
            if (pJob->PagesPrinted == 1)
                wsprintf(Buffer, "%u page of %u Pages, %u bytes of %u Total Bytes", pJob->PagesPrinted, pJob->TotalPages, pJob->BytesPrinted, pJob->Size);
            else
                wsprintf(Buffer, "%u pages of %u Pages, %u bytes of %u Total Bytes", pJob->PagesPrinted, pJob->TotalPages, pJob->BytesPrinted, pJob->Size);
            ReplaceString(&pStr, Buffer);
            break;
        }
        default:
        {
            ReplaceString(&pStr, "");
            break;
        }
    }

    return pStr;

} /* end of function GetColumnData */

BOOL IsChanged | ( | JOBDATA * | pJob,
 |  | WORD | Change
 | ) |  |

Definition at line 280 of file queue.c.

{
    return pJob->Changed[Change];

} /* end of function IsChanged */

BOOL SetJobData | ( | QUEUEDATA * | pQueueData,
 |  | JOB_INFO_2 * | pJI
 | ) |  |

Definition at line 547 of file queue.c.

{
    DWORD i;
    JOBDATA jd;

    if (!FindJob(pQueueData, pJI->JobId, &i))
        return FALSE;

    /* make a new one */
    if (!NewJob(&jd, pJI))
        return FALSE;

    /* cleanup previous version */
    FreeJob(&pQueueData->pJobs[i]);

    /* copy new data */
    pQueueData->pJobs[i] = jd;

    return TRUE;

} /* end of function SetJobData */

BOOL SetPrinterQueueData | ( | QUEUEDATA * | pQueueData,
 |  | PRINTER_INFO_2 * | pPI
 | ) |  |

Definition at line 474 of file queue.c.

{
    PRINTERDATA pd;

    if (pPI == NULL)
        return FALSE;

    /* Initialize and copy pertinent data */
    ZeroMemory(&pd, sizeof(pd));

    ReplaceString(&pd.pszPrinterName, pPI->pPrinterName);
    ReplaceString(&pd.pszServerName, pPI->pServerName);
    ReplaceString(&pd.pszShareName, pPI->pShareName);

    pd.dwStatus = pPI->Status;
    pd.cJobs = pPI->cJobs;
    pd.hPrinter = pQueueData->Printer.hPrinter;

    /* Cleanup previous printer data */
    free (pQueueData->Printer.pszPrinterName);
    free (pQueueData->Printer.pszServerName);
    free (pQueueData->Printer.pszShareName);

    /* copy it */
    pQueueData->Printer = pd;
    return TRUE;

} /* end of function SetPritnerQueueData */

BOOL UpdateJobData | ( | QUEUEDATA * | pQueueData,
 |  | PRINTER_NOTIFY_INFO_DATA * | pPNID
 | ) |  |

Definition at line 589 of file queue.c.

{
    DWORD       i;
    BOOL        fSuccess = FALSE;
    JOB_INFO_2  ji;

    /* check for the right notification type */
    if (pPNID->Type != JOB_NOTIFY_TYPE)
        return FALSE;

    if (!FindJob(pQueueData, pPNID->Id, &i))
    {
        /* didn't find job so possibly a new one */
        /* add an entry that can be updated now and later */
        ZeroMemory(&ji, sizeof(ji));
        ji.JobId = pPNID->Id;
        if (!AddJobData(pQueueData, &ji))
            return FALSE;
        if (!FindJob(pQueueData, pPNID->Id, &i))
            return FALSE;
    }

    /* Update members based on the advertised change */
    switch (pPNID->Field)
    {
        case JOB_NOTIFY_FIELD_STATUS:
        {
            pQueueData->pJobs[i].dwStatus = pPNID->NotifyData.adwData[0];
            fSuccess = TRUE;
            AddChange(&pQueueData->pJobs[i], STATUS);
            break;
        }
        case JOB_NOTIFY_FIELD_STATUS_STRING:
        {
            fSuccess = ReplaceString(&pQueueData->pJobs[i].pszStatus, pPNID->NotifyData.Data.pBuf);
            AddChange(&pQueueData->pJobs[i], STATUS);
            break;
        }
        case JOB_NOTIFY_FIELD_USER_NAME:
        {
            fSuccess = ReplaceString(&pQueueData->pJobs[i].pszOwner, pPNID->NotifyData.Data.pBuf);
            AddChange(&pQueueData->pJobs[i], OWNERNAME);
            break;
        }
        case JOB_NOTIFY_FIELD_DOCUMENT:
        {
            fSuccess = ReplaceString(&pQueueData->pJobs[i].pszDocument, pPNID->NotifyData.Data.pBuf);
            AddChange(&pQueueData->pJobs[i], DOCUMENTNAME);
            break;
        }
        case JOB_NOTIFY_FIELD_PAGES_PRINTED:
        {
            pQueueData->pJobs[i].PagesPrinted = pPNID->NotifyData.adwData[0];
            AddChange(&pQueueData->pJobs[i], PROGRESS);
            break;
        }
        case JOB_NOTIFY_FIELD_TOTAL_PAGES:
        {
            pQueueData->pJobs[i].TotalPages = pPNID->NotifyData.adwData[0];
            AddChange(&pQueueData->pJobs[i], PROGRESS);
            break;
        }
        case JOB_NOTIFY_FIELD_TOTAL_BYTES:
        {
            pQueueData->pJobs[i].Size = pPNID->NotifyData.adwData[0];
            AddChange(&pQueueData->pJobs[i], PROGRESS);
            break;
        }
        case JOB_NOTIFY_FIELD_BYTES_PRINTED:
        {
            pQueueData->pJobs[i].BytesPrinted = pPNID->NotifyData.adwData[0];
            AddChange(&pQueueData->pJobs[i], PROGRESS);
            break;
        }
        case JOB_NOTIFY_FIELD_SUBMITTED:
        {
            pQueueData->pJobs[i].Submitted = *(SYSTEMTIME*) pPNID->NotifyData.Data.pBuf;
            AddChange(&pQueueData->pJobs[i], SUBMITTED);
            break;
        }
    }

    return fSuccess;

} /* end of function UpdateJobData */

BOOL UpdatePrinterData | ( | QUEUEDATA * | pQueueData,
 |  | PRINTER_NOTIFY_INFO_DATA * | pPNID
 | ) |  |

Definition at line 689 of file queue.c.

{
    BOOL    fSuccess = FALSE;

    /* make sure we are processing printer data */
    if (pPNID->Type != PRINTER_NOTIFY_TYPE)
        return FALSE;

    /* update the change as advertised */
    switch (pPNID->Field)
    {
        case PRINTER_NOTIFY_FIELD_PRINTER_NAME:
        {
            fSuccess = ReplaceString(&pQueueData->Printer.pszPrinterName, pPNID->NotifyData.Data.pBuf);
            break;
        }
        case PRINTER_NOTIFY_FIELD_SHARE_NAME:
        {
            fSuccess = ReplaceString(&pQueueData->Printer.pszShareName, pPNID->NotifyData.Data.pBuf);
            break;
        }
        case PRINTER_NOTIFY_FIELD_SERVER_NAME:
        {
            fSuccess = ReplaceString(&pQueueData->Printer.pszServerName, pPNID->NotifyData.Data.pBuf);
            break;
        }
        case PRINTER_NOTIFY_FIELD_STATUS:
        {
            pQueueData->Printer.dwStatus = pPNID->NotifyData.adwData[0];
            fSuccess = TRUE;
            break;
        }
        case PRINTER_NOTIFY_FIELD_CJOBS:
        {
            pQueueData->Printer.cJobs = pPNID->NotifyData.adwData[0];
            fSuccess = TRUE;
            break;
        }
    }

    return fSuccess;

} /* end of function UpdatePrinterData */

Generated on Wed Nov 13 2024 16:53:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/PrintJob/queue.h File Reference

  • Multimedia
  • Gdi
  • PrintJob
Classes | Defines | Typedefs | Functions

queue.h File Reference

Go to the source code of this file.

Classes

struct | _Job
struct | _Printer
struct | _Queue

Defines

#define | DOCUMENTNAME 0
#define | NFIELDS 5
#define | OWNERNAME 1
#define | PROGRESS 4
#define | STATUS 2
#define | SUBMITTED 3

Typedefs

typedef struct _Job | JOBDATA
typedef struct _Printer | PRINTERDATA
typedef struct _Queue | QUEUEDATA

Functions

void | AddChange (JOBDATA *pJob, WORD Change)
BOOL | AddJobData (QUEUEDATA *pQueueData, JOB_INFO_2 *pJI)
BOOL | AllocQueueData (QUEUEDATA *pQueueData, DWORD nJobs)
void | ClearChanges (JOBDATA *pJob)
void | FreeJobs (QUEUEDATA *pQueueData)
void | FreeQueueData (QUEUEDATA *pQueueData)
char * | GetColumnData (JOBDATA *pJob, unsigned short iCol)
BOOL | IsChanged (JOBDATA *pJob, WORD Change)
BOOL | SetJobData (QUEUEDATA *pQueueData, JOB_INFO_2 *pJI)
BOOL | SetPrinterQueueData (QUEUEDATA *pQueueData, PRINTER_INFO_2 *pPI)
BOOL | UpdateJobData (QUEUEDATA *pQueueData, PRINTER_NOTIFY_INFO_DATA *pPNID)
BOOL | UpdatePrinterData (QUEUEDATA *pQueueData, PRINTER_NOTIFY_INFO_DATA *pPNID)
BOOL | UpdateQueue (QUEUEDATA *pQueueData, PRINTER_NOTIFY_INFO *pPNI)

Define Documentation

#define DOCUMENTNAME 0

Definition at line 44 of file queue.h.

#define NFIELDS 5

Definition at line 49 of file queue.h.

#define OWNERNAME 1

Definition at line 45 of file queue.h.

#define PROGRESS 4

Definition at line 48 of file queue.h.

#define STATUS 2

Definition at line 46 of file queue.h.

#define SUBMITTED 3

Definition at line 47 of file queue.h.

Typedef Documentation

typedef struct _Job JOBDATA
typedef struct _Printer PRINTERDATA
typedef struct _Queue QUEUEDATA

Function Documentation

void AddChange | ( | JOBDATA * | pJob,
 |  | WORD | Change
 | ) |  |

Definition at line 244 of file queue.c.

{
    pJob->Changed[Change] = TRUE;

} /* end of function AddChange */

BOOL AddJobData | ( | QUEUEDATA * | pQueueData,
 |  | JOB_INFO_2 * | pJI
 | ) |  |

Definition at line 515 of file queue.c.

{

    /* allocated more space if necessary */
    if (pQueueData->nJobs == pQueueData->nAllocated)
        if (!AllocQueueData(pQueueData, pQueueData->nAllocated+1))
            return FALSE;

    /* Add the Job at the end */
    if (!NewJob(&pQueueData->pJobs[pQueueData->nJobs], pJI))
        return FALSE;

    pQueueData->nJobs++;

    return TRUE;

} /* end of function AddJobData */

BOOL AllocQueueData | ( | QUEUEDATA * | pQueueData,
 |  | DWORD | nJobs
 | ) |  |

Definition at line 382 of file queue.c.

{
    QUEUEDATA   NewData;

    /* if we are to realloc, it should be expansion */
    if (nJobs < pQueueData->nAllocated)
        return FALSE;

    /* short cut the trivial */
    if (nJobs == pQueueData->nAllocated)
        return TRUE;

    /* Allocate a new Queue */
    ZeroMemory(&NewData, sizeof(NewData));
    NewData.pJobs = (JOBDATA *)realloc(pQueueData->pJobs, sizeof(JOBDATA) * nJobs);
    if (NewData.pJobs == NULL && nJobs)
    {
        return FALSE;
    }
    NewData.nJobs = pQueueData->nJobs;
    NewData.nAllocated = nJobs;
    NewData.Printer = pQueueData->Printer;

    /* Initialize the new allocated data space */
    ZeroMemory(&NewData.pJobs[NewData.nJobs], sizeof(JOBDATA)*(NewData.nAllocated-NewData.nJobs));

    *pQueueData = NewData;

    return TRUE;

} /* end of function AllocQueueData */

void ClearChanges ( JOBDATA * pJob )

Definition at line 262 of file queue.c.

{
    ZeroMemory(pJob->Changed, sizeof(pJob->Changed));

} /* end of function ClearChanges */

void FreeJobs ( QUEUEDATA * pQueueData )

Definition at line 448 of file queue.c.

{
    DWORD   i;

    for (i=0; i < pQueueData->nJobs; i++)
    {
        FreeJob(&pQueueData->pJobs[i]);
    }
    free (pQueueData->pJobs);
    pQueueData->pJobs = NULL;
    pQueueData->nJobs = pQueueData->nAllocated = 0;
} /* end of function FreeJobs */

void FreeQueueData ( QUEUEDATA * pQueueData )

Definition at line 426 of file queue.c.

{
    FreeJobs(pQueueData);
    free (pQueueData->Printer.pszPrinterName);
    free (pQueueData->Printer.pszServerName);
    free (pQueueData->Printer.pszShareName);
    free (pQueueData->pJobs);
    ZeroMemory(pQueueData, sizeof(QUEUEDATA));
} /* end of function FreeQueueData */

char* GetColumnData | ( | JOBDATA * | pJob,
 |  | unsigned short | iCol
 | ) |  |

Definition at line 305 of file queue.c.

{
    char *pStr = NULL;
    char Buffer[100];

    switch (iCol)
    {
        case DOCUMENTNAME:
        {
            ReplaceString(&pStr, pJob->pszDocument);
            break;
        }
        case OWNERNAME:
        {
            ReplaceString(&pStr, pJob->pszOwner);
            break;
        }
        case STATUS:
        {
            if (pJob->pszStatus != NULL && lstrlen(pJob->pszStatus))
            {
                ReplaceString(&pStr, pJob->pszStatus);
            }
            else
            {
                MakeJobStatusStr(Buffer, sizeof(Buffer), pJob->dwStatus);
                ReplaceString(&pStr, Buffer);
            }
            break;
        }
        case SUBMITTED:
        {
            wsprintf(Buffer,
                    "%02u/%02u/%u - %02u:%02u",
                    pJob->Submitted.wMonth,
                    pJob->Submitted.wDay,
                    (pJob->Submitted.wYear-((pJob->Submitted.wYear/100)*100)),
                    pJob->Submitted.wHour,
                    pJob->Submitted.wMinute);
            ReplaceString(&pStr, Buffer);
            break;
        }
        case PROGRESS:
        {
            if (pJob->PagesPrinted == 1)
                wsprintf(Buffer, "%u page of %u Pages, %u bytes of %u Total Bytes", pJob->PagesPrinted, pJob->TotalPages, pJob->BytesPrinted, pJob->Size);
            else
                wsprintf(Buffer, "%u pages of %u Pages, %u bytes of %u Total Bytes", pJob->PagesPrinted, pJob->TotalPages, pJob->BytesPrinted, pJob->Size);
            ReplaceString(&pStr, Buffer);
            break;
        }
        default:
        {
            ReplaceString(&pStr, "");
            break;
        }
    }

    return pStr;

} /* end of function GetColumnData */

BOOL IsChanged | ( | JOBDATA * | pJob,
 |  | WORD | Change
 | ) |  |

Definition at line 280 of file queue.c.

{
    return pJob->Changed[Change];

} /* end of function IsChanged */

BOOL SetJobData | ( | QUEUEDATA * | pQueueData,
 |  | JOB_INFO_2 * | pJI
 | ) |  |

Definition at line 547 of file queue.c.

{
    DWORD i;
    JOBDATA jd;

    if (!FindJob(pQueueData, pJI->JobId, &i))
        return FALSE;

    /* make a new one */
    if (!NewJob(&jd, pJI))
        return FALSE;

    /* cleanup previous version */
    FreeJob(&pQueueData->pJobs[i]);

    /* copy new data */
    pQueueData->pJobs[i] = jd;

    return TRUE;

} /* end of function SetJobData */

BOOL SetPrinterQueueData | ( | QUEUEDATA * | pQueueData,
 |  | PRINTER_INFO_2 * | pPI
 | ) |  |

Definition at line 474 of file queue.c.

{
    PRINTERDATA pd;

    if (pPI == NULL)
        return FALSE;

    /* Initialize and copy pertinent data */
    ZeroMemory(&pd, sizeof(pd));

    ReplaceString(&pd.pszPrinterName, pPI->pPrinterName);
    ReplaceString(&pd.pszServerName, pPI->pServerName);
    ReplaceString(&pd.pszShareName, pPI->pShareName);

    pd.dwStatus = pPI->Status;
    pd.cJobs = pPI->cJobs;
    pd.hPrinter = pQueueData->Printer.hPrinter;

    /* Cleanup previous printer data */
    free (pQueueData->Printer.pszPrinterName);
    free (pQueueData->Printer.pszServerName);
    free (pQueueData->Printer.pszShareName);

    /* copy it */
    pQueueData->Printer = pd;
    return TRUE;

} /* end of function SetPritnerQueueData */

BOOL UpdateJobData | ( | QUEUEDATA * | pQueueData,
 |  | PRINTER_NOTIFY_INFO_DATA * | pPNID
 | ) |  |

Definition at line 589 of file queue.c.

{
    DWORD       i;
    BOOL        fSuccess = FALSE;
    JOB_INFO_2  ji;

    /* check for the right notification type */
    if (pPNID->Type != JOB_NOTIFY_TYPE)
        return FALSE;

    if (!FindJob(pQueueData, pPNID->Id, &i))
    {
        /* didn't find job so possibly a new one */
        /* add an entry that can be updated now and later */
        ZeroMemory(&ji, sizeof(ji));
        ji.JobId = pPNID->Id;
        if (!AddJobData(pQueueData, &ji))
            return FALSE;
        if (!FindJob(pQueueData, pPNID->Id, &i))
            return FALSE;
    }

    /* Update members based on the advertised change */
    switch (pPNID->Field)
    {
        case JOB_NOTIFY_FIELD_STATUS:
        {
            pQueueData->pJobs[i].dwStatus = pPNID->NotifyData.adwData[0];
            fSuccess = TRUE;
            AddChange(&pQueueData->pJobs[i], STATUS);
            break;
        }
        case JOB_NOTIFY_FIELD_STATUS_STRING:
        {
            fSuccess = ReplaceString(&pQueueData->pJobs[i].pszStatus, pPNID->NotifyData.Data.pBuf);
            AddChange(&pQueueData->pJobs[i], STATUS);
            break;
        }
        case JOB_NOTIFY_FIELD_USER_NAME:
        {
            fSuccess = ReplaceString(&pQueueData->pJobs[i].pszOwner, pPNID->NotifyData.Data.pBuf);
            AddChange(&pQueueData->pJobs[i], OWNERNAME);
            break;
        }
        case JOB_NOTIFY_FIELD_DOCUMENT:
        {
            fSuccess = ReplaceString(&pQueueData->pJobs[i].pszDocument, pPNID->NotifyData.Data.pBuf);
            AddChange(&pQueueData->pJobs[i], DOCUMENTNAME);
            break;
        }
        case JOB_NOTIFY_FIELD_PAGES_PRINTED:
        {
            pQueueData->pJobs[i].PagesPrinted = pPNID->NotifyData.adwData[0];
            AddChange(&pQueueData->pJobs[i], PROGRESS);
            break;
        }
        case JOB_NOTIFY_FIELD_TOTAL_PAGES:
        {
            pQueueData->pJobs[i].TotalPages = pPNID->NotifyData.adwData[0];
            AddChange(&pQueueData->pJobs[i], PROGRESS);
            break;
        }
        case JOB_NOTIFY_FIELD_TOTAL_BYTES:
        {
            pQueueData->pJobs[i].Size = pPNID->NotifyData.adwData[0];
            AddChange(&pQueueData->pJobs[i], PROGRESS);
            break;
        }
        case JOB_NOTIFY_FIELD_BYTES_PRINTED:
        {
            pQueueData->pJobs[i].BytesPrinted = pPNID->NotifyData.adwData[0];
            AddChange(&pQueueData->pJobs[i], PROGRESS);
            break;
        }
        case JOB_NOTIFY_FIELD_SUBMITTED:
        {
            pQueueData->pJobs[i].Submitted = *(SYSTEMTIME*) pPNID->NotifyData.Data.pBuf;
            AddChange(&pQueueData->pJobs[i], SUBMITTED);
            break;
        }
    }

    return fSuccess;

} /* end of function UpdateJobData */

BOOL UpdatePrinterData | ( | QUEUEDATA * | pQueueData,
 |  | PRINTER_NOTIFY_INFO_DATA * | pPNID
 | ) |  |

Definition at line 689 of file queue.c.

{
    BOOL    fSuccess = FALSE;

    /* make sure we are processing printer data */
    if (pPNID->Type != PRINTER_NOTIFY_TYPE)
        return FALSE;

    /* update the change as advertised */
    switch (pPNID->Field)
    {
        case PRINTER_NOTIFY_FIELD_PRINTER_NAME:
        {
            fSuccess = ReplaceString(&pQueueData->Printer.pszPrinterName, pPNID->NotifyData.Data.pBuf);
            break;
        }
        case PRINTER_NOTIFY_FIELD_SHARE_NAME:
        {
            fSuccess = ReplaceString(&pQueueData->Printer.pszShareName, pPNID->NotifyData.Data.pBuf);
            break;
        }
        case PRINTER_NOTIFY_FIELD_SERVER_NAME:
        {
            fSuccess = ReplaceString(&pQueueData->Printer.pszServerName, pPNID->NotifyData.Data.pBuf);
            break;
        }
        case PRINTER_NOTIFY_FIELD_STATUS:
        {
            pQueueData->Printer.dwStatus = pPNID->NotifyData.adwData[0];
            fSuccess = TRUE;
            break;
        }
        case PRINTER_NOTIFY_FIELD_CJOBS:
        {
            pQueueData->Printer.cJobs = pPNID->NotifyData.adwData[0];
            fSuccess = TRUE;
            break;
        }
    }

    return fSuccess;

} /* end of function UpdatePrinterData */

BOOL UpdateQueue | ( | QUEUEDATA * | pQueueData,
 |  | PRINTER_NOTIFY_INFO * | pPNI
 | ) |  |

Definition at line 1205 of file printjob.c.

{
    unsigned int        i;

    for (i=0; i < pPNI->Count; i++)
    {
        if (!UpdateJobData(pQueueData, &pPNI->aData[i]))
            UpdatePrinterData(pQueueData, &pPNI->aData[i]);
    }

    return TRUE;
}

Generated on Wed Nov 13 2024 16:53:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/PrintJob/resource.h File Reference

  • Multimedia
  • Gdi
  • PrintJob
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | ID_FILE_REFRESH 40018
#define | IDC_COMPANYNAME 1003
#define | IDC_EDITSELECTPRINTER 1005
#define | IDC_FILEDESCRIPTION 1000
#define | IDC_LEGALCOPYRIGHT 1002
#define | IDC_LEGALTRADEMARKS 1004
#define | IDC_LISTVIEW 1006
#define | IDC_PRODUCTVERSION 1001
#define | IDC_STATIC -1
#define | IDD_ABOUTBOX 103
#define | IDD_SELECTPRINTER 106
#define | IDI_APP 102
#define | IDM_ABOUT 40017
#define | IDM_COPY 40010
#define | IDM_CUT 40009
#define | IDM_EXIT 40007
#define | IDM_HELPCONTENTS 40014
#define | IDM_HELPHELP 40016
#define | IDM_HELPSEARCH 40015
#define | IDM_LINK 40012
#define | IDM_LINKS 40013
#define | IDM_NEW 40001
#define | IDM_OPEN 40002
#define | IDM_PASTE 40011
#define | IDM_PRINT 40005
#define | IDM_PRINTERNOTIFICATION 40020
#define | IDM_PRINTSETUP 40006
#define | IDM_SAVE 40003
#define | IDM_SAVEAS 40004
#define | IDM_SELECTPRINTER 40019
#define | IDM_UNDO 40008
#define | IDR_COLUMNCOUNT 111
#define | IDR_COLUMNWIDTHS 109
#define | IDR_PRINTJOB 101
#define | IDS_COLUMN1 1
#define | IDS_COLUMN2 2
#define | IDS_COLUMN3 3
#define | IDS_COLUMN4 4
#define | IDS_COLUMN5 5
#define | IDS_COLUMN6 6

Define Documentation

#define ID_FILE_REFRESH 40018

Definition at line 41 of file resource.h.

#define IDC_COMPANYNAME 1003

Definition at line 20 of file resource.h.

#define IDC_EDITSELECTPRINTER 1005

Definition at line 22 of file resource.h.

#define IDC_FILEDESCRIPTION 1000

Definition at line 17 of file resource.h.

#define IDC_LEGALCOPYRIGHT 1002

Definition at line 19 of file resource.h.

#define IDC_LEGALTRADEMARKS 1004

Definition at line 21 of file resource.h.

#define IDC_LISTVIEW 1006

Definition at line 23 of file resource.h.

#define IDC_PRODUCTVERSION 1001

Definition at line 18 of file resource.h.

#define IDC_STATIC -1

Definition at line 44 of file resource.h.

#define IDD_ABOUTBOX 103

Definition at line 13 of file resource.h.

#define IDD_SELECTPRINTER 106

Definition at line 14 of file resource.h.

#define IDI_APP 102

Definition at line 12 of file resource.h.

#define IDM_ABOUT 40017

Definition at line 40 of file resource.h.

#define IDM_COPY 40010

Definition at line 33 of file resource.h.

#define IDM_CUT 40009

Definition at line 32 of file resource.h.

#define IDM_EXIT 40007

Definition at line 30 of file resource.h.

#define IDM_HELPCONTENTS 40014

Definition at line 37 of file resource.h.

#define IDM_HELPHELP 40016

Definition at line 39 of file resource.h.

#define IDM_HELPSEARCH 40015

Definition at line 38 of file resource.h.

#define IDM_LINK 40012

Definition at line 35 of file resource.h.

#define IDM_LINKS 40013

Definition at line 36 of file resource.h.

#define IDM_NEW 40001

Definition at line 24 of file resource.h.

#define IDM_OPEN 40002

Definition at line 25 of file resource.h.

#define IDM_PASTE 40011

Definition at line 34 of file resource.h.

#define IDM_PRINT 40005

Definition at line 28 of file resource.h.

#define IDM_PRINTERNOTIFICATION 40020

Definition at line 43 of file resource.h.

#define IDM_PRINTSETUP 40006

Definition at line 29 of file resource.h.

#define IDM_SAVE 40003

Definition at line 26 of file resource.h.

#define IDM_SAVEAS 40004

Definition at line 27 of file resource.h.

#define IDM_SELECTPRINTER 40019

Definition at line 42 of file resource.h.

#define IDM_UNDO 40008

Definition at line 31 of file resource.h.

#define IDR_COLUMNCOUNT 111

Definition at line 16 of file resource.h.

#define IDR_COLUMNWIDTHS 109

Definition at line 15 of file resource.h.

#define IDR_PRINTJOB 101

Definition at line 11 of file resource.h.

#define IDS_COLUMN1 1

Definition at line 5 of file resource.h.

#define IDS_COLUMN2 2

Definition at line 6 of file resource.h.

#define IDS_COLUMN3 3

Definition at line 7 of file resource.h.

#define IDS_COLUMN4 4

Definition at line 8 of file resource.h.

#define IDS_COLUMN5 5

Definition at line 9 of file resource.h.

#define IDS_COLUMN6 6

Definition at line 10 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/PrintJob/threads.c File Reference

  • Multimedia
  • Gdi
  • PrintJob
Classes | Defines | Typedefs | Functions | Variables

threads.c File Reference

#include <windows.h>
#include <process.h>
#include "Threads.h"
#include "Queue.h"
#include "QueList.h"
#include "Errors.h"
#include "QueCore.h"

Go to the source code of this file.

Classes

struct | _threadparameters

Defines

#define | STRICT

Typedefs

typedef struct _threadparameters | THREADPARAM

Functions

BOOL | ActiveUpdateThread (void)
BOOL | CreateThreadSyncResources (void)
BOOL | DestroyThreadSyncResources (void)
unsigned __stdcall | NotificationUpdate (void *pParameters)
unsigned __stdcall | PollingUpdate (void *pParameters)
HANDLE | StartNotifications (HWND hWnd, HANDLE hPrinter, HANDLE hPrevThread)
HANDLE | StartPolling (HWND hWnd, HANDLE hPrinter, HANDLE hPrevThread)
BOOL | StopUpdateThread (HANDLE hThread, BOOL fCloseAppNow)
BOOL | TriggerUpdateThreadRefresh (void)

Variables

BOOL | fCloseApp = FALSE
HANDLE | g_hForceRefreshEvent = NULL
HANDLE | g_hTerminateEvent = NULL
DWORD | g_nPollIntervalms = 1500

Define Documentation

#define STRICT

Definition at line 38 of file threads.c.

Typedef Documentation

typedef struct _threadparameters THREADPARAM

Function Documentation

BOOL ActiveUpdateThread ( void )

Definition at line 576 of file threads.c.

{
    /* let the caller know if a thread is running */
    return !(WaitForSingleObject(g_hTerminateEvent, 0) == WAIT_OBJECT_0);

} /* end of ActiveUpdateThread */

BOOL CreateThreadSyncResources ( void )

Definition at line 75 of file threads.c.

{
    /* Initialize Resources */
    g_hForceRefreshEvent = g_hTerminateEvent = NULL;

    /*
     * Create thread termination resource
     * If signaled, our worker thread must exit.
     * The resource is created initially signaled so that
     * we can use it to test for a running thread.
     */
    g_hTerminateEvent = CreateEvent(NULL,       /* no inheritance */
                                    TRUE,       /* Reset is manual */
                                    TRUE,       /* Initially signaled */
                                    "UpdateThreadTerminateEvent");
    if (!g_hTerminateEvent)
        goto Fail;

    /*
     * Create thread refresh trigger resource
     * If signaled, our worker thread must immediately refresh.
     * The resource is created not initially signaled so that
     * it does not trigger a superflouos update.
     */
    g_hForceRefreshEvent = CreateEvent(NULL,        /* no inheritance */
                                    TRUE,       /* Reset is manual */
                                    FALSE,      /* Initially signaled */
                                    "UpdateThreadRefreshEvent");
    if (!g_hForceRefreshEvent)
        goto Fail;

    return TRUE;

Fail:
    DestroyThreadSyncResources();
    return FALSE;

} /* end of function CreateThreadSyncResources */

BOOL DestroyThreadSyncResources ( void )

Definition at line 128 of file threads.c.

{
    if (g_hTerminateEvent)
        CloseHandle(g_hTerminateEvent);
    if (g_hForceRefreshEvent)
        CloseHandle(g_hForceRefreshEvent);
    return TRUE;

} /* end of DestroyThreadSyncResources */

unsigned __stdcall NotificationUpdate ( void * pParameters )

Definition at line 348 of file threads.c.

{
    THREADPARAM             ThreadParam;            /* Parameters for the thread */
    THREADPARAM *           pThreadParam;
    HANDLE                  hPrinterNotification;   /* The PrinterChangeNotification object */
    HANDLE                  Handles[3];             /* Array of objects waited on in the loop */
    HGLOBAL                 hParam;
    DWORD                   WaitResult;             /* High level info from the PrinterChangeNotification */
    DWORD                   OldFlags;               /* Temporary variable */
    PRINTER_NOTIFY_INFO *   pNotification = NULL;   /* The stuff that changed to cause the notification */
    WORD                    JobFields[] =
        {                                   /* Job Fields we want notifications for */
        JOB_NOTIFY_FIELD_STATUS,            /* Status bits */
        JOB_NOTIFY_FIELD_STATUS_STRING,     /* Status String */
        JOB_NOTIFY_FIELD_DOCUMENT,          /* Document Name */
        JOB_NOTIFY_FIELD_USER_NAME,         /* Name of Documents owner */
        JOB_NOTIFY_FIELD_TOTAL_PAGES,       /* Total pages in the job */
        JOB_NOTIFY_FIELD_PAGES_PRINTED,     /* # of pages of the job that have printed */
        JOB_NOTIFY_FIELD_SUBMITTED,         /* The time and date job was submitted */
        JOB_NOTIFY_FIELD_BYTES_PRINTED,     /* # of bytes sent to printer */
        JOB_NOTIFY_FIELD_TOTAL_BYTES        /* Total bytes in the print job */
        };
    WORD                    PrinterFields[] =
        {
        PRINTER_NOTIFY_FIELD_STATUS,        /* Status bits of printer queue */
        PRINTER_NOTIFY_FIELD_CJOBS,         /* # of jobs in printer queue */
        PRINTER_NOTIFY_FIELD_PRINTER_NAME,  /* Name of the printer queue */
        PRINTER_NOTIFY_FIELD_SERVER_NAME,   /* Name of the server when the queue is remote */
        PRINTER_NOTIFY_FIELD_SHARE_NAME     /* The queue's sharename */
        };

    PRINTER_NOTIFY_OPTIONS_TYPE Notifications[2] =
        {                                   /* The notification we want to be notified of */
            {
                JOB_NOTIFY_TYPE,            /* We want notifications on print jobs */
                0,
                0,
                0,
                sizeof(JobFields)/sizeof(JobFields[0]), /* We specified 9 fields in the JobFields array */
                NULL            /* Precisely which fields we want notifications for */
            },
            {
                PRINTER_NOTIFY_TYPE,        /* We want notification on the printer queue too */
                0,
                0,
                0,
                sizeof(PrinterFields)/sizeof(PrinterFields[0]), /* How many printer fields? */
                NULL            /* Precisely what printer fields we want */
            }
        };

    PRINTER_NOTIFY_OPTIONS NotificationOptions =
        {
            2,                                  /* Version of structure, see docs */
            PRINTER_NOTIFY_OPTIONS_REFRESH,     /* Options for FindNextPrinterChangeNotification */
            2,                                  /* # of Printer_Notify_Info structures */
            NULL                          /* What we want notifications of */
        };

    QUEUEDATA               Queue;              /* Our copy of the printer queue's data */

  Notifications[0].pFields = JobFields;
  Notifications[1].pFields = PrinterFields;
  NotificationOptions.pTypes = Notifications;

    /*
     * Transfer parameters to the thread's stack and
     * free the global memory
     */
    hParam = (HGLOBAL)pParameters;
    pThreadParam = (THREADPARAM *)GlobalLock((HGLOBAL)hParam);
    ThreadParam = *pThreadParam;

    /*
     * we do not intend to pass anything back to the
     * application so free the memory used to get us Params.
     */
    GlobalUnlock((HGLOBAL)hParam);
    GlobalFree((HGLOBAL)hParam);

    /* Terminate and Wait for previous thread to close down before we continue */
    if (ThreadParam.hPrevThread)
    {
        StopUpdateThread(ThreadParam.hPrevThread, FALSE);
        WaitForSingleObject(ThreadParam.hPrevThread, INFINITE);
        CloseHandle(ThreadParam.hPrevThread);
    }

    /* reinitialize the Termination Event so we can proceed */
    ResetEvent(g_hTerminateEvent);

    hPrinterNotification = FindFirstPrinterChangeNotification(
        ThreadParam.hPrinter,           /* The printer of interest */
        PRINTER_CHANGE_DELETE_JOB,      /* We need to know when a job is removed */
        0,                              /* reserved */
        &NotificationOptions);          /* The details of what notifications that are needed */

    /* Check for an error */
    if (hPrinterNotification == INVALID_HANDLE_VALUE)
    {
        ErrorBox(GetLastError(), "FindFirstPrinterChangeNotification");
        return 0;
    }

    /*
     * Loop on the Notifications, a terminate event, or a refresh event
     */

    /* setup for a WaitForMultipleObjects */
    Handles[0] = hPrinterNotification;
    Handles[1] = g_hTerminateEvent;
    Handles[2] = g_hForceRefreshEvent;

    /* Initialize for our local data structure */
    ZeroMemory(&Queue, sizeof(Queue));
    Queue.Printer.hPrinter = ThreadParam.hPrinter;

    /* Initialize the display and our local copy of the printer queue data */
    Refresh(ThreadParam.hWnd, &Queue);

    /*
     * Loop while we are stilling waiting on Notifications.
     */
    while (hPrinterNotification != INVALID_HANDLE_VALUE)
    {
        /* wait for a printer notification, terminate event, or refresh event */
        WaitForMultipleObjects(3, Handles, FALSE, INFINITE);

        /* check to see if the thread needs to quit. */
        if (WaitForSingleObject(g_hTerminateEvent, 0) == WAIT_OBJECT_0)
        {
            /* This should be the only way out of the loop */
            FindClosePrinterChangeNotification(hPrinterNotification);
            hPrinterNotification = INVALID_HANDLE_VALUE;
        }

        /* or check to see if the notification object for the printer queue is signaled */
        else if (WaitForSingleObject(hPrinterNotification, 0) == WAIT_OBJECT_0)
        {
            /* get the changes and reset the notification */
            if (!FindNextPrinterChangeNotification(hPrinterNotification,
                &WaitResult,            /* for the PRINTER_CHANGE_DELETE_JOB notice */
                &NotificationOptions,   /* The notifications */
                &pNotification))        /* address of pointer that gets what changed */
            {
                ErrorBox(GetLastError(), "FindNextPrinterChangeNotification");
            }

            /* Did a notification overflow occur? */
            if (pNotification && pNotification->Flags & PRINTER_NOTIFY_INFO_DISCARDED)
            {
                /* An overflow of notifications occured, must refresh to continue */

                OldFlags = NotificationOptions.Flags;

                NotificationOptions.Flags = PRINTER_NOTIFY_OPTIONS_REFRESH;

                FreePrinterNotifyInfo(pNotification);
                if (!FindNextPrinterChangeNotification(hPrinterNotification,
                    &WaitResult,
                    &NotificationOptions,
                    &pNotification))
                {
                    ErrorBox(GetLastError(), "FindNextPrinterChangeNotification refresh call.");
                }
                NotificationOptions.Flags = OldFlags;

                /* Start Over with Refreshed Data */
                Refresh(ThreadParam.hWnd, &Queue);

            }

            /* process the notification of changes */
            if (WaitResult & PRINTER_CHANGE_DELETE_JOB)
            {
                /* a job was deleted so start over clean */
                Refresh(ThreadParam.hWnd, &Queue);
            }
            else
            {
                /* track and show the changes */
                RefreshFromNotification(ThreadParam.hWnd, &Queue, pNotification);
            }
            FreePrinterNotifyInfo(pNotification);
            pNotification = NULL;
        }

        /* Or, maybe the user wants to refresh the view of the print queue */
        else if (WaitForSingleObject(g_hForceRefreshEvent, 0) == WAIT_OBJECT_0)
        {
            Refresh(ThreadParam.hWnd, &Queue);
            ResetEvent(g_hForceRefreshEvent);
        }

    }

    /* Done watching for notifications, cleanup */
    ClosePrinter(ThreadParam.hPrinter);
    FreeQueueData(&Queue);

    /* Thread posts the close message when the application is going away so the
     * the application willattempt to close down again and succeed since the
     * thread has died.
     */
    if (fCloseApp)
        PostMessage(ThreadParam.hWnd, WM_CLOSE, 0, 0);

    return TRUE;

} /* end of Thread entry point function NotificationUpdate */

unsigned __stdcall PollingUpdate ( void * pParameters )

Definition at line 158 of file threads.c.

{
    THREADPARAM ThreadParam;    /* what we are to work with */
    THREADPARAM *pThreadParam;
    QUEUEDATA   Queue;          /* To keep our copy of the print queue */
    HANDLE      Handles[2];     /* one for refresh, one for terminate */
    HGLOBAL     hParameters;

    /* Transfer parameters to the thread's stack and free global memory */
    hParameters = (HGLOBAL)pParameters;
    pThreadParam = (THREADPARAM *)GlobalLock((HGLOBAL)hParameters);
    ThreadParam = *pThreadParam;

    /* we do not intend to pass anything back to the application so free memory */
    GlobalUnlock((HGLOBAL)hParameters);
    GlobalFree((HGLOBAL)hParameters);

    /* Terminate and Wait for previous thread to close down before we continue */
    if (ThreadParam.hPrevThread)
    {
        StopUpdateThread(ThreadParam.hPrevThread, FALSE);
        WaitForSingleObject(ThreadParam.hPrevThread, INFINITE);
        CloseHandle(ThreadParam.hPrevThread);
    }

    /* reinitialize the Termination Event so we don't exit the polling loop */
    ResetEvent(g_hTerminateEvent);

    /* initialize our Queue data structure*/
    ZeroMemory(&Queue, sizeof(Queue));
    Queue.Printer.hPrinter = ThreadParam.hPrinter;

    /* setup for WaitForMultipleObjects */
    Handles[0] = g_hTerminateEvent;
    Handles[1] = g_hForceRefreshEvent;
    /*
     * Loop until we are told to quit, waiting each time by
     * the polling interval.
     */
    do {
        /* Setup for refresh override */
        ResetEvent(g_hForceRefreshEvent);

        /* Get the data and show it */
        Refresh(ThreadParam.hWnd, &Queue);

        /* Wait for a terminate event, a refresh event, or the polling period */
        WaitForMultipleObjects(2, Handles, FALSE, g_nPollIntervalms);

    /* Keep going as long as we have not been told to quit! */
    } while (WaitForSingleObject(g_hTerminateEvent, 0) != WAIT_OBJECT_0);

    /* Cleanup */
    ClosePrinter(ThreadParam.hPrinter);
    FreeQueueData(&Queue);

    /* Thread posts the close message at the request of the Window Procedure
     * so application will attempt to close down again and succeed since the
     * thread has died.
     * We close down the app this way in order to avoid messaging deadlocks
     * by having the Window Procedure wait on this thread to exit.
     */
    if (fCloseApp)
        PostMessage(ThreadParam.hWnd, WM_CLOSE, 0, 0);

    return TRUE;

} /* end of Thread entry point function PollingUpdate */

HANDLE StartNotifications | ( | HWND | hWnd,
 |  | HANDLE | hPrinter,
 |  | HANDLE | hPrevThread
 | ) |  |

Definition at line 300 of file threads.c.

{
    UINT        ThreadID;
    THREADPARAM *pThreadParam;
    HGLOBAL     hParam;
    HANDLE      hThread;

    /* create parameters to thread */
    hParam = GlobalAlloc(GHND, sizeof(THREADPARAM));
    pThreadParam = (THREADPARAM *)GlobalLock(hParam);
    pThreadParam->hWnd = hWnd;
    pThreadParam->hPrinter = hPrinter;
    pThreadParam->hPrevThread = hPrevThread;
    GlobalUnlock(hParam);

    /* Thread is responsible for deleteing the Global memory containing the
     * parameters.
     * The thread is responsible for closing the printer
     * and the thread is responsible for killing & closing the previous thread
     * It also is responsible for closing the application if it is asked.
     *
     * Note we use _beginthreadex from the runtime library to avoid problems
     * between the run time library and the OS CreateThread
     */
    hThread = (HANDLE)_beginthreadex(NULL,
                    0,
                    NotificationUpdate,
                    (void *)hParam,
                    1,
                    &ThreadID);
    return hThread;

} /* end of function StartNotifications */

HANDLE StartPolling | ( | HWND | hWnd,
 |  | HANDLE | hPrinter,
 |  | HANDLE | hPrevThread
 | ) |  |

Definition at line 246 of file threads.c.

{
    UINT       ThreadID;
    THREADPARAM *pThreadParam;
    HGLOBAL     hParam;
    HANDLE      hThread;

    /* create parameters to thread */
    hParam = GlobalAlloc(GHND, sizeof(THREADPARAM));
    pThreadParam = (THREADPARAM *)GlobalLock(hParam);
    pThreadParam->hWnd = hWnd;               /* Main application Window */
    pThreadParam->hPrinter = hPrinter;       /* Printer now owned by thread */
    pThreadParam->hPrevThread = hPrevThread; /* Previous thread to terminate */
    GlobalUnlock(hParam);

    /* Thread is responsible for deleteing the Global memory containing the
     * parameters.
     * The thread is responsible for closing the printer
     * and the thread is responsible for killing & closing the previous thread
     * It also is responsible for closing the application if it is asked.
     *
     * Note we use _beginthreadex from the runtime library to avoid problems
     * between the run time library and the OS CreateThread
     */
    hThread = (HANDLE)_beginthreadex(NULL,
                    0,
                    PollingUpdate,
                    (void *)hParam,
                    1,
                    &ThreadID);

    return hThread;

} /* end of function StartPolling */

BOOL StopUpdateThread | ( | HANDLE | hThread,
 |  | BOOL | fCloseAppNow
 | ) |  |

Definition at line 596 of file threads.c.

{
    /* No thread running? */
    if (!hThread)
        return FALSE;

    /* Should we close the application too? */
    fCloseApp = fCloseAppNow;

    /* tell thread to quit */
    SetEvent(g_hTerminateEvent);

    return TRUE;

} /* end of StopNotifications function */

BOOL TriggerUpdateThreadRefresh ( void )

Definition at line 625 of file threads.c.

{
    /* Signal the event that forces a refresh of the display /*/
    return SetEvent(g_hForceRefreshEvent);

} /* end of TriggerUpdateThreadRefresh function */

Variable Documentation

BOOL fCloseApp = FALSE

Definition at line 52 of file threads.c.

HANDLE g_hForceRefreshEvent = NULL

Definition at line 51 of file threads.c.

HANDLE g_hTerminateEvent = NULL

Definition at line 50 of file threads.c.

DWORD g_nPollIntervalms = 1500

Definition at line 49 of file threads.c.

Generated on Wed Nov 13 2024 16:53:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/PrintJob/threads.h File Reference

  • Multimedia
  • Gdi
  • PrintJob
Functions

threads.h File Reference

Go to the source code of this file.

Functions

BOOL | ActiveUpdateThread (void)
BOOL | CreateThreadSyncResources (void)
BOOL | DestroyThreadSyncResources (void)
unsigned __stdcall | NotificationUpdate (void *pParameters)
unsigned __stdcall | PollingUpdate (void *pParameters)
HANDLE | StartNotifications (HWND hWnd, HANDLE hPrinter, HANDLE hPrevThread)
HANDLE | StartPolling (HWND hWnd, HANDLE hPrinter, HANDLE hPrevThread)
BOOL | StopUpdateThread (HANDLE hThread, BOOL fCloseAppNow)
BOOL | TriggerUpdateThreadRefresh (void)

Function Documentation

BOOL ActiveUpdateThread ( void )

Definition at line 576 of file threads.c.

{
    /* let the caller know if a thread is running */
    return !(WaitForSingleObject(g_hTerminateEvent, 0) == WAIT_OBJECT_0);

} /* end of ActiveUpdateThread */

BOOL CreateThreadSyncResources ( void )

Definition at line 75 of file threads.c.

{
    /* Initialize Resources */
    g_hForceRefreshEvent = g_hTerminateEvent = NULL;

    /*
     * Create thread termination resource
     * If signaled, our worker thread must exit.
     * The resource is created initially signaled so that
     * we can use it to test for a running thread.
     */
    g_hTerminateEvent = CreateEvent(NULL,       /* no inheritance */
                                    TRUE,       /* Reset is manual */
                                    TRUE,       /* Initially signaled */
                                    "UpdateThreadTerminateEvent");
    if (!g_hTerminateEvent)
        goto Fail;

    /*
     * Create thread refresh trigger resource
     * If signaled, our worker thread must immediately refresh.
     * The resource is created not initially signaled so that
     * it does not trigger a superflouos update.
     */
    g_hForceRefreshEvent = CreateEvent(NULL,        /* no inheritance */
                                    TRUE,       /* Reset is manual */
                                    FALSE,      /* Initially signaled */
                                    "UpdateThreadRefreshEvent");
    if (!g_hForceRefreshEvent)
        goto Fail;

    return TRUE;

Fail:
    DestroyThreadSyncResources();
    return FALSE;

} /* end of function CreateThreadSyncResources */

BOOL DestroyThreadSyncResources ( void )

Definition at line 128 of file threads.c.

{
    if (g_hTerminateEvent)
        CloseHandle(g_hTerminateEvent);
    if (g_hForceRefreshEvent)
        CloseHandle(g_hForceRefreshEvent);
    return TRUE;

} /* end of DestroyThreadSyncResources */

unsigned __stdcall NotificationUpdate ( void * pParameters )

Definition at line 348 of file threads.c.

{
    THREADPARAM             ThreadParam;            /* Parameters for the thread */
    THREADPARAM *           pThreadParam;
    HANDLE                  hPrinterNotification;   /* The PrinterChangeNotification object */
    HANDLE                  Handles[3];             /* Array of objects waited on in the loop */
    HGLOBAL                 hParam;
    DWORD                   WaitResult;             /* High level info from the PrinterChangeNotification */
    DWORD                   OldFlags;               /* Temporary variable */
    PRINTER_NOTIFY_INFO *   pNotification = NULL;   /* The stuff that changed to cause the notification */
    WORD                    JobFields[] =
        {                                   /* Job Fields we want notifications for */
        JOB_NOTIFY_FIELD_STATUS,            /* Status bits */
        JOB_NOTIFY_FIELD_STATUS_STRING,     /* Status String */
        JOB_NOTIFY_FIELD_DOCUMENT,          /* Document Name */
        JOB_NOTIFY_FIELD_USER_NAME,         /* Name of Documents owner */
        JOB_NOTIFY_FIELD_TOTAL_PAGES,       /* Total pages in the job */
        JOB_NOTIFY_FIELD_PAGES_PRINTED,     /* # of pages of the job that have printed */
        JOB_NOTIFY_FIELD_SUBMITTED,         /* The time and date job was submitted */
        JOB_NOTIFY_FIELD_BYTES_PRINTED,     /* # of bytes sent to printer */
        JOB_NOTIFY_FIELD_TOTAL_BYTES        /* Total bytes in the print job */
        };
    WORD                    PrinterFields[] =
        {
        PRINTER_NOTIFY_FIELD_STATUS,        /* Status bits of printer queue */
        PRINTER_NOTIFY_FIELD_CJOBS,         /* # of jobs in printer queue */
        PRINTER_NOTIFY_FIELD_PRINTER_NAME,  /* Name of the printer queue */
        PRINTER_NOTIFY_FIELD_SERVER_NAME,   /* Name of the server when the queue is remote */
        PRINTER_NOTIFY_FIELD_SHARE_NAME     /* The queue's sharename */
        };

    PRINTER_NOTIFY_OPTIONS_TYPE Notifications[2] =
        {                                   /* The notification we want to be notified of */
            {
                JOB_NOTIFY_TYPE,            /* We want notifications on print jobs */
                0,
                0,
                0,
                sizeof(JobFields)/sizeof(JobFields[0]), /* We specified 9 fields in the JobFields array */
                NULL            /* Precisely which fields we want notifications for */
            },
            {
                PRINTER_NOTIFY_TYPE,        /* We want notification on the printer queue too */
                0,
                0,
                0,
                sizeof(PrinterFields)/sizeof(PrinterFields[0]), /* How many printer fields? */
                NULL            /* Precisely what printer fields we want */
            }
        };

    PRINTER_NOTIFY_OPTIONS NotificationOptions =
        {
            2,                                  /* Version of structure, see docs */
            PRINTER_NOTIFY_OPTIONS_REFRESH,     /* Options for FindNextPrinterChangeNotification */
            2,                                  /* # of Printer_Notify_Info structures */
            NULL                          /* What we want notifications of */
        };

    QUEUEDATA               Queue;              /* Our copy of the printer queue's data */

  Notifications[0].pFields = JobFields;
  Notifications[1].pFields = PrinterFields;
  NotificationOptions.pTypes = Notifications;

    /*
     * Transfer parameters to the thread's stack and
     * free the global memory
     */
    hParam = (HGLOBAL)pParameters;
    pThreadParam = (THREADPARAM *)GlobalLock((HGLOBAL)hParam);
    ThreadParam = *pThreadParam;

    /*
     * we do not intend to pass anything back to the
     * application so free the memory used to get us Params.
     */
    GlobalUnlock((HGLOBAL)hParam);
    GlobalFree((HGLOBAL)hParam);

    /* Terminate and Wait for previous thread to close down before we continue */
    if (ThreadParam.hPrevThread)
    {
        StopUpdateThread(ThreadParam.hPrevThread, FALSE);
        WaitForSingleObject(ThreadParam.hPrevThread, INFINITE);
        CloseHandle(ThreadParam.hPrevThread);
    }

    /* reinitialize the Termination Event so we can proceed */
    ResetEvent(g_hTerminateEvent);

    hPrinterNotification = FindFirstPrinterChangeNotification(
        ThreadParam.hPrinter,           /* The printer of interest */
        PRINTER_CHANGE_DELETE_JOB,      /* We need to know when a job is removed */
        0,                              /* reserved */
        &NotificationOptions);          /* The details of what notifications that are needed */

    /* Check for an error */
    if (hPrinterNotification == INVALID_HANDLE_VALUE)
    {
        ErrorBox(GetLastError(), "FindFirstPrinterChangeNotification");
        return 0;
    }

    /*
     * Loop on the Notifications, a terminate event, or a refresh event
     */

    /* setup for a WaitForMultipleObjects */
    Handles[0] = hPrinterNotification;
    Handles[1] = g_hTerminateEvent;
    Handles[2] = g_hForceRefreshEvent;

    /* Initialize for our local data structure */
    ZeroMemory(&Queue, sizeof(Queue));
    Queue.Printer.hPrinter = ThreadParam.hPrinter;

    /* Initialize the display and our local copy of the printer queue data */
    Refresh(ThreadParam.hWnd, &Queue);

    /*
     * Loop while we are stilling waiting on Notifications.
     */
    while (hPrinterNotification != INVALID_HANDLE_VALUE)
    {
        /* wait for a printer notification, terminate event, or refresh event */
        WaitForMultipleObjects(3, Handles, FALSE, INFINITE);

        /* check to see if the thread needs to quit. */
        if (WaitForSingleObject(g_hTerminateEvent, 0) == WAIT_OBJECT_0)
        {
            /* This should be the only way out of the loop */
            FindClosePrinterChangeNotification(hPrinterNotification);
            hPrinterNotification = INVALID_HANDLE_VALUE;
        }

        /* or check to see if the notification object for the printer queue is signaled */
        else if (WaitForSingleObject(hPrinterNotification, 0) == WAIT_OBJECT_0)
        {
            /* get the changes and reset the notification */
            if (!FindNextPrinterChangeNotification(hPrinterNotification,
                &WaitResult,            /* for the PRINTER_CHANGE_DELETE_JOB notice */
                &NotificationOptions,   /* The notifications */
                &pNotification))        /* address of pointer that gets what changed */
            {
                ErrorBox(GetLastError(), "FindNextPrinterChangeNotification");
            }

            /* Did a notification overflow occur? */
            if (pNotification && pNotification->Flags & PRINTER_NOTIFY_INFO_DISCARDED)
            {
                /* An overflow of notifications occured, must refresh to continue */

                OldFlags = NotificationOptions.Flags;

                NotificationOptions.Flags = PRINTER_NOTIFY_OPTIONS_REFRESH;

                FreePrinterNotifyInfo(pNotification);
                if (!FindNextPrinterChangeNotification(hPrinterNotification,
                    &WaitResult,
                    &NotificationOptions,
                    &pNotification))
                {
                    ErrorBox(GetLastError(), "FindNextPrinterChangeNotification refresh call.");
                }
                NotificationOptions.Flags = OldFlags;

                /* Start Over with Refreshed Data */
                Refresh(ThreadParam.hWnd, &Queue);

            }

            /* process the notification of changes */
            if (WaitResult & PRINTER_CHANGE_DELETE_JOB)
            {
                /* a job was deleted so start over clean */
                Refresh(ThreadParam.hWnd, &Queue);
            }
            else
            {
                /* track and show the changes */
                RefreshFromNotification(ThreadParam.hWnd, &Queue, pNotification);
            }
            FreePrinterNotifyInfo(pNotification);
            pNotification = NULL;
        }

        /* Or, maybe the user wants to refresh the view of the print queue */
        else if (WaitForSingleObject(g_hForceRefreshEvent, 0) == WAIT_OBJECT_0)
        {
            Refresh(ThreadParam.hWnd, &Queue);
            ResetEvent(g_hForceRefreshEvent);
        }

    }

    /* Done watching for notifications, cleanup */
    ClosePrinter(ThreadParam.hPrinter);
    FreeQueueData(&Queue);

    /* Thread posts the close message when the application is going away so the
     * the application willattempt to close down again and succeed since the
     * thread has died.
     */
    if (fCloseApp)
        PostMessage(ThreadParam.hWnd, WM_CLOSE, 0, 0);

    return TRUE;

} /* end of Thread entry point function NotificationUpdate */

unsigned __stdcall PollingUpdate ( void * pParameters )

Definition at line 158 of file threads.c.

{
    THREADPARAM ThreadParam;    /* what we are to work with */
    THREADPARAM *pThreadParam;
    QUEUEDATA   Queue;          /* To keep our copy of the print queue */
    HANDLE      Handles[2];     /* one for refresh, one for terminate */
    HGLOBAL     hParameters;

    /* Transfer parameters to the thread's stack and free global memory */
    hParameters = (HGLOBAL)pParameters;
    pThreadParam = (THREADPARAM *)GlobalLock((HGLOBAL)hParameters);
    ThreadParam = *pThreadParam;

    /* we do not intend to pass anything back to the application so free memory */
    GlobalUnlock((HGLOBAL)hParameters);
    GlobalFree((HGLOBAL)hParameters);

    /* Terminate and Wait for previous thread to close down before we continue */
    if (ThreadParam.hPrevThread)
    {
        StopUpdateThread(ThreadParam.hPrevThread, FALSE);
        WaitForSingleObject(ThreadParam.hPrevThread, INFINITE);
        CloseHandle(ThreadParam.hPrevThread);
    }

    /* reinitialize the Termination Event so we don't exit the polling loop */
    ResetEvent(g_hTerminateEvent);

    /* initialize our Queue data structure*/
    ZeroMemory(&Queue, sizeof(Queue));
    Queue.Printer.hPrinter = ThreadParam.hPrinter;

    /* setup for WaitForMultipleObjects */
    Handles[0] = g_hTerminateEvent;
    Handles[1] = g_hForceRefreshEvent;
    /*
     * Loop until we are told to quit, waiting each time by
     * the polling interval.
     */
    do {
        /* Setup for refresh override */
        ResetEvent(g_hForceRefreshEvent);

        /* Get the data and show it */
        Refresh(ThreadParam.hWnd, &Queue);

        /* Wait for a terminate event, a refresh event, or the polling period */
        WaitForMultipleObjects(2, Handles, FALSE, g_nPollIntervalms);

    /* Keep going as long as we have not been told to quit! */
    } while (WaitForSingleObject(g_hTerminateEvent, 0) != WAIT_OBJECT_0);

    /* Cleanup */
    ClosePrinter(ThreadParam.hPrinter);
    FreeQueueData(&Queue);

    /* Thread posts the close message at the request of the Window Procedure
     * so application will attempt to close down again and succeed since the
     * thread has died.
     * We close down the app this way in order to avoid messaging deadlocks
     * by having the Window Procedure wait on this thread to exit.
     */
    if (fCloseApp)
        PostMessage(ThreadParam.hWnd, WM_CLOSE, 0, 0);

    return TRUE;

} /* end of Thread entry point function PollingUpdate */

HANDLE StartNotifications | ( | HWND | hWnd,
 |  | HANDLE | hPrinter,
 |  | HANDLE | hPrevThread
 | ) |  |

Definition at line 300 of file threads.c.

{
    UINT        ThreadID;
    THREADPARAM *pThreadParam;
    HGLOBAL     hParam;
    HANDLE      hThread;

    /* create parameters to thread */
    hParam = GlobalAlloc(GHND, sizeof(THREADPARAM));
    pThreadParam = (THREADPARAM *)GlobalLock(hParam);
    pThreadParam->hWnd = hWnd;
    pThreadParam->hPrinter = hPrinter;
    pThreadParam->hPrevThread = hPrevThread;
    GlobalUnlock(hParam);

    /* Thread is responsible for deleteing the Global memory containing the
     * parameters.
     * The thread is responsible for closing the printer
     * and the thread is responsible for killing & closing the previous thread
     * It also is responsible for closing the application if it is asked.
     *
     * Note we use _beginthreadex from the runtime library to avoid problems
     * between the run time library and the OS CreateThread
     */
    hThread = (HANDLE)_beginthreadex(NULL,
                    0,
                    NotificationUpdate,
                    (void *)hParam,
                    1,
                    &ThreadID);
    return hThread;

} /* end of function StartNotifications */

HANDLE StartPolling | ( | HWND | hWnd,
 |  | HANDLE | hPrinter,
 |  | HANDLE | hPrevThread
 | ) |  |

Definition at line 246 of file threads.c.

{
    UINT       ThreadID;
    THREADPARAM *pThreadParam;
    HGLOBAL     hParam;
    HANDLE      hThread;

    /* create parameters to thread */
    hParam = GlobalAlloc(GHND, sizeof(THREADPARAM));
    pThreadParam = (THREADPARAM *)GlobalLock(hParam);
    pThreadParam->hWnd = hWnd;               /* Main application Window */
    pThreadParam->hPrinter = hPrinter;       /* Printer now owned by thread */
    pThreadParam->hPrevThread = hPrevThread; /* Previous thread to terminate */
    GlobalUnlock(hParam);

    /* Thread is responsible for deleteing the Global memory containing the
     * parameters.
     * The thread is responsible for closing the printer
     * and the thread is responsible for killing & closing the previous thread
     * It also is responsible for closing the application if it is asked.
     *
     * Note we use _beginthreadex from the runtime library to avoid problems
     * between the run time library and the OS CreateThread
     */
    hThread = (HANDLE)_beginthreadex(NULL,
                    0,
                    PollingUpdate,
                    (void *)hParam,
                    1,
                    &ThreadID);

    return hThread;

} /* end of function StartPolling */

BOOL StopUpdateThread | ( | HANDLE | hThread,
 |  | BOOL | fCloseAppNow
 | ) |  |

Definition at line 596 of file threads.c.

{
    /* No thread running? */
    if (!hThread)
        return FALSE;

    /* Should we close the application too? */
    fCloseApp = fCloseAppNow;

    /* tell thread to quit */
    SetEvent(g_hTerminateEvent);

    return TRUE;

} /* end of StopNotifications function */

BOOL TriggerUpdateThreadRefresh ( void )

Definition at line 625 of file threads.c.

{
    /* Signal the event that forces a refresh of the display /*/
    return SetEvent(g_hForceRefreshEvent);

} /* end of TriggerUpdateThreadRefresh function */

Generated on Wed Nov 13 2024 16:53:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/SetDisp/Resource.h File Reference

  • Multimedia
  • Gdi
  • SetDisp
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_DELAY1 1017
#define | IDC_DELAY2 1020
#define | IDC_DELAY3 1023
#define | IDC_NOTIFY1 1006
#define | IDC_NOTIFY2 1007
#define | IDC_NOTIFY3 1008
#define | IDC_STATE11 1009
#define | IDC_STATE12 1010
#define | IDC_STATE21 1011
#define | IDC_STATE22 1012
#define | IDC_STATE31 1013
#define | IDC_STATE32 1014
#define | IDC_STATIC -1
#define | IDC_TIP11 1018
#define | IDC_TIP12 1019
#define | IDC_TIP21 1021
#define | IDC_TIP22 1022
#define | IDC_TIP31 1024
#define | IDC_TIP32 1025
#define | IDD_ABOUT 125
#define | IDD_SETDISP 103
#define | IDD_VERIFYRES 111
#define | IDI_SETDISP 102
#define | IDI_STATE11 105
#define | IDI_STATE12 106
#define | IDI_STATE21 107
#define | IDI_STATE22 108
#define | IDI_STATE31 109
#define | IDI_STATE32 110
#define | IDM_ABOUT 113
#define | IDR_ACCELERATOR1 119
#define | IDR_ACCELERATOR2 120
#define | IDR_ACCELERATOR3 121
#define | IDR_ACCELERATOR4 122
#define | IDR_ACCELERATOR5 124
#define | IDR_HELP 109
#define | IDR_MENU 116
#define | IDR_MENU1 113
#define | IDR_MENU2 117
#define | IDR_RESOLUTIONS 112

Define Documentation

#define IDC_DELAY1 1017

Definition at line 35 of file Resource.h.

#define IDC_DELAY2 1020

Definition at line 38 of file Resource.h.

#define IDC_DELAY3 1023

Definition at line 41 of file Resource.h.

#define IDC_NOTIFY1 1006

Definition at line 26 of file Resource.h.

#define IDC_NOTIFY2 1007

Definition at line 27 of file Resource.h.

#define IDC_NOTIFY3 1008

Definition at line 28 of file Resource.h.

#define IDC_STATE11 1009

Definition at line 29 of file Resource.h.

#define IDC_STATE12 1010

Definition at line 30 of file Resource.h.

#define IDC_STATE21 1011

Definition at line 31 of file Resource.h.

#define IDC_STATE22 1012

Definition at line 32 of file Resource.h.

#define IDC_STATE31 1013

Definition at line 33 of file Resource.h.

#define IDC_STATE32 1014

Definition at line 34 of file Resource.h.

#define IDC_STATIC -1

Definition at line 44 of file Resource.h.

#define IDC_TIP11 1018

Definition at line 36 of file Resource.h.

#define IDC_TIP12 1019

Definition at line 37 of file Resource.h.

#define IDC_TIP21 1021

Definition at line 39 of file Resource.h.

#define IDC_TIP22 1022

Definition at line 40 of file Resource.h.

#define IDC_TIP31 1024

Definition at line 42 of file Resource.h.

#define IDC_TIP32 1025

Definition at line 43 of file Resource.h.

#define IDD_ABOUT 125

Definition at line 25 of file Resource.h.

#define IDD_SETDISP 103

Definition at line 6 of file Resource.h.

#define IDD_VERIFYRES 111

Definition at line 14 of file Resource.h.

#define IDI_SETDISP 102

Definition at line 5 of file Resource.h.

#define IDI_STATE11 105

Definition at line 7 of file Resource.h.

#define IDI_STATE12 106

Definition at line 8 of file Resource.h.

#define IDI_STATE21 107

Definition at line 9 of file Resource.h.

#define IDI_STATE22 108

Definition at line 10 of file Resource.h.

#define IDI_STATE31 109

Definition at line 11 of file Resource.h.

#define IDI_STATE32 110

Definition at line 13 of file Resource.h.

#define IDM_ABOUT 113

Definition at line 17 of file Resource.h.

#define IDR_ACCELERATOR1 119

Definition at line 20 of file Resource.h.

#define IDR_ACCELERATOR2 120

Definition at line 21 of file Resource.h.

#define IDR_ACCELERATOR3 121

Definition at line 22 of file Resource.h.

#define IDR_ACCELERATOR4 122

Definition at line 23 of file Resource.h.

#define IDR_ACCELERATOR5 124

Definition at line 24 of file Resource.h.

#define IDR_HELP 109

Definition at line 12 of file Resource.h.

#define IDR_MENU 116

Definition at line 18 of file Resource.h.

#define IDR_MENU1 113

Definition at line 16 of file Resource.h.

#define IDR_MENU2 117

Definition at line 19 of file Resource.h.

#define IDR_RESOLUTIONS 112

Definition at line 15 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/SetDisp/SetDisp.c File Reference

  • Multimedia
  • Gdi
  • SetDisp
Classes | Defines | Functions | Variables

SetDisp.c File Reference

#include "setdisp.h"
#include <windowsx.h>
#include <winuser.h>
#include <shellapi.h>
#include <stdio.h>
#include <stdlib.h>
#include "resource.h"

Go to the source code of this file.

Classes

struct | _DLGITEMS

Defines

#define | TRC(_x)

Functions

BOOL APIENTRY | About (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
BOOL | ChangeResolution (UINT nNewMode, HWND hwnd)
int | CompareDevModes (DEVMODE *leftDM, DEVMODE *rightDM)
BOOL | GetDevModes (HWND hwnd)
VOID APIENTRY | HandlePopupMenu (HWND hwnd, POINT point)
BOOL IsNT ()
void | NotifyAdd (HWND hDlg, UINT uIndex)
void | NotifyDelete (HWND hDlg, UINT uIndex)
INT_PTR CALLBACK | SetDispDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
BOOL | SetResolutionMenu (HWND hwnd)
BOOL | TrayMessage (HWND hDlg, DWORD dwMessage, UINT uID, HICON hIcon, PSTR pszTip)
INT_PTR CALLBACK | VerifyDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
VOID CALLBACK | VerifyTimerProc (HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
int WINAPI | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

Variables

struct _DLGITEMS | g_sDlgItems []

Define Documentation

#define TRC ( _x )

Definition at line 47 of file SetDisp.c.

Function Documentation

BOOL APIENTRY About | ( | HWND | hDlg,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 1360 of file SetDisp.c.

{
  switch (message)
  {
     case WM_INITDIALOG:
      return TRUE;

     case WM_COMMAND:
     if (LOWORD(wParam) == IDOK)
     {
        EndDialog(hDlg, TRUE);
        return TRUE;
     }

     break;

     default:

    return FALSE;

  }

  return FALSE;
}

BOOL ChangeResolution | ( | UINT | nNewMode,
 |  | HWND | hwnd
 | ) |  |

Definition at line 567 of file SetDisp.c.

{

    LONG lResult;       //Result of ChangeDisplaySettings
    INT_PTR nUserResponse;  //Return from VerifyRes Dlg
    UINT nOldMode;

   /*
    ChangeDisplaySettings can set
  dmBitsPerPel      Bits per pixel
  dmPelsWidth     Pixel width
  dmPelsHeight      Pixel height
  dmDisplayFlags      Mode flags
  dmDisplayFrequency  Mode frequency

        but one of these must be set in the DEVMODE dmFields
        DM_BITSPERPEL     Use the dmBitsPerPel value.
        DM_PELSWIDTH      Use the dmPelsWidth value.
        DM_PELSHEIGHT     Use the dmPelsHeight value.
        DM_DISPLAYFLAGS     Use the dmDisplayFlags value.
  DM_DISPLAYFREQENCY  Use the dmDisplayFrequency value.

    dmSize must be set to the size, in bytes, of the DEVMODE structure.

    */

    //
    // First select a DevMode to use
    // to start, just cycling through them
    //

    nOldMode = gnCurrentMode;
    gnCurrentMode = nNewMode;

    //
    // Increment ptr to the new mode
    //

    gpCurrentMode = gpDevModes;
    gpCurrentMode += nNewMode;

    //
    // Verify that the DEVMODE select will change something
    //

    if (!(DM_BITSPERPEL      & gpCurrentMode->dmFields ||
          DM_PELSWIDTH       & gpCurrentMode->dmFields ||
          DM_PELSHEIGHT      & gpCurrentMode->dmFields ||
          DM_DISPLAYFLAGS  & gpCurrentMode->dmFields ||
          DM_DISPLAYFREQUENCY & gpCurrentMode->dmFields ) )

    {

  //
        // Note our DEVMODE returned from EnumDisplaySettings
  // So we should never enter here
  //

        gnCurrentMode = nOldMode;

        gpCurrentMode = gpDevModes;
        gpCurrentMode += gnCurrentMode;

        return (FALSE);
    }

    /************************************************************\
    *                                                            *
    *   Possible Flags for param 2 of ChangeDisplay Settings     *
    *    0          The graphics mode for the current            *
    *                screen will be changed dynamically.         *
    *    CDS_UPDATEREGISTRY The graphics mode for the            *
    *                current screen will be changed dynamically  *
    *                and the graphics mode will be updated in    *
    *                the registry. The mode information is       *
    *                stored in the USER profile.                 *
    *    CDS_TEST The system tests if the requested            *
    *                graphics mode could be set.                 *
    *                                                            *
    \************************************************************/

    //
    // First have the system test if we can set it
    //

    //
    // Param 1 is the new DEVMODE
    // Param 2 is Test Flag,
    // which asks the operating system if this is a valid setting
    // to change to -- wedon't want to make the system unusable
    //

  // Note: ChangeDisplaySettings required dmSize to be
  // set to structSize, so we set that here

    lResult = ChangeDisplaySettings
                ( gpCurrentMode,
                  CDS_TEST );

    if (lResult == DISP_CHANGE_RESTART)
    {
        MessageBox(hwnd, "This mode requires a reboot which\n"  \
                         "is not supported in this sample.",
       "SetDisp Message", IDOK);

        gnCurrentMode = nOldMode;
        gpCurrentMode = gpDevModes;
        gpCurrentMode += gnCurrentMode;

        return FALSE;
    }

    if (DISP_CHANGE_SUCCESSFUL ==lResult)
    {

   //
   // Param 2 is 0 to change dynamically
   // hence the app name SetDisp!
   //

  // Note: ChangeDisplaySettings required dmSize to be
  // set to structSize, so we set that here

         lResult = ChangeDisplaySettings
                     ( gpCurrentMode,
                       0 );
    }

    switch (lResult)
    {

    case DISP_CHANGE_SUCCESSFUL:  //The settings change was successful.
   TRC("DISP_CHANGE_SUCCESSFUL\n");
   break;

    case DISP_CHANGE_RESTART:   //The computer must be restarted in order
                                  //  for the graphics mode to work.
         TRC("DISP_CHANGE_RESTART\n");
         break;

    case DISP_CHANGE_BADFLAGS:    //An invalid set of flags was passed in.
         TRC("DISP_CHANGE_BADFLAGS\n");
         break;

    case DISP_CHANGE_FAILED:    //The display driver failed the specified
                                  //  graphics mode.
         TRC("DISP_CHANGE_FAILED\n");
         break;

    case DISP_CHANGE_BADMODE:   //The graphics mode is not supported.
         TRC("DISP_CHANGE_BADMODE\n");
         break;

    case DISP_CHANGE_NOTUPDATED:  //Windows NT only: Unable to write settings
                                  //  to the registry.
         TRC("DISP_CHANGE_NOTUPDATED\n");
         break;
    default:
   TRC("Undocumented return value!!!!\n");
   break;
    }

    //
    // Set a timer to only give the user so much
    // time to dedice incase the screen is garbled
    //

    SetTimer(hwnd,  VERIFY_RESCHANGE, VERIFY_TIMEOUT, VerifyTimerProc);

    //
    // Have the user verify the new resolution and depth
    //

    nUserResponse = DialogBox(g_hinst,// handle this application
                              MAKEINTRESOURCE(IDD_VERIFYRES),// identifies dialog box template
                              NULL,               // handle to owner window
                              VerifyDlgProc);  // the dialog box procedure

    //
    // The verification is over, kill the timer
    //

    KillTimer(hwnd, VERIFY_RESCHANGE);

    if (IDYES == nUserResponse)
    {

  //
  // Keep resolution and update registry
  //

        char szTip[50];
        memset(szTip, 0, 50);

  //
  // TODO: give them three choices:
        //       Dynamic only, Registry too, or Abort
  //

  // Note: ChangeDisplaySettings required dmSize to be
  // set to structSize, so we set that here

        lResult = ChangeDisplaySettings
                    ( gpCurrentMode,
                      CDS_UPDATEREGISTRY );  //  Flag to update registry

        switch (lResult)

        {

        case DISP_CHANGE_SUCCESSFUL:

      //
      // The settings change was successful.
      //

            TRC("DISP_CHANGE_SUCCESSFUL - reg\n");

            _snprintf(szTip, sizeof(szTip) - 1,
                 "%d x %d, %d bit color at %d hz",
                 gpCurrentMode->dmPelsWidth,
                 gpCurrentMode->dmPelsHeight,
                 gpCurrentMode->dmBitsPerPel,
                 gpCurrentMode->dmDisplayFrequency);

             {

     //
     // Update the Menu informtion, just a check mark for now
     //

                 HMENU hMenu, hMenu2;

                 hMenu = GetMenu(hwnd);

                 hMenu2 = GetSubMenu (hMenu, 0);

     //
     // Uncheck the old
     //

                 CheckMenuItem (hMenu2, nOldMode, MF_BYPOSITION | MF_UNCHECKED);

     //
     // Check the new
     //

     CheckMenuItem (hMenu2, gnCurrentMode, MF_BYPOSITION | MF_CHECKED);

             }

       //
       // Update the Notify_Icon quick tip
       //

             TrayMessage(hwnd, NIM_MODIFY, g_sDlgItems[0].uNotify,
                    LoadImage(g_hinst, MAKEINTRESOURCE(IDI_SETDISP),
                    IMAGE_ICON, 16, 16, 0), szTip);

             break;

        case DISP_CHANGE_RESTART:   //The computer must be restarted in order
                                      //  for the graphics mode to work.
             TRC("DISP_CHANGE_RESTART - reg\n");
             break;

        case DISP_CHANGE_BADFLAGS:    //An invalid set of flags was passed in.
             TRC("DISP_CHANGE_BADFLAGS - reg\n");
             break;

        case DISP_CHANGE_FAILED:    //The display driver failed the specified
                                      //  graphics mode.
             TRC("DISP_CHANGE_FAILED - reg\n");
             break;

        case DISP_CHANGE_BADMODE:   //The graphics mode is not supported.
             TRC("DISP_CHANGE_BADMODE - reg\n");
             break;

        case DISP_CHANGE_NOTUPDATED:  //Windows NT only: Unable to write settings
                                      //  to the registry.
             TRC("DISP_CHANGE_NOTUPDATED - reg\n");
             break;
        default:
              TRC("Undocumented return value!!!! - reg\n");
              break;
        }

    }

    else

    {
  //
  // The user chose to not keep the setting or  we timed out
        // so they may not have seen the dialog box to choose
        //
        // Change resolution back by calling
        // ChangeDisplaySettings
        // with a NULL DEVMODE which returns us to the current
        // registry settings
  //

  // Note: ChangeDisplaySettings required dmSize to be
  // set to structSize, so we set that here

        lResult = ChangeDisplaySettings
                    ( NULL,
                      0 );  // 0 to change dynamically

        gnCurrentMode = nOldMode;

        gpCurrentMode = gpDevModes;
        gpCurrentMode += gnCurrentMode;

    }

    return (TRUE);

}

int CompareDevModes | ( | DEVMODE * | leftDM,
 |  | DEVMODE * | rightDM
 | ) |  |

Definition at line 1288 of file SetDisp.c.

{

    //
    // Return 1  if left is bigger
    //        0  if equal
    //        -1 if right is bigger
    //
    // Comparison order is Width then Height then Bits then Frequency
    // This is an arbitrary order of importance. Often BitPerPels is
    // on considered the most important measure of a display setting
    //
    // return on the first one that is larger between left and right
    //

    if (leftDM->dmPelsWidth  > rightDM->dmPelsWidth)
    {
        return 1;
    }
    else if (leftDM->dmPelsWidth  < rightDM->dmPelsWidth)
    {
        return -1;
    }

    if (leftDM->dmPelsHeight > rightDM->dmPelsHeight)
    {
        return 1;
    }
    else if (leftDM->dmPelsHeight < rightDM->dmPelsHeight)
    {
        return -1;
    }

    if (leftDM->dmBitsPerPel > rightDM->dmBitsPerPel)
    {
        return 1;
    }
    else if (leftDM->dmBitsPerPel < rightDM->dmBitsPerPel)
    {
        return -1;
    }

    if (leftDM->dmDisplayFrequency > rightDM->dmDisplayFrequency)
    {
        return 1;
    }
    else if (leftDM->dmDisplayFrequency < rightDM->dmDisplayFrequency)
    {
        return -1;
    }

    //
    // All are equal
    //

    return 0;

}

BOOL GetDevModes ( HWND hwnd )

Definition at line 332 of file SetDisp.c.

{

    BOOL bRet = TRUE;
    BOOL bAddDM;
    UINT iModeNum = 0;
    DEVMODE CurrentDM, WorkingDM;
    INT i, structSize;
    UINT nlist;
    LPDEVMODE pDM;

    //
    // setting param 1 to NULL (lpszDeviceName) uses current device on NT
    // and NULL is required on Win95
    //

    if (IsNT())
    {
  //
  // NT specific; returns current devmode when param 2 set to ENUM_CURRENT_SETTINGS,
  //

  EnumDisplaySettings (NULL, ENUM_CURRENT_SETTINGS, &CurrentDM);
    }

    //
    // Determine how much memory we need
    //

    for (iModeNum = 0, gnModes = -1;
         bRet && (gnModes <= MAX_MODES);
         iModeNum++)
    {
        bRet = EnumDisplaySettings
                     (NULL,            // use default device
                     iModeNum,         // DEVMODEs start at 0
                     &WorkingDM);      // if successful the system
                                       // fills in the DEVMODE
                                       // structure

        //
        // For some reason my driver supports 1 hz display frequency
        // So filter out settings we do not want to display
        //

        if ( bRet &&
       WorkingDM.dmPelsWidth    >= MIN_WIDTH &&
            (WorkingDM.dmDisplayFrequency >= MIN_FREQUENCY  ||
       WorkingDM.dmDisplayFrequency == 0) )

      //
      // Accept 0 frequency since windows 95 does return frequency
      //
        {
            //
            // Increment to use next DEVMODE
            //

            gnModes++;
  }

    } // for loop

    if(-1 == gnModes)
    {
        MessageBox(hwnd, "No Display modes available.", "SetDisp Error", IDOK);
        return (FALSE);
    }

    //
    // We need gnModes worth of DEVMODE Structures
  // Check to make sure the system dmSize is not larger
  // than the size of DEVMODE at compile time.  If it is
  // and we do not do this check we will overwrite memory.
    //

    structSize = (sizeof(DEVMODE) >= (int) WorkingDM.dmSize ?
    sizeof(DEVMODE) : (int) WorkingDM.dmSize);

    gpDevModes = (PDEVMODE) malloc ((size_t) (gnModes + 1) * structSize);

    if (gpDevModes == NULL)
    {
        return (FALSE);
    }

    //
    // Loop through EnumDisplaySetting to get each supported DEVMODE
    // When returns false we have them all
    //

    for (iModeNum = 0, i = 0, bRet = TRUE;
         bRet && i <= gnModes;
         iModeNum++)
    {
        bRet = EnumDisplaySettings
                     (NULL,            // use default device
                     iModeNum,         // DEVMODEs start at 0
                     &WorkingDM);      // if successful the system
                                       // fills in the DEVMODE
                                       // structure

        //
        // Miniport drivers support 1 hz display frequency representing the default
        // and older drivers support 0 hz display frequency representing the default
        // So filter out settings we do not want to display
        //

        if ( bRet &&
             WorkingDM.dmPelsWidth        >= MIN_WIDTH      &&
            (WorkingDM.dmDisplayFrequency >= MIN_FREQUENCY  ||
             WorkingDM.dmDisplayFrequency == 0              ||
             WorkingDM.dmDisplayFrequency == 1))
             // Accept 0 or 1 frequency which represent default frequencies
        {
            bAddDM = TRUE;

            //
            // We will take this one unless another default has already been
            // added at these settings
            //

            if (WorkingDM.dmDisplayFrequency == 0 ||
                WorkingDM.dmDisplayFrequency == 1)
            {
                for (nlist = 0; nlist <= gnCurrentMode; nlist++)
                {
                      pDM = gpDevModes + nlist;

                      if (pDM->dmPelsWidth  == WorkingDM.dmPelsWidth   &&
                          pDM->dmPelsHeight == WorkingDM.dmPelsHeight  &&
                          pDM->dmBitsPerPel == WorkingDM.dmBitsPerPel)
                      {
                          //
                          // If everything else is the same do not add another default
                          //

                          bAddDM = FALSE;
                      }
                } // end for nlist

            } // end if default

            if (bAddDM)
            {
                //
                // Increment to use next DEVMODE
        // Note: ChangeDisplaySettings required dmSize to be
        // set to structSize, so we set that here
                //

                if (i == 0)
                {
                    gpCurrentMode = gpDevModes;
          gpCurrentMode->dmSize = (WORD)structSize;
                }
                else
                {
                    gpCurrentMode += 1;
          gpCurrentMode->dmSize = (WORD)structSize;
                }

                EnumDisplaySettings (NULL, iModeNum, gpCurrentMode);
                i++;

            } // end if bAddDM

        } // end bRet and hz if

    } // end for EnumDisplaySettings

    //
    // Sort the array for display; default sort
    // A different compare routine could sort by different attributes
    //

    qsort((void *) gpDevModes,
          (size_t) gnModes + 1,  // add one since gnModes is zero based
          (size_t) structSize,
          ( int (_cdecl*)(const void*,const void*) )CompareDevModes);

    //
    // Set gCurrentMode to CurrentDM
    //
    if (IsNT())
    {
        for (i =0; i <= gnModes; i++)
        {

            if (i == 0)
            {
                gpCurrentMode = gpDevModes;
            }
            else
            {
                gpCurrentMode += 1;
            }

            if (0 == CompareDevModes (&CurrentDM, gpCurrentMode))
            {
                gnCurrentMode = i;
                break;
            }
        }
    }
    else
    {
        //
        // Default to the first one
        // since we error out if there is not even this one
        //

        gnCurrentMode = 0;
    }

    //
    // TODO: What if some of the DEVMODES are not supported on
    //       the physical Device?
    //

    return (TRUE);

}  //GetDevModes scope

VOID APIENTRY HandlePopupMenu | ( | HWND | hwnd,
 |  | POINT | point
 | ) |  |

Definition at line 1221 of file SetDisp.c.

{

    HMENU hMenu;
    HMENU hMenuTrackPopup;

    //
    // Get the menu for the windows
    //

    hMenu = GetMenu(hwnd);

    if (!hMenu)
    {
  return;
    }

    //
    // Get the first menu in it which we will use for the call to
    // TrackPopup(). This could also have been created on the fly using
    // CreatePopupMenu and then we could have used InsertMenu() or
    // AppendMenu.
    //

    hMenuTrackPopup = GetSubMenu (hMenu, 0);

    //
    // Draw and track the "floating" popup
    //

    if (point.x < (long) (gpCurrentMode->dmPelsWidth - 50))
        point.x = (long) (gpCurrentMode->dmPelsWidth - 50);

    if (point.y < (long) (gpCurrentMode->dmPelsHeight - 50))
        point.y = (long) (gpCurrentMode->dmPelsHeight - 50);

    //
    // This is required when using a notify icon -- see KB article
    // PRB: Menus for Notification Icons Don't Work Correctly
    //

    SetForegroundWindow (hwnd);

    TrackPopupMenu (hMenuTrackPopup, TPM_LEFTBUTTON | TPM_RIGHTBUTTON,
                    point.x, point.y, 0, hwnd, NULL);

    //
    // This is required when using a notify icon -- see KB article
    // PRB: Menus for Notification Icons Don't Work Correctly
    //

    PostMessage (hwnd, WM_USER, 0, 0);

}

BOOL IsNT ( void )

Definition at line 1389 of file SetDisp.c.

{
    OSVERSIONINFO          osvi;

    osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);

    GetVersionEx(&osvi);

    if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT)
    {
        return TRUE;
    }
    else
    {
        return FALSE;
    }
}

void NotifyAdd | ( | HWND | hDlg,
 |  | UINT | uIndex
 | ) |  |

Definition at line 1125 of file SetDisp.c.

{

    TrayMessage(hDlg, NIM_ADD, g_sDlgItems[uIndex].uNotify, NULL, NULL);

}

void NotifyDelete | ( | HWND | hDlg,
 |  | UINT | uIndex
 | ) |  |

Definition at line 1104 of file SetDisp.c.

{

    TrayMessage(hDlg, NIM_DELETE, g_sDlgItems[uIndex].uNotify, NULL, NULL);

}

INT_PTR CALLBACK SetDispDlgProc | ( | HWND | hDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 129 of file SetDisp.c.

{

    switch (uMsg)
    {

    case WM_INITDIALOG:
    {
  BOOL bRet;

  //
  //Get DEVMODES
  //

  bRet = GetDevModes (hDlg);

        if (bRet == FALSE)
        {
            //
            // Failed to get DEVMODES so end the dialog
            //

      EndDialog(hDlg, TRUE);

      break;
        }

  //
  // Initialize Menu with Resolutions
  //

  SetResolutionMenu (hDlg);

  //
  // Add Tray Notify Icon
  //

  NotifyAdd(hDlg, 0);

  //
  // Update Tip to current settings
  //
  {

      char szTip[50];
        memset(szTip, 0, 50);

      //
      // Set the menu text
      //

      if (IsNT())
            {
                _snprintf(szTip, sizeof(szTip) - 1,
                          "%d x %d, %d bit color at %d hz",
                          gpCurrentMode->dmPelsWidth,
                          gpCurrentMode->dmPelsHeight,
                          gpCurrentMode->dmBitsPerPel,
                          gpCurrentMode->dmDisplayFrequency);
            }
            else
            {
                szTip[0] = '\0';
            }

      //
      // For the current mode, set the tool tip
        //

      TrayMessage(hDlg, NIM_MODIFY, g_sDlgItems[0].uNotify,
                        LoadImage(g_hinst, MAKEINTRESOURCE(IDI_SETDISP),
                        IMAGE_ICON, 16, 16, 0), szTip);
  }

  SetForegroundWindow (hDlg);

  break;

    } // WM_INITDIALOG:

    case WM_DESTROY:  NotifyDelete(hDlg, 0);
      break;

    case WM_COMMAND:
    {
  switch (GET_WM_COMMAND_ID(wParam, lParam))
  {
      case IDCANCEL:   EndDialog(hDlg, TRUE);
           break;

      case IDABORT:    ShowWindow(hDlg, SW_HIDE);
           break;

      case IDM_ABOUT:
      DialogBox(g_hinst, MAKEINTRESOURCE(IDD_ABOUT),
          hDlg, (DLGPROC)About);
      break;

      default:

      //
      // handle MYWM_NOTIFYICON + 10 + i for diffent devmodes
      //

            if ( MYWM_NOTIFYICON + 10  <= GET_WM_COMMAND_ID(wParam, lParam) &&
     MYWM_NOTIFYICON + 11 + gnModes >= GET_WM_COMMAND_ID(wParam, lParam))
      {
    UINT nNewMode;

                nNewMode = GET_WM_COMMAND_ID(wParam, lParam) - (MYWM_NOTIFYICON + 10);

    //
    // Only update if they chose a new setting
    //

                if (gnCurrentMode != nNewMode)
                {
       ChangeResolution (nNewMode, hDlg);
    }

    break;

            }

  } //WM_COMMAN switch

    } //WM_COMMAND

    case MYWM_NOTIFYICON:
    {
  switch (lParam)
  {

      case WM_LBUTTONDOWN:

     //
     // Handle popup here when user right mouse clicks tray icon
     //
     {

         //
         // Handle popup here
         //

         POINT point;

         GetCursorPos (&point);

         HandlePopupMenu (hDlg, point);

         break;

     }

      case WM_RBUTTONDOWN:
     switch (wParam)
     {

        //
        // Diplay the dialog box on Left mouse click
        // this is how the user gets the dialog back if it is hidden
        //

        case IDC_NOTIFY1:  ShowWindow (hDlg, SW_RESTORE);
               SetForegroundWindow (hDlg);
               break;

        default:
       break;

      }

      default:
     break;

  }  // lParam switch

    }// MYWM_NOTIFYICON

    default:
   return(FALSE);

    }  // switch (uMsg)

    return(TRUE);

}

BOOL SetResolutionMenu ( HWND hwnd )

Definition at line 905 of file SetDisp.c.

{

    HMENU hMenu, hWndMenu; //hMenuTrackPopup;
    INT i;
    BOOL bRet=FALSE;
    PDEVMODE pDevMode = gpDevModes;

    //
    // Create new Resolutions menu from the DevModes collected
    //

    hMenu = CreateMenu();

    if (!hMenu)
    {
       return (FALSE);
    }

    //
    // For each devmode add an menu item
    // TODO: make the description on BitPerPel better
    //

    for(i=0; i<= gnModes; i++)
    {

        char szRes[50];
        memset(szRes, 0, 50);

        if (i == 0)
        {
            pDevMode = gpDevModes;
        }
        else
        {
            pDevMode += 1;
  }

        //
  // Set the menu text
  //

        if (pDevMode->dmDisplayFrequency == 0 ||
            pDevMode->dmDisplayFrequency == 1)
  {
        _snprintf(szRes, sizeof(szRes) - 1,
                 "%d x %d, %d bit color, default frequency",
                 pDevMode->dmPelsWidth,
                 pDevMode->dmPelsHeight,
                 pDevMode->dmBitsPerPel);
  }
  else
  {
        _snprintf(szRes, sizeof(szRes) - 1,
                 "%d x %d, %d bit color at %d hz",
                 pDevMode->dmPelsWidth,
                 pDevMode->dmPelsHeight,
                 pDevMode->dmBitsPerPel,
                 pDevMode->dmDisplayFrequency);
  }

        bRet = AppendMenu (hMenu, MF_STRING, MYWM_NOTIFYICON + 10 + i, szRes);

        SetMenuItemBitmaps(
      hMenu,   // handle of menu
      gnCurrentMode, // menu item to receive new bitmaps
                  MF_BYPOSITION, // menu item flags
                  NULL,          // handle of unchecked bitmap
      NULL);   // handle of checked bitmap
                                 // if last two are NULL the default
                                 // bitmap is used

    } // for loop to set menu

    if (!bRet)
    {

        //
        // if the last one worked they all likely worked
        // otherwise let's clean up
        //

        DestroyMenu(hMenu);

        return(FALSE);

    }
    else
    {

        if (IsNT())
        {
            //
            // Check the Current one
            //

            CheckMenuItem (hMenu, gnCurrentMode, MF_BYPOSITION | MF_CHECKED);

            //
            // Set it as the default so it is easy to go back to
            //

      SetMenuDefaultItem(hMenu, gnCurrentMode, TRUE ); //TRUE if for by Position

        }

        hWndMenu = GetMenu (hwnd);

        InsertMenu (hWndMenu, 0, MF_POPUP|MF_BYPOSITION, (DWORD_PTR)hMenu, "&Resolutions");

        return(TRUE);

    }

}

BOOL TrayMessage | ( | HWND | hDlg,
 |  | DWORD | dwMessage,
 |  | UINT | uID,
 |  | HICON | hIcon,
 |  | PSTR | pszTip
 | ) |  |

Definition at line 1036 of file SetDisp.c.

{
    BOOL res;
    NOTIFYICONDATA tnd;

    //
    // Get the Tray Icon
    //

    hIcon = (HICON)LoadImage(g_hinst, MAKEINTRESOURCE(IDI_SETDISP), IMAGE_ICON,
           16, 16, 0);

    tnd.cbSize    = sizeof(NOTIFYICONDATA);
    tnd.hWnd    = hDlg;
    tnd.uID   = uID;
    tnd.uFlags    = NIF_MESSAGE|NIF_ICON|NIF_TIP;
    tnd.uCallbackMessage= MYWM_NOTIFYICON;
    tnd.hIcon   = hIcon;

    //
    // If there is a specific tip, set it
    // otherwise use SetDisp as the default
    //

    memset(tnd.szTip, 0, sizeof(tnd.szTip));
    if (pszTip)
    {
  lstrcpyn(tnd.szTip, pszTip, sizeof(tnd.szTip));
    }
    else
    {
  lstrcpyn(tnd.szTip, "SetDisp", sizeof("SetDisp"));;
    }

    //
    //  Use the Shell_NotifyIcon API to setup the tray icon
    //

    res = Shell_NotifyIcon(dwMessage, &tnd);

    if (hIcon)
    {
   DestroyIcon(hIcon);
    }

    return res;

}

INT_PTR CALLBACK VerifyDlgProc | ( | HWND | hDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 1170 of file SetDisp.c.

{
    switch(uMsg)
    {
  case WM_INITDIALOG: ghVerifyDlg = hDlg;
        return(TRUE);

  case WM_COMMAND:

       //
       // LOWORD added for portability
       //

       switch (LOWORD(wParam))
       {

     case IDNO:
     case IDCANCEL: ghVerifyDlg = NULL;
        EndDialog(hDlg, IDNO);
        return 0;

     case IDYES:  ghVerifyDlg = NULL;
        EndDialog(hDlg, IDYES);
        return 0;
        }

  default:
       break;

    }

    return(FALSE);

    UNREFERENCED_PARAMETER(lParam);

}

VOID CALLBACK VerifyTimerProc | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | UINT_PTR | idEvent,
 |  | DWORD | dwTime
 | ) |  |

Definition at line 1148 of file SetDisp.c.

{

    SendMessage(ghVerifyDlg, WM_COMMAND, IDNO, 0);

}

int WINAPI WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 98 of file SetDisp.c.

{

    g_hinst = hInstance;

  DialogBox(hInstance, MAKEINTRESOURCE(IDD_SETDISP), (HWND)NULL, SetDispDlgProc);

    if (gpDevModes)
    {
        free(gpDevModes);
    }

    return(FALSE);

}

Variable Documentation

struct _DLGITEMS g_sDlgItems[]
Generated on Wed Nov 13 2024 16:53:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/SetDisp/SetDisp.h File Reference

  • Multimedia
  • Gdi
  • SetDisp
Defines | Functions | Variables

SetDisp.h File Reference

#include <windows.h>

Go to the source code of this file.

Defines

#define | _INC_OLE
#define | MAX_MODES 40
#define | MIN_FREQUENCY 60
#define | MIN_WIDTH 400
#define | MYWM_NOTIFYICON (WM_APP+100)
#define | STRICT
#define | VERIFY_RESCHANGE 1
#define | VERIFY_TIMEOUT 10000

Functions

BOOL APIENTRY | About (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
BOOL | ChangeResolution (UINT nNewMode, HWND hwnd)
int | CompareDevModes (DEVMODE *leftDM, DEVMODE *rightDM)
BOOL | GetDevModes (HWND hWnd)
VOID APIENTRY | HandlePopupMenu (HWND hwnd, POINT point)
BOOL | IsNT (void)
void | NotifyAdd (HWND hDlg, UINT uIndex)
void | NotifyDelete (HWND hDlg, UINT uIndex)
INT_PTR CALLBACK | SetDispDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
BOOL | SetResolutionMenu (HWND hwnd)
BOOL | TrayMessage (HWND hDlg, DWORD dwMessage, UINT uID, HICON hIcon, PSTR pszTip)
INT_PTR CALLBACK | VerifyDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
VOID CALLBACK | VerifyTimerProc (HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)

Variables

HINSTANCE | g_hinst = NULL
HANDLE | ghVerifyDlg = NULL
UINT | gnCurrentMode = 0
INT | gnModes = -1
PDEVMODE | gpCurrentMode = NULL
PDEVMODE | gpDevModes = NULL

Define Documentation

#define _INC_OLE

Definition at line 8 of file SetDisp.h.

#define MAX_MODES 40

Definition at line 24 of file SetDisp.h.

#define MIN_FREQUENCY 60

Definition at line 25 of file SetDisp.h.

#define MIN_WIDTH 400

Definition at line 26 of file SetDisp.h.

#define MYWM_NOTIFYICON (WM_APP+100)

Definition at line 18 of file SetDisp.h.

#define STRICT

Definition at line 6 of file SetDisp.h.

#define VERIFY_RESCHANGE 1

Definition at line 19 of file SetDisp.h.

#define VERIFY_TIMEOUT 10000

Definition at line 22 of file SetDisp.h.

Function Documentation

BOOL APIENTRY About | ( | HWND | hDlg,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 445 of file Generic.C.

{
   static  HFONT hfontDlg;    // Font for dialog text
   static   HFONT hFinePrint; // Font for 'fine print' in dialog
   DWORD   dwVerInfoSize;     // Size of version information block
   LPSTR   lpVersion;         // String pointer to 'version' text
   DWORD   dwVerHnd=0;        // An 'ignored' parameter, always '0'
   UINT    uVersionLen;
   WORD    wRootLen;
   BOOL    bRetCode;
   int     i;
   char    szFullPath[BUFFSIZE];
   char    szResult[BUFFSIZE];
   char    szGetName[BUFFSIZE];
   DWORD dwVersion;
   char  szVersion[40];
   DWORD dwResult;
   HRESULT hRes;

   switch (message) {
        case WM_INITDIALOG:
         ShowWindow (hDlg, SW_HIDE);

         if (PRIMARYLANGID(GetUserDefaultLangID()) == LANG_JAPANESE)
         {
            hfontDlg = CreateFont(14, 0, 0, 0, 0, 0, 0, 0, SHIFTJIS_CHARSET, 0, 0, 0,
                                  VARIABLE_PITCH | FF_DONTCARE, "");
            hFinePrint = CreateFont(11, 0, 0, 0, 0, 0, 0, 0, SHIFTJIS_CHARSET, 0, 0, 0,
                                    VARIABLE_PITCH | FF_DONTCARE, "");
         }
         else
         {
            hfontDlg = CreateFont(14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                  VARIABLE_PITCH | FF_SWISS, "");
            hFinePrint = CreateFont(11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                    VARIABLE_PITCH | FF_SWISS, "");
         }

         CenterWindow (hDlg, GetWindow (hDlg, GW_OWNER));
         GetModuleFileName (hInst, szFullPath, sizeof(szFullPath));

         // Now lets dive in and pull out the version information:
         dwVerInfoSize = GetFileVersionInfoSize(szFullPath, &dwVerHnd);
         if (dwVerInfoSize) {
            LPSTR   lpstrVffInfo;
            HANDLE  hMem;
            hMem = GlobalAlloc(GMEM_MOVEABLE, dwVerInfoSize);
            lpstrVffInfo  = GlobalLock(hMem);
            GetFileVersionInfo(szFullPath, dwVerHnd, dwVerInfoSize, lpstrVffInfo);
            // The below 'hex' value looks a little confusing, but
            // essentially what it is, is the hexidecimal representation
            // of a couple different values that represent the language
            // and character set that we are wanting string values for.
            // 040904E4 is a very common one, because it means:
            //   US English, Windows MultiLingual characterset
            // Or to pull it all apart:
            // 04------        = SUBLANG_ENGLISH_USA
            // --09----        = LANG_ENGLISH
            // --11----        = LANG_JAPANESE
            // ----04E4 = 1252 = Codepage for Windows:Multilingual

            // Use safe string handling
            szGetName[sizeof(szGetName) - 1] = '\0';
            lstrcpyn(szGetName, GetStringRes(IDS_VER_INFO_LANG), sizeof(szGetName) - 1);
            if (szGetName[sizeof(szGetName) - 1] != '\0') {
                return FALSE; // Buffer overflow error
            }

            wRootLen = (WORD) lstrlen(szGetName); // Save this position

            // Set the title of the dialog using safe string handling
            hRes = StringCchCatN(szGetName, sizeof(szGetName), "ProductName", sizeof("ProductName"));
            if (FAILED(hRes)) {
                return FALSE; // Buffer overflow error
            }

            bRetCode = VerQueryValue((LPVOID)lpstrVffInfo,
               (LPSTR)szGetName,
               (LPVOID)&lpVersion,
               (UINT *)&uVersionLen);

            // Notice order of version and string...
            if (PRIMARYLANGID(GetUserDefaultLangID()) == LANG_JAPANESE)
            {
                // Use safe string handling
                hRes = StringCchCopyN(szResult, sizeof(szResult), lpVersion, lstrlen(lpVersion));
                if (FAILED(hRes)) {
                    return FALSE; // Buffer overflow error
                }
                hRes = StringCchCatN(szResult, sizeof(szResult), " ‚Ìƒo[ƒWƒ‡ƒ“î•ñ", sizeof(" ‚Ìƒo[ƒWƒ‡ƒ“î•ñ"));
                if (FAILED(hRes)) {
                    return FALSE; // Buffer overflow error
                }
            }
            else
            {
                // Use safe string handling
                hRes = StringCchCopyN(szResult, sizeof(szResult), "About ", sizeof("About "));
                if (FAILED(hRes)) {
                    return FALSE; // Buffer overflow error
                }
                hRes = StringCchCatN(szResult, sizeof(szResult), lpVersion, lstrlen(lpVersion));
                if (FAILED(hRes)) {
                    return FALSE; // Buffer overflow error
                }
            }

            // -----------------------------------------------------

            SetWindowText (hDlg, szResult);

            // Walk through the dialog items that we want to replace:
            for (i = DLG_VERFIRST; i <= DLG_VERLAST; i++) {
               GetDlgItemText(hDlg, i, szResult, sizeof(szResult));
               szGetName[wRootLen] = (char)0;
               // Use safe sting handling
               hRes = StringCchCatN(szGetName, sizeof(szGetName), szResult, sizeof(szResult));
               if (FAILED(hRes)) {
                   return FALSE; // Buffer overflow error
               }
               uVersionLen   = 0;
               lpVersion     = NULL;
               bRetCode      =  VerQueryValue((LPVOID)lpstrVffInfo,
                  (LPSTR)szGetName,
                  (LPVOID)&lpVersion,
                  (UINT *)&uVersionLen);

               if ( bRetCode && uVersionLen && lpVersion) {
                   // Replace dialog item text with version info
                   // Use safe string handling
                   hRes = StringCchCopyN(szResult, sizeof(szResult), lpVersion, lstrlen(lpVersion));
                   if (FAILED(hRes)) {
                       return FALSE; // Buffer overflow error
                   }
                   SetDlgItemText(hDlg, i, szResult);
               }
               else
               {
                  dwResult = GetLastError();

                  // Use safe string handling
                  hRes = StringCchPrintf(szResult, sizeof(szResult), GetStringRes(IDS_VERSION_ERROR), dwResult);
                  if (FAILED(hRes)) {
                      return FALSE; // Buffer overflow error
                  }

                  SetDlgItemText (hDlg, i, szResult);
               }
               SendMessage (GetDlgItem (hDlg, i), WM_SETFONT,
                  (ULONG_PTR)((i==DLG_VERLAST)?hFinePrint:hfontDlg),
                  TRUE);
            } // for (i = DLG_VERFIRST; i <= DLG_VERLAST; i++)

            GlobalUnlock(hMem);
            GlobalFree(hMem);

         } else {
            // No version information available.
         } // if (dwVerInfoSize)

            SendMessage (GetDlgItem (hDlg, IDC_LABEL), WM_SETFONT,
            (WPARAM)hfontDlg,(LPARAM)TRUE);

         // We are  using GetVersion rather then GetVersionEx
         // because earlier versions of Windows NT and Win32s
         // didn't include GetVersionEx:
         dwVersion = GetVersion();

         if (dwVersion < 0x80000000) {
            // Windows NT
            // Use safe sting handling
            hRes = StringCchPrintf(szVersion, sizeof(szVersion), "Microsoft Windows NT %u.%u (Build: %u)",
                (DWORD)(LOBYTE(LOWORD(dwVersion))),
                (DWORD)(HIBYTE(LOWORD(dwVersion))),
                (DWORD)(HIWORD(dwVersion)) );
            if (FAILED(hRes)) {
                return FALSE; // Buffer overflow error
            }
         } else if (LOBYTE(LOWORD(dwVersion))<4) {
            // Win32s
            // Use safe sting handling
            hRes = StringCchPrintf(szVersion, sizeof(szVersion), "Microsoft Win32s %u.%u (Build: %u)",
                (DWORD)(LOBYTE(LOWORD(dwVersion))),
                (DWORD)(HIBYTE(LOWORD(dwVersion))),
                (DWORD)(HIWORD(dwVersion) & ~0x8000) );
            if (FAILED(hRes)) {
                return FALSE; // Buffer overflow error
            }
         } else {
            // Windows 95
            // Use safe sting handling
            hRes = StringCchPrintf(szVersion, sizeof(szVersion), "Microsoft Windows 95 %u.%u",
                (DWORD)(LOBYTE(LOWORD(dwVersion))),
                (DWORD)(HIBYTE(LOWORD(dwVersion))) );
            if (FAILED(hRes)) {
                return FALSE; // Buffer overflow error
            }
         }

          SetWindowText (GetDlgItem(hDlg, IDC_OSVERSION), szVersion);
         ShowWindow (hDlg, SW_SHOW);
         return (TRUE);

      case WM_COMMAND:
         if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) {
            EndDialog(hDlg, TRUE);
            DeleteObject (hfontDlg);
            DeleteObject (hFinePrint);
            return (TRUE);
         }
         break;
   }

    return FALSE;
}

BOOL ChangeResolution | ( | UINT | nNewMode,
 |  | HWND | hwnd
 | ) |  |

Definition at line 567 of file SetDisp.c.

{

    LONG lResult;       //Result of ChangeDisplaySettings
    INT_PTR nUserResponse;  //Return from VerifyRes Dlg
    UINT nOldMode;

   /*
    ChangeDisplaySettings can set
  dmBitsPerPel      Bits per pixel
  dmPelsWidth     Pixel width
  dmPelsHeight      Pixel height
  dmDisplayFlags      Mode flags
  dmDisplayFrequency  Mode frequency

        but one of these must be set in the DEVMODE dmFields
        DM_BITSPERPEL     Use the dmBitsPerPel value.
        DM_PELSWIDTH      Use the dmPelsWidth value.
        DM_PELSHEIGHT     Use the dmPelsHeight value.
        DM_DISPLAYFLAGS     Use the dmDisplayFlags value.
  DM_DISPLAYFREQENCY  Use the dmDisplayFrequency value.

    dmSize must be set to the size, in bytes, of the DEVMODE structure.

    */

    //
    // First select a DevMode to use
    // to start, just cycling through them
    //

    nOldMode = gnCurrentMode;
    gnCurrentMode = nNewMode;

    //
    // Increment ptr to the new mode
    //

    gpCurrentMode = gpDevModes;
    gpCurrentMode += nNewMode;

    //
    // Verify that the DEVMODE select will change something
    //

    if (!(DM_BITSPERPEL      & gpCurrentMode->dmFields ||
          DM_PELSWIDTH       & gpCurrentMode->dmFields ||
          DM_PELSHEIGHT      & gpCurrentMode->dmFields ||
          DM_DISPLAYFLAGS  & gpCurrentMode->dmFields ||
          DM_DISPLAYFREQUENCY & gpCurrentMode->dmFields ) )

    {

  //
        // Note our DEVMODE returned from EnumDisplaySettings
  // So we should never enter here
  //

        gnCurrentMode = nOldMode;

        gpCurrentMode = gpDevModes;
        gpCurrentMode += gnCurrentMode;

        return (FALSE);
    }

    /************************************************************\
    *                                                            *
    *   Possible Flags for param 2 of ChangeDisplay Settings     *
    *    0          The graphics mode for the current            *
    *                screen will be changed dynamically.         *
    *    CDS_UPDATEREGISTRY The graphics mode for the            *
    *                current screen will be changed dynamically  *
    *                and the graphics mode will be updated in    *
    *                the registry. The mode information is       *
    *                stored in the USER profile.                 *
    *    CDS_TEST The system tests if the requested            *
    *                graphics mode could be set.                 *
    *                                                            *
    \************************************************************/

    //
    // First have the system test if we can set it
    //

    //
    // Param 1 is the new DEVMODE
    // Param 2 is Test Flag,
    // which asks the operating system if this is a valid setting
    // to change to -- wedon't want to make the system unusable
    //

  // Note: ChangeDisplaySettings required dmSize to be
  // set to structSize, so we set that here

    lResult = ChangeDisplaySettings
                ( gpCurrentMode,
                  CDS_TEST );

    if (lResult == DISP_CHANGE_RESTART)
    {
        MessageBox(hwnd, "This mode requires a reboot which\n"  \
                         "is not supported in this sample.",
       "SetDisp Message", IDOK);

        gnCurrentMode = nOldMode;
        gpCurrentMode = gpDevModes;
        gpCurrentMode += gnCurrentMode;

        return FALSE;
    }

    if (DISP_CHANGE_SUCCESSFUL ==lResult)
    {

   //
   // Param 2 is 0 to change dynamically
   // hence the app name SetDisp!
   //

  // Note: ChangeDisplaySettings required dmSize to be
  // set to structSize, so we set that here

         lResult = ChangeDisplaySettings
                     ( gpCurrentMode,
                       0 );
    }

    switch (lResult)
    {

    case DISP_CHANGE_SUCCESSFUL:  //The settings change was successful.
   TRC("DISP_CHANGE_SUCCESSFUL\n");
   break;

    case DISP_CHANGE_RESTART:   //The computer must be restarted in order
                                  //  for the graphics mode to work.
         TRC("DISP_CHANGE_RESTART\n");
         break;

    case DISP_CHANGE_BADFLAGS:    //An invalid set of flags was passed in.
         TRC("DISP_CHANGE_BADFLAGS\n");
         break;

    case DISP_CHANGE_FAILED:    //The display driver failed the specified
                                  //  graphics mode.
         TRC("DISP_CHANGE_FAILED\n");
         break;

    case DISP_CHANGE_BADMODE:   //The graphics mode is not supported.
         TRC("DISP_CHANGE_BADMODE\n");
         break;

    case DISP_CHANGE_NOTUPDATED:  //Windows NT only: Unable to write settings
                                  //  to the registry.
         TRC("DISP_CHANGE_NOTUPDATED\n");
         break;
    default:
   TRC("Undocumented return value!!!!\n");
   break;
    }

    //
    // Set a timer to only give the user so much
    // time to dedice incase the screen is garbled
    //

    SetTimer(hwnd,  VERIFY_RESCHANGE, VERIFY_TIMEOUT, VerifyTimerProc);

    //
    // Have the user verify the new resolution and depth
    //

    nUserResponse = DialogBox(g_hinst,// handle this application
                              MAKEINTRESOURCE(IDD_VERIFYRES),// identifies dialog box template
                              NULL,               // handle to owner window
                              VerifyDlgProc);  // the dialog box procedure

    //
    // The verification is over, kill the timer
    //

    KillTimer(hwnd, VERIFY_RESCHANGE);

    if (IDYES == nUserResponse)
    {

  //
  // Keep resolution and update registry
  //

        char szTip[50];
        memset(szTip, 0, 50);

  //
  // TODO: give them three choices:
        //       Dynamic only, Registry too, or Abort
  //

  // Note: ChangeDisplaySettings required dmSize to be
  // set to structSize, so we set that here

        lResult = ChangeDisplaySettings
                    ( gpCurrentMode,
                      CDS_UPDATEREGISTRY );  //  Flag to update registry

        switch (lResult)

        {

        case DISP_CHANGE_SUCCESSFUL:

      //
      // The settings change was successful.
      //

            TRC("DISP_CHANGE_SUCCESSFUL - reg\n");

            _snprintf(szTip, sizeof(szTip) - 1,
                 "%d x %d, %d bit color at %d hz",
                 gpCurrentMode->dmPelsWidth,
                 gpCurrentMode->dmPelsHeight,
                 gpCurrentMode->dmBitsPerPel,
                 gpCurrentMode->dmDisplayFrequency);

             {

     //
     // Update the Menu informtion, just a check mark for now
     //

                 HMENU hMenu, hMenu2;

                 hMenu = GetMenu(hwnd);

                 hMenu2 = GetSubMenu (hMenu, 0);

     //
     // Uncheck the old
     //

                 CheckMenuItem (hMenu2, nOldMode, MF_BYPOSITION | MF_UNCHECKED);

     //
     // Check the new
     //

     CheckMenuItem (hMenu2, gnCurrentMode, MF_BYPOSITION | MF_CHECKED);

             }

       //
       // Update the Notify_Icon quick tip
       //

             TrayMessage(hwnd, NIM_MODIFY, g_sDlgItems[0].uNotify,
                    LoadImage(g_hinst, MAKEINTRESOURCE(IDI_SETDISP),
                    IMAGE_ICON, 16, 16, 0), szTip);

             break;

        case DISP_CHANGE_RESTART:   //The computer must be restarted in order
                                      //  for the graphics mode to work.
             TRC("DISP_CHANGE_RESTART - reg\n");
             break;

        case DISP_CHANGE_BADFLAGS:    //An invalid set of flags was passed in.
             TRC("DISP_CHANGE_BADFLAGS - reg\n");
             break;

        case DISP_CHANGE_FAILED:    //The display driver failed the specified
                                      //  graphics mode.
             TRC("DISP_CHANGE_FAILED - reg\n");
             break;

        case DISP_CHANGE_BADMODE:   //The graphics mode is not supported.
             TRC("DISP_CHANGE_BADMODE - reg\n");
             break;

        case DISP_CHANGE_NOTUPDATED:  //Windows NT only: Unable to write settings
                                      //  to the registry.
             TRC("DISP_CHANGE_NOTUPDATED - reg\n");
             break;
        default:
              TRC("Undocumented return value!!!! - reg\n");
              break;
        }

    }

    else

    {
  //
  // The user chose to not keep the setting or  we timed out
        // so they may not have seen the dialog box to choose
        //
        // Change resolution back by calling
        // ChangeDisplaySettings
        // with a NULL DEVMODE which returns us to the current
        // registry settings
  //

  // Note: ChangeDisplaySettings required dmSize to be
  // set to structSize, so we set that here

        lResult = ChangeDisplaySettings
                    ( NULL,
                      0 );  // 0 to change dynamically

        gnCurrentMode = nOldMode;

        gpCurrentMode = gpDevModes;
        gpCurrentMode += gnCurrentMode;

    }

    return (TRUE);

}

int CompareDevModes | ( | DEVMODE * | leftDM,
 |  | DEVMODE * | rightDM
 | ) |  |

Definition at line 1288 of file SetDisp.c.

{

    //
    // Return 1  if left is bigger
    //        0  if equal
    //        -1 if right is bigger
    //
    // Comparison order is Width then Height then Bits then Frequency
    // This is an arbitrary order of importance. Often BitPerPels is
    // on considered the most important measure of a display setting
    //
    // return on the first one that is larger between left and right
    //

    if (leftDM->dmPelsWidth  > rightDM->dmPelsWidth)
    {
        return 1;
    }
    else if (leftDM->dmPelsWidth  < rightDM->dmPelsWidth)
    {
        return -1;
    }

    if (leftDM->dmPelsHeight > rightDM->dmPelsHeight)
    {
        return 1;
    }
    else if (leftDM->dmPelsHeight < rightDM->dmPelsHeight)
    {
        return -1;
    }

    if (leftDM->dmBitsPerPel > rightDM->dmBitsPerPel)
    {
        return 1;
    }
    else if (leftDM->dmBitsPerPel < rightDM->dmBitsPerPel)
    {
        return -1;
    }

    if (leftDM->dmDisplayFrequency > rightDM->dmDisplayFrequency)
    {
        return 1;
    }
    else if (leftDM->dmDisplayFrequency < rightDM->dmDisplayFrequency)
    {
        return -1;
    }

    //
    // All are equal
    //

    return 0;

}

BOOL GetDevModes ( HWND hWnd )

Definition at line 332 of file SetDisp.c.

{

    BOOL bRet = TRUE;
    BOOL bAddDM;
    UINT iModeNum = 0;
    DEVMODE CurrentDM, WorkingDM;
    INT i, structSize;
    UINT nlist;
    LPDEVMODE pDM;

    //
    // setting param 1 to NULL (lpszDeviceName) uses current device on NT
    // and NULL is required on Win95
    //

    if (IsNT())
    {
  //
  // NT specific; returns current devmode when param 2 set to ENUM_CURRENT_SETTINGS,
  //

  EnumDisplaySettings (NULL, ENUM_CURRENT_SETTINGS, &CurrentDM);
    }

    //
    // Determine how much memory we need
    //

    for (iModeNum = 0, gnModes = -1;
         bRet && (gnModes <= MAX_MODES);
         iModeNum++)
    {
        bRet = EnumDisplaySettings
                     (NULL,            // use default device
                     iModeNum,         // DEVMODEs start at 0
                     &WorkingDM);      // if successful the system
                                       // fills in the DEVMODE
                                       // structure

        //
        // For some reason my driver supports 1 hz display frequency
        // So filter out settings we do not want to display
        //

        if ( bRet &&
       WorkingDM.dmPelsWidth    >= MIN_WIDTH &&
            (WorkingDM.dmDisplayFrequency >= MIN_FREQUENCY  ||
       WorkingDM.dmDisplayFrequency == 0) )

      //
      // Accept 0 frequency since windows 95 does return frequency
      //
        {
            //
            // Increment to use next DEVMODE
            //

            gnModes++;
  }

    } // for loop

    if(-1 == gnModes)
    {
        MessageBox(hwnd, "No Display modes available.", "SetDisp Error", IDOK);
        return (FALSE);
    }

    //
    // We need gnModes worth of DEVMODE Structures
  // Check to make sure the system dmSize is not larger
  // than the size of DEVMODE at compile time.  If it is
  // and we do not do this check we will overwrite memory.
    //

    structSize = (sizeof(DEVMODE) >= (int) WorkingDM.dmSize ?
    sizeof(DEVMODE) : (int) WorkingDM.dmSize);

    gpDevModes = (PDEVMODE) malloc ((size_t) (gnModes + 1) * structSize);

    if (gpDevModes == NULL)
    {
        return (FALSE);
    }

    //
    // Loop through EnumDisplaySetting to get each supported DEVMODE
    // When returns false we have them all
    //

    for (iModeNum = 0, i = 0, bRet = TRUE;
         bRet && i <= gnModes;
         iModeNum++)
    {
        bRet = EnumDisplaySettings
                     (NULL,            // use default device
                     iModeNum,         // DEVMODEs start at 0
                     &WorkingDM);      // if successful the system
                                       // fills in the DEVMODE
                                       // structure

        //
        // Miniport drivers support 1 hz display frequency representing the default
        // and older drivers support 0 hz display frequency representing the default
        // So filter out settings we do not want to display
        //

        if ( bRet &&
             WorkingDM.dmPelsWidth        >= MIN_WIDTH      &&
            (WorkingDM.dmDisplayFrequency >= MIN_FREQUENCY  ||
             WorkingDM.dmDisplayFrequency == 0              ||
             WorkingDM.dmDisplayFrequency == 1))
             // Accept 0 or 1 frequency which represent default frequencies
        {
            bAddDM = TRUE;

            //
            // We will take this one unless another default has already been
            // added at these settings
            //

            if (WorkingDM.dmDisplayFrequency == 0 ||
                WorkingDM.dmDisplayFrequency == 1)
            {
                for (nlist = 0; nlist <= gnCurrentMode; nlist++)
                {
                      pDM = gpDevModes + nlist;

                      if (pDM->dmPelsWidth  == WorkingDM.dmPelsWidth   &&
                          pDM->dmPelsHeight == WorkingDM.dmPelsHeight  &&
                          pDM->dmBitsPerPel == WorkingDM.dmBitsPerPel)
                      {
                          //
                          // If everything else is the same do not add another default
                          //

                          bAddDM = FALSE;
                      }
                } // end for nlist

            } // end if default

            if (bAddDM)
            {
                //
                // Increment to use next DEVMODE
        // Note: ChangeDisplaySettings required dmSize to be
        // set to structSize, so we set that here
                //

                if (i == 0)
                {
                    gpCurrentMode = gpDevModes;
          gpCurrentMode->dmSize = (WORD)structSize;
                }
                else
                {
                    gpCurrentMode += 1;
          gpCurrentMode->dmSize = (WORD)structSize;
                }

                EnumDisplaySettings (NULL, iModeNum, gpCurrentMode);
                i++;

            } // end if bAddDM

        } // end bRet and hz if

    } // end for EnumDisplaySettings

    //
    // Sort the array for display; default sort
    // A different compare routine could sort by different attributes
    //

    qsort((void *) gpDevModes,
          (size_t) gnModes + 1,  // add one since gnModes is zero based
          (size_t) structSize,
          ( int (_cdecl*)(const void*,const void*) )CompareDevModes);

    //
    // Set gCurrentMode to CurrentDM
    //
    if (IsNT())
    {
        for (i =0; i <= gnModes; i++)
        {

            if (i == 0)
            {
                gpCurrentMode = gpDevModes;
            }
            else
            {
                gpCurrentMode += 1;
            }

            if (0 == CompareDevModes (&CurrentDM, gpCurrentMode))
            {
                gnCurrentMode = i;
                break;
            }
        }
    }
    else
    {
        //
        // Default to the first one
        // since we error out if there is not even this one
        //

        gnCurrentMode = 0;
    }

    //
    // TODO: What if some of the DEVMODES are not supported on
    //       the physical Device?
    //

    return (TRUE);

}  //GetDevModes scope

VOID APIENTRY HandlePopupMenu | ( | HWND | hwnd,
 |  | POINT | point
 | ) |  |

Definition at line 1221 of file SetDisp.c.

{

    HMENU hMenu;
    HMENU hMenuTrackPopup;

    //
    // Get the menu for the windows
    //

    hMenu = GetMenu(hwnd);

    if (!hMenu)
    {
  return;
    }

    //
    // Get the first menu in it which we will use for the call to
    // TrackPopup(). This could also have been created on the fly using
    // CreatePopupMenu and then we could have used InsertMenu() or
    // AppendMenu.
    //

    hMenuTrackPopup = GetSubMenu (hMenu, 0);

    //
    // Draw and track the "floating" popup
    //

    if (point.x < (long) (gpCurrentMode->dmPelsWidth - 50))
        point.x = (long) (gpCurrentMode->dmPelsWidth - 50);

    if (point.y < (long) (gpCurrentMode->dmPelsHeight - 50))
        point.y = (long) (gpCurrentMode->dmPelsHeight - 50);

    //
    // This is required when using a notify icon -- see KB article
    // PRB: Menus for Notification Icons Don't Work Correctly
    //

    SetForegroundWindow (hwnd);

    TrackPopupMenu (hMenuTrackPopup, TPM_LEFTBUTTON | TPM_RIGHTBUTTON,
                    point.x, point.y, 0, hwnd, NULL);

    //
    // This is required when using a notify icon -- see KB article
    // PRB: Menus for Notification Icons Don't Work Correctly
    //

    PostMessage (hwnd, WM_USER, 0, 0);

}

BOOL IsNT ( void )

Definition at line 1389 of file SetDisp.c.

{
    OSVERSIONINFO          osvi;

    osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);

    GetVersionEx(&osvi);

    if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT)
    {
        return TRUE;
    }
    else
    {
        return FALSE;
    }
}

void NotifyAdd | ( | HWND | hDlg,
 |  | UINT | uIndex
 | ) |  |

Definition at line 1125 of file SetDisp.c.

{

    TrayMessage(hDlg, NIM_ADD, g_sDlgItems[uIndex].uNotify, NULL, NULL);

}

void NotifyDelete | ( | HWND | hDlg,
 |  | UINT | uIndex
 | ) |  |

Definition at line 1104 of file SetDisp.c.

{

    TrayMessage(hDlg, NIM_DELETE, g_sDlgItems[uIndex].uNotify, NULL, NULL);

}

INT_PTR CALLBACK SetDispDlgProc | ( | HWND | hDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 129 of file SetDisp.c.

{

    switch (uMsg)
    {

    case WM_INITDIALOG:
    {
  BOOL bRet;

  //
  //Get DEVMODES
  //

  bRet = GetDevModes (hDlg);

        if (bRet == FALSE)
        {
            //
            // Failed to get DEVMODES so end the dialog
            //

      EndDialog(hDlg, TRUE);

      break;
        }

  //
  // Initialize Menu with Resolutions
  //

  SetResolutionMenu (hDlg);

  //
  // Add Tray Notify Icon
  //

  NotifyAdd(hDlg, 0);

  //
  // Update Tip to current settings
  //
  {

      char szTip[50];
        memset(szTip, 0, 50);

      //
      // Set the menu text
      //

      if (IsNT())
            {
                _snprintf(szTip, sizeof(szTip) - 1,
                          "%d x %d, %d bit color at %d hz",
                          gpCurrentMode->dmPelsWidth,
                          gpCurrentMode->dmPelsHeight,
                          gpCurrentMode->dmBitsPerPel,
                          gpCurrentMode->dmDisplayFrequency);
            }
            else
            {
                szTip[0] = '\0';
            }

      //
      // For the current mode, set the tool tip
        //

      TrayMessage(hDlg, NIM_MODIFY, g_sDlgItems[0].uNotify,
                        LoadImage(g_hinst, MAKEINTRESOURCE(IDI_SETDISP),
                        IMAGE_ICON, 16, 16, 0), szTip);
  }

  SetForegroundWindow (hDlg);

  break;

    } // WM_INITDIALOG:

    case WM_DESTROY:  NotifyDelete(hDlg, 0);
      break;

    case WM_COMMAND:
    {
  switch (GET_WM_COMMAND_ID(wParam, lParam))
  {
      case IDCANCEL:   EndDialog(hDlg, TRUE);
           break;

      case IDABORT:    ShowWindow(hDlg, SW_HIDE);
           break;

      case IDM_ABOUT:
      DialogBox(g_hinst, MAKEINTRESOURCE(IDD_ABOUT),
          hDlg, (DLGPROC)About);
      break;

      default:

      //
      // handle MYWM_NOTIFYICON + 10 + i for diffent devmodes
      //

            if ( MYWM_NOTIFYICON + 10  <= GET_WM_COMMAND_ID(wParam, lParam) &&
     MYWM_NOTIFYICON + 11 + gnModes >= GET_WM_COMMAND_ID(wParam, lParam))
      {
    UINT nNewMode;

                nNewMode = GET_WM_COMMAND_ID(wParam, lParam) - (MYWM_NOTIFYICON + 10);

    //
    // Only update if they chose a new setting
    //

                if (gnCurrentMode != nNewMode)
                {
       ChangeResolution (nNewMode, hDlg);
    }

    break;

            }

  } //WM_COMMAN switch

    } //WM_COMMAND

    case MYWM_NOTIFYICON:
    {
  switch (lParam)
  {

      case WM_LBUTTONDOWN:

     //
     // Handle popup here when user right mouse clicks tray icon
     //
     {

         //
         // Handle popup here
         //

         POINT point;

         GetCursorPos (&point);

         HandlePopupMenu (hDlg, point);

         break;

     }

      case WM_RBUTTONDOWN:
     switch (wParam)
     {

        //
        // Diplay the dialog box on Left mouse click
        // this is how the user gets the dialog back if it is hidden
        //

        case IDC_NOTIFY1:  ShowWindow (hDlg, SW_RESTORE);
               SetForegroundWindow (hDlg);
               break;

        default:
       break;

      }

      default:
     break;

  }  // lParam switch

    }// MYWM_NOTIFYICON

    default:
   return(FALSE);

    }  // switch (uMsg)

    return(TRUE);

}

BOOL SetResolutionMenu ( HWND hwnd )

Definition at line 905 of file SetDisp.c.

{

    HMENU hMenu, hWndMenu; //hMenuTrackPopup;
    INT i;
    BOOL bRet=FALSE;
    PDEVMODE pDevMode = gpDevModes;

    //
    // Create new Resolutions menu from the DevModes collected
    //

    hMenu = CreateMenu();

    if (!hMenu)
    {
       return (FALSE);
    }

    //
    // For each devmode add an menu item
    // TODO: make the description on BitPerPel better
    //

    for(i=0; i<= gnModes; i++)
    {

        char szRes[50];
        memset(szRes, 0, 50);

        if (i == 0)
        {
            pDevMode = gpDevModes;
        }
        else
        {
            pDevMode += 1;
  }

        //
  // Set the menu text
  //

        if (pDevMode->dmDisplayFrequency == 0 ||
            pDevMode->dmDisplayFrequency == 1)
  {
        _snprintf(szRes, sizeof(szRes) - 1,
                 "%d x %d, %d bit color, default frequency",
                 pDevMode->dmPelsWidth,
                 pDevMode->dmPelsHeight,
                 pDevMode->dmBitsPerPel);
  }
  else
  {
        _snprintf(szRes, sizeof(szRes) - 1,
                 "%d x %d, %d bit color at %d hz",
                 pDevMode->dmPelsWidth,
                 pDevMode->dmPelsHeight,
                 pDevMode->dmBitsPerPel,
                 pDevMode->dmDisplayFrequency);
  }

        bRet = AppendMenu (hMenu, MF_STRING, MYWM_NOTIFYICON + 10 + i, szRes);

        SetMenuItemBitmaps(
      hMenu,   // handle of menu
      gnCurrentMode, // menu item to receive new bitmaps
                  MF_BYPOSITION, // menu item flags
                  NULL,          // handle of unchecked bitmap
      NULL);   // handle of checked bitmap
                                 // if last two are NULL the default
                                 // bitmap is used

    } // for loop to set menu

    if (!bRet)
    {

        //
        // if the last one worked they all likely worked
        // otherwise let's clean up
        //

        DestroyMenu(hMenu);

        return(FALSE);

    }
    else
    {

        if (IsNT())
        {
            //
            // Check the Current one
            //

            CheckMenuItem (hMenu, gnCurrentMode, MF_BYPOSITION | MF_CHECKED);

            //
            // Set it as the default so it is easy to go back to
            //

      SetMenuDefaultItem(hMenu, gnCurrentMode, TRUE ); //TRUE if for by Position

        }

        hWndMenu = GetMenu (hwnd);

        InsertMenu (hWndMenu, 0, MF_POPUP|MF_BYPOSITION, (DWORD_PTR)hMenu, "&Resolutions");

        return(TRUE);

    }

}

BOOL TrayMessage | ( | HWND | hDlg,
 |  | DWORD | dwMessage,
 |  | UINT | uID,
 |  | HICON | hIcon,
 |  | PSTR | pszTip
 | ) |  |

Definition at line 1036 of file SetDisp.c.

{
    BOOL res;
    NOTIFYICONDATA tnd;

    //
    // Get the Tray Icon
    //

    hIcon = (HICON)LoadImage(g_hinst, MAKEINTRESOURCE(IDI_SETDISP), IMAGE_ICON,
           16, 16, 0);

    tnd.cbSize    = sizeof(NOTIFYICONDATA);
    tnd.hWnd    = hDlg;
    tnd.uID   = uID;
    tnd.uFlags    = NIF_MESSAGE|NIF_ICON|NIF_TIP;
    tnd.uCallbackMessage= MYWM_NOTIFYICON;
    tnd.hIcon   = hIcon;

    //
    // If there is a specific tip, set it
    // otherwise use SetDisp as the default
    //

    memset(tnd.szTip, 0, sizeof(tnd.szTip));
    if (pszTip)
    {
  lstrcpyn(tnd.szTip, pszTip, sizeof(tnd.szTip));
    }
    else
    {
  lstrcpyn(tnd.szTip, "SetDisp", sizeof("SetDisp"));;
    }

    //
    //  Use the Shell_NotifyIcon API to setup the tray icon
    //

    res = Shell_NotifyIcon(dwMessage, &tnd);

    if (hIcon)
    {
   DestroyIcon(hIcon);
    }

    return res;

}

INT_PTR CALLBACK VerifyDlgProc | ( | HWND | hDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 1170 of file SetDisp.c.

{
    switch(uMsg)
    {
  case WM_INITDIALOG: ghVerifyDlg = hDlg;
        return(TRUE);

  case WM_COMMAND:

       //
       // LOWORD added for portability
       //

       switch (LOWORD(wParam))
       {

     case IDNO:
     case IDCANCEL: ghVerifyDlg = NULL;
        EndDialog(hDlg, IDNO);
        return 0;

     case IDYES:  ghVerifyDlg = NULL;
        EndDialog(hDlg, IDYES);
        return 0;
        }

  default:
       break;

    }

    return(FALSE);

    UNREFERENCED_PARAMETER(lParam);

}

VOID CALLBACK VerifyTimerProc | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | UINT_PTR | idEvent,
 |  | DWORD | dwTime
 | ) |  |

Definition at line 1148 of file SetDisp.c.

{

    SendMessage(ghVerifyDlg, WM_COMMAND, IDNO, 0);

}

Variable Documentation

HINSTANCE g_hinst = NULL

Definition at line 33 of file SetDisp.h.

HANDLE ghVerifyDlg = NULL

Definition at line 38 of file SetDisp.h.

UINT gnCurrentMode = 0

Definition at line 41 of file SetDisp.h.

INT gnModes = -1

Definition at line 40 of file SetDisp.h.

PDEVMODE gpCurrentMode = NULL

Definition at line 36 of file SetDisp.h.

PDEVMODE gpDevModes = NULL

Definition at line 35 of file SetDisp.h.

Generated on Wed Nov 13 2024 16:53:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/TextFx/Fx.c File Reference

  • Multimedia
  • Gdi
  • TextFx
Classes | Typedefs | Functions

Fx.c File Reference

#include <windows.h>
#include "fx.h"

Go to the source code of this file.

Classes

struct | tagSEG

Typedefs

typedef struct tagSEG | PTS

Functions

VOID CALLBACK | AddSegment (int x, int y, PTS *pts)
VOID CALLBACK | CountPoints (int x, int y, LPDWORD lpdwNumPts)
BOOL | FillOut (LPPOINT *lpPoints, LPDWORD lpdwNumPts)
void | GetRealTextExtent (LPPOINT lpPoints, int iNumPts, LPSIZE size)
BOOL | PolyDraw95 (HDC hdc, CONST LPPOINT lppt, CONST LPBYTE lpbTypes, int cCount)
BOOL | RenderPathPoints (HDC hDC, LPPOINT lpPoints, LPBYTE lpTypes, int iNumPts, BOOL bOutline)
BOOL | TextEffect (HDC hDC, LPPOINT lpTop, LPPOINT lpBot, DWORD dwTopPts, DWORD dwBotPts, LPSTR szText, BOOL bOutlineOnly)

Typedef Documentation

typedef struct tagSEG PTS

Function Documentation

VOID CALLBACK AddSegment | ( | int | x,
 |  | int | y,
 |  | PTS * | pts
 | ) |  |

Definition at line 44 of file Fx.c.

{
   pts->lpPoints[pts->dwPos].x = x;
   pts->lpPoints[pts->dwPos].y = y;
   pts->dwPos++;
}

VOID CALLBACK CountPoints | ( | int | x,
 |  | int | y,
 |  | LPDWORD | lpdwNumPts
 | ) |  |

Definition at line 57 of file Fx.c.

{
   (*lpdwNumPts)++;

   UNREFERENCED_PARAMETER(x);
   UNREFERENCED_PARAMETER(y);
}

BOOL FillOut | ( | LPPOINT * | lpPoints,
 |  | LPDWORD | lpdwNumPts
 | ) |  |

Definition at line 74 of file Fx.c.

{
   DWORD i;
   LPPOINT lpPts = *lpPoints;
   PTS pts;
   DWORD dwNumPts = 0;

   // Make sure we have at least two points
   if (*lpdwNumPts < 2) {
     MessageBox(NULL, "You need at least two points for a guide line.", "Not enough points!", MB_ICONSTOP);
     *lpdwNumPts = 0;
     return FALSE;
   }

   // Find out how namy points are on the segments
   for (i=0; i<*lpdwNumPts - 1; i++)
     LineDDA(lpPts[i].x, lpPts[i].y, lpPts[i+1].x, lpPts[i+1].y, (LINEDDAPROC)CountPoints, (LPARAM)&dwNumPts);

   // If there are too many points, print an anoying message so the user doesnt do it again
   if (dwNumPts > MAXFILLPOINTS) {
     MessageBox(NULL, "Make your guide lines a bit shorter please!", "Too many points!", MB_ICONSTOP);
     *lpdwNumPts = 0;
     return FALSE;  // Bail
   }

   // Allocate memory for the the points and initialize our "last point" index
   pts.lpPoints = (LPPOINT)GlobalAlloc(GPTR, dwNumPts * sizeof(POINT));
   pts.dwPos = 0;

   // Convert the segments to points
   for (i=0; i<*lpdwNumPts - 1; i++)
     LineDDA(lpPts[i].x, lpPts[i].y, lpPts[i+1].x, lpPts[i+1].y, (LINEDDAPROC)AddSegment, (LPARAM)&pts);

   // Get rid of the original array of segments...
   GlobalFree(lpPts);

   // ... and replace it with the new points
   *lpPoints = pts.lpPoints;
   *lpdwNumPts = pts.dwPos;

   // Check to see if anything hit the fan
   if (!pts.dwPos)
     return FALSE;

   return TRUE;
}

void GetRealTextExtent | ( | LPPOINT | lpPoints,
 |  | int | iNumPts,
 |  | LPSIZE | size
 | ) |  |

Definition at line 220 of file Fx.c.

{
  int i;

  for (i=0; i<iNumPts; i++) {
    if (lpPoints[i].x > size->cx) size->cx = lpPoints[i].x;
    if (lpPoints[i].y > size->cy) size->cy = lpPoints[i].y;
  }
}

BOOL PolyDraw95 | ( | HDC | hdc,
 |  | CONST LPPOINT | lppt,
 |  | CONST LPBYTE | lpbTypes,
 |  | int | cCount
 | ) |  |

Definition at line 134 of file Fx.c.

{
  int i;

  for (i=0; i<cCount; i++)
    switch (lpbTypes[i]) {
      case PT_MOVETO :
         MoveToEx(hdc, lppt[i].x, lppt[i].y, NULL);
         break;

      case PT_LINETO | PT_CLOSEFIGURE:
      case PT_LINETO :
         LineTo(hdc, lppt[i].x, lppt[i].y);
         break;

      case PT_BEZIERTO | PT_CLOSEFIGURE:
      case PT_BEZIERTO :
       PolyBezierTo(hdc, &lppt[i], 3);
     i+=2;
         break;
   }

   return TRUE;
}

BOOL RenderPathPoints | ( | HDC | hDC,
 |  | LPPOINT | lpPoints,
 |  | LPBYTE | lpTypes,
 |  | int | iNumPts,
 |  | BOOL | bOutline
 | ) |  |

Definition at line 176 of file Fx.c.

{
  BeginPath(hDC); // Draw into a path so that we can use FillPath()

  PolyDraw95(hDC, lpPoints, lpTypes, iNumPts);

  CloseFigure(hDC);
  EndPath(hDC);

  // Draw the path
  if (bOutline)
    StrokePath(hDC); // As an outline
  else
  {              // As solid figures
        int iROP2 = SetROP2(hDC, R2_MERGEPENNOT);
        HPEN hPen = SelectObject(hDC, GetStockObject(NULL_PEN)); // Just say "no" to outlines
        HBRUSH hBrush = SelectObject(hDC, GetStockObject(BLACK_BRUSH)); // Paint It Black

        FillPath(hDC);

        // Restore the DC to its previous state
        SetROP2(hDC, iROP2);
        SelectObject(hDC, hPen);
        SelectObject(hDC, hBrush);
  }

  return TRUE;
}

BOOL TextEffect | ( | HDC | hDC,
 |  | LPPOINT | lpTop,
 |  | LPPOINT | lpBot,
 |  | DWORD | dwTopPts,
 |  | DWORD | dwBotPts,
 |  | LPSTR | szText,
 |  | BOOL | bOutlineOnly
 | ) |  |

Definition at line 241 of file Fx.c.

{
  LPPOINT lpPoints;     // Path data points
  LPBYTE lpTypes;       // Path data types
  int i, iNumPts;
  SIZE size = {0,0};          // Text size info
  int iTopInd, iBotInd;   // Guide array indices
  float fXScale, fYScale;   // Scaling values

  // Set to transparent so we dont get an outline around the text string
  SetBkMode(hDC, TRANSPARENT);

  // Output the text into a path
  BeginPath(hDC);
  __try {
    TextOut(hDC, 0, 0, szText, strlen(szText));
  } __except (EXCEPTION_EXECUTE_HANDLER) {
    return FALSE;
  }
  EndPath(hDC);

  // How many points are in the path
  iNumPts = GetPath(hDC, NULL, NULL, 0);
  if (iNumPts == -1) return FALSE;

  // Allocate room for the points
  lpPoints = (LPPOINT)GlobalAlloc(GPTR, sizeof(POINT) * iNumPts);
  if (!lpPoints) return FALSE;

  // Allocate room for the point types
  lpTypes = GlobalAlloc(GPTR, iNumPts);
  if (!lpTypes) {
    GlobalFree(lpPoints);
    return FALSE;
  }

  // Get the points and types from the current path
  iNumPts = GetPath(hDC, lpPoints, lpTypes, iNumPts);

  // Even more error checking
  if (iNumPts == -1) {
    GlobalFree(lpTypes);
    GlobalFree(lpPoints);
    return FALSE;
  }

  // Get the exact extents of our text
  GetRealTextExtent(lpPoints, iNumPts, &size);

  // Relocate the points in the path based on the guide lines
  for (i=0; i < iNumPts; i++) {
    // How far along is this point on the x-axis
    fXScale = (float)lpPoints[i].x / (float)size.cx;

    // What point on the top guide does this coorespond to
    iTopInd = (int)(fXScale * (dwTopPts-1));
    // What point on the bottom guide does this coorespond to
    iBotInd = (int)(fXScale * (dwBotPts-1));

    // How far along is this point on the y-axis
    fYScale = (float)lpPoints[i].y / (float)size.cy;

    // Scale the points to their new locations
    lpPoints[i].x = (int)((lpBot[iBotInd].x * fYScale) + (lpTop[iTopInd].x * (1.0f-fYScale)));
    lpPoints[i].y = (int)((lpBot[iBotInd].y * fYScale) + (lpTop[iTopInd].y * (1.0f-fYScale)));
  }

  // Draw the new path
  RenderPathPoints(hDC, lpPoints, lpTypes, iNumPts, bOutlineOnly);

  GlobalFree(lpPoints);
  GlobalFree(lpTypes);

  return TRUE;
}

Generated on Wed Nov 13 2024 16:53:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/TextFx/Fx.h File Reference

  • Multimedia
  • Gdi
  • TextFx
Defines | Functions

Fx.h File Reference

#include <windows.h>

Go to the source code of this file.

Defines

#define | MAXFILLPOINTS 64000

Functions

BOOL | FillOut (LPPOINT *, LPDWORD)
BOOL | RenderAndFillPath (HDC, LPPOINT, LPBYTE, int)
BOOL | RenderPathPoints (HDC, LPPOINT, LPBYTE, int, BOOL)
BOOL | TextEffect (HDC, LPPOINT, LPPOINT, DWORD, DWORD, LPSTR, BOOL)

Define Documentation

#define MAXFILLPOINTS 64000

Definition at line 20 of file Fx.h.

Function Documentation

BOOL FillOut | ( | LPPOINT * | ,
 |  | LPDWORD |
 | ) |  |

Definition at line 74 of file Fx.c.

{
   DWORD i;
   LPPOINT lpPts = *lpPoints;
   PTS pts;
   DWORD dwNumPts = 0;

   // Make sure we have at least two points
   if (*lpdwNumPts < 2) {
     MessageBox(NULL, "You need at least two points for a guide line.", "Not enough points!", MB_ICONSTOP);
     *lpdwNumPts = 0;
     return FALSE;
   }

   // Find out how namy points are on the segments
   for (i=0; i<*lpdwNumPts - 1; i++)
     LineDDA(lpPts[i].x, lpPts[i].y, lpPts[i+1].x, lpPts[i+1].y, (LINEDDAPROC)CountPoints, (LPARAM)&dwNumPts);

   // If there are too many points, print an anoying message so the user doesnt do it again
   if (dwNumPts > MAXFILLPOINTS) {
     MessageBox(NULL, "Make your guide lines a bit shorter please!", "Too many points!", MB_ICONSTOP);
     *lpdwNumPts = 0;
     return FALSE;  // Bail
   }

   // Allocate memory for the the points and initialize our "last point" index
   pts.lpPoints = (LPPOINT)GlobalAlloc(GPTR, dwNumPts * sizeof(POINT));
   pts.dwPos = 0;

   // Convert the segments to points
   for (i=0; i<*lpdwNumPts - 1; i++)
     LineDDA(lpPts[i].x, lpPts[i].y, lpPts[i+1].x, lpPts[i+1].y, (LINEDDAPROC)AddSegment, (LPARAM)&pts);

   // Get rid of the original array of segments...
   GlobalFree(lpPts);

   // ... and replace it with the new points
   *lpPoints = pts.lpPoints;
   *lpdwNumPts = pts.dwPos;

   // Check to see if anything hit the fan
   if (!pts.dwPos)
     return FALSE;

   return TRUE;
}

BOOL RenderAndFillPath | ( | HDC | ,
 |  | LPPOINT | ,
 |  | LPBYTE | ,
 |  | int |
 | ) |  |
BOOL RenderPathPoints | ( | HDC | ,
 |  | LPPOINT | ,
 |  | LPBYTE | ,
 |  | int | ,
 |  | BOOL |
 | ) |  |

Definition at line 176 of file Fx.c.

{
  BeginPath(hDC); // Draw into a path so that we can use FillPath()

  PolyDraw95(hDC, lpPoints, lpTypes, iNumPts);

  CloseFigure(hDC);
  EndPath(hDC);

  // Draw the path
  if (bOutline)
    StrokePath(hDC); // As an outline
  else
  {              // As solid figures
        int iROP2 = SetROP2(hDC, R2_MERGEPENNOT);
        HPEN hPen = SelectObject(hDC, GetStockObject(NULL_PEN)); // Just say "no" to outlines
        HBRUSH hBrush = SelectObject(hDC, GetStockObject(BLACK_BRUSH)); // Paint It Black

        FillPath(hDC);

        // Restore the DC to its previous state
        SetROP2(hDC, iROP2);
        SelectObject(hDC, hPen);
        SelectObject(hDC, hBrush);
  }

  return TRUE;
}

BOOL TextEffect | ( | HDC | ,
 |  | LPPOINT | ,
 |  | LPPOINT | ,
 |  | DWORD | ,
 |  | DWORD | ,
 |  | LPSTR | ,
 |  | BOOL |
 | ) |  |

Definition at line 241 of file Fx.c.

{
  LPPOINT lpPoints;     // Path data points
  LPBYTE lpTypes;       // Path data types
  int i, iNumPts;
  SIZE size = {0,0};          // Text size info
  int iTopInd, iBotInd;   // Guide array indices
  float fXScale, fYScale;   // Scaling values

  // Set to transparent so we dont get an outline around the text string
  SetBkMode(hDC, TRANSPARENT);

  // Output the text into a path
  BeginPath(hDC);
  __try {
    TextOut(hDC, 0, 0, szText, strlen(szText));
  } __except (EXCEPTION_EXECUTE_HANDLER) {
    return FALSE;
  }
  EndPath(hDC);

  // How many points are in the path
  iNumPts = GetPath(hDC, NULL, NULL, 0);
  if (iNumPts == -1) return FALSE;

  // Allocate room for the points
  lpPoints = (LPPOINT)GlobalAlloc(GPTR, sizeof(POINT) * iNumPts);
  if (!lpPoints) return FALSE;

  // Allocate room for the point types
  lpTypes = GlobalAlloc(GPTR, iNumPts);
  if (!lpTypes) {
    GlobalFree(lpPoints);
    return FALSE;
  }

  // Get the points and types from the current path
  iNumPts = GetPath(hDC, lpPoints, lpTypes, iNumPts);

  // Even more error checking
  if (iNumPts == -1) {
    GlobalFree(lpTypes);
    GlobalFree(lpPoints);
    return FALSE;
  }

  // Get the exact extents of our text
  GetRealTextExtent(lpPoints, iNumPts, &size);

  // Relocate the points in the path based on the guide lines
  for (i=0; i < iNumPts; i++) {
    // How far along is this point on the x-axis
    fXScale = (float)lpPoints[i].x / (float)size.cx;

    // What point on the top guide does this coorespond to
    iTopInd = (int)(fXScale * (dwTopPts-1));
    // What point on the bottom guide does this coorespond to
    iBotInd = (int)(fXScale * (dwBotPts-1));

    // How far along is this point on the y-axis
    fYScale = (float)lpPoints[i].y / (float)size.cy;

    // Scale the points to their new locations
    lpPoints[i].x = (int)((lpBot[iBotInd].x * fYScale) + (lpTop[iTopInd].x * (1.0f-fYScale)));
    lpPoints[i].y = (int)((lpBot[iBotInd].y * fYScale) + (lpTop[iTopInd].y * (1.0f-fYScale)));
  }

  // Draw the new path
  RenderPathPoints(hDC, lpPoints, lpTypes, iNumPts, bOutlineOnly);

  GlobalFree(lpPoints);
  GlobalFree(lpTypes);

  return TRUE;
}

Generated on Wed Nov 13 2024 16:53:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/TextFx/GuidE.c File Reference

  • Multimedia
  • Gdi
  • TextFx
Functions

GuidE.c File Reference

#include <windows.h>
#include "guide.h"

Go to the source code of this file.

Functions

BOOL | GetGuideLine (HWND hWnd, LPPOINT *lpPoint, LPDWORD lpdwNumPts)
BOOL | ShowGuide (HDC hDC, LPPOINT lpPoints, DWORD dwNumPts)

Function Documentation

BOOL GetGuideLine | ( | HWND | hWnd,
 |  | LPPOINT * | lpPoint,
 |  | LPDWORD | lpdwNumPts
 | ) |  |

Definition at line 34 of file GuidE.c.

{
    MSG msg;
    HDC hDC = GetDC(hWnd);
    BOOL bFirstTime = TRUE;
    DWORD dwPos = 0;
    RECT rect;

    SetCapture(hWnd);
    GetClientRect(hWnd, &rect);

    // Allocate enough room for a reasonable line
    *lpPoint = (LPPOINT)GlobalAlloc(GPTR, MAXGUIDESEGMENTS * sizeof(POINT));

    /* Eat mouse messages until a WM_LBUTTONUP is encountered. Meanwhile
     * continue to draw a line that follows the mouse
     */
    for (;;){
        WaitMessage();
        if (PeekMessage(&msg,NULL,WM_MOUSEFIRST,WM_MOUSELAST,PM_REMOVE)) {

            // Make sure we are still tracking in our client area
            if ((LOWORD(msg.lParam) < rect.right) && (HIWORD(msg.lParam) < rect.bottom)) {

                // Set the CP to our starting position if we are starting
                if (bFirstTime) {
                  bFirstTime = FALSE;
            MoveToEx(hDC, LOWORD(msg.lParam), HIWORD(msg.lParam), NULL);
          }

                // If we dont have more points than we want...
                if (dwPos < MAXGUIDESEGMENTS) {

                // Store the point in our array
                (*lpPoint)[dwPos].x = LOWORD(msg.lParam);
                (*lpPoint)[dwPos].y = HIWORD(msg.lParam);

                // Draw from the last point to this one
                LineTo(hDC, (*lpPoint)[dwPos].x, (*lpPoint)[dwPos].y);

                // Increment our "number of points" counter
                dwPos++;
          }
            }

            // Bail when the user lets the left button up
            if (msg.message == WM_LBUTTONUP)
               break;
        }
        else
            continue;
    }

    *lpdwNumPts = dwPos;

    ReleaseDC(hWnd, hDC);

    ReleaseCapture();

    return TRUE;
}

BOOL ShowGuide | ( | HDC | hDC,
 |  | LPPOINT | lpPoints,
 |  | DWORD | dwNumPts
 | ) |  |

Definition at line 103 of file GuidE.c.

{
  HPEN hOldBrush;

  // Draw the line
  Polyline(hDC, lpPoints, dwNumPts);

  // Draw green circle to indicate line starting point
  hOldBrush = SelectObject(hDC, CreateSolidBrush(RGB(0,255,0)));
  Ellipse(hDC, lpPoints[0].x-5, lpPoints[0].y-5,
               lpPoints[0].x+5, lpPoints[0].y+5);

  // Draw red circle to indicate line ending point
  DeleteObject(SelectObject(hDC, CreateSolidBrush(RGB(255,0,0))));
  Ellipse(hDC, lpPoints[dwNumPts-1].x-5, lpPoints[dwNumPts-1].y-5,
               lpPoints[dwNumPts-1].x+5, lpPoints[dwNumPts-1].y+5);
  DeleteObject(SelectObject(hDC, hOldBrush));

  return TRUE;
}

Generated on Wed Nov 13 2024 16:53:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/TextFx/GuidE.h File Reference

  • Multimedia
  • Gdi
  • TextFx
Defines | Functions

GuidE.h File Reference

Go to the source code of this file.

Defines

#define | MAXGUIDESEGMENTS 1000

Functions

BOOL | GetGuideLine (HWND, LPPOINT *, LPDWORD)
BOOL | ShowGuide (HDC, LPPOINT, DWORD)

Define Documentation

#define MAXGUIDESEGMENTS 1000

Definition at line 18 of file GuidE.h.

Function Documentation

BOOL GetGuideLine | ( | HWND | ,
 |  | LPPOINT * | ,
 |  | LPDWORD |
 | ) |  |

Definition at line 34 of file GuidE.c.

{
    MSG msg;
    HDC hDC = GetDC(hWnd);
    BOOL bFirstTime = TRUE;
    DWORD dwPos = 0;
    RECT rect;

    SetCapture(hWnd);
    GetClientRect(hWnd, &rect);

    // Allocate enough room for a reasonable line
    *lpPoint = (LPPOINT)GlobalAlloc(GPTR, MAXGUIDESEGMENTS * sizeof(POINT));

    /* Eat mouse messages until a WM_LBUTTONUP is encountered. Meanwhile
     * continue to draw a line that follows the mouse
     */
    for (;;){
        WaitMessage();
        if (PeekMessage(&msg,NULL,WM_MOUSEFIRST,WM_MOUSELAST,PM_REMOVE)) {

            // Make sure we are still tracking in our client area
            if ((LOWORD(msg.lParam) < rect.right) && (HIWORD(msg.lParam) < rect.bottom)) {

                // Set the CP to our starting position if we are starting
                if (bFirstTime) {
                  bFirstTime = FALSE;
            MoveToEx(hDC, LOWORD(msg.lParam), HIWORD(msg.lParam), NULL);
          }

                // If we dont have more points than we want...
                if (dwPos < MAXGUIDESEGMENTS) {

                // Store the point in our array
                (*lpPoint)[dwPos].x = LOWORD(msg.lParam);
                (*lpPoint)[dwPos].y = HIWORD(msg.lParam);

                // Draw from the last point to this one
                LineTo(hDC, (*lpPoint)[dwPos].x, (*lpPoint)[dwPos].y);

                // Increment our "number of points" counter
                dwPos++;
          }
            }

            // Bail when the user lets the left button up
            if (msg.message == WM_LBUTTONUP)
               break;
        }
        else
            continue;
    }

    *lpdwNumPts = dwPos;

    ReleaseDC(hWnd, hDC);

    ReleaseCapture();

    return TRUE;
}

BOOL ShowGuide | ( | HDC | ,
 |  | LPPOINT | ,
 |  | DWORD |
 | ) |  |

Definition at line 103 of file GuidE.c.

{
  HPEN hOldBrush;

  // Draw the line
  Polyline(hDC, lpPoints, dwNumPts);

  // Draw green circle to indicate line starting point
  hOldBrush = SelectObject(hDC, CreateSolidBrush(RGB(0,255,0)));
  Ellipse(hDC, lpPoints[0].x-5, lpPoints[0].y-5,
               lpPoints[0].x+5, lpPoints[0].y+5);

  // Draw red circle to indicate line ending point
  DeleteObject(SelectObject(hDC, CreateSolidBrush(RGB(255,0,0))));
  Ellipse(hDC, lpPoints[dwNumPts-1].x-5, lpPoints[dwNumPts-1].y-5,
               lpPoints[dwNumPts-1].x+5, lpPoints[dwNumPts-1].y+5);
  DeleteObject(SelectObject(hDC, hOldBrush));

  return TRUE;
}

Generated on Wed Nov 13 2024 16:53:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/TextFx/Resource.h File Reference

  • Multimedia
  • Gdi
  • TextFx
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | DLG_VERFIRST 400
#define | DLG_VERLAST 404
#define | IDC_STATIC -1
#define | IDM_ABOUT 303
#define | IDM_CHOOSEFONT 108
#define | IDM_EXIT 106
#define | IDM_OUTLINE 126
#define | IDM_QUICKTEST 127
#define | IDM_RENDER 124
#define | IDM_SHOWGUIDES 125

Define Documentation

#define DLG_VERFIRST 400

Definition at line 12 of file Resource.h.

#define DLG_VERLAST 404

Definition at line 13 of file Resource.h.

#define IDC_STATIC -1

Definition at line 14 of file Resource.h.

#define IDM_ABOUT 303

Definition at line 11 of file Resource.h.

#define IDM_CHOOSEFONT 108

Definition at line 6 of file Resource.h.

#define IDM_EXIT 106

Definition at line 5 of file Resource.h.

#define IDM_OUTLINE 126

Definition at line 9 of file Resource.h.

#define IDM_QUICKTEST 127

Definition at line 10 of file Resource.h.

#define IDM_RENDER 124

Definition at line 7 of file Resource.h.

#define IDM_SHOWGUIDES 125

Definition at line 8 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/TextFx/TextFx.c File Reference

  • Multimedia
  • Gdi
  • TextFx
Defines | Functions | Variables

TextFx.c File Reference

#include <windows.h>
#include "resource.h"
#include <time.h>
#include "textfx.h"
#include "guide.h"
#include "fx.h"

Go to the source code of this file.

Defines

#define | FONTNAME "arial"
#define | QUICKTESTPOINTS 2
#define | random(i) (rand() % (i))

Functions

LRESULT CALLBACK | About (HWND hDlg, UINT message, WPARAM uParam, LPARAM lParam)
BOOL | CenterWindow (HWND hwndChild, HWND hwndParent)
DWORD | GetLastErrorBox (HWND hWnd, LPSTR lpTitle)
BOOL | InitApplication (HINSTANCE hInstance)
BOOL | InitInstance (HINSTANCE hInstance, int nCmdShow)
int APIENTRY | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
LRESULT CALLBACK | WndProc (HWND hWnd, UINT message, WPARAM uParam, LPARAM lParam)

Variables

HINSTANCE | hInst
char | szAppName [] = "TextFX"
char | szTitle [] = "TextFX Test Application"

Define Documentation

#define FONTNAME "arial"

Definition at line 46 of file TextFx.c.

#define QUICKTESTPOINTS 2

Definition at line 36 of file TextFx.c.

#define random ( i ) (rand() % (i))

Definition at line 44 of file TextFx.c.

Function Documentation

LRESULT CALLBACK About | ( | HWND | hDlg,
 |  | UINT | message,
 |  | WPARAM | uParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 599 of file TextFx.c.

{
    switch (message) {
        case WM_INITDIALOG:  // message: initialize dialog box
            // Center the dialog over the application window
            CenterWindow (hDlg, GetWindow (hDlg, GW_OWNER));
            return (TRUE);

        case WM_COMMAND:                      // message: received a command
            if (LOWORD(uParam) == IDOK || LOWORD(uParam) == IDCANCEL) {
                EndDialog(hDlg, TRUE);        // Exit the dialog
                return (TRUE);
            }
            break;
    }
    return (FALSE); // Didn't process the message

    UNREFERENCED_PARAMETER(lParam); // This will prevent 'unused formal parameter' warnings
}

BOOL CenterWindow | ( | HWND | hwndChild,
 |  | HWND | hwndParent
 | ) |  |

Definition at line 534 of file TextFx.c.

{
        RECT    rChild, rParent;
        int     wChild, hChild, wParent, hParent;
        int     wScreen, hScreen, xNew, yNew;
        HDC     hdc;

        // Get the Height and Width of the child window
        GetWindowRect (hwndChild, &rChild);
        wChild = rChild.right - rChild.left;
        hChild = rChild.bottom - rChild.top;

        // Get the Height and Width of the parent window
        GetWindowRect (hwndParent, &rParent);
        wParent = rParent.right - rParent.left;
        hParent = rParent.bottom - rParent.top;

        // Get the display limits
        hdc = GetDC (hwndChild);
        wScreen = GetDeviceCaps (hdc, HORZRES);
        hScreen = GetDeviceCaps (hdc, VERTRES);
        ReleaseDC (hwndChild, hdc);

        // Calculate new X position, then adjust for screen
        xNew = rParent.left + ((wParent - wChild) /2);
        if (xNew < 0) {
                xNew = 0;
        } else if ((xNew+wChild) > wScreen) {
                xNew = wScreen - wChild;
        }

        // Calculate new Y position, then adjust for screen
        yNew = rParent.top  + ((hParent - hChild) /2);
        if (yNew < 0) {
                yNew = 0;
        } else if ((yNew+hChild) > hScreen) {
                yNew = hScreen - hChild;
        }

        // Set it, and return
        return SetWindowPos (hwndChild, NULL,
                xNew, yNew, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
}

DWORD GetLastErrorBox | ( | HWND | hWnd,
 |  | LPSTR | lpTitle
 | ) |  |

Definition at line 57 of file TextFx.c.

{
   LPVOID lpv;
   DWORD  dwRv;

   if (GetLastError() == 0) return 0;

   dwRv = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
                        FORMAT_MESSAGE_FROM_SYSTEM,
                        NULL,
                        GetLastError(),
                        MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
                        (LPVOID)&lpv,
                        0,
                        NULL);

   MessageBox(hWnd, lpv, lpTitle, MB_OK);

   if(dwRv)
      LocalFree(lpv);

   SetLastError(0);
   return dwRv;
}

BOOL InitApplication ( HINSTANCE hInstance )

Definition at line 170 of file TextFx.c.

{
    WNDCLASS  wc;

    // Fill in window class structure with parameters that describe the
    // main window.

    wc.style         = CS_OWNDC;               // Class style(s).
    wc.lpfnWndProc   = (WNDPROC)WndProc;       // Window Procedure
    wc.cbClsExtra    = 0;                      // No per-class extra data.
    wc.cbWndExtra    = 0;                      // No per-window extra data.
    wc.hInstance     = hInstance;              // Owner of this class
    wc.hIcon         = LoadIcon (hInstance, szAppName); // Icon name from .RC
    wc.hCursor       = LoadCursor(NULL, IDC_ARROW);// Cursor
    wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);// Default color
    wc.lpszMenuName  = "TEXTFXMENU";           // Menu name from .RC
    wc.lpszClassName = szAppName;              // Name to register as

    // Register the window class and return success/failure code.
    return (RegisterClass(&wc));
}

BOOL InitInstance | ( | HINSTANCE | hInstance,
 |  | int | nCmdShow
 | ) |  |

Definition at line 209 of file TextFx.c.

{
    HWND            hWnd; // Main window handle.

    // Save the instance handle in static variable, which will be used in
    // many subsequence calls from this application to Windows.

    hInst = hInstance; // Store instance handle in our global variable

    // Create a main window for this application instance.

    hWnd = CreateWindow(
            szAppName,           // See RegisterClass() call.
            szTitle,             // Text for window title bar.
            WS_OVERLAPPEDWINDOW,// Window style.
            CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, // Use default positioning
            NULL,                // Overlapped windows have no parent.
            NULL,                // Use the window class menu.
            hInstance,           // This instance owns this window.
            NULL                 // We don't use any data in our WM_CREATE
    );

    // If window could not be created, return "failure"
    if (!hWnd) {
            return (FALSE);
    }

    // Make the window visible; update its client area; and return "success"
    ShowWindow(hWnd, nCmdShow); // Show the window
    UpdateWindow(hWnd);         // Sends WM_PAINT message

    return (TRUE);              // We succeeded...

}

int APIENTRY WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 103 of file TextFx.c.

{
    MSG msg;
    HANDLE hAccelTable;
  LONG lTime;

  // Just for fun, lets seed the random number generator
  time(&lTime);
    srand(lTime);

    if (!hPrevInstance) {       // Other instances of app running?
            if (!InitApplication(hInstance)) { // Initialize shared things
            return (FALSE);     // Exits if unable to initialize
        }
    }

    /* Perform initializations that apply to a specific instance */

    if (!InitInstance(hInstance, nCmdShow)) {
            return (FALSE);
    }

    hAccelTable = LoadAccelerators (hInstance, "TEXTFXACCEL");

    /* Acquire and dispatch messages until a WM_QUIT message is received. */

    while (GetMessage(&msg, // message structure
       NULL,   // handle of window receiving the message
       0,      // lowest message to examine
       0))     // highest message to examine
    {
        if (!TranslateAccelerator (msg.hwnd, hAccelTable, &msg)) {
            TranslateMessage(&msg);// Translates virtual key codes
            DispatchMessage(&msg); // Dispatches message to window
        }
    }

    return (int)(msg.wParam); // Returns the value from PostQuitMessage

    UNREFERENCED_PARAMETER(lpCmdLine); // This will prevent 'unused formal parameter' warnings
}

LRESULT CALLBACK WndProc | ( | HWND | hWnd,
 |  | UINT | message,
 |  | WPARAM | uParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 265 of file TextFx.c.

{
  int wmId, wmEvent;
    static BOOL bOn = TRUE;  // Which guide line (top = TRUE) are we on?
    static LPPOINT lpTop = NULL;
  static LPPOINT lpBot = NULL;
    static DWORD dwTop = 0;
  static DWORD dwBot = 0;
  static BOOL bOutlineOnly = FALSE;
  static BOOL bShowGuides  = FALSE;
    static HPEN hpenBlue, hpenRed;

  SetLastError(0); // Set error flag to "no errors"

  switch (message) {
      case WM_CREATE:  // Select an big Arial font into our DC
        {
          HDC hDC = GetDC(hWnd);
                LOGFONT lf;
        HFONT hf;

        ZeroMemory(&lf, sizeof(LOGFONT));
          lf.lfHeight = -72;    // Big fonts scale better
            lstrcpyn((LPSTR)&(lf.lfFaceName), FONTNAME, lstrlen(FONTNAME)+1);

          // Create and select the font
          hf = CreateFontIndirect(&lf);
          SelectObject(hDC, hf);

        hpenBlue = CreatePen(PS_SOLID, 1, RGB(0,0,255));
        hpenRed  = CreatePen(PS_SOLID, 1, RGB(255,0,0));
      }

      GetLastErrorBox(hWnd, "Error in WM_CREATE");
      break;

    case WM_PAINT:
            {
         PAINTSTRUCT ps;
         HDC hDC = BeginPaint(hWnd, &ps);
               RECT rect;

         // Clear the client area
               GetClientRect(hWnd, &rect);
               PatBlt(hDC, 0, 0, rect.right, rect.bottom, WHITENESS);

           // If we have something to show...
           if (dwTop && dwBot) {

             // Show the top guide line if we have one and the user wants to
             if (dwTop && bShowGuides) {
                     SelectObject(hDC, hpenBlue);
                     ShowGuide(hDC, lpTop, dwTop);
                     SelectObject(hDC, GetStockObject(BLACK_PEN));
                   }

             // If we have a bottom guide line
             if (dwBot) {

                   // ...then show it if the use wants to
                   if (bShowGuides) {
                     SelectObject(hDC, hpenRed);
                         ShowGuide(hDC, lpBot, dwBot);
                   SelectObject(hDC, GetStockObject(BLACK_PEN));
                       }

                   // Do the mapping and show the text
                   TextEffect(hDC, lpTop, lpBot, dwTop, dwBot, "This is a test", bOutlineOnly);
                   }
               }

               EndPaint(hWnd, &ps);
      }
            break;

    case WM_LBUTTONDOWN: // Read a guide line from the user
            {
               HDC hDC = GetDC(hWnd);
               RECT rect;

               if (bOn) {
                   GetClientRect(hWnd, &rect);

                   // Clear the screen
                   PatBlt(hDC, 0, 0, rect.right, rect.bottom, WHITENESS);

                   // Get rid of the previous guide lines
                   if (lpTop)
                     GlobalFree(lpTop);
                   if (lpBot)
                     GlobalFree(lpBot);
             dwBot = 0;

           SelectObject(hDC, hpenBlue);  // Top guide line is blue
                   GetGuideLine(hWnd, &lpTop, &dwTop);
               }
               else {
                   SelectObject(hDC, hpenRed);  // Bottom guide line is red
                   GetGuideLine(hWnd, &lpBot, &dwBot);
               }

               // Black as night, black as coal, I want to see the sun blotted out from the sky...
               SelectObject(hDC, GetStockObject(BLACK_PEN));
               bOn = !bOn;

         if (bOn) {

                  // Expand the line segment into points
                FillOut(&lpTop, &dwTop);
                  FillOut(&lpBot, &dwBot);

                  InvalidateRect(hWnd, NULL, FALSE);  // Draw the text via WM_PAINT
               }
            }

      GetLastErrorBox(hWnd, "Error in WM_LBUTTONDOWN");
            break;

        case WM_COMMAND:
            wmId    = LOWORD(uParam);
            wmEvent = HIWORD(uParam);

            switch (wmId) {
        case IDM_QUICKTEST:  // Randomly generate guide lines
            {
            RECT rect;
            int i;

            bOn = TRUE;  // Reset to top guide line

            GetClientRect(hWnd, &rect);
            if (dwTop)
              GlobalFree(lpTop);
            if (dwBot)
              GlobalFree(lpBot);

            // Allocate top guide line
            lpTop = (LPPOINT)GlobalAlloc(GPTR, sizeof(POINT) * QUICKTESTPOINTS);
            if (!lpTop) break;

            // Allocate bottom guide line
            lpBot = (LPPOINT)GlobalAlloc(GPTR, sizeof(POINT) * QUICKTESTPOINTS);
            if (!lpBot) {
              GlobalFree(lpTop);
            break;
            }

            // Generate points
            for (i=0; i<QUICKTESTPOINTS; i++) {
              lpTop[i].x = random(rect.right);
                        lpTop[i].y = random(rect.bottom);
            lpBot[i].x = random(rect.right);
                        lpBot[i].y = random(rect.bottom);
            }

            // Set number of points for top and bottom lines
            dwTop = QUICKTESTPOINTS;
            dwBot = QUICKTESTPOINTS;

            // Expand the line segment into points
                  FillOut(&lpTop, &dwTop);
                      FillOut(&lpBot, &dwBot);

                InvalidateRect(hWnd, NULL, FALSE);  // Draw the text via WM_PAINT
          }

          GetLastErrorBox(hWnd, "Error in IDM_QUICKTEST");
          break;

              case IDM_CHOOSEFONT: // Let the user pick a font
          {
             HDC hDC = GetDC(hWnd);
                       HFONT hf;
             LOGFONT lf;
             CHOOSEFONT cf;

               ZeroMemory(&cf, sizeof(cf));
             ZeroMemory(&lf, sizeof(lf));

             cf.lStructSize = sizeof(CHOOSEFONT);
             cf.lpLogFont = &lf;
                       cf.Flags = CF_SCREENFONTS | CF_TTONLY;

             if (ChooseFont(&cf)) {
                           lf.lfHeight = -72;    // Bigger fonts look better
                 hf = CreateFontIndirect(&lf);
                           DeleteObject(SelectObject(hDC, hf));
             }
              }

              // If we have text to show then re-render it
          if (dwTop && dwBot)
            InvalidateRect(hWnd, NULL, FALSE);  // Draw the text via WM_PAINT

          GetLastErrorBox(hWnd, "Error in IDM_CHOOSEFONT");
              break;

        case IDM_SHOWGUIDES:  // User toggled guide display
                    bShowGuides = !bShowGuides;
                    CheckMenuItem(GetMenu(hWnd), IDM_SHOWGUIDES, bShowGuides ? MF_CHECKED : MF_UNCHECKED);

          // If we have text to show then re-render it
          if (dwTop && dwBot)
            InvalidateRect(hWnd, NULL, FALSE);  // Draw the text via WM_PAINT

          GetLastErrorBox(hWnd, "Error in IDM_SHOWGUIDES");
                    break;

        case IDM_OUTLINE:   // User toggled display of text as outline
                    bOutlineOnly = !bOutlineOnly;
                    CheckMenuItem(GetMenu(hWnd), IDM_OUTLINE, bOutlineOnly ? MF_CHECKED : MF_UNCHECKED);

          // If we have text to show then re-render it
          if (dwTop && dwBot)
            InvalidateRect(hWnd, NULL, FALSE);  // Draw the text via WM_PAINT

          GetLastErrorBox(hWnd, "Error in IDM_OUTLINE");
                    break;

                case IDM_ABOUT:
                    DialogBox(hInst,          // current instance
                             "ABOUTBOX",      // dlg resource to use
                             hWnd,            // parent handle
                             (DLGPROC)About); // About() instance address

                    break;

                case IDM_EXIT:
          DestroyWindow (hWnd);
                    break;

                default:
                    return (DefWindowProc(hWnd, message, uParam, lParam));
            }
            break;

        case WM_DESTROY:  // message: window being destroyed
                if (lpTop) GlobalFree(lpTop);
        if (lpBot) GlobalFree(lpBot);

                PostQuitMessage(0);
                break;

        default:          // Passes it on if unproccessed
                return (DefWindowProc(hWnd, message, uParam, lParam));
  }
  return (0);
}

Variable Documentation

HINSTANCE hInst

Definition at line 38 of file TextFx.c.

char szAppName[] = "TextFX"

Definition at line 40 of file TextFx.c.

char szTitle[] = "TextFX Test Application"

Definition at line 41 of file TextFx.c.

Generated on Wed Nov 13 2024 16:53:44 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/TextFx/TextFx.h File Reference

  • Multimedia
  • Gdi
  • TextFx
Functions

TextFx.h File Reference

Go to the source code of this file.

Functions

LRESULT CALLBACK | About (HWND, UINT, WPARAM, LPARAM)
BOOL InitApplication (HANDLE)
BOOL | InitInstance (HANDLE, int)
LRESULT CALLBACK | WndProc (HWND, UINT, WPARAM, LPARAM)

Function Documentation

LRESULT CALLBACK About | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 445 of file Generic.C.

{
   static  HFONT hfontDlg;    // Font for dialog text
   static   HFONT hFinePrint; // Font for 'fine print' in dialog
   DWORD   dwVerInfoSize;     // Size of version information block
   LPSTR   lpVersion;         // String pointer to 'version' text
   DWORD   dwVerHnd=0;        // An 'ignored' parameter, always '0'
   UINT    uVersionLen;
   WORD    wRootLen;
   BOOL    bRetCode;
   int     i;
   char    szFullPath[BUFFSIZE];
   char    szResult[BUFFSIZE];
   char    szGetName[BUFFSIZE];
   DWORD dwVersion;
   char  szVersion[40];
   DWORD dwResult;
   HRESULT hRes;

   switch (message) {
        case WM_INITDIALOG:
         ShowWindow (hDlg, SW_HIDE);

         if (PRIMARYLANGID(GetUserDefaultLangID()) == LANG_JAPANESE)
         {
            hfontDlg = CreateFont(14, 0, 0, 0, 0, 0, 0, 0, SHIFTJIS_CHARSET, 0, 0, 0,
                                  VARIABLE_PITCH | FF_DONTCARE, "");
            hFinePrint = CreateFont(11, 0, 0, 0, 0, 0, 0, 0, SHIFTJIS_CHARSET, 0, 0, 0,
                                    VARIABLE_PITCH | FF_DONTCARE, "");
         }
         else
         {
            hfontDlg = CreateFont(14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                  VARIABLE_PITCH | FF_SWISS, "");
            hFinePrint = CreateFont(11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                    VARIABLE_PITCH | FF_SWISS, "");
         }

         CenterWindow (hDlg, GetWindow (hDlg, GW_OWNER));
         GetModuleFileName (hInst, szFullPath, sizeof(szFullPath));

         // Now lets dive in and pull out the version information:
         dwVerInfoSize = GetFileVersionInfoSize(szFullPath, &dwVerHnd);
         if (dwVerInfoSize) {
            LPSTR   lpstrVffInfo;
            HANDLE  hMem;
            hMem = GlobalAlloc(GMEM_MOVEABLE, dwVerInfoSize);
            lpstrVffInfo  = GlobalLock(hMem);
            GetFileVersionInfo(szFullPath, dwVerHnd, dwVerInfoSize, lpstrVffInfo);
            // The below 'hex' value looks a little confusing, but
            // essentially what it is, is the hexidecimal representation
            // of a couple different values that represent the language
            // and character set that we are wanting string values for.
            // 040904E4 is a very common one, because it means:
            //   US English, Windows MultiLingual characterset
            // Or to pull it all apart:
            // 04------        = SUBLANG_ENGLISH_USA
            // --09----        = LANG_ENGLISH
            // --11----        = LANG_JAPANESE
            // ----04E4 = 1252 = Codepage for Windows:Multilingual

            // Use safe string handling
            szGetName[sizeof(szGetName) - 1] = '\0';
            lstrcpyn(szGetName, GetStringRes(IDS_VER_INFO_LANG), sizeof(szGetName) - 1);
            if (szGetName[sizeof(szGetName) - 1] != '\0') {
                return FALSE; // Buffer overflow error
            }

            wRootLen = (WORD) lstrlen(szGetName); // Save this position

            // Set the title of the dialog using safe string handling
            hRes = StringCchCatN(szGetName, sizeof(szGetName), "ProductName", sizeof("ProductName"));
            if (FAILED(hRes)) {
                return FALSE; // Buffer overflow error
            }

            bRetCode = VerQueryValue((LPVOID)lpstrVffInfo,
               (LPSTR)szGetName,
               (LPVOID)&lpVersion,
               (UINT *)&uVersionLen);

            // Notice order of version and string...
            if (PRIMARYLANGID(GetUserDefaultLangID()) == LANG_JAPANESE)
            {
                // Use safe string handling
                hRes = StringCchCopyN(szResult, sizeof(szResult), lpVersion, lstrlen(lpVersion));
                if (FAILED(hRes)) {
                    return FALSE; // Buffer overflow error
                }
                hRes = StringCchCatN(szResult, sizeof(szResult), " ‚Ìƒo[ƒWƒ‡ƒ“î•ñ", sizeof(" ‚Ìƒo[ƒWƒ‡ƒ“î•ñ"));
                if (FAILED(hRes)) {
                    return FALSE; // Buffer overflow error
                }
            }
            else
            {
                // Use safe string handling
                hRes = StringCchCopyN(szResult, sizeof(szResult), "About ", sizeof("About "));
                if (FAILED(hRes)) {
                    return FALSE; // Buffer overflow error
                }
                hRes = StringCchCatN(szResult, sizeof(szResult), lpVersion, lstrlen(lpVersion));
                if (FAILED(hRes)) {
                    return FALSE; // Buffer overflow error
                }
            }

            // -----------------------------------------------------

            SetWindowText (hDlg, szResult);

            // Walk through the dialog items that we want to replace:
            for (i = DLG_VERFIRST; i <= DLG_VERLAST; i++) {
               GetDlgItemText(hDlg, i, szResult, sizeof(szResult));
               szGetName[wRootLen] = (char)0;
               // Use safe sting handling
               hRes = StringCchCatN(szGetName, sizeof(szGetName), szResult, sizeof(szResult));
               if (FAILED(hRes)) {
                   return FALSE; // Buffer overflow error
               }
               uVersionLen   = 0;
               lpVersion     = NULL;
               bRetCode      =  VerQueryValue((LPVOID)lpstrVffInfo,
                  (LPSTR)szGetName,
                  (LPVOID)&lpVersion,
                  (UINT *)&uVersionLen);

               if ( bRetCode && uVersionLen && lpVersion) {
                   // Replace dialog item text with version info
                   // Use safe string handling
                   hRes = StringCchCopyN(szResult, sizeof(szResult), lpVersion, lstrlen(lpVersion));
                   if (FAILED(hRes)) {
                       return FALSE; // Buffer overflow error
                   }
                   SetDlgItemText(hDlg, i, szResult);
               }
               else
               {
                  dwResult = GetLastError();

                  // Use safe string handling
                  hRes = StringCchPrintf(szResult, sizeof(szResult), GetStringRes(IDS_VERSION_ERROR), dwResult);
                  if (FAILED(hRes)) {
                      return FALSE; // Buffer overflow error
                  }

                  SetDlgItemText (hDlg, i, szResult);
               }
               SendMessage (GetDlgItem (hDlg, i), WM_SETFONT,
                  (ULONG_PTR)((i==DLG_VERLAST)?hFinePrint:hfontDlg),
                  TRUE);
            } // for (i = DLG_VERFIRST; i <= DLG_VERLAST; i++)

            GlobalUnlock(hMem);
            GlobalFree(hMem);

         } else {
            // No version information available.
         } // if (dwVerInfoSize)

            SendMessage (GetDlgItem (hDlg, IDC_LABEL), WM_SETFONT,
            (WPARAM)hfontDlg,(LPARAM)TRUE);

         // We are  using GetVersion rather then GetVersionEx
         // because earlier versions of Windows NT and Win32s
         // didn't include GetVersionEx:
         dwVersion = GetVersion();

         if (dwVersion < 0x80000000) {
            // Windows NT
            // Use safe sting handling
            hRes = StringCchPrintf(szVersion, sizeof(szVersion), "Microsoft Windows NT %u.%u (Build: %u)",
                (DWORD)(LOBYTE(LOWORD(dwVersion))),
                (DWORD)(HIBYTE(LOWORD(dwVersion))),
                (DWORD)(HIWORD(dwVersion)) );
            if (FAILED(hRes)) {
                return FALSE; // Buffer overflow error
            }
         } else if (LOBYTE(LOWORD(dwVersion))<4) {
            // Win32s
            // Use safe sting handling
            hRes = StringCchPrintf(szVersion, sizeof(szVersion), "Microsoft Win32s %u.%u (Build: %u)",
                (DWORD)(LOBYTE(LOWORD(dwVersion))),
                (DWORD)(HIBYTE(LOWORD(dwVersion))),
                (DWORD)(HIWORD(dwVersion) & ~0x8000) );
            if (FAILED(hRes)) {
                return FALSE; // Buffer overflow error
            }
         } else {
            // Windows 95
            // Use safe sting handling
            hRes = StringCchPrintf(szVersion, sizeof(szVersion), "Microsoft Windows 95 %u.%u",
                (DWORD)(LOBYTE(LOWORD(dwVersion))),
                (DWORD)(HIBYTE(LOWORD(dwVersion))) );
            if (FAILED(hRes)) {
                return FALSE; // Buffer overflow error
            }
         }

          SetWindowText (GetDlgItem(hDlg, IDC_OSVERSION), szVersion);
         ShowWindow (hDlg, SW_SHOW);
         return (TRUE);

      case WM_COMMAND:
         if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) {
            EndDialog(hDlg, TRUE);
            DeleteObject (hfontDlg);
            DeleteObject (hFinePrint);
            return (TRUE);
         }
         break;
   }

    return FALSE;
}

BOOL InitApplication ( HANDLE )

Definition at line 123 of file ClipText.c.

{
    WNDCLASS  wc = {0};

    wc.lpfnWndProc = (WNDPROC) MainWndProc;
    wc.hInstance = hInstance;
    wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
    wc.hCursor = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
    wc.lpszMenuName =  TEXT("CliptextMenu");
    wc.lpszClassName = TEXT("CliptextWClass");

    return (RegisterClass(&wc));
}

BOOL InitInstance | ( | HANDLE | ,
 |  | int |
 | ) |  |

Definition at line 126 of file ComDlg32.C.

{
    HWND            hWnd;

  // Save off the handle to the current instance.
    g_hInst = hInstance;

    // Create a main window for this application instance.
    hWnd = CreateWindow(
        "Comdlg32WClass",
        "Common Dialog Sample Application",
        WS_OVERLAPPEDWINDOW,            // Window style.
        CW_USEDEFAULT,                  // Default horizontal position.
        CW_USEDEFAULT,                  // Default vertical position.
        CW_USEDEFAULT,                  // Default width.
        CW_USEDEFAULT,                  // Default height.
        NULL,                           // Overlapped windows have no parent.
        NULL,                           // Use the window class menu.
        g_hInst,                        // This instance owns this window.
        NULL                            // Pointer not needed.
    );

    // If window could not be created, return "failure".
    if (!hWnd)
        return (FALSE);

    // Register the window messages to receive.
    cdmsgShareViolation = RegisterWindowMessage(szmsgSHAREVIOLATION);
    cdmsgFileOK         = RegisterWindowMessage(szmsgFILEOK);
    cdmsgHelp           = RegisterWindowMessage(szCommdlgHelp);

    // Make the window visible; update its client area; and return "success".
    ShowWindow(hWnd, nCmdShow);
    UpdateWindow(hWnd);
    return (TRUE);

}

LRESULT CALLBACK WndProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 290 of file Generic.C.

{
   int wmId, wmEvent;
   PAINTSTRUCT ps;
   HDC hdc;
      POINT pnt;
   HMENU hMenu;
      BOOL bGotHelp;

   switch (message) {

      case WM_COMMAND:
         wmId    = LOWORD(wParam); // Remember, these are...
         wmEvent = HIWORD(wParam); // ...different for Win32!

         //Parse the menu selections:
         switch (wmId) {

            case IDM_ABOUT:
               DialogBox(hInst, "AboutBox", hWnd, (DLGPROC)About);
               break;

            case IDM_EXIT:
               DestroyWindow (hWnd);
               break;

            case IDM_HELPTOPICS: // Only called in Windows 95
               bGotHelp = WinHelp (hWnd, APPNAME".HLP", HELP_FINDER,(DWORD)0);
               if (!bGotHelp)
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            case IDM_HELPCONTENTS: // Not called in Windows 95
               bGotHelp = WinHelp (hWnd, APPNAME".HLP", HELP_CONTENTS,(DWORD)0);
               if (!bGotHelp)
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            case IDM_HELPSEARCH: // Not called in Windows 95
               if (!WinHelp(hWnd, APPNAME".HLP", HELP_PARTIALKEY,
                           (ULONG_PTR)(LPSTR)""))
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            case IDM_HELPHELP: // Not called in Windows 95
               if(!WinHelp(hWnd, (LPSTR)NULL, HELP_HELPONHELP, 0))
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            // Here are all the other possible menu options,
            // all of these are currently disabled:
            case IDM_NEW:
            case IDM_OPEN:
            case IDM_SAVE:
            case IDM_SAVEAS:
            case IDM_UNDO:
            case IDM_CUT:
            case IDM_COPY:
            case IDM_PASTE:
            case IDM_LINK:
            case IDM_LINKS:

            default:
               return (DefWindowProc(hWnd, message, wParam, lParam));
         }
         break;

      case WM_NCRBUTTONUP: // RightClick on windows non-client area...
         if (IS_WIN95 && SendMessage(hWnd, WM_NCHITTEST, 0, lParam) == HTSYSMENU)
         {
            // The user has clicked the right button on the applications
            // 'System Menu'. Here is where you would alter the default
            // system menu to reflect your application. Notice how the
            // explorer deals with this. For this app, we aren't doing
            // anything
            return (DefWindowProc(hWnd, message, wParam, lParam));
         } else {
            // Nothing we are interested in, allow default handling...
            return (DefWindowProc(hWnd, message, wParam, lParam));
         }
            break;

        case WM_RBUTTONDOWN: // RightClick in windows client area...
            pnt.x = LOWORD(lParam);
            pnt.y = HIWORD(lParam);
            ClientToScreen(hWnd, (LPPOINT) &pnt);
      // This is where you would determine the appropriate 'context'
      // menu to bring up. Since this app has no real functionality,
      // we will just bring up the 'Help' menu:
            hMenu = GetSubMenu (GetMenu (hWnd), 2);
            if (hMenu) {
                TrackPopupMenu (hMenu, 0, pnt.x, pnt.y, 0, hWnd, NULL);
            } else {
            // Couldn't find the menu...
                MessageBeep(0);
            }
            break;

      case WM_DISPLAYCHANGE: // Only comes through on plug'n'play systems
      {
         SIZE  szScreen;
         DWORD dwBitsPerPixel = (DWORD)wParam;

         szScreen.cx = LOWORD(lParam);
         szScreen.cy = HIWORD(lParam);

         MessageBox (GetFocus(), GetStringRes(IDS_DISPLAYCHANGED),
                     szAppName, 0);
      }
      break;

      case WM_PAINT:
         hdc = BeginPaint (hWnd, &ps);
         // Add any drawing code here...
         EndPaint (hWnd, &ps);
         break;

      case WM_DESTROY:
         // Tell WinHelp we don't need it any more...
               WinHelp (hWnd, APPNAME".HLP", HELP_QUIT,(DWORD)0);
         PostQuitMessage(0);
         break;

      default:
         return (DefWindowProc(hWnd, message, wParam, lParam));
   }
   return (0);
}

Generated on Wed Nov 13 2024 16:53:44 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/ViewDIB/DIBSectn.c File Reference

  • Multimedia
  • Gdi
  • ViewDIB
Defines | Functions

DIBSectn.c File Reference

#include <Windows.h>
#include <stdlib.h>
#include <stdio.h>
#include "DibSectn.h"

Go to the source code of this file.

Defines

#define | BYTESPERLINE(Width, BPP) ((WORD)((((DWORD)(Width) * (DWORD)(BPP) + 31) >> 5)) << 2)
#define | NEW_DIB_FORMAT(lpbih) (lpbih->biSize != sizeof(BITMAPCOREHEADER))
#define | SWAP(x, y) ((x)^=(y)^=(x)^=(y))

Functions

BYTE | CountBits (DWORD dw)
WORD | DIBColorTableSize (LPVOID lpv)
WORD | DIBNumColors (LPVOID lpv)
DWORD WINAPI | DSBitsPerPixel (HBITMAP hBitmap)
DWORD WINAPI | DSColorTableSize (LPBITMAPINFO pbmi)
HBITMAP WINAPI | DSCopyBitmap (HBITMAP hbmp, HPALETTE hPal)
HBITMAP WINAPI | DSCopyBitmapEx (HBITMAP hbmp, HPALETTE hPal, WORD wBits)
HBITMAP WINAPI | DSCreateDDBForDS (HBITMAP hbmp)
HBITMAP WINAPI | DSCreateDIBSection (DWORD dwX, DWORD dwY, WORD wBits)
HPALETTE WINAPI | DSCreatePaletteForDIBSection (HBITMAP hBitmap)
HPALETTE WINAPI | DSCreateSpectrumPalette (void)
BOOL WINAPI | DSDrawDIBSectionOnDC (HDC hDC, HBITMAP hBitmap, LPRECT pRect)
LPBITMAPINFO WINAPI | DSGetBITMAPINFOForDIBSection (HBITMAP hBitmap)
HGLOBAL WINAPI | DSGetDIBFromDIBSection (HBITMAP hbmp)
HBITMAP WINAPI | DSGetDIBSectionFromClipboard ()
BOOL WINAPI | DSGetOptimalDIBFormat (HDC hdc, BITMAPINFOHEADER *pbi)
LPBYTE WINAPI | DSGetPointerToDIBSectionImageBits (HBITMAP hBitmap)
BOOL WINAPI | DSGetRGBBitsPerPixel (HDC hdc, PINT pRed, PINT pGreen, PINT pBlue)
DWORD WINAPI | DSImageBitsSize (LPBITMAPINFO pbmi)
BOOL WINAPI | DSLoadDIBSectionFromBMPFile (LPTSTR szFileName, HBITMAP *phBitmap, HPALETTE *phPalette)
BOOL WINAPI | DSPutDIBSectionOnClipboard (HBITMAP hbm)
BOOL WINAPI | DSStoreDIBSectionInBMPFile (LPTSTR szFileName, HBITMAP hBitmap)
DWORD WINAPI | DSTotalBytesSize (LPBITMAPINFO pbmi)

Define Documentation

#define BYTESPERLINE | ( | Width,
 |  | BPP |
 | ) |  | ((WORD)((((DWORD)(Width) * (DWORD)(BPP) + 31) >> 5)) << 2)

Definition at line 61 of file DIBSectn.c.

#define NEW_DIB_FORMAT ( lpbih ) (lpbih->biSize != sizeof(BITMAPCOREHEADER))

Definition at line 62 of file DIBSectn.c.

#define SWAP | ( | x,
 |  | y |
 | ) |  | ((x)^=(y)^=(x)^=(y))

Definition at line 65 of file DIBSectn.c.

Function Documentation

BYTE CountBits ( DWORD dw )

Definition at line 916 of file DIBSectn.c.

{
   int iBits = 0;

   while (dw) {
       iBits += (dw & 1);
       dw >>= 1;
   }

   return (BYTE)iBits;
}

WORD DIBColorTableSize ( LPVOID lpv )

Definition at line 1050 of file DIBSectn.c.

{
    LPBITMAPINFOHEADER lpbih = (LPBITMAPINFOHEADER)lpv;

    if (NEW_DIB_FORMAT(lpbih))
    {
      if (((LPBITMAPINFOHEADER)(lpbih))->biCompression == BI_BITFIELDS)
         /* Remember that 16/32bpp dibs can still have a color table */
         return (sizeof(DWORD) * 3) + (DIBNumColors (lpbih) * sizeof (RGBQUAD));
      else
         return (DIBNumColors (lpbih) * sizeof (RGBQUAD));
    }
    else
      return (DIBNumColors (lpbih) * sizeof (RGBTRIPLE));
}

WORD DIBNumColors ( LPVOID lpv )

Definition at line 1009 of file DIBSectn.c.

{
    INT                 bits;
    LPBITMAPINFOHEADER  lpbih = (LPBITMAPINFOHEADER)lpv;
    LPBITMAPCOREHEADER  lpbch = (LPBITMAPCOREHEADER)lpv;

    /*  With the BITMAPINFO format headers, the size of the palette
     *  is in biClrUsed, whereas in the BITMAPCORE - style headers, it
     *  is dependent on the bits per pixel (= 2 raised to the power of
     *  bits/pixel).
     */

    if (NEW_DIB_FORMAT(lpbih)) {
      if (lpbih->biClrUsed != 0)
        return (WORD)lpbih->biClrUsed;
      bits = lpbih->biBitCount;
    }
    else
      bits = lpbch->bcBitCount;

    if (bits > 8)
      return 0; /* Since biClrUsed is 0, we dont have a an optimal palette */
    else
      return (WORD)(1 << bits);
}

DWORD WINAPI DSBitsPerPixel ( HBITMAP hBitmap )

Definition at line 835 of file DIBSectn.c.

{
    DIBSECTION  ds;

    GetObject(hBitmap, sizeof(DIBSECTION), &ds);
    return (ds.dsBmih.biBitCount * ds.dsBmih.biPlanes);
}

DWORD WINAPI DSColorTableSize ( LPBITMAPINFO pbmi )

Definition at line 663 of file DIBSectn.c.

{
    DWORD dwColors;

    dwColors = 0;
    if(pbmi->bmiHeader.biClrUsed != 0)
        dwColors = pbmi->bmiHeader.biClrUsed;
    else if(pbmi->bmiHeader.biBitCount > 8)
        dwColors = 0;
    else
        dwColors = 1 << (pbmi->bmiHeader.biBitCount * pbmi->bmiHeader.biPlanes);

    if(pbmi->bmiHeader.biCompression == BI_BITFIELDS)
        return (sizeof(DWORD)*3) + (dwColors*sizeof(RGBQUAD));

    return (dwColors*sizeof(RGBQUAD));
}

HBITMAP WINAPI DSCopyBitmap | ( | HBITMAP | hbmp,
 |  | HPALETTE | hPal
 | ) |  |

Definition at line 1310 of file DIBSectn.c.

{
    BITMAP      bm;

  if (!GetObject(hbmp, sizeof(BITMAP), &bm))
    return (HBITMAP)NULL;

  // Create a DIB section to hold our copy of the data
  return DSCopyBitmapEx(hbmp, hPal, (WORD)(bm.bmPlanes*bm.bmBitsPixel));
}

HBITMAP WINAPI DSCopyBitmapEx | ( | HBITMAP | hbmp,
 |  | HPALETTE | hPal,
 |  | WORD | wBits
 | ) |  |

Definition at line 1224 of file DIBSectn.c.

{
    HBITMAP         hBitmap = NULL;
  BOOL      bNeedToCleanUp = FALSE;
    BITMAP      bm;
  HDC       hdcSrc, hdcDst;
  RGBQUAD     rgbq[256];
  int       iNumColors, i;

  if (!GetObject(hbmp, sizeof(BITMAP), &bm))
    return (HBITMAP)NULL;

  // Create a DIB section to hold our copy of the data
  hBitmap = DSCreateDIBSection(bm.bmWidth, bm.bmHeight, wBits);

  hdcSrc = CreateCompatibleDC(NULL);
  hdcDst = CreateCompatibleDC(NULL);

  if (hPal) {
    // Get the colors from the palette and copy them to our color table
    iNumColors = GetPaletteEntries(hPal, 0, 256, (LPPALETTEENTRY)rgbq);

    // RGB in PALETTEENTRYs and RGBQUADs are in different order so adjust
    for (i=0; i<iNumColors; i++) {
      SWAP(rgbq[i].rgbBlue, rgbq[i].rgbRed);
      rgbq[i].rgbReserved = 0;
    }
  } else
    if (wBits <= 8) { // We need some sort of color table for the target image
      // We're creating the palette rather than using one that was
      // passed in so we need to remember to clean it up before returning
      bNeedToCleanUp = TRUE;

      // Get the palette from the source images
      hPal = DSCreatePaletteForDIBSection(hbmp);

      // Convert it to RGBQUAD format
      iNumColors = GetPaletteEntries(hPal, 0, 256, (LPPALETTEENTRY)rgbq);

      // RGB in PALETTEENTRYs and RGBQUADs are in different order so adjust
      for (i=0; i<iNumColors; i++) {
        SWAP(rgbq[i].rgbBlue, rgbq[i].rgbRed);
        rgbq[i].rgbReserved = 0;
      }
    } else {
      hPal = GetStockObject(DEFAULT_PALETTE);
      iNumColors = 0;
    }

  // Prepare the source bitmap
  SelectObject(hdcSrc, hbmp);
  SelectPalette(hdcSrc, hPal, FALSE);
  RealizePalette(hdcSrc);

  // Prepare the destination bitmap
  SelectObject(hdcDst, hBitmap);
  SelectPalette(hdcDst, hPal, FALSE);
  RealizePalette(hdcDst);
  if (iNumColors)
    SetDIBColorTable(hdcDst, 0, iNumColors, rgbq);

  BitBlt(hdcDst, 0,0, bm.bmWidth, bm.bmHeight, hdcSrc, 0,0, SRCCOPY);

  DeleteDC(hdcSrc);
  DeleteDC(hdcDst);

  if (bNeedToCleanUp)
    DeleteObject(hPal);

    return hBitmap;
}

HBITMAP WINAPI DSCreateDDBForDS ( HBITMAP hbmp )

Definition at line 1135 of file DIBSectn.c.

{
    HBITMAP   hBitmap;
  HPALETTE  hPal;
  BITMAP    bm;
  HDC     hdcSrc, hdcDst;
  HDC     hdcScreen;

  // Get information about the surface
  if (!GetObject(hbmp, sizeof(BITMAP), &bm))
    return (HBITMAP)NULL;

  hdcScreen = GetDC(NULL);
  hPal = DSCreatePaletteForDIBSection(hbmp);

  // Create a DIB section to hold our copy of the data
  hBitmap = CreateCompatibleBitmap(hdcScreen, bm.bmWidth, bm.bmHeight);
  hdcSrc = CreateCompatibleDC(hdcScreen);
  hdcDst = CreateCompatibleDC(hdcScreen);

  // Prepare the source bitmap
  SelectObject(hdcSrc, hbmp);
  SelectPalette(hdcSrc, hPal, FALSE);
  RealizePalette(hdcSrc);

  // Prepare the destination bitmap
  SelectObject(hdcDst, hBitmap);
  SelectPalette(hdcDst, hPal, FALSE);
  RealizePalette(hdcDst);

  // Copy the contents of the surface from the source to the destination
  BitBlt(hdcDst, 0,0, bm.bmWidth, bm.bmHeight, hdcSrc, 0,0, SRCCOPY);

  // Clean up
  DeleteDC(hdcSrc);
  DeleteDC(hdcDst);
  DeleteObject(hPal);

    return hBitmap;
}

HBITMAP WINAPI DSCreateDIBSection | ( | DWORD | dwX,
 |  | DWORD | dwY,
 |  | WORD | wBits
 | ) |  |

Definition at line 87 of file DIBSectn.c.

{
    HBITMAP         hBitmap;
    LPBYTE          pBits;
    int             nInfoSize;
    LPBITMAPINFO    pbmi;
    HDC             hRefDC;

    nInfoSize = sizeof(BITMAPINFOHEADER);

    if(wBits <= 8)
        nInfoSize += sizeof(RGBQUAD) * (1 << wBits);

    if((wBits == 16) || (wBits == 15) || (wBits == 32))
        nInfoSize += 3 * sizeof(DWORD);

    // Create the header big enough to contain color table and bitmasks if needed
    pbmi = (LPBITMAPINFO)malloc(nInfoSize);
    if ( !pbmi )
        return (HBITMAP)NULL;

    ZeroMemory(pbmi, nInfoSize);
    pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
    pbmi->bmiHeader.biWidth = dwX;
    pbmi->bmiHeader.biHeight = dwY;
    pbmi->bmiHeader.biPlanes = 1;
    pbmi->bmiHeader.biBitCount = wBits;
    pbmi->bmiHeader.biCompression = BI_RGB; // override below for 16 and 32bpp

    switch(wBits)
    {
        case 24:
            // 24bpp requires no special handling
        break;

        case 15:
    {   // if it's 15bpp, fill in the masks and override the compression
            // these are the default masks - you could change them if needed
            LPDWORD pMasks = (LPDWORD)(pbmi->bmiColors);
            pMasks[0] = 0x00007c00;
            pMasks[1] = 0x000003e0;
            pMasks[2] = 0x0000001f;
            pbmi->bmiHeader.biCompression = BI_BITFIELDS;
      pbmi->bmiHeader.biBitCount = 16;  // 15 bpp is really 16 bpp
        }
        break;

    case 16:
        {   // if it's 16bpp, fill in the masks and override the compression
            // these are the default masks - you could change them if needed
            LPDWORD pMasks = (LPDWORD)(pbmi->bmiColors);
            pMasks[0] = 0x0000f800;
            pMasks[1] = 0x000007e0;
            pMasks[2] = 0x0000001f;
            pbmi->bmiHeader.biCompression = BI_BITFIELDS;
        }
        break;

        case 32:
        {   // if it's 32bpp, fill in the masks and override the compression
            // these are the default masks - you could change them if needed
            LPDWORD pMasks = (LPDWORD)(pbmi->bmiColors);
            pMasks[0] = 0x00ff0000;
            pMasks[1] = 0x0000ff00;
            pMasks[2] = 0x000000ff;
            pbmi->bmiHeader.biCompression = BI_BITFIELDS;
        }
        break;

        case 8:
        {
            HPALETTE        hPal;
            PALETTEENTRY    pe[256];
            int             i;

            // at this point, prgb points to the color table, even
            // if bitmasks are present
            hPal = DSCreateSpectrumPalette();
            GetPaletteEntries(hPal, 0, 256, pe);

            for(i=0;i<256;i++)
            {
                pbmi->bmiColors[i].rgbRed = pe[i].peRed;
                pbmi->bmiColors[i].rgbGreen = pe[i].peGreen;
                pbmi->bmiColors[i].rgbBlue = pe[i].peBlue;
                pbmi->bmiColors[i].rgbReserved = 0;
            }

            DeleteObject(hPal);
            pbmi->bmiHeader.biClrUsed = 256;
        }
        break;

        case 4:
        {   // Use a default 16 color table for 4bpp DIBSections
            RGBTRIPLE       rgb[16] = { { 0x00, 0x00, 0x00 }, // black
                                        { 0x80, 0x00, 0x00 }, // dark red
                                        { 0x00, 0x80, 0x00 }, // dark green
                                        { 0x80, 0x80, 0x00 }, // dark yellow
                                        { 0x00, 0x00, 0x80 }, // dark blue
                                        { 0x80, 0x00, 0x80 }, // dark magenta
                                        { 0x00, 0x80, 0x80 }, // dark cyan
                                        { 0xC0, 0xC0, 0xC0 }, // light gray
                                    //  { 0xC0, 0xDC, 0xC0 }, // money green
                                    //  { 0xA6, 0xCA, 0xF0 }, // sky blue
                                    //  { 0xFF, 0xFB, 0xF0 }, // cream
                                    //  { 0xA0, 0xA0, 0xA4 }, // light gray
                                        { 0x80, 0x80, 0x80 }, // medium gray
                                        { 0xFF, 0x00, 0x00 }, // red
                                        { 0x00, 0xFF, 0x00 }, // green
                                        { 0xFF, 0xFF, 0x00 }, // yellow
                                        { 0x00, 0x00, 0xFF }, // blue
                                        { 0xFF, 0x00, 0xFF }, // magenta
                                        { 0x00, 0xFF, 0xFF }, // cyan
                                        { 0xFF, 0xFF, 0xFF } }; // white
            int             i;

            for(i=0;i<16;i++)
            {
                pbmi->bmiColors[i].rgbRed = rgb[i].rgbtRed;
                pbmi->bmiColors[i].rgbGreen = rgb[i].rgbtGreen;
                pbmi->bmiColors[i].rgbBlue = rgb[i].rgbtBlue;
                pbmi->bmiColors[i].rgbReserved = 0;
            }
            pbmi->bmiHeader.biClrUsed = 16;
        }
        break;

        case 1: // BW
            pbmi->bmiColors[0].rgbRed = pbmi->bmiColors[0].rgbGreen = pbmi->bmiColors[0].rgbBlue = 0;
            pbmi->bmiColors[1].rgbRed = pbmi->bmiColors[1].rgbGreen = pbmi->bmiColors[1].rgbBlue = 255;
            pbmi->bmiColors[0].rgbReserved = pbmi->bmiColors[1].rgbReserved = 0;
        break;
    }

    hRefDC = GetDC(NULL);
    hBitmap = CreateDIBSection(hRefDC, pbmi, DIB_RGB_COLORS, &pBits, NULL, 0);
    nInfoSize = GetLastError();
    ReleaseDC(NULL, hRefDC);
    free(pbmi);

    if(hBitmap == NULL)
    {
        TCHAR   szTemp[64];
        _snprintf(szTemp, sizeof(szTemp)-1, "Error %d", nInfoSize);
        szTemp[sizeof(szTemp)-1] = '\0';
        MessageBox(NULL, szTemp, "Error", MB_OK);
    }

    return hBitmap;
}

HPALETTE WINAPI DSCreatePaletteForDIBSection ( HBITMAP hBitmap )

Definition at line 483 of file DIBSectn.c.

{
    BITMAP      bm;
    HPALETTE    hPalette;

    // Get the color depth of the DIBSection
    if (!GetObject(hBitmap, sizeof(BITMAP), &bm))
    return (HPALETTE)NULL;

    // If the DIBSection is 256 color or less, it has a color table
    if((bm.bmBitsPixel * bm.bmPlanes) <= 8)
    {
        HDC             hMemDC;
        HBITMAP         hOldBitmap;
        RGBQUAD         rgb[256];
        LPLOGPALETTE    pLogPal;
        WORD            i;
        int             nColors;

        // Find out how many colors are in the color table
        nColors = 1 << (bm.bmBitsPixel * bm.bmPlanes);

        // Create a memory DC and select the DIBSection into it
        hMemDC = CreateCompatibleDC(NULL);
        hOldBitmap = SelectObject(hMemDC, hBitmap);

        ZeroMemory(rgb, sizeof(rgb));

    // Get the DIBSection's color table
        GetDIBColorTable(hMemDC, 0, nColors, rgb);

        // Create a palette from the color table
        pLogPal = malloc(sizeof(LOGPALETTE) + (nColors*sizeof(PALETTEENTRY)));
        if ( !pLogPal )
        {
            DeleteDC(hMemDC);
            return (HPALETTE)NULL;
        }

        pLogPal->palVersion = 0x300;
        pLogPal->palNumEntries = (WORD)nColors;

        for(i=0;i<nColors;i++)
        {
            pLogPal->palPalEntry[i].peRed = rgb[i].rgbRed;
            pLogPal->palPalEntry[i].peGreen = rgb[i].rgbGreen;
            pLogPal->palPalEntry[i].peBlue = rgb[i].rgbBlue;
            pLogPal->palPalEntry[i].peFlags = 0;
        }

        hPalette = CreatePalette(pLogPal);

        // Clean up
        free(pLogPal);
        SelectObject(hMemDC, hOldBitmap);
        DeleteDC(hMemDC);

  } else  {  // It has no color table, so make one for the current video mode
    HDC hdc = GetDC(NULL);
    int iBitsPixel = GetDeviceCaps(hdc, PLANES) * GetDeviceCaps(hdc, BITSPIXEL);

    if (iBitsPixel <= 8)
      hPalette = CreateHalftonePalette(hdc);
    else
      hPalette = GetStockObject(DEFAULT_PALETTE);

    ReleaseDC(NULL, hdc);
  }

  return hPalette;
}

HPALETTE WINAPI DSCreateSpectrumPalette ( void )

Definition at line 788 of file DIBSectn.c.

{
    HPALETTE hPal;
    LPLOGPALETTE lplgPal;
    BYTE red, green, blue;
    int i;

    lplgPal = (LPLOGPALETTE)GlobalAlloc(GPTR, sizeof(LOGPALETTE) + sizeof(PALETTEENTRY) * 256);

    if (!lplgPal)
      return NULL;

    lplgPal->palVersion = 0x300;
    lplgPal->palNumEntries = 256;

    red = green = blue = 0;

    for (i = 0; i < 256; i++) {
        lplgPal->palPalEntry[i].peRed   = red;
        lplgPal->palPalEntry[i].peGreen = green;
        lplgPal->palPalEntry[i].peBlue  = blue;
        lplgPal->palPalEntry[i].peFlags = (BYTE)0;

        if (!(red += 32))
            if (!(green += 32))
                blue += 64;
    }

    hPal = CreatePalette(lplgPal);
    GlobalFree(lplgPal);

    return hPal;
}

BOOL WINAPI DSDrawDIBSectionOnDC | ( | HDC | hDC,
 |  | HBITMAP | hBitmap,
 |  | LPRECT | pRect
 | ) |  |

Definition at line 312 of file DIBSectn.c.

{
    DIBSECTION  ds;
    HPALETTE    hPal, hOldPal;
    BOOL        bRes;

    GetObject(hBitmap, sizeof(DIBSECTION), &ds);

    if(GetDeviceCaps(hDC, RASTERCAPS) & RC_PALETTE)
    {   // if it's a palette device, select and realize a palette
        // as a background palette (won't cause a problem is the
        // palette was not selected in the foreground in the main app
        hPal = DSCreatePaletteForDIBSection(hBitmap);
        hOldPal = SelectPalette(hDC, hPal, TRUE);
        RealizePalette(hDC);
    }

    if(GetDeviceCaps(hDC, TECHNOLOGY) == DT_RASDISPLAY)
    { // going to the screen, use StretchBlt()
        HDC hMemDC;
        HBITMAP hOldBitmap;

        hMemDC = CreateCompatibleDC(hDC);
        hOldBitmap = SelectObject(hMemDC, hBitmap);
        bRes = StretchBlt(hDC, pRect->left, pRect->top,
                pRect->right-pRect->left, pRect->bottom-pRect->top,
                hMemDC, 0, 0, ds.dsBm.bmWidth, ds.dsBm.bmHeight, SRCCOPY);
        SelectObject(hMemDC, hOldBitmap);
        DeleteDC(hMemDC);
    }
    else
    { // going to the printer, use StretchDIBits()
        LPBITMAPINFO    pbmi;

        // if the printer is palettized,
        pbmi = DSGetBITMAPINFOForDIBSection(hBitmap);
        if ( !pbmi )
            return FALSE;

        bRes = (GDI_ERROR != StretchDIBits(hDC, pRect->left, pRect->top,
                pRect->right-pRect->left, pRect->bottom-pRect->top,
                0, 0, ds.dsBm.bmWidth, ds.dsBm.bmHeight, ds.dsBm.bmBits,
                pbmi, DIB_RGB_COLORS, SRCCOPY));
        free(pbmi);
    }

    if(GetDeviceCaps(hDC, RASTERCAPS) & RC_PALETTE)
    {
        SelectPalette(hDC, hOldPal, TRUE);
        DeleteObject(hPal);
    }

    return bRes;
}

LPBITMAPINFO WINAPI DSGetBITMAPINFOForDIBSection ( HBITMAP hBitmap )

Definition at line 577 of file DIBSectn.c.

{
    LPBITMAPINFO    pbmi;
    DIBSECTION      ds;
    LPRGBQUAD       prgb;

    GetObject(hBitmap, sizeof(DIBSECTION), &ds);

    // load the header and the bitmasks if present
    // per function comments above, we allocate space for a color
    // table even if it is not needed
    if(ds.dsBmih.biCompression == BI_BITFIELDS)
    {   // has a bitmask - be sure to allocate for and copy them
        pbmi = malloc(sizeof(BITMAPINFOHEADER) + (3*sizeof(DWORD)) + (256*sizeof(RGBQUAD)));
        if ( !pbmi )
            return (LPBITMAPINFO)NULL;

        CopyMemory(&(pbmi->bmiHeader), &(ds.dsBmih), sizeof(BITMAPINFOHEADER) + (3*sizeof(DWORD)));
        prgb = (LPRGBQUAD)&(pbmi->bmiColors[3]);
    }
    else
    {   // no bitmask - just the header and color table
        pbmi = malloc(sizeof(BITMAPINFOHEADER) + (256*sizeof(RGBQUAD)));
        if ( !pbmi )
            return (LPBITMAPINFO)NULL;

        CopyMemory(&(pbmi->bmiHeader), &(ds.dsBmih), sizeof(BITMAPINFOHEADER));
        prgb = pbmi->bmiColors;
    }

    // at this point, prgb points to the color table, even
    // if bitmasks are present

    // Now for the color table
    if((ds.dsBm.bmBitsPixel * ds.dsBm.bmPlanes) <= 8)
    {   // the DIBSection is 256 color or less (has color table)
        HDC             hMemDC;
        HBITMAP         hOldBitmap;
        hMemDC = CreateCompatibleDC(NULL);
        hOldBitmap = SelectObject(hMemDC, hBitmap);
        GetDIBColorTable(hMemDC, 0, 1<<(ds.dsBm.bmBitsPixel*ds.dsBm.bmPlanes), prgb);
        SelectObject(hMemDC, hOldBitmap);
        DeleteDC(hMemDC);
    }
    else
    {   // the DIBSection is >8bpp (has no color table) so make one up
        HPALETTE        hPal;
        PALETTEENTRY    pe[256];
        int             i;

        // where are we going to get the colors? from a spectrum palette
        hPal = DSCreateSpectrumPalette();
        GetPaletteEntries(hPal, 0, 256, pe);

        for(i=0;i<256;i++)
        {
            prgb[i].rgbRed = pe[i].peRed;
            prgb[i].rgbGreen = pe[i].peGreen;
            prgb[i].rgbBlue = pe[i].peBlue;
            prgb[i].rgbReserved = 0;
        }

        DeleteObject(hPal);
        pbmi->bmiHeader.biClrUsed = 256;
    }

    return pbmi;
}

HGLOBAL WINAPI DSGetDIBFromDIBSection ( HBITMAP hbmp )

Definition at line 1331 of file DIBSectn.c.

{
  HGLOBAL    hDIB;
  LPBYTE       pDIB;
  LPBITMAPINFO pbmi;
  LPBYTE       pBits;
  DWORD    dwSize;

  // Attempt to get a pointer to the image bits
    pBits = DSGetPointerToDIBSectionImageBits(hbmp);

  // Did we get one?
  if (!pBits)
    return NULL; // No.  It's not a DIB section

  // Get a BITMAPINFO that describes the surface
    if (!(pbmi = DSGetBITMAPINFOForDIBSection(hbmp)))
    return NULL;

  // Get the size of the entire CF_DIB image
  dwSize = sizeof(BITMAPINFOHEADER) + DSColorTableSize(pbmi) + DSImageBitsSize(pbmi);

  // Allocate memory to hold the CF_DIB image
  if (!(hDIB = GlobalAlloc(GPTR, dwSize))) {
    free(pbmi);
    return NULL;
  }

  // Get a pointer to the memory block
  pDIB = (LPBYTE)GlobalLock(hDIB);

  // Copy over the DIB header information and the color table
  CopyMemory(pDIB, pbmi, sizeof(BITMAPINFOHEADER) + DSColorTableSize(pbmi));

  // Advance the pointer to where the surface bits should go
  pDIB += sizeof(BITMAPINFOHEADER) + DSColorTableSize(pbmi);

  CopyMemory(pDIB, pBits, DSImageBitsSize(pbmi));

    // clean up and leave
    free(pbmi);

    GlobalUnlock(hDIB);

  return hDIB;
}

HBITMAP WINAPI DSGetDIBSectionFromClipboard ( void )

Definition at line 1080 of file DIBSectn.c.

{
    HBITMAP         hBitmap = NULL;
    HANDLE      hClipData;
  HDC       hdcRef;

  // Is there any bitmap data (that we can use) on the cliboard?
  if (!IsClipboardFormatAvailable(CF_DIB) && !IsClipboardFormatAvailable(CF_BITMAP))
    return (HBITMAP)NULL;  // Nope, bail

  if (!OpenClipboard(NULL))
    return FALSE;

  // Get a reference DC
  hdcRef = GetDC(NULL);

  if (IsClipboardFormatAvailable(CF_DIB)) {
    PBYTE           pBitsDS, pBitsDIB;
    LPBITMAPINFO    pbmi;

    hClipData = GetClipboardData(CF_DIB);
    if (hClipData) {
      pbmi = (LPBITMAPINFO)GlobalLock(hClipData);

      // Create a DIB section compatible with the clipboard contents
      hBitmap = CreateDIBSection(hdcRef, pbmi, DIB_RGB_COLORS, &pBitsDS, NULL, 0);

      // Get a pinter to the surface bits
      pBitsDIB = (LPBYTE)pbmi + sizeof(BITMAPINFOHEADER) + DIBColorTableSize(pbmi);

      // Copy the surface contents to the surface of our DIB section
      CopyMemory(pBitsDS, pBitsDIB, pbmi->bmiHeader.biSizeImage);

      GlobalUnlock(hClipData);
    }
  }

  // If we couldn't get a DIB (or we didn't want one) try to get a DDB
  if (!hBitmap && IsClipboardFormatAvailable(CF_BITMAP)) {
    HPALETTE    hPal;

    hClipData = GetClipboardData(CF_BITMAP);
    hPal = GetClipboardData(CF_PALETTE);

    hBitmap = DSCopyBitmap((HBITMAP)hClipData, hPal);
  }

  ReleaseDC(NULL, hdcRef);
  CloseClipboard();

    return hBitmap;
}

BOOL WINAPI DSGetOptimalDIBFormat | ( | HDC | hdc,
 |  | BITMAPINFOHEADER * | pbi
 | ) |  |

Definition at line 883 of file DIBSectn.c.

{
   HBITMAP hbm;
   BOOL bRet = TRUE;

   // Create a memory bitmap that is compatible with the
   // format of the target device.
   hbm = CreateCompatibleBitmap(hdc, 1, 1);
   if (!hbm)
       return FALSE;

   // Initialize the header.
   ZeroMemory(pbi, sizeof(BITMAPINFOHEADER));
   pbi->biSize = sizeof(BITMAPINFOHEADER);

   // First call to GetDIBits will fill in the optimal biBitCount.
   bRet = GetDIBits(hdc, hbm, 0, 1, NULL, (BITMAPINFO*)pbi, DIB_RGB_COLORS);

   // Second call to GetDIBits will get the optimal color table, o
   // or the optimal bitfields values.
   if (bRet)
       bRet = GetDIBits(hdc, hbm, 0, 1, NULL, (BITMAPINFO*)pbi, DIB_RGB_COLORS);

   // Clean up.
   DeleteObject(hbm);

   return bRet;
}

LPBYTE WINAPI DSGetPointerToDIBSectionImageBits ( HBITMAP hBitmap )

Definition at line 756 of file DIBSectn.c.

{
    DIBSECTION  ds;

    if (!GetObject(hBitmap, sizeof(DIBSECTION), &ds))
    return NULL;

    return ds.dsBm.bmBits;
}

BOOL WINAPI DSGetRGBBitsPerPixel | ( | HDC | hdc,
 |  | PINT | pRed,
 |  | PINT | pGreen,
 |  | PINT | pBlue
 | ) |  |

Definition at line 952 of file DIBSectn.c.

{
   BITMAPINFOHEADER *pbi;
   LPDWORD lpdw;
   BOOL bRet = TRUE;

   // If the target device is palette-based, then bail because there is no
   // meaningful way to determine separate RGB bits per pixel.
   if (GetDeviceCaps(hdc, RASTERCAPS) & RC_PALETTE)
       return FALSE;

   // Shortcut for handling 24bpp cases.
   if (GetDeviceCaps(hdc, PLANES) * GetDeviceCaps(hdc, BITSPIXEL) == 24) {
       *pRed = *pGreen = *pBlue = 8;
       return TRUE;
   }

   // Allocate room for a header and a color table.
   pbi = (BITMAPINFOHEADER *)GlobalAlloc(GPTR, sizeof(BITMAPINFOHEADER) +
                                               sizeof(RGBQUAD)*256);
   if (!pbi)
       return FALSE;

   // Retrieve a description of the device surface.
   if (DSGetOptimalDIBFormat(hdc, pbi)) {
       // Get a pointer to the bitfields.
       lpdw = (LPDWORD)((LPBYTE)pbi + sizeof(BITMAPINFOHEADER));

       *pRed   = CountBits(lpdw[0]);
       *pGreen = CountBits(lpdw[1]);
       *pBlue  = CountBits(lpdw[2]);
   } else
       bRet = FALSE;

   // Clean up.
   GlobalFree(pbi);

   return bRet;
}

DWORD WINAPI DSImageBitsSize ( LPBITMAPINFO pbmi )

Definition at line 698 of file DIBSectn.c.

{
    switch(pbmi->bmiHeader.biCompression)
    {
        case BI_RLE8:
        case BI_RLE4:
            return pbmi->bmiHeader.biSizeImage;
        break;

    case BI_RGB:
        case BI_BITFIELDS:
            return BYTESPERLINE(pbmi->bmiHeader.biWidth,pbmi->bmiHeader.biBitCount*pbmi->bmiHeader.biPlanes)*pbmi->bmiHeader.biHeight;
        break;
    }

    return 0;
}

BOOL WINAPI DSLoadDIBSectionFromBMPFile | ( | LPTSTR | szFileName,
 |  | HBITMAP * | phBitmap,
 |  | HPALETTE * | phPalette
 | ) |  |

Definition at line 263 of file DIBSectn.c.

{
    if(phBitmap == NULL)
        return FALSE;

  *phBitmap = NULL;

    if(phPalette != NULL)
        *phPalette = NULL;

    // Use LoadImage() to get the image loaded into a DIBSection
    *phBitmap = LoadImage(NULL, szFileName, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION | LR_DEFAULTSIZE | LR_LOADFROMFILE);
    if(*phBitmap == NULL)
        return FALSE;

  // if they want a palette, get one
    if(phPalette != NULL)
        *phPalette = DSCreatePaletteForDIBSection(*phBitmap);

  return TRUE;
}

BOOL WINAPI DSPutDIBSectionOnClipboard ( HBITMAP hbm )

Definition at line 1187 of file DIBSectn.c.

{
    HGLOBAL         hDIB;
  BOOL            bRet;

  if (!OpenClipboard(NULL))
    return FALSE;

  if (!(hDIB = DSGetDIBFromDIBSection(hbm)))
    return FALSE;

  // Clear the clipboard
  EmptyClipboard();

  // Add our bitmap to the clipboard
  bRet = (SetClipboardData(CF_DIB, hDIB) != NULL);

  CloseClipboard();

    return bRet;
}

BOOL WINAPI DSStoreDIBSectionInBMPFile | ( | LPTSTR | szFileName,
 |  | HBITMAP | hBitmap
 | ) |  |

Definition at line 384 of file DIBSectn.c.

{
    HANDLE              hFile;
    BITMAPFILEHEADER    bfh;
    LPBITMAPINFO        pbmi;
    DWORD               dwTotalDIBBytes, dwSize, dwWritten;
    LPBYTE              pBits;

    // Open the file for writing (overwrites any previous version of that file)
    if((hFile=CreateFile(szFileName,GENERIC_WRITE,0,NULL ,CREATE_ALWAYS, SECURITY_SQOS_PRESENT | SECURITY_ANONYMOUS,NULL)) == INVALID_HANDLE_VALUE)
        return FALSE;

    if ( GetFileType(hFile) != FILE_TYPE_DISK )
    {
        CloseHandle(hFile);
        return FALSE;
    }

    // Get the BITMAPINFO for the DIBSection
    if((pbmi = DSGetBITMAPINFOForDIBSection(hBitmap)) == NULL)
    {
        CloseHandle(hFile);
        return FALSE;
    }

    // What's the total size of the DIB information (not counting file header)?
    dwTotalDIBBytes = DSTotalBytesSize(pbmi);

    // Construct the file header
    ZeroMemory(&bfh, sizeof(BITMAPFILEHEADER));
    bfh.bfType          = 0x4d42; // 'BM'
    bfh.bfSize          = dwTotalDIBBytes + sizeof(BITMAPFILEHEADER);
    bfh.bfReserved1     = 0;
    bfh.bfReserved2     = 0;
    bfh.bfOffBits       = (DWORD)(sizeof(BITMAPFILEHEADER) + pbmi->bmiHeader.biSize + DSColorTableSize(pbmi));

    // Write the file header
    if((! WriteFile(hFile, &bfh, sizeof(BITMAPFILEHEADER), &dwWritten, NULL)) ||
        (dwWritten != sizeof(BITMAPFILEHEADER)))
    {
        free(pbmi);
        CloseHandle(hFile);
        return FALSE;
    }

    // Write the BITMAPINFO
    dwSize = sizeof(BITMAPINFOHEADER) + DSColorTableSize(pbmi);

    if((! WriteFile(hFile, pbmi, dwSize, &dwWritten, NULL)) ||
        (dwWritten != dwSize))
    {
        free(pbmi);
        CloseHandle(hFile);
        return FALSE;
    }

    // Write the bits
    pBits = DSGetPointerToDIBSectionImageBits(hBitmap);
    dwSize = DSImageBitsSize(pbmi);

    if((! WriteFile(hFile, pBits, dwSize, &dwWritten, NULL)) ||
        (dwWritten != dwSize))
    {
        free(pbmi);
        CloseHandle(hFile);
        return FALSE;
    }

    // clean up and leave
    free(pbmi);
    CloseHandle(hFile);

    return TRUE;
}

DWORD WINAPI DSTotalBytesSize ( LPBITMAPINFO pbmi )

Definition at line 734 of file DIBSectn.c.

{
    return DSImageBitsSize(pbmi) + sizeof(BITMAPINFOHEADER) + DSColorTableSize(pbmi);
}

Generated on Wed Nov 13 2024 16:53:44 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/ViewDIB/DIBSectn.h File Reference

  • Multimedia
  • Gdi
  • ViewDIB
Functions

DIBSectn.h File Reference

Go to the source code of this file.

Functions

DWORD WINAPI | DSBitsPerPixel (HBITMAP)
DWORD WINAPI | DSColorTableSize (LPBITMAPINFO pbmi)
HBITMAP WINAPI | DSCopyBitmap (HBITMAP, HPALETTE)
HBITMAP WINAPI | DSCopyBitmapEx (HBITMAP, HPALETTE, WORD)
HBITMAP WINAPI | DSCreateDIBSection (DWORD dwX, DWORD dwY, WORD wBits)
HPALETTE WINAPI | DSCreatePaletteForDIBSection (HBITMAP hBitmap)
HPALETTE WINAPI | DSCreateSpectrumPalette (void)
BOOL WINAPI | DSDrawDIBSectionOnDC (HDC hDC, HBITMAP hBitmap, LPRECT pRect)
LPBITMAPINFO WINAPI | DSGetBITMAPINFOForDIBSection (HBITMAP hBitmap)
HGLOBAL WINAPI | DSGetDIBFromDIBSection (HBITMAP)
HBITMAP WINAPI | DSGetDIBSectionFromClipboard (void)
BOOL WINAPI | DSGetOptimalDIBFormat (HDC, BITMAPINFOHEADER *)
LPBYTE WINAPI | DSGetPointerToDIBSectionImageBits (HBITMAP hBitmap)
BOOL WINAPI | DSGetRGBBitsPerPixel (HDC, PINT, PINT, PINT)
DWORD WINAPI | DSImageBitsSize (LPBITMAPINFO pbmi)
BOOL WINAPI | DSLoadDIBSectionFromBMPFile (LPTSTR szFileName, HBITMAP *phBitmap, HPALETTE *phPalette)
BOOL WINAPI | DSPutDIBSectionOnClipboard (HBITMAP)
BOOL WINAPI | DSStoreDIBSectionInBMPFile (LPTSTR szFileName, HBITMAP hBitmap)
DWORD WINAPI | DSTotalBytesSize (LPBITMAPINFO pbmi)

Function Documentation

DWORD WINAPI DSBitsPerPixel ( HBITMAP )

Definition at line 835 of file DIBSectn.c.

{
    DIBSECTION  ds;

    GetObject(hBitmap, sizeof(DIBSECTION), &ds);
    return (ds.dsBmih.biBitCount * ds.dsBmih.biPlanes);
}

DWORD WINAPI DSColorTableSize ( LPBITMAPINFO pbmi )

Definition at line 663 of file DIBSectn.c.

{
    DWORD dwColors;

    dwColors = 0;
    if(pbmi->bmiHeader.biClrUsed != 0)
        dwColors = pbmi->bmiHeader.biClrUsed;
    else if(pbmi->bmiHeader.biBitCount > 8)
        dwColors = 0;
    else
        dwColors = 1 << (pbmi->bmiHeader.biBitCount * pbmi->bmiHeader.biPlanes);

    if(pbmi->bmiHeader.biCompression == BI_BITFIELDS)
        return (sizeof(DWORD)*3) + (dwColors*sizeof(RGBQUAD));

    return (dwColors*sizeof(RGBQUAD));
}

HBITMAP WINAPI DSCopyBitmap | ( | HBITMAP | ,
 |  | HPALETTE |
 | ) |  |

Definition at line 1310 of file DIBSectn.c.

{
    BITMAP      bm;

  if (!GetObject(hbmp, sizeof(BITMAP), &bm))
    return (HBITMAP)NULL;

  // Create a DIB section to hold our copy of the data
  return DSCopyBitmapEx(hbmp, hPal, (WORD)(bm.bmPlanes*bm.bmBitsPixel));
}

HBITMAP WINAPI DSCopyBitmapEx | ( | HBITMAP | ,
 |  | HPALETTE | ,
 |  | WORD |
 | ) |  |

Definition at line 1224 of file DIBSectn.c.

{
    HBITMAP         hBitmap = NULL;
  BOOL      bNeedToCleanUp = FALSE;
    BITMAP      bm;
  HDC       hdcSrc, hdcDst;
  RGBQUAD     rgbq[256];
  int       iNumColors, i;

  if (!GetObject(hbmp, sizeof(BITMAP), &bm))
    return (HBITMAP)NULL;

  // Create a DIB section to hold our copy of the data
  hBitmap = DSCreateDIBSection(bm.bmWidth, bm.bmHeight, wBits);

  hdcSrc = CreateCompatibleDC(NULL);
  hdcDst = CreateCompatibleDC(NULL);

  if (hPal) {
    // Get the colors from the palette and copy them to our color table
    iNumColors = GetPaletteEntries(hPal, 0, 256, (LPPALETTEENTRY)rgbq);

    // RGB in PALETTEENTRYs and RGBQUADs are in different order so adjust
    for (i=0; i<iNumColors; i++) {
      SWAP(rgbq[i].rgbBlue, rgbq[i].rgbRed);
      rgbq[i].rgbReserved = 0;
    }
  } else
    if (wBits <= 8) { // We need some sort of color table for the target image
      // We're creating the palette rather than using one that was
      // passed in so we need to remember to clean it up before returning
      bNeedToCleanUp = TRUE;

      // Get the palette from the source images
      hPal = DSCreatePaletteForDIBSection(hbmp);

      // Convert it to RGBQUAD format
      iNumColors = GetPaletteEntries(hPal, 0, 256, (LPPALETTEENTRY)rgbq);

      // RGB in PALETTEENTRYs and RGBQUADs are in different order so adjust
      for (i=0; i<iNumColors; i++) {
        SWAP(rgbq[i].rgbBlue, rgbq[i].rgbRed);
        rgbq[i].rgbReserved = 0;
      }
    } else {
      hPal = GetStockObject(DEFAULT_PALETTE);
      iNumColors = 0;
    }

  // Prepare the source bitmap
  SelectObject(hdcSrc, hbmp);
  SelectPalette(hdcSrc, hPal, FALSE);
  RealizePalette(hdcSrc);

  // Prepare the destination bitmap
  SelectObject(hdcDst, hBitmap);
  SelectPalette(hdcDst, hPal, FALSE);
  RealizePalette(hdcDst);
  if (iNumColors)
    SetDIBColorTable(hdcDst, 0, iNumColors, rgbq);

  BitBlt(hdcDst, 0,0, bm.bmWidth, bm.bmHeight, hdcSrc, 0,0, SRCCOPY);

  DeleteDC(hdcSrc);
  DeleteDC(hdcDst);

  if (bNeedToCleanUp)
    DeleteObject(hPal);

    return hBitmap;
}

HBITMAP WINAPI DSCreateDIBSection | ( | DWORD | dwX,
 |  | DWORD | dwY,
 |  | WORD | wBits
 | ) |  |

Definition at line 87 of file DIBSectn.c.

{
    HBITMAP         hBitmap;
    LPBYTE          pBits;
    int             nInfoSize;
    LPBITMAPINFO    pbmi;
    HDC             hRefDC;

    nInfoSize = sizeof(BITMAPINFOHEADER);

    if(wBits <= 8)
        nInfoSize += sizeof(RGBQUAD) * (1 << wBits);

    if((wBits == 16) || (wBits == 15) || (wBits == 32))
        nInfoSize += 3 * sizeof(DWORD);

    // Create the header big enough to contain color table and bitmasks if needed
    pbmi = (LPBITMAPINFO)malloc(nInfoSize);
    if ( !pbmi )
        return (HBITMAP)NULL;

    ZeroMemory(pbmi, nInfoSize);
    pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
    pbmi->bmiHeader.biWidth = dwX;
    pbmi->bmiHeader.biHeight = dwY;
    pbmi->bmiHeader.biPlanes = 1;
    pbmi->bmiHeader.biBitCount = wBits;
    pbmi->bmiHeader.biCompression = BI_RGB; // override below for 16 and 32bpp

    switch(wBits)
    {
        case 24:
            // 24bpp requires no special handling
        break;

        case 15:
    {   // if it's 15bpp, fill in the masks and override the compression
            // these are the default masks - you could change them if needed
            LPDWORD pMasks = (LPDWORD)(pbmi->bmiColors);
            pMasks[0] = 0x00007c00;
            pMasks[1] = 0x000003e0;
            pMasks[2] = 0x0000001f;
            pbmi->bmiHeader.biCompression = BI_BITFIELDS;
      pbmi->bmiHeader.biBitCount = 16;  // 15 bpp is really 16 bpp
        }
        break;

    case 16:
        {   // if it's 16bpp, fill in the masks and override the compression
            // these are the default masks - you could change them if needed
            LPDWORD pMasks = (LPDWORD)(pbmi->bmiColors);
            pMasks[0] = 0x0000f800;
            pMasks[1] = 0x000007e0;
            pMasks[2] = 0x0000001f;
            pbmi->bmiHeader.biCompression = BI_BITFIELDS;
        }
        break;

        case 32:
        {   // if it's 32bpp, fill in the masks and override the compression
            // these are the default masks - you could change them if needed
            LPDWORD pMasks = (LPDWORD)(pbmi->bmiColors);
            pMasks[0] = 0x00ff0000;
            pMasks[1] = 0x0000ff00;
            pMasks[2] = 0x000000ff;
            pbmi->bmiHeader.biCompression = BI_BITFIELDS;
        }
        break;

        case 8:
        {
            HPALETTE        hPal;
            PALETTEENTRY    pe[256];
            int             i;

            // at this point, prgb points to the color table, even
            // if bitmasks are present
            hPal = DSCreateSpectrumPalette();
            GetPaletteEntries(hPal, 0, 256, pe);

            for(i=0;i<256;i++)
            {
                pbmi->bmiColors[i].rgbRed = pe[i].peRed;
                pbmi->bmiColors[i].rgbGreen = pe[i].peGreen;
                pbmi->bmiColors[i].rgbBlue = pe[i].peBlue;
                pbmi->bmiColors[i].rgbReserved = 0;
            }

            DeleteObject(hPal);
            pbmi->bmiHeader.biClrUsed = 256;
        }
        break;

        case 4:
        {   // Use a default 16 color table for 4bpp DIBSections
            RGBTRIPLE       rgb[16] = { { 0x00, 0x00, 0x00 }, // black
                                        { 0x80, 0x00, 0x00 }, // dark red
                                        { 0x00, 0x80, 0x00 }, // dark green
                                        { 0x80, 0x80, 0x00 }, // dark yellow
                                        { 0x00, 0x00, 0x80 }, // dark blue
                                        { 0x80, 0x00, 0x80 }, // dark magenta
                                        { 0x00, 0x80, 0x80 }, // dark cyan
                                        { 0xC0, 0xC0, 0xC0 }, // light gray
                                    //  { 0xC0, 0xDC, 0xC0 }, // money green
                                    //  { 0xA6, 0xCA, 0xF0 }, // sky blue
                                    //  { 0xFF, 0xFB, 0xF0 }, // cream
                                    //  { 0xA0, 0xA0, 0xA4 }, // light gray
                                        { 0x80, 0x80, 0x80 }, // medium gray
                                        { 0xFF, 0x00, 0x00 }, // red
                                        { 0x00, 0xFF, 0x00 }, // green
                                        { 0xFF, 0xFF, 0x00 }, // yellow
                                        { 0x00, 0x00, 0xFF }, // blue
                                        { 0xFF, 0x00, 0xFF }, // magenta
                                        { 0x00, 0xFF, 0xFF }, // cyan
                                        { 0xFF, 0xFF, 0xFF } }; // white
            int             i;

            for(i=0;i<16;i++)
            {
                pbmi->bmiColors[i].rgbRed = rgb[i].rgbtRed;
                pbmi->bmiColors[i].rgbGreen = rgb[i].rgbtGreen;
                pbmi->bmiColors[i].rgbBlue = rgb[i].rgbtBlue;
                pbmi->bmiColors[i].rgbReserved = 0;
            }
            pbmi->bmiHeader.biClrUsed = 16;
        }
        break;

        case 1: // BW
            pbmi->bmiColors[0].rgbRed = pbmi->bmiColors[0].rgbGreen = pbmi->bmiColors[0].rgbBlue = 0;
            pbmi->bmiColors[1].rgbRed = pbmi->bmiColors[1].rgbGreen = pbmi->bmiColors[1].rgbBlue = 255;
            pbmi->bmiColors[0].rgbReserved = pbmi->bmiColors[1].rgbReserved = 0;
        break;
    }

    hRefDC = GetDC(NULL);
    hBitmap = CreateDIBSection(hRefDC, pbmi, DIB_RGB_COLORS, &pBits, NULL, 0);
    nInfoSize = GetLastError();
    ReleaseDC(NULL, hRefDC);
    free(pbmi);

    if(hBitmap == NULL)
    {
        TCHAR   szTemp[64];
        _snprintf(szTemp, sizeof(szTemp)-1, "Error %d", nInfoSize);
        szTemp[sizeof(szTemp)-1] = '\0';
        MessageBox(NULL, szTemp, "Error", MB_OK);
    }

    return hBitmap;
}

HPALETTE WINAPI DSCreatePaletteForDIBSection ( HBITMAP hBitmap )

Definition at line 483 of file DIBSectn.c.

{
    BITMAP      bm;
    HPALETTE    hPalette;

    // Get the color depth of the DIBSection
    if (!GetObject(hBitmap, sizeof(BITMAP), &bm))
    return (HPALETTE)NULL;

    // If the DIBSection is 256 color or less, it has a color table
    if((bm.bmBitsPixel * bm.bmPlanes) <= 8)
    {
        HDC             hMemDC;
        HBITMAP         hOldBitmap;
        RGBQUAD         rgb[256];
        LPLOGPALETTE    pLogPal;
        WORD            i;
        int             nColors;

        // Find out how many colors are in the color table
        nColors = 1 << (bm.bmBitsPixel * bm.bmPlanes);

        // Create a memory DC and select the DIBSection into it
        hMemDC = CreateCompatibleDC(NULL);
        hOldBitmap = SelectObject(hMemDC, hBitmap);

        ZeroMemory(rgb, sizeof(rgb));

    // Get the DIBSection's color table
        GetDIBColorTable(hMemDC, 0, nColors, rgb);

        // Create a palette from the color table
        pLogPal = malloc(sizeof(LOGPALETTE) + (nColors*sizeof(PALETTEENTRY)));
        if ( !pLogPal )
        {
            DeleteDC(hMemDC);
            return (HPALETTE)NULL;
        }

        pLogPal->palVersion = 0x300;
        pLogPal->palNumEntries = (WORD)nColors;

        for(i=0;i<nColors;i++)
        {
            pLogPal->palPalEntry[i].peRed = rgb[i].rgbRed;
            pLogPal->palPalEntry[i].peGreen = rgb[i].rgbGreen;
            pLogPal->palPalEntry[i].peBlue = rgb[i].rgbBlue;
            pLogPal->palPalEntry[i].peFlags = 0;
        }

        hPalette = CreatePalette(pLogPal);

        // Clean up
        free(pLogPal);
        SelectObject(hMemDC, hOldBitmap);
        DeleteDC(hMemDC);

  } else  {  // It has no color table, so make one for the current video mode
    HDC hdc = GetDC(NULL);
    int iBitsPixel = GetDeviceCaps(hdc, PLANES) * GetDeviceCaps(hdc, BITSPIXEL);

    if (iBitsPixel <= 8)
      hPalette = CreateHalftonePalette(hdc);
    else
      hPalette = GetStockObject(DEFAULT_PALETTE);

    ReleaseDC(NULL, hdc);
  }

  return hPalette;
}

HPALETTE WINAPI DSCreateSpectrumPalette ( void )

Definition at line 788 of file DIBSectn.c.

{
    HPALETTE hPal;
    LPLOGPALETTE lplgPal;
    BYTE red, green, blue;
    int i;

    lplgPal = (LPLOGPALETTE)GlobalAlloc(GPTR, sizeof(LOGPALETTE) + sizeof(PALETTEENTRY) * 256);

    if (!lplgPal)
      return NULL;

    lplgPal->palVersion = 0x300;
    lplgPal->palNumEntries = 256;

    red = green = blue = 0;

    for (i = 0; i < 256; i++) {
        lplgPal->palPalEntry[i].peRed   = red;
        lplgPal->palPalEntry[i].peGreen = green;
        lplgPal->palPalEntry[i].peBlue  = blue;
        lplgPal->palPalEntry[i].peFlags = (BYTE)0;

        if (!(red += 32))
            if (!(green += 32))
                blue += 64;
    }

    hPal = CreatePalette(lplgPal);
    GlobalFree(lplgPal);

    return hPal;
}

BOOL WINAPI DSDrawDIBSectionOnDC | ( | HDC | hDC,
 |  | HBITMAP | hBitmap,
 |  | LPRECT | pRect
 | ) |  |

Definition at line 312 of file DIBSectn.c.

{
    DIBSECTION  ds;
    HPALETTE    hPal, hOldPal;
    BOOL        bRes;

    GetObject(hBitmap, sizeof(DIBSECTION), &ds);

    if(GetDeviceCaps(hDC, RASTERCAPS) & RC_PALETTE)
    {   // if it's a palette device, select and realize a palette
        // as a background palette (won't cause a problem is the
        // palette was not selected in the foreground in the main app
        hPal = DSCreatePaletteForDIBSection(hBitmap);
        hOldPal = SelectPalette(hDC, hPal, TRUE);
        RealizePalette(hDC);
    }

    if(GetDeviceCaps(hDC, TECHNOLOGY) == DT_RASDISPLAY)
    { // going to the screen, use StretchBlt()
        HDC hMemDC;
        HBITMAP hOldBitmap;

        hMemDC = CreateCompatibleDC(hDC);
        hOldBitmap = SelectObject(hMemDC, hBitmap);
        bRes = StretchBlt(hDC, pRect->left, pRect->top,
                pRect->right-pRect->left, pRect->bottom-pRect->top,
                hMemDC, 0, 0, ds.dsBm.bmWidth, ds.dsBm.bmHeight, SRCCOPY);
        SelectObject(hMemDC, hOldBitmap);
        DeleteDC(hMemDC);
    }
    else
    { // going to the printer, use StretchDIBits()
        LPBITMAPINFO    pbmi;

        // if the printer is palettized,
        pbmi = DSGetBITMAPINFOForDIBSection(hBitmap);
        if ( !pbmi )
            return FALSE;

        bRes = (GDI_ERROR != StretchDIBits(hDC, pRect->left, pRect->top,
                pRect->right-pRect->left, pRect->bottom-pRect->top,
                0, 0, ds.dsBm.bmWidth, ds.dsBm.bmHeight, ds.dsBm.bmBits,
                pbmi, DIB_RGB_COLORS, SRCCOPY));
        free(pbmi);
    }

    if(GetDeviceCaps(hDC, RASTERCAPS) & RC_PALETTE)
    {
        SelectPalette(hDC, hOldPal, TRUE);
        DeleteObject(hPal);
    }

    return bRes;
}

LPBITMAPINFO WINAPI DSGetBITMAPINFOForDIBSection ( HBITMAP hBitmap )

Definition at line 577 of file DIBSectn.c.

{
    LPBITMAPINFO    pbmi;
    DIBSECTION      ds;
    LPRGBQUAD       prgb;

    GetObject(hBitmap, sizeof(DIBSECTION), &ds);

    // load the header and the bitmasks if present
    // per function comments above, we allocate space for a color
    // table even if it is not needed
    if(ds.dsBmih.biCompression == BI_BITFIELDS)
    {   // has a bitmask - be sure to allocate for and copy them
        pbmi = malloc(sizeof(BITMAPINFOHEADER) + (3*sizeof(DWORD)) + (256*sizeof(RGBQUAD)));
        if ( !pbmi )
            return (LPBITMAPINFO)NULL;

        CopyMemory(&(pbmi->bmiHeader), &(ds.dsBmih), sizeof(BITMAPINFOHEADER) + (3*sizeof(DWORD)));
        prgb = (LPRGBQUAD)&(pbmi->bmiColors[3]);
    }
    else
    {   // no bitmask - just the header and color table
        pbmi = malloc(sizeof(BITMAPINFOHEADER) + (256*sizeof(RGBQUAD)));
        if ( !pbmi )
            return (LPBITMAPINFO)NULL;

        CopyMemory(&(pbmi->bmiHeader), &(ds.dsBmih), sizeof(BITMAPINFOHEADER));
        prgb = pbmi->bmiColors;
    }

    // at this point, prgb points to the color table, even
    // if bitmasks are present

    // Now for the color table
    if((ds.dsBm.bmBitsPixel * ds.dsBm.bmPlanes) <= 8)
    {   // the DIBSection is 256 color or less (has color table)
        HDC             hMemDC;
        HBITMAP         hOldBitmap;
        hMemDC = CreateCompatibleDC(NULL);
        hOldBitmap = SelectObject(hMemDC, hBitmap);
        GetDIBColorTable(hMemDC, 0, 1<<(ds.dsBm.bmBitsPixel*ds.dsBm.bmPlanes), prgb);
        SelectObject(hMemDC, hOldBitmap);
        DeleteDC(hMemDC);
    }
    else
    {   // the DIBSection is >8bpp (has no color table) so make one up
        HPALETTE        hPal;
        PALETTEENTRY    pe[256];
        int             i;

        // where are we going to get the colors? from a spectrum palette
        hPal = DSCreateSpectrumPalette();
        GetPaletteEntries(hPal, 0, 256, pe);

        for(i=0;i<256;i++)
        {
            prgb[i].rgbRed = pe[i].peRed;
            prgb[i].rgbGreen = pe[i].peGreen;
            prgb[i].rgbBlue = pe[i].peBlue;
            prgb[i].rgbReserved = 0;
        }

        DeleteObject(hPal);
        pbmi->bmiHeader.biClrUsed = 256;
    }

    return pbmi;
}

HGLOBAL WINAPI DSGetDIBFromDIBSection ( HBITMAP )

Definition at line 1331 of file DIBSectn.c.

{
  HGLOBAL    hDIB;
  LPBYTE       pDIB;
  LPBITMAPINFO pbmi;
  LPBYTE       pBits;
  DWORD    dwSize;

  // Attempt to get a pointer to the image bits
    pBits = DSGetPointerToDIBSectionImageBits(hbmp);

  // Did we get one?
  if (!pBits)
    return NULL; // No.  It's not a DIB section

  // Get a BITMAPINFO that describes the surface
    if (!(pbmi = DSGetBITMAPINFOForDIBSection(hbmp)))
    return NULL;

  // Get the size of the entire CF_DIB image
  dwSize = sizeof(BITMAPINFOHEADER) + DSColorTableSize(pbmi) + DSImageBitsSize(pbmi);

  // Allocate memory to hold the CF_DIB image
  if (!(hDIB = GlobalAlloc(GPTR, dwSize))) {
    free(pbmi);
    return NULL;
  }

  // Get a pointer to the memory block
  pDIB = (LPBYTE)GlobalLock(hDIB);

  // Copy over the DIB header information and the color table
  CopyMemory(pDIB, pbmi, sizeof(BITMAPINFOHEADER) + DSColorTableSize(pbmi));

  // Advance the pointer to where the surface bits should go
  pDIB += sizeof(BITMAPINFOHEADER) + DSColorTableSize(pbmi);

  CopyMemory(pDIB, pBits, DSImageBitsSize(pbmi));

    // clean up and leave
    free(pbmi);

    GlobalUnlock(hDIB);

  return hDIB;
}

HBITMAP WINAPI DSGetDIBSectionFromClipboard ( void )

Definition at line 1080 of file DIBSectn.c.

{
    HBITMAP         hBitmap = NULL;
    HANDLE      hClipData;
  HDC       hdcRef;

  // Is there any bitmap data (that we can use) on the cliboard?
  if (!IsClipboardFormatAvailable(CF_DIB) && !IsClipboardFormatAvailable(CF_BITMAP))
    return (HBITMAP)NULL;  // Nope, bail

  if (!OpenClipboard(NULL))
    return FALSE;

  // Get a reference DC
  hdcRef = GetDC(NULL);

  if (IsClipboardFormatAvailable(CF_DIB)) {
    PBYTE           pBitsDS, pBitsDIB;
    LPBITMAPINFO    pbmi;

    hClipData = GetClipboardData(CF_DIB);
    if (hClipData) {
      pbmi = (LPBITMAPINFO)GlobalLock(hClipData);

      // Create a DIB section compatible with the clipboard contents
      hBitmap = CreateDIBSection(hdcRef, pbmi, DIB_RGB_COLORS, &pBitsDS, NULL, 0);

      // Get a pinter to the surface bits
      pBitsDIB = (LPBYTE)pbmi + sizeof(BITMAPINFOHEADER) + DIBColorTableSize(pbmi);

      // Copy the surface contents to the surface of our DIB section
      CopyMemory(pBitsDS, pBitsDIB, pbmi->bmiHeader.biSizeImage);

      GlobalUnlock(hClipData);
    }
  }

  // If we couldn't get a DIB (or we didn't want one) try to get a DDB
  if (!hBitmap && IsClipboardFormatAvailable(CF_BITMAP)) {
    HPALETTE    hPal;

    hClipData = GetClipboardData(CF_BITMAP);
    hPal = GetClipboardData(CF_PALETTE);

    hBitmap = DSCopyBitmap((HBITMAP)hClipData, hPal);
  }

  ReleaseDC(NULL, hdcRef);
  CloseClipboard();

    return hBitmap;
}

BOOL WINAPI DSGetOptimalDIBFormat | ( | HDC | ,
 |  | BITMAPINFOHEADER * |
 | ) |  |

Definition at line 883 of file DIBSectn.c.

{
   HBITMAP hbm;
   BOOL bRet = TRUE;

   // Create a memory bitmap that is compatible with the
   // format of the target device.
   hbm = CreateCompatibleBitmap(hdc, 1, 1);
   if (!hbm)
       return FALSE;

   // Initialize the header.
   ZeroMemory(pbi, sizeof(BITMAPINFOHEADER));
   pbi->biSize = sizeof(BITMAPINFOHEADER);

   // First call to GetDIBits will fill in the optimal biBitCount.
   bRet = GetDIBits(hdc, hbm, 0, 1, NULL, (BITMAPINFO*)pbi, DIB_RGB_COLORS);

   // Second call to GetDIBits will get the optimal color table, o
   // or the optimal bitfields values.
   if (bRet)
       bRet = GetDIBits(hdc, hbm, 0, 1, NULL, (BITMAPINFO*)pbi, DIB_RGB_COLORS);

   // Clean up.
   DeleteObject(hbm);

   return bRet;
}

LPBYTE WINAPI DSGetPointerToDIBSectionImageBits ( HBITMAP hBitmap )

Definition at line 756 of file DIBSectn.c.

{
    DIBSECTION  ds;

    if (!GetObject(hBitmap, sizeof(DIBSECTION), &ds))
    return NULL;

    return ds.dsBm.bmBits;
}

BOOL WINAPI DSGetRGBBitsPerPixel | ( | HDC | ,
 |  | PINT | ,
 |  | PINT | ,
 |  | PINT |
 | ) |  |

Definition at line 952 of file DIBSectn.c.

{
   BITMAPINFOHEADER *pbi;
   LPDWORD lpdw;
   BOOL bRet = TRUE;

   // If the target device is palette-based, then bail because there is no
   // meaningful way to determine separate RGB bits per pixel.
   if (GetDeviceCaps(hdc, RASTERCAPS) & RC_PALETTE)
       return FALSE;

   // Shortcut for handling 24bpp cases.
   if (GetDeviceCaps(hdc, PLANES) * GetDeviceCaps(hdc, BITSPIXEL) == 24) {
       *pRed = *pGreen = *pBlue = 8;
       return TRUE;
   }

   // Allocate room for a header and a color table.
   pbi = (BITMAPINFOHEADER *)GlobalAlloc(GPTR, sizeof(BITMAPINFOHEADER) +
                                               sizeof(RGBQUAD)*256);
   if (!pbi)
       return FALSE;

   // Retrieve a description of the device surface.
   if (DSGetOptimalDIBFormat(hdc, pbi)) {
       // Get a pointer to the bitfields.
       lpdw = (LPDWORD)((LPBYTE)pbi + sizeof(BITMAPINFOHEADER));

       *pRed   = CountBits(lpdw[0]);
       *pGreen = CountBits(lpdw[1]);
       *pBlue  = CountBits(lpdw[2]);
   } else
       bRet = FALSE;

   // Clean up.
   GlobalFree(pbi);

   return bRet;
}

DWORD WINAPI DSImageBitsSize ( LPBITMAPINFO pbmi )

Definition at line 698 of file DIBSectn.c.

{
    switch(pbmi->bmiHeader.biCompression)
    {
        case BI_RLE8:
        case BI_RLE4:
            return pbmi->bmiHeader.biSizeImage;
        break;

    case BI_RGB:
        case BI_BITFIELDS:
            return BYTESPERLINE(pbmi->bmiHeader.biWidth,pbmi->bmiHeader.biBitCount*pbmi->bmiHeader.biPlanes)*pbmi->bmiHeader.biHeight;
        break;
    }

    return 0;
}

BOOL WINAPI DSLoadDIBSectionFromBMPFile | ( | LPTSTR | szFileName,
 |  | HBITMAP * | phBitmap,
 |  | HPALETTE * | phPalette
 | ) |  |

Definition at line 263 of file DIBSectn.c.

{
    if(phBitmap == NULL)
        return FALSE;

  *phBitmap = NULL;

    if(phPalette != NULL)
        *phPalette = NULL;

    // Use LoadImage() to get the image loaded into a DIBSection
    *phBitmap = LoadImage(NULL, szFileName, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION | LR_DEFAULTSIZE | LR_LOADFROMFILE);
    if(*phBitmap == NULL)
        return FALSE;

  // if they want a palette, get one
    if(phPalette != NULL)
        *phPalette = DSCreatePaletteForDIBSection(*phBitmap);

  return TRUE;
}

BOOL WINAPI DSPutDIBSectionOnClipboard ( HBITMAP )

Definition at line 1187 of file DIBSectn.c.

{
    HGLOBAL         hDIB;
  BOOL            bRet;

  if (!OpenClipboard(NULL))
    return FALSE;

  if (!(hDIB = DSGetDIBFromDIBSection(hbm)))
    return FALSE;

  // Clear the clipboard
  EmptyClipboard();

  // Add our bitmap to the clipboard
  bRet = (SetClipboardData(CF_DIB, hDIB) != NULL);

  CloseClipboard();

    return bRet;
}

BOOL WINAPI DSStoreDIBSectionInBMPFile | ( | LPTSTR | szFileName,
 |  | HBITMAP | hBitmap
 | ) |  |

Definition at line 384 of file DIBSectn.c.

{
    HANDLE              hFile;
    BITMAPFILEHEADER    bfh;
    LPBITMAPINFO        pbmi;
    DWORD               dwTotalDIBBytes, dwSize, dwWritten;
    LPBYTE              pBits;

    // Open the file for writing (overwrites any previous version of that file)
    if((hFile=CreateFile(szFileName,GENERIC_WRITE,0,NULL ,CREATE_ALWAYS, SECURITY_SQOS_PRESENT | SECURITY_ANONYMOUS,NULL)) == INVALID_HANDLE_VALUE)
        return FALSE;

    if ( GetFileType(hFile) != FILE_TYPE_DISK )
    {
        CloseHandle(hFile);
        return FALSE;
    }

    // Get the BITMAPINFO for the DIBSection
    if((pbmi = DSGetBITMAPINFOForDIBSection(hBitmap)) == NULL)
    {
        CloseHandle(hFile);
        return FALSE;
    }

    // What's the total size of the DIB information (not counting file header)?
    dwTotalDIBBytes = DSTotalBytesSize(pbmi);

    // Construct the file header
    ZeroMemory(&bfh, sizeof(BITMAPFILEHEADER));
    bfh.bfType          = 0x4d42; // 'BM'
    bfh.bfSize          = dwTotalDIBBytes + sizeof(BITMAPFILEHEADER);
    bfh.bfReserved1     = 0;
    bfh.bfReserved2     = 0;
    bfh.bfOffBits       = (DWORD)(sizeof(BITMAPFILEHEADER) + pbmi->bmiHeader.biSize + DSColorTableSize(pbmi));

    // Write the file header
    if((! WriteFile(hFile, &bfh, sizeof(BITMAPFILEHEADER), &dwWritten, NULL)) ||
        (dwWritten != sizeof(BITMAPFILEHEADER)))
    {
        free(pbmi);
        CloseHandle(hFile);
        return FALSE;
    }

    // Write the BITMAPINFO
    dwSize = sizeof(BITMAPINFOHEADER) + DSColorTableSize(pbmi);

    if((! WriteFile(hFile, pbmi, dwSize, &dwWritten, NULL)) ||
        (dwWritten != dwSize))
    {
        free(pbmi);
        CloseHandle(hFile);
        return FALSE;
    }

    // Write the bits
    pBits = DSGetPointerToDIBSectionImageBits(hBitmap);
    dwSize = DSImageBitsSize(pbmi);

    if((! WriteFile(hFile, pBits, dwSize, &dwWritten, NULL)) ||
        (dwWritten != dwSize))
    {
        free(pbmi);
        CloseHandle(hFile);
        return FALSE;
    }

    // clean up and leave
    free(pbmi);
    CloseHandle(hFile);

    return TRUE;
}

DWORD WINAPI DSTotalBytesSize ( LPBITMAPINFO pbmi )

Definition at line 734 of file DIBSectn.c.

{
    return DSImageBitsSize(pbmi) + sizeof(BITMAPINFOHEADER) + DSColorTableSize(pbmi);
}

Generated on Wed Nov 13 2024 16:53:44 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/ViewDIB/OpenDIB.c File Reference

  • Multimedia
  • Gdi
  • ViewDIB
Defines | Functions

OpenDIB.c File Reference

#include <windows.h>
#include <stdio.h>
#include <commdlg.h>

Go to the source code of this file.

Defines

#define | IDC_FILEINFO 1062
#define | IDC_IMAGE 1061
#define | IDC_LOCATION 1119

Functions

LPWORD | AddItemToTemplate (LPWORD lpw, int lpwSize, DWORD dwStyle, DWORD dwExtStyle, WORD x, WORD y, WORD cx, WORD cy, WORD wID, WORD wClassID, LPSTR lpszTitle)
LPDLGTEMPLATE | CreateDialogTemplate ()
BOOL | DisplayBitmapInWindow (HWND hWnd, HBITMAP hbm)
BOOL | DisplayFileToDialog (LPSTR szFile, HWND hWnd, HBITMAP *hbm)
BOOL | GetDIBFilename (LPSTR lpstrFilename, LPSTR lpstrDefault, BOOL bSave)
BOOL NEAR PASCAL | HandleNotify (HWND hDlg, LPOFNOTIFY pofn, LPSTR szFile, HBITMAP *hbm)
LPWORD | lpwAlign (LPWORD lpIn)
int | nCopyAnsiToWideChar (LPWORD lpWCStr, LPSTR lpAnsiIn, int size)
LRESULT CALLBACK | PreviewWindowHookProc (HWND, UINT, WPARAM, LPARAM)

Define Documentation

#define IDC_FILEINFO 1062

Definition at line 14 of file OpenDIB.c.

#define IDC_IMAGE 1061

Definition at line 13 of file OpenDIB.c.

#define IDC_LOCATION 1119

Definition at line 15 of file OpenDIB.c.

Function Documentation

LPWORD AddItemToTemplate | ( | LPWORD | lpw,
 |  | int | lpwSize,
 |  | DWORD | dwStyle,
 |  | DWORD | dwExtStyle,
 |  | WORD | x,
 |  | WORD | y,
 |  | WORD | cx,
 |  | WORD | cy,
 |  | WORD | wID,
 |  | WORD | wClassID,
 |  | LPSTR | lpszTitle
 | ) |  |

Definition at line 39 of file OpenDIB.c.

{
  int nchar;

  // Start on a DWORD boundary
  lpw = lpwAlign(lpw);

  *lpw++ = LOWORD(dwStyle);
  *lpw++ = HIWORD(dwStyle);
  *lpw++ = LOWORD(dwExtStyle);
  *lpw++ = HIWORD(dwExtStyle);
  *lpw++ = x;        // x
  *lpw++ = y;        // y
  *lpw++ = cx;       // cx
  *lpw++ = cy;       // cy
  *lpw++ = wID;      // ID

  /* fill in class i.d. (static in this case) */
  *lpw++ = (WORD)0xffff;   // standard class prefix
  *lpw++ = (WORD)wClassID;

  /* copy the text of the first item */
  nchar = nCopyAnsiToWideChar (lpw, TEXT(lpszTitle), lpwSize - sizeof(WORD)*11);
  lpw += nchar;
  *lpw++ = 0;  // advance pointer over nExtraStuff WORD

  return lpw;
}

LPDLGTEMPLATE CreateDialogTemplate ( )

Definition at line 75 of file OpenDIB.c.

{
  LPWORD  p, pdlgtemplate;
  int   nchar;
  DWORD lStyle;

  /* allocate some memory to play with  */
  int wSize = 1000;
  int cSize = 0;
  pdlgtemplate = p = (PWORD) GlobalAlloc (GPTR, wSize);
  if ( !p )
      return (LPDLGTEMPLATE)NULL;

  /* start to fill in the dlgtemplate information.  addressing by WORDs */
  lStyle = DS_3DLOOK | DS_CONTROL | WS_CHILD | WS_CLIPSIBLINGS;
  *p++ = LOWORD (lStyle);
  *p++ = HIWORD (lStyle);
  *p++ = 0;          // LOWORD (lExtendedStyle)
  *p++ = 0;          // HIWORD (lExtendedStyle)
  *p++ = 3;          // Number of items being added
  *p++ = 0;          // x
  *p++ = 0;          // y
  *p++ = 86;         // cx
  *p++ = 122;        // cy
  *p++ = 0;          // Menu
  *p++ = 0;          // Class

  /* copy the title of the dialog */
  nchar = nCopyAnsiToWideChar (p, TEXT(""), wSize - (int)(p - pdlgtemplate)*sizeof(WORD));
  p += nchar;

  cSize = wSize - (int)(p - pdlgtemplate)*sizeof(WORD);
  // Add the template positioning control
  p = AddItemToTemplate(p, cSize, WS_CHILD, 0, 0,1,3,122, IDC_LOCATION, 0x82, "");

  cSize = wSize - (int)(p - pdlgtemplate)*sizeof(WORD);
  // Add the image display area
  p = AddItemToTemplate(p, cSize, WS_VISIBLE | WS_CHILD, WS_EX_STATICEDGE, 4,3,80,82, IDC_IMAGE, 0x82, "");

  cSize = wSize - (int)(p - pdlgtemplate)*sizeof(WORD);
  // Add filename display area
  p = AddItemToTemplate(p, cSize, WS_VISIBLE | WS_CHILD | WS_BORDER | ES_CENTER | ES_READONLY, WS_EX_STATICEDGE, 4,86,80,12, IDC_FILEINFO, 0x81, "");

  return (LPDLGTEMPLATE)pdlgtemplate;
}

BOOL DisplayBitmapInWindow | ( | HWND | hWnd,
 |  | HBITMAP | hbm
 | ) |  |

Definition at line 191 of file OpenDIB.c.

{
    DIBSECTION ds;
  HDC     hDC, hdcMem;
  RECT  rc;
    BOOL    bResult;

    GetClientRect(hWnd, &rc);

  hDC = GetDC(hWnd);

  if (!hbm) {
        PatBlt(hDC, 0, 0, rc.right, rc.bottom, BLACKNESS);
    ReleaseDC(hWnd, hDC);
    return FALSE;
  }

  if (!GetObject(hbm, sizeof(ds), &ds))
    return FALSE;

  SetStretchBltMode(hDC, HALFTONE);

  hdcMem = CreateCompatibleDC(NULL);
  SelectObject(hdcMem, hbm);

    bResult = StretchBlt(hDC,
                     0, 0, rc.right, rc.bottom,
                         hdcMem,
             0, 0, ds.dsBmih.biWidth, ds.dsBmih.biHeight,
             SRCCOPY);

  ReleaseDC(hWnd, hDC);
  DeleteDC(hdcMem);

    return bResult;
}

BOOL DisplayFileToDialog | ( | LPSTR | szFile,
 |  | HWND | hWnd,
 |  | HBITMAP * | hbm
 | ) |  |

Definition at line 228 of file OpenDIB.c.

{
  char szBuffer[256];

  if (*hbm)
    DeleteObject(*hbm);

  *hbm = (HBITMAP)LoadImage(NULL,
      szFile,
      IMAGE_BITMAP,
      0, 0,
      LR_CREATEDIBSECTION | LR_LOADFROMFILE);

  if (*hbm) {
    BITMAP bm;
    GetObject(*hbm, sizeof(bm), &bm);

    _snprintf(szBuffer, sizeof(szBuffer)-1, "%lux%lux%lubpp", bm.bmWidth, bm.bmHeight, bm.bmBitsPixel * bm.bmPlanes);
        szBuffer[sizeof(szBuffer)-1] = '\0';

    SetDlgItemText(hWnd, IDC_FILEINFO, szBuffer);
  }

  // If *hbm is bogus, DisplayDIBInWindow will display BLACKNESS
  return DisplayBitmapInWindow(GetDlgItem(hWnd,IDC_IMAGE), *hbm);
}

BOOL GetDIBFilename | ( | LPSTR | lpstrFilename,
 |  | LPSTR | lpstrDefault,
 |  | BOOL | bSave
 | ) |  |

Definition at line 135 of file OpenDIB.c.

{
  LPSTR lpstrFilters = "Bitmaps (*.bmp,*.dib,*.rle)\0*.BMP;*.DIB;*.RLE\0\0";
  OPENFILENAME ofn;
  BOOL bReturnValue = FALSE;
  char szDirName[MAX_PATH];
    // Establish the default directory
  if (!lpstrDefault) {
    GetCurrentDirectory(MAX_PATH, szDirName);
  } else {
        if ((GetFileAttributes(lpstrDefault) & FILE_ATTRIBUTE_DIRECTORY) && (GetFileAttributes(lpstrDefault) !=  0xFFFFFFFF) && lstrlen(lpstrDefault))  {
      lstrcpyn(szDirName, lpstrDefault, sizeof(szDirName)-1);
           szDirName[sizeof(szDirName)-1] = '\0';
       }
        else
      GetCurrentDirectory(MAX_PATH, szDirName);
  }

    // Zero initialize the members of the OPENFILENAME structure
  ZeroMemory(&ofn, sizeof(OPENFILENAME));

    ofn.lStructSize  = sizeof(OPENFILENAME);
    ofn.hwndOwner    = GetActiveWindow();
    ofn.nFilterIndex = 1;
  ofn.lpstrFilter  = lpstrFilters;
    ofn.lpstrFile    = lpstrFilename;
    ofn.nMaxFile     = MAX_PATH;
    ofn.lpstrInitialDir = szDirName;

  // If we are retreiving a filename to save...
  if (bSave) {
        ofn.Flags = OFN_EXPLORER | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;
        ofn.lpstrTitle = "Save Bitmap";

    // Display the Save dialog box.
    bReturnValue = GetSaveFileName(&ofn);
  } else  {
        ofn.lpstrTitle = "Open Bitmap";
    ofn.Flags = OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_EXPLORER;
    ofn.lpfnHook = (LPOFNHOOKPROC)PreviewWindowHookProc;
    ofn.hInstance = (HINSTANCE)CreateDialogTemplate();

    // Display the Open dialog box.
    bReturnValue = GetOpenFileName(&ofn);

    // Free the dialog template we created
    GlobalFree(ofn.hInstance);

   }

    return bReturnValue;
}

BOOL NEAR PASCAL HandleNotify | ( | HWND | hDlg,
 |  | LPOFNOTIFY | pofn,
 |  | LPSTR | szFile,
 |  | HBITMAP * | hbm
 | ) |  |

Definition at line 255 of file OpenDIB.c.

{
  switch (pofn->hdr.code) {
    case CDN_SELCHANGE:  // The selection has changed.

  // Get the path of the selected file.
  if (CommDlg_OpenSave_GetFilePath(GetParent(hDlg), szFile, MAX_PATH)) {
    DisplayFileToDialog(szFile, hDlg, hbm);
  }

    break;
  }

  return(TRUE);
}

LPWORD lpwAlign ( LPWORD lpIn )

Definition at line 28 of file OpenDIB.c.

{
  ULONG_PTR ul;

  ul = (ULONG_PTR) lpIn;
  ul +=3;
  ul >>=2;
  ul <<=2;
  return (LPWORD) ul;
}

int nCopyAnsiToWideChar | ( | LPWORD | lpWCStr,
 |  | LPSTR | lpAnsiIn,
 |  | int | size
 | ) |  |

Definition at line 21 of file OpenDIB.c.

{
  int cchAnsi = lstrlen(lpAnsiIn);

  return MultiByteToWideChar(GetACP(), MB_PRECOMPOSED, lpAnsiIn, cchAnsi, lpWCStr, size/sizeof(WCHAR)) + 1;
}

LRESULT CALLBACK PreviewWindowHookProc | ( | HWND | hDlg,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 272 of file OpenDIB.c.

{
  static char szFile[MAX_PATH];
  static HBITMAP hbm;

    switch (msg) {
  case WM_INITDIALOG:
    // Initialize values
    szFile[0] = 0;
    hbm = NULL;
    SetDlgItemText(hDlg, IDC_FILEINFO, "");
    {
      HFONT hf = (HFONT)SendMessage(GetParent(hDlg), WM_GETFONT, 0, 0);

      SendMessage(GetDlgItem(hDlg, IDC_FILEINFO), WM_SETFONT, (WPARAM)hf, lParam);
    }
    break;

  case WM_DESTROY:
    if (hbm)
      DeleteObject(hbm);
    break;

  case WM_CTLCOLORSTATIC:
    if (GetDlgItem(hDlg, IDC_IMAGE) == (HWND) lParam) {

      DisplayBitmapInWindow(GetDlgItem(hDlg, IDC_IMAGE), hbm);

      return (LRESULT)GetStockObject(NULL_BRUSH);
    }
    break;

  case WM_NOTIFY:
    {
      int idCtrl = (int) wParam;
      LPOFNOTIFY lpof = (LPOFNOTIFY)lParam;

      HandleNotify(hDlg, lpof, szFile, &hbm);
    }
    break;

  }

  return 0;
}

Generated on Wed Nov 13 2024 16:53:44 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/ViewDIB/OpenDIB.h File Reference

  • Multimedia
  • Gdi
  • ViewDIB
Functions

OpenDIB.h File Reference

Go to the source code of this file.

Functions

BOOL GetDIBFilename (LPSTR, LPSTR, BOOL)

Function Documentation

BOOL GetDIBFilename | ( | LPSTR | ,
 |  | LPSTR | ,
 |  | BOOL |
 | ) |  |

Definition at line 135 of file OpenDIB.c.

{
  LPSTR lpstrFilters = "Bitmaps (*.bmp,*.dib,*.rle)\0*.BMP;*.DIB;*.RLE\0\0";
  OPENFILENAME ofn;
  BOOL bReturnValue = FALSE;
  char szDirName[MAX_PATH];
    // Establish the default directory
  if (!lpstrDefault) {
    GetCurrentDirectory(MAX_PATH, szDirName);
  } else {
        if ((GetFileAttributes(lpstrDefault) & FILE_ATTRIBUTE_DIRECTORY) && (GetFileAttributes(lpstrDefault) !=  0xFFFFFFFF) && lstrlen(lpstrDefault))  {
      lstrcpyn(szDirName, lpstrDefault, sizeof(szDirName)-1);
           szDirName[sizeof(szDirName)-1] = '\0';
       }
        else
      GetCurrentDirectory(MAX_PATH, szDirName);
  }

    // Zero initialize the members of the OPENFILENAME structure
  ZeroMemory(&ofn, sizeof(OPENFILENAME));

    ofn.lStructSize  = sizeof(OPENFILENAME);
    ofn.hwndOwner    = GetActiveWindow();
    ofn.nFilterIndex = 1;
  ofn.lpstrFilter  = lpstrFilters;
    ofn.lpstrFile    = lpstrFilename;
    ofn.nMaxFile     = MAX_PATH;
    ofn.lpstrInitialDir = szDirName;

  // If we are retreiving a filename to save...
  if (bSave) {
        ofn.Flags = OFN_EXPLORER | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;
        ofn.lpstrTitle = "Save Bitmap";

    // Display the Save dialog box.
    bReturnValue = GetSaveFileName(&ofn);
  } else  {
        ofn.lpstrTitle = "Open Bitmap";
    ofn.Flags = OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_EXPLORER;
    ofn.lpfnHook = (LPOFNHOOKPROC)PreviewWindowHookProc;
    ofn.hInstance = (HINSTANCE)CreateDialogTemplate();

    // Display the Open dialog box.
    bReturnValue = GetOpenFileName(&ofn);

    // Free the dialog template we created
    GlobalFree(ofn.hInstance);

   }

    return bReturnValue;
}

Generated on Wed Nov 13 2024 16:53:44 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/ViewDIB/Resource.h File Reference

  • Multimedia
  • Gdi
  • ViewDIB
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_STATIC -1
#define | IDM_ABOUT 105
#define | IDM_CD15BPP 116
#define | IDM_CD16BPP 117
#define | IDM_CD1BPP 113
#define | IDM_CD24BPP 118
#define | IDM_CD32BPP 119
#define | IDM_CD4BPP 114
#define | IDM_CD8BPP 115
#define | IDM_COPY 110
#define | IDM_DIBINFO 112
#define | IDM_EXIT 102
#define | IDM_LOADDIB 106
#define | IDM_PASTE 111
#define | IDM_PRINT 109
#define | IDM_SAVEDIB 121

Define Documentation

#define IDC_STATIC -1

Definition at line 20 of file Resource.h.

#define IDM_ABOUT 105

Definition at line 6 of file Resource.h.

#define IDM_CD15BPP 116

Definition at line 15 of file Resource.h.

#define IDM_CD16BPP 117

Definition at line 16 of file Resource.h.

#define IDM_CD1BPP 113

Definition at line 12 of file Resource.h.

#define IDM_CD24BPP 118

Definition at line 17 of file Resource.h.

#define IDM_CD32BPP 119

Definition at line 18 of file Resource.h.

#define IDM_CD4BPP 114

Definition at line 13 of file Resource.h.

#define IDM_CD8BPP 115

Definition at line 14 of file Resource.h.

#define IDM_COPY 110

Definition at line 9 of file Resource.h.

#define IDM_DIBINFO 112

Definition at line 11 of file Resource.h.

#define IDM_EXIT 102

Definition at line 5 of file Resource.h.

#define IDM_LOADDIB 106

Definition at line 7 of file Resource.h.

#define IDM_PASTE 111

Definition at line 10 of file Resource.h.

#define IDM_PRINT 109

Definition at line 8 of file Resource.h.

#define IDM_SAVEDIB 121

Definition at line 19 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/ViewDIB/ViewDIB.c File Reference

  • Multimedia
  • Gdi
  • ViewDIB
Functions | Variables

ViewDIB.c File Reference

#include <windows.h>
#include <stdio.h>
#include <commdlg.h>
#include "DIBSectn.h"
#include "OpenDIB.h"
#include "resource.h"

Go to the source code of this file.

Functions

LRESULT CALLBACK | About (HWND, UINT, WPARAM, LPARAM)
DWORD | GetLastErrorBox (HWND hWnd, LPSTR lpTitle)
BOOL | InitApplication (HINSTANCE hInstance)
BOOL | InitInstance (HINSTANCE hInstance, int nCmdShow)
void | PrintDIBSection (HWND hWnd, HBITMAP hbmp)
void | SetWindowTitle (HWND hWnd, LPSTR szFilename, HBITMAP hbm)
int APIENTRY | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
LRESULT CALLBACK | WndProc (HWND, UINT, WPARAM, LPARAM)

Variables

HINSTANCE | hInst
char | szAppName [] = "ViewDIB"
char | szTitle [] = "ViewDIB: DIB Section Demo"

Function Documentation

LRESULT CALLBACK About | ( | HWND | hDlg,
 |  | UINT | message,
 |  | WPARAM | uParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 662 of file ViewDIB.c.

{
    switch (message) {
        case WM_COMMAND:                      // message: received a command
            if (LOWORD(uParam) == IDOK || LOWORD(uParam) == IDCANCEL) {
                EndDialog(hDlg, TRUE);        // Exit the dialog
                return (TRUE);
            }
            break;
    }
    return (FALSE); // Didn't process the message

    UNREFERENCED_PARAMETER(lParam); // This will prevent 'unused formal parameter' warnings
}

DWORD GetLastErrorBox | ( | HWND | hWnd,
 |  | LPSTR | lpTitle
 | ) |  |

Definition at line 56 of file ViewDIB.c.

{
   LPVOID lpv;
   DWORD  dwRv;

   if (GetLastError() == 0) return 0;

   dwRv = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
                        FORMAT_MESSAGE_FROM_SYSTEM,
                        NULL,
                        GetLastError(),
                        MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
                        (LPVOID)&lpv,
                        0,
                        NULL);

   MessageBox(hWnd, lpv, lpTitle, MB_OK);

   if(dwRv)
      LocalFree(lpv);

   SetLastError(0);
   return dwRv;
}

BOOL InitApplication ( HINSTANCE hInstance )

Definition at line 101 of file ViewDIB.c.

{
    WNDCLASS  wc;

    // Fill in window class structure with parameters that describe the
    // main window.

    wc.style         = CS_VREDRAW | CS_HREDRAW;  // Class style(s).
    wc.lpfnWndProc   = (WNDPROC)WndProc;       // Window Procedure
    wc.cbClsExtra    = 0;                      // No per-class extra data.
    wc.cbWndExtra    = 0;                      // No per-window extra data.
    wc.hInstance     = hInstance;              // Owner of this class
    wc.hIcon         = LoadIcon (hInstance, "VD_ICON"); // Icon name from .RC
    wc.hCursor       = LoadCursor(NULL, IDC_ARROW); // Cursor
    wc.hbrBackground = GetStockObject(NULL_BRUSH);
    wc.lpszMenuName  = "VD_MENU";              // Menu name from .RC
    wc.lpszClassName = szAppName;              // Name to register as

    // Register the window class and return success/failure code.
    return (RegisterClass(&wc));
}

BOOL InitInstance | ( | HINSTANCE | hInstance,
 |  | int | nCmdShow
 | ) |  |

Definition at line 140 of file ViewDIB.c.

{
    HWND            hWnd; // Main window handle.

    // Save the instance handle in static variable, which will be used in
    // many subsequence calls from this application to Windows.

    hInst = hInstance; // Store instance handle in our global variable

    // Create a main window for this application instance.
    hWnd = CreateWindow(
            szAppName,           // See RegisterClass() call.
            szTitle,             // Text for window title bar.
            WS_OVERLAPPEDWINDOW,// Window style.
            CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, // Use default positioning
            NULL,                // Overlapped windows have no parent.
            NULL,                // Use the window class menu.
            hInstance,           // This instance owns this window.
            NULL                 // We don't use any data in our WM_CREATE
    );

    // If window could not be created, return "failure"
    if (!hWnd) {
            return (FALSE);
    }

    // Make the window visible; update its client area; and return "success"
    ShowWindow(hWnd, nCmdShow); // Show the window
    UpdateWindow(hWnd);         // Sends WM_PAINT message

    return (TRUE);              // We succeeded...
}

void PrintDIBSection | ( | HWND | hWnd,
 |  | HBITMAP | hbmp
 | ) |  |

Definition at line 265 of file ViewDIB.c.

{
  PRINTDLG pd;
  RECT rc;
  DOCINFO di;

  // Clear the structure so it doesn't contain random values
  ZeroMemory(&pd, sizeof(pd));

  // Initialize the structure for retrieving an HDC
  pd.lStructSize = sizeof(PRINTDLG);
  pd.hwndOwner = hWnd;
  pd.Flags = PD_RETURNDC | PD_PRINTSETUP;

  // Let the user pick a printer
  if (!PrintDlg(&pd))
    return;

  // Make sure we got a DC
  if (!pd.hDC)
    return;

  if (pd.hDevMode) GlobalFree(pd.hDevMode);
  if (pd.hDevNames) GlobalFree(pd.hDevNames);

  // Get a rectangle that covers the entire page
  SetRect(&rc,0,0,GetDeviceCaps(pd.hDC, HORZRES), GetDeviceCaps(pd.hDC, VERTRES));

  // Initialize the DOCINFO with the document name
  ZeroMemory(&di, sizeof(di));
  di.cbSize = sizeof(di);
  di.lpszDocName = "ViewDIB Image";

  // Initiate document
  StartDoc(pd.hDC, &di);

  // Initiate page
  StartPage(pd.hDC);

  // Draw the image
  if (!DSDrawDIBSectionOnDC(pd.hDC, hbmp, &rc))
    GetLastErrorBox(hWnd, "Error during printing");

  EndPage(pd.hDC);
  EndDoc(pd.hDC);

  // Clean up
  DeleteDC(pd.hDC);
}

void SetWindowTitle | ( | HWND | hWnd,
 |  | LPSTR | szFilename,
 |  | HBITMAP | hbm
 | ) |  |

Definition at line 234 of file ViewDIB.c.

{
  DIBSECTION  ds;
  char    szNewTitle[MAX_PATH*2];

  if (hbm) {
    GetObject(hbm, sizeof(DIBSECTION), &ds);

    _snprintf(szNewTitle, sizeof(szNewTitle)-1,
         "%s - %s  (%lu x %lu x %lu bpp)",
         szAppName,
         szFilename,
         ds.dsBmih.biWidth,
         ds.dsBmih.biHeight,
         ds.dsBmih.biPlanes * ds.dsBmih.biBitCount);
    } else {
    lstrcpyn(szNewTitle, szAppName, sizeof(szNewTitle)-1);
    }
    szNewTitle[sizeof(szNewTitle)-1] = '\0';

    SetWindowText(hWnd, szNewTitle);
}

int APIENTRY WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 194 of file ViewDIB.c.

{
    MSG msg;
    HANDLE hAccelTable;

    if (!hPrevInstance) {       // Other instances of app running?
    if (!InitApplication(hInstance)) { // Initialize shared things
            return (FALSE);     // Exits if unable to initialize
        }
    }

    // Perform initializations that apply to a specific instance
    if (!InitInstance(hInstance, nCmdShow))
    return (FALSE);

    // Load the keyboard a accelerators for this app
  hAccelTable = LoadAccelerators (hInstance, "VIEWDIB");

    /* Acquire and dispatch messages until a WM_QUIT message is received. */
    while (GetMessage(&msg, NULL, 0, 0))  {
        if (!TranslateAccelerator (msg.hwnd, hAccelTable, &msg)) {
            TranslateMessage(&msg);// Translates virtual key codes
            DispatchMessage(&msg); // Dispatches message to window
        }
    }

    return (int)msg.wParam; // Returns the value from PostQuitMessage

    UNREFERENCED_PARAMETER(lpCmdLine); // This will prevent 'unused formal parameter' warnings
}

LRESULT CALLBACK WndProc | ( | HWND | hWnd,
 |  | UINT | message,
 |  | WPARAM | uParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 322 of file ViewDIB.c.

{
    static char szDirName[MAX_PATH] = "";
  int wmId, wmEvent;
    static HBITMAP hbmp = NULL;
    static HANDLE hPalette = NULL;

    switch (message) {
  case WM_PAINT:
    {
      PAINTSTRUCT ps;
      HDC    hDC = BeginPaint(hWnd, &ps);
      RECT   rect;
      HDC    hdcMem;
      BITMAP bm;

      // Get the extents of our drawing area
      GetClientRect(hWnd, &rect);

      if (hbmp) { // If we have a DIB section loaded

        // Get the attributes of our DIB section
        if (GetObject(hbmp, sizeof(BITMAP), &bm)) {
          // If our DIB has a color table
          if (DSBitsPerPixel(hbmp) <= 8)
            SetStretchBltMode(hDC, COLORONCOLOR); // Yes: COLORONCOLOR is sufficient
          else
            SetStretchBltMode(hDC, HALFTONE);     // No: It will probably look better in HALFTONE

          // If we have a palette, map the colors into the system palette
          if (hPalette) {
            SelectPalette(hDC, hPalette, FALSE);
            RealizePalette(hDC);
          }

          // Create a temporary memory DC to hold the DIB section
          hdcMem = CreateCompatibleDC(hDC);
          SelectObject(hdcMem, hbmp);

          // Display it
          StretchBlt(hDC,    0, 0, rect.right, rect.bottom,
                   hdcMem, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);

          DeleteDC(hdcMem);
        }
      } else
        PatBlt(hDC, 0, 0, rect.right, rect.bottom, BLACKNESS);

      EndPaint(hWnd, &ps);
    }
    break;

  case WM_PALETTECHANGED:
    if ((HWND) uParam == hWnd)
      return 0;

    // Otherwise, fall through to WM_QUERYNEWPALETTE.
  case WM_QUERYNEWPALETTE:
    if (hPalette)
    {
      HDC hdc = GetDC(hWnd);
      HPALETTE hpal;
      UINT i;

      // If realizing the palette causes the palette to change,
      // redraw completely.
      hpal = SelectPalette (hdc, hPalette, FALSE);
      i = RealizePalette(hdc); // i == entries that changed

      SelectPalette (hdc, hpal, FALSE);
      ReleaseDC(hWnd, hdc);

      // If any palette entries changed, repaint the entire window.
      if (i > 0)
        InvalidateRect(hWnd, NULL, TRUE);
      return i;
    }
    break;

  case WM_INITMENU:
    // Initialize all of the menu items
    EnableMenuItem((HMENU)uParam, IDM_PASTE,   (IsClipboardFormatAvailable(CF_DIB) || IsClipboardFormatAvailable(CF_BITMAP)) ? MF_ENABLED : MF_GRAYED);
    EnableMenuItem((HMENU)uParam, IDM_COPY,    hbmp ? MF_ENABLED : MF_GRAYED);
    EnableMenuItem((HMENU)uParam, IDM_SAVEDIB, hbmp ? MF_ENABLED : MF_GRAYED);
    EnableMenuItem((HMENU)uParam, IDM_PRINT,   hbmp ? MF_ENABLED : MF_GRAYED);
    EnableMenuItem((HMENU)uParam, IDM_DIBINFO, hbmp ? MF_ENABLED : MF_GRAYED);
    EnableMenuItem((HMENU)uParam, IDM_CD1BPP,  hbmp ? MF_ENABLED : MF_GRAYED);
    EnableMenuItem((HMENU)uParam, IDM_CD4BPP,  hbmp ? MF_ENABLED : MF_GRAYED);
    EnableMenuItem((HMENU)uParam, IDM_CD8BPP,  hbmp ? MF_ENABLED : MF_GRAYED);
    EnableMenuItem((HMENU)uParam, IDM_CD15BPP, hbmp ? MF_ENABLED : MF_GRAYED);
    EnableMenuItem((HMENU)uParam, IDM_CD16BPP, hbmp ? MF_ENABLED : MF_GRAYED);
    EnableMenuItem((HMENU)uParam, IDM_CD24BPP, hbmp ? MF_ENABLED : MF_GRAYED);
    EnableMenuItem((HMENU)uParam, IDM_CD32BPP, hbmp ? MF_ENABLED : MF_GRAYED);
    break;

  case WM_COMMAND:
    wmId    = LOWORD(uParam);
    wmEvent = HIWORD(uParam);

    switch (wmId) {
    case IDM_DIBINFO:  // Display the DIB section attributes to the user in a MessageBox
      {
        char szBuffer[256];
        DIBSECTION ds;

        // Bail if we don't have a DIB section
        if (!hbmp)
          break;

        // Get the surface attributes
        if (!GetObject(hbmp, sizeof(DIBSECTION), &ds))
          break;  // bail if there is an error

        // Compose the message
        _snprintf(szBuffer, sizeof(szBuffer)-1,
                                   "biSize       \t%lu\n"
                   "biWidth      \t%lu\n"
                   "biHeight     \t%lu\n"
                   "biPlanes     \t%u\n"
                   "biBitCount   \t%u\n"
                   "biCompression\t%lu\n"
                   "biSizeImage  \t%lu\n"
                   "biXPelsPerMtr\t%lu\n"
                   "biYPelsPerMtr\t%lu\n"
                   "biClrUsed    \t%lu\n"
                   "biClrImportant\t%lu\n",
            ds.dsBmih.biSize,
            ds.dsBmih.biWidth,
            ds.dsBmih.biHeight,
            ds.dsBmih.biPlanes,
            ds.dsBmih.biBitCount,
            ds.dsBmih.biCompression,
            ds.dsBmih.biSizeImage,
            ds.dsBmih.biXPelsPerMeter,
            ds.dsBmih.biYPelsPerMeter,
            ds.dsBmih.biClrUsed,
            ds.dsBmih.biClrImportant);
               szBuffer[sizeof(szBuffer)-1] = '\0';

             // Tack on the bitfields information if the DIB section uses bitfields
        if (ds.dsBmih.biCompression == BI_BITFIELDS) {
          _snprintf(&szBuffer[lstrlen(szBuffer)], sizeof(szBuffer)-lstrlen(szBuffer)-1,
                 "Bitfields:\n\tR: 0x%08X\n\tG: 0x%08X\n\tB: 0x%08X",
               ds.dsBitfields[0],ds.dsBitfields[1],ds.dsBitfields[2]);
                    szBuffer[sizeof(szBuffer)-1] = '\0';
        }

        // Show the user the information
        MessageBox (NULL, szBuffer, "DIB Section Information", MB_ICONINFORMATION);
      }
      break;

    // Handle format conversions
    case IDM_CD1BPP:
    case IDM_CD4BPP:
    case IDM_CD8BPP:
    case IDM_CD15BPP:
    case IDM_CD16BPP:
    case IDM_CD24BPP:
    case IDM_CD32BPP:
      {
        HBITMAP hbmNew;

        // Convert into the surface format the user asked for
        switch (wmId) {
          case IDM_CD1BPP: hbmNew = DSCopyBitmapEx(hbmp, NULL, 1); break;
          case IDM_CD4BPP: hbmNew = DSCopyBitmapEx(hbmp, NULL, 4); break;
          case IDM_CD8BPP: hbmNew = DSCopyBitmapEx(hbmp, NULL, 8); break;
          case IDM_CD15BPP: hbmNew = DSCopyBitmapEx(hbmp, NULL, 15); break;
          case IDM_CD16BPP: hbmNew = DSCopyBitmapEx(hbmp, NULL, 16); break;
          case IDM_CD24BPP: hbmNew = DSCopyBitmapEx(hbmp, NULL, 24); break;
          case IDM_CD32BPP: hbmNew = DSCopyBitmapEx(hbmp, NULL, 32); break;
        }

        // If we sucessfully converted, update the titlebar and redisplay
        if (hbmNew) {
          // Delete the old bitmap and palette
          DeleteObject(hbmp);
          if (hPalette)
            DeleteObject(hPalette);

          // Update our bitmap and palette to reference the new image
          hbmp = hbmNew;
          hPalette = DSCreatePaletteForDIBSection(hbmp);

          // Set our title to reflect the name of the file we loaded
          SetWindowTitle(hWnd, "Untitled.BMP", hbmp);

          // Force the new image to be displayed
          InvalidateRect(hWnd, NULL, FALSE);
        } else
          GetLastErrorBox(hWnd, "Error during format conversion");
      }
      break;

    // Print the DIB section
    case IDM_PRINT:
      if (hbmp)
        PrintDIBSection(hWnd, hbmp);
      break;

      // Copy the DIB section to the clipboard
    case IDM_COPY:
      if (hbmp) {
        DSPutDIBSectionOnClipboard(hbmp);
      }
      break;

    // Paste the DIB section from the clipboard
    case IDM_PASTE:
      {
        HBITMAP hbmNew;

        // Retrieve the DIB
        hbmNew = DSGetDIBSectionFromClipboard();

        if (hbmNew) {
          if (hbmp)
            DeleteObject(hbmp);

          if (hPalette)
            DeleteObject(hPalette);

          hbmp = hbmNew;
          hPalette = DSCreatePaletteForDIBSection(hbmp);

          // Set our title to reflect the origin/attributes of the image
          SetWindowTitle(hWnd, "<Clipboard>", hbmp);

          InvalidateRect(hWnd, NULL, FALSE);
        } else
          GetLastErrorBox(hWnd, "Error during paste");
      }
      break;

    case IDM_LOADDIB:
      {
        char szFilename[MAX_PATH] = "*.BMP";

        // Retreive a filename
                szDirName[sizeof(szDirName)-1] = '\0';
        if (GetDIBFilename(szFilename, szDirName, FALSE)) {

          // Save the current directory
          GetCurrentDirectory(MAX_PATH, szDirName);

          if (hbmp)
            DeleteObject(hbmp);

          if (hPalette)
            DeleteObject(hPalette);

          if (!DSLoadDIBSectionFromBMPFile(szFilename, &hbmp, (HPALETTE*)&hPalette)) {
            MessageBox(hWnd, "Unable to load file!", szFilename, MB_ICONSTOP);
            hbmp = NULL;
            hPalette = NULL;
          }
        } else  // user canceled
          return 0;

        // Set our title to reflect the name of the file we loaded
        SetWindowTitle(hWnd, szFilename, hbmp);

        InvalidateRect(hWnd, NULL, FALSE);
      }
      break;

    case IDM_SAVEDIB:
      {
        char szFilename[MAX_PATH] = "*.BMP";

        // Do we have a DIB loaded?
        if (!hbmp)
          break;

        // Retreive a filename
                szDirName[sizeof(szDirName)-1] = '\0';
        if (GetDIBFilename(szFilename, szDirName, TRUE)) {

          // Save the current directory
          GetCurrentDirectory(MAX_PATH, szDirName);

          // Save the current image to the filename the user selected
          DSStoreDIBSectionInBMPFile(szFilename, hbmp);

          // Set our title to reflect the new name of the file
          SetWindowTitle(hWnd, szFilename, hbmp);
        } else  // user canceled
          return 0;
      }
      break;

    case IDM_ABOUT:
      DialogBox(hInst,          // current instance
        "ABOUTBOX",      // dlg resource to use
        hWnd,            // parent handle
        (DLGPROC)About); // About() instance address
      break;

    case IDM_EXIT:
      DestroyWindow (hWnd);
      break;

    default:
      return (DefWindowProc(hWnd, message, uParam, lParam));
    }
    break;

        case WM_DESTROY:  // message: window being destroyed
      // Clean up the objects we created
      if (hbmp)
        DeleteObject(hbmp);

      if (hPalette)
        DeleteObject(hPalette);

      // Hasta la vista...
      PostQuitMessage(0);
      break;

        default:          // Passes it on if unproccessed
      return (DefWindowProc(hWnd, message, uParam, lParam));
    }
    return (0);
}

Variable Documentation

HINSTANCE hInst

Definition at line 39 of file ViewDIB.c.

char szAppName[] = "ViewDIB"

Definition at line 41 of file ViewDIB.c.

char szTitle[] = "ViewDIB: DIB Section Demo"

Definition at line 42 of file ViewDIB.c.

Generated on Wed Nov 13 2024 16:53:44 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/WinCap32/Copy.c File Reference

  • Multimedia
  • Gdi
  • WinCap32
Defines | Functions

Copy.c File Reference

#include <WINDOWS.H>
#include "DIBUTIL.H"
#include "DIBAPI.H"

Go to the source code of this file.

Defines

#define | STRICT

Functions

HBITMAP | CopyScreenToBitmap (LPRECT lpRect)
HDIB | CopyScreenToDIB (LPRECT lpRect)
HBITMAP | CopyWindowToBitmap (HWND hWnd, WORD fPrintArea)
HDIB | CopyWindowToDIB (HWND hWnd, WORD fPrintArea)
BOOL | PaintBitmap (HDC hDC, LPRECT lpDCRect, HBITMAP hDDB, LPRECT lpDDBRect, HPALETTE hPal)
BOOL | PaintDIB (HDC hDC, LPRECT lpDCRect, HDIB hDIB, LPRECT lpDIBRect, HPALETTE hPal)

Define Documentation

#define STRICT

Definition at line 28 of file Copy.c.

Function Documentation

HBITMAP CopyScreenToBitmap ( LPRECT lpRect )

Definition at line 288 of file Copy.c.

{
    HDC         hScrDC, hMemDC;         // screen DC and memory DC
    HBITMAP     hBitmap, hOldBitmap;    // handles to deice-dependent bitmaps
    int         nX, nY, nX2, nY2;       // coordinates of rectangle to grab
    int         nWidth, nHeight;        // DIB width and height
    int         xScrn, yScrn;           // screen resolution

    // check for an empty rectangle

    if (IsRectEmpty(lpRect))
      return NULL;

    // create a DC for the screen and create
    // a memory DC compatible to screen DC

    hScrDC = CreateDC("DISPLAY", NULL, NULL, NULL);
    hMemDC = CreateCompatibleDC(hScrDC);

    // get points of rectangle to grab

    nX = lpRect->left;
    nY = lpRect->top;
    nX2 = lpRect->right;
    nY2 = lpRect->bottom;

    // get screen resolution

    xScrn = GetDeviceCaps(hScrDC, HORZRES);
    yScrn = GetDeviceCaps(hScrDC, VERTRES);

    //make sure bitmap rectangle is visible

    if (nX < 0)
        nX = 0;
    if (nY < 0)
        nY = 0;
    if (nX2 > xScrn)
        nX2 = xScrn;
    if (nY2 > yScrn)
        nY2 = yScrn;

    nWidth = nX2 - nX;
    nHeight = nY2 - nY;

    // create a bitmap compatible with the screen DC
    hBitmap = CreateCompatibleBitmap(hScrDC, nWidth, nHeight);

    // select new bitmap into memory DC
    hOldBitmap = (HBITMAP) SelectObject(hMemDC, hBitmap);

    // bitblt screen DC to memory DC
    BitBlt(hMemDC, 0, 0, nWidth, nHeight, hScrDC, nX, nY, SRCCOPY);

    // select old bitmap back into memory DC and get handle to
    // bitmap of the screen

    hBitmap = (HBITMAP)  SelectObject(hMemDC, hOldBitmap);

    // clean up

    DeleteDC(hScrDC);
    DeleteDC(hMemDC);

    // return handle to the bitmap

    return hBitmap;
}

HDIB CopyScreenToDIB ( LPRECT lpRect )

Definition at line 141 of file Copy.c.

{
    HBITMAP     hBitmap;        // handle to device-dependent bitmap
    HPALETTE    hPalette;       // handle to palette
    HDIB        hDIB = NULL;    // handle to DIB

    // get the device-dependent bitmap in lpRect by calling
    //  CopyScreenToBitmap and passing it the rectangle to grab

  // Check for a valid rect
  if (!lpRect)
    return NULL;

    hBitmap = CopyScreenToBitmap(lpRect);

    // check for a valid bitmap handle

    if (!hBitmap)
      return NULL;

    // get the current palette

    hPalette = GetSystemPalette();

    // convert the bitmap to a DIB

    hDIB = BitmapToDIB(hBitmap, hPalette);

    // clean up

    DeleteObject(hPalette);
    DeleteObject(hBitmap);

    // return handle to the packed-DIB
    return hDIB;
}

HBITMAP CopyWindowToBitmap | ( | HWND | hWnd,
 |  | WORD | fPrintArea
 | ) |  |

Definition at line 202 of file Copy.c.

{
    HBITMAP     hBitmap = NULL;  // handle to device-dependent bitmap

    // check for a valid window handle

    if (!hWnd)
        return NULL;

    switch (fPrintArea)
    {
        case PW_WINDOW: // copy entire window
        {
            RECT    rectWnd;

            // get the window rectangle

            GetWindowRect(hWnd, &rectWnd);

            // get the bitmap of that window by calling
            // CopyScreenToBitmap and passing it the window rect

            hBitmap = CopyScreenToBitmap(&rectWnd);
            break;
        }

        case PW_CLIENT: // copy client area
        {
            RECT rectClient;
            POINT pt1, pt2;

            // get client dimensions

            GetClientRect(hWnd, &rectClient);

            // convert client coords to screen coords

            pt1.x = rectClient.left;
            pt1.y = rectClient.top;
            pt2.x = rectClient.right;
            pt2.y = rectClient.bottom;
            ClientToScreen(hWnd, &pt1);
            ClientToScreen(hWnd, &pt2);
            rectClient.left = pt1.x;
            rectClient.top = pt1.y;
            rectClient.right = pt2.x;
            rectClient.bottom = pt2.y;

            // get the bitmap of the client area by calling
            // CopyScreenToBitmap and passing it the client rect

            hBitmap = CopyScreenToBitmap(&rectClient);
            break;
        }

        default:    // invalid print area
            return NULL;
    }

    // return handle to the bitmap

   return hBitmap;
}

HDIB CopyWindowToDIB | ( | HWND | hWnd,
 |  | WORD | fPrintArea
 | ) |  |

Definition at line 57 of file Copy.c.

{
   HDIB     hDIB = NULL;  // handle to DIB

   // check for a valid window handle

    if (!hWnd)
        return NULL;

    switch (fPrintArea)
    {
        case PW_WINDOW: // copy entire window
        {
            RECT    rectWnd;

            // get the window rectangle

            GetWindowRect(hWnd, &rectWnd);

            // get the DIB of the window by calling
            // CopyScreenToDIB and passing it the window rect

            hDIB = CopyScreenToDIB(&rectWnd);
            break;
        }

        case PW_CLIENT: // copy client area
        {
            RECT    rectClient;
            POINT   pt1, pt2;

            // get the client area dimensions

            GetClientRect(hWnd, &rectClient);

            // convert client coords to screen coords

            pt1.x = rectClient.left;
            pt1.y = rectClient.top;
            pt2.x = rectClient.right;
            pt2.y = rectClient.bottom;
            ClientToScreen(hWnd, &pt1);
            ClientToScreen(hWnd, &pt2);
            rectClient.left = pt1.x;
            rectClient.top = pt1.y;
            rectClient.right = pt2.x;
            rectClient.bottom = pt2.y;

            // get the DIB of the client area by calling
            // CopyScreenToDIB and passing it the client rect

            hDIB = CopyScreenToDIB(&rectClient);
            break;
        }

        default:    // invalid print area
            return NULL;
    }

   // return the handle to the DIB

   return hDIB;
}

BOOL PaintBitmap | ( | HDC | hDC,
 |  | LPRECT | lpDCRect,
 |  | HBITMAP | hDDB,
 |  | LPRECT | lpDDBRect,
 |  | HPALETTE | hPal
 | ) |  |

Definition at line 487 of file Copy.c.

{
    HDC         hMemDC;            // Handle to memory DC
    HBITMAP     hOldBitmap;        // Handle to previous bitmap
    HPALETTE    hOldPal1 = NULL;   // Handle to previous palette
    HPALETTE    hOldPal2 = NULL;   // Handle to previous palette
    BOOL        bSuccess = FALSE;  // Success/fail flag

    // Create a memory DC

    hMemDC = CreateCompatibleDC (hDC);

    // If this failed, return FALSE

    if (!hMemDC)
        return FALSE;

    // If we have a palette, select and realize it

    if (hPal)
    {
        hOldPal1 = SelectPalette(hMemDC, hPal, TRUE);
        hOldPal2 = SelectPalette(hDC, hPal, TRUE);
        RealizePalette(hDC);
    }

    // Select bitmap into the memory DC

    hOldBitmap = (HBITMAP) SelectObject (hMemDC, hDDB);

    // Make sure to use the stretching mode best for color pictures

    SetStretchBltMode (hDC, COLORONCOLOR);

    // Determine whether to call StretchBlt() or BitBlt()
    if ((RECTWIDTH(lpDCRect)  == RECTWIDTH(lpDDBRect)) &&
            (RECTHEIGHT(lpDCRect) == RECTHEIGHT(lpDDBRect)))
        bSuccess = BitBlt(hDC, lpDCRect->left, lpDCRect->top,
                lpDCRect->right - lpDCRect->left,
                lpDCRect->bottom - lpDCRect->top, hMemDC, lpDDBRect->left,
                lpDDBRect->top, SRCCOPY);
    else
        bSuccess = StretchBlt(hDC, lpDCRect->left,  lpDCRect->top,
                lpDCRect->right - lpDCRect->left,
                lpDCRect->bottom - lpDCRect->top, hMemDC, lpDDBRect->left,
                lpDDBRect->top,  lpDDBRect->right - lpDDBRect->left,
                lpDDBRect->bottom - lpDDBRect->top, SRCCOPY);

    // Clean up

    SelectObject(hMemDC, hOldBitmap);

    if (hOldPal1)
        SelectPalette (hMemDC, hOldPal1, FALSE);

    if (hOldPal2)
        SelectPalette (hDC, hOldPal2, FALSE);

    DeleteDC (hMemDC);

    // Return with success/fail flag

    return bSuccess;
}

BOOL PaintDIB | ( | HDC | hDC,
 |  | LPRECT | lpDCRect,
 |  | HDIB | hDIB,
 |  | LPRECT | lpDIBRect,
 |  | HPALETTE | hPal
 | ) |  |

Definition at line 391 of file Copy.c.

{
    LPSTR        lpDIBHdr;           // Pointer to BITMAPINFOHEADER
    LPSTR        lpDIBBits;          // Pointer to DIB bits
    BOOL         bSuccess=FALSE;     // Success/fail flag
    HPALETTE     hOldPal=NULL;       // Previous palette

    // Check for valid DIB handle

    if (!hDIB)
        return FALSE;

    // Lock down the DIB, and get a pointer to the beginning of the bit
    // buffer

    lpDIBHdr  = (LPSTR) GlobalLock(hDIB);
    lpDIBBits = FindDIBBits(lpDIBHdr);

    // Select and realize our palette as background

    if (hPal)
    {
        hOldPal = SelectPalette(hDC, hPal, TRUE);
        RealizePalette(hDC);
    }

    // Make sure to use the stretching mode best for color pictures

    SetStretchBltMode(hDC, COLORONCOLOR);

    // Determine whether to call StretchDIBits() or SetDIBitsToDevice()

    if ((RECTWIDTH(lpDCRect)  == RECTWIDTH(lpDIBRect)) &&
            (RECTHEIGHT(lpDCRect) == RECTHEIGHT(lpDIBRect)))
    {
        bSuccess = SetDIBitsToDevice(hDC, lpDCRect->left, lpDCRect->top,
                RECTWIDTH(lpDCRect), RECTHEIGHT(lpDCRect), lpDIBRect->left,
                (int)DIBHeight(lpDIBHdr) - lpDIBRect->top -
                RECTHEIGHT(lpDIBRect), 0, DIBHeight(lpDIBHdr), lpDIBBits,
                (LPBITMAPINFO)lpDIBHdr, DIB_RGB_COLORS);
    }
    else
        bSuccess = StretchDIBits(hDC, lpDCRect->left, lpDCRect->top,
                RECTWIDTH(lpDCRect), RECTHEIGHT(lpDCRect), lpDIBRect->left,
                lpDIBRect->top, RECTWIDTH(lpDIBRect), RECTHEIGHT(lpDIBRect),
                lpDIBBits, (LPBITMAPINFO)lpDIBHdr, DIB_RGB_COLORS, SRCCOPY);

    // Unlock the memory block

    GlobalUnlock(hDIB);

    // Reselect old palette

    if (hOldPal)
     SelectPalette(hDC, hOldPal, FALSE);

    // Return with success/fail flag
    return bSuccess;
}

Generated on Wed Nov 13 2024 16:53:44 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/WinCap32/Dialogs.c File Reference

  • Multimedia
  • Gdi
  • WinCap32
Defines | Functions | Variables

Dialogs.c File Reference

#include <windows.h>
#include <string.h>
#include <stdlib.h>
#include "WINCAP.h"
#include "DIALOGS.h"
#include "commdlg.h"
#include "resource.h"

Go to the source code of this file.

Defines

#define | STRICT

Functions

LRESULT APIENTRY | AboutDlgProc (HWND hWndDlg, UINT Message, WPARAM wParam, LPARAM lParam)
LRESULT APIENTRY | PrintDlgProc (HWND hWndDlg, UINT Message, WPARAM wParam, LPARAM lParam)
LRESULT APIENTRY | RectangleDlgProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
LRESULT APIENTRY | SavingDlgProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
LRESULT APIENTRY | SelectDlgProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)

Variables

BOOL gbCaptRect
BOOL gbNowCapturing
HINSTANCE | ghInst
HWND | ghWndMain
char | szAppName [20]

Define Documentation

#define STRICT

Definition at line 18 of file Dialogs.c.

Function Documentation

LRESULT APIENTRY AboutDlgProc | ( | HWND | hWndDlg,
 |  | UINT | Message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 48 of file Dialogs.c.

{
    static HBITMAP  ghAboutBmp = NULL;

    switch (Message)
    {
        // Set focus on the OK button.  Since we set focus, return FALSE

        case WM_INITDIALOG:
            SetFocus(GetDlgItem(hWndDlg, IDOK));
            ghAboutBmp = LoadBitmap(ghInst, "ABOUTBMP");
            return FALSE;

        //Closing the Dialog behaves the same as Cancel

        case WM_CLOSE:
            PostMessage(hWndDlg, WM_COMMAND, IDCANCEL, 0L);
            break;

        case WM_COMMAND:
            switch (wParam)
            {
                case IDOK:

                case IDCANCEL:
                    EndDialog(hWndDlg, FALSE);
                    if (ghAboutBmp)
                        DeleteObject(ghAboutBmp);

                    break;
            }
            break;    //End of WM_COMMAND

        // Paint our bitmap in the about box in the WM_PAINT case

        case WM_PAINT:
        {
            HBITMAP     hbm;
            HDC         hdcMem;
            PAINTSTRUCT ps;
            RECT        r1;        // Coordinates of TEXT1 control
            POINT       p1;        // Used to convert screen to client coords
            BITMAP      bm;        // For getting info about "About" bitmap

            BeginPaint(hWndDlg, &ps);

            // Place screen coords of TEXT1 in r1

            GetWindowRect(GetDlgItem(hWndDlg, IDC_TEXT1), &r1);
            p1.x = r1.left;
            p1.y = r1.top;

            ScreenToClient(hWndDlg, &p1);

            // p1 now describes the location of upper-left corner
            // for the top text in the dialog.  Let's use this
            // to make sure we don't draw our bitmap over the text

            r1.left = 12;
            r1.top = p1.y;
            r1.right = p1.x - 25;
            r1.bottom = r1.top + (r1.right - r1.left); // Make it square

            if (hdcMem = CreateCompatibleDC(ps.hdc))
            {
                GetObject(ghAboutBmp, sizeof(BITMAP), (LPVOID)&bm);
                hbm = SelectObject(hdcMem, ghAboutBmp);
                StretchBlt(ps.hdc, r1.left, r1.top, r1.right, r1.bottom, hdcMem,
                        0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
                SelectObject(hdcMem, hbm);
                DeleteDC(hdcMem);
            }

            EndPaint(hWndDlg, &ps);
            break;
        }

        default:
            return FALSE;
    }

    return TRUE;
} // End of DIALOGSMsgProc

LRESULT APIENTRY PrintDlgProc | ( | HWND | hWndDlg,
 |  | UINT | Message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 150 of file Dialogs.c.

{
    static LPOPTIONSTRUCT   lpOS;

    switch (Message)
    {
        case WM_INITDIALOG:
        {

            // Because DialogBoxParam() was used to invoke this dialog box,
            // lParam contains a pointer to the OPTIONSTRUCT.
            // Place user input in this structure before returning.

            lpOS = (LPOPTIONSTRUCT)lParam;

            // Check the default button -- "BEST FIT"

            CheckRadioButton(hWndDlg, IDC_BESTFIT, IDC_STRETCHTOPAGE, IDC_BESTFIT);

            // Gray out the stuff under "SCALE"

            EnableWindow(GetDlgItem(hWndDlg, IDC_XAXIS), FALSE);
            EnableWindow(GetDlgItem(hWndDlg, IDC_YAXIS), FALSE);
            EnableWindow(GetDlgItem(hWndDlg, IDC_XTEXT), FALSE);
            EnableWindow(GetDlgItem(hWndDlg, IDC_YTEXT), FALSE);
            break;
        }

        // Closing the Dialog should behave the same as Cancel

        case WM_CLOSE:
            PostMessage(hWndDlg, WM_COMMAND, IDCANCEL, 0L);
            break;

        case WM_COMMAND:
            switch (wParam)
            {
                case IDC_BESTFIT:

                case IDC_STRETCHTOPAGE:

                case IDC_SCALE:

                    // Check the correct button

                    CheckRadioButton(hWndDlg, IDC_BESTFIT, IDC_SCALE, (int)wParam);

                    // And enable or disable the options under "Scale",
                    // depending on whether or not the IDC_SCALE button
                    // is checked

                    EnableWindow(GetDlgItem(hWndDlg, IDC_XAXIS),
                            (BOOL)(wParam == IDC_SCALE));
                    EnableWindow(GetDlgItem(hWndDlg, IDC_YAXIS),
                            (BOOL)(wParam == IDC_SCALE));
                    EnableWindow(GetDlgItem(hWndDlg, IDC_XTEXT),
                            (BOOL)(wParam == IDC_SCALE));
                    EnableWindow(GetDlgItem(hWndDlg, IDC_YTEXT),
                            (BOOL)(wParam == IDC_SCALE));
                    break;

                case IDOK:
                {
                    char    szTmp[100];

                    // Save the user's selection into the OPTIONSTRUCT

                    if (!lpOS)
                    {
                        EndDialog(hWndDlg, FALSE);
                        break;
                    }

                    if (IsDlgButtonChecked(hWndDlg, IDC_BESTFIT))
                        lpOS->iOption = IDC_BESTFIT;

                    if (IsDlgButtonChecked(hWndDlg, IDC_STRETCHTOPAGE))
                        lpOS->iOption = IDC_STRETCHTOPAGE;

                    if (IsDlgButtonChecked(hWndDlg, IDC_SCALE))
                        lpOS->iOption = IDC_SCALE;

                    if (GetDlgItemText(hWndDlg, IDC_XAXIS, (LPSTR)szTmp, 100))
                        lpOS->iXScale = atoi(szTmp);

                    if (GetDlgItemText(hWndDlg, IDC_YAXIS, (LPSTR)szTmp, 100))
                        lpOS->iYScale = atoi(szTmp);

                    EndDialog(hWndDlg, TRUE);
                    break;
                }

                case IDCANCEL:
                    EndDialog(hWndDlg, FALSE);
                    break;
            } // End of WM_COMMAND

            break;

        default:
            return FALSE;
    }

    return TRUE;
}

LRESULT APIENTRY RectangleDlgProc | ( | HWND | hDlg,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 371 of file Dialogs.c.

{
    switch (message)
    {
        case WM_INITDIALOG:
        {
            HGLOBAL     hMem;
            char        *szText;

            hMem = GlobalAlloc(GHND, 200);
      if (!hMem)
        return FALSE;

            szText = (char *)GlobalLock(hMem);
            if(szText == NULL)
                return TRUE;

            LoadString(ghInst, IDS_RECT2, szText, 200);
            SetDlgItemText(hDlg, IDC_STATIC_RECT2, szText);
            LoadString(ghInst, IDS_RECT3, szText, 200);
            SetDlgItemText(hDlg, IDC_STATIC_RECT3, szText);

            GlobalUnlock(hMem);
            GlobalFree(hMem);

            return TRUE;
        }

        case WM_COMMAND:
            if ((wParam) != IDCANCEL)
                return FALSE;
            else
            {
                ShowWindow(hDlg, SW_HIDE);
                gbNowCapturing = FALSE;
        gbCaptRect = FALSE;
                return TRUE;
            }

        case WM_SYSCOMMAND:
            if(wParam == SC_CLOSE)
            {
                ShowWindow(hDlg, SW_HIDE);
                gbNowCapturing = FALSE;
                return TRUE;
            }
            else
                return FALSE;

        case WM_DESTROY:
            return TRUE;

        default:
            return FALSE;
    }
}

LRESULT APIENTRY SavingDlgProc | ( | HWND | hDlg,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 268 of file Dialogs.c.

{
    switch (message)
    {
        case WM_SETFOCUS:
            MessageBeep(0);
            break;

        case WM_INITDIALOG:

            // Set the text of the filename in the dialog box.  This dialog
            // should be called with DialogBoxParam, and the parameter should
            // be a pointer to the filename.  It shows up as the lParam here.

            SetDlgItemText(hDlg, IDC_FILETEXT, (LPSTR)lParam);
            return TRUE;
            break;

        case WM_DESTROY:
            return TRUE;
            break;
    }

  // default return value.
  return FALSE;
}

LRESULT APIENTRY SelectDlgProc | ( | HWND | hDlg,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 305 of file Dialogs.c.

{
    switch (message)
    {
        case WM_INITDIALOG:
        {
            HGLOBAL     hMem;
            char        *szText;

            hMem = GlobalAlloc(GHND, 200);
      if (!hMem)
        return FALSE;

            szText = (char *)GlobalLock(hMem);
            if(szText == NULL)
                return TRUE;

            LoadString(ghInst, IDS_SELECT2, szText, 200);
            SetDlgItemText(hDlg, IDC_STATIC_SELECT2, szText);
            LoadString(ghInst, IDS_SELECT3, szText, 200);
            SetDlgItemText(hDlg, IDC_STATIC_SELECT3, szText);

            GlobalUnlock(hMem);
            GlobalFree(hMem);

            return TRUE;
        }

        case WM_COMMAND:
            if ((wParam) != IDCANCEL)
                return FALSE;
            else
            {
                ShowWindow(hDlg, SW_HIDE);
                gbNowCapturing = FALSE;
                return TRUE;
            }

        case WM_SYSCOMMAND:
            if(wParam == SC_CLOSE)
            {
                ShowWindow(hDlg, SW_HIDE);
                gbNowCapturing = FALSE;
                return TRUE;
            }
            else
                return FALSE;

        case WM_DESTROY:
            return TRUE;

        default:
            return FALSE;
    }
}

Variable Documentation

BOOL gbCaptRect

Definition at line 70 of file WinCap.c.

BOOL gbNowCapturing

Handle to main window.

Definition at line 69 of file WinCap.c.

HINSTANCE ghInst

Name of app.

Definition at line 24 of file ole2ui.c.

HWND ghWndMain

Handle to instance.

Definition at line 20 of file Dllinit.c.

char szAppName[20]

Definition at line 56 of file Generic.C.

Generated on Wed Nov 13 2024 16:53:37 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/WinCap32/Dialogs.h File Reference

  • Multimedia
  • Gdi
  • WinCap32
Defines

Dialogs.h File Reference

Go to the source code of this file.

Defines

#define | DLGOPEN_BIG 670
#define | DLGOPEN_DIR_LISTBOX 630
#define | DLGOPEN_EDIT 610
#define | DLGOPEN_FILE_LISTBOX 620
#define | DLGOPEN_FOLDOUT 660
#define | DLGOPEN_PATH 640
#define | DLGOPEN_SMALL 680
#define | DLGOPEN_TEXT 650
#define | IDC_ABOUT 107
#define | IDC_BESTFIT 119
#define | IDC_BITMAP1 126
#define | IDC_BITMAP2 131
#define | IDC_BOX1 123
#define | IDC_BOX2 118
#define | IDC_BOX3 124
#define | IDC_BOX4 109
#define | IDC_CAPTIONBARONLY 303
#define | IDC_CLIENTAREAONLY 302
#define | IDC_COPYRIGHT 114
#define | IDC_DIRECTORIES 204
#define | IDC_DIVIDINGLINE 106
#define | IDC_EDITFILE 502
#define | IDC_ENTIRESCREEN 311
#define | IDC_ENTIREWINDOW 301
#define | IDC_FILE 116
#define | IDC_FILETEXT 104
#define | IDC_FOLD 108
#define | IDC_GROUPBOX1 117
#define | IDC_ICONAREA 102
#define | IDC_MENUBARONLY 304
#define | IDC_OPTIONSBUTTON 110
#define | IDC_PARTIALSCREEN 312
#define | IDC_PERCENTAGE 403
#define | IDC_PRINTER 115
#define | IDC_PRINTTEXT1 401
#define | IDC_PRINTTEXT2 402
#define | IDC_SCALE 121
#define | IDC_SELECTPRINTER 105
#define | IDC_SELECTTEXT 101
#define | IDC_SINGLEWINDOW 310
#define | IDC_STATUSBAR 103
#define | IDC_STRETCHTOPAGE 120
#define | IDC_TEXT1 525
#define | IDC_TITLE 125
#define | IDC_TITLE1 129
#define | IDC_TITLE2 128
#define | IDC_VERSION 111
#define | IDC_XAXIS 122
#define | IDC_XTEXT 200
#define | IDC_YAXIS 201
#define | IDC_YTEXT 202
#define | OPENING 100

Define Documentation

#define DLGOPEN_BIG 670

Definition at line 47 of file Dialogs.h.

#define DLGOPEN_DIR_LISTBOX 630

Definition at line 43 of file Dialogs.h.

#define DLGOPEN_EDIT 610

Definition at line 41 of file Dialogs.h.

#define DLGOPEN_FILE_LISTBOX 620

Definition at line 42 of file Dialogs.h.

#define DLGOPEN_FOLDOUT 660

Definition at line 46 of file Dialogs.h.

#define DLGOPEN_PATH 640

Definition at line 44 of file Dialogs.h.

#define DLGOPEN_SMALL 680

Definition at line 48 of file Dialogs.h.

#define DLGOPEN_TEXT 650

Definition at line 45 of file Dialogs.h.

#define IDC_ABOUT 107

Definition at line 37 of file Dialogs.h.

#define IDC_BESTFIT 119

Definition at line 16 of file Dialogs.h.

#define IDC_BITMAP1 126

Definition at line 50 of file Dialogs.h.

#define IDC_BITMAP2 131

Definition at line 51 of file Dialogs.h.

#define IDC_BOX1 123

Definition at line 25 of file Dialogs.h.

#define IDC_BOX2 118

Definition at line 24 of file Dialogs.h.

#define IDC_BOX3 124

Definition at line 26 of file Dialogs.h.

#define IDC_BOX4 109

Definition at line 29 of file Dialogs.h.

#define IDC_CAPTIONBARONLY 303

Definition at line 6 of file Dialogs.h.

#define IDC_CLIENTAREAONLY 302

Definition at line 4 of file Dialogs.h.

#define IDC_COPYRIGHT 114

Definition at line 13 of file Dialogs.h.

#define IDC_DIRECTORIES 204

Definition at line 21 of file Dialogs.h.

#define IDC_DIVIDINGLINE 106

Definition at line 30 of file Dialogs.h.

#define IDC_EDITFILE 502

Definition at line 22 of file Dialogs.h.

#define IDC_ENTIRESCREEN 311

Definition at line 2 of file Dialogs.h.

#define IDC_ENTIREWINDOW 301

Definition at line 5 of file Dialogs.h.

#define IDC_FILE 116

Definition at line 15 of file Dialogs.h.

#define IDC_FILETEXT 104

Definition at line 27 of file Dialogs.h.

#define IDC_FOLD 108

Definition at line 40 of file Dialogs.h.

#define IDC_GROUPBOX1 117

Definition at line 23 of file Dialogs.h.

#define IDC_ICONAREA 102

Definition at line 11 of file Dialogs.h.

#define IDC_MENUBARONLY 304

Definition at line 7 of file Dialogs.h.

#define IDC_OPTIONSBUTTON 110

Definition at line 10 of file Dialogs.h.

#define IDC_PARTIALSCREEN 312

Definition at line 3 of file Dialogs.h.

#define IDC_PERCENTAGE 403

Definition at line 33 of file Dialogs.h.

#define IDC_PRINTER 115

Definition at line 14 of file Dialogs.h.

#define IDC_PRINTTEXT1 401

Definition at line 31 of file Dialogs.h.

#define IDC_PRINTTEXT2 402

Definition at line 32 of file Dialogs.h.

#define IDC_SCALE 121

Definition at line 18 of file Dialogs.h.

#define IDC_SELECTPRINTER 105

Definition at line 28 of file Dialogs.h.

#define IDC_SELECTTEXT 101

Definition at line 1 of file Dialogs.h.

#define IDC_SINGLEWINDOW 310

Definition at line 8 of file Dialogs.h.

#define IDC_STATUSBAR 103

Definition at line 9 of file Dialogs.h.

#define IDC_STRETCHTOPAGE 120

Definition at line 17 of file Dialogs.h.

#define IDC_TEXT1 525

Definition at line 52 of file Dialogs.h.

#define IDC_TITLE 125

Definition at line 34 of file Dialogs.h.

#define IDC_TITLE1 129

Definition at line 36 of file Dialogs.h.

#define IDC_TITLE2 128

Definition at line 35 of file Dialogs.h.

#define IDC_VERSION 111

Definition at line 12 of file Dialogs.h.

#define IDC_XAXIS 122

Definition at line 19 of file Dialogs.h.

#define IDC_XTEXT 200

Definition at line 39 of file Dialogs.h.

#define IDC_YAXIS 201

Definition at line 20 of file Dialogs.h.

#define IDC_YTEXT 202

Definition at line 38 of file Dialogs.h.

#define OPENING 100

Definition at line 53 of file Dialogs.h.

Generated on Wed Nov 13 2024 16:53:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/WinCap32/Dibapi.h File Reference

  • Multimedia
  • Gdi
  • WinCap32
Defines | Enumerations | Functions

Dibapi.h File Reference

Go to the source code of this file.

Defines

#define | HDIB HANDLE
#define | PW_BESTFIT 1
#define | PW_CLIENT 2
#define | PW_SCALE 3
#define | PW_STRETCHTOPAGE 2
#define | PW_WINDOW 1
#define | WIDTHBYTES(bits) (((bits) + 31) / 32 * 4)

Enumerations

enum {
ERR_MIN = 0, ERR_NOT_DIB = 0, ERR_MEMORY, ERR_READ,
ERR_LOCK, ERR_OPEN, ERR_CREATEPAL, ERR_GETDC,
ERR_CREATEDDB, ERR_STRETCHBLT, ERR_STRETCHDIBITS, ERR_SETDIBITSTODEVICE,
ERR_STARTDOC, ERR_NOGDIMODULE, ERR_SETABORTPROC, ERR_STARTPAGE,
ERR_NEWFRAME, ERR_ENDPAGE, ERR_ENDDOC, ERR_SETDIBITS,
ERR_FILENOTFOUND, ERR_INVALIDHANDLE, ERR_DIBFUNCTION, ERR_MAX
}

Functions

HDIB | BitmapToDIB (HBITMAP hBitmap, HPALETTE hPal)
HDIB | ChangeBitmapFormat (HBITMAP hBitmap, WORD wBitCount, DWORD dwCompression, HPALETTE hPal)
HDIB | ChangeDIBFormat (HDIB hDIB, WORD wBitCount, DWORD dwCompression)
HBITMAP | CopyScreenToBitmap (LPRECT)
HDIB | CopyScreenToDIB (LPRECT)
HBITMAP | CopyWindowToBitmap (HWND, WORD)
HDIB | CopyWindowToDIB (HWND, WORD)
HDIB | CreateDIB (DWORD, DWORD, WORD)
HPALETTE | CreateDIBPalette (HDIB)
WORD | DestroyDIB (HDIB)
void | DIBError (int ErrNo)
DWORD | DIBHeight (LPSTR lpDIB)
WORD | DIBNumColors (LPSTR lpDIB)
HBITMAP | DIBToBitmap (HDIB hDIB, HPALETTE hPal)
DWORD | DIBWidth (LPSTR lpDIB)
LPSTR | FindDIBBits (LPSTR lpDIB)
HPALETTE | GetSystemPalette (void)
HDIB | LoadDIB (LPSTR)
BOOL | PaintBitmap (HDC, LPRECT, HBITMAP, LPRECT, HPALETTE)
BOOL | PaintDIB (HDC, LPRECT, HDIB, LPRECT, HPALETTE)
int | PalEntriesOnDevice (HDC hDC)
WORD | PaletteSize (LPSTR lpDIB)
WORD | PrintDIB (HDIB, WORD, WORD, WORD, LPSTR)
WORD | PrintScreen (LPRECT, WORD, WORD, WORD, LPSTR)
WORD | PrintWindowSamp (HWND, WORD, WORD, WORD, WORD, LPSTR)
WORD | SaveDIB (HDIB, LPSTR)

Define Documentation

#define HDIB HANDLE

Definition at line 46 of file Dibapi.h.

#define PW_BESTFIT 1

Definition at line 55 of file Dibapi.h.

#define PW_CLIENT 2

Definition at line 51 of file Dibapi.h.

#define PW_SCALE 3

Definition at line 57 of file Dibapi.h.

#define PW_STRETCHTOPAGE 2

Definition at line 56 of file Dibapi.h.

#define PW_WINDOW 1

Definition at line 50 of file Dibapi.h.

#define WIDTHBYTES ( bits ) (((bits) + 31) / 32 * 4)

Definition at line 66 of file Dibapi.h.

Enumeration Type Documentation

anonymous enum
Enumerator:
ERR_MIN
ERR_NOT_DIB
ERR_MEMORY
ERR_READ
ERR_LOCK
ERR_OPEN
ERR_CREATEPAL
ERR_GETDC
ERR_CREATEDDB
ERR_STRETCHBLT
ERR_STRETCHDIBITS
ERR_SETDIBITSTODEVICE
ERR_STARTDOC
ERR_NOGDIMODULE
ERR_SETABORTPROC
ERR_STARTPAGE
ERR_NEWFRAME
ERR_ENDPAGE
ERR_ENDDOC
ERR_SETDIBITS
ERR_FILENOTFOUND
ERR_INVALIDHANDLE
ERR_DIBFUNCTION
ERR_MAX

Definition at line 69 of file Dibapi.h.

     {
      ERR_MIN = 0,                     // All error #s >= this value
      ERR_NOT_DIB = 0,                 // Tried to load a file, NOT a DIB!
      ERR_MEMORY,                      // Not enough memory!
      ERR_READ,                        // Error reading file!
      ERR_LOCK,                        // Error on a GlobalLock()!
      ERR_OPEN,                        // Error opening a file!
      ERR_CREATEPAL,                   // Error creating palette.
      ERR_GETDC,                       // Couldn't get a DC.
      ERR_CREATEDDB,                   // Error create a DDB.
      ERR_STRETCHBLT,                  // StretchBlt() returned failure.
      ERR_STRETCHDIBITS,               // StretchDIBits() returned failure.
      ERR_SETDIBITSTODEVICE,           // SetDIBitsToDevice() failed.
      ERR_STARTDOC,                    // Error calling StartDoc().
      ERR_NOGDIMODULE,                 // Couldn't find GDI module in memory.
      ERR_SETABORTPROC,                // Error calling SetAbortProc().
      ERR_STARTPAGE,                   // Error calling StartPage().
      ERR_NEWFRAME,                    // Error calling NEWFRAME escape.
      ERR_ENDPAGE,                     // Error calling EndPage().
      ERR_ENDDOC,                      // Error calling EndDoc().
      ERR_SETDIBITS,                   // Error calling SetDIBits().
      ERR_FILENOTFOUND,                // Error opening file in GetDib()
      ERR_INVALIDHANDLE,               // Invalid Handle
      ERR_DIBFUNCTION,                 // Error on call to DIB function
      ERR_MAX                          // All error #s < this value
     };

Function Documentation

HDIB BitmapToDIB | ( | HBITMAP | hBitmap,
 |  | HPALETTE | hPal
 | ) |  |

use our bitmap info. to fill BITMAPINFOHEADER

Definition at line 605 of file Dibutil.c.

{
    BITMAP              bm;         // bitmap structure
    BITMAPINFOHEADER    bi;         // bitmap header
    LPBITMAPINFOHEADER  lpbi;       // pointer to BITMAPINFOHEADER
    DWORD               dwLen;      // size of memory block
    HANDLE              hDIB, h;    // handle to DIB, temp handle
    HDC                 hDC;        // handle to DC
    WORD                biBits;     // bits per pixel

    // check if bitmap handle is valid

    if (!hBitmap)
        return NULL;

    // fill in BITMAP structure, return NULL if it didn't work

    if (!GetObject(hBitmap, sizeof(bm), (LPSTR)&bm))
        return NULL;

    // if no palette is specified, use default palette

    if (hPal == NULL)
        hPal = GetStockObject(DEFAULT_PALETTE);

    // calculate bits per pixel

    biBits = bm.bmPlanes * bm.bmBitsPixel;

    // make sure bits per pixel is valid

    if (biBits <= 1)
        biBits = 1;
    else if (biBits <= 4)
        biBits = 4;
    else if (biBits <= 8)
        biBits = 8;
    else // if greater than 8-bit, force to 24-bit
        biBits = 24;

    // initialize BITMAPINFOHEADER

    bi.biSize = sizeof(BITMAPINFOHEADER);
    bi.biWidth = bm.bmWidth;
    bi.biHeight = bm.bmHeight;
    bi.biPlanes = 1;
    bi.biBitCount = biBits;
    bi.biCompression = BI_RGB;
    bi.biSizeImage = 0;
    bi.biXPelsPerMeter = 0;
    bi.biYPelsPerMeter = 0;
    bi.biClrUsed = 0;
    bi.biClrImportant = 0;

    // calculate size of memory block required to store BITMAPINFO

    dwLen = bi.biSize + PaletteSize((LPSTR)&bi);

    // get a DC

    hDC = GetDC(NULL);

    // select and realize our palette

    hPal = SelectPalette(hDC, hPal, FALSE);
    RealizePalette(hDC);

    // alloc memory block to store our bitmap

    hDIB = GlobalAlloc(GHND, dwLen);

    // if we couldn't get memory block

    if (!hDIB)
    {
      // clean up and return NULL

      SelectPalette(hDC, hPal, TRUE);
      RealizePalette(hDC);
      ReleaseDC(NULL, hDC);
      return NULL;
    }

    // lock memory and get pointer to it

    lpbi = (LPBITMAPINFOHEADER)GlobalLock(hDIB);

    /// use our bitmap info. to fill BITMAPINFOHEADER

    *lpbi = bi;

    // call GetDIBits with a NULL lpBits param, so it will calculate the
    // biSizeImage field for us

    GetDIBits(hDC, hBitmap, 0, (UINT)bi.biHeight, NULL, (LPBITMAPINFO)lpbi,
        DIB_RGB_COLORS);

    // get the info. returned by GetDIBits and unlock memory block

    bi = *lpbi;
    GlobalUnlock(hDIB);

    // if the driver did not fill in the biSizeImage field, make one up
    if (bi.biSizeImage == 0)
        bi.biSizeImage = WIDTHBYTES((DWORD)bm.bmWidth * biBits) * bm.bmHeight;

    // realloc the buffer big enough to hold all the bits

    dwLen = bi.biSize + PaletteSize((LPSTR)&bi) + bi.biSizeImage;

    if (h = GlobalReAlloc(hDIB, dwLen, 0))
        hDIB = h;
    else
    {
        // clean up and return NULL

        GlobalFree(hDIB);
        hDIB = NULL;
        SelectPalette(hDC, hPal, TRUE);
        RealizePalette(hDC);
        ReleaseDC(NULL, hDC);
        return NULL;
    }

    // lock memory block and get pointer to it */

    lpbi = (LPBITMAPINFOHEADER)GlobalLock(hDIB);

    // call GetDIBits with a NON-NULL lpBits param, and actualy get the
    // bits this time

    if (GetDIBits(hDC, hBitmap, 0, (UINT)bi.biHeight, (LPSTR)lpbi +
            (WORD)lpbi->biSize + PaletteSize((LPSTR)lpbi), (LPBITMAPINFO)lpbi,
            DIB_RGB_COLORS) == 0)
    {
        // clean up and return NULL

        GlobalUnlock(hDIB);
        hDIB = NULL;
        SelectPalette(hDC, hPal, TRUE);
        RealizePalette(hDC);
        ReleaseDC(NULL, hDC);
        return NULL;
    }

    bi = *lpbi;

    // clean up
    GlobalUnlock(hDIB);
    SelectPalette(hDC, hPal, TRUE);
    RealizePalette(hDC);
    ReleaseDC(NULL, hDC);

    // return handle to the DIB
    return hDIB;
}

HDIB ChangeBitmapFormat | ( | HBITMAP | hBitmap,
 |  | WORD | wBitCount,
 |  | DWORD | dwCompression,
 |  | HPALETTE | hPal
 | ) |  |

Definition at line 1155 of file Dibutil.c.

{
    HDC                hDC;          // Screen DC
    HDIB               hNewDIB=NULL; // Handle to new DIB
    BITMAP             Bitmap;       // BITMAP data structure
    BITMAPINFOHEADER   bi;           // Bitmap info. header
    LPBITMAPINFOHEADER lpbi;         // Pointer to bitmap header
    HPALETTE           hOldPal=NULL; // Handle to palette
    WORD               NewBPP;       // New bits per pixel
    DWORD              NewComp;      // New compression format

    // Check for a valid bitmap handle

    if (!hBitmap)
        return NULL;

    // Validate wBitCount and dwCompression
    // They must match correctly (i.e., BI_RLE4 and 4 BPP or
    // BI_RLE8 and 8BPP, etc.) or we return failure

    if (wBitCount == 0)
    {
        NewComp = dwCompression;
        if (NewComp == BI_RLE4)
            NewBPP = 4;
        else if (NewComp == BI_RLE8)
            NewBPP = 8;
        else // Not enough info */
            return NULL;
    }
    else if (wBitCount == 1 && dwCompression == BI_RGB)
    {
        NewBPP = wBitCount;
        NewComp = BI_RGB;
    }
    else if (wBitCount == 4)
    {
        NewBPP = wBitCount;
        if (dwCompression == BI_RGB || dwCompression == BI_RLE4)
            NewComp = dwCompression;
        else
            return NULL;
    }
    else if (wBitCount == 8)
    {
        NewBPP = wBitCount;
        if (dwCompression == BI_RGB || dwCompression == BI_RLE8)
            NewComp = dwCompression;
        else
            return NULL;
    }
    else if (wBitCount == 24 && dwCompression == BI_RGB)
    {
        NewBPP = wBitCount;
        NewComp = BI_RGB;
    }
    else
        return NULL;

    // Get info about the bitmap

    GetObject(hBitmap, sizeof(BITMAP), (LPSTR)&Bitmap);

    // Fill in the BITMAPINFOHEADER appropriately

    bi.biSize               = sizeof(BITMAPINFOHEADER);
    bi.biWidth              = Bitmap.bmWidth;
    bi.biHeight             = Bitmap.bmHeight;
    bi.biPlanes             = 1;
    bi.biBitCount           = NewBPP;
    bi.biCompression        = NewComp;
    bi.biSizeImage          = 0;
    bi.biXPelsPerMeter      = 0;
    bi.biYPelsPerMeter      = 0;
    bi.biClrUsed            = 0;
    bi.biClrImportant       = 0;

    // Go allocate room for the new DIB

    hNewDIB = AllocRoomForDIB(bi, hBitmap);
    if (!hNewDIB)
        return NULL;

    // Get a pointer to the new DIB

    lpbi = (LPBITMAPINFOHEADER)GlobalLock(hNewDIB);

    hDC = GetDC(NULL);

    // If we have a palette, select/realize it

    if (hPal)
    {
        hOldPal = SelectPalette(hDC, hPal, FALSE);
        RealizePalette(hDC);
    }

    // Call GetDIBits and get the new DIB bits

    if (!GetDIBits(hDC, hBitmap, 0, (UINT) lpbi->biHeight, (LPSTR)lpbi +
            (WORD)lpbi->biSize + PaletteSize((LPSTR)lpbi), (LPBITMAPINFO)lpbi,
            DIB_RGB_COLORS))
    {
        GlobalUnlock(hNewDIB);
        GlobalFree(hNewDIB);
        hNewDIB = NULL;
    }

    // Clean up and return

    if (hOldPal)
    {
        SelectPalette(hDC, hOldPal, TRUE);
        RealizePalette(hDC);
        ReleaseDC(NULL, hDC);
    }

    // Unlock the new DIB's memory block

    if (hNewDIB)
        GlobalUnlock(hNewDIB);

    return hNewDIB;
}

HDIB ChangeDIBFormat | ( | HDIB | hDIB,
 |  | WORD | wBitCount,
 |  | DWORD | dwCompression
 | ) |  |

Definition at line 987 of file Dibutil.c.

{
    HDC                hDC;             // Handle to DC
    HBITMAP            hBitmap;         // Handle to bitmap
    BITMAP             Bitmap;          // BITMAP data structure
    BITMAPINFOHEADER   bi;              // Bitmap info header
    LPBITMAPINFOHEADER lpbi;            // Pointer to bitmap info
    HDIB               hNewDIB = NULL;  // Handle to new DIB
    HPALETTE           hPal, hOldPal;   // Handle to palette, prev pal
    WORD               DIBBPP, NewBPP;  // DIB bits per pixel, new bpp
    DWORD              DIBComp, NewComp;// DIB compression, new compression

    // Check for a valid DIB handle

    if (!hDIB)
        return NULL;

    // Get the old DIB's bits per pixel and compression format

    lpbi = (LPBITMAPINFOHEADER)GlobalLock(hDIB);
    DIBBPP = ((LPBITMAPINFOHEADER)lpbi)->biBitCount;
    DIBComp = ((LPBITMAPINFOHEADER)lpbi)->biCompression;
    GlobalUnlock(hDIB);

    // Validate wBitCount and dwCompression
    // They must match correctly (i.e., BI_RLE4 and 4 BPP or
    // BI_RLE8 and 8BPP, etc.) or we return failure
    if (wBitCount == 0)
    {
        NewBPP = DIBBPP;
        if ((dwCompression == BI_RLE4 && NewBPP == 4) ||
                (dwCompression == BI_RLE8 && NewBPP == 8) ||
                (dwCompression == BI_RGB))
            NewComp = dwCompression;
        else
            return NULL;
    }
    else if (wBitCount == 1 && dwCompression == BI_RGB)
    {
        NewBPP = wBitCount;
        NewComp = BI_RGB;
    }
    else if (wBitCount == 4)
    {
        NewBPP = wBitCount;
        if (dwCompression == BI_RGB || dwCompression == BI_RLE4)
            NewComp = dwCompression;
        else
            return NULL;
    }
    else if (wBitCount == 8)
    {
        NewBPP = wBitCount;
        if (dwCompression == BI_RGB || dwCompression == BI_RLE8)
            NewComp = dwCompression;
        else
            return NULL;
    }
    else if (wBitCount == 24 && dwCompression == BI_RGB)
    {
        NewBPP = wBitCount;
        NewComp = BI_RGB;
    }
    else
        return NULL;

    // Save the old DIB's palette

    hPal = CreateDIBPalette(hDIB);
    if (!hPal)
        return NULL;

    // Convert old DIB to a bitmap

    hBitmap = DIBToBitmap(hDIB, hPal);
    if (!hBitmap)
    {
        DeleteObject(hPal);
        return NULL;
    }

    // Get info about the bitmap
    GetObject(hBitmap, sizeof(BITMAP), (LPSTR)&Bitmap);

    // Fill in the BITMAPINFOHEADER appropriately

    bi.biSize               = sizeof(BITMAPINFOHEADER);
    bi.biWidth              = Bitmap.bmWidth;
    bi.biHeight             = Bitmap.bmHeight;
    bi.biPlanes             = 1;
    bi.biBitCount           = NewBPP;
    bi.biCompression        = NewComp;
    bi.biSizeImage          = 0;
    bi.biXPelsPerMeter      = 0;
    bi.biYPelsPerMeter      = 0;
    bi.biClrUsed            = 0;
    bi.biClrImportant       = 0;

    // Go allocate room for the new DIB

    hNewDIB = AllocRoomForDIB(bi, hBitmap);
    if (!hNewDIB)
        return NULL;

    // Get a pointer to the new DIB

    lpbi = (LPBITMAPINFOHEADER)GlobalLock(hNewDIB);

    // Get a DC and select/realize our palette in it

    hDC  = GetDC(NULL);
    hOldPal = SelectPalette(hDC, hPal, FALSE);
    RealizePalette(hDC);

    // Call GetDIBits and get the new DIB bits

    if (!GetDIBits(hDC, hBitmap, 0, (UINT) lpbi->biHeight,
            (LPSTR)lpbi + (WORD)lpbi->biSize + PaletteSize((LPSTR)lpbi),
            (LPBITMAPINFO)lpbi, DIB_RGB_COLORS))
    {
        GlobalUnlock(hNewDIB);
        GlobalFree(hNewDIB);
        hNewDIB = NULL;
    }

    // Clean up and return

    SelectPalette(hDC, hOldPal, TRUE);
    RealizePalette(hDC);
    ReleaseDC(NULL, hDC);

    // Unlock the new DIB's memory block
    if (hNewDIB)
        GlobalUnlock(hNewDIB);

    DeleteObject(hBitmap);
    DeleteObject(hPal);

    return hNewDIB;
}

HBITMAP CopyScreenToBitmap ( LPRECT )

Definition at line 288 of file Copy.c.

{
    HDC         hScrDC, hMemDC;         // screen DC and memory DC
    HBITMAP     hBitmap, hOldBitmap;    // handles to deice-dependent bitmaps
    int         nX, nY, nX2, nY2;       // coordinates of rectangle to grab
    int         nWidth, nHeight;        // DIB width and height
    int         xScrn, yScrn;           // screen resolution

    // check for an empty rectangle

    if (IsRectEmpty(lpRect))
      return NULL;

    // create a DC for the screen and create
    // a memory DC compatible to screen DC

    hScrDC = CreateDC("DISPLAY", NULL, NULL, NULL);
    hMemDC = CreateCompatibleDC(hScrDC);

    // get points of rectangle to grab

    nX = lpRect->left;
    nY = lpRect->top;
    nX2 = lpRect->right;
    nY2 = lpRect->bottom;

    // get screen resolution

    xScrn = GetDeviceCaps(hScrDC, HORZRES);
    yScrn = GetDeviceCaps(hScrDC, VERTRES);

    //make sure bitmap rectangle is visible

    if (nX < 0)
        nX = 0;
    if (nY < 0)
        nY = 0;
    if (nX2 > xScrn)
        nX2 = xScrn;
    if (nY2 > yScrn)
        nY2 = yScrn;

    nWidth = nX2 - nX;
    nHeight = nY2 - nY;

    // create a bitmap compatible with the screen DC
    hBitmap = CreateCompatibleBitmap(hScrDC, nWidth, nHeight);

    // select new bitmap into memory DC
    hOldBitmap = (HBITMAP) SelectObject(hMemDC, hBitmap);

    // bitblt screen DC to memory DC
    BitBlt(hMemDC, 0, 0, nWidth, nHeight, hScrDC, nX, nY, SRCCOPY);

    // select old bitmap back into memory DC and get handle to
    // bitmap of the screen

    hBitmap = (HBITMAP)  SelectObject(hMemDC, hOldBitmap);

    // clean up

    DeleteDC(hScrDC);
    DeleteDC(hMemDC);

    // return handle to the bitmap

    return hBitmap;
}

HDIB CopyScreenToDIB ( LPRECT )

Definition at line 141 of file Copy.c.

{
    HBITMAP     hBitmap;        // handle to device-dependent bitmap
    HPALETTE    hPalette;       // handle to palette
    HDIB        hDIB = NULL;    // handle to DIB

    // get the device-dependent bitmap in lpRect by calling
    //  CopyScreenToBitmap and passing it the rectangle to grab

  // Check for a valid rect
  if (!lpRect)
    return NULL;

    hBitmap = CopyScreenToBitmap(lpRect);

    // check for a valid bitmap handle

    if (!hBitmap)
      return NULL;

    // get the current palette

    hPalette = GetSystemPalette();

    // convert the bitmap to a DIB

    hDIB = BitmapToDIB(hBitmap, hPalette);

    // clean up

    DeleteObject(hPalette);
    DeleteObject(hBitmap);

    // return handle to the packed-DIB
    return hDIB;
}

HBITMAP CopyWindowToBitmap | ( | HWND | ,
 |  | WORD |
 | ) |  |

Definition at line 202 of file Copy.c.

{
    HBITMAP     hBitmap = NULL;  // handle to device-dependent bitmap

    // check for a valid window handle

    if (!hWnd)
        return NULL;

    switch (fPrintArea)
    {
        case PW_WINDOW: // copy entire window
        {
            RECT    rectWnd;

            // get the window rectangle

            GetWindowRect(hWnd, &rectWnd);

            // get the bitmap of that window by calling
            // CopyScreenToBitmap and passing it the window rect

            hBitmap = CopyScreenToBitmap(&rectWnd);
            break;
        }

        case PW_CLIENT: // copy client area
        {
            RECT rectClient;
            POINT pt1, pt2;

            // get client dimensions

            GetClientRect(hWnd, &rectClient);

            // convert client coords to screen coords

            pt1.x = rectClient.left;
            pt1.y = rectClient.top;
            pt2.x = rectClient.right;
            pt2.y = rectClient.bottom;
            ClientToScreen(hWnd, &pt1);
            ClientToScreen(hWnd, &pt2);
            rectClient.left = pt1.x;
            rectClient.top = pt1.y;
            rectClient.right = pt2.x;
            rectClient.bottom = pt2.y;

            // get the bitmap of the client area by calling
            // CopyScreenToBitmap and passing it the client rect

            hBitmap = CopyScreenToBitmap(&rectClient);
            break;
        }

        default:    // invalid print area
            return NULL;
    }

    // return handle to the bitmap

   return hBitmap;
}

HDIB CopyWindowToDIB | ( | HWND | ,
 |  | WORD |
 | ) |  |

Definition at line 57 of file Copy.c.

{
   HDIB     hDIB = NULL;  // handle to DIB

   // check for a valid window handle

    if (!hWnd)
        return NULL;

    switch (fPrintArea)
    {
        case PW_WINDOW: // copy entire window
        {
            RECT    rectWnd;

            // get the window rectangle

            GetWindowRect(hWnd, &rectWnd);

            // get the DIB of the window by calling
            // CopyScreenToDIB and passing it the window rect

            hDIB = CopyScreenToDIB(&rectWnd);
            break;
        }

        case PW_CLIENT: // copy client area
        {
            RECT    rectClient;
            POINT   pt1, pt2;

            // get the client area dimensions

            GetClientRect(hWnd, &rectClient);

            // convert client coords to screen coords

            pt1.x = rectClient.left;
            pt1.y = rectClient.top;
            pt2.x = rectClient.right;
            pt2.y = rectClient.bottom;
            ClientToScreen(hWnd, &pt1);
            ClientToScreen(hWnd, &pt2);
            rectClient.left = pt1.x;
            rectClient.top = pt1.y;
            rectClient.right = pt2.x;
            rectClient.bottom = pt2.y;

            // get the DIB of the client area by calling
            // CopyScreenToDIB and passing it the client rect

            hDIB = CopyScreenToDIB(&rectClient);
            break;
        }

        default:    // invalid print area
            return NULL;
    }

   // return the handle to the DIB

   return hDIB;
}

HDIB CreateDIB | ( | DWORD | ,
 |  | DWORD | ,
 |  | WORD |
 | ) |  |

Definition at line 66 of file Dibutil.c.

{
    BITMAPINFOHEADER    bi;             // bitmap header
    LPBITMAPINFOHEADER  lpbi;           // pointer to BITMAPINFOHEADER
    DWORD               dwLen;          // size of memory block
    HDIB                hDIB;
    DWORD               dwBytesPerLine; // Number of bytes per scanline

    // Make sure bits per pixel is valid

    if (wBitCount <= 1)
        wBitCount = 1;
    else if (wBitCount <= 4)
        wBitCount = 4;
    else if (wBitCount <= 8)
        wBitCount = 8;
    else if (wBitCount <= 24)
        wBitCount = 24;
  else if (wBitCount <= 32)
    wBitCount = 32;
    else
        wBitCount = 4;  // set default value to 4 if parameter is bogus

    // initialize BITMAPINFOHEADER

    bi.biSize = sizeof(BITMAPINFOHEADER);
    bi.biWidth = dwWidth;         // fill in width from parameter
    bi.biHeight = dwHeight;       // fill in height from parameter
    bi.biPlanes = 1;              // must be 1
    bi.biBitCount = wBitCount;    // from parameter
    bi.biCompression = BI_RGB;
    bi.biSizeImage = 0;           // 0's here mean "default"
    bi.biXPelsPerMeter = 0;
    bi.biYPelsPerMeter = 0;
    bi.biClrUsed = 0;
    bi.biClrImportant = 0;

    // calculate size of memory block required to store the DIB.  This
    // block should be big enough to hold the BITMAPINFOHEADER, the color
    // table, and the bits

    dwBytesPerLine = WIDTHBYTES(wBitCount * dwWidth);
    dwLen = bi.biSize + PaletteSize((LPSTR)&bi) + (dwBytesPerLine * dwHeight);

    // alloc memory block to store our bitmap

    hDIB = GlobalAlloc(GHND, dwLen);

    // major bummer if we couldn't get memory block

    if (!hDIB)
        return NULL;

    // lock memory and get pointer to it

    lpbi = (LPBITMAPINFOHEADER)GlobalLock(hDIB);

    // use our bitmap info structure to fill in first part of
    // our DIB with the BITMAPINFOHEADER

    *lpbi = bi;

    // Since we don't know what the colortable and bits should contain,
    // just leave these blank.  Unlock the DIB and return the HDIB.

    GlobalUnlock(hDIB);

    //return handle to the DIB

    return hDIB;
}

HPALETTE CreateDIBPalette ( HDIB )

Definition at line 377 of file Dibutil.c.

{
    LPLOGPALETTE        lpPal;          // pointer to a logical palette
    HANDLE              hLogPal;        // handle to a logical palette
    HPALETTE            hPal = NULL;    // handle to a palette
    int                 i, wNumColors;  // loop index, number of colors in color table
    LPSTR               lpbi;           // pointer to packed-DIB
    LPBITMAPINFO        lpbmi;          // pointer to BITMAPINFO structure (Win3.0)
    LPBITMAPCOREINFO    lpbmc;          // pointer to BITMAPCOREINFO structure (OS/2)
    BOOL                bWinStyleDIB;   // Win3.0 DIB?

    // if handle to DIB is invalid, return NULL

    if (!hDIB)
        return NULL;

    // lock DIB memory block and get a pointer to it

    lpbi = GlobalLock(hDIB);

    // get pointer to BITMAPINFO (Win 3.0)

    lpbmi = (LPBITMAPINFO)lpbi;

    // get pointer to BITMAPCOREINFO (OS/2 1.x)

    lpbmc = (LPBITMAPCOREINFO)lpbi;

    // get the number of colors in the DIB

    wNumColors = DIBNumColors(lpbi);

    // is this a Win 3.0 DIB?

    bWinStyleDIB = IS_WIN30_DIB(lpbi);
    if (wNumColors)
    {
        // allocate memory block for logical palette

        hLogPal = GlobalAlloc(GHND, sizeof(LOGPALETTE) +
                sizeof(PALETTEENTRY) * wNumColors);

        // if not enough memory, clean up and return NULL

        if (!hLogPal)
        {
            GlobalUnlock(hDIB);
            return NULL;
        }

        // lock memory block and get pointer to it

        lpPal = (LPLOGPALETTE)GlobalLock(hLogPal);

        // set version and number of palette entries

        lpPal->palVersion = PALVERSION;
        lpPal->palNumEntries = (WORD) wNumColors;

        // store RGB triples (if Win 3.0 DIB) or RGB quads (if OS/2 DIB)
        // into palette

        for (i = 0; i < wNumColors; i++)
        {
            if (bWinStyleDIB)
            {
                lpPal->palPalEntry[i].peRed = lpbmi->bmiColors[i].rgbRed;
                lpPal->palPalEntry[i].peGreen = lpbmi->bmiColors[i].rgbGreen;
                lpPal->palPalEntry[i].peBlue = lpbmi->bmiColors[i].rgbBlue;
                lpPal->palPalEntry[i].peFlags = 0;
            }
            else
            {
                lpPal->palPalEntry[i].peRed = lpbmc->bmciColors[i].rgbtRed;
                lpPal->palPalEntry[i].peGreen = lpbmc->bmciColors[i].rgbtGreen;
                lpPal->palPalEntry[i].peBlue = lpbmc->bmciColors[i].rgbtBlue;
                lpPal->palPalEntry[i].peFlags = 0;
            }
        }

        // create the palette and get handle to it

        hPal = CreatePalette(lpPal);

        // if error getting handle to palette, clean up and return NULL

        if (!hPal)
        {
            GlobalUnlock(hLogPal);
            GlobalFree(hLogPal);
            return NULL;
        }
    }

    // clean up

    GlobalUnlock(hLogPal);
    GlobalFree(hLogPal);
    GlobalUnlock(hDIB);

    // return handle to DIB's palette
    return hPal;
}

WORD DestroyDIB ( HDIB )

Definition at line 262 of file File.c.

{
    GlobalFree(hDib);
    return 0;
}

void DIBError ( int ErrNo )

Definition at line 70 of file Errors.c.

{
    if (nLangID == LANG_JAPANESE) {
        if ((ErrNo < ERR_MIN) || (ErrNo >= ERR_MAX))
            MessageBox(NULL, "–¢’m‚ÌƒGƒ‰[B", NULL, MB_OK | MB_ICONHAND);
        else
            MessageBox(NULL, szErrorsJ[ErrNo], NULL, MB_OK | MB_ICONHAND);
    }
    else {
        if ((ErrNo < ERR_MIN) || (ErrNo >= ERR_MAX))
            MessageBox(NULL, "Undefined Error!", NULL, MB_OK | MB_ICONHAND);
        else
            MessageBox(NULL, szErrors[ErrNo], NULL, MB_OK | MB_ICONHAND);
    }
}

DWORD DIBHeight ( LPSTR lpDIB )

Definition at line 228 of file Dibutil.c.

{
   LPBITMAPINFOHEADER   lpbmi;  // pointer to a Win 3.0-style DIB
   LPBITMAPCOREHEADER   lpbmc;  // pointer to an OS/2-style DIB

   if (!lpDIB)
     return 0;

   // point to the header (whether OS/2 or Win 3.0

   lpbmi = (LPBITMAPINFOHEADER)lpDIB;
   lpbmc = (LPBITMAPCOREHEADER)lpDIB;

    // return the DIB height if it is a Win 3.0 DIB
    if (lpbmi->biSize == sizeof(BITMAPINFOHEADER))
        return lpbmi->biHeight;
    else  // it is an OS/2 DIB, so return its height
        return (DWORD)lpbmc->bcHeight;
}

WORD DIBNumColors ( LPSTR lpDIB )

Definition at line 304 of file Dibutil.c.

{
    WORD wBitCount;  // DIB bit count

  if (!lpDIB)
    return (WORD) 0;

    // If this is a Windows-style DIB, the number of colors in the
    // color table can be less than the number of bits per pixel
    // allows for (i.e. lpbi->biClrUsed can be set to some value).
    // If this is the case, return the appropriate value.

    if (IS_WIN30_DIB(lpDIB))
    {
        DWORD dwClrUsed;

        dwClrUsed = ((LPBITMAPINFOHEADER)lpDIB)->biClrUsed;
        if (dwClrUsed)

        return (WORD)dwClrUsed;
    }

    // Calculate the number of colors in the color table based on
    // the number of bits per pixel for the DIB.

    if (IS_WIN30_DIB(lpDIB))
        wBitCount = ((LPBITMAPINFOHEADER)lpDIB)->biBitCount;
    else
        wBitCount = ((LPBITMAPCOREHEADER)lpDIB)->bcBitCount;

    // return number of colors based on bits per pixel

    switch (wBitCount)
    {
        case 1:
            return 2;

        case 4:
            return 16;

        case 8:
            return 256;

        default:
            return 0;
    }
}

HBITMAP DIBToBitmap | ( | HDIB | hDIB,
 |  | HPALETTE | hPal
 | ) |  |

Definition at line 524 of file Dibutil.c.

{
    LPSTR       lpDIBHdr, lpDIBBits;  // pointer to DIB header, pointer to DIB bits
    HBITMAP     hBitmap;            // handle to device-dependent bitmap
    HDC         hDC;                    // handle to DC
    HPALETTE    hOldPal = NULL;    // handle to a palette

    // if invalid handle, return NULL

    if (!hDIB)
        return NULL;

    // lock memory block and get a pointer to it

    lpDIBHdr = GlobalLock(hDIB);

    // get a pointer to the DIB bits

    lpDIBBits = FindDIBBits(lpDIBHdr);

  if (!lpDIBBits)
  {
     GlobalUnlock(hDIB);
        return NULL;
    }

    // get a DC

    hDC = GetDC(NULL);
    if (!hDC)
    {
        // clean up and return NULL

        GlobalUnlock(hDIB);
        return NULL;
    }

    // select and realize palette

    if (hPal)
        hOldPal = SelectPalette(hDC, hPal, FALSE);

    RealizePalette(hDC);

    // create bitmap from DIB info. and bits
    hBitmap = CreateDIBitmap(hDC, (LPBITMAPINFOHEADER)lpDIBHdr, CBM_INIT,
            lpDIBBits, (LPBITMAPINFO)lpDIBHdr, DIB_RGB_COLORS);

    // restore previous palette
    if (hOldPal)
        SelectPalette(hDC, hOldPal, FALSE);

    // clean up
    ReleaseDC(NULL, hDC);
    GlobalUnlock(hDIB);

    // return handle to the bitmap
    return hBitmap;
}

DWORD DIBWidth ( LPSTR lpDIB )

Definition at line 186 of file Dibutil.c.

{
    LPBITMAPINFOHEADER   lpbmi;  // pointer to a Win 3.0-style DIB
    LPBITMAPCOREHEADER   lpbmc;  // pointer to an OS/2-style DIB

  if (!lpDIB)
    return 0;

    // point to the header (whether Win 3.0 and OS/2)

    lpbmi = (LPBITMAPINFOHEADER)lpDIB;
    lpbmc = (LPBITMAPCOREHEADER)lpDIB;

    // return the DIB width if it is a Win 3.0 DIB

    if (lpbmi->biSize == sizeof(BITMAPINFOHEADER))
        return lpbmi->biWidth;
    else  // it is an OS/2 DIB, so return its width
        return (DWORD)lpbmc->bcWidth;
}

LPSTR FindDIBBits ( LPSTR lpDIB )

Definition at line 159 of file Dibutil.c.

{
  return (lpDIB != NULL ? (lpDIB + *(LPDWORD)lpDIB + PaletteSize(lpDIB)) :  NULL );
}

HPALETTE GetSystemPalette ( void )

Definition at line 814 of file Dibutil.c.

{
    HDC hDC;                // handle to a DC
    static HPALETTE hPal = NULL;   // handle to a palette
    HANDLE hLogPal;         // handle to a logical palette
    LPLOGPALETTE lpLogPal;  // pointer to a logical palette
    int nColors;            // number of colors

    // Find out how many palette entries we want.

    hDC = GetDC(NULL);

    if (!hDC)
        return NULL;

    nColors = PalEntriesOnDevice(hDC);   // Number of palette entries

    // Allocate room for the palette and lock it.

    hLogPal = GlobalAlloc(GHND, sizeof(LOGPALETTE) + nColors *
            sizeof(PALETTEENTRY));

    // if we didn't get a logical palette, return NULL

    if (!hLogPal)
        return NULL;

    // get a pointer to the logical palette

    lpLogPal = (LPLOGPALETTE)GlobalLock(hLogPal);

    // set some important fields

    lpLogPal->palVersion = PALVERSION;
    lpLogPal->palNumEntries = (WORD) nColors;

    // Copy the current system palette into our logical palette

    GetSystemPaletteEntries(hDC, 0, nColors,
            (LPPALETTEENTRY)(lpLogPal->palPalEntry));

    // Go ahead and create the palette.  Once it's created,
    // we no longer need the LOGPALETTE, so free it.

    hPal = CreatePalette(lpLogPal);

    // clean up

    GlobalUnlock(hLogPal);
    GlobalFree(hLogPal);
    ReleaseDC(NULL, hDC);

    return hPal;
}

HDIB LoadDIB ( LPSTR )

Definition at line 64 of file File.c.

{
    HDIB        hDIB;
    HANDLE      hFile;

  if (!lpFileName)
    return NULL;

    // Set the cursor to a hourglass, in case the loading operation
    // takes more than a sec, the user will know what's going on.

    SetCursor(LoadCursor(NULL, IDC_WAIT));

  // Create File with security related attributes
    hFile = CreateFile(lpFileName, GENERIC_READ, FILE_SHARE_READ, NULL,
            OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN | SECURITY_ANONYMOUS | SECURITY_SQOS_PRESENT, /* security level checks */
            NULL);

  if (INVALID_HANDLE_VALUE == hFile)    //Unable to open File, quit load
    return NULL;

  if ( GetFileType(hFile) != FILE_TYPE_DISK )
  {
    CloseHandle(hFile);
        DIBError(ERR_FILENOTFOUND);
        SetCursor(LoadCursor(NULL, IDC_ARROW));
        return NULL;
    }
    else
  {
        hDIB = ReadDIBFile(hFile);
        CloseHandle(hFile);
        SetCursor(LoadCursor(NULL, IDC_ARROW));
        return hDIB;
    }

}

BOOL PaintBitmap | ( | HDC | ,
 |  | LPRECT | ,
 |  | HBITMAP | ,
 |  | LPRECT | ,
 |  | HPALETTE |
 | ) |  |

Definition at line 487 of file Copy.c.

{
    HDC         hMemDC;            // Handle to memory DC
    HBITMAP     hOldBitmap;        // Handle to previous bitmap
    HPALETTE    hOldPal1 = NULL;   // Handle to previous palette
    HPALETTE    hOldPal2 = NULL;   // Handle to previous palette
    BOOL        bSuccess = FALSE;  // Success/fail flag

    // Create a memory DC

    hMemDC = CreateCompatibleDC (hDC);

    // If this failed, return FALSE

    if (!hMemDC)
        return FALSE;

    // If we have a palette, select and realize it

    if (hPal)
    {
        hOldPal1 = SelectPalette(hMemDC, hPal, TRUE);
        hOldPal2 = SelectPalette(hDC, hPal, TRUE);
        RealizePalette(hDC);
    }

    // Select bitmap into the memory DC

    hOldBitmap = (HBITMAP) SelectObject (hMemDC, hDDB);

    // Make sure to use the stretching mode best for color pictures

    SetStretchBltMode (hDC, COLORONCOLOR);

    // Determine whether to call StretchBlt() or BitBlt()
    if ((RECTWIDTH(lpDCRect)  == RECTWIDTH(lpDDBRect)) &&
            (RECTHEIGHT(lpDCRect) == RECTHEIGHT(lpDDBRect)))
        bSuccess = BitBlt(hDC, lpDCRect->left, lpDCRect->top,
                lpDCRect->right - lpDCRect->left,
                lpDCRect->bottom - lpDCRect->top, hMemDC, lpDDBRect->left,
                lpDDBRect->top, SRCCOPY);
    else
        bSuccess = StretchBlt(hDC, lpDCRect->left,  lpDCRect->top,
                lpDCRect->right - lpDCRect->left,
                lpDCRect->bottom - lpDCRect->top, hMemDC, lpDDBRect->left,
                lpDDBRect->top,  lpDDBRect->right - lpDDBRect->left,
                lpDDBRect->bottom - lpDDBRect->top, SRCCOPY);

    // Clean up

    SelectObject(hMemDC, hOldBitmap);

    if (hOldPal1)
        SelectPalette (hMemDC, hOldPal1, FALSE);

    if (hOldPal2)
        SelectPalette (hDC, hOldPal2, FALSE);

    DeleteDC (hMemDC);

    // Return with success/fail flag

    return bSuccess;
}

BOOL PaintDIB | ( | HDC | ,
 |  | LPRECT | ,
 |  | HDIB | ,
 |  | LPRECT | ,
 |  | HPALETTE |
 | ) |  |

Definition at line 391 of file Copy.c.

{
    LPSTR        lpDIBHdr;           // Pointer to BITMAPINFOHEADER
    LPSTR        lpDIBBits;          // Pointer to DIB bits
    BOOL         bSuccess=FALSE;     // Success/fail flag
    HPALETTE     hOldPal=NULL;       // Previous palette

    // Check for valid DIB handle

    if (!hDIB)
        return FALSE;

    // Lock down the DIB, and get a pointer to the beginning of the bit
    // buffer

    lpDIBHdr  = (LPSTR) GlobalLock(hDIB);
    lpDIBBits = FindDIBBits(lpDIBHdr);

    // Select and realize our palette as background

    if (hPal)
    {
        hOldPal = SelectPalette(hDC, hPal, TRUE);
        RealizePalette(hDC);
    }

    // Make sure to use the stretching mode best for color pictures

    SetStretchBltMode(hDC, COLORONCOLOR);

    // Determine whether to call StretchDIBits() or SetDIBitsToDevice()

    if ((RECTWIDTH(lpDCRect)  == RECTWIDTH(lpDIBRect)) &&
            (RECTHEIGHT(lpDCRect) == RECTHEIGHT(lpDIBRect)))
    {
        bSuccess = SetDIBitsToDevice(hDC, lpDCRect->left, lpDCRect->top,
                RECTWIDTH(lpDCRect), RECTHEIGHT(lpDCRect), lpDIBRect->left,
                (int)DIBHeight(lpDIBHdr) - lpDIBRect->top -
                RECTHEIGHT(lpDIBRect), 0, DIBHeight(lpDIBHdr), lpDIBBits,
                (LPBITMAPINFO)lpDIBHdr, DIB_RGB_COLORS);
    }
    else
        bSuccess = StretchDIBits(hDC, lpDCRect->left, lpDCRect->top,
                RECTWIDTH(lpDCRect), RECTHEIGHT(lpDCRect), lpDIBRect->left,
                lpDIBRect->top, RECTWIDTH(lpDIBRect), RECTHEIGHT(lpDIBRect),
                lpDIBBits, (LPBITMAPINFO)lpDIBHdr, DIB_RGB_COLORS, SRCCOPY);

    // Unlock the memory block

    GlobalUnlock(hDIB);

    // Reselect old palette

    if (hOldPal)
     SelectPalette(hDC, hOldPal, FALSE);

    // Return with success/fail flag
    return bSuccess;
}

int PalEntriesOnDevice ( HDC hDC )

Definition at line 781 of file Dibutil.c.

{
    int nColors;  // number of colors

    // Find out the number of colors on this device.

    nColors = (1 << (GetDeviceCaps(hDC, BITSPIXEL) * GetDeviceCaps(hDC, PLANES)));

    assert(nColors);
    return nColors;
}

WORD PaletteSize ( LPSTR lpDIB )

Definition at line 270 of file Dibutil.c.

{
  if (!lpDIB)
    return (WORD) 0;

    // calculate the size required by the palette
    if (IS_WIN30_DIB (lpDIB))
        return (DIBNumColors(lpDIB) * sizeof(RGBQUAD));
    else
        return (DIBNumColors(lpDIB) * sizeof(RGBTRIPLE));
}

WORD PrintDIB | ( | HDIB | ,
 |  | WORD | ,
 |  | WORD | ,
 |  | WORD | ,
 |  | LPSTR |
 | ) |  |

Definition at line 214 of file Print.c.

{
    HDC                 hPrnDC;         // DC to the printer
    RECT                rect;           // Rect structure used for banding
    LPSTR               lpBits;         // pointer to the DIB bits
    LPBITMAPINFOHEADER  lpDIBHdr;       // Pointer to DIB header
    int                 nBandCount = 0; // used for print dialog box to count bands
    WORD                wErrorCode = 0; // Error code to return
    RECT                rPrintRect;     // specifies the area on the printer
                                        // (in printer coordinates) which we
                                        // want the DIB to go to
    char                szBuffer[70];   // Buffer to hold message for "Printing" dlg box
    char                szJobNameTrunc[35];     // szJobName truncated to 31
                                        // characters, since STARTDOC can't
                                        // accept a string longer than 31
    DOCINFO             DocInfo;        // structure for StartDoc
    int                 nTemp;          // used to check banding capability
    CHAR                lpBuffer[128];  // Buffer for strings retrieved from resources

    // Paramter validation

    if (!hDib)
        return ERR_INVALIDHANDLE;

    // Get pointer to DIB header

    lpDIBHdr = (LPBITMAPINFOHEADER)GlobalLock(hDib);
    if (!lpDIBHdr) // Check that we have a valid pointer
        return ERR_LOCK;
    lpBits = FindDIBBits((LPSTR)lpDIBHdr); // Find pointer to DIB bits

    if (hPrnDC = GetPrinterDC())
    {
        SetStretchBltMode(hPrnDC, COLORONCOLOR);

        // Determine rPrintRect (printer area to print to) from the
        // fPrintOpt.  Fill in rPrintRect.left and .top from wXScale and
        // wYScale just in case we use PW_SCALE (see the function
        // CalculatePrintRect).

        rPrintRect.left = wXScale;
        rPrintRect.top = wYScale;
        CalculatePrintRect(hPrnDC, &rPrintRect, fPrintOpt, lpDIBHdr->biWidth,
                         lpDIBHdr->biHeight);

        // Initialize the abort procedure.

        hDlgAbort = CreateDialog(ghDLLInst, szPrintDlg, GetFocus(),
                (DLGPROC)PrintAbortDlg);

        // ISet the text inside the dialog to the name of our print job

        lstrcpyn(szJobNameTrunc, szJobName, sizeof(szJobNameTrunc) - 1);
        szJobNameTrunc[31] = '\0';           // Truncate string to 31 chars
        LoadString(ghDLLInst, IDS_PRINTMSG, lpBuffer, sizeof(lpBuffer) );
        _snprintf(szBuffer, sizeof(szBuffer) - 1, lpBuffer, (LPSTR)szJobNameTrunc);
        SetDlgItemText(hDlgAbort, IDC_PRINTTEXT1, (LPSTR)szBuffer);

        // Set global variable bAbort to FALSE.  This will get set to TRUE
        // in our PrintAbortDlg() procedure if the user selects the
        // CANCEL button in our dialog box

        bAbort = FALSE;

        // set up the Abort Procedure

        if (SetAbortProc(hPrnDC, (ABORTPROC)PrintAbortProc) < 0)
                return ERR_SETABORTPROC;

        // start print job

        ZeroMemory(&DocInfo, sizeof(DOCINFO));
        DocInfo.cbSize = sizeof(DOCINFO);
        DocInfo.lpszDocName = (LPTSTR)szJobNameTrunc;
        DocInfo.lpszOutput = NULL;

        if (StartDoc(hPrnDC, &DocInfo) <= 0)
        {
            // Oops, something happened, let's clean up here and return

             DestroyWindow(hDlgAbort);   // Remove abort dialog box
             DeleteDC(hPrnDC);
             GlobalUnlock(hDib);
             return ERR_STARTDOC;
        }

// Note: the following banding code applies to Windows 3.1.  With the new
//       printing architecture of Win32, send out both the graphics and
//       text in one band (like a non-banding device).  This code is used
//       for Win32s since Win32s depends on Windows 3.1 printing architecture.
//
        // Check if need to do banding.  If we do, loop through
        // each band in the page, calling NEXTBAND and BANDINFO
        // (if supported) calling PrintBand() on the band.  Else,
        // call PrintBand() with the entire page as our clipping
        // rectangle!

        // If Wincap32 is running on Win32s, then use banding

        nTemp = NEXTBAND;
        if (Escape(hPrnDC, QUERYESCSUPPORT, sizeof(int), (LPSTR)&nTemp, NULL) &&
                (GetVersion() & 0x80000000) && (LOWORD(GetVersion()) == 3))
        {
            BOOL                bBandInfoDevice;
            BANDINFOSTRUCT      biBandInfo;         // Used for banding

            // Fill in initial values for our BandInfo Structure to
            // tell driver we can want to do graphics and text, and
            // also which area we want the graphics to go in.

            biBandInfo.bGraphics = TRUE;
            biBandInfo.bText = TRUE;
            biBandInfo.GraphicsRect = rPrintRect;

            // Check if device supports the BANDINFO escape.

            nTemp = BANDINFO;
            bBandInfoDevice = Escape(hPrnDC, QUERYESCSUPPORT, sizeof(int),
                    (LPSTR)&nTemp, NULL);

            // Do each band -- Call Escape() with NEXTBAND, then the
            // rect structure returned is the area where we are to
            // print in.  This loop exits when the rect area is empty.

            while (Escape(hPrnDC, NEXTBAND, 0, NULL, (LPSTR)&rect) && !
                IsRectEmpty(&rect))
            {
                char szTmpBuf[100];

                // Do the BANDINFO, if needed.

                if (bBandInfoDevice)
                    Escape(hPrnDC, BANDINFO, sizeof(BANDINFOSTRUCT), (LPSTR)&
                            biBandInfo, (LPSTR)&biBandInfo);
                LoadString(ghDLLInst, IDS_BANDNMBR, lpBuffer, sizeof(lpBuffer));
                _snprintf(szTmpBuf, sizeof(szTmpBuf) - 1, lpBuffer, ++nBandCount);
        szTmpBuf[sizeof(szTmpBuf) - 1] = '\0';
                SetDlgItemText(hDlgAbort, IDC_PERCENTAGE, (LPSTR)szTmpBuf);

                // Call PrintBand() to do actual output into band.
                // Pass in our band-info flags to tell what sort
                // of data to output into the band.  Note that on
                // non-banding devices, we pass in the default bandinfo
                // stuff set above (i.e. bText=TRUE, bGraphics=TRUE).

                wErrorCode = PrintBand(hPrnDC, &rPrintRect, &rect,
                        biBandInfo.bText, biBandInfo.bGraphics, lpDIBHdr,
                        lpBits);
            }
        }
        else
        {
            // Print the whole page -- non-banding device.

            if (StartPage(hPrnDC) <= 0)
                return ERR_STARTPAGE;

            rect = rPrintRect;
            LoadString(ghDLLInst, IDS_SENDINGBAND, lpBuffer, sizeof(lpBuffer));
            SetDlgItemText(hDlgAbort, IDC_PERCENTAGE, lpBuffer);
            wErrorCode = PrintBand(hPrnDC, &rPrintRect, &rect, TRUE, TRUE,
                    lpDIBHdr, lpBits);

            // Non-banding devices need a NEWFRAME

            if (EndPage(hPrnDC) <= 0)
                return ERR_ENDPAGE;
        }

        // End the print operation.  Only send the ENDDOC if
        //  we didn't abort or error.

        if (!bAbort)
        {
            // We errored out on ENDDOC, but don't return here - we still
            // need to close the dialog box, free proc instances, etc.

            if (EndDoc(hPrnDC) <= 0)
                wErrorCode = ERR_ENDDOC;

            DestroyWindow(hDlgAbort);
        }

        // All done, clean up.

        DeleteDC(hPrnDC);
    }
    else
        wErrorCode = ERR_GETDC;   // Couldn't get Printer DC!

    GlobalUnlock(hDib);
    return wErrorCode;
}

WORD PrintScreen | ( | LPRECT | ,
 |  | WORD | ,
 |  | WORD | ,
 |  | WORD | ,
 |  | LPSTR |
 | ) |  |

Definition at line 151 of file Print.c.

{
    HDIB     hDib;          // A Handle to our DIB
    WORD     wReturn;       // Return value

    // Copy the screen contained in the specified rectangle to a DIB

    hDib = CopyScreenToDIB(rRegion);

    if (!hDib)
        return ERR_DIBFUNCTION;   // CopyScreenToDIB failed!

    wReturn = PrintDIB(hDib, fPrintOpt, wXScale, wYScale, szJobName);
    DestroyDIB(hDib);
    return wReturn; // Return the value that PrintDIB returned
}

WORD PrintWindowSamp | ( | HWND | ,
 |  | WORD | ,
 |  | WORD | ,
 |  | WORD | ,
 |  | WORD | ,
 |  | LPSTR |
 | ) |  |

Definition at line 96 of file Print.c.

{
    HDIB    hDib;          // Handle to the DIB
    WORD    wReturn;       // our return value

    // Parameter validation

    if (!hWnd)
        return ERR_INVALIDHANDLE;  // Invalid Window

    // Copy the Window to a DIB and print it.

    hDib = CopyWindowToDIB(hWnd, fPrintArea);
    if (!hDib)
        return ERR_DIBFUNCTION; // CopyWindowToDIB failed!

    wReturn = PrintDIB(hDib, fPrintOpt, wXScale, wYScale, szJobName);

    // Call DestroyDIB to free the memory the dib takes up.

    DestroyDIB(hDib);
    return wReturn;   // return the value from PrintDIB
}

WORD SaveDIB | ( | HDIB | ,
 |  | LPSTR |
 | ) |  |

Definition at line 124 of file File.c.

{
    BITMAPFILEHEADER    bmfHdr;     // Header for Bitmap file
    LPBITMAPINFOHEADER  lpBI;       // Pointer to DIB info structure
    HANDLE              fh;         // file handle for opened file
    DWORD               dwDIBSize;
    DWORD               dwWritten;

    if (!hDib)
        return ERR_INVALIDHANDLE;

  if (!lpFileName)
    return ERR_FILENOTFOUND;

    fh = CreateFile(lpFileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
            FILE_FLAG_SEQUENTIAL_SCAN | SECURITY_ANONYMOUS | SECURITY_SQOS_PRESENT, NULL);

    if (fh == INVALID_HANDLE_VALUE)
        return ERR_OPEN;

  if ( GetFileType(fh) != FILE_TYPE_DISK )
  {
      CloseHandle(fh);
      return ERR_OPEN;
  }

    // Get a pointer to the DIB memory, the first of which contains
    // a BITMAPINFO structure

    lpBI = (LPBITMAPINFOHEADER)GlobalLock(hDib);
    if (!lpBI)
    {
        CloseHandle(fh);
        return ERR_LOCK;
    }

    // Check to see if we're dealing with an OS/2 DIB.  If so, don't
    // save it because our functions aren't written to deal with these
    // DIBs.

    if (lpBI->biSize != sizeof(BITMAPINFOHEADER))
    {
        GlobalUnlock(hDib);
        CloseHandle(fh);
        return ERR_NOT_DIB;
    }

    // Fill in the fields of the file header

    // Fill in file type (first 2 bytes must be "BM" for a bitmap)

    bmfHdr.bfType = DIB_HEADER_MARKER;  // "BM"

    // Calculating the size of the DIB is a bit tricky (if we want to
    // do it right).  The easiest way to do this is to call GlobalSize()
    // on our global handle, but since the size of our global memory may have
    // been padded a few bytes, we may end up writing out a few too
    // many bytes to the file (which may cause problems with some apps,
    // like HC 3.0).
    //
    // So, instead let's calculate the size manually.
    //
    // To do this, find size of header plus size of color table.  Since the
    // first DWORD in both BITMAPINFOHEADER and BITMAPCOREHEADER conains
    // the size of the structure, let's use this.

    // Partial Calculation

    dwDIBSize = *(LPDWORD)lpBI + PaletteSize((LPSTR)lpBI);

    // Now calculate the size of the image

    // It's an RLE bitmap, we can't calculate size, so trust the biSizeImage
    // field

    if ((lpBI->biCompression == BI_RLE8) || (lpBI->biCompression == BI_RLE4))
        dwDIBSize += lpBI->biSizeImage;
    else
    {
        DWORD dwBmBitsSize;  // Size of Bitmap Bits only

        // It's not RLE, so size is Width (DWORD aligned) * Height

        dwBmBitsSize = WIDTHBYTES((lpBI->biWidth)*((DWORD)lpBI->biBitCount)) *
                lpBI->biHeight;

        dwDIBSize += dwBmBitsSize;

        // Now, since we have calculated the correct size, why don't we
        // fill in the biSizeImage field (this will fix any .BMP files which
        // have this field incorrect).

        lpBI->biSizeImage = dwBmBitsSize;
    }

    // Calculate the file size by adding the DIB size to sizeof(BITMAPFILEHEADER)

    bmfHdr.bfSize = dwDIBSize + sizeof(BITMAPFILEHEADER);
    bmfHdr.bfReserved1 = 0;
    bmfHdr.bfReserved2 = 0;

    // Now, calculate the offset the actual bitmap bits will be in
    // the file -- It's the Bitmap file header plus the DIB header,
    // plus the size of the color table.

    bmfHdr.bfOffBits = (DWORD)sizeof(BITMAPFILEHEADER) + lpBI->biSize +
            PaletteSize((LPSTR)lpBI);

    // Write the file header

    WriteFile(fh, (LPSTR)&bmfHdr, sizeof(BITMAPFILEHEADER), &dwWritten, NULL);

    // Write the DIB header and the bits -- use local version of
    // MyWrite, so we can write more than 32767 bytes of data

    WriteFile(fh, (LPSTR)lpBI, dwDIBSize, &dwWritten, NULL);

    GlobalUnlock(hDib);
    CloseHandle(fh);

    if (dwWritten == 0)
        return ERR_OPEN; // oops, something happened in the write
    else
        return 0; // Success code
}

Generated on Wed Nov 13 2024 16:53:44 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/WinCap32/Dibdll.h File Reference

  • Multimedia
  • Gdi
  • WinCap32
Defines

Dibdll.h File Reference

Go to the source code of this file.

Defines

#define | IDC_BOX1 123
#define | IDC_PERCENTAGE 403
#define | IDC_PRINTTEXT1 401
#define | IDC_PRINTTEXT2 402
#define | IDS_ABORTSTRING 604
#define | IDS_BANDNMBR 602
#define | IDS_PRINTMSG 601
#define | IDS_SENDINGBAND 603

Define Documentation

#define IDC_BOX1 123

Definition at line 16 of file Dibdll.h.

#define IDC_PERCENTAGE 403

Definition at line 19 of file Dibdll.h.

#define IDC_PRINTTEXT1 401

Definition at line 17 of file Dibdll.h.

#define IDC_PRINTTEXT2 402

Definition at line 18 of file Dibdll.h.

#define IDS_ABORTSTRING 604

Definition at line 24 of file Dibdll.h.

#define IDS_BANDNMBR 602

Definition at line 22 of file Dibdll.h.

#define IDS_PRINTMSG 601

Definition at line 21 of file Dibdll.h.

#define IDS_SENDINGBAND 603

Definition at line 23 of file Dibdll.h.

Generated on Wed Nov 13 2024 16:53:44 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/WinCap32/Dibutil.c File Reference

  • Multimedia
  • Gdi
  • WinCap32
Defines | Functions

Dibutil.c File Reference

#include <windows.h>
#include <assert.h>
#include "dibapi.h"
#include "dibutil.h"
#include <stdio.h>

Go to the source code of this file.

Defines

#define | STRICT

Functions

HANDLE | AllocRoomForDIB (BITMAPINFOHEADER bi, HBITMAP hBitmap)
HDIB | BitmapToDIB (HBITMAP hBitmap, HPALETTE hPal)
HDIB | ChangeBitmapFormat (HBITMAP hBitmap, WORD wBitCount, DWORD dwCompression, HPALETTE hPal)
HDIB | ChangeDIBFormat (HDIB hDIB, WORD wBitCount, DWORD dwCompression)
HDIB | CreateDIB (DWORD dwWidth, DWORD dwHeight, WORD wBitCount)
HPALETTE | CreateDIBPalette (HDIB hDIB)
DWORD | DIBHeight (LPSTR lpDIB)
WORD | DIBNumColors (LPSTR lpDIB)
HBITMAP | DIBToBitmap (HDIB hDIB, HPALETTE hPal)
DWORD | DIBWidth (LPSTR lpDIB)
LPSTR | FindDIBBits (LPSTR lpDIB)
HPALETTE | GetSystemPalette (void)
int | PalEntriesOnDevice (HDC hDC)
WORD | PaletteSize (LPSTR lpDIB)

Define Documentation

#define STRICT

Definition at line 28 of file Dibutil.c.

Function Documentation

HANDLE AllocRoomForDIB | ( | BITMAPINFOHEADER | bi,
 |  | HBITMAP | hBitmap
 | ) |  |

Definition at line 894 of file Dibutil.c.

{
    DWORD               dwLen;
    HANDLE              hDIB;
    HDC                 hDC;
    LPBITMAPINFOHEADER  lpbi;
    HANDLE              hTemp;

    // Figure out the size needed to hold the BITMAPINFO structure
    // (which includes the BITMAPINFOHEADER and the color table).

    dwLen = bi.biSize + PaletteSize((LPSTR) &bi);
    hDIB  = GlobalAlloc(GHND,dwLen);

    // Check that DIB handle is valid

    if (!hDIB)
        return NULL;

    // Set up the BITMAPINFOHEADER in the newly allocated global memory,
    // then call GetDIBits() with lpBits = NULL to have it fill in the
    // biSizeImage field for us.

    lpbi  = (LPBITMAPINFOHEADER)GlobalLock(hDIB);
    *lpbi = bi;

    hDC   = GetDC(NULL);

    GetDIBits(hDC, hBitmap, 0, (UINT) bi.biHeight, NULL, (LPBITMAPINFO)lpbi,
            DIB_RGB_COLORS);
    ReleaseDC(NULL, hDC);

    // If the driver did not fill in the biSizeImage field,
    // fill it in -- NOTE: this is a bug in the driver!

    if (lpbi->biSizeImage == 0)
        lpbi->biSizeImage = WIDTHBYTES((DWORD)lpbi->biWidth *
                lpbi->biBitCount) * lpbi->biHeight;

    // Get the size of the memory block we need

    dwLen = lpbi->biSize + PaletteSize((LPSTR) &bi) + lpbi->biSizeImage;

    // Unlock the memory block

    GlobalUnlock(hDIB);

    // ReAlloc the buffer big enough to hold all the bits

    if (hTemp = GlobalReAlloc(hDIB,dwLen,0))
        return hTemp;
    else
    {
        // Else free memory block and return failure

        GlobalFree(hDIB);
        return NULL;
    }
}

HDIB BitmapToDIB | ( | HBITMAP | hBitmap,
 |  | HPALETTE | hPal
 | ) |  |

use our bitmap info. to fill BITMAPINFOHEADER

Definition at line 605 of file Dibutil.c.

{
    BITMAP              bm;         // bitmap structure
    BITMAPINFOHEADER    bi;         // bitmap header
    LPBITMAPINFOHEADER  lpbi;       // pointer to BITMAPINFOHEADER
    DWORD               dwLen;      // size of memory block
    HANDLE              hDIB, h;    // handle to DIB, temp handle
    HDC                 hDC;        // handle to DC
    WORD                biBits;     // bits per pixel

    // check if bitmap handle is valid

    if (!hBitmap)
        return NULL;

    // fill in BITMAP structure, return NULL if it didn't work

    if (!GetObject(hBitmap, sizeof(bm), (LPSTR)&bm))
        return NULL;

    // if no palette is specified, use default palette

    if (hPal == NULL)
        hPal = GetStockObject(DEFAULT_PALETTE);

    // calculate bits per pixel

    biBits = bm.bmPlanes * bm.bmBitsPixel;

    // make sure bits per pixel is valid

    if (biBits <= 1)
        biBits = 1;
    else if (biBits <= 4)
        biBits = 4;
    else if (biBits <= 8)
        biBits = 8;
    else // if greater than 8-bit, force to 24-bit
        biBits = 24;

    // initialize BITMAPINFOHEADER

    bi.biSize = sizeof(BITMAPINFOHEADER);
    bi.biWidth = bm.bmWidth;
    bi.biHeight = bm.bmHeight;
    bi.biPlanes = 1;
    bi.biBitCount = biBits;
    bi.biCompression = BI_RGB;
    bi.biSizeImage = 0;
    bi.biXPelsPerMeter = 0;
    bi.biYPelsPerMeter = 0;
    bi.biClrUsed = 0;
    bi.biClrImportant = 0;

    // calculate size of memory block required to store BITMAPINFO

    dwLen = bi.biSize + PaletteSize((LPSTR)&bi);

    // get a DC

    hDC = GetDC(NULL);

    // select and realize our palette

    hPal = SelectPalette(hDC, hPal, FALSE);
    RealizePalette(hDC);

    // alloc memory block to store our bitmap

    hDIB = GlobalAlloc(GHND, dwLen);

    // if we couldn't get memory block

    if (!hDIB)
    {
      // clean up and return NULL

      SelectPalette(hDC, hPal, TRUE);
      RealizePalette(hDC);
      ReleaseDC(NULL, hDC);
      return NULL;
    }

    // lock memory and get pointer to it

    lpbi = (LPBITMAPINFOHEADER)GlobalLock(hDIB);

    /// use our bitmap info. to fill BITMAPINFOHEADER

    *lpbi = bi;

    // call GetDIBits with a NULL lpBits param, so it will calculate the
    // biSizeImage field for us

    GetDIBits(hDC, hBitmap, 0, (UINT)bi.biHeight, NULL, (LPBITMAPINFO)lpbi,
        DIB_RGB_COLORS);

    // get the info. returned by GetDIBits and unlock memory block

    bi = *lpbi;
    GlobalUnlock(hDIB);

    // if the driver did not fill in the biSizeImage field, make one up
    if (bi.biSizeImage == 0)
        bi.biSizeImage = WIDTHBYTES((DWORD)bm.bmWidth * biBits) * bm.bmHeight;

    // realloc the buffer big enough to hold all the bits

    dwLen = bi.biSize + PaletteSize((LPSTR)&bi) + bi.biSizeImage;

    if (h = GlobalReAlloc(hDIB, dwLen, 0))
        hDIB = h;
    else
    {
        // clean up and return NULL

        GlobalFree(hDIB);
        hDIB = NULL;
        SelectPalette(hDC, hPal, TRUE);
        RealizePalette(hDC);
        ReleaseDC(NULL, hDC);
        return NULL;
    }

    // lock memory block and get pointer to it */

    lpbi = (LPBITMAPINFOHEADER)GlobalLock(hDIB);

    // call GetDIBits with a NON-NULL lpBits param, and actualy get the
    // bits this time

    if (GetDIBits(hDC, hBitmap, 0, (UINT)bi.biHeight, (LPSTR)lpbi +
            (WORD)lpbi->biSize + PaletteSize((LPSTR)lpbi), (LPBITMAPINFO)lpbi,
            DIB_RGB_COLORS) == 0)
    {
        // clean up and return NULL

        GlobalUnlock(hDIB);
        hDIB = NULL;
        SelectPalette(hDC, hPal, TRUE);
        RealizePalette(hDC);
        ReleaseDC(NULL, hDC);
        return NULL;
    }

    bi = *lpbi;

    // clean up
    GlobalUnlock(hDIB);
    SelectPalette(hDC, hPal, TRUE);
    RealizePalette(hDC);
    ReleaseDC(NULL, hDC);

    // return handle to the DIB
    return hDIB;
}

HDIB ChangeBitmapFormat | ( | HBITMAP | hBitmap,
 |  | WORD | wBitCount,
 |  | DWORD | dwCompression,
 |  | HPALETTE | hPal
 | ) |  |

Definition at line 1155 of file Dibutil.c.

{
    HDC                hDC;          // Screen DC
    HDIB               hNewDIB=NULL; // Handle to new DIB
    BITMAP             Bitmap;       // BITMAP data structure
    BITMAPINFOHEADER   bi;           // Bitmap info. header
    LPBITMAPINFOHEADER lpbi;         // Pointer to bitmap header
    HPALETTE           hOldPal=NULL; // Handle to palette
    WORD               NewBPP;       // New bits per pixel
    DWORD              NewComp;      // New compression format

    // Check for a valid bitmap handle

    if (!hBitmap)
        return NULL;

    // Validate wBitCount and dwCompression
    // They must match correctly (i.e., BI_RLE4 and 4 BPP or
    // BI_RLE8 and 8BPP, etc.) or we return failure

    if (wBitCount == 0)
    {
        NewComp = dwCompression;
        if (NewComp == BI_RLE4)
            NewBPP = 4;
        else if (NewComp == BI_RLE8)
            NewBPP = 8;
        else // Not enough info */
            return NULL;
    }
    else if (wBitCount == 1 && dwCompression == BI_RGB)
    {
        NewBPP = wBitCount;
        NewComp = BI_RGB;
    }
    else if (wBitCount == 4)
    {
        NewBPP = wBitCount;
        if (dwCompression == BI_RGB || dwCompression == BI_RLE4)
            NewComp = dwCompression;
        else
            return NULL;
    }
    else if (wBitCount == 8)
    {
        NewBPP = wBitCount;
        if (dwCompression == BI_RGB || dwCompression == BI_RLE8)
            NewComp = dwCompression;
        else
            return NULL;
    }
    else if (wBitCount == 24 && dwCompression == BI_RGB)
    {
        NewBPP = wBitCount;
        NewComp = BI_RGB;
    }
    else
        return NULL;

    // Get info about the bitmap

    GetObject(hBitmap, sizeof(BITMAP), (LPSTR)&Bitmap);

    // Fill in the BITMAPINFOHEADER appropriately

    bi.biSize               = sizeof(BITMAPINFOHEADER);
    bi.biWidth              = Bitmap.bmWidth;
    bi.biHeight             = Bitmap.bmHeight;
    bi.biPlanes             = 1;
    bi.biBitCount           = NewBPP;
    bi.biCompression        = NewComp;
    bi.biSizeImage          = 0;
    bi.biXPelsPerMeter      = 0;
    bi.biYPelsPerMeter      = 0;
    bi.biClrUsed            = 0;
    bi.biClrImportant       = 0;

    // Go allocate room for the new DIB

    hNewDIB = AllocRoomForDIB(bi, hBitmap);
    if (!hNewDIB)
        return NULL;

    // Get a pointer to the new DIB

    lpbi = (LPBITMAPINFOHEADER)GlobalLock(hNewDIB);

    hDC = GetDC(NULL);

    // If we have a palette, select/realize it

    if (hPal)
    {
        hOldPal = SelectPalette(hDC, hPal, FALSE);
        RealizePalette(hDC);
    }

    // Call GetDIBits and get the new DIB bits

    if (!GetDIBits(hDC, hBitmap, 0, (UINT) lpbi->biHeight, (LPSTR)lpbi +
            (WORD)lpbi->biSize + PaletteSize((LPSTR)lpbi), (LPBITMAPINFO)lpbi,
            DIB_RGB_COLORS))
    {
        GlobalUnlock(hNewDIB);
        GlobalFree(hNewDIB);
        hNewDIB = NULL;
    }

    // Clean up and return

    if (hOldPal)
    {
        SelectPalette(hDC, hOldPal, TRUE);
        RealizePalette(hDC);
        ReleaseDC(NULL, hDC);
    }

    // Unlock the new DIB's memory block

    if (hNewDIB)
        GlobalUnlock(hNewDIB);

    return hNewDIB;
}

HDIB ChangeDIBFormat | ( | HDIB | hDIB,
 |  | WORD | wBitCount,
 |  | DWORD | dwCompression
 | ) |  |

Definition at line 987 of file Dibutil.c.

{
    HDC                hDC;             // Handle to DC
    HBITMAP            hBitmap;         // Handle to bitmap
    BITMAP             Bitmap;          // BITMAP data structure
    BITMAPINFOHEADER   bi;              // Bitmap info header
    LPBITMAPINFOHEADER lpbi;            // Pointer to bitmap info
    HDIB               hNewDIB = NULL;  // Handle to new DIB
    HPALETTE           hPal, hOldPal;   // Handle to palette, prev pal
    WORD               DIBBPP, NewBPP;  // DIB bits per pixel, new bpp
    DWORD              DIBComp, NewComp;// DIB compression, new compression

    // Check for a valid DIB handle

    if (!hDIB)
        return NULL;

    // Get the old DIB's bits per pixel and compression format

    lpbi = (LPBITMAPINFOHEADER)GlobalLock(hDIB);
    DIBBPP = ((LPBITMAPINFOHEADER)lpbi)->biBitCount;
    DIBComp = ((LPBITMAPINFOHEADER)lpbi)->biCompression;
    GlobalUnlock(hDIB);

    // Validate wBitCount and dwCompression
    // They must match correctly (i.e., BI_RLE4 and 4 BPP or
    // BI_RLE8 and 8BPP, etc.) or we return failure
    if (wBitCount == 0)
    {
        NewBPP = DIBBPP;
        if ((dwCompression == BI_RLE4 && NewBPP == 4) ||
                (dwCompression == BI_RLE8 && NewBPP == 8) ||
                (dwCompression == BI_RGB))
            NewComp = dwCompression;
        else
            return NULL;
    }
    else if (wBitCount == 1 && dwCompression == BI_RGB)
    {
        NewBPP = wBitCount;
        NewComp = BI_RGB;
    }
    else if (wBitCount == 4)
    {
        NewBPP = wBitCount;
        if (dwCompression == BI_RGB || dwCompression == BI_RLE4)
            NewComp = dwCompression;
        else
            return NULL;
    }
    else if (wBitCount == 8)
    {
        NewBPP = wBitCount;
        if (dwCompression == BI_RGB || dwCompression == BI_RLE8)
            NewComp = dwCompression;
        else
            return NULL;
    }
    else if (wBitCount == 24 && dwCompression == BI_RGB)
    {
        NewBPP = wBitCount;
        NewComp = BI_RGB;
    }
    else
        return NULL;

    // Save the old DIB's palette

    hPal = CreateDIBPalette(hDIB);
    if (!hPal)
        return NULL;

    // Convert old DIB to a bitmap

    hBitmap = DIBToBitmap(hDIB, hPal);
    if (!hBitmap)
    {
        DeleteObject(hPal);
        return NULL;
    }

    // Get info about the bitmap
    GetObject(hBitmap, sizeof(BITMAP), (LPSTR)&Bitmap);

    // Fill in the BITMAPINFOHEADER appropriately

    bi.biSize               = sizeof(BITMAPINFOHEADER);
    bi.biWidth              = Bitmap.bmWidth;
    bi.biHeight             = Bitmap.bmHeight;
    bi.biPlanes             = 1;
    bi.biBitCount           = NewBPP;
    bi.biCompression        = NewComp;
    bi.biSizeImage          = 0;
    bi.biXPelsPerMeter      = 0;
    bi.biYPelsPerMeter      = 0;
    bi.biClrUsed            = 0;
    bi.biClrImportant       = 0;

    // Go allocate room for the new DIB

    hNewDIB = AllocRoomForDIB(bi, hBitmap);
    if (!hNewDIB)
        return NULL;

    // Get a pointer to the new DIB

    lpbi = (LPBITMAPINFOHEADER)GlobalLock(hNewDIB);

    // Get a DC and select/realize our palette in it

    hDC  = GetDC(NULL);
    hOldPal = SelectPalette(hDC, hPal, FALSE);
    RealizePalette(hDC);

    // Call GetDIBits and get the new DIB bits

    if (!GetDIBits(hDC, hBitmap, 0, (UINT) lpbi->biHeight,
            (LPSTR)lpbi + (WORD)lpbi->biSize + PaletteSize((LPSTR)lpbi),
            (LPBITMAPINFO)lpbi, DIB_RGB_COLORS))
    {
        GlobalUnlock(hNewDIB);
        GlobalFree(hNewDIB);
        hNewDIB = NULL;
    }

    // Clean up and return

    SelectPalette(hDC, hOldPal, TRUE);
    RealizePalette(hDC);
    ReleaseDC(NULL, hDC);

    // Unlock the new DIB's memory block
    if (hNewDIB)
        GlobalUnlock(hNewDIB);

    DeleteObject(hBitmap);
    DeleteObject(hPal);

    return hNewDIB;
}

HDIB CreateDIB | ( | DWORD | dwWidth,
 |  | DWORD | dwHeight,
 |  | WORD | wBitCount
 | ) |  |

Definition at line 66 of file Dibutil.c.

{
    BITMAPINFOHEADER    bi;             // bitmap header
    LPBITMAPINFOHEADER  lpbi;           // pointer to BITMAPINFOHEADER
    DWORD               dwLen;          // size of memory block
    HDIB                hDIB;
    DWORD               dwBytesPerLine; // Number of bytes per scanline

    // Make sure bits per pixel is valid

    if (wBitCount <= 1)
        wBitCount = 1;
    else if (wBitCount <= 4)
        wBitCount = 4;
    else if (wBitCount <= 8)
        wBitCount = 8;
    else if (wBitCount <= 24)
        wBitCount = 24;
  else if (wBitCount <= 32)
    wBitCount = 32;
    else
        wBitCount = 4;  // set default value to 4 if parameter is bogus

    // initialize BITMAPINFOHEADER

    bi.biSize = sizeof(BITMAPINFOHEADER);
    bi.biWidth = dwWidth;         // fill in width from parameter
    bi.biHeight = dwHeight;       // fill in height from parameter
    bi.biPlanes = 1;              // must be 1
    bi.biBitCount = wBitCount;    // from parameter
    bi.biCompression = BI_RGB;
    bi.biSizeImage = 0;           // 0's here mean "default"
    bi.biXPelsPerMeter = 0;
    bi.biYPelsPerMeter = 0;
    bi.biClrUsed = 0;
    bi.biClrImportant = 0;

    // calculate size of memory block required to store the DIB.  This
    // block should be big enough to hold the BITMAPINFOHEADER, the color
    // table, and the bits

    dwBytesPerLine = WIDTHBYTES(wBitCount * dwWidth);
    dwLen = bi.biSize + PaletteSize((LPSTR)&bi) + (dwBytesPerLine * dwHeight);

    // alloc memory block to store our bitmap

    hDIB = GlobalAlloc(GHND, dwLen);

    // major bummer if we couldn't get memory block

    if (!hDIB)
        return NULL;

    // lock memory and get pointer to it

    lpbi = (LPBITMAPINFOHEADER)GlobalLock(hDIB);

    // use our bitmap info structure to fill in first part of
    // our DIB with the BITMAPINFOHEADER

    *lpbi = bi;

    // Since we don't know what the colortable and bits should contain,
    // just leave these blank.  Unlock the DIB and return the HDIB.

    GlobalUnlock(hDIB);

    //return handle to the DIB

    return hDIB;
}

HPALETTE CreateDIBPalette ( HDIB hDIB )

Definition at line 377 of file Dibutil.c.

{
    LPLOGPALETTE        lpPal;          // pointer to a logical palette
    HANDLE              hLogPal;        // handle to a logical palette
    HPALETTE            hPal = NULL;    // handle to a palette
    int                 i, wNumColors;  // loop index, number of colors in color table
    LPSTR               lpbi;           // pointer to packed-DIB
    LPBITMAPINFO        lpbmi;          // pointer to BITMAPINFO structure (Win3.0)
    LPBITMAPCOREINFO    lpbmc;          // pointer to BITMAPCOREINFO structure (OS/2)
    BOOL                bWinStyleDIB;   // Win3.0 DIB?

    // if handle to DIB is invalid, return NULL

    if (!hDIB)
        return NULL;

    // lock DIB memory block and get a pointer to it

    lpbi = GlobalLock(hDIB);

    // get pointer to BITMAPINFO (Win 3.0)

    lpbmi = (LPBITMAPINFO)lpbi;

    // get pointer to BITMAPCOREINFO (OS/2 1.x)

    lpbmc = (LPBITMAPCOREINFO)lpbi;

    // get the number of colors in the DIB

    wNumColors = DIBNumColors(lpbi);

    // is this a Win 3.0 DIB?

    bWinStyleDIB = IS_WIN30_DIB(lpbi);
    if (wNumColors)
    {
        // allocate memory block for logical palette

        hLogPal = GlobalAlloc(GHND, sizeof(LOGPALETTE) +
                sizeof(PALETTEENTRY) * wNumColors);

        // if not enough memory, clean up and return NULL

        if (!hLogPal)
        {
            GlobalUnlock(hDIB);
            return NULL;
        }

        // lock memory block and get pointer to it

        lpPal = (LPLOGPALETTE)GlobalLock(hLogPal);

        // set version and number of palette entries

        lpPal->palVersion = PALVERSION;
        lpPal->palNumEntries = (WORD) wNumColors;

        // store RGB triples (if Win 3.0 DIB) or RGB quads (if OS/2 DIB)
        // into palette

        for (i = 0; i < wNumColors; i++)
        {
            if (bWinStyleDIB)
            {
                lpPal->palPalEntry[i].peRed = lpbmi->bmiColors[i].rgbRed;
                lpPal->palPalEntry[i].peGreen = lpbmi->bmiColors[i].rgbGreen;
                lpPal->palPalEntry[i].peBlue = lpbmi->bmiColors[i].rgbBlue;
                lpPal->palPalEntry[i].peFlags = 0;
            }
            else
            {
                lpPal->palPalEntry[i].peRed = lpbmc->bmciColors[i].rgbtRed;
                lpPal->palPalEntry[i].peGreen = lpbmc->bmciColors[i].rgbtGreen;
                lpPal->palPalEntry[i].peBlue = lpbmc->bmciColors[i].rgbtBlue;
                lpPal->palPalEntry[i].peFlags = 0;
            }
        }

        // create the palette and get handle to it

        hPal = CreatePalette(lpPal);

        // if error getting handle to palette, clean up and return NULL

        if (!hPal)
        {
            GlobalUnlock(hLogPal);
            GlobalFree(hLogPal);
            return NULL;
        }
    }

    // clean up

    GlobalUnlock(hLogPal);
    GlobalFree(hLogPal);
    GlobalUnlock(hDIB);

    // return handle to DIB's palette
    return hPal;
}

DWORD DIBHeight ( LPSTR lpDIB )

Definition at line 228 of file Dibutil.c.

{
   LPBITMAPINFOHEADER   lpbmi;  // pointer to a Win 3.0-style DIB
   LPBITMAPCOREHEADER   lpbmc;  // pointer to an OS/2-style DIB

   if (!lpDIB)
     return 0;

   // point to the header (whether OS/2 or Win 3.0

   lpbmi = (LPBITMAPINFOHEADER)lpDIB;
   lpbmc = (LPBITMAPCOREHEADER)lpDIB;

    // return the DIB height if it is a Win 3.0 DIB
    if (lpbmi->biSize == sizeof(BITMAPINFOHEADER))
        return lpbmi->biHeight;
    else  // it is an OS/2 DIB, so return its height
        return (DWORD)lpbmc->bcHeight;
}

WORD DIBNumColors ( LPSTR lpDIB )

Definition at line 304 of file Dibutil.c.

{
    WORD wBitCount;  // DIB bit count

  if (!lpDIB)
    return (WORD) 0;

    // If this is a Windows-style DIB, the number of colors in the
    // color table can be less than the number of bits per pixel
    // allows for (i.e. lpbi->biClrUsed can be set to some value).
    // If this is the case, return the appropriate value.

    if (IS_WIN30_DIB(lpDIB))
    {
        DWORD dwClrUsed;

        dwClrUsed = ((LPBITMAPINFOHEADER)lpDIB)->biClrUsed;
        if (dwClrUsed)

        return (WORD)dwClrUsed;
    }

    // Calculate the number of colors in the color table based on
    // the number of bits per pixel for the DIB.

    if (IS_WIN30_DIB(lpDIB))
        wBitCount = ((LPBITMAPINFOHEADER)lpDIB)->biBitCount;
    else
        wBitCount = ((LPBITMAPCOREHEADER)lpDIB)->bcBitCount;

    // return number of colors based on bits per pixel

    switch (wBitCount)
    {
        case 1:
            return 2;

        case 4:
            return 16;

        case 8:
            return 256;

        default:
            return 0;
    }
}

HBITMAP DIBToBitmap | ( | HDIB | hDIB,
 |  | HPALETTE | hPal
 | ) |  |

Definition at line 524 of file Dibutil.c.

{
    LPSTR       lpDIBHdr, lpDIBBits;  // pointer to DIB header, pointer to DIB bits
    HBITMAP     hBitmap;            // handle to device-dependent bitmap
    HDC         hDC;                    // handle to DC
    HPALETTE    hOldPal = NULL;    // handle to a palette

    // if invalid handle, return NULL

    if (!hDIB)
        return NULL;

    // lock memory block and get a pointer to it

    lpDIBHdr = GlobalLock(hDIB);

    // get a pointer to the DIB bits

    lpDIBBits = FindDIBBits(lpDIBHdr);

  if (!lpDIBBits)
  {
     GlobalUnlock(hDIB);
        return NULL;
    }

    // get a DC

    hDC = GetDC(NULL);
    if (!hDC)
    {
        // clean up and return NULL

        GlobalUnlock(hDIB);
        return NULL;
    }

    // select and realize palette

    if (hPal)
        hOldPal = SelectPalette(hDC, hPal, FALSE);

    RealizePalette(hDC);

    // create bitmap from DIB info. and bits
    hBitmap = CreateDIBitmap(hDC, (LPBITMAPINFOHEADER)lpDIBHdr, CBM_INIT,
            lpDIBBits, (LPBITMAPINFO)lpDIBHdr, DIB_RGB_COLORS);

    // restore previous palette
    if (hOldPal)
        SelectPalette(hDC, hOldPal, FALSE);

    // clean up
    ReleaseDC(NULL, hDC);
    GlobalUnlock(hDIB);

    // return handle to the bitmap
    return hBitmap;
}

DWORD DIBWidth ( LPSTR lpDIB )

Definition at line 186 of file Dibutil.c.

{
    LPBITMAPINFOHEADER   lpbmi;  // pointer to a Win 3.0-style DIB
    LPBITMAPCOREHEADER   lpbmc;  // pointer to an OS/2-style DIB

  if (!lpDIB)
    return 0;

    // point to the header (whether Win 3.0 and OS/2)

    lpbmi = (LPBITMAPINFOHEADER)lpDIB;
    lpbmc = (LPBITMAPCOREHEADER)lpDIB;

    // return the DIB width if it is a Win 3.0 DIB

    if (lpbmi->biSize == sizeof(BITMAPINFOHEADER))
        return lpbmi->biWidth;
    else  // it is an OS/2 DIB, so return its width
        return (DWORD)lpbmc->bcWidth;
}

LPSTR FindDIBBits ( LPSTR lpDIB )

Definition at line 159 of file Dibutil.c.

{
  return (lpDIB != NULL ? (lpDIB + *(LPDWORD)lpDIB + PaletteSize(lpDIB)) :  NULL );
}

HPALETTE GetSystemPalette ( void )

Definition at line 814 of file Dibutil.c.

{
    HDC hDC;                // handle to a DC
    static HPALETTE hPal = NULL;   // handle to a palette
    HANDLE hLogPal;         // handle to a logical palette
    LPLOGPALETTE lpLogPal;  // pointer to a logical palette
    int nColors;            // number of colors

    // Find out how many palette entries we want.

    hDC = GetDC(NULL);

    if (!hDC)
        return NULL;

    nColors = PalEntriesOnDevice(hDC);   // Number of palette entries

    // Allocate room for the palette and lock it.

    hLogPal = GlobalAlloc(GHND, sizeof(LOGPALETTE) + nColors *
            sizeof(PALETTEENTRY));

    // if we didn't get a logical palette, return NULL

    if (!hLogPal)
        return NULL;

    // get a pointer to the logical palette

    lpLogPal = (LPLOGPALETTE)GlobalLock(hLogPal);

    // set some important fields

    lpLogPal->palVersion = PALVERSION;
    lpLogPal->palNumEntries = (WORD) nColors;

    // Copy the current system palette into our logical palette

    GetSystemPaletteEntries(hDC, 0, nColors,
            (LPPALETTEENTRY)(lpLogPal->palPalEntry));

    // Go ahead and create the palette.  Once it's created,
    // we no longer need the LOGPALETTE, so free it.

    hPal = CreatePalette(lpLogPal);

    // clean up

    GlobalUnlock(hLogPal);
    GlobalFree(hLogPal);
    ReleaseDC(NULL, hDC);

    return hPal;
}

int PalEntriesOnDevice ( HDC hDC )

Definition at line 781 of file Dibutil.c.

{
    int nColors;  // number of colors

    // Find out the number of colors on this device.

    nColors = (1 << (GetDeviceCaps(hDC, BITSPIXEL) * GetDeviceCaps(hDC, PLANES)));

    assert(nColors);
    return nColors;
}

WORD PaletteSize ( LPSTR lpDIB )

Definition at line 270 of file Dibutil.c.

{
  if (!lpDIB)
    return (WORD) 0;

    // calculate the size required by the palette
    if (IS_WIN30_DIB (lpDIB))
        return (DIBNumColors(lpDIB) * sizeof(RGBQUAD));
    else
        return (DIBNumColors(lpDIB) * sizeof(RGBTRIPLE));
}

Generated on Wed Nov 13 2024 16:53:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/WinCap32/Dibutil.h File Reference

  • Multimedia
  • Gdi
  • WinCap32
Defines | Functions

Dibutil.h File Reference

Go to the source code of this file.

Defines

#define | IS_WIN30_DIB(lpbi) ((*(LPDWORD)(lpbi)) == sizeof(BITMAPINFOHEADER))
#define | PALVERSION 0x300
#define | RECTHEIGHT(lpRect) ((lpRect)->bottom - (lpRect)->top)
#define | RECTWIDTH(lpRect) ((lpRect)->right - (lpRect)->left)

Functions

HANDLE | AllocRoomForDIB (BITMAPINFOHEADER bi, HBITMAP hBitmap)

Define Documentation

#define IS_WIN30_DIB ( lpbi ) ((*(LPDWORD)(lpbi)) == sizeof(BITMAPINFOHEADER))

Definition at line 20 of file Dibutil.h.

#define PALVERSION 0x300

Definition at line 17 of file Dibutil.h.

#define RECTHEIGHT ( lpRect ) ((lpRect)->bottom - (lpRect)->top)

Definition at line 22 of file Dibutil.h.

#define RECTWIDTH ( lpRect ) ((lpRect)->right - (lpRect)->left)

Definition at line 21 of file Dibutil.h.

Function Documentation

HANDLE AllocRoomForDIB | ( | BITMAPINFOHEADER | bi,
 |  | HBITMAP | hBitmap
 | ) |  |

Definition at line 894 of file Dibutil.c.

{
    DWORD               dwLen;
    HANDLE              hDIB;
    HDC                 hDC;
    LPBITMAPINFOHEADER  lpbi;
    HANDLE              hTemp;

    // Figure out the size needed to hold the BITMAPINFO structure
    // (which includes the BITMAPINFOHEADER and the color table).

    dwLen = bi.biSize + PaletteSize((LPSTR) &bi);
    hDIB  = GlobalAlloc(GHND,dwLen);

    // Check that DIB handle is valid

    if (!hDIB)
        return NULL;

    // Set up the BITMAPINFOHEADER in the newly allocated global memory,
    // then call GetDIBits() with lpBits = NULL to have it fill in the
    // biSizeImage field for us.

    lpbi  = (LPBITMAPINFOHEADER)GlobalLock(hDIB);
    *lpbi = bi;

    hDC   = GetDC(NULL);

    GetDIBits(hDC, hBitmap, 0, (UINT) bi.biHeight, NULL, (LPBITMAPINFO)lpbi,
            DIB_RGB_COLORS);
    ReleaseDC(NULL, hDC);

    // If the driver did not fill in the biSizeImage field,
    // fill it in -- NOTE: this is a bug in the driver!

    if (lpbi->biSizeImage == 0)
        lpbi->biSizeImage = WIDTHBYTES((DWORD)lpbi->biWidth *
                lpbi->biBitCount) * lpbi->biHeight;

    // Get the size of the memory block we need

    dwLen = lpbi->biSize + PaletteSize((LPSTR) &bi) + lpbi->biSizeImage;

    // Unlock the memory block

    GlobalUnlock(hDIB);

    // ReAlloc the buffer big enough to hold all the bits

    if (hTemp = GlobalReAlloc(hDIB,dwLen,0))
        return hTemp;
    else
    {
        // Else free memory block and return failure

        GlobalFree(hDIB);
        return NULL;
    }
}

Generated on Wed Nov 13 2024 16:53:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/WinCap32/Dlgopen.c File Reference

  • Multimedia
  • Gdi
  • WinCap32
Defines | Functions | Variables

Dlgopen.c File Reference

#include <windows.h>
#include "wincap.h"
#include "dialogs.h"
#include "resource.h"
#include "commdlg.h"
#include "dlgs.h"

Go to the source code of this file.

Defines

#define | MAXFILENAMELEN 144
#define | STRICT

Functions

BOOL APIENTRY | FileSaveHookProc (HWND hDlg, WORD msg, WPARAM wParam, LPARAM lParam)
BOOL | GetFileName (HWND hWndOwner, LPSTR szFileName, PDWORD_PTR dwFlags)

Variables

HANDLE ghInst
UINT guiFileOKMsg

Define Documentation

#define MAXFILENAMELEN 144

Definition at line 25 of file Dlgopen.c.

#define STRICT

Definition at line 16 of file Dlgopen.c.

Function Documentation

BOOL APIENTRY FileSaveHookProc | ( | HWND | hDlg,
 |  | WORD | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 154 of file Dlgopen.c.

{
    HWND                    hGroup;
    RECT                    rect, DlgRect;
    static LPOPENFILENAME   lpOpenFn;
    static DWORD_PTR        dwFlags;

    if (wParam == guiFileOKMsg)
    {
        WORD    biStyle, biBits;

        if (SendDlgItemMessage (hDlg, IDD_RGB, BM_GETCHECK, 0, 0L))
            biStyle = IDD_RGB;

        else if (SendDlgItemMessage (hDlg, IDD_RLE4, BM_GETCHECK, 0, 0L))
            biStyle = IDD_RLE4;

        else
            biStyle = IDD_RLE8;

        if (SendDlgItemMessage (hDlg, IDD_1, BM_GETCHECK, 0, 0L))
            biBits = 1;

        else if (SendDlgItemMessage (hDlg, IDD_4, BM_GETCHECK, 0, 0L))
            biBits = 4;

        else if (SendDlgItemMessage (hDlg, IDD_8, BM_GETCHECK, 0, 0L))
            biBits = 8;

        else
            biBits = 24;

        // Copy result of user input to our lCustData field, which
        // will pass it back to the calling function.

        lpOpenFn->lCustData = MAKELONG(biStyle, biBits);
        return FALSE;
    }

    switch (msg)
    {
        case WM_INITDIALOG:

            //  Get the memory handle stored in the extra words.
            //  From this, insert the filename, and the file format

            // Retrieve flags which we passed in in lCustData

            lpOpenFn = (LPOPENFILENAME)lParam;
            dwFlags = lpOpenFn->lCustData;

            // Our dwFlags field contains the following:
            //
            // HIWORD: Bits per pixel specification.  Should be set to
            //    one of the following: 1, 4, 8, or 24
            //
            // LOWORD: Compression specification:  Should be set to one of
            //    the following:   IDD_RGB, IDD_RLE4, IDD_RLE8

            switch (LOWORD(dwFlags))
            {
                case IDD_RGB:
                    SendDlgItemMessage (hDlg, IDD_RGB,  BM_SETCHECK, 1, 0L);
                    SendMessage (hDlg, WM_COMMAND, IDD_RGB, 0L);
                    break;

                case IDD_RLE4:
                    SendDlgItemMessage (hDlg, IDD_RLE4, BM_SETCHECK, 1, 0L);
                    SendMessage (hDlg, WM_COMMAND, IDD_RLE4, 0L);
                    break;

                case IDD_RLE8:

                default:
                    SendDlgItemMessage (hDlg, IDD_RLE8, BM_SETCHECK, 1, 0L);
                    SendMessage (hDlg, WM_COMMAND, IDD_RLE8, 0L);
                    break;
            }

            switch (HIWORD(dwFlags))
            {
                case 4:
                    SendDlgItemMessage (hDlg, IDD_4,   BM_SETCHECK, 1, 0L);
                    break;

                case 8:
                    SendDlgItemMessage (hDlg, IDD_8,   BM_SETCHECK, 1, 0L);
                    break;

                case 24:
                    SendDlgItemMessage (hDlg, IDD_24,  BM_SETCHECK, 1, 0L);
                    break;

                case 1:

                default:
                    SendDlgItemMessage (hDlg, IDD_1,   BM_SETCHECK, 1, 0L);
                    break;
            }

            // Return 1 so Windows sets focus on a control in our dialog.

            return 1;

        case WM_COMMAND:
            switch (wParam)
            {

            case IDD_FILETYPE:
                hGroup = GetDlgItem (hDlg, IDD_FILETYPEGROUP);
                GetWindowRect (hGroup, &rect);
                GetWindowRect (hDlg, &DlgRect);
                SetWindowPos (hDlg,0, DlgRect.left, DlgRect.top,
                        (DlgRect.right-DlgRect.left),
                        (rect.bottom+(rect.left-DlgRect.left)-DlgRect.top),
                        SWP_NOMOVE | SWP_NOZORDER);
                EnableWindow (GetDlgItem (hDlg, IDD_FILETYPE), 0);
                SetFocus (hGroup);
                break;

            case IDD_RLE4:
                if (SendDlgItemMessage (hDlg, IDD_1, BM_GETCHECK, 0, 0L))
                    SendDlgItemMessage (hDlg, IDD_1, BM_SETCHECK, 0,0L);
                if (SendDlgItemMessage (hDlg, IDD_8, BM_GETCHECK, 0, 0L))
                    SendDlgItemMessage (hDlg, IDD_8, BM_SETCHECK, 0,0L);
                if (SendDlgItemMessage (hDlg, IDD_24, BM_GETCHECK, 0, 0L))
                    SendDlgItemMessage (hDlg, IDD_24, BM_SETCHECK, 0,0L);

                EnableWindow (GetDlgItem(hDlg, IDD_4), 1);
                SendDlgItemMessage (hDlg, IDD_4, BM_SETCHECK, 1, 0L);
                EnableWindow (GetDlgItem(hDlg, IDD_1), 0);
                EnableWindow (GetDlgItem(hDlg, IDD_8), 0);
                EnableWindow (GetDlgItem(hDlg, IDD_24), 0);
                break;

            case IDD_RLE8:
                if (SendDlgItemMessage (hDlg, IDD_1, BM_GETCHECK, 0, 0L))
                    SendDlgItemMessage (hDlg, IDD_1, BM_SETCHECK, 0,0L);
                if (SendDlgItemMessage (hDlg, IDD_4, BM_GETCHECK, 0, 0L))
                    SendDlgItemMessage (hDlg, IDD_4, BM_SETCHECK, 0,0L);
                if (SendDlgItemMessage (hDlg, IDD_24, BM_GETCHECK, 0, 0L))
                    SendDlgItemMessage (hDlg, IDD_24, BM_SETCHECK, 0,0L);

                EnableWindow (GetDlgItem(hDlg, IDD_8), 1);
                SendDlgItemMessage (hDlg, IDD_8, BM_SETCHECK, 1, 0L);
                EnableWindow (GetDlgItem(hDlg, IDD_1), 0);
                EnableWindow (GetDlgItem(hDlg, IDD_4), 0);
                EnableWindow (GetDlgItem(hDlg, IDD_24), 0);
                break;

            case IDD_RGB:
                EnableWindow (GetDlgItem(hDlg, IDD_1), 1);
                EnableWindow (GetDlgItem(hDlg, IDD_4), 2);
                EnableWindow (GetDlgItem(hDlg, IDD_8), 3);
                EnableWindow (GetDlgItem(hDlg, IDD_24), 1);
                break;

            break;
        }

        default:
            break;
    }
    return FALSE;
}

BOOL GetFileName | ( | HWND | hWndOwner,
 |  | LPSTR | szFileName,
 |  | PDWORD_PTR | dwFlags
 | ) |  |

Definition at line 55 of file Dlgopen.c.

{
    OPENFILENAME   of;
    DWORD          flags;
    static char    szTitle[50];         // Dialog Box title
    static char    szFile[MAXFILENAMELEN];         // File name
    DWORD_PTR      dw = 0;               // Local copy of flags for validation
    BOOL           bReturn;             // Return code
    DWORD_PTR      dwLocalOpt;
    CHAR           lpBuffer[128];       // Holds strings retrieved from resources

    // Parameter validation -- try to recover gracefully if LPWORD
    // is NULL, so we don't die when we try to do a *wFlags = x below

  if (!szFileName)
    return FALSE;

    if (dwFlags == NULL)
        dwFlags = &dw;

    dwLocalOpt = *dwFlags;  // Make local copy of options

    // Initialize the OPENFILENAME members

    lstrcpyn(szFile, "*.BMP", 6); // copy the extension over to the file
  szFile[5] = '\0';

    LoadString(ghInst, IDS_SAVEASTITLE, (LPSTR)szTitle, 50);
    LoadString(ghInst, IDS_SAVEFILTER, lpBuffer, sizeof(lpBuffer));
    flags = OFN_ENABLEHOOK | OFN_ENABLETEMPLATE | OFN_HIDEREADONLY |
            OFN_OVERWRITEPROMPT;

    of.lStructSize       = sizeof (OPENFILENAME);
    of.hwndOwner         = hWndOwner;
    of.hInstance         = ghInst;
    of.lpstrFilter       = lpBuffer;
    of.lpstrCustomFilter = NULL;
    of.nMaxCustFilter    = 0L;
    of.nFilterIndex      = 1L;
    of.lpstrFile         = (LPSTR)szFile;
    of.nMaxFile          = MAXFILENAMELEN;
    of.lpstrFileTitle    = NULL;
    of.nMaxFileTitle     = 0;
    of.lpstrInitialDir   = NULL;
    of.lpstrTitle        = szTitle;
    of.Flags             = flags;
    of.nFileOffset       = 0;
    of.nFileExtension    = 0;
    of.lpstrDefExt       = "bmp";
    of.lpfnHook          = (LPOFNHOOKPROC)FileSaveHookProc;
    of.lpTemplateName    = (LPSTR)"FILESAVE";

    // Place our flags in the lCustData parameter

    of.lCustData         = dwLocalOpt;

    // Call the GetSaveFilename function

    if (GetSaveFileName (&of))
    {
        // User pressed OK, continue on

        bReturn = TRUE;

        // Copy filename out

        lstrcpyn (szFileName, of.lpstrFile, MAXFILENAMELEN );  // This is the most the file itself can take.  szFileName is 255, of.lpstrFile is 144
    szFileName[ sizeof(szFileName) - 1 ] = '\0';

        // Copy flags out

        *dwFlags = of.lCustData;

    }
    else
    {
    MessageBox(hWndOwner,TEXT("An error occurred while saving the file."), TEXT("Error in Save"), MB_OK);
        bReturn = FALSE;
        szFileName[0] = '\0';
        *dwFlags = 0;
    }

    return bReturn;
}

Variable Documentation

HANDLE ghInst

Name of app.

Definition at line 24 of file ole2ui.c.

UINT guiFileOKMsg

Definition at line 73 of file WinCap.c.

Generated on Wed Nov 13 2024 16:53:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/WinCap32/Dllinit.c File Reference

  • Multimedia
  • Gdi
  • WinCap32
Defines | Functions | Variables

Dllinit.c File Reference

#include <windows.h>
#include "dibdll.h"

Go to the source code of this file.

Defines

#define | STRICT

Functions

BOOL WINAPI | DllMain (HANDLE hModule, DWORD dwFunction, LPVOID lpNot)

Variables

HANDLE | ghDLLInst = 0
HWND | ghWndMain = 0
WORD | nLangID

Define Documentation

#define STRICT

Definition at line 14 of file Dllinit.c.

Function Documentation

BOOL WINAPI DllMain | ( | HANDLE | hModule,
 |  | DWORD | dwFunction,
 |  | LPVOID | lpNot
 | ) |  |

Definition at line 29 of file Dllinit.c.

{
    ghDLLInst = hModule;

    switch (dwFunction)
    {
        case DLL_PROCESS_ATTACH:
            nLangID = PRIMARYLANGID(GetUserDefaultLangID());
            break;

        case DLL_PROCESS_DETACH:

               // When we are finally going away, do something here

        default:
            break;
    }
    return TRUE;
}

Variable Documentation

HANDLE ghDLLInst = 0

Definition at line 24 of file Dllinit.c.

HWND ghWndMain = 0

Handle to instance.

Definition at line 20 of file Dllinit.c.

WORD nLangID

Definition at line 25 of file Dllinit.c.

Generated on Wed Nov 13 2024 16:53:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/WinCap32/Errors.c File Reference

  • Multimedia
  • Gdi
  • WinCap32
Defines | Functions | Variables

Errors.c File Reference

#include <windows.h>
#include "dibapi.h"

Go to the source code of this file.

Defines

#define | STRICT

Functions

void | DIBError (int ErrNo)

Variables

WORD | nLangID

Define Documentation

#define STRICT

Definition at line 12 of file Errors.c.

Function Documentation

void DIBError ( int ErrNo )

Definition at line 70 of file Errors.c.

{
    if (nLangID == LANG_JAPANESE) {
        if ((ErrNo < ERR_MIN) || (ErrNo >= ERR_MAX))
            MessageBox(NULL, "–¢’m‚ÌƒGƒ‰[B", NULL, MB_OK | MB_ICONHAND);
        else
            MessageBox(NULL, szErrorsJ[ErrNo], NULL, MB_OK | MB_ICONHAND);
    }
    else {
        if ((ErrNo < ERR_MIN) || (ErrNo >= ERR_MAX))
            MessageBox(NULL, "Undefined Error!", NULL, MB_OK | MB_ICONHAND);
        else
            MessageBox(NULL, szErrors[ErrNo], NULL, MB_OK | MB_ICONHAND);
    }
}

Variable Documentation

WORD nLangID

Definition at line 25 of file Dllinit.c.

Generated on Wed Nov 13 2024 16:53:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/WinCap32/File.c File Reference

  • Multimedia
  • Gdi
  • WinCap32
Defines | Functions

File.c File Reference

#include <windows.h>
#include <string.h>
#include <stdio.h>
#include <math.h>
#include <io.h>
#include <direct.h>
#include <stdlib.h>
#include "dibutil.h"
#include "dibapi.h"

Go to the source code of this file.

Defines

#define | DIB_HEADER_MARKER ((WORD) ('M' << 8) | 'B')
#define | STRICT

Functions

WORD | DestroyDIB (HDIB hDib)
HDIB | LoadDIB (LPSTR lpFileName)
HANDLE ReadDIBFile (HANDLE)
WORD | SaveDIB (HDIB hDib, LPSTR lpFileName)
BOOL | SaveDIBFile (void)
BOOL WriteDIB (LPSTR, HANDLE)

Define Documentation

#define DIB_HEADER_MARKER ((WORD) ('M' << 8) | 'B')

Definition at line 31 of file File.c.

#define STRICT

Definition at line 16 of file File.c.

Function Documentation

WORD DestroyDIB ( HDIB hDib )

Definition at line 262 of file File.c.

{
    GlobalFree(hDib);
    return 0;
}

HDIB LoadDIB ( LPSTR lpFileName )

Definition at line 64 of file File.c.

{
    HDIB        hDIB;
    HANDLE      hFile;

  if (!lpFileName)
    return NULL;

    // Set the cursor to a hourglass, in case the loading operation
    // takes more than a sec, the user will know what's going on.

    SetCursor(LoadCursor(NULL, IDC_WAIT));

  // Create File with security related attributes
    hFile = CreateFile(lpFileName, GENERIC_READ, FILE_SHARE_READ, NULL,
            OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN | SECURITY_ANONYMOUS | SECURITY_SQOS_PRESENT, /* security level checks */
            NULL);

  if (INVALID_HANDLE_VALUE == hFile)    //Unable to open File, quit load
    return NULL;

  if ( GetFileType(hFile) != FILE_TYPE_DISK )
  {
    CloseHandle(hFile);
        DIBError(ERR_FILENOTFOUND);
        SetCursor(LoadCursor(NULL, IDC_ARROW));
        return NULL;
    }
    else
  {
        hDIB = ReadDIBFile(hFile);
        CloseHandle(hFile);
        SetCursor(LoadCursor(NULL, IDC_ARROW));
        return hDIB;
    }

}

HANDLE ReadDIBFile ( HANDLE hFile )

Definition at line 296 of file File.c.

{
    BITMAPFILEHEADER    bmfHeader;
    DWORD               dwBitsSize;
    UINT                nNumColors;   // Number of colors in table
    HANDLE              hDIB;
    HANDLE              hDIBtmp;      // Used for GlobalRealloc() //MPB
    LPBITMAPINFOHEADER  lpbi;
    DWORD               offBits;
    DWORD               dwRead;

  if (!hFile)
    return NULL;

    // get length of DIB in bytes for use when reading

    dwBitsSize = GetFileSize(hFile, NULL);

    // Allocate memory for header & color table. We'll enlarge this
    // memory as needed.

    hDIB = GlobalAlloc(GMEM_MOVEABLE, (DWORD)(sizeof(BITMAPINFOHEADER) +
            256 * sizeof(RGBQUAD)));

    if (!hDIB)
        return NULL;

    lpbi = (LPBITMAPINFOHEADER)GlobalLock(hDIB);

    if (!lpbi)
    {
        GlobalFree(hDIB);
        return NULL;
    }

    // read the BITMAPFILEHEADER from our file

    if (!ReadFile(hFile, (LPSTR)&bmfHeader, sizeof (BITMAPFILEHEADER),
            &dwRead, NULL))
        goto ErrExit;

    if (sizeof (BITMAPFILEHEADER) != dwRead)
        goto ErrExit;

    if (bmfHeader.bfType != 0x4d42)  // 'BM'
        goto ErrExit;

    // read the BITMAPINFOHEADER

    if (!ReadFile(hFile, (LPSTR)lpbi, sizeof(BITMAPINFOHEADER), &dwRead,
            NULL))
        goto ErrExit;

    if (sizeof(BITMAPINFOHEADER) != dwRead)
        goto ErrExit;

    // Check to see that it's a Windows DIB -- an OS/2 DIB would cause
    // strange problems with the rest of the DIB API since the fields
    // in the header are different and the color table entries are
    // smaller.
    //
    // If it's not a Windows DIB (e.g. if biSize is wrong), return NULL.

    if (lpbi->biSize == sizeof(BITMAPCOREHEADER))
        goto ErrExit;

    // Now determine the size of the color table and read it.  Since the
    // bitmap bits are offset in the file by bfOffBits, we need to do some
    // special processing here to make sure the bits directly follow
    // the color table (because that's the format we are susposed to pass
    // back)

    if (!(nNumColors = (UINT)lpbi->biClrUsed))
    {
        // no color table for 24-bit, default size otherwise

        if (lpbi->biBitCount != 24)
            nNumColors = 1 << lpbi->biBitCount; // standard size table
    }

    // fill in some default values if they are zero

    if (lpbi->biClrUsed == 0)
        lpbi->biClrUsed = nNumColors;

    if (lpbi->biSizeImage == 0)
    {
        lpbi->biSizeImage = ((((lpbi->biWidth * (DWORD)lpbi->biBitCount) +
                31) & ~31) >> 3) * lpbi->biHeight;
    }

    // get a proper-sized buffer for header, color table and bits

    GlobalUnlock(hDIB);
    hDIBtmp = GlobalReAlloc(hDIB, lpbi->biSize + nNumColors *
            sizeof(RGBQUAD) + lpbi->biSizeImage, 0);

    if (!hDIBtmp) // can't resize buffer for loading
        goto ErrExitNoUnlock; //MPB
    else
        hDIB = hDIBtmp;

    lpbi = (LPBITMAPINFOHEADER)GlobalLock(hDIB);

    // read the color table

    ReadFile (hFile, (LPSTR)(lpbi) + lpbi->biSize,
            nNumColors * sizeof(RGBQUAD), &dwRead, NULL);

    // offset to the bits from start of DIB header

    offBits = lpbi->biSize + nNumColors * sizeof(RGBQUAD);

    // If the bfOffBits field is non-zero, then the bits might *not* be
    // directly following the color table in the file.  Use the value in
    // bfOffBits to seek the bits.

    if (bmfHeader.bfOffBits != 0L)
        SetFilePointer(hFile, bmfHeader.bfOffBits, NULL, FILE_BEGIN);

    if (ReadFile(hFile, (LPSTR)lpbi + offBits, lpbi->biSizeImage, &dwRead,
            NULL))
        goto OKExit;

ErrExit:
    GlobalUnlock(hDIB);

ErrExitNoUnlock:
    GlobalFree(hDIB);
    return NULL;

OKExit:
    GlobalUnlock(hDIB);
    return hDIB;
}

WORD SaveDIB | ( | HDIB | hDib,
 |  | LPSTR | lpFileName
 | ) |  |

Definition at line 124 of file File.c.

{
    BITMAPFILEHEADER    bmfHdr;     // Header for Bitmap file
    LPBITMAPINFOHEADER  lpBI;       // Pointer to DIB info structure
    HANDLE              fh;         // file handle for opened file
    DWORD               dwDIBSize;
    DWORD               dwWritten;

    if (!hDib)
        return ERR_INVALIDHANDLE;

  if (!lpFileName)
    return ERR_FILENOTFOUND;

    fh = CreateFile(lpFileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
            FILE_FLAG_SEQUENTIAL_SCAN | SECURITY_ANONYMOUS | SECURITY_SQOS_PRESENT, NULL);

    if (fh == INVALID_HANDLE_VALUE)
        return ERR_OPEN;

  if ( GetFileType(fh) != FILE_TYPE_DISK )
  {
      CloseHandle(fh);
      return ERR_OPEN;
  }

    // Get a pointer to the DIB memory, the first of which contains
    // a BITMAPINFO structure

    lpBI = (LPBITMAPINFOHEADER)GlobalLock(hDib);
    if (!lpBI)
    {
        CloseHandle(fh);
        return ERR_LOCK;
    }

    // Check to see if we're dealing with an OS/2 DIB.  If so, don't
    // save it because our functions aren't written to deal with these
    // DIBs.

    if (lpBI->biSize != sizeof(BITMAPINFOHEADER))
    {
        GlobalUnlock(hDib);
        CloseHandle(fh);
        return ERR_NOT_DIB;
    }

    // Fill in the fields of the file header

    // Fill in file type (first 2 bytes must be "BM" for a bitmap)

    bmfHdr.bfType = DIB_HEADER_MARKER;  // "BM"

    // Calculating the size of the DIB is a bit tricky (if we want to
    // do it right).  The easiest way to do this is to call GlobalSize()
    // on our global handle, but since the size of our global memory may have
    // been padded a few bytes, we may end up writing out a few too
    // many bytes to the file (which may cause problems with some apps,
    // like HC 3.0).
    //
    // So, instead let's calculate the size manually.
    //
    // To do this, find size of header plus size of color table.  Since the
    // first DWORD in both BITMAPINFOHEADER and BITMAPCOREHEADER conains
    // the size of the structure, let's use this.

    // Partial Calculation

    dwDIBSize = *(LPDWORD)lpBI + PaletteSize((LPSTR)lpBI);

    // Now calculate the size of the image

    // It's an RLE bitmap, we can't calculate size, so trust the biSizeImage
    // field

    if ((lpBI->biCompression == BI_RLE8) || (lpBI->biCompression == BI_RLE4))
        dwDIBSize += lpBI->biSizeImage;
    else
    {
        DWORD dwBmBitsSize;  // Size of Bitmap Bits only

        // It's not RLE, so size is Width (DWORD aligned) * Height

        dwBmBitsSize = WIDTHBYTES((lpBI->biWidth)*((DWORD)lpBI->biBitCount)) *
                lpBI->biHeight;

        dwDIBSize += dwBmBitsSize;

        // Now, since we have calculated the correct size, why don't we
        // fill in the biSizeImage field (this will fix any .BMP files which
        // have this field incorrect).

        lpBI->biSizeImage = dwBmBitsSize;
    }

    // Calculate the file size by adding the DIB size to sizeof(BITMAPFILEHEADER)

    bmfHdr.bfSize = dwDIBSize + sizeof(BITMAPFILEHEADER);
    bmfHdr.bfReserved1 = 0;
    bmfHdr.bfReserved2 = 0;

    // Now, calculate the offset the actual bitmap bits will be in
    // the file -- It's the Bitmap file header plus the DIB header,
    // plus the size of the color table.

    bmfHdr.bfOffBits = (DWORD)sizeof(BITMAPFILEHEADER) + lpBI->biSize +
            PaletteSize((LPSTR)lpBI);

    // Write the file header

    WriteFile(fh, (LPSTR)&bmfHdr, sizeof(BITMAPFILEHEADER), &dwWritten, NULL);

    // Write the DIB header and the bits -- use local version of
    // MyWrite, so we can write more than 32767 bytes of data

    WriteFile(fh, (LPSTR)lpBI, dwDIBSize, &dwWritten, NULL);

    GlobalUnlock(hDib);
    CloseHandle(fh);

    if (dwWritten == 0)
        return ERR_OPEN; // oops, something happened in the write
    else
        return 0; // Success code
}

BOOL SaveDIBFile ( void )
BOOL WriteDIB | ( | LPSTR | ,
 |  | HANDLE |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/WinCap32/Hook.c File Reference

  • Multimedia
  • Gdi
  • WinCap32
Defines | Functions | Variables

Hook.c File Reference

#include <windows.h>
#include "wincap.h"

Go to the source code of this file.

Defines

#define | STRICT

Functions

int APIENTRY | InstallHook (HWND hWnd, BOOL bCode)
LRESULT CALLBACK | KeyboardHook (int nCode, WORD wParam, DWORD lParam)

Variables

HANDLE ghDLLInst
HWND | ghWndMain

Define Documentation

#define STRICT

Definition at line 23 of file Hook.c.

Function Documentation

int APIENTRY InstallHook | ( | HWND | hWnd,
 |  | BOOL | bCode
 | ) |  |

Definition at line 62 of file Hook.c.

{

    int nReturn = 1;

    ghWndMain = hWnd;  // Store app's window handle in DLL global variable

    // Make sure that we are installing/removing in the proper order

    if (bCode == bHookInstalled)
        return 0;

    if (bCode)
    {
        hHook = (HHOOK)SetWindowsHookEx(WH_KEYBOARD,(HOOKPROC)KeyboardHook,
            ghDLLInst, 0);

        if (!hHook)
            return 0;

        bHookInstalled = TRUE;
    }
    else
    {
        nReturn = UnhookWindowsHookEx(hHook);
        bHookInstalled = FALSE;
    }
    return nReturn;
}

LRESULT CALLBACK KeyboardHook | ( | int | nCode,
 |  | WORD | wParam,
 |  | DWORD | lParam
 | ) |  |

Definition at line 114 of file Hook.c.

{

    if ( nCode >= 0 )
    {

        // Check to see if it's a key we're looking for

        if (GetKeyState(VK_SHIFT) < 0 && GetKeyState(VK_CONTROL) < 0)
        {
            switch (wParam)
            {

//      MENUITEM    "&Active Window \aCtrl+Shift+F9",  IDM_ACTIVEWINDOW
//      MENUITEM    "&Desktop\aCtrl+Shift+F10",       IDM_DESKTOP

                case VK_F9:
                    if (HIWORD(lParam) & 0x8000)
                        PostMessage(ghWndMain, WM_COMMAND, IDM_ACTIVEWINDOW, 0L);
                    return 1;

                case VK_F10:

                    if (HIWORD(lParam) & 0x8000)
                        PostMessage(ghWndMain, WM_COMMAND, IDM_DESKTOP, 0L);
                    return 1;
            }
        }
   }

   //
   // If we haven't returned 1 by the time we get here, then we
   // need to pass on the message to CallNextHookEx.
   //
   return (int)CallNextHookEx(hHook, nCode, wParam, lParam);
}

Variable Documentation

HANDLE ghDLLInst

Definition at line 24 of file Dllinit.c.

HWND ghWndMain

Handle to instance.

Definition at line 20 of file Dllinit.c.

Generated on Wed Nov 13 2024 16:53:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/WinCap32/Print.c File Reference

  • Multimedia
  • Gdi
  • WinCap32
Classes | Defines | Functions | Variables

Print.c File Reference

#include <windows.h>
#include <commdlg.h>
#include <stdio.h>
#include <string.h>
#include "dibdll.h"
#include "dibapi.h"
#include "dibutil.h"

Go to the source code of this file.

Classes

struct | BANDINFOSTRUCT

Defines

#define | STRICT

Functions

void | CalculatePrintRect (HDC, LPRECT, WORD, DWORD, DWORD)
HDC | GetPrinterDC (void)
int CALLBACK | PrintAbortDlg (HWND, UINT, WPARAM, LPARAM)
BOOL CALLBACK | PrintAbortProc (HDC, int)
WORD | PrintBand (HDC, LPRECT, LPRECT, BOOL, BOOL, LPBITMAPINFOHEADER, LPSTR)
WORD | PrintDIB (HDIB hDib, WORD fPrintOpt, WORD wXScale, WORD wYScale, LPSTR szJobName)
WORD | PrintScreen (LPRECT rRegion, WORD fPrintOpt, WORD wXScale, WORD wYScale, LPSTR szJobName)
WORD | PrintWindowSamp (HWND hWnd, WORD fPrintArea, WORD fPrintOpt, WORD wXScale, WORD wYScale, LPSTR szJobName)

Variables

BOOL | bAbort = FALSE
HANDLE ghDLLInst
char | gszDevice [50]
char | gszOutput [50]
HWND | hDlgAbort
char | szPrintDlg [] = "PRINTING"

Define Documentation

#define STRICT

Definition at line 16 of file Print.c.

Function Documentation

void CalculatePrintRect | ( | HDC | hDC,
 |  | LPRECT | lpPrintRect,
 |  | WORD | fPrintOpt,
 |  | DWORD | cxDIB,
 |  | DWORD | cyDIB
 | ) |  |

Definition at line 433 of file Print.c.

{
    int  cxPage, cyPage, cxInch, cyInch;

    if (!hDC)
        return;

    // Get some info from printer driver

    cxPage = GetDeviceCaps(hDC, HORZRES);   // Width of printr page - pixels
    cyPage = GetDeviceCaps(hDC, VERTRES);   // Height of printr page - pixels
    cxInch = GetDeviceCaps(hDC, LOGPIXELSX);// Printer pixels per inch - X
    cyInch = GetDeviceCaps(hDC, LOGPIXELSY);// Printer pixels per inch - Y

    switch (fPrintOpt)
    {

        // Best Fit case -- create a rectangle which preserves
        // the DIB's aspect ratio, and fills the page horizontally.

        // The formula in the "->bottom" field below calculates the Y
        // position of the printed bitmap, based on the size of the
        // bitmap, the width of the page, and the relative size of
        // a printed pixel (cyInch / cxInch).

        case PW_BESTFIT:
            lpPrintRect->top = 0;
            lpPrintRect->left = 0;
            lpPrintRect->bottom = (int)(((double)cyDIB * cxPage * cyInch) /
                    ((double)cxDIB * cxInch));
            lpPrintRect->right = cxPage;
            break;

        // Scaling option -- lpPrintRect's top/left contain
        // multipliers to multiply the DIB's height/width by.

        case PW_SCALE:
        {
            int     cxMult, cyMult;

            cxMult = lpPrintRect->left;
            cyMult = lpPrintRect->top;
            lpPrintRect->top = 0;
            lpPrintRect->left = 0;
            lpPrintRect->bottom = (int)(cyDIB * cyMult);
            lpPrintRect->right = (int)(cxDIB * cxMult);
            break;
        }

        // Stretch To Page case -- create a rectangle
        // which covers the entire printing page (note that this
        // is also the default).

        case PW_STRETCHTOPAGE:

        default:
            lpPrintRect->top = 0;
            lpPrintRect->left = 0;
            lpPrintRect->bottom = cyPage;
            lpPrintRect->right = cxPage;
            break;
    }
}

HDC GetPrinterDC ( void )

Definition at line 573 of file Print.c.

                   {

    PRINTDLG pd;

    ZeroMemory(&pd, sizeof(pd));

    pd.lStructSize = sizeof(PRINTDLG);
    pd.Flags = PD_RETURNDC;

    if (PrintDlg(&pd) == TRUE)
    {
        DEVNAMES    *pDevNames = GlobalLock(pd.hDevNames);

        lstrcpyn((LPSTR)gszDevice,
                (LPSTR)((char *)pDevNames+pDevNames->wDeviceOffset),
        sizeof(gszDevice) - 1);

    gszDevice[sizeof(gszDevice) - 1] = '\0';

        if(!lstrcmpi((LPSTR)((char *)pDevNames+pDevNames->wDeviceOffset),
                (LPSTR)((char *)pDevNames+pDevNames->wOutputOffset)))
    {
            lstrcpyn((LPSTR)gszOutput, "net:", 5);
      gszOutput[4] = '\0';
    }
        else
    {
            lstrcpyn((LPSTR)gszOutput,
                    (LPSTR)((char *)pDevNames+pDevNames->wOutputOffset),
          sizeof(gszOutput) - 1);
            gszOutput[sizeof(gszOutput) - 1] = '\0';
    }

        GlobalUnlock(pd.hDevNames);
        return pd.hDC;
    }

    else
        return NULL;
}

int CALLBACK PrintAbortDlg | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 651 of file Print.c.

{
    switch (msg)
    {
        case WM_INITDIALOG:
        {
            char szBuffer[100];
            CHAR msgBuffer[128];

            // Fill in the text which specifies where this bitmap
            // is going ("on HP LaserJet on LPT1", for example)
            LoadString(ghDLLInst, IDS_ABORTSTRING, msgBuffer, sizeof(msgBuffer));
            _snprintf(szBuffer, sizeof(szBuffer) - 1, msgBuffer, (LPSTR)gszDevice,
                    (LPSTR)gszOutput);
      szBuffer[sizeof(szBuffer) - 1] = '\0';
            SetDlgItemText(hWnd, IDC_PRINTTEXT2, (LPSTR)szBuffer);
            SetFocus(GetDlgItem(hWnd, IDCANCEL));
            return TRUE;     // Return TRUE because we called SetFocus()
        }

        case WM_COMMAND:
            bAbort = TRUE;
            DestroyWindow(hWnd);
            return TRUE;
            break;
    }

    return FALSE;
}

BOOL CALLBACK PrintAbortProc | ( | HDC | hDC,
 |  | int | code
 | ) |  |

Definition at line 624 of file Print.c.

{
    MSG  msg;

    while (!bAbort && PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
        if (!IsDialogMessage(hDlgAbort, &msg))
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }

    return !bAbort;
}

WORD PrintBand | ( | HDC | hDC,
 |  | LPRECT | lpRectOut,
 |  | LPRECT | lpRectClip,
 |  | BOOL | fDoText,
 |  | BOOL | fDoGraphics,
 |  | LPBITMAPINFOHEADER | lpDIBHdr,
 |  | LPSTR | lpDIBBits
 | ) |  |

Definition at line 514 of file Print.c.

{
    RECT    rect;           // Temporary rectangle
    double  dblXScaling,    // X and Y scaling factors
            dblYScaling;
    WORD    wReturn = 0;    // Return code

    if (fDoGraphics)
    {
        dblXScaling = ((double)lpRectOut->right - lpRectOut->left) / (double)
                lpDIBHdr->biWidth;
        dblYScaling = ((double)lpRectOut->bottom - lpRectOut->top) / (double)
                lpDIBHdr->biHeight;

        // Now we set up a temporary rectangle -- this rectangle
        // holds the coordinates on the paper where our bitmap
        // WILL be output.  We can intersect this rectangle with
        // the lpClipRect to see what we NEED to output to this
        // band.  Then, we determine the coordinates in the DIB
        // to which this rectangle corresponds (using dbl?Scaling).

        IntersectRect(&rect, lpRectOut, lpRectClip);
        if (!IsRectEmpty(&rect))
        {
            RECT    rectIn;

            rectIn.left = (int)((rect.left - lpRectOut->left) / dblXScaling +
                    0.5
                       );
            rectIn.top = (int)((rect.top - lpRectOut->top) / dblYScaling + 0.5);
            rectIn.right = (int)(rectIn.left + (rect.right - rect.left) /
                    dblXScaling + 0.5);
            rectIn.bottom = (int)(rectIn.top + (rect.bottom - rect.top) /
                    dblYScaling + 0.5);
            if (!StretchDIBits(hDC, rect.left, rect.top,
                    rect.right - rect.left, rect.bottom - rect.top,
                    rectIn.left, (int)(lpDIBHdr->biHeight) -
                    rectIn.top - (rectIn.bottom - rectIn.top),
                    rectIn.right - rectIn.left, rectIn.bottom - rectIn.top,
                    lpDIBBits, (LPBITMAPINFO)lpDIBHdr, DIB_RGB_COLORS,
                    SRCCOPY))
                wReturn = ERR_STRETCHDIBITS; // StretchDIBits() failed!
        }
    }

    return wReturn;
}

WORD PrintDIB | ( | HDIB | hDib,
 |  | WORD | fPrintOpt,
 |  | WORD | wXScale,
 |  | WORD | wYScale,
 |  | LPSTR | szJobName
 | ) |  |

Definition at line 214 of file Print.c.

{
    HDC                 hPrnDC;         // DC to the printer
    RECT                rect;           // Rect structure used for banding
    LPSTR               lpBits;         // pointer to the DIB bits
    LPBITMAPINFOHEADER  lpDIBHdr;       // Pointer to DIB header
    int                 nBandCount = 0; // used for print dialog box to count bands
    WORD                wErrorCode = 0; // Error code to return
    RECT                rPrintRect;     // specifies the area on the printer
                                        // (in printer coordinates) which we
                                        // want the DIB to go to
    char                szBuffer[70];   // Buffer to hold message for "Printing" dlg box
    char                szJobNameTrunc[35];     // szJobName truncated to 31
                                        // characters, since STARTDOC can't
                                        // accept a string longer than 31
    DOCINFO             DocInfo;        // structure for StartDoc
    int                 nTemp;          // used to check banding capability
    CHAR                lpBuffer[128];  // Buffer for strings retrieved from resources

    // Paramter validation

    if (!hDib)
        return ERR_INVALIDHANDLE;

    // Get pointer to DIB header

    lpDIBHdr = (LPBITMAPINFOHEADER)GlobalLock(hDib);
    if (!lpDIBHdr) // Check that we have a valid pointer
        return ERR_LOCK;
    lpBits = FindDIBBits((LPSTR)lpDIBHdr); // Find pointer to DIB bits

    if (hPrnDC = GetPrinterDC())
    {
        SetStretchBltMode(hPrnDC, COLORONCOLOR);

        // Determine rPrintRect (printer area to print to) from the
        // fPrintOpt.  Fill in rPrintRect.left and .top from wXScale and
        // wYScale just in case we use PW_SCALE (see the function
        // CalculatePrintRect).

        rPrintRect.left = wXScale;
        rPrintRect.top = wYScale;
        CalculatePrintRect(hPrnDC, &rPrintRect, fPrintOpt, lpDIBHdr->biWidth,
                         lpDIBHdr->biHeight);

        // Initialize the abort procedure.

        hDlgAbort = CreateDialog(ghDLLInst, szPrintDlg, GetFocus(),
                (DLGPROC)PrintAbortDlg);

        // ISet the text inside the dialog to the name of our print job

        lstrcpyn(szJobNameTrunc, szJobName, sizeof(szJobNameTrunc) - 1);
        szJobNameTrunc[31] = '\0';           // Truncate string to 31 chars
        LoadString(ghDLLInst, IDS_PRINTMSG, lpBuffer, sizeof(lpBuffer) );
        _snprintf(szBuffer, sizeof(szBuffer) - 1, lpBuffer, (LPSTR)szJobNameTrunc);
        SetDlgItemText(hDlgAbort, IDC_PRINTTEXT1, (LPSTR)szBuffer);

        // Set global variable bAbort to FALSE.  This will get set to TRUE
        // in our PrintAbortDlg() procedure if the user selects the
        // CANCEL button in our dialog box

        bAbort = FALSE;

        // set up the Abort Procedure

        if (SetAbortProc(hPrnDC, (ABORTPROC)PrintAbortProc) < 0)
                return ERR_SETABORTPROC;

        // start print job

        ZeroMemory(&DocInfo, sizeof(DOCINFO));
        DocInfo.cbSize = sizeof(DOCINFO);
        DocInfo.lpszDocName = (LPTSTR)szJobNameTrunc;
        DocInfo.lpszOutput = NULL;

        if (StartDoc(hPrnDC, &DocInfo) <= 0)
        {
            // Oops, something happened, let's clean up here and return

             DestroyWindow(hDlgAbort);   // Remove abort dialog box
             DeleteDC(hPrnDC);
             GlobalUnlock(hDib);
             return ERR_STARTDOC;
        }

// Note: the following banding code applies to Windows 3.1.  With the new
//       printing architecture of Win32, send out both the graphics and
//       text in one band (like a non-banding device).  This code is used
//       for Win32s since Win32s depends on Windows 3.1 printing architecture.
//
        // Check if need to do banding.  If we do, loop through
        // each band in the page, calling NEXTBAND and BANDINFO
        // (if supported) calling PrintBand() on the band.  Else,
        // call PrintBand() with the entire page as our clipping
        // rectangle!

        // If Wincap32 is running on Win32s, then use banding

        nTemp = NEXTBAND;
        if (Escape(hPrnDC, QUERYESCSUPPORT, sizeof(int), (LPSTR)&nTemp, NULL) &&
                (GetVersion() & 0x80000000) && (LOWORD(GetVersion()) == 3))
        {
            BOOL                bBandInfoDevice;
            BANDINFOSTRUCT      biBandInfo;         // Used for banding

            // Fill in initial values for our BandInfo Structure to
            // tell driver we can want to do graphics and text, and
            // also which area we want the graphics to go in.

            biBandInfo.bGraphics = TRUE;
            biBandInfo.bText = TRUE;
            biBandInfo.GraphicsRect = rPrintRect;

            // Check if device supports the BANDINFO escape.

            nTemp = BANDINFO;
            bBandInfoDevice = Escape(hPrnDC, QUERYESCSUPPORT, sizeof(int),
                    (LPSTR)&nTemp, NULL);

            // Do each band -- Call Escape() with NEXTBAND, then the
            // rect structure returned is the area where we are to
            // print in.  This loop exits when the rect area is empty.

            while (Escape(hPrnDC, NEXTBAND, 0, NULL, (LPSTR)&rect) && !
                IsRectEmpty(&rect))
            {
                char szTmpBuf[100];

                // Do the BANDINFO, if needed.

                if (bBandInfoDevice)
                    Escape(hPrnDC, BANDINFO, sizeof(BANDINFOSTRUCT), (LPSTR)&
                            biBandInfo, (LPSTR)&biBandInfo);
                LoadString(ghDLLInst, IDS_BANDNMBR, lpBuffer, sizeof(lpBuffer));
                _snprintf(szTmpBuf, sizeof(szTmpBuf) - 1, lpBuffer, ++nBandCount);
        szTmpBuf[sizeof(szTmpBuf) - 1] = '\0';
                SetDlgItemText(hDlgAbort, IDC_PERCENTAGE, (LPSTR)szTmpBuf);

                // Call PrintBand() to do actual output into band.
                // Pass in our band-info flags to tell what sort
                // of data to output into the band.  Note that on
                // non-banding devices, we pass in the default bandinfo
                // stuff set above (i.e. bText=TRUE, bGraphics=TRUE).

                wErrorCode = PrintBand(hPrnDC, &rPrintRect, &rect,
                        biBandInfo.bText, biBandInfo.bGraphics, lpDIBHdr,
                        lpBits);
            }
        }
        else
        {
            // Print the whole page -- non-banding device.

            if (StartPage(hPrnDC) <= 0)
                return ERR_STARTPAGE;

            rect = rPrintRect;
            LoadString(ghDLLInst, IDS_SENDINGBAND, lpBuffer, sizeof(lpBuffer));
            SetDlgItemText(hDlgAbort, IDC_PERCENTAGE, lpBuffer);
            wErrorCode = PrintBand(hPrnDC, &rPrintRect, &rect, TRUE, TRUE,
                    lpDIBHdr, lpBits);

            // Non-banding devices need a NEWFRAME

            if (EndPage(hPrnDC) <= 0)
                return ERR_ENDPAGE;
        }

        // End the print operation.  Only send the ENDDOC if
        //  we didn't abort or error.

        if (!bAbort)
        {
            // We errored out on ENDDOC, but don't return here - we still
            // need to close the dialog box, free proc instances, etc.

            if (EndDoc(hPrnDC) <= 0)
                wErrorCode = ERR_ENDDOC;

            DestroyWindow(hDlgAbort);
        }

        // All done, clean up.

        DeleteDC(hPrnDC);
    }
    else
        wErrorCode = ERR_GETDC;   // Couldn't get Printer DC!

    GlobalUnlock(hDib);
    return wErrorCode;
}

WORD PrintScreen | ( | LPRECT | rRegion,
 |  | WORD | fPrintOpt,
 |  | WORD | wXScale,
 |  | WORD | wYScale,
 |  | LPSTR | szJobName
 | ) |  |

Definition at line 151 of file Print.c.

{
    HDIB     hDib;          // A Handle to our DIB
    WORD     wReturn;       // Return value

    // Copy the screen contained in the specified rectangle to a DIB

    hDib = CopyScreenToDIB(rRegion);

    if (!hDib)
        return ERR_DIBFUNCTION;   // CopyScreenToDIB failed!

    wReturn = PrintDIB(hDib, fPrintOpt, wXScale, wYScale, szJobName);
    DestroyDIB(hDib);
    return wReturn; // Return the value that PrintDIB returned
}

WORD PrintWindowSamp | ( | HWND | hWnd,
 |  | WORD | fPrintArea,
 |  | WORD | fPrintOpt,
 |  | WORD | wXScale,
 |  | WORD | wYScale,
 |  | LPSTR | szJobName
 | ) |  |

Definition at line 96 of file Print.c.

{
    HDIB    hDib;          // Handle to the DIB
    WORD    wReturn;       // our return value

    // Parameter validation

    if (!hWnd)
        return ERR_INVALIDHANDLE;  // Invalid Window

    // Copy the Window to a DIB and print it.

    hDib = CopyWindowToDIB(hWnd, fPrintArea);
    if (!hDib)
        return ERR_DIBFUNCTION; // CopyWindowToDIB failed!

    wReturn = PrintDIB(hDib, fPrintOpt, wXScale, wYScale, szJobName);

    // Call DestroyDIB to free the memory the dib takes up.

    DestroyDIB(hDib);
    return wReturn;   // return the value from PrintDIB
}

Variable Documentation

BOOL bAbort = FALSE

Definition at line 49 of file Print.c.

HANDLE ghDLLInst

Definition at line 24 of file Dllinit.c.

char gszDevice[50]

Definition at line 50 of file Print.c.

char gszOutput[50]

Definition at line 51 of file Print.c.

HWND hDlgAbort

Definition at line 47 of file Print.c.

char szPrintDlg[] = "PRINTING"

Definition at line 48 of file Print.c.

Generated on Wed Nov 13 2024 16:53:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/WinCap32/Resource.h File Reference

  • Multimedia
  • Gdi
  • WinCap32
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_STATIC -1
#define | IDC_STATIC_RECT2 1002
#define | IDC_STATIC_RECT3 1003
#define | IDC_STATIC_SELECT2 1004
#define | IDC_STATIC_SELECT3 1005
#define | IDD_SELECT 102
#define | IDS_CANTCAPWNDW 17
#define | IDS_CANTSAVE 13
#define | IDS_CAPTEDALREADY 12
#define | IDS_ENTIRESCRN 15
#define | IDS_INTERROR 19
#define | IDS_MAINWINDOWTITLE 7
#define | IDS_NOIMAGE 9
#define | IDS_RECT2 2
#define | IDS_RECT3 3
#define | IDS_SAVEBMP 11
#define | IDS_SAVEERROR 14
#define | IDS_SAVEFILTER 20
#define | IDS_SELECT2 5
#define | IDS_SELECT3 6
#define | IDS_USERSELECT 16
#define | IDS_VWFULLSCRN 10
#define | IDS_WINCAPRUNNING 8
#define | IDS_WNDWNOTVIS 18

Define Documentation

#define IDC_STATIC -1

Definition at line 28 of file Resource.h.

#define IDC_STATIC_RECT2 1002

Definition at line 24 of file Resource.h.

#define IDC_STATIC_RECT3 1003

Definition at line 25 of file Resource.h.

#define IDC_STATIC_SELECT2 1004

Definition at line 26 of file Resource.h.

#define IDC_STATIC_SELECT3 1005

Definition at line 27 of file Resource.h.

#define IDD_SELECT 102

Definition at line 23 of file Resource.h.

#define IDS_CANTCAPWNDW 17

Definition at line 19 of file Resource.h.

#define IDS_CANTSAVE 13

Definition at line 15 of file Resource.h.

#define IDS_CAPTEDALREADY 12

Definition at line 14 of file Resource.h.

#define IDS_ENTIRESCRN 15

Definition at line 17 of file Resource.h.

#define IDS_INTERROR 19

Definition at line 21 of file Resource.h.

#define IDS_MAINWINDOWTITLE 7

Definition at line 9 of file Resource.h.

#define IDS_NOIMAGE 9

Definition at line 11 of file Resource.h.

#define IDS_RECT2 2

Definition at line 5 of file Resource.h.

#define IDS_RECT3 3

Definition at line 6 of file Resource.h.

#define IDS_SAVEBMP 11

Definition at line 13 of file Resource.h.

#define IDS_SAVEERROR 14

Definition at line 16 of file Resource.h.

#define IDS_SAVEFILTER 20

Definition at line 22 of file Resource.h.

#define IDS_SELECT2 5

Definition at line 7 of file Resource.h.

#define IDS_SELECT3 6

Definition at line 8 of file Resource.h.

#define IDS_USERSELECT 16

Definition at line 18 of file Resource.h.

#define IDS_VWFULLSCRN 10

Definition at line 12 of file Resource.h.

#define IDS_WINCAPRUNNING 8

Definition at line 10 of file Resource.h.

#define IDS_WNDWNOTVIS 18

Definition at line 20 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/WinCap32/Wepcode.c File Reference

  • Multimedia
  • Gdi
  • WinCap32
Defines | Functions

Wepcode.c File Reference

#include <windows.h>

Go to the source code of this file.

Defines

#define | STRICT

Functions

int APIENTRY | WEP (int nParameter)

Define Documentation

#define STRICT

Definition at line 18 of file Wepcode.c.

Function Documentation

int APIENTRY WEP ( int nParameter )

Definition at line 42 of file Wepcode.c.

{
    return (1);
}

Generated on Wed Nov 13 2024 16:53:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/WinCap32/WinCap.c File Reference

  • Multimedia
  • Gdi
  • WinCap32
Defines | Functions | Variables

WinCap.c File Reference

#include <windows.h>
#include <stdio.h>
#include <string.h>
#include "commdlg.h"
#include "wincap.h"
#include "resource.h"
#include "dialogs.h"
#include "dibapi.h"

Go to the source code of this file.

Defines

#define | DINV 3
#define | SCROLL_RATIO 4
#define | STRICT
#define | SWAP(x, y) ((x)^=(y)^=(x)^=(y))
#define | WM_DOCAPTURE WM_USER+101

Functions

BOOL | CenterWindow (HWND hwndChild, HWND hwndParent)
void | DoCapture (HWND hWnd, WORD wCommand)
void | DoPaint (HWND hWnd)
void | DoScroll (HWND hWnd, int message, int wPos, int wScrollType)
void | DoSize (HWND hWnd)
void | DrawSelect (HDC hdc, BOOL fDraw, LPRECT lprClip)
void | FrameWindow (HWND hWnd)
long APIENTRY | FullViewWndProc (HWND hWnd, UINT wMessage, WPARAM wParam, LPARAM lParam)
void WINAPI | NormalizeRect (LPRECT prc)
void | PrintMe ()
void | ReallyGetClientRect (HWND hWnd, LPRECT lpRect)
void | RubberBandScreen (LPRECT lpRect)
void | SaveMe ()
void | SetupScrollBars (HWND hWnd, WORD cxBitmap, WORD cyBitmap)
int WINAPI | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow)
long WINAPI | WndProc (HWND hWnd, UINT wMessage, WPARAM wParam, LPARAM lParam)

Variables

BOOL | bStartup = TRUE
BOOL | bViewFull = FALSE
BOOL | gbCaptRect = FALSE
BOOL | gbLButtonDown = FALSE
BOOL | gbNowCapturing = FALSE
BOOL | gbSave = FALSE
HBITMAP | ghBitmap = NULL
HBITMAP | ghbmLogo
HINSTANCE | ghInst
HPALETTE | ghPal = NULL
HWND | ghWndCapture = NULL
HWND | ghWndMain
char | gszWindowText [100]
UINT guiFileOKMsg
HWND | hModelessDlg
HWND | hRectangleDlg
HWND | hSelectDlg
HOOKPROC | lpfnKeyHook
HOOKPROC | lpfnOldHook
char | szAppName [20]

Define Documentation

#define DINV 3
#define SCROLL_RATIO 4

Definition at line 80 of file WinCap.c.

#define STRICT

Definition at line 37 of file WinCap.c.

#define SWAP | ( | x,
 |  | y |
 | ) |  | ((x)^=(y)^=(x)^=(y))

Definition at line 79 of file WinCap.c.

#define WM_DOCAPTURE WM_USER+101

Definition at line 75 of file WinCap.c.

Function Documentation

BOOL CenterWindow | ( | HWND | hwndChild,
 |  | HWND | hwndParent
 | ) |  |

Definition at line 1962 of file WinCap.c.

{
    RECT    rChild, rParent;
    int     wChild, hChild, wParent, hParent;
    int     wScreen, hScreen, xNew, yNew;
    HDC     hdc;

    // Get the Height and Width of the child window
    GetWindowRect (hwndChild, &rChild);
    wChild = rChild.right - rChild.left;
    hChild = rChild.bottom - rChild.top;

    // Get the Height and Width of the parent window
    GetWindowRect (hwndParent, &rParent);
    wParent = rParent.right - rParent.left;
    hParent = rParent.bottom - rParent.top;

    // Get the display limits
    hdc = GetDC (hwndChild);
    wScreen = GetDeviceCaps (hdc, HORZRES);
    hScreen = GetDeviceCaps (hdc, VERTRES);
    ReleaseDC (hwndChild, hdc);

    // Calculate new X position, then adjust for screen
    xNew = rParent.left + ((wParent - wChild) /2);
    if (xNew < 0)
        xNew = 0;
    else if ((xNew+wChild) > wScreen)
        xNew = wScreen - wChild;

    // Calculate new Y position, then adjust for screen
    yNew = rParent.top  + ((hParent - hChild) /2);
    if (yNew < 0)
        yNew = 0;
    else if ((yNew+hChild) > hScreen)
        yNew = hScreen - hChild;

    // Set it, and return
    return SetWindowPos (hwndChild, NULL, xNew, yNew, 0, 0,
            SWP_NOSIZE | SWP_NOZORDER);
}

void DoCapture | ( | HWND | hWnd,
 |  | WORD | wCommand
 | ) |  |

Definition at line 1104 of file WinCap.c.

{
    HBITMAP     hBitmap;        // Handle to our temporary bitmap
    HPALETTE    hPal;           // Handle to our palette
    CHAR        lpBuffer[128];  // Buffer for string retrieved from resources

    switch (wCommand)
    {
        // Copy Entire screen to DIB

        case IDM_DESKTOP:
        {
            RECT rScreen;       // Rect containing entire screen coordinates
            HDC hDC;            // DC to screen
            MSG msg;            // Message for the PeekMessage()

            hDC = CreateDC("DISPLAY", NULL, NULL, NULL);
            rScreen.left = rScreen.top = 0;
            rScreen.right = GetDeviceCaps(hDC, HORZRES);
            rScreen.bottom = GetDeviceCaps(hDC, VERTRES);

            // Delete our DC

            DeleteDC(hDC);

            LoadString(ghInst, IDS_ENTIRESCRN, lpBuffer, sizeof(lpBuffer));
            strncpy(gszWindowText, lpBuffer, sizeof(gszWindowText) - 1);
      gszWindowText[sizeof(gszWindowText) - 1] = '\0';

            // Wait until everybody repaints themselves

            while (PeekMessage(&msg,NULL,0,0,PM_REMOVE) != 0)
            {
                TranslateMessage(&msg);
                DispatchMessage(&msg);
            }

            hBitmap = CopyScreenToBitmap(&rScreen);

            if (hBitmap)
                hPal = GetSystemPalette();
            else
                hPal = NULL;
        }
        break;

        // copy user-selected portion of screen to DIB

        case IDM_CAPTRECT:
        {
            RECT rRubberBand;       // Region to capture (screen coordinates)

            // Allow user to "rubberband" a section of the screen for
            // us to capture

            RubberBandScreen(&rRubberBand);
            LoadString(ghInst, IDS_USERSELECT, lpBuffer, sizeof(lpBuffer));
            strncpy(gszWindowText, lpBuffer, sizeof(gszWindowText) - 1);
      gszWindowText[sizeof(gszWindowText) - 1] = '\0';

            hBitmap = CopyScreenToBitmap(&rRubberBand);

            if (hBitmap)
                hPal = GetSystemPalette();
            else
                hPal = NULL;
        }
        break;

        case IDM_CAPTWINDOW:
        case IDM_CAPTCLIENT:
        case IDM_ACTIVEWINDOW:
        {
            HWND    hWndSelect;       // The current active window
            HWND    hWndDesktop;      // Window to desktop
            MSG     msg;              // For our peekmessage loop

            // Just capture the current active window, whatever it is

            if (wCommand == IDM_ACTIVEWINDOW)
                hWndSelect = GetForegroundWindow();

            // Allow the user to click on a single window to capture

            else
                hWndSelect = ghWndCapture;

            // If they try to capture the desktop window, then just
            // capture the entire screen.

            hWndDesktop = GetDesktopWindow();

            if (hWndSelect == hWndDesktop)
            {
                RECT    rScreen;    // contains entire screen coordinates
                HDC     hDC;        // DC to screen
                MSG     msg1;       // Message for the PeekMessage()

                hDC = CreateDC("DISPLAY", NULL, NULL, NULL);
                rScreen.left = rScreen.top = 0;
                rScreen.right = GetDeviceCaps(hDC, HORZRES);
                rScreen.bottom = GetDeviceCaps(hDC, VERTRES);

                /* Delete our DC */
                DeleteDC(hDC);

                LoadString(ghInst, IDS_ENTIRESCRN, lpBuffer, sizeof(lpBuffer));
                strncpy(gszWindowText, lpBuffer, sizeof(gszWindowText) -1);

                // Wait until everybody repaints themselves

                while (PeekMessage(&msg1,NULL,0,0,PM_REMOVE) != 0)
                {
                    TranslateMessage(&msg1);
                    DispatchMessage(&msg1);
                }

                ghBitmap = CopyScreenToBitmap(&rScreen);

                if (ghBitmap)
                    ghPal = GetSystemPalette();
                else
                    ghPal = NULL;

                ghWndCapture = NULL;
                return;
            }

            // Check to see that the hWnd is not NULL

            if (!hWndSelect)
            {
                LoadString(ghInst, IDS_CANTCAPWNDW, lpBuffer, sizeof(lpBuffer));
                MessageBox(NULL, lpBuffer, szAppName,
                        MB_ICONEXCLAMATION | MB_OK);

                hBitmap = NULL;
                hPal = NULL;
                break;
            }

            // Make sure it's not a hidden window.  Hmm, capturing a hidden
            // window would certainly be a cool trick, wouldn't it?

            if (!IsWindowVisible(hWndSelect))
            {
                LoadString(ghInst, IDS_WNDWNOTVIS, lpBuffer, sizeof(lpBuffer));
                MessageBox(NULL, lpBuffer,
                        szAppName, MB_ICONEXCLAMATION | MB_OK);

                ghWndCapture = NULL;
                hBitmap = NULL;
                hPal = NULL;
                break;
            }

            // Move window which was selected to top of Z-order for
            // the capture, and make it redraw itself

            SetWindowPos(hWndSelect, NULL, 0, 0, 0, 0,
                    SWP_DRAWFRAME | SWP_NOSIZE | SWP_NOMOVE);

            UpdateWindow(hWndSelect);

            // Wait until everybody repaints themselves

            while (PeekMessage(&msg,NULL,0,0,PM_REMOVE) != 0)
            {
                TranslateMessage(&msg);
                DispatchMessage(&msg);
            }

            // Get the caption

            GetWindowText(hWndSelect, gszWindowText, 100);

            // Capture the screen -- if we selected CLIENT only capture, then
            // select that open when calling our API.  Otherwise, get the
            // entire window.

            hBitmap = CopyWindowToBitmap(hWndSelect,
                    (WORD)((wCommand == IDM_CAPTCLIENT) ? (PW_CLIENT) :
                    (PW_WINDOW)));

            if (hBitmap)
                hPal = GetSystemPalette();
            else
                hPal = NULL;

            break;
        }

        //Oops, something went wrong

        default:
            LoadString(ghInst, IDS_INTERROR, lpBuffer, sizeof(lpBuffer));
            MessageBox(NULL, lpBuffer, szAppName,
                    MB_ICONHAND | MB_OK);
            break;
    }

    if (hBitmap)
    {
        ghBitmap = hBitmap;
        hBitmap = NULL;
    }
    if (hPal)
    {
        ghPal = hPal;
        hPal = NULL;
    }

    // Now, paint our bitmap in the client area

    if (bStartup)
        bStartup = FALSE;

    InvalidateRect(hWnd, NULL, FALSE);
    UpdateWindow(hWnd);
    ghWndCapture = NULL;
}

void DoPaint ( HWND hWnd )

Definition at line 1804 of file WinCap.c.

{
    HDC             hDC, hMemDC;         // Handle to DC, memory DC
    PAINTSTRUCT     ps;                  // Painting structure
    BITMAP          bm;                  // BITMAP structure
    HBITMAP         hOldBm;              // Handle to previous bitmap
    RECT            rectClient, rectDDB; // Client and bitmap rectangles
    int             xScroll, yScroll;    // Scroll positions
    int             x, y;                // Logo origin

    // Begin painting

    hDC = BeginPaint(hWnd, &ps);

    // Check to see if we are displaying a bitmap

    if (!ghBitmap)
    {
        // No bitmap yet, are we in start mode?

        if (bStartup)
        {
            GetClientRect(hWnd, &rectClient);

            hMemDC = CreateCompatibleDC(ps.hdc);

            // Select our logo bitmap

            hOldBm = SelectObject(hMemDC, ghbmLogo);

            GetObject(ghbmLogo, sizeof(BITMAP), (VOID *)&bm);

            x = (rectClient.right - bm.bmWidth) / 2;
            y = (rectClient.bottom - bm.bmHeight) / 2;

            // Now bitblt our logo to client area

            BitBlt(ps.hdc, x, y, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0,
                    SRCCOPY);

            // Clean up
            SelectObject(hMemDC,hOldBm);
            DeleteDC(hMemDC);
        }
        else
        {
            // Turn off scroll bars in case they were on

                SetScrollRange (hWnd, SB_VERT, 0, 0, TRUE);
            SetScrollRange (hWnd, SB_HORZ, 0, 0, TRUE);
        }
    }
    else // We are displaying a bitmap
    {
        // Get bitmap info

        GetObject(ghBitmap, sizeof(BITMAP), (LPSTR)&bm);

        // Get scroll bar positions

        xScroll  = GetScrollPos  (hWnd, SB_HORZ);
        yScroll  = GetScrollPos  (hWnd, SB_VERT);

        // Set up the scroll bars appropriately.

        SetupScrollBars(hWnd, (WORD)bm.bmWidth, (WORD)bm.bmHeight);

        // Set up the necessary rectangles -- i.e. the rectangle
        //  we're rendering into, and the rectangle in the bitmap

        GetClientRect (hWnd, &rectClient);

        rectDDB.left   = xScroll;
        rectDDB.top    = yScroll;
        rectDDB.right  = xScroll + rectClient.right - rectClient.left;
        rectDDB.bottom = yScroll + rectClient.bottom - rectClient.top;

        if (rectDDB.right > bm.bmWidth)
        {
            int dx;

            dx = bm.bmWidth - rectDDB.right;

            rectDDB.right     += dx;
            rectClient.right  += dx;
        }

        if (rectDDB.bottom > bm.bmHeight)
        {
            int dy;

            dy = bm.bmHeight - rectDDB.bottom;

            rectDDB.bottom    += dy;
            rectClient.bottom += dy;
        }

        // Go do the actual painting.

        PaintBitmap(hDC, &rectClient, ghBitmap, &rectDDB, ghPal);
    }

    EndPaint(hWnd, &ps);
}

void DoScroll | ( | HWND | hWnd,
 |  | int | message,
 |  | int | wPos,
 |  | int | wScrollType
 | ) |  |

Definition at line 1702 of file WinCap.c.

{
    int  xBar;          // Where scrollbar is now.
    int  nMin;          // Minumum scroll bar value.
    int  nMax;          // Maximum scroll bar value.
    int  dx;            // How much to move.
    int  nOneUnit;      // # of pixels for LINEUP/LINEDOWN
    int  cxClient;      // Width of client area.
    int  nHorzOrVert;   // Doing the horizontal or vertical?
    RECT rect;          // Client area.

    GetClientRect (hWnd, &rect);

    if (message == WM_HSCROLL)
    {
        nHorzOrVert = SB_HORZ;
        cxClient    = rect.right - rect.left;
    }
    else
    {
        nHorzOrVert = SB_VERT;
        cxClient    = rect.bottom - rect.top;
    }

    // On a SB_LINEUP/SB_LINEDOWN we will move the DIB by
    //  1/SCROLL_RATIO of the client area (i.e. if SCROLL_RATIO
    //  is 4, it will scroll the DIB a quarter of the client
    //  area's height or width.

    nOneUnit = cxClient / SCROLL_RATIO;
    if (!nOneUnit)
        nOneUnit = 1;

    xBar = GetScrollPos (hWnd, nHorzOrVert);
    GetScrollRange (hWnd, nHorzOrVert, &nMin, &nMax);

    switch (wScrollType)
    {
        case SB_LINEDOWN:             // One line right.
            dx = nOneUnit;
            break;

        case SB_LINEUP:               // One line left.
            dx = -nOneUnit;
            break;

        case SB_PAGEDOWN:             // One page right.
            dx = cxClient;
            break;

        case SB_PAGEUP:               // One page left.
            dx = -cxClient;
            break;

        case SB_THUMBPOSITION:        // Absolute position.
            dx = wPos - xBar;
            break;

        default:                      // No change.
            dx = 0;
            break;
    }

    if (dx)
    {
        xBar += dx;

        if (xBar < nMin)
        {
            dx  -= xBar - nMin;
            xBar = nMin;
        }

        if (xBar > nMax)
        {
            dx  -= xBar - nMax;
            xBar = nMax;
        }

        if (dx)
        {
            SetScrollPos (hWnd, nHorzOrVert, xBar, TRUE);

            if (nHorzOrVert == SB_HORZ)
                ScrollWindow (hWnd, -dx, 0, NULL, NULL);
            else
                ScrollWindow (hWnd, 0, -dx, NULL, NULL);

            UpdateWindow (hWnd);
        }
    }
}

void DoSize ( HWND hWnd )

Definition at line 1553 of file WinCap.c.

{
    BITMAP      bm;                     // Bitmap info structure
    int         cxBitmap=0, cyBitmap=0; // Bitmap width and height
    int         cxScroll, cyScroll;     // Scroll positions
    RECT        rect;                   // Client rectangle

    // repaint if displaying bitmap

    if (ghBitmap)
    {
        // Get info about bitmap

        GetObject(ghBitmap, sizeof(BITMAP), (LPSTR)&bm);

        // Get the width and height of the bitmap

        cxBitmap = bm.bmWidth;
        cyBitmap = bm.bmHeight;

        // Find out the dimensions of the window, and the current thumb
        // positions

        GetClientRect(hWnd, &rect);

        cxScroll = GetScrollPos (hWnd, SB_HORZ);
        cyScroll = GetScrollPos (hWnd, SB_VERT);

        // If current thumb positions would cause blank space
        // at right or bottom of client area, repaint

        if (cxScroll + rect.right > cxBitmap ||
                cyScroll + rect.bottom > cyBitmap)
            InvalidateRect(hWnd, NULL, FALSE);

        // Make sure scroll bars are updated

        SetupScrollBars(hWnd, (WORD)cxBitmap, (WORD)cyBitmap);
    }
    else if (bStartup)
        InvalidateRect(hWnd, NULL, TRUE);
}

void DrawSelect | ( | HDC | hdc,
 |  | BOOL | fDraw,
 |  | LPRECT | lprClip
 | ) |  |

Definition at line 1463 of file WinCap.c.

{
    char sz[80];
    DWORD dw;
    int x, y, len, dx, dy;
    HDC hdcBits;
    HBITMAP hbm;
    RECT rcClip;
    SIZE sExtent;

    rcClip = *lprClip;
    if (!IsRectEmpty(&rcClip))
    {

        // If a rectangular clip region has been selected, draw it

        PatBlt(hdc, rcClip.left, rcClip.top, rcClip.right - rcClip.left, 1,
                DSTINVERT);
        PatBlt(hdc, rcClip.left, rcClip.bottom, 1, -(rcClip.bottom-rcClip.top),
                DSTINVERT);
        PatBlt(hdc, rcClip.right - 1, rcClip.top, 1, rcClip.bottom - rcClip.top,
                DSTINVERT);
        PatBlt(hdc, rcClip.right, rcClip.bottom - 1, -(rcClip.right -
                rcClip.left), 1, DSTINVERT);

        // Format the dimensions string ...

        _snprintf(sz, sizeof(sz) - 1, "%dx%d", rcClip.right - rcClip.left, rcClip.bottom -
               rcClip.top);
    sz[sizeof(sz) - 1] = '\0';

        len = lstrlen(sz);

        // ... and center it in the rectangle

        dw = GetTextExtentPoint(hdc, sz, len, &sExtent);
        dx = sExtent.cx;
        dy = sExtent.cy;
        x = (rcClip.right + rcClip.left - dx) / 2;
        y = (rcClip.bottom + rcClip.top - dy) / 2;
        hdcBits = CreateCompatibleDC(hdc);
        SetTextColor(hdcBits, 0xFFFFFFL);
        SetBkColor(hdcBits, 0x000000L);

        // Output the text to the DC

        if (hbm = CreateBitmap(dx, dy, 1, 1, NULL))
        {
            hbm = SelectObject(hdcBits, hbm);
            ExtTextOut(hdcBits, 0, 0, 0, NULL, sz, len, NULL);
            BitBlt(hdc, x, y, dx, dy, hdcBits, 0, 0, SRCINVERT);
            hbm = SelectObject(hdcBits, hbm);
            DeleteObject(hbm);
        }
        DeleteDC(hdcBits);
    }
}

void FrameWindow ( HWND hWnd )

Definition at line 1920 of file WinCap.c.

{
    HDC     hdc;
    RECT    rc;

#define DINV    3

    if (!IsWindow(hWnd))
        return;

    hdc = GetWindowDC(hWnd);
    GetWindowRect(hWnd, &rc);
    OffsetRect(&rc, -rc.left, -rc.top);

    if (!IsRectEmpty(&rc))
    {
        PatBlt(hdc, rc.left, rc.top, rc.right-rc.left, DINV, DSTINVERT);
        PatBlt(hdc, rc.left, rc.bottom-DINV, DINV, -(rc.bottom-rc.top-2*DINV),
                DSTINVERT);
        PatBlt(hdc, rc.right-DINV, rc.top+DINV, DINV, rc.bottom-rc.top-2*DINV,
                DSTINVERT);
        PatBlt(hdc, rc.right, rc.bottom-DINV, -(rc.right-rc.left), DINV,
                DSTINVERT);
    }

    ReleaseDC(hWnd, hdc);
}

long APIENTRY FullViewWndProc | ( | HWND | hWnd,
 |  | UINT | wMessage,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 829 of file WinCap.c.

{
    switch (wMessage)
    {
        case WM_PAINT:
        {
            PAINTSTRUCT     ps;
            HDC             hMemDC;
            BITMAP          bm;
            HBITMAP         hOldBm;
            RECT            rect, rectClient;
            int             x, y;

            BeginPaint(hWnd, &ps);

            // Check to see if we are displaying a bitmap

            if (!ghBitmap)
            {

                // No bitmap yet, are we in start mode?

                if (bStartup)
                {
                    GetClientRect(hWnd, &rectClient);

                    hMemDC = CreateCompatibleDC(ps.hdc);

                    // Select our logo bitmap

                    hOldBm = SelectObject(hMemDC, ghbmLogo);
                    GetObject(ghbmLogo, sizeof(BITMAP), (VOID *)&bm);

                    x = (rectClient.right - bm.bmWidth) / 2;
                    y = (rectClient.bottom - bm.bmHeight) / 2;

                    // Now bitblt our logo to client area
                    BitBlt(ps.hdc, x, y, bm.bmWidth, bm.bmHeight,
                          hMemDC, 0, 0, SRCCOPY);

                    // Clean up
                    SelectObject(hMemDC,hOldBm);
                    DeleteDC(hMemDC);
                }
            }
            else
            {
                // Get info for captured bitmap

                GetObject(ghBitmap, sizeof(BITMAP), (LPSTR)&bm);

                // Fill in src/dest rectangle with width and height
                // of captured bitmap

                rect.left = 0;
                rect.top = 0;
                rect.right = bm.bmWidth;
                rect.bottom = bm.bmHeight;

                // Paint the captured bitmap in the client area

                PaintBitmap(ps.hdc, &rect, ghBitmap, &rect, ghPal);
            }

            EndPaint(hWnd, &ps);
            break;
         }

        case WM_KEYDOWN:
        case WM_LBUTTONDOWN:
            DestroyWindow(hWnd);
            break;

        default:
            return (int)DefWindowProc(hWnd, wMessage, wParam, lParam);
    }

  return 0;
}

void WINAPI NormalizeRect ( LPRECT prc )

Definition at line 1532 of file WinCap.c.

{
    if (prc->right  < prc->left) SWAP(prc->right,  prc->left);
    if (prc->bottom < prc->top)  SWAP(prc->bottom, prc->top);
}

void PrintMe ( void )

Definition at line 1047 of file WinCap.c.

{
    static OPTIONSTRUCT opts;
    DWORD_PTR           iReturn;
    HDIB                hDIB;
    WORD                wReturn;

    // Display "Print Options" Box

    iReturn = DialogBoxParam(ghInst, (LPSTR)"Print", ghWndMain, PrintDlgProc,
            (LPARAM) &opts);

    if (iReturn)
    {
        // User pressed "OK" -- do the printing

        hDIB = BitmapToDIB(ghBitmap, ghPal);

        if (hDIB)
        {

            // Print the dib using PrintDIB() API

            if (opts.iOption == IDC_STRETCHTOPAGE)
                wReturn = PrintDIB(hDIB, PW_STRETCHTOPAGE, 0, 0,
                        (LPSTR)gszWindowText);

            else if (opts.iOption == IDC_SCALE)
                wReturn = PrintDIB(hDIB, (WORD)PW_SCALE, (WORD)opts.iXScale,
                        (WORD)opts.iYScale, (LPSTR)gszWindowText);
            else
                wReturn = PrintDIB(hDIB, PW_BESTFIT, 0, 0,
                        (LPSTR)gszWindowText);

            if (wReturn)
                DIBError(wReturn);

            DestroyDIB(hDIB);
        }
    }
}

void ReallyGetClientRect | ( | HWND | hWnd,
 |  | LPRECT | lpRect
 | ) |  |

Definition at line 1607 of file WinCap.c.

{
    DWORD   dwWinStyle;

    dwWinStyle = GetWindowLong (hWnd, GWL_STYLE);

    GetClientRect (hWnd, lpRect);

    if (dwWinStyle & WS_HSCROLL)
        lpRect->bottom += (GetSystemMetrics (SM_CYHSCROLL) - 1);

    if (dwWinStyle & WS_VSCROLL)
        lpRect->right  += (GetSystemMetrics (SM_CXVSCROLL) - 1);
}

void RubberBandScreen ( LPRECT lpRect )

Definition at line 1344 of file WinCap.c.

{
    POINT   pt;                 // Temporary POINT
    MSG     msg;                // Used in our PeekMessage() loop
    POINT   ptOrigin;           // Point where the user pressed left mouse button down
    RECT    rcClip;             // Current selection
    HDC     hScreenDC;          // DC to the screen (so we can draw on it)
    BOOL    bCapturing = FALSE; // TRUE if we are rubber-banding
    POINTS  pts;
    BOOL    bLButtonUp = FALSE;

    hScreenDC = CreateDC("DISPLAY", NULL, NULL, NULL);

    // Eat mouse messages until a WM_LBUTTONUP is encountered. Meanwhile
    // continue to draw a rubberbanding rectangle and display it's dimensions

    for (;;)
    {
        WaitMessage();
        if (PeekMessage(&msg, NULL, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE))
        {
            // If the message is a WM_LBUTTONDOWN, begin drawing the
            // rubber-band box.

            if (msg.message == WM_RBUTTONDOWN)
            {
                // User pressed left button, initialize selection
                // Set origin to current mouse position (in window coords)

                pts = MAKEPOINTS(msg.lParam);

                ptOrigin.x = pts.x;
                ptOrigin.y = pts.y;

                // Convert to screen coordinates

                ClientToScreen(ghWndMain, &ptOrigin);

                // rcClip is the current rectangle that the user
                // has selected.  Since user just pressed left button down,
                // initialize this rect very small

                rcClip.left = rcClip.right = ptOrigin.x;
                rcClip.top = rcClip.bottom = ptOrigin.y;
                NormalizeRect(&rcClip);     // Make sure it is a normal rect
                DrawSelect(hScreenDC, TRUE, &rcClip); // Draw the rubber-band box
                bCapturing = TRUE;
            }

            else if (msg.message == WM_LBUTTONUP)
            {
                if (!bCapturing)
                    break;
                else
                {
                    bLButtonUp = TRUE;
                    PostMessage(ghWndMain, WM_RBUTTONUP, msg.wParam, msg.lParam);
                }
            }

            // Any messages that make it into the next statement are mouse
            // messages, and we are capturing, so let's update the rubber-band
            // box

            if (bCapturing)
            {
                DrawSelect(hScreenDC, FALSE, &rcClip);  // erase old rubber-band
                rcClip.left = ptOrigin.x;   // Update rect with new mouse info
                rcClip.top = ptOrigin.y;

                pts = MAKEPOINTS(msg.lParam);

                pt.x = pts.x;
                pt.y = pts.y;

                // Convert to screen coordinates

                ClientToScreen(ghWndMain, &pt);
                rcClip.right = pt.x;
                rcClip.bottom = pt.y;
                NormalizeRect(&rcClip);
                DrawSelect(hScreenDC, TRUE, &rcClip); // new rubber-band
            }

            // If the message is WM_LBUTTONUP, then we stop the selection
            // process.

            if (msg.message == WM_RBUTTONUP)
            {
                DrawSelect(hScreenDC, FALSE, &rcClip);    // erase rubber-band
                if (bLButtonUp)
                    PostMessage(ghWndMain, WM_LBUTTONUP, msg.wParam, msg.lParam);
                break;
            }
        }
        else
            continue;
    }
    DeleteDC(hScreenDC);

    // Assign rect user selected to lpRect parameter

    if (!IsRectEmpty(&rcClip))
        CopyRect(lpRect, &rcClip);

    PostMessage(ghWndMain, WM_LBUTTONUP, msg.wParam, msg.lParam);
}

void SaveMe ( void )

Definition at line 921 of file WinCap.c.

{
    char    szFileBuf[255];     // Buffer to hold returned file name
    DWORD_PTR dwFlags;            // used to pass in / get out file type
    HDC     hDC;                // HDC for getting info
    int     iBits;              // Bits per pixel of the display adapter
    DWORD   dCompression;       // Compression that the user specifies
    WORD    wBitCount;          // Bits per pixel that the user specifies
    WORD    wCompression;       // Compression
    HDIB    hDIB;               // A handle to our dib
    BOOL    bResult;            // Result of dialog box - TRUE if OK was pressed
    CHAR    lpBuffer[128];      // Buffer to hold string message retrieved from resources
    CHAR    lpBuffer2[128];     // Buffer to hold string message retrieved from resources

    // Set up default compression to display in dialog box

    wCompression = IDD_RGB;

    // Depending on bits/pixel type for current display,
    // set the appropriate bit in the fFileOptions flag
    //
    // NOTE that we don't just assign wBitCount to iBits.  The reason
    // for this is some displays aren't 1,4,8 or 24 bits.  Some are
    // 15 bits, which isn't valid for a DIB, so in this case, we would
    // set the bits to 24.

    hDC = CreateDC("DISPLAY",NULL,NULL,NULL);
    iBits = GetDeviceCaps(hDC, BITSPIXEL) * GetDeviceCaps(hDC, PLANES);
    DeleteDC(hDC);

    if (iBits <= 1)
        wBitCount = 1;

    else if (iBits <= 4)
        wBitCount = 4;

    else if (iBits <= 8)
        wBitCount = 8;

    else if (iBits <= 24)
        wBitCount = 24;

  else if (iBits <= 32)
    wBitCount = 32;

    // Our dwFlags parameter to GetFileName is made up of the
    // bits per pixel in the HIWORD (1, 2, 4, or 24), and the compression
    // type in the LOWORD (IDD_RGB, IDD_RLE4, or IDD_RLE8).

    dwFlags = MAKELONG(wCompression, wBitCount);

    // Bring up File/Save... dialog and get info. about filename,
    // compression, and bits/pix. of DIB to be written.

    bResult = GetFileName(ghWndMain, (LPSTR)szFileBuf, &dwFlags);  // Function will accept up to 255 characters.

    // Extract DIB specs and save to file (if the user did not
    // press cancel)

    if (bResult)
    {
        switch(LOWORD(dwFlags))
        {
            case IDD_RLE4:
                dCompression = BI_RLE4;
                break;

            case IDD_RLE8:
                dCompression = BI_RLE8;
                break;

            case IDD_RGB:
            default:
                dCompression = BI_RGB;
                break;
        }

        // First, call up a modeless dialog box which tells that we are
        // saving this to a file...

        if (!hModelessDlg)
        {
            hModelessDlg = CreateDialogParam(ghInst, (LPSTR)"Saving",
                    ghWndMain,SavingDlgProc,(LPARAM)szFileBuf);
        }

        // Now, write out the DIB in the proper format.  The following
        // API ChangeBitmapFormat() will convert the specified bitmap
        // to a DIB with the specified Bit Count, Compression and
        // Palette.  Remember that the HIWORD of dwFlags specifies the
        // bits per pixel.

        hDIB = ChangeBitmapFormat(ghBitmap, HIWORD(dwFlags),
                dCompression, ghPal);

        if (hDIB)
        {
            if (SaveDIB(hDIB, szFileBuf))
            {
                LoadString(ghInst, IDS_CANTSAVE, lpBuffer, sizeof(lpBuffer));
                LoadString(ghInst, IDS_SAVEERROR, lpBuffer2, sizeof(lpBuffer2));
                MessageBox(NULL, lpBuffer, lpBuffer2, MB_ICONEXCLAMATION);
                gbSave = TRUE;
            }
            else
                gbSave = FALSE;

            DestroyDIB(hDIB);
        }

        DestroyWindow(hModelessDlg);
        hModelessDlg = NULL;
    }

}

void SetupScrollBars | ( | HWND | hWnd,
 |  | WORD | cxBitmap,
 |  | WORD | cyBitmap
 | ) |  |

Definition at line 1631 of file WinCap.c.

{
    RECT        rect;                       // Client Rectangle
    BOOL        bNeedScrollBars=FALSE;      // Need Scroll bars?
    unsigned    cxWindow, cyWindow;         // Width and height of client area
    int         cxRange=0, cyRange=0;       // Range needed for horz and vert

    // Do some initialization

    ReallyGetClientRect(hWnd, &rect);

    cxWindow = rect.right - rect.left;
    cyWindow = rect.bottom - rect.top;

    // Now determine if we need the scroll bars

    if ((cxWindow < (unsigned)cxBitmap) || (cyWindow < (unsigned)cyBitmap))
        bNeedScrollBars = TRUE;

    // Setup the scroll bar ranges.  We want to be able to
    // scroll the window so that all the bitmap can appear
    // within the client area.  Take into account that
    // if the opposite scroll bar is activated, it eats
    // up some client area.

    if (bNeedScrollBars)
    {
        cyRange = (unsigned)cyBitmap - cyWindow - 1 +
                GetSystemMetrics (SM_CYHSCROLL);
        cxRange = (unsigned)cxBitmap - cxWindow - 1 +
                GetSystemMetrics (SM_CXVSCROLL);
    }

    // Set the ranges we've calculated (0 to 0 means invisible scrollbar)

    SetScrollRange(hWnd, SB_VERT, 0, cyRange, TRUE);
    SetScrollRange(hWnd, SB_HORZ, 0, cxRange, TRUE);
}

int WINAPI WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpszCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 92 of file WinCap.c.

{
    MSG msg;
    WNDCLASS wndclass;
    HWND hWnd;
  CHAR lpBuffer[256];

    strncpy(szAppName, "WinCap", 7);     // Name of our App
  szAppName[6] = '\0';

    hModelessDlg = NULL;             // Set handle to modeless dialog to NULL
                                     // because we haven't created it yet

    hSelectDlg = hRectangleDlg = NULL;

  LoadString(ghInst, IDS_MAINWINDOWTITLE, lpBuffer, sizeof(lpBuffer));
    if (!FindWindow(szAppName, lpBuffer))
    {
        wndclass.style = 0;
        wndclass.lpfnWndProc = (WNDPROC)WndProc;
        wndclass.cbClsExtra = 0;
        wndclass.cbWndExtra = 0;
        wndclass.hInstance = hInstance;
        wndclass.hIcon = LoadIcon(hInstance, "WINCAP");
        wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);

        // Use black for background for better contrast

        wndclass.hbrBackground = GetStockObject(GRAY_BRUSH);

        wndclass.lpszMenuName = (LPSTR)"MAINMENU";
        wndclass.lpszClassName = (LPSTR)szAppName;

        if (!RegisterClass(&wndclass))
            return FALSE;

        ghInst = hInstance;  // Set Global variable

        // Create a main window for this application instance.

        hWnd = CreateWindow(szAppName, lpBuffer, WS_OVERLAPPEDWINDOW,
                CW_USEDEFAULT, CW_USEDEFAULT, 450, 345, NULL, NULL, hInstance,            // This instance owns this window
                NULL);

        ghWndMain = hWnd;      // Set global variable

        ShowWindow(hWnd, nCmdShow);
        UpdateWindow(hWnd);

        // Set up the Keyboard hook for our hotkeys

        InstallHook(hWnd, TRUE);  // Function resides in DIBAPI32.DLL

        // Create our full-screen view class

        wndclass.style = 0;
        wndclass.lpfnWndProc = (WNDPROC)FullViewWndProc;
        wndclass.cbClsExtra = 0;
        wndclass.cbWndExtra = 0;
        wndclass.hInstance = hInstance;
        wndclass.hIcon = NULL;
        wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
        wndclass.hbrBackground = GetStockObject(GRAY_BRUSH);
        wndclass.lpszMenuName = (LPSTR)NULL;
        wndclass.lpszClassName = (LPSTR)"ViewClass";

        if (!RegisterClass(&wndclass))
            return FALSE;

    }

    // Let's make this a single-instance app -- we can get into hotkey
    // conflicts (e.g. windows won't know which instance of WINCAP to
    // send the message to).

    else
    {
        LoadString(ghInst, IDS_WINCAPRUNNING, lpBuffer, sizeof(lpBuffer));
    MessageBeep(0);
        MessageBox(NULL, lpBuffer, szAppName, MB_OK | MB_ICONHAND);
        return FALSE;
    }

    // Polling messages from event queue -- we have a modeless dialog
    // box, so we have to take care of the messages here also

    while (GetMessage(&msg, NULL, 0, 0))
    {
        if (hModelessDlg == NULL || !IsDialogMessage(hModelessDlg, &msg) ||
                hSelectDlg || !IsDialogMessage(hSelectDlg, &msg) ||
                hRectangleDlg || !IsDialogMessage(hRectangleDlg, &msg))
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
    }
    return (int)msg.wParam;
}

long WINAPI WndProc | ( | HWND | hWnd,
 |  | UINT | wMessage,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 209 of file WinCap.c.

{

    // The gbNowCapturing variable is set to TRUE if we are in the middle of
    // printing.  This takes care of the case when the user presses the hotkey
    // during capturing

    static BOOL     bCapturedYet = FALSE;  // TRUE if window contains captured screen
    HWND            hViewWnd;              // Handle to our view window
    static WORD     wCaptureCommand;
    static HCURSOR  hOldCursor;
    static HWND     hBrowseWnd;
    CHAR            lpBuffer[128];
    CHAR            lpBuffer2[128];

    switch (wMessage)
    {

        case WM_CREATE:
            if (!hSelectDlg)
                hSelectDlg = CreateDialog(ghInst, "Select", hWnd,
                        SelectDlgProc);

            if (!hRectangleDlg)
                hRectangleDlg = CreateDialog(ghInst, "Rectangle", hWnd,
                        RectangleDlgProc);

            ghbmLogo = LoadBitmap(ghInst, "STARTBMP");
            guiFileOKMsg = RegisterWindowMessage( (LPCSTR)FILEOKSTRING );
            break;

        // Gray out menu items if we haven't captured anything yet.

        case WM_INITMENU:
            EnableMenuItem(GetMenu(hWnd), IDM_SAVE, MF_BYCOMMAND |
                    (bCapturedYet ? MF_ENABLED : MF_DISABLED | MF_GRAYED));
            EnableMenuItem(GetMenu(hWnd), IDM_PRINT, MF_BYCOMMAND |
                    (bCapturedYet ? MF_ENABLED : MF_DISABLED | MF_GRAYED));
            EnableMenuItem(GetMenu(hWnd), IDM_EDITCOPY, MF_BYCOMMAND |
                    (bCapturedYet ? MF_ENABLED : MF_DISABLED | MF_GRAYED));
            return 0;

        // The WM_PALETTECHANGED message informs all windows that the window
        // with input focus has realized its logical palette, thereby changing
        // the system palette. This message allows a window without input focus
        // that uses a color palette to realize its logical palettes and update
        // its client area.
        //
        // This message is sent to all windows, including the one that changed
        // the system palette and caused this message to be sent. The wParam of
        // this message contains the handle of the window that caused the system
        // palette to change. To avoid an infinite loop, care must be taken to
        // check that the wParam of this message does not match the window's
        // handle.

        case WM_PALETTECHANGED:
        {
            HDC         hDC;      // Handle to device context
            HPALETTE    hOldPal;  // Handle to previous logical palette

            // Before processing this message, make sure we
            // are indeed using a palette

            if (ghPal)
            {
                // If this application did not change the palette, select
                // and realize this application's palette

                if (wParam != (WPARAM)hWnd)
                {
                    // Need the window's DC for SelectPalette/RealizePalette

                    hDC = GetDC(hWnd);

                    // Select and realize our palette

                    hOldPal = SelectPalette(hDC, ghPal, FALSE);
                    RealizePalette(hDC);

                    // WHen updating the colors for an inactive window,
                    // UpdateColors can be called because it is faster than
                    // redrawing the client area (even though the results are
                    // not as good)

                    UpdateColors(hDC);

                    // Clean up

                    if (hOldPal)
                       SelectPalette(hDC, hOldPal, FALSE);

                    ReleaseDC(hWnd, hDC);
                }
            }
            break;
        }

        // The WM_QUERYNEWPALETTE message informs a window that it is about to
        // receive input focus. In response, the window receiving focus should
        // realize its palette as a foreground palette and update its client
        // area. If the window realizes its palette, it should return TRUE;
        // otherwise, it should return FALSE.

        case WM_QUERYNEWPALETTE:
        {
            HDC         hDC;      // Handle to device context
            HPALETTE    hOldPal;  // Handle to previous logical palette

            // Before processing this message, make sure we
            // are indeed using a palette

            if (ghPal)
            {
                 // Need the window's DC for SelectPalette/RealizePalette

                 hDC = GetDC(hWnd);

                 // Select and realize our palette

                 hOldPal = SelectPalette(hDC, ghPal, FALSE);
                 RealizePalette(hDC);

                 // Redraw the entire client area

                 InvalidateRect(hWnd, NULL, TRUE);
                 UpdateWindow(hWnd);

                 // Clean up

                 if (hOldPal)
                    SelectPalette(hDC, hOldPal, FALSE);

                 ReleaseDC(hWnd, hDC);

                 // Message processed, return TRUE

                 return TRUE;
             }

            // Message not processed, return FALSE

            return FALSE;
        }

        case WM_MOVE:
        {
            if (gbNowCapturing)
            {
                if (gbCaptRect)
                    CenterWindow(hRectangleDlg, hWnd);
                else
                    CenterWindow(hSelectDlg, hWnd);
            }

            return 0;
        }

        case WM_SIZE:
        {
            static BOOL     bSizing=FALSE;

            if (gbNowCapturing)
            {
                if (gbCaptRect)
                    CenterWindow(hRectangleDlg, hWnd);
                else
                    CenterWindow(hSelectDlg, hWnd);
            }

            // Check if we are already sizing

            if (bSizing)
                return 0l;

            bSizing = TRUE;
            DoSize(hWnd);
            bSizing = FALSE;
            break;
        }

        case WM_HSCROLL:
        case WM_VSCROLL:
            DoScroll(hWnd, wMessage, (int)HIWORD(wParam), (int)LOWORD(wParam));
            break;

        case WM_PAINT:
            DoPaint(hWnd);
            break;

        case WM_COMMAND:
            switch (LOWORD(wParam))
            {
                case IDM_ABOUT:
                    DialogBox(ghInst, (LPSTR)"About", hWnd, AboutDlgProc);
                    break;

                case IDM_SAVE:
                    SaveMe();
                    break;

                case IDM_PRINT:
                    PrintMe();
                    break;

                case IDM_VIEWFULL:
                    if (!bViewFull && (ghBitmap || bStartup))
                    {
                        HDC     hDC;
                        int ScreenX, ScreenY;

                        hDC = CreateDC("DISPLAY", NULL, NULL, NULL);

                        ScreenX = GetDeviceCaps(hDC, HORZRES);

                        ScreenY = GetDeviceCaps(hDC, VERTRES);
                        DeleteDC(hDC);

                        hViewWnd = CreateWindow((LPSTR)"ViewClass", (LPSTR)NULL,
                                WS_POPUP | WS_VISIBLE, 0, 0, ScreenX, ScreenY,
                                hWnd, NULL, ghInst, NULL);

                        ShowWindow(hViewWnd, SW_SHOW);
                        UpdateWindow(hViewWnd);
                    }
                    else {
                        LoadString(ghInst, IDS_NOIMAGE, lpBuffer, sizeof(lpBuffer));
                        LoadString(ghInst, IDS_VWFULLSCRN, lpBuffer2, sizeof(lpBuffer2));
                        MessageBox(hWnd, lpBuffer, lpBuffer2, MB_OK);
                    }
                    break;

                case IDM_EDITCOPY: // Copy DIB, bitmap, & palette to clipboard
                    if (OpenClipboard(hWnd))
                    {
                        HDIB        hDib;
                        HBITMAP     hBitmap;
                        HPALETTE    hPal;

                        EmptyClipboard();

                        if (ghBitmap)
                        {
                            // Once these are added to the clipboard, the
                            // clipboard owns the data.

                            if (hDib = BitmapToDIB(ghBitmap, ghPal))
                                SetClipboardData(CF_DIB, hDib);

                            // Make a copy of the bitmap so the clipboard can
                            // own it.

                            if (hBitmap = DIBToBitmap(hDib, ghPal))
                                SetClipboardData(CF_BITMAP, hBitmap);

                            // Make a copy of the palette so the clipboard can
                            // own it.

                            if (hPal = GetStockObject(DEFAULT_PALETTE))
                                SetClipboardData(CF_PALETTE, hPal);
                        }

                        CloseClipboard();
                    }
                    break;

                case IDM_VIEWCLEAR:
                {
                    WORD        wRet;

                    if (gbSave)
                    {
                        LoadString(ghInst, IDS_SAVEBMP, lpBuffer, sizeof(lpBuffer));
                        wRet =(WORD) MessageBox(hWnd, lpBuffer,
                                szAppName, MB_ICONEXCLAMATION | MB_YESNOCANCEL);

                        if (wRet == IDYES)
                            SaveMe();
                        else if( wRet == IDCANCEL)
                            break;
                    }

                    gbSave = FALSE;

                    // If we are just displaying logo, don't
                    // display it anymore

                    if (bStartup)
                        bStartup = FALSE;

                    // Delete captured bitmap if we have one

                    if (ghBitmap)
                    {
                        DeleteObject(ghBitmap);
                        ghBitmap = NULL;
                    }

                    // Delete our captured bitmap's palette if we have one

                    if (ghPal)
                    {
                        DeleteObject(ghPal);
                        ghPal = NULL;
                    }

                    // Now update display to reflect fact that we
                    // nuked the captured bitmap or don't want to
                    // look at the cool logo

                    InvalidateRect(hWnd, NULL, TRUE);
                    UpdateWindow(hWnd);

                    bCapturedYet = FALSE;  // Gray out "File.Save" menu item
                    break;
                }

                case IDM_CAPTRECT:
                    gbCaptRect = TRUE;

                case IDM_CAPTWINDOW:  // make sure lParam == IDM_CURSORSELECT
                case IDM_CAPTCLIENT:  // make sure lParam == IDM_CURSORSELECT
                    lParam = IDM_CURSORSELECT;

                case IDM_ACTIVEWINDOW:
                case IDM_DESKTOP:

                // User selected one of the window capture items

                // Check to see that we aren't already in the middle of
                // capturing.  This could happen if the user presses our hotkey
                // in the middle of one of our dialog boxes.

                if (gbNowCapturing)
                {
                    LoadString(ghInst, IDS_CAPTEDALREADY, lpBuffer, sizeof(lpBuffer));
                    MessageBox(NULL, lpBuffer,
                            szAppName, MB_OK | MB_ICONEXCLAMATION);
                }
                else
                {
                    // User wants to capture screen.  One problem we may
                    // run into here is that we might have a popup menu pulled
                    // down in our own application when we get to this point
                    // (because of the hotkey feature of this app).
                    //
                    // Normally, we'd just enter a message loop after calling
                    // ShowWindow(SW_HIDE) to take care of any menu messages
                    // which may have been posted as we hide our application's
                    // window, and *then* call our screen capture routine.
                    // But unfortunately, we can't do that here and be 100% safe.
                    //
                    // If we *have* been sent here on a hotkey, and a menu of
                    // our own app is currently down, then we are currently running
                    // inside of a PeekMessage() loop in the Windows Menu
                    // manager. We should *not* enter another PeekMessage loop,
                    // but should return from this message case right away.
                    // The Windows Menu manager code relies on checking messages
                    // in it's queue via it's own PeekMessage loop, and if we
                    // entered one, it would confuse the menu manager.
                    //
                    // So what we do instead is just post ourselves a private
                    // message, and when we get this message (see below), then
                    // do the screen capture.
                    //

                    // Commence screen capture!

                    gbNowCapturing = TRUE;

                    if (wParam == IDM_DESKTOP)
                        ShowWindow(hWnd, SW_HIDE);

                    // Allow this message case to return right away.  We'll
                    // capture screen down below.

                    if (lParam != IDM_CURSORSELECT)
                        PostMessage(hWnd, WM_DOCAPTURE, wParam, 0L);
                    else if (gbCaptRect)
                    {
                        CenterWindow(hRectangleDlg, hWnd);
                        ShowWindow(hRectangleDlg, SW_SHOW);
                    }
                    else
                    {
                        CenterWindow(hSelectDlg, hWnd);
                        ShowWindow(hSelectDlg, SW_SHOW);
                    }

                    wCaptureCommand = (WORD)wParam;
                }
                break;

                case IDM_EXIT:
                    PostMessage(hWnd, WM_CLOSE, 0, 0L);
                    break;

                default:
                    return (int)DefWindowProc(hWnd, wMessage, wParam, lParam);
                    break;
            } //switch (LOWORD(wParam))

            break; // case WM_COMMAND:

        // Message case for doing screen capture.  This message is posted
        // to us from the IDM_CAPT* code above.  wParam should be equal to
        // the ID of the message which we got sent here for (it is used in
        // the call to DoCapture()).

        case WM_DOCAPTURE:
        {
            // We're going to capture a new screen, get rid of
            // previous captured image

            if (ghBitmap)
            {
                DeleteObject(ghBitmap);
                ghBitmap = NULL;
            }

            if (ghPal)
            {
                DeleteObject(ghPal);
                ghPal = NULL;
            }

            SetForegroundWindow(ghWndCapture);

            // Save captured screen as bitmap

            DoCapture(hWnd, (WORD)wParam);

            SetForegroundWindow(hWnd);

            // Un-hide Window

            ShowWindow(hWnd, SW_SHOW);

            if (IsIconic(hWnd))
                PostMessage(hWnd, WM_SYSCOMMAND, SC_RESTORE,  0L);

            if (!gbCaptRect)
                gbNowCapturing = FALSE;

            bCapturedYet = TRUE; // Enable "File.Save" menu item
            gbSave = TRUE;
            break;
        }

        case WM_LBUTTONDOWN:
        {

            if (!gbNowCapturing)
                break;

            ShowWindow(hWnd, SW_HIDE);  // Hide main app's window
            if (gbCaptRect)
                ShowWindow(hRectangleDlg, SW_HIDE);
            else
                ShowWindow(hSelectDlg, SW_HIDE);
            if (gbCaptRect)
            {
                hOldCursor = SetCursor(LoadCursor(NULL, IDC_CROSS));
                PostMessage(hWnd, WM_DOCAPTURE, wCaptureCommand, 0L);
            }
            else
                hOldCursor = SetCursor(LoadCursor(ghInst, "SELECT"));
            gbLButtonDown = TRUE;
            SetCapture(ghWndMain);
            break;
        }

        case WM_LBUTTONUP:
        {
            POINTS      pts;
            POINT       pt;

            if (!(gbNowCapturing && gbLButtonDown))
                break;

            ReleaseCapture();
            gbLButtonDown = FALSE;
            SetCursor(hOldCursor);

            if (gbCaptRect)
            {
                gbCaptRect = FALSE;
                gbNowCapturing = FALSE;
                break;
            }

            FrameWindow(hBrowseWnd);
            hBrowseWnd = NULL;

            pts = MAKEPOINTS(lParam);
            pt.x = pts.x;
            pt.y = pts.y;

            // Convert to screen coordinates

            ClientToScreen(ghWndMain, &pt);

            // Get Window that we clicked on

            ghWndCapture = WindowFromPoint(pt);

            // If it's not a valid window, just return NULL

            if (!ghWndCapture)
            {
               SetCursor(hOldCursor);
               gbLButtonDown = gbNowCapturing = FALSE;
               break;
            }

            PostMessage(hWnd, WM_DOCAPTURE, wCaptureCommand, 0L);
            break;

        }

        case WM_MOUSEMOVE:
        {
            POINT       pt;
            HWND        hWndCurrent;

            if (!(gbNowCapturing && gbLButtonDown))
                break;

            if (gbCaptRect)
                break;

            // get the current mouse position

            GetCursorPos(&pt);

            // Get Window that we clicked on

            hWndCurrent = WindowFromPoint(pt);

            // if the cursor is still moving in the current window, no need
            // to highlight it again

            if (hWndCurrent != hBrowseWnd)
            {
                FrameWindow(hBrowseWnd);
                FrameWindow(hWndCurrent);
                hBrowseWnd = hWndCurrent;
                if (hWndCurrent)
                    UpdateWindow(hWndCurrent);
            }

            break;
        }

        case WM_CLOSE:
        {
            WORD        wRet;

            if (gbSave)
            {
                LoadString(ghInst, IDS_SAVEBMP, lpBuffer, sizeof(lpBuffer));
                wRet = (WORD) MessageBox(hWnd, lpBuffer,
                        szAppName, MB_ICONEXCLAMATION | MB_YESNOCANCEL);

                if (wRet == IDYES)
                    SaveMe();
                else if( wRet == IDCANCEL)
                    break;
            }

            if (IsWindow(hSelectDlg))
                DestroyWindow(hSelectDlg);
            if (IsWindow(hRectangleDlg))
                DestroyWindow(hRectangleDlg);

            return (int)DefWindowProc(hWnd, wMessage, wParam, lParam);
        }

        case WM_DESTROY:  // Clean up
            InstallHook(hWnd, FALSE);  // Remove keyboard hook
            DeleteObject(ghbmLogo);

            if (ghBitmap)
                DeleteObject(ghBitmap);
            if (ghPal)
                DeleteObject(ghPal);

            PostQuitMessage(0);
            break;

        default:
            return (int)DefWindowProc(hWnd, wMessage, wParam, lParam);
    }
    return 0L;
}

Variable Documentation

BOOL bStartup = TRUE

Definition at line 59 of file WinCap.c.

BOOL bViewFull = FALSE

Definition at line 60 of file WinCap.c.

BOOL gbCaptRect = FALSE

Definition at line 70 of file WinCap.c.

BOOL gbLButtonDown = FALSE

Definition at line 66 of file WinCap.c.

BOOL gbNowCapturing = FALSE

Handle to main window.

Definition at line 69 of file WinCap.c.

BOOL gbSave = FALSE

Definition at line 67 of file WinCap.c.

HBITMAP ghBitmap = NULL

Definition at line 62 of file WinCap.c.

HBITMAP ghbmLogo

Definition at line 61 of file WinCap.c.

HINSTANCE ghInst

Name of app.

Definition at line 51 of file WinCap.c.

HPALETTE ghPal = NULL

Definition at line 63 of file WinCap.c.

HWND ghWndCapture = NULL

Definition at line 68 of file WinCap.c.

HWND ghWndMain

Handle to instance.

Definition at line 52 of file WinCap.c.

char gszWindowText[100]

Definition at line 64 of file WinCap.c.

UINT guiFileOKMsg

Definition at line 73 of file WinCap.c.

HWND hModelessDlg

Definition at line 56 of file WinCap.c.

HWND hRectangleDlg

Definition at line 72 of file WinCap.c.

HWND hSelectDlg

Definition at line 71 of file WinCap.c.

HOOKPROC lpfnKeyHook

Definition at line 54 of file WinCap.c.

HOOKPROC lpfnOldHook

Definition at line 55 of file WinCap.c.

char szAppName[20]

Definition at line 47 of file WinCap.c.

Generated on Wed Nov 13 2024 16:53:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/WinCap32/WinCap.h File Reference

  • Multimedia
  • Gdi
  • WinCap32
Classes | Defines | Typedefs | Functions

WinCap.h File Reference

Go to the source code of this file.

Classes

struct | tagOPTIONS

Defines

#define | IDD_1 106
#define | IDD_24 109
#define | IDD_4 107
#define | IDD_8 108
#define | IDD_BPP 111
#define | IDD_FILETYPE 101
#define | IDD_FILETYPEGROUP 110
#define | IDD_PM 105
#define | IDD_RGB 102
#define | IDD_RLE4 103
#define | IDD_RLE8 104
#define | IDM_ABOUT 140
#define | IDM_ACTIVEWINDOW 250
#define | IDM_CAPTCLIENT 220
#define | IDM_CAPTRECT 230
#define | IDM_CAPTUREHIDE 240
#define | IDM_CAPTWINDOW 210
#define | IDM_CURSORSELECT 340
#define | IDM_DESKTOP 260
#define | IDM_EDITCOPY 180
#define | IDM_EXIT 130
#define | IDM_PRINT 120
#define | IDM_SAVE 110
#define | IDM_SELECTRECT 350
#define | IDM_VIEWCLEAR 330
#define | IDM_VIEWFULL 310
#define | IDM_VIEWRESTORED 320
#define | IDS_SAVEASTITLE 1
#define | OPTION_FILE 0x0001
#define | OPTION_PRINTER 0x0002

Typedefs

typedef struct tagOPTIONS * | LPOPTIONSTRUCT
typedef struct tagOPTIONS | OPTIONSTRUCT

Functions

LRESULT APIENTRY | AboutDlgProc (HWND, UINT, WPARAM, LPARAM)
BOOL | CenterWindow (HWND hwndChild, HWND hwndParent)
void | cwCenter (HWND, int)
void | DoCapture (HWND hWnd, WORD wCommand)
void | DoPaint (HWND)
void | DoScroll (HWND, int, int, int)
void | DoSize (HWND)
void | DrawIndent (HWND hDlg, int ID, int iType)
void | DrawSelect (HDC hdc, BOOL fDraw, LPRECT lprClip)
void | FrameWindow (HWND)
LONG APIENTRY | FullViewWndProc (HWND, UINT, WPARAM, LPARAM)
BOOL | GetFileName (HWND hWndOwner, LPSTR szFileName, PDWORD_PTR dwFlags)
BOOL WINAPI | HelpDlgProc (HWND, UINT, WPARAM, LPARAM)
int WINAPI | InstallHook (HWND hWnd, BOOL bCode)
void WINAPI | NormalizeRect (LPRECT prc)
LRESULT APIENTRY | PrintDlgProc (HWND, UINT, WPARAM, LPARAM)
void | PrintMe (void)
void | ReallyGetClientRect (HWND, LPRECT)
LRESULT CALLBACK | RectangleDlgProc (HWND, UINT, WPARAM, LPARAM)
void | RubberBandScreen (LPRECT lpRect)
void | SaveMe (void)
LRESULT APIENTRY | SavingDlgProc (HWND, UINT, WPARAM, LPARAM)
LRESULT CALLBACK | SelectDlgProc (HWND, UINT, WPARAM, LPARAM)
void | SetupScrollBars (HWND, WORD, WORD)
void | StretchIconToWindow (HWND hWndDlg, LPSTR szIconName)
LONG WINAPI | WndProc (HWND, UINT, WPARAM, LPARAM)

Define Documentation

#define IDD_1 106

Definition at line 45 of file WinCap.h.

#define IDD_24 109

Definition at line 48 of file WinCap.h.

#define IDD_4 107

Definition at line 46 of file WinCap.h.

#define IDD_8 108

Definition at line 47 of file WinCap.h.

#define IDD_BPP 111

Definition at line 50 of file WinCap.h.

#define IDD_FILETYPE 101

Definition at line 40 of file WinCap.h.

#define IDD_FILETYPEGROUP 110

Definition at line 49 of file WinCap.h.

#define IDD_PM 105

Definition at line 44 of file WinCap.h.

#define IDD_RGB 102

Definition at line 41 of file WinCap.h.

#define IDD_RLE4 103

Definition at line 42 of file WinCap.h.

#define IDD_RLE8 104

Definition at line 43 of file WinCap.h.

#define IDM_ABOUT 140

Definition at line 14 of file WinCap.h.

#define IDM_ACTIVEWINDOW 250

Definition at line 20 of file WinCap.h.

#define IDM_CAPTCLIENT 220

Definition at line 17 of file WinCap.h.

#define IDM_CAPTRECT 230

Definition at line 18 of file WinCap.h.

#define IDM_CAPTUREHIDE 240

Definition at line 19 of file WinCap.h.

#define IDM_CAPTWINDOW 210

Definition at line 16 of file WinCap.h.

#define IDM_CURSORSELECT 340

Definition at line 25 of file WinCap.h.

#define IDM_DESKTOP 260

Definition at line 21 of file WinCap.h.

#define IDM_EDITCOPY 180

Definition at line 15 of file WinCap.h.

#define IDM_EXIT 130

Definition at line 13 of file WinCap.h.

#define IDM_PRINT 120

Definition at line 12 of file WinCap.h.

#define IDM_SAVE 110

Definition at line 11 of file WinCap.h.

#define IDM_SELECTRECT 350

Definition at line 26 of file WinCap.h.

#define IDM_VIEWCLEAR 330

Definition at line 24 of file WinCap.h.

#define IDM_VIEWFULL 310

Definition at line 22 of file WinCap.h.

#define IDM_VIEWRESTORED 320

Definition at line 23 of file WinCap.h.

#define IDS_SAVEASTITLE 1

Definition at line 31 of file WinCap.h.

#define OPTION_FILE 0x0001

Definition at line 35 of file WinCap.h.

#define OPTION_PRINTER 0x0002

Definition at line 36 of file WinCap.h.

Typedef Documentation

typedef struct tagOPTIONS * LPOPTIONSTRUCT
typedef struct tagOPTIONS OPTIONSTRUCT

Function Documentation

LRESULT APIENTRY AboutDlgProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 471 of file APP.Cxx.

{

    switch(message)
    {
       case WM_INITDIALOG:
            return TRUE;
       case WM_COMMAND:
            switch (wParam) //Command ID
            {
               case IDOK:
               case IDCANCEL:
                    EndDialog(hwnd, 0);
                    return TRUE;
            }
            break;
    }
    return FALSE;
}

BOOL CenterWindow | ( | HWND | hwndChild,
 |  | HWND | hwndParent
 | ) |  |

Definition at line 676 of file Generic.C.

{
   RECT    rChild, rParent, rWorkArea;
   int     wChild, hChild, wParent, hParent;
   int     xNew, yNew;
   BOOL  bResult;

   // Get the Height and Width of the child window
   GetWindowRect (hwndChild, &rChild);
   wChild = rChild.right - rChild.left;
   hChild = rChild.bottom - rChild.top;

   // Get the Height and Width of the parent window
   GetWindowRect (hwndParent, &rParent);
   wParent = rParent.right - rParent.left;
   hParent = rParent.bottom - rParent.top;

   // Get the limits of the 'workarea'
   bResult = SystemParametersInfo(
      SPI_GETWORKAREA,  // system parameter to query or set
      sizeof(RECT),
      &rWorkArea,
      0);
   if (!bResult) {
      rWorkArea.left = rWorkArea.top = 0;
      rWorkArea.right = GetSystemMetrics(SM_CXSCREEN);
      rWorkArea.bottom = GetSystemMetrics(SM_CYSCREEN);
   }

   // Calculate new X position, then adjust for workarea
   xNew = rParent.left + ((wParent - wChild) /2);
   if (xNew < rWorkArea.left) {
      xNew = rWorkArea.left;
   } else if ((xNew+wChild) > rWorkArea.right) {
      xNew = rWorkArea.right - wChild;
   }

   // Calculate new Y position, then adjust for workarea
   yNew = rParent.top  + ((hParent - hChild) /2);
   if (yNew < rWorkArea.top) {
      yNew = rWorkArea.top;
   } else if ((yNew+hChild) > rWorkArea.bottom) {
      yNew = rWorkArea.bottom - hChild;
   }

   // Set it, and return
   return SetWindowPos (hwndChild, NULL, xNew, yNew, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
}

void cwCenter | ( | HWND | ,
 |  | int |
 | ) |  |
void DoCapture | ( | HWND | hWnd,
 |  | WORD | wCommand
 | ) |  |

Definition at line 1104 of file WinCap.c.

{
    HBITMAP     hBitmap;        // Handle to our temporary bitmap
    HPALETTE    hPal;           // Handle to our palette
    CHAR        lpBuffer[128];  // Buffer for string retrieved from resources

    switch (wCommand)
    {
        // Copy Entire screen to DIB

        case IDM_DESKTOP:
        {
            RECT rScreen;       // Rect containing entire screen coordinates
            HDC hDC;            // DC to screen
            MSG msg;            // Message for the PeekMessage()

            hDC = CreateDC("DISPLAY", NULL, NULL, NULL);
            rScreen.left = rScreen.top = 0;
            rScreen.right = GetDeviceCaps(hDC, HORZRES);
            rScreen.bottom = GetDeviceCaps(hDC, VERTRES);

            // Delete our DC

            DeleteDC(hDC);

            LoadString(ghInst, IDS_ENTIRESCRN, lpBuffer, sizeof(lpBuffer));
            strncpy(gszWindowText, lpBuffer, sizeof(gszWindowText) - 1);
      gszWindowText[sizeof(gszWindowText) - 1] = '\0';

            // Wait until everybody repaints themselves

            while (PeekMessage(&msg,NULL,0,0,PM_REMOVE) != 0)
            {
                TranslateMessage(&msg);
                DispatchMessage(&msg);
            }

            hBitmap = CopyScreenToBitmap(&rScreen);

            if (hBitmap)
                hPal = GetSystemPalette();
            else
                hPal = NULL;
        }
        break;

        // copy user-selected portion of screen to DIB

        case IDM_CAPTRECT:
        {
            RECT rRubberBand;       // Region to capture (screen coordinates)

            // Allow user to "rubberband" a section of the screen for
            // us to capture

            RubberBandScreen(&rRubberBand);
            LoadString(ghInst, IDS_USERSELECT, lpBuffer, sizeof(lpBuffer));
            strncpy(gszWindowText, lpBuffer, sizeof(gszWindowText) - 1);
      gszWindowText[sizeof(gszWindowText) - 1] = '\0';

            hBitmap = CopyScreenToBitmap(&rRubberBand);

            if (hBitmap)
                hPal = GetSystemPalette();
            else
                hPal = NULL;
        }
        break;

        case IDM_CAPTWINDOW:
        case IDM_CAPTCLIENT:
        case IDM_ACTIVEWINDOW:
        {
            HWND    hWndSelect;       // The current active window
            HWND    hWndDesktop;      // Window to desktop
            MSG     msg;              // For our peekmessage loop

            // Just capture the current active window, whatever it is

            if (wCommand == IDM_ACTIVEWINDOW)
                hWndSelect = GetForegroundWindow();

            // Allow the user to click on a single window to capture

            else
                hWndSelect = ghWndCapture;

            // If they try to capture the desktop window, then just
            // capture the entire screen.

            hWndDesktop = GetDesktopWindow();

            if (hWndSelect == hWndDesktop)
            {
                RECT    rScreen;    // contains entire screen coordinates
                HDC     hDC;        // DC to screen
                MSG     msg1;       // Message for the PeekMessage()

                hDC = CreateDC("DISPLAY", NULL, NULL, NULL);
                rScreen.left = rScreen.top = 0;
                rScreen.right = GetDeviceCaps(hDC, HORZRES);
                rScreen.bottom = GetDeviceCaps(hDC, VERTRES);

                /* Delete our DC */
                DeleteDC(hDC);

                LoadString(ghInst, IDS_ENTIRESCRN, lpBuffer, sizeof(lpBuffer));
                strncpy(gszWindowText, lpBuffer, sizeof(gszWindowText) -1);

                // Wait until everybody repaints themselves

                while (PeekMessage(&msg1,NULL,0,0,PM_REMOVE) != 0)
                {
                    TranslateMessage(&msg1);
                    DispatchMessage(&msg1);
                }

                ghBitmap = CopyScreenToBitmap(&rScreen);

                if (ghBitmap)
                    ghPal = GetSystemPalette();
                else
                    ghPal = NULL;

                ghWndCapture = NULL;
                return;
            }

            // Check to see that the hWnd is not NULL

            if (!hWndSelect)
            {
                LoadString(ghInst, IDS_CANTCAPWNDW, lpBuffer, sizeof(lpBuffer));
                MessageBox(NULL, lpBuffer, szAppName,
                        MB_ICONEXCLAMATION | MB_OK);

                hBitmap = NULL;
                hPal = NULL;
                break;
            }

            // Make sure it's not a hidden window.  Hmm, capturing a hidden
            // window would certainly be a cool trick, wouldn't it?

            if (!IsWindowVisible(hWndSelect))
            {
                LoadString(ghInst, IDS_WNDWNOTVIS, lpBuffer, sizeof(lpBuffer));
                MessageBox(NULL, lpBuffer,
                        szAppName, MB_ICONEXCLAMATION | MB_OK);

                ghWndCapture = NULL;
                hBitmap = NULL;
                hPal = NULL;
                break;
            }

            // Move window which was selected to top of Z-order for
            // the capture, and make it redraw itself

            SetWindowPos(hWndSelect, NULL, 0, 0, 0, 0,
                    SWP_DRAWFRAME | SWP_NOSIZE | SWP_NOMOVE);

            UpdateWindow(hWndSelect);

            // Wait until everybody repaints themselves

            while (PeekMessage(&msg,NULL,0,0,PM_REMOVE) != 0)
            {
                TranslateMessage(&msg);
                DispatchMessage(&msg);
            }

            // Get the caption

            GetWindowText(hWndSelect, gszWindowText, 100);

            // Capture the screen -- if we selected CLIENT only capture, then
            // select that open when calling our API.  Otherwise, get the
            // entire window.

            hBitmap = CopyWindowToBitmap(hWndSelect,
                    (WORD)((wCommand == IDM_CAPTCLIENT) ? (PW_CLIENT) :
                    (PW_WINDOW)));

            if (hBitmap)
                hPal = GetSystemPalette();
            else
                hPal = NULL;

            break;
        }

        //Oops, something went wrong

        default:
            LoadString(ghInst, IDS_INTERROR, lpBuffer, sizeof(lpBuffer));
            MessageBox(NULL, lpBuffer, szAppName,
                    MB_ICONHAND | MB_OK);
            break;
    }

    if (hBitmap)
    {
        ghBitmap = hBitmap;
        hBitmap = NULL;
    }
    if (hPal)
    {
        ghPal = hPal;
        hPal = NULL;
    }

    // Now, paint our bitmap in the client area

    if (bStartup)
        bStartup = FALSE;

    InvalidateRect(hWnd, NULL, FALSE);
    UpdateWindow(hWnd);
    ghWndCapture = NULL;
}

void DoPaint ( HWND )

Definition at line 1804 of file WinCap.c.

{
    HDC             hDC, hMemDC;         // Handle to DC, memory DC
    PAINTSTRUCT     ps;                  // Painting structure
    BITMAP          bm;                  // BITMAP structure
    HBITMAP         hOldBm;              // Handle to previous bitmap
    RECT            rectClient, rectDDB; // Client and bitmap rectangles
    int             xScroll, yScroll;    // Scroll positions
    int             x, y;                // Logo origin

    // Begin painting

    hDC = BeginPaint(hWnd, &ps);

    // Check to see if we are displaying a bitmap

    if (!ghBitmap)
    {
        // No bitmap yet, are we in start mode?

        if (bStartup)
        {
            GetClientRect(hWnd, &rectClient);

            hMemDC = CreateCompatibleDC(ps.hdc);

            // Select our logo bitmap

            hOldBm = SelectObject(hMemDC, ghbmLogo);

            GetObject(ghbmLogo, sizeof(BITMAP), (VOID *)&bm);

            x = (rectClient.right - bm.bmWidth) / 2;
            y = (rectClient.bottom - bm.bmHeight) / 2;

            // Now bitblt our logo to client area

            BitBlt(ps.hdc, x, y, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0,
                    SRCCOPY);

            // Clean up
            SelectObject(hMemDC,hOldBm);
            DeleteDC(hMemDC);
        }
        else
        {
            // Turn off scroll bars in case they were on

                SetScrollRange (hWnd, SB_VERT, 0, 0, TRUE);
            SetScrollRange (hWnd, SB_HORZ, 0, 0, TRUE);
        }
    }
    else // We are displaying a bitmap
    {
        // Get bitmap info

        GetObject(ghBitmap, sizeof(BITMAP), (LPSTR)&bm);

        // Get scroll bar positions

        xScroll  = GetScrollPos  (hWnd, SB_HORZ);
        yScroll  = GetScrollPos  (hWnd, SB_VERT);

        // Set up the scroll bars appropriately.

        SetupScrollBars(hWnd, (WORD)bm.bmWidth, (WORD)bm.bmHeight);

        // Set up the necessary rectangles -- i.e. the rectangle
        //  we're rendering into, and the rectangle in the bitmap

        GetClientRect (hWnd, &rectClient);

        rectDDB.left   = xScroll;
        rectDDB.top    = yScroll;
        rectDDB.right  = xScroll + rectClient.right - rectClient.left;
        rectDDB.bottom = yScroll + rectClient.bottom - rectClient.top;

        if (rectDDB.right > bm.bmWidth)
        {
            int dx;

            dx = bm.bmWidth - rectDDB.right;

            rectDDB.right     += dx;
            rectClient.right  += dx;
        }

        if (rectDDB.bottom > bm.bmHeight)
        {
            int dy;

            dy = bm.bmHeight - rectDDB.bottom;

            rectDDB.bottom    += dy;
            rectClient.bottom += dy;
        }

        // Go do the actual painting.

        PaintBitmap(hDC, &rectClient, ghBitmap, &rectDDB, ghPal);
    }

    EndPaint(hWnd, &ps);
}

void DoScroll | ( | HWND | ,
 |  | int | ,
 |  | int | ,
 |  | int |
 | ) |  |

Definition at line 1702 of file WinCap.c.

{
    int  xBar;          // Where scrollbar is now.
    int  nMin;          // Minumum scroll bar value.
    int  nMax;          // Maximum scroll bar value.
    int  dx;            // How much to move.
    int  nOneUnit;      // # of pixels for LINEUP/LINEDOWN
    int  cxClient;      // Width of client area.
    int  nHorzOrVert;   // Doing the horizontal or vertical?
    RECT rect;          // Client area.

    GetClientRect (hWnd, &rect);

    if (message == WM_HSCROLL)
    {
        nHorzOrVert = SB_HORZ;
        cxClient    = rect.right - rect.left;
    }
    else
    {
        nHorzOrVert = SB_VERT;
        cxClient    = rect.bottom - rect.top;
    }

    // On a SB_LINEUP/SB_LINEDOWN we will move the DIB by
    //  1/SCROLL_RATIO of the client area (i.e. if SCROLL_RATIO
    //  is 4, it will scroll the DIB a quarter of the client
    //  area's height or width.

    nOneUnit = cxClient / SCROLL_RATIO;
    if (!nOneUnit)
        nOneUnit = 1;

    xBar = GetScrollPos (hWnd, nHorzOrVert);
    GetScrollRange (hWnd, nHorzOrVert, &nMin, &nMax);

    switch (wScrollType)
    {
        case SB_LINEDOWN:             // One line right.
            dx = nOneUnit;
            break;

        case SB_LINEUP:               // One line left.
            dx = -nOneUnit;
            break;

        case SB_PAGEDOWN:             // One page right.
            dx = cxClient;
            break;

        case SB_PAGEUP:               // One page left.
            dx = -cxClient;
            break;

        case SB_THUMBPOSITION:        // Absolute position.
            dx = wPos - xBar;
            break;

        default:                      // No change.
            dx = 0;
            break;
    }

    if (dx)
    {
        xBar += dx;

        if (xBar < nMin)
        {
            dx  -= xBar - nMin;
            xBar = nMin;
        }

        if (xBar > nMax)
        {
            dx  -= xBar - nMax;
            xBar = nMax;
        }

        if (dx)
        {
            SetScrollPos (hWnd, nHorzOrVert, xBar, TRUE);

            if (nHorzOrVert == SB_HORZ)
                ScrollWindow (hWnd, -dx, 0, NULL, NULL);
            else
                ScrollWindow (hWnd, 0, -dx, NULL, NULL);

            UpdateWindow (hWnd);
        }
    }
}

void DoSize ( HWND )

Definition at line 1553 of file WinCap.c.

{
    BITMAP      bm;                     // Bitmap info structure
    int         cxBitmap=0, cyBitmap=0; // Bitmap width and height
    int         cxScroll, cyScroll;     // Scroll positions
    RECT        rect;                   // Client rectangle

    // repaint if displaying bitmap

    if (ghBitmap)
    {
        // Get info about bitmap

        GetObject(ghBitmap, sizeof(BITMAP), (LPSTR)&bm);

        // Get the width and height of the bitmap

        cxBitmap = bm.bmWidth;
        cyBitmap = bm.bmHeight;

        // Find out the dimensions of the window, and the current thumb
        // positions

        GetClientRect(hWnd, &rect);

        cxScroll = GetScrollPos (hWnd, SB_HORZ);
        cyScroll = GetScrollPos (hWnd, SB_VERT);

        // If current thumb positions would cause blank space
        // at right or bottom of client area, repaint

        if (cxScroll + rect.right > cxBitmap ||
                cyScroll + rect.bottom > cyBitmap)
            InvalidateRect(hWnd, NULL, FALSE);

        // Make sure scroll bars are updated

        SetupScrollBars(hWnd, (WORD)cxBitmap, (WORD)cyBitmap);
    }
    else if (bStartup)
        InvalidateRect(hWnd, NULL, TRUE);
}

void DrawIndent | ( | HWND | hDlg,
 |  | int | ID,
 |  | int | iType
 | ) |  |
void DrawSelect | ( | HDC | hdc,
 |  | BOOL | fDraw,
 |  | LPRECT | lprClip
 | ) |  |

Definition at line 1463 of file WinCap.c.

{
    char sz[80];
    DWORD dw;
    int x, y, len, dx, dy;
    HDC hdcBits;
    HBITMAP hbm;
    RECT rcClip;
    SIZE sExtent;

    rcClip = *lprClip;
    if (!IsRectEmpty(&rcClip))
    {

        // If a rectangular clip region has been selected, draw it

        PatBlt(hdc, rcClip.left, rcClip.top, rcClip.right - rcClip.left, 1,
                DSTINVERT);
        PatBlt(hdc, rcClip.left, rcClip.bottom, 1, -(rcClip.bottom-rcClip.top),
                DSTINVERT);
        PatBlt(hdc, rcClip.right - 1, rcClip.top, 1, rcClip.bottom - rcClip.top,
                DSTINVERT);
        PatBlt(hdc, rcClip.right, rcClip.bottom - 1, -(rcClip.right -
                rcClip.left), 1, DSTINVERT);

        // Format the dimensions string ...

        _snprintf(sz, sizeof(sz) - 1, "%dx%d", rcClip.right - rcClip.left, rcClip.bottom -
               rcClip.top);
    sz[sizeof(sz) - 1] = '\0';

        len = lstrlen(sz);

        // ... and center it in the rectangle

        dw = GetTextExtentPoint(hdc, sz, len, &sExtent);
        dx = sExtent.cx;
        dy = sExtent.cy;
        x = (rcClip.right + rcClip.left - dx) / 2;
        y = (rcClip.bottom + rcClip.top - dy) / 2;
        hdcBits = CreateCompatibleDC(hdc);
        SetTextColor(hdcBits, 0xFFFFFFL);
        SetBkColor(hdcBits, 0x000000L);

        // Output the text to the DC

        if (hbm = CreateBitmap(dx, dy, 1, 1, NULL))
        {
            hbm = SelectObject(hdcBits, hbm);
            ExtTextOut(hdcBits, 0, 0, 0, NULL, sz, len, NULL);
            BitBlt(hdc, x, y, dx, dy, hdcBits, 0, 0, SRCINVERT);
            hbm = SelectObject(hdcBits, hbm);
            DeleteObject(hbm);
        }
        DeleteDC(hdcBits);
    }
}

void FrameWindow ( HWND )

Definition at line 1920 of file WinCap.c.

{
    HDC     hdc;
    RECT    rc;

#define DINV    3

    if (!IsWindow(hWnd))
        return;

    hdc = GetWindowDC(hWnd);
    GetWindowRect(hWnd, &rc);
    OffsetRect(&rc, -rc.left, -rc.top);

    if (!IsRectEmpty(&rc))
    {
        PatBlt(hdc, rc.left, rc.top, rc.right-rc.left, DINV, DSTINVERT);
        PatBlt(hdc, rc.left, rc.bottom-DINV, DINV, -(rc.bottom-rc.top-2*DINV),
                DSTINVERT);
        PatBlt(hdc, rc.right-DINV, rc.top+DINV, DINV, rc.bottom-rc.top-2*DINV,
                DSTINVERT);
        PatBlt(hdc, rc.right, rc.bottom-DINV, -(rc.right-rc.left), DINV,
                DSTINVERT);
    }

    ReleaseDC(hWnd, hdc);
}

LONG APIENTRY FullViewWndProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 829 of file WinCap.c.

{
    switch (wMessage)
    {
        case WM_PAINT:
        {
            PAINTSTRUCT     ps;
            HDC             hMemDC;
            BITMAP          bm;
            HBITMAP         hOldBm;
            RECT            rect, rectClient;
            int             x, y;

            BeginPaint(hWnd, &ps);

            // Check to see if we are displaying a bitmap

            if (!ghBitmap)
            {

                // No bitmap yet, are we in start mode?

                if (bStartup)
                {
                    GetClientRect(hWnd, &rectClient);

                    hMemDC = CreateCompatibleDC(ps.hdc);

                    // Select our logo bitmap

                    hOldBm = SelectObject(hMemDC, ghbmLogo);
                    GetObject(ghbmLogo, sizeof(BITMAP), (VOID *)&bm);

                    x = (rectClient.right - bm.bmWidth) / 2;
                    y = (rectClient.bottom - bm.bmHeight) / 2;

                    // Now bitblt our logo to client area
                    BitBlt(ps.hdc, x, y, bm.bmWidth, bm.bmHeight,
                          hMemDC, 0, 0, SRCCOPY);

                    // Clean up
                    SelectObject(hMemDC,hOldBm);
                    DeleteDC(hMemDC);
                }
            }
            else
            {
                // Get info for captured bitmap

                GetObject(ghBitmap, sizeof(BITMAP), (LPSTR)&bm);

                // Fill in src/dest rectangle with width and height
                // of captured bitmap

                rect.left = 0;
                rect.top = 0;
                rect.right = bm.bmWidth;
                rect.bottom = bm.bmHeight;

                // Paint the captured bitmap in the client area

                PaintBitmap(ps.hdc, &rect, ghBitmap, &rect, ghPal);
            }

            EndPaint(hWnd, &ps);
            break;
         }

        case WM_KEYDOWN:
        case WM_LBUTTONDOWN:
            DestroyWindow(hWnd);
            break;

        default:
            return (int)DefWindowProc(hWnd, wMessage, wParam, lParam);
    }

  return 0;
}

BOOL GetFileName | ( | HWND | hWndOwner,
 |  | LPSTR | szFileName,
 |  | PDWORD_PTR | dwFlags
 | ) |  |

Definition at line 55 of file Dlgopen.c.

{
    OPENFILENAME   of;
    DWORD          flags;
    static char    szTitle[50];         // Dialog Box title
    static char    szFile[MAXFILENAMELEN];         // File name
    DWORD_PTR      dw = 0;               // Local copy of flags for validation
    BOOL           bReturn;             // Return code
    DWORD_PTR      dwLocalOpt;
    CHAR           lpBuffer[128];       // Holds strings retrieved from resources

    // Parameter validation -- try to recover gracefully if LPWORD
    // is NULL, so we don't die when we try to do a *wFlags = x below

  if (!szFileName)
    return FALSE;

    if (dwFlags == NULL)
        dwFlags = &dw;

    dwLocalOpt = *dwFlags;  // Make local copy of options

    // Initialize the OPENFILENAME members

    lstrcpyn(szFile, "*.BMP", 6); // copy the extension over to the file
  szFile[5] = '\0';

    LoadString(ghInst, IDS_SAVEASTITLE, (LPSTR)szTitle, 50);
    LoadString(ghInst, IDS_SAVEFILTER, lpBuffer, sizeof(lpBuffer));
    flags = OFN_ENABLEHOOK | OFN_ENABLETEMPLATE | OFN_HIDEREADONLY |
            OFN_OVERWRITEPROMPT;

    of.lStructSize       = sizeof (OPENFILENAME);
    of.hwndOwner         = hWndOwner;
    of.hInstance         = ghInst;
    of.lpstrFilter       = lpBuffer;
    of.lpstrCustomFilter = NULL;
    of.nMaxCustFilter    = 0L;
    of.nFilterIndex      = 1L;
    of.lpstrFile         = (LPSTR)szFile;
    of.nMaxFile          = MAXFILENAMELEN;
    of.lpstrFileTitle    = NULL;
    of.nMaxFileTitle     = 0;
    of.lpstrInitialDir   = NULL;
    of.lpstrTitle        = szTitle;
    of.Flags             = flags;
    of.nFileOffset       = 0;
    of.nFileExtension    = 0;
    of.lpstrDefExt       = "bmp";
    of.lpfnHook          = (LPOFNHOOKPROC)FileSaveHookProc;
    of.lpTemplateName    = (LPSTR)"FILESAVE";

    // Place our flags in the lCustData parameter

    of.lCustData         = dwLocalOpt;

    // Call the GetSaveFilename function

    if (GetSaveFileName (&of))
    {
        // User pressed OK, continue on

        bReturn = TRUE;

        // Copy filename out

        lstrcpyn (szFileName, of.lpstrFile, MAXFILENAMELEN );  // This is the most the file itself can take.  szFileName is 255, of.lpstrFile is 144
    szFileName[ sizeof(szFileName) - 1 ] = '\0';

        // Copy flags out

        *dwFlags = of.lCustData;

    }
    else
    {
    MessageBox(hWndOwner,TEXT("An error occurred while saving the file."), TEXT("Error in Save"), MB_OK);
        bReturn = FALSE;
        szFileName[0] = '\0';
        *dwFlags = 0;
    }

    return bReturn;
}

BOOL WINAPI HelpDlgProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |
int WINAPI InstallHook | ( | HWND | hWnd,
 |  | BOOL | bCode
 | ) |  |

Definition at line 62 of file Hook.c.

{

    int nReturn = 1;

    ghWndMain = hWnd;  // Store app's window handle in DLL global variable

    // Make sure that we are installing/removing in the proper order

    if (bCode == bHookInstalled)
        return 0;

    if (bCode)
    {
        hHook = (HHOOK)SetWindowsHookEx(WH_KEYBOARD,(HOOKPROC)KeyboardHook,
            ghDLLInst, 0);

        if (!hHook)
            return 0;

        bHookInstalled = TRUE;
    }
    else
    {
        nReturn = UnhookWindowsHookEx(hHook);
        bHookInstalled = FALSE;
    }
    return nReturn;
}

void WINAPI NormalizeRect ( LPRECT prc )

Definition at line 1532 of file WinCap.c.

{
    if (prc->right  < prc->left) SWAP(prc->right,  prc->left);
    if (prc->bottom < prc->top)  SWAP(prc->bottom, prc->top);
}

LRESULT APIENTRY PrintDlgProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 496 of file APP.Cxx.

{
    switch (message)
    {
        case WM_INITDIALOG:
             SetWindowText (hwndDlg, (TCHAR *)lParam) ;
             EnableMenuItem (GetSystemMenu (hwndDlg, FALSE), SC_CLOSE, MF_GRAYED) ;
             return TRUE ;

        case WM_COMMAND:
             PrGlobal._bUserAbort = TRUE ;
             EnableWindow (GetParent (hwndDlg), TRUE) ;
             DestroyWindow (hwndDlg) ;
             PrGlobal._hDlgPrint = 0 ;
             return TRUE ;
    }
    return FALSE ;
}

void PrintMe ( void )

Definition at line 1047 of file WinCap.c.

{
    static OPTIONSTRUCT opts;
    DWORD_PTR           iReturn;
    HDIB                hDIB;
    WORD                wReturn;

    // Display "Print Options" Box

    iReturn = DialogBoxParam(ghInst, (LPSTR)"Print", ghWndMain, PrintDlgProc,
            (LPARAM) &opts);

    if (iReturn)
    {
        // User pressed "OK" -- do the printing

        hDIB = BitmapToDIB(ghBitmap, ghPal);

        if (hDIB)
        {

            // Print the dib using PrintDIB() API

            if (opts.iOption == IDC_STRETCHTOPAGE)
                wReturn = PrintDIB(hDIB, PW_STRETCHTOPAGE, 0, 0,
                        (LPSTR)gszWindowText);

            else if (opts.iOption == IDC_SCALE)
                wReturn = PrintDIB(hDIB, (WORD)PW_SCALE, (WORD)opts.iXScale,
                        (WORD)opts.iYScale, (LPSTR)gszWindowText);
            else
                wReturn = PrintDIB(hDIB, PW_BESTFIT, 0, 0,
                        (LPSTR)gszWindowText);

            if (wReturn)
                DIBError(wReturn);

            DestroyDIB(hDIB);
        }
    }
}

void ReallyGetClientRect | ( | HWND | ,
 |  | LPRECT |
 | ) |  |

Definition at line 1607 of file WinCap.c.

{
    DWORD   dwWinStyle;

    dwWinStyle = GetWindowLong (hWnd, GWL_STYLE);

    GetClientRect (hWnd, lpRect);

    if (dwWinStyle & WS_HSCROLL)
        lpRect->bottom += (GetSystemMetrics (SM_CYHSCROLL) - 1);

    if (dwWinStyle & WS_VSCROLL)
        lpRect->right  += (GetSystemMetrics (SM_CXVSCROLL) - 1);
}

LRESULT CALLBACK RectangleDlgProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 371 of file Dialogs.c.

{
    switch (message)
    {
        case WM_INITDIALOG:
        {
            HGLOBAL     hMem;
            char        *szText;

            hMem = GlobalAlloc(GHND, 200);
      if (!hMem)
        return FALSE;

            szText = (char *)GlobalLock(hMem);
            if(szText == NULL)
                return TRUE;

            LoadString(ghInst, IDS_RECT2, szText, 200);
            SetDlgItemText(hDlg, IDC_STATIC_RECT2, szText);
            LoadString(ghInst, IDS_RECT3, szText, 200);
            SetDlgItemText(hDlg, IDC_STATIC_RECT3, szText);

            GlobalUnlock(hMem);
            GlobalFree(hMem);

            return TRUE;
        }

        case WM_COMMAND:
            if ((wParam) != IDCANCEL)
                return FALSE;
            else
            {
                ShowWindow(hDlg, SW_HIDE);
                gbNowCapturing = FALSE;
        gbCaptRect = FALSE;
                return TRUE;
            }

        case WM_SYSCOMMAND:
            if(wParam == SC_CLOSE)
            {
                ShowWindow(hDlg, SW_HIDE);
                gbNowCapturing = FALSE;
                return TRUE;
            }
            else
                return FALSE;

        case WM_DESTROY:
            return TRUE;

        default:
            return FALSE;
    }
}

void RubberBandScreen ( LPRECT lpRect )

Definition at line 1344 of file WinCap.c.

{
    POINT   pt;                 // Temporary POINT
    MSG     msg;                // Used in our PeekMessage() loop
    POINT   ptOrigin;           // Point where the user pressed left mouse button down
    RECT    rcClip;             // Current selection
    HDC     hScreenDC;          // DC to the screen (so we can draw on it)
    BOOL    bCapturing = FALSE; // TRUE if we are rubber-banding
    POINTS  pts;
    BOOL    bLButtonUp = FALSE;

    hScreenDC = CreateDC("DISPLAY", NULL, NULL, NULL);

    // Eat mouse messages until a WM_LBUTTONUP is encountered. Meanwhile
    // continue to draw a rubberbanding rectangle and display it's dimensions

    for (;;)
    {
        WaitMessage();
        if (PeekMessage(&msg, NULL, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE))
        {
            // If the message is a WM_LBUTTONDOWN, begin drawing the
            // rubber-band box.

            if (msg.message == WM_RBUTTONDOWN)
            {
                // User pressed left button, initialize selection
                // Set origin to current mouse position (in window coords)

                pts = MAKEPOINTS(msg.lParam);

                ptOrigin.x = pts.x;
                ptOrigin.y = pts.y;

                // Convert to screen coordinates

                ClientToScreen(ghWndMain, &ptOrigin);

                // rcClip is the current rectangle that the user
                // has selected.  Since user just pressed left button down,
                // initialize this rect very small

                rcClip.left = rcClip.right = ptOrigin.x;
                rcClip.top = rcClip.bottom = ptOrigin.y;
                NormalizeRect(&rcClip);     // Make sure it is a normal rect
                DrawSelect(hScreenDC, TRUE, &rcClip); // Draw the rubber-band box
                bCapturing = TRUE;
            }

            else if (msg.message == WM_LBUTTONUP)
            {
                if (!bCapturing)
                    break;
                else
                {
                    bLButtonUp = TRUE;
                    PostMessage(ghWndMain, WM_RBUTTONUP, msg.wParam, msg.lParam);
                }
            }

            // Any messages that make it into the next statement are mouse
            // messages, and we are capturing, so let's update the rubber-band
            // box

            if (bCapturing)
            {
                DrawSelect(hScreenDC, FALSE, &rcClip);  // erase old rubber-band
                rcClip.left = ptOrigin.x;   // Update rect with new mouse info
                rcClip.top = ptOrigin.y;

                pts = MAKEPOINTS(msg.lParam);

                pt.x = pts.x;
                pt.y = pts.y;

                // Convert to screen coordinates

                ClientToScreen(ghWndMain, &pt);
                rcClip.right = pt.x;
                rcClip.bottom = pt.y;
                NormalizeRect(&rcClip);
                DrawSelect(hScreenDC, TRUE, &rcClip); // new rubber-band
            }

            // If the message is WM_LBUTTONUP, then we stop the selection
            // process.

            if (msg.message == WM_RBUTTONUP)
            {
                DrawSelect(hScreenDC, FALSE, &rcClip);    // erase rubber-band
                if (bLButtonUp)
                    PostMessage(ghWndMain, WM_LBUTTONUP, msg.wParam, msg.lParam);
                break;
            }
        }
        else
            continue;
    }
    DeleteDC(hScreenDC);

    // Assign rect user selected to lpRect parameter

    if (!IsRectEmpty(&rcClip))
        CopyRect(lpRect, &rcClip);

    PostMessage(ghWndMain, WM_LBUTTONUP, msg.wParam, msg.lParam);
}

void SaveMe ( void )

Definition at line 921 of file WinCap.c.

{
    char    szFileBuf[255];     // Buffer to hold returned file name
    DWORD_PTR dwFlags;            // used to pass in / get out file type
    HDC     hDC;                // HDC for getting info
    int     iBits;              // Bits per pixel of the display adapter
    DWORD   dCompression;       // Compression that the user specifies
    WORD    wBitCount;          // Bits per pixel that the user specifies
    WORD    wCompression;       // Compression
    HDIB    hDIB;               // A handle to our dib
    BOOL    bResult;            // Result of dialog box - TRUE if OK was pressed
    CHAR    lpBuffer[128];      // Buffer to hold string message retrieved from resources
    CHAR    lpBuffer2[128];     // Buffer to hold string message retrieved from resources

    // Set up default compression to display in dialog box

    wCompression = IDD_RGB;

    // Depending on bits/pixel type for current display,
    // set the appropriate bit in the fFileOptions flag
    //
    // NOTE that we don't just assign wBitCount to iBits.  The reason
    // for this is some displays aren't 1,4,8 or 24 bits.  Some are
    // 15 bits, which isn't valid for a DIB, so in this case, we would
    // set the bits to 24.

    hDC = CreateDC("DISPLAY",NULL,NULL,NULL);
    iBits = GetDeviceCaps(hDC, BITSPIXEL) * GetDeviceCaps(hDC, PLANES);
    DeleteDC(hDC);

    if (iBits <= 1)
        wBitCount = 1;

    else if (iBits <= 4)
        wBitCount = 4;

    else if (iBits <= 8)
        wBitCount = 8;

    else if (iBits <= 24)
        wBitCount = 24;

  else if (iBits <= 32)
    wBitCount = 32;

    // Our dwFlags parameter to GetFileName is made up of the
    // bits per pixel in the HIWORD (1, 2, 4, or 24), and the compression
    // type in the LOWORD (IDD_RGB, IDD_RLE4, or IDD_RLE8).

    dwFlags = MAKELONG(wCompression, wBitCount);

    // Bring up File/Save... dialog and get info. about filename,
    // compression, and bits/pix. of DIB to be written.

    bResult = GetFileName(ghWndMain, (LPSTR)szFileBuf, &dwFlags);  // Function will accept up to 255 characters.

    // Extract DIB specs and save to file (if the user did not
    // press cancel)

    if (bResult)
    {
        switch(LOWORD(dwFlags))
        {
            case IDD_RLE4:
                dCompression = BI_RLE4;
                break;

            case IDD_RLE8:
                dCompression = BI_RLE8;
                break;

            case IDD_RGB:
            default:
                dCompression = BI_RGB;
                break;
        }

        // First, call up a modeless dialog box which tells that we are
        // saving this to a file...

        if (!hModelessDlg)
        {
            hModelessDlg = CreateDialogParam(ghInst, (LPSTR)"Saving",
                    ghWndMain,SavingDlgProc,(LPARAM)szFileBuf);
        }

        // Now, write out the DIB in the proper format.  The following
        // API ChangeBitmapFormat() will convert the specified bitmap
        // to a DIB with the specified Bit Count, Compression and
        // Palette.  Remember that the HIWORD of dwFlags specifies the
        // bits per pixel.

        hDIB = ChangeBitmapFormat(ghBitmap, HIWORD(dwFlags),
                dCompression, ghPal);

        if (hDIB)
        {
            if (SaveDIB(hDIB, szFileBuf))
            {
                LoadString(ghInst, IDS_CANTSAVE, lpBuffer, sizeof(lpBuffer));
                LoadString(ghInst, IDS_SAVEERROR, lpBuffer2, sizeof(lpBuffer2));
                MessageBox(NULL, lpBuffer, lpBuffer2, MB_ICONEXCLAMATION);
                gbSave = TRUE;
            }
            else
                gbSave = FALSE;

            DestroyDIB(hDIB);
        }

        DestroyWindow(hModelessDlg);
        hModelessDlg = NULL;
    }

}

LRESULT APIENTRY SavingDlgProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 268 of file Dialogs.c.

{
    switch (message)
    {
        case WM_SETFOCUS:
            MessageBeep(0);
            break;

        case WM_INITDIALOG:

            // Set the text of the filename in the dialog box.  This dialog
            // should be called with DialogBoxParam, and the parameter should
            // be a pointer to the filename.  It shows up as the lParam here.

            SetDlgItemText(hDlg, IDC_FILETEXT, (LPSTR)lParam);
            return TRUE;
            break;

        case WM_DESTROY:
            return TRUE;
            break;
    }

  // default return value.
  return FALSE;
}

LRESULT CALLBACK SelectDlgProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 305 of file Dialogs.c.

{
    switch (message)
    {
        case WM_INITDIALOG:
        {
            HGLOBAL     hMem;
            char        *szText;

            hMem = GlobalAlloc(GHND, 200);
      if (!hMem)
        return FALSE;

            szText = (char *)GlobalLock(hMem);
            if(szText == NULL)
                return TRUE;

            LoadString(ghInst, IDS_SELECT2, szText, 200);
            SetDlgItemText(hDlg, IDC_STATIC_SELECT2, szText);
            LoadString(ghInst, IDS_SELECT3, szText, 200);
            SetDlgItemText(hDlg, IDC_STATIC_SELECT3, szText);

            GlobalUnlock(hMem);
            GlobalFree(hMem);

            return TRUE;
        }

        case WM_COMMAND:
            if ((wParam) != IDCANCEL)
                return FALSE;
            else
            {
                ShowWindow(hDlg, SW_HIDE);
                gbNowCapturing = FALSE;
                return TRUE;
            }

        case WM_SYSCOMMAND:
            if(wParam == SC_CLOSE)
            {
                ShowWindow(hDlg, SW_HIDE);
                gbNowCapturing = FALSE;
                return TRUE;
            }
            else
                return FALSE;

        case WM_DESTROY:
            return TRUE;

        default:
            return FALSE;
    }
}

void SetupScrollBars | ( | HWND | ,
 |  | WORD | ,
 |  | WORD |
 | ) |  |

Definition at line 1631 of file WinCap.c.

{
    RECT        rect;                       // Client Rectangle
    BOOL        bNeedScrollBars=FALSE;      // Need Scroll bars?
    unsigned    cxWindow, cyWindow;         // Width and height of client area
    int         cxRange=0, cyRange=0;       // Range needed for horz and vert

    // Do some initialization

    ReallyGetClientRect(hWnd, &rect);

    cxWindow = rect.right - rect.left;
    cyWindow = rect.bottom - rect.top;

    // Now determine if we need the scroll bars

    if ((cxWindow < (unsigned)cxBitmap) || (cyWindow < (unsigned)cyBitmap))
        bNeedScrollBars = TRUE;

    // Setup the scroll bar ranges.  We want to be able to
    // scroll the window so that all the bitmap can appear
    // within the client area.  Take into account that
    // if the opposite scroll bar is activated, it eats
    // up some client area.

    if (bNeedScrollBars)
    {
        cyRange = (unsigned)cyBitmap - cyWindow - 1 +
                GetSystemMetrics (SM_CYHSCROLL);
        cxRange = (unsigned)cxBitmap - cxWindow - 1 +
                GetSystemMetrics (SM_CXVSCROLL);
    }

    // Set the ranges we've calculated (0 to 0 means invisible scrollbar)

    SetScrollRange(hWnd, SB_VERT, 0, cyRange, TRUE);
    SetScrollRange(hWnd, SB_HORZ, 0, cxRange, TRUE);
}

void StretchIconToWindow | ( | HWND | hWndDlg,
 |  | LPSTR | szIconName
 | ) |  |
LONG WINAPI WndProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 290 of file Generic.C.

{
   int wmId, wmEvent;
   PAINTSTRUCT ps;
   HDC hdc;
      POINT pnt;
   HMENU hMenu;
      BOOL bGotHelp;

   switch (message) {

      case WM_COMMAND:
         wmId    = LOWORD(wParam); // Remember, these are...
         wmEvent = HIWORD(wParam); // ...different for Win32!

         //Parse the menu selections:
         switch (wmId) {

            case IDM_ABOUT:
               DialogBox(hInst, "AboutBox", hWnd, (DLGPROC)About);
               break;

            case IDM_EXIT:
               DestroyWindow (hWnd);
               break;

            case IDM_HELPTOPICS: // Only called in Windows 95
               bGotHelp = WinHelp (hWnd, APPNAME".HLP", HELP_FINDER,(DWORD)0);
               if (!bGotHelp)
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            case IDM_HELPCONTENTS: // Not called in Windows 95
               bGotHelp = WinHelp (hWnd, APPNAME".HLP", HELP_CONTENTS,(DWORD)0);
               if (!bGotHelp)
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            case IDM_HELPSEARCH: // Not called in Windows 95
               if (!WinHelp(hWnd, APPNAME".HLP", HELP_PARTIALKEY,
                           (ULONG_PTR)(LPSTR)""))
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            case IDM_HELPHELP: // Not called in Windows 95
               if(!WinHelp(hWnd, (LPSTR)NULL, HELP_HELPONHELP, 0))
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            // Here are all the other possible menu options,
            // all of these are currently disabled:
            case IDM_NEW:
            case IDM_OPEN:
            case IDM_SAVE:
            case IDM_SAVEAS:
            case IDM_UNDO:
            case IDM_CUT:
            case IDM_COPY:
            case IDM_PASTE:
            case IDM_LINK:
            case IDM_LINKS:

            default:
               return (DefWindowProc(hWnd, message, wParam, lParam));
         }
         break;

      case WM_NCRBUTTONUP: // RightClick on windows non-client area...
         if (IS_WIN95 && SendMessage(hWnd, WM_NCHITTEST, 0, lParam) == HTSYSMENU)
         {
            // The user has clicked the right button on the applications
            // 'System Menu'. Here is where you would alter the default
            // system menu to reflect your application. Notice how the
            // explorer deals with this. For this app, we aren't doing
            // anything
            return (DefWindowProc(hWnd, message, wParam, lParam));
         } else {
            // Nothing we are interested in, allow default handling...
            return (DefWindowProc(hWnd, message, wParam, lParam));
         }
            break;

        case WM_RBUTTONDOWN: // RightClick in windows client area...
            pnt.x = LOWORD(lParam);
            pnt.y = HIWORD(lParam);
            ClientToScreen(hWnd, (LPPOINT) &pnt);
      // This is where you would determine the appropriate 'context'
      // menu to bring up. Since this app has no real functionality,
      // we will just bring up the 'Help' menu:
            hMenu = GetSubMenu (GetMenu (hWnd), 2);
            if (hMenu) {
                TrackPopupMenu (hMenu, 0, pnt.x, pnt.y, 0, hWnd, NULL);
            } else {
            // Couldn't find the menu...
                MessageBeep(0);
            }
            break;

      case WM_DISPLAYCHANGE: // Only comes through on plug'n'play systems
      {
         SIZE  szScreen;
         DWORD dwBitsPerPixel = (DWORD)wParam;

         szScreen.cx = LOWORD(lParam);
         szScreen.cy = HIWORD(lParam);

         MessageBox (GetFocus(), GetStringRes(IDS_DISPLAYCHANGED),
                     szAppName, 0);
      }
      break;

      case WM_PAINT:
         hdc = BeginPaint (hWnd, &ps);
         // Add any drawing code here...
         EndPaint (hWnd, &ps);
         break;

      case WM_DESTROY:
         // Tell WinHelp we don't need it any more...
               WinHelp (hWnd, APPNAME".HLP", HELP_QUIT,(DWORD)0);
         PostQuitMessage(0);
         break;

      default:
         return (DefWindowProc(hWnd, message, wParam, lParam));
   }
   return (0);
}

Generated on Wed Nov 13 2024 16:53:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/WinNT/HalfTone/halftone.c File Reference

  • Multimedia
  • Gdi
  • WinNT
  • HalfTone
Defines | Functions | Variables

halftone.c File Reference

#include <windows.h>
#include <commctrl.h>
#include <commdlg.h>
#include <strsafe.h>
#include "resource.h"

Go to the source code of this file.

Defines

#define | GetControlScrollPos(hDlg, uBar) SendMessage(GetDlgItem(hDlg, uBar), TBM_GETPOS, (WPARAM)0, (LPARAM)0)
#define | SetSliderPos(hSld, iPos) SendMessage(hSld, TBM_SETPOS, (WPARAM)TRUE, (LONG)iPos)

Functions

LRESULT CALLBACK | About (HWND, UINT, WPARAM, LPARAM)
BOOL | CenterWindow (HWND hwndChild, HWND hwndParent)
BOOL CALLBACK | HalftoneDialog (HWND hDlg, UINT message, WPARAM uParam, LPARAM lParam)
BOOL InitApplication (HANDLE)
BOOL | InitApplication (HINSTANCE hInstance)
BOOL | InitInstance (HANDLE, int)
BOOL | InitInstance (HINSTANCE hInstance, int nCmdShow)
void | SetupControls (HWND hDlg, UINT uBar, UINT uEdit, int iMin, int iMax, int iPos, BOOL bScale)
int APIENTRY | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
LRESULT CALLBACK | WndProc (HWND, UINT, WPARAM, LPARAM)

Variables

COLORADJUSTMENT | caHalf
HANDLE ghWnd
HICON | hIcon = NULL
HINSTANCE | hInst
HWND | hWndMain
char | szAppName [] = "HalfTone"
char | szTitle [] = "Halftone Stretching Demo"

Define Documentation

#define GetControlScrollPos | ( | hDlg,
 |  | uBar |
 | ) |  | SendMessage(GetDlgItem(hDlg, uBar), TBM_GETPOS, (WPARAM)0, (LPARAM)0)

Definition at line 207 of file halftone.c.

#define SetSliderPos | ( | hSld,
 |  | iPos |
 | ) |  | SendMessage(hSld, TBM_SETPOS, (WPARAM)TRUE, (LONG)iPos)

Definition at line 208 of file halftone.c.

Function Documentation

LRESULT CALLBACK About | ( | HWND | hDlg,
 |  | UINT | message,
 |  | WPARAM | uParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 655 of file halftone.c.

{
    switch (message) {
        case WM_INITDIALOG:  // message: initialize dialog box
            // Center the dialog over the application window
            CenterWindow (hDlg, GetWindow (hDlg, GW_OWNER));
            return (TRUE);

        case WM_COMMAND:                      // message: received a command
            if (LOWORD(uParam) == IDOK || LOWORD(uParam) == IDCANCEL) {
                EndDialog(hDlg, TRUE);        // Exit the dialog
                return (TRUE);
            }
            break;
    }
    return (FALSE); // Didn't process the message

    UNREFERENCED_PARAMETER(lParam); // This will prevent 'unused formal parameter' warnings
}

BOOL CenterWindow | ( | HWND | hwndChild,
 |  | HWND | hwndParent
 | ) |  |

Definition at line 590 of file halftone.c.

{
        RECT    rChild, rParent;
        int     wChild, hChild, wParent, hParent;
        int     wScreen, hScreen, xNew, yNew;
        HDC     hdc;

        // Get the Height and Width of the child window
        GetWindowRect (hwndChild, &rChild);
        wChild = rChild.right - rChild.left;
        hChild = rChild.bottom - rChild.top;

        // Get the Height and Width of the parent window
        GetWindowRect (hwndParent, &rParent);
        wParent = rParent.right - rParent.left;
        hParent = rParent.bottom - rParent.top;

        // Get the display limits
        hdc = GetDC (hwndChild);
        wScreen = GetDeviceCaps (hdc, HORZRES);
        hScreen = GetDeviceCaps (hdc, VERTRES);
        ReleaseDC (hwndChild, hdc);

        // Calculate new X position, then adjust for screen
        xNew = rParent.left + ((wParent - wChild) /2);
        if (xNew < 0) {
                xNew = 0;
        } else if ((xNew+wChild) > wScreen) {
                xNew = wScreen - wChild;
        }

        // Calculate new Y position, then adjust for screen
        yNew = rParent.top  + ((hParent - hChild) /2);
        if (yNew < 0) {
                yNew = 0;
        } else if ((yNew+hChild) > hScreen) {
                yNew = hScreen - hChild;
        }

        // Set it, and return
        return SetWindowPos (hwndChild, NULL,
                xNew, yNew, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
}

BOOL CALLBACK HalftoneDialog | ( | HWND | hDlg,
 |  | UINT | message,
 |  | WPARAM | uParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 227 of file halftone.c.

{
  BOOL bError;
  static COLORADJUSTMENT caOld = {0};
  static BOOL bUpdate = TRUE;

  switch (message) {
  case WM_INITDIALOG:           /* message: initialize dialog box */
    // Store the old copy so that we can cancel out
    caOld = caHalf;

    CheckDlgButton(hDlg, IDC_UPDATE, bUpdate);

    SendDlgItemMessage (hDlg, IDC_FLAGS, CB_ADDSTRING, 0, (LPARAM) "None");
    SendDlgItemMessage (hDlg, IDC_FLAGS, CB_ADDSTRING, 0, (LPARAM) "Negative");
    SendDlgItemMessage (hDlg, IDC_FLAGS, CB_ADDSTRING, 0, (LPARAM) "Log Filter");
    SendDlgItemMessage (hDlg, IDC_FLAGS, CB_SETCURSEL, caHalf.caFlags, 0);

    SendDlgItemMessage (hDlg, IDC_ILLUMINATE, CB_ADDSTRING, 0, (LPARAM) "Device's default");
    SendDlgItemMessage (hDlg, IDC_ILLUMINATE, CB_ADDSTRING, 0, (LPARAM) "Tungsten lamp");
    SendDlgItemMessage (hDlg, IDC_ILLUMINATE, CB_ADDSTRING, 0, (LPARAM) "Noon sunlight");
    SendDlgItemMessage (hDlg, IDC_ILLUMINATE, CB_ADDSTRING, 0, (LPARAM) "NTSC daylight");
    SendDlgItemMessage (hDlg, IDC_ILLUMINATE, CB_ADDSTRING, 0, (LPARAM) "Normal print");
    SendDlgItemMessage (hDlg, IDC_ILLUMINATE, CB_ADDSTRING, 0, (LPARAM) "Bond paper print");
    SendDlgItemMessage (hDlg, IDC_ILLUMINATE, CB_ADDSTRING, 0, (LPARAM) "Standard daylight");
    SendDlgItemMessage (hDlg, IDC_ILLUMINATE, CB_ADDSTRING, 0, (LPARAM) "Northern daylight");
    SendDlgItemMessage (hDlg, IDC_ILLUMINATE, CB_ADDSTRING, 0, (LPARAM) "Cool white lamp");
    SendDlgItemMessage (hDlg, IDC_ILLUMINATE, CB_SETCURSEL, caHalf.caIlluminantIndex, 0);

    SetupControls(hDlg, IDC_REDGAMMASLIDER,     IDC_REDGAMMA,     250,  6500, caHalf.caRedGamma / 10, TRUE);
    SetupControls(hDlg, IDC_GREENGAMMASLIDER,   IDC_GREENGAMMA,   250,  6500, caHalf.caGreenGamma / 10, TRUE);
    SetupControls(hDlg, IDC_BLUEGAMMASLIDER,    IDC_BLUEGAMMA,    250,  6500, caHalf.caBlueGamma / 10, TRUE);

    SetupControls(hDlg, IDC_REFBLACKSLIDER,     IDC_REFBLACK,       0,  4000, caHalf.caReferenceBlack, FALSE);
    SetupControls(hDlg, IDC_REFWHITESLIDER,     IDC_REFWHITE,    6000, 10000, caHalf.caReferenceWhite, FALSE);

    SetupControls(hDlg, IDC_CONTRASTSLIDER,     IDC_CONTRAST,     -100,  100, caHalf.caContrast, FALSE);
    SetupControls(hDlg, IDC_BRIGHTNESSSLIDER,   IDC_BRIGHTNESS,   -100,  100, caHalf.caBrightness, FALSE);
    SetupControls(hDlg, IDC_COLORFULNESSSLIDER, IDC_COLORFULNESS, -100,  100, caHalf.caColorfulness, FALSE);
    SetupControls(hDlg, IDC_TINTSLIDER,         IDC_TINT,         -100,  100, caHalf.caRedGreenTint, FALSE);
    return (TRUE);

  case WM_HSCROLL:
        {
            int iTemp = SendMessage((HWND)lParam, TBM_GETPOS, (WPARAM)0, (LPARAM)0);

            if ((HWND)lParam == GetDlgItem(hDlg, IDC_REDGAMMASLIDER))
                SetDlgItemInt(hDlg, IDC_REDGAMMA, iTemp*10, TRUE);

            if ((HWND)lParam == GetDlgItem(hDlg, IDC_GREENGAMMASLIDER))
                SetDlgItemInt(hDlg, IDC_GREENGAMMA, iTemp*10, TRUE);

            if ((HWND)lParam == GetDlgItem(hDlg, IDC_BLUEGAMMASLIDER))
                SetDlgItemInt(hDlg, IDC_BLUEGAMMA, iTemp*10, TRUE);

            if ((HWND)lParam == GetDlgItem(hDlg, IDC_REFBLACKSLIDER))
                SetDlgItemInt(hDlg, IDC_REFBLACK, iTemp, TRUE);

            if ((HWND)lParam == GetDlgItem(hDlg, IDC_REFWHITESLIDER))
                SetDlgItemInt(hDlg, IDC_REFWHITE, iTemp, TRUE);

            if ((HWND)lParam == GetDlgItem(hDlg, IDC_CONTRASTSLIDER))
                SetDlgItemInt(hDlg, IDC_CONTRAST, iTemp, TRUE);

            if ((HWND)lParam == GetDlgItem(hDlg, IDC_BRIGHTNESSSLIDER))
                SetDlgItemInt(hDlg, IDC_BRIGHTNESS, iTemp, TRUE);

            if ((HWND)lParam == GetDlgItem(hDlg, IDC_COLORFULNESSSLIDER))
                SetDlgItemInt(hDlg, IDC_COLORFULNESS, iTemp, TRUE);

            if ((HWND)lParam == GetDlgItem(hDlg, IDC_TINTSLIDER))
                SetDlgItemInt(hDlg, IDC_TINT, iTemp, TRUE);

            caHalf.caRedGamma = (WORD)GetDlgItemInt (hDlg, IDC_REDGAMMA, &bError, FALSE);
            caHalf.caGreenGamma = (WORD)GetDlgItemInt (hDlg, IDC_GREENGAMMA, &bError, FALSE);
            caHalf.caBlueGamma = (WORD)GetDlgItemInt (hDlg, IDC_BLUEGAMMA, &bError, FALSE);
            caHalf.caReferenceBlack = (WORD)GetDlgItemInt (hDlg, IDC_REFBLACK, &bError, FALSE);
            caHalf.caReferenceWhite = (WORD)GetDlgItemInt (hDlg, IDC_REFWHITE, &bError, FALSE);
            caHalf.caContrast = (WORD)GetDlgItemInt (hDlg, IDC_CONTRAST, &bError, FALSE);
            caHalf.caBrightness = (WORD)GetDlgItemInt (hDlg, IDC_BRIGHTNESS, &bError, FALSE);
            caHalf.caColorfulness = (WORD)GetDlgItemInt (hDlg, IDC_COLORFULNESS, &bError, FALSE);
            caHalf.caRedGreenTint = (WORD)GetDlgItemInt (hDlg, IDC_TINT, &bError, TRUE);

            if (IsDlgButtonChecked(hDlg, IDC_UPDATE))
                InvalidateRect(hWndMain, NULL, FALSE);
        }
        return FALSE;

  case WM_COMMAND:          /* message: received a command */

    if (HIWORD(uParam) == CBN_SELCHANGE) {
        caHalf.caFlags = (WORD) SendDlgItemMessage (hDlg, IDC_FLAGS, CB_GETCURSEL, 0, 0);
        caHalf.caIlluminantIndex = (WORD) SendDlgItemMessage (hDlg, IDC_ILLUMINATE, CB_GETCURSEL, 0, 0);

        if (IsDlgButtonChecked(hDlg, IDC_UPDATE))
            InvalidateRect(hWndMain, NULL, FALSE);
    }

    if (LOWORD (uParam) == IDOK || LOWORD (uParam) == IDCANCEL) {   /* System menu close command? */

      if (LOWORD (uParam) != IDOK)  // if cancel was pressed
        caHalf = caOld; // restore the old version
      else
        bUpdate = IsDlgButtonChecked(hDlg, IDC_UPDATE);

      EndDialog (hDlg, TRUE);   /* Exit the dialog */
      return (TRUE);
    }
    break;
  }
  return (FALSE);           /* Didn't process the message */

  lParam;                   /* This will prevent 'unused formal parameter' warnings */
}

BOOL InitApplication ( HANDLE )

Definition at line 123 of file ClipText.c.

{
    WNDCLASS  wc = {0};

    wc.lpfnWndProc = (WNDPROC) MainWndProc;
    wc.hInstance = hInstance;
    wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
    wc.hCursor = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
    wc.lpszMenuName =  TEXT("CliptextMenu");
    wc.lpszClassName = TEXT("CliptextWClass");

    return (RegisterClass(&wc));
}

BOOL InitApplication ( HINSTANCE hInstance )

Definition at line 133 of file halftone.c.

{
    WNDCLASS  wc;

    // Fill in window class structure with parameters that describe the
    // main window.

    wc.style         = CS_VREDRAW | CS_HREDRAW;  // Class style(s).
    wc.lpfnWndProc   = (WNDPROC)WndProc;       // Window Procedure
    wc.cbClsExtra    = 0;                      // No per-class extra data.
    wc.cbWndExtra    = 0;                      // No per-window extra data.
    wc.hInstance     = hInstance;              // Owner of this class
    wc.hIcon         = LoadIcon (hInstance, "HT_ICON"); // Icon name from .RC
    wc.hCursor       = LoadCursor(NULL, IDC_ARROW); // Cursor
    wc.hbrBackground = GetStockObject(NULL_BRUSH);
    wc.lpszMenuName  = "HT_MENU";              // Menu name from .RC
    wc.lpszClassName = szAppName;              // Name to register as

    // Register the window class and return success/failure code.
    return (RegisterClass(&wc));
}

BOOL InitInstance | ( | HANDLE | ,
 |  | int |
 | ) |  |

Definition at line 126 of file ComDlg32.C.

{
    HWND            hWnd;

  // Save off the handle to the current instance.
    g_hInst = hInstance;

    // Create a main window for this application instance.
    hWnd = CreateWindow(
        "Comdlg32WClass",
        "Common Dialog Sample Application",
        WS_OVERLAPPEDWINDOW,            // Window style.
        CW_USEDEFAULT,                  // Default horizontal position.
        CW_USEDEFAULT,                  // Default vertical position.
        CW_USEDEFAULT,                  // Default width.
        CW_USEDEFAULT,                  // Default height.
        NULL,                           // Overlapped windows have no parent.
        NULL,                           // Use the window class menu.
        g_hInst,                        // This instance owns this window.
        NULL                            // Pointer not needed.
    );

    // If window could not be created, return "failure".
    if (!hWnd)
        return (FALSE);

    // Register the window messages to receive.
    cdmsgShareViolation = RegisterWindowMessage(szmsgSHAREVIOLATION);
    cdmsgFileOK         = RegisterWindowMessage(szmsgFILEOK);
    cdmsgHelp           = RegisterWindowMessage(szCommdlgHelp);

    // Make the window visible; update its client area; and return "success".
    ShowWindow(hWnd, nCmdShow);
    UpdateWindow(hWnd);
    return (TRUE);

}

BOOL InitInstance | ( | HINSTANCE | hInstance,
 |  | int | nCmdShow
 | ) |  |

Definition at line 172 of file halftone.c.

{
    HWND            hWnd; // Main window handle.

    // Save the instance handle in static variable, which will be used in
    // many subsequence calls from this application to Windows.

    hInst = hInstance; // Store instance handle in our global variable

    // Create a main window for this application instance.
    hWndMain =
    hWnd = CreateWindow(
            szAppName,           // See RegisterClass() call.
            szTitle,             // Text for window title bar.
            WS_OVERLAPPEDWINDOW,// Window style.
            CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, // Use default positioning
            NULL,                // Overlapped windows have no parent.
            NULL,                // Use the window class menu.
            hInstance,           // This instance owns this window.
            NULL                 // We don't use any data in our WM_CREATE
    );

    // If window could not be created, return "failure"
    if (!hWnd) {
            return (FALSE);
    }

    // Make the window visible; update its client area; and return "success"
    ShowWindow(hWnd, nCmdShow); // Show the window
    UpdateWindow(hWnd);         // Sends WM_PAINT message

    return (TRUE);              // We succeeded...

}

void SetupControls | ( | HWND | hDlg,
 |  | UINT | uBar,
 |  | UINT | uEdit,
 |  | int | iMin,
 |  | int | iMax,
 |  | int | iPos,
 |  | BOOL | bScale
 | ) |  |

Definition at line 210 of file halftone.c.

{
    HWND hWndTrack = GetDlgItem(hDlg, uBar);

    if (!hWndTrack) return;

    SendMessage(hWndTrack, TBM_SETRANGE, TRUE, MAKELONG((short)iMin, (short)iMax));
    SendMessage(hWndTrack, TBM_SETTICFREQ, ((iMax-iMin) / 50)+1, (LPARAM)0);

    SetSliderPos(hWndTrack, iPos);

    if (bScale) iPos *=10;

    SetDlgItemInt(hDlg, uEdit, iPos, TRUE);
}

int APIENTRY WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 72 of file halftone.c.

{
    MSG msg;
    HANDLE hAccelTable;

    if (!hPrevInstance) {       // Other instances of app running?
            if (!InitApplication(hInstance)) { // Initialize shared things
            return (FALSE);     // Exits if unable to initialize
        }
    }

    /* Perform initializations that apply to a specific instance */

    if (!InitInstance(hInstance, nCmdShow)) {
            return (FALSE);
    }

    hAccelTable = LoadAccelerators (hInstance, "HALFTONE");

    /* Acquire and dispatch messages until a WM_QUIT message is received. */

    while (GetMessage(&msg, // message structure
       NULL,   // handle of window receiving the message
       0,      // lowest message to examine
       0))     // highest message to examine
    {
        if (!TranslateAccelerator (msg.hwnd, hAccelTable, &msg)) {
            TranslateMessage(&msg);// Translates virtual key codes
            DispatchMessage(&msg); // Dispatches message to window
        }
    }

    return (msg.wParam); // Returns the value from PostQuitMessage

    UNREFERENCED_PARAMETER(lpCmdLine); // This will prevent 'unused formal parameter' warnings
}

LRESULT CALLBACK WndProc | ( | HWND | hWnd,
 |  | UINT | message,
 |  | WPARAM | uParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 366 of file halftone.c.

{
    int wmId, wmEvent;
    static HBITMAP hbmp = NULL;
    static HANDLE hPalette = NULL;

    switch (message) {
        case WM_CREATE:
            {
                HDC hDC = GetDC(NULL);

        if (!hDC)
          return -1;  // Something is profoundly wrong, bail!

                // Initialize the global color adjustment structure
                caHalf.caSize = sizeof(caHalf);

                // Does the OS we are running on support GetColorAdjustment?
                if (!GetColorAdjustment (hDC, &caHalf)) {
                    MessageBox(hWnd, "Please be sure that the version of the OS you are running supports "
                                     "HALFTONE stretching.",
                                     "Unable to retrieve COLORADJUSTMENT settings", MB_ICONSTOP);
                    return  -1;   // No, bail!
                }

                // Create a halftone palette
                hPalette = CreateHalftonePalette(hDC);

                InitCommonControls();

                ReleaseDC(NULL, hDC);
            }
            return 0;

        case WM_PAINT:
            {
               PAINTSTRUCT ps;
               HDC    hDC = BeginPaint(hWnd, &ps);
         BOOL   bError;  // Track the error status
               RECT   rect;
               HDC    hdcMem;
               BITMAP bm;

               // Get the extents of our drawing area
               GetClientRect(hWnd, &rect);

               if (hbmp) { // If we have a DIB section loaded
                   // Prepare for our DC for a halftone stretch
                   bError = (SetStretchBltMode(hDC, HALFTONE) == 0);
           bError |= (SetColorAdjustment(hDC, &caHalf) == 0);

           bError |= (SelectPalette(hDC, hPalette, FALSE) == NULL);
                   bError |= (RealizePalette(hDC) == GDI_ERROR);

                   // Get the extents of our DIB
                   bError |= (GetObject(hbmp, sizeof(BITMAP), &bm) == 0);

                   hdcMem = CreateCompatibleDC(hDC);
           bError |= (hdcMem == NULL);

                   if (!bError) {
             SelectObject(hdcMem, hbmp);
             StretchBlt(hDC,    0, 0, rect.right, rect.bottom,
                  hdcMem, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
           } else // reprt that an error
             PostMessage(hWnd, WM_COMMAND, IDM_ERRORMESSAGE, 0);

                   DeleteDC(hdcMem);
               } else
                   PatBlt(hDC, 0, 0, rect.right, rect.bottom, BLACKNESS);

               EndPaint(hWnd, &ps);
            }
            break;

        case WM_PALETTECHANGED:
            if ((HWND) uParam == hWnd)
                return 0;

        /* Otherwise, fall through to WM_QUERYNEWPALETTE. */
        case WM_QUERYNEWPALETTE:
            {
                HDC hdc = GetDC(hWnd);
                HPALETTE hpal;
                UINT i;

                /*
                 * If realizing the palette causes the palette to change,
                 * redraw completely.
                 */
                hpal = SelectPalette (hdc, hPalette, FALSE);
                i = RealizePalette(hdc); /* i == entries that changed  */

                SelectPalette (hdc, hpal, FALSE);
                ReleaseDC(hWnd, hdc);

                /* If any palette entries changed, repaint the entire window. */
                if (i > 0)
                    InvalidateRect(hWnd, NULL, TRUE);
                return i;
            }

        case WM_COMMAND:
            wmId    = LOWORD(uParam);
            wmEvent = HIWORD(uParam);

            switch (wmId) {
        case IDM_ERRORMESSAGE:
          // Report that an error has occurred and exit
          MessageBox(hWnd, "An error has occurred in the handling of the WM_PAINT\n"
                       "Press OK to exit this application.", "Error!", MB_ICONSTOP);
          PostQuitMessage(-1);
          break;

                case IDM_LOADDIB:
                        {
                            OPENFILENAME ofn = {0};
                            char szNewTitle[MAX_PATH];
                            char szDirName[MAX_PATH];
                            char szFilename[MAX_PATH] = "*.BMP";

                            /* Get the windows directory name, and store in szDirName */
                            GetWindowsDirectory(szDirName, sizeof(szDirName));

                            /* Set all structure members to zero. */
                            ZeroMemory(&ofn, sizeof(OPENFILENAME));

                            ofn.lStructSize = sizeof(OPENFILENAME);
                            ofn.hwndOwner = hWnd;
                            ofn.lpstrFilter = "BMP Files (*.BMP)\0 *.BMP\0\0";
                            ofn.lpstrFile = szFilename;
                            ofn.nMaxFile = sizeof(szFilename);
                            ofn.lpstrDefExt = "BMP";
                            ofn.lpstrInitialDir = szDirName;
                            ofn.Flags = OFN_EXPLORER | OFN_SHOWHELP | OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;

                            if (hbmp)
                                DeleteObject(hbmp);

                            if (GetOpenFileName(&ofn)) {
                               hbmp = LoadImage(NULL,
                                             szFilename,
                                             IMAGE_BITMAP, 0, 0,
                                             LR_CREATEDIBSECTION | LR_LOADFROMFILE );
                               if (!hbmp)
                                  MessageBox(hWnd, "Unable to load file!", szFilename, MB_ICONSTOP);
                            } else {
                                if (strlen(szFilename) != 0)
                                  MessageBox(hWnd, "Unable to load file!", szFilename, MB_ICONSTOP);

                                return 0;
                            }

                            // Set our title to reflect the name of the file we loaded
                            StringCchCopy(szNewTitle, MAX_PATH, szTitle);
                            StringCchCat (szNewTitle, MAX_PATH, " - ");
                            StringCchCat (szNewTitle, MAX_PATH, szFilename);
                            SetWindowText(hWnd, szNewTitle);

                            InvalidateRect(hWnd, NULL, FALSE);
                        }
                        break;

                case IDM_PROPERTIES:
                        DialogBox (hInst,       /* current instance */
                                   "HT_DIALOG", /* dlg resource to use */
                                   hWnd,        /* parent handle */
                                   (DLGPROC) HalftoneDialog);   /* Halftone() instance address */

                        // Redraw with the new properties
                        InvalidateRect(hWnd, NULL, FALSE);
                        break;

                case IDM_ABOUT:
                    DialogBox(hInst,          // current instance
                             "ABOUTBOX",      // dlg resource to use
                             hWnd,            // parent handle
                             (DLGPROC)About); // About() instance address

                    break;

                case IDM_EXIT:
                        if (hbmp)
                            DeleteObject(hbmp);

                        DestroyWindow (hWnd);
                        break;

                default:
                        return (DefWindowProc(hWnd, message, uParam, lParam));
            }
            break;

        case WM_DESTROY:  // message: window being destroyed
        if (hPalette)
          DeleteObject(hPalette);
                PostQuitMessage(0);
                break;

        default:          // Passes it on if unproccessed
                return (DefWindowProc(hWnd, message, uParam, lParam));
    }
    return (0);
}

Variable Documentation

COLORADJUSTMENT caHalf

Definition at line 39 of file halftone.c.

HANDLE ghWnd

Definition at line 38 of file halftone.c.

HICON hIcon = NULL

Definition at line 37 of file halftone.c.

HINSTANCE hInst

Definition at line 36 of file halftone.c.

HWND hWndMain

Definition at line 40 of file halftone.c.

char szAppName[] = "HalfTone"

Definition at line 42 of file halftone.c.

char szTitle[] = "Halftone Stretching Demo"

Definition at line 43 of file halftone.c.

Generated on Wed Nov 13 2024 16:53:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/WinNT/HalfTone/resource.h File Reference

  • Multimedia
  • Gdi
  • WinNT
  • HalfTone
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | DLG_VERFIRST 400
#define | IDC_BLUEGAMMA 231
#define | IDC_BLUEGAMMASLIDER 1002
#define | IDC_BRIGHTNESS 236
#define | IDC_BRIGHTNESSSLIDER 1007
#define | IDC_COLORFULNESS 238
#define | IDC_COLORFULNESSSLIDER 1008
#define | IDC_CONTRAST 234
#define | IDC_CONTRASTSLIDER 1006
#define | IDC_FLAGS 222
#define | IDC_GREENGAMMA 230
#define | IDC_GREENGAMMASLIDER 1001
#define | IDC_ILLUMINATE 226
#define | IDC_REDGAMMA 229
#define | IDC_REDGAMMASLIDER 1000
#define | IDC_REFBLACK 232
#define | IDC_REFBLACKSLIDER 1004
#define | IDC_REFWHITE 233
#define | IDC_REFWHITESLIDER 1005
#define | IDC_STATIC -1
#define | IDC_TINT 239
#define | IDC_TINTSLIDER 1009
#define | IDC_UPDATE 1003
#define | IDM_ABOUT 105
#define | IDM_ERRORMESSAGE 2
#define | IDM_EXIT 102
#define | IDM_LOADDIB 106
#define | IDM_PROPERTIES 103

Define Documentation

#define DLG_VERFIRST 400

Definition at line 21 of file resource.h.

#define IDC_BLUEGAMMA 231

Definition at line 14 of file resource.h.

#define IDC_BLUEGAMMASLIDER 1002

Definition at line 24 of file resource.h.

#define IDC_BRIGHTNESS 236

Definition at line 18 of file resource.h.

#define IDC_BRIGHTNESSSLIDER 1007

Definition at line 29 of file resource.h.

#define IDC_COLORFULNESS 238

Definition at line 19 of file resource.h.

#define IDC_COLORFULNESSSLIDER 1008

Definition at line 30 of file resource.h.

#define IDC_CONTRAST 234

Definition at line 17 of file resource.h.

#define IDC_CONTRASTSLIDER 1006

Definition at line 28 of file resource.h.

#define IDC_FLAGS 222

Definition at line 10 of file resource.h.

#define IDC_GREENGAMMA 230

Definition at line 13 of file resource.h.

#define IDC_GREENGAMMASLIDER 1001

Definition at line 23 of file resource.h.

#define IDC_ILLUMINATE 226

Definition at line 11 of file resource.h.

#define IDC_REDGAMMA 229

Definition at line 12 of file resource.h.

#define IDC_REDGAMMASLIDER 1000

Definition at line 22 of file resource.h.

#define IDC_REFBLACK 232

Definition at line 15 of file resource.h.

#define IDC_REFBLACKSLIDER 1004

Definition at line 26 of file resource.h.

#define IDC_REFWHITE 233

Definition at line 16 of file resource.h.

#define IDC_REFWHITESLIDER 1005

Definition at line 27 of file resource.h.

#define IDC_STATIC -1

Definition at line 32 of file resource.h.

#define IDC_TINT 239

Definition at line 20 of file resource.h.

#define IDC_TINTSLIDER 1009

Definition at line 31 of file resource.h.

#define IDC_UPDATE 1003

Definition at line 25 of file resource.h.

#define IDM_ABOUT 105

Definition at line 8 of file resource.h.

#define IDM_ERRORMESSAGE 2

Definition at line 5 of file resource.h.

#define IDM_EXIT 102

Definition at line 6 of file resource.h.

#define IDM_LOADDIB 106

Definition at line 9 of file resource.h.

#define IDM_PROPERTIES 103

Definition at line 7 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/WinNT/PlgBlt/BitMap.c File Reference

  • Multimedia
  • Gdi
  • WinNT
  • PlgBlt
Functions

BitMap.c File Reference

#include <windows.h>
#include <commdlg.h>
#include "plgblt.h"

Go to the source code of this file.

Functions

VOID | DrawBitmap (HDC hdc, HBITMAP hbm)
HBITMAP | GetBitmap (HDC hdc, HANDLE hInst, BOOL monochrome)

Function Documentation

VOID DrawBitmap | ( | HDC | hdc,
 |  | HBITMAP | hbm
 | ) |  |

Definition at line 32 of file BitMap.c.

{
    BOOL f;
    HDC hdcBits;
    BITMAP bm;

    hdcBits = CreateCompatibleDC(hdc);
    GetObject (hbm, sizeof(BITMAP), &bm);
    SelectObject(hdcBits,hbm);
    f = BitBlt(hdc,0,0,bm.bmWidth, bm.bmHeight,hdcBits,0,0,SRCCOPY);
    DeleteDC(hdcBits);
}

HBITMAP GetBitmap | ( | HDC | hdc,
 |  | HANDLE | hInst,
 |  | BOOL | monochrome
 | ) |  |

Definition at line 62 of file BitMap.c.

{
    HBITMAP hbm;
    PBITMAPFILEHEADER pbmfh;
    PBITMAPINFOHEADER pbmih;
    PBYTE             pBits;
    int fh;
    int bfOffBits;
    int nbytes;
    OPENFILENAME  of;
    char buffer [MAX_PATH];

  if (!hdc) return NULL; /* check for valid hdc */

    buffer[0] = 0;

    /* set up the OPENFILE structure,
     *  then use the appropriate common dialog
     */
    of.lStructSize       = sizeof (OPENFILENAME);
    of.hwndOwner         = NULL;
    of.hInstance         = hInst;
    of.lpstrCustomFilter = NULL;
    of.nMaxCustFilter    = 0;
    of.nFilterIndex      = 0;
    of.lpstrFile         = buffer;
    of.nMaxFile          = MAX_PATH;
    of.lpstrFileTitle    = NULL;
    of.nMaxFileTitle     = 0;
    of.lpstrInitialDir   = "c:\\nt\\windows";
    of.lpstrTitle        = NULL;
    of.Flags             = OFN_HIDEREADONLY;
    of.nFileOffset       = 0;
    of.nFileExtension    = 0;
    of.lpstrDefExt       = NULL;
    of.lCustData         = 0;
    of.lpfnHook          = NULL;
    of.lpTemplateName    = NULL;

    if (PRIMARYLANGID(GetUserDefaultLangID ()) == LANG_JAPANESE)
      of.lpstrFilter       = "ËÞ¯ÄÏ¯Ìß(*.bmp)\000 *.BMP\000\000";
    else
      of.lpstrFilter       = "Bitmaps\000 *.BMP\000\000";

    if (!GetOpenFileName (&of)) return NULL;

    /* Try to open the file.  If successful, then allocate space for it,
     *  and read in all of the bytes.
     */
    fh = _lopen (buffer, OF_READ);
    if (fh == -1) return NULL;
    nbytes = GetFileSize (LongToHandle(fh), NULL);

    /* The contents of the file are read in here in three parts.  First
     *  the bitmap file header is read, then the bitmap header along with
     *  the color table, then finally the actual bit data.  I.e. from
     *  a total of nbytes...
     *    1.  sizeof (BITMAPFILEHEADER)
     *    2.  bfOffBits- sizeof (BITMAPFILEHEADER)
     *    3.  (nbytes - bfOffBits)
     */

    /* read in the bitmap file header.  save the offset to bits. */
    if (!(pbmfh = (PBITMAPFILEHEADER)LocalAlloc (LPTR, sizeof (BITMAPFILEHEADER))))
        return NULL;
    _lread (fh, (LPSTR)pbmfh, sizeof (BITMAPFILEHEADER));
    bfOffBits=pbmfh->bfOffBits;

    /* read in the bitmap info header and the color table right after it.
     * both BITMAPINFOHEADER and BITMAPINFO needed for CreateDIBitmap()
     */
    if (!(pbmih = (PBITMAPINFOHEADER)LocalAlloc (LPTR, bfOffBits- sizeof (BITMAPFILEHEADER))))
        return NULL;
    _lread (fh, (LPSTR)pbmih, bfOffBits- sizeof (BITMAPFILEHEADER));

    /* finally read in the bit data. */
    if (!(pBits = (PBYTE)LocalAlloc (LPTR, (nbytes - bfOffBits)))) return NULL;
    _lread (fh, (LPSTR)pBits, (nbytes - bfOffBits));

    /* in the case of desiring a monochrome bitmap (input parameter),
     *  verify that is what we got.  If it is, then use CreateBitmap,
     *  else use a device independent bitmap.
     */
    if (monochrome) {
      if (pbmih->biBitCount != 1) {
        MessageBox (NULL,
          GetStringRes (IDS_MONOCHROME),
          NULL, MB_APPLMODAL | MB_ICONSTOP | MB_OK);
        hbm = NULL;
      } else {
  BITMAP bmpInf;
  memset( &bmpInf, 0, sizeof(bmpInf) );
  bmpInf.bmWidth = pbmih->biWidth;
  bmpInf.bmHeight = pbmih->biHeight;
  bmpInf.bmWidthBytes = ((pbmih->biWidth+31)&(~31))/8;
  bmpInf.bmPlanes = pbmih->biPlanes;
  bmpInf.bmBitsPixel = pbmih->biBitCount;
  bmpInf.bmBits = pBits;

        hbm = CreateBitmapIndirect ( &bmpInf );
      }
    } else  /* bitmap is NOT monochrome, use DIB. */
      hbm = CreateDIBitmap (hdc, pbmih, CBM_INIT,
                          pBits, (PBITMAPINFO) pbmih, DIB_RGB_COLORS);

    /* hbm is set... free up memory, and return */
    LocalFree (LocalHandle ((LPSTR)pBits));
    LocalFree (LocalHandle ((LPSTR)pbmih));
    LocalFree (LocalHandle ((LPSTR)pbmfh));
    _lclose (fh);

    return hbm;
}

Generated on Wed Nov 13 2024 16:53:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/WinNT/PlgBlt/BitMap.h File Reference

  • Multimedia
  • Gdi
  • WinNT
  • PlgBlt
Functions

BitMap.h File Reference

Go to the source code of this file.

Functions

VOID | DrawBitmap (HDC, HBITMAP)
HBITMAP | GetBitmap (HDC, HANDLE, BOOL)

Function Documentation

VOID DrawBitmap | ( | HDC | ,
 |  | HBITMAP |
 | ) |  |

Definition at line 32 of file BitMap.c.

{
    BOOL f;
    HDC hdcBits;
    BITMAP bm;

    hdcBits = CreateCompatibleDC(hdc);
    GetObject (hbm, sizeof(BITMAP), &bm);
    SelectObject(hdcBits,hbm);
    f = BitBlt(hdc,0,0,bm.bmWidth, bm.bmHeight,hdcBits,0,0,SRCCOPY);
    DeleteDC(hdcBits);
}

HBITMAP GetBitmap | ( | HDC | ,
 |  | HANDLE | ,
 |  | BOOL |
 | ) |  |

Definition at line 62 of file BitMap.c.

{
    HBITMAP hbm;
    PBITMAPFILEHEADER pbmfh;
    PBITMAPINFOHEADER pbmih;
    PBYTE             pBits;
    int fh;
    int bfOffBits;
    int nbytes;
    OPENFILENAME  of;
    char buffer [MAX_PATH];

  if (!hdc) return NULL; /* check for valid hdc */

    buffer[0] = 0;

    /* set up the OPENFILE structure,
     *  then use the appropriate common dialog
     */
    of.lStructSize       = sizeof (OPENFILENAME);
    of.hwndOwner         = NULL;
    of.hInstance         = hInst;
    of.lpstrCustomFilter = NULL;
    of.nMaxCustFilter    = 0;
    of.nFilterIndex      = 0;
    of.lpstrFile         = buffer;
    of.nMaxFile          = MAX_PATH;
    of.lpstrFileTitle    = NULL;
    of.nMaxFileTitle     = 0;
    of.lpstrInitialDir   = "c:\\nt\\windows";
    of.lpstrTitle        = NULL;
    of.Flags             = OFN_HIDEREADONLY;
    of.nFileOffset       = 0;
    of.nFileExtension    = 0;
    of.lpstrDefExt       = NULL;
    of.lCustData         = 0;
    of.lpfnHook          = NULL;
    of.lpTemplateName    = NULL;

    if (PRIMARYLANGID(GetUserDefaultLangID ()) == LANG_JAPANESE)
      of.lpstrFilter       = "ËÞ¯ÄÏ¯Ìß(*.bmp)\000 *.BMP\000\000";
    else
      of.lpstrFilter       = "Bitmaps\000 *.BMP\000\000";

    if (!GetOpenFileName (&of)) return NULL;

    /* Try to open the file.  If successful, then allocate space for it,
     *  and read in all of the bytes.
     */
    fh = _lopen (buffer, OF_READ);
    if (fh == -1) return NULL;
    nbytes = GetFileSize (LongToHandle(fh), NULL);

    /* The contents of the file are read in here in three parts.  First
     *  the bitmap file header is read, then the bitmap header along with
     *  the color table, then finally the actual bit data.  I.e. from
     *  a total of nbytes...
     *    1.  sizeof (BITMAPFILEHEADER)
     *    2.  bfOffBits- sizeof (BITMAPFILEHEADER)
     *    3.  (nbytes - bfOffBits)
     */

    /* read in the bitmap file header.  save the offset to bits. */
    if (!(pbmfh = (PBITMAPFILEHEADER)LocalAlloc (LPTR, sizeof (BITMAPFILEHEADER))))
        return NULL;
    _lread (fh, (LPSTR)pbmfh, sizeof (BITMAPFILEHEADER));
    bfOffBits=pbmfh->bfOffBits;

    /* read in the bitmap info header and the color table right after it.
     * both BITMAPINFOHEADER and BITMAPINFO needed for CreateDIBitmap()
     */
    if (!(pbmih = (PBITMAPINFOHEADER)LocalAlloc (LPTR, bfOffBits- sizeof (BITMAPFILEHEADER))))
        return NULL;
    _lread (fh, (LPSTR)pbmih, bfOffBits- sizeof (BITMAPFILEHEADER));

    /* finally read in the bit data. */
    if (!(pBits = (PBYTE)LocalAlloc (LPTR, (nbytes - bfOffBits)))) return NULL;
    _lread (fh, (LPSTR)pBits, (nbytes - bfOffBits));

    /* in the case of desiring a monochrome bitmap (input parameter),
     *  verify that is what we got.  If it is, then use CreateBitmap,
     *  else use a device independent bitmap.
     */
    if (monochrome) {
      if (pbmih->biBitCount != 1) {
        MessageBox (NULL,
          GetStringRes (IDS_MONOCHROME),
          NULL, MB_APPLMODAL | MB_ICONSTOP | MB_OK);
        hbm = NULL;
      } else {
  BITMAP bmpInf;
  memset( &bmpInf, 0, sizeof(bmpInf) );
  bmpInf.bmWidth = pbmih->biWidth;
  bmpInf.bmHeight = pbmih->biHeight;
  bmpInf.bmWidthBytes = ((pbmih->biWidth+31)&(~31))/8;
  bmpInf.bmPlanes = pbmih->biPlanes;
  bmpInf.bmBitsPixel = pbmih->biBitCount;
  bmpInf.bmBits = pBits;

        hbm = CreateBitmapIndirect ( &bmpInf );
      }
    } else  /* bitmap is NOT monochrome, use DIB. */
      hbm = CreateDIBitmap (hdc, pbmih, CBM_INIT,
                          pBits, (PBITMAPINFO) pbmih, DIB_RGB_COLORS);

    /* hbm is set... free up memory, and return */
    LocalFree (LocalHandle ((LPSTR)pBits));
    LocalFree (LocalHandle ((LPSTR)pbmih));
    LocalFree (LocalHandle ((LPSTR)pbmfh));
    _lclose (fh);

    return hbm;
}

Generated on Wed Nov 13 2024 16:53:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/WinNT/PlgBlt/PlgBlt.c File Reference

  • Multimedia
  • Gdi
  • WinNT
  • PlgBlt
Defines | Functions | Variables

PlgBlt.c File Reference

#include <windows.h>
#include <commdlg.h>
#include <math.h>
#include <stdio.h>
#include "plgblt.h"
#include "track.h"
#include "bitmap.h"

Go to the source code of this file.

Defines

#define | BACKGROUNDBRUSH GetStockObject(LTGRAY_BRUSH)
#define | TICKSPACE 20

Functions

LRESULT CALLBACK | About (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
LRESULT CALLBACK | DlgProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
VOID | DrawGrids (HDC hdc, int width, int height)
LPTSTR | GetStringRes (int id)
LRESULT CALLBACK | MainWndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
int APIENTRY | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

Variables

HBITMAP | hbmMask = NULL
HBITMAP | hbmSrc
HDC | hdcDest
HDC | hdcMask
HDC | hdcSrc
HANDLE hInst
HWND | hwndDlg
HWND | hwndMain
int | nSpin
PTrackObject ptoDest
PTrackObject | ptoMask = NULL
PTrackObject ptoSrc

Define Documentation

#define BACKGROUNDBRUSH GetStockObject(LTGRAY_BRUSH)

Definition at line 42 of file PlgBlt.c.

#define TICKSPACE 20

Definition at line 1255 of file PlgBlt.c.

Function Documentation

LRESULT CALLBACK About | ( | HWND | hwnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 1297 of file PlgBlt.c.

{
  if ((message == WM_COMMAND) && (LOWORD(wParam) == IDOK)) {
    EndDialog (hwnd, TRUE);
    return TRUE;
  }
  if ((message == WM_SYSCOMMAND) && (wParam == SC_CLOSE)) {
    EndDialog (hwnd, TRUE);
    return TRUE;
  }
  return FALSE;
}

LRESULT CALLBACK DlgProc | ( | HWND | hwnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 1058 of file PlgBlt.c.

{

  switch (message) {
    /**********************************************************************\
    *  WM_INITDIALOG
    *
    * Fill the entry fields with sensible original values.
    \**********************************************************************/
    case WM_INITDIALOG:
        SetDlgItemText(hwnd, DID_P1X     , "0");
        SetDlgItemText(hwnd, DID_P1Y     , "0");
        SetDlgItemText(hwnd, DID_P2X     , "0");
        SetDlgItemText(hwnd, DID_P2Y     , "0");
        SetDlgItemText(hwnd, DID_P3X     , "0");
        SetDlgItemText(hwnd, DID_P3Y     , "0");
        SetDlgItemText(hwnd, DID_XSRC    , "0");
        SetDlgItemText(hwnd, DID_YSRC    , "0");
        SetDlgItemText(hwnd, DID_WIDTH   , "0");
        SetDlgItemText(hwnd, DID_HEIGHT  , "0");
        SetDlgItemText(hwnd, DID_XMASK   , "0");
        SetDlgItemText(hwnd, DID_YMASK   , "0");
    return TRUE;

    /**********************************************************************\
    *  WM_PUTUPLPOINTS
    *
    * wParam -  HDC with the needed world transform.
    * lParam -  Pointer to the track object.
    *
    * Fill the entry fields for the array of 3 dest parallelogram points.
    *  Conditionally change the first point depending on tracking mode.
    \**********************************************************************/
    case WM_PUTUPLPOINTS: {
        POINT p, origin;
        PTrackObject pto;
        HDC hdc;

        hdc = (HDC) wParam;
        pto = (PTrackObject) lParam;
        GetViewportOrgEx (hdc, &origin);

        if (pto->Mode & TMMOVE) {
          p.x = pto->rect.left;
          p.y = pto->rect.top;
          LPtoDP (pto->hdc, &p, 1);
          p.x -= origin.x; p.y -= origin.y;

          SetDlgItemInt(hwnd, DID_P1X, p.x, TRUE);
          SetDlgItemInt(hwnd, DID_P1Y, p.y, TRUE);

        }

        p.x = pto->rect.right;
        p.y = pto->rect.top;
        LPtoDP (pto->hdc, &p, 1);
        p.x -= origin.x; p.y -= origin.y;

        SetDlgItemInt(hwnd, DID_P2X, p.x, TRUE);
        SetDlgItemInt(hwnd, DID_P2Y, p.y, TRUE);

        p.x = pto->rect.left;
        p.y = pto->rect.bottom;
        LPtoDP (pto->hdc, &p, 1);
        p.x -= origin.x; p.y -= origin.y;
        SetDlgItemInt(hwnd, DID_P3X, p.x, TRUE);
        SetDlgItemInt(hwnd, DID_P3Y, p.y, TRUE);

    } return FALSE;

    /**********************************************************************\
    *  WM_PUTUPSRCRECT
    *
    * wParam -  HDC with the needed world transform.
    * lParam -  Pointer to the track object.
    *
    * Fill the entry fields for the source rectangle points.
    *  Conditionally change <x,y> or <width,height> depending on tracking mode.
    \**********************************************************************/
    case WM_PUTUPSRCRECT: {
        POINT p1,p2, origin;
        PTrackObject pto;
        HDC hdc;

        hdc = (HDC) wParam;
        pto = (PTrackObject) lParam;
        GetViewportOrgEx (hdc, &origin);

        p1.x = pto->rect.left;
        p1.y = pto->rect.top;
        LPtoDP (pto->hdc, &p1, 1);

        p2.x = pto->rect.right;
        p2.y = pto->rect.bottom;
        LPtoDP (pto->hdc, &p2, 1);
        p2.x -= p1.x; p2.y -= p1.y;

        p1.x -= origin.x; p1.y -= origin.y;

        if (!(pto->Mode & TMSIZEXY)) {
          SetDlgItemInt(hwnd, DID_XSRC, p1.x, TRUE);
          SetDlgItemInt(hwnd, DID_YSRC, p1.y, TRUE);
        }

        if (!(pto->Mode & TMMOVE)) {
          SetDlgItemInt(hwnd, DID_WIDTH,  p2.x, TRUE);
          SetDlgItemInt(hwnd, DID_HEIGHT, p2.y, TRUE);
        }
    } return FALSE;

    /**********************************************************************\
    *  WM_PUTUPMASKPT
    *
    * wParam -  HDC with the needed world transform.
    * lParam -  Pointer to the track object.
    *
    * Fill the entry fields for the mask location point.
    \**********************************************************************/
    case WM_PUTUPMASKPT: {
        POINT p1, origin;
        PTrackObject pto;
        HDC hdc;

        hdc = (HDC) wParam;
        pto = (PTrackObject) lParam;
        GetViewportOrgEx (hdc, &origin);

        p1.x = pto->rect.left;
        p1.y = pto->rect.top;
        LPtoDP (pto->hdc, &p1, 1);
        p1.x -= origin.x; p1.y -= origin.y;

        SetDlgItemInt(hwnd, DID_XMASK, p1.x, TRUE);
        SetDlgItemInt(hwnd, DID_YMASK, p1.y, TRUE);

    } return FALSE;

    /**********************************************************************\
    *  WM_COMMAND, DID_DRAW
    *
    * Draw button hit - send main window message to call PlgBlt().
    \**********************************************************************/
    case WM_COMMAND: {
      HBITMAP hbm;

      if (LOWORD(wParam) == DID_DRAW) {
          SendMessage (hwndMain, WM_PLGBLT, 0,0);

    /**********************************************************************\
    *  WM_COMMAND, DID_NEWSRC
    *
    * Try to get a new source bitmap.  Then
    *  invalidate two sub windows so that we force a repaint.
    \**********************************************************************/
      } else if (LOWORD(wParam) == DID_NEWSRC) {
        if ( hbm = GetBitmap (hdcSrc, hInst, FALSE)) {
          DeleteObject (hbmSrc);
          hbmSrc = hbm;
          InvalidateRect (hwndMain, &ptoSrc->rectClip, TRUE);
          InvalidateRect (hwndMain, &ptoDest->rectClip, TRUE);
        }

    /**********************************************************************\
    *  WM_COMMAND, DID_Mask
    *
    * Try to get a new mask bitmap.  Then
    *  invalidate two sub windows so that we force a repaint.
    \**********************************************************************/
      } else if (LOWORD(wParam) == DID_NEWMASK) {
        if ( hbm = GetBitmap (hdcMask,  hInst, TRUE)) {
          DeleteObject (hbmMask);
          hbmMask = hbm;
          InvalidateRect (hwndMain, &ptoMask->rectClip, TRUE);
          InvalidateRect (hwndMain, &ptoDest->rectClip, TRUE);
        }
      }

    } return FALSE; /* end WM_COMMAND */

  } /* end switch */
  return 0;
}

VOID DrawGrids | ( | HDC | hdc,
 |  | int | width,
 |  | int | height
 | ) |  |

Definition at line 1268 of file PlgBlt.c.

{
int i;

    /* Draw vertical lines. Double at the axis */
    for (i = 0; i<= width; i+=TICKSPACE){
      MoveToEx (hdc, i, 0, NULL);
      LineTo (hdc, i, height);
    }
    MoveToEx (hdc, 1, 0, NULL);
    LineTo (hdc, 1, height);

    /* Draw horizontal lines. Double at the axis */
    for (i = 0; i<= height; i+=TICKSPACE){
      MoveToEx (hdc, 0,i, NULL);
      LineTo (hdc, width,i);
    }
    MoveToEx (hdc, 0, 1, NULL);
    LineTo (hdc, width,1);

  return;
}

LPTSTR GetStringRes ( int id )

Definition at line 1324 of file PlgBlt.c.

{
  static TCHAR buffer[MAX_PATH];

  buffer[0]=0;
  LoadString (GetModuleHandle (NULL), id, buffer, MAX_PATH);
  return buffer;
}

LRESULT CALLBACK MainWndProc | ( | HWND | hwnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 176 of file PlgBlt.c.

{
static int miniWidth;
static RECT rect;
static HANDLE hPenGrid, hPenSeparator;

  switch (message) {

    /**********************************************************************\
    *  WM_CREATE
    *
    * Get three new HDCs, then create three new track objects.
    *  Each track object has different allowed tracking modes.
    *  Finally create two pens for drawing later on.
    \**********************************************************************/
    case WM_CREATE:
        hdcSrc  = GetDC (hwnd);
        hdcDest = GetDC (hwnd);
        hdcMask = GetDC (hwnd);

        ptoDest = doTrackObject (NULL, TROB_NEW, hwnd,0);
        ptoDest->allowedModes = TMALL;
        ptoSrc  = doTrackObject (NULL, TROB_NEW, hwnd,0);
        ptoSrc->allowedModes = TMMOVE | TMSIZEXY;
        ptoMask = doTrackObject (NULL, TROB_NEW, hwnd,0);
        ptoMask->allowedModes = TMMOVE;

        hPenGrid      = CreatePen (PS_SOLID, 1, GRIDCOLOR);
        hPenSeparator = CreatePen (PS_SOLID, 2*SEPARATORWIDTH, (COLORREF) 0x01000000);

        { HMENU hMenu;
        hMenu = GetMenu (hwnd);
        CheckMenuItem(hMenu, IDM_SPINTOPLEFT, MF_CHECKED);
        CheckMenuItem(hMenu, IDM_SPINOFF    , MF_CHECKED);
        nSpin = FALSE;
        }

    break;

    /**********************************************************************\
    *  WM_DESTROY
    *
    * Complement of WM_CREATE.  Free up all of the HDCs, send all of the
    *  track objects their delete messages, delete the pens,
    *  then call PostQuitMessage.
    \**********************************************************************/
    case WM_DESTROY:
        ReleaseDC (hwnd, hdcSrc );
        ReleaseDC (hwnd, hdcDest);
        ReleaseDC (hwnd, hdcMask);
        doTrackObject (ptoDest, TROB_DELETE, hwnd,0);
        doTrackObject (ptoSrc , TROB_DELETE, hwnd,0);
        doTrackObject (ptoMask, TROB_DELETE, hwnd,0);

        DeleteObject(hPenGrid);
        DeleteObject(hPenSeparator);

        PostQuitMessage(0);
    break;

    /**********************************************************************\
    *  WM_SIZE
    *
    * Stretch the top dialog to fill the width of the main window.
    * Adjust the viewport origins of the 6 HDCs.
    * Set the clip regions of the 6 HDCs.
    \**********************************************************************/
    case WM_SIZE: {
        HRGN hrgn;

        SetWindowPos (hwndDlg, NULL, 0,0, LOWORD(lParam), DIALOGHEIGHT, 0);

        GetClientRect (hwndMain, &rect);
        miniWidth = rect.right/3;

        SetViewportOrgEx (hdcDest,      0,           DIALOGHEIGHT, NULL);
        SetViewportOrgEx (ptoDest->hdc, 0,           DIALOGHEIGHT, NULL);
        SetViewportOrgEx (hdcSrc,       miniWidth,   DIALOGHEIGHT, NULL);
        SetViewportOrgEx (ptoSrc->hdc,  miniWidth,   DIALOGHEIGHT, NULL);
        SetViewportOrgEx (hdcMask,      2*miniWidth, DIALOGHEIGHT, NULL);
        SetViewportOrgEx (ptoMask->hdc, 2*miniWidth, DIALOGHEIGHT, NULL);

        ptoDest->rectClip.left    = 0;
        ptoDest->rectClip.top     = DIALOGHEIGHT;
        ptoDest->rectClip.right   = miniWidth-2*SEPARATORWIDTH;
        ptoDest->rectClip.bottom  = rect.bottom;
        hrgn = CreateRectRgnIndirect (&ptoDest->rectClip);
        SelectClipRgn (hdcDest,      hrgn);
        SelectClipRgn (ptoDest->hdc, hrgn);
        DeleteObject (hrgn);

        ptoSrc->rectClip.left    = miniWidth;
        ptoSrc->rectClip.top     = DIALOGHEIGHT;
        ptoSrc->rectClip.right   = 2*miniWidth-2*SEPARATORWIDTH;
        ptoSrc->rectClip.bottom  = rect.bottom;
        hrgn = CreateRectRgnIndirect (&ptoSrc->rectClip);
        SelectClipRgn (hdcSrc,       hrgn);
        SelectClipRgn (ptoSrc->hdc,  hrgn);
        DeleteObject (hrgn);

        ptoMask->rectClip.left    = 2*miniWidth;
        ptoMask->rectClip.top     = DIALOGHEIGHT;
        ptoMask->rectClip.right   = 3*miniWidth;
        ptoMask->rectClip.bottom  = rect.bottom;
        hrgn = CreateRectRgnIndirect (&ptoMask->rectClip);
        SelectClipRgn (hdcMask,      hrgn);
        SelectClipRgn (ptoMask->hdc, hrgn);
        DeleteObject (hrgn);

        SendMessage (hwndDlg, WM_PUTUPLPOINTS, (DWORD_PTR)hdcDest, (LONG_PTR)ptoDest);
        SendMessage (hwndDlg, WM_PUTUPSRCRECT, (DWORD_PTR)hdcSrc,  (LONG_PTR)ptoSrc);
        SendMessage (hwndDlg, WM_PUTUPMASKPT,  (DWORD_PTR)hdcMask, (LONG_PTR)ptoMask);

        /* repaint the whole window. */
        InvalidateRect (hwnd, NULL, TRUE);
    } break;

    /**********************************************************************\
    *  WM_PAINT
    *
    * miniWidth, rect -- set by WM_SIZE message.
    *
    * First shift the viewport origin down so that 0,0 is the top left
    *  most visible point (out from underneath the top dialog).  Second,
    *  draw the grid with wider lines on the axes.  Finally, read the
    *  values out of the top dialog, do elementary validation, and then
    *  try to call plgblt() with the values.
    \**********************************************************************/
     case WM_PAINT: {
        HDC hdc;
        PAINTSTRUCT ps;

        hdc = BeginPaint(hwnd, &ps);

        /* Draw Separator lines for the three miniareas */
        SelectObject(hdc, hPenSeparator);
        MoveToEx (hdc,   miniWidth-SEPARATORWIDTH,0, NULL);
        LineTo   (hdc,   miniWidth-SEPARATORWIDTH, rect.bottom);
        MoveToEx (hdc, 2*miniWidth-SEPARATORWIDTH,0, NULL);
        LineTo   (hdc, 2*miniWidth-SEPARATORWIDTH, rect.bottom);

        /* Grid the HDCs */
        SelectObject(hdcSrc, hPenGrid);
        DrawGrids (hdcSrc, miniWidth, rect.bottom);
        SelectObject(hdcMask, hPenGrid);
        DrawGrids (hdcMask, miniWidth, rect.bottom);

        /* Draw bitmaps if any, then draw track objects over them. */
        if (hbmSrc)  DrawBitmap (hdcSrc, hbmSrc);
        if (hbmMask) DrawBitmap (hdcMask, hbmMask);
        doTrackObject (ptoSrc , TROB_PAINT, hwnd, 0);
        doTrackObject (ptoMask, TROB_PAINT, hwnd, 0);

        /* paint the left third of the window. */
        SendMessage (hwnd, WM_PLGBLT, 0,0);

        EndPaint (hwnd, &ps);
    } return FALSE;

    /**********************************************************************\
    *  WM_PLGBLT
    *
    * WM_USER message.  This paints the left third of the window.  It
    *  is called on the WM_PAINT message.  It is separated out here because
    *  it is common for just the plgblt() to need to be called and not the
    *  whole window painted.
    \**********************************************************************/
    case WM_PLGBLT: {
        POINT lpPoint[3];
        int XSrc, YSrc, nWidth, nHeight, XMask, YMask;
        BOOL success;
        RECT cliprect;

        doTrackObject (ptoSrc , TROB_PAINT, hwnd, 0);
        doTrackObject (ptoMask, TROB_PAINT, hwnd, 0);

        GetClipBox (hdcDest, &cliprect);
        FillRect (hdcDest, &cliprect,
                  (HBRUSH) GetClassLongPtr (hwnd, GCLP_HBRBACKGROUND));
        SelectObject(hdcDest, hPenGrid);

        DrawGrids (hdcDest, miniWidth, rect.bottom);
        if (IsWindow(hwndDlg)) {

          /* Grab points out of the dialog entry fields. */
          lpPoint[0].x = GetDlgItemInt(hwndDlg, DID_P1X, &success, TRUE);
          lpPoint[0].y = GetDlgItemInt(hwndDlg, DID_P1Y, &success, TRUE);
          lpPoint[1].x = GetDlgItemInt(hwndDlg, DID_P2X, &success, TRUE);
          lpPoint[1].y = GetDlgItemInt(hwndDlg, DID_P2Y, &success, TRUE);
          lpPoint[2].x = GetDlgItemInt(hwndDlg, DID_P3X, &success, TRUE);
          lpPoint[2].y = GetDlgItemInt(hwndDlg, DID_P3Y, &success, TRUE);
          XSrc = GetDlgItemInt(hwndDlg, DID_XSRC, &success, TRUE);
          YSrc = GetDlgItemInt(hwndDlg, DID_YSRC, &success, TRUE);
          nWidth = GetDlgItemInt(hwndDlg, DID_WIDTH, &success, TRUE);
          nHeight = GetDlgItemInt(hwndDlg, DID_HEIGHT, &success, TRUE);
          XMask = GetDlgItemInt(hwndDlg, DID_XMASK, &success, TRUE);
          YMask = GetDlgItemInt(hwndDlg, DID_YMASK, &success, TRUE);

          /**********************************************************/
          /**********************************************************/
          PlgBlt (hdcDest, lpPoint,
                  hdcSrc, XSrc, YSrc, nWidth, nHeight,
                  hbmMask, XMask, YMask);
          /**********************************************************/
          /**********************************************************/
        }
        doTrackObject (ptoSrc , TROB_PAINT, hwnd, 0);
        doTrackObject (ptoMask, TROB_PAINT, hwnd, 0);
    } break;

    /**********************************************************************\
    *  WM_LBUTTONDOWN & WM_RBUTTONDOWN
    * On button down messages, hittest on the track object, and if
    *  it returns true, then send these messages to the track object.
    \**********************************************************************/
    case WM_RBUTTONDOWN:
    case WM_LBUTTONDOWN:
      if (doTrackObject(ptoDest, TROB_HITTEST, hwnd, lParam))
         doTrackObject(ptoDest, message, hwnd, lParam);
      else if (doTrackObject(ptoSrc, TROB_HITTEST, hwnd, lParam))
         doTrackObject(ptoSrc, message, hwnd, lParam);
      else if (doTrackObject(ptoMask, TROB_HITTEST, hwnd, lParam))
         doTrackObject(ptoMask, message, hwnd, lParam);
    break;

    /**********************************************************************\
    *  WM_LBUTTONUP & WM_RBUTTONDOWN & MW_MOUSEMOVE
    * If the track object is in a "tracking mode" then send it these messages.
    *  If the transform dialog is not minimized, fill it with numbers.
    *  If the mouse dialog is not minimized, fill it with numbers.
    \**********************************************************************/
    case WM_RBUTTONUP:
    case WM_LBUTTONUP:
      /* user action complete.  Force plgblt() update. */
      PostMessage (hwndMain, WM_PLGBLT, 0,0);
    case WM_MOUSEMOVE:
      if (ptoDest->Mode) {
        doTrackObject(ptoDest, message, hwnd, lParam);
        SendMessage (hwndDlg, WM_PUTUPLPOINTS, (DWORD_PTR) hdcDest, (LONG_PTR) ptoDest);
      }
      if (ptoSrc->Mode) {
        doTrackObject(ptoSrc, message, hwnd, lParam);
        SendMessage (hwndDlg, WM_PUTUPSRCRECT, (DWORD_PTR) hdcSrc, (LONG_PTR) ptoSrc);
      }

      if (ptoMask->Mode) {
        doTrackObject(ptoMask, message, hwnd, lParam);
        SendMessage (hwndDlg, WM_PUTUPMASKPT, (DWORD_PTR) hdcMask, (LONG_PTR) ptoMask);
      }

    break;

    /**********************************************************************\
    *  WM_SETFOCUS
    *
    * The main window should never have the focus.  Set it back
    *  to the top dialog.
    \**********************************************************************/
    case WM_SETFOCUS: SetFocus (hwndDlg);
        return 0;

    /**********************************************************************\
    *  Menu item support.
    *
    \**********************************************************************/
    case WM_COMMAND:
      switch (LOWORD(wParam)) {
        HBITMAP hbmCompat, hbmOld;
        HDC hdcCompat;

        /******************************************************************\
        *  WM_COMMAND, IDM_COPY
        *
        * Create a new bitmap, copy the destination HDC bits into it,
        *  and send the new bitmap to the clipboard.
        \******************************************************************/
        case IDM_COPY: {
          int X[4],Y[4];
          int nWidth, nHeight;
          int Xmin, Ymin, Xmax, Ymax;
          BOOL success;
          int i;

          for (i = 0; i<3 ; i++) {
            X[i] = GetDlgItemInt(hwndDlg, DID_P1X + 2*i, &success, TRUE);
            Y[i] = GetDlgItemInt(hwndDlg, DID_P1Y + 2*i, &success, TRUE);
          }

          X[3] = (X[1] - X[0]) + X[2];
          Y[3] = (Y[2] - Y[0]) + Y[1];

          Xmin = Xmax = X[0];
          Ymin = Ymax = Y[0];

          for (i = 1; i<4 ; i++) {
            Xmin = (X[i] < Xmin) ? X[i] : Xmin;
            Ymin = (Y[i] < Ymin) ? Y[i] : Ymin;
            Xmax = (X[i] > Xmax) ? X[i] : Xmax;
            Ymax = (Y[i] > Ymax) ? Y[i] : Ymax;
          }

          nWidth = Xmax - Xmin;
          nHeight = Ymax - Ymin;

          hdcCompat = CreateCompatibleDC(hdcDest);
          hbmCompat = CreateCompatibleBitmap (hdcDest, nWidth, nHeight);
          hbmOld = SelectObject(hdcCompat,hbmCompat);

          BitBlt (hdcCompat, 0,0,nWidth, nHeight, hdcDest, Xmin,Ymin, SRCCOPY );

          SelectObject(hdcCompat,hbmOld);
          DeleteDC(hdcCompat);

          OpenClipboard (hwnd);
          SetClipboardData (CF_BITMAP,hbmCompat);
          CloseClipboard ();

          DeleteObject (hbmCompat);

        } break;

        /******************************************************************\
        *  WM_COMMAND, IDM_PASTE
        *
        * Get bitmap handle from clipboard, create a new bitmap, draw
        *  the clipboard bitmap into the new one, and store the new
        *  handle in the global hbmSrc.
        \******************************************************************/
        case IDM_PASTE: {
          HBITMAP hbm;
          BITMAP bm;

          OpenClipboard (hwnd);
          if ( hbm = GetClipboardData (CF_BITMAP)) {
            DeleteObject (hbmSrc);

            GetObject (hbm, sizeof(BITMAP), &bm);

            hdcCompat = CreateCompatibleDC(hdcDest);
            hbmCompat = CreateCompatibleBitmap (hdcDest, bm.bmWidth, bm.bmHeight);
            hbmOld = SelectObject(hdcCompat,hbmCompat);

            DrawBitmap (hdcCompat, hbm);

            SelectObject(hdcCompat,hbmOld);
            DeleteDC(hdcCompat);

            hbmSrc = hbmCompat;

            InvalidateRect (hwnd, &ptoSrc->rectClip, TRUE);
            InvalidateRect (hwnd, &ptoDest->rectClip, TRUE);
          }
          CloseClipboard ();
        } break;

        /******************************************************************\
        *  WM_COMMAND, IDM_BOTH
        *
        * Post a COPY and PASTE command message to this window so that with
        *  one key stroke the user can copy the DEST image into the clipboard,
        *  paste it down into the SRC hdc and cause the blt.
        \******************************************************************/
        case IDM_BOTH:

          PostMessage (hwnd, WM_COMMAND, MAKELONG (IDM_COPY , 1), 0);
          PostMessage (hwnd, WM_COMMAND, MAKELONG (IDM_PASTE, 1), 0);

        break;

        /******************************************************************\
        *  WM_COMMAND, IDM_MODE_*
        *
        * manage mutually exclusive menu.
        *  call SetStretchBltMode() for the global destination hdc.
        \******************************************************************/
        case IDM_MODE_BLACKONWHITE:
          { HMENU hMenu;
          hMenu = GetMenu (hwnd);

          CheckMenuItem(hMenu, IDM_MODE_BLACKONWHITE, MF_CHECKED);
          CheckMenuItem(hMenu, IDM_MODE_COLORONCOLOR, MF_UNCHECKED);
          CheckMenuItem(hMenu, IDM_MODE_WHITEONBLACK, MF_UNCHECKED);
          CheckMenuItem(hMenu, IDM_MODE_HALFTONE    , MF_UNCHECKED);

          SetStretchBltMode (hdcDest,BLACKONWHITE);
          SendMessage (hwndMain, WM_PLGBLT, 0,0);

          } return 0;

        case IDM_MODE_COLORONCOLOR:
          { HMENU hMenu;
          hMenu = GetMenu (hwnd);

          CheckMenuItem(hMenu, IDM_MODE_BLACKONWHITE, MF_UNCHECKED);
          CheckMenuItem(hMenu, IDM_MODE_COLORONCOLOR, MF_CHECKED);
          CheckMenuItem(hMenu, IDM_MODE_WHITEONBLACK, MF_UNCHECKED);
          CheckMenuItem(hMenu, IDM_MODE_HALFTONE    , MF_UNCHECKED);

          SetStretchBltMode (hdcDest,COLORONCOLOR);
          SendMessage (hwndMain, WM_PLGBLT, 0,0);

          } return 0;

        case IDM_MODE_WHITEONBLACK:
          { HMENU hMenu;
          hMenu = GetMenu (hwnd);

          CheckMenuItem(hMenu, IDM_MODE_BLACKONWHITE, MF_UNCHECKED);
          CheckMenuItem(hMenu, IDM_MODE_COLORONCOLOR, MF_UNCHECKED);
          CheckMenuItem(hMenu, IDM_MODE_WHITEONBLACK, MF_CHECKED);
          CheckMenuItem(hMenu, IDM_MODE_HALFTONE    , MF_UNCHECKED);

          SetStretchBltMode (hdcDest,WHITEONBLACK);
          SendMessage (hwndMain, WM_PLGBLT, 0,0);

          } return 0;

        case IDM_MODE_HALFTONE    :
          { HMENU hMenu;
          hMenu = GetMenu (hwnd);

          CheckMenuItem(hMenu, IDM_MODE_BLACKONWHITE, MF_UNCHECKED);
          CheckMenuItem(hMenu, IDM_MODE_COLORONCOLOR, MF_UNCHECKED);
          CheckMenuItem(hMenu, IDM_MODE_WHITEONBLACK, MF_UNCHECKED);
          CheckMenuItem(hMenu, IDM_MODE_HALFTONE    , MF_CHECKED);

          SetStretchBltMode (hdcDest,HALFTONE);
          SendMessage (hwndMain, WM_PLGBLT, 0,0);

          } return 0;

        /******************************************************************\
        *  WM_COMMAND, IDM_SPIN*
        *
        * manage mutually exclusive menu.
        *
        \******************************************************************/
        case IDM_SPINOFF:
          { HMENU hMenu;
          hMenu = GetMenu (hwnd);

          CheckMenuItem(hMenu, IDM_SPINOFF, MF_CHECKED);
          CheckMenuItem(hMenu, IDM_SPIN5  , MF_UNCHECKED);
          CheckMenuItem(hMenu, IDM_SPIN10 , MF_UNCHECKED);
          CheckMenuItem(hMenu, IDM_SPIN30 , MF_UNCHECKED);
          CheckMenuItem(hMenu, IDM_SPIN60 , MF_UNCHECKED);
          CheckMenuItem(hMenu, IDM_SPIN90 , MF_UNCHECKED);

          nSpin = FALSE;
          SendMessage (hwndMain, WM_PLGBLT, 0,0);

          } return 0;

        case IDM_SPIN5 :
          { HMENU hMenu;
          hMenu = GetMenu (hwnd);

          CheckMenuItem(hMenu, IDM_SPINOFF, MF_UNCHECKED);
          CheckMenuItem(hMenu, IDM_SPIN5  , MF_CHECKED);
          CheckMenuItem(hMenu, IDM_SPIN10 , MF_UNCHECKED);
          CheckMenuItem(hMenu, IDM_SPIN30 , MF_UNCHECKED);
          CheckMenuItem(hMenu, IDM_SPIN60 , MF_UNCHECKED);
          CheckMenuItem(hMenu, IDM_SPIN90 , MF_UNCHECKED);

          nSpin = 5;

          } return 0;

        case IDM_SPIN10:
          { HMENU hMenu;
          hMenu = GetMenu (hwnd);

          CheckMenuItem(hMenu, IDM_SPINOFF, MF_UNCHECKED);
          CheckMenuItem(hMenu, IDM_SPIN5  , MF_UNCHECKED);
          CheckMenuItem(hMenu, IDM_SPIN10 , MF_CHECKED);
          CheckMenuItem(hMenu, IDM_SPIN30 , MF_UNCHECKED);
          CheckMenuItem(hMenu, IDM_SPIN60 , MF_UNCHECKED);
          CheckMenuItem(hMenu, IDM_SPIN90 , MF_UNCHECKED);

          nSpin = 10;

          } return 0;

        case IDM_SPIN30:
          { HMENU hMenu;
          hMenu = GetMenu (hwnd);

          CheckMenuItem(hMenu, IDM_SPINOFF, MF_UNCHECKED);
          CheckMenuItem(hMenu, IDM_SPIN5  , MF_UNCHECKED);
          CheckMenuItem(hMenu, IDM_SPIN10 , MF_UNCHECKED);
          CheckMenuItem(hMenu, IDM_SPIN30 , MF_CHECKED);
          CheckMenuItem(hMenu, IDM_SPIN60 , MF_UNCHECKED);
          CheckMenuItem(hMenu, IDM_SPIN90 , MF_UNCHECKED);

          nSpin = 30;

          } return 0;

        case IDM_SPIN60:
          { HMENU hMenu;
          hMenu = GetMenu (hwnd);

          CheckMenuItem(hMenu, IDM_SPINOFF, MF_UNCHECKED);
          CheckMenuItem(hMenu, IDM_SPIN5  , MF_UNCHECKED);
          CheckMenuItem(hMenu, IDM_SPIN10 , MF_UNCHECKED);
          CheckMenuItem(hMenu, IDM_SPIN30 , MF_UNCHECKED);
          CheckMenuItem(hMenu, IDM_SPIN60 , MF_CHECKED);
          CheckMenuItem(hMenu, IDM_SPIN90 , MF_UNCHECKED);

          nSpin = 60;

          } return 0;

        case IDM_SPIN90:
          { HMENU hMenu;
          hMenu = GetMenu (hwnd);

          CheckMenuItem(hMenu, IDM_SPINOFF, MF_UNCHECKED);
          CheckMenuItem(hMenu, IDM_SPIN5  , MF_UNCHECKED);
          CheckMenuItem(hMenu, IDM_SPIN10 , MF_UNCHECKED);
          CheckMenuItem(hMenu, IDM_SPIN30 , MF_UNCHECKED);
          CheckMenuItem(hMenu, IDM_SPIN60 , MF_UNCHECKED);
          CheckMenuItem(hMenu, IDM_SPIN90 , MF_CHECKED);

          nSpin = 90;

          } return 0;

        case IDM_FLIPONCE:
          nSpin = 90;
          SendMessage (hwndMain, WM_SPIN, 0,0);
          nSpin = FALSE;
          return 0;

        case IDM_SPINTOPLEFT:
          { HMENU hMenu;
          hMenu = GetMenu (hwnd);

          CheckMenuItem(hMenu, IDM_SPINTOPLEFT, MF_CHECKED);
          CheckMenuItem(hMenu, IDM_SPINCENTER , MF_UNCHECKED);

          } return 0;

        case IDM_SPINCENTER:
          { HMENU hMenu;
          hMenu = GetMenu (hwnd);

          CheckMenuItem(hMenu, IDM_SPINTOPLEFT, MF_UNCHECKED);
          CheckMenuItem(hMenu, IDM_SPINCENTER , MF_CHECKED);

          } return 0;

        /******************************************************************\
        *  WM_COMMAND, DID_NEW*
        *
        * menu equivalents for buttons on top dialog.  Just pass along
        *  WM_COMMAND messages to the dialog.
        *
        \******************************************************************/
        case DID_NEWSRC:
        case DID_NEWMASK:
          SendMessage (hwndDlg, message, wParam, lParam);
        return 0;

        /******************************************************************\
        *  WM_COMMAND, IDM_ABOUT
        *
        \******************************************************************/
        case IDM_ABOUT:
          DialogBox (hInst, "aboutBox", hwnd, (DLGPROC)About);
        return 0;

      }  /* end switch */

    break;  /* end wm_command */

    /******************************************************************\
    *  WM_SPIN
    *
    * Set up a transform to modify the destination points.
    *  (Note that the transform in hdcDest remains the identity.)
    *  Loop through, reblitting to the transformed points.
    *  Erase behind the old bitmap by keeping track of the region uncovered.
    *
    \******************************************************************/
    case WM_SPIN: {

      XFORM  x;
      HDC hdc;
      float M11, M12, M21, M22;
      int nSteps, i;

      POINT pivot;
      POINT lpPoint[3];
      POINT lpRgnErase[4], lpRgnBmp[4];
      HRGN hrgnErase, hrgnBmp;
      HMENU hMenu;
      int XSrc, YSrc, nWidth, nHeight, XMask, YMask;
      BOOL success;

      /* validate the dialog on top with the parameters in it. */
      if (!IsWindow(hwndDlg)) return 0;

      /* Grab points out of the dialog entry fields. */
      lpPoint[0].x = GetDlgItemInt(hwndDlg, DID_P1X, &success, TRUE);
      lpPoint[0].y = GetDlgItemInt(hwndDlg, DID_P1Y, &success, TRUE);
      lpPoint[1].x = GetDlgItemInt(hwndDlg, DID_P2X, &success, TRUE);
      lpPoint[1].y = GetDlgItemInt(hwndDlg, DID_P2Y, &success, TRUE);
      lpPoint[2].x = GetDlgItemInt(hwndDlg, DID_P3X, &success, TRUE);
      lpPoint[2].y = GetDlgItemInt(hwndDlg, DID_P3Y, &success, TRUE);
      XSrc = GetDlgItemInt(hwndDlg, DID_XSRC, &success, TRUE);
      YSrc = GetDlgItemInt(hwndDlg, DID_YSRC, &success, TRUE);
      nWidth = GetDlgItemInt(hwndDlg, DID_WIDTH, &success, TRUE);
      nHeight = GetDlgItemInt(hwndDlg, DID_HEIGHT, &success, TRUE);
      XMask = GetDlgItemInt(hwndDlg, DID_XMASK, &success, TRUE);
      YMask = GetDlgItemInt(hwndDlg, DID_YMASK, &success, TRUE);

      /* get an HDC we can use to play with transforms. */
      hdc = GetDC (hwnd);
      SetGraphicsMode (hdc, GM_ADVANCED);

      /* check menu check to pivot on top-left corner, or pivot on center. */
      hMenu = GetMenu (hwnd);

      if (GetMenuState(hMenu, IDM_SPINCENTER, MF_BYCOMMAND) & MF_CHECKED) {
        pivot.x = (lpPoint[1].x +lpPoint[2].x)/2;
        pivot.y = (lpPoint[1].y +lpPoint[2].y)/2;
      } else {
        pivot.x = lpPoint[0].x;
        pivot.y = lpPoint[0].y;
      }

      /* nSpin contains values reflecting the number of degrees per step.
       *  fill in the number of steps required (360 / nSpin), and fill in
       *  the precomputed transformation matrices.
       */
      switch (nSpin) {

        case 5:
          nSteps = 72;
          M11 =                   M22 = (float)0.9961946980917;
          M12 = (float)-0.08715574274766; M21 = (float)0.08715574274766;
          break;
        case 10:
          nSteps = 36;
          M11 =                   M22 = (float)0.984808;
          M12 = (float)-0.173648; M21 = (float)0.173648;
          break;
        case 30:
          nSteps = 12;
          M11 =                   M22 = (float)0.866025;
          M12 = (float)-0.5     ; M21 = (float)0.5;
          break;
        case 60:
          nSteps = 6;
          M11 =                   M22 = (float)0.5     ;
          M12 = (float)-0.866025; M21 = (float)0.866025;
          break;
        case 90:
          nSteps = 4;
          M11 =                   M22 = (float)0.0;
          M12 = (float)-1.0     ; M21 = (float)1.0;
          break;
        default:
          MessageBox (hwnd,
                      GetStringRes (IDS_INVALID),
                      NULL, MB_ICONHAND);
          return 0;

      } /* end switch nSpin */

      /* translate objects from pivot point to origin. */
      x.eM11 = (float)1.0;
      x.eM12 = (float)0.0;
      x.eM21 = (float)0.0;
      x.eM22 = (float)1.0;
      x.eDx = (float)-pivot.x;
      x.eDy = (float)-pivot.y;
      ModifyWorldTransform (hdc, &x, MWT_RIGHTMULTIPLY);

      /* rotate object about origin. */
      x.eM11 = M11;
      x.eM12 = M12;
      x.eM21 = M21;
      x.eM22 = M22;
      x.eDx = (float)0.0;
      x.eDy = (float)0.0;
      ModifyWorldTransform (hdc, &x, MWT_RIGHTMULTIPLY);

      /* translate objects back to pivot point. */
      x.eM11 = (float)1.0;
      x.eM12 = (float)0.0;
      x.eM21 = (float)0.0;
      x.eM22 = (float)1.0;
      x.eDx = (float)pivot.x;
      x.eDy = (float)pivot.y;
      ModifyWorldTransform (hdc, &x, MWT_RIGHTMULTIPLY);

      /* fill in initial region for erasure... the region containing bmp */
      lpRgnErase[0] = lpPoint[0];
      lpRgnErase[1] = lpPoint[1];
      lpRgnErase[3] = lpPoint[2];
      lpRgnErase[2].x =  lpPoint[1].x - lpPoint[0].x;
      lpRgnErase[2].x += lpPoint[2].x - lpPoint[0].x;
      lpRgnErase[2].x += lpPoint[0].x;
      lpRgnErase[2].y =  lpPoint[1].y - lpPoint[0].y;
      lpRgnErase[2].y += lpPoint[2].y - lpPoint[0].y;
      lpRgnErase[2].y += lpPoint[0].y;

      /* loop through transforming the points on each step. */
      for (i= 0; i<nSteps; i++) {

        hrgnErase = CreatePolygonRgn (lpRgnErase, 4, ALTERNATE);

        /* TRANSFORM the lpPoint[] destination extent points */
        LPtoDP (hdc, lpPoint, 3);

        /* create a region containing the new bitmap extents */
        lpRgnBmp[0] = lpPoint[0];
        lpRgnBmp[1] = lpPoint[1];
        lpRgnBmp[3] = lpPoint[2];
        lpRgnBmp[2].x =  lpPoint[1].x - lpPoint[0].x;
        lpRgnBmp[2].x += lpPoint[2].x - lpPoint[0].x;
        lpRgnBmp[2].x += lpPoint[0].x;
        lpRgnBmp[2].y =  lpPoint[1].y - lpPoint[0].y;
        lpRgnBmp[2].y += lpPoint[2].y - lpPoint[0].y;
        lpRgnBmp[2].y += lpPoint[0].y;
        hrgnBmp = CreatePolygonRgn (lpRgnBmp, 4, ALTERNATE);

        /* subtract the new bitmap extents region from the erasure region. */
        CombineRgn (hrgnErase, hrgnErase, hrgnBmp, RGN_DIFF);

        /* while we are here, get points ready for the next loop erasure */
        lpRgnErase[0] = lpPoint[0];
        lpRgnErase[1] = lpPoint[1];
        lpRgnErase[3] = lpPoint[2];
        lpRgnErase[2].x =  lpPoint[1].x - lpPoint[0].x;
        lpRgnErase[2].x += lpPoint[2].x - lpPoint[0].x;
        lpRgnErase[2].x += lpPoint[0].x;
        lpRgnErase[2].y =  lpPoint[1].y - lpPoint[0].y;
        lpRgnErase[2].y += lpPoint[2].y - lpPoint[0].y;
        lpRgnErase[2].y += lpPoint[0].y;

        /**********************************************************/
        PlgBlt (hdcDest, lpPoint,
                hdcSrc, XSrc, YSrc, nWidth, nHeight,
                hbmMask, XMask, YMask);
        /**********************************************************/

        /* need to flush graphics buffer, or regions are erased
         *  before the bitmap is drawn.
         */
        GdiFlush();

        /* erase the newly uncovered region. */
        FillRgn (hdcDest, hrgnErase, BACKGROUNDBRUSH );
        DeleteObject (hrgnErase);
        DeleteObject (hrgnBmp);
      } /* end for loop */

      /* because of roundoff error, the 'nSteps'th rotation will not
       *  always bring the parallelogram around to the 0th position.
       *  So we special case the last position, and do one more erase.
       *  Try commenting this out, and see the little glitches left
       *  on the screen if this comment is unclear.
       */
      lpRgnErase[0] = lpPoint[0];
      lpRgnErase[1] = lpPoint[1];
      lpRgnErase[3] = lpPoint[2];
      lpRgnErase[2].x =  lpPoint[1].x - lpPoint[0].x;
      lpRgnErase[2].x += lpPoint[2].x - lpPoint[0].x;
      lpRgnErase[2].x += lpPoint[0].x;
      lpRgnErase[2].y =  lpPoint[1].y - lpPoint[0].y;
      lpRgnErase[2].y += lpPoint[2].y - lpPoint[0].y;
      lpRgnErase[2].y += lpPoint[0].y;
      hrgnErase = CreatePolygonRgn (lpRgnErase, 4, ALTERNATE);
      lpPoint[0].x = GetDlgItemInt(hwndDlg, DID_P1X, &success, TRUE);
      lpPoint[0].y = GetDlgItemInt(hwndDlg, DID_P1Y, &success, TRUE);
      lpPoint[1].x = GetDlgItemInt(hwndDlg, DID_P2X, &success, TRUE);
      lpPoint[1].y = GetDlgItemInt(hwndDlg, DID_P2Y, &success, TRUE);
      lpPoint[2].x = GetDlgItemInt(hwndDlg, DID_P3X, &success, TRUE);
      lpPoint[2].y = GetDlgItemInt(hwndDlg, DID_P3Y, &success, TRUE);
      lpRgnBmp[0] = lpPoint[0];
      lpRgnBmp[1] = lpPoint[1];
      lpRgnBmp[3] = lpPoint[2];
      lpRgnBmp[2].x =  lpPoint[1].x - lpPoint[0].x;
      lpRgnBmp[2].x += lpPoint[2].x - lpPoint[0].x;
      lpRgnBmp[2].x += lpPoint[0].x;
      lpRgnBmp[2].y =  lpPoint[1].y - lpPoint[0].y;
      lpRgnBmp[2].y += lpPoint[2].y - lpPoint[0].y;
      lpRgnBmp[2].y += lpPoint[0].y;
      hrgnBmp = CreatePolygonRgn (lpRgnBmp, 4, ALTERNATE);
      CombineRgn (hrgnErase, hrgnErase, hrgnBmp, RGN_DIFF);
      FillRgn (hdcDest, hrgnErase, BACKGROUNDBRUSH );
      DeleteObject (hrgnErase);
      DeleteObject (hrgnBmp);

      ReleaseDC (hwnd, hdc);

    } return 0; /* end WM_SPIN message */

  } /* end switch */
  return (DefWindowProc(hwnd, message, wParam, lParam));
}

int APIENTRY WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 53 of file PlgBlt.c.

{
    MSG   msg;
    RECT rect;
    HANDLE haccel;

    UNREFERENCED_PARAMETER( lpCmdLine );

    //
    // Detect platform and exit gracefully if not Windows NT.
    //

    {
      OSVERSIONINFO osvi;
      osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);

      GetVersionEx (&osvi);
      if (osvi.dwPlatformId != VER_PLATFORM_WIN32_NT) {
        MessageBox (NULL,
          GetStringRes (IDS_NTONLY),
          "PlgBlt", MB_OK | MB_ICONSTOP);
        return 0;
      }
    }

    /* Check for previous instance.  If none, then register class. */
    if (!hPrevInstance) {
        WNDCLASS  wc;

        wc.style = 0;
        wc.lpfnWndProc = (WNDPROC)MainWndProc;

        wc.cbClsExtra = 0;
        wc.cbWndExtra = 0;
        wc.hInstance = hInstance;
        wc.hIcon = LoadIcon(hInstance, "plgbltIcon");
        wc.hCursor = LoadCursor(NULL, IDC_ARROW);
        wc.hbrBackground = BACKGROUNDBRUSH;
        wc.lpszMenuName =  "plgbltMenu";
        wc.lpszClassName = "plgblt";

        if (!RegisterClass(&wc)) return (FALSE);
    }  /* class registered o.k. */

    /* Create the main window.  Return false if CreateWindow() fails */
    hInst = hInstance;

    hwndMain = CreateWindow(
        "plgblt",
        GetStringRes (IDS_WINDOWTITLE),
        WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
        CW_USEDEFAULT,
        CW_USEDEFAULT,
        CW_USEDEFAULT,
        CW_USEDEFAULT,
        NULL,
        NULL,
        hInstance,
        NULL);

    if (!hwndMain) return (FALSE);

    /* create the top dialog as a child of the main window. */
    hwndDlg = CreateDialog (hInst, "plgbltDlg", hwndMain, (DLGPROC)DlgProc);

    /* Send main window a WM_SIZE message so that it will size the top
     *  dialog correctly.
     */
    GetClientRect (hwndMain, &rect);
    SendMessage (hwndMain, WM_SIZE, 0, (rect.right - rect.left));
    ShowWindow (hwndDlg, SW_SHOW);
    ShowWindow(hwndMain, nCmdShow);

    /* get global handle to the menu */

    /* Load the accelerator table that provides clipboard support. */
    haccel = LoadAccelerators (hInst, "bltAccel");

    /* Loop getting messages and dispatching them. */
    while (GetMessage(&msg,NULL, 0,0)) {
      if (!TranslateAccelerator(hwndMain, haccel, &msg))
      if (!IsDialogMessage (hwndDlg, &msg)){
        DispatchMessage(&msg);
      }

      /* if no messages, and we are spinning, then post spin message. */
      if (!PeekMessage (&msg, hwndMain, 0,0, PM_NOREMOVE) && nSpin)
        PostMessage (hwndMain, WM_SPIN, 0,0);
    }

    /* Return the value from PostQuitMessage */
    return (int)(msg.wParam);
}

Variable Documentation

HBITMAP hbmMask = NULL

Definition at line 34 of file PlgBlt.c.

HBITMAP hbmSrc

Definition at line 34 of file PlgBlt.c.

HDC hdcDest

Definition at line 33 of file PlgBlt.c.

HDC hdcMask

Definition at line 33 of file PlgBlt.c.

HDC hdcSrc

Definition at line 33 of file PlgBlt.c.

HANDLE hInst

Definition at line 36 of file PlgBlt.c.

HWND hwndDlg

Definition at line 37 of file PlgBlt.c.

HWND hwndMain

Definition at line 37 of file PlgBlt.c.

int nSpin

Definition at line 39 of file PlgBlt.c.

PTrackObject ptoDest

Definition at line 32 of file PlgBlt.c.

PTrackObject ptoMask = NULL

Definition at line 32 of file PlgBlt.c.

PTrackObject ptoSrc

Definition at line 32 of file PlgBlt.c.

Generated on Wed Nov 13 2024 16:53:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/WinNT/PlgBlt/PlgBlt.h File Reference

  • Multimedia
  • Gdi
  • WinNT
  • PlgBlt
Defines | Functions

PlgBlt.h File Reference

Go to the source code of this file.

Defines

#define | DIALOGHEIGHT 90
#define | DID_DRAW 200
#define | DID_HEIGHT 113
#define | DID_NEWMASK 161
#define | DID_NEWSRC 160
#define | DID_P1X 101
#define | DID_P1Y 102
#define | DID_P2X 103
#define | DID_P2Y 104
#define | DID_P3X 105
#define | DID_P3Y 106
#define | DID_WIDTH 112
#define | DID_XMASK 114
#define | DID_XSRC 110
#define | DID_YMASK 115
#define | DID_YSRC 111
#define | GRIDCOLOR (COLORREF) 0x01000006
#define | IDM_ABOUT 330
#define | IDM_BOTH 302
#define | IDM_COPY 300
#define | IDM_FLIPONCE 311
#define | IDM_MODE_BLACKONWHITE 320
#define | IDM_MODE_COLORONCOLOR 321
#define | IDM_MODE_HALFTONE 323
#define | IDM_MODE_WHITEONBLACK 322
#define | IDM_PASTE 301
#define | IDM_SPIN10 313
#define | IDM_SPIN30 314
#define | IDM_SPIN5 312
#define | IDM_SPIN60 315
#define | IDM_SPIN90 316
#define | IDM_SPINCENTER 318
#define | IDM_SPINOFF 310
#define | IDM_SPINTOPLEFT 317
#define | IDS_INVALID 18
#define | IDS_MONOCHROME 19
#define | IDS_NTONLY 16
#define | IDS_WINDOWTITLE 17
#define | INC 5
#define | MAXCHARS 32
#define | SEPARATORWIDTH 4
#define | WM_PLGBLT WM_USER+23
#define | WM_PUTUPLPOINTS WM_USER+20
#define | WM_PUTUPMASKPT WM_USER+22
#define | WM_PUTUPSRCRECT WM_USER+21
#define | WM_SPIN WM_USER+24

Functions

LRESULT CALLBACK | About (HWND, UINT, WPARAM, LPARAM)
LRESULT CALLBACK | DlgProc (HWND, UINT, WPARAM, LPARAM)
VOID | DrawGrids (HDC, int, int)
LPTSTR | GetStringRes (int)
LRESULT CALLBACK | MainWndProc (HWND, UINT, WPARAM, LPARAM)

Define Documentation

#define DIALOGHEIGHT 90

Definition at line 69 of file PlgBlt.h.

#define DID_DRAW 200

Definition at line 40 of file PlgBlt.h.

#define DID_HEIGHT 113

Definition at line 34 of file PlgBlt.h.

#define DID_NEWMASK 161

Definition at line 38 of file PlgBlt.h.

#define DID_NEWSRC 160

Definition at line 37 of file PlgBlt.h.

#define DID_P1X 101

Definition at line 25 of file PlgBlt.h.

#define DID_P1Y 102

Definition at line 26 of file PlgBlt.h.

#define DID_P2X 103

Definition at line 27 of file PlgBlt.h.

#define DID_P2Y 104

Definition at line 28 of file PlgBlt.h.

#define DID_P3X 105

Definition at line 29 of file PlgBlt.h.

#define DID_P3Y 106

Definition at line 30 of file PlgBlt.h.

#define DID_WIDTH 112

Definition at line 33 of file PlgBlt.h.

#define DID_XMASK 114

Definition at line 35 of file PlgBlt.h.

#define DID_XSRC 110

Definition at line 31 of file PlgBlt.h.

#define DID_YMASK 115

Definition at line 36 of file PlgBlt.h.

#define DID_YSRC 111

Definition at line 32 of file PlgBlt.h.

#define GRIDCOLOR (COLORREF) 0x01000006

Definition at line 68 of file PlgBlt.h.

#define IDM_ABOUT 330

Definition at line 58 of file PlgBlt.h.

#define IDM_BOTH 302

Definition at line 44 of file PlgBlt.h.

#define IDM_COPY 300

Definition at line 42 of file PlgBlt.h.

#define IDM_FLIPONCE 311

Definition at line 46 of file PlgBlt.h.

#define IDM_MODE_BLACKONWHITE 320

Definition at line 54 of file PlgBlt.h.

#define IDM_MODE_COLORONCOLOR 321

Definition at line 55 of file PlgBlt.h.

#define IDM_MODE_HALFTONE 323

Definition at line 57 of file PlgBlt.h.

#define IDM_MODE_WHITEONBLACK 322

Definition at line 56 of file PlgBlt.h.

#define IDM_PASTE 301

Definition at line 43 of file PlgBlt.h.

#define IDM_SPIN10 313

Definition at line 48 of file PlgBlt.h.

#define IDM_SPIN30 314

Definition at line 49 of file PlgBlt.h.

#define IDM_SPIN5 312

Definition at line 47 of file PlgBlt.h.

#define IDM_SPIN60 315

Definition at line 50 of file PlgBlt.h.

#define IDM_SPIN90 316

Definition at line 51 of file PlgBlt.h.

#define IDM_SPINCENTER 318

Definition at line 53 of file PlgBlt.h.

#define IDM_SPINOFF 310

Definition at line 45 of file PlgBlt.h.

#define IDM_SPINTOPLEFT 317

Definition at line 52 of file PlgBlt.h.

#define IDS_INVALID 18

Definition at line 63 of file PlgBlt.h.

#define IDS_MONOCHROME 19

Definition at line 64 of file PlgBlt.h.

#define IDS_NTONLY 16

Definition at line 61 of file PlgBlt.h.

#define IDS_WINDOWTITLE 17

Definition at line 62 of file PlgBlt.h.

#define INC 5

Definition at line 72 of file PlgBlt.h.

#define MAXCHARS 32

Definition at line 71 of file PlgBlt.h.

#define SEPARATORWIDTH 4

Definition at line 70 of file PlgBlt.h.

#define WM_PLGBLT WM_USER+23

Definition at line 81 of file PlgBlt.h.

#define WM_PUTUPLPOINTS WM_USER+20

Definition at line 78 of file PlgBlt.h.

#define WM_PUTUPMASKPT WM_USER+22

Definition at line 80 of file PlgBlt.h.

#define WM_PUTUPSRCRECT WM_USER+21

Definition at line 79 of file PlgBlt.h.

#define WM_SPIN WM_USER+24

Definition at line 82 of file PlgBlt.h.

Function Documentation

LRESULT CALLBACK About | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 445 of file Generic.C.

{
   static  HFONT hfontDlg;    // Font for dialog text
   static   HFONT hFinePrint; // Font for 'fine print' in dialog
   DWORD   dwVerInfoSize;     // Size of version information block
   LPSTR   lpVersion;         // String pointer to 'version' text
   DWORD   dwVerHnd=0;        // An 'ignored' parameter, always '0'
   UINT    uVersionLen;
   WORD    wRootLen;
   BOOL    bRetCode;
   int     i;
   char    szFullPath[BUFFSIZE];
   char    szResult[BUFFSIZE];
   char    szGetName[BUFFSIZE];
   DWORD dwVersion;
   char  szVersion[40];
   DWORD dwResult;
   HRESULT hRes;

   switch (message) {
        case WM_INITDIALOG:
         ShowWindow (hDlg, SW_HIDE);

         if (PRIMARYLANGID(GetUserDefaultLangID()) == LANG_JAPANESE)
         {
            hfontDlg = CreateFont(14, 0, 0, 0, 0, 0, 0, 0, SHIFTJIS_CHARSET, 0, 0, 0,
                                  VARIABLE_PITCH | FF_DONTCARE, "");
            hFinePrint = CreateFont(11, 0, 0, 0, 0, 0, 0, 0, SHIFTJIS_CHARSET, 0, 0, 0,
                                    VARIABLE_PITCH | FF_DONTCARE, "");
         }
         else
         {
            hfontDlg = CreateFont(14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                  VARIABLE_PITCH | FF_SWISS, "");
            hFinePrint = CreateFont(11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                    VARIABLE_PITCH | FF_SWISS, "");
         }

         CenterWindow (hDlg, GetWindow (hDlg, GW_OWNER));
         GetModuleFileName (hInst, szFullPath, sizeof(szFullPath));

         // Now lets dive in and pull out the version information:
         dwVerInfoSize = GetFileVersionInfoSize(szFullPath, &dwVerHnd);
         if (dwVerInfoSize) {
            LPSTR   lpstrVffInfo;
            HANDLE  hMem;
            hMem = GlobalAlloc(GMEM_MOVEABLE, dwVerInfoSize);
            lpstrVffInfo  = GlobalLock(hMem);
            GetFileVersionInfo(szFullPath, dwVerHnd, dwVerInfoSize, lpstrVffInfo);
            // The below 'hex' value looks a little confusing, but
            // essentially what it is, is the hexidecimal representation
            // of a couple different values that represent the language
            // and character set that we are wanting string values for.
            // 040904E4 is a very common one, because it means:
            //   US English, Windows MultiLingual characterset
            // Or to pull it all apart:
            // 04------        = SUBLANG_ENGLISH_USA
            // --09----        = LANG_ENGLISH
            // --11----        = LANG_JAPANESE
            // ----04E4 = 1252 = Codepage for Windows:Multilingual

            // Use safe string handling
            szGetName[sizeof(szGetName) - 1] = '\0';
            lstrcpyn(szGetName, GetStringRes(IDS_VER_INFO_LANG), sizeof(szGetName) - 1);
            if (szGetName[sizeof(szGetName) - 1] != '\0') {
                return FALSE; // Buffer overflow error
            }

            wRootLen = (WORD) lstrlen(szGetName); // Save this position

            // Set the title of the dialog using safe string handling
            hRes = StringCchCatN(szGetName, sizeof(szGetName), "ProductName", sizeof("ProductName"));
            if (FAILED(hRes)) {
                return FALSE; // Buffer overflow error
            }

            bRetCode = VerQueryValue((LPVOID)lpstrVffInfo,
               (LPSTR)szGetName,
               (LPVOID)&lpVersion,
               (UINT *)&uVersionLen);

            // Notice order of version and string...
            if (PRIMARYLANGID(GetUserDefaultLangID()) == LANG_JAPANESE)
            {
                // Use safe string handling
                hRes = StringCchCopyN(szResult, sizeof(szResult), lpVersion, lstrlen(lpVersion));
                if (FAILED(hRes)) {
                    return FALSE; // Buffer overflow error
                }
                hRes = StringCchCatN(szResult, sizeof(szResult), " ‚Ìƒo[ƒWƒ‡ƒ“î•ñ", sizeof(" ‚Ìƒo[ƒWƒ‡ƒ“î•ñ"));
                if (FAILED(hRes)) {
                    return FALSE; // Buffer overflow error
                }
            }
            else
            {
                // Use safe string handling
                hRes = StringCchCopyN(szResult, sizeof(szResult), "About ", sizeof("About "));
                if (FAILED(hRes)) {
                    return FALSE; // Buffer overflow error
                }
                hRes = StringCchCatN(szResult, sizeof(szResult), lpVersion, lstrlen(lpVersion));
                if (FAILED(hRes)) {
                    return FALSE; // Buffer overflow error
                }
            }

            // -----------------------------------------------------

            SetWindowText (hDlg, szResult);

            // Walk through the dialog items that we want to replace:
            for (i = DLG_VERFIRST; i <= DLG_VERLAST; i++) {
               GetDlgItemText(hDlg, i, szResult, sizeof(szResult));
               szGetName[wRootLen] = (char)0;
               // Use safe sting handling
               hRes = StringCchCatN(szGetName, sizeof(szGetName), szResult, sizeof(szResult));
               if (FAILED(hRes)) {
                   return FALSE; // Buffer overflow error
               }
               uVersionLen   = 0;
               lpVersion     = NULL;
               bRetCode      =  VerQueryValue((LPVOID)lpstrVffInfo,
                  (LPSTR)szGetName,
                  (LPVOID)&lpVersion,
                  (UINT *)&uVersionLen);

               if ( bRetCode && uVersionLen && lpVersion) {
                   // Replace dialog item text with version info
                   // Use safe string handling
                   hRes = StringCchCopyN(szResult, sizeof(szResult), lpVersion, lstrlen(lpVersion));
                   if (FAILED(hRes)) {
                       return FALSE; // Buffer overflow error
                   }
                   SetDlgItemText(hDlg, i, szResult);
               }
               else
               {
                  dwResult = GetLastError();

                  // Use safe string handling
                  hRes = StringCchPrintf(szResult, sizeof(szResult), GetStringRes(IDS_VERSION_ERROR), dwResult);
                  if (FAILED(hRes)) {
                      return FALSE; // Buffer overflow error
                  }

                  SetDlgItemText (hDlg, i, szResult);
               }
               SendMessage (GetDlgItem (hDlg, i), WM_SETFONT,
                  (ULONG_PTR)((i==DLG_VERLAST)?hFinePrint:hfontDlg),
                  TRUE);
            } // for (i = DLG_VERFIRST; i <= DLG_VERLAST; i++)

            GlobalUnlock(hMem);
            GlobalFree(hMem);

         } else {
            // No version information available.
         } // if (dwVerInfoSize)

            SendMessage (GetDlgItem (hDlg, IDC_LABEL), WM_SETFONT,
            (WPARAM)hfontDlg,(LPARAM)TRUE);

         // We are  using GetVersion rather then GetVersionEx
         // because earlier versions of Windows NT and Win32s
         // didn't include GetVersionEx:
         dwVersion = GetVersion();

         if (dwVersion < 0x80000000) {
            // Windows NT
            // Use safe sting handling
            hRes = StringCchPrintf(szVersion, sizeof(szVersion), "Microsoft Windows NT %u.%u (Build: %u)",
                (DWORD)(LOBYTE(LOWORD(dwVersion))),
                (DWORD)(HIBYTE(LOWORD(dwVersion))),
                (DWORD)(HIWORD(dwVersion)) );
            if (FAILED(hRes)) {
                return FALSE; // Buffer overflow error
            }
         } else if (LOBYTE(LOWORD(dwVersion))<4) {
            // Win32s
            // Use safe sting handling
            hRes = StringCchPrintf(szVersion, sizeof(szVersion), "Microsoft Win32s %u.%u (Build: %u)",
                (DWORD)(LOBYTE(LOWORD(dwVersion))),
                (DWORD)(HIBYTE(LOWORD(dwVersion))),
                (DWORD)(HIWORD(dwVersion) & ~0x8000) );
            if (FAILED(hRes)) {
                return FALSE; // Buffer overflow error
            }
         } else {
            // Windows 95
            // Use safe sting handling
            hRes = StringCchPrintf(szVersion, sizeof(szVersion), "Microsoft Windows 95 %u.%u",
                (DWORD)(LOBYTE(LOWORD(dwVersion))),
                (DWORD)(HIBYTE(LOWORD(dwVersion))) );
            if (FAILED(hRes)) {
                return FALSE; // Buffer overflow error
            }
         }

          SetWindowText (GetDlgItem(hDlg, IDC_OSVERSION), szVersion);
         ShowWindow (hDlg, SW_SHOW);
         return (TRUE);

      case WM_COMMAND:
         if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) {
            EndDialog(hDlg, TRUE);
            DeleteObject (hfontDlg);
            DeleteObject (hFinePrint);
            return (TRUE);
         }
         break;
   }

    return FALSE;
}

LRESULT CALLBACK DlgProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 1058 of file PlgBlt.c.

{

  switch (message) {
    /**********************************************************************\
    *  WM_INITDIALOG
    *
    * Fill the entry fields with sensible original values.
    \**********************************************************************/
    case WM_INITDIALOG:
        SetDlgItemText(hwnd, DID_P1X     , "0");
        SetDlgItemText(hwnd, DID_P1Y     , "0");
        SetDlgItemText(hwnd, DID_P2X     , "0");
        SetDlgItemText(hwnd, DID_P2Y     , "0");
        SetDlgItemText(hwnd, DID_P3X     , "0");
        SetDlgItemText(hwnd, DID_P3Y     , "0");
        SetDlgItemText(hwnd, DID_XSRC    , "0");
        SetDlgItemText(hwnd, DID_YSRC    , "0");
        SetDlgItemText(hwnd, DID_WIDTH   , "0");
        SetDlgItemText(hwnd, DID_HEIGHT  , "0");
        SetDlgItemText(hwnd, DID_XMASK   , "0");
        SetDlgItemText(hwnd, DID_YMASK   , "0");
    return TRUE;

    /**********************************************************************\
    *  WM_PUTUPLPOINTS
    *
    * wParam -  HDC with the needed world transform.
    * lParam -  Pointer to the track object.
    *
    * Fill the entry fields for the array of 3 dest parallelogram points.
    *  Conditionally change the first point depending on tracking mode.
    \**********************************************************************/
    case WM_PUTUPLPOINTS: {
        POINT p, origin;
        PTrackObject pto;
        HDC hdc;

        hdc = (HDC) wParam;
        pto = (PTrackObject) lParam;
        GetViewportOrgEx (hdc, &origin);

        if (pto->Mode & TMMOVE) {
          p.x = pto->rect.left;
          p.y = pto->rect.top;
          LPtoDP (pto->hdc, &p, 1);
          p.x -= origin.x; p.y -= origin.y;

          SetDlgItemInt(hwnd, DID_P1X, p.x, TRUE);
          SetDlgItemInt(hwnd, DID_P1Y, p.y, TRUE);

        }

        p.x = pto->rect.right;
        p.y = pto->rect.top;
        LPtoDP (pto->hdc, &p, 1);
        p.x -= origin.x; p.y -= origin.y;

        SetDlgItemInt(hwnd, DID_P2X, p.x, TRUE);
        SetDlgItemInt(hwnd, DID_P2Y, p.y, TRUE);

        p.x = pto->rect.left;
        p.y = pto->rect.bottom;
        LPtoDP (pto->hdc, &p, 1);
        p.x -= origin.x; p.y -= origin.y;
        SetDlgItemInt(hwnd, DID_P3X, p.x, TRUE);
        SetDlgItemInt(hwnd, DID_P3Y, p.y, TRUE);

    } return FALSE;

    /**********************************************************************\
    *  WM_PUTUPSRCRECT
    *
    * wParam -  HDC with the needed world transform.
    * lParam -  Pointer to the track object.
    *
    * Fill the entry fields for the source rectangle points.
    *  Conditionally change <x,y> or <width,height> depending on tracking mode.
    \**********************************************************************/
    case WM_PUTUPSRCRECT: {
        POINT p1,p2, origin;
        PTrackObject pto;
        HDC hdc;

        hdc = (HDC) wParam;
        pto = (PTrackObject) lParam;
        GetViewportOrgEx (hdc, &origin);

        p1.x = pto->rect.left;
        p1.y = pto->rect.top;
        LPtoDP (pto->hdc, &p1, 1);

        p2.x = pto->rect.right;
        p2.y = pto->rect.bottom;
        LPtoDP (pto->hdc, &p2, 1);
        p2.x -= p1.x; p2.y -= p1.y;

        p1.x -= origin.x; p1.y -= origin.y;

        if (!(pto->Mode & TMSIZEXY)) {
          SetDlgItemInt(hwnd, DID_XSRC, p1.x, TRUE);
          SetDlgItemInt(hwnd, DID_YSRC, p1.y, TRUE);
        }

        if (!(pto->Mode & TMMOVE)) {
          SetDlgItemInt(hwnd, DID_WIDTH,  p2.x, TRUE);
          SetDlgItemInt(hwnd, DID_HEIGHT, p2.y, TRUE);
        }
    } return FALSE;

    /**********************************************************************\
    *  WM_PUTUPMASKPT
    *
    * wParam -  HDC with the needed world transform.
    * lParam -  Pointer to the track object.
    *
    * Fill the entry fields for the mask location point.
    \**********************************************************************/
    case WM_PUTUPMASKPT: {
        POINT p1, origin;
        PTrackObject pto;
        HDC hdc;

        hdc = (HDC) wParam;
        pto = (PTrackObject) lParam;
        GetViewportOrgEx (hdc, &origin);

        p1.x = pto->rect.left;
        p1.y = pto->rect.top;
        LPtoDP (pto->hdc, &p1, 1);
        p1.x -= origin.x; p1.y -= origin.y;

        SetDlgItemInt(hwnd, DID_XMASK, p1.x, TRUE);
        SetDlgItemInt(hwnd, DID_YMASK, p1.y, TRUE);

    } return FALSE;

    /**********************************************************************\
    *  WM_COMMAND, DID_DRAW
    *
    * Draw button hit - send main window message to call PlgBlt().
    \**********************************************************************/
    case WM_COMMAND: {
      HBITMAP hbm;

      if (LOWORD(wParam) == DID_DRAW) {
          SendMessage (hwndMain, WM_PLGBLT, 0,0);

    /**********************************************************************\
    *  WM_COMMAND, DID_NEWSRC
    *
    * Try to get a new source bitmap.  Then
    *  invalidate two sub windows so that we force a repaint.
    \**********************************************************************/
      } else if (LOWORD(wParam) == DID_NEWSRC) {
        if ( hbm = GetBitmap (hdcSrc, hInst, FALSE)) {
          DeleteObject (hbmSrc);
          hbmSrc = hbm;
          InvalidateRect (hwndMain, &ptoSrc->rectClip, TRUE);
          InvalidateRect (hwndMain, &ptoDest->rectClip, TRUE);
        }

    /**********************************************************************\
    *  WM_COMMAND, DID_Mask
    *
    * Try to get a new mask bitmap.  Then
    *  invalidate two sub windows so that we force a repaint.
    \**********************************************************************/
      } else if (LOWORD(wParam) == DID_NEWMASK) {
        if ( hbm = GetBitmap (hdcMask,  hInst, TRUE)) {
          DeleteObject (hbmMask);
          hbmMask = hbm;
          InvalidateRect (hwndMain, &ptoMask->rectClip, TRUE);
          InvalidateRect (hwndMain, &ptoDest->rectClip, TRUE);
        }
      }

    } return FALSE; /* end WM_COMMAND */

  } /* end switch */
  return 0;
}

VOID DrawGrids | ( | HDC | ,
 |  | int | ,
 |  | int |
 | ) |  |

Definition at line 1268 of file PlgBlt.c.

{
int i;

    /* Draw vertical lines. Double at the axis */
    for (i = 0; i<= width; i+=TICKSPACE){
      MoveToEx (hdc, i, 0, NULL);
      LineTo (hdc, i, height);
    }
    MoveToEx (hdc, 1, 0, NULL);
    LineTo (hdc, 1, height);

    /* Draw horizontal lines. Double at the axis */
    for (i = 0; i<= height; i+=TICKSPACE){
      MoveToEx (hdc, 0,i, NULL);
      LineTo (hdc, width,i);
    }
    MoveToEx (hdc, 0, 1, NULL);
    LineTo (hdc, width,1);

  return;
}

LPTSTR GetStringRes ( int )

Definition at line 736 of file Generic.C.

{
  static TCHAR buffer[MAX_PATH];

  buffer[0]=0;
  LoadString (GetModuleHandle (NULL), id, buffer, MAX_PATH);
  return buffer;
}

LRESULT CALLBACK MainWndProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 3333 of file sdkdiff.cpp.

{
    char str[32];
    long ret;
    DWORD threadid;
  HRESULT hr;

    switch (message) {

        case WM_CREATE:

            /* initialise menu options to default/saved
             * option settings
             */

#define CHECKMENU(id, fChecked)  \
          CheckMenuItem(hMenu, (id), (fChecked) ? MF_CHECKED:MF_UNCHECKED)

            /* outline_include options */
            CHECKMENU(IDM_OUTLINE_INCSAME,   (outline_include & INCLUDE_SAME));
            CHECKMENU(IDM_OUTLINE_INCLEFT,   (outline_include & INCLUDE_LEFTONLY));
            CHECKMENU(IDM_OUTLINE_INCRIGHT,  (outline_include & INCLUDE_RIGHTONLY));
            CHECKMENU(IDM_OUTLINE_INCDIFFER, (outline_include & INCLUDE_DIFFER));

            /* expand_include options */
            CHECKMENU(IDM_EXPAND_INCSAME,         (expand_include & INCLUDE_SAME));
            CHECKMENU(IDM_EXPAND_INCLEFT,         (expand_include & INCLUDE_LEFTONLY));
            CHECKMENU(IDM_EXPAND_INCRIGHT,        (expand_include & INCLUDE_RIGHTONLY));
            CHECKMENU(IDM_EXPAND_INCMOVEDLEFT,    (expand_include & INCLUDE_MOVEDLEFT));
            CHECKMENU(IDM_EXPAND_INCMOVEDRIGHT,   (expand_include & INCLUDE_MOVEDRIGHT));
            CHECKMENU(IDM_EXPAND_INCSIMILARLEFT,  (expand_include & INCLUDE_SIMILARLEFT));
            CHECKMENU(IDM_EXPAND_INCSIMILARRIGHT, (expand_include & INCLUDE_SIMILARRIGHT));

            /* other options */
            CHECKMENU(line_numbers, TRUE);
            CHECKMENU(expand_mode, TRUE);
            CHECKMENU(IDM_IGNBLANKS, ignore_blanks);
            CHECKMENU(IDM_SHOWWHITESPACE, show_whitespace);
            CHECKMENU(IDM_ALG2, Algorithm2);
            CHECKMENU(IDM_MONOCOLS, mono_colours);
            CHECKMENU(IDM_PICTURE, picture_mode);
            CHECKMENU(IDM_HIDEMARK, hide_markedfiles);
#undef CHECKMENU

            /* nothing currently displayed */
            DisplayMode = MODE_NULL;

            break;

        case WM_SYSCOLORCHANGE:
            {
                HIGHCONTRAST hc;

                hc.cbSize = sizeof(hc);
                SystemParametersInfo(SPI_GETHIGHCONTRAST,0 ,&hc, 0);

                mono_colours = (hc.dwFlags & HCF_HIGHCONTRASTON);
                if (mono_colours) {
                    SetMonoColours();
                } else {
                    SetColours();
                }

                CheckMenuItem(hMenu, IDM_MONOCOLS,
                              mono_colours? MF_CHECKED:MF_UNCHECKED);
                hr = StringCchPrintf(str, 32, szD, mono_colours);
        if (FAILED(hr))
          OutputError(hr, IDS_SAFE_PRINTF);
                WriteProfileString(APPNAME, szMonoColours, str);
                SendMessage(hwndRCD, message, wParam, lParam);
                SendMessage(hwndStatus, message, wParam, lParam);
                SendMessage(hwndBar, message, wParam, lParam);

                /* The diffs are still valid, but force a re-display
                 * of bar window and main table.
                 */
                SendMessage(hwndBar, WM_COMMAND, IDM_MONOCOLS, 0);
                InvalidateRect(hwndBar, NULL, TRUE);
                view_changeviewoptions(current_view);
            }
            break;

        case WM_COMMAND:
            switch (GET_WM_COMMAND_ID(wParam, lParam)) {
                case IDM_EXIT:
                    if (ghThread!=NULL) {
                        bAbort = TRUE;
                        SetStatus(LoadRcString(IDS_ABORT_PENDING));
                        break;
                    }
                    if (!view_isexpanded(current_view)) {
                        /* save the current outline size and position */
                        WINDOWPLACEMENT wp;
                        wp.length = sizeof(wp);
                        if (GetWindowPlacement(hwndClient,&wp)) {
                            WriteProfileInt(APPNAME, szOutlineShowCmd, wp.showCmd);
                            WriteProfileInt(APPNAME, szOutlineMaxX, wp.ptMaxPosition.x);
                            WriteProfileInt(APPNAME, szOutlineMaxY, wp.ptMaxPosition.y);
                            WriteProfileInt(APPNAME, szOutlineNormLeft, wp.rcNormalPosition.left);
                            WriteProfileInt(APPNAME, szOutlineNormTop, wp.rcNormalPosition.top);
                            WriteProfileInt(APPNAME, szOutlineNormRight, wp.rcNormalPosition.right);
                            WriteProfileInt(APPNAME, szOutlineNormBottom, wp.rcNormalPosition.bottom);
                            WriteProfileInt(APPNAME, szOutlineSaved, 1);
                        }
                    } else {
                        /* save the current expanded size and position */
                        WINDOWPLACEMENT wp;
                        wp.length = sizeof(wp);
                        if (GetWindowPlacement(hwndClient,&wp)) {
                            WriteProfileInt(APPNAME, szExpandShowCmd, wp.showCmd);
                            WriteProfileInt(APPNAME, szExpandMaxX, wp.ptMaxPosition.x);
                            WriteProfileInt(APPNAME, szExpandMaxY, wp.ptMaxPosition.y);
                            WriteProfileInt(APPNAME, szExpandNormLeft, wp.rcNormalPosition.left);
                            WriteProfileInt(APPNAME, szExpandNormTop, wp.rcNormalPosition.top);
                            WriteProfileInt(APPNAME, szExpandNormRight, wp.rcNormalPosition.right);
                            WriteProfileInt(APPNAME, szExpandNormBottom, wp.rcNormalPosition.bottom);
                            WriteProfileInt(APPNAME, szExpandedSaved, 1);
                        }
                    }
                    DestroyWindow(hWnd);
                    break;

                case IDM_ABORT:
                    /* abort menu item, or status bar button.
                     * the status bar button text gives the appropriate
                     * action depending on our state - abort, outline
                     * or expand. But the command sent is always
                     * IDM_ABORT. Thus we need to check the state
                     * to see what to do. If we are busy, set the abort
                     * flag. If there is nothing to view,
                     * exit, otherwise switch outline<->expand
                     */
                    if (IsBusy()) {
                        bAbort = TRUE;
                        SetStatus(LoadRcString(IDS_ABORT_PENDING));
                    } else if (DisplayMode == MODE_NULL) {
                        DestroyWindow(hWnd);
                    } else if (DisplayMode == MODE_EXPAND) {
                        ToOutline(hWnd);
                    } else {
                        ToExpand(hWnd);
                    }
                    break;

                case IDM_FILE:
                    /* select two files and compare them */
                    if (SetBusy()) {

                        /* close the current view */
                        view_close(current_view);

                        /* make a new empty view */
                        current_view = view_new(hwndRCD);

                        /* make a COMPLIST using the files dialog,
                         * and notify the view
                         */
                        if (complist_filedialog(current_view) == NULL) {
                            view_close(current_view);
                        }

                        /* all done! */
                        SetNotBusy();
                    } else {
                        BusyError();
                    }
                    break;

                case IDM_DIR:

                    /* read two directory names, scan them and
                     * compare all the files and subdirs.
                     */
                    if (SetBusy()) {

                        /* close the current view */
                        view_close(current_view);

                        /* make a new empty view */
                        current_view = view_new(hwndRCD);

                        ghThread = CreateThread(NULL, 0, wd_dirdialog,
                                                (LPVOID) current_view, 0, &threadid);

                        if (ghThread == NULL)
                        {

                            /*
                             * either we are on WIN16, or the
                             * thread call failed. continue
                             * single-threaded.
                             */
                            wd_dirdialog( (LPVOID) current_view);

                        }

                    } else {
                        BusyError();
                    }
                    break;

                case IDM_CLOSE:
                    /* close the output list -
                     * discard all results so far
                     */
                    if (!IsBusy()) {
                        view_close(current_view);
                    }
                    break;

                case IDM_PRINT:
                    /* print the current view -
                     * either the outline list of filenames,
                     * or the currently expanded file.
                     */
                    if (!IsBusy()) {
                        DoPrint();
                    } else {
                        BusyError();
                    }
                    break;

                case IDM_TIME:
                    /* show time it took */
                    {       char msg[50];
                        DWORD tim;
                        if (IsBusy()) {
                            BusyError();
                        } else {
                            tim = complist_querytime();
                            hr = StringCchPrintf(msg, 50, LoadRcString(IDS_SECONDS), tim/1000, tim%1000);
              if (FAILED(hr))
                OutputError(hr, IDS_SAFE_PRINTF);
                            Trace_Status(msg);
                        }
                    }
                    break;

                case IDM_TRACE:
                    /* enable tracing */
                    bTrace = TRUE;
                    Trace_Status(LoadRcString(IDS_TRACING_ENABLED));
                    break;

                case IDM_TRACEOFF:
                    /* enable tracing */
                    bTrace = FALSE;
                    Trace_Status(LoadRcString(IDS_TRACING_DISABLED));
                    break;

                case IDM_SAVELIST:
                    /* allow user to save list of same/different files
                     * to a text file. dialog box to give filename
                     * and select which types of file to include
                     */
                    if (current_view == NULL) {
                        MessageBox(hWnd,
                                   LoadRcString(IDS_CREATE_DIFF_LIST),
                                   szSdkDiff, MB_OK|MB_ICONSTOP);
                        break;
                    }

                    complist_savelist(view_getcomplist(current_view), NULL, outline_include);
                    break;

                case IDM_COPYFILES:
                    /*
                     * copy files that are same/different to a new
                     * root directory. dialog box allows user
                     * to select new root and inclusion options
                     */
                    if (current_view == NULL) {
                        MessageBox(hWnd,
                                   LoadRcString(IDS_CREATE_DIFF_LIST),
                                   szSdkDiff, MB_OK|MB_ICONSTOP);
                        break;
                    }

                    if (SetBusy()) {
                        ghThread = CreateThread(NULL, 0, wd_copy,
                                                (LPVOID) current_view, 0, &threadid);
                        if (ghThread == NULL)
                        {
                            wd_copy( (LPVOID) current_view);
                        }

                    } else {
                        BusyError();
                    }

                    break;

                case IDM_ABOUT:
                    ShellAbout( hWnd,
                                (LPTSTR)szSdkDiff,
                                LoadRcString(IDS_TOOL_DESCRIPTION),
                                LoadIcon(hInst, szSdkDiff)
                              );
                    break;

                case IDM_CONTENTS:
                    /* Help contents */
          TCHAR pszHelp[MAX_PATH];
          memset(pszHelp, 0, MAX_PATH);
          hr = StringCchCopy(pszHelp, MAX_PATH, pszWorkingDirectoryName);
          if (FAILED(hr))
            OutputError(hr, IDS_SAFE_COPY);
          hr = StringCchCat(pszHelp, MAX_PATH, "sdkdiff.hlp");
          if (FAILED(hr))
            OutputError(hr, IDS_SAFE_CAT);
          WinHelp(hWnd, pszHelp, HELP_INDEX, 0);
                    break;

                    /* launch an editor on the current item - left, right or
                     * composite view
                     */
                case IDM_EDITLEFT:
                    do_editthread(current_view, CI_LEFT);
                    break;

                case IDM_EDITRIGHT:
                    do_editthread(current_view, CI_RIGHT);
                    break;

                case IDM_EDITCOMP:
                    {
                        COMPITEM item = view_getitem(current_view, selection);
                        FILEDATA fdLeft;
                        FILEDATA fdRight;

                        fdLeft = compitem_getleftfile(item);
                        fdRight = compitem_getrightfile(item);
                        if ((fdLeft && file_IsUnicode(fdLeft)) || (fdRight && file_IsUnicode(fdRight))) {
                            MessageBox(hWnd, LoadRcString(IDS_NOCOMPUNICODE),
                                       szSdkDiff, MB_OK);
                        } else {
                            do_editthread(current_view, CI_COMP);
                        }
                    }
                    break;

                    /* allow customisation of the editor command line */
                case IDM_SETEDIT:
                    if (StringInput(editor_cmdline, sizeof(editor_cmdline),
                                    LoadRcString(IDS_EDITOR_COMMAND),
                                    (LPSTR)szSdkDiff, editor_cmdline)) {
                        WriteProfileString(APPNAME, szEditor,
                                           editor_cmdline);
                    }
                    break;

                case IDM_SETTABWIDTH:
                    {
                        char sz[32];
                        int n;

LTabWidth_tryagain:
                        hr = StringCchPrintf(sz, 32, "%d", g_tabwidth);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        if (StringInput(sz, sizeof(sz),
                                        LoadRcString(IDS_TABWIDTH),
                                        (LPSTR)szSdkDiff, sz))
                        {
                            n = atoi(sz);
                            if (n <= 0 || n > 100)
                            {
                                MessageBox(hWnd,
                                           LoadRcString(IDS_BAD_TABWIDTH),
                                           szSdkDiff, MB_OK);
                                goto LTabWidth_tryagain;
                            }
                            WriteProfileInt(APPNAME, szTabWidth, n);
                            g_tabwidth = n;
                            SendMessage(hwndRCD, TM_SETTABWIDTH, 0, n);
                        }
                    }
                    break;

                case IDM_TABWIDTH4:
                case IDM_TABWIDTH8:
                    g_tabwidth = (GET_WM_COMMAND_ID(wParam, lParam) == IDM_TABWIDTH8) ? 8 : 4;
                    SendMessage(hwndRCD, TM_SETTABWIDTH, 0, g_tabwidth);
                    break;

                case IDM_SETFONT:
                    {
                        CHOOSEFONT cf;
                        LOGFONT lf;
                        char szFace[LF_FACESIZE];

                        hr = StringCchCopy(szFace, LF_FACESIZE, g_szFontFaceName);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_COPY);

                        memset(&lf, 0, sizeof(lf));
                        hr = StringCchCopy(lf.lfFaceName, LF_FACESIZE, szFace);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_COPY);
                        lf.lfWeight = g_fFontBold ? FW_BOLD : FW_DONTCARE;
                        lf.lfHeight = g_nFontHeight;
                        lf.lfCharSet = g_bFontCharSet;

                        memset(&cf, 0, sizeof(cf));
                        cf.lStructSize = sizeof(CHOOSEFONT);
                        cf.hwndOwner = hWnd;
                        cf.lpLogFont = &lf;
                        cf.Flags = CF_INITTOLOGFONTSTRUCT|CF_FORCEFONTEXIST|
                                CF_SCREENFONTS|CF_LIMITSIZE;
                        cf.nSizeMin = 8;
                        cf.nSizeMax = 36;
                        cf.lpszStyle = szFace;
                        if (ChooseFont(&cf))
                            {
                            hr = StringCchCopy(g_szFontFaceName, LF_FACESIZE, lf.lfFaceName);
              if (FAILED(hr))
                OutputError(hr, IDS_SAFE_COPY);
                            g_fFontBold = (lf.lfWeight == FW_BOLD);
                            g_nFontHeight = lf.lfHeight;
                            g_bFontCharSet = lf.lfCharSet;

                            WriteProfileString(APPNAME, szFontFaceName, g_szFontFaceName);
                            WriteProfileInt(APPNAME, szFontHeight, g_nFontHeight);
                            WriteProfileInt(APPNAME, szFontBold, g_fFontBold);
                            WriteProfileInt(APPNAME, szFontCharSet, g_bFontCharSet);

                            GetFontPref();

                            view_changeviewoptions(current_view);
                            }
                    }
                    break;

                case IDM_LNRS:
                case IDM_RNRS:
                case IDM_NONRS:

                    /* option selects whether the line nrs displayed
                     * in expand mode are the line nrs in the left
                     * file, the right file or none
                     */

                    CheckMenuItem(GetMenu(hWnd),
                                  line_numbers, MF_UNCHECKED);
                    line_numbers = GET_WM_COMMAND_ID(wParam, lParam);
                    CheckMenuItem(GetMenu(hWnd), line_numbers, MF_CHECKED);
                    hr = StringCchPrintf(str, 32, szD, line_numbers);
          if (FAILED(hr))
            OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szLineNumbers, str);

                    /* change the display to show the line nr style
                     * chosen
                     */

                    view_changeviewoptions(current_view);
                    break;

                /*
                 * options selecting which lines to include in the
                 * expand listing, based on their state
                 */
                case IDM_EXPAND_INCSAME:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_SAME;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCSAME,
                              (expand_include & INCLUDE_SAME) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCLEFT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_LEFTONLY;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCLEFT,
                              (expand_include & INCLUDE_LEFTONLY) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCRIGHT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_RIGHTONLY;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCRIGHT,
                              (expand_include & INCLUDE_RIGHTONLY) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCMOVEDLEFT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_MOVEDLEFT;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCMOVEDLEFT,
                              (expand_include & INCLUDE_MOVEDLEFT) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCMOVEDRIGHT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_MOVEDRIGHT;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCMOVEDRIGHT,
                              (expand_include & INCLUDE_MOVEDRIGHT) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCSIMILARLEFT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_SIMILARLEFT;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCSIMILARLEFT,
                              (expand_include & INCLUDE_SIMILARLEFT) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCSIMILARRIGHT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_SIMILARRIGHT;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCSIMILARRIGHT,
                              (expand_include & INCLUDE_SIMILARRIGHT) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                    /*
                     * options selecting which files to include in the
                     * outline listing, based on their state
                     */
                case IDM_OUTLINE_INCLEFT:

                    /* toggle flag in outline_include options */
                    outline_include ^= INCLUDE_LEFTONLY;

                    /* check/uncheck as necessary */
                    CheckMenuItem(hMenu, IDM_OUTLINE_INCLEFT,
                                  (outline_include & INCLUDE_LEFTONLY) ?
                                  MF_CHECKED:MF_UNCHECKED);

                    hr = StringCchPrintf(str, 32, szD, outline_include);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szFileInclude, str);
                    view_changeviewoptions(current_view);

                    break;

                case IDM_OUTLINE_INCRIGHT:

                    outline_include ^= INCLUDE_RIGHTONLY;

                    CheckMenuItem(hMenu, IDM_OUTLINE_INCRIGHT,
                                  (outline_include & INCLUDE_RIGHTONLY) ?
                                  MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, outline_include);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szFileInclude, str);
                    view_changeviewoptions(current_view);

                    break;

                case IDM_OUTLINE_INCSAME:

                    outline_include ^= INCLUDE_SAME;

                    CheckMenuItem(hMenu, IDM_OUTLINE_INCSAME,
                                  (outline_include & INCLUDE_SAME) ?
                                  MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, outline_include);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szFileInclude, str);
                    view_changeviewoptions(current_view);

                    break;

                case IDM_OUTLINE_INCDIFFER:

                    outline_include ^= INCLUDE_DIFFER;

                    CheckMenuItem(hMenu, IDM_OUTLINE_INCDIFFER,
                                  (outline_include & INCLUDE_DIFFER) ?
                                  MF_CHECKED:MF_UNCHECKED);

                    hr = StringCchPrintf(str, 32, szD, outline_include);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szFileInclude, str);
                    view_changeviewoptions(current_view);

                    break;

                case IDM_UPDATE:
                    OnUpdate( (COMPITEM) lParam);
                    break;

                case IDM_RESCAN:
                    RescanFile(hWnd);

                    /* do we need to force any repaints? */
                    // - no, as RescanFile sends a IDM_UPDATE
                    break;

                case IDM_LONLY:
                case IDM_RONLY:
                case IDM_BOTHFILES:
                    /* option selects whether the expanded file
                     * show is the combined file, or just one
                     * or other of the input files.
                     *
                     * if we are not in expand mode, this also
                     * causes us to expand the selection
                     */

                    CheckMenuItem(GetMenu(hWnd), expand_mode, MF_UNCHECKED);
                    expand_mode = GET_WM_COMMAND_ID(wParam, lParam);
                    CheckMenuItem(GetMenu(hWnd), expand_mode, MF_CHECKED);

                    /* change the current view to show only the lines
                     * of the selected type.
                     */
                    if (DisplayMode == MODE_OUTLINE) {
                        ToExpand(hWnd);
                    } else {
                        view_changeviewoptions(current_view);
                    }

                    break;

                case IDM_IGNBLANKS:

                    /* if selected, ignore all spaces and tabs on
                     * comparison - expand view only: outline view
                     * will still show that 'text files differ'
                     */

                    ignore_blanks = !ignore_blanks;
                    CheckMenuItem(hMenu, IDM_IGNBLANKS,
                                  ignore_blanks? MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, ignore_blanks);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szBlanks, str);

                    /* invalidate all diffs since we have
                     * changed diff options, and re-do and display the
                     * current diff if we are in expand mode.
                     */
                    view_changediffoptions(current_view);

                    /* force repaint of bar window */
                    InvalidateRect(hwndBar, NULL, TRUE);

                    break;

                case IDM_SHOWWHITESPACE:

                        /* if selected, display all spaces and tabs in
                           the expanded text view */
                        show_whitespace = !show_whitespace;
                        CheckMenuItem(hMenu, IDM_SHOWWHITESPACE,
                                show_whitespace ? MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, show_whitespace);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szShowWhitespace, str);

                        // change the current view to show only the lines
                        // of the selected type.
                        if (DisplayMode == MODE_EXPAND) {
                                view_changeviewoptions(current_view);
                        }

                        break;

                case IDM_ALG2:

                    /* if selected, do algorithm2 which does not accept
                     * unsafe matches.
                     */

                    Algorithm2 = !Algorithm2;
                    CheckMenuItem(hMenu, IDM_ALG2,
                                  Algorithm2? MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, Algorithm2);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szAlgorithm2, str);

                    /* invalidate all diffs since we have
                     * changed diff options, and re-do and display the
                     * current diff if we are in expand mode.
                     */
                    view_changediffoptions(current_view);

                    /* force repaint of bar window */
                    InvalidateRect(hwndBar, NULL, TRUE);

                    break;

                case IDM_MONOCOLS:

                    /* Use monochrome colours - toggle */

                    mono_colours = !mono_colours;
                    CheckMenuItem(hMenu, IDM_MONOCOLS,
                                  mono_colours? MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, mono_colours);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szMonoColours, str);
                    if (mono_colours)
                        SetMonoColours();
                    else
                        SetColours();

                    /* The diffs are still valid, but force a re-display
                     * of bar window and main table.
                     */
                    SendMessage(hwndBar, WM_COMMAND, IDM_MONOCOLS, 0);
                    InvalidateRect(hwndBar, NULL, TRUE);
                    view_changeviewoptions(current_view);

                    break;

                case IDM_PICTURE:
                    picture_mode = !picture_mode;
                    CheckMenuItem(hMenu, IDM_PICTURE,
                                  picture_mode? MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, picture_mode);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szPicture, str);
                    DoResize(hWnd);
                    break;

                case IDM_HIDEMARK:
                    // toggle state of marked files hidden or not
                    hide_markedfiles = !hide_markedfiles;
                    CheckMenuItem(hMenu, IDM_HIDEMARK,
                                  hide_markedfiles? MF_CHECKED : MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, hide_markedfiles);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szHideMark, str);

                    // rebuild view with new global option
                    // - note that marks only affect outline views
                    if (!view_isexpanded(current_view)) {
                        view_changeviewoptions(current_view);
                    }
                    break;

                case IDM_FIND:
                  {
                  int nRet = IDCANCEL;
                  DLGPROC lpProc = (DLGPROC) MakeProcInstance((WINPROCTYPE) FindDlgProc, hInst);
                  if (lpProc)
                    {
                    char *pszFind = NULL;
                    sdkdiff_UI(TRUE);
                    nRet = (BOOL) DialogBoxParam(hInst, (LPCTSTR) IDD_FIND, hwndClient, lpProc, 0L);
                    sdkdiff_UI(FALSE);
                    FreeProcInstance(lpProc);
                    }
                  }
                  break;

                case IDM_FINDNEXT:
                  {
                  const LONG iCol = (view_isexpanded(current_view)) ? 2 : 1;
                  FindString(hWnd, iCol, NULL, 1, 0);
                  break;
                  }

                case IDM_FINDPREV:
                  {
                  const LONG iCol = (view_isexpanded(current_view)) ? 2 : 1;
                  FindString(hWnd, iCol, NULL, -1, 0);
                  break;
                  }

                case IDM_GOTOLINE:
                  {
                  if (!view_getrowcount(current_view))
                    {
                    MessageBox(hWnd, LoadRcString(IDS_GOTOLINE_NOLINES), szSdkDiff, MB_OK|MB_ICONSTOP|MB_TASKMODAL);
                    }
                  else
                    {
                    DLGPROC lpProc = (DLGPROC) MakeProcInstance((WINPROCTYPE)GoToLineDlgProc, hInst);
                    if (lpProc)
                      {
                      sdkdiff_UI(TRUE);
                      DialogBoxParam(hInst, (LPCTSTR) IDD_GOTOLINE, hwndClient, lpProc, 0L);
                      sdkdiff_UI(FALSE);
                      FreeProcInstance(lpProc);
                      }
                    }
                  }
                  break;

                case IDM_EDITCOPY:
                    {
                        unsigned long cb = 0;
                        LPCSTR pszText = NULL;
                        long iRow = 0;
                        const BOOL fOutline = !view_isexpanded(current_view);

                        /* first count total data size */
                        for (iRow = 0; iRow < selection_nrows; iRow++) {
                            if (fOutline) {
                                pszText = view_gettext(current_view, selection + iRow, 1);
                                if (!pszText)
                                    break;
                                cb += (lstrlen(pszText) + 3) * sizeof(char);
                            }

                            pszText = view_gettext(current_view, selection + iRow, 2);
                            if (!pszText)
                                break;
                            cb += (lstrlen(pszText)) * sizeof(char);
                        }

                        if (cb && OpenClipboard(NULL)) {
                            /* space for trailing nul char */
                            cb++;

                            /* copy data to clipboard */
                            if (EmptyClipboard()) {
                                HGLOBAL hData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,  cb);

                                if (hData) {
                                    void *pv = hData;
                                    if (!pv) {
                                        HeapFree(GetProcessHeap(), NULL, hData);
                                    }
                                    else {
                                        LPSTR pszBuf = (LPSTR) pv;
                                        memset(pv, 0, cb);

                                        for (iRow = 0; iRow < selection_nrows; iRow++) {
                                            if (fOutline) {
                                                pszText = view_gettext(current_view, selection + iRow, 1);
                                                if (!pszText)
                                                    break;

                                                hr = StringCchCopy(pszBuf, cb, pszText);
                        if (FAILED(hr))
                          OutputError(hr, IDS_SAFE_COPY);
                                                pszBuf += lstrlen(pszBuf);
                                                *(pszBuf++) = '\t';
                                                *pszBuf = 0;
                                            }

                                            pszText = view_gettext(current_view, selection + iRow, 2);
                                            if (!pszText)
                                                break;

                                            hr = StringCchCopy(pszBuf, cb, pszText);
                      if (FAILED(hr))
                        OutputError(hr, IDS_SAFE_COPY);
                                            pszBuf += lstrlen(pszBuf);

                                            if (fOutline) {
                                                *(pszBuf++) = '\r';
                                                *(pszBuf++) = '\n';
                                                *pszBuf = 0;
                                            }
                                        }

                                        SetClipboardData(CF_TEXT, hData);
                                    }
                                }
                            }
                            CloseClipboard();
                        }
                    }
                    break;

                case IDM_MARK:
                    {
                        BOOL bChanged = FALSE;
                        int i;

                        // toggle the mark on the current selection
                        // note that the selection could be multiple rows
                        for (i = 0; i < selection_nrows; i++) {

                            if (view_setmarkstate(current_view, selection + i,
                                                  !view_getmarkstate(current_view, selection + i))) {

                                bChanged = TRUE;
                            }
                        }

                        if (bChanged) {
                            // yes the mark state was changed - need
                            // to rebuild the view.
                            if (!view_isexpanded(current_view)) {
                                view_changeviewoptions(current_view);
                            }
                        }
                        break;
                    }

                case IDM_TOGGLEMARK:
                    // toggle the state of all files: unmark all
                    // marked files and vice versa
                    complist_togglemark(view_getcomplist(current_view));

                    // rebuild view
                    if (!view_isexpanded(current_view)) {
                        view_changeviewoptions(current_view);
                    }
                    break;

                case IDM_MARKPATTERN:
                    // dialog to query the pattern, then set a mark on
                    // all compitems whose title matches that pattern
                    // returns TRUE if anything was changed
                    if (complist_markpattern(view_getcomplist(current_view))) {

                        // rebuild view
                        if (!view_isexpanded(current_view)) {
                            view_changeviewoptions(current_view);
                        }
                    }
                    break;

                case IDM_EXPAND:

                    /* show the expanded view of the
                     * selected file
                     */
                    if (current_view != NULL) {
                        ToExpand(hWnd);
                    }

                    break;

                case IDM_OUTLINE:
                    /* return to the outline view (list of filenames) */
                    ToOutline(hWnd);

                    break;

                case IDM_FCHANGE:
                    /* find the next line in the current view
                     * that is not the same in both files -
                     * in outline view, finds the next filename that
                     * is not identical
                     */
                    FindNextChange();
                    break;

                case IDM_FPCHANGE:
                    /* same as IDM_FCHANGE, but going backwards from
                     * current position
                     */
                    FindPrevChange();
                    break;

                case IDM_FCHANGE_LAURIE:
                    /* same as IDM_FCHANGE, but tries to keep cursor on same
                     * line.
                     */
                    _FindNextChange(TRUE, FALSE);
                    break;

                case IDM_FPCHANGE_LAURIE:
                    /* same as IDM_FPCHANGE, but tries to keep cursor on same
                     * line.
                     */
                    _FindPrevChange(TRUE, FALSE);
                    break;

                    // given a line that has been moved, jump to the
                    // other representation of the same line.
                    // this used to be available just through double-click
                    // but now is also available from a context menu
                case IDM_TOMOVED:
                    ToMoved(hWnd, TRUE);
                    break;
            }
            break;

        case WM_SIZE:
            DoResize(hWnd);
            break;

        case WM_SETFOCUS:
            /* set the focus on the table class so it can process
             * page-up /pagedown keys etc.
             */
            SetFocus(hwndRCD);
            break;

        case WM_KEYDOWN:
            /* although the table window has the focus, he passes
             * back to us any keys he doesn't understand
             * We handle escape here to mean 'return to outline view'
             */
            if (wParam == VK_ESCAPE) {
                ToOutline(hWnd);
            } else if (wParam == VK_APPS) {
                // Handle the context menu keyboard key
                POINT posCursor;
                GetCursorPos(&posCursor);
                ScreenToClient(hwndRCD, &posCursor);
                OnRightClick(hWnd, posCursor.x, posCursor.y);
            }
            break;

        case WM_RBUTTONDOWN:
            /*
             * the table window handles this by performing the
             * selection and then passing the message to us, allowing
             * us to put up a context menu.
             */
            OnRightClick(hWnd, LOWORD(lParam), HIWORD(lParam));
            break;

        case WM_CLOSE:
            SendMessage(hWnd, WM_COMMAND, IDM_EXIT, 0);
            return TRUE;

            /* don't allow close when busy - process this message in
             * order to ensure this
             */
            break;

        case WM_DESTROY:
      TCHAR pszHelp[MAX_PATH];
      memset(pszHelp, 0, MAX_PATH);
      hr = StringCchCopy(pszHelp, MAX_PATH, pszWorkingDirectoryName);
      if (FAILED(hr))
        OutputError(hr, IDS_SAFE_COPY);
      hr = StringCchCat(pszHelp, MAX_PATH, "sdkdiff.hlp");
      if (FAILED(hr))
        OutputError(hr, IDS_SAFE_COPY);
            DeleteTools();
            WinHelp(hWnd, pszHelp, HELP_QUIT, 0);
            PostQuitMessage(0);
            break;

        case TM_CURRENTVIEW:
            /* allow other people such as the bar window to query the
             * current view
             */
            return((INT_PTR) current_view);

#ifdef LATER
#ifdef WM_MOUSEWHEEL
        case WM_MOUSEWHEEL:
            if (LOWORD(wParam) & MK_MBUTTON) {
                if ((short)HIWORD(wParam) < 0) {
                    // The next occurence
                    _FindNextChange(FALSE, TRUE);
                }
                else {
                    _FindPrevChange(FALSE, TRUE);
                }
            }
            break;
#endif
#endif

        case WM_QUERYENDSESSION:
            if (IsBusy())
                return FALSE;
            return TRUE;

        case WM_ENDSESSION:
            SendMessage(hWnd, WM_CLOSE, 0, 0);
            break;

        default:
            /* handle registered table messages */
            if (message == table_msgcode) {
                ret = TableServer(hWnd, wParam, lParam);
                return(ret);
            }
            return(DefWindowProc(hWnd, message, wParam, lParam));
    }
    return(0);
}

Generated on Wed Nov 13 2024 16:53:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/WinNT/PlgBlt/Track.c File Reference

  • Multimedia
  • Gdi
  • WinNT
  • PlgBlt
Defines | Functions

Track.c File Reference

#include <windows.h>
#include <math.h>
#include "track.h"

Go to the source code of this file.

Defines

#define | EPSILON (float) 0.0001
#define | RECTSIZE 60

Functions

PTrackObject | doTrackObject (PTrackObject pto, int msg, HWND hwnd, LONG_PTR lParam)
VOID | MouseMove (PTrackObject pto, int msg, HWND hwnd, LONG_PTR lParam)

Define Documentation

#define EPSILON (float) 0.0001

Definition at line 20 of file Track.c.

#define RECTSIZE 60

Definition at line 21 of file Track.c.

Function Documentation

PTrackObject doTrackObject | ( | PTrackObject | pto,
 |  | int | msg,
 |  | HWND | hwnd,
 |  | LONG_PTR | lParam
 | ) |  |

Definition at line 54 of file Track.c.

{
  if ((pto == NULL) && (msg != TROB_NEW))  return NULL;

  switch (msg) {

    /**********************************************************************\
    *  TROB_NEW
    *
    * Allocate new PTrackObject structure.  Fill in default values
    *  for the fields of the structure.  Set up the HDC correctly.
    * return - pointer to the new object.
    \**********************************************************************/
    case  TROB_NEW: {
        PTrackObject  pto;

        /* with LPTR returned value is a pointer. */
        pto = (PTrackObject) LocalAlloc (LPTR, sizeof (TrackObject));
    if (!pto) return NULL;    /* failed to create track object*/

        /* initialize the HDC and other fields. */
        pto->hdc = GetDC (hwnd);
        SetGraphicsMode (pto->hdc, GM_ADVANCED);
        SetROP2(pto->hdc, R2_NOT);
        SelectObject (pto->hdc, GetStockObject (NULL_BRUSH));
        pto->Mode = TMNONE;
        pto->allowedModes = TMMOVE | TMSIZEXY;

        GetWorldTransform (pto->hdc, &(pto->xfmChange));

        /* initialize the size. */
        pto->rect.top = pto->rect.left = 0;
        pto->rect.bottom = pto->rect.right = RECTSIZE;

        return (pto);
    }

    /**********************************************************************\
    *  TROB_DELETE
    *
    * Complement of TROB_NEW.  Free up the memory allocated for the object.
    \**********************************************************************/
    case  TROB_DELETE:
        doTrackObject (pto, TROB_PAINT, hwnd, lParam);
        ReleaseDC (hwnd, pto->hdc);
        LocalFree (LocalHandle ((LPSTR)pto));
    return NULL;

    /**********************************************************************\
    *  TROB_PAINT
    *
    * Paint the object into its hdc.  Called half the time to erase
    *  the object, and half the time to redraw it.
    \**********************************************************************/
    case TROB_PAINT: {
        MoveToEx (pto->hdc, pto->rect.right, pto->rect.top, NULL);
        LineTo (pto->hdc,  pto->rect.left, pto->rect.top);
        LineTo (pto->hdc,  pto->rect.left, pto->rect.bottom);

        if (pto->allowedModes & TMSIZEXY) {
          LineTo (pto->hdc,  pto->rect.right, pto->rect.bottom);
          LineTo (pto->hdc,  pto->rect.right, pto->rect.top);
        }

        if (pto->allowedModes & TMROTATE) {
          MoveToEx (pto->hdc, pto->rect.left, pto->rect.bottom/ 4, NULL);
          AngleArc (pto->hdc, pto->rect.left, pto->rect.top,
                 (DWORD) pto->rect.bottom/ 4, (float) 270.0, (float) 90.0);
        }

    } return NULL;

    /**********************************************************************\
    *  TROB_HITTEST
    *
    * Check the point sent in in the lParam to see if it lays within
    *  the bounds of the objects defining rectangle.
    * return - pointer to the object iff the point is in rectangle,
    *  otherwise return NULL.
    \**********************************************************************/
    case TROB_HITTEST:{
        POINT  mouWorld;
        mouWorld.x = LOWORD(lParam);
        mouWorld.y = HIWORD(lParam);

        DPtoLP (pto->hdc, &mouWorld, 1);

        if (PtInRect (&pto->rect, mouWorld))  return pto;
        else  return NULL;
    }

    /**********************************************************************\
    *  WM_LBUTTONDOWN &  WM_RBUTTONDOWN
    *
    * Capture the mouse, set the tracking mode depending on the mouse
    *  location in world coordinates, reset the mouse position.
    *
    \**********************************************************************/
    case WM_LBUTTONDOWN:
    case WM_RBUTTONDOWN: {
      POINT  newmouScreen;
      POINT  mouWorld;

      mouWorld.x = LOWORD(lParam);
      mouWorld.y = HIWORD(lParam);
      DPtoLP (pto->hdc, &mouWorld, 1);

      /* upper left hand corner. right button is no-op. */
      if ((mouWorld.x <= (pto->rect.right  / 2)) &&
          (mouWorld.y <= (pto->rect.bottom / 2))) {
          if (msg == WM_RBUTTONDOWN) return NULL;
          pto->Mode = TMMOVE;
          newmouScreen.x = pto->rect.left;
          newmouScreen.y = pto->rect.top;

      /* lower left hand corner */
      } else if ((mouWorld.x <= (pto->rect.right  / 2)) &&
          (mouWorld.y > (pto->rect.bottom / 2))) {

          pto->Mode = (msg == WM_RBUTTONDOWN) ? TMSHEARY : TMSIZEY;
          newmouScreen.x = pto->rect.left;
          newmouScreen.y = pto->rect.bottom;

      /* upper right hand corner */
      } else if ((mouWorld.x > (pto->rect.right  / 2)) &&
          (mouWorld.y <= (pto->rect.bottom / 2))) {

          pto->Mode = (msg == WM_RBUTTONDOWN) ? TMSHEARX : TMSIZEX;
          newmouScreen.x = pto->rect.right;
          newmouScreen.y = pto->rect.top;

      /* lower right hand corner */
      } else if ((mouWorld.x > (pto->rect.right  / 2)) &&
          (mouWorld.y > (pto->rect.bottom / 2))) {

          pto->Mode = (msg == WM_RBUTTONDOWN) ? TMROTATE : TMSIZEXY;
          newmouScreen.x = pto->rect.right;
          newmouScreen.y = pto->rect.bottom;
      }

      if (! (pto->Mode & pto->allowedModes)) {
        pto->Mode = TMNONE;
        return NULL;
      }

      SetCapture(hwnd);
      LPtoDP (pto->hdc, &newmouScreen, 1);
      ClientToScreen (hwnd, &newmouScreen);
      SetCursorPos (newmouScreen.x,newmouScreen.y);

      GetWorldTransform (pto->hdc, &pto->xfmDown);
    } return NULL;

    /**********************************************************************\
    *  WM_MOUSEMOVE
    *
    * this is where almost all of the interesting calculation is done.
    *  First clip the mouse location to be in rectClip, then
    *  call MouseMove() to handle the different tracking modes.
    \**********************************************************************/
    case WM_MOUSEMOVE: {
      if ((short) LOWORD(lParam) < (short)pto->rectClip.left)
        lParam = MAKELONG ((WORD)pto->rectClip.left, HIWORD(lParam));

      if (LOWORD(lParam) > (WORD)pto->rectClip.right)
        lParam = MAKELONG ((WORD)pto->rectClip.right, HIWORD(lParam));

      if ((short) HIWORD(lParam) < (short)pto->rectClip.top)
        lParam = MAKELONG (LOWORD(lParam), (WORD)pto->rectClip.top);

      if (HIWORD(lParam) > (WORD)pto->rectClip.bottom)
        lParam = MAKELONG (LOWORD(lParam),(WORD)pto->rectClip.bottom);

      MouseMove (pto, msg, hwnd, lParam);

    } return NULL;

    /**********************************************************************\
    *  WM_RBUTTONUP & WM_LBUTTONUP
    *
    * simply release the mouse capture, and set the mode to TMNONE.
    \**********************************************************************/
    case WM_RBUTTONUP:
    case WM_LBUTTONUP: {
      if (pto->Mode) {
         ReleaseCapture();
         pto->Mode = TMNONE;
      }
    } return NULL;

  }  /* end switch(msg) */

  return NULL;  /* exercise all possible paths */
}

VOID MouseMove | ( | PTrackObject | pto,
 |  | int | msg,
 |  | HWND | hwnd,
 |  | LONG_PTR | lParam
 | ) |  |

Definition at line 299 of file Track.c.

{
POINT  mouWorld, mouDevice, orgDevice;

    UNREFERENCED_PARAMETER(msg);

    doTrackObject(pto, TROB_PAINT, hwnd, lParam);
    mouDevice.x = mouWorld.x = LOWORD(lParam);
    mouDevice.y = mouWorld.y = HIWORD(lParam);

    SetWorldTransform(pto->hdc, &pto->xfmDown);
    DPtoLP (pto->hdc, &mouWorld, 1);

    /* offset the mouse device point for the viewport's origin. */
    GetViewportOrgEx (pto->hdc, &orgDevice);
    mouDevice.x -= orgDevice.x;
    mouDevice.y -= orgDevice.y;

    GetWorldTransform(pto->hdc, &pto->xfmChange);

    switch (pto->Mode) {
      /*******************************************************\
      *    (     1         xShear       0   )
      *    (     0           1          0   )
      *    (     0           0          1   )
      *
      * xWorld = rect.left == 0;
      \*******************************************************/
      case TMSHEARX: {
        pto->xfmChange.eM12 = (float) mouDevice.y;
        pto->xfmChange.eM12 -=pto->xfmChange.eDy;
        pto->xfmChange.eM12 /=(float) pto->rect.right ;
        SetWorldTransform (pto->hdc, &pto->xfmChange);
      } break;

      /*******************************************************\
      *    (     1           0          0   )
      *    (   yShear        1          0   )
      *    (     0           0          1   )
      *
      * yWorld = rect.top == 0;
      \*******************************************************/
      case TMSHEARY: {
        pto->xfmChange.eM21 = (float) mouDevice.x;
        pto->xfmChange.eM21 -=pto->xfmChange.eDx;
        pto->xfmChange.eM21 /=(float) pto->rect.bottom ;
        SetWorldTransform (pto->hdc, &pto->xfmChange);

      } break;

      /*******************************************************\
      *    (   cos(a)      -sin(a)      0   )
      *    (   sin(a)       cos(a)      0   )
      *    (     0           0          1   )
      *
      * a == rotation angle.  Since mouse in in lower right,
      *  we need to shift this back 45 degrees (assuming that
      *  straight down is 0 degrees).  Thus we actually compute
      *  cos(a) = cos(b - 45) = cos(b)sin(45) + cos(45)sin(45)
      *  where b is angle from the origin to the mouse (x,y)
      *  cos(45) = sin(45) ~= 0.707107
      *  cos(b) = y/r    sin(b) = x/r
      *
      \*******************************************************/
      case TMROTATE: {
        float r;

        /* translate back to the origin. */
        pto->xfmChange.eDx = pto->xfmChange.eDy = (float)0.0;
        SetWorldTransform (pto->hdc, &pto->xfmChange);

        /* rotate about the origin. */
        r = (float) sqrt( (double)(mouWorld.x * mouWorld.x) +
                          (double)(mouWorld.y * mouWorld.y));

        pto->xfmChange.eM11 = (float) mouWorld.y / r;
        pto->xfmChange.eM11 += (float) mouWorld.x / r;
        pto->xfmChange.eM11 *= (float) 0.707107;
        pto->xfmChange.eM22 = pto->xfmChange.eM11;

        pto->xfmChange.eM12 = (float) mouWorld.y / r;
        pto->xfmChange.eM12 -= (float) mouWorld.x / r;
        pto->xfmChange.eM12 *= (float) 0.707107;
        pto->xfmChange.eM21 = -pto->xfmChange.eM12;

        pto->xfmChange.eDx = pto->xfmChange.eDy = (float)0.0;

        ModifyWorldTransform (pto->hdc, &pto->xfmChange, MWT_RIGHTMULTIPLY);

        /* translate back to the original offset. */
        pto->xfmChange.eM11 =
        pto->xfmChange.eM22 = (float) 1.0;
        pto->xfmChange.eM12 =
        pto->xfmChange.eM21 = (float) 0.0;

        pto->xfmChange.eDx = pto->xfmDown.eDx;
        pto->xfmChange.eDy = pto->xfmDown.eDy;
        ModifyWorldTransform (pto->hdc, &pto->xfmChange, MWT_RIGHTMULTIPLY);
        GetWorldTransform (pto->hdc, &pto->xfmChange);
      } break;

      /*******************************************************\
      *    (  Size X         0          0   )
      *    (     0        Size Y        0   )
      *    (     0           0          1   )
      *
      \*******************************************************/
      case TMSIZEXY: {
        pto->xfmChange.eM11 = (float) mouDevice.x;
        pto->xfmChange.eM11 -=pto->xfmChange.eDx;
        pto->xfmChange.eM11 -=((float) pto->rect.bottom*pto->xfmChange.eM21);
        pto->xfmChange.eM11 /=(float) pto->rect.right ;
        if (fabs(pto->xfmChange.eM11) < EPSILON)  // HACK.  system bug ?
           pto->xfmChange.eM11 = EPSILON;

        pto->xfmChange.eM22 = (float) mouDevice.y;
        pto->xfmChange.eM22 -=pto->xfmChange.eDy;
        pto->xfmChange.eM22 -=((float) pto->rect.right*pto->xfmChange.eM12);
        pto->xfmChange.eM22 /=(float) pto->rect.bottom ;
        if (fabs(pto->xfmChange.eM22) < EPSILON)  // HACK.  system bug ?
           pto->xfmChange.eM22 = EPSILON;
        SetWorldTransform (pto->hdc, &pto->xfmChange);
      } break;

      /*******************************************************\
      *    (  Size X         0          0   )
      *    (     0           1          0   )
      *    (     0           0          1   )
      *
      * yWorld = rect.top == 0;
      \*******************************************************/
      case TMSIZEX: {
        pto->xfmChange.eM11 = (float) mouDevice.x;
        pto->xfmChange.eM11 -=pto->xfmChange.eDx;
        pto->xfmChange.eM11 /=(float) pto->rect.right ;
        if (fabs(pto->xfmChange.eM11) < EPSILON)  // HACK.  system bug ?
           pto->xfmChange.eM11 = EPSILON;

        SetWorldTransform (pto->hdc, &pto->xfmChange);
      } break;

      /*******************************************************\
      *    (     1           0          0   )
      *    (     0        Size Y        0   )
      *    (     0           0          1   )
      *
      * xWorld = rect.left == 0;
      \*******************************************************/
      case TMSIZEY: {
        pto->xfmChange.eM22 = (float) mouDevice.y;
        pto->xfmChange.eM22 -=pto->xfmChange.eDy;
        pto->xfmChange.eM22 /=(float) pto->rect.bottom ;
        if (fabs(pto->xfmChange.eM22) < EPSILON)  // HACK.  system bug ?
           pto->xfmChange.eM22 = EPSILON;
        SetWorldTransform (pto->hdc, &pto->xfmChange);
      } break;

      /*******************************************************\
      *    (     1           0          0   )
      *    (     0           1          0   )
      *    (   Move x      Move y       1   )
      *
      * xWorld = rect.left == 0;
      * yWorld = rect.top == 0;
      \*******************************************************/
      case TMMOVE: {
        pto->xfmChange.eDx = (float) mouDevice.x ;
        pto->xfmChange.eDy = (float) mouDevice.y ;
        SetWorldTransform (pto->hdc, &pto->xfmChange);
      } break;
    } /* end switch */

    doTrackObject(pto, TROB_PAINT, hwnd, lParam);

    return;
 }

Generated on Wed Nov 13 2024 16:53:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/WinNT/PlgBlt/Track.h File Reference

  • Multimedia
  • Gdi
  • WinNT
  • PlgBlt
Classes | Defines | Typedefs | Functions

Track.h File Reference

Go to the source code of this file.

Classes

struct | tagTrackObject

Defines

#define | TMALL 0x00ff
#define | TMMOVE 0x0001
#define | TMNONE 0x0000
#define | TMROTATE 0x0008
#define | TMSHEARX 0x0010
#define | TMSHEARY 0x0020
#define | TMSIZEX 0x0002
#define | TMSIZEXY 0x0006
#define | TMSIZEY 0x0004
#define | TROB_DELETE WM_USER+2
#define | TROB_HITTEST WM_USER+5
#define | TROB_NEW WM_USER+1
#define | TROB_PAINT WM_USER+3

Typedefs

typedef struct tagTrackObject * | PTrackObject
typedef struct tagTrackObject | TrackObject

Functions

PTrackObject | doTrackObject (PTrackObject, int, HWND, LONG_PTR)
VOID | MouseMove (PTrackObject, int, HWND, LONG_PTR)

Define Documentation

#define TMALL 0x00ff

Definition at line 31 of file Track.h.

#define TMMOVE 0x0001

Definition at line 24 of file Track.h.

#define TMNONE 0x0000

Definition at line 23 of file Track.h.

#define TMROTATE 0x0008

Definition at line 30 of file Track.h.

#define TMSHEARX 0x0010

Definition at line 28 of file Track.h.

#define TMSHEARY 0x0020

Definition at line 29 of file Track.h.

#define TMSIZEX 0x0002

Definition at line 25 of file Track.h.

#define TMSIZEXY 0x0006

Definition at line 27 of file Track.h.

#define TMSIZEY 0x0004

Definition at line 26 of file Track.h.

#define TROB_DELETE WM_USER+2

Definition at line 17 of file Track.h.

#define TROB_HITTEST WM_USER+5

Definition at line 19 of file Track.h.

#define TROB_NEW WM_USER+1

Definition at line 16 of file Track.h.

#define TROB_PAINT WM_USER+3

Definition at line 18 of file Track.h.

Typedef Documentation

typedef struct tagTrackObject * PTrackObject
typedef struct tagTrackObject TrackObject

Function Documentation

PTrackObject doTrackObject | ( | PTrackObject | ,
 |  | int | ,
 |  | HWND | ,
 |  | LONG_PTR |
 | ) |  |

Definition at line 54 of file Track.c.

{
  if ((pto == NULL) && (msg != TROB_NEW))  return NULL;

  switch (msg) {

    /**********************************************************************\
    *  TROB_NEW
    *
    * Allocate new PTrackObject structure.  Fill in default values
    *  for the fields of the structure.  Set up the HDC correctly.
    * return - pointer to the new object.
    \**********************************************************************/
    case  TROB_NEW: {
        PTrackObject  pto;

        /* with LPTR returned value is a pointer. */
        pto = (PTrackObject) LocalAlloc (LPTR, sizeof (TrackObject));
    if (!pto) return NULL;    /* failed to create track object*/

        /* initialize the HDC and other fields. */
        pto->hdc = GetDC (hwnd);
        SetGraphicsMode (pto->hdc, GM_ADVANCED);
        SetROP2(pto->hdc, R2_NOT);
        SelectObject (pto->hdc, GetStockObject (NULL_BRUSH));
        pto->Mode = TMNONE;
        pto->allowedModes = TMMOVE | TMSIZEXY;

        GetWorldTransform (pto->hdc, &(pto->xfmChange));

        /* initialize the size. */
        pto->rect.top = pto->rect.left = 0;
        pto->rect.bottom = pto->rect.right = RECTSIZE;

        return (pto);
    }

    /**********************************************************************\
    *  TROB_DELETE
    *
    * Complement of TROB_NEW.  Free up the memory allocated for the object.
    \**********************************************************************/
    case  TROB_DELETE:
        doTrackObject (pto, TROB_PAINT, hwnd, lParam);
        ReleaseDC (hwnd, pto->hdc);
        LocalFree (LocalHandle ((LPSTR)pto));
    return NULL;

    /**********************************************************************\
    *  TROB_PAINT
    *
    * Paint the object into its hdc.  Called half the time to erase
    *  the object, and half the time to redraw it.
    \**********************************************************************/
    case TROB_PAINT: {
        MoveToEx (pto->hdc, pto->rect.right, pto->rect.top, NULL);
        LineTo (pto->hdc,  pto->rect.left, pto->rect.top);
        LineTo (pto->hdc,  pto->rect.left, pto->rect.bottom);

        if (pto->allowedModes & TMSIZEXY) {
          LineTo (pto->hdc,  pto->rect.right, pto->rect.bottom);
          LineTo (pto->hdc,  pto->rect.right, pto->rect.top);
        }

        if (pto->allowedModes & TMROTATE) {
          MoveToEx (pto->hdc, pto->rect.left, pto->rect.bottom/ 4, NULL);
          AngleArc (pto->hdc, pto->rect.left, pto->rect.top,
                 (DWORD) pto->rect.bottom/ 4, (float) 270.0, (float) 90.0);
        }

    } return NULL;

    /**********************************************************************\
    *  TROB_HITTEST
    *
    * Check the point sent in in the lParam to see if it lays within
    *  the bounds of the objects defining rectangle.
    * return - pointer to the object iff the point is in rectangle,
    *  otherwise return NULL.
    \**********************************************************************/
    case TROB_HITTEST:{
        POINT  mouWorld;
        mouWorld.x = LOWORD(lParam);
        mouWorld.y = HIWORD(lParam);

        DPtoLP (pto->hdc, &mouWorld, 1);

        if (PtInRect (&pto->rect, mouWorld))  return pto;
        else  return NULL;
    }

    /**********************************************************************\
    *  WM_LBUTTONDOWN &  WM_RBUTTONDOWN
    *
    * Capture the mouse, set the tracking mode depending on the mouse
    *  location in world coordinates, reset the mouse position.
    *
    \**********************************************************************/
    case WM_LBUTTONDOWN:
    case WM_RBUTTONDOWN: {
      POINT  newmouScreen;
      POINT  mouWorld;

      mouWorld.x = LOWORD(lParam);
      mouWorld.y = HIWORD(lParam);
      DPtoLP (pto->hdc, &mouWorld, 1);

      /* upper left hand corner. right button is no-op. */
      if ((mouWorld.x <= (pto->rect.right  / 2)) &&
          (mouWorld.y <= (pto->rect.bottom / 2))) {
          if (msg == WM_RBUTTONDOWN) return NULL;
          pto->Mode = TMMOVE;
          newmouScreen.x = pto->rect.left;
          newmouScreen.y = pto->rect.top;

      /* lower left hand corner */
      } else if ((mouWorld.x <= (pto->rect.right  / 2)) &&
          (mouWorld.y > (pto->rect.bottom / 2))) {

          pto->Mode = (msg == WM_RBUTTONDOWN) ? TMSHEARY : TMSIZEY;
          newmouScreen.x = pto->rect.left;
          newmouScreen.y = pto->rect.bottom;

      /* upper right hand corner */
      } else if ((mouWorld.x > (pto->rect.right  / 2)) &&
          (mouWorld.y <= (pto->rect.bottom / 2))) {

          pto->Mode = (msg == WM_RBUTTONDOWN) ? TMSHEARX : TMSIZEX;
          newmouScreen.x = pto->rect.right;
          newmouScreen.y = pto->rect.top;

      /* lower right hand corner */
      } else if ((mouWorld.x > (pto->rect.right  / 2)) &&
          (mouWorld.y > (pto->rect.bottom / 2))) {

          pto->Mode = (msg == WM_RBUTTONDOWN) ? TMROTATE : TMSIZEXY;
          newmouScreen.x = pto->rect.right;
          newmouScreen.y = pto->rect.bottom;
      }

      if (! (pto->Mode & pto->allowedModes)) {
        pto->Mode = TMNONE;
        return NULL;
      }

      SetCapture(hwnd);
      LPtoDP (pto->hdc, &newmouScreen, 1);
      ClientToScreen (hwnd, &newmouScreen);
      SetCursorPos (newmouScreen.x,newmouScreen.y);

      GetWorldTransform (pto->hdc, &pto->xfmDown);
    } return NULL;

    /**********************************************************************\
    *  WM_MOUSEMOVE
    *
    * this is where almost all of the interesting calculation is done.
    *  First clip the mouse location to be in rectClip, then
    *  call MouseMove() to handle the different tracking modes.
    \**********************************************************************/
    case WM_MOUSEMOVE: {
      if ((short) LOWORD(lParam) < (short)pto->rectClip.left)
        lParam = MAKELONG ((WORD)pto->rectClip.left, HIWORD(lParam));

      if (LOWORD(lParam) > (WORD)pto->rectClip.right)
        lParam = MAKELONG ((WORD)pto->rectClip.right, HIWORD(lParam));

      if ((short) HIWORD(lParam) < (short)pto->rectClip.top)
        lParam = MAKELONG (LOWORD(lParam), (WORD)pto->rectClip.top);

      if (HIWORD(lParam) > (WORD)pto->rectClip.bottom)
        lParam = MAKELONG (LOWORD(lParam),(WORD)pto->rectClip.bottom);

      MouseMove (pto, msg, hwnd, lParam);

    } return NULL;

    /**********************************************************************\
    *  WM_RBUTTONUP & WM_LBUTTONUP
    *
    * simply release the mouse capture, and set the mode to TMNONE.
    \**********************************************************************/
    case WM_RBUTTONUP:
    case WM_LBUTTONUP: {
      if (pto->Mode) {
         ReleaseCapture();
         pto->Mode = TMNONE;
      }
    } return NULL;

  }  /* end switch(msg) */

  return NULL;  /* exercise all possible paths */
}

VOID MouseMove | ( | PTrackObject | ,
 |  | int | ,
 |  | HWND | ,
 |  | LONG_PTR |
 | ) |  |

Definition at line 299 of file Track.c.

{
POINT  mouWorld, mouDevice, orgDevice;

    UNREFERENCED_PARAMETER(msg);

    doTrackObject(pto, TROB_PAINT, hwnd, lParam);
    mouDevice.x = mouWorld.x = LOWORD(lParam);
    mouDevice.y = mouWorld.y = HIWORD(lParam);

    SetWorldTransform(pto->hdc, &pto->xfmDown);
    DPtoLP (pto->hdc, &mouWorld, 1);

    /* offset the mouse device point for the viewport's origin. */
    GetViewportOrgEx (pto->hdc, &orgDevice);
    mouDevice.x -= orgDevice.x;
    mouDevice.y -= orgDevice.y;

    GetWorldTransform(pto->hdc, &pto->xfmChange);

    switch (pto->Mode) {
      /*******************************************************\
      *    (     1         xShear       0   )
      *    (     0           1          0   )
      *    (     0           0          1   )
      *
      * xWorld = rect.left == 0;
      \*******************************************************/
      case TMSHEARX: {
        pto->xfmChange.eM12 = (float) mouDevice.y;
        pto->xfmChange.eM12 -=pto->xfmChange.eDy;
        pto->xfmChange.eM12 /=(float) pto->rect.right ;
        SetWorldTransform (pto->hdc, &pto->xfmChange);
      } break;

      /*******************************************************\
      *    (     1           0          0   )
      *    (   yShear        1          0   )
      *    (     0           0          1   )
      *
      * yWorld = rect.top == 0;
      \*******************************************************/
      case TMSHEARY: {
        pto->xfmChange.eM21 = (float) mouDevice.x;
        pto->xfmChange.eM21 -=pto->xfmChange.eDx;
        pto->xfmChange.eM21 /=(float) pto->rect.bottom ;
        SetWorldTransform (pto->hdc, &pto->xfmChange);

      } break;

      /*******************************************************\
      *    (   cos(a)      -sin(a)      0   )
      *    (   sin(a)       cos(a)      0   )
      *    (     0           0          1   )
      *
      * a == rotation angle.  Since mouse in in lower right,
      *  we need to shift this back 45 degrees (assuming that
      *  straight down is 0 degrees).  Thus we actually compute
      *  cos(a) = cos(b - 45) = cos(b)sin(45) + cos(45)sin(45)
      *  where b is angle from the origin to the mouse (x,y)
      *  cos(45) = sin(45) ~= 0.707107
      *  cos(b) = y/r    sin(b) = x/r
      *
      \*******************************************************/
      case TMROTATE: {
        float r;

        /* translate back to the origin. */
        pto->xfmChange.eDx = pto->xfmChange.eDy = (float)0.0;
        SetWorldTransform (pto->hdc, &pto->xfmChange);

        /* rotate about the origin. */
        r = (float) sqrt( (double)(mouWorld.x * mouWorld.x) +
                          (double)(mouWorld.y * mouWorld.y));

        pto->xfmChange.eM11 = (float) mouWorld.y / r;
        pto->xfmChange.eM11 += (float) mouWorld.x / r;
        pto->xfmChange.eM11 *= (float) 0.707107;
        pto->xfmChange.eM22 = pto->xfmChange.eM11;

        pto->xfmChange.eM12 = (float) mouWorld.y / r;
        pto->xfmChange.eM12 -= (float) mouWorld.x / r;
        pto->xfmChange.eM12 *= (float) 0.707107;
        pto->xfmChange.eM21 = -pto->xfmChange.eM12;

        pto->xfmChange.eDx = pto->xfmChange.eDy = (float)0.0;

        ModifyWorldTransform (pto->hdc, &pto->xfmChange, MWT_RIGHTMULTIPLY);

        /* translate back to the original offset. */
        pto->xfmChange.eM11 =
        pto->xfmChange.eM22 = (float) 1.0;
        pto->xfmChange.eM12 =
        pto->xfmChange.eM21 = (float) 0.0;

        pto->xfmChange.eDx = pto->xfmDown.eDx;
        pto->xfmChange.eDy = pto->xfmDown.eDy;
        ModifyWorldTransform (pto->hdc, &pto->xfmChange, MWT_RIGHTMULTIPLY);
        GetWorldTransform (pto->hdc, &pto->xfmChange);
      } break;

      /*******************************************************\
      *    (  Size X         0          0   )
      *    (     0        Size Y        0   )
      *    (     0           0          1   )
      *
      \*******************************************************/
      case TMSIZEXY: {
        pto->xfmChange.eM11 = (float) mouDevice.x;
        pto->xfmChange.eM11 -=pto->xfmChange.eDx;
        pto->xfmChange.eM11 -=((float) pto->rect.bottom*pto->xfmChange.eM21);
        pto->xfmChange.eM11 /=(float) pto->rect.right ;
        if (fabs(pto->xfmChange.eM11) < EPSILON)  // HACK.  system bug ?
           pto->xfmChange.eM11 = EPSILON;

        pto->xfmChange.eM22 = (float) mouDevice.y;
        pto->xfmChange.eM22 -=pto->xfmChange.eDy;
        pto->xfmChange.eM22 -=((float) pto->rect.right*pto->xfmChange.eM12);
        pto->xfmChange.eM22 /=(float) pto->rect.bottom ;
        if (fabs(pto->xfmChange.eM22) < EPSILON)  // HACK.  system bug ?
           pto->xfmChange.eM22 = EPSILON;
        SetWorldTransform (pto->hdc, &pto->xfmChange);
      } break;

      /*******************************************************\
      *    (  Size X         0          0   )
      *    (     0           1          0   )
      *    (     0           0          1   )
      *
      * yWorld = rect.top == 0;
      \*******************************************************/
      case TMSIZEX: {
        pto->xfmChange.eM11 = (float) mouDevice.x;
        pto->xfmChange.eM11 -=pto->xfmChange.eDx;
        pto->xfmChange.eM11 /=(float) pto->rect.right ;
        if (fabs(pto->xfmChange.eM11) < EPSILON)  // HACK.  system bug ?
           pto->xfmChange.eM11 = EPSILON;

        SetWorldTransform (pto->hdc, &pto->xfmChange);
      } break;

      /*******************************************************\
      *    (     1           0          0   )
      *    (     0        Size Y        0   )
      *    (     0           0          1   )
      *
      * xWorld = rect.left == 0;
      \*******************************************************/
      case TMSIZEY: {
        pto->xfmChange.eM22 = (float) mouDevice.y;
        pto->xfmChange.eM22 -=pto->xfmChange.eDy;
        pto->xfmChange.eM22 /=(float) pto->rect.bottom ;
        if (fabs(pto->xfmChange.eM22) < EPSILON)  // HACK.  system bug ?
           pto->xfmChange.eM22 = EPSILON;
        SetWorldTransform (pto->hdc, &pto->xfmChange);
      } break;

      /*******************************************************\
      *    (     1           0          0   )
      *    (     0           1          0   )
      *    (   Move x      Move y       1   )
      *
      * xWorld = rect.left == 0;
      * yWorld = rect.top == 0;
      \*******************************************************/
      case TMMOVE: {
        pto->xfmChange.eDx = (float) mouDevice.x ;
        pto->xfmChange.eDy = (float) mouDevice.y ;
        SetWorldTransform (pto->hdc, &pto->xfmChange);
      } break;
    } /* end switch */

    doTrackObject(pto, TROB_PAINT, hwnd, lParam);

    return;
 }

Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/WinNT/WxForm/WxForm.c File Reference

  • Multimedia
  • Gdi
  • WinNT
  • WxForm
Functions

WxForm.c File Reference

#include <windows.h>
#include <string.h>
#include <stdio.h>
#include <math.h>
#include <limits.h>
#include "wxform.h"

Go to the source code of this file.

Functions

VOID | CenterOrigin (HWND hwnd, HDC hdc)
PTrackObject | doTrackObject (PTrackObject pto, int msg, HWND hwnd, LONG_PTR lParam)
LPTSTR | GetStringRes (int)
LRESULT CALLBACK | MainWndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
LRESULT CALLBACK | MouseDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
VOID | MouseMove (PTrackObject pto, int msg, HWND hwnd, LONG_PTR lParam)
LRESULT CALLBACK | TransformDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
int APIENTRY | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

Function Documentation

VOID CenterOrigin | ( | HWND | hwnd,
 |  | HDC | hdc
 | ) |  |

Definition at line 562 of file WxForm.c.

{
RECT  rect;
POINT center;

    GetClientRect (hwnd, &rect);
    center.x = rect.right / 2;
    center.y = rect.bottom /2;

    SetViewportOrgEx (hdc, center.x, center.y, NULL);
    return;
}

PTrackObject doTrackObject | ( | PTrackObject | pto,
 |  | int | msg,
 |  | HWND | hwnd,
 |  | LONG_PTR | lParam
 | ) |  |

Definition at line 609 of file WxForm.c.

{
  if ((pto == NULL) && (msg != TROB_NEW))  return NULL;

  switch (msg) {

    /**********************************************************************\
    *  TROB_NEW
    *
    * Allocate new PTrackObject structure.  Fill in default values
    *  for the fields of the structure.  Set up the HDC correctly.
    * return - pointer to the new object.
    \**********************************************************************/
    case  TROB_NEW: {
        PTrackObject  ptobj;

        /* with LPTR returned value is a pointer. */
        ptobj = (PTrackObject) LocalAlloc (LPTR, sizeof (TrackObject));
    if (!ptobj)
      return NULL;

        /* initialize the HDC and other fields. */
        ptobj->hdc = GetDC(hwnd);
        SetGraphicsMode (ptobj->hdc, GM_ADVANCED);
        SetROP2(ptobj->hdc, R2_NOT);
        SelectObject (ptobj->hdc, GetStockObject (NULL_BRUSH));
        SelectObject(ptobj->hdc, CreatePen (PS_SOLID, 2, (COLORREF) 0x01000009));
        ptobj->Mode = TMNONE;
        doTrackObject (ptobj, TROB_CENTER, hwnd, lParam);
        GetWorldTransform (ptobj->hdc, &(ptobj->xfmChange));

        /* initialize the size. */
        ptobj->rect.top = ptobj->rect.left = 0;
        ptobj->rect.bottom = ptobj->rect.right = TICKSPACE*5;

        return (ptobj);
    }

    /**********************************************************************\
    *  TROB_DELETE
    *
    * Delete the pen that we created, release the DC,
    *  free up the memory allocated for the object.
    \**********************************************************************/
    case  TROB_DELETE:
        DeleteObject (SelectObject (pto->hdc, GetStockObject (BLACK_PEN)));
        doTrackObject (pto, TROB_PAINT, hwnd, lParam);
        ReleaseDC (hwnd, pto->hdc);
    if (pto)
      LocalFree (LocalHandle ((LPSTR)pto));   /* Only free the memory if the pointer is valid */
    return NULL;

    /**********************************************************************\
    *  TROB_CENTER
    *
    * Called in order to reset the view port origin in the track objects
    *  hdc whenever the client window changes size.  This hdc is thus kept
    *  synchronized with the hdc that the axes are painted into.
    \**********************************************************************/
    case TROB_CENTER: {
        CenterOrigin (hwnd, pto->hdc);
        return (pto);
    }

    /**********************************************************************\
    *  TROB_PAINT
    *
    * Paint the object into its hdc.  Called half the time to erase
    *  the object, and half the time to redraw it.
    \**********************************************************************/
    case TROB_PAINT: {
        Rectangle (pto->hdc, pto->rect.left+1, pto->rect.top+1,
                             pto->rect.left+INC, pto->rect.top+INC);

        Rectangle (pto->hdc, pto->rect.left, pto->rect.top,
                             pto->rect.right, pto->rect.bottom);
    } return NULL;

    /**********************************************************************\
    *  TROB_SETXFORM
    *
    * lParam - pointer to the new transform.
    *  set the new transform into the HDC, then update xfmChange.
    \**********************************************************************/
    case TROB_SETXFORM: {
        doTrackObject (pto, TROB_PAINT, hwnd, lParam);
        SetWorldTransform(pto->hdc, (PXFORM) lParam);
        GetWorldTransform(pto->hdc, &pto->xfmChange);
        doTrackObject (pto, TROB_PAINT, hwnd, lParam);
    } return NULL;

    /**********************************************************************\
    *  TROB_HITTEST
    *
    * Check the point sent in in the lParam to see if it lays within
    *  the bounds of the objects defining rectangle.
    * return - pointer to the object iff the point is in rectangle,
    *  otherwise return NULL.
    \**********************************************************************/
    case TROB_HITTEST:{
        POINT  mouWorld;
        mouWorld.x = LOWORD(lParam);
        mouWorld.y = HIWORD(lParam);

        DPtoLP (pto->hdc, &mouWorld, 1);

        if (PtInRect (&pto->rect, mouWorld))  return pto;
        else  return NULL;
    }

    /**********************************************************************\
    *  WM_LBUTTONDOWN &  WM_RBUTTONDOWN
    *
    * Capture the mouse, set the tracking mode depending on the mouse
    *  location in world coordinates, reset the mouse position.
    *
    \**********************************************************************/
    case WM_LBUTTONDOWN:
    case WM_RBUTTONDOWN: {
      POINT  newmouScreen;
      POINT  mouWorld;

      mouWorld.x = LOWORD(lParam);
      mouWorld.y = HIWORD(lParam);
      DPtoLP (pto->hdc, &mouWorld, 1);

      /* upper left hand corner. right button is no-op. */
      if ((mouWorld.x <= (pto->rect.right  / 2)) &&
          (mouWorld.y <= (pto->rect.bottom / 2))) {
          if (msg == WM_RBUTTONDOWN) return NULL;
          pto->Mode = TMMOVE;
          newmouScreen.x = pto->rect.left;
          newmouScreen.y = pto->rect.top;

      /* lower left hand corner */
      } else if ((mouWorld.x <= (pto->rect.right  / 2)) &&
          (mouWorld.y > (pto->rect.bottom / 2))) {

          pto->Mode = (msg == WM_RBUTTONDOWN) ? TMSHEARY : TMSIZEY;
          newmouScreen.x = pto->rect.left;
          newmouScreen.y = pto->rect.bottom;

      /* upper right hand corner */
      } else if ((mouWorld.x > (pto->rect.right  / 2)) &&
          (mouWorld.y <= (pto->rect.bottom / 2))) {

          pto->Mode = (msg == WM_RBUTTONDOWN) ? TMSHEARX : TMSIZEX;
          newmouScreen.x = pto->rect.right;
          newmouScreen.y = pto->rect.top;

      /* lower right hand corner */
      } else if ((mouWorld.x > (pto->rect.right  / 2)) &&
          (mouWorld.y > (pto->rect.bottom / 2))) {

          pto->Mode = (msg == WM_RBUTTONDOWN) ? TMROTATE : TMSIZEXY;
          newmouScreen.x = pto->rect.right;
          newmouScreen.y = pto->rect.bottom;
      }

      SetCapture(hwnd);
      LPtoDP (pto->hdc, &newmouScreen, 1);
      ClientToScreen (hwnd, &newmouScreen);
      SetCursorPos (newmouScreen.x,newmouScreen.y);

      GetWorldTransform (pto->hdc, &pto->xfmDown);
    } return NULL;

    /**********************************************************************\
    *  WM_MOUSEMOVE
    *
    * this is where almost all of the interesting calculation is done.
    *  First clip the mouse location to be in client rectangle, then
    *  call MouseMove() to handle the different tracking modes.
    \**********************************************************************/
    case WM_MOUSEMOVE: {
      RECT  rect;
      GetClientRect (hwnd, &rect);

      if ((short) LOWORD(lParam) < (short)rect.left)
        lParam = MAKELONG ((WORD)rect.left, HIWORD(lParam));

      if (LOWORD(lParam) > (WORD)rect.right)
        lParam = MAKELONG ((WORD)rect.right, HIWORD(lParam));

      if ((short) HIWORD(lParam) < (short)rect.top)
        lParam = MAKELONG (LOWORD(lParam), (WORD)rect.top);

      if (HIWORD(lParam) > (WORD)rect.bottom)
        lParam = MAKELONG (LOWORD(lParam),(WORD)rect.bottom);

      MouseMove (pto, msg, hwnd, lParam);

    } return NULL;

    /**********************************************************************\
    *  WM_RBUTTONUP & WM_LBUTTONUP
    *
    * simply release the mouse capture, and set the mode to TMNONE.
    \**********************************************************************/
    case WM_RBUTTONUP:
    case WM_LBUTTONUP: {
      if (pto->Mode) {
         ReleaseCapture();
         pto->Mode = TMNONE;
      }
    } return NULL;

  }  /* end switch(msg) */

  return NULL;    /* Default option; do nothing */
}

LPTSTR GetStringRes ( int id )

Definition at line 1062 of file WxForm.c.

{
  static TCHAR buffer[MAX_PATH];

  buffer[0]=0;
  LoadString (GetModuleHandle (NULL), id, buffer, MAX_PATH);
  return buffer;
}

LRESULT CALLBACK MainWndProc | ( | HWND | hwnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 185 of file WxForm.c.

{
static HANDLE hPenGrid;

  switch (message) {

    /**********************************************************************\
    *  WM_CREATE
    *
    * create a pen for later use.
    \**********************************************************************/
    case WM_CREATE:
      hPenGrid  = CreatePen (PS_SOLID, 1, GRIDCOLOR);
    break;

    /**********************************************************************\
    *  WM_DESTROY
    *
    * Complement of WM_CREATE.  send the track object the delete messages,
    *  then call PostQuitMessage.
    \**********************************************************************/
    case WM_DESTROY:
      DeleteObject(hPenGrid);
      doTrackObject(ptoRect, TROB_DELETE, hwnd, lParam);
      PostQuitMessage(0);
    break;

    /**********************************************************************\
    *  WM_SIZE
    *
    * Invalidate the whole window because we reset the origin on paint
    *  messages according to the size.  Also, send the track object a
    *  message so that it will also change its HDC's viewport origin.
    \**********************************************************************/
    case WM_SIZE:
        InvalidateRect (hwnd, NULL, TRUE);
        doTrackObject (ptoRect, TROB_CENTER, hwnd, lParam);
    break;

    /**********************************************************************\
    *  WM_PAINT
    *
    * First invalidate the whole window (forces the object to be painted
    *  fresh, and thus it won't XOR its old self out).  Then draw the
    *  grid and finally draw the object.
    \**********************************************************************/
    case WM_PAINT : {
      PAINTSTRUCT ps;
      HDC hdc;
      RECT  rect;
      POINT point;
      int i;

      InvalidateRect (hwnd, NULL, TRUE);

      hdc = BeginPaint(hwnd, &ps);

      CenterOrigin (hwnd, hdc);
      GetClientRect (hwnd, &rect);
      GetViewportOrgEx(hdc, &point);
      OffsetRect(&rect, -point.x, -point.y );

      /* Draw vertical lines.  Draw three at the origin. */
      SelectObject(hdc, hPenGrid);
      for (i = 0; i<= rect.right; i+=TICKSPACE){
        MoveToEx (hdc, i, rect.top, NULL);
        LineTo (hdc, i, rect.bottom);
        MoveToEx (hdc, -i, rect.top, NULL);
        LineTo (hdc, -i, rect.bottom);
      }
      MoveToEx (hdc, -1, rect.top, NULL);
      LineTo (hdc, -1, rect.bottom);
      MoveToEx (hdc, 1, rect.top, NULL);
      LineTo (hdc, 1, rect.bottom);

      /* Draw horizontal lines.  Draw three at the origin. */
      for (i = 0; i<= rect.bottom; i+=TICKSPACE){
        MoveToEx (hdc, rect.left, i, NULL);
        LineTo (hdc, rect.right, i);
        MoveToEx (hdc, rect.left, -i, NULL);
        LineTo (hdc, rect.right, -i);
      }
      MoveToEx (hdc, rect.left, -1, NULL);
      LineTo (hdc, rect.right, -1);
      MoveToEx (hdc, rect.left, 1, NULL);
      LineTo (hdc, rect.right, 1);

      doTrackObject(ptoRect, TROB_PAINT, hwnd, lParam);

      EndPaint (hwnd, &ps);
    } break;

    /**********************************************************************\
    *  WM_LBUTTONDOWN & WM_RBUTTONDOWN
    * On button down messages, hittest on the track object, and if
    *  it returns true, then send these messages to the track object.
    \**********************************************************************/
    case WM_RBUTTONDOWN:
    case WM_LBUTTONDOWN:
      if (doTrackObject(ptoRect, TROB_HITTEST, hwnd, lParam))
         doTrackObject(ptoRect, message, hwnd, lParam);
    break;

    /**********************************************************************\
    *  WM_LBUTTONUP & WM_RBUTTONDOWN & MW_MOUSEMOVE
    * If the track object is in a "tracking mode" then send it these messages.
    *  If the transform dialog is not minimized, fill it with numbers.
    *  If the mouse dialog is not minimized, fill it with numbers.
    \**********************************************************************/
    case WM_RBUTTONUP:
    case WM_LBUTTONUP:
    case WM_MOUSEMOVE:
      if (ptoRect->Mode) {
        doTrackObject(ptoRect, message, hwnd, lParam);
        if (showTransform)
          SendMessage (hwndTransform, WM_PUTUPFLOATS, 0,
                       (LONG_PTR) &ptoRect->xfmChange);
      }

      if (showMouse)
        SendMessage (hwndMouse, WM_PUTUPFLOATS, (DWORD_PTR) hwnd, lParam);

    break;

  } /* end switch */
  return (DefWindowProc(hwnd, message, wParam, lParam));
}

LRESULT CALLBACK MouseDlgProc | ( | HWND | hwnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 490 of file WxForm.c.

{
char buffer[MAXCHARS];

  switch (message) {

    /******************************************************************\
    *  WM_PUTUPFLOATS
    *
    *  wParam - contains the hwnd for the main window.
    *  lParam - contains the mouse position in device coordinates.
    *           (c.f. WM_MOUSEMOVE)
    \******************************************************************/
    case WM_PUTUPFLOATS: {
      POINT pScreen, pWorld;
      HWND hwndM;

      hwndM = (HWND) wParam;
      pScreen.x = pWorld.x = LOWORD(lParam);
      pScreen.y = pWorld.y  = HIWORD(lParam);

      _snprintf (buffer, MAXCHARS - 1, "%d", pScreen.x);
      SetDlgItemText(hwnd, IDD_DEVICEX, buffer);
      _snprintf (buffer, MAXCHARS - 1, "%d", pScreen.y);
      SetDlgItemText(hwnd, IDD_DEVICEY, buffer);

      ClientToScreen (hwndM, &pScreen);
      _snprintf (buffer, MAXCHARS - 1, "%d", pScreen.x);
      SetDlgItemText(hwnd, IDD_SCREENX, buffer);
      _snprintf (buffer, MAXCHARS - 1, "%d", pScreen.y);
      SetDlgItemText(hwnd, IDD_SCREENY, buffer);

      DPtoLP (ptoRect->hdc, &pWorld, 1);
      _snprintf (buffer, MAXCHARS - 1, FORMATFLOAT, (float) pWorld.x);
      SetDlgItemText(hwnd, IDD_WORLDX , buffer);
      _snprintf (buffer, MAXCHARS - 1, FORMATFLOAT, (float) pWorld.y);
      SetDlgItemText(hwnd, IDD_WORLDY , buffer);

    } return FALSE;

    /******************************************************************\
    *  WM_SIZE
    *
    *  toggle the global variable keeping track of the iconized state
    *   of this window.
    \******************************************************************/
    case WM_SIZE :
      if (wParam == SIZEICONIC)
        showMouse = FALSE;
      else
        showMouse = TRUE;
    return FALSE;

  }
  return FALSE;
}

VOID MouseMove | ( | PTrackObject | pto,
 |  | int | msg,
 |  | HWND | hwnd,
 |  | LONG_PTR | lParam
 | ) |  |

Definition at line 874 of file WxForm.c.

{
POINT  mouWorld, mouDevice, orgDevice;

    UNREFERENCED_PARAMETER(msg);

    doTrackObject(pto, TROB_PAINT, hwnd, lParam);
    mouDevice.x = mouWorld.x = LOWORD(lParam);
    mouDevice.y = mouWorld.y = HIWORD(lParam);

    SetWorldTransform(pto->hdc, &pto->xfmDown);
    DPtoLP (pto->hdc, &mouWorld, 1);

    /* offset the mouse device point for the viewport's origin. */
    GetViewportOrgEx (pto->hdc, &orgDevice);
    mouDevice.x -= orgDevice.x;
    mouDevice.y -= orgDevice.y;

    GetWorldTransform(pto->hdc, &pto->xfmChange);

    switch (pto->Mode) {
      /*******************************************************\
      *    (     1         xShear       0   )
      *    (     0           1          0   )
      *    (     0           0          1   )
      *
      * xWorld = rect.left == 0;
      \*******************************************************/
      case TMSHEARX: {
        pto->xfmChange.eM12 = (float) mouDevice.y;
        pto->xfmChange.eM12 -=pto->xfmChange.eDy;
        pto->xfmChange.eM12 /=(float) pto->rect.right ;
        SetWorldTransform (pto->hdc, &pto->xfmChange);
      } break;

      /*******************************************************\
      *    (     1           0          0   )
      *    (   yShear        1          0   )
      *    (     0           0          1   )
      *
      * yWorld = rect.top == 0;
      \*******************************************************/
      case TMSHEARY: {
        pto->xfmChange.eM21 = (float) mouDevice.x;
        pto->xfmChange.eM21 -=pto->xfmChange.eDx;
        pto->xfmChange.eM21 /=(float) pto->rect.bottom ;
        SetWorldTransform (pto->hdc, &pto->xfmChange);

      } break;

      /*******************************************************\
      *    (   cos(a)      -sin(a)      0   )
      *    (   sin(a)       cos(a)      0   )
      *    (     0           0          1   )
      *
      * a == rotation angle.  Since mouse in in lower right,
      *  we need to shift this back 45 degrees (assuming that
      *  straight down is 0 degrees).  Thus we actually compute
      *  cos(a) = cos(b - 45) = cos(b)sin(45) + cos(45)sin(45)
      *  where b is angle from the origin to the mouse (x,y)
      *  cos(45) = sin(45) ~= 0.707107
      *  cos(b) = y/r    sin(b) = x/r
      *
      \*******************************************************/
      case TMROTATE: {
        float r;

        /* translate back to the origin. */
        pto->xfmChange.eDx = pto->xfmChange.eDy = (float)0.0;
        SetWorldTransform (pto->hdc, &pto->xfmChange);

        /* rotate about the origin. */
        r = (float) sqrt( (double)(mouWorld.x * mouWorld.x) +
                          (double)(mouWorld.y * mouWorld.y));

        pto->xfmChange.eM11 = (float) mouWorld.y / r;
        pto->xfmChange.eM11 += (float) mouWorld.x / r;
        pto->xfmChange.eM11 *= (float) 0.707107;
        pto->xfmChange.eM22 = pto->xfmChange.eM11;

        pto->xfmChange.eM12 = (float) mouWorld.y / r;
        pto->xfmChange.eM12 -= (float) mouWorld.x / r;
        pto->xfmChange.eM12 *= (float) 0.707107;
        pto->xfmChange.eM21 = -pto->xfmChange.eM12;

        pto->xfmChange.eDx = pto->xfmChange.eDy = (float)0.0;

        ModifyWorldTransform (pto->hdc, &pto->xfmChange, MWT_RIGHTMULTIPLY);

        /* translate back to the original offset. */
        pto->xfmChange.eM11 =
        pto->xfmChange.eM22 = (float) 1.0;
        pto->xfmChange.eM12 =
        pto->xfmChange.eM21 = (float) 0.0;

        pto->xfmChange.eDx = pto->xfmDown.eDx;
        pto->xfmChange.eDy = pto->xfmDown.eDy;
        ModifyWorldTransform (pto->hdc, &pto->xfmChange, MWT_RIGHTMULTIPLY);
        GetWorldTransform (pto->hdc, &pto->xfmChange);
      } break;

      /*******************************************************\
      *    (  Size X         0          0   )
      *    (     0        Size Y        0   )
      *    (     0           0          1   )
      *
      \*******************************************************/
      case TMSIZEXY: {
        pto->xfmChange.eM11 = (float) mouDevice.x;
        pto->xfmChange.eM11 -=pto->xfmChange.eDx;
        pto->xfmChange.eM11 -=((float) pto->rect.bottom * pto->xfmChange.eM21);
        pto->xfmChange.eM11 /=(float) pto->rect.right ;

        pto->xfmChange.eM22 = (float) mouDevice.y;
        pto->xfmChange.eM22 -=pto->xfmChange.eDy;
        pto->xfmChange.eM22 -=((float) pto->rect.right  * pto->xfmChange.eM12);
        pto->xfmChange.eM22 /=(float) pto->rect.bottom ;
        SetWorldTransform (pto->hdc, &pto->xfmChange);
      } break;

      /*******************************************************\
      *    (  Size X         0          0   )
      *    (     0           1          0   )
      *    (     0           0          1   )
      *
      * yWorld = rect.top == 0;
      \*******************************************************/
      case TMSIZEX: {
        pto->xfmChange.eM11 = (float) mouDevice.x;
        pto->xfmChange.eM11 -=pto->xfmChange.eDx;
        pto->xfmChange.eM11 /=(float) pto->rect.right ;
        SetWorldTransform (pto->hdc, &pto->xfmChange);
      } break;

      /*******************************************************\
      *    (     1           0          0   )
      *    (     0        Size Y        0   )
      *    (     0           0          1   )
      *
      * xWorld = rect.left == 0;
      \*******************************************************/
      case TMSIZEY: {
        pto->xfmChange.eM22 = (float) mouDevice.y;
        pto->xfmChange.eM22 -=pto->xfmChange.eDy;
        pto->xfmChange.eM22 /=(float) pto->rect.bottom ;
        SetWorldTransform (pto->hdc, &pto->xfmChange);
      } break;

      /*******************************************************\
      *    (     1           0          0   )
      *    (     0           1          0   )
      *    (   Move x      Move y       1   )
      *
      * xWorld = rect.left == 0;
      * yWorld = rect.top == 0;
      \*******************************************************/
      case TMMOVE: {
        pto->xfmChange.eDx = (float) mouDevice.x ;
        pto->xfmChange.eDy = (float) mouDevice.y ;
        SetWorldTransform (pto->hdc, &pto->xfmChange);
      } break;
    } /* end switch */

    doTrackObject(pto, TROB_PAINT, hwnd, lParam);

    return;
 }

LRESULT CALLBACK TransformDlgProc | ( | HWND | hwnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 346 of file WxForm.c.

{
XFORM  xform;
char buffer[MAXCHARS];

  switch (message) {

    /**********************************************************************\
    *  WM_INITDIALOG
    *
    * Fill the entry fields with sensible original values.
    \**********************************************************************/
    case WM_INITDIALOG:
      SetDlgItemText(hwnd, IDD_13, "0");
      SetDlgItemText(hwnd, IDD_23, "0");
      SetDlgItemText(hwnd, IDD_33, "1");
    return TRUE;

    /******************************************************************\
    *  WM_PUTUPFLOATS
    *
    *  lParam - pointer to an XFORM structure.
    *   fill the entry fields with the XFORM values.
    \******************************************************************/
    case WM_PUTUPFLOATS: {
      PXFORM pxform;
      pxform = (PXFORM) lParam;

      _snprintf (buffer, MAXCHARS -1, FORMATFLOAT,pxform->eM11);
      SetDlgItemText(hwnd, IDD_EM11, buffer);
      _snprintf (buffer, MAXCHARS - 1, FORMATFLOAT,pxform->eM12);
      SetDlgItemText(hwnd, IDD_EM12, buffer);
      _snprintf (buffer, MAXCHARS - 1, FORMATFLOAT,pxform->eDx);
      SetDlgItemText(hwnd, IDD_EDX, buffer);

      _snprintf (buffer, MAXCHARS - 1, FORMATFLOAT,pxform->eM21);
      SetDlgItemText(hwnd, IDD_EM21, buffer);
      _snprintf (buffer, MAXCHARS - 1, FORMATFLOAT,pxform->eM22);
      SetDlgItemText(hwnd, IDD_EM22, buffer);
      _snprintf (buffer, MAXCHARS - 1, FORMATFLOAT,pxform->eDy);
      SetDlgItemText(hwnd, IDD_EDY, buffer);

    } return FALSE;

    /******************************************************************\
    *  WM_SIZE
    *
    *  toggle the global variable keeping track of the iconized state
    *   of this window.
    \******************************************************************/
    case WM_SIZE :
      if (wParam == SIZEICONIC)
        showTransform = FALSE;
      else {
        showTransform = TRUE;
        SendMessage (hwnd, WM_PUTUPFLOATS, 0, (LONG_PTR) &ptoRect->xfmChange);
      }
    return FALSE;

    case WM_COMMAND:
      /******************************************************************\
      *  WM_COMMAND,  IDD_SETXFORM
      *
      *  take the values from the entry field, fill them into an XFORM
      *   structure and then send the track object the message to use
      *   these values.  Finally, reformat and repaint the entry fields.
      \******************************************************************/
      if (LOWORD(wParam) == IDD_SETXFORM) {
        GetDlgItemText(hwnd, IDD_EM11, buffer, MAXCHARS);
        xform.eM11 = (float) atof (buffer);
        GetDlgItemText(hwnd, IDD_EM12, buffer, MAXCHARS);
        xform.eM12 = (float) atof (buffer);
        GetDlgItemText(hwnd, IDD_EDX, buffer, MAXCHARS);
        xform.eDx = (float) atof (buffer);

        GetDlgItemText(hwnd, IDD_EM21, buffer, MAXCHARS);
        xform.eM21 = (float) atof (buffer);
        GetDlgItemText(hwnd, IDD_EM22, buffer, MAXCHARS);
        xform.eM22 = (float) atof (buffer);
        GetDlgItemText(hwnd, IDD_EDY, buffer, MAXCHARS);
        xform.eDy = (float) atof (buffer);

        // HACK.  The WM_SIZE here is used to flush the GDI buffer in order
        //  to eliminate a very strange bug whereby DPtoLP() doesn't work.
        if (showMouse) SendMessage (hwndMain, WM_SIZE, 0,0);

        doTrackObject (ptoRect, TROB_SETXFORM, hwnd, (LONG_PTR) &xform);
        SendMessage (hwnd, WM_PUTUPFLOATS, 0, (LONG_PTR) &xform);

      /******************************************************************\
      *  WM_COMMAND,  IDD_IDENTITY
      *
      *  fill a local XFORM structure with the identity matrix.  Now
      *   send the track object the message to use these values.
      *   Finally, reformat and repaint the entry fields.
      \******************************************************************/
      } else if (LOWORD(wParam) == IDD_IDENTITY) {
        xform.eM11 =
        xform.eM22 =  (float) 1.0;
        xform.eDx  =
        xform.eDy  =
        xform.eM12 =
        xform.eM21 =  (float) 0.0;

        // HACK.  The WM_SIZE here is used to flush the GDI buffer in order
        //  to eliminate a very strange bug whereby DPtoLP() doesn't work.
        if (showMouse) SendMessage (hwndMain, WM_SIZE, 0,0);

        doTrackObject (ptoRect, TROB_SETXFORM, hwnd, (LONG_PTR) &xform);
        SendMessage (hwnd, WM_PUTUPFLOATS, 0, (LONG_PTR) &xform);
      } /* end WM_COMMAND */
    return FALSE;

  } /* end switch */
  return FALSE;
}

int APIENTRY WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 49 of file WxForm.c.

{
    MSG   msg;
    HICON hicon;

    UNREFERENCED_PARAMETER( lpCmdLine );

    //
    // Detect platform and exit gracefully if not Windows NT.
    //

    {
      OSVERSIONINFO osvi;
      osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);

      GetVersionEx (&osvi);
      if (osvi.dwPlatformId != VER_PLATFORM_WIN32_NT) {
        MessageBox (NULL,
          GetStringRes (IDS_NTONLY),
          "wxform", MB_OK | MB_ICONSTOP);
        return 0;
      }
    }

    /* Check for previous instance.  If none, then register class. */
    if (!hPrevInstance) {
        WNDCLASS  wc;

        wc.style = 0;
        wc.lpfnWndProc = (WNDPROC)MainWndProc;

        wc.cbClsExtra = 0;
        wc.cbWndExtra = 0;
        wc.hInstance = hInstance;
        wc.hIcon = LoadIcon(hInstance, "TransformIcon");
        wc.hCursor = LoadCursor(NULL, IDC_ARROW);
        wc.hbrBackground = GetStockObject(LTGRAY_BRUSH);
        wc.lpszMenuName =  NULL;
        wc.lpszClassName = "wxform";

        if (!RegisterClass(&wc)) return (FALSE);
    }  /* class registered o.k. */

    /* Create the main window.  Return false if CreateWindow() fails */
    hInst = hInstance;

    hwndMain = CreateWindow(
        "wxform",
        GetStringRes (IDS_WINDOWTITLE),
        WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
        CW_USEDEFAULT,
        CW_USEDEFAULT,
        CW_USEDEFAULT,
        CW_USEDEFAULT,
        NULL,
        NULL,
        hInstance,
        NULL);

    if (!hwndMain) return (FALSE);
    ShowWindow(hwndMain, nCmdShow);
    UpdateWindow(hwndMain);

    /* create a new track object and paint it for the first time. */
    ptoRect = doTrackObject(NULL, TROB_NEW, hwndMain, 0);
    doTrackObject(ptoRect, TROB_PAINT, hwndMain, 0);

    /* load and display dialog for the world transform matrix.
     *  then fill its entry fields.  Also, get the HICON from the
     *  main window and fill it into the dialog's class structure
     *  for this application.
     */
    hwndTransform = CreateDialog(hInst, "TransformDlg",
                                 hwndMain, (DLGPROC)TransformDlgProc);
    hicon = (HICON) (DWORD_PTR) GetClassLongPtr (hwndMain, GCLP_HICON);
    SetClassLongPtr (hwndTransform, GCLP_HICON, (LONG) (DWORD_PTR) hicon);
    showTransform = TRUE;
    SendMessage (hwndTransform, WM_PUTUPFLOATS, 0, (LONG_PTR) &ptoRect->xfmChange);

    /* load and display the dialog for the mouse position.
     *  minimize it initially.
     */
    hwndMouse = CreateDialog(hInst, "MouseDlg",
                             hwndMain, (DLGPROC)MouseDlgProc);
    ShowWindow (hwndMouse, SW_SHOWMINIMIZED);
    showMouse = FALSE;

    /* load and display the dialog with the direct manipulation help.
     *  minimize it initially.   (Don't need a unique window procedure.)
     */
    hwndHelp = CreateDialog(hInst, "helpDlg", hwndMain, NULL);
    ShowWindow (hwndHelp, SW_SHOWMINIMIZED);

    /* Loop getting messages and dispatching them. */
    while (GetMessage(&msg,NULL, 0,0)) {
      if (!IsDialogMessage (hwndTransform, &msg))
      if (!IsDialogMessage (hwndMouse, &msg))
      if (!IsDialogMessage (hwndHelp, &msg)){
        TranslateMessage(&msg);
        DispatchMessage(&msg);
      }
    }
    return (int)(msg.wParam);
}

Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/Gdi/WinNT/WxForm/WxForm.h File Reference

  • Multimedia
  • Gdi
  • WinNT
  • WxForm
Classes | Defines | Typedefs | Functions | Variables

WxForm.h File Reference

Go to the source code of this file.

Classes

struct | tagTrackObject

Defines

#define | FORMATFLOAT "%1.2f"
#define | GRIDCOLOR (COLORREF) 0x01000006
#define | IDD_13 107
#define | IDD_23 108
#define | IDD_33 109
#define | IDD_DEVICEX 203
#define | IDD_DEVICEY 204
#define | IDD_EDX 103
#define | IDD_EDY 106
#define | IDD_EM11 101
#define | IDD_EM12 102
#define | IDD_EM21 104
#define | IDD_EM22 105
#define | IDD_IDENTITY 111
#define | IDD_SCREENX 201
#define | IDD_SCREENY 202
#define | IDD_SETXFORM 110
#define | IDD_WORLDX 205
#define | IDD_WORLDY 206
#define | IDS_NTONLY 16
#define | IDS_WINDOWTITLE 17
#define | INC 5
#define | MAXCHARS 32
#define | TICKSPACE 20
#define | TMMOVE 0x0001
#define | TMNONE 0x0000
#define | TMROTATE 0x0008
#define | TMSHEARX 0x0010
#define | TMSHEARY 0x0020
#define | TMSIZEX 0x0002
#define | TMSIZEXY 0x0006
#define | TMSIZEY 0x0004
#define | TROB_CENTER WM_USER+6
#define | TROB_DELETE WM_USER+2
#define | TROB_HITTEST WM_USER+5
#define | TROB_NEW WM_USER+1
#define | TROB_PAINT WM_USER+3
#define | TROB_SETXFORM WM_USER+7
#define | WM_PUTUPFLOATS WM_USER+1

Typedefs

typedef struct tagTrackObject * | PTrackObject
typedef struct tagTrackObject | TrackObject

Functions

VOID | CenterOrigin (HWND, HDC)
PTrackObject | doTrackObject (PTrackObject, int, HWND, LONG_PTR)
LRESULT CALLBACK | MainWndProc (HWND, UINT, WPARAM, LPARAM)
LRESULT CALLBACK | MouseDlgProc (HWND, UINT, WPARAM, LPARAM)
VOID | MouseMove (PTrackObject, int, HWND, LONG_PTR)
LRESULT CALLBACK | TransformDlgProc (HWND, UINT, WPARAM, LPARAM)

Variables

HANDLE hInst
HWND | hwndHelp
HWND | hwndMain
HWND | hwndMouse
HWND | hwndTransform
PTrackObject | ptoRect = NULL
BOOL showHelp
BOOL showMouse
BOOL showTransform

Define Documentation

#define FORMATFLOAT "%1.2f"

Definition at line 74 of file WxForm.h.

#define GRIDCOLOR (COLORREF) 0x01000006

Definition at line 75 of file WxForm.h.

#define IDD_13 107

Definition at line 28 of file WxForm.h.

#define IDD_23 108

Definition at line 29 of file WxForm.h.

#define IDD_33 109

Definition at line 30 of file WxForm.h.

#define IDD_DEVICEX 203

Definition at line 38 of file WxForm.h.

#define IDD_DEVICEY 204

Definition at line 39 of file WxForm.h.

#define IDD_EDX 103

Definition at line 24 of file WxForm.h.

#define IDD_EDY 106

Definition at line 27 of file WxForm.h.

#define IDD_EM11 101

Definition at line 22 of file WxForm.h.

#define IDD_EM12 102

Definition at line 23 of file WxForm.h.

#define IDD_EM21 104

Definition at line 25 of file WxForm.h.

#define IDD_EM22 105

Definition at line 26 of file WxForm.h.

#define IDD_IDENTITY 111

Definition at line 32 of file WxForm.h.

#define IDD_SCREENX 201

Definition at line 36 of file WxForm.h.

#define IDD_SCREENY 202

Definition at line 37 of file WxForm.h.

#define IDD_SETXFORM 110

Definition at line 31 of file WxForm.h.

#define IDD_WORLDX 205

Definition at line 40 of file WxForm.h.

#define IDD_WORLDY 206

Definition at line 41 of file WxForm.h.

#define IDS_NTONLY 16

Definition at line 44 of file WxForm.h.

#define IDS_WINDOWTITLE 17

Definition at line 45 of file WxForm.h.

#define INC 5

Definition at line 73 of file WxForm.h.

#define MAXCHARS 32

Definition at line 72 of file WxForm.h.

#define TICKSPACE 20

Definition at line 71 of file WxForm.h.

#define TMMOVE 0x0001

Definition at line 61 of file WxForm.h.

#define TMNONE 0x0000

Definition at line 60 of file WxForm.h.

#define TMROTATE 0x0008

Definition at line 67 of file WxForm.h.

#define TMSHEARX 0x0010

Definition at line 65 of file WxForm.h.

#define TMSHEARY 0x0020

Definition at line 66 of file WxForm.h.

#define TMSIZEX 0x0002

Definition at line 62 of file WxForm.h.

#define TMSIZEXY 0x0006

Definition at line 64 of file WxForm.h.

#define TMSIZEY 0x0004

Definition at line 63 of file WxForm.h.

#define TROB_CENTER WM_USER+6

Definition at line 52 of file WxForm.h.

#define TROB_DELETE WM_USER+2

Definition at line 49 of file WxForm.h.

#define TROB_HITTEST WM_USER+5

Definition at line 51 of file WxForm.h.

#define TROB_NEW WM_USER+1

Definition at line 48 of file WxForm.h.

#define TROB_PAINT WM_USER+3

Definition at line 50 of file WxForm.h.

#define TROB_SETXFORM WM_USER+7

Definition at line 53 of file WxForm.h.

#define WM_PUTUPFLOATS WM_USER+1

Definition at line 56 of file WxForm.h.

Typedef Documentation

typedef struct tagTrackObject * PTrackObject
typedef struct tagTrackObject TrackObject

Function Documentation

VOID CenterOrigin | ( | HWND | ,
 |  | HDC |
 | ) |  |

Definition at line 562 of file WxForm.c.

{
RECT  rect;
POINT center;

    GetClientRect (hwnd, &rect);
    center.x = rect.right / 2;
    center.y = rect.bottom /2;

    SetViewportOrgEx (hdc, center.x, center.y, NULL);
    return;
}

PTrackObject doTrackObject | ( | PTrackObject | ,
 |  | int | ,
 |  | HWND | ,
 |  | LONG_PTR |
 | ) |  |

Definition at line 54 of file Track.c.

{
  if ((pto == NULL) && (msg != TROB_NEW))  return NULL;

  switch (msg) {

    /**********************************************************************\
    *  TROB_NEW
    *
    * Allocate new PTrackObject structure.  Fill in default values
    *  for the fields of the structure.  Set up the HDC correctly.
    * return - pointer to the new object.
    \**********************************************************************/
    case  TROB_NEW: {
        PTrackObject  pto;

        /* with LPTR returned value is a pointer. */
        pto = (PTrackObject) LocalAlloc (LPTR, sizeof (TrackObject));
    if (!pto) return NULL;    /* failed to create track object*/

        /* initialize the HDC and other fields. */
        pto->hdc = GetDC (hwnd);
        SetGraphicsMode (pto->hdc, GM_ADVANCED);
        SetROP2(pto->hdc, R2_NOT);
        SelectObject (pto->hdc, GetStockObject (NULL_BRUSH));
        pto->Mode = TMNONE;
        pto->allowedModes = TMMOVE | TMSIZEXY;

        GetWorldTransform (pto->hdc, &(pto->xfmChange));

        /* initialize the size. */
        pto->rect.top = pto->rect.left = 0;
        pto->rect.bottom = pto->rect.right = RECTSIZE;

        return (pto);
    }

    /**********************************************************************\
    *  TROB_DELETE
    *
    * Complement of TROB_NEW.  Free up the memory allocated for the object.
    \**********************************************************************/
    case  TROB_DELETE:
        doTrackObject (pto, TROB_PAINT, hwnd, lParam);
        ReleaseDC (hwnd, pto->hdc);
        LocalFree (LocalHandle ((LPSTR)pto));
    return NULL;

    /**********************************************************************\
    *  TROB_PAINT
    *
    * Paint the object into its hdc.  Called half the time to erase
    *  the object, and half the time to redraw it.
    \**********************************************************************/
    case TROB_PAINT: {
        MoveToEx (pto->hdc, pto->rect.right, pto->rect.top, NULL);
        LineTo (pto->hdc,  pto->rect.left, pto->rect.top);
        LineTo (pto->hdc,  pto->rect.left, pto->rect.bottom);

        if (pto->allowedModes & TMSIZEXY) {
          LineTo (pto->hdc,  pto->rect.right, pto->rect.bottom);
          LineTo (pto->hdc,  pto->rect.right, pto->rect.top);
        }

        if (pto->allowedModes & TMROTATE) {
          MoveToEx (pto->hdc, pto->rect.left, pto->rect.bottom/ 4, NULL);
          AngleArc (pto->hdc, pto->rect.left, pto->rect.top,
                 (DWORD) pto->rect.bottom/ 4, (float) 270.0, (float) 90.0);
        }

    } return NULL;

    /**********************************************************************\
    *  TROB_HITTEST
    *
    * Check the point sent in in the lParam to see if it lays within
    *  the bounds of the objects defining rectangle.
    * return - pointer to the object iff the point is in rectangle,
    *  otherwise return NULL.
    \**********************************************************************/
    case TROB_HITTEST:{
        POINT  mouWorld;
        mouWorld.x = LOWORD(lParam);
        mouWorld.y = HIWORD(lParam);

        DPtoLP (pto->hdc, &mouWorld, 1);

        if (PtInRect (&pto->rect, mouWorld))  return pto;
        else  return NULL;
    }

    /**********************************************************************\
    *  WM_LBUTTONDOWN &  WM_RBUTTONDOWN
    *
    * Capture the mouse, set the tracking mode depending on the mouse
    *  location in world coordinates, reset the mouse position.
    *
    \**********************************************************************/
    case WM_LBUTTONDOWN:
    case WM_RBUTTONDOWN: {
      POINT  newmouScreen;
      POINT  mouWorld;

      mouWorld.x = LOWORD(lParam);
      mouWorld.y = HIWORD(lParam);
      DPtoLP (pto->hdc, &mouWorld, 1);

      /* upper left hand corner. right button is no-op. */
      if ((mouWorld.x <= (pto->rect.right  / 2)) &&
          (mouWorld.y <= (pto->rect.bottom / 2))) {
          if (msg == WM_RBUTTONDOWN) return NULL;
          pto->Mode = TMMOVE;
          newmouScreen.x = pto->rect.left;
          newmouScreen.y = pto->rect.top;

      /* lower left hand corner */
      } else if ((mouWorld.x <= (pto->rect.right  / 2)) &&
          (mouWorld.y > (pto->rect.bottom / 2))) {

          pto->Mode = (msg == WM_RBUTTONDOWN) ? TMSHEARY : TMSIZEY;
          newmouScreen.x = pto->rect.left;
          newmouScreen.y = pto->rect.bottom;

      /* upper right hand corner */
      } else if ((mouWorld.x > (pto->rect.right  / 2)) &&
          (mouWorld.y <= (pto->rect.bottom / 2))) {

          pto->Mode = (msg == WM_RBUTTONDOWN) ? TMSHEARX : TMSIZEX;
          newmouScreen.x = pto->rect.right;
          newmouScreen.y = pto->rect.top;

      /* lower right hand corner */
      } else if ((mouWorld.x > (pto->rect.right  / 2)) &&
          (mouWorld.y > (pto->rect.bottom / 2))) {

          pto->Mode = (msg == WM_RBUTTONDOWN) ? TMROTATE : TMSIZEXY;
          newmouScreen.x = pto->rect.right;
          newmouScreen.y = pto->rect.bottom;
      }

      if (! (pto->Mode & pto->allowedModes)) {
        pto->Mode = TMNONE;
        return NULL;
      }

      SetCapture(hwnd);
      LPtoDP (pto->hdc, &newmouScreen, 1);
      ClientToScreen (hwnd, &newmouScreen);
      SetCursorPos (newmouScreen.x,newmouScreen.y);

      GetWorldTransform (pto->hdc, &pto->xfmDown);
    } return NULL;

    /**********************************************************************\
    *  WM_MOUSEMOVE
    *
    * this is where almost all of the interesting calculation is done.
    *  First clip the mouse location to be in rectClip, then
    *  call MouseMove() to handle the different tracking modes.
    \**********************************************************************/
    case WM_MOUSEMOVE: {
      if ((short) LOWORD(lParam) < (short)pto->rectClip.left)
        lParam = MAKELONG ((WORD)pto->rectClip.left, HIWORD(lParam));

      if (LOWORD(lParam) > (WORD)pto->rectClip.right)
        lParam = MAKELONG ((WORD)pto->rectClip.right, HIWORD(lParam));

      if ((short) HIWORD(lParam) < (short)pto->rectClip.top)
        lParam = MAKELONG (LOWORD(lParam), (WORD)pto->rectClip.top);

      if (HIWORD(lParam) > (WORD)pto->rectClip.bottom)
        lParam = MAKELONG (LOWORD(lParam),(WORD)pto->rectClip.bottom);

      MouseMove (pto, msg, hwnd, lParam);

    } return NULL;

    /**********************************************************************\
    *  WM_RBUTTONUP & WM_LBUTTONUP
    *
    * simply release the mouse capture, and set the mode to TMNONE.
    \**********************************************************************/
    case WM_RBUTTONUP:
    case WM_LBUTTONUP: {
      if (pto->Mode) {
         ReleaseCapture();
         pto->Mode = TMNONE;
      }
    } return NULL;

  }  /* end switch(msg) */

  return NULL;  /* exercise all possible paths */
}

LRESULT CALLBACK MainWndProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 3333 of file sdkdiff.cpp.

{
    char str[32];
    long ret;
    DWORD threadid;
  HRESULT hr;

    switch (message) {

        case WM_CREATE:

            /* initialise menu options to default/saved
             * option settings
             */

#define CHECKMENU(id, fChecked)  \
          CheckMenuItem(hMenu, (id), (fChecked) ? MF_CHECKED:MF_UNCHECKED)

            /* outline_include options */
            CHECKMENU(IDM_OUTLINE_INCSAME,   (outline_include & INCLUDE_SAME));
            CHECKMENU(IDM_OUTLINE_INCLEFT,   (outline_include & INCLUDE_LEFTONLY));
            CHECKMENU(IDM_OUTLINE_INCRIGHT,  (outline_include & INCLUDE_RIGHTONLY));
            CHECKMENU(IDM_OUTLINE_INCDIFFER, (outline_include & INCLUDE_DIFFER));

            /* expand_include options */
            CHECKMENU(IDM_EXPAND_INCSAME,         (expand_include & INCLUDE_SAME));
            CHECKMENU(IDM_EXPAND_INCLEFT,         (expand_include & INCLUDE_LEFTONLY));
            CHECKMENU(IDM_EXPAND_INCRIGHT,        (expand_include & INCLUDE_RIGHTONLY));
            CHECKMENU(IDM_EXPAND_INCMOVEDLEFT,    (expand_include & INCLUDE_MOVEDLEFT));
            CHECKMENU(IDM_EXPAND_INCMOVEDRIGHT,   (expand_include & INCLUDE_MOVEDRIGHT));
            CHECKMENU(IDM_EXPAND_INCSIMILARLEFT,  (expand_include & INCLUDE_SIMILARLEFT));
            CHECKMENU(IDM_EXPAND_INCSIMILARRIGHT, (expand_include & INCLUDE_SIMILARRIGHT));

            /* other options */
            CHECKMENU(line_numbers, TRUE);
            CHECKMENU(expand_mode, TRUE);
            CHECKMENU(IDM_IGNBLANKS, ignore_blanks);
            CHECKMENU(IDM_SHOWWHITESPACE, show_whitespace);
            CHECKMENU(IDM_ALG2, Algorithm2);
            CHECKMENU(IDM_MONOCOLS, mono_colours);
            CHECKMENU(IDM_PICTURE, picture_mode);
            CHECKMENU(IDM_HIDEMARK, hide_markedfiles);
#undef CHECKMENU

            /* nothing currently displayed */
            DisplayMode = MODE_NULL;

            break;

        case WM_SYSCOLORCHANGE:
            {
                HIGHCONTRAST hc;

                hc.cbSize = sizeof(hc);
                SystemParametersInfo(SPI_GETHIGHCONTRAST,0 ,&hc, 0);

                mono_colours = (hc.dwFlags & HCF_HIGHCONTRASTON);
                if (mono_colours) {
                    SetMonoColours();
                } else {
                    SetColours();
                }

                CheckMenuItem(hMenu, IDM_MONOCOLS,
                              mono_colours? MF_CHECKED:MF_UNCHECKED);
                hr = StringCchPrintf(str, 32, szD, mono_colours);
        if (FAILED(hr))
          OutputError(hr, IDS_SAFE_PRINTF);
                WriteProfileString(APPNAME, szMonoColours, str);
                SendMessage(hwndRCD, message, wParam, lParam);
                SendMessage(hwndStatus, message, wParam, lParam);
                SendMessage(hwndBar, message, wParam, lParam);

                /* The diffs are still valid, but force a re-display
                 * of bar window and main table.
                 */
                SendMessage(hwndBar, WM_COMMAND, IDM_MONOCOLS, 0);
                InvalidateRect(hwndBar, NULL, TRUE);
                view_changeviewoptions(current_view);
            }
            break;

        case WM_COMMAND:
            switch (GET_WM_COMMAND_ID(wParam, lParam)) {
                case IDM_EXIT:
                    if (ghThread!=NULL) {
                        bAbort = TRUE;
                        SetStatus(LoadRcString(IDS_ABORT_PENDING));
                        break;
                    }
                    if (!view_isexpanded(current_view)) {
                        /* save the current outline size and position */
                        WINDOWPLACEMENT wp;
                        wp.length = sizeof(wp);
                        if (GetWindowPlacement(hwndClient,&wp)) {
                            WriteProfileInt(APPNAME, szOutlineShowCmd, wp.showCmd);
                            WriteProfileInt(APPNAME, szOutlineMaxX, wp.ptMaxPosition.x);
                            WriteProfileInt(APPNAME, szOutlineMaxY, wp.ptMaxPosition.y);
                            WriteProfileInt(APPNAME, szOutlineNormLeft, wp.rcNormalPosition.left);
                            WriteProfileInt(APPNAME, szOutlineNormTop, wp.rcNormalPosition.top);
                            WriteProfileInt(APPNAME, szOutlineNormRight, wp.rcNormalPosition.right);
                            WriteProfileInt(APPNAME, szOutlineNormBottom, wp.rcNormalPosition.bottom);
                            WriteProfileInt(APPNAME, szOutlineSaved, 1);
                        }
                    } else {
                        /* save the current expanded size and position */
                        WINDOWPLACEMENT wp;
                        wp.length = sizeof(wp);
                        if (GetWindowPlacement(hwndClient,&wp)) {
                            WriteProfileInt(APPNAME, szExpandShowCmd, wp.showCmd);
                            WriteProfileInt(APPNAME, szExpandMaxX, wp.ptMaxPosition.x);
                            WriteProfileInt(APPNAME, szExpandMaxY, wp.ptMaxPosition.y);
                            WriteProfileInt(APPNAME, szExpandNormLeft, wp.rcNormalPosition.left);
                            WriteProfileInt(APPNAME, szExpandNormTop, wp.rcNormalPosition.top);
                            WriteProfileInt(APPNAME, szExpandNormRight, wp.rcNormalPosition.right);
                            WriteProfileInt(APPNAME, szExpandNormBottom, wp.rcNormalPosition.bottom);
                            WriteProfileInt(APPNAME, szExpandedSaved, 1);
                        }
                    }
                    DestroyWindow(hWnd);
                    break;

                case IDM_ABORT:
                    /* abort menu item, or status bar button.
                     * the status bar button text gives the appropriate
                     * action depending on our state - abort, outline
                     * or expand. But the command sent is always
                     * IDM_ABORT. Thus we need to check the state
                     * to see what to do. If we are busy, set the abort
                     * flag. If there is nothing to view,
                     * exit, otherwise switch outline<->expand
                     */
                    if (IsBusy()) {
                        bAbort = TRUE;
                        SetStatus(LoadRcString(IDS_ABORT_PENDING));
                    } else if (DisplayMode == MODE_NULL) {
                        DestroyWindow(hWnd);
                    } else if (DisplayMode == MODE_EXPAND) {
                        ToOutline(hWnd);
                    } else {
                        ToExpand(hWnd);
                    }
                    break;

                case IDM_FILE:
                    /* select two files and compare them */
                    if (SetBusy()) {

                        /* close the current view */
                        view_close(current_view);

                        /* make a new empty view */
                        current_view = view_new(hwndRCD);

                        /* make a COMPLIST using the files dialog,
                         * and notify the view
                         */
                        if (complist_filedialog(current_view) == NULL) {
                            view_close(current_view);
                        }

                        /* all done! */
                        SetNotBusy();
                    } else {
                        BusyError();
                    }
                    break;

                case IDM_DIR:

                    /* read two directory names, scan them and
                     * compare all the files and subdirs.
                     */
                    if (SetBusy()) {

                        /* close the current view */
                        view_close(current_view);

                        /* make a new empty view */
                        current_view = view_new(hwndRCD);

                        ghThread = CreateThread(NULL, 0, wd_dirdialog,
                                                (LPVOID) current_view, 0, &threadid);

                        if (ghThread == NULL)
                        {

                            /*
                             * either we are on WIN16, or the
                             * thread call failed. continue
                             * single-threaded.
                             */
                            wd_dirdialog( (LPVOID) current_view);

                        }

                    } else {
                        BusyError();
                    }
                    break;

                case IDM_CLOSE:
                    /* close the output list -
                     * discard all results so far
                     */
                    if (!IsBusy()) {
                        view_close(current_view);
                    }
                    break;

                case IDM_PRINT:
                    /* print the current view -
                     * either the outline list of filenames,
                     * or the currently expanded file.
                     */
                    if (!IsBusy()) {
                        DoPrint();
                    } else {
                        BusyError();
                    }
                    break;

                case IDM_TIME:
                    /* show time it took */
                    {       char msg[50];
                        DWORD tim;
                        if (IsBusy()) {
                            BusyError();
                        } else {
                            tim = complist_querytime();
                            hr = StringCchPrintf(msg, 50, LoadRcString(IDS_SECONDS), tim/1000, tim%1000);
              if (FAILED(hr))
                OutputError(hr, IDS_SAFE_PRINTF);
                            Trace_Status(msg);
                        }
                    }
                    break;

                case IDM_TRACE:
                    /* enable tracing */
                    bTrace = TRUE;
                    Trace_Status(LoadRcString(IDS_TRACING_ENABLED));
                    break;

                case IDM_TRACEOFF:
                    /* enable tracing */
                    bTrace = FALSE;
                    Trace_Status(LoadRcString(IDS_TRACING_DISABLED));
                    break;

                case IDM_SAVELIST:
                    /* allow user to save list of same/different files
                     * to a text file. dialog box to give filename
                     * and select which types of file to include
                     */
                    if (current_view == NULL) {
                        MessageBox(hWnd,
                                   LoadRcString(IDS_CREATE_DIFF_LIST),
                                   szSdkDiff, MB_OK|MB_ICONSTOP);
                        break;
                    }

                    complist_savelist(view_getcomplist(current_view), NULL, outline_include);
                    break;

                case IDM_COPYFILES:
                    /*
                     * copy files that are same/different to a new
                     * root directory. dialog box allows user
                     * to select new root and inclusion options
                     */
                    if (current_view == NULL) {
                        MessageBox(hWnd,
                                   LoadRcString(IDS_CREATE_DIFF_LIST),
                                   szSdkDiff, MB_OK|MB_ICONSTOP);
                        break;
                    }

                    if (SetBusy()) {
                        ghThread = CreateThread(NULL, 0, wd_copy,
                                                (LPVOID) current_view, 0, &threadid);
                        if (ghThread == NULL)
                        {
                            wd_copy( (LPVOID) current_view);
                        }

                    } else {
                        BusyError();
                    }

                    break;

                case IDM_ABOUT:
                    ShellAbout( hWnd,
                                (LPTSTR)szSdkDiff,
                                LoadRcString(IDS_TOOL_DESCRIPTION),
                                LoadIcon(hInst, szSdkDiff)
                              );
                    break;

                case IDM_CONTENTS:
                    /* Help contents */
          TCHAR pszHelp[MAX_PATH];
          memset(pszHelp, 0, MAX_PATH);
          hr = StringCchCopy(pszHelp, MAX_PATH, pszWorkingDirectoryName);
          if (FAILED(hr))
            OutputError(hr, IDS_SAFE_COPY);
          hr = StringCchCat(pszHelp, MAX_PATH, "sdkdiff.hlp");
          if (FAILED(hr))
            OutputError(hr, IDS_SAFE_CAT);
          WinHelp(hWnd, pszHelp, HELP_INDEX, 0);
                    break;

                    /* launch an editor on the current item - left, right or
                     * composite view
                     */
                case IDM_EDITLEFT:
                    do_editthread(current_view, CI_LEFT);
                    break;

                case IDM_EDITRIGHT:
                    do_editthread(current_view, CI_RIGHT);
                    break;

                case IDM_EDITCOMP:
                    {
                        COMPITEM item = view_getitem(current_view, selection);
                        FILEDATA fdLeft;
                        FILEDATA fdRight;

                        fdLeft = compitem_getleftfile(item);
                        fdRight = compitem_getrightfile(item);
                        if ((fdLeft && file_IsUnicode(fdLeft)) || (fdRight && file_IsUnicode(fdRight))) {
                            MessageBox(hWnd, LoadRcString(IDS_NOCOMPUNICODE),
                                       szSdkDiff, MB_OK);
                        } else {
                            do_editthread(current_view, CI_COMP);
                        }
                    }
                    break;

                    /* allow customisation of the editor command line */
                case IDM_SETEDIT:
                    if (StringInput(editor_cmdline, sizeof(editor_cmdline),
                                    LoadRcString(IDS_EDITOR_COMMAND),
                                    (LPSTR)szSdkDiff, editor_cmdline)) {
                        WriteProfileString(APPNAME, szEditor,
                                           editor_cmdline);
                    }
                    break;

                case IDM_SETTABWIDTH:
                    {
                        char sz[32];
                        int n;

LTabWidth_tryagain:
                        hr = StringCchPrintf(sz, 32, "%d", g_tabwidth);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        if (StringInput(sz, sizeof(sz),
                                        LoadRcString(IDS_TABWIDTH),
                                        (LPSTR)szSdkDiff, sz))
                        {
                            n = atoi(sz);
                            if (n <= 0 || n > 100)
                            {
                                MessageBox(hWnd,
                                           LoadRcString(IDS_BAD_TABWIDTH),
                                           szSdkDiff, MB_OK);
                                goto LTabWidth_tryagain;
                            }
                            WriteProfileInt(APPNAME, szTabWidth, n);
                            g_tabwidth = n;
                            SendMessage(hwndRCD, TM_SETTABWIDTH, 0, n);
                        }
                    }
                    break;

                case IDM_TABWIDTH4:
                case IDM_TABWIDTH8:
                    g_tabwidth = (GET_WM_COMMAND_ID(wParam, lParam) == IDM_TABWIDTH8) ? 8 : 4;
                    SendMessage(hwndRCD, TM_SETTABWIDTH, 0, g_tabwidth);
                    break;

                case IDM_SETFONT:
                    {
                        CHOOSEFONT cf;
                        LOGFONT lf;
                        char szFace[LF_FACESIZE];

                        hr = StringCchCopy(szFace, LF_FACESIZE, g_szFontFaceName);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_COPY);

                        memset(&lf, 0, sizeof(lf));
                        hr = StringCchCopy(lf.lfFaceName, LF_FACESIZE, szFace);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_COPY);
                        lf.lfWeight = g_fFontBold ? FW_BOLD : FW_DONTCARE;
                        lf.lfHeight = g_nFontHeight;
                        lf.lfCharSet = g_bFontCharSet;

                        memset(&cf, 0, sizeof(cf));
                        cf.lStructSize = sizeof(CHOOSEFONT);
                        cf.hwndOwner = hWnd;
                        cf.lpLogFont = &lf;
                        cf.Flags = CF_INITTOLOGFONTSTRUCT|CF_FORCEFONTEXIST|
                                CF_SCREENFONTS|CF_LIMITSIZE;
                        cf.nSizeMin = 8;
                        cf.nSizeMax = 36;
                        cf.lpszStyle = szFace;
                        if (ChooseFont(&cf))
                            {
                            hr = StringCchCopy(g_szFontFaceName, LF_FACESIZE, lf.lfFaceName);
              if (FAILED(hr))
                OutputError(hr, IDS_SAFE_COPY);
                            g_fFontBold = (lf.lfWeight == FW_BOLD);
                            g_nFontHeight = lf.lfHeight;
                            g_bFontCharSet = lf.lfCharSet;

                            WriteProfileString(APPNAME, szFontFaceName, g_szFontFaceName);
                            WriteProfileInt(APPNAME, szFontHeight, g_nFontHeight);
                            WriteProfileInt(APPNAME, szFontBold, g_fFontBold);
                            WriteProfileInt(APPNAME, szFontCharSet, g_bFontCharSet);

                            GetFontPref();

                            view_changeviewoptions(current_view);
                            }
                    }
                    break;

                case IDM_LNRS:
                case IDM_RNRS:
                case IDM_NONRS:

                    /* option selects whether the line nrs displayed
                     * in expand mode are the line nrs in the left
                     * file, the right file or none
                     */

                    CheckMenuItem(GetMenu(hWnd),
                                  line_numbers, MF_UNCHECKED);
                    line_numbers = GET_WM_COMMAND_ID(wParam, lParam);
                    CheckMenuItem(GetMenu(hWnd), line_numbers, MF_CHECKED);
                    hr = StringCchPrintf(str, 32, szD, line_numbers);
          if (FAILED(hr))
            OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szLineNumbers, str);

                    /* change the display to show the line nr style
                     * chosen
                     */

                    view_changeviewoptions(current_view);
                    break;

                /*
                 * options selecting which lines to include in the
                 * expand listing, based on their state
                 */
                case IDM_EXPAND_INCSAME:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_SAME;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCSAME,
                              (expand_include & INCLUDE_SAME) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCLEFT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_LEFTONLY;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCLEFT,
                              (expand_include & INCLUDE_LEFTONLY) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCRIGHT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_RIGHTONLY;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCRIGHT,
                              (expand_include & INCLUDE_RIGHTONLY) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCMOVEDLEFT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_MOVEDLEFT;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCMOVEDLEFT,
                              (expand_include & INCLUDE_MOVEDLEFT) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCMOVEDRIGHT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_MOVEDRIGHT;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCMOVEDRIGHT,
                              (expand_include & INCLUDE_MOVEDRIGHT) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCSIMILARLEFT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_SIMILARLEFT;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCSIMILARLEFT,
                              (expand_include & INCLUDE_SIMILARLEFT) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                case IDM_EXPAND_INCSIMILARRIGHT:
                        /* toggle flag in expand_include options */
                        expand_include ^= INCLUDE_SIMILARRIGHT;

                        /* check/uncheck as necessary */
                        CheckMenuItem(hMenu, IDM_EXPAND_INCSIMILARRIGHT,
                              (expand_include & INCLUDE_SIMILARRIGHT) ?
                                        MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, expand_include);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szLineInclude, str);
                        view_changeviewoptions(current_view);
                        break;

                    /*
                     * options selecting which files to include in the
                     * outline listing, based on their state
                     */
                case IDM_OUTLINE_INCLEFT:

                    /* toggle flag in outline_include options */
                    outline_include ^= INCLUDE_LEFTONLY;

                    /* check/uncheck as necessary */
                    CheckMenuItem(hMenu, IDM_OUTLINE_INCLEFT,
                                  (outline_include & INCLUDE_LEFTONLY) ?
                                  MF_CHECKED:MF_UNCHECKED);

                    hr = StringCchPrintf(str, 32, szD, outline_include);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szFileInclude, str);
                    view_changeviewoptions(current_view);

                    break;

                case IDM_OUTLINE_INCRIGHT:

                    outline_include ^= INCLUDE_RIGHTONLY;

                    CheckMenuItem(hMenu, IDM_OUTLINE_INCRIGHT,
                                  (outline_include & INCLUDE_RIGHTONLY) ?
                                  MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, outline_include);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szFileInclude, str);
                    view_changeviewoptions(current_view);

                    break;

                case IDM_OUTLINE_INCSAME:

                    outline_include ^= INCLUDE_SAME;

                    CheckMenuItem(hMenu, IDM_OUTLINE_INCSAME,
                                  (outline_include & INCLUDE_SAME) ?
                                  MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, outline_include);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szFileInclude, str);
                    view_changeviewoptions(current_view);

                    break;

                case IDM_OUTLINE_INCDIFFER:

                    outline_include ^= INCLUDE_DIFFER;

                    CheckMenuItem(hMenu, IDM_OUTLINE_INCDIFFER,
                                  (outline_include & INCLUDE_DIFFER) ?
                                  MF_CHECKED:MF_UNCHECKED);

                    hr = StringCchPrintf(str, 32, szD, outline_include);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szFileInclude, str);
                    view_changeviewoptions(current_view);

                    break;

                case IDM_UPDATE:
                    OnUpdate( (COMPITEM) lParam);
                    break;

                case IDM_RESCAN:
                    RescanFile(hWnd);

                    /* do we need to force any repaints? */
                    // - no, as RescanFile sends a IDM_UPDATE
                    break;

                case IDM_LONLY:
                case IDM_RONLY:
                case IDM_BOTHFILES:
                    /* option selects whether the expanded file
                     * show is the combined file, or just one
                     * or other of the input files.
                     *
                     * if we are not in expand mode, this also
                     * causes us to expand the selection
                     */

                    CheckMenuItem(GetMenu(hWnd), expand_mode, MF_UNCHECKED);
                    expand_mode = GET_WM_COMMAND_ID(wParam, lParam);
                    CheckMenuItem(GetMenu(hWnd), expand_mode, MF_CHECKED);

                    /* change the current view to show only the lines
                     * of the selected type.
                     */
                    if (DisplayMode == MODE_OUTLINE) {
                        ToExpand(hWnd);
                    } else {
                        view_changeviewoptions(current_view);
                    }

                    break;

                case IDM_IGNBLANKS:

                    /* if selected, ignore all spaces and tabs on
                     * comparison - expand view only: outline view
                     * will still show that 'text files differ'
                     */

                    ignore_blanks = !ignore_blanks;
                    CheckMenuItem(hMenu, IDM_IGNBLANKS,
                                  ignore_blanks? MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, ignore_blanks);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szBlanks, str);

                    /* invalidate all diffs since we have
                     * changed diff options, and re-do and display the
                     * current diff if we are in expand mode.
                     */
                    view_changediffoptions(current_view);

                    /* force repaint of bar window */
                    InvalidateRect(hwndBar, NULL, TRUE);

                    break;

                case IDM_SHOWWHITESPACE:

                        /* if selected, display all spaces and tabs in
                           the expanded text view */
                        show_whitespace = !show_whitespace;
                        CheckMenuItem(hMenu, IDM_SHOWWHITESPACE,
                                show_whitespace ? MF_CHECKED:MF_UNCHECKED);
                        hr = StringCchPrintf(str, 32, szD, show_whitespace);
            if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                        WriteProfileString(APPNAME, szShowWhitespace, str);

                        // change the current view to show only the lines
                        // of the selected type.
                        if (DisplayMode == MODE_EXPAND) {
                                view_changeviewoptions(current_view);
                        }

                        break;

                case IDM_ALG2:

                    /* if selected, do algorithm2 which does not accept
                     * unsafe matches.
                     */

                    Algorithm2 = !Algorithm2;
                    CheckMenuItem(hMenu, IDM_ALG2,
                                  Algorithm2? MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, Algorithm2);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szAlgorithm2, str);

                    /* invalidate all diffs since we have
                     * changed diff options, and re-do and display the
                     * current diff if we are in expand mode.
                     */
                    view_changediffoptions(current_view);

                    /* force repaint of bar window */
                    InvalidateRect(hwndBar, NULL, TRUE);

                    break;

                case IDM_MONOCOLS:

                    /* Use monochrome colours - toggle */

                    mono_colours = !mono_colours;
                    CheckMenuItem(hMenu, IDM_MONOCOLS,
                                  mono_colours? MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, mono_colours);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szMonoColours, str);
                    if (mono_colours)
                        SetMonoColours();
                    else
                        SetColours();

                    /* The diffs are still valid, but force a re-display
                     * of bar window and main table.
                     */
                    SendMessage(hwndBar, WM_COMMAND, IDM_MONOCOLS, 0);
                    InvalidateRect(hwndBar, NULL, TRUE);
                    view_changeviewoptions(current_view);

                    break;

                case IDM_PICTURE:
                    picture_mode = !picture_mode;
                    CheckMenuItem(hMenu, IDM_PICTURE,
                                  picture_mode? MF_CHECKED:MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, picture_mode);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szPicture, str);
                    DoResize(hWnd);
                    break;

                case IDM_HIDEMARK:
                    // toggle state of marked files hidden or not
                    hide_markedfiles = !hide_markedfiles;
                    CheckMenuItem(hMenu, IDM_HIDEMARK,
                                  hide_markedfiles? MF_CHECKED : MF_UNCHECKED);
                    hr = StringCchPrintf(str, 32, szD, hide_markedfiles);
          if (FAILED(hr))
              OutputError(hr, IDS_SAFE_PRINTF);
                    WriteProfileString(APPNAME, szHideMark, str);

                    // rebuild view with new global option
                    // - note that marks only affect outline views
                    if (!view_isexpanded(current_view)) {
                        view_changeviewoptions(current_view);
                    }
                    break;

                case IDM_FIND:
                  {
                  int nRet = IDCANCEL;
                  DLGPROC lpProc = (DLGPROC) MakeProcInstance((WINPROCTYPE) FindDlgProc, hInst);
                  if (lpProc)
                    {
                    char *pszFind = NULL;
                    sdkdiff_UI(TRUE);
                    nRet = (BOOL) DialogBoxParam(hInst, (LPCTSTR) IDD_FIND, hwndClient, lpProc, 0L);
                    sdkdiff_UI(FALSE);
                    FreeProcInstance(lpProc);
                    }
                  }
                  break;

                case IDM_FINDNEXT:
                  {
                  const LONG iCol = (view_isexpanded(current_view)) ? 2 : 1;
                  FindString(hWnd, iCol, NULL, 1, 0);
                  break;
                  }

                case IDM_FINDPREV:
                  {
                  const LONG iCol = (view_isexpanded(current_view)) ? 2 : 1;
                  FindString(hWnd, iCol, NULL, -1, 0);
                  break;
                  }

                case IDM_GOTOLINE:
                  {
                  if (!view_getrowcount(current_view))
                    {
                    MessageBox(hWnd, LoadRcString(IDS_GOTOLINE_NOLINES), szSdkDiff, MB_OK|MB_ICONSTOP|MB_TASKMODAL);
                    }
                  else
                    {
                    DLGPROC lpProc = (DLGPROC) MakeProcInstance((WINPROCTYPE)GoToLineDlgProc, hInst);
                    if (lpProc)
                      {
                      sdkdiff_UI(TRUE);
                      DialogBoxParam(hInst, (LPCTSTR) IDD_GOTOLINE, hwndClient, lpProc, 0L);
                      sdkdiff_UI(FALSE);
                      FreeProcInstance(lpProc);
                      }
                    }
                  }
                  break;

                case IDM_EDITCOPY:
                    {
                        unsigned long cb = 0;
                        LPCSTR pszText = NULL;
                        long iRow = 0;
                        const BOOL fOutline = !view_isexpanded(current_view);

                        /* first count total data size */
                        for (iRow = 0; iRow < selection_nrows; iRow++) {
                            if (fOutline) {
                                pszText = view_gettext(current_view, selection + iRow, 1);
                                if (!pszText)
                                    break;
                                cb += (lstrlen(pszText) + 3) * sizeof(char);
                            }

                            pszText = view_gettext(current_view, selection + iRow, 2);
                            if (!pszText)
                                break;
                            cb += (lstrlen(pszText)) * sizeof(char);
                        }

                        if (cb && OpenClipboard(NULL)) {
                            /* space for trailing nul char */
                            cb++;

                            /* copy data to clipboard */
                            if (EmptyClipboard()) {
                                HGLOBAL hData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,  cb);

                                if (hData) {
                                    void *pv = hData;
                                    if (!pv) {
                                        HeapFree(GetProcessHeap(), NULL, hData);
                                    }
                                    else {
                                        LPSTR pszBuf = (LPSTR) pv;
                                        memset(pv, 0, cb);

                                        for (iRow = 0; iRow < selection_nrows; iRow++) {
                                            if (fOutline) {
                                                pszText = view_gettext(current_view, selection + iRow, 1);
                                                if (!pszText)
                                                    break;

                                                hr = StringCchCopy(pszBuf, cb, pszText);
                        if (FAILED(hr))
                          OutputError(hr, IDS_SAFE_COPY);
                                                pszBuf += lstrlen(pszBuf);
                                                *(pszBuf++) = '\t';
                                                *pszBuf = 0;
                                            }

                                            pszText = view_gettext(current_view, selection + iRow, 2);
                                            if (!pszText)
                                                break;

                                            hr = StringCchCopy(pszBuf, cb, pszText);
                      if (FAILED(hr))
                        OutputError(hr, IDS_SAFE_COPY);
                                            pszBuf += lstrlen(pszBuf);

                                            if (fOutline) {
                                                *(pszBuf++) = '\r';
                                                *(pszBuf++) = '\n';
                                                *pszBuf = 0;
                                            }
                                        }

                                        SetClipboardData(CF_TEXT, hData);
                                    }
                                }
                            }
                            CloseClipboard();
                        }
                    }
                    break;

                case IDM_MARK:
                    {
                        BOOL bChanged = FALSE;
                        int i;

                        // toggle the mark on the current selection
                        // note that the selection could be multiple rows
                        for (i = 0; i < selection_nrows; i++) {

                            if (view_setmarkstate(current_view, selection + i,
                                                  !view_getmarkstate(current_view, selection + i))) {

                                bChanged = TRUE;
                            }
                        }

                        if (bChanged) {
                            // yes the mark state was changed - need
                            // to rebuild the view.
                            if (!view_isexpanded(current_view)) {
                                view_changeviewoptions(current_view);
                            }
                        }
                        break;
                    }

                case IDM_TOGGLEMARK:
                    // toggle the state of all files: unmark all
                    // marked files and vice versa
                    complist_togglemark(view_getcomplist(current_view));

                    // rebuild view
                    if (!view_isexpanded(current_view)) {
                        view_changeviewoptions(current_view);
                    }
                    break;

                case IDM_MARKPATTERN:
                    // dialog to query the pattern, then set a mark on
                    // all compitems whose title matches that pattern
                    // returns TRUE if anything was changed
                    if (complist_markpattern(view_getcomplist(current_view))) {

                        // rebuild view
                        if (!view_isexpanded(current_view)) {
                            view_changeviewoptions(current_view);
                        }
                    }
                    break;

                case IDM_EXPAND:

                    /* show the expanded view of the
                     * selected file
                     */
                    if (current_view != NULL) {
                        ToExpand(hWnd);
                    }

                    break;

                case IDM_OUTLINE:
                    /* return to the outline view (list of filenames) */
                    ToOutline(hWnd);

                    break;

                case IDM_FCHANGE:
                    /* find the next line in the current view
                     * that is not the same in both files -
                     * in outline view, finds the next filename that
                     * is not identical
                     */
                    FindNextChange();
                    break;

                case IDM_FPCHANGE:
                    /* same as IDM_FCHANGE, but going backwards from
                     * current position
                     */
                    FindPrevChange();
                    break;

                case IDM_FCHANGE_LAURIE:
                    /* same as IDM_FCHANGE, but tries to keep cursor on same
                     * line.
                     */
                    _FindNextChange(TRUE, FALSE);
                    break;

                case IDM_FPCHANGE_LAURIE:
                    /* same as IDM_FPCHANGE, but tries to keep cursor on same
                     * line.
                     */
                    _FindPrevChange(TRUE, FALSE);
                    break;

                    // given a line that has been moved, jump to the
                    // other representation of the same line.
                    // this used to be available just through double-click
                    // but now is also available from a context menu
                case IDM_TOMOVED:
                    ToMoved(hWnd, TRUE);
                    break;
            }
            break;

        case WM_SIZE:
            DoResize(hWnd);
            break;

        case WM_SETFOCUS:
            /* set the focus on the table class so it can process
             * page-up /pagedown keys etc.
             */
            SetFocus(hwndRCD);
            break;

        case WM_KEYDOWN:
            /* although the table window has the focus, he passes
             * back to us any keys he doesn't understand
             * We handle escape here to mean 'return to outline view'
             */
            if (wParam == VK_ESCAPE) {
                ToOutline(hWnd);
            } else if (wParam == VK_APPS) {
                // Handle the context menu keyboard key
                POINT posCursor;
                GetCursorPos(&posCursor);
                ScreenToClient(hwndRCD, &posCursor);
                OnRightClick(hWnd, posCursor.x, posCursor.y);
            }
            break;

        case WM_RBUTTONDOWN:
            /*
             * the table window handles this by performing the
             * selection and then passing the message to us, allowing
             * us to put up a context menu.
             */
            OnRightClick(hWnd, LOWORD(lParam), HIWORD(lParam));
            break;

        case WM_CLOSE:
            SendMessage(hWnd, WM_COMMAND, IDM_EXIT, 0);
            return TRUE;

            /* don't allow close when busy - process this message in
             * order to ensure this
             */
            break;

        case WM_DESTROY:
      TCHAR pszHelp[MAX_PATH];
      memset(pszHelp, 0, MAX_PATH);
      hr = StringCchCopy(pszHelp, MAX_PATH, pszWorkingDirectoryName);
      if (FAILED(hr))
        OutputError(hr, IDS_SAFE_COPY);
      hr = StringCchCat(pszHelp, MAX_PATH, "sdkdiff.hlp");
      if (FAILED(hr))
        OutputError(hr, IDS_SAFE_COPY);
            DeleteTools();
            WinHelp(hWnd, pszHelp, HELP_QUIT, 0);
            PostQuitMessage(0);
            break;

        case TM_CURRENTVIEW:
            /* allow other people such as the bar window to query the
             * current view
             */
            return((INT_PTR) current_view);

#ifdef LATER
#ifdef WM_MOUSEWHEEL
        case WM_MOUSEWHEEL:
            if (LOWORD(wParam) & MK_MBUTTON) {
                if ((short)HIWORD(wParam) < 0) {
                    // The next occurence
                    _FindNextChange(FALSE, TRUE);
                }
                else {
                    _FindPrevChange(FALSE, TRUE);
                }
            }
            break;
#endif
#endif

        case WM_QUERYENDSESSION:
            if (IsBusy())
                return FALSE;
            return TRUE;

        case WM_ENDSESSION:
            SendMessage(hWnd, WM_CLOSE, 0, 0);
            break;

        default:
            /* handle registered table messages */
            if (message == table_msgcode) {
                ret = TableServer(hWnd, wParam, lParam);
                return(ret);
            }
            return(DefWindowProc(hWnd, message, wParam, lParam));
    }
    return(0);
}

LRESULT CALLBACK MouseDlgProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 490 of file WxForm.c.

{
char buffer[MAXCHARS];

  switch (message) {

    /******************************************************************\
    *  WM_PUTUPFLOATS
    *
    *  wParam - contains the hwnd for the main window.
    *  lParam - contains the mouse position in device coordinates.
    *           (c.f. WM_MOUSEMOVE)
    \******************************************************************/
    case WM_PUTUPFLOATS: {
      POINT pScreen, pWorld;
      HWND hwndM;

      hwndM = (HWND) wParam;
      pScreen.x = pWorld.x = LOWORD(lParam);
      pScreen.y = pWorld.y  = HIWORD(lParam);

      _snprintf (buffer, MAXCHARS - 1, "%d", pScreen.x);
      SetDlgItemText(hwnd, IDD_DEVICEX, buffer);
      _snprintf (buffer, MAXCHARS - 1, "%d", pScreen.y);
      SetDlgItemText(hwnd, IDD_DEVICEY, buffer);

      ClientToScreen (hwndM, &pScreen);
      _snprintf (buffer, MAXCHARS - 1, "%d", pScreen.x);
      SetDlgItemText(hwnd, IDD_SCREENX, buffer);
      _snprintf (buffer, MAXCHARS - 1, "%d", pScreen.y);
      SetDlgItemText(hwnd, IDD_SCREENY, buffer);

      DPtoLP (ptoRect->hdc, &pWorld, 1);
      _snprintf (buffer, MAXCHARS - 1, FORMATFLOAT, (float) pWorld.x);
      SetDlgItemText(hwnd, IDD_WORLDX , buffer);
      _snprintf (buffer, MAXCHARS - 1, FORMATFLOAT, (float) pWorld.y);
      SetDlgItemText(hwnd, IDD_WORLDY , buffer);

    } return FALSE;

    /******************************************************************\
    *  WM_SIZE
    *
    *  toggle the global variable keeping track of the iconized state
    *   of this window.
    \******************************************************************/
    case WM_SIZE :
      if (wParam == SIZEICONIC)
        showMouse = FALSE;
      else
        showMouse = TRUE;
    return FALSE;

  }
  return FALSE;
}

VOID MouseMove | ( | PTrackObject | ,
 |  | int | ,
 |  | HWND | ,
 |  | LONG_PTR |
 | ) |  |

Definition at line 299 of file Track.c.

{
POINT  mouWorld, mouDevice, orgDevice;

    UNREFERENCED_PARAMETER(msg);

    doTrackObject(pto, TROB_PAINT, hwnd, lParam);
    mouDevice.x = mouWorld.x = LOWORD(lParam);
    mouDevice.y = mouWorld.y = HIWORD(lParam);

    SetWorldTransform(pto->hdc, &pto->xfmDown);
    DPtoLP (pto->hdc, &mouWorld, 1);

    /* offset the mouse device point for the viewport's origin. */
    GetViewportOrgEx (pto->hdc, &orgDevice);
    mouDevice.x -= orgDevice.x;
    mouDevice.y -= orgDevice.y;

    GetWorldTransform(pto->hdc, &pto->xfmChange);

    switch (pto->Mode) {
      /*******************************************************\
      *    (     1         xShear       0   )
      *    (     0           1          0   )
      *    (     0           0          1   )
      *
      * xWorld = rect.left == 0;
      \*******************************************************/
      case TMSHEARX: {
        pto->xfmChange.eM12 = (float) mouDevice.y;
        pto->xfmChange.eM12 -=pto->xfmChange.eDy;
        pto->xfmChange.eM12 /=(float) pto->rect.right ;
        SetWorldTransform (pto->hdc, &pto->xfmChange);
      } break;

      /*******************************************************\
      *    (     1           0          0   )
      *    (   yShear        1          0   )
      *    (     0           0          1   )
      *
      * yWorld = rect.top == 0;
      \*******************************************************/
      case TMSHEARY: {
        pto->xfmChange.eM21 = (float) mouDevice.x;
        pto->xfmChange.eM21 -=pto->xfmChange.eDx;
        pto->xfmChange.eM21 /=(float) pto->rect.bottom ;
        SetWorldTransform (pto->hdc, &pto->xfmChange);

      } break;

      /*******************************************************\
      *    (   cos(a)      -sin(a)      0   )
      *    (   sin(a)       cos(a)      0   )
      *    (     0           0          1   )
      *
      * a == rotation angle.  Since mouse in in lower right,
      *  we need to shift this back 45 degrees (assuming that
      *  straight down is 0 degrees).  Thus we actually compute
      *  cos(a) = cos(b - 45) = cos(b)sin(45) + cos(45)sin(45)
      *  where b is angle from the origin to the mouse (x,y)
      *  cos(45) = sin(45) ~= 0.707107
      *  cos(b) = y/r    sin(b) = x/r
      *
      \*******************************************************/
      case TMROTATE: {
        float r;

        /* translate back to the origin. */
        pto->xfmChange.eDx = pto->xfmChange.eDy = (float)0.0;
        SetWorldTransform (pto->hdc, &pto->xfmChange);

        /* rotate about the origin. */
        r = (float) sqrt( (double)(mouWorld.x * mouWorld.x) +
                          (double)(mouWorld.y * mouWorld.y));

        pto->xfmChange.eM11 = (float) mouWorld.y / r;
        pto->xfmChange.eM11 += (float) mouWorld.x / r;
        pto->xfmChange.eM11 *= (float) 0.707107;
        pto->xfmChange.eM22 = pto->xfmChange.eM11;

        pto->xfmChange.eM12 = (float) mouWorld.y / r;
        pto->xfmChange.eM12 -= (float) mouWorld.x / r;
        pto->xfmChange.eM12 *= (float) 0.707107;
        pto->xfmChange.eM21 = -pto->xfmChange.eM12;

        pto->xfmChange.eDx = pto->xfmChange.eDy = (float)0.0;

        ModifyWorldTransform (pto->hdc, &pto->xfmChange, MWT_RIGHTMULTIPLY);

        /* translate back to the original offset. */
        pto->xfmChange.eM11 =
        pto->xfmChange.eM22 = (float) 1.0;
        pto->xfmChange.eM12 =
        pto->xfmChange.eM21 = (float) 0.0;

        pto->xfmChange.eDx = pto->xfmDown.eDx;
        pto->xfmChange.eDy = pto->xfmDown.eDy;
        ModifyWorldTransform (pto->hdc, &pto->xfmChange, MWT_RIGHTMULTIPLY);
        GetWorldTransform (pto->hdc, &pto->xfmChange);
      } break;

      /*******************************************************\
      *    (  Size X         0          0   )
      *    (     0        Size Y        0   )
      *    (     0           0          1   )
      *
      \*******************************************************/
      case TMSIZEXY: {
        pto->xfmChange.eM11 = (float) mouDevice.x;
        pto->xfmChange.eM11 -=pto->xfmChange.eDx;
        pto->xfmChange.eM11 -=((float) pto->rect.bottom*pto->xfmChange.eM21);
        pto->xfmChange.eM11 /=(float) pto->rect.right ;
        if (fabs(pto->xfmChange.eM11) < EPSILON)  // HACK.  system bug ?
           pto->xfmChange.eM11 = EPSILON;

        pto->xfmChange.eM22 = (float) mouDevice.y;
        pto->xfmChange.eM22 -=pto->xfmChange.eDy;
        pto->xfmChange.eM22 -=((float) pto->rect.right*pto->xfmChange.eM12);
        pto->xfmChange.eM22 /=(float) pto->rect.bottom ;
        if (fabs(pto->xfmChange.eM22) < EPSILON)  // HACK.  system bug ?
           pto->xfmChange.eM22 = EPSILON;
        SetWorldTransform (pto->hdc, &pto->xfmChange);
      } break;

      /*******************************************************\
      *    (  Size X         0          0   )
      *    (     0           1          0   )
      *    (     0           0          1   )
      *
      * yWorld = rect.top == 0;
      \*******************************************************/
      case TMSIZEX: {
        pto->xfmChange.eM11 = (float) mouDevice.x;
        pto->xfmChange.eM11 -=pto->xfmChange.eDx;
        pto->xfmChange.eM11 /=(float) pto->rect.right ;
        if (fabs(pto->xfmChange.eM11) < EPSILON)  // HACK.  system bug ?
           pto->xfmChange.eM11 = EPSILON;

        SetWorldTransform (pto->hdc, &pto->xfmChange);
      } break;

      /*******************************************************\
      *    (     1           0          0   )
      *    (     0        Size Y        0   )
      *    (     0           0          1   )
      *
      * xWorld = rect.left == 0;
      \*******************************************************/
      case TMSIZEY: {
        pto->xfmChange.eM22 = (float) mouDevice.y;
        pto->xfmChange.eM22 -=pto->xfmChange.eDy;
        pto->xfmChange.eM22 /=(float) pto->rect.bottom ;
        if (fabs(pto->xfmChange.eM22) < EPSILON)  // HACK.  system bug ?
           pto->xfmChange.eM22 = EPSILON;
        SetWorldTransform (pto->hdc, &pto->xfmChange);
      } break;

      /*******************************************************\
      *    (     1           0          0   )
      *    (     0           1          0   )
      *    (   Move x      Move y       1   )
      *
      * xWorld = rect.left == 0;
      * yWorld = rect.top == 0;
      \*******************************************************/
      case TMMOVE: {
        pto->xfmChange.eDx = (float) mouDevice.x ;
        pto->xfmChange.eDy = (float) mouDevice.y ;
        SetWorldTransform (pto->hdc, &pto->xfmChange);
      } break;
    } /* end switch */

    doTrackObject(pto, TROB_PAINT, hwnd, lParam);

    return;
 }

LRESULT CALLBACK TransformDlgProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 346 of file WxForm.c.

{
XFORM  xform;
char buffer[MAXCHARS];

  switch (message) {

    /**********************************************************************\
    *  WM_INITDIALOG
    *
    * Fill the entry fields with sensible original values.
    \**********************************************************************/
    case WM_INITDIALOG:
      SetDlgItemText(hwnd, IDD_13, "0");
      SetDlgItemText(hwnd, IDD_23, "0");
      SetDlgItemText(hwnd, IDD_33, "1");
    return TRUE;

    /******************************************************************\
    *  WM_PUTUPFLOATS
    *
    *  lParam - pointer to an XFORM structure.
    *   fill the entry fields with the XFORM values.
    \******************************************************************/
    case WM_PUTUPFLOATS: {
      PXFORM pxform;
      pxform = (PXFORM) lParam;

      _snprintf (buffer, MAXCHARS -1, FORMATFLOAT,pxform->eM11);
      SetDlgItemText(hwnd, IDD_EM11, buffer);
      _snprintf (buffer, MAXCHARS - 1, FORMATFLOAT,pxform->eM12);
      SetDlgItemText(hwnd, IDD_EM12, buffer);
      _snprintf (buffer, MAXCHARS - 1, FORMATFLOAT,pxform->eDx);
      SetDlgItemText(hwnd, IDD_EDX, buffer);

      _snprintf (buffer, MAXCHARS - 1, FORMATFLOAT,pxform->eM21);
      SetDlgItemText(hwnd, IDD_EM21, buffer);
      _snprintf (buffer, MAXCHARS - 1, FORMATFLOAT,pxform->eM22);
      SetDlgItemText(hwnd, IDD_EM22, buffer);
      _snprintf (buffer, MAXCHARS - 1, FORMATFLOAT,pxform->eDy);
      SetDlgItemText(hwnd, IDD_EDY, buffer);

    } return FALSE;

    /******************************************************************\
    *  WM_SIZE
    *
    *  toggle the global variable keeping track of the iconized state
    *   of this window.
    \******************************************************************/
    case WM_SIZE :
      if (wParam == SIZEICONIC)
        showTransform = FALSE;
      else {
        showTransform = TRUE;
        SendMessage (hwnd, WM_PUTUPFLOATS, 0, (LONG_PTR) &ptoRect->xfmChange);
      }
    return FALSE;

    case WM_COMMAND:
      /******************************************************************\
      *  WM_COMMAND,  IDD_SETXFORM
      *
      *  take the values from the entry field, fill them into an XFORM
      *   structure and then send the track object the message to use
      *   these values.  Finally, reformat and repaint the entry fields.
      \******************************************************************/
      if (LOWORD(wParam) == IDD_SETXFORM) {
        GetDlgItemText(hwnd, IDD_EM11, buffer, MAXCHARS);
        xform.eM11 = (float) atof (buffer);
        GetDlgItemText(hwnd, IDD_EM12, buffer, MAXCHARS);
        xform.eM12 = (float) atof (buffer);
        GetDlgItemText(hwnd, IDD_EDX, buffer, MAXCHARS);
        xform.eDx = (float) atof (buffer);

        GetDlgItemText(hwnd, IDD_EM21, buffer, MAXCHARS);
        xform.eM21 = (float) atof (buffer);
        GetDlgItemText(hwnd, IDD_EM22, buffer, MAXCHARS);
        xform.eM22 = (float) atof (buffer);
        GetDlgItemText(hwnd, IDD_EDY, buffer, MAXCHARS);
        xform.eDy = (float) atof (buffer);

        // HACK.  The WM_SIZE here is used to flush the GDI buffer in order
        //  to eliminate a very strange bug whereby DPtoLP() doesn't work.
        if (showMouse) SendMessage (hwndMain, WM_SIZE, 0,0);

        doTrackObject (ptoRect, TROB_SETXFORM, hwnd, (LONG_PTR) &xform);
        SendMessage (hwnd, WM_PUTUPFLOATS, 0, (LONG_PTR) &xform);

      /******************************************************************\
      *  WM_COMMAND,  IDD_IDENTITY
      *
      *  fill a local XFORM structure with the identity matrix.  Now
      *   send the track object the message to use these values.
      *   Finally, reformat and repaint the entry fields.
      \******************************************************************/
      } else if (LOWORD(wParam) == IDD_IDENTITY) {
        xform.eM11 =
        xform.eM22 =  (float) 1.0;
        xform.eDx  =
        xform.eDy  =
        xform.eM12 =
        xform.eM21 =  (float) 0.0;

        // HACK.  The WM_SIZE here is used to flush the GDI buffer in order
        //  to eliminate a very strange bug whereby DPtoLP() doesn't work.
        if (showMouse) SendMessage (hwndMain, WM_SIZE, 0,0);

        doTrackObject (ptoRect, TROB_SETXFORM, hwnd, (LONG_PTR) &xform);
        SendMessage (hwnd, WM_PUTUPFLOATS, 0, (LONG_PTR) &xform);
      } /* end WM_COMMAND */
    return FALSE;

  } /* end switch */
  return FALSE;
}

Variable Documentation

HANDLE hInst

Definition at line 100 of file WxForm.h.

HWND hwndHelp

Definition at line 98 of file WxForm.h.

HWND hwndMain

Definition at line 101 of file WxForm.h.

HWND hwndMouse

Definition at line 98 of file WxForm.h.

HWND hwndTransform

Definition at line 98 of file WxForm.h.

PTrackObject ptoRect = NULL

Definition at line 99 of file WxForm.h.

BOOL showHelp

Definition at line 97 of file WxForm.h.

BOOL showMouse

Definition at line 97 of file WxForm.h.

BOOL showTransform

Definition at line 97 of file WxForm.h.

Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/wia/GetImage/BitmapUtil.cpp File Reference

  • Multimedia
  • wia
  • GetImage
Namespaces | Functions

BitmapUtil.cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include "BitmapUtil.h"

Go to the source code of this file.

Namespaces

namespace | BitmapUtil

Functions

BOOL | BitmapUtil::FillBitmapFileHeader (LPCVOID pDib, PBITMAPFILEHEADER pbmfh)
BOOL | BitmapUtil::FixBitmapHeight (PVOID pDib, ULONG nSize, BOOL bTopDown)
BOOL | BitmapUtil::GetBitmapDimensions (LPCVOID pDib, UINT *pWidth, UINT *pHeight)
ULONG | BitmapUtil::GetBitmapHeaderSize (LPCVOID pDib)
ULONG | BitmapUtil::GetBitmapLineWidthInBytes (ULONG nWidthInPixels, ULONG nBitCount)
ULONG | BitmapUtil::GetBitmapOffsetBits (LPCVOID pDib)
ULONG | BitmapUtil::GetBitmapSize (LPCVOID pDib)
Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/wia/GetImage/BitmapUtil.h File Reference

  • Multimedia
  • wia
  • GetImage
Namespaces | Functions

BitmapUtil.h File Reference

Go to the source code of this file.

Namespaces

namespace | BitmapUtil

Functions

BOOL | BitmapUtil::FillBitmapFileHeader (LPCVOID pDib, PBITMAPFILEHEADER pbmfh)
BOOL | BitmapUtil::FixBitmapHeight (PVOID pDib, ULONG nSize, BOOL bTopDown)
BOOL | BitmapUtil::GetBitmapDimensions (LPCVOID pDib, UINT *pWidth, UINT *pHeight)
ULONG | BitmapUtil::GetBitmapHeaderSize (LPCVOID pDib)
ULONG | BitmapUtil::GetBitmapLineWidthInBytes (ULONG nWidthInPixels, ULONG nBitCount)
ULONG | BitmapUtil::GetBitmapOffsetBits (LPCVOID pDib)
ULONG | BitmapUtil::GetBitmapSize (LPCVOID pDib)
Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/wia/GetImage/BitmapWnd.cpp File Reference

  • Multimedia
  • wia
  • GetImage
Functions

BitmapWnd.cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include "BitmapUtil.h"
#include "BitmapWnd.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CBitmapWnd

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 74 of file BitmapWnd.cpp.

{
    LONG cRef = InterlockedDecrement(&m_cRef);

    if (cRef == 0)
    {
        delete this;
    }

    return cRef;
}

Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/wia/GetImage/BitmapWnd.h File Reference

  • Multimedia
  • wia
  • GetImage
Classes

BitmapWnd.h File Reference

Go to the source code of this file.

Classes

class | CBitmapWnd
class | CGdiplusInit
Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/wia/GetImage/DataCallback.cpp File Reference

  • Multimedia
  • wia
  • GetImage
Namespaces | Functions

DataCallback.cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include "BitmapUtil.h"
#include "DataCallback.h"

Go to the source code of this file.

Namespaces

namespace WiaWrap

Functions

WiaWrap::STDMETHODIMP_ (ULONG) CDataCallback
Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/wia/GetImage/DataCallback.h File Reference

  • Multimedia
  • wia
  • GetImage
Classes | Namespaces

DataCallback.h File Reference

#include "WiaWrap.h"

Go to the source code of this file.

Classes

class | WiaWrap::CDataCallback

Namespaces

namespace | WiaWrap
Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/wia/GetImage/EventCallback.cpp File Reference

  • Multimedia
  • wia
  • GetImage
Namespaces | Functions

EventCallback.cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include "WiaWrap.h"
#include "EventCallback.h"

Go to the source code of this file.

Namespaces

namespace WiaWrap

Functions

WiaWrap::STDMETHODIMP_ (ULONG) CDataCallback
Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/wia/GetImage/EventCallback.h File Reference

  • Multimedia
  • wia
  • GetImage
Classes | Namespaces

EventCallback.h File Reference

Go to the source code of this file.

Classes

class | WiaWrap::CEventCallback

Namespaces

namespace | WiaWrap
Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/wia/GetImage/GetImage.cpp File Reference

  • Multimedia
  • wia
  • GetImage
Functions | Variables

GetImage.cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include "BitmapWnd.h"
#include "MainWnd.h"

Go to the source code of this file.

Functions

void | RunGetImage ()
int APIENTRY | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR pCmdLine, int nCmdShow)

Variables

HINSTANCE | g_hInstance = 0

Function Documentation

void RunGetImage ( )

Definition at line 20 of file GetImage.cpp.

{
    CComPtr<CMainWindow> pMainWindow = new CMainWindow;

    if (pMainWindow != NULL)
    {
        TCHAR szTitle[DEFAULT_STRING_SIZE] = _T("");

      LoadString(g_hInstance, IDS_MAIN_WINDOW_TITLE, szTitle, COUNTOF(szTitle));

        HWND hWnd = CreateWindowEx(
            0,
            _T("MainWindow"),
            szTitle,
            WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_VISIBLE,
            CW_USEDEFAULT,
            CW_USEDEFAULT,
            CW_USEDEFAULT,
            CW_USEDEFAULT,
            NULL,
            NULL,
            g_hInstance,
            pMainWindow
        );

        if (hWnd != NULL)
        {
            pMainWindow->DoModal();
        }
    }
}

int WINAPI WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | PSTR | pCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 60 of file GetImage.cpp.

{
    // Initialize the global module instance value

    g_hInstance = hInstance;

    // Initialize the GDI+ library

    CGdiplusInit GdiplusInit;

    // Register window classes

    INITCOMMONCONTROLSEX iccex;

    iccex.dwSize = sizeof(iccex);
    iccex.dwICC  = ICC_BAR_CLASSES;

    InitCommonControlsEx(&iccex);

    CBitmapWnd::Register();

    CMainWindow::Register();

    // Initialize the COM library

    HRESULT hr = CoInitialize(NULL);

    if (SUCCEEDED(hr))
    {
        // Create the main window and enter the message loop

        RunGetImage();

        // Close the COM library

        CoUninitialize();
    }

    return 0;
}

Variable Documentation

HINSTANCE g_hInstance = 0

Definition at line 18 of file GetImage.cpp.

Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/wia/GetImage/MainWnd.cpp File Reference

  • Multimedia
  • wia
  • GetImage
Functions

MainWnd.cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include "WiaWrap.h"
#include "BitmapWnd.h"
#include "MainWnd.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CMainWindow

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 76 of file MainWnd.cpp.

{
    LONG cRef = InterlockedDecrement(&m_cRef);

    if (cRef == 0)
    {
        delete this;
    }

    return cRef;
}

Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/wia/GetImage/MainWnd.h File Reference

  • Multimedia
  • wia
  • GetImage
Classes

MainWnd.h File Reference

#include "EventCallback.h"

Go to the source code of this file.

Classes

class CMainWindow
Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/wia/GetImage/ProgressDlg.cpp File Reference

  • Multimedia
  • wia
  • GetImage
Namespaces | Functions

ProgressDlg.cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include "ProgressDlg.h"

Go to the source code of this file.

Namespaces

namespace WiaWrap

Functions

WiaWrap::STDMETHODIMP_ (ULONG) CDataCallback
Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/wia/GetImage/ProgressDlg.h File Reference

  • Multimedia
  • wia
  • GetImage
Classes | Namespaces

ProgressDlg.h File Reference

Go to the source code of this file.

Classes

class | WiaWrap::CProgressDlg

Namespaces

namespace | WiaWrap
Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/wia/GetImage/resource.h File Reference

  • Multimedia
  • wia
  • GetImage
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | FIRST_MDI_CHILD 40008
#define | ID_FILE_EXIT 40002
#define | ID_FILE_FROM_SCANNER_OR_CAMERA 40001
#define | ID_HELP_ABOUT 40007
#define | ID_WINDOW_ARRANGE_ICONS 40006
#define | ID_WINDOW_CASCADE 40003
#define | ID_WINDOW_TILE_HORIZONTALLY 40004
#define | ID_WINDOW_TILE_VERTICALLY 40005
#define | IDC_MESSAGE 1001
#define | IDC_PROGRESS_BAR 1000
#define | IDD_PROGRESS 102
#define | IDR_MENU 101
#define | IDS_APP_NAME 1
#define | IDS_BITMAP_WINDOW_TITLE 3
#define | IDS_ERROR_GET_IMAGE_DLG 8
#define | IDS_MAIN_WINDOW_TITLE 2
#define | IDS_STATUS_PROCESSING_DATA 6
#define | IDS_STATUS_TRANSFER_FROM_DEVICE 5
#define | IDS_STATUS_TRANSFER_TO_CLIENT 7
#define | IDS_WAIT 4
#define | WINDOW_MENU_POSITION 1

Define Documentation

#define FIRST_MDI_CHILD 40008

Definition at line 25 of file resource.h.

#define ID_FILE_EXIT 40002

Definition at line 19 of file resource.h.

#define ID_FILE_FROM_SCANNER_OR_CAMERA 40001

Definition at line 18 of file resource.h.

#define ID_HELP_ABOUT 40007

Definition at line 24 of file resource.h.

#define ID_WINDOW_ARRANGE_ICONS 40006

Definition at line 23 of file resource.h.

#define ID_WINDOW_CASCADE 40003

Definition at line 20 of file resource.h.

#define ID_WINDOW_TILE_HORIZONTALLY 40004

Definition at line 21 of file resource.h.

#define ID_WINDOW_TILE_VERTICALLY 40005

Definition at line 22 of file resource.h.

#define IDC_MESSAGE 1001

Definition at line 17 of file resource.h.

#define IDC_PROGRESS_BAR 1000

Definition at line 16 of file resource.h.

#define IDD_PROGRESS 102

Definition at line 15 of file resource.h.

#define IDR_MENU 101

Definition at line 14 of file resource.h.

#define IDS_APP_NAME 1

Definition at line 6 of file resource.h.

#define IDS_BITMAP_WINDOW_TITLE 3

Definition at line 8 of file resource.h.

#define IDS_ERROR_GET_IMAGE_DLG 8

Definition at line 13 of file resource.h.

#define IDS_MAIN_WINDOW_TITLE 2

Definition at line 7 of file resource.h.

#define IDS_STATUS_PROCESSING_DATA 6

Definition at line 11 of file resource.h.

#define IDS_STATUS_TRANSFER_FROM_DEVICE 5

Definition at line 10 of file resource.h.

#define IDS_STATUS_TRANSFER_TO_CLIENT 7

Definition at line 12 of file resource.h.

#define IDS_WAIT 4

Definition at line 9 of file resource.h.

#define WINDOW_MENU_POSITION 1

Definition at line 5 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/wia/GetImage/StdAfx.cpp File Reference

  • Multimedia
  • wia
  • GetImage

StdAfx.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/wia/GetImage/StdAfx.h File Reference

  • Multimedia
  • wia
  • GetImage
Defines | Variables

StdAfx.h File Reference

#include <tchar.h>
#include <stdio.h>
#include <windows.h>
#include <commctrl.h>
#include <shellapi.h>
#include <objbase.h>
#include <atlbase.h>
#include <wia.h>
#include <sti.h>
#include <gdiplus.h>

Go to the source code of this file.

Defines

#define | COUNTOF(x) ( sizeof(x) / sizeof(*x) )
#define | DEFAULT_STRING_SIZE 256
#define | WIN32_LEAN_AND_MEAN

Variables

HINSTANCE | g_hInstance

Define Documentation

#define COUNTOF ( x ) ( sizeof(x) / sizeof(*x) )

Definition at line 29 of file StdAfx.h.

#define DEFAULT_STRING_SIZE 256

Definition at line 31 of file StdAfx.h.

#define WIN32_LEAN_AND_MEAN

Definition at line 15 of file StdAfx.h.

Variable Documentation

HINSTANCE g_hInstance

Definition at line 104 of file SServer.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/wia/GetImage/WiaWrap.cpp File Reference

  • Multimedia
  • wia
  • GetImage
Namespaces | Defines | Functions

WiaWrap.cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include "DataCallback.h"
#include "ProgressDlg.h"
#include "WiaWrap.h"

Go to the source code of this file.

Namespaces

namespace | WiaWrap

Defines

#define | MAX_GUID_STRING_LEN 39

Functions

HRESULT CALLBACK | WiaWrap::DefaultProgressCallback (LONG lStatus, LONG lPercentComplete, PVOID pParam)
HRESULT | WiaWrap::ReadPropertyGuid (IWiaPropertyStorage *pWiaPropertyStorage, const PROPSPEC *pPropSpec, GUID *pguidResult)
HRESULT | WiaWrap::ReadPropertyLong (IWiaPropertyStorage *pWiaPropertyStorage, const PROPSPEC *pPropSpec, LONG *plResult)
HRESULT | WiaWrap::WiaGetImage (HWND hWndParent, LONG lDeviceType, LONG lFlags, LONG lIntent, IWiaDevMgr *pSuppliedWiaDevMgr, IWiaItem *pSuppliedItemRoot, PFNPROGRESSCALLBACK pfnProgressCallback, PVOID pProgressCallbackParam, GUID *pguidFormat, LONG *plCount, IStream ***pppStream)
HRESULT | WiaWrap::WiaGetNumDevices (IWiaDevMgr *pSuppliedWiaDevMgr, ULONG *pulNumDevices)

Define Documentation

#define MAX_GUID_STRING_LEN 39

Definition at line 24 of file WiaWrap.cpp.

Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/wia/GetImage/WiaWrap.h File Reference

  • Multimedia
  • wia
  • GetImage
Classes | Namespaces | Typedefs | Functions

WiaWrap.h File Reference

Go to the source code of this file.

Classes

class | WiaWrap::CComPtrArray< T >

Namespaces

namespace | WiaWrap

Typedefs

typedef HRESULT(CALLBACK * | WiaWrap::PFNPROGRESSCALLBACK )(LONG lStatus, LONG lPercentComplete, PVOID pParam)

Functions

HRESULT | WiaWrap::ReadPropertyGuid (IWiaPropertyStorage *pWiaPropertyStorage, const PROPSPEC *pPropSpec, GUID *pguidResult)
HRESULT | WiaWrap::ReadPropertyLong (IWiaPropertyStorage *pWiaPropertyStorage, const PROPSPEC *pPropSpec, LONG *plResult)
HRESULT | WiaWrap::WiaGetImage (HWND hWndParent, LONG lDeviceType, LONG lFlags, LONG lIntent, IWiaDevMgr *pSuppliedWiaDevMgr, IWiaItem *pSuppliedItemRoot, PFNPROGRESSCALLBACK pfnProgressCallback, PVOID pProgressCallbackParam, GUID *pguidFormat, LONG *plCount, IStream ***pppStream)
HRESULT | WiaWrap::WiaGetNumDevices (IWiaDevMgr *pSuppliedWiaDevMgr, ULONG *pulNumDevices)
Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/wia/wiassamp/wiassamp.cpp File Reference

  • Multimedia
  • wia
  • wiassamp
Classes | Functions

wiassamp.cpp File Reference

#include <windows.h>
#include <objbase.h>
#include <stdio.h>
#include <tchar.h>
#include <wia.h>

Go to the source code of this file.

Classes

class | CWiaDataCallback

Functions

int __cdecl | _tmain (int, TCHAR *[])
HRESULT | CreateWiaDevice (IWiaDevMgr *pWiaDevMgr, BSTR bstrDeviceID, IWiaItem **ppWiaDevice)
HRESULT | CreateWiaDeviceAndDoSomeStuff (IWiaDevMgr *pWiaDevMgr, IWiaPropertyStorage *pWiaPropertyStorage)
HRESULT | CreateWiaDeviceManager (IWiaDevMgr **ppWiaDevMgr)
HRESULT | EnumerateItems (IWiaItem *pWiaItem)
HRESULT | EnumerateWiaDevices (IWiaDevMgr *pWiaDevMgr)
HRESULT | PrintItemName (IWiaItem *pWiaItem)
HRESULT | ReadSomeWiaProperties (IWiaPropertyStorage *pWiaPropertyStorage)
void | ReportError (LPCTSTR pszMessage, HRESULT hr=S_OK)
HRESULT | TransferWiaItem (IWiaItem *pWiaItem)

Function Documentation

int __cdecl _tmain | ( | int | ,
 |  | TCHAR * | []
 | ) |  |

Definition at line 828 of file wiassamp.cpp.

{
    //
    // Initialize COM
    //
    HRESULT hr = CoInitialize(NULL);
    if (SUCCEEDED(hr))
    {
        //
        // Create the device manager
        //
        IWiaDevMgr *pWiaDevMgr = NULL;
        hr = CreateWiaDeviceManager( &pWiaDevMgr );
        if (SUCCEEDED(hr))
        {
            //
            // Enumerate all of the WIA devices
            //
            hr = EnumerateWiaDevices( pWiaDevMgr );
            if (FAILED(hr))
            {
                ReportError( TEXT("Error calling EnumerateWiaDevices"), hr );
            }

            //
            // Release the device manager
            //
            pWiaDevMgr->Release();
            pWiaDevMgr = NULL;
        }
        else
        {
            ReportError( TEXT("Error calling CreateWiaDeviceManager"), hr );
        }

        //
        // Uninitialize COM
        //
        CoUninitialize();
    }
    return 0;
}

HRESULT CreateWiaDevice | ( | IWiaDevMgr * | pWiaDevMgr,
 |  | BSTR | bstrDeviceID,
 |  | IWiaItem ** | ppWiaDevice
 | ) |  |

Definition at line 378 of file wiassamp.cpp.

{
    //
    // Validate arguments
    //
    if (NULL == pWiaDevMgr || NULL == bstrDeviceID || NULL == ppWiaDevice)
    {
        return E_INVALIDARG;
    }

    //
    // Initialize out variables
    //
    *ppWiaDevice = NULL;

    //
    // Create the WIA Device
    //
    HRESULT hr = pWiaDevMgr->CreateDevice( bstrDeviceID, ppWiaDevice );
    if (FAILED(hr))
    {
        ReportError( TEXT("Error calling IWiaDevMgr::CreateDevice"), hr );
    }

    //
    // Return the result of creating the device
    //
    return hr;
}

HRESULT CreateWiaDeviceAndDoSomeStuff | ( | IWiaDevMgr * | pWiaDevMgr,
 |  | IWiaPropertyStorage * | pWiaPropertyStorage
 | ) |  |

Definition at line 640 of file wiassamp.cpp.

{
    //
    // Validate arguments
    //
    if (NULL == pWiaPropertyStorage)
    {
        return E_INVALIDARG;
    }

    //
    // Declare PROPSPECs and PROPVARIANTs, and initialize them to zero.
    //
    PROPSPEC PropSpec[1] = {0};
    PROPVARIANT PropVar[1] = {0};

    //
    // How many properties are we querying for?
    //
    const ULONG c_nPropertyCount = sizeof(PropSpec)/sizeof(PropSpec[0]);

    //
    // Define which properties we want to read.  We want the
    // device ID, so we can create the device.
    //
    PropSpec[0].ulKind = PRSPEC_PROPID;
    PropSpec[0].propid = WIA_DIP_DEV_ID;

    //
    // Ask for the property values
    //
    HRESULT hr = pWiaPropertyStorage->ReadMultiple( c_nPropertyCount, PropSpec, PropVar );
    if (SUCCEEDED(hr))
    {
        //
        // Check the return type for the device ID to make
        // sure this property was actually read.
        //
        if (VT_BSTR == PropVar[0].vt)
        {
            //
            // Create the WIA device, which results in obtaining
            // the root IWiaItem
            //
            IWiaItem *pWiaRootItem = NULL;
            hr = CreateWiaDevice( pWiaDevMgr, PropVar[0].bstrVal, &pWiaRootItem );
            if (SUCCEEDED(hr))
            {
                //
                // Recursively enumerate the items
                // (This function will also do some stuff with each item)
                //
                hr = EnumerateItems( pWiaRootItem );

                //
                // Free the root item
                //
                pWiaRootItem->Release();
                pWiaRootItem = NULL;
            }
            else
            {
                ReportError( TEXT("Error calling CreateWiaDevice"), hr );
            }
        }

        //
        // Free the returned PROPVARIANTs
        //
        FreePropVariantArray( c_nPropertyCount, PropVar );
    }
    else
    {
        ReportError( TEXT("Error calling IWiaPropertyStorage::ReadMultiple"), hr );
    }

    //
    // Return the result of all of this
    //
    return hr;
}

HRESULT CreateWiaDeviceManager ( IWiaDevMgr ** ppWiaDevMgr )

Definition at line 408 of file wiassamp.cpp.

{
    //
    // Validate arguments
    //
    if (NULL == ppWiaDevMgr)
    {
        return E_INVALIDARG;
    }

    //
    // Initialize out variables
    //
    *ppWiaDevMgr = NULL;

    //
    // Create an instance of the device manager
    //
    HRESULT hr = CoCreateInstance( CLSID_WiaDevMgr, NULL, CLSCTX_LOCAL_SERVER, IID_IWiaDevMgr, (void**)ppWiaDevMgr );
    if (FAILED(hr))
    {
        ReportError( TEXT("CoCreateInstance failed on CLSID_WiaDevMgr"), hr );
    }

    //
    // Return the result of creating the device manager
    //
    return hr;
}

HRESULT EnumerateItems ( IWiaItem * pWiaItem )

Definition at line 540 of file wiassamp.cpp.

{
    //
    // Validate arguments
    //
    if (NULL == pWiaItem)
    {
        return E_INVALIDARG;
    }

    //
    // Get the item type for this item
    //
    LONG lItemType = 0;
    HRESULT hr = pWiaItem->GetItemType( &lItemType );

    //
    // Do something with this item.  Print the item name.
    //
    PrintItemName( pWiaItem );

    //
    // If this is an image, transfer it
    //
    if (lItemType & WiaItemTypeImage)
    {
        hr = TransferWiaItem( pWiaItem );
    }

    //
    // If it is a folder, or it has attachments, enumerate its children
    //
    if (lItemType & WiaItemTypeFolder ||
        lItemType & WiaItemTypeHasAttachments)
    {
        //
        // Get the child item enumerator for this item
        //
        IEnumWiaItem *pEnumWiaItem = NULL;
        hr = pWiaItem->EnumChildItems( &pEnumWiaItem );
        if (SUCCEEDED(hr))
        {
            //
            // We will loop until we get an error or pEnumWiaItem->Next returns
            // S_FALSE to signal the end of the list.
            //
            while (S_OK == hr)
            {
                //
                // Get the next child item
                //
                IWiaItem *pChildWiaItem = NULL;
                hr = pEnumWiaItem->Next( 1, &pChildWiaItem, NULL );

                //
                // pEnumWiaItem->Next will return S_FALSE when the list is
                // exhausted, so check for S_OK before using the returned
                // value.
                //
                if (S_OK == hr)
                {
                    //
                    // Recurse into this item
                    //
                    hr = EnumerateItems( pChildWiaItem );

                    //
                    // Release this item
                    //
                    pChildWiaItem->Release();
                    pChildWiaItem = NULL;
                }
                else if (FAILED(hr))
                {
                    //
                    // Report that an error occurred during enumeration
                    //
                    ReportError( TEXT("Error calling pEnumWiaItem->Next"), hr );
                }
            }

            //
            // If the result of the enumeration is S_FALSE, since this
            // is normal, we will change it to S_OK
            //
            if (S_FALSE == hr)
            {
                hr = S_OK;
            }

            //
            // Release the enumerator
            //
            pEnumWiaItem->Release();
            pEnumWiaItem = NULL;
        }
    }
    return  hr;
}

HRESULT EnumerateWiaDevices ( IWiaDevMgr * pWiaDevMgr )

Definition at line 722 of file wiassamp.cpp.

{
    //
    // Validate arguments
    //
    if (NULL == pWiaDevMgr)
    {
        return E_INVALIDARG;
    }

    //
    // Get a device enumerator interface
    //
    IEnumWIA_DEV_INFO *pWiaEnumDevInfo = NULL;
    HRESULT hr = pWiaDevMgr->EnumDeviceInfo( WIA_DEVINFO_ENUM_LOCAL, &pWiaEnumDevInfo );
    if (SUCCEEDED(hr))
    {
        //
        // Reset the device enumerator to the beginning of the list
        //
        hr = pWiaEnumDevInfo->Reset();
        if (SUCCEEDED(hr))
        {
            //
            // We will loop until we get an error or pWiaEnumDevInfo->Next returns
            // S_FALSE to signal the end of the list.
            //
            while (S_OK == hr)
            {
                //
                // Get the next device's property storage interface pointer
                //
                IWiaPropertyStorage *pWiaPropertyStorage = NULL;
                hr = pWiaEnumDevInfo->Next( 1, &pWiaPropertyStorage, NULL );

                //
                // pWiaEnumDevInfo->Next will return S_FALSE when the list is
                // exhausted, so check for S_OK before using the returned
                // value.
                //
                if (hr == S_OK)
                {
                    //
                    // Do something with the device's IWiaPropertyStorage*
                    //
                    ReadSomeWiaProperties( pWiaPropertyStorage );

                    //
                    // Call a helper function to create the device
                    // and do some stuff with it.
                    //
                    CreateWiaDeviceAndDoSomeStuff( pWiaDevMgr, pWiaPropertyStorage );

                    //
                    // Release the device's IWiaPropertyStorage*
                    //
                    pWiaPropertyStorage->Release();
                    pWiaPropertyStorage = NULL;
                }
                else if (FAILED(hr))
                {
                    //
                    // Report that an error occurred during enumeration
                    //
                    ReportError( TEXT("Error calling pWiaEnumDevInfo->Next"), hr );
                }
            }

            //
            // If the result of the enumeration is S_FALSE, since this
            // is normal, we will change it to S_OK.
            //
            if (S_FALSE == hr)
            {
                hr = S_OK;
            }
        }
        else
        {
            //
            // Report that an error occurred calling Reset()
            //
            ReportError( TEXT("Error calling IEnumWIA_DEV_INFO::Reset()"), hr );
        }

        //
        // Release the enumerator
        //
        pWiaEnumDevInfo->Release();
        pWiaEnumDevInfo = NULL;
    }
    else
    {
        //
        // Report that an error occurred trying to create the enumerator
        //
        ReportError( TEXT("Error calling IWiaDevMgr::EnumDeviceInfo"), hr );
    }

    //
    // Return the result of the enumeration
    //
    return hr;
}

HRESULT PrintItemName ( IWiaItem * pWiaItem )

Definition at line 296 of file wiassamp.cpp.

{
    //
    // Validate arguments
    //
    if (NULL == pWiaItem)
    {
        return E_INVALIDARG;
    }

    //
    // Get the IWiaPropertyStorage interface
    //
    IWiaPropertyStorage *pWiaPropertyStorage = NULL;
    HRESULT hr = pWiaItem->QueryInterface( IID_IWiaPropertyStorage, (void**)&pWiaPropertyStorage );
    if (SUCCEEDED(hr))
    {
        //
        // Declare PROPSPECs and PROPVARIANTs, and initialize them to zero.
        //
        PROPSPEC PropSpec[1] = {0};
        PROPVARIANT PropVar[1] = {0};

        //
        // How many properties are we querying for?
        //
        const ULONG c_nPropertyCount = sizeof(PropSpec)/sizeof(PropSpec[0]);

        //
        // Define which properties we want to read:
        // Device ID.  This is what we'd use to create
        // the device.
        //
        PropSpec[0].ulKind = PRSPEC_PROPID;
        PropSpec[0].propid = WIA_IPA_FULL_ITEM_NAME;

        //
        // Ask for the property values
        //
        hr = pWiaPropertyStorage->ReadMultiple( c_nPropertyCount, PropSpec, PropVar );
        if (SUCCEEDED(hr))
        {
            //
            // IWiaPropertyStorage::ReadMultiple will return S_FALSE if some
            // properties could not be read, so we have to check the return
            // types for each requested item.
            //

            //
            // Check the return type for the device ID
            //
            if (VT_BSTR == PropVar[0].vt)
            {
                //
                // Do something with the device ID
                //
                _tprintf( TEXT("Item Name: %ws\n"), PropVar[0].bstrVal );
            }

            //
            // Free the returned PROPVARIANTs
            //
            FreePropVariantArray( c_nPropertyCount, PropVar );
        }
        else
        {
            ReportError( TEXT("Error calling IWiaPropertyStorage::ReadMultiple"), hr );
        }

        //
        // Release the IWiaPropertyStorage interface
        //
        pWiaPropertyStorage->Release();
        pWiaPropertyStorage = NULL;
    }

    //
    // Return the result of reading the properties
    //
    return hr;
}

HRESULT ReadSomeWiaProperties ( IWiaPropertyStorage * pWiaPropertyStorage )

Definition at line 438 of file wiassamp.cpp.

{
    //
    // Validate arguments
    //
    if (NULL == pWiaPropertyStorage)
    {
        return E_INVALIDARG;
    }

    //
    // Declare PROPSPECs and PROPVARIANTs, and initialize them to zero.
    //
    PROPSPEC PropSpec[3] = {0};
    PROPVARIANT PropVar[3] = {0};

    //
    // How many properties are we querying for?
    //
    const ULONG c_nPropertyCount = sizeof(PropSpec)/sizeof(PropSpec[0]);

    //
    // Define which properties we want to read:
    // Device ID.  This is what we'd use to create
    // the device.
    //
    PropSpec[0].ulKind = PRSPEC_PROPID;
    PropSpec[0].propid = WIA_DIP_DEV_ID;

    //
    // Device Name
    //
    PropSpec[1].ulKind = PRSPEC_PROPID;
    PropSpec[1].propid = WIA_DIP_DEV_NAME;

    //
    // Device description
    //
    PropSpec[2].ulKind = PRSPEC_PROPID;
    PropSpec[2].propid = WIA_DIP_DEV_DESC;

    //
    // Ask for the property values
    //
    HRESULT hr = pWiaPropertyStorage->ReadMultiple( c_nPropertyCount, PropSpec, PropVar );
    if (SUCCEEDED(hr))
    {
        //
        // IWiaPropertyStorage::ReadMultiple will return S_FALSE if some
        // properties could not be read, so we have to check the return
        // types for each requested item.
        //

        //
        // Check the return type for the device ID
        //
        if (VT_BSTR == PropVar[0].vt)
        {
            //
            // Do something with the device ID
            //
            _tprintf( TEXT("WIA_DIP_DEV_ID: %ws\n"), PropVar[0].bstrVal );
        }

        //
        // Check the return type for the device name
        //
        if (VT_BSTR == PropVar[1].vt)
        {
            //
            // Do something with the device name
            //
            _tprintf( TEXT("WIA_DIP_DEV_NAME: %ws\n"), PropVar[1].bstrVal );
        }

        //
        // Check the return type for the device description
        //
        if (VT_BSTR == PropVar[2].vt)
        {
            //
            // Do something with the device description
            //
            _tprintf( TEXT("WIA_DIP_DEV_DESC: %ws\n"), PropVar[2].bstrVal );
        }

        //
        // Free the returned PROPVARIANTs
        //
        FreePropVariantArray( c_nPropertyCount, PropVar );
    }
    else
    {
        ReportError( TEXT("Error calling IWiaPropertyStorage::ReadMultiple"), hr );
    }

    //
    // Return the result of reading the properties
    //
    return hr;
}

void ReportError | ( | LPCTSTR | pszMessage,
 |  | HRESULT | hr = S_OK
 | ) |  |

Definition at line 32 of file wiassamp.cpp.

{
    if (S_OK != hr)
    {
        _tprintf( TEXT("%s: HRESULT: 0x%08X\n"), pszMessage, hr );
    }
    else
    {
        _tprintf( TEXT("%s\n"), pszMessage );
    }
}

HRESULT TransferWiaItem ( IWiaItem * pWiaItem )

Definition at line 153 of file wiassamp.cpp.

{
    //
    // Validate arguments
    //
    if (NULL == pWiaItem)
    {
        return E_INVALIDARG;
    }

    //
    // Get the IWiaPropertyStorage interface so we can set required properties
    //
    IWiaPropertyStorage *pWiaPropertyStorage = NULL;
    HRESULT hr = pWiaItem->QueryInterface( IID_IWiaPropertyStorage, (void**)&pWiaPropertyStorage );
    if (SUCCEEDED(hr))
    {
        //
        // Prepare PROPSPECs and PROPVARIANTs for setting the
        // media type and format
        //
        PROPSPEC PropSpec[2] = {0};
        PROPVARIANT PropVariant[2] = {0};
        const ULONG c_nPropCount = sizeof(PropVariant)/sizeof(PropVariant[0]);

        //
        // Use BMP as the output format
        //
        GUID guidOutputFormat = WiaImgFmt_BMP;

        //
        // Initialize the PROPSPECs
        //
        PropSpec[0].ulKind = PRSPEC_PROPID;
        PropSpec[0].propid = WIA_IPA_FORMAT;
        PropSpec[1].ulKind = PRSPEC_PROPID;
        PropSpec[1].propid = WIA_IPA_TYMED;

        //
        // Initialize the PROPVARIANTs
        //
        PropVariant[0].vt = VT_CLSID;
        PropVariant[0].puuid = &guidOutputFormat;
        PropVariant[1].vt = VT_I4;
        PropVariant[1].lVal = TYMED_FILE;

        //
        // Set the properties
        //
        hr = pWiaPropertyStorage->WriteMultiple( c_nPropCount, PropSpec, PropVariant, WIA_IPA_FIRST );
        if (SUCCEEDED(hr))
        {
            //
            // Get the IWiaDataTransfer interface
            //
            IWiaDataTransfer *pWiaDataTransfer = NULL;
            hr = pWiaItem->QueryInterface( IID_IWiaDataTransfer, (void**)&pWiaDataTransfer );
            if (SUCCEEDED(hr))
            {
                //
                // Create our callback class
                //
                CWiaDataCallback *pCallback = new CWiaDataCallback;
                if (pCallback)
                {
                    //
                    // Get the IWiaDataCallback interface from our callback class.
                    //
                    IWiaDataCallback *pWiaDataCallback = NULL;
                    hr = pCallback->QueryInterface( IID_IWiaDataCallback, (void**)&pWiaDataCallback );
                    if (SUCCEEDED(hr))
                    {
                        //
                        // Perform the transfer using default settings
                        //
                        STGMEDIUM stgMedium = {0};
                        hr = pWiaDataTransfer->idtGetData( &stgMedium, pWiaDataCallback );
                        if (S_OK == hr)
                        {
                            //
                            // Print the filename (note that this filename is always
                            // a WCHAR string, not TCHAR.
                            //
                            _tprintf( TEXT("Transferred filename: %ws\n"), stgMedium.lpszFileName );

                            //
                            // Release any memory associated with the stgmedium
                            //
                            ReleaseStgMedium( &stgMedium );
                        }
                        else
                        {
                            ReportError( TEXT("pWiaDataTransfer->idtGetData failed"), hr );
                        }

                        //
                        // Release the callback interface
                        //
                        pWiaDataCallback->Release();
                        pWiaDataCallback = NULL;
                    }
                    else
                    {
                        ReportError( TEXT("pCallback->QueryInterface failed on IID_IWiaDataCallback"), hr );
                    }

                    //
                    // Release our callback.  It should now delete itself.
                    //
                    pCallback->Release();
                    pCallback = NULL;
                }
                else
                {
                    ReportError( TEXT("Unable to create CWiaDataCallback class instance") );
                }

                //
                // Release the IWiaDataTransfer
                //
                pWiaDataTransfer->Release();
                pWiaDataTransfer = NULL;
            }
            else
            {
                ReportError( TEXT("pWiaItem->QueryInterface failed on IID_IWiaDataTransfer"), hr );
            }
        }

        //
        // Release the IWiaPropertyStorage
        //
        pWiaPropertyStorage->Release();
        pWiaPropertyStorage = NULL;
    }
    else
    {
        ReportError( TEXT("pWiaItem->QueryInterface failed on IID_IWiaPropertyStorage"), hr );
    }

    return hr;
}

Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/Authentication/Authenticate.cpp File Reference

  • Multimedia
  • WindowsMediaServices9
  • Authentication
Functions | Variables

Authenticate.cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include "Authenticate.h"
#include "AuthenticatePlugin.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 51 of file Authenticate.cpp.

{
    return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 59 of file Authenticate.cpp.

{
    return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 36 of file Authenticate.cpp.

{
    if (dwReason == DLL_PROCESS_ATTACH)
    {
        _Module.Init(ObjectMap, hInstance, &LIBID_AUTHENTICATEPLUGINLib);
        DisableThreadLibraryCalls(hInstance);
    }
    else if (dwReason == DLL_PROCESS_DETACH)
        _Module.Term();
    return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 67 of file Authenticate.cpp.

{
    // registers object, typelib and all interfaces in typelib
    return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 76 of file Authenticate.cpp.

{
    return _Module.UnregisterServer(TRUE);
}

Variable Documentation

CComModule _Module

Definition at line 26 of file Authenticate.cpp.

Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/Authentication/Authenticate.idl File Reference

  • Multimedia
  • WindowsMediaServices9
  • Authentication
Classes | Namespaces | Functions

Authenticate.idl File Reference

Go to the source code of this file.

Classes

class | AUTHENTICATEPLUGINLib::AuthenticateAdmin
class | AUTHENTICATEPLUGINLib::AuthenticateContext
class | AUTHENTICATEPLUGINLib::AuthenticatePlugin
interface | IAuthenticateAdmin
interface | IAuthenticateContext
interface | IAuthenticatePlugin

Namespaces

namespace | AUTHENTICATEPLUGINLib

Functions

EXTERN_GUID (LIBID_AUTHENTICATEPLUGINLib, 0x5D3BABFB, 0x48A8, 0x4BC8, 0xB1, 0xE9, 0x13, 0x0D, 0x3F, 0x74, 0x91, 0xFC)
EXTERN_GUID (CLSID_AuthenticatePlugin, 0x394D8DC7, 0x5F9D, 0x4B42, 0x95, 0xF1, 0x1B, 0x35, 0xF4, 0xFE, 0x96, 0x8C)
EXTERN_GUID (IID_AuthenticateContext, 0x2673E72B, 0x1132, 0x4EF2, 0x81, 0x9C, 0xC1, 0xE1, 0x9B, 0xCB, 0x00, 0xBA)
EXTERN_GUID (IID_IAuthenticateAdmin, 0xD2DFF596, 0xE522, 0x4923, 0xB0, 0x9E, 0x9C, 0xAA, 0x43, 0xDE, 0xC5, 0xB0)
EXTERN_GUID (CLSID_AuthenticateAdmin, 0xE0B7D97C, 0x32AB, 0x4540, 0x95, 0x2E, 0xD5, 0xC3, 0xA8, 0xBA, 0x43, 0xA4)
EXTERN_GUID (CLSID_AuthenticateContext, 0x216A00A7, 0x1C9F, 0x4550, 0x97, 0xC0, 0x63, 0xA2, 0x1F, 0x63, 0x2C, 0xFB)
AUTHENTICATEPLUGINLib::importlib ("stdole2.tlb")
AUTHENTICATEPLUGINLib::importlib ("stdole32.tlb")

Function Documentation

EXTERN_GUID | ( | LIBID_AUTHENTICATEPLUGINLib | ,
 |  | 0x5D3BABFB | ,
 |  | 0x48A8 | ,
 |  | 0x4BC8 | ,
 |  | 0xB1 | ,
 |  | 0xE9 | ,
 |  | 0x13 | ,
 |  | 0x0D | ,
 |  | 0x3F | ,
 |  | 0x74 | ,
 |  | 0x91 | ,
 |  | 0xFC |
 | ) |  |
EXTERN_GUID | ( | CLSID_AuthenticatePlugin | ,
 |  | 0x394D8DC7 | ,
 |  | 0x5F9D | ,
 |  | 0x4B42 | ,
 |  | 0x95 | ,
 |  | 0xF1 | ,
 |  | 0x1B | ,
 |  | 0x35 | ,
 |  | 0xF4 | ,
 |  | 0xFE | ,
 |  | 0x96 | ,
 |  | 0x8C |
 | ) |  |
EXTERN_GUID | ( | IID_AuthenticateContext | ,
 |  | 0x2673E72B | ,
 |  | 0x1132 | ,
 |  | 0x4EF2 | ,
 |  | 0x81 | ,
 |  | 0x9C | ,
 |  | 0xC1 | ,
 |  | 0xE1 | ,
 |  | 0x9B | ,
 |  | 0xCB | ,
 |  | 0x00 | ,
 |  | 0xBA |
 | ) |  |
EXTERN_GUID | ( | IID_IAuthenticateAdmin | ,
 |  | 0xD2DFF596 | ,
 |  | 0xE522 | ,
 |  | 0x4923 | ,
 |  | 0xB0 | ,
 |  | 0x9E | ,
 |  | 0x9C | ,
 |  | 0xAA | ,
 |  | 0x43 | ,
 |  | 0xDE | ,
 |  | 0xC5 | ,
 |  | 0xB0 |
 | ) |  |
EXTERN_GUID | ( | CLSID_AuthenticateAdmin | ,
 |  | 0xE0B7D97C | ,
 |  | 0x32AB | ,
 |  | 0x4540 | ,
 |  | 0x95 | ,
 |  | 0x2E | ,
 |  | 0xD5 | ,
 |  | 0xC3 | ,
 |  | 0xA8 | ,
 |  | 0xBA | ,
 |  | 0x43 | ,
 |  | 0xA4 |
 | ) |  |
EXTERN_GUID | ( | CLSID_AuthenticateContext | ,
 |  | 0x216A00A7 | ,
 |  | 0x1C9F | ,
 |  | 0x4550 | ,
 |  | 0x97 | ,
 |  | 0xC0 | ,
 |  | 0x63 | ,
 |  | 0xA2 | ,
 |  | 0x1F | ,
 |  | 0x63 | ,
 |  | 0x2C | ,
 |  | 0xFB |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/Authentication/AuthenticateAdmin.cpp File Reference

  • Multimedia
  • WindowsMediaServices9
  • Authentication

AuthenticateAdmin.cpp File Reference

#include "stdafx.h"
#include "Authenticate.h"
#include "AuthenticateAdmin.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/Authentication/AuthenticateAdmin.h File Reference

  • Multimedia
  • WindowsMediaServices9
  • Authentication
Classes

AuthenticateAdmin.h File Reference

#include "resource.h"
#include "AuthenticatePlugin.h"

Go to the source code of this file.

Classes

class CAuthenticateAdmin
Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/Authentication/AuthenticateContext.cpp File Reference

  • Multimedia
  • WindowsMediaServices9
  • Authentication
Defines

AuthenticateContext.cpp File Reference

#include "stdafx.h"
#include "Authenticate.h"
#include "AuthenticatePlugin.h"
#include "AuthenticateContext.h"

Go to the source code of this file.

Defines

#define | ANON_DOMAIN L""
#define | ANON_PSWD L""
#define | ANON_USER L""
#define | REALM_NAME L"MyRealm"

Define Documentation

#define ANON_DOMAIN L""

Definition at line 22 of file AuthenticateContext.cpp.

#define ANON_PSWD L""

Definition at line 24 of file AuthenticateContext.cpp.

#define ANON_USER L""

Definition at line 23 of file AuthenticateContext.cpp.

#define REALM_NAME L"MyRealm"

Definition at line 21 of file AuthenticateContext.cpp.

Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/Authentication/AuthenticateContext.h File Reference

  • Multimedia
  • WindowsMediaServices9
  • Authentication
Classes

AuthenticateContext.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class CAuthenticateContext
Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/Authentication/AuthenticatePlugin.cpp File Reference

  • Multimedia
  • WindowsMediaServices9
  • Authentication
Defines

AuthenticatePlugin.cpp File Reference

#include "stdafx.h"
#include "Authenticate.h"
#include "AuthenticatePlugin.h"
#include "AuthenticateAdmin.h"
#include "AuthenticateContext.h"

Go to the source code of this file.

Defines

#define | PACKET_NAME "MyPackage"
#define | PROTOCOL_NAME "Anonymous User"

Define Documentation

#define PACKET_NAME "MyPackage"

Definition at line 18 of file AuthenticatePlugin.cpp.

#define PROTOCOL_NAME "Anonymous User"

Definition at line 19 of file AuthenticatePlugin.cpp.

Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/Authentication/AuthenticatePlugin.h File Reference

  • Multimedia
  • WindowsMediaServices9
  • Authentication
Classes

AuthenticatePlugin.h File Reference

#include "resource.h"
#include "WMSContextNames.h"

Go to the source code of this file.

Classes

class CAuthenticatePlugin
Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/Authentication/resource.h File Reference

  • Multimedia
  • WindowsMediaServices9
  • Authentication
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_AUTHENTICATEADMIN 102
#define | IDR_AUTHENTICATECONTEXT 103
#define | IDR_AUTHENTICATEPLUGIN 101
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_AUTHENTICATEADMIN 102

Definition at line 17 of file resource.h.

#define IDR_AUTHENTICATECONTEXT 103

Definition at line 18 of file resource.h.

#define IDR_AUTHENTICATEPLUGIN 101

Definition at line 16 of file resource.h.

#define IDS_PROJNAME 100

Definition at line 15 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/Authentication/StdAfx.cpp File Reference

  • Multimedia
  • WindowsMediaServices9
  • Authentication

StdAfx.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/Authentication/StdAfx.h File Reference

  • Multimedia
  • WindowsMediaServices9
  • Authentication
Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>
#include <msxml2.h>
#include <WMSBasicPlugin.h>
#include <authen.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0400
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 27 of file StdAfx.h.

#define _WIN32_WINNT 0x0400

Definition at line 25 of file StdAfx.h.

#define STRICT

Definition at line 23 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/Authorization/dbauth.cpp File Reference

  • Multimedia
  • WindowsMediaServices9
  • Authorization
Functions | Variables

dbauth.cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include "DBAuth.h"
#include "DBAuthPlugin.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 49 of file dbauth.cpp.

{
    return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 57 of file dbauth.cpp.

{
    return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 34 of file dbauth.cpp.

{
    if (dwReason == DLL_PROCESS_ATTACH)
    {
        _Module.Init(ObjectMap, hInstance, &LIBID_DBAUTHPLUGINLib);
        DisableThreadLibraryCalls(hInstance);
    }
    else if (dwReason == DLL_PROCESS_DETACH)
        _Module.Term();
    return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 65 of file dbauth.cpp.

{
    // registers object, typelib and all interfaces in typelib
    return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 74 of file dbauth.cpp.

{
    return _Module.UnregisterServer(TRUE);
}

Variable Documentation

CComModule _Module

Definition at line 24 of file dbauth.cpp.

Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/Authorization/dbauth.idl File Reference

  • Multimedia
  • WindowsMediaServices9
  • Authorization
Classes | Namespaces | Functions

dbauth.idl File Reference

Go to the source code of this file.

Classes

interface | IDBAuthAdmin
interface | IDBAuthPlugin

Namespaces

namespace | DBAUTHPLUGINLib

Functions

EXTERN_GUID (LIBID_DBAUTHPLUGINLib, 0x0BC95C01, 0x9658, 0x49B5, 0xAC, 0xA3, 0xCB, 0xEA, 0x79, 0xB0, 0xDA, 0xE6)
EXTERN_GUID (CLSID_DBAuthPlugin, 0xBC8F17A9, 0xB5EB, 0x47F0, 0x96, 0x12, 0x34, 0x72, 0x5C, 0x6C, 0xFA, 0x32)
EXTERN_GUID (IID_IDBAuthAdmin, 0x5D5B4932, 0x8BE0, 0x4FDF, 0xB7, 0x3C, 0x49, 0x06, 0x81, 0x3D, 0x0F, 0xC3)
EXTERN_GUID (CLSID_DBAuthAdmin, 0x13DDFC98, 0xC330, 0x4E1E, 0xA7, 0x22, 0x62, 0x4C, 0x7E, 0x50, 0x79, 0x85)
DBAUTHPLUGINLib::importlib ("stdole2.tlb")
DBAUTHPLUGINLib::importlib ("stdole32.tlb")

Function Documentation

EXTERN_GUID | ( | LIBID_DBAUTHPLUGINLib | ,
 |  | 0x0BC95C01 | ,
 |  | 0x9658 | ,
 |  | 0x49B5 | ,
 |  | 0xAC | ,
 |  | 0xA3 | ,
 |  | 0xCB | ,
 |  | 0xEA | ,
 |  | 0x79 | ,
 |  | 0xB0 | ,
 |  | 0xDA | ,
 |  | 0xE6 |
 | ) |  |
EXTERN_GUID | ( | CLSID_DBAuthPlugin | ,
 |  | 0xBC8F17A9 | ,
 |  | 0xB5EB | ,
 |  | 0x47F0 | ,
 |  | 0x96 | ,
 |  | 0x12 | ,
 |  | 0x34 | ,
 |  | 0x72 | ,
 |  | 0x5C | ,
 |  | 0x6C | ,
 |  | 0xFA | ,
 |  | 0x32 |
 | ) |  |
EXTERN_GUID | ( | IID_IDBAuthAdmin | ,
 |  | 0x5D5B4932 | ,
 |  | 0x8BE0 | ,
 |  | 0x4FDF | ,
 |  | 0xB7 | ,
 |  | 0x3C | ,
 |  | 0x49 | ,
 |  | 0x06 | ,
 |  | 0x81 | ,
 |  | 0x3D | ,
 |  | 0x0F | ,
 |  | 0xC3 |
 | ) |  |
EXTERN_GUID | ( | CLSID_DBAuthAdmin | ,
 |  | 0x13DDFC98 | ,
 |  | 0xC330 | ,
 |  | 0x4E1E | ,
 |  | 0xA7 | ,
 |  | 0x22 | ,
 |  | 0x62 | ,
 |  | 0x4C | ,
 |  | 0x7E | ,
 |  | 0x50 | ,
 |  | 0x79 | ,
 |  | 0x85 |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/Authorization/dbauthadmin.cpp File Reference

  • Multimedia
  • WindowsMediaServices9
  • Authorization

dbauthadmin.cpp File Reference

#include "stdafx.h"
#include "DBAuth.h"
#include "DBAuthAdmin.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/Authorization/dbauthadmin.h File Reference

  • Multimedia
  • WindowsMediaServices9
  • Authorization
Classes

dbauthadmin.h File Reference

#include "resource.h"
#include "DBAuthPlugin.h"

Go to the source code of this file.

Classes

class CDBAuthAdmin
Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/Authorization/dbauthplugin.cpp File Reference

  • Multimedia
  • WindowsMediaServices9
  • Authorization
Defines | Variables

dbauthplugin.cpp File Reference

#include "stdafx.h"
#include "DBAuth.h"
#include "DBAuthPlugin.h"
#include "DBAuthAdmin.h"

Go to the source code of this file.

Defines

#define | AUTHORIZED_USERS_PROPERTY L"AuthorizedUsers"

Variables

const | NUM_AUTHORIZED_EVENTS = 1

Define Documentation

#define AUTHORIZED_USERS_PROPERTY L"AuthorizedUsers"

Definition at line 16 of file dbauthplugin.cpp.

Variable Documentation

const NUM_AUTHORIZED_EVENTS = 1

Definition at line 18 of file dbauthplugin.cpp.

Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/Authorization/dbauthplugin.h File Reference

  • Multimedia
  • WindowsMediaServices9
  • Authorization
Classes

dbauthplugin.h File Reference

#include "resource.h"
#include "wmsdefs.h"

Go to the source code of this file.

Classes

class | CDBAuthPlugin
class | CSids
Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/Authorization/resource.h File Reference

  • Multimedia
  • WindowsMediaServices9
  • Authorization
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_DBAUTHADMIN 102
#define | IDR_DBAUTHPLUGIN 101
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_DBAUTHADMIN 102

Definition at line 18 of file resource.h.

#define IDR_DBAUTHPLUGIN 101

Definition at line 17 of file resource.h.

#define IDS_PROJNAME 100

Definition at line 16 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/Authorization/stdafx.cpp File Reference

  • Multimedia
  • WindowsMediaServices9
  • Authorization

stdafx.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/Authorization/stdafx.h File Reference

  • Multimedia
  • WindowsMediaServices9
  • Authorization
Defines | Variables

stdafx.h File Reference

#include <atlbase.h>
#include <atlcom.h>
#include <event.h>
#include <wmsserver.h>
#include <WMSBasicPlugin.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0400
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 22 of file stdafx.h.

#define _WIN32_WINNT 0x0400

Definition at line 20 of file stdafx.h.

#define STRICT

Definition at line 18 of file stdafx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/CacheProxy/cplusplus/proxyplugin.cpp File Reference

  • Multimedia
  • WindowsMediaServices9
  • CacheProxy
  • cplusplus
Functions | Variables

proxyplugin.cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include "ProxyPlugin.h"
#include "ProxyPluginImpl.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 45 of file proxyplugin.cpp.

{
    return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 53 of file proxyplugin.cpp.

{
    return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 30 of file proxyplugin.cpp.

{
    if (dwReason == DLL_PROCESS_ATTACH)
    {
        _Module.Init(ObjectMap, hInstance, &LIBID_PROXYPLUGINLib);
        DisableThreadLibraryCalls(hInstance);
    }
    else if (dwReason == DLL_PROCESS_DETACH)
        _Module.Term();
    return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 61 of file proxyplugin.cpp.

{
    // registers object, typelib and all interfaces in typelib
    return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 70 of file proxyplugin.cpp.

{
    return _Module.UnregisterServer(TRUE);
}

Variable Documentation

CComModule _Module

Definition at line 20 of file proxyplugin.cpp.

Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/CacheProxy/cplusplus/proxyplugin.idl File Reference

  • Multimedia
  • WindowsMediaServices9
  • CacheProxy
  • cplusplus
Namespaces | Functions

proxyplugin.idl File Reference

Go to the source code of this file.

Namespaces

namespace PROXYPLUGINLib

Functions

EXTERN_GUID (LIBID_PROXYPLUGINLib, 0x65cc485b, 0xaac6, 0x457a, 0xa6, 0x88, 0x9, 0x79, 0xb9, 0x5e, 0x4a, 0x95)
EXTERN_GUID (CLSID_ProxyPlugin, 0xc5403bb1, 0x1b30, 0x49bf, 0xa8, 0x73, 0x77, 0xfd, 0xfd, 0x4c, 0xf6, 0xe6)
PROXYPLUGINLib::importlib ("stdole32.tlb")
PROXYPLUGINLib::importlib ("stdole2.tlb")

Function Documentation

EXTERN_GUID | ( | LIBID_PROXYPLUGINLib | ,
 |  | 0x65cc485b | ,
 |  | 0xaac6 | ,
 |  | 0x457a | ,
 |  | 0xa6 | ,
 |  | 0x88 | ,
 |  | 0x9 | ,
 |  | 0x79 | ,
 |  | 0xb9 | ,
 |  | 0x5e | ,
 |  | 0x4a | ,
 |  | 0x95 |
 | ) |  |
EXTERN_GUID | ( | CLSID_ProxyPlugin | ,
 |  | 0xc5403bb1 | ,
 |  | 0x1b30 | ,
 |  | 0x49bf | ,
 |  | 0xa8 | ,
 |  | 0x73 | ,
 |  | 0x77 | ,
 |  | 0xfd | ,
 |  | 0xfd | ,
 |  | 0x4c | ,
 |  | 0xf6 | ,
 |  | 0xe6 |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/CacheProxy/cplusplus/proxypluginimpl.cpp File Reference

  • Multimedia
  • WindowsMediaServices9
  • CacheProxy
  • cplusplus
Variables

proxypluginimpl.cpp File Reference

#include "stdafx.h"
#include <limits.h>
#include "WMSBasicPlugin.h"
#include "nserror.h"
#include "WMSContextNames.h"
#include "ProxyPlugin.h"
#include "ProxyPluginImpl.h"

Go to the source code of this file.

Variables

LPWSTR g_ProxyProtocols [] = { L"HTTP", L"RTSP", NULL }

Variable Documentation

LPWSTR g_ProxyProtocols[] = { L"HTTP", L"RTSP", NULL }

Definition at line 25 of file proxypluginimpl.cpp.

Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/CacheProxy/cplusplus/proxypluginimpl.h File Reference

  • Multimedia
  • WindowsMediaServices9
  • CacheProxy
  • cplusplus
Classes

proxypluginimpl.h File Reference

#include "resource.h"
#include "WMSBasicPlugin.h"
#include "StreamCache.h"
#include "ProxyPlugin.h"
#include "wmscontext.h"

Go to the source code of this file.

Classes

class | CProxyPlugin
class | CProxyPlugin::COpState
Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/CacheProxy/cplusplus/Resource.h File Reference

  • Multimedia
  • WindowsMediaServices9
  • CacheProxy
  • cplusplus
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_PROXYPLUGIN 101
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_PROXYPLUGIN 101

Definition at line 18 of file Resource.h.

#define IDS_PROJNAME 100

Definition at line 17 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/CacheProxy/cplusplus/StdAfx.cpp File Reference

  • Multimedia
  • WindowsMediaServices9
  • CacheProxy
  • cplusplus

StdAfx.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/CacheProxy/cplusplus/StdAfx.h File Reference

  • Multimedia
  • WindowsMediaServices9
  • CacheProxy
  • cplusplus
Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0400
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 23 of file StdAfx.h.

#define _WIN32_WINNT 0x0400

Definition at line 21 of file StdAfx.h.

#define STRICT

Definition at line 19 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/CacheProxy/csharp/AssemblyInfo.cs File Reference

  • Multimedia
  • WindowsMediaServices9
  • CacheProxy
  • csharp

AssemblyInfo.cs File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/CacheProxy/csharp/cacheproxysampleplugin.cs File Reference

  • Multimedia
  • WindowsMediaServices9
  • CacheProxy
  • csharp
Classes | Enumerations

cacheproxysampleplugin.cs File Reference

Go to the source code of this file.

Classes

class | PersistedConfiguration
More...
class | PersistedConfigurationDataSet
More...

Enumerations

enum | protocolEnum { clientprotocol, HTTP, RTSPU, RTSPT }

Enumeration Type Documentation

enum protocolEnum

Enumerator:
clientprotocol
HTTP
RTSPU
RTSPT

Definition at line 65 of file cacheproxysampleplugin.cs.

                         {

    /// <remarks/>
    clientprotocol,

    /// <remarks/>
    HTTP,

    /// <remarks/>
    RTSPU,

    /// <remarks/>
    RTSPT,
}

Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/CacheProxy/csharp/Class1.cs File Reference

  • Multimedia
  • WindowsMediaServices9
  • CacheProxy
  • csharp
Classes | Namespaces

Class1.cs File Reference

Go to the source code of this file.

Classes

class | CacheProxySamplePlugin::CacheProxyPlugin
Summary description for Class1. More...
class | CacheProxySamplePlugin::ContentInfo
class | CacheProxySamplePlugin::INSSBufferImpl
class | CacheProxySamplePlugin::IWMSCacheItemCollectionImpl
class | CacheProxySamplePlugin::IWMSCacheItemDescriptorImpl
class | CacheProxySamplePlugin::PlaylistItem

Namespaces

namespace | CacheProxySamplePlugin
Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/CacheProxy/csharp/PluginAdmin.cs File Reference

  • Multimedia
  • WindowsMediaServices9
  • CacheProxy
  • csharp
Classes

PluginAdmin.cs File Reference

Go to the source code of this file.

Classes

class | CachePluginAdmin
More...
interface | IWMSCacheAdmin
Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/DataSource/resource.h File Reference

  • Multimedia
  • WindowsMediaServices9
  • DataSource
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_SDKSAMPLESTORAGESYSTEM 101
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_SDKSAMPLESTORAGESYSTEM 101

Definition at line 18 of file resource.h.

#define IDS_PROJNAME 100

Definition at line 17 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/DataSource/sdksamplestorageplugin.cpp File Reference

  • Multimedia
  • WindowsMediaServices9
  • DataSource
Functions | Variables

sdksamplestorageplugin.cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include "SDKSampleStoragePlugin.h"
#include "SDKSampleStorageSystem.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 52 of file sdksamplestorageplugin.cpp.

{
#ifdef _MERGE_PROXYSTUB
    if (PrxDllCanUnloadNow() != S_OK)
        return S_FALSE;
#endif
    return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 64 of file sdksamplestorageplugin.cpp.

{
#ifdef _MERGE_PROXYSTUB
    if (PrxDllGetClassObject(rclsid, riid, ppv) == S_OK)
        return S_OK;
#endif
    return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID | lpReserved
 | ) |  |

Definition at line 32 of file sdksamplestorageplugin.cpp.

{
    lpReserved;
#ifdef _MERGE_PROXYSTUB
    if (!PrxDllMain(hInstance, dwReason, lpReserved))
        return FALSE;
#endif
    if (dwReason == DLL_PROCESS_ATTACH)
    {
        _Module.Init(ObjectMap, hInstance, &LIBID_SDKSAMPLESTORAGEPLUGINLib);
        DisableThreadLibraryCalls(hInstance);
    }
    else if (dwReason == DLL_PROCESS_DETACH)
        _Module.Term();
    return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 76 of file sdksamplestorageplugin.cpp.

{
#ifdef _MERGE_PROXYSTUB
    HRESULT hRes = PrxDllRegisterServer();
    if (FAILED(hRes))
        return hRes;
#endif
    // registers object, typelib and all interfaces in typelib
    return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 90 of file sdksamplestorageplugin.cpp.

{
#ifdef _MERGE_PROXYSTUB
    PrxDllUnregisterServer();
#endif
    return _Module.UnregisterServer(TRUE);
}

Variable Documentation

CComModule _Module

Definition at line 22 of file sdksamplestorageplugin.cpp.

Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/DataSource/sdksamplestorageplugin.idl File Reference

  • Multimedia
  • WindowsMediaServices9
  • DataSource
Namespaces | Functions

sdksamplestorageplugin.idl File Reference

Go to the source code of this file.

Namespaces

namespace SDKSAMPLESTORAGEPLUGINLib

Functions

EXTERN_GUID (LIBID_SDKSAMPLESTORAGEPLUGINLib, 0x46b14880, 0x4ddc, 0x4957, 0xa4, 0xa4, 0xf9, 0x0, 0xd9, 0xf2, 0x3, 0x3f)
EXTERN_GUID (CLSID_SDKSampleStorageSystem, 0x28dfd023, 0xdc35, 0x4786, 0xb1, 0xa1, 0xf, 0xc6, 0xcb, 0x6a, 0x38, 0x46)
SDKSAMPLESTORAGEPLUGINLib::importlib ("stdole32.tlb")
SDKSAMPLESTORAGEPLUGINLib::importlib ("stdole2.tlb")

Function Documentation

EXTERN_GUID | ( | LIBID_SDKSAMPLESTORAGEPLUGINLib | ,
 |  | 0x46b14880 | ,
 |  | 0x4ddc | ,
 |  | 0x4957 | ,
 |  | 0xa4 | ,
 |  | 0xa4 | ,
 |  | 0xf9 | ,
 |  | 0x0 | ,
 |  | 0xd9 | ,
 |  | 0xf2 | ,
 |  | 0x3 | ,
 |  | 0x3f |
 | ) |  |
EXTERN_GUID | ( | CLSID_SDKSampleStorageSystem | ,
 |  | 0x28dfd023 | ,
 |  | 0xdc35 | ,
 |  | 0x4786 | ,
 |  | 0xb1 | ,
 |  | 0xa1 | ,
 |  | 0xf | ,
 |  | 0xc6 | ,
 |  | 0xcb | ,
 |  | 0x6a | ,
 |  | 0x38 | ,
 |  | 0x46 |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/DataSource/sdksamplestoragesystem.cpp File Reference

  • Multimedia
  • WindowsMediaServices9
  • DataSource

sdksamplestoragesystem.cpp File Reference

#include "stdafx.h"
#include "SDKSampleStoragePlugin.h"
#include "SDKSampleStorageSystem.h"
#include <float.h>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/DataSource/sdksamplestoragesystem.h File Reference

  • Multimedia
  • WindowsMediaServices9
  • DataSource
Classes | Defines

sdksamplestoragesystem.h File Reference

#include "resource.h"
#include "dataContainer.h"
#include "WMSBasicPlugin.h"

Go to the source code of this file.

Classes

class | CSampleDataContainer
class | CSampleDirectory
class | CSampleDirectoryInfo
class | CSDKSampleStorageSystem

Defines

#define | DIR_MASK L"\\*"
#define | DIR_MASK_LENGTH 2
#define | HIDWORD(l) ((DWORD)(((ULONGLONG)(l) >> 32) & 0xFFFFFFFF))
#define | LODWORD(l) ((DWORD)(l))
#define | MAKEQWORD(a, b) MAKEULONGLONG((a),(b))
#define | MAKEULONGLONG(a, b) ((ULONGLONG)(((DWORD)(a)) | ((ULONGLONG)((DWORD)(b))) << 32))
#define | URL_SCHEME L"sample://"
#define | URL_SCHEME_LENGTH 9

Define Documentation

#define DIR_MASK L"\\*"

Definition at line 27 of file sdksamplestoragesystem.h.

#define DIR_MASK_LENGTH 2

Definition at line 26 of file sdksamplestoragesystem.h.

#define HIDWORD ( l ) ((DWORD)(((ULONGLONG)(l) >> 32) & 0xFFFFFFFF))

Definition at line 31 of file sdksamplestoragesystem.h.

#define LODWORD ( l ) ((DWORD)(l))

Definition at line 30 of file sdksamplestoragesystem.h.

#define MAKEQWORD | ( | a,
 |  | b |
 | ) |  | MAKEULONGLONG((a),(b))

Definition at line 29 of file sdksamplestoragesystem.h.

#define MAKEULONGLONG | ( | a,
 |  | b |
 | ) |  | ((ULONGLONG)(((DWORD)(a)) | ((ULONGLONG)((DWORD)(b))) << 32))

Definition at line 32 of file sdksamplestoragesystem.h.

#define URL_SCHEME L"sample://"

Definition at line 24 of file sdksamplestoragesystem.h.

#define URL_SCHEME_LENGTH 9

Definition at line 23 of file sdksamplestoragesystem.h.

Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/DataSource/stdafx.cpp File Reference

  • Multimedia
  • WindowsMediaServices9
  • DataSource

stdafx.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/DataSource/stdafx.h File Reference

  • Multimedia
  • WindowsMediaServices9
  • DataSource
Defines | Variables

stdafx.h File Reference

#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0400
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 23 of file stdafx.h.

#define _WIN32_WINNT 0x0400

Definition at line 21 of file stdafx.h.

#define STRICT

Definition at line 19 of file stdafx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/EventNotification/ContextAdmin.cpp File Reference

  • Multimedia
  • WindowsMediaServices9
  • EventNotification

ContextAdmin.cpp File Reference

#include "StdAfx.h"
#include "ContextDll.h"
#include "ContextAdmin.h"
#include <comdef.h>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/EventNotification/ContextAdmin.h File Reference

  • Multimedia
  • WindowsMediaServices9
  • EventNotification
Classes

ContextAdmin.h File Reference

#include "Resource.h"
#include "ContextPlugin.h"
#include "Resource.h"

Go to the source code of this file.

Classes

class CContextAdmin
Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/EventNotification/ContextDll.cpp File Reference

  • Multimedia
  • WindowsMediaServices9
  • EventNotification
Functions | Variables

ContextDll.cpp File Reference

#include "StdAfx.h"
#include "Resource.h"
#include <initguid.h>
#include "ContextDll.h"
#include "ContextPlugin.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 44 of file ContextDll.cpp.

{
    return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 52 of file ContextDll.cpp.

{
    return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 29 of file ContextDll.cpp.

{
    if (dwReason == DLL_PROCESS_ATTACH)
    {
        _Module.Init(ObjectMap, hInstance, &LIBID_CONTEXTPLUGINLib);
        DisableThreadLibraryCalls(hInstance);
    }
    else if (dwReason == DLL_PROCESS_DETACH)
        _Module.Term();
    return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 60 of file ContextDll.cpp.

{
    // registers object, typelib and all interfaces in typelib
    return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 69 of file ContextDll.cpp.

{
    return _Module.UnregisterServer(TRUE);
}

Variable Documentation

CComModule _Module

Definition at line 19 of file ContextDll.cpp.

Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/EventNotification/ContextDll.idl File Reference

  • Multimedia
  • WindowsMediaServices9
  • EventNotification
Classes | Namespaces | Typedefs | Enumerations | Functions

ContextDll.idl File Reference

Go to the source code of this file.

Classes

interface | IWMSContextAdmin
interface | IWMSContextPlugin

Namespaces

namespace | CONTEXTPLUGINLib

Typedefs

typedef enum
WMS_CONTEXT_PLUGIN_CONTEXT_TYPE 		WMS_CONTEXT_PLUGIN_CONTEXT_TYPE

Enumerations

enum WMS_CONTEXT_PLUGIN_CONTEXT_TYPE {
WMS_CONTEXT_PLUGIN_NO_CONTEXT = 0, WMS_CONTEXT_PLUGIN_USER_CONTEXT = 1, WMS_CONTEXT_PLUGIN_PRESENTATION_CONTEXT = 2, WMS_CONTEXT_PLUGIN_COMMAND_REQUEST_CONTEXT = 4,
WMS_CONTEXT_PLUGIN_COMMAND_RESPONSE_CONTEXT = 8
}

Functions

EXTERN_GUID (LIBID_CONTEXTPLUGINLib, 0x763a9744, 0x3a49, 0x4902, 0xb9, 0x57, 0x2, 0x7f, 0xc, 0x62, 0x5b, 0x78)
EXTERN_GUID (CLSID_WMSContextPlugin, 0x763a9745, 0x3a49, 0x4902, 0xb9, 0x57, 0x2, 0x7f, 0xc, 0x62, 0x5b, 0x78)
EXTERN_GUID (IID_IWMSContextAdmin, 0x763a9747, 0x3a49, 0x4902, 0xb9, 0x57, 0x2, 0x7f, 0xc, 0x62, 0x5b, 0x78)
EXTERN_GUID (IID_IWMSContextPlugin, 0x763a9746, 0x3a49, 0x4902, 0xb9, 0x57, 0x2, 0x7f, 0xc, 0x62, 0x5b, 0x78)
CONTEXTPLUGINLib::importlib ("stdole2.tlb")
CONTEXTPLUGINLib::importlib ("stdole32.tlb")

Typedef Documentation

typedef enum WMS_CONTEXT_PLUGIN_CONTEXT_TYPE WMS_CONTEXT_PLUGIN_CONTEXT_TYPE

Enumeration Type Documentation

enum WMS_CONTEXT_PLUGIN_CONTEXT_TYPE
Enumerator:
WMS_CONTEXT_PLUGIN_NO_CONTEXT
WMS_CONTEXT_PLUGIN_USER_CONTEXT
WMS_CONTEXT_PLUGIN_PRESENTATION_CONTEXT
WMS_CONTEXT_PLUGIN_COMMAND_REQUEST_CONTEXT
WMS_CONTEXT_PLUGIN_COMMAND_RESPONSE_CONTEXT

Definition at line 43 of file ContextDll.idl.

{
    WMS_CONTEXT_PLUGIN_NO_CONTEXT = 0,
    WMS_CONTEXT_PLUGIN_USER_CONTEXT = 1,
    WMS_CONTEXT_PLUGIN_PRESENTATION_CONTEXT = 2,
    WMS_CONTEXT_PLUGIN_COMMAND_REQUEST_CONTEXT = 4,
    WMS_CONTEXT_PLUGIN_COMMAND_RESPONSE_CONTEXT = 8
} WMS_CONTEXT_PLUGIN_CONTEXT_TYPE;

Function Documentation

EXTERN_GUID | ( | LIBID_CONTEXTPLUGINLib | ,
 |  | 0x763a9744 | ,
 |  | 0x3a49 | ,
 |  | 0x4902 | ,
 |  | 0xb9 | ,
 |  | 0x57 | ,
 |  | 0x2 | ,
 |  | 0x7f | ,
 |  | 0xc | ,
 |  | 0x62 | ,
 |  | 0x5b | ,
 |  | 0x78 |
 | ) |  |
EXTERN_GUID | ( | CLSID_WMSContextPlugin | ,
 |  | 0x763a9745 | ,
 |  | 0x3a49 | ,
 |  | 0x4902 | ,
 |  | 0xb9 | ,
 |  | 0x57 | ,
 |  | 0x2 | ,
 |  | 0x7f | ,
 |  | 0xc | ,
 |  | 0x62 | ,
 |  | 0x5b | ,
 |  | 0x78 |
 | ) |  |
EXTERN_GUID | ( | IID_IWMSContextAdmin | ,
 |  | 0x763a9747 | ,
 |  | 0x3a49 | ,
 |  | 0x4902 | ,
 |  | 0xb9 | ,
 |  | 0x57 | ,
 |  | 0x2 | ,
 |  | 0x7f | ,
 |  | 0xc | ,
 |  | 0x62 | ,
 |  | 0x5b | ,
 |  | 0x78 |
 | ) |  |
EXTERN_GUID | ( | IID_IWMSContextPlugin | ,
 |  | 0x763a9746 | ,
 |  | 0x3a49 | ,
 |  | 0x4902 | ,
 |  | 0xb9 | ,
 |  | 0x57 | ,
 |  | 0x2 | ,
 |  | 0x7f | ,
 |  | 0xc | ,
 |  | 0x62 | ,
 |  | 0x5b | ,
 |  | 0x78 |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/EventNotification/ContextPlugin.cpp File Reference

  • Multimedia
  • WindowsMediaServices9
  • EventNotification
Variables

ContextPlugin.cpp File Reference

#include "StdAfx.h"
#include "ContextDll.h"
#include "ContextPlugin.h"
#include "ContextAdmin.h"
#include "WMSContextNames.h"
#include <comdef.h>
#include "nserror.h"

Go to the source code of this file.

Variables

const LPWSTR | CONTEXT_SAMPLE_ARRAY_TYPE_STRING = "%s(%d) = Type(%d) (VT_ARRAY?)\r\n"
const LPWSTR | CONTEXT_SAMPLE_BSTR_TYPE_STRING = "%s(%d) = %s(VT_BSTR)\r\n"
const LPWSTR | CONTEXT_SAMPLE_COMMAND_REQUEST_CONTEXT_HEADER = "-------------------------\r\nCommand Request Context\r\n-------------------------\r\n"
const LPWSTR | CONTEXT_SAMPLE_COMMAND_RESPONSE_CONTEXT_HEADER = "-------------------------\r\nCommand Response Context\r\n-------------------------\r\n"
const LPWSTR | CONTEXT_SAMPLE_CY_TYPE_STRING = "%s(%d) = 0x%16.16I64x(VT_CY)\r\n"
const LPWSTR | CONTEXT_SAMPLE_DATE_TYPE_STRING = "%s(%d) = 0x%8.8x(VT_DATE)\r\n"
const LPWSTR | CONTEXT_SAMPLE_DECIMAL_TYPE_STRING = "%s(%d) = 0x%8.8x(VT_DECIMAL)\r\n"
const LPWSTR | CONTEXT_SAMPLE_DISPATCH_TYPE_STRING = "%s(%d) = 0x%8.8x(VT_DISPATCH)\r\n"
const LPWSTR | CONTEXT_SAMPLE_I4_TYPE_STRING = "%s(%d) = 0x%8.8x(%d)(VT_I4)\r\n"
const LPWSTR | CONTEXT_SAMPLE_NEW_EVENT_HEADER = "************************************************************\r\n%s Event at %4d.%02d.%02d %02d.%02d.%02d\r\n************************************************************\r\n"
const LPWSTR | CONTEXT_SAMPLE_PRESENTATION_CONTEXT_HEADER = "-------------------------\r\nPresentation Context\r\n-------------------------\r\n"
const LPWSTR | CONTEXT_SAMPLE_UI8_TYPE_STRING = "%s(%d) = 0x%16.16I64x(VT_UI8)\r\n"
const LPWSTR | CONTEXT_SAMPLE_UNKNOWN_TYPE_STRING = "%s(%d) = 0x%8.8x(VT_UNKNOWN)\r\n"
const LPWSTR | CONTEXT_SAMPLE_USER_CONTEXT_HEADER = "-------------------------\r\nUser Context\r\n-------------------------\r\n"
const | NUM_HANDLED_EVENTS = 27

Variable Documentation

const LPWSTR CONTEXT_SAMPLE_ARRAY_TYPE_STRING = "%s(%d) = Type(%d) (VT_ARRAY?)\r\n"

Definition at line 35 of file ContextPlugin.cpp.

const LPWSTR CONTEXT_SAMPLE_BSTR_TYPE_STRING = "%s(%d) = %s(VT_BSTR)\r\n"

Definition at line 27 of file ContextPlugin.cpp.

const LPWSTR CONTEXT_SAMPLE_COMMAND_REQUEST_CONTEXT_HEADER = "-------------------------\r\nCommand Request Context\r\n-------------------------\r\n"

Definition at line 23 of file ContextPlugin.cpp.

const LPWSTR CONTEXT_SAMPLE_COMMAND_RESPONSE_CONTEXT_HEADER = "-------------------------\r\nCommand Response Context\r\n-------------------------\r\n"

Definition at line 24 of file ContextPlugin.cpp.

const LPWSTR CONTEXT_SAMPLE_CY_TYPE_STRING = "%s(%d) = 0x%16.16I64x(VT_CY)\r\n"

Definition at line 30 of file ContextPlugin.cpp.

const LPWSTR CONTEXT_SAMPLE_DATE_TYPE_STRING = "%s(%d) = 0x%8.8x(VT_DATE)\r\n"

Definition at line 31 of file ContextPlugin.cpp.

const LPWSTR CONTEXT_SAMPLE_DECIMAL_TYPE_STRING = "%s(%d) = 0x%8.8x(VT_DECIMAL)\r\n"

Definition at line 32 of file ContextPlugin.cpp.

const LPWSTR CONTEXT_SAMPLE_DISPATCH_TYPE_STRING = "%s(%d) = 0x%8.8x(VT_DISPATCH)\r\n"

Definition at line 34 of file ContextPlugin.cpp.

const LPWSTR CONTEXT_SAMPLE_I4_TYPE_STRING = "%s(%d) = 0x%8.8x(%d)(VT_I4)\r\n"

Definition at line 28 of file ContextPlugin.cpp.

const LPWSTR CONTEXT_SAMPLE_NEW_EVENT_HEADER = "************************************************************\r\n%s Event at %4d.%02d.%02d %02d.%02d.%02d\r\n************************************************************\r\n"

Definition at line 38 of file ContextPlugin.cpp.

const LPWSTR CONTEXT_SAMPLE_PRESENTATION_CONTEXT_HEADER = "-------------------------\r\nPresentation Context\r\n-------------------------\r\n"

Definition at line 22 of file ContextPlugin.cpp.

const LPWSTR CONTEXT_SAMPLE_UI8_TYPE_STRING = "%s(%d) = 0x%16.16I64x(VT_UI8)\r\n"

Definition at line 29 of file ContextPlugin.cpp.

const LPWSTR CONTEXT_SAMPLE_UNKNOWN_TYPE_STRING = "%s(%d) = 0x%8.8x(VT_UNKNOWN)\r\n"

Definition at line 33 of file ContextPlugin.cpp.

const LPWSTR CONTEXT_SAMPLE_USER_CONTEXT_HEADER = "-------------------------\r\nUser Context\r\n-------------------------\r\n"

Definition at line 21 of file ContextPlugin.cpp.

const NUM_HANDLED_EVENTS = 27

Definition at line 19 of file ContextPlugin.cpp.

Generated on Wed Nov 13 2024 16:53:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/EventNotification/ContextPlugin.h File Reference

  • Multimedia
  • WindowsMediaServices9
  • EventNotification
Classes | Typedefs

ContextPlugin.h File Reference

#include "resource.h"
#include "wmsdefs.h"
#include "resource.h"

Go to the source code of this file.

Classes

class | CContextPlugin
struct | ContextNameHint

Typedefs

typedef struct ContextNameHint | ContextNameHint

Typedef Documentation

typedef struct ContextNameHint ContextNameHint
Generated on Wed Nov 13 2024 16:53:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/EventNotification/Resource.h File Reference

  • Multimedia
  • WindowsMediaServices9
  • EventNotification
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | EVENT_LENGTH 4
#define | IDR_CONTEXTPLUGIN 101
#define | IDS_PROJNAME 100

Define Documentation

#define EVENT_LENGTH 4

Definition at line 16 of file Resource.h.

#define IDR_CONTEXTPLUGIN 101

Definition at line 18 of file Resource.h.

#define IDS_PROJNAME 100

Definition at line 17 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/EventNotification/StdAfx.cpp File Reference

  • Multimedia
  • WindowsMediaServices9
  • EventNotification

StdAfx.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/EventNotification/StdAfx.h File Reference

  • Multimedia
  • WindowsMediaServices9
  • EventNotification
Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>
#include "event.h"
#include "wmsserver.h"
#include "WMSBasicPlugin.h"

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0400
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 22 of file StdAfx.h.

#define _WIN32_WINNT 0x0400

Definition at line 20 of file StdAfx.h.

#define STRICT

Definition at line 18 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/EventNotification/ContextSamplePropPage/ContextSamplePropPage.cpp File Reference

  • Multimedia
  • WindowsMediaServices9
  • EventNotification
  • ContextSamplePropPage
Functions | Variables

ContextSamplePropPage.cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include "ContextSamplePropPage.h"
#include "ContextSamplePropPageImpl.h"
#include "ContextSamplePropPage_i.c"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 53 of file ContextSamplePropPage.cpp.

{
#ifdef _MERGE_PROXYSTUB
    if (PrxDllCanUnloadNow() != S_OK)
        return S_FALSE;
#endif
    return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 65 of file ContextSamplePropPage.cpp.

{
#ifdef _MERGE_PROXYSTUB
    if (PrxDllGetClassObject(rclsid, riid, ppv) == S_OK)
        return S_OK;
#endif
    return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID | lpReserved
 | ) |  |

Definition at line 33 of file ContextSamplePropPage.cpp.

{
    lpReserved;
#ifdef _MERGE_PROXYSTUB
    if (!PrxDllMain(hInstance, dwReason, lpReserved))
        return FALSE;
#endif
    if (dwReason == DLL_PROCESS_ATTACH)
    {
        _Module.Init(ObjectMap, hInstance, &LIBID_CONTEXTSAMPLEPROPPAGELib);
        DisableThreadLibraryCalls(hInstance);
    }
    else if (dwReason == DLL_PROCESS_DETACH)
        _Module.Term();
    return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 77 of file ContextSamplePropPage.cpp.

{
#ifdef _MERGE_PROXYSTUB
    HRESULT hRes = PrxDllRegisterServer();
    if (FAILED(hRes))
        return hRes;
#endif
    // registers object, typelib and all interfaces in typelib
    return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 91 of file ContextSamplePropPage.cpp.

{
#ifdef _MERGE_PROXYSTUB
    PrxDllUnregisterServer();
#endif
    return _Module.UnregisterServer(TRUE);
}

Variable Documentation

CComModule _Module

Definition at line 23 of file ContextSamplePropPage.cpp.

Generated on Wed Nov 13 2024 16:53:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/EventNotification/ContextSamplePropPage/ContextSamplePropPage.idl File Reference

  • Multimedia
  • WindowsMediaServices9
  • EventNotification
  • ContextSamplePropPage
Classes | Namespaces | Functions

ContextSamplePropPage.idl File Reference

Go to the source code of this file.

Classes

class | CONTEXTSAMPLEPROPPAGELib::ContextSamplePropPage

Namespaces

namespace | CONTEXTSAMPLEPROPPAGELib

Functions

CONTEXTSAMPLEPROPPAGELib::importlib ("stdole32.tlb")
CONTEXTSAMPLEPROPPAGELib::importlib ("stdole2.tlb")
Generated on Wed Nov 13 2024 16:53:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/EventNotification/ContextSamplePropPage/ContextSamplePropPageImpl.cpp File Reference

  • Multimedia
  • WindowsMediaServices9
  • EventNotification
  • ContextSamplePropPage

ContextSamplePropPageImpl.cpp File Reference

#include "stdafx.h"
#include "ContextSamplePropPageImpl.h"
#include "ContextSamplePropPage.h"
#include <atlbase.h>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/EventNotification/ContextSamplePropPage/ContextSamplePropPageImpl.h File Reference

  • Multimedia
  • WindowsMediaServices9
  • EventNotification
  • ContextSamplePropPage
Classes | Variables

ContextSamplePropPageImpl.h File Reference

#include "stdafx.h"
#include "resource.h"
#include "WMSServer.h"
#include "ContextSamplePropPage.h"
#include "ContextDll.h"
#include <comdef.h>
#include <commctrl.h>

Go to the source code of this file.

Classes

class | CContextSamplePropPage

Variables

EXTERN_C const CLSID | CLSID_ContextSamplePropPage

Variable Documentation

EXTERN_C const CLSID CLSID_ContextSamplePropPage

Definition at line 25 of file ContextSamplePropPageImpl.h.

Generated on Wed Nov 13 2024 16:53:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/EventNotification/ContextSamplePropPage/resource.h File Reference

  • Multimedia
  • WindowsMediaServices9
  • EventNotification
  • ContextSamplePropPage
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_CHECK_COMMAND_REQUEST_CONTEXT 207
#define | IDC_CHECK_COMMAND_RESPONSE_CONTEXT 208
#define | IDC_CHECK_PRESENTATION_CONTEXT 206
#define | IDC_CHECK_USER_CONTEXT 205
#define | IDC_EDIT_OUTPUT_PATH 204
#define | IDD_CONTEXTSAMPLEPROPPAGE 101
#define | IDR_CONTEXTSAMPLEPROPPAGE 102
#define | IDS_CONTEXTSAMPLE_CONTEXT_TYPES_LABEL 107
#define | IDS_CONTEXTSAMPLE_OUTPUT_PATH_LABEL 106
#define | IDS_DOCSTRINGContextSamplePropPage 105
#define | IDS_HELPFILEContextSamplePropPage 104
#define | IDS_PLUGIN_PROPS_ERROR 108
#define | IDS_PROJNAME 100
#define | IDS_SERVER_CONNECT_ERROR 109
#define | IDS_TITLEContextSamplePropPage 103

Define Documentation

#define IDC_CHECK_COMMAND_REQUEST_CONTEXT 207

Definition at line 28 of file resource.h.

#define IDC_CHECK_COMMAND_RESPONSE_CONTEXT 208

Definition at line 29 of file resource.h.

#define IDC_CHECK_PRESENTATION_CONTEXT 206

Definition at line 27 of file resource.h.

#define IDC_CHECK_USER_CONTEXT 205

Definition at line 26 of file resource.h.

#define IDC_EDIT_OUTPUT_PATH 204

Definition at line 25 of file resource.h.

#define IDD_CONTEXTSAMPLEPROPPAGE 101

Definition at line 16 of file resource.h.

#define IDR_CONTEXTSAMPLEPROPPAGE 102

Definition at line 17 of file resource.h.

#define IDS_CONTEXTSAMPLE_CONTEXT_TYPES_LABEL 107

Definition at line 22 of file resource.h.

#define IDS_CONTEXTSAMPLE_OUTPUT_PATH_LABEL 106

Definition at line 21 of file resource.h.

#define IDS_DOCSTRINGContextSamplePropPage 105

Definition at line 20 of file resource.h.

#define IDS_HELPFILEContextSamplePropPage 104

Definition at line 19 of file resource.h.

#define IDS_PLUGIN_PROPS_ERROR 108

Definition at line 23 of file resource.h.

#define IDS_PROJNAME 100

Definition at line 15 of file resource.h.

#define IDS_SERVER_CONNECT_ERROR 109

Definition at line 24 of file resource.h.

#define IDS_TITLEContextSamplePropPage 103

Definition at line 18 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/EventNotification/ContextSamplePropPage/stdafx.h File Reference

  • Multimedia
  • WindowsMediaServices9
  • EventNotification
  • ContextSamplePropPage
Defines | Variables

stdafx.h File Reference

#include <atlbase.h>
#include <uxtheme.h>
#include <atlcom.h>
#include <atlctl.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0400
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 22 of file stdafx.h.

#define _WIN32_WINNT 0x0400

Definition at line 20 of file stdafx.h.

#define STRICT

Definition at line 18 of file stdafx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/Playlist/dlldatax.h File Reference

  • Multimedia
  • WindowsMediaServices9
  • Playlist

dlldatax.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/Playlist/resource.h File Reference

  • Multimedia
  • WindowsMediaServices9
  • Playlist
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_SDKSAMPLEPLAYLISTPARSER 101
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_SDKSAMPLEPLAYLISTPARSER 101

Definition at line 18 of file resource.h.

#define IDS_PROJNAME 100

Definition at line 17 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/Playlist/SDKSamplePlaylistParser.cpp File Reference

  • Multimedia
  • WindowsMediaServices9
  • Playlist

SDKSamplePlaylistParser.cpp File Reference

#include "stdafx.h"
#include "SDKSamplePlaylistPlugin.h"
#include "SDKSamplePlaylistParser.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/Playlist/SDKSamplePlaylistParser.h File Reference

  • Multimedia
  • WindowsMediaServices9
  • Playlist
Classes | Typedefs

SDKSamplePlaylistParser.h File Reference

#include "resource.h"
#include "WMSBasicPlugin.h"
#include "WMSPlaylistParser.h"
#include "resource.h"

Go to the source code of this file.

Classes

class | CSDKSamplePlaylistParser
class | CSDKSamplePlaylistParserPlugin

Typedefs

typedef CComObject
< CSDKSamplePlaylistParser > 		CComSDKSamplePlaylistParser

Typedef Documentation

typedef CComObject< CSDKSamplePlaylistParser > CComSDKSamplePlaylistParser

Definition at line 79 of file SDKSamplePlaylistParser.h.

Generated on Wed Nov 13 2024 16:53:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/Playlist/SDKSamplePlaylistPlugin.cpp File Reference

  • Multimedia
  • WindowsMediaServices9
  • Playlist
Functions | Variables

SDKSamplePlaylistPlugin.cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include "SDKSamplePlaylistPlugin.h"
#include "dlldatax.h"
#include "SDKSamplePlaylistPlugin_i.c"
#include "SDKSamplePlaylistParser.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 55 of file SDKSamplePlaylistPlugin.cpp.

{
#ifdef _MERGE_PROXYSTUB
    if (PrxDllCanUnloadNow() != S_OK)
        return S_FALSE;
#endif
    return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 67 of file SDKSamplePlaylistPlugin.cpp.

{
#ifdef _MERGE_PROXYSTUB
    if (PrxDllGetClassObject(rclsid, riid, ppv) == S_OK)
        return S_OK;
#endif
    return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID | lpReserved
 | ) |  |

Definition at line 35 of file SDKSamplePlaylistPlugin.cpp.

{
    lpReserved;
#ifdef _MERGE_PROXYSTUB
    if (!PrxDllMain(hInstance, dwReason, lpReserved))
        return FALSE;
#endif
    if (dwReason == DLL_PROCESS_ATTACH)
    {
        _Module.Init(ObjectMap, hInstance, &LIBID_SDKSAMPLEPLAYLISTPLUGINLib);
        DisableThreadLibraryCalls(hInstance);
    }
    else if (dwReason == DLL_PROCESS_DETACH)
        _Module.Term();
    return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 79 of file SDKSamplePlaylistPlugin.cpp.

{
#ifdef _MERGE_PROXYSTUB
    HRESULT hRes = PrxDllRegisterServer();
    if (FAILED(hRes))
        return hRes;
#endif
    // registers object, typelib and all interfaces in typelib
    return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 93 of file SDKSamplePlaylistPlugin.cpp.

{
#ifdef _MERGE_PROXYSTUB
    PrxDllUnregisterServer();
#endif
    return _Module.UnregisterServer(TRUE);
}

Variable Documentation

CComModule _Module

Definition at line 25 of file SDKSamplePlaylistPlugin.cpp.

Generated on Wed Nov 13 2024 16:53:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/Playlist/SDKSamplePlaylistPlugin.idl File Reference

  • Multimedia
  • WindowsMediaServices9
  • Playlist
Classes | Namespaces | Functions

SDKSamplePlaylistPlugin.idl File Reference

Go to the source code of this file.

Classes

class | SDKSAMPLEPLAYLISTPLUGINLib::SDKSamplePlaylistParser

Namespaces

namespace | SDKSAMPLEPLAYLISTPLUGINLib

Functions

SDKSAMPLEPLAYLISTPLUGINLib::importlib ("stdole32.tlb")
SDKSAMPLEPLAYLISTPLUGINLib::importlib ("stdole2.tlb")
Generated on Wed Nov 13 2024 16:53:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/Playlist/StdAfx.cpp File Reference

  • Multimedia
  • WindowsMediaServices9
  • Playlist

StdAfx.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Multimedia/WindowsMediaServices9/Playlist/StdAfx.h File Reference

  • Multimedia
  • WindowsMediaServices9
  • Playlist
Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0400
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 23 of file StdAfx.h.

#define _WIN32_WINNT 0x0400

Definition at line 21 of file StdAfx.h.

#define STRICT

Definition at line 19 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ActiveDirectory/PropSheetHost/DataObj.cpp File Reference

  • NetDS
  • ActiveDirectory
  • PropSheetHost
Functions

DataObj.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (DWORD) CPropSheetHost

Function Documentation

STDMETHODIMP_ ( DWORD )

Definition at line 76 of file DataObj.cpp.

{
    if(--m_ObjRefCount == 0)
    {
        delete this;
        return 0;
    }

    return m_ObjRefCount;
}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ActiveDirectory/PropSheetHost/Main.cpp File Reference

  • NetDS
  • ActiveDirectory
  • PropSheetHost
Defines | Functions

Main.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Defines

#define | MAX_ADSPATH_CHARS 2048

Functions

int | _tmain (int argc, _TCHAR *argv[])
int | LocalToWideChar (LPWSTR pWide, LPCTSTR pLocal, DWORD dwChars)

Define Documentation

#define MAX_ADSPATH_CHARS 2048

Definition at line 24 of file Main.cpp.

Function Documentation

int _tmain | ( | int | argc,
 |  | _TCHAR * | argv[]
 | ) |  |

Definition at line 38 of file Main.cpp.

{
    TCHAR szTemp[MAX_ADSPATH_CHARS];
    LPWSTR pwszADsPath = NULL;

    CoInitialize(NULL);

    if(argc < 2)
    {
        // Prompt the user for the ADsPath.
        _tprintf(TEXT("Enter the ADsPath of the object to display the property sheet for:\n"));
        _fgetts(szTemp, MAX_ADSPATH_CHARS - 1, stdin);

        // Trim the last character, which is the carriage return.
        szTemp[lstrlen(szTemp) - 1] = 0;
    }
    else
    {
        lstrcpyn(szTemp, argv[1], MAX_ADSPATH_CHARS - 1);
    }

    DWORD dwChars = lstrlen(szTemp) + 1;
    pwszADsPath = new WCHAR[dwChars];

    if(pwszADsPath)
    {
        HRESULT hr;

        HINSTANCE hInstance = NULL;
        HWND hwndConsole = GetConsoleWindow();
        if(hwndConsole)
        {
            hInstance = (HINSTANCE)(LONG_PTR)GetWindowLongPtr(hwndConsole, GWLP_HINSTANCE);
        }

        CPropSheetHost *pHost = new CPropSheetHost(hInstance);

        LocalToWideChar(pwszADsPath, szTemp, dwChars);

        // Hold a reference count for the CPropSheetHost object.
        pHost->AddRef();

        hr = pHost->SetObject(pwszADsPath);
        if(FAILED(hr))
        {
            goto ExitMain;
        }

        pHost->Run();

        /*
        Release the CPropSheetHost object. Other components may still hold a
        reference to the object, so this cannot just be deleted here. Let
        the object delete itself when all references are released.
        */
        pHost->Release();
    }

ExitMain:
    if(pwszADsPath)
    {
        delete pwszADsPath;
    }

    CoUninitialize();

    return 0;
}

int LocalToWideChar | ( | LPWSTR | pWide,
 |  | LPCTSTR | pLocal,
 |  | DWORD | dwChars
 | ) |  |

Definition at line 113 of file Main.cpp.

{
    *pWide = 0;

    #ifdef UNICODE
    lstrcpyn(pWide, pLocal, dwChars);
    #else
    MultiByteToWideChar( CP_ACP,
                        0,
                        pLocal,
                        -1,
                        pWide,
                        dwChars);
    #endif

    return lstrlenW(pWide);
}

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ActiveDirectory/PropSheetHost/PropSheetHost.cpp File Reference

  • NetDS
  • ActiveDirectory
  • PropSheetHost

PropSheetHost.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ActiveDirectory/PropSheetHost/PropSheetHost.h File Reference

  • NetDS
  • ActiveDirectory
  • PropSheetHost
Classes | Defines | Typedefs

PropSheetHost.h File Reference

#include "stdafx.h"

Go to the source code of this file.

Classes

struct | _DSA_SEC_PAGE_INFO
struct | _PROPSHEETCFG
class | CPropSheetHost

Defines

#define | CFSTR_DS_PARENTHWND CFSTR_DS_PARENTHWND_A
#define | CFSTR_DS_PARENTHWND_A "DsAdminParentHwndClipFormat"
#define | CFSTR_DS_PARENTHWND_W L"DsAdminParentHwndClipFormat"
#define | CFSTR_DS_PROPSHEETCONFIG CFSTR_DS_PROPSHEETCONFIG_A
#define | CFSTR_DS_PROPSHEETCONFIG_A "DsPropSheetCfgClipFormat"
#define | CFSTR_DS_PROPSHEETCONFIG_W L"DsPropSheetCfgClipFormat"
#define | PROP_SHEET_HOST_ID 0xCDCDCDCD
#define | PROP_SHEET_PREFIX_ADMIN L"admin"
#define | PROP_SHEET_PREFIX_SHELL L"shell"
#define | VIEW_POINTER_OFFSET GWLP_USERDATA
#define | WM_ADSPROP_SHEET_CREATE (WM_USER + 1108)
#define | WM_DSA_SHEET_CLOSE_NOTIFY (WM_USER + 5)
#define | WM_DSA_SHEET_CREATE_NOTIFY (WM_USER + 6)

Typedefs

typedef struct _DSA_SEC_PAGE_INFO | DSA_SEC_PAGE_INFO
typedef struct _DSA_SEC_PAGE_INFO * | PDSA_SEC_PAGE_INFO
typedef struct _PROPSHEETCFG * | PPROPSHEETCFG
typedef struct _PROPSHEETCFG | PROPSHEETCFG

Define Documentation

#define CFSTR_DS_PARENTHWND CFSTR_DS_PARENTHWND_A

Definition at line 37 of file PropSheetHost.h.

#define CFSTR_DS_PARENTHWND_A "DsAdminParentHwndClipFormat"

Definition at line 32 of file PropSheetHost.h.

#define CFSTR_DS_PARENTHWND_W L"DsAdminParentHwndClipFormat"

Definition at line 31 of file PropSheetHost.h.

#define CFSTR_DS_PROPSHEETCONFIG CFSTR_DS_PROPSHEETCONFIG_A

Definition at line 48 of file PropSheetHost.h.

#define CFSTR_DS_PROPSHEETCONFIG_A "DsPropSheetCfgClipFormat"

Definition at line 43 of file PropSheetHost.h.

#define CFSTR_DS_PROPSHEETCONFIG_W L"DsPropSheetCfgClipFormat"

Definition at line 42 of file PropSheetHost.h.

#define PROP_SHEET_HOST_ID 0xCDCDCDCD

Definition at line 87 of file PropSheetHost.h.

#define PROP_SHEET_PREFIX_ADMIN L"admin"

Definition at line 89 of file PropSheetHost.h.

#define PROP_SHEET_PREFIX_SHELL L"shell"

Definition at line 90 of file PropSheetHost.h.

#define VIEW_POINTER_OFFSET GWLP_USERDATA

Definition at line 28 of file PropSheetHost.h.

#define WM_ADSPROP_SHEET_CREATE (WM_USER + 1108)

Definition at line 54 of file PropSheetHost.h.

#define WM_DSA_SHEET_CLOSE_NOTIFY (WM_USER + 5)

Definition at line 64 of file PropSheetHost.h.

#define WM_DSA_SHEET_CREATE_NOTIFY (WM_USER + 6)

Definition at line 59 of file PropSheetHost.h.

Typedef Documentation

typedef struct _DSA_SEC_PAGE_INFO DSA_SEC_PAGE_INFO
typedef struct _DSA_SEC_PAGE_INFO * PDSA_SEC_PAGE_INFO
typedef struct _PROPSHEETCFG * PPROPSHEETCFG
typedef struct _PROPSHEETCFG PROPSHEETCFG
Generated on Wed Nov 13 2024 16:53:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ActiveDirectory/PropSheetHost/stdafx.cpp File Reference

  • NetDS
  • ActiveDirectory
  • PropSheetHost

stdafx.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ActiveDirectory/PropSheetHost/stdafx.h File Reference

  • NetDS
  • ActiveDirectory
  • PropSheetHost
Defines

stdafx.h File Reference

#include <windows.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <commctrl.h>
#include <ole2.h>
#include <atlbase.h>
#include <shlobj.h>
#include <dsclient.h>
#include <vector>
#include <string>
#include <adsprop.h>
#include "PropSheetHost.h"

Go to the source code of this file.

Defines

#define WIN32_LEAN_AND_MEAN

Define Documentation

#define WIN32_LEAN_AND_MEAN

Definition at line 23 of file stdafx.h.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/DevGuide/banner.inc File Reference

  • NetDS
  • ADSI
  • DevGuide

banner.inc File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/activedir/addgroup/vc/main.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • activedir
  • addgroup
  • vc
Defines | Functions | Variables

main.cpp File Reference

#include <windows.h>
#include <winuser.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
#include <winldap.h>
#include <activeds.h>
#include <assert.h>

Go to the source code of this file.

Defines

#define | _WIN32_DCOM
#define | INC_OLE2
#define | UNICODE 1

Functions

void | CheckADHRESULT (HRESULT passedhr, LPOLESTR pwReason)
WCHAR * | CrackADError (HRESULT hResult)
HRESULT | CreateGroup (IDirectoryObject *pDirObject, LPWSTR pwCommonName, LPWSTR pwSamAcctName, IDirectoryObject **ppDirObjRet, int iGroupType)
BOOL | ParseCommandLine (int argc, wchar_t *argv[])
void | PrintIADSObject (IADs *pIADs)
void | wmain (int argc, wchar_t *argv[])

Variables

BSTR | bsADsPathContainer
BSTR | bsNT5GroupName
BSTR | bsSamAcctName
int | iGroupType
WCHAR * | pwszUsage = " new group will be created with ADS_GROUP_TYPE_SECURITY_ENABLED\n"

Define Documentation

#define _WIN32_DCOM

Definition at line 4 of file main.cpp.

#define INC_OLE2

Definition at line 2 of file main.cpp.

#define UNICODE 1

Definition at line 3 of file main.cpp.

Function Documentation

void CheckADHRESULT | ( | HRESULT | passedhr,
 |  | LPOLESTR | pwReason
 | ) |  |

Definition at line 323 of file main.cpp.

{
    if (SUCCEEDED(passedhr))
        return;

    HRESULT hr;
    DWORD lError;
    WCHAR pwErrBuff[2048];
    WCHAR pwADErrBuff[512];

    WCHAR * pADErrCodeStr;

    pwErrBuff[0] = NULL;
    pADErrCodeStr = CrackADError( passedhr);

    // If an ADSI error code was returned, display it
    if (pADErrCodeStr[0] != NULL)
    {
        wcscat(pwErrBuff,L"<*> ADSI Error HRESULT Returns: <*> \n");
        wcscat(pwErrBuff,pADErrCodeStr);
        wcscat(pwErrBuff,L"\n");
    }

    // Call ADsGetLastError() to retrieve the error text from ADSI
    wcscat(pwErrBuff,L"<*> ADSI Error: <*>\n");

    hr = ADsGetLastError(
        &lError,
        pwADErrBuff,
        511,
        L"",
        0
        );

    if (FAILED(hr))
        wcscat(pwErrBuff,L"<Unable to retrieve ADs Error>");
    else
        wcscat(pwErrBuff,pwADErrBuff);

    wcscat(pwErrBuff,L"\n");

    WCHAR sz[1024];

    wcscat(pwErrBuff,L"<*> System Error: <*> \n");

    // Check the standard system to crack the bad HRESULT into a string
    if (!FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM, 0, passedhr, 0, sz, 1024, 0))
        wcscat(sz, L"Unknown HRESULT error");
    else
        wcscat(pwErrBuff, sz);

    // Display
    OutputDebugStringW(pwErrBuff);
    OutputDebugStringW(L"\r\n");
    _putws(L"\n**********");
    wprintf(L"\nERROR on %s\n\n",pwReason);
    _putws(pwErrBuff);
    _putws(L"\n**********");

}

WCHAR * CrackADError ( HRESULT hResult )

Definition at line 385 of file main.cpp.

{
   static WCHAR szwText[ 128 ];
   szwText[0] = 0l;

   switch( hResult )
   {
      case  E_ADS_BAD_PATHNAME:
         return L"E_ADS_BAD_PATHNAME";
         break;

      case  E_ADS_INVALID_DOMAIN_OBJECT:
         return L"E_ADS_INVALID_DOMAIN_OBJECT";
         break;

      case  E_ADS_INVALID_USER_OBJECT:
         return L"E_ADS_INVALID_USER_OBJECT";
         break;

      case  E_ADS_INVALID_COMPUTER_OBJECT:
         return L"E_ADS_INVALID_COMPUTER_OBJECT";
         break;

      case  E_ADS_UNKNOWN_OBJECT:
         return L"E_ADS_UNKNOWN_OBJECT";
         break;

      case  E_ADS_PROPERTY_NOT_SET:
         return L"E_ADS_PROPERTY_NOT_SET";
         break;

      case  E_ADS_PROPERTY_NOT_SUPPORTED:
         return L"E_ADS_PROPERTY_NOT_SUPPORTED";
         break;

      case  E_ADS_PROPERTY_INVALID:
         return L"E_ADS_PROPERTY_INVALID";
         break;

      case  E_ADS_BAD_PARAMETER:
         return L"E_ADS_BAD_PARAMETER";
         break;

      case  E_ADS_OBJECT_UNBOUND:
         return L"E_ADS_OBJECT_UNBOUND";
         break;

      case  E_ADS_PROPERTY_NOT_MODIFIED:
         return L"E_ADS_PROPERTY_NOT_MODIFIED";
         break;

      case  E_ADS_PROPERTY_MODIFIED:
         return L"E_ADS_PROPERTY_MODIFIED";
         break;

      case  E_ADS_CANT_CONVERT_DATATYPE:
         return L"E_ADS_CANT_CONVERT_DATATYPE";
         break;

      case  E_ADS_PROPERTY_NOT_FOUND:
         return L"E_ADS_PROPERTY_NOTFOUND";
         break;

      case  E_ADS_OBJECT_EXISTS:
         return L"E_ADS_OBJECT_EXISTS";
         break;

      case  E_ADS_SCHEMA_VIOLATION:
         return L"E_ADS_SCHEMA_VIOLATION";
         break;

      case  E_ADS_COLUMN_NOT_SET:
         return L"E_ADS_COLUMN_NOT_SET";
         break;

      case  E_ADS_INVALID_FILTER:
         return L"E_ADS_INVALID_FILTER";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_OPERATIONS_ERROR):
         return L"ERROR_DS_OPERATIONS_ERROR";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_PROTOCOL_ERROR):
         return L"ERROR_DS_PROTOCOL_ERROR";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_TIMELIMIT_EXCEEDED):
         return L"ERROR_DS_TIMELIMIT_EXCEEDED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_SIZELIMIT_EXCEEDED):
         return L"ERROR_DS_SIZELIMIT_EXCEEDED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_COMPARE_FALSE):
         return L"ERROR_DS_COMPARE_FALSE";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_COMPARE_TRUE):
         return L"ERROR_DS_COMPARE_TRUE";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_AUTH_METHOD_NOT_SUPPORTED):
         return L"ERROR_DS_AUTH_METHOD_NOT_SUPPORTED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_STRONG_AUTH_REQUIRED):
         return L"ERROR_DS_STRONG_AUTH_REQUIRED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_MORE_DATA):
         return L"ERROR_MORE_DATA";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_REFERRAL):
         return L"(ERROR_DS_REFERRAL";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_ADMIN_LIMIT_EXCEEDED):
         return L"ERROR_DS_ADMIN_LIMIT_EXCEEDED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_UNAVAILABLE_CRIT_EXTENSION):
         return L"(ERROR_DS_UNAVAILABLE_CRIT_EXTENSION";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_CONFIDENTIALITY_REQUIRED):
         return L"HRESULT_FROM_WIN32(ERROR_DS_CONFIDENTIALITY_REQUIRED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_NO_ATTRIBUTE_OR_VALUE):
         return L"ERROR_DS_NO_ATTRIBUTE_OR_VALUE";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_ATTRIBUTE_TYPE_UNDEFINED):
         return L"(ERROR_DS_ATTRIBUTE_TYPE_UNDEFINED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_INAPPROPRIATE_MATCHING):
         return L"(ERROR_DS_INAPPROPRIATE_MATCHING";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_CONSTRAINT_VIOLATION):
         return L"ERROR_DS_CONSTRAINT_VIOLATION";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_ATTRIBUTE_OR_VALUE_EXISTS):
         return L"ERROR_DS_ATTRIBUTE_OR_VALUE_EXISTS";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_INVALID_ATTRIBUTE_SYNTAX):
         return L"ERROR_DS_INVALID_ATTRIBUTE_SYNTAX";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_NO_SUCH_OBJECT):
         return L"ERROR_DS_NO_SUCH_OBJECT";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_INVALID_DN_SYNTAX):
         return L"ERROR_DS_INVALID_DN_SYNTAX";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_IS_LEAF):
         return L"ERROR_DS_IS_LEAF";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_ALIAS_DEREF_PROBLEM):
         return L"ERROR_DS_ALIAS_DEREF_PROBLEM";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_INAPPROPRIATE_AUTH):
         return L"ERROR_DS_INAPPROPRIATE_AUTH";
         break;

      case  HRESULT_FROM_WIN32(ERROR_INVALID_PASSWORD):
         return L"ERROR_INVALID_PASSWORD";
         break;

      case  HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED):
         return L"ERROR_ACCESS_DENIED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_BUSY):
         return L"ERROR_DS_BUSY";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_UNAVAILABLE):
         return L"ERROR_DS_UNAVAILABLE";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_UNWILLING_TO_PERFORM):
         return L"ERROR_DS_UNWILLING_TO_PERFORM";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_LOOP_DETECT):
         return L"ERROR_DS_LOOP_DETECT";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_NAMING_VIOLATION):
         return L"ERROR_DS_NAMING_VIOLATION";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_OBJ_CLASS_VIOLATION):
         return L"ERROR_DS_OBJ_CLASS_VIOLATION";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_CANT_ON_NON_LEAF):
         return L"ERROR_DS_CANT_ON_NONLEAF";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_CANT_ON_RDN):
         return L"ERROR_DS_CANT_ON_RDN";
         break;

      case  HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS):
         return L"ERROR_ALREADY_EXISTS";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_CANT_MOD_OBJ_CLASS):
         return L"ERROR_DS_CANT_MOD_OBJ_CLASS";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_OBJECT_RESULTS_TOO_LARGE):
         return L"ERROR_DS_OBJECT_RESULTS_TOO_LARGE";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_AFFECTS_MULTIPLE_DSAS):
         return L"ERROR_DS_AFFECTS_MULTIPLE_DSAS";
         break;

      case  HRESULT_FROM_WIN32(ERROR_GEN_FAILURE):
         return L"(ERROR_GEN_FAILURE";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_SERVER_DOWN):
         return L"ERROR_DS_SERVER_DOWN";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_LOCAL_ERROR):
         return L"ERROR_DS_LOCAL_ERROR";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_ENCODING_ERROR):
         return L"ERROR_DS_ENCODING_ERROR";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_DECODING_ERROR):
         return L"(ERROR_DS_DECODING_ERROR";
         break;

      case  HRESULT_FROM_WIN32(ERROR_TIMEOUT):
         return L"(ERROR_TIMEOUT";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_AUTH_UNKNOWN):
         return L"ERROR_DS_AUTH_UNKNOWN";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_FILTER_UNKNOWN):
         return L"(ERROR_DS_FILTER_UNKNOWN";
         break;

      case  HRESULT_FROM_WIN32(ERROR_CANCELLED):
         return L"(ERROR_CANCELLED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_PARAM_ERROR):
         return L"ERROR_DS_PARAM_ERROR";
         break;

      case  HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY):
         return L"ERROR_NOT_ENOUGH_MEMORY";
         break;

      case  HRESULT_FROM_WIN32(ERROR_CONNECTION_REFUSED):
         return L"ERROR_CONNECTION_REFUSED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_NOT_SUPPORTED):
         return L"ERROR_DS_NOT_SUPPORTED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_NO_RESULTS_RETURNED):
         return L"ERROR_DS_NO_RESULTS_RETURNED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_CONTROL_NOT_FOUND):
         return L"ERROR_DS_CONTROL_NOT_FOUND";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_CLIENT_LOOP):
         return L"(ERROR_DS_CLIENT_LOOP";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_REFERRAL_LIMIT_EXCEEDED):
         return L"ERROR_DS_REFERRAL_LIMIT_EXCEEDED";
         break;

      case  E_FAIL:
         return L"E_FAIL";
         break;

      case  E_NOTIMPL:
         return L"E_NOIMPL";
         break;

      case  S_OK:
         return L"OK";
         break;

      case  0x800704b8:
      // we have an extended error
      {
         WCHAR szErrorBuff[ 1024 ];
         WCHAR szNameBuff[ 1024 ];
         DWORD dwError;

         ADsGetLastError( &dwError,
                          szErrorBuff,
                          1023,
                          szNameBuff,
                          1023 );

         int sizeNameBuff = wcslen(szNameBuff);

    if(sizeNameBuff<1024-3)
    {
          wcsncat( szNameBuff, L" : ",3);
    if(1023-sizeNameBuff-3 >=0) //-3 for previous wcsncat
          wcsncat( szNameBuff, szErrorBuff,1023-sizeNameBuff-3);
    }
         wcsncat( szwText,szNameBuff,127);

         return szwText;
      }

   }

    return szwText;
}

HRESULT CreateGroup | ( | IDirectoryObject * | pDirObject,
 |  | LPWSTR | pwCommonName,
 |  | LPWSTR | pwSamAcctName,
 |  | IDirectoryObject ** | ppDirObjRet,
 |  | int | iGroupType
 | ) |  |

Definition at line 212 of file main.cpp.

{
    assert(pDirObject);
    if (wcslen(pwSamAcctName) >256)
    {
        MessageBox(NULL,L"SamAccountName CANNOT be bigger than 256 characters",L"Error: CreateSimpleGroup()",MB_ICONSTOP);
        assert(0);
        return E_FAIL;
    }

    HRESULT    hr;
    ADSVALUE   sAMValue;
    ADSVALUE   classValue;
    ADSVALUE   groupType;

    LPDISPATCH pDisp;
    WCHAR       pwCommonNameFull[1024];

    ADS_ATTR_INFO  attrInfo[] =
    {
       { L"objectClass", ADS_ATTR_UPDATE,
                           ADSTYPE_CASE_IGNORE_STRING, &classValue, 1 },
       {L"sAMAccountName", ADS_ATTR_UPDATE,
                           ADSTYPE_CASE_IGNORE_STRING, &sAMValue, 1},
       {L"groupType", ADS_ATTR_UPDATE,
                           ADSTYPE_INTEGER, &groupType, 1}
    };

    DWORD dwAttrs = sizeof(attrInfo)/sizeof(ADS_ATTR_INFO);

    classValue.dwType = ADSTYPE_CASE_IGNORE_STRING;
    classValue.CaseIgnoreString = L"group";

    sAMValue.dwType=ADSTYPE_CASE_IGNORE_STRING;
    sAMValue.CaseIgnoreString = pwSamAcctName;

    groupType.dwType=ADSTYPE_INTEGER;
    groupType.Integer =  iGroupType;

    wsprintfW(pwCommonNameFull,L"CN=%s",pwCommonName);

    hr = pDirObject->CreateDSObject( pwCommonNameFull,  attrInfo,
                                dwAttrs, &pDisp );
    if (SUCCEEDED(hr))
    {
        hr = pDisp->QueryInterface(IID_IDirectoryObject,(void**) ppDirObjRet);

        pDisp->Release();
        pDisp = NULL;
    }
    return hr;
}

BOOL ParseCommandLine | ( | int | argc,
 |  | wchar_t * | argv[]
 | ) |  |

Definition at line 138 of file main.cpp.

{
  if (argc < 4 || argc >6)
  {
        _putws(pwszUsage);
        return FALSE;
    }
    // if we have at least 3 arguments (the first is the EXE name)
    // Save them
    if (argc >= 4)
    {
        bsADsPathContainer  = SysAllocString(argv[1]);
        bsNT5GroupName      = SysAllocString(argv[2]);
        if(wcslen(bsNT5GroupName)>64) return FALSE;
        bsSamAcctName       = SysAllocString(argv[3]);
    }

    // was the group type passed in?
    if (argc >=5)
    {
        if (_wcsicmp(L"global",argv[4])==0)
            iGroupType = ADS_GROUP_TYPE_GLOBAL_GROUP;

        else if (_wcsicmp(L"local",argv[4])==0)
            iGroupType = ADS_GROUP_TYPE_DOMAIN_LOCAL_GROUP;

        else if (_wcsicmp(L"universal",argv[4])==0)
            iGroupType = ADS_GROUP_TYPE_UNIVERSAL_GROUP;

        else
      {
            _putws(L"!! Incorrect Group Type Parameter !!");
            _putws(pwszUsage);
            return FALSE;
        }
    }
     else   // Default to Global
        iGroupType = ADS_GROUP_TYPE_GLOBAL_GROUP;

    // was security enabled passed in?
    if (argc ==6)
    {
        if (_wcsicmp(L"security",argv[5])==0)
            iGroupType |= ADS_GROUP_TYPE_SECURITY_ENABLED;

        // else if the parameter there is NOT nosecurity- error
        else if (!(_wcsicmp(L"nosecurity",argv[5])==0))
        {
            _putws(L"!! Incorrect security Parameter !!");
            _putws(pwszUsage);
            return FALSE;
        }

    }
    else    // Default to security
        iGroupType |= ADS_GROUP_TYPE_SECURITY_ENABLED;

    return TRUE;
}

void PrintIADSObject ( IADs * pIADs )

Definition at line 274 of file main.cpp.

{
  assert(pIADs);

  BSTR bsResult;
  HRESULT hr = S_OK;

  hr = pIADs->get_Name(&bsResult);
  if(FAILED(hr)) {wprintf(L" Failed to get name\n"); return;}
  wprintf(L" NAME: %s\n",(LPOLESTR) bsResult);
  SysFreeString(bsResult);

  hr = pIADs->get_Class(&bsResult);
  if(FAILED(hr)) {wprintf(L" Failed to get class\n"); return;}
  wprintf(L" CLASS: %s\n",(LPOLESTR) bsResult);
  SysFreeString(bsResult);

  hr = pIADs->get_GUID(&bsResult);
  if(FAILED(hr)) {wprintf(L" Failed to get GUID\n"); return;}
  wprintf(L" GUID: %s\n",(LPOLESTR) bsResult);
  SysFreeString(bsResult);

  hr = pIADs->get_ADsPath(&bsResult);
  if(FAILED(hr)) {wprintf(L" Failed to get ADsPath\n"); return;}
  wprintf(L" ADSPATH: %s\n",(LPOLESTR) bsResult);
  SysFreeString(bsResult);

  hr = pIADs->get_Parent(&bsResult);
  if(FAILED(hr)) {wprintf(L" Failed to get parent\n"); return;}
  wprintf(L" PARENT: %s\n",(LPOLESTR) bsResult);
  SysFreeString(bsResult);

  hr = pIADs->get_Schema(&bsResult);
  if(FAILED(hr)) {wprintf(L" Failed to get schema\n"); return;}
  wprintf(L" SCHEMA: %s\n",(LPOLESTR) bsResult);
  SysFreeString(bsResult);

}

void wmain | ( | int | argc,
 |  | wchar_t * | argv[]
 | ) |  |

Definition at line 63 of file main.cpp.

{

    HRESULT hr;
    IDirectoryObject * pDirObjectContainer = NULL;
    IDirectoryObject * pDirObjRet = NULL;

    if (!ParseCommandLine(argc,argv))
        goto ret;

    // Initialize COM
    CoInitialize(0);

    // Bind to the container passed
    hr = ADsGetObject(  bsADsPathContainer, IID_IDirectoryObject,(void **)&pDirObjectContainer);

    if (SUCCEEDED(hr))
    {
        // Call the helper funtion to create the group
        hr = CreateGroup(pDirObjectContainer, bsNT5GroupName,bsSamAcctName,
                         &pDirObjRet,iGroupType);

        if (SUCCEEDED(hr))
        {
            _putws(L"\n New Group created with the following properties:");

            IADs * pIADsNewGoup = NULL;

            // Group succeeded- now get an IADs interface to it
            // and print some properties
            hr = pDirObjRet->QueryInterface(IID_IADs,(void**)&pIADsNewGoup);

            if (SUCCEEDED(hr))
            {
                PrintIADSObject(pIADsNewGoup);

                pIADsNewGoup->Release();
                pIADsNewGoup = NULL;
            }
            else
                CheckADHRESULT(hr,L"QueryInterface() - New group for IADs");
            pDirObjRet->Release();
            pDirObjRet = NULL;
        }
        else
            CheckADHRESULT(hr,L"CreateGroup()");

        pDirObjectContainer->Release();
        pDirObjectContainer = NULL;
    }
    else
        CheckADHRESULT(hr,L"ADsGetObject()");

    CoUninitialize();
    ret:
    if(!bsADsPathContainer) SysFreeString(bsADsPathContainer);
    if(!bsNT5GroupName) SysFreeString(bsNT5GroupName);
    if(!bsSamAcctName) SysFreeString(bsSamAcctName);

 }

Variable Documentation

BSTR bsADsPathContainer

Definition at line 41 of file main.cpp.

BSTR bsNT5GroupName

Definition at line 42 of file main.cpp.

BSTR bsSamAcctName

Definition at line 43 of file main.cpp.

int iGroupType

Definition at line 44 of file main.cpp.

WCHAR* pwszUsage = " new group will be created with ADS_GROUP_TYPE_SECURITY_ENABLED\n"

Definition at line 21 of file main.cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/activedir/adevent/ADEvent.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • activedir
  • adevent
Classes | Defines | Typedefs | Functions | Variables

ADEvent.cpp File Reference

#include <olectl.h>
#include <shlobj.h>
#include <dsclient.h>
#include "ADEvent.h"
#include <initguid.h>
#include <dsadmin.h>

Go to the source code of this file.

Classes

struct | _REGSTRUCT

Defines

#define | ARRAYSIZE(a) (sizeof(a)/sizeof(a[0]))

Typedefs

typedef struct _REGSTRUCT * | LPREGSTRUCT
typedef struct _REGSTRUCT | REGSTRUCT

Functions

DEFINE_GUID (CLSID_AdminEventHandler, 0x8698521, 0x653c, 0x4386, 0xb2, 0x6, 0xdf, 0xa3, 0xc0, 0xf9, 0x4, 0xe5)
BOOL | DeleteEntireKey (HKEY hKey, LPTSTR pszSubKey)
STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppReturn)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (VOID)
int | LocalToWideChar (LPWSTR pWide, LPTSTR pLocal, DWORD dwChars)
STDMETHODIMP_ (DWORD) CClassFactory
int | WideCharToLocal (LPTSTR pLocal, LPWSTR pWide, DWORD dwChars)

Variables

UINT g_DllRefCount
HINSTANCE | g_hInst
TCHAR | g_szMainTitle [] = TEXT("Sample AD Admin Notification Handler")

Define Documentation

#define ARRAYSIZE ( a ) (sizeof(a)/sizeof(a[0]))

Definition at line 50 of file ADEvent.cpp.

Typedef Documentation

typedef struct _REGSTRUCT * LPREGSTRUCT
typedef struct _REGSTRUCT REGSTRUCT

Function Documentation

DEFINE_GUID | ( | CLSID_AdminEventHandler | ,
 |  | 0x8698521 | ,
 |  | 0x653c | ,
 |  | 0x4386 | ,
 |  | 0xb2 | ,
 |  | 0x6 | ,
 |  | 0xdf | ,
 |  | 0xa3 | ,
 |  | 0xc0 | ,
 |  | 0xf9 | ,
 |  | 0x4 | ,
 |  | 0xe5 |
 | ) |  |
BOOL DeleteEntireKey | ( | HKEY | hKey,
 |  | LPTSTR | pszSubKey
 | ) |  |

Definition at line 708 of file ADEvent.cpp.

{
    LRESULT  lResult;
    HKEY     hEnumKey;

    lResult = RegOpenKeyEx( hKey,
                            pszSubKey,
                            0,
                            KEY_ENUMERATE_SUB_KEYS,
                            &hEnumKey);

    if(NOERROR == lResult)
    {
        TCHAR szKey[MAX_PATH];
        DWORD dwSize = MAX_PATH;

        while(ERROR_SUCCESS == RegEnumKeyEx(hEnumKey, 0, szKey, &dwSize, NULL, NULL, NULL, NULL))
        {
            DeleteEntireKey(hEnumKey, szKey);

            dwSize = MAX_PATH;
        }

        RegCloseKey(hEnumKey);
    }
    else
    {
        return FALSE;
    }

    RegDeleteKey(hKey, pszSubKey);

    return TRUE;
}

STDAPI DllCanUnloadNow ( void )

Definition at line 79 of file ADEvent.cpp.

{
    return (g_DllRefCount == 0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppReturn
 | ) |  |

Definition at line 90 of file ADEvent.cpp.

{
    *ppReturn = NULL;

    //if we don't support this classid, return the proper error code
    if(!IsEqualCLSID(rclsid, CLSID_AdminEventHandler))
    {
        return CLASS_E_CLASSNOTAVAILABLE;
    }

    //create a CClassFactory object and check it for validity
    CClassFactory *pClassFactory = new CClassFactory();
    if(NULL == pClassFactory)
    {
        return E_OUTOFMEMORY;
    }

    //get the QueryInterface return for our return value
    HRESULT hr = pClassFactory->QueryInterface(riid, ppReturn);

    //call Release to decement the ref count - creating the object set it to one
    //and QueryInterface incremented it - since its being used externally (not by
    //us), we only want the ref count to be 1
    pClassFactory->Release();

    //return the result from QueryInterface
    return hr;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID | lpReserved
 | ) |  |

Definition at line 59 of file ADEvent.cpp.

{
    switch(dwReason)
    {
    case DLL_PROCESS_ATTACH:
        g_hInst = hInstance;
        break;
    }

    return TRUE;
}

STDAPI DllRegisterServer ( void )

Definition at line 135 of file ADEvent.cpp.

{
    int      i;
    HKEY     hKey;
    LRESULT  lResult;
    DWORD    dwDisp;
    TCHAR    szSubKey[MAX_PATH];
    TCHAR    szCLSID[MAX_PATH];
    TCHAR    szModule[MAX_PATH];
    LPWSTR   pwsz;

    //get the CLSID in string form
    StringFromIID(CLSID_AdminEventHandler, &pwsz);

    if(pwsz)
    {
        WideCharToLocal(szCLSID, pwsz, ARRAYSIZE(szCLSID));

        //free the string
        LPMALLOC pMalloc;
        CoGetMalloc(1, &pMalloc);
        if(pMalloc)
        {
            pMalloc->Free(pwsz);
            pMalloc->Release();
        }
    }

    //get this DLL's path and file name
    GetModuleFileName(g_hInst, szModule, ARRAYSIZE(szModule));

    //register the CLSID entries
    REGSTRUCT ClsidEntries[] = {HKEY_CLASSES_ROOT,   TEXT("CLSID\\%s"),                                   NULL,                   g_szMainTitle,
                                HKEY_CLASSES_ROOT,   TEXT("CLSID\\%s\\InprocServer32"),                   NULL,                   TEXT("%s"),
                                HKEY_CLASSES_ROOT,   TEXT("CLSID\\%s\\InprocServer32"),                   TEXT("ThreadingModel"), TEXT("Apartment"),
                                NULL,                NULL,                                                NULL,                   NULL};

    for(i = 0; ClsidEntries[i].hRootKey; i++)
    {
        //Create the sub key string.
        wsprintf(szSubKey, ClsidEntries[i].lpszSubKey, szCLSID);

        lResult = RegCreateKeyEx(   ClsidEntries[i].hRootKey,
                                    szSubKey,
                                    0,
                                    NULL,
                                    REG_OPTION_NON_VOLATILE,
                                    KEY_WRITE,
                                    NULL,
                                    &hKey,
                                    &dwDisp);

        if(NOERROR == lResult)
        {
            TCHAR szData[MAX_PATH] = TEXT("");

            //if necessary, create the value string
            wsprintf(szData, ClsidEntries[i].lpszData, szModule);

            lResult = RegSetValueEx(    hKey,
                                        ClsidEntries[i].lpszValueName,
                                        0,
                                        REG_SZ,
                                        (LPBYTE)szData,
                                        lstrlen(szData) + 1);

            RegCloseKey(hKey);
        }
        else
        {
            return SELFREG_E_CLASS;
        }
    }

    return S_OK;
}

STDAPI DllUnregisterServer ( VOID )

Definition at line 218 of file ADEvent.cpp.

{
    LPWSTR   pwsz;
    TCHAR    szCLSID[MAX_PATH];
    TCHAR    szSubKey[MAX_PATH];

    //get the CLSID in string form
    StringFromIID(CLSID_AdminEventHandler, &pwsz);

    if(pwsz)
    {
        WideCharToLocal(szCLSID, pwsz, ARRAYSIZE(szCLSID));

        //free the string
        CoTaskMemFree(pwsz);
    }
    else
    {
        return E_FAIL;
    }

    //delete the object's registry entries
    wsprintf(szSubKey, TEXT("CLSID\\%s"), szCLSID);
    DeleteEntireKey(HKEY_CLASSES_ROOT, szSubKey);

    return S_OK;
}

int LocalToWideChar | ( | LPWSTR | pWide,
 |  | LPTSTR | pLocal,
 |  | DWORD | dwChars
 | ) |  |

Definition at line 684 of file ADEvent.cpp.

{
    *pWide = 0;

    #ifdef UNICODE
    lstrcpyn(pWide, pLocal, dwChars);
    #else
    MultiByteToWideChar(    CP_ACP,
                            0,
                            pLocal,
                            -1,
                            pWide,
                            dwChars);
    #endif

    return lstrlenW(pWide);
}

STDMETHODIMP_ ( DWORD )

Definition at line 467 of file ADEvent.cpp.

{
    if(--m_ObjRefCount == 0)
    {
        delete this;
        return 0;
    }

    return m_ObjRefCount;
}

int WideCharToLocal | ( | LPTSTR | pLocal,
 |  | LPWSTR | pWide,
 |  | DWORD | dwChars
 | ) |  |

Definition at line 658 of file ADEvent.cpp.

{
    *pLocal = 0;

    #ifdef UNICODE
    lstrcpyn(pLocal, pWide, dwChars);
    #else
    WideCharToMultiByte(    CP_ACP,
                            0,
                            pWide,
                            -1,
                            pLocal,
                            dwChars,
                            NULL,
                            NULL);
    #endif

    return lstrlen(pLocal);
}

Variable Documentation

UINT g_DllRefCount

Definition at line 47 of file ADEvent.cpp.

HINSTANCE g_hInst

Definition at line 46 of file ADEvent.cpp.

TCHAR g_szMainTitle[] = TEXT("Sample AD Admin Notification Handler")

Definition at line 48 of file ADEvent.cpp.

Generated on Wed Nov 13 2024 16:53:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/activedir/adevent/adevent.h File Reference

  • NetDS
  • ADSI
  • samples
  • activedir
  • adevent
Classes

adevent.h File Reference

#include <windows.h>
#include <iads.h>
#include <dsadmin.h>

Go to the source code of this file.

Classes

class | CAdminNotifyHandler
class | CClassFactory
Generated on Wed Nov 13 2024 16:53:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/activedir/attributes/vc/attributes.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • activedir
  • attributes
  • vc
Defines | Functions

attributes.cpp File Reference

#include <wchar.h>
#include <activeds.h>

Go to the source code of this file.

Defines

#define | ADS_SYSTEMFLAG_ATTR_IS_CONSTRUCTED (0x00000004)
#define | ADS_SYSTEMFLAG_ATTR_NOT_REPLICATED (0x00000001)
#define | LDAP_PROV L"LDAP://"

Functions

HRESULT | FindAttributesByType (IDirectorySearch *pSchemaNC, DWORD dwAttributeType, LPWSTR pszAttributerNameType, BOOL bIsExactMatch)
HRESULT | FindGCAttributes (IDirectorySearch *pSchemaNC, LPWSTR pszAttributeNameType, BOOL bInGC)
HRESULT | FindIndexedAttributes (IDirectorySearch *pSchemaNC, LPWSTR pszAttributeNameType, BOOL bIsIndexed)
int | main (int argc, char *argv[])

Define Documentation

#define ADS_SYSTEMFLAG_ATTR_IS_CONSTRUCTED (0x00000004)

Definition at line 11 of file attributes.cpp.

#define ADS_SYSTEMFLAG_ATTR_NOT_REPLICATED (0x00000001)

Definition at line 7 of file attributes.cpp.

#define LDAP_PROV L"LDAP://"

Definition at line 36 of file attributes.cpp.

Function Documentation

HRESULT FindAttributesByType | ( | IDirectorySearch * | pSchemaNC,
 |  | DWORD | dwAttributeType,
 |  | LPWSTR | pszAttributerNameType,
 |  | BOOL | bIsExactMatch
 | ) |  |

Definition at line 137 of file attributes.cpp.

{
    //Create search filter
    LPWSTR pszSearchFilter = new WCHAR[MAX_PATH*2];
    if (bIsExactMatch)
       //Find attributes with systemFlags that exactly match dwAttributeType
       wsprintf(pszSearchFilter, L"(&(objectCategory=attributeSchema)(systemFlags=%d))",dwAttributeType);
    else
       //Find attributes with systemFlags that contain dwAttributeType
        wsprintf(pszSearchFilter, L"(&(objectCategory=attributeSchema)(systemFlags:1.2.840.113556.1.4.804:=%d))",dwAttributeType);

    //Attributes are one-level deep in the Schema container so only need to search one level.
    ADS_SEARCHPREF_INFO SearchPrefs;
    SearchPrefs.dwSearchPref = ADS_SEARCHPREF_SEARCH_SCOPE;
    SearchPrefs.vValue.dwType = ADSTYPE_INTEGER;
    SearchPrefs.vValue.Integer = ADS_SCOPE_ONELEVEL;
    DWORD dwNumPrefs = 1;

    // COL for iterations
    ADS_SEARCH_COLUMN col;
    HRESULT hr;

    // Interface Pointers
    IADs    *pObj = NULL;
    IADs    * pIADs = NULL;

    // Handle used for searching
    ADS_SEARCH_HANDLE hSearch;

    // Set the search preference
    hr = pSchemaNC->SetSearchPreference( &SearchPrefs, dwNumPrefs);
    if (FAILED(hr))
        return hr;

    CONST DWORD dwAttrNameSize = 1;
    LPWSTR pszAttribute[dwAttrNameSize];

    if (!pszAttributeNameType)
        pszAttribute[0] = L"cn";
    else
        pszAttribute[0] = pszAttributeNameType;

    // Execute the search
    hr = pSchemaNC->ExecuteSearch(pszSearchFilter,
                                  pszAttribute,
                                  dwAttrNameSize,
                                  &hSearch
                                  );
    if ( SUCCEEDED(hr) )
    {

    // Call IDirectorySearch::GetNextRow() to retrieve the next row
    //of data
        while( pSchemaNC->GetNextRow( hSearch) != S_ADS_NOMORE_ROWS )
        {

            // loop through the array of passed column names,
            // print the data for each column
            for (DWORD x = 0; x < dwAttrNameSize; x++)
            {

                // Get the data for this column
                hr = pSchemaNC->GetColumn( hSearch, pszAttribute[x], &col );

                if ( SUCCEEDED(hr) )
                {

                    if (ADSTYPE_CASE_IGNORE_STRING == col.dwADsType)
                    {
                        // Print the data for the column and free the column
                        wprintf(L"%s: %s\r\n",pszAttribute[x],col.pADsValues->CaseIgnoreString);
                    }
                    else
                        wprintf(L"<%s property is not a string>",pszAttribute[x]);

                    pSchemaNC->FreeColumn( &col );
                }
                else
                    wprintf(L"<Could not get value for %s property>",pszAttribute[x]);

            }
        }

        // Close the search handle to clean up
        pSchemaNC->CloseSearchHandle(hSearch);
    }
    delete pszSearchFilter;
    return hr;
}

HRESULT FindGCAttributes | ( | IDirectorySearch * | pSchemaNC,
 |  | LPWSTR | pszAttributeNameType,
 |  | BOOL | bInGC
 | ) |  |

Definition at line 330 of file attributes.cpp.

{
    //Create search filter
    LPWSTR pszSearchFilter = new WCHAR[MAX_PATH*2];
    LPWSTR szBool = NULL;
    if (bInGC)
       szBool = L"TRUE";
    else
       szBool = L"FALSE";

    wsprintf(pszSearchFilter, L"(&(objectCategory=attributeSchema)(isMemberOfPartialAttributeSet=%s))",szBool);

    //Attributes are one-level deep in the Schema container so only need to search one level.
    ADS_SEARCHPREF_INFO SearchPrefs;
    SearchPrefs.dwSearchPref = ADS_SEARCHPREF_SEARCH_SCOPE;
    SearchPrefs.vValue.dwType = ADSTYPE_INTEGER;
    SearchPrefs.vValue.Integer = ADS_SCOPE_ONELEVEL;
    DWORD dwNumPrefs = 1;

    // COL for iterations
    ADS_SEARCH_COLUMN col;
    HRESULT hr;

    // Interface Pointers
    IADs    *pObj = NULL;
    IADs    * pIADs = NULL;

    // Handle used for searching
    ADS_SEARCH_HANDLE hSearch;

    // Set the search preference
    hr = pSchemaNC->SetSearchPreference( &SearchPrefs, dwNumPrefs);
    if (FAILED(hr))
        return hr;

    CONST DWORD dwAttrNameSize = 1;
    LPWSTR pszAttribute[dwAttrNameSize];

    if (!pszAttributeNameType)
        pszAttribute[0] = L"cn";
    else
        pszAttribute[0] = pszAttributeNameType;

    // Execute the search
    hr = pSchemaNC->ExecuteSearch(pszSearchFilter,
                                  pszAttribute,
                                  dwAttrNameSize,
                                  &hSearch
                                  );
    if ( SUCCEEDED(hr) )
    {

    // Call IDirectorySearch::GetNextRow() to retrieve the next row
    //of data
        while( pSchemaNC->GetNextRow( hSearch) != S_ADS_NOMORE_ROWS )
        {

            // loop through the array of passed column names,
            // print the data for each column
            for (DWORD x = 0; x < dwAttrNameSize; x++)
            {

                // Get the data for this column
                hr = pSchemaNC->GetColumn( hSearch, pszAttribute[x], &col );

                if ( SUCCEEDED(hr) )
                {

                    if (ADSTYPE_CASE_IGNORE_STRING == col.dwADsType)
                    {
                        // Print the data for the column and free the column
                        wprintf(L"%s: %s\r\n",pszAttribute[x],col.pADsValues->CaseIgnoreString);
                    }
                    else
                        wprintf(L"<%s property is not a string>",pszAttribute[x]);

                    pSchemaNC->FreeColumn( &col );
                }
                else
                    wprintf(L"<Could not get value for %s property>",pszAttribute[x]);
            }
        }

        // Close the search handle to clean up
        pSchemaNC->CloseSearchHandle(hSearch);
    }
    delete pszSearchFilter;
    return hr;
}

HRESULT FindIndexedAttributes | ( | IDirectorySearch * | pSchemaNC,
 |  | LPWSTR | pszAttributeNameType,
 |  | BOOL | bIsIndexed
 | ) |  |

Definition at line 234 of file attributes.cpp.

{
    //Create search filter
    LPWSTR pszSearchFilter = new WCHAR[MAX_PATH*2];
    DWORD dwIndexed;
    if (bIsIndexed)
       dwIndexed = 1;
    else
       dwIndexed = 0;

    wsprintf(pszSearchFilter, L"(&(objectCategory=attributeSchema)(searchFlags=%d))",dwIndexed);

    //Attributes are one-level deep in the Schema container so only need to search one level.
    ADS_SEARCHPREF_INFO SearchPrefs;
    SearchPrefs.dwSearchPref = ADS_SEARCHPREF_SEARCH_SCOPE;
    SearchPrefs.vValue.dwType = ADSTYPE_INTEGER;
    SearchPrefs.vValue.Integer = ADS_SCOPE_ONELEVEL;
    DWORD dwNumPrefs = 1;

    // COL for iterations
    ADS_SEARCH_COLUMN col;
    HRESULT hr;

    // Interface Pointers
    IADs    *pObj = NULL;
    IADs    * pIADs = NULL;

    // Handle used for searching
    ADS_SEARCH_HANDLE hSearch;

    // Set the search preference
    hr = pSchemaNC->SetSearchPreference( &SearchPrefs, dwNumPrefs);
    if (FAILED(hr))
        return hr;

    CONST DWORD dwAttrNameSize = 1;
    LPWSTR pszAttribute[dwAttrNameSize];

    if (!pszAttributeNameType)
        pszAttribute[0] = L"cn";
    else
        pszAttribute[0] = pszAttributeNameType;

    // Execute the search
    hr = pSchemaNC->ExecuteSearch(pszSearchFilter,
                                  pszAttribute,
                                  dwAttrNameSize,
                                  &hSearch
                                  );
    if ( SUCCEEDED(hr) )
    {

    // Call IDirectorySearch::GetNextRow() to retrieve the next row
    //of data
        while( pSchemaNC->GetNextRow( hSearch) != S_ADS_NOMORE_ROWS )
        {

            // loop through the array of passed column names,
            // print the data for each column
            for (DWORD x = 0; x < dwAttrNameSize; x++)
            {

                // Get the data for this column
                hr = pSchemaNC->GetColumn( hSearch, pszAttribute[x], &col );

                if ( SUCCEEDED(hr) )
                {

                    if (ADSTYPE_CASE_IGNORE_STRING == col.dwADsType)
                    {
                        // Print the data for the column and free the column
                        wprintf(L"%s: %s\r\n",pszAttribute[x],col.pADsValues->CaseIgnoreString);
                    }
                    else
                        wprintf(L"<%s property is not a string>",pszAttribute[x]);

                    pSchemaNC->FreeColumn( &col );
                }
                else
                    wprintf(L"<Could not get value for %s property>",pszAttribute[x]);
            }
        }

        // Close the search handle to clean up
        pSchemaNC->CloseSearchHandle(hSearch);
    }
    delete pszSearchFilter;
    return hr;
}

int main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 38 of file attributes.cpp.

{
LPWSTR szPath = new WCHAR[MAX_PATH];
HRESULT hr = S_OK;
IADs *pObject = NULL;
IDirectorySearch *pSchemaNC = NULL;
VARIANT var;

//Initialize COM
CoInitialize(NULL);

wprintf(L"This program displays the following types of attributes in the schema:\n");
wprintf(L"Non-Replicated, Indexed, Constructed, Global Catalog\n\n");

//wcscpy(szPath, L"LDAP://");
//Get rootDSE and the schema container's DN.
//Bind to current user's domain using current user's security context.
hr = ADsOpenObject(L"LDAP://rootDSE", //NOTE: If you're running NT 4.0, Win9x, you must add
                                      // the server name, e.g LDAP://myServer/rootDSE
                 NULL,
                 NULL,
                 ADS_SECURE_AUTHENTICATION, //Use Secure Authentication
                 IID_IADs,
                 (void**)&pObject);

if (SUCCEEDED(hr))
{
    hr = pObject->Get(L"schemaNamingContext",&var);
    if (SUCCEEDED(hr))
    {
        memset(szPath, 0, MAX_PATH);
        if (MAX_PATH >= (wcslen(LDAP_PROV) + wcslen(var.bstrVal)))
        {
            wcsncpy(szPath,LDAP_PROV, wcslen(LDAP_PROV));
            wcsncat(szPath,var.bstrVal, wcslen(var.bstrVal));
        }
        hr = ADsOpenObject(szPath,
                         NULL,
                         NULL,
                         ADS_SECURE_AUTHENTICATION, //Use Secure Authentication
                         IID_IDirectorySearch,
                         (void**)&pSchemaNC);

        if (SUCCEEDED(hr))
        {
            //Find non-replicated attributes
            wprintf (L"----------------------------------------------\n");
            wprintf(L"Non-Replicated attributes (stored on each domain controller but are not replicated elsewhere)\n");
            wprintf(L"Find non-replicated attributes\n");
            hr = FindAttributesByType(pSchemaNC, //IDirectorySearch pointer to schema naming context.
                                     ADS_SYSTEMFLAG_ATTR_NOT_REPLICATED, //Bit flags to search for in systemFlags
                                     L"ldapDisplayName",
                                     TRUE
                                     );

            //Find attributes included in the global catalog
            wprintf (L"----------------------------------------------\n");
            wprintf(L"Global Catalog attributes (replicated to the Global Catalog)\n");
            wprintf(L"Find attributes included in the global catalog\n");
            hr = FindGCAttributes(pSchemaNC,
                                 L"ldapDisplayName",
                                 TRUE
                                 );

            //Find constructed attributes
            wprintf (L"----------------------------------------------\n");
            wprintf(L"Constructed attributes (not stored in the directory but are calculated by the domain controller)\n");
            wprintf(L"Find constructed attributes\n");
            hr = FindAttributesByType(pSchemaNC, //IDirectorySearch pointer to schema naming context.
                                     ADS_SYSTEMFLAG_ATTR_IS_CONSTRUCTED, //Bit flags to search for in systemFlags
                                     L"ldapDisplayName",
                                     FALSE
                                     );

            //Find indexed attributes
            wprintf (L"----------------------------------------------\n");
            wprintf(L"Indexed attributes (indexed for efficient search)\n");
            wprintf(L"Find indexed attributes\n");
            hr = FindIndexedAttributes(pSchemaNC, //IDirectorySearch pointer to schema naming context.
                                      L"ldapDisplayName",
                                      TRUE
                                      );

        }
        if (pSchemaNC)
           pSchemaNC->Release();
    }
    VariantClear(&var);
}
if (pObject)
    pObject->Release();

// Uninitialize COM
CoUninitialize();
delete szPath;
return 0;
}

Generated on Wed Nov 13 2024 16:53:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/activedir/bindtoparent/vc/bindtoparent.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • activedir
  • bindtoparent
  • vc
Functions

bindtoparent.cpp File Reference

#include <wchar.h>
#include <objbase.h>
#include <activeds.h>

Go to the source code of this file.

Functions

HRESULT | FindUserByName (IDirectorySearch *pSearchBase, LPOLESTR szFindUser, IADs **ppUser)
HRESULT | GetParentObject (IADs *pObject, IADs **ppParent)
void | wmain (int argc, wchar_t *argv[])

Function Documentation

HRESULT FindUserByName | ( | IDirectorySearch * | pSearchBase,
 |  | LPOLESTR | szFindUser,
 |  | IADs ** | ppUser
 | ) |  |

Definition at line 180 of file bindtoparent.cpp.

{
  HRESULT hr = S_OK;

  if ((!pSearchBase)||(!szFindUser))
    return E_INVALIDARG;

  //Create search filter
  LPOLESTR pszSearchFilter = new OLECHAR[MAX_PATH];
  LPOLESTR szADsPath = new OLECHAR[MAX_PATH];
  wcscpy(pszSearchFilter, L"(&(objectCategory=person)(objectClass=user)(cn=");
  wcscat(pszSearchFilter, szFindUser);
  wcscat(pszSearchFilter, L"))");

  //Search entire subtree from root.
  ADS_SEARCHPREF_INFO SearchPrefs;
  SearchPrefs.dwSearchPref = ADS_SEARCHPREF_SEARCH_SCOPE;
  SearchPrefs.vValue.dwType = ADSTYPE_INTEGER;
  SearchPrefs.vValue.Integer = ADS_SCOPE_SUBTREE;
  DWORD dwNumPrefs = 1;

  // COL for iterations
  ADS_SEARCH_COLUMN col;
  // Handle used for searching
  ADS_SEARCH_HANDLE hSearch;
  // Set the search preference

  hr = pSearchBase->SetSearchPreference( &SearchPrefs, dwNumPrefs);
  if (FAILED(hr))
  {
    delete pszSearchFilter;
    delete szADsPath;
    return hr;
  }

  // Set attributes to return
  LPOLESTR pszAttribute[1] = {L"ADsPath"};

  // Execute the search
  hr = pSearchBase->ExecuteSearch(pszSearchFilter,
                                    pszAttribute,
                1,
                &hSearch
                );

  DWORD noUsersFound = 0;
  if (SUCCEEDED(hr))
  {

    // Call IDirectorySearch::GetNextRow() to retrieve the next row
    //of data
    while( pSearchBase->GetNextRow( hSearch) != S_ADS_NOMORE_ROWS )
    {

      if(noUsersFound>0 && ((*ppUser) != NULL))(*ppUser)->Release();
      wprintf(L"Found User %s.\n",szFindUser);
      // Get the data for this column
      hr = pSearchBase->GetColumn( hSearch, pszAttribute[0], &col );
      if ( SUCCEEDED(hr) )
      {
        // Print the data for the column and free the column
        // Note the attribute we asked for is type CaseIgnoreString.
        wcscpy(szADsPath, col.pADsValues->CaseIgnoreString);
        wprintf(L"%s: %s\r\n",pszAttribute[0],col.pADsValues->CaseIgnoreString);
        hr = ADsOpenObject(szADsPath,
                 NULL,
                 NULL,
                 ADS_SECURE_AUTHENTICATION, //Use Secure Authentication
                 IID_IADs,
                 (void**)ppUser);
        if(SUCCEEDED(hr)) noUsersFound ++;

        pSearchBase->FreeColumn( &col );
      }
    }
    // Close the search handle to clean up
          pSearchBase->CloseSearchHandle(hSearch);
  }

  if (noUsersFound>1)
  {
    VARIANT var;
    wprintf(L"---------------------------------------------------\n");
    wprintf(L"More than one user with CN %s was found.\n",szFindUser);
    (*ppUser)->Get(L"distinguishedName", &var);
    wprintf(L"Returning pointer to User (DN): %s\n",var.bstrVal);
    wprintf(L"---------------------------------------------------\n");
    VariantClear(&var);
  }

  if(noUsersFound == 0) hr = E_FAIL;

  delete pszSearchFilter;
  delete szADsPath;
  return hr;
}

HRESULT GetParentObject | ( | IADs * | pObject,
 |  | IADs ** | ppParent
 | ) |  |

Definition at line 143 of file bindtoparent.cpp.

{
  if ((!pObject)||(!ppParent))
    return E_INVALIDARG;

  HRESULT hr = E_FAIL;
  BSTR bstr;
  hr = pObject->get_Parent(&bstr);
  if (SUCCEEDED(hr))
  {
    //Bind to the parent container.
    *ppParent = NULL;
        hr = ADsOpenObject(bstr,
       NULL,
       NULL,
       ADS_SECURE_AUTHENTICATION, //Use Secure Authentication
       IID_IADs,
       (void**)ppParent);
    if(FAILED(hr))
    {
      if ((*ppParent))
      {
          (*ppParent)->Release();
              (*ppParent) = NULL;
      }
    }
  }
       FreeADsStr(bstr);
  return hr;
}

void wmain | ( | int | argc,
 |  | wchar_t * | argv[]
 | ) |  |

Definition at line 16 of file bindtoparent.cpp.

{

//Handle the command line arguments.
LPOLESTR pszBuffer = new OLECHAR[MAX_PATH*2];
if (argv[1] == NULL)
{
  wprintf(L"This program finds a user in the current Window 2000 domain\n");
  wprintf(L"and displays its parent container's ADsPath and binds to that container.\n");
  wprintf(L"Enter Common Name of the user to find:");
  _getws(pszBuffer);
}
else
   wcscpy(pszBuffer, argv[1]);
//if empty string, exit.
if (0==wcscmp(L"", pszBuffer))
{
   delete pszBuffer;
   return;
}

wprintf(L"\nFinding user: %s...\n",pszBuffer);

//Intialize COM
CoInitialize(NULL);
HRESULT hr = S_OK;
//Get rootDSE and the domain container's DN.
IADs *pObject = NULL;
IADs *pParent = NULL;
IDirectorySearch *pDS = NULL;
LPOLESTR szPath = new OLECHAR[MAX_PATH]; //[seyitb] delete at the end
VARIANT var;
hr = ADsOpenObject(L"LDAP://rootDSE",
         NULL,
         NULL,
         ADS_SECURE_AUTHENTICATION, //Use Secure Authentication
         IID_IADs,
         (void**)&pObject);
if (FAILED(hr))
{
   wprintf(L"Not Found. Could not bind to the domain.\n");
   if (pObject)
     pObject->Release();
    delete pszBuffer;
    delete szPath;
   return;
}

hr = pObject->Get(L"defaultNamingContext",&var);
if (SUCCEEDED(hr))
{
  wcscpy(szPath,L"LDAP://"); // If you're running on NT 4.0 or Win9.x machine, you need to
                             // add the server name e.g L"LDAP://myServer"
  wcscat(szPath,var.bstrVal);
  VariantClear(&var);
  if (pObject)
  {
     pObject->Release();
     pObject = NULL;
  }
  //Bind to the root of the current domain.
  hr = ADsOpenObject(szPath,
           NULL,
           NULL,
           ADS_SECURE_AUTHENTICATION, //Use Secure Authentication
           IID_IDirectorySearch,
           (void**)&pDS);
  if (SUCCEEDED(hr))
  {
    hr =  FindUserByName(pDS, //Container to search
               pszBuffer, //Name of user to find.
               &pObject); //Return a pointer to the user
    if (pDS)  pDS->Release();

    if (SUCCEEDED(hr))
    {
      BSTR bstr, bstrC;
                hr = GetParentObject(pObject, //Pointer the object whose parent to bind to.
            &pParent //Return a pointer to the parent object.
            );
      if (SUCCEEDED(hr))
      {
           wprintf(L"Successfully bound to parent container\n");
           //Get ADsPath
           hr = pParent->get_ADsPath(&bstr);
             //Get the distinguishedName property
                hr = pParent->Get(L"distinguishedName", &var);
           //Get class
           hr = pParent->get_Class(&bstrC);
             if (SUCCEEDED(hr))
           {
                 wprintf(L"ADsPath: %s\n",bstr);
            wprintf(L"DN: %s\n",var.bstrVal);
            wprintf(L"Class: %s\n",bstrC);
           }
           else
              wprintf(L"Get method failed with hr: %x\n",hr);
           VariantClear(&var);
           //Free the BSTR.
                   FreeADsStr(bstr);
                   FreeADsStr(bstrC);
      }
      else
        wprintf(L"GetParentObject failed with hr: %x\n",hr);
      if (pParent)
        pParent->Release();
    }
    else
    {
                wprintf(L"User \"%s\" not Found.\n",pszBuffer);
      wprintf (L"FindUserByName failed with the following HR: %x\n", hr);
    }
    if (pObject)
      pObject->Release();
  }
}

delete pszBuffer;
delete szPath;

//Uninitalize COM
CoUninitialize();

return;
}

Generated on Wed Nov 13 2024 16:53:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/activedir/createuser/vc/CreateUserHelpers.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • activedir
  • createuser
  • vc
Defines | Functions

CreateUserHelpers.cpp File Reference

#include <windows.h>
#include <winuser.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
#include <winldap.h>
#include <activeds.h>
#include <assert.h>
#include "CreateUserHelpers.h"

Go to the source code of this file.

Defines

#define | _WIN32_DCOM
#define | INC_OLE2
#define | UNICODE 1

Functions

void | CheckADHRESULT (HRESULT passedhr, LPOLESTR pwReason)
WCHAR * | CrackADError (HRESULT hResult)
int | IS_BUFFER_ENOUGH (UINT maxAlloc, LPWSTR pszTarget, LPCWSTR pszSource, int toCopy=1)
void | PrintIADSObject (IADs *pIADs)
bool | SAFE_APPEND (int targetSize, LPWSTR szTarget, LPCWSTR szSource)

Define Documentation

#define _WIN32_DCOM

Definition at line 3 of file CreateUserHelpers.cpp.

#define INC_OLE2

Definition at line 1 of file CreateUserHelpers.cpp.

#define UNICODE 1

Definition at line 2 of file CreateUserHelpers.cpp.

Function Documentation

void CheckADHRESULT | ( | HRESULT | passedhr,
 |  | LPOLESTR | pwReason
 | ) |  |

Definition at line 83 of file CreateUserHelpers.cpp.

{
    if (SUCCEEDED(passedhr))
        return;

    HRESULT hr;
    DWORD lError;
    WCHAR pwErrBuff[2048];
    WCHAR pwADErrBuff[512];
    WCHAR * pADErrCodeStr;

    pwErrBuff[0] = NULL;
    pADErrCodeStr = CrackADError( passedhr);

  int maxAlloc = sizeof(pwErrBuff)/sizeof(WCHAR);

    // If an ADSI error code was returned, display it
    if (pADErrCodeStr[0] != NULL)
    {
    SAFE_APPEND(maxAlloc, pwErrBuff, L"<*> ADSI Error HRESULT Returns: <*> \n");
    SAFE_APPEND(maxAlloc, pwErrBuff, pADErrCodeStr);
    SAFE_APPEND(maxAlloc, pwErrBuff, L"\n");
    }

    // Call ADsGetLastError() to retrieve the error text from ADSI
  SAFE_APPEND(maxAlloc, pwErrBuff, L"<*> ADSI Error: <*>\n");

    hr = ADsGetLastError(
        &lError,
        pwADErrBuff,
        2047,
        L"",
        0
        );

    if (FAILED(hr))
    SAFE_APPEND(maxAlloc, pwErrBuff, L"<Unable to retrieve ADs Error>");
    else
    SAFE_APPEND(maxAlloc, pwErrBuff, pwADErrBuff);

  SAFE_APPEND(maxAlloc, pwErrBuff, L"\n");

    WCHAR sz[1024];

  SAFE_APPEND(maxAlloc, pwErrBuff, L"<*> System Error: <*> \n");

    // Check the standard system to crack the bad HRESULT into a string
    if (!FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM, 0, passedhr, 0, sz, 1024, 0))
        wcscat(sz, L"Unknown HRESULT error");
    else
    SAFE_APPEND(maxAlloc, pwErrBuff, sz);

    // Display
    OutputDebugStringW(pwErrBuff);
    OutputDebugStringW(L"\r\n");
    _putws(L"\n**********");
    wprintf(L"\nERROR on %s\n\n",pwReason);
    _putws(pwErrBuff);
    _putws(L"\n**********");

}

WCHAR* CrackADError ( HRESULT hResult )

Definition at line 149 of file CreateUserHelpers.cpp.

{
   static WCHAR szwText[ 128 ];
   szwText[0] = 0l;

   switch( hResult )
   {
      case  E_ADS_BAD_PATHNAME:
         return L"E_ADS_BAD_PATHNAME";
         break;

      case  E_ADS_INVALID_DOMAIN_OBJECT:
         return L"E_ADS_INVALID_DOMAIN_OBJECT";
         break;

      case  E_ADS_INVALID_USER_OBJECT:
         return L"E_ADS_INVALID_USER_OBJECT";
         break;

      case  E_ADS_INVALID_COMPUTER_OBJECT:
         return L"E_ADS_INVALID_COMPUTER_OBJECT";
         break;

      case  E_ADS_UNKNOWN_OBJECT:
         return L"E_ADS_UNKNOWN_OBJECT";
         break;

      case  E_ADS_PROPERTY_NOT_SET:
         return L"E_ADS_PROPERTY_NOT_SET";
         break;

      case  E_ADS_PROPERTY_NOT_SUPPORTED:
         return L"E_ADS_PROPERTY_NOT_SUPPORTED";
         break;

      case  E_ADS_PROPERTY_INVALID:
         return L"E_ADS_PROPERTY_INVALID";
         break;

      case  E_ADS_BAD_PARAMETER:
         return L"E_ADS_BAD_PARAMETER";
         break;

      case  E_ADS_OBJECT_UNBOUND:
         return L"E_ADS_OBJECT_UNBOUND";
         break;

      case  E_ADS_PROPERTY_NOT_MODIFIED:
         return L"E_ADS_PROPERTY_NOT_MODIFIED";
         break;

      case  E_ADS_PROPERTY_MODIFIED:
         return L"E_ADS_PROPERTY_MODIFIED";
         break;

      case  E_ADS_CANT_CONVERT_DATATYPE:
         return L"E_ADS_CANT_CONVERT_DATATYPE";
         break;

      case  E_ADS_PROPERTY_NOT_FOUND:
         return L"E_ADS_PROPERTY_NOTFOUND";
         break;

      case  E_ADS_OBJECT_EXISTS:
         return L"E_ADS_OBJECT_EXISTS";
         break;

      case  E_ADS_SCHEMA_VIOLATION:
         return L"E_ADS_SCHEMA_VIOLATION";
         break;

      case  E_ADS_COLUMN_NOT_SET:
         return L"E_ADS_COLUMN_NOT_SET";
         break;

      case  E_ADS_INVALID_FILTER:
         return L"E_ADS_INVALID_FILTER";
         break;

      //case  E_ADS_LDAP_BASE:
      //   return L"E_ADS_LDAP_BASE";
      //   break;

      case  HRESULT_FROM_WIN32(ERROR_DS_OPERATIONS_ERROR):
         return L"ERROR_DS_OPERATIONS_ERROR";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_PROTOCOL_ERROR):
         return L"ERROR_DS_PROTOCOL_ERROR";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_TIMELIMIT_EXCEEDED):
         return L"ERROR_DS_TIMELIMIT_EXCEEDED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_SIZELIMIT_EXCEEDED):
         return L"ERROR_DS_SIZELIMIT_EXCEEDED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_COMPARE_FALSE):
         return L"ERROR_DS_COMPARE_FALSE";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_COMPARE_TRUE):
         return L"ERROR_DS_COMPARE_TRUE";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_AUTH_METHOD_NOT_SUPPORTED):
         return L"ERROR_DS_AUTH_METHOD_NOT_SUPPORTED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_STRONG_AUTH_REQUIRED):
         return L"ERROR_DS_STRONG_AUTH_REQUIRED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_MORE_DATA):
         return L"ERROR_MORE_DATA";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_REFERRAL):
         return L"(ERROR_DS_REFERRAL";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_ADMIN_LIMIT_EXCEEDED):
         return L"ERROR_DS_ADMIN_LIMIT_EXCEEDED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_UNAVAILABLE_CRIT_EXTENSION):
         return L"(ERROR_DS_UNAVAILABLE_CRIT_EXTENSION";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_CONFIDENTIALITY_REQUIRED):
         return L"HRESULT_FROM_WIN32(ERROR_DS_CONFIDENTIALITY_REQUIRED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_NO_ATTRIBUTE_OR_VALUE):
         return L"ERROR_DS_NO_ATTRIBUTE_OR_VALUE";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_ATTRIBUTE_TYPE_UNDEFINED):
         return L"(ERROR_DS_ATTRIBUTE_TYPE_UNDEFINED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_INAPPROPRIATE_MATCHING):
         return L"(ERROR_DS_INAPPROPRIATE_MATCHING";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_CONSTRAINT_VIOLATION):
         return L"ERROR_DS_CONSTRAINT_VIOLATION";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_ATTRIBUTE_OR_VALUE_EXISTS):
         return L"ERROR_DS_ATTRIBUTE_OR_VALUE_EXISTS";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_INVALID_ATTRIBUTE_SYNTAX):
         return L"ERROR_DS_INVALID_ATTRIBUTE_SYNTAX";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_NO_SUCH_OBJECT):
         return L"ERROR_DS_NO_SUCH_OBJECT";
         break;

      // case  HRESULT_FROM_WIN32(E_ADS_LDAP_ALIAS_PROBLEM:
         // return L"HRESULT_FROM_WIN32(E_ADS_LDAP_ALIAS_PROBLEM";
         // break;

      case  HRESULT_FROM_WIN32(ERROR_DS_INVALID_DN_SYNTAX):
         return L"ERROR_DS_INVALID_DN_SYNTAX";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_IS_LEAF):
         return L"ERROR_DS_IS_LEAF";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_ALIAS_DEREF_PROBLEM):
         return L"ERROR_DS_ALIAS_DEREF_PROBLEM";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_INAPPROPRIATE_AUTH):
         return L"ERROR_DS_INAPPROPRIATE_AUTH";
         break;

      case  HRESULT_FROM_WIN32(ERROR_INVALID_PASSWORD):
         return L"ERROR_INVALID_PASSWORD";
         break;

      case  HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED):
         return L"ERROR_ACCESS_DENIED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_BUSY):
         return L"ERROR_DS_BUSY";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_UNAVAILABLE):
         return L"ERROR_DS_UNAVAILABLE";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_UNWILLING_TO_PERFORM):
         return L"ERROR_DS_UNWILLING_TO_PERFORM";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_LOOP_DETECT):
         return L"ERROR_DS_LOOP_DETECT";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_NAMING_VIOLATION):
         return L"ERROR_DS_NAMING_VIOLATION";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_OBJ_CLASS_VIOLATION):
         return L"ERROR_DS_OBJ_CLASS_VIOLATION";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_CANT_ON_NON_LEAF):
         return L"ERROR_DS_CANT_ON_NONLEAF";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_CANT_ON_RDN):
         return L"ERROR_DS_CANT_ON_RDN";
         break;

      case  HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS):
         return L"ERROR_ALREADY_EXISTS";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_CANT_MOD_OBJ_CLASS):
         return L"ERROR_DS_CANT_MOD_OBJ_CLASS";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_OBJECT_RESULTS_TOO_LARGE):
         return L"ERROR_DS_OBJECT_RESULTS_TOO_LARGE";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_AFFECTS_MULTIPLE_DSAS):
         return L"ERROR_DS_AFFECTS_MULTIPLE_DSAS";
         break;

      case  HRESULT_FROM_WIN32(ERROR_GEN_FAILURE):
         return L"(ERROR_GEN_FAILURE";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_SERVER_DOWN):
         return L"ERROR_DS_SERVER_DOWN";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_LOCAL_ERROR):
         return L"ERROR_DS_LOCAL_ERROR";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_ENCODING_ERROR):
         return L"ERROR_DS_ENCODING_ERROR";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_DECODING_ERROR):
         return L"(ERROR_DS_DECODING_ERROR";
         break;

      case  HRESULT_FROM_WIN32(ERROR_TIMEOUT):
         return L"(ERROR_TIMEOUT";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_AUTH_UNKNOWN):
         return L"ERROR_DS_AUTH_UNKNOWN";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_FILTER_UNKNOWN):
         return L"(ERROR_DS_FILTER_UNKNOWN";
         break;

      case  HRESULT_FROM_WIN32(ERROR_CANCELLED):
         return L"(ERROR_CANCELLED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_PARAM_ERROR):
         return L"ERROR_DS_PARAM_ERROR";
         break;

      case  HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY):
         return L"ERROR_NOT_ENOUGH_MEMORY";
         break;

      case  HRESULT_FROM_WIN32(ERROR_CONNECTION_REFUSED):
         return L"ERROR_CONNECTION_REFUSED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_NOT_SUPPORTED):
         return L"ERROR_DS_NOT_SUPPORTED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_NO_RESULTS_RETURNED):
         return L"ERROR_DS_NO_RESULTS_RETURNED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_CONTROL_NOT_FOUND):
         return L"ERROR_DS_CONTROL_NOT_FOUND";
         break;

      // case  HRESULT_FROM_WIN32(E_ADS_LDAP_MORE_RESULTS_TO_RETURN:
         // return L"HRESULT_FROM_WIN32(E_ADS_LDAP_MORE_RESULTS_TO_RETURN";
         // break;

      case  HRESULT_FROM_WIN32(ERROR_DS_CLIENT_LOOP):
         return L"(ERROR_DS_CLIENT_LOOP";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_REFERRAL_LIMIT_EXCEEDED):
         return L"ERROR_DS_REFERRAL_LIMIT_EXCEEDED";
         break;

      // case  HRESULT_FROM_WIN32(E_ADS_LDAP_LAST:
         // return L"HRESULT_FROM_WIN32(E_ADS_LDAP_LAST";
         // break;

      case  E_FAIL:
         return L"E_FAIL";
         break;

      case  E_NOTIMPL:
         return L"E_NOIMPL";
         break;

      case  S_OK:
         return L"OK";
         break;

      case  0x800704b8:
      // we have an extended error
      {
         WCHAR szErrorBuff[ 1024 ];
         WCHAR szNameBuff[ 1024 ];
         DWORD dwError;

         ADsGetLastError( &dwError,
                          szErrorBuff,
                          1023,
                          szNameBuff,
                          1023 );
     int errSize=sizeof(szErrorBuff)/sizeof(WCHAR);
     SAFE_APPEND(errSize, szNameBuff, L" : " );
         SAFE_APPEND(errSize, szNameBuff, szErrorBuff);

     szwText[0]=0l;
     int textSize= sizeof(szwText)/sizeof(WCHAR);
     SAFE_APPEND(textSize,szwText, szNameBuff);

         return szwText;
      }

   }

    return szwText;
}

int IS_BUFFER_ENOUGH | ( | UINT | maxAlloc,
 |  | LPWSTR | pszTarget,
 |  | LPCWSTR | pszSource,
 |  | int | toCopy = 1
 | ) |  |

Definition at line 513 of file CreateUserHelpers.cpp.

{

         if (toCopy == -1)

          {
               toCopy = wcslen(pszSource);
          }

      return maxAlloc - (wcslen(pszTarget) + toCopy + 1);
}

void PrintIADSObject ( IADs * pIADs )

Definition at line 41 of file CreateUserHelpers.cpp.

{
  assert(pIADs);

  BSTR bsResult;

  pIADs->get_Name(&bsResult);
  wprintf(L" NAME: %s\n",(LPOLESTR) bsResult);
  SysFreeString(bsResult);

  pIADs->get_Class(&bsResult);
  wprintf(L" CLASS: %s\n",(LPOLESTR) bsResult);
  SysFreeString(bsResult);

  pIADs->get_GUID(&bsResult);
  wprintf(L" GUID: %s\n",(LPOLESTR) bsResult);
  SysFreeString(bsResult);

  pIADs->get_ADsPath(&bsResult);
  wprintf(L" ADSPATH: %s\n",(LPOLESTR) bsResult);
  SysFreeString(bsResult);

  pIADs->get_Parent(&bsResult);
  wprintf(L" PARENT: %s\n",(LPOLESTR) bsResult);
  SysFreeString(bsResult);

  pIADs->get_Schema(&bsResult);
  wprintf(L" SCHEMA: %s\n",(LPOLESTR) bsResult);
  SysFreeString(bsResult);

}

bool SAFE_APPEND | ( | int | targetSize,
 |  | LPWSTR | szTarget,
 |  | LPCWSTR | szSource
 | ) |  |

Definition at line 527 of file CreateUserHelpers.cpp.

{
  if ( IS_BUFFER_ENOUGH( targetSize, szTarget, szSource) > 0 )
  {
    wcscpy(szTarget, szSource);
    return true;
  }

  return false;
}

Generated on Wed Nov 13 2024 16:53:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/activedir/createuser/vc/CreateUserHelpers.h File Reference

  • NetDS
  • ADSI
  • samples
  • activedir
  • createuser
  • vc
Functions

CreateUserHelpers.h File Reference

Go to the source code of this file.

Functions

void | CheckADHRESULT (HRESULT passedhr, LPOLESTR pwReason)
WCHAR * | CrackADError (HRESULT hResult)
void | PrintIADSObject (IADs *pIADs)

Function Documentation

void CheckADHRESULT | ( | HRESULT | passedhr,
 |  | LPOLESTR | pwReason
 | ) |  |

Definition at line 323 of file main.cpp.

{
    if (SUCCEEDED(passedhr))
        return;

    HRESULT hr;
    DWORD lError;
    WCHAR pwErrBuff[2048];
    WCHAR pwADErrBuff[512];

    WCHAR * pADErrCodeStr;

    pwErrBuff[0] = NULL;
    pADErrCodeStr = CrackADError( passedhr);

    // If an ADSI error code was returned, display it
    if (pADErrCodeStr[0] != NULL)
    {
        wcscat(pwErrBuff,L"<*> ADSI Error HRESULT Returns: <*> \n");
        wcscat(pwErrBuff,pADErrCodeStr);
        wcscat(pwErrBuff,L"\n");
    }

    // Call ADsGetLastError() to retrieve the error text from ADSI
    wcscat(pwErrBuff,L"<*> ADSI Error: <*>\n");

    hr = ADsGetLastError(
        &lError,
        pwADErrBuff,
        511,
        L"",
        0
        );

    if (FAILED(hr))
        wcscat(pwErrBuff,L"<Unable to retrieve ADs Error>");
    else
        wcscat(pwErrBuff,pwADErrBuff);

    wcscat(pwErrBuff,L"\n");

    WCHAR sz[1024];

    wcscat(pwErrBuff,L"<*> System Error: <*> \n");

    // Check the standard system to crack the bad HRESULT into a string
    if (!FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM, 0, passedhr, 0, sz, 1024, 0))
        wcscat(sz, L"Unknown HRESULT error");
    else
        wcscat(pwErrBuff, sz);

    // Display
    OutputDebugStringW(pwErrBuff);
    OutputDebugStringW(L"\r\n");
    _putws(L"\n**********");
    wprintf(L"\nERROR on %s\n\n",pwReason);
    _putws(pwErrBuff);
    _putws(L"\n**********");

}

WCHAR* CrackADError ( HRESULT hResult )

Definition at line 385 of file main.cpp.

{
   static WCHAR szwText[ 128 ];
   szwText[0] = 0l;

   switch( hResult )
   {
      case  E_ADS_BAD_PATHNAME:
         return L"E_ADS_BAD_PATHNAME";
         break;

      case  E_ADS_INVALID_DOMAIN_OBJECT:
         return L"E_ADS_INVALID_DOMAIN_OBJECT";
         break;

      case  E_ADS_INVALID_USER_OBJECT:
         return L"E_ADS_INVALID_USER_OBJECT";
         break;

      case  E_ADS_INVALID_COMPUTER_OBJECT:
         return L"E_ADS_INVALID_COMPUTER_OBJECT";
         break;

      case  E_ADS_UNKNOWN_OBJECT:
         return L"E_ADS_UNKNOWN_OBJECT";
         break;

      case  E_ADS_PROPERTY_NOT_SET:
         return L"E_ADS_PROPERTY_NOT_SET";
         break;

      case  E_ADS_PROPERTY_NOT_SUPPORTED:
         return L"E_ADS_PROPERTY_NOT_SUPPORTED";
         break;

      case  E_ADS_PROPERTY_INVALID:
         return L"E_ADS_PROPERTY_INVALID";
         break;

      case  E_ADS_BAD_PARAMETER:
         return L"E_ADS_BAD_PARAMETER";
         break;

      case  E_ADS_OBJECT_UNBOUND:
         return L"E_ADS_OBJECT_UNBOUND";
         break;

      case  E_ADS_PROPERTY_NOT_MODIFIED:
         return L"E_ADS_PROPERTY_NOT_MODIFIED";
         break;

      case  E_ADS_PROPERTY_MODIFIED:
         return L"E_ADS_PROPERTY_MODIFIED";
         break;

      case  E_ADS_CANT_CONVERT_DATATYPE:
         return L"E_ADS_CANT_CONVERT_DATATYPE";
         break;

      case  E_ADS_PROPERTY_NOT_FOUND:
         return L"E_ADS_PROPERTY_NOTFOUND";
         break;

      case  E_ADS_OBJECT_EXISTS:
         return L"E_ADS_OBJECT_EXISTS";
         break;

      case  E_ADS_SCHEMA_VIOLATION:
         return L"E_ADS_SCHEMA_VIOLATION";
         break;

      case  E_ADS_COLUMN_NOT_SET:
         return L"E_ADS_COLUMN_NOT_SET";
         break;

      case  E_ADS_INVALID_FILTER:
         return L"E_ADS_INVALID_FILTER";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_OPERATIONS_ERROR):
         return L"ERROR_DS_OPERATIONS_ERROR";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_PROTOCOL_ERROR):
         return L"ERROR_DS_PROTOCOL_ERROR";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_TIMELIMIT_EXCEEDED):
         return L"ERROR_DS_TIMELIMIT_EXCEEDED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_SIZELIMIT_EXCEEDED):
         return L"ERROR_DS_SIZELIMIT_EXCEEDED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_COMPARE_FALSE):
         return L"ERROR_DS_COMPARE_FALSE";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_COMPARE_TRUE):
         return L"ERROR_DS_COMPARE_TRUE";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_AUTH_METHOD_NOT_SUPPORTED):
         return L"ERROR_DS_AUTH_METHOD_NOT_SUPPORTED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_STRONG_AUTH_REQUIRED):
         return L"ERROR_DS_STRONG_AUTH_REQUIRED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_MORE_DATA):
         return L"ERROR_MORE_DATA";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_REFERRAL):
         return L"(ERROR_DS_REFERRAL";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_ADMIN_LIMIT_EXCEEDED):
         return L"ERROR_DS_ADMIN_LIMIT_EXCEEDED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_UNAVAILABLE_CRIT_EXTENSION):
         return L"(ERROR_DS_UNAVAILABLE_CRIT_EXTENSION";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_CONFIDENTIALITY_REQUIRED):
         return L"HRESULT_FROM_WIN32(ERROR_DS_CONFIDENTIALITY_REQUIRED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_NO_ATTRIBUTE_OR_VALUE):
         return L"ERROR_DS_NO_ATTRIBUTE_OR_VALUE";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_ATTRIBUTE_TYPE_UNDEFINED):
         return L"(ERROR_DS_ATTRIBUTE_TYPE_UNDEFINED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_INAPPROPRIATE_MATCHING):
         return L"(ERROR_DS_INAPPROPRIATE_MATCHING";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_CONSTRAINT_VIOLATION):
         return L"ERROR_DS_CONSTRAINT_VIOLATION";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_ATTRIBUTE_OR_VALUE_EXISTS):
         return L"ERROR_DS_ATTRIBUTE_OR_VALUE_EXISTS";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_INVALID_ATTRIBUTE_SYNTAX):
         return L"ERROR_DS_INVALID_ATTRIBUTE_SYNTAX";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_NO_SUCH_OBJECT):
         return L"ERROR_DS_NO_SUCH_OBJECT";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_INVALID_DN_SYNTAX):
         return L"ERROR_DS_INVALID_DN_SYNTAX";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_IS_LEAF):
         return L"ERROR_DS_IS_LEAF";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_ALIAS_DEREF_PROBLEM):
         return L"ERROR_DS_ALIAS_DEREF_PROBLEM";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_INAPPROPRIATE_AUTH):
         return L"ERROR_DS_INAPPROPRIATE_AUTH";
         break;

      case  HRESULT_FROM_WIN32(ERROR_INVALID_PASSWORD):
         return L"ERROR_INVALID_PASSWORD";
         break;

      case  HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED):
         return L"ERROR_ACCESS_DENIED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_BUSY):
         return L"ERROR_DS_BUSY";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_UNAVAILABLE):
         return L"ERROR_DS_UNAVAILABLE";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_UNWILLING_TO_PERFORM):
         return L"ERROR_DS_UNWILLING_TO_PERFORM";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_LOOP_DETECT):
         return L"ERROR_DS_LOOP_DETECT";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_NAMING_VIOLATION):
         return L"ERROR_DS_NAMING_VIOLATION";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_OBJ_CLASS_VIOLATION):
         return L"ERROR_DS_OBJ_CLASS_VIOLATION";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_CANT_ON_NON_LEAF):
         return L"ERROR_DS_CANT_ON_NONLEAF";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_CANT_ON_RDN):
         return L"ERROR_DS_CANT_ON_RDN";
         break;

      case  HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS):
         return L"ERROR_ALREADY_EXISTS";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_CANT_MOD_OBJ_CLASS):
         return L"ERROR_DS_CANT_MOD_OBJ_CLASS";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_OBJECT_RESULTS_TOO_LARGE):
         return L"ERROR_DS_OBJECT_RESULTS_TOO_LARGE";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_AFFECTS_MULTIPLE_DSAS):
         return L"ERROR_DS_AFFECTS_MULTIPLE_DSAS";
         break;

      case  HRESULT_FROM_WIN32(ERROR_GEN_FAILURE):
         return L"(ERROR_GEN_FAILURE";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_SERVER_DOWN):
         return L"ERROR_DS_SERVER_DOWN";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_LOCAL_ERROR):
         return L"ERROR_DS_LOCAL_ERROR";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_ENCODING_ERROR):
         return L"ERROR_DS_ENCODING_ERROR";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_DECODING_ERROR):
         return L"(ERROR_DS_DECODING_ERROR";
         break;

      case  HRESULT_FROM_WIN32(ERROR_TIMEOUT):
         return L"(ERROR_TIMEOUT";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_AUTH_UNKNOWN):
         return L"ERROR_DS_AUTH_UNKNOWN";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_FILTER_UNKNOWN):
         return L"(ERROR_DS_FILTER_UNKNOWN";
         break;

      case  HRESULT_FROM_WIN32(ERROR_CANCELLED):
         return L"(ERROR_CANCELLED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_PARAM_ERROR):
         return L"ERROR_DS_PARAM_ERROR";
         break;

      case  HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY):
         return L"ERROR_NOT_ENOUGH_MEMORY";
         break;

      case  HRESULT_FROM_WIN32(ERROR_CONNECTION_REFUSED):
         return L"ERROR_CONNECTION_REFUSED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_NOT_SUPPORTED):
         return L"ERROR_DS_NOT_SUPPORTED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_NO_RESULTS_RETURNED):
         return L"ERROR_DS_NO_RESULTS_RETURNED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_CONTROL_NOT_FOUND):
         return L"ERROR_DS_CONTROL_NOT_FOUND";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_CLIENT_LOOP):
         return L"(ERROR_DS_CLIENT_LOOP";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_REFERRAL_LIMIT_EXCEEDED):
         return L"ERROR_DS_REFERRAL_LIMIT_EXCEEDED";
         break;

      case  E_FAIL:
         return L"E_FAIL";
         break;

      case  E_NOTIMPL:
         return L"E_NOIMPL";
         break;

      case  S_OK:
         return L"OK";
         break;

      case  0x800704b8:
      // we have an extended error
      {
         WCHAR szErrorBuff[ 1024 ];
         WCHAR szNameBuff[ 1024 ];
         DWORD dwError;

         ADsGetLastError( &dwError,
                          szErrorBuff,
                          1023,
                          szNameBuff,
                          1023 );

         int sizeNameBuff = wcslen(szNameBuff);

    if(sizeNameBuff<1024-3)
    {
          wcsncat( szNameBuff, L" : ",3);
    if(1023-sizeNameBuff-3 >=0) //-3 for previous wcsncat
          wcsncat( szNameBuff, szErrorBuff,1023-sizeNameBuff-3);
    }
         wcsncat( szwText,szNameBuff,127);

         return szwText;
      }

   }

    return szwText;
}

void PrintIADSObject ( IADs * pIADs )

Definition at line 274 of file main.cpp.

{
  assert(pIADs);

  BSTR bsResult;
  HRESULT hr = S_OK;

  hr = pIADs->get_Name(&bsResult);
  if(FAILED(hr)) {wprintf(L" Failed to get name\n"); return;}
  wprintf(L" NAME: %s\n",(LPOLESTR) bsResult);
  SysFreeString(bsResult);

  hr = pIADs->get_Class(&bsResult);
  if(FAILED(hr)) {wprintf(L" Failed to get class\n"); return;}
  wprintf(L" CLASS: %s\n",(LPOLESTR) bsResult);
  SysFreeString(bsResult);

  hr = pIADs->get_GUID(&bsResult);
  if(FAILED(hr)) {wprintf(L" Failed to get GUID\n"); return;}
  wprintf(L" GUID: %s\n",(LPOLESTR) bsResult);
  SysFreeString(bsResult);

  hr = pIADs->get_ADsPath(&bsResult);
  if(FAILED(hr)) {wprintf(L" Failed to get ADsPath\n"); return;}
  wprintf(L" ADSPATH: %s\n",(LPOLESTR) bsResult);
  SysFreeString(bsResult);

  hr = pIADs->get_Parent(&bsResult);
  if(FAILED(hr)) {wprintf(L" Failed to get parent\n"); return;}
  wprintf(L" PARENT: %s\n",(LPOLESTR) bsResult);
  SysFreeString(bsResult);

  hr = pIADs->get_Schema(&bsResult);
  if(FAILED(hr)) {wprintf(L" Failed to get schema\n"); return;}
  wprintf(L" SCHEMA: %s\n",(LPOLESTR) bsResult);
  SysFreeString(bsResult);

}

Generated on Wed Nov 13 2024 16:53:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/activedir/createuser/vc/main.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • activedir
  • createuser
  • vc
Defines | Functions | Variables

main.cpp File Reference

#include <windows.h>
#include <winuser.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
#include <winldap.h>
#include <activeds.h>
#include <assert.h>
#include "CreateUserHelpers.h"
#include "UserProps.h"

Go to the source code of this file.

Defines

#define | _WIN32_DCOM
#define | INC_OLE2
#define | MAX_ATTRIBS 4096
#define | UNICODE 1

Functions

HRESULT | ConvertUTCFromStringToUTCTime (LPWSTR pwszTime, SYSTEMTIME *pst)
HRESULT | CreateUser (IDirectoryObject *pDirObject, LPWSTR pwCommonName, LPWSTR pwSamAcctName, IDirectoryObject **ppDirObjRet)
HRESULT | CreateUserFromFile (IDirectoryObject *pDirObject, LPWSTR pwCommonName, LPWSTR pwSamAcctName, IDirectoryObject **ppDirObjRet, LPWSTR pwszFileName)
BOOL | GetNextLine (FILE *fp, LPWSTR pwszDest, int iSize)
HRESULT | MakeOctetADSVALUE (ADSVALUE *pAdsValue, LPWSTR pwszOctet)
BOOL | ParseCommandLine (int argc, wchar_t *argv[])
BOOL | PopulateADSAttrInfo (ADS_ATTR_INFO *pattrInfo, LPWSTR pwszAttrib, LPWSTR pwszValue)
BOOL | PopulateAttrInfoFromFile (LPWSTR pwszFileName, ADS_ATTR_INFO *pattrInfo, DWORD &rdwNumPopulated)
HRESULT | ReadDataFromLine (LPWSTR pwszLine, BSTR *pbsAttrib, BSTR *pbsValue)
void | RemoveSpecialChars (LPWSTR pwszLine)
void | Trim (LPWSTR pwszData)
void | wmain (int argc, wchar_t *argv[])

Variables

BSTR | bsFILE = NULL
BSTR | bsLDAP = NULL
BSTR | bsPASS = NULL
BSTR | bsSAMNAME = NULL
BSTR | bsUNAME = NULL
BSTR | bsUSER = NULL
WCHAR * | pwszUsage = "\n"

Define Documentation

#define _WIN32_DCOM

Definition at line 4 of file main.cpp.

#define INC_OLE2

Definition at line 2 of file main.cpp.

#define MAX_ATTRIBS 4096

Definition at line 23 of file main.cpp.

#define UNICODE 1

Definition at line 3 of file main.cpp.

Function Documentation

HRESULT ConvertUTCFromStringToUTCTime | ( | LPWSTR | pwszTime,
 |  | SYSTEMTIME * | pst
 | ) |  |

Definition at line 309 of file main.cpp.

{
    FILETIME ft;
    TCHAR sz[3];
    LPWSTR pszSrc = pwszTime;
    SYSTEMTIME st;

    // Year
    sz[0] = pszSrc[0];
    sz[1] = pszSrc[1];
    sz[2] = TEXT('\0');
    st.wYear = (WORD)_wtoi(sz);
    if (st.wYear < 50)
    {
        st.wYear += 2000;
    }
    else
    {
        st.wYear += 1900;
    }
    // Month
    sz[0] = pszSrc[2];
    sz[1] = pszSrc[3];
    st.wMonth = (WORD)_wtoi(sz);

    // Day
    sz[0] = pszSrc[4];
    sz[1] = pszSrc[5];
    st.wDay = (WORD)_wtoi(sz);

    // Hour
    sz[0] = pszSrc[6];
    sz[1] = pszSrc[7];
    st.wHour = (WORD)_wtoi(sz);

    // Minute
    sz[0] = pszSrc[8];
    sz[1] = pszSrc[9];
    st.wMinute = (WORD)_wtoi(sz);

    // Second
    sz[0] = pszSrc[10];
    sz[1] = pszSrc[11];
    st.wSecond = (WORD)_wtoi(sz);
    st.wMilliseconds = 0;

    // This gets us the day of week
    SystemTimeToFileTime(&st, &ft);
    FileTimeToSystemTime(&ft, &st);
    *pst = st;
    return S_OK;
}

HRESULT CreateUser | ( | IDirectoryObject * | pDirObject,
 |  | LPWSTR | pwCommonName,
 |  | LPWSTR | pwSamAcctName,
 |  | IDirectoryObject ** | ppDirObjRet
 | ) |  |

Definition at line 854 of file main.cpp.

{
    assert(pDirObject);
    if (wcslen(pwSamAcctName) >20)
    {
        MessageBox(NULL,L"SamAccountName CANNOT be bigger than 20 characters",L"Error: CreateSimpleUser()",MB_ICONSTOP);
        assert(0);
        return E_FAIL;
    }

  HRESULT    hr;
    ADSVALUE   sAMValue;
    ADSVALUE   classValue;
    LPDISPATCH pDisp;
    WCHAR       pwCommonNameFull[1024];

    ADS_ATTR_INFO  attrInfo[] =
    {
       { L"objectClass", ADS_ATTR_UPDATE,
                           ADSTYPE_CASE_IGNORE_STRING, &classValue, 1 },
       {L"sAMAccountName", ADS_ATTR_UPDATE,
                           ADSTYPE_CASE_IGNORE_STRING, &sAMValue, 1},
    };

    DWORD dwAttrs = sizeof(attrInfo)/sizeof(ADS_ATTR_INFO);
    classValue.dwType = ADSTYPE_CASE_IGNORE_STRING;
    classValue.CaseIgnoreString = L"User";

    sAMValue.dwType=ADSTYPE_CASE_IGNORE_STRING;
    sAMValue.CaseIgnoreString = pwSamAcctName;

    wsprintfW(pwCommonNameFull,L"CN=%s",pwCommonName);

    hr = pDirObject->CreateDSObject( pwCommonNameFull,  attrInfo,
                                dwAttrs, &pDisp );
    if (SUCCEEDED(hr))
    {
        hr = pDisp->QueryInterface(IID_IDirectoryObject,(void**) ppDirObjRet);

        pDisp->Release();
        pDisp = NULL;
    }
    return hr;
}

HRESULT CreateUserFromFile | ( | IDirectoryObject * | pDirObject,
 |  | LPWSTR | pwCommonName,
 |  | LPWSTR | pwSamAcctName,
 |  | IDirectoryObject ** | ppDirObjRet,
 |  | LPWSTR | pwszFileName
 | ) |  |

Definition at line 771 of file main.cpp.

{
    // To simply things, allocate a fixed array:
    ADS_ATTR_INFO   attrInfo [MAX_ATTRIBS+1];

    HRESULT         hr = S_OK;
    DWORD           dwNumPopulated;
    LPDISPATCH      pDisp;
    *ppDirObjRet     = NULL;
    WCHAR           pwCommonNameFull[MAX_PATH*2];
    BOOL    bRet = FALSE;
    FILE * fpInput = NULL;
    WCHAR  pwszLine[4096];
    dwNumPopulated = 0;

  if( (fpInput = _wfopen( pwszFileName, L"r" )) == NULL )
  {
    wprintf(L"\nError Opening Input File:%s",pwszFileName);
    return FALSE;
  }

    while (GetNextLine(fpInput,pwszLine,4096) && SUCCEEDED(hr))
    {
        Trim(pwszLine);

        BSTR bsAttrib;
        BSTR bsValue;

        // Read the line into our BSTRS
        // if S_FALSE is returned, then we do not have a line
        // if E_FAIL is returned, then we have an error condition
        hr = ReadDataFromLine(pwszLine,&bsAttrib,&bsValue);

        if (hr == S_OK)
        {
            wprintf(L" attrib:%s value:%s\n",bsAttrib,bsValue);

            // Take the attribute and value and add them to the Array
            if (!PopulateADSAttrInfo(&attrInfo[dwNumPopulated],bsAttrib,bsValue))
            {
                hr = E_FAIL;
                break;
            }

            SysFreeString(bsAttrib);
            SysFreeString(bsValue);
            dwNumPopulated++;
        }
    }
  fclose(fpInput);

    wsprintfW(pwCommonNameFull,L"CN=%s",pwCommonName);

    hr = pDirObject->CreateDSObject( pwCommonNameFull,  attrInfo,
    dwNumPopulated, &pDisp );

    if (SUCCEEDED(hr))
    {
        hr = pDisp->QueryInterface(IID_IDirectoryObject,(void**) ppDirObjRet);

        pDisp->Release();
        pDisp = NULL;
    }

    //FreeAttrInfo(attrInfo);

  return hr;
}

BOOL GetNextLine | ( | FILE * | fp,
 |  | LPWSTR | pwszDest,
 |  | int | iSize
 | ) |  |

Definition at line 373 of file main.cpp.

{
  //BOOL bRet;
  WCHAR c =0 ;
  int x = 0;
  do
  {
    if (x < iSize )
        {
            // Get a character
            c = getwc(fp);
        // Handle the end
            if (x ==0 && ((char)c) == EOF )
          return FALSE;

        // If it is NOT a carriage return - save the character
            // (note the cast to (char): as EOF is a char -1.
            // with a WIDE character this becomes 65535)
            // so we cast DOWN the char to test for the potential -1
            if (c!= '\r' && ((char)c) != EOF && c != '\n')
          pwszDest[x++] = c;
          else
                break;
        }
  } while (c != '\r' && c != EOF && c != '\n' && c !=65535);

  pwszDest[x] = NULL;
  return TRUE;
}

HRESULT MakeOctetADSVALUE | ( | ADSVALUE * | pAdsValue,
 |  | LPWSTR | pwszOctet
 | ) |  |

Definition at line 538 of file main.cpp.

{
    int iNumBytes = 0;
    int iStrLen = wcslen(pwszOctet);

    // Count the number of BYTES in the String
    for (int x =0;x <iStrLen;x++)
        if (pwszOctet[x] == L'x' || pwszOctet[x] == L'X')
            iNumBytes ++;

    if (iNumBytes)
    {
        int iCurrByte =0;

        // Allocate the bytes
        pAdsValue->OctetString.lpValue = new BYTE [iNumBytes+1];
        pAdsValue->OctetString.dwLength = iNumBytes;

        for (int x =0;x <iStrLen;x++)
            if (pwszOctet[x] == L'x' || pwszOctet[x] == L'X')
            {
                x++;
                int iVal;
                // found an x so grab the data
                swscanf(  &pwszOctet[x], L"%x",&iVal);
                pAdsValue->OctetString.lpValue[iCurrByte++]= iVal;

                // scan past the rest of the string
                for (x =x;x<iStrLen && pwszOctet[x] != (WCHAR)' ' ;x++)
                    ;
            }
    }
    else
        return E_FAIL;

    return S_OK;
}

BOOL ParseCommandLine | ( | int | argc,
 |  | wchar_t * | argv[]
 | ) |  |

Definition at line 187 of file main.cpp.

{
/*
     ** PARSE the FOLLOWING ARGUMENTS:
    /LDAP <Path of container>
        ADsPath of the container for placing the new group

    /UNAME <NT 5 User Name>
        This is the name for the new group

    /SAMNAME <Downlevel NT 4 Sam Account name>
        Cannot exceed 20 characters and must be globally unique

    <*> Detailed New User information <*>
    /FILE < Info File >

        Filename for file to contain new user information

    <*> OPTIONAL Binding Information <*>
    /USER <User name used for binding to the DC>

    /PASS <Password used for binding to the DC>
    (If these are passed, binding is done with ADsOpenObject())
*/
  if (argc == 1)
  {
        _putws(pwszUsage);
        return FALSE;
    }
    for (int x= 1; x < argc; x++)
    {
        if (_wcsicmp(argv[x],L"/LDAP")==0)
        {
            if (argc == x) // Make sure the parameter was passed
            {
                wprintf(L"\nERROR: %s Missing parameter!!!!\n\n",argv[x]);
                _putws(pwszUsage);
                return FALSE;
            }
            // Go to the next argument and save it in module level variable
            x++;
            bsLDAP = SysAllocString(argv[x]);
        }
        else if (_wcsicmp(argv[x],L"/UNAME")==0)
        {
            if (argc == x) // Make sure the parameter was passed
            {
                wprintf(L"\nERROR: %s Missing parameter!!!!\n\n",argv[x]);
                _putws(pwszUsage);
                return FALSE;
            }
            // Go to the next argument and save it in module level variable
            x++;
            bsUNAME = SysAllocString(argv[x]);
        }
        else if (_wcsicmp(argv[x],L"/SAMNAME")==0)
        {
            if (argc == x) // Make sure the parameter was passed
            {
                wprintf(L"\nERROR: %s Missing parameter!!!!\n\n",argv[x]);
                _putws(pwszUsage);
                return FALSE;
            }
            // Go to the next argument and save it in module level variable
            x++;
            bsSAMNAME = SysAllocString(argv[x]);
        }
        else if (_wcsicmp(argv[x],L"/FILE")==0)
        {
            if (argc == x) // Make sure the parameter was passed
            {
                wprintf(L"\nERROR: %s Missing parameter!!!!\n\n",argv[x]);
                _putws(pwszUsage);
                return FALSE;
            }
            // Go to the next argument and save it in module level variable
            x++;
            bsFILE = SysAllocString(argv[x]);
        }
        else if (_wcsicmp(argv[x],L"/USER")==0)
        {
            if (argc == x) // Make sure the parameter was passed
            {
                wprintf(L"\nERROR: %s Missing parameter!!!!\n\n",argv[x]);
                _putws(pwszUsage);
                return FALSE;
            }
            // Go to the next argument and save it in module level variable
            x++;
            bsUSER = SysAllocString(argv[x]);
        }
        else if (_wcsicmp(argv[x],L"/PASS")==0)
        {
            if (argc == x) // Make sure the parameter was passed
            {
                wprintf(L"\nERROR: %s Missing parameter!!!!\n\n",argv[x]);
                _putws(pwszUsage);
                return FALSE;
            }
            // Go to the next argument and save it in module level variable
            x++;
            bsPASS = SysAllocString(argv[x]);
        }
        else
        {
                wprintf(L"\nERROR: %s UNknown Argument\n\n",argv[x]);
                _putws(pwszUsage);
                return FALSE;
        }
    }
    // Check if User is poassed, then password is required:
    if (bsUSER || bsPASS)
        if (!bsUSER || !bsPASS) // if either one is missing complain
        {
            _putws(L"\nERROR: If /USER is specified /PASS is required!");
            return FALSE;
        }

    return TRUE;
}

BOOL PopulateADSAttrInfo | ( | ADS_ATTR_INFO * | pattrInfo,
 |  | LPWSTR | pwszAttrib,
 |  | LPWSTR | pwszValue
 | ) |  |

Definition at line 586 of file main.cpp.

{
    // Look up the attribute name and get the TYPE string for this attribute
    LPWSTR pwszType;
    LPWSTR  pwszSingleMulti;
    BOOL bAttribIsSingle = TRUE;

    BOOL bret;

    bret = MapUserAttribToType(pwszAttrib,&pwszType,&pwszSingleMulti);
    if (!bret)
    {
        wprintf(L"\n!!!Error: unable to map %s\n",pwszAttrib);
        return FALSE;
    }

    if (_wcsicmp(pwszSingleMulti,L"MV")==0)
        bAttribIsSingle = FALSE;
    else
        bAttribIsSingle = TRUE;

    // Look up the string and get the corrosponding ADSVALUE...
    ADSTYPE adType = MapTypeToADSTYPE(pwszType);

    if (adType == ADSTYPE_UNKNOWN)
    {
        wprintf(L"\n!!!Error: unable to map %s ADS_TYPE unknown\n",pwszAttrib);
        return FALSE;
    }
    // FIll in the Attribute Name
    pattrInfo->pszAttrName = new WCHAR [wcslen(pwszAttrib)+1];
    wcscpy(pattrInfo->pszAttrName,pwszAttrib);
    pattrInfo->dwControlCode  = ADS_ATTR_UPDATE;
    pattrInfo->dwADsType = ADSTYPE_CASE_IGNORE_STRING;

    pattrInfo->pADsValues = new ADSVALUE;
    pattrInfo->pADsValues->dwType = adType;
    pattrInfo->dwNumValues = 1;

    // Fill in the VALUE:
    switch (adType )
    {

        case ADSTYPE_DN_STRING:
        case ADSTYPE_CASE_EXACT_STRING:
        case ADSTYPE_CASE_IGNORE_STRING:
        case ADSTYPE_PRINTABLE_STRING:
        case ADSTYPE_NUMERIC_STRING:
        case ADSTYPE_TYPEDNAME:
        case ADSTYPE_FAXNUMBER:
        case ADSTYPE_PATH:
        case ADSTYPE_OBJECT_CLASS:
        {
            pattrInfo->pADsValues->CaseIgnoreString = new WCHAR [wcslen(pwszValue)+1];
            wcscpy(pattrInfo->pADsValues->CaseIgnoreString,pwszValue);

            break;
        }
        case ADSTYPE_BOOLEAN:
            if (_wcsicmp(pwszValue,L"TRUE")==0)
                pattrInfo->pADsValues->Boolean = 1;
            else if (_wcsicmp(pwszValue,L"FALSE")==0)
                pattrInfo->pADsValues->Boolean = 0;
            else if (_wtoi(pwszValue)>0)
                pattrInfo->pADsValues->Boolean = 1;
            else
                pattrInfo->pADsValues->Boolean = 0;
            break;
        case ADSTYPE_INTEGER:
        {
            pattrInfo->pADsValues->Integer = _wtoi(pwszValue);
            break;
        }
        case ADSTYPE_OCTET_STRING:
        {
            // Read the string into an actualy binary blob
            HRESULT hr = MakeOctetADSVALUE(pattrInfo->pADsValues ,pwszValue);
            if (FAILED(hr))
                return FALSE;
            break;
        }
        case ADSTYPE_UTC_TIME:
        {
            SYSTEMTIME pst;

            HRESULT hr = ConvertUTCFromStringToUTCTime( pwszValue,&pst );

            if (FAILED(hr))
                return FALSE;

            pattrInfo->pADsValues->UTCTime = pst;

            break;
        }
        case ADSTYPE_LARGE_INTEGER:
        {
            pattrInfo->pADsValues->dwType = ADSTYPE_LARGE_INTEGER;
            swscanf (pwszValue, L"%I64d", &pattrInfo->pADsValues->LargeInteger);
            break;
        }

        default:
        {
            wprintf(L"\n\n!!!ERROR Unrecognized Type for atrib: %s",pwszAttrib);
            return FALSE;
        }
    }
    return TRUE;
}

BOOL PopulateAttrInfoFromFile | ( | LPWSTR | pwszFileName,
 |  | ADS_ATTR_INFO * | pattrInfo,
 |  | DWORD & | rdwNumPopulated
 | ) |  |

Definition at line 707 of file main.cpp.

{
    HRESULT hr = S_OK;
    BOOL    bRet = FALSE;
  FILE * fpInput = NULL;
    WCHAR  pwszLine[4096];
    rdwNumPopulated = 0;

  if( (fpInput = _wfopen( pwszFileName, L"r" )) == NULL )
  {
    wprintf(L"\nError Opening Input File:%s",pwszFileName);
    return FALSE;
  }

    while (GetNextLine(fpInput,pwszLine,4096) && SUCCEEDED(hr))
    {
        Trim(pwszLine);

        BSTR bsAttrib;
        BSTR bsValue;

        // Read the line into our BSTRS
        // if S_FALSE is returned, then we do not have a line
        // if E_FAIL is returned, then we have an error condition
        hr = ReadDataFromLine(pwszLine,&bsAttrib,&bsValue);

        if (hr == S_OK)
        {
            wprintf(L" attrib:%s value:%s\n",bsAttrib,bsValue);

            // Take the attribute and value and add them to the Array
            if (!PopulateADSAttrInfo(&pattrInfo[rdwNumPopulated],bsAttrib,bsValue))
            {
                hr = E_FAIL;
                break;
            }

            SysFreeString(bsAttrib);
            SysFreeString(bsValue);

            rdwNumPopulated++;
        }
    }
  fclose(fpInput);
  return (SUCCEEDED(hr));
}

HRESULT ReadDataFromLine | ( | LPWSTR | pwszLine,
 |  | BSTR * | pbsAttrib,
 |  | BSTR * | pbsValue
 | ) |  |

Definition at line 468 of file main.cpp.

{
    int x;
    int iLen = wcslen(pwszLine);

    *pbsAttrib = NULL;
    *pbsValue  = NULL;

    // Remove any tabs still in the line:
    RemoveSpecialChars(pwszLine);

    // If this line is a comment or blank, bail..
    if (pwszLine[0] == L'/' || iLen == 0)
        return S_FALSE;

    // Make a temp string to save our string
    LPWSTR pwszTempAttrib = new WCHAR [iLen +1];
    pwszTempAttrib[0]= NULL;

    for (x = 0; x< iLen; x++)
        switch(pwszLine[x])
        {
             case L' ':
             case L'\t':
             {
                // NULL terminate the copy we are building
                pwszTempAttrib[x] = L'\0';
                x++;
                goto DoneReadDataFromLine;
                break;
             }
             case NULL:    // if we hit the end of the string- there is NOT a value there
             {
                wprintf(L"\n!!!Attribute missing value [%s]\n",pwszLine);
                return E_FAIL;
             }
             default:
             {
                pwszTempAttrib[x] = pwszLine[x];
             }
        }

DoneReadDataFromLine:
    // Trim off any preceding spaces..
    Trim((LPWSTR)pwszLine +x);

    // Grab the END of the passed line, and put it in the
    // Value BSTR
    *pbsValue = SysAllocString((LPWSTR)pwszLine +x);

    // Alloc a new BSTR to return for this attribute
    *pbsAttrib= SysAllocString(pwszTempAttrib);

    if (iLen)
        delete [] pwszTempAttrib ;
    return S_OK;
}

void RemoveSpecialChars ( LPWSTR pwszLine )

Definition at line 446 of file main.cpp.

{
    int iLen = wcslen(pwszLine);
    for (int x = 0; x < iLen; x++)
    {
        switch (pwszLine[x])
        {
            case '\t':
                pwszLine[x] = ' '; // convert tabs to spaces..
        }
    }
}

void Trim ( LPWSTR pwszData )

Definition at line 411 of file main.cpp.

{
    int iscan=0;
    int iput=0;

    int iLenData = wcslen(pwszData);
    LPWSTR pwszTemp = new WCHAR[iLenData+1];
    int iLenTemp;

    // Trim left:
    while (pwszData[iscan] != NULL && (pwszData[iscan] == ' ' || pwszData[iscan] == '\t' ))
        iscan++;

    // We have now scanned PAST whitespace- so copy the string:
    wcscpy(pwszTemp,&pwszData[iscan]);

    // Now we need to do the TrimRight
    iLenTemp = wcslen(pwszTemp);

    for (iscan = iLenTemp-1; iscan; iscan--)
    {
        if (!(pwszTemp[iscan] == ' ' || pwszTemp[iscan] == '\t' ) )
            break;
    }
    pwszTemp[iscan+1] =NULL;
    wcscpy(pwszData,pwszTemp);
}

void wmain | ( | int | argc,
 |  | wchar_t * | argv[]
 | ) |  |

Definition at line 85 of file main.cpp.

{
    WCHAR pwszTemp[4096];

    // We have now scanned PAST whitespace- so copy the string:
    wcscpy(pwszTemp,L" A String");

    Trim(pwszTemp);

    HRESULT hr;
    IDirectoryObject * pDirObjectContainer = NULL;
    IDirectoryObject * pDirObjRet = NULL;

    // Initialize COM
    CoInitialize(0);

    if (!ParseCommandLine(argc,argv))
        return;

    // Bind to the container passed
    // If USER and PASS passed in, use ADsOpenObject()
    if (bsUSER)
        hr = ADsOpenObject(bsLDAP, bsUSER, bsPASS,
                                   ADS_SECURE_AUTHENTICATION,IID_IDirectoryObject, (void**) &pDirObjectContainer);
    else
        hr = ADsGetObject(  bsLDAP, IID_IDirectoryObject,(void **)&pDirObjectContainer);

    if (SUCCEEDED(hr))
    {
        // if a file is NOT passed in- Do the simple version
        if (!bsFILE)
        {
            // Call the helper funtion to create the User
            hr = CreateUser(pDirObjectContainer, bsUNAME,bsSAMNAME,
                             &pDirObjRet);
        }
        else // file was passed in
        {
            // Call the helper funtion to create the User
            hr = CreateUserFromFile(pDirObjectContainer, bsUNAME,bsSAMNAME,
                                    &pDirObjRet,bsFILE);
        }
        if (SUCCEEDED(hr))
        {
            _putws(L"\n\n New User created with the following properties:\n");

            IADs * pIADsNewGoup = NULL;

            // User succeeded- now get an IADs interface to it
            // and print some properties
            hr = pDirObjRet->QueryInterface(IID_IADs,(void**)&pIADsNewGoup);

            if (SUCCEEDED(hr))
            {
                PrintIADSObject(pIADsNewGoup);

                pIADsNewGoup->Release();
                pIADsNewGoup = NULL;
            }
            else
                CheckADHRESULT(hr,L"QueryInterface() - New User for IADs");
            pDirObjRet->Release();
            pDirObjRet = NULL;
        }
        else
            CheckADHRESULT(hr,L"CreateUser()");

        pDirObjectContainer->Release();
        pDirObjectContainer = NULL;
    }
    else
        if (bsUSER)
            CheckADHRESULT(hr,L"ADsOpenObject()");
        else
            CheckADHRESULT(hr,L"ADsGetObject()");

    CoUninitialize();
 }

Variable Documentation

BSTR bsFILE = NULL

Definition at line 63 of file main.cpp.

BSTR bsLDAP = NULL

Definition at line 57 of file main.cpp.

BSTR bsPASS = NULL

Definition at line 67 of file main.cpp.

BSTR bsSAMNAME = NULL

Definition at line 61 of file main.cpp.

BSTR bsUNAME = NULL

Definition at line 59 of file main.cpp.

BSTR bsUSER = NULL

Definition at line 65 of file main.cpp.

WCHAR* pwszUsage = "\n"

Definition at line 27 of file main.cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/activedir/createuser/vc/UserProps.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • activedir
  • createuser
  • vc
Classes | Defines | Functions | Variables

UserProps.cpp File Reference

#include <windows.h>
#include <winuser.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <activeds.h>
#include "UserProps.h"

Go to the source code of this file.

Classes

struct | ADSTYPE_TO_STRING_ENTRY
struct | ADSTYPEsyntaxmapping

Defines

#define | _WIN32_DCOM
#define | INC_OLE2
#define | UNICODE 1

Functions

BOOL | FindAttribFromName (LPWSTR pwszName, WCHAR *pwsArray[], int iSize, LPWSTR *ppwszRetAttType, LPWSTR *ppwszRetAttribMultiOrSingle)
ADSTYPE | MapAdsTypeFromString (LPWSTR pwszAdsType)
BOOL | MapMandatoryUserAttribToType (LPWSTR pwszAttrib, LPWSTR *ppwszRetAttType, LPWSTR *ppwszRetAttribMultiOrSingle)
BOOL | MapOptionalUserAttribToType (LPWSTR pwszAttrib, LPWSTR *ppwszRetAttType, LPWSTR *ppwszRetAttribMultiOrSingle)
ADSTYPE | MapTypeToADSTYPE (LPWSTR pwszName)
BOOL | MapUserAttribToType (LPWSTR pwszAttrib, LPWSTR *ppwszRetAttType, LPWSTR *ppwszRetAttribMultiOrSingle)

Variables

ADSTYPEsyntaxmapping aSyntaxMap []
ADSTYPE_TO_STRING_ENTRY pAdsTypeToStringList []
WCHAR * | parwszUserMandatoryProps []
WCHAR * | parwszUserOptionalProps []

Define Documentation

#define _WIN32_DCOM

Definition at line 4 of file UserProps.cpp.

#define INC_OLE2

Definition at line 2 of file UserProps.cpp.

#define UNICODE 1

Definition at line 3 of file UserProps.cpp.

Function Documentation

BOOL FindAttribFromName | ( | LPWSTR | pwszName,
 |  | WCHAR * | pwsArray[],
 |  | int | iSize,
 |  | LPWSTR * | ppwszRetAttType,
 |  | LPWSTR * | ppwszRetAttribMultiOrSingle
 | ) |  |

Definition at line 339 of file UserProps.cpp.

{
    *ppwszRetAttType                  = NULL;
    *ppwszRetAttribMultiOrSingle      = NULL;

    for (int x =0; x< iSize; x+=3)
        if (_wcsicmp(pwsArray[x],pwszName)==0)
        {
            *ppwszRetAttType              = pwsArray[x+1];
            *ppwszRetAttribMultiOrSingle  = pwsArray[x+2];
            return TRUE;
        }
    return FALSE;
}

ADSTYPE MapAdsTypeFromString ( LPWSTR pwszAdsType )

Definition at line 470 of file UserProps.cpp.

{
/*    //"1.2.840.113556.1.4.903",
  Boolean,
  CaseIgnoreString,
  DirectoryString,
  DN,
  GeneralizedTime,
  IA5String,
  INTEGER,
  INTEGER8,
  NumericString,
  ObjectSecurityDescriptor,
  OctetString,
  OID,
  ORName,
  PrintableString,
  UTCTime
*/
    if (_wcsicmp(pwszAdsType,L"Boolean")==0)
    {
        return ADSTYPE_BOOLEAN;
    }
    else if (_wcsicmp(pwszAdsType,L"CaseIgnoreString")==0)
    {
        return ADSTYPE_CASE_IGNORE_STRING;
    }
    else if (_wcsicmp(pwszAdsType,L"DirectoryString")==0)
    {
        return ADSTYPE_CASE_IGNORE_STRING;
    }
    else if (_wcsicmp(pwszAdsType,L"DN")==0)
    {
        return ADSTYPE_CASE_IGNORE_STRING;
    }
    else if (_wcsicmp(pwszAdsType,L"GeneralizedTime")==0)
    {
        return ADSTYPE_UTC_TIME;
    }
    else if (_wcsicmp(pwszAdsType,L"IA5String")==0)
    {
        return ADSTYPE_CASE_IGNORE_STRING;
    }
    else if (_wcsicmp(pwszAdsType,L"INTEGER")==0)
    {
        return ADSTYPE_INTEGER;
    }
    else if (_wcsicmp(pwszAdsType,L"INTEGER8")==0)
    {
        return ADSTYPE_LARGE_INTEGER;
    }
    else if (_wcsicmp(pwszAdsType,L"NumericString")==0)
    {
        return ADSTYPE_NUMERIC_STRING;
    }
    else if (_wcsicmp(pwszAdsType,L"ObjectSecurityDescriptor")==0)
    {
        return ADSTYPE_OCTET_STRING;
    }
    else if (_wcsicmp(pwszAdsType,L"OctetString")==0)
    {
        return ADSTYPE_OCTET_STRING ;
    }
    else if (_wcsicmp(pwszAdsType,L"OID")==0)
    {
        return ADSTYPE_OCTET_STRING;
    }
    else if (_wcsicmp(pwszAdsType,L"ORName")==0)
    {
        return ADSTYPE_CASE_IGNORE_STRING;
    }
    else if (_wcsicmp(pwszAdsType,L"PrintableString")==0)
    {
        return ADSTYPE_PRINTABLE_STRING;
    }
    else if (_wcsicmp(pwszAdsType,L"UTCTime")==0)
    {
        return ADSTYPE_UTC_TIME;
    }
    return ADSTYPE_UNKNOWN;
}

BOOL MapMandatoryUserAttribToType | ( | LPWSTR | pwszAttrib,
 |  | LPWSTR * | ppwszRetAttType,
 |  | LPWSTR * | ppwszRetAttribMultiOrSingle
 | ) |  |

Definition at line 354 of file UserProps.cpp.

{
    return FindAttribFromName(pwszAttrib,parwszUserMandatoryProps,sizeof(parwszUserMandatoryProps),ppwszRetAttType, ppwszRetAttribMultiOrSingle);
}

BOOL MapOptionalUserAttribToType | ( | LPWSTR | pwszAttrib,
 |  | LPWSTR * | ppwszRetAttType,
 |  | LPWSTR * | ppwszRetAttribMultiOrSingle
 | ) |  |

Definition at line 359 of file UserProps.cpp.

{
    return FindAttribFromName(pwszAttrib,parwszUserOptionalProps,sizeof(parwszUserOptionalProps),ppwszRetAttType, ppwszRetAttribMultiOrSingle );
}

ADSTYPE MapTypeToADSTYPE ( LPWSTR pwszName )

Definition at line 423 of file UserProps.cpp.

{
    int iSize = sizeof(aSyntaxMap);

    for (int x =0; x< iSize; x++)
        if (_wcsicmp(aSyntaxMap[x].pwszSyntax,pwszName)==0)
            return aSyntaxMap[x].adsType;
    return ADSTYPE_UNKNOWN ;
}

BOOL MapUserAttribToType | ( | LPWSTR | pwszAttrib,
 |  | LPWSTR * | ppwszRetAttType,
 |  | LPWSTR * | ppwszRetAttribMultiOrSingle
 | ) |  |

Definition at line 364 of file UserProps.cpp.

{
    BOOL bret;

    bret = MapMandatoryUserAttribToType(pwszAttrib,ppwszRetAttType, ppwszRetAttribMultiOrSingle);

    if (!bret)
        bret = MapOptionalUserAttribToType(pwszAttrib,ppwszRetAttType, ppwszRetAttribMultiOrSingle);

    return bret;
}

Variable Documentation

ADSTYPEsyntaxmapping aSyntaxMap[]

Definition at line 382 of file UserProps.cpp.

ADSTYPE_TO_STRING_ENTRY pAdsTypeToStringList[]
Initial value:

{
    L"CaseExactString",  ADSTYPE_CASE_EXACT_STRING ,
    L"CaseIgnoreString", ADSTYPE_CASE_IGNORE_STRING ,
    L"",                 ADSTYPE_PRINTABLE_STRING ,
    L"",                 ADSTYPE_NUMERIC_STRING ,
    L"Boolean",          ADSTYPE_BOOLEAN ,
    L"",                 ADSTYPE_INTEGER ,
    L"", ADSTYPE_OCTET_STRING ,
    L"", ADSTYPE_UTC_TIME ,
    L"", ADSTYPE_LARGE_INTEGER ,
    L"", ADSTYPE_PROV_SPECIFIC ,
    L"", ADSTYPE_OBJECT_CLASS ,
    L"", ADSTYPE_CASEIGNORE_LIST ,
    L"", ADSTYPE_OCTET_LIST ,
    L"", ADSTYPE_PATH ,
    L"", ADSTYPE_POSTALADDRESS ,
    L"", ADSTYPE_TIMESTAMP ,
    L"", ADSTYPE_BACKLINK ,
    L"", ADSTYPE_TYPEDNAME ,
    L"", ADSTYPE_HOLD ,
    L"", ADSTYPE_NETADDRESS ,
    L"", ADSTYPE_REPLICAPOINTER ,
    L"", ADSTYPE_FAXNUMBER ,
    L"", ADSTYPE_EMAIL ,
    L"", ADSTYPE_NT_SECURITY_DESCRIPTOR ,
    L"", ADSTYPE_UNKNOWN
}

Definition at line 440 of file UserProps.cpp.

WCHAR* parwszUserMandatoryProps[]
Initial value:

{

    L"cn",                      L"DirectoryString",                 L"SV",
    L"instanceType",            L"INTEGER",                         L"SV",
    L"nTSecurityDescriptor",    L"ObjectSecurityDescriptor",        L"SV",
    L"objectCategory",          L"DN",                              L"SV",
    L"objectClass",             L"OID",                             L"MV",
    L"objectSid",               L"OctetString",                     L"SV",
    L"sAMAccountName",          L"DirectoryString",                 L"SV"
}

Definition at line 22 of file UserProps.cpp.

WCHAR* parwszUserOptionalProps[]

Definition at line 39 of file UserProps.cpp.

Generated on Wed Nov 13 2024 16:53:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/activedir/createuser/vc/UserProps.h File Reference

  • NetDS
  • ADSI
  • samples
  • activedir
  • createuser
  • vc
Functions

UserProps.h File Reference

Go to the source code of this file.

Functions

ADSTYPE | MapAdsTypeFromString (LPWSTR pwszAdsType)
BOOL | MapMandatoryUserAttribToType (LPWSTR pwszAttrib, LPWSTR *ppwszRetAttType, LPWSTR *ppwszRetAttribMultiOrSingle)
BOOL | MapOptionalUserAttribToType (LPWSTR pwszAttrib, LPWSTR *ppwszRetAttType, LPWSTR *ppwszRetAttribMultiOrSingle)
ADSTYPE | MapTypeToADSTYPE (LPWSTR pwszName)
BOOL | MapUserAttribToType (LPWSTR pwszAttrib, LPWSTR *ppwszRetAttType, LPWSTR *ppwszRetAttribMultiOrSingle)

Function Documentation

ADSTYPE MapAdsTypeFromString ( LPWSTR pwszAdsType )

Definition at line 470 of file UserProps.cpp.

{
/*    //"1.2.840.113556.1.4.903",
  Boolean,
  CaseIgnoreString,
  DirectoryString,
  DN,
  GeneralizedTime,
  IA5String,
  INTEGER,
  INTEGER8,
  NumericString,
  ObjectSecurityDescriptor,
  OctetString,
  OID,
  ORName,
  PrintableString,
  UTCTime
*/
    if (_wcsicmp(pwszAdsType,L"Boolean")==0)
    {
        return ADSTYPE_BOOLEAN;
    }
    else if (_wcsicmp(pwszAdsType,L"CaseIgnoreString")==0)
    {
        return ADSTYPE_CASE_IGNORE_STRING;
    }
    else if (_wcsicmp(pwszAdsType,L"DirectoryString")==0)
    {
        return ADSTYPE_CASE_IGNORE_STRING;
    }
    else if (_wcsicmp(pwszAdsType,L"DN")==0)
    {
        return ADSTYPE_CASE_IGNORE_STRING;
    }
    else if (_wcsicmp(pwszAdsType,L"GeneralizedTime")==0)
    {
        return ADSTYPE_UTC_TIME;
    }
    else if (_wcsicmp(pwszAdsType,L"IA5String")==0)
    {
        return ADSTYPE_CASE_IGNORE_STRING;
    }
    else if (_wcsicmp(pwszAdsType,L"INTEGER")==0)
    {
        return ADSTYPE_INTEGER;
    }
    else if (_wcsicmp(pwszAdsType,L"INTEGER8")==0)
    {
        return ADSTYPE_LARGE_INTEGER;
    }
    else if (_wcsicmp(pwszAdsType,L"NumericString")==0)
    {
        return ADSTYPE_NUMERIC_STRING;
    }
    else if (_wcsicmp(pwszAdsType,L"ObjectSecurityDescriptor")==0)
    {
        return ADSTYPE_OCTET_STRING;
    }
    else if (_wcsicmp(pwszAdsType,L"OctetString")==0)
    {
        return ADSTYPE_OCTET_STRING ;
    }
    else if (_wcsicmp(pwszAdsType,L"OID")==0)
    {
        return ADSTYPE_OCTET_STRING;
    }
    else if (_wcsicmp(pwszAdsType,L"ORName")==0)
    {
        return ADSTYPE_CASE_IGNORE_STRING;
    }
    else if (_wcsicmp(pwszAdsType,L"PrintableString")==0)
    {
        return ADSTYPE_PRINTABLE_STRING;
    }
    else if (_wcsicmp(pwszAdsType,L"UTCTime")==0)
    {
        return ADSTYPE_UTC_TIME;
    }
    return ADSTYPE_UNKNOWN;
}

BOOL MapMandatoryUserAttribToType | ( | LPWSTR | pwszAttrib,
 |  | LPWSTR * | ppwszRetAttType,
 |  | LPWSTR * | ppwszRetAttribMultiOrSingle
 | ) |  |

Definition at line 354 of file UserProps.cpp.

{
    return FindAttribFromName(pwszAttrib,parwszUserMandatoryProps,sizeof(parwszUserMandatoryProps),ppwszRetAttType, ppwszRetAttribMultiOrSingle);
}

BOOL MapOptionalUserAttribToType | ( | LPWSTR | pwszAttrib,
 |  | LPWSTR * | ppwszRetAttType,
 |  | LPWSTR * | ppwszRetAttribMultiOrSingle
 | ) |  |

Definition at line 359 of file UserProps.cpp.

{
    return FindAttribFromName(pwszAttrib,parwszUserOptionalProps,sizeof(parwszUserOptionalProps),ppwszRetAttType, ppwszRetAttribMultiOrSingle );
}

ADSTYPE MapTypeToADSTYPE ( LPWSTR pwszName )

Definition at line 423 of file UserProps.cpp.

{
    int iSize = sizeof(aSyntaxMap);

    for (int x =0; x< iSize; x++)
        if (_wcsicmp(aSyntaxMap[x].pwszSyntax,pwszName)==0)
            return aSyntaxMap[x].adsType;
    return ADSTYPE_UNKNOWN ;
}

BOOL MapUserAttribToType | ( | LPWSTR | pwszAttrib,
 |  | LPWSTR * | ppwszRetAttType,
 |  | LPWSTR * | ppwszRetAttribMultiOrSingle
 | ) |  |

Definition at line 364 of file UserProps.cpp.

{
    BOOL bret;

    bret = MapMandatoryUserAttribToType(pwszAttrib,ppwszRetAttType, ppwszRetAttribMultiOrSingle);

    if (!bret)
        bret = MapOptionalUserAttribToType(pwszAttrib,ppwszRetAttType, ppwszRetAttribMultiOrSingle);

    return bret;
}

Generated on Wed Nov 13 2024 16:53:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/activedir/credentials/VC/Credentials.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • activedir
  • credentials
  • VC
Functions

Credentials.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Functions

int | main (int argc, char *argv[])
void | ReportError (TCHAR *pTxt, DWORD err)

Function Documentation

int main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 15 of file Credentials.cpp.

{
    IADs             *pNS = NULL,
                     *pRoot=NULL,
                     *pAuth=NULL;

    IADsOpenDSObject *pDSObj=NULL;

    VARIANT varDSRoot;

    TCHAR   adspath[MAX_PATH],username[255],password[255];

    HRESULT hr;

  hr = CoInitialize(NULL);

  //  Get the name of the root container for this domain.
  //  Read the Root DSE from the default DS,  which will be the DS for
  //  the local domain.  This will get us the name of the schema container,
  //  which is stored in the "defaultNamingContext" operational attribute.

    hr = ADsGetObject(TEXT("LDAP://RootDSE"),
                      IID_IADs,
                      (void**)&pRoot);

    hr = pRoot->Get(TEXT("defaultNamingContext"),&varDSRoot);
  _tprintf(TEXT("\nDomain Name is :%s\n"),varDSRoot.bstrVal);
    pRoot->Release();

    _tcscpy(adspath,TEXT("LDAP://"));
  // get the remaining buffer size; make sure it copies, avoid buffer overrun
  int rem =  (sizeof(adspath)/sizeof(TCHAR)) - _tcslen(adspath) -1; //-1 is for NULL
  int len = wcslen(varDSRoot.bstrVal);

  if ( rem >= len )
  {
    _tcsncat(adspath,varDSRoot.bstrVal, len);
  }
  else
  {
    pRoot->Release();
    VariantClear(&varDSRoot);
    return 0;
  }

    hr = ADsGetObject(TEXT("LDAP:"),
                      IID_IADs,
                      (void**)&pNS);

    hr = pNS->QueryInterface(IID_IADsOpenDSObject,(void**)&pDSObj);

    //
    // Collect the username and password and bind to the Domain using these.
    //

    if SUCCEEDED(hr)
  {
        pNS->Release();
        _tprintf(TEXT("\nusername:"));
        _fgetts(username,sizeof(username)/sizeof(TCHAR),stdin);
        _tprintf(TEXT("\npassword:"));
        _fgetts(password, sizeof(password)/sizeof(TCHAR), stdin);
        hr = pDSObj->OpenDSObject(adspath,username,password,ADS_SECURE_AUTHENTICATION,(IDispatch**)&pAuth);
    // NOTE: Alternatively you can use an ADSI wrapper API: ADsOpenObject
        if FAILED(hr)
    {
            ReportError(TEXT("Bind Failed"),(DWORD)hr);
        }
    else
    {
      _tprintf(TEXT("Successfully logon!"));

    }
    }

    if (pAuth)
  {
        pAuth->Release();
  }
    if (pDSObj)
  {
        pDSObj->Release();
  }

    CoUninitialize();
    return 0;

}

void ReportError | ( | TCHAR * | pTxt,
 |  | DWORD | err
 | ) |  |

Definition at line 112 of file Credentials.cpp.

{
    DWORD   dwStatus;
    TCHAR   *pBuf;

    dwStatus = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|
               FORMAT_MESSAGE_ALLOCATE_BUFFER|
               FORMAT_MESSAGE_IGNORE_INSERTS,
               NULL,
               err,
               LANG_NEUTRAL,
               (USHORT*)&pBuf,
               64,
               NULL);
  if (dwStatus != 0)
  {
    _tprintf(TEXT("%s %s"),pTxt,pBuf);
        LocalFree(pBuf);
  } else
  {
    _tprintf(TEXT("%s %X\n"),pTxt,err);
  }
}

Generated on Wed Nov 13 2024 16:53:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/activedir/credentials/VC/StdAfx.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • activedir
  • credentials
  • VC

StdAfx.cpp File Reference

#include "stdafx.h"
#include "activeds.h"
#include "stdio.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/activedir/credentials/VC/StdAfx.h File Reference

  • NetDS
  • ADSI
  • samples
  • activedir
  • credentials
  • VC
Defines

StdAfx.h File Reference

#include <tchar.h>
#include <windows.h>
#include <objbase.h>
#include <stdio.h>
#include <security.h>
#include <activeds.h>

Go to the source code of this file.

Defines

#define | _UNICODE
#define | _WIN32_WINNT 0x0500
#define | SECURITY_WIN32
#define | UNICODE
#define | WIN32_LEAN_AND_MEAN

Define Documentation

#define _UNICODE

Definition at line 15 of file StdAfx.h.

#define _WIN32_WINNT 0x0500

Definition at line 13 of file StdAfx.h.

#define SECURITY_WIN32

Definition at line 17 of file StdAfx.h.

#define UNICODE

Definition at line 14 of file StdAfx.h.

#define WIN32_LEAN_AND_MEAN

Definition at line 16 of file StdAfx.h.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/activedir/gcallusers/vc/gcallusers.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • activedir
  • gcallusers
  • vc
Functions

gcallusers.cpp File Reference

#include <wchar.h>
#include <activeds.h>

Go to the source code of this file.

Functions

HRESULT | FindAllUsersInGC ()
int | main (int argc, char *argv[])

Function Documentation

HRESULT FindAllUsersInGC ( )

Definition at line 26 of file gcallusers.cpp.

{
    HRESULT hr = E_FAIL;
    HRESULT hrGC = S_OK;

  VARIANT var;
  ULONG lFetch;

    // Interface Pointers
    IDirectorySearch *pGCSearch = NULL;
  IADsContainer *pContainer = NULL;
    IUnknown *pUnk = NULL;
  IEnumVARIANT *pEnum = NULL;
    IDispatch *pDisp = NULL;
    IADs *pADs = NULL;

  //Bind to Global Catalog
    hr = ADsOpenObject(L"GC:",  //NT 4.0, Win9.x client must include the servername, e.g GC://myServer
         NULL,
         NULL,
         ADS_SECURE_AUTHENTICATION, //Use Secure Authentication
         IID_IADsContainer,
         (void**)&pContainer);

  if (SUCCEEDED(hr))
  {
       hr = pContainer->get__NewEnum( &pUnk );
       if (SUCCEEDED(hr))
     {
      hr = pUnk->QueryInterface( IID_IEnumVARIANT, (void**) &pEnum );
      if (SUCCEEDED(hr))
      {
      // Now Enumerate--there should be only one item.
      hr = pEnum->Next( 1, &var, &lFetch );
      if (SUCCEEDED(hr))
      {
        while( hr == S_OK )
        {
          if ( lFetch == 1 )
          {
            pDisp = V_DISPATCH(&var);
            hr = pDisp->QueryInterface( IID_IDirectorySearch, (void**)&pGCSearch);
            hrGC = hr;
          }
          VariantClear(&var);
          hr = pEnum->Next( 1, &var, &lFetch );
        };
      }
      }
        if (pEnum)
          pEnum->Release();
     }
       if (pUnk)
       pUnk->Release();
  }
  if (pContainer)
    pContainer->Release();

  if (FAILED(hrGC))
  {
    if (pGCSearch)
      pGCSearch->Release();
    return hrGC;
  }

  //Create search filter
  LPOLESTR pszSearchFilter = L"(&(objectCategory=person)(objectClass=user))";
    //Search entire subtree from root.
  ADS_SEARCHPREF_INFO SearchPrefs;
  SearchPrefs.dwSearchPref = ADS_SEARCHPREF_SEARCH_SCOPE;
  SearchPrefs.vValue.dwType = ADSTYPE_INTEGER;
  SearchPrefs.vValue.Integer = ADS_SCOPE_SUBTREE;
    DWORD dwNumPrefs = 1;

  // COL for iterations
    ADS_SEARCH_COLUMN col;

    // Handle used for searching
    ADS_SEARCH_HANDLE hSearch;

  // Set the search preference
    hr = pGCSearch->SetSearchPreference( &SearchPrefs, dwNumPrefs);
    if (FAILED(hr))
        return hr;
  // Set attributes to return
  CONST DWORD dwAttrNameSize = 2;
    LPOLESTR pszAttribute[dwAttrNameSize] = {L"cn",L"distinguishedName"};

    // Execute the search
    hr = pGCSearch->ExecuteSearch(pszSearchFilter,
                              pszAttribute,
                  dwAttrNameSize,
                  &hSearch
                  );
  if ( SUCCEEDED(hr) )
  {

    // Call IDirectorySearch::GetNextRow() to retrieve the next row
    //of data
        while( pGCSearch->GetNextRow( hSearch) != S_ADS_NOMORE_ROWS )
    {

            // loop through the array of passed column names,
            // print the data for each column
            for (DWORD x = 0; x < dwAttrNameSize; x++)
            {

          // Get the data for this column
                hr = pGCSearch->GetColumn( hSearch, pszAttribute[x], &col );

          if ( SUCCEEDED(hr) )
          {
            // Print the data for the column and free the column
          // Note the attributes we asked for are type CaseIgnoreString.
                    wprintf(L"%s: %s\r\n",pszAttribute[x],col.pADsValues->CaseIgnoreString);
            pGCSearch->FreeColumn( &col );
          }
          else
            wprintf(L"<%s property is not a string>",pszAttribute[x]);
            }
        wprintf(L"------------------------------\n");
    }

    // Close the search handle to clean up
        pGCSearch->CloseSearchHandle(hSearch);
  }
  if (pGCSearch)
    pGCSearch->Release();
    return hr;
}

int main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 9 of file gcallusers.cpp.

{
//Initialize COM
CoInitialize(NULL);

HRESULT hr = S_OK;
wprintf(L"This program finds all users in the forest\nby searching the global catalog.\n");
wprintf(L"------------------------------\n");

hr = FindAllUsersInGC();
if (FAILED(hr))
  wprintf(L"Search for all users failed with hr: %d\n", hr);
// Uninitialize COM
CoUninitialize();
return 0;
}

Generated on Wed Nov 13 2024 16:53:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/activedir/getdomainmode/vc/getdomainmode.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • activedir
  • getdomainmode
  • vc
Functions

getdomainmode.cpp File Reference

#include <wchar.h>
#include <activeds.h>

Go to the source code of this file.

Functions

HRESULT | CheckDomainModeOfObject (IDirectoryObject *pDirObject, BOOL *bIsMixed)
WCHAR * | GetDirectoryObjectAttrib (IDirectoryObject *pDirObject, LPWSTR pAttrName)
HRESULT | GetDomainMode (IADs *pDomain, BOOL *bIsMixed)
int | main (int argc, char *argv[])

Function Documentation

HRESULT CheckDomainModeOfObject | ( | IDirectoryObject * | pDirObject,
 |  | BOOL * | bIsMixed
 | ) |  |
WCHAR* GetDirectoryObjectAttrib | ( | IDirectoryObject * | pDirObject,
 |  | LPWSTR | pAttrName
 | ) |  |
HRESULT GetDomainMode | ( | IADs * | pDomain,
 |  | BOOL * | bIsMixed
 | ) |  |

Definition at line 97 of file getdomainmode.cpp.

{
HRESULT hr = E_FAIL;
VARIANT var;
if (pDomain)
{
  VariantClear(&var);
  //Get the ntMixedDomain attribute
  LPOLESTR szAttribute = L"ntMixedDomain";
  hr = pDomain->Get(szAttribute,&var);
  if (SUCCEEDED(hr))
  {
    //Type should be VT_I4.
    if (var.vt==VT_I4)
    {
      //Zero means native mode.
      if (var.lVal == 0)
        *bIsMixed = FALSE;
      //One means mixed mode.
      else if (var.lVal == 1)
        *bIsMixed = TRUE;
      else
        hr=E_FAIL;
    }
  }
  VariantClear(&var);
}
return hr;

}

int main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 9 of file getdomainmode.cpp.

{

wprintf(L"This program checks whether the current domain is in mixed or native mode.\n");

//Intialize COM
CoInitialize(NULL);
HRESULT hr = S_OK;
//Get rootDSE and the domain container's DN.
IADs *pObject = NULL;
LPOLESTR szPath = new OLECHAR[MAX_PATH];
VARIANT var;
BOOL bIsMixed;

hr = ADsOpenObject(L"LDAP://rootDSE",
         NULL,
         NULL,
         ADS_SECURE_AUTHENTICATION, //Use Secure Authentication
         IID_IADs,
         (void**)&pObject);
if (FAILED(hr))
{
   wprintf(L"Not Found. Could not bind to the domain.\n");
   if (pObject)
     pObject->Release();
   return TRUE;
}

hr = pObject->Get(L"defaultNamingContext",&var);
if (SUCCEEDED(hr))
{
  wcscpy(szPath,L"LDAP://"); //For NT 4.0 and Win 9.x, you must add the server name, e.g LDAP://myServer
  int len = wcslen(szPath);
  int dnLen = wcslen( var.bstrVal);
  if ( MAX_PATH <= len + dnLen ) // make sure we have enough buffer
  {
    wprintf(L"The buffer is too small for the DN\n");
    pObject->Release();
    VariantClear(&var);
    return FALSE;
  }

  wcscat(szPath,var.bstrVal);
  VariantClear(&var);
  if (pObject)
  {
     pObject->Release();
     pObject = NULL;
  }
  //Bind to the root of the current domain.
  hr = ADsOpenObject(szPath,
           NULL,
           NULL,
           ADS_SECURE_AUTHENTICATION, //Use Secure Authentication
           IID_IADs,
           (void**)&pObject);
  if (SUCCEEDED(hr))
  {
    hr = GetDomainMode(pObject, &bIsMixed);
    if (SUCCEEDED(hr))
    {
        hr = pObject->Get(L"name",&var);
      if (bIsMixed)
        wprintf(L"Current domain %s is in mixed mode\n", var.bstrVal);
      else
        wprintf(L"Current domain %s is in native mode\n", var.bstrVal);
    }
    else
      wprintf(L"GetDomainMode failed with hr: %x",hr);
  }
  else
    wprintf(L"Bind to domain failed with hr: %x",hr);
}
VariantClear(&var);
if (pObject)
  pObject->Release();

return TRUE;
}

Generated on Wed Nov 13 2024 16:53:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/activedir/getschemainfo/vc/getschemainfo.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • activedir
  • getschemainfo
  • vc
Defines | Functions

getschemainfo.cpp File Reference

#include <objbase.h>
#include <wchar.h>
#include <activeds.h>
#include <sddl.h>

Go to the source code of this file.

Defines

#define | _WIN32_WINNT 0x0500

Functions

HRESULT | FindAttributesOrClasses (IDirectorySearch *pSchemaNC, LPOLESTR szFilter, LPOLESTR *pszPropertiesToReturn, BOOL bIsAttributeQuery, BOOL bIsVerbose)
int | IS_BUFFER_ENOUGH (UINT maxAlloc, LPWSTR pszTarget, LPCWSTR pszSource, int toCopy=-1)
void | wmain (int argc, wchar_t *argv[])

Define Documentation

#define _WIN32_WINNT 0x0500

Definition at line 8 of file getschemainfo.cpp.

Function Documentation

HRESULT FindAttributesOrClasses | ( | IDirectorySearch * | pSchemaNC,
 |  | LPOLESTR | szFilter,
 |  | LPOLESTR * | pszPropertiesToReturn,
 |  | BOOL | bIsAttributeQuery,
 |  | BOOL | bIsVerbose
 | ) |  |

Definition at line 192 of file getschemainfo.cpp.

                                                                                :
             //example: l (Locality-Name)
              )
{
  if (!pSchemaNC)
    return E_POINTER;
    //Create search filter
  int allocFilter = MAX_PATH*2;
  LPOLESTR pszSearchFilter = new OLECHAR[allocFilter];
  LPOLESTR szCategory = NULL;
  if (bIsAttributeQuery)
    szCategory = L"attributeSchema";
  else
    szCategory = L"classSchema";

  wcscpy(pszSearchFilter, L"(&(objectCategory=attributeSchema)%s)");
  BOOL bBufferOK=false;
  // Check for buffer overrun...
  if (szFilter)
  {
    if ( IS_BUFFER_ENOUGH(allocFilter,pszSearchFilter, szCategory) > 0 )
    {
         wsprintf(pszSearchFilter, L"(&(objectCategory=%s)%s)",szCategory,szFilter);
       bBufferOK=true;
    }
  }
  else
  {
    if ( IS_BUFFER_ENOUGH(allocFilter,pszSearchFilter, szCategory) > 0 )
    {
         wsprintf(pszSearchFilter, L"(objectCategory=%s)",szCategory);
       bBufferOK=true;
    }
  }

  if( !bBufferOK)
  {
      wprintf(L"Filter is too large - aborting");
      return E_FAIL;
  }

    //Attributes are one-level deep in the Schema container so only need to search one level.
  ADS_SEARCHPREF_INFO SearchPrefs;
  SearchPrefs.dwSearchPref = ADS_SEARCHPREF_SEARCH_SCOPE;
  SearchPrefs.vValue.dwType = ADSTYPE_INTEGER;
  SearchPrefs.vValue.Integer = ADS_SCOPE_ONELEVEL;
    DWORD dwNumPrefs = 1;

  // COL for iterations
  LPOLESTR pszColumn = NULL;
  ADS_SEARCH_COLUMN col;
    HRESULT hr;

    // Interface Pointers
    IADs    *pObj = NULL;
    IADs  * pIADs = NULL;

    // Handle used for searching
    ADS_SEARCH_HANDLE hSearch = NULL;

  // Set the search preference
    hr = pSchemaNC->SetSearchPreference( &SearchPrefs, dwNumPrefs);
    if (FAILED(hr))
        return hr;

  LPOLESTR pszBool = NULL;
  DWORD dwBool;
  PSID pObjectSID = NULL;
  LPOLESTR szSID = NULL;
  LPOLESTR szDSGUID = new WCHAR [39];
  LPGUID pObjectGUID = NULL;
  FILETIME filetime;
  SYSTEMTIME systemtime;
  DATE date;
  VARIANT varDate;
  LARGE_INTEGER liValue;
  LPOLESTR *pszPropertyList = NULL;
  LPOLESTR pszNonVerboseList[] = {L"lDAPDisplayName",L"cn"};

  LPOLESTR szCNValue = new OLECHAR[MAX_PATH];
  LPOLESTR szLDAPDispleyNameValue = new OLECHAR[MAX_PATH];

  int iCount = 0;
  DWORD x = 0L;

  if (!bIsVerbose)
  {
     //Return non-verbose list properties only
         hr = pSchemaNC->ExecuteSearch(pszSearchFilter,
                              pszNonVerboseList,
                  sizeof(pszNonVerboseList)/sizeof(LPOLESTR),
                  &hSearch
                  );
  }
  else
  {
    if (!pszPropertiesToReturn)
    {
      //Return all properties.
      hr = pSchemaNC->ExecuteSearch(pszSearchFilter,
                              NULL,
                  0L,
                  &hSearch
                  );
    }
    else
    {
      //specified subset.
        pszPropertyList = pszPropertiesToReturn;
       //Return specified properties
       hr = pSchemaNC->ExecuteSearch(pszSearchFilter,
                              pszPropertyList,
                  sizeof(pszPropertyList)/sizeof(LPOLESTR),
                  &hSearch
                  );
    }
  }
  if ( SUCCEEDED(hr) )
  {
    // Call IDirectorySearch::GetNextRow() to retrieve the next row
    //of data
    hr = pSchemaNC->GetFirstRow( hSearch);
    if (SUCCEEDED(hr))
    {
        while( hr != S_ADS_NOMORE_ROWS )
    {
      //Keep track of count.
      iCount++;
      if (bIsVerbose)
        wprintf(L"----------------------------------\n");
            // loop through the array of passed column names,
            // print the data for each column

      while( pSchemaNC->GetNextColumnName( hSearch, &pszColumn ) != S_ADS_NOMORE_COLUMNS )
            {
                hr = pSchemaNC->GetColumn( hSearch, pszColumn, &col );
          if ( SUCCEEDED(hr) )
          {
                // Print the data for the column and free the column
          if(bIsVerbose)
          {
              // Get the data for this column
            wprintf(L"%s\n",col.pszAttrName);
          switch (col.dwADsType)
          {
            case ADSTYPE_DN_STRING:
                          for (x = 0; x< col.dwNumValues; x++)
              {
                wprintf(L"  %s\r\n",col.pADsValues[x].DNString);
              }
              break;
            case ADSTYPE_CASE_EXACT_STRING:
            case ADSTYPE_CASE_IGNORE_STRING:
            case ADSTYPE_PRINTABLE_STRING:
            case ADSTYPE_NUMERIC_STRING:
            case ADSTYPE_TYPEDNAME:
            case ADSTYPE_FAXNUMBER:
            case ADSTYPE_PATH:
            case ADSTYPE_OBJECT_CLASS:
              for (x = 0; x< col.dwNumValues; x++)
              {
                wprintf(L"  %s\r\n",col.pADsValues[x].CaseIgnoreString);
              }
              break;
            case ADSTYPE_BOOLEAN:
              for (x = 0; x< col.dwNumValues; x++)
              {
                dwBool = col.pADsValues[x].Boolean;
                pszBool = dwBool ? L"TRUE" : L"FALSE";
                wprintf(L"  %s\r\n",pszBool);
              }
              break;
            case ADSTYPE_INTEGER:
                for (x = 0; x< col.dwNumValues; x++)
              {
                wprintf(L"  %d\r\n",col.pADsValues[x].Integer);
              }
              break;
            case ADSTYPE_OCTET_STRING:
                if ( _wcsicmp(col.pszAttrName,L"objectSID") == 0 )
              {
                  for (x = 0; x< col.dwNumValues; x++)
                {
                  pObjectSID = (PSID)(col.pADsValues[x].OctetString.lpValue);
                  //Convert SID to string.
                  ConvertSidToStringSid(pObjectSID, &szSID);
                  wprintf(L"  %s\r\n",szSID);
                  LocalFree(szSID);
                }
              }
                else if ( (_wcsicmp(col.pszAttrName,L"objectGUID") == 0)
                || (_wcsicmp(col.pszAttrName,L"schemaIDGUID") == 0)
                || (_wcsicmp(col.pszAttrName,L"attributeSecurityGUID") == 0) )
              {
                  for (x = 0; x< col.dwNumValues; x++)
                {
                //Cast to LPGUID
                pObjectGUID = (LPGUID)(col.pADsValues[x].OctetString.lpValue);
                //Convert GUID to string.
                                ::StringFromGUID2(*pObjectGUID, szDSGUID, 39);
                //Print the GUID
                wprintf(L"  %s\r\n",szDSGUID);
                }
              }
                else if ( _wcsicmp(col.pszAttrName,L"oMObjectClass") == 0 )
              {
                //TODO:
                wprintf(L"  TODO:No conversion for this.");
              }
              else
                wprintf(L"  Value of type Octet String. No Conversion.");
                break;
            case ADSTYPE_UTC_TIME:
              for (x = 0; x< col.dwNumValues; x++)
              {
              systemtime = col.pADsValues[x].UTCTime;
              if (SystemTimeToVariantTime(&systemtime,
                            &date) != 0)
              {
                //Pack in variant.vt
                varDate.vt = VT_DATE;
                varDate.date = date;
                VariantChangeType(&varDate,&varDate,VARIANT_NOVALUEPROP,VT_BSTR);
                  wprintf(L"  %s\r\n",varDate.bstrVal);
                VariantClear(&varDate);
              }
              else
                wprintf(L"  Could not convert UTC-Time.\n");
              }
              break;
            case ADSTYPE_LARGE_INTEGER:
              for (x = 0; x< col.dwNumValues; x++)
              {
                liValue = col.pADsValues[x].LargeInteger;
              filetime.dwLowDateTime = liValue.LowPart;
              filetime.dwHighDateTime = liValue.HighPart;
              if((filetime.dwHighDateTime==0) && (filetime.dwLowDateTime==0))
              {
                wprintf(L"  No value set.\n");
              }
              else
              {
                //Check for properties of type LargeInteger that represent time
                //if TRUE, then convert to variant time.
                if ((0==wcscmp(L"accountExpires", col.pszAttrName))|
                  (0==wcscmp(L"badPasswordTime", col.pszAttrName))||
                  (0==wcscmp(L"lastLogon", col.pszAttrName))||
                  (0==wcscmp(L"lastLogoff", col.pszAttrName))||
                  (0==wcscmp(L"lockoutTime", col.pszAttrName))||
                  (0==wcscmp(L"pwdLastSet", col.pszAttrName))
                   )
                {
                  //Handle special case for Never Expires where low part is -1
                  if (filetime.dwLowDateTime==-1)
                  {
                    wprintf(L"  Never Expires.\n");
                  }
                  else
                  {
                    if (FileTimeToLocalFileTime(&filetime, &filetime) != 0)
                    {
                      if (FileTimeToSystemTime(&filetime,
                                 &systemtime) != 0)
                      {
                        if (SystemTimeToVariantTime(&systemtime,
                                      &date) != 0)
                        {
                          //Pack in variant.vt
                          varDate.vt = VT_DATE;
                          varDate.date = date;
                          VariantChangeType(&varDate,&varDate,VARIANT_NOVALUEPROP,VT_BSTR);
                          wprintf(L"  %s\r\n",varDate.bstrVal);
                          VariantClear(&varDate);
                        }
                        else
                        {
                          wprintf(L"  FileTimeToVariantTime failed\n");
                        }
                      }
                      else
                      {
                        wprintf(L"  FileTimeToSystemTime failed\n");
                      }

                    }
                    else
                    {
                      wprintf(L"  FileTimeToLocalFileTime failed\n");
                    }
                  }
                }
                else
                {
                  //Print the LargeInteger.
                  wprintf(L"  high: %d low: %d\r\n",filetime.dwHighDateTime, filetime.dwLowDateTime);
                }
              }
              }
              break;
            case ADSTYPE_NT_SECURITY_DESCRIPTOR:
              for (x = 0; x< col.dwNumValues; x++)
              {
                wprintf(L"  Security descriptor.\n");
              }
              break;
            default:
                  wprintf(L"Unknown type %d.\n",col.dwADsType);
          }
          }
            else
          {
          //Verbose handles only the two single-valued attributes: cn and ldapdisplayname
          //so this is a special case.
          if (0==wcscmp(L"cn", pszColumn))
          {
            wcscpy(szCNValue,col.pADsValues->CaseIgnoreString);
          }
          if (0==wcscmp(L"lDAPDisplayName", pszColumn))
          {
            wcscpy(szLDAPDispleyNameValue,col.pADsValues->CaseIgnoreString);
          }
          }
            pSchemaNC->FreeColumn( &col );
          }
        FreeADsMem( pszColumn );
            }
       if (!bIsVerbose)
         wprintf(L"%s (%s)\n",szLDAPDispleyNameValue,szCNValue);
       //Get the next row
       hr = pSchemaNC->GetNextRow( hSearch);
    }

    }
    // Close the search handle to clean up
      pSchemaNC->CloseSearchHandle(hSearch);
  }
  if (SUCCEEDED(hr) && 0==iCount)
    hr = S_FALSE;

    return hr;
}

int IS_BUFFER_ENOUGH | ( | UINT | maxAlloc,
 |  | LPWSTR | pszTarget,
 |  | LPCWSTR | pszSource,
 |  | int | toCopy = -1
 | ) |  |

Definition at line 548 of file getschemainfo.cpp.

{

         if (toCopy == -1)

          {
               toCopy = wcslen(pszSource);
          }

      return maxAlloc - (wcslen(pszTarget) + toCopy + 1);
}

void wmain | ( | int | argc,
 |  | wchar_t * | argv[]
 | ) |  |

Definition at line 31 of file getschemainfo.cpp.

{

//Handle the command line arguments
int maxAlloc=MAX_PATH*2;
LPOLESTR pszBuffer = new OLECHAR[maxAlloc];
wcscpy(pszBuffer, L"");

BOOL bIsAttributeQuery = TRUE;
BOOL bReturnVerbose = FALSE;
LPOLESTR szType = L"attribute";
if (1==argc||(_wcsicmp(argv[1],L"/?") == 0))
{
  wprintf(L"This program queries the schema for the specified classes or attributes.\n");
  wprintf(L"Syntax: getschemainfo [/C|/A][/V][querystring]\n");
  wprintf(L"where /C specifies to query for classes.\n");
  wprintf(L"      /A specifies to query for attributes.\n");
  wprintf(L"      /V specifies that all properties for the found classes or attributes should be returned.\n");
  wprintf(L"      querystring is the query criteria in ldap query format.\n");
  wprintf(L"Defaults: If neither /A or /C is specified, the query is against both.\n");
  wprintf(L"          If no /V is specified, the query returns only the ldapDisplayName and cn of the items found.\n");
  wprintf(L"          If no querystring is specified, the query returns all classes and/or attributes.\n");
  wprintf(L"Example: getschemainfo /A (IsSingleValued=TRUE)\n");
  wprintf(L"Returns all single-valued attributes in the schema.\n");
  wprintf(L"Common querystrings:\n");
  wprintf(L"For attributes:\n");
  wprintf(L"(cn=Street-Address) to find the attribute with CN of Street-Address.\n");
  wprintf(L"(ldapdisplayname=street) to find the attribute with ldapdisplayname of street.\n");
  wprintf(L"(IsSingleValued=TRUE) for single-valued attributes.\n");
  wprintf(L"(IsSingleValued=FALSE) for mulit-valued attributes.\n");
  wprintf(L"(systemFlags:1.2.840.113556.1.4.804:=00000001) for non-replicated attributes\n");
  wprintf(L"(systemFlags:1.2.840.113556.1.4.804:=00000004) for constructed attributes\n");
  wprintf(L"(searchFlags=1) for indexed attributes.\n");
  wprintf(L"(isMemberOfPartialAttributeSet=TRUE) for attributes included in the global catalog\n");
  return;
}
for (int i = 1;i<argc;i++)
{
  if (_wcsicmp(argv[i],L"/C") == 0)
  {
    bIsAttributeQuery = FALSE;
    szType = L"class";
  }
  else if (_wcsicmp(argv[i],L"/A") == 0)
  {
    bIsAttributeQuery = TRUE;
    szType = L"attribute";
  }
  else if (_wcsicmp(argv[i],L"/V") == 0)
  {
    bReturnVerbose = TRUE;
  }
  else
  {
    if ( IS_BUFFER_ENOUGH(maxAlloc,pszBuffer, argv[i]) > 0 )
    {
       wcscpy(pszBuffer,argv[i]);
    }
    else
    {

      wprintf(L"The argument is too large ");
      return;
    }

  }
}
if (_wcsicmp(pszBuffer,L"") == 0)
  wprintf(L"\nFinding all %sSchema objects in the schema...\n\n",szType);
else
  wprintf(L"\nFinding %sSchema objects based on query: %s...\n\n",szType, pszBuffer);

//Intialize COM
CoInitialize(NULL);
HRESULT hr = S_OK;
//Get rootDSE and the domain container's DN.
IADs *pObject = NULL;
IDirectorySearch *pSchemaNC = NULL;
LPOLESTR szPath = new OLECHAR[MAX_PATH];
VARIANT var;
hr = ADsOpenObject(L"LDAP://rootDSE",
         NULL,
         NULL,
         ADS_SECURE_AUTHENTICATION, //Use Secure Authentication
         IID_IADs,
         (void**)&pObject);
if (FAILED(hr))
{
   wprintf(L"Could not execute query. Could not bind to LDAP://rootDSE.\n");
   if (pObject)
     pObject->Release();
   return;
}
if (SUCCEEDED(hr))
{
  hr = pObject->Get(L"schemaNamingContext",&var);
  if (SUCCEEDED(hr))
  {
        wcscpy(szPath,L"LDAP://");

    if ( IS_BUFFER_ENOUGH(MAX_PATH,szPath, var.bstrVal, SysStringLen(var.bstrVal)) > 0 )
    {
            wcscat(szPath,var.bstrVal);
    }
    else
    {
      wprintf(L"The Schema's DN is too larget");
      pObject->Release();
      return;
    }

        hr = ADsOpenObject(szPath,
             NULL,
             NULL,
             ADS_SECURE_AUTHENTICATION, //Use Secure Authentication
             IID_IDirectorySearch,
             (void**)&pSchemaNC);

    if (SUCCEEDED(hr))
    {
      hr = FindAttributesOrClasses(pSchemaNC, //IDirectorySearch pointer to schema naming context.
           pszBuffer,
           NULL,
           bIsAttributeQuery,
           bReturnVerbose
         );
      if (SUCCEEDED(hr))
      {
        if (S_FALSE==hr)
           wprintf(L"No %sSchema object could be found based on the query: %s\n",szType,pszBuffer);
      }
      else if (0x8007203e==hr)
        wprintf(L"Could not execute query. An invalid filter was specified.\n");
      else
        wprintf(L"Query failed to run. HRESULT: %x\n",hr);
    }
    else
    {
       wprintf(L"Could not execute query. Could not bind to the schema container.\n");
    }
    if (pSchemaNC)
       pSchemaNC->Release();
  }
    VariantClear(&var);
}
if (pObject)
    pObject->Release();

// Uninitialize COM
CoUninitialize();
return;
}

Generated on Wed Nov 13 2024 16:53:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/activedir/guidbind/vc/ADSIhelpers.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • activedir
  • guidbind
  • vc
Classes | Defines | Functions | Variables

ADSIhelpers.cpp File Reference

#include "ADSIhelpers.h"
#include <windows.h>
#include <OBJIDL.H>
#include <OAIDL.H>
#include <COMCAT.H>
#include <DOCOBJ.H>
#include <HLINK.H>
#include <MTX.H>
#include <MTXSPM.H>
#include <stdio.h>
#include <string.h>
#include <assert.h>

Go to the source code of this file.

Classes

struct | IIDLookUp

Defines

#define | _WIN32_DCOM
#define | INC_OLE2
#define | UNICODE 1

Functions

void | ADErrMsgBox (HRESULT passedhr)
const char * | AdsTypeToChar (long AdsType)
BOOL | AretheGUIDsEqual (REFGUID rguid1, REFGUID rguid2)
void | CheckHRESULT (HRESULT hr, const char *pszCause)
WCHAR * | CrackADError (HRESULT hResult)
char * | GetCharFromGUID (GUID idtofind)
HRESULT | GetIADsPropertyValueAsBSTR (BSTR *pbsRet, IADsPropertyValue *pAdsPV)
const char * | GetVariantStyle (VARTYPE vt)
const char * | QueryAllInterfaces (IUnknown *pUnk)

Variables

IIDLookUp arIDs []
char | pQueryAllInterfacesOut [5000]

Define Documentation

#define _WIN32_DCOM

Definition at line 12 of file ADSIhelpers.cpp.

#define INC_OLE2

Definition at line 10 of file ADSIhelpers.cpp.

#define UNICODE 1

Definition at line 11 of file ADSIhelpers.cpp.

Function Documentation

void ADErrMsgBox ( HRESULT passedhr )

Definition at line 226 of file ADSIhelpers.cpp.

{

    if (SUCCEEDED(passedhr))
        return;

    HRESULT hr;
    DWORD lError;
    WCHAR pwErrBuff[2048];
    WCHAR pwADErrBuff[512];

    WCHAR * pADErrCodeStr;

    pwErrBuff[0] = NULL;
    pADErrCodeStr = CrackADError( passedhr);

    // If an ADSI error code was returned, display it
    if (pADErrCodeStr[0] != NULL)
    {
        wcscat(pwErrBuff,L"\t<*> ADSI Error HRESULT Returns: <*> \n");
        wcscat(pwErrBuff,pADErrCodeStr);
        wcscat(pwErrBuff,L"\n");
    }

    // Call ADsGetLastError() to retrieve the error text from ADSI
    wcscat(pwErrBuff,L"\t<*> ADSI Error: <*>\n");

    hr = ADsGetLastError(
        &lError,
        pwADErrBuff,
        2047,
        L"",
        0
        );

    if (FAILED(hr))
        wcscat(pwErrBuff,L"<Unable to retrieve ADs Error>");
    else
        wcscat(pwErrBuff,pwADErrBuff);

    wcscat(pwErrBuff,L"\n");

    WCHAR sz[1024];

    wcscat(pwErrBuff,L"\t<*> System Error: <*> \n");

    // Check the standard system to crack the bad HRESULT into a string
    if (!FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM, 0, passedhr, 0, sz, 1024, 0))
        wcscat(sz, L"Unknown HRESULT error");
    else
        wcscat(pwErrBuff, sz);

    // Display
    OutputDebugStringW(pwErrBuff);
    OutputDebugStringW(L"\r\n");
    MessageBoxW(NULL,pwErrBuff,L"ADErrMsgBox():",MB_OK);

    #ifdef _DEBUG
        DebugBreak();
    #endif

    #ifdef THROW_CHARPTR_ONERROR
        throw pwErrBuff;
    #endif

}

const char* AdsTypeToChar ( long AdsType )

Definition at line 637 of file ADSIhelpers.cpp.

{
  static char pAdsChar[200];
  pAdsChar[0] = NULL;

  switch (AdsType)
  {

    case ADSTYPE_INVALID :
      strcpy(pAdsChar,"ADSTYPE_INVALID");
    break;
    case ADSTYPE_DN_STRING :
      strcpy(pAdsChar,"ADSTYPE_DN_STRING");
    break;
    case ADSTYPE_CASE_EXACT_STRING :
      strcpy(pAdsChar,"ADSTYPE_CASE_EXACT_STRING");
    break;
    case ADSTYPE_CASE_IGNORE_STRING :
      strcpy(pAdsChar,"ADSTYPE_CASE_IGNORE_STRING");
    break;
    case ADSTYPE_PRINTABLE_STRING :
      strcpy(pAdsChar,"ADSTYPE_PRINTABLE_STRING");
    break;
    case ADSTYPE_NUMERIC_STRING :
      strcpy(pAdsChar,"ADSTYPE_NUMERIC_STRING");
    break;
    case ADSTYPE_BOOLEAN :
      strcpy(pAdsChar,"ADSTYPE_BOOLEAN");
    break;
    case ADSTYPE_INTEGER :
      strcpy(pAdsChar,"ADSTYPE_INTEGER");
    break;
    case ADSTYPE_OCTET_STRING :
      strcpy(pAdsChar,"ADSTYPE_OCTET_STRING");
    break;
    case ADSTYPE_UTC_TIME :
      strcpy(pAdsChar,"ADSTYPE_UTC_TIME");
    break;
    case ADSTYPE_LARGE_INTEGER :
      strcpy(pAdsChar,"ADSTYPE_LARGE_INTEGER");
    break;
    case ADSTYPE_PROV_SPECIFIC :
      strcpy(pAdsChar,"ADSTYPE_PROV_SPECIFIC");
    break;
    case ADSTYPE_OBJECT_CLASS :
      strcpy(pAdsChar,"ADSTYPE_OBJECT_CLASS");
    break;
    case ADSTYPE_PATH :
      strcpy(pAdsChar,"ADSTYPE_PATH");
    break;
    case ADSTYPE_NT_SECURITY_DESCRIPTOR :
      strcpy(pAdsChar,"ADSTYPE_NT_SECURITY_DESCRIPTOR");
    break;

    default:
      strcpy(pAdsChar,"<UNRECOGNIZED>");
    break;

  }
  return pAdsChar;

}

BOOL AretheGUIDsEqual | ( | REFGUID | rguid1,
 |  | REFGUID | rguid2 |
 | ) |  |  | [inline]

Definition at line 940 of file ADSIhelpers.cpp.

{
   return (
    ((PLONG) &rguid1)[0] == ((PLONG) &rguid2)[0] &&
    ((PLONG) &rguid1)[1] == ((PLONG) &rguid2)[1] &&
    ((PLONG) &rguid1)[2] == ((PLONG) &rguid2)[2] &&
    ((PLONG) &rguid1)[3] == ((PLONG) &rguid2)[3]);
}

void CheckHRESULT | ( | HRESULT | hr,
 |  | const char * | pszCause
 | ) |  |

Definition at line 45 of file ADSIhelpers.cpp.

{
    if (FAILED(hr))
    {
        char sz[1024];
        char szCaption[1024];
        strcpy(szCaption, pszCause);
        strcat(szCaption, " failed!");
        if (!FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, 0, hr, 0, sz, 1024, 0))
            strcpy(sz, "Unknown error");
        MessageBoxA(0, sz, szCaption, MB_SETFOREGROUND);
       // DebugBreak();
    }
}

WCHAR* CrackADError ( HRESULT hResult )

Definition at line 296 of file ADSIhelpers.cpp.

{
   static WCHAR szwText[ 128 ];
   szwText[0] = 0l;

   switch( hResult )
   {
      case  E_ADS_BAD_PATHNAME:
         return L"E_ADS_BAD_PATHNAME";
         break;

      case  E_ADS_INVALID_DOMAIN_OBJECT:
         return L"E_ADS_INVALID_DOMAIN_OBJECT";
         break;

      case  E_ADS_INVALID_USER_OBJECT:
         return L"E_ADS_INVALID_USER_OBJECT";
         break;

      case  E_ADS_INVALID_COMPUTER_OBJECT:
         return L"E_ADS_INVALID_COMPUTER_OBJECT";
         break;

      case  E_ADS_UNKNOWN_OBJECT:
         return L"E_ADS_UNKNOWN_OBJECT";
         break;

      case  E_ADS_PROPERTY_NOT_SET:
         return L"E_ADS_PROPERTY_NOT_SET";
         break;

      case  E_ADS_PROPERTY_NOT_SUPPORTED:
         return L"E_ADS_PROPERTY_NOT_SUPPORTED";
         break;

      case  E_ADS_PROPERTY_INVALID:
         return L"E_ADS_PROPERTY_INVALID";
         break;

      case  E_ADS_BAD_PARAMETER:
         return L"E_ADS_BAD_PARAMETER";
         break;

      case  E_ADS_OBJECT_UNBOUND:
         return L"E_ADS_OBJECT_UNBOUND";
         break;

      case  E_ADS_PROPERTY_NOT_MODIFIED:
         return L"E_ADS_PROPERTY_NOT_MODIFIED";
         break;

      case  E_ADS_PROPERTY_MODIFIED:
         return L"E_ADS_PROPERTY_MODIFIED";
         break;

      case  E_ADS_CANT_CONVERT_DATATYPE:
         return L"E_ADS_CANT_CONVERT_DATATYPE";
         break;

      case  E_ADS_PROPERTY_NOT_FOUND:
         return L"E_ADS_PROPERTY_NOTFOUND";
         break;

      case  E_ADS_OBJECT_EXISTS:
         return L"E_ADS_OBJECT_EXISTS";
         break;

      case  E_ADS_SCHEMA_VIOLATION:
         return L"E_ADS_SCHEMA_VIOLATION";
         break;

      case  E_ADS_COLUMN_NOT_SET:
         return L"E_ADS_COLUMN_NOT_SET";
         break;

      case  E_ADS_INVALID_FILTER:
         return L"E_ADS_INVALID_FILTER";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_OPERATIONS_ERROR):
         return L"ERROR_DS_OPERATIONS_ERROR";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_PROTOCOL_ERROR):
         return L"ERROR_DS_PROTOCOL_ERROR";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_TIMELIMIT_EXCEEDED):
         return L"ERROR_DS_TIMELIMIT_EXCEEDED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_SIZELIMIT_EXCEEDED):
         return L"ERROR_DS_SIZELIMIT_EXCEEDED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_COMPARE_FALSE):
         return L"ERROR_DS_COMPARE_FALSE";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_COMPARE_TRUE):
         return L"ERROR_DS_COMPARE_TRUE";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_AUTH_METHOD_NOT_SUPPORTED):
         return L"ERROR_DS_AUTH_METHOD_NOT_SUPPORTED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_STRONG_AUTH_REQUIRED):
         return L"ERROR_DS_STRONG_AUTH_REQUIRED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_MORE_DATA):
         return L"ERROR_MORE_DATA";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_REFERRAL):
         return L"(ERROR_DS_REFERRAL";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_ADMIN_LIMIT_EXCEEDED):
         return L"ERROR_DS_ADMIN_LIMIT_EXCEEDED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_UNAVAILABLE_CRIT_EXTENSION):
         return L"(ERROR_DS_UNAVAILABLE_CRIT_EXTENSION";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_CONFIDENTIALITY_REQUIRED):
         return L"HRESULT_FROM_WIN32(ERROR_DS_CONFIDENTIALITY_REQUIRED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_NO_ATTRIBUTE_OR_VALUE):
         return L"ERROR_DS_NO_ATTRIBUTE_OR_VALUE";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_ATTRIBUTE_TYPE_UNDEFINED):
         return L"(ERROR_DS_ATTRIBUTE_TYPE_UNDEFINED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_INAPPROPRIATE_MATCHING):
         return L"(ERROR_DS_INAPPROPRIATE_MATCHING";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_CONSTRAINT_VIOLATION):
         return L"ERROR_DS_CONSTRAINT_VIOLATION";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_ATTRIBUTE_OR_VALUE_EXISTS):
         return L"ERROR_DS_ATTRIBUTE_OR_VALUE_EXISTS";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_INVALID_ATTRIBUTE_SYNTAX):
         return L"ERROR_DS_INVALID_ATTRIBUTE_SYNTAX";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_NO_SUCH_OBJECT):
         return L"ERROR_DS_NO_SUCH_OBJECT";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_INVALID_DN_SYNTAX):
         return L"ERROR_DS_INVALID_DN_SYNTAX";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_IS_LEAF):
         return L"ERROR_DS_IS_LEAF";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_ALIAS_DEREF_PROBLEM):
         return L"ERROR_DS_ALIAS_DEREF_PROBLEM";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_INAPPROPRIATE_AUTH):
         return L"ERROR_DS_INAPPROPRIATE_AUTH";
         break;

      case  HRESULT_FROM_WIN32(ERROR_INVALID_PASSWORD):
         return L"ERROR_INVALID_PASSWORD";
         break;

      case  HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED):
         return L"ERROR_ACCESS_DENIED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_BUSY):
         return L"ERROR_DS_BUSY";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_UNAVAILABLE):
         return L"ERROR_DS_UNAVAILABLE";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_UNWILLING_TO_PERFORM):
         return L"ERROR_DS_UNWILLING_TO_PERFORM";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_LOOP_DETECT):
         return L"ERROR_DS_LOOP_DETECT";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_NAMING_VIOLATION):
         return L"ERROR_DS_NAMING_VIOLATION";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_OBJ_CLASS_VIOLATION):
         return L"ERROR_DS_OBJ_CLASS_VIOLATION";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_CANT_ON_NON_LEAF):
         return L"ERROR_DS_CANT_ON_NONLEAF";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_CANT_ON_RDN):
         return L"ERROR_DS_CANT_ON_RDN";
         break;

      case  HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS):
         return L"ERROR_ALREADY_EXISTS";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_CANT_MOD_OBJ_CLASS):
         return L"ERROR_DS_CANT_MOD_OBJ_CLASS";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_OBJECT_RESULTS_TOO_LARGE):
         return L"ERROR_DS_OBJECT_RESULTS_TOO_LARGE";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_AFFECTS_MULTIPLE_DSAS):
         return L"ERROR_DS_AFFECTS_MULTIPLE_DSAS";
         break;

      case  HRESULT_FROM_WIN32(ERROR_GEN_FAILURE):
         return L"(ERROR_GEN_FAILURE";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_SERVER_DOWN):
         return L"ERROR_DS_SERVER_DOWN";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_LOCAL_ERROR):
         return L"ERROR_DS_LOCAL_ERROR";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_ENCODING_ERROR):
         return L"ERROR_DS_ENCODING_ERROR";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_DECODING_ERROR):
         return L"(ERROR_DS_DECODING_ERROR";
         break;

      case  HRESULT_FROM_WIN32(ERROR_TIMEOUT):
         return L"(ERROR_TIMEOUT";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_AUTH_UNKNOWN):
         return L"ERROR_DS_AUTH_UNKNOWN";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_FILTER_UNKNOWN):
         return L"(ERROR_DS_FILTER_UNKNOWN";
         break;

      case  HRESULT_FROM_WIN32(ERROR_CANCELLED):
         return L"(ERROR_CANCELLED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_PARAM_ERROR):
         return L"ERROR_DS_PARAM_ERROR";
         break;

      case  HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY):
         return L"ERROR_NOT_ENOUGH_MEMORY";
         break;

      case  HRESULT_FROM_WIN32(ERROR_CONNECTION_REFUSED):
         return L"ERROR_CONNECTION_REFUSED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_NOT_SUPPORTED):
         return L"ERROR_DS_NOT_SUPPORTED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_NO_RESULTS_RETURNED):
         return L"ERROR_DS_NO_RESULTS_RETURNED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_CONTROL_NOT_FOUND):
         return L"ERROR_DS_CONTROL_NOT_FOUND";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_CLIENT_LOOP):
         return L"(ERROR_DS_CLIENT_LOOP";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_REFERRAL_LIMIT_EXCEEDED):
         return L"ERROR_DS_REFERRAL_LIMIT_EXCEEDED";
         break;

      case  E_FAIL:
         return L"E_FAIL";
         break;

      case  E_NOTIMPL:
         return L"E_NOIMPL";
         break;

      case  S_OK:
         return L"OK";
         break;

      case  0x800704b8:
      // we have an extended error
      {
         WCHAR szErrorBuff[ 1024 ];
         WCHAR szNameBuff[ 1024 ];
         DWORD dwError;

         ADsGetLastError( &dwError,
                          szErrorBuff,
                          1023,
                          szNameBuff,
                          1023 );
         wcscat( szNameBuff, L" : " );
         wcscat( szNameBuff, szErrorBuff );
         wcscpy( szwText,szNameBuff);

         return szwText;
      }

   }

    return szwText;
}

char* GetCharFromGUID ( GUID idtofind )

Definition at line 951 of file ADSIhelpers.cpp.

{
  int x =0;

  while(arIDs[x].pIDName && !AretheGUIDsEqual(arIDs[x].id ,idtofind))
    x++;

  return arIDs[x].pIDName ;
}

HRESULT GetIADsPropertyValueAsBSTR | ( | BSTR * | pbsRet,
 |  | IADsPropertyValue * | pAdsPV
 | ) |  |

Definition at line 99 of file ADSIhelpers.cpp.

{
  HRESULT hr = S_OK;

  long lAdsType;
  hr = pAdsPV->get_ADsType(&lAdsType);

  if (FAILED(hr))
    return hr;

  switch (lAdsType)
  {
    case ADSTYPE_INVALID :
    {
      *pbsRet = SysAllocString(L"<ADSTYPE_INVALID>");
    }
    break;

    case ADSTYPE_DN_STRING :
    {
      hr = pAdsPV->get_DNString(pbsRet);
    }
    break;
    case ADSTYPE_CASE_EXACT_STRING :
    {
      hr = pAdsPV->get_CaseExactString(pbsRet);
    }
    break;
    case ADSTYPE_CASE_IGNORE_STRING :
    {
      hr = pAdsPV->get_CaseIgnoreString(pbsRet);
    }
    break;
    case ADSTYPE_PRINTABLE_STRING :
    {
      hr = pAdsPV->get_PrintableString(pbsRet);
    }
    break;
    case ADSTYPE_NUMERIC_STRING :
    {
      hr = pAdsPV->get_NumericString(pbsRet);
    }
    break;
    case ADSTYPE_BOOLEAN :
    {
      long b;
      hr = pAdsPV->get_Boolean(&b);
      if (SUCCEEDED(hr))
      {
        if (b)
          *pbsRet = SysAllocString(L"<TRUE>");
        else
          *pbsRet = SysAllocString(L"<FALSE>");
      }
    }
    break;
    case ADSTYPE_INTEGER :
    {
      long lInt;
      hr = pAdsPV->get_Integer(&lInt);
      if (SUCCEEDED(hr))
      {
        WCHAR wOut[100];
        wsprintf(wOut,L"%d",lInt);
        *pbsRet = SysAllocString(wOut);
      }
    }
    break;
    case ADSTYPE_OCTET_STRING :
    {
      *pbsRet = SysAllocString(L"<ADSTYPE_LARGE_INTEGER>");
      //  hr = pAdsPV->get_OctetString(pbsRet);
    }
    break;
    case ADSTYPE_UTC_TIME :
    {
      DATE daUTCTime;
      WCHAR wDateOut[255];
      hr = pAdsPV->get_UTCTime(&daUTCTime);

      if (SUCCEEDED(hr))
      {
      /*  wsprintf(wDateout,L"%02d/%02d/%04d %02d:%02d:%02d",
          pValues->UTCTime.wMonth, pValues->UTCTime.wDay, pValues->UTCTime.wYear,
          pValues->UTCTime.wHour, pValues->UTCTime.wMinute, pValues->UTCTime.wSecond );
      */
        *pbsRet = SysAllocString(wDateOut);
      }
    }
    break;
    case ADSTYPE_LARGE_INTEGER :
    {
      *pbsRet = SysAllocString(L"<ADSTYPE_LARGE_INTEGER>");
    }
    break;
    case ADSTYPE_PROV_SPECIFIC :
    {
      *pbsRet = SysAllocString(L"<ADSTYPE_PROV_SPECIFIC>");
    }
    break;
    case ADSTYPE_OBJECT_CLASS :
    {
      *pbsRet = SysAllocString(L"<ADSTYPE_OBJECT_CLASS>");
    }
    break;
    case ADSTYPE_PATH :
    {
      *pbsRet = SysAllocString(L"<ADSTYPE_PATH>");
    }
    break;
    case ADSTYPE_NT_SECURITY_DESCRIPTOR :
    {
      *pbsRet = SysAllocString(L"<ADSTYPE_NT_SECURITY_DESCRIPTOR>");
    }
    break;

    default:
      *pbsRet = SysAllocString(L"<UNRECOGNIZED>");
    break;

  }
  return hr;
}

const char* GetVariantStyle ( VARTYPE vt )

Definition at line 63 of file ADSIhelpers.cpp.

{
  static char pRet[200];

  pRet[0] = NULL;

  if (vt == VT_EMPTY) strcat(pRet,"VT_EMPTY ");

  if (HAS_BIT_STYLE(vt, VT_BYREF)) strcat(pRet,"VT_BYREF ");
  if (HAS_BIT_STYLE(vt, VT_UI1)) strcat(pRet,"VT_UI1 ");
  if (HAS_BIT_STYLE(vt, VT_I2)) strcat(pRet,"VT_I2 ");
  if (HAS_BIT_STYLE(vt, VT_I4)) strcat(pRet,"VT_I4 ");
  if (HAS_BIT_STYLE(vt, VT_R4)) strcat(pRet,"VT_R4 ");
  if (HAS_BIT_STYLE(vt, VT_R8)) strcat(pRet,"VT_R8 ");
  if (HAS_BIT_STYLE(vt, VT_CY)) strcat(pRet,"VT_CY ");
  if (HAS_BIT_STYLE(vt, VT_BSTR)) strcat(pRet,"VT_BSTR ");
  if (HAS_BIT_STYLE(vt, VT_NULL)) strcat(pRet,"VT_NULL ");
  if (HAS_BIT_STYLE(vt, VT_ERROR)) strcat(pRet,"VT_ERROR ");
  if (HAS_BIT_STYLE(vt, VT_BOOL)) strcat(pRet,"VT_BOOL ");
  if (HAS_BIT_STYLE(vt, VT_DATE)) strcat(pRet,"VT_DATE ");
  if (HAS_BIT_STYLE(vt, VT_DISPATCH)) strcat(pRet,"VT_DISPATCH ");
  if (HAS_BIT_STYLE(vt, VT_VARIANT)) strcat(pRet,"VT_VARIANT ");
  if (HAS_BIT_STYLE(vt, VT_UNKNOWN)) strcat(pRet,"VT_UNKNOWN ");
  if (HAS_BIT_STYLE(vt, VT_ARRAY)) strcat(pRet,"VT_ARRAY ");

  return pRet;
}

const char* QueryAllInterfaces ( IUnknown * pUnk )

Definition at line 966 of file ADSIhelpers.cpp.

{

  int x = 0;
  int iLen = sizeof(arIDs)/sizeof(IIDLookUp);
  pQueryAllInterfacesOut[0] = NULL;
  IUnknown * pGetUnk = NULL;

  for (x = 0; x < iLen; x++)
  {
    if(SUCCEEDED(pUnk->QueryInterface(arIDs[x].id,(void **) &pGetUnk)))
    {
      if (arIDs[x].pIDName)
      {
        strcat (pQueryAllInterfacesOut,arIDs[x].pIDName );
        strcat (pQueryAllInterfacesOut,"\n ");
        pGetUnk->Release();
        pGetUnk = NULL;
      }
    }
  }
  return pQueryAllInterfacesOut;
}

Variable Documentation

IIDLookUp arIDs[]

Definition at line 713 of file ADSIhelpers.cpp.

char pQueryAllInterfacesOut[5000]

Definition at line 961 of file ADSIhelpers.cpp.

Generated on Wed Nov 13 2024 16:53:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/activedir/guidbind/vc/ADSIhelpers.h File Reference

  • NetDS
  • ADSI
  • samples
  • activedir
  • guidbind
  • vc
Defines | Functions

ADSIhelpers.h File Reference

#include <activeds.h>
#include <adsiid.h>

Go to the source code of this file.

Defines

#define | HAS_BIT_STYLE(val, style) ((val & style) == style)

Functions

void | ADErrMsgBox (HRESULT passedhr)
void | CheckADHRESULT (HRESULT hr)
void | CheckHRESULT (HRESULT hr, const char *pszCause)
WCHAR * | CrackADError (HRESULT hResult)
char * | GetCharFromGUID (GUID idtofind)
HRESULT | GetIADsPropertyValueAsBSTR (BSTR *pbsRet, IADsPropertyValue *pAdsPV)
const char * | GetVariantStyle (VARTYPE vt)
const char * | QueryAllInterfaces (IUnknown *pUnk)

Define Documentation

#define HAS_BIT_STYLE | ( | val,
 |  | style |
 | ) |  | ((val & style) == style)

Definition at line 32 of file ADSIhelpers.h.

Function Documentation

void ADErrMsgBox ( HRESULT passedhr )

Definition at line 226 of file ADSIhelpers.cpp.

{

    if (SUCCEEDED(passedhr))
        return;

    HRESULT hr;
    DWORD lError;
    WCHAR pwErrBuff[2048];
    WCHAR pwADErrBuff[512];

    WCHAR * pADErrCodeStr;

    pwErrBuff[0] = NULL;
    pADErrCodeStr = CrackADError( passedhr);

    // If an ADSI error code was returned, display it
    if (pADErrCodeStr[0] != NULL)
    {
        wcscat(pwErrBuff,L"\t<*> ADSI Error HRESULT Returns: <*> \n");
        wcscat(pwErrBuff,pADErrCodeStr);
        wcscat(pwErrBuff,L"\n");
    }

    // Call ADsGetLastError() to retrieve the error text from ADSI
    wcscat(pwErrBuff,L"\t<*> ADSI Error: <*>\n");

    hr = ADsGetLastError(
        &lError,
        pwADErrBuff,
        2047,
        L"",
        0
        );

    if (FAILED(hr))
        wcscat(pwErrBuff,L"<Unable to retrieve ADs Error>");
    else
        wcscat(pwErrBuff,pwADErrBuff);

    wcscat(pwErrBuff,L"\n");

    WCHAR sz[1024];

    wcscat(pwErrBuff,L"\t<*> System Error: <*> \n");

    // Check the standard system to crack the bad HRESULT into a string
    if (!FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM, 0, passedhr, 0, sz, 1024, 0))
        wcscat(sz, L"Unknown HRESULT error");
    else
        wcscat(pwErrBuff, sz);

    // Display
    OutputDebugStringW(pwErrBuff);
    OutputDebugStringW(L"\r\n");
    MessageBoxW(NULL,pwErrBuff,L"ADErrMsgBox():",MB_OK);

    #ifdef _DEBUG
        DebugBreak();
    #endif

    #ifdef THROW_CHARPTR_ONERROR
        throw pwErrBuff;
    #endif

}

void CheckADHRESULT ( HRESULT hr ) [inline]

Definition at line 40 of file ADSIhelpers.h.

{
    if (FAILED(hr))
        ADErrMsgBox(hr);

}

void CheckHRESULT | ( | HRESULT | hr,
 |  | const char * | pszCause
 | ) |  |

Definition at line 45 of file ADSIhelpers.cpp.

{
    if (FAILED(hr))
    {
        char sz[1024];
        char szCaption[1024];
        strcpy(szCaption, pszCause);
        strcat(szCaption, " failed!");
        if (!FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, 0, hr, 0, sz, 1024, 0))
            strcpy(sz, "Unknown error");
        MessageBoxA(0, sz, szCaption, MB_SETFOREGROUND);
       // DebugBreak();
    }
}

WCHAR* CrackADError ( HRESULT hResult )

Definition at line 385 of file main.cpp.

{
   static WCHAR szwText[ 128 ];
   szwText[0] = 0l;

   switch( hResult )
   {
      case  E_ADS_BAD_PATHNAME:
         return L"E_ADS_BAD_PATHNAME";
         break;

      case  E_ADS_INVALID_DOMAIN_OBJECT:
         return L"E_ADS_INVALID_DOMAIN_OBJECT";
         break;

      case  E_ADS_INVALID_USER_OBJECT:
         return L"E_ADS_INVALID_USER_OBJECT";
         break;

      case  E_ADS_INVALID_COMPUTER_OBJECT:
         return L"E_ADS_INVALID_COMPUTER_OBJECT";
         break;

      case  E_ADS_UNKNOWN_OBJECT:
         return L"E_ADS_UNKNOWN_OBJECT";
         break;

      case  E_ADS_PROPERTY_NOT_SET:
         return L"E_ADS_PROPERTY_NOT_SET";
         break;

      case  E_ADS_PROPERTY_NOT_SUPPORTED:
         return L"E_ADS_PROPERTY_NOT_SUPPORTED";
         break;

      case  E_ADS_PROPERTY_INVALID:
         return L"E_ADS_PROPERTY_INVALID";
         break;

      case  E_ADS_BAD_PARAMETER:
         return L"E_ADS_BAD_PARAMETER";
         break;

      case  E_ADS_OBJECT_UNBOUND:
         return L"E_ADS_OBJECT_UNBOUND";
         break;

      case  E_ADS_PROPERTY_NOT_MODIFIED:
         return L"E_ADS_PROPERTY_NOT_MODIFIED";
         break;

      case  E_ADS_PROPERTY_MODIFIED:
         return L"E_ADS_PROPERTY_MODIFIED";
         break;

      case  E_ADS_CANT_CONVERT_DATATYPE:
         return L"E_ADS_CANT_CONVERT_DATATYPE";
         break;

      case  E_ADS_PROPERTY_NOT_FOUND:
         return L"E_ADS_PROPERTY_NOTFOUND";
         break;

      case  E_ADS_OBJECT_EXISTS:
         return L"E_ADS_OBJECT_EXISTS";
         break;

      case  E_ADS_SCHEMA_VIOLATION:
         return L"E_ADS_SCHEMA_VIOLATION";
         break;

      case  E_ADS_COLUMN_NOT_SET:
         return L"E_ADS_COLUMN_NOT_SET";
         break;

      case  E_ADS_INVALID_FILTER:
         return L"E_ADS_INVALID_FILTER";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_OPERATIONS_ERROR):
         return L"ERROR_DS_OPERATIONS_ERROR";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_PROTOCOL_ERROR):
         return L"ERROR_DS_PROTOCOL_ERROR";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_TIMELIMIT_EXCEEDED):
         return L"ERROR_DS_TIMELIMIT_EXCEEDED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_SIZELIMIT_EXCEEDED):
         return L"ERROR_DS_SIZELIMIT_EXCEEDED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_COMPARE_FALSE):
         return L"ERROR_DS_COMPARE_FALSE";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_COMPARE_TRUE):
         return L"ERROR_DS_COMPARE_TRUE";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_AUTH_METHOD_NOT_SUPPORTED):
         return L"ERROR_DS_AUTH_METHOD_NOT_SUPPORTED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_STRONG_AUTH_REQUIRED):
         return L"ERROR_DS_STRONG_AUTH_REQUIRED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_MORE_DATA):
         return L"ERROR_MORE_DATA";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_REFERRAL):
         return L"(ERROR_DS_REFERRAL";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_ADMIN_LIMIT_EXCEEDED):
         return L"ERROR_DS_ADMIN_LIMIT_EXCEEDED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_UNAVAILABLE_CRIT_EXTENSION):
         return L"(ERROR_DS_UNAVAILABLE_CRIT_EXTENSION";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_CONFIDENTIALITY_REQUIRED):
         return L"HRESULT_FROM_WIN32(ERROR_DS_CONFIDENTIALITY_REQUIRED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_NO_ATTRIBUTE_OR_VALUE):
         return L"ERROR_DS_NO_ATTRIBUTE_OR_VALUE";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_ATTRIBUTE_TYPE_UNDEFINED):
         return L"(ERROR_DS_ATTRIBUTE_TYPE_UNDEFINED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_INAPPROPRIATE_MATCHING):
         return L"(ERROR_DS_INAPPROPRIATE_MATCHING";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_CONSTRAINT_VIOLATION):
         return L"ERROR_DS_CONSTRAINT_VIOLATION";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_ATTRIBUTE_OR_VALUE_EXISTS):
         return L"ERROR_DS_ATTRIBUTE_OR_VALUE_EXISTS";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_INVALID_ATTRIBUTE_SYNTAX):
         return L"ERROR_DS_INVALID_ATTRIBUTE_SYNTAX";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_NO_SUCH_OBJECT):
         return L"ERROR_DS_NO_SUCH_OBJECT";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_INVALID_DN_SYNTAX):
         return L"ERROR_DS_INVALID_DN_SYNTAX";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_IS_LEAF):
         return L"ERROR_DS_IS_LEAF";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_ALIAS_DEREF_PROBLEM):
         return L"ERROR_DS_ALIAS_DEREF_PROBLEM";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_INAPPROPRIATE_AUTH):
         return L"ERROR_DS_INAPPROPRIATE_AUTH";
         break;

      case  HRESULT_FROM_WIN32(ERROR_INVALID_PASSWORD):
         return L"ERROR_INVALID_PASSWORD";
         break;

      case  HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED):
         return L"ERROR_ACCESS_DENIED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_BUSY):
         return L"ERROR_DS_BUSY";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_UNAVAILABLE):
         return L"ERROR_DS_UNAVAILABLE";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_UNWILLING_TO_PERFORM):
         return L"ERROR_DS_UNWILLING_TO_PERFORM";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_LOOP_DETECT):
         return L"ERROR_DS_LOOP_DETECT";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_NAMING_VIOLATION):
         return L"ERROR_DS_NAMING_VIOLATION";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_OBJ_CLASS_VIOLATION):
         return L"ERROR_DS_OBJ_CLASS_VIOLATION";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_CANT_ON_NON_LEAF):
         return L"ERROR_DS_CANT_ON_NONLEAF";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_CANT_ON_RDN):
         return L"ERROR_DS_CANT_ON_RDN";
         break;

      case  HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS):
         return L"ERROR_ALREADY_EXISTS";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_CANT_MOD_OBJ_CLASS):
         return L"ERROR_DS_CANT_MOD_OBJ_CLASS";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_OBJECT_RESULTS_TOO_LARGE):
         return L"ERROR_DS_OBJECT_RESULTS_TOO_LARGE";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_AFFECTS_MULTIPLE_DSAS):
         return L"ERROR_DS_AFFECTS_MULTIPLE_DSAS";
         break;

      case  HRESULT_FROM_WIN32(ERROR_GEN_FAILURE):
         return L"(ERROR_GEN_FAILURE";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_SERVER_DOWN):
         return L"ERROR_DS_SERVER_DOWN";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_LOCAL_ERROR):
         return L"ERROR_DS_LOCAL_ERROR";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_ENCODING_ERROR):
         return L"ERROR_DS_ENCODING_ERROR";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_DECODING_ERROR):
         return L"(ERROR_DS_DECODING_ERROR";
         break;

      case  HRESULT_FROM_WIN32(ERROR_TIMEOUT):
         return L"(ERROR_TIMEOUT";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_AUTH_UNKNOWN):
         return L"ERROR_DS_AUTH_UNKNOWN";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_FILTER_UNKNOWN):
         return L"(ERROR_DS_FILTER_UNKNOWN";
         break;

      case  HRESULT_FROM_WIN32(ERROR_CANCELLED):
         return L"(ERROR_CANCELLED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_PARAM_ERROR):
         return L"ERROR_DS_PARAM_ERROR";
         break;

      case  HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY):
         return L"ERROR_NOT_ENOUGH_MEMORY";
         break;

      case  HRESULT_FROM_WIN32(ERROR_CONNECTION_REFUSED):
         return L"ERROR_CONNECTION_REFUSED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_NOT_SUPPORTED):
         return L"ERROR_DS_NOT_SUPPORTED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_NO_RESULTS_RETURNED):
         return L"ERROR_DS_NO_RESULTS_RETURNED";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_CONTROL_NOT_FOUND):
         return L"ERROR_DS_CONTROL_NOT_FOUND";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_CLIENT_LOOP):
         return L"(ERROR_DS_CLIENT_LOOP";
         break;

      case  HRESULT_FROM_WIN32(ERROR_DS_REFERRAL_LIMIT_EXCEEDED):
         return L"ERROR_DS_REFERRAL_LIMIT_EXCEEDED";
         break;

      case  E_FAIL:
         return L"E_FAIL";
         break;

      case  E_NOTIMPL:
         return L"E_NOIMPL";
         break;

      case  S_OK:
         return L"OK";
         break;

      case  0x800704b8:
      // we have an extended error
      {
         WCHAR szErrorBuff[ 1024 ];
         WCHAR szNameBuff[ 1024 ];
         DWORD dwError;

         ADsGetLastError( &dwError,
                          szErrorBuff,
                          1023,
                          szNameBuff,
                          1023 );

         int sizeNameBuff = wcslen(szNameBuff);

    if(sizeNameBuff<1024-3)
    {
          wcsncat( szNameBuff, L" : ",3);
    if(1023-sizeNameBuff-3 >=0) //-3 for previous wcsncat
          wcsncat( szNameBuff, szErrorBuff,1023-sizeNameBuff-3);
    }
         wcsncat( szwText,szNameBuff,127);

         return szwText;
      }

   }

    return szwText;
}

char* GetCharFromGUID ( GUID idtofind )

Definition at line 951 of file ADSIhelpers.cpp.

{
  int x =0;

  while(arIDs[x].pIDName && !AretheGUIDsEqual(arIDs[x].id ,idtofind))
    x++;

  return arIDs[x].pIDName ;
}

HRESULT GetIADsPropertyValueAsBSTR | ( | BSTR * | pbsRet,
 |  | IADsPropertyValue * | pAdsPV
 | ) |  |

Definition at line 99 of file ADSIhelpers.cpp.

{
  HRESULT hr = S_OK;

  long lAdsType;
  hr = pAdsPV->get_ADsType(&lAdsType);

  if (FAILED(hr))
    return hr;

  switch (lAdsType)
  {
    case ADSTYPE_INVALID :
    {
      *pbsRet = SysAllocString(L"<ADSTYPE_INVALID>");
    }
    break;

    case ADSTYPE_DN_STRING :
    {
      hr = pAdsPV->get_DNString(pbsRet);
    }
    break;
    case ADSTYPE_CASE_EXACT_STRING :
    {
      hr = pAdsPV->get_CaseExactString(pbsRet);
    }
    break;
    case ADSTYPE_CASE_IGNORE_STRING :
    {
      hr = pAdsPV->get_CaseIgnoreString(pbsRet);
    }
    break;
    case ADSTYPE_PRINTABLE_STRING :
    {
      hr = pAdsPV->get_PrintableString(pbsRet);
    }
    break;
    case ADSTYPE_NUMERIC_STRING :
    {
      hr = pAdsPV->get_NumericString(pbsRet);
    }
    break;
    case ADSTYPE_BOOLEAN :
    {
      long b;
      hr = pAdsPV->get_Boolean(&b);
      if (SUCCEEDED(hr))
      {
        if (b)
          *pbsRet = SysAllocString(L"<TRUE>");
        else
          *pbsRet = SysAllocString(L"<FALSE>");
      }
    }
    break;
    case ADSTYPE_INTEGER :
    {
      long lInt;
      hr = pAdsPV->get_Integer(&lInt);
      if (SUCCEEDED(hr))
      {
        WCHAR wOut[100];
        wsprintf(wOut,L"%d",lInt);
        *pbsRet = SysAllocString(wOut);
      }
    }
    break;
    case ADSTYPE_OCTET_STRING :
    {
      *pbsRet = SysAllocString(L"<ADSTYPE_LARGE_INTEGER>");
      //  hr = pAdsPV->get_OctetString(pbsRet);
    }
    break;
    case ADSTYPE_UTC_TIME :
    {
      DATE daUTCTime;
      WCHAR wDateOut[255];
      hr = pAdsPV->get_UTCTime(&daUTCTime);

      if (SUCCEEDED(hr))
      {
      /*  wsprintf(wDateout,L"%02d/%02d/%04d %02d:%02d:%02d",
          pValues->UTCTime.wMonth, pValues->UTCTime.wDay, pValues->UTCTime.wYear,
          pValues->UTCTime.wHour, pValues->UTCTime.wMinute, pValues->UTCTime.wSecond );
      */
        *pbsRet = SysAllocString(wDateOut);
      }
    }
    break;
    case ADSTYPE_LARGE_INTEGER :
    {
      *pbsRet = SysAllocString(L"<ADSTYPE_LARGE_INTEGER>");
    }
    break;
    case ADSTYPE_PROV_SPECIFIC :
    {
      *pbsRet = SysAllocString(L"<ADSTYPE_PROV_SPECIFIC>");
    }
    break;
    case ADSTYPE_OBJECT_CLASS :
    {
      *pbsRet = SysAllocString(L"<ADSTYPE_OBJECT_CLASS>");
    }
    break;
    case ADSTYPE_PATH :
    {
      *pbsRet = SysAllocString(L"<ADSTYPE_PATH>");
    }
    break;
    case ADSTYPE_NT_SECURITY_DESCRIPTOR :
    {
      *pbsRet = SysAllocString(L"<ADSTYPE_NT_SECURITY_DESCRIPTOR>");
    }
    break;

    default:
      *pbsRet = SysAllocString(L"<UNRECOGNIZED>");
    break;

  }
  return hr;
}

const char* GetVariantStyle ( VARTYPE vt )

Definition at line 63 of file ADSIhelpers.cpp.

{
  static char pRet[200];

  pRet[0] = NULL;

  if (vt == VT_EMPTY) strcat(pRet,"VT_EMPTY ");

  if (HAS_BIT_STYLE(vt, VT_BYREF)) strcat(pRet,"VT_BYREF ");
  if (HAS_BIT_STYLE(vt, VT_UI1)) strcat(pRet,"VT_UI1 ");
  if (HAS_BIT_STYLE(vt, VT_I2)) strcat(pRet,"VT_I2 ");
  if (HAS_BIT_STYLE(vt, VT_I4)) strcat(pRet,"VT_I4 ");
  if (HAS_BIT_STYLE(vt, VT_R4)) strcat(pRet,"VT_R4 ");
  if (HAS_BIT_STYLE(vt, VT_R8)) strcat(pRet,"VT_R8 ");
  if (HAS_BIT_STYLE(vt, VT_CY)) strcat(pRet,"VT_CY ");
  if (HAS_BIT_STYLE(vt, VT_BSTR)) strcat(pRet,"VT_BSTR ");
  if (HAS_BIT_STYLE(vt, VT_NULL)) strcat(pRet,"VT_NULL ");
  if (HAS_BIT_STYLE(vt, VT_ERROR)) strcat(pRet,"VT_ERROR ");
  if (HAS_BIT_STYLE(vt, VT_BOOL)) strcat(pRet,"VT_BOOL ");
  if (HAS_BIT_STYLE(vt, VT_DATE)) strcat(pRet,"VT_DATE ");
  if (HAS_BIT_STYLE(vt, VT_DISPATCH)) strcat(pRet,"VT_DISPATCH ");
  if (HAS_BIT_STYLE(vt, VT_VARIANT)) strcat(pRet,"VT_VARIANT ");
  if (HAS_BIT_STYLE(vt, VT_UNKNOWN)) strcat(pRet,"VT_UNKNOWN ");
  if (HAS_BIT_STYLE(vt, VT_ARRAY)) strcat(pRet,"VT_ARRAY ");

  return pRet;
}

const char* QueryAllInterfaces ( IUnknown * pUnk )

Definition at line 966 of file ADSIhelpers.cpp.

{

  int x = 0;
  int iLen = sizeof(arIDs)/sizeof(IIDLookUp);
  pQueryAllInterfacesOut[0] = NULL;
  IUnknown * pGetUnk = NULL;

  for (x = 0; x < iLen; x++)
  {
    if(SUCCEEDED(pUnk->QueryInterface(arIDs[x].id,(void **) &pGetUnk)))
    {
      if (arIDs[x].pIDName)
      {
        strcat (pQueryAllInterfacesOut,arIDs[x].pIDName );
        strcat (pQueryAllInterfacesOut,"\n ");
        pGetUnk->Release();
        pGetUnk = NULL;
      }
    }
  }
  return pQueryAllInterfacesOut;
}

Generated on Wed Nov 13 2024 16:53:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/activedir/guidbind/vc/main.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • activedir
  • guidbind
  • vc
Defines | Functions

main.cpp File Reference

#include <windows.h>
#include <winuser.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
#include <winldap.h>
#include <activeds.h>
#include "ADSIhelpers.h"
#include <assert.h>

Go to the source code of this file.

Defines

#define | _WIN32_DCOM
#define | INC_OLE2
#define | UNICODE 1

Functions

void | main ()

Define Documentation

#define _WIN32_DCOM

Definition at line 3 of file main.cpp.

#define INC_OLE2

Definition at line 1 of file main.cpp.

#define UNICODE 1

Definition at line 2 of file main.cpp.

Function Documentation

void main ( void )

Definition at line 19 of file main.cpp.

{
// Initialize COM
CoInitialize(0);

WCHAR pwszADsPathObject[1024];
WCHAR pwszBindByGuidStr[1024];
HRESULT hr;

IADs * pIADsObject = NULL;
IADs * pIADsObjectByGuid = NULL;

// Ask the user for a ADsPath to start
_putws(L"This code binds to a directory object by ADsPath, retrieves the GUID,\n"
       L" then rebinds by GUID. \n\nSpecify the ADsPath of the object to bind to :\n");
_getws(pwszADsPathObject);

if (pwszADsPathObject[0] == NULL)
    return;

wprintf(L"\nBinding to %s\n",pwszADsPathObject);

// Bind to initial object
hr = ADsGetObject( pwszADsPathObject,IID_IADs, (void **)& pIADsObject);
if (SUCCEEDED(hr))
{
    BSTR bsGuid = NULL;
    hr = pIADsObject->get_GUID(&bsGuid);

    if (SUCCEEDED(hr))
    {
        wprintf(L"\n The GUID for\n\n%s\n\nis\n\n%s\n",pwszADsPathObject,bsGuid);

        // Build a string for Binding to the object by GUID
        wsprintf(pwszBindByGuidStr,L"LDAP://<GUID=%s>",bsGuid);

        // Bind BACK to the Same object using the GUID
        hr = ADsGetObject( pwszBindByGuidStr,IID_IADs, (void **)& pIADsObjectByGuid);

        if (SUCCEEDED(hr))
        {
            wprintf(L"\nSuccessfully RE bound to\n\n%s\n\nUsing the path:\n\n%s\n", pwszADsPathObject,pwszBindByGuidStr);

            // Release bind by GUID Object
            pIADsObjectByGuid->Release();
            pIADsObjectByGuid = NULL;
        }

        SysFreeString(bsGuid);
    }

    pIADsObject->Release();
    pIADsObject = NULL;
}

if (FAILED(hr))
    _putws(L"Failed");
CoUninitialize();

}

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/activedir/OtherWKO/vc/otherwko.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • activedir
  • OtherWKO
  • vc
Defines | Functions

otherwko.cpp File Reference

#include <wchar.h>
#include <objbase.h>
#include <activeds.h>
#include <winldap.h>

Go to the source code of this file.

Defines

#define | _WIN32_WINNT 0x0500

Functions

HRESULT | AddValueToOtherWKOProperty (LPOLESTR szContainerDN, LPGUID pWKOGUID, LPOLESTR szWKOObjectDN)
HRESULT | GetWKOObject (LPOLESTR szBindableWKGUID, IADs **ppObject)
HRESULT | GUIDtoBindableString (LPGUID pGUID, LPOLESTR *ppGUIDString)
void | wmain (int argc, wchar_t *argv[])

Define Documentation

#define _WIN32_WINNT 0x0500

Definition at line 9 of file otherwko.cpp.

Function Documentation

HRESULT AddValueToOtherWKOProperty | ( | LPOLESTR | szContainerDN,
 |  | LPGUID | pWKOGUID,
 |  | LPOLESTR | szWKOObjectDN
 | ) |  |

Definition at line 172 of file otherwko.cpp.

{
HRESULT hr = E_FAIL;
LPOLESTR szGUIDString = new OLECHAR[MAX_PATH];
LPOLESTR szDNwithOctetString = new OLECHAR[MAX_PATH*2];
DWORD dwReturn;
//Connection handle
LDAP *hConnect = NULL;
//Specify NULL to bind to a DC in the current computer's domain.
//LDAP_PORT is the default port, 389
hConnect  = ldap_open(NULL,  LDAP_PORT);
//Bind using the preferred authentication method on Windows 2000
//and the logged on user's security context.
dwReturn = ldap_bind_s( hConnect, NULL, NULL, LDAP_AUTH_NEGOTIATE );
if (dwReturn==LDAP_SUCCESS)
{
  //Create the WKO value to add.
  GUIDtoBindableString (pWKOGUID, &szGUIDString);
  DWORD dwGUIDSize = sizeof(OLECHAR)*(wcslen(szGUIDString));
  //Build the DNwithoctetstring
  swprintf(szDNwithOctetString, L"B:%d:%s:%s", dwGUIDSize, szGUIDString,szWKOObjectDN);
  ULONG ulBerSize = sizeof(OLECHAR)*(wcslen(szDNwithOctetString));
  //Build the BerVal
  PCHAR pByteVal = (PCHAR)szDNwithOctetString;
  berval berWKO;
  berWKO.bv_len = ulBerSize;
  berWKO.bv_val = pByteVal;

  //Build the mod structure to add the value.
  LDAPMod ldWKO;
  //mod_values takes a NULL terminated array of WCHARs.
  //We're adding a single value.
  OLECHAR *berValues[] = { szDNwithOctetString, NULL };
  //Operation
  ldWKO.mod_op = LDAP_MOD_ADD|LDAP_MOD_BVALUES;
  //Attribute
  ldWKO.mod_type = L"otherWellKnownValues";
  //Value to set.
  ldWKO.mod_values = berValues;
  //mods is a NULL terminated array of LDAPMod structures.
  //We're adding a single value.
  LDAPMod *pMod[] = {&ldWKO,NULL};

  //Modify the object specified by szContainerDN.
  dwReturn = ldap_modify_s(  hConnect,
                           szContainerDN,
               pMod);
  if (dwReturn==LDAP_SUCCESS)
    hr = S_OK;
}
return hr;
}

HRESULT GetWKOObject | ( | LPOLESTR | szBindableWKGUID,
 |  | IADs ** | ppObject
 | ) |  |

Definition at line 264 of file otherwko.cpp.

{
HRESULT hr = E_FAIL;
//Get rootDSE and the domain container's DN.
IADs *pObject = NULL;
LPOLESTR szPath = new OLECHAR[MAX_PATH];
VARIANT var;
hr = ADsOpenObject(L"LDAP://rootDSE",
         NULL,
         NULL,
         ADS_SECURE_AUTHENTICATION, //Use Secure Authentication
         IID_IADs,
         (void**)&pObject);

//Get current domain DN.
if (SUCCEEDED(hr))
{
  hr = pObject->Get(L"defaultNamingContext",&var);
  if (SUCCEEDED(hr))
  {
    //Build the WKGUID binding string.
    wcscpy(szPath,L"LDAP://");
    wcscat(szPath,L"<WKGUID=");
    wcscat(szPath,szBindableWKGUID);
    wcscat(szPath,L",");
    wcscat(szPath,var.bstrVal);
    wcscat(szPath,L">");
    //Print the binding string.
    //wprintf(L"WKGUID binding string: %s\n",szPath);
    VariantClear(&var);
    //Bind to the well-known object.
    hr = ADsOpenObject(szPath,
             NULL,
             NULL,
             ADS_SECURE_AUTHENTICATION, //Use Secure Authentication
             IID_IADs,
             (void**)ppObject);
    if (FAILED(hr))
    {
      if (*ppObject)
      {
        (*ppObject)->Release();
        (*ppObject) = NULL;
      }
    }
  }
}
if (pObject)
  pObject->Release();

return hr;
}

HRESULT GUIDtoBindableString | ( | LPGUID | pGUID,
 |  | LPOLESTR * | ppGUIDString
 | ) |  |

Definition at line 232 of file otherwko.cpp.

{
HRESULT hr = E_FAIL;
if (!pGUID)
  return E_INVALIDARG;
//Build bindable GUID string
LPOLESTR szDSGUID = new WCHAR [128];
DWORD dwLen =  sizeof(*pGUID);
LPBYTE lpByte = (LPBYTE) pGUID;
//Copy a blank string to make it a zero length string.
wcscpy( szDSGUID, L"" );
//Loop through to add each byte to the string.
for( DWORD dwItem = 0L; dwItem < dwLen ; dwItem++ )
{
  //Append to szDSGUID, double-byte, byte at dwItem index.
  swprintf(szDSGUID + wcslen(szDSGUID), L"%02x", lpByte[dwItem]);
  if( wcslen( szDSGUID ) > 128 )
    break;
}
//Allocate memory for string
*ppGUIDString = (OLECHAR *)CoTaskMemAlloc (sizeof(OLECHAR)*(wcslen(szDSGUID)+1));
if (*ppGUIDString)
  wcscpy(*ppGUIDString, szDSGUID);
else
  hr=E_FAIL;
//Caller must free ppGUIDString using CoTaskMemFree.
return hr;
}

void wmain | ( | int | argc,
 |  | wchar_t * | argv[]
 | ) |  |

Definition at line 35 of file otherwko.cpp.

{

//Handle the command line arguments.
LPOLESTR pszBuffer = new OLECHAR[MAX_PATH*2];
  wprintf(L"This program does the following:\n");
  wprintf(L"1. Creates a container (MyWKOTestContainer) in the current Window 2000 domain.\n");
  wprintf(L"2. Creates a container object (MyWKOTestObject) within the container.\n");
  wprintf(L"3. Adds a value for the container object on the otherWellKnownObject property of the container.\n");
  wprintf(L"4. Binds to the container object using WKGUID binding string.\n");
  wprintf(L"5. Renames the container object using WKGUID binding string.\n");
  wprintf(L"6. Binds to the container object using WKGUID binding string.\n");
  wprintf(L"7. Optionally, cleans up by removing the container and leaf object.\n\n");

//Intialize COM
CoInitialize(NULL);

HRESULT hr = S_OK;
IADs *pObject = NULL;
IADsContainer *pDomain = NULL;
IDispatch *pDisp = NULL;
IDispatch *pDispNewContainerObject = NULL;
IADsContainer *pNewContainer = NULL;
IADs *pIADsObject = NULL;
IADs *pNewContainerObject = NULL;

LPOLESTR szNewContainerDN = new OLECHAR[MAX_PATH];
LPOLESTR szPath = new OLECHAR[MAX_PATH];
LPOLESTR szRelPath = new OLECHAR[MAX_PATH];

//Names of the container and child object.
LPOLESTR szContainer = L"MyWKOTestContainer";
LPOLESTR szNewContainerObject = L"MyWKOTestObject";

//Get rootDSE and the domain container's DN.
VARIANT var;
hr = ADsOpenObject(L"LDAP://rootDSE",
         NULL,
         NULL,
         ADS_SECURE_AUTHENTICATION, //Use Secure Authentication
         IID_IADs,
         (void**)&pObject);
if (FAILED(hr))
{
   wprintf(L"Not Found. Could not bind to the domain.\n");
   if (pObject)
     pObject->Release();
   return;
}

hr = pObject->Get(L"defaultNamingContext",&var);
if (SUCCEEDED(hr))
{
  //Build the ADsPath to the domain
  wcscpy(szPath,L"LDAP://");
  wcscat(szPath,var.bstrVal);
  VariantClear(&var);
  //Bind to the current domain.
  hr = ADsOpenObject(szPath,
           NULL,
           NULL,
           ADS_SECURE_AUTHENTICATION, //Use Secure Authentication
           IID_IADsContainer,
           (void**)&pDomain);
  if (SUCCEEDED(hr))
  {
    //Create the container.
    wcscpy(szRelPath,L"cn=");
    wcscat(szRelPath,szContainer);
    hr = pDomain->Create(L"container", //ldapDisplayName of the class of the object to create.
                       szRelPath, //relative path in RDN=value format
               &pDisp); //return an IDispatch pointer to the new object.
    if (SUCCEEDED(hr))
    {
    //QI for an IADsContainer interface.
    hr = pDisp->QueryInterface(IID_IADsContainer, (void **)&pNewContainer);
    if (SUCCEEDED(hr))
    {
      //Create the leaf object in the container.
      wcscpy(szRelPath,L"cn=");
        wcscat(szRelPath,szNewContainerObject);
        hr = pNewContainer->Create(L"leaf", //ldapDisplayName of the class of the object to create.
                   szRelPath, //relative path in RDN=value format
           &pDispNewContainerObject); //return an IDispatch pointer to the new object.
          //QI for an IADs interface.
        hr = pNewContainer->QueryInterface(IID_IADs, (void **)&pIADsObject);
      if (SUCCEEDED(hr))
      {
      //Get the DN of the new container object
      hr = pIADsObject->Get(L"distinguishedName", &var);
      if (SUCCEEDED(hr))
      {
        wcscpy(szNewContainerDN, var.bstrVal);
        VariantClear(&var);
        hr = NewContainerObject->QueryInterface(IID_IADs, (void **)&pNewContainerObject);
          if (SUCCEEDED(hr))
        {
          //Get the DN for the leaf object
          hr = pNewContainerObject->Get(L"distinguishedName", &var);
          if (SUCCEEDED(hr))
        {
          //FOR BETA 3 only. Need to use LDAP API to set the otherWellKnownObjects property.
                  hr = AddValueToOtherWKOProperty(szNewContainerDN, //DN for container whose otherWellKnownObjects property to modify
                   &MyWKOTestObjectGUID, //WKO GUID for the well-known object.
                   var.bstrVal //DN of the well-known object.
                   );
        }
        }
          if (pNewContainerObject)
          pNewContainerObject->Release();
      }
      VariantClear(&var);
      }
        if (pIADsObject)
        pIADsObject->Release();
        if (pDispNewContainerObject)
          pDispNewContainerObject->Release();
    }
      if (pNewContainer)
        pNewContainer->Release();
    }
    if (pDisp)
      pDisp->Release();
  }
    if (pDomain)
    pDomain->Release();
}
if (pObject)
   pObject->Release();

//Uninitalize COM
CoUninitialize();

  return;
}

Generated on Wed Nov 13 2024 16:53:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/activedir/OtherWKO/vc/otherwko1.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • activedir
  • OtherWKO
  • vc
Defines | Functions

otherwko1.cpp File Reference

#include <wchar.h>
#include <objbase.h>
#include <activeds.h>
#include <stdio.h>
#include <winldap.h>

Go to the source code of this file.

Defines

#define | _WIN32_WINNT 0x0500

Functions

HRESULT | AddValueToOtherWKOProperty (LPOLESTR szContainerDN, LPGUID pWKOGUID, LPOLESTR szWKOObjectDN)
HRESULT | GetWKOObject (LPOLESTR szBindableWKGUID, IADs **ppObject)
HRESULT | GUIDtoBindableString (LPGUID pGUID, LPOLESTR *ppGUIDString)
int | IS_BUFFER_ENOUGH (UINT maxAlloc, LPWSTR pszTarget, LPCWSTR pszSource, int toCopy=-1)
bool | SAFE_APPEND (int targetSize, LPWSTR szTarget, LPCWSTR szSource)
void | wmain (int argc, wchar_t *argv[])

Define Documentation

#define _WIN32_WINNT 0x0500

Definition at line 9 of file otherwko1.cpp.

Function Documentation

HRESULT AddValueToOtherWKOProperty | ( | LPOLESTR | szContainerDN,
 |  | LPGUID | pWKOGUID,
 |  | LPOLESTR | szWKOObjectDN
 | ) |  |

Definition at line 338 of file otherwko1.cpp.

{
HRESULT hr = E_FAIL;
LPOLESTR szGUIDString = new OLECHAR[MAX_PATH];
int      maxAlloc = MAX_PATH*2;
LPOLESTR szDNwithOctetString = new OLECHAR[MAX_PATH*2];
DWORD dwReturn;
//Connection handle
LDAP *hConnect = NULL;
//Specify NULL to bind to a DC in the current computer's domain.
//LDAP_PORT is the default port, 389
hConnect  = ldap_open(NULL,  LDAP_PORT);
//Bind using the preferred authentication method on Windows 2000
//and the logged on user's security context.
dwReturn = ldap_bind_s( hConnect, NULL, NULL, LDAP_AUTH_NEGOTIATE );
if (dwReturn==LDAP_SUCCESS)
{

  //Create the WKO value to add.
  GUIDtoBindableString (pWKOGUID, &szGUIDString);
  DWORD dwGUIDSize = (wcslen(szGUIDString));
  OLECHAR szLen[64];
  //Build the DNwithoctetstring

  wcscpy(szDNwithOctetString, L"B:");
  swprintf(szLen,L"%d", dwGUIDSize);
  SAFE_APPEND(maxAlloc, szDNwithOctetString,szLen);
  SAFE_APPEND(maxAlloc, szDNwithOctetString,L":");
  SAFE_APPEND(maxAlloc, szDNwithOctetString,szGUIDString);
  SAFE_APPEND(maxAlloc, szDNwithOctetString,L":");
  SAFE_APPEND(maxAlloc, szDNwithOctetString,szWKOObjectDN);

  //swprintf(szDNwithOctetString, L"B:%d:%s:%s", dwGUIDSize, szGUIDString,szWKOObjectDN);
//  ULONG ulBerSize = (wcslen(szDNwithOctetString));
  //Build the BerVal
//  PCHAR pByteVal = (PCHAR)szDNwithOctetString;
//  berval berWKO;
//  berWKO.bv_len = ulBerSize;
//  berWKO.bv_val = pByteVal;
  //Build the mod structure to add the value.
  LDAPMod ldWKO;
  //mod_values takes a NULL terminated array of WCHARs.
  //We're adding a single value.
  WCHAR *StrValues[] = {szDNwithOctetString , NULL };
  //Operation
  ldWKO.mod_op = LDAP_MOD_ADD;
  //Attribute
  ldWKO.mod_type = L"otherWellKnownObjects";
  //Value to set.
  ldWKO.mod_vals.modv_strvals = StrValues;
  //mods is a NULL terminated array of LDAPMod structures.
  //We're adding a single value.
  LDAPMod *pMod[] = {&ldWKO,NULL};

  //Modify the object specified by szContainerDN.
  dwReturn = ldap_modify_s(  hConnect,
                           szContainerDN,
               pMod);
  CoTaskMemFree(szGUIDString);

  if (dwReturn==LDAP_SUCCESS)
    hr = S_OK;
}
return hr;
}

HRESULT GetWKOObject | ( | LPOLESTR | szBindableWKGUID,
 |  | IADs ** | ppObject
 | ) |  |

Definition at line 444 of file otherwko1.cpp.

{
HRESULT hr = E_FAIL;
//Get rootDSE and the domain container's DN.
IADs *pObject = NULL;
LPOLESTR szPath = new OLECHAR[MAX_PATH];
VARIANT var;
hr = ADsOpenObject(L"LDAP://rootDSE",
         NULL,
         NULL,
         ADS_SECURE_AUTHENTICATION, //Use Secure Authentication
         IID_IADs,
         (void**)&pObject);

//Get current domain DN.
if (SUCCEEDED(hr))
{
  hr = pObject->Get(L"defaultNamingContext",&var);
  if (SUCCEEDED(hr))
  {
    //Build the WKGUID binding string.
    wcscpy(szPath,L"LDAP://");
    SAFE_APPEND(MAX_PATH, szPath,L"<WKGUID=");
    SAFE_APPEND(MAX_PATH, szPath,szBindableWKGUID);
    SAFE_APPEND(MAX_PATH, szPath,L",");
    SAFE_APPEND(MAX_PATH, szPath,var.bstrVal);
    SAFE_APPEND(MAX_PATH, szPath,L">");

    //Print the binding string.
    //wprintf(L"WKGUID binding string: %s\n",szPath);
    VariantClear(&var);
    //Bind to the well-known object.
    hr = ADsOpenObject(szPath,
             NULL,
             NULL,
             ADS_SECURE_AUTHENTICATION, //Use Secure Authentication
             IID_IADs,
             (void**)ppObject);
    if (FAILED(hr))
    {
      if (*ppObject)
      {
        (*ppObject)->Release();
        (*ppObject) = NULL;
      }
    }
  }
}
if (pObject)
  pObject->Release();

return hr;
}

HRESULT GUIDtoBindableString | ( | LPGUID | pGUID,
 |  | LPOLESTR * | ppGUIDString
 | ) |  |

Definition at line 412 of file otherwko1.cpp.

{
HRESULT hr = E_FAIL;
if (!pGUID)
  return E_INVALIDARG;
//Build bindable GUID string
LPOLESTR szDSGUID = new WCHAR [128];
DWORD dwLen =  sizeof(*pGUID);
LPBYTE lpByte = (LPBYTE) pGUID;
//Copy a blank string to make it a zero length string.
wcscpy( szDSGUID, L"" );
//Loop through to add each byte to the string.
for( DWORD dwItem = 0L; dwItem < dwLen ; dwItem++ )
{
  //Append to szDSGUID, double-byte, byte at dwItem index.
  swprintf(szDSGUID + wcslen(szDSGUID), L"%02x", lpByte[dwItem]);
  if( wcslen( szDSGUID ) > 128 )
    break;
}
//Allocate memory for string
*ppGUIDString = (OLECHAR *)CoTaskMemAlloc (sizeof(OLECHAR)*(wcslen(szDSGUID)+1));
if (*ppGUIDString)
  wcscpy(*ppGUIDString, szDSGUID);
else
  hr=E_FAIL;
//Caller must free ppGUIDString using CoTaskMemFree.
return hr;
}

int IS_BUFFER_ENOUGH | ( | UINT | maxAlloc,
 |  | LPWSTR | pszTarget,
 |  | LPCWSTR | pszSource,
 |  | int | toCopy = -1
 | ) |  |

Definition at line 503 of file otherwko1.cpp.

{

         if (toCopy == -1)

          {
               toCopy = wcslen(pszSource);
          }

      return maxAlloc - (wcslen(pszTarget) + toCopy + 1);
}

bool SAFE_APPEND | ( | int | targetSize,
 |  | LPWSTR | szTarget,
 |  | LPCWSTR | szSource
 | ) |  |

Definition at line 517 of file otherwko1.cpp.

{
  if ( IS_BUFFER_ENOUGH( targetSize, szTarget, szSource) > 0 )
  {
    wcscpy(szTarget, szSource);
    return true;
  }

  return false;
}

void wmain | ( | int | argc,
 |  | wchar_t * | argv[]
 | ) |  |

Definition at line 38 of file otherwko1.cpp.

{

int allocBuffer = MAX_PATH*2;
LPOLESTR pszBuffer = new OLECHAR[allocBuffer];
  wprintf(L"This program does the following:\n");
  wprintf(L"1. Creates a container (MyWKOTestContainer) in the current Window 2000 domain.\n");
  wprintf(L"2. Creates a container object (MyWKOTestObject) within the container.\n");
  wprintf(L"3. Adds a value for the container object on the otherWellKnownObject property of the container.\n");
  wprintf(L"4. Binds to the container object using WKGUID binding string.\n");
  wprintf(L"5. Renames the container object using WKGUID binding string.\n");
  wprintf(L"6. Binds to the container object using WKGUID binding string.\n");
  wprintf(L"7. Optionally, cleans up by removing the container and container object.\n\n");

//Intialize COM
CoInitialize(NULL);

HRESULT hr = S_OK;
IADs *pObject = NULL;
IADsContainer *pDomain = NULL;
IDispatch *pDisp = NULL;
IDispatch *pDispNewObject = NULL;
IADsContainer *pNewContainer = NULL;
IADs *pIADsObject = NULL;
IADs *pNewObject = NULL;
IADs *pTestWKO1 = NULL;
IADs *pTestWKO2 = NULL;
VARIANT vartest;
BSTR bstr;

LPOLESTR szNewContainerDN = new OLECHAR[MAX_PATH];
LPOLESTR szPath = new OLECHAR[MAX_PATH];
LPOLESTR szRelPath = new OLECHAR[MAX_PATH];
LPOLESTR szGUIDString = NULL;

//Names of the container and child object.
LPOLESTR szContainer = L"MyWKOTestContainer";
LPOLESTR szNewObject = L"MyWKOTestObject";

LPOLESTR szNewObjectRenameRDN = L"cn=ObjectwithNEWNAME";

//Get rootDSE and the domain container's DN.
VARIANT var;
hr = ADsOpenObject(L"LDAP://rootDSE",
         NULL,
         NULL,
         ADS_SECURE_AUTHENTICATION, //Use Secure Authentication
         IID_IADs,
         (void**)&pObject);
if (FAILED(hr))
{
   wprintf(L"Not Found. Could not bind to the domain.\n");
   if (pObject)
     pObject->Release();
   return;
}

hr = pObject->Get(L"defaultNamingContext",&var);
if (SUCCEEDED(hr))
{
  //Build the ADsPath to the domain
  wcscpy(szPath,L"LDAP://");
  if (!SAFE_APPEND(MAX_PATH, szPath, var.bstrVal) )
  {
    pObject->Release();
    VariantClear(&var);
    wprintf(L"Buffer is to small, operation is aborting...");
    return;
  }
  VariantClear(&var);
  //Bind to the current domain.
  hr = ADsOpenObject(szPath,
           NULL,
           NULL,
           ADS_SECURE_AUTHENTICATION, //Use Secure Authentication
           IID_IADsContainer,
           (void**)&pDomain);
  if (SUCCEEDED(hr))
  {
    //Create the container.
    wcscpy(szRelPath,L"cn=");

    // Check if there is enough buffer.
    if ( IS_BUFFER_ENOUGH(MAX_PATH, szRelPath, szContainer) > 0 )
    {
       wcscat(szRelPath,szContainer);
    }
    else
    {
      pObject->Release();
      pDomain->Release();
      wprintf(L"Buffer is to small, operation is aborting...");
      return;
    }

    hr = pDomain->Create(L"container", //ldapDisplayName of the class of the object to create.
                       szRelPath, //relative path in RDN=value format
               &pDisp); //return an IDispatch pointer to the new object.
    if (SUCCEEDED(hr))
    {
        //QI for an IADs interface.
      hr = pDisp->QueryInterface(IID_IADs, (void **)&pIADsObject);
    //Commit the new object to the directory.
    hr = pIADsObject->SetInfo();
    //QI for an IADsContainer interface.
    hr = pDisp->QueryInterface(IID_IADsContainer, (void **)&pNewContainer);
    if (SUCCEEDED(hr))
    {
      //Create the new container object in the container.
      wcscpy(szRelPath,L"cn=");

      // Check for potential buffer overrun
      if (!SAFE_APPEND(MAX_PATH, szRelPath, szNewObject) )
      {
          pObject->Release();
          pDomain->Release();
          pDisp->Release();
          VariantClear(&var);
          wprintf(L"Buffer is too small to hold the string");
          return;
      }

        hr = pNewContainer->Create(L"container", //ldapDisplayName of the class of the object to create.
                   szRelPath, //relative path in RDN=value format
           &pDispNewObject); //return an IDispatch pointer to the new object.
      if (SUCCEEDED(hr))
      {
      //Get the DN of the new container object
      hr = pIADsObject->Get(L"distinguishedName", &var);
      if (SUCCEEDED(hr))
      {
        if (!SAFE_APPEND(MAX_PATH, szNewContainerDN, var.bstrVal) )
        {
          pObject->Release();
          pDomain->Release();
          pDisp->Release();
          pIADsObject->Release();
          VariantClear(&var);
          wprintf(L"Buffer is too small to hold the string");
          return;
        }
        wcscpy(szNewContainerDN, var.bstrVal);
        VariantClear(&var);
        wprintf(L"Created new container with DN: %s\n",szNewContainerDN);
        hr = pDispNewObject->QueryInterface(IID_IADs, (void **)&pNewObject);
          if (SUCCEEDED(hr))
        {
            //Commit the new object to the directory.
            hr = pNewObject->SetInfo();
          //Get the DN for the new object
          hr = pNewObject->Get(L"distinguishedName", &var);
          if (SUCCEEDED(hr))
        {
            wprintf(L"Created new child object with DN: %s\n",var.bstrVal);
          //FOR BETA 3 only. Need to use LDAP API to set the otherWellKnownObjects property.
          wprintf(L"Call AddValueToOtherWKOProperty with:\n");
          wprintf(L"szContainer DN: %s\n",szNewContainerDN);
          GUIDtoBindableString (&MyWKOTestObjectGUID, &szGUIDString);
          wprintf(L"pWKOGUID (bindable string format): %s\n",szGUIDString);
          wprintf(L"szWKOObjectDN: %s\n",var.bstrVal);
                  hr = AddValueToOtherWKOProperty(szNewContainerDN, //DN for container whose otherWellKnownObjects property to modify
                   &MyWKOTestObjectGUID, //WKO GUID for the well-known object.
                   var.bstrVal //DN of the well-known object.
                   );
          wprintf(L"AddValueToOtherWKOProperty returned: %x\n",hr);
          if (SUCCEEDED(hr))
          {
            //Now bind using WKGUID binding
            //Build the ADsPath to the well-known object

                    wcscpy(szPath,L"LDAP://<WKGUID=");
            SAFE_APPEND(MAX_PATH, szPath,szGUIDString);
            SAFE_APPEND(MAX_PATH, szPath,L",");
            SAFE_APPEND(MAX_PATH, szPath,szNewContainerDN);
            SAFE_APPEND(MAX_PATH, szPath,L">");

              wprintf(L"Bind with the following WKGUID binding string: %s\n",szPath);
            hr = ADsOpenObject(szPath,
             NULL,
             NULL,
             ADS_SECURE_AUTHENTICATION, //Use Secure Authentication
             IID_IADs,
             (void**)&pTestWKO1);
            if (SUCCEEDED(hr))
            {
              hr = pTestWKO1->Get(L"distinguishedName",&vartest);
                if (SUCCEEDED(hr))
              {
                    wprintf(L"Successfully bound to object. DN: %s\n",vartest.bstrVal);
                VariantClear(&vartest);
              }
            }
            else
                  wprintf(L"Binding failed with hr: %x\n",hr);

            if (pTestWKO1)
              pTestWKO1->Release();
            //Bind again using the DN to get a regular ADsPath.
                    wcscpy(szPath,L"LDAP://");
            SAFE_APPEND(MAX_PATH, szPath,var.bstrVal);

            hr = ADsOpenObject(szPath,
             NULL,
             NULL,
             ADS_SECURE_AUTHENTICATION, //Use Secure Authentication
             IID_IADs,
             (void**)&pTestWKO1);
            hr = pTestWKO1->get_ADsPath(&bstr);
            //Rename the WKO object
            hr = pNewContainer->MoveHere(bstr,szNewObjectRenameRDN,NULL);
            FreeADsStr(bstr);
            if (pTestWKO1)
              pTestWKO1->Release();
            //Now AGAIN bind using WKGUID binding
            //Build the ADsPath to the well-known object
                    wcscpy(szPath,L"LDAP://<WKGUID=");
            SAFE_APPEND(MAX_PATH, szPath,szGUIDString);
            SAFE_APPEND(MAX_PATH, szPath,L",");
            SAFE_APPEND(MAX_PATH, szPath,szNewContainerDN);
            SAFE_APPEND(MAX_PATH, szPath,L">");

            wprintf(L"Bind AGAIN with the following WKGUID binding string: %s\n",szPath);
            hr = ADsOpenObject(szPath,
             NULL,
             NULL,
             ADS_SECURE_AUTHENTICATION, //Use Secure Authentication
             IID_IADs,
             (void**)&pTestWKO2);
            if (SUCCEEDED(hr))
            {
              hr = pTestWKO2->Get(L"distinguishedName",&vartest);
                if (SUCCEEDED(hr))
              {
                    wprintf(L"Successfully bound to object (Note the DN reflects the rename). DN: %s\n",vartest.bstrVal);
                VariantClear(&vartest);
              }
            }
            else
                  wprintf(L"Binding failed with hr: %x\n",hr);
          }
          CoTaskMemFree(szGUIDString);
        }
        }
          if (pNewObject)
          pNewObject->Release();
      }
      VariantClear(&var);
      }
        if (pIADsObject)
        pIADsObject->Release();
        if (pDispNewObject)
          pDispNewObject->Release();
    }

    //Ask user if they want us to delete the test containers.
    wprintf(L"Do you want to delete the test container and object (Y/N):");
    fgetws(pszBuffer,allocBuffer,stdin);

    if (0==wcsnicmp(L"Y", pszBuffer,1))
    {
      //Delete the object
      //Delete the container
      hr = pNewContainer->Delete(L"container",szNewObjectRenameRDN);
            if (SUCCEEDED(hr))
      {
        wprintf(L"Successfully deleted test object.\n");
        wcscpy(szRelPath,L"cn=");
        SAFE_APPEND(MAX_PATH, szRelPath,szContainer);

        //Delete the container
        hr = pDomain->Delete(L"container",szRelPath);
        if (SUCCEEDED(hr))
          wprintf(L"Successfully deleted test container and its contents.\n");
        else
          wprintf(L"Failed to delete test container and its contents. hr: %x\n",hr);
      }
      else
        wprintf(L"Failed to delete test container and its contents. hr: %x\n",hr);
    }

      if (pNewContainer)
        pNewContainer->Release();
    }
    if (pDisp)
      pDisp->Release();
  }
    if (pDomain)
    pDomain->Release();
}
if (pObject)
   pObject->Release();

//Uninitalize COM
CoUninitialize();

  return;
}

Generated on Wed Nov 13 2024 16:53:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/activedir/PropertyList/vc/ADSIhelpers.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • activedir
  • PropertyList
  • vc
Defines | Functions

ADSIhelpers.cpp File Reference

#include "ADSIhelpers.h"
#include <stdio.h>
#include <assert.h>
#include <iads.h>
#include <adshlp.h>
#include <adserr.h>
#include <wchar.h>
#include <objbase.h>
#include <activeds.h>
#include <sddl.h>

Go to the source code of this file.

Defines

#define | _WIN32_DCOM
#define | _WIN32_WINNT 0x0500
#define | INC_OLE2
#define | UNICODE 1

Functions

void | CheckHRESULT (HRESULT hr, const char *pszCause)
HRESULT | GetIADsPropertyValueAsBSTR (BSTR *pbsRet, IADsPropertyEntry *pAdsEntry, IADsPropertyValue *pAdsPV)
const char * | GetVariantStyle (VARTYPE vt)
void | PrintIADSObject (IADs *pIADs)

Define Documentation

#define _WIN32_DCOM

Definition at line 4 of file ADSIhelpers.cpp.

#define _WIN32_WINNT 0x0500

Definition at line 20 of file ADSIhelpers.cpp.

#define INC_OLE2

Definition at line 2 of file ADSIhelpers.cpp.

#define UNICODE 1

Definition at line 3 of file ADSIhelpers.cpp.

Function Documentation

void CheckHRESULT | ( | HRESULT | hr,
 |  | const char * | pszCause
 | ) |  |

Definition at line 71 of file ADSIhelpers.cpp.

{
    if (FAILED(hr))
    {
        char sz[1024];
        char szCaption[1024];
        strcpy(szCaption, pszCause);
        strcat(szCaption, " failed!");
        if (!FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, 0, hr, 0, sz, 1024, 0))
            strcpy(sz, "Unknown error");
        MessageBoxA(0, sz, szCaption, MB_SETFOREGROUND);
       // DebugBreak();
    }
}

HRESULT GetIADsPropertyValueAsBSTR | ( | BSTR * | pbsRet,
 |  | IADsPropertyEntry * | pAdsEntry,
 |  | IADsPropertyValue * | pAdsPV
 | ) |  |

Definition at line 127 of file ADSIhelpers.cpp.

{
  HRESULT hr = S_OK;

  long lAdsType;
  hr = pAdsPV->get_ADsType(&lAdsType);

  if (FAILED(hr))
    return hr;

  switch (lAdsType)
  {
    case ADSTYPE_INVALID :
    {
      *pbsRet = SysAllocString(L"<ADSTYPE_INVALID>");
    }
    break;

    case ADSTYPE_DN_STRING :
    {
      hr = pAdsPV->get_DNString(pbsRet);
    }
    break;
    case ADSTYPE_CASE_EXACT_STRING :
    {
      hr = pAdsPV->get_CaseExactString(pbsRet);
    }
    break;
    case ADSTYPE_CASE_IGNORE_STRING :
    {
      hr = pAdsPV->get_CaseIgnoreString(pbsRet);
    }
    break;
    case ADSTYPE_PRINTABLE_STRING :
    {
      hr = pAdsPV->get_PrintableString(pbsRet);
    }
    break;
    case ADSTYPE_NUMERIC_STRING :
    {
      hr = pAdsPV->get_NumericString(pbsRet);
    }
    break;
    case ADSTYPE_BOOLEAN :
    {
      long b;
      hr = pAdsPV->get_Boolean(&b);
      if (SUCCEEDED(hr))
      {
        if (b)
          *pbsRet = SysAllocString(L"<TRUE>");
        else
          *pbsRet = SysAllocString(L"<FALSE>");
      }
    }
    break;
    case ADSTYPE_INTEGER :
    {
      long lInt;
      hr = pAdsPV->get_Integer(&lInt);
      if (SUCCEEDED(hr))
      {
        WCHAR wOut[100];
        wsprintf(wOut,L"%d",lInt);
        *pbsRet = SysAllocString(wOut);
      }
    }
    break;
    case ADSTYPE_OCTET_STRING :
    {
      *pbsRet = SysAllocString(L"<ADSTYPE_OCTET_STRING>");
            BSTR bsName= NULL;
            VARIANT vOctet;
            DWORD dwSLBound;
            DWORD dwSUBound;
            void HUGEP *pArray;
            VariantInit(&vOctet);

        //Get the name of the property to handle
        //the properties we're interested in.
        pAdsEntry->get_Name(&bsName);
        hr = pAdsPV->get_OctetString(&vOctet);

                //Get a pointer to the bytes in the octet string.
        if (SUCCEEDED(hr))
        {
          hr = SafeArrayGetLBound( V_ARRAY(&vOctet),
                        1,
                        (long FAR *) &dwSLBound );
          hr = SafeArrayGetUBound( V_ARRAY(&vOctet),
                        1,
                        (long FAR *) &dwSUBound );
          if (SUCCEEDED(hr))
          {
            hr = SafeArrayAccessData( V_ARRAY(&vOctet),
                          &pArray );
          }
          /* Since an Octet String has a specific meaning
                       depending on the attribute name, handle two
                       common ones here
                    */
                    if (0==wcscmp(L"objectGUID", bsName))
          {
            LPOLESTR szDSGUID = new WCHAR [39];

            //Cast to LPGUID
            LPGUID pObjectGUID = (LPGUID)pArray;
            //Convert GUID to string.
                        ::StringFromGUID2(*pObjectGUID, szDSGUID, 39);
                        *pbsRet = SysAllocString(szDSGUID);

          }
          else if (0==wcscmp(L"objectSid", bsName))
          {
            PSID pObjectSID = (PSID)pArray;

            //Convert SID to string.
            LPOLESTR szSID = NULL;
            ConvertSidToStringSid(pObjectSID, &szSID);
                        *pbsRet = SysAllocString(szSID);
            LocalFree(szSID);
          }
          else
          {
            *pbsRet = SysAllocString(L"<Value of type Octet String. No Conversion>");

          }
            SafeArrayUnaccessData( V_ARRAY(&vOctet) );
            VariantClear(&vOctet);
        }

        SysFreeString(bsName);

    }
    break;
    case ADSTYPE_LARGE_INTEGER :
    {
      *pbsRet = SysAllocString(L"<ADSTYPE_LARGE_INTEGER>");
    }
    break;
    case ADSTYPE_PROV_SPECIFIC :
    {
      *pbsRet = SysAllocString(L"<ADSTYPE_PROV_SPECIFIC>");
    }
    break;
    case ADSTYPE_OBJECT_CLASS :
    {
      hr = pAdsPV->get_CaseIgnoreString(pbsRet);
    }
    break;
    case ADSTYPE_PATH :
    {
      hr = pAdsPV->get_CaseIgnoreString(pbsRet);
    }
    break;
    case ADSTYPE_NT_SECURITY_DESCRIPTOR :
    {
      *pbsRet = SysAllocString(L"<ADSTYPE_NT_SECURITY_DESCRIPTOR>");
    }
    break;

    default:
      *pbsRet = SysAllocString(L"<UNRECOGNIZED>");
    break;

  }
  return hr;
}

const char* GetVariantStyle ( VARTYPE vt )

Definition at line 89 of file ADSIhelpers.cpp.

{
  static char pRet[200];

  pRet[0] = NULL;

  if (vt == VT_EMPTY) strcat(pRet,"VT_EMPTY ");

  if (HAS_BIT_STYLE(vt, VT_BYREF)) strcat(pRet,"VT_BYREF ");
  if (HAS_BIT_STYLE(vt, VT_UI1)) strcat(pRet,"VT_UI1 ");
  if (HAS_BIT_STYLE(vt, VT_I2)) strcat(pRet,"VT_I2 ");
  if (HAS_BIT_STYLE(vt, VT_I4)) strcat(pRet,"VT_I4 ");
  if (HAS_BIT_STYLE(vt, VT_R4)) strcat(pRet,"VT_R4 ");
  if (HAS_BIT_STYLE(vt, VT_R8)) strcat(pRet,"VT_R8 ");
  if (HAS_BIT_STYLE(vt, VT_CY)) strcat(pRet,"VT_CY ");
  if (HAS_BIT_STYLE(vt, VT_BSTR)) strcat(pRet,"VT_BSTR ");
  if (HAS_BIT_STYLE(vt, VT_NULL)) strcat(pRet,"VT_NULL ");
  if (HAS_BIT_STYLE(vt, VT_ERROR)) strcat(pRet,"VT_ERROR ");
  if (HAS_BIT_STYLE(vt, VT_BOOL)) strcat(pRet,"VT_BOOL ");
  if (HAS_BIT_STYLE(vt, VT_DATE)) strcat(pRet,"VT_DATE ");
  if (HAS_BIT_STYLE(vt, VT_DISPATCH)) strcat(pRet,"VT_DISPATCH ");
  if (HAS_BIT_STYLE(vt, VT_VARIANT)) strcat(pRet,"VT_VARIANT ");
  if (HAS_BIT_STYLE(vt, VT_UNKNOWN)) strcat(pRet,"VT_UNKNOWN ");
  if (HAS_BIT_STYLE(vt, VT_ARRAY)) strcat(pRet,"VT_ARRAY ");

  return pRet;
}

void PrintIADSObject ( IADs * pIADs )

Definition at line 34 of file ADSIhelpers.cpp.

{
  assert(pIADs);

  BSTR bsResult;

  pIADs->get_Name(&bsResult);
  wprintf(L" NAME: %s\n",(LPOLESTR) bsResult);
  SysFreeString(bsResult);

  pIADs->get_Class(&bsResult);
  wprintf(L" CLASS: %s\n",(LPOLESTR) bsResult);
  SysFreeString(bsResult);

  pIADs->get_GUID(&bsResult);
  wprintf(L" GUID: %s\n",(LPOLESTR) bsResult);
  SysFreeString(bsResult);

  pIADs->get_ADsPath(&bsResult);
  wprintf(L" ADSPATH: %s\n",(LPOLESTR) bsResult);
  SysFreeString(bsResult);

  pIADs->get_Parent(&bsResult);
  wprintf(L" PARENT: %s\n",(LPOLESTR) bsResult);
  SysFreeString(bsResult);

  pIADs->get_Schema(&bsResult);
  wprintf(L" SCHEMA: %s\n",(LPOLESTR) bsResult);
  SysFreeString(bsResult);

}

Generated on Wed Nov 13 2024 16:53:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/activedir/PropertyList/vc/ADSIhelpers.h File Reference

  • NetDS
  • ADSI
  • samples
  • activedir
  • PropertyList
  • vc
Defines | Functions

ADSIhelpers.h File Reference

#include <activeds.h>
#include <adsiid.h>

Go to the source code of this file.

Defines

#define | HAS_BIT_STYLE(val, style) ((val & style) == style)

Functions

void | CheckHRESULT (HRESULT hr, const char *pszCause)
HRESULT | GetIADsPropertyValueAsBSTR (BSTR *pbsRet, IADsPropertyEntry *pAdsEntry, IADsPropertyValue *pAdsPV)
const char * | GetVariantStyle (VARTYPE vt)
void | PrintIADSObject (IADs *pIADs)

Define Documentation

#define HAS_BIT_STYLE | ( | val,
 |  | style |
 | ) |  | ((val & style) == style)

Definition at line 21 of file ADSIhelpers.h.

Function Documentation

void CheckHRESULT | ( | HRESULT | hr,
 |  | const char * | pszCause
 | ) |  |

Definition at line 45 of file ADSIhelpers.cpp.

{
    if (FAILED(hr))
    {
        char sz[1024];
        char szCaption[1024];
        strcpy(szCaption, pszCause);
        strcat(szCaption, " failed!");
        if (!FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, 0, hr, 0, sz, 1024, 0))
            strcpy(sz, "Unknown error");
        MessageBoxA(0, sz, szCaption, MB_SETFOREGROUND);
       // DebugBreak();
    }
}

HRESULT GetIADsPropertyValueAsBSTR | ( | BSTR * | pbsRet,
 |  | IADsPropertyEntry * | pAdsEntry,
 |  | IADsPropertyValue * | pAdsPV
 | ) |  |

Definition at line 127 of file ADSIhelpers.cpp.

{
  HRESULT hr = S_OK;

  long lAdsType;
  hr = pAdsPV->get_ADsType(&lAdsType);

  if (FAILED(hr))
    return hr;

  switch (lAdsType)
  {
    case ADSTYPE_INVALID :
    {
      *pbsRet = SysAllocString(L"<ADSTYPE_INVALID>");
    }
    break;

    case ADSTYPE_DN_STRING :
    {
      hr = pAdsPV->get_DNString(pbsRet);
    }
    break;
    case ADSTYPE_CASE_EXACT_STRING :
    {
      hr = pAdsPV->get_CaseExactString(pbsRet);
    }
    break;
    case ADSTYPE_CASE_IGNORE_STRING :
    {
      hr = pAdsPV->get_CaseIgnoreString(pbsRet);
    }
    break;
    case ADSTYPE_PRINTABLE_STRING :
    {
      hr = pAdsPV->get_PrintableString(pbsRet);
    }
    break;
    case ADSTYPE_NUMERIC_STRING :
    {
      hr = pAdsPV->get_NumericString(pbsRet);
    }
    break;
    case ADSTYPE_BOOLEAN :
    {
      long b;
      hr = pAdsPV->get_Boolean(&b);
      if (SUCCEEDED(hr))
      {
        if (b)
          *pbsRet = SysAllocString(L"<TRUE>");
        else
          *pbsRet = SysAllocString(L"<FALSE>");
      }
    }
    break;
    case ADSTYPE_INTEGER :
    {
      long lInt;
      hr = pAdsPV->get_Integer(&lInt);
      if (SUCCEEDED(hr))
      {
        WCHAR wOut[100];
        wsprintf(wOut,L"%d",lInt);
        *pbsRet = SysAllocString(wOut);
      }
    }
    break;
    case ADSTYPE_OCTET_STRING :
    {
      *pbsRet = SysAllocString(L"<ADSTYPE_OCTET_STRING>");
            BSTR bsName= NULL;
            VARIANT vOctet;
            DWORD dwSLBound;
            DWORD dwSUBound;
            void HUGEP *pArray;
            VariantInit(&vOctet);

        //Get the name of the property to handle
        //the properties we're interested in.
        pAdsEntry->get_Name(&bsName);
        hr = pAdsPV->get_OctetString(&vOctet);

                //Get a pointer to the bytes in the octet string.
        if (SUCCEEDED(hr))
        {
          hr = SafeArrayGetLBound( V_ARRAY(&vOctet),
                        1,
                        (long FAR *) &dwSLBound );
          hr = SafeArrayGetUBound( V_ARRAY(&vOctet),
                        1,
                        (long FAR *) &dwSUBound );
          if (SUCCEEDED(hr))
          {
            hr = SafeArrayAccessData( V_ARRAY(&vOctet),
                          &pArray );
          }
          /* Since an Octet String has a specific meaning
                       depending on the attribute name, handle two
                       common ones here
                    */
                    if (0==wcscmp(L"objectGUID", bsName))
          {
            LPOLESTR szDSGUID = new WCHAR [39];

            //Cast to LPGUID
            LPGUID pObjectGUID = (LPGUID)pArray;
            //Convert GUID to string.
                        ::StringFromGUID2(*pObjectGUID, szDSGUID, 39);
                        *pbsRet = SysAllocString(szDSGUID);

          }
          else if (0==wcscmp(L"objectSid", bsName))
          {
            PSID pObjectSID = (PSID)pArray;

            //Convert SID to string.
            LPOLESTR szSID = NULL;
            ConvertSidToStringSid(pObjectSID, &szSID);
                        *pbsRet = SysAllocString(szSID);
            LocalFree(szSID);
          }
          else
          {
            *pbsRet = SysAllocString(L"<Value of type Octet String. No Conversion>");

          }
            SafeArrayUnaccessData( V_ARRAY(&vOctet) );
            VariantClear(&vOctet);
        }

        SysFreeString(bsName);

    }
    break;
    case ADSTYPE_LARGE_INTEGER :
    {
      *pbsRet = SysAllocString(L"<ADSTYPE_LARGE_INTEGER>");
    }
    break;
    case ADSTYPE_PROV_SPECIFIC :
    {
      *pbsRet = SysAllocString(L"<ADSTYPE_PROV_SPECIFIC>");
    }
    break;
    case ADSTYPE_OBJECT_CLASS :
    {
      hr = pAdsPV->get_CaseIgnoreString(pbsRet);
    }
    break;
    case ADSTYPE_PATH :
    {
      hr = pAdsPV->get_CaseIgnoreString(pbsRet);
    }
    break;
    case ADSTYPE_NT_SECURITY_DESCRIPTOR :
    {
      *pbsRet = SysAllocString(L"<ADSTYPE_NT_SECURITY_DESCRIPTOR>");
    }
    break;

    default:
      *pbsRet = SysAllocString(L"<UNRECOGNIZED>");
    break;

  }
  return hr;
}

const char* GetVariantStyle ( VARTYPE vt )

Definition at line 63 of file ADSIhelpers.cpp.

{
  static char pRet[200];

  pRet[0] = NULL;

  if (vt == VT_EMPTY) strcat(pRet,"VT_EMPTY ");

  if (HAS_BIT_STYLE(vt, VT_BYREF)) strcat(pRet,"VT_BYREF ");
  if (HAS_BIT_STYLE(vt, VT_UI1)) strcat(pRet,"VT_UI1 ");
  if (HAS_BIT_STYLE(vt, VT_I2)) strcat(pRet,"VT_I2 ");
  if (HAS_BIT_STYLE(vt, VT_I4)) strcat(pRet,"VT_I4 ");
  if (HAS_BIT_STYLE(vt, VT_R4)) strcat(pRet,"VT_R4 ");
  if (HAS_BIT_STYLE(vt, VT_R8)) strcat(pRet,"VT_R8 ");
  if (HAS_BIT_STYLE(vt, VT_CY)) strcat(pRet,"VT_CY ");
  if (HAS_BIT_STYLE(vt, VT_BSTR)) strcat(pRet,"VT_BSTR ");
  if (HAS_BIT_STYLE(vt, VT_NULL)) strcat(pRet,"VT_NULL ");
  if (HAS_BIT_STYLE(vt, VT_ERROR)) strcat(pRet,"VT_ERROR ");
  if (HAS_BIT_STYLE(vt, VT_BOOL)) strcat(pRet,"VT_BOOL ");
  if (HAS_BIT_STYLE(vt, VT_DATE)) strcat(pRet,"VT_DATE ");
  if (HAS_BIT_STYLE(vt, VT_DISPATCH)) strcat(pRet,"VT_DISPATCH ");
  if (HAS_BIT_STYLE(vt, VT_VARIANT)) strcat(pRet,"VT_VARIANT ");
  if (HAS_BIT_STYLE(vt, VT_UNKNOWN)) strcat(pRet,"VT_UNKNOWN ");
  if (HAS_BIT_STYLE(vt, VT_ARRAY)) strcat(pRet,"VT_ARRAY ");

  return pRet;
}

void PrintIADSObject ( IADs * pIADs )

Definition at line 274 of file main.cpp.

{
  assert(pIADs);

  BSTR bsResult;
  HRESULT hr = S_OK;

  hr = pIADs->get_Name(&bsResult);
  if(FAILED(hr)) {wprintf(L" Failed to get name\n"); return;}
  wprintf(L" NAME: %s\n",(LPOLESTR) bsResult);
  SysFreeString(bsResult);

  hr = pIADs->get_Class(&bsResult);
  if(FAILED(hr)) {wprintf(L" Failed to get class\n"); return;}
  wprintf(L" CLASS: %s\n",(LPOLESTR) bsResult);
  SysFreeString(bsResult);

  hr = pIADs->get_GUID(&bsResult);
  if(FAILED(hr)) {wprintf(L" Failed to get GUID\n"); return;}
  wprintf(L" GUID: %s\n",(LPOLESTR) bsResult);
  SysFreeString(bsResult);

  hr = pIADs->get_ADsPath(&bsResult);
  if(FAILED(hr)) {wprintf(L" Failed to get ADsPath\n"); return;}
  wprintf(L" ADSPATH: %s\n",(LPOLESTR) bsResult);
  SysFreeString(bsResult);

  hr = pIADs->get_Parent(&bsResult);
  if(FAILED(hr)) {wprintf(L" Failed to get parent\n"); return;}
  wprintf(L" PARENT: %s\n",(LPOLESTR) bsResult);
  SysFreeString(bsResult);

  hr = pIADs->get_Schema(&bsResult);
  if(FAILED(hr)) {wprintf(L" Failed to get schema\n"); return;}
  wprintf(L" SCHEMA: %s\n",(LPOLESTR) bsResult);
  SysFreeString(bsResult);

}

Generated on Wed Nov 13 2024 16:53:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/activedir/PropertyList/vc/main.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • activedir
  • PropertyList
  • vc
Defines | Functions

main.cpp File Reference

#include <windows.h>
#include <winuser.h>
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <winldap.h>
#include <adsiid.h>
#include <string.h>
#include <activeds.h>
#include "ADSIhelpers.h"

Go to the source code of this file.

Defines

#define | _WIN32_DCOM
#define | INC_OLE2
#define | UNICODE 1

Functions

int | IS_BUFFER_ENOUGH (UINT maxAlloc, LPWSTR pszTarget, LPCWSTR pszSource, int toCopy=-1)
void | main ()

Define Documentation

#define _WIN32_DCOM

Definition at line 29 of file main.cpp.

#define INC_OLE2

Definition at line 27 of file main.cpp.

#define UNICODE 1

Definition at line 28 of file main.cpp.

Function Documentation

int IS_BUFFER_ENOUGH | ( | UINT | maxAlloc,
 |  | LPWSTR | pszTarget,
 |  | LPCWSTR | pszSource,
 |  | int | toCopy = -1
 | ) |  |

Definition at line 250 of file main.cpp.

{
         if (toCopy == -1)

          {
               toCopy = wcslen(pszSource);
          }

      return maxAlloc - (wcslen(pszTarget) + toCopy + 1);
}

void main ( void )

Definition at line 46 of file main.cpp.

{
    // COM result variable
  HRESULT hr;

  // Interface Pointers
  IDirectorySearch    *   pDSSearch=NULL;
  IADs              *   pIADs = NULL;
  IADsPropertyList    *   pIADpl = NULL;
  VARIANT                 vRet;
  LONG                    lCount;
    IADs                *   pIADsrootDSE = NULL;
    BSTR                    bsNamingContext;
    VARIANT                 vResult;
    WCHAR                   wszActualLDAPPath[MAX_PATH];

  VariantInit(&vRet);

  // Initialize COM
  CoInitialize(0);

  // Bind Through RootDSE
    _putws(L"Binding to a server using LDAP://rootDSE");

    hr = ADsGetObject(  L"LDAP://rootDSE", IID_IADs,(void **)&pIADsrootDSE);

  if (FAILED(hr))
    return;

     // Get the defaultNamingContext attribute and for binding
    // to the actual DC
    bsNamingContext = SysAllocString(L"defaultNamingContext");
    VariantInit(&vResult);

    // Get the defaultNamingContext Attribute
    hr = pIADsrootDSE->Get(bsNamingContext,&vResult);

    if (SUCCEEDED(hr))
    {
            // Make sure it's a BSTR
            hr = VariantChangeType(&vResult,&vResult,NULL,VT_BSTR);

            if (SUCCEEDED(hr))
            {
                // Build a binding string
        wcscpy(wszActualLDAPPath, L"LDAP://");
        if ( IS_BUFFER_ENOUGH(MAX_PATH, wszActualLDAPPath, vResult.bstrVal) > 0 )
        {
                   wcscat(wszActualLDAPPath,vResult.bstrVal );
           wprintf(L"\nBinding to the path %s\n",wszActualLDAPPath);
        }
        else
        {
          pIADsrootDSE->Release();
          wprintf(L"Buffer is too small to hold the domain DN");
        }

                // Bind to the actual server
                hr = ADsGetObject(  wszActualLDAPPath, IID_IADs,(void **)&pIADs);
            }
            VariantClear(&vResult);
    }
    SysFreeString(bsNamingContext);

    // Relase the RootDse binding...
    pIADsrootDSE->Release();
    pIADsrootDSE = NULL;

  if (FAILED(hr))
    return;

    wprintf(L"\n\nSuccessfully bound to %s\n",wszActualLDAPPath);

    // Print some general info about the object we are bound to
    PrintIADSObject(pIADs);

  if (FAILED(hr))
    return;

    wprintf(L"\n\nEnumerating this object's properties using the IADsPropertyList interface\n\n");

  //Call GetInfo to load all the properties. Call GetInfoEx to load only specific ones.
  hr = pIADs->GetInfo();

  if (FAILED(hr))
    return;

  //QueryInterface() for IADsPropertyList ptr.
  hr = pIADs->QueryInterface( IID_IADsPropertyList,(void **)&pIADpl);

  if (FAILED(hr))
    return;

  // Retrieve a COUNT of all the properties in the propertylist
  hr = pIADpl->get_PropertyCount(  &lCount  );

  // Output the property count obtained from the IADsPropertyList interface
  printf("\n The Object has %d properties\n",lCount);

  // Move to the FIRST property in the list
  hr = pIADpl->Next(&vRet);
  CheckHRESULT(hr,"pIADpl->Next(&vRet);");

  for (long lElement = 0; lElement < lCount; lElement++)
  {

    IDispatch * pDisp = V_DISPATCH(&vRet);
    IADsPropertyEntry * pAdsEntry = NULL;

    // QueryInterface for a IADsPropertyEntry interace on the current property
    hr = pDisp->QueryInterface(IID_IADsPropertyEntry,(void**) &pAdsEntry);

    if (SUCCEEDED(hr))
    {
      BSTR  bsName ;
      VARIANT vValue;
      VariantInit(&vValue);

      // Get the NAME of the current property
      hr = pAdsEntry->get_Name( &bsName);

      if (SUCCEEDED(hr))
      {
        wprintf(L"\n NAME:%s \t\n",(LPOLESTR)bsName);
        SysFreeString(bsName);
      }

      // Get the values
            hr = pAdsEntry->get_Values(&vValue);

      puts("The Values Variant style is :");
      puts(GetVariantStyle(vValue.vt));

      if (SUCCEEDED(hr))
      {
        // We should now have a VARAIANT ARRAY of IDispath *'s
                // So, read the safe array, enumeraing each IDispatch *
                // The IDispatch * is then QI'd for the IADsPropertyValue
                // interface. This interface provides the property information
        if (HAS_BIT_STYLE(vValue.vt,VT_ARRAY))
        {
          LONG dwSLBound = 0;
          LONG dwSUBound = 0;
          LONG i;

          hr = SafeArrayGetLBound(V_ARRAY(&vValue),1,(long FAR *)&dwSLBound);

          hr = SafeArrayGetUBound(V_ARRAY(&vValue),1,(long FAR *)&dwSUBound);

          for (i = dwSLBound; i <= dwSUBound; i++)
          {
            VARIANT v;
            VariantInit(&v);
            hr = SafeArrayGetElement(V_ARRAY(&vValue),(long FAR *)&i,&v);

            if (SUCCEEDED(hr))
            {
              if (HAS_BIT_STYLE(v.vt,VT_DISPATCH))
              {
                IDispatch * pDispEntry = V_DISPATCH(&v);
                IADsPropertyValue * pAdsPV = NULL;

                hr = pDispEntry->QueryInterface(IID_IADsPropertyValue,(void **) &pAdsPV);

                if (SUCCEEDED(hr))
                {
                  BSTR bValue;

                  // Get the value as a BSTR
                                    hr = GetIADsPropertyValueAsBSTR(&bValue,pAdsEntry,pAdsPV);

                  if (SUCCEEDED(hr))
                  {
                    wprintf(L"<%s>\n",(LPOLESTR)bValue);
                    SysFreeString(bValue);
                  }
                  pAdsPV->Release();
                  pAdsPV =NULL;
                }
              }
              else
                puts("!!NO DISPATCH ENTRY!!");

              VariantClear(&v);
            }
          }
          VariantClear(&vValue);
        }
        else
          wprintf(L" NAME:%s \t",(LPOLESTR)V_BSTR(&vValue));

      }
      pAdsEntry->Release();
      pAdsEntry = NULL;
    }
    hr = pIADpl->Next(&vRet);
  }

  CoUninitialize();

}

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/activedir/QueryUsers/vc/queryusers.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • activedir
  • QueryUsers
  • vc
Defines | Functions

queryusers.cpp File Reference

#include <objbase.h>
#include <wchar.h>
#include <activeds.h>
#include <sddl.h>

Go to the source code of this file.

Defines

#define | _WIN32_WINNT 0x0500

Functions

HRESULT | FindUsers (IDirectorySearch *pContainerToSearch, LPOLESTR szFilter, LPOLESTR *pszPropertiesToReturn, BOOL bIsVerbose)
int | IS_BUFFER_ENOUGH (UINT maxAlloc, LPWSTR pszTarget, LPCWSTR pszSource, int toCopy=-1)
void | wmain (int argc, wchar_t *argv[])

Define Documentation

#define _WIN32_WINNT 0x0500

Definition at line 8 of file queryusers.cpp.

Function Documentation

HRESULT FindUsers | ( | IDirectorySearch * | pContainerToSearch,
 |  | LPOLESTR | szFilter,
 |  | LPOLESTR * | pszPropertiesToReturn,
 |  | BOOL | bIsVerbose
 | ) |  |

Definition at line 155 of file queryusers.cpp.

{
  if (!pContainerToSearch)
    return E_POINTER;
    //Create search filter
  LPOLESTR pszSearchFilter = new OLECHAR[MAX_PATH*2];
  wchar_t szFormat[] = L"(&(objectClass=user)(objectCategory=person)%s)";

  // Check the buffer first
   if ( IS_BUFFER_ENOUGH(MAX_PATH*2, szFormat, szFilter) > 0 )
   {
     //Add the filter.
          wsprintf(pszSearchFilter, szFormat,szFilter);
   }
   else
   {
     wprintf(L"The filter is too large for buffer, aborting...");
         return FALSE;
   }

    //Specify subtree search
  ADS_SEARCHPREF_INFO SearchPrefs;
  SearchPrefs.dwSearchPref = ADS_SEARCHPREF_SEARCH_SCOPE;
  SearchPrefs.vValue.dwType = ADSTYPE_INTEGER;
  SearchPrefs.vValue.Integer = ADS_SCOPE_SUBTREE;
    DWORD dwNumPrefs = 1;

  // COL for iterations
  LPOLESTR pszColumn = NULL;
  ADS_SEARCH_COLUMN col;
    HRESULT hr;

    // Interface Pointers
    IADs    *pObj = NULL;
    IADs  * pIADs = NULL;

    // Handle used for searching
    ADS_SEARCH_HANDLE hSearch = NULL;

  // Set the search preference
    hr = pContainerToSearch->SetSearchPreference( &SearchPrefs, dwNumPrefs);
    if (FAILED(hr))
        return hr;

  LPOLESTR pszBool = NULL;
  DWORD dwBool;
  PSID pObjectSID = NULL;
  LPOLESTR szSID = NULL;
  LPOLESTR szDSGUID = new WCHAR [39];
  LPGUID pObjectGUID = NULL;
  FILETIME filetime;
  SYSTEMTIME systemtime;
  DATE date;
  VARIANT varDate;
  LARGE_INTEGER liValue;
  LPOLESTR *pszPropertyList = NULL;
  LPOLESTR pszNonVerboseList[] = {L"name",L"distinguishedName"};

  LPOLESTR szName = new OLECHAR[MAX_PATH];
  LPOLESTR szDN = new OLECHAR[MAX_PATH];

  int iCount = 0;
  DWORD x = 0L;

  if (!bIsVerbose)
  {
     //Return non-verbose list properties only
         hr = pContainerToSearch->ExecuteSearch(pszSearchFilter,
                              pszNonVerboseList,
                  sizeof(pszNonVerboseList)/sizeof(LPOLESTR),
                  &hSearch
                  );
  }
  else
  {
    if (!pszPropertiesToReturn)
    {
      //Return all properties.
      hr = pContainerToSearch->ExecuteSearch(pszSearchFilter,
                              NULL,
                  0L,
                  &hSearch
                  );
    }
    else
    {
      //specified subset.
        pszPropertyList = pszPropertiesToReturn;
       //Return specified properties
       hr = pContainerToSearch->ExecuteSearch(pszSearchFilter,
                              pszPropertyList,
                  sizeof(pszPropertyList)/sizeof(LPOLESTR),
                  &hSearch
                  );
    }
  }
  if ( SUCCEEDED(hr) )
  {
    // Call IDirectorySearch::GetNextRow() to retrieve the next row
    //of data
    hr = pContainerToSearch->GetFirstRow( hSearch);
    if (SUCCEEDED(hr))
    {
        while( hr != S_ADS_NOMORE_ROWS )
    {
      //Keep track of count.
      iCount++;
      if (bIsVerbose)
        wprintf(L"----------------------------------\n");
            // loop through the array of passed column names,
            // print the data for each column

      while( pContainerToSearch->GetNextColumnName( hSearch, &pszColumn ) != S_ADS_NOMORE_COLUMNS )
            {
                hr = pContainerToSearch->GetColumn( hSearch, pszColumn, &col );
          if ( SUCCEEDED(hr) )
          {
                // Print the data for the column and free the column
          if(bIsVerbose)
          {
              // Get the data for this column
            wprintf(L"%s\n",col.pszAttrName);
          switch (col.dwADsType)
          {
            case ADSTYPE_DN_STRING:
                          for (x = 0; x< col.dwNumValues; x++)
              {
                wprintf(L"  %s\r\n",col.pADsValues[x].DNString);
              }
              break;
            case ADSTYPE_CASE_EXACT_STRING:
            case ADSTYPE_CASE_IGNORE_STRING:
            case ADSTYPE_PRINTABLE_STRING:
            case ADSTYPE_NUMERIC_STRING:
            case ADSTYPE_TYPEDNAME:
            case ADSTYPE_FAXNUMBER:
            case ADSTYPE_PATH:
            case ADSTYPE_OBJECT_CLASS:
              for (x = 0; x< col.dwNumValues; x++)
              {
                wprintf(L"  %s\r\n",col.pADsValues[x].CaseIgnoreString);
              }
              break;
            case ADSTYPE_BOOLEAN:
              for (x = 0; x< col.dwNumValues; x++)
              {
                dwBool = col.pADsValues[x].Boolean;
                pszBool = dwBool ? L"TRUE" : L"FALSE";
                wprintf(L"  %s\r\n",pszBool);
              }
              break;
            case ADSTYPE_INTEGER:
                for (x = 0; x< col.dwNumValues; x++)
              {
                wprintf(L"  %d\r\n",col.pADsValues[x].Integer);
              }
              break;
            case ADSTYPE_OCTET_STRING:
                if ( _wcsicmp(col.pszAttrName,L"objectSID") == 0 )
              {
                  for (x = 0; x< col.dwNumValues; x++)
                {
                  pObjectSID = (PSID)(col.pADsValues[x].OctetString.lpValue);
                  //Convert SID to string.
                  ConvertSidToStringSid(pObjectSID, &szSID);
                  wprintf(L"  %s\r\n",szSID);
                  LocalFree(szSID);
                }
              }
                else if ( (_wcsicmp(col.pszAttrName,L"objectGUID") == 0) )
              {
                  for (x = 0; x< col.dwNumValues; x++)
                {
                //Cast to LPGUID
                pObjectGUID = (LPGUID)(col.pADsValues[x].OctetString.lpValue);
                //Convert GUID to string.
                                ::StringFromGUID2(*pObjectGUID, szDSGUID, 39);
                //Print the GUID
                wprintf(L"  %s\r\n",szDSGUID);
                }
              }
              else
                wprintf(L"  Value of type Octet String. No Conversion.");
                break;
            case ADSTYPE_UTC_TIME:
              for (x = 0; x< col.dwNumValues; x++)
              {
              systemtime = col.pADsValues[x].UTCTime;
              if (SystemTimeToVariantTime(&systemtime,
                            &date) != 0)
              {
                //Pack in variant.vt
                varDate.vt = VT_DATE;
                varDate.date = date;
                VariantChangeType(&varDate,&varDate,VARIANT_NOVALUEPROP,VT_BSTR);
                  wprintf(L"  %s\r\n",varDate.bstrVal);
                VariantClear(&varDate);
              }
              else
                wprintf(L"  Could not convert UTC-Time.\n",pszColumn);
              }
              break;
            case ADSTYPE_LARGE_INTEGER:
              for (x = 0; x< col.dwNumValues; x++)
              {
                liValue = col.pADsValues[x].LargeInteger;
              filetime.dwLowDateTime = liValue.LowPart;
              filetime.dwHighDateTime = liValue.HighPart;
              if((filetime.dwHighDateTime==0) && (filetime.dwLowDateTime==0))
              {
                wprintf(L"  No value set.\n");
              }
              else
              {
                //Check for properties of type LargeInteger that represent time
                //if TRUE, then convert to variant time.
                if ((0==wcscmp(L"accountExpires", col.pszAttrName))|
                  (0==wcscmp(L"badPasswordTime", col.pszAttrName))||
                  (0==wcscmp(L"lastLogon", col.pszAttrName))||
                  (0==wcscmp(L"lastLogoff", col.pszAttrName))||
                  (0==wcscmp(L"lockoutTime", col.pszAttrName))||
                  (0==wcscmp(L"pwdLastSet", col.pszAttrName))
                   )
                {
                  //Handle special case for Never Expires where low part is -1
                  if (filetime.dwLowDateTime==-1)
                  {
                    wprintf(L"  Never Expires.\n");
                  }
                  else
                  {
                    if (FileTimeToLocalFileTime(&filetime, &filetime) != 0)
                    {
                      if (FileTimeToSystemTime(&filetime,
                                 &systemtime) != 0)
                      {
                        if (SystemTimeToVariantTime(&systemtime,
                                      &date) != 0)
                        {
                          //Pack in variant.vt
                          varDate.vt = VT_DATE;
                          varDate.date = date;
                          VariantChangeType(&varDate,&varDate,VARIANT_NOVALUEPROP,VT_BSTR);
                          wprintf(L"  %s\r\n",varDate.bstrVal);
                          VariantClear(&varDate);
                        }
                        else
                        {
                          wprintf(L"  FileTimeToVariantTime failed\n");
                        }
                      }
                      else
                      {
                        wprintf(L"  FileTimeToSystemTime failed\n");
                      }

                    }
                    else
                    {
                      wprintf(L"  FileTimeToLocalFileTime failed\n");
                    }
                  }
                }
                else
                {
                  //Print the LargeInteger.
                  wprintf(L"  high: %d low: %d\r\n",filetime.dwHighDateTime, filetime.dwLowDateTime);
                }
              }
              }
              break;
            case ADSTYPE_NT_SECURITY_DESCRIPTOR:
              for (x = 0; x< col.dwNumValues; x++)
              {
                wprintf(L"  Security descriptor.\n");
              }
              break;
            default:
                  wprintf(L"Unknown type %d.\n",col.dwADsType);
          }
          }
            else
          {
          //Verbose handles only the two single-valued attributes: cn and ldapdisplayname
          //so this is a special case.

          if (0==wcscmp(L"name", pszColumn))
          {
            szName[0]=L'\0';
            if( IS_BUFFER_ENOUGH(MAX_PATH, szName, col.pADsValues->CaseIgnoreString) > 0 )
            {
                 wcscpy(szName,col.pADsValues->CaseIgnoreString);
            }
          }
          if (0==wcscmp(L"distinguishedName", pszColumn))
          {
            szDN[0]=L'\0';
            if( IS_BUFFER_ENOUGH(MAX_PATH, szDN, col.pADsValues->CaseIgnoreString) > 0 )
            {
                 wcscpy(szDN,col.pADsValues->CaseIgnoreString);
            }
          }
          }
            pContainerToSearch->FreeColumn( &col );
          }
        FreeADsMem( pszColumn );
            }
       if (!bIsVerbose)
         wprintf(L"%s\n  DN: %s\n\n",szName,szDN);
       //Get the next row
       hr = pContainerToSearch->GetNextRow( hSearch);
    }

    }
    // Close the search handle to clean up
      pContainerToSearch->CloseSearchHandle(hSearch);
  }
  if (SUCCEEDED(hr) && 0==iCount)
    hr = S_FALSE;

    return hr;
}

int IS_BUFFER_ENOUGH | ( | UINT | maxAlloc,
 |  | LPWSTR | pszTarget,
 |  | LPCWSTR | pszSource,
 |  | int | toCopy = -1
 | ) |  |

Definition at line 493 of file queryusers.cpp.

{
         if (toCopy == -1)

          {
               toCopy = wcslen(pszSource);
          }

      return maxAlloc - (wcslen(pszTarget) + toCopy + 1);
}

void wmain | ( | int | argc,
 |  | wchar_t * | argv[]
 | ) |  |

Definition at line 25 of file queryusers.cpp.

{

//Handle the command line arguments.
int maxAlloc = MAX_PATH*2;
LPOLESTR pszBuffer = new OLECHAR[maxAlloc];
wcscpy(pszBuffer, L"");
BOOL bReturnVerbose = FALSE;

for (int i = 1;i<argc;i++)
{
    if (_wcsicmp(argv[i],L"/V") == 0)
  {
    bReturnVerbose = TRUE;
  }
  else if ((_wcsicmp(argv[i],L"/?") == 0)||
             (_wcsicmp(argv[i],L"-?") == 0))
  {
    wprintf(L"This program queries for users in the current user's domain.\n");
    wprintf(L"Syntax: queryusers [/V][querystring]\n");
    wprintf(L"where /V specifies that all properties for the found users should be returned.\n");
    wprintf(L"      querystring is the query criteria in ldap query format.\n");
    wprintf(L"Defaults: If no /V is specified, the query returns only the RDN and DN of the items found.\n");
    wprintf(L"          If no querystring is specified, the query returns all users.\n");
    wprintf(L"Example: queryusers (sn=Smith)\n");
    wprintf(L"Returns all users with surname Smith.\n");
    return;
  }
  else
  {
    if ( IS_BUFFER_ENOUGH(maxAlloc, pszBuffer, argv[i]) > 0 )
    {
        wcscpy(pszBuffer,argv[i]);
    }
    else
    {
      wprintf(L"Buffer is too small for the argument");
      return;
    }
  }
}
if (_wcsicmp(pszBuffer,L"") == 0)
  wprintf(L"\nFinding all user objects...\n\n");
else
  wprintf(L"\nFinding user objects based on query: %s...\n\n", pszBuffer);

//Initialize COM
CoInitialize(NULL);
HRESULT hr = S_OK;
//Get rootDSE and the current user's domain container DN.
IADs *pObject = NULL;
IDirectorySearch *pContainerToSearch = NULL;
LPOLESTR szPath = new OLECHAR[MAX_PATH];
VARIANT var;
hr = ADsOpenObject(L"LDAP://rootDSE",
         NULL,
         NULL,
         ADS_SECURE_AUTHENTICATION, //Use Secure Authentication
         IID_IADs,
         (void**)&pObject);
if (FAILED(hr))
{
   wprintf(L"Could not execute query. Could not bind to LDAP://rootDSE.\n");
   if (pObject)
     pObject->Release();
   return;
}
if (SUCCEEDED(hr))
{
  hr = pObject->Get(L"defaultNamingContext",&var);
  if (SUCCEEDED(hr))
  {
    //Build path to the domain container.
        wcscpy(szPath,L"LDAP://");
    if ( IS_BUFFER_ENOUGH(MAX_PATH, szPath, var.bstrVal) > 0 )
    {
        wcscat(szPath,var.bstrVal);
    }
    else
    {
      wprintf(L"Buffer is too small for the domain DN");
      return;
    }

        hr = ADsOpenObject(szPath,
             NULL,
             NULL,
             ADS_SECURE_AUTHENTICATION, //Use Secure Authentication
             IID_IDirectorySearch,
             (void**)&pContainerToSearch);

    if (SUCCEEDED(hr))
    {
      hr = FindUsers(pContainerToSearch, //IDirectorySearch pointer to Partitions container.
           pszBuffer,
           NULL, //Return all properties
           bReturnVerbose
         );
      if (SUCCEEDED(hr))
      {
        if (S_FALSE==hr)
           wprintf(L"No user object could be found.\n");
      }
      else if (0x8007203e==hr)
        wprintf(L"Could not execute query. An invalid filter was specified.\n");
      else
        wprintf(L"Query failed to run. HRESULT: %x\n",hr);
    }
    else
    {
       wprintf(L"Could not execute query. Could not bind to the container.\n");
    }
    if (pContainerToSearch)
       pContainerToSearch->Release();
  }
    VariantClear(&var);
}
if (pObject)
    pObject->Release();

// Uninitialize COM
CoUninitialize();
return;
}

Generated on Wed Nov 13 2024 16:53:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/activedir/RootDSE/VC/RootDSE.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • activedir
  • RootDSE
  • VC
Functions

RootDSE.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])

Function Documentation

int main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 7 of file RootDSE.cpp.

{
  IADs    *pRoot=NULL;
  VARIANT varDSRoot;
  HRESULT hr;

  hr = CoInitialize(NULL);

  /////////////////////////////////////////////////////////////////////////////
  // NOTE: If your client is NT 4.0 or Win 9.x without the DS Client, you
  // must put the server name in front of the LDAP://.  For example
  // ADsGetObject(L"LDAP://myDC/RootDSE")
  // If your client is Windows 2000, you don't need to specify the servername.
  // The locator service in Windows 2000 will automatically locate the best DC for you
  /////////////////////////////////////////////////////////////////////////////////////

  // Get the Directory Object on the root DSE, to get to the server configuration
  hr = ADsGetObject(L"LDAP://RootDSE",IID_IADs,(void**)&pRoot);

  if(SUCCEEDED(hr) && pRoot != NULL)
  {

    hr = pRoot->Get(L"defaultNamingContext",&varDSRoot);
    if(SUCCEEDED(hr))
      printf("\nDefault Naming Context:%S\n",varDSRoot.bstrVal);
    VariantClear(&varDSRoot);

    hr = pRoot->Get(L"rootDomainNamingContext",&varDSRoot);
    if(SUCCEEDED(hr))
      printf("\nRoot Domain Naming Context:%S\n",varDSRoot.bstrVal);
    VariantClear(&varDSRoot);

    hr = pRoot->Get(L"configurationNamingContext",&varDSRoot);
    if(SUCCEEDED(hr))
      printf("\nConfiguration Naming Context :%S\n",varDSRoot.bstrVal);
    VariantClear(&varDSRoot);

    hr = pRoot->Get(L"schemaNamingContext",&varDSRoot);
    if(SUCCEEDED(hr))
      printf("\nSchema Naming context :%S\n",varDSRoot.bstrVal);
    VariantClear(&varDSRoot);

  }

      if (pRoot)
        pRoot->Release();

  CoUninitialize();

  return 0;
}

Generated on Wed Nov 13 2024 16:53:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/activedir/RootDSE/VC/StdAfx.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • activedir
  • RootDSE
  • VC

StdAfx.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/activedir/RootDSE/VC/StdAfx.h File Reference

  • NetDS
  • ADSI
  • samples
  • activedir
  • RootDSE
  • VC

StdAfx.h File Reference

#include "stdio.h"
#include "activeds.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/activedir/SID/vc/objectSid.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • activedir
  • SID
  • vc
Defines | Functions

objectSid.cpp File Reference

#include <wchar.h>
#include <objbase.h>
#include <activeds.h>
#include <sddl.h>

Go to the source code of this file.

Defines

#define | _WIN32_WINNT 0x0500

Functions

HRESULT | FindUserByName (IDirectorySearch *pSearchBase, LPOLESTR szFindUser, IADs **ppUser)
HRESULT | GetLPBYTEtoOctetString (VARIANT *pVar, LPBYTE *ppByte)
void | wmain (int argc, wchar_t *argv[])

Define Documentation

#define _WIN32_WINNT 0x0500

Definition at line 10 of file objectSid.cpp.

Function Documentation

HRESULT FindUserByName | ( | IDirectorySearch * | pSearchBase,
 |  | LPOLESTR | szFindUser,
 |  | IADs ** | ppUser
 | ) |  |

Definition at line 185 of file objectSid.cpp.

{
    HRESULT hrObj = E_FAIL;
    HRESULT hr = E_FAIL;
  if ((!pSearchBase)||(!szFindUser))
    return E_INVALIDARG;
  //Create search filter
  LPOLESTR pszSearchFilter = NULL;
       LPOLESTR szADsPath = NULL;
  pszSearchFilter = new OLECHAR[MAX_PATH];
  szADsPath = new OLECHAR[MAX_PATH];
       if(pszSearchFilter == NULL || szADsPath == NULL)
            return  E_OUT_OF_MEMORY;

  wcscpy(pszSearchFilter, L"(&(objectCategory=person)(objectClass=user)(cn=");
  wcscat(pszSearchFilter, szFindUser);
  wcscat(pszSearchFilter, L"))");
    //Search entire subtree from root.
  ADS_SEARCHPREF_INFO SearchPrefs;
  SearchPrefs.dwSearchPref = ADS_SEARCHPREF_SEARCH_SCOPE;
  SearchPrefs.vValue.dwType = ADSTYPE_INTEGER;
  SearchPrefs.vValue.Integer = ADS_SCOPE_SUBTREE;
    DWORD dwNumPrefs = 1;
  // COL for iterations
    ADS_SEARCH_COLUMN col;
    // Handle used for searching
    ADS_SEARCH_HANDLE hSearch;
  // Set the search preference
    hr = pSearchBase->SetSearchPreference( &SearchPrefs, dwNumPrefs);
    if (FAILED(hr))
        goto ret;
  // Set attributes to return
  CONST DWORD dwAttrNameSize = 1;
    LPOLESTR pszAttribute[dwAttrNameSize] = {L"ADsPath"};

    // Execute the search
    hr = pSearchBase->ExecuteSearch(pszSearchFilter,
                              pszAttribute,
                  dwAttrNameSize,
                  &hSearch
                  );
  if (SUCCEEDED(hr))
  {

    // Call IDirectorySearch::GetNextRow() to retrieve the next row
    //of data
        while( pSearchBase->GetNextRow( hSearch) != S_ADS_NOMORE_ROWS )
    {
            // loop through the array of passed column names,
            // print the data for each column
            for (DWORD x = 0; x < dwAttrNameSize; x++)
            {
          // Get the data for this column
                hr = pSearchBase->GetColumn( hSearch, pszAttribute[x], &col );
          if ( SUCCEEDED(hr) )
          {
            // Print the data for the column and free the column
          // Note the attribute we asked for is type CaseIgnoreString.
                    wcscpy(szADsPath, col.pADsValues->CaseIgnoreString);
          hr = ADsOpenObject(szADsPath,
                   NULL,
                   NULL,
                   ADS_SECURE_AUTHENTICATION, //Use Secure Authentication
                   IID_IADs,
                   (void**)ppUser);
          if (SUCCEEDED(hr))
          {
                       wprintf(L"Found User.\n",szFindUser);
                       wprintf(L"%s: %s\r\n",pszAttribute[x],col.pADsValues->CaseIgnoreString);
             hrObj = S_OK;
          }
            pSearchBase->FreeColumn( &col );
          }
          else
            hr = E_FAIL;
            }
    }
    // Close the search handle to clean up
        pSearchBase->CloseSearchHandle(hSearch);
  }
  if (FAILED(hrObj))
    hr = hrObj;

  ret:
        delete pszSearchFilter;
        delete szADsPath;
        return hr;
}

HRESULT GetLPBYTEtoOctetString | ( | VARIANT * | pVar,
 |  | LPBYTE * | ppByte
 | ) |  |

Definition at line 150 of file objectSid.cpp.

{
HRESULT hr = E_FAIL;
//Check args
if ((!pVar)||(!ppByte))
  return E_INVALIDARG;
//Check the variant type for unsigned char array (octet string).
if ((pVar->vt)!=(VT_UI1|VT_ARRAY))
  return E_INVALIDARG;

void HUGEP *pArray;
long lLBound, lUBound;
hr = SafeArrayGetLBound(V_ARRAY(pVar), 1, &lLBound);
hr = SafeArrayGetUBound(V_ARRAY(pVar), 1, &lUBound);
//Get the count of elements
long cElements = lUBound-lLBound + 1;
hr = SafeArrayAccessData( V_ARRAY(pVar),
                &pArray );
if (SUCCEEDED(hr))
{
 LPBYTE pTemp = (LPBYTE)pArray;
 *ppByte = (LPBYTE) CoTaskMemAlloc(cElements);
 if (*ppByte)
    memcpy(*ppByte, pTemp, cElements);
 else
  hr = E_OUTOFMEMORY;
}
SafeArrayUnaccessData( V_ARRAY(pVar) );

return hr;
}

void wmain | ( | int | argc,
 |  | wchar_t * | argv[]
 | ) |  |

Definition at line 24 of file objectSid.cpp.

{

//Handle the command line arguments.
LPOLESTR pszBuffer = NULL;
pszBuffer = new OLECHAR[MAX_PATH*2];
if(pszBuffer == NULL)
    goto ret;
if (argv[1] == NULL)
{
  wprintf(L"This program finds a user in the current Window 2000 domain\n");
  wprintf(L"and displays its objectSid property in string form.\n");
  wprintf(L"This program demonstrates reading a property of type octet string.\n\n");

  wprintf(L"Enter Common Name of the user to find:");
  _getws(pszBuffer);
}
else
   wcscpy(pszBuffer, argv[1]);
//if empty string, exit.
if (0==wcscmp(L"", pszBuffer))
   goto ret;

wprintf(L"\nFinding user: %s...\n",pszBuffer);

//Intialize COM
CoInitialize(NULL);
HRESULT hr = S_OK;
//Get rootDSE and the domain container's DN.
IADs *pObject = NULL;
IDirectorySearch *pDS = NULL;
LPOLESTR szPath = NULL;
szPath = new OLECHAR[MAX_PATH];
if(szPath == NULL)
    goto ret;

VARIANT var;
hr = ADsOpenObject(L"LDAP://rootDSE",
         NULL,
         NULL,
         ADS_SECURE_AUTHENTICATION, //Use Secure Authentication
         IID_IADs,
         (void**)&pObject);
if (FAILED(hr))
{
   wprintf(L"Not Found. Could not bind to the domain.\n");
   if (pObject)
     pObject->Release();
   goto ret;
}

VariantInit(&var);
hr = pObject->Get(L"defaultNamingContext",&var);
if (SUCCEEDED(hr))
{
  wcscpy(szPath,L"LDAP://");
  wcscat(szPath,var.bstrVal);
  VariantClear(&var);
  if (pObject)
  {
     pObject->Release();
     pObject = NULL;
  }
  //Bind to the root of the current domain.
  hr = ADsOpenObject(szPath,
           NULL,
           NULL,
           ADS_SECURE_AUTHENTICATION, //Use Secure Authentication
           IID_IDirectorySearch,
           (void**)&pDS);
  if (SUCCEEDED(hr))
  {
    hr =  FindUserByName(pDS, //Container to search
               pszBuffer, //Name of user to find.
               &pObject); //Return a pointer to the user
    if (SUCCEEDED(hr))
    {
      //Get the objectSid property
      hr = pObject->Get(L"objectSid", &var);
      if (SUCCEEDED(hr))
      {
        LPBYTE pByte = NULL;
        wprintf (L"----------------------------------------------\n");
        wprintf (L"----------Call GetLPBYTEtoOctetString---------\n");
        wprintf (L"----------------------------------------------\n");
        hr = GetLPBYTEtoOctetString(&var, //IN. Pointer to variant containing the octetstring.
                 &pByte //OUT. Return LPBYTE to the data represented in octetstring.
                 );

        PSID pObjectSID = (PSID)pByte;
        //Convert SID to string.
        LPOLESTR szSID = NULL;
        ConvertSidToStringSid(pObjectSID, &szSID);
        wprintf(L"objectSid:%s\n",szSID);
        LocalFree(szSID);
        //Free the buffer.
        CoTaskMemFree(pByte);
      }
      else
        wprintf(L"Get method failed with hr: %x\n",hr);
      VariantClear(&var);
    }
    else
    {
            wprintf(L"User \"%s\" not Found.\n",pszBuffer);
      wprintf (L"FindUserByName failed with the following HR: %x\n", hr);
    }
    if (pObject)
      pObject->Release();
  }

  if (pDS)
     pDS->Release();
}
ret:
    if(pszBuffer) delete pszBuffer;
    if(szPath)     delete szPath;
//Uninitalize COM
CoUninitialize();

  return;
}

Generated on Wed Nov 13 2024 16:53:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/activedir/User/vc/iasuser.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • activedir
  • User
  • vc
Defines | Functions

iasuser.cpp File Reference

#include <math.h>
#include <wchar.h>
#include <objbase.h>
#include <activeds.h>
#include <sddl.h>

Go to the source code of this file.

Defines

#define | _WIN32_WINNT 0x0500

Functions

HRESULT | FindUserByName (IDirectorySearch *pSearchBase, LPWSTR szFindUser, IADs **ppUser)
HRESULT | GetUserPropertyMethods (IADsUser *pUser)
void | wmain (int argc, wchar_t *argv[])

Define Documentation

#define _WIN32_WINNT 0x0500

Definition at line 12 of file iasuser.cpp.

Function Documentation

HRESULT FindUserByName | ( | IDirectorySearch * | pSearchBase,
 |  | LPWSTR | szFindUser,
 |  | IADs ** | ppUser
 | ) |  |

Definition at line 1166 of file iasuser.cpp.

{
    HRESULT hr ;
    wchar_t pszSearchFilter[MAX_PATH] ;
    wchar_t pszADsPath[MAX_PATH] ;
    ADS_SEARCHPREF_INFO searchPrefs ;
    ADS_SEARCH_COLUMN col ;
    ADS_SEARCH_HANDLE hSearch ;
    LPWSTR pszAttribute[1] = { L"ADsPath"} ;

    if ( NULL == pSearchBase || NULL == szFindUser || NULL == ppUser ) {
        return( E_INVALIDARG ) ;
    }

    // build our search filter.
    if ( 0 > _snwprintf( pszSearchFilter, MAX_PATH, L"(&(objectCategory=person)(objectClass=user)(cn=%ws))", szFindUser ) ) {
        // uh oh, username is too long.  just abort.
        return( E_INVALIDARG ) ;
    }
    ZeroMemory(&searchPrefs, sizeof( searchPrefs ) ) ;
    searchPrefs.dwSearchPref = ADS_SEARCHPREF_SEARCH_SCOPE ;
    searchPrefs.vValue.dwType = ADSTYPE_INTEGER ;
    searchPrefs.vValue.Integer = ADS_SCOPE_SUBTREE ;
    hr = pSearchBase->SetSearchPreference( &searchPrefs, 1 ) ;
    if ( FAILED( hr ) ) {
        return( hr ) ;
    }
    hr = pSearchBase->ExecuteSearch( pszSearchFilter, pszAttribute, 1, &hSearch ) ;
    if ( SUCCEEDED( hr ) ) {
        if ( S_ADS_NOMORE_ROWS != pSearchBase->GetNextRow( hSearch ) ) {
            hr = pSearchBase->GetColumn( hSearch, pszAttribute[0], &col ) ;
            if ( SUCCEEDED( hr ) ) {
                wcsncpy( pszADsPath, col.pADsValues->CaseIgnoreString, MAX_PATH ) ;
                pszADsPath[MAX_PATH-1] = 0 ;
                hr = ADsOpenObject( pszADsPath, NULL, NULL, ADS_SECURE_AUTHENTICATION, IID_IADs, (void**)ppUser ) ;
                if ( SUCCEEDED( hr ) ) {
                    wprintf( L"Found User.\n" ) ;
                    wprintf( L"%ws: %ws\n", pszAttribute[0], pszADsPath ) ;
                }
                pSearchBase->FreeColumn( &col ) ;
            }
        }
        pSearchBase->CloseSearchHandle( hSearch ) ;
    }
    return( hr ) ;

}

HRESULT GetUserPropertyMethods ( IADsUser * pUser )

Definition at line 128 of file iasuser.cpp.

{
    VARIANT_BOOL bBool ;
    DATE date ;
    BSTR bstr ;
    LONG lProp ;
    VARIANT var ;
    HRESULT hr ;
    long lBound, uBound ;

    if ( NULL == pUser ) {
        return( HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER ) ) ;
    }
    VariantInit( &var ) ;

    hr = pUser->get_AccountDisabled( &bBool ) ;
    if ( SUCCEEDED( hr ) ) {
        wprintf( L"AccountDisabled: %ws\n", ( bBool ? L"TRUE" : L"FALSE" ) ) ;
    }
    else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
        wprintf( L"AccountDisabled property not found.\n" ) ;
    }
    else {
        wprintf( L"AccountDisabled failed with hr: 0x%08x\n", hr ) ;
    }

    hr = pUser->get_AccountExpirationDate( &date ) ;
    if ( SUCCEEDED( hr ) ) {
        var.vt = VT_DATE ;
        var.date = date ;
        hr = VariantChangeType( &var, &var, VARIANT_NOVALUEPROP, VT_BSTR ) ;
        if ( SUCCEEDED( hr ) ) {
            wprintf( L"AccountExpirationDate: %ws\n", var.bstrVal ) ;
        }
        else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
            wprintf( L"AccountExpirationDate property not found.\n" ) ;
        }
        else {
            wprintf( L"AccountExpirationDate failed with hr: 0x%08x\n", hr ) ;
        }
        VariantClear( &var ) ;
    }

    hr = pUser->get_BadLoginAddress( &bstr ) ;
    if ( SUCCEEDED( hr ) ) {
        wprintf( L"BadLoginAddress: %ws\n", bstr ) ;
        SysFreeString( bstr ) ;
    }
    else {
        if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
            wprintf( L"BadLoginAddress property not found.\n" ) ;
        }
        else if ( E_ADS_PROPERTY_NOT_SUPPORTED == hr ) {
            // Property not supported on all platforms, check documentation.
            wprintf( L"BadLoginAddress property is not supported on this platform.\n" ) ;
        }
        else {
            wprintf( L"BadLoginAddress failed with hr: 0x%08x\n", hr ) ;
        }
    }

    hr = pUser->get_BadLoginCount( &lProp ) ;
    if ( SUCCEEDED( hr ) ) {
        wprintf( L"BadLoginCount: %d\n", lProp ) ;
    }
    else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
        wprintf( L"BadLoginCount property not found.\n" ) ;
    }
    else {
        wprintf( L"BadLoginCount failed with hr: 0x%08x\n", hr ) ;
    }

    hr = pUser->get_Department( &bstr ) ;
    if ( SUCCEEDED( hr ) ) {
        wprintf( L"Department: %ws\n", bstr ) ;
        SysFreeString( bstr ) ;
    }
    else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
        wprintf( L"Department property not found.\n" ) ;
    }
    else {
        wprintf( L"Department failed with hr: 0x%08x\n", hr ) ;
    }

    hr = pUser->get_Description( &bstr ) ;
    if ( SUCCEEDED( hr ) ) {
        wprintf( L"Description: %ws\n", bstr ) ;
        SysFreeString( bstr ) ;
    }
    else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
        wprintf( L"Description property not found.\n" ) ;
    }
    else {
        wprintf( L"Description failed with hr: 0x%08x\n", hr ) ;
    }

    hr = pUser->get_Division( &bstr ) ;
    if ( SUCCEEDED( hr ) ) {
        wprintf( L"Division: %ws\n", bstr ) ;
        SysFreeString( bstr ) ;
    }
    else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
        wprintf( L"Division property not found.\n" ) ;
    }
    else {
        wprintf( L"Division failed with hr: 0x%08x\n", hr ) ;
    }

    hr = pUser->get_EmailAddress( &bstr ) ;
    if ( SUCCEEDED( hr ) ) {
        wprintf( L"EmailAddress: %ws\n", bstr ) ;
        SysFreeString( bstr ) ;
    }
    else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
        wprintf( L"EmailAddress property not found.\n" ) ;
    }
    else {
        wprintf( L"EmailAddress failed with hr: 0x%08x\n", hr ) ;
    }

    hr = pUser->get_EmployeeID( &bstr ) ;
    if ( SUCCEEDED( hr ) ) {
        wprintf( L"EmployeeID: %ws\n", bstr ) ;
        SysFreeString( bstr ) ;
    }
    else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
        wprintf( L"EmployeeID property not found.\n" ) ;
    }
    else {
        wprintf( L"EmployeeID failed with hr: 0x%08x\n", hr ) ;
    }

    hr = pUser->get_FaxNumber( &var ) ;
    if ( SUCCEEDED( hr ) ) {
        // Note:  This property method can return either a VARIANT with
        // type VT_BSTR and a single string, or a VARIANT with type
        // VT_ARRAY | VT_BSTR and multiple strings, depending on whether
        // the target directory's property is single- or multi-valued.
        // Generic code should probably handle both cases.
        if ( VT_BSTR == var.vt ) {
            wprintf( L"FaxNumber: %ws\n", var.bstrVal ) ;
        }
        else if ( ( VT_ARRAY | VT_BSTR ) == var.vt ) {
            VARIANT elem ;
            VariantInit( &elem ) ;
            if ( SUCCEEDED( SafeArrayGetLBound( V_ARRAY(&var), 1, &lBound ) ) &&
                 SUCCEEDED( SafeArrayGetUBound( V_ARRAY(&var), 1, &uBound ) ) ) {
                while ( lBound <= uBound ) {
                    if ( SUCCEEDED( SafeArrayGetElement( V_ARRAY(&var), &lBound, &elem ) ) ) {
                        wprintf( L"FaxNumber: %ws\n", elem.bstrVal ) ;
                        VariantClear( &elem ) ;
                    }
                    ++lBound ;
                }
            }
        }
        VariantClear( &var ) ;
    }
    else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
        wprintf( L"FaxNumber property not found.\n" ) ;
    }
    else {
        wprintf( L"FaxNumber failed with hr: 0x%08x\n", hr ) ;
    }

    hr = pUser->get_FirstName( &bstr ) ;
    if ( SUCCEEDED( hr ) ) {
        wprintf( L"FirstName: %ws\n", bstr ) ;
        SysFreeString( bstr ) ;
    }
    else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
        wprintf( L"FirstName property not found.\n" ) ;
    }
    else {
        wprintf( L"FirstName failed with hr: 0x%08x\n", hr ) ;
    }

    hr = pUser->get_FullName( &bstr ) ;
    if ( SUCCEEDED( hr ) ) {
        wprintf( L"FullName: %ws\n", bstr ) ;
        SysFreeString( bstr ) ;
    }
    else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
        wprintf( L"FullName property not found.\n" ) ;
    }
    else {
        wprintf( L"FullName failed with hr: 0x%08x\n", hr ) ;
    }

    hr = pUser->get_GraceLoginsAllowed( &lProp ) ;
    if ( SUCCEEDED( hr ) ) {
        wprintf( L"GraceLoginsAllowed: %d\n", lProp ) ;
    }
    else if ( E_ADS_PROPERTY_NOT_SUPPORTED == hr ) {
        // Property not supported on all platforms, check documentation.
        wprintf( L"GraceLoginsAllowed property is not supported on this platform.\n" ) ;
    }
    else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
        wprintf( L"GraceLoginsAllowed property not found.\n" ) ;
    }
    else {
        wprintf( L"GraceLoginsAllowed failed with hr: 0x%08x\n", hr ) ;
    }

    hr = pUser->get_GraceLoginsRemaining( &lProp ) ;
    if ( SUCCEEDED( hr ) ) {
        wprintf( L"GraceLoginsRemaining: %d\n", lProp ) ;
    }
    else if ( E_ADS_PROPERTY_NOT_SUPPORTED == hr ) {
        // Property not supported on all platforms, check documentation.
        wprintf( L"GraceLoginsRemaining property is not supported on this platform.\n" ) ;
    }
    else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
        wprintf( L"GraceLoginsRemaining property not found.\n" ) ;
    }
    else {
        wprintf( L"GraceLoginsRemaining failed with hr: 0x%08x\n", hr ) ;
    }

    hr = pUser->get_HomeDirectory( &bstr ) ;
    if ( SUCCEEDED( hr ) ) {
        wprintf( L"HomeDirectory: %ws\n", bstr ) ;
        SysFreeString( bstr ) ;
    }
    else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
        wprintf( L"HomeDirectory property not found.\n" ) ;
    }
    else {
        wprintf( L"HomeDirectory failed with hr: 0x%08x\n", hr ) ;
    }

    hr = pUser->get_HomePage( &bstr ) ;
    if ( SUCCEEDED( hr ) ) {
        wprintf( L"HomePage: %ws\n", bstr ) ;
        SysFreeString( bstr ) ;
    }
    else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
        wprintf( L"HomePage property not found.\n" ) ;
    }
    else {
        wprintf( L"HomePage failed with hr: 0x%08x\n", hr ) ;
    }

    hr = pUser->get_IsAccountLocked( &bBool ) ;
    if ( SUCCEEDED( hr ) ) {
        wprintf( L"IsAccountLocked: %ws\n", ( bBool ? L"TRUE" : L"FALSE" ) ) ;
    }
    else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
        wprintf( L"IsAccountLocked property not found.\n" ) ;
    }
    else {
        wprintf( L"IsAccountLocked failed with hr: 0x%08x\n", hr ) ;
    }

    hr = pUser->get_Languages( &var ) ;
    if ( SUCCEEDED( hr ) ) {
        // Note:  This property method can return either a VARIANT with
        // type VT_BSTR and a single string, or a VARIANT with type
        // VT_ARRAY | VT_BSTR and multiple strings, depending on whether
        // the target directory's property is single- or multi-valued.
        // Generic code should probably handle both cases.
        if ( VT_BSTR == var.vt ) {
            wprintf( L"Languages: %ws\n", var.bstrVal ) ;
        }
        else if ( ( VT_ARRAY | VT_BSTR ) == var.vt ) {
            VARIANT elem ;
            VariantInit( &elem ) ;
            if ( SUCCEEDED( SafeArrayGetLBound( V_ARRAY(&var), 1, &lBound ) ) &&
                 SUCCEEDED( SafeArrayGetUBound( V_ARRAY(&var), 1, &uBound ) ) ) {
                while ( lBound <= uBound ) {
                    if ( SUCCEEDED( SafeArrayGetElement( V_ARRAY(&var), &lBound, &elem ) ) ) {
                        wprintf( L"Languages: %ws\n", elem.bstrVal ) ;
                        VariantClear( &elem ) ;
                    }
                    ++lBound ;
                }
            }
        }
        VariantClear( &var ) ;
    }
    else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
        wprintf( L"Languages property not found.\n" ) ;
    }
    else if ( E_ADS_PROPERTY_NOT_SUPPORTED == hr ) {
        // Property not supported on all platforms, check documentation.
        wprintf( L"Languages property is not supported on this platform.\n" ) ;
    }
    else {
        wprintf( L"Languages failed with hr: 0x%08x\n", hr ) ;
    }

    hr = pUser->get_LastFailedLogin( &date ) ;
    if ( SUCCEEDED( hr ) ) {
        var.vt = VT_DATE ;
        var.date = date ;
        hr = VariantChangeType( &var, &var, VARIANT_NOVALUEPROP, VT_BSTR ) ;
        if ( SUCCEEDED( hr ) ) {
            wprintf( L"LastFailedLogin: %ws\n", var.bstrVal ) ;
        }
        else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
            wprintf( L"LastFailedLogin property not found.\n" ) ;
        }
        else {
            wprintf( L"LastFailedLogin failed with hr: 0x%08x\n", hr ) ;
        }
        VariantClear( &var ) ;
    }

    hr = pUser->get_LastLogin( &date ) ;
    if ( SUCCEEDED( hr ) ) {
        var.vt = VT_DATE ;
        var.date = date ;
        hr = VariantChangeType( &var, &var, VARIANT_NOVALUEPROP, VT_BSTR ) ;
        if ( SUCCEEDED( hr ) ) {
            wprintf( L"LastLogin: %ws\n", var.bstrVal ) ;
        }
        else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
            wprintf( L"LastLogin property not found.\n" ) ;
        }
        else {
            wprintf( L"LastLogin failed with hr: 0x%08x\n", hr ) ;
        }
        VariantClear( &var ) ;
    }

    hr = pUser->get_LastLogoff( &date ) ;
    if ( SUCCEEDED( hr ) ) {
        var.vt = VT_DATE ;
        var.date = date ;
        hr = VariantChangeType( &var, &var, VARIANT_NOVALUEPROP, VT_BSTR ) ;
        if ( SUCCEEDED( hr ) ) {
            wprintf( L"LastLogoff: %ws\n", var.bstrVal ) ;
        }
        else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
            wprintf( L"LastLogoff property not found.\n" ) ;
        }
        else {
            wprintf( L"LastLogoff failed with hr: 0x%08x\n", hr ) ;
        }
        VariantClear( &var ) ;
    }

    hr = pUser->get_LastName( &bstr ) ;
    if ( SUCCEEDED( hr ) ) {
        wprintf( L"LastName: %ws\n", bstr ) ;
        SysFreeString( bstr ) ;
    }
    else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
        wprintf( L"LastName property not found.\n" ) ;
    }
    else {
        wprintf( L"LastName failed with hr: 0x%08x\n", hr ) ;
    }

    hr = pUser->get_LoginHours( &var ) ;
    if ( SUCCEEDED( hr ) ) {
        wprintf(L"LoginHours:\n");
        //For Octet String
        void HUGEP *pArray;
        ULONG dwSLBound;
        ULONG dwSUBound;
        if ( var.vt==(VT_UI1|VT_ARRAY) )
        {
            if ( SUCCEEDED( SafeArrayGetLBound( V_ARRAY(&var),
                                                1,
                                                (long FAR *) &dwSLBound ) ) &&
                 SUCCEEDED( SafeArrayGetUBound( V_ARRAY(&var),
                                                1,
                                                (long FAR *) &dwSUBound ) ) ) {
                hr = SafeArrayAccessData( V_ARRAY(&var),
                                          &pArray );

                //21 byte array representing 8 hour blocks for each day.
                //First byte is 16:00-23:59 on saturday.
                //Second byte is 0:00-07:59 on sunday,
                //Third byte is 8:00-15:59 on sunday,
                //and so on up to 8:00-15:59 on saturday.
                PBYTE pLogonHours = (PBYTE)pArray;
                wchar_t szDay[12] ;
                wchar_t szTime[12] ;
                int base = 2;
                //8 bits in a byte.
                DWORD iBitMax = 8;
                DWORD dVal, j;
                int iTotalBytes = 21;
                int iOffset;
                for ( int k = 1; k <= iTotalBytes; k++ )
                {
                    if ( k!=iTotalBytes )
                        iOffset = k;
                    else
                        iOffset = 0;
                    //Get the block of time during the day.
                    switch ( k-1 )
                    {
                    case 0:
                    case 1:
                    case 2:
                        wcscpy(szDay, L"Sunday" ) ;
                        break;
                    case 3:
                    case 4:
                    case 5:
                        wcscpy(szDay, L"Monday" ) ;
                        break;
                    case 6:
                    case 7:
                    case 8:
                        wcscpy(szDay, L"Tuesday" );
                        break;
                    case 9:
                    case 10:
                    case 11:
                        wcscpy(szDay, L"Wednesday" );
                        break;
                    case 12:
                    case 13:
                    case 14:
                        wcscpy(szDay, L"Thursday" );
                        break;
                    case 15:
                    case 16:
                    case 17:
                        wcscpy(szDay, L"Friday" );
                        break;
                    case 18:
                    case 19:
                    case 20:
                        wcscpy(szDay, L"Saturday");
                        break;
                    }

                    switch ( k-1 )
                    {
                    case 0:
                    case 3:
                    case 6:
                    case 9:
                    case 12:
                    case 15:
                    case 18:
                        for ( j = 0; j < iBitMax; j++ )
                        {
                            dVal = (DWORD)pow(base, j);
                            if ( (pLogonHours[iOffset] & dVal)==dVal )
                            {
                                switch ( j )
                                {
                                case 0:
                                    wcscpy(szTime, L"00:00-59");
                                    break;
                                case 1:
                                    wcscpy(szTime, L"01:00-59");
                                    break;
                                case 2:
                                    wcscpy(szTime, L"02:00-59");
                                    break;
                                case 3:
                                    wcscpy(szTime, L"03:00-59");
                                    break;
                                case 4:
                                    wcscpy(szTime, L"04:00-59");
                                    break;
                                case 5:
                                    wcscpy(szTime, L"05:00-59");
                                    break;
                                case 6:
                                    wcscpy(szTime, L"06:00-59");
                                    break;
                                case 7:
                                    wcscpy(szTime, L"07:00-59");
                                    break;
                                }
                                wprintf(L"   %ws %ws\n",szDay,szTime);
                            }
                        }
                        break;
                    case 1:
                    case 4:
                    case 7:
                    case 10:
                    case 13:
                    case 16:
                    case 19:
                        for ( j = 0; j < iBitMax; j++ )
                        {
                            dVal = (DWORD)pow(base, j);
                            if ( (pLogonHours[iOffset] & dVal)==dVal )
                            {
                                switch ( j )
                                {
                                case 0:
                                    wcscpy(szTime, L"08:00-59");
                                    break;
                                case 1:
                                    wcscpy(szTime, L"09:00-59");
                                    break;
                                case 2:
                                    wcscpy(szTime, L"10:00-59");
                                    break;
                                case 3:
                                    wcscpy(szTime, L"11:00-59");
                                    break;
                                case 4:
                                    wcscpy(szTime, L"12:00-59");
                                    break;
                                case 5:
                                    wcscpy(szTime, L"13:00-59");
                                    break;
                                case 6:
                                    wcscpy(szTime, L"14:00-59");
                                    break;
                                case 7:
                                    wcscpy(szTime, L"15:00-59");
                                    break;
                                }
                                wprintf(L"   %ws %ws\n",szDay,szTime);
                            }
                        }
                        break;
                    case 2:
                    case 5:
                    case 8:
                    case 11:
                    case 14:
                    case 17:
                    case 20:
                        for ( j = 0; j < iBitMax; j++ )
                        {
                            dVal = (DWORD)pow(base, j);
                            if ( (pLogonHours[iOffset] & dVal)==dVal )
                            {
                                switch ( j )
                                {
                                case 0:
                                    wcscpy(szTime, L"16:00-59");
                                    break;
                                case 1:
                                    wcscpy(szTime, L"17:00-59");
                                    break;
                                case 2:
                                    wcscpy(szTime, L"18:00-59");
                                    break;
                                case 3:
                                    wcscpy(szTime, L"19:00-59");
                                    break;
                                case 4:
                                    wcscpy(szTime, L"20:00-59");
                                    break;
                                case 5:
                                    wcscpy(szTime, L"21:00-59");
                                    break;
                                case 6:
                                    wcscpy(szTime, L"22:00-59");
                                    break;
                                case 7:
                                    wcscpy(szTime, L"23:00-59");
                                    break;
                                }
                                wprintf(L"   %ws %ws\n",szDay,szTime);
                            }
                        }
                        break;
                    }
                }

                //Decrement the access count for the array.
                SafeArrayUnaccessData( V_ARRAY(&var) );
            }
        }
        VariantClear(&var ) ;
    }
    else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
        wprintf( L"LoginHours property not found.\n" ) ;
    }
    else {
        wprintf( L"LoginHours failed with hr: 0x%08x\n", hr ) ;
    }

    hr = pUser->get_LoginScript( &bstr ) ;
    if ( SUCCEEDED( hr ) ) {
        wprintf( L"LoginScript: %ws\n", bstr ) ;
        SysFreeString( bstr ) ;
    }
    else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
        wprintf( L"LoginScript property not found.\n" ) ;
    }
    else {
        wprintf( L"LoginScript failed with hr: 0x%08x\n", hr ) ;
    }

    hr = pUser->get_LoginWorkstations( &var ) ;
    if ( SUCCEEDED( hr ) ) {
        if ( SUCCEEDED( SafeArrayGetLBound( V_ARRAY(&var), 1, &lBound ) ) &&
             SUCCEEDED( SafeArrayGetUBound( V_ARRAY(&var), 1, &uBound ) ) ) {
            VARIANT elem ;
            while ( lBound <= uBound ) {
                hr = SafeArrayGetElement( V_ARRAY(&var), &lBound, &elem ) ;
                if ( SUCCEEDED( hr ) ) {
                    wprintf( L"LoginWorkstations: %ws\n", elem.bstrVal ) ;
                    VariantClear( &elem ) ;
                }
                ++lBound ;
            }
        }
        VariantClear( &var ) ;
    }
    else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
        wprintf( L"LoginWorkstations property not found.\n" ) ;
    }
    else {
        wprintf( L"LoginWorkstations failed with hr: 0x%08x\n", hr ) ;
    }

    hr = pUser->get_Manager( &bstr ) ;
    if ( SUCCEEDED( hr ) ) {
        wprintf( L"Manager: %ws\n", bstr ) ;
        SysFreeString( bstr ) ;
    }
    else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
        wprintf( L"Manager property not found.\n" ) ;
    }
    else {
        wprintf( L"Manager failed with hr: 0x%08x\n", hr ) ;
    }

    hr = pUser->get_MaxLogins( &lProp ) ;
    if ( SUCCEEDED( hr ) ) {
        wprintf( L"MaxLogins: %d\n", lProp ) ;
    }
    else if ( E_ADS_PROPERTY_NOT_SUPPORTED == hr ) {
        // Property not supported on all platforms, check documentation.
        wprintf( L"MaxLogins property is not supported on this platform.\n" ) ;
    }
    else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
        wprintf( L"MaxLogins property not found.\n" ) ;
    }
    else {
        wprintf( L"MaxLogins failed with hr: 0x%08x\n", hr ) ;
    }

    hr = pUser->get_MaxStorage( &lProp ) ;
    if ( SUCCEEDED( hr ) ) {
        wprintf( L"MaxStorage: %d\n", lProp ) ;
    }
    else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
        wprintf( L"MaxStorage property not found.\n" ) ;
    }
    else {
        wprintf( L"MaxStorage failed with hr: 0x%08x\n", hr ) ;
    }

    hr = pUser->get_NamePrefix( &bstr ) ;
    if ( SUCCEEDED( hr ) ) {
        wprintf( L"NamePrefix: %ws\n", bstr ) ;
        SysFreeString( bstr ) ;
    }
    else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
        wprintf( L"NamePrefix property not found.\n" ) ;
    }
    else {
        wprintf( L"NamePrefix failed with hr: 0x%08x\n", hr ) ;
    }

    hr = pUser->get_NameSuffix( &bstr ) ;
    if ( SUCCEEDED( hr ) ) {
        wprintf( L"NameSuffix: %ws\n", bstr ) ;
        SysFreeString( bstr ) ;
    }
    else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
        wprintf( L"NameSuffix property not found.\n" ) ;
    }
    else {
        wprintf( L"NameSuffix failed with hr: 0x%08x\n", hr ) ;
    }

    hr = pUser->get_OfficeLocations( &var ) ;
    if ( SUCCEEDED( hr ) ) {
        // Note:  This property method can return either a VARIANT with
        // type VT_BSTR and a single string, or a VARIANT with type
        // VT_ARRAY | VT_BSTR and multiple strings, depending on whether
        // the target directory's property is single- or multi-valued.
        // Generic code should probably handle both cases.
        if ( VT_BSTR == var.vt ) {
            wprintf( L"OfficeLocations: %ws\n", var.bstrVal ) ;
        }
        else if ( ( VT_ARRAY | VT_BSTR ) == var.vt ) {
            VARIANT elem ;
            VariantInit( &elem ) ;
            if ( SUCCEEDED( SafeArrayGetLBound( V_ARRAY(&var), 1, &lBound ) ) &&
                 SUCCEEDED( SafeArrayGetUBound( V_ARRAY(&var), 1, &uBound ) ) ) {
                while ( lBound <= uBound ) {
                    if ( SUCCEEDED( SafeArrayGetElement( V_ARRAY(&var), &lBound, &elem ) ) ) {
                        wprintf( L"OfficeLocations: %ws\n", elem.bstrVal ) ;
                        VariantClear( &elem ) ;
                    }
                    ++lBound ;
                }
            }
        }
        VariantClear( &var ) ;
    }
    else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
        wprintf( L"OfficeLocations property not found.\n" ) ;
    }
    else {
        wprintf( L"OfficeLocations failed with hr: 0x%08x\n", hr ) ;
    }

    hr = pUser->get_OtherName( &bstr ) ;
    if ( SUCCEEDED( hr ) ) {
        wprintf( L"OtherName: %ws\n", bstr ) ;
        SysFreeString( bstr ) ;
    }
    else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
        wprintf( L"OtherName property not found.\n" ) ;
    }
    else {
        wprintf( L"OtherName failed with hr: 0x%08x\n", hr ) ;
    }

    hr = pUser->get_PasswordExpirationDate( &date ) ;
    if ( SUCCEEDED( hr ) ) {
        var.vt = VT_DATE ;
        var.date = date ;
        hr = VariantChangeType( &var, &var, VARIANT_NOVALUEPROP, VT_BSTR ) ;
        if ( SUCCEEDED( hr ) ) {
            wprintf( L"PasswordExpirationDate: %ws\n", var.bstrVal ) ;
        }
        else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
            wprintf( L"PasswordExpirationDate property not found.\n" ) ;
        }
        else {
            wprintf( L"PasswordExpirationDate failed with hr: 0x%08x\n", hr ) ;
        }
        VariantClear( &var ) ;
    }

    hr = pUser->get_PasswordLastChanged( &date ) ;
    if ( SUCCEEDED( hr ) ) {
        var.vt = VT_DATE ;
        var.date = date ;
        hr = VariantChangeType( &var, &var, VARIANT_NOVALUEPROP, VT_BSTR ) ;
        if ( SUCCEEDED( hr ) ) {
            wprintf( L"PasswordLastChanged: %ws\n", var.bstrVal ) ;
        }
        else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
            wprintf( L"PasswordLastChanged property not found.\n" ) ;
        }
        else {
            wprintf( L"PasswordLastChanged failed with hr: 0x%08x\n", hr ) ;
        }
        VariantClear( &var ) ;
    }

    hr = pUser->get_PasswordMinimumLength( &lProp ) ;
    if ( SUCCEEDED( hr ) ) {
        wprintf( L"PasswordMinimumLength: %d\n", lProp ) ;
    }
    else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
        wprintf( L"PasswordMinimumLength property not found.\n" ) ;
    }
    else {
        wprintf( L"PasswordMinimumLength failed with hr: 0x%08x\n", hr ) ;
    }

    hr = pUser->get_PasswordRequired( &bBool ) ;
    if ( SUCCEEDED( hr ) ) {
        wprintf( L"PasswordRequired: %ws\n", ( bBool ? L"TRUE" : L"FALSE" ) ) ;
    }
    else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
        wprintf( L"PasswordRequired property not found.\n" ) ;
    }
    else {
        wprintf( L"PasswordRequired failed with hr: 0x%08x\n", hr ) ;
    }

    hr = pUser->get_Picture( &var ) ;
    if ( SUCCEEDED( hr ) ) {
        wprintf( L"Picture is set (not displayed)\n" ) ;
        VariantClear( &var ) ;
    }
    else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
        wprintf( L"Picture property not found.\n" ) ;
    }
    else {
        wprintf( L"Picture failed with hr: 0x%08x\n", hr ) ;
    }

    hr = pUser->get_PostalAddresses( &var ) ;
    if ( SUCCEEDED( hr ) ) {
        if ( SUCCEEDED( SafeArrayGetLBound( V_ARRAY(&var), 1, &lBound ) ) &&
             SUCCEEDED( SafeArrayGetUBound( V_ARRAY(&var), 1, &uBound ) ) ) {
            VARIANT elem ;
            while ( lBound <= uBound ) {
                hr = SafeArrayGetElement( V_ARRAY(&var), &lBound, &elem ) ;
                if ( SUCCEEDED( hr ) ) {
                    wprintf( L"PostalAddresses: %ws\n", elem.bstrVal ) ;
                    VariantClear( &elem ) ;
                }
                ++lBound ;
            }
        }
        VariantClear( &var ) ;
    }
    else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
        wprintf( L"PostalAddresses property not found.\n" ) ;
    }
    else {
        wprintf( L"PostalAddresses failed with hr: 0x%08x\n", hr ) ;
    }

    hr = pUser->get_PostalCodes( &var ) ;
    if ( SUCCEEDED( hr ) ) {
        // Note:  This property method can return either a VARIANT with
        // type VT_BSTR and a single string, or a VARIANT with type
        // VT_ARRAY | VT_BSTR and multiple strings, depending on whether
        // the target directory's property is single- or multi-valued.
        // Generic code should probably handle both cases.
        if ( VT_BSTR == var.vt ) {
            wprintf( L"PostalCodes: %ws\n", var.bstrVal ) ;
        }
        else if ( ( VT_ARRAY | VT_BSTR ) == var.vt ) {
            VARIANT elem ;
            VariantInit( &elem ) ;
            if ( SUCCEEDED( SafeArrayGetLBound( V_ARRAY(&var), 1, &lBound ) ) &&
                 SUCCEEDED( SafeArrayGetUBound( V_ARRAY(&var), 1, &uBound ) ) ) {
                while ( lBound <= uBound ) {
                    if ( SUCCEEDED( SafeArrayGetElement( V_ARRAY(&var), &lBound, &elem ) ) ) {
                        wprintf( L"PostalCodes: %ws\n", elem.bstrVal ) ;
                        VariantClear( &elem ) ;
                    }
                    ++lBound ;
                }
            }
        }
        VariantClear( &var ) ;
    }
    else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
        wprintf( L"PostalCodes property not found.\n" ) ;
    }
    else {
        wprintf( L"PostalCodes failed with hr: 0x%08x\n", hr ) ;
    }

    hr = pUser->get_Profile( &bstr ) ;
    if ( SUCCEEDED( hr ) ) {
        wprintf( L"Profile: %ws\n", bstr ) ;
        SysFreeString( bstr ) ;
    }
    else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
        wprintf( L"Profile property not found.\n" ) ;
    }
    else {
        wprintf( L"Profile failed with hr: 0x%08x\n", hr ) ;
    }

    hr = pUser->get_RequireUniquePassword( &bBool ) ;
    if ( SUCCEEDED( hr ) ) {
        wprintf( L"RequireUniquePassword: %ws\n", ( bBool ? L"TRUE" : L"FALSE" ) ) ;
    }
    else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
        wprintf( L"RequireUniquePassword property not found.\n" ) ;
    }
    else {
        wprintf( L"RequireUniquePassword failed with hr: 0x%08x\n", hr ) ;
    }

    hr = pUser->get_SeeAlso( &var ) ;
    if ( SUCCEEDED( hr ) ) {
        if ( SUCCEEDED( SafeArrayGetLBound( V_ARRAY(&var), 1, &lBound ) ) &&
             SUCCEEDED( SafeArrayGetUBound( V_ARRAY(&var), 1, &uBound ) ) ) {
            VARIANT elem ;
            while ( lBound <= uBound ) {
                hr = SafeArrayGetElement( V_ARRAY(&var), &lBound, &elem ) ;
                if ( SUCCEEDED( hr ) ) {
                    wprintf( L"SeeAlso: %ws\n", elem.bstrVal ) ;
                    VariantClear( &elem ) ;
                }
                ++lBound ;
            }
        }
        VariantClear( &var ) ;
    }
    else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
        wprintf( L"SeeAlso property not found.\n" ) ;
    }
    else {
        wprintf( L"SeeAlso failed with hr: 0x%08x\n", hr ) ;
    }

    hr = pUser->get_TelephoneHome( &var ) ;
    if ( SUCCEEDED( hr ) ) {
        // Note:  This property method can return either a VARIANT with
        // type VT_BSTR and a single string, or a VARIANT with type
        // VT_ARRAY | VT_BSTR and multiple strings, depending on whether
        // the target directory's property is single- or multi-valued.
        // Generic code should probably handle both cases.
        if ( VT_BSTR == var.vt ) {
            wprintf( L"TelephoneHome: %ws\n", var.bstrVal ) ;
        }
        else if ( ( VT_ARRAY | VT_BSTR ) == var.vt ) {
            VARIANT elem ;
            VariantInit( &elem ) ;
            if ( SUCCEEDED( SafeArrayGetLBound( V_ARRAY(&var), 1, &lBound ) ) &&
                 SUCCEEDED( SafeArrayGetUBound( V_ARRAY(&var), 1, &uBound ) ) ) {
                while ( lBound <= uBound ) {
                    if ( SUCCEEDED( SafeArrayGetElement( V_ARRAY(&var), &lBound, &elem ) ) ) {
                        wprintf( L"TelephoneHome: %ws\n", elem.bstrVal ) ;
                        VariantClear( &elem ) ;
                    }
                    ++lBound ;
                }
            }
        }
        VariantClear( &var ) ;
    }
    else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
        wprintf( L"TelephoneHome property not found.\n" ) ;
    }
    else {
        wprintf( L"TelephoneHome failed with hr: 0x%08x\n", hr ) ;
    }

    hr = pUser->get_TelephoneMobile( &var ) ;
    if ( SUCCEEDED( hr ) ) {
        // Note:  This property method can return either a VARIANT with
        // type VT_BSTR and a single string, or a VARIANT with type
        // VT_ARRAY | VT_BSTR and multiple strings, depending on whether
        // the target directory's property is single- or multi-valued.
        // Generic code should probably handle both cases.
        if ( VT_BSTR == var.vt ) {
            wprintf( L"TelephoneMobile: %ws\n", var.bstrVal ) ;
        }
        else if ( ( VT_ARRAY | VT_BSTR ) == var.vt ) {
            VARIANT elem ;
            VariantInit( &elem ) ;
            if ( SUCCEEDED( SafeArrayGetLBound( V_ARRAY(&var), 1, &lBound ) ) &&
                 SUCCEEDED( SafeArrayGetUBound( V_ARRAY(&var), 1, &uBound ) ) ) {
                while ( lBound <= uBound ) {
                    if ( SUCCEEDED( SafeArrayGetElement( V_ARRAY(&var), &lBound, &elem ) ) ) {
                        wprintf( L"TelephoneMobile: %ws\n", elem.bstrVal ) ;
                        VariantClear( &elem ) ;
                    }
                    ++lBound ;
                }
            }
        }
        VariantClear( &var ) ;
    }
    else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
        wprintf( L"TelephoneMobile property not found.\n" ) ;
    }
    else {
        wprintf( L"TelephoneMobile failed with hr: 0x%08x\n", hr ) ;
    }

    hr = pUser->get_TelephoneNumber( &var ) ;
    if ( SUCCEEDED( hr ) ) {
        // Note:  This property method can return either a VARIANT with
        // type VT_BSTR and a single string, or a VARIANT with type
        // VT_ARRAY | VT_BSTR and multiple strings, depending on whether
        // the target directory's property is single- or multi-valued.
        // Generic code should probably handle both cases.
        if ( VT_BSTR == var.vt ) {
            wprintf( L"TelephoneNumber: %ws\n", var.bstrVal ) ;
        }
        else if ( ( VT_ARRAY | VT_BSTR ) == var.vt ) {
            VARIANT elem ;
            VariantInit( &elem ) ;
            if ( SUCCEEDED( SafeArrayGetLBound( V_ARRAY(&var), 1, &lBound ) ) &&
                 SUCCEEDED( SafeArrayGetUBound( V_ARRAY(&var), 1, &uBound ) ) ) {
                while ( lBound <= uBound ) {
                    if ( SUCCEEDED( SafeArrayGetElement( V_ARRAY(&var), &lBound, &elem ) ) ) {
                        wprintf( L"TelephoneNumber: %ws\n", elem.bstrVal ) ;
                        VariantClear( &elem ) ;
                    }
                    ++lBound ;
                }
            }
        }
        VariantClear( &var ) ;
    }
    else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
        wprintf( L"TelephoneNumber property not found.\n" ) ;
    }
    else {
        wprintf( L"TelephoneNumber failed with hr: 0x%08x\n", hr ) ;
    }

    hr = pUser->get_TelephonePager( &var ) ;
    if ( SUCCEEDED( hr ) ) {
        // Note:  This property method can return either a VARIANT with
        // type VT_BSTR and a single string, or a VARIANT with type
        // VT_ARRAY | VT_BSTR and multiple strings, depending on whether
        // the target directory's property is single- or multi-valued.
        // Generic code should probably handle both cases.
        if ( VT_BSTR == var.vt ) {
            wprintf( L"TelephonePager: %ws\n", var.bstrVal ) ;
        }
        else if ( ( VT_ARRAY | VT_BSTR ) == var.vt ) {
            VARIANT elem ;
            VariantInit( &elem ) ;
            if ( SUCCEEDED( SafeArrayGetLBound( V_ARRAY(&var), 1, &lBound ) ) &&
                 SUCCEEDED( SafeArrayGetUBound( V_ARRAY(&var), 1, &uBound ) ) ) {
                while ( lBound <= uBound ) {
                    if ( SUCCEEDED( SafeArrayGetElement( V_ARRAY(&var), &lBound, &elem ) ) ) {
                        wprintf( L"TelephonePager: %ws\n", elem.bstrVal ) ;
                        VariantClear( &elem ) ;
                    }
                    ++lBound ;
                }
            }
        }
        VariantClear( &var ) ;
    }
    else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
        wprintf( L"TelephonePager property not found.\n" ) ;
    }
    else {
        wprintf( L"TelephonePager failed with hr: 0x%08x\n", hr ) ;
    }

    hr = pUser->get_Title( &bstr ) ;
    if ( SUCCEEDED( hr ) ) {
        wprintf( L"Title: %ws\n", bstr ) ;
        SysFreeString( bstr ) ;
    }
    else if ( E_ADS_PROPERTY_NOT_FOUND == hr ) {
        wprintf( L"Title property not found.\n" ) ;
    }
    else {
        wprintf( L"Title failed with hr: 0x%08x\n", hr ) ;
    }

    return( S_OK ) ;
}

void wmain | ( | int | argc,
 |  | wchar_t * | argv[]
 | ) |  |

Definition at line 25 of file iasuser.cpp.

{

//Handle the command line arguments.

    wchar_t pszBuffer[MAX_PATH*2] ;
    if ( argc != 2 )
    {
        wprintf( L"This program finds a user in the current domain\n" ) ;
        wprintf( L"(Windows 2000 or higher), and displays all the IADsUser\n" ) ;
        wprintf( L"properties.\n\n" ) ;
        wprintf(L"useage:  iadsuser <username>\n");
        wprintf( L"where <username> is the DN of the user.\n" ) ;
        wprintf( L"Enclose in quotes as necessary.\n" ) ;
        return ;
    }
    wcsncpy( pszBuffer, argv[1], MAX_PATH * 2 ) ;
    pszBuffer[(MAX_PATH*2)-1] = 0 ;
    //if empty string, exit.
    if ( 0==wcscmp(L"", pszBuffer) )
        return ;

    wprintf(L"\nFinding user: %ws...\n",pszBuffer);

//Intialize COM
    CoInitialize(NULL);
    HRESULT hr = S_OK;
//Get rootDSE and the domain container's DN.
    IADs *pObject = NULL;
    IDirectorySearch *pDS = NULL;
    wchar_t szPath[MAX_PATH] ;
    VARIANT var;
    hr = ADsOpenObject(L"LDAP://rootDSE",
                       NULL,
                       NULL,
                       ADS_SECURE_AUTHENTICATION, //Use Secure Authentication
                       IID_IADs,
                       (void**)&pObject);
    if ( FAILED(hr) )
    {
        wprintf(L"Not Found. Could not bind to the domain.\n");
        if ( pObject )
            pObject->Release();
        return;
    }

    VariantInit( &var ) ;
    hr = pObject->Get(L"defaultNamingContext",&var);
    if ( SUCCEEDED(hr) )
    {
        _snwprintf( szPath, MAX_PATH, L"LDAP://%ws", var.bstrVal ) ;
        szPath[MAX_PATH-1] = 0 ;
        VariantClear(&var);
        if ( pObject )
        {
            pObject->Release();
            pObject = NULL;
        }
        //Bind to the root of the current domain.
        hr = ADsOpenObject(szPath,
                           NULL,
                           NULL,
                           ADS_SECURE_AUTHENTICATION, //Use Secure Authentication
                           IID_IDirectorySearch,
                           (void**)&pDS);
        if ( SUCCEEDED(hr) )
        {
            hr =  FindUserByName(pDS, //Container to search
                                 pszBuffer, //Name of user to find.
                                 &pObject); //Return a pointer to the user
            if ( SUCCEEDED(hr) )
            {
                IADsUser *pUser = NULL;
                hr = pObject->QueryInterface( IID_IADsUser, (void**) &pUser );
                if ( SUCCEEDED(hr) )
                {
                    wprintf (L"----------------------------------------------\n");
                    wprintf (L"--------Call GetUserPropertyMethods-----------\n");
                    hr = GetUserPropertyMethods(pUser);
                    wprintf (L"GetUserPropertyMethods HR: %x\n", hr);
                }
                if ( pUser )
                    pUser->Release();
            }
            else
            {
                wprintf(L"User \"%ws\" not Found.\n",pszBuffer);
                wprintf (L"FindUserByName failed with the following HR: %x\n", hr);
            }
            if ( pObject )
                pObject->Release();
        }

        if ( pDS )
            pDS->Release();
    }

//Uninitalize COM
    CoUninitialize();

    return;
}

Generated on Wed Nov 13 2024 16:53:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/activedir/WKGUID/vc/wkguid.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • activedir
  • WKGUID
  • vc
Defines | Functions

wkguid.cpp File Reference

#include <wchar.h>
#include <objbase.h>
#include <activeds.h>
#include <ntdsapi.h>

Go to the source code of this file.

Defines

#define | _WIN32_WINNT 0x0500

Functions

HRESULT | GetWKDomainObject (LPOLESTR szBindableWKGUID, IADs **ppObject)
void | wmain (int argc, wchar_t *argv[])

Define Documentation

#define _WIN32_WINNT 0x0500

Definition at line 12 of file wkguid.cpp.

Function Documentation

HRESULT GetWKDomainObject | ( | LPOLESTR | szBindableWKGUID,
 |  | IADs ** | ppObject
 | ) |  |

Definition at line 85 of file wkguid.cpp.

{
HRESULT hr = E_FAIL;
//Get rootDSE and the domain container's DN.
IADs *pObject = NULL;
LPOLESTR szPath = new OLECHAR[MAX_PATH];
VARIANT var;
hr = ADsOpenObject(L"LDAP://rootDSE",
         NULL,
         NULL,
         ADS_SECURE_AUTHENTICATION, //Use Secure Authentication
         IID_IADs,
         (void**)&pObject);

VariantInit(&var);
//Get current domain DN.
if (SUCCEEDED(hr))
{
  hr = pObject->Get(L"defaultNamingContext",&var);
  if (SUCCEEDED(hr))
  {
    //Build the WKGUID binding string.
    wcscpy(szPath,L"LDAP://");
    wcscat(szPath,L"<WKGUID=");
    wcscat(szPath,szBindableWKGUID);
    wcscat(szPath,L",");
    wcscat(szPath,V_BSTR(&var));
    wcscat(szPath,L">");
    //Print the binding string.
    //wprintf(L"WKGUID binding string: %s\n",szPath);
    VariantClear(&var);
    //Bind to the well-known object.
    hr = ADsOpenObject(szPath,
             NULL,
             NULL,
             ADS_SECURE_AUTHENTICATION, //Use Secure Authentication
             IID_IADs,
             (void**)ppObject);
    if (FAILED(hr))
    {
      if (*ppObject)
      {
        (*ppObject)->Release();
        (*ppObject) = NULL;
      }
    }
  }
}
if (pObject)
  pObject->Release();

return hr;
}

void wmain | ( | int | argc,
 |  | wchar_t * | argv[]
 | ) |  |

Definition at line 20 of file wkguid.cpp.

{
wprintf(L"This program finds the User's container in the current Window 2000 domain\n");
wprintf(L"It uses the WKGUID binding string format.\n");
//Intialize COM
CoInitialize(NULL);
HRESULT hr = S_OK;
//Get rootDSE and the domain container's DN.
IADs *pObject = NULL;
hr = GetWKDomainObject(GUID_USERS_CONTAINER_W, //IN. Bindable string GUID of Users container.
              &pObject //OUT. Return a pointer to the specified well-known object.
              );
if (FAILED(hr))
{
   wprintf(L"Not Found. Could not bind to the User container.\n");
   if (pObject)
     pObject->Release();
   return;
}

BSTR bstr = NULL;
hr = pObject->get_ADsPath(&bstr);
if (SUCCEEDED(hr))
{
    wprintf (L"\nADsPath of Users Container (using WKGUID binding format):\n%s\n", bstr);
    FreeADsStr(bstr);
}

hr = pObject->get_Name(&bstr);
if (SUCCEEDED(hr))
{
    wprintf (L"\nName of Users Container (using WKGUID binding format):\n%s\n", bstr);
    FreeADsStr(bstr);
}

VARIANT var;
VariantInit(&var);
hr = pObject->Get(L"distinguishedName",&var);
if (SUCCEEDED(hr))
{
    wprintf (L"\nName of Users Container: %s\n", V_BSTR(&var));
}
VariantClear(&var);

if (pObject)
  pObject->Release();

//Uninitalize COM
CoUninitialize();
return;

}

Generated on Wed Nov 13 2024 16:53:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/scpext/scpcmenu/dsmenu.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • scpext
  • scpcmenu
Defines | Functions

dsmenu.cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include "SCPCMenu.h"
#include "dsmenu.h"
#include "SCPCMenuUI.h"
#include <dsclient.h>

Go to the source code of this file.

Defines

#define | ARRAYLEN(x) (sizeof(x) / sizeof((x)[0]))

Functions

BOOL | _InsertMenuHelper (HMENU hMenu, UINT uPosition, UINT uFlags, UINT_PTR uIDNewItem, LPCTSTR lpNewItem, UINT *pnCurrentCount)

Define Documentation

#define ARRAYLEN ( x ) (sizeof(x) / sizeof((x)[0]))

Definition at line 22 of file dsmenu.cpp.

Function Documentation

BOOL _InsertMenuHelper | ( | HMENU | hMenu,
 |  | UINT | uPosition,
 |  | UINT | uFlags,
 |  | UINT_PTR | uIDNewItem,
 |  | LPCTSTR | lpNewItem,
 |  | UINT * | pnCurrentCount
 | ) |  |

Definition at line 66 of file dsmenu.cpp.

{
  if (::InsertMenu(hMenu, uPosition, uFlags, uIDNewItem, lpNewItem))
  {
    (*pnCurrentCount)++;
    return TRUE;
  }
  return FALSE;
}

Generated on Wed Nov 13 2024 16:53:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/scpext/scpcmenu/dsmenu.h File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • scpext
  • scpcmenu
Classes

dsmenu.h File Reference

Go to the source code of this file.

Classes

class CContextMenu
Generated on Wed Nov 13 2024 16:53:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/scpext/scpcmenu/resource.h File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • scpext
  • scpcmenu
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_CLASS_EDIT 1008
#define | IDC_PATH_EDIT 1007
#define | IDC_PREFIX_EDIT 1003
#define | IDC_SERVER_CONFIG_PATH_EDIT 1006
#define | IDC_SERVER_EDIT 1005
#define | IDC_USER_EDIT 1004
#define | IDD_SCP_MENU_DIALOG 101
#define | IDS_SCP_MENU 2
#define | IDS_TEST_STRING 1

Define Documentation

#define IDC_CLASS_EDIT 1008

Definition at line 23 of file resource.h.

#define IDC_PATH_EDIT 1007

Definition at line 22 of file resource.h.

#define IDC_PREFIX_EDIT 1003

Definition at line 18 of file resource.h.

#define IDC_SERVER_CONFIG_PATH_EDIT 1006

Definition at line 21 of file resource.h.

#define IDC_SERVER_EDIT 1005

Definition at line 20 of file resource.h.

#define IDC_USER_EDIT 1004

Definition at line 19 of file resource.h.

#define IDD_SCP_MENU_DIALOG 101

Definition at line 17 of file resource.h.

#define IDS_SCP_MENU 2

Definition at line 16 of file resource.h.

#define IDS_TEST_STRING 1

Definition at line 15 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/scpext/scpcmenu/SCPCMenu.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • scpext
  • scpcmenu
Classes | Functions | Variables

SCPCMenu.cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include "initguid.h"
#include <dsadmin.h>
#include "SCPCMenu.h"
#include "dsmenu.h"

Go to the source code of this file.

Classes

class | CSCPCMenuApp

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CSCPContextMenuModule _Module
CSCPCMenuApp theApp
BOOL | x = TRUE

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 61 of file SCPCMenu.cpp.

{
  AFX_MANAGE_STATE(AfxGetStaticModuleState());
  return (AfxDllCanUnloadNow()==S_OK && _Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 70 of file SCPCMenu.cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

STDAPI DllRegisterServer ( void )

Definition at line 79 of file SCPCMenu.cpp.

{
    return _Module.RegisterServer(FALSE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 87 of file SCPCMenu.cpp.

{
  _Module.UnregisterServer();
  return S_OK;
}

Variable Documentation

CSCPContextMenuModule _Module

Definition at line 31 of file SCPCMenu.cpp.

CSCPCMenuApp theApp

Definition at line 44 of file SCPCMenu.cpp.

BOOL x = TRUE

Definition at line 78 of file SCPCMenu.cpp.

Generated on Wed Nov 13 2024 16:53:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/scpext/scpcmenu/SCPCMenu.h File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • scpext
  • scpcmenu
Variables

SCPCMenu.h File Reference

Go to the source code of this file.

Variables

const CLSID CLSID_SCPContextMenu

Variable Documentation

const CLSID CLSID_SCPContextMenu
Generated on Wed Nov 13 2024 16:53:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/scpext/scpcmenu/scpcmenuui.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • scpext
  • scpcmenu

scpcmenuui.cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include "SCPCMenuUI.h"
#include <dsclient.h>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/scpext/scpcmenu/scpcmenuui.h File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • scpext
  • scpcmenu
Classes | Defines

scpcmenuui.h File Reference

Go to the source code of this file.

Classes

class | CSCPCMenuDialog

Defines

#define | BYTE_OFFSET(base, offset) (((LPBYTE)base)+offset)

Define Documentation

#define BYTE_OFFSET | ( | base,
 |  | offset |
 | ) |  | (((LPBYTE)base)+offset)

Definition at line 14 of file scpcmenuui.h.

Generated on Wed Nov 13 2024 16:53:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/scpext/scpcmenu/StdAfx.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • scpext
  • scpcmenu

StdAfx.cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/scpext/scpcmenu/StdAfx.h File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • scpext
  • scpcmenu
Classes | Defines | Variables

StdAfx.h File Reference

#include <afxwin.h>
#include <afxdisp.h>
#include "afxdlgs.h"
#include <xstring>
#include <vector>
#include <list>
#include <activeds.h>
#include <dsadmin.h>
#include <atlbase.h>
#include <atlcom.h>
#include <shellapi.h>
#include <dlgs.h>
#include <atlwin21.h>
#include <atldlgs.h>

Go to the source code of this file.

Classes

class | CSCPContextMenuModule

Defines

#define | _ATL_APARTMENT_THREADED
#define | DECLARE_REGISTRY_CLSID()
#define | STRICT

Variables

CSCPContextMenuModule _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 32 of file StdAfx.h.

#define DECLARE_REGISTRY_CLSID ( )
Value:
static HRESULT WINAPI UpdateRegistry(BOOL bRegister) \
{ \
    return _Module.UpdateRegistryCLSID(GetObjectCLSID(), bRegister); \
}

Definition at line 60 of file StdAfx.h.

#define STRICT

Definition at line 24 of file StdAfx.h.

Variable Documentation

CSCPContextMenuModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/scpext/scpproppage/resource.h File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • scpext
  • scpproppage
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_ADD_BUTTON 1013
#define | IDC_DELETE_BUTTON 1016
#define | IDC_DESCRIPTION_EDIT 1003
#define | IDC_DNS_NAME_EDIT 1001
#define | IDC_DNS_NAME_TYPE_EDIT 1018
#define | IDC_EDIT_BUTTON 1015
#define | IDC_KEYWORD_EDIT 1011
#define | IDC_KEYWORD_LIST 1012
#define | IDC_NAME_EDIT 1017
#define | IDC_SERVICE_CLASS_EDIT 1004
#define | IDD_SCP_BINDING_INFO_PAGE 103
#define | IDD_SCP_GENERAL_PAGE 102
#define | IDD_SCP_KEYWORDS_PAGE 107

Define Documentation

#define IDC_ADD_BUTTON 1013

Definition at line 23 of file resource.h.

#define IDC_DELETE_BUTTON 1016

Definition at line 25 of file resource.h.

#define IDC_DESCRIPTION_EDIT 1003

Definition at line 19 of file resource.h.

#define IDC_DNS_NAME_EDIT 1001

Definition at line 18 of file resource.h.

#define IDC_DNS_NAME_TYPE_EDIT 1018

Definition at line 27 of file resource.h.

#define IDC_EDIT_BUTTON 1015

Definition at line 24 of file resource.h.

#define IDC_KEYWORD_EDIT 1011

Definition at line 21 of file resource.h.

#define IDC_KEYWORD_LIST 1012

Definition at line 22 of file resource.h.

#define IDC_NAME_EDIT 1017

Definition at line 26 of file resource.h.

#define IDC_SERVICE_CLASS_EDIT 1004

Definition at line 20 of file resource.h.

#define IDD_SCP_BINDING_INFO_PAGE 103

Definition at line 16 of file resource.h.

#define IDD_SCP_GENERAL_PAGE 102

Definition at line 15 of file resource.h.

#define IDD_SCP_KEYWORDS_PAGE 107

Definition at line 17 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/scpext/scpproppage/SCP.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • scpext
  • scpproppage

SCP.cpp File Reference

#include "stdafx.h"
#include "SCP.h"
#include "util.h"
#include "adsprop.h"
#include "dsclient.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/scpext/scpproppage/SCP.h File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • scpext
  • scpproppage
Classes

SCP.h File Reference

#include "stdafx.h"
#include "SCPProppage.h"
#include "SCPUI.h"

Go to the source code of this file.

Classes

class CSCP
Generated on Wed Nov 13 2024 16:53:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/scpext/scpproppage/SCPProppage.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • scpext
  • scpproppage
Classes | Functions | Variables

SCPProppage.cpp File Reference

#include "stdafx.h"
#include <objbase.h>
#include <initguid.h>
#include <dsadmin.h>
#include "resource.h"
#include "SCPProppage.h"
#include "SCP.h"

Go to the source code of this file.

Classes

class | CMyUIExtApp

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CMyUIExtModule _Module
CMyUIExtApp theApp
BOOL | x = TRUE

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 65 of file SCPProppage.cpp.

{
  AFX_MANAGE_STATE(AfxGetStaticModuleState());
  return (AfxDllCanUnloadNow()==S_OK && _Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 74 of file SCPProppage.cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

STDAPI DllRegisterServer ( void )

Definition at line 83 of file SCPProppage.cpp.

{
    return _Module.RegisterServer(FALSE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 91 of file SCPProppage.cpp.

{
  _Module.UnregisterServer();
  return S_OK;
}

Variable Documentation

CMyUIExtModule _Module

Definition at line 35 of file SCPProppage.cpp.

CMyUIExtApp theApp

Definition at line 48 of file SCPProppage.cpp.

BOOL x = TRUE

Definition at line 82 of file SCPProppage.cpp.

Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/scpext/scpproppage/SCPProppage.h File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • scpext
  • scpproppage
Variables

SCPProppage.h File Reference

Go to the source code of this file.

Variables

const GUID CLSID_ProppageSCP

Variable Documentation

const GUID CLSID_ProppageSCP
Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/scpext/scpproppage/SCPUI.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • scpext
  • scpproppage

SCPUI.cpp File Reference

#include "stdafx.h"
#include "SCPUI.h"
#include "util.h"
#include "adsprop.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/scpext/scpproppage/SCPUI.h File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • scpext
  • scpproppage
Classes

SCPUI.h File Reference

#include "resource.h"
#include "util.h"
#include "resource.h"
#include "util.h"

Go to the source code of this file.

Classes

class | CSCPUIBindingInfo
class | CSCPUIGeneral
class | CSCPUIKeywords
Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/scpext/scpproppage/StdAfx.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • scpext
  • scpproppage

StdAfx.cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/scpext/scpproppage/StdAfx.h File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • scpext
  • scpproppage
Classes | Defines | Variables

StdAfx.h File Reference

#include <afxwin.h>
#include <afxdisp.h>
#include "afxdlgs.h"
#include <activeds.h>
#include <dsadmin.h>
#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Classes

class | CMyUIExtModule

Defines

#define | _ATL_APARTMENT_THREADED
#define | DECLARE_REGISTRY_CLSID()
#define | STRICT

Variables

CMyUIExtModule _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 30 of file StdAfx.h.

#define DECLARE_REGISTRY_CLSID ( )
Value:
static HRESULT WINAPI UpdateRegistry(BOOL bRegister) \
{ \
    return _Module.UpdateRegistryCLSID(GetObjectCLSID(), bRegister); \
}

Definition at line 50 of file StdAfx.h.

#define STRICT

Definition at line 22 of file StdAfx.h.

Variable Documentation

CMyUIExtModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/scpext/scpproppage/util.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • scpext
  • scpproppage
Functions

util.cpp File Reference

#include "stdafx.h"
#include "util.h"

Go to the source code of this file.

Functions

HRESULT SetStringAttribute (IADs *pIADs, LPCWSTR lpszAttr, LPCWSTR lpszValue)

Function Documentation

HRESULT SetStringAttribute | ( | IADs * | pIADs,
 |  | LPCWSTR | lpszAttr,
 |  | LPCWSTR | lpszValue
 | ) |  |

Definition at line 14 of file util.cpp.

{
  ASSERT(pIADs != NULL);
  ASSERT(lpszAttr != NULL);

  //
  // Allocate the string
  //
  BSTR bstrAttr = ::SysAllocString(lpszAttr);

  //
  // Imbed the value in a VARIANT
  //
  HRESULT hr = S_OK;
  CComVariant varValue;
  varValue.vt = VT_BSTR;
  varValue.bstrVal = ::SysAllocString(lpszValue);

  //
  // Set the value in the temporary object
  //
  hr = pIADs->Put(bstrAttr, varValue);

  //
  // Clean up memory
  //
  ::SysFreeString(bstrAttr);
  return hr;
}

Generated on Wed Nov 13 2024 16:53:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/scpext/scpproppage/util.h File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • scpext
  • scpproppage
Classes | Defines | Functions

util.h File Reference

Go to the source code of this file.

Classes

class | CAttributeValueAddButton
class | CAttributeValueDeleteButton
class | CAttributeValueEditButton
class | CAttributeValueEditor
class | CMultiValuedAttributeEditor
class | CMultiValuedListBox

Defines

#define | BYTE_OFFSET(base, offset) (((LPBYTE)base)+offset)

Functions

HRESULT | SetStringAttribute (IADs *pIADs, LPCWSTR lpszAttr, LPCWSTR lpszValue)

Define Documentation

#define BYTE_OFFSET | ( | base,
 |  | offset |
 | ) |  | (((LPBYTE)base)+offset)

Definition at line 14 of file util.h.

Function Documentation

HRESULT SetStringAttribute | ( | IADs * | pIADs,
 |  | LPCWSTR | lpszAttr,
 |  | LPCWSTR | lpszValue
 | ) |  |

Definition at line 14 of file util.cpp.

{
  ASSERT(pIADs != NULL);
  ASSERT(lpszAttr != NULL);

  //
  // Allocate the string
  //
  BSTR bstrAttr = ::SysAllocString(lpszAttr);

  //
  // Imbed the value in a VARIANT
  //
  HRESULT hr = S_OK;
  CComVariant varValue;
  varValue.vt = VT_BSTR;
  varValue.bstrVal = ::SysAllocString(lpszValue);

  //
  // Set the value in the temporary object
  //
  hr = pIADs->Put(bstrAttr, varValue);

  //
  // Clean up memory
  //
  ::SysFreeString(bstrAttr);
  return hr;
}

Generated on Wed Nov 13 2024 16:53:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/scpext/scpwizard/resource.h File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • scpext
  • scpwizard
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_ADD_BUTTON 1013
#define | IDC_BINDING_INFO_EDIT 1002
#define | IDC_DELETE_BUTTON 1016
#define | IDC_DESCRIPTION_EDIT 1003
#define | IDC_DNS_NAME_EDIT 1001
#define | IDC_DNS_NAME_TYPE_EDIT 1018
#define | IDC_EDIT_BUTTON 1015
#define | IDC_EDIT_CONTAINER 1006
#define | IDC_KEYWORD_EDIT 1011
#define | IDC_KEYWORD_LIST 1012
#define | IDC_NAME_EDIT 1017
#define | IDC_PRODUCT_GUID_EDIT 1008
#define | IDC_PRODUCT_NAME_EDIT 1007
#define | IDC_PRODUCT_VERSION_EDIT 1009
#define | IDC_SERVICE_CLASS_EDIT 1004
#define | IDC_STATIC_ICON 1005
#define | IDC_VENDOR_GUID_EDIT 1006
#define | IDC_VENDOR_NAME_EDIT 1005
#define | IDC_VERSION_GUIO_EDIT 1010
#define | IDD_SCP_GENERAL_PAGE 102
#define | IDD_SCP_KEYWORDS_PAGE 107
#define | IDD_SCP_PAGE_BINDING_INFO 107
#define | IDD_SCP_PAGE_GENERAL 102
#define | IDD_SCP_PAGE_KEYWORDS 106

Define Documentation

#define IDC_ADD_BUTTON 1013

Definition at line 34 of file resource.h.

#define IDC_BINDING_INFO_EDIT 1002

Definition at line 21 of file resource.h.

#define IDC_DELETE_BUTTON 1016

Definition at line 36 of file resource.h.

#define IDC_DESCRIPTION_EDIT 1003

Definition at line 22 of file resource.h.

#define IDC_DNS_NAME_EDIT 1001

Definition at line 20 of file resource.h.

#define IDC_DNS_NAME_TYPE_EDIT 1018

Definition at line 38 of file resource.h.

#define IDC_EDIT_BUTTON 1015

Definition at line 35 of file resource.h.

#define IDC_EDIT_CONTAINER 1006

Definition at line 27 of file resource.h.

#define IDC_KEYWORD_EDIT 1011

Definition at line 32 of file resource.h.

#define IDC_KEYWORD_LIST 1012

Definition at line 33 of file resource.h.

#define IDC_NAME_EDIT 1017

Definition at line 37 of file resource.h.

#define IDC_PRODUCT_GUID_EDIT 1008

Definition at line 29 of file resource.h.

#define IDC_PRODUCT_NAME_EDIT 1007

Definition at line 28 of file resource.h.

#define IDC_PRODUCT_VERSION_EDIT 1009

Definition at line 30 of file resource.h.

#define IDC_SERVICE_CLASS_EDIT 1004

Definition at line 23 of file resource.h.

#define IDC_STATIC_ICON 1005

Definition at line 25 of file resource.h.

#define IDC_VENDOR_GUID_EDIT 1006

Definition at line 26 of file resource.h.

#define IDC_VENDOR_NAME_EDIT 1005

Definition at line 24 of file resource.h.

#define IDC_VERSION_GUIO_EDIT 1010

Definition at line 31 of file resource.h.

#define IDD_SCP_GENERAL_PAGE 102

Definition at line 15 of file resource.h.

#define IDD_SCP_KEYWORDS_PAGE 107

Definition at line 18 of file resource.h.

#define IDD_SCP_PAGE_BINDING_INFO 107

Definition at line 19 of file resource.h.

#define IDD_SCP_PAGE_GENERAL 102

Definition at line 16 of file resource.h.

#define IDD_SCP_PAGE_KEYWORDS 106

Definition at line 17 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/scpext/scpwizard/SCPPageUI.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • scpext
  • scpwizard

SCPPageUI.cpp File Reference

#include "stdafx.h"
#include "SCPPageUI.h"
#include "SCPWiz.h"
#include "util.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/scpext/scpwizard/SCPPageUI.h File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • scpext
  • scpwizard
Classes

SCPPageUI.h File Reference

#include "resource.h"
#include "util.h"
#include "resource.h"
#include "util.h"

Go to the source code of this file.

Classes

class | CSCPPageBindingInfo
class | CSCPPageGeneral
class | CSCPPageKeywords
Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/scpext/scpwizard/SCPWiz.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • scpext
  • scpwizard

SCPWiz.cpp File Reference

#include "stdafx.h"
#include "SCPWiz.h"
#include "util.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/scpext/scpwizard/SCPWiz.h File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • scpext
  • scpwizard
Classes

SCPWiz.h File Reference

#include "resource.h"
#include "SCPWizard.h"
#include "SCPPageUI.h"

Go to the source code of this file.

Classes

class CSCPWiz
Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/scpext/scpwizard/SCPWizard.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • scpext
  • scpwizard
Classes | Functions | Variables

SCPWizard.cpp File Reference

#include "stdafx.h"
#include <objbase.h>
#include <initguid.h>
#include <dsadmin.h>
#include "resource.h"
#include "SCPWizard.h"
#include "SCPWiz.h"

Go to the source code of this file.

Classes

class | CSCPWizApp

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CSCPWizModule _Module
CSCPWizApp theApp
BOOL | x = TRUE

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 65 of file SCPWizard.cpp.

{
  AFX_MANAGE_STATE(AfxGetStaticModuleState());
  return (AfxDllCanUnloadNow()==S_OK && _Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 74 of file SCPWizard.cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

STDAPI DllRegisterServer ( void )

Definition at line 83 of file SCPWizard.cpp.

{
    return _Module.RegisterServer(FALSE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 91 of file SCPWizard.cpp.

{
  _Module.UnregisterServer();
  return S_OK;
}

Variable Documentation

CSCPWizModule _Module

Definition at line 35 of file SCPWizard.cpp.

CSCPWizApp theApp

Definition at line 48 of file SCPWizard.cpp.

BOOL x = TRUE

Definition at line 82 of file SCPWizard.cpp.

Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/scpext/scpwizard/SCPWizard.h File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • scpext
  • scpwizard
Variables

SCPWizard.h File Reference

Go to the source code of this file.

Variables

const GUID CLSID_SCPWizard

Variable Documentation

const GUID CLSID_SCPWizard
Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/scpext/scpwizard/StdAfx.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • scpext
  • scpwizard

StdAfx.cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/scpext/scpwizard/StdAfx.h File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • scpext
  • scpwizard
Classes | Defines | Variables

StdAfx.h File Reference

#include <afxwin.h>
#include <afxdisp.h>
#include "afxdlgs.h"
#include <activeds.h>
#include <dsadmin.h>
#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Classes

class | CSCPWizModule

Defines

#define | _ATL_APARTMENT_THREADED
#define | DECLARE_REGISTRY_CLSID()
#define | STRICT

Variables

CSCPWizModule _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 30 of file StdAfx.h.

#define DECLARE_REGISTRY_CLSID ( )
Value:
static HRESULT WINAPI UpdateRegistry(BOOL bRegister) \
{ \
    return _Module.UpdateRegistryCLSID(GetObjectCLSID(), bRegister); \
}

Definition at line 50 of file StdAfx.h.

#define STRICT

Definition at line 22 of file StdAfx.h.

Variable Documentation

CSCPWizModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/scpext/scpwizard/util.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • scpext
  • scpwizard
Functions

util.cpp File Reference

#include "stdafx.h"
#include "util.h"

Go to the source code of this file.

Functions

HRESULT | SetStringAttribute (IADs *pIADs, LPCWSTR lpszAttr, LPCWSTR lpszValue)
HRESULT | SetStringListAttribute (IADs *pIADs, LPCWSTR lpszAttr, CStringList &szValueList)
HRESULT | StringListToVariant (VARIANT &refvar, const CStringList &refstringlist)

Function Documentation

HRESULT SetStringAttribute | ( | IADs * | pIADs,
 |  | LPCWSTR | lpszAttr,
 |  | LPCWSTR | lpszValue
 | ) |  |

Definition at line 14 of file util.cpp.

{
  ASSERT(pIADs != NULL);
  ASSERT(lpszAttr != NULL);

  // Allocate the string
  BSTR bstrAttr = ::SysAllocString(lpszAttr);

  // Imbed the value in a VARIANT
  HRESULT hr = S_OK;
  CComVariant varValue;
  varValue.vt = VT_BSTR;
  varValue.bstrVal = ::SysAllocString(lpszValue);

  // Set the value in the temporary object
  hr = pIADs->Put(bstrAttr, varValue);

  // Clean up memory
  ::SysFreeString(bstrAttr);
  return hr;
}

HRESULT SetStringListAttribute | ( | IADs * | pIADs,
 |  | LPCWSTR | lpszAttr,
 |  | CStringList & | szValueList
 | ) |  |

Definition at line 36 of file util.cpp.

{
  CComVariant var;
  HRESULT hr = S_OK;

  hr = StringListToVariant(var, szValueList);
  if (SUCCEEDED(hr))
  {
    BSTR bstrAttr = ::SysAllocString(lpszAttr);
    hr = pIADs->Put(bstrAttr, var);
    ::SysFreeString(bstrAttr);
  }
  return hr;
}

HRESULT StringListToVariant | ( | VARIANT & | refvar,
 |  | const CStringList & | refstringlist
 | ) |  |

Definition at line 51 of file util.cpp.

{
  HRESULT hr = S_OK;
  int cCount = refstringlist.GetCount();

  SAFEARRAYBOUND rgsabound[1];
  rgsabound[0].lLbound = 0;
  rgsabound[0].cElements = cCount;

  SAFEARRAY* psa = SafeArrayCreate(VT_VARIANT, 1, rgsabound);
  if (NULL == psa)
    return E_OUTOFMEMORY;

  VariantClear( &refvar );
  V_VT(&refvar) = VT_VARIANT|VT_ARRAY;
  V_ARRAY(&refvar) = psa;

  VARIANT SingleResult;
  VariantInit( &SingleResult );
  V_VT(&SingleResult) = VT_BSTR;
  POSITION pos = refstringlist.GetHeadPosition();
  long i;
  for (i = 0; i < cCount, pos != NULL; i++)
  {
    V_BSTR(&SingleResult) = T2BSTR((LPCTSTR)refstringlist.GetNext(pos));
    hr = SafeArrayPutElement(psa, &i, &SingleResult);
    if( FAILED(hr) )
      return hr;
  }
  if (i != cCount || pos != NULL)
    return E_UNEXPECTED;

  return hr;
} // StringListToVariant()

Generated on Wed Nov 13 2024 16:53:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/scpext/scpwizard/util.h File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • scpext
  • scpwizard
Classes | Defines | Functions

util.h File Reference

Go to the source code of this file.

Classes

class | CAttributeValueAddButton
class | CAttributeValueDeleteButton
class | CAttributeValueEditor
class | CMultiValuedAttributeEditor
class | CMultiValuedListBox

Defines

#define | BYTE_OFFSET(base, offset) (((LPBYTE)base)+offset)

Functions

HRESULT | SetStringAttribute (IADs *pIADs, LPCWSTR lpszAttr, LPCWSTR lpszValue)
HRESULT | SetStringListAttribute (IADs *pIADs, LPCWSTR lpszAttr, CStringList &szValueList)
HRESULT | StringListToVariant (VARIANT &refvar, const CStringList &refstringlist)

Define Documentation

#define BYTE_OFFSET | ( | base,
 |  | offset |
 | ) |  | (((LPBYTE)base)+offset)

Definition at line 14 of file util.h.

Function Documentation

HRESULT SetStringAttribute | ( | IADs * | pIADs,
 |  | LPCWSTR | lpszAttr,
 |  | LPCWSTR | lpszValue
 | ) |  |

Definition at line 14 of file util.cpp.

{
  ASSERT(pIADs != NULL);
  ASSERT(lpszAttr != NULL);

  //
  // Allocate the string
  //
  BSTR bstrAttr = ::SysAllocString(lpszAttr);

  //
  // Imbed the value in a VARIANT
  //
  HRESULT hr = S_OK;
  CComVariant varValue;
  varValue.vt = VT_BSTR;
  varValue.bstrVal = ::SysAllocString(lpszValue);

  //
  // Set the value in the temporary object
  //
  hr = pIADs->Put(bstrAttr, varValue);

  //
  // Clean up memory
  //
  ::SysFreeString(bstrAttr);
  return hr;
}

HRESULT SetStringListAttribute | ( | IADs * | pIADs,
 |  | LPCWSTR | lpszAttr,
 |  | CStringList & | szValueList
 | ) |  |

Definition at line 36 of file util.cpp.

{
  CComVariant var;
  HRESULT hr = S_OK;

  hr = StringListToVariant(var, szValueList);
  if (SUCCEEDED(hr))
  {
    BSTR bstrAttr = ::SysAllocString(lpszAttr);
    hr = pIADs->Put(bstrAttr, var);
    ::SysFreeString(bstrAttr);
  }
  return hr;
}

HRESULT StringListToVariant | ( | VARIANT & | refvar,
 |  | const CStringList & | refstringlist
 | ) |  |

Definition at line 51 of file util.cpp.

{
  HRESULT hr = S_OK;
  int cCount = refstringlist.GetCount();

  SAFEARRAYBOUND rgsabound[1];
  rgsabound[0].lLbound = 0;
  rgsabound[0].cElements = cCount;

  SAFEARRAY* psa = SafeArrayCreate(VT_VARIANT, 1, rgsabound);
  if (NULL == psa)
    return E_OUTOFMEMORY;

  VariantClear( &refvar );
  V_VT(&refvar) = VT_VARIANT|VT_ARRAY;
  V_ARRAY(&refvar) = psa;

  VARIANT SingleResult;
  VariantInit( &SingleResult );
  V_VT(&SingleResult) = VT_BSTR;
  POSITION pos = refstringlist.GetHeadPosition();
  long i;
  for (i = 0; i < cCount, pos != NULL; i++)
  {
    V_BSTR(&SingleResult) = T2BSTR((LPCTSTR)refstringlist.GetNext(pos));
    hr = SafeArrayPutElement(psa, &i, &SingleResult);
    if( FAILED(hr) )
      return hr;
  }
  if (i != cCount || pos != NULL)
    return E_UNEXPECTED;

  return hr;
} // StringListToVariant()

Generated on Wed Nov 13 2024 16:53:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/userext/userproppage/proppageuser.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • userext
  • userproppage

proppageuser.cpp File Reference

#include "stdafx.h"
#include "ProppageUser.h"
#include "util.h"
#include "adsprop.h"
#include "dsclient.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/userext/userproppage/proppageuser.h File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • userext
  • userproppage
Classes

proppageuser.h File Reference

#include "stdafx.h"
#include "userproppage.h"
#include "ProppageUserUI.h"

Go to the source code of this file.

Classes

class CProppageUser
Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/userext/userproppage/proppageuserui.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • userext
  • userproppage

proppageuserui.cpp File Reference

#include "stdafx.h"
#include "ProppageUserUI.h"
#include "util.h"
#include "adsprop.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/userext/userproppage/proppageuserui.h File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • userext
  • userproppage
Classes

proppageuserui.h File Reference

#include "resource.h"
#include "util.h"
#include "resource.h"
#include "util.h"

Go to the source code of this file.

Classes

class CProppageUserUI
Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/userext/userproppage/resource.h File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • userext
  • userproppage
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_BUTTON_CHANGE_PICTURE 1002
#define | IDC_BUTTON_CLEAR_PICTURE 1004
#define | IDC_EDIT_EMPLOYEE_ID 1003
#define | IDC_EDIT_PICTURE_PATH 1000
#define | IDC_PICTURE_DISPLAY 1001
#define | IDD_USER_PAGE_EXT 107

Define Documentation

#define IDC_BUTTON_CHANGE_PICTURE 1002

Definition at line 18 of file resource.h.

#define IDC_BUTTON_CLEAR_PICTURE 1004

Definition at line 20 of file resource.h.

#define IDC_EDIT_EMPLOYEE_ID 1003

Definition at line 19 of file resource.h.

#define IDC_EDIT_PICTURE_PATH 1000

Definition at line 16 of file resource.h.

#define IDC_PICTURE_DISPLAY 1001

Definition at line 17 of file resource.h.

#define IDD_USER_PAGE_EXT 107

Definition at line 15 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/userext/userproppage/stdafx.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • userext
  • userproppage

stdafx.cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/userext/userproppage/stdafx.h File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • userext
  • userproppage
Classes | Defines | Variables

stdafx.h File Reference

#include <afxwin.h>
#include <afxdisp.h>
#include "afxdlgs.h"
#include <activeds.h>
#include <dsadmin.h>
#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Classes

class | CMyUIExtModule

Defines

#define | _ATL_APARTMENT_THREADED
#define | DECLARE_REGISTRY_CLSID()
#define | STRICT

Variables

CMyUIExtModule _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 30 of file stdafx.h.

#define DECLARE_REGISTRY_CLSID ( )
Value:
static HRESULT WINAPI UpdateRegistry(BOOL bRegister) \
{ \
    return _Module.UpdateRegistryCLSID(GetObjectCLSID(), bRegister); \
}

Definition at line 51 of file stdafx.h.

#define STRICT

Definition at line 22 of file stdafx.h.

Variable Documentation

CMyUIExtModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/userext/userproppage/userproppage.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • userext
  • userproppage
Classes | Functions | Variables

userproppage.cpp File Reference

#include "stdafx.h"
#include <objbase.h>
#include <initguid.h>
#include <dsadmin.h>
#include "resource.h"
#include "userproppage.h"
#include "ProppageUser.h"

Go to the source code of this file.

Classes

class | CMyUIExtApp

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CMyUIExtModule _Module
CMyUIExtApp theApp
BOOL | x = TRUE

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 65 of file userproppage.cpp.

{
  AFX_MANAGE_STATE(AfxGetStaticModuleState());
  return (AfxDllCanUnloadNow()==S_OK && _Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 74 of file userproppage.cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

STDAPI DllRegisterServer ( void )

Definition at line 83 of file userproppage.cpp.

{
    return _Module.RegisterServer(FALSE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 91 of file userproppage.cpp.

{
  _Module.UnregisterServer();
  return S_OK;
}

Variable Documentation

CMyUIExtModule _Module

Definition at line 35 of file userproppage.cpp.

CMyUIExtApp theApp

Definition at line 48 of file userproppage.cpp.

BOOL x = TRUE

Definition at line 82 of file userproppage.cpp.

Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/userext/userproppage/userproppage.h File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • userext
  • userproppage
Variables

userproppage.h File Reference

Go to the source code of this file.

Variables

const GUID CLSID_ProppageUser

Variable Documentation

const GUID CLSID_ProppageUser
Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/userext/userproppage/util.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • userext
  • userproppage
Functions

util.cpp File Reference

#include "stdafx.h"
#include "util.h"

Go to the source code of this file.

Functions

HRESULT | _ClearAttribute (IADs *pIADs, BSTR bstrAttrName, BOOL bPostCommit)
HRESULT | GetStringAttribute (IADs *pIADs, LPCWSTR lpszAttr, CString &szVal)
BOOL | LoadFileAsByteArray (PWSTR pszPath, LPBYTE *ppByteArray, DWORD *pdwSize)
HRESULT | SetByteArrayAsOctetString (IADs *pIADs, LPCWSTR lpszAttr, BYTE *pByteArray, DWORD dwSize)
HRESULT | SetStringAttribute (IADs *pIADs, LPCWSTR lpszAttr, LPCWSTR lpszVal, BOOL bPostCommit)

Function Documentation

HRESULT _ClearAttribute | ( | IADs * | pIADs,
 |  | BSTR | bstrAttrName,
 |  | BOOL | bPostCommit
 | ) |  |

Definition at line 16 of file util.cpp.

{
  ASSERT(pIADs != NULL);
  ASSERT(bstrAttrName != NULL);
  HRESULT hr = S_OK;

  VARIANT varVal;
  ::VariantInit(&varVal);

  // see if the attribute is there
  HRESULT hrFind = pIADs->Get(bstrAttrName, &varVal);
  if (SUCCEEDED(hrFind))
  {
    // found, need to clear the property
    if (bPostCommit)
    {
      // remove from the committed object
      hr = pIADs->PutEx(ADS_PROPERTY_CLEAR, bstrAttrName, varVal);
    }
    else
    {
      // remove from the cache of the temporary object
      IADsPropertyList* pPropList = NULL;
      hr = pIADs->QueryInterface(IID_IADsPropertyList, (void**)&pPropList);
      ASSERT(pPropList != NULL);
      if (SUCCEEDED(hr))
      {
        VARIANT v;
        ::VariantInit(&v);
        v.vt = VT_BSTR;
        v.bstrVal = ::SysAllocString(bstrAttrName);
        hr = pPropList->ResetPropertyItem(v);
        ::VariantClear(&v);
        pPropList->Release();
      }
    }
  }

  ::VariantClear(&varVal);
  return hr;
}

HRESULT GetStringAttribute | ( | IADs * | pIADs,
 |  | LPCWSTR | lpszAttr,
 |  | CString & | szVal
 | ) |  |

Definition at line 90 of file util.cpp.

{
  ASSERT(pIADs != NULL);
  VARIANT varVal;
  ::VariantInit(&varVal);

  BSTR bstrAttr = ::SysAllocString(lpszAttr);

  szVal.Empty();
  HRESULT hr = pIADs->Get(bstrAttr, &varVal);
  if (SUCCEEDED(hr))
  {
    if (varVal.vt == VT_BSTR)
      szVal = varVal.bstrVal;
    else
      hr = E_INVALIDARG;
  }
  VariantClear(&varVal);
  ::SysFreeString(bstrAttr);

  TRACE(_T("GetStringAttribute()lpszAttr = <%s>, (LPCWSTR)szVal = <%s>\n"), lpszAttr, szVal);
  return hr;
}

BOOL LoadFileAsByteArray | ( | PWSTR | pszPath,
 |  | LPBYTE * | ppByteArray,
 |  | DWORD * | pdwSize
 | ) |  |

Definition at line 154 of file util.cpp.

{
  CFile file;
  if (!file.Open(pszPath, CFile::modeRead | CFile::shareDenyNone | CFile::typeBinary))
  {
    AfxMessageBox(_T("Failed to open file."));
    return FALSE;
  }

  *pdwSize = file.GetLength();
  *ppByteArray = new BYTE[*pdwSize];
  ASSERT(*ppByteArray != NULL);

  UINT uiCount = file.Read(*ppByteArray, *pdwSize);
  ASSERT(uiCount == *pdwSize);

  return TRUE;
}

HRESULT SetByteArrayAsOctetString | ( | IADs * | pIADs,
 |  | LPCWSTR | lpszAttr,
 |  | BYTE * | pByteArray,
 |  | DWORD | dwSize
 | ) |  |

Definition at line 116 of file util.cpp.

{
  if (pByteArray == NULL)
  {
    CComBSTR bstrAttr = lpszAttr;
    return _ClearAttribute(pIADs, bstrAttr, FALSE);
  }

  HRESULT hr = S_OK;
  SAFEARRAYBOUND rgsabound[1];
  rgsabound[0].lLbound = 0;
  rgsabound[0].cElements = dwSize;

  SAFEARRAY* psa = SafeArrayCreate(VT_UI1, 1, rgsabound);
  if (psa == NULL)
  {
    return E_OUTOFMEMORY;
  }

  CComVariant var;
  V_VT(&var) = VT_UI1|VT_ARRAY;
  V_ARRAY(&var) = psa;

  for (long idx = 0; (DWORD)idx < dwSize; idx++)
  {
    hr = SafeArrayPutElement(psa, &idx, (void*)&pByteArray[idx]);
    if (FAILED(hr))
    {
      return hr;
    }
  }

  hr = pIADs->Put((LPWSTR)lpszAttr, var);
  //SafeArrayDestroy(psa);

  return hr;
}

HRESULT SetStringAttribute | ( | IADs * | pIADs,
 |  | LPCWSTR | lpszAttr,
 |  | LPCWSTR | lpszVal,
 |  | BOOL | bPostCommit
 | ) |  |

Definition at line 61 of file util.cpp.

{
  ASSERT(pIADs != NULL);
  ASSERT(lpszAttr != NULL);

  TRACE(_T("SetStringAttribute() on bPostCommit = %s\n"), bPostCommit ? L"TRUE" : L"FALSE");
  TRACE(_T("\t'%s' = <%s>\n"), lpszAttr, lpszVal);

  HRESULT hr = S_OK;
  BSTR bstrAttr = ::SysAllocString(lpszAttr);
  VARIANT varVal;
  ::VariantInit(&varVal);
  varVal.vt = VT_BSTR;
  varVal.bstrVal = ::SysAllocString(lpszVal);

  if ( (lpszVal == NULL) || ((lpszVal != NULL) && (lpszVal[0] == NULL)) )
  {
    hr = _ClearAttribute(pIADs, bstrAttr, bPostCommit);
  }
  else
  {
    // set the value
    hr = pIADs->Put(bstrAttr, varVal);
  }
  ::SysFreeString(bstrAttr);
  ::VariantClear(&varVal);
  return hr;
}

Generated on Wed Nov 13 2024 16:53:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/userext/userproppage/util.h File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • userext
  • userproppage
Classes | Defines | Functions

util.h File Reference

Go to the source code of this file.

Classes

class | CThumbNailPhotoHolder

Defines

#define | BYTE_OFFSET(base, offset) (((LPBYTE)base)+offset)

Functions

HRESULT | GetStringAttribute (IADs *pIADs, LPCWSTR lpszAttr, CString &szVal)
BOOL | LoadFileAsByteArray (PWSTR pszPath, LPBYTE *ppByteArray, DWORD *pdwSize)
HRESULT | SetByteArrayAsOctetString (IADs *pIADs, LPCWSTR lpszAttr, BYTE *pByteArray, DWORD dwSize)
HRESULT | SetStringAttribute (IADs *pIADs, LPCWSTR lpszAttr, LPCWSTR lpszVal, BOOL bPostCommit=FALSE)

Define Documentation

#define BYTE_OFFSET | ( | base,
 |  | offset |
 | ) |  | (((LPBYTE)base)+offset)

Definition at line 14 of file util.h.

Function Documentation

HRESULT GetStringAttribute | ( | IADs * | pIADs,
 |  | LPCWSTR | lpszAttr,
 |  | CString & | szVal
 | ) |  |

Definition at line 90 of file util.cpp.

{
  ASSERT(pIADs != NULL);
  VARIANT varVal;
  ::VariantInit(&varVal);

  BSTR bstrAttr = ::SysAllocString(lpszAttr);

  szVal.Empty();
  HRESULT hr = pIADs->Get(bstrAttr, &varVal);
  if (SUCCEEDED(hr))
  {
    if (varVal.vt == VT_BSTR)
      szVal = varVal.bstrVal;
    else
      hr = E_INVALIDARG;
  }
  VariantClear(&varVal);
  ::SysFreeString(bstrAttr);

  TRACE(_T("GetStringAttribute()lpszAttr = <%s>, (LPCWSTR)szVal = <%s>\n"), lpszAttr, szVal);
  return hr;
}

BOOL LoadFileAsByteArray | ( | PWSTR | pszPath,
 |  | LPBYTE * | ppByteArray,
 |  | DWORD * | pdwSize
 | ) |  |

Definition at line 154 of file util.cpp.

{
  CFile file;
  if (!file.Open(pszPath, CFile::modeRead | CFile::shareDenyNone | CFile::typeBinary))
  {
    AfxMessageBox(_T("Failed to open file."));
    return FALSE;
  }

  *pdwSize = file.GetLength();
  *ppByteArray = new BYTE[*pdwSize];
  ASSERT(*ppByteArray != NULL);

  UINT uiCount = file.Read(*ppByteArray, *pdwSize);
  ASSERT(uiCount == *pdwSize);

  return TRUE;
}

HRESULT SetByteArrayAsOctetString | ( | IADs * | pIADs,
 |  | LPCWSTR | lpszAttr,
 |  | BYTE * | pByteArray,
 |  | DWORD | dwSize
 | ) |  |

Definition at line 116 of file util.cpp.

{
  if (pByteArray == NULL)
  {
    CComBSTR bstrAttr = lpszAttr;
    return _ClearAttribute(pIADs, bstrAttr, FALSE);
  }

  HRESULT hr = S_OK;
  SAFEARRAYBOUND rgsabound[1];
  rgsabound[0].lLbound = 0;
  rgsabound[0].cElements = dwSize;

  SAFEARRAY* psa = SafeArrayCreate(VT_UI1, 1, rgsabound);
  if (psa == NULL)
  {
    return E_OUTOFMEMORY;
  }

  CComVariant var;
  V_VT(&var) = VT_UI1|VT_ARRAY;
  V_ARRAY(&var) = psa;

  for (long idx = 0; (DWORD)idx < dwSize; idx++)
  {
    hr = SafeArrayPutElement(psa, &idx, (void*)&pByteArray[idx]);
    if (FAILED(hr))
    {
      return hr;
    }
  }

  hr = pIADs->Put((LPWSTR)lpszAttr, var);
  //SafeArrayDestroy(psa);

  return hr;
}

HRESULT SetStringAttribute | ( | IADs * | pIADs,
 |  | LPCWSTR | lpszAttr,
 |  | LPCWSTR | lpszVal,
 |  | BOOL | bPostCommit = FALSE
 | ) |  |

Definition at line 61 of file util.cpp.

{
  ASSERT(pIADs != NULL);
  ASSERT(lpszAttr != NULL);

  TRACE(_T("SetStringAttribute() on bPostCommit = %s\n"), bPostCommit ? L"TRUE" : L"FALSE");
  TRACE(_T("\t'%s' = <%s>\n"), lpszAttr, lpszVal);

  HRESULT hr = S_OK;
  BSTR bstrAttr = ::SysAllocString(lpszAttr);
  VARIANT varVal;
  ::VariantInit(&varVal);
  varVal.vt = VT_BSTR;
  varVal.bstrVal = ::SysAllocString(lpszVal);

  if ( (lpszVal == NULL) || ((lpszVal != NULL) && (lpszVal[0] == NULL)) )
  {
    hr = _ClearAttribute(pIADs, bstrAttr, bPostCommit);
  }
  else
  {
    // set the value
    hr = pIADs->Put(bstrAttr, varVal);
  }
  ::SysFreeString(bstrAttr);
  ::VariantClear(&varVal);
  return hr;
}

Generated on Wed Nov 13 2024 16:53:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/userext/userwizard/extpageuser.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • userext
  • userwizard

extpageuser.cpp File Reference

#include "stdafx.h"
#include "ExtPageUser.h"
#include "WizExt.h"
#include "util.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/userext/userwizard/extpageuser.h File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • userext
  • userwizard
Classes

extpageuser.h File Reference

#include "resource.h"
#include "util.h"
#include "resource.h"
#include "util.h"

Go to the source code of this file.

Classes

class CExtPageUser
Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/userext/userwizard/resource.h File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • userext
  • userwizard
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_BUTTON_CHANGE_PICTURE 1002
#define | IDC_BUTTON_CLEAR_PICTURE 1007
#define | IDC_EDIT_CONTAINER 1006
#define | IDC_EDIT_EMPLOYEE_ID 1003
#define | IDC_EDIT_PICTURE_PATH 1000
#define | IDC_PICTURE_DISPLAY 1001
#define | IDC_STATIC_ICON 1005
#define | IDD_USER_PAGE_EXT 107

Define Documentation

#define IDC_BUTTON_CHANGE_PICTURE 1002

Definition at line 8 of file resource.h.

#define IDC_BUTTON_CLEAR_PICTURE 1007

Definition at line 12 of file resource.h.

#define IDC_EDIT_CONTAINER 1006

Definition at line 11 of file resource.h.

#define IDC_EDIT_EMPLOYEE_ID 1003

Definition at line 9 of file resource.h.

#define IDC_EDIT_PICTURE_PATH 1000

Definition at line 6 of file resource.h.

#define IDC_PICTURE_DISPLAY 1001

Definition at line 7 of file resource.h.

#define IDC_STATIC_ICON 1005

Definition at line 10 of file resource.h.

#define IDD_USER_PAGE_EXT 107

Definition at line 5 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/userext/userwizard/stdafx.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • userext
  • userwizard

stdafx.cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/userext/userwizard/stdafx.h File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • userext
  • userwizard
Classes | Defines | Variables

stdafx.h File Reference

#include <afxwin.h>
#include <afxdisp.h>
#include "afxdlgs.h"
#include <activeds.h>
#include <dsadmin.h>
#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Classes

class | CMyWizExtModule

Defines

#define | _ATL_APARTMENT_THREADED
#define | DECLARE_REGISTRY_CLSID()
#define | STRICT

Variables

CMyWizExtModule _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 30 of file stdafx.h.

#define DECLARE_REGISTRY_CLSID ( )
Value:
static HRESULT WINAPI UpdateRegistry(BOOL bRegister) \
{ \
    return _Module.UpdateRegistryCLSID(GetObjectCLSID(), bRegister); \
}

Definition at line 51 of file stdafx.h.

#define STRICT

Definition at line 22 of file stdafx.h.

Variable Documentation

CMyWizExtModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/userext/userwizard/userwizard.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • userext
  • userwizard
Classes | Functions | Variables

userwizard.cpp File Reference

#include "stdafx.h"
#include <objbase.h>
#include <initguid.h>
#include <dsadmin.h>
#include "resource.h"
#include "userwizard.h"
#include "WizExt.h"

Go to the source code of this file.

Classes

class | CMyWizExtApp

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CMyWizExtModule _Module
CMyWizExtApp theApp
BOOL | x = TRUE

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 65 of file userwizard.cpp.

{
  AFX_MANAGE_STATE(AfxGetStaticModuleState());
  return (AfxDllCanUnloadNow()==S_OK && _Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 74 of file userwizard.cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

STDAPI DllRegisterServer ( void )

Definition at line 83 of file userwizard.cpp.

{
    return _Module.RegisterServer(FALSE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 91 of file userwizard.cpp.

{
  _Module.UnregisterServer();
  return S_OK;
}

Variable Documentation

CMyWizExtModule _Module

Definition at line 35 of file userwizard.cpp.

CMyWizExtApp theApp

Definition at line 48 of file userwizard.cpp.

BOOL x = TRUE

Definition at line 82 of file userwizard.cpp.

Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/userext/userwizard/userwizard.h File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • userext
  • userwizard
Variables

userwizard.h File Reference

Go to the source code of this file.

Variables

const GUID CLSID_WizExtUser

Variable Documentation

const GUID CLSID_WizExtUser
Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/userext/userwizard/util.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • userext
  • userwizard
Functions

util.cpp File Reference

#include "stdafx.h"
#include "util.h"

Go to the source code of this file.

Functions

HRESULT | _ClearAttribute (IADs *pIADs, BSTR bstrAttrName, BOOL bPostCommit)
HRESULT | GetStringAttribute (IADs *pIADs, LPCWSTR lpszAttr, CString &szVal)
BOOL | LoadFileAsByteArray (PWSTR pszPath, LPBYTE *ppByteArray, DWORD *pdwSize)
HRESULT | SetByteArrayAsOctetString (IADs *pIADs, LPCWSTR lpszAttr, BYTE *pByteArray, DWORD dwSize)
HRESULT | SetStringAttribute (IADs *pIADs, LPCWSTR lpszAttr, LPCWSTR lpszVal, BOOL bPostCommit)

Function Documentation

HRESULT _ClearAttribute | ( | IADs * | pIADs,
 |  | BSTR | bstrAttrName,
 |  | BOOL | bPostCommit
 | ) |  |

Definition at line 16 of file util.cpp.

{
  ASSERT(pIADs != NULL);
  ASSERT(bstrAttrName != NULL);
  HRESULT hr = S_OK;

  VARIANT varVal;
  ::VariantInit(&varVal);

  // see if the attribute is there
  HRESULT hrFind = pIADs->Get(bstrAttrName, &varVal);
  if (SUCCEEDED(hrFind))
  {
    // found, need to clear the property
    if (bPostCommit)
    {
      // remove from the committed object
      hr = pIADs->PutEx(ADS_PROPERTY_CLEAR, bstrAttrName, varVal);
    }
    else
    {
      // remove from the cache of the temporary object
      IADsPropertyList* pPropList = NULL;
      hr = pIADs->QueryInterface(IID_IADsPropertyList, (void**)&pPropList);
      ASSERT(pPropList != NULL);
      if (SUCCEEDED(hr))
      {
        VARIANT v;
        ::VariantInit(&v);
        v.vt = VT_BSTR;
        v.bstrVal = ::SysAllocString(bstrAttrName);
        hr = pPropList->ResetPropertyItem(v);
        ::VariantClear(&v);
        pPropList->Release();
      }
    }
  }

  ::VariantClear(&varVal);
  return hr;
}

HRESULT GetStringAttribute | ( | IADs * | pIADs,
 |  | LPCWSTR | lpszAttr,
 |  | CString & | szVal
 | ) |  |

Definition at line 90 of file util.cpp.

{
  ASSERT(pIADs != NULL);
  VARIANT varVal;
  ::VariantInit(&varVal);

  BSTR bstrAttr = ::SysAllocString(lpszAttr);

  szVal.Empty();
  HRESULT hr = pIADs->Get(bstrAttr, &varVal);
  if (SUCCEEDED(hr))
  {
    if (varVal.vt == VT_BSTR)
      szVal = varVal.bstrVal;
    else
      hr = E_INVALIDARG;
  }
  VariantClear(&varVal);
  ::SysFreeString(bstrAttr);

  TRACE(_T("GetStringAttribute()lpszAttr = <%s>, (LPCWSTR)szVal = <%s>\n"), lpszAttr, szVal);
  return hr;
}

BOOL LoadFileAsByteArray | ( | PWSTR | pszPath,
 |  | LPBYTE * | ppByteArray,
 |  | DWORD * | pdwSize
 | ) |  |

Definition at line 154 of file util.cpp.

{
  CFile file;
  if (!file.Open(pszPath, CFile::modeRead | CFile::shareDenyNone | CFile::typeBinary))
  {
    AfxMessageBox(_T("Failed to open file."));
    return FALSE;
  }

  *pdwSize = file.GetLength();
  *ppByteArray = new BYTE[*pdwSize];
  ASSERT(*ppByteArray != NULL);

  UINT uiCount = file.Read(*ppByteArray, *pdwSize);
  ASSERT(uiCount == *pdwSize);

  return TRUE;
}

HRESULT SetByteArrayAsOctetString | ( | IADs * | pIADs,
 |  | LPCWSTR | lpszAttr,
 |  | BYTE * | pByteArray,
 |  | DWORD | dwSize
 | ) |  |

Definition at line 116 of file util.cpp.

{
  if (pByteArray == NULL)
  {
    CComBSTR bstrAttr = lpszAttr;
    return _ClearAttribute(pIADs, bstrAttr, FALSE);
  }

  HRESULT hr = S_OK;
  SAFEARRAYBOUND rgsabound[1];
  rgsabound[0].lLbound = 0;
  rgsabound[0].cElements = dwSize;

  SAFEARRAY* psa = SafeArrayCreate(VT_UI1, 1, rgsabound);
  if (psa == NULL)
  {
    return E_OUTOFMEMORY;
  }

  CComVariant var;
  V_VT(&var) = VT_UI1|VT_ARRAY;
  V_ARRAY(&var) = psa;

  for (long idx = 0; (DWORD)idx < dwSize; idx++)
  {
    hr = SafeArrayPutElement(psa, &idx, (void*)&pByteArray[idx]);
    if (FAILED(hr))
    {
      return hr;
    }
  }

  hr = pIADs->Put((LPWSTR)lpszAttr, var);
  //SafeArrayDestroy(psa);

  return hr;
}

HRESULT SetStringAttribute | ( | IADs * | pIADs,
 |  | LPCWSTR | lpszAttr,
 |  | LPCWSTR | lpszVal,
 |  | BOOL | bPostCommit
 | ) |  |

Definition at line 61 of file util.cpp.

{
  ASSERT(pIADs != NULL);
  ASSERT(lpszAttr != NULL);

  TRACE(_T("SetStringAttribute() on bPostCommit = %s\n"), bPostCommit ? L"TRUE" : L"FALSE");
  TRACE(_T("\t'%s' = <%s>\n"), lpszAttr, lpszVal);

  HRESULT hr = S_OK;
  BSTR bstrAttr = ::SysAllocString(lpszAttr);
  VARIANT varVal;
  ::VariantInit(&varVal);
  varVal.vt = VT_BSTR;
  varVal.bstrVal = ::SysAllocString(lpszVal);

  if ( (lpszVal == NULL) || ((lpszVal != NULL) && (lpszVal[0] == NULL)) )
  {
    hr = _ClearAttribute(pIADs, bstrAttr, bPostCommit);
  }
  else
  {
    // set the value
    hr = pIADs->Put(bstrAttr, varVal);
  }
  ::SysFreeString(bstrAttr);
  ::VariantClear(&varVal);
  return hr;
}

Generated on Wed Nov 13 2024 16:53:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/userext/userwizard/util.h File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • userext
  • userwizard
Classes | Defines | Functions

util.h File Reference

Go to the source code of this file.

Classes

class | CThumbNailPhotoHolder

Defines

#define | BYTE_OFFSET(base, offset) (((LPBYTE)base)+offset)

Functions

HRESULT | GetStringAttribute (IADs *pIADs, LPCWSTR lpszAttr, CString &szVal)
BOOL | LoadFileAsByteArray (PWSTR pszPath, LPBYTE *ppByteArray, DWORD *pdwSize)
HRESULT | SetByteArrayAsOctetString (IADs *pIADs, LPCWSTR lpszAttr, BYTE *pByteArray, DWORD dwSize)
HRESULT | SetStringAttribute (IADs *pIADs, LPCWSTR lpszAttr, LPCWSTR lpszVal, BOOL bPostCommit=FALSE)

Define Documentation

#define BYTE_OFFSET | ( | base,
 |  | offset |
 | ) |  | (((LPBYTE)base)+offset)

Definition at line 14 of file util.h.

Function Documentation

HRESULT GetStringAttribute | ( | IADs * | pIADs,
 |  | LPCWSTR | lpszAttr,
 |  | CString & | szVal
 | ) |  |

Definition at line 90 of file util.cpp.

{
  ASSERT(pIADs != NULL);
  VARIANT varVal;
  ::VariantInit(&varVal);

  BSTR bstrAttr = ::SysAllocString(lpszAttr);

  szVal.Empty();
  HRESULT hr = pIADs->Get(bstrAttr, &varVal);
  if (SUCCEEDED(hr))
  {
    if (varVal.vt == VT_BSTR)
      szVal = varVal.bstrVal;
    else
      hr = E_INVALIDARG;
  }
  VariantClear(&varVal);
  ::SysFreeString(bstrAttr);

  TRACE(_T("GetStringAttribute()lpszAttr = <%s>, (LPCWSTR)szVal = <%s>\n"), lpszAttr, szVal);
  return hr;
}

BOOL LoadFileAsByteArray | ( | PWSTR | pszPath,
 |  | LPBYTE * | ppByteArray,
 |  | DWORD * | pdwSize
 | ) |  |

Definition at line 154 of file util.cpp.

{
  CFile file;
  if (!file.Open(pszPath, CFile::modeRead | CFile::shareDenyNone | CFile::typeBinary))
  {
    AfxMessageBox(_T("Failed to open file."));
    return FALSE;
  }

  *pdwSize = file.GetLength();
  *ppByteArray = new BYTE[*pdwSize];
  ASSERT(*ppByteArray != NULL);

  UINT uiCount = file.Read(*ppByteArray, *pdwSize);
  ASSERT(uiCount == *pdwSize);

  return TRUE;
}

HRESULT SetByteArrayAsOctetString | ( | IADs * | pIADs,
 |  | LPCWSTR | lpszAttr,
 |  | BYTE * | pByteArray,
 |  | DWORD | dwSize
 | ) |  |

Definition at line 116 of file util.cpp.

{
  if (pByteArray == NULL)
  {
    CComBSTR bstrAttr = lpszAttr;
    return _ClearAttribute(pIADs, bstrAttr, FALSE);
  }

  HRESULT hr = S_OK;
  SAFEARRAYBOUND rgsabound[1];
  rgsabound[0].lLbound = 0;
  rgsabound[0].cElements = dwSize;

  SAFEARRAY* psa = SafeArrayCreate(VT_UI1, 1, rgsabound);
  if (psa == NULL)
  {
    return E_OUTOFMEMORY;
  }

  CComVariant var;
  V_VT(&var) = VT_UI1|VT_ARRAY;
  V_ARRAY(&var) = psa;

  for (long idx = 0; (DWORD)idx < dwSize; idx++)
  {
    hr = SafeArrayPutElement(psa, &idx, (void*)&pByteArray[idx]);
    if (FAILED(hr))
    {
      return hr;
    }
  }

  hr = pIADs->Put((LPWSTR)lpszAttr, var);
  //SafeArrayDestroy(psa);

  return hr;
}

HRESULT SetStringAttribute | ( | IADs * | pIADs,
 |  | LPCWSTR | lpszAttr,
 |  | LPCWSTR | lpszVal,
 |  | BOOL | bPostCommit = FALSE
 | ) |  |

Definition at line 61 of file util.cpp.

{
  ASSERT(pIADs != NULL);
  ASSERT(lpszAttr != NULL);

  TRACE(_T("SetStringAttribute() on bPostCommit = %s\n"), bPostCommit ? L"TRUE" : L"FALSE");
  TRACE(_T("\t'%s' = <%s>\n"), lpszAttr, lpszVal);

  HRESULT hr = S_OK;
  BSTR bstrAttr = ::SysAllocString(lpszAttr);
  VARIANT varVal;
  ::VariantInit(&varVal);
  varVal.vt = VT_BSTR;
  varVal.bstrVal = ::SysAllocString(lpszVal);

  if ( (lpszVal == NULL) || ((lpszVal != NULL) && (lpszVal[0] == NULL)) )
  {
    hr = _ClearAttribute(pIADs, bstrAttr, bPostCommit);
  }
  else
  {
    // set the value
    hr = pIADs->Put(bstrAttr, varVal);
  }
  ::SysFreeString(bstrAttr);
  ::VariantClear(&varVal);
  return hr;
}

Generated on Wed Nov 13 2024 16:53:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/userext/userwizard/wizext.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • userext
  • userwizard

wizext.cpp File Reference

#include "stdafx.h"
#include "WizExt.h"
#include "util.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/DSUI/userext/userwizard/wizext.h File Reference

  • NetDS
  • ADSI
  • samples
  • DSUI
  • userext
  • userwizard
Classes

wizext.h File Reference

#include "resource.h"
#include "userwizard.h"
#include "ExtPageUser.h"

Go to the source code of this file.

Classes

class CWizExtUser
Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Extension/tutorial/step1/ADsFirstExt.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • Extension
  • tutorial
  • step1
Classes | Functions | Variables

ADsFirstExt.cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include "ADsFirstExt.h"
#include "ADsFirstExt_i.c"
#include "HelloWorld.h"

Go to the source code of this file.

Classes

class | CADsFirstExtApp

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)
STDAPI | RegisterADsExt (void)
STDAPI | UnRegisterADsExt (void)

Variables

CComModule | _Module
CADsFirstExtApp theApp

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 70 of file ADsFirstExt.cpp.

{
    AFX_MANAGE_STATE(AfxGetStaticModuleState());
    return (AfxDllCanUnloadNow()==S_OK && _Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 79 of file ADsFirstExt.cpp.

{
    return _Module.GetClassObject(rclsid, riid, ppv);
}

STDAPI DllRegisterServer ( void )

Definition at line 87 of file ADsFirstExt.cpp.

{
    // registers object, typelib and all interfaces in typelib
  if ( SUCCEEDED(_Module.RegisterServer(TRUE) ) )
  {
         return RegisterADsExt();
  }
    return E_FAIL;
}

STDAPI DllUnregisterServer ( void )

Definition at line 100 of file ADsFirstExt.cpp.

{
  UnRegisterADsExt();
    return _Module.UnregisterServer(TRUE);
}

STDAPI RegisterADsExt ( void )

Definition at line 106 of file ADsFirstExt.cpp.

{
  HRESULT hr;
  HKEY hKey;
  DWORD dwDisposition;

  hr = RegCreateKeyEx( HKEY_LOCAL_MACHINE,
                     _T("SOFTWARE\\Microsoft\\ADs\\Providers\\LDAP\\Extensions\\User\\{E1E3EDF8-48D1-11D2-B22B-0000F87A6B50}"),
             0,
             NULL,
             REG_OPTION_NON_VOLATILE,
             KEY_WRITE,
             NULL,
             &hKey,
             &dwDisposition );

  if ( !SUCCEEDED(hr) )
  {
    return hr;
  }

  ///////////////////////////////////////////
  // Interface
  ////////////////////////////////////////////
  const wchar_t szIf[] = L"{E1E3EDF7-48D1-11D2-B22B-0000F87A6B50}\0\0";

  hr = RegSetValueEx( hKey, _T("Interfaces"), 0, REG_BINARY, (const BYTE *) szIf, sizeof(szIf));

  RegCloseKey(hKey);

  return hr;
}

STDAPI UnRegisterADsExt ( void )

Definition at line 145 of file ADsFirstExt.cpp.

{

  LONG lResult;
  lResult = RegDeleteKey(  HKEY_LOCAL_MACHINE,
    _T("SOFTWARE\\Microsoft\\ADs\\Providers\\LDAP\\Extensions\\User\\{E1E3EDF8-48D1-11D2-B22B-0000F87A6B50}") );

  if ( lResult == ERROR_SUCCESS )
  {
    return S_OK;

  }

    return E_FAIL;
}

Variable Documentation

CComModule _Module

Definition at line 17 of file ADsFirstExt.cpp.

CADsFirstExtApp theApp

Definition at line 53 of file ADsFirstExt.cpp.

Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Extension/tutorial/step1/ADsFirstExt.h File Reference

  • NetDS
  • ADSI
  • samples
  • Extension
  • tutorial
  • step1
Classes | Defines | Typedefs | Functions | Variables

ADsFirstExt.h File Reference

#include "rpc.h"
#include "rpcndr.h"
#include "windows.h"
#include "ole2.h"
#include "oaidl.h"
#include "ocidl.h"

Go to the source code of this file.

Classes

struct | IHelloWorldVtbl

Defines

#define | __ADSFIRSTEXTLib_LIBRARY_DEFINED__
#define | __HelloWorld_FWD_DEFINED__
#define | __IHelloWorld_FWD_DEFINED__
#define | __IHelloWorld_INTERFACE_DEFINED__
#define | __REQUIRED_RPCNDR_H_VERSION__ 440

Typedefs

typedef struct HelloWorld | HelloWorld
typedef interface IHelloWorld | IHelloWorld
typedef struct IHelloWorldVtbl | IHelloWorldVtbl

Functions

HRESULT STDMETHODCALLTYPE | IHelloWorld_Say_Proxy (IHelloWorld __RPC_FAR *This)
void __RPC_STUB | IHelloWorld_Say_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
void __RPC_FAR *__RPC_USER | MIDL_user_allocate (size_t)
void __RPC_USER | MIDL_user_free (void __RPC_FAR *)

Variables

EXTERN_C const CLSID | CLSID_HelloWorld
EXTERN_C const IID | IID_IHelloWorld
EXTERN_C const IID | LIBID_ADSFIRSTEXTLib
interface IHelloWorld
CONST_VTBL struct
IHelloWorldVtbl __RPC_FAR * 		lpVtbl

Define Documentation

#define __ADSFIRSTEXTLib_LIBRARY_DEFINED__

Definition at line 196 of file ADsFirstExt.h.

#define __HelloWorld_FWD_DEFINED__

Definition at line 47 of file ADsFirstExt.h.

#define __IHelloWorld_FWD_DEFINED__

Definition at line 41 of file ADsFirstExt.h.

#define __IHelloWorld_INTERFACE_DEFINED__

Definition at line 66 of file ADsFirstExt.h.

#define __REQUIRED_RPCNDR_H_VERSION__ 440

Definition at line 16 of file ADsFirstExt.h.

Typedef Documentation

typedef struct HelloWorld HelloWorld

Definition at line 52 of file ADsFirstExt.h.

typedef interface IHelloWorld IHelloWorld

Definition at line 42 of file ADsFirstExt.h.

typedef struct IHelloWorldVtbl IHelloWorldVtbl

Function Documentation

HRESULT STDMETHODCALLTYPE IHelloWorld_Say_Proxy ( IHelloWorld __RPC_FAR * This )
void __RPC_STUB IHelloWorld_Say_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
void __RPC_FAR* __RPC_USER MIDL_user_allocate ( size_t )

Definition at line 364 of file Picklpc.c.

{
    unsigned char * pcAllocated;
    unsigned char * pcUserPtr;

    pcAllocated = (unsigned char *) malloc( s + 15 );
    pcUserPtr =  ALIGN_TO8( pcAllocated );
    if ( pcUserPtr == pcAllocated )
        pcUserPtr = pcAllocated + 8;

    *(pcUserPtr - 1) = (char) (pcUserPtr - pcAllocated);

    return( pcUserPtr );
}

void __RPC_USER MIDL_user_free ( void __RPC_FAR * )

Definition at line 379 of file Picklpc.c.

{
    unsigned char * pcAllocated;
    unsigned char * pcUserPtr;

    pcUserPtr = (unsigned char *) f;
    pcAllocated = pcUserPtr - *(pcUserPtr - 1);

    free( pcAllocated );
}

Variable Documentation

EXTERN_C const CLSID CLSID_HelloWorld

Definition at line 204 of file ADsFirstExt.h.

EXTERN_C const IID IID_IHelloWorld

Definition at line 72 of file ADsFirstExt.h.

EXTERN_C const IID LIBID_ADSFIRSTEXTLib

Definition at line 202 of file ADsFirstExt.h.

interface IHelloWorld CONST_VTBL struct IHelloWorldVtbl __RPC_FAR* lpVtbl

Definition at line 138 of file ADsFirstExt.h.

Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Extension/tutorial/step1/ADsFirstExt.idl File Reference

  • NetDS
  • ADSI
  • samples
  • Extension
  • tutorial
  • step1
Classes | Namespaces | Functions

ADsFirstExt.idl File Reference

Go to the source code of this file.

Classes

class | ADSFIRSTEXTLib::HelloWorld
interface | IHelloWorld

Namespaces

namespace | ADSFIRSTEXTLib

Functions

ADSFIRSTEXTLib::importlib ("stdole32.tlb")
ADSFIRSTEXTLib::importlib ("stdole2.tlb")
Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Extension/tutorial/step1/ADsFirstExt_i.c File Reference

  • NetDS
  • ADSI
  • samples
  • Extension
  • tutorial
  • step1
Classes | Defines | Typedefs | Variables

ADsFirstExt_i.c File Reference

Go to the source code of this file.

Classes

struct | _IID

Defines

#define | __IID_DEFINED__
#define | CLSID_DEFINED

Typedefs

typedef IID | CLSID
typedef struct _IID | IID

Variables

const CLSID | CLSID_HelloWorld = {0xE1E3EDF8,0x48D1,0x11D2,{0xB2,0x2B,0x00,0x00,0xF8,0x7A,0x6B,0x50}}
const IID | IID_IHelloWorld = {0xE1E3EDF7,0x48D1,0x11D2,{0xB2,0x2B,0x00,0x00,0xF8,0x7A,0x6B,0x50}}
const IID | LIBID_ADSFIRSTEXTLib = {0xE1E3EDEA,0x48D1,0x11D2,{0xB2,0x2B,0x00,0x00,0xF8,0x7A,0x6B,0x50}}

Define Documentation

#define __IID_DEFINED__

Definition at line 21 of file ADsFirstExt_i.c.

#define CLSID_DEFINED

Definition at line 34 of file ADsFirstExt_i.c.

Typedef Documentation

typedef IID CLSID

Definition at line 35 of file ADsFirstExt_i.c.

typedef struct _IID IID

Variable Documentation

const CLSID CLSID_HelloWorld = {0xE1E3EDF8,0x48D1,0x11D2,{0xB2,0x2B,0x00,0x00,0xF8,0x7A,0x6B,0x50}}

Definition at line 44 of file ADsFirstExt_i.c.

const IID IID_IHelloWorld = {0xE1E3EDF7,0x48D1,0x11D2,{0xB2,0x2B,0x00,0x00,0xF8,0x7A,0x6B,0x50}}

Definition at line 38 of file ADsFirstExt_i.c.

const IID LIBID_ADSFIRSTEXTLib = {0xE1E3EDEA,0x48D1,0x11D2,{0xB2,0x2B,0x00,0x00,0xF8,0x7A,0x6B,0x50}}

Definition at line 41 of file ADsFirstExt_i.c.

Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Extension/tutorial/step1/ADsFirstExt_p.c File Reference

  • NetDS
  • ADSI
  • samples
  • Extension
  • tutorial
  • step1
Classes | Defines | Typedefs | Functions | Variables

ADsFirstExt_p.c File Reference

#include "rpcproxy.h"
#include "ADsFirstExt.h"

Go to the source code of this file.

Classes

struct | _MIDL_PROC_FORMAT_STRING
struct | _MIDL_TYPE_FORMAT_STRING

Defines

#define | __REQUIRED_RPCPROXY_H_VERSION__ 440
#define | _ADsFirstExt_CHECK_IID(n) IID_GENERIC_CHECK_IID( _ADsFirstExt, pIID, n)
#define | PROC_FORMAT_STRING_SIZE 23
#define | TYPE_FORMAT_STRING_SIZE 3
#define | USE_STUBLESS_PROXY

Typedefs

typedef struct
_MIDL_PROC_FORMAT_STRING 		MIDL_PROC_FORMAT_STRING
typedef struct
_MIDL_TYPE_FORMAT_STRING 		MIDL_TYPE_FORMAT_STRING

Functions

int __stdcall | _ADsFirstExt_IID_Lookup (const IID *pIID, int *pIndex)
CINTERFACE_PROXY_VTABLE (8)

Variables

const MIDL_PROC_FORMAT_STRING | __MIDL_ProcFormatString
const MIDL_TYPE_FORMAT_STRING | __MIDL_TypeFormatString
const IID * | _ADsFirstExt_BaseIIDList []
PCInterfaceName const | _ADsFirstExt_InterfaceNamesList []
const CInterfaceProxyVtbl * | _ADsFirstExt_ProxyVtblList []
const CInterfaceStubVtbl * | _ADsFirstExt_StubVtblList []
CInterfaceStubVtbl | _IHelloWorldStubVtbl
const ExtendedProxyFileInfo | ADsFirstExt_ProxyFileInfo
const MIDL_SERVER_INFO | IHelloWorld_ServerInfo
const MIDL_STUB_DESC | Object_StubDesc

Define Documentation

#define __REQUIRED_RPCPROXY_H_VERSION__ 440

Definition at line 18 of file ADsFirstExt_p.c.

#define _ADsFirstExt_CHECK_IID ( n ) IID_GENERIC_CHECK_IID( _ADsFirstExt, pIID, n)

Definition at line 242 of file ADsFirstExt_p.c.

#define PROC_FORMAT_STRING_SIZE 23

Definition at line 31 of file ADsFirstExt_p.c.

#define TYPE_FORMAT_STRING_SIZE 3

Definition at line 30 of file ADsFirstExt_p.c.

#define USE_STUBLESS_PROXY

Definition at line 13 of file ADsFirstExt_p.c.

Typedef Documentation

typedef struct _MIDL_PROC_FORMAT_STRING MIDL_PROC_FORMAT_STRING
typedef struct _MIDL_TYPE_FORMAT_STRING MIDL_TYPE_FORMAT_STRING

Function Documentation

int __stdcall _ADsFirstExt_IID_Lookup | ( | const IID * | pIID,
 |  | int * | pIndex
 | ) |  |

Definition at line 244 of file ADsFirstExt_p.c.

{

    if(!_ADsFirstExt_CHECK_IID(0))
        {
        *pIndex = 0;
        return 1;
        }

    return 0;
}

CINTERFACE_PROXY_VTABLE ( 8 )

Definition at line 124 of file ADsFirstExt_p.c.

{
    &IHelloWorld_ProxyInfo,
    &IID_IHelloWorld,
    IUnknown_QueryInterface_Proxy,
    IUnknown_AddRef_Proxy,
    IUnknown_Release_Proxy ,
    0 /* (void *)-1 /* IDispatch::GetTypeInfoCount */ ,
    0 /* (void *)-1 /* IDispatch::GetTypeInfo */ ,
    0 /* (void *)-1 /* IDispatch::GetIDsOfNames */ ,
    0 /* IDispatch_Invoke_Proxy */ ,
    (void *)-1 /* IHelloWorld::Say */
};

Variable Documentation

static const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString

Definition at line 171 of file ADsFirstExt_p.c.

static const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString
Initial value:
    {
        0,
        {
      NdrFcShort( 0x0 ),

      0x0
        }
    }

Definition at line 207 of file ADsFirstExt_p.c.

const IID* _ADsFirstExt_BaseIIDList[]
Initial value:

{
    &IID_IDispatch,
    0
}

Definition at line 235 of file ADsFirstExt_p.c.

PCInterfaceName const _ADsFirstExt_InterfaceNamesList[]
Initial value:

{
    "IHelloWorld",
    0
}

Definition at line 229 of file ADsFirstExt_p.c.

const CInterfaceProxyVtbl* _ADsFirstExt_ProxyVtblList[]
Initial value:

{
    ( CInterfaceProxyVtbl *) &_IHelloWorldProxyVtbl,
    0
}

Definition at line 217 of file ADsFirstExt_p.c.

const CInterfaceStubVtbl* _ADsFirstExt_StubVtblList[]
Initial value:

{
    ( CInterfaceStubVtbl *) &_IHelloWorldStubVtbl,
    0
}

Definition at line 223 of file ADsFirstExt_p.c.

CInterfaceStubVtbl _IHelloWorldStubVtbl
Initial value:
{
    &IID_IHelloWorld,
    &IHelloWorld_ServerInfo,
    8,
    &IHelloWorld_table[-3],
    CStdStubBuffer_DELEGATING_METHODS
}

Definition at line 148 of file ADsFirstExt_p.c.

const ExtendedProxyFileInfo ADsFirstExt_ProxyFileInfo
Initial value:

{
    (PCInterfaceProxyVtblList *) & _ADsFirstExt_ProxyVtblList,
    (PCInterfaceStubVtblList *) & _ADsFirstExt_StubVtblList,
    (const PCInterfaceName * ) & _ADsFirstExt_InterfaceNamesList,
    (const IID ** ) & _ADsFirstExt_BaseIIDList,
    & _ADsFirstExt_IID_Lookup,
    1,
    2,
    0,
    0,
    0,
    0
}

Definition at line 256 of file ADsFirstExt_p.c.

static const MIDL_SERVER_INFO IHelloWorld_ServerInfo
Initial value:

    {
    &Object_StubDesc,
    0,
    __MIDL_ProcFormatString.Format,
    &IHelloWorld_FormatStringOffsetTable[-3],
    0,
    0,
    0,
    0
    }

Definition at line 102 of file ADsFirstExt_p.c.

static const MIDL_STUB_DESC Object_StubDesc
Initial value:

    {
    0,
    NdrOleAllocate,
    NdrOleFree,
    0,
    0,
    0,
    0,
    0,
    __MIDL_TypeFormatString.Format,
    1,
    0x20000,
    0,
    0x50100a4,
    0,
    0,
    0,
    1,
    0,
    0,
    0
    }

Definition at line 69 of file ADsFirstExt_p.c.

Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Extension/tutorial/step1/dlldata.c File Reference

  • NetDS
  • ADSI
  • samples
  • Extension
  • tutorial
  • step1
Defines | Functions

dlldata.c File Reference

#include <rpcproxy.h>

Go to the source code of this file.

Defines

#define | PROXY_DELEGATION

Functions

PROXYFILE_LIST_START | REFERENCE_PROXY_FILE (ADsFirstExt)

Define Documentation

#define PROXY_DELEGATION

Definition at line 14 of file dlldata.c.

Function Documentation

PROXYFILE_LIST_START REFERENCE_PROXY_FILE ( ADsFirstExt )
Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Extension/tutorial/step1/HelloWorld.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • Extension
  • tutorial
  • step1

HelloWorld.cpp File Reference

#include "stdafx.h"
#include "ADsFirstExt.h"
#include "HelloWorld.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Extension/tutorial/step1/HelloWorld.h File Reference

  • NetDS
  • ADSI
  • samples
  • Extension
  • tutorial
  • step1
Classes

HelloWorld.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class HelloWorld
Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Extension/tutorial/step1/resource.h File Reference

  • NetDS
  • ADSI
  • samples
  • Extension
  • tutorial
  • step1
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_HelloWorld 103
#define | IDS_HELLOWORLD_DESC 102
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_HelloWorld 103

Definition at line 7 of file resource.h.

#define IDS_HELLOWORLD_DESC 102

Definition at line 6 of file resource.h.

#define IDS_PROJNAME 100

Definition at line 5 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Extension/tutorial/step1/StdAfx.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • Extension
  • tutorial
  • step1

StdAfx.cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Extension/tutorial/step1/StdAfx.h File Reference

  • NetDS
  • ADSI
  • samples
  • Extension
  • tutorial
  • step1
Defines | Variables

StdAfx.h File Reference

#include <afxwin.h>
#include <afxdisp.h>
#include <atlbase.h>
#include <atlcom.h>
#include "activeds.h"

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0400
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 16 of file StdAfx.h.

#define _WIN32_WINNT 0x0400

Definition at line 14 of file StdAfx.h.

#define STRICT

Definition at line 12 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Extension/tutorial/step2/ADsFirstExt.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • Extension
  • tutorial
  • step2
Classes | Functions | Variables

ADsFirstExt.cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include "ADsFirstExt.h"
#include "ADsFirstExt_i.c"
#include "HelloWorld.h"

Go to the source code of this file.

Classes

class | CADsFirstExtApp

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)
STDAPI | RegisterADsExt (void)
STDAPI | UnRegisterADsExt (void)

Variables

CComModule | _Module
CADsFirstExtApp theApp

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 70 of file ADsFirstExt.cpp.

{
    AFX_MANAGE_STATE(AfxGetStaticModuleState());
    return (AfxDllCanUnloadNow()==S_OK && _Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 79 of file ADsFirstExt.cpp.

{
    return _Module.GetClassObject(rclsid, riid, ppv);
}

STDAPI DllRegisterServer ( void )

Definition at line 87 of file ADsFirstExt.cpp.

{
    // registers object, typelib and all interfaces in typelib
  if ( SUCCEEDED(_Module.RegisterServer(TRUE) ) )
  {
         return RegisterADsExt();
  }
    return E_FAIL;
}

STDAPI DllUnregisterServer ( void )

Definition at line 100 of file ADsFirstExt.cpp.

{
  UnRegisterADsExt();
    return _Module.UnregisterServer(TRUE);
}

STDAPI RegisterADsExt ( void )

Definition at line 106 of file ADsFirstExt.cpp.

{
  HRESULT hr;
  HKEY hKey;
  DWORD dwDisposition;

  hr = RegCreateKeyEx( HKEY_LOCAL_MACHINE,
                     _T("SOFTWARE\\Microsoft\\ADs\\Providers\\LDAP\\Extensions\\User\\{E1E3EDF8-48D1-11D2-B22B-0000F87A6B50}"),
             0,
             NULL,
             REG_OPTION_NON_VOLATILE,
             KEY_WRITE,
             NULL,
             &hKey,
             &dwDisposition );

  if ( !SUCCEEDED(hr) )
  {
    return hr;
  }

  ///////////////////////////////////////////
  // Interface
  ////////////////////////////////////////////
  const wchar_t szIf[] = L"{E1E3EDF7-48D1-11D2-B22B-0000F87A6B50}\0\0";

  hr = RegSetValueEx( hKey, _T("Interfaces"), 0, REG_BINARY, (const BYTE *) szIf, sizeof(szIf));

  RegCloseKey(hKey);

  return hr;
}

STDAPI UnRegisterADsExt ( void )

Definition at line 143 of file ADsFirstExt.cpp.

{

  LONG lResult;
  lResult = RegDeleteKey(  HKEY_LOCAL_MACHINE,
    _T("SOFTWARE\\Microsoft\\ADs\\Providers\\LDAP\\Extensions\\User\\{E1E3EDF8-48D1-11D2-B22B-0000F87A6B50}") );

  if ( lResult == ERROR_SUCCESS )
  {
    return S_OK;

  }

    return E_FAIL;
}

Variable Documentation

CComModule _Module

Definition at line 17 of file ADsFirstExt.cpp.

CADsFirstExtApp theApp

Definition at line 53 of file ADsFirstExt.cpp.

Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Extension/tutorial/step2/ADsFirstExt.h File Reference

  • NetDS
  • ADSI
  • samples
  • Extension
  • tutorial
  • step2
Classes | Defines | Typedefs | Functions | Variables

ADsFirstExt.h File Reference

#include "rpc.h"
#include "rpcndr.h"
#include "windows.h"
#include "ole2.h"
#include "oaidl.h"
#include "ocidl.h"

Go to the source code of this file.

Classes

struct | IHelloWorldVtbl

Defines

#define | __ADSFIRSTEXTLib_LIBRARY_DEFINED__
#define | __HelloWorld_FWD_DEFINED__
#define | __IHelloWorld_FWD_DEFINED__
#define | __IHelloWorld_INTERFACE_DEFINED__
#define | __REQUIRED_RPCNDR_H_VERSION__ 440

Typedefs

typedef struct HelloWorld | HelloWorld
typedef interface IHelloWorld | IHelloWorld
typedef struct IHelloWorldVtbl | IHelloWorldVtbl

Functions

HRESULT STDMETHODCALLTYPE | IHelloWorld_Say_Proxy (IHelloWorld __RPC_FAR *This)
void __RPC_STUB | IHelloWorld_Say_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
void __RPC_FAR *__RPC_USER | MIDL_user_allocate (size_t)
void __RPC_USER | MIDL_user_free (void __RPC_FAR *)

Variables

EXTERN_C const CLSID | CLSID_HelloWorld
EXTERN_C const IID | IID_IHelloWorld
EXTERN_C const IID | LIBID_ADSFIRSTEXTLib

Define Documentation

#define __ADSFIRSTEXTLib_LIBRARY_DEFINED__

Definition at line 196 of file ADsFirstExt.h.

#define __HelloWorld_FWD_DEFINED__

Definition at line 47 of file ADsFirstExt.h.

#define __IHelloWorld_FWD_DEFINED__

Definition at line 41 of file ADsFirstExt.h.

#define __IHelloWorld_INTERFACE_DEFINED__

Definition at line 66 of file ADsFirstExt.h.

#define __REQUIRED_RPCNDR_H_VERSION__ 440

Definition at line 16 of file ADsFirstExt.h.

Typedef Documentation

typedef struct HelloWorld HelloWorld

Definition at line 52 of file ADsFirstExt.h.

typedef interface IHelloWorld IHelloWorld

Definition at line 42 of file ADsFirstExt.h.

typedef struct IHelloWorldVtbl IHelloWorldVtbl

Function Documentation

HRESULT STDMETHODCALLTYPE IHelloWorld_Say_Proxy ( IHelloWorld __RPC_FAR * This )
void __RPC_STUB IHelloWorld_Say_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
void __RPC_FAR* __RPC_USER MIDL_user_allocate ( size_t )

Definition at line 364 of file Picklpc.c.

{
    unsigned char * pcAllocated;
    unsigned char * pcUserPtr;

    pcAllocated = (unsigned char *) malloc( s + 15 );
    pcUserPtr =  ALIGN_TO8( pcAllocated );
    if ( pcUserPtr == pcAllocated )
        pcUserPtr = pcAllocated + 8;

    *(pcUserPtr - 1) = (char) (pcUserPtr - pcAllocated);

    return( pcUserPtr );
}

void __RPC_USER MIDL_user_free ( void __RPC_FAR * )

Definition at line 379 of file Picklpc.c.

{
    unsigned char * pcAllocated;
    unsigned char * pcUserPtr;

    pcUserPtr = (unsigned char *) f;
    pcAllocated = pcUserPtr - *(pcUserPtr - 1);

    free( pcAllocated );
}

Variable Documentation

EXTERN_C const CLSID CLSID_HelloWorld

Definition at line 204 of file ADsFirstExt.h.

EXTERN_C const IID IID_IHelloWorld

Definition at line 72 of file ADsFirstExt.h.

EXTERN_C const IID LIBID_ADSFIRSTEXTLib

Definition at line 202 of file ADsFirstExt.h.

Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Extension/tutorial/step2/ADsFirstExt.idl File Reference

  • NetDS
  • ADSI
  • samples
  • Extension
  • tutorial
  • step2
Classes | Namespaces | Functions

ADsFirstExt.idl File Reference

Go to the source code of this file.

Classes

class | ADSFIRSTEXTLib::HelloWorld
interface | IHelloWorld

Namespaces

namespace | ADSFIRSTEXTLib

Functions

ADSFIRSTEXTLib::importlib ("stdole32.tlb")
ADSFIRSTEXTLib::importlib ("stdole2.tlb")
Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Extension/tutorial/step2/ADsFirstExt_i.c File Reference

  • NetDS
  • ADSI
  • samples
  • Extension
  • tutorial
  • step2
Classes | Defines | Typedefs | Variables

ADsFirstExt_i.c File Reference

Go to the source code of this file.

Classes

struct | _IID

Defines

#define | __IID_DEFINED__
#define | CLSID_DEFINED

Typedefs

typedef IID | CLSID
typedef struct _IID | IID

Variables

const CLSID | CLSID_HelloWorld = {0xE1E3EDF8,0x48D1,0x11D2,{0xB2,0x2B,0x00,0x00,0xF8,0x7A,0x6B,0x50}}
const IID | IID_IHelloWorld = {0xE1E3EDF7,0x48D1,0x11D2,{0xB2,0x2B,0x00,0x00,0xF8,0x7A,0x6B,0x50}}
const IID | LIBID_ADSFIRSTEXTLib = {0xE1E3EDEA,0x48D1,0x11D2,{0xB2,0x2B,0x00,0x00,0xF8,0x7A,0x6B,0x50}}

Define Documentation

#define __IID_DEFINED__

Definition at line 21 of file ADsFirstExt_i.c.

#define CLSID_DEFINED

Definition at line 34 of file ADsFirstExt_i.c.

Typedef Documentation

typedef IID CLSID

Definition at line 35 of file ADsFirstExt_i.c.

typedef struct _IID IID

Variable Documentation

const CLSID CLSID_HelloWorld = {0xE1E3EDF8,0x48D1,0x11D2,{0xB2,0x2B,0x00,0x00,0xF8,0x7A,0x6B,0x50}}

Definition at line 44 of file ADsFirstExt_i.c.

const IID IID_IHelloWorld = {0xE1E3EDF7,0x48D1,0x11D2,{0xB2,0x2B,0x00,0x00,0xF8,0x7A,0x6B,0x50}}

Definition at line 38 of file ADsFirstExt_i.c.

const IID LIBID_ADSFIRSTEXTLib = {0xE1E3EDEA,0x48D1,0x11D2,{0xB2,0x2B,0x00,0x00,0xF8,0x7A,0x6B,0x50}}

Definition at line 41 of file ADsFirstExt_i.c.

Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Extension/tutorial/step2/ADsFirstExt_p.c File Reference

  • NetDS
  • ADSI
  • samples
  • Extension
  • tutorial
  • step2
Classes | Defines | Typedefs | Functions | Variables

ADsFirstExt_p.c File Reference

#include "rpcproxy.h"
#include "ADsFirstExt.h"

Go to the source code of this file.

Classes

struct | _MIDL_PROC_FORMAT_STRING
struct | _MIDL_TYPE_FORMAT_STRING

Defines

#define | __REQUIRED_RPCPROXY_H_VERSION__ 440
#define | _ADsFirstExt_CHECK_IID(n) IID_GENERIC_CHECK_IID( _ADsFirstExt, pIID, n)
#define | PROC_FORMAT_STRING_SIZE 23
#define | TYPE_FORMAT_STRING_SIZE 3
#define | USE_STUBLESS_PROXY

Typedefs

typedef struct
_MIDL_PROC_FORMAT_STRING 		MIDL_PROC_FORMAT_STRING
typedef struct
_MIDL_TYPE_FORMAT_STRING 		MIDL_TYPE_FORMAT_STRING

Functions

int __stdcall | _ADsFirstExt_IID_Lookup (const IID *pIID, int *pIndex)
CINTERFACE_PROXY_VTABLE (8)

Variables

const MIDL_PROC_FORMAT_STRING | __MIDL_ProcFormatString
const MIDL_TYPE_FORMAT_STRING | __MIDL_TypeFormatString
const IID * | _ADsFirstExt_BaseIIDList []
PCInterfaceName const | _ADsFirstExt_InterfaceNamesList []
const CInterfaceProxyVtbl * | _ADsFirstExt_ProxyVtblList []
const CInterfaceStubVtbl * | _ADsFirstExt_StubVtblList []
CInterfaceStubVtbl | _IHelloWorldStubVtbl
const ExtendedProxyFileInfo | ADsFirstExt_ProxyFileInfo
const MIDL_SERVER_INFO | IHelloWorld_ServerInfo
const MIDL_STUB_DESC | Object_StubDesc

Define Documentation

#define __REQUIRED_RPCPROXY_H_VERSION__ 440

Definition at line 18 of file ADsFirstExt_p.c.

#define _ADsFirstExt_CHECK_IID ( n ) IID_GENERIC_CHECK_IID( _ADsFirstExt, pIID, n)

Definition at line 242 of file ADsFirstExt_p.c.

#define PROC_FORMAT_STRING_SIZE 23

Definition at line 31 of file ADsFirstExt_p.c.

#define TYPE_FORMAT_STRING_SIZE 3

Definition at line 30 of file ADsFirstExt_p.c.

#define USE_STUBLESS_PROXY

Definition at line 13 of file ADsFirstExt_p.c.

Typedef Documentation

typedef struct _MIDL_PROC_FORMAT_STRING MIDL_PROC_FORMAT_STRING
typedef struct _MIDL_TYPE_FORMAT_STRING MIDL_TYPE_FORMAT_STRING

Function Documentation

int __stdcall _ADsFirstExt_IID_Lookup | ( | const IID * | pIID,
 |  | int * | pIndex
 | ) |  |

Definition at line 244 of file ADsFirstExt_p.c.

{

    if(!_ADsFirstExt_CHECK_IID(0))
        {
        *pIndex = 0;
        return 1;
        }

    return 0;
}

CINTERFACE_PROXY_VTABLE ( 8 )

Definition at line 124 of file ADsFirstExt_p.c.

{
    &IHelloWorld_ProxyInfo,
    &IID_IHelloWorld,
    IUnknown_QueryInterface_Proxy,
    IUnknown_AddRef_Proxy,
    IUnknown_Release_Proxy ,
    0 /* (void *)-1 /* IDispatch::GetTypeInfoCount */ ,
    0 /* (void *)-1 /* IDispatch::GetTypeInfo */ ,
    0 /* (void *)-1 /* IDispatch::GetIDsOfNames */ ,
    0 /* IDispatch_Invoke_Proxy */ ,
    (void *)-1 /* IHelloWorld::Say */
};

Variable Documentation

const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString

Definition at line 171 of file ADsFirstExt_p.c.

const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString
Initial value:
    {
        0,
        {
      NdrFcShort( 0x0 ),

      0x0
        }
    }

Definition at line 207 of file ADsFirstExt_p.c.

const IID* _ADsFirstExt_BaseIIDList[]
Initial value:

{
    &IID_IDispatch,
    0
}

Definition at line 235 of file ADsFirstExt_p.c.

PCInterfaceName const _ADsFirstExt_InterfaceNamesList[]
Initial value:

{
    "IHelloWorld",
    0
}

Definition at line 229 of file ADsFirstExt_p.c.

const CInterfaceProxyVtbl* _ADsFirstExt_ProxyVtblList[]
Initial value:

{
    ( CInterfaceProxyVtbl *) &_IHelloWorldProxyVtbl,
    0
}

Definition at line 217 of file ADsFirstExt_p.c.

const CInterfaceStubVtbl* _ADsFirstExt_StubVtblList[]
Initial value:

{
    ( CInterfaceStubVtbl *) &_IHelloWorldStubVtbl,
    0
}

Definition at line 223 of file ADsFirstExt_p.c.

CInterfaceStubVtbl _IHelloWorldStubVtbl
Initial value:
{
    &IID_IHelloWorld,
    &IHelloWorld_ServerInfo,
    8,
    &IHelloWorld_table[-3],
    CStdStubBuffer_DELEGATING_METHODS
}

Definition at line 148 of file ADsFirstExt_p.c.

const ExtendedProxyFileInfo ADsFirstExt_ProxyFileInfo
Initial value:

{
    (PCInterfaceProxyVtblList *) & _ADsFirstExt_ProxyVtblList,
    (PCInterfaceStubVtblList *) & _ADsFirstExt_StubVtblList,
    (const PCInterfaceName * ) & _ADsFirstExt_InterfaceNamesList,
    (const IID ** ) & _ADsFirstExt_BaseIIDList,
    & _ADsFirstExt_IID_Lookup,
    1,
    2,
    0,
    0,
    0,
    0
}

Definition at line 256 of file ADsFirstExt_p.c.

const MIDL_SERVER_INFO IHelloWorld_ServerInfo
Initial value:

    {
    &Object_StubDesc,
    0,
    __MIDL_ProcFormatString.Format,
    &IHelloWorld_FormatStringOffsetTable[-3],
    0,
    0,
    0,
    0
    }

Definition at line 102 of file ADsFirstExt_p.c.

const MIDL_STUB_DESC Object_StubDesc
Initial value:

    {
    0,
    NdrOleAllocate,
    NdrOleFree,
    0,
    0,
    0,
    0,
    0,
    __MIDL_TypeFormatString.Format,
    1,
    0x20000,
    0,
    0x50100a4,
    0,
    0,
    0,
    1,
    0,
    0,
    0
    }

Definition at line 69 of file ADsFirstExt_p.c.

Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Extension/tutorial/step2/dlldata.c File Reference

  • NetDS
  • ADSI
  • samples
  • Extension
  • tutorial
  • step2
Defines | Functions

dlldata.c File Reference

#include <rpcproxy.h>

Go to the source code of this file.

Defines

#define | PROXY_DELEGATION

Functions

PROXYFILE_LIST_START | REFERENCE_PROXY_FILE (ADsFirstExt)

Define Documentation

#define PROXY_DELEGATION

Definition at line 14 of file dlldata.c.

Function Documentation

PROXYFILE_LIST_START REFERENCE_PROXY_FILE ( ADsFirstExt )
Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Extension/tutorial/step2/HelloWorld.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • Extension
  • tutorial
  • step2

HelloWorld.cpp File Reference

#include "stdafx.h"
#include "ADsFirstExt.h"
#include "HelloWorld.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Extension/tutorial/step2/HelloWorld.h File Reference

  • NetDS
  • ADSI
  • samples
  • Extension
  • tutorial
  • step2
Classes

HelloWorld.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class HelloWorld
Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Extension/tutorial/step2/resource.h File Reference

  • NetDS
  • ADSI
  • samples
  • Extension
  • tutorial
  • step2
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_HelloWorld 103
#define | IDS_HELLOWORLD_DESC 102
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_HelloWorld 103

Definition at line 7 of file resource.h.

#define IDS_HELLOWORLD_DESC 102

Definition at line 6 of file resource.h.

#define IDS_PROJNAME 100

Definition at line 5 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Extension/tutorial/step2/StdAfx.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • Extension
  • tutorial
  • step2

StdAfx.cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Extension/tutorial/step2/StdAfx.h File Reference

  • NetDS
  • ADSI
  • samples
  • Extension
  • tutorial
  • step2
Defines | Variables

StdAfx.h File Reference

#include <afxwin.h>
#include <afxdisp.h>
#include <atlbase.h>
#include <atlcom.h>
#include "activeds.h"

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0400
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 16 of file StdAfx.h.

#define _WIN32_WINNT 0x0400

Definition at line 14 of file StdAfx.h.

#define STRICT

Definition at line 12 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/ADQI/ADQI.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • ADQI
Variables

ADQI.cpp File Reference

#include "stdafx.h"
#include "ADQI.h"
#include "ADQIDlg.h"

Go to the source code of this file.

Variables

CADQIApp theApp

Variable Documentation

CADQIApp theApp

Definition at line 72 of file ADQI.cpp.

Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/ADQI/ADQI.h File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • ADQI
Classes | Defines

ADQI.h File Reference

#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Classes

class | CADQIApp

Defines

#define | App ((CADQIApp*)AfxGetApp())

Define Documentation

#define App ((CADQIApp*)AfxGetApp())

Definition at line 22 of file ADQI.h.

Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/ADQI/ADQIDlg.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • ADQI
Variables

ADQIDlg.cpp File Reference

#include "stdafx.h"
#include "ADQI.h"
#include "ADQIDlg.h"
#include "lmcons.h"
#include "ads.h"
#include "adscontainer.h"
#include "directorysearch.h"
#include "directoryobject.h"
#include "adspropertylist.h"
#include "adsopendsobject.h"
#include "adslargeinteger.h"
#include "security.h"

Go to the source code of this file.

Variables

ADSIIF adsiIfs []

Variable Documentation

ADSIIF adsiIfs[]

Definition at line 47 of file ADQIDlg.cpp.

Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/ADQI/ADQIDlg.h File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • ADQI
Classes | Functions

ADQIDlg.h File Reference

Go to the source code of this file.

Classes

class | CADQIDlg

Functions

void | DlgProcIADsOpenDSObject (LPUNKNOWN pUnk, LPUNKNOWN *ppNew)

Function Documentation

void DlgProcIADsOpenDSObject | ( | LPUNKNOWN | pUnk,
 |  | LPUNKNOWN * | ppNew
 | ) |  |

Definition at line 28 of file ADsOpenDSObject.cpp.

{
   CDlgIADsOpenDSObject dlg( pUnk, ppNew );
   dlg.DoModal();
}

Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/ADQI/ADs.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • ADQI
Defines | Variables

ADs.cpp File Reference

#include "stdafx.h"
#include "ADQI.h"
#include "ADs.h"
#include "ADsContainer.h"

Go to the source code of this file.

Defines

#define STRING_SEPARATOR _T("----------")

Variables

ADSIIF adsiIfs []

Define Documentation

#define STRING_SEPARATOR _T("----------")

Definition at line 29 of file ADs.cpp.

Variable Documentation

ADSIIF adsiIfs[]

Definition at line 47 of file ADQIDlg.cpp.

Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/ADQI/ADs.h File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • ADQI
Classes

ADs.h File Reference

Go to the source code of this file.

Classes

class | CDlgIADs
class | CGetInfoExDlg
Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/ADQI/adscontainer.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • ADQI

adscontainer.cpp File Reference

#include "stdafx.h"
#include "ADQI.h"
#include "ads.h"
#include "ADsContainer.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/ADQI/adscontainer.h File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • ADQI
Classes

adscontainer.h File Reference

Go to the source code of this file.

Classes

class | CDlgIADsContainer
class | CMoveDlg
class | CRenameDlg
Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/ADQI/ADsLargeInteger.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • ADQI

ADsLargeInteger.cpp File Reference

#include "stdafx.h"
#include "ADQI.h"
#include "ADsLargeInteger.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/ADQI/ADsLargeInteger.h File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • ADQI
Classes

ADsLargeInteger.h File Reference

Go to the source code of this file.

Classes

class CDlgIADsLargeInteger
Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/ADQI/ADsOpenDSObject.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • ADQI
Functions

ADsOpenDSObject.cpp File Reference

#include "stdafx.h"
#include "ADQI.h"
#include "ADsOpenDSObject.h"

Go to the source code of this file.

Functions

void DlgProcIADsOpenDSObject (LPUNKNOWN pUnk, LPUNKNOWN *ppNew)

Function Documentation

void DlgProcIADsOpenDSObject | ( | LPUNKNOWN | pUnk,
 |  | LPUNKNOWN * | ppNew
 | ) |  |

Definition at line 28 of file ADsOpenDSObject.cpp.

{
   CDlgIADsOpenDSObject dlg( pUnk, ppNew );
   dlg.DoModal();
}

Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/ADQI/ADsOpenDSObject.h File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • ADQI
Classes

ADsOpenDSObject.h File Reference

Go to the source code of this file.

Classes

class CDlgIADsOpenDSObject
Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/ADQI/ADsPropertyList.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • ADQI

ADsPropertyList.cpp File Reference

#include "stdafx.h"
#include "ADQI.h"
#include "ADsPropertyList.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/ADQI/ADsPropertyList.h File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • ADQI
Classes

ADsPropertyList.h File Reference

Go to the source code of this file.

Classes

class CDlgIADsPropertyList
Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/ADQI/DirectoryObject.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • ADQI

DirectoryObject.cpp File Reference

#include "stdafx.h"
#include "ADQI.h"
#include "DirectoryObject.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/ADQI/DirectoryObject.h File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • ADQI
Classes

DirectoryObject.h File Reference

Go to the source code of this file.

Classes

class | CDeleteObjectDlg
class | CDlgIDirectoryObject
Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/ADQI/DirectorySearch.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • ADQI

DirectorySearch.cpp File Reference

#include "stdafx.h"
#include "ADQI.h"
#include "DirectorySearch.h"
#include "ads.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/ADQI/DirectorySearch.h File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • ADQI
Classes | Defines

DirectorySearch.h File Reference

Go to the source code of this file.

Classes

class | CADsSearch
class | CDlgIDirectorySearch

Defines

#define | MAX_SEARCH_PREF 12

Define Documentation

#define MAX_SEARCH_PREF 12

Definition at line 73 of file DirectorySearch.h.

Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/ADQI/helper.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • ADQI
Functions | Variables

helper.cpp File Reference

#include "stdafx.h"
#include "helper.h"

Go to the source code of this file.

Functions

void | ADsToStringList (ADSVALUE *pValues, DWORD dwNumber, CStringList &sList)
LPWSTR WINAPI | AtlA2WHelper (LPWSTR lpw, LPCSTR lpa, int nChars)
LPSTR WINAPI | AtlW2AHelper (LPSTR lpa, LPCWSTR lpw, int nChars)
CString | GetADSIError (HRESULT hr)
CString | GetErrorMessage (HRESULT hr)
HRESULT | OctetVariantToString (VARIANT &refvar, CString &sResult)
void | PopulateComboBoxFromStringList (CComboBox &list, CStringList &sList)
void | PopulateListBoxFromStringList (CListBox &list, CStringList &sList)
HRESULT | PropertyValueToString (LONG lADsType, IADsPropertyValue *pValue, CString &sValue)
HRESULT | ReportError (HRESULT hr)
void | StringListToString (CStringList &sList, CString &s)
HRESULT | StringListToVariant (VARIANT &refvar, const CStringList &refstringlist)
void | StringToStringList (CString s, CStringList &sList)
HRESULT | VariantToPtrList (VARIANT &refvar, CPtrList &refptrlist)
HRESULT | VariantToStringList (VARIANT &refvar, CStringList &refstringlist)

Variables

ADSERRMSG adsErr []
ADSIIF adsiIfs []

Function Documentation

void ADsToStringList | ( | ADSVALUE * | pValues,
 |  | DWORD | dwNumber,
 |  | CStringList & | sList
 | ) |  |

Definition at line 271 of file helper.cpp.

{
  CString sTemp;

  sList.RemoveAll();

  USES_CONVERSION;

  for (DWORD x=0; x < dwNumber; x++)
  {
        if ( pValues->dwType == ADSTYPE_INVALID )
      {
        continue;
      }

      sTemp.Empty();

      switch( pValues->dwType )
      {
      case ADSTYPE_DN_STRING         :
        sTemp.Format(
        "%s",
                OLE2T(pValues->DNString)
                );
        break;

      case ADSTYPE_CASE_EXACT_STRING :
        sTemp.Format(
                "%s",
                OLE2T(pValues->CaseExactString)
                );
        break;

      case ADSTYPE_CASE_IGNORE_STRING:

        sTemp.Format(
                "%s",
                OLE2T(pValues->CaseIgnoreString)
                );

            break;

      case ADSTYPE_PRINTABLE_STRING  :
        sTemp.Format(
                "%s",
                pValues->PrintableString
                );
        break;

      case ADSTYPE_NUMERIC_STRING    :
        sTemp.Format(
                "%s",
                pValues->NumericString
                );
        break;

      case ADSTYPE_OBJECT_CLASS    :
        sTemp.Format(
                "%s",
                pValues->ClassName
                );
        break;

      case ADSTYPE_BOOLEAN           :
        sTemp.Format(
                "%s",
                (DWORD) pValues->Boolean ?
                "TRUE" : "FALSE"
                );
        break;

      case ADSTYPE_INTEGER           :
        sTemp.Format(
                "%d",
                (DWORD) pValues->Integer
                );
        break;

      case ADSTYPE_OCTET_STRING      :
        {
          CString sOctet;
          CString sPrint;
          CString sChar;

          BYTE  b;
          for ( DWORD idx=0; idx<pValues->OctetString.dwLength; idx++)
          {
            b = ((BYTE *)pValues->OctetString.lpValue)[idx];
            sOctet.Format(
             "%02X ",
              b
            );
            if ( idx != 0 && ((idx % 16)  == 0) )
            {
              sTemp += "\t";
              sTemp += sPrint;
              sList.AddTail( sTemp );
              sTemp.Empty();
              sPrint.Empty();
            }

            if ( !isprint(b) )
            {
              sPrint += _T(".");
            }
            else
            {
              sChar.Format("%c", b );
              sPrint += sChar;

            }

            sTemp += sOctet;

          }

          if ( !sPrint.IsEmpty() )
          {
            DWORD dwMod;
             // Figure out the remaining 16 bytes aligment
             // for display
             dwMod = 16 - (idx % 16);
             for( idx=0;idx < dwMod; idx++ )
             {
              sTemp += _T("Xx ");
             }
             sTemp += _T("\t");
             sTemp += sPrint;
          }

        }
        break;

      case ADSTYPE_LARGE_INTEGER     :
        if  ( pValues->LargeInteger.HighPart )
        {
          sTemp.Format("%ld%ld", pValues->LargeInteger.HighPart, pValues->LargeInteger.LowPart );
        }
        else
        {
          sTemp.Format("%ld", pValues->LargeInteger.LowPart );
        }

        break;

      case ADSTYPE_UTC_TIME          :
        sTemp.Format(
          "%02d/%02d/%04d %02d:%02d:%02d", pValues->UTCTime.wMonth, pValues->UTCTime.wDay, pValues->UTCTime.wYear,
           pValues->UTCTime.wHour, pValues->UTCTime.wMinute, pValues->UTCTime.wSecond
          );
        break;

      case ADSTYPE_PROV_SPECIFIC     :
        sTemp.Format(
          "(provider specific value) "
          );
        break;

      case ADSTYPE_NT_SECURITY_DESCRIPTOR:
        {
          sTemp.Format(_T("%sIADsSecurityDescriptor"), ARROW_SYMBOL );
          }
        break;

      }

      pValues++;

      sList.AddTail( sTemp );

  }

 }

LPWSTR WINAPI AtlA2WHelper | ( | LPWSTR | lpw,
 |  | LPCSTR | lpa,
 |  | int | nChars
 | ) |  |

Definition at line 852 of file helper.cpp.

{
  _ASSERTE(lpa != NULL);
  _ASSERTE(lpw != NULL);
  // verify that no illegal character present
  // since lpw was allocated based on the size of lpa
  // don't worry about the number of chars
  lpw[0] = '\0';
  MultiByteToWideChar(CP_ACP, 0, lpa, -1, lpw, nChars);
  return lpw;
}

LPSTR WINAPI AtlW2AHelper | ( | LPSTR | lpa,
 |  | LPCWSTR | lpw,
 |  | int | nChars
 | ) |  |

Definition at line 864 of file helper.cpp.

{
  _ASSERTE(lpw != NULL);
  _ASSERTE(lpa != NULL);
  // verify that no illegal character present
  // since lpa was allocated based on the size of lpw
  // don't worry about the number of chars
  lpa[0] = '\0';
  WideCharToMultiByte(CP_ACP, 0, lpw, -1, lpa, nChars, NULL, NULL);
  return lpa;
}

CString GetADSIError ( HRESULT hr )

Definition at line 822 of file helper.cpp.

{
  CString s;

  if ( hr & 0x00005000 )
  {
    int idx=0;
    while (adsErr[idx].hr != 0 )
    {
      if ( adsErr[idx].hr == hr )
      {
        return adsErr[idx].pszError;
      }
      idx++;
    }
  }

  return _T("");

}

CString GetErrorMessage ( HRESULT hr )

Definition at line 711 of file helper.cpp.

{
  BOOL bRet;
  CString s;
  LPTSTR lpBuffer=NULL;

  if ( SUCCEEDED(hr) )
  {
    return _T("Success");
  }

  if ( hr & 0x00005000) // standard ADSI Errors
  {
    s = GetADSIError(hr);
  }
  else if ( HRESULT_FACILITY(hr)==FACILITY_WIN32 )
  {

    /////////////////////////////////////////////
    //
    // Retrieve the Win32 Error message
    //
    /////////////////////////////////////////////////

    bRet = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
               NULL,  hr,
               MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT),
               (LPTSTR) &lpBuffer, 0, NULL);

    if ( !bRet )
    {
      s.Format(_T("Error %X"), hr );
    }

    if ( lpBuffer )
    {
      s = lpBuffer;
      LocalFree( lpBuffer );
    }
  }
  else // Non Win32 Error
  {
    s.Format("%X", hr );
  }

  //////////////////////////////////////////////////////////////////
  //
  // Extended error message may be occured.
  //
  // IADs, IADsContainer, IDirectoryObject or IDirectorySearch may return
  // this extended error message
  //
  ////////////////////////////////////////////////////////////////////

  if ( (hr & 0x00005000) ||  //adsi
     (hr & 0x00007000) )   // and win32
  {
    WCHAR szBuffer[MAX_PATH];
    WCHAR szName[MAX_PATH];
    DWORD dwError;

    hr = ADsGetLastError( &dwError, szBuffer, (sizeof(szBuffer)/sizeof(WCHAR))-1,
                        szName, (sizeof(szName)/sizeof(WCHAR))-1 );

    if ( SUCCEEDED(hr) && dwError != ERROR_INVALID_DATA  && wcslen(szBuffer))
    {
      USES_CONVERSION;
      s += _T("  -- Extended Error:");
      s += OLE2T(szName);
      s += _T(" : ");
      s += OLE2T( szBuffer );
    }
  }

  return s;
}

HRESULT OctetVariantToString | ( | VARIANT & | refvar,
 |  | CString & | sResult
 | ) |  |

Definition at line 117 of file helper.cpp.

{
    HRESULT hr = S_OK;
  CString s;
    long start, end;
  USES_CONVERSION;

  if ( !(V_VT(&refvar) &  VT_ARRAY)  ) // Single Value
    {
    return E_UNEXPECTED;
    }

    SAFEARRAY *saAttributes = V_ARRAY( &refvar );

    //
    // Figure out the dimensions of the array.
    //

    hr = SafeArrayGetLBound( saAttributes, 1, &start );
    if( FAILED(hr) )
           return hr;

    hr = SafeArrayGetUBound( saAttributes, 1, &end );
    if( FAILED(hr) )
            return hr;

    VARIANT SingleResult;
    VariantInit( &SingleResult );

    //
    // Process the array elements.
    //
  sResult.Empty();
    for ( long idx = start; idx <= end; idx++   )
  {

        hr = SafeArrayGetElement( saAttributes, &idx, &SingleResult );
        if( FAILED(hr) )
    {
            return hr;
    }

    if ( V_VT(&SingleResult) == VT_I1 )
    {
      s.Format("%02X", V_I1(&SingleResult));
      sResult += s;
      VariantClear( &SingleResult );
    }
    }

    return S_OK;
} // VariantToStringList()

void PopulateComboBoxFromStringList | ( | CComboBox & | list,
 |  | CStringList & | sList
 | ) |  |

Definition at line 471 of file helper.cpp.

{
  POSITION pos;

  pos = sList.GetHeadPosition();
  while( pos != NULL )
  {
    list.AddString( sList.GetAt(pos));
    sList.GetNext(pos);
  }

}

void PopulateListBoxFromStringList | ( | CListBox & | list,
 |  | CStringList & | sList
 | ) |  |

Definition at line 455 of file helper.cpp.

{
  POSITION pos;

  pos = sList.GetHeadPosition();
  while( pos != NULL )
  {
    list.AddString( sList.GetAt(pos));
    sList.GetNext(pos);
  }

}

HRESULT PropertyValueToString | ( | LONG | lADsType,
 |  | IADsPropertyValue * | pValue,
 |  | CString & | sValue
 | ) |  |

Definition at line 559 of file helper.cpp.

{
  BSTR bstr = NULL;
  LONG l;
  VARIANT var;
  HRESULT hr = S_OK;
  sValue.Empty();

  VariantInit(&var);
  switch( lADsType )
  {
  case ADSTYPE_DN_STRING:
     hr = pValue->get_DNString( &bstr );
     sValue = bstr;
    break;

  case ADSTYPE_CASE_EXACT_STRING:
    hr = pValue->get_CaseExactString( &bstr );
    sValue = bstr;
    break;

  case ADSTYPE_CASE_IGNORE_STRING:
     hr = pValue->get_CaseIgnoreString( &bstr );
     sValue = bstr;
    break;

  case ADSTYPE_PRINTABLE_STRING:
     hr = pValue->get_PrintableString( &bstr );
     sValue = bstr;
    break;

  case ADSTYPE_NUMERIC_STRING:
    hr = pValue->get_NumericString( &bstr );
    sValue = bstr;
    break;

  case ADSTYPE_BOOLEAN:
     hr = pValue->get_Boolean( &l );
     sValue = l ? _T("TRUE") : _T("FALSE");
    break;

  case ADSTYPE_INTEGER:
     hr = pValue->get_Integer( &l );
     sValue.Format("%ld", l );
    break;

  case ADSTYPE_OCTET_STRING:
     hr = pValue->get_OctetString( &var );
     if ( SUCCEEDED(hr) )
     {
      CString s;
      hr =  OctetVariantToString( var, s);
      if ( SUCCEEDED(hr) )
      {
        sValue = s;
      }
     }

    break;

  case ADSTYPE_UTC_TIME:
    {
      DATE date;
      hr = pValue->get_UTCTime(&date);

    }
    break;

  case ADSTYPE_LARGE_INTEGER:
    sValue.Format(_T("%sIADsLargeInteger"), ARROW_SYMBOL );
    break;

  case ADSTYPE_PROV_SPECIFIC:
    sValue = _T("Provider Specific");
    break;

  case ADSTYPE_CASEIGNORE_LIST:
    hr = pValue->get_CaseIgnoreString(&bstr);
    sValue = bstr;
    break;

  case ADSTYPE_OCTET_LIST:
    sValue.Format(_T("%sIADsOctetString"), ARROW_SYMBOL );
    break;

  case ADSTYPE_PATH:
    sValue.Format(_T("%sIADsPath"), ARROW_SYMBOL );
    break;

  case ADSTYPE_POSTALADDRESS:
    sValue.Format(_T("%sIADsPostalAddress"), ARROW_SYMBOL );
    break;

  case ADSTYPE_TIMESTAMP:
    sValue.Format(_T("%sIADsTimestamp"), ARROW_SYMBOL );
    break;

  case ADSTYPE_BACKLINK:
    sValue.Format(_T("%sIADsBackLink"), ARROW_SYMBOL );
    break;

  case ADSTYPE_TYPEDNAME:
    sValue.Format(_T("%sIADsTypedName"), ARROW_SYMBOL );
    break;

  case ADSTYPE_HOLD:
    sValue.Format(_T("%sIADsHold"), ARROW_SYMBOL );
    break;

  case ADSTYPE_NETADDRESS:
    sValue.Format(_T("%sIADsNetAddress"), ARROW_SYMBOL );
    break;

  case ADSTYPE_REPLICAPOINTER:
    sValue.Format(_T("%sIADsReplicaPointer"), ARROW_SYMBOL );
    break;

  case ADSTYPE_FAXNUMBER:
    sValue.Format(_T("%sIADsFaxNumber"), ARROW_SYMBOL );
    break;

  case ADSTYPE_EMAIL:
    sValue.Format(_T("%sIADsEmail"), ARROW_SYMBOL );
    break;

  case ADSTYPE_NT_SECURITY_DESCRIPTOR:
    sValue.Format(_T("%sIADsSecurityDescriptor"), ARROW_SYMBOL );
    break;

  case ADSTYPE_UNKNOWN:
     sValue = _T("Unknown");
     break;

  }

  if ( bstr )
  {
    SysFreeString( bstr );
  }

  VariantClear(&var);
  pValue->Release();
  return hr;
}

HRESULT ReportError ( HRESULT hr )

Definition at line 487 of file helper.cpp.

{
  AfxMessageBox( GetErrorMessage(hr) );
  return hr;
}

void StringListToString | ( | CStringList & | sList,
 |  | CString & | s
 | ) |  |

Definition at line 241 of file helper.cpp.

{
  POSITION pos;
  int idx=0;
  CString sTemp;

  pos = sList.GetHeadPosition();
  s.Empty();
  while( pos != NULL )
  {
    if ( idx )
    {
      s += _T(" #");
      s += sList.GetAt(pos);
    }
    else
    {
      s += sList.GetAt(pos);
    }

    sList.GetNext(pos);
    idx++;

  }

}

HRESULT StringListToVariant | ( | VARIANT & | refvar,
 |  | const CStringList & | refstringlist
 | ) |  |

Definition at line 175 of file helper.cpp.

{
    HRESULT hr = S_OK;
    int cCount = refstringlist.GetCount();

    SAFEARRAYBOUND rgsabound[1];
    rgsabound[0].lLbound = 0;
    rgsabound[0].cElements = cCount;

    SAFEARRAY* psa = SafeArrayCreate(VT_VARIANT, 1, rgsabound);
    if (NULL == psa)
        return E_OUTOFMEMORY;

    VariantClear( &refvar );
    V_VT(&refvar) = VT_VARIANT|VT_ARRAY;
    V_ARRAY(&refvar) = psa;

    VARIANT SingleResult;
    VariantInit( &SingleResult );
    V_VT(&SingleResult) = VT_BSTR;
    POSITION pos = refstringlist.GetHeadPosition();
    long i;
    for (i = 0; i < cCount, pos != NULL; i++)
    {
        V_BSTR(&SingleResult) = T2BSTR((LPCTSTR)refstringlist.GetNext(pos));
        hr = SafeArrayPutElement(psa, &i, &SingleResult);
        if( FAILED(hr) )
            return hr;
    }
    if (i != cCount || pos != NULL)
        return E_UNEXPECTED;

    return hr;
} // StringListToVariant()

void StringToStringList | ( | CString | s,
 |  | CStringList & | sList
 | ) |  |

Definition at line 211 of file helper.cpp.

{
  int idx;
  CString sAttr;

  //////////////////////////////////////////
  // Parse and put them in the string list
  //////////////////////////////////////////
  idx = s.Find(_T(","));
  while( idx != -1 )
  {
       sAttr = s.Mid(0, idx );
       sAttr.TrimLeft(); sAttr.TrimRight();
       if ( !sAttr.IsEmpty() )
       {
       sList.AddTail( sAttr );
       }
       s = s.Mid( idx + 1 );
       idx = s.Find(_T(","));
  }
  s.TrimLeft(); s.TrimRight();
  if ( !s.IsEmpty() )
  {
    sList.AddTail( s );
  }

}

HRESULT VariantToPtrList | ( | VARIANT & | refvar,
 |  | CPtrList & | refptrlist
 | ) |  |

Definition at line 495 of file helper.cpp.

{
    HRESULT hr = S_OK;
    long start, end;

  if ( !(V_VT(&refvar) &  VT_ARRAY)  )
    {

    if ( V_VT(&refvar) != VT_DISPATCH )
    {
      return E_FAIL;
    }
    else
    {
       refptrlist.AddHead( V_DISPATCH(&refvar) );

    }

    }

    SAFEARRAY *saAttributes = V_ARRAY( &refvar );

    //
    // Figure out the dimensions of the array.
    //

    hr = SafeArrayGetLBound( saAttributes, 1, &start );
        if( FAILED(hr) )
                return hr;

    hr = SafeArrayGetUBound( saAttributes, 1, &end );
        if( FAILED(hr) )
                return hr;

    VARIANT SingleResult;
    VariantInit( &SingleResult );

    //
    // Process the array elements.
    //

    for ( long idx = start; idx <= end; idx++   )
  {

        hr = SafeArrayGetElement( saAttributes, &idx, &SingleResult );
        if( FAILED(hr) )
    {
            return hr;
    }

    if ( V_VT(&SingleResult) != VT_DISPATCH )
    {
      return E_UNEXPECTED;
    }

        refptrlist.AddHead( V_DISPATCH(&SingleResult) );
    }

    return S_OK;
} // VariantToStringList()

HRESULT VariantToStringList | ( | VARIANT & | refvar,
 |  | CStringList & | refstringlist
 | ) |  |

Definition at line 8 of file helper.cpp.

{
    HRESULT hr = S_OK;
    long start, end;
  USES_CONVERSION;

  if ( !(V_VT(&refvar) &  VT_ARRAY)  ) // Single Value
    {
    if ( V_VT(&refvar) == VT_DISPATCH )
    {
      // Find out which interfaces it supports
      IUnknown *pQI;
      int xx=0;
      CString s;
      while( !IsEqualIID( *adsiIfs[xx].pIID, IID_NULL ) )
      {
               hr = V_DISPATCH(&refvar)->QueryInterface( *adsiIfs[xx].pIID, (void**) &pQI );
               if ( SUCCEEDED(hr) )
           {
              s = ARROW_SYMBOL;
            s += adsiIfs[xx].szIf;
                  refstringlist.AddHead( s );
                  pQI->Release();
           }
               xx++;
      }
      return S_OK;

    }
    else if ( V_VT(&refvar) != VT_BSTR )
    {

      hr = VariantChangeType( &refvar, &refvar,0, VT_BSTR );

      if( FAILED(hr) )
      {
        return hr;
      }

    }

    refstringlist.AddHead( OLE2T(V_BSTR(&refvar)) );
        return hr;
    }

    SAFEARRAY *saAttributes = V_ARRAY( &refvar );

    //
    // Figure out the dimensions of the array.
    //

    hr = SafeArrayGetLBound( saAttributes, 1, &start );
        if( FAILED(hr) )
                return hr;

    hr = SafeArrayGetUBound( saAttributes, 1, &end );
        if( FAILED(hr) )
                return hr;

    VARIANT SingleResult;
    VariantInit( &SingleResult );

    //
    // Process the array elements.
    //

    for ( long idx = start; idx <= end; idx++   )
  {

        hr = SafeArrayGetElement( saAttributes, &idx, &SingleResult );
        if( FAILED(hr) )
    {
            return hr;
    }

    if ( V_VT(&SingleResult) != VT_BSTR )
    {

      if ( V_VT(&SingleResult) == VT_NULL )
      {
        V_VT(&SingleResult ) = VT_BSTR;
        V_BSTR(&SingleResult ) = SysAllocString(L"0");
      }
      else
      {
        hr = VariantChangeType( &SingleResult, &SingleResult,0, VT_BSTR );

        if( FAILED(hr) )
        {
          return hr;
        }
      }
    }

         refstringlist.AddHead( OLE2T(V_BSTR(&SingleResult)) );
        VariantClear( &SingleResult );
    }

    return S_OK;
} // VariantToStringList()

Variable Documentation

ADSERRMSG adsErr[]
Initial value:

{
  ADDADSERROR(E_ADS_BAD_PATHNAME),
  ADDADSERROR(E_ADS_INVALID_DOMAIN_OBJECT),
  ADDADSERROR(E_ADS_INVALID_USER_OBJECT),
  ADDADSERROR(E_ADS_INVALID_COMPUTER_OBJECT),
  ADDADSERROR(E_ADS_UNKNOWN_OBJECT),
  ADDADSERROR(E_ADS_PROPERTY_NOT_SET),
  ADDADSERROR(E_ADS_PROPERTY_NOT_SUPPORTED),
  ADDADSERROR(E_ADS_PROPERTY_INVALID),
  ADDADSERROR(E_ADS_BAD_PARAMETER),
  ADDADSERROR(E_ADS_OBJECT_UNBOUND),
  ADDADSERROR(E_ADS_PROPERTY_NOT_MODIFIED),
  ADDADSERROR(E_ADS_PROPERTY_MODIFIED),
  ADDADSERROR(E_ADS_CANT_CONVERT_DATATYPE),
  ADDADSERROR(E_ADS_PROPERTY_NOT_FOUND),
  ADDADSERROR(E_ADS_OBJECT_EXISTS),
  ADDADSERROR(E_ADS_SCHEMA_VIOLATION),
  ADDADSERROR(E_ADS_COLUMN_NOT_SET),
  ADDADSERROR(E_ADS_INVALID_FILTER),
  ADDADSERROR(0),
}

Definition at line 793 of file helper.cpp.

ADSIIF adsiIfs[]

Definition at line 47 of file ADQIDlg.cpp.

Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/ADQI/helper.h File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • ADQI
Defines | Functions

helper.h File Reference

Go to the source code of this file.

Defines

#define | RETURN_ON_FAILURE(hr) if (!SUCCEEDED(hr)) { ReportError(hr); return; }

Functions

void | ADsToStringList (ADSVALUE *pValue, DWORD dwNumber, CStringList &sList)
CString | GetADSIError (HRESULT hr)
CString | GetErrorMessage (HRESULT hr)
HRESULT | OctetVariantToString (VARIANT &refvar, CString &sResult)
void | PopulateComboBoxFromStringList (CComboBox &list, CStringList &sList)
void | PopulateListBoxFromStringList (CListBox &list, CStringList &sList)
HRESULT | PropertyValueToString (LONG lADsType, IADsPropertyValue *pValue, CString &sValue)
HRESULT | ReportError (HRESULT hr)
void | StringListToString (CStringList &sList, CString &s)
HRESULT | StringListToVariant (VARIANT &refvar, const CStringList &refstringlist)
void | StringToStringList (CString s, CStringList &sList)
HRESULT | VariantToPtrList (VARIANT &refvar, CPtrList &refptrlist)
HRESULT | VariantToStringList (VARIANT &refvar, CStringList &refstringlist)

Define Documentation

#define RETURN_ON_FAILURE ( hr ) if (!SUCCEEDED(hr)) { ReportError(hr); return; }

Definition at line 18 of file helper.h.

Function Documentation

void ADsToStringList | ( | ADSVALUE * | pValue,
 |  | DWORD | dwNumber,
 |  | CStringList & | sList
 | ) |  |

Definition at line 271 of file helper.cpp.

{
  CString sTemp;

  sList.RemoveAll();

  USES_CONVERSION;

  for (DWORD x=0; x < dwNumber; x++)
  {
        if ( pValues->dwType == ADSTYPE_INVALID )
      {
        continue;
      }

      sTemp.Empty();

      switch( pValues->dwType )
      {
      case ADSTYPE_DN_STRING         :
        sTemp.Format(
        "%s",
                OLE2T(pValues->DNString)
                );
        break;

      case ADSTYPE_CASE_EXACT_STRING :
        sTemp.Format(
                "%s",
                OLE2T(pValues->CaseExactString)
                );
        break;

      case ADSTYPE_CASE_IGNORE_STRING:

        sTemp.Format(
                "%s",
                OLE2T(pValues->CaseIgnoreString)
                );

            break;

      case ADSTYPE_PRINTABLE_STRING  :
        sTemp.Format(
                "%s",
                pValues->PrintableString
                );
        break;

      case ADSTYPE_NUMERIC_STRING    :
        sTemp.Format(
                "%s",
                pValues->NumericString
                );
        break;

      case ADSTYPE_OBJECT_CLASS    :
        sTemp.Format(
                "%s",
                pValues->ClassName
                );
        break;

      case ADSTYPE_BOOLEAN           :
        sTemp.Format(
                "%s",
                (DWORD) pValues->Boolean ?
                "TRUE" : "FALSE"
                );
        break;

      case ADSTYPE_INTEGER           :
        sTemp.Format(
                "%d",
                (DWORD) pValues->Integer
                );
        break;

      case ADSTYPE_OCTET_STRING      :
        {
          CString sOctet;
          CString sPrint;
          CString sChar;

          BYTE  b;
          for ( DWORD idx=0; idx<pValues->OctetString.dwLength; idx++)
          {
            b = ((BYTE *)pValues->OctetString.lpValue)[idx];
            sOctet.Format(
             "%02X ",
              b
            );
            if ( idx != 0 && ((idx % 16)  == 0) )
            {
              sTemp += "\t";
              sTemp += sPrint;
              sList.AddTail( sTemp );
              sTemp.Empty();
              sPrint.Empty();
            }

            if ( !isprint(b) )
            {
              sPrint += _T(".");
            }
            else
            {
              sChar.Format("%c", b );
              sPrint += sChar;

            }

            sTemp += sOctet;

          }

          if ( !sPrint.IsEmpty() )
          {
            DWORD dwMod;
             // Figure out the remaining 16 bytes aligment
             // for display
             dwMod = 16 - (idx % 16);
             for( idx=0;idx < dwMod; idx++ )
             {
              sTemp += _T("Xx ");
             }
             sTemp += _T("\t");
             sTemp += sPrint;
          }

        }
        break;

      case ADSTYPE_LARGE_INTEGER     :
        if  ( pValues->LargeInteger.HighPart )
        {
          sTemp.Format("%ld%ld", pValues->LargeInteger.HighPart, pValues->LargeInteger.LowPart );
        }
        else
        {
          sTemp.Format("%ld", pValues->LargeInteger.LowPart );
        }

        break;

      case ADSTYPE_UTC_TIME          :
        sTemp.Format(
          "%02d/%02d/%04d %02d:%02d:%02d", pValues->UTCTime.wMonth, pValues->UTCTime.wDay, pValues->UTCTime.wYear,
           pValues->UTCTime.wHour, pValues->UTCTime.wMinute, pValues->UTCTime.wSecond
          );
        break;

      case ADSTYPE_PROV_SPECIFIC     :
        sTemp.Format(
          "(provider specific value) "
          );
        break;

      case ADSTYPE_NT_SECURITY_DESCRIPTOR:
        {
          sTemp.Format(_T("%sIADsSecurityDescriptor"), ARROW_SYMBOL );
          }
        break;

      }

      pValues++;

      sList.AddTail( sTemp );

  }

 }

CString GetADSIError ( HRESULT hr )

Definition at line 822 of file helper.cpp.

{
  CString s;

  if ( hr & 0x00005000 )
  {
    int idx=0;
    while (adsErr[idx].hr != 0 )
    {
      if ( adsErr[idx].hr == hr )
      {
        return adsErr[idx].pszError;
      }
      idx++;
    }
  }

  return _T("");

}

CString GetErrorMessage ( HRESULT hr )

Definition at line 711 of file helper.cpp.

{
  BOOL bRet;
  CString s;
  LPTSTR lpBuffer=NULL;

  if ( SUCCEEDED(hr) )
  {
    return _T("Success");
  }

  if ( hr & 0x00005000) // standard ADSI Errors
  {
    s = GetADSIError(hr);
  }
  else if ( HRESULT_FACILITY(hr)==FACILITY_WIN32 )
  {

    /////////////////////////////////////////////
    //
    // Retrieve the Win32 Error message
    //
    /////////////////////////////////////////////////

    bRet = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
               NULL,  hr,
               MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT),
               (LPTSTR) &lpBuffer, 0, NULL);

    if ( !bRet )
    {
      s.Format(_T("Error %X"), hr );
    }

    if ( lpBuffer )
    {
      s = lpBuffer;
      LocalFree( lpBuffer );
    }
  }
  else // Non Win32 Error
  {
    s.Format("%X", hr );
  }

  //////////////////////////////////////////////////////////////////
  //
  // Extended error message may be occured.
  //
  // IADs, IADsContainer, IDirectoryObject or IDirectorySearch may return
  // this extended error message
  //
  ////////////////////////////////////////////////////////////////////

  if ( (hr & 0x00005000) ||  //adsi
     (hr & 0x00007000) )   // and win32
  {
    WCHAR szBuffer[MAX_PATH];
    WCHAR szName[MAX_PATH];
    DWORD dwError;

    hr = ADsGetLastError( &dwError, szBuffer, (sizeof(szBuffer)/sizeof(WCHAR))-1,
                        szName, (sizeof(szName)/sizeof(WCHAR))-1 );

    if ( SUCCEEDED(hr) && dwError != ERROR_INVALID_DATA  && wcslen(szBuffer))
    {
      USES_CONVERSION;
      s += _T("  -- Extended Error:");
      s += OLE2T(szName);
      s += _T(" : ");
      s += OLE2T( szBuffer );
    }
  }

  return s;
}

HRESULT OctetVariantToString | ( | VARIANT & | refvar,
 |  | CString & | sResult
 | ) |  |

Definition at line 117 of file helper.cpp.

{
    HRESULT hr = S_OK;
  CString s;
    long start, end;
  USES_CONVERSION;

  if ( !(V_VT(&refvar) &  VT_ARRAY)  ) // Single Value
    {
    return E_UNEXPECTED;
    }

    SAFEARRAY *saAttributes = V_ARRAY( &refvar );

    //
    // Figure out the dimensions of the array.
    //

    hr = SafeArrayGetLBound( saAttributes, 1, &start );
    if( FAILED(hr) )
           return hr;

    hr = SafeArrayGetUBound( saAttributes, 1, &end );
    if( FAILED(hr) )
            return hr;

    VARIANT SingleResult;
    VariantInit( &SingleResult );

    //
    // Process the array elements.
    //
  sResult.Empty();
    for ( long idx = start; idx <= end; idx++   )
  {

        hr = SafeArrayGetElement( saAttributes, &idx, &SingleResult );
        if( FAILED(hr) )
    {
            return hr;
    }

    if ( V_VT(&SingleResult) == VT_I1 )
    {
      s.Format("%02X", V_I1(&SingleResult));
      sResult += s;
      VariantClear( &SingleResult );
    }
    }

    return S_OK;
} // VariantToStringList()

void PopulateComboBoxFromStringList | ( | CComboBox & | list,
 |  | CStringList & | sList
 | ) |  |

Definition at line 471 of file helper.cpp.

{
  POSITION pos;

  pos = sList.GetHeadPosition();
  while( pos != NULL )
  {
    list.AddString( sList.GetAt(pos));
    sList.GetNext(pos);
  }

}

void PopulateListBoxFromStringList | ( | CListBox & | list,
 |  | CStringList & | sList
 | ) |  |

Definition at line 455 of file helper.cpp.

{
  POSITION pos;

  pos = sList.GetHeadPosition();
  while( pos != NULL )
  {
    list.AddString( sList.GetAt(pos));
    sList.GetNext(pos);
  }

}

HRESULT PropertyValueToString | ( | LONG | lADsType,
 |  | IADsPropertyValue * | pValue,
 |  | CString & | sValue
 | ) |  |

Definition at line 559 of file helper.cpp.

{
  BSTR bstr = NULL;
  LONG l;
  VARIANT var;
  HRESULT hr = S_OK;
  sValue.Empty();

  VariantInit(&var);
  switch( lADsType )
  {
  case ADSTYPE_DN_STRING:
     hr = pValue->get_DNString( &bstr );
     sValue = bstr;
    break;

  case ADSTYPE_CASE_EXACT_STRING:
    hr = pValue->get_CaseExactString( &bstr );
    sValue = bstr;
    break;

  case ADSTYPE_CASE_IGNORE_STRING:
     hr = pValue->get_CaseIgnoreString( &bstr );
     sValue = bstr;
    break;

  case ADSTYPE_PRINTABLE_STRING:
     hr = pValue->get_PrintableString( &bstr );
     sValue = bstr;
    break;

  case ADSTYPE_NUMERIC_STRING:
    hr = pValue->get_NumericString( &bstr );
    sValue = bstr;
    break;

  case ADSTYPE_BOOLEAN:
     hr = pValue->get_Boolean( &l );
     sValue = l ? _T("TRUE") : _T("FALSE");
    break;

  case ADSTYPE_INTEGER:
     hr = pValue->get_Integer( &l );
     sValue.Format("%ld", l );
    break;

  case ADSTYPE_OCTET_STRING:
     hr = pValue->get_OctetString( &var );
     if ( SUCCEEDED(hr) )
     {
      CString s;
      hr =  OctetVariantToString( var, s);
      if ( SUCCEEDED(hr) )
      {
        sValue = s;
      }
     }

    break;

  case ADSTYPE_UTC_TIME:
    {
      DATE date;
      hr = pValue->get_UTCTime(&date);

    }
    break;

  case ADSTYPE_LARGE_INTEGER:
    sValue.Format(_T("%sIADsLargeInteger"), ARROW_SYMBOL );
    break;

  case ADSTYPE_PROV_SPECIFIC:
    sValue = _T("Provider Specific");
    break;

  case ADSTYPE_CASEIGNORE_LIST:
    hr = pValue->get_CaseIgnoreString(&bstr);
    sValue = bstr;
    break;

  case ADSTYPE_OCTET_LIST:
    sValue.Format(_T("%sIADsOctetString"), ARROW_SYMBOL );
    break;

  case ADSTYPE_PATH:
    sValue.Format(_T("%sIADsPath"), ARROW_SYMBOL );
    break;

  case ADSTYPE_POSTALADDRESS:
    sValue.Format(_T("%sIADsPostalAddress"), ARROW_SYMBOL );
    break;

  case ADSTYPE_TIMESTAMP:
    sValue.Format(_T("%sIADsTimestamp"), ARROW_SYMBOL );
    break;

  case ADSTYPE_BACKLINK:
    sValue.Format(_T("%sIADsBackLink"), ARROW_SYMBOL );
    break;

  case ADSTYPE_TYPEDNAME:
    sValue.Format(_T("%sIADsTypedName"), ARROW_SYMBOL );
    break;

  case ADSTYPE_HOLD:
    sValue.Format(_T("%sIADsHold"), ARROW_SYMBOL );
    break;

  case ADSTYPE_NETADDRESS:
    sValue.Format(_T("%sIADsNetAddress"), ARROW_SYMBOL );
    break;

  case ADSTYPE_REPLICAPOINTER:
    sValue.Format(_T("%sIADsReplicaPointer"), ARROW_SYMBOL );
    break;

  case ADSTYPE_FAXNUMBER:
    sValue.Format(_T("%sIADsFaxNumber"), ARROW_SYMBOL );
    break;

  case ADSTYPE_EMAIL:
    sValue.Format(_T("%sIADsEmail"), ARROW_SYMBOL );
    break;

  case ADSTYPE_NT_SECURITY_DESCRIPTOR:
    sValue.Format(_T("%sIADsSecurityDescriptor"), ARROW_SYMBOL );
    break;

  case ADSTYPE_UNKNOWN:
     sValue = _T("Unknown");
     break;

  }

  if ( bstr )
  {
    SysFreeString( bstr );
  }

  VariantClear(&var);
  pValue->Release();
  return hr;
}

HRESULT ReportError ( HRESULT hr )

Definition at line 487 of file helper.cpp.

{
  AfxMessageBox( GetErrorMessage(hr) );
  return hr;
}

void StringListToString | ( | CStringList & | sList,
 |  | CString & | s
 | ) |  |

Definition at line 241 of file helper.cpp.

{
  POSITION pos;
  int idx=0;
  CString sTemp;

  pos = sList.GetHeadPosition();
  s.Empty();
  while( pos != NULL )
  {
    if ( idx )
    {
      s += _T(" #");
      s += sList.GetAt(pos);
    }
    else
    {
      s += sList.GetAt(pos);
    }

    sList.GetNext(pos);
    idx++;

  }

}

HRESULT StringListToVariant | ( | VARIANT & | refvar,
 |  | const CStringList & | refstringlist
 | ) |  |

Definition at line 51 of file util.cpp.

{
  HRESULT hr = S_OK;
  int cCount = refstringlist.GetCount();

  SAFEARRAYBOUND rgsabound[1];
  rgsabound[0].lLbound = 0;
  rgsabound[0].cElements = cCount;

  SAFEARRAY* psa = SafeArrayCreate(VT_VARIANT, 1, rgsabound);
  if (NULL == psa)
    return E_OUTOFMEMORY;

  VariantClear( &refvar );
  V_VT(&refvar) = VT_VARIANT|VT_ARRAY;
  V_ARRAY(&refvar) = psa;

  VARIANT SingleResult;
  VariantInit( &SingleResult );
  V_VT(&SingleResult) = VT_BSTR;
  POSITION pos = refstringlist.GetHeadPosition();
  long i;
  for (i = 0; i < cCount, pos != NULL; i++)
  {
    V_BSTR(&SingleResult) = T2BSTR((LPCTSTR)refstringlist.GetNext(pos));
    hr = SafeArrayPutElement(psa, &i, &SingleResult);
    if( FAILED(hr) )
      return hr;
  }
  if (i != cCount || pos != NULL)
    return E_UNEXPECTED;

  return hr;
} // StringListToVariant()

void StringToStringList | ( | CString | s,
 |  | CStringList & | sList
 | ) |  |

Definition at line 211 of file helper.cpp.

{
  int idx;
  CString sAttr;

  //////////////////////////////////////////
  // Parse and put them in the string list
  //////////////////////////////////////////
  idx = s.Find(_T(","));
  while( idx != -1 )
  {
       sAttr = s.Mid(0, idx );
       sAttr.TrimLeft(); sAttr.TrimRight();
       if ( !sAttr.IsEmpty() )
       {
       sList.AddTail( sAttr );
       }
       s = s.Mid( idx + 1 );
       idx = s.Find(_T(","));
  }
  s.TrimLeft(); s.TrimRight();
  if ( !s.IsEmpty() )
  {
    sList.AddTail( s );
  }

}

HRESULT VariantToPtrList | ( | VARIANT & | refvar,
 |  | CPtrList & | refptrlist
 | ) |  |

Definition at line 495 of file helper.cpp.

{
    HRESULT hr = S_OK;
    long start, end;

  if ( !(V_VT(&refvar) &  VT_ARRAY)  )
    {

    if ( V_VT(&refvar) != VT_DISPATCH )
    {
      return E_FAIL;
    }
    else
    {
       refptrlist.AddHead( V_DISPATCH(&refvar) );

    }

    }

    SAFEARRAY *saAttributes = V_ARRAY( &refvar );

    //
    // Figure out the dimensions of the array.
    //

    hr = SafeArrayGetLBound( saAttributes, 1, &start );
        if( FAILED(hr) )
                return hr;

    hr = SafeArrayGetUBound( saAttributes, 1, &end );
        if( FAILED(hr) )
                return hr;

    VARIANT SingleResult;
    VariantInit( &SingleResult );

    //
    // Process the array elements.
    //

    for ( long idx = start; idx <= end; idx++   )
  {

        hr = SafeArrayGetElement( saAttributes, &idx, &SingleResult );
        if( FAILED(hr) )
    {
            return hr;
    }

    if ( V_VT(&SingleResult) != VT_DISPATCH )
    {
      return E_UNEXPECTED;
    }

        refptrlist.AddHead( V_DISPATCH(&SingleResult) );
    }

    return S_OK;
} // VariantToStringList()

HRESULT VariantToStringList | ( | VARIANT & | refvar,
 |  | CStringList & | refstringlist
 | ) |  |

Definition at line 8 of file helper.cpp.

{
    HRESULT hr = S_OK;
    long start, end;
  USES_CONVERSION;

  if ( !(V_VT(&refvar) &  VT_ARRAY)  ) // Single Value
    {
    if ( V_VT(&refvar) == VT_DISPATCH )
    {
      // Find out which interfaces it supports
      IUnknown *pQI;
      int xx=0;
      CString s;
      while( !IsEqualIID( *adsiIfs[xx].pIID, IID_NULL ) )
      {
               hr = V_DISPATCH(&refvar)->QueryInterface( *adsiIfs[xx].pIID, (void**) &pQI );
               if ( SUCCEEDED(hr) )
           {
              s = ARROW_SYMBOL;
            s += adsiIfs[xx].szIf;
                  refstringlist.AddHead( s );
                  pQI->Release();
           }
               xx++;
      }
      return S_OK;

    }
    else if ( V_VT(&refvar) != VT_BSTR )
    {

      hr = VariantChangeType( &refvar, &refvar,0, VT_BSTR );

      if( FAILED(hr) )
      {
        return hr;
      }

    }

    refstringlist.AddHead( OLE2T(V_BSTR(&refvar)) );
        return hr;
    }

    SAFEARRAY *saAttributes = V_ARRAY( &refvar );

    //
    // Figure out the dimensions of the array.
    //

    hr = SafeArrayGetLBound( saAttributes, 1, &start );
        if( FAILED(hr) )
                return hr;

    hr = SafeArrayGetUBound( saAttributes, 1, &end );
        if( FAILED(hr) )
                return hr;

    VARIANT SingleResult;
    VariantInit( &SingleResult );

    //
    // Process the array elements.
    //

    for ( long idx = start; idx <= end; idx++   )
  {

        hr = SafeArrayGetElement( saAttributes, &idx, &SingleResult );
        if( FAILED(hr) )
    {
            return hr;
    }

    if ( V_VT(&SingleResult) != VT_BSTR )
    {

      if ( V_VT(&SingleResult) == VT_NULL )
      {
        V_VT(&SingleResult ) = VT_BSTR;
        V_BSTR(&SingleResult ) = SysAllocString(L"0");
      }
      else
      {
        hr = VariantChangeType( &SingleResult, &SingleResult,0, VT_BSTR );

        if( FAILED(hr) )
        {
          return hr;
        }
      }
    }

         refstringlist.AddHead( OLE2T(V_BSTR(&SingleResult)) );
        VariantClear( &SingleResult );
    }

    return S_OK;
} // VariantToStringList()

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/ADQI/resource.h File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • ADQI
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_ACELIST 1082
#define | IDC_ACETYPE 1100
#define | IDC_ADSPATH 1001
#define | IDC_ADSTYPE 1061
#define | IDC_ASYNCH 1075
#define | IDC_ATTR 1019
#define | IDC_ATTRIBONLY 1073
#define | IDC_ATTRIBUTE 1058
#define | IDC_ATTRLIST 1017
#define | IDC_ATTRVALUE 1018
#define | IDC_BINDGUID 1099
#define | IDC_BROWSE 1030
#define | IDC_BUTTON1 1099
#define | IDC_CACHERESULTS 1057
#define | IDC_CHANGE_CREATE_CHILD 1094
#define | IDC_CHANGE_CREATE_CHILD2 1095
#define | IDC_CHANGE_CREATE_CHILD3 1096
#define | IDC_CHANGE_CREATE_CHILD4 1097
#define | IDC_CHANGEUSER 1023
#define | IDC_CHASEREFERRAL 1039
#define | IDC_CHASEREFERRAL_TXT 1038
#define | IDC_CHECK2 1084
#define | IDC_CHILDRENLIST 1021
#define | IDC_CLASS 1007
#define | IDC_CLEARTEXT 1080
#define | IDC_COPY 1016
#define | IDC_CREATE 1028
#define | IDC_CREATE_CHILD 1083
#define | IDC_CREATECHILD 1083
#define | IDC_CREATECHILD_EDIT 1090
#define | IDC_CURRENTCREDENTIAL 1077
#define | IDC_DELETE 1026
#define | IDC_DELETECHILD 1084
#define | IDC_DELETECHILD_EDIT 1091
#define | IDC_DELETEOBJECT 1102
#define | IDC_DELETETREE 1089
#define | IDC_DEREF 1074
#define | IDC_DEREF_TXT 1076
#define | IDC_DN 1052
#define | IDC_ENABLED 1044
#define | IDC_ENCRYPT 1067
#define | IDC_EXECUTE 1042
#define | IDC_EXTENDEDRIGHT 1106
#define | IDC_EXTENDEDRIGHT_EDIT 1098
#define | IDC_FASTBIND 1080
#define | IDC_FILTER 1024
#define | IDC_GET 1014
#define | IDC_GETEX 1015
#define | IDC_GETINFO 1011
#define | IDC_GETINFOEX 1012
#define | IDC_GUID 1010
#define | IDC_HIPART 1110
#define | IDC_INHERITANCE 1101
#define | IDC_INTERFACES 1002
#define | IDC_LISTCONTENT 1085
#define | IDC_LISTOBJECT 1086
#define | IDC_LISTVIEW 1111
#define | IDC_LOWPART 1111
#define | IDC_MODIFYOWNER 1105
#define | IDC_MODIFYPERMISSION 1104
#define | IDC_MOVE 1029
#define | IDC_NAME 1003
#define | IDC_NOAUTHENTICATION 1070
#define | IDC_PAGESIZE 1037
#define | IDC_PAGESIZE_TXT 1036
#define | IDC_PARENT 1004
#define | IDC_PARENTPATH 1050
#define | IDC_PASSWORD 1065
#define | IDC_PROMPTCREDENTIAL 1069
#define | IDC_PURGE 1063
#define | IDC_PUT 1020
#define | IDC_PUTEX 1021
#define | IDC_RDN 1051
#define | IDC_READONLY 1068
#define | IDC_READPERMISSION 1103
#define | IDC_READPROP 1087
#define | IDC_READPROP_EDIT 1092
#define | IDC_RENAME 1027
#define | IDC_RESULTLIST 1045
#define | IDC_SCHEMA 1009
#define | IDC_SCHEMAPATH 1056
#define | IDC_SEALING 1082
#define | IDC_SEARCHSCOPE 1035
#define | IDC_SEARCHSCOPE_TXT 1048
#define | IDC_SECURED 1066
#define | IDC_SET 1025
#define | IDC_SETINFO 1013
#define | IDC_SIGNING 1081
#define | IDC_SIZELIMIT 1043
#define | IDC_SIZELIMIT_TXT 1051
#define | IDC_SORTON 1040
#define | IDC_SORTON_TXT 1049
#define | IDC_TIMELIMIT 1041
#define | IDC_TIMELIMIT_TXT 1050
#define | IDC_TIMEOUT 1034
#define | IDC_TIMEOUT_TXT 1047
#define | IDC_TOTAL 1072
#define | IDC_USERNAME 1064
#define | IDC_USERNAME_TXT 1079
#define | IDC_VALUELIST 1055
#define | IDC_VIEW 1022
#define | IDC_WRITEPROP 1088
#define | IDC_WRITEPROP_EDIT 1093
#define | IDD_ABOUTBOX 100
#define | IDD_ADQI_DIALOG 102
#define | IDD_DELETEOBJECT 137
#define | IDD_GETINFOEX 131
#define | IDD_IADS 130
#define | IDD_IADSCONTAINER 132
#define | IDD_IADSOPENDSOBJECT 141
#define | IDD_IDIRECTORYOBJECT 136
#define | IDD_IDIRECTORYSEARCH 134
#define | IDD_LARGEINTEGER 145
#define | IDD_MOVE 144
#define | IDD_PROPERTYLIST 138
#define | IDD_RENAME 133
#define | IDD_SECURITY 142
#define | IDM_ABOUTBOX 0x0010
#define | IDR_MAINFRAME 128
#define | IDS_ABOUTBOX 101

Define Documentation

#define IDC_ACELIST 1082

Definition at line 93 of file resource.h.

#define IDC_ACETYPE 1100

Definition at line 115 of file resource.h.

#define IDC_ADSPATH 1001

Definition at line 22 of file resource.h.

#define IDC_ADSTYPE 1061

Definition at line 74 of file resource.h.

#define IDC_ASYNCH 1075

Definition at line 86 of file resource.h.

#define IDC_ATTR 1019

Definition at line 37 of file resource.h.

#define IDC_ATTRIBONLY 1073

Definition at line 84 of file resource.h.

#define IDC_ATTRIBUTE 1058

Definition at line 73 of file resource.h.

#define IDC_ATTRLIST 1017

Definition at line 35 of file resource.h.

#define IDC_ATTRVALUE 1018

Definition at line 36 of file resource.h.

#define IDC_BINDGUID 1099

Definition at line 114 of file resource.h.

#define IDC_BROWSE 1030

Definition at line 49 of file resource.h.

#define IDC_BUTTON1 1099

Definition at line 113 of file resource.h.

#define IDC_CACHERESULTS 1057

Definition at line 72 of file resource.h.

#define IDC_CHANGE_CREATE_CHILD 1094

Definition at line 108 of file resource.h.

#define IDC_CHANGE_CREATE_CHILD2 1095

Definition at line 109 of file resource.h.

#define IDC_CHANGE_CREATE_CHILD3 1096

Definition at line 110 of file resource.h.

#define IDC_CHANGE_CREATE_CHILD4 1097

Definition at line 111 of file resource.h.

#define IDC_CHANGEUSER 1023

Definition at line 42 of file resource.h.

#define IDC_CHASEREFERRAL 1039

Definition at line 55 of file resource.h.

#define IDC_CHASEREFERRAL_TXT 1038

Definition at line 54 of file resource.h.

#define IDC_CHECK2 1084

Definition at line 97 of file resource.h.

#define IDC_CHILDRENLIST 1021

Definition at line 40 of file resource.h.

#define IDC_CLASS 1007

Definition at line 26 of file resource.h.

#define IDC_CLEARTEXT 1080

Definition at line 90 of file resource.h.

#define IDC_COPY 1016

Definition at line 34 of file resource.h.

#define IDC_CREATE 1028

Definition at line 47 of file resource.h.

#define IDC_CREATE_CHILD 1083

Definition at line 95 of file resource.h.

#define IDC_CREATECHILD 1083

Definition at line 96 of file resource.h.

#define IDC_CREATECHILD_EDIT 1090

Definition at line 104 of file resource.h.

#define IDC_CURRENTCREDENTIAL 1077

Definition at line 88 of file resource.h.

#define IDC_DELETE 1026

Definition at line 45 of file resource.h.

#define IDC_DELETECHILD 1084

Definition at line 98 of file resource.h.

#define IDC_DELETECHILD_EDIT 1091

Definition at line 105 of file resource.h.

#define IDC_DELETEOBJECT 1102

Definition at line 117 of file resource.h.

#define IDC_DELETETREE 1089

Definition at line 103 of file resource.h.

#define IDC_DEREF 1074

Definition at line 85 of file resource.h.

#define IDC_DEREF_TXT 1076

Definition at line 87 of file resource.h.

#define IDC_DN 1052

Definition at line 69 of file resource.h.

#define IDC_ENABLED 1044

Definition at line 60 of file resource.h.

#define IDC_ENCRYPT 1067

Definition at line 79 of file resource.h.

#define IDC_EXECUTE 1042

Definition at line 58 of file resource.h.

#define IDC_EXTENDEDRIGHT 1106

Definition at line 121 of file resource.h.

#define IDC_EXTENDEDRIGHT_EDIT 1098

Definition at line 112 of file resource.h.

#define IDC_FASTBIND 1080

Definition at line 91 of file resource.h.

#define IDC_FILTER 1024

Definition at line 43 of file resource.h.

#define IDC_GET 1014

Definition at line 32 of file resource.h.

#define IDC_GETEX 1015

Definition at line 33 of file resource.h.

#define IDC_GETINFO 1011

Definition at line 29 of file resource.h.

#define IDC_GETINFOEX 1012

Definition at line 30 of file resource.h.

#define IDC_GUID 1010

Definition at line 28 of file resource.h.

#define IDC_HIPART 1110

Definition at line 122 of file resource.h.

#define IDC_INHERITANCE 1101

Definition at line 116 of file resource.h.

#define IDC_INTERFACES 1002

Definition at line 23 of file resource.h.

#define IDC_LISTCONTENT 1085

Definition at line 99 of file resource.h.

#define IDC_LISTOBJECT 1086

Definition at line 100 of file resource.h.

#define IDC_LISTVIEW 1111

Definition at line 124 of file resource.h.

#define IDC_LOWPART 1111

Definition at line 123 of file resource.h.

#define IDC_MODIFYOWNER 1105

Definition at line 120 of file resource.h.

#define IDC_MODIFYPERMISSION 1104

Definition at line 119 of file resource.h.

#define IDC_MOVE 1029

Definition at line 48 of file resource.h.

#define IDC_NAME 1003

Definition at line 24 of file resource.h.

#define IDC_NOAUTHENTICATION 1070

Definition at line 82 of file resource.h.

#define IDC_PAGESIZE 1037

Definition at line 53 of file resource.h.

#define IDC_PAGESIZE_TXT 1036

Definition at line 52 of file resource.h.

#define IDC_PARENT 1004

Definition at line 25 of file resource.h.

#define IDC_PARENTPATH 1050

Definition at line 65 of file resource.h.

#define IDC_PASSWORD 1065

Definition at line 77 of file resource.h.

#define IDC_PROMPTCREDENTIAL 1069

Definition at line 81 of file resource.h.

#define IDC_PURGE 1063

Definition at line 75 of file resource.h.

#define IDC_PUT 1020

Definition at line 38 of file resource.h.

#define IDC_PUTEX 1021

Definition at line 39 of file resource.h.

#define IDC_RDN 1051

Definition at line 67 of file resource.h.

#define IDC_READONLY 1068

Definition at line 80 of file resource.h.

#define IDC_READPERMISSION 1103

Definition at line 118 of file resource.h.

#define IDC_READPROP 1087

Definition at line 101 of file resource.h.

#define IDC_READPROP_EDIT 1092

Definition at line 106 of file resource.h.

#define IDC_RENAME 1027

Definition at line 46 of file resource.h.

#define IDC_RESULTLIST 1045

Definition at line 61 of file resource.h.

#define IDC_SCHEMA 1009

Definition at line 27 of file resource.h.

#define IDC_SCHEMAPATH 1056

Definition at line 71 of file resource.h.

#define IDC_SEALING 1082

Definition at line 94 of file resource.h.

#define IDC_SEARCHSCOPE 1035

Definition at line 51 of file resource.h.

#define IDC_SEARCHSCOPE_TXT 1048

Definition at line 63 of file resource.h.

#define IDC_SECURED 1066

Definition at line 78 of file resource.h.

#define IDC_SET 1025

Definition at line 44 of file resource.h.

#define IDC_SETINFO 1013

Definition at line 31 of file resource.h.

#define IDC_SIGNING 1081

Definition at line 92 of file resource.h.

#define IDC_SIZELIMIT 1043

Definition at line 59 of file resource.h.

#define IDC_SIZELIMIT_TXT 1051

Definition at line 68 of file resource.h.

#define IDC_SORTON 1040

Definition at line 56 of file resource.h.

#define IDC_SORTON_TXT 1049

Definition at line 64 of file resource.h.

#define IDC_TIMELIMIT 1041

Definition at line 57 of file resource.h.

#define IDC_TIMELIMIT_TXT 1050

Definition at line 66 of file resource.h.

#define IDC_TIMEOUT 1034

Definition at line 50 of file resource.h.

#define IDC_TIMEOUT_TXT 1047

Definition at line 62 of file resource.h.

#define IDC_TOTAL 1072

Definition at line 83 of file resource.h.

#define IDC_USERNAME 1064

Definition at line 76 of file resource.h.

#define IDC_USERNAME_TXT 1079

Definition at line 89 of file resource.h.

#define IDC_VALUELIST 1055

Definition at line 70 of file resource.h.

#define IDC_VIEW 1022

Definition at line 41 of file resource.h.

#define IDC_WRITEPROP 1088

Definition at line 102 of file resource.h.

#define IDC_WRITEPROP_EDIT 1093

Definition at line 107 of file resource.h.

#define IDD_ABOUTBOX 100

Definition at line 6 of file resource.h.

#define IDD_ADQI_DIALOG 102

Definition at line 8 of file resource.h.

#define IDD_DELETEOBJECT 137

Definition at line 16 of file resource.h.

#define IDD_GETINFOEX 131

Definition at line 11 of file resource.h.

#define IDD_IADS 130

Definition at line 10 of file resource.h.

#define IDD_IADSCONTAINER 132

Definition at line 12 of file resource.h.

#define IDD_IADSOPENDSOBJECT 141

Definition at line 18 of file resource.h.

#define IDD_IDIRECTORYOBJECT 136

Definition at line 15 of file resource.h.

#define IDD_IDIRECTORYSEARCH 134

Definition at line 14 of file resource.h.

#define IDD_LARGEINTEGER 145

Definition at line 21 of file resource.h.

#define IDD_MOVE 144

Definition at line 20 of file resource.h.

#define IDD_PROPERTYLIST 138

Definition at line 17 of file resource.h.

#define IDD_RENAME 133

Definition at line 13 of file resource.h.

#define IDD_SECURITY 142

Definition at line 19 of file resource.h.

#define IDM_ABOUTBOX 0x0010

Definition at line 5 of file resource.h.

#define IDR_MAINFRAME 128

Definition at line 9 of file resource.h.

#define IDS_ABOUTBOX 101

Definition at line 7 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/ADQI/security.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • ADQI

security.cpp File Reference

#include "stdafx.h"
#include "ADQI.h"
#include "directorysearch.h"
#include "security.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/ADQI/security.h File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • ADQI
Classes

security.h File Reference

Go to the source code of this file.

Classes

class CDlgIADsSecurityDescriptor
Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/ADQI/StdAfx.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • ADQI

StdAfx.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/ADQI/StdAfx.h File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • ADQI
Classes | Defines | Typedefs

StdAfx.h File Reference

#include <afxwin.h>
#include <afxext.h>
#include <afxcmn.h>
#include <afxole.h>
#include <atlbase.h>
#include <atlconv.h>
#include <activeds.h>
#include "helper.h"
#include "helper.h"

Go to the source code of this file.

Classes

struct | tagADSERRMSG
struct | tagADSIIF

Defines

#define | ADDADSERROR(x) x, _T(#x)
#define | ARROW_SYMBOL _T("--> ")
#define | DECLAREADSPROC(x)
#define | MAKEADSENTRY(x) &IID_##x, _T(#x)
#define | VC_EXTRALEAN

Typedefs

typedef void(* | ADSDLGPROC )(LPUNKNOWN, LPUNKNOWN *)
typedef struct tagADSERRMSG | ADSERRMSG
typedef struct tagADSIIF | ADSIIF

Define Documentation

#define ADDADSERROR ( x ) x, _T(#x)

Definition at line 42 of file StdAfx.h.

#define ARROW_SYMBOL _T("--> ")

Definition at line 46 of file StdAfx.h.

#define DECLAREADSPROC ( x )
Value:
void DlgProc##x(LPUNKNOWN, LPUNKNOWN *ppNew=NULL); \
void DlgProc##x(LPUNKNOWN pUnk, LPUNKNOWN *ppNew) { CDlg##x dlg( pUnk); dlg.DoModal(); }

Definition at line 43 of file StdAfx.h.

#define MAKEADSENTRY ( x ) &IID_##x, _T(#x)

Definition at line 41 of file StdAfx.h.

#define VC_EXTRALEAN

Definition at line 13 of file StdAfx.h.

Typedef Documentation

typedef void(* ADSDLGPROC)(LPUNKNOWN, LPUNKNOWN *)

Definition at line 26 of file StdAfx.h.

typedef struct tagADSERRMSG ADSERRMSG
typedef struct tagADSIIF ADSIIF
Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/ADsCmd/dump.cxx File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • ADsCmd
Functions

dump.cxx File Reference

#include "main.hxx"

Go to the source code of this file.

Functions

int | DoDump (char *AnsiADsPath)
HRESULT | DumpObject (IADs *pADs)
HRESULT | GetPropertyList (IADs *pADs, VARIANT *pvar)

Function Documentation

int DoDump ( char * AnsiADsPath )

Definition at line 21 of file dump.cxx.

{
 HRESULT hr = E_OUTOFMEMORY ;
 LPWSTR pszADsPath = NULL;
 IADs * pADs = NULL;

 //
 // Convert path to unicode and then bind to the object.
 //

 BAIL_ON_NULL(pszADsPath = AllocateUnicodeString(AnsiADsPath));

 hr = ADsGetObject(
             pszADsPath,
             IID_IADs,
             (void **)&pADs
             );

 if (FAILED(hr)) {

     wprintf(L"Failed to bind to object: %s\n", pszADsPath) ;
     BAIL_ON_FAILURE(hr, L"Failed to do ADsGetObject");
 }
 else {

     //
     // Dump the object
     //

     hr = DumpObject(pADs);

     if (FAILED(hr)) {

         wprintf(L"Unable to read properties of: %s\n", pszADsPath) ;
     }

     pADs->Release();
 }

error:

 FreeUnicodeString(pszADsPath);

 return (FAILED(hr) ? 1 : 0) ;
}

HRESULT DumpObject ( IADs * pADs )

Definition at line 72 of file dump.cxx.

{
 HRESULT hr;
HRESULT hrSA;
 VARIANT var;
ZeroMemory(&var,sizeof(var));
VARIANT *   pvarPropName = NULL;
 DWORD i = 0;
VARIANT varProperty;

 //
 // Access the schema for the object
 //

 hr = GetPropertyList(
             pADs,
             &var);
 BAIL_ON_FAILURE(hr, L"Failed to get property list");

 //
 // List the Properties
//
hr = SafeArrayAccessData(var.parray, (void **) &pvarPropName);
BAIL_ON_FAILURE(hr, L"Failed while calling SafeArrayAccessData");

for (i = 0; i < var.parray->rgsabound[0].cElements; i++){

   //
     // Get a property and print it out. The HRESULT is passed to
     // PrintProperty.
     //

     hr = pADs->Get(
             pvarPropName[i].bstrVal,
             &varProperty
             );
     if (FAILED(hr)) {
         wprintf(L"Error: 0x%x \t Failed to get the property: %s \n", hr, pvarPropName[i].bstrVal);
         continue;
     }

     PrintProperty(
         pvarPropName[i].bstrVal,
         hr,
         varProperty
         );

   VariantClear(&varProperty);

}

hr = SafeArrayUnaccessData(var.parray);
BAIL_ON_FAILURE(hr, L"Failed when calling SafeArrayUnaccessData");

error:
// Don't destroy hr in case we're here from BAIL_ON_FAILURE
if(var.parray) hrSA = SafeArrayDestroy(var.parray);

return(hr);
}

HRESULT GetPropertyList | ( | IADs * | pADs,
 |  | VARIANT * | pvar
 | ) |  |

Definition at line 137 of file dump.cxx.

{
 HRESULT hr= S_OK;
 BSTR bstrSchemaPath = NULL;
IADsClass * pADsClass = NULL;

 hr = pADs->get_Schema(&bstrSchemaPath);
 BAIL_ON_FAILURE(hr, L"Failed to get the schema path of the class");

 hr = ADsGetObject(
             bstrSchemaPath,
             IID_IADsClass,
             (void **)&pADsClass);
 BAIL_ON_FAILURE(hr, L"Failed to bind to schema path of the class");

//Put SafeArray of bstr's into input variant struct
hr = pADsClass->get_MandatoryProperties(pvar);
BAIL_ON_FAILURE(hr, L"Failed to get the mandatory properties of the class");

error:
 if (bstrSchemaPath) {
     SysFreeString(bstrSchemaPath);
 }

 if (pADsClass) {
     pADsClass->Release();
 }

 return(hr);
}

Generated on Wed Nov 13 2024 16:53:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/ADsCmd/enum.cxx File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • ADsCmd
Defines | Functions

enum.cxx File Reference

#include "main.hxx"

Go to the source code of this file.

Defines

#define | MAX_ADS_ENUM 100
#define | MAX_ADS_FILTERS 10

Functions

int | DoList (char *AnsiADsPath)
HRESULT | EnumObject (LPWSTR pszADsPath, LPWSTR *lppClassNames, DWORD dwClassNames)
HRESULT | PrintLongFormat (IADs *pObject)

Define Documentation

#define MAX_ADS_ENUM 100

Definition at line 22 of file enum.cxx.

#define MAX_ADS_FILTERS 10

Definition at line 21 of file enum.cxx.

Function Documentation

int DoList ( char * AnsiADsPath )

Definition at line 40 of file enum.cxx.

{
    HRESULT hr;
    int i = 0 ;
    LPWSTR pszADsPath, apszTypes[MAX_ADS_FILTERS] ;

    if (!(pszADsPath = AllocateUnicodeString(AnsiADsPath))) {

        return(1) ;
    }

    apszTypes[0] = NULL ;

    //
    //  Filter may be set as follows. For example, to get users and group:
    //
    //  apszTypes[0] = L"User" ;
    //  apszTypes[1] = L"Group" ;
    //  apszTypes[2] = NULL ;
    //

    hr = EnumObject(
             pszADsPath,
             apszTypes,
             i
             );

    FreeUnicodeString(pszADsPath);

    return (FAILED(hr) ? 1 : 0) ;
}

HRESULT EnumObject | ( | LPWSTR | pszADsPath,
 |  | LPWSTR * | lppClassNames,
 |  | DWORD | dwClassNames
 | ) |  |

Definition at line 77 of file enum.cxx.

{
    ULONG cElementFetched = 0L;
    IEnumVARIANT * pEnumVariant = NULL;
    VARIANT VarFilter, VariantArray[MAX_ADS_ENUM];

    HRESULT hr;
    IADsContainer * pADsContainer =  NULL;
    DWORD dwObjects = 0, dwEnumCount = 0, i = 0;
    BOOL  fContinue = TRUE;

    VariantInit(&VarFilter);

    hr = ADsGetObject(
                pszADsPath,
                IID_IADsContainer,
                (void **)&pADsContainer
                );

    BAIL_ON_FAILURE(hr, L"Failed to bind to container object");

    hr = ADsBuildVarArrayStr(
                lppClassNames,
                dwClassNames,
                &VarFilter
                );
    BAIL_ON_FAILURE(hr, L"Failed while executing ADsBuildVarArrayStr");

    hr = pADsContainer->put_Filter(VarFilter);
    BAIL_ON_FAILURE(hr, L"Failed to put_Filter on container object");

    hr = ADsBuildEnumerator(
            pADsContainer,
            &pEnumVariant
            );
    BAIL_ON_FAILURE(hr, L"Failed while executing ADsBuildEnumerator");

    while (fContinue) {

        IADs *pObject ;

        hr = ADsEnumerateNext(
                    pEnumVariant,
                    MAX_ADS_ENUM,
                    VariantArray,
                    &cElementFetched
                    );

        if (hr == S_FALSE) {
            fContinue = FALSE;
        }

        dwEnumCount++;

        for (i = 0; i < cElementFetched; i++ ) {

            IDispatch *pDispatch = NULL;

            pDispatch = VariantArray[i].pdispVal;

            hr = pDispatch->QueryInterface(IID_IADs,
                                           (VOID **) &pObject) ;
            BAIL_ON_FAILURE(hr, L"Failed to QI the enumerate varDisp to IADs interface");

            PrintLongFormat(pObject);

            pObject->Release();
            pDispatch->Release();
        }

        memset(VariantArray, 0, sizeof(VARIANT)*MAX_ADS_ENUM);

        dwObjects += cElementFetched;

    }

    printf("Total Number of Objects enumerated is %d\n", dwObjects);

    ADsFreeEnumerator( pEnumVariant ); // You don't need to Release if you call ADsFreeEnumerator

    if (pADsContainer) {
        pADsContainer->Release();
    }

    VariantClear(&VarFilter);

    return(S_OK);

error:
    if (FAILED(hr)) {

        wprintf(L"Unable to list contents of: %s\n", pszADsPath) ;
    }

//exitpoint:

    if (pEnumVariant) {
        pEnumVariant->Release();
    }

    VariantClear(&VarFilter);

    if (pADsContainer) {
        pADsContainer->Release();
    }

    return(hr);
}

HRESULT PrintLongFormat ( IADs * pObject )

Definition at line 197 of file enum.cxx.

{

    HRESULT hr = S_OK;
    BSTR bstrName = NULL;
    BSTR bstrClass = NULL;
    BSTR bstrSchema = NULL;

    hr = pObject->get_Name(&bstrName) ;
    BAIL_ON_FAILURE(hr, L"Failed to get the name of the object");

    hr = pObject->get_Class(&bstrClass);
    BAIL_ON_FAILURE(hr, L"Failed to get the class of the object");

    // hr = pObject->get_Schema(&bstrSchema);

    wprintf(L"  %s(%s)\n", bstrName, bstrClass) ;

error:
    if (bstrClass) {
        SysFreeString(bstrClass);
    }
    if (bstrName) {
        SysFreeString(bstrName);
    }
    if (bstrSchema) {
        SysFreeString(bstrSchema);
    }
    return(hr);
}

Generated on Wed Nov 13 2024 16:53:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/ADsCmd/main.cxx File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • ADsCmd
Functions

main.cxx File Reference

#include "main.hxx"

Go to the source code of this file.

Functions

int __cdecl main (int argc, char *argv[])

Function Documentation

int __cdecl main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 25 of file main.cxx.

{
    HRESULT hr;
    int exitcode;

    if (argc != 3) {
        PrintUsage() ;
        exit(1);
    }

    hr = CoInitialize(NULL);

    if (FAILED(hr)) {
        printf("CoInitialize failed\n");
        exit(1);
    }

    if (_stricmp(argv[1],"list") == 0) {

        //
        // Call the List helper function
        //

        exitcode = DoList(argv[2]) ;
    }
    else if (_stricmp(argv[1],"dump") == 0) {

        //
        // Call the Dump helper function
        //

        exitcode = DoDump(argv[2]) ;
    }
    else {

        //
        // Unknown command
        //

        PrintUsage() ;
        exitcode = 1 ;
    }
    CoUninitialize();
    exit(exitcode) ;
    return 0;
}

Generated on Wed Nov 13 2024 16:53:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/ADsCmd/main.hxx File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • ADsCmd
Defines | Functions

main.hxx File Reference

#include <windows.h>
#include <stdlib.h>
#include <limits.h>
#include <io.h>
#include <stdio.h>
#include <activeds.h>

Go to the source code of this file.

Defines

#define | _UNICODE
#define | BAIL_ON_FAILURE(hr, msg)
#define | BAIL_ON_NULL(p)
#define | FREE_BSTR(bstr)
#define | FREE_INTERFACE(pInterface)
#define | INC_OLE2
#define | UNICODE

Functions

LPWSTR | AllocateUnicodeString (LPSTR pAnsiString)
int | AnsiToUnicodeString (LPSTR pAnsi, LPWSTR pUnicode, DWORD StringLength)
int | DoDump (char *AnsiADsPath)
int | DoList (char *AnsiADsPath)
HRESULT | DumpObject (IADs *pADs)
HRESULT | EnumObject (LPWSTR pszADsPath, LPWSTR *lppClassNames, DWORD dwClassNames)
void | FreeUnicodeString (LPWSTR pUnicodeString)
HRESULT | GetPropertyList (IADs *pADs, VARIANT *pvar)
HRESULT | PrintProperty (BSTR bstrPropName, HRESULT hRetVal, VARIANT varPropData)
void | PrintUsage (void)
HRESULT | PrintVariant (VARIANT varPropData)
HRESULT | PrintVariantArray (VARIANT var)
int | UnicodeToAnsiString (LPWSTR pUnicode, LPSTR pAnsi, DWORD StringLength)

Define Documentation

#define _UNICODE

Definition at line 19 of file main.hxx.

#define BAIL_ON_FAILURE | ( | hr,
 |  | msg
 | ) |
Value:
if (FAILED(hr)) {     \
         wprintf(L"Error: 0x%x\t Msg: %s \n", hr, msg); \
         goto error;   \
     }

Definition at line 48 of file main.hxx.

#define BAIL_ON_NULL ( p )
Value:
if (!(p)) {           \
         goto error;   \
     }

Definition at line 43 of file main.hxx.

#define FREE_BSTR ( bstr )
Value:
if (bstr) {                \
         SysFreeString(bstr);   \
         bstr = NULL;           \
     }

Definition at line 60 of file main.hxx.

#define FREE_INTERFACE ( pInterface )
Value:
if (pInterface) {          \
         pInterface->Release(); \
         pInterface=NULL;       \
     }

Definition at line 54 of file main.hxx.

#define INC_OLE2

Definition at line 20 of file main.hxx.

#define UNICODE

Definition at line 18 of file main.hxx.

Function Documentation

LPWSTR AllocateUnicodeString ( LPSTR pAnsiString )

Definition at line 118 of file util.cxx.

{
    LPWSTR  pUnicodeString = NULL;

    if (!pAnsiString)
        return NULL;

    pUnicodeString = (LPWSTR)LocalAlloc(
                        LPTR,
                        strlen(pAnsiString)*sizeof(WCHAR) + sizeof(WCHAR)
                        );

    if (pUnicodeString) {

        AnsiToUnicodeString(
            pAnsiString,
            pUnicodeString,
            0
            );
    }

    return pUnicodeString;
}

int AnsiToUnicodeString | ( | LPSTR | pAnsi,
 |  | LPWSTR | pUnicode,
 |  | DWORD | StringLength
 | ) |  |

Definition at line 21 of file util.cxx.

{
    int iReturn;

    if( StringLength == 0 )
        StringLength = strlen( pAnsi );

    iReturn = MultiByteToWideChar(CP_ACP,
                                  MB_PRECOMPOSED,
                                  pAnsi,
                                  StringLength + 1,
                                  pUnicode,
                                  StringLength + 1 );

    //
    // Ensure NULL termination.
    //
    pUnicode[StringLength] = 0;

    return iReturn;
}

int DoDump ( char * AnsiADsPath )

Definition at line 21 of file dump.cxx.

{
 HRESULT hr = E_OUTOFMEMORY ;
 LPWSTR pszADsPath = NULL;
 IADs * pADs = NULL;

 //
 // Convert path to unicode and then bind to the object.
 //

 BAIL_ON_NULL(pszADsPath = AllocateUnicodeString(AnsiADsPath));

 hr = ADsGetObject(
             pszADsPath,
             IID_IADs,
             (void **)&pADs
             );

 if (FAILED(hr)) {

     wprintf(L"Failed to bind to object: %s\n", pszADsPath) ;
     BAIL_ON_FAILURE(hr, L"Failed to do ADsGetObject");
 }
 else {

     //
     // Dump the object
     //

     hr = DumpObject(pADs);

     if (FAILED(hr)) {

         wprintf(L"Unable to read properties of: %s\n", pszADsPath) ;
     }

     pADs->Release();
 }

error:

 FreeUnicodeString(pszADsPath);

 return (FAILED(hr) ? 1 : 0) ;
}

int DoList ( char * AnsiADsPath )

Definition at line 40 of file enum.cxx.

{
    HRESULT hr;
    int i = 0 ;
    LPWSTR pszADsPath, apszTypes[MAX_ADS_FILTERS] ;

    if (!(pszADsPath = AllocateUnicodeString(AnsiADsPath))) {

        return(1) ;
    }

    apszTypes[0] = NULL ;

    //
    //  Filter may be set as follows. For example, to get users and group:
    //
    //  apszTypes[0] = L"User" ;
    //  apszTypes[1] = L"Group" ;
    //  apszTypes[2] = NULL ;
    //

    hr = EnumObject(
             pszADsPath,
             apszTypes,
             i
             );

    FreeUnicodeString(pszADsPath);

    return (FAILED(hr) ? 1 : 0) ;
}

HRESULT DumpObject ( IADs * pADs )

Definition at line 72 of file dump.cxx.

{
 HRESULT hr;
HRESULT hrSA;
 VARIANT var;
ZeroMemory(&var,sizeof(var));
VARIANT *   pvarPropName = NULL;
 DWORD i = 0;
VARIANT varProperty;

 //
 // Access the schema for the object
 //

 hr = GetPropertyList(
             pADs,
             &var);
 BAIL_ON_FAILURE(hr, L"Failed to get property list");

 //
 // List the Properties
//
hr = SafeArrayAccessData(var.parray, (void **) &pvarPropName);
BAIL_ON_FAILURE(hr, L"Failed while calling SafeArrayAccessData");

for (i = 0; i < var.parray->rgsabound[0].cElements; i++){

   //
     // Get a property and print it out. The HRESULT is passed to
     // PrintProperty.
     //

     hr = pADs->Get(
             pvarPropName[i].bstrVal,
             &varProperty
             );
     if (FAILED(hr)) {
         wprintf(L"Error: 0x%x \t Failed to get the property: %s \n", hr, pvarPropName[i].bstrVal);
         continue;
     }

     PrintProperty(
         pvarPropName[i].bstrVal,
         hr,
         varProperty
         );

   VariantClear(&varProperty);

}

hr = SafeArrayUnaccessData(var.parray);
BAIL_ON_FAILURE(hr, L"Failed when calling SafeArrayUnaccessData");

error:
// Don't destroy hr in case we're here from BAIL_ON_FAILURE
if(var.parray) hrSA = SafeArrayDestroy(var.parray);

return(hr);
}

HRESULT EnumObject | ( | LPWSTR | pszADsPath,
 |  | LPWSTR * | lppClassNames,
 |  | DWORD | dwClassNames
 | ) |  |

Definition at line 77 of file enum.cxx.

{
    ULONG cElementFetched = 0L;
    IEnumVARIANT * pEnumVariant = NULL;
    VARIANT VarFilter, VariantArray[MAX_ADS_ENUM];

    HRESULT hr;
    IADsContainer * pADsContainer =  NULL;
    DWORD dwObjects = 0, dwEnumCount = 0, i = 0;
    BOOL  fContinue = TRUE;

    VariantInit(&VarFilter);

    hr = ADsGetObject(
                pszADsPath,
                IID_IADsContainer,
                (void **)&pADsContainer
                );

    BAIL_ON_FAILURE(hr, L"Failed to bind to container object");

    hr = ADsBuildVarArrayStr(
                lppClassNames,
                dwClassNames,
                &VarFilter
                );
    BAIL_ON_FAILURE(hr, L"Failed while executing ADsBuildVarArrayStr");

    hr = pADsContainer->put_Filter(VarFilter);
    BAIL_ON_FAILURE(hr, L"Failed to put_Filter on container object");

    hr = ADsBuildEnumerator(
            pADsContainer,
            &pEnumVariant
            );
    BAIL_ON_FAILURE(hr, L"Failed while executing ADsBuildEnumerator");

    while (fContinue) {

        IADs *pObject ;

        hr = ADsEnumerateNext(
                    pEnumVariant,
                    MAX_ADS_ENUM,
                    VariantArray,
                    &cElementFetched
                    );

        if (hr == S_FALSE) {
            fContinue = FALSE;
        }

        dwEnumCount++;

        for (i = 0; i < cElementFetched; i++ ) {

            IDispatch *pDispatch = NULL;

            pDispatch = VariantArray[i].pdispVal;

            hr = pDispatch->QueryInterface(IID_IADs,
                                           (VOID **) &pObject) ;
            BAIL_ON_FAILURE(hr, L"Failed to QI the enumerate varDisp to IADs interface");

            PrintLongFormat(pObject);

            pObject->Release();
            pDispatch->Release();
        }

        memset(VariantArray, 0, sizeof(VARIANT)*MAX_ADS_ENUM);

        dwObjects += cElementFetched;

    }

    printf("Total Number of Objects enumerated is %d\n", dwObjects);

    ADsFreeEnumerator( pEnumVariant ); // You don't need to Release if you call ADsFreeEnumerator

    if (pADsContainer) {
        pADsContainer->Release();
    }

    VariantClear(&VarFilter);

    return(S_OK);

error:
    if (FAILED(hr)) {

        wprintf(L"Unable to list contents of: %s\n", pszADsPath) ;
    }

//exitpoint:

    if (pEnumVariant) {
        pEnumVariant->Release();
    }

    VariantClear(&VarFilter);

    if (pADsContainer) {
        pADsContainer->Release();
    }

    return(hr);
}

void FreeUnicodeString ( LPWSTR pUnicodeString )

Definition at line 146 of file util.cxx.

{

    LocalFree(pUnicodeString);

    return;
}

HRESULT GetPropertyList | ( | IADs * | pADs,
 |  | VARIANT * | pvar
 | ) |  |

Definition at line 137 of file dump.cxx.

{
 HRESULT hr= S_OK;
 BSTR bstrSchemaPath = NULL;
IADsClass * pADsClass = NULL;

 hr = pADs->get_Schema(&bstrSchemaPath);
 BAIL_ON_FAILURE(hr, L"Failed to get the schema path of the class");

 hr = ADsGetObject(
             bstrSchemaPath,
             IID_IADsClass,
             (void **)&pADsClass);
 BAIL_ON_FAILURE(hr, L"Failed to bind to schema path of the class");

//Put SafeArray of bstr's into input variant struct
hr = pADsClass->get_MandatoryProperties(pvar);
BAIL_ON_FAILURE(hr, L"Failed to get the mandatory properties of the class");

error:
 if (bstrSchemaPath) {
     SysFreeString(bstrSchemaPath);
 }

 if (pADsClass) {
     pADsClass->Release();
 }

 return(hr);
}

HRESULT PrintProperty | ( | BSTR | bstrPropName,
 |  | HRESULT | hRetVal,
 |  | VARIANT | varPropData
 | ) |  |

Definition at line 284 of file util.cxx.

{
    HRESULT hr = S_OK;

    switch (hRetVal) {

    case 0:
        wprintf(L"%-32s: ", bstrPropName);
        PrintVariant(varPropData);
        break;

    case E_ADS_CANT_CONVERT_DATATYPE:
        wprintf(L"%-32s: ", bstrPropName);
        printf("<Data could not be converted for display>\n");
        break;

    default:
        wprintf(L"%-32s: ", bstrPropName);
        printf("<Data not available>\n");
        break;

    }
    return(hr);
}

void PrintUsage ( void )

Definition at line 1549 of file Sample1.Cpp.

{
   wprintf(L"sample1.exe\n");
   wprintf(L"Usage:\n");
   wprintf(L"   sample1 <action> [action specific parameters]\n");
   wprintf(L"      where <action> is one of the followings:\n");
   wprintf(L"                download\n");
   wprintf(L"                upload\n");
   wprintf(L"                enum\n");
   wprintf(L"                search\n");
   wprintf(L"                mkdir\n");
   wprintf(L"                copy\n");
   wprintf(L"                move\n");
   wprintf(L"                delete\n");
   wprintf(L"      action specific parameters:\n");
   wprintf(L"         download: u=url [l=local_dest] [n=username p=password]\n");
   wprintf(L"         upload:   u=url l=local_src [n=username p=password]\n");
   wprintf(L"         enum:     u=url [v=yes/no] [n=username p=password]\n");
   wprintf(L"         search:   u=url [q=\"SQL query\"] [v=yes/no] [n=username p=password]\n");
   wprintf(L"                   note that '\"' in the query should be typed as '\\\"'\n");
   wprintf(L"         mkdir:    u=url [n=username p=password]\n");
   wprintf(L"         copy:     us=src ud=dest [ns=username ps=password]\n");
   wprintf(L"                                  [nd=username pd=password]\n");
   wprintf(L"         move:     us=src ud=dest [ns=username ps=password]\n");
   wprintf(L"                                  [nd=username pd=password]\n");
   wprintf(L"         delete:   u=url [n=username p=password]\n");
}

HRESULT PrintVariant ( VARIANT varPropData )

Definition at line 163 of file util.cxx.

{
    HRESULT hr;
    BSTR bstrValue = NULL;

    switch (varPropData.vt) {
    case VT_I4:
        printf("%d", varPropData.lVal);
        break;
    case VT_BSTR:
        wprintf(L"%s", varPropData.bstrVal);
        break;

    case VT_BOOL:
        printf("%d", V_BOOL(&varPropData));
        break;

    case (VT_ARRAY | VT_VARIANT):
        PrintVariantArray(varPropData);
        break;

    case VT_DATE:
        hr = VarBstrFromDate(
                 varPropData.date,
                 LOCALE_SYSTEM_DEFAULT,
                 LOCALE_NOUSEROVERRIDE,
                 &bstrValue
                 );
        if ((S_OK == hr) && (NULL != bstrValue)) {
            wprintf(L"%s", bstrValue);
            SysFreeString(bstrValue);
        }
        else
            wprintf(L"Error: 0x%x \t Failed while executing VarBstrFromDate\n");
        break;

    default:
        printf("Data type is %d\n", varPropData.vt);
        break;

    }
    printf("\n");
    return(S_OK);
}

HRESULT PrintVariantArray ( VARIANT var )

Definition at line 212 of file util.cxx.

{
    LONG dwSLBound = 0;
    LONG dwSUBound = 0;
    VARIANT v;
    LONG i;
    HRESULT hr = S_OK;

    if(!((V_VT(&var) &  VT_VARIANT) &&  V_ISARRAY(&var))) {
        return(E_FAIL);
    }

    //
    // Check that there is only one dimension in this array
    //

    if ((V_ARRAY(&var))->cDims != 1) {
        hr = E_FAIL;
        BAIL_ON_FAILURE(hr, L"Variant Array dimension is not equal to 1");
    }
    //
    // Check that there is atleast one element in this array
    //

    if ((V_ARRAY(&var))->rgsabound[0].cElements == 0){
        hr = E_FAIL;
        BAIL_ON_FAILURE(hr, L"Variant Array has zero elements");
    }

    //
    // We know that this is a valid single dimension array
    //

    hr = SafeArrayGetLBound(V_ARRAY(&var),
                            1,
                            (long FAR *)&dwSLBound
                            );
    BAIL_ON_FAILURE(hr, L"Failed while executing SafeArrayGetLBound");

    hr = SafeArrayGetUBound(V_ARRAY(&var),
                            1,
                            (long FAR *)&dwSUBound
                            );
    BAIL_ON_FAILURE(hr, L"Failed while executing SafeArrayGetUBound");

    VariantInit(&v);
    for (i = dwSLBound; i <= dwSUBound; i++) {
        hr = SafeArrayGetElement(V_ARRAY(&var),
                                (long FAR *)&i,
                                &v
                                );
        if (FAILED(hr)) {
            wprintf(L"Error: 0x%x \t Failed while executing SafeArrayGetElement", hr);
            continue;
        }
        if (i < dwSUBound) {
            wprintf(L"%s, ", v.bstrVal);
        } else {
            wprintf(L"%s", v.bstrVal);
        }
        VariantClear(&v);
    }
    return(S_OK);

error:
    return(hr);
}

int UnicodeToAnsiString | ( | LPWSTR | pUnicode,
 |  | LPSTR | pAnsi,
 |  | DWORD | StringLength
 | ) |  |
Generated on Wed Nov 13 2024 16:53:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/ADsCmd/util.cxx File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • ADsCmd
Functions

util.cxx File Reference

#include "main.hxx"

Go to the source code of this file.

Functions

LPWSTR | AllocateUnicodeString (LPSTR pAnsiString)
int | AnsiToUnicodeString (LPSTR pAnsi, LPWSTR pUnicode, DWORD StringLength)
void | FreeUnicodeString (LPWSTR pUnicodeString)
HRESULT | PrintProperty (BSTR bstrPropName, HRESULT hRetVal, VARIANT varPropData)
void | PrintUsage (void)
HRESULT | PrintVariant (VARIANT varPropData)
HRESULT | PrintVariantArray (VARIANT var)

Function Documentation

LPWSTR AllocateUnicodeString ( LPSTR pAnsiString )

Definition at line 118 of file util.cxx.

{
    LPWSTR  pUnicodeString = NULL;

    if (!pAnsiString)
        return NULL;

    pUnicodeString = (LPWSTR)LocalAlloc(
                        LPTR,
                        strlen(pAnsiString)*sizeof(WCHAR) + sizeof(WCHAR)
                        );

    if (pUnicodeString) {

        AnsiToUnicodeString(
            pAnsiString,
            pUnicodeString,
            0
            );
    }

    return pUnicodeString;
}

int AnsiToUnicodeString | ( | LPSTR | pAnsi,
 |  | LPWSTR | pUnicode,
 |  | DWORD | StringLength
 | ) |  |

Definition at line 21 of file util.cxx.

{
    int iReturn;

    if( StringLength == 0 )
        StringLength = strlen( pAnsi );

    iReturn = MultiByteToWideChar(CP_ACP,
                                  MB_PRECOMPOSED,
                                  pAnsi,
                                  StringLength + 1,
                                  pUnicode,
                                  StringLength + 1 );

    //
    // Ensure NULL termination.
    //
    pUnicode[StringLength] = 0;

    return iReturn;
}

void FreeUnicodeString ( LPWSTR pUnicodeString )

Definition at line 146 of file util.cxx.

{

    LocalFree(pUnicodeString);

    return;
}

HRESULT PrintProperty | ( | BSTR | bstrPropName,
 |  | HRESULT | hRetVal,
 |  | VARIANT | varPropData
 | ) |  |

Definition at line 284 of file util.cxx.

{
    HRESULT hr = S_OK;

    switch (hRetVal) {

    case 0:
        wprintf(L"%-32s: ", bstrPropName);
        PrintVariant(varPropData);
        break;

    case E_ADS_CANT_CONVERT_DATATYPE:
        wprintf(L"%-32s: ", bstrPropName);
        printf("<Data could not be converted for display>\n");
        break;

    default:
        wprintf(L"%-32s: ", bstrPropName);
        printf("<Data not available>\n");
        break;

    }
    return(hr);
}

void PrintUsage ( void )

Definition at line 314 of file util.cxx.

{
    printf("usage: adscmd [list|dump] <ADsPath>\n") ;
}

HRESULT PrintVariant ( VARIANT varPropData )

Definition at line 163 of file util.cxx.

{
    HRESULT hr;
    BSTR bstrValue = NULL;

    switch (varPropData.vt) {
    case VT_I4:
        printf("%d", varPropData.lVal);
        break;
    case VT_BSTR:
        wprintf(L"%s", varPropData.bstrVal);
        break;

    case VT_BOOL:
        printf("%d", V_BOOL(&varPropData));
        break;

    case (VT_ARRAY | VT_VARIANT):
        PrintVariantArray(varPropData);
        break;

    case VT_DATE:
        hr = VarBstrFromDate(
                 varPropData.date,
                 LOCALE_SYSTEM_DEFAULT,
                 LOCALE_NOUSEROVERRIDE,
                 &bstrValue
                 );
        if ((S_OK == hr) && (NULL != bstrValue)) {
            wprintf(L"%s", bstrValue);
            SysFreeString(bstrValue);
        }
        else
            wprintf(L"Error: 0x%x \t Failed while executing VarBstrFromDate\n");
        break;

    default:
        printf("Data type is %d\n", varPropData.vt);
        break;

    }
    printf("\n");
    return(S_OK);
}

HRESULT PrintVariantArray ( VARIANT var )

Definition at line 212 of file util.cxx.

{
    LONG dwSLBound = 0;
    LONG dwSUBound = 0;
    VARIANT v;
    LONG i;
    HRESULT hr = S_OK;

    if(!((V_VT(&var) &  VT_VARIANT) &&  V_ISARRAY(&var))) {
        return(E_FAIL);
    }

    //
    // Check that there is only one dimension in this array
    //

    if ((V_ARRAY(&var))->cDims != 1) {
        hr = E_FAIL;
        BAIL_ON_FAILURE(hr, L"Variant Array dimension is not equal to 1");
    }
    //
    // Check that there is atleast one element in this array
    //

    if ((V_ARRAY(&var))->rgsabound[0].cElements == 0){
        hr = E_FAIL;
        BAIL_ON_FAILURE(hr, L"Variant Array has zero elements");
    }

    //
    // We know that this is a valid single dimension array
    //

    hr = SafeArrayGetLBound(V_ARRAY(&var),
                            1,
                            (long FAR *)&dwSLBound
                            );
    BAIL_ON_FAILURE(hr, L"Failed while executing SafeArrayGetLBound");

    hr = SafeArrayGetUBound(V_ARRAY(&var),
                            1,
                            (long FAR *)&dwSUBound
                            );
    BAIL_ON_FAILURE(hr, L"Failed while executing SafeArrayGetUBound");

    VariantInit(&v);
    for (i = dwSLBound; i <= dwSUBound; i++) {
        hr = SafeArrayGetElement(V_ARRAY(&var),
                                (long FAR *)&i,
                                &v
                                );
        if (FAILED(hr)) {
            wprintf(L"Error: 0x%x \t Failed while executing SafeArrayGetElement", hr);
            continue;
        }
        if (i < dwSUBound) {
            wprintf(L"%s, ", v.bstrVal);
        } else {
            wprintf(L"%s", v.bstrVal);
        }
        VariantClear(&v);
    }
    return(S_OK);

error:
    return(hr);
}

Generated on Wed Nov 13 2024 16:53:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/ADsError/ADsError.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • ADsError
Functions | Variables

ADsError.cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include "ADsError.h"
#include "ADsError_i.c"
#include "IADsError.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 42 of file ADsError.cpp.

{
    return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 50 of file ADsError.cpp.

{
    return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 27 of file ADsError.cpp.

{
    if (dwReason == DLL_PROCESS_ATTACH)
    {
        _Module.Init(ObjectMap, hInstance, &LIBID_ADSERRORLib);
        DisableThreadLibraryCalls(hInstance);
    }
    else if (dwReason == DLL_PROCESS_DETACH)
        _Module.Term();
    return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 58 of file ADsError.cpp.

{
    // registers object, typelib and all interfaces in typelib
    return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 67 of file ADsError.cpp.

{
    return _Module.UnregisterServer(TRUE);
}

Variable Documentation

CComModule _Module

Definition at line 17 of file ADsError.cpp.

Generated on Wed Nov 13 2024 16:53:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/ADsError/ADsError.h File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • ADsError
Classes | Defines | Typedefs | Functions | Variables

ADsError.h File Reference

#include "rpc.h"
#include "rpcndr.h"
#include "windows.h"
#include "ole2.h"
#include "oaidl.h"
#include "ocidl.h"

Go to the source code of this file.

Classes

struct | IADsErrorVtbl

Defines

#define | __ADsError_FWD_DEFINED__
#define | __ADSERRORLib_LIBRARY_DEFINED__
#define | __IADsError_FWD_DEFINED__
#define | __IADsError_INTERFACE_DEFINED__
#define | __REQUIRED_RPCNDR_H_VERSION__ 440

Typedefs

typedef struct ADsError | ADsError
typedef interface IADsError | IADsError
typedef struct IADsErrorVtbl | IADsErrorVtbl

Functions

void __RPC_USER | BSTR_UserFree (unsigned long __RPC_FAR *, BSTR __RPC_FAR *)
unsigned char __RPC_FAR *__RPC_USER | BSTR_UserMarshal (unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, BSTR __RPC_FAR *)
unsigned long __RPC_USER | BSTR_UserSize (unsigned long __RPC_FAR *, unsigned long, BSTR __RPC_FAR *)
unsigned char __RPC_FAR *__RPC_USER | BSTR_UserUnmarshal (unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, BSTR __RPC_FAR *)
HRESULT STDMETHODCALLTYPE | IADsError_GetErrorMessage_Proxy (IADsError __RPC_FAR *This, long hResult, BSTR __RPC_FAR *pbMsg)
void __RPC_STUB | IADsError_GetErrorMessage_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
void __RPC_FAR *__RPC_USER | MIDL_user_allocate (size_t)
void __RPC_USER | MIDL_user_free (void __RPC_FAR *)

Variables

EXTERN_C const CLSID | CLSID_ADsError
EXTERN_C const IID | IID_IADsError
EXTERN_C const IID | LIBID_ADSERRORLib
interface IADsError CONST_VTBL
struct IADsErrorVtbl __RPC_FAR * 		lpVtbl

Define Documentation

#define __ADsError_FWD_DEFINED__

Definition at line 47 of file ADsError.h.

#define __ADSERRORLib_LIBRARY_DEFINED__

Definition at line 202 of file ADsError.h.

#define __IADsError_FWD_DEFINED__

Definition at line 41 of file ADsError.h.

#define __IADsError_INTERFACE_DEFINED__

Definition at line 66 of file ADsError.h.

#define __REQUIRED_RPCNDR_H_VERSION__ 440

Definition at line 16 of file ADsError.h.

Typedef Documentation

typedef struct ADsError ADsError

Definition at line 52 of file ADsError.h.

typedef interface IADsError IADsError

Definition at line 42 of file ADsError.h.

typedef struct IADsErrorVtbl IADsErrorVtbl

Function Documentation

void __RPC_USER BSTR_UserFree | ( | unsigned long __RPC_FAR * | ,
 |  | BSTR __RPC_FAR * |
 | ) |  |
unsigned char __RPC_FAR* __RPC_USER BSTR_UserMarshal | ( | unsigned long __RPC_FAR * | ,
 |  | unsigned char __RPC_FAR * | ,
 |  | BSTR __RPC_FAR * |
 | ) |  |
unsigned long __RPC_USER BSTR_UserSize | ( | unsigned long __RPC_FAR * | ,
 |  | unsigned | long,
 |  | BSTR __RPC_FAR * |
 | ) |  |
unsigned char __RPC_FAR* __RPC_USER BSTR_UserUnmarshal | ( | unsigned long __RPC_FAR * | ,
 |  | unsigned char __RPC_FAR * | ,
 |  | BSTR __RPC_FAR * |
 | ) |  |
HRESULT STDMETHODCALLTYPE IADsError_GetErrorMessage_Proxy | ( | IADsError __RPC_FAR * | This,
 |  | long | hResult,
 |  | BSTR __RPC_FAR * | pbMsg
 | ) |  |
void __RPC_STUB IADsError_GetErrorMessage_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
void __RPC_FAR* __RPC_USER MIDL_user_allocate ( size_t )

Definition at line 364 of file Picklpc.c.

{
    unsigned char * pcAllocated;
    unsigned char * pcUserPtr;

    pcAllocated = (unsigned char *) malloc( s + 15 );
    pcUserPtr =  ALIGN_TO8( pcAllocated );
    if ( pcUserPtr == pcAllocated )
        pcUserPtr = pcAllocated + 8;

    *(pcUserPtr - 1) = (char) (pcUserPtr - pcAllocated);

    return( pcUserPtr );
}

void __RPC_USER MIDL_user_free ( void __RPC_FAR * )

Definition at line 379 of file Picklpc.c.

{
    unsigned char * pcAllocated;
    unsigned char * pcUserPtr;

    pcUserPtr = (unsigned char *) f;
    pcAllocated = pcUserPtr - *(pcUserPtr - 1);

    free( pcAllocated );
}

Variable Documentation

EXTERN_C const CLSID CLSID_ADsError

Definition at line 210 of file ADsError.h.

EXTERN_C const IID IID_IADsError

Definition at line 72 of file ADsError.h.

EXTERN_C const IID LIBID_ADSERRORLib

Definition at line 208 of file ADsError.h.

interface IADsError CONST_VTBL struct IADsErrorVtbl __RPC_FAR* lpVtbl

Definition at line 142 of file ADsError.h.

Generated on Wed Nov 13 2024 16:53:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/ADsError/ADsError.idl File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • ADsError
Classes | Namespaces | Functions

ADsError.idl File Reference

Go to the source code of this file.

Classes

class | ADSERRORLib::ADsError
interface | IADsError

Namespaces

namespace | ADSERRORLib

Functions

ADSERRORLib::importlib ("stdole32.tlb")
ADSERRORLib::importlib ("stdole2.tlb")
Generated on Wed Nov 13 2024 16:53:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/ADsError/ADsError_i.c File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • ADsError
Classes | Defines | Typedefs | Variables

ADsError_i.c File Reference

Go to the source code of this file.

Classes

struct | _IID

Defines

#define | __IID_DEFINED__
#define | CLSID_DEFINED

Typedefs

typedef IID | CLSID
typedef struct _IID | IID

Variables

const CLSID | CLSID_ADsError = {0x417D01E0,0xF1C6,0x11D2,{0xBC,0x88,0x00,0xC0,0x4F,0xD4,0x30,0xAF}}
const IID | IID_IADsError = {0x417D01DF,0xF1C6,0x11D2,{0xBC,0x88,0x00,0xC0,0x4F,0xD4,0x30,0xAF}}
const IID | LIBID_ADSERRORLib = {0x417D01D3,0xF1C6,0x11D2,{0xBC,0x88,0x00,0xC0,0x4F,0xD4,0x30,0xAF}}

Define Documentation

#define __IID_DEFINED__

Definition at line 21 of file ADsError_i.c.

#define CLSID_DEFINED

Definition at line 34 of file ADsError_i.c.

Typedef Documentation

typedef IID CLSID

Definition at line 35 of file ADsError_i.c.

typedef struct _IID IID

Variable Documentation

const CLSID CLSID_ADsError = {0x417D01E0,0xF1C6,0x11D2,{0xBC,0x88,0x00,0xC0,0x4F,0xD4,0x30,0xAF}}

Definition at line 44 of file ADsError_i.c.

const IID IID_IADsError = {0x417D01DF,0xF1C6,0x11D2,{0xBC,0x88,0x00,0xC0,0x4F,0xD4,0x30,0xAF}}

Definition at line 38 of file ADsError_i.c.

const IID LIBID_ADSERRORLib = {0x417D01D3,0xF1C6,0x11D2,{0xBC,0x88,0x00,0xC0,0x4F,0xD4,0x30,0xAF}}

Definition at line 41 of file ADsError_i.c.

Generated on Wed Nov 13 2024 16:53:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/ADsError/ADsError_p.c File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • ADsError
Classes | Defines | Typedefs | Functions | Variables

ADsError_p.c File Reference

#include "rpcproxy.h"
#include "ADsError.h"

Go to the source code of this file.

Classes

struct | _MIDL_PROC_FORMAT_STRING
struct | _MIDL_TYPE_FORMAT_STRING

Defines

#define | __REQUIRED_RPCPROXY_H_VERSION__ 440
#define | _ADsError_CHECK_IID(n) IID_GENERIC_CHECK_IID( _ADsError, pIID, n)
#define | PROC_FORMAT_STRING_SIZE 35
#define | TYPE_FORMAT_STRING_SIZE 41
#define | USE_STUBLESS_PROXY

Typedefs

typedef struct
_MIDL_PROC_FORMAT_STRING 		MIDL_PROC_FORMAT_STRING
typedef struct
_MIDL_TYPE_FORMAT_STRING 		MIDL_TYPE_FORMAT_STRING

Functions

int __stdcall | _ADsError_IID_Lookup (const IID *pIID, int *pIndex)
CINTERFACE_PROXY_VTABLE (8)

Variables

const MIDL_PROC_FORMAT_STRING | __MIDL_ProcFormatString
const MIDL_TYPE_FORMAT_STRING | __MIDL_TypeFormatString
const IID * | _ADsError_BaseIIDList []
PCInterfaceName const | _ADsError_InterfaceNamesList []
const CInterfaceProxyVtbl * | _ADsError_ProxyVtblList []
const CInterfaceStubVtbl * | _ADsError_StubVtblList []
CInterfaceStubVtbl | _IADsErrorStubVtbl
const ExtendedProxyFileInfo | ADsError_ProxyFileInfo
const MIDL_SERVER_INFO | IADsError_ServerInfo
const MIDL_STUB_DESC | Object_StubDesc
const
USER_MARSHAL_ROUTINE_QUADRUPLE 		UserMarshalRoutines [1]

Define Documentation

#define __REQUIRED_RPCPROXY_H_VERSION__ 440

Definition at line 18 of file ADsError_p.c.

#define _ADsError_CHECK_IID ( n ) IID_GENERIC_CHECK_IID( _ADsError, pIID, n)

Definition at line 307 of file ADsError_p.c.

#define PROC_FORMAT_STRING_SIZE 35

Definition at line 31 of file ADsError_p.c.

#define TYPE_FORMAT_STRING_SIZE 41

Definition at line 30 of file ADsError_p.c.

#define USE_STUBLESS_PROXY

Definition at line 13 of file ADsError_p.c.

Typedef Documentation

typedef struct _MIDL_PROC_FORMAT_STRING MIDL_PROC_FORMAT_STRING
typedef struct _MIDL_TYPE_FORMAT_STRING MIDL_TYPE_FORMAT_STRING

Function Documentation

int __stdcall _ADsError_IID_Lookup | ( | const IID * | pIID,
 |  | int * | pIndex
 | ) |  |

Definition at line 309 of file ADsError_p.c.

{

    if(!_ADsError_CHECK_IID(0))
        {
        *pIndex = 0;
        return 1;
        }

    return 0;
}

CINTERFACE_PROXY_VTABLE ( 8 )

Definition at line 125 of file ADsError_p.c.

{
    &IADsError_ProxyInfo,
    &IID_IADsError,
    IUnknown_QueryInterface_Proxy,
    IUnknown_AddRef_Proxy,
    IUnknown_Release_Proxy ,
    0 /* (void *)-1 /* IDispatch::GetTypeInfoCount */ ,
    0 /* (void *)-1 /* IDispatch::GetTypeInfo */ ,
    0 /* (void *)-1 /* IDispatch::GetIDsOfNames */ ,
    0 /* IDispatch_Invoke_Proxy */ ,
    (void *)-1 /* IADsError::GetErrorMessage */
};

Variable Documentation

const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString

Definition at line 185 of file ADsError_p.c.

const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString

Definition at line 242 of file ADsError_p.c.

const IID* _ADsError_BaseIIDList[]
Initial value:

{
    &IID_IDispatch,
    0
}

Definition at line 300 of file ADsError_p.c.

PCInterfaceName const _ADsError_InterfaceNamesList[]
Initial value:

{
    "IADsError",
    0
}

Definition at line 294 of file ADsError_p.c.

const CInterfaceProxyVtbl* _ADsError_ProxyVtblList[]
Initial value:

{
    ( CInterfaceProxyVtbl *) &_IADsErrorProxyVtbl,
    0
}

Definition at line 282 of file ADsError_p.c.

const CInterfaceStubVtbl* _ADsError_StubVtblList[]
Initial value:

{
    ( CInterfaceStubVtbl *) &_IADsErrorStubVtbl,
    0
}

Definition at line 288 of file ADsError_p.c.

CInterfaceStubVtbl _IADsErrorStubVtbl
Initial value:
{
    &IID_IADsError,
    &IADsError_ServerInfo,
    8,
    &IADsError_table[-3],
    CStdStubBuffer_DELEGATING_METHODS
}

Definition at line 149 of file ADsError_p.c.

const ExtendedProxyFileInfo ADsError_ProxyFileInfo
Initial value:

{
    (PCInterfaceProxyVtblList *) & _ADsError_ProxyVtblList,
    (PCInterfaceStubVtblList *) & _ADsError_StubVtblList,
    (const PCInterfaceName * ) & _ADsError_InterfaceNamesList,
    (const IID ** ) & _ADsError_BaseIIDList,
    & _ADsError_IID_Lookup,
    1,
    2,
    0,
    0,
    0,
    0
}

Definition at line 321 of file ADsError_p.c.

static const MIDL_SERVER_INFO IADsError_ServerInfo
Initial value:

    {
    &Object_StubDesc,
    0,
    __MIDL_ProcFormatString.Format,
    &IADsError_FormatStringOffsetTable[-3],
    0,
    0,
    0,
    0
    }

Definition at line 103 of file ADsError_p.c.

const MIDL_STUB_DESC Object_StubDesc
Initial value:

    {
    0,
    NdrOleAllocate,
    NdrOleFree,
    0,
    0,
    0,
    0,
    0,
    __MIDL_TypeFormatString.Format,
    1,
    0x20000,
    0,
    0x50100a4,
    0,
    UserMarshalRoutines,
    0,
    1,
    0,
    0,
    0
    }

Definition at line 70 of file ADsError_p.c.

static const USER_MARSHAL_ROUTINE_QUADRUPLE UserMarshalRoutines
Initial value:

        {

            {
            BSTR_UserSize
            ,BSTR_UserMarshal
            ,BSTR_UserUnmarshal
            ,BSTR_UserFree
            }

        }

Definition at line 160 of file ADsError_p.c.

Generated on Wed Nov 13 2024 16:53:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/ADsError/dlldata.c File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • ADsError
Defines | Functions

dlldata.c File Reference

#include <rpcproxy.h>

Go to the source code of this file.

Defines

#define | PROXY_DELEGATION

Functions

PROXYFILE_LIST_START | REFERENCE_PROXY_FILE (ADsError)

Define Documentation

#define PROXY_DELEGATION

Definition at line 14 of file dlldata.c.

Function Documentation

PROXYFILE_LIST_START REFERENCE_PROXY_FILE ( ADsError )
Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/ADsError/IADsError.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • ADsError
Defines | Functions

IADsError.cpp File Reference

#include "stdafx.h"
#include "ADsError.h"
#include "IADsError.h"

Go to the source code of this file.

Defines

#define | FACILITY_ADSI 0x00005000

Functions

HRESULT | GetADSIError (HRESULT hr, CComBSTR &bstr)
HRESULT | GetErrorMessage (HRESULT hr, CComBSTR &bstr)
BOOL | GetMessageHelper (DWORD flags, HMODULE hModule, HRESULT hr, CComBSTR &bstr)

Define Documentation

#define FACILITY_ADSI 0x00005000

Definition at line 57 of file IADsError.cpp.

Function Documentation

HRESULT GetADSIError | ( | HRESULT | hr,
 |  | CComBSTR & | bstr
 | ) |  |
HRESULT GetErrorMessage | ( | HRESULT | hr,
 |  | CComBSTR & | bstr
 | ) |  |

Definition at line 61 of file IADsError.cpp.

{

  bstr.Empty();
  if ( SUCCEEDED(hr) )
  {
    bstr = _T("SUCCESS");
    return S_OK;
  }

  int code = HRESULT_CODE(hr);

    if (code == -1)
    {
       bstr = _T("Unknown Error Code");
     return S_OK;
    }

  // default is the system error message table
   HMODULE hModule = 0;

   DWORD dwFlags = FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS |FORMAT_MESSAGE_FROM_SYSTEM;

   int facility = HRESULT_FACILITY(hr);
   if ( hr & FACILITY_ADSI ) // standard ADSI Errors
   {

        static HMODULE adsi_err_res_dll = 0;
        // use the net error message resource dll
        if (adsi_err_res_dll == 0)
        {
               adsi_err_res_dll =LoadLibraryEx(_T("activeds.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE);
        }

        hModule = adsi_err_res_dll;
        dwFlags |= FORMAT_MESSAGE_FROM_HMODULE;

        // the message dll expects the entire error code
        code = hr;

   }
   else
   {

    switch (facility)
    {

      case FACILITY_WIN32:    // 0x7
      {
        // included here:
        // lanman error codes (in it's own dll)
        // dns
        // winsock

             static HMODULE lm_err_res_dll = 0;
         if (code >= NERR_BASE && code <= MAX_NERR)
         {
          // use the net error message resource dll
          if (lm_err_res_dll == 0)
          {
            lm_err_res_dll = LoadLibraryEx(_T("netmsg.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE);
          }

          hModule = lm_err_res_dll;
          dwFlags |= FORMAT_MESSAGE_FROM_HMODULE;
         }
      }
      break;

      case FACILITY_SSPI: // 0x9
      {
        // some of these are in their own dll (those declared in issperr.h),
        // some are in the system message tables.
        // first try the system message tables.
        CComBSTR bTest;
        if( !GetMessageHelper( dwFlags, 0, code, bTest ) )
        {
          // not found.  try the secur32.dll resources
                // @@ use SafeDLL here.
          static HMODULE sec_err_res_dll = 0;
          if (sec_err_res_dll == 0)
          {
            sec_err_res_dll = LoadLibraryEx(_T("secur32.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE);
          }

          hModule = sec_err_res_dll;
          dwFlags |= FORMAT_MESSAGE_FROM_HMODULE;
        }
        break;
      }

      default:
      {
        //do nothing;
        break;
      }

    } // switch

   } // end else

  // Retrieve the message
    GetMessageHelper( dwFlags, hModule, code, bstr );

  //////////////////////////////////////////////////////////////////
  //
  // Extended error message may be occured.
  //
  // IADs, IADsContainer, IDirectoryObject or IDirectorySearch may return
  // this extended error message
  //
  ////////////////////////////////////////////////////////////////////

  if (  (hr & FACILITY_ADSI)  ||         //adsi
      facility == FACILITY_WIN32  )   // and win32
  {
    WCHAR szBuffer[MAX_PATH];
    WCHAR szName[MAX_PATH];
    DWORD dwError;

    hr = ADsGetLastError( &dwError, szBuffer, (sizeof(szBuffer)/sizeof(WCHAR))-1,
                        szName, (sizeof(szName)/sizeof(WCHAR))-1 );

    if ( SUCCEEDED(hr) && dwError != ERROR_INVALID_DATA  && wcslen(szBuffer))
    {
      USES_CONVERSION;
      bstr.Append(_T("  -- Extended Error:"));
      bstr.Append(szName);
      bstr.Append(_T(" : "));
      bstr.Append( szBuffer );
    }
  }

  return S_OK;
}

BOOL GetMessageHelper | ( | DWORD | flags,
 |  | HMODULE | hModule,
 |  | HRESULT | hr,
 |  | CComBSTR & | bstr
 | ) |  |

Definition at line 214 of file IADsError.cpp.

{
      BOOL bRet;
    LPTSTR lpBuffer=NULL;

    /////////////////////////////////////////////
    //
    // Retrieve the Error message
    //
    /////////////////////////////////////////////////

    bRet = FormatMessage(dwFlags,
               hModule,  hr,
               MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT),
               (LPTSTR) &lpBuffer, 0, NULL);

    if ( !bRet )
    {
      TCHAR szErr[256];
      wsprintf(szErr, _T("Error %X"), hr );
      bstr =  szErr;
    }

    if ( lpBuffer )
    {
      bstr.Append( lpBuffer );
      LocalFree( lpBuffer );
    }

    return bRet;

}

Generated on Wed Nov 13 2024 16:53:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/ADsError/IADsError.h File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • ADsError
Classes

IADsError.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class ADsError
Generated on Wed Nov 13 2024 16:53:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/ADsError/resource.h File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • ADsError
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_ADsError 102
#define | IDS_ADSERROR_DESC 101
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_ADsError 102

Definition at line 7 of file resource.h.

#define IDS_ADSERROR_DESC 101

Definition at line 6 of file resource.h.

#define IDS_PROJNAME 100

Definition at line 5 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/ADsError/StdAfx.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • ADsError

StdAfx.cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/ADsError/StdAfx.h File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • ADsError
Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>
#include <activeds.h>
#include <lmerr.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0400
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 16 of file StdAfx.h.

#define _WIN32_WINNT 0x0400

Definition at line 14 of file StdAfx.h.

#define STRICT

Definition at line 12 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/ADSIDump/AdsiDump.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • ADSIDump
Classes | Defines | Typedefs | Functions

AdsiDump.cpp File Reference

#include "stdafx.h"
#include <stdio.h>
#include <string>

Go to the source code of this file.

Classes

class | CStringException

Defines

#define | CheckHresult(hr, sz)
#define | CheckHresultADs(hr) { HRESULT hr_ADSxyz = (hr); if (!SUCCEEDED(hr_ADSxyz)) VThrowAdsError(); }

Typedefs

typedef VOID(* | pfnArrayCallback )(CSZ cszValue, IADs *piads, FILE *pfile)
typedef std::basic_string< WCHAR > | stringW

Functions

INT | CchSzLen (CSZ cszString)
void | main (int argc, char *argv[])
VOID | VDumpArray (CSZ cszValue, IADs *piads, FILE *pfile)
VOID | VDumpAttribute (CSZ cszAttribute, IADs *piads, FILE *pfile)
VOID | VDumpObject (CSZ cszParent, IADs *piads, FILE *pfile)
VOID | VDumpTree (CSZ cszParent, IADs *piads, FILE *pfile)
VOID | VIterateSafeArray (SAFEARRAY *psa, VARTYPE vt, IADs *piads, FILE *pfile, pfnArrayCallback fnCallback)
VOID | VThrowAdsError (VOID)

Define Documentation

#define CheckHresult | ( | hr,
 |  | sz
 | ) |
Value:
{ HRESULT hr_xyz = (hr);  \
    if (!SUCCEEDED(hr_xyz)) { \
        WCHAR szBuf[1024];  \
        swprintf(szBuf, L"Error: 0x%x  %s", hr, sz); \
    throw CStringException(szBuf);} }

Definition at line 75 of file AdsiDump.cpp.

#define CheckHresultADs ( hr ) { HRESULT hr_ADSxyz = (hr); if (!SUCCEEDED(hr_ADSxyz)) VThrowAdsError(); }

Definition at line 74 of file AdsiDump.cpp.

Typedef Documentation

typedef VOID(* pfnArrayCallback)(CSZ cszValue, IADs *piads, FILE *pfile)

Definition at line 128 of file AdsiDump.cpp.

typedef std::basic_string<WCHAR> stringW

Definition at line 18 of file AdsiDump.cpp.

Function Documentation

INT CchSzLen ( CSZ cszString )

Definition at line 33 of file AdsiDump.cpp.

    {
    Assert(cszString);

    const WCHAR * pwch = cszString;
    while (*pwch)
        pwch++;

    return (pwch - cszString);
    }

void main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 472 of file AdsiDump.cpp.

    {
    FILE * pfile = NULL;

    try
        {

        // initialize COM
        CheckHresult(::CoInitialize(NULL), TEXT("Could not initialize COM"));

        // validate input
        if (3 != argc)
            {
            MessageBox(NULL,
                       TEXT("Usage is AdsiDump <ADSI path> <Output file>"),
                       TEXT("Usage"),
                       MB_OK);
            return;
            }

        // convert LDAP path to ANSI
        UINT cchLdapPath = ::strlen(argv[1]);
        SZ szLdapPath = (SZ) alloca((cchLdapPath + 1) * sizeof(WCHAR));
        ::MultiByteToWideChar(CP_ACP,
                              0,
                              argv[1],
                              -1,
                              szLdapPath,
                              cchLdapPath + 1);

        // open the file
        pfile = ::fopen(argv[2], "w");
        if (!pfile)
            {
            ::MessageBox(NULL,
                         TEXT("Could not open output file for writing"),
                         TEXT("Error"),
                         MB_OK);
            return;
            }

        // open the object
        CComPtr<IADs> srpiads;
        CheckHresult(::ADsGetObject(szLdapPath,
                                    IID_IADs,
                                    (PVOID *) &srpiads),
                     TEXT("Could not open LDAP path"));
        Assert(srpiads);

        // dump the tree
        ::VDumpTree(NULL, srpiads, pfile);

        }
    catch (CStringException& rstrex)
        {
        ::MessageBox(NULL, rstrex, TEXT("Error"), MB_OK);
        }

    // close the file
    if (pfile)
        ::fclose(pfile);

    ::printf("\n");
    }

VOID VDumpArray | ( | CSZ | cszValue,
 |  | IADs * | piads,
 |  | FILE * | pfile
 | ) |  |

Definition at line 210 of file AdsiDump.cpp.

    {
    Assert(cszValue);
    Assert(pfile);

    UNUSED(piads);

    ::fprintf(pfile, "  \"%S\"", cszValue);
    }

VOID VDumpAttribute | ( | CSZ | cszAttribute,
 |  | IADs * | piads,
 |  | FILE * | pfile
 | ) |  |

Definition at line 238 of file AdsiDump.cpp.

    {
    Assert(piads);
    Assert(cszAttribute);
    Assert(pfile);

    CComVariant svar;
    CComBSTR sbstr(cszAttribute);
    HRESULT hr = S_OK;
    hr = piads->Get(sbstr, &svar);
    if (E_ADS_PROPERTY_NOT_FOUND != hr) CheckHresult(hr, TEXT("Failed to Get value of an attribute"));

    ::fprintf(pfile, "\n    %S : ", (SZ) sbstr);

    switch (svar.vt)
        {
        default:
            ::fprintf(pfile, "(Unknown variant type)");
            break;

        case VT_BSTR:
            ::fprintf(pfile, "(BSTR) \"%S\"", svar.bstrVal);
            break;

        case (VT_ARRAY | VT_BSTR):
        case (VT_ARRAY | VT_VARIANT):
            {
            if (svar.parray)
                {
                ::fprintf(pfile, "(ARRAY) [");
                ::VIterateSafeArray(svar.parray,
                                    svar.vt,
                                    piads,
                                    pfile,
                                    VDumpArray);
                ::fprintf(pfile, "]");
                }
            break;
            }

        case VT_I1:
        case VT_I4:
        case VT_UI1:
        case VT_UI2:
        case VT_INT:
        case VT_UINT:
            fprintf(pfile, "(INT) %d", svar.intVal);
            break;

        case VT_I8:
        case VT_UI8:
            ::fprintf(pfile, "(INT8) %ld", svar.uintVal);
            break;

        case VT_BOOL:
            ::fprintf(pfile, "(BOOL) %s", (svar.boolVal) ? "TRUE" : "FALSE");
            break;
        }
    }

VOID VDumpObject | ( | CSZ | cszParent,
 |  | IADs * | piads,
 |  | FILE * | pfile
 | ) |  |

Definition at line 316 of file AdsiDump.cpp.

    {
    Assert(piads);
    Assert(pfile);

    // pull down information from server
    CheckHresultADs(piads->GetInfo());

    // start dumping
    ::fprintf(pfile, "\n\n=======================================================\n");

    // name
    CComBSTR sbstrName;
    CheckHresultADs(piads->get_Name(&sbstrName));
    ::fprintf(pfile, "\n***  %S  ***", (SZ) sbstrName);
    ::wprintf(L"\n  %s...", sbstrName);

    // parent
    if (cszParent)
        ::fprintf(pfile, "\n  Child of %S", cszParent);
    else
        ::fprintf(pfile, "\n  ROOT OBJECT");

    // full path
    CComBSTR sbstrPath;
    CheckHresultADs(piads->get_ADsPath(&sbstrPath));
    ::fprintf(pfile, "\n  Full ADs path: \"%S\"", (SZ) sbstrPath);

    // class
    CComBSTR sbstrClass;
    CheckHresultADs(piads->get_Class(&sbstrClass));
    ::fprintf(pfile, "\n  Class: %S", (SZ) sbstrClass);

    // schema
    CComBSTR sbstrSchema;
    CheckHresultADs(piads->get_Schema(&sbstrSchema));
    ::fprintf(pfile, "\n  Schema: %S", (SZ) sbstrSchema);

    // attributes
    ::fprintf(pfile, "\n  Attributes -------------------");

    // open the class, get all the attributes
    CComPtr<IADsClass> srpiaclass;
    CheckHresultADs(::ADsGetObject(sbstrSchema,
                                     IID_IADsClass,
                                     (PVOID *) &srpiaclass));
    Assert(srpiaclass);

    VARIANT var;
    var.vt = VT_EMPTY;
    var.parray = NULL;
    CheckHresultADs(srpiaclass->get_MandatoryProperties(&var));
    if (VT_ARRAY == (var.vt & VT_ARRAY))
        {
        Assert(var.parray);
        ::VIterateSafeArray(var.parray, var.vt, piads, pfile, VDumpAttribute);
        ::SafeArrayDestroy(var.parray);
        }

    var.vt = VT_EMPTY;
    var.parray = NULL;
    CheckHresultADs(srpiaclass->get_OptionalProperties(&var));
    if (VT_ARRAY == (var.vt & VT_ARRAY))
        {
        Assert(var.parray);
        ::VIterateSafeArray(var.parray, var.vt, piads, pfile, VDumpAttribute);
        ::SafeArrayDestroy(var.parray);
        }

    ::fprintf(pfile, "\n");
    }

VOID VDumpTree | ( | CSZ | cszParent,
 |  | IADs * | piads,
 |  | FILE * | pfile
 | ) |  |

Definition at line 405 of file AdsiDump.cpp.

    {
    Assert(piads);
    Assert(pfile);

    // dump this object
    ::VDumpObject(cszParent, piads, pfile);

    // get name
    CComBSTR sbstrName;
    CheckHresultADs(piads->get_Name(&sbstrName));

    // iterate through children, and dump them
    CComPtr<IADsContainer> srpiac;
    HRESULT hr = S_OK;
    CheckHresult(piads->QueryInterface(IID_IADsContainer,(PVOID *) &srpiac),
                    TEXT("Failed to QI to IADsContainer interface"));

    if (srpiac)
        {
        CComPtr<IEnumVARIANT> srpiev;
        CheckHresult(srpiac->get__NewEnum((IUnknown **) &srpiev), TEXT("Failed to get_NewEnum"));

        if (srpiev)
            {
            while (true)
                {
                CComVariant svar;
                ULONG cFetched = 0;
                hr = srpiev->Next(1, &svar, &cFetched);
                if (S_OK != hr)
                    break;

                Assert(1 == cFetched);
                Assert(VT_DISPATCH == svar.vt);
                Assert(svar.pdispVal);

                CComPtr<IADs> srpiads;
                CheckHresultADs(svar.pdispVal->QueryInterface(IID_IADs,
                                (PVOID *) &srpiads));
                Assert(srpiads);

                // dump the object and its children
                ::VDumpTree(sbstrName, srpiads, pfile);
                }
            }
        }
    }

VOID VIterateSafeArray | ( | SAFEARRAY * | psa,
 |  | VARTYPE | vt,
 |  | IADs * | piads,
 |  | FILE * | pfile,
 |  | pfnArrayCallback | fnCallback
 | ) |  |

Definition at line 142 of file AdsiDump.cpp.

    {
    Assert(psa);
    Assert(1 == ::SafeArrayGetDim(psa));
    Assert(VT_ARRAY == (vt & VT_ARRAY) && "Should be an array");
    Assert(piads);
    Assert(pfile);
    //Assert(pfnArrayCallback);

    vt -= VT_ARRAY;

    long lLBound, lUBound;
    Verify(SUCCEEDED(::SafeArrayGetLBound(psa, 1, &lLBound)));
    Verify(SUCCEEDED(::SafeArrayGetUBound(psa, 1, &lUBound)));

    switch (vt)
        {
        default:
#ifdef DEBUG
            Assert(false && "Unknown variant type");
            break;

        case VT_VARIANT:
#endif    // _DEBUG
            {
            for (long i = lLBound; i <= lUBound; i++)
                {
                CComVariant svar;
                Verify(SUCCEEDED(::SafeArrayGetElement(psa, &i, &svar)));
                if (VT_BSTR == svar.vt && svar.bstrVal)
                    fnCallback(svar.bstrVal, piads, pfile);
                }
            break;
            }

        case VT_BSTR:
            {
            for (long i = lLBound; i <= lUBound; i++)
                {
                CComBSTR sbstr;
                Verify(SUCCEEDED(::SafeArrayGetElement(psa, &i, &sbstr)));
                if (sbstr)
                    fnCallback(sbstr, piads, pfile);
                }
            break;
            }
        }
    }

VOID VThrowAdsError ( VOID )

Definition at line 93 of file AdsiDump.cpp.

    {
    DWORD dwCode = 0;
    const dwLen = 2048;
    WCHAR szError[dwLen];
    WCHAR szProvider[dwLen];
    if (SUCCEEDED(::ADsGetLastError(&dwCode,
                                    szError,
                                    dwLen,
                                    szProvider,
                                    dwLen)))
        {
        stringW strError;

        strError = TEXT("An ADSI error has occured.  Provider = '");
        strError += szProvider;
        strError += TEXT("'  Error message = \"");
        strError += szError;
        strError += TEXT("\"  Error code = 0x");

        TCHAR szNum[16];
        ::_ltow(dwCode, szNum, 16);    // BASE-16
        strError += szNum;

        throw CStringException(strError.c_str());
        }
    else
        {
        throw CStringException(TEXT("Unknown ADSI error"));
        }
    }

Generated on Wed Nov 13 2024 16:53:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/ADSIDump/StdAfx.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • ADSIDump

StdAfx.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/ADSIDump/StdAfx.h File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • ADSIDump
Defines | Typedefs

StdAfx.h File Reference

#include <windows.h>
#include <atlbase.h>
#include <activeds.h>

Go to the source code of this file.

Defines

#define | Assert(x) { }
#define | Implies(x, y) Assert((!(x)) || (y))
#define | UNUSED(x) { x; }
#define | Verify(x) { x; }

Typedefs

typedef const WCHAR * | CSZ
typedef WCHAR * | SZ

Define Documentation

#define Assert ( x ) { }

Definition at line 30 of file StdAfx.h.

#define Implies | ( | x,
 |  | y |
 | ) |  | Assert((!(x)) || (y))

Definition at line 33 of file StdAfx.h.

#define UNUSED ( x ) { x; }

Definition at line 38 of file StdAfx.h.

#define Verify ( x ) { x; }

Definition at line 31 of file StdAfx.h.

Typedef Documentation

typedef const WCHAR* CSZ

Definition at line 36 of file StdAfx.h.

typedef WCHAR* SZ

Definition at line 35 of file StdAfx.h.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/DsBrowse/bitmaps/afxres.h File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • DsBrowse
  • bitmaps
Defines

afxres.h File Reference

Go to the source code of this file.

Defines

#define | _AFXRES 1
#define | AFX_CONTROLBAR_MASK(nIDC) (1L << (nIDC - AFX_IDW_CONTROLBAR_FIRST))
#define | AFX_ID_PREVIEW_CLOSE 0xE300
#define | AFX_ID_PREVIEW_NEXT 0xE302
#define | AFX_ID_PREVIEW_NUMPAGE 0xE301
#define | AFX_ID_PREVIEW_PREV 0xE303
#define | AFX_ID_PREVIEW_PRINT 0xE304
#define | AFX_ID_PREVIEW_ZOOMIN 0xE305
#define | AFX_ID_PREVIEW_ZOOMOUT 0xE306
#define | AFX_IDC_CHANGE 101
#define | AFX_IDC_CONTEXTHELP 30977
#define | AFX_IDC_HSPLITBAR 30980
#define | AFX_IDC_LISTBOX 100
#define | AFX_IDC_MAGNIFY 30978
#define | AFX_IDC_MOVE4WAY 30988
#define | AFX_IDC_NODROPCRSR 30982
#define | AFX_IDC_PRINT_DOCNAME 201
#define | AFX_IDC_PRINT_PAGENUM 204
#define | AFX_IDC_PRINT_PORTNAME 203
#define | AFX_IDC_PRINT_PRINTERNAME 202
#define | AFX_IDC_SMALLARROWS 30979
#define | AFX_IDC_TRACK4WAY 30987
#define | AFX_IDC_TRACKNESW 30984
#define | AFX_IDC_TRACKNS 30985
#define | AFX_IDC_TRACKNWSE 30983
#define | AFX_IDC_TRACKWE 30986
#define | AFX_IDC_VSPLITBAR 30981
#define | AFX_IDD_BUSY 30730
#define | AFX_IDD_CHANGEICON 30725
#define | AFX_IDD_COLOR 28679
#define | AFX_IDD_CONVERT 30726
#define | AFX_IDD_EDITLINKS 30728
#define | AFX_IDD_FILEBROWSE 30729
#define | AFX_IDD_FILEOPEN 28676
#define | AFX_IDD_FILESAVE 28677
#define | AFX_IDD_FIND 28682
#define | AFX_IDD_FONT 28678
#define | AFX_IDD_INSERTOBJECT 30724
#define | AFX_IDD_NEWTYPEDLG 30721
#define | AFX_IDD_PASTESPECIAL 30727
#define | AFX_IDD_PREVIEW_TOOLBAR 30723
#define | AFX_IDD_PRINT 28680
#define | AFX_IDD_PRINTDLG 30722
#define | AFX_IDD_PRINTSETUP 28681
#define | AFX_IDD_REPLACE 28683
#define | AFX_IDI_STD_FRAME 2
#define | AFX_IDI_STD_MDIFRAME 1
#define | AFX_IDM_FIRST_MDICHILD 0xFF00
#define | AFX_IDM_WINDOW_FIRST 0xE130
#define | AFX_IDM_WINDOW_LAST 0xE13F
#define | AFX_IDP_ASK_TO_DISCARD 0xF18E
#define | AFX_IDP_ASK_TO_SAVE 0xF103
#define | AFX_IDP_ASK_TO_UPDATE 0xF187
#define | AFX_IDP_BAD_VERB 0xF183
#define | AFX_IDP_COMMAND_FAILURE 0xF109
#define | AFX_IDP_FAILED_ACCESS_READ 0xF123
#define | AFX_IDP_FAILED_ACCESS_WRITE 0xF124
#define | AFX_IDP_FAILED_DISK_FULL 0xF122
#define | AFX_IDP_FAILED_INVALID_FORMAT 0xF120
#define | AFX_IDP_FAILED_INVALID_PATH 0xF121
#define | AFX_IDP_FAILED_IO_ERROR_READ 0xF125
#define | AFX_IDP_FAILED_IO_ERROR_WRITE 0xF126
#define | AFX_IDP_FAILED_MEMORY_ALLOC 0xF10A
#define | AFX_IDP_FAILED_TO_AUTO_REGISTER 0xF18A
#define | AFX_IDP_FAILED_TO_CONNECT 0xF181
#define | AFX_IDP_FAILED_TO_CONVERT 0xF18B
#define | AFX_IDP_FAILED_TO_CREATE_DOC 0xF104
#define | AFX_IDP_FAILED_TO_LAUNCH 0xF186
#define | AFX_IDP_FAILED_TO_LAUNCH_HELP 0xF107
#define | AFX_IDP_FAILED_TO_NOTIFY 0xF185
#define | AFX_IDP_FAILED_TO_OPEN_DOC 0xF101
#define | AFX_IDP_FAILED_TO_REGISTER 0xF189
#define | AFX_IDP_FAILED_TO_SAVE_DOC 0xF102
#define | AFX_IDP_FAILED_TO_START_PRINT 0xF106
#define | AFX_IDP_FAILED_TO_UPDATE 0xF188
#define | AFX_IDP_FILE_TOO_LARGE 0xF105
#define | AFX_IDP_GET_NOT_SUPPORTED 0xF18C
#define | AFX_IDP_INTERNAL_FAILURE 0xF108
#define | AFX_IDP_INVALID_FILENAME 0xF100
#define | AFX_IDP_PARSE_INT 0xF110
#define | AFX_IDP_PARSE_INT_RANGE 0xF112
#define | AFX_IDP_PARSE_RADIO_BUTTON 0xF115
#define | AFX_IDP_PARSE_REAL 0xF111
#define | AFX_IDP_PARSE_REAL_RANGE 0xF113
#define | AFX_IDP_PARSE_STRING_SIZE 0xF114
#define | AFX_IDP_SERVER_BUSY 0xF182
#define | AFX_IDP_SET_NOT_SUPPORTED 0xF18D
#define | AFX_IDP_SQL_API_CONFORMANCE 0xF28E
#define | AFX_IDP_SQL_CONNECT_FAIL 0xF281
#define | AFX_IDP_SQL_DATA_TRUNCATED 0xF295
#define | AFX_IDP_SQL_DYNASET_NOT_SUPPORTED 0xF28C
#define | AFX_IDP_SQL_EMPTY_COLUMN_LIST 0xF283
#define | AFX_IDP_SQL_FIELD_SCHEMA_MISMATCH 0xF284
#define | AFX_IDP_SQL_FIRST 0xF280
#define | AFX_IDP_SQL_ILLEGAL_MODE 0xF285
#define | AFX_IDP_SQL_LOCK_MODE_NOT_SUPPORTED 0xF294
#define | AFX_IDP_SQL_MULTIPLE_ROWS_AFFECTED 0xF286
#define | AFX_IDP_SQL_NO_CURRENT_RECORD 0xF287
#define | AFX_IDP_SQL_NO_DATA_FOUND 0xF290
#define | AFX_IDP_SQL_NO_POSITIONED_UPDATES 0xF293
#define | AFX_IDP_SQL_NO_ROWS_AFFECTED 0xF288
#define | AFX_IDP_SQL_ODBC_LOAD_FAILED 0xF28B
#define | AFX_IDP_SQL_ODBC_V2_REQUIRED 0xF292
#define | AFX_IDP_SQL_RECORDSET_FORWARD_ONLY 0xF282
#define | AFX_IDP_SQL_RECORDSET_READONLY 0xF289
#define | AFX_IDP_SQL_ROW_UPDATE_NOT_SUPPORTED 0xF291
#define | AFX_IDP_SQL_SNAPSHOT_NOT_SUPPORTED 0xF28D
#define | AFX_IDP_SQL_SQL_CONFORMANCE 0xF28F
#define | AFX_IDP_SQL_SQL_NO_TOTAL 0xF28A
#define | AFX_IDP_STATIC_OBJECT 0xF180
#define | AFX_IDP_VB2APICALLED 0xF10B
#define | AFX_IDS_ACTIVATE_VERB 0xF082
#define | AFX_IDS_ALL_FILES 0xF087
#define | AFX_IDS_ALLFILTER 0xF002
#define | AFX_IDS_APP_TITLE 0xE000
#define | AFX_IDS_APP_TITLE_EMBEDDING 0xE004
#define | AFX_IDS_APP_TITLE_INPLACE 0xE003
#define | AFX_IDS_AUTO 0xF084
#define | AFX_IDS_BITMAP_FORMAT 0xF090
#define | AFX_IDS_CHANGE_LINK 0xF083
#define | AFX_IDS_DESKACCESSORY 0xEFDA
#define | AFX_IDS_DIB_FORMAT 0xF08F
#define | AFX_IDS_EDIT_VERB 0xF081
#define | AFX_IDS_EMBED_FORMAT 0xF092
#define | AFX_IDS_EXIT_MENU 0xF08C
#define | AFX_IDS_FROZEN 0xF086
#define | AFX_IDS_HELPMODEMESSAGE 0xE002
#define | AFX_IDS_IDLEMESSAGE 0xE001
#define | AFX_IDS_LINKSOURCE_FORMAT 0xF091
#define | AFX_IDS_MANUAL 0xF085
#define | AFX_IDS_MDICHILD 0xEF1F
#define | AFX_IDS_METAFILE_FORMAT 0xF08E
#define | AFX_IDS_OBJECT_MENUITEM 0xF080
#define | AFX_IDS_ONEPAGE 0xF041
#define | AFX_IDS_OPENFILE 0xF000
#define | AFX_IDS_PREVIEW_CLOSE 0xF005
#define | AFX_IDS_PREVIEWPAGEDESC 0xF044
#define | AFX_IDS_PRINTONPORT 0xF040
#define | AFX_IDS_PRINTPAGENUM 0xF043
#define | AFX_IDS_SAVE_AS_MENU 0xF08A
#define | AFX_IDS_SAVE_COPY_AS_MENU 0xF08B
#define | AFX_IDS_SAVE_MENU 0xF088
#define | AFX_IDS_SAVEFILE 0xF001
#define | AFX_IDS_SAVEFILECOPY 0xF004
#define | AFX_IDS_SCCLOSE 0xEF06
#define | AFX_IDS_SCFIRST 0xEF00
#define | AFX_IDS_SCMAXIMIZE 0xEF03
#define | AFX_IDS_SCMINIMIZE 0xEF02
#define | AFX_IDS_SCMOVE 0xEF01
#define | AFX_IDS_SCNEXTWINDOW 0xEF04
#define | AFX_IDS_SCPREVWINDOW 0xEF05
#define | AFX_IDS_SCRESTORE 0xEF12
#define | AFX_IDS_SCSIZE 0xEF00
#define | AFX_IDS_SCTASKLIST 0xEF13
#define | AFX_IDS_TWOPAGE 0xF042
#define | AFX_IDS_UNTITLED 0xF003
#define | AFX_IDS_UPDATE_MENU 0xF089
#define | AFX_IDS_UPDATING_ITEMS 0xF08D
#define | AFX_IDW_CONTROLBAR_FIRST 0xE800
#define | AFX_IDW_CONTROLBAR_LAST 0xE8FF
#define | AFX_IDW_HSCROLL_FIRST 0xEA00
#define | AFX_IDW_PANE_FIRST 0xE900
#define | AFX_IDW_PANE_LAST 0xE9ff
#define | AFX_IDW_PANE_SAVE 0xEA21
#define | AFX_IDW_PREVIEW_BAR 0xE802
#define | AFX_IDW_RESIZE_BAR 0xE803
#define | AFX_IDW_SIZE_BOX 0xEA20
#define | AFX_IDW_STATUS_BAR 0xE801
#define | AFX_IDW_TOOLBAR 0xE800
#define | AFX_IDW_VSCROLL_FIRST 0xEA10
#define | AFX_WS_DEFAULT_VIEW (WS_CHILD | WS_VISIBLE | WS_BORDER)
#define | CBRS_BOTTOM 0x00008200L
#define | CBRS_LEFT 0x00001400L
#define | CBRS_NOALIGN 0x00000000L
#define | CBRS_RIGHT 0x00004100L
#define | CBRS_TOP 0x00002800L
#define | ID_APP_ABOUT 0xE140
#define | ID_APP_EXIT 0xE141
#define | ID_CONTEXT_HELP 0xE144
#define | ID_DEFAULT_HELP 0xE146
#define | ID_EDIT_CLEAR 0xE120
#define | ID_EDIT_CLEAR_ALL 0xE121
#define | ID_EDIT_COPY 0xE122
#define | ID_EDIT_CUT 0xE123
#define | ID_EDIT_FIND 0xE124
#define | ID_EDIT_PASTE 0xE125
#define | ID_EDIT_PASTE_LINK 0xE126
#define | ID_EDIT_PASTE_SPECIAL 0xE127
#define | ID_EDIT_REDO 0xE12C
#define | ID_EDIT_REPEAT 0xE128
#define | ID_EDIT_REPLACE 0xE129
#define | ID_EDIT_SELECT_ALL 0xE12A
#define | ID_EDIT_UNDO 0xE12B
#define | ID_FILE_CLOSE 0xE102
#define | ID_FILE_MRU_FILE1 0xE110
#define | ID_FILE_MRU_FILE2 0xE111
#define | ID_FILE_MRU_FILE3 0xE112
#define | ID_FILE_MRU_FILE4 0xE113
#define | ID_FILE_NEW 0xE100
#define | ID_FILE_OPEN 0xE101
#define | ID_FILE_PAGE_SETUP 0xE105
#define | ID_FILE_PRINT 0xE107
#define | ID_FILE_PRINT_PREVIEW 0xE108
#define | ID_FILE_PRINT_SETUP 0xE106
#define | ID_FILE_SAVE 0xE103
#define | ID_FILE_SAVE_AS 0xE104
#define | ID_FILE_SAVE_COPY_AS 0xE10A
#define | ID_FILE_UPDATE 0xE109
#define | ID_HELP 0xE145
#define | ID_HELP_INDEX 0xE142
#define | ID_HELP_USING 0xE143
#define | ID_INDICATOR_CAPS 0xE701
#define | ID_INDICATOR_EXT 0xE700
#define | ID_INDICATOR_NUM 0xE702
#define | ID_INDICATOR_OVR 0xE704
#define | ID_INDICATOR_REC 0xE705
#define | ID_INDICATOR_SCRL 0xE703
#define | ID_NEXT_PANE 0xE150
#define | ID_OLE_EDIT_CHANGE_ICON 0xE203
#define | ID_OLE_EDIT_CONVERT 0xE202
#define | ID_OLE_EDIT_LINKS 0xE201
#define | ID_OLE_INSERT_NEW 0xE200
#define | ID_OLE_VERB_FIRST 0xE210
#define | ID_OLE_VERB_LAST 0xE21F
#define | ID_PREV_PANE 0xE151
#define | ID_RECORD_FIRST 0xE900
#define | ID_RECORD_LAST 0xE901
#define | ID_RECORD_NEXT 0xE902
#define | ID_RECORD_PREV 0xE903
#define | ID_SEPARATOR 0
#define | ID_VIEW_STATUS_BAR 0xE801
#define | ID_VIEW_TOOLBAR 0xE800
#define | ID_WINDOW_ARRANGE 0xE131
#define | ID_WINDOW_CASCADE 0xE132
#define | ID_WINDOW_NEW 0xE130
#define | ID_WINDOW_SPLIT 0xE135
#define | ID_WINDOW_TILE_HORZ 0xE133
#define | ID_WINDOW_TILE_VERT 0xE134
#define | IDC_STATIC -1
#define | RT_DLGINIT MAKEINTRESOURCE(240)
#define | WM_VBXINIT (WM_USER+0)

Define Documentation

#define _AFXRES 1

Definition at line 14 of file afxres.h.

#define AFX_CONTROLBAR_MASK ( nIDC ) (1L << (nIDC - AFX_IDW_CONTROLBAR_FIRST))

Definition at line 79 of file afxres.h.

#define AFX_ID_PREVIEW_CLOSE 0xE300

RC_INVOKED.

Definition at line 184 of file afxres.h.

#define AFX_ID_PREVIEW_NEXT 0xE302

Definition at line 186 of file afxres.h.

#define AFX_ID_PREVIEW_NUMPAGE 0xE301

Definition at line 185 of file afxres.h.

#define AFX_ID_PREVIEW_PREV 0xE303

Definition at line 187 of file afxres.h.

#define AFX_ID_PREVIEW_PRINT 0xE304

Definition at line 188 of file afxres.h.

#define AFX_ID_PREVIEW_ZOOMIN 0xE305

Definition at line 189 of file afxres.h.

#define AFX_ID_PREVIEW_ZOOMOUT 0xE306

Definition at line 190 of file afxres.h.

#define AFX_IDC_CHANGE 101

Definition at line 347 of file afxres.h.

#define AFX_IDC_CONTEXTHELP 30977

Definition at line 391 of file afxres.h.

#define AFX_IDC_HSPLITBAR 30980

Definition at line 394 of file afxres.h.

#define AFX_IDC_LISTBOX 100

Definition at line 346 of file afxres.h.

#define AFX_IDC_MAGNIFY 30978

Definition at line 392 of file afxres.h.

#define AFX_IDC_MOVE4WAY 30988

Definition at line 402 of file afxres.h.

#define AFX_IDC_NODROPCRSR 30982

Definition at line 396 of file afxres.h.

#define AFX_IDC_PRINT_DOCNAME 201

Definition at line 350 of file afxres.h.

#define AFX_IDC_PRINT_PAGENUM 204

Definition at line 353 of file afxres.h.

#define AFX_IDC_PRINT_PORTNAME 203

Definition at line 352 of file afxres.h.

#define AFX_IDC_PRINT_PRINTERNAME 202

Definition at line 351 of file afxres.h.

#define AFX_IDC_SMALLARROWS 30979

Definition at line 393 of file afxres.h.

#define AFX_IDC_TRACK4WAY 30987

Definition at line 401 of file afxres.h.

#define AFX_IDC_TRACKNESW 30984

Definition at line 398 of file afxres.h.

#define AFX_IDC_TRACKNS 30985

Definition at line 399 of file afxres.h.

#define AFX_IDC_TRACKNWSE 30983

Definition at line 397 of file afxres.h.

#define AFX_IDC_TRACKWE 30986

Definition at line 400 of file afxres.h.

#define AFX_IDC_VSPLITBAR 30981

Definition at line 395 of file afxres.h.

#define AFX_IDD_BUSY 30730

Definition at line 387 of file afxres.h.

#define AFX_IDD_CHANGEICON 30725

Definition at line 382 of file afxres.h.

#define AFX_IDD_COLOR 28679

Definition at line 368 of file afxres.h.

#define AFX_IDD_CONVERT 30726

Definition at line 383 of file afxres.h.

#define AFX_IDD_EDITLINKS 30728

Definition at line 385 of file afxres.h.

#define AFX_IDD_FILEBROWSE 30729

Definition at line 386 of file afxres.h.

#define AFX_IDD_FILEOPEN 28676

Definition at line 365 of file afxres.h.

#define AFX_IDD_FILESAVE 28677

Definition at line 366 of file afxres.h.

#define AFX_IDD_FIND 28682

Definition at line 371 of file afxres.h.

#define AFX_IDD_FONT 28678

Definition at line 367 of file afxres.h.

#define AFX_IDD_INSERTOBJECT 30724

Definition at line 381 of file afxres.h.

#define AFX_IDD_NEWTYPEDLG 30721

RC_INVOKED.

Definition at line 376 of file afxres.h.

#define AFX_IDD_PASTESPECIAL 30727

Definition at line 384 of file afxres.h.

#define AFX_IDD_PREVIEW_TOOLBAR 30723

Definition at line 378 of file afxres.h.

#define AFX_IDD_PRINT 28680

Definition at line 369 of file afxres.h.

#define AFX_IDD_PRINTDLG 30722

Definition at line 377 of file afxres.h.

#define AFX_IDD_PRINTSETUP 28681

Definition at line 370 of file afxres.h.

#define AFX_IDD_REPLACE 28683

Definition at line 372 of file afxres.h.

#define AFX_IDI_STD_FRAME 2

Definition at line 360 of file afxres.h.

#define AFX_IDI_STD_MDIFRAME 1

Definition at line 359 of file afxres.h.

#define AFX_IDM_FIRST_MDICHILD 0xFF00

Definition at line 156 of file afxres.h.

#define AFX_IDM_WINDOW_FIRST 0xE130

Definition at line 154 of file afxres.h.

#define AFX_IDM_WINDOW_LAST 0xE13F

Definition at line 155 of file afxres.h.

#define AFX_IDP_ASK_TO_DISCARD 0xF18E

Definition at line 312 of file afxres.h.

#define AFX_IDP_ASK_TO_SAVE 0xF103

Definition at line 271 of file afxres.h.

#define AFX_IDP_ASK_TO_UPDATE 0xF187

Definition at line 305 of file afxres.h.

#define AFX_IDP_BAD_VERB 0xF183

Definition at line 302 of file afxres.h.

#define AFX_IDP_COMMAND_FAILURE 0xF109

Definition at line 277 of file afxres.h.

#define AFX_IDP_FAILED_ACCESS_READ 0xF123

Definition at line 293 of file afxres.h.

#define AFX_IDP_FAILED_ACCESS_WRITE 0xF124

Definition at line 294 of file afxres.h.

#define AFX_IDP_FAILED_DISK_FULL 0xF122

Definition at line 292 of file afxres.h.

#define AFX_IDP_FAILED_INVALID_FORMAT 0xF120

Definition at line 290 of file afxres.h.

#define AFX_IDP_FAILED_INVALID_PATH 0xF121

Definition at line 291 of file afxres.h.

#define AFX_IDP_FAILED_IO_ERROR_READ 0xF125

Definition at line 295 of file afxres.h.

#define AFX_IDP_FAILED_IO_ERROR_WRITE 0xF126

Definition at line 296 of file afxres.h.

#define AFX_IDP_FAILED_MEMORY_ALLOC 0xF10A

Definition at line 278 of file afxres.h.

#define AFX_IDP_FAILED_TO_AUTO_REGISTER 0xF18A

Definition at line 308 of file afxres.h.

#define AFX_IDP_FAILED_TO_CONNECT 0xF181

Definition at line 300 of file afxres.h.

#define AFX_IDP_FAILED_TO_CONVERT 0xF18B

Definition at line 309 of file afxres.h.

#define AFX_IDP_FAILED_TO_CREATE_DOC 0xF104

Definition at line 272 of file afxres.h.

#define AFX_IDP_FAILED_TO_LAUNCH 0xF186

Definition at line 304 of file afxres.h.

#define AFX_IDP_FAILED_TO_LAUNCH_HELP 0xF107

Definition at line 275 of file afxres.h.

#define AFX_IDP_FAILED_TO_NOTIFY 0xF185

Definition at line 303 of file afxres.h.

#define AFX_IDP_FAILED_TO_OPEN_DOC 0xF101

Definition at line 269 of file afxres.h.

#define AFX_IDP_FAILED_TO_REGISTER 0xF189

Definition at line 307 of file afxres.h.

#define AFX_IDP_FAILED_TO_SAVE_DOC 0xF102

Definition at line 270 of file afxres.h.

#define AFX_IDP_FAILED_TO_START_PRINT 0xF106

Definition at line 274 of file afxres.h.

#define AFX_IDP_FAILED_TO_UPDATE 0xF188

Definition at line 306 of file afxres.h.

#define AFX_IDP_FILE_TOO_LARGE 0xF105

Definition at line 273 of file afxres.h.

#define AFX_IDP_GET_NOT_SUPPORTED 0xF18C

Definition at line 310 of file afxres.h.

#define AFX_IDP_INTERNAL_FAILURE 0xF108

Definition at line 276 of file afxres.h.

#define AFX_IDP_INVALID_FILENAME 0xF100

Definition at line 268 of file afxres.h.

#define AFX_IDP_PARSE_INT 0xF110

Definition at line 282 of file afxres.h.

#define AFX_IDP_PARSE_INT_RANGE 0xF112

Definition at line 284 of file afxres.h.

#define AFX_IDP_PARSE_RADIO_BUTTON 0xF115

Definition at line 287 of file afxres.h.

#define AFX_IDP_PARSE_REAL 0xF111

Definition at line 283 of file afxres.h.

#define AFX_IDP_PARSE_REAL_RANGE 0xF113

Definition at line 285 of file afxres.h.

#define AFX_IDP_PARSE_STRING_SIZE 0xF114

Definition at line 286 of file afxres.h.

#define AFX_IDP_SERVER_BUSY 0xF182

Definition at line 301 of file afxres.h.

#define AFX_IDP_SET_NOT_SUPPORTED 0xF18D

Definition at line 311 of file afxres.h.

#define AFX_IDP_SQL_API_CONFORMANCE 0xF28E

Definition at line 333 of file afxres.h.

#define AFX_IDP_SQL_CONNECT_FAIL 0xF281

RC_INVOKED.

Definition at line 320 of file afxres.h.

#define AFX_IDP_SQL_DATA_TRUNCATED 0xF295

Definition at line 340 of file afxres.h.

#define AFX_IDP_SQL_DYNASET_NOT_SUPPORTED 0xF28C

Definition at line 331 of file afxres.h.

#define AFX_IDP_SQL_EMPTY_COLUMN_LIST 0xF283

Definition at line 322 of file afxres.h.

#define AFX_IDP_SQL_FIELD_SCHEMA_MISMATCH 0xF284

Definition at line 323 of file afxres.h.

#define AFX_IDP_SQL_FIRST 0xF280

Definition at line 318 of file afxres.h.

#define AFX_IDP_SQL_ILLEGAL_MODE 0xF285

Definition at line 324 of file afxres.h.

#define AFX_IDP_SQL_LOCK_MODE_NOT_SUPPORTED 0xF294

Definition at line 339 of file afxres.h.

#define AFX_IDP_SQL_MULTIPLE_ROWS_AFFECTED 0xF286

Definition at line 325 of file afxres.h.

#define AFX_IDP_SQL_NO_CURRENT_RECORD 0xF287

Definition at line 326 of file afxres.h.

#define AFX_IDP_SQL_NO_DATA_FOUND 0xF290

Definition at line 335 of file afxres.h.

#define AFX_IDP_SQL_NO_POSITIONED_UPDATES 0xF293

Definition at line 338 of file afxres.h.

#define AFX_IDP_SQL_NO_ROWS_AFFECTED 0xF288

Definition at line 327 of file afxres.h.

#define AFX_IDP_SQL_ODBC_LOAD_FAILED 0xF28B

Definition at line 330 of file afxres.h.

#define AFX_IDP_SQL_ODBC_V2_REQUIRED 0xF292

Definition at line 337 of file afxres.h.

#define AFX_IDP_SQL_RECORDSET_FORWARD_ONLY 0xF282

Definition at line 321 of file afxres.h.

#define AFX_IDP_SQL_RECORDSET_READONLY 0xF289

Definition at line 328 of file afxres.h.

#define AFX_IDP_SQL_ROW_UPDATE_NOT_SUPPORTED 0xF291

Definition at line 336 of file afxres.h.

#define AFX_IDP_SQL_SNAPSHOT_NOT_SUPPORTED 0xF28D

Definition at line 332 of file afxres.h.

#define AFX_IDP_SQL_SQL_CONFORMANCE 0xF28F

Definition at line 334 of file afxres.h.

#define AFX_IDP_SQL_SQL_NO_TOTAL 0xF28A

Definition at line 329 of file afxres.h.

#define AFX_IDP_STATIC_OBJECT 0xF180

Definition at line 299 of file afxres.h.

#define AFX_IDP_VB2APICALLED 0xF10B

Definition at line 279 of file afxres.h.

#define AFX_IDS_ACTIVATE_VERB 0xF082

Definition at line 247 of file afxres.h.

#define AFX_IDS_ALL_FILES 0xF087

Definition at line 252 of file afxres.h.

#define AFX_IDS_ALLFILTER 0xF002

Definition at line 232 of file afxres.h.

#define AFX_IDS_APP_TITLE 0xE000

Definition at line 100 of file afxres.h.

#define AFX_IDS_APP_TITLE_EMBEDDING 0xE004

Definition at line 108 of file afxres.h.

#define AFX_IDS_APP_TITLE_INPLACE 0xE003

Definition at line 106 of file afxres.h.

#define AFX_IDS_AUTO 0xF084

Definition at line 249 of file afxres.h.

#define AFX_IDS_BITMAP_FORMAT 0xF090

Definition at line 263 of file afxres.h.

#define AFX_IDS_CHANGE_LINK 0xF083

Definition at line 248 of file afxres.h.

#define AFX_IDS_DESKACCESSORY 0xEFDA

Definition at line 227 of file afxres.h.

#define AFX_IDS_DIB_FORMAT 0xF08F

Definition at line 262 of file afxres.h.

#define AFX_IDS_EDIT_VERB 0xF081

Definition at line 246 of file afxres.h.

#define AFX_IDS_EMBED_FORMAT 0xF092

Definition at line 265 of file afxres.h.

#define AFX_IDS_EXIT_MENU 0xF08C

Definition at line 258 of file afxres.h.

#define AFX_IDS_FROZEN 0xF086

Definition at line 251 of file afxres.h.

#define AFX_IDS_HELPMODEMESSAGE 0xE002

Definition at line 104 of file afxres.h.

#define AFX_IDS_IDLEMESSAGE 0xE001

Definition at line 102 of file afxres.h.

#define AFX_IDS_LINKSOURCE_FORMAT 0xF091

Definition at line 264 of file afxres.h.

#define AFX_IDS_MANUAL 0xF085

Definition at line 250 of file afxres.h.

#define AFX_IDS_MDICHILD 0xEF1F

Definition at line 225 of file afxres.h.

#define AFX_IDS_METAFILE_FORMAT 0xF08E

Definition at line 261 of file afxres.h.

#define AFX_IDS_OBJECT_MENUITEM 0xF080

Definition at line 245 of file afxres.h.

#define AFX_IDS_ONEPAGE 0xF041

Definition at line 239 of file afxres.h.

#define AFX_IDS_OPENFILE 0xF000

Definition at line 230 of file afxres.h.

#define AFX_IDS_PREVIEW_CLOSE 0xF005

Definition at line 235 of file afxres.h.

#define AFX_IDS_PREVIEWPAGEDESC 0xF044

Definition at line 242 of file afxres.h.

#define AFX_IDS_PRINTONPORT 0xF040

Definition at line 238 of file afxres.h.

#define AFX_IDS_PRINTPAGENUM 0xF043

Definition at line 241 of file afxres.h.

#define AFX_IDS_SAVE_AS_MENU 0xF08A

Definition at line 256 of file afxres.h.

#define AFX_IDS_SAVE_COPY_AS_MENU 0xF08B

Definition at line 257 of file afxres.h.

#define AFX_IDS_SAVE_MENU 0xF088

Definition at line 254 of file afxres.h.

#define AFX_IDS_SAVEFILE 0xF001

Definition at line 231 of file afxres.h.

#define AFX_IDS_SAVEFILECOPY 0xF004

Definition at line 234 of file afxres.h.

#define AFX_IDS_SCCLOSE 0xEF06

Definition at line 221 of file afxres.h.

#define AFX_IDS_SCFIRST 0xEF00

Definition at line 212 of file afxres.h.

#define AFX_IDS_SCMAXIMIZE 0xEF03

Definition at line 218 of file afxres.h.

#define AFX_IDS_SCMINIMIZE 0xEF02

Definition at line 217 of file afxres.h.

#define AFX_IDS_SCMOVE 0xEF01

Definition at line 216 of file afxres.h.

#define AFX_IDS_SCNEXTWINDOW 0xEF04

Definition at line 219 of file afxres.h.

#define AFX_IDS_SCPREVWINDOW 0xEF05

Definition at line 220 of file afxres.h.

#define AFX_IDS_SCRESTORE 0xEF12

Definition at line 222 of file afxres.h.

#define AFX_IDS_SCSIZE 0xEF00

RC_INVOKED.

Definition at line 215 of file afxres.h.

#define AFX_IDS_SCTASKLIST 0xEF13

Definition at line 223 of file afxres.h.

#define AFX_IDS_TWOPAGE 0xF042

Definition at line 240 of file afxres.h.

#define AFX_IDS_UNTITLED 0xF003

Definition at line 233 of file afxres.h.

#define AFX_IDS_UPDATE_MENU 0xF089

Definition at line 255 of file afxres.h.

#define AFX_IDS_UPDATING_ITEMS 0xF08D

Definition at line 259 of file afxres.h.

#define AFX_IDW_CONTROLBAR_FIRST 0xE800

Definition at line 70 of file afxres.h.

#define AFX_IDW_CONTROLBAR_LAST 0xE8FF

Definition at line 71 of file afxres.h.

#define AFX_IDW_HSCROLL_FIRST 0xEA00

Definition at line 84 of file afxres.h.

#define AFX_IDW_PANE_FIRST 0xE900

Definition at line 82 of file afxres.h.

#define AFX_IDW_PANE_LAST 0xE9ff

Definition at line 83 of file afxres.h.

#define AFX_IDW_PANE_SAVE 0xEA21

Definition at line 88 of file afxres.h.

#define AFX_IDW_PREVIEW_BAR 0xE802

Definition at line 75 of file afxres.h.

#define AFX_IDW_RESIZE_BAR 0xE803

Definition at line 76 of file afxres.h.

#define AFX_IDW_SIZE_BOX 0xEA20

Definition at line 87 of file afxres.h.

#define AFX_IDW_STATUS_BAR 0xE801

Definition at line 74 of file afxres.h.

#define AFX_IDW_TOOLBAR 0xE800

Definition at line 73 of file afxres.h.

#define AFX_IDW_VSCROLL_FIRST 0xEA10

Definition at line 85 of file afxres.h.

#define AFX_WS_DEFAULT_VIEW (WS_CHILD | WS_VISIBLE | WS_BORDER)

RC_INVOKED.

Definition at line 93 of file afxres.h.

#define CBRS_BOTTOM 0x00008200L

Definition at line 52 of file afxres.h.

#define CBRS_LEFT 0x00001400L

Definition at line 49 of file afxres.h.

#define CBRS_NOALIGN 0x00000000L

Definition at line 48 of file afxres.h.

#define CBRS_RIGHT 0x00004100L

Definition at line 51 of file afxres.h.

#define CBRS_TOP 0x00002800L

Definition at line 50 of file afxres.h.

#define ID_APP_ABOUT 0xE140

RC_INVOKED.

Definition at line 160 of file afxres.h.

#define ID_APP_EXIT 0xE141

Definition at line 161 of file afxres.h.

#define ID_CONTEXT_HELP 0xE144

Definition at line 164 of file afxres.h.

#define ID_DEFAULT_HELP 0xE146

Definition at line 167 of file afxres.h.

#define ID_EDIT_CLEAR 0xE120

Definition at line 132 of file afxres.h.

#define ID_EDIT_CLEAR_ALL 0xE121

Definition at line 133 of file afxres.h.

#define ID_EDIT_COPY 0xE122

Definition at line 134 of file afxres.h.

#define ID_EDIT_CUT 0xE123

Definition at line 135 of file afxres.h.

#define ID_EDIT_FIND 0xE124

Definition at line 136 of file afxres.h.

#define ID_EDIT_PASTE 0xE125

Definition at line 137 of file afxres.h.

#define ID_EDIT_PASTE_LINK 0xE126

Definition at line 138 of file afxres.h.

#define ID_EDIT_PASTE_SPECIAL 0xE127

Definition at line 139 of file afxres.h.

#define ID_EDIT_REDO 0xE12C

Definition at line 144 of file afxres.h.

#define ID_EDIT_REPEAT 0xE128

Definition at line 140 of file afxres.h.

#define ID_EDIT_REPLACE 0xE129

Definition at line 141 of file afxres.h.

#define ID_EDIT_SELECT_ALL 0xE12A

Definition at line 142 of file afxres.h.

#define ID_EDIT_UNDO 0xE12B

Definition at line 143 of file afxres.h.

#define ID_FILE_CLOSE 0xE102

Definition at line 116 of file afxres.h.

#define ID_FILE_MRU_FILE1 0xE110

Definition at line 126 of file afxres.h.

#define ID_FILE_MRU_FILE2 0xE111

Definition at line 127 of file afxres.h.

#define ID_FILE_MRU_FILE3 0xE112

Definition at line 128 of file afxres.h.

#define ID_FILE_MRU_FILE4 0xE113

Definition at line 129 of file afxres.h.

#define ID_FILE_NEW 0xE100

Definition at line 114 of file afxres.h.

#define ID_FILE_OPEN 0xE101

Definition at line 115 of file afxres.h.

#define ID_FILE_PAGE_SETUP 0xE105

Definition at line 119 of file afxres.h.

#define ID_FILE_PRINT 0xE107

Definition at line 121 of file afxres.h.

#define ID_FILE_PRINT_PREVIEW 0xE108

Definition at line 122 of file afxres.h.

#define ID_FILE_PRINT_SETUP 0xE106

Definition at line 120 of file afxres.h.

#define ID_FILE_SAVE 0xE103

Definition at line 117 of file afxres.h.

#define ID_FILE_SAVE_AS 0xE104

Definition at line 118 of file afxres.h.

#define ID_FILE_SAVE_COPY_AS 0xE10A

Definition at line 124 of file afxres.h.

#define ID_FILE_UPDATE 0xE109

Definition at line 123 of file afxres.h.

#define ID_HELP 0xE145

Definition at line 166 of file afxres.h.

#define ID_HELP_INDEX 0xE142

Definition at line 162 of file afxres.h.

#define ID_HELP_USING 0xE143

Definition at line 163 of file afxres.h.

#define ID_INDICATOR_CAPS 0xE701

Definition at line 59 of file afxres.h.

#define ID_INDICATOR_EXT 0xE700

Definition at line 58 of file afxres.h.

#define ID_INDICATOR_NUM 0xE702

Definition at line 60 of file afxres.h.

#define ID_INDICATOR_OVR 0xE704

Definition at line 62 of file afxres.h.

#define ID_INDICATOR_REC 0xE705

Definition at line 63 of file afxres.h.

#define ID_INDICATOR_SCRL 0xE703

Definition at line 61 of file afxres.h.

#define ID_NEXT_PANE 0xE150

Definition at line 170 of file afxres.h.

#define ID_OLE_EDIT_CHANGE_ICON 0xE203

Definition at line 177 of file afxres.h.

#define ID_OLE_EDIT_CONVERT 0xE202

Definition at line 176 of file afxres.h.

#define ID_OLE_EDIT_LINKS 0xE201

Definition at line 175 of file afxres.h.

#define ID_OLE_INSERT_NEW 0xE200

Definition at line 174 of file afxres.h.

#define ID_OLE_VERB_FIRST 0xE210

Definition at line 178 of file afxres.h.

#define ID_OLE_VERB_LAST 0xE21F

Definition at line 180 of file afxres.h.

#define ID_PREV_PANE 0xE151

Definition at line 171 of file afxres.h.

#define ID_RECORD_FIRST 0xE900

Definition at line 198 of file afxres.h.

#define ID_RECORD_LAST 0xE901

Definition at line 199 of file afxres.h.

#define ID_RECORD_NEXT 0xE902

Definition at line 200 of file afxres.h.

#define ID_RECORD_PREV 0xE903

Definition at line 201 of file afxres.h.

#define ID_SEPARATOR 0

Definition at line 65 of file afxres.h.

#define ID_VIEW_STATUS_BAR 0xE801

Definition at line 194 of file afxres.h.

#define ID_VIEW_TOOLBAR 0xE800

Definition at line 193 of file afxres.h.

#define ID_WINDOW_ARRANGE 0xE131

Definition at line 148 of file afxres.h.

#define ID_WINDOW_CASCADE 0xE132

Definition at line 149 of file afxres.h.

#define ID_WINDOW_NEW 0xE130

Definition at line 147 of file afxres.h.

#define ID_WINDOW_SPLIT 0xE135

Definition at line 152 of file afxres.h.

#define ID_WINDOW_TILE_HORZ 0xE133

Definition at line 150 of file afxres.h.

#define ID_WINDOW_TILE_VERT 0xE134

Definition at line 151 of file afxres.h.

#define IDC_STATIC -1

Definition at line 206 of file afxres.h.

#define RT_DLGINIT MAKEINTRESOURCE(240)

Definition at line 33 of file afxres.h.

#define WM_VBXINIT (WM_USER+0)

Definition at line 36 of file afxres.h.

Generated on Wed Nov 13 2024 16:53:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/DsBrowse/bitmaps/resource.h File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • DsBrowse
  • bitmaps
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | Computer 101
#define | Country 111
#define | Domain 103
#define | Dummy 114
#define | FileShare 109
#define | Group 106
#define | ICON 116
#define | IDI_ICON1 117
#define | Namespace 113
#define | Namespaces 115
#define | Ndsou 108
#define | Organization 110
#define | PrintQueue 107
#define | Service 105
#define | Syntax 104
#define | Top 112
#define | User 102

Define Documentation

#define Computer 101

Definition at line 5 of file resource.h.

#define Country 111

Definition at line 15 of file resource.h.

#define Domain 103

Definition at line 7 of file resource.h.

#define Dummy 114

Definition at line 18 of file resource.h.

#define FileShare 109

Definition at line 13 of file resource.h.

#define Group 106

Definition at line 10 of file resource.h.

#define ICON 116

Definition at line 20 of file resource.h.

#define IDI_ICON1 117

Definition at line 21 of file resource.h.

#define Namespace 113

Definition at line 17 of file resource.h.

#define Namespaces 115

Definition at line 19 of file resource.h.

#define Ndsou 108

Definition at line 12 of file resource.h.

#define Organization 110

Definition at line 14 of file resource.h.

#define PrintQueue 107

Definition at line 11 of file resource.h.

#define Service 105

Definition at line 9 of file resource.h.

void Syntax 104

Definition at line 8 of file resource.h.

#define Top 112

Definition at line 16 of file resource.h.

#define User 102

Definition at line 6 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/DsBrowse/bitmaps/winres.h File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • DsBrowse
  • bitmaps
Defines

winres.h File Reference

Go to the source code of this file.

Defines

#define | BS_3STATE 0x00000005L
#define | BS_AUTO3STATE 0x00000006L
#define | BS_AUTOCHECKBOX 0x00000003L
#define | BS_AUTORADIOBUTTON 0x00000009L
#define | BS_CHECKBOX 0x00000002L
#define | BS_DEFPUSHBUTTON 0x00000001L
#define | BS_GROUPBOX 0x00000007L
#define | BS_LEFTTEXT 0x00000020L
#define | BS_OWNERDRAW 0x0000000BL
#define | BS_PUSHBUTTON 0x00000000L
#define | BS_RADIOBUTTON 0x00000004L
#define | BS_USERBUTTON 0x00000008L
#define | CB_ADDSTRING (WM_USER+3)
#define | CBS_AUTOHSCROLL 0x0040L
#define | CBS_DISABLENOSCROLL 0x0800L
#define | CBS_DROPDOWN 0x0002L
#define | CBS_DROPDOWNLIST 0x0003L
#define | CBS_HASSTRINGS 0x0200L
#define | CBS_NOINTEGRALHEIGHT 0x0400L
#define | CBS_OEMCONVERT 0x0080L
#define | CBS_OWNERDRAWFIXED 0x0010L
#define | CBS_OWNERDRAWVARIABLE 0x0020L
#define | CBS_SIMPLE 0x0001L
#define | CBS_SORT 0x0100L
#define | DS_ABSALIGN 0x01L
#define | DS_LOCALEDIT 0x20L
#define | DS_MODALFRAME 0x80L
#define | DS_NOIDLEMSG 0x100L
#define | DS_SETFONT 0x40L
#define | DS_SYSMODAL 0x02L
#define | ES_AUTOHSCROLL 0x00000080L
#define | ES_AUTOVSCROLL 0x00000040L
#define | ES_CENTER 0x00000001L
#define | ES_LEFT 0x00000000L
#define | ES_LOWERCASE 0x00000010L
#define | ES_MULTILINE 0x00000004L
#define | ES_NOHIDESEL 0x00000100L
#define | ES_OEMCONVERT 0x00000400L
#define | ES_PASSWORD 0x00000020L
#define | ES_READONLY 0x00000800L
#define | ES_RIGHT 0x00000002L
#define | ES_UPPERCASE 0x00000008L
#define | ES_WANTRETURN 0x00001000L
#define | IDABORT 3
#define | IDCANCEL 2
#define | IDIGNORE 5
#define | IDNO 7
#define | IDOK 1
#define | IDRETRY 4
#define | IDYES 6
#define | LB_ADDSTRING (WM_USER+1)
#define | LBS_DISABLENOSCROLL 0x1000L
#define | LBS_EXTENDEDSEL 0x0800L
#define | LBS_HASSTRINGS 0x0040L
#define | LBS_MULTICOLUMN 0x0200L
#define | LBS_MULTIPLESEL 0x0008L
#define | LBS_NOINTEGRALHEIGHT 0x0100L
#define | LBS_NOREDRAW 0x0004L
#define | LBS_NOTIFY 0x0001L
#define | LBS_OWNERDRAWFIXED 0x0010L
#define | LBS_OWNERDRAWVARIABLE 0x0020L
#define | LBS_SORT 0x0002L
#define | LBS_STANDARD (LBS_NOTIFY | LBS_SORT | WS_VSCROLL | WS_BORDER)
#define | LBS_USETABSTOPS 0x0080L
#define | LBS_WANTKEYBOARDINPUT 0x0400L
#define | OBM_BTNCORNERS 32758
#define | OBM_BTSIZE 32761
#define | OBM_CHECK 32760
#define | OBM_CHECKBOXES 32759
#define | OBM_CLOSE 32754
#define | OBM_COMBO 32738
#define | OBM_DNARROW 32752
#define | OBM_DNARROWD 32742
#define | OBM_DNARROWI 32736
#define | OBM_LFARROW 32750
#define | OBM_LFARROWD 32740
#define | OBM_LFARROWI 32734
#define | OBM_MNARROW 32739
#define | OBM_OLD_CLOSE 32767
#define | OBM_OLD_DNARROW 32764
#define | OBM_OLD_LFARROW 32762
#define | OBM_OLD_REDUCE 32757
#define | OBM_OLD_RESTORE 32755
#define | OBM_OLD_RGARROW 32763
#define | OBM_OLD_UPARROW 32765
#define | OBM_OLD_ZOOM 32756
#define | OBM_REDUCE 32749
#define | OBM_REDUCED 32746
#define | OBM_RESTORE 32747
#define | OBM_RESTORED 32744
#define | OBM_RGARROW 32751
#define | OBM_RGARROWD 32741
#define | OBM_RGARROWI 32735
#define | OBM_SIZE 32766
#define | OBM_UPARROW 32753
#define | OBM_UPARROWD 32743
#define | OBM_UPARROWI 32737
#define | OBM_ZOOM 32748
#define | OBM_ZOOMD 32745
#define | OCR_CROSS 32515
#define | OCR_IBEAM 32513
#define | OCR_ICOCUR 32647
#define | OCR_ICON 32641
#define | OCR_NORMAL 32512
#define | OCR_SIZE 32640
#define | OCR_SIZEALL 32646
#define | OCR_SIZENESW 32643
#define | OCR_SIZENS 32645
#define | OCR_SIZENWSE 32642
#define | OCR_SIZEWE 32644
#define | OCR_UP 32516
#define | OCR_WAIT 32514
#define | OIC_BANG 32515
#define | OIC_HAND 32513
#define | OIC_NOTE 32516
#define | OIC_QUES 32514
#define | OIC_SAMPLE 32512
#define | SBS_BOTTOMALIGN 0x0004L
#define | SBS_HORZ 0x0000L
#define | SBS_LEFTALIGN 0x0002L
#define | SBS_RIGHTALIGN 0x0004L
#define | SBS_SIZEBOX 0x0008L
#define | SBS_SIZEBOXBOTTOMRIGHTALIGN 0x0004L
#define | SBS_SIZEBOXTOPLEFTALIGN 0x0002L
#define | SBS_TOPALIGN 0x0002L
#define | SBS_VERT 0x0001L
#define | SC_ARRANGE 0xF110
#define | SC_CLOSE 0xF060
#define | SC_HOTKEY 0xF150
#define | SC_HSCROLL 0xF080
#define | SC_KEYMENU 0xF100
#define | SC_MAXIMIZE 0xF030
#define | SC_MINIMIZE 0xF020
#define | SC_MOUSEMENU 0xF090
#define | SC_MOVE 0xF010
#define | SC_NEXTWINDOW 0xF040
#define | SC_PREVWINDOW 0xF050
#define | SC_RESTORE 0xF120
#define | SC_SCREENSAVE 0xF140
#define | SC_SIZE 0xF000
#define | SC_TASKLIST 0xF130
#define | SC_VSCROLL 0xF070
#define | SS_BLACKFRAME 0x00000007L
#define | SS_BLACKRECT 0x00000004L
#define | SS_CENTER 0x00000001L
#define | SS_GRAYFRAME 0x00000008L
#define | SS_GRAYRECT 0x00000005L
#define | SS_ICON 0x00000003L
#define | SS_LEFT 0x00000000L
#define | SS_LEFTNOWORDWRAP 0x0000000CL
#define | SS_NOPREFIX 0x00000080L
#define | SS_RIGHT 0x00000002L
#define | SS_SIMPLE 0x0000000BL
#define | SS_WHITEFRAME 0x00000009L
#define | SS_WHITERECT 0x00000006L
#define | VK_ADD 0x6B
#define | VK_BACK 0x08
#define | VK_CANCEL 0x03
#define | VK_CAPITAL 0x14
#define | VK_CLEAR 0x0C
#define | VK_CONTROL 0x11
#define | VK_DECIMAL 0x6E
#define | VK_DELETE 0x2E
#define | VK_DIVIDE 0x6F
#define | VK_DOWN 0x28
#define | VK_END 0x23
#define | VK_ESCAPE 0x1B
#define | VK_EXECUTE 0x2B
#define | VK_F1 0x70
#define | VK_F10 0x79
#define | VK_F11 0x7A
#define | VK_F12 0x7B
#define | VK_F13 0x7C
#define | VK_F14 0x7D
#define | VK_F15 0x7E
#define | VK_F16 0x7F
#define | VK_F17 0x80
#define | VK_F18 0x81
#define | VK_F19 0x82
#define | VK_F2 0x71
#define | VK_F20 0x83
#define | VK_F21 0x84
#define | VK_F22 0x85
#define | VK_F23 0x86
#define | VK_F24 0x87
#define | VK_F3 0x72
#define | VK_F4 0x73
#define | VK_F5 0x74
#define | VK_F6 0x75
#define | VK_F7 0x76
#define | VK_F8 0x77
#define | VK_F9 0x78
#define | VK_HELP 0x2F
#define | VK_HOME 0x24
#define | VK_INSERT 0x2D
#define | VK_LBUTTON 0x01
#define | VK_LEFT 0x25
#define | VK_MBUTTON 0x04
#define | VK_MENU 0x12
#define | VK_MULTIPLY 0x6A
#define | VK_NEXT 0x22
#define | VK_NUMLOCK 0x90
#define | VK_NUMPAD0 0x60
#define | VK_NUMPAD1 0x61
#define | VK_NUMPAD2 0x62
#define | VK_NUMPAD3 0x63
#define | VK_NUMPAD4 0x64
#define | VK_NUMPAD5 0x65
#define | VK_NUMPAD6 0x66
#define | VK_NUMPAD7 0x67
#define | VK_NUMPAD8 0x68
#define | VK_NUMPAD9 0x69
#define | VK_PAUSE 0x13
#define | VK_PRINT 0x2A
#define | VK_PRIOR 0x21
#define | VK_RBUTTON 0x02
#define | VK_RETURN 0x0D
#define | VK_RIGHT 0x27
#define | VK_SCROLL 0x91
#define | VK_SELECT 0x29
#define | VK_SEPARATOR 0x6C
#define | VK_SHIFT 0x10
#define | VK_SNAPSHOT 0x2C
#define | VK_SPACE 0x20
#define | VK_SUBTRACT 0x6D
#define | VK_TAB 0x09
#define | VK_UP 0x26
#define | WM_USER 0x0400
#define | WS_BORDER 0x00800000L
#define | WS_CAPTION 0x00C00000L
#define | WS_CHILD 0x40000000L
#define | WS_CHILDWINDOW (WS_CHILD)
#define | WS_CLIPCHILDREN 0x02000000L
#define | WS_CLIPSIBLINGS 0x04000000L
#define | WS_DISABLED 0x08000000L
#define | WS_DLGFRAME 0x00400000L
#define | WS_GROUP 0x00020000L
#define | WS_HSCROLL 0x00100000L
#define | WS_ICONIC WS_MINIMIZE
#define | WS_MAXIMIZE 0x01000000L
#define | WS_MAXIMIZEBOX 0x00010000L
#define | WS_MINIMIZE 0x20000000L
#define | WS_MINIMIZEBOX 0x00020000L
#define | WS_OVERLAPPED 0x00000000L
#define | WS_OVERLAPPEDWINDOW (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX)
#define | WS_POPUP 0x80000000L
#define | WS_POPUPWINDOW (WS_POPUP | WS_BORDER | WS_SYSMENU)
#define | WS_SIZEBOX WS_THICKFRAME
#define | WS_SYSMENU 0x00080000L
#define | WS_TABSTOP 0x00010000L
#define | WS_THICKFRAME 0x00040000L
#define | WS_TILED WS_OVERLAPPED
#define | WS_TILEDWINDOW WS_OVERLAPPEDWINDOW
#define | WS_VISIBLE 0x10000000L
#define | WS_VSCROLL 0x00200000L

Define Documentation

#define BS_3STATE 0x00000005L

Definition at line 220 of file winres.h.

#define BS_AUTO3STATE 0x00000006L

Definition at line 221 of file winres.h.

#define BS_AUTOCHECKBOX 0x00000003L

Definition at line 218 of file winres.h.

#define BS_AUTORADIOBUTTON 0x00000009L

Definition at line 224 of file winres.h.

#define BS_CHECKBOX 0x00000002L

Definition at line 217 of file winres.h.

#define BS_DEFPUSHBUTTON 0x00000001L

Definition at line 216 of file winres.h.

#define BS_GROUPBOX 0x00000007L

Definition at line 222 of file winres.h.

#define BS_LEFTTEXT 0x00000020L

Definition at line 226 of file winres.h.

#define BS_OWNERDRAW 0x0000000BL

Definition at line 225 of file winres.h.

#define BS_PUSHBUTTON 0x00000000L

Definition at line 215 of file winres.h.

#define BS_RADIOBUTTON 0x00000004L

Definition at line 219 of file winres.h.

#define BS_USERBUTTON 0x00000008L

Definition at line 223 of file winres.h.

#define CB_ADDSTRING (WM_USER+3)

Definition at line 282 of file winres.h.

#define CBS_AUTOHSCROLL 0x0040L

Definition at line 272 of file winres.h.

#define CBS_DISABLENOSCROLL 0x0800L

Definition at line 277 of file winres.h.

#define CBS_DROPDOWN 0x0002L

Definition at line 268 of file winres.h.

#define CBS_DROPDOWNLIST 0x0003L

Definition at line 269 of file winres.h.

#define CBS_HASSTRINGS 0x0200L

Definition at line 275 of file winres.h.

#define CBS_NOINTEGRALHEIGHT 0x0400L

Definition at line 276 of file winres.h.

#define CBS_OEMCONVERT 0x0080L

Definition at line 273 of file winres.h.

#define CBS_OWNERDRAWFIXED 0x0010L

Definition at line 270 of file winres.h.

#define CBS_OWNERDRAWVARIABLE 0x0020L

Definition at line 271 of file winres.h.

#define CBS_SIMPLE 0x0001L

Definition at line 267 of file winres.h.

#define CBS_SORT 0x0100L

Definition at line 274 of file winres.h.

#define DS_ABSALIGN 0x01L

Definition at line 194 of file winres.h.

#define DS_LOCALEDIT 0x20L

Definition at line 196 of file winres.h.

#define DS_MODALFRAME 0x80L

Definition at line 198 of file winres.h.

#define DS_NOIDLEMSG 0x100L

Definition at line 199 of file winres.h.

#define DS_SETFONT 0x40L

Definition at line 197 of file winres.h.

#define DS_SYSMODAL 0x02L

Definition at line 195 of file winres.h.

#define ES_AUTOHSCROLL 0x00000080L

Definition at line 236 of file winres.h.

#define ES_AUTOVSCROLL 0x00000040L

Definition at line 235 of file winres.h.

#define ES_CENTER 0x00000001L

Definition at line 229 of file winres.h.

#define ES_LEFT 0x00000000L

Definition at line 228 of file winres.h.

#define ES_LOWERCASE 0x00000010L

Definition at line 233 of file winres.h.

#define ES_MULTILINE 0x00000004L

Definition at line 231 of file winres.h.

#define ES_NOHIDESEL 0x00000100L

Definition at line 237 of file winres.h.

#define ES_OEMCONVERT 0x00000400L

Definition at line 238 of file winres.h.

#define ES_PASSWORD 0x00000020L

Definition at line 234 of file winres.h.

#define ES_READONLY 0x00000800L

Definition at line 239 of file winres.h.

#define ES_RIGHT 0x00000002L

Definition at line 230 of file winres.h.

#define ES_UPPERCASE 0x00000008L

Definition at line 232 of file winres.h.

#define ES_WANTRETURN 0x00001000L

Definition at line 240 of file winres.h.

#define IDABORT 3

Definition at line 290 of file winres.h.

#define IDCANCEL 2

Definition at line 289 of file winres.h.

#define IDIGNORE 5

Definition at line 292 of file winres.h.

#define IDNO 7

Definition at line 294 of file winres.h.

#define IDOK 1

Definition at line 288 of file winres.h.

#define IDRETRY 4

Definition at line 291 of file winres.h.

#define IDYES 6

Definition at line 293 of file winres.h.

#define LB_ADDSTRING (WM_USER+1)

Definition at line 281 of file winres.h.

#define LBS_DISABLENOSCROLL 0x1000L

Definition at line 264 of file winres.h.

#define LBS_EXTENDEDSEL 0x0800L

Definition at line 263 of file winres.h.

#define LBS_HASSTRINGS 0x0040L

Definition at line 258 of file winres.h.

#define LBS_MULTICOLUMN 0x0200L

Definition at line 261 of file winres.h.

#define LBS_MULTIPLESEL 0x0008L

Definition at line 255 of file winres.h.

#define LBS_NOINTEGRALHEIGHT 0x0100L

Definition at line 260 of file winres.h.

#define LBS_NOREDRAW 0x0004L

Definition at line 254 of file winres.h.

#define LBS_NOTIFY 0x0001L

Definition at line 252 of file winres.h.

#define LBS_OWNERDRAWFIXED 0x0010L

Definition at line 256 of file winres.h.

#define LBS_OWNERDRAWVARIABLE 0x0020L

Definition at line 257 of file winres.h.

#define LBS_SORT 0x0002L

Definition at line 253 of file winres.h.

#define LBS_STANDARD (LBS_NOTIFY | LBS_SORT | WS_VSCROLL | WS_BORDER)

Definition at line 265 of file winres.h.

#define LBS_USETABSTOPS 0x0080L

Definition at line 259 of file winres.h.

#define LBS_WANTKEYBOARDINPUT 0x0400L

Definition at line 262 of file winres.h.

#define OBM_BTNCORNERS 32758

Definition at line 51 of file winres.h.

#define OBM_BTSIZE 32761

Definition at line 48 of file winres.h.

#define OBM_CHECK 32760

Definition at line 49 of file winres.h.

#define OBM_CHECKBOXES 32759

Definition at line 50 of file winres.h.

#define OBM_CLOSE 32754

Definition at line 21 of file winres.h.

#define OBM_COMBO 32738

Definition at line 37 of file winres.h.

#define OBM_DNARROW 32752

Definition at line 23 of file winres.h.

#define OBM_DNARROWD 32742

Definition at line 33 of file winres.h.

#define OBM_DNARROWI 32736

Definition at line 39 of file winres.h.

#define OBM_LFARROW 32750

Definition at line 25 of file winres.h.

#define OBM_LFARROWD 32740

Definition at line 35 of file winres.h.

#define OBM_LFARROWI 32734

Definition at line 41 of file winres.h.

#define OBM_MNARROW 32739

Definition at line 36 of file winres.h.

#define OBM_OLD_CLOSE 32767

Definition at line 42 of file winres.h.

#define OBM_OLD_DNARROW 32764

Definition at line 45 of file winres.h.

#define OBM_OLD_LFARROW 32762

Definition at line 47 of file winres.h.

#define OBM_OLD_REDUCE 32757

Definition at line 52 of file winres.h.

#define OBM_OLD_RESTORE 32755

Definition at line 54 of file winres.h.

#define OBM_OLD_RGARROW 32763

Definition at line 46 of file winres.h.

#define OBM_OLD_UPARROW 32765

Definition at line 44 of file winres.h.

#define OBM_OLD_ZOOM 32756

Definition at line 53 of file winres.h.

#define OBM_REDUCE 32749

Definition at line 26 of file winres.h.

#define OBM_REDUCED 32746

Definition at line 29 of file winres.h.

#define OBM_RESTORE 32747

Definition at line 28 of file winres.h.

#define OBM_RESTORED 32744

Definition at line 31 of file winres.h.

#define OBM_RGARROW 32751

Definition at line 24 of file winres.h.

#define OBM_RGARROWD 32741

Definition at line 34 of file winres.h.

#define OBM_RGARROWI 32735

Definition at line 40 of file winres.h.

#define OBM_SIZE 32766

Definition at line 43 of file winres.h.

#define OBM_UPARROW 32753

Definition at line 22 of file winres.h.

#define OBM_UPARROWD 32743

Definition at line 32 of file winres.h.

#define OBM_UPARROWI 32737

Definition at line 38 of file winres.h.

#define OBM_ZOOM 32748

Definition at line 27 of file winres.h.

#define OBM_ZOOMD 32745

Definition at line 30 of file winres.h.

#define OCR_CROSS 32515

Definition at line 58 of file winres.h.

#define OCR_IBEAM 32513

Definition at line 56 of file winres.h.

#define OCR_ICOCUR 32647

Definition at line 67 of file winres.h.

#define OCR_ICON 32641

Definition at line 61 of file winres.h.

#define OCR_NORMAL 32512

Definition at line 55 of file winres.h.

#define OCR_SIZE 32640

Definition at line 60 of file winres.h.

#define OCR_SIZEALL 32646

Definition at line 66 of file winres.h.

#define OCR_SIZENESW 32643

Definition at line 63 of file winres.h.

#define OCR_SIZENS 32645

Definition at line 65 of file winres.h.

#define OCR_SIZENWSE 32642

Definition at line 62 of file winres.h.

#define OCR_SIZEWE 32644

Definition at line 64 of file winres.h.

#define OCR_UP 32516

Definition at line 59 of file winres.h.

#define OCR_WAIT 32514

Definition at line 57 of file winres.h.

#define OIC_BANG 32515

Definition at line 71 of file winres.h.

#define OIC_HAND 32513

Definition at line 69 of file winres.h.

#define OIC_NOTE 32516

Definition at line 72 of file winres.h.

#define OIC_QUES 32514

Definition at line 70 of file winres.h.

#define OIC_SAMPLE 32512

Definition at line 68 of file winres.h.

#define SBS_BOTTOMALIGN 0x0004L

Definition at line 246 of file winres.h.

#define SBS_HORZ 0x0000L

Definition at line 242 of file winres.h.

#define SBS_LEFTALIGN 0x0002L

Definition at line 245 of file winres.h.

#define SBS_RIGHTALIGN 0x0004L

Definition at line 247 of file winres.h.

#define SBS_SIZEBOX 0x0008L

Definition at line 250 of file winres.h.

#define SBS_SIZEBOXBOTTOMRIGHTALIGN 0x0004L

Definition at line 249 of file winres.h.

#define SBS_SIZEBOXTOPLEFTALIGN 0x0002L

Definition at line 248 of file winres.h.

#define SBS_TOPALIGN 0x0002L

Definition at line 244 of file winres.h.

#define SBS_VERT 0x0001L

Definition at line 243 of file winres.h.

#define SC_ARRANGE 0xF110

Definition at line 188 of file winres.h.

#define SC_CLOSE 0xF060

Definition at line 183 of file winres.h.

#define SC_HOTKEY 0xF150

Definition at line 192 of file winres.h.

#define SC_HSCROLL 0xF080

Definition at line 185 of file winres.h.

#define SC_KEYMENU 0xF100

Definition at line 187 of file winres.h.

#define SC_MAXIMIZE 0xF030

Definition at line 180 of file winres.h.

#define SC_MINIMIZE 0xF020

Definition at line 179 of file winres.h.

#define SC_MOUSEMENU 0xF090

Definition at line 186 of file winres.h.

#define SC_MOVE 0xF010

Definition at line 178 of file winres.h.

#define SC_NEXTWINDOW 0xF040

Definition at line 181 of file winres.h.

#define SC_PREVWINDOW 0xF050

Definition at line 182 of file winres.h.

#define SC_RESTORE 0xF120

Definition at line 189 of file winres.h.

#define SC_SCREENSAVE 0xF140

Definition at line 191 of file winres.h.

#define SC_SIZE 0xF000

Definition at line 177 of file winres.h.

#define SC_TASKLIST 0xF130

Definition at line 190 of file winres.h.

#define SC_VSCROLL 0xF070

Definition at line 184 of file winres.h.

#define SS_BLACKFRAME 0x00000007L

Definition at line 208 of file winres.h.

#define SS_BLACKRECT 0x00000004L

Definition at line 205 of file winres.h.

#define SS_CENTER 0x00000001L

Definition at line 202 of file winres.h.

#define SS_GRAYFRAME 0x00000008L

Definition at line 209 of file winres.h.

#define SS_GRAYRECT 0x00000005L

Definition at line 206 of file winres.h.

#define SS_ICON 0x00000003L

Definition at line 204 of file winres.h.

#define SS_LEFT 0x00000000L

Definition at line 201 of file winres.h.

#define SS_LEFTNOWORDWRAP 0x0000000CL

Definition at line 212 of file winres.h.

#define SS_NOPREFIX 0x00000080L

Definition at line 213 of file winres.h.

#define SS_RIGHT 0x00000002L

Definition at line 203 of file winres.h.

#define SS_SIMPLE 0x0000000BL

Definition at line 211 of file winres.h.

#define SS_WHITEFRAME 0x00000009L

Definition at line 210 of file winres.h.

#define SS_WHITERECT 0x00000006L

Definition at line 207 of file winres.h.

#define VK_ADD 0x6B

Definition at line 145 of file winres.h.

#define VK_BACK 0x08

Definition at line 108 of file winres.h.

#define VK_CANCEL 0x03

Definition at line 106 of file winres.h.

#define VK_CAPITAL 0x14

Definition at line 116 of file winres.h.

#define VK_CLEAR 0x0C

Definition at line 110 of file winres.h.

#define VK_CONTROL 0x11

Definition at line 113 of file winres.h.

#define VK_DECIMAL 0x6E

Definition at line 148 of file winres.h.

#define VK_DELETE 0x2E

Definition at line 132 of file winres.h.

#define VK_DIVIDE 0x6F

Definition at line 149 of file winres.h.

#define VK_DOWN 0x28

Definition at line 126 of file winres.h.

#define VK_END 0x23

Definition at line 121 of file winres.h.

#define VK_ESCAPE 0x1B

Definition at line 117 of file winres.h.

#define VK_EXECUTE 0x2B

Definition at line 129 of file winres.h.

#define VK_F1 0x70

Definition at line 150 of file winres.h.

#define VK_F10 0x79

Definition at line 159 of file winres.h.

#define VK_F11 0x7A

Definition at line 160 of file winres.h.

#define VK_F12 0x7B

Definition at line 161 of file winres.h.

#define VK_F13 0x7C

Definition at line 162 of file winres.h.

#define VK_F14 0x7D

Definition at line 163 of file winres.h.

#define VK_F15 0x7E

Definition at line 164 of file winres.h.

#define VK_F16 0x7F

Definition at line 165 of file winres.h.

#define VK_F17 0x80

Definition at line 166 of file winres.h.

#define VK_F18 0x81

Definition at line 167 of file winres.h.

#define VK_F19 0x82

Definition at line 168 of file winres.h.

#define VK_F2 0x71

Definition at line 151 of file winres.h.

#define VK_F20 0x83

Definition at line 169 of file winres.h.

#define VK_F21 0x84

Definition at line 170 of file winres.h.

#define VK_F22 0x85

Definition at line 171 of file winres.h.

#define VK_F23 0x86

Definition at line 172 of file winres.h.

#define VK_F24 0x87

Definition at line 173 of file winres.h.

#define VK_F3 0x72

Definition at line 152 of file winres.h.

#define VK_F4 0x73

Definition at line 153 of file winres.h.

#define VK_F5 0x74

Definition at line 154 of file winres.h.

#define VK_F6 0x75

Definition at line 155 of file winres.h.

#define VK_F7 0x76

Definition at line 156 of file winres.h.

#define VK_F8 0x77

Definition at line 157 of file winres.h.

#define VK_F9 0x78

Definition at line 158 of file winres.h.

#define VK_HELP 0x2F

Definition at line 133 of file winres.h.

#define VK_HOME 0x24

Definition at line 122 of file winres.h.

#define VK_INSERT 0x2D

Definition at line 131 of file winres.h.

#define VK_LBUTTON 0x01

Definition at line 104 of file winres.h.

#define VK_LEFT 0x25

Definition at line 123 of file winres.h.

#define VK_MBUTTON 0x04

Definition at line 107 of file winres.h.

#define VK_MENU 0x12

Definition at line 114 of file winres.h.

#define VK_MULTIPLY 0x6A

Definition at line 144 of file winres.h.

#define VK_NEXT 0x22

Definition at line 120 of file winres.h.

#define VK_NUMLOCK 0x90

Definition at line 174 of file winres.h.

#define VK_NUMPAD0 0x60

Definition at line 134 of file winres.h.

#define VK_NUMPAD1 0x61

Definition at line 135 of file winres.h.

#define VK_NUMPAD2 0x62

Definition at line 136 of file winres.h.

#define VK_NUMPAD3 0x63

Definition at line 137 of file winres.h.

#define VK_NUMPAD4 0x64

Definition at line 138 of file winres.h.

#define VK_NUMPAD5 0x65

Definition at line 139 of file winres.h.

#define VK_NUMPAD6 0x66

Definition at line 140 of file winres.h.

#define VK_NUMPAD7 0x67

Definition at line 141 of file winres.h.

#define VK_NUMPAD8 0x68

Definition at line 142 of file winres.h.

#define VK_NUMPAD9 0x69

Definition at line 143 of file winres.h.

#define VK_PAUSE 0x13

Definition at line 115 of file winres.h.

#define VK_PRINT 0x2A

Definition at line 128 of file winres.h.

#define VK_PRIOR 0x21

Definition at line 119 of file winres.h.

#define VK_RBUTTON 0x02

Definition at line 105 of file winres.h.

#define VK_RETURN 0x0D

Definition at line 111 of file winres.h.

#define VK_RIGHT 0x27

Definition at line 125 of file winres.h.

#define VK_SCROLL 0x91

Definition at line 175 of file winres.h.

#define VK_SELECT 0x29

Definition at line 127 of file winres.h.

#define VK_SEPARATOR 0x6C

Definition at line 146 of file winres.h.

#define VK_SHIFT 0x10

Definition at line 112 of file winres.h.

#define VK_SNAPSHOT 0x2C

Definition at line 130 of file winres.h.

#define VK_SPACE 0x20

Definition at line 118 of file winres.h.

#define VK_SUBTRACT 0x6D

Definition at line 147 of file winres.h.

#define VK_TAB 0x09

Definition at line 109 of file winres.h.

#define VK_UP 0x26

Definition at line 124 of file winres.h.

#define WM_USER 0x0400

Definition at line 280 of file winres.h.

#define WS_BORDER 0x00800000L

Definition at line 84 of file winres.h.

#define WS_CAPTION 0x00C00000L

Definition at line 83 of file winres.h.

#define WS_CHILD 0x40000000L

Definition at line 76 of file winres.h.

#define WS_CHILDWINDOW (WS_CHILD)

Definition at line 98 of file winres.h.

#define WS_CLIPCHILDREN 0x02000000L

Definition at line 78 of file winres.h.

#define WS_CLIPSIBLINGS 0x04000000L

Definition at line 77 of file winres.h.

#define WS_DISABLED 0x08000000L

Definition at line 80 of file winres.h.

#define WS_DLGFRAME 0x00400000L

Definition at line 85 of file winres.h.

#define WS_GROUP 0x00020000L

Definition at line 92 of file winres.h.

#define WS_HSCROLL 0x00100000L

Definition at line 87 of file winres.h.

#define WS_ICONIC WS_MINIMIZE

Definition at line 100 of file winres.h.

#define WS_MAXIMIZE 0x01000000L

Definition at line 82 of file winres.h.

#define WS_MAXIMIZEBOX 0x00010000L

Definition at line 91 of file winres.h.

#define WS_MINIMIZE 0x20000000L

Definition at line 81 of file winres.h.

#define WS_MINIMIZEBOX 0x00020000L

Definition at line 90 of file winres.h.

#define WS_OVERLAPPED 0x00000000L

Definition at line 74 of file winres.h.

#define WS_OVERLAPPEDWINDOW (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX)

Definition at line 96 of file winres.h.

#define WS_POPUP 0x80000000L

Definition at line 75 of file winres.h.

#define WS_POPUPWINDOW (WS_POPUP | WS_BORDER | WS_SYSMENU)

Definition at line 97 of file winres.h.

#define WS_SIZEBOX WS_THICKFRAME

Definition at line 101 of file winres.h.

#define WS_SYSMENU 0x00080000L

Definition at line 88 of file winres.h.

#define WS_TABSTOP 0x00010000L

Definition at line 93 of file winres.h.

#define WS_THICKFRAME 0x00040000L

Definition at line 89 of file winres.h.

#define WS_TILED WS_OVERLAPPED

Definition at line 99 of file winres.h.

#define WS_TILEDWINDOW WS_OVERLAPPEDWINDOW

Definition at line 102 of file winres.h.

#define WS_VISIBLE 0x10000000L

Definition at line 79 of file winres.h.

#define WS_VSCROLL 0x00200000L

Definition at line 86 of file winres.h.

Generated on Wed Nov 13 2024 16:53:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/DsSrch/main.cxx File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • DsSrch
Defines | Functions | Variables

main.cxx File Reference

#include <windows.h>
#include <stdlib.h>
#include <limits.h>
#include <io.h>
#include <stdio.h>
#include "activeds.h"
#include "main.hxx"

Go to the source code of this file.

Defines

#define | BAIL_ON_FAILURE(hr)
#define | BAIL_ON_NULL(p)
#define | INC_OLE2

Functions

INT | main (int argc, char *argv[])
HRESULT | ProcessArgs (int argc, char *argv[])
LPWSTR | RemoveWhiteSpaces (LPWSTR pszText)

Variables

DWORD | cErr = 0
DWORD | dwAuthFlags = 0
DWORD | dwCurrPref = 0
DWORD | dwMaxRows = (DWORD) -1
DWORD | dwNumberAttributes = -1
DWORD dwPageSize
DWORD dwSearchScope
DWORD dwTimeOut
BOOL | fASynchronous = FALSE
BOOL | fAttrsOnly = FALSE
BOOL | fDerefAliases = FALSE
DWORD fSizeLimit
DWORD fTimeLimit
DWORD | nSortKeys = 0
char * | prefNameLookup []
ADS_SEARCHPREF_INFO | pSearchPref [10]
ADS_SORTKEY | pSortKey [10]
LPWSTR | pszAttrList
LPWSTR | pszAttrNames [10]
LPWSTR | pszPassword = NULL
LPWSTR | pszSearchBase
LPWSTR | pszSearchFilter
LPWSTR | pszUserName = NULL

Define Documentation

#define BAIL_ON_FAILURE ( hr )
Value:
if (FAILED(hr)) {     \
                goto error;   \
        }

Definition at line 44 of file main.cxx.

#define BAIL_ON_NULL ( p )
Value:
if (!(p)) {           \
                goto error;   \
        }

Definition at line 39 of file main.cxx.

#define INC_OLE2

Definition at line 18 of file main.cxx.

Function Documentation

INT main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 98 of file main.cxx.

{
    HRESULT hr=S_OK;
    IDirectorySearch *pDSSearch=NULL;
    ADS_SEARCH_HANDLE hSearchHandle=NULL;
    ADS_SEARCH_COLUMN Column;
    DWORD nRows = 0, i;
    LPWSTR pszColumnName = NULL;

#if 0       // Enable if you want to test binary values in filters and send
            // pszBinaryFilter instead of pszSearchFilter in ExecuteSearch

    WCHAR pszBinaryFilter[256] = L"objectSid=";

    LPWSTR pszDest = NULL;

    BYTE column[100] = {
                    0x01, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x15, 0x00,
                    0x00, 0x00, 0x59, 0x51, 0xb8, 0x17, 0x66, 0x72, 0x5d, 0x25,
                    0x64, 0x63, 0x3b, 0x0b, 0x29, 0x99, 0x21, 0x00 };

    hr = ADsEncodeBinaryData (
       column,
       28,
       &pszDest
       );

    wcsncat( pszBinaryFilter, pszDest ,wcslen(pszDest) );

    FreeADsMem( pszDest );

#endif

    //
    // Sets the global variables with the parameters
    //
    hr = ProcessArgs(argc, argv);
    BAIL_ON_FAILURE(hr);

    hr = CoInitialize(NULL);

    if (FAILED(hr)) {
        printf("CoInitialize failed\n") ;
        return(1) ;
    }

    hr = ADsOpenObject(
        pszSearchBase,
        pszUserName,
        pszPassword,
        dwAuthFlags,
        IID_IDirectorySearch,
        (void **)&pDSSearch
        );

if(pszUserName) ZeroMemory((PVOID)pszUserName,wcslen(pszUserName)*sizeof(WCHAR));
if(pszPassword) ZeroMemory((PVOID)pszPassword,wcslen(pszPassword)*sizeof(WCHAR));

#if 0 // If you want to go with the default credentials

    hr = ADsGetObject(
                pszSearchBase,
                IID_IDirectorySearch,
                (void **)&pDSSearch
                );

#endif

    BAIL_ON_FAILURE(hr);

    if (dwCurrPref) {
        hr = pDSSearch->SetSearchPreference(
                 pSearchPref,
                 dwCurrPref
                 );
        BAIL_ON_FAILURE(hr);

        if (hr != S_OK) {
            for (i=0; i<dwCurrPref; i++) {
                if (pSearchPref[i].dwStatus != ADS_STATUS_S_OK) {
                    printf(
                        "Error in setting the preference %s: status = %d\n",
                           prefNameLookup[pSearchPref[i].dwSearchPref],
                           pSearchPref[i].dwStatus
                           );
                    cErr++;
                }
            }

        }
    }

    hr = pDSSearch->ExecuteSearch(
             pszSearchFilter,
             pszAttrNames,
             dwNumberAttributes,
             &hSearchHandle
              );
    BAIL_ON_FAILURE(hr);

    hr = pDSSearch->GetNextRow(
             hSearchHandle
             );
    BAIL_ON_FAILURE(hr);

    while (hr != S_ADS_NOMORE_ROWS && nRows < dwMaxRows) {
        nRows++;

        if (dwNumberAttributes == -1) {
            hr = pDSSearch->GetNextColumnName(
                     hSearchHandle,
                     &pszColumnName
                     );
            BAIL_ON_FAILURE(hr);

            while (hr != S_ADS_NOMORE_COLUMNS) {
                hr = pDSSearch->GetColumn(
                         hSearchHandle,
                         pszColumnName,
                         &Column
                         );

                if (FAILED(hr)  && hr != E_ADS_COLUMN_NOT_SET)
                    goto error;

                if (SUCCEEDED(hr)) {
                    PrintColumn(&Column, pszColumnName);
                    pDSSearch->FreeColumn(&Column);
                }

                FreeADsMem(pszColumnName);
                hr = pDSSearch->GetNextColumnName(
                         hSearchHandle,
                         &pszColumnName
                         );
                BAIL_ON_FAILURE(hr);
            }
            printf("\n");
        }
        else {
            for ( i=0; i<dwNumberAttributes; i++) {
                hr = pDSSearch->GetColumn(
                         hSearchHandle,
                         pszAttrNames[i],
                         &Column
                         );

                if (hr == E_ADS_COLUMN_NOT_SET)
                    continue;

                BAIL_ON_FAILURE(hr);

                PrintColumn(&Column, pszAttrNames[i]);

                pDSSearch->FreeColumn(&Column);
            }
        printf("\n");
        }

        hr = pDSSearch->GetNextRow(
                 hSearchHandle
                 );
        BAIL_ON_FAILURE(hr);
    }

    wprintf (L"Total Rows: %d\n", nRows);

    if (cErr) {
        wprintf (L"%d warning(s) ignored", cErr);
    }

    if (hSearchHandle)
        pDSSearch->CloseSearchHandle(hSearchHandle);

    FREE_INTERFACE(pDSSearch);

    FREE_UNICODE_STRING(pszSearchBase) ;
    FREE_UNICODE_STRING(pszSearchFilter) ;
    FREE_UNICODE_STRING(pszAttrList) ;
    FREE_UNICODE_STRING(pszUserName) ;
    FREE_UNICODE_STRING(pszPassword) ;
    for(i=0;i<nSortKeys;i++)    FREE_UNICODE_STRING(pSortKey[i].pszAttrType);
    CoUninitialize();

    return(0) ;

error:

    if (hSearchHandle)
        pDSSearch->CloseSearchHandle(hSearchHandle);

    FREE_INTERFACE(pDSSearch);

    FREE_UNICODE_STRING(pszSearchBase) ;
    FREE_UNICODE_STRING(pszSearchFilter) ;
    FREE_UNICODE_STRING(pszAttrList) ;
    FREE_UNICODE_STRING(pszUserName) ;
    FREE_UNICODE_STRING(pszPassword) ;
    for(i=0;i<nSortKeys;i++)    FREE_UNICODE_STRING(pSortKey[i].pszAttrType);
    wprintf (L"Error! hr = 0x%x\n", hr);
    return(1) ;
}

HRESULT ProcessArgs | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 313 of file main.cxx.

{
    argc--;
    int currArg = 1;
    LPWSTR pTemp;
    char *pszCurrPref, *pszCurrPrefValue;

    char *pszAttr;
    DWORD nAttr=0;

    while (argc) {
        if (argv[currArg][0] != '/' && argv[currArg][0] != '-')
            BAIL_ON_FAILURE (E_FAIL);
        switch (argv[currArg][1]) {
        case 'b':
            argc--;
            currArg++;
            if (argc <= 0)
                BAIL_ON_FAILURE (E_FAIL);
            pszSearchBase = AllocateUnicodeString(argv[currArg]);
            BAIL_ON_NULL(pszSearchBase);
            break;

        case 'f':
            argc--;
            currArg++;
            if (argc <= 0)
                BAIL_ON_FAILURE (E_FAIL);
            pszSearchFilter = AllocateUnicodeString(argv[currArg]);
            BAIL_ON_NULL(pszSearchFilter);
            break;

        case 'a':
            argc--;
            currArg++;
            if (argc <= 0)
                BAIL_ON_FAILURE (E_FAIL);
            pszAttrList = AllocateUnicodeString(argv[currArg]);
            BAIL_ON_NULL(pszAttrList);

            dwNumberAttributes = 0;
            pTemp = wcstok(pszAttrList, L",");
            pszAttrNames[dwNumberAttributes] = RemoveWhiteSpaces(pTemp);
            dwNumberAttributes++;

            while (pTemp) {
                pTemp = wcstok(NULL, L",");
                pszAttrNames[dwNumberAttributes] = RemoveWhiteSpaces(pTemp);
                dwNumberAttributes++;
            }
            dwNumberAttributes--;
            break;

        case 'u':
            argc--;
            currArg++;
            if (argc <= 0)
                BAIL_ON_FAILURE (E_FAIL);
            pszUserName = AllocateUnicodeString(argv[currArg]);
            BAIL_ON_NULL(pszSearchBase);
            argc--;
            currArg++;
            if (argc <= 0)
                BAIL_ON_FAILURE (E_FAIL);
            pszPassword = AllocateUnicodeString(argv[currArg]);
            BAIL_ON_NULL(pszSearchBase);
            break;

        case 't':
            argc--;
            currArg++;
            if (argc <= 0)
                BAIL_ON_FAILURE (E_FAIL);

            pszCurrPref = strtok(argv[currArg], "=");
            pszCurrPrefValue = strtok(NULL, "=");
            if (!pszCurrPref || !pszCurrPrefValue)
                BAIL_ON_FAILURE(E_FAIL);

            if (!_stricmp(pszCurrPref, "SecureAuth")) {
                if (!_stricmp(pszCurrPrefValue, "yes" ))
                    dwAuthFlags |= ADS_SECURE_AUTHENTICATION;
                else if (!_stricmp(pszCurrPrefValue, "no" ))
                    dwAuthFlags &= ~ADS_SECURE_AUTHENTICATION;
                else
                    BAIL_ON_FAILURE(E_FAIL);
            }
            else if (!_stricmp(pszCurrPref, "UseEncrypt")) {
                if (!_stricmp(pszCurrPrefValue, "yes" ))
                    dwAuthFlags |= ADS_USE_ENCRYPTION;
                else if (!_stricmp(pszCurrPrefValue, "no" ))
                    dwAuthFlags &= ~ADS_USE_ENCRYPTION;
                else
                    BAIL_ON_FAILURE(E_FAIL);
            }
            else
                BAIL_ON_FAILURE(E_FAIL);
            break;

        case 'p':
            argc--;
            currArg++;
            if (argc <= 0)
                BAIL_ON_FAILURE (E_FAIL);

            pszCurrPref = strtok(argv[currArg], "=");
            pszCurrPrefValue = strtok(NULL, "=");
            if (!pszCurrPref || !pszCurrPrefValue)
                BAIL_ON_FAILURE(E_FAIL);

            if (!_stricmp(pszCurrPref, "asynchronous")) {
                pSearchPref[dwCurrPref].dwSearchPref = ADS_SEARCHPREF_ASYNCHRONOUS;
                pSearchPref[dwCurrPref].vValue.dwType = ADSTYPE_BOOLEAN;
                if (!_stricmp(pszCurrPrefValue, "yes" ))
                    pSearchPref[dwCurrPref].vValue.Boolean = TRUE;
                else if (!_stricmp(pszCurrPrefValue, "no" ))
                    pSearchPref[dwCurrPref].vValue.Boolean = FALSE;
                else
                    BAIL_ON_FAILURE(E_FAIL);
            }
            else if (!_stricmp(pszCurrPref, "attrTypesOnly")) {
                pSearchPref[dwCurrPref].dwSearchPref = ADS_SEARCHPREF_ATTRIBTYPES_ONLY;
                pSearchPref[dwCurrPref].vValue.dwType = ADSTYPE_BOOLEAN;
                if (!_stricmp(pszCurrPrefValue, "yes" ))
                    pSearchPref[dwCurrPref].vValue.Boolean = TRUE;
                else if (!_stricmp(pszCurrPrefValue, "no" ))
                    pSearchPref[dwCurrPref].vValue.Boolean = FALSE;
                else
                    BAIL_ON_FAILURE(E_FAIL);
            }
            else if (!_stricmp(pszCurrPref, "derefAliases")) {
                pSearchPref[dwCurrPref].dwSearchPref = ADS_SEARCHPREF_DEREF_ALIASES;
                pSearchPref[dwCurrPref].vValue.dwType = ADSTYPE_INTEGER;
                if (!_stricmp(pszCurrPrefValue, "yes" ))
                    pSearchPref[dwCurrPref].vValue.Integer = ADS_DEREF_ALWAYS;
                else if (!_stricmp(pszCurrPrefValue, "no" ))
                    pSearchPref[dwCurrPref].vValue.Integer = ADS_DEREF_NEVER;
                else
                    BAIL_ON_FAILURE(E_FAIL);
            }
            else if (!_stricmp(pszCurrPref, "timeOut")) {
                pSearchPref[dwCurrPref].dwSearchPref = ADS_SEARCHPREF_TIMEOUT;
                pSearchPref[dwCurrPref].vValue.dwType = ADSTYPE_INTEGER;
                pSearchPref[dwCurrPref].vValue.Integer = atoi(pszCurrPrefValue);
            }
            else if (!_stricmp(pszCurrPref, "timeLimit")) {
                pSearchPref[dwCurrPref].dwSearchPref = ADS_SEARCHPREF_TIME_LIMIT;
                pSearchPref[dwCurrPref].vValue.dwType = ADSTYPE_INTEGER;
                pSearchPref[dwCurrPref].vValue.Integer = atoi(pszCurrPrefValue);
            }
            else if (!_stricmp(pszCurrPref, "sizeLimit")) {
                pSearchPref[dwCurrPref].dwSearchPref = ADS_SEARCHPREF_SIZE_LIMIT;
                pSearchPref[dwCurrPref].vValue.dwType = ADSTYPE_INTEGER;
                pSearchPref[dwCurrPref].vValue.Integer = atoi(pszCurrPrefValue);
            }
            else if (!_stricmp(pszCurrPref, "PageSize")) {
                pSearchPref[dwCurrPref].dwSearchPref = ADS_SEARCHPREF_PAGESIZE;
                pSearchPref[dwCurrPref].vValue.dwType = ADSTYPE_INTEGER;
                pSearchPref[dwCurrPref].vValue.Integer = atoi(pszCurrPrefValue);
            }
            else if (!_stricmp(pszCurrPref, "PagedTimeLimit")) {
                pSearchPref[dwCurrPref].dwSearchPref = ADS_SEARCHPREF_PAGED_TIME_LIMIT;
                pSearchPref[dwCurrPref].vValue.dwType = ADSTYPE_INTEGER;
                pSearchPref[dwCurrPref].vValue.Integer = atoi(pszCurrPrefValue);
            }
            else if (!_stricmp(pszCurrPref, "SearchScope")) {
                pSearchPref[dwCurrPref].dwSearchPref = ADS_SEARCHPREF_SEARCH_SCOPE;
                pSearchPref[dwCurrPref].vValue.dwType = ADSTYPE_INTEGER;
                if (!_stricmp(pszCurrPrefValue, "Base" ))
                    pSearchPref[dwCurrPref].vValue.Integer = ADS_SCOPE_BASE;
                else if (!_stricmp(pszCurrPrefValue, "OneLevel" ))
                    pSearchPref[dwCurrPref].vValue.Integer = ADS_SCOPE_ONELEVEL;
                else if (!_stricmp(pszCurrPrefValue, "Subtree" ))
                    pSearchPref[dwCurrPref].vValue.Integer = ADS_SCOPE_SUBTREE;
                else
                    BAIL_ON_FAILURE(E_FAIL);
            }
            else if (!_stricmp(pszCurrPref, "ChaseReferrals")) {
                pSearchPref[dwCurrPref].dwSearchPref = ADS_SEARCHPREF_CHASE_REFERRALS;
                pSearchPref[dwCurrPref].vValue.dwType = ADSTYPE_INTEGER;
                if (!_stricmp(pszCurrPrefValue, "always" ))
                    pSearchPref[dwCurrPref].vValue.Integer = ADS_CHASE_REFERRALS_ALWAYS;
                else if (!_stricmp(pszCurrPrefValue, "never" ))
                    pSearchPref[dwCurrPref].vValue.Integer = ADS_CHASE_REFERRALS_NEVER;
                else if (!_stricmp(pszCurrPrefValue, "external" ))
                    pSearchPref[dwCurrPref].vValue.Integer = ADS_CHASE_REFERRALS_EXTERNAL;
                else if (!_stricmp(pszCurrPrefValue, "subordinate" ))
                    pSearchPref[dwCurrPref].vValue.Integer = ADS_CHASE_REFERRALS_SUBORDINATE;
                else
                    BAIL_ON_FAILURE(E_FAIL);
            }
            else if (!_stricmp(pszCurrPref, "SortOn")) {
                pSearchPref[dwCurrPref].dwSearchPref = ADS_SEARCHPREF_SORT_ON;
                pSearchPref[dwCurrPref].vValue.dwType = ADSTYPE_PROV_SPECIFIC;

                pszAttr = strtok(pszCurrPrefValue, ",");

                for (nAttr=0; pszAttr && nAttr < 10; nAttr++) {

                    pSortKey[nAttr].pszAttrType = AllocateUnicodeString(pszAttr);
                    pSortKey[nAttr].pszReserved = NULL;
                    pSortKey[nAttr].fReverseorder = 0;
          nSortKeys++;

                    pszAttr = strtok(NULL, ",");
                }
                if (nAttr == 0 && nAttr >= 10) {
                    BAIL_ON_FAILURE(E_FAIL);
                }

                pSearchPref[dwCurrPref].vValue.ProviderSpecific.dwLength = sizeof(ADS_SORTKEY) * nAttr;
                pSearchPref[dwCurrPref].vValue.ProviderSpecific.lpValue = (LPBYTE) pSortKey;
            }
            else if (!_stricmp(pszCurrPref, "cacheResults")) {
                pSearchPref[dwCurrPref].dwSearchPref = ADS_SEARCHPREF_CACHE_RESULTS;
                pSearchPref[dwCurrPref].vValue.dwType = ADSTYPE_BOOLEAN;
                if (!_stricmp(pszCurrPrefValue, "yes" ))
                    pSearchPref[dwCurrPref].vValue.Boolean = TRUE;
                else if (!_stricmp(pszCurrPrefValue, "no" ))
                    pSearchPref[dwCurrPref].vValue.Boolean = FALSE;
                else
                    BAIL_ON_FAILURE(E_FAIL);
            }
            else
                BAIL_ON_FAILURE(E_FAIL);

            dwCurrPref++;
            break;

        case 'n':
            argc--;
            currArg++;
            if (argc <= 0)
                BAIL_ON_FAILURE (E_FAIL);
            dwMaxRows = atoi(argv[currArg]);
            break;

       default:
            BAIL_ON_FAILURE(E_FAIL);
        }

        argc--;
        currArg++;
    }

    //
    // Check for Mandatory arguments;
    //

    if (!pszSearchBase || !pszSearchFilter)
        BAIL_ON_FAILURE(E_FAIL);

    if (dwNumberAttributes == 0) {
        //
        // Get all the attributes
        //
        dwNumberAttributes = -1;
    }

    return (S_OK);
error:

    PrintUsage();
    return E_FAIL;

}

LPWSTR RemoveWhiteSpaces ( LPWSTR pszText )

Definition at line 585 of file main.cxx.

{
    LPWSTR pChar;

    if(!pszText)
        return (pszText);

    while(*pszText && iswspace(*pszText))
        pszText++;

    for(pChar = pszText + wcslen(pszText) - 1; pChar >= pszText; pChar--) {
        if(!iswspace(*pChar))
            break;
        else
            *pChar = L'\0';
    }

    return pszText;
}

Variable Documentation

DWORD cErr = 0

Definition at line 73 of file main.cxx.

DWORD dwAuthFlags = 0

Definition at line 72 of file main.cxx.

DWORD dwCurrPref = 0

Definition at line 69 of file main.cxx.

DWORD dwMaxRows = (DWORD) -1

Definition at line 57 of file main.cxx.

DWORD dwNumberAttributes = -1

Definition at line 57 of file main.cxx.

DWORD dwPageSize

Definition at line 64 of file main.cxx.

DWORD dwSearchScope

Definition at line 64 of file main.cxx.

DWORD dwTimeOut

Definition at line 64 of file main.cxx.

BOOL fASynchronous = FALSE

Definition at line 63 of file main.cxx.

BOOL fAttrsOnly = FALSE

Definition at line 63 of file main.cxx.

BOOL fDerefAliases = FALSE

Definition at line 63 of file main.cxx.

DWORD fSizeLimit

Definition at line 64 of file main.cxx.

DWORD fTimeLimit

Definition at line 64 of file main.cxx.

DWORD nSortKeys = 0

Definition at line 68 of file main.cxx.

char* prefNameLookup[]
Initial value:
    {
    "ADS_SEARCHPREF_ASYNCHRONOUS",
    "ADS_SEARCHPREF_DEREF_ALIASES",
    "ADS_SEARCHPREF_SIZE_LIMIT",
    "ADS_SEARCHPREF_TIME_LIMIT",
    "ADS_SEARCHPREF_ATTRIBTYPES_ONLY",
    "ADS_SEARCHPREF_SEARCH_SCOPE",
    "ADS_SEARCHPREF_TIMEOUT",
    "ADS_SEARCHPREF_PAGESIZE",
    "ADS_SEARCHPREF_PAGED_TIME_LIMIT",
    "ADS_SEARCHPREF_CHASE_REFERRALS"
    "ADS_SEARCHPREF_CACHE_RESULTS"
    }

Definition at line 75 of file main.cxx.

ADS_SEARCHPREF_INFO pSearchPref[10]

Definition at line 66 of file main.cxx.

ADS_SORTKEY pSortKey[10]

Definition at line 67 of file main.cxx.

LPWSTR pszAttrList

Definition at line 56 of file main.cxx.

LPWSTR pszAttrNames[10]

Definition at line 56 of file main.cxx.

LPWSTR pszPassword = NULL

Definition at line 71 of file main.cxx.

LPWSTR pszSearchBase

Definition at line 56 of file main.cxx.

LPWSTR pszSearchFilter

Definition at line 56 of file main.cxx.

LPWSTR pszUserName = NULL

Definition at line 71 of file main.cxx.

Generated on Wed Nov 13 2024 16:53:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/DsSrch/main.hxx File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • DsSrch
Defines | Functions

main.hxx File Reference

#include <windows.h>
#include <stdlib.h>
#include <limits.h>
#include <io.h>
#include <stdio.h>
#include <stddef.h>
#include "activeds.h"
#include "oledb.h"
#include "oledberr.h"

Go to the source code of this file.

Defines

#define | _UNICODE
#define | ADS_FREE(pMem)
#define | BAIL_ON_FAILURE(hr)
#define | BAIL_ON_NULL(p)
#define | FREE_INTERFACE(pInterface)
#define | FREE_UNICODE_STRING(pMem)
#define | INC_OLE2
#define | NULL_TERMINATED 0
#define | UNICODE

Functions

LPWSTR | AllocateUnicodeString (LPSTR pAnsiString)
int | AnsiToUnicodeString (LPSTR pAnsi, LPWSTR pUnicode, DWORD StringLength)
void | FreeUnicodeString (LPWSTR pUnicodeString)
void | PrintColumn (PADS_SEARCH_COLUMN pColumn, LPWSTR pszColumnName)
void | PrintUsage (void)
HRESULT | ProcessArgs (int argc, char *argv[])
LPWSTR | RemoveWhiteSpaces (LPWSTR pszText)

Define Documentation

#define _UNICODE

Definition at line 9 of file main.hxx.

#define ADS_FREE ( pMem )
Value:
if (pMem) {    \
            FreeADsMem(pMem); \
            pMem = NULL;     \
        }

Definition at line 64 of file main.hxx.

#define BAIL_ON_FAILURE ( hr )
Value:
if (FAILED(hr)) {     \
                goto error;   \
        }

Definition at line 51 of file main.hxx.

#define BAIL_ON_NULL ( p )
Value:
if (!(p)) {           \
                goto error;   \
        }

Definition at line 46 of file main.hxx.

#define FREE_INTERFACE ( pInterface )
Value:
if (pInterface) {          \
            pInterface->Release(); \
            pInterface=NULL;       \
        }

Definition at line 57 of file main.hxx.

#define FREE_UNICODE_STRING ( pMem )
Value:
if (pMem) {    \
            FreeUnicodeString(pMem); \
            pMem = NULL;     \
        }

Definition at line 71 of file main.hxx.

#define INC_OLE2

Definition at line 10 of file main.hxx.

#define NULL_TERMINATED 0

Definition at line 40 of file main.hxx.

#define UNICODE

Definition at line 8 of file main.hxx.

Function Documentation

LPWSTR AllocateUnicodeString ( LPSTR pAnsiString )

Definition at line 118 of file util.cxx.

{
    LPWSTR  pUnicodeString = NULL;

    if (!pAnsiString)
        return NULL;

    pUnicodeString = (LPWSTR)LocalAlloc(
                        LPTR,
                        strlen(pAnsiString)*sizeof(WCHAR) + sizeof(WCHAR)
                        );

    if (pUnicodeString) {

        AnsiToUnicodeString(
            pAnsiString,
            pUnicodeString,
            0
            );
    }

    return pUnicodeString;
}

int AnsiToUnicodeString | ( | LPSTR | pAnsi,
 |  | LPWSTR | pUnicode,
 |  | DWORD | StringLength
 | ) |  |

Definition at line 21 of file util.cxx.

{
    int iReturn;

    if( StringLength == 0 )
        StringLength = strlen( pAnsi );

    iReturn = MultiByteToWideChar(CP_ACP,
                                  MB_PRECOMPOSED,
                                  pAnsi,
                                  StringLength + 1,
                                  pUnicode,
                                  StringLength + 1 );

    //
    // Ensure NULL termination.
    //
    pUnicode[StringLength] = 0;

    return iReturn;
}

void FreeUnicodeString ( LPWSTR pUnicodeString )

Definition at line 146 of file util.cxx.

{

    LocalFree(pUnicodeString);

    return;
}

void PrintColumn | ( | PADS_SEARCH_COLUMN | pColumn,
 |  | LPWSTR | pszColumnName
 | ) |  |

Definition at line 54 of file util.cxx.

{

    ULONG j, k;

    if (!pColumn) {
        return;
    }

    wprintf(
        L"%s = ",
        pszColumnName
        );

    for (k=0; k < pColumn->dwNumValues; k++) {
        if (k > 0)
            wprintf(L"#  ");

        switch(pColumn->dwADsType) {
        case ADSTYPE_DN_STRING         :
            wprintf(
                L"%s  ",
                (LPWSTR) pColumn->pADsValues[k].DNString
                );
            break;
        case ADSTYPE_CASE_EXACT_STRING :
            wprintf(
                L"%s  ",
                (LPWSTR) pColumn->pADsValues[k].CaseExactString
                );
            break;
        case ADSTYPE_CASE_IGNORE_STRING:
            wprintf(
                L"%s  ",
                (LPWSTR) pColumn->pADsValues[k].CaseIgnoreString
                );
            break;
        case ADSTYPE_PRINTABLE_STRING  :
            wprintf(
                L"%s  ",
                (LPWSTR) pColumn->pADsValues[k].PrintableString
                );
            break;
        case ADSTYPE_NUMERIC_STRING    :
            wprintf(
                L"%s  ",
                (LPWSTR) pColumn->pADsValues[k].NumericString
                );
            break;

        case ADSTYPE_OBJECT_CLASS    :
            wprintf(
                L"%s  ",
                (LPWSTR) pColumn->pADsValues[k].ClassName
                );
            break;

        case ADSTYPE_BOOLEAN           :
            wprintf(
                L"%s  ",
                (DWORD) pColumn->pADsValues[k].Boolean ?
                L"TRUE" : L"FALSE"
                );
            break;

        case ADSTYPE_INTEGER           :
            wprintf(
                L"%d  ",
                (DWORD) pColumn->pADsValues[k].Integer
                );
            break;

        case ADSTYPE_OCTET_STRING      :
            for (j=0; j<pColumn->pADsValues[k].OctetString.dwLength; j++) {
                printf(
                    "%02x",
                    ((BYTE *)pColumn->pADsValues[k].OctetString.lpValue)[j]
                    );
            }
            break;

        case ADSTYPE_LARGE_INTEGER     :
            wprintf(
                L"%I64d  ",
                pColumn->pADsValues[k].LargeInteger
                );
            break;

        case ADSTYPE_UTC_TIME          :
            wprintf(
                L"(date value) "
                );
            break;
        case ADSTYPE_PROV_SPECIFIC     :
            wprintf(
                L"(provider specific value) "
                );
            break;

        }
    }

    printf("\n");
}

void PrintUsage ( void )

Definition at line 1549 of file Sample1.Cpp.

{
   wprintf(L"sample1.exe\n");
   wprintf(L"Usage:\n");
   wprintf(L"   sample1 <action> [action specific parameters]\n");
   wprintf(L"      where <action> is one of the followings:\n");
   wprintf(L"                download\n");
   wprintf(L"                upload\n");
   wprintf(L"                enum\n");
   wprintf(L"                search\n");
   wprintf(L"                mkdir\n");
   wprintf(L"                copy\n");
   wprintf(L"                move\n");
   wprintf(L"                delete\n");
   wprintf(L"      action specific parameters:\n");
   wprintf(L"         download: u=url [l=local_dest] [n=username p=password]\n");
   wprintf(L"         upload:   u=url l=local_src [n=username p=password]\n");
   wprintf(L"         enum:     u=url [v=yes/no] [n=username p=password]\n");
   wprintf(L"         search:   u=url [q=\"SQL query\"] [v=yes/no] [n=username p=password]\n");
   wprintf(L"                   note that '\"' in the query should be typed as '\\\"'\n");
   wprintf(L"         mkdir:    u=url [n=username p=password]\n");
   wprintf(L"         copy:     us=src ud=dest [ns=username ps=password]\n");
   wprintf(L"                                  [nd=username pd=password]\n");
   wprintf(L"         move:     us=src ud=dest [ns=username ps=password]\n");
   wprintf(L"                                  [nd=username pd=password]\n");
   wprintf(L"         delete:   u=url [n=username p=password]\n");
}

HRESULT ProcessArgs | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 313 of file main.cxx.

{
    argc--;
    int currArg = 1;
    LPWSTR pTemp;
    char *pszCurrPref, *pszCurrPrefValue;

    char *pszAttr;
    DWORD nAttr=0;

    while (argc) {
        if (argv[currArg][0] != '/' && argv[currArg][0] != '-')
            BAIL_ON_FAILURE (E_FAIL);
        switch (argv[currArg][1]) {
        case 'b':
            argc--;
            currArg++;
            if (argc <= 0)
                BAIL_ON_FAILURE (E_FAIL);
            pszSearchBase = AllocateUnicodeString(argv[currArg]);
            BAIL_ON_NULL(pszSearchBase);
            break;

        case 'f':
            argc--;
            currArg++;
            if (argc <= 0)
                BAIL_ON_FAILURE (E_FAIL);
            pszSearchFilter = AllocateUnicodeString(argv[currArg]);
            BAIL_ON_NULL(pszSearchFilter);
            break;

        case 'a':
            argc--;
            currArg++;
            if (argc <= 0)
                BAIL_ON_FAILURE (E_FAIL);
            pszAttrList = AllocateUnicodeString(argv[currArg]);
            BAIL_ON_NULL(pszAttrList);

            dwNumberAttributes = 0;
            pTemp = wcstok(pszAttrList, L",");
            pszAttrNames[dwNumberAttributes] = RemoveWhiteSpaces(pTemp);
            dwNumberAttributes++;

            while (pTemp) {
                pTemp = wcstok(NULL, L",");
                pszAttrNames[dwNumberAttributes] = RemoveWhiteSpaces(pTemp);
                dwNumberAttributes++;
            }
            dwNumberAttributes--;
            break;

        case 'u':
            argc--;
            currArg++;
            if (argc <= 0)
                BAIL_ON_FAILURE (E_FAIL);
            pszUserName = AllocateUnicodeString(argv[currArg]);
            BAIL_ON_NULL(pszSearchBase);
            argc--;
            currArg++;
            if (argc <= 0)
                BAIL_ON_FAILURE (E_FAIL);
            pszPassword = AllocateUnicodeString(argv[currArg]);
            BAIL_ON_NULL(pszSearchBase);
            break;

        case 't':
            argc--;
            currArg++;
            if (argc <= 0)
                BAIL_ON_FAILURE (E_FAIL);

            pszCurrPref = strtok(argv[currArg], "=");
            pszCurrPrefValue = strtok(NULL, "=");
            if (!pszCurrPref || !pszCurrPrefValue)
                BAIL_ON_FAILURE(E_FAIL);

            if (!_stricmp(pszCurrPref, "SecureAuth")) {
                if (!_stricmp(pszCurrPrefValue, "yes" ))
                    dwAuthFlags |= ADS_SECURE_AUTHENTICATION;
                else if (!_stricmp(pszCurrPrefValue, "no" ))
                    dwAuthFlags &= ~ADS_SECURE_AUTHENTICATION;
                else
                    BAIL_ON_FAILURE(E_FAIL);
            }
            else if (!_stricmp(pszCurrPref, "UseEncrypt")) {
                if (!_stricmp(pszCurrPrefValue, "yes" ))
                    dwAuthFlags |= ADS_USE_ENCRYPTION;
                else if (!_stricmp(pszCurrPrefValue, "no" ))
                    dwAuthFlags &= ~ADS_USE_ENCRYPTION;
                else
                    BAIL_ON_FAILURE(E_FAIL);
            }
            else
                BAIL_ON_FAILURE(E_FAIL);
            break;

        case 'p':
            argc--;
            currArg++;
            if (argc <= 0)
                BAIL_ON_FAILURE (E_FAIL);

            pszCurrPref = strtok(argv[currArg], "=");
            pszCurrPrefValue = strtok(NULL, "=");
            if (!pszCurrPref || !pszCurrPrefValue)
                BAIL_ON_FAILURE(E_FAIL);

            if (!_stricmp(pszCurrPref, "asynchronous")) {
                pSearchPref[dwCurrPref].dwSearchPref = ADS_SEARCHPREF_ASYNCHRONOUS;
                pSearchPref[dwCurrPref].vValue.dwType = ADSTYPE_BOOLEAN;
                if (!_stricmp(pszCurrPrefValue, "yes" ))
                    pSearchPref[dwCurrPref].vValue.Boolean = TRUE;
                else if (!_stricmp(pszCurrPrefValue, "no" ))
                    pSearchPref[dwCurrPref].vValue.Boolean = FALSE;
                else
                    BAIL_ON_FAILURE(E_FAIL);
            }
            else if (!_stricmp(pszCurrPref, "attrTypesOnly")) {
                pSearchPref[dwCurrPref].dwSearchPref = ADS_SEARCHPREF_ATTRIBTYPES_ONLY;
                pSearchPref[dwCurrPref].vValue.dwType = ADSTYPE_BOOLEAN;
                if (!_stricmp(pszCurrPrefValue, "yes" ))
                    pSearchPref[dwCurrPref].vValue.Boolean = TRUE;
                else if (!_stricmp(pszCurrPrefValue, "no" ))
                    pSearchPref[dwCurrPref].vValue.Boolean = FALSE;
                else
                    BAIL_ON_FAILURE(E_FAIL);
            }
            else if (!_stricmp(pszCurrPref, "derefAliases")) {
                pSearchPref[dwCurrPref].dwSearchPref = ADS_SEARCHPREF_DEREF_ALIASES;
                pSearchPref[dwCurrPref].vValue.dwType = ADSTYPE_INTEGER;
                if (!_stricmp(pszCurrPrefValue, "yes" ))
                    pSearchPref[dwCurrPref].vValue.Integer = ADS_DEREF_ALWAYS;
                else if (!_stricmp(pszCurrPrefValue, "no" ))
                    pSearchPref[dwCurrPref].vValue.Integer = ADS_DEREF_NEVER;
                else
                    BAIL_ON_FAILURE(E_FAIL);
            }
            else if (!_stricmp(pszCurrPref, "timeOut")) {
                pSearchPref[dwCurrPref].dwSearchPref = ADS_SEARCHPREF_TIMEOUT;
                pSearchPref[dwCurrPref].vValue.dwType = ADSTYPE_INTEGER;
                pSearchPref[dwCurrPref].vValue.Integer = atoi(pszCurrPrefValue);
            }
            else if (!_stricmp(pszCurrPref, "timeLimit")) {
                pSearchPref[dwCurrPref].dwSearchPref = ADS_SEARCHPREF_TIME_LIMIT;
                pSearchPref[dwCurrPref].vValue.dwType = ADSTYPE_INTEGER;
                pSearchPref[dwCurrPref].vValue.Integer = atoi(pszCurrPrefValue);
            }
            else if (!_stricmp(pszCurrPref, "sizeLimit")) {
                pSearchPref[dwCurrPref].dwSearchPref = ADS_SEARCHPREF_SIZE_LIMIT;
                pSearchPref[dwCurrPref].vValue.dwType = ADSTYPE_INTEGER;
                pSearchPref[dwCurrPref].vValue.Integer = atoi(pszCurrPrefValue);
            }
            else if (!_stricmp(pszCurrPref, "PageSize")) {
                pSearchPref[dwCurrPref].dwSearchPref = ADS_SEARCHPREF_PAGESIZE;
                pSearchPref[dwCurrPref].vValue.dwType = ADSTYPE_INTEGER;
                pSearchPref[dwCurrPref].vValue.Integer = atoi(pszCurrPrefValue);
            }
            else if (!_stricmp(pszCurrPref, "PagedTimeLimit")) {
                pSearchPref[dwCurrPref].dwSearchPref = ADS_SEARCHPREF_PAGED_TIME_LIMIT;
                pSearchPref[dwCurrPref].vValue.dwType = ADSTYPE_INTEGER;
                pSearchPref[dwCurrPref].vValue.Integer = atoi(pszCurrPrefValue);
            }
            else if (!_stricmp(pszCurrPref, "SearchScope")) {
                pSearchPref[dwCurrPref].dwSearchPref = ADS_SEARCHPREF_SEARCH_SCOPE;
                pSearchPref[dwCurrPref].vValue.dwType = ADSTYPE_INTEGER;
                if (!_stricmp(pszCurrPrefValue, "Base" ))
                    pSearchPref[dwCurrPref].vValue.Integer = ADS_SCOPE_BASE;
                else if (!_stricmp(pszCurrPrefValue, "OneLevel" ))
                    pSearchPref[dwCurrPref].vValue.Integer = ADS_SCOPE_ONELEVEL;
                else if (!_stricmp(pszCurrPrefValue, "Subtree" ))
                    pSearchPref[dwCurrPref].vValue.Integer = ADS_SCOPE_SUBTREE;
                else
                    BAIL_ON_FAILURE(E_FAIL);
            }
            else if (!_stricmp(pszCurrPref, "ChaseReferrals")) {
                pSearchPref[dwCurrPref].dwSearchPref = ADS_SEARCHPREF_CHASE_REFERRALS;
                pSearchPref[dwCurrPref].vValue.dwType = ADSTYPE_INTEGER;
                if (!_stricmp(pszCurrPrefValue, "always" ))
                    pSearchPref[dwCurrPref].vValue.Integer = ADS_CHASE_REFERRALS_ALWAYS;
                else if (!_stricmp(pszCurrPrefValue, "never" ))
                    pSearchPref[dwCurrPref].vValue.Integer = ADS_CHASE_REFERRALS_NEVER;
                else if (!_stricmp(pszCurrPrefValue, "external" ))
                    pSearchPref[dwCurrPref].vValue.Integer = ADS_CHASE_REFERRALS_EXTERNAL;
                else if (!_stricmp(pszCurrPrefValue, "subordinate" ))
                    pSearchPref[dwCurrPref].vValue.Integer = ADS_CHASE_REFERRALS_SUBORDINATE;
                else
                    BAIL_ON_FAILURE(E_FAIL);
            }
            else if (!_stricmp(pszCurrPref, "SortOn")) {
                pSearchPref[dwCurrPref].dwSearchPref = ADS_SEARCHPREF_SORT_ON;
                pSearchPref[dwCurrPref].vValue.dwType = ADSTYPE_PROV_SPECIFIC;

                pszAttr = strtok(pszCurrPrefValue, ",");

                for (nAttr=0; pszAttr && nAttr < 10; nAttr++) {

                    pSortKey[nAttr].pszAttrType = AllocateUnicodeString(pszAttr);
                    pSortKey[nAttr].pszReserved = NULL;
                    pSortKey[nAttr].fReverseorder = 0;
          nSortKeys++;

                    pszAttr = strtok(NULL, ",");
                }
                if (nAttr == 0 && nAttr >= 10) {
                    BAIL_ON_FAILURE(E_FAIL);
                }

                pSearchPref[dwCurrPref].vValue.ProviderSpecific.dwLength = sizeof(ADS_SORTKEY) * nAttr;
                pSearchPref[dwCurrPref].vValue.ProviderSpecific.lpValue = (LPBYTE) pSortKey;
            }
            else if (!_stricmp(pszCurrPref, "cacheResults")) {
                pSearchPref[dwCurrPref].dwSearchPref = ADS_SEARCHPREF_CACHE_RESULTS;
                pSearchPref[dwCurrPref].vValue.dwType = ADSTYPE_BOOLEAN;
                if (!_stricmp(pszCurrPrefValue, "yes" ))
                    pSearchPref[dwCurrPref].vValue.Boolean = TRUE;
                else if (!_stricmp(pszCurrPrefValue, "no" ))
                    pSearchPref[dwCurrPref].vValue.Boolean = FALSE;
                else
                    BAIL_ON_FAILURE(E_FAIL);
            }
            else
                BAIL_ON_FAILURE(E_FAIL);

            dwCurrPref++;
            break;

        case 'n':
            argc--;
            currArg++;
            if (argc <= 0)
                BAIL_ON_FAILURE (E_FAIL);
            dwMaxRows = atoi(argv[currArg]);
            break;

       default:
            BAIL_ON_FAILURE(E_FAIL);
        }

        argc--;
        currArg++;
    }

    //
    // Check for Mandatory arguments;
    //

    if (!pszSearchBase || !pszSearchFilter)
        BAIL_ON_FAILURE(E_FAIL);

    if (dwNumberAttributes == 0) {
        //
        // Get all the attributes
        //
        dwNumberAttributes = -1;
    }

    return (S_OK);
error:

    PrintUsage();
    return E_FAIL;

}

LPWSTR RemoveWhiteSpaces ( LPWSTR pszText )

Definition at line 585 of file main.cxx.

{
    LPWSTR pChar;

    if(!pszText)
        return (pszText);

    while(*pszText && iswspace(*pszText))
        pszText++;

    for(pChar = pszText + wcslen(pszText) - 1; pChar >= pszText; pChar--) {
        if(!iswspace(*pChar))
            break;
        else
            *pChar = L'\0';
    }

    return pszText;
}

Generated on Wed Nov 13 2024 16:53:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/General/DsSrch/util.cxx File Reference

  • NetDS
  • ADSI
  • samples
  • General
  • DsSrch
Functions

util.cxx File Reference

#include "main.hxx"

Go to the source code of this file.

Functions

LPWSTR | AllocateUnicodeString (LPSTR pAnsiString)
int | AnsiToUnicodeString (LPSTR pAnsi, LPWSTR pUnicode, DWORD StringLength)
void | FreeUnicodeString (LPWSTR pUnicodeString)
void | PrintColumn (PADS_SEARCH_COLUMN pColumn, LPWSTR pszColumnName)
void | PrintUsage (void)

Function Documentation

LPWSTR AllocateUnicodeString ( LPSTR pAnsiString )

Definition at line 191 of file util.cxx.

{
    LPWSTR  pUnicodeString = NULL;

    if (!pAnsiString)
        return NULL;

    pUnicodeString = (LPWSTR)LocalAlloc(
                        LPTR,
                        strlen(pAnsiString)*sizeof(WCHAR) +sizeof(WCHAR)
                        );

    if (pUnicodeString) {

        AnsiToUnicodeString(
            pAnsiString,
            pUnicodeString,
            NULL_TERMINATED
            );
    }

    return pUnicodeString;
}

int AnsiToUnicodeString | ( | LPSTR | pAnsi,
 |  | LPWSTR | pUnicode,
 |  | DWORD | StringLength
 | ) |  |

Definition at line 164 of file util.cxx.

{
    int iReturn;

    if( StringLength == NULL_TERMINATED )
        StringLength = strlen( pAnsi );

    iReturn = MultiByteToWideChar(CP_ACP,
                                  MB_PRECOMPOSED,
                                  pAnsi,
                                  StringLength + 1,
                                  pUnicode,
                                  StringLength + 1 );

    //
    // Ensure NULL termination.
    //
    pUnicode[StringLength] = 0;

    return iReturn;
}

void FreeUnicodeString ( LPWSTR pUnicodeString )

Definition at line 219 of file util.cxx.

{
    if (!pUnicodeString)
        return;

    LocalFree(pUnicodeString);

    return;
}

void PrintColumn | ( | PADS_SEARCH_COLUMN | pColumn,
 |  | LPWSTR | pszColumnName
 | ) |  |

Definition at line 54 of file util.cxx.

{

    ULONG j, k;

    if (!pColumn) {
        return;
    }

    wprintf(
        L"%s = ",
        pszColumnName
        );

    for (k=0; k < pColumn->dwNumValues; k++) {
        if (k > 0)
            wprintf(L"#  ");

        switch(pColumn->dwADsType) {
        case ADSTYPE_DN_STRING         :
            wprintf(
                L"%s  ",
                (LPWSTR) pColumn->pADsValues[k].DNString
                );
            break;
        case ADSTYPE_CASE_EXACT_STRING :
            wprintf(
                L"%s  ",
                (LPWSTR) pColumn->pADsValues[k].CaseExactString
                );
            break;
        case ADSTYPE_CASE_IGNORE_STRING:
            wprintf(
                L"%s  ",
                (LPWSTR) pColumn->pADsValues[k].CaseIgnoreString
                );
            break;
        case ADSTYPE_PRINTABLE_STRING  :
            wprintf(
                L"%s  ",
                (LPWSTR) pColumn->pADsValues[k].PrintableString
                );
            break;
        case ADSTYPE_NUMERIC_STRING    :
            wprintf(
                L"%s  ",
                (LPWSTR) pColumn->pADsValues[k].NumericString
                );
            break;

        case ADSTYPE_OBJECT_CLASS    :
            wprintf(
                L"%s  ",
                (LPWSTR) pColumn->pADsValues[k].ClassName
                );
            break;

        case ADSTYPE_BOOLEAN           :
            wprintf(
                L"%s  ",
                (DWORD) pColumn->pADsValues[k].Boolean ?
                L"TRUE" : L"FALSE"
                );
            break;

        case ADSTYPE_INTEGER           :
            wprintf(
                L"%d  ",
                (DWORD) pColumn->pADsValues[k].Integer
                );
            break;

        case ADSTYPE_OCTET_STRING      :
            for (j=0; j<pColumn->pADsValues[k].OctetString.dwLength; j++) {
                printf(
                    "%02x",
                    ((BYTE *)pColumn->pADsValues[k].OctetString.lpValue)[j]
                    );
            }
            break;

        case ADSTYPE_LARGE_INTEGER     :
            wprintf(
                L"%I64d  ",
                pColumn->pADsValues[k].LargeInteger
                );
            break;

        case ADSTYPE_UTC_TIME          :
            wprintf(
                L"(date value) "
                );
            break;
        case ADSTYPE_PROV_SPECIFIC     :
            wprintf(
                L"(provider specific value) "
                );
            break;

        }
    }

    printf("\n");
}

void PrintUsage ( void )

Definition at line 19 of file util.cxx.

{
    printf("\nUsage: dssrch /b <baseObject> /f <search_filter> [/f <attrlist>] [/p <preference>=value>] ");
    printf(" [/u <UserName> <Password>] [/t <flagName>=<value> \n");
    printf("\n   where:\n" );
    printf("   baseObject     = ADsPath of the base of the search\n");
    printf("   search_filter  = search filter string in LDAP format\n" );
    printf("   attrlist       = list of the attributes to display\n" );
    printf("   preference could be one of:\n");
    printf("   Asynchronous, AttrTypesOnly, DerefAliases, SizeLimit, TimeLimit,\n");
    printf("   TimeOut, PageSize, SearchScope, SortOn, CacheResults\n");
    printf("   flagName could be one of:\n");
    printf("   SecureAuth or UseEncrypt\n");
    printf("   value is yes/no for a Boolean and the respective integer for integers\n");
    printf("   scope is one of \"Base\", \"OneLevel\", or \"Subtree\"\n");

    printf("\nFor Example: dssrch /b NDS://ntmarst/ms /f \"(object Class=*)\" ");
    printf(" /a  \"ADsPath, name, description\" /p searchScope=onelevel /p searchscope=onelevel\n\n OR \n");

    printf("\n dssrch /b \"LDAP://test.mysite.com/");
    printf("OU=testOU,DC=test,DC=mysite,DC=com\"  /f \"(objectClass=*)\"  /a \"ADsPath, name, usnchanged\" ");
    printf(" /u \"CN=user1,CN=Users,DC=test,DC=mysite,DC=COM\" \"secret~1\" ");
    printf("/p searchScope=onelevel /t secureauth=yes /p SortOn=name /p CacheResults=no\n");

}

Generated on Wed Nov 13 2024 16:53:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Start/Binding/vc/Binding.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • Start
  • Binding
  • vc
Functions

Binding.cpp File Reference

#include "stdafx.h"
#include "stdio.h"
#include "activeds.h"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])

Function Documentation

int main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 9 of file Binding.cpp.

{
  CoInitialize(NULL);

  HRESULT hr;
  IADs *pADs = NULL;
  /////////////////////////////////////////
  // Binding as currently logged on user
  ////////////////////////////////////////
  hr = ADsGetObject( L"WinNT://INDEPENDENCE/JSmith,user", IID_IADs, (void**) &pADs );

  if ( !SUCCEEDED(hr) )
  {
    return hr;
  }

  //... do some operations here
  pADs->Release(); // Do not forget to release when you're done.

  /////////////////////////////////////////
  // Binding with alternate credentials
  ////////////////////////////////////////
  hr = ADsOpenObject(L"WinNT://INDEPENDENCE/JSmith,user", L"Administrator", L"secret", ADS_SECURE_AUTHENTICATION, IID_IADs, (void**) &pADs );
  if ( !SUCCEEDED(hr) )
  {
    return hr;
  }

  //...
  // Make sure you release it after use
  pADs->Release();

  CoUninitialize();
  return 0;
}

Generated on Wed Nov 13 2024 16:53:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Start/Binding/vc/StdAfx.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • Start
  • Binding
  • vc

StdAfx.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Start/Binding/vc/StdAfx.h File Reference

  • NetDS
  • ADSI
  • samples
  • Start
  • Binding
  • vc

StdAfx.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Start/Child/vc/Child.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • Start
  • Child
  • vc
Defines | Functions

Child.cpp File Reference

#include "stdafx.h"
#include "stdio.h"
#include "activeds.h"

Go to the source code of this file.

Defines

#define | RETURN_ON_FAILURE(hr) if(!SUCCEEDED(hr)) return hr;

Functions

int | main (int argc, char *argv[])

Define Documentation

#define RETURN_ON_FAILURE ( hr ) if(!SUCCEEDED(hr)) return hr;

Definition at line 8 of file Child.cpp.

Function Documentation

int main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 11 of file Child.cpp.

{
  HRESULT hr;

  CoInitialize(NULL);

  IADsContainer *pCont=NULL;

  hr = ADsGetObject(L"LDAP://DC=mydomain2,DC=mydomain1,DC=microsoft,DC=com",
                  IID_IADsContainer,
            (void**) &pCont );

  RETURN_ON_FAILURE(hr);

  /////////////////////////////////////////////////////////////
  // Get the child from the container
  // Note in the LDAP provider you can go down more than one level
  ///////////////////////////////////////////////////////////////
  IDispatch *pDisp = NULL;
  IADs    *pADs  = NULL;
  hr = pCont->GetObject(L"user", L"CN=Mike Smith, OU=myou1", &pDisp );
  pCont->Release();

  RETURN_ON_FAILURE(hr);

  hr = pDisp->QueryInterface( IID_IADs, (void**) &pADs );
  pDisp->Release();
  RETURN_ON_FAILURE(hr);

  // ... do something with pADs here .
  pADs->Release();

  CoUninitialize();
  return 0;
}

Generated on Wed Nov 13 2024 16:53:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Start/Child/vc/StdAfx.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • Start
  • Child
  • vc

StdAfx.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Start/Child/vc/StdAfx.h File Reference

  • NetDS
  • ADSI
  • samples
  • Start
  • Child
  • vc

StdAfx.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Start/Create/vc/Create.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • Start
  • Create
  • vc
Functions

Create.cpp File Reference

#include "stdafx.h"
#include "stdio.h"
#include "activeds.h"

Go to the source code of this file.

Functions

HRESULT | CreateUserIADsContainer (void)
HRESULT | CreateUserIDirectoryObject (void)
int | main (int argc, char *argv[])

Function Documentation

HRESULT CreateUserIADsContainer ( void )

Definition at line 8 of file Create.cpp.

{
HRESULT hr;
IADsContainer *pCont = NULL;
IDispatch *pDisp=NULL;
IADsUser *pIADsUser=NULL;

///////////////////////////////////////////////////
// Create a user using IADsContainer::Create
////////////////////////////////////////////////////
hr = ADsGetObject( L"WinNT://seyitb-dev", IID_IADsContainer, (void**) &pCont );
if (FAILED(hr) )
  return hr;

hr = pCont->Create(L"user", L"AliceW", &pDisp );
pCont->Release();

if(FAILED(hr) )
  return hr;

hr = pDisp->QueryInterface( IID_IADsUser, (void**) &pIADsUser );
if (FAILED(hr))
    return hr;

//do NOT hard code your password into the source code in production code
//take user input instead
pIADsUser->SetPassword(L"MysEcret1");
hr = pIADsUser->SetInfo(); // Commit
if(SUCCEEDED(hr))
    wprintf(L"User created successfully\n");

pIADsUser->Release();

return hr;
}

HRESULT CreateUserIDirectoryObject ( void )

Definition at line 47 of file Create.cpp.

{
///////////////////////////////////////////////////////////
// Use IDirectoryObject to create an object
////////////////////////////////////////////////////////////
HRESULT hr;
IDispatch *pDisp=NULL;
IDirectoryObject *pDirObject=NULL;
ADSVALUE   sAMValue;
ADSVALUE   uPNValue;
ADSVALUE   classValue;

ADS_ATTR_INFO  attrInfo[] =
{
  { L"objectClass",   ADS_ATTR_UPDATE,
                    ADSTYPE_CASE_IGNORE_STRING, &classValue, 1 },
  {L"sAMAccountName", ADS_ATTR_UPDATE,
                        ADSTYPE_CASE_IGNORE_STRING, &sAMValue, 1},
  {L"userPrincipalName", ADS_ATTR_UPDATE,
                        ADSTYPE_CASE_IGNORE_STRING, &uPNValue, 1},
};
DWORD dwAttrs = sizeof(attrInfo)/sizeof(ADS_ATTR_INFO);

classValue.dwType = ADSTYPE_CASE_IGNORE_STRING;
classValue.CaseIgnoreString = L"user";

sAMValue.dwType=ADSTYPE_CASE_IGNORE_STRING;
sAMValue.CaseIgnoreString = L"mikes";

uPNValue.dwType=ADSTYPE_CASE_IGNORE_STRING;
uPNValue.CaseIgnoreString = L"mikes@fabrikam.com";

// Create this user in an organizational unit
hr = ADsGetObject(L"LDAP://OU=MyOU,DC=fabrikam,DC=com",
            IID_IDirectoryObject, (void**) &pDirObject );

if ( SUCCEEDED(hr) )
{
  hr = pDirObject->CreateDSObject( L"CN=Mike Smith",  attrInfo,
                   dwAttrs, &pDisp );
  if ( SUCCEEDED(hr) )
  {
    pDisp->Release();
  }
    pDirObject->Release();
}

return hr;
}

int main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 97 of file Create.cpp.

{
HRESULT hr;
CoInitialize(NULL);

// Create a local user account
hr = CreateUserIADsContainer();
wprintf(L"Result: 0x%x\n", hr);

// Create a domain user account in Active Directory
// hr = CreateUserIDirectoryObject();
// wprintf(L"Result: 0x%x\n", hr);

CoUninitialize();
return 0;
}

Generated on Wed Nov 13 2024 16:53:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Start/Create/vc/StdAfx.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • Start
  • Create
  • vc

StdAfx.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Start/Create/vc/StdAfx.h File Reference

  • NetDS
  • ADSI
  • samples
  • Start
  • Create
  • vc

StdAfx.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Start/Delete/vc/Delete.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • Start
  • Delete
  • vc
Functions

Delete.cpp File Reference

#include "stdafx.h"
#include "stdio.h"
#include "activeds.h"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])

Function Documentation

int main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 8 of file Delete.cpp.

{
  HRESULT hr;
  IADsContainer *pCont=NULL;

  CoInitialize(NULL);

  hr = ADsGetObject(L"WinNT://INDEPENDENCE", IID_IADsContainer, (void**) &pCont);
  if ( !SUCCEEDED(hr) )
  {
    return 0;
  }

  ///////////////////////////////////////////////////
  // Using IADsContainer::Delete to delete a user
  //////////////////////////////////////////////////
  hr = pCont->Delete(L"user", L"AliceW");
  pCont->Release();

  /////////////////////////////////////////////////////////////
  // Using IDirectoryObject::DeleteDSObject to delete a user
  //////////////////////////////////////////////////////////////
  IDirectoryObject *pDirObject=NULL;

  hr = ADsGetObject(L"LDAP://OU=testOU,DC=testDom1,DC=testDom2,DC=microsoft,DC=com",
                      IID_IDirectoryObject, (void**) &pDirObject );

  if ( SUCCEEDED(hr) )
  {
    hr = pDirObject->DeleteDSObject(L"CN=Mike Smith");
    pDirObject->Release();
  }

  CoUninitialize();

  return 0;
}

Generated on Wed Nov 13 2024 16:53:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Start/Delete/vc/StdAfx.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • Start
  • Delete
  • vc

StdAfx.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Start/Delete/vc/StdAfx.h File Reference

  • NetDS
  • ADSI
  • samples
  • Start
  • Delete
  • vc

StdAfx.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Start/Enum/vc/Enum.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • Start
  • Enum
  • vc
Functions

Enum.cpp File Reference

#include "stdafx.h"
#include "stdio.h"
#include "activeds.h"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])

Function Documentation

int main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 11 of file Enum.cpp.

{
  HRESULT hr;
  IADsContainer *pCont;
  CoInitialize(NULL);

  ////////////////////////////////
  // Bind to a domain object
  //////////////////////////////////
  hr = ADsGetObject(L"WinNT://INDEPENDENCE", IID_IADsContainer, (void**) &pCont );
  if ( !SUCCEEDED(hr) )
  {
    return 0;
  }

  /////////////////////////////////
  // Enumerate
  /////////////////////////////////
  IEnumVARIANT *pEnum = NULL;
  hr = ADsBuildEnumerator( pCont, &pEnum );
  if ( SUCCEEDED(hr) )
  {
    VARIANT var;
    ULONG   lFetch;
    IADs   *pChild=NULL;
    VariantInit(&var);

    while( SUCCEEDED(ADsEnumerateNext( pEnum, 1, &var, &lFetch )) && lFetch == 1 )
    {
      hr = V_DISPATCH(&var)->QueryInterface( IID_IADs, (void**) &pChild );
      if ( SUCCEEDED(hr) )
      {
        BSTR bstrName;
        BSTR bstrClass;
        // Get more information on the child classes
        pChild->get_Name(&bstrName);
        pChild->get_Class(&bstrClass);

        printf("%S\t(%S)\n", bstrName, bstrClass );

        // Clean-up
        SysFreeString(bstrName);
        SysFreeString(bstrClass);

        pChild->Release();

      }
      VariantClear(&var);
    }

  }

  if ( pEnum )
  {
    ADsFreeEnumerator( pEnum );
  }

  pCont->Release();

  CoUninitialize();
  return 0;
}

Generated on Wed Nov 13 2024 16:53:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Start/Enum/vc/StdAfx.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • Start
  • Enum
  • vc

StdAfx.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Start/Enum/vc/StdAfx.h File Reference

  • NetDS
  • ADSI
  • samples
  • Start
  • Enum
  • vc

StdAfx.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Start/Filter/vc/Filter.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • Start
  • Filter
  • vc
Functions

Filter.cpp File Reference

#include "stdafx.h"
#include "stdio.h"
#include "activeds.h"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])

Function Documentation

int main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 9 of file Filter.cpp.

{
  HRESULT hr;
  IADsContainer *pCont=NULL;

  CoInitialize(NULL);
  ///////////////////////////////////
  // Bind to the object
  /////////////////////////////////
  hr = ADsGetObject(L"WinNT://INDEPENDENCE", IID_IADsContainer, (void**) &pCont );
  if ( !SUCCEEDED(hr) )
  {
    return hr;
  }

  ///////////////////////////////////
  // Build variant filter
  /////////////////////////////////
  LPWSTR pszFilter[] = { L"user", L"group" };
  DWORD dwNumber = sizeof( pszFilter ) /sizeof(LPWSTR);
  VARIANT var;

  hr = ADsBuildVarArrayStr( pszFilter, dwNumber, &var );

  if ( !SUCCEEDED(hr) )
  {
    pCont->Release();
    return hr;
  }

  ///////////////////////////////////
  // Set the filter
  /////////////////////////////////

  hr = pCont->put_Filter(var);
  VariantClear(&var);

  if (!SUCCEEDED(hr) )
  {
    pCont->Release();
    return hr;
  }

  ////////////////////////////////////////////
  // Enumerate the result
  ///////////////////////////////////////////////
  IEnumVARIANT *pEnum = NULL;
  hr = ADsBuildEnumerator( pCont, &pEnum );
  pCont->Release(); // no longer needed, since we have the enumerator already

  if ( SUCCEEDED(hr) )
  {
    VARIANT var;
    ULONG lFetch;
    IADs *pChild=NULL;
    VariantInit(&var);

    while( SUCCEEDED(ADsEnumerateNext( pEnum, 1, &var, &lFetch )) && lFetch == 1 )
    {
      hr = V_DISPATCH(&var)->QueryInterface( IID_IADs, (void**) &pChild );
      if ( SUCCEEDED(hr) )
      {
        BSTR bstrName;
        BSTR bstrClass;
        // Get more information on the child classes
        pChild->get_Name(&bstrName);
        pChild->get_Class(&bstrClass);

        printf("%S\t\t(%S)\n", bstrName, bstrClass );

        // Clean-up
        SysFreeString(bstrName);
        SysFreeString(bstrClass);

        pChild->Release();
      }
      VariantClear(&var);
    }
  }

              if ( pEnum )
  {
    ADsFreeEnumerator( pEnum );
  }

  CoUninitialize();

  return 0;
}

Generated on Wed Nov 13 2024 16:53:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Start/Filter/vc/StdAfx.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • Start
  • Filter
  • vc

StdAfx.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Start/Filter/vc/StdAfx.h File Reference

  • NetDS
  • ADSI
  • samples
  • Start
  • Filter
  • vc

StdAfx.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Start/First/vc/First.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • Start
  • First
  • vc
Functions

First.cpp File Reference

#include "stdafx.h"
#include "activeds.h"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])

Function Documentation

int main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 7 of file First.cpp.

{
  HRESULT hr;
  IADsContainer *pCont;

  CoInitialize(NULL);

  hr = ADsGetObject(L"WinNT://YOURDOMAIN", IID_IADsContainer, (void**) &pCont );

  if ( !SUCCEEDED(hr) )
  {
    return 0;
  }

  //----------------------------
  // Creating a user
  //-----------------------------
  IDispatch *pDisp=NULL;
  IADs *pUser;
  hr = pCont->Create( L"user", L"jsmith", &pDisp );
  pCont->Release();

  if ( !SUCCEEDED(hr) )
  {
    return 0;
  }

  hr = pDisp->QueryInterface( IID_IADs, (void**) &pUser );
    pDisp->Release();

  if ( !SUCCEEDED(hr) )
  {
    return 0;
  }

  // Commit creation to the directory
  pUser->SetInfo();

  // Release the object
  pUser->Release();

  CoUninitialize();

  return 0;
}

Generated on Wed Nov 13 2024 16:53:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Start/First/vc/StdAfx.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • Start
  • First
  • vc

StdAfx.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Start/First/vc/StdAfx.h File Reference

  • NetDS
  • ADSI
  • samples
  • Start
  • First
  • vc

StdAfx.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Start/Move/vc/Move.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • Start
  • Move
  • vc
Functions

Move.cpp File Reference

#include "stdafx.h"
#include "stdio.h"
#include "activeds.h"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])

Function Documentation

int main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 9 of file Move.cpp.

{
  CoInitialize(NULL);

  ////////////////////////////////////////////
  // First bind to the destination container
  ////////////////////////////////////////////
  HRESULT hr;
  IADsContainer *pCont=NULL;
    hr = ADsGetObject(L"LDAP://OU=trOU,DC=domain1,DC=domain2,DC=microsoft,DC=com",
                  IID_IADsContainer,
            (void**) &pCont );

  if ( !SUCCEEDED(hr) )
  {
    return 0;
  }

  /////////////////////////////////////////////////
  // Now, move the object to the bound container
  ///////////////////////////////////////////////////
  IDispatch *pDisp=NULL;

  hr = pCont->MoveHere(L"LDAP://CN=Mike Smith,OU=srOU,DC=domain1,DC=domain2,DC=microsoft,DC=com", NULL, &pDisp );
  pCont->Release();

  if (SUCCEEDED(hr) )
  {
    // You may do other operation here, such as updating attributes
    pDisp->Release();
  }

  CoUninitialize();
  return 0;
}

Generated on Wed Nov 13 2024 16:53:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Start/Move/vc/StdAfx.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • Start
  • Move
  • vc

StdAfx.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Start/Move/vc/StdAfx.h File Reference

  • NetDS
  • ADSI
  • samples
  • Start
  • Move
  • vc

StdAfx.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Start/Parent/vc/Parent.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • Start
  • Parent
  • vc
Functions

Parent.cpp File Reference

#include "stdafx.h"
#include "activeds.h"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])

Function Documentation

int main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 8 of file Parent.cpp.

{
  HRESULT hr;

  CoInitialize(NULL);

  /////////////////////////////////////////
  //Bind to an object
  /////////////////////////////////////////
  IADs *pADs = NULL;
  hr = ADsGetObject(L"WinNT://INDEPENDENCE/JJohnson", IID_IADs, (void**) &pADs );
  if (!SUCCEEDED(hr) )
  {
    return hr;
  }

  BSTR bstrParent;
  IADs *pParent=NULL;

  //////////////////////////////
  // Get the ADs Parent's Path
  //////////////////////////////
  pADs->get_Parent(&bstrParent);
  pADs->Release();

  ////////////////////////////////
  // Bind to the Parent
  ////////////////////////////////
  hr = ADsGetObject( bstrParent, IID_IADs, (void**) &pParent );
  SysFreeString(bstrParent);

  if (SUCCEEDED(hr) )
  {
    // do something with pParent...
    pParent->Release();
  }

  CoUninitialize();
  return 0;
}

Generated on Wed Nov 13 2024 16:53:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Start/Parent/vc/StdAfx.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • Start
  • Parent
  • vc

StdAfx.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Start/Parent/vc/StdAfx.h File Reference

  • NetDS
  • ADSI
  • samples
  • Start
  • Parent
  • vc

StdAfx.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Start/Read/vc/Read.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • Start
  • Read
  • vc
Functions

Read.cpp File Reference

#include "stdafx.h"
#include "stdio.h"
#include "activeds.h"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])

Function Documentation

int main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 9 of file Read.cpp.

{
  HRESULT hr;
  IADs *pUsr=NULL;

  CoInitialize(NULL);

  ////////////////////////////////////
  // Bind to a directory object
  /////////////////////////////////////
  hr = ADsGetObject(L"WinNT://INDEPENDENCE/Administrator,user", IID_IADs, (void**) &pUsr );
    if ( !SUCCEEDED(hr) )
    {
        return 0;
    }

  ///////////////////////////////////
  // Get a single value attribute
  ////////////////////////////////////
  VARIANT var;
  VariantInit(&var);

  hr = pUsr->Get(L"FullName", &var );
  if ( SUCCEEDED(hr) )
  {
    printf("FullName: %S\n", V_BSTR(&var) );
    VariantClear(&var);
  }

  if ( pUsr )
  {
    pUsr->Release();
  }

  ///////////////////////////////////////////////////////
  // Get a multi value attribute from a service object
  /////////////////////////////////////////////////////////
  IADs *pSvc = NULL;

  hr = ADsGetObject(L"WinNT://INDEPENDENCE/ANDYHAR11/Browser,service", IID_IADs, (void**) &pSvc );
  if ( !SUCCEEDED(hr) )
  {
    return hr;
  }

  hr = pSvc->Get(L"Dependencies", &var );
  if ( SUCCEEDED(hr) )
  {
    LONG lstart, lend;
    SAFEARRAY  *sa = V_ARRAY( &var );
    VARIANT varItem;

    // Get the lower and upper bound
      hr = SafeArrayGetLBound( sa, 1, &lstart );
                     hr = SafeArrayGetUBound( sa, 1, &lend );

    // Now iterate and print the content
    VariantInit(&varItem);
    printf("Getting service dependencies using IADs :\n");
    for ( long idx=lstart; idx < lend; idx++ )
    {
      hr = SafeArrayGetElement( sa, &idx, &varItem );
      printf("%S ", V_BSTR(&varItem));
      VariantClear(&varItem);
    }
    printf("\n");

    VariantClear(&var);
  }

  // Clean-up
  if ( pSvc )
  {
    pSvc->Release();
  }

  ///////////////////////////////////////////////////////////
  // Using IDirectoryObject to get a multivalue attribute
  // Note: NOT all providers support this interface
  ////////////////////////////////////////////////////////////
  IDirectoryObject  *pDirObject=NULL;
  ADS_ATTR_INFO   *pAttrInfo=NULL;
  DWORD       dwReturn;
  LPWSTR        pAttrNames[]={L"objectClass" };
  DWORD       dwNumAttr=sizeof(pAttrNames)/sizeof(LPWSTR);

  hr = ADsGetObject(L"LDAP://CN=Administrator,CN=Users,DC=testDom1,DC=testDom2,DC=microsoft,DC=com",
                  IID_IDirectoryObject,
            (void**) &pDirObject );

  if ( !SUCCEEDED(hr) )
  {
    return 0;
  }

  // Now get the attribute
  hr = pDirObject->GetObjectAttributes( pAttrNames,
                      dwNumAttr,
                                          &pAttrInfo,
                                          &dwReturn );
  if ( SUCCEEDED(hr) )
  {
    printf("Getting the objectClass multivalue attribute using IDirectoryObject :\n");
    for (DWORD val=0; val < pAttrInfo->dwNumValues; val++, pAttrInfo->pADsValues++)
        {
                printf("  %S\n", pAttrInfo->pADsValues->CaseIgnoreString);
        }
    FreeADsMem(pAttrInfo);
  }

  //Clean up
  pDirObject->Release();

  CoUninitialize();
  return 0;
}

Generated on Wed Nov 13 2024 16:53:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Start/Read/vc/StdAfx.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • Start
  • Read
  • vc

StdAfx.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Start/Read/vc/StdAfx.h File Reference

  • NetDS
  • ADSI
  • samples
  • Start
  • Read
  • vc

StdAfx.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Start/Rename/vc/Rename.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • Start
  • Rename
  • vc
Functions

Rename.cpp File Reference

#include "stdafx.h"
#include "stdio.h"
#include "activeds.h"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])

Function Documentation

int main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 8 of file Rename.cpp.

{
HRESULT hr;
IADsContainer *pCont=NULL;
IDispatch *pDisp=NULL;

CoInitialize(NULL);

hr = ADsGetObject(L"LDAP://CN=Users,DC=Microsoft,DC=COM", IID_IADsContainer, (void**) &pCont);
if (FAILED(hr) )
{
  return 0;
}

hr = pCont->MoveHere(L"LDAP://CN=Jeff Smith,CN=Users,DC=Microsoft,DC=COM",L"CN=Jeffrey Smith", &pDisp );
if ( SUCCEEDED(hr) )
{
  pDisp->Release();
}

CoUninitialize();

return 0;
}

Generated on Wed Nov 13 2024 16:53:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Start/Rename/vc/StdAfx.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • Start
  • Rename
  • vc

StdAfx.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Start/Rename/vc/StdAfx.h File Reference

  • NetDS
  • ADSI
  • samples
  • Start
  • Rename
  • vc

StdAfx.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Start/Schema/vc/Schema.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • Start
  • Schema
  • vc
Functions

Schema.cpp File Reference

#include "stdafx.h"
#include "stdio.h"
#include "activeds.h"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])

Function Documentation

int main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 9 of file Schema.cpp.

{
  IADsContainer *pSchema=NULL;
  HRESULT hr;

  CoInitialize(NULL);

  hr = ADsGetObject(L"WinNT://INDEPENDENCE/Schema", IID_IADsContainer, (void**) &pSchema );

  if ( !SUCCEEDED(hr) )
  {
    return hr;
  }

  ////////////// Enumerate Schema objects ///////////////////////////////////
  IEnumVARIANT *pEnum = NULL;
  hr = ADsBuildEnumerator( pSchema, &pEnum );
  pSchema->Release(); // no longer needed, since we have the enumerator already

  if ( SUCCEEDED(hr) )
  {
    VARIANT var;
    ULONG lFetch;
    IADs *pChild=NULL;
    VariantInit(&var);

    while( SUCCEEDED(ADsEnumerateNext( pEnum, 1, &var, &lFetch )) && lFetch == 1 )
    {
      hr = V_DISPATCH(&var)->QueryInterface( IID_IADs, (void**) &pChild );
      if ( SUCCEEDED(hr) )
      {
        BSTR bstrName;
        BSTR bstrClass;
        // Get more information on the child classes
        pChild->get_Name(&bstrName);
        pChild->get_Class(&bstrClass);

        printf("%S\t\t(%S)\n", bstrName, bstrClass );

        // Clean-up
        SysFreeString(bstrName);
        SysFreeString(bstrClass);

        pChild->Release();
      }
      VariantClear(&var);
    }
  }

              //Release the enumerator.
              if (pEnum != NULL)
              {
                  ADsFreeEnumerator(pEnum);
              }

  CoUninitialize();

  return 0;
}

Generated on Wed Nov 13 2024 16:53:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Start/Schema/vc/StdAfx.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • Start
  • Schema
  • vc

StdAfx.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Start/Schema/vc/StdAfx.h File Reference

  • NetDS
  • ADSI
  • samples
  • Start
  • Schema
  • vc

StdAfx.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Start/Search/vc/Search.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • Start
  • Search
  • vc
Functions

Search.cpp File Reference

#include "stdafx.h"
#include "stdio.h"
#include "activeds.h"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])

Function Documentation

int main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 9 of file Search.cpp.

{
  HRESULT hr;
  IDirectorySearch *pSearch;
  CoInitialize(NULL);

  ///////////////////////////////////////////////
  // Bind to Object, it serves as a base search
  ///////////////////////////////////////////////
  hr = ADsGetObject(L"LDAP://DC=testDom1,DC=testDom2,DC=microsoft,DC=com",
                  IID_IDirectorySearch,
            (void**) &pSearch );

  if ( !SUCCEEDED(hr) )
  {
    return hr;
  }

  ///////////////////////////////////////
  // We want a subtree search
  /////////////////////////////////////////
  ADS_SEARCHPREF_INFO prefInfo[1];
  prefInfo[0].dwSearchPref = ADS_SEARCHPREF_SEARCH_SCOPE;
  prefInfo[0].vValue.dwType = ADSTYPE_INTEGER;
  prefInfo[0].vValue.Integer = ADS_SCOPE_SUBTREE;
  hr = pSearch->SetSearchPreference( prefInfo, 1);

  ////////////////////////////////////
  // Prepared for attributed returned
  ////////////////////////////////////
  LPWSTR pszAttr[] = { L"Name"};
  ADS_SEARCH_HANDLE hSearch;
  DWORD dwCount= sizeof(pszAttr)/sizeof(LPWSTR);

  //////////////////////////////////////////
  // Search for all groups in a domain
  /////////////////////////////////////////////
  hr = pSearch->ExecuteSearch(L"(objectCategory=Group)", pszAttr, dwCount, &hSearch );

  if ( !SUCCEEDED(hr) )
  {
    pSearch->Release();
    return hr;
  }

  //////////////////////////////////////////
  // Now enumerate the result
  /////////////////////////////////////////////
  ADS_SEARCH_COLUMN col;
    while(  pSearch->GetNextRow(hSearch)  != S_ADS_NOMORE_ROWS )
    {
    // Get 'Name' attribute
    hr = pSearch->GetColumn( hSearch, pszAttr[0], &col );
    if ( SUCCEEDED(hr) )
    {
      printf("%S\n", col.pADsValues->CaseIgnoreString);
      pSearch->FreeColumn( &col ); // You need to FreeColum after use.
    }

    }

  ////////////////////
  // Clean-up
  ////////////////////////
    pSearch->CloseSearchHandle(hSearch);
  pSearch->Release();

  CoUninitialize();
  return 0;
}

Generated on Wed Nov 13 2024 16:53:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Start/Search/vc/StdAfx.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • Start
  • Search
  • vc

StdAfx.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Start/Search/vc/StdAfx.h File Reference

  • NetDS
  • ADSI
  • samples
  • Start
  • Search
  • vc

StdAfx.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Start/Write/vc/StdAfx.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • Start
  • Write
  • vc

StdAfx.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Start/Write/vc/StdAfx.h File Reference

  • NetDS
  • ADSI
  • samples
  • Start
  • Write
  • vc

StdAfx.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/ADSI/samples/Start/Write/vc/Write.cpp File Reference

  • NetDS
  • ADSI
  • samples
  • Start
  • Write
  • vc
Functions

Write.cpp File Reference

#include "stdafx.h"
#include "stdio.h"
#include "activeds.h"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])

Function Documentation

int main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 9 of file Write.cpp.

{
  HRESULT hr;
  IADs *pADs=NULL;
  LPWSTR pszADsPath = L"LDAP://CN=Jane Johnson,OU=testOU,DC=testDom1,DC=testDom2,DC=microsoft,DC=com";

  CoInitialize(NULL);

  ///////////////////////////////////
  // Modifying attributes via IADs
  ////////////////////////////////////
  hr = ADsGetObject(pszADsPath,
                  IID_IADs,
                (void**) &pADs );

  if (!SUCCEEDED(hr) )
  {
    return hr;
  }

  VARIANT var;

  // we omit checking result for brevity..

  // First Name
  VariantInit(&var);
  V_BSTR(&var) = SysAllocString(L"Janet");
  V_VT(&var) = VT_BSTR;
  hr = pADs->Put( L"givenName", var );

  // Last Name
  VariantClear(&var);
  V_BSTR(&var) = SysAllocString(L"Johns");
  V_VT(&var) = VT_BSTR;
  hr = pADs->Put( L"sn", var );
  VariantClear(&var);

  // Other Telephones
  LPWSTR pszPhones[] = { L"425 844 1234", L"425 924 4321" };
  DWORD dwNumber = sizeof( pszPhones ) /sizeof(LPWSTR);

  hr = ADsBuildVarArrayStr( pszPhones, dwNumber, &var );
  hr = pADs->Put( L"otherTelephone", var );
  VariantClear(&var);

  hr = pADs->SetInfo();
  pADs->Release();

  if (!SUCCEEDED(hr) )
  {

    return hr;
  }

  /////////////////////////////////////////////////
  // Alternatively, you can use IDirectoryObject
  //////////////////////////////////////////////////
  IDirectoryObject *pDir=NULL;
  hr = ADsGetObject(pszADsPath,
                  IID_IDirectoryObject,
                (void**) &pDir );

  if ( !SUCCEEDED(hr) )
  {
    return hr;
  }

  DWORD  dwReturn;
  ADSVALUE  snValue;
  ADSVALUE  fNameValue;
  ADSVALUE  phoneValue[2];

  ADS_ATTR_INFO  attrInfo[] = {
    {L"givenName",ADS_ATTR_UPDATE, ADSTYPE_CASE_IGNORE_STRING,&snValue,1},
    {L"sn", ADS_ATTR_UPDATE, ADSTYPE_CASE_IGNORE_STRING,&fNameValue,1 },
    {L"otherTelephone", ADS_ATTR_UPDATE, ADSTYPE_CASE_IGNORE_STRING, phoneValue,2 }
                };
  DWORD dwAttrs = sizeof(attrInfo)/sizeof(ADS_ATTR_INFO);

  ///// First Name ///////////
  fNameValue.dwType=ADSTYPE_CASE_IGNORE_STRING;
  fNameValue.CaseIgnoreString = L"Janet";

  ///// Last Name ///////////
  snValue.dwType= ADSTYPE_CASE_IGNORE_STRING;
  snValue.CaseIgnoreString = L"Johns";

  ///// Other Telephone ///////////
  phoneValue[0].dwType = ADSTYPE_CASE_IGNORE_STRING;
  phoneValue[0].CaseIgnoreString = L"425 844 1234";

  phoneValue[1].dwType = ADSTYPE_CASE_IGNORE_STRING;
  phoneValue[1].CaseIgnoreString = L"425 924 4321";

  hr = pDir->SetObjectAttributes(attrInfo, dwAttrs, &dwReturn);

  pDir->Release();

  if ( !SUCCEEDED(hr) )
  {
    return hr;
  }

  CoUninitialize();
  return 0;
}

Generated on Wed Nov 13 2024 16:53:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Bluetooth/bthcxn.cpp File Reference

  • NetDS
  • Bluetooth
Defines | Functions | Variables

bthcxn.cpp File Reference

#include <stdio.h>
#include <initguid.h>
#include <winsock2.h>
#include <ws2bth.h>

Go to the source code of this file.

Defines

#define | CXN_BDADDR_STR_LEN 17
#define | CXN_DELAY_NEXT_INQUIRY 15
#define | CXN_MAX_INQUIRY_RETRY 3
#define | CXN_TRANSFER_DATA_LENGTH 100

Functions

ULONG | AddrStringToBtAddr (IN const char *pszRemoteAddr, OUT BTH_ADDR *pRemoteBtAddr)
DEFINE_GUID (g_guidServiceClass, 0xb62c4e8d, 0x62cc, 0x404b, 0xbb, 0xbf, 0xbf, 0x3e, 0x3b, 0xbb, 0x13, 0x74)
int _cdecl | main (int argc, char *argv[])
ULONG | NameToBthAddr (IN const char *pszRemoteName, OUT BTH_ADDR *pRemoteBthAddr)
ULONG | ParseCmdLine (IN int argc, IN char *argv[])
ULONG | RunClientMode (IN ULONGLONG ululRemoteBthAddr, IN int iMaxCxnCycles=1)
ULONG | RunClientMode (ULONGLONG ululRemoteAddr, int iMaxCxnCycles)
ULONG | RunServerMode (IN int iMaxCxnCycles=1)
ULONG | RunServerMode (int iMaxCxnCycles)
void | ShowCmdLineHelp (void)

Variables

int | g_iOutputLevel = 0
char | g_szRemoteAddr [CXN_BDADDR_STR_LEN+1] = {0}
char | g_szRemoteName [BTH_MAX_NAME_SIZE+1] = {0}
int | g_ulMaxCxnCycles = 1

Define Documentation

#define CXN_BDADDR_STR_LEN 17

Definition at line 34 of file bthcxn.cpp.

#define CXN_DELAY_NEXT_INQUIRY 15

Definition at line 37 of file bthcxn.cpp.

#define CXN_MAX_INQUIRY_RETRY 3

Definition at line 36 of file bthcxn.cpp.

#define CXN_TRANSFER_DATA_LENGTH 100

Definition at line 35 of file bthcxn.cpp.

Function Documentation

ULONG AddrStringToBtAddr | ( | IN const char * | pszRemoteAddr,
 |  | OUT BTH_ADDR * | pRemoteBtAddr
 | ) |  |

Definition at line 319 of file bthcxn.cpp.

{
    ULONG ulAddrData[6], ulRetCode = 0;
    BTH_ADDR BtAddrTemp = 0;

    if ( ( NULL == pszRemoteAddr ) || ( NULL == pRemoteBtAddr ) )
    {
        ulRetCode = 1;
        goto CleanupAndExit;
    }

    *pRemoteBtAddr = 0;

    //
    // Populate a 6 membered array of unsigned long integers
    // by parsing the given address in string format
    //
    sscanf(pszRemoteAddr,
           "%02x:%02x:%02x:%02x:%02x:%02x",
           &ulAddrData[0],&ulAddrData[1],&ulAddrData[2],&ulAddrData[3],&ulAddrData[4],&ulAddrData[5]);

    //
    // Construct a BTH_ADDR from the 6 integers stored in the array
    //
    for ( int i=0; i<6; i++ )
    {
        //
        // Extract data from the first 8 lower bits.
        //
        BtAddrTemp = (BTH_ADDR)( ulAddrData[i] & 0xFF );

        //
        // Push 8 bits to the left
        //
        *pRemoteBtAddr = ( (*pRemoteBtAddr) << 8 ) + BtAddrTemp;
    }

CleanupAndExit:
    return ulRetCode;
}

DEFINE_GUID | ( | g_guidServiceClass | ,
 |  | 0xb62c4e8d | ,
 |  | 0x62cc | ,
 |  | 0x404b | ,
 |  | 0xbb | ,
 |  | 0xbf | ,
 |  | 0xbf | ,
 |  | 0x3e | ,
 |  | 0x3b | ,
 |  | 0xbb | ,
 |  | 0x13 | ,
 |  | 0x74 |
 | ) |  |
int _cdecl main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 53 of file bthcxn.cpp.

{
    ULONG      ulRetCode = 0;
    WSADATA    WSAData = {0};
    ULONGLONG  ululRemoteBthAddr = 0;

    //
    // Parse the command line
    //
    if ( 0 == ( ulRetCode = ParseCmdLine(argc, argv) ) )
    {
        //
        // Ask for Winsock version 2.2.
        //
        if ( 0 != ( ulRetCode = WSAStartup(MAKEWORD(2, 2), &WSAData) ) )
        {
            printf("-FATAL- | Unable to initialize Winsock version 2.2\n");
            goto CleanupAndExit;
        }

        if ( '\0' != g_szRemoteName[0] )
        {
            //
            // Get address from name of the remote device and run the application in client mode
            //
            if ( 0 != ( ulRetCode = NameToBthAddr(g_szRemoteName, (BTH_ADDR *) &ululRemoteBthAddr) ) )
            {
                printf("-FATAL- | Unable to get address of the remote radio having name %s\n", g_szRemoteName);
                goto CleanupAndExit;
            }

            ulRetCode = RunClientMode(ululRemoteBthAddr, g_ulMaxCxnCycles);
        }
        else if ( '\0' != g_szRemoteAddr[0] )
        {
            //
            // Get address from formated address-string of the remote device and run the application in client mode
            //
            // BUGBUG should be calling WSAStringToAddress
            //
            if ( 0 != ( ulRetCode = AddrStringToBtAddr(g_szRemoteAddr, (BTH_ADDR *) &ululRemoteBthAddr) ) )
            {
                printf("-FATAL- | Unable to get address of the remote radio having formated address-string %s\n", g_szRemoteAddr);
                goto CleanupAndExit;
            }

            ulRetCode = RunClientMode(ululRemoteBthAddr, g_ulMaxCxnCycles);
        }
        else
        {
            //
            // No remote name/address specified.  Run the application in server mode
            //
            ulRetCode = RunServerMode(g_ulMaxCxnCycles);
        }
    }
    else if ( 1 == ulRetCode )
    {
        //
        // Command line syntax error.  Display cmd line help
        //
        ShowCmdLineHelp();
    }
    else
    {
        printf("-FATAL- | Error in parsing command line\n");
    }

CleanupAndExit:
    return (int) (ulRetCode);
}

ULONG NameToBthAddr | ( | IN const char * | pszRemoteName,
 |  | OUT BTH_ADDR * | pRemoteBthAddr
 | ) |  |

Definition at line 135 of file bthcxn.cpp.

{
    INT          iResult = 0, iRetryCount = 0;
    BOOL         bContinueLookup = FALSE, bRemoteDeviceFound = FALSE;
    ULONG        ulFlags = 0, ulPQSSize = sizeof(WSAQUERYSET);
    HANDLE       hLookup = 0;
    PWSAQUERYSET pWSAQuerySet = NULL;

    if ( ( NULL == pszRemoteName ) || ( NULL == pRemoteBtAddr ) )
    {
        goto CleanupAndExit;
    }

    if ( NULL == ( pWSAQuerySet = (PWSAQUERYSET) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, ulPQSSize) ) )
    {
        printf("!ERROR! | Unable to allocate memory for WSAQUERYSET\n");
        goto CleanupAndExit;
    }

    //
    // Search for the device with the correct name
    //
    for (iRetryCount = 0; !bRemoteDeviceFound && (iRetryCount < CXN_MAX_INQUIRY_RETRY); iRetryCount++)
    {
        //
        // WSALookupService is used for both service search and device inquiry
        // LUP_CONTAINERS is the flag which signals that we're doing a device inquiry.
        //
        ulFlags = LUP_CONTAINERS;

        //
        // Friendly device name (if available) will be returned in lpszServiceInstanceName
        //
        ulFlags |= LUP_RETURN_NAME;

        //
        // BTH_ADDR will be returned in lpcsaBuffer member of WSAQUERYSET
        //
        ulFlags |= LUP_RETURN_ADDR;

        if ( 0 == iRetryCount )
        {
            printf("*INFO* | Inquiring device from cache...\n");
        }
        else
        {
            //
            // Flush the device cache for all inquiries, except for the first inquiry
            //
            // By setting LUP_FLUSHCACHE flag, we're asking the lookup service to do
            // a fresh lookup instead of pulling the information from device cache.
            //
            ulFlags |= LUP_FLUSHCACHE;

            //
            // Pause for some time before all the inquiries after the first inquiry
            //
            //
            // BUGBUG why sleep. Try to get rid of this
            //
            // Remote Name requests will arrive after device inquiry has
            // completed.  Without a window to receive IN_RANGE notifications,
            // we don't have a direct mechanism to determine when remote
            // name requests have completed.
            //
            printf("*INFO* | Unable to find device.  Waiting for %d seconds before re-inquiry...\n", CXN_DELAY_NEXT_INQUIRY);
            Sleep(CXN_DELAY_NEXT_INQUIRY * 1000);

            printf("*INFO* | Inquiring device ...\n");
        }

        //
        // Start the lookup service
        //
        iResult = 0;
        hLookup = 0;
        bContinueLookup = FALSE;
        ZeroMemory(pWSAQuerySet, ulPQSSize);
        pWSAQuerySet->dwNameSpace = NS_BTH;
        pWSAQuerySet->dwSize = sizeof(WSAQUERYSET);
        iResult = WSALookupServiceBegin(pWSAQuerySet, ulFlags, &hLookup);

        if ( (NO_ERROR == iResult) && (NULL != hLookup) )
        {
            bContinueLookup = TRUE;
        }
        else if ( 0 < iRetryCount )
        {
            printf("=CRITICAL= | WSALookupServiceBegin() failed with error code %d, WSALastError = %d\n", iResult, WSAGetLastError());
            goto CleanupAndExit;
        }

        while ( bContinueLookup )
        {
            //
            // Get information about next bluetooth device
            //
            // Note you may pass the same WSAQUERYSET from LookupBegin
            // as long as you don't need to modify any of the pointer
            // members of the structure, etc.
            //
            // ZeroMemory(pWSAQuerySet, ulPQSSize);
            // pWSAQuerySet->dwNameSpace = NS_BTH;
            // pWSAQuerySet->dwSize = sizeof(WSAQUERYSET);
            if ( NO_ERROR == WSALookupServiceNext(hLookup, ulFlags, &ulPQSSize, pWSAQuerySet) )
            {
                //
                // Since we're a non-unicode application, the remote
                // name in lpszServiceInstanceName will have been converted
                // from CP_UTF8 to CP_ACP, this may cause the name match
                // to fail unexpectedly.  If the app is to handle this,
                // the app needs to be unicode.
                //
                if ( ( pWSAQuerySet->lpszServiceInstanceName != NULL ) && ( 0 == _stricmp(pWSAQuerySet->lpszServiceInstanceName, pszRemoteName) ) )
                {
                    //
                    // Found a remote bluetooth device with matching name.
                    // Get the address of the device and exit the lookup.
                    //
                    CopyMemory(pRemoteBtAddr,
                               &((PSOCKADDR_BTH) pWSAQuerySet->lpcsaBuffer->RemoteAddr.lpSockaddr)->btAddr,
                               sizeof(*pRemoteBtAddr));
                    bRemoteDeviceFound = TRUE;
                    bContinueLookup = FALSE;
                }
            }
            else
            {
                if ( WSA_E_NO_MORE == ( iResult = WSAGetLastError() ) ) //No more data
                {
                    //
                    // No more devices found.  Exit the lookup.
                    //
                    bContinueLookup = FALSE;
                }
                else if ( WSAEFAULT == iResult )
                {
                    //
                    // The buffer for QUERYSET was insufficient.
                    // In such case 3rd parameter "ulPQSSize" of function "WSALookupServiceNext()" receives
                    // the required size.  So we can use this parameter to reallocate memory for QUERYSET.
                    //
                    HeapFree(GetProcessHeap(), 0, pWSAQuerySet);
                    pWSAQuerySet = NULL;
                    if ( NULL == ( pWSAQuerySet = (PWSAQUERYSET) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, ulPQSSize) ) )
                    {
                        printf("!ERROR! | Unable to allocate memory for WSAQERYSET\n");
                        bContinueLookup = FALSE;
                    }
                }
                else
                {
                    printf("=CRITICAL= | WSALookupServiceNext() failed with error code %d\n", iResult);
                    bContinueLookup = FALSE;
                }
            }
        }

        //
        // End the lookup service
        //
        WSALookupServiceEnd(hLookup);
    }

CleanupAndExit:
    if ( NULL != pWSAQuerySet )
    {
        HeapFree(GetProcessHeap(), 0, pWSAQuerySet);
        pWSAQuerySet = NULL;
    }

    if ( bRemoteDeviceFound )
    {
        return(0);
    }
    else
    {
        return(1);
    }
}

ULONG ParseCmdLine | ( | IN int | argc,
 |  | IN char * | argv[]
 | ) |  |

Definition at line 793 of file bthcxn.cpp.

{
    int   iStrLen = 0;
    ULONG ulRetCode = 0;

    for ( int i = 1; i < argc; i++ )
    {
        char * pszToken = argv[i];
        if ( *pszToken == '-' || *pszToken == '/' )
        {
            char token;

            //
            // skip over the "-" or "/"
            //
            pszToken++;

            //
            // Get the command line option
            //
            token = *pszToken;

            //
            // Go one past the option the option-data
            //
            pszToken++;

            //
            // Get the option-data
            //
            switch ( token )
            {
                case 'n':
                    iStrLen = lstrlen(pszToken);
                    if ( (0 < iStrLen) && (BTH_MAX_NAME_SIZE >= iStrLen)  )
                    {
                        lstrcpy(g_szRemoteName, pszToken);
                    }
                    else
                    {
                        ulRetCode = 2;
                        printf("!ERROR! | cmd line | Unable to parse -n<RemoteName>, length error (min 1 char, max %d chars)\n", BTH_MAX_NAME_SIZE);
                    }
                    break;

                case 'a':
                    iStrLen = lstrlen(pszToken);
                    if ( CXN_BDADDR_STR_LEN == iStrLen )
                    {
                        lstrcpy(g_szRemoteAddr, pszToken);
                    }
                    else
                    {
                        ulRetCode = 2;
                        printf("!ERROR! | cmd line | Unable to parse -a<RemoteAddress>, Remote bluetooth radio address string length expected %d | Found: %d)\n", CXN_BDADDR_STR_LEN, iStrLen);
                    }
                    break;

                case 'c':
                    if ( 0 < lstrlen(pszToken) )
                    {
                        sscanf(pszToken,"%d", &g_ulMaxCxnCycles);
                        if ( 0 > g_ulMaxCxnCycles )
                        {
                            ulRetCode = 2;
                            printf("!ERROR! | cmd line | Must provide +ve or 0 value with -c option\n");
                        }
                    }
                    else
                    {
                        ulRetCode = 2;
                        printf("!ERROR! | cmd line | Must provide a value with -c option\n");
                    }
                    break;

                case 'o':
                    if ( 0 < lstrlen(pszToken) )
                    {
                        sscanf(pszToken,"%d", &g_iOutputLevel);
                        if ( 0 > g_iOutputLevel )
                        {
                            ulRetCode = 2;
                            printf("!ERROR! | cmd line | Must provide a +ve or 0 value with -o option");
                        }
                    }
                    else
                    {
                        ulRetCode = 2;
                        printf("!ERROR! | cmd line | Must provide a value with -o option");
                    }
                    break;

                case '?':
                case 'h':
                case 'H':
                default:
                    ulRetCode = 1;
            }
        }
        else
        {
            ulRetCode = 1;
            printf("!ERROR! | cmd line | Bad option prefix, use '/' or '-' \n");
        }
    }

    return ulRetCode;
}

ULONG RunClientMode | ( | IN ULONGLONG | ululRemoteBthAddr,
 |  | IN int | iMaxCxnCycles = 1
 | ) |  |
ULONG RunClientMode | ( | ULONGLONG | ululRemoteAddr,
 |  | int | iMaxCxnCycles
 | ) |  |

Definition at line 364 of file bthcxn.cpp.

{
    ULONG              ulRetCode = 0;
    int                iCxnCount = 0;
    char               szData[CXN_TRANSFER_DATA_LENGTH] = {0};
    SOCKET             LocalSocket = INVALID_SOCKET;
    SOCKADDR_BTH       SockAddrBthServer = {0};

    //
    // Setting address family to AF_BTH indicates winsock2 to use Bluetooth sockets
    // Port should be set to 0 if ServiceClassId is spesified.
    //
    SockAddrBthServer.addressFamily = AF_BTH;
    SockAddrBthServer.btAddr = (BTH_ADDR) ululRemoteAddr;
    SockAddrBthServer.serviceClassId = g_guidServiceClass;
    SockAddrBthServer.port = 0;

    //
    // Create a static data-string, which will be transferred to the remote Bluetooth device
    //
    //
    // BUGBUG make this #define and do strlen of the string
    //
    strncpy(szData, "~!@#$%^&*()-_=+?<>1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", CXN_TRANSFER_DATA_LENGTH - 1);

    //
    // Run the connection/data-transfer for user specified number of cycles
    //
    for ( iCxnCount = 0; (0 == ulRetCode) && (iCxnCount < iMaxCxnCycles || iMaxCxnCycles == 0); iCxnCount++ )
    {
        printf("\n");

        //
        // Open a bluetooth socket using RFCOMM protocol
        //
        if ( INVALID_SOCKET == ( LocalSocket = socket(AF_BTH, SOCK_STREAM, BTHPROTO_RFCOMM) ) )
        {
            printf("=CRITICAL= | socket() call failed. WSAGetLastError = [%d]\n", WSAGetLastError());
            ulRetCode = 1;
            goto CleanupAndExit;
        }

        if ( 2 <= g_iOutputLevel )
        {
            printf("*INFO* | socket() call succeeded. Socket = [0x%X]\n", LocalSocket);
        }

        if ( 1 <= g_iOutputLevel )
        {
            printf("*INFO* | connect() attempt with Remote BTHAddr = [0x%X]\n", ululRemoteAddr);
        }

        //
        // Connect the socket (pSocket) to a given remote socket represented by address (pServerAddr)
        //
        if ( SOCKET_ERROR == connect(LocalSocket, (struct sockaddr *) &SockAddrBthServer, sizeof(SOCKADDR_BTH)) )
        {
            printf("=CRITICAL= | connect() call failed. WSAGetLastError=[%d]\n", WSAGetLastError());
            ulRetCode = 1;
            goto CleanupAndExit;
        }

        if ( 2 <= g_iOutputLevel )
        {
            printf("*INFO* | connect() call succeeded\n");
        }

        //
        // send() call indicates winsock2 to send the given data
        // of a specified length over a given connection.
        //
        printf("*INFO* | Sending following data string:\n%s\n", szData);
        if ( SOCKET_ERROR == send(LocalSocket, szData, CXN_TRANSFER_DATA_LENGTH, 0) )
        {
            printf("=CRITICAL= | send() call failed w/socket = [0x%X], szData = [%p], dataLen = [%d]. WSAGetLastError=[%d]\n", LocalSocket, szData, CXN_TRANSFER_DATA_LENGTH, WSAGetLastError());
            ulRetCode = 1;
            goto CleanupAndExit;
        }

        if ( 2 <= g_iOutputLevel )
        {
            printf("*INFO* | send() call succeeded\n");
        }

        //
        // Close the socket
        //
        if ( SOCKET_ERROR == closesocket(LocalSocket) )
        {
            printf("=CRITICAL= | closesocket() call failed w/socket = [0x%X]. WSAGetLastError=[%d]\n", LocalSocket, WSAGetLastError());
            ulRetCode = 1;
            goto CleanupAndExit;
        }

        LocalSocket = INVALID_SOCKET;

        if ( 2 <= g_iOutputLevel )
        {
            printf("*INFO* | closesocket() call succeeded");
        }
    }

CleanupAndExit:
    if ( INVALID_SOCKET != LocalSocket )
    {
        closesocket(LocalSocket);
        LocalSocket = INVALID_SOCKET;
    }

    return ulRetCode;
}

ULONG RunServerMode ( IN int iMaxCxnCycles = 1 )
ULONG RunServerMode ( int iMaxCxnCycles )

Definition at line 480 of file bthcxn.cpp.

{
    ULONG              ulRetCode = 0;
    int                iAddrLen = sizeof(SOCKADDR_BTH), iCxnCount = 0, iLengthReceived = 0, iTotalLengthReceived = 0;
    char               szDataBuffer[CXN_TRANSFER_DATA_LENGTH] = {0};
    char *             pszDataBufferIndex = NULL;
    LPTSTR             lptstrThisComputerName = NULL;
    DWORD              dwLenComputerName = MAX_COMPUTERNAME_LENGTH + 1;
    SOCKET             LocalSocket = INVALID_SOCKET, ClientSocket = INVALID_SOCKET;
    WSAVERSION         wsaVersion = {0};
    WSAQUERYSET        wsaQuerySet = {0};
    SOCKADDR_BTH       SockAddrBthLocal = {0};
    LPCSADDR_INFO      lpCSAddrInfo = NULL;

    //
    // BUGBUG both of these fixed-size allocations can be on the stack
    //
    if ( NULL == ( lpCSAddrInfo = (LPCSADDR_INFO) HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CSADDR_INFO) ) ) )
    {
        printf("!ERROR! | Unable to allocate memory for CSADDR_INFO\n");
        ulRetCode = 1;
        goto CleanupAndExit;
    }

    if ( NULL == ( lptstrThisComputerName = (LPTSTR) HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, dwLenComputerName ) ) )
    {
        printf("!ERROR! | Unable to allocate memory for CSADDR_INFO\n");
        ulRetCode = 1;
        goto CleanupAndExit;
    }

    if ( !GetComputerName(lptstrThisComputerName, &dwLenComputerName) )
    {
        printf("=CRITICAL= | GetComputerName() call failed. WSAGetLastError=[%d]\n", WSAGetLastError());
        ulRetCode = 1;
        goto CleanupAndExit;
    }

    //
    // Open a bluetooth socket using RFCOMM protocol
    //
    if ( INVALID_SOCKET == ( LocalSocket = socket(AF_BTH, SOCK_STREAM, BTHPROTO_RFCOMM) ) )
    {
        printf("=CRITICAL= | socket() call failed. WSAGetLastError = [%d]\n", WSAGetLastError());
        ulRetCode = 1;
        goto CleanupAndExit;
    }

    if ( 2 <= g_iOutputLevel )
    {
        printf("*INFO* | socket() call succeeded. Socket = [0x%X]\n", LocalSocket);
    }

    //
    // Setting address family to AF_BTH indicates winsock2 to use Bluetooth port
    //
    SockAddrBthLocal.addressFamily = AF_BTH;
    SockAddrBthLocal.port = BT_PORT_ANY;

    //
    // bind() associates a local address and port combination
    // with the socket just created. This is most useful when
    // the application is a server that has a well-known port
    // that clients know about in advance.
    //
    if ( SOCKET_ERROR == bind(LocalSocket, (struct sockaddr *) &SockAddrBthLocal, sizeof(SOCKADDR_BTH) ) )
    {
        printf("=CRITICAL= | bind() call failed w/socket = [0x%X]. WSAGetLastError=[%d]\n", LocalSocket, WSAGetLastError());
        ulRetCode = 1;
        goto CleanupAndExit;
    }

    if ( 2 <= g_iOutputLevel )
    {
        printf("*INFO* | bind() call succeeded\n");
    }

    if ( SOCKET_ERROR == ( ulRetCode = getsockname(LocalSocket, (struct sockaddr *)&SockAddrBthLocal, &iAddrLen) ) )
    {
        printf("=CRITICAL= | getsockname() call failed w/socket = [0x%X]. WSAGetLastError=[%d]\n", LocalSocket, WSAGetLastError());
        ulRetCode = 1;
        goto CleanupAndExit;
    }

    //
    // CSADDR_INFO
    //
    lpCSAddrInfo[0].LocalAddr.iSockaddrLength = sizeof( SOCKADDR_BTH );
    lpCSAddrInfo[0].LocalAddr.lpSockaddr = (LPSOCKADDR)&SockAddrBthLocal;
    lpCSAddrInfo[0].RemoteAddr.iSockaddrLength = sizeof( SOCKADDR_BTH );
    lpCSAddrInfo[0].RemoteAddr.lpSockaddr = (LPSOCKADDR)&SockAddrBthLocal;
    lpCSAddrInfo[0].iSocketType = SOCK_STREAM;
    lpCSAddrInfo[0].iProtocol = BTHPROTO_RFCOMM;

    //
    // If we got an address, go ahead and advertise it.
    //
    ZeroMemory(&wsaQuerySet, sizeof(WSAQUERYSET));
    wsaQuerySet.dwSize = sizeof(WSAQUERYSET);
    wsaQuerySet.lpServiceClassId = (LPGUID) &g_guidServiceClass;
    //
    // BUGBUG should be something like "Sample Bluetooth Server"
    //
    wsaQuerySet.lpszServiceInstanceName = lptstrThisComputerName;
    wsaQuerySet.lpszComment = "Example Service instance registered in the directory service through RnR";
    wsaQuerySet.dwNameSpace = NS_BTH;
    wsaQuerySet.dwNumberOfCsAddrs = 1;      // Must be 1.
    wsaQuerySet.lpcsaBuffer = lpCSAddrInfo; // Req'd.

    //
    // As long as we use a blocking accept(), we will have a race
    // between advertising the service and actually being ready to
    // accept connections.  If we use non-blocking accept, advertise
    // the service after accept has been called.
    //
    if ( SOCKET_ERROR == WSASetService(&wsaQuerySet, RNRSERVICE_REGISTER, 0) )
    {
        printf("=CRITICAL= | WSASetService() call failed. WSAGetLastError=[%d]\n", WSAGetLastError());
        ulRetCode = 1;
        goto CleanupAndExit;
    }

    //
    // listen() call indicates winsock2 to listen on a given socket for any incoming connection.
    //
    if ( SOCKET_ERROR == listen(LocalSocket, SOMAXCONN) )
    {
        printf("=CRITICAL= | listen() call failed w/socket = [0x%X]. WSAGetLastError=[%d]\n", LocalSocket, WSAGetLastError());
        ulRetCode = 1;
        goto CleanupAndExit;
    }

    if ( 2 <= g_iOutputLevel )
    {
        printf("*INFO* | listen() call succeeded\n");
    }

    for ( iCxnCount = 0; (0 == ulRetCode) && ( (iCxnCount < iMaxCxnCycles) || (iMaxCxnCycles == 0) ); iCxnCount++ )
    {
        printf("\n");

        //
        // accept() call indicates winsock2 to wait for any
        // incoming connection request from a remote socket.
        // If there are already some connection requests on the queue,
        // then accept() extracts the first request and creates a new socket and
        // returns the handle to this newly created socket. This newly created
        // socket represents the actual connection that connects the two sockets.
        //
        if ( INVALID_SOCKET == ( ClientSocket = accept(LocalSocket, NULL, NULL) ) )
        {
            printf("=CRITICAL= | accept() call failed. WSAGetLastError=[%d]\n", WSAGetLastError());
            ulRetCode = 1;
            break; // Break out of the for loop
        }

        if ( 2 <= g_iOutputLevel )
        {
            printf("*INFO* | accept() call succeeded. CientSocket = [0x%X]\n", ClientSocket);
        }

        //
        // Read data from the incoming stream
        //
        BOOL bContinue = TRUE;
        pszDataBufferIndex = &szDataBuffer[0];
        while ( bContinue && (iTotalLengthReceived < CXN_TRANSFER_DATA_LENGTH) )
        {
            //
            // recv() call indicates winsock2 to receive data
            // of an expected length over a given connection.
            // recv() may not be able to get the entire length
            // of data at once.  In such case the return value,
            // which specifies the number of bytes received,
            // can be used to calculate how much more data is
            // pending and accordingly recv() can be called again.
            //
            iLengthReceived = recv(ClientSocket, pszDataBufferIndex, (CXN_TRANSFER_DATA_LENGTH - iTotalLengthReceived), 0);

            switch ( iLengthReceived )
            {
                case 0: // socket connection has been closed gracefully
                    bContinue = FALSE;
                    break;

                case SOCKET_ERROR:
                    printf("=CRITICAL= | recv() call failed. WSAGetLastError=[%d]\n", WSAGetLastError());
                    bContinue = FALSE;
                    ulRetCode = 1;
                    break;

                default: // most cases when data is being read
                    pszDataBufferIndex += iLengthReceived;
                    iTotalLengthReceived += iLengthReceived;
                    if ( 2 <= g_iOutputLevel )
                    {
                        printf("*INFO* | Receiving data of length = [%d]. Current Total = [%d]\n", iLengthReceived, iTotalLengthReceived);
                    }
                    break;
            }
        }

        if ( 0 == ulRetCode )
        {
            if ( CXN_TRANSFER_DATA_LENGTH != iTotalLengthReceived )
            {
                printf("+WARNING+ | Data transfer aborted mid-stream. Expected Length = [%d], Actual Length = [%d]\n", CXN_TRANSFER_DATA_LENGTH, iTotalLengthReceived);
            }

            printf("*INFO* | Received following data string from remote device:\n%s\n", szDataBuffer);

            //
            // Close the connection
            //
            if ( SOCKET_ERROR == closesocket(ClientSocket) )
            {
                printf("=CRITICAL= | closesocket() call failed w/socket = [0x%X]. WSAGetLastError=[%d]\n", LocalSocket, WSAGetLastError());
                ulRetCode = 1;
            }
            else
            {
                //
                // Make the connection invalid regardless
                //
                ClientSocket = INVALID_SOCKET;

                if ( 2 <= g_iOutputLevel )
                {
                    printf("*INFO* | closesocket() call succeeded w/socket=[0x%X]\n", ClientSocket);
                }
            }
        }
    }

CleanupAndExit:
    if ( INVALID_SOCKET != ClientSocket )
    {
        closesocket(ClientSocket);
        ClientSocket = INVALID_SOCKET;
    }

    if ( INVALID_SOCKET != LocalSocket )
    {
        closesocket(LocalSocket);
        LocalSocket = INVALID_SOCKET;
    }

    if ( NULL != lptstrThisComputerName )
    {
        HeapFree(GetProcessHeap(), 0, lptstrThisComputerName);
        lptstrThisComputerName = NULL;
    }

    if ( NULL != lpCSAddrInfo )
    {
        HeapFree(GetProcessHeap(), 0, lpCSAddrInfo);
        lpCSAddrInfo = NULL;
    }

    return ulRetCode;
}

void ShowCmdLineHelp ( void )

Definition at line 745 of file bthcxn.cpp.

{
    printf(
          "\n  Bluetooth example application for demonstrating connection and data transfer."
          "\n"
          "\n"
          "\n  BTHCxnDemo.exe  [-n<RemoteName> | -a<RemoteAddress>] "
          "\n                  [-c<ConnectionCycles>] [-o<Output Level>]"
          "\n"
          "\n"
          "\n  Switches applicable for Client mode:"
          "\n    -n<RemoteName>        Specifies name of remote BlueTooth-Device."
          "\n"
          "\n    -a<RemoteAddress>     Specifies address of remote BlueTooth-Device."
          "\n                          The address is in form XX:XX:XX:XX:XX:XX"
          "\n                          where XX is a hexidecimal byte"
          "\n"
          "\n                          One of the above two switches is required for client."
          "\n"
          "\n"
          "\n  Switches applicable for both Client and Server mode:"
          "\n    -c<ConnectionCycles>  Specifies number of connection cycles."
          "\n                          Default value for this parameter is 1.  Specify 0 to "
          "\n                          run infinite number of connection cycles."
          "\n"
          "\n    -o<OutputLevel>       Specifies level of information reporting in cmd window."
          "\n                          Default value for this parameter is 0 (minimal info)."
          "\n                          Possible values: 1 (more info), 2 (all info)."
          "\n"
          "\n"
          "\n  Command Line Examples:"
          "\n    \"BTHCxnDemo.exe -c0\""
          "\n    Runs the BTHCxnDemo server for infinite connection cycles."
          "\n    The application reports minimal information onto the cmd window."
          "\n"
          "\n    \"BTHCxnDemo.exe -nServerDevice -c50 -o2\""
          "\n    Runs the BTHCxnDemo client connecting to remote device (having name "
          "\n    \"ServerDevice\" for 50 connection cycles."
          "\n    The application reports minimal information onto the cmd window."
          "\n"
          );
}

Variable Documentation

int g_iOutputLevel = 0

Definition at line 42 of file bthcxn.cpp.

char g_szRemoteAddr[CXN_BDADDR_STR_LEN+1] = {0}

Definition at line 41 of file bthcxn.cpp.

char g_szRemoteName[BTH_MAX_NAME_SIZE+1] = {0}

Definition at line 40 of file bthcxn.cpp.

int g_ulMaxCxnCycles = 1

Definition at line 42 of file bthcxn.cpp.

Generated on Wed Nov 13 2024 16:53:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/DHCP/DHCPNotify/dhcpnotify.cpp File Reference

  • NetDS
  • DHCP
  • DHCPNotify
Functions | Variables

dhcpnotify.cpp File Reference

#include <windows.h>
#include <stdio.h>
#include <iphlpapi.h>
#include <dhcpcsdk.h>

Go to the source code of this file.

Functions

BOOL WINAPI | CtrlHandler (DWORD dwCtrlType)
LPSTR DetermineAdapter ()
int | main (int argc, char *argv[])
void | OutputError (DWORD dwError)

Variables

HANDLE g_hExitEvent

Function Documentation

BOOL WINAPI CtrlHandler ( DWORD dwCtrlType )

Definition at line 129 of file dhcpnotify.cpp.

{
  printf("\n\nStop Event Received... Aborting... \n\n");

  switch (dwCtrlType)
    {
    case CTRL_C_EVENT:
    case CTRL_BREAK_EVENT:
    case CTRL_SHUTDOWN_EVENT:
    case CTRL_LOGOFF_EVENT:
    case CTRL_CLOSE_EVENT:
      SetEvent(g_hExitEvent);
      break;
    default:
      return FALSE;
    }

  return TRUE;
}

LPSTR DetermineAdapter ( )

Definition at line 65 of file dhcpnotify.cpp.

{
  DWORD dwResult;                            // result of API calls
  IP_INTERFACE_INFO * pInfo = NULL;          // adapter information structure
  DWORD dwSize = 0;                          // size of required buffer
  CHAR szAdapter[MAX_ADAPTER_NAME] = {0};    // the adapter to use
  char * ptr;                                // pointer to adapter name

  // get buffer size
  dwResult = GetInterfaceInfo(NULL, &dwSize);
  if (dwResult == ERROR_INSUFFICIENT_BUFFER)
    {
    // allocate buffer
    pInfo = (IP_INTERFACE_INFO *) LocalAlloc(LPTR, dwSize);
    if (!pInfo)
      {
      OutputError(GetLastError());
      exit(1);
      }

    // make the actual call
    dwResult = GetInterfaceInfo(pInfo, &dwSize);
    if (dwResult != ERROR_SUCCESS)
      {
      OutputError(GetLastError());
      exit(2);
      }
    }
  else
    {
    OutputError(GetLastError());
    exit(3);
    }

  // convert, parse, and convert back
  ptr = NULL;
  WideCharToMultiByte(0, 0, pInfo->Adapter[0].Name,
                            lstrlenW(pInfo->Adapter[0].Name),
                            szAdapter, MAX_ADAPTER_NAME, NULL, NULL);
  if (szAdapter[0] != '?')
    {
    // find the GUID
    ptr = strchr(szAdapter, '{');
    }

  // use index if the pointer is not set
  if (!ptr)
    {
    sprintf(szAdapter, "%ld\0", pInfo->Adapter[0].Index);
    ptr = szAdapter;
    }

  // free what was allocated
  if (pInfo)
    LocalFree(pInfo);

  return ptr;
}

int main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 154 of file dhcpnotify.cpp.

{
  DWORD dwResult;                            // result from API call
  DWORD dwVersion;                           // API version reported
  WCHAR wszAdapter[MAX_ADAPTER_NAME] = {0};  // the adapter name in wide chars
  char * ptr;                                // pointer to adapter name

  g_hExitEvent = CreateEvent(NULL, FALSE, FALSE, "DHCP_EXIT_EVENT");
  if (g_hExitEvent == NULL)
    OutputError(GetLastError());

  SetConsoleCtrlHandler(CtrlHandler, true);

  if (argc > 1)
    // use what's on the command line for the adapter ID
    ptr = argv[1];
  else
    // use IP Helper API to get the adapter ID to use
    ptr = DetermineAdapter();

  // convert it for the API call
  MultiByteToWideChar(0, 0, ptr, (int) strlen(ptr), wszAdapter, MAX_ADAPTER_NAME);

  // initialize the DHCP Client Options API
  dwResult = DhcpCApiInitialize(&dwVersion);
  if (dwResult != 0)
    {
    OutputError(dwResult);
    exit(4);
    }
  else
    printf("DHCP Client Options API version %d\n", dwVersion);

  //
  // Here the watch is set up - since this is an easy example, the request
  // is set up statically, however in a real-world scenario this may require
  // building the watch array in a more 'dynamic' way
  //
  // Also for this sample we are using one item that is almost always in a
  // DHCP configuration.
  //
  // the DHCP Client Options API array for watching the options
  //
  DHCPCAPI_PARAMS watch[1] =
              {{0, OPTION_ROUTER_ADDRESS, FALSE, NULL, 0}}; // gateway address

  // set-up the actual array
  DHCPCAPI_PARAMS_ARRAY watcharray = {1, watch}; // we are watching 1 item

  printf("Watching DHCP Options Change on Adapter [%S]\n", wszAdapter);

  HANDLE hEvent;  // handle that will be set when parameter(s) change

  // make the request on the adapter
  dwResult = DhcpRegisterParamChange(DHCPCAPI_REGISTER_HANDLE_EVENT,
                                     NULL,
                                     wszAdapter,
                                     NULL,
                                     watcharray,
                                     &hEvent);

  // wait for the events to become signaled
  if (dwResult == ERROR_SUCCESS)
    {
    HANDLE lpHandles[2] = {g_hExitEvent, hEvent};
    DWORD rc = 0;

    while (rc = WaitForMultipleObjects(2, lpHandles, FALSE, INFINITE))
      {
      if (rc == WAIT_OBJECT_0)
        break;

      ResetEvent(hEvent);
      printf("Parameter has changed.\n");

      // the change could then be read and applied as needed
      // see the sample DHCPREQUEST or the DhcpRequestParams() API
      // for more information
      }
    }
  else
    {
    OutputError(dwResult);
    }

  dwResult = DhcpDeRegisterParamChange(DHCPCAPI_REGISTER_HANDLE_EVENT,
                                       NULL, &hEvent);
  if (dwResult != ERROR_SUCCESS)
    OutputError(dwResult);

  // de-init the api
  DhcpCApiCleanup();

  // close out the exit event handle
  CloseHandle(g_hExitEvent);

  return 0;
}

void OutputError ( DWORD dwError )

Definition at line 32 of file dhcpnotify.cpp.

{
  LPVOID lpMsgBuf;    // buffer to copy string into (allocated by call)

  if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
                FORMAT_MESSAGE_FROM_SYSTEM |
                FORMAT_MESSAGE_IGNORE_INSERTS, NULL, dwError,
                MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
                (LPTSTR) &lpMsgBuf, 0, NULL) == 0)
    printf("Error Reported: %d GetLastError: %d\n", dwError, GetLastError());
  else
    {
    printf("Error %d: %s\n", dwError, (LPCSTR) lpMsgBuf);

    // free the buffer.
    LocalFree(lpMsgBuf);
    }
}

Variable Documentation

HANDLE g_hExitEvent

Definition at line 25 of file dhcpnotify.cpp.

Generated on Wed Nov 13 2024 16:53:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/DHCP/DHCPPersist/dhcppersist.cpp File Reference

  • NetDS
  • DHCP
  • DHCPPersist
Defines | Functions

dhcppersist.cpp File Reference

#include <windows.h>
#include <stdio.h>
#include <iphlpapi.h>
#include <dhcpcsdk.h>

Go to the source code of this file.

Defines

#define | DHCP_PERSISTENT_APP_STRING L"DhcpRequestSample"
#define | INITIAL_BUFFER_SIZE 256

Functions

LPSTR DetermineAdapter ()
int | main (int argc, char *argv[])
void | OutputError (DWORD dwError)

Define Documentation

#define DHCP_PERSISTENT_APP_STRING L"DhcpRequestSample"

Definition at line 28 of file dhcppersist.cpp.

#define INITIAL_BUFFER_SIZE 256

Definition at line 27 of file dhcppersist.cpp.

Function Documentation

LPSTR DetermineAdapter ( )

Definition at line 68 of file dhcppersist.cpp.

{
  DWORD dwResult;                            // result of API calls
  IP_INTERFACE_INFO * pInfo = NULL;          // adapter information structure
  DWORD dwSize = 0;                          // size of required buffer
  CHAR szAdapter[MAX_ADAPTER_NAME] = {0};    // the adapter to use
  char * ptr;                                // pointer to adapter name

  // get buffer size
  dwResult = GetInterfaceInfo(NULL, &dwSize);
  if (dwResult == ERROR_INSUFFICIENT_BUFFER)
    {
    // allocate buffer
    pInfo = (IP_INTERFACE_INFO *) LocalAlloc(LPTR, dwSize);
    if (!pInfo)
      {
      OutputError(GetLastError());
      exit(1);
      }

    // make the actual call
    dwResult = GetInterfaceInfo(pInfo, &dwSize);
    if (dwResult != ERROR_SUCCESS)
      {
      OutputError(GetLastError());
      exit(2);
      }
    }
  else
    {
    OutputError(GetLastError());
    exit(3);
    }

  // convert, parse, and convert back
  ptr = NULL;
  WideCharToMultiByte(0, 0, pInfo->Adapter[0].Name,
                            lstrlenW(pInfo->Adapter[0].Name),
                            szAdapter, MAX_ADAPTER_NAME, NULL, NULL);
  if (szAdapter[0] != '?')
    {
    // find the GUID
    ptr = strchr(szAdapter, '{');
    }

  // use index if the pointer is not set
  if (!ptr)
    {
    sprintf(szAdapter, "%ld\0", pInfo->Adapter[0].Index);
    ptr = szAdapter;
    }

  // free what was allocated
  if (pInfo)
    LocalFree(pInfo);

  return ptr;
}

int main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 132 of file dhcppersist.cpp.

{
  DWORD dwResult;                            // result from API call
  DWORD dwVersion;                           // API version reported
  WCHAR wszAdapter[MAX_ADAPTER_NAME] = {0};  // the adapter name in wide chars
  char * ptr = NULL;                         // pointer to adapter name
  BOOL bRemovePersist = FALSE;               // remove persistent request
  BOOL bAddPersist = FALSE;                  // add persistent request

  // check for persist options and adapter ID
  for (int i = 1; i < argc; i++)
    {
    char * p;
    p = argv[i];
    if ((p[0] == '/') || (p[0] == '-'))
      {
      p++;
      if ((p[0] == 'p') || (p[0] == 'P'))
        bAddPersist = TRUE;
      if ((p[0] == 'r') || (p[0] == 'R'))
        bRemovePersist = TRUE;
      }
    else
      ptr = argv[i];
    }

  if (!ptr)
    ptr = DetermineAdapter();

  // convert it for the API call
  MultiByteToWideChar(0, 0, ptr, (int) strlen(ptr), wszAdapter, MAX_ADAPTER_NAME);

  // initialize the DHCP Client Options API
  dwResult = DhcpCApiInitialize(&dwVersion);
  if (dwResult != 0)
    {
    OutputError(dwResult);
    exit(4);
    }
  else
    printf("DHCP Client Options API version %d\n", dwVersion);

  printf("Setting DHCP Options on Adapter [%S]\n", wszAdapter);

  // remove persistence if required
  if (bRemovePersist)
    {
    printf("Removing Option Persistence...\n");
    dwResult = DhcpUndoRequestParams(0, NULL, wszAdapter,
                                     DHCP_PERSISTENT_APP_STRING);
    if (dwResult != ERROR_SUCCESS)
      OutputError(dwResult);
    }
  else
    {
    //
    // Here the request is set up - since this is an easy example, the request
    // is set up statically, however in a real-world scenario this may require
    // building the request array in a more 'dynamic' way
    //
    // the DHCP Client Options API arrays for getting the options
    DHCPCAPI_PARAMS requests[1] =
                {{0, OPTION_TIME_SERVERS, FALSE, NULL, 0}}; // gateway address

    // set-up the actual arrays
    DHCPCAPI_PARAMS_ARRAY sendarray = {0, NULL}; // we aren't sending anything
    DHCPCAPI_PARAMS_ARRAY requestarray = {1, requests}; // we are requesting 1

    // buffer variables
    DWORD dwSize = INITIAL_BUFFER_SIZE; // size of buffer for options
    LPBYTE buffer = NULL;               // buffer for options
    IN_ADDR addr;                       // address in return code

    // loop until buffer is big enough to get the data and then make request
    do
      {
      if (buffer)
        LocalFree(buffer);

      buffer = (LPBYTE) LocalAlloc(LPTR, dwSize);       // allocate the buffer
      if (!buffer)
        {
        OutputError(GetLastError());
        exit(5);
        }

      // make the request on the adapter
      DWORD dwFlags = DHCPCAPI_REQUEST_SYNCHRONOUS;
      if (bAddPersist)
        {
        dwFlags = DHCPCAPI_REQUEST_PERSISTENT;
        printf("Making the request persistent...\n");
        }

      dwResult = DhcpRequestParams(dwFlags,
                                   NULL,
                                   wszAdapter,
                                   NULL, sendarray,
                                   requestarray,
                                   buffer, &dwSize,
                                   bAddPersist ?
                                        DHCP_PERSISTENT_APP_STRING : NULL);
      }
    while (dwResult == ERROR_MORE_DATA);

    // parse out results only if we made the synchronous request
    if (dwResult == ERROR_SUCCESS)
      {
      if (bAddPersist != TRUE)
        {
        // check for time server
        if (requests[0].nBytesData > 0)
          {
          memcpy(&addr, (LPVOID) requests[0].Data, 4);
          printf("Time Server: %s\n", inet_ntoa(addr));
          }
        else
          printf("Time Server NOT present!\n");
        }
      }
    else
      {
      OutputError(dwResult);
      }

    // free the buffer
    if (buffer)
      LocalFree(buffer);
    }

  // de-init the api
  DhcpCApiCleanup();

  return 0;
}

void OutputError ( DWORD dwError )

Definition at line 35 of file dhcppersist.cpp.

{
  LPVOID lpMsgBuf;    // buffer to copy string into (allocated by call)

  if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
                FORMAT_MESSAGE_FROM_SYSTEM |
                FORMAT_MESSAGE_IGNORE_INSERTS, NULL, dwError,
                MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
                (LPTSTR) &lpMsgBuf, 0, NULL) == 0)
    printf("Error Reported: %d GetLastError: %d\n", dwError, GetLastError());
  else
    {
    printf("Error %d: %s\n", dwError, (LPCSTR) lpMsgBuf);

    // free the buffer.
    LocalFree(lpMsgBuf);
    }
}

Generated on Wed Nov 13 2024 16:53:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/DHCP/DHCPRequest/dhcprequest.cpp File Reference

  • NetDS
  • DHCP
  • DHCPRequest
Defines | Functions

dhcprequest.cpp File Reference

#include <windows.h>
#include <stdio.h>
#include <iphlpapi.h>
#include <dhcpcsdk.h>

Go to the source code of this file.

Defines

#define | INITIAL_BUFFER_SIZE 256

Functions

LPSTR DetermineAdapter ()
int | main (int argc, char *argv[])
void | OutputError (DWORD dwError)

Define Documentation

#define INITIAL_BUFFER_SIZE 256

Definition at line 26 of file dhcprequest.cpp.

Function Documentation

LPSTR DetermineAdapter ( )

Definition at line 66 of file dhcprequest.cpp.

{
  DWORD dwResult;                            // result of API calls
  IP_INTERFACE_INFO * pInfo = NULL;          // adapter information structure
  DWORD dwSize = 0;                          // size of required buffer
  CHAR szAdapter[MAX_ADAPTER_NAME] = {0};    // the adapter to use
  char * ptr;                                // pointer to adapter name

  // get buffer size
  dwResult = GetInterfaceInfo(NULL, &dwSize);
  if (dwResult == ERROR_INSUFFICIENT_BUFFER)
    {
    // allocate buffer
    pInfo = (IP_INTERFACE_INFO *) LocalAlloc(LPTR, dwSize);
    if (!pInfo)
      {
      OutputError(GetLastError());
      exit(1);
      }

    // make the actual call
    dwResult = GetInterfaceInfo(pInfo, &dwSize);
    if (dwResult != ERROR_SUCCESS)
      {
      OutputError(GetLastError());
      exit(2);
      }
    }
  else
    {
    OutputError(GetLastError());
    exit(3);
    }

  // convert, parse, and convert back
  ptr = NULL;
  WideCharToMultiByte(0, 0, pInfo->Adapter[0].Name,
                            lstrlenW(pInfo->Adapter[0].Name),
                            szAdapter, MAX_ADAPTER_NAME, NULL, NULL);
  if (szAdapter[0] != '?')
    {
    // find the GUID
    ptr = strchr(szAdapter, '{');
    }

  // use index if the pointer is not set
  if (!ptr)
    {
    sprintf(szAdapter, "%ld\0", pInfo->Adapter[0].Index);
    ptr = szAdapter;
    }

  // free what was allocated
  if (pInfo)
    LocalFree(pInfo);

  return ptr;
}

int main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 130 of file dhcprequest.cpp.

{
  DWORD dwResult;                            // result from API call
  DWORD dwVersion;                           // API version reported
  WCHAR wszAdapter[MAX_ADAPTER_NAME] = {0};  // the adapter name in wide chars
  char * ptr = NULL;                         // pointer to adapter name

  if (argc > 1)
    ptr = argv[1];
  else
    ptr = DetermineAdapter();

  // convert it for the API call
  MultiByteToWideChar(0, 0, ptr, (int) strlen(ptr), wszAdapter, MAX_ADAPTER_NAME);

  // initialize the DHCP Client Options API
  dwResult = DhcpCApiInitialize(&dwVersion);
  if (dwResult != 0)
    {
    OutputError(dwResult);
    exit(4);
    }
  else
    printf("DHCP Client Options API version %d\n", dwVersion);

  //
  // Here the request is set up - since this is an easy example, the request
  // is set up statically, however in a real-world scenario this may require
  // building the request array in a more 'dynamic' way
  //
  // Also for this sample we are using two items that are almost always in a
  // DHCP configuration. Hence this information is retrieved from the local
  // DHCP cache.
  //
  // the DHCP Client Options API arrays for getting the options
  DHCPCAPI_PARAMS requests[2] =
              {{0, OPTION_SUBNET_MASK, FALSE, NULL, 0}, // subnet mask
               {0, OPTION_ROUTER_ADDRESS, FALSE, NULL, 0}}; // gateway address

  // set-up the actual arrays
  DHCPCAPI_PARAMS_ARRAY sendarray = {0, NULL};  // we aren't sending anything
  DHCPCAPI_PARAMS_ARRAY requestarray = {2, requests}; // we are requesting 2

  // buffer variables
  DWORD dwSize = INITIAL_BUFFER_SIZE; // size of buffer for options
  LPBYTE buffer = NULL;               // buffer for options
  IN_ADDR addr;                       // address in return code

  printf("Getting DHCP Options on Adapter [%S]\n", wszAdapter);

  // loop until buffer is big enough to get the data and then make request
  do
    {
    if (buffer)
      LocalFree(buffer);

    buffer = (LPBYTE) LocalAlloc(LPTR, dwSize);       // allocate the buffer
    if (!buffer)
      {
      OutputError(GetLastError());
      exit(5);
      }

    // make the request on the adapter
    dwResult = DhcpRequestParams(DHCPCAPI_REQUEST_SYNCHRONOUS,
                                 NULL,
                                 wszAdapter,
                                 NULL, sendarray,
                                 requestarray,
                                 buffer, &dwSize,
                                 NULL);
    }
  while (dwResult == ERROR_MORE_DATA);

  // parse out results
  if (dwResult == ERROR_SUCCESS)
    {

    // first check subnet
    if (requests[0].nBytesData > 0)
      {
      memcpy(&addr, (LPVOID) requests[0].Data, 4);
      printf("Subnet Mask: %s\n", inet_ntoa(addr));
      }
    else
      printf("Subnet Mask NOT present!\n");

    // check for router address
    if (requests[1].nBytesData > 0)
      {
      memcpy(&addr, (LPVOID) requests[1].Data, 4);
      printf("Gateway Address: %s\n", inet_ntoa(addr));
      }
    else
      printf("Gateway Address NOT present!\n");
    }
  else
    {
    OutputError(dwResult);
    }

  // free the buffer
  if (buffer)
    LocalFree(buffer);

  // de-init the api
  DhcpCApiCleanup();

  return 0;
}

void OutputError ( DWORD dwError )

Definition at line 33 of file dhcprequest.cpp.

{
  LPVOID lpMsgBuf;    // buffer to copy string into (allocated by call)

  if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
                FORMAT_MESSAGE_FROM_SYSTEM |
                FORMAT_MESSAGE_IGNORE_INSERTS, NULL, dwError,
                MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
                (LPTSTR) &lpMsgBuf, 0, NULL) == 0)
    printf("Error Reported: %d GetLastError: %d\n", dwError, GetLastError());
  else
    {
    printf("Error %d: %s\n", dwError, (LPCSTR) lpMsgBuf);

    // free the buffer.
    LocalFree(lpMsgBuf);
    }
}

Generated on Wed Nov 13 2024 16:53:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/DNS/DNSQuery/DNSQuery.Cpp File Reference

  • NetDS
  • DNS
  • DNSQuery
Functions

DNSQuery.Cpp File Reference

Go to the source code of this file.

Functions

void __cdecl | main (int argc, char *argv[])
void | Usage (char *progname)

Function Documentation

void __cdecl main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 49 of file DNSQuery.Cpp.

{

    DNS_STATUS status;               // return value of  DnsQuery_A() function.
    PDNS_RECORD pDnsRecord;          //pointer to DNS_RECORD structure
    PIP4_ARRAY pSrvList = NULL;      //pinter to IP4_ARRAY structure
    LPTSTR pOwnerName = NULL;        //owner name to be queried
    WORD wType;                      //Type of the record to be queried
    char DnsServIp[BUFFER_LEN];      //DNS server ip address
    DNS_FREE_TYPE freetype ;
    freetype =  DnsFreeRecordListDeep;
    IN_ADDR ipaddr;

    if (argc > 4) {

        for (int i = 1; i < argc ; i++) {

            if ( (argv[i][0] == '-') || (argv[i][0] == '/') ) {

                switch (tolower(argv[i][1])) {

                case 'n':
                    pOwnerName = argv[++i];
                    break;

                case 't':
                    if (!_stricmp(argv[i+1], "A") )
                        wType = DNS_TYPE_A; //Query host records to resolve a name
                    else if (!_stricmp(argv[i+1], "PTR") )
                        wType = DNS_TYPE_PTR; //Query PTR records to resovle an IP address
                    else
                        Usage(argv[0]);
                    i++;
                    break;

                case 's':
                    // Allocate memory for IP4_ARRAY structure
                    pSrvList = (PIP4_ARRAY) LocalAlloc(LPTR,sizeof(IP4_ARRAY));
                    if (!pSrvList) {
                        printf("Memory allocation failed \n");
                        exit(1);
                    }
                    if (argv[++i]) {
                        strncpy(DnsServIp, argv[i], sizeof(DnsServIp)-1 );
                        DnsServIp[sizeof(DnsServIp)-1] = '\0';
                        pSrvList->AddrCount = 1;
                        pSrvList->AddrArray[0] = inet_addr(DnsServIp); //DNS server IP address
                        if ( pSrvList->AddrArray[0] == INADDR_NONE ) {
                            printf("Invalid DNS server IP address \n");
                            Usage( argv[0] );
                        }
                        break;
                    }

                default:
                    Usage(argv[0]);
                    break;
                }
            }
            else
                Usage(argv[0]);
        }

    }
    else
        Usage(argv[0]);

    // Calling function DnsQuery_A() to query Host or PTR records

    status = DnsQuery_A(pOwnerName,                 //pointer to OwnerName
                        wType,                      //Type of the record to be queried
                        DNS_QUERY_BYPASS_CACHE,     // Bypasses the resolver cache on the lookup.
                        pSrvList,                   //contains DNS server IP address
                        &pDnsRecord,                //Resource record comprising the response
                        NULL);                     //reserved for future use

    if (status) {
        if (wType == DNS_TYPE_A)
            printf("Failed to query the host record for %s and the error is %d \n", pOwnerName, status);
        else
            printf("Failed to query the PTR record and the error is %d \n", status);
    }
    else {
        if (wType == DNS_TYPE_A) {

            //convert the Internet network address into a string
            //in Internet standard dotted format.
            ipaddr.S_un.S_addr = (pDnsRecord->Data.A.IpAddress);
            printf("The IP address of the host %s is %s \n", pOwnerName,inet_ntoa(ipaddr));

            // Free memory allocated for DNS records

            DnsRecordListFree(pDnsRecord, freetype);
        }
        else {
            printf("The host name is %s  \n",(pDnsRecord->Data.PTR.pNameHost));

            // Free memory allocated for DNS records

            DnsRecordListFree(pDnsRecord, freetype);
        }
    }
    LocalFree(pSrvList);

}

void Usage ( char * progname )

Definition at line 38 of file DNSQuery.Cpp.

                           {
    fprintf(stderr,"Usage\n%s -n [OwnerName] -t [Type]  -s [DnsServerIp]\n",
            progname);
    fprintf(stderr,"Where:\n\t\"OwnerName\" is name of the owner of the record set being queried\n");
    fprintf(stderr,"\t\"Type\" is the type of record set to be queried A or PTR\n");
    fprintf(stderr,"\t\"DnsServerIp\"is the IP address of DNS server (in dotted decimal notation)");
    fprintf(stderr,"to which the query should be sent\n");
    exit(1);
}

Generated on Wed Nov 13 2024 16:53:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/DNS/ModifyRecords/ModifyRecords.cpp File Reference

  • NetDS
  • DNS
  • ModifyRecords
Functions

ModifyRecords.cpp File Reference

Go to the source code of this file.

Functions

void __cdecl | main (int argc, char *argv[])
void | Usage (char *progname)

Function Documentation

void __cdecl main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 49 of file ModifyRecords.cpp.

{

    DNS_STATUS status;               // return value of  DnsModifyRecordsInSet() function.
    PDNS_RECORD pmyDnsRecord = NULL; //pointer to DNS_RECORD structure
    PIP4_ARRAY pSrvList = NULL;      //pinter to IP4_ARRAY structure
    LPTSTR pOwnerName = NULL, pNameData = NULL;  //owner name and the data for CNAME resource record
    char HostipAddress[BUFFER_LEN];         //Ip address required to add host record
    char DnsServIp[BUFFER_LEN];             //DNS server ip address

    memset(HostipAddress, 0, sizeof(HostipAddress) );
    memset(DnsServIp, 0, sizeof(DnsServIp) );

    //Allocate memory for DNS_RECORD structure.

    pmyDnsRecord = (PDNS_RECORD) LocalAlloc( LPTR, sizeof( DNS_RECORD ) );

    if (!pmyDnsRecord) {
        printf("Memory allocaltion failed\n");
        exit(1);
    }

    if (argc > 8) {

        for (int i = 1; i < argc ; i++) {

            if ( (argv[i][0] == '-') || (argv[i][0] == '/') ) {

                switch (tolower(argv[i][1])) {

                case 'n':
                    pOwnerName = argv[++i];
                    pmyDnsRecord->pName = pOwnerName; //copy the Owner name information
                    break;

                case 't':
                    if (!_stricmp(argv[i+1], "A") )
                        pmyDnsRecord->wType = DNS_TYPE_A; //add host records
                    else if (!_stricmp(argv[i+1], "CNAME") )
                        pmyDnsRecord->wType = DNS_TYPE_CNAME; //add CNAME records
                    else
                        Usage(argv[0]);
                    i++;
                    break;

                case 'l':
                    pmyDnsRecord->dwTtl = atoi(argv[++i]); // time to live value in seconds
                    break;
                case 'd':
                    if (pmyDnsRecord->wType == DNS_TYPE_A) {
                        pmyDnsRecord->wDataLength = sizeof(DNS_A_DATA); //data structure for A records
                        strncpy(HostipAddress, argv[++i], sizeof(HostipAddress)-1);
                        HostipAddress[sizeof(HostipAddress)-1] = '\0';
                        pmyDnsRecord->Data.A.IpAddress = inet_addr(HostipAddress); //convert string to proper address
                        if ( pmyDnsRecord->Data.A.IpAddress == INADDR_NONE ) {
                            printf("Invalid IP address in A record data \n");
                            Usage(argv[0]);
                        }
                        break;
                    }
                    else {
                        pmyDnsRecord->wDataLength = sizeof(DNS_PTR_DATA); //data structure for CNAME records
                        pNameData = argv[++i];
                        pmyDnsRecord->Data.Cname.pNameHost = pNameData;
                        break;
                    }
                case 's':
                    // Allocate memory for IP4_ARRAY structure
                    pSrvList = (PIP4_ARRAY) LocalAlloc(LPTR,sizeof(IP4_ARRAY));
                    if (!pSrvList) {
                        printf("Memory allocation failed \n");
                        exit(1);
                    }
                    if (argv[++i]) {
                        strncpy(DnsServIp,argv[i],sizeof(DnsServIp)-1);
                        DnsServIp[sizeof(DnsServIp)-1] = '\0';
                        pSrvList->AddrCount = 1;
                        pSrvList->AddrArray[0] = inet_addr(DnsServIp); //DNS server IP address
                        if ( pSrvList->AddrArray[0] == INADDR_NONE ) {
                            printf("Invalid DNS server IP address\n");
                            Usage(argv[0]);
                        }
                        break;
                    }

                default:
                    Usage(argv[0]);
                    break;
                }
            }
            else
                Usage(argv[0]);

        }

    }
    else {
        Usage(argv[0]);
    }

    // Calling function DNSModifyRecordsInSet_A to add Host or CNAME records

    status = DnsModifyRecordsInSet_A(pmyDnsRecord,                     //pointer to DNS_RECORD
                                     NULL,
                                     DNS_UPDATE_SECURITY_USE_DEFAULT,  //do not attempt secure dynamic updates
                                     NULL,                             //use default credentials
                                     pSrvList,                         //contains DNS server IP address
                                     NULL);                            //reserved for future use

    if (status) {
        if (pmyDnsRecord->wType == DNS_TYPE_A)
            printf("Failed to add the host record for %s and the error is %d \n", pOwnerName, status);
        else
            printf("Failed to add the Cname record for %s and the error is %d \n", pOwnerName, status);
    }
    else {
        if (pmyDnsRecord->wType == DNS_TYPE_A)
            printf("Successfully added the host record for %s \n", pOwnerName);
        else
            printf("Successfully added the Cname record for %s \n", pOwnerName);
    }

    LocalFree(pmyDnsRecord); // Free the memory allocated for DNS_RECORD structure
    LocalFree(pSrvList);     // Free the memory allocated for IP4_ARRAY structure

}

void Usage ( char * progname )

Definition at line 37 of file ModifyRecords.cpp.

                           {
    fprintf(stderr,"Usage\n%s -n [OwnerName] - t [Type] -l [Ttl] -d [Data] -s [DnsServerIp]\n",
            progname);
    fprintf(stderr,"Where:\n\tOwnerName is the owner field to be added\n");
    fprintf(stderr,"\tType is the type of resource record to be added A or CNAME\n");
    fprintf(stderr,"\tData is the data corresponding to RR to be added\n");
    fprintf(stderr,"\tTtl is the time to live value in seconds \n");
    fprintf(stderr,"\tDnsServerIp is the ipaddress of DNS server (in dotted decimal notation)\n");
    exit(1);
}

Generated on Wed Nov 13 2024 16:53:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/fax/PrintSdi/FaxDlg.Cpp File Reference

  • NetDS
  • fax
  • PrintSdi

FaxDlg.Cpp File Reference

#include "stdafx.h"
#include "PrintSDI.h"
#include "FaxDlg.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/fax/PrintSdi/FaxDlg.h File Reference

  • NetDS
  • fax
  • PrintSdi
Classes

FaxDlg.h File Reference

Go to the source code of this file.

Classes

class FaxDlg
Generated on Wed Nov 13 2024 16:53:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/fax/PrintSdi/MainFrm.Cpp File Reference

  • NetDS
  • fax
  • PrintSdi

MainFrm.Cpp File Reference

#include "stdafx.h"
#include "PrintSDI.h"
#include "MainFrm.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/fax/PrintSdi/MainFrm.h File Reference

  • NetDS
  • fax
  • PrintSdi
Classes

MainFrm.h File Reference

Go to the source code of this file.

Classes

class CMainFrame
Generated on Wed Nov 13 2024 16:53:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/fax/PrintSdi/NewDocDlg.Cpp File Reference

  • NetDS
  • fax
  • PrintSdi

NewDocDlg.Cpp File Reference

#include "stdafx.h"
#include "PrintSDI.h"
#include "NewDocDlg.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/fax/PrintSdi/NewDocDlg.h File Reference

  • NetDS
  • fax
  • PrintSdi
Classes

NewDocDlg.h File Reference

Go to the source code of this file.

Classes

class NewDocDlg
Generated on Wed Nov 13 2024 16:53:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/fax/PrintSdi/PrintSdi.Cpp File Reference

  • NetDS
  • fax
  • PrintSdi
Classes | Variables

PrintSdi.Cpp File Reference

#include "stdafx.h"
#include "PrintSDI.h"
#include "MainFrm.h"
#include "PrintSDIDoc.h"
#include "PrintSDIView.h"

Go to the source code of this file.

Classes

class CAboutDlg

Variables

CPrintSDIApp theApp

Variable Documentation

CPrintSDIApp theApp

Definition at line 45 of file PrintSdi.Cpp.

Generated on Wed Nov 13 2024 16:53:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/fax/PrintSdi/PrintSdi.h File Reference

  • NetDS
  • fax
  • PrintSdi
Classes

PrintSdi.h File Reference

#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Classes

class CPrintSDIApp
Generated on Wed Nov 13 2024 16:53:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/fax/PrintSdi/PrintSdiDoc.h File Reference

  • NetDS
  • fax
  • PrintSdi
Classes

PrintSdiDoc.h File Reference

Go to the source code of this file.

Classes

class CPrintSDIDoc
Generated on Wed Nov 13 2024 16:53:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/fax/PrintSdi/PrintSdiView.h File Reference

  • NetDS
  • fax
  • PrintSdi
Classes

PrintSdiView.h File Reference

Go to the source code of this file.

Classes

class CPrintSDIView
Generated on Wed Nov 13 2024 16:53:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/fax/PrintSdi/PrintSdiVw.Cpp File Reference

  • NetDS
  • fax
  • PrintSdi

PrintSdiVw.Cpp File Reference

#include "stdafx.h"
#include "PrintSDI.h"
#include "PrintSDIDoc.h"
#include "PrintSDIView.h"
#include "faxdlg.h"
#include <winfax.h>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/fax/PrintSdi/Resource.h File Reference

  • NetDS
  • fax
  • PrintSdi
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | ID_FILE_FAX 32771
#define | IDC_CIRCLE 1001
#define | IDC_EDIT1 1000
#define | IDC_EDIT2 1004
#define | IDC_SQUARE 1002
#define | IDC_TRIANGLE 1003
#define | IDD_ABOUTBOX 100
#define | IDD_FAX 131
#define | IDD_NEWDIALOG 130
#define | IDR_MAINFRAME 128
#define | IDR_PRINTSTYPE 129

Define Documentation

#define ID_FILE_FAX 32771

Definition at line 15 of file Resource.h.

#define IDC_CIRCLE 1001

Definition at line 11 of file Resource.h.

#define IDC_EDIT1 1000

Definition at line 10 of file Resource.h.

#define IDC_EDIT2 1004

Definition at line 14 of file Resource.h.

#define IDC_SQUARE 1002

Definition at line 12 of file Resource.h.

#define IDC_TRIANGLE 1003

Definition at line 13 of file Resource.h.

#define IDD_ABOUTBOX 100

Definition at line 5 of file Resource.h.

#define IDD_FAX 131

Definition at line 9 of file Resource.h.

#define IDD_NEWDIALOG 130

Definition at line 8 of file Resource.h.

#define IDR_MAINFRAME 128

Definition at line 6 of file Resource.h.

#define IDR_PRINTSTYPE 129

Definition at line 7 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/fax/PrintSdi/SdiDoc.Cpp File Reference

  • NetDS
  • fax
  • PrintSdi

SdiDoc.Cpp File Reference

#include "stdafx.h"
#include "PrintSDI.h"
#include "PrintSDIDoc.h"
#include "newdocdlg.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/fax/PrintSdi/StdAfx.Cpp File Reference

  • NetDS
  • fax
  • PrintSdi

StdAfx.Cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/fax/PrintSdi/StdAfx.h File Reference

  • NetDS
  • fax
  • PrintSdi
Defines

StdAfx.h File Reference

#include <afxwin.h>
#include <afxext.h>
#include <afxdisp.h>
#include <afxcmn.h>

Go to the source code of this file.

Defines

#define VC_EXTRALEAN

Define Documentation

#define VC_EXTRALEAN

Definition at line 13 of file StdAfx.h.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/fax/SampleFSP/Macros.h File Reference

  • NetDS
  • fax
  • SampleFSP
Defines | Variables

Macros.h File Reference

Go to the source code of this file.

Defines

#define | MemAllocMacro(dwBytes) (HeapAlloc(g_HeapHandle, HEAP_GENERATE_EXCEPTIONS | HEAP_ZERO_MEMORY, dwBytes))
#define | MemFreeMacro(lpMem) (HeapFree(g_HeapHandle, 0, lpMem))
#define | MemInitializeMacro(hHeap) (g_HeapHandle = hHeap)
#define | MemReAllocMacro(lpMem, dwBytes) (HeapReAlloc(g_HeapHandle, HEAP_GENERATE_EXCEPTIONS | HEAP_ZERO_MEMORY, lpMem, dwBytes))

Variables

HANDLE g_HeapHandle

Define Documentation

#define MemAllocMacro ( dwBytes ) (HeapAlloc(g_HeapHandle, HEAP_GENERATE_EXCEPTIONS | HEAP_ZERO_MEMORY, dwBytes))

Definition at line 27 of file Macros.h.

#define MemFreeMacro ( lpMem ) (HeapFree(g_HeapHandle, 0, lpMem))

Definition at line 33 of file Macros.h.

#define MemInitializeMacro ( hHeap ) (g_HeapHandle = hHeap)

Definition at line 21 of file Macros.h.

#define MemReAllocMacro | ( | lpMem,
 |  | dwBytes |
 | ) |  | (HeapReAlloc(g_HeapHandle, HEAP_GENERATE_EXCEPTIONS | HEAP_ZERO_MEMORY, lpMem, dwBytes))

Definition at line 30 of file Macros.h.

Variable Documentation

HANDLE g_HeapHandle

Definition at line 18 of file NewFsp.c.

Generated on Wed Nov 13 2024 16:53:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/fax/SampleFSP/NewFsp.c File Reference

  • NetDS
  • fax
  • SampleFSP
Functions | Variables

NewFsp.c File Reference

#include "newfsp.h"
#include <tchar.h>

Go to the source code of this file.

Functions

DWORD WINAPI | DeviceReceiveThread (LPDWORD pdwDeviceId)
BOOL WINAPI | DllEntryPoint (HINSTANCE hInstance, DWORD dwReason, LPVOID pContext)
STDAPI | DllRegisterServer ()
BOOL WINAPI | FaxDevAbortOperation (IN HANDLE FaxHandle)
BOOL WINAPI | FaxDevEndJob (IN HANDLE FaxHandle)
BOOL WINAPI | FaxDevInitialize (IN HLINEAPP LineAppHandle, IN HANDLE HeapHandle, OUT PFAX_LINECALLBACK *LineCallbackFunction, IN PFAX_SERVICE_CALLBACK FaxServiceCallback)
BOOL WINAPI | FaxDevReceive (IN HANDLE FaxHandle, IN HCALL CallHandle, IN OUT PFAX_RECEIVE FaxReceive)
BOOL WINAPI | FaxDevReportStatus (IN HANDLE FaxHandle OPTIONAL, OUT PFAX_DEV_STATUS FaxStatus, IN DWORD FaxStatusSize, OUT LPDWORD FaxStatusSizeRequired)
BOOL WINAPI | FaxDevSend (IN HANDLE FaxHandle, IN PFAX_SEND FaxSend, IN PFAX_SEND_CALLBACK FaxSendCallback)
BOOL WINAPI | FaxDevStartJob (IN HLINE LineHandle, IN DWORD DeviceId, OUT PHANDLE FaxHandle, IN HANDLE CompletionPortHandle, IN ULONG_PTR CompletionKey)
BOOL WINAPI | FaxDevVirtualDeviceCreation (OUT LPDWORD DeviceCount, OUT LPWSTR DeviceNamePrefix, OUT LPDWORD DeviceIdPrefix, IN HANDLE CompletionPort, IN ULONG_PTR CompletionKey)
VOID CALLBACK | FaxLineCallback (IN HANDLE FaxHandle, IN DWORD hDevice, IN DWORD dwMessage, IN DWORD_PTR dwInstance, IN DWORD_PTR dwParam1, IN DWORD_PTR dwParam2, IN DWORD_PTR dwParam3)

Variables

HANDLE | g_HeapHandle = NULL

Function Documentation

DWORD WINAPI DeviceReceiveThread ( LPDWORD pdwDeviceId )

Definition at line 1403 of file NewFsp.c.

                   :

  Thread to watch for an incoming fax transmission

Arguments:

  pdwDeviceId - pointer to the virtual fax device identifier

Return Value:

  DWORD

--*/
{
    // hChangeNotification is a handle to a notification change in a directory
    HANDLE         hChangeNotification;
    // hWaitObjects are the handles to the wait objects
    HANDLE         hWaitObjects[2];
    // dwDeviceId is the virtual fax device identifier
    DWORD          dwDeviceId;
    // pLineMessage is a pointer to LINEMESSAGE structure to signal an incoming fax transmission to the fax service
    LPLINEMESSAGE  pLineMessage;

    WriteDebugString(L"---SampleFSP: DeviceReceiveThread Enter---\n");

    // Copy the virtual fax device identifier
    dwDeviceId = *pdwDeviceId;
    MemFreeMacro(pdwDeviceId);

    // Create the change notification handle
    hChangeNotification = FindFirstChangeNotification(g_pDeviceInfo[dwDeviceId]->Directory,
                            FALSE,
                            FILE_NOTIFY_CHANGE_ATTRIBUTES);
    if (hChangeNotification == INVALID_HANDLE_VALUE) {
        goto Exit;
    }

    // Wait for access to this virtual fax device
    EnterCriticalSection(&g_pDeviceInfo[dwDeviceId]->cs);

    // Set hWaitObjects
    hWaitObjects[0] = g_pDeviceInfo[dwDeviceId]->ExitEvent;
    hWaitObjects[1] = hChangeNotification;

    // Release access to this virtual fax device
    LeaveCriticalSection(&g_pDeviceInfo[dwDeviceId]->cs);

    while (TRUE) {
        // Wait for the exit event or notification change to be signaled
        if ( WaitForMultipleObjects(2,
                  hWaitObjects,
                  FALSE,
                  INFINITE) == WAIT_OBJECT_0) {
            break;
        }

        // Wait for access to this virtual fax device
        EnterCriticalSection(&g_pDeviceInfo[dwDeviceId]->cs);

        if (g_pDeviceInfo[dwDeviceId]->Status == DEVICE_IDLE) {
            // Allocate a block of memory for the completion packet
            pLineMessage = LocalAlloc(LPTR, sizeof(LINEMESSAGE));
            if (pLineMessage != NULL) {
                // Initialize the completion packet
                // Set the completion packet's handle to the virtual fax device
                pLineMessage->hDevice = dwDeviceId + NEWFSP_DEVICE_ID_PREFIX;
                // Set the completion packet's virtual fax device message
                pLineMessage->dwMessageID = 0;
                // Set the completion packet's instance data
                pLineMessage->dwCallbackInstance = 0;
                // Set the completion packet's first parameter
                pLineMessage->dwParam1 = LINEDEVSTATE_RINGING;
                // Set the completion packet's second parameter
                pLineMessage->dwParam2 = 0;
                // Set the completion packet's third parameter
                pLineMessage->dwParam3 = 0;

                WriteDebugString(L"---SampleFSP: DeviceReceiveThread Signaling Fax Service...---\n");

                // Post the completion packet
                PostQueuedCompletionStatus(g_CompletionPort,
                       sizeof(LINEMESSAGE),
                       g_CompletionKey,
                       (LPOVERLAPPED) pLineMessage);
            }
        }

        // Release access to this virtual fax device
        LeaveCriticalSection(&g_pDeviceInfo[dwDeviceId]->cs);

        // Find the next notification change
        FindNextChangeNotification(hChangeNotification);
    }

Exit:
    if (hChangeNotification != INVALID_HANDLE_VALUE) {
        // Close the handle to the change notification
        FindCloseChangeNotification(hChangeNotification);
    }

    // Close the handle to the exit event
    CloseHandle(hWaitObjects[0]);

    WriteDebugString(L"---SampleFSP: DeviceReceiveThread Exit---\n");

    return 0;
}

BOOL WINAPI DllEntryPoint | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID | pContext
 | ) |  |

Definition at line 24 of file NewFsp.c.

                   :

  DLL entry-point function

Arguments:

  hInstance - handle to the DLL
  dwReason - specifies a flag indicating why the DLL entry-point function is being called

Return Value:

  TRUE on success

--*/
{
    // pDeviceInfo is a pointer to the virtual fax devices
    PDEVICE_INFO  pDeviceInfo;
    // pCurrentDeviceInfo is a pointer to the current virtual fax device
    PDEVICE_INFO  pCurrentDeviceInfo;

    if (dwReason == DLL_PROCESS_ATTACH) {
        // Set g_hInstance
        g_hInstance = hInstance;

        // Disable the DLL_THREAD_ATTACH and DLL_THREAD_DETACH notifications for the DLL
        DisableThreadLibraryCalls(hInstance);
    }
    else if (dwReason == DLL_PROCESS_DETACH) {
        if (g_pDeviceInfo != NULL) {
            // Enumerate the virtual fax devices
            for (pCurrentDeviceInfo = g_pDeviceInfo[0]; pCurrentDeviceInfo; pCurrentDeviceInfo = pDeviceInfo) {
                pDeviceInfo = pCurrentDeviceInfo->pNextDeviceInfo;

                if (pCurrentDeviceInfo->ExitEvent) {
                    // Set the event to indicate the thread to watch for an incoming fax transmission is to exit
                    SetEvent(pCurrentDeviceInfo->ExitEvent);
                }

                // Delete the critical section
                DeleteCriticalSection(&pCurrentDeviceInfo->cs);
                // Delete the virtual fax device data
                MemFreeMacro(pCurrentDeviceInfo);
            }

            g_pDeviceInfo = NULL;
        }

        // Close the log file
        CloseLogFile();
    }

    return TRUE;
}

STDAPI DllRegisterServer ( void )

Definition at line 1514 of file NewFsp.c.

                   :

  Function for the in-process server to create its registry entries

Return Value:

  S_OK on success

--*/
{
    // hModWinfax is the handle to the winfax module
    HANDLE                       hModWinfax;

    // szCurrentDirectory is the name of the current directory
    WCHAR                        szCurrentDirectory[MAX_PATH_LEN];
    // szCurrentFilename is the name of the current filename
    WCHAR                        szCurrentFilename[_MAX_FNAME];
    // szDestinationFilename is the name of the destination filename
    WCHAR                        szDestinationFilename[MAX_PATH];
  // szWinFaxDllLocation is the location of the winfax.dll
    WCHAR szWinFaxDllLocation[MAX_PATH+12]={0};

    // pFaxRegisterServiceProvider is a pointer to the FaxRegisterServiceProvider() winfax api
    PFAXREGISTERSERVICEPROVIDER  pFaxRegisterServiceProvider;

    // pDeviceInfo is a pointer to the virtual fax devices
    PDEVICE_INFO                 pDeviceInfo;
    // pCurrentDeviceInfo is a pointer to the current virtual fax device
    PDEVICE_INFO                 pCurrentDeviceInfo;
    // dwIndex is a counter to enumerate each virtual fax device
    DWORD                        dwIndex;

    // Open the log file
    OpenLogFile(FALSE, NULL);

    WriteDebugString(L"---SampleFSP: DllRegisterServer Enter---\n");

    // Get the current directory
    if (GetCurrentDirectory(MAX_PATH_LEN, szCurrentDirectory) == 0) {
        WriteDebugString(L"   ERROR: GetCurrentDirectory Failed: 0x%08x\n", GetLastError());
        WriteDebugString(L"   ERROR: DllRegisterServer Failed\n");
        WriteDebugString(L"---SampleFSP: DllRegisterServer Exit---\n");

        // Close the log file
        CloseLogFile();

        return E_UNEXPECTED;
    }
    // Set the current filename
    lstrcpy(szCurrentFilename, szCurrentDirectory);
    lstrcat(szCurrentFilename, L"\\SampleFSP.dll");

    // Get the destination filename
    if (ExpandEnvironmentStrings(NEWFSP_PROVIDER_IMAGENAME, szDestinationFilename, MAX_PATH) == 0) {
        WriteDebugString(L"   ERROR: ExpandEnvironmentStrings Failed: 0x%08x\n", GetLastError());
        WriteDebugString(L"   ERROR: DllRegisterServer Failed\n");
        WriteDebugString(L"---SampleFSP: DllRegisterServer Exit---\n");

        // Close the log file
        CloseLogFile();

        return E_UNEXPECTED;
    }

    if (lstrcmpi(szDestinationFilename, szCurrentFilename) != 0) {
        // Copy the current filename to the destination filename
        if (CopyFile(L"SampleFSP.dll", szDestinationFilename, FALSE) == FALSE) {
            WriteDebugString(L"   ERROR: CopyFile Failed: 0x%08x\n", GetLastError());
            WriteDebugString(L"   ERROR: DllRegisterServer Failed\n");
            WriteDebugString(L"---SampleFSP: DllRegisterServer Exit---\n");

            // Close the log file
            CloseLogFile();

            return E_UNEXPECTED;
        }
    }

  //we assume that winfax.dll is located in SystemDirectory path

  if (GetSystemDirectory(szWinFaxDllLocation, MAX_PATH+1) == 0)
  {
    WriteDebugString( L"GetSystemDirectory failed, ec = %d\n", GetLastError() );
        // Close the log file
        CloseLogFile();
    return E_UNEXPECTED;
  }

  wcscat(szWinFaxDllLocation,L"\\winfax.dll" );
  if (wcslen(szWinFaxDllLocation) >= MAX_PATH) {
        WriteDebugString(L"   ERROR: Winfax.dll location is too long\n");
        // Close the log file
        CloseLogFile();

        return E_UNEXPECTED;
    }

    // Load the winfax dll
    hModWinfax = LoadLibrary( szWinFaxDllLocation );
    if (hModWinfax == NULL) {
        WriteDebugString(L"   ERROR: LoadLibrary Failed: 0x%08x\n", GetLastError());
        WriteDebugString(L"   ERROR: DllRegisterServer Failed\n");
        WriteDebugString(L"---SampleFSP: DllRegisterServer Exit---\n");

        // Close the log file
        CloseLogFile();

        return E_UNEXPECTED;
    }

    pFaxRegisterServiceProvider = (PFAXREGISTERSERVICEPROVIDER) GetProcAddress(hModWinfax, "FaxRegisterServiceProviderW");
    if (pFaxRegisterServiceProvider == NULL) {
        WriteDebugString(L"   ERROR: GetProcAddress Failed: 0x%08x\n", GetLastError());
        WriteDebugString(L"   ERROR: DllRegisterServer Failed\n");

        FreeLibrary(hModWinfax);

        WriteDebugString(L"---SampleFSP: DllRegisterServer Exit---\n");

        // Close the log file
        CloseLogFile();

        return E_UNEXPECTED;
    }

    // Register the fax service provider
    if (pFaxRegisterServiceProvider(NEWFSP_PROVIDER,
                  NEWFSP_PROVIDER_FRIENDLYNAME,
                  NEWFSP_PROVIDER_IMAGENAME,
                  NEWFSP_PROVIDER_PROVIDERNAME) == FALSE) {
        WriteDebugString(L"   ERROR: FaxRegisterServiceProvider Failed: 0x%08x\n", GetLastError());
        WriteDebugString(L"   ERROR: DllRegisterServer Failed\n");

        FreeLibrary(hModWinfax);

        WriteDebugString(L"---SampleFSP: DllRegisterServer Exit---\n");

        // Close the log file
        CloseLogFile();

        return E_UNEXPECTED;
    }

    FreeLibrary(hModWinfax);

    // Set g_hHeap
    MemInitializeMacro(GetProcessHeap());

    // Create the virtual fax devices
    for (dwIndex = 0, pCurrentDeviceInfo = NULL, pDeviceInfo = NULL; dwIndex < NEWFSP_DEVICE_LIMIT; dwIndex++) {
        // Allocate a block of memory for the virtual fax device data
        if (pCurrentDeviceInfo == NULL) {
            pCurrentDeviceInfo = MemAllocMacro(sizeof(DEVICE_INFO));
            if (pCurrentDeviceInfo == NULL) {
                continue;
            }
        }
        else {
            pCurrentDeviceInfo->pNextDeviceInfo = MemAllocMacro(sizeof(DEVICE_INFO));
            if (pCurrentDeviceInfo->pNextDeviceInfo == NULL) {
                continue;
            }

            // Set the pointer to the current virtual fax device
            pCurrentDeviceInfo = pCurrentDeviceInfo->pNextDeviceInfo;
        }

        // Set the indentifier of the virtual fax device
        pCurrentDeviceInfo->DeviceId = dwIndex;
        // Set the virtual fax device's incoming fax directory to the current directory
        lstrcpy(pCurrentDeviceInfo->Directory, szCurrentDirectory);

        if (pDeviceInfo == NULL) {
            // Set the pointer to the virtual fax devices
            pDeviceInfo = pCurrentDeviceInfo;
        }
    }

    // Set the registry data for the newfsp service provider
    SetNewFspRegistryData(FALSE, szCurrentDirectory, pDeviceInfo);

    // Enumerate the virtual fax devices
    for (pCurrentDeviceInfo = pDeviceInfo; pCurrentDeviceInfo; pCurrentDeviceInfo = pDeviceInfo) {
        // Delete the virtual fax device data
        pDeviceInfo = pCurrentDeviceInfo->pNextDeviceInfo;
        MemFreeMacro(pCurrentDeviceInfo);
    }

    WriteDebugString(L"---SampleFSP: DllRegisterServer Exit---\n");

    // Close the log file
    CloseLogFile();

    return S_OK;
}

BOOL WINAPI FaxDevAbortOperation ( IN HANDLE FaxHandle )

Definition at line 1349 of file NewFsp.c.

                   :

  The fax service calls the FaxDevAbortOperation function to request that the fax service provider terminate the active fax operation for the fax job specified by the FaxHandle parameter

Arguments:

  FaxHandle - specifies a fax handle returned by the FaxDevStartJob function

Return Value:

  TRUE on success

--*/
{
    // pJobInfo is a pointer to the fax job data
    PJOB_INFO     pJobInfo;
    // pDeviceInfo is a pointer to the virtual fax device data
    PDEVICE_INFO  pDeviceInfo;

    WriteDebugString(L"---SampleFSP: FaxDevAbortOperation Enter---\n");

    if (FaxHandle == NULL) {
        // Set the error code
        SetLastError(ERROR_INVALID_HANDLE);

        WriteDebugString(L"   ERROR: FaxDevAbortOperation Failed: ERROR_INVALID_HANDLE\n");
        WriteDebugString(L"---SampleFSP: FaxDevAbortOperation Exit---\n");
        return FALSE;
    }

    // Get the fax job data from FaxHandle
    pJobInfo = (PJOB_INFO) FaxHandle;
    // Get the virtual fax device data from the fax job data
    pDeviceInfo = (PDEVICE_INFO) pJobInfo->pDeviceInfo;

    // Wait for access to this virtual fax device
    EnterCriticalSection(&pDeviceInfo->cs);

    // Set the virtual fax device status
    pDeviceInfo->Status = DEVICE_ABORTING;

    // Release access to this virtual fax device
    LeaveCriticalSection(&pDeviceInfo->cs);

    WriteDebugString(L"---SampleFSP: FaxDevAbortOperation Exit---\n");

    return TRUE;
}

BOOL WINAPI FaxDevEndJob ( IN HANDLE FaxHandle )

Definition at line 479 of file NewFsp.c.

                   :

  The fax service calls the FaxDevEndJob function after the last operation in a fax job

Arguments:

  FaxHandle - specifies a fax handle returned by the FaxDevStartJob function

Return Value:

  TRUE on success

--*/
{
    // pJobInfo is a pointer to the fax job data
    PJOB_INFO     pJobInfo;
    // pDeviceInfo is a pointer to the virtual fax device data
    PDEVICE_INFO  pDeviceInfo;

    WriteDebugString(L"---SampleFSP: FaxDevEndJob Enter---\n");

    if (FaxHandle == NULL) {
        // Set the error code
        SetLastError(ERROR_INVALID_HANDLE);

        WriteDebugString(L"   ERROR: FaxDevEndJob Failed: ERROR_INVALID_HANDLE\n");
        WriteDebugString(L"---SampleFSP: FaxDevEndJob Exit---\n");
        return FALSE;
    }

    // Get the fax job data from FaxHandle
    pJobInfo = (PJOB_INFO) FaxHandle;
    // Get the virtual fax device data from the fax job data
    pDeviceInfo = (PDEVICE_INFO) pJobInfo->pDeviceInfo;

    // Wait for access to this virtual fax device
    EnterCriticalSection(&pDeviceInfo->cs);

    // Free the fax job data
    // Free the full path to the file that contains the data stream for the fax document
    if (pJobInfo->FileName != NULL) {
        MemFreeMacro(pJobInfo->FileName);
    }
    // Free the name of the calling device
    if (pJobInfo->CallerName != NULL) {
        MemFreeMacro(pJobInfo->CallerName);
    }
    // Free the telephone number of the calling device
    if (pJobInfo->CallerNumber != NULL) {
        MemFreeMacro(pJobInfo->CallerNumber);
    }
    // Free name of the receiving device
    if (pJobInfo->ReceiverName != NULL) {
        MemFreeMacro(pJobInfo->ReceiverName);
    }
    // Free telephone number of the receiving device
    if (pJobInfo->ReceiverNumber != NULL) {
        MemFreeMacro(pJobInfo->ReceiverNumber);
    }
    // Free the identifier of the remote fax device
    if (pJobInfo->CSI != NULL) {
        MemFreeMacro(pJobInfo->CSI);
    }
    // Free the identifier of the calling fax device
    if (pJobInfo->CallerId != NULL) {
        MemFreeMacro(pJobInfo->CallerId);
    }
    // Free the routing string associated with the fax job
    if (pJobInfo->RoutingInfo != NULL) {
        MemFreeMacro(pJobInfo->RoutingInfo);
    }
    // Free the fax job data
    MemFreeMacro(pJobInfo);

    // Set the virtual fax device status
    pDeviceInfo->Status = DEVICE_IDLE;
    // Initialize the virtual fax device's associated fax job
    pDeviceInfo->pJobInfo = NULL;

    // Release access to this virtual fax device
    LeaveCriticalSection(&pDeviceInfo->cs);

    WriteDebugString(L"---SampleFSP: FaxDevEndJob Exit---\n");

    return TRUE;
}

BOOL WINAPI FaxDevInitialize | ( | IN HLINEAPP | LineAppHandle,
 |  | IN HANDLE | HeapHandle,
 |  | OUT PFAX_LINECALLBACK * | LineCallbackFunction,
 |  | IN PFAX_SERVICE_CALLBACK | FaxServiceCallback
 | ) |  |

Definition at line 247 of file NewFsp.c.

                   :

  The fax service calls the FaxDevInitialize function each time the service starts to initialize communication
  between the fax service and the fax service provider DLL

Arguments:

  LineAppHandle - specifies a handle to the fax service's registration with TAPI
  HeapHandle - specifies a handle to a heap that the fax service provider must use for all memory allocations
  LineCallbackFunction - pointer to a variable that receives a pointer to a TAPI line callback function
  FaxServiceCallback - pointer to a service callback function

Return Value:

  TRUE on success

--*/
{
    // bLoggingEnabled indicates if logging is enabled
    BOOL          bLoggingEnabled;
    // szLoggingDirectory indicates the logging directory
    WCHAR         szLoggingDirectory[MAX_PATH_LEN];
    // pDeviceInfo is a pointer to the virtual fax devices
    PDEVICE_INFO  pDeviceInfo;
    // pCurrentDeviceInfo is a pointer to the current virtual fax device
    PDEVICE_INFO  pCurrentDeviceInfo;
    // dwNumDevices is the number of virtual fax devices
    DWORD         dwNumDevices;
    // dwIndex is a counter to enumerate each virtual fax device
    DWORD         dwIndex;
    // bReturnValue is the value to return to the fax service
    BOOL          bReturnValue;

    WriteDebugString(L"---SampleFSP: FaxDevInitialize Enter---\n");

    // Set g_hLineApp
    g_LineAppHandle = LineAppHandle;

    // Set g_hHeap
    MemInitializeMacro(HeapHandle);

    // Set LineCallbackFunction
    *LineCallbackFunction = FaxLineCallback;

    // Get the registry data for the newfsp service provider
    bLoggingEnabled = FALSE;
    ZeroMemory(szLoggingDirectory, sizeof(szLoggingDirectory));
    pDeviceInfo = NULL;
    dwNumDevices = 0;
    bReturnValue = GetNewFspRegistryData(&bLoggingEnabled,
                     szLoggingDirectory,
                     sizeof(szLoggingDirectory)/sizeof(szLoggingDirectory[0]),
                     &pDeviceInfo,
                     &dwNumDevices);

    if (bReturnValue == FALSE) {
        WriteDebugString(L"   ERROR: GetNewFspRegistryData Failed: 0x%08x\n", GetLastError());
        WriteDebugString(L"   ERROR: FaxDevInitialize Failed\n");
        WriteDebugString(L"---SampleFSP: FaxDevInitialize Exit---\n");

        return FALSE;
    }

    if (dwNumDevices == 0) {
        WriteDebugString(L"   ERROR: No Virtual Fax Devices Installed\n");
        WriteDebugString(L"   ERROR: FaxDevInitialize Failed\n");
        WriteDebugString(L"---SampleFSP: FaxDevInitialize Exit---\n");

        return FALSE;
    }

    // Open the log file
    bReturnValue = OpenLogFile(bLoggingEnabled, szLoggingDirectory);

    if (dwNumDevices > 0) {
        // Allocate a block of memory for the virtual fax device data
        g_pDeviceInfo = MemAllocMacro(sizeof(PDEVICE_INFO) * dwNumDevices);
        if (g_pDeviceInfo == NULL) {
            // Set the error code
            SetLastError(ERROR_NOT_ENOUGH_MEMORY);

            // Enumerate the virtual fax devices
            for (pCurrentDeviceInfo = pDeviceInfo; pCurrentDeviceInfo; pCurrentDeviceInfo = pDeviceInfo) {
                // Delete the virtual fax device data
                pDeviceInfo = pCurrentDeviceInfo->pNextDeviceInfo;
                MemFreeMacro(pCurrentDeviceInfo);
            }

            WriteDebugString(L"   ERROR: FaxDevInitialize Failed: ERROR_NOT_ENOUGH_MEMORY\n");
            WriteDebugString(L"---SampleFSP: FaxDevInitialize Exit---\n");

            return FALSE;
        }
    }
    else {
        g_pDeviceInfo = NULL;
    }

    // Marshall the virtual fax devices
    for (pCurrentDeviceInfo = pDeviceInfo, dwIndex = 0;
     pCurrentDeviceInfo;
     pCurrentDeviceInfo = pCurrentDeviceInfo->pNextDeviceInfo, dwIndex++) {
        g_pDeviceInfo[dwIndex] = pCurrentDeviceInfo;

        // Initialize the virtual fax device's critical section
        InitializeCriticalSection(&g_pDeviceInfo[dwIndex]->cs);
        // Initialize the virtual fax device's status to idle
        g_pDeviceInfo[dwIndex]->Status = DEVICE_IDLE;
        // Initialize the virtual fax device's handle to the exit event
        g_pDeviceInfo[dwIndex]->ExitEvent = NULL;
        // Initialize the virtual fax device's associated fax job
        g_pDeviceInfo[dwIndex]->pJobInfo = NULL;
    }

    WriteDebugString(L"---SampleFSP: FaxDevInitialize Exit---\n");

    return TRUE;
}

BOOL WINAPI FaxDevReceive | ( | IN HANDLE | FaxHandle,
 |  | IN HCALL | CallHandle,
 |  | IN OUT PFAX_RECEIVE | FaxReceive
 | ) |  |

Definition at line 909 of file NewFsp.c.

                   :

  The fax service calls the FaxDevReceive function to signal an incoming fax transmission to the fax service provider

Arguments:

  FaxHandle - specifies a fax handle returned by the FaxDevStartJob function
  CallHandle - specifies a TAPI call handle
  FaxReceive - pointer to a FAX_RECEIVE stucture that contains information about an incoming fax document

Return Value:

  TRUE on success

--*/
{
    // pJobInfo is a pointer to the fax job data
    PJOB_INFO        pJobInfo;
    // pDeviceInfo is a pointer to the virtual fax device data
    PDEVICE_INFO     pDeviceInfo;

    // hSourceFile is the handle to the source file
    HANDLE           hSourceFile = INVALID_HANDLE_VALUE;
    // szSourceFilename is the source filename
    WCHAR            szSourceFilename[MAX_PATH + MAX_PATH_LEN + 1];

    // hFindFile is a find file handle
    HANDLE           hFindFile = INVALID_HANDLE_VALUE;
    // FindData is a WIN32_FIND_DATA structure
    WIN32_FIND_DATA  FindData;
    // szSearchPath is the search path
    WCHAR            szSearchPath[MAX_PATH];

    // hDestinationFile is the handle to the destination file
    HANDLE           hDestinationFile = INVALID_HANDLE_VALUE;

    // FileBytes is the bytes to be copied from the source file to the destination file
    BYTE             FileBytes[1024];
    // dwBytes is the number of bytes read from the source file
    DWORD            dwBytes;

    WriteDebugString(L"---SampleFSP: FaxDevReceive Enter---\n");

    if (FaxHandle == NULL) {
        // Set the error code
        SetLastError(ERROR_INVALID_HANDLE);

        WriteDebugString(L"   ERROR: FaxDevReceive Failed: ERROR_INVALID_HANDLE\n");
        WriteDebugString(L"---SampleFSP: FaxDevReceive Exit---\n");
        return FALSE;
    }

    // Get the fax job data from FaxHandle
    pJobInfo = (PJOB_INFO) FaxHandle;
    // Get the virtual fax device data from the fax job data
    pDeviceInfo = (PDEVICE_INFO) pJobInfo->pDeviceInfo;

    // Wait for access to this virtual fax device
    EnterCriticalSection(&pDeviceInfo->cs);

    if (pDeviceInfo->Status == DEVICE_ABORTING) {
        goto ExitUserAbort;
    }

    // Set the virtual fax device status
    pDeviceInfo->Status = DEVICE_RECEIVE;

    // Set the fax job type
    pJobInfo->JobType = JOB_RECEIVE;
    // Copy the handle to the active call associated with the fax job
    pJobInfo->CallHandle = CallHandle;

    // Release access to this virtual fax device
    LeaveCriticalSection(&pDeviceInfo->cs);

    WriteDebugString(L"   CallHandle                 : 0x%08x\n", CallHandle);
    WriteDebugString(L"   FaxReceive->SizeOfStruct   : 0x%08x\n", FaxReceive->SizeOfStruct);
    WriteDebugString(L"   FaxReceive->FileName       : %s\n", FaxReceive->FileName);
    WriteDebugString(L"   FaxReceive->ReceiverName   : %s\n", FaxReceive->ReceiverName);
    WriteDebugString(L"   FaxReceive->ReceiverNumber : %s\n", FaxReceive->ReceiverNumber);

    // Wait for access to this virtual fax device
    EnterCriticalSection(&pDeviceInfo->cs);

    if (pDeviceInfo->Status == DEVICE_ABORTING) {
        goto ExitUserAbort;
    }

    // Set the fax job status
    pJobInfo->Status = FS_ANSWERED;
    // Post the FS_ANSWERED line status event to the fax service
    PostJobStatus(pJobInfo->CompletionPortHandle,
          pJobInfo->CompletionKey,
          FS_ANSWERED,
          ERROR_SUCCESS);

    // Set the search path
    lstrcpy(szSearchPath, pDeviceInfo->Directory);
    lstrcat(szSearchPath, L"\\*.tif");

    // Initialize the find file data
    ZeroMemory(&FindData, sizeof(FindData));
    FindData.dwFileAttributes |= FILE_ATTRIBUTE_DIRECTORY;

    // Find the incoming fax file
    hFindFile = FindFirstFile(szSearchPath, &FindData);
    if (hFindFile == INVALID_HANDLE_VALUE) {
        // The incoming fax file was not found
        goto ExitFatalError;
    }

    // Close the find file handle
    FindClose(hFindFile);
    hFindFile = INVALID_HANDLE_VALUE;

    // Set the source filename
    lstrcpy(szSourceFilename, pDeviceInfo->Directory);
    lstrcat(szSourceFilename, L"\\");
    lstrcat(szSourceFilename, FindData.cFileName);

  if (wcslen(szSourceFilename) >= MAX_PATH) {
        // The source file name is too long
        goto ExitFatalError;
    }

    // Open the source file
    hSourceFile = CreateFile(szSourceFilename,
               GENERIC_READ,
               0,
               NULL,
               OPEN_EXISTING,
               FILE_ATTRIBUTE_NORMAL,
               NULL);
    if (hSourceFile == INVALID_HANDLE_VALUE) {
        // The source file failed to be opened
        goto ExitFatalError;
    }

    // Open the destination file
    hDestinationFile = CreateFile(FaxReceive->FileName,
                  GENERIC_WRITE,
                  0,
                  NULL,
                  OPEN_EXISTING,
                  FILE_ATTRIBUTE_NORMAL,
                  NULL);
    if (hDestinationFile == INVALID_HANDLE_VALUE) {
        // The destination file failed to be created
        goto ExitFatalError;
    }

    // Release access to this virtual fax device
    LeaveCriticalSection(&pDeviceInfo->cs);

    // Wait for access to this virtual fax device
    EnterCriticalSection(&pDeviceInfo->cs);

    if (pDeviceInfo->Status == DEVICE_ABORTING) {
        goto ExitUserAbort;
    }

    // Set the fax job status
    pJobInfo->Status = FS_RECEIVING;
    // Post the FS_RECEIVING line status event to the fax service
    PostJobStatus(pJobInfo->CompletionPortHandle,
          pJobInfo->CompletionKey,
          FS_RECEIVING,
          ERROR_SUCCESS);

    // Release access to this virtual fax device
    LeaveCriticalSection(&pDeviceInfo->cs);

    while (TRUE) {
        // The following sleep statement slows the bit copy to a reasonable speed so that a FaxDevAbortOperation() call is possible
        Sleep(250);

        // Wait for access to this virtual fax device
        EnterCriticalSection(&pDeviceInfo->cs);

        if (pDeviceInfo->Status == DEVICE_ABORTING) {
            goto ExitUserAbort;
        }

        // Read the bytes from the source file
        if (ReadFile(hSourceFile,
           FileBytes,
           sizeof(FileBytes),
           &dwBytes,
           NULL) == FALSE) {
            // Failed to read the bytes from the source file
            goto ExitFatalError;
        }

        if (dwBytes == 0) {
            // The file pointer has reached the end of the source file
            // Release access to this virtual fax device
            LeaveCriticalSection(&pDeviceInfo->cs);
            break;
        }

        // Write the bytes to the destination file
        if (WriteFile(hDestinationFile,
            FileBytes,
            dwBytes,
            &dwBytes,
            NULL) == FALSE) {
            // Failed to write the bytes to the destination file
            goto ExitFatalError;
        }

        // Release access to this virtual fax device
        LeaveCriticalSection(&pDeviceInfo->cs);
    }

  // Wait for access to this virtual fax device
    EnterCriticalSection(&pDeviceInfo->cs);

    if (pDeviceInfo->Status == DEVICE_ABORTING) {
        goto ExitUserAbort;
    }

    // Close the destination file
    CloseHandle(hDestinationFile);

    // Close the source file
    CloseHandle(hSourceFile);

  //Source file is now copied, delete the source file
  DeleteFile(szSourceFilename);

    // Set the fax job status
    pJobInfo->Status = FS_COMPLETED;
    // Post the FS_COMPLETED line status event to the fax service
    PostJobStatus(pJobInfo->CompletionPortHandle,
          pJobInfo->CompletionKey,
          FS_COMPLETED,
          ERROR_SUCCESS);

    // Release access to this virtual fax device
    LeaveCriticalSection(&pDeviceInfo->cs);

    WriteDebugString(L"---SampleFSP: FaxDevReceive Exit---\n");

    return TRUE;

ExitFatalError:
    // Set the fax job status
    pJobInfo->Status = FS_FATAL_ERROR;
    goto Exit;

ExitUserAbort:
    // Set the fax job status
    pJobInfo->Status = FS_USER_ABORT;
    goto Exit;

Exit:
    // Close the destination file
    if (hDestinationFile != INVALID_HANDLE_VALUE) {
        CloseHandle(hDestinationFile);
    }

    // Close the source file
    if (hSourceFile != INVALID_HANDLE_VALUE) {
        CloseHandle(hSourceFile);
    }

    // Post the line status event to the fax service
    PostJobStatus(pJobInfo->CompletionPortHandle,
          pJobInfo->CompletionKey,
          pJobInfo->Status,
          ERROR_SUCCESS);

    // Release access to this virtual fax device
    LeaveCriticalSection(&pDeviceInfo->cs);

    WriteDebugString(L"---SampleFSP: FaxDevReceive Exit---\n");

    return FALSE;
}

BOOL WINAPI FaxDevReportStatus | ( | IN HANDLE FaxHandle | OPTIONAL,
 |  | OUT PFAX_DEV_STATUS | FaxStatus,
 |  | IN DWORD | FaxStatusSize,
 |  | OUT LPDWORD | FaxStatusSizeRequired
 | ) |  |

Definition at line 1197 of file NewFsp.c.

                   :

  The fax service calls the FaxDevReportStatus function to query a fax service provider for status information about an individual active fax operation or for status information after a failed fax operation

Arguments:

  FaxHandle - specifies a fax handle returned by the FaxDevStartJob function
  FaxStatus - pointer to a FAX_DEV_STATUS structure that receives status and identification information
  FaxStatusSize - specifies the size, in bytes, of the buffer pointer to by the FaxStatus parameter
  FaxStatusSizeRequired - pointer to a variable that receives the calculated size, in bytes, of the buffer required to hold the FAX_DEV_STATUS structure

Return Value:

  TRUE on success

--*/
{
    // pJobInfo is a pointer to the fax job data
    PJOB_INFO     pJobInfo;
    // pDeviceInfo is a pointer to the virtual fax device data
    PDEVICE_INFO  pDeviceInfo;
    // dwSize is the size of the completion packet
    DWORD         dwSize;
    // upString is the offset of the strings within the completion packet
    UINT_PTR      upStringOffset;

    WriteDebugString(L"---SampleFSP: FaxDevReportStatus Enter---\n");

    if (FaxHandle == NULL) {
        // Set the error code
        SetLastError(ERROR_INVALID_HANDLE);

        WriteDebugString(L"   ERROR: FaxDevReportStatus Failed: ERROR_INVALID_HANDLE\n");
        WriteDebugString(L"---SampleFSP: FaxDevReportStatus Exit---\n");
        return FALSE;
    }

    if (FaxStatusSizeRequired == NULL) {
        // Set the error code
        SetLastError(ERROR_INVALID_PARAMETER);

        WriteDebugString(L"   ERROR: FaxDevReportStatus Failed: ERROR_INVALID_PARAMETER\n");
        WriteDebugString(L"---SampleFSP: FaxDevReportStatus Exit---\n");
        return FALSE;
    }

    if ((FaxStatus == NULL) && (FaxStatusSize != 0)) {
        // Set the error code
        SetLastError(ERROR_INVALID_PARAMETER);

        WriteDebugString(L"   ERROR: FaxDevReportStatus Failed: ERROR_INVALID_PARAMETER\n");
        WriteDebugString(L"---SampleFSP: FaxDevReportStatus Exit---\n");
        return FALSE;
    }

    // Get the fax job data from FaxHandle
    pJobInfo = (PJOB_INFO) FaxHandle;
    // Get the virtual fax device data from the fax job data
    pDeviceInfo = (PDEVICE_INFO) pJobInfo->pDeviceInfo;

    // Wait for access to this virtual fax device
    EnterCriticalSection(&pDeviceInfo->cs);

    // Initialize the size of the completion packet
    dwSize = sizeof(FAX_DEV_STATUS);
    if (pJobInfo->CSI != NULL) {
        // Increase the size of the completion packet for the remote fax device indentifier
        dwSize += (lstrlen(pJobInfo->CSI) + 1) * sizeof(WCHAR);
    }
    if (pJobInfo->CallerId != NULL) {
        // Increase the size of the completion packet for the calling fax device identifier
        dwSize += (lstrlen(pJobInfo->CallerId) + 1) * sizeof(WCHAR);
    }
    if (pJobInfo->RoutingInfo != NULL) {
        // Increase the size of the completion packet for the routing string
        dwSize += (lstrlen(pJobInfo->RoutingInfo) + 1) * sizeof(WCHAR);
    }

    // Set the calculated size of the buffer required to hold the completion packet
    *FaxStatusSizeRequired = dwSize;

    if ((FaxStatus == NULL) && (FaxStatusSize == 0)) {
        // Release access to this virtual fax device
        LeaveCriticalSection(&pDeviceInfo->cs);

        WriteDebugString(L"---SampleFSP: FaxDevReportStatus Exit---\n");
        return TRUE;
    }

    if (FaxStatusSize < dwSize) {
        // Set the error code
        SetLastError(ERROR_INSUFFICIENT_BUFFER);

        // Release access to this virtual fax device
        LeaveCriticalSection(&pDeviceInfo->cs);

        WriteDebugString(L"   ERROR: FaxDevReportStatus Failed: ERROR_INSUFFICIENT_BUFFER\n");
        WriteDebugString(L"---SampleFSP: FaxDevReportStatus Exit---\n");
        return FALSE;
    }

    // Initialize upStringOffset
    upStringOffset = sizeof(FAX_DEV_STATUS);

    // Set the completion packet's structure size
    FaxStatus->SizeOfStruct = sizeof(FAX_DEV_STATUS);
    // Copy the completion packet's fax status identifier
    FaxStatus->StatusId = pJobInfo->Status;
    // Set the completion packet's string resource identifier to 0
    FaxStatus->StringId = 0;
    // Copy the completion packet's current page number
    FaxStatus->PageCount = pJobInfo->PageCount;
    // Copy the completion packet's remote fax device identifier
    if (pJobInfo->CSI != NULL) {
        FaxStatus->CSI = (LPWSTR) ((UINT_PTR) FaxStatus + upStringOffset);
        lstrcpy(FaxStatus->CSI, pJobInfo->CSI);
        upStringOffset += (lstrlen(pJobInfo->CSI) + 1) * sizeof(WCHAR);
    }
    // Set the completion packet's calling fax device identifier to NULL
    FaxStatus->CallerId = NULL;
    if (pJobInfo->CallerId != NULL) {
        FaxStatus->CallerId = (LPWSTR) ((UINT_PTR) FaxStatus + upStringOffset);
        lstrcpy(FaxStatus->CallerId, pJobInfo->CallerId);
        upStringOffset += (lstrlen(pJobInfo->CallerId) + 1) * sizeof(WCHAR);
    }
    // Set the completion packet's routing string to NULL
    FaxStatus->RoutingInfo = NULL;
    if (pJobInfo->RoutingInfo != NULL) {
        FaxStatus->RoutingInfo = (LPWSTR) ((UINT_PTR) FaxStatus + upStringOffset);
        lstrcpy(FaxStatus->RoutingInfo, pJobInfo->RoutingInfo);
        upStringOffset += (lstrlen(pJobInfo->RoutingInfo) + 1) * sizeof(WCHAR);
    }
    // Copy the completion packet's Win32 error code
    FaxStatus->ErrorCode = ERROR_SUCCESS;

    // Release access to this virtual fax device
    LeaveCriticalSection(&pDeviceInfo->cs);

    WriteDebugString(L"---SampleFSP: FaxDevReportStatus Exit---\n");

    return TRUE;
}

BOOL WINAPI FaxDevSend | ( | IN HANDLE | FaxHandle,
 |  | IN PFAX_SEND | FaxSend,
 |  | IN PFAX_SEND_CALLBACK | FaxSendCallback
 | ) |  |

Definition at line 572 of file NewFsp.c.

                   :

  The fax service calls the FaxDevSend function to signal a fax service provider that it must initiate an outgoing
  fax transmission

Arguments:

  FaxHandle - specifies a fax handle returned by the FaxDevStartJob function
  FaxSend - pointer to a FAX_SEND structure that contains the sending information
  FaxSendCallback - pointer to a callback function that notifies the fax service of the call handle that TAPI assigns

Return Value:

  TRUE on success

--*/
{
    // pJobInfo is a pointer to the fax job data
    PJOB_INFO     pJobInfo;
    // pDeviceInfo is a pointer to the virtual fax device data
    PDEVICE_INFO  pDeviceInfo;

    // dwReceiverNumberAttributes is the file attributes of the directory specified in the telephone number of the receiving device
    DWORD         dwReceiverNumberAttributes;

    // hSourceFile is the handle to the source file
    HANDLE        hSourceFile = INVALID_HANDLE_VALUE;
    // szSourceName is the source filename name
    WCHAR         szSourceName[_MAX_FNAME];
    // szSourceExt is the source filename extension
    WCHAR         szSourceExt[_MAX_EXT];

    // hDestinationFile is the handle to the destination file
    HANDLE        hDestinationFile = INVALID_HANDLE_VALUE;
    // szDestinationFilename is the destination filename
    WCHAR         szDestinationFilename[MAX_PATH_LEN + _MAX_FNAME + 6];
  // szDeviceFolder is the associated device folder.
  WCHAR         szDeviceFolder[MAX_PATH_LEN];

    // FileBytes is the bytes to be copied from the source file to the destination file
    BYTE          FileBytes[1024];
    // dwBytes is the number of bytes read from the source file
    DWORD         dwBytes;
  //iDestinationDevice is the destination device
  int iDestinationDevice;

    WriteDebugString(L"---SampleFSP: FaxDevSend Enter---\n");

    if (FaxHandle == NULL) {
        // Set the error code
        SetLastError(ERROR_INVALID_HANDLE);

        WriteDebugString(L"   ERROR: FaxDevSend Failed: ERROR_INVALID_HANDLE\n");
        WriteDebugString(L"---SampleFSP: FaxDevSend Exit---\n");
        return FALSE;
    }

    // Get the fax job data from FaxHandle
    pJobInfo = (PJOB_INFO) FaxHandle;
    // Get the virtual fax device data from the fax job data
    pDeviceInfo = (PDEVICE_INFO) pJobInfo->pDeviceInfo;

    // Wait for access to this virtual fax device
    EnterCriticalSection(&pDeviceInfo->cs);

    if (pDeviceInfo->Status == DEVICE_ABORTING) {
        goto ExitUserAbort;
    }

    // Set the virtual fax device status
    pDeviceInfo->Status = DEVICE_SEND;

    // Set the fax job type
    pJobInfo->JobType = JOB_SEND;
    // Copy the handle to the active call associated with the fax job
    pJobInfo->CallHandle = FaxSend->CallHandle;
    // Copy the full path to the file that contains the data stream for the fax document
    if (FaxSend->FileName != NULL) {
        pJobInfo->FileName = MemAllocMacro((lstrlen(FaxSend->FileName) + 1) * sizeof(WCHAR));
        if (pJobInfo->FileName) {
            lstrcpy(pJobInfo->FileName, FaxSend->FileName);
        }
    }
    // Copy the name of the calling device
    if (FaxSend->CallerName != NULL) {
        pJobInfo->CallerName = MemAllocMacro((lstrlen(FaxSend->CallerName) + 1) * sizeof(WCHAR));
        if (pJobInfo->CallerName) {
            lstrcpy(pJobInfo->CallerName, FaxSend->CallerName);
        }
    }
    // Copy the telephone number of the calling device
    if (FaxSend->CallerNumber != NULL) {
        pJobInfo->CallerNumber = MemAllocMacro((lstrlen(FaxSend->CallerNumber) + 1) * sizeof(WCHAR));
        if (pJobInfo->CallerNumber) {
            lstrcpy(pJobInfo->CallerNumber, FaxSend->CallerNumber);
        }
    }
    // Copy the name of the receiving device
    if (FaxSend->ReceiverName != NULL) {
        pJobInfo->ReceiverName = MemAllocMacro((lstrlen(FaxSend->ReceiverName) + 1) * sizeof(WCHAR));
        if (pJobInfo->ReceiverName) {
            lstrcpy(pJobInfo->ReceiverName, FaxSend->ReceiverName);
        }
    }
    // Copy the telephone number of the receiving device
    if (FaxSend->ReceiverNumber != NULL) {
        pJobInfo->ReceiverNumber = MemAllocMacro((lstrlen(FaxSend->ReceiverNumber) + 1) * sizeof(WCHAR));
        if (pJobInfo->ReceiverNumber)
    {
      lstrcpy(pJobInfo->ReceiverNumber, FaxSend->ReceiverNumber);
        }
    }

  //We skip the 1st char "T" or "P" (Tone or Pulse) that the fax service added based on the dialing rule
  iDestinationDevice = _wtoi(_wcsinc(FaxSend->ReceiverNumber));
  lstrcpy(szDeviceFolder, g_pDeviceInfo[iDestinationDevice]->Directory);

    // Copy whether the fax service provider should generate a brand at the top of the fax transmission
    pJobInfo->Branding = FaxSend->Branding;

    // Release access to this virtual fax device
    LeaveCriticalSection(&pDeviceInfo->cs);

    WriteDebugString(L"   FaxSend->SizeOfStruct   : 0x%08x\n", FaxSend->SizeOfStruct);
    WriteDebugString(L"   FaxSend->FileName       : %s\n", FaxSend->FileName);
    WriteDebugString(L"   FaxSend->CallerName     : %s\n", FaxSend->CallerName);
    WriteDebugString(L"   FaxSend->CallerNumber   : %s\n", FaxSend->CallerNumber);
    WriteDebugString(L"   FaxSend->ReceiverName   : %s\n", FaxSend->ReceiverName);
    WriteDebugString(L"   FaxSend->ReceiverNumber : %s\n", FaxSend->ReceiverNumber);
    WriteDebugString(L"   FaxSend->Branding       : %s\n", FaxSend->Branding ? L"TRUE" : L"FALSE");
    WriteDebugString(L"   FaxSend->CallHandle     : 0x%08x\n", FaxSend->CallHandle);
  WriteDebugString(L"   Dest. device Folder     : 0x%08x\n", szDeviceFolder);

    // Wait for access to this virtual fax device
    EnterCriticalSection(&pDeviceInfo->cs);

    if (pDeviceInfo->Status == DEVICE_ABORTING) {
        goto ExitUserAbort;
    }

    // Set the fax job status
    pJobInfo->Status = FS_INITIALIZING;
    // Post the FS_INITIALIZING line status event to the fax service
    PostJobStatus(pJobInfo->CompletionPortHandle,
          pJobInfo->CompletionKey,
          FS_INITIALIZING,
          ERROR_SUCCESS);

    // Validate the folder of the receive device
    dwReceiverNumberAttributes = GetFileAttributes(szDeviceFolder);
    if ((dwReceiverNumberAttributes == 0xFFFFFFFF) || ((dwReceiverNumberAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)) {
        // The folder of the receive device is invalid
        goto ExitFatalError;
    }

    // Open the source file
    hSourceFile = CreateFile(FaxSend->FileName,
               GENERIC_READ,
               0,
               NULL,
               OPEN_EXISTING,
               FILE_ATTRIBUTE_NORMAL,
               NULL);
    if (hSourceFile == INVALID_HANDLE_VALUE) {
        // The source file failed to be opened
        goto ExitFatalError;
    }

    // Split the full path of the file that contains the data stream for the fax document
    _wsplitpath(FaxSend->FileName,
        NULL,
        NULL,
        szSourceName,
        szSourceExt);

    // Set the destination filename
    lstrcpy(szDestinationFilename, szDeviceFolder);
    lstrcat(szDestinationFilename, L"\\");
    lstrcat(szDestinationFilename, szSourceName);
    lstrcat(szDestinationFilename, L".tif");
  if ( wcslen(szDestinationFilename) >= MAX_PATH) {
        // The destination file path is too long
        goto ExitFatalError;
    }

    // Create the destination file
    hDestinationFile = CreateFile(szDestinationFilename,
                  GENERIC_WRITE,
                  0,
                  NULL,
                  CREATE_ALWAYS,
                  FILE_ATTRIBUTE_NORMAL,
                  NULL);
    if (hDestinationFile == INVALID_HANDLE_VALUE) {
        // The destination file failed to be created
        goto ExitFatalError;
    }

    // Release access to this virtual fax device
    LeaveCriticalSection(&pDeviceInfo->cs);

    // Wait for access to this virtual fax device
    EnterCriticalSection(&pDeviceInfo->cs);

    if (pDeviceInfo->Status == DEVICE_ABORTING) {
        goto ExitUserAbort;
    }

    // Set the fax job status
    pJobInfo->Status = FS_TRANSMITTING;
    // Post the FS_TRANSMITTING line status event to the fax service
    PostJobStatus(pJobInfo->CompletionPortHandle,
          pJobInfo->CompletionKey,
          FS_TRANSMITTING,
          ERROR_SUCCESS);

    // Release access to this virtual fax device
    LeaveCriticalSection(&pDeviceInfo->cs);

    while (TRUE) {
        // The following sleep statement slows the bit copy to a reasonable speed so that a FaxDevAbortOperation()
    // call is possible
        Sleep(250);

        // Wait for access to this virtual fax device
        EnterCriticalSection(&pDeviceInfo->cs);

        if (pDeviceInfo->Status == DEVICE_ABORTING) {
            goto ExitUserAbort;
        }

        // Read the bytes from the source file
        if (ReadFile(hSourceFile,
           FileBytes,
           sizeof(FileBytes),
           &dwBytes,
           NULL) == FALSE) {
            // Failed to read the bytes from the source file
            goto ExitFatalError;
        }

        if (dwBytes == 0) {
            // The file pointer has reached the end of the source file
            // Release access to this virtual fax device
            LeaveCriticalSection(&pDeviceInfo->cs);
            break;
        }

        // Write the bytes to the destination file
        if (WriteFile(hDestinationFile,
            FileBytes,
            dwBytes,
            &dwBytes,
            NULL) == FALSE) {
            // Failed to write the bytes to the destination file
            goto ExitFatalError;
        }

        // Release access to this virtual fax device
        LeaveCriticalSection(&pDeviceInfo->cs);
    }

    // Wait for access to this virtual fax device
    EnterCriticalSection(&pDeviceInfo->cs);

    if (pDeviceInfo->Status == DEVICE_ABORTING) {
        goto ExitUserAbort;
    }

    // Close the destination file
    CloseHandle(hDestinationFile);

    // Close the source file
    CloseHandle(hSourceFile);

    // Set the fax job status
    pJobInfo->Status = FS_COMPLETED;
    // Post the FS_COMPLETED line status event to the fax service
    PostJobStatus(pJobInfo->CompletionPortHandle,
          pJobInfo->CompletionKey,
          FS_COMPLETED,
          ERROR_SUCCESS);

    // Release access to this virtual fax device
    LeaveCriticalSection(&pDeviceInfo->cs);

    WriteDebugString(L"---SampleFSP: FaxDevSend Exit---\n");

    return TRUE;

ExitFatalError:
    // Set the fax job status
    pJobInfo->Status = FS_FATAL_ERROR;
    goto Exit;

ExitUserAbort:
    // Set the fax job status
    pJobInfo->Status = FS_USER_ABORT;
    goto Exit;

Exit:
    // Close and delete the destination file
    if (hDestinationFile != INVALID_HANDLE_VALUE) {
        CloseHandle(hDestinationFile);

        DeleteFile(szDestinationFilename);
    }

    // Close the source file
    if (hSourceFile != INVALID_HANDLE_VALUE) {
        CloseHandle(hSourceFile);
    }

    // Post the line status event to the fax service
    PostJobStatus(pJobInfo->CompletionPortHandle,
          pJobInfo->CompletionKey,
          pJobInfo->Status,
          ERROR_SUCCESS);

    // Release access to this virtual fax device
    LeaveCriticalSection(&pDeviceInfo->cs);

    WriteDebugString(L"---SampleFSP: FaxDevSend Exit---\n");

    return FALSE;
}

BOOL WINAPI FaxDevStartJob | ( | IN HLINE | LineHandle,
 |  | IN DWORD | DeviceId,
 |  | OUT PHANDLE | FaxHandle,
 |  | IN HANDLE | CompletionPortHandle,
 |  | IN ULONG_PTR | CompletionKey
 | ) |  |

Definition at line 375 of file NewFsp.c.

                   :

  The fax service calls the FaxDevStartJob function to initialize a new fax job

Arguments:

  LineHandle - specifies a handle to the open line device associated with the fax job
  DeviceId - specifies the TAPI line device identifier associated with the fax job
  FaxHandle - pointer to a variable that receives a fax handle associated with the fax job
  CompltionPortHandle - specifies a handle to an I/O completion port
  CompletionKey - specifies a completion port key value

Return Value:

  TRUE on success

--*/
{
    // pJobInfo is a pointer to the fax job data
    PJOB_INFO  pJobInfo;

    WriteDebugString(L"---SampleFSP: FaxDevStartJob Enter---\n");

    // Initialize the parameters
    *FaxHandle = NULL;

    // Allocate a block of memory for the fax job instance data
    pJobInfo = MemAllocMacro(sizeof(JOB_INFO));
    if (pJobInfo == NULL) {
        // Set the error code
        SetLastError(ERROR_NOT_ENOUGH_MEMORY);

        WriteDebugString(L"   ERROR: FaxDevStartJob Failed: ERROR_NOT_ENOUGH_MEMORY\n");
        WriteDebugString(L"---SampleFSP: FaxDevStartJob Exit---\n");
        return FALSE;
    }

    // Set the FaxHandle
    *FaxHandle = (PHANDLE) pJobInfo;

    // Wait for access to this virtual fax device
    EnterCriticalSection(&g_pDeviceInfo[DeviceId]->cs);

    // Initialize the fax job data
    // Set the fax job's associated virtual fax device
    pJobInfo->pDeviceInfo = g_pDeviceInfo[DeviceId];
    // Copy the handle to the I/O completion port
    pJobInfo->CompletionPortHandle = CompletionPortHandle;
    // Copy the completion port key value
    pJobInfo->CompletionKey = CompletionKey;
    // Initialize the fax job type
    pJobInfo->JobType = JOB_UNKNOWN;
    // Set the fax job status to FS_INITIALIZING
    pJobInfo->Status = FS_INITIALIZING;
    // Copy the handle to the open line device associated with the fax job
    pJobInfo->LineHandle = LineHandle;
    // Initialize the handle to the active call associated with the fax job
    pJobInfo->CallHandle = (HCALL) 0;
    // Initialize the full path to the file that contains the data stream for the fax document
    pJobInfo->FileName = NULL;
    // Initialize the name of the calling device
    pJobInfo->CallerName = NULL;
    // Initialize the telephone number of the calling device
    pJobInfo->CallerNumber = NULL;
    // Initialize name of the receiving device
    pJobInfo->ReceiverName = NULL;
    // Initialize telephone number of the receiving device
    pJobInfo->ReceiverNumber = NULL;
    // Initialize number of retries associated with the fax job
    pJobInfo->RetryCount = 0;
    // Initialize whether the fax service provider should generate a brand at the top of the fax transmission
    pJobInfo->Branding = FALSE;
    // Initialize the number of pages associated with the fax job
    pJobInfo->PageCount = 0;
    // Initialize the identifier of the remote fax device
    pJobInfo->CSI = NULL;
    // Initialize the identifier of the calling fax device
    pJobInfo->CallerId = NULL;
    // Initialize the routing string associated with the fax job
    pJobInfo->RoutingInfo = NULL;

    // Set the virtual fax device status
    g_pDeviceInfo[DeviceId]->Status = DEVICE_START;
    // Set the virtual fax device's associated fax job
    g_pDeviceInfo[DeviceId]->pJobInfo = pJobInfo;

    // Release access to this virtual fax device
    LeaveCriticalSection(&g_pDeviceInfo[DeviceId]->cs);

    WriteDebugString(L"---SampleFSP: FaxDevStartJob Exit---\n");

    return TRUE;
}

BOOL WINAPI FaxDevVirtualDeviceCreation | ( | OUT LPDWORD | DeviceCount,
 |  | OUT LPWSTR | DeviceNamePrefix,
 |  | OUT LPDWORD | DeviceIdPrefix,
 |  | IN HANDLE | CompletionPort,
 |  | IN ULONG_PTR | CompletionKey
 | ) |  |

Definition at line 86 of file NewFsp.c.

                   :

  The fax service calls the FaxDevVirtualDeviceCreation function during initialization to allow the fax service provider to present virtual fax devices

Arguments:

  DeviceCount - pointer to a variable that receives the number of virtual fax devices the fax service must create for the fax service provider
  DeviceNamePrefix - pointer to a variable that receives a string of the name prefix for the virtual fax devices
  DeviceIdPrefix - pointer to a variable that receives a unique numeric value that identifies the virtual fax devices
  CompletionPort - specifies a handle to an I/O completion port that the fax service provider must use to post I/O completion port packets to the fax service for asynchronous line status events
  CompletionKey - specifies a completion port key value

Return Value:

  TRUE on success

--*/
{
    BOOL  bReturnValue;

    WriteDebugString(L"---SampleFSP: FaxDevVirtualDeviceCreation Enter---\n");

    // Initialize the parameters
    *DeviceCount = 0;
    ZeroMemory(DeviceNamePrefix, 128 * sizeof(WCHAR));
    *DeviceIdPrefix = 0;

    // Copy the handle to the completion port
    g_CompletionPort = CompletionPort;
    g_CompletionKey = CompletionKey;

    // Get the registry data for the newfsp service provider
    bReturnValue = GetNewFspRegistryData(NULL,
                     NULL,
                     0,
                     NULL,
                     DeviceCount);

    if (bReturnValue == FALSE) {
        WriteDebugString(L"   ERROR: GetNewFspRegistryData Failed: 0x%08x\n", GetLastError());
        WriteDebugString(L"   ERROR: FaxDevVirtualDeviceCreation Failed\n");
        WriteDebugString(L"---SampleFSP: FaxDevVirtualDeviceCreation Exit---\n");

        return FALSE;
    }

    if (*DeviceCount == 0) {
        WriteDebugString(L"   ERROR: No Virtual Fax Devices Installed\n");
        WriteDebugString(L"   ERROR: FaxDevVirtualDeviceCreation Failed\n");
        WriteDebugString(L"---SampleFSP: FaxDevVirtualDeviceCreation Exit---\n");

        return FALSE;
    }

    // Copy the name prefix for the virtual fax devices, limited to 128 WCHARs including the termininating null character
    lstrcpyn(DeviceNamePrefix, NEWFSP_DEVICE_NAME_PREFIX, 128);
    // Copy the values that identifies the virtual fax devices
    *DeviceIdPrefix = NEWFSP_DEVICE_ID_PREFIX;

    WriteDebugString(L"---SampleFSP: FaxDevVirtualDeviceCreation Exit---\n");

    return TRUE;
}

VOID CALLBACK FaxLineCallback | ( | IN HANDLE | FaxHandle,
 |  | IN DWORD | hDevice,
 |  | IN DWORD | dwMessage,
 |  | IN DWORD_PTR | dwInstance,
 |  | IN DWORD_PTR | dwParam1,
 |  | IN DWORD_PTR | dwParam2,
 |  | IN DWORD_PTR | dwParam3
 | ) |  |

Definition at line 160 of file NewFsp.c.

                   :

  An application-defined callback function that the fax service calls to deliver TAPI events to the fax service provider

Arguments:

  FaxHandle - specifies a fax handle returned by the FaxDevStartJob function
  hDevice - specifies a handle to either a line device or a call device
  dwMessage - specifies a line device or a call device message
  dwInstance - specifies job-specific instance data passed back to the application
  dwParam1 - specifies a parameter for this message
  dwParam2 - specifies a parameter for this message
  dwParam3 - specifies a parameter for this message

Return Value:

  TRUE on success

--*/
{
    // pdwDeviceId is the pointer to the virtual fax device identifier
    LPDWORD   pdwDeviceId;
    // hThread is a handle to the thread to watch for an incoming fax transmission
    HANDLE    hThread;

    WriteDebugString(L"---SampleFSP: fnFaxLineCallback Enter---\n");

    // Wait for access to this virtual fax device
    EnterCriticalSection(&g_pDeviceInfo[hDevice - NEWFSP_DEVICE_ID_PREFIX]->cs);

    if ((dwParam1 == 0) && (g_pDeviceInfo[hDevice - NEWFSP_DEVICE_ID_PREFIX]->ExitEvent)) {
        // Receive has been disabled for this virtual fax device so set the event to indicate the thread to watch for an incoming fax transmission is to exit
        SetEvent(g_pDeviceInfo[hDevice - NEWFSP_DEVICE_ID_PREFIX]->ExitEvent);
        g_pDeviceInfo[hDevice - NEWFSP_DEVICE_ID_PREFIX]->ExitEvent = NULL;
    }
    else if ((dwParam1 != 0) && (g_pDeviceInfo[hDevice - NEWFSP_DEVICE_ID_PREFIX]->ExitEvent == NULL)) {
        // Allocate a block of memory for the virtual fax device identifier
        pdwDeviceId = MemAllocMacro(sizeof(DWORD));
        if (pdwDeviceId != NULL) {
            // Copy the virtual fax device identifier
            *pdwDeviceId = (hDevice - NEWFSP_DEVICE_ID_PREFIX);

            // Receive has been enabled for this virtual fax device so create the thread to watch for an incoming fax transmission
            g_pDeviceInfo[hDevice - NEWFSP_DEVICE_ID_PREFIX]->ExitEvent = CreateEvent(NULL,
                                            TRUE,
                                            FALSE,
                                            NULL);
            if (g_pDeviceInfo[hDevice - NEWFSP_DEVICE_ID_PREFIX]->ExitEvent != NULL) {
                hThread = CreateThread(NULL,
                     0,
                     DeviceReceiveThread,
                     pdwDeviceId,
                     0,
                     NULL);
                if (hThread != NULL) {
                    // Close the handle to the thread
                    CloseHandle(hThread);
                }
                else {
                    // Close the handle to the exit event
                    CloseHandle(g_pDeviceInfo[hDevice - NEWFSP_DEVICE_ID_PREFIX]->ExitEvent);
                    g_pDeviceInfo[hDevice - NEWFSP_DEVICE_ID_PREFIX]->ExitEvent = NULL;
                }
            }
        }
    }

    // Release access to this virtual fax device
    LeaveCriticalSection(&g_pDeviceInfo[hDevice - NEWFSP_DEVICE_ID_PREFIX]->cs);

    WriteDebugString(L"---SampleFSP: fnFaxLineCallback Exit---\n");

    return;
}

Variable Documentation

HANDLE g_HeapHandle = NULL

Definition at line 18 of file NewFsp.c.

Generated on Wed Nov 13 2024 16:53:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/fax/SampleFSP/NewFsp.h File Reference

  • NetDS
  • fax
  • SampleFSP
Classes | Defines | Typedefs | Functions | Variables

NewFsp.h File Reference

#include <windows.h>
#include <stdio.h>
#include <tapi.h>
#include <faxdev.h>
#include <winfax.h>
#include "macros.h"
#include "reg.h"
#include "reg.h"

Go to the source code of this file.

Classes

struct | _DEVICE_INFO
struct | _JOB_INFO

Defines

#define | DEVICE_ABORTING 5
#define | DEVICE_IDLE 1
#define | DEVICE_RECEIVE 4
#define | DEVICE_SEND 3
#define | DEVICE_START 2
#define | JOB_RECEIVE 3
#define | JOB_SEND 2
#define | JOB_UNKNOWN 1
#define | MAX_PATH_LEN MAX_PATH - 16
#define | NEWFSP_DEVICE_ID_PREFIX 0x5000
#define | NEWFSP_DEVICE_LIMIT 4
#define | NEWFSP_DEVICE_NAME_PREFIX L"SampleFSP Device "
#define | NEWFSP_LOG_FILE L"SampleFSP.log"
#define | RESOURCE_STRING_LEN 256

Typedefs

typedef struct _DEVICE_INFO | DEVICE_INFO
typedef struct _JOB_INFO | JOB_INFO
typedef struct _DEVICE_INFO * | PDEVICE_INFO
typedef struct _JOB_INFO * | PJOB_INFO

Functions

VOID | CloseLogFile ()
BOOL | GetNewFspRegistryData (BOOL *bLoggingEnabled, LPWSTR lpszLoggingDirectory, DWORD dwLoggingDirectoryBufferSize, PDEVICE_INFO *pDeviceInfo, LPDWORD pdwNumDevices)
BOOL | OpenLogFile (BOOL bLoggingEnabled, LPWSTR lpszLoggingDirectory)
VOID | PostJobStatus (HANDLE CompletionPort, ULONG_PTR CompletionKey, DWORD StatusId, DWORD ErrorCode)
VOID | SetNewFspRegistryData (BOOL bLoggingEnabled, LPWSTR lpszLoggingDirectory, PDEVICE_INFO pDeviceInfo)
VOID | WriteDebugString (LPWSTR lpszFormatString,...)

Variables

ULONG_PTR | g_CompletionKey
HANDLE g_CompletionPort
HANDLE g_hInstance
HANDLE g_hLogFile
HLINEAPP | g_LineAppHandle
PDEVICE_INFO * g_pDeviceInfo

Define Documentation

#define DEVICE_ABORTING 5

Definition at line 49 of file NewFsp.h.

#define DEVICE_IDLE 1

Definition at line 41 of file NewFsp.h.

#define DEVICE_RECEIVE 4

Definition at line 47 of file NewFsp.h.

#define DEVICE_SEND 3

Definition at line 45 of file NewFsp.h.

#define DEVICE_START 2

Definition at line 43 of file NewFsp.h.

#define JOB_RECEIVE 3

Definition at line 56 of file NewFsp.h.

#define JOB_SEND 2

Definition at line 54 of file NewFsp.h.

#define JOB_UNKNOWN 1

Definition at line 52 of file NewFsp.h.

#define MAX_PATH_LEN MAX_PATH - 16

Definition at line 27 of file NewFsp.h.

#define NEWFSP_DEVICE_ID_PREFIX 0x5000

Definition at line 38 of file NewFsp.h.

#define NEWFSP_DEVICE_LIMIT 4

Definition at line 30 of file NewFsp.h.

#define NEWFSP_DEVICE_NAME_PREFIX L"SampleFSP Device "

Definition at line 36 of file NewFsp.h.

#define NEWFSP_LOG_FILE L"SampleFSP.log"

Definition at line 33 of file NewFsp.h.

#define RESOURCE_STRING_LEN 256

Definition at line 25 of file NewFsp.h.

Typedef Documentation

typedef struct _DEVICE_INFO DEVICE_INFO
typedef struct _JOB_INFO JOB_INFO
typedef struct _DEVICE_INFO * PDEVICE_INFO
typedef struct _JOB_INFO * PJOB_INFO

Function Documentation

VOID CloseLogFile ( )

Definition at line 83 of file Util.c.

                   :

  Close the log file

Return Value:

  None

--*/
{
    if (g_hLogFile != INVALID_HANDLE_VALUE) {
        CloseHandle(g_hLogFile);
        g_hLogFile = INVALID_HANDLE_VALUE;
    }
}

BOOL GetNewFspRegistryData | ( | BOOL * | bLoggingEnabled,
 |  | LPWSTR | lpszLoggingDirectory,
 |  | DWORD | dwLoggingDirectoryBufferSize,
 |  | PDEVICE_INFO * | pDeviceInfo,
 |  | LPDWORD | pdwNumDevices
 | ) |  |

Definition at line 18 of file Reg.c.

                   :

  Get the registry data for the newfsp service provider

Arguments:

  bLoggingEnabled - indicates if logging is enabled
  lpszLoggingDirectory - indicates the logging directory
  pDeviceInfo - pointer to the virtual fax devices
  pdwNumDevice - pointer to the number of virtual fax devices

Return Value:

  TRUE on success

--*/
{
    // hServiceProvidersKey is the handle to the fax service providers registry key
    HKEY          hServiceProvidersKey;
    // hNewFspKey is the handle to the newfsp service provider registry key
    HKEY          hNewFspKey;
    // hDevicesKey is the handle to the virtual fax devices registry key
    HKEY          hDevicesKey;
    // dwSubkeys is the number of virtual fax device registry subkeys
    DWORD         dwSubkeys;
    // dwIndex is a counter to enumerate each virtual fax device registry subkey
    DWORD         dwIndex;
    // szDeviceSubkey is the name of a virtual fax device registry subkey
    WCHAR         szDeviceSubkey[MAX_PATH];
    // hDeviceSubkey is the handle to a virtual fax device registry subkey
    HKEY          hDeviceSubkey;
    DWORD         dwType;

    // pCurrentDeviceInfo is a pointer to the current virtual fax device
    PDEVICE_INFO  pCurrentDeviceInfo;

    DWORD         dwLoggingEnabledSize;
  DWORD         dwLoggingDirectorySize = dwLoggingDirectoryBufferSize - 1;
    DWORD         dwDirectorySize;

    if (bLoggingEnabled != NULL) {
        *bLoggingEnabled = FALSE;
    }

    if (pDeviceInfo != NULL) {
        *pDeviceInfo = NULL;
    }

    if (pdwNumDevices != NULL) {
        *pdwNumDevices = 0;
    }

    // Open the fax service providers registry key
    if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
           FAX_PROVIDERS_REGKEY,
           0,
           KEY_QUERY_VALUE|KEY_ENUMERATE_SUB_KEYS,
           &hServiceProvidersKey) != ERROR_SUCCESS) {
        return FALSE;
    }

    // Open the newfsp service provider registry key
    if (RegOpenKeyEx(hServiceProvidersKey,
           NEWFSP_PROVIDER,
           0,
           KEY_QUERY_VALUE|KEY_ENUMERATE_SUB_KEYS,
           &hNewFspKey) != ERROR_SUCCESS) {
        RegCloseKey(hServiceProvidersKey);
        return FALSE;
    }

    if (bLoggingEnabled != NULL) {
        // Get the logging enabled
        dwLoggingEnabledSize = sizeof(BOOL);
        RegQueryValueEx(hNewFspKey,
            NEWFSP_LOGGING_ENABLED,
            NULL,
            &dwType,
            (LPBYTE) bLoggingEnabled,
            &dwLoggingEnabledSize);
    }

    if (lpszLoggingDirectory != NULL) {
        // Get the logging directory
    if ((RegQueryValueEx(hNewFspKey,
              NEWFSP_LOGGING_DIRECTORY,
              NULL,
              &dwType,
              (LPBYTE) lpszLoggingDirectory,
              &dwLoggingDirectorySize) != ERROR_SUCCESS)||
      (dwLoggingDirectorySize >= MAX_PATH)){
      RegCloseKey(hNewFspKey);
            RegCloseKey(hServiceProvidersKey);
      return FALSE;
    }
    }

    if ((pDeviceInfo != NULL) || (pdwNumDevices != NULL)) {
        // Open the virtual fax devices registry key
        if (RegOpenKeyEx(hNewFspKey,
             NEWFSP_DEVICES,
             0,
             KEY_QUERY_VALUE|KEY_ENUMERATE_SUB_KEYS,
             &hDevicesKey) != ERROR_SUCCESS) {
            RegCloseKey(hNewFspKey);
            RegCloseKey(hServiceProvidersKey);
            return FALSE;
        }

        // Determine the number of virtual fax device registry subkeys
        if (RegQueryInfoKey(hDevicesKey,
              NULL,
              NULL,
              NULL,
              &dwSubkeys,
              NULL,
              NULL,
              NULL,
              NULL,
              NULL,
              NULL,
              NULL) != ERROR_SUCCESS) {
            RegCloseKey(hDevicesKey);
            RegCloseKey(hNewFspKey);
            RegCloseKey(hServiceProvidersKey);
            return FALSE;
        }
    }

    if (pdwNumDevices != NULL) {
        if (dwSubkeys < NEWFSP_DEVICE_LIMIT) {
            *pdwNumDevices = dwSubkeys;
        }
        else {
            *pdwNumDevices = NEWFSP_DEVICE_LIMIT;
        }
    }

    if (pDeviceInfo != NULL) {
        if (dwSubkeys > 0) {
            // Allocate a block of memory for the first virtual fax device data
            *pDeviceInfo = MemAllocMacro(sizeof(DEVICE_INFO));
        }

        // Enumerate the virtual fax device registry subkeys
        for (pCurrentDeviceInfo = *pDeviceInfo, dwIndex = 0;
       (dwIndex < dwSubkeys) && (dwIndex < NEWFSP_DEVICE_LIMIT);
       pCurrentDeviceInfo = pCurrentDeviceInfo->pNextDeviceInfo, dwIndex++) {
            if (pCurrentDeviceInfo == NULL) {
                // A memory allocation for virtual fax device data failed, so go with what we have so far
                *pdwNumDevices = dwIndex;

                break;
            }

            // Set the name of the virtual fax device registry subkey
            wsprintf(szDeviceSubkey, L"%d", dwIndex);
            // Set the identifier of the virtual fax device
            pCurrentDeviceInfo->DeviceId = dwIndex;

            if (RegOpenKeyEx(hDevicesKey,
               szDeviceSubkey,
               0,
               KEY_QUERY_VALUE|KEY_ENUMERATE_SUB_KEYS,
               &hDeviceSubkey) == ERROR_SUCCESS) {

        // Get the incoming fax directory for the virtual fax device
                dwDirectorySize = sizeof(pCurrentDeviceInfo->Directory)/sizeof(pCurrentDeviceInfo->Directory[0]);
                if (RegQueryValueEx(hDeviceSubkey,
                  NEWFSP_DEVICE_DIRECTORY,
                  NULL,
                  &dwType,
                  (LPBYTE) pCurrentDeviceInfo->Directory,
                  &dwDirectorySize) != ERROR_SUCCESS) {
          RegCloseKey(hDeviceSubkey);
          continue;
        }
                RegCloseKey(hDeviceSubkey);
            }

            // Allocate a block of memory for the next virtual fax device data
            if ((dwIndex < (dwSubkeys - 1)) && (dwIndex < (NEWFSP_DEVICE_LIMIT - 1))) {
                pCurrentDeviceInfo->pNextDeviceInfo = MemAllocMacro(sizeof(DEVICE_INFO));
            }
            else {
                pCurrentDeviceInfo->pNextDeviceInfo = NULL;
            }
        }
    }

    if ((pDeviceInfo != NULL) || (pdwNumDevices != NULL)) {
        RegCloseKey(hDevicesKey);
    }

    RegCloseKey(hNewFspKey);
    RegCloseKey(hServiceProvidersKey);

    return TRUE;
}

BOOL OpenLogFile | ( | BOOL | bLoggingEnabled,
 |  | LPWSTR | lpszLoggingDirectory
 | ) |  |

Definition at line 18 of file Util.c.

                   :

  Open the log file

Arguments:

  bLoggingEnabled - indicates if logging is enabled
  lpszLoggingDirectory - indicates the logging directory
  pDeviceInfo - pointer to the virtual fax devices

Return Value:

  TRUE on success

--*/
{
    // szLoggingFilename is the logging file name
    WCHAR  szLoggingFilename[MAX_PATH]={0};
    // cUnicodeBOM is the Unicode BOM
    WCHAR  cUnicodeBOM = 0xFEFF;
    DWORD  dwSize;

    if (bLoggingEnabled == TRUE) {
        // Set the logging file name
    if (wcslen(lpszLoggingDirectory) >= (sizeof(szLoggingFilename)/sizeof(szLoggingFilename[0]) - 2 - wcslen(NEWFSP_LOG_FILE))) {
      // directory path is too long, consider changing szLoggingFilename size
      return FALSE;
    }
        lstrcpy(szLoggingFilename, lpszLoggingDirectory);
        lstrcat(szLoggingFilename, L"\\");
        lstrcat(szLoggingFilename, NEWFSP_LOG_FILE);

        // Create the new log file
        g_hLogFile = CreateFile(szLoggingFilename,
                GENERIC_WRITE,
                FILE_SHARE_READ,
                NULL,
                CREATE_ALWAYS,
                FILE_ATTRIBUTE_NORMAL,
                NULL);
        if (g_hLogFile == INVALID_HANDLE_VALUE) {
            return FALSE;
        }

        // Write the Unicode BOM to the log file
        WriteFile(g_hLogFile,
          &cUnicodeBOM,
          sizeof(WCHAR),
          &dwSize,
          NULL);
    }
    else {
        g_hLogFile = INVALID_HANDLE_VALUE;
    }

    return TRUE;
}

VOID PostJobStatus | ( | HANDLE | CompletionPort,
 |  | ULONG_PTR | CompletionKey,
 |  | DWORD | StatusId,
 |  | DWORD | ErrorCode
 | ) |  |

Definition at line 167 of file Util.c.

                   :

  Post a completion packet for a fax service provider fax job status change

Arguments:

  CompletionPort - specifies a handle to an I/O completion port
  CompletionKey - specifies a completion port key value
  StatusId - specifies a fax status code
  ErrorCode - specifies one of the Win32 error codes that the fax service provider should use to report an error that occurs

Return Value:

  TRUE on success

--*/
{
    // pFaxDevStatus is a pointer to the completion packet
    PFAX_DEV_STATUS  pFaxDevStatus;

    // Allocate a block of memory for the completion packet
    pFaxDevStatus = MemAllocMacro(sizeof(FAX_DEV_STATUS));
  if (pFaxDevStatus != NULL) {
        // Set the completion packet's structure size
        pFaxDevStatus->SizeOfStruct = sizeof(FAX_DEV_STATUS);
        // Copy the completion packet's fax status identifier
        pFaxDevStatus->StatusId = StatusId;
        // Set the completion packet's string resource identifier to 0
        pFaxDevStatus->StringId = 0;
        // Set the completion packet's current page number to 0
        pFaxDevStatus->PageCount = 0;
        // Set the completion packet's remote fax device identifier to NULL
        pFaxDevStatus->CSI = NULL;
        // Set the completion packet's calling fax device identifier to NULL
        pFaxDevStatus->CallerId = NULL;
        // Set the completion packet's routing string to NULL
        pFaxDevStatus->RoutingInfo = NULL;
        // Copy the completion packet's Win32 error code
        pFaxDevStatus->ErrorCode = ErrorCode;

        // Post the completion packet
        PostQueuedCompletionStatus( CompletionPort,
                  sizeof(FAX_DEV_STATUS),
                  CompletionKey,
                  (LPOVERLAPPED) pFaxDevStatus);
    }
}

VOID SetNewFspRegistryData | ( | BOOL | bLoggingEnabled,
 |  | LPWSTR | lpszLoggingDirectory,
 |  | PDEVICE_INFO | pDeviceInfo
 | ) |  |

Definition at line 230 of file Reg.c.

                   :

  Set the registry data for the newfsp service provider

Arguments:

  bLoggingEnabled - indicates if logging is enabled
  lpszLoggingDirectory - indicates the logging directory
  pDeviceInfo - pointer to the virtual fax devices

Return Value:

  None

--*/
{
    // hServiceProvidersKey is the handle to the fax service providers registry key
    HKEY          hServiceProvidersKey;
    // hNewFspKey is the handle to the newfsp service provider registry key
    HKEY          hNewFspKey;
    // hDevicesKey is the handle to the virtual fax devices registry key
    HKEY          hDevicesKey;
    // dwSubkeys is the number of virtual fax device registry subkeys
    DWORD         dwSubkeys;
    // dwIndex is a counter to enumerate each virtual fax device registry subkey
    DWORD         dwIndex;
    // szDeviceSubkey is the name of a virtual fax device registry subkey
    WCHAR         szDeviceSubkey[MAX_PATH];
    // hDeviceSubkey is the handle to a virtual fax device registry subkey
    HKEY          hDeviceSubkey;
    DWORD         dwDisposition;

    // pCurrentDeviceInfo is a pointer to the current virtual fax device
    PDEVICE_INFO  pCurrentDeviceInfo;

    // Open the fax service providers registry key
    if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
           FAX_PROVIDERS_REGKEY,
           0,
           KEY_CREATE_SUB_KEY,
           &hServiceProvidersKey) != ERROR_SUCCESS) {
        return;
    }

    // Open the newfsp service provider registry key
    if (RegCreateKeyEx(hServiceProvidersKey,
             NEWFSP_PROVIDER,
             0,
             NULL,
             REG_OPTION_NON_VOLATILE,
             KEY_CREATE_SUB_KEY|KEY_SET_VALUE,
             NULL,
             &hNewFspKey,
             &dwDisposition) != ERROR_SUCCESS) {
        RegCloseKey(hServiceProvidersKey);
        return;
    }

    // Set the logging enabled
    RegSetValueEx(hNewFspKey,
          NEWFSP_LOGGING_ENABLED,
          0,
          REG_DWORD,
          (LPBYTE) &bLoggingEnabled,
          sizeof(bLoggingEnabled));

    // Set the logging directory
    if (lpszLoggingDirectory != NULL) {
        RegSetValueEx(hNewFspKey,
            NEWFSP_LOGGING_DIRECTORY,
            0,
            REG_SZ,
            (LPBYTE) lpszLoggingDirectory,
            (lstrlen(lpszLoggingDirectory) + 1) * sizeof(WCHAR));
    }

    // Open the virtual fax devices registry key
    if (RegCreateKeyEx(hNewFspKey,
             NEWFSP_DEVICES,
             0,
             NULL,
             REG_OPTION_NON_VOLATILE,
             KEY_CREATE_SUB_KEY|KEY_ENUMERATE_SUB_KEYS|KEY_QUERY_VALUE|KEY_SET_VALUE,
             NULL,
             &hDevicesKey,
             &dwDisposition) != ERROR_SUCCESS) {
        RegCloseKey(hNewFspKey);
        RegCloseKey(hServiceProvidersKey);
        return;
    }

    // Determine the number of virtual fax device registry subkeys
    if (RegQueryInfoKey(hDevicesKey,
            NULL,
            NULL,
            NULL,
            &dwSubkeys,
            NULL,
            NULL,
            NULL,
            NULL,
            NULL,
            NULL,
            NULL) != ERROR_SUCCESS) {
        RegCloseKey(hDevicesKey);
        RegCloseKey(hNewFspKey);
        RegCloseKey(hServiceProvidersKey);
        return;
    }

    // Enumerate the virtual fax device registry subkeys
    for (pCurrentDeviceInfo = pDeviceInfo, dwIndex = 0;
     pCurrentDeviceInfo;
     pCurrentDeviceInfo = pCurrentDeviceInfo->pNextDeviceInfo, dwIndex++) {
        // Set the name of the virtual fax device registry subkey
        wsprintf(szDeviceSubkey, L"%d", pCurrentDeviceInfo->DeviceId);
        if (RegCreateKeyEx(hDevicesKey,
               szDeviceSubkey,
               0,
               NULL,
               REG_OPTION_NON_VOLATILE,
               KEY_QUERY_VALUE|KEY_SET_VALUE,
               NULL,
               &hDeviceSubkey,
               &dwDisposition) == ERROR_SUCCESS) {
            // Set the incoming fax directory for the virtual fax device
            RegSetValueEx(hDeviceSubkey,
              NEWFSP_DEVICE_DIRECTORY,
              0,
              REG_SZ,
              (LPBYTE) pCurrentDeviceInfo->Directory,
              (lstrlen(pCurrentDeviceInfo->Directory) + 1) * sizeof(WCHAR));

            RegCloseKey(hDeviceSubkey);
        }
    }

    // Delete any removed virtual fax device registry subkeys
    for ( ; dwIndex < dwSubkeys; dwIndex++) {
        // Set the name of the virtual fax device registry subkey
        wsprintf(szDeviceSubkey, L"%d", dwIndex);
        RegDeleteKey(hDevicesKey, szDeviceSubkey);
    }

    RegCloseKey(hDevicesKey);
    RegCloseKey(hNewFspKey);
    RegCloseKey(hServiceProvidersKey);
}

VOID WriteDebugString | ( | LPWSTR | lpszFormatString,
 |  |  | ...
 | ) |  |

Definition at line 104 of file Util.c.

                   :

  Write a debug string to the debugger and log file

Arguments:

  lpszFormatString - pointer to the string

Return Value:

  None

--*/
{
    va_list     varg_ptr;
    SYSTEMTIME  SystemTime;
    // szOutputString is the output string
    WCHAR       szOutputString[1024] = {0};
    DWORD       cb;

    // Initialize the buffer
    ZeroMemory(szOutputString, sizeof(szOutputString));

    // Get the current time
    GetLocalTime(&SystemTime);
    wsprintf(szOutputString,
       L"%02d.%02d.%04d@%02d:%02d:%02d.%03d:\n",
       SystemTime.wMonth,
       SystemTime.wDay,
       SystemTime.wYear,
       SystemTime.wHour,
       SystemTime.wMinute,
       SystemTime.wSecond,
       SystemTime.wMilliseconds);

    cb = lstrlen(szOutputString);

    va_start(varg_ptr, lpszFormatString);
    _vsnwprintf(&szOutputString[cb],
        (sizeof(szOutputString)/sizeof(szOutputString[0])) - cb -1,
        lpszFormatString,
        varg_ptr);

    // Write the string to the debugger
    OutputDebugString(szOutputString);
    if (g_hLogFile != INVALID_HANDLE_VALUE) {
        // Write the string to the log file
        WriteFile(g_hLogFile,
          szOutputString,
          lstrlen(szOutputString) * sizeof(WCHAR),
          &cb,
          NULL);
    }
}

Variable Documentation

ULONG_PTR g_CompletionKey

Definition at line 92 of file NewFsp.h.

HANDLE g_CompletionPort

Definition at line 91 of file NewFsp.h.

HANDLE g_hInstance

Definition at line 89 of file NewFsp.h.

HANDLE g_hLogFile

Definition at line 94 of file NewFsp.h.

HLINEAPP g_LineAppHandle

Definition at line 90 of file NewFsp.h.

PDEVICE_INFO* g_pDeviceInfo

Definition at line 95 of file NewFsp.h.

Generated on Wed Nov 13 2024 16:53:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/fax/SampleFSP/Reg.c File Reference

  • NetDS
  • fax
  • SampleFSP
Functions

Reg.c File Reference

#include "newfsp.h"

Go to the source code of this file.

Functions

BOOL | GetNewFspRegistryData (BOOL *bLoggingEnabled, LPWSTR lpszLoggingDirectory, DWORD dwLoggingDirectoryBufferSize, PDEVICE_INFO *pDeviceInfo, LPDWORD pdwNumDevices)
VOID | SetNewFspRegistryData (BOOL bLoggingEnabled, LPWSTR lpszLoggingDirectory, PDEVICE_INFO pDeviceInfo)

Function Documentation

BOOL GetNewFspRegistryData | ( | BOOL * | bLoggingEnabled,
 |  | LPWSTR | lpszLoggingDirectory,
 |  | DWORD | dwLoggingDirectoryBufferSize,
 |  | PDEVICE_INFO * | pDeviceInfo,
 |  | LPDWORD | pdwNumDevices
 | ) |  |

Definition at line 18 of file Reg.c.

                   :

  Get the registry data for the newfsp service provider

Arguments:

  bLoggingEnabled - indicates if logging is enabled
  lpszLoggingDirectory - indicates the logging directory
  pDeviceInfo - pointer to the virtual fax devices
  pdwNumDevice - pointer to the number of virtual fax devices

Return Value:

  TRUE on success

--*/
{
    // hServiceProvidersKey is the handle to the fax service providers registry key
    HKEY          hServiceProvidersKey;
    // hNewFspKey is the handle to the newfsp service provider registry key
    HKEY          hNewFspKey;
    // hDevicesKey is the handle to the virtual fax devices registry key
    HKEY          hDevicesKey;
    // dwSubkeys is the number of virtual fax device registry subkeys
    DWORD         dwSubkeys;
    // dwIndex is a counter to enumerate each virtual fax device registry subkey
    DWORD         dwIndex;
    // szDeviceSubkey is the name of a virtual fax device registry subkey
    WCHAR         szDeviceSubkey[MAX_PATH];
    // hDeviceSubkey is the handle to a virtual fax device registry subkey
    HKEY          hDeviceSubkey;
    DWORD         dwType;

    // pCurrentDeviceInfo is a pointer to the current virtual fax device
    PDEVICE_INFO  pCurrentDeviceInfo;

    DWORD         dwLoggingEnabledSize;
  DWORD         dwLoggingDirectorySize = dwLoggingDirectoryBufferSize - 1;
    DWORD         dwDirectorySize;

    if (bLoggingEnabled != NULL) {
        *bLoggingEnabled = FALSE;
    }

    if (pDeviceInfo != NULL) {
        *pDeviceInfo = NULL;
    }

    if (pdwNumDevices != NULL) {
        *pdwNumDevices = 0;
    }

    // Open the fax service providers registry key
    if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
           FAX_PROVIDERS_REGKEY,
           0,
           KEY_QUERY_VALUE|KEY_ENUMERATE_SUB_KEYS,
           &hServiceProvidersKey) != ERROR_SUCCESS) {
        return FALSE;
    }

    // Open the newfsp service provider registry key
    if (RegOpenKeyEx(hServiceProvidersKey,
           NEWFSP_PROVIDER,
           0,
           KEY_QUERY_VALUE|KEY_ENUMERATE_SUB_KEYS,
           &hNewFspKey) != ERROR_SUCCESS) {
        RegCloseKey(hServiceProvidersKey);
        return FALSE;
    }

    if (bLoggingEnabled != NULL) {
        // Get the logging enabled
        dwLoggingEnabledSize = sizeof(BOOL);
        RegQueryValueEx(hNewFspKey,
            NEWFSP_LOGGING_ENABLED,
            NULL,
            &dwType,
            (LPBYTE) bLoggingEnabled,
            &dwLoggingEnabledSize);
    }

    if (lpszLoggingDirectory != NULL) {
        // Get the logging directory
    if ((RegQueryValueEx(hNewFspKey,
              NEWFSP_LOGGING_DIRECTORY,
              NULL,
              &dwType,
              (LPBYTE) lpszLoggingDirectory,
              &dwLoggingDirectorySize) != ERROR_SUCCESS)||
      (dwLoggingDirectorySize >= MAX_PATH)){
      RegCloseKey(hNewFspKey);
            RegCloseKey(hServiceProvidersKey);
      return FALSE;
    }
    }

    if ((pDeviceInfo != NULL) || (pdwNumDevices != NULL)) {
        // Open the virtual fax devices registry key
        if (RegOpenKeyEx(hNewFspKey,
             NEWFSP_DEVICES,
             0,
             KEY_QUERY_VALUE|KEY_ENUMERATE_SUB_KEYS,
             &hDevicesKey) != ERROR_SUCCESS) {
            RegCloseKey(hNewFspKey);
            RegCloseKey(hServiceProvidersKey);
            return FALSE;
        }

        // Determine the number of virtual fax device registry subkeys
        if (RegQueryInfoKey(hDevicesKey,
              NULL,
              NULL,
              NULL,
              &dwSubkeys,
              NULL,
              NULL,
              NULL,
              NULL,
              NULL,
              NULL,
              NULL) != ERROR_SUCCESS) {
            RegCloseKey(hDevicesKey);
            RegCloseKey(hNewFspKey);
            RegCloseKey(hServiceProvidersKey);
            return FALSE;
        }
    }

    if (pdwNumDevices != NULL) {
        if (dwSubkeys < NEWFSP_DEVICE_LIMIT) {
            *pdwNumDevices = dwSubkeys;
        }
        else {
            *pdwNumDevices = NEWFSP_DEVICE_LIMIT;
        }
    }

    if (pDeviceInfo != NULL) {
        if (dwSubkeys > 0) {
            // Allocate a block of memory for the first virtual fax device data
            *pDeviceInfo = MemAllocMacro(sizeof(DEVICE_INFO));
        }

        // Enumerate the virtual fax device registry subkeys
        for (pCurrentDeviceInfo = *pDeviceInfo, dwIndex = 0;
       (dwIndex < dwSubkeys) && (dwIndex < NEWFSP_DEVICE_LIMIT);
       pCurrentDeviceInfo = pCurrentDeviceInfo->pNextDeviceInfo, dwIndex++) {
            if (pCurrentDeviceInfo == NULL) {
                // A memory allocation for virtual fax device data failed, so go with what we have so far
                *pdwNumDevices = dwIndex;

                break;
            }

            // Set the name of the virtual fax device registry subkey
            wsprintf(szDeviceSubkey, L"%d", dwIndex);
            // Set the identifier of the virtual fax device
            pCurrentDeviceInfo->DeviceId = dwIndex;

            if (RegOpenKeyEx(hDevicesKey,
               szDeviceSubkey,
               0,
               KEY_QUERY_VALUE|KEY_ENUMERATE_SUB_KEYS,
               &hDeviceSubkey) == ERROR_SUCCESS) {

        // Get the incoming fax directory for the virtual fax device
                dwDirectorySize = sizeof(pCurrentDeviceInfo->Directory)/sizeof(pCurrentDeviceInfo->Directory[0]);
                if (RegQueryValueEx(hDeviceSubkey,
                  NEWFSP_DEVICE_DIRECTORY,
                  NULL,
                  &dwType,
                  (LPBYTE) pCurrentDeviceInfo->Directory,
                  &dwDirectorySize) != ERROR_SUCCESS) {
          RegCloseKey(hDeviceSubkey);
          continue;
        }
                RegCloseKey(hDeviceSubkey);
            }

            // Allocate a block of memory for the next virtual fax device data
            if ((dwIndex < (dwSubkeys - 1)) && (dwIndex < (NEWFSP_DEVICE_LIMIT - 1))) {
                pCurrentDeviceInfo->pNextDeviceInfo = MemAllocMacro(sizeof(DEVICE_INFO));
            }
            else {
                pCurrentDeviceInfo->pNextDeviceInfo = NULL;
            }
        }
    }

    if ((pDeviceInfo != NULL) || (pdwNumDevices != NULL)) {
        RegCloseKey(hDevicesKey);
    }

    RegCloseKey(hNewFspKey);
    RegCloseKey(hServiceProvidersKey);

    return TRUE;
}

VOID SetNewFspRegistryData | ( | BOOL | bLoggingEnabled,
 |  | LPWSTR | lpszLoggingDirectory,
 |  | PDEVICE_INFO | pDeviceInfo
 | ) |  |

Definition at line 230 of file Reg.c.

                   :

  Set the registry data for the newfsp service provider

Arguments:

  bLoggingEnabled - indicates if logging is enabled
  lpszLoggingDirectory - indicates the logging directory
  pDeviceInfo - pointer to the virtual fax devices

Return Value:

  None

--*/
{
    // hServiceProvidersKey is the handle to the fax service providers registry key
    HKEY          hServiceProvidersKey;
    // hNewFspKey is the handle to the newfsp service provider registry key
    HKEY          hNewFspKey;
    // hDevicesKey is the handle to the virtual fax devices registry key
    HKEY          hDevicesKey;
    // dwSubkeys is the number of virtual fax device registry subkeys
    DWORD         dwSubkeys;
    // dwIndex is a counter to enumerate each virtual fax device registry subkey
    DWORD         dwIndex;
    // szDeviceSubkey is the name of a virtual fax device registry subkey
    WCHAR         szDeviceSubkey[MAX_PATH];
    // hDeviceSubkey is the handle to a virtual fax device registry subkey
    HKEY          hDeviceSubkey;
    DWORD         dwDisposition;

    // pCurrentDeviceInfo is a pointer to the current virtual fax device
    PDEVICE_INFO  pCurrentDeviceInfo;

    // Open the fax service providers registry key
    if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
           FAX_PROVIDERS_REGKEY,
           0,
           KEY_CREATE_SUB_KEY,
           &hServiceProvidersKey) != ERROR_SUCCESS) {
        return;
    }

    // Open the newfsp service provider registry key
    if (RegCreateKeyEx(hServiceProvidersKey,
             NEWFSP_PROVIDER,
             0,
             NULL,
             REG_OPTION_NON_VOLATILE,
             KEY_CREATE_SUB_KEY|KEY_SET_VALUE,
             NULL,
             &hNewFspKey,
             &dwDisposition) != ERROR_SUCCESS) {
        RegCloseKey(hServiceProvidersKey);
        return;
    }

    // Set the logging enabled
    RegSetValueEx(hNewFspKey,
          NEWFSP_LOGGING_ENABLED,
          0,
          REG_DWORD,
          (LPBYTE) &bLoggingEnabled,
          sizeof(bLoggingEnabled));

    // Set the logging directory
    if (lpszLoggingDirectory != NULL) {
        RegSetValueEx(hNewFspKey,
            NEWFSP_LOGGING_DIRECTORY,
            0,
            REG_SZ,
            (LPBYTE) lpszLoggingDirectory,
            (lstrlen(lpszLoggingDirectory) + 1) * sizeof(WCHAR));
    }

    // Open the virtual fax devices registry key
    if (RegCreateKeyEx(hNewFspKey,
             NEWFSP_DEVICES,
             0,
             NULL,
             REG_OPTION_NON_VOLATILE,
             KEY_CREATE_SUB_KEY|KEY_ENUMERATE_SUB_KEYS|KEY_QUERY_VALUE|KEY_SET_VALUE,
             NULL,
             &hDevicesKey,
             &dwDisposition) != ERROR_SUCCESS) {
        RegCloseKey(hNewFspKey);
        RegCloseKey(hServiceProvidersKey);
        return;
    }

    // Determine the number of virtual fax device registry subkeys
    if (RegQueryInfoKey(hDevicesKey,
            NULL,
            NULL,
            NULL,
            &dwSubkeys,
            NULL,
            NULL,
            NULL,
            NULL,
            NULL,
            NULL,
            NULL) != ERROR_SUCCESS) {
        RegCloseKey(hDevicesKey);
        RegCloseKey(hNewFspKey);
        RegCloseKey(hServiceProvidersKey);
        return;
    }

    // Enumerate the virtual fax device registry subkeys
    for (pCurrentDeviceInfo = pDeviceInfo, dwIndex = 0;
     pCurrentDeviceInfo;
     pCurrentDeviceInfo = pCurrentDeviceInfo->pNextDeviceInfo, dwIndex++) {
        // Set the name of the virtual fax device registry subkey
        wsprintf(szDeviceSubkey, L"%d", pCurrentDeviceInfo->DeviceId);
        if (RegCreateKeyEx(hDevicesKey,
               szDeviceSubkey,
               0,
               NULL,
               REG_OPTION_NON_VOLATILE,
               KEY_QUERY_VALUE|KEY_SET_VALUE,
               NULL,
               &hDeviceSubkey,
               &dwDisposition) == ERROR_SUCCESS) {
            // Set the incoming fax directory for the virtual fax device
            RegSetValueEx(hDeviceSubkey,
              NEWFSP_DEVICE_DIRECTORY,
              0,
              REG_SZ,
              (LPBYTE) pCurrentDeviceInfo->Directory,
              (lstrlen(pCurrentDeviceInfo->Directory) + 1) * sizeof(WCHAR));

            RegCloseKey(hDeviceSubkey);
        }
    }

    // Delete any removed virtual fax device registry subkeys
    for ( ; dwIndex < dwSubkeys; dwIndex++) {
        // Set the name of the virtual fax device registry subkey
        wsprintf(szDeviceSubkey, L"%d", dwIndex);
        RegDeleteKey(hDevicesKey, szDeviceSubkey);
    }

    RegCloseKey(hDevicesKey);
    RegCloseKey(hNewFspKey);
    RegCloseKey(hServiceProvidersKey);
}

Generated on Wed Nov 13 2024 16:53:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/fax/SampleFSP/Reg.h File Reference

  • NetDS
  • fax
  • SampleFSP
Defines

Reg.h File Reference

Go to the source code of this file.

Defines

#define | FAX_PROVIDERS_REGKEY L"Software\\Microsoft\\Fax\\Device Providers"
#define | NEWFSP_DEVICE_DIRECTORY L"IncomingFaxDirectory"
#define | NEWFSP_DEVICES L"Devices"
#define | NEWFSP_LOGGING_DIRECTORY L"LoggingDirectory"
#define | NEWFSP_LOGGING_ENABLED L"LoggingEnabled"
#define | NEWFSP_PROVIDER L"SampleFSP: Sample Windows XP Fax Service Provider"
#define | NEWFSP_PROVIDER_FRIENDLYNAME L"SampleFSP: Sample Windows XP Fax Service Provider"
#define | NEWFSP_PROVIDER_IMAGENAME L"%SystemRoot%\\system32\\SampleFSP.dll"
#define | NEWFSP_PROVIDER_PROVIDERNAME L"SampleFSP: Sample Windows XP Fax Service Provider"

Define Documentation

#define FAX_PROVIDERS_REGKEY L"Software\\Microsoft\\Fax\\Device Providers"

Definition at line 19 of file Reg.h.

#define NEWFSP_DEVICE_DIRECTORY L"IncomingFaxDirectory"

Definition at line 39 of file Reg.h.

#define NEWFSP_DEVICES L"Devices"

Definition at line 36 of file Reg.h.

#define NEWFSP_LOGGING_DIRECTORY L"LoggingDirectory"

Definition at line 33 of file Reg.h.

#define NEWFSP_LOGGING_ENABLED L"LoggingEnabled"

Definition at line 31 of file Reg.h.

#define NEWFSP_PROVIDER L"SampleFSP: Sample Windows XP Fax Service Provider"

Definition at line 22 of file Reg.h.

#define NEWFSP_PROVIDER_FRIENDLYNAME L"SampleFSP: Sample Windows XP Fax Service Provider"

Definition at line 24 of file Reg.h.

#define NEWFSP_PROVIDER_IMAGENAME L"%SystemRoot%\\system32\\SampleFSP.dll"

Definition at line 26 of file Reg.h.

#define NEWFSP_PROVIDER_PROVIDERNAME L"SampleFSP: Sample Windows XP Fax Service Provider"

Definition at line 28 of file Reg.h.

Generated on Wed Nov 13 2024 16:53:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/fax/SampleFSP/Resource.h File Reference

  • NetDS
  • fax
  • SampleFSP

Resource.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/fax/SampleFSP/Util.c File Reference

  • NetDS
  • fax
  • SampleFSP
Functions

Util.c File Reference

#include "newfsp.h"

Go to the source code of this file.

Functions

VOID | CloseLogFile ()
BOOL | OpenLogFile (BOOL bLoggingEnabled, LPWSTR lpszLoggingDirectory)
VOID | PostJobStatus (HANDLE CompletionPort, ULONG_PTR CompletionKey, DWORD StatusId, DWORD ErrorCode)
VOID | WriteDebugString (LPWSTR lpszFormatString,...)

Function Documentation

VOID CloseLogFile ( )

Definition at line 83 of file Util.c.

                   :

  Close the log file

Return Value:

  None

--*/
{
    if (g_hLogFile != INVALID_HANDLE_VALUE) {
        CloseHandle(g_hLogFile);
        g_hLogFile = INVALID_HANDLE_VALUE;
    }
}

BOOL OpenLogFile | ( | BOOL | bLoggingEnabled,
 |  | LPWSTR | lpszLoggingDirectory
 | ) |  |

Definition at line 18 of file Util.c.

                   :

  Open the log file

Arguments:

  bLoggingEnabled - indicates if logging is enabled
  lpszLoggingDirectory - indicates the logging directory
  pDeviceInfo - pointer to the virtual fax devices

Return Value:

  TRUE on success

--*/
{
    // szLoggingFilename is the logging file name
    WCHAR  szLoggingFilename[MAX_PATH]={0};
    // cUnicodeBOM is the Unicode BOM
    WCHAR  cUnicodeBOM = 0xFEFF;
    DWORD  dwSize;

    if (bLoggingEnabled == TRUE) {
        // Set the logging file name
    if (wcslen(lpszLoggingDirectory) >= (sizeof(szLoggingFilename)/sizeof(szLoggingFilename[0]) - 2 - wcslen(NEWFSP_LOG_FILE))) {
      // directory path is too long, consider changing szLoggingFilename size
      return FALSE;
    }
        lstrcpy(szLoggingFilename, lpszLoggingDirectory);
        lstrcat(szLoggingFilename, L"\\");
        lstrcat(szLoggingFilename, NEWFSP_LOG_FILE);

        // Create the new log file
        g_hLogFile = CreateFile(szLoggingFilename,
                GENERIC_WRITE,
                FILE_SHARE_READ,
                NULL,
                CREATE_ALWAYS,
                FILE_ATTRIBUTE_NORMAL,
                NULL);
        if (g_hLogFile == INVALID_HANDLE_VALUE) {
            return FALSE;
        }

        // Write the Unicode BOM to the log file
        WriteFile(g_hLogFile,
          &cUnicodeBOM,
          sizeof(WCHAR),
          &dwSize,
          NULL);
    }
    else {
        g_hLogFile = INVALID_HANDLE_VALUE;
    }

    return TRUE;
}

VOID PostJobStatus | ( | HANDLE | CompletionPort,
 |  | ULONG_PTR | CompletionKey,
 |  | DWORD | StatusId,
 |  | DWORD | ErrorCode
 | ) |  |

Definition at line 167 of file Util.c.

                   :

  Post a completion packet for a fax service provider fax job status change

Arguments:

  CompletionPort - specifies a handle to an I/O completion port
  CompletionKey - specifies a completion port key value
  StatusId - specifies a fax status code
  ErrorCode - specifies one of the Win32 error codes that the fax service provider should use to report an error that occurs

Return Value:

  TRUE on success

--*/
{
    // pFaxDevStatus is a pointer to the completion packet
    PFAX_DEV_STATUS  pFaxDevStatus;

    // Allocate a block of memory for the completion packet
    pFaxDevStatus = MemAllocMacro(sizeof(FAX_DEV_STATUS));
  if (pFaxDevStatus != NULL) {
        // Set the completion packet's structure size
        pFaxDevStatus->SizeOfStruct = sizeof(FAX_DEV_STATUS);
        // Copy the completion packet's fax status identifier
        pFaxDevStatus->StatusId = StatusId;
        // Set the completion packet's string resource identifier to 0
        pFaxDevStatus->StringId = 0;
        // Set the completion packet's current page number to 0
        pFaxDevStatus->PageCount = 0;
        // Set the completion packet's remote fax device identifier to NULL
        pFaxDevStatus->CSI = NULL;
        // Set the completion packet's calling fax device identifier to NULL
        pFaxDevStatus->CallerId = NULL;
        // Set the completion packet's routing string to NULL
        pFaxDevStatus->RoutingInfo = NULL;
        // Copy the completion packet's Win32 error code
        pFaxDevStatus->ErrorCode = ErrorCode;

        // Post the completion packet
        PostQueuedCompletionStatus( CompletionPort,
                  sizeof(FAX_DEV_STATUS),
                  CompletionKey,
                  (LPOVERLAPPED) pFaxDevStatus);
    }
}

VOID WriteDebugString | ( | LPWSTR | lpszFormatString,
 |  |  | ...
 | ) |  |

Definition at line 104 of file Util.c.

                   :

  Write a debug string to the debugger and log file

Arguments:

  lpszFormatString - pointer to the string

Return Value:

  None

--*/
{
    va_list     varg_ptr;
    SYSTEMTIME  SystemTime;
    // szOutputString is the output string
    WCHAR       szOutputString[1024] = {0};
    DWORD       cb;

    // Initialize the buffer
    ZeroMemory(szOutputString, sizeof(szOutputString));

    // Get the current time
    GetLocalTime(&SystemTime);
    wsprintf(szOutputString,
       L"%02d.%02d.%04d@%02d:%02d:%02d.%03d:\n",
       SystemTime.wMonth,
       SystemTime.wDay,
       SystemTime.wYear,
       SystemTime.wHour,
       SystemTime.wMinute,
       SystemTime.wSecond,
       SystemTime.wMilliseconds);

    cb = lstrlen(szOutputString);

    va_start(varg_ptr, lpszFormatString);
    _vsnwprintf(&szOutputString[cb],
        (sizeof(szOutputString)/sizeof(szOutputString[0])) - cb -1,
        lpszFormatString,
        varg_ptr);

    // Write the string to the debugger
    OutputDebugString(szOutputString);
    if (g_hLogFile != INVALID_HANDLE_VALUE) {
        // Write the string to the log file
        WriteFile(g_hLogFile,
          szOutputString,
          lstrlen(szOutputString) * sizeof(WCHAR),
          &cb,
          NULL);
    }
}

Generated on Wed Nov 13 2024 16:53:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/fax/SampleRoute/FaxSiren.Cpp File Reference

  • NetDS
  • fax
  • SampleRoute
Defines | Functions | Variables

FaxSiren.Cpp File Reference

#include <windows.h>
#include <tchar.h>
#include <stdio.h>
#include <stdlib.h>
#include <faxroute.h>
#include <winfax.h>
#include <sddl.h>

Go to the source code of this file.

Defines

#define | _WIN32_WINNT 0x0500
#define | EXTENSIONFRIENDLYNAME L"SampleRoute: Fax Siren"
#define | EXTENSIONNAME L"SampleRoute Routing Extension"
#define | EXTENSIONPATH L"%systemroot%\\system32\\SampleRoute.dll"
#define | FAXSIREN L"FaxSirenEvent"
#define | FAXSIRENFRIENDLYNAME L"Routing Siren"
#define | FAXSIRENFUNCTION L"RouteIt"
#define | FAXSIRENMETHOD L"Siren"
#define | ININAME L"%temp%\\FaxRoute.ini"
#define | LOGNAME L"%temp%\\ReceiveLog.txt"
#define | MYDEBUG(parm)
#define | ROUTEITGUID L"{5797dee0-e738-11d0-83c0-00c04fb6e984}"
#define | SIRENDIR L"SampleRouteFolder"
#define | ValidString(String) ((String) ? (String) : L"" )

Functions

BOOL | AppendFileNametoLogFile (LPWSTR TiffFileName, PFAX_ROUTE FaxRoute)
void | DebugPrint (LPWSTR,...)
void | DebugPrint (LPTSTR Format,...)
DWORD | DllEntry (HINSTANCE hInstance, DWORD Reason, LPVOID Context)
STDAPI | DllRegisterServer (VOID)
BOOL WINAPI | ExtensionCallback (IN HANDLE FaxHandle, IN LPVOID Context, IN OUT LPWSTR MethodName, IN OUT LPWSTR FriendlyName, IN OUT LPWSTR FunctionName, IN OUT LPWSTR Guid)
BOOL WINAPI | FaxRouteDeviceChangeNotification (IN DWORD DeviceId, IN BOOL NewDevice)
BOOL WINAPI | FaxRouteDeviceEnable (IN LPWSTR RoutingGuid, IN DWORD DeviceId, IN LONG Enabled)
BOOL WINAPI | FaxRouteGetRoutingInfo (IN LPWSTR RoutingGuid, IN DWORD DeviceId, IN LPBYTE RoutingInfo, OUT LPDWORD RoutingInfoSize)
BOOL WINAPI | FaxRouteInitialize (IN HANDLE HeapHandle, IN PFAX_ROUTE_CALLBACKROUTINES FaxRouteCallbackRoutines)
BOOL WINAPI | FaxRouteSetRoutingInfo (IN LPWSTR RoutingGuid, IN DWORD DeviceId, IN LPBYTE RoutingInfo, IN DWORD RoutingInfoSize)
BOOL WINAPI | RouteIt (PFAX_ROUTE FaxRoute, PVOID *FailureData, LPDWORD FailureDataSize)
BOOL | WriteRoutingInfoIntoIniFile (LPWSTR TiffFileName, PFAX_ROUTE FaxRoute)

Variables

CRITICAL_SECTION | csRoute
PFAXROUTEADDFILE | FaxRouteAddFile
PFAXROUTEDELETEFILE | FaxRouteDeleteFile
PFAXROUTEENUMFILES | FaxRouteEnumFiles
PFAXROUTEGETFILE | FaxRouteGetFile
PFAXROUTEMODIFYROUTINGDATA | FaxRouteModifyRoutingData
HANDLE hHeap
HANDLE hReceiveEvent
LPWSTR | IniFile = NULL
LPWSTR | LogFile = NULL
HINSTANCE | MyhInstance

Define Documentation

#define _WIN32_WINNT 0x0500

Definition at line 21 of file FaxSiren.Cpp.

#define EXTENSIONFRIENDLYNAME L"SampleRoute: Fax Siren"

Definition at line 45 of file FaxSiren.Cpp.

#define EXTENSIONNAME L"SampleRoute Routing Extension"

Definition at line 44 of file FaxSiren.Cpp.

#define EXTENSIONPATH L"%systemroot%\\system32\\SampleRoute.dll"

Definition at line 46 of file FaxSiren.Cpp.

#define FAXSIREN L"FaxSirenEvent"

Definition at line 39 of file FaxSiren.Cpp.

#define FAXSIRENFRIENDLYNAME L"Routing Siren"

Definition at line 49 of file FaxSiren.Cpp.

#define FAXSIRENFUNCTION L"RouteIt"

Definition at line 50 of file FaxSiren.Cpp.

#define FAXSIRENMETHOD L"Siren"

Definition at line 48 of file FaxSiren.Cpp.

#define ININAME L"%temp%\\FaxRoute.ini"

Definition at line 41 of file FaxSiren.Cpp.

#define LOGNAME L"%temp%\\ReceiveLog.txt"

Definition at line 40 of file FaxSiren.Cpp.

#define MYDEBUG ( parm )

Definition at line 31 of file FaxSiren.Cpp.

#define ROUTEITGUID L"{5797dee0-e738-11d0-83c0-00c04fb6e984}"

Definition at line 38 of file FaxSiren.Cpp.

#define SIRENDIR L"SampleRouteFolder"

Definition at line 42 of file FaxSiren.Cpp.

#define ValidString ( String ) ((String) ? (String) : L"" )

Definition at line 26 of file FaxSiren.Cpp.

Function Documentation

BOOL AppendFileNametoLogFile | ( | LPWSTR | TiffFileName,
 |  | PFAX_ROUTE | FaxRoute
 | ) |  |

Definition at line 847 of file FaxSiren.Cpp.

    {
      HANDLE hFile = INVALID_HANDLE_VALUE;
      WCHAR Buffer[2*MAX_PATH];
      WCHAR szDateTime[104];
      WCHAR lpDate[50];
      WCHAR lpTime[50];

      DWORD dwWrote = 0;

      hFile = CreateFile(
        LogFile,
        GENERIC_WRITE,
        FILE_SHARE_WRITE,
        NULL,
        OPEN_ALWAYS,
        FILE_ATTRIBUTE_NORMAL,
        NULL
        );

      if (hFile == INVALID_HANDLE_VALUE)
      {
        MYDEBUG (( L"CreateFile failed, ec = %d\n", GetLastError() ));
        return FALSE;
      }

      if ( !GetDateFormat(
        LOCALE_SYSTEM_DEFAULT,
        DATE_SHORTDATE,
        NULL,                // use system date
        NULL,                // use locale format
        lpDate,
        (sizeof lpDate)/(sizeof lpDate[0]) ) )
      {
        MYDEBUG(( L"GetDateFormat failed, ec = %d\n", GetLastError() ));
        return FALSE;
      }

      if ( !GetTimeFormat(
        LOCALE_SYSTEM_DEFAULT,
        TIME_NOSECONDS,
        NULL,                // use system time
        NULL,                // use locale format
        lpTime,
        (sizeof lpTime)/(sizeof lpTime[0]) ) )
      {
        MYDEBUG(( L"GetTimeFormat failed, ec = %d\n", GetLastError() ));
        return FALSE;
      }

      wsprintf( szDateTime, TEXT("%-8s %-8s"), lpDate, lpTime);

      wsprintf(Buffer, L"%s :Received %s\r\n",ValidString(szDateTime),ValidString(TiffFileName));

      SetFilePointer(hFile,0,0,FILE_END);

      if (!WriteFile(hFile,Buffer,lstrlen(Buffer)*sizeof(WCHAR),&dwWrote,NULL))
      {
        MYDEBUG (( L"WriteFile() failed, ec = %d\n", GetLastError() ));
        CloseHandle(hFile);
        return FALSE;
      }

      CloseHandle(hFile);
       return TRUE;
    }

void DebugPrint | ( | LPWSTR | ,
 |  |  | ...
 | ) |  |
void DebugPrint | ( | LPTSTR | Format,
 |  |  | ...
 | ) |  |

Definition at line 916 of file FaxSiren.Cpp.

                       :

        Prints a debug string

    Arguments:

        format      - wsprintf() format string
        ...         - Variable data

    Return Value:

        None.

    --*/

    {
      TCHAR Buffer[1024];
      TCHAR AppName[MAX_PATH];
      TCHAR ShortName[MAX_PATH];
      SYSTEMTIME CurrentTime;
      int len=0;

      va_list marker;

      ZeroMemory(AppName,MAX_PATH);
      ZeroMemory(ShortName,MAX_PATH);

      if (  GetModuleFileName(
        NULL, // handle to module to find filename for
        AppName,
        MAX_PATH)
        )
      {
        _tsplitpath(AppName,NULL,NULL,ShortName,NULL);
      }

      ZeroMemory(&CurrentTime,sizeof(SYSTEMTIME));

      GetLocalTime(&CurrentTime);

      wsprintf(
        Buffer,
        TEXT ("%02d.%02d.%02d.%03d %s: "),
        CurrentTime.wHour,
        CurrentTime.wMinute,
        CurrentTime.wSecond,
        CurrentTime.wMilliseconds,
        ShortName
        );

      // init arg list
      va_start(marker,Format);

      // point to rest of blank buffer
      len = lstrlen(Buffer);

      _vsntprintf(
        &Buffer[len], // don't want to overwrite the start of the string!
            sizeof(Buffer) - len - 3, //size of the rest of the buffer
            Format,
            marker
        );

      len = lstrlen(Buffer);
      if (Buffer[len-1] == L'\n' )
      {
        Buffer[len-1] = L'\r';
        Buffer[len] = L'\n';
        Buffer[len+1] = 0;
      }
      else
      {
        Buffer[len] = L'\r';
        Buffer[len+1] = L'\n';
        Buffer[len+2] = 0;
      }
      OutputDebugString(Buffer);
      va_end(marker);
    }

DWORD DllEntry | ( | HINSTANCE | hInstance,
 |  | DWORD | Reason,
 |  | LPVOID | Context
 | ) |  |

Definition at line 103 of file FaxSiren.Cpp.

                       :

        dll entrypoint

    Arguments:

        hInstance   - Module handle
        Reason      - Reason for being called
        Context     - Register context

    Return Value:

        TRUE for success, otherwise FALSE.

    --*/

    {
        switch (Reason) {
        case DLL_PROCESS_ATTACH:
          MyhInstance = hInstance;
          DisableThreadLibraryCalls(hInstance);
          break;
        case DLL_PROCESS_DETACH:

           //
           // cleanup
           //
           if (hReceiveEvent) CloseHandle(hReceiveEvent);
           break;
        }

        return TRUE;
    }

STDAPI DllRegisterServer ( VOID )

Definition at line 147 of file FaxSiren.Cpp.

                       :

      Function for the in-process server to create its registry entries

    Return Value:

      S_OK on success

    Notes:
      We leverage the DllRegisterServer entrypoint as an easy way to configure
      our routing extension for use on the system.  Note that the extension doesn't
      have any COM code in it per se, but this makes installation much simpler since
      the setup code doesn't have to use custom code to setup the routing extension.

    --*/
    {
      HRESULT RetCode;
      HMODULE hWinFax;
      PFAXREGISTERROUTINGEXTENSION pFaxRegisterRoutingExtension;
      PFAXCONNECTFAXSERVER pFaxConnectFaxServer;
      PFAXCLOSE pFaxClose;
      HANDLE hFax;
      DWORD ExtensionCount = 0;
        TCHAR lpszWinFaxDllLocation[MAX_PATH+13]={0};
      //
      // we assume that the routing extension has already been installed into the
      // proper location by the setup code.
      //
      //we assume that winfax.dll is located in SystemDirectory path

      if (GetSystemDirectory(lpszWinFaxDllLocation, MAX_PATH+1) == 0)
      {
        MYDEBUG(( L"GetSystemDirectory failed, ec = %d\n", GetLastError() ));
        RetCode = E_UNEXPECTED;
        goto e0;
      }

      _tcscat(lpszWinFaxDllLocation,_T("\\winfax.dll") );
    if (_tcslen(lpszWinFaxDllLocation) >= MAX_PATH)
    {
        MYDEBUG(( L"Library path too long\n", 0 ));
        RetCode = E_UNEXPECTED;
        goto e0;
      }

      hWinFax = LoadLibrary(lpszWinFaxDllLocation);
      if (!hWinFax)
      {
        MYDEBUG(( L"LoadLibrary failed, ec = %d\n", GetLastError() ));
        RetCode = E_UNEXPECTED;
        goto e0;
      }

      pFaxRegisterRoutingExtension = (PFAXREGISTERROUTINGEXTENSION) GetProcAddress(hWinFax, "FaxRegisterRoutingExtensionW" );
      pFaxConnectFaxServer = (PFAXCONNECTFAXSERVER) GetProcAddress(hWinFax, "FaxConnectFaxServerW");
      pFaxClose = (PFAXCLOSE) GetProcAddress(hWinFax, "FaxClose" );

      if (!pFaxRegisterRoutingExtension || !pFaxConnectFaxServer || !pFaxClose)
      {
        MYDEBUG(( L"GetProcAddress failed, ec = %d\n", GetLastError() ));
        RetCode = E_UNEXPECTED;
        goto e1;
      }

      if (!pFaxConnectFaxServer( NULL, &hFax ))
      {
        MYDEBUG(( L"FaxConnectFaxServer failed, ec = %d\n", GetLastError() ));
        RetCode = HRESULT_FROM_WIN32( GetLastError() );
        goto e1;
      }

      if (!pFaxRegisterRoutingExtension(
        hFax,
            EXTENSIONNAME,
            EXTENSIONFRIENDLYNAME,
            EXTENSIONPATH,
            ExtensionCallback,
            (LPVOID) &ExtensionCount
            ))
      {
        MYDEBUG(( L"FaxRegisterRoutingExtension failed, ec = %d\n", GetLastError() ));
        RetCode = HRESULT_FROM_WIN32( GetLastError() );
        goto e2;
      }
      RetCode = S_OK;

    e2:
      pFaxClose( hFax );
    e1:
      FreeLibrary( hWinFax );
    e0:
      return RetCode;
    }

BOOL WINAPI ExtensionCallback | ( | IN HANDLE | FaxHandle,
 |  | IN LPVOID | Context,
 |  | IN OUT LPWSTR | MethodName,
 |  | IN OUT LPWSTR | FriendlyName,
 |  | IN OUT LPWSTR | FunctionName,
 |  | IN OUT LPWSTR | Guid
 | ) |  |

Definition at line 248 of file FaxSiren.Cpp.

                       :

      Callback function for adding our routing extensions

    Return Value:

      TRUE if we added another extension, FALSE if we're done adding extensions

    --*/
    {
      PDWORD ExtensionCount = (PDWORD) Context;

      //
      // since we only have one extension, this is a really simple function
      // --we don't really need the context data above, it's just here to
      //   illustrate what you might use the context data for.
      //

        if (ExtensionCount)
      {
        MYDEBUG(( L"ExtensionCallback called for extension %d\n", *ExtensionCount ));
        }
      else
      {
        MYDEBUG(( L"context data is NULL, can't continue\n", *ExtensionCount ));
            return FALSE;
        }

        if (*ExtensionCount != 0)
      {
            //
            // we've added all of our methods, return FALSE to signify that we're done
            //
            return FALSE;
        }

      wcscpy(MethodName,   FAXSIRENMETHOD );
      wcscpy(FriendlyName, FAXSIRENFRIENDLYNAME );
      wcscpy(FunctionName, FAXSIRENFUNCTION );
      wcscpy(Guid,         ROUTEITGUID );

        *ExtensionCount += 1;
        return TRUE;
    }

BOOL WINAPI FaxRouteDeviceChangeNotification | ( | IN DWORD | DeviceId,
 |  | IN BOOL | NewDevice
 | ) |  |

Definition at line 580 of file FaxSiren.Cpp.

                       :

        This functions is called by the fax service to alert the routing extension that a device
        has changed

    Arguments:

        DeviceId            - Device that has changed
        NewDevice           - TRUE means device was added, FALSE means a device was removed

    Return Value:

        TRUE for success

    --*/
    {
      //
      // We don't have any per device routing data, so this is just stubbed out
      //
      return TRUE;
    }

BOOL WINAPI FaxRouteDeviceEnable | ( | IN LPWSTR | RoutingGuid,
 |  | IN DWORD | DeviceId,
 |  | IN LONG | Enabled
 | ) |  |

Definition at line 509 of file FaxSiren.Cpp.

                       :

        This functions is called by the fax service to determine if a routing extension is enabled or
        to enable a routing extension

    Arguments:

        RoutingGuid         - Unique identifier for the requested routing method
        DeviceId            - Device that is being configured
        Enabled             - meaning differs based on context (see FAXROUTE_ENABLE enumerated type)

    Return Value:

        depends on context.

    --*/
    {
        //
        // -note that we make the assumption that there are never more than 4 devices in this sample
        // -also note that this isn't thread safe
        // -a real routing extension wouldn't make these assumptions, and would probably have some
        //  persistent store which kept track of the enabled state of an extension per-routing method
        //
      static long MyEnabled[4] = {STATUS_ENABLE,STATUS_ENABLE,STATUS_ENABLE,STATUS_ENABLE};
        static DWORD DeviceIdIndex[4] = {0,0,0,0};
        DWORD count;

        //
        // make sure that we're dealing with our routing method
        //
        if (wcsicmp(RoutingGuid,ROUTEITGUID) != 0)
      {
        MYDEBUG (( L"Passed a GUID (%s) for a method not in this extension!\n", RoutingGuid ));
            return FALSE;
        }

        for (count = 0 ; count <4; count ++)
      {
        if (DeviceIdIndex[count] == DeviceId)
        {
          break;
            }
        else if (DeviceIdIndex[count] == 0)
        {
          DeviceIdIndex[count] = DeviceId;
            }
        }

        if (Enabled == QUERY_STATUS)
      {
        return MyEnabled[count];
        }

        MYDEBUG ((
        L"Setting enabled state to %s\n",
            (Enabled == STATUS_DISABLE) ? L"STATUS_DISABLE" : L"STATUS_ENABLE"
            ));

      MyEnabled[count] = Enabled;
        return TRUE;
    }

BOOL WINAPI FaxRouteGetRoutingInfo | ( | IN LPWSTR | RoutingGuid,
 |  | IN DWORD | DeviceId,
 |  | IN LPBYTE | RoutingInfo,
 |  | OUT LPDWORD | RoutingInfoSize
 | ) |  |

Definition at line 432 of file FaxSiren.Cpp.

                       :

        This functions is called by the fax service to
        get routing configuration data.

    Arguments:

        RoutingGuid         - Unique identifier for the requested routing method
        DeviceId            - Device that is being configured
        RoutingInfo         - Routing info buffer
        RoutingInfoSize     - Size of the buffer (in bytes)

    Return Value:

        TRUE for success, otherwise FALSE.

    --*/

    {
        //
        // the sample doesn't have any per device routing data, so this function is
        // just stubbed out -- if you have per device routing data, it would be
        // retrieved here.
        //
      if (RoutingInfoSize)
      {
        *RoutingInfoSize = 0;
        }
        return TRUE;
    }

BOOL WINAPI FaxRouteInitialize | ( | IN HANDLE | HeapHandle,
 |  | IN PFAX_ROUTE_CALLBACKROUTINES | FaxRouteCallbackRoutines
 | ) |  |

Definition at line 310 of file FaxSiren.Cpp.

                       :

        This functions is called by the fax service to initialize the routing extension.  This function
        should only be called once per instantiation of the fax service

    Arguments:

        HeapHandle               - Heap handle for memory all allocations
        FaxRouteCallbackRoutines - structure containing callback functions

    Return Value:

        TRUE for success, otherwise FALSE.

    --*/

    {
      DWORD dwNeeded;
        SECURITY_ATTRIBUTES sa;

        //
        // make sure we can understand the structure
        //
        if ( FaxRouteCallbackRoutines->SizeOfStruct < sizeof(FAX_ROUTE_CALLBACKROUTINES) )
      {
        MYDEBUG (
          (L"The passed in SizeOfStruct (%d) is smaller than expected (%d) ",
          FaxRouteCallbackRoutines->SizeOfStruct,
            sizeof(FAX_ROUTE_CALLBACKROUTINES))
            );
        return FALSE;
      }

        hHeap = HeapHandle;
        FaxRouteAddFile = FaxRouteCallbackRoutines->FaxRouteAddFile;
        FaxRouteDeleteFile = FaxRouteCallbackRoutines->FaxRouteDeleteFile;
        FaxRouteGetFile = FaxRouteCallbackRoutines->FaxRouteGetFile;
        FaxRouteEnumFiles = FaxRouteCallbackRoutines->FaxRouteEnumFiles;
        FaxRouteModifyRoutingData = FaxRouteCallbackRoutines->FaxRouteModifyRoutingData;

        InitializeCriticalSection( &csRoute );

        //
        // create a named event
        //
        // note that we need to create a security descriptor with a DACL (everyone read, administrators full control) because we want the named
        // event to be opened by programs that might not be running in same context as the fax service
        //

        sa.nLength = sizeof(SECURITY_ATTRIBUTES);
        sa.bInheritHandle = FALSE;
      //owner is builtin administrators
      //everyone read ace
      //built-in administrators full control
        LPCWSTR pwszSD=L"O:BAG:BAD:(A;;GR;;;WD) (A;;GA;;;BA)";

        if (ConvertStringSecurityDescriptorToSecurityDescriptor(
                                pwszSD,
                                SDDL_REVISION_1,
                                &(sa.lpSecurityDescriptor),
                                NULL))
        {
        MYDEBUG(( L"ConvertStringSecurityDescriptorToSecurityDescriptor failed, ec = %d\n", GetLastError() ));
            return FALSE;
        }

        hReceiveEvent = CreateEvent(&sa,FALSE,FALSE,FAXSIREN);

      if (!hReceiveEvent)
      {
        if (GetLastError() != ERROR_ALREADY_EXISTS)
        {
          MYDEBUG (( L"CreateEvent failed, ec = %d\n", GetLastError() ));
          return FALSE;
        }
      }
        LocalFree(sa.lpSecurityDescriptor);

        //
        // get path to files for logging, etc.
        //
        dwNeeded = ExpandEnvironmentStrings(ININAME,IniFile,0);
        IniFile  = (LPWSTR) HeapAlloc(hHeap,HEAP_ZERO_MEMORY,(dwNeeded)*sizeof(WCHAR));
        if (!IniFile)
      {
        MYDEBUG((L"HeapAlloc failed, ec = %d\n", GetLastError() ));
        return FALSE;
        }
        DWORD dwSuccess = ExpandEnvironmentStrings(ININAME,IniFile,dwNeeded);

        if (dwSuccess == 0)
      {
        return FALSE;
        }

        dwNeeded = ExpandEnvironmentStrings(LOGNAME,LogFile,0);
        LogFile  = (LPWSTR) HeapAlloc(hHeap,HEAP_ZERO_MEMORY,sizeof(WCHAR)*(dwNeeded));
        if (!LogFile)
      {
        MYDEBUG(( L"HeapAlloc failed, ec = %d\n", GetLastError() ));
        return FALSE;
        }
        dwSuccess = ExpandEnvironmentStrings(LOGNAME,LogFile,dwNeeded);

        if (dwSuccess == 0)
      {
        return FALSE;
        }

      MYDEBUG (( L"Logfile : %s\n", LogFile ));
        MYDEBUG (( L"Inifile : %s\n", IniFile ));
        return TRUE;
    }

BOOL WINAPI FaxRouteSetRoutingInfo | ( | IN LPWSTR | RoutingGuid,
 |  | IN DWORD | DeviceId,
 |  | IN LPBYTE | RoutingInfo,
 |  | IN DWORD | RoutingInfoSize
 | ) |  |

Definition at line 474 of file FaxSiren.Cpp.

                       :

        This functions is called by the fax service to
        set routing configuration data.

    Arguments:

        RoutingGuid         - Unique identifier for the requested routing method
        DeviceId            - Device that is being configured
        RoutingInfo         - Routing info buffer
        RoutingInfoSize     - Size of the buffer (in bytes)

    Return Value:

        TRUE for success, otherwise FALSE.

    --*/
    {
        //
        // the sample doesn't have any per device routing data, so this function is
        // just stubbed out -- if you have per device routing data, it would be
        // commited to storage here.
        //
      return TRUE;
    }

BOOL WINAPI RouteIt | ( | PFAX_ROUTE | FaxRoute,
 |  | PVOID * | FailureData,
 |  | LPDWORD | FailureDataSize
 | ) |  |

Definition at line 616 of file FaxSiren.Cpp.

                       :

        This functions is called by the fax service to
        route a received fax.

    Arguments:

        FaxRoute            - Routing information
        FailureData         - Failure data buffer
        FailureDataSize     - Size of failure data buffer

    Return Value:

        TRUE for success, otherwise FALSE.

    --*/

    {
      WCHAR TiffFileName[MAX_PATH];
        WCHAR Dir[_MAX_DIR],Drive[_MAX_DRIVE],File[_MAX_FNAME],Ext[_MAX_EXT];
        WCHAR CopyOfTiff[MAX_PATH+1];

        DWORD Size = sizeof(TiffFileName);

        //
        // serialize access to this function so that data is written into the logfile accurately
        //
        EnterCriticalSection( &csRoute );

      if (!FaxRouteGetFile(
        FaxRoute->JobId,
            1,
            TiffFileName,
            &Size))
      {
        MYDEBUG(( L"Couldn't FaxRouteGetFile, ec = %d", GetLastError() ));
        LeaveCriticalSection( &csRoute );
        return FALSE;
        }

        MYDEBUG ((
        L"Received fax %s\n\tCSID :%s\n\t Name : %s\n\t #: %s\n\tDevice: %s\n",
            TiffFileName,
            ValidString ( FaxRoute->Csid ),
            ValidString ( FaxRoute->ReceiverName),
            ValidString ( FaxRoute->ReceiverNumber),
            ValidString ( FaxRoute->DeviceName )
        ));

      _wsplitpath(TiffFileName, Drive, Dir, File, Ext );
    if ((wcslen(Drive) + wcslen(SIRENDIR) + wcslen(File) + wcslen(Ext)) >= MAX_PATH) {
        LeaveCriticalSection( &csRoute );
        return FALSE;
        }

        wsprintf(CopyOfTiff,L"%s\\%s\\%s%s",Drive,SIRENDIR,File,Ext);

        //
        // copy the tiff so it persists after this routine exits
        //
        CopyFile(TiffFileName,CopyOfTiff,FALSE);

        //
        // write some logging data
        //
        WriteRoutingInfoIntoIniFile(CopyOfTiff,FaxRoute);
        AppendFileNametoLogFile(TiffFileName, FaxRoute);

        //
        // signal event -- another application could use this named event to do something
        // with the file that was just copied into this directory
        // (note that the INI file isn't thread-safe accross applications, we could have the routing data overwritten by
        //  another fax being received)
        //
        SetEvent(hReceiveEvent);

        //
        // service needs to be able to interact with the current desktop for this to work
        //
        MessageBeep(MB_ICONEXCLAMATION);

        LeaveCriticalSection( &csRoute );
        return TRUE;
    }

BOOL WriteRoutingInfoIntoIniFile | ( | LPWSTR | TiffFileName,
 |  | PFAX_ROUTE | FaxRoute
 | ) |  |

Definition at line 714 of file FaxSiren.Cpp.

    {
      WCHAR Buffer[MAX_PATH*2];
        ULONG ulBufferSize = sizeof(Buffer);
    ULONG ulArraySize = ulBufferSize/sizeof(Buffer[0]);
      //
      // write each routing info member into ini file
      //

      //filename
      ZeroMemory(Buffer,ulBufferSize);
    wcsncpy(Buffer,ValidString (TiffFileName), ulArraySize - 1);
      WritePrivateProfileString(
        L"RoutingInfo",// pointer to section name
        L"FileName",// pointer to key name
        Buffer,   // pointer to string to add
        IniFile // pointer to initialization filename
        );

      //jobid
    ZeroMemory(Buffer,ulBufferSize);
      wsprintf(Buffer, L"%u",FaxRoute->JobId);
      WritePrivateProfileString(
        L"RoutingInfo",// pointer to section name
        L"JobId",// pointer to key name
        Buffer,   // pointer to string to add
        IniFile // pointer to initialization filename
        );

      //elapsedtime
    ZeroMemory(Buffer,ulBufferSize);
      wsprintf(Buffer, L"%u",FaxRoute->ElapsedTime);
      WritePrivateProfileString(
        L"RoutingInfo",// pointer to section name
        L"ElapsedTime",// pointer to key name
        Buffer,   // pointer to string to add
        IniFile // pointer to initialization filename
        );

      //receivetime
    ZeroMemory(Buffer,ulBufferSize);
      wsprintf(Buffer, L"%u",FaxRoute->ReceiveTime);
      WritePrivateProfileString(
        L"RoutingInfo",// pointer to section name
        L"ReceiveTime",// pointer to key name
        Buffer,   // pointer to string to add
        IniFile // pointer to initialization filename
        );

      //pagecount
    ZeroMemory(Buffer,ulBufferSize);
      wsprintf(Buffer, L"%u",FaxRoute->PageCount);
      WritePrivateProfileString(
        L"RoutingInfo",// pointer to section name
        L"PageCount",// pointer to key name
        Buffer,   // pointer to string to add
        IniFile // pointer to initialization filename
        );

      //Csid
    ZeroMemory(Buffer,ulBufferSize);
    wcsncpy(Buffer,ValidString (FaxRoute->Csid), ulArraySize - 1);
      WritePrivateProfileString(
        L"RoutingInfo",// pointer to section name
        L"Csid",// pointer to key name
        Buffer,   // pointer to string to add
        IniFile // pointer to initialization filename
        );

      //CallerId
    ZeroMemory(Buffer,ulBufferSize);
    wcsncpy(Buffer, ValidString (FaxRoute->CallerId ), ulArraySize - 1);
      WritePrivateProfileString(
        L"RoutingInfo",// pointer to section name
        L"CallerId",// pointer to key name
        Buffer,   // pointer to string to add
        IniFile // pointer to initialization filename
        );

      //RoutingInfo
    ZeroMemory(Buffer,ulBufferSize);
    wcsncpy(Buffer, ValidString (FaxRoute->RoutingInfo ), ulArraySize - 1);
      WritePrivateProfileString(
        L"RoutingInfo",// pointer to section name
        L"RoutingInfo",// pointer to key name
        Buffer,   // pointer to string to add
        IniFile // pointer to initialization filename
        );

      //ReceiverName
    ZeroMemory(Buffer,ulBufferSize);
    wcsncpy(Buffer, ValidString (FaxRoute->ReceiverName ), ulArraySize - 1);
      WritePrivateProfileString(
        L"RoutingInfo",// pointer to section name
        L"ReceiverName",// pointer to key name
        Buffer,   // pointer to string to add
        IniFile // pointer to initialization filename
        );

      //ReceiverNumber
    ZeroMemory(Buffer,ulBufferSize);
    wcsncpy(Buffer, ValidString (FaxRoute->ReceiverNumber ), ulArraySize - 1);
      WritePrivateProfileString(
        L"RoutingInfo",// pointer to section name
        L"ReceiverNumber",// pointer to key name
        Buffer,   // pointer to string to add
        IniFile // pointer to initialization filename
        );

      //DeviceName
    ZeroMemory(Buffer,ulBufferSize);
    wcsncpy(Buffer, ValidString (FaxRoute->DeviceName ), ulArraySize - 1);
      WritePrivateProfileString(
        L"RoutingInfo",// pointer to section name
        L"DeviceName",// pointer to key name
        Buffer,   // pointer to string to add
        IniFile // pointer to initialization filename
        );

      //DeviceId
    ZeroMemory(Buffer,ulBufferSize);
      wsprintf(Buffer, L"%u",FaxRoute->DeviceId );
      WritePrivateProfileString(
        L"RoutingInfo",// pointer to section name
        L"DeviceId",// pointer to key name
        Buffer,   // pointer to string to add
        IniFile // pointer to initialization filename
        );

      return TRUE;
    }

Variable Documentation

CRITICAL_SECTION csRoute

Definition at line 96 of file FaxSiren.Cpp.

PFAXROUTEADDFILE FaxRouteAddFile

Definition at line 88 of file FaxSiren.Cpp.

PFAXROUTEDELETEFILE FaxRouteDeleteFile

Definition at line 89 of file FaxSiren.Cpp.

PFAXROUTEENUMFILES FaxRouteEnumFiles

Definition at line 91 of file FaxSiren.Cpp.

PFAXROUTEGETFILE FaxRouteGetFile

Definition at line 90 of file FaxSiren.Cpp.

PFAXROUTEMODIFYROUTINGDATA FaxRouteModifyRoutingData

Definition at line 92 of file FaxSiren.Cpp.

HANDLE hHeap

Definition at line 94 of file FaxSiren.Cpp.

HANDLE hReceiveEvent

Definition at line 95 of file FaxSiren.Cpp.

LPWSTR IniFile = NULL

Definition at line 97 of file FaxSiren.Cpp.

LPWSTR LogFile = NULL

Definition at line 98 of file FaxSiren.Cpp.

HINSTANCE MyhInstance

Definition at line 99 of file FaxSiren.Cpp.

Generated on Wed Nov 13 2024 16:53:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/fax/SampleRoute/Resource.h File Reference

  • NetDS
  • fax
  • SampleRoute

Resource.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/fax/SampleSend/Resource.h File Reference

  • NetDS
  • fax
  • SampleSend

Resource.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/fax/SampleSend/Simple.c File Reference

  • NetDS
  • fax
  • SampleSend
Defines | Functions

Simple.c File Reference

#include <windows.h>
#include <winbase.h>
#include <stdio.h>
#include <stdlib.h>
#include <winfax.h>
#include <tchar.h>
#include <assert.h>
#include <shellapi.h>

Go to the source code of this file.

Defines

#define | ARR_SIZE(a) (sizeof(a)/sizeof(a[0]))
#define | DEBUG_SIMPLE(parm1, parm2)

Functions

void | GiveUsage (LPTSTR AppName)
int | main (int argc, char *argvA[])
void | PrintDeviceStatus (PFAX_DEVICE_STATUS fds)

Define Documentation

#define ARR_SIZE ( a ) (sizeof(a)/sizeof(a[0]))

Definition at line 36 of file Simple.c.

#define DEBUG_SIMPLE | ( | parm1,
 |  | parm2
 | ) |

Definition at line 33 of file Simple.c.

Function Documentation

void GiveUsage ( LPTSTR AppName )

Definition at line 38 of file Simple.c.

    {
        _tprintf( TEXT("Usage : %s /d <full path to doc> /n <number>\n --send a fax\n"),AppName);
        _tprintf( TEXT("Usage : %s /? -- this message\n"),AppName);

    }

int main | ( | int | argc,
 |  | char * | argvA[]
 | ) |  |

Definition at line 97 of file Simple.c.

                       :

        Entry point to the setup program

    Arguments:

        argc - Number of args.
        argvA - the commandline arguments.

    Return Value:

    --*/
    {
        LPTSTR *argv;
        int argcount = 0;
        TCHAR Document[MAX_PATH] = {0};
        TCHAR Number[64] = {0};

        HANDLE hFax;
        HANDLE hCompletionPort = INVALID_HANDLE_VALUE;
        HANDLE hFile;
        PFAX_JOB_PARAM JobParam;
        PFAX_COVERPAGE_INFO CoverpageInfo;
        DWORD JobId;
        DWORD dwBytes, CompletionKey;
        PFAX_EVENT FaxEvent;
        BOOL bTerminate = FALSE;
        HANDLE hPort;
        PFAX_DEVICE_STATUS DeviceStatus;

        //
        // do commandline stuff
        //
    #ifdef UNICODE
        argv = CommandLineToArgvW( GetCommandLine(), &argc );
    #else
        argv = argvA;
    #endif

        DEBUG_SIMPLE ("Number of arguments = %d\n",argc);
        for (argcount=0;argcount<argc;argcount++)
        {
            DEBUG_SIMPLE ("Arg %d:",argcount);
            DEBUG_SIMPLE (" %s\n",argv[argcount]);
        }

        // check for commandline switches
        for (argcount=0; argcount<argc; argcount++)
        {
            if ((argv[argcount][0] == L'/') || (argv[argcount][0] == L'-'))
            {
                switch (towlower(argv[argcount][1]))
                {
                case 'n':
                   lstrcpyn(Number, argv[argcount+1],ARR_SIZE(Number));
                   break;
                case 'd':
                   lstrcpyn(Document, argv[argcount+1],ARR_SIZE(Document));
                   //check to see if the file exists and if it is a disk file
                   hFile = CreateFile(Document,
                                      GENERIC_READ,
                                      FILE_SHARE_READ,
                                      NULL,
                                      OPEN_EXISTING,
                                      FILE_ATTRIBUTE_NORMAL,
                                      NULL);
                   if ((hFile == INVALID_HANDLE_VALUE)||(GetFileType(hFile) != FILE_TYPE_DISK))
                   {
                        _tprintf( TEXT("Error with file : %s \n"),Document);
                        GiveUsage(argv[0]);
                        return -1;
                   }
                   CloseHandle(hFile);
                   break;
                case '?':
                   GiveUsage(argv[0]);
                   return 0;
                default:
                   break;
                }
            }
        }

        if (!Number[0] || !Document[0])
        {
            _tprintf( TEXT("Missing args.\n") );
            GiveUsage(argv[0]);
            return -1;
        }

        //
        // connect to fax service
        //
        if (!FaxConnectFaxServer(NULL,&hFax))
        {
            _tprintf( TEXT("FaxConnectFaxServer failed, ec = %d\n"),GetLastError() );
            return -1;
        }

        assert (hFax != NULL);

        hCompletionPort = CreateIoCompletionPort(INVALID_HANDLE_VALUE,NULL,0,0);

        if (!hCompletionPort)
        {
            _tprintf( TEXT("CreateIoCompletionPort failed, ec = %d\n"), GetLastError() );
            FaxClose( hFax );
            return -1;
        }

        if (!FaxInitializeEventQueue(
            hFax,
            hCompletionPort,
            0,
            NULL,
            0
            ))
        {
            _tprintf( TEXT("FaxInitializeEventQueue failed, ec = %d\n"), GetLastError() );
            FaxClose( hFax );
            return -1;
        }

        FaxCompleteJobParams(&JobParam,&CoverpageInfo);
        JobParam->RecipientNumber = Number;
        if (!FaxSendDocument( hFax, Document, JobParam, NULL , &JobId) )
        {
            _tprintf( TEXT("FaxSendDocument failed, ec = %d \n"), GetLastError() );
            FaxClose( hFax );
            CloseHandle( hCompletionPort );
            FaxFreeBuffer(JobParam);
            FaxFreeBuffer(CoverpageInfo);
            return -1;
        }

        _tprintf(
            TEXT("Queued document %s for transmition to %s, JobID = %d\n"),
            Document,
            Number,
            JobId
            );

        FaxFreeBuffer( JobParam );
        FaxFreeBuffer( CoverpageInfo );

        while (
            !bTerminate &&
            GetQueuedCompletionStatus(
                hCompletionPort,
                &dwBytes,
                &CompletionKey,
                (LPOVERLAPPED *)&FaxEvent,
                INFINITE
                )
            )
       {

            _tprintf( TEXT("Received event 0x%x\n"),FaxEvent->EventId);

            switch (FaxEvent->EventId) {
                case FEI_IDLE:
                case FEI_COMPLETED:
                case FEI_MODEM_POWERED_ON:
                case FEI_MODEM_POWERED_OFF:
                case FEI_FAXSVC_ENDED:
                    bTerminate = TRUE;
                    break;

                case FEI_JOB_QUEUED:
                    _tprintf( TEXT("JobId 0x%x queued\n"),FaxEvent->JobId );
                    break;

                case FEI_DIALING:
                case FEI_SENDING:
                case FEI_RECEIVING:
                case FEI_BUSY:
                case FEI_NO_ANSWER:
                case FEI_BAD_ADDRESS:
                case FEI_NO_DIAL_TONE:
                case FEI_DISCONNECTED:
                case FEI_FATAL_ERROR:
                if (FaxOpenPort( hFax, FaxEvent->DeviceId,PORT_OPEN_QUERY, &hPort) )
                {
                    if (FaxGetDeviceStatus(hPort,&DeviceStatus) )
                    {
                        PrintDeviceStatus(DeviceStatus);
                        FaxFreeBuffer( DeviceStatus );
                    }
                    FaxClose( hPort );
                }
                break;
            }
        }

        FaxClose( hFax );
        CloseHandle( hCompletionPort );
        return 1;
    }

void PrintDeviceStatus ( PFAX_DEVICE_STATUS fds )

Definition at line 45 of file Simple.c.

    {
        TCHAR SubmitBuffer[100];
        TCHAR StartBuffer[100];
        SYSTEMTIME SystemTime;

        if (!fds)
        {
            return;
        }

        _tprintf(TEXT("Device Id:\t\t%d\n"),fds->DeviceId );
        _tprintf(TEXT("Device Name:\t\t%s\n"),fds->DeviceName );
        _tprintf(TEXT("CallerId:\t\t%s\n"),fds->CallerId );
        _tprintf(TEXT("CSID:\t\t\t%s\n"),fds->Csid );
        _tprintf(TEXT("TSID:\t\t\t%s\n"),fds->Tsid );
        _tprintf(TEXT("Page:\t\t\t%d of %d\n"),fds->CurrentPage,fds->TotalPages );
        _tprintf(TEXT("DocumentName:\t\t%s\n"),fds->DocumentName);
        _tprintf(TEXT("JobType:\t\t%d\n"),fds->JobType);
        _tprintf(TEXT("PhoneNumber:\t\t%s\n"),fds->PhoneNumber);
        _tprintf(TEXT("SenderName:\t\t%s\n"),fds->SenderName);
        _tprintf(TEXT("RecipientName:\t\t%s\n"),fds->RecipientName);
        _tprintf(TEXT("Size (in bytes):\t%d\n"),fds->Size);
        _tprintf(TEXT("Status (see FPS flags):\t0x%x\n"),fds->Status);

        FileTimeToSystemTime(&fds->StartTime,&SystemTime);

        GetTimeFormat(
            LOCALE_SYSTEM_DEFAULT,
            LOCALE_NOUSEROVERRIDE,
            &SystemTime,
            NULL,
            StartBuffer,
            ARR_SIZE(StartBuffer)
            );

        FileTimeToSystemTime(&fds->SubmittedTime,&SystemTime);
        SystemTimeToTzSpecificLocalTime(NULL,&SystemTime,&SystemTime);

        GetTimeFormat(
            LOCALE_SYSTEM_DEFAULT,
            LOCALE_NOUSEROVERRIDE,
            &SystemTime,
            NULL,
            SubmitBuffer,
            ARR_SIZE(SubmitBuffer)
            );

        _tprintf(TEXT("Job Submited at %s\n"),SubmitBuffer);
        _tprintf(TEXT("Job transmission started at %s\n\n"),StartBuffer);
    }

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/GQos/QosEvent/ChkQos.Cpp File Reference

  • NetDS
  • GQos
  • QosEvent
Functions

ChkQos.Cpp File Reference

#include "qosevent.h"

Go to the source code of this file.

Functions

BOOL ChkQosSend (SOCKET sd)

Function Documentation

BOOL ChkQosSend ( SOCKET sd )

Definition at line 36 of file ChkQos.Cpp.

{
    int     nRet;
    DWORD   dwBytes;
    DWORD   inbuf = ALLOWED_TO_SEND_DATA;
    DWORD   outbuf;
    OSVERSIONINFO   verInfo = {0};

    // first check for windows 98, and silently fail if it is.
    verInfo.dwOSVersionInfoSize = sizeof(verInfo);
  GetVersionEx(&verInfo);
  if (VER_PLATFORM_WIN32_NT != verInfo.dwPlatformId)
      return(TRUE);

    nRet = WSAIoctl(sd, SIO_CHK_QOS,
                        (LPVOID)&inbuf, sizeof(inbuf),
                        (LPVOID)&outbuf, sizeof(outbuf),
                        &dwBytes, NULL, NULL);

    if (SOCKET_ERROR == nRet)
    {
        printf("WSAIoctl:SIO_CHK_QOS %d\n", WSAGetLastError());
        return(FALSE);
    }

    return((BOOL)outbuf);
}

Generated on Wed Nov 13 2024 16:53:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/GQos/QosEvent/Findsp.Cpp File Reference

  • NetDS
  • GQos
  • QosEvent
Functions

Findsp.Cpp File Reference

#include "qosevent.h"

Go to the source code of this file.

Functions

BOOL FindServiceProvider (int iProtocol, BOOL bQos, BOOL bMulticast, WSAPROTOCOL_INFO *pProtocolInfo)

Function Documentation

BOOL FindServiceProvider | ( | int | iProtocol,
 |  | BOOL | bQos,
 |  | BOOL | bMulticast,
 |  | WSAPROTOCOL_INFO * | pProtocolInfo
 | ) |  |

Definition at line 35 of file Findsp.Cpp.

{
    int nRet;
    WSAPROTOCOL_INFO *lpProtocolBuf = NULL;
    DWORD dwBufLen = 0;
    DWORD dwErr;
    BOOL bProtocolFound = FALSE;
    BOOL bSPQos = FALSE, bSPMulticast=FALSE;
    BOOL bQosMatch = FALSE, bMulticastMatch = FALSE;

    // first have WSAEnumProtocols tell us how big a buffer is needed
    nRet = WSAEnumProtocols(NULL, NULL, &dwBufLen);
    if (SOCKET_ERROR != nRet)
    {
        printf("WSAEnumProtocols: should not have suceeded\n");
        goto end;
    }

    if (WSAENOBUFS != (dwErr = WSAGetLastError()))
    {
        // WSAEnumProtocols failed for some reason not relating to buffer size
        printf("WSAEnumProtocols(1): %d\n", dwErr);
        goto end;
    }

    // WSAEnumProtocols failed for the "expected" reason, allocate a buffer
    // of the needed size
    lpProtocolBuf = (WSAPROTOCOL_INFO *)malloc(dwBufLen);
    if (!lpProtocolBuf)
    {
        printf("malloc failed in FindServiceProvider\n");
        goto end;
    }

    // now we can call WSAEnumProtocols again with the expectation it will
    // succeed because we have allocated a big enough buffer.
    nRet = WSAEnumProtocols(NULL, lpProtocolBuf, &dwBufLen);
    if (SOCKET_ERROR == nRet)
    {
        printf("WSAEnumProtocols(3): %d\n", WSAGetLastError());
        goto end;
    }

    // loop thru protocols, looking for a matching service provider
    {
    for (int i=0; i<nRet; i++)
    {
        printf("  sp <%s>\n", lpProtocolBuf[i].szProtocol);

        // do we have the correct protocol?
        if (AF_INET != lpProtocolBuf[i].iAddressFamily
                || iProtocol != lpProtocolBuf[i].iProtocol)
            continue; // nope, move on

        // Check for Qos and Multicast
        bSPQos =
            ((XP1_QOS_SUPPORTED & lpProtocolBuf[i].dwServiceFlags1) != 0);
        bSPMulticast =
            ((XP1_SUPPORT_MULTIPOINT & lpProtocolBuf[i].dwServiceFlags1) != 0);

        // Look to see if we got exactly what we wanted
        if ((bQos == bSPQos) && (bMulticast == bSPMulticast))
        {

            memcpy(pProtocolInfo, (void *) &lpProtocolBuf[i],
                    sizeof(WSAPROTOCOL_INFO));
            bProtocolFound = TRUE;
            break;
        }
    } // for
    } // scope resolution for int i on stricter compilers

end:
    if (lpProtocolBuf)
        free(lpProtocolBuf);

    if (bProtocolFound)
        printf("  Using service provider <%s>\n\n", pProtocolInfo->szProtocol);

    return(bProtocolFound);
}

Generated on Wed Nov 13 2024 16:53:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/GQos/QosEvent/GetQos.Cpp File Reference

  • NetDS
  • GQos
  • QosEvent
Functions

GetQos.Cpp File Reference

#include "qosevent.h"

Go to the source code of this file.

Functions

BOOL GetQos (SOCKET sd, BOOL bQueryBufferSize, QOS **pQos)

Function Documentation

BOOL GetQos | ( | SOCKET | sd,
 |  | BOOL | bQueryBufferSize,
 |  | QOS ** | pQos
 | ) |  |

Definition at line 34 of file GetQos.Cpp.

{
    DWORD   dwBytesReturned=0;
    DWORD   status;
    DWORD   dwBufferLen;
    CHAR    *pBuf;
    QOS     *pTempQos;

    // Figure out what size buffer we need.
    if (!bQueryBufferSize)
        dwBufferLen = 2048; //win98 platform
    else
    {
        // Try to get it dynamically.
        dwBufferLen = 0;
        status = WSAIoctl(sd, SIO_GET_QOS, NULL, 0,
                      &dwBufferLen, sizeof(dwBufferLen),
                      &dwBytesReturned, NULL, NULL);

        // we have an error, anything except
        if (SOCKET_ERROR == status)
        {
            DWORD dwErr = WSAGetLastError();

            if (WSAEWOULDBLOCK == dwErr)
                return(FALSE);  // nothing to do

            if (WSAENOBUFS != dwErr)
            {
                // some sort of error not related to passing a large enough buffer
                printf("GetQos: WSAIoctl(SIO_GET_QOS) - query: %d\n", dwErr);
                return(FALSE);
            }
        }
    }

    // for Windows 98 dwBufferLen has been set statically, for Windows 2000 we queried the OS
    // for the proper buffer size
    printf("GetQos: dwBufferlen for pQos = %d\n", dwBufferLen);
    pBuf = (CHAR *)malloc(dwBufferLen);
    if (!pBuf)
    {
        printf("GetQos: malloc: %d\n", GetLastError());
        return(FALSE);
    }

    // Windows 98 workaround - not needed for Win2000, but doesn't hurt.  Windows 98
    // needs the provider specific buffer to point to valid memory, whereas Windows 2000
    // simply needs a contiguous block of memory.  Therefore we allocate a contiguous
    // block of memory cast it to a QOS structure and then set the provider specific
    // buffer pointer to just beyond the QOS structure proper.  Windows 98 needs this
    // whereas Windows 2000 ignores this.  Windows 98 should not care, because this
    // is strictly an output buffer, Windows 2000 corrects this problem.
    pTempQos = (QOS *)pBuf;
    pTempQos->ProviderSpecific.buf = pBuf + sizeof(QOS);
    pTempQos->ProviderSpecific.len = dwBufferLen - sizeof(QOS);
    // end Windows 98 workaround

    // Make the real call
    status = WSAIoctl(sd, SIO_GET_QOS, NULL, 0,
                            pBuf, dwBufferLen, &dwBytesReturned,
                            NULL, NULL);

    if (SOCKET_ERROR == status)
    {
        DWORD dwErr = WSAGetLastError();
        if (WSAEWOULDBLOCK != dwErr)
            printf("GetQos(2): WSAIoctl(SIO_GET_QOS) %d\n", dwErr);

        free(pBuf);
        return(FALSE);
    }

    // True means we need to free this memory later.
    *pQos = pTempQos;
    return(TRUE);
}

Generated on Wed Nov 13 2024 16:53:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/GQos/QosEvent/PrintQos.Cpp File Reference

  • NetDS
  • GQos
  • QosEvent
Functions

PrintQos.Cpp File Reference

#include "qosevent.h"

Go to the source code of this file.

Functions

void PrintQos (QOS *qos, CHAR *lpszIndent)

Function Documentation

void PrintQos | ( | QOS * | qos,
 |  | CHAR * | lpszIndent
 | ) |  |

Definition at line 55 of file PrintQos.Cpp.

{
    CHAR szIndent[24];

    strncpy(szIndent, lpszIndent, sizeof(szIndent));
    szIndent[sizeof(szIndent)-1] = '\0';

    if (NULL == qos)
    {
        printf("%sQOS structure is NULL\n", szIndent);
        return;
    }

    printf("%sSendingFlowSpec\n", szIndent);
    PrintFlowspec(&qos->SendingFlowspec, szIndent);

    printf("%sReceivingingFlowSpec\n", szIndent);
    PrintFlowspec(&qos->ReceivingFlowspec, szIndent);

    printf("%sProviderSpecific - len = %d\n", szIndent,
                qos->ProviderSpecific.len);
    PrintProviderSpecific(&qos->ProviderSpecific, szIndent);

    printf("\n");
    return;
}

Generated on Wed Nov 13 2024 16:53:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/GQos/QosEvent/QosEvent.Cpp File Reference

  • NetDS
  • GQos
  • QosEvent
Functions | Variables

QosEvent.Cpp File Reference

#include "qosevent.h"

Go to the source code of this file.

Functions

int _cdecl | main (int argc, char *argv[])

Variables

FLOWSPEC | default_g711
FLOWSPEC | default_notraffic
OPTIONS default_options
SOCKADDR_IN | g_destaddr

Function Documentation

int _cdecl main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 141 of file QosEvent.Cpp.

{
    int ret, err;
    OPTIONS options;
    WSADATA WSAData;
    WSAPROTOCOL_INFO protocol_info;

    ret = NO_ERROR;
    options.buf = NULL;

    // Process the Command Line Options
    if (!ValidOptions(argv, argc, &options))
        exit(1);

    // Startup Winsock
    err = WSAStartup(MAKEWORD(2,2), &WSAData);
    if (err)
    {
        printf("WSAStartup Failed (%d) Exiting\n", err);
        goto cleanup;
    }

    // Look for a Service Provider to handle what
    // we need from the options
    if (!FindServiceProvider(
                    options.spOptions.iProtocol,
                    options.spOptions.bQos,
                    options.spOptions.bMulticast,
                    &protocol_info))
    {
        printf("No matching service provider found. Exiting\n");
        goto cleanup;
    }

    // Show the user what they have selected
    PrintOptions(&options);

    // Become a Sender or a Reciever
    if (options.qosOptions.bReceiver)
        Receiver(&options, &protocol_info);
    else
        Sender(&options, &protocol_info);

cleanup:

    if (options.buf)
        free(options.buf);

    WSACleanup();
    return(0);
}

Variable Documentation

FLOWSPEC default_g711
Initial value:
    {
    8500,
    680,
    17000,
    QOS_NOT_SPECIFIED,
    QOS_NOT_SPECIFIED,
    SERVICETYPE_GUARANTEED,
    340,
    340
    }

Definition at line 119 of file QosEvent.Cpp.

FLOWSPEC default_notraffic
Initial value:
    {
    QOS_NOT_SPECIFIED,
    QOS_NOT_SPECIFIED,
    QOS_NOT_SPECIFIED,
    QOS_NOT_SPECIFIED,
    QOS_NOT_SPECIFIED,
    SERVICETYPE_NOTRAFFIC,
    QOS_NOT_SPECIFIED,
    QOS_NOT_SPECIFIED
    }

Definition at line 106 of file QosEvent.Cpp.

OPTIONS default_options
Initial value:

    {
    "localhost",
    MY_DEFPORT,
    1,
    'c',
    4096,
    NULL,
    0,
    0,
    {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, INVALID_SEND_PRIORITY,
        TRUE, TRUE, TRUE, TRUE, FALSE, QOS_IOCTL_SET_BEFORE, QOS_DEFAULTNAME},
    {IPPROTO_TCP, FALSE, FALSE}
    }

Definition at line 91 of file QosEvent.Cpp.

SOCKADDR_IN g_destaddr

Definition at line 132 of file QosEvent.Cpp.

Generated on Wed Nov 13 2024 16:53:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/GQos/QosEvent/QosEvent.h File Reference

  • NetDS
  • GQos
  • QosEvent
Classes | Defines | Typedefs | Enumerations | Functions | Variables

QosEvent.h File Reference

#include <winsock2.h>
#include <ws2tcpip.h>
#include <qos.h>
#include <qossp.h>
#include <stdio.h>
#include <stdlib.h>

Go to the source code of this file.

Classes

struct | _OPTIONS
struct | _QOS_OPTIONS
struct | _SP_OPTIONS

Defines

#define | DEFAULT_MULTICASTGROUP "234.5.6.7"
#define | INVALID_SEND_PRIORITY 255
#define | MY_DEFPORT (5001)
#define | QOS_DEFAULTNAME "default"

Typedefs

typedef struct _OPTIONS | OPTIONS
typedef struct _QOS_OPTIONS | QOS_OPTIONS
typedef struct _SP_OPTIONS | SP_OPTIONS

Enumerations

enum | QOS_IOCTL_SET { QOS_IOCTL_SET_DURING, QOS_IOCTL_SET_BEFORE, QOS_IOCTL_SET_AFTER, QOS_IOCTL_SET_QOS }

Functions

BOOL | ChkQosSend (SOCKET sd)
BOOL | FindServiceProvider (int iProtocol, BOOL bQos, BOOL bMulticast, WSAPROTOCOL_INFO *pProtocolInfo)
BOOL | GetQos (SOCKET sd, BOOL bQueryBufferSize, QOS **pQos)
void | PrintQos (QOS *qos, CHAR *lpszIndent)
VOID | Receiver (OPTIONS *pOptions, WSAPROTOCOL_INFO *pProtocolInfo)
VOID | Sender (OPTIONS *pOptions, WSAPROTOCOL_INFO *pProtocolInfo)
BOOL | SetQos (SOCKET sd, QOS_OPTIONS *pQosOptions, BOOL bSetQos, QOS *pQos, DWORD *cbQosLen)

Variables

FLOWSPEC | default_g711
FLOWSPEC | default_notraffic
SOCKADDR_IN | g_destaddr

Define Documentation

#define DEFAULT_MULTICASTGROUP "234.5.6.7"

Definition at line 43 of file QosEvent.h.

#define INVALID_SEND_PRIORITY 255

Definition at line 35 of file QosEvent.h.

#define MY_DEFPORT (5001)

Definition at line 29 of file QosEvent.h.

#define QOS_DEFAULTNAME "default"

Definition at line 40 of file QosEvent.h.

Typedef Documentation

typedef struct _OPTIONS OPTIONS
typedef struct _QOS_OPTIONS QOS_OPTIONS
typedef struct _SP_OPTIONS SP_OPTIONS

Enumeration Type Documentation

enum QOS_IOCTL_SET
Enumerator:
QOS_IOCTL_SET_DURING
QOS_IOCTL_SET_BEFORE
QOS_IOCTL_SET_AFTER
QOS_IOCTL_SET_QOS

Definition at line 53 of file QosEvent.h.

    {
    QOS_IOCTL_SET_DURING,       // do not use ioctl to set Qos
    QOS_IOCTL_SET_BEFORE,       // set qos with ioctl before connection/accept
    QOS_IOCTL_SET_AFTER,        // set qos with ioctl after connection/accept
    QOS_IOCTL_SET_QOS           // set qos in receiver during FD_QOS, note that
                                //  qos must be set prior to wsaeventselect in
                                //  order to ever receive fd_qos
    } QOS_IOCTL_SET;

Function Documentation

BOOL ChkQosSend ( SOCKET sd )

Definition at line 36 of file ChkQos.Cpp.

{
    int     nRet;
    DWORD   dwBytes;
    DWORD   inbuf = ALLOWED_TO_SEND_DATA;
    DWORD   outbuf;
    OSVERSIONINFO   verInfo = {0};

    // first check for windows 98, and silently fail if it is.
    verInfo.dwOSVersionInfoSize = sizeof(verInfo);
  GetVersionEx(&verInfo);
  if (VER_PLATFORM_WIN32_NT != verInfo.dwPlatformId)
      return(TRUE);

    nRet = WSAIoctl(sd, SIO_CHK_QOS,
                        (LPVOID)&inbuf, sizeof(inbuf),
                        (LPVOID)&outbuf, sizeof(outbuf),
                        &dwBytes, NULL, NULL);

    if (SOCKET_ERROR == nRet)
    {
        printf("WSAIoctl:SIO_CHK_QOS %d\n", WSAGetLastError());
        return(FALSE);
    }

    return((BOOL)outbuf);
}

BOOL FindServiceProvider | ( | int | iProtocol,
 |  | BOOL | bQos,
 |  | BOOL | bMulticast,
 |  | WSAPROTOCOL_INFO * | pProtocolInfo
 | ) |  |

Definition at line 35 of file Findsp.Cpp.

{
    int nRet;
    WSAPROTOCOL_INFO *lpProtocolBuf = NULL;
    DWORD dwBufLen = 0;
    DWORD dwErr;
    BOOL bProtocolFound = FALSE;
    BOOL bSPQos = FALSE, bSPMulticast=FALSE;
    BOOL bQosMatch = FALSE, bMulticastMatch = FALSE;

    // first have WSAEnumProtocols tell us how big a buffer is needed
    nRet = WSAEnumProtocols(NULL, NULL, &dwBufLen);
    if (SOCKET_ERROR != nRet)
    {
        printf("WSAEnumProtocols: should not have suceeded\n");
        goto end;
    }

    if (WSAENOBUFS != (dwErr = WSAGetLastError()))
    {
        // WSAEnumProtocols failed for some reason not relating to buffer size
        printf("WSAEnumProtocols(1): %d\n", dwErr);
        goto end;
    }

    // WSAEnumProtocols failed for the "expected" reason, allocate a buffer
    // of the needed size
    lpProtocolBuf = (WSAPROTOCOL_INFO *)malloc(dwBufLen);
    if (!lpProtocolBuf)
    {
        printf("malloc failed in FindServiceProvider\n");
        goto end;
    }

    // now we can call WSAEnumProtocols again with the expectation it will
    // succeed because we have allocated a big enough buffer.
    nRet = WSAEnumProtocols(NULL, lpProtocolBuf, &dwBufLen);
    if (SOCKET_ERROR == nRet)
    {
        printf("WSAEnumProtocols(3): %d\n", WSAGetLastError());
        goto end;
    }

    // loop thru protocols, looking for a matching service provider
    {
    for (int i=0; i<nRet; i++)
    {
        printf("  sp <%s>\n", lpProtocolBuf[i].szProtocol);

        // do we have the correct protocol?
        if (AF_INET != lpProtocolBuf[i].iAddressFamily
                || iProtocol != lpProtocolBuf[i].iProtocol)
            continue; // nope, move on

        // Check for Qos and Multicast
        bSPQos =
            ((XP1_QOS_SUPPORTED & lpProtocolBuf[i].dwServiceFlags1) != 0);
        bSPMulticast =
            ((XP1_SUPPORT_MULTIPOINT & lpProtocolBuf[i].dwServiceFlags1) != 0);

        // Look to see if we got exactly what we wanted
        if ((bQos == bSPQos) && (bMulticast == bSPMulticast))
        {

            memcpy(pProtocolInfo, (void *) &lpProtocolBuf[i],
                    sizeof(WSAPROTOCOL_INFO));
            bProtocolFound = TRUE;
            break;
        }
    } // for
    } // scope resolution for int i on stricter compilers

end:
    if (lpProtocolBuf)
        free(lpProtocolBuf);

    if (bProtocolFound)
        printf("  Using service provider <%s>\n\n", pProtocolInfo->szProtocol);

    return(bProtocolFound);
}

BOOL GetQos | ( | SOCKET | sd,
 |  | BOOL | bQueryBufferSize,
 |  | QOS ** | pQos
 | ) |  |

Definition at line 34 of file GetQos.Cpp.

{
    DWORD   dwBytesReturned=0;
    DWORD   status;
    DWORD   dwBufferLen;
    CHAR    *pBuf;
    QOS     *pTempQos;

    // Figure out what size buffer we need.
    if (!bQueryBufferSize)
        dwBufferLen = 2048; //win98 platform
    else
    {
        // Try to get it dynamically.
        dwBufferLen = 0;
        status = WSAIoctl(sd, SIO_GET_QOS, NULL, 0,
                      &dwBufferLen, sizeof(dwBufferLen),
                      &dwBytesReturned, NULL, NULL);

        // we have an error, anything except
        if (SOCKET_ERROR == status)
        {
            DWORD dwErr = WSAGetLastError();

            if (WSAEWOULDBLOCK == dwErr)
                return(FALSE);  // nothing to do

            if (WSAENOBUFS != dwErr)
            {
                // some sort of error not related to passing a large enough buffer
                printf("GetQos: WSAIoctl(SIO_GET_QOS) - query: %d\n", dwErr);
                return(FALSE);
            }
        }
    }

    // for Windows 98 dwBufferLen has been set statically, for Windows 2000 we queried the OS
    // for the proper buffer size
    printf("GetQos: dwBufferlen for pQos = %d\n", dwBufferLen);
    pBuf = (CHAR *)malloc(dwBufferLen);
    if (!pBuf)
    {
        printf("GetQos: malloc: %d\n", GetLastError());
        return(FALSE);
    }

    // Windows 98 workaround - not needed for Win2000, but doesn't hurt.  Windows 98
    // needs the provider specific buffer to point to valid memory, whereas Windows 2000
    // simply needs a contiguous block of memory.  Therefore we allocate a contiguous
    // block of memory cast it to a QOS structure and then set the provider specific
    // buffer pointer to just beyond the QOS structure proper.  Windows 98 needs this
    // whereas Windows 2000 ignores this.  Windows 98 should not care, because this
    // is strictly an output buffer, Windows 2000 corrects this problem.
    pTempQos = (QOS *)pBuf;
    pTempQos->ProviderSpecific.buf = pBuf + sizeof(QOS);
    pTempQos->ProviderSpecific.len = dwBufferLen - sizeof(QOS);
    // end Windows 98 workaround

    // Make the real call
    status = WSAIoctl(sd, SIO_GET_QOS, NULL, 0,
                            pBuf, dwBufferLen, &dwBytesReturned,
                            NULL, NULL);

    if (SOCKET_ERROR == status)
    {
        DWORD dwErr = WSAGetLastError();
        if (WSAEWOULDBLOCK != dwErr)
            printf("GetQos(2): WSAIoctl(SIO_GET_QOS) %d\n", dwErr);

        free(pBuf);
        return(FALSE);
    }

    // True means we need to free this memory later.
    *pQos = pTempQos;
    return(TRUE);
}

void PrintQos | ( | QOS * | qos,
 |  | CHAR * | lpszIndent
 | ) |  |

Definition at line 55 of file PrintQos.Cpp.

{
    CHAR szIndent[24];

    strncpy(szIndent, lpszIndent, sizeof(szIndent));
    szIndent[sizeof(szIndent)-1] = '\0';

    if (NULL == qos)
    {
        printf("%sQOS structure is NULL\n", szIndent);
        return;
    }

    printf("%sSendingFlowSpec\n", szIndent);
    PrintFlowspec(&qos->SendingFlowspec, szIndent);

    printf("%sReceivingingFlowSpec\n", szIndent);
    PrintFlowspec(&qos->ReceivingFlowspec, szIndent);

    printf("%sProviderSpecific - len = %d\n", szIndent,
                qos->ProviderSpecific.len);
    PrintProviderSpecific(&qos->ProviderSpecific, szIndent);

    printf("\n");
    return;
}

VOID Receiver | ( | OPTIONS * | pOptions,
 |  | WSAPROTOCOL_INFO * | pProtocolInfo
 | ) |  |

Definition at line 83 of file Receiver.Cpp.

{
    WSANETWORKEVENTS NetworkEvents;
    long lNetworkEvents;
    BOOL bProcessEventsDone;
    RECV_INFO RecvInfo;
    int i;

    printf("Receiver\n");

    // initialize data structures
    ZeroMemory(&RecvInfo, sizeof(RECV_INFO));
    for (i=0; i<MAXCLIENTS+1; i++)
    {
        RecvInfo.sd[i] = INVALID_SOCKET;

        if (WSA_INVALID_EVENT == (RecvInfo.hEvents[i] = WSACreateEvent()))
        {
            printf("WSACreateEvent(%d): %d\n", i, WSAGetLastError());
            goto CLEANUP;
        }
    }

    // create the receiving/listening socket
    if (!CreateReceivingSocket(&RecvInfo, pOptions, pProtocolInfo))
        goto CLEANUP;

    // TCP sockets need to accept a connection prior to receiving data.  ,
    // Additionally if we are doing UDP and multicasting, IP Multicasting does
    // not support rooted planes and thus a receiving end will not get
    // FD_ACCEPT notification
    if (IPPROTO_TCP == pOptions->spOptions.iProtocol)
        lNetworkEvents = FD_ACCEPT;
    else
        lNetworkEvents = (FD_READ|FD_QOS|FD_CLOSE);

    if (SOCKET_ERROR == WSAEventSelect(RecvInfo.sd[0], RecvInfo.hEvents[0],
                                        lNetworkEvents))
    {
        printf("WSAEventSelect: %d\n", WSAGetLastError());
        goto CLEANUP;
    }

    bProcessEventsDone = FALSE;
    do
    {
        DWORD dwEvent = WSAWaitForMultipleEvents((MAXCLIENTS+1), RecvInfo.hEvents,
                                                    FALSE, WSA_INFINITE, FALSE);
        switch (dwEvent)
        {
        case WSA_WAIT_FAILED:
            printf("WSAEventSelect: %d\n", WSAGetLastError());
            goto CLEANUP;

        case WAIT_IO_COMPLETION:
        case WSA_WAIT_TIMEOUT:
            _assume(0);
            break;

        default:
            // lets see what network activity trigged this event
            NetworkEvents.lNetworkEvents = 0;
            dwEvent -= WSA_WAIT_EVENT_0;

            if (SOCKET_ERROR == WSAEnumNetworkEvents(RecvInfo.sd[dwEvent],
                                                     RecvInfo.hEvents[dwEvent],
                                                     &NetworkEvents))
            {
                printf("WSAEnumNetworkEvent: %d dwEvent %d lNetworkEvent %X\n",
                            WSAGetLastError(), dwEvent,
                            NetworkEvents.lNetworkEvents);

                goto CLEANUP;
            }

            // it is possible that more than one notification triggered
            //printf("WSAEnumNetworkEvents %X\n", NetworkEvents.lNetworkEvents)
            if (FD_ACCEPT & NetworkEvents.lNetworkEvents)
                bProcessEventsDone |= fd_accept_func(dwEvent,
                                                     &NetworkEvents,
                                                     &RecvInfo,
                                                     pOptions);

            if (FD_READ & NetworkEvents.lNetworkEvents)
                bProcessEventsDone |= fd_read_func(dwEvent,
                                                     &NetworkEvents,
                                                     &RecvInfo,
                                                     pOptions);

            if (FD_QOS     & NetworkEvents.lNetworkEvents)
                bProcessEventsDone |= fd_qos_func(dwEvent,
                                                  &NetworkEvents,
                                                  &RecvInfo,
                                                  pOptions);

            if (FD_CLOSE   & NetworkEvents.lNetworkEvents)
                bProcessEventsDone |= fd_close_func(dwEvent,
                                                    &NetworkEvents,
                                                    &RecvInfo,
                                                    pOptions);

            break;
        }
    } while (!bProcessEventsDone);

CLEANUP:
    for (i=0; i<MAXCLIENTS+1; i++)
    {
        if (    (WSA_INVALID_EVENT != RecvInfo.hEvents[i])
            &&  (NULL != RecvInfo.hEvents[i]))
            WSACloseEvent(RecvInfo.hEvents[i]);

        if (    (INVALID_SOCKET != RecvInfo.sd[i])
             && (NULL != RecvInfo.sd[i]))
            closesocket(RecvInfo.sd[i]);
    }

    return;
}

VOID Sender | ( | OPTIONS * | pOptions,
 |  | WSAPROTOCOL_INFO * | pProtocolInfo
 | ) |  |

Definition at line 91 of file Sender.Cpp.

{
    WSANETWORKEVENTS    NetworkEvents;
    BOOL                bProcessEventsDone;
    SEND_INFO           SendInfo;
    int                 i;
    BOOL                bDisableQos = TRUE;
    BOOL                bErr;

    printf("Sender\n");

    //Initialize SEND_INFO
    ZeroMemory((char *)&SendInfo,sizeof(SendInfo));
    for (i=0; i<TOTAL_EVENTS; i++)
    {
        SendInfo.hEvents[i] = WSACreateEvent();
        if (WSA_INVALID_EVENT == SendInfo.hEvents[i])
        {
            printf("WSACreateEvent(%d): %d\n", i, WSAGetLastError());
            goto CLEANUP;
        }
    }

    SendInfo.sd           = INVALID_SOCKET;
    SendInfo.ovr.hEvent   = SendInfo.hEvents[WSASEND_EVENT];
    SendInfo.sndbuf.buf   = pOptions->buf;
    SendInfo.sndbuf.len   = pOptions->nBufSize;
    SendInfo.nTotalSends  = 0;

    // Should we be able to send yet?
    if (!pOptions->spOptions.bQos)
        SendInfo.bSendEnabled = TRUE;
    else
        SendInfo.bSendEnabled = !pOptions->qosOptions.bWaitToSend;

    bErr = CreateSendingSocket(&SendInfo, pOptions, pProtocolInfo);

    if (!bErr)
        goto CLEANUP;

    // If we are using UDP.
    if (IPPROTO_UDP == pOptions->spOptions.iProtocol)
        //
        // Post the first send.
        if (PostSend(&SendInfo, pOptions))
            goto CLEANUP;

    bProcessEventsDone = FALSE;
    do
    {
        DWORD dwEvent = WSAWaitForMultipleEvents(TOTAL_EVENTS, SendInfo.hEvents,
                                                    FALSE, WSA_INFINITE, FALSE);
        switch (dwEvent)
        {
        case WSA_WAIT_FAILED:
            printf("WSAEventSelect: %d\n", WSAGetLastError());
            goto CLEANUP;

        case WAIT_IO_COMPLETION:
        case WSA_WAIT_TIMEOUT:
            _assume(0);
            break;

        default:
            dwEvent -= WSA_WAIT_EVENT_0;

            if (WSAEVENTSELECT_EVENT != dwEvent) {
                bProcessEventsDone = CompleteSend(&SendInfo, pOptions);
                break;
            }

            // lets see what network activity trigged this event
            if (SOCKET_ERROR == WSAEnumNetworkEvents(
                                    SendInfo.sd,
                                    SendInfo.hEvents[WSAEVENTSELECT_EVENT],
                                    &NetworkEvents))
            {
                printf("WSAEnumNetworkEvent: %d lNetworkEvent %X\n",
                    WSAGetLastError(), NetworkEvents.lNetworkEvents);
                NetworkEvents.lNetworkEvents = 0;
                break;
            }

            if (FD_CONNECT & NetworkEvents.lNetworkEvents)
                bProcessEventsDone |= fd_connect_func(dwEvent,
                                                      &NetworkEvents,
                                                      &SendInfo,
                                                      pOptions);

            if (FD_QOS     & NetworkEvents.lNetworkEvents)
                bProcessEventsDone |= fd_qos_func(dwEvent,
                                                  &NetworkEvents,
                                                  &SendInfo,
                                                  pOptions);

            if (FD_CLOSE   & NetworkEvents.lNetworkEvents)
                bProcessEventsDone |= fd_close_func(dwEvent,
                                                    &NetworkEvents,
                                                    &SendInfo);
        }

        // allow pauses between notifications
        if (pOptions->dwSleep)
            Sleep(pOptions->dwSleep);

        // alternate every N sends enabling or disabling QOS on a socket
        if (    pOptions->spOptions.bQos
            &&  pOptions->qosOptions.bAlternateQos
            &&  ((SendInfo.nTotalSends % 5) == 0) )
        {
            QOS     qos;
            DWORD   dwBytes, cbQosLen;
            int     nRet;

            if (bDisableQos)
            {
                bDisableQos = FALSE;

                qos.ReceivingFlowspec    = default_notraffic;
                qos.SendingFlowspec      = default_notraffic;
                qos.ProviderSpecific.buf = NULL;
                qos.ProviderSpecific.len = 0;

                cbQosLen = sizeof(QOS) + qos.ProviderSpecific.len;

                nRet = WSAIoctl(SendInfo.sd, SIO_SET_QOS, (LPVOID)&qos,
                                    cbQosLen, NULL, 0, &dwBytes, NULL, NULL);

                if (SOCKET_ERROR == nRet)
                    printf("WSAIoctl:SIO_SET_QOS %d\n", WSAGetLastError());

                SendInfo.bSendEnabled = TRUE;
            }
            else
            {
                bDisableQos = TRUE;

                SetQos(SendInfo.sd, &pOptions->qosOptions, TRUE,
                        &qos, &cbQosLen);

                // sender should not send data until RESV arrives for this new
                // PATH msg if -rsvp-wait flag is specified.
                SendInfo.bSendEnabled = !pOptions->qosOptions.bWaitToSend;
            }

            printf("  bSendEnabled = %s\n", (
                        SendInfo.bSendEnabled?"TRUE":"FALSE"));

        }
    } while (!bProcessEventsDone);

CLEANUP:
    if (    (INVALID_SOCKET != SendInfo.sd)
        &&  (NULL != SendInfo.sd))
        closesocket(SendInfo.sd);

    for (i=0; i<TOTAL_EVENTS; i++)
        if (    (WSA_INVALID_EVENT != SendInfo.hEvents[i])
            &&  (NULL != SendInfo.hEvents[i]))
            WSACloseEvent(SendInfo.hEvents[i]);

}

BOOL SetQos | ( | SOCKET | sd,
 |  | QOS_OPTIONS * | pQosOptions,
 |  | BOOL | bSetQos,
 |  | QOS * | pQos,
 |  | DWORD * | cbQosLen
 | ) |  |

Definition at line 31 of file SetQos.Cpp.

{
    // fill in some default values
    if (_stricmp(pQosOptions->szTemplate, QOS_DEFAULTNAME) == 0)
        FillQosFlowspecDefault(pQos, cbQosLen, pQosOptions);
    else if (!FillQosFlowspecFromTemplate(sd, pQos, cbQosLen, pQosOptions))
        return FALSE;

    if (pQosOptions->bDisableSignalling)
        pQos->ReceivingFlowspec.ServiceType |= SERVICE_NO_QOS_SIGNALING;

    if (!FillQosProviderSpecific(pQos, cbQosLen, pQosOptions))
        return FALSE;

    if (bSetQos)
    {
        int     nRet;
        DWORD   dwBytes;

        if (pQosOptions->bFineGrainErrorAvail)
        {
            RSVP_STATUS_INFO rsvpStatus;

            // uncomment next line to test error handling on SIO_SET_QOS
            // pQos->ReceivingFlowspec.ServiceType = 0x555;
            nRet = WSAIoctl(sd, SIO_SET_QOS, (LPVOID)pQos, *cbQosLen,
                            &rsvpStatus, sizeof(RSVP_STATUS_INFO), &dwBytes,
                            NULL, NULL);

            if (SOCKET_ERROR == nRet)
            {
                printf("WSAIoctl(SIO_SET_QOS) %d, \n\tStatusCode=%d\n\tExtendedStatus1=%d\n\tExtendedStatus2=%d\n",
                            WSAGetLastError(),
                            rsvpStatus.StatusCode,
                            rsvpStatus.ExtendedStatus1,
                            rsvpStatus.ExtendedStatus2);
                return FALSE;
            }

        } else {
            nRet = WSAIoctl(sd, SIO_SET_QOS, (LPVOID)pQos, *cbQosLen,
                            NULL, 0, &dwBytes, NULL, NULL);

            if (SOCKET_ERROR == nRet)
            {
                printf("WSAIoctl(SIO_SET_QOS) %d\n", WSAGetLastError());
                return FALSE;
            }
        }
    }

    return(TRUE);
}

Variable Documentation

FLOWSPEC default_g711

Definition at line 119 of file QosEvent.Cpp.

FLOWSPEC default_notraffic

Definition at line 106 of file QosEvent.Cpp.

SOCKADDR_IN g_destaddr

Definition at line 132 of file QosEvent.Cpp.

Generated on Wed Nov 13 2024 16:53:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/GQos/QosEvent/Receiver.Cpp File Reference

  • NetDS
  • GQos
  • QosEvent
Classes | Defines | Typedefs | Functions

Receiver.Cpp File Reference

#include "qosevent.h"

Go to the source code of this file.

Classes

struct | _RECV_INFO

Defines

#define | MAXCLIENTS 4

Typedefs

typedef struct _RECV_INFO | RECV_INFO

Functions

int CALLBACK | AcceptCondFunc (LPWSABUF, LPWSABUF, LPQOS, LPQOS, LPWSABUF, LPWSABUF, GROUP FAR *, DWORD_PTR)
VOID | Receiver (OPTIONS *pOptions, WSAPROTOCOL_INFO *pProtocolInfo)

Define Documentation

#define MAXCLIENTS 4

Definition at line 47 of file Receiver.Cpp.

Typedef Documentation

typedef struct _RECV_INFO RECV_INFO

Function Documentation

int CALLBACK AcceptCondFunc | ( | LPWSABUF | lpCallerId,
 |  | LPWSABUF | lpCallerData,
 |  | LPQOS | lpSQos,
 |  | LPQOS | lpGQos,
 |  | LPWSABUF | lpCalleeId,
 |  | LPWSABUF | lpCalleeData,
 |  | GROUP FAR * | Group,
 |  | DWORD_PTR | CallbackData
 | ) |  |

Definition at line 699 of file Receiver.Cpp.

{
    OPTIONS *pOptions;

    UNREFERENCED_PARAMETER(Group);
    UNREFERENCED_PARAMETER(lpCalleeData);
    UNREFERENCED_PARAMETER(lpGQos);
    UNREFERENCED_PARAMETER(lpCallerData);

    pOptions = (OPTIONS *)CallbackData;

    printf("    AcceptCondFunc\n");
    if (lpCallerId)
    {
        // NOTE:  This program only supports TCP or UDP
        SOCKADDR_IN *sockaddr = (SOCKADDR_IN *)lpCallerId->buf;
        printf("      lpCallerId address family=%d, port=%d\n",
            sockaddr->sin_family, ntohs(sockaddr->sin_port));
    }

    if (lpSQos)
    {
        printf("    AcceptCondFunc: lpSQos valid\n");

        if (pOptions->spOptions.bQos)
            // bMustSetQosInAccept will not be set for Windows2000 but only for
            // Win98. Win98 currently requires valid QOS parameters to be set
            // here iff lpSQos is a valid pointer.
            if (    (QOS_IOCTL_SET_DURING == pOptions->qosOptions.qosIoctlSet)
                ||  pOptions->qosOptions.bMustSetQosInAccept)
            {
                DWORD cbQosLen;
                printf("    AcceptCondFunc: filling in Qos\n");

                if (SetQos(g_sd, &pOptions->qosOptions,  FALSE, lpSQos, &cbQosLen))
                    PrintQos(lpSQos, "    ");
                else
                    printf("    Failed to SetQos\n");
            }
    }

    if (lpCalleeId)
    {
        // NOTE:  This program only supports TCP or UDP
        SOCKADDR_IN *sockaddr = (SOCKADDR_IN *)lpCalleeId->buf;
        printf("      lpCalleeId: address family=%d, port=%d\n",
                    sockaddr->sin_family, ntohs(sockaddr->sin_port));
    }

    //
    // Determine where to accept or reject the new connection based
    // on the number of clients currently connected.
    if (MAXCLIENTS == pOptions->dwTotalClients)
    {
        printf("      Rejecting connection, limit of %d clients reached\n",
                    pOptions->dwTotalClients);

        // At this point a connection will already have been established,
        // this will just cause the connection to be reset.
        return(CF_REJECT);
    }

    pOptions->dwTotalClients++;

    return(CF_ACCEPT);
}

VOID Receiver | ( | OPTIONS * | pOptions,
 |  | WSAPROTOCOL_INFO * | pProtocolInfo
 | ) |  |

Definition at line 83 of file Receiver.Cpp.

{
    WSANETWORKEVENTS NetworkEvents;
    long lNetworkEvents;
    BOOL bProcessEventsDone;
    RECV_INFO RecvInfo;
    int i;

    printf("Receiver\n");

    // initialize data structures
    ZeroMemory(&RecvInfo, sizeof(RECV_INFO));
    for (i=0; i<MAXCLIENTS+1; i++)
    {
        RecvInfo.sd[i] = INVALID_SOCKET;

        if (WSA_INVALID_EVENT == (RecvInfo.hEvents[i] = WSACreateEvent()))
        {
            printf("WSACreateEvent(%d): %d\n", i, WSAGetLastError());
            goto CLEANUP;
        }
    }

    // create the receiving/listening socket
    if (!CreateReceivingSocket(&RecvInfo, pOptions, pProtocolInfo))
        goto CLEANUP;

    // TCP sockets need to accept a connection prior to receiving data.  ,
    // Additionally if we are doing UDP and multicasting, IP Multicasting does
    // not support rooted planes and thus a receiving end will not get
    // FD_ACCEPT notification
    if (IPPROTO_TCP == pOptions->spOptions.iProtocol)
        lNetworkEvents = FD_ACCEPT;
    else
        lNetworkEvents = (FD_READ|FD_QOS|FD_CLOSE);

    if (SOCKET_ERROR == WSAEventSelect(RecvInfo.sd[0], RecvInfo.hEvents[0],
                                        lNetworkEvents))
    {
        printf("WSAEventSelect: %d\n", WSAGetLastError());
        goto CLEANUP;
    }

    bProcessEventsDone = FALSE;
    do
    {
        DWORD dwEvent = WSAWaitForMultipleEvents((MAXCLIENTS+1), RecvInfo.hEvents,
                                                    FALSE, WSA_INFINITE, FALSE);
        switch (dwEvent)
        {
        case WSA_WAIT_FAILED:
            printf("WSAEventSelect: %d\n", WSAGetLastError());
            goto CLEANUP;

        case WAIT_IO_COMPLETION:
        case WSA_WAIT_TIMEOUT:
            _assume(0);
            break;

        default:
            // lets see what network activity trigged this event
            NetworkEvents.lNetworkEvents = 0;
            dwEvent -= WSA_WAIT_EVENT_0;

            if (SOCKET_ERROR == WSAEnumNetworkEvents(RecvInfo.sd[dwEvent],
                                                     RecvInfo.hEvents[dwEvent],
                                                     &NetworkEvents))
            {
                printf("WSAEnumNetworkEvent: %d dwEvent %d lNetworkEvent %X\n",
                            WSAGetLastError(), dwEvent,
                            NetworkEvents.lNetworkEvents);

                goto CLEANUP;
            }

            // it is possible that more than one notification triggered
            //printf("WSAEnumNetworkEvents %X\n", NetworkEvents.lNetworkEvents)
            if (FD_ACCEPT & NetworkEvents.lNetworkEvents)
                bProcessEventsDone |= fd_accept_func(dwEvent,
                                                     &NetworkEvents,
                                                     &RecvInfo,
                                                     pOptions);

            if (FD_READ & NetworkEvents.lNetworkEvents)
                bProcessEventsDone |= fd_read_func(dwEvent,
                                                     &NetworkEvents,
                                                     &RecvInfo,
                                                     pOptions);

            if (FD_QOS     & NetworkEvents.lNetworkEvents)
                bProcessEventsDone |= fd_qos_func(dwEvent,
                                                  &NetworkEvents,
                                                  &RecvInfo,
                                                  pOptions);

            if (FD_CLOSE   & NetworkEvents.lNetworkEvents)
                bProcessEventsDone |= fd_close_func(dwEvent,
                                                    &NetworkEvents,
                                                    &RecvInfo,
                                                    pOptions);

            break;
        }
    } while (!bProcessEventsDone);

CLEANUP:
    for (i=0; i<MAXCLIENTS+1; i++)
    {
        if (    (WSA_INVALID_EVENT != RecvInfo.hEvents[i])
            &&  (NULL != RecvInfo.hEvents[i]))
            WSACloseEvent(RecvInfo.hEvents[i]);

        if (    (INVALID_SOCKET != RecvInfo.sd[i])
             && (NULL != RecvInfo.sd[i]))
            closesocket(RecvInfo.sd[i]);
    }

    return;
}

Generated on Wed Nov 13 2024 16:53:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/GQos/QosEvent/Sender.Cpp File Reference

  • NetDS
  • GQos
  • QosEvent
Classes | Defines | Typedefs | Functions

Sender.Cpp File Reference

#include "qosevent.h"

Go to the source code of this file.

Classes

struct | _SEND_INFO

Defines

#define | TOTAL_EVENTS 2
#define | WSAEVENTSELECT_EVENT 0
#define | WSASEND_EVENT 1

Typedefs

typedef struct _SEND_INFO | SEND_INFO

Functions

VOID | Sender (OPTIONS *pOptions, WSAPROTOCOL_INFO *pProtocolInfo)

Define Documentation

#define TOTAL_EVENTS 2

Definition at line 48 of file Sender.Cpp.

#define WSAEVENTSELECT_EVENT 0

Definition at line 46 of file Sender.Cpp.

#define WSASEND_EVENT 1

Definition at line 47 of file Sender.Cpp.

Typedef Documentation

typedef struct _SEND_INFO SEND_INFO

Function Documentation

VOID Sender | ( | OPTIONS * | pOptions,
 |  | WSAPROTOCOL_INFO * | pProtocolInfo
 | ) |  |

Definition at line 91 of file Sender.Cpp.

{
    WSANETWORKEVENTS    NetworkEvents;
    BOOL                bProcessEventsDone;
    SEND_INFO           SendInfo;
    int                 i;
    BOOL                bDisableQos = TRUE;
    BOOL                bErr;

    printf("Sender\n");

    //Initialize SEND_INFO
    ZeroMemory((char *)&SendInfo,sizeof(SendInfo));
    for (i=0; i<TOTAL_EVENTS; i++)
    {
        SendInfo.hEvents[i] = WSACreateEvent();
        if (WSA_INVALID_EVENT == SendInfo.hEvents[i])
        {
            printf("WSACreateEvent(%d): %d\n", i, WSAGetLastError());
            goto CLEANUP;
        }
    }

    SendInfo.sd           = INVALID_SOCKET;
    SendInfo.ovr.hEvent   = SendInfo.hEvents[WSASEND_EVENT];
    SendInfo.sndbuf.buf   = pOptions->buf;
    SendInfo.sndbuf.len   = pOptions->nBufSize;
    SendInfo.nTotalSends  = 0;

    // Should we be able to send yet?
    if (!pOptions->spOptions.bQos)
        SendInfo.bSendEnabled = TRUE;
    else
        SendInfo.bSendEnabled = !pOptions->qosOptions.bWaitToSend;

    bErr = CreateSendingSocket(&SendInfo, pOptions, pProtocolInfo);

    if (!bErr)
        goto CLEANUP;

    // If we are using UDP.
    if (IPPROTO_UDP == pOptions->spOptions.iProtocol)
        //
        // Post the first send.
        if (PostSend(&SendInfo, pOptions))
            goto CLEANUP;

    bProcessEventsDone = FALSE;
    do
    {
        DWORD dwEvent = WSAWaitForMultipleEvents(TOTAL_EVENTS, SendInfo.hEvents,
                                                    FALSE, WSA_INFINITE, FALSE);
        switch (dwEvent)
        {
        case WSA_WAIT_FAILED:
            printf("WSAEventSelect: %d\n", WSAGetLastError());
            goto CLEANUP;

        case WAIT_IO_COMPLETION:
        case WSA_WAIT_TIMEOUT:
            _assume(0);
            break;

        default:
            dwEvent -= WSA_WAIT_EVENT_0;

            if (WSAEVENTSELECT_EVENT != dwEvent) {
                bProcessEventsDone = CompleteSend(&SendInfo, pOptions);
                break;
            }

            // lets see what network activity trigged this event
            if (SOCKET_ERROR == WSAEnumNetworkEvents(
                                    SendInfo.sd,
                                    SendInfo.hEvents[WSAEVENTSELECT_EVENT],
                                    &NetworkEvents))
            {
                printf("WSAEnumNetworkEvent: %d lNetworkEvent %X\n",
                    WSAGetLastError(), NetworkEvents.lNetworkEvents);
                NetworkEvents.lNetworkEvents = 0;
                break;
            }

            if (FD_CONNECT & NetworkEvents.lNetworkEvents)
                bProcessEventsDone |= fd_connect_func(dwEvent,
                                                      &NetworkEvents,
                                                      &SendInfo,
                                                      pOptions);

            if (FD_QOS     & NetworkEvents.lNetworkEvents)
                bProcessEventsDone |= fd_qos_func(dwEvent,
                                                  &NetworkEvents,
                                                  &SendInfo,
                                                  pOptions);

            if (FD_CLOSE   & NetworkEvents.lNetworkEvents)
                bProcessEventsDone |= fd_close_func(dwEvent,
                                                    &NetworkEvents,
                                                    &SendInfo);
        }

        // allow pauses between notifications
        if (pOptions->dwSleep)
            Sleep(pOptions->dwSleep);

        // alternate every N sends enabling or disabling QOS on a socket
        if (    pOptions->spOptions.bQos
            &&  pOptions->qosOptions.bAlternateQos
            &&  ((SendInfo.nTotalSends % 5) == 0) )
        {
            QOS     qos;
            DWORD   dwBytes, cbQosLen;
            int     nRet;

            if (bDisableQos)
            {
                bDisableQos = FALSE;

                qos.ReceivingFlowspec    = default_notraffic;
                qos.SendingFlowspec      = default_notraffic;
                qos.ProviderSpecific.buf = NULL;
                qos.ProviderSpecific.len = 0;

                cbQosLen = sizeof(QOS) + qos.ProviderSpecific.len;

                nRet = WSAIoctl(SendInfo.sd, SIO_SET_QOS, (LPVOID)&qos,
                                    cbQosLen, NULL, 0, &dwBytes, NULL, NULL);

                if (SOCKET_ERROR == nRet)
                    printf("WSAIoctl:SIO_SET_QOS %d\n", WSAGetLastError());

                SendInfo.bSendEnabled = TRUE;
            }
            else
            {
                bDisableQos = TRUE;

                SetQos(SendInfo.sd, &pOptions->qosOptions, TRUE,
                        &qos, &cbQosLen);

                // sender should not send data until RESV arrives for this new
                // PATH msg if -rsvp-wait flag is specified.
                SendInfo.bSendEnabled = !pOptions->qosOptions.bWaitToSend;
            }

            printf("  bSendEnabled = %s\n", (
                        SendInfo.bSendEnabled?"TRUE":"FALSE"));

        }
    } while (!bProcessEventsDone);

CLEANUP:
    if (    (INVALID_SOCKET != SendInfo.sd)
        &&  (NULL != SendInfo.sd))
        closesocket(SendInfo.sd);

    for (i=0; i<TOTAL_EVENTS; i++)
        if (    (WSA_INVALID_EVENT != SendInfo.hEvents[i])
            &&  (NULL != SendInfo.hEvents[i]))
            WSACloseEvent(SendInfo.hEvents[i]);

}

Generated on Wed Nov 13 2024 16:53:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/GQos/QosEvent/SetQos.Cpp File Reference

  • NetDS
  • GQos
  • QosEvent
Functions

SetQos.Cpp File Reference

#include "qosevent.h"

Go to the source code of this file.

Functions

BOOL SetQos (SOCKET sd, QOS_OPTIONS *pQosOptions, BOOL bSetQos, QOS *pQos, DWORD *cbQosLen)

Function Documentation

BOOL SetQos | ( | SOCKET | sd,
 |  | QOS_OPTIONS * | pQosOptions,
 |  | BOOL | bSetQos,
 |  | QOS * | pQos,
 |  | DWORD * | cbQosLen
 | ) |  |

Definition at line 31 of file SetQos.Cpp.

{
    // fill in some default values
    if (_stricmp(pQosOptions->szTemplate, QOS_DEFAULTNAME) == 0)
        FillQosFlowspecDefault(pQos, cbQosLen, pQosOptions);
    else if (!FillQosFlowspecFromTemplate(sd, pQos, cbQosLen, pQosOptions))
        return FALSE;

    if (pQosOptions->bDisableSignalling)
        pQos->ReceivingFlowspec.ServiceType |= SERVICE_NO_QOS_SIGNALING;

    if (!FillQosProviderSpecific(pQos, cbQosLen, pQosOptions))
        return FALSE;

    if (bSetQos)
    {
        int     nRet;
        DWORD   dwBytes;

        if (pQosOptions->bFineGrainErrorAvail)
        {
            RSVP_STATUS_INFO rsvpStatus;

            // uncomment next line to test error handling on SIO_SET_QOS
            // pQos->ReceivingFlowspec.ServiceType = 0x555;
            nRet = WSAIoctl(sd, SIO_SET_QOS, (LPVOID)pQos, *cbQosLen,
                            &rsvpStatus, sizeof(RSVP_STATUS_INFO), &dwBytes,
                            NULL, NULL);

            if (SOCKET_ERROR == nRet)
            {
                printf("WSAIoctl(SIO_SET_QOS) %d, \n\tStatusCode=%d\n\tExtendedStatus1=%d\n\tExtendedStatus2=%d\n",
                            WSAGetLastError(),
                            rsvpStatus.StatusCode,
                            rsvpStatus.ExtendedStatus1,
                            rsvpStatus.ExtendedStatus2);
                return FALSE;
            }

        } else {
            nRet = WSAIoctl(sd, SIO_SET_QOS, (LPVOID)pQos, *cbQosLen,
                            NULL, 0, &dwBytes, NULL, NULL);

            if (SOCKET_ERROR == nRet)
            {
                printf("WSAIoctl(SIO_SET_QOS) %d\n", WSAGetLastError());
                return FALSE;
            }
        }
    }

    return(TRUE);
}

Generated on Wed Nov 13 2024 16:53:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/GQos/Qoslist/Qoslist.Cpp File Reference

  • NetDS
  • GQos
  • Qoslist
Classes | Defines | Typedefs | Enumerations | Functions | Variables

Qoslist.Cpp File Reference

#include <winsock2.h>
#include <ws2tcpip.h>
#include <ws2spi.h>
#include <qos.h>
#include <qossp.h>
#include <qosname.h>
#include <stdio.h>

Go to the source code of this file.

Classes

struct | _OPTIONS

Defines

#define | QOSTEST "qostest"
#define | WINVER 0x0500

Typedefs

typedef struct _OPTIONS | OPTIONS

Enumerations

enum | TEMPLATE_CMD { CMD_OPTION_ADD, CMD_OPTION_DEL, CMD_OPTION_LIST }

Functions

int | main (int argc, char *argv[])

Variables

FLOWSPEC | default_qostest

Define Documentation

#define QOSTEST "qostest"

Definition at line 44 of file Qoslist.Cpp.

#define WINVER 0x0500

Definition at line 33 of file Qoslist.Cpp.

Typedef Documentation

typedef struct _OPTIONS OPTIONS

Enumeration Type Documentation

enum TEMPLATE_CMD
Enumerator:
CMD_OPTION_ADD
CMD_OPTION_DEL
CMD_OPTION_LIST

Definition at line 48 of file Qoslist.Cpp.

    {
    CMD_OPTION_ADD,
    CMD_OPTION_DEL,
    CMD_OPTION_LIST
    } TEMPLATE_CMD;

Function Documentation

int main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 86 of file Qoslist.Cpp.

    {
    OPTIONS options;
    WSADATA WSAData;
    WSAPROTOCOL_INFO protocol_info;
    SOCKET sd;
    int status;

    if (!ValidOptions(argv, argc, &options))
        exit(1);

    status = WSAStartup(MAKEWORD(2,2), &WSAData);
    if (status != NO_ERROR)
        {
        printf("WSAStartup %d", status);
        exit(1);
        }

    if (!FindServiceProvider(&protocol_info))
        {
        printf("Suitable GQOS Service Provider not found\n");
        exit(1);
        }

    sd = WSASocket(FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO,
            &protocol_info, 0, WSA_FLAG_OVERLAPPED);
    if (INVALID_SOCKET != sd)
        {
        switch (options.template_cmd)
            {
            case CMD_OPTION_ADD:
                AddQos(sd, options.bGlobalTemplate, &protocol_info);
                break;

            case CMD_OPTION_DEL:
                DeleteQos(sd, options.bGlobalTemplate, &protocol_info);
                break;

            case CMD_OPTION_LIST:
                ListQos(sd);
                break;
            }
        closesocket(sd);
        }   else printf("WSASocket Failed with error %d\n", WSAGetLastError());
    WSACleanup();
    return(0);
    }

Variable Documentation

FLOWSPEC default_qostest
Initial value:
    {
    65000,
    6500,
    135000,
    QOS_NOT_SPECIFIED,
    QOS_NOT_SPECIFIED,
    SERVICETYPE_GUARANTEED,
    350,
    350
    }

Definition at line 62 of file Qoslist.Cpp.

Generated on Wed Nov 13 2024 16:53:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/http/server/main.c File Reference

  • NetDS
  • http
  • server
Defines | Functions

main.c File Reference

#include "precomp.h"

Go to the source code of this file.

Defines

#define | ADD_KNOWN_HEADER(Response, HeaderId, RawValue)
#define | ALLOC_MEM(cb) HeapAlloc(GetProcessHeap(), 0, (cb))
#define | FREE_MEM(ptr) HeapFree(GetProcessHeap(), 0, (ptr))
#define | INITIALIZE_HTTP_RESPONSE(resp, status, reason)
#define | MAX_ULONG_STR ((ULONG) sizeof("4294967295"))

Functions

DWORD | DoReceiveRequests (HANDLE hReqQueue)
DWORD | DoReceiveRequests (IN HANDLE hReqQueue)
DWORD | SendHttpPostResponse (IN HANDLE hReqQueue, IN PHTTP_REQUEST pRequest)
DWORD | SendHttpResponse (IN HANDLE hReqQueue, IN PHTTP_REQUEST pRequest, IN USHORT StatusCode, IN PSTR pReason, IN PSTR pEntity)
int __cdecl | wmain (int argc, wchar_t *argv[])

Define Documentation

#define ADD_KNOWN_HEADER | ( | Response,
 |  | HeaderId,
 |  | RawValue
 | ) |
Value:
do                                                                      \
    {                                                                       \
        (Response).Headers.KnownHeaders[(HeaderId)].pRawValue = (RawValue); \
        (Response).Headers.KnownHeaders[(HeaderId)].RawValueLength =        \
            (USHORT) strlen(RawValue);                                      \
    } while(FALSE)

Definition at line 29 of file main.c.

#define ALLOC_MEM ( cb ) HeapAlloc(GetProcessHeap(), 0, (cb))

Definition at line 37 of file main.c.

#define FREE_MEM ( ptr ) HeapFree(GetProcessHeap(), 0, (ptr))

Definition at line 38 of file main.c.

#define INITIALIZE_HTTP_RESPONSE | ( | resp,
 |  | status,
 |  | reason
 | ) |
Value:
do                                                                      \
    {                                                                       \
        RtlZeroMemory( (resp), sizeof(*(resp)) );                           \
        (resp)->StatusCode = (status);                                      \
        (resp)->pReason = (reason);                                         \
        (resp)->ReasonLength = (USHORT) strlen(reason);                     \
    } while (FALSE)

Definition at line 18 of file main.c.

#define MAX_ULONG_STR ((ULONG) sizeof("4294967295"))

Function Documentation

DWORD DoReceiveRequests ( HANDLE hReqQueue )
DWORD DoReceiveRequests ( IN HANDLE hReqQueue )

Definition at line 214 of file main.c.

{
    ULONG              result;
    HTTP_REQUEST_ID    requestId;
    DWORD              bytesRead;
    PHTTP_REQUEST      pRequest;
    PCHAR              pRequestBuffer;
    ULONG              RequestBufferLength;

    //
    // Allocate a 2K buffer. Should be good for most requests, we'll grow
    // this if required. We also need space for a HTTP_REQUEST structure.
    //
    RequestBufferLength = sizeof(HTTP_REQUEST) + 2048;
    pRequestBuffer      = ALLOC_MEM( RequestBufferLength );

    if (pRequestBuffer == NULL)
    {
        return ERROR_NOT_ENOUGH_MEMORY;
    }

    pRequest = (PHTTP_REQUEST)pRequestBuffer;

    //
    // Wait for a new request -- This is indicated by a NULL request ID.
    //

    HTTP_SET_NULL_ID( &requestId );

    for(;;)
    {
        RtlZeroMemory(pRequest, RequestBufferLength);

        result = HttpReceiveHttpRequest(
                    hReqQueue,          // Req Queue
                    requestId,          // Req ID
                    0,                  // Flags
                    pRequest,           // HTTP request buffer
                    RequestBufferLength,// req buffer length
                    &bytesRead,         // bytes received
                    NULL                // LPOVERLAPPED
                    );

        if(NO_ERROR == result)
        {
            //
            // Worked!
            //
            switch(pRequest->Verb)
            {
                case HttpVerbGET:
                    wprintf(L"Got a GET request for %ws \n",
                            pRequest->CookedUrl.pFullUrl);

                    result = SendHttpResponse(
                                hReqQueue,
                                pRequest,
                                200,
                                "OK",
                                "Hey! You hit the server \r\n"
                                );
                    break;

                case HttpVerbPOST:

                    wprintf(L"Got a POST request for %ws \n",
                            pRequest->CookedUrl.pFullUrl);

                    result = SendHttpPostResponse(hReqQueue, pRequest);
                    break;

                default:
                    wprintf(L"Got a unknown request for %ws \n",
                            pRequest->CookedUrl.pFullUrl);

                    result = SendHttpResponse(
                                hReqQueue,
                                pRequest,
                                503,
                                "Not Implemented",
                                NULL
                                );
                    break;
            }

            if(result != NO_ERROR)
            {
                break;
            }

            //
            // Reset the Request ID so that we pick up the next request.
            //
            HTTP_SET_NULL_ID( &requestId );
        }
        else if(result == ERROR_MORE_DATA)
        {
            //
            // The input buffer was too small to hold the request headers
            // We have to allocate more buffer & call the API again.
            //
            // When we call the API again, we want to pick up the request
            // that just failed. This is done by passing a RequestID.
            //
            // This RequestID is picked from the old buffer.
            //
            requestId = pRequest->RequestId;

            //
            // Free the old buffer and allocate a new one.
            //
            RequestBufferLength = bytesRead;
            FREE_MEM( pRequestBuffer );
            pRequestBuffer = ALLOC_MEM( RequestBufferLength );

            if (pRequestBuffer == NULL)
            {
                result = ERROR_NOT_ENOUGH_MEMORY;
                break;
            }

            pRequest = (PHTTP_REQUEST)pRequestBuffer;

        }
        else if(ERROR_CONNECTION_INVALID == result &&
                !HTTP_IS_NULL_ID(&requestId))
        {
            // The TCP connection got torn down by the peer when we were
            // trying to pick up a request with more buffer. We'll just move
            // onto the next request.

            HTTP_SET_NULL_ID( &requestId );
        }
        else
        {
            break;
        }

    } // for(;;)

    if(pRequestBuffer)
    {
        FREE_MEM( pRequestBuffer );
    }

    return result;
}

DWORD SendHttpPostResponse | ( | IN HANDLE | hReqQueue,
 |  | IN PHTTP_REQUEST | pRequest
 | ) |  |

Definition at line 457 of file main.c.

{
    HTTP_RESPONSE   response;
    DWORD           result;
    DWORD           bytesSent;
    PUCHAR          pEntityBuffer;
    ULONG           EntityBufferLength;
    ULONG           BytesRead;
    ULONG           TempFileBytesWritten;
    HANDLE          hTempFile;
    TCHAR           szTempName[MAX_PATH + 1];
#define MAX_ULONG_STR ((ULONG) sizeof("4294967295"))
    CHAR            szContentLength[MAX_ULONG_STR];
    HTTP_DATA_CHUNK dataChunk;
    ULONG           TotalBytesRead = 0;

    BytesRead  = 0;
    hTempFile  = INVALID_HANDLE_VALUE;

    //
    // Allocate some space for an entity buffer. We'll grow this on demand.
    //
    EntityBufferLength = 2048;
    pEntityBuffer      = ALLOC_MEM( EntityBufferLength );

    if (pEntityBuffer == NULL)
    {
        result = ERROR_NOT_ENOUGH_MEMORY;
        wprintf(L"Insufficient resources \n");
        goto Done;
    }

    //
    // Initialize the HTTP response structure.
    //
    INITIALIZE_HTTP_RESPONSE(&response, 200, "OK");

    //
    // For POST, we'll echo back the entity that we got from the client.
    //
    // NOTE: If we had passed the HTTP_RECEIVE_REQUEST_FLAG_COPY_BODY
    //       flag with HttpReceiveHttpRequest(), the entity would have
    //       been a part of HTTP_REQUEST (using the pEntityChunks field).
    //       Since we have not passed that flag, we can be assured that
    //       there are no entity bodies in HTTP_REQUEST.
    //

    if(pRequest->Flags & HTTP_REQUEST_FLAG_MORE_ENTITY_BODY_EXISTS)
    {
        // The entity body is send over multiple calls. Let's collect all
        // of these in a file & send it back. We'll create a temp file
        //

        if(GetTempFileName(
                L".",
                L"New",
                0,
                szTempName
                ) == 0)
        {
            result = GetLastError();
            wprintf(L"GetTempFileName failed with %lu \n", result);
            goto Done;
        }

        hTempFile = CreateFile(
                        szTempName,
                        GENERIC_READ | GENERIC_WRITE,
                        0,                             // don't share.
                        NULL,                          // no security descriptor
                        CREATE_ALWAYS,                 // overrwrite existing
                        FILE_ATTRIBUTE_NORMAL,         // normal file.
                        NULL
                        );

        if(hTempFile == INVALID_HANDLE_VALUE)
        {
            result = GetLastError();
            wprintf(L"Could not create temporary file. Error %lu \n", result);
            goto Done;
        }

        do
        {
            //
            // Read the entity chunk from the request.
            //
            BytesRead = 0;
            result = HttpReceiveRequestEntityBody(
                        hReqQueue,
                        pRequest->RequestId,
                        0,
                        pEntityBuffer,
                        EntityBufferLength,
                        &BytesRead,
                        NULL
                        );

            switch(result)
            {
                case NO_ERROR:

                    if(BytesRead != 0)
                    {
                        TotalBytesRead += BytesRead;
                        WriteFile(
                                hTempFile,
                                pEntityBuffer,
                                BytesRead,
                                &TempFileBytesWritten,
                                NULL
                                );
                    }
                    break;

                case ERROR_HANDLE_EOF:

                    //
                    // We have read the last request entity body. We can send
                    // back a response.
                    //
                    // To illustrate entity sends via
                    // HttpSendResponseEntityBody, we will send the response
                    // over multiple calls. This is achieved by passing the
                    // HTTP_SEND_RESPONSE_FLAG_MORE_DATA flag.

                    if(BytesRead != 0)
                    {
                        TotalBytesRead += BytesRead;
                        WriteFile(
                                hTempFile,
                                pEntityBuffer,
                                BytesRead,
                                &TempFileBytesWritten,
                                NULL
                                );
                    }

                    //
                    // Since we are sending the response over multiple API
                    // calls, we have to add a content-length.
                    //
                    // Alternatively, we could have sent using chunked transfer
                    // encoding, by passing "Transfer-Encoding: Chunked".
                    //

                    // NOTE: Since we are accumulating the TotalBytesRead in
                    //       a ULONG, this will not work for entity bodies that
                    //       are larger than 4 GB. For supporting large entity
                    //       bodies, we would have to use a ULONGLONG.
                    //

                    sprintf(szContentLength, "%lu", TotalBytesRead);

                    ADD_KNOWN_HEADER(
                            response,
                            HttpHeaderContentLength,
                            szContentLength
                            );

                    result =
                        HttpSendHttpResponse(
                               hReqQueue,           // ReqQueueHandle
                               pRequest->RequestId, // Request ID
                               HTTP_SEND_RESPONSE_FLAG_MORE_DATA,
                               &response,           // HTTP response
                               NULL,                // pReserved1
                               &bytesSent,          // bytes sent (optional)
                               NULL,                // pReserved2
                               0,                   // Reserved3
                               NULL,                // LPOVERLAPPED
                               NULL                 // pReserved4
                               );

                    if(result != NO_ERROR)
                    {
                        wprintf(L"HttpSendHttpResponse failed with %lu \n",
                                result);
                        goto Done;
                    }

                    //
                    // Send entity body from a file handle.
                    //
                    dataChunk.DataChunkType =
                        HttpDataChunkFromFileHandle;

                    dataChunk.FromFileHandle.
                        ByteRange.StartingOffset.QuadPart = 0;

                    dataChunk.FromFileHandle.
                        ByteRange.Length.QuadPart = HTTP_BYTE_RANGE_TO_EOF;

                    dataChunk.FromFileHandle.FileHandle = hTempFile;

                    result = HttpSendResponseEntityBody(
                                hReqQueue,
                                pRequest->RequestId,
                                0,                    // This is the last send.
                                1,                    // Entity Chunk Count.
                                &dataChunk,
                                NULL,
                                NULL,
                                0,
                                NULL,
                                NULL
                                );

                    if(result != NO_ERROR)
                    {
                        wprintf(
                           L"HttpSendResponseEntityBody failed with %lu \n",
                           result
                           );
                    }

                    goto Done;

                    break;

                default:
                    wprintf(L"HttpReceiveRequestEntityBody failed with %lu \n",
                            result);
                    goto Done;
            }

        } while(TRUE);
    }
    else
    {
        // This request does not have any entity body.
        //

        result = HttpSendHttpResponse(
                   hReqQueue,           // ReqQueueHandle
                   pRequest->RequestId, // Request ID
                   0,
                   &response,           // HTTP response
                   NULL,                // pReserved1
                   &bytesSent,          // bytes sent (optional)
                   NULL,                // pReserved2
                   0,                   // Reserved3
                   NULL,                // LPOVERLAPPED
                   NULL                 // pReserved4
                   );
        if(result != NO_ERROR)
        {
            wprintf(L"HttpSendHttpResponse failed with %lu \n", result);
        }
    }

Done:

    if(pEntityBuffer)
    {
        FREE_MEM(pEntityBuffer);
    }

    if(INVALID_HANDLE_VALUE != hTempFile)
    {
        CloseHandle(hTempFile);
        DeleteFile(szTempName);
    }

    return result;
}

DWORD SendHttpResponse | ( | IN HANDLE | hReqQueue,
 |  | IN PHTTP_REQUEST | pRequest,
 |  | IN USHORT | StatusCode,
 |  | IN PSTR | pReason,
 |  | IN PSTR | pEntity
 | ) |  |

Definition at line 381 of file main.c.

{
    HTTP_RESPONSE   response;
    HTTP_DATA_CHUNK dataChunk;
    DWORD           result;
    DWORD           bytesSent;

    //
    // Initialize the HTTP response structure.
    //
    INITIALIZE_HTTP_RESPONSE(&response, StatusCode, pReason);

    //
    // Add a known header.
    //
    ADD_KNOWN_HEADER(response, HttpHeaderContentType, "text/html");

    if(pEntityString)
    {
        //
        // Add an entity chunk
        //
        dataChunk.DataChunkType           = HttpDataChunkFromMemory;
        dataChunk.FromMemory.pBuffer      = pEntityString;
        dataChunk.FromMemory.BufferLength = (ULONG) strlen(pEntityString);

        response.EntityChunkCount         = 1;
        response.pEntityChunks            = &dataChunk;
    }

    //
    // Since we are sending all the entity body in one call, we don't have
    // to specify the Content-Length.
    //

    result = HttpSendHttpResponse(
                    hReqQueue,           // ReqQueueHandle
                    pRequest->RequestId, // Request ID
                    0,                   // Flags
                    &response,           // HTTP response
                    NULL,                // pReserved1
                    &bytesSent,          // bytes sent   (OPTIONAL)
                    NULL,                // pReserved2   (must be NULL)
                    0,                   // Reserved3    (must be 0)
                    NULL,                // LPOVERLAPPED (OPTIONAL)
                    NULL                 // pReserved4   (must be NULL)
                    );

    if(result != NO_ERROR)
    {
        wprintf(L"HttpSendHttpResponse failed with %lu \n", result);
    }

    return result;
}

int __cdecl wmain | ( | int | argc,
 |  | wchar_t * | argv[]
 | ) |  |

Definition at line 76 of file main.c.

{
    ULONG           retCode;
    int             i;
    HANDLE          hReqQueue      = NULL;
    int             UrlAdded       = 0;
    HTTPAPI_VERSION HttpApiVersion = HTTPAPI_VERSION_1;

    if (argc < 2)
    {
        wprintf(L"%ws: <Url1> [Url2] ... \n", argv[0]);
        return -1;
    }

    //
    // Initialize HTTP APIs.
    //
    retCode = HttpInitialize(
                HttpApiVersion,
                HTTP_INITIALIZE_SERVER,    // Flags
                NULL                       // Reserved
                );

    if (retCode != NO_ERROR)
    {
        wprintf(L"HttpInitialize failed with %lu \n", retCode);
        return retCode;
    }

    //
    // Create a Request Queue Handle
    //
    retCode = HttpCreateHttpHandle(
                &hReqQueue,        // Req Queue
                0                  // Reserved
                );

    if (retCode != NO_ERROR)
    {
        wprintf(L"HttpCreateHttpHandle failed with %lu \n", retCode);
        goto CleanUp;
    }

    //
    // The command line arguments represent URIs that we want to listen on.
    // We will call HttpAddUrl for each of these URIs.
    //
    // The URI is a fully qualified URI and MUST include the terminating '/'
    //
    for (i = 1; i < argc; i++)
    {
        wprintf(
          L"we are listening for requests on the following url: %s\n",
          argv[i]);

        retCode = HttpAddUrl(
                    hReqQueue,    // Req Queue
                    argv[i],      // Fully qualified URL
                    NULL          // Reserved
                    );

        if (retCode != NO_ERROR)
        {
            wprintf(L"HttpAddUrl failed with %lu \n", retCode);
            goto CleanUp;
        }
        else
        {
            //
            // Keep track of the URLs that we've currently added.
            //
            UrlAdded ++;
        }
    }

    // Loop while receiving requests
    for(;;)
    {
        retCode = DoReceiveRequests(hReqQueue);

        if(NO_ERROR == retCode)
        {
            wprintf(
                L"DoReceiveRequests failed with %lu \n",
                retCode
                );

            break;
        }

    } // CTRL C to break out of loop

CleanUp:

    //
    // Call HttpRemoveUrl for all the URLs that we added.
    //
    for(i=1; i<=UrlAdded; i++)
    {
        HttpRemoveUrl(
              hReqQueue,     // Req Queue
              argv[i]        // Fully qualified URL
              );
    }

    //
    // Close the Request Queue handle.
    //
    if(hReqQueue)
    {
        CloseHandle(hReqQueue);
    }

    //
    // Call HttpTerminate.
    //
    HttpTerminate(HTTP_INITIALIZE_SERVER, NULL);

    return retCode;
}

Generated on Wed Nov 13 2024 16:53:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/http/server/precomp.h File Reference

  • NetDS
  • http
  • server

precomp.h File Reference

#include <windows.h>
#include <stdio.h>
#include "http.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/http/serviceconfig/iplisten.c File Reference

  • NetDS
  • http
  • serviceconfig
Functions

iplisten.c File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

int | DoIpDelete (IN PWSTR pIp)
int | DoIpListen (int argc, WCHAR **argv, HTTPCFG_TYPE Type)
int | DoIpQuery ()
int | DoIpSet (IN PWSTR pIp)
void | PrintIpListenRecords (IN PUCHAR pOutput)

Function Documentation

int DoIpDelete ( IN PWSTR pIp )

Definition at line 229 of file iplisten.c.

{
    HTTP_SERVICE_CONFIG_IP_LISTEN_PARAM SetParam;
    DWORD                               Status;
    SOCKADDR_STORAGE                    TempSockAddr;

    if((Status = GetAddress(pIp,
                            &TempSockAddr,
                            sizeof(TempSockAddr)
                            )) != NO_ERROR)
    {
        NlsPutMsg(HTTPCFG_INVALID_IP, pIp);
        return Status;
    }

    SetParam.AddrLength = sizeof(TempSockAddr);
    SetParam.pAddress   = (LPSOCKADDR) &TempSockAddr;

    Status = HttpDeleteServiceConfiguration(
                NULL,
                HttpServiceConfigIPListenList,
                (PVOID)&SetParam,
                sizeof(SetParam),
                NULL
                );

    NlsPutMsg(HTTPCFG_DELETESERVICE_STATUS, Status);
    return Status;
}

int DoIpListen | ( | int | argc,
 |  | WCHAR ** | argv,
 |  | HTTPCFG_TYPE | Type
 | ) |  |

Definition at line 265 of file iplisten.c.

{
    PWCHAR   pIp = NULL;

    while(argc>=2 && (argv[0][0] == '-' || argv[0][0]== '/'))
    {
        switch(toupper(argv[0][1]))
        {
            case 'I':
                pIp = argv[1];
                break;

            default:
                NlsPutMsg(HTTPCFG_INVALID_SWITCH, argv[0]);
                return ERROR_INVALID_PARAMETER;
        }
        argc -=2;
        argv +=2;
    }

    switch(Type)
    {
        case HttpCfgTypeSet:
            return DoIpSet(pIp);

        case HttpCfgTypeQuery:
            return DoIpQuery();

        case HttpCfgTypeDelete:
            return DoIpDelete(pIp);

        default:
            NlsPutMsg(HTTPCFG_INVALID_SWITCH, argv[0]);
            return ERROR_INVALID_PARAMETER;
    }
}

int DoIpQuery ( )

Definition at line 160 of file iplisten.c.

{
    DWORD    Status;
    PUCHAR   pOutput = NULL;
    DWORD    OutputLength = 0;
    DWORD    ReturnLength = 0;

    for(;;)
    {
        // First get the size of the output buffer that is required.
        //
        Status = HttpQueryServiceConfiguration(
                    NULL,
                    HttpServiceConfigIPListenList,
                    NULL,
                    0,
                    pOutput,
                    OutputLength,
                    &ReturnLength,
                    NULL
                    );

        if(ERROR_INSUFFICIENT_BUFFER == Status)
        {
            // If the API completes with ERROR_INSUFFICIENT_BUFFER, we'll
            // allocate memory for it & continue with the loop where we'll
            // call it again.

            if(pOutput)
            {
                // If there was an existing buffer, free it.
                LocalFree(pOutput);
            }

            //
            // Allocate a new buffer.
            //
            pOutput = LocalAlloc(LMEM_FIXED, ReturnLength);
            if(!pOutput)
            {
                return ERROR_NOT_ENOUGH_MEMORY;
            }

            OutputLength = ReturnLength;
        }
        else if(NO_ERROR == Status)
        {
            PrintIpListenRecords(pOutput);
            break;
        }
        else
        {
            //
            // Some other error, so we are done
            //
            NlsPutMsg(HTTPCFG_QUERYSERVICE_STATUS, Status);
            break;
        }
    }

    if(pOutput)
    {
        LocalFree(pOutput);
    }

    return Status;
}

int DoIpSet ( IN PWSTR pIp )

Definition at line 113 of file iplisten.c.

{
    HTTP_SERVICE_CONFIG_IP_LISTEN_PARAM SetParam;
    DWORD                               Status;
    SOCKADDR_STORAGE                    TempSockAddr;

    // convert IP to a SOCKADDR.
    if((Status = GetAddress(pIp,
                            &TempSockAddr,
                            sizeof(TempSockAddr)
                            )) != NO_ERROR)
    {
        NlsPutMsg(HTTPCFG_INVALID_IP, pIp);
        return Status;
    }

    SetParam.AddrLength = sizeof(TempSockAddr);
    SetParam.pAddress   = (LPSOCKADDR)&TempSockAddr;

    // Call the API
    Status = HttpSetServiceConfiguration(
                NULL,
                HttpServiceConfigIPListenList,
                (PVOID)&SetParam,
                sizeof(SetParam),
                NULL
                );

    NlsPutMsg(HTTPCFG_SETSERVICE_STATUS, Status);

    return Status;
}

void PrintIpListenRecords ( IN PUCHAR pOutput )

Definition at line 33 of file iplisten.c.

{
    PHTTP_SERVICE_CONFIG_IP_LISTEN_QUERY pListenQuery;
    ULONG                                i;
    DWORD                                Status = NO_ERROR;

    pListenQuery = (PHTTP_SERVICE_CONFIG_IP_LISTEN_QUERY) pOutput;

    for(i=0; i<pListenQuery->AddrCount; i++)
    {
        DWORD        dwSockAddrLength;
        WCHAR        IpAddr[MAX_PATH];
        DWORD        dwIpAddrLen;
        PSOCKADDR_IN pSockAddrIn;

        dwIpAddrLen = MAX_PATH * sizeof(WCHAR);

        pSockAddrIn = (PSOCKADDR_IN)
                    &pListenQuery->AddrList[i];

        // Convert address to string.
        //

        if(pSockAddrIn->sin_family == AF_INET)
        {
            dwSockAddrLength = sizeof(SOCKADDR_IN);
        }
        else if(pSockAddrIn->sin_family == AF_INET6)
        {
            dwSockAddrLength = sizeof(SOCKADDR_IN6);
        }
        else
        {
            Status = ERROR_REGISTRY_CORRUPT;
            break;
        }

        Status = WSAAddressToString(
                            (LPSOCKADDR)&pListenQuery->AddrList[i],
                            dwSockAddrLength,
                            NULL,
                            (LPWSTR) IpAddr,
                            &dwIpAddrLen
                            );

        if(SOCKET_ERROR == Status)
        {
            Status = WSAGetLastError();
            break;
        }
        else
        {
            NlsPutMsg(
                    HTTPCFG_SSL_IP,
                    IpAddr
                    );

            NlsPutMsg(
                    HTTPCFG_RECORD_SEPARATOR
                    );
        }
    }

    return;
}

Generated on Wed Nov 13 2024 16:53:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/http/serviceconfig/main.c File Reference

  • NetDS
  • http
  • serviceconfig
Functions

main.c File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

DWORD | GetAddress (PWCHAR pIp, PVOID pBuffer, ULONG Length)
UINT | NlsPutMsg (IN UINT MsgNumber, IN...)
int _cdecl | wmain (int argc, LPWSTR argv[])

Function Documentation

DWORD GetAddress | ( | PWCHAR | pIp,
 |  | PVOID | pBuffer,
 |  | ULONG | Length
 | ) |  |

Definition at line 194 of file main.c.

{
    DWORD Status;
    DWORD TempStatus;

    if(pIp == NULL)
    {
        return ERROR_INVALID_PARAMETER;
    }

    //
    // The address could be a v4 or a v6 address. First, let's try v4.
    //

    Status = WSAStringToAddress(
                pIp,
                AF_INET,
                NULL,
                pBuffer,
                (LPINT)&Length
                );

    if(Status != NO_ERROR)
    {
        //
        // Now, try v6
        //

        Status = WSAGetLastError();

        TempStatus = WSAStringToAddress(
                        pIp,
                        AF_INET6,
                        NULL,
                        pBuffer,
                        (LPINT)&Length
                        );

        //
        // If IPv6 also fails, then we want to return the original
        // error.
        //
        // If it succeeds, we want to return NO_ERROR.
        //

        if(TempStatus == NO_ERROR)
        {
            Status = NO_ERROR;
        }
    }

    return Status;
}

UINT NlsPutMsg | ( | IN UINT | MsgNumber,
 |  | IN... |
 | ) |  |

Definition at line 145 of file main.c.

{
    UINT    msglen;
    VOID    *vp;
    va_list arglist;

    va_start(arglist, MsgNumber);

    msglen = FormatMessage(
                FORMAT_MESSAGE_FROM_HMODULE |
                FORMAT_MESSAGE_ALLOCATE_BUFFER,   // dwFlags.
                NULL,                             // lpSource.
                MsgNumber,                        // dwMessageId.
                0L,                               // dwLanguageId (default)
                (LPWSTR)&vp,
                0,
                &arglist
                );

    if(!msglen)
    {
        return 0;
    }

    wprintf(L"%ws", vp);

    LocalFree(vp);

    return msglen;
}

int _cdecl wmain | ( | int | argc,
 |  | LPWSTR | argv[]
 | ) |  |

Definition at line 29 of file main.c.

{
    DWORD           Status = NO_ERROR;
    HTTPCFG_TYPE    Type;
    HTTPAPI_VERSION HttpApiVersion = HTTPAPI_VERSION_1;
    WORD            wVersionRequested;
    WSADATA         wsaData;

    // Parse command line parameters.

    if(argc < 3)
    {
        NlsPutMsg(HTTPCFG_USAGE, argv[0]);
        return 0;
    }

    argv++; argc --;

    //
    // First parse the type of operation.
    //

    if(_wcsicmp(argv[0], L"set") == 0)
    {
        Type = HttpCfgTypeSet;
    }
    else if(_wcsicmp(argv[0], L"query") == 0)
    {
        Type = HttpCfgTypeQuery;
    }
    else if(_wcsicmp(argv[0], L"delete") == 0)
    {
        Type = HttpCfgTypeDelete;
    }
    else if(_wcsicmp(argv[0], L"?") == 0)
    {
        NlsPutMsg(HTTPCFG_USAGE, argv[0]);
        return 0;
    }
    else
    {
        NlsPutMsg(HTTPCFG_INVALID_SWITCH, argv[0]);
        return ERROR_INVALID_PARAMETER;
    }
    argv++; argc--;

    //
    // Call HttpInitialize.
    //

    if((Status = HttpInitialize(
                    HttpApiVersion,
                    HTTP_INITIALIZE_CONFIG,
                    NULL)) != NO_ERROR)
    {
        NlsPutMsg(HTTPCFG_HTTPINITIALIZE, Status);
        return Status;
    }

    //
    // Call WSAStartup as we are using some winsock functions.
    //
    wVersionRequested = MAKEWORD( 2, 2 );

    if(WSAStartup( wVersionRequested, &wsaData ) != 0)
    {
        HttpTerminate(HTTP_INITIALIZE_CONFIG, NULL);
        return GetLastError();
    }

    //
    // Call the corresponding API.
    //

    if(_wcsicmp(argv[0], L"ssl") == 0)
    {
        argv++; argc--;
        Status = DoSsl(argc, argv, Type);
    }
    else if(_wcsicmp(argv[0], L"urlacl") == 0)
    {
        argv++; argc--;
        Status = DoUrlAcl(argc, argv, Type);
    }
    else if(_wcsicmp(argv[0], L"iplisten") == 0)
    {
        argv++; argc--;
        Status = DoIpListen(argc, argv, Type);
    }
    else
    {
        NlsPutMsg(HTTPCFG_INVALID_SWITCH, argv[0]);
        Status = ERROR_INVALID_PARAMETER;
    }

    WSACleanup();
    HttpTerminate(HTTP_INITIALIZE_CONFIG, NULL);

    return Status;
}

Generated on Wed Nov 13 2024 16:53:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/http/serviceconfig/makefile.inc File Reference

  • NetDS
  • http
  • serviceconfig

makefile.inc File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/http/serviceconfig/precomp.h File Reference

  • NetDS
  • http
  • serviceconfig
Defines | Typedefs | Enumerations | Functions

precomp.h File Reference

#include <nt.h>
#include <ntrtl.h>
#include <nturtl.h>
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <io.h>
#include <winsock2.h>
#include <ws2tcpip.h>
#include <ntddip6.h>
#include <objbase.h>
#include <wtypes.h>
#include "http.h"
#include "nlstxt.h"

Go to the source code of this file.

Defines

#define | NOGDI
#define | NOMINMAX

Typedefs

typedef enum _HTTPCFG_TYPE | HTTPCFG_TYPE
typedef enum _HTTPCFG_TYPE * | PHTTPCFG_TYPE

Enumerations

enum | _HTTPCFG_TYPE { HttpCfgTypeSet, HttpCfgTypeQuery, HttpCfgTypeDelete, HttpCfgTypeMax }

Functions

int | DoIpListen (int argc, WCHAR **argv, HTTPCFG_TYPE Type)
int | DoSsl (int argc, WCHAR **argv, HTTPCFG_TYPE Type)
int | DoUrlAcl (int argc, WCHAR **argv, HTTPCFG_TYPE Type)
DWORD | GetAddress (PWCHAR pIp, PVOID pBuffer, ULONG Length)
UINT | NlsPutMsg (IN UINT MsgNumber, IN...)

Define Documentation

#define NOGDI

Definition at line 19 of file precomp.h.

#define NOMINMAX

Definition at line 20 of file precomp.h.

Typedef Documentation

typedef enum _HTTPCFG_TYPE HTTPCFG_TYPE
typedef enum _HTTPCFG_TYPE * PHTTPCFG_TYPE

Enumeration Type Documentation

enum _HTTPCFG_TYPE
Enumerator:
HttpCfgTypeSet
HttpCfgTypeQuery
HttpCfgTypeDelete
HttpCfgTypeMax

Definition at line 36 of file precomp.h.

{
    HttpCfgTypeSet,
    HttpCfgTypeQuery,
    HttpCfgTypeDelete,
    HttpCfgTypeMax

} HTTPCFG_TYPE, *PHTTPCFG_TYPE;

Function Documentation

int DoIpListen | ( | int | argc,
 |  | WCHAR ** | argv,
 |  | HTTPCFG_TYPE | Type
 | ) |  |

Definition at line 265 of file iplisten.c.

{
    PWCHAR   pIp = NULL;

    while(argc>=2 && (argv[0][0] == '-' || argv[0][0]== '/'))
    {
        switch(toupper(argv[0][1]))
        {
            case 'I':
                pIp = argv[1];
                break;

            default:
                NlsPutMsg(HTTPCFG_INVALID_SWITCH, argv[0]);
                return ERROR_INVALID_PARAMETER;
        }
        argc -=2;
        argv +=2;
    }

    switch(Type)
    {
        case HttpCfgTypeSet:
            return DoIpSet(pIp);

        case HttpCfgTypeQuery:
            return DoIpQuery();

        case HttpCfgTypeDelete:
            return DoIpDelete(pIp);

        default:
            NlsPutMsg(HTTPCFG_INVALID_SWITCH, argv[0]);
            return ERROR_INVALID_PARAMETER;
    }
}

int DoSsl | ( | int | argc,
 |  | WCHAR ** | argv,
 |  | HTTPCFG_TYPE | Type
 | ) |  |

Definition at line 498 of file ssl.c.

{
    PWCHAR   pGuid             = NULL;
    PWCHAR   pHash             = NULL;
    PWCHAR   pCertStoreName    = NULL;
    PWCHAR   pCtlIdentifier    = NULL;
    PWCHAR   pCtlStoreName     = NULL;
    DWORD    CertCheckMode     = 0;
    DWORD    Freshness         = 0;
    DWORD    Timeout           = 0;
    DWORD    Flags             = 0;
    PWCHAR   pIp               = NULL;

    while(argc >= 2 && (argv[0][0] == L'-' || argv[0][0] == L'/'))
    {
        switch(toupper(argv[0][1]))
        {
            case 'I':
                pIp = argv[1];
                break;

            case 'C':
                pCertStoreName = argv[1];
                break;

            case 'N':
                pCtlStoreName = argv[1];
                break;

            case 'T':
                pCtlIdentifier = argv[1];
                break;

            case 'M':
                CertCheckMode = _wtoi(argv[1]);
                break;

            case 'R':
                Freshness = _wtoi(argv[1]);
                break;

            case 'X':
                Timeout = _wtoi(argv[1]);
                break;

            case 'F':
                Flags = _wtoi(argv[1]);
                break;

            case 'G':
                pGuid = argv[1];
                break;

            case 'H':
                pHash = argv[1];
                break;

            default:
                NlsPutMsg(HTTPCFG_INVALID_SWITCH, argv[0]);
                return ERROR_INVALID_PARAMETER;
        }

        argc -=2;
        argv +=2;
    }

    switch(type)
    {
        case HttpCfgTypeSet:
            return DoSslSet(
                        pIp,
                        pGuid,
                        pHash,
                        CertCheckMode,
                        Freshness,
                        Timeout,
                        Flags,
                        pCtlIdentifier,
                        pCtlStoreName,
                        pCertStoreName
                        );

        case HttpCfgTypeQuery:
            return DoSslQuery(pIp);

        case HttpCfgTypeDelete:
            return DoSslDelete(pIp);

        default:
            NlsPutMsg(HTTPCFG_INVALID_SWITCH, argv[0]);
            return ERROR_INVALID_PARAMETER;
            break;
    }
}

int DoUrlAcl | ( | int | argc,
 |  | WCHAR ** | argv,
 |  | HTTPCFG_TYPE | Type
 | ) |  |

Definition at line 279 of file url.c.

{
    PWCHAR   pUrl             = NULL;
    PWCHAR   pAcl             = NULL;

    while(argc>=2 && (argv[0][0] == '-' || argv[0][0]== '/'))
    {
        switch(toupper(argv[0][1]))
        {
            case 'U':
                pUrl = argv[1];
                break;

            case 'A':
                pAcl = argv[1];
                break;

            default:
                NlsPutMsg(HTTPCFG_INVALID_SWITCH, argv[0]);
                return ERROR_INVALID_PARAMETER;
        }

        argc -=2;
        argv +=2;
    }

    switch(Type)
    {
        case HttpCfgTypeSet:
            return DoUrlAclSet(pUrl, pAcl);

        case HttpCfgTypeQuery:
            return DoUrlAclQuery(pUrl);

        case HttpCfgTypeDelete:
            return DoUrlAclDelete(pUrl);

        default:
            NlsPutMsg(HTTPCFG_INVALID_SWITCH, argv[0]);
            return ERROR_INVALID_PARAMETER;
    }
}

DWORD GetAddress | ( | PWCHAR | pIp,
 |  | PVOID | pBuffer,
 |  | ULONG | Length
 | ) |  |

Definition at line 194 of file main.c.

{
    DWORD Status;
    DWORD TempStatus;

    if(pIp == NULL)
    {
        return ERROR_INVALID_PARAMETER;
    }

    //
    // The address could be a v4 or a v6 address. First, let's try v4.
    //

    Status = WSAStringToAddress(
                pIp,
                AF_INET,
                NULL,
                pBuffer,
                (LPINT)&Length
                );

    if(Status != NO_ERROR)
    {
        //
        // Now, try v6
        //

        Status = WSAGetLastError();

        TempStatus = WSAStringToAddress(
                        pIp,
                        AF_INET6,
                        NULL,
                        pBuffer,
                        (LPINT)&Length
                        );

        //
        // If IPv6 also fails, then we want to return the original
        // error.
        //
        // If it succeeds, we want to return NO_ERROR.
        //

        if(TempStatus == NO_ERROR)
        {
            Status = NO_ERROR;
        }
    }

    return Status;
}

UINT NlsPutMsg | ( | IN UINT | MsgNumber,
 |  | IN... |
 | ) |  |

Definition at line 145 of file main.c.

{
    UINT    msglen;
    VOID    *vp;
    va_list arglist;

    va_start(arglist, MsgNumber);

    msglen = FormatMessage(
                FORMAT_MESSAGE_FROM_HMODULE |
                FORMAT_MESSAGE_ALLOCATE_BUFFER,   // dwFlags.
                NULL,                             // lpSource.
                MsgNumber,                        // dwMessageId.
                0L,                               // dwLanguageId (default)
                (LPWSTR)&vp,
                0,
                &arglist
                );

    if(!msglen)
    {
        return 0;
    }

    wprintf(L"%ws", vp);

    LocalFree(vp);

    return msglen;
}

Generated on Wed Nov 13 2024 16:53:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/http/serviceconfig/ssl.c File Reference

  • NetDS
  • http
  • serviceconfig
Defines | Functions

ssl.c File Reference

#include "precomp.h"

Go to the source code of this file.

Defines

#define | CONVERT_WCHAR(ch, n)
#define | MAX_HASH 20

Functions

int | DoSsl (int argc, WCHAR **argv, HTTPCFG_TYPE type)
int | DoSslDelete (IN PWCHAR pIp)
int | DoSslQuery (IN PWCHAR pIp)
int | DoSslSet (IN PWCHAR pIp, IN PWCHAR pGuid, IN PWCHAR pHash, IN DWORD CertCheckMode, IN DWORD Freshness, IN DWORD Timeout, IN DWORD Flags, IN PWCHAR pCtlIdentifier, IN PWCHAR pCtlStoreName, IN PWCHAR pCertStoreName)
void | PrintSslRecord (IN PUCHAR pOutput)

Define Documentation

#define CONVERT_WCHAR | ( | ch,
 |  | n
 | ) |
Value:
if(iswdigit((ch)))                                                  \
    {                                                                   \
        (n) = (UCHAR)((ch) - L'0');                                     \
    }                                                                   \
    else if(iswxdigit((ch)))                                            \
    {                                                                   \
        (n) = (UCHAR) ((ch) + 10 - (iswlower((ch))?L'a':L'A'));         \
    }                                                                   \
    else                                                                \
    {                                                                   \
        NlsPutMsg(HTTPCFG_INVALID_HASH, pHash);                         \
        return ERROR_INVALID_PARAMETER;                                 \
    }

Definition at line 21 of file ssl.c.

#define MAX_HASH 20

Definition at line 19 of file ssl.c.

Function Documentation

int DoSsl | ( | int | argc,
 |  | WCHAR ** | argv,
 |  | HTTPCFG_TYPE | type
 | ) |  |

Definition at line 498 of file ssl.c.

{
    PWCHAR   pGuid             = NULL;
    PWCHAR   pHash             = NULL;
    PWCHAR   pCertStoreName    = NULL;
    PWCHAR   pCtlIdentifier    = NULL;
    PWCHAR   pCtlStoreName     = NULL;
    DWORD    CertCheckMode     = 0;
    DWORD    Freshness         = 0;
    DWORD    Timeout           = 0;
    DWORD    Flags             = 0;
    PWCHAR   pIp               = NULL;

    while(argc >= 2 && (argv[0][0] == L'-' || argv[0][0] == L'/'))
    {
        switch(toupper(argv[0][1]))
        {
            case 'I':
                pIp = argv[1];
                break;

            case 'C':
                pCertStoreName = argv[1];
                break;

            case 'N':
                pCtlStoreName = argv[1];
                break;

            case 'T':
                pCtlIdentifier = argv[1];
                break;

            case 'M':
                CertCheckMode = _wtoi(argv[1]);
                break;

            case 'R':
                Freshness = _wtoi(argv[1]);
                break;

            case 'X':
                Timeout = _wtoi(argv[1]);
                break;

            case 'F':
                Flags = _wtoi(argv[1]);
                break;

            case 'G':
                pGuid = argv[1];
                break;

            case 'H':
                pHash = argv[1];
                break;

            default:
                NlsPutMsg(HTTPCFG_INVALID_SWITCH, argv[0]);
                return ERROR_INVALID_PARAMETER;
        }

        argc -=2;
        argv +=2;
    }

    switch(type)
    {
        case HttpCfgTypeSet:
            return DoSslSet(
                        pIp,
                        pGuid,
                        pHash,
                        CertCheckMode,
                        Freshness,
                        Timeout,
                        Flags,
                        pCtlIdentifier,
                        pCtlStoreName,
                        pCertStoreName
                        );

        case HttpCfgTypeQuery:
            return DoSslQuery(pIp);

        case HttpCfgTypeDelete:
            return DoSslDelete(pIp);

        default:
            NlsPutMsg(HTTPCFG_INVALID_SWITCH, argv[0]);
            return ERROR_INVALID_PARAMETER;
            break;
    }
}

int DoSslDelete ( IN PWCHAR pIp )

Definition at line 444 of file ssl.c.

{
    HTTP_SERVICE_CONFIG_SSL_SET SetParam;
    DWORD                       Status;
    SOCKADDR_STORAGE            TempSockAddr;

    SetParam.KeyDesc.pIpPort = (LPSOCKADDR)&TempSockAddr;

    // Convert string IP address to a SOCKADDR structure
    Status = GetAddress(pIp,
                        SetParam.KeyDesc.pIpPort,
                        sizeof(TempSockAddr)
                        );

    if(Status != NO_ERROR)
    {
        NlsPutMsg(HTTPCFG_INVALID_IP, pIp);
        return Status;
    }

    // Call the API.
    Status = HttpDeleteServiceConfiguration(
                NULL,
                HttpServiceConfigSSLCertInfo,
                &SetParam,
                sizeof(SetParam),
                NULL
                );

    NlsPutMsg(HTTPCFG_DELETESERVICE_STATUS, Status);
    return Status;
}

int DoSslQuery ( IN PWCHAR pIp )

Definition at line 304 of file ssl.c.

{
    DWORD                          Status;
    PUCHAR                         pOutput = NULL;
    DWORD                          OutputLength = 0;
    DWORD                          ReturnLength = 0;
    HTTP_SERVICE_CONFIG_SSL_QUERY  QueryParam;
    SOCKADDR_STORAGE               TempSockAddr;

    ZeroMemory(&QueryParam, sizeof(QueryParam));

    if(pIp)
    {
        // if an IP address is specified, we'll covert it to a SOCKADDR
        // and do an exact query.

        QueryParam.QueryDesc = HttpServiceConfigQueryExact;
        QueryParam.KeyDesc.pIpPort = (LPSOCKADDR)&TempSockAddr;

        if((Status = GetAddress(pIp,
                                QueryParam.KeyDesc.pIpPort,
                                sizeof(TempSockAddr)
                                )) != NO_ERROR)
        {
            NlsPutMsg(HTTPCFG_INVALID_IP, pIp);
            return Status;
        }
    }
    else
    {
        // We are enumerating all the records in the SSL store.
        QueryParam.QueryDesc = HttpServiceConfigQueryNext;
    }

    for(;;)
    {
        //
        // First, compute the bytes required to enumerate an entry.
        //
        Status = HttpQueryServiceConfiguration(
                    NULL,
                    HttpServiceConfigSSLCertInfo,
                    &QueryParam,
                    sizeof(QueryParam),
                    pOutput,
                    OutputLength,
                    &ReturnLength,
                    NULL
                    );

        if(Status == ERROR_INSUFFICIENT_BUFFER)
        {
            // If the API completes with ERROR_INSUFFICIENT_BUFFER, we'll
            // allocate memory for it & continue with the loop where we'll
            // call it again.

            if(pOutput)
            {
                // If there was an existing buffer, free it.
                LocalFree(pOutput);
            }

            // Allocate a new buffer

            pOutput = LocalAlloc(LMEM_FIXED, ReturnLength);
            if(!pOutput)
            {
                return ERROR_NOT_ENOUGH_MEMORY;
            }

            OutputLength = ReturnLength;
        }
        else if(Status == NO_ERROR)
        {
            // The query succeeded! We'll print the record that we just
            // queried.
            //
            PrintSslRecord(pOutput);

            if(pIp != NULL)
            {
                //
                // If we are not enumerating, we are done.
                //
                break;
            }
            else
            {
                //
                // Since we are enumerating, we'll move on to the next
                // record. This is done by incrementing the cursor, till
                // we get ERROR_NO_MORE_ITEMS.
                //
                QueryParam.dwToken ++;
            }
        }
        else if(ERROR_NO_MORE_ITEMS == Status && !pIp)
        {
            // We are enumerating and we have reached the end. This is
            // indicated by a ERROR_NO_MORE_ITEMS error code.

            // This is not a real error, since it is used to indicate that
            // we've finished enumeration.

            Status = NO_ERROR;
            break;
        }
        else
        {
            //
            // Some other error, so we are done
            //
            NlsPutMsg(HTTPCFG_QUERYSERVICE_STATUS, Status);
            break;
        }
    }

    if(pOutput)
    {
        LocalFree(pOutput);
    }

    return Status;
}

int DoSslSet | ( | IN PWCHAR | pIp,
 |  | IN PWCHAR | pGuid,
 |  | IN PWCHAR | pHash,
 |  | IN DWORD | CertCheckMode,
 |  | IN DWORD | Freshness,
 |  | IN DWORD | Timeout,
 |  | IN DWORD | Flags,
 |  | IN PWCHAR | pCtlIdentifier,
 |  | IN PWCHAR | pCtlStoreName,
 |  | IN PWCHAR | pCertStoreName
 | ) |  |

Definition at line 187 of file ssl.c.

{
    HTTP_SERVICE_CONFIG_SSL_SET SetParam;
    UNICODE_STRING              GuidString;
    DWORD                       Status;
    SOCKADDR_STORAGE            TempSockAddr;
    USHORT                      HashLength;
    UCHAR                       BinaryHash[MAX_HASH];
    DWORD                       i, j;
    UCHAR                       n1, n2;

    ZeroMemory(&SetParam, sizeof(SetParam));

    SetParam.KeyDesc.pIpPort = (LPSOCKADDR)&TempSockAddr;

    //
    // Convert the string based IP into a SOCKADDR
    //
    if((Status = GetAddress(pIp,
                            SetParam.KeyDesc.pIpPort,
                            sizeof(TempSockAddr)
                            )) != NO_ERROR)
    {
        NlsPutMsg(HTTPCFG_INVALID_IP, pIp);
        return Status;
    }

    //
    // Convert the string to a GUID.
    //
    if(pGuid)
    {
        GuidString.Length        = (USHORT)wcslen(pGuid) * sizeof(WCHAR);
        GuidString.MaximumLength = (USHORT)GuidString.Length+1;
        GuidString.Buffer        = pGuid;
        Status = RtlGUIDFromString(&GuidString, &SetParam.ParamDesc.AppId);

        if(Status != NO_ERROR)
        {
            NlsPutMsg(HTTPCFG_INVALID_GUID, pGuid);
            return Status;
        }
    }

    if(pHash)
    {
        HashLength = (USHORT) wcslen(pHash);

        for(i=0, j=0; i<MAX_HASH && HashLength >= 2; )
        {
            CONVERT_WCHAR(pHash[j], n1);
            CONVERT_WCHAR(pHash[j+1], n2);

            BinaryHash[i] = ((n1<<4) & 0xF0) | (n2 & 0x0F);

            // We've consumed 2 WCHARs
            HashLength -= 2;
            j += 2;

            // and used up one byte in BinaryHash
            i ++;
        }

        if(HashLength != 0 || i != MAX_HASH)
        {
            NlsPutMsg(HTTPCFG_INVALID_HASH, pHash);
            return ERROR_INVALID_PARAMETER;
        }

        SetParam.ParamDesc.SslHashLength = i;
        SetParam.ParamDesc.pSslHash      = BinaryHash;
    }

    SetParam.ParamDesc.pSslCertStoreName                    = pCertStoreName;
    SetParam.ParamDesc.pDefaultSslCtlIdentifier             = pCtlIdentifier;
    SetParam.ParamDesc.pDefaultSslCtlStoreName              = pCtlStoreName;
    SetParam.ParamDesc.DefaultCertCheckMode                 = CertCheckMode;
    SetParam.ParamDesc.DefaultRevocationFreshnessTime       = Freshness;
    SetParam.ParamDesc.DefaultRevocationUrlRetrievalTimeout = Timeout;
    SetParam.ParamDesc.DefaultFlags                         = Flags;

    Status = HttpSetServiceConfiguration(
                NULL,
                HttpServiceConfigSSLCertInfo,
                &SetParam,
                sizeof(SetParam),
                NULL
                );

    NlsPutMsg(HTTPCFG_SETSERVICE_STATUS, Status);

    return Status;
}

void PrintSslRecord ( IN PUCHAR pOutput )

Definition at line 53 of file ssl.c.

{
    DWORD                        i;
    UNICODE_STRING               GuidString;
    WCHAR                        IpAddr[INET6_ADDRSTRLEN];
    DWORD                        dwIpAddrLen = INET6_ADDRSTRLEN;
    DWORD                        dwSockAddrLength;
    PUCHAR                       pStr;
    PSOCKADDR_IN                 pSockAddrIn;
    PHTTP_SERVICE_CONFIG_SSL_SET pSsl;
    DWORD                        Status;

    pSsl = (PHTTP_SERVICE_CONFIG_SSL_SET) pOutput;

    // Convert address to string.
    //

    pSockAddrIn = (PSOCKADDR_IN)  pSsl->KeyDesc.pIpPort;
    if(pSockAddrIn->sin_family == AF_INET)
    {
        dwSockAddrLength = sizeof(SOCKADDR_IN);
    }
    else if(pSockAddrIn->sin_family == AF_INET6)
    {
        dwSockAddrLength = sizeof(SOCKADDR_IN6);
    }
    else
    {
        // Status = ERROR_REGISTRY_CORRUPT;
        return;
    }

    Status = WSAAddressToString(pSsl->KeyDesc.pIpPort,
                       dwSockAddrLength,
                       NULL,
                       IpAddr,
                       &dwIpAddrLen
                       );

    if(NO_ERROR != Status)
    {
        return;
    }

    // Print the Key.
    NlsPutMsg(HTTPCFG_SSL_IP,   IpAddr);

    NlsPutMsg(HTTPCFG_SSL_HASH);

    pStr = (PUCHAR) pSsl->ParamDesc.pSslHash;
    for(i=0; i<pSsl->ParamDesc.SslHashLength; i++)
    {
        NlsPutMsg(HTTPCFG_CHAR,  pStr[i]);
    }

    NlsPutMsg(HTTPCFG_NEWLINE);

    Status = RtlStringFromGUID(&pSsl->ParamDesc.AppId, &GuidString);

    if(NO_ERROR != Status)
    {
        return;
    }

    NlsPutMsg(HTTPCFG_SSL_GUID, GuidString.Buffer);

    RtlFreeUnicodeString(&GuidString);

    NlsPutMsg(HTTPCFG_SSL_CERTSTORENAME,
              pSsl->ParamDesc.pSslCertStoreName
              );

    NlsPutMsg(
              HTTPCFG_SSL_CERTCHECKMODE,
              pSsl->ParamDesc.DefaultCertCheckMode
              );

    NlsPutMsg(
              HTTPCFG_SSL_REVOCATIONFRESHNESSTIME,
              pSsl->ParamDesc.DefaultRevocationFreshnessTime
              );

    NlsPutMsg(
              HTTPCFG_SSL_REVOCATIONURLRETRIEVAL_TIMEOUT,
              pSsl->ParamDesc.DefaultRevocationUrlRetrievalTimeout
              );

    NlsPutMsg(
              HTTPCFG_SSL_SSLCTLIDENTIFIER,
              pSsl->ParamDesc.pDefaultSslCtlIdentifier
              );

    NlsPutMsg(
              HTTPCFG_SSL_SSLCTLSTORENAME,
              pSsl->ParamDesc.pDefaultSslCtlStoreName
              );

    NlsPutMsg(
              HTTPCFG_SSL_FLAGS,
              pSsl->ParamDesc.DefaultFlags
              );

    NlsPutMsg(
              HTTPCFG_RECORD_SEPARATOR
              );
}

Generated on Wed Nov 13 2024 16:53:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/http/serviceconfig/url.c File Reference

  • NetDS
  • http
  • serviceconfig
Functions

url.c File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

int | DoUrlAcl (int argc, WCHAR **argv, HTTPCFG_TYPE Type)
int | DoUrlAclDelete (IN PWSTR pUrl)
int | DoUrlAclQuery (IN PWSTR pUrl)
int | DoUrlAclSet (IN PWSTR pUrl, IN PWSTR pAcl)
void | PrintUrlAclRecord (IN PUCHAR pOutput)

Function Documentation

int DoUrlAcl | ( | int | argc,
 |  | WCHAR ** | argv,
 |  | HTTPCFG_TYPE | Type
 | ) |  |

Definition at line 279 of file url.c.

{
    PWCHAR   pUrl             = NULL;
    PWCHAR   pAcl             = NULL;

    while(argc>=2 && (argv[0][0] == '-' || argv[0][0]== '/'))
    {
        switch(toupper(argv[0][1]))
        {
            case 'U':
                pUrl = argv[1];
                break;

            case 'A':
                pAcl = argv[1];
                break;

            default:
                NlsPutMsg(HTTPCFG_INVALID_SWITCH, argv[0]);
                return ERROR_INVALID_PARAMETER;
        }

        argc -=2;
        argv +=2;
    }

    switch(Type)
    {
        case HttpCfgTypeSet:
            return DoUrlAclSet(pUrl, pAcl);

        case HttpCfgTypeQuery:
            return DoUrlAclQuery(pUrl);

        case HttpCfgTypeDelete:
            return DoUrlAclDelete(pUrl);

        default:
            NlsPutMsg(HTTPCFG_INVALID_SWITCH, argv[0]);
            return ERROR_INVALID_PARAMETER;
    }
}

int DoUrlAclDelete ( IN PWSTR pUrl )

Definition at line 239 of file url.c.

{
    HTTP_SERVICE_CONFIG_URLACL_SET SetParam;
    DWORD                          Status;

    SetParam.KeyDesc.pUrlPrefix = pUrl;
    Status = HttpDeleteServiceConfiguration(
                NULL,
                HttpServiceConfigUrlAclInfo,
                &SetParam,
                sizeof(SetParam),
                NULL
                );

    NlsPutMsg(HTTPCFG_DELETESERVICE_STATUS, Status);
    return Status;
}

int DoUrlAclQuery ( IN PWSTR pUrl )

Definition at line 109 of file url.c.

{
    DWORD                             Status;
    PUCHAR                            pOutput = NULL;
    DWORD                             OutputLength = 0;
    DWORD                             ReturnLength = 0;
    HTTP_SERVICE_CONFIG_URLACL_QUERY  QueryParam;

    ZeroMemory(&QueryParam, sizeof(QueryParam));

    if(pUrl)
    {
        // If a URL is specified, we'll Query for an exact entry.
        //
        QueryParam.QueryDesc = HttpServiceConfigQueryExact;
        QueryParam.KeyDesc.pUrlPrefix = pUrl;
    }
    else
    {
        //
        // No URL is specified, so enumerate the entire store.
        //
        QueryParam.QueryDesc = HttpServiceConfigQueryNext;
    }

    for(;;)
    {
        //
        // First, compute bytes required for querying the first entry.
        //
        Status = HttpQueryServiceConfiguration(
                    NULL,
                    HttpServiceConfigUrlAclInfo,
                    &QueryParam,
                    sizeof(QueryParam),
                    pOutput,
                    OutputLength,
                    &ReturnLength,
                    NULL
                    );

        if(Status == ERROR_INSUFFICIENT_BUFFER)
        {
            // If the API completes with ERROR_INSUFFICIENT_BUFFER, we'll
            // allocate memory for it & continue with the loop where we'll
            // call it again.

            if(pOutput)
            {
                // If there was an existing buffer, free it.
                LocalFree(pOutput);
            }

            // Allocate a new buffer
            pOutput = LocalAlloc(LMEM_FIXED, ReturnLength);
            if(!pOutput)
            {
                return ERROR_NOT_ENOUGH_MEMORY;
            }

            OutputLength = ReturnLength;
        }
        else if(Status == NO_ERROR)
        {

            // The query succeeded! We'll print the record that we just
            // queried.

            PrintUrlAclRecord(pOutput);

            if(pUrl)
            {
                //
                // If we are not enumerating, we are done.
                //
                break;
            }
            else
            {
                //
                // Since we are enumerating, we'll move on to the next
                // record. This is done by incrementing the cursor, till
                // we get ERROR_NO_MORE_ITEMS.
                //
                QueryParam.dwToken ++;
            }
        }
        else if(ERROR_NO_MORE_ITEMS == Status && pUrl == NULL)
        {
            // We are enumerating and we have reached the end. This is
            // indicated by a ERROR_NO_MORE_ITEMS error code.

            // This is not a real error, since it is used to indicate that
            // we've finished enumeration.

            Status = NO_ERROR;
            break;
        }
        else
        {
            //
            // Some other error, so we are done
            //
            NlsPutMsg(HTTPCFG_QUERYSERVICE_STATUS, Status);
            break;
        }
    }

    if(pOutput)
    {
        LocalFree(pOutput);
    }

    return Status;
}

int DoUrlAclSet | ( | IN PWSTR | pUrl,
 |  | IN PWSTR | pAcl
 | ) |  |

Definition at line 70 of file url.c.

{
    HTTP_SERVICE_CONFIG_URLACL_SET SetParam;
    DWORD                          Status;

    ZeroMemory(&SetParam, sizeof(SetParam));

    SetParam.KeyDesc.pUrlPrefix                  = pUrl;
    SetParam.ParamDesc.pStringSecurityDescriptor = pAcl;

    Status = HttpSetServiceConfiguration(
                NULL,
                HttpServiceConfigUrlAclInfo,
                &SetParam,
                sizeof(SetParam),
                NULL
                );

    NlsPutMsg(HTTPCFG_SETSERVICE_STATUS, Status);

    return Status;
}

void PrintUrlAclRecord ( IN PUCHAR pOutput )

Definition at line 33 of file url.c.

{
    PHTTP_SERVICE_CONFIG_URLACL_SET pSetParam;

    pSetParam = (PHTTP_SERVICE_CONFIG_URLACL_SET) pOutput;

    NlsPutMsg(
        HTTPCFG_URLACL_URL,
        pSetParam->KeyDesc.pUrlPrefix
        );

    NlsPutMsg(
              HTTPCFG_URLACL_ACL,
              pSetParam->ParamDesc.pStringSecurityDescriptor
              );

    NlsPutMsg(
            HTTPCFG_RECORD_SEPARATOR
            );
}

Generated on Wed Nov 13 2024 16:53:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/IAS/DialIn/DialIn.c File Reference

  • NetDS
  • IAS
  • DialIn
Functions | Variables

DialIn.c File Reference

#include <windows.h>
#include <malloc.h>
#include <authif.h>
#include <rassapi.h>
#include <lmerr.h>

Go to the source code of this file.

Functions

CONST RADIUS_ATTRIBUTE *WINAPI | FindAttribute (IN CONST RADIUS_ATTRIBUTE *pAttrs, IN DWORD dwAttrType)
DWORD WINAPI | RadiusExtensionInit (VOID)
DWORD WINAPI | RadiusExtensionProcess (IN CONST RADIUS_ATTRIBUTE *pAttrs, OUT OPTIONAL PRADIUS_ACTION pfAction)

Variables

WCHAR | theLocalServer [UNCLEN+1]

Function Documentation

CONST RADIUS_ATTRIBUTE* WINAPI FindAttribute | ( | IN CONST RADIUS_ATTRIBUTE * | pAttrs,
 |  | IN DWORD | dwAttrType
 | ) |  |

Definition at line 35 of file DialIn.c.

{
   for ( ; pAttrs->dwAttrType != ratMinimum; ++pAttrs)
   {
      if (pAttrs->dwAttrType == dwAttrType) { return pAttrs; }
   }

   return NULL;
}

DWORD WINAPI RadiusExtensionInit ( VOID )

Definition at line 53 of file DialIn.c.

{
   DWORD cbData;

   /* theLocalServer must be in UNC format. */
   wcscpy(theLocalServer, L"\\\\");

   /* Append the computer name. */
   cbData = UNCLEN - 1;
   if (!GetComputerNameW(theLocalServer + 2, &cbData))
   {
      return GetLastError();
   }

   return NO_ERROR;
}

DWORD WINAPI RadiusExtensionProcess | ( | IN CONST RADIUS_ATTRIBUTE * | pAttrs,
 |  | OUT OPTIONAL PRADIUS_ACTION | pfAction
 | ) |  |

Definition at line 75 of file DialIn.c.

{
   CONST RADIUS_ATTRIBUTE *p;
   PWSTR domain, username;
   int nChar;
   DWORD error;
   WCHAR buffer[UNCLEN + 1], *accountServer;
   RAS_USER_0 ru0;

   /* Only process Access-Requests. */
   p = FindAttribute(pAttrs, ratCode);
   if (p == NULL || p->dwValue != 1)
   {
      return NO_ERROR;
   }

   /* If it's not destined for the WindowsNT provider, we're not interested. */
   p = FindAttribute(pAttrs, ratProvider);
   if (p == NULL || p->dwValue != rapWindowsNT)
   {
      return NO_ERROR;
   }

   /* Find the Stripped-User-Name attribute. */
   p = FindAttribute(pAttrs, ratStrippedUserName);

   /* Make sure we found an attribute and it's the right data type. */
   if (p == NULL || p->fDataType != rdtString)
   {
      return ERROR_INVALID_DATA;
   }

   /* Allocate a buffer for the UNICODE string. */
   domain = (PWSTR)_alloca((p->cbDataLength + 1) * sizeof(WCHAR));

   /* Convert to UNICODE. */
   nChar = MultiByteToWideChar(
               CP_ACP,
               0,
               p->lpValue,
               p->cbDataLength,
               domain,
               p->cbDataLength + 1
               );
   if (nChar == 0)
   {
      return GetLastError();
   }
   domain[nChar] = L'\0';

   /* Look for the delimiter in "domain\username". */
   username = wcschr(domain, L'\\');

   accountServer = theLocalServer;

   if (username)
   {
      /* We found a delimiter, so null it out and advance. */
      *username++ = L'\0';

      /* Is this the local computer? */
      if (_wcsicmp(domain, theLocalServer + 2))
      {
         /* No, so we have to find a DC. */
         error = RasAdminGetUserAccountServer(
                     domain,
                     NULL,
                     buffer
                     );
         if (error != NO_ERROR)
         {
            return error;
         }

         accountServer = buffer;
      }
   }
   else
   {
      /* No delimiter, so the whole thing is the username. */
      username = domain;
   }

   /* Retrieve the dial-in info for this user. */
   error = RasAdminUserGetInfo(
               accountServer,
               username,
               &ru0
               );

   /* If the user doesn't exist, it's not an error, but we always reject. */
   if (error == NERR_UserNotFound)
   {
      *pfAction = raReject;
      return NO_ERROR;
   }

   /* Any other error and we bail. */
   if (error != NO_ERROR)
   {
      return error;
   }

   /* Is the dial-in bit set? */
   if ((ru0.bfPrivilege & RASPRIV_DialinPrivilege) == 0)
   {
      /* No, so reject. */
      *pfAction = raReject;
   }

   return NO_ERROR;
}

Variable Documentation

WCHAR theLocalServer[UNCLEN+1]

Definition at line 28 of file DialIn.c.

Generated on Wed Nov 13 2024 16:53:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/IAS/MapName/dllmain.c File Reference

  • NetDS
  • IAS
  • MapName
Functions | Variables

dllmain.c File Reference

#include "windows.h"
#include "radutil.h"

Go to the source code of this file.

Functions

BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
STDAPI | DllRegisterServer (VOID)
STDAPI | DllUnregisterServer (VOID)

Variables

LPCWSTR | pwszDllType

Function Documentation

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID | lpReserved
 | ) |  |

Definition at line 12 of file dllmain.c.

{
   if (dwReason == DLL_PROCESS_ATTACH)
   {
      hModule = hInstance;
      DisableThreadLibraryCalls(hInstance);
   }

   return TRUE;
}

STDAPI DllRegisterServer ( VOID )

Definition at line 28 of file dllmain.c.

{
   return RadiusExtensionInstall(hModule, pwszDllType, TRUE);
}

STDAPI DllUnregisterServer ( VOID )

Definition at line 34 of file dllmain.c.

{
   return RadiusExtensionInstall(hModule, pwszDllType, FALSE);
}

Variable Documentation

LPCWSTR pwszDllType

Definition at line 10 of file mapname.c.

Generated on Wed Nov 13 2024 16:53:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/IAS/MapName/mapname.c File Reference

  • NetDS
  • IAS
  • MapName
Functions | Variables

mapname.c File Reference

#include "windows.h"
#include "authif.h"
#include "lmcons.h"
#include "ntsecapi.h"
#include "radutil.h"

Go to the source code of this file.

Functions

DWORD WINAPI | RadiusExtensionInit (VOID)
DWORD WINAPI | RadiusExtensionProcess2 (PRADIUS_EXTENSION_CONTROL_BLOCK pECB)
VOID WINAPI | RadiusExtensionTerm (VOID)

Variables

LSA_HANDLE | hPolicy = NULL
LPCWSTR | pwszDllType = AUTHSRV_EXTENSIONS_VALUE_W

Function Documentation

DWORD WINAPI RadiusExtensionInit ( VOID )

Definition at line 19 of file mapname.c.

{
   NTSTATUS status;
   LSA_OBJECT_ATTRIBUTES objectAttributes;

   memset(&objectAttributes, 0, sizeof(objectAttributes));
   status = LsaOpenPolicy(
               NULL,
               &objectAttributes,
               POLICY_LOOKUP_NAMES,
               &hPolicy
               );

   return LsaNtStatusToWinError(status);
}

DWORD WINAPI RadiusExtensionProcess2 ( PRADIUS_EXTENSION_CONTROL_BLOCK pECB )

Definition at line 47 of file mapname.c.

{
   PRADIUS_ATTRIBUTE_ARRAY pInAttrs;
   const RADIUS_ATTRIBUTE* pAttr;
   int nChar;
   WCHAR wszUserName[UNLEN];
   CHAR szUserName[UNLEN];
   LSA_UNICODE_STRING lusName;
   NTSTATUS status;
   PLSA_REFERENCED_DOMAIN_LIST pReferencedDomains;
   PLSA_TRANSLATED_SID pSids;
   DWORD cbDataLength, dwResult;
   RADIUS_ATTRIBUTE raNewName;

   /* We only process authentication. */
   if (pECB->repPoint != repAuthentication)
   {
      return NO_ERROR;
   }

   /* We only process Access-Requests. */
   if (pECB->rcRequestType != rcAccessRequest)
   {
      return NO_ERROR;
   }

   /* Don't process if it's already been rejected. */
   if (pECB->rcResponseType == rcAccessReject)
   {
      return NO_ERROR;
   }

   /* Get the attributes from the Access-Request. */
   pInAttrs = pECB->GetRequest(pECB);

   /* Only process Windows users */
   pAttr = RadiusFindFirstAttribute(pInAttrs, ratProvider);
   if ((pAttr == NULL) || (pAttr->dwValue != rapWindowsNT))
   {
      return NO_ERROR;
   }

   /* Retrieve the username. If it doesn't exist, there's nothing to do. */
   pAttr = RadiusFindFirstAttribute(pInAttrs, ratUserName);
   if (pAttr == NULL)
   {
      return NO_ERROR;
   }

   /* If the username already includes a domain name or if it's a user
    * principal name (UPN), then we don't have to do anything. */
   if (memchr(pAttr->lpValue, '\\', pAttr->cbDataLength) != NULL)
   {
      return NO_ERROR;
   }
   if (memchr(pAttr->lpValue, '@', pAttr->cbDataLength) != NULL)
   {
      return NO_ERROR;
   }

   /* Convert the username to Unicode. */
   nChar = MultiByteToWideChar(
              CP_ACP,
              MB_ERR_INVALID_CHARS,
              pAttr->lpValue,
              pAttr->cbDataLength,
              wszUserName,
              UNLEN
              );
   if (nChar == 0)
   {
      return GetLastError();
   }

   /* Pack the username into an LSA_UNICODE_STRING struct. */
   lusName.Length = nChar * sizeof(WCHAR);
   lusName.MaximumLength = lusName.Length;
   lusName.Buffer = wszUserName;

   /* Lookup the name. */
   status = LsaLookupNames(
               hPolicy,
               1,
               &lusName,
               &pReferencedDomains,
               &pSids
               );
   if (!LSA_SUCCESS(status))
   {
      return LsaNtStatusToWinError(status);
   }

   /* Get the domain which has the user account */
   lusName = pReferencedDomains->Domains[pSids[0].DomainIndex].Name;

   /* Convert to an ANSI string. */
   nChar = WideCharToMultiByte(
              CP_ACP,
              0,
              lusName.Buffer,
              (lusName.Length / sizeof(WCHAR)),
              szUserName,
              UNLEN,
              NULL,
              NULL
              );

   LsaFreeMemory(pReferencedDomains);
   LsaFreeMemory(pSids);

   if (nChar == 0)
   {
      return GetLastError();
   }

   /* New attribute is the domain plus delimiter plus username */
   cbDataLength = nChar + 1 + pAttr->cbDataLength;
   if (cbDataLength > UNLEN)
   {
      return ERROR_BAD_USERNAME;
   }

   /* Build the fully-qualified username. */
   szUserName[nChar] = '\\';
   memcpy(szUserName + nChar + 1, pAttr->lpValue, pAttr->cbDataLength);

   /* Fill in the RADIUS_ATTRIBUTE struct. */
   raNewName.fDataType = rdtString;
   raNewName.cbDataLength = cbDataLength;
   raNewName.lpValue = szUserName;

   /* Add as both the ratStrippedUserName and the ratFQUserName. */
   raNewName.dwAttrType = ratStrippedUserName;
   dwResult = RadiusReplaceFirstAttribute(pInAttrs, &raNewName);
   if (dwResult == NO_ERROR)
   {
      raNewName.dwAttrType = ratFQUserName;
      dwResult = RadiusReplaceFirstAttribute(pInAttrs, &raNewName);
   }

   return dwResult;
}

VOID WINAPI RadiusExtensionTerm ( VOID )

Definition at line 38 of file mapname.c.

{
   LsaClose(hPolicy);
   hPolicy = NULL;
}

Variable Documentation

LSA_HANDLE hPolicy = NULL

Definition at line 14 of file mapname.c.

LPCWSTR pwszDllType = AUTHSRV_EXTENSIONS_VALUE_W

Definition at line 10 of file mapname.c.

Generated on Wed Nov 13 2024 16:53:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/IAS/MapName/multisz.c File Reference

  • NetDS
  • IAS
  • MapName
Functions

multisz.c File Reference

#include "windows.h"
#include "wchar.h"
#include "multisz.h"
#include "radutil.h"

Go to the source code of this file.

Functions

LONG WINAPI | MultiSzAppend (PMULTI_SZ pMultiSz, LPCWSTR pwszString)
VOID WINAPI | MultiSzErase (PMULTI_SZ pMultiSz, LPWSTR pwszString)
LPWSTR WINAPI | MultiSzFind (PMULTI_SZ pMultiSz, LPCWSTR pwszString)
VOID WINAPI | MultiSzFree (PMULTI_SZ pMultiSz)
VOID WINAPI | MultiSzInit (PMULTI_SZ pMultiSz)
LONG WINAPI | MultiSzQuery (PMULTI_SZ pMultiSz, HKEY hKey, LPCWSTR pwszValueName)
LONG WINAPI | MultiSzSet (PMULTI_SZ pMultiSz, HKEY hKey, LPCWSTR pwszValueName)

Function Documentation

LONG WINAPI MultiSzAppend | ( | PMULTI_SZ | pMultiSz,
 |  | LPCWSTR | pwszString
 | ) |  |

Definition at line 36 of file multisz.c.

{
   DWORD nChar;
   MULTI_SZ result;
   PWSTR pwszPos;

   /* Calculate the number of characters being added. */
   nChar = lstrlenW(pwszString) + 1;

   /* Allocate a new MULTI_SZ with enough room for the additional string. */
   result.nChar = pMultiSz->nChar + nChar;
   result.pwszValue = RadiusAlloc(result.nChar * sizeof(WCHAR));
   if (result.pwszValue == NULL)
   {
      return ERROR_NOT_ENOUGH_MEMORY;
   }

   /* Copy in the current MULTI_SZ. */
   memcpy(
      result.pwszValue,
      pMultiSz->pwszValue,
      (pMultiSz->nChar * sizeof(WCHAR))
      );

   /* Compute the position to add the new string. */
   pwszPos = result.pwszValue + pMultiSz->nChar - 1;

   /* Append the string and the extra null-terminator. */
   memcpy(
      pwszPos,
      pwszString,
      (nChar * sizeof(WCHAR))
      );
   pwszPos[nChar] = L'\0';

   /* Clean-up the old MULTI_SZ and swap in the new one. */
   MultiSzFree(pMultiSz);
   *pMultiSz = result;

   return NO_ERROR;
}

VOID WINAPI MultiSzErase | ( | PMULTI_SZ | pMultiSz,
 |  | LPWSTR | pwszString
 | ) |  |

Definition at line 83 of file multisz.c.

{
   DWORD nChar;
   PWSTR pwszNext, pwszFirst, pwszLast;

   /* Compute the number of characters being erased. */
   nChar = lstrlenW(pwszString) + 1;

   /* Slide everything left to erase the string. */
   pwszFirst = pwszString + nChar;
   pwszLast = pMultiSz->pwszValue + pMultiSz->nChar;
   for (pwszNext = pwszFirst; pwszNext < pwszLast; ++pwszNext)
   {
      *pwszString++ = *pwszNext;
   }

   /* Update the length of the MULTI_SZ. */
   pMultiSz->nChar -= nChar;
}

LPWSTR WINAPI MultiSzFind | ( | PMULTI_SZ | pMultiSz,
 |  | LPCWSTR | pwszString
 | ) |  |

Definition at line 108 of file multisz.c.

{
   LPWSTR pwszNext;

   for (pwszNext = pMultiSz->pwszValue;
        *pwszNext != L'\0';
        pwszNext += (lstrlenW(pwszNext) + 1))
   {
      if (lstrcmpiW(pwszNext, pwszString) == 0)
      {
         return pwszNext;
      }
   }

   return NULL;
}

VOID WINAPI MultiSzFree ( PMULTI_SZ pMultiSz )

Definition at line 22 of file multisz.c.

{
   if (pMultiSz->pwszValue != wszEmptyMultiSz)
   {
      RadiusFree(pMultiSz->pwszValue);
   }

   memset(pMultiSz, 0, sizeof(MULTI_SZ));
}

VOID WINAPI MultiSzInit ( PMULTI_SZ pMultiSz )

Definition at line 12 of file multisz.c.

{
   pMultiSz->pwszValue = wszEmptyMultiSz;
   pMultiSz->nChar = 1;
}

LONG WINAPI MultiSzQuery | ( | PMULTI_SZ | pMultiSz,
 |  | HKEY | hKey,
 |  | LPCWSTR | pwszValueName
 | ) |  |

Definition at line 130 of file multisz.c.

{
   LONG lResult;
   DWORD dwType, cbData;
   LPBYTE lpData;

   /* Initialize the MULTI_SZ. */
   MultiSzInit(pMultiSz);

   /* Compute the size of the value. */
   cbData = 0;
   lResult = RegQueryValueExW(
                hKey,
                pwszValueName,
                NULL,
                &dwType,
                NULL,
                &cbData
                );
   if (lResult != NO_ERROR)
   {
      return lResult;
   }
   if (dwType != REG_MULTI_SZ)
   {
      return ERROR_INVALID_DATA;
   }

   /* Allocate a buffer to hold the MULTI_SZ. */
   lpData = RadiusAlloc(cbData);

   /* Get the value. */
   lResult = RegQueryValueExW(
                hKey,
                pwszValueName,
                NULL,
                &dwType,
                lpData,
                &cbData
                );
   if (lResult != NO_ERROR)
   {
      RadiusFree(lpData);
      return lResult;
   }
   if (dwType != REG_MULTI_SZ)
   {
      RadiusFree(lpData);
      return ERROR_INVALID_DATA;
   }

   /* Store the result. */
   pMultiSz->pwszValue = (LPWSTR)lpData;
   pMultiSz->nChar = cbData / sizeof(WCHAR);

   return NO_ERROR;
}

LONG WINAPI MultiSzSet | ( | PMULTI_SZ | pMultiSz,
 |  | HKEY | hKey,
 |  | LPCWSTR | pwszValueName
 | ) |  |

Definition at line 195 of file multisz.c.

{
   return RegSetValueExW(
             hKey,
             pwszValueName,
             0,
             REG_MULTI_SZ,
             (const BYTE *)pMultiSz->pwszValue,
             pMultiSz->nChar * sizeof(WCHAR)
             );
}

Generated on Wed Nov 13 2024 16:53:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/IAS/MapName/multisz.h File Reference

  • NetDS
  • IAS
  • MapName
Classes | Typedefs | Functions

multisz.h File Reference

Go to the source code of this file.

Classes

struct | tagMULTI_SZ

Typedefs

typedef struct tagMULTI_SZ | MULTI_SZ
typedef struct tagMULTI_SZ * | PMULTI_SZ

Functions

LONG WINAPI | MultiSzAppend (PMULTI_SZ pMultiSz, LPCWSTR pwszString)
VOID WINAPI | MultiSzErase (PMULTI_SZ pMultiSz, LPWSTR pwszString)
LPWSTR WINAPI | MultiSzFind (PMULTI_SZ pMultiSz, LPCWSTR pwszString)
VOID WINAPI | MultiSzFree (PMULTI_SZ pMultiSz)
VOID WINAPI | MultiSzInit (PMULTI_SZ pMultiSz)
LONG WINAPI | MultiSzQuery (PMULTI_SZ pMultiSz, HKEY hKey, LPCWSTR pwszValueName)
LONG WINAPI | MultiSzSet (PMULTI_SZ pMultiSz, HKEY hKey, LPCWSTR pwszValueName)

Typedef Documentation

typedef struct tagMULTI_SZ MULTI_SZ
typedef struct tagMULTI_SZ * PMULTI_SZ

Function Documentation

LONG WINAPI MultiSzAppend | ( | PMULTI_SZ | pMultiSz,
 |  | LPCWSTR | pwszString
 | ) |  |

Definition at line 36 of file multisz.c.

{
   DWORD nChar;
   MULTI_SZ result;
   PWSTR pwszPos;

   /* Calculate the number of characters being added. */
   nChar = lstrlenW(pwszString) + 1;

   /* Allocate a new MULTI_SZ with enough room for the additional string. */
   result.nChar = pMultiSz->nChar + nChar;
   result.pwszValue = RadiusAlloc(result.nChar * sizeof(WCHAR));
   if (result.pwszValue == NULL)
   {
      return ERROR_NOT_ENOUGH_MEMORY;
   }

   /* Copy in the current MULTI_SZ. */
   memcpy(
      result.pwszValue,
      pMultiSz->pwszValue,
      (pMultiSz->nChar * sizeof(WCHAR))
      );

   /* Compute the position to add the new string. */
   pwszPos = result.pwszValue + pMultiSz->nChar - 1;

   /* Append the string and the extra null-terminator. */
   memcpy(
      pwszPos,
      pwszString,
      (nChar * sizeof(WCHAR))
      );
   pwszPos[nChar] = L'\0';

   /* Clean-up the old MULTI_SZ and swap in the new one. */
   MultiSzFree(pMultiSz);
   *pMultiSz = result;

   return NO_ERROR;
}

VOID WINAPI MultiSzErase | ( | PMULTI_SZ | pMultiSz,
 |  | LPWSTR | pwszString
 | ) |  |

Definition at line 83 of file multisz.c.

{
   DWORD nChar;
   PWSTR pwszNext, pwszFirst, pwszLast;

   /* Compute the number of characters being erased. */
   nChar = lstrlenW(pwszString) + 1;

   /* Slide everything left to erase the string. */
   pwszFirst = pwszString + nChar;
   pwszLast = pMultiSz->pwszValue + pMultiSz->nChar;
   for (pwszNext = pwszFirst; pwszNext < pwszLast; ++pwszNext)
   {
      *pwszString++ = *pwszNext;
   }

   /* Update the length of the MULTI_SZ. */
   pMultiSz->nChar -= nChar;
}

LPWSTR WINAPI MultiSzFind | ( | PMULTI_SZ | pMultiSz,
 |  | LPCWSTR | pwszString
 | ) |  |

Definition at line 108 of file multisz.c.

{
   LPWSTR pwszNext;

   for (pwszNext = pMultiSz->pwszValue;
        *pwszNext != L'\0';
        pwszNext += (lstrlenW(pwszNext) + 1))
   {
      if (lstrcmpiW(pwszNext, pwszString) == 0)
      {
         return pwszNext;
      }
   }

   return NULL;
}

VOID WINAPI MultiSzFree ( PMULTI_SZ pMultiSz )

Definition at line 22 of file multisz.c.

{
   if (pMultiSz->pwszValue != wszEmptyMultiSz)
   {
      RadiusFree(pMultiSz->pwszValue);
   }

   memset(pMultiSz, 0, sizeof(MULTI_SZ));
}

VOID WINAPI MultiSzInit ( PMULTI_SZ pMultiSz )

Definition at line 12 of file multisz.c.

{
   pMultiSz->pwszValue = wszEmptyMultiSz;
   pMultiSz->nChar = 1;
}

LONG WINAPI MultiSzQuery | ( | PMULTI_SZ | pMultiSz,
 |  | HKEY | hKey,
 |  | LPCWSTR | pwszValueName
 | ) |  |

Definition at line 130 of file multisz.c.

{
   LONG lResult;
   DWORD dwType, cbData;
   LPBYTE lpData;

   /* Initialize the MULTI_SZ. */
   MultiSzInit(pMultiSz);

   /* Compute the size of the value. */
   cbData = 0;
   lResult = RegQueryValueExW(
                hKey,
                pwszValueName,
                NULL,
                &dwType,
                NULL,
                &cbData
                );
   if (lResult != NO_ERROR)
   {
      return lResult;
   }
   if (dwType != REG_MULTI_SZ)
   {
      return ERROR_INVALID_DATA;
   }

   /* Allocate a buffer to hold the MULTI_SZ. */
   lpData = RadiusAlloc(cbData);

   /* Get the value. */
   lResult = RegQueryValueExW(
                hKey,
                pwszValueName,
                NULL,
                &dwType,
                lpData,
                &cbData
                );
   if (lResult != NO_ERROR)
   {
      RadiusFree(lpData);
      return lResult;
   }
   if (dwType != REG_MULTI_SZ)
   {
      RadiusFree(lpData);
      return ERROR_INVALID_DATA;
   }

   /* Store the result. */
   pMultiSz->pwszValue = (LPWSTR)lpData;
   pMultiSz->nChar = cbData / sizeof(WCHAR);

   return NO_ERROR;
}

LONG WINAPI MultiSzSet | ( | PMULTI_SZ | pMultiSz,
 |  | HKEY | hKey,
 |  | LPCWSTR | pwszValueName
 | ) |  |

Definition at line 195 of file multisz.c.

{
   return RegSetValueExW(
             hKey,
             pwszValueName,
             0,
             REG_MULTI_SZ,
             (const BYTE *)pMultiSz->pwszValue,
             pMultiSz->nChar * sizeof(WCHAR)
             );
}

Generated on Wed Nov 13 2024 16:53:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/IAS/MapName/radutil.c File Reference

  • NetDS
  • IAS
  • MapName
Functions

radutil.c File Reference

#include "windows.h"
#include "radutil.h"
#include "multisz.h"

Go to the source code of this file.

Functions

LPVOID WINAPI | RadiusAlloc (SIZE_T dwBytes)
HRESULT WINAPI | RadiusExtensionInstall (HMODULE hModule, LPCWSTR pwszType, BOOL fInstall)
const RADIUS_ATTRIBUTE *WINAPI | RadiusFindFirstAttribute (PRADIUS_ATTRIBUTE_ARRAY pAttrs, DWORD dwAttrType)
DWORD WINAPI | RadiusFindFirstIndex (PRADIUS_ATTRIBUTE_ARRAY pAttrs, DWORD dwAttrType)
VOID WINAPI | RadiusFree (LPVOID lpMem)
DWORD WINAPI | RadiusReplaceFirstAttribute (PRADIUS_ATTRIBUTE_ARRAY pAttrs, const RADIUS_ATTRIBUTE *pSrc)

Function Documentation

LPVOID WINAPI RadiusAlloc ( SIZE_T dwBytes )

Definition at line 9 of file radutil.c.

{
   return HeapAlloc(GetProcessHeap(), 0, dwBytes);
}

HRESULT WINAPI RadiusExtensionInstall | ( | HMODULE | hModule,
 |  | LPCWSTR | pwszType,
 |  | BOOL | fInstall
 | ) |  |

Definition at line 114 of file radutil.c.

{
   LONG lResult;
   HKEY hKey;
   DWORD nChar, dwError;
   WCHAR wszFileName[MAX_PATH];
   MULTI_SZ value;
   LPWSTR pwszSelf;

   if ((hModule == NULL) || (pwszType == NULL))
   {
      return ERROR_INVALID_PARAMETER;
   }

   /* Retrieve the full path to the extension DLL. */
   nChar = GetModuleFileNameW(
              hModule,
              wszFileName,
              MAX_PATH
              );
   if (nChar == 0)
   {
      dwError = GetLastError();
      return HRESULT_FROM_WIN32(dwError);
   }

   /* Open or create the parameters key. */
   lResult = RegCreateKeyExW(
                HKEY_LOCAL_MACHINE,
                AUTHSRV_PARAMETERS_KEY_W,
                0,
                NULL,
                REG_OPTION_NON_VOLATILE,
                (KEY_QUERY_VALUE | KEY_SET_VALUE),
                NULL,
                &hKey,
                NULL
                );
   if (lResult != NO_ERROR)
   {
      return HRESULT_FROM_WIN32(lResult);
   }

   /* Read the current registered extensions DLLs. */
   lResult = MultiSzQuery(
                &value,
                hKey,
                pwszType
                );
   switch (lResult)
   {
      case NO_ERROR:
      case ERROR_FILE_NOT_FOUND:
      case ERROR_INVALID_DATA:
         break;

      default:
         RegCloseKey(hKey);
         return HRESULT_FROM_WIN32(lResult);
   }

   /* Is this DLL currently registered? */
   pwszSelf = MultiSzFind(&value, wszFileName);

   if (fInstall)
   {
      if (pwszSelf == NULL)
      {
         /* We're installing and we're not currently registered, so we have to
          * add ourself to the list of DLLs. */
         lResult = MultiSzAppend(&value, wszFileName);
         if (lResult == NO_ERROR)
         {
            lResult = MultiSzSet(&value, hKey, pwszType);
         }
      }
      else
      {
         /* The DLL is already registered -- nothing to do.  */
         lResult = NO_ERROR;
      }
   }
   else
   {
      if (pwszSelf != NULL)
      {
         /* We're uninstalling and we're currently registered, so we have to
          * remove ourself from the list of DLLs. */
         MultiSzErase(&value, pwszSelf);
         if (value.nChar > 1)
         {
            lResult = MultiSzSet(&value, hKey, pwszType);
         }
         else
         {
            lResult = RegDeleteValueW(hKey, pwszType);
         }
      }
      else
      {
         /* The DLL isn't registered -- nothing to do. */
         lResult = NO_ERROR;
      }
   }

   /* Clean up the MULTI_SZ. */
   MultiSzFree(&value);

   return HRESULT_FROM_WIN32(lResult);
}

const RADIUS_ATTRIBUTE* WINAPI RadiusFindFirstAttribute | ( | PRADIUS_ATTRIBUTE_ARRAY | pAttrs,
 |  | DWORD | dwAttrType
 | ) |  |

Definition at line 62 of file radutil.c.

{
   DWORD dwIndex;

   dwIndex = RadiusFindFirstIndex(pAttrs, dwAttrType);

   if (dwIndex != RADIUS_ATTR_NOT_FOUND)
   {
      return pAttrs->AttributeAt(pAttrs, dwIndex);
   }
   else
   {
      return NULL;
   }
}

DWORD WINAPI RadiusFindFirstIndex | ( | PRADIUS_ATTRIBUTE_ARRAY | pAttrs,
 |  | DWORD | dwAttrType
 | ) |  |

Definition at line 29 of file radutil.c.

{
   DWORD dwIndex, dwSize;
   const RADIUS_ATTRIBUTE *pAttr;

   if (pAttrs == NULL)
   {
      return RADIUS_ATTR_NOT_FOUND;
   }

   /* Get the number of attributes in the array */
   dwSize = pAttrs->GetSize(pAttrs);

   /* Iterate through the array ... */
   for (dwIndex = 0; dwIndex < dwSize; ++dwIndex)
   {
      /* ... looking for the first attribute that matches the type. */
      pAttr = pAttrs->AttributeAt(pAttrs, dwIndex);
      if (pAttr->dwAttrType == dwAttrType)
      {
         return dwIndex;
      }
   }

   return RADIUS_ATTR_NOT_FOUND;
}

VOID WINAPI RadiusFree ( LPVOID lpMem )

Definition at line 19 of file radutil.c.

{
   HeapFree(GetProcessHeap(), 0, lpMem);
}

DWORD WINAPI RadiusReplaceFirstAttribute | ( | PRADIUS_ATTRIBUTE_ARRAY | pAttrs,
 |  | const RADIUS_ATTRIBUTE * | pSrc
 | ) |  |

Definition at line 84 of file radutil.c.

{
   DWORD dwIndex;

   if ((pAttrs == NULL) || (pSrc == NULL))
   {
      return ERROR_INVALID_PARAMETER;
   }

   dwIndex = RadiusFindFirstIndex(pAttrs, pSrc->dwAttrType);

   if (dwIndex != RADIUS_ATTR_NOT_FOUND)
   {
      /* It already exists, so overwrite the existing attribute. */
      return pAttrs->SetAt(pAttrs, dwIndex, pSrc);
   }
   else
   {
      /* It doesn't exist, so add it to the end of the array. */
      return pAttrs->Add(pAttrs, pSrc);
   }

}

Generated on Wed Nov 13 2024 16:53:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/IAS/MapName/radutil.h File Reference

  • NetDS
  • IAS
  • MapName
Defines | Functions

radutil.h File Reference

#include "authif.h"

Go to the source code of this file.

Defines

#define | RADIUS_ATTR_NOT_FOUND ((DWORD)-1)

Functions

LPVOID WINAPI | RadiusAlloc (SIZE_T dwBytes)
HRESULT WINAPI | RadiusExtensionInstall (HMODULE hModule, LPCWSTR pwszType, BOOL fInstall)
const RADIUS_ATTRIBUTE *WINAPI | RadiusFindFirstAttribute (PRADIUS_ATTRIBUTE_ARRAY pAttrs, DWORD dwAttrType)
DWORD WINAPI | RadiusFindFirstIndex (PRADIUS_ATTRIBUTE_ARRAY pAttrs, DWORD dwAttrType)
VOID WINAPI | RadiusFree (LPVOID lpMem)
DWORD WINAPI | RadiusReplaceFirstAttribute (PRADIUS_ATTRIBUTE_ARRAY pAttrs, const RADIUS_ATTRIBUTE *pSrc)

Define Documentation

#define RADIUS_ATTR_NOT_FOUND ((DWORD)-1)

Definition at line 25 of file radutil.h.

Function Documentation

LPVOID WINAPI RadiusAlloc ( SIZE_T dwBytes )

Definition at line 9 of file radutil.c.

{
   return HeapAlloc(GetProcessHeap(), 0, dwBytes);
}

HRESULT WINAPI RadiusExtensionInstall | ( | HMODULE | hModule,
 |  | LPCWSTR | pwszType,
 |  | BOOL | fInstall
 | ) |  |

Definition at line 114 of file radutil.c.

{
   LONG lResult;
   HKEY hKey;
   DWORD nChar, dwError;
   WCHAR wszFileName[MAX_PATH];
   MULTI_SZ value;
   LPWSTR pwszSelf;

   if ((hModule == NULL) || (pwszType == NULL))
   {
      return ERROR_INVALID_PARAMETER;
   }

   /* Retrieve the full path to the extension DLL. */
   nChar = GetModuleFileNameW(
              hModule,
              wszFileName,
              MAX_PATH
              );
   if (nChar == 0)
   {
      dwError = GetLastError();
      return HRESULT_FROM_WIN32(dwError);
   }

   /* Open or create the parameters key. */
   lResult = RegCreateKeyExW(
                HKEY_LOCAL_MACHINE,
                AUTHSRV_PARAMETERS_KEY_W,
                0,
                NULL,
                REG_OPTION_NON_VOLATILE,
                (KEY_QUERY_VALUE | KEY_SET_VALUE),
                NULL,
                &hKey,
                NULL
                );
   if (lResult != NO_ERROR)
   {
      return HRESULT_FROM_WIN32(lResult);
   }

   /* Read the current registered extensions DLLs. */
   lResult = MultiSzQuery(
                &value,
                hKey,
                pwszType
                );
   switch (lResult)
   {
      case NO_ERROR:
      case ERROR_FILE_NOT_FOUND:
      case ERROR_INVALID_DATA:
         break;

      default:
         RegCloseKey(hKey);
         return HRESULT_FROM_WIN32(lResult);
   }

   /* Is this DLL currently registered? */
   pwszSelf = MultiSzFind(&value, wszFileName);

   if (fInstall)
   {
      if (pwszSelf == NULL)
      {
         /* We're installing and we're not currently registered, so we have to
          * add ourself to the list of DLLs. */
         lResult = MultiSzAppend(&value, wszFileName);
         if (lResult == NO_ERROR)
         {
            lResult = MultiSzSet(&value, hKey, pwszType);
         }
      }
      else
      {
         /* The DLL is already registered -- nothing to do.  */
         lResult = NO_ERROR;
      }
   }
   else
   {
      if (pwszSelf != NULL)
      {
         /* We're uninstalling and we're currently registered, so we have to
          * remove ourself from the list of DLLs. */
         MultiSzErase(&value, pwszSelf);
         if (value.nChar > 1)
         {
            lResult = MultiSzSet(&value, hKey, pwszType);
         }
         else
         {
            lResult = RegDeleteValueW(hKey, pwszType);
         }
      }
      else
      {
         /* The DLL isn't registered -- nothing to do. */
         lResult = NO_ERROR;
      }
   }

   /* Clean up the MULTI_SZ. */
   MultiSzFree(&value);

   return HRESULT_FROM_WIN32(lResult);
}

const RADIUS_ATTRIBUTE* WINAPI RadiusFindFirstAttribute | ( | PRADIUS_ATTRIBUTE_ARRAY | pAttrs,
 |  | DWORD | dwAttrType
 | ) |  |

Definition at line 62 of file radutil.c.

{
   DWORD dwIndex;

   dwIndex = RadiusFindFirstIndex(pAttrs, dwAttrType);

   if (dwIndex != RADIUS_ATTR_NOT_FOUND)
   {
      return pAttrs->AttributeAt(pAttrs, dwIndex);
   }
   else
   {
      return NULL;
   }
}

DWORD WINAPI RadiusFindFirstIndex | ( | PRADIUS_ATTRIBUTE_ARRAY | pAttrs,
 |  | DWORD | dwAttrType
 | ) |  |

Definition at line 29 of file radutil.c.

{
   DWORD dwIndex, dwSize;
   const RADIUS_ATTRIBUTE *pAttr;

   if (pAttrs == NULL)
   {
      return RADIUS_ATTR_NOT_FOUND;
   }

   /* Get the number of attributes in the array */
   dwSize = pAttrs->GetSize(pAttrs);

   /* Iterate through the array ... */
   for (dwIndex = 0; dwIndex < dwSize; ++dwIndex)
   {
      /* ... looking for the first attribute that matches the type. */
      pAttr = pAttrs->AttributeAt(pAttrs, dwIndex);
      if (pAttr->dwAttrType == dwAttrType)
      {
         return dwIndex;
      }
   }

   return RADIUS_ATTR_NOT_FOUND;
}

VOID WINAPI RadiusFree ( LPVOID lpMem )

Definition at line 19 of file radutil.c.

{
   HeapFree(GetProcessHeap(), 0, lpMem);
}

DWORD WINAPI RadiusReplaceFirstAttribute | ( | PRADIUS_ATTRIBUTE_ARRAY | pAttrs,
 |  | const RADIUS_ATTRIBUTE * | pSrc
 | ) |  |

Definition at line 84 of file radutil.c.

{
   DWORD dwIndex;

   if ((pAttrs == NULL) || (pSrc == NULL))
   {
      return ERROR_INVALID_PARAMETER;
   }

   dwIndex = RadiusFindFirstIndex(pAttrs, pSrc->dwAttrType);

   if (dwIndex != RADIUS_ATTR_NOT_FOUND)
   {
      /* It already exists, so overwrite the existing attribute. */
      return pAttrs->SetAt(pAttrs, dwIndex, pSrc);
   }
   else
   {
      /* It doesn't exist, so add it to the end of the array. */
      return pAttrs->Add(pAttrs, pSrc);
   }

}

Generated on Wed Nov 13 2024 16:53:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/IPHelp/EnableRouter/enablerouter.c File Reference

  • NetDS
  • IPHelp
  • EnableRouter
Defines | Functions | Variables

enablerouter.c File Reference

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

Go to the source code of this file.

Defines

#define | FAIL_PRINT(X, Y, Z)
#define | MAX_STRLEN 128
#define | RETURN_FAILURE 1
#define | RETURN_SUCCESS 0
#define | SUCCESS_PRINT(X, Y, Z)

Functions

DWORD WINAPI | AllNullParamCase (LPVOID)
void | CommandLineUsage (void)
DWORD (WINAPI *EnableRouter)(PHANDLE
int __cdecl | main (int argc, char *argv[])
DWORD WINAPI | NullHandleCase (LPVOID)
DWORD WINAPI | NullOverlappedCase (LPVOID)
int | UnreadableRand (size_t length, char szTestNumber[MAX_STRLEN])
int | UnwriteableRand (size_t length, char szTestNumber[MAX_STRLEN])

Variables

DWORD Count
DWORD dwThreadId
DWORD Error
HANDLE Handle
HINSTANCE | Hinstance
HANDLE hThread
INT | i
LPDWORD
LPOVERLAPPED
OVERLAPPED | Overlapped
OVERLAPPED | OverlappedUnenableRouter

Define Documentation

#define FAIL_PRINT | ( | X,
 |  | Y,
 |  | Z
 | ) |
Value:
{ \
              printf("%s: %s FAILED: Error %lu: line %d\n",X,Y,Z, __LINE__); \
              fflush(stdout); \
              }

Definition at line 26 of file enablerouter.c.

#define MAX_STRLEN 128

Definition at line 19 of file enablerouter.c.

#define RETURN_FAILURE 1

Definition at line 18 of file enablerouter.c.

#define RETURN_SUCCESS 0

Definition at line 17 of file enablerouter.c.

#define SUCCESS_PRINT | ( | X,
 |  | Y,
 |  | Z
 | ) |
Value:
{ \
                printf("%s: %s SUCCEEDED: Return %lu: line %d\n",X,Y,Z, __LINE__); \
                fflush(stdout); \
                }

Definition at line 21 of file enablerouter.c.

Function Documentation

DWORD WINAPI AllNullParamCase ( LPVOID lpNotUsed )

Definition at line 636 of file enablerouter.c.

{
  ZeroMemory(&Overlapped, sizeof(Overlapped));
  Overlapped.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
  if (!Overlapped.hEvent)
  {
    FAIL_PRINT("Regression Test 3.3", "CreateEvent", GetLastError());
  }
  else
  {
    SUCCESS_PRINT("Regression Test 3.3", "CreateEvent", GetLastError());
    printf("Regression Test 3.3: Call to EnableRouter(NULL, NULL) is expected to block\n");
    Error = EnableRouter(NULL, NULL);
    if (Error != ERROR_IO_PENDING)
    {
      FAIL_PRINT("Regression Test 3.3", "EnableRouter", Error);
    }
    else
    {
      SUCCESS_PRINT("Regression Test 3.3", "EnableRouter", Error);
      Error = UnenableRouter(&Overlapped, &Count);
      if (Error)
      {
        FAIL_PRINT("Regression Test 3.3", "UnenableRouter", Error);
      }
      else
      {
        SUCCESS_PRINT("Regression Test 3.3", "UnenableRouter", Error);
        printf("Regression Test 3.3: UnenableRouter: %d references left\n", Count);
      }
    }
    CloseHandle(Overlapped.hEvent);
  }
  return RETURN_FAILURE;
}

void CommandLineUsage ( void )

Definition at line 544 of file enablerouter.c.

{
   fprintf( stderr, "\nEnableRouter [stress, regress]\n\n" );
   fprintf( stderr, "  'enablerouter' with no parameters will step through one iteration of\n" );
   fprintf( stderr, "                 enabling and disabling the router\n\n" );
   fprintf( stderr, "  'enablerouter stress' will enable and disable the router in an infinite loop\n\n" );
   fprintf( stderr, "  'enablerouter regress' will perform the EnableRouter() and UnenableRouter()\n" );
   fprintf( stderr, "                         regression tests\n\n" );
   fprintf( stderr, "  Any other parameter will display this help message\n\n" );
}

DWORD ( WINAPI * EnableRouter )
int __cdecl main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 48 of file enablerouter.c.

{
  Hinstance = LoadLibrary(TEXT("IPHLPAPI.DLL"));
    if (!Hinstance)
  {
        printf("LoadLibrary: %d\n", GetLastError());
    return RETURN_FAILURE;
    }
  else
  {
    EnableRouter =
      (DWORD (WINAPI*)(PHANDLE, LPOVERLAPPED))
        GetProcAddress(Hinstance, "EnableRouter");
    UnenableRouter =
      (DWORD (WINAPI*)(LPOVERLAPPED, LPDWORD))
        GetProcAddress(Hinstance, "UnenableRouter");
    if (!EnableRouter || !UnenableRouter)
    {
      printf("GetProcAddress: %d\n", GetLastError());
      return RETURN_FAILURE;
    }
  }

// Step through one iteration if there are no command line switches

  if (argc < 2)
  {
    ZeroMemory(&Overlapped, sizeof(Overlapped));
    Overlapped.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
    if (!Overlapped.hEvent)
    {
      printf("CreateEvent: %d\n", GetLastError());
      return RETURN_FAILURE;
    }
    else
    {
      Error = EnableRouter(&Handle, &Overlapped);
      if (Error != ERROR_IO_PENDING)
      {
        printf("EnableRouter: %d\n", Error);
        return RETURN_FAILURE;
      }
      else
      {
        printf("Press <Enter> to disable routing");
        getchar();
        Error = UnenableRouter(&Overlapped, &Count);
        if (Error)
        {
          printf("UnenableRouter: %d\n", Error);
          return RETURN_FAILURE;
        }
        else
        {
          printf("UnenableRouter: %d references left\n", Count);
        }
      }
      CloseHandle(Overlapped.hEvent);
    }
    FreeLibrary(Hinstance);
    return RETURN_SUCCESS;
  }

// Loop continuously for the 'stress' command line switch

  if ((argv[1][0] == 's') || (argv[1][0] == 'S'))
  {
    i = 1;
    while (TRUE)
    {
      ZeroMemory(&Overlapped, sizeof(Overlapped));
      Overlapped.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
      if (!Overlapped.hEvent)
      {
        printf("CreateEvent: %d\n", GetLastError());
        return RETURN_FAILURE;
      }
      else
      {
        Error = EnableRouter(&Handle, &Overlapped);
        if (Error != ERROR_IO_PENDING)
        {
          printf("EnableRouter: %d\n", Error);
        }
        else
        {
          Error = UnenableRouter(&Overlapped, &Count);
          if (Error)
          {
            printf("UnenableRouter: %d\n", Error);
          }
          else
          {
            if ((i % 100) == 0)
            {
              printf("Enable/UnenableRouter Stress: %d iterations\n", i);
            }
            i++;
          }
        }
        CloseHandle(Overlapped.hEvent);
      }
    }
    FreeLibrary(Hinstance);
    return RETURN_SUCCESS;
  }

// Run the API regressions for the 'regress' command line switch

  if ((argv[1][0] == 'r') || (argv[1][0] == 'R'))
  {
    srand( (unsigned)time( NULL ) );
    rand();        // throw out the first number because of its predictability

// Regression test EnableRouter()

    printf("\n\n\tRegression tests for EnableRouter()\n\n");

// Test 1: Do not zero memory for the Overlapped structure

    printf("\nRegression Test 1: Do not zero memory for the Overlapped structure\n");

    printf("\nRegression Test 1: ZeroMemory(&Overlapped, sizeof(Overlapped)) NOT called\n");

    Overlapped.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
    if (!Overlapped.hEvent)
    {
      FAIL_PRINT("Regression Test 1", "CreateEvent", GetLastError());
    }
    else
    {
      SUCCESS_PRINT("Regression Test 1", "CreateEvent", GetLastError());
      Error = EnableRouter(&Handle, &Overlapped);
      if (Error != ERROR_IO_PENDING)
      {
        FAIL_PRINT("Regression Test 1", "EnableRouter", Error);
      }
      else
      {
        SUCCESS_PRINT("Regression Test 1", "EnableRouter", Error);
        Error = UnenableRouter(&Overlapped, &Count);
        if (Error)
        {
          FAIL_PRINT("Regression Test 1", "UnenableRouter", Error);
        }
        else
        {
          SUCCESS_PRINT("Regression Test 1", "UnenableRouter", Error);
          printf("Regression Test 1: UnenableRouter: %d references left\n", Count);
        }
      }
      CloseHandle(Overlapped.hEvent);
    }

// Test 2: Overlapped.hEvent is zero

    printf("\nRegression Test 2: Set Overlapped.hEvent equal to zero\n");

    printf("\nRegression Test 2: Overlapped.hEvent = 0\n");

    ZeroMemory(&Overlapped, sizeof(Overlapped));
    Overlapped.hEvent = 0;
    Error = EnableRouter(&Handle, &Overlapped);
    if (Error != ERROR_IO_PENDING)
    {
      FAIL_PRINT("Regression Test 2", "EnableRouter", Error);
    }
    else
    {
      SUCCESS_PRINT("Regression Test 2", "EnableRouter", Error);
      Error = UnenableRouter(&Overlapped, &Count);
      if (Error)
      {
        FAIL_PRINT("Regression Test 2", "UnenableRouter", Error);
      }
      else
      {
        SUCCESS_PRINT("Regression Test 2", "UnenableRouter", Error);
        printf("Regression Test 2: UnenableRouter: %d references left\n", Count);
      }
    }

// Test 3: Pass NULL parameters to EnableRouter()

    printf("\nRegression Test 3: Pass NULL parameters to EnableRouter()\n");

    printf("\nRegression Test 3.1: EnableRouter(NULL, &Overlapped)\n");

    hThread = NULL;
    dwThreadId = 0;
    hThread = CreateThread(NULL, 0, NullHandleCase, NULL, CREATE_SUSPENDED, &dwThreadId);
    if (hThread == NULL)
    {
      FAIL_PRINT("Regression Test 3.1", "CreateThread", GetLastError());
    }
    else
    {
      Error = ResumeThread(hThread);
      if (Error == 0xFFFFFFFF)
      {
        FAIL_PRINT("Regression Test 3.1", "ResumeThread", GetLastError());
      }
      else
      {
        Error = WaitForSingleObject(hThread, 10000);  // wait 10 seconds for thread to complete
        if ((Error == WAIT_FAILED) || (Error == WAIT_ABANDONED))
        {
          FAIL_PRINT("Regression Test 3.1", "WaitForSingleObject", GetLastError());
        }
        if (Error == WAIT_OBJECT_0)
        {
          FAIL_PRINT("Regression Test 3.1", "WaitForSingleObject", GetLastError());
          printf("Regression Test 3.1: WAIT_OBJECT_0 was unexpected\n");
        }
        if (Error == WAIT_TIMEOUT)
        {
          SUCCESS_PRINT("Regression Test 3.1", "WaitForSingleObject", Error);
          printf("Regression Test 3.1: WAIT_TIMEOUT was expected\n");
        }
      }
      CloseHandle(hThread);
    }

    printf("\nRegression Test 3.2: EnableRouter(&Handle, NULL)\n");

    hThread = NULL;
    dwThreadId = 0;
    hThread = CreateThread(NULL, 0, NullOverlappedCase, NULL, CREATE_SUSPENDED, &dwThreadId);
    if (hThread == NULL)
    {
      FAIL_PRINT("Regression Test 3.2", "CreateThread", GetLastError());
    }
    else
    {
      Error = ResumeThread(hThread);
      if (Error == 0xFFFFFFFF)
      {
        FAIL_PRINT("Regression Test 3.2", "ResumeThread", GetLastError());
      }
      else
      {
        Error = WaitForSingleObject(hThread, 10000);  // wait 10 seconds for thread to complete
        if ((Error == WAIT_FAILED) || (Error == WAIT_ABANDONED))
        {
          FAIL_PRINT("Regression Test 3.2", "WaitForSingleObject", GetLastError());
        }
        if (Error == WAIT_OBJECT_0)
        {
          FAIL_PRINT("Regression Test 3.2", "WaitForSingleObject", GetLastError());
          printf("Regression Test 3.2: WAIT_OBJECT_0 was unexpected\n");
        }
        if (Error == WAIT_TIMEOUT)
        {
          SUCCESS_PRINT("Regression Test 3.2", "WaitForSingleObject", Error);
          printf("Regression Test 3.2: WAIT_TIMEOUT was expected\n");
        }
      }
      CloseHandle(hThread);
    }

    printf("\nRegression Test 3.3: EnableRouter(NULL, NULL)\n");

    hThread = NULL;
    dwThreadId = 0;
    hThread = CreateThread(NULL, 0, AllNullParamCase, NULL, CREATE_SUSPENDED, &dwThreadId);
    if (hThread == NULL)
    {
      FAIL_PRINT("Regression Test 3.3", "CreateThread", GetLastError());
    }
    else
    {
      Error = ResumeThread(hThread);
      if (Error == 0xFFFFFFFF)
      {
        FAIL_PRINT("Regression Test 3.3", "ResumeThread", GetLastError());
      }
      else
      {
        Error = WaitForSingleObject(hThread, 10000);  // wait 10 seconds for thread to complete
        if ((Error == WAIT_FAILED) || (Error == WAIT_ABANDONED))
        {
          FAIL_PRINT("Regression Test 3.3", "WaitForSingleObject", GetLastError());
        }
        if (Error == WAIT_OBJECT_0)
        {
          FAIL_PRINT("Regression Test 3.3", "WaitForSingleObject", GetLastError());
          printf("Regression Test 3.3: WAIT_OBJECT_0 was unexpected\n");
        }
        if (Error == WAIT_TIMEOUT)
        {
          SUCCESS_PRINT("Regression Test 3.3", "WaitForSingleObject", Error);
          printf("Regression Test 3.3: WAIT_TIMEOUT was expected\n");
        }
      }
      CloseHandle(hThread);
    }

// Test 4: Pass bad pointers, unreadable or unwriteable, to EnableRouter()

    printf("\nRegression Test 4: Pass bad pointers to EnableRouter()\n");

    printf("\nRegression Test 4.1: EnableRouter((unwriteable pointer), &Overlapped)\n");

    ZeroMemory(&Overlapped, sizeof(Overlapped));
    Overlapped.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
    if (!Overlapped.hEvent)
    {
      FAIL_PRINT("Regression Test 4.1", "CreateEvent", GetLastError());
    }
    else
    {
      SUCCESS_PRINT("Regression Test 4.1", "CreateEvent", GetLastError());
      Error = EnableRouter((HANDLE *)UnwriteableRand(sizeof(Handle), "Regression Test 4.1"), &Overlapped);
      if (Error == ERROR_INVALID_PARAMETER)
      {
        SUCCESS_PRINT("Regression Test 4.1", "EnableRouter", Error);
        printf("Regression Test 4.1: ERROR_INVALID_PARAMETER was expected\n");
      }
      else
      {
        if (Error == ERROR_IO_PENDING)
        {
          FAIL_PRINT("Regression Test 4.1", "EnableRouter", Error);
          printf("Regression Test 4.1: ERROR_IO_PENDING was unexpected\n");
          Error = UnenableRouter(&Overlapped, &Count);
          if (Error)
          {
            FAIL_PRINT("Regression Test 4.1", "UnenableRouter", Error);
          }
          else
          {
            SUCCESS_PRINT("Regression Test 4.1", "UnenableRouter", Error);
            printf("Regression Test 4.1: UnenableRouter: %d references left\n", Count);
          }
        }
        else
        {
          FAIL_PRINT("Regression Test 4.1", "EnableRouter", Error);
          printf("Regression Test 4.1: This ERROR?? was unexpected\n");
        }
      }
      CloseHandle(Overlapped.hEvent);
    }

    printf("\nRegression Test 4.2: EnableRouter(&Handle, (unreadable pointer))\n");

    ZeroMemory(&Overlapped, sizeof(Overlapped));
    Overlapped.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
    if (!Overlapped.hEvent)
    {
      FAIL_PRINT("Regression Test 4.2", "CreateEvent", GetLastError());
    }
    else
    {
      SUCCESS_PRINT("Regression Test 4.2", "CreateEvent", GetLastError());
      Error = EnableRouter(&Handle, (OVERLAPPED *)UnreadableRand(sizeof(Overlapped), "Regression Test 4.2"));
      if (Error == ERROR_INVALID_PARAMETER)
      {
        SUCCESS_PRINT("Regression Test 4.2", "EnableRouter", Error);
        printf("Regression Test 4.2: ERROR_INVALID_PARAMETER was expected\n");
      }
      else
      {
        if (Error == ERROR_IO_PENDING)
        {
          FAIL_PRINT("Regression Test 4.2", "EnableRouter", Error);
          printf("Regression Test 4.2: ERROR_IO_PENDING was unexpected\n");
          Error = UnenableRouter(&Overlapped, &Count);
          if (Error)
          {
            FAIL_PRINT("Regression Test 4.2", "UnenableRouter", Error);
          }
          else
          {
            SUCCESS_PRINT("Regression Test 4.2", "UnenableRouter", Error);
            printf("Regression Test 4.2: UnenableRouter: %d references left\n", Count);
          }
        }
        else
        {
          FAIL_PRINT("Regression Test 4.2", "EnableRouter", Error);
          printf("Regression Test 4.2: This ERROR?? was unexpected\n");
        }
      }
      CloseHandle(Overlapped.hEvent);
    }

    printf("\nRegression Test 4.3: EnableRouter((unwritable pointer), (unreadable pointer))\n");

    ZeroMemory(&Overlapped, sizeof(Overlapped));
    Overlapped.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
    if (!Overlapped.hEvent)
    {
      FAIL_PRINT("Regression Test 4.3", "CreateEvent", GetLastError());
    }
    else
    {
      SUCCESS_PRINT("Regression Test 4.3", "CreateEvent", GetLastError());
      Error = EnableRouter((HANDLE *)UnwriteableRand(sizeof(Handle), "Regression Test 4.3"),
                (OVERLAPPED *)UnreadableRand(sizeof(Overlapped), "Regression Test 4.3"));
      if (Error == ERROR_INVALID_PARAMETER)
      {
        SUCCESS_PRINT("Regression Test 4.3", "EnableRouter", Error);
        printf("Regression Test 4.3: ERROR_INVALID_PARAMETER was expected\n");
      }
      else
      {
        if (Error == ERROR_IO_PENDING)
        {
          FAIL_PRINT("Regression Test 4.3", "EnableRouter", Error);
          printf("Regression Test 4.3: ERROR_IO_PENDING was unexpected\n");
          Error = UnenableRouter(&Overlapped, &Count);
          if (Error)
          {
            FAIL_PRINT("Regression Test 4.3", "UnenableRouter", Error);
          }
          else
          {
            SUCCESS_PRINT("Regression Test 4.3", "UnenableRouter", Error);
            printf("Regression Test 4.3: UnenableRouter: %d references left\n", Count);
          }
        }
        else
        {
          FAIL_PRINT("Regression Test 4.3", "EnableRouter", Error);
          printf("Regression Test 4.3: This ERROR?? was unexpected\n");
        }
      }
      CloseHandle(Overlapped.hEvent);
    }

// Regression test UnenableRouter()

    printf("\n\n\tRegression tests for UnenableRouter()\n\n");

// Test 5: Use an Overlapped that is different from the one used for EnableRouter

    printf("\nRegression Test 5: Use a different Overlapped than the one used for EnableRouter\n");

    printf("\nRegression Test 5: Declare OVERLAPPED OverlappedUnenableRouter\n");

    ZeroMemory(&Overlapped, sizeof(Overlapped));
    Overlapped.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
    if (!Overlapped.hEvent)
    {
      FAIL_PRINT("Regression Test 5", "CreateEvent", GetLastError());
    }
    else
    {
      SUCCESS_PRINT("Regression Test 5", "CreateEvent", GetLastError());
      Error = EnableRouter(&Handle, &Overlapped);
      if (Error != ERROR_IO_PENDING)
      {
        FAIL_PRINT("Regression Test 5", "EnableRouter", Error);
      }
      else
      {
        SUCCESS_PRINT("Regression Test 5", "EnableRouter", Error);
        ZeroMemory(&OverlappedUnenableRouter, sizeof(OverlappedUnenableRouter));
        OverlappedUnenableRouter.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
        if (!OverlappedUnenableRouter.hEvent)
        {
          FAIL_PRINT("Regression Test 5", "CreateEvent", GetLastError());
        }
        else
        {
          SUCCESS_PRINT("Regression Test 5", "CreateEvent", GetLastError());
          Error = UnenableRouter(&OverlappedUnenableRouter, &Count);
          if (Error)
          {
            FAIL_PRINT("Regression Test 5", "UnenableRouter", Error);
          }
          else
          {
            SUCCESS_PRINT("Regression Test 5", "UnenableRouter", Error);
            printf("Regression Test 5: UnenableRouter: %d references left\n", Count);
          }
          CloseHandle(OverlappedUnenableRouter.hEvent);
        }
      }
      CloseHandle(Overlapped.hEvent);
    }

    FreeLibrary(Hinstance);
    return RETURN_SUCCESS;
  }
  CommandLineUsage();
  FreeLibrary(Hinstance);
  return RETURN_FAILURE;
}

DWORD WINAPI NullHandleCase ( LPVOID lpNotUsed )

Definition at line 558 of file enablerouter.c.

{
  ZeroMemory(&Overlapped, sizeof(Overlapped));
  Overlapped.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
  if (!Overlapped.hEvent)
  {
    FAIL_PRINT("Regression Test 3.1", "CreateEvent", GetLastError());
  }
  else
  {
    SUCCESS_PRINT("Regression Test 3.1", "CreateEvent", GetLastError());
    printf("Regression Test 3.1: Call to EnableRouter(NULL, &Overlapped) is expected to block\n");
    Error = EnableRouter(NULL, &Overlapped);
    if (Error != ERROR_IO_PENDING)
    {
      FAIL_PRINT("Regression Test 3.1", "EnableRouter", Error);
    }
    else
    {
      SUCCESS_PRINT("Regression Test 3.1", "EnableRouter", Error);
      Error = UnenableRouter(&Overlapped, &Count);
      if (Error)
      {
        FAIL_PRINT("Regression Test 3.1", "UnenableRouter", Error);
      }
      else
      {
        SUCCESS_PRINT("Regression Test 3.1", "UnenableRouter", Error);
        printf("Regression Test 3.1: UnenableRouter: %d references left\n", Count);
      }
    }
    CloseHandle(Overlapped.hEvent);
  }
  return RETURN_FAILURE;
}

DWORD WINAPI NullOverlappedCase ( LPVOID lpNotUsed )

Definition at line 597 of file enablerouter.c.

{
  ZeroMemory(&Overlapped, sizeof(Overlapped));
  Overlapped.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
  if (!Overlapped.hEvent)
  {
    FAIL_PRINT("Regression Test 3.2", "CreateEvent", GetLastError());
  }
  else
  {
    SUCCESS_PRINT("Regression Test 3.2", "CreateEvent", GetLastError());
    printf("Regression Test 3.2: Call to EnableRouter(&Handle, NULL) is expected to block\n");
    Error = EnableRouter(&Handle, NULL);
    if (Error != ERROR_IO_PENDING)
    {
      FAIL_PRINT("Regression Test 3.2", "EnableRouter", Error);
    }
    else
    {
      SUCCESS_PRINT("Regression Test 3.2", "EnableRouter", Error);
      Error = UnenableRouter(&Overlapped, &Count);
      if (Error)
      {
        FAIL_PRINT("Regression Test 3.2", "UnenableRouter", Error);
      }
      else
      {
        SUCCESS_PRINT("Regression Test 3.2", "UnenableRouter", Error);
        printf("Regression Test 3.2: UnenableRouter: %d references left\n", Count);
      }
    }
    CloseHandle(Overlapped.hEvent);
  }
  return RETURN_FAILURE;
}

int UnreadableRand | ( | size_t | length,
 |  | char | szTestNumber[MAX_STRLEN]
 | ) |  |

Definition at line 674 of file enablerouter.c.

{
    int RandVal;
  for (i = 1; i < 5001; i++)
    {
      RandVal = rand();
    if (IsBadReadPtr((CONST VOID *)RandVal, (UINT)length) != 0)
    {
      printf("%s: Returning an UNREADABLE pointer\n", szTestNumber);
      return RandVal;
    }
    }
  printf("%s: Returning a READABLE pointer\n", szTestNumber);
    return RandVal;
}

int UnwriteableRand | ( | size_t | length,
 |  | char | szTestNumber[MAX_STRLEN]
 | ) |  |

Definition at line 693 of file enablerouter.c.

{
    int RandVal;
  for (i = 1; i < 5001; i++)
    {
      RandVal = rand();
    if (IsBadWritePtr((LPVOID)RandVal, (UINT)length) != 0)
    {
      printf("%s: Returning an UNWRITEABLE pointer\n", szTestNumber);
      return RandVal;
    }
    }
    printf("%s: Returning a WRITEABLE pointer\n", szTestNumber);
  return RandVal;
}

Variable Documentation

HRESULT _stdcall Count

Definition at line 32 of file enablerouter.c.

DWORD dwThreadId

Definition at line 32 of file enablerouter.c.

DWORD Error

Definition at line 32 of file enablerouter.c.

HANDLE Handle

Definition at line 33 of file enablerouter.c.

HINSTANCE Hinstance

Definition at line 31 of file enablerouter.c.

HANDLE hThread

Definition at line 33 of file enablerouter.c.

INT i

Definition at line 35 of file enablerouter.c.

LPDWORD

Definition at line 37 of file enablerouter.c.

LPOVERLAPPED

Definition at line 36 of file enablerouter.c.

OVERLAPPED Overlapped

Definition at line 34 of file enablerouter.c.

OVERLAPPED OverlappedUnenableRouter

Definition at line 34 of file enablerouter.c.

Generated on Wed Nov 13 2024 16:53:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/IPHelp/IPArp/IPArp.Cpp File Reference

  • NetDS
  • IPHelp
  • IPArp
Functions

IPArp.Cpp File Reference

#include "IpArp.h"

Go to the source code of this file.

Functions

void | DoDeleteIpNetEntry (char *pszDottedInetAddr, char *pszInterface)
void | DoGetIpNetTable ()
void | DoSetIpNetEntry (char *pszDottedInetAddr, char *pszPhysAddr, char *pszInterface)
bool | InterfaceIdxToInterfaceIp (PMIB_IPADDRTABLE pIpAddrTable, DWORD dwIndex, char str[])
void _cdecl | main (int argc, char **argv)
DWORD | MyGetIpAddrTable (PMIB_IPADDRTABLE &pIpAddrTable, bool fOrder)
DWORD | MyGetIpNetTable (PMIB_IPNETTABLE &pIpNetTable, bool fOrder)
bool | PhysAddrToString (BYTE PhysAddr[], DWORD PhysAddrLen, char str[])
void | PrintIpAddrTable (PMIB_IPADDRTABLE pIpAddrTable)
void | PrintIpNetTable (PMIB_IPNETTABLE pIpNetTable)
int | StringToPhysAddr (char *szInEther, char *szOutEther)
void | Usage (char *pszProgramName)

Function Documentation

void DoDeleteIpNetEntry | ( | char * | pszDottedInetAddr,
 |  | char * | pszInterface
 | ) |  |

Definition at line 190 of file IPArp.Cpp.

{
    DWORD dwInetAddr = 0; // ip address
    DWORD dwStatus;

    if (pszDottedInetAddr == NULL)
    {
        printf("IpArp: Bad Argument\n");
        return;
    }
    dwInetAddr = inet_addr(pszDottedInetAddr); // convert dotted ip addr. to ip addr.
    if (dwInetAddr == INADDR_NONE)
    {
        printf("IpArp: Bad Argument %s\n", pszDottedInetAddr);
        return;
    }

    MIB_IPNETROW arpEntry; // an arp entry
    if (pszInterface)
    {
        // User provides a interface index number
        sscanf(pszInterface, "%X",&(arpEntry.dwIndex));
    }
    else
    {
        // try to delete this from first available interface
        PMIB_IPADDRTABLE pIpAddrTable = NULL;
        if ( (dwStatus = MyGetIpAddrTable(pIpAddrTable)) != NO_ERROR)
        {
            printf("IpArp: Couldn't find a interface number to add your arp entry\n");
            return;
        }
        arpEntry.dwIndex = pIpAddrTable->table[0].dwIndex;
        free(pIpAddrTable);
    }

    arpEntry.dwAddr = dwInetAddr;
    dwStatus = DeleteIpNetEntry(&arpEntry);
    if (dwStatus != NO_ERROR)
    {
        printf("IpArp: couldn't delete (%s), dwStatus = %lu.\n",
                    pszDottedInetAddr, dwStatus);
    }

}

void DoGetIpNetTable ( )

Definition at line 99 of file IPArp.Cpp.

{
    DWORD dwStatus;
    PMIB_IPNETTABLE pIpArpTab = NULL;

    if ( (dwStatus = MyGetIpNetTable(pIpArpTab, TRUE)) == NO_ERROR)
    {
        PrintIpNetTable(pIpArpTab);
        free(pIpArpTab);
        return;
    }
    else if ( dwStatus == ERROR_NO_DATA)
    {
        printf("No entries in arp cache.\n");
        if (pIpArpTab)
            free (pIpArpTab);
        return;
    }
    else
    {
        if (pIpArpTab)
            free (pIpArpTab);
        printf("IpArp returned 0x%x\n", dwStatus);
        return;
    }

}

void DoSetIpNetEntry | ( | char * | pszDottedInetAddr,
 |  | char * | pszPhysAddr,
 |  | char * | pszInterface
 | ) |  |

Definition at line 133 of file IPArp.Cpp.

{
    DWORD dwInetAddr = 0; // ip address
    DWORD dwStatus;
    BYTE bPhysAddr[MAXLEN_PHYSADDR];

    if (pszDottedInetAddr == NULL || pszPhysAddr == NULL)
    {
        printf("IpArp: Bad Argument\n");
        return;
    }

    dwInetAddr = inet_addr(pszDottedInetAddr); // convert dotted ip addr. to ip addr.
    if (dwInetAddr == INADDR_NONE)
    {
        printf("IpArp: Bad Argument %s\n", pszDottedInetAddr);
        return;
    }

    if (StringToPhysAddr(pszPhysAddr, (char*)bPhysAddr ) != 0)
    {
        printf("IpArp: Bad Argument %s\n", pszPhysAddr);
        return;
    }
    MIB_IPNETROW arpEntry; // an arp entry
    if (pszInterface)
    {
        // User provides a interface index number
        sscanf(pszInterface, "%X",&(arpEntry.dwIndex));
    }
    else
    {
        // add this to the first available interface
        PMIB_IPADDRTABLE pIpAddrTable = NULL;
        if ( (dwStatus = MyGetIpAddrTable(pIpAddrTable)) != NO_ERROR)
        {
            printf("IpArp: Couldn't find a interface number to add your arp entry\n");
            return;
        }
        arpEntry.dwIndex = pIpAddrTable->table[0].dwIndex;
        free(pIpAddrTable);
    }
    arpEntry.dwPhysAddrLen = 6;
    memcpy(arpEntry.bPhysAddr, bPhysAddr, 6);
    arpEntry.dwAddr = dwInetAddr;
    arpEntry.dwType = MIB_IPNET_TYPE_STATIC; //static arp entry
    dwStatus = SetIpNetEntry(&arpEntry);
    if (dwStatus != NO_ERROR)
    {
        printf("IpArp: couldn't add (%s, %s), dwStatus = %lu.\n",
                    pszDottedInetAddr, pszPhysAddr, dwStatus);
    }
}

bool InterfaceIdxToInterfaceIp | ( | PMIB_IPADDRTABLE | pIpAddrTable,
 |  | DWORD | dwIndex,
 |  | char | str[]
 | ) |  |

Definition at line 241 of file IPArp.Cpp.

{
    struct in_addr inadTmp;
    char* szIpAddr;

    if (pIpAddrTable == NULL ||  str == NULL)
        return FALSE;
    str[0] = '\0';
    for (DWORD dwIdx = 0; dwIdx < pIpAddrTable->dwNumEntries; dwIdx++)
    {
        if (dwIndex == pIpAddrTable->table[dwIdx].dwIndex)
        {
            inadTmp.s_addr = pIpAddrTable->table[dwIdx].dwAddr;
            szIpAddr = inet_ntoa(inadTmp);
            if (szIpAddr)
            {
                strcpy(str, szIpAddr);
                return TRUE;
            }
            else
                return FALSE;
        }
    }
    return FALSE;

}

void _cdecl main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 47 of file IPArp.Cpp.

{
    WORD wVersionRequested = MAKEWORD(1,1);
    WSADATA wsaData;
    int nRet;

    nRet = WSAStartup(wVersionRequested, &wsaData);
    if (wsaData.wVersion != wVersionRequested)
    {
        fprintf(stderr,"\n Wrong version\n");
        return;
    }

    if ((argc < 2) || (argv[1][0] != '-'))
        Usage("IpArp");
    if (strlen(argv[1]) > 2)
        Usage("IpArp");

    switch(argv[1][1])
    {
    case 'a':
        // Print arp table
        DoGetIpNetTable();
        break;
    case 's':
        //Update or add an ARP Internet/Ethernet Address entry
        if (argc == 4)
            DoSetIpNetEntry(argv[2], argv[3]);
        else if (argc == 5)
            DoSetIpNetEntry(argv[2], argv[3], argv[4]);
        else
            Usage("IpArp");
        break;
    case 'd':
        //Delete an Internet/Ethernet Address pair from the ARP table
        if (argc == 3)
            DoDeleteIpNetEntry(argv[2]);
        else if (argc == 4)
            DoDeleteIpNetEntry(argv[2], argv[3]);
        else
            Usage("IpArp");
        break;
    default:
        // help
        Usage("IpArp");
        break;
    }
    WSACleanup();
}

DWORD MyGetIpAddrTable | ( | PMIB_IPADDRTABLE & | pIpAddrTable,
 |  | bool | fOrder
 | ) |  |

Definition at line 461 of file IPArp.Cpp.

{
    DWORD status = NO_ERROR;
    DWORD statusRetry = NO_ERROR;
    DWORD dwActualSize = 0;

    // query for buffer size needed
    status = GetIpAddrTable(pIpAddrTable, &dwActualSize, fOrder);

    if (status == NO_ERROR)
    {
        printf("No error\n");
        return status;
    }
    else if (status == ERROR_INSUFFICIENT_BUFFER)
    {
        // need more space

        pIpAddrTable = (PMIB_IPADDRTABLE) malloc(dwActualSize);
        assert(pIpAddrTable);

        statusRetry = GetIpAddrTable(pIpAddrTable, &dwActualSize, fOrder);
        return statusRetry;
    }
    else
    {
        return status;
    }
}

DWORD MyGetIpNetTable | ( | PMIB_IPNETTABLE & | pIpNetTable,
 |  | bool | fOrder
 | ) |  |

Definition at line 496 of file IPArp.Cpp.

{
    DWORD status = NO_ERROR;
    DWORD statusRetry = NO_ERROR;
    DWORD dwActualSize = 0;

    // query for buffer size needed
    dwActualSize = 0;
    status = GetIpNetTable(pIpNetTable, &dwActualSize, fOrder);

    if (status == NO_ERROR)
    {
        return status;
    }
    else if (status == ERROR_INSUFFICIENT_BUFFER)
    {
        // need more space

        pIpNetTable = (PMIB_IPNETTABLE) malloc(dwActualSize);
        assert(pIpNetTable);

        statusRetry = GetIpNetTable(pIpNetTable, &dwActualSize, fOrder);

        if (statusRetry != NO_ERROR)
        {
#ifdef _DEBUG
            printf("Retry failed.\n");
#endif
            return statusRetry;
        }
        else
        {
            return statusRetry;
        }
    }
    else
    {
#ifdef _DEBUG
        printf("first getipnettable call failed\n");
#endif
        return status;
    }
}

bool PhysAddrToString | ( | BYTE | PhysAddr[],
 |  | DWORD | PhysAddrLen,
 |  | char | str[]
 | ) |  |

Definition at line 315 of file IPArp.Cpp.

{
    if (PhysAddr == NULL || PhysAddrLen == 0 || str == NULL)
        return FALSE;
    str[0] = '\0';
    for (DWORD dwIdx = 0; dwIdx < PhysAddrLen; dwIdx++)
    {
        if (dwIdx == PhysAddrLen-1)
            sprintf(str+(dwIdx*3), "%02X", ((int)PhysAddr[dwIdx])&0xff);
        else
            sprintf(str+(dwIdx*3), "%02X-", ((int)PhysAddr[dwIdx])&0xff);

    }
    return TRUE;
}

void PrintIpAddrTable ( PMIB_IPADDRTABLE pIpAddrTable )

Definition at line 427 of file IPArp.Cpp.

{
    DWORD i;
    struct in_addr inadTmp1;
    struct in_addr inadTmp2;
    char szAddr[128];
    char szMask[128];

    if (pIpAddrTable == NULL)
    {
        printf( "pIpAddrTable == NULL in line %d\n", __LINE__);
        return;
    }
    printf("ipAdEntAddr\t ifAdEntIfIndex\t ipAdEntNetMask\t ipAdEntBcastAddr\t ipAdEntReasmMaxSize\n");
    for (i = 0; i < pIpAddrTable->dwNumEntries; ++i)
    {
        inadTmp1.s_addr = pIpAddrTable->table[i].dwAddr;
        strcpy(szAddr, inet_ntoa(inadTmp1));
        inadTmp2.s_addr = pIpAddrTable->table[i].dwMask;
        strcpy(szMask, inet_ntoa(inadTmp2));
        printf("  %s\t 0x%X\t %s\t %s\t %u\n",
                szAddr,
                pIpAddrTable->table[i].dwIndex,
                szMask,
                (pIpAddrTable->table[i].dwBCastAddr ? "255.255.255.255" : "0.0.0.0"),
                pIpAddrTable->table[i].dwReasmSize);

    }
}

void PrintIpNetTable ( PMIB_IPNETTABLE pIpNetTable )

Definition at line 341 of file IPArp.Cpp.

{
    DWORD i, dwStatus, dwCurrIndex;
    struct in_addr inadTmp;
    char szPrintablePhysAddr[256];
    char szType[128];
    char szIpAddr[128];
    PMIB_IPADDRTABLE pIpAddrTable = NULL;

    if (pIpNetTable == NULL)
    {
        printf( "pIpNetTable == NULL in line %d\n", __LINE__);
        return;
    }
    // get IP Address Table for mapping interface index number to ip address
    if ( (dwStatus = MyGetIpAddrTable(pIpAddrTable)) != NO_ERROR)
    {
        printf("GetIpAddrTable returned 0x%x\n", dwStatus);
        if (pIpAddrTable)
            free(pIpAddrTable);
        return;
    }
    assert(pIpAddrTable);
    // Note: the ARP table should be sorted in interface index
    dwCurrIndex = pIpNetTable->table[0].dwIndex;
    if (InterfaceIdxToInterfaceIp(pIpAddrTable, dwCurrIndex, szIpAddr))
    {
        printf("\nInterface: %s on Interface 0x%X\n", szIpAddr, dwCurrIndex);
        printf("  Internet Address      Physical Address      Type\n");
    }
    else
    {
        printf("Error: Could not convert Interface number 0x%X to IP address.\n",
                    pIpNetTable->table[0].dwIndex);
        return;
    }

    for (i = 0; i < pIpNetTable->dwNumEntries; ++i)
    {
        if (pIpNetTable->table[i].dwIndex != dwCurrIndex)
        {
            dwCurrIndex = pIpNetTable->table[i].dwIndex;
            if (InterfaceIdxToInterfaceIp(pIpAddrTable, dwCurrIndex, szIpAddr))
            {
                printf("Interface: %s on Interface 0x%X\n", szIpAddr, dwCurrIndex);
                printf("  Internet Address      Physical Address      Type\n");
            }
            else
            {
                printf("Error: Could not convert Interface number 0x%X to IP address.\n",
                    pIpNetTable->table[0].dwIndex);
                return;
            }
        }
        PhysAddrToString(pIpNetTable->table[i].bPhysAddr, pIpNetTable->table[i].dwPhysAddrLen, szPrintablePhysAddr);
        inadTmp.s_addr = pIpNetTable->table[i].dwAddr;
        switch (pIpNetTable->table[i].dwType)
        {
        case 1:
            strcpy(szType,"other");
            break;
        case 2:
            strcpy(szType,"invalidated");
            break;
        case 3:
            strcpy(szType,"dynamic");
            break;
        case 4:
            strcpy(szType,"static");
            break;
        default:
            strcpy(szType,"invalidType");
        }
        printf("  %-16s      %-17s     %-11s\n", inet_ntoa(inadTmp), szPrintablePhysAddr, szType);

    }
    if (pIpAddrTable)
        free(pIpAddrTable);
}

int StringToPhysAddr | ( | char * | szInEther,
 |  | char * | szOutEther
 | ) |  |

Definition at line 273 of file IPArp.Cpp.

{
    const char DASH = '-';
    register char c;
    register int val;

    // check szInEther for the correct format
    if (strlen(szInEther) != 17)
        return (-1);
    if (szInEther[2] != DASH || szInEther[5] != DASH || szInEther[8] != DASH ||
        szInEther[8] != DASH || szInEther[14] != DASH)
        return (-1);
    if (!isxdigit(szInEther[0]) || !isxdigit(szInEther[1]) ||
        !isxdigit(szInEther[3]) || !isxdigit(szInEther[4]) ||
        !isxdigit(szInEther[6]) || !isxdigit(szInEther[7]) ||
        !isxdigit(szInEther[9]) || !isxdigit(szInEther[10]) ||
        !isxdigit(szInEther[12]) || !isxdigit(szInEther[13]) ||
        !isxdigit(szInEther[15]) || !isxdigit(szInEther[16]))
        return (-1);
    // convert the 12 hex decimals back to 6 digit decimals
    for (int i = 0; i < 6; i++)
    {
        val = 0;
        c = toupper(szInEther[i*3]);
        c = c - (isdigit(c) ? '0' : ('A' - 10)); //offset adjustment
        val += c;
        val = (val << 4); // val * 16
        c = toupper(szInEther[i*3 + 1]);
        c = c - (isdigit(c) ? '0' : ('A' - 10)); // offset adjustement
        val += c;
        szOutEther[i] = val;
    }
    return (0);
}

void Usage ( char * pszProgramName )

Definition at line 20 of file IPArp.Cpp.

{
    printf("%s -s inet_addr eth_addr [if_addr]\n", pszProgramName);
    printf("%s -d inet_addr [if_addr]\n", pszProgramName);
    printf("%s -a\n", pszProgramName);

    printf("-a            Displays current ARP entries by interrogating the current\n");
    printf("              protocol data.\n");
    printf("-d            Deletes the host specified by inet_addr.\n");
    printf("-s            Adds the host and associates the Internet address inet_addr\n");
    printf("              with the Physical address eth_addr.  The Physical address is\n");
    printf("              given as 6 hexadecimal bytes separated by hyphens. The entry\n");
    printf("              is permanent.\n");
    printf("eth_addr      Specifies a physical address.\n");
    printf("if_addr       If present, this specifies the Internet address of the\n");
    printf("              interface whose address translation table should be modified.\n");
    printf("              If not present, the first applicable interface will be used.\n");
    printf("Example:\n");
    printf("   >IpArp -s 157.55.85.212   00-aa-bb-cc-dd-ee 0x2000003 .... Add a static\n");
    printf("                                  arp entry on interface number 0x2000003.\n");
    printf("   >IpArp -a                                    ....Displays the arp table.\n");
    printf("   >IpArp -d 157.55.85.212                      ....Delete an entry.\n");
    WSACleanup();
    exit(1);
}

Generated on Wed Nov 13 2024 16:53:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/IPHelp/IPArp/IPArp.h File Reference

  • NetDS
  • IPHelp
  • IPArp
Functions

IPArp.h File Reference

#include <windows.h>
#include <winsock.h>
#include <iphlpapi.h>
#include <assert.h>
#include <stdlib.h>
#include <malloc.h>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <iptypes.h>

Go to the source code of this file.

Functions

void | DoDeleteIpNetEntry (char *pszInetAddr, char *pszInterface=NULL)
void | DoGetIpNetTable ()
void | DoSetIpNetEntry (char *pszDottedInetAddr, char *pszPhysAddr, char *pszInterface=NULL)
bool | InterfaceIdxToInterfaceIp (PMIB_IPADDRTABLE pIpAddrTable, DWORD dwIndex, char str[])
DWORD | MyGetIpAddrTable (PMIB_IPADDRTABLE &pIpAddrTable, bool fOrder=FALSE)
DWORD | MyGetIpNetTable (PMIB_IPNETTABLE &pIpArpTab, bool fOrder=FALSE)
bool | PhysAddrToString (BYTE PhysAddr[], DWORD PhysAddrLen, char str[])
void | PrintIpAddrTable (PMIB_IPADDRTABLE pIpAddrTable)
void | PrintIpNetTable (PMIB_IPNETTABLE pIpNetTable)
int | StringToPhysAddr (char *szInEther, char *szOutEther)

Function Documentation

void DoDeleteIpNetEntry | ( | char * | pszInetAddr,
 |  | char * | pszInterface = NULL
 | ) |  |

Definition at line 190 of file IPArp.Cpp.

{
    DWORD dwInetAddr = 0; // ip address
    DWORD dwStatus;

    if (pszDottedInetAddr == NULL)
    {
        printf("IpArp: Bad Argument\n");
        return;
    }
    dwInetAddr = inet_addr(pszDottedInetAddr); // convert dotted ip addr. to ip addr.
    if (dwInetAddr == INADDR_NONE)
    {
        printf("IpArp: Bad Argument %s\n", pszDottedInetAddr);
        return;
    }

    MIB_IPNETROW arpEntry; // an arp entry
    if (pszInterface)
    {
        // User provides a interface index number
        sscanf(pszInterface, "%X",&(arpEntry.dwIndex));
    }
    else
    {
        // try to delete this from first available interface
        PMIB_IPADDRTABLE pIpAddrTable = NULL;
        if ( (dwStatus = MyGetIpAddrTable(pIpAddrTable)) != NO_ERROR)
        {
            printf("IpArp: Couldn't find a interface number to add your arp entry\n");
            return;
        }
        arpEntry.dwIndex = pIpAddrTable->table[0].dwIndex;
        free(pIpAddrTable);
    }

    arpEntry.dwAddr = dwInetAddr;
    dwStatus = DeleteIpNetEntry(&arpEntry);
    if (dwStatus != NO_ERROR)
    {
        printf("IpArp: couldn't delete (%s), dwStatus = %lu.\n",
                    pszDottedInetAddr, dwStatus);
    }

}

void DoGetIpNetTable ( )

Definition at line 99 of file IPArp.Cpp.

{
    DWORD dwStatus;
    PMIB_IPNETTABLE pIpArpTab = NULL;

    if ( (dwStatus = MyGetIpNetTable(pIpArpTab, TRUE)) == NO_ERROR)
    {
        PrintIpNetTable(pIpArpTab);
        free(pIpArpTab);
        return;
    }
    else if ( dwStatus == ERROR_NO_DATA)
    {
        printf("No entries in arp cache.\n");
        if (pIpArpTab)
            free (pIpArpTab);
        return;
    }
    else
    {
        if (pIpArpTab)
            free (pIpArpTab);
        printf("IpArp returned 0x%x\n", dwStatus);
        return;
    }

}

void DoSetIpNetEntry | ( | char * | pszDottedInetAddr,
 |  | char * | pszPhysAddr,
 |  | char * | pszInterface = NULL
 | ) |  |

Definition at line 133 of file IPArp.Cpp.

{
    DWORD dwInetAddr = 0; // ip address
    DWORD dwStatus;
    BYTE bPhysAddr[MAXLEN_PHYSADDR];

    if (pszDottedInetAddr == NULL || pszPhysAddr == NULL)
    {
        printf("IpArp: Bad Argument\n");
        return;
    }

    dwInetAddr = inet_addr(pszDottedInetAddr); // convert dotted ip addr. to ip addr.
    if (dwInetAddr == INADDR_NONE)
    {
        printf("IpArp: Bad Argument %s\n", pszDottedInetAddr);
        return;
    }

    if (StringToPhysAddr(pszPhysAddr, (char*)bPhysAddr ) != 0)
    {
        printf("IpArp: Bad Argument %s\n", pszPhysAddr);
        return;
    }
    MIB_IPNETROW arpEntry; // an arp entry
    if (pszInterface)
    {
        // User provides a interface index number
        sscanf(pszInterface, "%X",&(arpEntry.dwIndex));
    }
    else
    {
        // add this to the first available interface
        PMIB_IPADDRTABLE pIpAddrTable = NULL;
        if ( (dwStatus = MyGetIpAddrTable(pIpAddrTable)) != NO_ERROR)
        {
            printf("IpArp: Couldn't find a interface number to add your arp entry\n");
            return;
        }
        arpEntry.dwIndex = pIpAddrTable->table[0].dwIndex;
        free(pIpAddrTable);
    }
    arpEntry.dwPhysAddrLen = 6;
    memcpy(arpEntry.bPhysAddr, bPhysAddr, 6);
    arpEntry.dwAddr = dwInetAddr;
    arpEntry.dwType = MIB_IPNET_TYPE_STATIC; //static arp entry
    dwStatus = SetIpNetEntry(&arpEntry);
    if (dwStatus != NO_ERROR)
    {
        printf("IpArp: couldn't add (%s, %s), dwStatus = %lu.\n",
                    pszDottedInetAddr, pszPhysAddr, dwStatus);
    }
}

bool InterfaceIdxToInterfaceIp | ( | PMIB_IPADDRTABLE | pIpAddrTable,
 |  | DWORD | dwIndex,
 |  | char | str[]
 | ) |  |

Definition at line 241 of file IPArp.Cpp.

{
    struct in_addr inadTmp;
    char* szIpAddr;

    if (pIpAddrTable == NULL ||  str == NULL)
        return FALSE;
    str[0] = '\0';
    for (DWORD dwIdx = 0; dwIdx < pIpAddrTable->dwNumEntries; dwIdx++)
    {
        if (dwIndex == pIpAddrTable->table[dwIdx].dwIndex)
        {
            inadTmp.s_addr = pIpAddrTable->table[dwIdx].dwAddr;
            szIpAddr = inet_ntoa(inadTmp);
            if (szIpAddr)
            {
                strcpy(str, szIpAddr);
                return TRUE;
            }
            else
                return FALSE;
        }
    }
    return FALSE;

}

DWORD MyGetIpAddrTable | ( | PMIB_IPADDRTABLE & | pIpAddrTable,
 |  | bool | fOrder = FALSE
 | ) |  |

Definition at line 461 of file IPArp.Cpp.

{
    DWORD status = NO_ERROR;
    DWORD statusRetry = NO_ERROR;
    DWORD dwActualSize = 0;

    // query for buffer size needed
    status = GetIpAddrTable(pIpAddrTable, &dwActualSize, fOrder);

    if (status == NO_ERROR)
    {
        printf("No error\n");
        return status;
    }
    else if (status == ERROR_INSUFFICIENT_BUFFER)
    {
        // need more space

        pIpAddrTable = (PMIB_IPADDRTABLE) malloc(dwActualSize);
        assert(pIpAddrTable);

        statusRetry = GetIpAddrTable(pIpAddrTable, &dwActualSize, fOrder);
        return statusRetry;
    }
    else
    {
        return status;
    }
}

DWORD MyGetIpNetTable | ( | PMIB_IPNETTABLE & | pIpArpTab,
 |  | bool | fOrder = FALSE
 | ) |  |

Definition at line 496 of file IPArp.Cpp.

{
    DWORD status = NO_ERROR;
    DWORD statusRetry = NO_ERROR;
    DWORD dwActualSize = 0;

    // query for buffer size needed
    dwActualSize = 0;
    status = GetIpNetTable(pIpNetTable, &dwActualSize, fOrder);

    if (status == NO_ERROR)
    {
        return status;
    }
    else if (status == ERROR_INSUFFICIENT_BUFFER)
    {
        // need more space

        pIpNetTable = (PMIB_IPNETTABLE) malloc(dwActualSize);
        assert(pIpNetTable);

        statusRetry = GetIpNetTable(pIpNetTable, &dwActualSize, fOrder);

        if (statusRetry != NO_ERROR)
        {
#ifdef _DEBUG
            printf("Retry failed.\n");
#endif
            return statusRetry;
        }
        else
        {
            return statusRetry;
        }
    }
    else
    {
#ifdef _DEBUG
        printf("first getipnettable call failed\n");
#endif
        return status;
    }
}

bool PhysAddrToString | ( | BYTE | PhysAddr[],
 |  | DWORD | PhysAddrLen,
 |  | char | str[]
 | ) |  |

Definition at line 315 of file IPArp.Cpp.

{
    if (PhysAddr == NULL || PhysAddrLen == 0 || str == NULL)
        return FALSE;
    str[0] = '\0';
    for (DWORD dwIdx = 0; dwIdx < PhysAddrLen; dwIdx++)
    {
        if (dwIdx == PhysAddrLen-1)
            sprintf(str+(dwIdx*3), "%02X", ((int)PhysAddr[dwIdx])&0xff);
        else
            sprintf(str+(dwIdx*3), "%02X-", ((int)PhysAddr[dwIdx])&0xff);

    }
    return TRUE;
}

void PrintIpAddrTable ( PMIB_IPADDRTABLE pIpAddrTable )

Definition at line 427 of file IPArp.Cpp.

{
    DWORD i;
    struct in_addr inadTmp1;
    struct in_addr inadTmp2;
    char szAddr[128];
    char szMask[128];

    if (pIpAddrTable == NULL)
    {
        printf( "pIpAddrTable == NULL in line %d\n", __LINE__);
        return;
    }
    printf("ipAdEntAddr\t ifAdEntIfIndex\t ipAdEntNetMask\t ipAdEntBcastAddr\t ipAdEntReasmMaxSize\n");
    for (i = 0; i < pIpAddrTable->dwNumEntries; ++i)
    {
        inadTmp1.s_addr = pIpAddrTable->table[i].dwAddr;
        strcpy(szAddr, inet_ntoa(inadTmp1));
        inadTmp2.s_addr = pIpAddrTable->table[i].dwMask;
        strcpy(szMask, inet_ntoa(inadTmp2));
        printf("  %s\t 0x%X\t %s\t %s\t %u\n",
                szAddr,
                pIpAddrTable->table[i].dwIndex,
                szMask,
                (pIpAddrTable->table[i].dwBCastAddr ? "255.255.255.255" : "0.0.0.0"),
                pIpAddrTable->table[i].dwReasmSize);

    }
}

void PrintIpNetTable ( PMIB_IPNETTABLE pIpNetTable )

Definition at line 341 of file IPArp.Cpp.

{
    DWORD i, dwStatus, dwCurrIndex;
    struct in_addr inadTmp;
    char szPrintablePhysAddr[256];
    char szType[128];
    char szIpAddr[128];
    PMIB_IPADDRTABLE pIpAddrTable = NULL;

    if (pIpNetTable == NULL)
    {
        printf( "pIpNetTable == NULL in line %d\n", __LINE__);
        return;
    }
    // get IP Address Table for mapping interface index number to ip address
    if ( (dwStatus = MyGetIpAddrTable(pIpAddrTable)) != NO_ERROR)
    {
        printf("GetIpAddrTable returned 0x%x\n", dwStatus);
        if (pIpAddrTable)
            free(pIpAddrTable);
        return;
    }
    assert(pIpAddrTable);
    // Note: the ARP table should be sorted in interface index
    dwCurrIndex = pIpNetTable->table[0].dwIndex;
    if (InterfaceIdxToInterfaceIp(pIpAddrTable, dwCurrIndex, szIpAddr))
    {
        printf("\nInterface: %s on Interface 0x%X\n", szIpAddr, dwCurrIndex);
        printf("  Internet Address      Physical Address      Type\n");
    }
    else
    {
        printf("Error: Could not convert Interface number 0x%X to IP address.\n",
                    pIpNetTable->table[0].dwIndex);
        return;
    }

    for (i = 0; i < pIpNetTable->dwNumEntries; ++i)
    {
        if (pIpNetTable->table[i].dwIndex != dwCurrIndex)
        {
            dwCurrIndex = pIpNetTable->table[i].dwIndex;
            if (InterfaceIdxToInterfaceIp(pIpAddrTable, dwCurrIndex, szIpAddr))
            {
                printf("Interface: %s on Interface 0x%X\n", szIpAddr, dwCurrIndex);
                printf("  Internet Address      Physical Address      Type\n");
            }
            else
            {
                printf("Error: Could not convert Interface number 0x%X to IP address.\n",
                    pIpNetTable->table[0].dwIndex);
                return;
            }
        }
        PhysAddrToString(pIpNetTable->table[i].bPhysAddr, pIpNetTable->table[i].dwPhysAddrLen, szPrintablePhysAddr);
        inadTmp.s_addr = pIpNetTable->table[i].dwAddr;
        switch (pIpNetTable->table[i].dwType)
        {
        case 1:
            strcpy(szType,"other");
            break;
        case 2:
            strcpy(szType,"invalidated");
            break;
        case 3:
            strcpy(szType,"dynamic");
            break;
        case 4:
            strcpy(szType,"static");
            break;
        default:
            strcpy(szType,"invalidType");
        }
        printf("  %-16s      %-17s     %-11s\n", inet_ntoa(inadTmp), szPrintablePhysAddr, szType);

    }
    if (pIpAddrTable)
        free(pIpAddrTable);
}

int StringToPhysAddr | ( | char * | szInEther,
 |  | char * | szOutEther
 | ) |  |

Definition at line 273 of file IPArp.Cpp.

{
    const char DASH = '-';
    register char c;
    register int val;

    // check szInEther for the correct format
    if (strlen(szInEther) != 17)
        return (-1);
    if (szInEther[2] != DASH || szInEther[5] != DASH || szInEther[8] != DASH ||
        szInEther[8] != DASH || szInEther[14] != DASH)
        return (-1);
    if (!isxdigit(szInEther[0]) || !isxdigit(szInEther[1]) ||
        !isxdigit(szInEther[3]) || !isxdigit(szInEther[4]) ||
        !isxdigit(szInEther[6]) || !isxdigit(szInEther[7]) ||
        !isxdigit(szInEther[9]) || !isxdigit(szInEther[10]) ||
        !isxdigit(szInEther[12]) || !isxdigit(szInEther[13]) ||
        !isxdigit(szInEther[15]) || !isxdigit(szInEther[16]))
        return (-1);
    // convert the 12 hex decimals back to 6 digit decimals
    for (int i = 0; i < 6; i++)
    {
        val = 0;
        c = toupper(szInEther[i*3]);
        c = c - (isdigit(c) ? '0' : ('A' - 10)); //offset adjustment
        val += c;
        val = (val << 4); // val * 16
        c = toupper(szInEther[i*3 + 1]);
        c = c - (isdigit(c) ? '0' : ('A' - 10)); // offset adjustement
        val += c;
        szOutEther[i] = val;
    }
    return (0);
}

Generated on Wed Nov 13 2024 16:53:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/IPHelp/IPChange/IPChange.Cpp File Reference

  • NetDS
  • IPHelp
  • IPChange
Functions

IPChange.Cpp File Reference

#include <windows.h>
#include <stdio.h>
#include <iphlpapi.h>

Go to the source code of this file.

Functions

void | main (int argc, char *argv[])
void | Usage (void)

Function Documentation

void main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 70 of file IPChange.Cpp.

                                  {
    ULONG NTEContext = 0;
    ULONG NTEInstance;
    IPAddr NewIP;
    IPAddr NewMask;
    DWORD Index;
    DWORD Context;
    CHAR NewIPStr[64];
    CHAR NewMaskStr[64];

    PIP_ADAPTER_INFO pAdapterInfo, pAdapt;
    PIP_ADDR_STRING pAddrStr;
    DWORD AdapterInfoSize;
    DWORD Err;
    BOOL OptList = FALSE;
    BOOL OptAdd = FALSE;
    BOOL OptDel = FALSE;

    NewIPStr[0] = '\0';
    NewMaskStr[0] = '\0';
    Context = Index = (DWORD)-1;
    for (int i = 1; i < argc; i++)
    {
        if ((argv[i][0] == '-') || (argv[i][0] == '/'))
        {
            switch(tolower(argv[i][1]))
            {
                case 'l':
                    OptList = TRUE;
                    break;
                case 'a':
                    OptAdd = TRUE;
                    break;
                case 'c':
                    if (strlen(argv[i]) > 2)
                        Context = atoi(&argv[i][2]);
                    break;
                case 'd':
                    OptDel = TRUE;
                    break;
                case 'i':
                    if (strlen(argv[i]) > 2)
                        strcpy(NewIPStr, &argv[i][2]);
                    break;
                case 'm':
                    if (strlen(argv[i]) > 2)
                        strcpy(NewMaskStr, &argv[i][2]);
                    break;
                case 'n':
                    if (strlen(argv[i]) > 2)
                        Index = atoi(&argv[i][2]);
                    break;
                default:
                    printf("default\n");
                    Usage();
                    return;
                }
        }
        else
        {
            printf("else\n");
            Usage();
            return;
        }
    }

    // Check options
    if ((OptAdd && (Index == -1 || NewIPStr[0] == '\0' || NewMaskStr[0] == '\0'))
        || (OptDel && Context == -1))
    {
        Usage();
        return;
    }

    // Get sizing information about all adapters
    AdapterInfoSize = 0;
    if ((Err = GetAdaptersInfo(NULL, &AdapterInfoSize)) != 0)
    {
        if (Err != ERROR_BUFFER_OVERFLOW)
        {
            printf("GetAdaptersInfo sizing failed with error %d\n", Err);
            return;
        }
    }

    // Allocate memory from sizing information
    if ((pAdapterInfo = (PIP_ADAPTER_INFO) GlobalAlloc(GPTR, AdapterInfoSize)) == NULL)
    {
        printf("Memory allocation error\n");
        return;
    }

    // Get actual adapter information
    if ((Err = GetAdaptersInfo(pAdapterInfo, &AdapterInfoSize)) != 0)
    {
        printf("GetAdaptersInfo failed with error %d\n", Err);
        return;
    }

    if (OptList)
    {
        printf("MAC Address - Adapter\n"
            "Index     Context   Ip Address          Subnet Mask\n"
            "--------------------------------------------------------------\n");

        pAdapt = pAdapterInfo;

        while (pAdapt)
        {
            for (UINT i=0; i<pAdapt->AddressLength; i++)
            {
                if (i == (pAdapt->AddressLength - 1))
                    printf("%.2X - ",(int)pAdapt->Address[i]);
                else
                    printf("%.2X-",(int)pAdapt->Address[i]);
            }
            printf("%s\n", pAdapt->Description);

            pAddrStr = &(pAdapt->IpAddressList);
            while(pAddrStr)
            {
                printf("%-10.d%-10.d%-20.20s%s\n", pAdapt->Index, pAddrStr->Context, pAddrStr->IpAddress.String, pAddrStr->IpMask.String);
                pAddrStr = pAddrStr->Next;
            }

            pAdapt = pAdapt->Next;
        }
    }

    if (OptAdd)
    {
        NewIP = inet_addr(NewIPStr);
        NewMask = inet_addr(NewMaskStr);
        if ((Err = AddIPAddress(NewIP, NewMask, Index, &NTEContext, &NTEInstance)) != 0)
        {
            printf("AddIPAddress failed with error %d, %d\n", NTEContext, Err);
            return;
        }
    }

    if (OptDel)
    {
        if ((Err = DeleteIPAddress(Context)) != 0)
            printf("DeleteIPAddress failed %d\n", Err);
    }
}

void Usage ( void )

Definition at line 58 of file IPChange.Cpp.

                 {
    printf("Usage: Ipchange [ -l ] [ -a -n<index id> -i<ip address> -m<subnet mask> ] "
        "[ -d -c<context id>]\n\n"
        "\t -l List adapter index IDs and IP Address context ID information\n"
        "\t -a Add IP Address option\n"
        "\t -d Delete IP Address option\n"
        "\t -i IP Address to specify with -a option\n"
        "\t -m Subnet Mask to specify with -a option\n"
        "\t -c IP context ID for an existing IP address\n"
        "\t -n Index ID of an existing network adapter\n");
}

Generated on Wed Nov 13 2024 16:53:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/IPHelp/IPConfig/IPConfig.Cpp File Reference

  • NetDS
  • IPHelp
  • IPConfig
Functions

IPConfig.Cpp File Reference

#include <windows.h>
#include <iphlpapi.h>
#include <stdio.h>
#include <time.h>

Go to the source code of this file.

Functions

void main (void)

Function Documentation

void main ( void )

Definition at line 41 of file IPConfig.Cpp.

                {

    DWORD Err;

    PFIXED_INFO pFixedInfo;
    DWORD FixedInfoSize = 0;

    PIP_ADAPTER_INFO pAdapterInfo, pAdapt;
    DWORD AdapterInfoSize;
    PIP_ADDR_STRING pAddrStr;

    //
    // Get the main IP configuration information for this machine using a FIXED_INFO structure
    //
    if ((Err = GetNetworkParams(NULL, &FixedInfoSize)) != 0)
    {
        if (Err != ERROR_BUFFER_OVERFLOW)
        {
            printf("GetNetworkParams sizing failed with error %d\n", Err);
            return;
        }
    }

    // Allocate memory from sizing information
    if ((pFixedInfo = (PFIXED_INFO) GlobalAlloc(GPTR, FixedInfoSize)) == NULL)
    {
        printf("Memory allocation error\n");
        return;
    }

    if ((Err = GetNetworkParams(pFixedInfo, &FixedInfoSize)) == 0)
    {
        printf("\tHost Name . . . . . . . . . : %s\n", pFixedInfo->HostName);
        printf("\tDNS Servers . . . . . . . . : %s\n", pFixedInfo->DnsServerList.IpAddress.String);
        pAddrStr = pFixedInfo->DnsServerList.Next;
        while(pAddrStr)
        {
            printf("%52s\n", pAddrStr->IpAddress.String);
            pAddrStr = pAddrStr->Next;
        }

        printf("\tNode Type . . . . . . . . . : ");
        switch (pFixedInfo->NodeType)
        {
            case 1:
                printf("%s\n", "Broadcast");
                break;
            case 2:
                printf("%s\n", "Peer to peer");
                break;
            case 4:
                printf("%s\n", "Mixed");
                break;
            case 8:
                printf("%s\n", "Hybrid");
                break;
            default:
                printf("\n");
        }

        printf("\tNetBIOS Scope ID. . . . . . : %s\n", pFixedInfo->ScopeId);
        printf("\tIP Routing Enabled. . . . . : %s\n", (pFixedInfo->EnableRouting ? "yes" : "no"));
        printf("\tWINS Proxy Enabled. . . . . : %s\n", (pFixedInfo->EnableProxy ? "yes" : "no"));
        printf("\tNetBIOS Resolution Uses DNS : %s\n", (pFixedInfo->EnableDns ? "yes" : "no"));
    } else
    {
        printf("GetNetworkParams failed with error %d\n", Err);
        return;
    }

    //
    // Enumerate all of the adapter specific information using the IP_ADAPTER_INFO structure.
    // Note:  IP_ADAPTER_INFO contains a linked list of adapter entries.
    //
    AdapterInfoSize = 0;
    if ((Err = GetAdaptersInfo(NULL, &AdapterInfoSize)) != 0)
    {
        if (Err != ERROR_BUFFER_OVERFLOW)
        {
            printf("GetAdaptersInfo sizing failed with error %d\n", Err);
            return;
        }
    }

    // Allocate memory from sizing information
    if ((pAdapterInfo = (PIP_ADAPTER_INFO) GlobalAlloc(GPTR, AdapterInfoSize)) == NULL)
    {
        printf("Memory allocation error\n");
        return;
    }

    // Get actual adapter information
    if ((Err = GetAdaptersInfo(pAdapterInfo, &AdapterInfoSize)) != 0)
    {
        printf("GetAdaptersInfo failed with error %d\n", Err);
        return;
    }

    pAdapt = pAdapterInfo;

    while (pAdapt)
    {
        switch (pAdapt->Type)
        {
            case MIB_IF_TYPE_ETHERNET:
                printf("\nEthernet adapter ");
                break;
            case MIB_IF_TYPE_TOKENRING:
                printf("\nToken Ring adapter ");
                break;
            case MIB_IF_TYPE_FDDI:
                printf("\nFDDI adapter ");
                break;
            case MIB_IF_TYPE_PPP:
                printf("\nPPP adapter ");
                break;
            case MIB_IF_TYPE_LOOPBACK:
                printf("\nLoopback adapter ");
                break;
            case MIB_IF_TYPE_SLIP:
                printf("\nSlip adapter ");
                break;
            case MIB_IF_TYPE_OTHER:
            default:
                printf("\nOther adapter ");
        }
        printf("%s:\n\n", pAdapt->AdapterName);

        printf("\tDescription . . . . . . . . : %s\n", pAdapt->Description);

        printf("\tPhysical Address. . . . . . : ");
        for (UINT i=0; i<pAdapt->AddressLength; i++)
        {
            if (i == (pAdapt->AddressLength - 1))
                printf("%.2X\n",(int)pAdapt->Address[i]);
            else
                printf("%.2X-",(int)pAdapt->Address[i]);
        }

        printf("\tDHCP Enabled. . . . . . . . : %s\n", (pAdapt->DhcpEnabled ? "yes" : "no"));

        pAddrStr = &(pAdapt->IpAddressList);
        while(pAddrStr)
        {
            printf("\tIP Address. . . . . . . . . : %s\n", pAddrStr->IpAddress.String);
            printf("\tSubnet Mask . . . . . . . . : %s\n", pAddrStr->IpMask.String);
            pAddrStr = pAddrStr->Next;
        }

        printf("\tDefault Gateway . . . . . . : %s\n", pAdapt->GatewayList.IpAddress.String);
        pAddrStr = pAdapt->GatewayList.Next;
        while(pAddrStr)
        {
            printf("%52s\n", pAddrStr->IpAddress.String);
            pAddrStr = pAddrStr->Next;
        }

        printf("\tDHCP Server . . . . . . . . : %s\n", pAdapt->DhcpServer.IpAddress.String);
        printf("\tPrimary WINS Server . . . . : %s\n", pAdapt->PrimaryWinsServer.IpAddress.String);
        printf("\tSecondary WINS Server . . . : %s\n", pAdapt->SecondaryWinsServer.IpAddress.String);

        struct tm *newtime;

        // Display coordinated universal time - GMT
        newtime = gmtime(&pAdapt->LeaseObtained);
        printf( "\tLease Obtained. . . . . . . : %s", asctime( newtime ) );

        newtime = gmtime(&pAdapt->LeaseExpires);
        printf( "\tLease Expires . . . . . . . : %s", asctime( newtime ) );

        pAdapt = pAdapt->Next;
    }
}

Generated on Wed Nov 13 2024 16:53:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/IPHelp/IPRenew/IPRenew.Cpp File Reference

  • NetDS
  • IPHelp
  • IPRenew
Functions

IPRenew.Cpp File Reference

#include <windows.h>
#include <iphlpapi.h>
#include <stdio.h>

Go to the source code of this file.

Functions

void | main (int argc, char *argv[])
void | Usage (void)

Function Documentation

void main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 60 of file IPRenew.Cpp.

{
    DWORD InterfaceInfoSize = 0;
    PIP_INTERFACE_INFO pInterfaceInfo;
    DWORD Err;
    INT i;
    PIP_ADAPTER_INFO pAdapterInfo, pAdapt;
    DWORD AdapterInfoSize = 0;
    DWORD Index = (DWORD) -1;
    BOOL OptList = FALSE;
    BOOL OptRelease = FALSE;
    BOOL OptRenew = FALSE;

    if (argc < 2)
    {
        Usage();
        return;
    }
    for (i = 1; i < argc; i++)
    {
        if ((argv[i][0] == '-') || (argv[i][0] == '/'))
        {
            switch(tolower(argv[i][1]))
            {
                case 'l':
                    OptList = TRUE;
                    break;
                case 'r':
                    OptRelease = TRUE;
                    if (strlen(argv[i]) > 2)
                        Index = atoi(&argv[i][2]);
                    break;
                case 'n':
                    OptRenew = TRUE;
                    if (strlen(argv[i]) > 2)
                        Index = atoi(&argv[i][2]);
                    break;
                default:
                    Usage();
                    return;
                }
        }
        else
        {
            Usage();
            return;
        }
    }

    // Check options
    if ((OptRelease && Index == -1) || (OptRenew && Index == -1))
    {
        Usage();
        return;
    }

    if (OptList)
    {
        if ((Err = GetAdaptersInfo(NULL, &AdapterInfoSize)) != 0)
        {
            if (Err != ERROR_BUFFER_OVERFLOW)
            {
                printf("GetAdaptersInfo sizing failed with error %d\n", Err);
                return;
            }
        }

        // Allocate memory from sizing information
        if ((pAdapterInfo = (PIP_ADAPTER_INFO) GlobalAlloc(GPTR, AdapterInfoSize)) == NULL)
        {
            printf("Memory allocation error\n");
            return;
        }

        // Get actual adapter information
        if ((Err = GetAdaptersInfo(pAdapterInfo, &AdapterInfoSize)) != 0)
        {
            printf("GetAdaptersInfo failed with error %d\n", Err);
            return;
        }

        pAdapt = pAdapterInfo;

        printf("Index     Adapter\n");
        while (pAdapt)
        {
            printf("%-10.i%s\n", pAdapt->Index, pAdapt->Description);
            pAdapt = pAdapt->Next;
        }
    }

    if ((Err = GetInterfaceInfo(NULL, &InterfaceInfoSize)) != 0)
    {
        if (Err != ERROR_INSUFFICIENT_BUFFER)
        {
            printf("GetInterfaceInfo sizing failed with error %d\n", Err);
            return;
        }
    }

    // Allocate memory from sizing information
    if ((pInterfaceInfo = (PIP_INTERFACE_INFO) GlobalAlloc(GPTR, InterfaceInfoSize)) == NULL)
    {
        printf("Memory allocation error\n");
        return;
    }

    // Get actual adapter information
    if ((Err = GetInterfaceInfo(pInterfaceInfo, &InterfaceInfoSize)) != 0)
    {
        printf("GetInterfaceInfo failed with error %d\n", Err);
        return;
    }

    if (OptRelease)
    {
        for (i = 0; i < pInterfaceInfo->NumAdapters; i++)
            if (Index == pInterfaceInfo->Adapter[i].Index)
            {
                if ((Err = IpReleaseAddress(&pInterfaceInfo->Adapter[i])) != 0)
                {
                    printf("IpReleaseAddress failed with error %d\n", Err);
                    return;
                }
                break;
            }
    }

    if (OptRenew)
    {
        for (i = 0; i < pInterfaceInfo->NumAdapters; i++)
            if (Index == pInterfaceInfo->Adapter[i].Index)
            {
                if ((Err = IpRenewAddress(&pInterfaceInfo->Adapter[i])) != 0)
                {
                    printf("IpRenewAddress failed with error %d\n", Err);
                    return;
                }
                break;
            }
    }
}

void Usage ( void )

Definition at line 53 of file IPRenew.Cpp.

                 {
    printf("Usage: Iprenew [ -l ] [ -r<index id> ] [ -n<index id>]\n\n"
            "\t -l List adapters with corresponding index ID information\n"
            "\t -r Release IP address for adapter index ID\n"
            "\t -n Renew IP address for adapter index ID\n");
}

Generated on Wed Nov 13 2024 16:53:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/IPHelp/IPRoute/IPRoute.Cpp File Reference

  • NetDS
  • IPHelp
  • IPRoute
Functions

IPRoute.Cpp File Reference

#include "IpRoute.h"

Go to the source code of this file.

Functions

void | DoDeleteIpForwardEntry (char *pszDest)
void | DoGetIpForwardTable ()
void | DoSetIpForwardEntry (char *pszDest, char *pszNetMask, char *pszGateway, char *pszInterface, DWORD dwMetric)
bool | InterfaceIdxToInterfaceIp (PMIB_IPADDRTABLE pIpAddrTable, DWORD dwIndex, char str[])
bool | InterfaceIpToIdxAndMask (PMIB_IPADDRTABLE pIpAddrTable, char str[], DWORD &dwIndex, DWORD &dwMask)
void _cdecl | main (int argc, char **argv)
DWORD | MyGetIpAddrTable (PMIB_IPADDRTABLE &pIpAddrTable, BOOL fOrder)
DWORD | MyGetIpForwardTable (PMIB_IPFORWARDTABLE &pIpRouteTab, BOOL fOrder)
void | PrintIpForwardTable (PMIB_IPFORWARDTABLE pIpRouteTable)
void | Usage (char *pszProgramName)

Function Documentation

void DoDeleteIpForwardEntry ( char * pszDest )

Definition at line 240 of file IPRoute.Cpp.

{
    DWORD dwStatus, dwDelStatus, i;
    PMIB_IPFORWARDTABLE pIpRouteTab = NULL; // Ip routing table
    MIB_IPFORWARDROW routeEntry;            // Ip routing table row entry
    DWORD dwForwardDest = 0;
    bool fDeleted = FALSE;

    memset(&routeEntry, 0, sizeof(MIB_IPFORWARDROW));
    dwForwardDest = inet_addr(pszDest); // convert dotted ip addr. to ip addr.
    if (dwForwardDest == INADDR_NONE)
    {
        printf("IpRoute: Bad Destination %s\n", pszDest);
        return;
    }

    if ( (dwStatus = MyGetIpForwardTable(pIpRouteTab, TRUE)) == NO_ERROR)
    {
        for (i = 0; i < pIpRouteTab->dwNumEntries; i++)
        {
            if (dwForwardDest == pIpRouteTab->table[i].dwForwardDest)
            {
                memcpy(&routeEntry, &(pIpRouteTab->table[i]), sizeof(MIB_IPFORWARDROW));
                dwDelStatus = DeleteIpForwardEntry(&routeEntry);
                if (dwDelStatus != NO_ERROR)
                {
                    printf("IpRoute: couldn't delete (%s), dwStatus = %lu.\n",
                            pszDest, dwDelStatus);
                    return;
                }
                else
                    fDeleted = TRUE;
            }
        }
        free(pIpRouteTab);
        if (! fDeleted)
            printf("IpRoute: The route specified was not found.\n");
        return;
    }
    else if ( dwStatus == ERROR_NO_DATA)
    {
        printf("IpRoute: No entries in route table.\n");
        if (pIpRouteTab)
            free (pIpRouteTab);
        return;
    }
    else
    {
        if (pIpRouteTab)
            free (pIpRouteTab);
        printf("IpRoute returned 0x%x\n", dwStatus);
        return;
    }

}

void DoGetIpForwardTable ( )

Definition at line 112 of file IPRoute.Cpp.

{
    DWORD dwStatus;
    PMIB_IPFORWARDTABLE pIpRouteTab = NULL; // Ip routing table

    if ( (dwStatus = MyGetIpForwardTable(pIpRouteTab, TRUE)) == NO_ERROR)
    {
        PrintIpForwardTable(pIpRouteTab);
        free(pIpRouteTab);
        return;
    }
    else if ( dwStatus == ERROR_NO_DATA)
    {
        printf("No entries in route table.\n");
        if (pIpRouteTab)
            free (pIpRouteTab);
        return;
    }
    else
    {
        if (pIpRouteTab)
            free (pIpRouteTab);
        printf("IpRoute returned 0x%x\n", dwStatus);
        return;
    }
}

void DoSetIpForwardEntry | ( | char * | pszDest,
 |  | char * | pszNetMask,
 |  | char * | pszGateway,
 |  | char * | pszInterface,
 |  | DWORD | dwMetric
 | ) |  |

Definition at line 140 of file IPRoute.Cpp.

{
    DWORD dwStatus;

    MIB_IPFORWARDROW routeEntry;            // Ip routing table row entry
    PMIB_IPADDRTABLE pIpAddrTable = NULL;   // Ip Addr Table
    DWORD dwIfIndex;                        // Interface index number
    DWORD dwIfMask;                         // Interface Subnet Mask
    DWORD dwIfIpAddr;                       // Interface Ip Address

    memset(&routeEntry, 0, sizeof(MIB_IPFORWARDROW));

    // converting and checking input arguments...
    if (pszDest == NULL || pszNetMask == NULL || pszGateway == NULL)
    {
        printf("IpRoute: Bad Argument\n");
        return;
    }

    routeEntry.dwForwardDest = inet_addr(pszDest); // convert dotted ip addr. to ip addr.
    if (routeEntry.dwForwardDest == INADDR_NONE)
    {
        printf("IpRoute: Bad Destination %s\n", pszDest);
        return;
    }

    routeEntry.dwForwardMask = inet_addr(pszNetMask);
    if ( (routeEntry.dwForwardMask == INADDR_NONE) &&
         (strcmp("255.255.255.255", pszNetMask) != 0) )
    {
        printf("IpRoute: Bad Mask %s\n", pszNetMask);
        return;
    }

    routeEntry.dwForwardNextHop = inet_addr(pszGateway);
    if (routeEntry.dwForwardNextHop == INADDR_NONE)
    {
        printf("IpRoute: Bad Gateway %s\n", pszGateway);
        return;
    }

    if ( (routeEntry.dwForwardDest & routeEntry.dwForwardMask) != routeEntry.dwForwardDest)
    {
        printf("IpRoute: Invalid Mask %s\n", pszNetMask);
        return;

    }

    dwIfIpAddr = inet_addr(pszInterface);
    if (dwIfIpAddr == INADDR_NONE)
    {
        printf("IpRoute: Bad Interface %s\n", pszInterface);
        return;
    }

    // Check if we have the given interface
    if ( (dwStatus = MyGetIpAddrTable(pIpAddrTable)) != NO_ERROR)
    {
        printf("GetIpAddrTable returned 0x%x\n", dwStatus);
        if (pIpAddrTable)
            free(pIpAddrTable);
        return;
    }
    assert(pIpAddrTable);
    if ( InterfaceIpToIdxAndMask(pIpAddrTable, pszInterface, dwIfIndex, dwIfMask) == FALSE)
    {
        printf("IpRoute: Bad Argument %s\n", pszInterface);
        return;
    }
    free(pIpAddrTable);

    if ( (routeEntry.dwForwardNextHop & dwIfMask) != (dwIfIpAddr & dwIfMask) )
    {
        printf("IpRoute: Gateway %s and Interface %s are not in the same subnet.\n", pszGateway, pszInterface);
        return;
    }

    routeEntry.dwForwardIfIndex = dwIfIndex;

    routeEntry.dwForwardMetric1 = dwMetric;

    // some default values
    routeEntry.dwForwardProto = MIB_IPPROTO_LOCAL;
    routeEntry.dwForwardMetric2 = (DWORD)-1;
    routeEntry.dwForwardMetric3 = (DWORD)-1;
    routeEntry.dwForwardMetric4 = (DWORD)-1;

    dwStatus = SetIpForwardEntry(&routeEntry);
    if (dwStatus != NO_ERROR)
    {
        printf("IpRoute: couldn't add (%s), dwStatus = %lu.\n",
                    pszDest, dwStatus);
    }

}

bool InterfaceIdxToInterfaceIp | ( | PMIB_IPADDRTABLE | pIpAddrTable,
 |  | DWORD | dwIndex,
 |  | char | str[]
 | ) |  |

Definition at line 417 of file IPRoute.Cpp.

{
    struct in_addr inadTmp;
    char* szIpAddr;

    if (pIpAddrTable == NULL ||  str == NULL)
        return FALSE;
    str[0] = '\0';
    for (DWORD dwIdx = 0; dwIdx < pIpAddrTable->dwNumEntries; dwIdx++)
    {
        if (dwIndex == pIpAddrTable->table[dwIdx].dwIndex)
        {
            inadTmp.s_addr = pIpAddrTable->table[dwIdx].dwAddr;
            szIpAddr = inet_ntoa(inadTmp);
            if (szIpAddr)
            {
                strcpy(str, szIpAddr);
                return TRUE;
            }
            else
                return FALSE;
        }
    }
    return FALSE;

}

bool InterfaceIpToIdxAndMask | ( | PMIB_IPADDRTABLE | pIpAddrTable,
 |  | char | str[],
 |  | DWORD & | dwIndex,
 |  | DWORD & | dwMask
 | ) |  |

Definition at line 450 of file IPRoute.Cpp.

{
    DWORD dwIfIpAddr; // Interface Ip Address

    if (pIpAddrTable == NULL)
        return FALSE;

    dwIfIpAddr = inet_addr(str);
    if (dwIfIpAddr == INADDR_NONE)
        return FALSE;

    for (DWORD dwIdx = 0; dwIdx < pIpAddrTable->dwNumEntries; dwIdx++)
    {
        if (dwIfIpAddr == pIpAddrTable->table[dwIdx].dwAddr)
        {
            dwIndex = pIpAddrTable->table[dwIdx].dwIndex;
            dwMask = pIpAddrTable->table[dwIdx].dwMask;
            return TRUE;
        }
    }
    return FALSE;
}

void _cdecl main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 57 of file IPRoute.Cpp.

{
    WORD wVersionRequested = MAKEWORD(1,1);
    WSADATA wsaData;
    int nRet;

    nRet = WSAStartup(wVersionRequested, &wsaData);
    if (wsaData.wVersion != wVersionRequested)
    {
        fprintf(stderr,"\n Wrong version\n");
        return;
    }

    if ((argc < 2) || (argv[1][0] != '-'))
        Usage("IpRoute");
    if (strlen(argv[1]) > 2)
        Usage("IpRoute");

    switch(argv[1][1])
    {
    case 'p':
        // Print routing table
        DoGetIpForwardTable();
        break;
    case 'a':
        //Adds an entry into routing table
        if (argc == 6)
            DoSetIpForwardEntry(argv[2], argv[3], argv[4], argv[5]); // dest mask gateway if
        else if (argc == 7)
        {
            DWORD dwMetric;
            if (sscanf(argv[6], "%u", &dwMetric ) == 1)
                DoSetIpForwardEntry(argv[2], argv[3], argv[4], argv[5], dwMetric);
            else
                printf("IpRoute: Bad argument %s\n", argv[6]);
        }
        else
            Usage("IpRoute");
        break;

    case 'd':
        //Delete an entry from the routing table
        if (argc == 3)
            DoDeleteIpForwardEntry(argv[2]);
        else
            Usage("IpRoute");
        break;
    default:
        // help
        Usage("IpRoute");
        break;
    }
    WSACleanup();
}

DWORD MyGetIpAddrTable | ( | PMIB_IPADDRTABLE & | pIpAddrTable,
 |  | BOOL | fOrder
 | ) |  |

Definition at line 477 of file IPRoute.Cpp.

{
    DWORD status = NO_ERROR;
    DWORD statusRetry = NO_ERROR;
    DWORD dwActualSize = 0;

    // query for buffer size needed
    status = GetIpAddrTable(pIpAddrTable, &dwActualSize, fOrder);

    if (status == NO_ERROR)
    {
        printf("No error\n");
        return status;
    }
    else if (status == ERROR_INSUFFICIENT_BUFFER)
    {
        // need more space

        pIpAddrTable = (PMIB_IPADDRTABLE) malloc(dwActualSize);
        assert(pIpAddrTable);

        statusRetry = GetIpAddrTable(pIpAddrTable, &dwActualSize, fOrder);
        return statusRetry;
    }
    else
    {
        return status;
    }
}

DWORD MyGetIpForwardTable | ( | PMIB_IPFORWARDTABLE & | pIpRouteTab,
 |  | BOOL | fOrder
 | ) |  |

Definition at line 304 of file IPRoute.Cpp.

{
    DWORD status = NO_ERROR;
    DWORD statusRetry = NO_ERROR;
    DWORD dwActualSize = 0;

    // query for buffer size needed
    status = GetIpForwardTable(pIpRouteTab, &dwActualSize, fOrder);

    if (status == NO_ERROR)
    {
        printf("No error\n");
        return status;
    }
    else if (status == ERROR_INSUFFICIENT_BUFFER)
    {
        // need more space

        pIpRouteTab = (PMIB_IPFORWARDTABLE) malloc(dwActualSize);
        assert(pIpRouteTab);

        statusRetry = GetIpForwardTable(pIpRouteTab, &dwActualSize, fOrder);
        return statusRetry;
    }
    else
    {
        return status;
    }

}

void PrintIpForwardTable ( PMIB_IPFORWARDTABLE pIpRouteTable )

Definition at line 348 of file IPRoute.Cpp.

{
    DWORD i, dwStatus, dwCurrIndex;
    struct in_addr inadDest;
    struct in_addr inadMask;
    struct in_addr inadGateway;
    char szIpAddr[128];          // ip address of an interface index
    PMIB_IPADDRTABLE pIpAddrTable = NULL;

    char szDestIp[128];
    char szMaskIp[128];
    char szGatewayIp[128];

    if (pIpRouteTable == NULL)
    {
        printf( "pIpRouteTable == NULL in line %d\n", __LINE__);
        return;
    }
    // get IP Address Table for mapping interface index number to ip address
    if ( (dwStatus = MyGetIpAddrTable(pIpAddrTable)) != NO_ERROR)
    {
        printf("GetIpAddrTable returned 0x%x\n", dwStatus);
        if (pIpAddrTable)
            free(pIpAddrTable);
        return;
    }
    assert(pIpAddrTable);

    printf("Active Routes:\n\n");

    printf("  Network Address          Netmask  Gateway Address        Interface  Metric\n");
    for (i = 0; i < pIpRouteTable->dwNumEntries; i++)
    {
        dwCurrIndex = pIpRouteTable->table[i].dwForwardIfIndex;
        if (InterfaceIdxToInterfaceIp(pIpAddrTable, dwCurrIndex, szIpAddr) == FALSE)
        {
            printf("Error: Could not convert Interface number 0x%X to IP address.\n",dwCurrIndex);
            if (pIpAddrTable)
                free(pIpAddrTable);
            return;
        }

        inadDest.s_addr = pIpRouteTable->table[i].dwForwardDest;
        inadMask.s_addr = pIpRouteTable->table[i].dwForwardMask;
        inadGateway.s_addr = pIpRouteTable->table[i].dwForwardNextHop;

        strcpy(szDestIp, inet_ntoa(inadDest));
        strcpy(szMaskIp, inet_ntoa(inadMask));
        strcpy(szGatewayIp, inet_ntoa(inadGateway));
        printf("  %15s %16s %16s %16s %7d\n",
                szDestIp,
                szMaskIp,
                szGatewayIp,
                szIpAddr,
                pIpRouteTable->table[i].dwForwardMetric1);

    }

    if (pIpAddrTable)
        free(pIpAddrTable);

}

void Usage ( char * pszProgramName )

Definition at line 18 of file IPRoute.Cpp.

{
    printf("Manipulates network routing tables.\n\n");

    printf("%s -p                                               ...Prints route table.\n", pszProgramName);
    printf("%s -a destination netmask gateway interface [metric]...Adds a route.\n", pszProgramName);
    printf("%s -d destination                                   ...Deletes routes to\n", pszProgramName);
    printf("                                                            destination.\n\n");

    printf("destination  Specifies the destination host.\n\n");

    printf("netmask      Specifies a subnet mask value to be associated\n");
    printf("             with this route entry.\n\n");

    printf("gateway      Specifies gateway.\n\n");

    printf("interface    Specifies the interface ip.\n\n");

    printf("metric       The cost for this destination\n\n");

    printf("Diagnostic Notes:\n\n");
    printf("Invalid MASK generates an error, that is when (DEST & MASK) != DEST.\n");
    printf("Example> IpRoute -a 157.0.0.0 155.0.0.0 157.55.80.1 157.55.80.9\n");
    printf("         IpRoute: Invalid Mask 155.0.0.0\n\n");

    printf("Examples:\n\n");

    printf("> IpRoute -p\n");
    printf("> IpRoute -a 157.0.0.0    255.0.0.0 157.55.80.1  157.55.80.9           1\n");
    printf("             ^destination ^mask     ^gateway     ^existing interface   ^metric\n");
    printf("> IpRoute -p\n");
    printf("> IpRoute -d 157.0.0.0\n");
    printf("> IpRoute -p\n");

    WSACleanup();
    exit(1);
}

Generated on Wed Nov 13 2024 16:53:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/IPHelp/IPRoute/IPRoute.h File Reference

  • NetDS
  • IPHelp
  • IPRoute
Functions

IPRoute.h File Reference

#include <windows.h>
#include <winsock.h>
#include <iphlpapi.h>
#include <assert.h>
#include <stdlib.h>
#include <malloc.h>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <iptypes.h>

Go to the source code of this file.

Functions

void | DoDeleteIpForwardEntry (char *pszDest)
void | DoGetIpForwardTable ()
void | DoSetIpForwardEntry (char *pszDest, char *pszNetMask, char *pszGateway, char *pszInterface, DWORD dwMetric=1)
bool | InterfaceIdxToInterfaceIp (PMIB_IPADDRTABLE pIpAddrTable, DWORD dwIndex, char str[])
bool | InterfaceIpToIdxAndMask (PMIB_IPADDRTABLE pIpAddrTable, char str[], DWORD &dwIndex, DWORD &dwMask)
DWORD | MyGetIpAddrTable (PMIB_IPADDRTABLE &pIpAddrTable, BOOL fOrder=FALSE)
DWORD | MyGetIpForwardTable (PMIB_IPFORWARDTABLE &pIpRouteTab, BOOL fOrder=FALSE)
void | PrintIpForwardTable (PMIB_IPFORWARDTABLE pIpRouteTable)

Function Documentation

void DoDeleteIpForwardEntry ( char * pszDest )

Definition at line 240 of file IPRoute.Cpp.

{
    DWORD dwStatus, dwDelStatus, i;
    PMIB_IPFORWARDTABLE pIpRouteTab = NULL; // Ip routing table
    MIB_IPFORWARDROW routeEntry;            // Ip routing table row entry
    DWORD dwForwardDest = 0;
    bool fDeleted = FALSE;

    memset(&routeEntry, 0, sizeof(MIB_IPFORWARDROW));
    dwForwardDest = inet_addr(pszDest); // convert dotted ip addr. to ip addr.
    if (dwForwardDest == INADDR_NONE)
    {
        printf("IpRoute: Bad Destination %s\n", pszDest);
        return;
    }

    if ( (dwStatus = MyGetIpForwardTable(pIpRouteTab, TRUE)) == NO_ERROR)
    {
        for (i = 0; i < pIpRouteTab->dwNumEntries; i++)
        {
            if (dwForwardDest == pIpRouteTab->table[i].dwForwardDest)
            {
                memcpy(&routeEntry, &(pIpRouteTab->table[i]), sizeof(MIB_IPFORWARDROW));
                dwDelStatus = DeleteIpForwardEntry(&routeEntry);
                if (dwDelStatus != NO_ERROR)
                {
                    printf("IpRoute: couldn't delete (%s), dwStatus = %lu.\n",
                            pszDest, dwDelStatus);
                    return;
                }
                else
                    fDeleted = TRUE;
            }
        }
        free(pIpRouteTab);
        if (! fDeleted)
            printf("IpRoute: The route specified was not found.\n");
        return;
    }
    else if ( dwStatus == ERROR_NO_DATA)
    {
        printf("IpRoute: No entries in route table.\n");
        if (pIpRouteTab)
            free (pIpRouteTab);
        return;
    }
    else
    {
        if (pIpRouteTab)
            free (pIpRouteTab);
        printf("IpRoute returned 0x%x\n", dwStatus);
        return;
    }

}

void DoGetIpForwardTable ( )

Definition at line 112 of file IPRoute.Cpp.

{
    DWORD dwStatus;
    PMIB_IPFORWARDTABLE pIpRouteTab = NULL; // Ip routing table

    if ( (dwStatus = MyGetIpForwardTable(pIpRouteTab, TRUE)) == NO_ERROR)
    {
        PrintIpForwardTable(pIpRouteTab);
        free(pIpRouteTab);
        return;
    }
    else if ( dwStatus == ERROR_NO_DATA)
    {
        printf("No entries in route table.\n");
        if (pIpRouteTab)
            free (pIpRouteTab);
        return;
    }
    else
    {
        if (pIpRouteTab)
            free (pIpRouteTab);
        printf("IpRoute returned 0x%x\n", dwStatus);
        return;
    }
}

void DoSetIpForwardEntry | ( | char * | pszDest,
 |  | char * | pszNetMask,
 |  | char * | pszGateway,
 |  | char * | pszInterface,
 |  | DWORD | dwMetric = 1
 | ) |  |

Definition at line 140 of file IPRoute.Cpp.

{
    DWORD dwStatus;

    MIB_IPFORWARDROW routeEntry;            // Ip routing table row entry
    PMIB_IPADDRTABLE pIpAddrTable = NULL;   // Ip Addr Table
    DWORD dwIfIndex;                        // Interface index number
    DWORD dwIfMask;                         // Interface Subnet Mask
    DWORD dwIfIpAddr;                       // Interface Ip Address

    memset(&routeEntry, 0, sizeof(MIB_IPFORWARDROW));

    // converting and checking input arguments...
    if (pszDest == NULL || pszNetMask == NULL || pszGateway == NULL)
    {
        printf("IpRoute: Bad Argument\n");
        return;
    }

    routeEntry.dwForwardDest = inet_addr(pszDest); // convert dotted ip addr. to ip addr.
    if (routeEntry.dwForwardDest == INADDR_NONE)
    {
        printf("IpRoute: Bad Destination %s\n", pszDest);
        return;
    }

    routeEntry.dwForwardMask = inet_addr(pszNetMask);
    if ( (routeEntry.dwForwardMask == INADDR_NONE) &&
         (strcmp("255.255.255.255", pszNetMask) != 0) )
    {
        printf("IpRoute: Bad Mask %s\n", pszNetMask);
        return;
    }

    routeEntry.dwForwardNextHop = inet_addr(pszGateway);
    if (routeEntry.dwForwardNextHop == INADDR_NONE)
    {
        printf("IpRoute: Bad Gateway %s\n", pszGateway);
        return;
    }

    if ( (routeEntry.dwForwardDest & routeEntry.dwForwardMask) != routeEntry.dwForwardDest)
    {
        printf("IpRoute: Invalid Mask %s\n", pszNetMask);
        return;

    }

    dwIfIpAddr = inet_addr(pszInterface);
    if (dwIfIpAddr == INADDR_NONE)
    {
        printf("IpRoute: Bad Interface %s\n", pszInterface);
        return;
    }

    // Check if we have the given interface
    if ( (dwStatus = MyGetIpAddrTable(pIpAddrTable)) != NO_ERROR)
    {
        printf("GetIpAddrTable returned 0x%x\n", dwStatus);
        if (pIpAddrTable)
            free(pIpAddrTable);
        return;
    }
    assert(pIpAddrTable);
    if ( InterfaceIpToIdxAndMask(pIpAddrTable, pszInterface, dwIfIndex, dwIfMask) == FALSE)
    {
        printf("IpRoute: Bad Argument %s\n", pszInterface);
        return;
    }
    free(pIpAddrTable);

    if ( (routeEntry.dwForwardNextHop & dwIfMask) != (dwIfIpAddr & dwIfMask) )
    {
        printf("IpRoute: Gateway %s and Interface %s are not in the same subnet.\n", pszGateway, pszInterface);
        return;
    }

    routeEntry.dwForwardIfIndex = dwIfIndex;

    routeEntry.dwForwardMetric1 = dwMetric;

    // some default values
    routeEntry.dwForwardProto = MIB_IPPROTO_LOCAL;
    routeEntry.dwForwardMetric2 = (DWORD)-1;
    routeEntry.dwForwardMetric3 = (DWORD)-1;
    routeEntry.dwForwardMetric4 = (DWORD)-1;

    dwStatus = SetIpForwardEntry(&routeEntry);
    if (dwStatus != NO_ERROR)
    {
        printf("IpRoute: couldn't add (%s), dwStatus = %lu.\n",
                    pszDest, dwStatus);
    }

}

bool InterfaceIdxToInterfaceIp | ( | PMIB_IPADDRTABLE | pIpAddrTable,
 |  | DWORD | dwIndex,
 |  | char | str[]
 | ) |  |

Definition at line 241 of file IPArp.Cpp.

{
    struct in_addr inadTmp;
    char* szIpAddr;

    if (pIpAddrTable == NULL ||  str == NULL)
        return FALSE;
    str[0] = '\0';
    for (DWORD dwIdx = 0; dwIdx < pIpAddrTable->dwNumEntries; dwIdx++)
    {
        if (dwIndex == pIpAddrTable->table[dwIdx].dwIndex)
        {
            inadTmp.s_addr = pIpAddrTable->table[dwIdx].dwAddr;
            szIpAddr = inet_ntoa(inadTmp);
            if (szIpAddr)
            {
                strcpy(str, szIpAddr);
                return TRUE;
            }
            else
                return FALSE;
        }
    }
    return FALSE;

}

bool InterfaceIpToIdxAndMask | ( | PMIB_IPADDRTABLE | pIpAddrTable,
 |  | char | str[],
 |  | DWORD & | dwIndex,
 |  | DWORD & | dwMask
 | ) |  |

Definition at line 450 of file IPRoute.Cpp.

{
    DWORD dwIfIpAddr; // Interface Ip Address

    if (pIpAddrTable == NULL)
        return FALSE;

    dwIfIpAddr = inet_addr(str);
    if (dwIfIpAddr == INADDR_NONE)
        return FALSE;

    for (DWORD dwIdx = 0; dwIdx < pIpAddrTable->dwNumEntries; dwIdx++)
    {
        if (dwIfIpAddr == pIpAddrTable->table[dwIdx].dwAddr)
        {
            dwIndex = pIpAddrTable->table[dwIdx].dwIndex;
            dwMask = pIpAddrTable->table[dwIdx].dwMask;
            return TRUE;
        }
    }
    return FALSE;
}

DWORD MyGetIpAddrTable | ( | PMIB_IPADDRTABLE & | pIpAddrTable,
 |  | BOOL | fOrder = FALSE
 | ) |  |

Definition at line 477 of file IPRoute.Cpp.

{
    DWORD status = NO_ERROR;
    DWORD statusRetry = NO_ERROR;
    DWORD dwActualSize = 0;

    // query for buffer size needed
    status = GetIpAddrTable(pIpAddrTable, &dwActualSize, fOrder);

    if (status == NO_ERROR)
    {
        printf("No error\n");
        return status;
    }
    else if (status == ERROR_INSUFFICIENT_BUFFER)
    {
        // need more space

        pIpAddrTable = (PMIB_IPADDRTABLE) malloc(dwActualSize);
        assert(pIpAddrTable);

        statusRetry = GetIpAddrTable(pIpAddrTable, &dwActualSize, fOrder);
        return statusRetry;
    }
    else
    {
        return status;
    }
}

DWORD MyGetIpForwardTable | ( | PMIB_IPFORWARDTABLE & | pIpRouteTab,
 |  | BOOL | fOrder = FALSE
 | ) |  |

Definition at line 304 of file IPRoute.Cpp.

{
    DWORD status = NO_ERROR;
    DWORD statusRetry = NO_ERROR;
    DWORD dwActualSize = 0;

    // query for buffer size needed
    status = GetIpForwardTable(pIpRouteTab, &dwActualSize, fOrder);

    if (status == NO_ERROR)
    {
        printf("No error\n");
        return status;
    }
    else if (status == ERROR_INSUFFICIENT_BUFFER)
    {
        // need more space

        pIpRouteTab = (PMIB_IPFORWARDTABLE) malloc(dwActualSize);
        assert(pIpRouteTab);

        statusRetry = GetIpForwardTable(pIpRouteTab, &dwActualSize, fOrder);
        return statusRetry;
    }
    else
    {
        return status;
    }

}

void PrintIpForwardTable ( PMIB_IPFORWARDTABLE pIpRouteTable )

Definition at line 348 of file IPRoute.Cpp.

{
    DWORD i, dwStatus, dwCurrIndex;
    struct in_addr inadDest;
    struct in_addr inadMask;
    struct in_addr inadGateway;
    char szIpAddr[128];          // ip address of an interface index
    PMIB_IPADDRTABLE pIpAddrTable = NULL;

    char szDestIp[128];
    char szMaskIp[128];
    char szGatewayIp[128];

    if (pIpRouteTable == NULL)
    {
        printf( "pIpRouteTable == NULL in line %d\n", __LINE__);
        return;
    }
    // get IP Address Table for mapping interface index number to ip address
    if ( (dwStatus = MyGetIpAddrTable(pIpAddrTable)) != NO_ERROR)
    {
        printf("GetIpAddrTable returned 0x%x\n", dwStatus);
        if (pIpAddrTable)
            free(pIpAddrTable);
        return;
    }
    assert(pIpAddrTable);

    printf("Active Routes:\n\n");

    printf("  Network Address          Netmask  Gateway Address        Interface  Metric\n");
    for (i = 0; i < pIpRouteTable->dwNumEntries; i++)
    {
        dwCurrIndex = pIpRouteTable->table[i].dwForwardIfIndex;
        if (InterfaceIdxToInterfaceIp(pIpAddrTable, dwCurrIndex, szIpAddr) == FALSE)
        {
            printf("Error: Could not convert Interface number 0x%X to IP address.\n",dwCurrIndex);
            if (pIpAddrTable)
                free(pIpAddrTable);
            return;
        }

        inadDest.s_addr = pIpRouteTable->table[i].dwForwardDest;
        inadMask.s_addr = pIpRouteTable->table[i].dwForwardMask;
        inadGateway.s_addr = pIpRouteTable->table[i].dwForwardNextHop;

        strcpy(szDestIp, inet_ntoa(inadDest));
        strcpy(szMaskIp, inet_ntoa(inadMask));
        strcpy(szGatewayIp, inet_ntoa(inadGateway));
        printf("  %15s %16s %16s %16s %7d\n",
                szDestIp,
                szMaskIp,
                szGatewayIp,
                szIpAddr,
                pIpRouteTable->table[i].dwForwardMetric1);

    }

    if (pIpAddrTable)
        free(pIpAddrTable);

}

Generated on Wed Nov 13 2024 16:53:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/IPHelp/IPStat/IPStat.Cpp File Reference

  • NetDS
  • IPHelp
  • IPStat
Functions

IPStat.Cpp File Reference

#include "IpStat.h"

Go to the source code of this file.

Functions

void | DoGetConnTable (char *pszProto)
void | DoGetStat (char *pszProto)
void | DumpTcpTable (PMIB_TCPTABLE pTcpTable)
void | DumpUdpTable (PMIB_UDPTABLE pUdpTable)
void _cdecl | main (int argc, char **argv)
DWORD | MyGetIcmpStatistics (PMIB_ICMP &pIcmpStats)
DWORD | MyGetIpStatistics (PMIB_IPSTATS &pIpStats)
DWORD | MyGetTcpStatistics (PMIB_TCPSTATS &pTcpStats)
DWORD | MyGetTcpTable (PMIB_TCPTABLE &pTcpTable, BOOL fOrder)
DWORD | MyGetUdpStatistics (PMIB_UDPSTATS &pUdpStats)
DWORD | MyGetUdpTable (PMIB_UDPTABLE &pUdpTable, BOOL fOrder)
void | PrintIcmpStats (MIBICMPINFO *pStats)
void | PrintIpStats (PMIB_IPSTATS pStats)
void | PrintTcpStats (PMIB_TCPSTATS pStats)
void | PrintUdpStats (PMIB_UDPSTATS pStats)
void | Usage (char *pszProgramName)

Function Documentation

void DoGetConnTable ( char * pszProto )

Definition at line 87 of file IPStat.Cpp.

{
    DWORD dwStatus;
    if (_strnicmp(pszProto, "tcp", 3) == 0)
    {
        //Print Tcp Connnection Table
        PMIB_TCPTABLE pTcpTable = NULL;
        dwStatus = MyGetTcpTable(pTcpTable, TRUE);
        if (dwStatus != NO_ERROR)
        {
            printf("Ipstat: Couldn't get tcp connection table.\n");
            if (pTcpTable)
                free(pTcpTable);
            return;
        }
        else
        {
            DumpTcpTable(pTcpTable);
            free(pTcpTable);
        }
    }
    else if (_strnicmp(pszProto, "udp", 3) == 0)
    {
        //Print Udp Table
        PMIB_UDPTABLE pUdpTable = NULL;
        dwStatus = MyGetUdpTable(pUdpTable, TRUE);
        if (dwStatus != NO_ERROR)
        {
            printf("Ipstat: Couldn't get udp table.\n");
            if (pUdpTable)
                free(pUdpTable);
            return;
        }
        else
        {
            DumpUdpTable(pUdpTable);
            free(pUdpTable);
        }
    }
    else
        Usage("IpStat");
}

void DoGetStat ( char * pszProto )

Definition at line 130 of file IPStat.Cpp.

{
    if (pszProto == NULL)
    {
        // by default, display all statistics
        {
        PMIB_IPSTATS pIpStats = NULL;
        if (MyGetIpStatistics(pIpStats) != NO_ERROR)
            printf("IpStat: error in getting ip statistics.\n");
        else
            PrintIpStats(pIpStats);

        if (pIpStats)
            free(pIpStats);
        }
        {
        PMIB_ICMP pIcmpStats = NULL;
        if (MyGetIcmpStatistics(pIcmpStats) != NO_ERROR)
            printf("IpStat: error in getting icmp statistics.\n");
        else
            PrintIcmpStats(&(pIcmpStats->stats));

        if (pIcmpStats)
            free(pIcmpStats);

        }
        {
        PMIB_TCPSTATS pTcpStats = NULL;
        if (MyGetTcpStatistics(pTcpStats) != NO_ERROR)
            printf("IpStat: error in getting tcp statistics.\n");
        else
            PrintTcpStats(pTcpStats);

        if (pTcpStats)
            free(pTcpStats);
        }
        {
        PMIB_UDPSTATS pUdpStats = NULL;
        if (MyGetUdpStatistics(pUdpStats) != NO_ERROR)
            printf("IpStat: error in getting udp statistics.\n");
        else
            PrintUdpStats(pUdpStats);

        if (pUdpStats)
            free(pUdpStats);

        }
    }
    else if (_strnicmp(pszProto, "ip", 2) == 0)
    {
        PMIB_IPSTATS pIpStats = NULL;
        if (MyGetIpStatistics(pIpStats) != NO_ERROR)
            printf("IpStat: error in getting ip statistics.\n");
        else
            PrintIpStats(pIpStats);

        if (pIpStats)
            free(pIpStats);
    }

    else if (_strnicmp(pszProto, "icmp", 4) == 0)
    {
        PMIB_ICMP pIcmpStats = NULL;
        if (MyGetIcmpStatistics(pIcmpStats) != NO_ERROR)
            printf("IpStat: error in getting icmp statistics.\n");
        else
            PrintIcmpStats(&(pIcmpStats->stats));

        if (pIcmpStats)
            free(pIcmpStats);

    }

    else if (_strnicmp(pszProto, "tcp", 3) == 0)
    {
        PMIB_TCPSTATS pTcpStats = NULL;
        if (MyGetTcpStatistics(pTcpStats) != NO_ERROR)
            printf("IpStat: error in getting tcp statistics.\n");
        else
            PrintTcpStats(pTcpStats);

        if (pTcpStats)
            free(pTcpStats);

    }

    else if (_strnicmp(pszProto, "udp", 3) == 0)
    {
        PMIB_UDPSTATS pUdpStats = NULL;
        if (MyGetUdpStatistics(pUdpStats) != NO_ERROR)
            printf("IpStat: error in getting udp statistics.\n");
        else
            PrintUdpStats(pUdpStats);

        if (pUdpStats)
            free(pUdpStats);
    }
    else
        printf("IpStat: no available statistics for %s.\n", pszProto);

}

void DumpTcpTable ( PMIB_TCPTABLE pTcpTable )

Definition at line 233 of file IPStat.Cpp.

{
    char    strState[MAX_STRLEN];
    struct  in_addr    inadLocal, inadRemote;
    DWORD   dwRemotePort = 0;
    char    szLocalIp[MAX_STRLEN];
    char    szRemIp[MAX_STRLEN];

    if (pTcpTable != NULL)
    {
        printf("TCP TABLE\n");
        printf("%20s %10s %20s %10s %s\n", "Loc Addr", "Loc Port", "Rem Addr",
                "Rem Port", "State");
        for (UINT i = 0; i < pTcpTable->dwNumEntries; ++i)
        {
            switch (pTcpTable->table[i].dwState)
            {
            case MIB_TCP_STATE_CLOSED:
                strcpy(strState, "CLOSED");
                break;
            case MIB_TCP_STATE_TIME_WAIT:
                strcpy(strState, "TIME_WAIT");
                break;
            case MIB_TCP_STATE_LAST_ACK:
                strcpy(strState, "LAST_ACK");
                break;
            case MIB_TCP_STATE_CLOSING:
                strcpy(strState, "CLOSING");
                break;
            case MIB_TCP_STATE_CLOSE_WAIT:
                strcpy(strState, "CLOSE_WAIT");
                break;
            case MIB_TCP_STATE_FIN_WAIT1:
                strcpy(strState, "FIN_WAIT1");
                break;
            case MIB_TCP_STATE_ESTAB:
                strcpy(strState, "ESTAB");
                break;
            case MIB_TCP_STATE_SYN_RCVD:
                strcpy(strState, "SYN_RCVD");
                break;
            case MIB_TCP_STATE_SYN_SENT:
                strcpy(strState, "SYN_SENT");
                break;
            case MIB_TCP_STATE_LISTEN:
                strcpy(strState, "LISTEN");
                break;
            case MIB_TCP_STATE_DELETE_TCB:
                strcpy(strState, "DELETE");
                break;
            default:
                printf("Error: unknown state!\n");
                break;
            }
            inadLocal.s_addr = pTcpTable->table[i].dwLocalAddr;

            if (strcmp(strState, "LISTEN") != 0)
            {
                dwRemotePort = pTcpTable->table[i].dwRemotePort;
            }
            else
                dwRemotePort = 0;

            inadRemote.s_addr = pTcpTable->table[i].dwRemoteAddr;
            strcpy(szLocalIp, inet_ntoa(inadLocal));
            strcpy(szRemIp, inet_ntoa(inadRemote));
            printf("%20s %10u %20s %10u %s\n",
                szLocalIp,  ntohs((unsigned short)(0x0000FFFF & pTcpTable->table[i].dwLocalPort)),
                szRemIp, ntohs((unsigned short)(0x0000FFFF & dwRemotePort)),
                strState);
        }
    }
}

void DumpUdpTable ( PMIB_UDPTABLE pUdpTable )

Definition at line 308 of file IPStat.Cpp.

{

    struct in_addr    inadLocal;
    if (pUdpTable != NULL)
    {
        printf("UDP TABLE\n");
        printf("%20s %10s\n", "Loc Addr", "Loc Port");
        for (UINT i = 0; i < pUdpTable->dwNumEntries; ++i)
        {
            inadLocal.s_addr = pUdpTable->table[i].dwLocalAddr;

            printf("%20s %10u \n",
                inet_ntoa(inadLocal), ntohs((unsigned short)(0x0000FFFF & pUdpTable->table[i].dwLocalPort)));
        }
    }
}

void _cdecl main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 41 of file IPStat.Cpp.

{
    WORD wVersionRequested = MAKEWORD(1,1);
    WSADATA wsaData;
    int nRet;

    nRet = WSAStartup(wVersionRequested, &wsaData);
    if (wsaData.wVersion != wVersionRequested)
    {
        fprintf(stderr,"\n Wrong version\n");
        return;
    }

    if ((argc < 2) || (argv[1][0] != '-'))
        Usage("IpStat");
    if (strlen(argv[1]) > 2)
        Usage("IpStat");

    switch(argv[1][1])
    {
    case 'p':
        // Print connection table
        if (argc == 3)
            DoGetConnTable(argv[2]);
        else
            Usage("IpStat");
        break;
    case 's':
        // show statistics
        if (argc == 4 && argv[2][1] == 'p')
            DoGetStat(argv[3]); // Get stat for a specific protocol
        else if (argc == 2)
            DoGetStat(); // Get stat for all protocols
        else
            Usage("IpStat");
        break;

    default:
        // help
        Usage("IpStat");
        break;
    }
    WSACleanup();
}

DWORD MyGetIcmpStatistics ( PMIB_ICMP & pIcmpStats )

Definition at line 399 of file IPStat.Cpp.

{
    pIcmpStats = (PMIB_ICMP)malloc(sizeof(MIB_ICMP));
    assert(pIcmpStats != NULL);
    return GetIcmpStatistics(pIcmpStats);
}

DWORD MyGetIpStatistics ( PMIB_IPSTATS & pIpStats )

Definition at line 392 of file IPStat.Cpp.

{
    pIpStats = (PMIB_IPSTATS)malloc(sizeof(MIB_IPSTATS));
    assert(pIpStats != NULL);
    return GetIpStatistics(pIpStats);
}

DWORD MyGetTcpStatistics ( PMIB_TCPSTATS & pTcpStats )

Definition at line 406 of file IPStat.Cpp.

{
    pTcpStats = (PMIB_TCPSTATS)malloc(sizeof(MIB_TCPSTATS));
    assert(pTcpStats != NULL);
    return GetTcpStatistics(pTcpStats);
}

DWORD MyGetTcpTable | ( | PMIB_TCPTABLE & | pTcpTable,
 |  | BOOL | fOrder
 | ) |  |

Definition at line 329 of file IPStat.Cpp.

{
    DWORD status = NO_ERROR;
    DWORD statusRetry = NO_ERROR;
    DWORD dwActualSize = 0;

    // query for buffer size needed
    status = GetTcpTable(pTcpTable, &dwActualSize, fOrder);

    if (status == NO_ERROR)
    {
        printf("No error\n");
        return status;
    }
    else if (status == ERROR_INSUFFICIENT_BUFFER)
    {
        // need more space
        pTcpTable = (PMIB_TCPTABLE) malloc(dwActualSize);
        assert(pTcpTable);

        statusRetry = GetTcpTable(pTcpTable, &dwActualSize, fOrder);
        return statusRetry;
    }
    else
    {
        return status;
    }
}

DWORD MyGetUdpStatistics ( PMIB_UDPSTATS & pUdpStats )

Definition at line 413 of file IPStat.Cpp.

{
    pUdpStats = (PMIB_UDPSTATS)malloc(sizeof(MIB_UDPSTATS));
    assert(pUdpStats != NULL);
    return GetUdpStatistics(pUdpStats);
}

DWORD MyGetUdpTable | ( | PMIB_UDPTABLE & | pUdpTable,
 |  | BOOL | fOrder
 | ) |  |

Definition at line 362 of file IPStat.Cpp.

{
    DWORD status = NO_ERROR;
    DWORD statusRetry = NO_ERROR;
    DWORD dwActualSize = 0;

    // query for buffer size needed
    status = GetUdpTable(pUdpTable, &dwActualSize, fOrder);

    if (status == NO_ERROR)
    {
        printf("No error\n");
        return status;
    }
    else if (status == ERROR_INSUFFICIENT_BUFFER)
    {
        // need more space
        pUdpTable = (PMIB_UDPTABLE) malloc(dwActualSize);
        assert(pUdpTable);

        statusRetry = GetUdpTable(pUdpTable, &dwActualSize, fOrder);
        return statusRetry;
    }
    else
    {
        return status;
    }
}

void PrintIcmpStats ( MIBICMPINFO * pStats )

Definition at line 477 of file IPStat.Cpp.

{
    if (pStats != NULL)
    {
        printf("\n%20s %10s %10s\n","ICMP Statistics", "IN", "OUT");
        printf("%20s %10s %10s\n","---------------", "------", "------");
        printf("%20s %10lu %10lu\n", "dwMsgs", pStats->icmpInStats.dwMsgs, pStats->icmpOutStats.dwMsgs);
        printf("%20s %10lu %10lu\n", "dwErrors", pStats->icmpInStats.dwErrors, pStats->icmpOutStats.dwErrors);
        printf("%20s %10lu %10lu\n", "dwDestUnreachs", pStats->icmpInStats.dwDestUnreachs, pStats->icmpOutStats.dwDestUnreachs);
        printf("%20s %10lu %10lu\n", "dwTimeExcds", pStats->icmpInStats.dwTimeExcds, pStats->icmpOutStats.dwTimeExcds);
        printf("%20s %10lu %10lu\n", "dwParmProbs", pStats->icmpInStats.dwParmProbs, pStats->icmpOutStats.dwParmProbs);
        printf("%20s %10lu %10lu\n", "dwSrcQuenchs", pStats->icmpInStats.dwSrcQuenchs, pStats->icmpOutStats.dwSrcQuenchs);
        printf("%20s %10lu %10lu\n", "dwRedirects", pStats->icmpInStats.dwRedirects, pStats->icmpOutStats.dwRedirects);
        printf("%20s %10lu %10lu\n", "dwEchos", pStats->icmpInStats.dwEchos, pStats->icmpOutStats.dwEchos);
        printf("%20s %10lu %10lu\n", "dwEchoReps", pStats->icmpInStats.dwEchoReps, pStats->icmpOutStats.dwEchoReps);
        printf("%20s %10lu %10lu\n", "dwTimestamps", pStats->icmpInStats.dwTimestamps, pStats->icmpOutStats.dwTimestamps);
        printf("%20s %10lu %10lu\n", "dwTimestampReps", pStats->icmpInStats.dwTimestampReps, pStats->icmpOutStats.dwTimestampReps);
        printf("%20s %10lu %10lu\n", "dwAddrMasks", pStats->icmpInStats.dwAddrMasks, pStats->icmpOutStats.dwAddrMasks);
        printf("%20s %10lu %10lu\n", "dwAddrMaskReps", pStats->icmpInStats.dwAddrMaskReps, pStats->icmpOutStats.dwAddrMaskReps);
    }
}

void PrintIpStats ( PMIB_IPSTATS pStats )

Definition at line 420 of file IPStat.Cpp.

{
    if (pStats != NULL)
    {
        printf("\nIP Statistics:\n");

        printf("\
  dwForwarding       = %lu\n\
  dwDefaultTTL       = %lu\n\
  dwInReceives       = %lu\n\
  dwInHdrErrors      = %lu\n\
  dwInAddrErrors     = %lu\n\
  dwForwDatagrams    = %lu\n\
  dwInUnknownProtos  = %lu\n\
  dwInDiscards       = %lu\n\
  dwInDelivers       = %lu\n\
  dwOutRequests      = %lu\n\
  dwRoutingDiscards  = %lu\n\
  dwOutDiscards      = %lu\n\
  dwOutNoRoutes      = %lu\n\
  dwReasmTimeout     = %lu\n\
  dwReasmReqds       = %lu\n\
  dwReasmOks         = %lu\n\
  dwReasmFails       = %lu\n\
  dwFragOks          = %lu\n\
  dwFragFails        = %lu\n\
  dwFragCreates      = %lu\n\
  dwNumIf            = %lu\n\
  dwNumAddr          = %lu\n\
  dwNumRoutes        = %lu\n",
                  pStats->dwForwarding,
                  pStats->dwDefaultTTL,
                  pStats->dwInReceives,
                  pStats->dwInHdrErrors,
                  pStats->dwInAddrErrors,
                  pStats->dwForwDatagrams,
                  pStats->dwInUnknownProtos,
                  pStats->dwInDiscards,
                  pStats->dwInDelivers,
                  pStats->dwOutRequests,
                  pStats->dwRoutingDiscards,
                  pStats->dwOutDiscards,
                  pStats->dwOutNoRoutes,
                  pStats->dwReasmTimeout,
                  pStats->dwReasmReqds,
                  pStats->dwReasmOks,
                  pStats->dwReasmFails,
                  pStats->dwFragOks,
                  pStats->dwFragFails,
                  pStats->dwFragCreates,
                  pStats->dwNumIf,
                  pStats->dwNumAddr,
                  pStats->dwNumRoutes);
    }

}

void PrintTcpStats ( PMIB_TCPSTATS pStats )

Definition at line 499 of file IPStat.Cpp.

{
    if (pStats != NULL)
    {
        printf("\nTCP Statistics\n");
        printf("\
  dwRtoAlgorithm     = %lu\n\
  dwRtoMin           = %lu\n\
  dwRtoMax           = %lu\n\
  dwMaxConn          = %lu\n\
  dwActiveOpens      = %lu\n\
  dwPassiveOpens     = %lu\n\
  dwAttemptFails     = %lu\n\
  dwEstabResets      = %lu\n\
  dwCurrEstab        = %lu\n\
  dwInSegs           = %lu\n\
  dwOutSegs          = %lu\n\
  dwRetransSegs      = %lu\n\
  dwInErrs           = %lu\n\
  dwOutRsts          = %lu\n\
  dwNumConns         = %lu\n",
pStats->dwRtoAlgorithm,
pStats->dwRtoMin,
pStats->dwRtoMax,
pStats->dwMaxConn,
pStats->dwActiveOpens,
pStats->dwPassiveOpens,
pStats->dwAttemptFails,
pStats->dwEstabResets,
pStats->dwCurrEstab,
pStats->dwInSegs,
pStats->dwOutSegs,
pStats->dwRetransSegs,
pStats->dwInErrs,
pStats->dwOutRsts,
pStats->dwNumConns);
    }
}

void PrintUdpStats ( PMIB_UDPSTATS pStats )

Definition at line 538 of file IPStat.Cpp.

{
    if (pStats != NULL)
    {
        printf("\nUDP Statistics\n");
        printf("\
  dwInDatagrams      = %lu\n\
  dwNoPorts          = %lu\n\
  dwInErrors         = %lu\n\
  dwOutDatagrams     = %lu\n\
  dwNumAddrs         = %lu\n",
pStats->dwInDatagrams,
pStats->dwNoPorts,
pStats->dwInErrors,
pStats->dwOutDatagrams,
pStats->dwNumAddrs);
    }
}

void Usage ( char * pszProgramName )

Definition at line 19 of file IPStat.Cpp.

{
    printf("Manipulates IP Statistics.\n\n");

    printf("%s -p proto      Shows connections for the protocol specified\n", pszProgramName);
    printf("                     by proto, proto may be tcp or udp.\n");
    printf("%s -s [-p proto] Displays per-protocol statistics.\n", pszProgramName);
    printf("                     By default, statistics are shown for\n");
    printf("                     IP, ICMP, TCP and UDP; the -p option\n");
    printf("                     may be used to specify a subset of the default.\n");

    printf("Examples:\n\n");

    printf("> IpStat -p tcp\n");
    printf("> IpStat  -s\n");

    WSACleanup();
    exit(1);
}

Generated on Wed Nov 13 2024 16:53:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/IPHelp/IPStat/IPStat.h File Reference

  • NetDS
  • IPHelp
  • IPStat
Defines | Functions

IPStat.h File Reference

#include <windows.h>
#include <winsock.h>
#include <iphlpapi.h>
#include <assert.h>
#include <stdlib.h>
#include <malloc.h>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <iptypes.h>

Go to the source code of this file.

Defines

#define | MAX_STRLEN 128

Functions

void | DoGetConnTable (char *pszProto)
void | DoGetStat (char *pszProto=NULL)
void | DumpTcpTable (PMIB_TCPTABLE pTcpTable)
void | DumpUdpTable (PMIB_UDPTABLE pUdpTable)
DWORD | MyGetIcmpStatistics (PMIB_ICMP &pIcmpStats)
DWORD | MyGetIpStatistics (PMIB_IPSTATS &pIpStats)
DWORD | MyGetTcpStatistics (PMIB_TCPSTATS &pTcpStats)
DWORD | MyGetTcpTable (PMIB_TCPTABLE &pTcpTable, BOOL fOrder=FALSE)
DWORD | MyGetUdpStatistics (PMIB_UDPSTATS &pUdpStats)
DWORD | MyGetUdpTable (PMIB_UDPTABLE &pUdpTable, BOOL fOrder=FALSE)
void | PrintIcmpStats (MIBICMPINFO *pStats)
void | PrintIpStats (PMIB_IPSTATS pStats)
void | PrintTcpStats (PMIB_TCPSTATS pStats)
void | PrintUdpStats (PMIB_UDPSTATS pStats)

Define Documentation

#define MAX_STRLEN 128

Definition at line 17 of file IPStat.h.

Function Documentation

void DoGetConnTable ( char * pszProto )

Definition at line 87 of file IPStat.Cpp.

{
    DWORD dwStatus;
    if (_strnicmp(pszProto, "tcp", 3) == 0)
    {
        //Print Tcp Connnection Table
        PMIB_TCPTABLE pTcpTable = NULL;
        dwStatus = MyGetTcpTable(pTcpTable, TRUE);
        if (dwStatus != NO_ERROR)
        {
            printf("Ipstat: Couldn't get tcp connection table.\n");
            if (pTcpTable)
                free(pTcpTable);
            return;
        }
        else
        {
            DumpTcpTable(pTcpTable);
            free(pTcpTable);
        }
    }
    else if (_strnicmp(pszProto, "udp", 3) == 0)
    {
        //Print Udp Table
        PMIB_UDPTABLE pUdpTable = NULL;
        dwStatus = MyGetUdpTable(pUdpTable, TRUE);
        if (dwStatus != NO_ERROR)
        {
            printf("Ipstat: Couldn't get udp table.\n");
            if (pUdpTable)
                free(pUdpTable);
            return;
        }
        else
        {
            DumpUdpTable(pUdpTable);
            free(pUdpTable);
        }
    }
    else
        Usage("IpStat");
}

void DoGetStat ( char * pszProto = NULL )

Definition at line 130 of file IPStat.Cpp.

{
    if (pszProto == NULL)
    {
        // by default, display all statistics
        {
        PMIB_IPSTATS pIpStats = NULL;
        if (MyGetIpStatistics(pIpStats) != NO_ERROR)
            printf("IpStat: error in getting ip statistics.\n");
        else
            PrintIpStats(pIpStats);

        if (pIpStats)
            free(pIpStats);
        }
        {
        PMIB_ICMP pIcmpStats = NULL;
        if (MyGetIcmpStatistics(pIcmpStats) != NO_ERROR)
            printf("IpStat: error in getting icmp statistics.\n");
        else
            PrintIcmpStats(&(pIcmpStats->stats));

        if (pIcmpStats)
            free(pIcmpStats);

        }
        {
        PMIB_TCPSTATS pTcpStats = NULL;
        if (MyGetTcpStatistics(pTcpStats) != NO_ERROR)
            printf("IpStat: error in getting tcp statistics.\n");
        else
            PrintTcpStats(pTcpStats);

        if (pTcpStats)
            free(pTcpStats);
        }
        {
        PMIB_UDPSTATS pUdpStats = NULL;
        if (MyGetUdpStatistics(pUdpStats) != NO_ERROR)
            printf("IpStat: error in getting udp statistics.\n");
        else
            PrintUdpStats(pUdpStats);

        if (pUdpStats)
            free(pUdpStats);

        }
    }
    else if (_strnicmp(pszProto, "ip", 2) == 0)
    {
        PMIB_IPSTATS pIpStats = NULL;
        if (MyGetIpStatistics(pIpStats) != NO_ERROR)
            printf("IpStat: error in getting ip statistics.\n");
        else
            PrintIpStats(pIpStats);

        if (pIpStats)
            free(pIpStats);
    }

    else if (_strnicmp(pszProto, "icmp", 4) == 0)
    {
        PMIB_ICMP pIcmpStats = NULL;
        if (MyGetIcmpStatistics(pIcmpStats) != NO_ERROR)
            printf("IpStat: error in getting icmp statistics.\n");
        else
            PrintIcmpStats(&(pIcmpStats->stats));

        if (pIcmpStats)
            free(pIcmpStats);

    }

    else if (_strnicmp(pszProto, "tcp", 3) == 0)
    {
        PMIB_TCPSTATS pTcpStats = NULL;
        if (MyGetTcpStatistics(pTcpStats) != NO_ERROR)
            printf("IpStat: error in getting tcp statistics.\n");
        else
            PrintTcpStats(pTcpStats);

        if (pTcpStats)
            free(pTcpStats);

    }

    else if (_strnicmp(pszProto, "udp", 3) == 0)
    {
        PMIB_UDPSTATS pUdpStats = NULL;
        if (MyGetUdpStatistics(pUdpStats) != NO_ERROR)
            printf("IpStat: error in getting udp statistics.\n");
        else
            PrintUdpStats(pUdpStats);

        if (pUdpStats)
            free(pUdpStats);
    }
    else
        printf("IpStat: no available statistics for %s.\n", pszProto);

}

void DumpTcpTable ( PMIB_TCPTABLE pTcpTable )

Definition at line 233 of file IPStat.Cpp.

{
    char    strState[MAX_STRLEN];
    struct  in_addr    inadLocal, inadRemote;
    DWORD   dwRemotePort = 0;
    char    szLocalIp[MAX_STRLEN];
    char    szRemIp[MAX_STRLEN];

    if (pTcpTable != NULL)
    {
        printf("TCP TABLE\n");
        printf("%20s %10s %20s %10s %s\n", "Loc Addr", "Loc Port", "Rem Addr",
                "Rem Port", "State");
        for (UINT i = 0; i < pTcpTable->dwNumEntries; ++i)
        {
            switch (pTcpTable->table[i].dwState)
            {
            case MIB_TCP_STATE_CLOSED:
                strcpy(strState, "CLOSED");
                break;
            case MIB_TCP_STATE_TIME_WAIT:
                strcpy(strState, "TIME_WAIT");
                break;
            case MIB_TCP_STATE_LAST_ACK:
                strcpy(strState, "LAST_ACK");
                break;
            case MIB_TCP_STATE_CLOSING:
                strcpy(strState, "CLOSING");
                break;
            case MIB_TCP_STATE_CLOSE_WAIT:
                strcpy(strState, "CLOSE_WAIT");
                break;
            case MIB_TCP_STATE_FIN_WAIT1:
                strcpy(strState, "FIN_WAIT1");
                break;
            case MIB_TCP_STATE_ESTAB:
                strcpy(strState, "ESTAB");
                break;
            case MIB_TCP_STATE_SYN_RCVD:
                strcpy(strState, "SYN_RCVD");
                break;
            case MIB_TCP_STATE_SYN_SENT:
                strcpy(strState, "SYN_SENT");
                break;
            case MIB_TCP_STATE_LISTEN:
                strcpy(strState, "LISTEN");
                break;
            case MIB_TCP_STATE_DELETE_TCB:
                strcpy(strState, "DELETE");
                break;
            default:
                printf("Error: unknown state!\n");
                break;
            }
            inadLocal.s_addr = pTcpTable->table[i].dwLocalAddr;

            if (strcmp(strState, "LISTEN") != 0)
            {
                dwRemotePort = pTcpTable->table[i].dwRemotePort;
            }
            else
                dwRemotePort = 0;

            inadRemote.s_addr = pTcpTable->table[i].dwRemoteAddr;
            strcpy(szLocalIp, inet_ntoa(inadLocal));
            strcpy(szRemIp, inet_ntoa(inadRemote));
            printf("%20s %10u %20s %10u %s\n",
                szLocalIp,  ntohs((unsigned short)(0x0000FFFF & pTcpTable->table[i].dwLocalPort)),
                szRemIp, ntohs((unsigned short)(0x0000FFFF & dwRemotePort)),
                strState);
        }
    }
}

void DumpUdpTable ( PMIB_UDPTABLE pUdpTable )

Definition at line 308 of file IPStat.Cpp.

{

    struct in_addr    inadLocal;
    if (pUdpTable != NULL)
    {
        printf("UDP TABLE\n");
        printf("%20s %10s\n", "Loc Addr", "Loc Port");
        for (UINT i = 0; i < pUdpTable->dwNumEntries; ++i)
        {
            inadLocal.s_addr = pUdpTable->table[i].dwLocalAddr;

            printf("%20s %10u \n",
                inet_ntoa(inadLocal), ntohs((unsigned short)(0x0000FFFF & pUdpTable->table[i].dwLocalPort)));
        }
    }
}

DWORD MyGetIcmpStatistics ( PMIB_ICMP & pIcmpStats )

Definition at line 399 of file IPStat.Cpp.

{
    pIcmpStats = (PMIB_ICMP)malloc(sizeof(MIB_ICMP));
    assert(pIcmpStats != NULL);
    return GetIcmpStatistics(pIcmpStats);
}

DWORD MyGetIpStatistics ( PMIB_IPSTATS & pIpStats )

Definition at line 392 of file IPStat.Cpp.

{
    pIpStats = (PMIB_IPSTATS)malloc(sizeof(MIB_IPSTATS));
    assert(pIpStats != NULL);
    return GetIpStatistics(pIpStats);
}

DWORD MyGetTcpStatistics ( PMIB_TCPSTATS & pTcpStats )

Definition at line 406 of file IPStat.Cpp.

{
    pTcpStats = (PMIB_TCPSTATS)malloc(sizeof(MIB_TCPSTATS));
    assert(pTcpStats != NULL);
    return GetTcpStatistics(pTcpStats);
}

DWORD MyGetTcpTable | ( | PMIB_TCPTABLE & | pTcpTable,
 |  | BOOL | fOrder = FALSE
 | ) |  |

Definition at line 329 of file IPStat.Cpp.

{
    DWORD status = NO_ERROR;
    DWORD statusRetry = NO_ERROR;
    DWORD dwActualSize = 0;

    // query for buffer size needed
    status = GetTcpTable(pTcpTable, &dwActualSize, fOrder);

    if (status == NO_ERROR)
    {
        printf("No error\n");
        return status;
    }
    else if (status == ERROR_INSUFFICIENT_BUFFER)
    {
        // need more space
        pTcpTable = (PMIB_TCPTABLE) malloc(dwActualSize);
        assert(pTcpTable);

        statusRetry = GetTcpTable(pTcpTable, &dwActualSize, fOrder);
        return statusRetry;
    }
    else
    {
        return status;
    }
}

DWORD MyGetUdpStatistics ( PMIB_UDPSTATS & pUdpStats )

Definition at line 413 of file IPStat.Cpp.

{
    pUdpStats = (PMIB_UDPSTATS)malloc(sizeof(MIB_UDPSTATS));
    assert(pUdpStats != NULL);
    return GetUdpStatistics(pUdpStats);
}

DWORD MyGetUdpTable | ( | PMIB_UDPTABLE & | pUdpTable,
 |  | BOOL | fOrder = FALSE
 | ) |  |

Definition at line 362 of file IPStat.Cpp.

{
    DWORD status = NO_ERROR;
    DWORD statusRetry = NO_ERROR;
    DWORD dwActualSize = 0;

    // query for buffer size needed
    status = GetUdpTable(pUdpTable, &dwActualSize, fOrder);

    if (status == NO_ERROR)
    {
        printf("No error\n");
        return status;
    }
    else if (status == ERROR_INSUFFICIENT_BUFFER)
    {
        // need more space
        pUdpTable = (PMIB_UDPTABLE) malloc(dwActualSize);
        assert(pUdpTable);

        statusRetry = GetUdpTable(pUdpTable, &dwActualSize, fOrder);
        return statusRetry;
    }
    else
    {
        return status;
    }
}

void PrintIcmpStats ( MIBICMPINFO * pStats )

Definition at line 477 of file IPStat.Cpp.

{
    if (pStats != NULL)
    {
        printf("\n%20s %10s %10s\n","ICMP Statistics", "IN", "OUT");
        printf("%20s %10s %10s\n","---------------", "------", "------");
        printf("%20s %10lu %10lu\n", "dwMsgs", pStats->icmpInStats.dwMsgs, pStats->icmpOutStats.dwMsgs);
        printf("%20s %10lu %10lu\n", "dwErrors", pStats->icmpInStats.dwErrors, pStats->icmpOutStats.dwErrors);
        printf("%20s %10lu %10lu\n", "dwDestUnreachs", pStats->icmpInStats.dwDestUnreachs, pStats->icmpOutStats.dwDestUnreachs);
        printf("%20s %10lu %10lu\n", "dwTimeExcds", pStats->icmpInStats.dwTimeExcds, pStats->icmpOutStats.dwTimeExcds);
        printf("%20s %10lu %10lu\n", "dwParmProbs", pStats->icmpInStats.dwParmProbs, pStats->icmpOutStats.dwParmProbs);
        printf("%20s %10lu %10lu\n", "dwSrcQuenchs", pStats->icmpInStats.dwSrcQuenchs, pStats->icmpOutStats.dwSrcQuenchs);
        printf("%20s %10lu %10lu\n", "dwRedirects", pStats->icmpInStats.dwRedirects, pStats->icmpOutStats.dwRedirects);
        printf("%20s %10lu %10lu\n", "dwEchos", pStats->icmpInStats.dwEchos, pStats->icmpOutStats.dwEchos);
        printf("%20s %10lu %10lu\n", "dwEchoReps", pStats->icmpInStats.dwEchoReps, pStats->icmpOutStats.dwEchoReps);
        printf("%20s %10lu %10lu\n", "dwTimestamps", pStats->icmpInStats.dwTimestamps, pStats->icmpOutStats.dwTimestamps);
        printf("%20s %10lu %10lu\n", "dwTimestampReps", pStats->icmpInStats.dwTimestampReps, pStats->icmpOutStats.dwTimestampReps);
        printf("%20s %10lu %10lu\n", "dwAddrMasks", pStats->icmpInStats.dwAddrMasks, pStats->icmpOutStats.dwAddrMasks);
        printf("%20s %10lu %10lu\n", "dwAddrMaskReps", pStats->icmpInStats.dwAddrMaskReps, pStats->icmpOutStats.dwAddrMaskReps);
    }
}

void PrintIpStats ( PMIB_IPSTATS pStats )

Definition at line 420 of file IPStat.Cpp.

{
    if (pStats != NULL)
    {
        printf("\nIP Statistics:\n");

        printf("\
  dwForwarding       = %lu\n\
  dwDefaultTTL       = %lu\n\
  dwInReceives       = %lu\n\
  dwInHdrErrors      = %lu\n\
  dwInAddrErrors     = %lu\n\
  dwForwDatagrams    = %lu\n\
  dwInUnknownProtos  = %lu\n\
  dwInDiscards       = %lu\n\
  dwInDelivers       = %lu\n\
  dwOutRequests      = %lu\n\
  dwRoutingDiscards  = %lu\n\
  dwOutDiscards      = %lu\n\
  dwOutNoRoutes      = %lu\n\
  dwReasmTimeout     = %lu\n\
  dwReasmReqds       = %lu\n\
  dwReasmOks         = %lu\n\
  dwReasmFails       = %lu\n\
  dwFragOks          = %lu\n\
  dwFragFails        = %lu\n\
  dwFragCreates      = %lu\n\
  dwNumIf            = %lu\n\
  dwNumAddr          = %lu\n\
  dwNumRoutes        = %lu\n",
                  pStats->dwForwarding,
                  pStats->dwDefaultTTL,
                  pStats->dwInReceives,
                  pStats->dwInHdrErrors,
                  pStats->dwInAddrErrors,
                  pStats->dwForwDatagrams,
                  pStats->dwInUnknownProtos,
                  pStats->dwInDiscards,
                  pStats->dwInDelivers,
                  pStats->dwOutRequests,
                  pStats->dwRoutingDiscards,
                  pStats->dwOutDiscards,
                  pStats->dwOutNoRoutes,
                  pStats->dwReasmTimeout,
                  pStats->dwReasmReqds,
                  pStats->dwReasmOks,
                  pStats->dwReasmFails,
                  pStats->dwFragOks,
                  pStats->dwFragFails,
                  pStats->dwFragCreates,
                  pStats->dwNumIf,
                  pStats->dwNumAddr,
                  pStats->dwNumRoutes);
    }

}

void PrintTcpStats ( PMIB_TCPSTATS pStats )

Definition at line 499 of file IPStat.Cpp.

{
    if (pStats != NULL)
    {
        printf("\nTCP Statistics\n");
        printf("\
  dwRtoAlgorithm     = %lu\n\
  dwRtoMin           = %lu\n\
  dwRtoMax           = %lu\n\
  dwMaxConn          = %lu\n\
  dwActiveOpens      = %lu\n\
  dwPassiveOpens     = %lu\n\
  dwAttemptFails     = %lu\n\
  dwEstabResets      = %lu\n\
  dwCurrEstab        = %lu\n\
  dwInSegs           = %lu\n\
  dwOutSegs          = %lu\n\
  dwRetransSegs      = %lu\n\
  dwInErrs           = %lu\n\
  dwOutRsts          = %lu\n\
  dwNumConns         = %lu\n",
pStats->dwRtoAlgorithm,
pStats->dwRtoMin,
pStats->dwRtoMax,
pStats->dwMaxConn,
pStats->dwActiveOpens,
pStats->dwPassiveOpens,
pStats->dwAttemptFails,
pStats->dwEstabResets,
pStats->dwCurrEstab,
pStats->dwInSegs,
pStats->dwOutSegs,
pStats->dwRetransSegs,
pStats->dwInErrs,
pStats->dwOutRsts,
pStats->dwNumConns);
    }
}

void PrintUdpStats ( PMIB_UDPSTATS pStats )

Definition at line 538 of file IPStat.Cpp.

{
    if (pStats != NULL)
    {
        printf("\nUDP Statistics\n");
        printf("\
  dwInDatagrams      = %lu\n\
  dwNoPorts          = %lu\n\
  dwInErrors         = %lu\n\
  dwOutDatagrams     = %lu\n\
  dwNumAddrs         = %lu\n",
pStats->dwInDatagrams,
pStats->dwNoPorts,
pStats->dwInErrors,
pStats->dwOutDatagrams,
pStats->dwNumAddrs);
    }
}

Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/c_draw/DisDraw.Cpp File Reference

  • NetDS
  • MessageQueuing
  • c_draw
Defines | Variables

DisDraw.Cpp File Reference

#include "stdafx.h"
#include "disdraw.h"
#include "drawdlg.h"
#include "logindlg.h"

Go to the source code of this file.

Defines

#define MAX_USERNAME_LEN 32

Variables

CDisdrawApp theApp

Define Documentation

#define MAX_USERNAME_LEN 32

Definition at line 28 of file DisDraw.Cpp.

Variable Documentation

CDisdrawApp theApp

Definition at line 53 of file DisDraw.Cpp.

Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/c_draw/DisDraw.h File Reference

  • NetDS
  • MessageQueuing
  • c_draw
Classes

DisDraw.h File Reference

#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Classes

class CDisdrawApp
Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/c_draw/DrawArea.Cpp File Reference

  • NetDS
  • MessageQueuing
  • c_draw

DrawArea.Cpp File Reference

#include "stdafx.h"
#include "disdraw.h"
#include "drawdlg.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/c_draw/DrawArea.h File Reference

  • NetDS
  • MessageQueuing
  • c_draw
Classes | Defines | Typedefs

DrawArea.h File Reference

Go to the source code of this file.

Classes

class | CDrawArea
struct | tagLINE

Defines

#define | MAX_MSG_BODY_LEN 32

Typedefs

typedef struct tagLINE | LINE

Define Documentation

#define MAX_MSG_BODY_LEN 32

Definition at line 16 of file DrawArea.h.

Typedef Documentation

typedef struct tagLINE LINE
Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/c_draw/DrawDlg.Cpp File Reference

  • NetDS
  • MessageQueuing
  • c_draw
Defines | Functions | Variables

DrawDlg.Cpp File Reference

#include "stdafx.h"
#include "disdraw.h"
#include "drawdlg.h"

Go to the source code of this file.

Defines

#define | MAX_FORMAT_NAME_LEN 256
#define | MAX_VAR 20

Functions

BOOL | LocateQueue (CString m_strLabel, WCHAR *wcsFormatName, DWORD dwNumChars)
DWORD | ReceiveUpdates (CDisdrawDlg *pDrawDlg)

Variables

CLSID guidDrawType

Define Documentation

#define MAX_FORMAT_NAME_LEN 256

Definition at line 26 of file DrawDlg.Cpp.

#define MAX_VAR 20

Definition at line 28 of file DrawDlg.Cpp.

Function Documentation

BOOL LocateQueue | ( | CString | m_strLabel,
 |  | WCHAR * | wcsFormatName,
 |  | DWORD | dwNumChars
 | ) |  |

Definition at line 98 of file DrawDlg.Cpp.

{
  //
  // Set restrictions to locate the drawing queue with the label specified.
  //
  DWORD cProps = 0;
  MQPROPERTYRESTRICTION aPropRestriction[2];
  MQRESTRICTION Restriction;

  aPropRestriction[cProps].rel           = PREQ;
  aPropRestriction[cProps].prop          = PROPID_Q_TYPE;
  aPropRestriction[cProps].prval.vt      = VT_CLSID;
  aPropRestriction[cProps].prval.puuid   = &guidDrawType;
  cProps++;

  WCHAR wcsLabel[MQ_MAX_Q_LABEL_LEN];
  mbstowcs(wcsLabel, m_strLabel, MQ_MAX_Q_LABEL_LEN);
  aPropRestriction[cProps].rel           = PREQ;
  aPropRestriction[cProps].prop          = PROPID_Q_LABEL;
  aPropRestriction[cProps].prval.vt      = VT_LPWSTR;
  aPropRestriction[cProps].prval.pwszVal = wcsLabel;
  cProps++;

  Restriction.cRes = cProps;
  Restriction.paPropRes = aPropRestriction;

  //
  // Request the queue instance for the queue specified.
  //
  cProps = 0;
  QUEUEPROPID aPropId[1];
  MQCOLUMNSET Column;

  aPropId[cProps] = PROPID_Q_INSTANCE;
  cProps++;

  Column.cCol = cProps;
  Column.aCol = aPropId;

  //
  // Locate the queue specified.
  //
  HANDLE hEnum;
  BOOL fFound = FALSE;
  HRESULT hr = MQLocateBegin(NULL, &Restriction, &Column, NULL, &hEnum);
  if (!FAILED(hr))
  {
      MQPROPVARIANT aPropVar[1];
    DWORD cQueue = 1;
    hr = MQLocateNext(hEnum, &cQueue, aPropVar);
    if (!FAILED(hr) && cQueue > 0)
    {
      //
      // Obtain the format name for the queue located.
      //
      hr = MQInstanceToFormatName(aPropVar[0].puuid, wcsFormatName, &dwNumChars);
            MQFreeMemory(aPropVar[0].puuid);
      if (!FAILED(hr))
        fFound = TRUE;
    }

    MQLocateEnd(hEnum);
  }

    return fFound;
}

DWORD ReceiveUpdates ( CDisdrawDlg * pDrawDlg )

Definition at line 284 of file DrawDlg.Cpp.

{
    //
  // Prepare the message properties to receive.
  //
  DWORD cProps = 0;
  MQMSGPROPS    propsMessage;
  MQPROPVARIANT aPropVar[2];
  MSGPROPID     aPropId[2];

  WCHAR wcsBody[MAX_MSG_BODY_LEN];
  aPropId[cProps]       = PROPID_M_BODY;
  aPropVar[cProps].vt     = VT_UI1 | VT_VECTOR;
  aPropVar[cProps].caub.cElems = sizeof(wcsBody);
  aPropVar[cProps].caub.pElems = (UCHAR *)wcsBody;
  cProps++;

    aPropId[cProps]       = PROPID_M_BODY_SIZE;
  aPropVar[cProps].vt     = VT_UI4;
  cProps++;

  propsMessage.cProp    = cProps;
  propsMessage.aPropID  = aPropId;
  propsMessage.aPropVar = aPropVar;
  propsMessage.aStatus  = NULL;

    //
    // Keep receiving updates sent to the incoming queue.
    //
    HRESULT hr;
    LINE line;
  char mbsBody[MAX_MSG_BODY_LEN + 1];

    while (TRUE)
    {
        //
        // Synchronously receive a message from the incoming queue.
        //
        hr = MQReceiveMessage(pDrawDlg->m_hqIncoming, INFINITE,
                              MQ_ACTION_RECEIVE, &propsMessage,
                NULL, NULL, NULL, NULL);

    //
    // Determine if the message contains a keystroke or a line.
    //
        if (!FAILED(hr))
        {
      //
      // Convert the body to a multibyte null-terminated string.
      //
            UINT uNumChars = aPropVar[1].ulVal/sizeof(WCHAR);
      wcstombs(mbsBody, wcsBody, uNumChars);
      mbsBody[uNumChars] = '\0';

      //
      // Add the keystroke to the drawing.
      //
      if (uNumChars == 1)
            {
        pDrawDlg->m_drawScribble.AddKeystroke(mbsBody);
            }

      //
      // Add the line received to the drawing.
      //
      else
      {
            sscanf(mbsBody, "%07ld%07ld%07ld%07ld",
             &line.ptStart.x, &line.ptStart.y,
             &line.ptEnd.x, &line.ptEnd.y);
        pDrawDlg->m_drawScribble.AddLine(line);
      }
        }
    }

    return 0;
}

Variable Documentation

CLSID guidDrawType
Initial value:
{ 0x151ceac0, 0xacb5, 0x11cf, { 0x8b, 0x51, 0x00, 0x20, 0xaf, 0x92, 0x95, 0x46 } }

Definition at line 34 of file DrawDlg.Cpp.

Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/c_draw/DrawDlg.h File Reference

  • NetDS
  • MessageQueuing
  • c_draw
Classes

DrawDlg.h File Reference

#include "drawarea.h"
#include "drawarea.h"

Go to the source code of this file.

Classes

class CDisdrawDlg
Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/c_draw/LoginDlg.Cpp File Reference

  • NetDS
  • MessageQueuing
  • c_draw

LoginDlg.Cpp File Reference

#include "stdafx.h"
#include "disdraw.h"
#include "logindlg.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/c_draw/LoginDlg.h File Reference

  • NetDS
  • MessageQueuing
  • c_draw
Classes

LoginDlg.h File Reference

Go to the source code of this file.

Classes

class CLoginDlg
Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/c_draw/Resource.h File Reference

  • NetDS
  • MessageQueuing
  • c_draw
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_BUTTON_ATTACH 1001
#define | IDC_CONTINUE 3
#define | IDC_DRAWAREA_SCRIBLLE 1004
#define | IDC_EDIT_FRIEND 1000
#define | IDC_EDIT_FRIEND_COMPUTER 1005
#define | IDC_EDIT_LOGIN 1005
#define | IDC_RADIO_DS 1006
#define | IDC_RADIO_EXPRESS 1002
#define | IDC_RADIO_RECOVERABLE 1003
#define | IDC_RADIO_WORKGROUP 1007
#define | IDC_STATIC_C_LABEL 1012
#define | IDC_STATIC_CHOOSE_DS 1009
#define | IDC_STATIC_CHOOSE_MESSAGE 1011
#define | IDC_STATIC_Q_LABEL 1010
#define | IDD_DISDRAW_DIALOG 102
#define | IDD_LOGIN 129
#define | IDR_MAINFRAME 128

Define Documentation

#define IDC_BUTTON_ATTACH 1001

Definition at line 21 of file Resource.h.

#define IDC_CONTINUE 3

Definition at line 16 of file Resource.h.

#define IDC_DRAWAREA_SCRIBLLE 1004

Definition at line 24 of file Resource.h.

#define IDC_EDIT_FRIEND 1000

Definition at line 20 of file Resource.h.

#define IDC_EDIT_FRIEND_COMPUTER 1005

Definition at line 26 of file Resource.h.

#define IDC_EDIT_LOGIN 1005

Definition at line 25 of file Resource.h.

#define IDC_RADIO_DS 1006

Definition at line 27 of file Resource.h.

#define IDC_RADIO_EXPRESS 1002

Definition at line 22 of file Resource.h.

#define IDC_RADIO_RECOVERABLE 1003

Definition at line 23 of file Resource.h.

#define IDC_RADIO_WORKGROUP 1007

Definition at line 28 of file Resource.h.

#define IDC_STATIC_C_LABEL 1012

Definition at line 32 of file Resource.h.

#define IDC_STATIC_CHOOSE_DS 1009

Definition at line 29 of file Resource.h.

#define IDC_STATIC_CHOOSE_MESSAGE 1011

Definition at line 31 of file Resource.h.

#define IDC_STATIC_Q_LABEL 1010

Definition at line 30 of file Resource.h.

#define IDD_DISDRAW_DIALOG 102

Definition at line 17 of file Resource.h.

#define IDD_LOGIN 129

Definition at line 19 of file Resource.h.

#define IDR_MAINFRAME 128

Definition at line 18 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/c_draw/StdAfx.Cpp File Reference

  • NetDS
  • MessageQueuing
  • c_draw

StdAfx.Cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/c_draw/StdAfx.h File Reference

  • NetDS
  • MessageQueuing
  • c_draw
Defines

StdAfx.h File Reference

#include <afxwin.h>
#include <afxext.h>
#include <afxcmn.h>
#include <afxtempl.h>
#include <afxole.h>
#include "mq.h"

Go to the source code of this file.

Defines

#define VC_EXTRALEAN

Define Documentation

#define VC_EXTRALEAN

Definition at line 18 of file StdAfx.h.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/csharp_draw/assemblyinfo.cs File Reference

  • NetDS
  • MessageQueuing
  • csharp_draw

assemblyinfo.cs File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/csharp_draw/form1.cs File Reference

  • NetDS
  • MessageQueuing
  • csharp_draw
Classes | Namespaces

form1.cs File Reference

Go to the source code of this file.

Classes

class | CSharp_Draw::Form1
Form1 is the main form for sending and receiving Drawing commands using MSMQ. More...
class | Util::HelperFunctions
struct | Util::line

Namespaces

namespace | CSharp_Draw
namespace | Util
Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/csharp_draw/inputbox.cs File Reference

  • NetDS
  • MessageQueuing
  • csharp_draw
Classes | Namespaces

inputbox.cs File Reference

Go to the source code of this file.

Classes

class | CSharp_Draw::InputBox
Summary description for InputBox. More...

Namespaces

namespace | CSharp_Draw
Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/DirEncrypt/DirEncrypt.Cpp File Reference

  • NetDS
  • MessageQueuing
  • DirEncrypt
Defines | Functions | Variables

DirEncrypt.Cpp File Reference

#include <windows.h>
#include <wincrypt.h>
#include <STDIO.H>
#include <mq.h>

Go to the source code of this file.

Defines

#define | MSGPROPS (sizeof(aMsgPropId) / sizeof(*aMsgPropId))
#define | QMPROPS (sizeof(aQmPropId) / sizeof(*aQmPropId))

Functions

BOOL | getPublicKeyBlob (PBYTE *pbPbKeyxKey, DWORD *pdwPbKeyxKeyLen)
int | main (int argc, char *argv[])
void | Usage (char *pszProgramName)

Variables

BOOL | fEnhEncrypted = FALSE
QMPROPID | propidPK = PROPID_QM_ENCRYPTION_PK
WCHAR | wszMachineName [128] = {0}

Define Documentation

#define MSGPROPS (sizeof(aMsgPropId) / sizeof(*aMsgPropId))
#define QMPROPS (sizeof(aQmPropId) / sizeof(*aQmPropId))

Function Documentation

BOOL getPublicKeyBlob | ( | PBYTE * | pbPbKeyxKey,
 |  | DWORD * | pdwPbKeyxKeyLen
 | ) |  |

Definition at line 49 of file DirEncrypt.Cpp.

                   :

    This routine retrieves the public key of the remote computer.
    The key is retrieved using the MQGetMachineProperties() API, which connects to the
    directory service (DS) to retrieve the specified properties.
    Usually when using workgroup (direct) mode, no DS connection is available.
    This routine comes only as a substitute to other means of obtaining the
    remote computer public key. (SSL protocol, via disk or file, etc.) .

Arguments:

    pbPbKeyxKey     - (OUT) pointer to the key.
    pdwPbKeyxKeyLen - (OUT) pointer to the key length

Return Value:

    TRUE  - if the key was retreived .
    FALSE - if the key couldn't be reteived.

--*/
{
    if (fEnhEncrypted)
    {
        propidPK = PROPID_QM_ENCRYPTION_PK_ENHANCED ;
    }

    QMPROPID aQmPropId[1] ;
    aQmPropId[0] = propidPK ;
    #define QMPROPS (sizeof(aQmPropId) / sizeof(*aQmPropId))

    MQPROPVARIANT aQmPropVar[QMPROPS];
    HRESULT       aQmStatus[QMPROPS];

    MQQMPROPS QmProps = {QMPROPS, aQmPropId, aQmPropVar, aQmStatus};

    aQmPropVar[0].vt = VT_NULL;

    HRESULT hr = MQGetMachineProperties(wszMachineName, NULL, &QmProps);
    if (FAILED(hr))
    {
        printf(
           "The public key of %S could not be retrieved. Error code: %lxh\n",
                                                  wszMachineName, hr);

        return FALSE;
    }

    if (aQmPropVar[0].vt != (VT_UI1|VT_VECTOR))
    {
        printf(
        "A type indicator in the structure passed to MQGetMachineProperties() is incorrect. Type idicator: %lxh, QMPROPS: %lut, Error code: %lxh\n",
                                                 aQmPropVar[0].vt, QMPROPS, hr) ;
        return FALSE ;
    }

    *pbPbKeyxKey = aQmPropVar[0].caub.pElems;
    *pdwPbKeyxKeyLen = aQmPropVar[0].caub.cElems;

    return TRUE;
}

int main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 114 of file DirEncrypt.Cpp.

{

    DWORD  dwEncryptAlg = CALG_RC2 ;
    WCHAR  wszQueueName[ 128 ] = {0} ;
    WCHAR  wszMsgLabel[ 128 ] = {TEXT("MessageLabel")} ;
    WCHAR  wszMsgBody[ 128 ] = {TEXT("MessageBody")} ;
    LPSTR  lpszArg = NULL ;
    DWORD  dwMsgSize = sizeof(WCHAR) * (1 + wcslen(wszMsgBody)) ;
    DWORD  dwBufferSize = sizeof(wszMsgBody) ;
    LPWSTR pMsgBody = wszMsgBody ;
  BOOL bQueueName = FALSE, bMachineName = FALSE;

  if (argc < 2)
  {
    Usage(argv[0]);
  }
    //
    // Allow the user to override settings with command line switches.
    //
    for ( int i = 1; i < argc; i++)
    {
        if ((*argv[i] == '-') || (*argv[i] == '/'))
        {
      if(strlen(argv[i]) <2)
      {
        Usage(argv[0]);
      }
            switch (*(argv[i]+1))
            {
            case '2':
                dwEncryptAlg = CALG_RC2 ;
                break ;

            case '4':
                dwEncryptAlg = CALG_RC4 ;
                break ;

            case 'e':
                fEnhEncrypted = TRUE ;
                break ;

            case 'b':
        if(i+1 == argc)
        {
          Usage(argv[0]);
        }

                lpszArg = argv[++i];
                mbstowcs(wszMsgBody, lpszArg, 127) ;
                break;

            case 'l':
        if(i+1 == argc)
        {
          Usage(argv[0]);
        }
                lpszArg = argv[++i];
                mbstowcs(wszMsgLabel, lpszArg, 127) ;
                break;

            case 'm':
        if(i+1 == argc)
        {
          Usage(argv[0]);
        }
        lpszArg = argv[++i];
                mbstowcs(wszMachineName, lpszArg, 127) ;
                bMachineName = TRUE;
        break;

            case 'q':
        if(i+1 == argc)
        {
          Usage(argv[0]);
        }
        lpszArg = argv[++i];
                mbstowcs(wszQueueName, lpszArg, 127) ;
        bQueueName = TRUE;
                break;

            case 'h':
            case '?':
            default:
                Usage(argv[0]);
            }
        }
        else
        {
            Usage(argv[0]);
        }
    }

  if(!bMachineName || !bQueueName)
  {
    Usage(argv[0]);
  }

    dwMsgSize = sizeof(WCHAR) * (1 + wcslen(wszMsgBody)) ;

    //
    // Get the public key blob of the destination computer.
    //

    PBYTE pbPbKeyxKey = NULL;
    DWORD dwPbKeyxKeyLen = 0;

    if (getPublicKeyBlob( &pbPbKeyxKey, &dwPbKeyxKeyLen))
    {
        printf("The public key of %S was retrieved successfully. Length: %lut\n",
                                     wszMachineName, dwPbKeyxKeyLen) ;

    }
    else
    {
        return -1 ;
    }

    //
    // Get a handle to the default cryptographic service provider (CSP).
    //
    LPWSTR lpwszProviderName = MS_DEF_PROV ;
    if (fEnhEncrypted)
    {
        lpwszProviderName = MS_ENHANCED_PROV ;
    }
    HCRYPTPROV hProv = NULL;

    BOOL bRet = CryptAcquireContext( &hProv,
                                       NULL,
                                       lpwszProviderName,
                                       PROV_RSA_FULL,
                                       0 ) ;
    if (!bRet)
    {
        if (GetLastError() == NTE_BAD_KEYSET)
        {
            //
            // The default key container does not exist yet, so create it.
            //
            if (!CryptAcquireContext( &hProv,
                                        NULL,
                                        lpwszProviderName,
                                        PROV_RSA_FULL,
                                        CRYPT_NEWKEYSET ))
            {
                printf(
                "CryptAcquireContext(%S, CRYPT_NEWKEYSET) failed. Error code: %lxh\n",
                                     lpwszProviderName, GetLastError());
                return -1;
            }
            printf("CryptAcquireContext(%S, CRYPT_NEWKEYSET) succeeded.\n",
                                                       lpwszProviderName) ;
        }
        else
        {
            printf(
              "CryptAcquireContext(%S) failed. Error code: %lxh\n",
                                     lpwszProviderName, GetLastError());
            return -1;
        }
    }
    else
    {
        printf("CryptAcquireContext(%S) succeeded.\n", lpwszProviderName) ;
    }

    //
    // Import the public key blob of the destination computer into the CSP.
    //
    HCRYPTKEY hPbKey = NULL;

    if (!CryptImportKey( hProv,
                         pbPbKeyxKey,
                         dwPbKeyxKeyLen,
                         NULL,
                         0,
                        &hPbKey ))
    {
        printf("CryptImportKey() failed. Error code: %lxh\n", GetLastError());
        return -1;
    }
    printf("CryptImportKey() succeeded.\n") ;

    //
    // Free the public key blob of the destination computer.
    //
    MQFreeMemory(pbPbKeyxKey);

    //
    // Create a symmetric key.
    //
    HCRYPTKEY hSymmKey = NULL;

    if (!CryptGenKey(hProv, dwEncryptAlg, CRYPT_EXPORTABLE, &hSymmKey))
    {
        printf("CryptGenKey() failed. Error code: %lxh\n", GetLastError());
        return -1;
    }
    printf("CryptGenKey(alg- %lut) successfully created a symmetric key.\n",
                                                           dwEncryptAlg) ;
    //
    // Get the encrypted symmetric key blob. This blob should
    // be passed to MQSendMessage in PROPID_M_DEST_SYMM_KEY.
    //
    BYTE  abSymmKey[ 512 ];
    DWORD dwSymmKeyLen = sizeof(abSymmKey);

    if (!CryptExportKey( hSymmKey,
                         hPbKey,
                         SIMPLEBLOB,
                         0,
                         abSymmKey,
                         &dwSymmKeyLen ))
    {
        printf("CryptExportKey() failed. Error code: %lxh\n", GetLastError());
        return -1;
    }
    printf("CryptExportKey() succeeded.\n") ;

    //
    // Get a handle to the destination queue.
    //
    WCHAR wszQueueFormat[128] = {0};

  if (_snwprintf(wszQueueFormat, (sizeof(wszQueueFormat)/sizeof(wszQueueFormat[0])) - 1, TEXT("DIRECT=OS:%s\\%s"),
                                        wszMachineName, wszQueueName) <0)
  {
    printf("The format name is too long for the buffer specified. Exiting...\n");
    exit(1);
  }
  else
  {
    wszQueueFormat[(sizeof(wszQueueFormat)/sizeof(wszQueueFormat[0]))-1] = '\0';
  }

    QUEUEHANDLE hQueue = NULL;

    HRESULT hr = MQOpenQueue(wszQueueFormat, MQ_SEND_ACCESS, 0, &hQueue);
    if (FAILED(hr))
    {
        printf("MQOpenQueue(%S) failed. Error code: %lxh\n", wszQueueFormat, hr) ;
        return -1;
    }
    printf("MQOpenQueue(%S) succeeded.\n", wszQueueFormat) ;

    //
    // Prepare the message properties.
    //
  GUID guid ;

    MSGPROPID aMsgPropId[] = {PROPID_M_BODY,
                              PROPID_M_DEST_SYMM_KEY,
                              PROPID_M_ENCRYPTION_ALG,
                              PROPID_M_CONNECTOR_TYPE,
                              PROPID_M_LABEL,
                              PROPID_M_PRIV_LEVEL};
    #define MSGPROPS (sizeof(aMsgPropId) / sizeof(*aMsgPropId))

    MQPROPVARIANT aMsgPropVar[MSGPROPS];
    HRESULT       aMsgStatus[MSGPROPS];

    MQMSGPROPS MsgProps = {MSGPROPS, aMsgPropId, aMsgPropVar, aMsgStatus};

    aMsgPropVar[0].vt = VT_VECTOR | VT_UI1;
    aMsgPropVar[0].caub.pElems = (BYTE*) pMsgBody ;

    aMsgPropVar[1].vt = VT_VECTOR | VT_UI1;
    aMsgPropVar[1].caub.cElems = dwSymmKeyLen;
    aMsgPropVar[1].caub.pElems = abSymmKey;

    aMsgPropVar[2].vt = VT_UI4;
    aMsgPropVar[2].ulVal = dwEncryptAlg ;

    aMsgPropVar[3].vt = VT_CLSID;
  aMsgPropVar[3].puuid = &guid;

    aMsgPropVar[4].vt = VT_LPWSTR;
    aMsgPropVar[4].pwszVal = wszMsgLabel;

    //
    // The connector type (PROPID_M_CONNECTOR_TYPE) is not initialized
    // because it is assumed that nobody will bother about it on the
    // receiving side; otherwise, it should be initialized.
    //

    //
    // Encrypt the line.
    //

    if (!CryptEncrypt( hSymmKey,
                       NULL,
                       TRUE,
                       0,
                       (BYTE*) pMsgBody,
                      &dwMsgSize,
                       dwBufferSize ))
    {
        printf("CryptEncrypt() failed. Error code: %lxh\n", GetLastError());
        return -1;
    }
    printf("CryptEncrypt() succeeded.\n") ;

    //
    // Update the length of the message according to the result of the
    // encryption algorithm. RC4 may enlarge the message size. At the
    // destination, the message will be received as clear text with the
    // correct (original) message body size.
    //
    aMsgPropVar[0].caub.cElems = dwMsgSize ;

    aMsgPropVar[5].vt = VT_UI4;
    if(!fEnhEncrypted)
    {
        aMsgPropVar[5].ulVal= MQMSG_PRIV_LEVEL_NONE ;
    }
    else
    {
        aMsgPropVar[5].ulVal = MQMSG_PRIV_LEVEL_BODY_ENHANCED ;
    }
    MsgProps.cProp = MSGPROPS ;

    //
    // Send the mesasge.
    //
    hr = MQSendMessage(hQueue, &MsgProps, NULL);
    if (FAILED(hr))
    {
        printf("MQSendMessage() failed. Error code: %lxh\n", hr) ;
    return -1;
    }
    printf("MQSendMessage() succeeded.\n") ;

    //
    // Free resources. This is actually not required here. The code is included
    // to show how it is done, if neccessary.
    //
    MQCloseQueue(hQueue);
    CryptDestroyKey(hSymmKey);
    CryptDestroyKey(hPbKey);
    CryptReleaseContext(hProv, 0);

    return 0;
}

void Usage ( char * pszProgramName )

Definition at line 36 of file DirEncrypt.Cpp.

{
    fprintf(stderr, "...Usage:  %s\n", pszProgramName);
    fprintf(stderr, "\t-2 send encrypted, RC2\n") ;
    fprintf(stderr, "\t-4 send encrypted, RC4\n") ;
    fprintf(stderr, "\t-b <Message Body>\n") ;
    fprintf(stderr, "\t-e Enhanced Encryption\n") ;
    fprintf(stderr, "\t-l <Message Label>\n") ;
    fprintf(stderr, "\t-m <Name of destination machine>\n") ;
    fprintf(stderr, "\t-q <Queue name>\n") ;
    exit(1);
}

Variable Documentation

BOOL fEnhEncrypted = FALSE

Definition at line 29 of file DirEncrypt.Cpp.

QMPROPID propidPK = PROPID_QM_ENCRYPTION_PK

Definition at line 30 of file DirEncrypt.Cpp.

WCHAR wszMachineName[128] = {0}

Definition at line 31 of file DirEncrypt.Cpp.

Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/Imp_Draw/DrawArea.Cpp File Reference

  • NetDS
  • MessageQueuing
  • Imp_Draw

DrawArea.Cpp File Reference

#include "stdafx.h"
#include "Imp_draw.h"
#include "Imp_dlg.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/Imp_Draw/DrawArea.h File Reference

  • NetDS
  • MessageQueuing
  • Imp_Draw
Classes | Defines | Typedefs

DrawArea.h File Reference

#include <afxtempl.h>

Go to the source code of this file.

Classes

class | CDrawArea
struct | tagLINE

Defines

#define | MAX_MSG_BODY_LEN 32

Typedefs

typedef struct tagLINE | LINE

Define Documentation

#define MAX_MSG_BODY_LEN 32

Definition at line 19 of file DrawArea.h.

Typedef Documentation

typedef struct tagLINE LINE
Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/Imp_Draw/EvHandle.Cpp File Reference

  • NetDS
  • MessageQueuing
  • Imp_Draw

EvHandle.Cpp File Reference

#include "stdafx.h"
#include <afxdisp.h>
#include "Imp_Draw.h"
#include "Imp_Dlg.h"
#import <mqoa.tlb>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/Imp_Draw/EvHandle.h File Reference

  • NetDS
  • MessageQueuing
  • Imp_Draw
Classes

EvHandle.h File Reference

Go to the source code of this file.

Classes

class CMSMQEventHandler
Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/Imp_Draw/Imp_Dlg.Cpp File Reference

  • NetDS
  • MessageQueuing
  • Imp_Draw

Imp_Dlg.Cpp File Reference

#include "stdafx.h"
#include <afxdisp.h>
#include "Imp_Draw.h"
#include "Imp_Dlg.h"
#include "logindlg.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/Imp_Draw/Imp_Dlg.h File Reference

  • NetDS
  • MessageQueuing
  • Imp_Draw
Classes | Defines

Imp_Dlg.h File Reference

#import <mqoa.tlb>
#include "EvHandle.h"
#include "drawarea.h"
#include "drawarea.h"

Go to the source code of this file.

Classes

class | CImp_DrawDlg
struct | CImp_DrawDlg::Line

Defines

#define | MAXNUMLEN 7

Define Documentation

#define MAXNUMLEN 7

Definition at line 27 of file Imp_Dlg.h.

Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/Imp_Draw/Imp_Draw.Cpp File Reference

  • NetDS
  • MessageQueuing
  • Imp_Draw
Variables

Imp_Draw.Cpp File Reference

#include "stdafx.h"
#include "Imp_Draw.h"
#include "Imp_Dlg.h"

Go to the source code of this file.

Variables

CImp_DrawApp theApp

Variable Documentation

CImp_DrawApp theApp

Definition at line 50 of file Imp_Draw.Cpp.

Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/Imp_Draw/Imp_Draw.h File Reference

  • NetDS
  • MessageQueuing
  • Imp_Draw
Classes

Imp_Draw.h File Reference

#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Classes

class CImp_DrawApp
Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/Imp_Draw/LoginDlg.Cpp File Reference

  • NetDS
  • MessageQueuing
  • Imp_Draw

LoginDlg.Cpp File Reference

#include "stdafx.h"
#include "Imp_Draw.h"
#include "logindlg.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/Imp_Draw/LoginDlg.h File Reference

  • NetDS
  • MessageQueuing
  • Imp_Draw
Classes

LoginDlg.h File Reference

Go to the source code of this file.

Classes

class CLoginDlg
Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/Imp_Draw/Resource.h File Reference

  • NetDS
  • MessageQueuing
  • Imp_Draw
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_BUTTON_ATTACH 1001
#define | IDC_CONTINUE 3
#define | IDC_DRAWAREA_SCRIBLLE 1004
#define | IDC_EDIT_FRIEND 1000
#define | IDC_EDIT_FRIEND_COMPUTER 1005
#define | IDC_EDIT_LOGIN 1005
#define | IDC_RADIO_DS 1006
#define | IDC_RADIO_EXPRESS 1002
#define | IDC_RADIO_RECOVERABLE 1003
#define | IDC_RADIO_WORKGROUP 1007
#define | IDC_STATIC_C_LABEL 1012
#define | IDC_STATIC_CHOOSE_DS 1009
#define | IDC_STATIC_CHOOSE_MESSAGE 1011
#define | IDC_STATIC_Q_LABEL 1010
#define | IDD_IMP_DRAW_DIALOG 102
#define | IDD_LOGIN 130
#define | IDR_MAINFRAME 128

Define Documentation

#define IDC_BUTTON_ATTACH 1001

Definition at line 21 of file Resource.h.

#define IDC_CONTINUE 3

Definition at line 16 of file Resource.h.

#define IDC_DRAWAREA_SCRIBLLE 1004

Definition at line 24 of file Resource.h.

#define IDC_EDIT_FRIEND 1000

Definition at line 20 of file Resource.h.

#define IDC_EDIT_FRIEND_COMPUTER 1005

Definition at line 26 of file Resource.h.

#define IDC_EDIT_LOGIN 1005

Definition at line 25 of file Resource.h.

#define IDC_RADIO_DS 1006

Definition at line 27 of file Resource.h.

#define IDC_RADIO_EXPRESS 1002

Definition at line 22 of file Resource.h.

#define IDC_RADIO_RECOVERABLE 1003

Definition at line 23 of file Resource.h.

#define IDC_RADIO_WORKGROUP 1007

Definition at line 28 of file Resource.h.

#define IDC_STATIC_C_LABEL 1012

Definition at line 32 of file Resource.h.

#define IDC_STATIC_CHOOSE_DS 1009

Definition at line 29 of file Resource.h.

#define IDC_STATIC_CHOOSE_MESSAGE 1011

Definition at line 31 of file Resource.h.

#define IDC_STATIC_Q_LABEL 1010

Definition at line 30 of file Resource.h.

#define IDD_IMP_DRAW_DIALOG 102

Definition at line 17 of file Resource.h.

#define IDD_LOGIN 130

Definition at line 19 of file Resource.h.

#define IDR_MAINFRAME 128

Definition at line 18 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/Imp_Draw/StdAfx.Cpp File Reference

  • NetDS
  • MessageQueuing
  • Imp_Draw

StdAfx.Cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/Imp_Draw/StdAfx.h File Reference

  • NetDS
  • MessageQueuing
  • Imp_Draw
Defines

StdAfx.h File Reference

#include <afxwin.h>
#include <afxext.h>
#include <afxcmn.h>

Go to the source code of this file.

Defines

#define VC_EXTRALEAN

Define Documentation

#define VC_EXTRALEAN

Definition at line 24 of file StdAfx.h.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MqApiTst/CLOSQDlg.Cpp File Reference

  • NetDS
  • MessageQueuing
  • MqApiTst

CLOSQDlg.Cpp File Reference

#include "stdafx.h"
#include "MQApitst.h"
#include "ClosQDlg.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MqApiTst/CLOSQDlg.h File Reference

  • NetDS
  • MessageQueuing
  • MqApiTst
Classes

CLOSQDlg.h File Reference

Go to the source code of this file.

Classes

class CCloseQueueDialog
Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MqApiTst/CRQDlg.Cpp File Reference

  • NetDS
  • MessageQueuing
  • MqApiTst

CRQDlg.Cpp File Reference

#include "stdafx.h"
#include "MQApitst.h"
#include "CrQDlg.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MqApiTst/CRQDlg.h File Reference

  • NetDS
  • MessageQueuing
  • MqApiTst
Classes

CRQDlg.h File Reference

Go to the source code of this file.

Classes

class CCreateQueueDialog
Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MqApiTst/DELQDlg.Cpp File Reference

  • NetDS
  • MessageQueuing
  • MqApiTst

DELQDlg.Cpp File Reference

#include "stdafx.h"
#include "MQApitst.h"
#include "DelQDlg.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MqApiTst/DELQDlg.h File Reference

  • NetDS
  • MessageQueuing
  • MqApiTst
Classes

DELQDlg.h File Reference

Go to the source code of this file.

Classes

class CDeleteQueueDialog
Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MqApiTst/LocatDlg.Cpp File Reference

  • NetDS
  • MessageQueuing
  • MqApiTst

LocatDlg.Cpp File Reference

#include "stdafx.h"
#include "MQApitst.h"
#include "LocatDlg.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MqApiTst/LocatDlg.h File Reference

  • NetDS
  • MessageQueuing
  • MqApiTst
Classes

LocatDlg.h File Reference

Go to the source code of this file.

Classes

class CLocateDialog
Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MqApiTst/MainFrm.Cpp File Reference

  • NetDS
  • MessageQueuing
  • MqApiTst
Defines | Functions | Variables

MainFrm.Cpp File Reference

#include "stdafx.h"
#include "MQApitst.h"
#include <afxtempl.h>
#include "MainFrm.h"
#include "CrQDlg.h"
#include "DelQDlg.h"
#include "OpenQDlg.h"
#include "ClosQDlg.h"
#include "SendMDlg.h"
#include "RecvMDlg.h"
#include "RecWDlg.h"
#include "LocatDlg.h"

Go to the source code of this file.

Defines

#define | _mqscpy(dest, src)
#define | MAXINDEX 31

Functions

void | AnsiStringToUnicode (LPWSTR lpsUnicode, LPSTR lpsAnsi, DWORD nSize)
BOOL | GetTextualSid (PSID pSid, LPTSTR TextualSID, LPDWORD dwBufferLen)
LPSTR | UnicodeStringToAnsiString (LPCWSTR lpcsUnicode)

Variables

struct {
unsigned short mclass
LPTSTR pszDescription
} StringClass []
TCHAR | szLastMessageBody [BUFFERSIZE]
TCHAR | szLastMessageLabel [BUFFERSIZE]

Define Documentation

#define _mqscpy | ( | dest,
 |  | src
 | ) |
Value:
ASSERT(src != NULL); \
                  AnsiStringToUnicode(dest, src, _tcslen(src)+1);

Definition at line 91 of file MainFrm.Cpp.

#define MAXINDEX 31

Definition at line 269 of file MainFrm.Cpp.

Function Documentation

void AnsiStringToUnicode | ( | LPWSTR | lpsUnicode,
 |  | LPSTR | lpsAnsi,
 |  | DWORD | nSize
 | ) |  |

Definition at line 65 of file MainFrm.Cpp.

    {
      if (lpsUnicode == NULL)
      {
        return;
      }

      ASSERT(lpsAnsi != NULL);

      size_t rc = mbstowcs(lpsUnicode, lpsAnsi, nSize);
      if (rc == (size_t)(-1))
      {
        AfxMessageBox(_T("An unsupported wide character was encountered. Exiting..."));
        exit(1);
      }

      if (lpsUnicode[nSize-1] != L'\0')
        lpsUnicode[nSize] = L'\0';
    }

BOOL GetTextualSid | ( | PSID | pSid,
 |  | LPTSTR | TextualSID,
 |  | LPDWORD | dwBufferLen
 | ) |  |

Definition at line 96 of file MainFrm.Cpp.

    {
      PSID_IDENTIFIER_AUTHORITY psia;
      DWORD dwSubAuthorities;
      DWORD dwSidRev = SID_REVISION;
      DWORD dwCounter;
      DWORD dwSidSize;

      // Obtain the identifier-authority value in the SID.
      psia = &((SID *)pSid)->IdentifierAuthority;

      // Obtain the number of subauthorities in the SID.
      dwSubAuthorities = (DWORD)((SID *)pSid)->SubAuthorityCount;

      //
      // Compute the buffer length.
      // S-SID_REVISION + identifier authority + subauthorities + NULL
      //
      dwSidSize = (15 + 12 + (12 * dwSubAuthorities) + 1) * sizeof(TCHAR);

      //
      // Check the buffer length provided.
      // If it is not large enough, indicate the proper size and call SetLastError.
      //
      if (*dwBufferLen < dwSidSize)
      {
        *dwBufferLen = dwSidSize;
        SetLastError(ERROR_INSUFFICIENT_BUFFER);
        return FALSE;
      }

      //
      // Obtain a textual representation of S-SID_REVISION.
      //
      TextualSID += _stprintf(TextualSID, TEXT("S-%lu-"), dwSidRev );

      //
      // Obtain a textual representation of the identifier-authority value.
      //
      if ( (psia->Value[0] != 0) || (psia->Value[1] != 0) )
      {
        TextualSID += _stprintf(TextualSID,
              TEXT("0x%02hx%02hx%02hx%02hx%02hx%02hx"),
              (USHORT)psia->Value[0],
              (USHORT)psia->Value[1],
              (USHORT)psia->Value[2],
              (USHORT)psia->Value[3],
              (USHORT)psia->Value[4],
              (USHORT)psia->Value[5]);
      }
      else
      {
        TextualSID += _stprintf(TextualSID, TEXT("%lu"),
              (ULONG)(psia->Value[5]      )   +
              (ULONG)(psia->Value[4] <<  8)   +
              (ULONG)(psia->Value[3] << 16)   +
              (ULONG)(psia->Value[2] << 24)   );
      }

      //
      // Loop through the subauthorities.
      //
      for (dwCounter=0 ; dwCounter < dwSubAuthorities ; dwCounter++)
      {
        TextualSID += _stprintf(TextualSID, TEXT("-%lu"),
              ((SID *)pSid)->SubAuthority[ dwCounter] );
      }

      return TRUE;
    }

LPSTR UnicodeStringToAnsiString ( LPCWSTR lpcsUnicode )

Definition at line 45 of file MainFrm.Cpp.

    {
      LPSTR lpAnsiString = NULL;

      if (lpcsUnicode)
      {
        DWORD dwSize = wcstombs(NULL, lpcsUnicode, 0);
        lpAnsiString = new char[dwSize+1];
        size_t rc = wcstombs(lpAnsiString, lpcsUnicode, dwSize);
        if (rc == (size_t)(-1))
        {
          AfxMessageBox(_T("An unsupported wide character was encountered. Exiting..."));
          exit(1);
        }
        lpAnsiString[dwSize] = '\0';
      }

      return lpAnsiString;
    }

Variable Documentation

unsigned short mclass

Definition at line 672 of file MainFrm.Cpp.

LPTSTR pszDescription

Definition at line 673 of file MainFrm.Cpp.

struct { ... } StringClass[]
TCHAR szLastMessageBody[BUFFERSIZE]

Definition at line 1202 of file MainFrm.Cpp.

TCHAR szLastMessageLabel[BUFFERSIZE]

Definition at line 1203 of file MainFrm.Cpp.

Generated on Wed Nov 13 2024 16:53:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MqApiTst/MainFrm.h File Reference

  • NetDS
  • MessageQueuing
  • MqApiTst
Classes | Functions | Variables

MainFrm.h File Reference

#include "OpenQDlg.h"

Go to the source code of this file.

Classes

class | CMainFrame

Functions

void | PrintToScreen (const TCHAR *Format,...)

Variables

CWnd * | pMainView

Function Documentation

void PrintToScreen | ( | const TCHAR * | Format,
 |  |  | ...
 | ) |  |

Definition at line 172 of file MqApiTst.Cpp.

{

   TCHAR szText[500];
   va_list l;
   static len = 0;

    // Format the string.
    va_start(l, Format);
#ifdef UNICODE
    if(_vsnwprintf(szText, 499, Format, l) < 0)
  {
    ::MessageBox(NULL,_T("The text is too long for the text buffer. Exiting...\n"),NULL,MB_OK);
    exit(1);
  }

  szText[(sizeof(szText)/sizeof(szText[0])) - 1] = L'\0';

#else
    if (_vsnprintf(szText,499, Format, l) <0)
  {
    ::MessageBox(NULL,"The text is too long for the text buffer. Exiting...\n",NULL,MB_OK);
    exit(1);
  }

  szText[(sizeof(szText)/sizeof(szText[0])) - 1] = '\0';

#endif

    CEdit& rfMainEdit = ((CTestView*)pMainView)->GetEditCtrl();

  int i = rfMainEdit.GetLineCount();

  ((CTestView*)pMainView)->GetEditCtrl().SetSel(INT_MAX,INT_MAX);
  ((CTestView*)pMainView)->GetEditCtrl().ReplaceSel(szText);
  ((CTestView*)pMainView)->GetEditCtrl().ReplaceSel(TEXT("\r\n"));
  len += lstrlen(szText) + 2;
  ((CTestView*)pMainView)->GetDocument()->SetModifiedFlag(FALSE);
}

Variable Documentation

CWnd* pMainView

Definition at line 170 of file MqApiTst.Cpp.

Generated on Wed Nov 13 2024 16:53:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MqApiTst/MqApiTst.Cpp File Reference

  • NetDS
  • MessageQueuing
  • MqApiTst
Classes | Functions | Variables

MqApiTst.Cpp File Reference

#include "stdafx.h"
#include "MQApitst.h"
#include "MainFrm.h"
#include "testDoc.h"
#include "testView.h"
#include "mq.h"

Go to the source code of this file.

Classes

class | CAboutDlg

Functions

void | PrintToScreen (const TCHAR *Format,...)

Variables

CWnd * | pMainView
CTestApp theApp

Function Documentation

void PrintToScreen | ( | const TCHAR * | Format,
 |  |  | ...
 | ) |  |

Definition at line 172 of file MqApiTst.Cpp.

{

   TCHAR szText[500];
   va_list l;
   static len = 0;

    // Format the string.
    va_start(l, Format);
#ifdef UNICODE
    if(_vsnwprintf(szText, 499, Format, l) < 0)
  {
    ::MessageBox(NULL,_T("The text is too long for the text buffer. Exiting...\n"),NULL,MB_OK);
    exit(1);
  }

  szText[(sizeof(szText)/sizeof(szText[0])) - 1] = L'\0';

#else
    if (_vsnprintf(szText,499, Format, l) <0)
  {
    ::MessageBox(NULL,"The text is too long for the text buffer. Exiting...\n",NULL,MB_OK);
    exit(1);
  }

  szText[(sizeof(szText)/sizeof(szText[0])) - 1] = '\0';

#endif

    CEdit& rfMainEdit = ((CTestView*)pMainView)->GetEditCtrl();

  int i = rfMainEdit.GetLineCount();

  ((CTestView*)pMainView)->GetEditCtrl().SetSel(INT_MAX,INT_MAX);
  ((CTestView*)pMainView)->GetEditCtrl().ReplaceSel(szText);
  ((CTestView*)pMainView)->GetEditCtrl().ReplaceSel(TEXT("\r\n"));
  len += lstrlen(szText) + 2;
  ((CTestView*)pMainView)->GetDocument()->SetModifiedFlag(FALSE);
}

Variable Documentation

CWnd* pMainView

Definition at line 170 of file MqApiTst.Cpp.

CTestApp theApp

Definition at line 57 of file MqApiTst.Cpp.

Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MqApiTst/MqApiTst.h File Reference

  • NetDS
  • MessageQueuing
  • MqApiTst
Classes | Defines

MqApiTst.h File Reference

#include "resource.h"
#include "mq.h"
#include "resource.h"

Go to the source code of this file.

Classes

class | ARRAYQ
class | CTestApp

Defines

#define | ACCESSBUFFERSIZE 50
#define | BUFFERSIZE MAX_Q_FORMATNAME_LEN
#define | DEFAULT_M_TIMETOBERECEIVED -1
#define | DEFAULT_M_TIMETOREACHQUEUE -1
#define | MAX_Q_FORMATNAME_LEN 4000
#define | MAX_Q_PATHNAME_LEN 4000
#define | MAX_VAR 20

Define Documentation

#define ACCESSBUFFERSIZE 50

Definition at line 64 of file MqApiTst.h.

#define BUFFERSIZE MAX_Q_FORMATNAME_LEN

Definition at line 58 of file MqApiTst.h.

#define DEFAULT_M_TIMETOBERECEIVED -1

Definition at line 62 of file MqApiTst.h.

#define DEFAULT_M_TIMETOREACHQUEUE -1

Definition at line 61 of file MqApiTst.h.

#define MAX_Q_FORMATNAME_LEN 4000

Definition at line 57 of file MqApiTst.h.

#define MAX_Q_PATHNAME_LEN 4000

Definition at line 56 of file MqApiTst.h.

#define MAX_VAR 20

Definition at line 63 of file MqApiTst.h.

Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MqApiTst/OpenQDlg.Cpp File Reference

  • NetDS
  • MessageQueuing
  • MqApiTst

OpenQDlg.Cpp File Reference

#include "stdafx.h"
#include "MQApitst.h"
#include "OpenQDlg.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MqApiTst/OpenQDlg.h File Reference

  • NetDS
  • MessageQueuing
  • MqApiTst
Classes | Defines

OpenQDlg.h File Reference

Go to the source code of this file.

Classes

class | COpenQueueDialog

Defines

#define | OPENQDLG_CLEAR_COMBOBOX -1

Define Documentation

#define OPENQDLG_CLEAR_COMBOBOX -1

Definition at line 21 of file OpenQDlg.h.

Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MqApiTst/RecvMDlg.Cpp File Reference

  • NetDS
  • MessageQueuing
  • MqApiTst

RecvMDlg.Cpp File Reference

#include "stdafx.h"
#include "MQApitst.h"
#include "RecvMDlg.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MqApiTst/RecvMDlg.h File Reference

  • NetDS
  • MessageQueuing
  • MqApiTst
Classes

RecvMDlg.h File Reference

Go to the source code of this file.

Classes

class CReceiveMessageDialog
Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MqApiTst/RecWDlg.Cpp File Reference

  • NetDS
  • MessageQueuing
  • MqApiTst

RecWDlg.Cpp File Reference

#include "stdafx.h"
#include "MQApitst.h"
#include "RecWDlg.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MqApiTst/RecWDlg.h File Reference

  • NetDS
  • MessageQueuing
  • MqApiTst
Classes

RecWDlg.h File Reference

Go to the source code of this file.

Classes

class CReceiveWaitDialog
Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MqApiTst/Resource.h File Reference

  • NetDS
  • MessageQueuing
  • MqApiTst
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | ID_API_CLOSE_QUEUE 32774
#define | ID_API_CREATE_QUEUE 32771
#define | ID_API_DELETE_QUEUE 32772
#define | ID_API_LOCATE 32777
#define | ID_API_OPEN_QUEUE 32773
#define | ID_API_RECEIVE_MESSAGE 32776
#define | ID_API_SEND_MESSAGE 32775
#define | IDC_ACK_FULL_RADIO 1016
#define | IDC_ACK_FULL_REACH_QUEUE_RADIO 1016
#define | IDC_ACK_FULL_RECEIVE_RADIO 1017
#define | IDC_ACK_NEG_RADIO 1017
#define | IDC_ACK_NONE_RADIO 1018
#define | IDC_ADMIN_COMBO 1012
#define | IDC_AUTHENTICATED 1029
#define | IDC_BODY 1021
#define | IDC_COMBO 1011
#define | IDC_DEAD_LETTER 1027
#define | IDC_DELETE_QUEUE_COMBO 1003
#define | IDC_DELIVERY_EXPRESS_RADIO 1014
#define | IDC_DELIVERY_RECOVERABLE_RADIO 1015
#define | IDC_EDIT1 1035
#define | IDC_EDT_BODY_SIZE 1037
#define | IDC_ENCRYPTED 1038
#define | IDC_FORMATNAME_COMBO2 1011
#define | IDC_IDC_MQ_RECEIVE_ACCESS 1009
#define | IDC_JOURNAL 1026
#define | IDC_LABEL 1020
#define | IDC_LOCATE_LABEL 1025
#define | IDC_MESSAGE_PRIORITY 1013
#define | IDC_MQ_PEEK_ACCESS 1007
#define | IDC_MQ_SEND_ACCESS 1008
#define | IDC_NACK_REACH_QUEUE_RADIO 1031
#define | IDC_NACK_RECEIVE_RADIO 1032
#define | IDC_PATHNAME_COMBO 1010
#define | IDC_QUEUE_LABEL 1001
#define | IDC_QUEUE_PATHNAME 1000
#define | IDC_RADIO1 1042
#define | IDC_RADIO2 1043
#define | IDC_RADIO3 1036
#define | IDC_RADIO4 1044
#define | IDC_TARGET_COMBO 1024
#define | IDC_TIME_TO_BE_RECEIVED 1030
#define | IDC_TIME_TO_REACH_QUEUE 1033
#define | IDC_TIMEOUT 1022
#define | IDD_ABOUTBOX 100
#define | IDD_CLOSE_QUEUE_DIALOG 133
#define | IDD_CREATE_QUEUE_DIALOG 130
#define | IDD_DELETE_QUEUE_DIALOG 131
#define | IDD_LOCATE_DIALOG 137
#define | IDD_OPEN_QUEUE_DIALOG 132
#define | IDD_RECEIVE_MESSAGE_DIALOG 135
#define | IDD_SEND_MESSAGE_DIALOG 134
#define | IDD_WAIT_DIALOG 136
#define | IDR_MAINFRAME 128
#define | IDR_TESTTYPE 129

Define Documentation

#define ID_API_CLOSE_QUEUE 32774

Definition at line 56 of file Resource.h.

#define ID_API_CREATE_QUEUE 32771

Definition at line 53 of file Resource.h.

#define ID_API_DELETE_QUEUE 32772

Definition at line 54 of file Resource.h.

#define ID_API_LOCATE 32777

Definition at line 59 of file Resource.h.

#define ID_API_OPEN_QUEUE 32773

Definition at line 55 of file Resource.h.

#define ID_API_RECEIVE_MESSAGE 32776

Definition at line 58 of file Resource.h.

#define ID_API_SEND_MESSAGE 32775

Definition at line 57 of file Resource.h.

#define IDC_ACK_FULL_RADIO 1016

Definition at line 29 of file Resource.h.

#define IDC_ACK_FULL_REACH_QUEUE_RADIO 1016

Definition at line 30 of file Resource.h.

#define IDC_ACK_FULL_RECEIVE_RADIO 1017

Definition at line 32 of file Resource.h.

#define IDC_ACK_NEG_RADIO 1017

Definition at line 31 of file Resource.h.

#define IDC_ACK_NONE_RADIO 1018

Definition at line 33 of file Resource.h.

#define IDC_ADMIN_COMBO 1012

Definition at line 25 of file Resource.h.

#define IDC_AUTHENTICATED 1029

Definition at line 41 of file Resource.h.

#define IDC_BODY 1021

Definition at line 35 of file Resource.h.

#define IDC_COMBO 1011

Definition at line 23 of file Resource.h.

#define IDC_DEAD_LETTER 1027

Definition at line 40 of file Resource.h.

#define IDC_DELETE_QUEUE_COMBO 1003

Definition at line 18 of file Resource.h.

#define IDC_DELIVERY_EXPRESS_RADIO 1014

Definition at line 27 of file Resource.h.

#define IDC_DELIVERY_RECOVERABLE_RADIO 1015

Definition at line 28 of file Resource.h.

#define IDC_EDIT1 1035

Definition at line 46 of file Resource.h.

#define IDC_EDT_BODY_SIZE 1037

Definition at line 48 of file Resource.h.

#define IDC_ENCRYPTED 1038

Definition at line 49 of file Resource.h.

#define IDC_FORMATNAME_COMBO2 1011

Definition at line 24 of file Resource.h.

#define IDC_IDC_MQ_RECEIVE_ACCESS 1009

Definition at line 21 of file Resource.h.

#define IDC_JOURNAL 1026

Definition at line 39 of file Resource.h.

#define IDC_LABEL 1020

Definition at line 34 of file Resource.h.

#define IDC_LOCATE_LABEL 1025

Definition at line 38 of file Resource.h.

#define IDC_MESSAGE_PRIORITY 1013

Definition at line 26 of file Resource.h.

#define IDC_MQ_PEEK_ACCESS 1007

Definition at line 19 of file Resource.h.

#define IDC_MQ_SEND_ACCESS 1008

Definition at line 20 of file Resource.h.

#define IDC_NACK_REACH_QUEUE_RADIO 1031

Definition at line 43 of file Resource.h.

#define IDC_NACK_RECEIVE_RADIO 1032

Definition at line 44 of file Resource.h.

#define IDC_PATHNAME_COMBO 1010

Definition at line 22 of file Resource.h.

#define IDC_QUEUE_LABEL 1001

Definition at line 17 of file Resource.h.

#define IDC_QUEUE_PATHNAME 1000

Definition at line 16 of file Resource.h.

#define IDC_RADIO1 1042

Definition at line 50 of file Resource.h.

#define IDC_RADIO2 1043

Definition at line 51 of file Resource.h.

#define IDC_RADIO3 1036

Definition at line 47 of file Resource.h.

#define IDC_RADIO4 1044

Definition at line 52 of file Resource.h.

#define IDC_TARGET_COMBO 1024

Definition at line 37 of file Resource.h.

#define IDC_TIME_TO_BE_RECEIVED 1030

Definition at line 42 of file Resource.h.

#define IDC_TIME_TO_REACH_QUEUE 1033

Definition at line 45 of file Resource.h.

#define IDC_TIMEOUT 1022

Definition at line 36 of file Resource.h.

#define IDD_ABOUTBOX 100

Definition at line 5 of file Resource.h.

#define IDD_CLOSE_QUEUE_DIALOG 133

Definition at line 11 of file Resource.h.

#define IDD_CREATE_QUEUE_DIALOG 130

Definition at line 8 of file Resource.h.

#define IDD_DELETE_QUEUE_DIALOG 131

Definition at line 9 of file Resource.h.

#define IDD_LOCATE_DIALOG 137

Definition at line 15 of file Resource.h.

#define IDD_OPEN_QUEUE_DIALOG 132

Definition at line 10 of file Resource.h.

#define IDD_RECEIVE_MESSAGE_DIALOG 135

Definition at line 13 of file Resource.h.

#define IDD_SEND_MESSAGE_DIALOG 134

Definition at line 12 of file Resource.h.

#define IDD_WAIT_DIALOG 136

Definition at line 14 of file Resource.h.

#define IDR_MAINFRAME 128

Definition at line 6 of file Resource.h.

#define IDR_TESTTYPE 129

Definition at line 7 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MqApiTst/SendMDlg.Cpp File Reference

  • NetDS
  • MessageQueuing
  • MqApiTst
Variables

SendMDlg.Cpp File Reference

#include "stdafx.h"
#include "MQApitst.h"
#include "SendMDlg.h"

Go to the source code of this file.

Variables

const TCHAR MULTICAST [] = _T("MULTICAST=")

Variable Documentation

const TCHAR MULTICAST[] = _T("MULTICAST=")

Definition at line 28 of file SendMDlg.Cpp.

Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MqApiTst/SendMDlg.h File Reference

  • NetDS
  • MessageQueuing
  • MqApiTst
Classes | Variables

SendMDlg.h File Reference

Go to the source code of this file.

Classes

class | CSendMessageDialog

Variables

TCHAR | szLastMessageBody [BUFFERSIZE]
TCHAR | szLastMessageLabel [BUFFERSIZE]

Variable Documentation

TCHAR szLastMessageBody[BUFFERSIZE]

Definition at line 1202 of file MainFrm.Cpp.

TCHAR szLastMessageLabel[BUFFERSIZE]

Definition at line 1203 of file MainFrm.Cpp.

Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MqApiTst/StdAfx.Cpp File Reference

  • NetDS
  • MessageQueuing
  • MqApiTst

StdAfx.Cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MqApiTst/StdAfx.h File Reference

  • NetDS
  • MessageQueuing
  • MqApiTst
Defines

StdAfx.h File Reference

#include <afxwin.h>
#include <afxext.h>
#include <afxcmn.h>
#include <afxole.h>
#include <afxtempl.h>

Go to the source code of this file.

Defines

#define VC_EXTRALEAN

Define Documentation

#define VC_EXTRALEAN

Definition at line 18 of file StdAfx.h.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MqApiTst/TestDoc.Cpp File Reference

  • NetDS
  • MessageQueuing
  • MqApiTst

TestDoc.Cpp File Reference

#include "stdafx.h"
#include "MQApitst.h"
#include "testDoc.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MqApiTst/TestDoc.h File Reference

  • NetDS
  • MessageQueuing
  • MqApiTst
Classes

TestDoc.h File Reference

Go to the source code of this file.

Classes

class CTestDoc
Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MqApiTst/TestVIEW.Cpp File Reference

  • NetDS
  • MessageQueuing
  • MqApiTst

TestVIEW.Cpp File Reference

#include "stdafx.h"
#include "MQApitst.h"
#include "mainfrm.h"
#include "testDoc.h"
#include "testView.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MqApiTst/TestVIEW.h File Reference

  • NetDS
  • MessageQueuing
  • MqApiTst
Classes

TestVIEW.h File Reference

Go to the source code of this file.

Classes

class CTestView
Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/mqf_draw/connectdlg.cpp File Reference

  • NetDS
  • MessageQueuing
  • mqf_draw

connectdlg.cpp File Reference

#include "stdafx.h"
#include "mqfdraw.h"
#include "connectdlg.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/mqf_draw/connectdlg.h File Reference

  • NetDS
  • MessageQueuing
  • mqf_draw
Classes

connectdlg.h File Reference

Go to the source code of this file.

Classes

class CConnectDlg
Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/mqf_draw/drawarea.cpp File Reference

  • NetDS
  • MessageQueuing
  • mqf_draw

drawarea.cpp File Reference

#include "stdafx.h"
#include "mqfdraw.h"
#include "drawdlg.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/mqf_draw/drawarea.h File Reference

  • NetDS
  • MessageQueuing
  • mqf_draw
Classes | Defines | Typedefs

drawarea.h File Reference

Go to the source code of this file.

Classes

class | CDrawArea
struct | tagLINE

Defines

#define | MAX_MSG_BODY_LEN 32

Typedefs

typedef struct tagLINE | LINE

Define Documentation

#define MAX_MSG_BODY_LEN 32

Definition at line 17 of file drawarea.h.

Typedef Documentation

typedef struct tagLINE LINE
Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/mqf_draw/drawdlg.cpp File Reference

  • NetDS
  • MessageQueuing
  • mqf_draw
Defines | Functions | Variables

drawdlg.cpp File Reference

#include "stdafx.h"
#include "mqfdraw.h"
#include "drawdlg.h"

Go to the source code of this file.

Defines

#define | FORMAT_NAME_LIST_LEN 1026
#define | MAX_FORMAT_NAME_LEN 256

Functions

BOOL | LocateQueue (CString m_strLabel, WCHAR *wcsFormatName, DWORD dwNumChars)
DWORD | ReceiveUpdates (CDisdrawDlg *pDrawDlg)

Variables

CLSID guidDrawType
CString strTitle

Define Documentation

#define FORMAT_NAME_LIST_LEN 1026

Definition at line 28 of file drawdlg.cpp.

#define MAX_FORMAT_NAME_LEN 256

Definition at line 27 of file drawdlg.cpp.

Function Documentation

BOOL LocateQueue | ( | CString | m_strLabel,
 |  | WCHAR * | wcsFormatName,
 |  | DWORD | dwNumChars
 | ) |  |

Definition at line 107 of file drawdlg.cpp.

{
  //
  // Set restrictions to locate a draw queue with the specified label.
  //
  DWORD cProps = 0;
  MQPROPERTYRESTRICTION aPropRestriction[2];
  MQRESTRICTION Restriction;

  aPropRestriction[cProps].rel           = PREQ;
  aPropRestriction[cProps].prop          = PROPID_Q_TYPE;
  aPropRestriction[cProps].prval.vt      = VT_CLSID;
  aPropRestriction[cProps].prval.puuid   = &guidDrawType;
  cProps++;

  WCHAR wcsLabel[MQ_MAX_Q_LABEL_LEN];
  mbstowcs(wcsLabel, m_strLabel, MQ_MAX_Q_LABEL_LEN);
  aPropRestriction[cProps].rel           = PREQ;
  aPropRestriction[cProps].prop          = PROPID_Q_LABEL;
  aPropRestriction[cProps].prval.vt      = VT_LPWSTR;
  aPropRestriction[cProps].prval.pwszVal = wcsLabel;
  cProps++;

  Restriction.cRes = cProps;
  Restriction.paPropRes = aPropRestriction;

  //
  // Retrieve the GUID of the specified queue.
  //
  cProps = 0;
  QUEUEPROPID aPropId[1];
  MQCOLUMNSET Column;

  aPropId[cProps] = PROPID_Q_INSTANCE;
  cProps++;

  Column.cCol = cProps;
  Column.aCol = aPropId;

  //
  // Locate the specified queue.
  //
  HANDLE hEnum;
  BOOL fFound = FALSE;
  HRESULT hr = MQLocateBegin(NULL, &Restriction, &Column, NULL, &hEnum);
  if (!FAILED(hr))
  {
      MQPROPVARIANT aPropVar[1];
    DWORD cQueue = 1;
    hr = MQLocateNext(hEnum, &cQueue, aPropVar);
    if (!FAILED(hr) && cQueue > 0)
    {
      //
      // Obtain the format name for the queue located.
      //
      hr = MQInstanceToFormatName(aPropVar[0].puuid, wcsFormatName, &dwNumChars);
            MQFreeMemory(aPropVar[0].puuid);
      if (!FAILED(hr))
        fFound = TRUE;
    }

    MQLocateEnd(hEnum);
  }

    return fFound;
}

DWORD ReceiveUpdates ( CDisdrawDlg * pDrawDlg )

Definition at line 303 of file drawdlg.cpp.

{
    //
  // Prepare the message properties for receiving a message.
  //
  DWORD cProps = 0;
  MQMSGPROPS    propsMessage;
  MQPROPVARIANT aPropVar[2];
  MSGPROPID     aPropId[2];

  WCHAR wcsBody[MAX_MSG_BODY_LEN];
  aPropId[cProps]       = PROPID_M_BODY;
  aPropVar[cProps].vt     = VT_UI1 | VT_VECTOR;
  aPropVar[cProps].caub.cElems = sizeof(wcsBody);
  aPropVar[cProps].caub.pElems = (UCHAR *)wcsBody;
  cProps++;

    aPropId[cProps]       = PROPID_M_BODY_SIZE;
  aPropVar[cProps].vt     = VT_UI4;
  cProps++;

  propsMessage.cProp    = cProps;
  propsMessage.aPropID  = aPropId;
  propsMessage.aPropVar = aPropVar;
  propsMessage.aStatus  = NULL;

    //
    // Keep receiving updates sent to the incoming queue.
    //
    HRESULT hr;
    LINE line;
  char mbsBody[MAX_MSG_BODY_LEN + 1];

    while (TRUE)
    {
        //
        // Synchronously receive a message from the incoming queue.
        //
        hr = MQReceiveMessage(pDrawDlg->m_hqIncoming, INFINITE,
                              MQ_ACTION_RECEIVE, &propsMessage,
                NULL, NULL, NULL, NULL);

    //
    // Determine whether the message contains a keystroke or a line.
    //
        if (!FAILED(hr))
        {
      //
      // Convert the body to a multi-byte null-terminated string.
      //
      UINT uNumChars = aPropVar[1].ulVal/sizeof(WCHAR);
      if(MAX_MSG_BODY_LEN < uNumChars)
      {
        AfxMessageBox("The message body length exceeds the allowed value. Exiting...");
        exit(1);
      }

            size_t rc = wcstombs(mbsBody, wcsBody, uNumChars);
      if (rc == (size_t)(-1))
      {
        AfxMessageBox("An unsupported wide character was encountered. Ignoring...");
        continue;
      }

      mbsBody[uNumChars] = '\0';

      //
      // Add the keystroke to the drawing.
      //
      if (uNumChars == 1)
            {
        pDrawDlg->m_drawScribble.AddKeystroke(mbsBody);
            }

      //
      // Add the received line to the drawing.
      //
      else
      {
        int iRes = sscanf(mbsBody, "%07ld%07ld%07ld%07ld",
             &line.ptStart.x, &line.ptStart.y,
             &line.ptEnd.x, &line.ptEnd.y);
        if (iRes != 0 && iRes != EOF)
        {
          pDrawDlg->m_drawScribble.AddLine(line);
        }
      }
        }
    }

    return 0;
}

Variable Documentation

CLSID guidDrawType
Initial value:
{ 0x151ceac0, 0xacb5, 0x11cf, { 0x8b, 0x51, 0x00, 0x20, 0xaf, 0x92, 0x95, 0x46 } }

Definition at line 34 of file drawdlg.cpp.

CString strTitle

Definition at line 40 of file drawdlg.cpp.

Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/mqf_draw/drawdlg.h File Reference

  • NetDS
  • MessageQueuing
  • mqf_draw
Classes

drawdlg.h File Reference

#include "drawarea.h"

Go to the source code of this file.

Classes

class CDisdrawDlg
Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/mqf_draw/logindlg.cpp File Reference

  • NetDS
  • MessageQueuing
  • mqf_draw
Defines

logindlg.cpp File Reference

#include "stdafx.h"
#include "mqfdraw.h"
#include "logindlg.h"

Go to the source code of this file.

Defines

#define MAX_VAR 20

Define Documentation

#define MAX_VAR 20

Definition at line 28 of file logindlg.cpp.

Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/mqf_draw/logindlg.h File Reference

  • NetDS
  • MessageQueuing
  • mqf_draw
Classes

logindlg.h File Reference

Go to the source code of this file.

Classes

class CLoginDlg
Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/mqf_draw/mqfdraw.cpp File Reference

  • NetDS
  • MessageQueuing
  • mqf_draw
Defines | Variables

mqfdraw.cpp File Reference

#include "stdafx.h"
#include "mqfdraw.h"
#include "drawdlg.h"
#include "logindlg.h"
#include "connectdlg.h"

Go to the source code of this file.

Defines

#define | MAX_USERNAME_LEN 32
#define | MAX_VAR 20

Variables

CDisdrawApp theApp

Define Documentation

#define MAX_USERNAME_LEN 32

Definition at line 29 of file mqfdraw.cpp.

#define MAX_VAR 20

Definition at line 30 of file mqfdraw.cpp.

Variable Documentation

CDisdrawApp theApp

Definition at line 55 of file mqfdraw.cpp.

Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/mqf_draw/mqfdraw.h File Reference

  • NetDS
  • MessageQueuing
  • mqf_draw
Classes

mqfdraw.h File Reference

#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Classes

class CDisdrawApp
Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/mqf_draw/resource.h File Reference

  • NetDS
  • MessageQueuing
  • mqf_draw
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_BUTTON_ADDQUEUE 1013
#define | IDC_BUTTON_ATTACH 1001
#define | IDC_CONNECTION 1024
#define | IDC_CONTINUE 3
#define | IDC_DRAWAREA_SCRIBLLE 1004
#define | IDC_EDIT_FRIEND 1000
#define | IDC_EDIT_FRIEND_COMPUTER 1005
#define | IDC_EDIT_LOGIN 1005
#define | IDC_FRAME_FRIEND 1023
#define | IDC_RADIO_DS 1006
#define | IDC_RADIO_EXPRESS 1002
#define | IDC_RADIO_PRIVATEQUEUE 1020
#define | IDC_RADIO_PUBLICQUEUE 1018
#define | IDC_RADIO_RECOVERABLE 1003
#define | IDC_RADIO_WORKGROUP 1007
#define | IDC_STATIC_C_LABEL 1012
#define | IDC_STATIC_CHOOSE_DS 1009
#define | IDC_STATIC_CHOOSE_MESSAGE 1011
#define | IDC_STATIC_CHOOSE_QUEUE 1017
#define | IDC_STATIC_DSFRAME 1022
#define | IDC_STATIC_Q_LABEL 1010
#define | IDD_DISDRAW_DIALOG 102
#define | IDD_DS 130
#define | IDD_LOGIN 129
#define | IDR_MAINFRAME 128

Define Documentation

#define IDC_BUTTON_ADDQUEUE 1013

Definition at line 23 of file resource.h.

#define IDC_BUTTON_ATTACH 1001

Definition at line 11 of file resource.h.

#define IDC_CONNECTION 1024

Definition at line 29 of file resource.h.

#define IDC_CONTINUE 3

Definition at line 5 of file resource.h.

#define IDC_DRAWAREA_SCRIBLLE 1004

Definition at line 14 of file resource.h.

#define IDC_EDIT_FRIEND 1000

Definition at line 10 of file resource.h.

#define IDC_EDIT_FRIEND_COMPUTER 1005

Definition at line 16 of file resource.h.

#define IDC_EDIT_LOGIN 1005

Definition at line 15 of file resource.h.

#define IDC_FRAME_FRIEND 1023

Definition at line 28 of file resource.h.

#define IDC_RADIO_DS 1006

Definition at line 17 of file resource.h.

#define IDC_RADIO_EXPRESS 1002

Definition at line 12 of file resource.h.

#define IDC_RADIO_PRIVATEQUEUE 1020

Definition at line 26 of file resource.h.

#define IDC_RADIO_PUBLICQUEUE 1018

Definition at line 25 of file resource.h.

#define IDC_RADIO_RECOVERABLE 1003

Definition at line 13 of file resource.h.

#define IDC_RADIO_WORKGROUP 1007

Definition at line 18 of file resource.h.

#define IDC_STATIC_C_LABEL 1012

Definition at line 22 of file resource.h.

#define IDC_STATIC_CHOOSE_DS 1009

Definition at line 19 of file resource.h.

#define IDC_STATIC_CHOOSE_MESSAGE 1011

Definition at line 21 of file resource.h.

#define IDC_STATIC_CHOOSE_QUEUE 1017

Definition at line 24 of file resource.h.

#define IDC_STATIC_DSFRAME 1022

Definition at line 27 of file resource.h.

#define IDC_STATIC_Q_LABEL 1010

Definition at line 20 of file resource.h.

#define IDD_DISDRAW_DIALOG 102

Definition at line 6 of file resource.h.

#define IDD_DS 130

Definition at line 9 of file resource.h.

#define IDD_LOGIN 129

Definition at line 8 of file resource.h.

#define IDR_MAINFRAME 128

Definition at line 7 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/mqf_draw/stdafx.cpp File Reference

  • NetDS
  • MessageQueuing
  • mqf_draw

stdafx.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/mqf_draw/stdafx.h File Reference

  • NetDS
  • MessageQueuing
  • mqf_draw
Defines

stdafx.h File Reference

#include <afxwin.h>
#include <afxext.h>
#include <afxcmn.h>
#include <afxtempl.h>
#include <afxole.h>
#include "mq.h"

Go to the source code of this file.

Defines

#define VC_EXTRALEAN

Define Documentation

#define VC_EXTRALEAN

Definition at line 17 of file stdafx.h.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MQPers/QueueDef.h File Reference

  • NetDS
  • MessageQueuing
  • MQPers
Classes | Defines | Functions

QueueDef.h File Reference

Go to the source code of this file.

Classes

struct | InitOle

Defines

#define | STR_QUEUE_LABEL L"Object Test Queue"
#define | STR_QUEUE_NAME L".\\IStreamTest"

Functions

void | dump_com_error (_com_error &e)

Define Documentation

#define STR_QUEUE_LABEL L"Object Test Queue"

Definition at line 5 of file QueueDef.h.

#define STR_QUEUE_NAME L".\\IStreamTest"

Definition at line 4 of file QueueDef.h.

Function Documentation

void dump_com_error ( _com_error & e )

Definition at line 8 of file QueueDef.h.

{
    _tprintf(_T("Oops - hit an error!\n"));
    _tprintf(_T("\a\tCode = %08lx\n"), e.Error());
    _tprintf(_T("\a\tCode meaning = %s\n"), e.ErrorMessage());
    _bstr_t bstrSource(e.Source());
    _bstr_t bstrDescription(e.Description());
    _tprintf(_T("\a\tSource = %s\n"), (LPCTSTR) bstrSource);
    _tprintf(_T("\a\tDescription = %s\n"), (LPCTSTR) bstrDescription);
}

Generated on Wed Nov 13 2024 16:53:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MQPers/GraphObj/DllDatax.c File Reference

  • NetDS
  • MessageQueuing
  • MQPers
  • GraphObj

DllDatax.c File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MQPers/GraphObj/DllDatax.h File Reference

  • NetDS
  • MessageQueuing
  • MQPers
  • GraphObj

DllDatax.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MQPers/GraphObj/GraphObj.Cpp File Reference

  • NetDS
  • MessageQueuing
  • MQPers
  • GraphObj
Functions | Variables

GraphObj.Cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include "initguid.h"
#include "GraphObj.h"
#include "dlldatax.h"
#include "GraphObj_i.c"
#include "Point.h"
#include "Line.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 81 of file GraphObj.Cpp.

{
#ifdef _MERGE_PROXYSTUB
  if (PrxDllCanUnloadNow() != S_OK)
    return S_FALSE;
#endif
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 93 of file GraphObj.Cpp.

{
#ifdef _MERGE_PROXYSTUB
  if (PrxDllGetClassObject(rclsid, riid, ppv) == S_OK)
    return S_OK;
#endif
  return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID | lpReserved
 | ) |  |

Definition at line 61 of file GraphObj.Cpp.

{
  lpReserved;
#ifdef _MERGE_PROXYSTUB
  if (!PrxDllMain(hInstance, dwReason, lpReserved))
    return FALSE;
#endif
  if (dwReason == DLL_PROCESS_ATTACH)
  {
    _Module.Init(ObjectMap, hInstance);
    DisableThreadLibraryCalls(hInstance);
  }
  else if (dwReason == DLL_PROCESS_DETACH)
    _Module.Term();
  return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 105 of file GraphObj.Cpp.

{
#ifdef _MERGE_PROXYSTUB
  HRESULT hRes = PrxDllRegisterServer();
  if (FAILED(hRes))
    return hRes;
#endif
  // registers object, typelib and all interfaces in typelib
  return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 119 of file GraphObj.Cpp.

{
#ifdef _MERGE_PROXYSTUB
  PrxDllUnregisterServer();
#endif
  _Module.UnregisterServer();
  return S_OK;
}

Variable Documentation

CComModule _Module

Definition at line 50 of file GraphObj.Cpp.

Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MQPers/GraphObj/GraphObj.Idl File Reference

  • NetDS
  • MessageQueuing
  • MQPers
  • GraphObj
Functions | Variables

GraphObj.Idl File Reference

Go to the source code of this file.

Functions

interface | helpstring ("property x")] HRESULT x([out
interface | helpstring ("property x1")] HRESULT x1([out
interface | id (1)
importlib ("stdole2.tlb")
library GRAPHOBJLib | importlib ("stdole32.tlb")
HRESULT | x ([in] long newVal)
HRESULT | x1 ([in] long newVal)
HRESULT | x2 ([out, retval] long *pVal)
HRESULT | x2 ([in] long newVal)
HRESULT | y ([out, retval] long *pVal)
HRESULT | y ([in] long newVal)
HRESULT | y1 ([in] long newVal)
HRESULT | y1 ([out, retval] long *pVal)
HRESULT | y2 ([out, retval] long *pVal)
HRESULT | y2 ([in] long newVal)

Variables

import oaidl | idl
interface retval long * | pVal

Function Documentation

interface helpstring ( "property x" )
interface helpstring ( "property x1" )
interface id ( 1 )
importlib ( "stdole2.tlb" )
library GRAPHOBJLib importlib ( "stdole32.tlb" )
HRESULT x ( [in] long newVal ) [set]
HRESULT x1 ( [in] long newVal ) [set]
HRESULT x2 ( [out, retval] long * pVal ) [get]
HRESULT x2 ( [in] long newVal ) [set]
HRESULT y ( [out, retval] long * pVal ) [get]
HRESULT y ( [in] long newVal ) [set]
HRESULT y1 ( [in] long newVal ) [set]
HRESULT y1 ( [out, retval] long * pVal ) [get]
HRESULT y2 ( [out, retval] long * pVal ) [get]
HRESULT y2 ( [in] long newVal ) [set]

Variable Documentation

import ocidl idl

Definition at line 7 of file GraphObj.Idl.

interface retval long* pVal

Definition at line 19 of file GraphObj.Idl.

Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MQPers/GraphObj/IPersistStm.h File Reference

  • NetDS
  • MessageQueuing
  • MQPers
  • GraphObj
Classes

IPersistStm.h File Reference

Go to the source code of this file.

Classes

class IMyPersistStreamImpl< T >
Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MQPers/GraphObj/Line.Cpp File Reference

  • NetDS
  • MessageQueuing
  • MQPers
  • GraphObj

Line.Cpp File Reference

#include "stdafx.h"
#include "GraphObj.h"
#include "Line.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MQPers/GraphObj/Line.h File Reference

  • NetDS
  • MessageQueuing
  • MQPers
  • GraphObj
Classes | Defines

Line.h File Reference

#include "resource.h"
#include <atlcom.h>
#include <atlctl.h>
#include <olectl.h>
#include "IPersistStm.h"

Go to the source code of this file.

Classes

class | CLine
struct | CLine::LINEDATA

Defines

#define | _ATL_DEBUG_QI
#define | _ATL_DEBUG_REFCOUNT

Define Documentation

#define _ATL_DEBUG_QI

Definition at line 18 of file Line.h.

#define _ATL_DEBUG_REFCOUNT

Definition at line 19 of file Line.h.

Generated on Wed Nov 13 2024 16:53:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MQPers/GraphObj/Point.Cpp File Reference

  • NetDS
  • MessageQueuing
  • MQPers
  • GraphObj

Point.Cpp File Reference

#include "stdafx.h"
#include "GraphObj.h"
#include "Point.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MQPers/GraphObj/Point.h File Reference

  • NetDS
  • MessageQueuing
  • MQPers
  • GraphObj
Classes

Point.h File Reference

#include "resource.h"
#include "IPersistStm.h"

Go to the source code of this file.

Classes

class | CPoint
struct | CPoint::POINT
Generated on Wed Nov 13 2024 16:53:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MQPers/GraphObj/Resource.h File Reference

  • NetDS
  • MessageQueuing
  • MQPers
  • GraphObj
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_LINE 102
#define | IDR_POINT 101
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_LINE 102

Definition at line 18 of file Resource.h.

#define IDR_POINT 101

Definition at line 17 of file Resource.h.

#define IDS_PROJNAME 100

Definition at line 16 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MQPers/GraphObj/StdAfx.Cpp File Reference

  • NetDS
  • MessageQueuing
  • MQPers
  • GraphObj

StdAfx.Cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MQPers/GraphObj/StdAfx.h File Reference

  • NetDS
  • MessageQueuing
  • MQPers
  • GraphObj
Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0400
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 27 of file StdAfx.h.

#define _WIN32_WINNT 0x0400

Definition at line 26 of file StdAfx.h.

#define STRICT

Definition at line 23 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MQPers/Rcv/Main.Cpp File Reference

  • NetDS
  • MessageQueuing
  • MQPers
  • Rcv
Functions | Variables

Main.Cpp File Reference

#include "stdafx.h"
#include "..\QueueDef.h"
#import "mqoa.tlb"
#import "..\GraphObj\ReleaseU\GraphObj.dll"

Go to the source code of this file.

Functions

void | main ()

Variables

struct InitOle | _init_InitOle_

Function Documentation

void main ( void )

Definition at line 35 of file Main.Cpp.

{
    try {
    // For these ActiveX components we need only smart interface pointer
    IMSMQQueuePtr   pQueue;
    IMSMQMessagePtr   pMessage;

    // Instanciate the follwing ActiveX components
    IMSMQQueueInfoPtr pQueueInfo(__uuidof(MSMQQueueInfo));

    int         n = 1;

    cout << "\n\nMSMQ IPersistStream Test Object Receiver\n";
    cout << "==========================================\n\n";

    // Open the queue
    pQueueInfo->PathName = ".\\IStreamTest";
    try {
      pQueue = pQueueInfo->Open(MQ_RECEIVE_ACCESS, MQ_DENY_NONE);
    } catch (_com_error& e) {
      if (e.Error() == MQ_ERROR_QUEUE_NOT_FOUND) {
        cout << "\n\nERROR queue does not exist\n";
        exit(-1);
      } else
        dump_com_error(e);
    }

    // Get the next message
    pMessage = pQueue->Receive();

    IPointPtr   pPoint((IUnknown*)pMessage->Body);

    // Check if it's a Point object
    if (pPoint != NULL) {

      cout << "\nGot a Point Object: " << pPoint->x << "   " << pPoint->y << "\n";

    }
    else {
      ILinePtr  pLine((IUnknown*)pMessage->Body);

      // Check if it's a Line object
      if (pLine != NULL) {
        cout << "\nGot a Line Object: " << pLine->x1 << " " << pLine->y1 << " " << pLine->x2 << " " << pLine->y2 << "\n";
      }
      else
        cout << "\nUnknown Object !!!\n";
    }
    pQueue->Close();

    } catch (_com_error& e) {
    dump_com_error(e);
    }
}

Variable Documentation

struct InitOle _init_InitOle_

Definition at line 31 of file Main.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MQPers/Rcv/StdAfx.Cpp File Reference

  • NetDS
  • MessageQueuing
  • MQPers
  • Rcv

StdAfx.Cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MQPers/Rcv/StdAfx.h File Reference

  • NetDS
  • MessageQueuing
  • MQPers
  • Rcv

StdAfx.h File Reference

#include <windows.h>
#include <tchar.h>
#include <comdef.h>
#include <objbase.h>
#include <stdio.h>
#include <iostream.h>
#include "../GraphObj/GraphObj_i.c"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MQPers/Snd/Main.Cpp File Reference

  • NetDS
  • MessageQueuing
  • MQPers
  • Snd
Functions | Variables

Main.Cpp File Reference

#include "stdafx.h"
#include "..\QueueDef.h"
#import "mqoa.tlb"
#import "..\GraphObj\ReleaseU\GraphObj.dll"

Go to the source code of this file.

Functions

void | main ()

Variables

struct InitOle | _init_InitOle_

Function Documentation

void main ( void )

Definition at line 30 of file Main.Cpp.

{
    try {

    // For these ActiveX components we need only smart interface pointer
    IMSMQQueueInfosPtr  pQueueInfos;
    IMSMQQueueInfoPtr pQueueInfo;
    IMSMQQueuePtr   pQueue;
    IUnknownPtr     pIUnknown;

    // Instanciate the follwing ActiveX components
    IMSMQQueryPtr   pQuery(__uuidof(MSMQQuery));
    IMSMQMessagePtr   pMessage(__uuidof(MSMQMessage));
    ILinePtr      pLine(__uuidof(Line));
    IPointPtr     pPoint(__uuidof(Point));

    int         n = 1;
    _variant_t      varQueueNameInit(STR_QUEUE_LABEL);
    VARIANT       varQueueName;

    cout << "\n\nMSMQ IPersistStream Test\n";
    cout << "==========================\n\n";

    varQueueName = varQueueNameInit.Detach();

    // Find the queue
    pQueueInfos = pQuery->LookupQueue(&vtMissing, &vtMissing, &varQueueName);
    varQueueNameInit.Attach(varQueueName);
    pQueueInfos->Reset();

    if ((pQueueInfo = pQueueInfos->Next()) == NULL) {

      //  The queue was not found create it on the local system
      pQueueInfo = new IMSMQQueueInfoPtr( __uuidof(MSMQQueueInfo) );
      pQueueInfo->PathName = STR_QUEUE_NAME;
      pQueueInfo->Label = STR_QUEUE_LABEL;
      pQueueInfo->Create();
      cout << "\nNew Queue created\n";
    }

    cout << "Which object should be send ?\n";
    cout << "1 - Point\n";
    cout << "2 - Line\n";
    cout << ":";
    cin >> n;

    // Open the queue
    pQueue = pQueueInfo->Open(MQ_SEND_ACCESS, MQ_DENY_NONE);

    if (n == 1) {
      // Initialize point object
      pPoint->x = 8;
      pPoint->y = 9;
      pMessage->Body = static_cast<IUnknown*>(pPoint); // The message body gets the IUnknown pointer

    }
    else {
      // Initialize line object
      pLine->x1 = 1;
      pLine->y1 = 2;
      pLine->x2 = 3;
      pLine->y2 = 4;
      pMessage->Body = static_cast<IUnknown*>(pLine); // The message body gets the IUnknown pointer
    }
    cout << "Sending Object\n";
    pMessage->Send(pQueue);

    // Close the Queue
    pQueue->Close();

    } catch (_com_error& e) {
    dump_com_error(e);
    }
}

Variable Documentation

struct InitOle _init_InitOle_

Definition at line 28 of file Main.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MQPers/Snd/StdAfx.Cpp File Reference

  • NetDS
  • MessageQueuing
  • MQPers
  • Snd

StdAfx.Cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MQPers/Snd/StdAfx.h File Reference

  • NetDS
  • MessageQueuing
  • MQPers
  • Snd

StdAfx.h File Reference

#include <windows.h>
#include <tchar.h>
#include <comdef.h>
#include <objbase.h>
#include <stdio.h>
#include <iostream.h>
#include "../GraphObj/GraphObj_i.c"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MQPort/MQPort.Cpp File Reference

  • NetDS
  • MessageQueuing
  • MQPort
Classes | Functions | Variables

MQPort.Cpp File Reference

#include <windows.h>
#include <stdio.h>
#import <mqoa.tlb>
#include <mq.h>

Go to the source code of this file.

Classes

struct | RECEIVE_CONTEXT

Functions

void | AllocMsgProps (RECEIVE_CONTEXT *prc)
DWORD WINAPI | CompletionPortThread (LPVOID lParam)
void | CreateWorkingThreads (HANDLE hPort)
short | DetectDsConnection (void)
HRESULT | EnableAsyncReceive (RECEIVE_CONTEXT *prc)
void | HandleErrors (_com_error comerr)
void | HandleReceivedMessage (RECEIVE_CONTEXT *prc)
HRESULT | InitiateAsyncReceiveWithCompletionPort (IMSMQQueuePtr q)
int | main ()
IMSMQQueuePtr | OpenQueueForAsyncReceiveWithCompletionPort (HANDLE hPort)
void | SendSomeMessages (int cMsgs)

Variables

IMSMQQueueInfoPtr | g_qinfo

Function Documentation

void AllocMsgProps ( RECEIVE_CONTEXT * prc )

Definition at line 95 of file MQPort.Cpp.

{
    int cProp = 1;
    prc->pmsgprops->aPropID = new MSGPROPID[cProp];
    prc->pmsgprops->aPropVar = new MQPROPVARIANT[cProp];
    prc->pmsgprops->aStatus = new HRESULT[cProp];

    int iProp = 0;
    prc->pmsgprops->aPropID[iProp] = PROPID_M_APPSPECIFIC;
    prc->pmsgprops->aPropVar[iProp].vt = VT_UI4;
    prc->pmsgprops->cProp = cProp;
}

DWORD WINAPI CompletionPortThread ( LPVOID lParam )

Definition at line 197 of file MQPort.Cpp.

{
    HANDLE hPort = (HANDLE)lParam;
    HRESULT hr = NOERROR;

    for (;;)
    {
      //
      // Wait for completion notification.
      //
      DWORD dwNoOfBytes;
      ULONG_PTR dwKey;
      OVERLAPPED* pov = NULL;
      BOOL fSuccess = GetQueuedCompletionStatus(
                          hPort,
                          &dwNoOfBytes,
                          &dwKey,
                          &pov,
                          INFINITE    // Notification time-out interval
                          );
      //
      // A NULL value of pov is returned if completion port notification
      // failed. In this case, fSuccess is guaranteed to be FALSE.
      // When fSuccess is TRUE, the OVERLAPPED structure may still
      // contain an error code. It is inspected in HandleReceivedMessage.
      //
      if (pov == NULL)
      {
        //
        // Unrecoverable error occurred in the completion port. Wait for the next notification.
        //
        continue;
      }
      RECEIVE_CONTEXT* prc = CONTAINING_RECORD(pov, RECEIVE_CONTEXT, ov);
      HandleReceivedMessage(prc);

      //
      // Start the next message receive operation.
      //
      hr = EnableAsyncReceive(prc);
      if (FAILED(hr))
        return hr;
    }

    //
    // The queue is unreachable.
    //
    return 0;
}

void CreateWorkingThreads ( HANDLE hPort )

Definition at line 258 of file MQPort.Cpp.

{
    //
    // Start several threads to handle the completion port.
    // The number of threads that you create depends on number of processors
    // in the system and the expected serialization in the working thread logic.
    //
    const int xNumberOfProcessors = 1;
    const int xNumberOfThreads = 2 * xNumberOfProcessors;

    for (int i = 0; i < xNumberOfThreads; i++)
    {
      DWORD dwThreadId;
      HANDLE hThread = CreateThread(
                          NULL,                   // Thread security
                          0,                      // Default stack
                          CompletionPortThread,   // Start routine
                          hPort,                  // Start routine parameter
                          0,                      // Run immediately
                          &dwThreadId             // Thread identifier
                          );
      CloseHandle(hThread);
    }
}

short DetectDsConnection ( void )

Definition at line 396 of file MQPort.Cpp.

{
    HRESULT hresult;
    IMSMQApplication2Ptr pApp;

    hresult = CoInitialize(NULL);
    if (FAILED(hresult))
    {
        printf("\nCOM cannot be initialized. Error code: %d\n", hresult);
        exit(1);
    }

    hresult = pApp.CreateInstance(__uuidof(MSMQApplication));
    if (FAILED(hresult))
    {
        printf("\nThe MSMQApplication object cannot be created. Error code: %d\n", hresult);
        exit(1);
    }

    return pApp->GetIsDsEnabled();
}

HRESULT EnableAsyncReceive ( RECEIVE_CONTEXT * prc )

Definition at line 171 of file MQPort.Cpp.

{
    //
    // Re-enable asynchronous receiving.
    //
    return MQReceiveMessage(
            prc->hQueue,
            INFINITE,               // Time-out interval
            MQ_ACTION_RECEIVE,
            prc->pmsgprops,
            &prc->ov,               // OVERLAPPED
            NULL,                   // No callback function
            NULL,                   // No cursor
            NULL);                  // No transaction pointer
}

void HandleErrors ( _com_error comerr )

Definition at line 152 of file MQPort.Cpp.

{
    HRESULT hr = comerr.Error();
    printf("An error occurred. Error code: %x\nExiting...", hr);
    exit(hr);
};

void HandleReceivedMessage ( RECEIVE_CONTEXT * prc )

Definition at line 121 of file MQPort.Cpp.

{
    //
    // Get receive message final status.
    //
    HRESULT rc = MQGetOverlappedResult(&prc->ov);

    //
    // Handle the status and message.
    //
    if (SUCCEEDED(rc))
    {
      //
      // Get the received message. PROPID_M_ APPSPECIFIC is the single property
      // that we set and now retrieve.
      //
      long lAppSpecific = prc->pmsgprops->aPropVar[0].lVal;
      printf("Thread id: %x Message received with the app-specific data: %d\n",
        GetCurrentThreadId(),
        lAppSpecific);
    }
}

HRESULT InitiateAsyncReceiveWithCompletionPort ( IMSMQQueuePtr q )

Definition at line 365 of file MQPort.Cpp.

{
    HRESULT hr = NOERROR;

    //
    // Kick off several overlapped receives.
    //
    const cOverlappedReceives = 1;

    for (int i = 0; i < cOverlappedReceives; i++)
    {
      //
      // Allocate and set a receive context.
      //
      RECEIVE_CONTEXT* prc = new RECEIVE_CONTEXT;
      memset(prc, 0, sizeof(RECEIVE_CONTEXT));
      prc->hQueue = (HANDLE)q->Handle;
      prc->pmsgprops = new MQMSGPROPS;
      AllocMsgProps(prc);
      hr = EnableAsyncReceive(prc);
      if (FAILED(hr)) {
        return hr;
      }
    }
    return hr;
}

int main ( void )

Definition at line 422 of file MQPort.Cpp.

{
    HRESULT hr;
    char strPathName[522];
    char strComputerName[256];
    char strQueueName[256];
    int dNoOfMessages;

    //
    // Initialize OLE.
    //
    hr = OleInitialize(NULL);
    if (FAILED(hr))
        return hr;

    try
    {
        g_qinfo = IMSMQQueueInfoPtr("MSMQ.MSMQQueueInfo");
        IMSMQQueuePtr qRec;

        //
        // Create a new completion port.
        //
        HANDLE hPort = CreateIoCompletionPort(
                      INVALID_HANDLE_VALUE,     // Create a new port.
                      NULL,                     // Create a new port.
                      0,
                      0);

        //
        // Create some worker threads to handle asynchronous receive operations.
        //
        CreateWorkingThreads(hPort);

        //
        // Get a queue path name.
        //
        printf("\nEnter queue computer name: ");
    if (fgets(strComputerName, 255, stdin) == NULL)
    {
      printf("\nInvalid input was entered.\n");
            exit(1);
    }
    //
    // Remove the \n at the end of the string created by fgets.
    //
    if(strComputerName[strlen(strComputerName) - 1] == '\n')
    {
      strComputerName[strlen(strComputerName) - 1] = '\0';
    }

        printf("\nEnter queue name: ");
    if (fgets(strQueueName, 255, stdin) == NULL)
    {
      printf("\nInvalid input was entered.\n");
            exit(1);
    }
    if(strQueueName[strlen(strQueueName) - 1] == '\n')
    {
      strQueueName[strlen(strQueueName) - 1] = '\0';
    }

        if(strComputerName[0] == 0 || strQueueName[0] == 0)
        {
            printf("\nInvalid parameters were supplied. Exiting...\n");
            exit(1);
        }

        //
        // Open the queue and associate it with the completion port.
        //
    int nRes, nSize;
    nSize = (sizeof(strComputerName)/sizeof(strComputerName[0])) + (sizeof(strQueueName)/sizeof(strQueueName[0])) -1;

        if(DetectDsConnection())
        //
    // Access to the DS is enabled, so work with a public queue.
        //
    {
      nRes = _snprintf(strPathName, nSize+1, "%s\\%s", strComputerName, strQueueName);
        }

        else
    //
        // Access to the DS is disabled, so work with a private queue.
        //
    {
      nRes = _snprintf(strPathName, nSize+10, "%s\\private$\\%s", strComputerName, strQueueName);
        }

    if(nRes < 0)
    {
      printf("The path name is too long for the buffer specified.\n");
      exit(1);
    }

    strPathName[nRes] = '\0';
        g_qinfo->PathName = strPathName;
        qRec = OpenQueueForAsyncReceiveWithCompletionPort(hPort);

        //
        // Invoke MSMQ to start an asynchronous receive operation on the queue several times.
        //
        hr = InitiateAsyncReceiveWithCompletionPort(qRec);
        if (FAILED(hr)) {
        return hr;
        }

        //
        // Send some messages.
        //
        printf("\nEnter the number of messages to send: ");
    int iRes = scanf("%d", &dNoOfMessages);
    if (iRes == 0 || iRes == EOF)
    {
      printf("\nInvalid input was entered.\n");
      exit(1);
    }

        SendSomeMessages(dNoOfMessages);

        //
        // Wait forever. Kill the application manually to exit.
        //
        printf("\nKill the application manually to exit.\n");
        Sleep(INFINITE);
        }
    catch(_com_error comerr) {
      HandleErrors(comerr);
    };
    return 0;
}

IMSMQQueuePtr OpenQueueForAsyncReceiveWithCompletionPort ( HANDLE hPort )

Definition at line 294 of file MQPort.Cpp.

{
    IMSMQQueuePtr qRec;

    //
    // Delete the existing queue, ignoring errors.
    //
    try {
      g_qinfo->Delete();
    }
    catch(_com_error comerr) {
    };

    //
    // Recreate the queue.
    //
    g_qinfo->Create();
    //
    // Open the queue to receive messages from it.
    //
    qRec = g_qinfo->Open(MQ_RECEIVE_ACCESS, MQ_DENY_NONE);

    //
    // Associate the queue with the completion port.
    //
    CreateIoCompletionPort(
      (HANDLE)qRec->Handle,       // Queue to associate port with
      hPort,                      // Port handle
      0,
      0);
    return qRec;
}

void SendSomeMessages ( int cMsgs )

Definition at line 336 of file MQPort.Cpp.

{
    IMSMQQueuePtr qSend;
    IMSMQMessagePtr msg("MSMQ.MSMQMessage");

    //
    // Open the queue for sending messages.
    //
    qSend = g_qinfo->Open(MQ_SEND_ACCESS, MQ_DENY_NONE);

    //
    // Send a bunch of messages.
    //
    for (int i = 0; i < cMsgs; i++)
    {
      msg->AppSpecific = i;
      msg->Send(qSend);
    }
}

Variable Documentation

IMSMQQueueInfoPtr g_qinfo

Definition at line 67 of file MQPort.Cpp.

Generated on Wed Nov 13 2024 16:53:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MqTestOA/Guids.Cpp File Reference

  • NetDS
  • MessageQueuing
  • MqTestOA
Defines

Guids.Cpp File Reference

#include <windows.h>
#include "mqoai.H"

Go to the source code of this file.

Defines

#define INITGUID

Define Documentation

#define INITGUID

Definition at line 17 of file Guids.Cpp.

Generated on Wed Nov 13 2024 16:53:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MqTestOA/MqTestOA.Cpp File Reference

  • NetDS
  • MessageQueuing
  • MqTestOA
Defines | Functions | Variables

MqTestOA.Cpp File Reference

#include <stdio.h>
#include <windows.h>
#include <mqoai.h>

Go to the source code of this file.

Defines

#define | ADDREF(punk) ((punk) ? (punk)->AddRef() : 0)
#define | MAX_BUFFER 500
#define | MAX_VAR 20
#define | PRINTERROR(s, hr) { PrintError(s, hr); goto Cleanup; }
#define | RELEASE(punk) if (punk) { (punk)->Release(); (punk) = NULL; }

Functions

short | DetectDsConnection (void)
HRESULT | DirectSender (void)
int | main (int argc, char **argv)
void | PrintError (char *s, HRESULT hr)
HRESULT | Receiver (bool fDirectMode)
HRESULT | Sender (int fDirectMode)
bool | SetConnectionMode (void)
HRESULT | StandardSender ()
HRESULT | Syntax ()

Variables

char | mbsMachineName [MAX_COMPUTERNAME_LENGTH+1]

Define Documentation

#define ADDREF ( punk ) ((punk) ? (punk)->AddRef() : 0)

Definition at line 45 of file MqTestOA.Cpp.

#define MAX_BUFFER 500

Definition at line 28 of file MqTestOA.Cpp.

#define MAX_VAR 20

Definition at line 27 of file MqTestOA.Cpp.

#define PRINTERROR | ( | s,
 |  | hr |
 | ) |  | { PrintError(s, hr); goto Cleanup; }

Definition at line 46 of file MqTestOA.Cpp.

#define RELEASE ( punk ) if (punk) { (punk)->Release(); (punk) = NULL; }

Definition at line 44 of file MqTestOA.Cpp.

Function Documentation

short DetectDsConnection ( void )

Definition at line 55 of file MqTestOA.Cpp.

{
    IMSMQApplication2 *pqapp = NULL;
    short fDsConnection;
    HRESULT hresult;

    hresult = CoCreateInstance(
                   CLSID_MSMQApplication,
                   NULL,      // punkOuter
                   CLSCTX_SERVER,
                   IID_IMSMQApplication2,
                   (LPVOID *)&pqapp);

    if (FAILED(hresult))
  {
    printf("The attempt to create an MSMQApplication object failed (0x%X). Exiting...\n", hresult);
    RELEASE(pqapp);
    exit(1);
  }

    pqapp->get_IsDsEnabled(&fDsConnection);
    RELEASE(pqapp);
    return fDsConnection;
}

HRESULT DirectSender ( void )

Definition at line 676 of file MqTestOA.Cpp.

{
    IMSMQQueue *rgpqSend = NULL;
    IMSMQQueueInfo *pqinfo = NULL;
    IMSMQMessage *pmessage = NULL;
    char szBuffer[MAX_BUFFER];
    WCHAR wcsMsgLabel[MQ_MAX_MSG_LABEL_LEN] = {0};

    WCHAR wcsFormat[MAX_BUFFER + 100] = {0};
  WCHAR wcsReceiverComputer[MAX_BUFFER] = {0};
    BSTR bstrFormat = NULL;
    BSTR bstrServiceType = NULL;
    BSTR bstrLabel = NULL;
    BSTR bstrBody = NULL;
    VARIANT varBody;
    DWORD cQueue = 0;
    HRESULT hresult = NOERROR;

    //
    // Get the receiver computer name.
    //

  //
  // Flushing stdin to get rid of the new-line character entered earlier.
  //
  fflush(stdin);
    printf("\nEnter receiver computer name: ");

  if (fgetws(wcsReceiverComputer, MAX_BUFFER - 1, stdin) == NULL)
        return E_INVALIDARG;

  if(wcsReceiverComputer[wcslen(wcsReceiverComputer) - 1] == L'\n')
    wcsReceiverComputer[wcslen(wcsReceiverComputer) - 1] = L'\0';

  if(wcsReceiverComputer[0] == 0)
    {
        printf("You have entered an incorrect parameter. Exiting...\n");
        return E_INVALIDARG;
    }

    hresult = CoCreateInstance(
               CLSID_MSMQQueueInfo,
               NULL,      // punkOuter
               CLSCTX_SERVER,
               IID_IMSMQQueueInfo,
               (LPVOID *)&pqinfo);
    if (FAILED(hresult))
      PRINTERROR("The queue cannot be opened", hresult);

  if(_snwprintf(wcsFormat, (sizeof(wcsFormat)/sizeof(wcsFormat[0])) - 1,
  L"DIRECT=OS:%s\\private$\\MSMQTest", wcsReceiverComputer) < 0)
  {
    // Overflow occurred.
    PRINTERROR("The receiver format name is too long for the buffer specified", hresult);
  }
  else
  {
    wcsFormat[(sizeof(wcsFormat)/sizeof(wcsFormat[0])) - 1] = L'\0';
  }

    bstrFormat = SysAllocString(wcsFormat);
    hresult = pqinfo->put_FormatName(bstrFormat);
    if (FAILED(hresult))
        PRINTERROR("Open failed", hresult);

    //
    // Open the queue with send access.
    //
    hresult = pqinfo->Open(
              MQ_SEND_ACCESS,
              MQ_DENY_NONE,
              &rgpqSend);

    if (FAILED(hresult))
        PRINTERROR("Open failed", hresult);

    printf("\nSender mode on the computer %s.\n\n", mbsMachineName);
    printf("\nEnter \"quit\" to exit.\n");

    //
    // Build the message label property.
    //

  if(_snwprintf(wcsMsgLabel,(sizeof(wcsMsgLabel)/sizeof(wcsMsgLabel[0])) - 1,
    L"Message from %S", mbsMachineName) < 0)
  {
    // Overflow occurred.
    PRINTERROR("Label creation failed", hresult);
  }
  else
  {
    wcsMsgLabel[(sizeof(wcsMsgLabel)/sizeof(wcsMsgLabel[0])) - 1] = L'\0';
  }

  bstrLabel = SysAllocString(wcsMsgLabel);
    if (bstrLabel == NULL)
        PRINTERROR("OOM: label", E_OUTOFMEMORY);

    fflush(stdin);
    //
    // Main sender loop.
    //
    while (1)
    {
        //
        // Get a string from the console.
        //
        printf("Enter a string: ");
        if (fgets(szBuffer,sizeof(szBuffer) - 1, stdin) == NULL)
      break;

    if(szBuffer[strlen(szBuffer) - 1] == '\n')
    {

      szBuffer[strlen(szBuffer) - 1] = '\0';

    }

    //
        // Create a message object.
        //
        hresult = CoCreateInstance(
                     CLSID_MSMQMessage,
                     NULL,      // punkOuter
                     CLSCTX_SERVER,
                     IID_IMSMQMessage,
                     (LPVOID *)&pmessage);
        //
        // Send the message.
        //

        hresult = pmessage->put_Label(bstrLabel);

        bstrBody = SysAllocStringByteLen(szBuffer, strlen(szBuffer) + 1);
        if (bstrBody == NULL)
          PRINTERROR("OOM: body", E_OUTOFMEMORY);

        VariantInit(&varBody);
        V_VT(&varBody) = VT_BSTR;
        V_BSTR(&varBody) = bstrBody;
        hresult = pmessage->put_Body(varBody);
        if (FAILED(hresult))
          PRINTERROR("put_body failed", hresult);

        hresult = pmessage->Send(rgpqSend, NULL);
        if (FAILED(hresult))
          PRINTERROR("Send failed", hresult);

        VariantClear(&varBody);
        bstrBody = NULL;

        RELEASE(pmessage);

        //
        // Check for a request to end teh application.
        //
        if (stricmp(szBuffer, "quit") == 0)
        break;
    } /* while (1) */

Cleanup:
  if(rgpqSend != NULL)
  {
    rgpqSend->Close();
    rgpqSend->Release();
    }

    RELEASE(pqinfo);
    RELEASE(pmessage);
    SysFreeString(bstrFormat);
    SysFreeString(bstrLabel);
    SysFreeString(bstrBody);
    SysFreeString(bstrServiceType);
    return hresult;
}

int main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 883 of file MqTestOA.Cpp.

{
    DWORD dwNumChars;
    HRESULT hresult = NOERROR;
    bool fDirectMode;

    if (argc != 2)
      return Syntax();

    hresult = OleInitialize(NULL);
    if (FAILED(hresult))
      PRINTERROR("OLE cannot be initialized", hresult);

    //
    // Retrieve the computer name.
    //
    dwNumChars = MAX_COMPUTERNAME_LENGTH;
    if(!GetComputerNameA(mbsMachineName, &dwNumChars))
  {
    printf("The computer name cannot be obtained. Exiting...\n");
    exit(1);
  }
    //
    // Detect DS connection and working mode.
    //
    fDirectMode = SetConnectionMode();

    if (strcmp(argv[1], "-s") == 0)
      hresult = Sender(fDirectMode);

    else if (strcmp(argv[1], "-r") == 0)
      hresult = Receiver(fDirectMode);

    else
      hresult = Syntax();

    printf("\nOK\n");

    // Fall through...

Cleanup:
    return (int)hresult;
}

void PrintError | ( | char * | s,
 |  | HRESULT | hr
 | ) |  |

Definition at line 930 of file MqTestOA.Cpp.

{
    printf("%s (0x%X). Exiting...\n", s, hr);
}

HRESULT Receiver ( bool fDirectMode )

Definition at line 148 of file MqTestOA.Cpp.

{
    IMSMQMessage *pmessageReceive = NULL;
    IMSMQQueue *pqReceive = NULL;
    IMSMQQueueInfo  *pqinfo = NULL;
    BSTR bstrPathName = NULL;
    BSTR bstrServiceType = NULL;
    BSTR bstrLabel = NULL;
    BSTR bstrMsgLabel = NULL;
    VARIANT varIsTransactional, varIsWorldReadable, varBody, varBody2, varWantDestQueue, varWantBody, varReceiveTimeout;

  WCHAR wcsPathName[MAX_COMPUTERNAME_LENGTH +100];

  BOOL fQuit = FALSE;
    HRESULT hresult = NOERROR;

    printf("\nReceiver Mode on Machine: %s\n\n", mbsMachineName);

    //
    // Create an MSMQQueueInfo object.
    //
    hresult = CoCreateInstance(
                   CLSID_MSMQQueueInfo,
                   NULL,      // punkOuter
                   CLSCTX_SERVER,
                   IID_IMSMQQueueInfo,
                   (LPVOID *)&pqinfo);
    if (FAILED(hresult)) {
      PRINTERROR("The queue cannot be created", hresult);
    }

    //
    // Prepare properties for creating a queue on the local computer.
    //

    // Set the path name.
    if(fDirectMode)             // Private queue path name
    {
    if(_snwprintf(wcsPathName,(sizeof(wcsPathName)/sizeof(wcsPathName[0]))-1,
    L"%S\\private$\\MSMQTest", mbsMachineName) < 0)
    {
      // overflow
      PRINTERROR("Path name creation failed", hresult);
    }
    else
    {
      wcsPathName[(sizeof(wcsPathName)/sizeof(wcsPathName[0]))-1] = L'\0';
    }

    }
    else                       // Public queue path name
    {
    if(_snwprintf(wcsPathName,(sizeof(wcsPathName)/sizeof(wcsPathName[0]))-1,
    L"%S\\MSMQTest", mbsMachineName) < 0)
    {
      // Overflow occurred.
      PRINTERROR("Path name creation failed", hresult);
    }
    else
    {
      wcsPathName[(sizeof(wcsPathName)/sizeof(wcsPathName[0]))-1] = L'\0';
    }

    }

    bstrPathName = SysAllocString(wcsPathName);
    if (bstrPathName == NULL) {
      PRINTERROR("OOM: pathname", E_OUTOFMEMORY);
    }
    pqinfo->put_PathName(bstrPathName);

    //
    // Set the type of the queue.
    // (This property will be used to locate all the queues of this type.)
    //
    bstrServiceType = SysAllocString(strGuidMQTestType);
    if (bstrServiceType == NULL) {
      PRINTERROR("OOM: ServiceType", E_OUTOFMEMORY);
    }
    pqinfo->put_ServiceTypeGuid(bstrServiceType);

    //
    // Add a descriptive label to the queue.
    // (This property is useful for administration through the MSMQ admin tools.)
    //
    bstrLabel =
      SysAllocString(L"Sample ActiveX application of MSMQ SDK");
    if (bstrLabel == NULL) {
      PRINTERROR("OOM: label ", E_OUTOFMEMORY);
    }
    pqinfo->put_Label(bstrLabel);

    //
    // Specify whether the queue is transactional.
    //
    VariantInit(&varIsTransactional);
    varIsTransactional.vt = VT_BOOL;
    varIsTransactional.boolVal = MQ_TRANSACTIONAL_NONE;
    VariantInit(&varIsWorldReadable);
    varIsWorldReadable.vt = VT_BOOL;
    varIsWorldReadable.boolVal = FALSE;
    //
    // Create the queue.
    //
    hresult = pqinfo->Create(&varIsTransactional, &varIsWorldReadable);
    if (FAILED(hresult)) {
      //
      // The API failed, but not because the queue exists.
      //
      if (hresult != MQ_ERROR_QUEUE_EXISTS)
        PRINTERROR("The queue cannot be created", hresult);
    }

    //
    // Open the queue with receive access.
    //
    hresult = pqinfo->Open(MQ_RECEIVE_ACCESS,
                           MQ_DENY_NONE,
                           &pqReceive);

    //
    // Things are a little bit tricky. MQCreateQueue succeeded, but in the
    // case of a public queue, this does not mean that MQOpenQueue
    // will succeed, because replication delays are possible. The queue is
    // registered in the DS, but it might take a replication interval
    // until the replica reaches the server that I am connected to.
    // To overcome this, open the queue in a loop.
    //
    // In this specific case, this can happen only if this program
    // is run on an MSMQ 1.0 backup server controller (BSC) or on
    // a client connected to a BSC.
    // To be totally on the safe side, we should have put some code
    // to exit the loop after a few retries, but this is just a sample.
    //
    while (hresult == MQ_ERROR_QUEUE_NOT_FOUND) {
      printf(".");

      // Wait a bit.
      Sleep(500);

      // Retry.
      hresult = pqinfo->Open(MQ_RECEIVE_ACCESS,
                             MQ_DENY_NONE,
                             &pqReceive);
    }
    if (FAILED(hresult)) {
      PRINTERROR("The queue cannot be opened", hresult);
    }

    //
    // Main receiver loop
    //
    printf("\nWaiting for messages...\n");
    while (!fQuit) {
      //
      // Receive the message.
      //
      VariantInit(&varWantDestQueue);
      VariantInit(&varWantBody);
      VariantInit(&varReceiveTimeout);
      varWantDestQueue.vt = VT_BOOL;
      varWantDestQueue.boolVal = TRUE;    // Yes, we want the destination queue.
      varWantBody.vt = VT_BOOL;
      varWantBody.boolVal = TRUE;         // Yes, we want the message body.
      varReceiveTimeout.vt = VT_I4;
      varReceiveTimeout.lVal = INFINITE;  // Infinite time-out
      hresult = pqReceive->Receive(
                  NULL,
                  &varWantDestQueue,
                  &varWantBody,
                  &varReceiveTimeout,
                  &pmessageReceive);
      if (FAILED(hresult)) {
        PRINTERROR("Receive failed", hresult);
      }

      //
      // Display the received message.
      //
      pmessageReceive->get_Label(&bstrMsgLabel);
      VariantInit(&varBody);
      VariantInit(&varBody2);
      hresult = pmessageReceive->get_Body(&varBody);
      if (FAILED(hresult)) {
        PRINTERROR("The message body cannot be retrieved", hresult);
      }
      hresult = VariantChangeType(&varBody2,
                                  &varBody,
                                  0,
                                  VT_BSTR);
      if (FAILED(hresult)) {
        PRINTERROR("The message body cannot be converted to a string", hresult);
      }
      printf("%S : %s\n", bstrMsgLabel, (char *)V_BSTR(&varBody2));
      //
      // Check for a request to end the application.
      //
      if (stricmp((char *)V_BSTR(&varBody2), "quit") == 0) {
        fQuit = TRUE;
      }

      VariantClear(&varBody);
      VariantClear(&varBody2);

      //
      // Release the current message.
      //
      RELEASE(pmessageReceive);
    } /* while (!fQuit) */

    //
    // Cleanup: Close the handle to the queue.
    //
    pqReceive->Close();
    if (FAILED(hresult)) {
      PRINTERROR("The queue cannot be closed", hresult);
    }

    //
    // In the concluding stage, we delete the queue from the directory
    // service. (We don't need to do this. In case of a public queue,
    // leaving it in the DS enables sender applications to send messages
    // even if the receiver is not available.)
    //
    hresult = pqinfo->Delete();
    if (FAILED(hresult)) {
      PRINTERROR("The queue cannot be deleted", hresult);
    }
    // Fall through...

Cleanup:
    SysFreeString(bstrPathName);
    SysFreeString(bstrMsgLabel);
    SysFreeString(bstrServiceType);
    SysFreeString(bstrLabel);
    RELEASE(pmessageReceive);
    RELEASE(pqReceive);
    RELEASE(pqinfo);
    return hresult;
}

HRESULT Sender ( int fDirectMode )

Definition at line 867 of file MqTestOA.Cpp.

{

    if(fDirectMode != 0)
        return DirectSender();

    else
        return StandardSender();
}

bool SetConnectionMode ( void )

Definition at line 87 of file MqTestOA.Cpp.

{

    char cDirectMode;

    //
    // If the local computer is in a domain and not in workgroup mode,
    // we have two cases:
    //   1. Other side is a computer in a domain.
    //   2. Other side is a computer working in workgroup mode.
    //

    if(DetectDsConnection() != 0)
    {
            printf("Do you want to connect to a DS-disabled computer (Y or N) ? ");

      int iRes = scanf("%c", &cDirectMode);
      if (iRes == 0 || iRes == EOF)
      {
        printf("\nInvalid input was entered.\n");
        exit(1);
      }

            switch(tolower(cDirectMode))
            {
                case 'y':
                    return true;

                case 'n':
                    return false;

                default:
                    printf("Bye.\n");
                    exit(1);
            }

    }

    return true;     // Local computer is DS-disabled.
}

HRESULT StandardSender ( void )

Definition at line 417 of file MqTestOA.Cpp.

{
    IMSMQQuery *pquery = NULL;
    IMSMQQueueInfo *rgpqinfo[MAX_VAR];
    IMSMQQueue *rgpqSend[MAX_VAR];
    IMSMQQueueInfo *pqinfo = NULL;
    IMSMQQueueInfos *pqinfos = NULL;
    IMSMQMessage *pmessage = NULL;
    char szBuffer[MAX_BUFFER] = {0};
    WCHAR wcsMsgLabel[MQ_MAX_MSG_LABEL_LEN] = {0};
    BSTR bstrServiceType = NULL;
    BSTR bstrLabel = NULL;
    BSTR bstrBody = NULL;
    VARIANT varBody;
    DWORD i;
    DWORD cQueue = 0;
    HRESULT hresult = NOERROR;

    printf("\nSender mode on the computer %s\n\n", mbsMachineName);

    //
    // Create query object for lookup.
    //
    hresult = CoCreateInstance(
                   CLSID_MSMQQuery,
                   NULL,      // punkOuter
                   CLSCTX_SERVER,
                   IID_IMSMQQuery,
                   (LPVOID *)&pquery);
    if (FAILED(hresult)) {
      PRINTERROR("A query object cannot be created", hresult);
    }

    //
    // Prepare parameters to locate all queues that
    // have the test service type GUID.
    //
    VARIANT varGuidQueue;
    VARIANT varStrLabel;
    VARIANT varGuidServiceType;
    VARIANT varRelServiceType;
    VARIANT varRelLabel;
    VARIANT varCreateTime;
    VARIANT varModifyTime;
    VARIANT varRelCreateTime;
    VARIANT varRelModifyTime;

    VariantInit(&varGuidQueue);
    VariantInit(&varStrLabel);
    VariantInit(&varGuidServiceType);
    VariantInit(&varRelServiceType);
    VariantInit(&varRelLabel);
    VariantInit(&varCreateTime);
    VariantInit(&varModifyTime);
    VariantInit(&varRelCreateTime);
    VariantInit(&varRelModifyTime);

    //
    // We only want to specify the service type GUID, so we
    // set the other variant parameters to VT_ERROR to simulate
    // "missing," i.e. optional, parameters.
    //
    V_VT(&varGuidQueue) = VT_ERROR;
    V_VT(&varStrLabel) = VT_ERROR;
    V_VT(&varRelServiceType) = VT_ERROR;
    V_VT(&varRelLabel) = VT_ERROR;
    V_VT(&varCreateTime) = VT_ERROR;
    V_VT(&varModifyTime) = VT_ERROR;
    V_VT(&varRelCreateTime) = VT_ERROR;
    V_VT(&varRelModifyTime) = VT_ERROR;
    bstrServiceType = SysAllocString(strGuidMQTestType);
    if (bstrServiceType == NULL) {
      PRINTERROR("OOM: Service Type GUID", E_OUTOFMEMORY);
    }
    V_VT(&varGuidServiceType) = VT_BSTR;
    V_BSTR(&varGuidServiceType) = bstrServiceType;

    hresult = pquery->LookupQueue(&varGuidQueue,
                                  &varGuidServiceType,
                                  &varStrLabel,
                                  &varCreateTime,
                                  &varModifyTime,
                                  &varRelServiceType,
                                  &varRelLabel,
                                  &varRelCreateTime,
                                  &varRelModifyTime,
                                  &pqinfos);
    if (FAILED(hresult)) {
      PRINTERROR("LookupQueue failed", hresult);
    }

    //
    // Reset the queue collection object.
    //
    hresult = pqinfos->Reset();
    if (FAILED(hresult)) {
      PRINTERROR("Reset failed", hresult);
    }

    //
    // Open each of the queues found.
    //
    cQueue = 0;
    hresult = pqinfos->Next(&rgpqinfo[cQueue]);
    if (FAILED(hresult)) {
      PRINTERROR("Next failed", hresult);
    }
    pqinfo = rgpqinfo[cQueue];
    while (pqinfo) {
      //
      // Open the queue with send access.
      //

      hresult = pqinfo->Open(
                  MQ_SEND_ACCESS,
                  MQ_DENY_NONE,
                  &rgpqSend[cQueue]);
      if (FAILED(hresult)) {
        PRINTERROR("Open failed", hresult);
      }

    cQueue++;
      hresult = pqinfos->Next(&rgpqinfo[cQueue]);
      if (FAILED(hresult)) {
        PRINTERROR("Next failed", hresult);
      }
      pqinfo = rgpqinfo[cQueue];
    }

    if (cQueue == 0) {
      //
      // No queue could be found, so exit.
      //
      PRINTERROR("No queue is registered", hresult = E_INVALIDARG);
    }
    printf("\tQueue(s) found: %d\n", cQueue);
    printf("\nEnter \"quit\" to exit.\n");

    //
    // Build the message label property.
    //

  if(_snwprintf(wcsMsgLabel,(sizeof(wcsMsgLabel)/sizeof(wcsMsgLabel[0]))-1,
    L"Message from %S", mbsMachineName) < 0)
  {
    // overflow
    PRINTERROR("Label creation failed", hresult);
  }
  else
  {
    wcsMsgLabel[(sizeof(wcsMsgLabel)/sizeof(wcsMsgLabel[0]))-1] = L'\0';
  }

    bstrLabel = SysAllocString(wcsMsgLabel);
    if (bstrLabel == NULL)
        PRINTERROR("OOM: label", E_OUTOFMEMORY);

    fflush(stdin);
    //
    // Main sender loop
    //
    while (1) {
      //
      // Get a string from the console.
      //
      printf("Enter a string: ");
      if (fgets(szBuffer, MAX_BUFFER - 1, stdin) == NULL)
        break;

      szBuffer[MAX_BUFFER - 1] = '\0';

    //
    // Delete the new-line character from the string.
    //
    if(szBuffer[strlen(szBuffer) - 1] == '\n')
    {

    szBuffer[strlen(szBuffer) - 1] = '\0';

    }

      //
      // Create a message object.
      //
      hresult = CoCreateInstance(
                     CLSID_MSMQMessage,
                     NULL,      // punkOuter
                     CLSCTX_SERVER,
                     IID_IMSMQMessage,
                     (LPVOID *)&pmessage);
      //
      // Send the message to all the queues.
      //
      for (i = 0; i < cQueue; i++)
      {
        hresult = pmessage->put_Label(bstrLabel);

        //
        // This isn't a "true" Unicode string, of course.
        //
        bstrBody = SysAllocStringByteLen(szBuffer, strlen(szBuffer) + 1);
        if (bstrBody == NULL) {
          PRINTERROR("OOM: message body", E_OUTOFMEMORY);
        }
        VariantInit(&varBody);
        V_VT(&varBody) = VT_BSTR;
        V_BSTR(&varBody) = bstrBody;
        hresult = pmessage->put_Body(varBody);
        if (FAILED(hresult)) {
          PRINTERROR("put_body failed", hresult);
        }
        hresult = pmessage->Send(rgpqSend[i], NULL);
        if (FAILED(hresult)) {
          PRINTERROR("Send failed", hresult);
        }
        VariantClear(&varBody);
        bstrBody = NULL;
      }
      RELEASE(pmessage);

      //
      // Check for a request to end the application.
      //
      if (stricmp(szBuffer, "quit") == 0)
        break;
    } /* while (1) */

Cleanup:
    //
    // Close and release all the queues.
    //
    for (i = 0; i < cQueue; i++) {
      rgpqSend[i]->Close();
      rgpqSend[i]->Release();
      rgpqinfo[i]->Release();
    }
    RELEASE(pqinfos);
    RELEASE(pquery);
    RELEASE(pmessage);
    SysFreeString(bstrLabel);
    SysFreeString(bstrBody);
    SysFreeString(bstrServiceType);
    return hresult;
}

HRESULT Syntax ( )

Definition at line 936 of file MqTestOA.Cpp.

{
    printf("\n");
    printf("Syntax: mqtestoa -s | -r\n");
    printf("\t-s: Sender\n");
    printf("\t-r: Receiver\n");
    return E_INVALIDARG;
}

Variable Documentation

char mbsMachineName[MAX_COMPUTERNAME_LENGTH+1]

Definition at line 41 of file MqTestOA.Cpp.

Generated on Wed Nov 13 2024 16:53:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MqTrans/MqTrans.Cpp File Reference

  • NetDS
  • MessageQueuing
  • MqTrans
Classes | Defines | Typedefs | Functions | Variables

MqTrans.Cpp File Reference

#include <stdio.h>
#include <transact.h>
#include <SQLEXT.h>
#include "mq.h"

Go to the source code of this file.

Classes

struct | DBCONN

Defines

#define | DBNTWIN32
#define | INITGUID
#define | MAX_FORMAT 100
#define | MAX_VAR 20
#define | SQL_COPT_SS_BASE 1200
#define | SQL_COPT_SS_ENLIST_IN_DTC (SQL_COPT_SS_BASE+7)
#define | SQL_DTC_DONE 0L
#define | STR_LEN 40
#define | UNICODE

Typedefs

typedef struct DBCONN | DBCONN

Functions

void | CreateQueue (CLSID *pGuidType, WCHAR wsFormat[])
void | DisplayDollars (DBCONN *ptr, char *psAccount)
void | DoSQLError (DBCONN *ptr)
HRESULT | DtcGetTransactionManager (LPSTR pszHost, LPSTR pszTmName, REFIID rid, DWORD dwReserved1, WORD wcbReserved2, void FAR *pvReserved2, void **ppvObject)
void | Error (char *s, HRESULT hr)
void | ExecuteStatement (DBCONN *ptr, char *pszBuf, BOOL ProcessFlag)
void | FreeODBCHandles (DBCONN *ptr)
void | GetMachineName ()
BOOL IsDsEnabledLocaly ()
void | LocateTargetQueue (CLSID *pGuidType, WCHAR wsFormat[MAX_FORMAT])
void | LogonToDB (DBCONN *ptr)
main (int argc, char *argv[])
void | PrepareSendMessageProperties (MSGPROPID amPropId[MAX_VAR], MQPROPVARIANT aPropVar[MAX_VAR], MQMSGPROPS &msgprops, DWORD &TransferSum)
BOOL | ProcessRetCode (char *pszFuncName, DBCONN *ptr, RETCODE retcode, BOOL fExit=TRUE)
void | Receiver ()
void | Sender ()
void | Syntax ()

Variables

HENV | g_hEnv = SQL_NULL_HENV
WCHAR | g_wszMachineName [MAX_COMPUTERNAME_LENGTH+1]

Define Documentation

#define DBNTWIN32

Definition at line 46 of file MqTrans.Cpp.

#define INITGUID

Definition at line 28 of file MqTrans.Cpp.

#define MAX_FORMAT 100

Definition at line 93 of file MqTrans.Cpp.

#define MAX_VAR 20

Definition at line 92 of file MqTrans.Cpp.

#define SQL_COPT_SS_BASE 1200

Definition at line 51 of file MqTrans.Cpp.

#define SQL_COPT_SS_ENLIST_IN_DTC (SQL_COPT_SS_BASE+7)

Definition at line 52 of file MqTrans.Cpp.

#define SQL_DTC_DONE 0L

Definition at line 55 of file MqTrans.Cpp.

#define STR_LEN 40

Definition at line 91 of file MqTrans.Cpp.

#define UNICODE

Definition at line 19 of file MqTrans.Cpp.

Typedef Documentation

typedef struct DBCONN DBCONN

Function Documentation

void CreateQueue | ( | CLSID * | pGuidType,
 |  | WCHAR | wsFormat[]
 | ) |  |

Definition at line 1136 of file MqTrans.Cpp.

{
   QUEUEPROPID       aqPropId[MAX_VAR];
   WCHAR             wsPathName[1000];  // Long path name
   MQPROPVARIANT     aPropVar[MAX_VAR];
   DWORD             cProps;
   MQQUEUEPROPS      qprops;
   DWORD             dwSize;
   HRESULT           hr;

   //---------------------------------------------------------------------
   // Prepare properties to create a queue on the local computer.
   //---------------------------------------------------------------------
   cProps = 0;

   // Set the path name property.
   aqPropId[cProps] =          PROPID_Q_PATHNAME;

   wsprintf(wsPathName, TEXT("%s\\MSMQDemo"), g_wszMachineName);
   aPropVar[cProps].vt =       VT_LPWSTR;
   aPropVar[cProps].pwszVal =  wsPathName;
   cProps++;

   // Set the transactional level of the queue to transactional.
   aqPropId[cProps] =        PROPID_Q_TRANSACTION;

   aPropVar[cProps].vt =     VT_UI1;
   aPropVar[cProps].bVal =   MQ_TRANSACTIONAL;
   cProps++;

   // Set the service type GUID of the queue (used to locate queues in a query).
   aqPropId[cProps] =        PROPID_Q_TYPE;

   aPropVar[cProps].vt =     VT_CLSID;
   aPropVar[cProps].puuid =  pGuidType;
   cProps++;

   // Create a QUEUEPROPS structure.
   qprops.cProp =    cProps;
   qprops.aPropID =  aqPropId;
   qprops.aPropVar = aPropVar;
   qprops.aStatus =  0;

   //-----------------------------------------------------------------------
   // Create the queue.
   //-----------------------------------------------------------------------
   dwSize = sizeof(WCHAR)*MAX_FORMAT;
   hr = MQCreateQueue(NULL, &qprops, wsFormat, &dwSize);

   if(FAILED(hr))
   {
      // The API failed, but not because the queue exists.
      if(hr != MQ_ERROR_QUEUE_EXISTS)
            Error("MQCreateQueue failed", hr);

      // The queue exists, so get its format name.
      // Note: Because the queue already exists, this sample assumes
      // that it was created earlier by this program, so we do not
      // check whether the queue is transactional. If at this point the
      // queue is not transactional, the transactions will abort later.
      //
      hr = MQPathNameToFormatName(wsPathName, wsFormat, &dwSize);

      if (FAILED(hr))
         Error ("The format name cannot be retrieved", hr);
   }
}

void DisplayDollars | ( | DBCONN * | ptr,
 |  | char * | psAccount
 | ) |  |

Definition at line 1256 of file MqTrans.Cpp.

{

   DWORD             DollarsSum;                  // IN SQL database
   SDWORD               cbValue;                  // OUT argument for SQL query
   char              sSQLStatement[STR_LEN*2];
   RETCODE              retcode;

   // Allocate a statement handle for use with SQLExecDirect.
   retcode = SQLAllocStmt(ptr->hdbc,&(ptr->hstmt));

   ProcessRetCode("SQLAllocStmt",ptr,retcode);

   // Prepare SQL statement for issuing a query.
   int n = _snprintf(sSQLStatement, STR_LEN*2 -1, "SELECT * FROM %s", psAccount);
   if(n < 0)
   {
    printf("The string is too long for the buffer specified. Exiting...\n");
    exit(1);
   }
   sSQLStatement[n] = L'\0';

   // Issue the SQL query.
   retcode = SQLExecDirect (ptr->hstmt,(UCHAR *)sSQLStatement,SQL_NTS);

   ProcessRetCode ("SQLExecDirect",ptr,retcode);

   // Prepare a data structure for retrieving the query results.
   retcode = SQLBindCol(ptr->hstmt,1,SQL_C_ULONG,&DollarsSum,0,(SQLLEN *)&cbValue);

   ProcessRetCode ("SQLBindCol",ptr,retcode);

   // Retrieve the query results.
   retcode = SQLFetch (ptr->hstmt);

   ProcessRetCode ("SQLFetch",ptr,retcode);

   // Display the query results.
   printf ("Sum of dollars in %s is %d .\n\n",psAccount,DollarsSum);

   // Free the statement handle.
   retcode = SQLFreeStmt(ptr->hstmt, SQL_DROP);
   ptr->hstmt = SQL_NULL_HSTMT;

   ProcessRetCode("SQLFreeStmt",ptr,retcode);

}

void DoSQLError ( DBCONN * ptr )

Definition at line 1393 of file MqTrans.Cpp.

{
   UCHAR                szSqlState[6];
   UCHAR             szErrorMsg[SQL_MAX_MESSAGE_LENGTH];

   SQLINTEGER  fNativeError   = 0;
   SWORD    cbErrorMsg = 0;
   RETCODE     retcode;

   retcode = SQLError(g_hEnv,
              ptr ? ptr->hdbc : 0,
              ptr ? ptr->hstmt :0,
              szSqlState,
              &fNativeError,
              szErrorMsg,
              sizeof(szErrorMsg),
              &cbErrorMsg
              );

   if (retcode != SQL_NO_DATA_FOUND && retcode != SQL_ERROR)
   {
      if (fNativeError != 0x1645)   // ignore change database to master context message
      {
         printf("SQLError info:\n");
         printf("SqlState: %s, fNativeError: %x\n",szSqlState,fNativeError);
         printf("Error Message: %s\n\n",szErrorMsg);
      }
   }
   else
   {
      printf("SQLError() failed: %x, NO_DATA_FOUND OR SQL_ERROR\n",retcode);
   }

}

HRESULT DtcGetTransactionManager | ( | LPSTR | pszHost,
 |  | LPSTR | pszTmName,
 |  | REFIID | rid,
 |  | DWORD | dwReserved1,
 |  | WORD | wcbReserved2,
 |  | void FAR * | pvReserved2,
 |  | void ** | ppvObject
 | ) |  |
void Error | ( | char * | s,
 |  | HRESULT | hr
 | ) |  |

Definition at line 998 of file MqTrans.Cpp.

{

    printf("\n\n%s (0x%X). Exiting...\n", s, hr);
    exit(1);
}

void ExecuteStatement | ( | DBCONN * | ptr,
 |  | char * | pszBuf,
 |  | BOOL | ProcessFlag
 | ) |  |

Definition at line 1229 of file MqTrans.Cpp.

{
   RETCODE retcode = 0;

   // Allocate a statement handle for use with SQLExecDirect.
   retcode = SQLAllocStmt(ptr->hdbc,&(ptr->hstmt));

   if (ProcessFlag)
      ProcessRetCode("SQLAllocStmt",ptr,retcode);

   // Execute the string passed as a SQL statement.
    retcode = SQLExecDirect (ptr->hstmt,(UCHAR *) pszBuf,SQL_NTS);

   if (ProcessFlag)
      ProcessRetCode("SQLExecDirect",ptr,retcode);

   // Free the statement handle.
   retcode = SQLFreeStmt(ptr->hstmt, SQL_DROP);
   ptr->hstmt = SQL_NULL_HSTMT;

   if (ProcessFlag)
      ProcessRetCode("SQLFreeStmt",ptr,retcode);

}

void FreeODBCHandles ( DBCONN * ptr )

Definition at line 1316 of file MqTrans.Cpp.

{
   SQLDisconnect(ptr->hdbc);

   SQLFreeConnect(ptr->hdbc);

   ptr->hdbc   = SQL_NULL_HDBC;
   ptr->hstmt  = SQL_NULL_HSTMT;
}

void GetMachineName ( )
BOOL IsDsEnabledLocaly ( )

Definition at line 851 of file MqTrans.Cpp.

                   :

      The routine checks whether the local computer operates in
      domain (DS-enabled) mode or in workgroup (DS-disabled) mode.

Arguments:

      None

Return Value:

      TRUE     -  domain (DS-enabled) mode.
      FALSE    -  workgroup (DS-disabled) mode.

--*/

{

    MQPRIVATEPROPS PrivateProps;
    QMPROPID       aPropId[MAX_VAR];
    MQPROPVARIANT  aPropVar[MAX_VAR];
    DWORD          cProp;
    HRESULT        hr;
    //
    // Specify the PROPID_PC_DS_ENABLED property, which
  // indicates whether the local computer can access the DS.
    //
    cProp = 0;

    aPropId[cProp] = PROPID_PC_DS_ENABLED;
    aPropVar[cProp].vt = VT_NULL;
    ++cProp;
    //
    // Create a PRIVATEPROPS structure.
    //
    PrivateProps.cProp = cProp;
  PrivateProps.aPropID = aPropId;
  PrivateProps.aPropVar = aPropVar;
    PrivateProps.aStatus = NULL;

    //
    // Retrieve the information.
    //

    //
    // This code is used to detect a DS connection.
    // This code is designed to allow compilation both on
    // Windows NT 4.0 and on Windows 2000 and later.
    //
    HINSTANCE hMqrtLibrary = GetModuleHandle(TEXT("mqrt.dll"));
  if(hMqrtLibrary == NULL)
  {
    printf("An incomplete installation of MSMQ was detected. Exiting...\n");
    exit(1);
  }

    typedef HRESULT (APIENTRY *MQGetPrivateComputerInformation_ROUTINE)(LPCWSTR , MQPRIVATEPROPS*);
    MQGetPrivateComputerInformation_ROUTINE pfMQGetPrivateComputerInformation =
          (MQGetPrivateComputerInformation_ROUTINE)GetProcAddress(hMqrtLibrary,
                           "MQGetPrivateComputerInformation");
    if(pfMQGetPrivateComputerInformation == NULL)
    {
        //
        // There is no entry point in the DLL that matches this routine.
        // It must be an old version of mqrt.dll (MSMQ 1.0).
        // It will be OK to handle this case as the case of DS-enabled computer.
        //
        return TRUE;
    }

  hr = pfMQGetPrivateComputerInformation(
             NULL,
           &PrivateProps);
  if(FAILED(hr))
  {
        //
        // We were not able to determine whether the computer is DS-enabled or DS-disabled.
        // Notify the user and assume the worst case (i.e., the computer is DS-disasbled).
        //
        Error("No DS connection could be detected", hr);
        return FALSE;
    }

    if(PrivateProps.aPropVar[0].boolVal == 0)
    {
        //
        // DS-disabled.
        //
        return FALSE;
    }

    return TRUE;

}

void LocateTargetQueue | ( | CLSID * | pGuidType,
 |  | WCHAR | wsFormat[MAX_FORMAT]
 | ) |  |

Definition at line 1019 of file MqTrans.Cpp.

{

   DWORD      dwSize;
   DWORD      i;

   DWORD      cQueue;
   DWORD      cProps;
   HRESULT       hr;
   MQPROPERTYRESTRICTION   aPropRestriction[MAX_VAR];
   MQRESTRICTION        Restriction;
   MQCOLUMNSET          Column;
   QUEUEPROPID          aqPropId[MAX_VAR];
   HANDLE               hEnum;
   MQPROPVARIANT        aPropVar[MAX_VAR];

    //
    // Prepare parameters for locating queues.
    //
    //
    // 1. Restriction: Queues with PROPID_Q_TYPE = MSMQTransTest service type GUIID
    //
    cProps = 0;

    aPropRestriction[cProps].rel = PREQ;
    aPropRestriction[cProps].prop = PROPID_Q_TYPE;
    aPropRestriction[cProps].prval.vt = VT_CLSID;
    aPropRestriction[cProps].prval.puuid = pGuidType;
    cProps++;

    Restriction.cRes = cProps;
    Restriction.paPropRes = aPropRestriction;

    //
    // 2. Columnset (the queue properties to retrieve) = queue GUID
    //
    cProps = 0;
    aqPropId[cProps] = PROPID_Q_INSTANCE;
    cProps++;

    Column.cCol = cProps;
    Column.aCol = aqPropId;

    //
    // Issue the query to locate the queues.
    //
    hr = MQLocateBegin(NULL, &Restriction, &Column, NULL, &hEnum);

   if (FAILED(hr))
      Error ("MQLocateBegin failed", hr);

    //
    // Get the results.
    //
    cQueue = MAX_VAR;
    hr = MQLocateNext(hEnum, &cQueue, aPropVar);

   if (FAILED(hr))
      Error ("MQLocateNext failed", hr);

    hr = MQLocateEnd(hEnum);

    if(cQueue == 0)
    {
        // No queue could be found, so exit
        printf("No queue was found. Exiting...\n\n");
        exit(0);
    }

    printf("FOUND %d.\n", cQueue);

    dwSize = sizeof(WCHAR)*MAX_FORMAT;

   // Transform the queue GUID into a format name.
   hr = MQInstanceToFormatName(aPropVar[0].puuid, wsFormat, &dwSize);

   if (FAILED(hr))
      Error ("MQInstancetoFormatName failed", hr);

   // Free the memory that was allocated for the queue GUID during the query.
    for(i = 0; i < cQueue; i++)
      MQFreeMemory(aPropVar[i].puuid);

}

void LogonToDB ( DBCONN * ptr )

Definition at line 1206 of file MqTrans.Cpp.

{
   RETCODE retcode = 0;

   retcode = SQLAllocConnect(g_hEnv, &(ptr->hdbc) );

   if (ProcessRetCode("SQLAllocConnect",ptr,retcode))
   {
      retcode = SQLConnect(ptr->hdbc,
                  (UCHAR *)(ptr->pszSrv),
                  SQL_NTS,
                  (UCHAR *)(ptr->pszUser),
                  SQL_NTS,
                  (UCHAR *)(ptr->pszPasswd),
                  SQL_NTS
                  );

      ProcessRetCode("SQLConnect",ptr,retcode);
   }
}

main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 956 of file MqTrans.Cpp.

{
   DWORD dwSize;

    if(argc != 2)
        Syntax();

    // Fail if the local computer is DS-disabled.
    if(!IsDsEnabledLocaly())
    {
        printf("We cannot work on a DS-disabled computer.\nExiting...");
        exit(1);
    }

    // Retrieve computer name.
    dwSize = MAX_COMPUTERNAME_LENGTH;
  if(!GetComputerName(g_wszMachineName, &dwSize))
  {
    printf("The computer name cannot be retrieved.\nExiting...");
        exit(1);
  }

    if(strcmp(argv[1], "-s") == 0)
        Sender();

    else if(strcmp(argv[1], "-r") == 0)
        Receiver();

    else
        Syntax();

    return(1);

}

void PrepareSendMessageProperties | ( | MSGPROPID | amPropId[MAX_VAR],
 |  | MQPROPVARIANT | aPropVar[MAX_VAR],
 |  | MQMSGPROPS & | msgprops,
 |  | DWORD & | TransferSum
 | ) |  |

Definition at line 1111 of file MqTrans.Cpp.

{

   DWORD      cProps;

    cProps = 0;
    amPropId[cProps] =             PROPID_M_BODY;
    aPropVar[cProps].vt =          VT_UI1 | VT_VECTOR;
    aPropVar[cProps].caub.cElems =  sizeof(TransferSum);
    aPropVar[cProps].caub.pElems =  (unsigned char *)&TransferSum;
    cProps++;

    // Create a MSGPROPS structure.
    msgprops.cProp =    cProps;
    msgprops.aPropID =  amPropId;
    msgprops.aPropVar = aPropVar;
    msgprops.aStatus =  0;

}

BOOL ProcessRetCode | ( | char * | pszFuncName,
 |  | DBCONN * | ptr,
 |  | RETCODE | retcode,
 |  | BOOL | fExit = TRUE
 | ) |  |

Definition at line 1329 of file MqTrans.Cpp.

{
   BOOL state = TRUE ;
   BOOL fExitP = fExit ;

   switch (retcode)
   {

   case SQL_SUCCESS:
         fExitP = FALSE ;
         break;

   case SQL_SUCCESS_WITH_INFO:
         fExitP = FALSE ;
         break;

   case SQL_ERROR:
         printf("%s failed - see more info\n",pszFuncName);
         DoSQLError(ptr);
         state = FALSE;
         break;

   case SQL_INVALID_HANDLE:
         printf("%s failed - SQL_INVALID_HANDLE\n",pszFuncName);
         state = FALSE;
         break;

   case SQL_NO_DATA_FOUND:
         printf("%s failed - SQL_NO_DATA_FOUND\n",pszFuncName);
         fExitP = FALSE ;
         state = FALSE;
         break;

   case SQL_STILL_EXECUTING:
         printf("%s failed - SQL_STILL_EXECUTING\n",pszFuncName);
         fExitP = FALSE ;
         state = FALSE;
         break;

   case SQL_NEED_DATA:
         printf("%s failed - SQL_NEED_DATA\n",pszFuncName);
         fExitP = FALSE ;
         state = FALSE;
         break;

   default:
         printf("%s failed - unexpected error, retcode = %x\n",pszFuncName,retcode);
         DoSQLError(ptr);
         state = FALSE;
         break;
   }

   if (fExitP)
   {
      exit(-1) ;
   }
   return state ;
}

void Receiver ( )

Definition at line 488 of file MqTrans.Cpp.

{
   MSGPROPID            amPropId[MAX_VAR];
   MQMSGPROPS           msgprops;
   MQPROPVARIANT        aPropVar[MAX_VAR];
   DWORD             cProps;
   HRESULT              hr;
   WCHAR             wsFormat[MAX_FORMAT];
   QUEUEHANDLE          aqh;

   ITransactionDispenser   *pTransactionDispenser;
   ITransaction         *pTransaction;
   BOOL              TransactionCommitFlag;  // Used to decide whether to commit or abort

   RETCODE              retcode;
   DWORD             TransferSum;

   DWORD             MessageBuffer;       // Message body containing TransferSum
   char              sSQLStatement[STR_LEN*2];

   printf ("\nReceiver Side.\n\n");

   //-----------------------------------------------------------------------
   // Build a "ReceiverAccount" database (with the sum of $500).
   //-----------------------------------------------------------------------

   printf ("Building a ReceiverAccount with a sum of $500...\n");

   // Get ODBC environment handle.
   retcode = SQLAllocEnv(&g_hEnv);

   ProcessRetCode("SQLAllocEnv",0, retcode);

   // Establish a connection to the database.
   LogonToDB(&gSrv);

   // Clear the table from the previous run.
   ExecuteStatement(&gSrv,"DROP TABLE ReceiverAccount",FALSE);

   // Create a new table.
   ExecuteStatement(&gSrv,"CREATE TABLE ReceiverAccount (Rate INTEGER CONSTRAINT c2 CHECK (Rate>0))",TRUE);

   // Insert new data into the table.
   ExecuteStatement(&gSrv,"INSERT INTO ReceiverAccount  VALUES(500)",TRUE);

   printf ("OK.\n\n");

   //-----------------------------------------------------------------------
   // Create queue and open it for receiving messages.
   //-----------------------------------------------------------------------

   printf ("Creating a receiver queue...\n");

   // Create the queue.
   CreateQueue (&guidMQTransTestType, wsFormat);

   // Prepare message properties for reading messages.
   cProps = 0;

   amPropId[cProps] =             PROPID_M_BODY;

   aPropVar[cProps].vt =          VT_UI1 | VT_VECTOR;
   aPropVar[cProps].caub.cElems =  sizeof(MessageBuffer);
   aPropVar[cProps].caub.pElems =  (unsigned char *)&MessageBuffer;
   cProps++;

   // Create a MSGPROPS structure.
   msgprops.cProp =    cProps;
   msgprops.aPropID =  amPropId;
   msgprops.aPropVar = aPropVar;
   msgprops.aStatus =  0;

   // Open the queue.
   hr = MQOpenQueue(wsFormat, MQ_RECEIVE_ACCESS, 0, &aqh);

   //
   // Things are a little bit tricky. MQCreateQueue succeeded, but in the
   // case of a public queue, this does not mean that MQOpenQueue
   // will succeed, because replication delays are possible. The queue is
   // registered in the DS, but it might take a replication interval
   // until the replica reaches the server that I am connected to.
   // To overcome this, open the queue in a loop.
   //
   if (hr == MQ_ERROR_QUEUE_NOT_FOUND)
   {
       int iCount = 0 ;
       while((hr == MQ_ERROR_QUEUE_NOT_FOUND) && (iCount < 120))
       {
          printf(".");

          // Wait a bit.
          iCount++ ;
          Sleep(500);

          // Retry.
          hr = MQOpenQueue(wsFormat, MQ_RECEIVE_ACCESS, 0, &aqh);
       }
   }

   if (FAILED(hr))
   {
      Error ("MQOpenQueue failed", hr);
   }

   printf("OK.");

   //--------------------------------------------------------------------------
   // Get the transaction dispenser.
   //--------------------------------------------------------------------------

   // Obtain an interface pointer from the MS DTC proxy.
   hr = DtcGetTransactionManager(
         NULL, NULL, // pszHost, pszTmName
         IID_ITransactionDispenser,         // IID of the requested interface
         0,0,0,                             // Reserved -- must be NULL
         (void **)&pTransactionDispenser);  // Pointer to pointer to the requested interface

   if (FAILED(hr))
      Error ("DTCGetTransactionManager failed", hr);

   //--------------------------------------------------------------------------
   // Receiver Main Loop
   //--------------------------------------------------------------------------
   while (TRUE)
   {

      printf ("\n\nWaiting for a message to come...\n");

      // Peek outside the transaction to avoid database lock
      // for a long/infinite period.
      //
      //dwSize = sizeof(wsResponse);
      hr = MQReceiveMessage(
                    aqh,                     // Handle to queue
                    INFINITE,                // Time-out
                    MQ_ACTION_PEEK_CURRENT,  // Peek action
                    &msgprops,               // Message properties
                    NULL,                    // No OVERLAPPED structure
                    NULL,                    // No callback function
                    NULL,                    // No cursor
                    NULL                     // No transaction yet
                           );

      if (FAILED(hr))
         Error("MQReceiveMessage (PEEKING) failed", hr);

      //--------------------------------------------------------------------------
      // Create a transaction.
      //--------------------------------------------------------------------------
      printf ("\n\nStarting a transaction...\n\n");

      // Initiate an MS DTC transaction.
      hr = pTransactionDispenser->BeginTransaction (
            0,                               // Must be NULL
            ISOLATIONLEVEL_ISOLATED,         // Isolation level
            ISOFLAG_RETAIN_DONTCARE,         // Isolation flags
            0,                               // Pointer to transaction options object
            &pTransaction);                  // Pointer to pointer to transaction object

      if (FAILED(hr))
         Error ("BeginTransaction failed", hr);

      // The default is to commit the transaction.
      TransactionCommitFlag = TRUE;

      //
      // SQL is a resource manager in the transaction.
      // It must be enlisted.
      //

      // Enlist the database in the transaction.
      retcode = SQLSetConnectOption (gSrv.hdbc, SQL_COPT_SS_ENLIST_IN_DTC, (UDWORD)pTransaction);

      if (retcode != SQL_SUCCESS)
         TransactionCommitFlag = FALSE;

      // Receive a message from the queue
      //dwSize = sizeof(wsResponse);
      hr = MQReceiveMessage(
            aqh,                              // Handle to queue
            INFINITE,                         // Time-out interval
            MQ_ACTION_RECEIVE,                // Receive action
            &msgprops,                        // Message properties
            NULL,NULL,NULL,                   // No OVERLAPPED structure, callback function, or cursor
            pTransaction);                    // Pointer to transaction object

      if (FAILED(hr))
         TransactionCommitFlag = FALSE;

      // The message buffer holds TransferSum.
      TransferSum = (DWORD)MessageBuffer;

      // Prepare an SQL statement to update ReceiverAccount.
      sprintf (sSQLStatement, "UPDATE ReceiverAccount   SET Rate = Rate + %i", TransferSum);

      // Allocate a statement handle for use with SQLExecDirect.
      retcode = SQLAllocStmt(gSrv.hdbc,&gSrv.hstmt);

      if (retcode != SQL_SUCCESS)
         TransactionCommitFlag = FALSE;

      // Update the database (add TransferSum to ReceiverAccount).
      retcode = SQLExecDirect (gSrv.hstmt,(UCHAR *) sSQLStatement, SQL_NTS);

      if (retcode != SQL_SUCCESS)
         TransactionCommitFlag = FALSE;

      // Free the statement handle.
      retcode = SQLFreeStmt(gSrv.hstmt, SQL_DROP);

      gSrv.hstmt = SQL_NULL_HSTMT;

      // Commit the transaction.
      if (TransactionCommitFlag)
      {
         printf ("Committing the transaction...   ");

         hr = pTransaction->Commit(0, 0, 0);

         if (FAILED(hr))
            printf ("Failed... The transaction was aborted.\n\n");
         else
            printf ("The transaction was committed successfully.\n\n");

      }

      // Abort the transaction.
      else
      {
         printf ("Aborting the transaction...\n");

         hr = pTransaction->Abort(0, 0, 0);

         if (FAILED(hr))
            Error("The transaction was aborted", hr);
         else
            printf ("The transaction was aborted.\n\n");

      }

      // Release the transaction.
      pTransaction->Release();

      // End the enlistment of the database.
      retcode = SQLSetConnectOption (gSrv.hdbc, SQL_COPT_SS_ENLIST_IN_DTC, SQL_DTC_DONE);

      ProcessRetCode ("SQLSetConnectOption", &gSrv, retcode);

      // Display the number of dollars in ReceiverAccount.
      DisplayDollars (&gSrv, "ReceiverAccount");

      // Decide whether to continue the loop.
      if (TransferSum == 0)
         break;

   }

   //--------------------------------------------------------------------------
   // Cleanup
   //--------------------------------------------------------------------------

   // Release the transaction dispenser.
   pTransactionDispenser->Release();

   // Free the database.
   ExecuteStatement(&gSrv,"DROP TABLE ReceiverAccount",TRUE);

   // Free the ODBC handle.
   FreeODBCHandles(&gSrv);

   // Free the ODBC environment handle.
   retcode = SQLFreeEnv(g_hEnv);

   if (retcode == SQL_ERROR)
      Error ("SQL FreeEnv ",0);

   // Free the queue handle.
    MQCloseQueue(aqh);

   // Delete the queue from the directory service.
   MQDeleteQueue(wsFormat);

   printf ("\n\nReceiver side completed.\n\n");
}

void Sender ( )

Definition at line 185 of file MqTrans.Cpp.

{

   ITransactionDispenser   *pTransactionDispenser;
   ITransaction            *pTransaction;
   BOOL                    fTransactionCommitFlag;
                            // Used to decide whether to commit or abort

   HRESULT              hr;
   RETCODE              retcode;
   DWORD                dwTransferSum;              // Set by the user
   char                 sUserString[ STR_LEN ];
   char                 sSQLStatement[ STR_LEN*2 ];

   MQMSGPROPS           msgprops;
   MQPROPVARIANT        aPropVar[MAX_VAR];
   MSGPROPID            amPropId[MAX_VAR];
   WCHAR                wsFormat[MAX_FORMAT];
   QUEUEHANDLE          aqh;

    printf("\nSender Side.\n\n");

   //---------------------------------------------------------------------
   // Build the "SenderAccount" database (with the sum of $1000)
   //---------------------------------------------------------------------

   printf ("Building SenderAccount with the sum of $1000...\n");

   // Get the ODBC environment handle.
   retcode = SQLAllocEnv(&g_hEnv);

   ProcessRetCode("SQLAllocEnv",0, retcode);

   // Establish a connection to the database.
   LogonToDB(&gSrv);

   // Clear the database from the previous run.
   ExecuteStatement(&gSrv,"DROP TABLE SenderAccount",FALSE);

   // Create a new table in the database.
   ExecuteStatement(&gSrv,
    "CREATE TABLE SenderAccount (Rate INTEGER CONSTRAINT c1 CHECK (Rate>=0))",TRUE);

   // Insert new data into the database.
   ExecuteStatement(&gSrv,"INSERT INTO SenderAccount   VALUES(1000)",TRUE);

   printf ("OK.\n\n");

   //-----------------------------------------------------------------------
   // Locate the destination queue and open it for sending messages.
   //-----------------------------------------------------------------------

   printf ("Searching for the receiver queue...\n");

   // Locate the destination queue.
   LocateTargetQueue (&guidMQTransTestType, wsFormat);

   // Open the destination queue.
   hr = MQOpenQueue(wsFormat, MQ_SEND_ACCESS, 0, &aqh);

   if (FAILED(hr))
   {
      Error ("MQOpenQueue failed", hr);
   }

   //--------------------------------------------------------------------------
   // Get the transaction dispenser.
   //--------------------------------------------------------------------------

   // Obtain an interface pointer from the MS DTC proxy.
   hr = DtcGetTransactionManager(
               NULL,                        // pszHost
               NULL,                        // pszTmName
               IID_ITransactionDispenser,   // IID of interface
               0,                           // Reserved -- must be NULL
               0,                           // Reserved -- must be NULL
               0,                           // Reserved -- must be NULL
               (void **)&pTransactionDispenser  // Pointer to pointer to requested interface
                                 );

   if (FAILED(hr))
   {
      Error ("DTCGetTransactionManager failed", hr);
   }

   //--------------------------------------------------------------------
   // Sender's main loop
   //--------------------------------------------------------------------
   while (TRUE)
   {

    // Prompt user to enter a value for TransferSum.
    printf ("\n\nPlease enter the sum of dollars to transfer, or '0' to quit  ==> ");

    // Read the user input.

    if (fgets (sUserString, STR_LEN - 1, stdin) == NULL)
    {
      printf("\nInvalid input was entered. Exiting...\n");
      exit(1);
    }

    sUserString[STR_LEN - 1] = '\0';

    //
    // Remove the final new-line character introduced by fgets.
    //
    if(sUserString[strlen(sUserString) - 1] == '\n')
    {
      sUserString[strlen(sUserString) - 1] = '\0';
    }

      // Convert the user string to a DWORD
      dwTransferSum = atoi(sUserString);

      // Prepare message properties to sending a message.
      PrepareSendMessageProperties (amPropId,
                                    aPropVar,
                                    msgprops,
                                    dwTransferSum);

      //---------------------------------------------------------------------
      // Create a transaction (within the sender's main loop).
      //---------------------------------------------------------------------

      printf ("\nStarting a transaction...\n\n");

      // Initiate an MS DTC transaction.
      hr = pTransactionDispenser->BeginTransaction (
            0,                         // Must be null
            ISOLATIONLEVEL_ISOLATED,   // Isolation level
            ISOFLAG_RETAIN_DONTCARE,   // Isolation flags
            0,                         // Pointer to transaction options object
            &pTransaction);            // Pointer to pointer to transaction object

      if (FAILED(hr))
      {
         Error ("BeginTransaction failed",hr);
      }

      // The default is to commit the transaction.
      fTransactionCommitFlag = TRUE;

      //
      // SQL is a resource manager in the transaction.
      // It must be enlisted.
      //

      // Enlist the database in the transaction.
      retcode = SQLSetConnectOption (gSrv.hdbc,
                                     SQL_COPT_SS_ENLIST_IN_DTC,
                                     (UDWORD)pTransaction);

      if (retcode != SQL_SUCCESS)
      {
         ProcessRetCode("SQLSetConnection", &gSrv, retcode, FALSE);
         fTransactionCommitFlag = FALSE;
      }

      // Prepare an SQL statement for updating SenderAccount.
      sprintf (sSQLStatement,
               "UPDATE SenderAccount  SET Rate = Rate - %lu", dwTransferSum) ;

      // Allocate a statement handle for use with SQLExecDirect.
      retcode = SQLAllocStmt(gSrv.hdbc, &gSrv.hstmt);

      if (retcode != SQL_SUCCESS)
      {
         ProcessRetCode("SQLAllocStmt", &gSrv, retcode, FALSE);
         fTransactionCommitFlag = FALSE;
      }

      // Update the database (subtract TransferSum from SenderAccount).
      retcode = SQLExecDirect (gSrv.hstmt,(UCHAR *) sSQLStatement, SQL_NTS);

      if (retcode != SQL_SUCCESS)
      {
         ProcessRetCode("SQLExecDirect", &gSrv, retcode, FALSE);
         fTransactionCommitFlag = FALSE;
      }

      // Free the statement handle.
      retcode = SQLFreeStmt(gSrv.hstmt, SQL_DROP);

      gSrv.hstmt = SQL_NULL_HSTMT;

      //
      // MSMQ is another resource manager in the transaction.
      // Its enlistment is implicit.
      //

      // Within the transaction, send a message to the receiver side.
      hr = MQSendMessage(aqh,              // Handle to destination queue
                         &msgprops,        // pointer to MQMSGPROPS structure
                         pTransaction);    // pointer to Transaction Object

      if (FAILED(hr))
      {
         printf("\nMQSendMessage() failed. Error code: %lxh\n", (DWORD) hr);
         fTransactionCommitFlag = FALSE;
      }

      // Commit the transaction.
      if (fTransactionCommitFlag)
      {
         printf ("Committing the transaction...\n");

         hr = pTransaction->Commit(0, 0, 0);

         if (FAILED(hr))
            printf ("The transaction was aborted.\n\n");
         else
            printf ("The transaction was committed successfully.\n\n");

      }
      else
      {
         printf ("Aborting the transaction...\n");

         hr = pTransaction->Abort(0, 0, 0);

         if (FAILED(hr))
            Error("The transaction was aborted", hr);
         else
            printf ("The transaction was aborted.\n\n");
      }

      // Release the transaction.
      pTransaction->Release();

      // End enlistment of the database.
      retcode = SQLSetConnectOption (gSrv.hdbc, SQL_COPT_SS_ENLIST_IN_DTC, SQL_DTC_DONE);

      ProcessRetCode ("SQLSetConnectOption", &gSrv, retcode);

      // Display the sum of dollars in SenderAccount.
      DisplayDollars (&gSrv, "SenderAccount");

      // Quit the loop when nothing was transferred.
      if (dwTransferSum == 0)
         break;
   }

   //--------------------------------------------------------------------------
   // Cleanup
   //--------------------------------------------------------------------------

   // Release the transaction dispenser.
   pTransactionDispenser->Release();

   // Free the database.
   ExecuteStatement(&gSrv,"DROP TABLE SenderAccount",TRUE);

   // Free the ODBC handle.
   FreeODBCHandles(&gSrv);

   // Free the ODBC environment handle.
   retcode = SQLFreeEnv(g_hEnv);

   if (retcode == SQL_ERROR)
      Error ("SQL FreeEnv ",0);

   // Free the MSMQ queue handle.
   MQCloseQueue(aqh);

   printf ("\n\nThe sender side completed.\n\n");

}

void Syntax ( )

Definition at line 1007 of file MqTrans.Cpp.

{
    printf("\n");
    printf("Syntax: msmqtrans -s | -r\n");
    printf("\t-s - Sender Side\n");
    printf("\t-r - Receiver Side\n");
    exit(1);

}

Variable Documentation

HENV g_hEnv = SQL_NULL_HENV

Definition at line 130 of file MqTrans.Cpp.

WCHAR g_wszMachineName[MAX_COMPUTERNAME_LENGTH+1]

Definition at line 134 of file MqTrans.Cpp.

Generated on Wed Nov 13 2024 16:53:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/MessageQueuing/MSMQTest/MSMQTest.c File Reference

  • NetDS
  • MessageQueuing
  • MSMQTest
Defines | Functions | Variables

MSMQTest.c File Reference

#include <stdio.h>
#include <windows.h>
#include <mq.h>

Go to the source code of this file.

Defines

#define | DIRECT 1
#define | DS_DISABLED 0
#define | DS_ENABLED 1
#define | MAX_BUFFER 500
#define | MAX_FORMAT 300
#define | MAX_VAR 20
#define | STANDARD 0

Functions

int | DetectDsConnection (void)
void | DirectSender (void)
void | Error (char *s, HRESULT hr)
int | main (int argc, char *argv[])
void | Receiver (int dDirectMode)
void | Sender (int dDirectMode)
int | SetConnectionMode (void)
void | StandardSender (void)
void | Syntax ()

Variables

char | mbsMachineName [MAX_COMPUTERNAME_LENGTH+1]

Define Documentation

#define DIRECT 1

Definition at line 33 of file MSMQTest.c.

#define DS_DISABLED 0

Definition at line 37 of file MSMQTest.c.

#define DS_ENABLED 1

Definition at line 36 of file MSMQTest.c.

#define MAX_BUFFER 500

Definition at line 31 of file MSMQTest.c.

#define MAX_FORMAT 300

Definition at line 30 of file MSMQTest.c.

#define MAX_VAR 20

Definition at line 29 of file MSMQTest.c.

#define STANDARD 0

Definition at line 34 of file MSMQTest.c.

Function Documentation

int DetectDsConnection ( void )

Definition at line 63 of file MSMQTest.c.

{

    MQPRIVATEPROPS PrivateProps;
    QMPROPID       aPropId[MAX_VAR];
    MQPROPVARIANT  aPropVar[MAX_VAR];
    HRESULT        aStatus[MAX_VAR];

    DWORD          cProp;

    HRESULT        hr;

    //
    // Specify the PROPID_PC_DS_ENABLED property, which
  // indicates whether the local computer can access the DS.
    //
    cProp = 0;

    aPropId[cProp] = PROPID_PC_DS_ENABLED;
    aPropVar[cProp].vt = VT_NULL;
    ++cProp;

    // Create a PRIVATEPROPS structure.
    PrivateProps.cProp = cProp;
  PrivateProps.aPropID = aPropId;
  PrivateProps.aPropVar = aPropVar;
    PrivateProps.aStatus = aStatus;
    //
    // Retrieve the information.
    //
  hr = MQGetPrivateComputerInformation(
             NULL,
           &PrivateProps);
  if(FAILED(hr))
  {
        Error("A DS connection cannot be detected", hr);
    }

    if(PrivateProps.aPropVar[0].boolVal == 0)
        return DS_DISABLED;

    return DS_ENABLED;
}

void DirectSender ( void )

Definition at line 705 of file MSMQTest.c.

{

    MQMSGPROPS    msgprops;
    MQPROPVARIANT aPropVar[MAX_VAR];
    MSGPROPID     amPropId[MAX_VAR];
    DWORD         cProps;

    WCHAR         wcsFormat[MAX_FORMAT];
    WCHAR         wcsReceiverComputer[MAX_COMPUTERNAME_LENGTH + 1];

    UCHAR         Buffer[MAX_BUFFER];
    WCHAR         wcsMsgLabel[MQ_MAX_MSG_LABEL_LEN];

    QUEUEHANDLE   qhSend;

    HRESULT       hr;
  int       nPos;

    //
    // Get the receiver computer name.
    //
    printf("Enter receiver computer name: ");
  if (fgetws(wcsReceiverComputer, MAX_COMPUTERNAME_LENGTH, stdin) == NULL)
  {
        printf("An invalid parameter was entered. Exiting...\n");
        exit(1);
  }
  wcsReceiverComputer[MAX_COMPUTERNAME_LENGTH] = L'\0';
  //
  // Deleting the new-line character.
  //
  if(wcsReceiverComputer[wcslen(wcsReceiverComputer) - 1] == L'\n')
  {
    wcsReceiverComputer[wcslen(wcsReceiverComputer) - 1] = L'\0';
  }

    if(wcsReceiverComputer[0] == 0)
    {
        printf("An invalid parameter was entered. Exiting...\n");
        exit(1);
    }

    //
    // Open the queue with send access.
    //
  nPos = _snwprintf(wcsFormat, MAX_FORMAT - 1, L"DIRECT=OS:%s\\private$\\MSMQTest", wcsReceiverComputer);
  if(nPos < 0)
  {
    printf("The format name is too long for the buffer. Exiting...\n");
    exit(1);
  }
  wcsFormat[nPos] = L'\0';

    hr = MQOpenQueue(
             wcsFormat,           // IN:  Queue format name
             MQ_SEND_ACCESS,      // IN:  Want to send to queue
             0,                   // IN:  Must be 0 for send access
             &qhSend);            // OUT: Handle of open queue

    if (FAILED(hr))
        Error("MQOpenQueue failed", hr);

    printf("\nEnter \"quit\" to exit\n");

    //
    // Construct the message label.
    //
  nPos = _snwprintf(wcsMsgLabel, MQ_MAX_MSG_LABEL_LEN - 1, L"Message from %S", mbsMachineName);
  if(nPos < 0)
  {
    printf("The label is too long for the buffer. Exiting...\n");
    exit(1);
  }
  wcsMsgLabel[nPos] = L'\0';

    fflush(stdin);

    //
    // Main sender loop
    //
    for(;;)
    {
        //
        // Get a string from the console.
        //
        printf("Enter a string: ");
        if (fgets(Buffer, MAX_BUFFER - 1, stdin) == NULL)
            break;

    Buffer[MAX_BUFFER-1] = '\0';
    //
    // Delete the new-line character.
    //
    if(Buffer[strlen(Buffer) - 1] == '\n')
    {
      Buffer[strlen(Buffer) - 1] = '\0';
    }

        //
        // Set the message properties for sending messages.
        //
        cProps = 0;

        // Set the body of the message.
        amPropId[cProps]            = PROPID_M_BODY;
        aPropVar[cProps].vt         = VT_UI1 | VT_VECTOR;
        aPropVar[cProps].caub.cElems = sizeof(Buffer);
        aPropVar[cProps].caub.pElems = Buffer;
        cProps++;

        // Set the label of the message.
        amPropId[cProps]            = PROPID_M_LABEL;
        aPropVar[cProps].vt         = VT_LPWSTR;
        aPropVar[cProps].pwszVal    = wcsMsgLabel;
        cProps++;

        // Create a MSGPROPS structure.
        msgprops.cProp    = cProps;
        msgprops.aPropID  = amPropId;
        msgprops.aPropVar = aPropVar;
        msgprops.aStatus  = 0;

        //
        // Send the message.
        //
        hr = MQSendMessage(
                qhSend,     // IN: Queue handle
                &msgprops,  // IN: Message properties to send
                NULL);      // IN: Not part of a transaction

        if (FAILED(hr))
            Error("MQSendMessage failed", hr);

        //
        // Check for a request to end the application.
        //
        if (stricmp(Buffer, "quit") == 0)
            break;

    } /* for */

    //
    // Close the queue handle.
    //
    MQCloseQueue(qhSend);
}

void Error | ( | char * | s,
 |  | HRESULT | hr
 | ) |  |

Definition at line 925 of file MSMQTest.c.

{
    printf("%s (0x%X). Exiting...\n", s, hr);
    exit(1);
}

int main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 882 of file MSMQTest.c.

{
    DWORD dwNumChars;
    int dDirectMode;

    if (argc != 2)
    {
        Syntax();
    }

    //
    // Retrieve the computer name.
    //
    dwNumChars = MAX_COMPUTERNAME_LENGTH;
    if(!GetComputerName(mbsMachineName, &dwNumChars))
  {
    printf("Failed to get computer name. Exiting...\n");
    exit(1);
  }

    //
    // Detect a DS connection and determine the working mode.
    //

    dDirectMode = SetConnectionMode();

    if(strcmp(argv[1], "-s") == 0)
        Sender(dDirectMode);

    else if (strcmp(argv[1], "-r") == 0)
        Receiver(dDirectMode);

    else
        Syntax();

    printf("\nOK\n");

    return(0);
}

void Receiver ( int dDirectMode )

Definition at line 182 of file MSMQTest.c.

{

    MQQUEUEPROPS  qprops;
    MQMSGPROPS    msgprops;
    MQPROPVARIANT aPropVar[MAX_VAR];
    QUEUEPROPID   aqPropId[MAX_VAR];
    MSGPROPID     amPropId[MAX_VAR];
    DWORD         cProps;

    WCHAR         wcsFormat[MAX_FORMAT];

    UCHAR         Buffer[MAX_BUFFER];
    WCHAR         wcsMsgLabel[MQ_MAX_MSG_LABEL_LEN];
    WCHAR         wcsPathName[MAX_FORMAT];

    DWORD         dwNumChars;
    QUEUEHANDLE   qh;

    HRESULT       hr;
  int       nPos;

    printf("\nReceiver Mode on Machine: %s\n\n", mbsMachineName);

    //
    // Set properties to create a queue on the local computer.
    //
    cProps = 0;

    // Set the path name.
    if(dDirectMode == DIRECT)  // Private queue path name
    {
    nPos = _snwprintf(wcsPathName, MAX_FORMAT - 1, L"%S\\private$\\MSMQTest", mbsMachineName);
    if(nPos < 0)
    {
      printf("The path name is too long for the buffer. Exiting...\n");
      exit(1);
    }
    wcsPathName[nPos] = L'\0';

    }
    else                       // Public queue path name
    {
    nPos = _snwprintf(wcsPathName, MAX_FORMAT - 1, L"%S\\MSMQTest", mbsMachineName);
    if(nPos < 0)
    {
      printf("The path name is too long for the buffer. Exiting...\n");
      exit(1);
    }
    wcsPathName[nPos] = L'\0';

    }

    aqPropId[cProps]         = PROPID_Q_PATHNAME;
    aPropVar[cProps].vt      = VT_LPWSTR;
    aPropVar[cProps].pwszVal = wcsPathName;
    cProps++;

    // Specify the service type GUID of the queue.
    // (This property will be used to locate all the queues of this type.)
    aqPropId[cProps]         = PROPID_Q_TYPE;
    aPropVar[cProps].vt      = VT_CLSID;
    aPropVar[cProps].puuid   = &guidMQTestType;
    cProps++;

    // Add a descriptive label to the queue.
    // (A label is useful for administration through the MSMQ admin tools.)
    aqPropId[cProps]         = PROPID_Q_LABEL;
    aPropVar[cProps].vt      = VT_LPWSTR;
    aPropVar[cProps].pwszVal = L"Sample application of MSMQ SDK";
    cProps++;

    // Create a QUEUEPROPS structure.
    qprops.cProp    = cProps;
    qprops.aPropID  = aqPropId;
    qprops.aPropVar = aPropVar;
    qprops.aStatus  = 0;

    //
    // Create the queue.
    //
    dwNumChars = MAX_FORMAT;
    hr = MQCreateQueue(
            NULL,           // IN:     Default security
            &qprops,        // IN/OUT: Queue properties
            wcsFormat,      // OUT:    Format name
            &dwNumChars);   // IN/OUT: Size of the format name

    if (FAILED(hr))
    {
        //
        // API failed, but not because the queue exists.
        //
        if (hr != MQ_ERROR_QUEUE_EXISTS)
            Error("MQCreateQueue failed", hr);

        //
        // The queue exist, so get its format name.
        //
        printf("The queue already exists. Open it anyway.\n");

        if(dDirectMode == DIRECT)
        // It's a private queue, so we know its direct format name.
        {
      int n = _snwprintf(wcsFormat, MAX_FORMAT - 1, L"DIRECT=OS:%s", wcsPathName);
      if(n < 0)
      {
        printf("The format name is too long for the buffer. Exiting...\n");
        exit(1);
      }
      wcsFormat[n] = L'\0';

        }
        else
        // It's a public queue, so we must get its format name from the DS.
        {
            dwNumChars = MAX_FORMAT;
            hr = MQPathNameToFormatName(
                       wcsPathName,     // IN:     Queue path name
                       wcsFormat,       // OUT:    Format name
                       &dwNumChars);    // IN/OUT: Size of the format name

            if (FAILED(hr))
                Error("The format name cannot be retrieved", hr);
        }
    }

    //
    // Open the queue with receive access.
    //
    hr = MQOpenQueue(
             wcsFormat,          // IN:  Queue format name
             MQ_RECEIVE_ACCESS,  // IN:  Want to receive from queue
             0,                  // IN:  Allow sharing
             &qh);               // OUT: Handle of open queue

    //
    // Things are a little bit tricky. MQCreateQueue succeeded, but in the
    // case of a public queue, this does not mean that MQOpenQueue
    // will succeed, because replication delays are possible. The queue is
    // registered in the DS, but it might take a replication interval
    // until the replica reaches the server that I am connected to.
    // To overcome this, open the queue in a loop.
    //
    // In this specific case, this can happen only if this program
    // is run on an MSMQ 1.0 backup server controller (BSC) or on
    // a client connected to a BSC.
    // To be totally on the safe side, we should have put some code
    // to exit the loop after a few retries, but this is just a sample.
    //
    while (hr == MQ_ERROR_QUEUE_NOT_FOUND)
    {
       printf(".");

       // Wait a bit.
       Sleep(500);

       // Retry.
       hr = MQOpenQueue(wcsFormat, MQ_RECEIVE_ACCESS, 0, &qh);
    }

    if (FAILED(hr))
         Error("The queue cannot be opened", hr);

    //
    // Main receiver loop
    //
    if(dDirectMode == DIRECT)
    {
        printf("\n* Working in workgroup (direct) mode.\n");
    }
    printf("\n* Waiting for messages...\n");

    for(;;)
    {
        //
        // Set the message properties for reading messages.
        //
        cProps = 0;

        // Ask for the body of the message.
        amPropId[cProps]            = PROPID_M_BODY;
        aPropVar[cProps].vt         = VT_UI1 | VT_VECTOR;
        aPropVar[cProps].caub.cElems = sizeof(Buffer);
        aPropVar[cProps].caub.pElems = Buffer;
        cProps++;

        // Ask for the label of the message.
        amPropId[cProps]         = PROPID_M_LABEL;
        aPropVar[cProps].vt      = VT_LPWSTR;
        aPropVar[cProps].pwszVal = wcsMsgLabel;
        cProps++;

        // Ask for the length of the label of the message.
        amPropId[cProps]         = PROPID_M_LABEL_LEN;
        aPropVar[cProps].vt      = VT_UI4;
        aPropVar[cProps].ulVal   = MQ_MAX_MSG_LABEL_LEN;
        cProps++;

        // Create a MSGPROPS structure.
        msgprops.cProp    = cProps;
        msgprops.aPropID  = amPropId;
        msgprops.aPropVar = aPropVar;
        msgprops.aStatus  = 0;

        //
        // Receive the message.
        //
        hr = MQReceiveMessage(
               qh,                // IN:     Queue handle
               INFINITE,          // IN:     Time-out
               MQ_ACTION_RECEIVE, // IN:     Read operation
               &msgprops,         // IN/OUT: Message properties to retrieve
               NULL,              // IN/OUT: No OVERLAPPED structure
               NULL,              // IN:     No callback
               NULL,              // IN:     No cursor
               NULL);             // IN:     Not part of a transaction

        if (FAILED(hr))
            Error("MQReceiveMessage failed", hr);

        //
        // Display the received message.
        //
        printf("%S : %s\n", wcsMsgLabel, Buffer);

        //
        // Check for a request to end the application.
        //
        if (stricmp(Buffer, "quit") == 0)
            break;

    } /* while (1) */

    //
    // Cleanup: Close the handle to the queue.
    //
    MQCloseQueue(qh);

    //
    // In the concluding stage, we delete the queue from the directory
    // service. (We don't need to do this. In case of a public queue,
    // leaving it in the DS enables sender applications to send messages
    // even if the receiver is not available.)
    //
    hr = MQDeleteQueue(wcsFormat);
    if (FAILED(hr))
        Error("The queue cannot be deleted", hr);
}

void Sender ( int dDirectMode )

Definition at line 865 of file MSMQTest.c.

{

    if(dDirectMode == DIRECT)
        DirectSender();

    else
        StandardSender();
}

int SetConnectionMode ( void )

Definition at line 117 of file MSMQTest.c.

{

    char cDirectMode;
    int iRes;

    //
    // If the local computer is in a domain and not in workgroup mode,
    // we have two cases:
    //   1. Other side is a computer operating in domain mode.
    //   2. Other side is a computer operating in workgroup mode.
    //

    if(DetectDsConnection() == DS_ENABLED)
    {
            printf("Do you want to connect to a DS-disabled client (y or n) ? ");
      iRes = scanf("%c", &cDirectMode);
      if (iRes == 0 || iRes == EOF)
      {
        printf("\nInvalid input.\n");
        exit(1);
      }

      //
      // Flushing stdin to get rid of the new line entered earlier.
      //
      fflush(stdin);

            switch(tolower(cDirectMode))
            {
                case 'y':
                    return DIRECT;

                case 'n':
                    return STANDARD;

                default:
                    printf("Bye.\n");
                    exit(1);
            }

    }

    return DIRECT;     // Local computer is DS-disabled
}

void StandardSender ( void )

Definition at line 466 of file MSMQTest.c.

{
    DWORD         cProps;

    MQMSGPROPS    msgprops;
    MQPROPVARIANT aPropVar[MAX_VAR];
    QUEUEPROPID   aqPropId[MAX_VAR];
    MSGPROPID     amPropId[MAX_VAR];

    MQPROPERTYRESTRICTION aPropRestriction[MAX_VAR];
    MQRESTRICTION Restriction;

    MQCOLUMNSET      Column;
    HANDLE        hEnum;

    WCHAR         wcsFormat[MAX_FORMAT];

    UCHAR         Buffer[MAX_BUFFER];
    WCHAR         wcsMsgLabel[MQ_MAX_MSG_LABEL_LEN];

    DWORD         i;

    DWORD         cQueue;
    DWORD         dwNumChars;
    QUEUEHANDLE   aqh[MAX_VAR];

    HRESULT       hr;
  int       nPos;

    printf("\nSender mode on the computer %s\n\n", mbsMachineName);

    //
    // Prepare parameters for locating queues.
    //

    //
    // 1. Restriction: Queues with PROPID_Q_TYPE = MSMQTest service type GUIID
    //
    cProps = 0;
    aPropRestriction[cProps].rel         = PREQ;
    aPropRestriction[cProps].prop        = PROPID_Q_TYPE;
    aPropRestriction[cProps].prval.vt    = VT_CLSID;
    aPropRestriction[cProps].prval.puuid = &guidMQTestType;
    cProps++;

    Restriction.cRes      = cProps;
    Restriction.paPropRes = aPropRestriction;

    //
    // 2. Columnset (the queue properties to retrieve) = queue GUID
    //
    cProps = 0;
    aqPropId[cProps] = PROPID_Q_INSTANCE;
    cProps++;

    Column.cCol = cProps;
    Column.aCol = aqPropId;

    //
    // Issue the query to locate the queues.
    //
    hr = MQLocateBegin(
             NULL,          // IN:  Context must be NULL
             &Restriction,  // IN:  Restriction
             &Column,       // IN:  Properties to return
             NULL,          // IN:  No need to sort
             &hEnum);       // OUT: Enumeration handle

    if (FAILED(hr))
        Error("MQLocateBegin failed", hr);

    //
    // Get the results (up to MAX_VAR).
    // (For more results, call MQLocateNext in a loop.)
    //
    cQueue = MAX_VAR;
    hr = MQLocateNext(
             hEnum,         // IN:     Enumeration handle
             &cQueue,       // IN/OUT: Number of properties
             aPropVar);     // OUT:    Properties of the queue located

    if (FAILED(hr))
        Error("MQLocateNext failed", hr);

    //
    // End the query and release the resouces associated with it.
    //
    hr = MQLocateEnd(hEnum);

    if (cQueue == 0)
    {
        //
        // No queue could be found, so exit.
        //
        printf("No queue was registered.");
        exit(0);
    }

    printf("\tQueue(s) found: %d\n", cQueue);

    //
    // Open a handle for each of the queues found.
    //
    for (i = 0; i < cQueue; i++)
    {
        // Convert the queue GUID to a format name.
        dwNumChars = MAX_FORMAT;
        hr = MQInstanceToFormatName(
                  aPropVar[i].puuid,    // IN:     Queue GUID
                  wcsFormat,            // OUT:    Format name
                  &dwNumChars);         // IN/OUT: Size of format name

        if (FAILED(hr))
            Error("MQInstanceToFormatName failed", hr);

        //
        // Open the queue with send access.
        //
        hr = MQOpenQueue(
                 wcsFormat,           // IN:  Queue format name
                 MQ_SEND_ACCESS,      // IN:  Want to send to queue
                 0,                   // IN:  Must be 0 for send access
                 &aqh[i]);            // OUT: Handle of open queue

        if (FAILED(hr))
            Error("MQOpenQueue failed", hr);

        //
        // Free the memory that was allocated for the queue GUID during the query.
        //
        MQFreeMemory(aPropVar[i].puuid);
    }

    printf("\nEnter \"quit\" to exit.\n");

    //
    // Construct the message label.
    //
  nPos = _snwprintf(wcsMsgLabel, MQ_MAX_MSG_LABEL_LEN - 1, L"Message from %S", mbsMachineName);
  if(nPos < 0)
  {
    printf("The label is too long for the buffer. Exiting...\n");
    exit(1);
  }
  wcsMsgLabel[nPos] = L'\0';

    //
    // Main sender loop
    //
    for(;;)
    {
        //
        // Get a string from the console.
        //
        printf("Enter a string: ");
    if (fgets(Buffer, MAX_BUFFER - 1, stdin) == NULL)
            break;

    Buffer[MAX_BUFFER-1] = '\0';
    //
    // Deleting the new-line character.
    //
    if(Buffer[strlen(Buffer) - 1] == '\n')
    {
      Buffer[strlen(Buffer)-1] = '\0';
    }

        //
        // Prepare the message properties for sending messages.
        //
        cProps = 0;

        // Set the message body.
        amPropId[cProps]            = PROPID_M_BODY;
        aPropVar[cProps].vt         = VT_UI1 | VT_VECTOR;
        aPropVar[cProps].caub.cElems = sizeof(Buffer);
        aPropVar[cProps].caub.pElems = Buffer;
        cProps++;

        // Set the message label.
        amPropId[cProps]            = PROPID_M_LABEL;
        aPropVar[cProps].vt         = VT_LPWSTR;
        aPropVar[cProps].pwszVal    = wcsMsgLabel;
        cProps++;

        // Create a MSGPROPS structure.
        msgprops.cProp    = cProps;
        msgprops.aPropID  = amPropId;
        msgprops.aPropVar = aPropVar;
        msgprops.aStatus  = 0;

        //
        // Send the message to all the queues.
        //
        for (i = 0; i < cQueue; i++)
        {
            hr = MQSendMessage(
                    aqh[i],     // IN: Queue handle
                    &msgprops,  // IN: Message properties to send
                    NULL);      // IN: Not part of a transaction

            if (FAILED(hr))
                Error("MQSendMessage failed", hr);
        }

        //
        // Check for a request to end the application.
        //
        if (stricmp(Buffer, "quit") == 0)
            break;

    } /* for */

    //
    // Close all the queue handles.
    //
    for (i = 0; i < cQueue; i++)
        MQCloseQueue(aqh[i]);

}

void Syntax ( )

Definition at line 932 of file MSMQTest.c.

{
    printf("\n");
    printf("Syntax: msmqtest -s | -r\n");
    printf("\t-s: Sender\n");
    printf("\t-r: Receiver\n");
    exit(1);
}

Variable Documentation

char mbsMachineName[MAX_COMPUTERNAME_LENGTH+1]

Definition at line 54 of file MSMQTest.c.

Generated on Wed Nov 13 2024 16:53:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/NetMon/experts/blrplate/blrplate.cpp File Reference

  • NetDS
  • NetMon
  • experts
  • blrplate
Defines | Functions | Variables

blrplate.cpp File Reference

#include "BLRPLATE.h"
#include "resrc1.h"

Go to the source code of this file.

Defines

#define | STRICT 1

Functions

BOOL WINAPI | Configure (HEXPERTKEY hExpertKey, PEXPERTCONFIG *ppConfig, PEXPERTSTARTUPINFO pStartupInfo, DWORD StartupFlags, HWND hWnd)
BOOL WINAPI | DllMain (HINSTANCE hInstance, ULONG ulReason, LPVOID pvReserved)
BOOL WINAPI | Register (PEXPERTENUMINFO lpExpertInfo)
BOOL WINAPI | Run (HEXPERTKEY hExpertKey, PEXPERTCONFIG lpConfig, PEXPERTSTARTUPINFO pStartupInfo, DWORD StartupFlags, HWND hwnd)

Variables

char | g_Col0Name [MAX_PATH]
char | g_Col1Name [MAX_PATH]
char | g_EventName [MAX_PATH]
char | g_ExpertName [MAX_PATH]
HINSTANCE | g_hInstance
char | g_Justification [MAX_PATH]
char | g_StatusString [MAX_PATH]

Define Documentation

#define STRICT 1

Definition at line 12 of file blrplate.cpp.

Function Documentation

BOOL WINAPI Configure | ( | HEXPERTKEY | hExpertKey,
 |  | PEXPERTCONFIG * | ppConfig,
 |  | PEXPERTSTARTUPINFO | pStartupInfo,
 |  | DWORD | StartupFlags,
 |  | HWND | hWnd
 | ) |  |

Definition at line 65 of file blrplate.cpp.

{
    // is the startup info from a right mouse click?
    if( (pStartupInfo == NULL) &&
        (StartupFlags & EXPERT_STARTUP_FLAG_USE_STARTUP_DATA_OVER_CONFIG_DATA) )
    {
        // The user started this expert by right mouse clicking...

        // TODO: pull the relevant data out of the pStartupInfo
        // and put it in the (possibly resized) ppConfig
    }

    // call the dialog
    return ConfigBLRPLATEDlg_Do(hWnd,
                                (PBLRPLATECONFIG *)ppConfig,
                                hExpertKey);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | ULONG | ulReason,
 |  | LPVOID | pvReserved
 | ) |  |

Definition at line 32 of file blrplate.cpp.

{
    switch( ulReason )
    {
        case DLL_PROCESS_ATTACH:
            g_hInstance = hInstance;
            break;

        case DLL_PROCESS_DETACH:
            break;
    }
    return TRUE;
}

BOOL WINAPI Register ( PEXPERTENUMINFO lpExpertInfo )

Definition at line 49 of file blrplate.cpp.

{
    // fill in the expert info data structure
    // TODO: Choose the proper flags
    lpExpertInfo->Flags = EXPERT_ENUM_FLAG_VIEWER_PRIVATE |
                          EXPERT_ENUM_FLAG_CONFIGURABLE;
    lpExpertInfo->Version = 1;
    LoadString( g_hInstance, IDS_EXPERTNAME, lpExpertInfo->szName, MAX_PATH);
    LoadString( g_hInstance, IDS_COMMENT, lpExpertInfo->szDescription, MAX_PATH);
    LoadString( g_hInstance, IDS_AUTHOR, lpExpertInfo->szVendor, MAX_PATH);
    return TRUE;
}

BOOL WINAPI Run | ( | HEXPERTKEY | hExpertKey,
 |  | PEXPERTCONFIG | lpConfig,
 |  | PEXPERTSTARTUPINFO | pStartupInfo,
 |  | DWORD | StartupFlags,
 |  | HWND | hwnd
 | ) |  |

Definition at line 91 of file blrplate.cpp.

{
    DWORD                   rc;
    EXPERTSTATUS            Status;

    HFILTER                 hFilter;
    FILTEROBJECT2            FilterObj;

    PBLRPLATECONFIG         pBLRPLATEConfig = (PBLRPLATECONFIG)lpConfig;

    PNMEVENTDATA            pEvent;

    DWORD                   TotalFrames;
    DWORD                   CurrentFrameNumber;
    BYTE                    CurrentPercentDone;
    BYTE                    ReportedPercentDone;

    EXPERTFRAMEDESCRIPTOR   FrameDescriptor;

    // -----------------------------------------------------------------------
    // Zero out all of our stack data structures
    memset( &Status, 0, sizeof(EXPERTSTATUS) );
    memset( &FilterObj, 0, sizeof(FILTEROBJECT) );
    memset( &FrameDescriptor, 0, sizeof(EXPERTFRAMEDESCRIPTOR) );

    // -----------------------------------------------------------------------
    // Set up our status structure and tell the world that we are initializing
    Status.Frame       = 0;
    Status.PercentDone = 0;
    Status.Status      = EXPERTSTATUS_STARTING;
    Status.SubStatus   = 0;
    LoadString(g_hInstance, IDS_INITIALIZING, Status.szStatusText, MAX_PATH);
    rc = ExpertIndicateStatus(hExpertKey,
                              Status.Status,
                              Status.SubStatus,
                              Status.szStatusText,
                              Status.PercentDone);
    if( rc == NMERR_EXPERT_TERMINATE )
    {
        // we have been asked to terminate
        return TRUE;
    }
    else if( rc != NMERR_SUCCESS )
    {
        // something bad happened
        return FALSE;
    }

    // -----------------------------------------------------------------------
    // prefill the event
    // TODO: the 2s below should be mondified to reflect the desired event
    // TODO: this code needs to be copied for any extra types of events
    pEvent = (PNMEVENTDATA)ExpertAllocMemory( hExpertKey,
                                              sizeof(NMEVENTDATA) +
                                              2 * sizeof(NMCOLUMNINFO),
                                              &rc);
    if( pEvent == NULL )
    {
        LoadString(g_hInstance, IDS_CANTALLOCMEM, g_StatusString, MAX_PATH);
        ExpertIndicateStatus( hExpertKey,
                              EXPERTSTATUS_PROBLEM,
                              0,
                              g_StatusString,
                              0);
        return FALSE;
    }

    pEvent->Version      = 0;
    pEvent->EventIdent   = 1;
    pEvent->Flags        = NMEVENTFLAG_DO_NOT_DISPLAY_MACHINE;
    pEvent->Severity     = NMEVENT_SEVERITY_INFORMATIONAL;
    pEvent->NumColumns   = 2;
    memset( &(pEvent->SysTime), 0, sizeof(SYSTEMTIME));
    pEvent->Justification= g_Justification;
    LoadString(g_hInstance, IDS_EXPERTNAME, g_ExpertName, MAX_PATH);
    pEvent->szSourceName = g_ExpertName;
    LoadString(g_hInstance, IDS_EVENTNAME, g_EventName, MAX_PATH);
    pEvent->szEventName  = g_EventName;
//    pEvent->szUrl        = NULL;
    pEvent->szDescription= NULL;
    pEvent->szMachine    = NULL;

    LoadString(g_hInstance, IDS_COLZERO, g_Col0Name, MAX_PATH);
    pEvent->Column[0].szColumnName = g_Col0Name;
    pEvent->Column[0].VariantData.Type = NMCOLUMNTYPE_IPADDR;
    LoadString(g_hInstance, IDS_COLONE, g_Col1Name, MAX_PATH);
    pEvent->Column[1].szColumnName = g_Col1Name;
    pEvent->Column[1].VariantData.Type = NMCOLUMNTYPE_IPADDR;

    // ------------------------------------------------------------------------
    // create a filter which will only find frames which we are interested in
    hFilter = CreateFilter();
    if( hFilter == NULL )
    {
        // can't make filter
        LoadString(g_hInstance, IDS_CANTCREATEFILTER, g_StatusString, MAX_PATH);
        ExpertIndicateStatus( hExpertKey,
                              EXPERTSTATUS_PROBLEM,
                              0,
                              g_StatusString,
                              0);
        return FALSE;
    }

    // TODO: Fill the filter
    // This example returns only frames which contain TCP
    FilterObj.Action = FILTERACTION_PROTOCOLEXIST;
    FilterObj.hProtocol = GetProtocolFromName( "TCP" );
    rc = FilterAddObject( hFilter, &FilterObj);
    if( rc != NMERR_SUCCESS )
    {
        // can't add to the filter
        LoadString(g_hInstance, IDS_CANTADDTOFILTER, g_StatusString, MAX_PATH);
        ExpertIndicateStatus( hExpertKey,
                              EXPERTSTATUS_PROBLEM,
                              0,
                              g_StatusString,
                              0);
        DestroyFilter( hFilter);
        return FALSE;
    }

    // -----------------------------------------------------------------------
    // send the first status message which will indicate that we are now running
    rc = ExpertIndicateStatus( hExpertKey,
                               EXPERTSTATUS_RUNNING,
                               0,
                               "",
                               0);
    if( rc == NMERR_EXPERT_TERMINATE )
    {
        // we were terminated
        DestroyFilter( hFilter );
        return FALSE;
    }

    // -----------------------------------------------------------------------
    // the main loop
    TotalFrames = GetCaptureTotalFrames( pStartupInfo->hCapture);
    CurrentFrameNumber = -1;
    do
    {
        // get the next frame which passes both the user's filter and ours
        rc = ExpertGetFrame( hExpertKey,
                             GET_FRAME_NEXT_FORWARD,
                             ( FLAGS_DEFER_TO_UI_FILTER |
                               FLAGS_ATTACH_PROPERTIES ),
                             CurrentFrameNumber,
                             hFilter,
                             &FrameDescriptor);
        if( rc == NMERR_EXPERT_TERMINATE )
        {
            // we were terminated
            DestroyFilter( hFilter );
            return FALSE;
        }
        if( rc != NMERR_SUCCESS )
        {
            // we failed to get a frame, break out of the loop
            break;
        }

        // got a frame, which one?
        CurrentFrameNumber = FrameDescriptor.FrameNumber;

        // update our status if we need to
        CurrentPercentDone = (BYTE)((CurrentFrameNumber*100)
                                         /TotalFrames);
        if( CurrentPercentDone > ReportedPercentDone )
        {
            // new number
            rc = ExpertIndicateStatus( hExpertKey,
                                         EXPERTSTATUS_RUNNING,
                                         0,
                                         "",
                                         CurrentPercentDone);
            ReportedPercentDone = CurrentPercentDone;
            if( rc == NMERR_EXPERT_TERMINATE )
            {
                // we were terminated
                DestroyFilter( hFilter );
                return FALSE;
            }
        }

        // TODO: This is were the expert actually uses the frame
        // returned by either sending an event or recording information
        // for a summary type event later.

    } while( rc == NMERR_SUCCESS );

    // -----------------------------------------------------------------------
    // TODO: submit summary type events here

    // -----------------------------------------------------------------------
    // we are done
    DestroyFilter( hFilter );
    return rc;
}

Variable Documentation

char g_Col0Name[MAX_PATH]

Definition at line 22 of file blrplate.cpp.

char g_Col1Name[MAX_PATH]

Definition at line 23 of file blrplate.cpp.

char g_EventName[MAX_PATH]

Definition at line 25 of file blrplate.cpp.

char g_ExpertName[MAX_PATH]

Definition at line 24 of file blrplate.cpp.

HINSTANCE g_hInstance

Definition at line 19 of file blrplate.cpp.

char g_Justification[MAX_PATH]

Definition at line 26 of file blrplate.cpp.

char g_StatusString[MAX_PATH]

Definition at line 21 of file blrplate.cpp.

Generated on Wed Nov 13 2024 16:53:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/NetMon/experts/blrplate/blrplate.h File Reference

  • NetDS
  • NetMon
  • experts
  • blrplate
Classes | Typedefs | Functions | Variables

blrplate.h File Reference

#include <windows.h>
#include <netmon.h>

Go to the source code of this file.

Classes

struct | _BLRPLATECONFIG

Typedefs

typedef struct _BLRPLATECONFIG | BLRPLATECONFIG
typedef BLRPLATECONFIG * | PBLRPLATECONFIG

Functions

BOOL | ConfigBLRPLATEDlg_Do (HWND hwnd, PBLRPLATECONFIG *ppBLRPLATEConfig, HEXPERTKEY hExpertKey)
BOOL WINAPI | Configure (HEXPERTKEY hExpertKey, PEXPERTCONFIG *ppConfig, PEXPERTSTARTUPINFO pStartupInfo, DWORD StartupFlags, HWND hWnd)
BOOL WINAPI | DllMain (HINSTANCE hInstance, ULONG ulReason, LPVOID pvReserved)
BOOL WINAPI | Register (PEXPERTENUMINFO lpExpertInfo)
BOOL WINAPI | Run (HEXPERTKEY hExpertKey, PEXPERTCONFIG lpConfig, HWND hwnd)

Variables

HINSTANCE | g_hInstance
char | g_StatusString []

Typedef Documentation

typedef struct _BLRPLATECONFIG BLRPLATECONFIG
typedef BLRPLATECONFIG* PBLRPLATECONFIG

Definition at line 37 of file blrplate.h.

Function Documentation

BOOL ConfigBLRPLATEDlg_Do | ( | HWND | hwnd,
 |  | PBLRPLATECONFIG * | ppBLRPLATEConfig,
 |  | HEXPERTKEY | hExpertKey
 | ) |  |

Definition at line 38 of file config.cpp.

{
    // save the current struture
    g_hExpertKey = hExpertKey;
    g_ppBLRPLATEConfig = ppBLRPLATEConfig;

    // create the dialog box...
    return DialogBox( g_hInstance,
                      MAKEINTRESOURCE(IDD_BLRPLATE_CONFIG_DIALOG),
                      hwnd,
                      (DLGPROC)ConfigBLRPLATEDlg_DlgProc);
}

BOOL WINAPI Configure | ( | HEXPERTKEY | hExpertKey,
 |  | PEXPERTCONFIG * | ppConfig,
 |  | PEXPERTSTARTUPINFO | pStartupInfo,
 |  | DWORD | StartupFlags,
 |  | HWND | hWnd
 | ) |  |

Definition at line 65 of file blrplate.cpp.

{
    // is the startup info from a right mouse click?
    if( (pStartupInfo == NULL) &&
        (StartupFlags & EXPERT_STARTUP_FLAG_USE_STARTUP_DATA_OVER_CONFIG_DATA) )
    {
        // The user started this expert by right mouse clicking...

        // TODO: pull the relevant data out of the pStartupInfo
        // and put it in the (possibly resized) ppConfig
    }

    // call the dialog
    return ConfigBLRPLATEDlg_Do(hWnd,
                                (PBLRPLATECONFIG *)ppConfig,
                                hExpertKey);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | ULONG | ulReason,
 |  | LPVOID | pvReserved
 | ) |  |

Definition at line 32 of file blrplate.cpp.

{
    switch( ulReason )
    {
        case DLL_PROCESS_ATTACH:
            g_hInstance = hInstance;
            break;

        case DLL_PROCESS_DETACH:
            break;
    }
    return TRUE;
}

BOOL WINAPI Register ( PEXPERTENUMINFO lpExpertInfo )

Definition at line 49 of file blrplate.cpp.

{
    // fill in the expert info data structure
    // TODO: Choose the proper flags
    lpExpertInfo->Flags = EXPERT_ENUM_FLAG_VIEWER_PRIVATE |
                          EXPERT_ENUM_FLAG_CONFIGURABLE;
    lpExpertInfo->Version = 1;
    LoadString( g_hInstance, IDS_EXPERTNAME, lpExpertInfo->szName, MAX_PATH);
    LoadString( g_hInstance, IDS_COMMENT, lpExpertInfo->szDescription, MAX_PATH);
    LoadString( g_hInstance, IDS_AUTHOR, lpExpertInfo->szVendor, MAX_PATH);
    return TRUE;
}

BOOL WINAPI Run | ( | HEXPERTKEY | hExpertKey,
 |  | PEXPERTCONFIG | lpConfig,
 |  | HWND | hwnd
 | ) |  |

Variable Documentation

HINSTANCE g_hInstance

Definition at line 104 of file SServer.Cpp.

char g_StatusString[]

Definition at line 21 of file blrplate.cpp.

Generated on Wed Nov 13 2024 16:53:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/NetMon/experts/blrplate/config.cpp File Reference

  • NetDS
  • NetMon
  • experts
  • blrplate
Defines | Functions | Variables

config.cpp File Reference

#include <windows.h>
#include <windowsx.h>
#include <netmon.h>
#include "Resrc1.h"
#include "BLRPLATE.h"

Go to the source code of this file.

Defines

#define | STRICT 1

Functions

BOOL CALLBACK | ConfigBLRPLATEDlg_DlgProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
BOOL | ConfigBLRPLATEDlg_Do (HWND hwnd, PBLRPLATECONFIG *ppBLRPLATEConfig, HEXPERTKEY hExpertKey)
void | ConfigBLRPLATEDlg_OnCancelButton (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
void | ConfigBLRPLATEDlg_OnCommand (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
void | ConfigBLRPLATEDlg_OnHelpButton (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
BOOL | ConfigBLRPLATEDlg_OnInitDialog (HWND hwnd, HWND hwndFocus, LPARAM lParam)
void | ConfigBLRPLATEDlg_OnOKButton (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)

Variables

HEXPERTKEY | g_hExpertKey
PBLRPLATECONFIG * g_ppBLRPLATEConfig

Define Documentation

#define STRICT 1

Definition at line 12 of file config.cpp.

Function Documentation

BOOL CALLBACK ConfigBLRPLATEDlg_DlgProc | ( | HWND | hwnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 55 of file config.cpp.

{
    switch (msg)
    {
        HANDLE_MSG(hwnd, WM_INITDIALOG, ConfigBLRPLATEDlg_OnInitDialog);
        HANDLE_MSG(hwnd, WM_COMMAND,    ConfigBLRPLATEDlg_OnCommand);

        // this makes the F1 key act like the Help key
        case WM_HELP:
            ConfigBLRPLATEDlg_OnHelpButton(hwnd, IDM_HELP, NULL, 0);
            break;
    }
    return(FALSE);
}

BOOL ConfigBLRPLATEDlg_Do | ( | HWND | hwnd,
 |  | PBLRPLATECONFIG * | ppBLRPLATEConfig,
 |  | HEXPERTKEY | hExpertKey
 | ) |  |

Definition at line 38 of file config.cpp.

{
    // save the current struture
    g_hExpertKey = hExpertKey;
    g_ppBLRPLATEConfig = ppBLRPLATEConfig;

    // create the dialog box...
    return DialogBox( g_hInstance,
                      MAKEINTRESOURCE(IDD_BLRPLATE_CONFIG_DIALOG),
                      hwnd,
                      (DLGPROC)ConfigBLRPLATEDlg_DlgProc);
}

void ConfigBLRPLATEDlg_OnCancelButton | ( | HWND | hwnd,
 |  | int | id,
 |  | HWND | hwndCtl,
 |  | UINT | codeNotify
 | ) |  |

Definition at line 156 of file config.cpp.

{
    // TODO: Release any memory that you have allocated

    // we are done
    EndDialog(hwnd, FALSE);
}

void ConfigBLRPLATEDlg_OnCommand | ( | HWND | hwnd,
 |  | int | id,
 |  | HWND | hwndCtl,
 |  | UINT | codeNotify
 | ) |  |

Definition at line 81 of file config.cpp.

{
    switch(id)
    {
        // OK Button has been hit...
        case IDOK:
            ConfigBLRPLATEDlg_OnOKButton(hwnd, id, hwndCtl, codeNotify);
            break;

        // Cancel button has been hit
        case IDCANCEL:
            ConfigBLRPLATEDlg_OnCancelButton(hwnd, id, hwndCtl, codeNotify);
            break;

        case IDM_HELP:
            ConfigBLRPLATEDlg_OnHelpButton(hwnd, id, hwndCtl, codeNotify);
            break;
    }
}

void ConfigBLRPLATEDlg_OnHelpButton | ( | HWND | hwnd,
 |  | int | id,
 |  | HWND | hwndCtl,
 |  | UINT | codeNotify
 | ) |  |

Definition at line 166 of file config.cpp.

{
    // TODO: bring up help
}

BOOL ConfigBLRPLATEDlg_OnInitDialog | ( | HWND | hwnd,
 |  | HWND | hwndFocus,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 72 of file config.cpp.

{
    // TODO: Add initialization code

    return TRUE;
}

void ConfigBLRPLATEDlg_OnOKButton | ( | HWND | hwnd,
 |  | int | id,
 |  | HWND | hwndCtl,
 |  | UINT | codeNotify
 | ) |  |

Definition at line 103 of file config.cpp.

{
    DWORD BufferSize;
    DWORD rc;

    // TODO: Validate dialog contents ----------------------------------------
    BufferSize = 1;

    // TODO: Size the buffer -------------------------------------------------
    // do we have a config buffer?
    if( *g_ppBLRPLATEConfig == NULL )
    {
        // no, allocate one
        *g_ppBLRPLATEConfig = (PBLRPLATECONFIG)ExpertAllocMemory(
                                    g_hExpertKey,
                                    BufferSize,
                                    &rc);
        if( *g_ppBLRPLATEConfig == NULL )
        {
            return;
        }
    }
    else
    {
        // is the given buffer big enough
        if( (*g_ppBLRPLATEConfig)->nTotalLength < BufferSize )
        {
            PBLRPLATECONFIG TempConfig;

            // no, we must grow it
            TempConfig = (PBLRPLATECONFIG)ExpertReallocMemory(
                                    g_hExpertKey,
                                    *g_ppBLRPLATEConfig,
                                    BufferSize,
                                    &rc);
            if( TempConfig == NULL )
            {
                return;
            }

            // it worked
            *g_ppBLRPLATEConfig = TempConfig;
        }
    }

    // TODO: Fill in the Config ----------------------------------------------

    // we are done
    EndDialog(hwnd, TRUE);
}

Variable Documentation

HEXPERTKEY g_hExpertKey

Definition at line 22 of file config.cpp.

PBLRPLATECONFIG* g_ppBLRPLATEConfig

Definition at line 23 of file config.cpp.

Generated on Wed Nov 13 2024 16:53:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/NetMon/experts/blrplate/resrc1.h File Reference

  • NetDS
  • NetMon
  • experts
  • blrplate
Defines

resrc1.h File Reference

Go to the source code of this file.

Defines

#define | IDD_BLRPLATE_CONFIG_DIALOG 110
#define | IDM_HELP 111
#define | IDS_AUTHOR 202
#define | IDS_CANTADDTOFILTER 212
#define | IDS_CANTALLOCMEM 210
#define | IDS_CANTCREATEFILTER 211
#define | IDS_COLONE 207
#define | IDS_COLZERO 206
#define | IDS_COMMENT 201
#define | IDS_DESCRIPTION 204
#define | IDS_EVENTNAME 203
#define | IDS_EXPERTNAME 200
#define | IDS_INITIALIZING 209
#define | IDS_JUSTIFICATION_FORMAT 208
#define | IDS_MACHINE 205

Define Documentation

#define IDD_BLRPLATE_CONFIG_DIALOG 110

Definition at line 5 of file resrc1.h.

#define IDM_HELP 111

Definition at line 6 of file resrc1.h.

#define IDS_AUTHOR 202

Definition at line 9 of file resrc1.h.

#define IDS_CANTADDTOFILTER 212

Definition at line 19 of file resrc1.h.

#define IDS_CANTALLOCMEM 210

Definition at line 17 of file resrc1.h.

#define IDS_CANTCREATEFILTER 211

Definition at line 18 of file resrc1.h.

#define IDS_COLONE 207

Definition at line 14 of file resrc1.h.

#define IDS_COLZERO 206

Definition at line 13 of file resrc1.h.

#define IDS_COMMENT 201

Definition at line 8 of file resrc1.h.

#define IDS_DESCRIPTION 204

Definition at line 11 of file resrc1.h.

#define IDS_EVENTNAME 203

Definition at line 10 of file resrc1.h.

#define IDS_EXPERTNAME 200

Definition at line 7 of file resrc1.h.

#define IDS_INITIALIZING 209

Definition at line 16 of file resrc1.h.

#define IDS_JUSTIFICATION_FORMAT 208

Definition at line 15 of file resrc1.h.

#define IDS_MACHINE 205

Definition at line 12 of file resrc1.h.

Generated on Wed Nov 13 2024 16:53:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/NetMon/parsers/blrplate/blrplate.c File Reference

  • NetDS
  • NetMon
  • parsers
  • blrplate
Functions | Variables

blrplate.c File Reference

#include "BLRPLATE.h"

Go to the source code of this file.

Functions

LPBYTE WINAPI | BLRPLATE_AttachProperties (HFRAME hFrame, LPBYTE pMacFrame, LPBYTE pBLRPLATEFrame, DWORD MacType, DWORD BytesLeft, HPROTOCOL hPrevProtocol, DWORD nPrevProtOffset, DWORD InstData)
VOID WINAPI | BLRPLATE_Deregister (HPROTOCOL hBLRPLATE)
DWORD WINAPI | BLRPLATE_FormatProperties (HFRAME hFrame, LPBYTE pMacFrame, LPBYTE pBLRPLATEFrame, DWORD nPropertyInsts, LPPROPERTYINST p)
VOID WINAPIV | BLRPLATE_FormatSummary (LPPROPERTYINST pPropertyInst)
LPBYTE WINAPI | BLRPLATE_RecognizeFrame (HFRAME hFrame, LPBYTE pMacFrame, LPBYTE pBLRPLATEFrame, DWORD MacType, DWORD BytesLeft, HPROTOCOL hPrevProtocol, DWORD nPrevProtOffset, LPDWORD pProtocolStatus, LPHPROTOCOL phNextProtocol, LPDWORD InstData)
VOID WINAPI | BLRPLATE_Register (HPROTOCOL hBLRPLATE)
BOOL WINAPI | DllMain (HANDLE hInstance, ULONG Command, LPVOID Reserved)
PPF_PARSERDLLINFO WINAPI | ParserAutoInstallInfo ()

Variables

DWORD | Attached = 0
ENTRYPOINTS | BLRPLATEEntryPoints
LABELED_BIT | BLRPLATEFlags []
SET | BLRPLATEFlagsSET
LABELED_WORD | BLRPLATEOpCodes []
SET | BLRPLATEOpCodesSET
PROPERTYINFO | BLRPLATEPropertyTable []
HPROTOCOL | hBLRPLATE = NULL
DWORD | nNumBLRPLATEProps = (sizeof(BLRPLATEPropertyTable)/sizeof(PROPERTYINFO))

Function Documentation

LPBYTE BHAPI BLRPLATE_AttachProperties | ( | HFRAME | hFrame,
 |  | LPBYTE | pMacFrame,
 |  | LPBYTE | pBLRPLATEFrame,
 |  | DWORD | MacType,
 |  | DWORD | BytesLeft,
 |  | HPROTOCOL | hPrevProtocol,
 |  | DWORD | nPrevProtOffset,
 |  | DWORD | InstData
 | ) |  |

Definition at line 385 of file blrplate.c.

{
    // apply the header overlay in order to decode the protocol
    PBLRPLATEHDR pBLRPLATEHdr = (PBLRPLATEHDR)pBLRPLATEFrame;

    //
    // Attach Properties...
    //

    // summary line
    AttachPropertyInstance( hFrame,
                            BLRPLATEPropertyTable[BLRPLATE_SUMMARY].hProperty,
                            (WORD)BytesLeft,
                            (LPBYTE)pBLRPLATEFrame,
                            0, 0, 0);

    // signature
    AttachPropertyInstance( hFrame,
                            BLRPLATEPropertyTable[BLRPLATE_SIGNATURE].hProperty,
                            sizeof(DWORD),
                            &(pBLRPLATEHdr->Signature),
                            0, 1, 0);

    // opcode
    AttachPropertyInstance( hFrame,
                            BLRPLATEPropertyTable[BLRPLATE_OPCODE].hProperty,
                            sizeof(WORD),
                            &(pBLRPLATEHdr->Opcode),
                            0, 1, 0);

    // flags summary
    AttachPropertyInstance( hFrame,
                            BLRPLATEPropertyTable[BLRPLATE_FLAGS_SUMMARY].hProperty,
                            sizeof(BYTE),
                            &(pBLRPLATEHdr->Flags),
                            0, 1, 0);

    // flags decode
    AttachPropertyInstance( hFrame,
                            BLRPLATEPropertyTable[BLRPLATE_FLAGS_FLAGS].hProperty,
                            sizeof(BYTE),
                            &(pBLRPLATEHdr->Flags),
                            0, 2, 0);

    return NULL;
}

VOID WINAPI BLRPLATE_Deregister ( HPROTOCOL hBLRPLATE )

Definition at line 340 of file blrplate.c.

{
    // tell the kernel that it may now free our database
    DestroyPropertyDatabase( hBLRPLATE);
}

DWORD BHAPI BLRPLATE_FormatProperties | ( | HFRAME | hFrame,
 |  | LPBYTE | pMacFrame,
 |  | LPBYTE | pBLRPLATEFrame,
 |  | DWORD | nPropertyInsts,
 |  | LPPROPERTYINST | p
 | ) |  |

Definition at line 450 of file blrplate.c.

{
    // loop through the property instances
    while( nPropertyInsts-- > 0)
    {
        // and call the formatter for each
        ( (FORMAT)(p->lpPropertyInfo->InstanceData) )( p);
        p++;
    }

    return NMERR_SUCCESS;
}

VOID WINAPIV BLRPLATE_FormatSummary ( LPPROPERTYINST pPropertyInst )

Definition at line 477 of file blrplate.c.

{
    LPBYTE       pReturnedString = pPropertyInst->szPropertyText;
    PBLRPLATEHDR pBLRPLATE = (PBLRPLATEHDR)(pPropertyInst->lpData);
    char*        szTempString;

    // fetch the Opcode name
    szTempString = LookupWordSetString( &BLRPLATEOpCodesSET,
                                        pBLRPLATE->Opcode );
    if( szTempString == NULL )
    {
        szTempString = "Unknown";
    }

    // print "Opcode: <Opcode Name> (<Opcode number>)"
    wsprintf ( pReturnedString,
               "Opcode: %s (%d)",
               szTempString,
               pBLRPLATE->Opcode);
}

LPBYTE BHAPI BLRPLATE_RecognizeFrame | ( | HFRAME | hFrame,
 |  | LPBYTE | pMacFrame,
 |  | LPBYTE | pBLRPLATEFrame,
 |  | DWORD | MacType,
 |  | DWORD | BytesLeft,
 |  | HPROTOCOL | hPrevProtocol,
 |  | DWORD | nPrevProtOffset,
 |  | LPDWORD | pProtocolStatus,
 |  | LPHPROTOCOL | phNextProtocol,
 |  | LPDWORD | InstData
 | ) |  |

Definition at line 358 of file blrplate.c.

{
    // For now, just assume that if we got called,
    // then the packet does contain us and we go to the end of the frame
    *pProtocolStatus = PROTOCOL_STATUS_CLAIMED;
    return NULL;
}

void BHAPI BLRPLATE_Register ( HPROTOCOL hBLRPLATE )

Definition at line 316 of file blrplate.c.

{
    WORD  i;

    // tell the kernel to make reserve some space for our property table
    CreatePropertyDatabase( hBLRPLATE, nNumBLRPLATEProps);

    // add our properties to the kernel's database
    for( i = 0; i < nNumBLRPLATEProps; i++)
    {
        AddProperty( hBLRPLATE, &BLRPLATEPropertyTable[i]);
    }
}

BOOL WINAPI DllMain | ( | HANDLE | hInstance,
 |  | ULONG | Command,
 |  | LPVOID | Reserved
 | ) |  |

Definition at line 273 of file blrplate.c.

{

    // what type of call is this
    switch( Command )
    {
        case DLL_PROCESS_ATTACH:
            // are we loading for the first time?
            if( Attached == 0 )
            {
                // the first time in we need to tell the kernel
                // about ourselves
                hBLRPLATE = CreateProtocol( "BLRPLATE",
                                            &BLRPLATEEntryPoints,
                                            ENTRYPOINTS_SIZE);
            }
            Attached++;
            break;

        case DLL_PROCESS_DETACH:
            // are we detaching our last instance?
            Attached--;
            if( Attached == 0 )
            {
                // last guy out needs to clean up
                DestroyProtocol( hBLRPLATE);
            }
            break;
    }

    // Netmon parsers ALWAYS return TRUE.
    return TRUE;
}

PPF_PARSERDLLINFO WINAPI ParserAutoInstallInfo ( )

Definition at line 169 of file blrplate.c.

{
    PPF_PARSERDLLINFO pParserDllInfo;
    PPF_PARSERINFO    pParserInfo;
    DWORD NumProtocols;
    /*
    DWORD NumHandoffs;
    PPF_HANDOFFSET    pHandoffSet;
    PPF_HANDOFFENTRY  pHandoffEntry;
    */

    /*
    DWORD NumFollows;
    PPF_FOLLOWSET     pFollowSet;
    PPF_FOLLOWENTRY   pFollowEntry;
    */

    // Base structure ========================================================

    // Allocate memory for parser info:
    NumProtocols = 1;
    pParserDllInfo = (PPF_PARSERDLLINFO)HeapAlloc( GetProcessHeap(),
                                                   HEAP_ZERO_MEMORY,
                                                   sizeof( PF_PARSERDLLINFO ) +
                                                   NumProtocols * sizeof( PF_PARSERINFO) );
    if( pParserDllInfo == NULL)
    {
        return NULL;
    }

    // fill in the parser DLL info
    pParserDllInfo->nParsers = NumProtocols;

    // fill in the individual parser infos...

    // BLRPLATE ==============================================================
    pParserInfo = &(pParserDllInfo->ParserInfo[0]);
    wsprintf( pParserInfo->szProtocolName, "BLRPLATE" );
    wsprintf( pParserInfo->szComment,      "Boilerplate Protocol" );
    wsprintf( pParserInfo->szHelpFile,     "");

    /*
    // the incoming handoff set ----------------------------------------------
    // allocate
    NumHandoffs = 1;
    pHandoffSet = (PPF_HANDOFFSET)HeapAlloc( GetProcessHeap(),
                                             HEAP_ZERO_MEMORY,
                                             sizeof( PF_HANDOFFSET ) +
                                             NumHandoffs * sizeof( PF_HANDOFFENTRY) );
    if( pHandoffSet == NULL )
    {
        // just return early
        return pParserDllInfo;
    }

    // fill in the incoming handoff set
    pParserInfo->pWhoHandsOffToMe = pHandoffSet;
    pHandoffSet->nEntries = NumHandoffs;

    // TCP PORT FFFF
    pHandoffEntry = &(pHandoffSet->Entry[0]);
    wsprintf( pHandoffEntry->szIniFile,    "TCPIP.INI" );
    wsprintf( pHandoffEntry->szIniSection, "TCP_HandoffSet" );
    wsprintf( pHandoffEntry->szProtocol,   "BLRPLATE" );
    pHandoffEntry->dwHandOffValue =        0xFFFF;
    pHandoffEntry->ValueFormatBase =       HANDOFF_VALUE_FORMAT_BASE_DECIMAL;
    */

    /*
    // the outgoing follow set -----------------------------------------------
    // allocate
    NumFollows = 1;
    pFollowSet = (PPF_FOLLOWSET)HeapAlloc( GetProcessHeap(),
                                           HEAP_ZERO_MEMORY,
                                           sizeof( PF_FOLLOWSET ) +
                                           NumFollows * sizeof( PF_FOLLOWENTRY) );
    if( pFollowSet == NULL )
    {
        // just return early
        return pParserDllInfo;
    }

    // fill in the outgoing follow set
    pParserInfo->pWhoCanFollowMe = pFollowSet;
    pFollowSet->nEntries = NumFollows;

    // SMB
    pFollowEntry = &(pFollowSet->Entry[0]);
    wsprintf( pFollowEntry->szProtocol,   "SMB" );
    */

    return pParserDllInfo;
}

Variable Documentation

DWORD Attached = 0

Definition at line 18 of file blrplate.c.

ENTRYPOINTS BLRPLATEEntryPoints
Initial value:
{

    BLRPLATE_Register,
    BLRPLATE_Deregister,
    BLRPLATE_RecognizeFrame,
    BLRPLATE_AttachProperties,
    BLRPLATE_FormatProperties
}

Definition at line 50 of file blrplate.c.

LABELED_BIT BLRPLATEFlags[]
Initial value:
{

    {   0,
      "No aardvarks",
      "Aardvarks welcome",
    },

    {   1,
      "Batteries not included",
      "Batteries included",
    },

    {   4,
      "Not a subsidiary of ACME Spaceworks",
      "ACME Spaceworks subsidiary",
    },

}

Definition at line 74 of file blrplate.c.

SET BLRPLATEFlagsSET
Initial value:
 {sizeof(BLRPLATEFlags)/sizeof(LABELED_BIT),
                        BLRPLATEFlags}

Definition at line 95 of file blrplate.c.

LABELED_WORD BLRPLATEOpCodes[]
Initial value:

{
    { 1, "Premiere" },
    { 2, "Secondary" },
}

Definition at line 64 of file blrplate.c.

SET BLRPLATEOpCodesSET
Initial value:
 {(sizeof(BLRPLATEOpCodes)/sizeof(LABELED_WORD)),
                          BLRPLATEOpCodes }

Definition at line 69 of file blrplate.c.

PROPERTYINFO BLRPLATEPropertyTable[]

Definition at line 101 of file blrplate.c.

HPROTOCOL hBLRPLATE = NULL

Definition at line 17 of file blrplate.c.

DWORD nNumBLRPLATEProps = (sizeof(BLRPLATEPropertyTable)/sizeof(PROPERTYINFO))

Definition at line 160 of file blrplate.c.

Generated on Wed Nov 13 2024 16:53:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/NetMon/parsers/blrplate/blrplate.h File Reference

  • NetDS
  • NetMon
  • parsers
  • blrplate
Classes | Typedefs | Enumerations

blrplate.h File Reference

#include <windows.h>
#include <netmon.h>
#include <stdlib.h>
#include <string.h>

Go to the source code of this file.

Classes

struct | _BLRPLATE

Typedefs

typedef struct _BLRPLATE | BLRPLATEHDR
typedef BLRPLATEHDR UNALIGNED * | PBLRPLATEHDR

Enumerations

enum {
BLRPLATE_SUMMARY = 0, BLRPLATE_SIGNATURE, BLRPLATE_OPCODE, BLRPLATE_FLAGS_SUMMARY,
BLRPLATE_FLAGS_FLAGS
}

Typedef Documentation

typedef struct _BLRPLATE BLRPLATEHDR
typedef BLRPLATEHDR UNALIGNED* PBLRPLATEHDR

Definition at line 30 of file blrplate.h.

Enumeration Type Documentation

anonymous enum
Enumerator:
BLRPLATE_SUMMARY
BLRPLATE_SIGNATURE
BLRPLATE_OPCODE
BLRPLATE_FLAGS_SUMMARY
BLRPLATE_FLAGS_FLAGS

Definition at line 34 of file blrplate.h.

{
    BLRPLATE_SUMMARY = 0,
    BLRPLATE_SIGNATURE,
    BLRPLATE_OPCODE,
    BLRPLATE_FLAGS_SUMMARY,
    BLRPLATE_FLAGS_FLAGS
};

Generated on Wed Nov 13 2024 16:53:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/netshell/nshsamp.cpp File Reference

  • NetDS
  • netshell
Defines | Functions | Variables

nshsamp.cpp File Reference

#include "nshsamp.h"

Go to the source code of this file.

Defines

#define | UNICODE

Functions

BOOL WINAPI | CheckRunningOnWhistler (IN UINT CIMOSType, IN UINT CIMOSProductSuite, IN LPCWSTR CIMOSVersion, IN LPCWSTR CIMOSBuildNumber, IN LPCWSTR CIMServicePackMajorVersion, IN LPCWSTR CIMServicePackMinorVersion, IN UINT CIMProcessorArchitecture, IN DWORD dwReserved)
DWORD WINAPI | CommitFn (IN DWORD dwAction)
DWORD WINAPI | ConnectFn (IN LPCWSTR pwszMachine)
DWORD WINAPI | GenericStopHelper (IN DWORD dwReserved)
DWORD WINAPI | InitHelperDll (IN DWORD dwNetshVersion, OUT PVOID pReserved)
DWORD WINAPI | StartHelpers (IN CONST GUID *pguidParent, IN DWORD dwVersion)

Variables

PSAMPLE_HELPER_DATA g_CurrentData = &g_OnlineData
HANDLE | g_hModule = 0
SAMPLE_HELPER_DATA | g_OfflineData = {0, 0, 0, 0, FALSE, 0, LOW}
SAMPLE_HELPER_DATA | g_OnlineData = {0, 0, 0, 0, FALSE, 0, LOW}
CMD_ENTRY | g_RandomCommands []
CMD_ENTRY | g_ResetObjects []
CMD_GROUP_ENTRY | g_Sample_Commands []
CMD_GROUP_ENTRY | g_SampleInterface_Commands []
CMD_ENTRY | g_ShowError []
CMD_ENTRY | g_TopLevelCommands []
CMD_ENTRY | g_TopLevelSubInterfaceCommands []

Define Documentation

#define UNICODE

Definition at line 17 of file nshsamp.cpp.

Function Documentation

BOOL WINAPI CheckRunningOnWhistler | ( | IN UINT | CIMOSType,
 |  | IN UINT | CIMOSProductSuite,
 |  | IN LPCWSTR | CIMOSVersion,
 |  | IN LPCWSTR | CIMOSBuildNumber,
 |  | IN LPCWSTR | CIMServicePackMajorVersion,
 |  | IN LPCWSTR | CIMServicePackMinorVersion,
 |  | IN UINT | CIMProcessorArchitecture,
 |  | IN DWORD | dwReserved
 | ) |  |

Definition at line 212 of file nshsamp.cpp.

{
    //
    // Leave this code in here so it can be uncommented and recompiled.
    // Its output can be kind of distracting if on by default, so it
    // was turned off.
    //
    /*
    PrintMessage(L"\n"
                 L"Entered CheckRunningOnWhistler.  Received arguments of \n"
                 L"Type %1!lu!\n"
                 L"ProductSuite %2!lu!\n"
                 L"Version %3!s!\n"
                 L"BuildNumber %4!s!\n"
                 L"ServicePackMajorVersion %5!s!\n"
                 L"ServicePackMinorVersion %6!s!\n"
                 L"ProcessorArchitecture %7!lu!\n",
                 CIMOSType,
                 CIMOSProductSuite,
                 CIMOSVersion,
                 CIMOSBuildNumber,
                 CIMServicePackMajorVersion,
                 CIMServicePackMinorVersion,
                 CIMProcessorArchitecture);
    */

    return TRUE;
}

DWORD WINAPI CommitFn ( IN DWORD dwAction )

Definition at line 119 of file nshsamp.cpp.

{
    //
    // The handling of this action is admittedly simple in this example.
    // We simply have two copies of the data that we persist and consider
    // one the "online" set of data and one the "offline" set of data.
    // However, since neither the offline nor online sets of data need to
    // be "applied" to anything, it makes the distinction between them
    // somewhat meaningless.  The scheme used to support online/offline modes
    // is generally left up to the developer.
    //
    switch (dwAction)
    {
        case NETSH_COMMIT:
            //
            // Change to commit mode, otherwise known as online.
            //
            g_CurrentData = &g_OnlineData;
            break;

        case NETSH_UNCOMMIT:
            //
            // Change to uncommit mode, meaning all our data goes
            // to our offlinedata buffer.
            //
            g_CurrentData = &g_OfflineData;
            break;

        case NETSH_FLUSH:
            //
            // Flush all uncommitted changes.  We'll do this by
            // overwriting whatever data is in g_OfflineData with
            // what is in g_OnlineData.
            //
            CopyMemory(&g_OfflineData, &g_OnlineData, sizeof(SAMPLE_HELPER_DATA));
            break;

        case NETSH_SAVE:
            //
            // Copy the memory from our offline struct to our
            // online one, then "apply" it.
            //
            CopyMemory(&g_OnlineData, &g_OfflineData, sizeof(SAMPLE_HELPER_DATA));
            g_CurrentData = &g_OnlineData;

            // SomeFunctionToApplyOurData(g_OnlineData);

            break;

        default:
            break;
    }
    return NO_ERROR;
}

DWORD WINAPI ConnectFn ( IN LPCWSTR pwszMachine )

Definition at line 176 of file nshsamp.cpp.

{
    //
    // This function is called whenever the machine name changes.
    // If the context this was called for (you can specify a connect
    // function on a per context basis, see RegisterContext) is
    // supposed to be remotable, then the helper should verify
    // connectivity to the machine specified by pwszMachine and
    // return an error if unable to reach the machine.
    //

    //
    // This is also where the helper might want to call RegisterContext
    // again on a context to remove or add commands at will.  This allows
    // the commands in your context to be dynamic, that is, commands
    // may be added and removed at will.  However, the versioning
    // functions tend to make a dynamic context unnecessary, as most
    // dynamic command changes are needed because of differing OS's the
    // commands are used on.  Note that NULL for pwszMachine indicates
    // that the machine to be connected to is the local machine.  When
    // and if the connect function returns an error code, the command
    // that was going to be executed (whether a context command or
    // entering a context) will fail.
    //

    //
    // Uncomment this line to see how often the Connect function is called
    // and what gets passed to it.
    //
    //PrintMessageFromModule(g_hModule, GEN_CONNECT_SHOWSTRING, pwszMachine);

    return NO_ERROR;
}

DWORD WINAPI GenericStopHelper ( IN DWORD dwReserved )

Definition at line 103 of file nshsamp.cpp.

{
    //
    // Here we would perform any work that needs to be done
    // when netsh exits and helpers are stopped.  This would
    // include things like closing open handles, freeing
    // allocated memory, etc.  Note that you can have
    // a different StopHelper function for each helper
    // you register. (The NS_HELPER_ATTRIBUTES.pfnStop param
    // of the call to RegisterHelper in InitHelper below.)
    //
    return NO_ERROR;
}

DWORD WINAPI InitHelperDll | ( | IN DWORD | dwNetshVersion,
 |  | OUT PVOID | pReserved
 | ) |  |

Definition at line 251 of file nshsamp.cpp.

{
    DWORD                   dwRet;
    NS_HELPER_ATTRIBUTES    MyAttributes;

    //
    // We could also implement a DllMain to get
    // this handle.
    //
    g_hModule = GetModuleHandle(L"nshsamp.dll");

    ZeroMemory(&MyAttributes, sizeof(MyAttributes));
    MyAttributes.dwVersion      = SAMPLE_HELPER_VERSION;

    //
    // This specifies the function netsh should call to
    // initialize the contexts for this helper.  We'll
    // use the same function for all the helpers, because
    // we can tell based on the pguidParent arg passed
    // to StartHelpers() which helper we need to register
    // contexts for.  If necessary, use a different start
    // function for each helper.  Just set the
    // MyAttributes.pfnStart parameter before each call
    // to RegisterHelper.
    //
    MyAttributes.pfnStart       = StartHelpers;

    //
    // We'll use a generic stop function for all helpers,
    // rather than one for each for simplicity.  One for
    // each is allowed, of course.
    //
    MyAttributes.pfnStop        = GenericStopHelper;

    //
    // Set the GUID of our helper.
    //
    MyAttributes.guidHelper     = g_ObjectGuid;

    //
    // Specify g_RootGuid as the parent helper to indicate
    // that any contexts registered by this helper will be top
    // level contexts.  Note that NULL as the parent GUID means
    // the same thing.
    //
    dwRet = RegisterHelper(&g_RootGuid, &MyAttributes);
    if (NO_ERROR == dwRet)
    {
        //
        // Set the GUID of our helper.
        //
        MyAttributes.guidHelper = g_SubContext;

        //
        // We want this helper's contexts to show up as children of
        // g_ObjectGuid's context(s), so we specify it as the parent
        // helper istead of g_RootGuid.
        //
        dwRet = RegisterHelper(&g_ObjectGuid, &MyAttributes);
        if (NO_ERROR == dwRet)
        {
            //
            // Set the GUID of our helper.
            //
            MyAttributes.guidHelper = g_SampleInterface;

            //
            // Again, we want this helper's contexts to show up as children of
            // ifmon.dll's 'interface' context, so we specify it here.  To
            // see a list of all helpers, contexts, and their associated
            // GUID's, type 'show helper' within netsh.
            //
            dwRet = RegisterHelper(&g_Interface, &MyAttributes);
        }
    }
    return dwRet;
}

DWORD WINAPI StartHelpers | ( | IN CONST GUID * | pguidParent,
 |  | IN DWORD | dwVersion
 | ) |  |

Definition at line 332 of file nshsamp.cpp.

{
    BOOL                    bFoundMatch = TRUE;
    DWORD                   dwRet = ERROR_INVALID_PARAMETER;
    NS_CONTEXT_ATTRIBUTES   ContextAttributes;

    ZeroMemory(&ContextAttributes, sizeof(ContextAttributes));

    ContextAttributes.dwVersion         = SAMPLE_HELPER_VERSION;

    if (IsEqualGUID(*pguidParent, g_RootGuid))
    {
        //
        // The parent is the netsh root GUID, and the only
        // helper we have that registers root contexts is
        // the 'object' helper, so set the relevant info.
        //
        ContextAttributes.dwFlags           = 0;
        //
        // This is the default, but we are specifying for clarity.
        //
        ContextAttributes.ulPriority        = DEFAULT_CONTEXT_PRIORITY;
        ContextAttributes.pwszContext       = TOKEN_SAMPLE;
        ContextAttributes.guidHelper        = g_ObjectGuid;
        ContextAttributes.ulNumTopCmds      = sizeof(g_TopLevelCommands)/sizeof(CMD_ENTRY);
        ContextAttributes.pTopCmds          = (CMD_ENTRY (*)[])g_TopLevelCommands;
        ContextAttributes.ulNumGroups       = sizeof(g_Sample_Commands)/sizeof(CMD_GROUP_ENTRY);
        ContextAttributes.pCmdGroups        = (CMD_GROUP_ENTRY (*)[])g_Sample_Commands;
        ContextAttributes.pfnCommitFn       = CommitFn;
        ContextAttributes.pfnConnectFn      = ConnectFn;
        ContextAttributes.pfnDumpFn         = DumpSample;
        //
        // Just like commands or groups, you can specify a version
        // checking function for contexts.
        //
        ContextAttributes.pfnOsVersionCheck = CheckRunningOnWhistler;
    }
    else if (IsEqualGUID(*pguidParent, g_ObjectGuid))
    {
        //
        // The only helper we have that registers under
        // g_ObjectGuid is the 'subcontext' helper.
        //
        ContextAttributes.dwFlags           = 0;

        //
        // This is the default, but we are specifying for clarity.
        //
        ContextAttributes.ulPriority        = DEFAULT_CONTEXT_PRIORITY;

        ContextAttributes.pwszContext       = TOKEN_SUBCONTEXT;
        ContextAttributes.guidHelper        = g_SubContext;
        ContextAttributes.ulNumTopCmds      = sizeof(g_ShowError)/sizeof(CMD_ENTRY);
        ContextAttributes.pTopCmds          = (CMD_ENTRY (*)[])g_ShowError;
        ContextAttributes.ulNumGroups       = 0;
        ContextAttributes.pCmdGroups        = NULL;
        ContextAttributes.pfnCommitFn       = CommitFn;
        ContextAttributes.pfnConnectFn      = ConnectFn;
        ContextAttributes.pfnOsVersionCheck = NULL;

        //
        // We're choosing to have no dump function.
        // (There isn't really anything to dump for a
        // function that just outputs error strings.)
        //
        ContextAttributes.pfnDumpFn         = NULL;
    }
    else if (IsEqualGUID(*pguidParent, g_Interface))
    {
        //
        // The only helper we have that registers under
        // g_Interface is the 'sampleinterface' helper.
        //

        //
        // Specifies that ulPriority should be paid attention.
        //
        ContextAttributes.dwFlags           = (DWORD)CMD_FLAG_PRIORITY;

        //
        // We change the priority of this so that its dump
        // function will be called before other dump functions.
        // UlPriority of 0 is the highest priority.  This can
        // be useful if some contexts require information
        // enumerated by a different context - for example
        // the 'interface' context has a ulPriority of 10 so
        // that other contexts can use the friendly names it
        // generates.  Those friendly names would otherwise
        // be inaccessible.  Note that the ulPriority of
        // this DumpFn is 0, so if you do a dump in the 'interface'
        // context, you would see this contexts dump info before
        // interface's dump information, even though this context
        // is located in a subhelper to 'interface'.
        //
        ContextAttributes.ulPriority        = 0;
        ContextAttributes.pwszContext       = TOKEN_SAMPLEINTERFACE;
        ContextAttributes.guidHelper        = g_SampleInterface;
        ContextAttributes.ulNumTopCmds      = sizeof(g_TopLevelSubInterfaceCommands)/sizeof(CMD_ENTRY);
        ContextAttributes.pTopCmds          = (CMD_ENTRY (*)[])g_TopLevelSubInterfaceCommands;
        ContextAttributes.ulNumGroups       = sizeof(g_SampleInterface_Commands)/sizeof(CMD_GROUP_ENTRY);
        ContextAttributes.pCmdGroups        = (CMD_GROUP_ENTRY (*)[])g_SampleInterface_Commands;
        ContextAttributes.pfnCommitFn       = CommitFn;
        ContextAttributes.pfnConnectFn      = ConnectFn;
        ContextAttributes.pfnDumpFn         = DumpSampleInterface;
        ContextAttributes.pfnOsVersionCheck = NULL;
    }
    else
    {
        //
        // If netsh passed us some parent guid that we
        // haven't heard of, error out.
        //
        bFoundMatch = FALSE;
    }

    if (bFoundMatch)
    {
        dwRet = RegisterContext(&ContextAttributes);
    }

    return dwRet;
}

Variable Documentation

PSAMPLE_HELPER_DATA g_CurrentData = &g_OnlineData
HANDLE g_hModule = 0

Definition at line 33 of file main.cpp.

SAMPLE_HELPER_DATA g_OfflineData = {0, 0, 0, 0, FALSE, 0, LOW}
SAMPLE_HELPER_DATA g_OnlineData = {0, 0, 0, 0, FALSE, 0, LOW}
CMD_ENTRY g_RandomCommands[]
Initial value:
{
    CREATE_CMD_ENTRY(SET_INTERFACE,             HandleSetInterfaceCommand),

}

Definition at line 65 of file nshsamp.cpp.

CMD_ENTRY g_ResetObjects[]
Initial value:
{
    CREATE_CMD_ENTRY(RESET_OBJECT_WIDGETS,      HandleResetWidgetCommand),
    CREATE_CMD_ENTRY(RESET_OBJECT_SPROCKETS,    HandleResetSprocketCommand),

}

Definition at line 53 of file nshsamp.cpp.

CMD_GROUP_ENTRY g_Sample_Commands[]
Initial value:
{

}

Definition at line 79 of file nshsamp.cpp.

CMD_GROUP_ENTRY g_SampleInterface_Commands[]
Initial value:
{

}

Definition at line 85 of file nshsamp.cpp.

CMD_ENTRY g_ShowError[]
Initial value:
{

}

Definition at line 60 of file nshsamp.cpp.

CMD_ENTRY g_TopLevelCommands[]
Initial value:
{
    CREATE_CMD_ENTRY(SHOW_OBJECT, HandleShowObjectCommand),

    CREATE_CMD_ENTRY_EX_VER(ADD_OBJECT, HandleAddObjectCommand, CMD_FLAG_ONLINE, CheckRunningOnWhistler),

}

Definition at line 34 of file nshsamp.cpp.

CMD_ENTRY g_TopLevelSubInterfaceCommands[]
Initial value:
{

}

Definition at line 71 of file nshsamp.cpp.

Generated on Wed Nov 13 2024 16:53:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/netshell/nshsamp.h File Reference

  • NetDS
  • netshell
Classes | Defines | Typedefs | Enumerations | Functions | Variables

nshsamp.h File Reference

#include <windows.h>
#include <guiddef.h>
#include <netsh.h>
#include <stdlib.h>

Go to the source code of this file.

Classes

struct | _SAMPLE_HELPER_DATA_

Defines

#define | ALL 2
#define | CMD_ADD_OBJECT TOKEN_ADD
#define | CMD_RESET_OBJECT TOKEN_RESET
#define | CMD_RESET_OBJECT_ALL TOKEN_ALL
#define | CMD_RESET_OBJECT_SPROCKETS TOKEN_SPROCKETS
#define | CMD_RESET_OBJECT_WIDGETS TOKEN_WIDGETS
#define | CMD_SET_GATEWAY TOKEN_GATEWAY
#define | CMD_SET_INTERFACE TOKEN_INTERFACE
#define | CMD_SET_OBJECT TOKEN_SET
#define | CMD_SET_RANDOM_STUFF TOKEN_SET
#define | CMD_SHOW_OBJECT TOKEN_SHOW
#define | CMD_SHOW_RANDOM TOKEN_SHOW
#define | CMD_SHOWERROR TOKEN_SHOWERROR
#define | DISABLED 2
#define | DUMP_SAMP DUMP_SAMP_BASE + 1
#define | DUMP_SAMP_BASE 40000
#define | DUMP_SAMPINTERFACE DUMP_SAMP + 1
#define | ENABLED 1
#define | ERR_INVALID_ERROR_CODE ERR_INVALID_NUM_ARGS + 1
#define | ERR_INVALID_NUM_ARGS ERR_NO_VALID_COUNT + 1
#define | ERR_NO_VALID_COUNT ERR_SAMP_BASE + 1
#define | ERR_SAMP_BASE 20000
#define | GEN_CMD_OKAY GEN_SAMP_BASE + 1
#define | GEN_CONNECT_SHOWSTRING GEN_SAMPLEGATEWAY_SETTINGS + 1
#define | GEN_CURRENT_COUNT GEN_CMD_OKAY + 1
#define | GEN_SAMP_BASE 30000
#define | GEN_SAMPLEGATEWAY_SETTINGS GEN_SAMPLEINTERFACE_SETTINGS + 1
#define | GEN_SAMPLEINTERFACE_SETTINGS GEN_CURRENT_COUNT + 1
#define | HLP_ADD_OBJECT HLP_SAMP_BASE + HLP_ADD_OBJECT_BASE + 10
#define | HLP_ADD_OBJECT_BASE 0
#define | HLP_ADD_OBJECT_EX HLP_SAMP_BASE + HLP_ADD_OBJECT_BASE + 11
#define | HLP_RANDOM_BASE 500
#define | HLP_RESET_OBJECT HLP_SAMP_BASE + HLP_RESET_OBJECT_BASE
#define | HLP_RESET_OBJECT_ALL HLP_SAMP_BASE + HLP_RESET_OBJECT_BASE + 30
#define | HLP_RESET_OBJECT_ALL_EX HLP_SAMP_BASE + HLP_RESET_OBJECT_BASE + 31
#define | HLP_RESET_OBJECT_BASE 300
#define | HLP_RESET_OBJECT_SPROCKETS HLP_SAMP_BASE + HLP_RESET_OBJECT_BASE + 20
#define | HLP_RESET_OBJECT_SPROCKETS_EX HLP_SAMP_BASE + HLP_RESET_OBJECT_BASE + 21
#define | HLP_RESET_OBJECT_WIDGETS HLP_SAMP_BASE + HLP_RESET_OBJECT_BASE + 10
#define | HLP_RESET_OBJECT_WIDGETS_EX HLP_SAMP_BASE + HLP_RESET_OBJECT_BASE + 11
#define | HLP_SAMP_BASE 10000
#define | HLP_SET_GATEWAY HLP_SAMP_BASE + HLP_RANDOM_BASE + 20
#define | HLP_SET_GATEWAY_EX HLP_SAMP_BASE + HLP_RANDOM_BASE + 21
#define | HLP_SET_INTERFACE HLP_SAMP_BASE + HLP_RANDOM_BASE + 10
#define | HLP_SET_INTERFACE_EX HLP_SAMP_BASE + HLP_RANDOM_BASE + 11
#define | HLP_SET_OBJECT HLP_SAMP_BASE + HLP_SET_OBJECT_BASE + 10
#define | HLP_SET_OBJECT_BASE 200
#define | HLP_SET_OBJECT_EX HLP_SAMP_BASE + HLP_SET_OBJECT_BASE + 11
#define | HLP_SET_RANDOM_STUFF HLP_SAMP_BASE + HLP_RANDOM_BASE
#define | HLP_SHOW_OBJECT HLP_SAMP_BASE + HLP_SHOW_OBJECT_BASE + 10
#define | HLP_SHOW_OBJECT_BASE 100
#define | HLP_SHOW_OBJECT_EX HLP_SAMP_BASE + HLP_SHOW_OBJECT_BASE + 11
#define | HLP_SHOW_RANDOM HLP_SAMP_BASE + HLP_RANDOM_BASE + 30
#define | HLP_SHOW_RANDOM_EX HLP_SAMP_BASE + HLP_RANDOM_BASE + 31
#define | HLP_SHOWERROR HLP_SAMP_BASE + HLP_SHOWERROR_BASE + 10
#define | HLP_SHOWERROR_BASE 400
#define | HLP_SHOWERROR_EX HLP_SAMP_BASE + HLP_SHOWERROR_BASE + 11
#define | ID 0
#define | POTENTIAL 4
#define | SAMPLE_HELPER_VERSION 1
#define | SPROCKETS 1
#define | SUPERMETRIC 3
#define | TOKEN_ADD L"add"
#define | TOKEN_ALL L"all"
#define | TOKEN_DISABLED L"disabled"
#define | TOKEN_ENABLED L"enabled"
#define | TOKEN_GATEWAY L"gateway"
#define | TOKEN_HIGH L"high"
#define | TOKEN_IA64 L"ia64"
#define | TOKEN_ID L"id"
#define | TOKEN_INTERFACE L"interface"
#define | TOKEN_LOW L"low"
#define | TOKEN_MEDIUM L"medium"
#define | TOKEN_POTENTIAL L"potential"
#define | TOKEN_RESET L"reset"
#define | TOKEN_SAMPLE L"sample"
#define | TOKEN_SAMPLEINTERFACE L"sampleinterface"
#define | TOKEN_SET L"set"
#define | TOKEN_SHOW L"show"
#define | TOKEN_SHOWERROR L"showerror"
#define | TOKEN_SPROCKETS L"sprockets"
#define | TOKEN_SUBCONTEXT L"subcontext"
#define | TOKEN_SUPERMETRIC L"supermetric"
#define | TOKEN_UNKNOWN L"unknown"
#define | TOKEN_USERDATA L"userdata"
#define | TOKEN_WIDGETS L"widgets"
#define | TOKEN_X86 L"x86"
#define | UNICODE
#define | WIDGETS 0

Typedefs

typedef struct
_SAMPLE_HELPER_DATA_ * 		PSAMPLE_HELPER_DATA
typedef struct _SAMPLE_HELPER_DATA_ | SAMPLE_HELPER_DATA

Enumerations

enum | ePOTENTIAL { LOW = 0, MEDIUM = 1, HIGH = 2 }

Functions

BOOL WINAPI | CheckRunningOnWhistler (IN UINT CIMOSType, IN UINT CIMOSProductSuite, IN LPCWSTR CIMOSVersion, IN LPCWSTR CIMOSBuildNumber, IN LPCWSTR CIMServicePackMajorVersion, IN LPCWSTR CIMServicePackMinorVersion, IN UINT CIMProcessorArchitecture, IN DWORD dwReserved)
DWORD WINAPI | DumpSample (IN LPCWSTR pwszRouter, IN OUT LPWSTR *ppwcArguments, IN DWORD dwArgCount, IN LPCVOID pvData)
DWORD WINAPI | DumpSampleInterface (IN LPCWSTR pwszRouter, IN OUT LPWSTR *ppwcArguments, IN DWORD dwArgCount, IN LPCVOID pvData)
DWORD WINAPI | HandleAddObjectCommand (IN LPCWSTR pwszMachine, IN OUT LPWSTR *ppwcArguments, IN DWORD dwCurrentIndex, IN DWORD dwArgCount, IN DWORD dwFlags, IN LPCVOID pvData, OUT BOOL *pbDone)
DWORD WINAPI | HandleResetAllCommand (IN LPCWSTR pwszMachine, IN OUT LPWSTR *ppwcArguments, IN DWORD dwCurrentIndex, IN DWORD dwArgCount, IN DWORD dwFlags, IN LPCVOID pvData, OUT BOOL *pbDone)
DWORD WINAPI | HandleResetSprocketCommand (IN LPCWSTR pwszMachine, IN OUT LPWSTR *ppwcArguments, IN DWORD dwCurrentIndex, IN DWORD dwArgCount, IN DWORD dwFlags, IN LPCVOID pvData, OUT BOOL *pbDone)
DWORD WINAPI | HandleResetWidgetCommand (IN LPCWSTR pwszMachine, IN OUT LPWSTR *ppwcArguments, IN DWORD dwCurrentIndex, IN DWORD dwArgCount, IN DWORD dwFlags, IN LPCVOID pvData, OUT BOOL *pbDone)
DWORD WINAPI | HandleSetGatewayCommand (IN LPCWSTR pwszMachine, IN OUT LPWSTR *ppwcArguments, IN DWORD dwCurrentIndex, IN DWORD dwArgCount, IN DWORD dwFlags, IN LPCVOID pvData, OUT BOOL *pbDone)
DWORD WINAPI | HandleSetInterfaceCommand (IN LPCWSTR pwszMachine, IN OUT LPWSTR *ppwcArguments, IN DWORD dwCurrentIndex, IN DWORD dwArgCount, IN DWORD dwFlags, IN LPCVOID pvData, OUT BOOL *pbDone)
DWORD WINAPI | HandleSetObjectCommand (IN LPCWSTR pwszMachine, IN OUT LPWSTR *ppwcArguments, IN DWORD dwCurrentIndex, IN DWORD dwArgCount, IN DWORD dwFlags, IN LPCVOID pvData, OUT BOOL *pbDone)
DWORD WINAPI | HandleShowErrorCommand (IN LPCWSTR pwszMachine, IN OUT LPWSTR *ppwcArguments, IN DWORD dwCurrentIndex, IN DWORD dwArgCount, IN DWORD dwFlags, IN LPCVOID pvData, OUT BOOL *pbDone)
DWORD WINAPI | HandleShowObjectCommand (IN LPCWSTR pwszMachine, IN OUT LPWSTR *ppwcArguments, IN DWORD dwCurrentIndex, IN DWORD dwArgCount, IN DWORD dwFlags, IN LPCVOID pvData, OUT BOOL *pbDone)
DWORD WINAPI | HandleShowRandomSettingsCommand (IN LPCWSTR pwszMachine, IN OUT LPWSTR *ppwcArguments, IN DWORD dwCurrentIndex, IN DWORD dwArgCount, IN DWORD dwFlags, IN LPCVOID pvData, OUT BOOL *pbDone)
DWORD WINAPI | InitHelperDll (IN DWORD dwNetshVersion, OUT PVOID pReserved)
DWORD WINAPI | StartHelpers (IN CONST GUID *pguidParent, IN DWORD dwVersion)

Variables

const GUID | g_Interface = {0x0705eca1, 0x7aac, 0x11d2, {0x89, 0xdc, 0x00, 0x60, 0x08, 0xb0, 0xe5, 0xb9}}
const GUID | g_ObjectGuid = {0xf7e0bc27, 0xba6e, 0x4145, {0xa1, 0x23, 0x01, 0x2f, 0x19, 0x22, 0xf3, 0xf1}}
const GUID | g_RootGuid = NETSH_ROOT_GUID
const GUID | g_SampleInterface = {0xf7e0bc29, 0xba6e, 0x4145, {0xa1, 0x23, 0x01, 0x2f, 0x19, 0x22, 0xf3, 0xf1}}
const GUID | g_SubContext = {0xf7e0bc28, 0xba6e, 0x4145, {0xa1, 0x23, 0x01, 0x2f, 0x19, 0x22, 0xf3, 0xf1}}

Define Documentation

#define ALL 2

Definition at line 263 of file nshsamp.h.

#define CMD_ADD_OBJECT TOKEN_ADD

Definition at line 305 of file nshsamp.h.

#define CMD_RESET_OBJECT TOKEN_RESET

Definition at line 290 of file nshsamp.h.

#define CMD_RESET_OBJECT_ALL TOKEN_ALL

Definition at line 335 of file nshsamp.h.

#define CMD_RESET_OBJECT_SPROCKETS TOKEN_SPROCKETS

Definition at line 331 of file nshsamp.h.

#define CMD_RESET_OBJECT_WIDGETS TOKEN_WIDGETS

Definition at line 327 of file nshsamp.h.

#define CMD_SET_GATEWAY TOKEN_GATEWAY

Definition at line 355 of file nshsamp.h.

#define CMD_SET_INTERFACE TOKEN_INTERFACE

Definition at line 351 of file nshsamp.h.

#define CMD_SET_OBJECT TOKEN_SET

Definition at line 317 of file nshsamp.h.

#define CMD_SET_RANDOM_STUFF TOKEN_SET

Definition at line 293 of file nshsamp.h.

#define CMD_SHOW_OBJECT TOKEN_SHOW

Definition at line 311 of file nshsamp.h.

#define CMD_SHOW_RANDOM TOKEN_SHOW

Definition at line 359 of file nshsamp.h.

#define CMD_SHOWERROR TOKEN_SHOWERROR

Definition at line 343 of file nshsamp.h.

#define DISABLED 2

Definition at line 267 of file nshsamp.h.

#define DUMP_SAMP DUMP_SAMP_BASE + 1

Definition at line 385 of file nshsamp.h.

#define DUMP_SAMP_BASE 40000

Definition at line 384 of file nshsamp.h.

#define DUMP_SAMPINTERFACE DUMP_SAMP + 1

Definition at line 386 of file nshsamp.h.

#define ENABLED 1

Definition at line 266 of file nshsamp.h.

#define ERR_INVALID_ERROR_CODE ERR_INVALID_NUM_ARGS + 1

Definition at line 369 of file nshsamp.h.

#define ERR_INVALID_NUM_ARGS ERR_NO_VALID_COUNT + 1

Definition at line 368 of file nshsamp.h.

#define ERR_NO_VALID_COUNT ERR_SAMP_BASE + 1

Definition at line 367 of file nshsamp.h.

#define ERR_SAMP_BASE 20000

Definition at line 366 of file nshsamp.h.

#define GEN_CMD_OKAY GEN_SAMP_BASE + 1

Definition at line 375 of file nshsamp.h.

#define GEN_CONNECT_SHOWSTRING GEN_SAMPLEGATEWAY_SETTINGS + 1

Definition at line 379 of file nshsamp.h.

#define GEN_CURRENT_COUNT GEN_CMD_OKAY + 1

Definition at line 376 of file nshsamp.h.

#define GEN_SAMP_BASE 30000

Definition at line 374 of file nshsamp.h.

#define GEN_SAMPLEGATEWAY_SETTINGS GEN_SAMPLEINTERFACE_SETTINGS + 1

Definition at line 378 of file nshsamp.h.

#define GEN_SAMPLEINTERFACE_SETTINGS GEN_CURRENT_COUNT + 1

Definition at line 377 of file nshsamp.h.

#define HLP_ADD_OBJECT HLP_SAMP_BASE + HLP_ADD_OBJECT_BASE + 10

Definition at line 306 of file nshsamp.h.

#define HLP_ADD_OBJECT_BASE 0

Definition at line 278 of file nshsamp.h.

#define HLP_ADD_OBJECT_EX HLP_SAMP_BASE + HLP_ADD_OBJECT_BASE + 11

Definition at line 307 of file nshsamp.h.

#define HLP_RANDOM_BASE 500

Definition at line 283 of file nshsamp.h.

#define HLP_RESET_OBJECT HLP_SAMP_BASE + HLP_RESET_OBJECT_BASE

Definition at line 291 of file nshsamp.h.

#define HLP_RESET_OBJECT_ALL HLP_SAMP_BASE + HLP_RESET_OBJECT_BASE + 30

Definition at line 336 of file nshsamp.h.

#define HLP_RESET_OBJECT_ALL_EX HLP_SAMP_BASE + HLP_RESET_OBJECT_BASE + 31

Definition at line 337 of file nshsamp.h.

#define HLP_RESET_OBJECT_BASE 300

Definition at line 281 of file nshsamp.h.

#define HLP_RESET_OBJECT_SPROCKETS HLP_SAMP_BASE + HLP_RESET_OBJECT_BASE + 20

Definition at line 332 of file nshsamp.h.

#define HLP_RESET_OBJECT_SPROCKETS_EX HLP_SAMP_BASE + HLP_RESET_OBJECT_BASE + 21

Definition at line 333 of file nshsamp.h.

#define HLP_RESET_OBJECT_WIDGETS HLP_SAMP_BASE + HLP_RESET_OBJECT_BASE + 10

Definition at line 328 of file nshsamp.h.

#define HLP_RESET_OBJECT_WIDGETS_EX HLP_SAMP_BASE + HLP_RESET_OBJECT_BASE + 11

Definition at line 329 of file nshsamp.h.

#define HLP_SAMP_BASE 10000

Definition at line 276 of file nshsamp.h.

#define HLP_SET_GATEWAY HLP_SAMP_BASE + HLP_RANDOM_BASE + 20

Definition at line 356 of file nshsamp.h.

#define HLP_SET_GATEWAY_EX HLP_SAMP_BASE + HLP_RANDOM_BASE + 21

Definition at line 357 of file nshsamp.h.

#define HLP_SET_INTERFACE HLP_SAMP_BASE + HLP_RANDOM_BASE + 10

Definition at line 352 of file nshsamp.h.

#define HLP_SET_INTERFACE_EX HLP_SAMP_BASE + HLP_RANDOM_BASE + 11

Definition at line 353 of file nshsamp.h.

#define HLP_SET_OBJECT HLP_SAMP_BASE + HLP_SET_OBJECT_BASE + 10

Definition at line 318 of file nshsamp.h.

#define HLP_SET_OBJECT_BASE 200

Definition at line 280 of file nshsamp.h.

#define HLP_SET_OBJECT_EX HLP_SAMP_BASE + HLP_SET_OBJECT_BASE + 11

Definition at line 319 of file nshsamp.h.

#define HLP_SET_RANDOM_STUFF HLP_SAMP_BASE + HLP_RANDOM_BASE

Definition at line 294 of file nshsamp.h.

#define HLP_SHOW_OBJECT HLP_SAMP_BASE + HLP_SHOW_OBJECT_BASE + 10

Definition at line 312 of file nshsamp.h.

#define HLP_SHOW_OBJECT_BASE 100

Definition at line 279 of file nshsamp.h.

#define HLP_SHOW_OBJECT_EX HLP_SAMP_BASE + HLP_SHOW_OBJECT_BASE + 11

Definition at line 313 of file nshsamp.h.

#define HLP_SHOW_RANDOM HLP_SAMP_BASE + HLP_RANDOM_BASE + 30

Definition at line 360 of file nshsamp.h.

#define HLP_SHOW_RANDOM_EX HLP_SAMP_BASE + HLP_RANDOM_BASE + 31

Definition at line 361 of file nshsamp.h.

#define HLP_SHOWERROR HLP_SAMP_BASE + HLP_SHOWERROR_BASE + 10

Definition at line 344 of file nshsamp.h.

#define HLP_SHOWERROR_BASE 400

Definition at line 282 of file nshsamp.h.

#define HLP_SHOWERROR_EX HLP_SAMP_BASE + HLP_SHOWERROR_BASE + 11

Definition at line 345 of file nshsamp.h.

#define ID 0

Definition at line 265 of file nshsamp.h.

#define POTENTIAL 4

Definition at line 269 of file nshsamp.h.

#define SAMPLE_HELPER_VERSION 1

Definition at line 24 of file nshsamp.h.

#define SPROCKETS 1

Definition at line 262 of file nshsamp.h.

#define SUPERMETRIC 3

Definition at line 268 of file nshsamp.h.

#define TOKEN_ADD L"add"

Definition at line 232 of file nshsamp.h.

#define TOKEN_ALL L"all"

Definition at line 235 of file nshsamp.h.

#define TOKEN_DISABLED L"disabled"

Definition at line 245 of file nshsamp.h.

#define TOKEN_ENABLED L"enabled"

Definition at line 244 of file nshsamp.h.

#define TOKEN_GATEWAY L"gateway"

Definition at line 241 of file nshsamp.h.

#define TOKEN_HIGH L"high"

Definition at line 248 of file nshsamp.h.

#define TOKEN_IA64 L"ia64"

Definition at line 252 of file nshsamp.h.

#define TOKEN_ID L"id"

Definition at line 243 of file nshsamp.h.

#define TOKEN_INTERFACE L"interface"

Definition at line 240 of file nshsamp.h.

#define TOKEN_LOW L"low"

Definition at line 250 of file nshsamp.h.

#define TOKEN_MEDIUM L"medium"

Definition at line 249 of file nshsamp.h.

#define TOKEN_POTENTIAL L"potential"

Definition at line 247 of file nshsamp.h.

#define TOKEN_RESET L"reset"

Definition at line 238 of file nshsamp.h.

#define TOKEN_SAMPLE L"sample"

Definition at line 225 of file nshsamp.h.

#define TOKEN_SAMPLEINTERFACE L"sampleinterface"

Definition at line 227 of file nshsamp.h.

#define TOKEN_SET L"set"

Definition at line 237 of file nshsamp.h.

#define TOKEN_SHOW L"show"

Definition at line 236 of file nshsamp.h.

#define TOKEN_SHOWERROR L"showerror"

Definition at line 239 of file nshsamp.h.

#define TOKEN_SPROCKETS L"sprockets"

Definition at line 234 of file nshsamp.h.

#define TOKEN_SUBCONTEXT L"subcontext"

Definition at line 226 of file nshsamp.h.

#define TOKEN_SUPERMETRIC L"supermetric"

Definition at line 246 of file nshsamp.h.

#define TOKEN_UNKNOWN L"unknown"

Definition at line 253 of file nshsamp.h.

#define TOKEN_USERDATA L"userdata"

Definition at line 242 of file nshsamp.h.

#define TOKEN_WIDGETS L"widgets"

Definition at line 233 of file nshsamp.h.

#define TOKEN_X86 L"x86"

Definition at line 251 of file nshsamp.h.

#define UNICODE

Definition at line 17 of file nshsamp.h.

#define WIDGETS 0

Definition at line 261 of file nshsamp.h.

Typedef Documentation

typedef struct _SAMPLE_HELPER_DATA_ * PSAMPLE_HELPER_DATA
typedef struct _SAMPLE_HELPER_DATA_ SAMPLE_HELPER_DATA

Enumeration Type Documentation

enum ePOTENTIAL
Enumerator:
LOW
MEDIUM
HIGH

Definition at line 47 of file nshsamp.h.

{
    LOW =       0,
    MEDIUM =    1,
    HIGH =      2
};

Function Documentation

BOOL WINAPI CheckRunningOnWhistler | ( | IN UINT | CIMOSType,
 |  | IN UINT | CIMOSProductSuite,
 |  | IN LPCWSTR | CIMOSVersion,
 |  | IN LPCWSTR | CIMOSBuildNumber,
 |  | IN LPCWSTR | CIMServicePackMajorVersion,
 |  | IN LPCWSTR | CIMServicePackMinorVersion,
 |  | IN UINT | CIMProcessorArchitecture,
 |  | IN DWORD | dwReserved
 | ) |  |

Definition at line 212 of file nshsamp.cpp.

{
    //
    // Leave this code in here so it can be uncommented and recompiled.
    // Its output can be kind of distracting if on by default, so it
    // was turned off.
    //
    /*
    PrintMessage(L"\n"
                 L"Entered CheckRunningOnWhistler.  Received arguments of \n"
                 L"Type %1!lu!\n"
                 L"ProductSuite %2!lu!\n"
                 L"Version %3!s!\n"
                 L"BuildNumber %4!s!\n"
                 L"ServicePackMajorVersion %5!s!\n"
                 L"ServicePackMinorVersion %6!s!\n"
                 L"ProcessorArchitecture %7!lu!\n",
                 CIMOSType,
                 CIMOSProductSuite,
                 CIMOSVersion,
                 CIMOSBuildNumber,
                 CIMServicePackMajorVersion,
                 CIMServicePackMinorVersion,
                 CIMProcessorArchitecture);
    */

    return TRUE;
}

DWORD WINAPI DumpSample | ( | IN LPCWSTR | pwszRouter,
 |  | IN OUT LPWSTR * | ppwcArguments,
 |  | IN DWORD | dwArgCount,
 |  | IN LPCVOID | pvData
 | ) |  |

Definition at line 25 of file sample.cpp.

{
    //
    // Output the string that shows our settings.
    // The idea here is to spit out a script that,
    // when run from the command line (netsh -f script)
    // will cause your component to be configured
    // exactly as it is when this dump command was run.
    //
    PrintMessageFromModule(g_hModule, DUMP_SAMP,
                           TOKEN_SET,
                           TOKEN_WIDGETS,
                           g_CurrentData->WidgetCount,
                           TOKEN_SPROCKETS,
                           g_CurrentData->SprocketCount);

    return NO_ERROR;

}

DWORD WINAPI DumpSampleInterface | ( | IN LPCWSTR | pwszRouter,
 |  | IN OUT LPWSTR * | ppwcArguments,
 |  | IN DWORD | dwArgCount,
 |  | IN LPCVOID | pvData
 | ) |  |

Definition at line 25 of file sampinterface.cpp.

{
    DWORD       dwRet;
    UINT        OSType;
    UINT        OSProductSuite;
    WCHAR       OSVersion[MAX_PATH];
    WCHAR       OSBuildNumber[MAX_PATH];
    WCHAR       ServicePackMajorVersion[MAX_PATH];
    WCHAR       ServicePackMinorVersion[MAX_PATH];
    UINT        ProcessorArchitecture;
    LPWSTR      lpArchitecture = NULL;

    //
    // This function is provided by netsh so that you can take different
    // actions in any function depending on the machine type.
    //
    dwRet = GetHostMachineInfo(
                &OSType,
                &OSProductSuite,
                OSVersion,
                OSBuildNumber,
                ServicePackMajorVersion,
                ServicePackMinorVersion,
                &ProcessorArchitecture);

    if (NO_ERROR == dwRet)
    {

        //
        // Note that these values (0 and 6) are WMI values that specify
        // the architecture.  At the time of this writing, these values
        // as listed in MSDN were off by one, ie x86 was listed as 1 and
        // IA64 was listed as 7.  The values here are the correct values
        // to check against.
        //
        switch(ProcessorArchitecture)
        {
            case 0:
                lpArchitecture = TOKEN_X86;
                break;
            case 6:
                lpArchitecture = TOKEN_IA64;
                break;
            default:
                lpArchitecture = TOKEN_UNKNOWN;
                break;
        }
    }

    LPWSTR lpPotential = 0;

    switch(g_CurrentData->Potential)
    {
        case LOW:
            lpPotential = TOKEN_LOW;
            break;
        case MEDIUM:
            lpPotential = TOKEN_MEDIUM;
            break;
        case HIGH:
            lpPotential = TOKEN_HIGH;
            break;
    }

    //
    // Output the string that shows our settings.
    // The idea here is to spit out a script that,
    // when run from the command line (netsh -f script)
    // will cause your component to be configured
    // exactly as it is when this dump command is run.
    //
    PrintMessageFromModule(g_hModule, DUMP_SAMPINTERFACE,
                           TOKEN_SET,
                           TOKEN_INTERFACE,
                           TOKEN_ID,
                           g_CurrentData->InterfaceID,
                           g_CurrentData->bEnabled ? TOKEN_ENABLED : TOKEN_DISABLED,
                           TOKEN_SUPERMETRIC,
                           g_CurrentData->Supermetric,
                           TOKEN_POTENTIAL,
                           lpPotential,
                           // Second set command starts here.
                           TOKEN_GATEWAY,
                           TOKEN_USERDATA,
                           (DWORD)LOBYTE(LOWORD(g_CurrentData->GatewayUserData)),
                           (DWORD)HIBYTE(LOWORD(g_CurrentData->GatewayUserData)),
                           (DWORD)LOBYTE(HIWORD(g_CurrentData->GatewayUserData)),
                           (DWORD)HIBYTE(HIWORD(g_CurrentData->GatewayUserData)),
                           lpArchitecture);

    return NO_ERROR;
}

DWORD WINAPI HandleAddObjectCommand | ( | IN LPCWSTR | pwszMachine,
 |  | IN OUT LPWSTR * | ppwcArguments,
 |  | IN DWORD | dwCurrentIndex,
 |  | IN DWORD | dwArgCount,
 |  | IN DWORD | dwFlags,
 |  | IN LPCVOID | pvData,
 |  | OUT BOOL * | pbDone
 | ) |  |

Definition at line 52 of file sample.cpp.

{
    //
    // Init the return value to ERROR_SHOW_USAGE.  This value
    // if returned, will cause netsh to display the extended
    // usage for this command.  (HLP_ADD_OBJECT_EX in this case.)
    //
    DWORD dwRet = ERROR_SHOW_USAGE;

    //
    // We know the add xxxx x command has two tokens that we care
    // about - the type (widgets, sprockets, all) and the number
    // to add after the type.  From that, we know:
    // 1.  There should be 4 arguments for a valid command.  No more,
    //          no less.
    // 2.  The third arg should be one of the three type id's.
    // 3.  The fourth arg should be a number.
    //

    //
    // So, for 1, make sure we have 4 args.
    //

    if (4 == dwArgCount)
    {
        long lCountToAdd;

        //
        // We'll take care of 3 first, because we need it converted
        // to a number in any case.  CRT function WCSTOL is best to use
        // here.
        //
        if (lCountToAdd = wcstol(ppwcArguments[dwCurrentIndex + 1], NULL, 10))
        {
            //
            // For 2, we'll use MatchToken to match the tokens.
            // If we found a match, return ERROR_OKAY so that
            // netsh will output an "Ok." string to indicate
            // the command was successful.  Returning
            // ERROR_SUPPRESS_OUTPUT indicates that the command
            // was successful but netsh shouldn't output anything
            // to indicate so.
            //
            if (MatchToken(ppwcArguments[dwCurrentIndex], TOKEN_WIDGETS))
            {
                g_CurrentData->WidgetCount += lCountToAdd;
                dwRet = ERROR_OKAY;
            }
            else if(MatchToken(ppwcArguments[dwCurrentIndex], TOKEN_SPROCKETS))
            {
                g_CurrentData->SprocketCount += lCountToAdd;
                dwRet = ERROR_OKAY;
            }
            else if(MatchToken(ppwcArguments[dwCurrentIndex], TOKEN_ALL))
            {
                g_CurrentData->WidgetCount += lCountToAdd;
                g_CurrentData->SprocketCount += lCountToAdd;
                //
                // Since we are returning ERROR_SUPPRESS_OUTPUT
                // to prevent netsh's default "Ok." we will output
                // our own string instead.
                //
                PrintMessageFromModule(g_hModule, GEN_CMD_OKAY);
                dwRet = ERROR_SUPPRESS_OUTPUT;
            }
        }
        else
        {
            //
            // Put a message here telling the user what went wrong.  Note that
            // in your .rc file, you need to specify ... (ellipsis) args via
            // FormatMessage style, ie %1!s! instead of just %s.
            //
            PrintMessageFromModule(g_hModule, ERR_NO_VALID_COUNT, ppwcArguments[3]);
        }
    }
    else
    {
        PrintMessageFromModule(g_hModule, ERR_INVALID_NUM_ARGS, 3);
    }

    return dwRet;
}

DWORD WINAPI HandleResetAllCommand | ( | IN LPCWSTR | pwszMachine,
 |  | IN OUT LPWSTR * | ppwcArguments,
 |  | IN DWORD | dwCurrentIndex,
 |  | IN DWORD | dwArgCount,
 |  | IN DWORD | dwFlags,
 |  | IN LPCVOID | pvData,
 |  | OUT BOOL * | pbDone
 | ) |  |

Definition at line 406 of file sample.cpp.

{
    g_CurrentData->WidgetCount = 0;
    g_CurrentData->SprocketCount = 0;

    //
    // Carry out the command and return NO_ERROR.  Same behavior as
    // returning ERROR_SUPPRESS_OUTPUT.
    //
    return NO_ERROR;
}

DWORD WINAPI HandleResetSprocketCommand | ( | IN LPCWSTR | pwszMachine,
 |  | IN OUT LPWSTR * | ppwcArguments,
 |  | IN DWORD | dwCurrentIndex,
 |  | IN DWORD | dwArgCount,
 |  | IN DWORD | dwFlags,
 |  | IN LPCVOID | pvData,
 |  | OUT BOOL * | pbDone
 | ) |  |

Definition at line 386 of file sample.cpp.

{
    g_CurrentData->SprocketCount = 0;

    //
    // We'll carry out the command, but show what happens when
    // ERROR_INVALID_SYNTAX is returned - netsh outputs an error
    // message.
    //
    return ERROR_INVALID_SYNTAX;
}

DWORD WINAPI HandleResetWidgetCommand | ( | IN LPCWSTR | pwszMachine,
 |  | IN OUT LPWSTR * | ppwcArguments,
 |  | IN DWORD | dwCurrentIndex,
 |  | IN DWORD | dwArgCount,
 |  | IN DWORD | dwFlags,
 |  | IN LPCVOID | pvData,
 |  | OUT BOOL * | pbDone
 | ) |  |

Definition at line 358 of file sample.cpp.

{

    g_CurrentData->WidgetCount = 0;

    //
    // Carry out the command, but return ERROR_SHOW_USAGE
    // to show what happens. netsh should display the
    // HLP_RESET_OBJECT_WIDGETS_EX message.  Note that
    // the other commands in this group, "sprockets" and
    // "all" don't return ERROR_SHOW_USAGE, so there is
    // no reason to specify the extended help strings
    // (HLP_RESET_OBJECT_SPROCKETS_EX and
    // HLP_RESET_OBJECT_ALL_EX) for each command.  They are
    // #define'd though, so that the CREATE_CMD_ENTRY macros
    // will still work.
    //
    return ERROR_SHOW_USAGE;
}

DWORD WINAPI HandleSetGatewayCommand | ( | IN LPCWSTR | pwszMachine,
 |  | IN OUT LPWSTR * | ppwcArguments,
 |  | IN DWORD | dwCurrentIndex,
 |  | IN DWORD | dwArgCount,
 |  | IN DWORD | dwFlags,
 |  | IN LPCVOID | pvData,
 |  | OUT BOOL * | pbDone
 | ) |  |

Definition at line 222 of file sampinterface.cpp.

{
    DWORD dwRet = ERROR_SHOW_USAGE;
    const DWORD MAX_CMDS = 4;
    const DWORD MAX_VALUE = 255;

    DWORD dwTagType[MAX_CMDS];

    TAG_TYPE ValidCommands[] =
    {
        //
        // Specify that it is acceptable to put this token in a command
        // multiple times.
        //
        {TOKEN_USERDATA,     NS_REQ_ALLOW_MULTIPLE, FALSE}
    };

    //
    // Since our command should have an = in it, PreprocessCommand will
    // do most of the parsing for us.
    //
    dwRet = PreprocessCommand(
        0,
        ppwcArguments,
        dwCurrentIndex,
        dwArgCount,
        ValidCommands,
        sizeof(ValidCommands)/sizeof(TAG_TYPE),
        1,
        // We'll put a limit of MAX_CMDS pieces of data (so it fits in one DWORD.)
        MAX_CMDS,
        dwTagType);

    if (NO_ERROR == dwRet)
    {
        //
        // Reset GatewayUserData to 0.
        //
        g_CurrentData->GatewayUserData = 0;

        for (DWORD i = dwCurrentIndex; i < dwArgCount; i++)
        {
            //
            // If we got to this point, then we can just start converting bits of data
            // because there is only one possible argument.
            //
            DWORD dwResult = wcstoul(ppwcArguments[i], NULL, 10);
            if (dwResult > 0 && dwResult < MAX_VALUE)
            {
                //
                // Store our data in the global DWORD by bitshifting each
                // arg by (i - dwCurrentIndex) * 8 bits.  So, the first time
                // through, i - dwCurrentIndex will be 0, and the value
                // won't be shifted.  The second time through, i - dwCurrentIndex
                // is 1, so the value will be shifted left by 8 bits, which
                // when |'d with g_GatewayUserData, will store our number in the
                // second byte.
                //
                g_CurrentData->GatewayUserData |= dwResult << ((i - dwCurrentIndex) * 8);
            }
            else
            {
                dwRet = ERROR_SHOW_USAGE;
            }
        }
    }

    return dwRet;
}

DWORD WINAPI HandleSetInterfaceCommand | ( | IN LPCWSTR | pwszMachine,
 |  | IN OUT LPWSTR * | ppwcArguments,
 |  | IN DWORD | dwCurrentIndex,
 |  | IN DWORD | dwArgCount,
 |  | IN DWORD | dwFlags,
 |  | IN LPCVOID | pvData,
 |  | OUT BOOL * | pbDone
 | ) |  |

Definition at line 125 of file sampinterface.cpp.

{
    DWORD dwRet = ERROR_SHOW_USAGE;
    const DWORD MAX_CMDS = 4;
    DWORD dwTagType[MAX_CMDS];

    //
    // This command line is more complicated, and allows us
    // to show the results of using PreprocessCommand on a
    // more complicated command line.
    //

    TAG_TYPE ValidCommands[] =
    {
        {TOKEN_ID,  NS_REQ_PRESENT, FALSE},
        {TOKEN_ENABLED, NS_REQ_ZERO, FALSE},
        {TOKEN_DISABLED, NS_REQ_ZERO, FALSE},
        {TOKEN_SUPERMETRIC, NS_REQ_ZERO, FALSE},
        {TOKEN_POTENTIAL, NS_REQ_ZERO, FALSE}
    };

    dwRet = PreprocessCommand(
        0,
        ppwcArguments,
        dwCurrentIndex,
        dwArgCount,
        ValidCommands,
        sizeof(ValidCommands)/sizeof(TAG_TYPE),
        // At least two commands are required - the id specification for the interface and some other bit of data.
        2,
        MAX_CMDS,
        dwTagType);

    if (NO_ERROR == dwRet)
    {
        for (DWORD i = 0; i < (dwArgCount - dwCurrentIndex); i++)
        {
            //
            // This switch works because these were #defined to match with
            // ValidCommands above.
            //
            // #define ID                              0
            // #define ENABLED                         1
            // #define DISABLED                        2
            // #define SUPERMETRIC                     3
            // #define POTENTIAL                       4
            //

            switch (dwTagType[i])
            {
                case ID:
                    g_CurrentData->InterfaceID = wcstoul(ppwcArguments[i + dwCurrentIndex], NULL, 10);
                    break;
                case ENABLED:
                    g_CurrentData->bEnabled = TRUE;
                    break;
                case DISABLED:
                    g_CurrentData->bEnabled = FALSE;
                    break;
                case SUPERMETRIC:
                    g_CurrentData->Supermetric = wcstoul(ppwcArguments[i + dwCurrentIndex], NULL, 10);
                    break;
                case POTENTIAL:
                    if (MatchToken(ppwcArguments[i + dwCurrentIndex], TOKEN_LOW))
                    {
                        g_CurrentData->Potential = LOW;
                    }
                    else if (MatchToken(ppwcArguments[i + dwCurrentIndex], TOKEN_MEDIUM))
                    {
                        g_CurrentData->Potential = MEDIUM;
                    }
                    else if (MatchToken(ppwcArguments[i + dwCurrentIndex], TOKEN_HIGH))
                    {
                        g_CurrentData->Potential = HIGH;
                    }
                    break;
                default:
                    //
                    // Shouldn't reach this point.
                    //
                    dwRet = ERROR_INVALID_SYNTAX;
                    break;
            }
        }
    }

    return dwRet;
}

DWORD WINAPI HandleSetObjectCommand | ( | IN LPCWSTR | pwszMachine,
 |  | IN OUT LPWSTR * | ppwcArguments,
 |  | IN DWORD | dwCurrentIndex,
 |  | IN DWORD | dwArgCount,
 |  | IN DWORD | dwFlags,
 |  | IN LPCVOID | pvData,
 |  | OUT BOOL * | pbDone
 | ) |  |

Definition at line 224 of file sample.cpp.

{
    DWORD dwRet;

    //
    // This command involves setting something equal to a value
    // provided by the user.  The netsh function we will use
    // to parse the command line will be PreProcessCommand,
    // which the most extensive of the argument handling
    // functions netsh offers.  The first thing to note
    // about PreprocessCommand is that it removes all identifiers
    // from your given command string.  For example, the command
    // "set widgets=10 sprockets=2", after being sent through
    // PreprocessCommand, will result in a arguments that would read
    // "set 10 2" which is much easier to.  Of course, PreprocessCommand
    // has a method for telling the caller which commands those
    // resulting numbers refer to.
    //

    //
    // First we set up our array of valid commands, note that
    // the entries are aligned so that ValidCommands[WIDGETS]
    // and ValidCommands[SPROCKETS] makes sense.
    //
    TAG_TYPE ValidCommands[] =
    {
        {TOKEN_WIDGETS,     NS_REQ_ZERO, FALSE},
        {TOKEN_SPROCKETS,   NS_REQ_ZERO, FALSE},
    };

    //
    // We'll need an array of DWORD's that is equal or larger
    // than the total number interesting arguments
    // (dwArgCount - dwCurrentIndex).  Rather than allocate memory
    // dynamically, we'll just use a stack allocated array of
    // DWORD's knowing the largest number of arguments there can be. (2)
    // easier.
    //
    const DWORD MAX_ARGS =       2;

    DWORD dwTagType[MAX_ARGS];

    //
    // Note that if there are too many or too few args for the command
    // to be valid, PreprocessCommand returns something other than
    // NO_ERROR,
    //
    dwRet = PreprocessCommand(
        0,                                      // This argument is not used; should be 0.
        ppwcArguments,                          // Argv style array (netsh passed us this.)
        dwCurrentIndex,                         // Means ppwcArguments[dwCurrentIndex] is the first argument of interest.
                                                // PpwcArguments[0] is going to be the context,
                                                // PpwcArguments[1] is the first command, 'add' in this case.
                                                // So ppwcARguments[2] is the first argument of interest.
        dwArgCount,                             // Total count of all the args in ppwcArguments.
        ValidCommands,                          // Our array of valid commands struct.
        sizeof(ValidCommands)/sizeof(TAG_TYPE), // Number of entries in the ValidCommands array.
        1,                                      // Minimum number of arguments needed to be a valid command.
        MAX_ARGS,                               // Maximum number of arguments allowed to be a valid command.
        dwTagType);                             // Array of DWORD's used to indicate which command in ValidCommands.
                                                // The token in the command line referred to.

    //
    // When the call to PreprocessCommand has returned, the values of ValidCommands[x].bPresent tell you which commands
    // were present in the command line.  Generally, you don't need to use the bPresent BOOL to process the results;
    // Rather, use bPresent to implement more advanced error handling for commands that have complicated command lines
    // (such and such arg was present, but you forgot this other arg.)
    //

    //
    // Each consecutive value in the dwTagType array refers to consecutive args in ppwcArguments starting with
    // ppwcArguments[dwCurrentIndex].  So, when PreprocessCommand returns and dwTagType[0] is 1, that means that
    // the first arg the user gave netsh was the command referred to by ValidCommands[1], or the "sprockets" command.
    // As you'll recall, since PreprocessCommand got rid of the "sprockets=" part of "sprockets=2" token, processing
    // all that remains, "2", is easy.
    //

    if (NO_ERROR == dwRet)
    {
        //
        // Change the return to ERROR_OKAY so netsh spits out confirmation if
        // everything goes ok after this point.
        //
        dwRet = ERROR_OKAY;

        //
        // For each argument..
        //
        for (DWORD i = 0; i < (dwArgCount - dwCurrentIndex); i++)
        {
            //
            // Check its corresponding value in the dwTagType array.
            //
            switch (dwTagType[i])
            {
                //
                // This works because i defined these to match with
                // ValidCommands above.
                //
                // #define WIDGETS                         0
                // #define SPROCKETS                       1
                //
                case WIDGETS:
                    g_CurrentData->WidgetCount = wcstoul(ppwcArguments[dwCurrentIndex + i], NULL, 10);
                    break;
                case SPROCKETS:
                    g_CurrentData->SprocketCount = wcstoul(ppwcArguments[dwCurrentIndex + i], NULL, 10);
                    break;
                default:
                    // Since 0 and 1 are the only valid values, means the arg wasn't recognized.
                    // Shouldn't reach this point because PreprocessCommand wouldn't have returned
                    // NO_ERROR if this was the case.
                    dwRet = ERROR_INVALID_SYNTAX;
                    break;
            }
        }
    }
    else
    {
        dwRet = ERROR_SHOW_USAGE;
    }

    return dwRet;
}

DWORD WINAPI HandleShowErrorCommand | ( | IN LPCWSTR | pwszMachine,
 |  | IN OUT LPWSTR * | ppwcArguments,
 |  | IN DWORD | dwCurrentIndex,
 |  | IN DWORD | dwArgCount,
 |  | IN DWORD | dwFlags,
 |  | IN LPCVOID | pvData,
 |  | OUT BOOL * | pbDone
 | ) |  |

Definition at line 25 of file subcontext.cpp.

{
    DWORD dwRet = ERROR_SHOW_USAGE;
    DWORD dwNumArgs = dwArgCount - dwCurrentIndex;

    //
    // If there are args for us to process..
    //
    if (dwNumArgs)
    {
        dwRet = ERROR_OKAY;

        for (DWORD i = dwCurrentIndex; i < dwArgCount; i++)
        {
            ULONG ulErrorNumber = wcstoul(ppwcArguments[i], NULL, 10);
            if (!ulErrorNumber)
            {
                ulErrorNumber = wcstoul(ppwcArguments[i], NULL, 16);
            }

            //
            // Use PrintError's first type of functionality, that being
            // printing out system error messages, be they netsh error
            // messages, (see netsh.h), ras errors, mpr errors, or win32
            // errors.
            //
            PrintMessage(L"%1!u!: ", ulErrorNumber);
            //
            // Pad the PrintError call with some extra zero's - this will prevent us from AV'ing
            // if we try to look at an error string that requires extra inputs.  (Hack, but
            // since it is expected that you know which error string you are outputting, it's
            // unavoidable.)
            //
            if (!PrintError(0, ulErrorNumber, 0, 0, 0, 0, 0, 0))
            {
                //
                // PrintError returns 0 if something didn't work (usually means
                // invalid error id), so we can use its other function, which
                // is to print out error messages from a given module.  Note that
                // this is essentially the same functionality as
                // PrintMessageFromModule.
                //
                PrintError(g_hModule, ERR_INVALID_ERROR_CODE, ulErrorNumber, ulErrorNumber);
            }
        }
    }

    return dwRet;
}

DWORD WINAPI HandleShowObjectCommand | ( | IN LPCWSTR | pwszMachine,
 |  | IN OUT LPWSTR * | ppwcArguments,
 |  | IN DWORD | dwCurrentIndex,
 |  | IN DWORD | dwArgCount,
 |  | IN DWORD | dwFlags,
 |  | IN LPCVOID | pvData,
 |  | OUT BOOL * | pbDone
 | ) |  |

Definition at line 144 of file sample.cpp.

{
    //
    // Init the return value to ERROR_SHOW_USAGE.  This value
    // will cause netsh to display the extended usage for this
    // command.
    //
    DWORD dwRet = ERROR_SHOW_USAGE;

    //
    // We only need check the first token after the command
    // (ppwcArguments[2].  We could use MatchToken like in
    // HandleAddObjectCommand, but for the purposes of showing
    // examples we'll use MatchEnumTag, though MatchEnumTag
    // isn't quite aimed towards this kind of command line
    // arrangement.  First, we initialize our valid tokens
    // struct.  This is designed to be like a C enum - each
    // identifier is associated with a value.  You send it
    // a particular argument, it returns you the value
    // associated with that argument (if its a valid argument.)
    //
    //
    TOKEN_VALUE ValidTokens[] =
    {
        {TOKEN_WIDGETS,     WIDGETS},
        {TOKEN_SPROCKETS,   SPROCKETS},
        {TOKEN_ALL,         ALL}
    };

    //
    // Make sure our arg count is correct.
    //
    if (3 == dwArgCount)
    {
        //
        // Then call MatchEnumTag with our argument of interest.
        // if NO_ERROR is returned, then MatchEnumTag must have
        // found a valid match.
        //
        DWORD dwResult = 0xffffffff;
        if (NO_ERROR == MatchEnumTag(0,
                                    ppwcArguments[dwCurrentIndex],
                                    sizeof(ValidTokens)/sizeof(TOKEN_VALUE),
                                    ValidTokens,
                                    &dwResult))
        {
            //
            // Since we found a match, assume we can return a success code
            // unless dwResult isn't 1, 2, or 3.  That shouldn't happen
            // however.
            //
            dwRet = ERROR_OKAY;
            switch(dwResult)
            {
                case WIDGETS:
                    PrintMessageFromModule(g_hModule, GEN_CURRENT_COUNT, TOKEN_WIDGETS, g_CurrentData->WidgetCount);
                    break;
                case SPROCKETS:
                    PrintMessageFromModule(g_hModule, GEN_CURRENT_COUNT, TOKEN_SPROCKETS, g_CurrentData->SprocketCount);
                    break;
                case ALL:
                    PrintMessageFromModule(g_hModule, GEN_CURRENT_COUNT, TOKEN_WIDGETS, g_CurrentData->WidgetCount);
                    PrintMessageFromModule(g_hModule, GEN_CURRENT_COUNT, TOKEN_SPROCKETS, g_CurrentData->SprocketCount);
                    break;
                default:
                    dwRet = ERROR_INVALID_SYNTAX;
            }
        }
    }
    return dwRet;
}

DWORD WINAPI HandleShowRandomSettingsCommand | ( | IN LPCWSTR | pwszMachine,
 |  | IN OUT LPWSTR * | ppwcArguments,
 |  | IN DWORD | dwCurrentIndex,
 |  | IN DWORD | dwArgCount,
 |  | IN DWORD | dwFlags,
 |  | IN LPCVOID | pvData,
 |  | OUT BOOL * | pbDone
 | ) |  |

Definition at line 301 of file sampinterface.cpp.

{
    LPWSTR lpPotential = 0;

    switch(g_CurrentData->Potential)
    {
        case LOW:
            lpPotential = TOKEN_LOW;
            break;
        case MEDIUM:
            lpPotential = TOKEN_MEDIUM;
            break;
        case HIGH:
            lpPotential = TOKEN_HIGH;
            break;
    }

    //
    // Output the current settings.
    //
    PrintMessageFromModule(g_hModule,
                           GEN_SAMPLEINTERFACE_SETTINGS,
                           g_CurrentData->InterfaceID,
                           g_CurrentData->bEnabled ? TOKEN_ENABLED : TOKEN_DISABLED,
                           g_CurrentData->Supermetric,
                           lpPotential);

    PrintMessageFromModule(g_hModule,
                           GEN_SAMPLEGATEWAY_SETTINGS,
                           (DWORD)LOBYTE(LOWORD(g_CurrentData->GatewayUserData)),
                           (DWORD)HIBYTE(LOWORD(g_CurrentData->GatewayUserData)),
                           (DWORD)LOBYTE(HIWORD(g_CurrentData->GatewayUserData)),
                           (DWORD)HIBYTE(HIWORD(g_CurrentData->GatewayUserData)));

    //
    // There wasn't really any error checking to do for this one
    // so just return NO_ERROR.
    //
    return NO_ERROR;
}

DWORD WINAPI InitHelperDll | ( | IN DWORD | dwNetshVersion,
 |  | OUT PVOID | pReserved
 | ) |  |

Definition at line 251 of file nshsamp.cpp.

{
    DWORD                   dwRet;
    NS_HELPER_ATTRIBUTES    MyAttributes;

    //
    // We could also implement a DllMain to get
    // this handle.
    //
    g_hModule = GetModuleHandle(L"nshsamp.dll");

    ZeroMemory(&MyAttributes, sizeof(MyAttributes));
    MyAttributes.dwVersion      = SAMPLE_HELPER_VERSION;

    //
    // This specifies the function netsh should call to
    // initialize the contexts for this helper.  We'll
    // use the same function for all the helpers, because
    // we can tell based on the pguidParent arg passed
    // to StartHelpers() which helper we need to register
    // contexts for.  If necessary, use a different start
    // function for each helper.  Just set the
    // MyAttributes.pfnStart parameter before each call
    // to RegisterHelper.
    //
    MyAttributes.pfnStart       = StartHelpers;

    //
    // We'll use a generic stop function for all helpers,
    // rather than one for each for simplicity.  One for
    // each is allowed, of course.
    //
    MyAttributes.pfnStop        = GenericStopHelper;

    //
    // Set the GUID of our helper.
    //
    MyAttributes.guidHelper     = g_ObjectGuid;

    //
    // Specify g_RootGuid as the parent helper to indicate
    // that any contexts registered by this helper will be top
    // level contexts.  Note that NULL as the parent GUID means
    // the same thing.
    //
    dwRet = RegisterHelper(&g_RootGuid, &MyAttributes);
    if (NO_ERROR == dwRet)
    {
        //
        // Set the GUID of our helper.
        //
        MyAttributes.guidHelper = g_SubContext;

        //
        // We want this helper's contexts to show up as children of
        // g_ObjectGuid's context(s), so we specify it as the parent
        // helper istead of g_RootGuid.
        //
        dwRet = RegisterHelper(&g_ObjectGuid, &MyAttributes);
        if (NO_ERROR == dwRet)
        {
            //
            // Set the GUID of our helper.
            //
            MyAttributes.guidHelper = g_SampleInterface;

            //
            // Again, we want this helper's contexts to show up as children of
            // ifmon.dll's 'interface' context, so we specify it here.  To
            // see a list of all helpers, contexts, and their associated
            // GUID's, type 'show helper' within netsh.
            //
            dwRet = RegisterHelper(&g_Interface, &MyAttributes);
        }
    }
    return dwRet;
}

DWORD WINAPI StartHelpers | ( | IN CONST GUID * | pguidParent,
 |  | IN DWORD | dwVersion
 | ) |  |

Definition at line 332 of file nshsamp.cpp.

{
    BOOL                    bFoundMatch = TRUE;
    DWORD                   dwRet = ERROR_INVALID_PARAMETER;
    NS_CONTEXT_ATTRIBUTES   ContextAttributes;

    ZeroMemory(&ContextAttributes, sizeof(ContextAttributes));

    ContextAttributes.dwVersion         = SAMPLE_HELPER_VERSION;

    if (IsEqualGUID(*pguidParent, g_RootGuid))
    {
        //
        // The parent is the netsh root GUID, and the only
        // helper we have that registers root contexts is
        // the 'object' helper, so set the relevant info.
        //
        ContextAttributes.dwFlags           = 0;
        //
        // This is the default, but we are specifying for clarity.
        //
        ContextAttributes.ulPriority        = DEFAULT_CONTEXT_PRIORITY;
        ContextAttributes.pwszContext       = TOKEN_SAMPLE;
        ContextAttributes.guidHelper        = g_ObjectGuid;
        ContextAttributes.ulNumTopCmds      = sizeof(g_TopLevelCommands)/sizeof(CMD_ENTRY);
        ContextAttributes.pTopCmds          = (CMD_ENTRY (*)[])g_TopLevelCommands;
        ContextAttributes.ulNumGroups       = sizeof(g_Sample_Commands)/sizeof(CMD_GROUP_ENTRY);
        ContextAttributes.pCmdGroups        = (CMD_GROUP_ENTRY (*)[])g_Sample_Commands;
        ContextAttributes.pfnCommitFn       = CommitFn;
        ContextAttributes.pfnConnectFn      = ConnectFn;
        ContextAttributes.pfnDumpFn         = DumpSample;
        //
        // Just like commands or groups, you can specify a version
        // checking function for contexts.
        //
        ContextAttributes.pfnOsVersionCheck = CheckRunningOnWhistler;
    }
    else if (IsEqualGUID(*pguidParent, g_ObjectGuid))
    {
        //
        // The only helper we have that registers under
        // g_ObjectGuid is the 'subcontext' helper.
        //
        ContextAttributes.dwFlags           = 0;

        //
        // This is the default, but we are specifying for clarity.
        //
        ContextAttributes.ulPriority        = DEFAULT_CONTEXT_PRIORITY;

        ContextAttributes.pwszContext       = TOKEN_SUBCONTEXT;
        ContextAttributes.guidHelper        = g_SubContext;
        ContextAttributes.ulNumTopCmds      = sizeof(g_ShowError)/sizeof(CMD_ENTRY);
        ContextAttributes.pTopCmds          = (CMD_ENTRY (*)[])g_ShowError;
        ContextAttributes.ulNumGroups       = 0;
        ContextAttributes.pCmdGroups        = NULL;
        ContextAttributes.pfnCommitFn       = CommitFn;
        ContextAttributes.pfnConnectFn      = ConnectFn;
        ContextAttributes.pfnOsVersionCheck = NULL;

        //
        // We're choosing to have no dump function.
        // (There isn't really anything to dump for a
        // function that just outputs error strings.)
        //
        ContextAttributes.pfnDumpFn         = NULL;
    }
    else if (IsEqualGUID(*pguidParent, g_Interface))
    {
        //
        // The only helper we have that registers under
        // g_Interface is the 'sampleinterface' helper.
        //

        //
        // Specifies that ulPriority should be paid attention.
        //
        ContextAttributes.dwFlags           = (DWORD)CMD_FLAG_PRIORITY;

        //
        // We change the priority of this so that its dump
        // function will be called before other dump functions.
        // UlPriority of 0 is the highest priority.  This can
        // be useful if some contexts require information
        // enumerated by a different context - for example
        // the 'interface' context has a ulPriority of 10 so
        // that other contexts can use the friendly names it
        // generates.  Those friendly names would otherwise
        // be inaccessible.  Note that the ulPriority of
        // this DumpFn is 0, so if you do a dump in the 'interface'
        // context, you would see this contexts dump info before
        // interface's dump information, even though this context
        // is located in a subhelper to 'interface'.
        //
        ContextAttributes.ulPriority        = 0;
        ContextAttributes.pwszContext       = TOKEN_SAMPLEINTERFACE;
        ContextAttributes.guidHelper        = g_SampleInterface;
        ContextAttributes.ulNumTopCmds      = sizeof(g_TopLevelSubInterfaceCommands)/sizeof(CMD_ENTRY);
        ContextAttributes.pTopCmds          = (CMD_ENTRY (*)[])g_TopLevelSubInterfaceCommands;
        ContextAttributes.ulNumGroups       = sizeof(g_SampleInterface_Commands)/sizeof(CMD_GROUP_ENTRY);
        ContextAttributes.pCmdGroups        = (CMD_GROUP_ENTRY (*)[])g_SampleInterface_Commands;
        ContextAttributes.pfnCommitFn       = CommitFn;
        ContextAttributes.pfnConnectFn      = ConnectFn;
        ContextAttributes.pfnDumpFn         = DumpSampleInterface;
        ContextAttributes.pfnOsVersionCheck = NULL;
    }
    else
    {
        //
        // If netsh passed us some parent guid that we
        // haven't heard of, error out.
        //
        bFoundMatch = FALSE;
    }

    if (bFoundMatch)
    {
        dwRet = RegisterContext(&ContextAttributes);
    }

    return dwRet;
}

Variable Documentation

const GUID g_Interface = {0x0705eca1, 0x7aac, 0x11d2, {0x89, 0xdc, 0x00, 0x60, 0x08, 0xb0, 0xe5, 0xb9}}

Definition at line 39 of file nshsamp.h.

const GUID g_ObjectGuid = {0xf7e0bc27, 0xba6e, 0x4145, {0xa1, 0x23, 0x01, 0x2f, 0x19, 0x22, 0xf3, 0xf1}}

Definition at line 31 of file nshsamp.h.

const GUID g_RootGuid = NETSH_ROOT_GUID

Definition at line 40 of file nshsamp.h.

const GUID g_SampleInterface = {0xf7e0bc29, 0xba6e, 0x4145, {0xa1, 0x23, 0x01, 0x2f, 0x19, 0x22, 0xf3, 0xf1}}

Definition at line 33 of file nshsamp.h.

const GUID g_SubContext = {0xf7e0bc28, 0xba6e, 0x4145, {0xa1, 0x23, 0x01, 0x2f, 0x19, 0x22, 0xf3, 0xf1}}

Definition at line 32 of file nshsamp.h.

Generated on Wed Nov 13 2024 16:53:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/netshell/sampinterface.cpp File Reference

  • NetDS
  • netshell
Functions | Variables

sampinterface.cpp File Reference

#include "nshsamp.h"

Go to the source code of this file.

Functions

DWORD WINAPI | DumpSampleInterface (IN LPCWSTR pwszRouter, IN OUT LPWSTR *ppwcArguments, IN DWORD dwArgCount, IN LPCVOID pvData)
DWORD WINAPI | HandleSetGatewayCommand (IN LPCWSTR pwszMachine, IN OUT LPWSTR *ppwcArguments, IN DWORD dwCurrentIndex, IN DWORD dwArgCount, IN DWORD dwFlags, IN LPCVOID pvData, OUT BOOL *pbDone)
DWORD WINAPI | HandleSetInterfaceCommand (IN LPCWSTR pwszMachine, IN OUT LPWSTR *ppwcArguments, IN DWORD dwCurrentIndex, IN DWORD dwArgCount, IN DWORD dwFlags, IN LPCVOID pvData, OUT BOOL *pbDone)
DWORD WINAPI | HandleShowRandomSettingsCommand (IN LPCWSTR pwszMachine, IN OUT LPWSTR *ppwcArguments, IN DWORD dwCurrentIndex, IN DWORD dwArgCount, IN DWORD dwFlags, IN LPCVOID pvData, OUT BOOL *pbDone)

Variables

PSAMPLE_HELPER_DATA g_CurrentData
HANDLE g_hModule
SAMPLE_HELPER_DATA g_OfflineData
SAMPLE_HELPER_DATA g_OnlineData

Function Documentation

DWORD WINAPI DumpSampleInterface | ( | IN LPCWSTR | pwszRouter,
 |  | IN OUT LPWSTR * | ppwcArguments,
 |  | IN DWORD | dwArgCount,
 |  | IN LPCVOID | pvData
 | ) |  |

Definition at line 25 of file sampinterface.cpp.

{
    DWORD       dwRet;
    UINT        OSType;
    UINT        OSProductSuite;
    WCHAR       OSVersion[MAX_PATH];
    WCHAR       OSBuildNumber[MAX_PATH];
    WCHAR       ServicePackMajorVersion[MAX_PATH];
    WCHAR       ServicePackMinorVersion[MAX_PATH];
    UINT        ProcessorArchitecture;
    LPWSTR      lpArchitecture = NULL;

    //
    // This function is provided by netsh so that you can take different
    // actions in any function depending on the machine type.
    //
    dwRet = GetHostMachineInfo(
                &OSType,
                &OSProductSuite,
                OSVersion,
                OSBuildNumber,
                ServicePackMajorVersion,
                ServicePackMinorVersion,
                &ProcessorArchitecture);

    if (NO_ERROR == dwRet)
    {

        //
        // Note that these values (0 and 6) are WMI values that specify
        // the architecture.  At the time of this writing, these values
        // as listed in MSDN were off by one, ie x86 was listed as 1 and
        // IA64 was listed as 7.  The values here are the correct values
        // to check against.
        //
        switch(ProcessorArchitecture)
        {
            case 0:
                lpArchitecture = TOKEN_X86;
                break;
            case 6:
                lpArchitecture = TOKEN_IA64;
                break;
            default:
                lpArchitecture = TOKEN_UNKNOWN;
                break;
        }
    }

    LPWSTR lpPotential = 0;

    switch(g_CurrentData->Potential)
    {
        case LOW:
            lpPotential = TOKEN_LOW;
            break;
        case MEDIUM:
            lpPotential = TOKEN_MEDIUM;
            break;
        case HIGH:
            lpPotential = TOKEN_HIGH;
            break;
    }

    //
    // Output the string that shows our settings.
    // The idea here is to spit out a script that,
    // when run from the command line (netsh -f script)
    // will cause your component to be configured
    // exactly as it is when this dump command is run.
    //
    PrintMessageFromModule(g_hModule, DUMP_SAMPINTERFACE,
                           TOKEN_SET,
                           TOKEN_INTERFACE,
                           TOKEN_ID,
                           g_CurrentData->InterfaceID,
                           g_CurrentData->bEnabled ? TOKEN_ENABLED : TOKEN_DISABLED,
                           TOKEN_SUPERMETRIC,
                           g_CurrentData->Supermetric,
                           TOKEN_POTENTIAL,
                           lpPotential,
                           // Second set command starts here.
                           TOKEN_GATEWAY,
                           TOKEN_USERDATA,
                           (DWORD)LOBYTE(LOWORD(g_CurrentData->GatewayUserData)),
                           (DWORD)HIBYTE(LOWORD(g_CurrentData->GatewayUserData)),
                           (DWORD)LOBYTE(HIWORD(g_CurrentData->GatewayUserData)),
                           (DWORD)HIBYTE(HIWORD(g_CurrentData->GatewayUserData)),
                           lpArchitecture);

    return NO_ERROR;
}

DWORD WINAPI HandleSetGatewayCommand | ( | IN LPCWSTR | pwszMachine,
 |  | IN OUT LPWSTR * | ppwcArguments,
 |  | IN DWORD | dwCurrentIndex,
 |  | IN DWORD | dwArgCount,
 |  | IN DWORD | dwFlags,
 |  | IN LPCVOID | pvData,
 |  | OUT BOOL * | pbDone
 | ) |  |

Definition at line 222 of file sampinterface.cpp.

{
    DWORD dwRet = ERROR_SHOW_USAGE;
    const DWORD MAX_CMDS = 4;
    const DWORD MAX_VALUE = 255;

    DWORD dwTagType[MAX_CMDS];

    TAG_TYPE ValidCommands[] =
    {
        //
        // Specify that it is acceptable to put this token in a command
        // multiple times.
        //
        {TOKEN_USERDATA,     NS_REQ_ALLOW_MULTIPLE, FALSE}
    };

    //
    // Since our command should have an = in it, PreprocessCommand will
    // do most of the parsing for us.
    //
    dwRet = PreprocessCommand(
        0,
        ppwcArguments,
        dwCurrentIndex,
        dwArgCount,
        ValidCommands,
        sizeof(ValidCommands)/sizeof(TAG_TYPE),
        1,
        // We'll put a limit of MAX_CMDS pieces of data (so it fits in one DWORD.)
        MAX_CMDS,
        dwTagType);

    if (NO_ERROR == dwRet)
    {
        //
        // Reset GatewayUserData to 0.
        //
        g_CurrentData->GatewayUserData = 0;

        for (DWORD i = dwCurrentIndex; i < dwArgCount; i++)
        {
            //
            // If we got to this point, then we can just start converting bits of data
            // because there is only one possible argument.
            //
            DWORD dwResult = wcstoul(ppwcArguments[i], NULL, 10);
            if (dwResult > 0 && dwResult < MAX_VALUE)
            {
                //
                // Store our data in the global DWORD by bitshifting each
                // arg by (i - dwCurrentIndex) * 8 bits.  So, the first time
                // through, i - dwCurrentIndex will be 0, and the value
                // won't be shifted.  The second time through, i - dwCurrentIndex
                // is 1, so the value will be shifted left by 8 bits, which
                // when |'d with g_GatewayUserData, will store our number in the
                // second byte.
                //
                g_CurrentData->GatewayUserData |= dwResult << ((i - dwCurrentIndex) * 8);
            }
            else
            {
                dwRet = ERROR_SHOW_USAGE;
            }
        }
    }

    return dwRet;
}

DWORD WINAPI HandleSetInterfaceCommand | ( | IN LPCWSTR | pwszMachine,
 |  | IN OUT LPWSTR * | ppwcArguments,
 |  | IN DWORD | dwCurrentIndex,
 |  | IN DWORD | dwArgCount,
 |  | IN DWORD | dwFlags,
 |  | IN LPCVOID | pvData,
 |  | OUT BOOL * | pbDone
 | ) |  |

Definition at line 125 of file sampinterface.cpp.

{
    DWORD dwRet = ERROR_SHOW_USAGE;
    const DWORD MAX_CMDS = 4;
    DWORD dwTagType[MAX_CMDS];

    //
    // This command line is more complicated, and allows us
    // to show the results of using PreprocessCommand on a
    // more complicated command line.
    //

    TAG_TYPE ValidCommands[] =
    {
        {TOKEN_ID,  NS_REQ_PRESENT, FALSE},
        {TOKEN_ENABLED, NS_REQ_ZERO, FALSE},
        {TOKEN_DISABLED, NS_REQ_ZERO, FALSE},
        {TOKEN_SUPERMETRIC, NS_REQ_ZERO, FALSE},
        {TOKEN_POTENTIAL, NS_REQ_ZERO, FALSE}
    };

    dwRet = PreprocessCommand(
        0,
        ppwcArguments,
        dwCurrentIndex,
        dwArgCount,
        ValidCommands,
        sizeof(ValidCommands)/sizeof(TAG_TYPE),
        // At least two commands are required - the id specification for the interface and some other bit of data.
        2,
        MAX_CMDS,
        dwTagType);

    if (NO_ERROR == dwRet)
    {
        for (DWORD i = 0; i < (dwArgCount - dwCurrentIndex); i++)
        {
            //
            // This switch works because these were #defined to match with
            // ValidCommands above.
            //
            // #define ID                              0
            // #define ENABLED                         1
            // #define DISABLED                        2
            // #define SUPERMETRIC                     3
            // #define POTENTIAL                       4
            //

            switch (dwTagType[i])
            {
                case ID:
                    g_CurrentData->InterfaceID = wcstoul(ppwcArguments[i + dwCurrentIndex], NULL, 10);
                    break;
                case ENABLED:
                    g_CurrentData->bEnabled = TRUE;
                    break;
                case DISABLED:
                    g_CurrentData->bEnabled = FALSE;
                    break;
                case SUPERMETRIC:
                    g_CurrentData->Supermetric = wcstoul(ppwcArguments[i + dwCurrentIndex], NULL, 10);
                    break;
                case POTENTIAL:
                    if (MatchToken(ppwcArguments[i + dwCurrentIndex], TOKEN_LOW))
                    {
                        g_CurrentData->Potential = LOW;
                    }
                    else if (MatchToken(ppwcArguments[i + dwCurrentIndex], TOKEN_MEDIUM))
                    {
                        g_CurrentData->Potential = MEDIUM;
                    }
                    else if (MatchToken(ppwcArguments[i + dwCurrentIndex], TOKEN_HIGH))
                    {
                        g_CurrentData->Potential = HIGH;
                    }
                    break;
                default:
                    //
                    // Shouldn't reach this point.
                    //
                    dwRet = ERROR_INVALID_SYNTAX;
                    break;
            }
        }
    }

    return dwRet;
}

DWORD WINAPI HandleShowRandomSettingsCommand | ( | IN LPCWSTR | pwszMachine,
 |  | IN OUT LPWSTR * | ppwcArguments,
 |  | IN DWORD | dwCurrentIndex,
 |  | IN DWORD | dwArgCount,
 |  | IN DWORD | dwFlags,
 |  | IN LPCVOID | pvData,
 |  | OUT BOOL * | pbDone
 | ) |  |

Definition at line 301 of file sampinterface.cpp.

{
    LPWSTR lpPotential = 0;

    switch(g_CurrentData->Potential)
    {
        case LOW:
            lpPotential = TOKEN_LOW;
            break;
        case MEDIUM:
            lpPotential = TOKEN_MEDIUM;
            break;
        case HIGH:
            lpPotential = TOKEN_HIGH;
            break;
    }

    //
    // Output the current settings.
    //
    PrintMessageFromModule(g_hModule,
                           GEN_SAMPLEINTERFACE_SETTINGS,
                           g_CurrentData->InterfaceID,
                           g_CurrentData->bEnabled ? TOKEN_ENABLED : TOKEN_DISABLED,
                           g_CurrentData->Supermetric,
                           lpPotential);

    PrintMessageFromModule(g_hModule,
                           GEN_SAMPLEGATEWAY_SETTINGS,
                           (DWORD)LOBYTE(LOWORD(g_CurrentData->GatewayUserData)),
                           (DWORD)HIBYTE(LOWORD(g_CurrentData->GatewayUserData)),
                           (DWORD)LOBYTE(HIWORD(g_CurrentData->GatewayUserData)),
                           (DWORD)HIBYTE(HIWORD(g_CurrentData->GatewayUserData)));

    //
    // There wasn't really any error checking to do for this one
    // so just return NO_ERROR.
    //
    return NO_ERROR;
}

Variable Documentation

PSAMPLE_HELPER_DATA g_CurrentData
HANDLE g_hModule

Definition at line 33 of file main.cpp.

SAMPLE_HELPER_DATA g_OfflineData
SAMPLE_HELPER_DATA g_OnlineData
Generated on Wed Nov 13 2024 16:53:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/netshell/sample.cpp File Reference

  • NetDS
  • netshell
Functions | Variables

sample.cpp File Reference

#include "nshsamp.h"

Go to the source code of this file.

Functions

DWORD WINAPI | DumpSample (IN LPCWSTR pwszRouter, IN OUT LPWSTR *ppwcArguments, IN DWORD dwArgCount, IN LPCVOID pvData)
DWORD WINAPI | HandleAddObjectCommand (IN LPCWSTR pwszMachine, IN OUT LPWSTR *ppwcArguments, IN DWORD dwCurrentIndex, IN DWORD dwArgCount, IN DWORD dwFlags, IN LPCVOID pvData, OUT BOOL *pbDone)
DWORD WINAPI | HandleResetAllCommand (IN LPCWSTR pwszMachine, IN OUT LPWSTR *ppwcArguments, IN DWORD dwCurrentIndex, IN DWORD dwArgCount, IN DWORD dwFlags, IN LPCVOID pvData, OUT BOOL *pbDone)
DWORD WINAPI | HandleResetSprocketCommand (IN LPCWSTR pwszMachine, IN OUT LPWSTR *ppwcArguments, IN DWORD dwCurrentIndex, IN DWORD dwArgCount, IN DWORD dwFlags, IN LPCVOID pvData, OUT BOOL *pbDone)
DWORD WINAPI | HandleResetWidgetCommand (IN LPCWSTR pwszMachine, IN OUT LPWSTR *ppwcArguments, IN DWORD dwCurrentIndex, IN DWORD dwArgCount, IN DWORD dwFlags, IN LPCVOID pvData, OUT BOOL *pbDone)
DWORD WINAPI | HandleSetObjectCommand (IN LPCWSTR pwszMachine, IN OUT LPWSTR *ppwcArguments, IN DWORD dwCurrentIndex, IN DWORD dwArgCount, IN DWORD dwFlags, IN LPCVOID pvData, OUT BOOL *pbDone)
DWORD WINAPI | HandleShowObjectCommand (IN LPCWSTR pwszMachine, IN OUT LPWSTR *ppwcArguments, IN DWORD dwCurrentIndex, IN DWORD dwArgCount, IN DWORD dwFlags, IN LPCVOID pvData, OUT BOOL *pbDone)

Variables

PSAMPLE_HELPER_DATA g_CurrentData
HANDLE g_hModule
SAMPLE_HELPER_DATA g_OfflineData
SAMPLE_HELPER_DATA g_OnlineData

Function Documentation

DWORD WINAPI DumpSample | ( | IN LPCWSTR | pwszRouter,
 |  | IN OUT LPWSTR * | ppwcArguments,
 |  | IN DWORD | dwArgCount,
 |  | IN LPCVOID | pvData
 | ) |  |

Definition at line 25 of file sample.cpp.

{
    //
    // Output the string that shows our settings.
    // The idea here is to spit out a script that,
    // when run from the command line (netsh -f script)
    // will cause your component to be configured
    // exactly as it is when this dump command was run.
    //
    PrintMessageFromModule(g_hModule, DUMP_SAMP,
                           TOKEN_SET,
                           TOKEN_WIDGETS,
                           g_CurrentData->WidgetCount,
                           TOKEN_SPROCKETS,
                           g_CurrentData->SprocketCount);

    return NO_ERROR;

}

DWORD WINAPI HandleAddObjectCommand | ( | IN LPCWSTR | pwszMachine,
 |  | IN OUT LPWSTR * | ppwcArguments,
 |  | IN DWORD | dwCurrentIndex,
 |  | IN DWORD | dwArgCount,
 |  | IN DWORD | dwFlags,
 |  | IN LPCVOID | pvData,
 |  | OUT BOOL * | pbDone
 | ) |  |

Definition at line 52 of file sample.cpp.

{
    //
    // Init the return value to ERROR_SHOW_USAGE.  This value
    // if returned, will cause netsh to display the extended
    // usage for this command.  (HLP_ADD_OBJECT_EX in this case.)
    //
    DWORD dwRet = ERROR_SHOW_USAGE;

    //
    // We know the add xxxx x command has two tokens that we care
    // about - the type (widgets, sprockets, all) and the number
    // to add after the type.  From that, we know:
    // 1.  There should be 4 arguments for a valid command.  No more,
    //          no less.
    // 2.  The third arg should be one of the three type id's.
    // 3.  The fourth arg should be a number.
    //

    //
    // So, for 1, make sure we have 4 args.
    //

    if (4 == dwArgCount)
    {
        long lCountToAdd;

        //
        // We'll take care of 3 first, because we need it converted
        // to a number in any case.  CRT function WCSTOL is best to use
        // here.
        //
        if (lCountToAdd = wcstol(ppwcArguments[dwCurrentIndex + 1], NULL, 10))
        {
            //
            // For 2, we'll use MatchToken to match the tokens.
            // If we found a match, return ERROR_OKAY so that
            // netsh will output an "Ok." string to indicate
            // the command was successful.  Returning
            // ERROR_SUPPRESS_OUTPUT indicates that the command
            // was successful but netsh shouldn't output anything
            // to indicate so.
            //
            if (MatchToken(ppwcArguments[dwCurrentIndex], TOKEN_WIDGETS))
            {
                g_CurrentData->WidgetCount += lCountToAdd;
                dwRet = ERROR_OKAY;
            }
            else if(MatchToken(ppwcArguments[dwCurrentIndex], TOKEN_SPROCKETS))
            {
                g_CurrentData->SprocketCount += lCountToAdd;
                dwRet = ERROR_OKAY;
            }
            else if(MatchToken(ppwcArguments[dwCurrentIndex], TOKEN_ALL))
            {
                g_CurrentData->WidgetCount += lCountToAdd;
                g_CurrentData->SprocketCount += lCountToAdd;
                //
                // Since we are returning ERROR_SUPPRESS_OUTPUT
                // to prevent netsh's default "Ok." we will output
                // our own string instead.
                //
                PrintMessageFromModule(g_hModule, GEN_CMD_OKAY);
                dwRet = ERROR_SUPPRESS_OUTPUT;
            }
        }
        else
        {
            //
            // Put a message here telling the user what went wrong.  Note that
            // in your .rc file, you need to specify ... (ellipsis) args via
            // FormatMessage style, ie %1!s! instead of just %s.
            //
            PrintMessageFromModule(g_hModule, ERR_NO_VALID_COUNT, ppwcArguments[3]);
        }
    }
    else
    {
        PrintMessageFromModule(g_hModule, ERR_INVALID_NUM_ARGS, 3);
    }

    return dwRet;
}

DWORD WINAPI HandleResetAllCommand | ( | IN LPCWSTR | pwszMachine,
 |  | IN OUT LPWSTR * | ppwcArguments,
 |  | IN DWORD | dwCurrentIndex,
 |  | IN DWORD | dwArgCount,
 |  | IN DWORD | dwFlags,
 |  | IN LPCVOID | pvData,
 |  | OUT BOOL * | pbDone
 | ) |  |

Definition at line 406 of file sample.cpp.

{
    g_CurrentData->WidgetCount = 0;
    g_CurrentData->SprocketCount = 0;

    //
    // Carry out the command and return NO_ERROR.  Same behavior as
    // returning ERROR_SUPPRESS_OUTPUT.
    //
    return NO_ERROR;
}

DWORD WINAPI HandleResetSprocketCommand | ( | IN LPCWSTR | pwszMachine,
 |  | IN OUT LPWSTR * | ppwcArguments,
 |  | IN DWORD | dwCurrentIndex,
 |  | IN DWORD | dwArgCount,
 |  | IN DWORD | dwFlags,
 |  | IN LPCVOID | pvData,
 |  | OUT BOOL * | pbDone
 | ) |  |

Definition at line 386 of file sample.cpp.

{
    g_CurrentData->SprocketCount = 0;

    //
    // We'll carry out the command, but show what happens when
    // ERROR_INVALID_SYNTAX is returned - netsh outputs an error
    // message.
    //
    return ERROR_INVALID_SYNTAX;
}

DWORD WINAPI HandleResetWidgetCommand | ( | IN LPCWSTR | pwszMachine,
 |  | IN OUT LPWSTR * | ppwcArguments,
 |  | IN DWORD | dwCurrentIndex,
 |  | IN DWORD | dwArgCount,
 |  | IN DWORD | dwFlags,
 |  | IN LPCVOID | pvData,
 |  | OUT BOOL * | pbDone
 | ) |  |

Definition at line 358 of file sample.cpp.

{

    g_CurrentData->WidgetCount = 0;

    //
    // Carry out the command, but return ERROR_SHOW_USAGE
    // to show what happens. netsh should display the
    // HLP_RESET_OBJECT_WIDGETS_EX message.  Note that
    // the other commands in this group, "sprockets" and
    // "all" don't return ERROR_SHOW_USAGE, so there is
    // no reason to specify the extended help strings
    // (HLP_RESET_OBJECT_SPROCKETS_EX and
    // HLP_RESET_OBJECT_ALL_EX) for each command.  They are
    // #define'd though, so that the CREATE_CMD_ENTRY macros
    // will still work.
    //
    return ERROR_SHOW_USAGE;
}

DWORD WINAPI HandleSetObjectCommand | ( | IN LPCWSTR | pwszMachine,
 |  | IN OUT LPWSTR * | ppwcArguments,
 |  | IN DWORD | dwCurrentIndex,
 |  | IN DWORD | dwArgCount,
 |  | IN DWORD | dwFlags,
 |  | IN LPCVOID | pvData,
 |  | OUT BOOL * | pbDone
 | ) |  |

Definition at line 224 of file sample.cpp.

{
    DWORD dwRet;

    //
    // This command involves setting something equal to a value
    // provided by the user.  The netsh function we will use
    // to parse the command line will be PreProcessCommand,
    // which the most extensive of the argument handling
    // functions netsh offers.  The first thing to note
    // about PreprocessCommand is that it removes all identifiers
    // from your given command string.  For example, the command
    // "set widgets=10 sprockets=2", after being sent through
    // PreprocessCommand, will result in a arguments that would read
    // "set 10 2" which is much easier to.  Of course, PreprocessCommand
    // has a method for telling the caller which commands those
    // resulting numbers refer to.
    //

    //
    // First we set up our array of valid commands, note that
    // the entries are aligned so that ValidCommands[WIDGETS]
    // and ValidCommands[SPROCKETS] makes sense.
    //
    TAG_TYPE ValidCommands[] =
    {
        {TOKEN_WIDGETS,     NS_REQ_ZERO, FALSE},
        {TOKEN_SPROCKETS,   NS_REQ_ZERO, FALSE},
    };

    //
    // We'll need an array of DWORD's that is equal or larger
    // than the total number interesting arguments
    // (dwArgCount - dwCurrentIndex).  Rather than allocate memory
    // dynamically, we'll just use a stack allocated array of
    // DWORD's knowing the largest number of arguments there can be. (2)
    // easier.
    //
    const DWORD MAX_ARGS =       2;

    DWORD dwTagType[MAX_ARGS];

    //
    // Note that if there are too many or too few args for the command
    // to be valid, PreprocessCommand returns something other than
    // NO_ERROR,
    //
    dwRet = PreprocessCommand(
        0,                                      // This argument is not used; should be 0.
        ppwcArguments,                          // Argv style array (netsh passed us this.)
        dwCurrentIndex,                         // Means ppwcArguments[dwCurrentIndex] is the first argument of interest.
                                                // PpwcArguments[0] is going to be the context,
                                                // PpwcArguments[1] is the first command, 'add' in this case.
                                                // So ppwcARguments[2] is the first argument of interest.
        dwArgCount,                             // Total count of all the args in ppwcArguments.
        ValidCommands,                          // Our array of valid commands struct.
        sizeof(ValidCommands)/sizeof(TAG_TYPE), // Number of entries in the ValidCommands array.
        1,                                      // Minimum number of arguments needed to be a valid command.
        MAX_ARGS,                               // Maximum number of arguments allowed to be a valid command.
        dwTagType);                             // Array of DWORD's used to indicate which command in ValidCommands.
                                                // The token in the command line referred to.

    //
    // When the call to PreprocessCommand has returned, the values of ValidCommands[x].bPresent tell you which commands
    // were present in the command line.  Generally, you don't need to use the bPresent BOOL to process the results;
    // Rather, use bPresent to implement more advanced error handling for commands that have complicated command lines
    // (such and such arg was present, but you forgot this other arg.)
    //

    //
    // Each consecutive value in the dwTagType array refers to consecutive args in ppwcArguments starting with
    // ppwcArguments[dwCurrentIndex].  So, when PreprocessCommand returns and dwTagType[0] is 1, that means that
    // the first arg the user gave netsh was the command referred to by ValidCommands[1], or the "sprockets" command.
    // As you'll recall, since PreprocessCommand got rid of the "sprockets=" part of "sprockets=2" token, processing
    // all that remains, "2", is easy.
    //

    if (NO_ERROR == dwRet)
    {
        //
        // Change the return to ERROR_OKAY so netsh spits out confirmation if
        // everything goes ok after this point.
        //
        dwRet = ERROR_OKAY;

        //
        // For each argument..
        //
        for (DWORD i = 0; i < (dwArgCount - dwCurrentIndex); i++)
        {
            //
            // Check its corresponding value in the dwTagType array.
            //
            switch (dwTagType[i])
            {
                //
                // This works because i defined these to match with
                // ValidCommands above.
                //
                // #define WIDGETS                         0
                // #define SPROCKETS                       1
                //
                case WIDGETS:
                    g_CurrentData->WidgetCount = wcstoul(ppwcArguments[dwCurrentIndex + i], NULL, 10);
                    break;
                case SPROCKETS:
                    g_CurrentData->SprocketCount = wcstoul(ppwcArguments[dwCurrentIndex + i], NULL, 10);
                    break;
                default:
                    // Since 0 and 1 are the only valid values, means the arg wasn't recognized.
                    // Shouldn't reach this point because PreprocessCommand wouldn't have returned
                    // NO_ERROR if this was the case.
                    dwRet = ERROR_INVALID_SYNTAX;
                    break;
            }
        }
    }
    else
    {
        dwRet = ERROR_SHOW_USAGE;
    }

    return dwRet;
}

DWORD WINAPI HandleShowObjectCommand | ( | IN LPCWSTR | pwszMachine,
 |  | IN OUT LPWSTR * | ppwcArguments,
 |  | IN DWORD | dwCurrentIndex,
 |  | IN DWORD | dwArgCount,
 |  | IN DWORD | dwFlags,
 |  | IN LPCVOID | pvData,
 |  | OUT BOOL * | pbDone
 | ) |  |

Definition at line 144 of file sample.cpp.

{
    //
    // Init the return value to ERROR_SHOW_USAGE.  This value
    // will cause netsh to display the extended usage for this
    // command.
    //
    DWORD dwRet = ERROR_SHOW_USAGE;

    //
    // We only need check the first token after the command
    // (ppwcArguments[2].  We could use MatchToken like in
    // HandleAddObjectCommand, but for the purposes of showing
    // examples we'll use MatchEnumTag, though MatchEnumTag
    // isn't quite aimed towards this kind of command line
    // arrangement.  First, we initialize our valid tokens
    // struct.  This is designed to be like a C enum - each
    // identifier is associated with a value.  You send it
    // a particular argument, it returns you the value
    // associated with that argument (if its a valid argument.)
    //
    //
    TOKEN_VALUE ValidTokens[] =
    {
        {TOKEN_WIDGETS,     WIDGETS},
        {TOKEN_SPROCKETS,   SPROCKETS},
        {TOKEN_ALL,         ALL}
    };

    //
    // Make sure our arg count is correct.
    //
    if (3 == dwArgCount)
    {
        //
        // Then call MatchEnumTag with our argument of interest.
        // if NO_ERROR is returned, then MatchEnumTag must have
        // found a valid match.
        //
        DWORD dwResult = 0xffffffff;
        if (NO_ERROR == MatchEnumTag(0,
                                    ppwcArguments[dwCurrentIndex],
                                    sizeof(ValidTokens)/sizeof(TOKEN_VALUE),
                                    ValidTokens,
                                    &dwResult))
        {
            //
            // Since we found a match, assume we can return a success code
            // unless dwResult isn't 1, 2, or 3.  That shouldn't happen
            // however.
            //
            dwRet = ERROR_OKAY;
            switch(dwResult)
            {
                case WIDGETS:
                    PrintMessageFromModule(g_hModule, GEN_CURRENT_COUNT, TOKEN_WIDGETS, g_CurrentData->WidgetCount);
                    break;
                case SPROCKETS:
                    PrintMessageFromModule(g_hModule, GEN_CURRENT_COUNT, TOKEN_SPROCKETS, g_CurrentData->SprocketCount);
                    break;
                case ALL:
                    PrintMessageFromModule(g_hModule, GEN_CURRENT_COUNT, TOKEN_WIDGETS, g_CurrentData->WidgetCount);
                    PrintMessageFromModule(g_hModule, GEN_CURRENT_COUNT, TOKEN_SPROCKETS, g_CurrentData->SprocketCount);
                    break;
                default:
                    dwRet = ERROR_INVALID_SYNTAX;
            }
        }
    }
    return dwRet;
}

Variable Documentation

PSAMPLE_HELPER_DATA g_CurrentData
HANDLE g_hModule

Definition at line 33 of file main.cpp.

SAMPLE_HELPER_DATA g_OfflineData
SAMPLE_HELPER_DATA g_OnlineData
Generated on Wed Nov 13 2024 16:53:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/netshell/subcontext.cpp File Reference

  • NetDS
  • netshell
Functions | Variables

subcontext.cpp File Reference

#include "nshsamp.h"

Go to the source code of this file.

Functions

DWORD WINAPI HandleShowErrorCommand (IN LPCWSTR pwszMachine, IN OUT LPWSTR *ppwcArguments, IN DWORD dwCurrentIndex, IN DWORD dwArgCount, IN DWORD dwFlags, IN LPCVOID pvData, OUT BOOL *pbDone)

Variables

PSAMPLE_HELPER_DATA g_CurrentData
HANDLE g_hModule
SAMPLE_HELPER_DATA g_OfflineData
SAMPLE_HELPER_DATA g_OnlineData

Function Documentation

DWORD WINAPI HandleShowErrorCommand | ( | IN LPCWSTR | pwszMachine,
 |  | IN OUT LPWSTR * | ppwcArguments,
 |  | IN DWORD | dwCurrentIndex,
 |  | IN DWORD | dwArgCount,
 |  | IN DWORD | dwFlags,
 |  | IN LPCVOID | pvData,
 |  | OUT BOOL * | pbDone
 | ) |  |

Definition at line 25 of file subcontext.cpp.

{
    DWORD dwRet = ERROR_SHOW_USAGE;
    DWORD dwNumArgs = dwArgCount - dwCurrentIndex;

    //
    // If there are args for us to process..
    //
    if (dwNumArgs)
    {
        dwRet = ERROR_OKAY;

        for (DWORD i = dwCurrentIndex; i < dwArgCount; i++)
        {
            ULONG ulErrorNumber = wcstoul(ppwcArguments[i], NULL, 10);
            if (!ulErrorNumber)
            {
                ulErrorNumber = wcstoul(ppwcArguments[i], NULL, 16);
            }

            //
            // Use PrintError's first type of functionality, that being
            // printing out system error messages, be they netsh error
            // messages, (see netsh.h), ras errors, mpr errors, or win32
            // errors.
            //
            PrintMessage(L"%1!u!: ", ulErrorNumber);
            //
            // Pad the PrintError call with some extra zero's - this will prevent us from AV'ing
            // if we try to look at an error string that requires extra inputs.  (Hack, but
            // since it is expected that you know which error string you are outputting, it's
            // unavoidable.)
            //
            if (!PrintError(0, ulErrorNumber, 0, 0, 0, 0, 0, 0))
            {
                //
                // PrintError returns 0 if something didn't work (usually means
                // invalid error id), so we can use its other function, which
                // is to print out error messages from a given module.  Note that
                // this is essentially the same functionality as
                // PrintMessageFromModule.
                //
                PrintError(g_hModule, ERR_INVALID_ERROR_CODE, ulErrorNumber, ulErrorNumber);
            }
        }
    }

    return dwRet;
}

Variable Documentation

PSAMPLE_HELPER_DATA g_CurrentData
HANDLE g_hModule

Definition at line 33 of file main.cpp.

SAMPLE_HELPER_DATA g_OfflineData
SAMPLE_HELPER_DATA g_OnlineData
Generated on Wed Nov 13 2024 16:53:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Ras/ConnectionManager/cmsample.cpp File Reference

  • NetDS
  • Ras
  • ConnectionManager
Defines | Typedefs | Enumerations | Functions

cmsample.cpp File Reference

#include <windows.h>

Go to the source code of this file.

Defines

#define | CMSAMPLE_STARTING_BUF_SIZE 256
#define | MAX_CMD_ARGS 15

Typedefs

typedef enum _CMDLN_STATE | CMDLN_STATE

Enumerations

enum _CMDLN_STATE {
CS_END_SPACE, CS_BEGIN_QUOTE, CS_END_QUOTE, CS_CHAR,
CS_DONE
}

Functions

BOOL WINAPI | DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
LPSTR * GetArgV (LPSTR pszCmdLine)
BOOL | ReadProxyServerByTunnelAddressFromFile (LPCSTR pszSourceFile, LPSTR pszTunnelAddress, LPSTR *ppszProxyServer)
HRESULT WINAPI | SetProxyUsingTunnelAddress (HWND hWnd, HINSTANCE hInst, LPSTR pszArgs, DWORD nShow)
BOOL | WriteProxyServerSettingToFile (LPCSTR pszSourceFile, LPSTR pszProxyServer)

Define Documentation

#define CMSAMPLE_STARTING_BUF_SIZE 256

Definition at line 26 of file cmsample.cpp.

#define MAX_CMD_ARGS 15

Definition at line 27 of file cmsample.cpp.

Typedef Documentation

typedef enum _CMDLN_STATE CMDLN_STATE

Enumeration Type Documentation

enum _CMDLN_STATE
Enumerator:
CS_END_SPACE
CS_BEGIN_QUOTE
CS_END_QUOTE
CS_CHAR
CS_DONE

Definition at line 30 of file cmsample.cpp.

{
    CS_END_SPACE,   // handling end space
    CS_BEGIN_QUOTE, // we've encountered a begin quote
    CS_END_QUOTE,   // we've encountered an end quote
    CS_CHAR,        // we're scanning chars
    CS_DONE
} CMDLN_STATE;

Function Documentation

BOOL WINAPI DllMain | ( | HINSTANCE | hinstDLL,
 |  | DWORD | fdwReason,
 |  | LPVOID | lpvReserved
 | ) |  |

Definition at line 42 of file cmsample.cpp.

{
    return TRUE;
}

LPSTR * GetArgV ( LPSTR pszCmdLine )

Definition at line 401 of file cmsample.cpp.

{
    HANDLE hCurrentHeap = GetProcessHeap();

    if (NULL == pszCmdLine || NULL == pszCmdLine[0])
    {
        return NULL;
    }

    // Allocate Ptr array, up to MAX_CMD_ARGS ptrs
  LPSTR *ppArgV = (LPSTR *) HeapAlloc(hCurrentHeap, HEAP_ZERO_MEMORY,
                                        sizeof(LPSTR) * MAX_CMD_ARGS);

    if (NULL == ppArgV)
    {
        return NULL;
    }

    // Declare locals
    LPSTR pszCurr = NULL;
    LPSTR pszNext = NULL;
    LPSTR pszToken = NULL;
    CMDLN_STATE state;
    state = CS_CHAR;
    int ndx = 0;

    // Parse out pszCmdLine and store pointers in ppArgV
    pszCurr = pszToken = pszCmdLine;

    do
    {
        switch (*pszCurr)
        {
            case ' ':
                if (state == CS_CHAR)
                {
                    // We found a token
                    pszNext = CharNext(pszCurr);
                    *pszCurr = '\0';

                    ppArgV[ndx] = pszToken;
                    ndx++;

                    pszCurr = pszToken = pszNext;
                    state = CS_END_SPACE;
                    continue;
                }
        else
                {
                    if (state == CS_END_SPACE || state == CS_END_QUOTE)
            {
              pszToken = CharNext(pszToken);
            }
                }

                break;

            case '\"':
                if (state == CS_BEGIN_QUOTE)
                {
                    // We found a token
                    pszNext = CharNext(pszCurr);
                    *pszCurr = '\0';

                    // skip the opening quote
                    pszToken = CharNext(pszToken);

                    ppArgV[ndx] = pszToken;
                    ndx++;

                    pszCurr = pszToken = pszNext;

                    state = CS_END_QUOTE;
                    continue;
                }
                else
                {
                    state = CS_BEGIN_QUOTE;
                }
                break;

            case '\0':
                if (state != CS_END_QUOTE)
                {
                    // End of the line, set last token
                    ppArgV[ndx] = pszToken;
                }
                state = CS_DONE;
                break;

            default:
                if (state == CS_END_SPACE || state == CS_END_QUOTE)
                {
                    state = CS_CHAR;
                }
                break;
        }

        pszCurr = CharNext(pszCurr);
    } while ((state != CS_DONE) && (MAX_CMD_ARGS > ndx));

    return ppArgV;
}

BOOL ReadProxyServerByTunnelAddressFromFile | ( | LPCSTR | pszSourceFile,
 |  | LPSTR | pszTunnelAddress,
 |  | LPSTR * | ppszProxyServer
 | ) |  |

Definition at line 244 of file cmsample.cpp.

{
  BOOL bReturn = FALSE;
  BOOL bExit = FALSE;
  DWORD dwReturnedSize = 0;
  DWORD dwSize = CMSAMPLE_STARTING_BUF_SIZE;
    HANDLE hCurrentHeap = GetProcessHeap();

    // Section in Tunnel to read
    const CHAR* const c_pszTunnelAddressSection = "Tunnel Address";

    //  Check parameters
  if ((NULL == ppszProxyServer) || (NULL == pszSourceFile) ||
        (NULL == pszTunnelAddress))
  {
    return FALSE;
  }

  // Check for empty strings
  if (!(*pszSourceFile) || !(*pszTunnelAddress))
  {
    return FALSE;
  }

  // Set the incoming pointer to NULL
  *ppszProxyServer = NULL;

  // In case the original buffer size is too small, the loop will try to
    // allocate more buffer space and try to read the value until. The
  // loop will exist if the value properly fits into the buffer or the size
  // exceeds 2048.
    do
    {
        if (*ppszProxyServer)
        {
        // Free allocated memory
        HeapFree(hCurrentHeap, 0, (LPVOID)*ppszProxyServer);
        *ppszProxyServer = NULL;
        }

    // Allocate space for the ProxyServer name
        *ppszProxyServer = (LPSTR)HeapAlloc(hCurrentHeap, HEAP_ZERO_MEMORY,
                                            dwSize);  //ANSI - char == byte

        if (*ppszProxyServer)
        {
      // Since memory allocation succeeded, read the value from the
            // settings file
            dwReturnedSize = GetPrivateProfileString(c_pszTunnelAddressSection,
                                            pszTunnelAddress,  "",
                                            *ppszProxyServer, dwSize,
                                            pszSourceFile);

      // Check if the value fits into the buffer
            if ((dwReturnedSize == (dwSize - 2))  ||
                (dwReturnedSize == (dwSize - 1)))
            {
                //  The buffer is too small, lets allocate a bigger one
                dwSize = 2*dwSize;
                if (dwSize > 2048)
                {
                    // Allocation above 2K, need to exit
          HeapFree(hCurrentHeap, 0, (LPVOID)*ppszProxyServer);
          *ppszProxyServer = NULL;
          goto exit;
                }
            }
            else if (0 == dwReturnedSize)
            {
                //  Either we got an error, or more likely there was no data
                //  to get
        HeapFree(hCurrentHeap, 0, (LPVOID)*ppszProxyServer);
                *ppszProxyServer = NULL;
                goto exit;
            }
            else
            {
        // The function read in the data correctly. Just return.
                return TRUE;
            }
        }
        else
        {
            bExit = TRUE;
        }

    } while (!bExit);

exit:
  return bReturn;
}

HRESULT WINAPI SetProxyUsingTunnelAddress | ( | HWND | hWnd,
 |  | HINSTANCE | hInst,
 |  | LPSTR | pszArgs,
 |  | DWORD | nShow
 | ) |  |

Definition at line 68 of file cmsample.cpp.

{
    // If we wanted to fail the connection we would return E_FAIL, since we
    // still want to connect even if this custom action fails, we just return S_FALSE (by default)
    // or S_OK in a successful case
    HRESULT hr = S_FALSE;
    LPSTR* ArgV = NULL;
    LPSTR pszServiceDir = NULL;
    LPSTR pszTunnelAddress = NULL;
    LPSTR pszProxyFile = NULL;
    LPSTR pszTunnelFile = NULL;
    LPSTR pszTunnelSettingFilePath = NULL;
    LPSTR pszProxyFilePath = NULL;
    LPSTR pszProxyServer = NULL;
    DWORD dwTunnelPathLen = 0;
    DWORD dwProxyPathLen = 0;
    HANDLE hCurrentHeap = GetProcessHeap();
    int i = 0;
    DWORD lcid = 0;

  //  Parse out the command line parameters
  //  command line is of the form:
    //      /ServiceDir %SERVICEDIR% /TunnelAddress %TUNNELADDRESS% /ProxyFile
    //          <PROXYFILE> /TunnelFile <TUNNELFILE>

  // Check if we have any arguments
    if (!pszArgs)
    {
    goto exit;
    }

  // Separate each argument in the string by '\0' and return a list of
    // pointers to each argument
    ArgV = GetArgV(pszArgs);

  // Check if we have any valid parsed arguments
    if (!ArgV)
    {
        goto exit;
    }

  // Search the command line arguments for the following switches and their
  // corresponding values. Since actual paramter value is at i+1, make sure i
    // is less than the maximum allowed parameters - 1.

    lcid = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT);

    while (ArgV[i] && ((MAX_CMD_ARGS-1) > i))
    {
        if ((CSTR_EQUAL == CompareString(lcid, NORM_IGNORECASE,  ArgV[i], -1, "/ServiceDir", -1)) && ArgV[i+1])
        {
      pszServiceDir = (ArgV[i+1]);
      i = i+2;
        }
    else if ((CSTR_EQUAL == CompareString(lcid, NORM_IGNORECASE,  ArgV[i], -1, "/TunnelAddress", -1)) && ArgV[i+1])
        {
      pszTunnelAddress = ArgV[i+1];
      i = i+2;
        }
    else if ((CSTR_EQUAL == CompareString(lcid, NORM_IGNORECASE,  ArgV[i], -1, "/ProxyFile", -1)) && ArgV[i+1])
        {
      pszProxyFile = ArgV[i+1];
      i = i+2;
        }
    else if ((CSTR_EQUAL == CompareString(lcid, NORM_IGNORECASE,  ArgV[i], -1, "/TunnelFile", -1)) && ArgV[i+1])
        {
      pszTunnelFile = ArgV[i+1];
      i = i+2;
        }
        else
        {
            //  Unknown option.
            i++;
        }
    }

  // Make sure we have values for the arguments
  if (!pszServiceDir || !pszTunnelAddress || !pszProxyFile || !pszTunnelFile)
  {
        goto exit;
  }

  // Check to see if we got zero length string values from the command line
    // arguments. Exit if that is the case.
  if (!(*pszServiceDir) || !(*pszTunnelAddress) ||
    !(*pszProxyFile) || !(*pszTunnelFile))
  {
        goto exit;
  }

  // Calculate the string size for the two paths that need to be created
  // Add 2 for the NULL and backslash
    dwTunnelPathLen = lstrlen(pszServiceDir) +  lstrlen(pszTunnelFile) + 2;
  dwProxyPathLen = lstrlen(pszServiceDir) +  lstrlen(pszProxyFile) + 2;

  // Allocate the memory
  pszTunnelSettingFilePath = (LPSTR)HeapAlloc(hCurrentHeap, HEAP_ZERO_MEMORY,
                                dwTunnelPathLen); // ANSI - char == byte
  if (!pszTunnelSettingFilePath)
  {
        goto exit;
  }

  pszProxyFilePath = (LPSTR)HeapAlloc(hCurrentHeap, HEAP_ZERO_MEMORY,
                                dwProxyPathLen);  // ANSI - char == byte
  if (!pszProxyFilePath)
  {
        goto exit;
  }

  // Since we allocated pszTunnelSettingFilePath, we know that it has enough
    // room to fit the path. Otherwise we would have to use _snprintf or wnsprintf.
    // Copy the Service directory to create the full path.
  wsprintf(pszTunnelSettingFilePath, "%s\\%s", pszServiceDir, pszTunnelFile);

    // Since we allocated pszTunnelSettingFilePath, we know that it has enough
    // room to fit the path. Otherwise we would have to use _snprintf or wnsprintf.
    //Create the full path to the Proxy file.
  wsprintf(pszProxyFilePath, "%s\\%s", pszServiceDir, pszProxyFile);

  if (ReadProxyServerByTunnelAddressFromFile(pszTunnelSettingFilePath,
                                               pszTunnelAddress,
                                               &pszProxyServer))
  {
    // Call WriteProxyServerSettingToFile - the function checks for empty
        // strings
    if(WriteProxyServerSettingToFile(pszProxyFilePath, pszProxyServer))
    {
      hr = S_OK;
    }
  }

exit:
  // Clean up allocated memory
  // Delete the argument pointers, Tunnel Server path, Proxy file path and
    // ProxyServer name pointers
    if (ArgV)
      HeapFree(hCurrentHeap, 0, (LPVOID)ArgV);

    if (pszTunnelSettingFilePath)
      HeapFree(hCurrentHeap, 0, (LPVOID)pszTunnelSettingFilePath);

    if (pszProxyFilePath)
        HeapFree(hCurrentHeap, 0, (LPVOID)pszProxyFilePath);

    if (pszProxyServer)
        HeapFree(hCurrentHeap, 0, (LPVOID)pszProxyServer);

  return hr;
}

BOOL WriteProxyServerSettingToFile | ( | LPCSTR | pszSourceFile,
 |  | LPSTR | pszProxyServer
 | ) |  |

Definition at line 353 of file cmsample.cpp.

{
  BOOL bReturn = FALSE;

    // Section in Proxy file to update
    const CHAR* const c_pszManualProxySection = "Manual Proxy";

    // Key in Proxy file to update
    const CHAR* const c_pszProxyServer = "ProxyServer";

    //  Check input params
  if ( (NULL == pszSourceFile) || (NULL == pszProxyServer))
  {
    return bReturn;
  }

  // Check for empty strings
  if (!(*pszSourceFile) || !(*pszProxyServer))
  {
    return bReturn;
  }

    //  Save the Proxy Server name to the Proxy setting file
    if (WritePrivateProfileString(c_pszManualProxySection, c_pszProxyServer,
                                  pszProxyServer, pszSourceFile))
    {
        bReturn = TRUE;
    }

  return bReturn;
}

Generated on Wed Nov 13 2024 16:53:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Ras/customdial/customdial.cpp File Reference

  • NetDS
  • Ras
  • customdial
Classes | Defines | Typedefs | Functions | Variables

customdial.cpp File Reference

#include <windows.h>
#include <windowsx.h>
#include <ras.h>
#include <raserror.h>
#include <rasdlg.h>
#include <stdio.h>
#include "resource.h"

Go to the source code of this file.

Classes

struct | _CUSTOM_DIAL_DLG_SAMPLE_
struct | _CUSTOM_ENTRY_DATA_SAMPLE_

Defines

#define | CELEMS(x) ((sizeof(x))/(sizeof(x[0])))
#define | UNICODE
#define | WINVER 0x0500

Typedefs

typedef struct
_CUSTOM_DIAL_DLG_SAMPLE_ * 		PSAMPLE_CUSTOM_DIAL_DLG
typedef struct
_CUSTOM_ENTRY_DATA_SAMPLE_ * 		PSAMPLE_CUSTOM_ENTRY_DATA
typedef struct
_CUSTOM_DIAL_DLG_SAMPLE_ 		SAMPLE_CUSTOM_DIAL_DLG
typedef struct
_CUSTOM_ENTRY_DATA_SAMPLE_ 		SAMPLE_CUSTOM_ENTRY_DATA

Functions

INT_PTR CALLBACK | CustomDialDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
INT_PTR CALLBACK | CustomEntryDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
BOOL APIENTRY | DllMain (HINSTANCE hInstance, DWORD ul_reason_for_call, LPVOID lpReserved)
void | OutputTraceString (LPTSTR lpszFormatString,...)
DWORD WINAPI | RasCustomDeleteEntryNotify (LPCTSTR lpszPhonebook, LPCTSTR lpszEntry, DWORD dwFlags)
DWORD WINAPI | RasCustomDial (HINSTANCE hInstDll, LPRASDIALEXTENSIONS lpRasDialExtensions, LPCTSTR lpszPhonebook, LPRASDIALPARAMS lpRasDialParams, DWORD dwNotifierType, LPVOID lpvNotifier, LPHRASCONN lphRasConn)
BOOL WINAPI | RasCustomDialDlg (HINSTANCE hInstDll, DWORD dwFlags, LPTSTR lpszPhonebook, LPTSTR lpszEntry, LPTSTR lpszPhoneNumber, LPRASDIALDLG lpInfo, PVOID pvInfo)
BOOL WINAPI | RasCustomEntryDlg (HINSTANCE hInstDll, LPTSTR lpszPhonebook, LPTSTR lpszEntry, LPRASENTRYDLG lpInfo)
DWORD WINAPI | RasCustomHangUp (HRASCONN hRasConn)

Variables

HANDLE g_hInstance

Define Documentation

#define CELEMS ( x ) ((sizeof(x))/(sizeof(x[0])))

Definition at line 55 of file customdial.cpp.

#define UNICODE

Definition at line 40 of file customdial.cpp.

#define WINVER 0x0500

Definition at line 35 of file customdial.cpp.

Typedef Documentation

typedef struct _CUSTOM_DIAL_DLG_SAMPLE_ * PSAMPLE_CUSTOM_DIAL_DLG
typedef struct _CUSTOM_ENTRY_DATA_SAMPLE_ * PSAMPLE_CUSTOM_ENTRY_DATA
typedef struct _CUSTOM_DIAL_DLG_SAMPLE_ SAMPLE_CUSTOM_DIAL_DLG
typedef struct _CUSTOM_ENTRY_DATA_SAMPLE_ SAMPLE_CUSTOM_ENTRY_DATA

Function Documentation

INT_PTR CALLBACK CustomDialDlgProc | ( | HWND | hwndDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 619 of file customdial.cpp.

{
    LPRASDIALDLG lpInfo = NULL;                     // pointer to RASDIALDLG structure
    static LPRASDIALPARAMS lpRasDialParams = NULL;  // pointer to RASDIALPARAMS structure
    static PSAMPLE_CUSTOM_DIAL_DLG pDialData = NULL;// pointer to SAMPLE_CUSTOM_DIAL_DLG structure
    HWND hEditBox = NULL;                           // handle to an edit box

    switch (uMsg)
    {
    case WM_INITDIALOG:
        {
            pDialData = (PSAMPLE_CUSTOM_DIAL_DLG)lParam;
            if (!pDialData) return FALSE;

            lpInfo = &(pDialData->tDialDlg);
            lpRasDialParams = &(pDialData->tDialParams);

            // set known items
            hEditBox = GetDlgItem(hwndDlg, IDC_EDIT_USERNAME);
            if (hEditBox)
            {
                Edit_LimitText(hEditBox, CELEMS(lpRasDialParams->szUserName) - 1); // Count doesn't include NULL
                Edit_SetText(hEditBox, lpRasDialParams->szUserName);
            }

            hEditBox = GetDlgItem(hwndDlg, IDC_EDIT_DOMAIN);
            if (hEditBox)
            {
                Edit_LimitText(hEditBox, CELEMS(lpRasDialParams->szDomain) - 1); // Count doesn't include NULL
                Edit_SetText(hEditBox, lpRasDialParams->szDomain);
            }

            // Move dialog and position according to structure
            // we don't take into account multiple monitors or extreme
            // cases here as this is only a quick sample

            DWORD xPos = 0;         // x coordinate position for centering
            DWORD yPos = 0;         // y coordinate position for centering

            if (lpInfo->dwFlags & RASDDFLAG_PositionDlg)
            {
                xPos = lpInfo->xDlg;
                yPos = lpInfo->yDlg;
            }
            else
            {
                RECT rectTop;         // parent rectangle used for centering
                RECT rectDlg;         // dialog rectangle used for centering

                // center window within the owner or desktop
                GetWindowRect(lpInfo->hwndOwner != NULL ? lpInfo->hwndOwner : GetDesktopWindow(), &rectTop);
                GetWindowRect(hwndDlg, &rectDlg);

                xPos = ((rectTop.left + rectTop.right) / 2) - ((rectDlg.right - rectDlg.left) / 2);
                yPos = ((rectTop.top + rectTop.bottom) / 2) - ((rectDlg.bottom - rectDlg.top) / 2);
            }

            SetWindowPos(hwndDlg, NULL, xPos, yPos, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);

            return TRUE;
        }
    case WM_COMMAND:
      switch (LOWORD(wParam))
        {
        case IDOK:
            hEditBox = GetDlgItem(hwndDlg, IDC_EDIT_USERNAME);
            if (hEditBox)
            {
                Edit_GetText(hEditBox, lpRasDialParams->szUserName, CELEMS(lpRasDialParams->szUserName));
            }

            hEditBox = GetDlgItem(hwndDlg, IDC_EDIT_PASSWORD);
            if (hEditBox)
            {
                Edit_GetText(hEditBox, lpRasDialParams->szPassword, CELEMS(lpRasDialParams->szPassword));
            }

            hEditBox = GetDlgItem(hwndDlg, IDC_EDIT_DOMAIN);
            if (hEditBox)
            {
                Edit_GetText(hEditBox, lpRasDialParams->szDomain, CELEMS(lpRasDialParams->szDomain));
            }

            EndDialog(hwndDlg, TRUE);
            return TRUE;

        case IDCANCEL:
            EndDialog(hwndDlg, FALSE);
            return TRUE;
        }
      break;
    }

    return FALSE;
}

INT_PTR CALLBACK CustomEntryDlgProc | ( | HWND | hwndDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 222 of file customdial.cpp.

{
    HWND hEditBox = NULL;                           // handle to an edit box
    HWND hComboBox = NULL;                          // handle to the combo box
    LPRASENTRYDLG lpInfo = NULL;                    // pointer to the RASENTRYDLG structure
    static LPRASENTRY lpRasEntry = NULL;            // pointer to the RASENTRY structure
    static PSAMPLE_CUSTOM_ENTRY_DATA pData = NULL;  // pointer to the SAMPLE_CUSTOM_ENTRY_DATA structure

    switch (uMsg)
    {
    case WM_INITDIALOG:
        {
            // set up the dialog and the parameters
            pData = (PSAMPLE_CUSTOM_ENTRY_DATA) lParam;
            if (!pData)
            {
                return FALSE;
            }

            lpInfo = &(pData->tEntryDlg);
            lpRasEntry = pData->ptEntry;

            hComboBox = GetDlgItem(hwndDlg, IDC_LIST_MODEMS);

            hEditBox = GetDlgItem(hwndDlg, IDC_EDIT_ENTRYNAME);
            if (hEditBox)
            {
                Edit_LimitText(hEditBox, RAS_MaxEntryName); // Count doesn't include NULL
                Edit_SetText(hEditBox, (LPTSTR)pData->szEntryName);
            }

            hEditBox = GetDlgItem(hwndDlg, IDC_EDIT_PHONENO);
            if (hEditBox)
            {
                Edit_LimitText(hEditBox, CELEMS(lpRasEntry->szLocalPhoneNumber) - 1); // Count doesn't include NULL
                Edit_SetText(hEditBox, lpRasEntry->szLocalPhoneNumber);
            }

            //
            // enumerate to get the device name to use - we'll just do modems
            //

            // first get the size of the buffer required
            LPRASDEVINFO lpRasDevInfo = NULL;   // RASDEVINFO structure pointer
            DWORD dwNumEntries = 0;             // number of entries returned
            DWORD dwSize = sizeof(RASDEVINFO);  // size of buffer
            DWORD rc = 0;                       // return code

            // Allocate buffer with space for at least one structure
            lpRasDevInfo = (LPRASDEVINFO)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwSize);
            if (NULL == lpRasDevInfo)
            {
                return FALSE;
            }

            lpRasDevInfo->dwSize = sizeof(RASDEVINFO);

            rc = RasEnumDevices(lpRasDevInfo, &dwSize, &dwNumEntries);
            if (ERROR_BUFFER_TOO_SMALL == rc)
            {
                // If the buffer is too small, free the allocated memory and allocate a bigger buffer.
                if (HeapFree(GetProcessHeap(), 0, (LPVOID)lpRasDevInfo))
                {
                    lpRasDevInfo = (LPRASDEVINFO)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwSize);
                    if (NULL == lpRasDevInfo)
                    {
                        OutputTraceString(L"--- Error allocating memory (HeapAlloc) for RASDEVINFO structures for RasEnumDevices(): %d\n", GetLastError());
                        return FALSE;
                    }

                    lpRasDevInfo->dwSize = sizeof(RASDEVINFO);

                    rc = RasEnumDevices(lpRasDevInfo, &dwSize, &dwNumEntries);
                }
                else
                {
                    // Couldn't free the memory
                    return FALSE;
                }
            }

            // Check whether RasEnumDevices succeeded
            if (ERROR_SUCCESS == rc)
            {
                lpRasDevInfo = (LPRASDEVINFO) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwSize);
                if (NULL != lpRasDevInfo)
                {
                    lpRasDevInfo->dwSize = sizeof(RASDEVINFO);

                    rc = RasEnumDevices(lpRasDevInfo, &dwSize, &dwNumEntries);
                    if (ERROR_SUCCESS == rc)
                    {
                        for (UINT i = 0; i < dwNumEntries; i++, lpRasDevInfo++)
                        {
                            if (lstrcmpi(lpRasDevInfo->szDeviceType, RASDT_Modem) == 0)
                            {
                                if (hComboBox)
                                {
                                    // add to the list
                                    ComboBox_AddString(hComboBox, lpRasDevInfo->szDeviceName);
                                }
                            }
                        }
                    }

                    HeapFree(GetProcessHeap(), 0, (LPVOID)lpRasDevInfo);
                    lpRasDevInfo = NULL;
                }
                else
                {
                    OutputTraceString(L"--- Error allocating memory (HeapAlloc) for RASDEVINFO structures for RasEnumDevices(): %d\n", GetLastError());
                }
            }

            if (hComboBox)
            {
                // select the item we have in the entry
                ComboBox_SelectString(hComboBox, -1, lpRasEntry->szDeviceName);
            }

            // move dialog and position according to structure paramters
            // NOTE: we don't take into account multiple monitors or extreme
            // cases here as this is only a quick sample

            DWORD xPos = 0;         // x coordinate position for centering
            DWORD yPos = 0;         // y coordinate position for centering

            if (lpInfo->dwFlags & RASDDFLAG_PositionDlg)
            {
                xPos = lpInfo->xDlg;
                yPos = lpInfo->yDlg;
            }
            else
            {
                RECT rectTop;         // parent rectangle used for centering
                RECT rectDlg;         // dialog rectangle used for centering

                // center window within the owner or desktop
                GetWindowRect(lpInfo->hwndOwner != NULL ? lpInfo->hwndOwner : GetDesktopWindow(), &rectTop);
                GetWindowRect(hwndDlg, &rectDlg);

                xPos = ((rectTop.left + rectTop.right) / 2) - ((rectDlg.right - rectDlg.left) / 2);
                yPos = ((rectTop.top + rectTop.bottom) / 2) - ((rectDlg.bottom - rectDlg.top) / 2);
            }

            SetWindowPos(hwndDlg, NULL, xPos, yPos, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);

            return TRUE;
        }
    case WM_COMMAND:
        switch (LOWORD(wParam))
        {
        case IDOK:
            {
            TCHAR szEntryName[RAS_MaxEntryName + 1] = {0};  // Entry name
            TCHAR szPhoneBook[MAX_PATH + 1] = {0};          // Phonebook path
            TCHAR szPhoneNumber[RAS_MaxPhoneNumber + 1] = {0};

            // copy back the phonenumber, entry name, & device name
            hEditBox = GetDlgItem(hwndDlg, IDC_EDIT_PHONENO);
            if (hEditBox)
            {
                Edit_GetText(hEditBox, lpRasEntry->szLocalPhoneNumber, CELEMS(lpRasEntry->szLocalPhoneNumber));
            }

            hEditBox = GetDlgItem(hwndDlg, IDC_EDIT_ENTRYNAME);
            if (hEditBox)
            {
                Edit_GetText(hEditBox, szEntryName, CELEMS(szEntryName));
            }

            hEditBox = GetDlgItem(hwndDlg, IDC_EDIT_PHONENO);
            if (hEditBox)
            {
                Edit_GetText(hEditBox, szPhoneNumber, CELEMS(szPhoneNumber));
            }

            hComboBox = GetDlgItem(hwndDlg, IDC_LIST_MODEMS);
            if (hComboBox)
            {
                ComboBox_GetLBText(hComboBox, ComboBox_GetCurSel(hComboBox), lpRasEntry->szDeviceName);
            }

            if (!pData) return FALSE;

            // Check entry name for validity
            lstrcpyn(szPhoneBook,  (LPTSTR)pData->szPhoneBookPath, CELEMS(szPhoneBook));
            if (RasValidateEntryName(szPhoneBook, szEntryName) == ERROR_INVALID_NAME)
            {
                MessageBox(hwndDlg, L"The Entry Name is Invalid.", L"Entry name error", MB_OK);
            }
            else
            {
                lstrcpyn(pData->szEntryName, szEntryName, CELEMS(pData->szEntryName));
                lstrcpyn(lpRasEntry->szLocalPhoneNumber, szPhoneNumber, CELEMS(lpRasEntry->szLocalPhoneNumber));

                EndDialog(hwndDlg, TRUE);
            }

            return TRUE;
            }
        case IDCANCEL:
            EndDialog(hwndDlg, FALSE);
            return TRUE;
        }
        break;
    }

    return FALSE;
}

BOOL APIENTRY DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | ul_reason_for_call,
 |  | LPVOID | lpReserved
 | ) |  |

Definition at line 101 of file customdial.cpp.

{
    // save instance handle for register/unregister functionality
    g_hInstance = hInstance;

    switch (ul_reason_for_call)
    {
    case DLL_PROCESS_ATTACH:
        DisableThreadLibraryCalls(hInstance);
        OutputTraceString(L"CustomDial DLLMain (instance: 0x%08x) called - Process Attach\n", hInstance);
        break;
    case DLL_THREAD_ATTACH:
        OutputTraceString(L"CustomDial DLLMain (instance: 0x%08x) called - Thread Attach\n", hInstance);
        break;
    case DLL_THREAD_DETACH:
        OutputTraceString(L"CustomDial DLLMain (instance: 0x%08x) called - Thread Detach\n", hInstance);
        break;
    case DLL_PROCESS_DETACH:
        OutputTraceString(L"CustomDial DLLMain (instance: 0x%08x) called - Process Detach\n", hInstance);
        break;
    }

    return TRUE;
}

void OutputTraceString | ( | LPTSTR | lpszFormatString,
 |  |  | ...
 | ) |  |

Definition at line 80 of file customdial.cpp.

{
  const DWORD MAX_DEBUGSTR = 256;      // max string for ouput
  va_list arglist;                     // variable argument list
  TCHAR szOutputString[MAX_DEBUGSTR];  // the string to print - limited

  // create the new string limited to the char count as indicated
  va_start(arglist, lpszFormatString);
  _vsnwprintf(szOutputString, MAX_DEBUGSTR, lpszFormatString, arglist);
  va_end(arglist);

  // send it out
  OutputDebugString(szOutputString);
}

DWORD WINAPI RasCustomDeleteEntryNotify | ( | LPCTSTR | lpszPhonebook,
 |  | LPCTSTR | lpszEntry,
 |  | DWORD | dwFlags
 | ) |  |

Definition at line 857 of file customdial.cpp.

{
    DWORD rc = NO_ERROR;     // return code

    OutputTraceString(L"RasCustomDeleteEntryNotify called in customdial.dll\n");

    // just forward the request on - one could do more custom delete stuff here
    rc = RasDeleteEntry(lpszPhonebook, lpszEntry);

    OutputTraceString(L"RasCustomDeleteEntryNotify exiting customdial.dll with return code: %d\n");

    return rc;
}

DWORD WINAPI RasCustomDial | ( | HINSTANCE | hInstDll,
 |  | LPRASDIALEXTENSIONS | lpRasDialExtensions,
 |  | LPCTSTR | lpszPhonebook,
 |  | LPRASDIALPARAMS | lpRasDialParams,
 |  | DWORD | dwNotifierType,
 |  | LPVOID | lpvNotifier,
 |  | LPHRASCONN | lphRasConn
 | ) |  |

Definition at line 139 of file customdial.cpp.

{
    DWORD rc = ERROR_SUCCESS;             // return code from RasDial
    RASDIALEXTENSIONS RasDialExtensions;  // used as a copy of the RasDialExtensions structure

    OutputTraceString(L"RasCustomDial called in customdial.dll\n");

    if (NULL == lpRasDialParams)
    {
        return ERROR_UNKNOWN;
    }

    // set up the RasDialExtensions structure appropriately
    if (NULL == lpRasDialExtensions)
    {
        ZeroMemory(&RasDialExtensions, sizeof(RASDIALEXTENSIONS));
        RasDialExtensions.dwSize = sizeof(RASDIALEXTENSIONS);
    }
    else
    {
        CopyMemory(&RasDialExtensions, lpRasDialExtensions, sizeof(RASDIALEXTENSIONS));
    }

    RasDialExtensions.dwfOptions |= RDEOPT_CustomDial; // added cause we are calling RasDial

    OutputTraceString(L"--- RasCustomDial RasDialParams: E: '%s' UN: '%s' D: '%s'\n",
        lpRasDialParams->szEntryName,
        lpRasDialParams->szUserName,
        lpRasDialParams->szDomain);

    // Simply call RasDial with the modified RasDialExtensions structure
    // and the original parameters passed in.
    // We are passing  lpvNotifier & lphRasConn directly into RasDial. Since we don't use these variable
    // locally we skip checking for NULLs.
    rc = RasDial(&RasDialExtensions, lpszPhonebook, lpRasDialParams, dwNotifierType, lpvNotifier, lphRasConn);

    OutputTraceString(L"--- RasCustomDial returning handle 0x%08x\n", *lphRasConn);
    OutputTraceString(L"RasCustomDial exiting customdial.dll with return code: %d\n", rc);

    return rc;
}

BOOL WINAPI RasCustomDialDlg | ( | HINSTANCE | hInstDll,
 |  | DWORD | dwFlags,
 |  | LPTSTR | lpszPhonebook,
 |  | LPTSTR | lpszEntry,
 |  | LPTSTR | lpszPhoneNumber,
 |  | LPRASDIALDLG | lpInfo,
 |  | PVOID | pvInfo
 | ) |  |

Definition at line 729 of file customdial.cpp.

{
    DWORD rc = 0;               // return code
    HRASCONN hRasConn = NULL;
    DWORD dwSize = 0;
    PSAMPLE_CUSTOM_DIAL_DLG pDialData = NULL;
    RASDIALPARAMS RasDialParams;

    OutputTraceString(L"RasCustomDialDlg called in customdial.dll\n");

    if (!lpInfo)
    {
        return FALSE;
    }

    // set up the RasDialParams structure with information passed in
    ZeroMemory(&RasDialParams, sizeof(RASDIALPARAMS));
    RasDialParams.dwSize = sizeof(RASDIALPARAMS);
    lstrcpyn(RasDialParams.szEntryName, lpszEntry, CELEMS(RasDialParams.szEntryName));

    if (lpszPhoneNumber != NULL)
    {
        lstrcpyn(RasDialParams.szPhoneNumber, lpszPhoneNumber, CELEMS(RasDialParams.szPhoneNumber));
    }

    // pull information from the Entry for the dialog
    if (lpszEntry != NULL)
    {
        BOOL bPassword;

        if (rc = RasGetEntryDialParams(lpszPhonebook, &RasDialParams, &bPassword) != SUCCESS)
        {
            OutputTraceString(L"--- Error retrieving Entry Dial Parameters: %d\n", rc);
        }
        else
        {
            OutputTraceString(L"--- RasGetEntryDialParams: UN: '%s' D: '%s'\n",
                              RasDialParams.szUserName,
                              RasDialParams.szDomain);
        }
    }

    // display dialog - passing in structure of data that the dialog needs
    // so we can get the username, password and domain information

    // first build the buffer of data to pass
    dwSize = sizeof(SAMPLE_CUSTOM_DIAL_DLG);
    pDialData = (PSAMPLE_CUSTOM_DIAL_DLG) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwSize);
    if (pDialData != NULL)
    {
        CopyMemory(&(pDialData->tDialParams), &RasDialParams, sizeof(pDialData->tDialParams));
        CopyMemory(&(pDialData->tDialDlg), lpInfo, sizeof(pDialData->tDialDlg));

        rc = DialogBoxParam(hInstDll, MAKEINTRESOURCE(IDD_CUSTOMDIALDLG), lpInfo->hwndOwner, CustomDialDlgProc, (LPARAM) pDialData);
        if (rc > 0)   // dialog succeeded
        {
            // copy the results back of dialog entry back into stack variable
            CopyMemory(&RasDialParams, &(pDialData->tDialParams), sizeof(RASDIALPARAMS));

            // call the RasCustomDial since we just need it to do the same thing anyway but
            // one would probably call their own custom dialer here or forward to RasDial using
            // another window for connection status.
            rc = RasCustomDial(hInstDll, NULL, lpszPhonebook, &RasDialParams, 0, 0, &hRasConn);

            if (rc != 0)
            {
                // hang-up on error
                RasCustomHangUp(hRasConn);
                lpInfo->dwError = rc;
                rc = 0;     // return 0 on failure and set error info
            }
            else
            {
                // set the Entry Dial Params since we succeeded the dial
                if (rc = RasSetEntryDialParams(lpszPhonebook, &RasDialParams, TRUE) != SUCCESS)
                {
                    OutputTraceString(L"--- Error setting Entry Dial Parameters: %d\n", rc);
                }

                rc = 1;     // return >0 on success for the entire call
            }
        }
        else
        {
            lpInfo->dwError = GetLastError();
            OutputTraceString(L"--- DialogBox Failed (or cancelled) in RasCustomDialDlg (GetLastError = %d)\n", lpInfo->dwError);
            rc = 0;
        }

        // Clear out password from memory
        ZeroMemory(&(pDialData->tDialParams.szPassword), sizeof(pDialData->tDialParams.szPassword));

        HeapFree(GetProcessHeap(), 0, (LPVOID)pDialData);
        pDialData = NULL;
    }
    else
    {
        OutputTraceString(L"--- Memory allocation failed (HeapAlloc) in RasCustomDialDlg (GetLastError = %d)\n", GetLastError());
        rc = ERROR_OUTOFMEMORY;
    }

    // Clear out structures in order to clear up the password from memory
    ZeroMemory(&RasDialParams, sizeof(RASDIALPARAMS));

    OutputTraceString(L"RasCustomDialDlg exiting customdial.dll with return code: %d\n", rc);

    return rc;
}

BOOL WINAPI RasCustomEntryDlg | ( | HINSTANCE | hInstDll,
 |  | LPTSTR | lpszPhonebook,
 |  | LPTSTR | lpszEntry,
 |  | LPRASENTRYDLG | lpInfo
 | ) |  |

Definition at line 450 of file customdial.cpp.

{
    DWORD rc = 0;           // return code
    DWORD dwSize = 0;       // size of buffer
    //RASENTRY RasEntry;      // Ras Entry structure
    PSAMPLE_CUSTOM_ENTRY_DATA pEntryData = NULL;    // pointer to allocated strucutre for passing data
    LPRASENTRY pLocalRE = NULL;
    LPRASENTRY pMemberRE = NULL;

    OutputTraceString(L"RasCustomEntryDlg called in customdial.dll\n");

    // Check input parameters
    if (!lpszEntry || !lpInfo)
    {
        return FALSE;
    }

    // create buffer of data to move back and forth between dialog
    dwSize = sizeof(SAMPLE_CUSTOM_ENTRY_DATA);

    pEntryData = (PSAMPLE_CUSTOM_ENTRY_DATA)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwSize);
    if (pEntryData)
    {
        CopyMemory(&(pEntryData->tEntryDlg), lpInfo, sizeof(RASENTRYDLG));

        dwSize = sizeof(RASENTRY);

        pLocalRE = (LPRASENTRY)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwSize);
        if (NULL == pLocalRE)
        {
            return FALSE;
        }

        // get the other parameters for the entry (phone and Device Name)

        pLocalRE->dwSize = dwSize;

        rc = RasGetEntryProperties(lpszPhonebook, lpszEntry, pLocalRE, &dwSize, NULL, NULL);
        if (ERROR_BUFFER_TOO_SMALL == rc)
        {
            if (HeapFree(GetProcessHeap(), 0, (LPVOID)pLocalRE))
            {
                pLocalRE = (LPRASENTRY)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwSize);

                if (NULL == pLocalRE)
                {
                    return FALSE;
                }
            }
            else
            {
                return FALSE;
            }

            // get the other parameters for the entry (phone and Device Name)

            pLocalRE->dwSize = dwSize;
            rc = RasGetEntryProperties(lpszPhonebook, lpszEntry, pLocalRE, &dwSize, NULL, NULL);
        }

        pMemberRE = (LPRASENTRY)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwSize);
        if (NULL == pMemberRE)
        {
            HeapFree(GetProcessHeap(), 0, (LPVOID)pMemberRE);
            return FALSE;
        }

        // Set size and save pointer into structure
        pMemberRE->dwSize = dwSize;
        pEntryData->ptEntry = pMemberRE;
        pMemberRE = NULL;

        if (ERROR_SUCCESS == rc)
        {
            CopyMemory(pEntryData->ptEntry, pLocalRE , pEntryData->ptEntry->dwSize);
        }
        else
        {
            MessageBox(NULL, L"Copy Memory failed", L"Error", MB_OK);
        }

        lstrcpyn(pEntryData->szEntryName, lpszEntry, CELEMS(pEntryData->szEntryName));
        lstrcpyn(pEntryData->szPhoneBookPath, lpszPhonebook, CELEMS(pEntryData->szPhoneBookPath));

        OutputTraceString(L"--- Call Custom Entry Dialog\n");

        rc = DialogBoxParam(hInstDll, MAKEINTRESOURCE(IDD_CUSTOMENTRYDLG), lpInfo->hwndOwner, CustomEntryDlgProc, (LPARAM) pEntryData);

        OutputTraceString(L"--- Return from Custom Entry Dialog: %d\n", rc);

        if (rc > 0)   // dialog succeeded
        {
            // copy entry name into lpInfo structure for return
            lstrcpyn(lpInfo->szEntry, (LPTSTR) pEntryData->szEntryName, CELEMS(lpInfo->szEntry));

            // check to see if anything has changed and change the entry
            LPRASENTRY lpRasEntry = pEntryData->ptEntry;

            if ((lstrcmpi(pLocalRE->szLocalPhoneNumber, lpRasEntry->szLocalPhoneNumber) != 0) ||
                (lstrcmpi(pLocalRE->szDeviceName, lpRasEntry->szDeviceName) != 0) ||
                (lstrcmpi(lpInfo->szEntry, lpszEntry) != 0))
            {
                OutputTraceString(L"--- Calling RasSetEntryProperties to make changes\n");
                if (rc = RasSetEntryProperties(lpszPhonebook, lpInfo->szEntry, lpRasEntry, lpRasEntry->dwSize, NULL, 0) != SUCCESS)
                {
                    OutputTraceString(L"--- RasSetEntryProperties() failed: %d\n", rc);
                    lpInfo->dwError = rc;
                    rc = FALSE;
                }
                else
                {
                    OutputTraceString(L"--- RasSetEntryProperties() succeeded.\n", rc);
                    rc = TRUE;
                }
            }
            else
            {
                rc = TRUE;
            }
        }
        else
        {
            lpInfo->dwError = GetLastError();
            OutputTraceString(L"DialogBox Failed (or cancelled) in RasCustomEntryDlg (GetLastError = %d)\n", lpInfo->dwError);
            rc = FALSE;
        }

        if (pLocalRE)
        {
            HeapFree(GetProcessHeap(), 0, (LPVOID)pLocalRE);
            pLocalRE = NULL;
        }

        if (pEntryData->ptEntry)
        {
            HeapFree(GetProcessHeap(), 0, (LPVOID)pEntryData->ptEntry);
            pEntryData->ptEntry = NULL;
        }

        HeapFree(GetProcessHeap(), 0, (LPVOID)pEntryData);
        pEntryData = NULL;

    }
    else
    {
        OutputTraceString(L"--- Memory allocation failed (HeapAlloc) in RasCustomEntryDlg (GetLastError = %d)\n", GetLastError());
    }

    OutputTraceString(L"RasCustomEntryDlg exiting customdial.dll with return code: %d\n", rc);

    return rc;
}

DWORD WINAPI RasCustomHangUp ( HRASCONN hRasConn )

Definition at line 198 of file customdial.cpp.

{
    DWORD rc = SUCCESS;     // return code

    OutputTraceString(L"RasCustomHangUp called in customdial.dll\n");
    OutputTraceString(L"--- RasCustomHangUp on handle 0x%08x\n", hRasConn);

    // simply call RasHangUp on the handle
    rc = RasHangUp(hRasConn);

    OutputTraceString(L"RasCustomHangUp exiting customdial.dll with return code: %d\n", rc);

    return rc;
}

Variable Documentation

HANDLE g_hInstance

Definition at line 52 of file customdial.cpp.

Generated on Wed Nov 13 2024 16:53:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Ras/customdial/customdialreg.cpp File Reference

  • NetDS
  • Ras
  • customdial
Defines | Functions | Variables

customdialreg.cpp File Reference

#include <windows.h>
#include <ras.h>
#include <raserror.h>

Go to the source code of this file.

Defines

#define | RASCUSTOMDIAL_ENTRYNAME L"Steelhead"
#define | RASCUSTOMDIAL_KEYPATH L"SYSTEM\\CurrentControlSet\\Services\\Rasman\\Parameters"
#define | RASCUSTOMDIAL_PHONENO L"29719"
#define | RASCUSTOMDIAL_VALUENAME L"CustomDLL"
#define | UNICODE
#define | WINVER 0x0500

Functions

TCHAR * | CheckForSelf (LPCTSTR pSrc, LPBYTE pDest, DWORD dwBufLen)
BOOL | CreateTestEntry (LPCTSTR szDLLPath)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)
void | OutputTraceString (LPTSTR lpszFormatString,...)

Variables

HANDLE g_hInstance

Define Documentation

#define RASCUSTOMDIAL_ENTRYNAME L"Steelhead"

Definition at line 34 of file customdialreg.cpp.

#define RASCUSTOMDIAL_KEYPATH L"SYSTEM\\CurrentControlSet\\Services\\Rasman\\Parameters"

Definition at line 32 of file customdialreg.cpp.

#define RASCUSTOMDIAL_PHONENO L"29719"

Definition at line 35 of file customdialreg.cpp.

#define RASCUSTOMDIAL_VALUENAME L"CustomDLL"

Definition at line 33 of file customdialreg.cpp.

#define UNICODE

Definition at line 24 of file customdialreg.cpp.

#define WINVER 0x0500

Definition at line 23 of file customdialreg.cpp.

Function Documentation

TCHAR * CheckForSelf | ( | LPCTSTR | pSrc,
 |  | LPBYTE | pDest,
 |  | DWORD | dwBufLen
 | ) |  |

Definition at line 169 of file customdialreg.cpp.

{
  DWORD dwLen = 0;  // length of the buffer
  TCHAR * p;        // pointer into the buffer

  // loop through the buffer up to the length
  while (dwLen < dwBufLen)
    {
    p = (LPTSTR) &pDest[dwLen];   // get out string

    if (lstrcmpi(pSrc, p) == 0)   // check it
      return p;

    // go past string we just checked + the terminating '\0'
    dwLen = dwLen + ((lstrlen(p) + 1) * sizeof(TCHAR));
    }

  return NULL;      // string was not found
}

BOOL CreateTestEntry ( LPCTSTR szDLLPath )

Definition at line 48 of file customdialreg.cpp.

{
  DWORD rc;               // return code from function calls
  DWORD dwSize;           // structure size
  RASENTRY *RasEntry = NULL;      // Ras Entry structure
  BOOL bResult = TRUE;    // return for the function
  RasEntry = (RASENTRY *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
    sizeof(RASENTRY));

  OutputTraceString(L"CreateTestEntry called in customdial.dll\n");
  rc = RasGetEntryProperties(NULL, L"", RasEntry, &dwSize, NULL, NULL);
  while (rc == ERROR_BUFFER_TOO_SMALL) {
  RasEntry = (RASENTRY *) HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
    RasEntry, dwSize);
  rc = RasGetEntryProperties(NULL, L"", RasEntry, &dwSize, NULL, NULL);
  }
  // Initialize the RASENTRY structure.
  RasEntry->dwSize = dwSize;

  // Validate the format of the connection entry name.
  rc = RasValidateEntryName(NULL, RASCUSTOMDIAL_ENTRYNAME);
  if (rc == ERROR_INVALID_NAME)
    {
    OutputTraceString(L"--- RasValidateEntryName returned invalid name in CreateTestEntry: %d\n", rc);
    bResult = FALSE;
    }
  else if (rc == ERROR_ALREADY_EXISTS)
    {
    rc = RasGetEntryProperties(NULL, RASCUSTOMDIAL_ENTRYNAME, RasEntry, &dwSize, NULL, NULL);
 while (rc == ERROR_BUFFER_TOO_SMALL) {
  RasEntry = (RASENTRY *) HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
    RasEntry, dwSize);
  rc = RasGetEntryProperties(NULL, RASCUSTOMDIAL_ENTRYNAME, RasEntry, &dwSize, NULL, NULL);
  }
    if (rc != ERROR_SUCCESS)
      {
      OutputTraceString(L"--- RasGetEntryProperties failed in CreateTestEntry: %d\n", rc);
      bResult = FALSE;
      }
    else
      // Just modify the existing entry to make sure DLL is set
      lstrcpy(RasEntry->szCustomDialDll, szDLLPath);
    }
  else
    {
    rc = RasGetEntryProperties(NULL, L"", RasEntry, &dwSize, NULL, NULL);

    if (rc != ERROR_SUCCESS)
      {
      OutputTraceString(L"--- RasGetEntryProperties failed in CreateTestEntry: %d\n", rc);
      bResult = FALSE;
      }
    else
      {
      // Modify the default entry
      lstrcpy(RasEntry->szLocalPhoneNumber, RASCUSTOMDIAL_PHONENO);
      lstrcpy(RasEntry->szDeviceType, RASDT_Modem);
      lstrcpy(RasEntry->szCustomDialDll, szDLLPath);

      //
      // enumerate to get the device name to use - we'll just pick one (a modem)
      //
      // first get the size of the buffer required
      LPRASDEVINFO lpRasDevInfo;
      DWORD dwNumEntries;

      RasEnumDevices(NULL, &dwSize, &dwNumEntries);
      lpRasDevInfo = (LPRASDEVINFO) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwSize);
      if (lpRasDevInfo == NULL)
        {
        OutputTraceString(L"--- HeapAlloc failed in CreateTestEntry (GetLastError = %d)\n", GetLastError());
        bResult = FALSE;
        }
      else
        {
        lpRasDevInfo->dwSize = sizeof(RASDEVINFO);

        rc = RasEnumDevices(lpRasDevInfo, &dwSize, &dwNumEntries);
        if (rc != ERROR_SUCCESS)
          {
          OutputTraceString(L"--- RasEnumDevices failed in CreateTestEntry: %d", rc);
          bResult = FALSE;
          }
        else
          {
          for (UINT i=0; i < dwNumEntries; i++, lpRasDevInfo++)
            {
            if (lstrcmpi(lpRasDevInfo->szDeviceType, RASDT_Modem) == 0)
              {
              OutputTraceString(L"-- Modem device: %s\n", lpRasDevInfo->szDeviceName);
              lstrcpy(RasEntry->szDeviceName, lpRasDevInfo->szDeviceName);
              break;
              }
            }
          }

        HeapFree(GetProcessHeap(), 0, lpRasDevInfo);
        }
      }
    }

  // write the phonebook entry.
  rc = RasSetEntryProperties(NULL, RASCUSTOMDIAL_ENTRYNAME, RasEntry, sizeof(RASENTRY), NULL, 0);
  if (rc != ERROR_SUCCESS)
    {
    OutputTraceString(L"--- RasSetEntryProperties failed in CreateTestEntry: %d\n", rc);
    bResult = FALSE;
    }

  OutputTraceString(L"CreateTestEntry exiting customdial.dll\n");

  return bResult;
}

STDAPI DllRegisterServer ( void )

Definition at line 205 of file customdialreg.cpp.

{
  HRESULT hr = E_UNEXPECTED;    // return code
  HKEY hKey;                    // handle to open registry key
  TCHAR wszPath[MAX_PATH];      // full path to this DLL

  OutputTraceString(L"DllRegisterServer called in customdial.dll\n");

  // get the path to this DLL
  GetModuleFileName((HMODULE) g_hInstance, wszPath, MAX_PATH);

  // open registry for reading/writing
  if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, RASCUSTOMDIAL_KEYPATH,
               0, KEY_ALL_ACCESS, &hKey) == ERROR_SUCCESS)
    {
    // read in current value
    DWORD dwSize = 0;     // size of buffer for reading registry
    DWORD dwBufSize = 0;  // size of buffer for writing to registry
    DWORD dwType;         // type of buffer
    LPBYTE buffer = NULL; // the buffer

    __try
      {
      // obtain current value size
      RegQueryValueEx(hKey, RASCUSTOMDIAL_VALUENAME, NULL, &dwType, NULL, &dwSize);

      // allocate buffer to read (and write) all NULLs will be there
      if (dwSize > 0)
        dwBufSize = dwSize + (lstrlen(wszPath) * sizeof(TCHAR)) + sizeof(TCHAR);   // should be terminated in a \0
      else
        dwBufSize = (lstrlen(wszPath) * sizeof(TCHAR)) + (2 * sizeof(TCHAR));   // should be terminated in a \0\0 pair

      buffer = (LPBYTE) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY | HEAP_GENERATE_EXCEPTIONS, dwBufSize);

      // read it if dwSize was > 0
      if (dwSize > 0)
        {
        if (RegQueryValueEx(hKey, RASCUSTOMDIAL_VALUENAME, NULL, &dwType, buffer, &dwSize) != ERROR_SUCCESS)
          return hr;    // force to finally block via AbnormalTermination
        }

      // if it isn't there add it in
      if (CheckForSelf(wszPath, buffer, dwSize) == NULL)
        {
        DWORD dwBufPosition = 0;    // position of new string in the buffer

        if (dwSize > 0)
          dwBufPosition = dwSize - sizeof(TCHAR); // back off original pos

        // add to the buffer
        CopyMemory(&buffer[dwBufPosition], wszPath, lstrlen(wszPath) * sizeof(TCHAR));

        // write it
        dwType = REG_MULTI_SZ;
        if (RegSetValueEx(hKey, RASCUSTOMDIAL_VALUENAME, 0, dwType, buffer, dwBufSize) != ERROR_SUCCESS)
          return hr;    // force to finally block via AbnormalTermination
        }
      else
        __leave;      // it is already there - force to finally block normally
      }
    __finally
      {
      if (!AbnormalTermination())
        {
        hr = S_OK;
        }

      if (buffer)
        HeapFree(GetProcessHeap(), 0, buffer);

      RegCloseKey(hKey);
      } // finally block
    }

  CreateTestEntry(wszPath);

  if (hr == S_OK)
    MessageBox(NULL, L"Windows may have to be restarted for the changes to take effect.",
                     L"CustomDial DLL Sample", MB_OK);

  OutputTraceString(L"DllRegisterServer exiting customdial.dll with return code: 0x%08x\n", hr);

  return hr;
}

STDAPI DllUnregisterServer ( void )

Definition at line 301 of file customdialreg.cpp.

{
  HRESULT hr = E_UNEXPECTED;    // return code
  HKEY hKey;                    // handle to open registry key
  TCHAR wszPath[MAX_PATH];      // full path to this DLL
  DebugBreak();

  OutputTraceString(L"DllUnregisterServer called in customdial.dll\n");

  // get the path to this DLL
  GetModuleFileName((HMODULE) g_hInstance, wszPath, MAX_PATH);

  // open registry for reading/writing
  if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, RASCUSTOMDIAL_KEYPATH,
               0, KEY_ALL_ACCESS, &hKey) == ERROR_SUCCESS)
    {
    DWORD dwSize = 0;         // size of buffer for reading/writing registry
    DWORD dwType;             // type of buffer
    LPBYTE buffer = NULL;     // the buffer
    LPBYTE newBuffer = NULL;  // pointer to buffer
    TCHAR * p;                // pointer to the string in the buffer
    DWORD dwPos;              // position of string in buffer

    __try
      {
      // obtain current value size
      RegQueryValueEx(hKey, RASCUSTOMDIAL_VALUENAME, NULL, &dwType, NULL, &dwSize);

      if (dwSize > 0)
        {
        // allocate buffer to read
        buffer = (LPBYTE) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY | HEAP_GENERATE_EXCEPTIONS, dwSize);
        }
      else
        __leave;        // there's nothing there...

      // read current value
      if (RegQueryValueEx(hKey, RASCUSTOMDIAL_VALUENAME, NULL, &dwType, buffer, &dwSize) != ERROR_SUCCESS)
        return hr;    // force to finally block via AbnormalTermination

      // rebuild buffer without the string in there
      newBuffer = buffer;
      p = CheckForSelf(wszPath, newBuffer, dwSize);

      if (p == NULL)    // it's not there
        __leave;

      // determine the position of the string in the buffer, move other data
      // accordingly and adjust size
      dwPos = (LPBYTE) p - newBuffer;
      if (dwPos == 0)
        {
        // it's the beginning - just move the buffer
        newBuffer = &newBuffer[(lstrlen(p) + 1) * sizeof(TCHAR)];
        dwSize = dwSize - ((lstrlen(p) + 1) * sizeof(TCHAR));
        }
      else
        if (dwPos + (lstrlen(p) * sizeof(TCHAR)) + (2 * sizeof(TCHAR)) == dwSize)
          {
          // it's the last one - adjust size and add a double termination
          dwSize = dwSize - ((lstrlen(p) + 1) * sizeof(TCHAR));
          CopyMemory(&newBuffer[dwSize - sizeof(TCHAR)], L"\0", sizeof(TCHAR));
          }
        else
          {
          // it's in the middle - move the back to overwriting the org. position
          DWORD dwCopySize = dwSize - (dwPos + ((lstrlen(p) + 1) * sizeof(TCHAR)));
          dwSize = dwSize - ((lstrlen(p) + 1) * sizeof(TCHAR));
          CopyMemory(&newBuffer[dwPos], &newBuffer[dwPos + ((lstrlen(p) + 1) * sizeof(TCHAR))], dwCopySize);
          }

      // write it or delete it
      if (dwSize > sizeof(TCHAR))     // there is only 1 '\0' left...
        {
        dwType = REG_MULTI_SZ;
        if (RegSetValueEx(hKey, RASCUSTOMDIAL_VALUENAME, 0, dwType, newBuffer, dwSize) != ERROR_SUCCESS)
          return hr;    // force to finally block via AbnormalTermination
        }
      else
        if (RegDeleteValue(hKey, RASCUSTOMDIAL_VALUENAME) != ERROR_SUCCESS)
          return hr;    // force to finally block via AbnormalTermination
      }
    __finally
      {
      if (!AbnormalTermination())
        {
        // means there was no error during calls and we reached here via normal
        // unwrapping of the stack
        hr = S_OK;
        }

      if (buffer)
        HeapFree(GetProcessHeap(), 0, buffer);

      RegCloseKey(hKey);
      } // finally block
    }

  // remove the test entry
  if (DWORD rc = RasDeleteEntry(NULL, RASCUSTOMDIAL_ENTRYNAME) != ERROR_SUCCESS)
    OutputTraceString(L"--- RasDeleteEntry failed in DllUnregisterServer: Error = %d\n", rc);

  if (hr == S_OK)
    MessageBox(NULL, L"Windows may have to be restarted for the changes to take effect.",
                     L"CustomDial DLL Sample", MB_OK);

  OutputTraceString(L"DllUnregisterServer exiting customdial.dll with return code: 0x%08x\n", hr);

  return hr;
}

void OutputTraceString | ( | LPTSTR | lpszFormatString,
 |  |  | ...
 | ) |  |

Definition at line 80 of file customdial.cpp.

{
  const DWORD MAX_DEBUGSTR = 256;      // max string for ouput
  va_list arglist;                     // variable argument list
  TCHAR szOutputString[MAX_DEBUGSTR];  // the string to print - limited

  // create the new string limited to the char count as indicated
  va_start(arglist, lpszFormatString);
  _vsnwprintf(szOutputString, MAX_DEBUGSTR, lpszFormatString, arglist);
  va_end(arglist);

  // send it out
  OutputDebugString(szOutputString);
}

Variable Documentation

HANDLE g_hInstance

Definition at line 104 of file SServer.Cpp.

Generated on Wed Nov 13 2024 16:53:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Ras/customdial/resource.h File Reference

  • NetDS
  • Ras
  • customdial
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_EDIT_DOMAIN 1003
#define | IDC_EDIT_ENTRYNAME 1002
#define | IDC_EDIT_PASSWORD 1002
#define | IDC_EDIT_PHONENO 1000
#define | IDC_EDIT_USERNAME 1001
#define | IDC_LIST_MODEMS 1003
#define | IDD_CUSTOMDIALDLG 101
#define | IDD_CUSTOMENTRYDLG 102

Define Documentation

#define IDC_EDIT_DOMAIN 1003

Definition at line 11 of file resource.h.

#define IDC_EDIT_ENTRYNAME 1002

Definition at line 10 of file resource.h.

#define IDC_EDIT_PASSWORD 1002

Definition at line 9 of file resource.h.

#define IDC_EDIT_PHONENO 1000

Definition at line 7 of file resource.h.

#define IDC_EDIT_USERNAME 1001

Definition at line 8 of file resource.h.

#define IDC_LIST_MODEMS 1003

Definition at line 12 of file resource.h.

#define IDD_CUSTOMDIALDLG 101

Definition at line 5 of file resource.h.

#define IDD_CUSTOMENTRYDLG 102

Definition at line 6 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Ras/CustomScript/CustomEntry/customentry.c File Reference

  • NetDS
  • Ras
  • CustomScript
  • CustomEntry
Defines | Functions

customentry.c File Reference

#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
#include <ras.h>
#include <raserror.h>
#include <tchar.h>

Go to the source code of this file.

Defines

#define | _WIN32_WINNT 0x500
#define | CELEMS(x) ((sizeof(x))/(sizeof(x[0])))
#define | MAX_DEBUGSTR 256
#define | RASCUSTOMDIAL_ENTRYNAME TEXT("SDKSample")
#define | RASCUSTOMDIAL_KEYPATH "SYSTEM\\CurrentControlSet\\Services\\Rasman\\Parameters"
#define | RASCUSTOMDIAL_VALUENAME "CustomDLL"

Functions

TCHAR * | CheckForSelf (LPCTSTR pSrc, LPBYTE pDest, DWORD dwBufLen)
BOOL | CreateEntry (LPTSTR pszEntryName, LPTSTR pszPhoneNumber, LPTSTR pszDLLPath, BOOL fCustomScript)
HRESULT | CreateRegistryKey (LPTSTR pszPath)
int __cdecl | main (int argc, TCHAR *argv[])
void | OutputTraceString (LPTSTR lpszFormatString,...)
void | Usage ()

Define Documentation

#define _WIN32_WINNT 0x500

Definition at line 10 of file customentry.c.

#define CELEMS ( x ) ((sizeof(x))/(sizeof(x[0])))

Definition at line 31 of file customentry.c.

#define MAX_DEBUGSTR 256

Definition at line 43 of file customentry.c.

#define RASCUSTOMDIAL_ENTRYNAME TEXT("SDKSample")

Definition at line 42 of file customentry.c.

#define RASCUSTOMDIAL_KEYPATH "SYSTEM\\CurrentControlSet\\Services\\Rasman\\Parameters"

Definition at line 34 of file customentry.c.

#define RASCUSTOMDIAL_VALUENAME "CustomDLL"

Definition at line 35 of file customentry.c.

Function Documentation

TCHAR* CheckForSelf | ( | LPCTSTR | pSrc,
 |  | LPBYTE | pDest,
 |  | DWORD | dwBufLen
 | ) |  |

Definition at line 417 of file customentry.c.

{
    DWORD dwLen = 0;  // length of the buffer
    TCHAR * p;        // pointer into the buffer

    if (!pSrc || !pDest)
    {
        return NULL;
    }

    // loop through the buffer up to the length
    while (dwLen < dwBufLen)
    {
        p = (LPTSTR) &pDest[dwLen];   // get out string

        // Compare the strings
        if (CSTR_EQUAL == CompareString(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT),
                                        NORM_IGNORECASE,
                                        pSrc,
                                        -1,
                                        p,
                                        -1))
        {
            return p;
        }

        // go past string we just checked + the terminating '\0'
        dwLen = dwLen + ((lstrlen(p) + 1) * sizeof(TCHAR));
    }

    return NULL;      // string was not found
}

BOOL CreateEntry | ( | LPTSTR | pszEntryName,
 |  | LPTSTR | pszPhoneNumber,
 |  | LPTSTR | pszDLLPath,
 |  | BOOL | fCustomScript
 | ) |  |

Definition at line 117 of file customentry.c.

{
    DWORD rc = 0;               // return code from function calls
    DWORD dwSize = 0;           // structure size
    RASENTRY *pRasEntry = NULL; // Ras Entry structure
    BOOL bResult = FALSE;       // return value for the function
    LPRASDEVINFO lpRasDevInfo = NULL;
    LPRASDEVINFO lpRasDevInfoTemp = NULL;
    DWORD dwNumEntries = 0;
    BOOL fSuccess = FALSE;

    OutputTraceString("CreateEntry called.\n");

    if (!pszEntryName || !pszPhoneNumber || !pszDLLPath)
    {
        return FALSE;
    }

    dwSize = sizeof(RASENTRY);
    pRasEntry = (RASENTRY*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwSize);
    if (NULL == pRasEntry)
    {
        return FALSE;
    }

    // Initialize the RASENTRY structure.
    pRasEntry->dwSize = dwSize;

    // When passing in L"" as 2nd param this call populates pRasEntry with default values.
    rc = RasGetEntryProperties(NULL, "", pRasEntry, &dwSize, NULL, NULL);
    if (ERROR_BUFFER_TOO_SMALL == rc)
    {
        if (HeapFree(GetProcessHeap(), 0, (LPVOID)pRasEntry))
        {
            pRasEntry = (RASENTRY*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwSize);
            if (NULL == pRasEntry)
            {
                return FALSE;
            }
        }
        else
        {
            return FALSE;
        }

        // Initialize the RASENTRY structure.
        pRasEntry->dwSize = sizeof(RASENTRY);
        rc = RasGetEntryProperties(NULL, "", pRasEntry, &dwSize, NULL, NULL);
    }

    if (ERROR_SUCCESS != rc)
    {
        goto done;
    }

    // Modify the entry structure
    lstrcpyn(pRasEntry->szLocalPhoneNumber, pszPhoneNumber, CELEMS(pRasEntry->szLocalPhoneNumber));
    lstrcpyn(pRasEntry->szDeviceType, RASDT_Modem, CELEMS(pRasEntry->szDeviceType));
    lstrcpyn(pRasEntry->szCustomDialDll, pszDLLPath, CELEMS(pRasEntry->szCustomDialDll));

    pRasEntry->dwfOptions = 0;
    pRasEntry->dwfOptions = RASEO_PreviewPhoneNumber | RASEO_ShowDialingProgress | RASEO_PreviewUserPw | RASEO_PreviewDomain;

    if (fCustomScript)
    {
        printf("Setting RASEO_CustomScript option.\n");
        pRasEntry->dwfOptions |= RASEO_CustomScript;
    }

    pRasEntry->dwfNetProtocols = RASNP_Ip | RASNP_Ipx;
    pRasEntry->dwSubEntries = 1;
    pRasEntry->dwType =  RASET_Phone;
    pRasEntry->dwEncryptionType = ET_None;

    //
    // enumerate to get the device name to use - we'll just pick one (a modem)
    //
    // first get the size of the buffer required
    // Allocate buffer with default value
    dwSize = sizeof(RASDEVINFO);
    lpRasDevInfo = (LPRASDEVINFO)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwSize);
    if (NULL == lpRasDevInfo)
    {
        printf("HeapAlloc failed.\n");
        goto done;
    }

    lpRasDevInfo->dwSize = sizeof(RASDEVINFO);

    rc = RasEnumDevices(lpRasDevInfo, &dwSize, &dwNumEntries);

    switch(rc)   // Check whether RasEnumDevices succeeded
    {
    case ERROR_BUFFER_TOO_SMALL:
        // If the buffer is too small, free the allocated memory and allocate a bigger buffer.

        if (HeapFree(GetProcessHeap(), 0, (LPVOID)lpRasDevInfo))
        {
            lpRasDevInfo = (LPRASDEVINFO) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwSize);
            if (NULL == lpRasDevInfo)
            {
                OutputTraceString(_T("--- HeapAlloc failed in CreateTestEntry (GetLastError = %d)\n"), GetLastError());
                goto done;
            }

            lpRasDevInfo->dwSize = sizeof(RASDEVINFO);

            rc = RasEnumDevices(lpRasDevInfo, &dwSize, &dwNumEntries);
            if (ERROR_SUCCESS != rc)
            {
                OutputTraceString(_TEXT("--- RasEnumDevices failed in CreateTestEntry: %d"), rc);
                goto done;
            }

            fSuccess = TRUE;
        }
        else
        {
            OutputTraceString(_T("--- HeapFree failed in CreateTestEntry (GetLastError = %d)\n"), GetLastError());
            goto done;
        }
        break;
    case ERROR_SUCCESS:
        fSuccess = TRUE;
        break;

    default:
        printf("RasEnumDevices failed: Error = %d\n", rc);
        goto done;
    }

    lpRasDevInfoTemp = lpRasDevInfo;
    if (fSuccess)
    {
        UINT i = 0;
        for (i = 0; i < dwNumEntries; i++, lpRasDevInfoTemp++)
        {
            // See if this is a modem device
            if (CSTR_EQUAL == CompareString(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT),
                                            NORM_IGNORECASE,
                                            lpRasDevInfoTemp->szDeviceType,
                                            -1,
                                            RASDT_Modem,
                                            -1))
            {
                OutputTraceString(_TEXT("-- Modem device: %s\n"), lpRasDevInfoTemp->szDeviceName);
                lstrcpyn(pRasEntry->szDeviceName, lpRasDevInfoTemp->szDeviceName, CELEMS(pRasEntry->szDeviceName));
                break;
            }
        }
    }

    // Write the phonebook entry.
    rc = RasSetEntryProperties(NULL, pszEntryName, pRasEntry, sizeof(RASENTRY), NULL, 0);
    if (ERROR_SUCCESS != rc)
    {
        OutputTraceString(_TEXT("--- RasSetEntryProperties failed in CreateTestEntry: %d\n"), rc);
    }
    else
    {
        if (lstrlen(pszDLLPath))
        {
            OutputTraceString(_TEXT("--- Calling CreateRegistryKey\n"));
            printf("--- Calling CreateRegistryKey\n");
            bResult  = (S_OK == CreateRegistryKey(pszDLLPath)? TRUE : FALSE);
        }
        else
        {
            bResult = TRUE;
        }
    }

done:

    if (pRasEntry)
    {
        HeapFree(GetProcessHeap(), 0, (LPVOID)pRasEntry);
    }

    if (lpRasDevInfo)
    {
        HeapFree(GetProcessHeap(), 0, (LPVOID)lpRasDevInfo);
    }

    OutputTraceString(_TEXT("Exiting CreateEntry\n"));

    return bResult;
}

HRESULT CreateRegistryKey ( LPTSTR pszPath )

Definition at line 329 of file customentry.c.

{
    HRESULT hr = E_UNEXPECTED;      // return code
    HKEY hKey;                      // handle to open registry key
    LONG lRet = 0;

    OutputTraceString(_TEXT("CreateRegistryKey called.\n"));

    // open registry for reading/writing
    if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, RASCUSTOMDIAL_KEYPATH,
               0, KEY_ALL_ACCESS, &hKey) == ERROR_SUCCESS)
    {
        // read in current value
        DWORD dwSize = 0;           // size of buffer for reading registry
        DWORD dwBufSize = 0;        // size of buffer for writing to registry
        DWORD dwType = 0;           // type of buffer
        LPBYTE buffer = NULL;       // the buffer
        DWORD dwBufPosition = 0;    // position of new string in the buffer

        // obtain current value size
        RegQueryValueEx(hKey, RASCUSTOMDIAL_VALUENAME, NULL, &dwType, NULL, &dwSize);

        // allocate buffer to read (and write) all NULLs will be there
        if (dwSize > 0)
        {
            dwBufSize = dwSize + (lstrlen(pszPath) * sizeof(TCHAR)) + sizeof(TCHAR);   // should be terminated in a \0
        }
        else
        {
            dwBufSize = (lstrlen(pszPath) * sizeof(TCHAR)) + (2 * sizeof(TCHAR));   // should be terminated in a \0\0 pair
        }

        buffer = (LPBYTE) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwBufSize);

        if (!buffer)
        {
            hr = E_OUTOFMEMORY;
            return hr;
        }

        // read it if dwSize was > 0
        if (dwSize > 0)
        {
            lRet = RegQueryValueEx(hKey, RASCUSTOMDIAL_VALUENAME, NULL, &dwType, buffer, &dwSize);
            if (ERROR_SUCCESS != lRet)
            {
                hr = HRESULT_FROM_WIN32(lRet);
                goto done;
            }
        }

        // if it isn't there add it in
        if (CheckForSelf(pszPath, buffer, dwSize) == NULL)
        {
            if (dwSize > 0)
            {
                dwBufPosition = dwSize - sizeof(TCHAR); // back off original pos
            }

            // add to the buffer
            CopyMemory(&buffer[dwBufPosition], pszPath, lstrlen(pszPath) * sizeof(TCHAR));

            // write it
            dwType = REG_MULTI_SZ;

            lRet = RegSetValueEx(hKey, RASCUSTOMDIAL_VALUENAME, 0, dwType, buffer, dwBufSize);
            if (ERROR_SUCCESS != lRet)
            {
                hr = HRESULT_FROM_WIN32(lRet);
                goto done;
            }
        }

        hr = S_OK;

done:
        if (buffer)
        {
            HeapFree(GetProcessHeap(), 0, (LPVOID)buffer);
        }

        RegCloseKey(hKey);

    }

    return hr;
}

int __cdecl main | ( | int | argc,
 |  | TCHAR * | argv[]
 | ) |  |

Definition at line 45 of file customentry.c.

{
  DWORD dwErr = 0;
    TCHAR szEntryName[RAS_MaxEntryName + 1] = {0};
    TCHAR szPhoneNumber[RAS_MaxPhoneNumber + 1] = {0};
    TCHAR szCustomDLLPath[MAX_PATH + 1] = {0};
    RASENTRY rasEntry = {0};
  BOOL fRetVal = FALSE;
    BOOL fCustomScript = FALSE;

    // 1st argument is phone number, second is custom script, third is custom dial dll path
    if (3 <= argc)
    {
        if (3 == argc)
        {
            lstrcpyn(szPhoneNumber, argv[1], CELEMS(szPhoneNumber));
            fCustomScript = (BOOL)_ttol(argv[2]);
        }
        else
        {
            if (4 == argc)
            {
                lstrcpyn(szPhoneNumber, argv[1], CELEMS(szPhoneNumber));
                fCustomScript = (BOOL)_ttol(argv[2]);
                lstrcpyn(szCustomDLLPath, argv[3], CELEMS(szCustomDLLPath));
            }
            else
            {
                Usage();
                return ERROR_INVALID_PARAMETER;
            }
        }
    }
    else
    {
        Usage();
        return ERROR_INVALID_PARAMETER;
    }

    lstrcpyn(szEntryName, RASCUSTOMDIAL_ENTRYNAME, CELEMS(szEntryName));

    fRetVal = CreateEntry(szEntryName, szPhoneNumber, szCustomDLLPath, fCustomScript);

    if (fRetVal)
    {
        _tprintf(_T("Successfully created the custom entry %s \n"),szEntryName);
    }
    else
    {
        _tprintf(_T("Failed to Create the entry.\n"));
    }

    return (int)fRetVal;
}

void OutputTraceString | ( | LPTSTR | lpszFormatString,
 |  |  | ...
 | ) |  |

Definition at line 312 of file customentry.c.

{
    TCHAR szOutputString[MAX_DEBUGSTR] = {0};  // the string to print - limited
    va_list arglist;                     // variable argument list

  // create the new string limited to the char count as indicated
  va_start(arglist, lpszFormatString);
  _vsnprintf(szOutputString, MAX_DEBUGSTR, lpszFormatString, arglist);
  va_end(arglist);

  // send it out
  OutputDebugString(szOutputString);
}

void Usage ( void )

Definition at line 100 of file customentry.c.

{
    printf("PhoneNumber is required. CustomDLLPath is optional\n");
    printf("Usage : customentry <PhoneNumber> <custom_script> [<CustomDLLPath>]\n");
    printf("\ncustom_script:\n 0 - no custom script is being used.\n 1 - using custom script.\n");

    return;
}

Generated on Wed Nov 13 2024 16:53:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Ras/PhoneEntry/PhoneEntry.c File Reference

  • NetDS
  • Ras
  • PhoneEntry
Defines | Functions | Variables

PhoneEntry.c File Reference

#include <windows.h>
#include <windowsx.h>
#include <ras.h>
#include <raserror.h>
#include <commctrl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "resource.h"

Go to the source code of this file.

Defines

#define | CELEMS(x) ((sizeof(x))/(sizeof(x[0])))
#define | MAX_BUF_SIZE 256
#define | NUMBER_OF_PROPERTY_SHEETS 3
#define | STRICT

Functions

INT_PTR CALLBACK | Dlg_Proc1 (HWND, UINT, WPARAM, LPARAM)
INT_PTR CALLBACK | Dlg_Proc2 (HWND, UINT, WPARAM, LPARAM)
INT_PTR CALLBACK | Page0Proc (HWND, UINT, WPARAM, LPARAM)
INT_PTR CALLBACK | Page1Proc (HWND, UINT, WPARAM, LPARAM)
INT_PTR CALLBACK | Page2Proc (HWND, UINT, WPARAM, LPARAM)
BOOL CALLBACK | PropSheet (HWND hWnd)
int WINAPI | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)

Variables

DWORD | g_dwEntries = 0
BOOL | g_fFlag = FALSE
BOOL | g_fValidEntry = FALSE
HINSTANCE | g_hInstance = NULL
int | g_iTemp = 0
LPRASENTRY | g_lpRasEntry = NULL
LPRASDEVINFO | g_RasDevInfo = NULL
char | g_szEntryName [256] = {0}

Define Documentation

#define CELEMS ( x ) ((sizeof(x))/(sizeof(x[0])))

Definition at line 44 of file PhoneEntry.c.

#define MAX_BUF_SIZE 256

Definition at line 31 of file PhoneEntry.c.

#define NUMBER_OF_PROPERTY_SHEETS 3

Definition at line 32 of file PhoneEntry.c.

#define STRICT

Definition at line 19 of file PhoneEntry.c.

Function Documentation

INT_PTR CALLBACK Dlg_Proc1 | ( | HWND | hWnd,
 |  | UINT | uMsgID,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 95 of file PhoneEntry.c.

{
    static HWND hRadio1 = NULL;
    static HWND hRadio2 = NULL;
    static HWND hRadio3 = NULL;
    static HWND hRadio4 = NULL;
    static HWND hEdit1 = NULL;
    static HWND hEdit2 = NULL;
    static HWND hEdit3 = NULL;
    static HWND hEdit4 = NULL;
    static HWND hEdit5 = NULL;
    char buff[256];
    BYTE a, b, c, d;

    // Initialize handles for various controls
    hRadio1 = GetDlgItem(hWnd, IDC_RADIO1);
    hRadio2 = GetDlgItem(hWnd, IDC_RADIO2);
    hRadio3 = GetDlgItem(hWnd, IDC_RADIO3);
    hRadio4 = GetDlgItem(hWnd, IDC_RADIO4);
    hEdit1 = GetDlgItem(hWnd, IDC_EDIT8);
    hEdit2 = GetDlgItem(hWnd, IDC_EDIT2);
    hEdit3 = GetDlgItem(hWnd, IDC_EDIT3);
    hEdit4 = GetDlgItem(hWnd, IDC_EDIT6);
    hEdit5 = GetDlgItem(hWnd, IDC_EDIT7);

    if (!hRadio1 || !hRadio2 || !hRadio3 || !hRadio4 || !hEdit1 || !hEdit2 || !hEdit3 || !hEdit4 || !hEdit5)
    {
        return 0;
    }

    switch (uMsgID)
    {
        case WM_INITDIALOG:
            if (g_fFlag)        // Check if any phonebook entry exists
            {                   // Display parametres of the existing entry
                if (g_lpRasEntry->dwfOptions & RASEO_SpecificIpAddr)
                {
                    CheckRadioButton(hWnd, IDC_RADIO1, IDC_RADIO2, IDC_RADIO2);
                    EnableWindow(hEdit1, TRUE);

                    _snprintf(buff, CELEMS(buff), "%d.%d.%d.%d", g_lpRasEntry->ipaddr.a, g_lpRasEntry->ipaddr.b,
                        g_lpRasEntry->ipaddr.c, g_lpRasEntry->ipaddr.d);
                    SendMessage(hEdit1, WM_SETTEXT, 0, (LPARAM) (LPCTSTR) buff);
                }
                else
                {
                    CheckRadioButton(hWnd, IDC_RADIO1, IDC_RADIO2, IDC_RADIO1);
                    EnableWindow(hEdit1, FALSE);
                }

                if (g_lpRasEntry->dwfOptions & RASEO_SpecificNameServers)
                {
                    CheckRadioButton(hWnd, IDC_RADIO3, IDC_RADIO4, IDC_RADIO4);
                    EnableWindow(hEdit2, TRUE);
                    EnableWindow(hEdit3, TRUE);
                    EnableWindow(hEdit4, TRUE);
                    EnableWindow(hEdit5, TRUE);

                    _snprintf(buff, CELEMS(buff), "%d.%d.%d.%d", g_lpRasEntry->ipaddrDns.a, g_lpRasEntry->ipaddrDns.b,
                        g_lpRasEntry->ipaddrDns.c, g_lpRasEntry->ipaddrDns.d);
                    SendMessage(hEdit2, WM_SETTEXT, 0, (LPARAM) (LPCTSTR) buff);

                    _snprintf(buff, CELEMS(buff), "%d.%d.%d.%d", g_lpRasEntry->ipaddrDnsAlt.a, g_lpRasEntry->ipaddrDnsAlt.b,
                        g_lpRasEntry->ipaddrDnsAlt.c, g_lpRasEntry->ipaddrDnsAlt.d);
                    SendMessage(hEdit3, WM_SETTEXT, 0, (LPARAM) (LPCTSTR) buff);

                    _snprintf(buff, CELEMS(buff), "%d.%d.%d.%d", g_lpRasEntry->ipaddrWins.a, g_lpRasEntry->ipaddrWins.b,
                        g_lpRasEntry->ipaddrWins.c, g_lpRasEntry->ipaddrWins.d);
                    SendMessage(hEdit4, WM_SETTEXT, 0, (LPARAM) (LPCTSTR) buff);

                    _snprintf(buff, CELEMS(buff), "%d.%d.%d.%d", g_lpRasEntry->ipaddrWinsAlt.a, g_lpRasEntry->ipaddrWinsAlt.b,
                        g_lpRasEntry->ipaddrWinsAlt.c, g_lpRasEntry->ipaddrWinsAlt.d);
                    SendMessage(hEdit5, WM_SETTEXT, 0, (LPARAM) (LPCTSTR) buff);
                }
                else
                {
                    CheckRadioButton(hWnd, IDC_RADIO3, IDC_RADIO4, IDC_RADIO3);
                    EnableWindow(hEdit2, FALSE);
                    EnableWindow(hEdit3, FALSE);
                    EnableWindow(hEdit4, FALSE);
                    EnableWindow(hEdit5, FALSE);
                }

                if (g_lpRasEntry->dwfOptions & RASEO_IpHeaderCompression)
                {
                    CheckDlgButton(hWnd, IDC_CHECK7, BST_CHECKED);
                }

                if (g_lpRasEntry->dwfOptions & RASEO_RemoteDefaultGateway)
                {
                    CheckDlgButton(hWnd, IDC_CHECK8, BST_CHECKED);
                }
            }
            else
            {                   // No entry exists, display default paramters
                CheckRadioButton(hWnd, IDC_RADIO1, IDC_RADIO2, IDC_RADIO1);
                CheckRadioButton(hWnd, IDC_RADIO3, IDC_RADIO4, IDC_RADIO3);
                EnableWindow(hEdit1, FALSE);
                EnableWindow(hEdit2, FALSE);
                EnableWindow(hEdit3, FALSE);
                EnableWindow(hEdit4, FALSE);
                EnableWindow(hEdit5, FALSE);
                CheckDlgButton(hWnd, IDC_CHECK7, BST_CHECKED);
                CheckDlgButton(hWnd, IDC_CHECK8, BST_CHECKED);
            }
            break;
        case WM_CLOSE:
            EndDialog(hWnd, 0);
            break;
        case WM_COMMAND:
            switch (LOWORD(wParam))
            {
                case IDOK:
                    if (IsDlgButtonChecked(hWnd, IDC_RADIO2) == BST_CHECKED)
                    {
                        // Enable the SpecificIpAddr flag and store the
                        // IP address in RASENTRY
                        g_lpRasEntry->dwfOptions |= RASEO_SpecificIpAddr;

                        GetWindowText(GetDlgItem(hWnd, IDC_EDIT8), buff, CELEMS(buff));
                        sscanf(buff, "%d.%d.%d.%d", &a, &b, &c, &d);
                        g_lpRasEntry->ipaddr.a = a;
                        g_lpRasEntry->ipaddr.b = b;
                        g_lpRasEntry->ipaddr.c = c;
                        g_lpRasEntry->ipaddr.d = d;
                    }
                    else        // Disable the SpecificIpAddr flag
                    {
                        g_lpRasEntry->dwfOptions &= ~RASEO_SpecificIpAddr;
                    }

                    if (IsDlgButtonChecked(hWnd, IDC_RADIO4) == BST_CHECKED)
                    {
                        // Enable the SpecificNameServers flag and store
                        // the DNS, DNS Alt., WINS and WINS Alt. addresses in RASENTRY
                        g_lpRasEntry->dwfOptions |= RASEO_SpecificNameServers;

                        GetWindowText(GetDlgItem(hWnd, IDC_EDIT2), buff, CELEMS(buff));
                        sscanf(buff, "%d.%d.%d.%d", &a, &b, &c, &d);
                        g_lpRasEntry->ipaddrDns.a = a;
                        g_lpRasEntry->ipaddrDns.b = b;
                        g_lpRasEntry->ipaddrDns.c = c;
                        g_lpRasEntry->ipaddrDns.d = d;

                        GetWindowText(GetDlgItem(hWnd, IDC_EDIT3), buff, CELEMS(buff));
                        sscanf(buff, "%d.%d.%d.%d", &a, &b, &c, &d);
                        g_lpRasEntry->ipaddrDnsAlt.a = a;
                        g_lpRasEntry->ipaddrDnsAlt.b = b;
                        g_lpRasEntry->ipaddrDnsAlt.c = c;
                        g_lpRasEntry->ipaddrDnsAlt.d = d;

                        GetWindowText(GetDlgItem(hWnd, IDC_EDIT6), buff, CELEMS(buff));
                        sscanf(buff, "%d.%d.%d.%d", &a, &b, &c, &d);
                        g_lpRasEntry->ipaddrWins.a = a;
                        g_lpRasEntry->ipaddrWins.b = b;
                        g_lpRasEntry->ipaddrWins.c = c;
                        g_lpRasEntry->ipaddrWins.d = d;

                        GetWindowText(GetDlgItem(hWnd, IDC_EDIT7), buff, CELEMS(buff));
                        sscanf(buff, "%d.%d.%d.%d", &a, &b, &c, &d);
                        g_lpRasEntry->ipaddrWinsAlt.a = a;
                        g_lpRasEntry->ipaddrWinsAlt.b = b;
                        g_lpRasEntry->ipaddrWinsAlt.c = c;
                        g_lpRasEntry->ipaddrWinsAlt.d = d;
                    }
                    else
                    {
                        // Disable the SpecificNameServers
                        g_lpRasEntry->dwfOptions &= ~RASEO_SpecificNameServers;
                    }

                    if (IsDlgButtonChecked(hWnd, IDC_CHECK7) == BST_CHECKED)
                    {
                        // Enable the IpHeaderCompression flag
                        g_lpRasEntry->dwfOptions |= RASEO_IpHeaderCompression;
                    }
                    else
                    {
                        // Disable the IpHeaderCompression flag
                        g_lpRasEntry->dwfOptions &= ~RASEO_IpHeaderCompression;
                    }

                    if (IsDlgButtonChecked(hWnd, IDC_CHECK8) == BST_CHECKED)
                    {
                        // Enable the RemoteDefaultGateway flag
                        g_lpRasEntry->dwfOptions |= RASEO_RemoteDefaultGateway;
                    }
                    else
                    {
                        // Disable the RemoteDefaultGateway flag
                        g_lpRasEntry->dwfOptions &= ~RASEO_RemoteDefaultGateway;
                    }

                    EndDialog(hWnd, TRUE);
                    break;
                case IDCANCEL:
                    EndDialog(hWnd, 0);
                    break;
                case IDC_RADIO2:
                    EnableWindow(hEdit1, TRUE);
                    break;
                case IDC_RADIO4:
                    EnableWindow(hEdit2, TRUE);
                    EnableWindow(hEdit3, TRUE);
                    EnableWindow(hEdit4, TRUE);
                    EnableWindow(hEdit5, TRUE);
                    break;
                case IDC_RADIO1:
                    EnableWindow(hEdit1, FALSE);
                    break;
                case IDC_RADIO3:
                    EnableWindow(hEdit2, FALSE);
                    EnableWindow(hEdit3, FALSE);
                    EnableWindow(hEdit4, FALSE);
                    EnableWindow(hEdit5, FALSE);
                    break;
                default:
                    break;
            }
            break;
        default:
            break;
    }
    return 0;
}

INT_PTR CALLBACK Dlg_Proc2 | ( | HWND | hWnd,
 |  | UINT | uMsgID,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 1192 of file PhoneEntry.c.

{
    int i = 0;
    char szTemp[256] = {0};
    DWORD nRet = 0;
    LPRASENTRYNAME lpRasEntryName = NULL;
    LPRASENTRYNAME lpTempRasEntryName = NULL;

    DWORD cbEntry = sizeof(RASENTRYNAME);
    DWORD cEntries = 0;
    static HWND hComboBox = NULL;
    DWORD dwRasEntryInfoSize = 0;
  WPARAM wp = 0;
    LONG l = 0;

    hComboBox = GetDlgItem(hWnd, IDC_COMBO1);
    if (!hComboBox)
    {
        return FALSE;
    }

    switch (uMsgID)
    {
        case WM_INITDIALOG:
            // Enumerate all the phonebook entries using RasEnumEntries

            lpRasEntryName = (LPRASENTRYNAME)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(RASENTRYNAME));
            if (NULL == lpRasEntryName)
            {
                return FALSE;
            }

            lpRasEntryName->dwSize = sizeof(RASENTRYNAME);
            nRet = RasEnumEntries(NULL, NULL, lpRasEntryName, &cbEntry, &cEntries);
            if (ERROR_BUFFER_TOO_SMALL == nRet)
            {
                // Need to make sure that we actually free the memory before allocating it again.
                if (HeapFree(GetProcessHeap(), 0, (LPVOID)lpRasEntryName))
                {
                    lpRasEntryName = (LPRASENTRYNAME)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cbEntry);
                    if (NULL == lpRasEntryName)
                    {
                        _snprintf(szTemp, CELEMS(szTemp), "Couldn't allocate memory.");
                        MessageBox(hWnd, szTemp, NULL, MB_OK | MB_ICONERROR);
                        return FALSE;
                    }

                    lpRasEntryName->dwSize = sizeof(RASENTRYNAME);
                    if (nRet = RasEnumEntries(NULL, NULL, lpRasEntryName, &cbEntry, &cEntries))
                    {
                        _snprintf(szTemp, CELEMS(szTemp), "RasEnumEntries  failed: %d", nRet);
                        MessageBox(hWnd, szTemp, NULL, MB_OK | MB_ICONERROR);

                        if (lpRasEntryName)
                        {
                            HeapFree(GetProcessHeap(), 0, (LPVOID)lpRasEntryName);
                            lpRasEntryName = NULL;
                        }

                        return FALSE;
                    }
                }
                else
                {
                    return FALSE;
                }
            }

            lpTempRasEntryName = lpRasEntryName;
            if (cEntries)
            {
                g_dwEntries = cEntries;
                for (i = 0; i < (int) cEntries; i++)
                {
                    SendMessage(hComboBox, CB_ADDSTRING, i,
                        (LPARAM) (LPCTSTR) lpRasEntryName->szEntryName);
                    lpRasEntryName++;
                }

                SendMessage(hComboBox, CB_SETCURSEL, 0, 0);
                GetWindowText(hComboBox, g_szEntryName, CELEMS(g_szEntryName));
            }
            else
            {
                SendMessage(hComboBox, CB_SETCURSEL, 0, 0);
            }

            if (lpTempRasEntryName)
            {
                HeapFree(GetProcessHeap(), 0, (LPVOID)lpTempRasEntryName);
                lpRasEntryName = NULL;
            }
            return TRUE;

        case WM_CLOSE:
            EndDialog(hWnd, 0);
            return TRUE;

        case WM_COMMAND:
            switch (LOWORD(wParam))
            {
                case IDOK:
                    EndDialog(hWnd, 0);
                    return TRUE;

                case IDNEW:
                    g_fFlag = FALSE;
                    g_lpRasEntry = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(RASENTRY));
                    if (NULL == g_lpRasEntry)
                    {
                        return FALSE;
                    }

                    g_lpRasEntry->dwSize = sizeof(RASENTRY);
                    PropSheet(hWnd);
                    if (g_fValidEntry)
                    {
                        SendMessage(hComboBox, CB_ADDSTRING, 0, (LPARAM) (LPCSTR) g_szEntryName);
            wp = SendMessage(hComboBox, CB_FINDSTRINGEXACT, 0, (LPARAM) (LPCTSTR) g_szEntryName);
                        SendMessage(hComboBox, CB_SETCURSEL, wp, 0);
                        g_dwEntries++;
                    }

                    HeapFree(GetProcessHeap(), 0, (LPVOID)g_lpRasEntry);
                    g_lpRasEntry = NULL;

                    return TRUE;
                case IDCHANGE:
                    if (g_dwEntries)
                    {
                        wp = SendMessage(hComboBox, CB_GETCURSEL, 0, 0);
                        l = SendMessage(hComboBox, CB_GETLBTEXTLEN, wp, (LPARAM) 0);
                        if (CELEMS(g_szEntryName) > l)
                        {
                            SendMessage(hComboBox, CB_GETLBTEXT, wp, (LPARAM) (LPCSTR) g_szEntryName);
                        }

                        // Initialize the dwRasEntryInfoSize parameter
                        if ((nRet = RasGetEntryProperties(NULL,
                                    g_szEntryName,
                                    NULL,
                                    &dwRasEntryInfoSize,
                                    NULL,
                                    0)) != ERROR_BUFFER_TOO_SMALL)
                        {
                            _snprintf(szTemp, CELEMS(szTemp), "RasGetEntryProperty failed: %d", nRet);
                            MessageBox(hWnd, szTemp, NULL, MB_OK | MB_ICONERROR);
                        }

                        if (dwRasEntryInfoSize > 0)
                        {
                            g_lpRasEntry = (LPRASENTRY) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwRasEntryInfoSize);
                            if (NULL == g_lpRasEntry)
                            {
                                return FALSE;
                            }
                            g_lpRasEntry->dwSize = dwRasEntryInfoSize;
                        }
                        else
                        {
                            g_lpRasEntry = NULL;
                        }

                        // Retrieve the properties of the phonebook entry using
                        // RasGetEntryProperties
                        if (nRet = RasGetEntryProperties(NULL,
                                g_szEntryName,
                                g_lpRasEntry,
                                &dwRasEntryInfoSize,
                                NULL,
                                0))
                        {
                            _snprintf(szTemp, CELEMS(szTemp), "RasGetEntryProperty failed: %d", nRet);
                            MessageBox(hWnd, szTemp, NULL, MB_OK | MB_ICONERROR);
                        }
                        else
                        {
                            g_fFlag = TRUE;    // Flag to indicate phonebook entry exists
                            PropSheet(hWnd);
                        }

                        HeapFree(GetProcessHeap(), 0, (LPVOID)g_lpRasEntry);
                        g_lpRasEntry = NULL;

                    }
                    return TRUE;

                case IDC_COMBO1:
          wp = SendMessage(hComboBox, CB_GETCURSEL, 0, 0);
                    l = SendMessage(hComboBox, CB_GETLBTEXTLEN, wp, (LPARAM) 0);
                    if (CELEMS(g_szEntryName) > l)
                    {
                        SendMessage(hComboBox, CB_GETLBTEXT, wp, (LPARAM) (LPCSTR) g_szEntryName);
                    }
                    else
                    {
                        return FALSE;
                    }

                    return TRUE;
            }
            break;
    }

    return FALSE;
}

INT_PTR CALLBACK Page0Proc | ( | HWND | hWnd,
 |  | UINT | uMsgID,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 364 of file PhoneEntry.c.

{
    int i = 0, j = 0, k = 0, iItem =0;
    char szCCode[256] = {0};
    char szCName[256] = {0};
    char szTemp[256] = {0};
    char temp[256] = {0};
    DWORD nRet = 0;
    DWORD cb = 0;
    DWORD cDevices = 0;
    DWORD dwSize = 0;
  WPARAM wp = 0;
    LPRASCTRYINFO lpRasCtryInfo = (LPRASCTRYINFO) temp;
    LONG l = 0;

    static HWND hComboBox = NULL;
    static HWND hComboBox2 = NULL;
    static HWND hEditBox1 = NULL;
    static HWND hEditBox3 = NULL;
    static HWND hEditBox4 = NULL;

    // Initialize the various controls
    hComboBox = GetDlgItem(hWnd, IDC_COMBO3);
    hComboBox2 = GetDlgItem(hWnd, IDC_COMBO1);
    hEditBox1 = GetDlgItem(hWnd, IDC_ENTRYNAME);
    hEditBox3 = GetDlgItem(hWnd, IDC_ACODE);
    hEditBox4 = GetDlgItem(hWnd, IDC_PHONE);

    if (!hComboBox || !hComboBox2 || !hEditBox1 || !hEditBox3 || !hEditBox4)
    {
        return 0;
    }

    lpRasCtryInfo->dwCountryID = 1;
    switch (uMsgID)
    {
        case WM_INITDIALOG:

            cb = sizeof(RASDEVINFO);

            // Allocate memory in RASDEVINFO for RasEnumDevices
            g_RasDevInfo = (RASDEVINFO*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cb);
            if (NULL == g_RasDevInfo)
            {
                _snprintf(szTemp, CELEMS(szTemp), "HeapAlloc failed.");
                return 0;
            }

            g_RasDevInfo->dwSize = sizeof(RASDEVINFO);

            nRet = RasEnumDevices(g_RasDevInfo, &cb, &cDevices);
            switch (nRet)
            {
            case ERROR_BUFFER_TOO_SMALL:
                // If the buffer is too small, free the allocated memory and allocate a bigger buffer.
                if (HeapFree(GetProcessHeap(), 0, (LPVOID)g_RasDevInfo))
                {
                    g_RasDevInfo = (LPRASDEVINFO)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cb);
                    if (NULL == g_RasDevInfo)
                    {
                        printf("HeapAlloc failed.\n");
                        return 0;
                    }

                    g_RasDevInfo->dwSize = sizeof(RASDEVINFO);
                    nRet = RasEnumDevices(g_RasDevInfo, &cb, &cDevices);
                }
                else
                {
                    printf("HeapFree failed.\n");
                    return 0;
                }
                break;

            case ERROR_SUCCESS:
                break;

            default:
                _snprintf(szTemp, CELEMS(szTemp), "RasEnumDevices failed: %d ", nRet);
                MessageBox(hWnd, szTemp, NULL, MB_OK | MB_ICONERROR);
                return 0;
                break;

            }

            // Check for RAS capable devices using RasEnumDevices
            if (ERROR_SUCCESS != nRet)
            {
                _snprintf(szTemp, CELEMS(szTemp), "RasEnumDevices failed: %d ", nRet);
                MessageBox(hWnd, szTemp, NULL, MB_OK | MB_ICONERROR);
                return 0;
            }
            else
            {
                g_iTemp = cDevices;
                if (!cDevices)
                {
                    _snprintf(szTemp, CELEMS(szTemp), "No RAS capable devices found.");
                    MessageBox(hWnd, szTemp, NULL, MB_OK | MB_ICONERROR);
                    return 0;
                }
                else
                {               // Display the devices in the combo box
                    for (i = 0; i < (int) cDevices; i++)
                    {
                        SendMessage(hComboBox, CB_ADDSTRING, 0, (LPARAM) (LPCTSTR) g_RasDevInfo[i].szDeviceName);
                    }

                    if (g_fFlag)
                    {
                        wp = SendMessage(hComboBox, CB_FINDSTRINGEXACT, 0, (LPARAM) (LPCTSTR) g_lpRasEntry->szDeviceName);
                        SendMessage(hComboBox, CB_SETCURSEL, wp, 0);
                    }
                    else
                    {
                        SendMessage(hComboBox, CB_SETCURSEL, 0, 0);
                    }
                }
            }

            while (lpRasCtryInfo->dwCountryID)
            {
                // Initialize RASCTRYINFO structure to be used in RasGetCountryInfo().
                lpRasCtryInfo->dwSize = sizeof(RASCTRYINFO);
                dwSize = MAX_BUF_SIZE;     // Minimum size of 256 required.

                nRet = RasGetCountryInfo(lpRasCtryInfo, &dwSize);
                if (nRet)
                {
                    _snprintf(szTemp, CELEMS(szTemp), "RasGetCountryInfo failed: %d", nRet);
                    MessageBox(hWnd, szTemp, NULL, MB_OK | MB_ICONERROR);
                    return FALSE;
                }

                _snprintf(szCCode, CELEMS(szCCode), "%s (%d)", (LPSTR) lpRasCtryInfo + lpRasCtryInfo->dwCountryNameOffset, lpRasCtryInfo->dwCountryCode);

                // Display the country information in the combo box
                SendMessage(hComboBox2, CB_ADDSTRING, 0, (LPARAM) (LPCTSTR) szCCode);

                // Store the current phonebook entry's country name and code
                if (g_lpRasEntry->dwCountryID == lpRasCtryInfo->dwCountryID)
                {
                    lstrcpyn(szTemp, szCCode, CELEMS(szTemp));
                }

                lpRasCtryInfo->dwCountryID = lpRasCtryInfo->dwNextCountryID;
            }

            if (g_fFlag == TRUE)   // Flag to indicate phonebook entry exists
            {
                // Display the properties retrieved for the first page
                SendMessage(hEditBox1, WM_SETTEXT, 0, (LPARAM) (LPCTSTR) g_szEntryName);
                if (g_lpRasEntry->dwfOptions & RASEO_UseCountryAndAreaCodes)
                {
                    CheckDlgButton(hWnd, IDC_CHECK6, BST_CHECKED);
                    wp = SendMessage(hComboBox2, CB_FINDSTRINGEXACT, 0, (LPARAM) (LPCTSTR) szTemp);
                    SendMessage(hComboBox2, CB_SETCURSEL, wp, 0);
                    SendMessage(hEditBox3, WM_SETTEXT, 0, (LPARAM) (LPCTSTR) g_lpRasEntry->szAreaCode);
                    EnableWindow(hEditBox3, TRUE);
                    EnableWindow(hComboBox2, TRUE);

                }
                else
                {
                    EnableWindow(hEditBox3, FALSE);
                    EnableWindow(hComboBox2, FALSE);
                }

                SendMessage(hEditBox4, WM_SETTEXT, 0, (LPARAM) (LPCTSTR) g_lpRasEntry->szLocalPhoneNumber);

            }
            else
            {
                // Set Default Values
                EnableWindow(hComboBox2, FALSE);
                EnableWindow(hEditBox3, FALSE);
                g_lpRasEntry->dwfNetProtocols |= RASNP_Ip;
                g_lpRasEntry->dwFramingProtocol = RASFP_Ppp;
            }

            return TRUE;
        case WM_COMMAND:
            switch (LOWORD(wParam))
            {
                // If user selects to use the Country Code and Area Code
                case IDC_ECAC:
                    if (IsDlgButtonChecked(hWnd, IDC_ECAC) == BST_CHECKED)
                    {
                        EnableWindow(hEditBox3, TRUE);
                        EnableWindow(hComboBox2, TRUE);
                        SendMessage(hComboBox2, CB_SETCURSEL, 0, 0);
                    }
                    else
                    {
                        EnableWindow(hEditBox3, FALSE);
                        EnableWindow(hComboBox2, FALSE);
                    }
                    return TRUE;
                default:
                    break;

            }
            break;
        case WM_NOTIFY:
            switch (((LPNMHDR) lParam)->code)
            {
                case PSN_APPLY: // OK button has been clicked
                    {
                        HWND hwndControl = NULL;

                        // Get the values in the edit fields of the first page
                        hwndControl = GetDlgItem(hWnd, IDC_ENTRYNAME);
                        if (hwndControl)
                        {
                            GetWindowText(hwndControl, g_szEntryName, CELEMS(g_szEntryName));
                        }

                        hwndControl = GetDlgItem(hWnd, IDC_ACODE);
                        if (hwndControl)
                        {
                            GetWindowText(hwndControl, g_lpRasEntry->szAreaCode, CELEMS(g_lpRasEntry->szAreaCode));
                        }

                        hwndControl = GetDlgItem(hWnd, IDC_PHONE);
                        if (hwndControl)
                        {
                            GetWindowText(hwndControl, g_lpRasEntry->szLocalPhoneNumber, CELEMS(g_lpRasEntry->szLocalPhoneNumber));
                        }

                        // Validate the phonebook entry name using RasValidateEntryName
                        if (nRet = RasValidateEntryName(NULL, (LPSTR)g_szEntryName))
                        {
                            switch (nRet)
                            {
                                case ERROR_ALREADY_EXISTS:
                                    // If entry already exists, warn user that original values
                                    // will be overwritten
                                    g_fValidEntry = TRUE;
                                    _snprintf(szTemp, CELEMS(szTemp), "Entry name %s already exists, will overwrite!", g_szEntryName);
                                    iItem = MessageBox(hWnd, szTemp, "Warning!!!", MB_YESNO | MB_ICONWARNING);
                                    if (iItem == IDNO)
                                        return 0;
                                    break;
                                case ERROR_INVALID_NAME:
                                    g_fValidEntry = FALSE;
                                    _snprintf(szTemp, CELEMS(szTemp), "Entry name %s is invalid", g_szEntryName);
                                    MessageBox(hWnd, szTemp, NULL, MB_OK | MB_ICONERROR);
                                    return 0;
                                    break;
                            }
                        }
                        else
                        {
                            g_fValidEntry = TRUE;
                        }

                        if (IsDlgButtonChecked(hWnd, IDC_ECAC) == BST_CHECKED)
                            // Enable the UseCountryAndAreaCodes flag
                        {
                            g_lpRasEntry->dwfOptions |= RASEO_UseCountryAndAreaCodes;
                            // Get the country name and code
                wp = SendMessage(hComboBox2, CB_GETCURSEL, 0, 0);
                            l = SendMessage(hComboBox2, CB_GETLBTEXTLEN, wp, (LPARAM)0);
                            if (CELEMS(szTemp) > l)
                            {
                                SendMessage(hComboBox2, CB_GETLBTEXT, wp, (LPARAM) (LPCSTR) szTemp);
                                lstrcpyn(szCCode, szTemp, CELEMS(szCCode));
                            }
                            else
                            {
                                return FALSE;
                            }

                            k = 0;
                            // Store the country name in a buffer
                            while (szCCode[k] != '(')
                            {
                                k++;
                            }

                            szCCode[k - 1] = '\0';
                            k++;
                            i = 0;

                            // Store the country code in another buffer
                            while (szTemp[k] != ')')
                            {
                                szCName[i] = szTemp[k];
                                i++;
                                k++;
                            }

                            szCName[i] = '\0';

                            // Convert the country code string to an integer
                            j = atoi(szCName);
                            lpRasCtryInfo->dwSize = sizeof(RASCTRYINFO);
                            lpRasCtryInfo->dwCountryID = 1;

                            // Obtain the country ID by using RasGetCountryInfo
                            while (lpRasCtryInfo->dwCountryID)
                            {
                                lpRasCtryInfo->dwSize = sizeof(RASCTRYINFO);
                                dwSize = MAX_BUF_SIZE;
                                if (nRet = RasGetCountryInfo(lpRasCtryInfo, &dwSize))
                                {
                                    _snprintf(szTemp, CELEMS(szTemp), "RasGetCountryInfo failed: %d", nRet);
                                    MessageBox(hWnd, szTemp, NULL, MB_OK | MB_ICONERROR);
                                    return -1;
                                }
                                if ((lstrcmp(szCCode, (LPSTR) lpRasCtryInfo + lpRasCtryInfo->dwCountryNameOffset)) == 0)
                                {
                                    g_lpRasEntry->dwCountryCode = lpRasCtryInfo->dwCountryCode;
                                    g_lpRasEntry->dwCountryID = lpRasCtryInfo->dwCountryID;
                                    break;
                                }

                                lpRasCtryInfo->dwCountryID = lpRasCtryInfo->dwNextCountryID;
                            }
                        }
                        else
                        {
                            g_lpRasEntry->dwfOptions &= ~RASEO_UseCountryAndAreaCodes;
                        }

                        // Get the device chosen from the combo box
              wp = SendMessage(hComboBox, CB_GETCURSEL, 0, 0);
                        l = SendMessage(hComboBox, CB_GETLBTEXTLEN, wp, (LPARAM) 0);
                        if (CELEMS(g_lpRasEntry->szDeviceName) > l)
                        {
                            SendMessage(hComboBox, CB_GETLBTEXT, wp, (LPARAM) (LPCSTR) g_lpRasEntry->szDeviceName);
                            for (i = 0; i < g_iTemp; i++)
                            {
                                if (!(lstrcmp(g_RasDevInfo[i].szDeviceName, g_lpRasEntry->szDeviceName)))
                                {
                                    lstrcpyn(g_lpRasEntry->szDeviceType, g_RasDevInfo[i].szDeviceType, CELEMS(g_lpRasEntry->szDeviceType));
                                }
                            }

                            // Set the properties of the phonebook entry using
                            // RasSetEntryProperties

                            if (nRet = RasSetEntryProperties(NULL, (LPSTR) g_szEntryName, g_lpRasEntry, g_lpRasEntry->dwSize, NULL, 0))
                            {
                                _snprintf(szTemp, CELEMS(szTemp), "RasSetEntryProperties  failed: %d", nRet);
                                MessageBox(hWnd, szTemp, NULL, MB_OK | MB_ICONERROR);
                            }
                        }
                        else
                        {
                            return FALSE;
                        }

                        return TRUE;
                    }
                default:
                    break;
            }
            break;

        default:
            break;
    }

    return FALSE;
}

INT_PTR CALLBACK Page1Proc | ( | HWND | hWnd,
 |  | UINT | uMsgID,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 766 of file PhoneEntry.c.

{
    static HWND hComboBox = NULL;
    static HWND hCheckBox1 = NULL;
    static HWND hCheckBox4 = NULL;
    static HWND hCheckBox5 = NULL;
    static HWND hButton = NULL;
    int i = 0;

    // Initialize the various controls
    hComboBox = GetDlgItem(hWnd, IDC_COMBO2);
    hCheckBox1 = GetDlgItem(hWnd, IDC_CHECK1);
    hCheckBox4 = GetDlgItem(hWnd, IDC_CHECK4);
    hCheckBox5 = GetDlgItem(hWnd, IDC_CHECK5);
    hButton = GetDlgItem(hWnd, IDC_BUTTON1);

    if (!hComboBox || !hCheckBox1 || !hCheckBox4 || !hCheckBox5 || !hButton)
    {
        return FALSE;
    }

    switch (uMsgID)
    {
        case WM_INITDIALOG:
            SendMessage(hComboBox, CB_ADDSTRING, 0, (LPARAM) "PPP: Windows NT, Windows 95 Plus, Internet");
            SendMessage(hComboBox, CB_ADDSTRING, 1, (LPARAM) "SLIP: Internet");

            if (g_fFlag)           // Phonebook entry exists
            {                   // Display the entry's parameters

                switch (g_lpRasEntry->dwFramingProtocol)
                {
                    case RASFP_Ppp:
                        SendMessage(hComboBox, CB_SETCURSEL, 0, 0);
                        break;
                    case RASFP_Slip:
                        SendMessage(hComboBox, CB_SETCURSEL, 1, 0);
                        break;

                    default:
                        break;
                }

                if (g_lpRasEntry->dwfOptions & RASEO_SwCompression)
                {
                    CheckDlgButton(hWnd, IDC_CHECK4, BST_CHECKED);
                }
                else
                {
                    CheckDlgButton(hWnd, IDC_CHECK4, BST_UNCHECKED);
                }

                if (g_lpRasEntry->dwfOptions & RASEO_DisableLcpExtensions)
                {
                    CheckDlgButton(hWnd, IDC_CHECK5, BST_UNCHECKED);
                }
                else
                {
                    CheckDlgButton(hWnd, IDC_CHECK5, BST_CHECKED);
                }

                if (g_lpRasEntry->dwfNetProtocols & RASNP_Ip)
                {
                    CheckDlgButton(hWnd, IDC_CHECK1, BST_CHECKED);
                }
                else
                {
                    CheckDlgButton(hWnd, IDC_CHECK1, BST_UNCHECKED);
                }
            }
            else
            {
                // Display default parameters
                SendMessage(hComboBox, CB_SETCURSEL, 0, 0);
                CheckDlgButton(hWnd, IDC_CHECK5, BST_CHECKED);
                CheckDlgButton(hWnd, IDC_CHECK1, BST_CHECKED);
            }
            return TRUE;

        case WM_COMMAND:
            switch (LOWORD(wParam))
            {
                case IDC_BUTTON1:   // TCP/IP Settings Button pressed
                    DialogBox(g_hInstance, MAKEINTRESOURCE(IDD_DIALOG7), hWnd, Dlg_Proc1);
                    return TRUE;

                case IDC_COMBO2:// Framing Protocol settings
                    if (CBN_SELCHANGE == HIWORD(wParam))
                    {
                        i = (int)SendMessage(hComboBox, CB_GETCURSEL, 0, 0);
                        switch (i)
                        {
                            case 0: // PPP

                                CheckDlgButton(hWnd, IDC_CHECK1, BST_CHECKED);
                                CheckDlgButton(hWnd, IDC_CHECK5, BST_CHECKED);
                                EnableWindow(hCheckBox1, TRUE);
                                EnableWindow(hCheckBox4, TRUE);
                                EnableWindow(hCheckBox5, TRUE);
                                EnableWindow(hButton, TRUE);
                                break;
                            case 1: // Slip
                                EnableWindow(hCheckBox1, TRUE);
                                CheckDlgButton(hWnd, IDC_CHECK1, BST_CHECKED);
                                if (IsDlgButtonChecked(hWnd, IDC_CHECK4))
                                    CheckDlgButton(hWnd, IDC_CHECK4, BST_UNCHECKED);
                                if (IsDlgButtonChecked(hWnd, IDC_CHECK5))
                                    CheckDlgButton(hWnd, IDC_CHECK5, BST_UNCHECKED);
                                EnableWindow(hCheckBox4, FALSE);
                                EnableWindow(hCheckBox5, FALSE);
                                EnableWindow(hButton, TRUE);
                                break;
                            default:
                                break;
                        }
                    }
                    break;
                default:
                    break;
            }
            return TRUE;

        case WM_NOTIFY:
            switch (((LPNMHDR) lParam)->code)
            {
                case PSN_KILLACTIVE:
                    i = (int)SendMessage(hComboBox, CB_GETCURSEL, 0, 0);
                    switch (i)  // Set framing protocol based on the
                    {           // value returned from the combo box
                        case 0:
                            g_lpRasEntry->dwFramingProtocol = RASFP_Ppp;
                            break;
                        case 1:
                            g_lpRasEntry->dwFramingProtocol = RASFP_Slip;
                            break;
                        default:
                            g_lpRasEntry->dwFramingProtocol = RASFP_Ppp;
                            break;
                    }

                    if (IsDlgButtonChecked(hWnd, IDC_CHECK4) == BST_CHECKED)
                    {
                        // Enable the SwCompression flag
                        g_lpRasEntry->dwfOptions |= RASEO_SwCompression;
                    }
                    else
                    {
                        // Disable the SwCompression flag
                        g_lpRasEntry->dwfOptions &= ~RASEO_SwCompression;
                    }

                    if (IsDlgButtonChecked(hWnd, IDC_CHECK5) == BST_UNCHECKED)
                    {
                        // Enable the DisableLcpExtensions flag
                        g_lpRasEntry->dwfOptions |= RASEO_DisableLcpExtensions;
                    }
                    else
                    {
                        // Disable the DisableLcpExtensions flag
                        g_lpRasEntry->dwfOptions &= ~RASEO_DisableLcpExtensions;
                    }

                    if (IsDlgButtonChecked(hWnd, IDC_CHECK1) == BST_CHECKED)
                    {
                        // Enable Ip Net Protocol
                        g_lpRasEntry->dwfNetProtocols |= RASNP_Ip;
                    }
                    else
                    {
                        // Disable Ip Net Protocol
                        g_lpRasEntry->dwfNetProtocols &= ~RASNP_Ip;
                    }

                    return TRUE;
                default:
                    break;
            }
            break;
        default:
            break;
    }
    return FALSE;
}

INT_PTR CALLBACK Page2Proc | ( | HWND | hWnd,
 |  | UINT | uMsgID,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 981 of file PhoneEntry.c.

{
    static HWND hEdit1 = NULL;

    // Initialize the various controls
    hEdit1 = GetDlgItem(hWnd, IDC_EDIT1);

    if (!hEdit1)
    {
        return 0;
    }

    switch (uMsgID)
    {
        case WM_INITDIALOG:
            if (g_fFlag)        // Phonebook entry exists
            {                   // Display the parameters of the entry
                if (g_lpRasEntry->dwfOptions & RASEO_TerminalAfterDial)
                {
                    CheckRadioButton(hWnd, IDC_RADIO1, IDC_RADIO3, IDC_RADIO3);
                    EnableWindow(hEdit1, FALSE);
                }
                else
                {
                    if ((strcmp(g_lpRasEntry->szScript, "")) != 0)
                    {
                        CheckRadioButton(hWnd, IDC_RADIO1, IDC_RADIO3, IDC_RADIO2);
                        EnableWindow(hEdit1, TRUE);
                        SendMessage(hEdit1, WM_SETTEXT, 0, (LPARAM) (LPCTSTR) g_lpRasEntry->szScript);
                    }
                    else
                    {
                        CheckRadioButton(hWnd, IDC_RADIO1, IDC_RADIO3, IDC_RADIO1);
                        EnableWindow(hEdit1, FALSE);
                    }
                }
            }
            else
            {                   // Display default parametrs
                CheckRadioButton(hWnd, IDC_RADIO1, IDC_RADIO3, IDC_RADIO1);
                EnableWindow(hEdit1, FALSE);
            }

            break;
        case WM_COMMAND:
            switch (LOWORD(wParam))
            {
                case IDC_RADIO1:// Disable the edit box for holding the script name
                case IDC_RADIO3:
                    EnableWindow(hEdit1, FALSE);
                    break;
                case IDC_RADIO2:// Enable the edit box for holding the script name
                    EnableWindow(hEdit1, TRUE);
                    break;
                default:
                    break;
            }
            break;
        case WM_NOTIFY:
            switch (((LPNMHDR) lParam)->code)
            {
                case PSN_KILLACTIVE:
                    if (IsDlgButtonChecked(hWnd, IDC_RADIO3))
                    {
                        // Enable the TerminalAfterDial flag
                        g_lpRasEntry->dwfOptions |= RASEO_TerminalAfterDial;
                    }
                    else
                    {
                        // Disable the TerminalAfterDial flag
                        g_lpRasEntry->dwfOptions &= ~RASEO_TerminalAfterDial;
                    }

                    if (IsDlgButtonChecked(hWnd, IDC_RADIO2))
                    {
                        // Get the script name from the edit box
                        GetWindowText(GetDlgItem(hWnd, IDC_EDIT1), g_lpRasEntry->szScript, 256);
                    }
                    else
                    {
                        // Corresponds to "None"
                        g_lpRasEntry->szScript[0] = TEXT('\0');
                    }

                    return TRUE;
                    break;
                default:
                    break;
            }
            break;
        default:
            break;
    }
    return 0;
}

BOOL CALLBACK PropSheet ( HWND hWnd )

Definition at line 1093 of file PhoneEntry.c.

{
    // Build property sheet
    PROPSHEETHEADER pshSheet;
    PROPSHEETPAGE pspPage[NUMBER_OF_PROPERTY_SHEETS];
    int iRC = 0;

    ZeroMemory(&pshSheet, sizeof(PROPSHEETHEADER));

    // Sheet
    pshSheet.dwSize = sizeof(PROPSHEETHEADER);
    pshSheet.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW;
    pshSheet.hwndParent = hWnd;
    pshSheet.hInstance = g_hInstance;
    pshSheet.pszCaption = "EditPhonebookEntries";
    pshSheet.nPages = NUMBER_OF_PROPERTY_SHEETS;
    pshSheet.ppsp = pspPage;

    ZeroMemory(&pspPage, sizeof(PROPSHEETPAGE) * NUMBER_OF_PROPERTY_SHEETS);

    // Page 0
    pspPage[0].dwSize = sizeof(PROPSHEETPAGE);
    pspPage[0].hInstance = g_hInstance;
    pspPage[0].pszTemplate = MAKEINTRESOURCE(IDD_DIALOG2);
    pspPage[0].pfnDlgProc = Page0Proc;

    // Page 1
    pspPage[1].dwSize = sizeof(PROPSHEETPAGE);
    pspPage[1].hInstance = g_hInstance;
    pspPage[1].pszTemplate = MAKEINTRESOURCE(IDD_DIALOG3);
    pspPage[1].pfnDlgProc = Page1Proc;

    // Page 2
    pspPage[2].dwSize = sizeof(PROPSHEETPAGE);
    pspPage[2].hInstance = g_hInstance;
    pspPage[2].pszTemplate = MAKEINTRESOURCE(IDD_DIALOG4);
    pspPage[2].pfnDlgProc = Page2Proc;

    iRC = PropertySheet(&pshSheet);

    return 0;
}

int WINAPI WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | PSTR | szCmdLine,
 |  | int | iCmdShow
 | ) |  |

Definition at line 1152 of file PhoneEntry.c.

{
    int iRet = 0;
    iRet = (int)DialogBox(g_hInstance, MAKEINTRESOURCE(IDD_DIALOG1), NULL, Dlg_Proc2);

    if (g_RasDevInfo)
    {
        HeapFree(GetProcessHeap(), 0, (LPVOID)g_RasDevInfo);
        g_RasDevInfo = NULL;
    }

    return iRet;
}

Variable Documentation

DWORD g_dwEntries = 0

Definition at line 40 of file PhoneEntry.c.

BOOL g_fFlag = FALSE

Definition at line 38 of file PhoneEntry.c.

BOOL g_fValidEntry = FALSE

Definition at line 39 of file PhoneEntry.c.

HINSTANCE g_hInstance = NULL

Definition at line 34 of file PhoneEntry.c.

int g_iTemp = 0

Definition at line 41 of file PhoneEntry.c.

LPRASENTRY g_lpRasEntry = NULL

Definition at line 36 of file PhoneEntry.c.

LPRASDEVINFO g_RasDevInfo = NULL

Definition at line 37 of file PhoneEntry.c.

char g_szEntryName[256] = {0}

Definition at line 35 of file PhoneEntry.c.

Generated on Wed Nov 13 2024 16:53:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Ras/PhoneEntry/Resource.h File Reference

  • NetDS
  • Ras
  • PhoneEntry
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDBASIC 7
#define | IDC_ACODE 1011
#define | IDC_BUTTON1 1019
#define | IDC_CCODE 1009
#define | IDC_CHECK1 1008
#define | IDC_CHECK2 1009
#define | IDC_CHECK3 1011
#define | IDC_CHECK4 1010
#define | IDC_CHECK5 1012
#define | IDC_CHECK6 1014
#define | IDC_CHECK7 1023
#define | IDC_CHECK8 1024
#define | IDC_COMBO1 1027
#define | IDC_COMBO2 1007
#define | IDC_COMBO3 1017
#define | IDC_COMMENT 1008
#define | IDC_ECAC 1014
#define | IDC_EDIT1 1005
#define | IDC_EDIT2 1008
#define | IDC_EDIT3 1009
#define | IDC_EDIT4 1011
#define | IDC_EDIT5 1012
#define | IDC_EDIT6 1010
#define | IDC_EDIT7 1014
#define | IDC_EDIT8 1015
#define | IDC_ENTRYNAME 1013
#define | IDC_PHONE 1012
#define | IDC_RADIO1 1011
#define | IDC_RADIO2 1012
#define | IDC_RADIO3 1013
#define | IDC_RADIO4 1022
#define | IDCHANGE 3
#define | IDD_DIALOG1 101
#define | IDD_DIALOG2 102
#define | IDD_DIALOG3 103
#define | IDD_DIALOG4 104
#define | IDD_DIALOG7 109
#define | IDNEW 4
#define | IDSCRIPT 9
#define | IDSECURITY 10
#define | IDSERVER 8
#define | IDX25 11

Define Documentation

#define IDBASIC 7

Definition at line 7 of file Resource.h.

#define IDC_ACODE 1011

Definition at line 30 of file Resource.h.

#define IDC_BUTTON1 1019

Definition at line 42 of file Resource.h.

#define IDC_CCODE 1009

Definition at line 24 of file Resource.h.

#define IDC_CHECK1 1008

Definition at line 20 of file Resource.h.

#define IDC_CHECK2 1009

Definition at line 23 of file Resource.h.

#define IDC_CHECK3 1011

Definition at line 28 of file Resource.h.

#define IDC_CHECK4 1010

Definition at line 25 of file Resource.h.

#define IDC_CHECK5 1012

Definition at line 32 of file Resource.h.

#define IDC_CHECK6 1014

Definition at line 37 of file Resource.h.

#define IDC_CHECK7 1023

Definition at line 44 of file Resource.h.

#define IDC_CHECK8 1024

Definition at line 45 of file Resource.h.

#define IDC_COMBO1 1027

Definition at line 46 of file Resource.h.

#define IDC_COMBO2 1007

Definition at line 18 of file Resource.h.

#define IDC_COMBO3 1017

Definition at line 41 of file Resource.h.

#define IDC_COMMENT 1008

Definition at line 21 of file Resource.h.

#define IDC_ECAC 1014

Definition at line 39 of file Resource.h.

#define IDC_EDIT1 1005

Definition at line 17 of file Resource.h.

#define IDC_EDIT2 1008

Definition at line 19 of file Resource.h.

#define IDC_EDIT3 1009

Definition at line 22 of file Resource.h.

#define IDC_EDIT4 1011

Definition at line 27 of file Resource.h.

#define IDC_EDIT5 1012

Definition at line 31 of file Resource.h.

#define IDC_EDIT6 1010

Definition at line 26 of file Resource.h.

#define IDC_EDIT7 1014

Definition at line 38 of file Resource.h.

#define IDC_EDIT8 1015

Definition at line 40 of file Resource.h.

#define IDC_ENTRYNAME 1013

Definition at line 36 of file Resource.h.

#define IDC_PHONE 1012

Definition at line 34 of file Resource.h.

#define IDC_RADIO1 1011

Definition at line 29 of file Resource.h.

#define IDC_RADIO2 1012

Definition at line 33 of file Resource.h.

#define IDC_RADIO3 1013

Definition at line 35 of file Resource.h.

#define IDC_RADIO4 1022

Definition at line 43 of file Resource.h.

#define IDCHANGE 3

Definition at line 5 of file Resource.h.

#define IDD_DIALOG1 101

Definition at line 12 of file Resource.h.

#define IDD_DIALOG2 102

Definition at line 13 of file Resource.h.

#define IDD_DIALOG3 103

Definition at line 14 of file Resource.h.

#define IDD_DIALOG4 104

Definition at line 15 of file Resource.h.

#define IDD_DIALOG7 109

Definition at line 16 of file Resource.h.

#define IDNEW 4

Definition at line 6 of file Resource.h.

#define IDSCRIPT 9

Definition at line 9 of file Resource.h.

#define IDSECURITY 10

Definition at line 10 of file Resource.h.

#define IDSERVER 8

Definition at line 8 of file Resource.h.

#define IDX25 11

Definition at line 11 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Ras/Ras_Statistics/RasGetConnectionStatistics.c File Reference

  • NetDS
  • Ras
  • Ras_Statistics
Defines | Functions

RasGetConnectionStatistics.c File Reference

#include <windows.h>
#include <stdio.h>
#include <ras.h>
#include <raserror.h>
#include <tchar.h>

Go to the source code of this file.

Defines

#define | _WIN32_WINNT 0x500
#define | CELEMS(x) ((sizeof(x))/(sizeof(x[0])))

Functions

int | main (void)

Define Documentation

#define _WIN32_WINNT 0x500

Definition at line 22 of file RasGetConnectionStatistics.c.

#define CELEMS ( x ) ((sizeof(x))/(sizeof(x[0])))

Definition at line 26 of file RasGetConnectionStatistics.c.

Function Documentation

int main ( void )

Definition at line 34 of file RasGetConnectionStatistics.c.

{
  DWORD   nRet = 0;
  LPRASCONN lpRasConn = NULL;
    LPRASCONN lpTempRasConn = NULL;
  DWORD   cb = sizeof(RASCONN);
  DWORD   cConnections = 0;
    RAS_STATS *lpStatistics = NULL;
    BOOL        fSuccess = FALSE;
    DWORD       i = 0;
    TCHAR       szTempBuf[256] = {0};

  // Allocate buffer with default value
  lpRasConn = (LPRASCONN)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cb);
  if (NULL == lpRasConn)
  {
    printf("HeapAlloc failed.\n");
    return ERROR_OUTOFMEMORY;
  }

  lpRasConn->dwSize = sizeof(RASCONN);

  // Call RasEnumConnections to obtain the handle of the current active RAS connection
  nRet = RasEnumConnections(lpRasConn, &cb, &cConnections);

    switch (nRet)
    {
    case ERROR_BUFFER_TOO_SMALL:
        if (HeapFree(GetProcessHeap(), 0, (LPVOID)lpRasConn))
        {

            lpRasConn = (LPRASCONN)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cb);
          if (NULL == lpRasConn)
          {
            printf("HeapAlloc failed.\n");
            return ERROR_OUTOFMEMORY;
          }

          lpRasConn->dwSize = sizeof(RASCONN);

            nRet = RasEnumConnections(lpRasConn, &cb, &cConnections);
            if (ERROR_SUCCESS == nRet)
            {
                fSuccess = TRUE;
            }
            else
            {
            printf("RasEnumConnections failed: Error = %d\n", nRet);
                goto done;
            }
        }
        else
        {
            printf("HeapFree failed.\n");
            return GetLastError();
        }
        break;

    case ERROR_SUCCESS:
            fSuccess = TRUE;
            break;

    default:
    printf("RasEnumConnections failed: Error = %d\n", nRet);
        goto done;
        break;
    }

    if (fSuccess)
    {
      // Allocate buffer to obtain the RAS statistics
      lpStatistics = (RAS_STATS*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(RAS_STATS));

      if (NULL == lpStatistics)
      {
        printf("HeapAlloc failed.\n");
        goto done;
      }

        lpTempRasConn = lpRasConn;
        for (i = 0; i < cConnections; i++)
        {
            ZeroMemory(lpStatistics, sizeof(RAS_STATS));
          lpStatistics->dwSize = sizeof(RAS_STATS);

          // Call RasGetConnectionStatistics
          nRet = RasGetConnectionStatistics(lpTempRasConn->hrasconn, lpStatistics);
          if(ERROR_SUCCESS != nRet) // RasGetConnectionStatistics returned an error
          {
            printf("RasGetConnectionStatistics failed: Error = %d\n", nRet);
                goto done;
          }

            // Print the results obtained
          _snprintf(szTempBuf, CELEMS(szTempBuf) - 1, "Statistics for %s connection\n\n", lpTempRasConn->szEntryName);
            printf(szTempBuf);

          printf("Bytes Xmited\t\t\t%d\n", lpStatistics->dwBytesXmited);
          printf("Bytes Received\t\t\t%d\n", lpStatistics->dwBytesRcved);
          printf("Frames Xmited\t\t\t%d\n", lpStatistics->dwFramesXmited);
          printf("Frames Received\t\t\t%d\n", lpStatistics->dwFramesRcved);
          printf("Crc Error\t\t\t%d\n", lpStatistics->dwCrcErr);
          printf("Timeout Error\t\t\t%d\n", lpStatistics->dwTimeoutErr);
          printf("Alignment Error\t\t\t%d\n", lpStatistics->dwAlignmentErr);
          printf("Hardware Overrun Error\t\t%d\n", lpStatistics->dwHardwareOverrunErr);
          printf("Framing Error\t\t\t%d\n", lpStatistics->dwFramingErr);
          printf("Buffer Overrun Error\t\t%d\n", lpStatistics->dwBufferOverrunErr);
          printf("Compression Ratio [In]\t\t%d\n", lpStatistics->dwCompressionRatioIn);
          printf("Compression Ratio [Out]\t\t%d\n", lpStatistics->dwCompressionRatioOut);
          printf("Baud Rate [bps]\t\t\t%d\n", lpStatistics->dwBps);
          printf("Connection Duration [mili sec]\t%d\n", lpStatistics->dwConnectDuration);
            lpTempRasConn++;
        }

        nRet = ERROR_SUCCESS;
    }

done:
  // Clean up
  if (lpRasConn)
    {
        HeapFree(GetProcessHeap(), 0, (LPVOID)lpRasConn);
    }

    if (lpStatistics)
    {
      HeapFree(GetProcessHeap(), 0, (LPVOID)lpStatistics);
    }

  return (int)nRet;
}

Generated on Wed Nov 13 2024 16:53:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Ras/RasDial/c/RasDial.c File Reference

  • NetDS
  • Ras
  • RasDial
  • c
Defines | Functions

RasDial.c File Reference

#include <stdio.h>
#include <windows.h>
#include <ras.h>
#include <raserror.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <tchar.h>

Go to the source code of this file.

Defines

#define | _WIN32_WINNT 0x500
#define | CELEMS(x) ((sizeof(x))/(sizeof(x[0])))
#define | WIN32_LEAN_AND_MEAN

Functions

int | main (int argc, char **argv)
void | Usage (char *pszProgName)

Define Documentation

#define _WIN32_WINNT 0x500

Definition at line 25 of file RasDial.c.

#define CELEMS ( x ) ((sizeof(x))/(sizeof(x[0])))

Definition at line 44 of file RasDial.c.

#define WIN32_LEAN_AND_MEAN

Definition at line 32 of file RasDial.c.

Function Documentation

int main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 65 of file RasDial.c.

{
    LPRASDIALPARAMS     lpRasDialParams = NULL;
    HRASCONN            hRasConn = NULL;
    LPRASCONNSTATUS     lpRasConnStatus = NULL;
    RASPPPIP            *lpProjection = NULL;
    int                 i = 0;
    int                 j = 0;
    DWORD               dwRet = 0;
    DWORD               cb = sizeof(RASDIALPARAMS);
    DWORD               dwMaxTickCount = 0;
    BOOL                fRequired = FALSE;
    BOOL                fSuccess = FALSE;
    TCHAR               szTempBuf[256] = {0};

    lpRasDialParams = (LPRASDIALPARAMS)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cb);
    if (NULL == lpRasDialParams)
    {
        printf("HeapAlloc failed\n");
        return ERROR_OUTOFMEMORY;
    }

    lpRasDialParams->dwSize = sizeof(RASDIALPARAMS);

    // Copy command line arguments into the RASDIALPARAMS structure
    if (argc > 1)
    {
        for(i = 1; i < (argc - 1); i++)
        {
            if (argv[i] && ((argv[i][0] == '-') || (argv[i][0] == '/')))
          {
                switch(tolower(argv[i][1]))
              {
                    case 'e': // Entry name
                        j = ++i;
                        if (argv[j])
                        {
                            lstrcpyn(lpRasDialParams->szEntryName, argv[j], CELEMS(lpRasDialParams->szEntryName));
                            fRequired = TRUE;
                        }
                        break;
                    case 'p': // Phone number
                        j = ++i;
                        if (argv[j])
                        {
                            lstrcpyn(lpRasDialParams->szPhoneNumber, argv[j], CELEMS(lpRasDialParams->szPhoneNumber));
                        }
                        break;
                    case 'u': // User name
                        j = ++i;
                        if (argv[j])
                        {
                            lstrcpyn(lpRasDialParams->szUserName, argv[j], CELEMS(lpRasDialParams->szUserName));
                        }
                        break;
                    case 'z': // Password
                        j = ++i;
                        if (argv[j])
                        {
                            lstrcpyn(lpRasDialParams->szPassword, argv[j], CELEMS(lpRasDialParams->szPassword));
                        }
                        break;
                    case 'd': // Domain name
                        j = ++i;
                        if (argv[j])
                        {
                            lstrcpyn(lpRasDialParams->szDomain, argv[j], CELEMS(lpRasDialParams->szDomain));
                        }
                        break;
                    default:
                        Usage(argv[0]);
                        dwRet = ERROR_INVALID_PARAMETER;
                        break;
              }
          }
            else
            {
                Usage(argv[0]);
                dwRet = ERROR_INVALID_PARAMETER;
                goto done;
            }
        }
    }
    else
    {
        Usage(argv[0]);
        dwRet = ERROR_INVALID_PARAMETER;
        goto done;
    }

    // Check if we got at least required entry name
    if (FALSE == fRequired)
    {
        Usage(argv[0]);
        dwRet = ERROR_INVALID_PARAMETER;
        goto done;
    }

    printf("Dialing...\n");

    // Calling RasDial synchronously
    dwRet = RasDial(NULL, NULL, lpRasDialParams, 0, 0L, &hRasConn);
    if (dwRet)
    {
        printf("RasDial failed: Error = %d\n", dwRet);
        goto done;
    }

    lpRasConnStatus = (LPRASCONNSTATUS)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(RASCONNSTATUS));
    if (NULL == lpRasConnStatus)
    {
        printf("HeapAlloc failed.\n");
        goto disconnect;
    }

    // Set the appropriate size
    lpRasConnStatus->dwSize = sizeof(RASCONNSTATUS);

    // Checking connection status using RasGetConnectStatus
    dwRet = RasGetConnectStatus(hRasConn, lpRasConnStatus);
    if (ERROR_SUCCESS != dwRet)
    {
        printf("RasGetConnectStatus failed: Error = %d\n", dwRet);
        goto disconnect;
    }
    else
    {
        // Since the call succeeded, let's see what ras connection state we are in
        // by using the RASCONNSTATUS structure.
        if (lpRasConnStatus->rasconnstate == RASCS_Connected)
        {
            ZeroMemory((LPVOID)szTempBuf, sizeof(szTempBuf));
            _snprintf(szTempBuf, CELEMS(szTempBuf) - 1, "Connection estabilished using %s\n", lpRasConnStatus->szDeviceName);
            printf(szTempBuf);
        }
        else
        {
            // We don't seem to be connected. Just try to terminate the connection by
            // hanging up.
            printf("lpRasConnStatus->rasconnstate = %d\n", lpRasConnStatus->rasconnstate);
            goto disconnect;
        }
    }

    lpProjection = (RASPPPIP *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(RASPPPIP));
    if (NULL == lpProjection)
    {
        printf("HeapAlloc failed.\n");
        dwRet = ERROR_OUTOFMEMORY;
        goto disconnect;
    }

    cb = sizeof(RASPPPIP);
    lpProjection->dwSize = cb;

   // Getting the Ras client and server IP address using RasGetProjectionInfo
   dwRet = RasGetProjectionInfo(hRasConn, RASP_PppIp, lpProjection, &cb);

    switch (dwRet)
    {
    case ERROR_BUFFER_TOO_SMALL:
        if (HeapFree(GetProcessHeap(), 0, (LPVOID)lpProjection))
        {

            lpProjection = (RASPPPIP *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cb);
            if (NULL == lpProjection)
            {
                printf("HeapAlloc failed.\n");
                goto disconnect;
            }

            dwRet = RasGetProjectionInfo(hRasConn, RASP_PppIp, lpProjection, &cb);
            if (ERROR_SUCCESS == dwRet)
            {
                fSuccess = TRUE;
            }
            else
            {
                printf("RasGetProjectionInfo failed: Error %d", dwRet);
                goto disconnect;
            }
        }
        else
        {
            printf("HeapFree failed.\n");
            goto disconnect;
        }
        break;

   case ERROR_SUCCESS:
        fSuccess = TRUE;
        break;

   default:
         printf("RasGetProjectionInfo failed: Error %d", dwRet);
     goto disconnect;

        break;
    }

    if (fSuccess)
    {
        // Print out the IP addresses
        ZeroMemory((LPVOID)szTempBuf, sizeof(szTempBuf));
        _snprintf(szTempBuf, CELEMS(szTempBuf) - 1, "\nRas Client IP address: %s\n", lpProjection->szIpAddress);
        printf(szTempBuf);

        ZeroMemory((LPVOID)szTempBuf, sizeof(szTempBuf));
        _snprintf(szTempBuf, CELEMS(szTempBuf) - 1, "Ras Server IP address: %s\n\n", lpProjection->szServerIpAddress);
        printf(szTempBuf);
    }

    printf("Pausing for 5 seconds before disconnecting...\n");
    Sleep(5000);

disconnect:

    // Terminating the connection using RasHangUp
    dwRet = RasHangUp(hRasConn);
    if (ERROR_SUCCESS != dwRet)
    {
      printf("RasHangUp failed: Error = %d", dwRet);
      goto done;
    }

    // Keep checking  for 10 seconds and make sure we are really disconnected.
    // Once the connection is disconnected, RasGetConnectStatus returns ERROR_INVALID_HANDLE.
    // or our timeout is reached we exit the while loop.
    // This gives the RAS API time to make sure the modem hangs up before we exit this process.
    // If a process exits with a connected RAS connection, the port could be stranded.
    dwMaxTickCount = GetTickCount() + 10000;

    while((RasGetConnectStatus(hRasConn, lpRasConnStatus) != ERROR_INVALID_HANDLE) && (dwMaxTickCount > GetTickCount()))
    {
      Sleep(50);
    }

    printf("Diconnected\n");

    dwRet = ERROR_SUCCESS;

done:
    if (lpProjection)
    {
        HeapFree(GetProcessHeap(), 0, (LPVOID)lpProjection);
    }

    if (lpRasDialParams)
    {
        HeapFree(GetProcessHeap(), 0, (LPVOID)lpRasDialParams);
    }

    if (lpRasConnStatus)
    {
        HeapFree(GetProcessHeap(), 0, (LPVOID)lpRasConnStatus);
    }

   return (int)dwRet;
}

void Usage ( char * pszProgName )

Definition at line 47 of file RasDial.c.

{
    TCHAR szTempBuf[256] = {0};

    if (pszProgName)
    {
        _snprintf(szTempBuf,
                  CELEMS(szTempBuf) - 1,
                  "Usage\n%s \t-e entry_name -p [phone_number] \n\t\t-u [username] -z [password] -d [domain]\n",
                  pszProgName);

        printf(szTempBuf);
    }

    return;
}

Generated on Wed Nov 13 2024 16:53:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Ras/RasDialAsync/RasDialAsync.c File Reference

  • NetDS
  • Ras
  • RasDialAsync
Defines | Functions | Variables

RasDialAsync.c File Reference

#include <stdio.h>
#include <windows.h>
#include <ras.h>
#include <raserror.h>
#include <string.h>
#include <winbase.h>
#include <time.h>
#include <stdlib.h>
#include <tchar.h>

Go to the source code of this file.

Defines

#define | _WIN32_WINNT 0x500
#define | CELEMS(x) ((sizeof(x))/(sizeof(x[0])))
#define | WIN32_LEAN_AND_MEAN

Functions

int | main (int argc, char *argv[])
void WINAPI | RasDialFunc (UINT unMsg, RASCONNSTATE rasconnstate, DWORD dwError)
void | Usage (char *pszProgName)

Variables

HANDLE gEvent_handle

Define Documentation

#define _WIN32_WINNT 0x500

Definition at line 25 of file RasDialAsync.c.

#define CELEMS ( x ) ((sizeof(x))/(sizeof(x[0])))

Definition at line 45 of file RasDialAsync.c.

#define WIN32_LEAN_AND_MEAN

Definition at line 32 of file RasDialAsync.c.

Function Documentation

int main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 72 of file RasDialAsync.c.

{
    LPRASDIALPARAMS lpRasDialParams = NULL;   // Structure to store the RasDial parameters
    HRASCONN        hRasConn = NULL;          // Handle to RAS connection
    DWORD           nRet = 0;                 // Return value from a function
    DWORD           dwMaxTickCount = 0;               // Final Tick Count value
    int             i = 0;
    int             j = 0;
    BOOL            fRequired = FALSE;
    TCHAR           szTempBuf[256] = {0};

    // Create the event, which indicates completion of RasDial()
    gEvent_handle = CreateEvent(NULL, FALSE, FALSE, NULL);
    if (!gEvent_handle)
    {
        nRet = GetLastError();
        printf("CreateEvent failed: Error = %d", nRet);
        return nRet;
    }

    // Initialize the RASDIALPARAMS structure
    lpRasDialParams = (LPRASDIALPARAMS) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(RASDIALPARAMS));
    if (NULL == lpRasDialParams)
    {
      printf("HeapAlloc failed\n");
      goto done;
    }

    lpRasDialParams->dwSize =sizeof(RASDIALPARAMS);

    // Copy command line arguments into the RASDIALPARAMS structure
    if (argc > 1)
    {
      for(i = 1; i < (argc - 1); i++)
      {
        if (argv[i] && ((argv[i][0] == '-') || (argv[i][0] == '/')))
        {
          switch(tolower(argv[i][1]))
          {
              case 'e': // Entry name
                        j = ++i; // Increment i and assign it to j
                        if (argv[j])
                        {
                            lstrcpyn(lpRasDialParams->szEntryName, argv[j], CELEMS(lpRasDialParams->szEntryName));
                            fRequired = TRUE;
                        }
              break;
            case 'p': // Phone number
                        j = ++i; // Increment i and assign it to j
                        if (argv[j])
                        {
                            lstrcpyn(lpRasDialParams->szPhoneNumber, argv[j], CELEMS(lpRasDialParams->szPhoneNumber));
                        }
                        break;
                    case 'u': // User name
                        j = ++i; // Increment i and assign it to j
                        if (argv[j])
                        {
                            lstrcpyn(lpRasDialParams->szUserName, argv[j], CELEMS(lpRasDialParams->szUserName));
                        }
                        break;
                    case 'z': // Password
                        j = ++i; // Increment i and assign it to j
                        if (argv[j])
                        {
                            lstrcpyn(lpRasDialParams->szPassword, argv[j], CELEMS(lpRasDialParams->szPassword));
                        }
                        break;
                    case 'd': // Domain name
                        j = ++i; // Increment i and assign it to j
                        if (argv[j])
                        {
                            lstrcpyn(lpRasDialParams->szDomain, argv[j], CELEMS(lpRasDialParams->szDomain));
                        }
                        break;
                    default:
                        Usage(argv[0]);
                        goto done;
                        break;
          }
        }
            else
            {
                Usage(argv[0]);
                goto done;
            }
      }
    }
    else
    {
        Usage(argv[0]);
        goto done;
    }

    // Check if we got at least required entry name
    if (FALSE == fRequired)
    {
        Usage(argv[0]);
        goto done;
    }

    // Dial out asynchronously using RasDial()
    ZeroMemory((LPVOID)szTempBuf, sizeof(szTempBuf));
    _snprintf(szTempBuf, CELEMS(szTempBuf) - 1, "Dialing... %s\n", lpRasDialParams->szPhoneNumber);
    printf(szTempBuf);
    hRasConn = NULL;

    nRet = RasDial(NULL, NULL, lpRasDialParams, 0, &RasDialFunc, &hRasConn);
    // Check whether RasDial() succeeded
    if (nRet)
    {
        printf("RasDial failed: Error = %d\n", nRet);
        goto done;
    }

    // Wait for the RasDial() to complete, signaled by the SetEvent()
    nRet = WaitForSingleObject(gEvent_handle, 50000);
    switch (nRet)
    {
        case WAIT_OBJECT_0:
        // Normal completion or Ras Error encountered
            printf("Will hang up in 5 seconds...\n");
            Sleep(5000);

            break;

        case WAIT_TIMEOUT: // RasDial timed out
            printf("RasDial Timed out...\n");
            break;

        default:
            printf("WaitForSingleObject returned %d\n", nRet);
            break;
    }

    printf("Calling RasHangUp...\n");
    nRet = RasHangUp(hRasConn);
    if (ERROR_SUCCESS == nRet)
    {
        ZeroMemory((LPVOID)szTempBuf, sizeof(szTempBuf));
        _snprintf(szTempBuf, CELEMS(szTempBuf) - 1, "Connection to %s terminated.\n", lpRasDialParams->szPhoneNumber);
        printf(szTempBuf);
    }
    else
    {
        printf("RasHangUp failed with error = %d.\n", nRet);
    }

done:
   CloseHandle(gEvent_handle);

    if (lpRasDialParams)
    {
        // Clear password from memory
        ZeroMemory(lpRasDialParams->szPassword, sizeof(lpRasDialParams->szPassword));
        HeapFree(GetProcessHeap(), 0, (LPVOID)lpRasDialParams);
    }

    return (int)nRet;
}

void WINAPI RasDialFunc | ( | UINT | unMsg,
 |  | RASCONNSTATE | rasconnstate,
 |  | DWORD | dwError
 | ) |  |

Definition at line 236 of file RasDialAsync.c.

{
    char szRasString[256] = {0}; // Buffer for storing the error string
    TCHAR szTempBuf[256] = {0};  // Buffer used for printing out the text

    if (dwError)  // Error occurred
    {
        RasGetErrorString((UINT)dwError, szRasString, CELEMS(szRasString));

        ZeroMemory((LPVOID)szTempBuf, sizeof(szTempBuf));
        _snprintf(szTempBuf, CELEMS(szTempBuf) - 1, "Error: %d - %s\n", dwError, szRasString);
        printf(szTempBuf);

        SetEvent(gEvent_handle);
        return;
    }

   // Map each of the states of RasDial() and display on the screen
   // the next state that RasDial() is entering
   switch (rasconnstate)
   {
      case RASCS_OpenPort:
            printf ("RASCS_OpenPort = %d\n", rasconnstate);
            printf ("Opening port...\n");
      break;
        case RASCS_PortOpened:
            printf ("RASCS_PortOpened = %d\n", rasconnstate);
            printf ("Port opened.\n");
          break;
        case RASCS_ConnectDevice:
            printf ("RASCS_ConnectDevice = %d\n", rasconnstate);
            printf ("Connecting device...\n");
           break;
        case RASCS_DeviceConnected:
            printf ("RASCS_DeviceConnected = %d\n", rasconnstate);
            printf ("Device connected.\n");
            break;
        case RASCS_AllDevicesConnected:
            printf ("RASCS_AllDevicesConnected = %d\n", rasconnstate);
            printf ("All devices connected.\n");
            break;
        case RASCS_Authenticate:
            printf ("RASCS_Authenticate = %d\n", rasconnstate);
            printf ("Authenticating...\n");
            break;
        case RASCS_AuthNotify:
            printf ("RASCS_AuthNotify = %d\n", rasconnstate);
            printf ("Authentication notify.\n");
            break;
        case RASCS_AuthRetry:
            printf ("RASCS_AuthRetry = %d\n", rasconnstate);
            printf ("Retrying authentication...\n");
            break;
        case RASCS_AuthCallback:
            printf ("RASCS_AuthCallback = %d\n", rasconnstate);
            printf ("Authentication callback...\n");
            break;
        case RASCS_AuthChangePassword:
            printf ("RASCS_AuthChangePassword = %d\n", rasconnstate);
            printf ("Change password...\n");
            break;
        case RASCS_AuthProject:
            printf ("RASCS_AuthProject = %d\n", rasconnstate);
            printf ("Projection phase started...\n");
            break;
        case RASCS_AuthLinkSpeed:
            printf ("RASCS_AuthLinkSpeed = %d\n", rasconnstate);
            printf ("Negoting speed...\n");
            break;
        case RASCS_AuthAck:
            printf ("RASCS_AuthAck = %d\n", rasconnstate);
            printf ("Authentication acknowledge...\n");
            break;
        case RASCS_ReAuthenticate:
            printf ("RASCS_ReAuthenticate = %d\n", rasconnstate);
            printf ("Retrying Authentication...\n");
            break;
        case RASCS_Authenticated:
            printf ("RASCS_Authenticated = %d\n", rasconnstate);
            printf ("Authentication complete.\n");
            break;
        case RASCS_PrepareForCallback:
            printf ("RASCS_PrepareForCallback = %d\n", rasconnstate);
            printf ("Preparing for callback...\n");
            break;
        case RASCS_WaitForModemReset:
            printf ("RASCS_WaitForModemReset = %d\n", rasconnstate);
            printf ("Waiting for modem reset...\n");
            break;
        case RASCS_WaitForCallback:
            printf ("RASCS_WaitForCallback = %d\n", rasconnstate);
            printf ("Waiting for callback...\n");
            break;
        case RASCS_Projected:
            printf ("RASCS_Projected = %d\n", rasconnstate);
            printf ("Projection completed.\n");
            break;
    #if (WINVER >= 0x400)
        case RASCS_StartAuthentication:    // Windows 95 only
            printf ("RASCS_StartAuthentication = %d\n", rasconnstate);
            printf ("Starting authentication...\n");

            break;
        case RASCS_CallbackComplete:       // Windows 95 only
            printf ("RASCS_CallbackComplete = %d\n", rasconnstate);
            printf ("Callback complete.\n");
            break;
        case RASCS_LogonNetwork:           // Windows 95 only
            printf ("RASCS_LogonNetwork = %d\n", rasconnstate);
            printf ("Login to the network.\n");
            break;
    #endif
        case RASCS_SubEntryConnected:
            printf ("RASCS_SubEntryConnected = %d\n", rasconnstate);
            printf ("Subentry connected.\n");
            break;
        case RASCS_SubEntryDisconnected:
            printf ("RASCS_SubEntryDisconnected = %d\n", rasconnstate);
            printf ("Subentry disconnected.\n");
            break;
    //PAUSED STATES:
    case RASCS_Interactive:
            printf ("RASCS_Interactive = %d\n", rasconnstate);
            printf ("In Paused state: Interactive mode.\n");
            break;
    case RASCS_RetryAuthentication:
            printf ("RASCS_RetryAuthentication = %d\n", rasconnstate);
            printf ("In Paused state: Retry Authentication...\n");
            break;
    case RASCS_CallbackSetByCaller:
            printf ("RASCS_CallbackSetByCaller = %d\n", rasconnstate);
            printf ("In Paused state: Callback set by Caller.\n");
            break;
    case RASCS_PasswordExpired:
            printf ("RASCS_PasswordExpired = %d\n", rasconnstate);
            printf ("In Paused state: Password has expired...\n");
            break;

        case RASCS_Connected: // = RASCS_DONE:
            printf ("RASCS_Connected = %d\n", rasconnstate);
            printf ("Connection completed.\n");
      SetEvent(gEvent_handle);
            break;
        case RASCS_Disconnected:
            printf ("RASCS_Disconnected = %d\n", rasconnstate);
            printf ("Disconnecting...\n");
            break;
    default:
      printf ("Unknown Status = %d\n", rasconnstate);
      printf ("What are you going to do about it?\n");
      break;
   }
}

void Usage ( char * pszProgName )

Definition at line 54 of file RasDialAsync.c.

{
    TCHAR szTempBuf[256] = {0};

    if (pszProgName)
    {
        _snprintf(szTempBuf,
                  CELEMS(szTempBuf) - 1,
                  "Usage\n%s \t-e [entry name] -p [phone number] \n\t\t-u [username] -z [password] -d [domain]\n",
                  pszProgName);
        printf(szTempBuf);
    }
    return;
}

Variable Documentation

HANDLE gEvent_handle

Definition at line 51 of file RasDialAsync.c.

Generated on Wed Nov 13 2024 16:53:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Ras/RasEnumConnections/c/RasEnumConnections.c File Reference

  • NetDS
  • Ras
  • RasEnumConnections
  • c
Defines | Functions

RasEnumConnections.c File Reference

#include <windows.h>
#include <stdio.h>
#include <ras.h>
#include <raserror.h>
#include <tchar.h>

Go to the source code of this file.

Defines

#define | _WIN32_WINNT 0x500
#define | CELEMS(x) ((sizeof(x))/(sizeof(x[0])))

Functions

int | main (void)

Define Documentation

#define _WIN32_WINNT 0x500

Definition at line 21 of file RasEnumConnections.c.

#define CELEMS ( x ) ((sizeof(x))/(sizeof(x[0])))

Definition at line 32 of file RasEnumConnections.c.

Function Documentation

int main ( void )

Definition at line 34 of file RasEnumConnections.c.

{
  DWORD   dwRet = 0;
  LPRASCONN lpRasConn = NULL;
  LPRASCONN   lpTempRasConn = NULL;
    DWORD   cb = sizeof(RASCONN);
  DWORD   dwConnections = 0;
  DWORD   i = 0;
    BOOL        fSuccess = FALSE;
    TCHAR       szTempBuf[256] = {0};

  // Allocate buffer with space for at least one structure
  lpRasConn = (LPRASCONN)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cb);
  if (NULL == lpRasConn)
  {
    printf("HeapAlloc failed.\n");
    return ERROR_OUTOFMEMORY;
  }

  lpRasConn->dwSize = sizeof(RASCONN);

  dwRet = RasEnumConnections(lpRasConn, &cb, &dwConnections);

  switch (dwRet) // Check whether RasEnumConnections succeeded
  {
  case ERROR_BUFFER_TOO_SMALL: // Since initial buffer allocation was small.
    if (HeapFree(GetProcessHeap(), 0, (LPVOID)lpRasConn)) // Free initial buffer
        {
        // And reassign a new buffer with the value returned in cb
          lpRasConn = (LPRASCONN)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cb);
        if (NULL == lpRasConn)
        {
          printf("HeapAlloc failed.\n");
          return ERROR_OUTOFMEMORY;
        }

        lpRasConn->dwSize = sizeof(RASCONN);

        // Again call RasEnumConnections
        dwRet = RasEnumConnections(lpRasConn, &cb, &dwConnections);
        if (ERROR_SUCCESS == dwRet)
        {
                fSuccess = TRUE;
            }
            else
            {
                // RasEnumConnections failed
          printf("RasEnumConnections failed: Error = %d\n", dwRet);
            goto done;
        }
        }
        else
        {
            printf("HeapFree failed.\n");
            goto done;
        }
    break;

  case ERROR_SUCCESS: // RasEnumConnections succeeded with intial buffer allocation.
    fSuccess = TRUE;
    break;

  default: // RasEnumConnections failed with some error.
    printf("RasEnumConnections failed: Error = %d\n", dwRet);
    break;
  }

    if (fSuccess)
    {

        // RasEnumConnections succeeded. Print the results.
    printf("The following RAS connections are currently active\n\n");
    lpTempRasConn = lpRasConn;
    for (i = 0; i < dwConnections; i++)
    {
      printf("Size: %d\n", lpTempRasConn->dwSize);

            ZeroMemory((LPVOID)szTempBuf, sizeof(szTempBuf));
            _snprintf(szTempBuf, CELEMS(szTempBuf) - 1, "Entry name: %s\n", lpTempRasConn->szEntryName);
      printf(szTempBuf);

            ZeroMemory((LPVOID)szTempBuf, sizeof(szTempBuf));
            _snprintf(szTempBuf, CELEMS(szTempBuf) - 1, "Device name: %s\n", lpTempRasConn->szDeviceName);
      printf(szTempBuf);
      lpTempRasConn++;
    }
    }

done:
    HeapFree(GetProcessHeap(), 0, (LPVOID)lpRasConn);
  return (int)dwRet;
}

Generated on Wed Nov 13 2024 16:53:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Ras/RasEnumDevices/c/RasEnumDevices.c File Reference

  • NetDS
  • Ras
  • RasEnumDevices
  • c
Defines | Functions

RasEnumDevices.c File Reference

#include <windows.h>
#include <stdio.h>
#include <ras.h>
#include <raserror.h>
#include <tchar.h>

Go to the source code of this file.

Defines

#define | _WIN32_WINNT 0x500
#define | CELEMS(x) ((sizeof(x))/(sizeof(x[0])))

Functions

int | main (void)

Define Documentation

#define _WIN32_WINNT 0x500

Definition at line 21 of file RasEnumDevices.c.

#define CELEMS ( x ) ((sizeof(x))/(sizeof(x[0])))

Definition at line 31 of file RasEnumDevices.c.

Function Documentation

int main ( void )

Definition at line 33 of file RasEnumDevices.c.

{
  DWORD         i = 0;
  DWORD         dwRet = 0;
  DWORD         cb = sizeof(RASDEVINFO);
  DWORD         cDevices = 0;
  LPRASDEVINFO    lpRasDevInfo;
  LPRASDEVINFO    lpTempRasDevInfo;
    BOOL            fSuccess = FALSE;
    TCHAR           szTempBuf[256] = {0};

    // Allocate buffer with space for at least one structure
    lpRasDevInfo = (LPRASDEVINFO)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cb);
    if (NULL == lpRasDevInfo)
    {
        printf("HeapAlloc failed.\n");
        return ERROR_OUTOFMEMORY;
    }

    lpRasDevInfo->dwSize = sizeof(RASDEVINFO);

    dwRet = RasEnumDevices(lpRasDevInfo, &cb, &cDevices);

    switch(dwRet)   // Check whether RasEnumDevices succeeded
    {
    case ERROR_BUFFER_TOO_SMALL:
        // If the buffer is too small, free the allocated memory and allocate a bigger buffer.
        HeapFree(GetProcessHeap(), 0, (LPVOID)lpRasDevInfo);
        lpRasDevInfo = (LPRASDEVINFO)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cb);
        if (NULL == lpRasDevInfo)
        {
            printf("HeapAlloc failed.\n");
            return ERROR_OUTOFMEMORY;
        }

        lpRasDevInfo->dwSize = sizeof(RASDEVINFO);

        dwRet = RasEnumDevices(lpRasDevInfo, &cb, &cDevices);
        if (ERROR_SUCCESS == dwRet)
        {
            fSuccess = TRUE;
        }
        else
        {
            printf("RasEnumDevices failed: Error = %d\n", dwRet);
            goto done;
        }
        break;

    case ERROR_SUCCESS:
            fSuccess = TRUE;
            break;

    default:
        printf("RasEnumDevices failed: Error = %d\n", dwRet);
        goto done;
    }

  if (fSuccess)
  {
    printf("The following RAS capable devices were found on this machine:\n\n");
    printf("Device\t\t\tCategory\n\n");
    lpTempRasDevInfo = lpRasDevInfo;
    for (i = 0; i < cDevices; i++)
    {
            ZeroMemory((LPVOID)szTempBuf, sizeof(szTempBuf));
            _snprintf(szTempBuf, CELEMS(szTempBuf) - 1, "%s\t%s\n",lpTempRasDevInfo->szDeviceName, lpTempRasDevInfo->szDeviceType);
      printf(szTempBuf);
      lpTempRasDevInfo++;
    }
  }

done:
  HeapFree(GetProcessHeap(), 0, (LPVOID)lpRasDevInfo);
  return (int)dwRet;
}

Generated on Wed Nov 13 2024 16:53:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Ras/RasEnumEntries/c/RasEnumentries.c File Reference

  • NetDS
  • Ras
  • RasEnumEntries
  • c
Defines | Functions

RasEnumentries.c File Reference

#include <windows.h>
#include <stdio.h>
#include <ras.h>
#include <raserror.h>
#include <tchar.h>

Go to the source code of this file.

Defines

#define | _WIN32_WINNT 0x500
#define | CELEMS(x) ((sizeof(x))/(sizeof(x[0])))

Functions

int | main (void)

Define Documentation

#define _WIN32_WINNT 0x500

Definition at line 22 of file RasEnumentries.c.

#define CELEMS ( x ) ((sizeof(x))/(sizeof(x[0])))

Definition at line 32 of file RasEnumentries.c.

Function Documentation

int main ( void )

Definition at line 34 of file RasEnumentries.c.

{
  LPRASENTRYNAME lpRasEntryName = NULL;
  LPRASENTRYNAME lpTempRasEntryName = NULL;
  DWORD cb = sizeof(RASENTRYNAME);
  DWORD cEntries = 0;
  int nRet = 0;
  DWORD i = 0;
    BOOL fSuccess = FALSE;
    TCHAR           szTempBuf[256] = {0};

  lpRasEntryName = (LPRASENTRYNAME)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cb);
  if (NULL == lpRasEntryName)
  {
    printf("HeapAlloc failed.\n");
    return ERROR_OUTOFMEMORY;
  }

  lpRasEntryName->dwSize = sizeof(RASENTRYNAME);

  // Getting the size required for the RASENTRYNAME buffer

  nRet = RasEnumEntries(NULL, NULL, lpRasEntryName, &cb, &cEntries);

  switch (nRet)
  {
  case ERROR_BUFFER_TOO_SMALL:
    if (HeapFree(GetProcessHeap(), 0, (LPVOID)lpRasEntryName))
        {

            lpRasEntryName = (LPRASENTRYNAME)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cb);
          if (NULL == lpRasEntryName)
        {
          printf("HeapAlloc failed.\n");
                return ERROR_OUTOFMEMORY;
        }

        lpRasEntryName->dwSize = sizeof(RASENTRYNAME);

        // Calling RasEnumEntries to enumerate the phonebook entries for a default phonebook
        nRet = RasEnumEntries(NULL, NULL, lpRasEntryName, &cb, &cEntries);
        if (ERROR_SUCCESS != nRet)
        {
          printf("RasEnumEntries failed: Error %d\n", nRet);
          goto done;
        }
        else
        {
                fSuccess = TRUE;
        }
        }
        else
        {
      printf("HeapFree failed.\n");
            return GetLastError();
        }

    break;

  case ERROR_SUCCESS:
    fSuccess = TRUE;
    break;

  default:
    printf("RasEnumEntries failed: Error = %d\n", nRet);
    goto done;
  }

    if (fSuccess)
    {
    printf("Phone book entries in the default phonebook:\n\n");
    lpTempRasEntryName = lpRasEntryName;
    for (i = 0; i < cEntries; i++)
    {
            ZeroMemory((LPVOID)szTempBuf, sizeof(szTempBuf));
            _snprintf(szTempBuf, CELEMS(szTempBuf) - 1, "%s\n",lpTempRasEntryName->szEntryName);
      printf(szTempBuf);
      lpTempRasEntryName++;
    }
    }

done:
    HeapFree(GetProcessHeap(), 0, (LPVOID)lpRasEntryName);

    return nRet;
}

Generated on Wed Nov 13 2024 16:53:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Ras/WinNT/RasHost/RasHost.Cpp File Reference

  • NetDS
  • Ras
  • WinNT
  • RasHost
Defines | Functions | Variables

RasHost.Cpp File Reference

#include "RASHOST.H"
#include <stdio.h>
#include "Shlwapi.h"

Go to the source code of this file.

Defines

#define | CELEMS(x) ((sizeof(x))/(sizeof(x[0])))

Functions

void WINAPI | CallWorkerThread (PWORK_THREAD_DATA pCallData)
BOOL APIENTRY | DllMain (HINSTANCE hDll, DWORD dwReason, LPVOID lpReserved)
DWORD | GetClientResponse (HPORT hPort, PBYTE Buffer)
DWORD WINAPI | RasSecurityDialogBegin (HPORT hPort, PBYTE pSendBuf, DWORD SendBufSize, PBYTE pRecvBuf, DWORD RecvBufSize, VOID(WINAPI *RasSecurityDialogComplete)(SECURITY_MESSAGE *))
DWORD WINAPI | RasSecurityDialogEnd (HPORT hPort)
DWORD WINAPI | ValidateCallingUser (PRASHOST_DATA pData, BOOL *pfAccessGranted)

Variables

HINSTANCE | ghLibHandle = NULL
RASSECURITYDIALOGRECEIVEPROC | gpfnReceiveProc = NULL
RASSECURITYDIALOGSENDPROC | gpfnSendProc = NULL

Define Documentation

#define CELEMS ( x ) ((sizeof(x))/(sizeof(x[0])))

Definition at line 21 of file RasHost.Cpp.

Function Documentation

void WINAPI CallWorkerThread ( PWORK_THREAD_DATA pCallData )

Definition at line 212 of file RasHost.Cpp.

{
    // Initialize the appropiate structures
    CHAR                szTemp [256] = {0};       // Needed for OutputDebugString only
    DWORD               dwError = 0;
    BOOL                fAccessGranted = FALSE;
    SECURITY_MESSAGE    smResult = {0};
    RASHOST_DATA        HostData = {0};
    DWORD               dwErrSend = 0;

    OutputDebugString("CallWorkerThread.\n");

    if (NULL == pCallData ||
        NULL == pCallData->pRecvBuf ||
        NULL == pCallData->pfnSecurityDialogEnd ||
        NULL == pCallData->pSendBuf)
    {
        OutputDebugString("CallWorkerThread - Invalid parameter.\n");
        return;
    }

    smResult.hPort = pCallData->hPort;
    smResult.dwError =  0;

    // Set UserName to something which will fail validation in case they don't
    // enter anything at all.
    lstrcpyn(smResult.UserName, TEXT("(RASHOST - Unknown)"), CELEMS(smResult.UserName));

    ZeroMemory (pCallData->pRecvBuf, pCallData->RecvBufSize);

    // Set size value
    HostData.dwSize = sizeof(RASHOST_DATA);

    // Create an event to wait for client responses
    if ( !(hEvent = CreateEvent (NULL, FALSE, FALSE, NULL)))
    {
        wnsprintf (szTemp, CELEMS(szTemp), "CreateEvent failed: %d\n", GetLastError());
        OutputDebugString (szTemp);
        return;
    }
    else {
        wnsprintf(szTemp, CELEMS(szTemp), "Event %d created.\n", (DWORD)hEvent);
        OutputDebugString (szTemp);
    }

    //
    // Get username
    //

    // Get size for memcpy
    pCallData->SendBufSize = sizeof("Username: ");

    // Set prompt which will be sent to the user's terminal window
    CopyMemory (pCallData->pSendBuf, "Username: ", pCallData->SendBufSize);

    // Send the prompt to the user
    dwErrSend =  gpfnSendProc (pCallData->hPort,
                               pCallData->pSendBuf,
                               (WORD)pCallData->SendBufSize);

    if (dwErrSend != 0) {
        wnsprintf(szTemp, CELEMS(szTemp), "RASPORT SEND RETURNED %d \n", dwErrSend);
        OutputDebugString (szTemp);
    }

    // Fetch the user's input.  Return will be non-zero if the user enters a string.
    pCallData->RecvBufSize = GetClientResponse(pCallData->hPort, pCallData->pRecvBuf);

    if(pCallData->RecvBufSize > 0) {
        // Copy the client data from the incoming buffer to the data structure
        CopyMemory (HostData.szUserName, pCallData->pRecvBuf, min(pCallData->RecvBufSize, CELEMS(HostData.szUserName)));
        lstrcpyn(smResult.UserName, HostData.szUserName, CELEMS(smResult.UserName));
    }
    else {
        // This will cause the RAS server to fail the authentication.
        lstrcpyn(smResult.UserName, TEXT("(RASHOST - Unknown)"), CELEMS(smResult.UserName));
    }

    //
    // Get the domain name
    //

    // Get size for memcpy
    pCallData->SendBufSize = sizeof("\r\nDomain: ");

    // Set prompt which will be sent to the user's terminal window
    CopyMemory (pCallData->pSendBuf, "\r\nDomain: ", pCallData->SendBufSize);

    // Send the prompt to the user
    gpfnSendProc (pCallData->hPort, pCallData->pSendBuf, (WORD)pCallData->SendBufSize);

    if (dwErrSend != 0) {
        wnsprintf(szTemp, CELEMS(szTemp), "RASPORT SEND RETURNED %d \n", dwErrSend);
        OutputDebugString (szTemp);
    }

    // Fetch the user's input.  Return will be non-zero if the user enters a string.
    pCallData->RecvBufSize = GetClientResponse(pCallData->hPort, pCallData->pRecvBuf);

    if(pCallData->RecvBufSize > 0) {
        // Copy the client data from the incoming buffer to the data structure
        CopyMemory (HostData.szUserDomain, pCallData->pRecvBuf, min(pCallData->RecvBufSize, CELEMS(HostData.szUserDomain)));
        lstrcpyn(smResult.Domain, HostData.szUserDomain, CELEMS(smResult.Domain));
    }
    else {
        // This will cause the RAS server to fail the authentication.
        lstrcpyn(smResult.Domain, TEXT("(RASHOST - Unknown)"), CELEMS(smResult.Domain));
    }

    // Dump the info we've received to debugger
    OutputDebugString("\nUserName: ");
    OutputDebugString(smResult.UserName);
    OutputDebugString("\n");

    OutputDebugString("\nDomainName: ");
    OutputDebugString(smResult.Domain);
    OutputDebugString("\n");

    // With the received client response, validate the access for the client
    dwError = ValidateCallingUser (&HostData, &fAccessGranted);

    if (dwError)
    {
        // There was an error, deny access.
        if (ERROR_SMM_TIMEOUT == dwError)
        {
            smResult.dwMsgId = SECURITYMSG_FAILURE;
            OutputDebugString("ERROR_SMM_TIMEOUT\n");
        }
        else
        {
            smResult.dwMsgId = SECURITYMSG_ERROR;
            smResult.dwError = dwError;
            OutputDebugString("Other error.\n");
        }
    }
    else if (fAccessGranted)
    {
        // Access has been granted
        smResult.dwMsgId = SECURITYMSG_SUCCESS;
        OutputDebugString("Access granted.\n");
    }
    else
    {
        // The caller did not respond correctly
        smResult.dwMsgId = SECURITYMSG_FAILURE;
        OutputDebugString("Access denied.\n");
    }

    // Release the synchronization objects
    CloseHandle (hEvent);

    // Tell the RAS manager we are finished by calling the END dialog funcition.
    pCallData->pfnSecurityDialogEnd (&smResult);

    // Free the memory of this call instance before exiting the thread
    HeapFree (GetProcessHeap(), 0, pCallData);
}

BOOL APIENTRY DllMain | ( | HINSTANCE | hDll,
 |  | DWORD | dwReason,
 |  | LPVOID | lpReserved
 | ) |  |

Definition at line 39 of file RasHost.Cpp.

{
    if (DLL_PROCESS_DETACH == dwReason && ghLibHandle)
    {
        FreeLibrary (ghLibHandle);
    }
    return TRUE;
}

DWORD GetClientResponse | ( | HPORT | hPort,
 |  | PBYTE | Buffer
 | ) |  |

Definition at line 433 of file RasHost.Cpp.

{
    static int     iChar = 0;               // Count of characters in user's entry.
    static DWORD   dwBytes = 0;
    static DWORD   dwWait = 0;
    static DWORD   dwError = 0;
    static char    szTemp[256] = {0};       // Used for OutputDebugString only
    static char    szHoldBuffer[256] = {0}; // Holds the user input string as it's built up.

    if (NULL == Buffer)
    {
        return ERROR_INVALID_PARAMETER;
    }

    if (NULL == gpfnReceiveProc)
    {
        return ERROR_INVALID_FUNCTION;
    }

    iChar = 0;
    szHoldBuffer[0] = '\0';

    do {
        // Reset dwBytes so we only get 1 byte back
        dwBytes = 1;

        // Wait for an answer from the client responder
        dwError = gpfnReceiveProc (hPort,
                                   Buffer,
                                   (WORD *)&dwBytes,
                                   0,
                                   hEvent);

        wnsprintf(szTemp, CELEMS(szTemp), "gpfnReceiveProc returned: %d\n", dwError);
        OutputDebugString(szTemp);

        OutputDebugString("Calling WaitForSingleObject.\n");
        dwWait = WaitForSingleObject (hEvent, INFINITE);

        switch (dwWait) {
            case WAIT_FAILED:
                wnsprintf (szTemp, CELEMS(szTemp), "WaitForSingleObject failed: %d\n", GetLastError());
                OutputDebugString (szTemp);
                return 0;

            case WAIT_TIMEOUT:
                dwError = ERROR_SMM_TIMEOUT;
                OutputDebugString ( "Wait timed out \n");
                return 0;

            case WAIT_ABANDONED:
                OutputDebugString("WAIT_ABANDONED\n");
                return 0;

            case WAIT_OBJECT_0:
                OutputDebugString("The state of the object is signaled.\n");
                break;
        }

        // Save this character if it's not \n or \r character
        if(Buffer[0] != 13 && Buffer[0] != 10) {

            // Make sure there is enough space in our buffer
            if (CELEMS(szHoldBuffer) > iChar)
            {
                // Save this character and increment character count
                szHoldBuffer[iChar++] = Buffer[0];
            }
            else
            {
                break;
            }
        }

        wnsprintf(szTemp, CELEMS(szTemp), "Buffer= %c\n", Buffer[0]);
        OutputDebugString(szTemp);

    } while(Buffer[0] != 13);

    // Null terminate the string
    szHoldBuffer[iChar] = '\0';

    // Now copy the string back into the buffer
    CopyMemory (Buffer, &szHoldBuffer, iChar);

    wnsprintf(szTemp, CELEMS(szTemp), "Returning Buffer: %s\n", Buffer);
    OutputDebugString(szTemp);

    wnsprintf(szTemp, CELEMS(szTemp), "Returning size: %d\n", iChar);
    OutputDebugString(szTemp);

    return iChar;

}   /* End of 'GetClientResponse' */

DWORD WINAPI RasSecurityDialogBegin | ( | HPORT | hPort,
 |  | PBYTE | pSendBuf,
 |  | DWORD | SendBufSize,
 |  | PBYTE | pRecvBuf,
 |  | DWORD | RecvBufSize,
 |  | VOID(WINAPI *RasSecurityDialogComplete)(SECURITY_MESSAGE *) |
 | ) |  |

Definition at line 82 of file RasHost.Cpp.

{
    if (!pSendBuf || !pRecvBuf || !RasSecurityDialogComplete)
    {
        OutputDebugString("RasSecurityDialogBegin - ERROR_INVALID_PARAMETER\n");
        return ERROR_INVALID_PARAMETER;
    }

    // Initialize the global pointer to the entry points in the RAS manager
    // DLL. I use these entry points to send and receive data to the remote
    // client machine. These functions will send and receive RAW buffers of
    // data to the other machine just before PPP-framing starts.
    // These functions have not been exported in any publish import library
    // so we must do a dynamic binding to them.
    if (NULL == ghLibHandle)
    {
        ghLibHandle = LoadLibrary ("RASMAN.DLL");
        if (NULL == ghLibHandle)
        {
            return ERROR_DLL_NOT_FOUND;
        }
    }

    // Obtain the send and received entry points from the RAS manager DLL.
    if (NULL == gpfnSendProc)
    {
        gpfnSendProc = (RASSECURITYDIALOGSENDPROC)GetProcAddress (ghLibHandle, TEXT("RasSecurityDialogSend"));
        if (NULL == gpfnSendProc)
        {
            return ERROR_PROC_NOT_FOUND;
        }
    }

    if (NULL == gpfnReceiveProc)
    {
        gpfnReceiveProc = (RASSECURITYDIALOGRECEIVEPROC)GetProcAddress (ghLibHandle, TEXT("RasSecurityDialogReceive"));
        if (NULL == gpfnReceiveProc)
        {
            return ERROR_PROC_NOT_FOUND;
        }
    }

    // Save the parameters passed and give them to the working thread
    // that will handle the authentication of the caller. The thread
    // should release this memory.
    // The parameters passed to use should be valid until we call the
    // dialog end function or until we get call in the termination
    // dialog entry point by the RAS system supervisor (the RAS manager)
    PWORK_THREAD_DATA pCallData = (PWORK_THREAD_DATA)HeapAlloc (GetProcessHeap(),
                                                                HEAP_ZERO_MEMORY,
                                                                sizeof(WORK_THREAD_DATA));
    if (NULL == pCallData)
    {
        return ERROR_OUTOFMEMORY;
    }

    // Initialize the members.
    pCallData->hPort = hPort;
    pCallData->pSendBuf = pSendBuf;
    pCallData->SendBufSize = SendBufSize;
    pCallData->pRecvBuf = pRecvBuf;
    pCallData->RecvBufSize = RecvBufSize;
    pCallData->pfnSecurityDialogEnd = RasSecurityDialogComplete;

    // For each call, spawn a working thread that will make the neccesary
    // authentication of the dial-up caller. We should never block the call
    // to RasSecurityDialogBegin(). If we do so, RAS will also block and no
    // more call would be accepted.
    DWORD dwThreadID = 0;
    HANDLE hThread = CreateThread (NULL,
                                   0,
                                   (LPTHREAD_START_ROUTINE)CallWorkerThread,
                                   (LPVOID)pCallData,
                                   0,
                                   &dwThreadID);
    if (NULL == hThread)
    {
        // Call GetLastError() before calling HeapFree().
        DWORD dwError = GetLastError();
        HeapFree (GetProcessHeap(), 0, pCallData);
        return dwError;
    }

    OutputDebugString("Returning ERROR_SUCCESS from RasSecurityDialogBegin\n");
    return ERROR_SUCCESS;
}

DWORD WINAPI RasSecurityDialogEnd ( HPORT hPort )

Definition at line 190 of file RasHost.Cpp.

{
    OutputDebugString("RasSecurityDialogEnd\n");
    return ERROR_PORT_DISCONNECTED;
}

DWORD WINAPI ValidateCallingUser | ( | PRASHOST_DATA | pData,
 |  | BOOL * | pfAccessGranted
 | ) |  |

Definition at line 393 of file RasHost.Cpp.

{
    DWORD dwResult = ERROR_SUCCESS;

    if (!pData || !pfAccessGranted)
    {
        return ERROR_INVALID_PARAMETER;
    }

    *pfAccessGranted = FALSE;

    // Do stuff here

    // Increased security wouldn't hurt.  Currently, if username starts with 'e',
    // they get in.  Wouldn't be too hard to read from a file or registry to validate
    // users.
    if(pData->szUserName[0] == 'e') {
        *pfAccessGranted = TRUE;
    }

    return dwResult;
}

Variable Documentation

HINSTANCE ghLibHandle = NULL

Definition at line 23 of file RasHost.Cpp.

RASSECURITYDIALOGRECEIVEPROC gpfnReceiveProc = NULL

Definition at line 25 of file RasHost.Cpp.

RASSECURITYDIALOGSENDPROC gpfnSendProc = NULL

Definition at line 24 of file RasHost.Cpp.

Generated on Wed Nov 13 2024 16:53:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Ras/WinNT/RasHost/RasHost.h File Reference

  • NetDS
  • Ras
  • WinNT
  • RasHost
Classes | Defines | Typedefs | Functions | Variables

RasHost.h File Reference

#include <WINDOWS.H>
#include <RASERROR.H>
#include <RASSHOST.H>

Go to the source code of this file.

Classes

struct | _RASHOST_DATA
struct | _WORK_THREAD_DATA

Defines

#define | CLIENT_RESPONSE_TIMEOUT 15000
#define | STRICT

Typedefs

typedef struct _RASHOST_DATA * | PRASHOST_DATA
typedef struct _WORK_THREAD_DATA * | PWORK_THREAD_DATA
typedef struct _RASHOST_DATA | RASHOST_DATA
typedef DWORD(WINAPI * | RASSECURITYDIALOGRECEIVEPROC )(HPORT, PBYTE, PWORD, DWORD, HANDLE)
typedef DWORD(WINAPI * | RASSECURITYDIALOGSENDPROC )(HPORT, PBYTE, WORD)
typedef struct _WORK_THREAD_DATA | WORK_THREAD_DATA

Functions

void WINAPI | CallWorkerThread (PWORK_THREAD_DATA pCallData)
DWORD | GetClientResponse (HPORT hPort, PBYTE Buffer)
DWORD WINAPI | ValidateCallingUser (PRASHOST_DATA pData, BOOL *pfAccessGranted)

Variables

RASSECURITYDIALOGRECEIVEPROC gpfnReceiveProc
RASSECURITYDIALOGSENDPROC gpfnSendProc
HANDLE hEvent

Define Documentation

#define CLIENT_RESPONSE_TIMEOUT 15000

Definition at line 34 of file RasHost.h.

#define STRICT

Definition at line 25 of file RasHost.h.

Typedef Documentation

typedef struct _RASHOST_DATA * PRASHOST_DATA
typedef struct _WORK_THREAD_DATA * PWORK_THREAD_DATA
typedef struct _RASHOST_DATA RASHOST_DATA
typedef DWORD(WINAPI * RASSECURITYDIALOGRECEIVEPROC)(HPORT, PBYTE, PWORD, DWORD, HANDLE)

Definition at line 57 of file RasHost.h.

typedef DWORD(WINAPI * RASSECURITYDIALOGSENDPROC)(HPORT, PBYTE, WORD)

Definition at line 56 of file RasHost.h.

typedef struct _WORK_THREAD_DATA WORK_THREAD_DATA

Function Documentation

void WINAPI CallWorkerThread ( PWORK_THREAD_DATA pCallData )

Definition at line 212 of file RasHost.Cpp.

{
    // Initialize the appropiate structures
    CHAR                szTemp [256] = {0};       // Needed for OutputDebugString only
    DWORD               dwError = 0;
    BOOL                fAccessGranted = FALSE;
    SECURITY_MESSAGE    smResult = {0};
    RASHOST_DATA        HostData = {0};
    DWORD               dwErrSend = 0;

    OutputDebugString("CallWorkerThread.\n");

    if (NULL == pCallData ||
        NULL == pCallData->pRecvBuf ||
        NULL == pCallData->pfnSecurityDialogEnd ||
        NULL == pCallData->pSendBuf)
    {
        OutputDebugString("CallWorkerThread - Invalid parameter.\n");
        return;
    }

    smResult.hPort = pCallData->hPort;
    smResult.dwError =  0;

    // Set UserName to something which will fail validation in case they don't
    // enter anything at all.
    lstrcpyn(smResult.UserName, TEXT("(RASHOST - Unknown)"), CELEMS(smResult.UserName));

    ZeroMemory (pCallData->pRecvBuf, pCallData->RecvBufSize);

    // Set size value
    HostData.dwSize = sizeof(RASHOST_DATA);

    // Create an event to wait for client responses
    if ( !(hEvent = CreateEvent (NULL, FALSE, FALSE, NULL)))
    {
        wnsprintf (szTemp, CELEMS(szTemp), "CreateEvent failed: %d\n", GetLastError());
        OutputDebugString (szTemp);
        return;
    }
    else {
        wnsprintf(szTemp, CELEMS(szTemp), "Event %d created.\n", (DWORD)hEvent);
        OutputDebugString (szTemp);
    }

    //
    // Get username
    //

    // Get size for memcpy
    pCallData->SendBufSize = sizeof("Username: ");

    // Set prompt which will be sent to the user's terminal window
    CopyMemory (pCallData->pSendBuf, "Username: ", pCallData->SendBufSize);

    // Send the prompt to the user
    dwErrSend =  gpfnSendProc (pCallData->hPort,
                               pCallData->pSendBuf,
                               (WORD)pCallData->SendBufSize);

    if (dwErrSend != 0) {
        wnsprintf(szTemp, CELEMS(szTemp), "RASPORT SEND RETURNED %d \n", dwErrSend);
        OutputDebugString (szTemp);
    }

    // Fetch the user's input.  Return will be non-zero if the user enters a string.
    pCallData->RecvBufSize = GetClientResponse(pCallData->hPort, pCallData->pRecvBuf);

    if(pCallData->RecvBufSize > 0) {
        // Copy the client data from the incoming buffer to the data structure
        CopyMemory (HostData.szUserName, pCallData->pRecvBuf, min(pCallData->RecvBufSize, CELEMS(HostData.szUserName)));
        lstrcpyn(smResult.UserName, HostData.szUserName, CELEMS(smResult.UserName));
    }
    else {
        // This will cause the RAS server to fail the authentication.
        lstrcpyn(smResult.UserName, TEXT("(RASHOST - Unknown)"), CELEMS(smResult.UserName));
    }

    //
    // Get the domain name
    //

    // Get size for memcpy
    pCallData->SendBufSize = sizeof("\r\nDomain: ");

    // Set prompt which will be sent to the user's terminal window
    CopyMemory (pCallData->pSendBuf, "\r\nDomain: ", pCallData->SendBufSize);

    // Send the prompt to the user
    gpfnSendProc (pCallData->hPort, pCallData->pSendBuf, (WORD)pCallData->SendBufSize);

    if (dwErrSend != 0) {
        wnsprintf(szTemp, CELEMS(szTemp), "RASPORT SEND RETURNED %d \n", dwErrSend);
        OutputDebugString (szTemp);
    }

    // Fetch the user's input.  Return will be non-zero if the user enters a string.
    pCallData->RecvBufSize = GetClientResponse(pCallData->hPort, pCallData->pRecvBuf);

    if(pCallData->RecvBufSize > 0) {
        // Copy the client data from the incoming buffer to the data structure
        CopyMemory (HostData.szUserDomain, pCallData->pRecvBuf, min(pCallData->RecvBufSize, CELEMS(HostData.szUserDomain)));
        lstrcpyn(smResult.Domain, HostData.szUserDomain, CELEMS(smResult.Domain));
    }
    else {
        // This will cause the RAS server to fail the authentication.
        lstrcpyn(smResult.Domain, TEXT("(RASHOST - Unknown)"), CELEMS(smResult.Domain));
    }

    // Dump the info we've received to debugger
    OutputDebugString("\nUserName: ");
    OutputDebugString(smResult.UserName);
    OutputDebugString("\n");

    OutputDebugString("\nDomainName: ");
    OutputDebugString(smResult.Domain);
    OutputDebugString("\n");

    // With the received client response, validate the access for the client
    dwError = ValidateCallingUser (&HostData, &fAccessGranted);

    if (dwError)
    {
        // There was an error, deny access.
        if (ERROR_SMM_TIMEOUT == dwError)
        {
            smResult.dwMsgId = SECURITYMSG_FAILURE;
            OutputDebugString("ERROR_SMM_TIMEOUT\n");
        }
        else
        {
            smResult.dwMsgId = SECURITYMSG_ERROR;
            smResult.dwError = dwError;
            OutputDebugString("Other error.\n");
        }
    }
    else if (fAccessGranted)
    {
        // Access has been granted
        smResult.dwMsgId = SECURITYMSG_SUCCESS;
        OutputDebugString("Access granted.\n");
    }
    else
    {
        // The caller did not respond correctly
        smResult.dwMsgId = SECURITYMSG_FAILURE;
        OutputDebugString("Access denied.\n");
    }

    // Release the synchronization objects
    CloseHandle (hEvent);

    // Tell the RAS manager we are finished by calling the END dialog funcition.
    pCallData->pfnSecurityDialogEnd (&smResult);

    // Free the memory of this call instance before exiting the thread
    HeapFree (GetProcessHeap(), 0, pCallData);
}

DWORD GetClientResponse | ( | HPORT | hPort,
 |  | PBYTE | Buffer
 | ) |  |

Definition at line 433 of file RasHost.Cpp.

{
    static int     iChar = 0;               // Count of characters in user's entry.
    static DWORD   dwBytes = 0;
    static DWORD   dwWait = 0;
    static DWORD   dwError = 0;
    static char    szTemp[256] = {0};       // Used for OutputDebugString only
    static char    szHoldBuffer[256] = {0}; // Holds the user input string as it's built up.

    if (NULL == Buffer)
    {
        return ERROR_INVALID_PARAMETER;
    }

    if (NULL == gpfnReceiveProc)
    {
        return ERROR_INVALID_FUNCTION;
    }

    iChar = 0;
    szHoldBuffer[0] = '\0';

    do {
        // Reset dwBytes so we only get 1 byte back
        dwBytes = 1;

        // Wait for an answer from the client responder
        dwError = gpfnReceiveProc (hPort,
                                   Buffer,
                                   (WORD *)&dwBytes,
                                   0,
                                   hEvent);

        wnsprintf(szTemp, CELEMS(szTemp), "gpfnReceiveProc returned: %d\n", dwError);
        OutputDebugString(szTemp);

        OutputDebugString("Calling WaitForSingleObject.\n");
        dwWait = WaitForSingleObject (hEvent, INFINITE);

        switch (dwWait) {
            case WAIT_FAILED:
                wnsprintf (szTemp, CELEMS(szTemp), "WaitForSingleObject failed: %d\n", GetLastError());
                OutputDebugString (szTemp);
                return 0;

            case WAIT_TIMEOUT:
                dwError = ERROR_SMM_TIMEOUT;
                OutputDebugString ( "Wait timed out \n");
                return 0;

            case WAIT_ABANDONED:
                OutputDebugString("WAIT_ABANDONED\n");
                return 0;

            case WAIT_OBJECT_0:
                OutputDebugString("The state of the object is signaled.\n");
                break;
        }

        // Save this character if it's not \n or \r character
        if(Buffer[0] != 13 && Buffer[0] != 10) {

            // Make sure there is enough space in our buffer
            if (CELEMS(szHoldBuffer) > iChar)
            {
                // Save this character and increment character count
                szHoldBuffer[iChar++] = Buffer[0];
            }
            else
            {
                break;
            }
        }

        wnsprintf(szTemp, CELEMS(szTemp), "Buffer= %c\n", Buffer[0]);
        OutputDebugString(szTemp);

    } while(Buffer[0] != 13);

    // Null terminate the string
    szHoldBuffer[iChar] = '\0';

    // Now copy the string back into the buffer
    CopyMemory (Buffer, &szHoldBuffer, iChar);

    wnsprintf(szTemp, CELEMS(szTemp), "Returning Buffer: %s\n", Buffer);
    OutputDebugString(szTemp);

    wnsprintf(szTemp, CELEMS(szTemp), "Returning size: %d\n", iChar);
    OutputDebugString(szTemp);

    return iChar;

}   /* End of 'GetClientResponse' */

DWORD WINAPI ValidateCallingUser | ( | PRASHOST_DATA | pData,
 |  | BOOL * | pfAccessGranted
 | ) |  |

Definition at line 393 of file RasHost.Cpp.

{
    DWORD dwResult = ERROR_SUCCESS;

    if (!pData || !pfAccessGranted)
    {
        return ERROR_INVALID_PARAMETER;
    }

    *pfAccessGranted = FALSE;

    // Do stuff here

    // Increased security wouldn't hurt.  Currently, if username starts with 'e',
    // they get in.  Wouldn't be too hard to read from a file or registry to validate
    // users.
    if(pData->szUserName[0] == 'e') {
        *pfAccessGranted = TRUE;
    }

    return dwResult;
}

Variable Documentation

RASSECURITYDIALOGRECEIVEPROC gpfnReceiveProc

Definition at line 25 of file RasHost.Cpp.

RASSECURITYDIALOGSENDPROC gpfnSendProc

Definition at line 24 of file RasHost.Cpp.

HANDLE hEvent

Definition at line 62 of file RasHost.h.

Generated on Wed Nov 13 2024 16:53:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Ras/WinNT/RasHost/Resource.h File Reference

  • NetDS
  • Ras
  • WinNT
  • RasHost

Resource.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/AsyncRPC/AsyncRPC.Idl File Reference

  • NetDS
  • RPC
  • AsyncRPC
Functions | Variables

AsyncRPC.Idl File Reference

Go to the source code of this file.

Functions

void | AsyncFunc (handle_t hBinding,[in] unsigned long nAsychDelay)
void | NonAsyncFunc (handle_t hBinding,[in, string] unsigned char *pszMessage)
void | Shutdown (handle_t hBinding)

Variables

interface AsyncRPC const long | DEFAULT_ASYNC_DELAY = 20
const char * | DEFAULT_ENDPOINT = "8765"
const char * | DEFAULT_PROTOCOL_SEQUENCE = "ncacn_ip_tcp"

Function Documentation

void AsyncFunc | ( | handle_t | hBinding,
 |  | [in] unsigned long | nAsychDelay
 | ) |  |
void NonAsyncFunc | ( | handle_t | hBinding,
 |  | [in, string] unsigned char * | pszMessage
 | ) |  |
void Shutdown ( handle_t hBinding )

Variable Documentation

interface AsyncRPC const long DEFAULT_ASYNC_DELAY = 20

Definition at line 7 of file AsyncRPC.Idl.

const char* DEFAULT_ENDPOINT = "8765"

Definition at line 9 of file AsyncRPC.Idl.

const char* DEFAULT_PROTOCOL_SEQUENCE = "ncacn_ip_tcp"

Definition at line 8 of file AsyncRPC.Idl.

Generated on Wed Nov 13 2024 16:53:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/AsyncRPC/AsyncRPCc.c File Reference

  • NetDS
  • RPC
  • AsyncRPC
Defines | Functions

AsyncRPCc.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include "AsyncRPC.h"

Go to the source code of this file.

Defines

#define | DEFAULT_MESSAGE "message from client"
#define | DEFAULT_NOTIFICATION "event"

Functions

void RPC_ENTRY | APCNotificationRoutine (PRPC_ASYNC_STATE pAsync, void *Context, RPC_ASYNC_EVENT Event)
void __cdecl | main (int argc, char **argv)
void __RPC_FAR *__RPC_USER | midl_user_allocate (size_t len)
void __RPC_USER | midl_user_free (void __RPC_FAR *ptr)
void | Usage (char *pszProgramName)

Define Documentation

#define DEFAULT_MESSAGE "message from client"

Definition at line 38 of file AsyncRPCc.c.

#define DEFAULT_NOTIFICATION "event"

Definition at line 37 of file AsyncRPCc.c.

Function Documentation

void RPC_ENTRY APCNotificationRoutine | ( | PRPC_ASYNC_STATE | pAsync,
 |  | void * | Context,
 |  | RPC_ASYNC_EVENT | Event
 | ) |  |

Definition at line 377 of file AsyncRPCc.c.

{
   BOOL *pbCallFinished = (BOOL*)(pAsync->UserInfo);

   printf("APCNotificationRoutine reported ");

   switch (Event)
   {
      case RpcCallComplete:
         printf("event RpcCallComplete\n");
         if (pbCallFinished != NULL)
            *pbCallFinished = TRUE;  // used for ncadg_ip_udp
         break;
      case RpcSendComplete:
         printf("event RpcSendComplete\n");
         break;
      case RpcReceiveComplete:
         printf("event RpcReceiveComplete\n");
         break;
      default:
         printf("event unknown\n");
         break;
   }

   return;
}

void __cdecl main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 84 of file AsyncRPCc.c.

{
   unsigned char *pszUuid               = NULL;
   unsigned char *pszProtocolSequence   = DEFAULT_PROTOCOL_SEQUENCE;
   unsigned char *pszEndpoint           = DEFAULT_ENDPOINT;
   unsigned char *pszNetworkAddress     = NULL;
   unsigned char *pszOptions            = NULL;
   unsigned char *pszStringBinding      = NULL;
   unsigned char *pszNotificationMethod = DEFAULT_NOTIFICATION;
   unsigned char *pszMessage            = DEFAULT_MESSAGE;
   unsigned long nAsychDelay            = DEFAULT_ASYNC_DELAY;
   unsigned long ulCode;
   unsigned long nAsychTimeOut;
   BOOL bAsychCancel = FALSE;
   BOOL bShutDownServer = FALSE;
   BOOL bIsUDP = FALSE;
   BOOL bCallFinished = TRUE;
   BOOL bAsyncCallSuccess = TRUE;
   int i, nReply;
   RPC_ASYNC_STATE Async;
   RPC_STATUS status;
   DWORD dwResult;

   for (i = 1; i < argc; i++)
   {
      if ((*argv[i] == '-') || (*argv[i] == '/'))
      {
         switch (tolower(*(argv[i]+1)))
         {
            case 'p':
               pszProtocolSequence = argv[++i];
               break;
            case 'e':  // endpoint
               pszEndpoint = argv[++i];
               break;
            case 'n':  // network address
               pszNetworkAddress = argv[++i];
               break;
            case 'o':
               pszOptions = argv[++i];
               break;
            case 'm':
               pszNotificationMethod = argv[++i];
               break;
            case 'd':
               if (argv[i+1][0] != '-')
                  nAsychDelay = atol(argv[++i]);
               else
                  Usage(argv[0]);
               break;
            case 'c':
               bAsychCancel = TRUE;
               break;
            case 's':
               bShutDownServer = TRUE;
               break;
            case 'h':
            case '?':
            default:
               Usage(argv[0]);
         }
      }
      else
         Usage(argv[0]);
   }

   if ((pszProtocolSequence == NULL) || (pszEndpoint == NULL) ||
       (pszNotificationMethod == NULL) || (pszMessage == NULL) ||
       (nAsychDelay < 0))
   {
      Usage(argv[0]);
   }

   // Use a convenience function to concatenate the elements of
   // the string binding into the proper sequence.
   status = RpcStringBindingCompose(pszUuid,
                                    pszProtocolSequence,
                                    pszNetworkAddress,
                                    pszEndpoint,
                                    pszOptions,
                                    &pszStringBinding);
   printf("RpcStringBindingCompose returned 0x%x\n", status);
   printf("pszStringBinding = %s\n", pszStringBinding);
   if (status)
      exit(status);

   // Set the binding handle that will be used to bind to the server.
   status = RpcBindingFromStringBinding(pszStringBinding,
                                        &AsyncRPC_ClientIfHandle);
   printf("RpcBindingFromStringBinding returned 0x%x\n", status);
   if (status)
      exit(status);

   status = RpcAsyncInitializeHandle(&Async, sizeof(RPC_ASYNC_STATE));
   printf("RpcAsyncInitializeHandle returned 0x%x\n", status);
   if (status)
      exit(status);

   Async.UserInfo = NULL;

   // Detemine what type of notification method should be used
   if (stricmp(pszNotificationMethod, "apc") == 0)
   {
      Async.NotificationType = RpcNotificationTypeApc;
      if (stricmp(pszProtocolSequence, "ncadg_ip_udp") == 0)
         bIsUDP = TRUE;
   }
   else if (stricmp(pszNotificationMethod, "iocp") == 0)
      Async.NotificationType = RpcNotificationTypeIoc;
   else // "event"
      Async.NotificationType = RpcNotificationTypeEvent;

   // Fill in the RPC_ASYNC_STATE structure
   switch (Async.NotificationType)
   {
      case RpcNotificationTypeApc:
         Async.u.APC.NotificationRoutine = (PFN_RPCNOTIFICATION_ROUTINE)APCNotificationRoutine;
         Async.u.APC.hThread = 0;
         // Using APC and UDP will potentially cause SleepEx() to
         // block forever. We use a user defined flag to check
         // whether the call is completed or not.
         if (bIsUDP)
            Async.UserInfo = (void*)&bCallFinished;
         break;
      case RpcNotificationTypeIoc:
         Async.u.IOC.hIOPort = CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, 0, 0);
         if (Async.u.IOC.hIOPort == NULL)
         {
            printf("CreateIoCompletionPort() failed: %d\n", GetLastError());
            exit(1);
         }
         break;
      default:  // case RpcNotificationTypeEvent:
         Async.u.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
         if (Async.u.hEvent == 0)
         {
            printf("CreateEvent() failed: %d\n", GetLastError());
            exit(1);
         }
         break;
   }

   // Call an asynchronous RPC rountine here
   RpcTryExcept
   {
      printf("\nCalling the remote procedure 'AsyncFunc'\n");
      AsyncFunc(&Async, AsyncRPC_ClientIfHandle, nAsychDelay);
   }
   RpcExcept(1)
   {
      ulCode = RpcExceptionCode();
      printf("AsyncFunc: Runtime reported exception 0x%lx = %ld\n", ulCode, ulCode);
   }
   RpcEndExcept

   // Call a non-synchronous routine while
   // the synchronous routine is still running
   RpcTryExcept
   {
      printf("\nCalling the remote procedure 'NonAsyncFunc'\n");
      NonAsyncFunc(AsyncRPC_ClientIfHandle, pszMessage);
      fprintf(stderr, "You see, while 'AsyncFunc' is running asyncronously,\n"
                      "we still can send message to the server in the mean time.\n\n");
   }
   RpcExcept(1)
   {
      ulCode = RpcExceptionCode();
      printf("NonAsyncFunc: Runtime reported exception 0x%lx = %ld\n", ulCode, ulCode);
   }
   RpcEndExcept

   if (bAsychCancel)
   {
      // nonabortive cancel
      status = RpcAsyncCancelCall(&Async, FALSE);
      printf("RpcAsyncCancelCall returned 0x%x\n", status);
      if (status)
         exit(status);
   }

   // should plus the synchronous call
   // time if it also takes long
   nAsychTimeOut = nAsychDelay * 1000 * 3;

   // Wait for asynchronous notification
   printf("Waiting for asynchronous call to finish ...\n");
   switch (Async.NotificationType)
   {
      case RpcNotificationTypeApc:
         // Over ncadg_ip_udp, the RPC calls are executed sequentially on the server side
         // according to the order they are called by the client, regardless of their
         // async attributes. When the client is using APC, we need to "manually" check
         // whether AsyncFunc() is finished or not.
         if (bIsUDP)
         {
            if (!bCallFinished)
            {
               printf("Asynchronous call failed\n");
               bAsyncCallSuccess = FALSE;
            }
         }
         else
         {
            dwResult = SleepEx(nAsychTimeOut, TRUE);
            if (dwResult != WAIT_IO_COMPLETION)
            {
               if (dwResult == 0)
                  printf("SleepEx() is timed out\n");
               else
                  printf("SleepEx() failed: %d\n", dwResult);

               bAsyncCallSuccess = FALSE;
            }
         }
         break;
      case RpcNotificationTypeIoc:
         if (!GetQueuedCompletionStatus(Async.u.IOC.hIOPort,
                                        &Async.u.IOC.dwNumberOfBytesTransferred,
                                        &Async.u.IOC.dwCompletionKey,
                                        &Async.u.IOC.lpOverlapped,
                                        nAsychTimeOut))
         {
            dwResult = GetLastError();

            if (dwResult == WAIT_TIMEOUT)
               printf("GetQueuedCompletionStatus() is timed out\n");
            else
               printf("GetQueuedCompletionStatus() failed: %d\n", dwResult);

            bAsyncCallSuccess = FALSE;
         }
         break;
      default:  // case RpcNotificationTypeEvent:
         dwResult = WaitForSingleObject(Async.u.hEvent, nAsychTimeOut);
         if (dwResult == WAIT_FAILED)
         {
            printf("WaitForSingleObject() failed: %d\n", GetLastError());
            bAsyncCallSuccess = FALSE;
         }
         else if (dwResult == WAIT_TIMEOUT)
         {
            printf("WaitForSingleObject() is timed out\n");
            bAsyncCallSuccess = FALSE;
         }
         break;
   }

   if (bAsyncCallSuccess)
   {
      printf("Calling RpcAsyncCompleteCall\n");
      status = RpcAsyncCompleteCall(&Async, &nReply);
      printf("RpcAsyncCompleteCall returned 0x%x\n", status);
      if (status)
         exit(status);

      printf("Remote procedure 'AsyncFunc' returned successfully\n\n");
   }

   // Clean up notification resources
   switch (Async.NotificationType)
   {
      case RpcNotificationTypeApc:
         break;
      case RpcNotificationTypeIoc:
         CloseHandle(Async.u.IOC.hIOPort);
         break;
      default:  // case RpcNotificationTypeEvent:
         CloseHandle(Async.u.hEvent);
         break;
   }

   if (bShutDownServer)
   {
      printf("Shutting down server ...\n");
      Shutdown(AsyncRPC_ClientIfHandle); // shut down the server side
   }

   // The calls to the remote procedures are complete.
   // Free the string and the binding handle.
   status = RpcStringFree(&pszStringBinding);
   printf("RpcStringFree returned 0x%x\n", status);
   if (status)
      exit(status);

   status = RpcBindingFree(&AsyncRPC_ClientIfHandle);
   printf("RpcBindingFree returned 0x%x\n", status);
   if (status)
      exit(status);

   exit(0);
}

void __RPC_FAR* __RPC_USER midl_user_allocate ( size_t len )

Definition at line 408 of file AsyncRPCc.c.

{
   return(malloc(len));
}

void __RPC_USER midl_user_free ( void __RPC_FAR * ptr )

Definition at line 414 of file AsyncRPCc.c.

{
   free(ptr);
}

void Usage ( char * pszProgramName )

Definition at line 40 of file AsyncRPCc.c.

{
   fprintf(stderr, "USAGE:  %s\n", pszProgramName);
   fprintf(stderr, "          -p protocol_sequence\n");
   fprintf(stderr, "          -e endpoint\n");
   fprintf(stderr, "          -n network_address\n");
   fprintf(stderr, "          -o network_options\n");
   fprintf(stderr, "          -m notification_method\n");
   fprintf(stderr, "          -d asynchronous_delay\n");
   fprintf(stderr, "          -c\n");
   fprintf(stderr, "          -s\n\n");

   fprintf(stderr, "DESCRIPTION:\n");
   fprintf(stderr, " -p protocol_sequence:\n"
                   "   Specifies the protocol sequence (default is %s).\n",
                   DEFAULT_PROTOCOL_SEQUENCE);
   fprintf(stderr, " -e endpoint:\n"
                   "   Specifies the endpoint (default is %s).\n",
                   DEFAULT_ENDPOINT);
   fprintf(stderr, " -n network_address:\n"
                   "   Specifies the host name or IP address (default is localhost).\n");
   fprintf(stderr, " -o network_options:\n"
                   "   Specified the network options.\n");
   fprintf(stderr, " -m notification_method:\n"
                   "   Specifies the notification method used by the asynchronous function.\n"
                   "   Supported method: event, iocp, or apc (default is %s).\n",
                   DEFAULT_NOTIFICATION);
   fprintf(stderr, " -d asynchronous_delay:\n"
                   "   Specifies the number of seconds how long the asynchronous function\n"
                   "   will take ro run on the server (default is %u seconds).\n",
                   DEFAULT_ASYNC_DELAY);
   fprintf(stderr, " -c:\n"
                   "   Indicates the asynchronous call will be cancelled.\n");
   fprintf(stderr, " -s:\n"
                   "   Indicates the server will be shutdown.\n");
   exit(1);
}

Generated on Wed Nov 13 2024 16:53:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/AsyncRPC/AsyncRPCp.c File Reference

  • NetDS
  • RPC
  • AsyncRPC
Functions | Variables

AsyncRPCp.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include "AsyncRPC.h"

Go to the source code of this file.

Functions

void | AsyncFunc (IN PRPC_ASYNC_STATE pAsync, IN RPC_BINDING_HANDLE hBinding, IN unsigned long nAsychDelay)
void | NonAsyncFunc (IN RPC_BINDING_HANDLE hBinding, IN unsigned char *pszMessage)
void | Shutdown (IN RPC_BINDING_HANDLE hBinding)

Variables

const unsigned long | ASYNC_CANCEL_CHECK = 500
const unsigned long | DEFAULT_NONASYNC_DELAY = 1000
const char | PERCENT = '%'

Function Documentation

void AsyncFunc | ( | IN PRPC_ASYNC_STATE | pAsync,
 |  | IN RPC_BINDING_HANDLE | hBinding,
 |  | IN unsigned long | nAsychDelay
 | ) |  |

Definition at line 43 of file AsyncRPCp.c.

{
   int nReply = 1;
   RPC_STATUS status;
   unsigned long nTmpAsychDelay;
   int i;

   if (nAsychDelay < 0)
      nAsychDelay = DEFAULT_ASYNC_DELAY;

   nAsychDelay *= 1000;  // convert to ms

   // We only call RpcServerTestCancel if the call
   // takes longer than ASYNC_CANCEL_CHECK ms
   if (nAsychDelay > ASYNC_CANCEL_CHECK)
   {
      nTmpAsychDelay = nAsychDelay/100;

      for (i = 0; i < 100; i++)
      {
         Sleep(nTmpAsychDelay);

         if (i%5 == 0)
         {
            // Report the progress of the asynchronous function
            fprintf(stderr, "\rRunning AsyncFunc (%lu ms) (%d%c) ... ",
                    nAsychDelay, i+5, PERCENT);

            // Check whether the call is cancelled by the client
            status = RpcServerTestCancel(RpcAsyncGetCallHandle(pAsync));
            if (status == RPC_S_OK)
            {
               fprintf(stderr, "\nAsyncFunc has been cancelled!!!\n");
               break;
            }
            else if (status != RPC_S_CALL_IN_PROGRESS)
            {
               printf("RpcServerTestCancel returned 0x%x\n", status);
               exit(status);
            }
         }
      }
   }
   else
      Sleep(nAsychDelay);

   printf("\nCalling RpcAsyncCompleteCall\n");
   status = RpcAsyncCompleteCall(pAsync, &nReply);
   printf("RpcAsyncCompleteCall returned 0x%x\n", status);
   if (status)
      exit(status);
}

void NonAsyncFunc | ( | IN RPC_BINDING_HANDLE | hBinding,
 |  | IN unsigned char * | pszMessage
 | ) |  |

Definition at line 33 of file AsyncRPCp.c.

{
   Sleep(DEFAULT_NONASYNC_DELAY);
   fprintf(stderr, "\n\nReceived (%s) via NonAsyncFunc\n\n", pszMessage);
}

void Shutdown ( IN RPC_BINDING_HANDLE hBinding )

Definition at line 99 of file AsyncRPCp.c.

{
   RPC_STATUS status;

   printf("Calling RpcMgmtStopServerListening\n");
   status = RpcMgmtStopServerListening(NULL);
   printf("RpcMgmtStopServerListening returned: 0x%x\n", status);
   if (status)
      exit(status);

   printf("Calling RpcServerUnregisterIf\n");
   status = RpcServerUnregisterIf(NULL, NULL, FALSE);
   printf("RpcServerUnregisterIf returned 0x%x\n", status);
   if (status)
      exit(status);
}

Variable Documentation

const unsigned long ASYNC_CANCEL_CHECK = 500

Definition at line 29 of file AsyncRPCp.c.

const unsigned long DEFAULT_NONASYNC_DELAY = 1000

Definition at line 28 of file AsyncRPCp.c.

const char PERCENT = '%'

Definition at line 27 of file AsyncRPCp.c.

Generated on Wed Nov 13 2024 16:53:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/AsyncRPC/AsyncRPCs.c File Reference

  • NetDS
  • RPC
  • AsyncRPC
Functions | Variables

AsyncRPCs.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include "AsyncRPC.h"

Go to the source code of this file.

Functions

void __cdecl | main (int argc, char *argv[])
void __RPC_FAR *__RPC_USER | midl_user_allocate (size_t len)
void __RPC_USER | midl_user_free (void __RPC_FAR *ptr)
void | Quit (RPC_STATUS status)
void | Usage (char *pszProgramName)

Variables

const int | DEFAULT_MAX_CALLS = 20
const int | DEFAULT_MIN_CALLS = 1
const BOOL | DEFAULT_WAIT_FLAG = FALSE
PSECURITY_DESCRIPTOR | pszSecurity = NULL

Function Documentation

void __cdecl main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 51 of file AsyncRPCs.c.

{
   unsigned char *pszProtocolSequence = DEFAULT_PROTOCOL_SEQUENCE;
   unsigned char *pszEndpoint         = DEFAULT_ENDPOINT;
   unsigned int   nMinCalls           = DEFAULT_MIN_CALLS;
   unsigned int   nMaxCalls           = DEFAULT_MAX_CALLS;
   BOOL bDontWait                     = DEFAULT_WAIT_FLAG;
   PSECURITY_DESCRIPTOR pszSecurity   = NULL;
   int i;
   RPC_STATUS status;

   // allow the user to override settings with command line switches
   for (i = 1; i < argc; i++)
   {
      if ((*argv[i] == '-') || (*argv[i] == '/'))
      {
         switch (tolower(*(argv[i]+1)))
         {
            case 'p':
               pszProtocolSequence = argv[++i];
               break;
            case 'e':
               pszEndpoint = argv[++i];
               break;
            case 'm':
               nMaxCalls = (unsigned int) atoi(argv[++i]);
               break;
            case 'n':
               nMinCalls = (unsigned int) atoi(argv[++i]);
               break;
            case 'f':
               bDontWait = (unsigned int) atoi(argv[++i]);
               break;
            case 'h':
            case '?':
            default:
               Usage(argv[0]);
         }
      }
      else
         Usage(argv[0]);
   }

   if ((pszProtocolSequence == NULL) || (pszEndpoint == NULL) ||
       (nMinCalls < 1) || (nMinCalls > nMaxCalls))
      Usage(argv[0]);

   status = RpcServerUseProtseqEp(pszProtocolSequence,
                                  nMaxCalls,
                                  pszEndpoint,
                                  pszSecurity);
   printf("RpcServerUseProtseqEp returned 0x%x\n", status);
   if (status)
      Quit(status);

   status = RpcServerRegisterIf(AsyncRPC_ServerIfHandle,
                                NULL,
                                NULL);
   printf("RpcServerRegisterIf returned 0x%x\n", status);
   if (status)
      Quit(status);

   printf("Calling RpcServerListen\n");
   status = RpcServerListen(nMinCalls,
                      nMaxCalls,
                      bDontWait);
   printf("RpcServerListen returned: 0x%x\n", status);
   if (status)
      Quit(status);

   if (bDontWait)
   {
      printf("Calling RpcMgmtWaitServerListen\n");
      status = RpcMgmtWaitServerListen();  // wait operation
      printf("RpcMgmtWaitServerListen returned: 0x%x\n", status);
      if (status)
         Quit(status);
   }

   free(pszSecurity);
}

void __RPC_FAR* __RPC_USER midl_user_allocate ( size_t len )

Definition at line 135 of file AsyncRPCs.c.

{
   return(malloc(len));
}

void __RPC_USER midl_user_free ( void __RPC_FAR * ptr )

Definition at line 141 of file AsyncRPCs.c.

{
   free(ptr);
}

void Quit ( RPC_STATUS status )

Definition at line 43 of file AsyncRPCs.c.

{
   if (pszSecurity != NULL)
      free(pszSecurity);

   exit(status);
}

void Usage ( char * pszProgramName )

Definition at line 32 of file AsyncRPCs.c.

{
   fprintf(stderr, "Usage:  %s\n", pszProgramName);
   fprintf(stderr, " -p protocol_sequence (default is '%s')\n", DEFAULT_PROTOCOL_SEQUENCE);
   fprintf(stderr, " -e endpoint (default is '%s')\n", DEFAULT_ENDPOINT);
   fprintf(stderr, " -m maxcalls (default is %d)\n", DEFAULT_MAX_CALLS);
   fprintf(stderr, " -n mincalls\n (default is %d)\n", DEFAULT_MAX_CALLS);
   fprintf(stderr, " -f flag_wait_op (default is %d)\n", DEFAULT_WAIT_FLAG);
   exit(1);
}

Variable Documentation

const int DEFAULT_MAX_CALLS = 20

Definition at line 27 of file AsyncRPCs.c.

const int DEFAULT_MIN_CALLS = 1

Definition at line 26 of file AsyncRPCs.c.

const BOOL DEFAULT_WAIT_FLAG = FALSE

Definition at line 28 of file AsyncRPCs.c.

PSECURITY_DESCRIPTOR pszSecurity = NULL

Definition at line 30 of file AsyncRPCs.c.

Generated on Wed Nov 13 2024 16:53:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/ClUuid/ClUuid.Idl File Reference

  • NetDS
  • RPC
  • ClUuid

ClUuid.Idl File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/ClUuid/ClUuidc.c File Reference

  • NetDS
  • RPC
  • ClUuid
Functions

ClUuidc.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include "cluuid.h"

Go to the source code of this file.

Functions

void __cdecl | main (int argc, char **argv)
void __RPC_FAR *__RPC_USER | midl_user_allocate (size_t len)
void __RPC_USER | midl_user_free (void __RPC_FAR *ptr)
void | Usage (char *pszProgramName)

Function Documentation

void __cdecl main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 43 of file ClUuidc.c.

{
    RPC_STATUS status;
    unsigned char * pszUuid             = NULL;
    unsigned char * pszProtocolSequence = "ncacn_np";
    unsigned char * pszNetworkAddress   = NULL;
    unsigned char * pszEndpoint         = "\\pipe\\cluuid";
    unsigned char * pszOptions          = NULL;
    unsigned char * pszStringBinding    = NULL;
    unsigned char * pszString           = "hello, world";
    unsigned long ulCode;
    int i;

    /* allow the user to override settings with command line switches */
    for (i = 1; i < argc; i++) {
        if ((*argv[i] == '-') || (*argv[i] == '/')) {
            switch (tolower(*(argv[i]+1))) {
            case 'p':  // protocol sequence
                pszProtocolSequence = argv[++i];
                break;
            case 'n':  // network address
                pszNetworkAddress = argv[++i];
                break;
            case 'e':
                pszEndpoint = argv[++i];
                break;
            case 'o':
                pszOptions = argv[++i];
                break;
            case 's':
                pszString = argv[++i];
                break;
            case 'u':
                pszUuid = argv[++i];
                break;
            case 'h':
            case '?':
            default:
                Usage(argv[0]);
            }
        }
        else
            Usage(argv[0]);
    }

    /* Use a convenience function to concatenate the elements of  */
    /* the string binding into the proper sequence.               */
    status = RpcStringBindingCompose(pszUuid,
                                     pszProtocolSequence,
                                     pszNetworkAddress,
                                     pszEndpoint,
                                     pszOptions,
                                     &pszStringBinding);
    printf("RpcStringBindingCompose returned 0x%x\n", status);
    printf("pszStringBinding = %s\n", pszStringBinding);
    if (status) {
        exit(status);
    }

    /* Set the binding handle that will be used to bind to the server. */
    status = RpcBindingFromStringBinding(pszStringBinding,
                                         &ImpHandle);
    printf("RpcBindingFromStringBinding returned 0x%x\n", status);
    if (status) {
        exit(status);
    }

    printf("Calling the remote procedure 'HelloProc'\n");
    printf("  print the string '%s' on the server\n", pszString);

    RpcTryExcept {
        HelloProc(pszString);  /* make call with user message */
        printf("Calling the remote procedure 'Shutdown'\n");
        Shutdown();             // shut down the server side
    }
    RpcExcept(1) {
        ulCode = RpcExceptionCode();
        printf("Runtime reported exception 0x%lx = %ld\n", ulCode, ulCode);
    }
    RpcEndExcept

    /*  The calls to the remote procedures are complete. */
    /*  Free the string and the binding handle           */

    status = RpcStringFree(&pszStringBinding);  // remote calls done; unbind
    printf("RpcStringFree returned 0x%x\n", status);
    if (status) {
        exit(status);
    }

    status = RpcBindingFree(&ImpHandle);  // remote calls done; unbind
    printf("RpcBindingFree returned 0x%x\n", status);
    if (status) {
        exit(status);
    }

    exit(0);
}

void __RPC_FAR* __RPC_USER midl_user_allocate ( size_t len )

Definition at line 147 of file ClUuidc.c.

{
    return(malloc(len));
}

void __RPC_USER midl_user_free ( void __RPC_FAR * ptr )

Definition at line 152 of file ClUuidc.c.

{
    free(ptr);
}

void Usage ( char * pszProgramName )

Definition at line 31 of file ClUuidc.c.

{
    fprintf(stderr, "Usage:  %s\n", pszProgramName);
    fprintf(stderr, " -p protocol_sequence\n");
    fprintf(stderr, " -n network_address\n");
    fprintf(stderr, " -e endpoint\n");
    fprintf(stderr, " -o options\n");
    fprintf(stderr, " -s string\n");
    fprintf(stderr, " -u uuid\n");
    exit(1);
}

Generated on Wed Nov 13 2024 16:53:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/ClUuid/ClUuidp.c File Reference

  • NetDS
  • RPC
  • ClUuid
Functions

ClUuidp.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "cluuid.h"

Go to the source code of this file.

Functions

void | HelloProc (unsigned char *pszString)
void | HelloProc2 (unsigned char *pszString)
void | Shutdown (void)

Function Documentation

void HelloProc ( unsigned char * pszString )

Definition at line 55 of file ClUuidp.c.

{
    printf("%s\n", pszString);
}

void HelloProc2 ( unsigned char * pszString )

Definition at line 60 of file ClUuidp.c.

{
    printf("%s\n", strrev(pszString));
}

void Shutdown ( void )

Definition at line 65 of file ClUuidp.c.

{
    RPC_STATUS status;

    printf("Calling RpcMgmtStopServerListening\n");
    status = RpcMgmtStopServerListening(NULL);
    printf("RpcMgmtStopServerListening returned: 0x%x\n", status);
    if (status) {
        exit(status);
    }

    printf("Calling RpcServerUnregisterIf\n");
    status = RpcServerUnregisterIf(NULL, NULL, FALSE);
    printf("RpcServerUnregisterIf returned 0x%x\n", status);
    if (status) {
        exit(status);
    }
}

Generated on Wed Nov 13 2024 16:53:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/ClUuid/ClUuids.c File Reference

  • NetDS
  • RPC
  • ClUuid
Defines | Functions

ClUuids.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "cluuid.h"

Go to the source code of this file.

Defines

#define | NULL_UUID_STRING "00000000-0000-0000-0000-000000000000"
#define | PURPOSE "This Microsoft RPC Version 2.0 sample program demonstrates how\n\to supply multiple implementations of the remote procedure\n\specified in the interface. It also demonstrates how the client\n\selects among the implementations by providing a client object uuid.\n\n"

Functions

void | HelloProc2 (unsigned char *pszString)
void __cdecl | main (int argc, char *argv[])
void __RPC_FAR *__RPC_USER | midl_user_allocate (size_t len)
void __RPC_USER | midl_user_free (void __RPC_FAR *ptr)
void | Usage (char *pszProgramName)

Define Documentation

#define NULL_UUID_STRING "00000000-0000-0000-0000-000000000000"

Definition at line 41 of file ClUuids.c.

#define PURPOSE "This Microsoft RPC Version 2.0 sample program demonstrates how\n\to supply multiple implementations of the remote procedure\n\specified in the interface. It also demonstrates how the client\n\selects among the implementations by providing a client object uuid.\n\n"

Definition at line 35 of file ClUuids.c.

Function Documentation

void HelloProc2 ( unsigned char * pszString )

Definition at line 60 of file ClUuidp.c.

{
    printf("%s\n", strrev(pszString));
}

void __cdecl main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 58 of file ClUuids.c.

{
    RPC_STATUS status;
    UUID MgrTypeUuid, ClientUuid;
    unsigned char * pszProtocolSequence = "ncacn_np";
    unsigned char * pszSecurity         = NULL;
    unsigned char * pszClientUuid       = NULL_UUID_STRING;
    unsigned char * pszMgrTypeUuid      = "11111111-1111-1111-1111-111111111111";
    unsigned char * pszEndpoint         = "\\pipe\\cluuid";
    unsigned int    cMinCalls           = 1;
    unsigned int    cMaxCalls           = 20;
    unsigned int    fDontWait           = FALSE;
    int i;

    cluuid_SERVER_EPV epv2;    // the mgr_epv for the 2nd implementation

    /* allow the user to override settings with command line switches */
    for (i = 1; i < argc; i++) {
        if ((*argv[i] == '-') || (*argv[i] == '/')) {
            switch (tolower(*(argv[i]+1))) {
            case 'p':  // protocol sequence
                pszProtocolSequence = argv[++i];
                break;
            case 'e':
                pszEndpoint = argv[++i];
                break;
            case 'm':
                cMaxCalls = (unsigned int) atoi(argv[++i]);
                break;
            case 'n':
                cMinCalls = (unsigned int) atoi(argv[++i]);
                break;
            case 'f':
                fDontWait = (unsigned int) atoi(argv[++i]);
                break;
            case '1':
                pszMgrTypeUuid = argv[++i];
                break;
            case '2':
                pszClientUuid = argv[++i];
                break;
            case 'h':
            case '?':
            default:
                Usage(argv[0]);
            }
        }
        else
            Usage(argv[0]);
    }

    status = RpcServerUseProtseqEp(pszProtocolSequence,
                                   cMaxCalls,
                                   pszEndpoint,
                                   pszSecurity);  // Security descriptor
    printf("RpcServerUseProtseqEp returned 0x%x\n", status);
    if (status) {
        exit(status);
    }

    status = UuidFromString(pszClientUuid, &ClientUuid);
    printf("UuidFromString returned 0x%x = %d\n", status, status);
    if (status) {
        exit(status);
    }

    status = UuidFromString(pszMgrTypeUuid, &MgrTypeUuid);
    printf("UuidFromString returned 0x%x = %d\n", status, status);
    if (status) {
        exit(status);
    }
    if (strcmp (pszMgrTypeUuid, NULL_UUID_STRING) == 0) {
        printf("Register object using non-null uuid %s\n", pszMgrTypeUuid);
        exit(1);
    }

    if (strcmp (pszClientUuid, NULL_UUID_STRING) == 0) {
        printf("Register object using non-null uuid %s\n", pszMgrTypeUuid);
        ClientUuid = MgrTypeUuid;
    }

    RpcObjectSetType(&ClientUuid, &MgrTypeUuid);  // associate type UUID with nil UUID
    printf("RpcObjectSetType returned 0x%x\n", status);
    if (status) {
        exit(status);
    }

    status = RpcServerRegisterIf(cluuid_ServerIfHandle, // interface to register
                                 NULL,   // MgrTypeUuid
                                 NULL);  // MgrEpv; null means use default
    printf("RpcServerRegisterIf returned 0x%x\n", status);
    if (status) {
        exit(status);
    }

    /* register the second manager epv and associate it with the
       specified uuid.  the second uuid must be non-null so that
       it will not conflict with the NULL uuid already registered
       for this interface
    */
    epv2.HelloProc = HelloProc2;
    epv2.Shutdown = Shutdown;
    status = RpcServerRegisterIf(cluuid_ServerIfHandle, // interface to register
                                 &MgrTypeUuid,  // MgrTypeUuid
                                 &epv2);        // 2nd manager epv
    printf("RpcServerRegisterIf returned 0x%x\n", status);
    if (status) {
        exit(status);
    }

    printf("Calling RpcServerListen\n");
    status = RpcServerListen(cMinCalls,
                             cMaxCalls,
                             fDontWait);
    printf("RpcServerListen returned: 0x%x\n", status);
    if (status) {
        exit(status);
    }

    if (fDontWait) {
        printf("Calling RpcMgmtWaitServerListen\n");
        status = RpcMgmtWaitServerListen();  //  wait operation
        printf("RpcMgmtWaitServerListen returned: 0x%x\n", status);
        if (status) {
            exit(status);
        }
    }

} // end main()

void __RPC_FAR* __RPC_USER midl_user_allocate ( size_t len )

Definition at line 193 of file ClUuids.c.

{
    return(malloc(len));
}

void __RPC_USER midl_user_free ( void __RPC_FAR * ptr )

Definition at line 198 of file ClUuids.c.

{
    free(ptr);
}

void Usage ( char * pszProgramName )

Definition at line 43 of file ClUuids.c.

{
    fprintf(stderr, "%s", PURPOSE);
    fprintf(stderr, "Usage:  %s\n", pszProgramName);
    fprintf(stderr, " -p protocol_sequence\n");
    fprintf(stderr, " -e endpoint\n");
    fprintf(stderr, " -m maxcalls\n");
    fprintf(stderr, " -n mincalls\n");
    fprintf(stderr, " -f flag_wait_op\n");
    fprintf(stderr, " -1 client uuid\n");
    fprintf(stderr, " -2 manager uuid\n");
    exit(1);
}

Generated on Wed Nov 13 2024 16:53:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Data/DUnion/DUnion.Idl File Reference

  • NetDS
  • RPC
  • Data
  • DUnion

DUnion.Idl File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Data/DUnion/DUnionc.c File Reference

  • NetDS
  • RPC
  • Data
  • DUnion
Functions

DUnionc.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include "dunion.h"

Go to the source code of this file.

Functions

void | DisplayUnionValue (DISCRIM_UNION_PARAM_TYPE *up, short sDiscrim)
void __cdecl | main (int argc, char **argv)
void __RPC_FAR *__RPC_USER | midl_user_allocate (size_t len)
void __RPC_USER | midl_user_free (void __RPC_FAR *ptr)
void | Usage (char *pszProgramName)

Function Documentation

void DisplayUnionValue | ( | DISCRIM_UNION_PARAM_TYPE * | up,
 |  | short | sDiscrim
 | ) |  |

Definition at line 42 of file DUnionc.c.

{
    printf("sDiscrim = %d, data = ", sDiscrim);
    switch(sDiscrim) {
    case 0:
        printf("short: %d\n", up->sVal);
        break;
    case 1:
        printf("float: %f\n", up->fVal);
        break;
    case 2:
        printf("char: %c\n", up->chVal);
        break;
    default:
        printf("invalid\n");
        break;
    }
}

void __cdecl main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 62 of file DUnionc.c.

{
    RPC_STATUS status;
    unsigned char * pszUuid             = NULL;
    unsigned char * pszProtocolSequence = "ncacn_np";
    unsigned char * pszNetworkAddress   = NULL;
    unsigned char * pszEndpoint         = "\\pipe\\dunion";
    unsigned char * pszOptions          = NULL;
    unsigned char * pszStringBinding    = NULL;
    int i;

    short sDiscrim = 0;
    DISCRIM_UNION_PARAM_TYPE  up = {1};
    DISCRIM_UNION_STRUCT_TYPE us = {0, 1};

    /* allow the user to override settings with command line switches */
    for (i = 1; i < argc; i++) {
        if ((*argv[i] == '-') || (*argv[i] == '/')) {
            switch (tolower(*(argv[i]+1))) {
            case 'p':  // protocol sequence
                pszProtocolSequence = argv[++i];
                break;
            case 'n':  // network address
                pszNetworkAddress = argv[++i];
                break;
            case 'e':
                pszEndpoint = argv[++i];
                break;
            case 'o':
                pszOptions = argv[++i];
                break;
            case 'd':
                sDiscrim = (short) atoi(argv[++i]);
                if ((sDiscrim > 3) || (sDiscrim < 0))
                    sDiscrim = 0;
                us.sDiscrim = sDiscrim;
                break;
            case 'v':
                switch(sDiscrim) {
                case 0:
                    up.sVal =  (short) atoi(argv[++i]);
                    us.u.sVal = up.sVal;
                    break;
                case 1:
                    up.fVal =  (float) atof(argv[++i]);
                    us.u.fVal = up.fVal;
                    break;
                case 2:
                    up.chVal = *(argv[++i]);
                    us.u.chVal = up.chVal;
                    break;
                default:
                    break;
                }
                break;
            case 'h':
            case '?':
            default:
                Usage(argv[0]);
            }
        }
        else
            Usage(argv[0]);
    }

    /* Use a convenience function to concatenate the elements of  */
    /* the string binding into the proper sequence.               */
    status = RpcStringBindingCompose(pszUuid,
                                     pszProtocolSequence,
                                     pszNetworkAddress,
                                     pszEndpoint,
                                     pszOptions,
                                     &pszStringBinding);
    printf("RpcStringBindingCompose returned 0x%x\n", status);
    printf("pszStringBinding = %s\n", pszStringBinding);
    if (status) {
        exit(status);
    }

    /* Set the binding handle that will be used to bind to the server. */
    status = RpcBindingFromStringBinding(pszStringBinding,
                                         &hDiscrim);
    printf("RpcBindingFromStringBinding returned 0x%x\n", status);
    if (status) {
        exit(status);
    }

    printf("Calling the remote procedure 'UnionParamProc'\n");

    RpcTryExcept {
        DisplayUnionValue(&up, sDiscrim);  // display value before call
        UnionParamProc(&up, sDiscrim);     // call the remote procedure

        UnionStructProc(&us);              // call the remote procedure
        DisplayUnionValue(&up, sDiscrim);  // display value after call

        Shutdown();                    // Shut down the server
    }
    RpcExcept(1) {
        printf("Runtime reported exception %ld\n", RpcExceptionCode() );
    }
    RpcEndExcept

    /*  The remote procedure call is complete.  Free the binding handle */
    status = RpcBindingFree(&hDiscrim);
    printf("RpcBindingFree returned 0x%x\n", status);
    if (status) {
        exit(status);
    }

    exit(0);

}  // end main()

void __RPC_FAR* __RPC_USER midl_user_allocate ( size_t len )

Definition at line 181 of file DUnionc.c.

{
    return(malloc(len));
}

void __RPC_USER midl_user_free ( void __RPC_FAR * ptr )

Definition at line 186 of file DUnionc.c.

{
    free(ptr);
}

void Usage ( char * pszProgramName )

Definition at line 30 of file DUnionc.c.

{
    fprintf(stderr, "Usage:  %s\n", pszProgramName);
    fprintf(stderr, " -p protocol_sequence\n");
    fprintf(stderr, " -n network_address\n");
    fprintf(stderr, " -e endpoint\n");
    fprintf(stderr, " -o options\n");
    fprintf(stderr, " -d discriminant\n");
    fprintf(stderr, " -v union_value\n");
    exit(1);
}

Generated on Wed Nov 13 2024 16:53:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Data/DUnion/DUnionp.c File Reference

  • NetDS
  • RPC
  • Data
  • DUnion
Functions

DUnionp.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include "dunion.h"

Go to the source code of this file.

Functions

void | Shutdown (void)
void | UnionParamProc (DISCRIM_UNION_PARAM_TYPE *up, short sDiscrim)
void | UnionStructProc (DISCRIM_UNION_STRUCT_TYPE *u)

Function Documentation

void Shutdown ( void )

Definition at line 63 of file DUnionp.c.

{
    RPC_STATUS status;

    printf("Calling RpcMgmtStopServerListening\n");
    status = RpcMgmtStopServerListening(NULL);
    printf("RpcMgmtStopServerListening returned: 0x%x\n", status);
    if (status) {
        exit(status);
    }

    printf("Calling RpcServerUnregisterIf\n");
    status = RpcServerUnregisterIf(NULL, NULL, FALSE);
    printf("RpcServerUnregisterIf returned 0x%x\n", status);
    if (status) {
        exit(status);
    }
}

void UnionParamProc | ( | DISCRIM_UNION_PARAM_TYPE * | up,
 |  | short | sDiscrim
 | ) |  |

Definition at line 24 of file DUnionp.c.

{
    printf("sDiscrim = %d, data = ", sDiscrim);
    switch(sDiscrim) {
    case 0:
        printf("short %d\n", up->sVal);
        break;
    case 1:
        printf("float %f\n", up->fVal);
        break;
    case 2:
        printf("char %c\n", up->chVal);
        break;
    default:
        printf("invalid\n");
        break;
    }
}

void UnionStructProc ( DISCRIM_UNION_STRUCT_TYPE * u )

Definition at line 44 of file DUnionp.c.

{
    printf("sDiscrim = %d, data = ", u->sDiscrim);
    switch(u->sDiscrim) {
    case 0:
        printf("short %d\n", u->u.sVal);
        break;
    case 1:
        printf("float %f\n", u->u.fVal);
        break;
    case 2:
        printf("char %c\n", u->u.chVal);
        break;
    default:
        printf("invalid\n");
        break;
    }
}

Generated on Wed Nov 13 2024 16:53:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Data/DUnion/DUnions.c File Reference

  • NetDS
  • RPC
  • Data
  • DUnion
Defines | Functions

DUnions.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include "dunion.h"

Go to the source code of this file.

Defines

#define | PURPOSE "This Microsoft RPC Version 2.0 sample program demonstrates\n\two ways to specify a discriminated union. For more information\n\about the attributes and the RPC API functions, see the\n\RPC programming guide and reference.\n\n"

Functions

void __cdecl | main (int argc, char *argv[])
void __RPC_FAR *__RPC_USER | midl_user_allocate (size_t len)
void __RPC_USER | midl_user_free (void __RPC_FAR *ptr)
void | Usage (char *pszProgramName)

Define Documentation

#define PURPOSE "This Microsoft RPC Version 2.0 sample program demonstrates\n\two ways to specify a discriminated union. For more information\n\about the attributes and the RPC API functions, see the\n\RPC programming guide and reference.\n\n"

Definition at line 28 of file DUnions.c.

Function Documentation

void __cdecl main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 46 of file DUnions.c.

{
    RPC_STATUS status;
    unsigned char * pszProtocolSequence = "ncacn_np";
    unsigned char * pszSecurity         = NULL;
    unsigned char * pszEndpoint         = "\\pipe\\dunion";
    unsigned int    cMinCalls           = 1;
    unsigned int    cMaxCalls           = 20;
    unsigned int    fDontWait           = FALSE;
    int i;

    /* allow the user to override settings with command line switches */
    for (i = 1; i < argc; i++) {
        if ((*argv[i] == '-') || (*argv[i] == '/')) {
            switch (tolower(*(argv[i]+1))) {
            case 'p':  // protocol sequence
                pszProtocolSequence = argv[++i];
                break;
            case 'e':
                pszEndpoint = argv[++i];
                break;
            case 'm':
                cMaxCalls = (unsigned int) atoi(argv[++i]);
                break;
            case 'n':
                cMinCalls = (unsigned int) atoi(argv[++i]);
                break;
            case 'f':
                fDontWait = (unsigned int) atoi(argv[++i]);
                break;
            case 'h':
            case '?':
            default:
                Usage(argv[0]);
            }
        }
        else
            Usage(argv[0]);
     }

     status = RpcServerUseProtseqEp(pszProtocolSequence,
                                    cMaxCalls,
                                    pszEndpoint,
                                    pszSecurity);  // Security descriptor
     printf("RpcServerUseProtseqEp returned 0x%x\n", status);
     if (status) {
         exit(status);
     }

     status = RpcServerRegisterIf(dunion_ServerIfHandle,// interface to register
                                  NULL,   // MgrTypeUuid
                                  NULL);  // MgrEpv; null means use default
     printf("RpcServerRegisterIf returned 0x%x\n", status);
     if (status) {
         exit(status);
     }

     printf("Calling RpcServerListen\n");
     status = RpcServerListen(cMinCalls,
                              cMaxCalls,
                              fDontWait);
     printf("RpcServerListen returned: 0x%x\n", status);
     if (status) {
         exit(status);
     }

     if (fDontWait) {
         printf("Calling RpcMgmtWaitServerListen\n");
         status = RpcMgmtWaitServerListen();  //  wait operation
         printf("RpcMgmtWaitServerListen returned: 0x%x\n", status);
         if (status) {
             exit(status);
         }
     }

}  // end main()

void __RPC_FAR* __RPC_USER midl_user_allocate ( size_t len )

Definition at line 128 of file DUnions.c.

{
    return(malloc(len));
}

void __RPC_USER midl_user_free ( void __RPC_FAR * ptr )

Definition at line 133 of file DUnions.c.

{
    free(ptr);
}

void Usage ( char * pszProgramName )

Definition at line 34 of file DUnions.c.

{
    fprintf(stderr, "%s", PURPOSE);
    fprintf(stderr, "Usage:  %s\n", pszProgramName);
    fprintf(stderr, " -p protocol_sequence\n");
    fprintf(stderr, " -e endpoint\n");
    fprintf(stderr, " -m maxcalls\n");
    fprintf(stderr, " -n mincalls\n");
    fprintf(stderr, " -f flag_wait_op\n");
    exit(1);
}

Generated on Wed Nov 13 2024 16:53:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Data/InOut/InOut.Idl File Reference

  • NetDS
  • RPC
  • Data
  • InOut

InOut.Idl File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Data/InOut/InOutc.c File Reference

  • NetDS
  • RPC
  • Data
  • InOut
Defines | Functions

InOutc.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include "inout.h"

Go to the source code of this file.

Defines

#define | DESCRIPTION "One [in], one [out], and one [in,out] parameter are defined\n\for the function InOutProc(). This program displays the values\n\of these parameters before and after the remote procedure call.\n\n"
#define | PURPOSE "This Microsoft RPC Version 2.0 sample program demonstrates\n\use of the [in], [out], and [in, out] attributes. For more\n\information about attributes and RPC API functions, see the\n\Microsoft RPC programming guide and reference.\n\n"

Functions

void __cdecl | main (int argc, char **argv)
void __RPC_FAR *__RPC_USER | midl_user_allocate (size_t len)
void __RPC_USER | midl_user_free (void __RPC_FAR *ptr)
void | Usage (char *pszProgramName)

Define Documentation

#define DESCRIPTION "One [in], one [out], and one [in,out] parameter are defined\n\for the function InOutProc(). This program displays the values\n\of these parameters before and after the remote procedure call.\n\n"

Definition at line 36 of file InOutc.c.

#define PURPOSE "This Microsoft RPC Version 2.0 sample program demonstrates\n\use of the [in], [out], and [in, out] attributes. For more\n\information about attributes and RPC API functions, see the\n\Microsoft RPC programming guide and reference.\n\n"

Definition at line 30 of file InOutc.c.

Function Documentation

void __cdecl main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 55 of file InOutc.c.

{
    RPC_STATUS status;
    unsigned char * pszUuid             = NULL;
    unsigned char * pszProtocolSequence = "ncacn_np";
    unsigned char * pszNetworkAddress   = NULL;
    unsigned char * pszEndpoint         = "\\pipe\\inout";
    unsigned char * pszOptions          = NULL;
    unsigned char * pszStringBinding    = NULL;
    short   s1 = 257;
    short   s2 = 631;
    float   f3 = (float) 0.406;
    int i;

    /* allow the user to override settings with command line switches */
    for (i = 1; i < argc; i++) {
        if ((*argv[i] == '-') || (*argv[i] == '/')) {
            switch (tolower(*(argv[i]+1))) {
            case 'p':  // protocol sequence
                pszProtocolSequence = argv[++i];
                break;
            case 'n':  // network address
                pszNetworkAddress = argv[++i];
                break;
            case 'e':
                pszEndpoint = argv[++i];
                break;
            case 'o':
                pszOptions = argv[++i];
                break;
            case '1':
                s1 = (short) atoi(argv[++i]);
                break;
            case '2':
                s2 = (short) atoi(argv[++i]);
                break;
            case '3':
                f3 = (float) atof(argv[++i]);
                break;
            case 'h':
            case '?':
            default:
                Usage(argv[0]);
            }
        }
        else
            Usage(argv[0]);
    }

    printf("%s", DESCRIPTION);

    /* Use a convenience function to concatenate the elements of  */
    /* the string binding into the proper sequence.               */
    status = RpcStringBindingCompose(pszUuid,
                                     pszProtocolSequence,
                                     pszNetworkAddress,
                                     pszEndpoint,
                                     pszOptions,
                                     &pszStringBinding);
    printf("RpcStringBindingCompose returned 0x%x\n", status);
    printf("pszStringBinding = %s\n", pszStringBinding);
    if (status) {
        exit(status);
    }

    /* Set the binding handle that will be used to bind to the server. */
    status = RpcBindingFromStringBinding(pszStringBinding,
                                         &inout_IfHandle);
    printf("RpcBindingFromStringBinding returned 0x%x\n", status);
    if (status) {
        exit(status);
    }

    printf("Calling the remote procedure 'InOutProc'\n");
    printf("  parameters = %d %d %0.3f\n", s1, s2, f3);

    RpcTryExcept {
        InOutProc(s1, &s2, &f3);  // call the remote procedure

        printf("Returning from the remote procedure 'InOutProc'\n");
        printf("  parameters = %d %d %0.3f\n", s1, s2, f3);

        Shutdown();
    }
    RpcExcept(1) {
        printf("Runtime reported exception %ld\n", RpcExceptionCode() );
    }
    RpcEndExcept

    /* The call to the remote procedure is complete. */
    /* Free the string and binding handle.           */
    status = RpcBindingFree(&inout_IfHandle);
    printf("RpcBindingFree returned 0x%x\n", status);
    if (status) {
        exit(status);
    }

    status = RpcStringFree(&pszStringBinding);
    printf("RpcStringFree returned 0x%x\n", status);
    if (status) {
        exit(status);
    }

    exit(0);

}  // end main()

void __RPC_FAR* __RPC_USER midl_user_allocate ( size_t len )

Definition at line 167 of file InOutc.c.

{
    return(malloc(len));
}

void __RPC_USER midl_user_free ( void __RPC_FAR * ptr )

Definition at line 172 of file InOutc.c.

{
    free(ptr);
}

void Usage ( char * pszProgramName )

Definition at line 41 of file InOutc.c.

{
    fprintf(stderr, "%s", PURPOSE);
    fprintf(stderr, "Usage:  %s\n", pszProgramName);
    fprintf(stderr, " -p protocol_sequence\n");
    fprintf(stderr, " -n network_address\n");
    fprintf(stderr, " -e endpoint\n");
    fprintf(stderr, " -o options\n");
    fprintf(stderr, " -1 parameter_1\n");
    fprintf(stderr, " -2 parameter_2\n");
    fprintf(stderr, " -3 parameter_3\n");
    exit(1);
}

Generated on Wed Nov 13 2024 16:53:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Data/InOut/InOutp.c File Reference

  • NetDS
  • RPC
  • Data
  • InOut
Defines | Functions

InOutp.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include "inout.h"

Go to the source code of this file.

Defines

#define | CONSTANT 257

Functions

void | InOutProc (short s1, short *ps2, float *pf3)
void | Shutdown (void)

Define Documentation

#define CONSTANT 257

Definition at line 21 of file InOutp.c.

Function Documentation

void InOutProc | ( | short | s1,
 |  | short * | ps2,
 |  | float * | pf3
 | ) |  |

Definition at line 23 of file InOutp.c.

{
    printf("on entry, *pf3 = %f\n", *pf3);

    *pf3 = (float) s1 / (float) *ps2;
    printf("%d / %d = %0.3f\n", s1, *ps2, *pf3);

    *ps2 = (short)CONSTANT - s1;
    printf("%d - %d = %d\n", CONSTANT, s1, *ps2);

    s1++;

    return;
}

void Shutdown ( void )

Definition at line 40 of file InOutp.c.

{
    RPC_STATUS status;

    printf("Calling RpcMgmtStopServerListening\n");
    status = RpcMgmtStopServerListening(NULL);
    printf("RpcMgmtStopServerListening returned: 0x%x\n", status);
    if (status) {
        exit(status);
    }

    printf("Calling RpcServerUnregisterIf\n");
    status = RpcServerUnregisterIf(NULL, NULL, FALSE);
    printf("RpcServerUnregisterIf returned 0x%x\n", status);
    if (status) {
        exit(status);
    }
}

Generated on Wed Nov 13 2024 16:53:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Data/InOut/InOuts.c File Reference

  • NetDS
  • RPC
  • Data
  • InOut
Defines | Functions

InOuts.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include "inout.h"

Go to the source code of this file.

Defines

#define | PURPOSE "This Microsoft RPC Version 2.0 sample program demonstrates\n\the [in] and [out] directional attributes. For more information\n\about these attributes and the RPC API functions, see the\n\RPC programming guide and reference.\n\n"

Functions

void __cdecl | main (int argc, char *argv[])
void __RPC_FAR *__RPC_USER | midl_user_allocate (size_t len)
void __RPC_USER | midl_user_free (void __RPC_FAR *ptr)
void | Usage (char *pszProgramName)

Define Documentation

#define PURPOSE "This Microsoft RPC Version 2.0 sample program demonstrates\n\the [in] and [out] directional attributes. For more information\n\about these attributes and the RPC API functions, see the\n\RPC programming guide and reference.\n\n"

Definition at line 28 of file InOuts.c.

Function Documentation

void __cdecl main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 46 of file InOuts.c.

{
    RPC_STATUS status;
    unsigned char * pszProtocolSequence = "ncacn_np";
    unsigned char * pszSecurity         = NULL;
    unsigned char * pszEndpoint         = "\\pipe\\inout";
    unsigned int    cMinCalls           = 1;
    unsigned int    cMaxCalls           = 20;
    unsigned int    fDontWait           = FALSE;
    int i;

    /* allow the user to override settings with command line switches */
    for (i = 1; i < argc; i++) {
        if ((*argv[i] == '-') || (*argv[i] == '/')) {
            switch (tolower(*(argv[i]+1))) {
            case 'p':  // protocol sequence
                pszProtocolSequence = argv[++i];
                break;
            case 'e':
                pszEndpoint = argv[++i];
                break;
            case 'm':
                cMaxCalls = (unsigned int) atoi(argv[++i]);
                break;
            case 'n':
                cMinCalls = (unsigned int) atoi(argv[++i]);
                break;
            case 'f':
                fDontWait = (unsigned int) atoi(argv[++i]);
                break;
            case 'h':
            case '?':
            default:
                Usage(argv[0]);
            }
        }
        else
            Usage(argv[0]);
    }

    status = RpcServerUseProtseqEp(pszProtocolSequence,
                                   cMaxCalls,
                                   pszEndpoint,
                                   pszSecurity);  // Security descriptor
    printf("RpcServerUseProtseqEp returned 0x%x\n", status);
    if (status) {
        exit(status);
    }

    status = RpcServerRegisterIf(inout_ServerIfHandle,  // interface to register
                                 NULL,   // MgrTypeUuid
                                 NULL);  // MgrEpv; null means use default
    printf("RpcServerRegisterIf returned 0x%x\n", status);
    if (status) {
        exit(status);
    }

    printf("Calling RpcServerListen\n");
    status = RpcServerListen(cMinCalls,
                             cMaxCalls,
                             fDontWait);
    printf("RpcServerListen returned: 0x%x\n", status);
    if (status) {
        exit(status);
    }

    if (fDontWait) {
        printf("Calling RpcMgmtWaitServerListen\n");
        status = RpcMgmtWaitServerListen();  //  wait operation
        printf("RpcMgmtWaitServerListen returned: 0x%x\n", status);
        if (status) {
            exit(status);
        }
    }

}  // end main()

void __RPC_FAR* __RPC_USER midl_user_allocate ( size_t len )

Definition at line 128 of file InOuts.c.

{
    return(malloc(len));
}

void __RPC_USER midl_user_free ( void __RPC_FAR * ptr )

Definition at line 133 of file InOuts.c.

{
    free(ptr);
}

void Usage ( char * pszProgramName )

Definition at line 34 of file InOuts.c.

{
    fprintf(stderr, "%s", PURPOSE);
    fprintf(stderr, "Usage:  %s\n", pszProgramName);
    fprintf(stderr, " -p protocol_sequence\n");
    fprintf(stderr, " -e endpoint\n");
    fprintf(stderr, " -m maxcalls\n");
    fprintf(stderr, " -n mincalls\n");
    fprintf(stderr, " -f flag_wait_op\n");
    exit(1);
}

Generated on Wed Nov 13 2024 16:53:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Data/repas/Repas.Idl File Reference

  • NetDS
  • RPC
  • Data
  • repas

Repas.Idl File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Data/repas/Repasc.c File Reference

  • NetDS
  • RPC
  • Data
  • repas
Defines | Functions

Repasc.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include "repasc.h"

Go to the source code of this file.

Defines

#define | MAX_ELEMENTS 50
#define | PURPOSE "This Microsoft RPC Version 2.0 sample program demonstrates\n\the use of the [represent_as] attribute. For more information\n\about the attributes and the RPC API functions, see the\n\RPC programming guide and reference.\n\n"

Functions

void __cdecl | main (int argc, char **argv)
void | Usage (char *pszProgramName)

Define Documentation

#define MAX_ELEMENTS 50

Definition at line 63 of file Repasc.c.

#define PURPOSE "This Microsoft RPC Version 2.0 sample program demonstrates\n\the use of the [represent_as] attribute. For more information\n\about the attributes and the RPC API functions, see the\n\RPC programming guide and reference.\n\n"

Definition at line 57 of file Repasc.c.

Function Documentation

void __cdecl main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 79 of file Repasc.c.

{
    RPC_STATUS status;
    unsigned char * pszUuid             = NULL;
    unsigned char * pszProtocolSequence = "ncacn_np";
    unsigned char * pszNetworkAddress   = NULL;
    unsigned char * pszEndpoint         = "\\pipe\\repas";
    unsigned char * pszOptions          = NULL;
    unsigned char * pszStringBinding    = NULL;
    int i;
    int cElements = 10;
    short sValue = 100;
    short sDelta = 10;

    char    FirstBuffer[100];

    /* allow the user to override settings with command line switches */
    for (i = 1; i < argc; i++) {
        if ((*argv[i] == '-') || (*argv[i] == '/')) {
            switch (tolower(*(argv[i]+1))) {
            case 'p':  // protocol sequence
                pszProtocolSequence = argv[++i];
                break;
            case 'n':  // network address
                pszNetworkAddress = argv[++i];
                break;
            case 'e':
                pszEndpoint = argv[++i];
                break;
            case 'o':
                pszOptions = argv[++i];
                break;
            case 'c':
                cElements = atoi(argv[++i]);
                if (cElements > MAX_ELEMENTS)
                    cElements = MAX_ELEMENTS;
                break;
            case 'v':
                sValue = (short)atoi(argv[++i]);
                break;
            case 'd':
                sDelta = (short)atoi(argv[++i]);
                break;
            case 'h':
            case '?':
            default:
                Usage(argv[0]);
            }
        }
        else
            Usage(argv[0]);
    }

    /* Use a convenience function to concatenate the elements of the string */
    /* binding into the syntax needed by RpcBindingFromStringBinding.       */
    status = RpcStringBindingCompose(pszUuid,
                                     pszProtocolSequence,
                                     pszNetworkAddress,
                                     pszEndpoint,
                                     pszOptions,
                                     &pszStringBinding);
    printf("RpcStringBindingCompose returned 0x%x\n", status);
    printf("pszStringBinding = %s\n", pszStringBinding);
    if (status) {
        exit(status);
    }

    /* Set the binding handle that will be used to bind to the server. */
    status = RpcBindingFromStringBinding(pszStringBinding,
                                         &hrepas);
    printf("RpcBindingFromStringBinding returned 0x%x\n", status);
    if (status) {
        exit(status);
    }

    RpcTryExcept {
        // initialize a string to be shipped
        strcpy(FirstBuffer,"This ASCII string is sent from the client to the server as UNICODE");

        printf("\nThe Client side is about to send:\n\"%s\"\n\n", FirstBuffer );

        printf("Calling the remote procedure 'ModifyMyWString'\n");
        // note that the client sees the interface using ascii, not unicode
        ModifyMyWString( &FirstBuffer );
        printf("The Client side got back:\n\"%s\"\n\n", FirstBuffer );

        // initialize a string to be shipped
        strcpy(FirstBuffer,"And this ASCII string is sent from the client to the server as ASCII");

        printf("The Client side is about to send:\n\"%s\"\n\n", FirstBuffer );
        printf("Calling the remote procedure 'ModifyMyString'\n");
        // note that the client sees the interface using ascii
        ModifyMyString( &FirstBuffer );
        printf("The Client side got back:\n\"%s\"\n\n", FirstBuffer );

        printf("Calling the remote procedure 'Shutdown'\n");
        Shutdown();  // shut down the server side
    }
    RpcExcept(1) {
        printf("Runtime reported exception %ld\n", RpcExceptionCode() );
    }
    RpcEndExcept

    /* The calls to the remote procedures are complete.            */
    /* Free the string and the binding handle using RPC API calls. */
    status = RpcStringFree(&pszStringBinding);
    printf("RpcStringFree returned 0x%x\n", status);
    if (status) {
        exit(status);
    }

    status = RpcBindingFree(&hrepas);
    printf("RpcBindingFree returned 0x%x\n", status);
    if (status) {
        exit(status);
    }

    exit(0);

}  // end main()

void Usage ( char * pszProgramName )

Definition at line 65 of file Repasc.c.

{
    fprintf(stderr, "%s", PURPOSE);
    fprintf(stderr, "Usage:  %s\n", pszProgramName);
    fprintf(stderr, " -p protocol_sequence\n");
    fprintf(stderr, " -n network_address\n");
    fprintf(stderr, " -e endpoint\n");
    fprintf(stderr, " -o options\n");
    fprintf(stderr, " -c count_of_elements\n");
    fprintf(stderr, " -v value\n");
    fprintf(stderr, " -d delta\n");
    exit(1);
}

Generated on Wed Nov 13 2024 16:53:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Data/repas/Repascu.c File Reference

  • NetDS
  • RPC
  • Data
  • repas
Functions

Repascu.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include "repasc.h"

Go to the source code of this file.

Functions

void __RPC_FAR *__RPC_USER | midl_user_allocate (size_t len)
void __RPC_USER | midl_user_free (void __RPC_FAR *ptr)
void __RPC_USER | WCHAR_STRING_free_inst (WCHAR_STRING __RPC_FAR *pWire)
void __RPC_USER | WCHAR_STRING_free_local (CHAR_STRING __RPC_FAR *pLocal)
void __RPC_USER | WCHAR_STRING_from_local (CHAR_STRING __RPC_FAR *pLocal, WCHAR_STRING __RPC_FAR *__RPC_FAR *ppWire)
void __RPC_USER | WCHAR_STRING_to_local (WCHAR_STRING __RPC_FAR *pWire, CHAR_STRING __RPC_FAR *pLocal)

Function Documentation

void __RPC_FAR* __RPC_USER midl_user_allocate ( size_t len )

Definition at line 140 of file Repascu.c.

{
    return(malloc(len));
}

void __RPC_USER midl_user_free ( void __RPC_FAR * ptr )

Definition at line 145 of file Repascu.c.

{
    free(ptr);
}

void __RPC_USER WCHAR_STRING_free_inst ( WCHAR_STRING __RPC_FAR * pWire )

Definition at line 112 of file Repascu.c.

{
    midl_user_free( pWire );
}

void __RPC_USER WCHAR_STRING_free_local ( CHAR_STRING __RPC_FAR * pLocal )

Definition at line 128 of file Repascu.c.

{
    /* As there are no embedded pointers in the
     * local type. So nothing to free
     */

     return;
}

void __RPC_USER WCHAR_STRING_from_local | ( | CHAR_STRING __RPC_FAR * | pLocal,
 |  | WCHAR_STRING __RPC_FAR *__RPC_FAR * | ppWire
 | ) |  |

Definition at line 68 of file Repascu.c.

{
    WCHAR_STRING    *   pWireString;

    pWireString = midl_user_allocate( sizeof( WCHAR_STRING ) );

    *ppWire = pWireString;

    mbstowcs( *pWireString, *pLocal, STRING_SIZE );
}

void __RPC_USER WCHAR_STRING_to_local | ( | WCHAR_STRING __RPC_FAR * | pWire,
 |  | CHAR_STRING __RPC_FAR * | pLocal
 | ) |  |

Definition at line 94 of file Repascu.c.

{
    wcstombs( *pLocal, *pWire, STRING_SIZE );
}

Generated on Wed Nov 13 2024 16:53:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Data/repas/Repasp.c File Reference

  • NetDS
  • RPC
  • Data
  • repas
Functions

Repasp.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include "repass.h"

Go to the source code of this file.

Functions

void | ModifyMyString (WCHAR_STRING *pStr)
void | ModifyMyWString (WCHAR_STRING *pStr)
void | Shutdown (void)

Function Documentation

void ModifyMyString ( WCHAR_STRING * pStr )

Definition at line 63 of file Repasp.c.

{
    wprintf(L"\nModifyMyString: received UNICODE string:\n%s\n\n", *pStr );
    wcscpy(*pStr, L"This UNICODE string comes back on the wire as ASCII");
    wprintf(L"ModifyMyString: sending UNICODE string:\n%s\n\n", *pStr );

}

void ModifyMyWString ( WCHAR_STRING * pStr )

Definition at line 39 of file Repasp.c.

{
    wprintf(L"\nModifyMyWString: received UNICODE string:\n%s\n\n", *pStr );
    wcscpy(*pStr, L"This string comes back on the wire as UNICODE");
    wprintf(L"ModifyMyWString: sending UNICODE string:\n%s\n\n", *pStr );

}

void Shutdown ( void )

Definition at line 89 of file Repasp.c.

{
    RPC_STATUS status;

    printf("Calling RpcMgmtStopServerListening\n");
    status = RpcMgmtStopServerListening(NULL);
    printf("RpcMgmtStopServerListening returned: 0x%x\n", status);
    if (status) {
        exit(status);
    }

    printf("Calling RpcServerUnregisterIf\n");
    status = RpcServerUnregisterIf(NULL, NULL, FALSE);
    printf("RpcServerUnregisterIf returned 0x%x\n", status);
    if (status) {
        exit(status);
    }
}

Generated on Wed Nov 13 2024 16:53:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Data/repas/Repass.c File Reference

  • NetDS
  • RPC
  • Data
  • repas
Defines | Functions

Repass.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include "repass.h"

Go to the source code of this file.

Defines

#define | PURPOSE "This Microsoft RPC Version 2.0 sample program demonstrates\n\the use of the [transmit_as] attribute. For more information\n\about the attributes and the RPC API functions, see the\n\RPC programming guide and reference.\n\n"

Functions

void __cdecl | main (int argc, char *argv[])
void | Usage (char *pszProgramName)

Define Documentation

#define PURPOSE "This Microsoft RPC Version 2.0 sample program demonstrates\n\the use of the [transmit_as] attribute. For more information\n\about the attributes and the RPC API functions, see the\n\RPC programming guide and reference.\n\n"

Definition at line 48 of file Repass.c.

Function Documentation

void __cdecl main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 67 of file Repass.c.

{
    RPC_STATUS status;
    unsigned char * pszProtocolSequence = "ncacn_np";
    unsigned char * pszSecurity         = NULL;
    unsigned char * pszEndpoint         = "\\pipe\\repas";
    unsigned int    cMinCalls           = 1;
    unsigned int    cMaxCalls           = 20;
    unsigned int    fDontWait           = FALSE;
    int i;

    /* allow the user to override settings with command line switches */
    for (i = 1; i < argc; i++) {
        if ((*argv[i] == '-') || (*argv[i] == '/')) {
            switch (tolower(*(argv[i]+1))) {
            case 'p':  // protocol sequence
                pszProtocolSequence = argv[++i];
                break;
            case 'e':
                pszEndpoint = argv[++i];
                break;
            case 'm':
                cMaxCalls = (unsigned int) atoi(argv[++i]);
                break;
            case 'n':
                cMinCalls = (unsigned int) atoi(argv[++i]);
                break;
            case 'f':
                fDontWait = (unsigned int) atoi(argv[++i]);
                break;
            case 'h':
            case '?':
            default:
                Usage(argv[0]);
            }
        }
        else
            Usage(argv[0]);
    }

    status = RpcServerUseProtseqEp(pszProtocolSequence,
                                   cMaxCalls,
                                   pszEndpoint,
                                   pszSecurity);  // Security descriptor
    printf("RpcServerUseProtseqEp returned 0x%x\n", status);
    if (status) {
        exit(status);
    }

    status = RpcServerRegisterIf(repas_ServerIfHandle,  // interface to register
                                 NULL,   // MgrTypeUuid
                                 NULL);  // MgrEpv; null means use default
    printf("RpcServerRegisterIf returned 0x%x\n", status);
    if (status) {
        exit(status);
    }

    printf("Calling RpcServerListen\n");
    status = RpcServerListen(cMinCalls,
                             cMaxCalls,
                             fDontWait);
    printf("RpcServerListen returned: 0x%x\n", status);
    if (status) {
        exit(status);
    }

    if (fDontWait) {
        printf("Calling RpcMgmtWaitServerListen\n");
        status = RpcMgmtWaitServerListen();  //  wait operation
        printf("RpcMgmtWaitServerListen returned: 0x%x\n", status);
        if (status) {
            exit(status);
        }
    }

}  // end main()

void Usage ( char * pszProgramName )

Definition at line 54 of file Repass.c.

{
    fprintf(stderr, "%s", PURPOSE);
    fprintf(stderr, "Usage:  %s\n", pszProgramName);
    fprintf(stderr, " -p protocol_sequence\n");
    fprintf(stderr, " -e endpoint\n");
    fprintf(stderr, " -m maxcalls\n");
    fprintf(stderr, " -n mincalls\n");
    fprintf(stderr, " -f flag_wait_op\n");
    exit(1);
}

Generated on Wed Nov 13 2024 16:53:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Data/repas/Repassu.c File Reference

  • NetDS
  • RPC
  • Data
  • repas
Functions

Repassu.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include "repass.h"

Go to the source code of this file.

Functions

void __RPC_USER | CHAR_STRING_free_inst (CHAR_STRING __RPC_FAR *pWire)
void __RPC_USER | CHAR_STRING_free_local (WCHAR_STRING __RPC_FAR *pLocal)
void __RPC_USER | CHAR_STRING_from_local (WCHAR_STRING __RPC_FAR *pLocal, CHAR_STRING __RPC_FAR *__RPC_FAR *ppWire)
void __RPC_USER | CHAR_STRING_to_local (CHAR_STRING __RPC_FAR *pWire, WCHAR_STRING __RPC_FAR *pLocal)
void __RPC_FAR *__RPC_USER | midl_user_allocate (size_t len)
void __RPC_USER | midl_user_free (void __RPC_FAR *ptr)

Function Documentation

void __RPC_USER CHAR_STRING_free_inst ( CHAR_STRING __RPC_FAR * pWire )

Definition at line 110 of file Repassu.c.

{
    midl_user_free( pWire );
}

void __RPC_USER CHAR_STRING_free_local ( WCHAR_STRING __RPC_FAR * pLocal )

Definition at line 127 of file Repassu.c.

{
     /* As there are no embedded pointers in the
     * local type. So nothing to free
     */

     return;
}

void __RPC_USER CHAR_STRING_from_local | ( | WCHAR_STRING __RPC_FAR * | pLocal,
 |  | CHAR_STRING __RPC_FAR *__RPC_FAR * | ppWire
 | ) |  |

Definition at line 67 of file Repassu.c.

{
    CHAR_STRING    *   pWireString;

    pWireString = midl_user_allocate( sizeof( CHAR_STRING ) );

    *ppWire = pWireString;

    wcstombs( *pWireString, *pLocal, STRING_SIZE );
}

void __RPC_USER CHAR_STRING_to_local | ( | CHAR_STRING __RPC_FAR * | pWire,
 |  | WCHAR_STRING __RPC_FAR * | pLocal
 | ) |  |

Definition at line 92 of file Repassu.c.

{
    mbstowcs( *pLocal, *pWire, STRING_SIZE );
}

void __RPC_FAR* __RPC_USER midl_user_allocate ( size_t len )

Definition at line 139 of file Repassu.c.

{
    return(malloc(len));
}

void __RPC_USER midl_user_free ( void __RPC_FAR * ptr )

Definition at line 144 of file Repassu.c.

{
    free(ptr);
}

Generated on Wed Nov 13 2024 16:53:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Data/Xmit/Xmit.Idl File Reference

  • NetDS
  • RPC
  • Data
  • Xmit

Xmit.Idl File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Data/Xmit/Xmitc.c File Reference

  • NetDS
  • RPC
  • Data
  • Xmit
Defines | Functions

Xmitc.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include "xmit.h"
#include "xmitu.h"

Go to the source code of this file.

Defines

#define | MAX_ELEMENTS 50
#define | PURPOSE "This Microsoft RPC Version 2.0 sample program demonstrates\n\the use of the [transmit_as] attribute. For more information\n\about the attributes and the RPC API functions, see the\n\RPC programming guide and reference.\n\n"

Functions

void __cdecl | main (int argc, char **argv)
void | Usage (char *pszProgramName)

Define Documentation

#define MAX_ELEMENTS 50

Definition at line 59 of file Xmitc.c.

#define PURPOSE "This Microsoft RPC Version 2.0 sample program demonstrates\n\the use of the [transmit_as] attribute. For more information\n\about the attributes and the RPC API functions, see the\n\RPC programming guide and reference.\n\n"

Definition at line 53 of file Xmitc.c.

Function Documentation

void __cdecl main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 75 of file Xmitc.c.

{
    RPC_STATUS status;
    unsigned char * pszUuid             = NULL;
    unsigned char * pszProtocolSequence = "ncacn_np";
    unsigned char * pszNetworkAddress   = NULL;
    unsigned char * pszEndpoint         = "\\pipe\\xmit";
    unsigned char * pszOptions          = NULL;
    unsigned char * pszStringBinding    = NULL;
    int i;
    int cElements = 10;
    short sValue = 100;
    short sDelta = 10;

    DOUBLE_LINK_TYPE *pFirst, *pCurrent;

    /* allow the user to override settings with command line switches */
    for (i = 1; i < argc; i++) {
        if ((*argv[i] == '-') || (*argv[i] == '/')) {
            switch (tolower(*(argv[i]+1))) {
            case 'p':  // protocol sequence
                pszProtocolSequence = argv[++i];
                break;
            case 'n':  // network address
                pszNetworkAddress = argv[++i];
                break;
            case 'e':
                pszEndpoint = argv[++i];
                break;
            case 'o':
                pszOptions = argv[++i];
                break;
            case 'c':
                cElements = atoi(argv[++i]);
                if (cElements > MAX_ELEMENTS)
                    cElements = MAX_ELEMENTS;
                break;
            case 'v':
                sValue = (short)atoi(argv[++i]);
                break;
            case 'd':
                sDelta = (short)atoi(argv[++i]);
                break;
            case 'h':
            case '?':
            default:
                Usage(argv[0]);
            }
        }
        else
            Usage(argv[0]);
    }

    /* initialize a list with a number of elements */
    pFirst = InsertNewNode(sValue, NULL);
    pCurrent = pFirst;   // assign some values to the list nodes
    sValue += sDelta;    // make them different values

    for (i = 1; i < cElements; i++) {
        pCurrent = InsertNewNode(sValue, pCurrent);
        sValue += sDelta;
    }
    ListWalkProc(pFirst);

    /* Use a convenience function to concatenate the elements of the string */
    /* binding into the syntax needed by RpcBindingFromStringBinding.       */
    status = RpcStringBindingCompose(pszUuid,
                                     pszProtocolSequence,
                                     pszNetworkAddress,
                                     pszEndpoint,
                                     pszOptions,
                                     &pszStringBinding);
    printf("RpcStringBindingCompose returned 0x%x\n", status);
    printf("pszStringBinding = %s\n", pszStringBinding);
    if (status) {
        exit(status);
    }

    /* Set the binding handle that will be used to bind to the server. */
    status = RpcBindingFromStringBinding(pszStringBinding,
                                         &hXmit);
    printf("RpcBindingFromStringBinding returned 0x%x\n", status);
    if (status) {
        exit(status);
    }

    RpcTryExcept {
        printf("Calling the remote procedure 'ModifyListProc'\n");
        ModifyListProc(pFirst);  // call the remote procedure

        printf("Calling the remote procedure 'Shutdown'\n");
        Shutdown();  // shut down the server side
    }
    RpcExcept(1) {
        printf("Runtime reported exception %ld\n", RpcExceptionCode() );
    }
    RpcEndExcept

    printf("After ModifyListProc, the list appears as follows:\n");
    ListWalkProc(pFirst);  // call the utility that displays the list

    /* The calls to the remote procedures are complete.            */
    /* Free the string and the binding handle using RPC API calls. */
    status = RpcStringFree(&pszStringBinding);
    printf("RpcStringFree returned 0x%x\n", status);
    if (status) {
        exit(status);
    }

    status = RpcBindingFree(&hXmit);
    printf("RpcBindingFree returned 0x%x\n", status);
    if (status) {
        exit(status);
    }

    exit(0);

}  // end main()

void Usage ( char * pszProgramName )

Definition at line 61 of file Xmitc.c.

{
    fprintf(stderr, "%s", PURPOSE);
    fprintf(stderr, "Usage:  %s\n", pszProgramName);
    fprintf(stderr, " -p protocol_sequence\n");
    fprintf(stderr, " -n network_address\n");
    fprintf(stderr, " -e endpoint\n");
    fprintf(stderr, " -o options\n");
    fprintf(stderr, " -c count_of_elements\n");
    fprintf(stderr, " -v value\n");
    fprintf(stderr, " -d delta\n");
    exit(1);
}

Generated on Wed Nov 13 2024 16:53:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Data/Xmit/Xmitp.c File Reference

  • NetDS
  • RPC
  • Data
  • Xmit
Functions

Xmitp.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include "xmit.h"

Go to the source code of this file.

Functions

DOUBLE_LINK_TYPE * | InsertNewNode (short sValue, DOUBLE_LINK_TYPE *pPrevious)
void | ModifyListProc (DOUBLE_LINK_TYPE *pFirst)
void | Shutdown (void)

Function Documentation

DOUBLE_LINK_TYPE* InsertNewNode | ( | short | sValue,
 |  | DOUBLE_LINK_TYPE * | pPrevious
 | ) |  |

Definition at line 63 of file Xmitu.c.

{
    DOUBLE_LINK_TYPE * pNew;

    do {
        pNew = (DOUBLE_LINK_TYPE *)midl_user_allocate(sizeof(DOUBLE_LINK_TYPE));
    } while (pNew == pPrevious);

    pNew->pNext = NULL;      // initialize
    pNew->pPrevious = NULL;  // initialize
    pNew->sNumber = sValue;  // insert b between a and c

    pNew->pPrevious = pPrevious;             // prev(b) = a
    if (pPrevious == NULL)
        pNew->pNext = NULL;
    else {
        pNew->pNext = pPrevious->pNext;      // next(b) = c
        pPrevious->pNext = pNew;             // next(a) = b
        if (pNew->pNext != NULL)
            (pNew->pNext)->pPrevious = pNew; // prev(c) = b
    }

    return(pNew);
}

void ModifyListProc ( DOUBLE_LINK_TYPE * pFirst )

Definition at line 49 of file Xmitp.c.

{
    DOUBLE_LINK_TYPE * pList = pFirst;
    short newNumber;

    printf("ModifyListProc: Display contents of doubly linked list:\n");
    while (pList != NULL) {
         printf("pList @0x%p = %d, Next = 0x%p\n",
                pList, pList->sNumber, pList->pNext);
         pList = pList->pNext;
    }

    printf("ModifyListProc: Add one node for every node in tree\n");
    for (pList = pFirst; pList != NULL; pList = pList->pNext) {
        newNumber = pList->sNumber + 1;
        pList = InsertNewNode(newNumber, pList);
    }

    printf("ModifyListProc: Display modified contents of doubly linked list:\n");
    for (pList = pFirst; pList != NULL; pList = pList->pNext) {
        printf("pList @0x%p = %d, Next = 0x%p\n",
               pList, pList->sNumber, pList->pNext);
    }
}

void Shutdown ( void )

Definition at line 92 of file Xmitp.c.

{
    RPC_STATUS status;

    printf("Calling RpcMgmtStopServerListening\n");
    status = RpcMgmtStopServerListening(NULL);
    printf("RpcMgmtStopServerListening returned: 0x%x\n", status);
    if (status) {
        exit(status);
    }

    printf("Calling RpcServerUnregisterIf\n");
    status = RpcServerUnregisterIf(NULL, NULL, FALSE);
    printf("RpcServerUnregisterIf returned 0x%x\n", status);
    if (status) {
        exit(status);
    }
}

Generated on Wed Nov 13 2024 16:53:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Data/Xmit/Xmits.c File Reference

  • NetDS
  • RPC
  • Data
  • Xmit
Defines | Functions

Xmits.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include "xmit.h"
#include "xmitu.h"

Go to the source code of this file.

Defines

#define | PURPOSE "This Microsoft RPC Version 2.0 sample program demonstrates\n\the use of the [transmit_as] attribute. For more information\n\about the attributes and the RPC API functions, see the\n\RPC programming guide and reference.\n\n"

Functions

void __cdecl | main (int argc, char *argv[])
void | Usage (char *pszProgramName)

Define Documentation

#define PURPOSE "This Microsoft RPC Version 2.0 sample program demonstrates\n\the use of the [transmit_as] attribute. For more information\n\about the attributes and the RPC API functions, see the\n\RPC programming guide and reference.\n\n"

Definition at line 43 of file Xmits.c.

Function Documentation

void __cdecl main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 62 of file Xmits.c.

{
    RPC_STATUS status;
    unsigned char * pszProtocolSequence = "ncacn_np";
    unsigned char * pszSecurity         = NULL;
    unsigned char * pszEndpoint         = "\\pipe\\xmit";
    unsigned int    cMinCalls           = 1;
    unsigned int    cMaxCalls           = 20;
    unsigned int    fDontWait           = FALSE;
    int i;

    /* allow the user to override settings with command line switches */
    for (i = 1; i < argc; i++) {
        if ((*argv[i] == '-') || (*argv[i] == '/')) {
            switch (tolower(*(argv[i]+1))) {
            case 'p':  // protocol sequence
                pszProtocolSequence = argv[++i];
                break;
            case 'e':
                pszEndpoint = argv[++i];
                break;
            case 'm':
                cMaxCalls = (unsigned int) atoi(argv[++i]);
                break;
            case 'n':
                cMinCalls = (unsigned int) atoi(argv[++i]);
                break;
            case 'f':
                fDontWait = (unsigned int) atoi(argv[++i]);
                break;
            case 'h':
            case '?':
            default:
                Usage(argv[0]);
            }
        }
        else
            Usage(argv[0]);
    }

    status = RpcServerUseProtseqEp(pszProtocolSequence,
                                   cMaxCalls,
                                   pszEndpoint,
                                   pszSecurity);  // Security descriptor
    printf("RpcServerUseProtseqEp returned 0x%x\n", status);
    if (status) {
        exit(status);
    }

    status = RpcServerRegisterIf(xmit_ServerIfHandle,  // interface to register
                                 NULL,   // MgrTypeUuid
                                 NULL);  // MgrEpv; null means use default
    printf("RpcServerRegisterIf returned 0x%x\n", status);
    if (status) {
        exit(status);
    }

    printf("Calling RpcServerListen\n");
    status = RpcServerListen(cMinCalls,
                             cMaxCalls,
                             fDontWait);
    printf("RpcServerListen returned: 0x%x\n", status);
    if (status) {
        exit(status);
    }

    if (fDontWait) {
        printf("Calling RpcMgmtWaitServerListen\n");
        status = RpcMgmtWaitServerListen();  //  wait operation
        printf("RpcMgmtWaitServerListen returned: 0x%x\n", status);
        if (status) {
            exit(status);
        }
    }

}  // end main()

void Usage ( char * pszProgramName )

Definition at line 49 of file Xmits.c.

{
    fprintf(stderr, "%s", PURPOSE);
    fprintf(stderr, "Usage:  %s\n", pszProgramName);
    fprintf(stderr, " -p protocol_sequence\n");
    fprintf(stderr, " -e endpoint\n");
    fprintf(stderr, " -m maxcalls\n");
    fprintf(stderr, " -n mincalls\n");
    fprintf(stderr, " -f flag_wait_op\n");
    exit(1);
}

Generated on Wed Nov 13 2024 16:53:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Data/Xmit/Xmitu.c File Reference

  • NetDS
  • RPC
  • Data
  • Xmit
Functions

Xmitu.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include "xmit.h"
#include "xmitu.h"

Go to the source code of this file.

Functions

void | ArrayWalkProc (DOUBLE_XMIT_TYPE *pArray)
void __RPC_USER | DOUBLE_LINK_TYPE_free_inst (DOUBLE_LINK_TYPE __RPC_FAR *pList)
void __RPC_USER | DOUBLE_LINK_TYPE_free_xmit (DOUBLE_XMIT_TYPE __RPC_FAR *pArray)
void __RPC_USER | DOUBLE_LINK_TYPE_from_xmit (DOUBLE_XMIT_TYPE __RPC_FAR *pArray, DOUBLE_LINK_TYPE __RPC_FAR *pList)
void __RPC_USER | DOUBLE_LINK_TYPE_to_xmit (DOUBLE_LINK_TYPE __RPC_FAR *pList, DOUBLE_XMIT_TYPE __RPC_FAR *__RPC_FAR *ppArray)
DOUBLE_LINK_TYPE * | InsertNewNode (short sValue, DOUBLE_LINK_TYPE *pPrevious)
void | ListWalkProc (DOUBLE_LINK_TYPE *pList)
void __RPC_FAR *__RPC_USER | midl_user_allocate (size_t len)
void __RPC_USER | midl_user_free (void __RPC_FAR *ptr)

Function Documentation

void ArrayWalkProc ( DOUBLE_XMIT_TYPE * pArray )

Definition at line 44 of file Xmitu.c.

{
    int i;

    printf("Display contents of transmitted array:\n");
    for (i = 0; i < pArray->sSize; i++)
        printf("pArray->asNumber[%d] = %d\n", i, pArray->asNumber[i]);
}

void __RPC_USER DOUBLE_LINK_TYPE_free_inst ( DOUBLE_LINK_TYPE __RPC_FAR * pList )

Definition at line 162 of file Xmitu.c.

{
    while (pList->pNext != NULL)  // go to end of list
        pList = pList->pNext;

    pList = pList->pPrevious;
    while (pList != NULL) {  // back through list
        midl_user_free(pList->pNext);
        pList = pList->pPrevious;
    }
}

void __RPC_USER DOUBLE_LINK_TYPE_free_xmit ( DOUBLE_XMIT_TYPE __RPC_FAR * pArray )

Definition at line 177 of file Xmitu.c.

{
    midl_user_free(pArray);
}

void __RPC_USER DOUBLE_LINK_TYPE_from_xmit | ( | DOUBLE_XMIT_TYPE __RPC_FAR * | pArray,
 |  | DOUBLE_LINK_TYPE __RPC_FAR * | pList
 | ) |  |

Definition at line 133 of file Xmitu.c.

{
    DOUBLE_LINK_TYPE *pCurrent;
    int i;

    if (pArray->sSize <= 0) {  // error checking
        pList = NULL;
        return;
    }

    if (pList == NULL)
        pList = InsertNewNode(pArray->asNumber[0], NULL);
    else {
        DOUBLE_LINK_TYPE_free_inst(pList);  // free all other nodes
        pList->sNumber = pArray->asNumber[0];
        pList->pNext = NULL;
    }

    pCurrent = pList;
    for (i = 1; i < pArray->sSize; i++)  // write new values
        pCurrent = InsertNewNode(pArray->asNumber[i], pCurrent);
}

void __RPC_USER DOUBLE_LINK_TYPE_to_xmit | ( | DOUBLE_LINK_TYPE __RPC_FAR * | pList,
 |  | DOUBLE_XMIT_TYPE __RPC_FAR *__RPC_FAR * | ppArray
 | ) |  |

Definition at line 106 of file Xmitu.c.

{
    short cCount = 0;
    DOUBLE_LINK_TYPE * pHead = pList;  // save pointer to start
    DOUBLE_XMIT_TYPE * pArray;

    /* count the number of elements to allocate memory */
    for (; pList != NULL; pList = pList->pNext)
        cCount++;

    /* allocate the memory for the array */
    pArray = (DOUBLE_XMIT_TYPE *) midl_user_allocate
             (sizeof(DOUBLE_XMIT_TYPE) + (cCount * sizeof(short)));
    pArray->sSize = cCount;

    /* copy the linked list contents into the array */
    for (cCount = 0, pList = pHead; pList != NULL; pList = pList->pNext)
        pArray->asNumber[cCount++] = pList->sNumber;

    /* return the address of the pointer to the array */
    *ppArray = pArray;
}

DOUBLE_LINK_TYPE* InsertNewNode | ( | short | sValue,
 |  | DOUBLE_LINK_TYPE * | pPrevious
 | ) |  |

Definition at line 63 of file Xmitu.c.

{
    DOUBLE_LINK_TYPE * pNew;

    do {
        pNew = (DOUBLE_LINK_TYPE *)midl_user_allocate(sizeof(DOUBLE_LINK_TYPE));
    } while (pNew == pPrevious);

    pNew->pNext = NULL;      // initialize
    pNew->pPrevious = NULL;  // initialize
    pNew->sNumber = sValue;  // insert b between a and c

    pNew->pPrevious = pPrevious;             // prev(b) = a
    if (pPrevious == NULL)
        pNew->pNext = NULL;
    else {
        pNew->pNext = pPrevious->pNext;      // next(b) = c
        pPrevious->pNext = pNew;             // next(a) = b
        if (pNew->pNext != NULL)
            (pNew->pNext)->pPrevious = pNew; // prev(c) = b
    }

    return(pNew);
}

void ListWalkProc ( DOUBLE_LINK_TYPE * pList )

Definition at line 53 of file Xmitu.c.

{
    printf("Display contents of doubly linked list:\n");
    while (pList != NULL) {
        printf("pList %p = %d, Next = %p\n",
               pList, pList->sNumber, pList->pNext);
        pList = pList->pNext;
    }
}

void __RPC_FAR* __RPC_USER midl_user_allocate ( size_t len )

Definition at line 91 of file Xmitu.c.

{
    return(malloc(len));
}

void __RPC_USER midl_user_free ( void __RPC_FAR * ptr )

Definition at line 96 of file Xmitu.c.

{
    free(ptr);
}

Generated on Wed Nov 13 2024 16:53:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Data/Xmit/Xmitu.h File Reference

  • NetDS
  • RPC
  • Data
  • Xmit
Functions

Xmitu.h File Reference

Go to the source code of this file.

Functions

void | ArrayWalkProc (DOUBLE_XMIT_TYPE *pArray)
void __RPC_USER | DOUBLE_LINK_TYPE_free_inst (DOUBLE_LINK_TYPE __RPC_FAR *pList)
void __RPC_USER | DOUBLE_LINK_TYPE_free_xmit (DOUBLE_XMIT_TYPE __RPC_FAR *pArray)
void __RPC_USER | DOUBLE_LINK_TYPE_from_xmit (DOUBLE_XMIT_TYPE __RPC_FAR *pArray, DOUBLE_LINK_TYPE __RPC_FAR *pList)
void __RPC_USER | DOUBLE_LINK_TYPE_to_xmit (DOUBLE_LINK_TYPE __RPC_FAR *pList, DOUBLE_XMIT_TYPE __RPC_FAR *__RPC_FAR *ppArray)
DOUBLE_LINK_TYPE * | InsertNewNode (short sValue, DOUBLE_LINK_TYPE *pPrevious)
void | ListWalkProc (DOUBLE_LINK_TYPE *pList)
void __RPC_FAR *__RPC_USER | midl_user_allocate (size_t len)
void __RPC_USER | midl_user_free (void __RPC_FAR *ptr)

Function Documentation

void ArrayWalkProc ( DOUBLE_XMIT_TYPE * pArray )

Definition at line 44 of file Xmitu.c.

{
    int i;

    printf("Display contents of transmitted array:\n");
    for (i = 0; i < pArray->sSize; i++)
        printf("pArray->asNumber[%d] = %d\n", i, pArray->asNumber[i]);
}

void __RPC_USER DOUBLE_LINK_TYPE_free_inst ( DOUBLE_LINK_TYPE __RPC_FAR * pList )

Definition at line 162 of file Xmitu.c.

{
    while (pList->pNext != NULL)  // go to end of list
        pList = pList->pNext;

    pList = pList->pPrevious;
    while (pList != NULL) {  // back through list
        midl_user_free(pList->pNext);
        pList = pList->pPrevious;
    }
}

void __RPC_USER DOUBLE_LINK_TYPE_free_xmit ( DOUBLE_XMIT_TYPE __RPC_FAR * pArray )

Definition at line 177 of file Xmitu.c.

{
    midl_user_free(pArray);
}

void __RPC_USER DOUBLE_LINK_TYPE_from_xmit | ( | DOUBLE_XMIT_TYPE __RPC_FAR * | pArray,
 |  | DOUBLE_LINK_TYPE __RPC_FAR * | pList
 | ) |  |

Definition at line 133 of file Xmitu.c.

{
    DOUBLE_LINK_TYPE *pCurrent;
    int i;

    if (pArray->sSize <= 0) {  // error checking
        pList = NULL;
        return;
    }

    if (pList == NULL)
        pList = InsertNewNode(pArray->asNumber[0], NULL);
    else {
        DOUBLE_LINK_TYPE_free_inst(pList);  // free all other nodes
        pList->sNumber = pArray->asNumber[0];
        pList->pNext = NULL;
    }

    pCurrent = pList;
    for (i = 1; i < pArray->sSize; i++)  // write new values
        pCurrent = InsertNewNode(pArray->asNumber[i], pCurrent);
}

void __RPC_USER DOUBLE_LINK_TYPE_to_xmit | ( | DOUBLE_LINK_TYPE __RPC_FAR * | pList,
 |  | DOUBLE_XMIT_TYPE __RPC_FAR *__RPC_FAR * | ppArray
 | ) |  |

Definition at line 106 of file Xmitu.c.

{
    short cCount = 0;
    DOUBLE_LINK_TYPE * pHead = pList;  // save pointer to start
    DOUBLE_XMIT_TYPE * pArray;

    /* count the number of elements to allocate memory */
    for (; pList != NULL; pList = pList->pNext)
        cCount++;

    /* allocate the memory for the array */
    pArray = (DOUBLE_XMIT_TYPE *) midl_user_allocate
             (sizeof(DOUBLE_XMIT_TYPE) + (cCount * sizeof(short)));
    pArray->sSize = cCount;

    /* copy the linked list contents into the array */
    for (cCount = 0, pList = pHead; pList != NULL; pList = pList->pNext)
        pArray->asNumber[cCount++] = pList->sNumber;

    /* return the address of the pointer to the array */
    *ppArray = pArray;
}

DOUBLE_LINK_TYPE* InsertNewNode | ( | short | sValue,
 |  | DOUBLE_LINK_TYPE * | pPrevious
 | ) |  |

Definition at line 63 of file Xmitu.c.

{
    DOUBLE_LINK_TYPE * pNew;

    do {
        pNew = (DOUBLE_LINK_TYPE *)midl_user_allocate(sizeof(DOUBLE_LINK_TYPE));
    } while (pNew == pPrevious);

    pNew->pNext = NULL;      // initialize
    pNew->pPrevious = NULL;  // initialize
    pNew->sNumber = sValue;  // insert b between a and c

    pNew->pPrevious = pPrevious;             // prev(b) = a
    if (pPrevious == NULL)
        pNew->pNext = NULL;
    else {
        pNew->pNext = pPrevious->pNext;      // next(b) = c
        pPrevious->pNext = pNew;             // next(a) = b
        if (pNew->pNext != NULL)
            (pNew->pNext)->pPrevious = pNew; // prev(c) = b
    }

    return(pNew);
}

void ListWalkProc ( DOUBLE_LINK_TYPE * pList )

Definition at line 53 of file Xmitu.c.

{
    printf("Display contents of doubly linked list:\n");
    while (pList != NULL) {
        printf("pList %p = %d, Next = %p\n",
               pList, pList->sNumber, pList->pNext);
        pList = pList->pNext;
    }
}

void __RPC_FAR* __RPC_USER midl_user_allocate ( size_t len )

Definition at line 408 of file AsyncRPCc.c.

{
   return(malloc(len));
}

void __RPC_USER midl_user_free ( void __RPC_FAR * ptr )

Definition at line 414 of file AsyncRPCc.c.

{
   free(ptr);
}

Generated on Wed Nov 13 2024 16:53:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Dynept/Dynept.Idl File Reference

  • NetDS
  • RPC
  • Dynept

Dynept.Idl File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Dynept/Dyneptc.c File Reference

  • NetDS
  • RPC
  • Dynept
Functions

Dyneptc.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include "dynept.h"

Go to the source code of this file.

Functions

void __cdecl | main (int argc, char **argv)
void __RPC_FAR *__RPC_USER | midl_user_allocate (size_t len)
void __RPC_USER | midl_user_free (void __RPC_FAR *ptr)
void | Usage (char *pszProgramName)

Function Documentation

void __cdecl main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 40 of file Dyneptc.c.

{
    RPC_STATUS status;
    unsigned char * pszUuid             = NULL;
    unsigned char * pszProtocolSequence = "ncacn_np";
    unsigned char * pszNetworkAddress   = NULL;
    unsigned char * pszOptions          = NULL;
    unsigned char * pszStringBinding    = NULL;
    unsigned char * pszString           = "What a dynamic world";
    unsigned long ulCode;
    int i;

    /* allow the user to override settings with command line switches */
    for (i = 1; i < argc; i++) {
        if ((*argv[i] == '-') || (*argv[i] == '/')) {
            switch (tolower(*(argv[i]+1))) {
            case 'p':  // protocol sequence
                pszProtocolSequence = argv[++i];
                break;
            case 'n':  // network address
                pszNetworkAddress = argv[++i];
                break;
            case 'o':
                pszOptions = argv[++i];
                break;
            case 's':
                pszString = argv[++i];
                break;
            case 'h':
            case '?':
            default:
                Usage(argv[0]);
            }
        }
        else
            Usage(argv[0]);
    }

    /* Use a convenience function to concatenate the elements of */
    /* the string binding into the proper sequence.              */
    status = RpcStringBindingCompose(pszUuid,
                                     pszProtocolSequence,
                                     pszNetworkAddress,
                                     NULL,
                                     pszOptions,
                                     &pszStringBinding);
    printf("RpcStringBindingCompose returned 0x%x\n", status);
    printf("pszStringBinding = %s\n", pszStringBinding);
    if (status) {
        exit(status);
    }

    /* Set the binding handle that will be used to bind to the server. */
    status = RpcBindingFromStringBinding(pszStringBinding,
                                         &dynept_IfHandle);
    printf("RpcBindingFromStringBinding returned 0x%x\n", status);
    if (status) {
        exit(status);
    }

    printf("Calling the remote procedure 'HelloProc'\n");
    printf("Print the string '%s' on the server\n", pszString);

    RpcTryExcept {
        HelloProc(pszString);  // make call with user message
        printf("Calling the remote procedure 'Shutdown'\n");
        Shutdown();  // shut down the server side
    }
    RpcExcept(1) {
        ulCode = RpcExceptionCode();
        printf("Runtime reported exception 0x%lx = %ld\n", ulCode, ulCode);
    }
    RpcEndExcept

    /*  The calls to the remote procedures are complete. */
    /*  Free the string and the binding handle           */
    status = RpcStringFree(&pszStringBinding);  // remote calls done; unbind
    printf("RpcStringFree returned 0x%x\n", status);
    if (status) {
        exit(status);
    }

    status = RpcBindingFree(&dynept_IfHandle);  // remote calls done; unbind
    printf("RpcBindingFree returned 0x%x\n", status);
    if (status) {
        exit(status);
    }

    exit(0);

}  // end main()

void __RPC_FAR* __RPC_USER midl_user_allocate ( size_t len )

Definition at line 137 of file Dyneptc.c.

{
    return(malloc(len));
}

void __RPC_USER midl_user_free ( void __RPC_FAR * ptr )

Definition at line 142 of file Dyneptc.c.

{
    free(ptr);
}

void Usage ( char * pszProgramName )

Definition at line 30 of file Dyneptc.c.

{
    fprintf(stderr, "Usage:  %s\n", pszProgramName);
    fprintf(stderr, " -p protocol_sequence\n");
    fprintf(stderr, " -n network_address\n");
    fprintf(stderr, " -o options\n");
    fprintf(stderr, " -s string\n");
    exit(1);
}

Generated on Wed Nov 13 2024 16:53:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Dynept/Dyneptp.c File Reference

  • NetDS
  • RPC
  • Dynept
Functions

Dyneptp.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include "dynept.h"

Go to the source code of this file.

Functions

void | HelloProc (unsigned char *pszString)
void | Shutdown (void)

Function Documentation

void HelloProc ( unsigned char * pszString )

Definition at line 26 of file Dyneptp.c.

{
    printf("%s\n", pszString);
}

void Shutdown ( void )

Definition at line 31 of file Dyneptp.c.

{
    RPC_STATUS status;

    printf("Calling RpcMgmtStopServerListening\n");
    status = RpcMgmtStopServerListening(NULL);
    printf("RpcMgmtStopServerListening returned: 0x%x\n", status);
    if (status) {
       exit(status);
    }
}

Generated on Wed Nov 13 2024 16:53:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Dynept/Dynepts.c File Reference

  • NetDS
  • RPC
  • Dynept
Defines | Functions

Dynepts.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include "dynept.h"

Go to the source code of this file.

Defines

#define | PURPOSE "This Microsoft RPC Version 2.0 sample program demonstrates\n\the use of dynamic endpoints. For more information\n\about the attributes and the RPC API functions, see the\n\RPC programming guide and reference.\n\n"

Functions

void __cdecl | main (int argc, char *argv[])
void __RPC_FAR *__RPC_USER | midl_user_allocate (size_t len)
void __RPC_USER | midl_user_free (void __RPC_FAR *ptr)
void | Usage (char *pszProgramName)

Define Documentation

#define PURPOSE "This Microsoft RPC Version 2.0 sample program demonstrates\n\the use of dynamic endpoints. For more information\n\about the attributes and the RPC API functions, see the\n\RPC programming guide and reference.\n\n"

Definition at line 30 of file Dynepts.c.

Function Documentation

void __cdecl main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 48 of file Dynepts.c.

{
    RPC_STATUS status;
    RPC_BINDING_VECTOR * pBindingVector = NULL;
    unsigned char * pszProtocolSequence = "ncacn_np";
    unsigned char * pszSecurity         = NULL;
    unsigned int    cMinCalls           = 1;
    unsigned int    cMaxCalls           = 20;
    unsigned int    fDontWait           = FALSE;
    unsigned int    fRegistered         = 0;
    unsigned int    fEndpoint           = 0;
    int i;

    /* allow the user to override settings with command line switches */
    for (i = 1; i < argc; i++) {
        if ((*argv[i] == '-') || (*argv[i] == '/')) {
            switch (tolower(*(argv[i]+1))) {
            case 'p':  // protocol sequence
                pszProtocolSequence = argv[++i];
                break;
            case 'm':
                cMaxCalls = (unsigned int) atoi(argv[++i]);
                break;
            case 'n':
                cMinCalls = (unsigned int) atoi(argv[++i]);
                break;
            case 'f':
                fDontWait = (unsigned int) atoi(argv[++i]);
                break;
            case 'h':
            case '?':
            default:
                Usage(argv[0]);
            }
        }
        else
            Usage(argv[0]);
    }

    status = RpcServerUseProtseq(pszProtocolSequence,
                                 cMaxCalls,
                                 pszSecurity);  // Security descriptor
    printf("RpcServerUseProtseq returned 0x%x\n", status);
    if (status) {
        goto cleanup;
    }

    status = RpcServerRegisterIf(dynept_ServerIfHandle,  // interface to register
                                 NULL,   // MgrTypeUuid
                                 NULL);  // MgrEpv; null means use default
    printf("RpcServerRegisterIf returned 0x%x\n", status);
    if (status) {
        goto cleanup;
    }
    else
        fRegistered = 1;

    status = RpcServerInqBindings(&pBindingVector);
    printf("RpcServerInqBindings returned 0x%x\n", status);
    if (status) {
        goto cleanup;
    }

    status = RpcEpRegister( dynept_ServerIfHandle,
                            pBindingVector,
                            NULL,
                            "" );
    printf("RpcEpRegister returned: 0x%x\n", status);
    if (status) {
        goto cleanup;
    }
    else
        fEndpoint = 1;

    printf("Calling RpcServerListen\n");
    status = RpcServerListen(cMinCalls,
                             cMaxCalls,
                             fDontWait);
    printf("RpcServerListen returned: 0x%x\n", status);
    if (status) {
        goto cleanup;
    }

    if (fDontWait) {
        printf("Calling RpcMgmtWaitServerListen\n");
        status = RpcMgmtWaitServerListen();  // wait operation
        printf("RpcMgmtWaitServerListen returned: 0x%x\n", status);
    }

  cleanup:

    if ( fEndpoint )
    {
        status = RpcEpUnregister(dynept_ServerIfHandle,
                                 pBindingVector,
                                 NULL);
        printf( "RpcEpUnregister returned 0x%x\n", status);
    }

    if ( pBindingVector )
    {
        status = RpcBindingVectorFree(&pBindingVector);
        printf( "RpcBindingVectorFree returned 0x%x\n", status);
    }

    if ( fRegistered )
    {
        printf("Calling RpcServerUnregisterIf\n");
        status = RpcServerUnregisterIf(NULL, NULL, FALSE);
        printf("RpcServerUnregisterIf returned 0x%x\n", status);
    }

    exit (status);

}  // end main()

void __RPC_FAR* __RPC_USER midl_user_allocate ( size_t len )

Definition at line 169 of file Dynepts.c.

{
    return(malloc(len));
}

void __RPC_USER midl_user_free ( void __RPC_FAR * ptr )

Definition at line 174 of file Dynepts.c.

{
    free(ptr);
}

void Usage ( char * pszProgramName )

Definition at line 36 of file Dynepts.c.

{
    fprintf(stderr, "%s", PURPOSE);
    fprintf(stderr, "Usage:  %s\n", pszProgramName);
    fprintf(stderr, " -p protocol_sequence\n");
    fprintf(stderr, " -m maxcalls\n");
    fprintf(stderr, " -n mincalls\n");
    fprintf(stderr, " -f flag_wait_op\n");
    exit(1);
}

Generated on Wed Nov 13 2024 16:53:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/DynOut/DynOut.Idl File Reference

  • NetDS
  • RPC
  • DynOut

DynOut.Idl File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/DynOut/DynOutc.c File Reference

  • NetDS
  • RPC
  • DynOut
Functions

DynOutc.c File Reference

#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <assert.h>
#include <malloc.h>
#include "dynout.h"

Go to the source code of this file.

Functions

void | main (int argc, char **argv)
void __RPC_FAR *__RPC_API | midl_user_allocate (size_t len)
void __RPC_API | midl_user_free (void __RPC_FAR *ptr)

Function Documentation

void main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 23 of file DynOutc.c.

{
  unsigned char *pr = NULL;
  long lSize;
  int i;
  int bOK;

  RpcTryExcept
  {
    for(;;)
    {
      pr = NULL;  // This is *REALLY* important!

      GrabChunk(&lSize,&pr);

      // quick sanity check
      for (i=0, bOK=TRUE; (i < lSize) && bOK; i++)
      {
        if (*pr != pr[i])
        {
          puts("***Error***");
          bOK=FALSE;
          break;
        }
      }

      printf("Returned %d bytes of '%c'\n",lSize,*pr);

      midl_user_free(pr);
    }
  }
  RpcExcept(1)
  {
    printf("Err: %u\n",RpcExceptionCode());
  }
  RpcEndExcept
}

void __RPC_FAR* __RPC_API midl_user_allocate ( size_t len )

Definition at line 61 of file DynOutc.c.

{
    return malloc(len);
}

void __RPC_API midl_user_free ( void __RPC_FAR * ptr )

Definition at line 66 of file DynOutc.c.

{

    free(ptr);
}

Generated on Wed Nov 13 2024 16:53:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/DynOut/DynOutp.c File Reference

  • NetDS
  • RPC
  • DynOut
Functions

DynOutp.c File Reference

#include <assert.h>
#include "stdio.h"
#include "string.h"
#include "dynout.h"

Go to the source code of this file.

Functions

short GrabChunk (long *lSize, unsigned char **ppData)

Function Documentation

short GrabChunk | ( | long * | lSize,
 |  | unsigned char ** | ppData
 | ) |  |

Definition at line 22 of file DynOutp.c.

{
  int cbChunk = rand() % 10000; // how much memory to grab
  int cChar = 33 + rand()%30;   // what to fill it with

  printf("GrabChunk() allocating %d bytes of '%c'\n",cbChunk,cChar);

  *lSize = (long)cbChunk;
  *ppData = midl_user_allocate(cbChunk);
  memset(*ppData,cChar,cbChunk);

  return 0;
}

Generated on Wed Nov 13 2024 16:53:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/DynOut/DynOuts.c File Reference

  • NetDS
  • RPC
  • DynOut
Defines | Functions

DynOuts.c File Reference

#include <stdio.h>
#include <assert.h>
#include <malloc.h>
#include "dynout.h"

Go to the source code of this file.

Defines

#define | CHECK_STATUS(x) {if (x!=RPC_S_OK) { printf("RPC Err: %d\nfile = %s, line=%d.",x,__FILE__,__LINE__); exit(x);}}
#define | TRACE(s) puts(s)

Functions

void | main (int argc, char **argv)
void __RPC_FAR *__RPC_API | midl_user_allocate (size_t len)
void __RPC_API | midl_user_free (void __RPC_FAR *ptr)

Define Documentation

#define CHECK_STATUS ( x ) {if (x!=RPC_S_OK) { printf("RPC Err: %d\nfile = %s, line=%d.",x,__FILE__,__LINE__); exit(x);}}

Definition at line 29 of file DynOuts.c.

#define TRACE ( s ) puts(s)

Definition at line 30 of file DynOuts.c.

Function Documentation

void main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 33 of file DynOuts.c.

{
  RPC_STATUS      rpcStatus;
  RPC_BINDING_VECTOR  *vectBinding;
  unsigned char     *szEntryName;

  TRACE("RpcServerRegisterIf");
  rpcStatus=RpcServerRegisterIf(MemStuff_v1_0_s_ifspec,0,0);
  CHECK_STATUS(rpcStatus);

  TRACE("RpcServerUseAllProtseqs");
  rpcStatus=RpcServerUseAllProtseqs(RPC_C_PROTSEQ_MAX_REQS_DEFAULT,NULL);
  CHECK_STATUS(rpcStatus);

  TRACE("RpcServerInqBindings");
  rpcStatus=RpcServerInqBindings(&vectBinding);
  CHECK_STATUS(rpcStatus);

  TRACE("RpcNsBindingExport");
  szEntryName="/.:/MyServer";
  rpcStatus=RpcNsBindingExport(RPC_C_NS_SYNTAX_DEFAULT,szEntryName,MemStuff_v1_0_s_ifspec,vectBinding,NULL);
  CHECK_STATUS(rpcStatus);

  TRACE("RpcEpRegister");
  rpcStatus=RpcEpRegister(MemStuff_v1_0_s_ifspec,
        vectBinding,
        NULL,NULL);
  CHECK_STATUS(rpcStatus);

  TRACE("RpcBindingVectorFree");
  rpcStatus=RpcBindingVectorFree(&vectBinding);
  CHECK_STATUS(rpcStatus);

  puts("\n\n");
  puts("(C) Microsoft New Zealand Limited. Written by Michael Howard, " __DATE__);
  puts("\nListening....");

  rpcStatus=RpcServerListen(1,RPC_C_LISTEN_MAX_CALLS_DEFAULT,FALSE);
  CHECK_STATUS(rpcStatus);
}

void __RPC_FAR* __RPC_API midl_user_allocate ( size_t len )

Definition at line 74 of file DynOuts.c.

{
    return malloc(len);
}

void __RPC_API midl_user_free ( void __RPC_FAR * ptr )

Definition at line 79 of file DynOuts.c.

{
    free(ptr);
}

Generated on Wed Nov 13 2024 16:53:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/FileRepAsyncPipe/common.cpp File Reference

  • NetDS
  • RPC
  • FileRep
  • FileRepAsyncPipe
Functions | Variables

common.cpp File Reference

#include "common.h"
#include <tchar.h>
#include <stdio.h>
#include <stdlib.h>

Go to the source code of this file.

Functions

VOID * | AutoHeapAlloc (size_t dwBytes)
VOID | AutoHeapFree (VOID *lpMem)
VOID | GetEEInfoText (TCHAR *Msg, UINT BuffSize, UINT *MsgSize)
VOID | PrintProcFailureEEInfo (LPTSTR ProcName, DWORD ErrCode)

Variables

HANDLE | hProcessHeap = NULL

Function Documentation

VOID* AutoHeapAlloc ( size_t dwBytes )

Definition at line 108 of file common.cpp.

                                     {
    if (hProcessHeap == NULL) {
        hProcessHeap = GetProcessHeap();
    }
    return HeapAlloc(hProcessHeap, 0, dwBytes);
}

VOID AutoHeapFree ( VOID * lpMem )

Definition at line 115 of file common.cpp.

                                {
    DWORD status;
    ASSERT(hProcessHeap != NULL);
    status = HeapFree(hProcessHeap, 0, lpMem);
    ASSERT(status);
}

VOID GetEEInfoText | ( | TCHAR * | Msg,
 |  | UINT | BuffSize,
 |  | UINT * | MsgSize
 | ) |  |

Definition at line 21 of file common.cpp.

                                                             {
    RPC_STATUS status;
    RPC_ERROR_ENUM_HANDLE EnumHandle;

  *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("EEInfo:\n"));

    status = RpcErrorStartEnumeration(&EnumHandle);

    if (status == RPC_S_ENTRY_NOT_FOUND) {
        *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("no EEInfo found\n"));
    }
    else if (status != RPC_S_OK) {
        *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("could not get EEInfo\n"));
    }
    else {
        RPC_EXTENDED_ERROR_INFO ErrorInfo;

        while (status == RPC_S_OK) {
            ErrorInfo.Version = RPC_EEINFO_VERSION;
            ErrorInfo.Flags = 0;
            ErrorInfo.NumberOfParameters = 4;

            status = RpcErrorGetNextRecord(&EnumHandle, FALSE, &ErrorInfo);
            if (status == RPC_S_ENTRY_NOT_FOUND) {
                break;
            }
            else if (status != RPC_S_OK) {
                *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("enumeration broke with status %d\n"), status);
                break;
            }
            else {
                INT i;

                *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("GeneratingComponent: %d\n"), ErrorInfo.GeneratingComponent);
                *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("Status: %d\n"), ErrorInfo.Status);
                *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("Detection Location: %d\n"), ErrorInfo.DetectionLocation);
                *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("Flags: %d\n"), ErrorInfo.Flags);
                *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("NumberOfParameters: %d\n"), ErrorInfo.NumberOfParameters);

                for (i = 0; i < ErrorInfo.NumberOfParameters; i++) {
                    switch (ErrorInfo.Parameters[i].ParameterType) {
                    case eeptAnsiString:
                        *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("AnsiString: %s\n"), ErrorInfo.Parameters[i].u.AnsiString);
                        break;

                    case eeptUnicodeString:
                        *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("UnicodeString: %S\n"), ErrorInfo.Parameters[i].u.UnicodeString);
                        break;

                    case eeptLongVal:
                        *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("LongVal: %d\n"), ErrorInfo.Parameters[i].u.LVal);
                        break;

                    case eeptShortVal:
                        *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("ShortVal: %d\n"), ErrorInfo.Parameters[i].u.SVal);
                        break;

                    case eeptPointerVal:
                        *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("PointerVal: %d\n"), ErrorInfo.Parameters[i].u.PVal);
                        break;

                    case eeptNone:
                        *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("Invalid type of parameter %d\n"), ErrorInfo.Parameters[i].ParameterType);
                        break;

                    default:
                        *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("Invalid type of parameter %d\n"), ErrorInfo.Parameters[i].ParameterType);
                    }
                }
            }
        }
    }
}

VOID PrintProcFailureEEInfo | ( | LPTSTR | ProcName,
 |  | DWORD | ErrCode
 | ) |  |

Definition at line 95 of file common.cpp.

                                                            {
    TCHAR Msg[MSG_SIZE];
    UINT MsgSize = 0;

    MsgSize += _stprintf(&Msg[MsgSize], TEXT("%s failed with code %d\n"), ProcName, ErrCode);
  GetEEInfoText(Msg, MSG_SIZE, &MsgSize);

  Msg[MsgSize] = 0;

    _tprintf(TEXT("%s"), Msg);
}

Variable Documentation

HANDLE hProcessHeap = NULL

Definition at line 19 of file common.cpp.

Generated on Wed Nov 13 2024 16:53:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/FileRepAsyncPipe/common.h File Reference

  • NetDS
  • RPC
  • FileRep
  • FileRepAsyncPipe
Defines | Typedefs | Functions

common.h File Reference

#include <tchar.h>
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>

Go to the source code of this file.

Defines

#define | ASSERT(cond) {}
#define | CriticalSectionOwned(CriticalSection) (ULongToPtr(GetCurrentThreadId()) == (CriticalSection)->OwningThread)
#define | EXIT_IF_FAIL(x, string)
#define | MSG_SIZE (256)
#define | RPC_EEINFO_EXIT_IF_FAIL(x, string)

Typedefs

typedef RPC_STATUS(__stdcall * | WINAPI_MY_PIPE_PULL )(CHAR *state, CHAR *buf, unsigned long num, unsigned long *ecount)
typedef RPC_STATUS(__stdcall * | WINAPI_MY_PIPE_PUSH )(CHAR *state, CHAR *buf, unsigned long ecount)

Functions

VOID * | AutoHeapAlloc (size_t dwBytes)
VOID | AutoHeapFree (VOID *lpMem)
VOID | GetEEInfoText (TCHAR *Msg, UINT BuffSize, UINT *MsgSize)
VOID | PrintProcFailureEEInfo (LPTSTR ProcName, DWORD ErrCode)

Define Documentation

#define ASSERT ( cond ) {}

Definition at line 24 of file common.h.

#define CriticalSectionOwned ( CriticalSection ) (ULongToPtr(GetCurrentThreadId()) == (CriticalSection)->OwningThread)

Definition at line 61 of file common.h.

#define EXIT_IF_FAIL | ( | x,
 |  | string
 | ) |
Value:
{ \
        ((x) != RPC_S_OK) ? _tprintf(TEXT("%s failed with error %d\n"), \
        TEXT(string), (x)), exit(EXIT_FAILURE) : 0;}

Definition at line 29 of file common.h.

#define MSG_SIZE (256)

Definition at line 51 of file common.h.

#define RPC_EEINFO_EXIT_IF_FAIL | ( | x,
 |  | string
 | ) |
Value:
{ \
        ((x) != RPC_S_OK) ? PrintProcFailureEEInfo(string, x), \
        exit(EXIT_FAILURE) : 0;}

Definition at line 33 of file common.h.

Typedef Documentation

typedef RPC_STATUS(__stdcall * WINAPI_MY_PIPE_PULL)(CHAR *state, CHAR *buf, unsigned long num, unsigned long *ecount)

Definition at line 45 of file common.h.

typedef RPC_STATUS(__stdcall * WINAPI_MY_PIPE_PUSH)(CHAR *state, CHAR *buf, unsigned long ecount)

Definition at line 40 of file common.h.

Function Documentation

VOID* AutoHeapAlloc ( size_t dwBytes )

Definition at line 108 of file common.cpp.

                                     {
    if (hProcessHeap == NULL) {
        hProcessHeap = GetProcessHeap();
    }
    return HeapAlloc(hProcessHeap, 0, dwBytes);
}

VOID AutoHeapFree ( VOID * lpMem )

Definition at line 115 of file common.cpp.

                                {
    DWORD status;
    ASSERT(hProcessHeap != NULL);
    status = HeapFree(hProcessHeap, 0, lpMem);
    ASSERT(status);
}

VOID GetEEInfoText | ( | TCHAR * | Msg,
 |  | UINT | BuffSize,
 |  | UINT * | MsgSize
 | ) |  |

Definition at line 21 of file common.cpp.

                                                             {
    RPC_STATUS status;
    RPC_ERROR_ENUM_HANDLE EnumHandle;

  *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("EEInfo:\n"));

    status = RpcErrorStartEnumeration(&EnumHandle);

    if (status == RPC_S_ENTRY_NOT_FOUND) {
        *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("no EEInfo found\n"));
    }
    else if (status != RPC_S_OK) {
        *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("could not get EEInfo\n"));
    }
    else {
        RPC_EXTENDED_ERROR_INFO ErrorInfo;

        while (status == RPC_S_OK) {
            ErrorInfo.Version = RPC_EEINFO_VERSION;
            ErrorInfo.Flags = 0;
            ErrorInfo.NumberOfParameters = 4;

            status = RpcErrorGetNextRecord(&EnumHandle, FALSE, &ErrorInfo);
            if (status == RPC_S_ENTRY_NOT_FOUND) {
                break;
            }
            else if (status != RPC_S_OK) {
                *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("enumeration broke with status %d\n"), status);
                break;
            }
            else {
                INT i;

                *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("GeneratingComponent: %d\n"), ErrorInfo.GeneratingComponent);
                *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("Status: %d\n"), ErrorInfo.Status);
                *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("Detection Location: %d\n"), ErrorInfo.DetectionLocation);
                *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("Flags: %d\n"), ErrorInfo.Flags);
                *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("NumberOfParameters: %d\n"), ErrorInfo.NumberOfParameters);

                for (i = 0; i < ErrorInfo.NumberOfParameters; i++) {
                    switch (ErrorInfo.Parameters[i].ParameterType) {
                    case eeptAnsiString:
                        *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("AnsiString: %s\n"), ErrorInfo.Parameters[i].u.AnsiString);
                        break;

                    case eeptUnicodeString:
                        *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("UnicodeString: %S\n"), ErrorInfo.Parameters[i].u.UnicodeString);
                        break;

                    case eeptLongVal:
                        *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("LongVal: %d\n"), ErrorInfo.Parameters[i].u.LVal);
                        break;

                    case eeptShortVal:
                        *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("ShortVal: %d\n"), ErrorInfo.Parameters[i].u.SVal);
                        break;

                    case eeptPointerVal:
                        *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("PointerVal: %d\n"), ErrorInfo.Parameters[i].u.PVal);
                        break;

                    case eeptNone:
                        *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("Invalid type of parameter %d\n"), ErrorInfo.Parameters[i].ParameterType);
                        break;

                    default:
                        *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("Invalid type of parameter %d\n"), ErrorInfo.Parameters[i].ParameterType);
                    }
                }
            }
        }
    }
}

VOID PrintProcFailureEEInfo | ( | LPTSTR | ProcName,
 |  | DWORD | ErrCode
 | ) |  |

Definition at line 95 of file common.cpp.

                                                            {
    TCHAR Msg[MSG_SIZE];
    UINT MsgSize = 0;

    MsgSize += _stprintf(&Msg[MsgSize], TEXT("%s failed with code %d\n"), ProcName, ErrCode);
  GetEEInfoText(Msg, MSG_SIZE, &MsgSize);

  Msg[MsgSize] = 0;

    _tprintf(TEXT("%s"), Msg);
}

Generated on Wed Nov 13 2024 16:53:11 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/FileRepAsyncPipe/DbgMsg.cpp File Reference

  • NetDS
  • RPC
  • FileRep
  • FileRepAsyncPipe
Functions | Variables

DbgMsg.cpp File Reference

#include "common.h"
#include "DbgMsg.h"
#include "Service.h"

Go to the source code of this file.

Functions

VOID | DbgMsgCloseLog (VOID)
VOID | DbgMsgOpenLog (LPTSTR LogFileName)
VOID | DbgMsgRecord (LPTSTR msg)

Variables

CRITICAL_SECTION | DbgMsgCriticalSection
HANDLE | hDbgMsgLog = NULL
UINT | nDbgMsgLogSize = 0

Function Documentation

VOID DbgMsgCloseLog ( VOID )

Definition at line 69 of file DbgMsg.cpp.

                          {
    DWORD status;

    // Delete and the critsec.
    DeleteCriticalSection(&DbgMsgCriticalSection);

    // Close the debug log.
    if (hDbgMsgLog != NULL && hDbgMsgLog != INVALID_HANDLE_VALUE) {
        status = CloseHandle(hDbgMsgLog);
        ASSERT(status);
    }
}

VOID DbgMsgOpenLog ( LPTSTR LogFileName )

Definition at line 25 of file DbgMsg.cpp.

                                       {

    // Init the critsec.
    if (InitializeCriticalSectionAndSpinCount(&DbgMsgCriticalSection, 0) == 0) {
        AddToMessageLogProcFailure(TEXT("DbgMsgOpenLog: InitializeCriticalSectionAndSpinCount"), GetLastError());
        return;
    }

    // Open the profiling log.
    if ((hDbgMsgLog = CreateFile(LogFileName,
                               GENERIC_WRITE,
                               0,
                               NULL,
                               CREATE_ALWAYS,
                               FILE_ATTRIBUTE_NORMAL,
                               NULL)) == INVALID_HANDLE_VALUE) {
        AddToMessageLogProcFailure(TEXT("DbgMsgOpenLog: CreateFile"), GetLastError());
    }
}

VOID DbgMsgRecord ( LPTSTR msg )

Definition at line 45 of file DbgMsg.cpp.

                              {
    ULONG cbWritten;

    EnterCriticalSection(&DbgMsgCriticalSection);

    // Write the entry only if there is enough space left in
    // the log.
    if (nDbgMsgLogSize < DEBUG_LOG_MAX_SIZE + _tcslen(msg)) {

        // Append the entry to the log.
        nDbgMsgLogSize += _tcslen(msg);
        if(!WriteFile(hDbgMsgLog,
                      (LPVOID)msg,
                      _tcslen(msg)*sizeof(TCHAR),
                      &cbWritten,
                      NULL)) {
            AddToMessageLogProcFailure(TEXT("DbgMsgRecord: WriteFile"), GetLastError());
        }
    }

    LeaveCriticalSection(&DbgMsgCriticalSection);
    return;
}

Variable Documentation

CRITICAL_SECTION DbgMsgCriticalSection

Definition at line 23 of file DbgMsg.cpp.

HANDLE hDbgMsgLog = NULL

Definition at line 18 of file DbgMsg.cpp.

UINT nDbgMsgLogSize = 0

Definition at line 21 of file DbgMsg.cpp.

Generated on Wed Nov 13 2024 16:53:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/FileRepAsyncPipe/DbgMsg.h File Reference

  • NetDS
  • RPC
  • FileRep
  • FileRepAsyncPipe
Defines | Functions | Variables

DbgMsg.h File Reference

Go to the source code of this file.

Defines

#define | DEBUG_LOG_MAX_SIZE (10*1024*1024)

Functions

VOID | DbgMsgCloseLog (VOID)
VOID | DbgMsgOpenLog (LPTSTR LogFileName)
VOID | DbgMsgRecord (LPTSTR msg)

Variables

CRITICAL_SECTION | DbgMsgCriticalSection

Define Documentation

#define DEBUG_LOG_MAX_SIZE (10*1024*1024)

Definition at line 21 of file DbgMsg.h.

Function Documentation

VOID DbgMsgCloseLog ( VOID )

Definition at line 69 of file DbgMsg.cpp.

                          {
    DWORD status;

    // Delete and the critsec.
    DeleteCriticalSection(&DbgMsgCriticalSection);

    // Close the debug log.
    if (hDbgMsgLog != NULL && hDbgMsgLog != INVALID_HANDLE_VALUE) {
        status = CloseHandle(hDbgMsgLog);
        ASSERT(status);
    }
}

VOID DbgMsgOpenLog ( LPTSTR LogFileName )

Definition at line 25 of file DbgMsg.cpp.

                                       {

    // Init the critsec.
    if (InitializeCriticalSectionAndSpinCount(&DbgMsgCriticalSection, 0) == 0) {
        AddToMessageLogProcFailure(TEXT("DbgMsgOpenLog: InitializeCriticalSectionAndSpinCount"), GetLastError());
        return;
    }

    // Open the profiling log.
    if ((hDbgMsgLog = CreateFile(LogFileName,
                               GENERIC_WRITE,
                               0,
                               NULL,
                               CREATE_ALWAYS,
                               FILE_ATTRIBUTE_NORMAL,
                               NULL)) == INVALID_HANDLE_VALUE) {
        AddToMessageLogProcFailure(TEXT("DbgMsgOpenLog: CreateFile"), GetLastError());
    }
}

VOID DbgMsgRecord ( LPTSTR msg )

Definition at line 45 of file DbgMsg.cpp.

                              {
    ULONG cbWritten;

    EnterCriticalSection(&DbgMsgCriticalSection);

    // Write the entry only if there is enough space left in
    // the log.
    if (nDbgMsgLogSize < DEBUG_LOG_MAX_SIZE + _tcslen(msg)) {

        // Append the entry to the log.
        nDbgMsgLogSize += _tcslen(msg);
        if(!WriteFile(hDbgMsgLog,
                      (LPVOID)msg,
                      _tcslen(msg)*sizeof(TCHAR),
                      &cbWritten,
                      NULL)) {
            AddToMessageLogProcFailure(TEXT("DbgMsgRecord: WriteFile"), GetLastError());
        }
    }

    LeaveCriticalSection(&DbgMsgCriticalSection);
    return;
}

Variable Documentation

CRITICAL_SECTION DbgMsgCriticalSection

Definition at line 23 of file DbgMsg.cpp.

Generated on Wed Nov 13 2024 16:53:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/FileRepAsyncPipe/FileRep.cpp File Reference

  • NetDS
  • RPC
  • FileRep
  • FileRepAsyncPipe
Functions

FileRep.cpp File Reference

#include "common.h"
#include <process.h>
#include <rpc.h>
#include <Ntdsapi.h>
#include "Service.h"
#include "FileRepClient.h"

Go to the source code of this file.

Functions

INT _cdecl | main (int argc, char **argv)
VOID __RPC_FAR *__RPC_API | midl_user_allocate (size_t len)
VOID __RPC_API | midl_user_free (VOID __RPC_FAR *ptr)
void | PrintUsage (TCHAR *ProgName)

Function Documentation

INT _cdecl main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 77 of file FileRep.cpp.

                                       {

    INT i;
    RPC_STATUS rpcstatus;

    // Controlls printing out of messages.
    BOOL bDebug = FALSE;

    // Explicit binding handle to the client system service.
    handle_t hFileRepClient = NULL;

    // These are the default values for extablishing connections.
    // Default connection is to a local server over local rpc.
    LPTSTR pszProtocolSequence = TEXT("ncalrpc");
    LPTSTR pszNetworkAddress = NULL;

    // An empty endpoint string is used, since we are going to
    // connect to the endpoint dynamically generated by the
    // RPC run-time library.  Server calls RpcServerUseProtseq to
    // obtain a binding hadnle and a dynamic endpoint.
    LPTSTR pszEndpoint = TEXT("");

    LPTSTR pszUuid = NULL;
    LPTSTR pszOptions = NULL;
    LPTSTR pszStringBinding = NULL;

    LPTSTR ServerName = NULL;
    LPTSTR RemoteFileName = NULL;
    LPTSTR LocalFileName = NULL;

    INT nNumArgs;

#ifndef NO_SEC
    // Quality of service structure to ensure authentication.
    RPC_SECURITY_QOS SecurityQOS;

    // Used in generating the principal name for the local system service.
    TCHAR Name[128];
    DWORD cbName = sizeof(Name);

    TCHAR DomainName[128];
    DWORD cbDomainName = sizeof(DomainName);
    SID_NAME_USE Use;

    SID_IDENTIFIER_AUTHORITY SIDAuth = SECURITY_NT_AUTHORITY;
    BYTE sidBuffer[100];
    PSID pSID = (PSID)&sidBuffer;
#endif

    // Get a common handle on the command line arguments for both
    // UNICODE and ASCII
#ifdef _UNICODE
    LPWSTR *szArgList = CommandLineToArgvW(GetCommandLine(), &nNumArgs);
    if (NULL == szArgList) {
        _tprintf(TEXT("FileRep main: CommandLineToArgW failed"));
        exit(EXIT_FAILURE);
    }
#else
    char **szArgList = argv;
    nNumArgs = argc;
#endif

    // Check that the correct number of arguments is given.
    if(nNumArgs<4){
        PrintUsage(szArgList[0]);
        exit(EXIT_FAILURE);
    }

    // Extract the required arguments.
    ServerName = szArgList[1];
    RemoteFileName = szArgList[2];
    LocalFileName = szArgList[3];

    // Allow the user to override settings with command line switches.
    for (i = 4; i < nNumArgs; i++) {
        // Well-formed argument switches start with '/' or '-' and are
        // two characters long.
        if (((*szArgList[i] == TEXT('-')) || (*szArgList[i] == TEXT('/'))) && _tcsclen(szArgList[i]) == 2) {

            switch (_totlower(*(szArgList[i]+1))) {

                case TEXT('p'):

                    // Override protocol sequence.

                    // Check that the next argument exists and is not a
                    // switch.
                    if(i+1 < nNumArgs && *szArgList[i+1] != TEXT('-') && *szArgList[i+1] != TEXT('/')) {
                        pszProtocolSequence = szArgList[++i];
                    }
                    // Otherwise we have an empty protocol sequence.
                    else {
                        // We do not allow an empty protocol sequence.
                        _tprintf(TEXT("Protocol sequence can't be \"\".\n"));
                        exit(EXIT_FAILURE);
                    }

                    break;

                case TEXT('n'):

                    // Override the network address.
                    if(i+1 < nNumArgs && *szArgList[i+1] != TEXT('-') && *szArgList[i+1] != TEXT('/')) {
                        pszNetworkAddress = szArgList[++i];
                    }
                    else {
                        pszNetworkAddress = TEXT("");
                    }

                    break;

                case TEXT('e'):

                    // Override the endpoint.
                    if(i+1 < nNumArgs && *szArgList[i+1] != TEXT('-') && *szArgList[i+1] != TEXT('/')) {
                        pszEndpoint = szArgList[++i];
                    }
                    else {
                        pszEndpoint = TEXT("");
                    }

                    break;

                case TEXT('d'):
                    // Turn on debugging.
                    bDebug = TRUE;
                    break;

                case TEXT('h'):
                case TEXT('?'):
                default:
                    PrintUsage(szArgList[0]);
                    exit(EXIT_SUCCESS);
            }
        }
        else {
            PrintUsage(szArgList[0]);
            exit(EXIT_FAILURE);
        }
    }

    // Concatenate the elements of
    // the string binding into the proper sequence.
    rpcstatus = RpcStringBindingCompose(pszUuid,
                                        pszProtocolSequence,
                                        pszNetworkAddress,
                                        pszEndpoint,
                                        pszOptions,
                                        &pszStringBinding);
    if(bDebug){
        _tprintf(TEXT("RpcStringBindingCompose returned 0x%x\n"), rpcstatus);
        _tprintf(TEXT("pszStringBinding = %s\n"), pszStringBinding);
    }
    RPC_EEINFO_EXIT_IF_FAIL(rpcstatus, TEXT("RpcStringBindingCompose"));

    // Set the binding handle that will be used to bind to the server.
    rpcstatus = RpcBindingFromStringBinding(pszStringBinding, &hFileRepClient);
    if(bDebug) _tprintf(TEXT("RpcBindingFromStringBinding returned 0x%x\n"), rpcstatus);
    RPC_EEINFO_EXIT_IF_FAIL(rpcstatus, TEXT("RpcBindingFromStringBinding"));

    // Free the binding string.
    rpcstatus = RpcStringFree(&pszStringBinding);
    ASSERT(rpcstatus == RPC_S_OK);

#ifndef NO_SEC
    // Specify quality of service parameters.
    SecurityQOS.Version = RPC_C_SECURITY_QOS_VERSION;
    SecurityQOS.Capabilities = RPC_C_QOS_CAPABILITIES_MUTUAL_AUTH;
    // Dynamic identity tracking is more efficient for a single LRPC call.
    SecurityQOS.IdentityTracking = RPC_C_QOS_IDENTITY_DYNAMIC;
    // The client system service needs to impersonate the security context
    // of the client utility on the remote systems where it may replicate
    // files from.
    // We need to impersonate with level delegate, since the server system
    // service will need to impersonate the user further.
    SecurityQOS.ImpersonationType = RPC_C_IMP_LEVEL_DELEGATE;

    // Generate the principal name for the local system service.
    // We can't just use the a string constant, because then
    // we rely on a particular English-language representation of the
    // principal.

    if (AllocateAndInitializeSid(&SIDAuth, 1,
                                 SECURITY_NETWORK_SERVICE_RID,
                                 0, 0, 0, 0, 0, 0, 0,
                                 &pSID) == 0) {
        printf("AllocateAndInitializeSid failed\n");
        exit(EXIT_FAILURE);
    }

    if (LookupAccountSid(NULL, // name of local or remote computer
                         pSID, // security identifier
                         Name, // account name buffer
                         &cbName, // size of account name buffer
                         DomainName, // domain name
                         &cbDomainName, // size of domain name buffer
                         &Use) == 0) { // SID type
        printf("LookupAccountSid failed\n");
        exit(EXIT_FAILURE);
    }

    if(bDebug) _tprintf(TEXT("Server \"magic name\" is %s\n"), Name);

    // Set authentication and authorisation information for
    // the binding handle.
    // By speciying NULL for the 5th parameter we use the security login
    // context for the current address space.
    // The security level is "PRIVACY" since it is the only level
    // provided by LRPC.
    // We are assured of talking to a local service running with
    // system privileges.
    rpcstatus = RpcBindingSetAuthInfoEx(hFileRepClient, Name, RPC_C_AUTHN_LEVEL_PKT_PRIVACY, RPC_C_AUTHN_WINNT, NULL, NULL, &SecurityQOS);
    RPC_EEINFO_EXIT_IF_FAIL(rpcstatus, TEXT("RpcBindingSetAuthInfo"));

#endif

    // Make the RPC to request file replication.
    RpcTryExcept {
        if(bDebug) _tprintf(TEXT("Calling the remote procedure RequestFile(hFileRepClient, %s, %s, %s)\n"), ServerName, RemoteFileName, LocalFileName);

        RequestFile(hFileRepClient, ServerName, RemoteFileName, LocalFileName);

        if(bDebug) _tprintf(TEXT("RequestFile() finished\n"));
    }
    // Return "non-fatal" errors.  Catching fatal errors
    // makes it harder to debug.
    RpcExcept ( ( (RpcExceptionCode() != STATUS_ACCESS_VIOLATION) &&
                  (RpcExceptionCode() != STATUS_DATATYPE_MISALIGNMENT) &&
                  (RpcExceptionCode() != STATUS_PRIVILEGED_INSTRUCTION) &&
                  (RpcExceptionCode() != STATUS_ILLEGAL_INSTRUCTION) &&
                  (RpcExceptionCode() != STATUS_BREAKPOINT))
                  ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH ) {

      PrintProcFailureEEInfo(TEXT("RequestFile"), RpcExceptionCode());
        exit(EXIT_FAILURE);
    }
    RpcEndExcept;

    // Free the binding.
    rpcstatus = RpcBindingFree((VOID **)&hFileRepClient);
    ASSERT(rpcstatus == RPC_S_OK);

    if(bDebug) _tprintf(TEXT("Success!\n"));

    return(EXIT_SUCCESS);

} // end main()

VOID __RPC_FAR* __RPC_API midl_user_allocate ( size_t len )

Definition at line 329 of file FileRep.cpp.

                                                          {
    return(AutoHeapAlloc(len));
}

VOID __RPC_API midl_user_free ( VOID __RPC_FAR * ptr )

Definition at line 333 of file FileRep.cpp.

                                                    {
    if(ptr != NULL) {
        AutoHeapFree(ptr);
    }
}

void PrintUsage ( TCHAR * ProgName )

Definition at line 51 of file FileRep.cpp.

                                 {
    _tprintf(TEXT("%s - File Replication Client Utility\n\n"), ProgName);
    _tprintf(TEXT("Usage: %s [server name] [remote file] [local file] <options...> \n\n"), ProgName);
    _tprintf(TEXT("Options:\n"));
    _tprintf(TEXT(" -p protocol_sequence\n"));
    _tprintf(TEXT(" -n network_address\n"));
    _tprintf(TEXT(" -e endpoint\n"));
    _tprintf(TEXT(" -d print messages\n"));
}

Generated on Wed Nov 13 2024 16:53:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/FileRepAsyncPipe/FileRepClient.idl File Reference

  • NetDS
  • RPC
  • FileRep
  • FileRepAsyncPipe
Classes

FileRepClient.idl File Reference

Go to the source code of this file.

Classes

interface FileRepClient
Generated on Wed Nov 13 2024 16:53:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/FileRepAsyncPipe/FileRepClientProc.cpp File Reference

  • NetDS
  • RPC
  • FileRep
  • FileRepAsyncPipe
Classes | Defines | Typedefs | Enumerations | Functions | Variables

FileRepClientProc.cpp File Reference

#include "common.h"
#include <stddef.h>
#include <Ntdsapi.h>
#include <time.h>
#include "FileRepClient.h"
#include "FileRepServer.h"
#include "Service.h"

Go to the source code of this file.

Classes

struct | tReq

Defines

#define | ClientCompletionPortTimeout (20*1000)
#define | FILE_SIZE_EXTENSION (1*1024*1024)

Typedefs

typedef struct tReq | Req
typedef enum tReqState | ReqState

Enumerations

enum ActionType {
Activate, Pull, Wait, Activate,
Read, Push, Wait
}
enum IoCompletionType {
IoFileRep, IoPipe, IoFile, IoFileRep,
IoPipe, IoFile
}
enum tReqState {
StateArrived, StateQueued, StateActive, StateArrived,
StateQueued, StateActive
}

Functions

VOID | ClientShutdownRequest (Req *pReq)
VOID | FindAndActivateCReq (VOID)
Req * | FindCReq (void)
BOOL | HandleReq (tReq *pReq)
BOOL | IsSecureClient (handle_t hFileRepClient, Req *pReq)
VOID | RequestFile (handle_t hFileRepClient, LPTSTR ServerName, LPTSTR RemoteFileName, LPTSTR LocalFileName)
VOID | ServiceRequests (VOID)
VOID | SetFileSize (HANDLE hFile, DWORD Size)

Variables

HANDLE ClientCompletionPort
LONG | nThreadsAtClientCompletionPort

Define Documentation

#define ClientCompletionPortTimeout (20*1000)

Definition at line 49 of file FileRepClientProc.cpp.

#define FILE_SIZE_EXTENSION (1*1024*1024)

Definition at line 46 of file FileRepClientProc.cpp.

Typedef Documentation

typedef struct tReq Req
typedef enum tReqState ReqState

Enumeration Type Documentation

enum ActionType
Enumerator:
Activate
Pull
Wait
Activate
Read
Push
Wait

Definition at line 60 of file FileRepClientProc.cpp.

             {
  Activate,
  Pull,
  Wait
} ActionType;

enum IoCompletionType
Enumerator:
IoFileRep
IoPipe
IoFile
IoFileRep
IoPipe
IoFile

Definition at line 53 of file FileRepClientProc.cpp.

             {
  IoFileRep, // Posted by FileRep
  IoPipe, // Posted by the RPC runtime
  IoFile // Posted by the File IO subsystem
} IoCompletionType;

enum tReqState
Enumerator:
StateArrived
StateQueued
StateActive
StateArrived
StateQueued
StateActive

Definition at line 67 of file FileRepClientProc.cpp.

                       {
    StateArrived,
    StateQueued,
    StateActive
} ReqState;

Function Documentation

VOID ClientShutdownRequest ( Req * pReq )

Definition at line 307 of file FileRepClientProc.cpp.

                                      {
  DWORD status;
  RPC_STATUS rpcstatus;

#ifdef DEBUG2
  TCHAR Msg[MSG_SIZE];
  DbgMsgRecord(TEXT("-> ClientShutdownRequest\n"));
#endif

  ASSERT(pReq != NULL);

  /*
    The failuire handling for async pipe call is as follows:

      Pull returned failure:
      RPC has done all the clenaup. No need to do anything.

      Non-RPC failure occurred:
      Call RpcAsyncCalncelCall
      Wait for call-complete notification
      Call RpcAsyncCompleteCall

      Received call-complete with failure:
      Call RpcAsyncCompleteCall

  */

  // Complete or cancel the async call, depending on whether
  // an error has occurred and whether complete is needed.
  if (pReq->bCallMade && !pReq->bFailureFromPull) {

    // If we are processing a syncronous failure and the call has not yet
    // been cancelled, then cancel the call and return.  We will later get a
    // call-complete event and will complete the call then.
    if (!pReq->bCallComplete && pReq->Status && !pReq->bAsyncCallFailureReceived && !pReq->bCallCancelled) {

      RpcAsyncCancelCall(&(pReq->Async),
                         TRUE);
      // After cancelling the RPC we return and wait for a
      // call-complete notification.  We will continue to clean up afterwards.
      pReq->bCallCancelled = TRUE;

      if (CriticalSectionOwned(&(pReq->Lock))) {
        LeaveCriticalSection(&(pReq->Lock));
      }
      return;
    }

    // Complete a call if either an error has occurred and we already received
    // a completion notification, or if we had already cancelled it, or
    // if the request has been handled.
    else {

      // If there is an outstanding pull, we should wait for it to complete.
      // This can only happen if WriteFile has failed.
      ASSERT(!pReq->bPullOutstanding || pReq->bFailureFromWrite);
      if (pReq->bPullOutstanding) {
        if (CriticalSectionOwned(&(pReq->Lock))) {
          LeaveCriticalSection(&pReq->Lock);
        }
        return;
      }

      RpcTryExcept {
        RpcAsyncCompleteCall(&(pReq->Async),
                             &status);
      }
      RpcExcept ( ( (RpcExceptionCode() != STATUS_ACCESS_VIOLATION) &&
                    (RpcExceptionCode() != STATUS_DATATYPE_MISALIGNMENT) &&
                    (RpcExceptionCode() != STATUS_PRIVILEGED_INSTRUCTION) &&
                    (RpcExceptionCode() != STATUS_ILLEGAL_INSTRUCTION) &&
                    (RpcExceptionCode() != STATUS_BREAKPOINT) )
                  ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH ) {
        ASSERT(pReq->Status != RPC_S_OK);
      }
      RpcEndExcept;
    }
  }

  // If there are outstanding writes we should wait for them to complete
  // before destroying the object.
  if (pReq->nWritesOutstanding > 0) {
    if (CriticalSectionOwned(&(pReq->Lock))) {
      LeaveCriticalSection(&pReq->Lock);
    }
    return;
  }

  // If there have been no failures, then all the bytes written
  // should have been written and there must not be any
  // bytes unaccounted for.
  ASSERT(pReq->Status != RPC_S_OK || pReq->nBytesOutstanding == 0);

  if (CriticalSectionOwned(&(pReq->Lock))) {
    LeaveCriticalSection(&pReq->Lock);
  }

#ifdef DEBUG1
  nClientReqs--;
#endif

  // We are actually going to wipe out a request after this point
  // and need to bring in a new one from the queue.
  FindAndActivateCReq();

  // Stop impersonating if we are.
  // The first thing we do in handling a request is impersonating the client.
  if (pReq->bImpersonating) {
    if (RevertToSelf() == 0) {
      AddToMessageLogProcFailure(TEXT("ClientShutdownRequest: RevertToSelf"), GetLastError());
    }
    pReq->bImpersonating = FALSE;
  }

  if(pReq->hFileRepServer != NULL) {
    rpcstatus = RpcBindingFree(&(pReq->hFileRepServer));
    ASSERT(rpcstatus == RPC_S_OK);
  }
  // Check that hLocalFile has been initialized and that initialization
  // was successful.
  if(pReq->hLocalFile != NULL && pReq->hLocalFile != INVALID_HANDLE_VALUE) {

    // The file has been extended, truncate its size:
    if (pReq->FileWritePos < pReq->CurrentExtendedSize) {
      SetFileSize(pReq->hLocalFile, pReq->FileWritePos);
    }

    status = CloseHandle(pReq->hLocalFile);
    ASSERT(status != 0);
  }

  // Check if any of the counters need to be decremented
  // since we are removing the request.
  if (pReq->State == StateQueued) {
    CounterDecrement(pClientReqCounters[pReq->Pri]);
#ifdef DEBUG2
    _stprintf(Msg, TEXT("Decremented ClientReqCounters[%d]\n"), pReq->Pri);
    DbgMsgRecord(Msg);
#endif
  }
  if (pReq->State == StateActive) {
    CounterDecrement(pClientActiveReqCounters[pReq->Pri]);
    QueueHashDecrementCounter(ClientActiveReqHashCounters[pReq->Pri], pReq->pSID);
#ifdef DEBUG2
    _stprintf(Msg, TEXT("Decremented ClientActiveReqCounters[%d] and ClientActiveReqHashCounters[%d]\n"), pReq->Pri, pReq->Pri);
    DbgMsgRecord(Msg);
#endif

#ifdef DEBUG1
    QueueRemoveData(ClientActiveReqQueue, pReq);
#endif
  }

  if (pReq->hTokenHandle != NULL) {
    status = CloseHandle(pReq->hTokenHandle);
    ASSERT(status != NULL);
  }

  if (pReq->ServerName != NULL) {
    AutoHeapFree(pReq->ServerName);
  }
  if (pReq->LocalFileName != NULL) {
    AutoHeapFree(pReq->LocalFileName);
  }
  if (pReq->RemoteFileName != NULL) {
    AutoHeapFree(pReq->RemoteFileName);
  }

  if (pReq->pSID != NULL) {
    AutoHeapFree(pReq->pSID);
  }

  // If the critical section has been allocated, free it.
  if (pReq->Lock.DebugInfo) {
    DeleteCriticalSection(&pReq->Lock);
  }

#ifdef PROF
  ProfRecordTime(pReq->nReqId, TEXT("handled"));
#endif

  AutoHeapFree(pReq);

#ifdef DEBUG2
  DbgMsgRecord(TEXT("<- ClientShutdownRequest\n"));
#endif
}

VOID FindAndActivateCReq ( VOID )

Definition at line 280 of file FileRepClientProc.cpp.

                               {
    DWORD status;

    tReq *pReq = FindCReq();

    if (pReq) {

#ifdef DEBUG1
      QueueAdd(ClientActiveReqQueue, pReq, TRUE);
#endif

      // All that is requeired to activate the request is to queue a completion
      // packet with Activate key and the Req as Overlapped.
      status = PostQueuedCompletionStatus(ClientCompletionPort,
                                          0,
                                          IoFileRep,
                                          (LPOVERLAPPED)pReq);
      ASSERT(status);
    }
}

Req* FindCReq ( void )

Definition at line 188 of file FileRepClientProc.cpp.

                    {

#ifdef DEBUG2
    TCHAR Msg[MSG_SIZE];
#endif

    Req *pReq = NULL;

    //
    // We will now go and check if the request or the active request sets of queues have anything that we
    // can service.  If they do not, then this thread can terminate.
    //

    // Check if the request queues have anything on them.  If they do,
    // pick a request off the highest priority queue and handle it, but only if we
    // are not handling enough of those requests already.
    for (UINT pri = NumPriGroups; pri > 0; pri--) {
      pReq = (Req *) QueueRemove(ClientReqQueues[pri-1]);
      if (pReq != NULL) {
        break;
      }
    }

    // We had found a request
    if (pReq != NULL) {

#ifdef DEBUG2
      _stprintf(Msg, TEXT("RequestFile: Took req %p off Req queue %p\n"), pReq, ClientReqQueues[pReq->Pri]);
      DbgMsgRecord(Msg);
#endif

      if (CounterIncrement(pClientActiveReqCounters[pReq->Pri])) {
        if (QueueHashIncrementCounter(ClientActiveReqHashCounters[pReq->Pri], pReq->pSID)) {
#ifdef DEBUG2
          _stprintf(Msg, TEXT("Incremented ClientActiveReqCounters[%d] and ClientActiveReqHashCounters[%d]\n"), pReq->Pri, pReq->Pri);
          DbgMsgRecord(Msg);
#endif
          // The request now resides on a new queue.
          CounterDecrement(pClientReqCounters[pReq->Pri]);
#ifdef DEBUG2
          _stprintf(Msg, TEXT("Decremented ClientReqCounters[%d]\n"), pReq->Pri);
          DbgMsgRecord(Msg);
#endif
          pReq->State = StateActive;

#ifdef DEBUG2
          _stprintf(Msg, TEXT("RequestFile: Handling active req %p\n"), pReq);
          DbgMsgRecord(Msg);
#endif

          return pReq;

        }
        else {
          // There were too many requests for a given SID, place the request back
          // onto the queue.

          // Don't forget to decrement the counter for the group!
          CounterDecrement(pClientActiveReqCounters[pReq->Pri]);

          QueueAdd(ClientReqQueues[pReq->Pri], pReq, TRUE);

#ifdef DEBUG2
          _stprintf(Msg, TEXT("Too many active requests for a SID\n"));
          DbgMsgRecord(Msg);
          _stprintf(Msg, TEXT("RequestFile: Put req %p onto Req queue %p\n"), pReq, ClientReqQueues[pReq->Pri]);
          DbgMsgRecord(Msg);
#endif
        }
      }
      else {
        // There were too many active requests for the user group, place the request back
        // onto the queue.

        QueueAdd(ClientReqQueues[pReq->Pri], pReq, TRUE);

#ifdef DEBUG2
        _stprintf(Msg, TEXT("Too many active requests for priority %d\n"), pReq->Pri);
        DbgMsgRecord(Msg);
        _stprintf(Msg, TEXT("RequestFile: Put req %p onto Req queue %p\n"), pReq, ClientReqQueues[pReq->Pri]);
        DbgMsgRecord(Msg);
#endif
      }
    }

    return NULL;
}

BOOL HandleReq ( tReq * pReq )

Definition at line 504 of file FileRepClientProc.cpp.

                           {

    RPC_STATUS rpcstatus;

    // Default connection to server system service is over TCP/IP.
    LPTSTR DefaultProtocolSequence = TEXT("ncacn_ip_tcp");

    // An empty endpoint string is used, since we are going to
    // connect to the endpoint dynamically generated by the
    // RPC run-time library.  Server calls RpcServerUseProtseq to
    // obtain a binding hadnle and a dynamic endpoint.
    LPTSTR DefaultEndpoint = TEXT("");

    LPTSTR pszUuid = NULL;
    LPTSTR pszOptions = NULL;
    LPTSTR pszStringBinding = NULL;

    //
    // If a request is picked of the request queue.
    // Then we need to set up binding, bind to the server,
    // and do the initial read.
    //

    // We need to impersonate the user that has issued the
    // remote call.
    // We want to impersonate as soon as possible to minimise
    // the amount of resources that can be consumed by an attack.
    if (ImpersonateLoggedOnUser(pReq->hTokenHandle) == 0) {
        pReq->Status = GetLastError();
        ClientShutdownRequest(pReq);
        AddToMessageLogProcFailure(TEXT("HandleReq: ImpersonateLoggedOnUser"), GetLastError());
        return FALSE;
    }
    pReq->bImpersonating = TRUE;

    // Prepare the binding information.
    if ((rpcstatus = RpcStringBindingCompose(pszUuid,
                                             DefaultProtocolSequence,
                                             pReq->ServerName,
                                             DefaultEndpoint,
                                             pszOptions,
                                             &pszStringBinding)) != RPC_S_OK) {
        pReq->Status = rpcstatus;
        ClientShutdownRequest(pReq);
        AddToMessageLogProcFailureEEInfo(TEXT("HandleReq: RpcStringBindingCompose"), rpcstatus);
        return FALSE;
    }

    if ((rpcstatus = RpcBindingFromStringBinding(pszStringBinding, &(pReq->hFileRepServer))) != RPC_S_OK) {
        // The binding handle is invalid
        pReq->hFileRepServer = NULL;

        // Deallocate the string binding.
        rpcstatus = RpcStringFree(&pszStringBinding);
        ASSERT(rpcstatus == RPC_S_OK);

        pReq->Status = GetLastError();
        ClientShutdownRequest(pReq);
        AddToMessageLogProcFailureEEInfo(TEXT("HandleReq: RpcBindingFromStringBinding"), rpcstatus);
        return FALSE;
    }

    // We need to delete the string binding, since it is no longer
    // necessary.  All the binding information is now contained in the
    // binding handle.
    rpcstatus = RpcStringFree(&pszStringBinding);
    ASSERT(rpcstatus == RPC_S_OK);

#ifndef NO_SEC
    DWORD status;

    // Quality of service structure to ensure authentication.
    RPC_SECURITY_QOS SecurityQOS;

    // The length of the principal name and the principal name
    // for the client system service.
    TCHAR szSpn[MAX_PATH];
    ULONG ulSpn = sizeof(szSpn);

    // Generate a principal name for the local system service.
    if ((status = DsMakeSpn(SERVICENAME,
                            pReq->ServerName,
                            NULL,
                            0,
                            0,
                            &ulSpn,
                            szSpn)) != ERROR_SUCCESS) {
        pReq->Status = GetLastError();
        ClientShutdownRequest(pReq);
        AddToMessageLogProcFailure(TEXT("HandleReq: DsMakeSpn"), GetLastError());
        return FALSE;
    }

    // Specify quality of service parameters.
    SecurityQOS.Version = RPC_C_SECURITY_QOS_VERSION;
    SecurityQOS.Capabilities = RPC_C_QOS_CAPABILITIES_MUTUAL_AUTH;
    // Use static identity tracking since we will be issuing multiple
    // RPC calls from this thread with different identities: while
    // impersonating, and while not.  This insures that all the calls will
    // go to server under the identity of the user who created the binding
    // handle.
    SecurityQOS.IdentityTracking = RPC_C_QOS_IDENTITY_STATIC;
    // The client system service needs to impersonate the security context
    // of the client utility on the remote systems where it may replicate
    // files from.  It will also need to obtain client's SID and hence
    // requires impersonation.
    SecurityQOS.ImpersonationType = RPC_C_IMP_LEVEL_IMPERSONATE;

    // Set authentification and authorisation information for
    // the binding handle.
    if ((rpcstatus = RpcBindingSetAuthInfoEx(pReq->hFileRepServer, szSpn, RPC_C_AUTHN_LEVEL_PKT_PRIVACY, RPC_C_AUTHN_GSS_KERBEROS, NULL, RPC_C_AUTHZ_NAME, &SecurityQOS)) != RPC_S_OK) {

        pReq->Status = rpcstatus;
        ClientShutdownRequest(pReq);
        AddToMessageLogProcFailureEEInfo(TEXT("HandleReq: RpcBindingSetAuthInfoEx"), rpcstatus);
        return FALSE;
    }
#endif

    // Initialize the async handle.
    RpcAsyncInitializeHandle(&(pReq->Async),
                             sizeof(RPC_ASYNC_STATE));
    pReq->Async.Flags = RPC_C_NOTIFY_ON_SEND_COMPLETE;
    pReq->Async.UserInfo = pReq;
    pReq->Async.NotificationType = RpcNotificationTypeIoc;
    pReq->Async.u.IOC.hIOPort = ClientCompletionPort;
    pReq->Async.u.IOC.dwCompletionKey = IoPipe;
    pReq->Async.u.IOC.lpOverlapped = (LPOVERLAPPED) pReq;

    // Initialize the request fileds for throtteling the overlapped structure.
    pReq->FileOl.Offset = 0;
    pReq->FileOl.OffsetHigh = 0;
    pReq->FileOl.hEvent = NULL;

    pReq->bPullOutstanding = FALSE;
    pReq->bBuf = FALSE;
    pReq->bDataAvailable = FALSE;
    pReq->bAllPullsDone = FALSE;
    pReq->bCallComplete = FALSE;
    pReq->bAsyncCallFailureReceived = FALSE;
    pReq->bFailureFromPull = FALSE;
    pReq->bFailureFromWrite = FALSE;

    pReq->FileWritePos = 0;
    pReq->CurrentExtendedSize = 0;

    // Attempt to open the local file.
    if ((pReq->hLocalFile = CreateFile(pReq->LocalFileName,
                                       GENERIC_WRITE,
                                       0,
                                       NULL,
                                       CREATE_ALWAYS,
                                       FILE_FLAG_OVERLAPPED,
                                       NULL)) == INVALID_HANDLE_VALUE) {
        pReq->Status = GetLastError();
        ClientShutdownRequest(pReq);
        AddToMessageLogProcFailure(TEXT("HandleReq: CreateFile"), GetLastError());
        return FALSE;
    }

    SetFileSize(pReq->hLocalFile, FILE_SIZE_EXTENSION);

    // Link this file to the client requests's IO completion port:
    if ((ClientCompletionPort = CreateIoCompletionPort (pReq->hLocalFile,
                                                        ClientCompletionPort,
                                                        IoFile,
                                                        0)) == NULL) {
        pReq->Status = GetLastError();
        ClientShutdownRequest(pReq);
        AddToMessageLogProcFailure(TEXT("HandleActiveReq: CreateIoCompletionPort"), GetLastError());
        return FALSE;
    }

    // We need to enter critical section since right after the call is made
    // another thread can receive an asyncronous failure and clean up.
    EnterCriticalSection(&pReq->Lock);

#ifdef RETRY_EXCEPTION
    // When making aggressive calls to the server, this flag is
    // set when the call succeeded.  This makes the client service attempt
    // to contact the server even after an exception occured.
    BOOL bRetryCall = TRUE;
    while (bRetryCall) {
#endif

        // Attempt to open the remote file.
        RpcTryExcept {
            c_RemoteReadAsyncPipe(&(pReq->Async),
                                  pReq->hFileRepServer,
                                  pReq->RemoteFileName,
                                  &(pReq->OutPipe));

#ifdef RETRY_EXCEPTION
            bRetryCall = FALSE;
#endif
        }
        RpcExcept ( ( (RpcExceptionCode() != STATUS_ACCESS_VIOLATION) &&
                      (RpcExceptionCode() != STATUS_DATATYPE_MISALIGNMENT) &&
                      (RpcExceptionCode() != STATUS_PRIVILEGED_INSTRUCTION) &&
                      (RpcExceptionCode() != STATUS_ILLEGAL_INSTRUCTION) &&
                      (RpcExceptionCode() != STATUS_BREAKPOINT) )
                    ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH ) {

#ifdef RETRY_EXCEPTION
            // This code attempts to make aggressive calls, retrying
            // if no endpoints are available.  It is used to put servers
            // under stress.
            if (RpcExceptionCode() != EPT_S_NOT_REGISTERED &&
                RpcExceptionCode() != RPC_S_SERVER_UNAVAILABLE) {
#endif
                // Deallocate all the thread data before failing.
                pReq->Status = RpcExceptionCode();

                ClientShutdownRequest(pReq);
                AddToMessageLogProcFailureEEInfo(TEXT("HandleReq: c_RemoteOpen"), RpcExceptionCode());

                return FALSE;
#ifdef RETRY_EXCEPTION
            }
#endif
        }
        RpcEndExcept;
#ifdef RETRY_EXCEPTION
    }
#endif

    pReq->bCallMade = true;

    // We need to stop impersonating before putting this request back into
    // a queue or quitting.
    if (RevertToSelf() == 0) {
        pReq->bImpersonating = FALSE;
        pReq->Status = GetLastError();
        ClientShutdownRequest(pReq);
        AddToMessageLogProcFailure(TEXT("HandleReq: RevertToSelf"), GetLastError());
    }
    pReq->bImpersonating = FALSE;

    LeaveCriticalSection(&pReq->Lock);

    return TRUE;
}

BOOL IsSecureClient | ( | handle_t | hFileRepClient,
 |  | Req * | pReq
 | ) |  |

Definition at line 1238 of file FileRepClientProc.cpp.

                                                        {

#ifndef NO_SEC
    RPC_AUTHZ_HANDLE hAuth;
    ULONG ulAuthnLevel;

    // Get client security info.
    if (RpcBindingInqAuthClient(pReq->hFileRepClient,
                                &hAuth,
                                NULL,
                                &ulAuthnLevel,
                                NULL,
                                NULL) != RPC_S_OK) {
        AddRpcEEInfo(GetLastError(), TEXT("RequestFile: RpcBindingInqAuthClient failed"));
        return FALSE;
    }

    // Make sure the client has adequate security measures.
    // Since this is LRPC, we get the security level of privacy
    // because it is the only available security level.
    // We do not interoperate with old versions of FileRep
    // client utilities, since appropriate versions should be
    // available with the local system service.
    if (ulAuthnLevel != RPC_C_AUTHN_LEVEL_PKT_PRIVACY) {
        AddRpcEEInfo(RPC_S_SEC_PKG_ERROR, TEXT("RequestFile: ulAuthnLevel != RPC_C_AUTHN_LEVEL_PKT_PRIVACY"));
        return FALSE;
    }
#endif

    return TRUE;
}

VOID RequestFile | ( | handle_t | hFileRepClient,
 |  | LPTSTR | ServerName,
 |  | LPTSTR | RemoteFileName,
 |  | LPTSTR | LocalFileName
 | ) |  |

Definition at line 1286 of file FileRepClientProc.cpp.

                                       {

    RPC_STATUS rpcstatus;

    Req *pReq = NULL;

    // The string binding that is used to make sure clients contact the
    // service via an LRPC call.
    LPTSTR StringBinding;

    // The protocol sequence that gets extracted from the string binding.
    LPTSTR ProtSeq;

    TCHAR Msg[MSG_SIZE];

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> RequestFile\n"));
#endif

    if((pReq = (Req *) AutoHeapAlloc(sizeof(Req))) == NULL) {
        AddRpcEEInfoAndRaiseException(ERROR_OUTOFMEMORY, TEXT("RequestFile: AutoHeapAlloc failed"));
        return;
    }

    // Set pReq' fields to NULL so that we will know
    // in ClientShutdownRequest which ones have been initialized.
    pReq->hFileRepServer = NULL;

    pReq->hFileRepClient = hFileRepClient;

    pReq->hTokenHandle = NULL;

    pReq->hLocalFile = NULL;
    pReq->bImpersonating = FALSE;
    pReq->Pri = 0;
    pReq->State = StateArrived;

    pReq->ServerName = NULL;
    pReq->LocalFileName = NULL;
    pReq->RemoteFileName = NULL;

    pReq->pSID = NULL;

    pReq->Status = 0;

    pReq->bCallMade = FALSE;
    pReq->bCallCancelled = FALSE;

    pReq->Lock.DebugInfo = NULL;

    pReq->nWritesOutstanding = 0;
    pReq->nBytesOutstanding = 0;

#ifdef DEBUG1
    nClientReqs++;

#endif

    // Copy strings out since they may need to be allocated longer then
    // the arguments that live on the stack.
    // It is conceivable that this thread will put the
    // request on the queue and some other thread will
    // handle the request after this thread has exited.
    if ((pReq->ServerName = (LPTSTR) AutoHeapAlloc((_tcslen(ServerName)+1) * sizeof(TCHAR))) == NULL) {
        pReq->Status = GetLastError();
        ClientShutdownRequest(pReq);
        AddRpcEEInfoAndRaiseException(ERROR_OUTOFMEMORY, TEXT("RequestFile: AutoHeapAlloc failed"));
        return;
    }
    CopyMemory(pReq->ServerName, ServerName, (_tcslen(ServerName)+1) * sizeof(TCHAR));
    if ((pReq->RemoteFileName = (LPTSTR) AutoHeapAlloc((_tcslen(RemoteFileName)+1) * sizeof(TCHAR))) == NULL) {
        pReq->Status = GetLastError();
        ClientShutdownRequest(pReq);
        AddRpcEEInfoAndRaiseException(ERROR_OUTOFMEMORY, TEXT("RequestFile: AutoHeapAlloc failed"));
        return;
    }
    CopyMemory(pReq->RemoteFileName, RemoteFileName, (_tcslen(RemoteFileName)+1) * sizeof(TCHAR));
    if ((pReq->LocalFileName = (LPTSTR) AutoHeapAlloc((_tcslen(LocalFileName)+1) * sizeof(TCHAR))) == NULL) {
        pReq->Status = GetLastError();
        ClientShutdownRequest(pReq);
        AddRpcEEInfoAndRaiseException(ERROR_OUTOFMEMORY, TEXT("RequestFile: AutoHeapAlloc failed"));
        return;
    }
    CopyMemory(pReq->LocalFileName, LocalFileName, (_tcslen(LocalFileName)+1) * sizeof(TCHAR));

#ifdef PROF
    static ULONG nTotalId;

    EnterCriticalSection(&ProfCriticalSection);

    // Record the number of the current request.
    pReq->nReqId = nTotalId;
    // Increment the number of the request.
    nTotalId++;

    LeaveCriticalSection(&ProfCriticalSection);

    _stprintf(Msg, TEXT("name=\"%s\" arrived"), RemoteFileName);

    // Record the time of arrival of this request.
    ProfRecordTime(pReq->nReqId, Msg);
#endif

    // Make sure that the client utility is local.
    // Client system service only services LRPC calls.
    if ((rpcstatus = RpcBindingToStringBinding(pReq->hFileRepClient, &StringBinding)) != RPC_S_OK) {
        pReq->Status = rpcstatus;
        ClientShutdownRequest(pReq);
        AddRpcEEInfoAndRaiseException(rpcstatus, TEXT("RequestFile: RpcBindingToStringBinding failed"));
        return;
    }
    if ((rpcstatus = RpcStringBindingParse(StringBinding, NULL, &ProtSeq, NULL, NULL, NULL)) != RPC_S_OK) {
        pReq->Status = rpcstatus;

        // Free the string binding.
        rpcstatus = RpcStringFree(&StringBinding);
        ASSERT(rpcstatus == RPC_S_OK);

        rpcstatus = pReq->Status;
        ClientShutdownRequest(pReq);
        AddRpcEEInfoAndRaiseException(rpcstatus, TEXT("RequestFile: RpcStringBindingParse failed"));
        return;
    }
    if (_tcscmp(ProtSeq, TEXT("ncalrpc")) != 0) {

        // Free the string binding.
        rpcstatus = RpcStringFree(&StringBinding);
        ASSERT(rpcstatus == RPC_S_OK);
        // And the protocol sequence
        rpcstatus = RpcStringFree(&ProtSeq);
        ASSERT(rpcstatus == RPC_S_OK);

        pReq->Status = ERROR_ACCESS_DENIED;
        ClientShutdownRequest(pReq);
        AddRpcEEInfoAndRaiseException(RPC_S_INVALID_RPC_PROTSEQ, TEXT("RequestFile: _tcscmp(ProtSeq, TEXT(\"ncalrpc\")) != 0"));
        return;
    }

    // Free the string binding.
    rpcstatus = RpcStringFree(&StringBinding);
    ASSERT(rpcstatus == RPC_S_OK);
    // And the protocol sequence.
    rpcstatus = RpcStringFree(&ProtSeq);
    ASSERT(rpcstatus == RPC_S_OK);

#ifndef NO_SEC
    if (!IsSecureClient(hFileRepClient, pReq)) {
        pReq->Status = ERROR_ACCESS_DENIED;
        ClientShutdownRequest(pReq);
        AddRpcEEInfoAndRaiseException(RPC_S_SEC_PKG_ERROR, TEXT("RequestFile: IsSecureClient failed"));
        return;
    }
#endif

    //
    // Check that we are not exceeding the bound on the number
    // of concurrent requests for this user's priority group.
    // And update the number of such requests.
    //

    // Impersonate the caller so that we can get the caller's SID
    // Sometimes RpcImpersonateClient may fail under heavy load.
#ifdef RETRY_EXCEPTION
    rpcstatus = RPC_S_OK;
    unsigned tries = 0;
    do {
      if (rpcstatus != RPC_S_OK) {
        tries++;
        Sleep(100);
      }
      rpcstatus = RpcImpersonateClient(pReq->hFileRepClient);
    }
    while (rpcstatus != RPC_S_OK && tries < 10);
#else
    rpcstatus = RpcImpersonateClient(pReq->hFileRepClient);
#endif

    if (rpcstatus != RPC_S_OK) {
        pReq->Status = GetLastError();
        ClientShutdownRequest(pReq);
        AddRpcEEInfoAndRaiseException(rpcstatus, TEXT("RequestFile: RpcImpersonateClient failed"));
        return;
    }
    pReq->bImpersonating = TRUE;

    // We need to write down the access token for the user so that
    // we can use it for impersonation later when the client binding handle
    // gets deallocated.
    if (OpenThreadToken(GetCurrentThread(),
                        TOKEN_QUERY | TOKEN_IMPERSONATE,
                        TRUE,
                        &pReq->hTokenHandle) == 0) {

        pReq->Status = GetLastError();
        ClientShutdownRequest(pReq);
        AddRpcEEInfoAndRaiseException(GetLastError(), TEXT("RequestFile: OpenThreadToken failed"));
        return;
    }

    // Determine current user's priority level.  This corresponds to the
    // priority level of the callee, since we are impersonating.
    pReq->Pri = GetCurrentUserPriority();

    // Write down the SID for the user.
    pReq->pSID = GetUserSID();
    if (pReq->pSID == NULL) {
        pReq->Status = RPC_S_CALL_FAILED;
        ClientShutdownRequest(pReq);
        AddRpcEEInfoAndRaiseException(RPC_S_CALL_FAILED, TEXT("RequestFile: GetUserSID failed"));
        return;
    }

    // Stop impersonating.  We got what we wanted.
    if ((rpcstatus = RpcRevertToSelf()) != RPC_S_OK) {
        pReq->Status = GetLastError();
        pReq->bImpersonating = FALSE;
        ClientShutdownRequest(pReq);
        AddRpcEEInfoAndRaiseException(rpcstatus, TEXT("RequestFile: RpcRevertToSelf failed"));
        return;
    }
    pReq->bImpersonating = FALSE;

    // Init the critsec.
    if (InitializeCriticalSectionAndSpinCount(&pReq->Lock, 10) == 0) {
        AddRpcEEInfoAndRaiseException(GetLastError(), TEXT("ProfOpenLog: InitializeCriticalSectionAndSpinCount"));
        return;
    }

#ifdef DEBUG2
    _stprintf(Msg, TEXT("RequestFile: Pri=%d for req %p\n"), pReq->Pri, pReq);
    DbgMsgRecord(Msg);
#endif

    HANDLE hThread;
    ULONG ThreadIdentifier;
    DWORD status;

    // If the number of worker threads is lower then the maximum, create one.
    if (nThreadsAtClientCompletionPort < 1) {

      // Go service some requests, remember that you are
      // an RPC thread.
      if ((hThread = CreateThread(NULL,
                                  0,
                                  (LPTHREAD_START_ROUTINE) ServiceRequests,
                                  NULL,
                                  0,
                                  &ThreadIdentifier)) == NULL) {

        pReq->Status = GetLastError();
        ClientShutdownRequest(pReq);
        AddToMessageLogProcFailure(TEXT("ServiceRequests: CreateThread"), GetLastError());
        return;
      }

      // Unless we close a handle to the thread, it will remain in the
      // system even after its execution has terminated.
      status = CloseHandle(hThread);
      ASSERT(status != 0);
    }

    // We need to wait putting the request onto the queue untill we know that we could create
    // a worker thread.

    // Increment the counter for the number of concurrent requests.
    if (!CounterIncrement(pClientReqCounters[pReq->Pri])) {

        pReq->Status = RPC_S_SERVER_TOO_BUSY;
        ClientShutdownRequest(pReq);
        // We have to raise exception after deallocating the data
        // since there is a possibility that a client thread
        // will retry and will attempt to open this local file
        // while it's previous request is still holding a lock.
        // This has been actually hit on an overloaded system.
        AddRpcEEInfoAndRaiseException(RPC_S_SERVER_TOO_BUSY, TEXT("RequestFile: CounterIncrement failed"));
#ifdef DEBUG2
        DbgMsgRecord(TEXT("<- RequestFile\n"));
#endif
        return;
    }
#ifdef DEBUG2
    _stprintf(Msg, TEXT("Incremented ClientReqCounters[%d]\n"), pReq->Pri);
    DbgMsgRecord(Msg);
#endif

    pReq->State = StateQueued;

    // Place the request onto the queue.
    // The request will be picked off the queue by a worker thread from the
    // completion port and activate later.
    QueueAdd(ClientReqQueues[pReq->Pri], pReq, TRUE);
#ifdef DEBUG2
    _stprintf(Msg, TEXT("RequestFile: Put req %p onto Req queue %p\n"), pReq, ClientReqQueues[pReq->Pri]);
    DbgMsgRecord(Msg);
#endif

    // Now if we can, find a queued request and activate it.
    FindAndActivateCReq();

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- RequestFile\n"));
#endif
    return;
}

VOID ServiceRequests ( VOID )

Definition at line 750 of file FileRepClientProc.cpp.

                           {
    DWORD Status;

    // The request that we will be processing
    tReq *pReq;

#ifdef DEBUG2
    TCHAR Msg[MSG_SIZE];
#endif

    // Number of bytes read by a pull
    ULONG cbRead;

    // Values returned after a wait on the completion port
    DWORD dwNumberOfBytesTransferred;
    DWORD dwCompletionKey;
    OVERLAPPED *lpOverlapped;

    // A worker thread starts of by waiting for IO
    ActionType Action = Wait;

    while(TRUE) {

      //
      // Make a pull to try and receive data.
      //
      if (Action == Pull) {

        EnterCriticalSection(&pReq->Lock);

        // This will be set if we have processed an async failure notification.
        // Do not issue any more pulls and just wait for all file
        // IO to complete.
        if (pReq->bAsyncCallFailureReceived) {

          LeaveCriticalSection(&pReq->Lock);

          Action = Wait;
          continue;
        }

        // This will be the case if an async write has failed and we want to
        // terminate the request.
        // Wait for all the writes to be completed.
        if (pReq->bFailureFromWrite == TRUE) {

          LeaveCriticalSection(&pReq->Lock);

          Action = Wait;
          continue;
        }

        // We did not read anything yet.
        cbRead = 0;

        RpcTryExcept {

          WINAPI_MY_PIPE_PULL pPull = (WINAPI_MY_PIPE_PULL)pReq->OutPipe.pull;

          pReq->bPullOutstanding = TRUE;

          Status = pPull (pReq->OutPipe.state,
                          (char *) pReq->pbBuf,
                          PULL_BUFSIZE,
                          &cbRead);
        }
        RpcExcept ( ( (RpcExceptionCode() != STATUS_ACCESS_VIOLATION) &&
                      (RpcExceptionCode() != STATUS_DATATYPE_MISALIGNMENT) &&
                      (RpcExceptionCode() != STATUS_PRIVILEGED_INSTRUCTION) &&
                      (RpcExceptionCode() != STATUS_ILLEGAL_INSTRUCTION) &&
                      (RpcExceptionCode() != STATUS_BREAKPOINT))
                    ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH ) {

          Status = RpcExceptionCode();
          ASSERT(Status != RPC_S_OK && Status != RPC_S_ASYNC_CALL_PENDING);
        }
        RpcEndExcept;

        // The pull has failed either through and exception or an
        // error return code.
        if (Status != RPC_S_OK && Status != RPC_S_ASYNC_CALL_PENDING) {

          AddToMessageLogProcFailureEEInfo(TEXT("HandleActiveReq: c_RemoteRead"), Status);

          pReq->bFailureFromPull = TRUE;
          pReq->bAllPullsDone = TRUE;
          pReq->bPullOutstanding = FALSE;
          pReq->bCallComplete = TRUE;

          // Dump this request.
          pReq->Status = Status;
          ClientShutdownRequest(pReq);

          Action = Wait;
        }

        // The pull has succeeded.
        // We read some data.
        else if (Status == RPC_S_OK && cbRead > 0) {

          pReq->FileOl.Offset = pReq->FileWritePos;

          pReq->bDataAvailable = FALSE;
          pReq->bPullOutstanding = FALSE;

          pReq->nWritesOutstanding++;
          pReq->nBytesOutstanding+=cbRead;

          // Access check was done on opening when we were impersonating.
          // Thus we do not need to impersonate in this code.
          Status = WriteFile(pReq->hLocalFile, pReq->pbBuf, cbRead, NULL, &pReq->FileOl);

          // Write has failed.
          if(!Status && GetLastError() != ERROR_IO_PENDING) {

              AddToMessageLogProcFailure(TEXT("HandleActiveReq: WriteFile"), GetLastError());

              pReq->nWritesOutstanding--;

              pReq->nBytesOutstanding-=cbRead;

              // If we hit a failure on write we will
              // stop the pulls, wait for all outstanding IO to
              // complete and then finish.
              pReq->bFailureFromWrite = TRUE;

              // Dump this request.
              pReq->Status = GetLastError();
              ClientShutdownRequest(pReq);

              Action = Wait;
          }

          // Write has suceeded.
          else {

            pReq->FileWritePos+=cbRead;

            if (pReq->FileWritePos > pReq->CurrentExtendedSize) {
              pReq->CurrentExtendedSize+=FILE_SIZE_EXTENSION;
              SetFileSize(pReq->hLocalFile, pReq->CurrentExtendedSize);
            }

            LeaveCriticalSection(&pReq->Lock);

            Action = Pull;
          }
        }

        // The pull has suceeded.
        // We did not get any data.
        // If the pipe is empty and pull returned 0 bytes, the transfer is complete.
        else if (Status == RPC_S_OK && cbRead == 0) {

          pReq->bDataAvailable = FALSE;
          pReq->bPullOutstanding = FALSE;

          pReq->bAllPullsDone = TRUE;

          // If we have done all the pulls and received call-complete, finish.
          if(pReq->bAllPullsDone && pReq->bCallComplete) {
            ClientShutdownRequest(pReq);
          }
          // Otherwise, wait.
          else {
            LeaveCriticalSection(&pReq->Lock);
          }

          // We will either complete this request ot wait for all the file
          // IO to complete.  In either case, the next action will be Wait.
          Action = Wait;
        }

        // No data is present yet.  A notification will be issued later.
        else if (Status == RPC_S_ASYNC_CALL_PENDING && cbRead == 0) {

          ASSERT(pReq->bDataAvailable == FALSE);

          LeaveCriticalSection(&pReq->Lock);

          Action = Wait;
        }

        // Should not get here
        else {

          LeaveCriticalSection(&pReq->Lock);

          ASSERT(0);
        }
      }

      //
      // Wait for IO completion
      //
      else if (Action == Wait) {

        InterlockedIncrement(&nThreadsAtClientCompletionPort);

        ASSERT(nThreadsAtClientCompletionPort >= 0);

        Status = GetQueuedCompletionStatus(ClientCompletionPort,
                                           &dwNumberOfBytesTransferred,
                                           (PULONG_PTR)&dwCompletionKey,
                                           &lpOverlapped,
                                           ClientCompletionPortTimeout);

        // Failure to dequeue an IO completion packet.
        if (!Status && lpOverlapped == NULL) {

          ULONG nThreads = InterlockedDecrement(&nThreadsAtClientCompletionPort);

          // Wait timed out.
          if (GetLastError() == WAIT_TIMEOUT) {

            // If wait timed out and there are other threads waiting on the completion port,
            // we can exit.
            if (nThreads != 0) {
              return;
            }
            // If there are no other threads, go back to wait for the IO.
            else {
              continue;
            }
          }

          // Failure occurred and we were unable to dequeue an IO completion
          // packet.
          else {
            AddToMessageLogProcFailure(TEXT("HandleActiveReq: GetQueuedCompletionStatus"), GetLastError());

            // Nothing we can do, just wait a little and re-try.
            Sleep(100);
            Action = Wait;
            continue;
          }
        }

        // If this is the last thread to come off a completion port,
        // spin up an extra worker thread.  Thi ensures that there is
        // always a waiter on the port.
        if (InterlockedDecrement(&nThreadsAtClientCompletionPort) == 0) {

          HANDLE hThread;
          ULONG ThreadIdentifier;
          DWORD status;

          if ((hThread = CreateThread(NULL,
                                      0,
                                      (LPTHREAD_START_ROUTINE) ServiceRequests,
                                      NULL,
                                      0,
                                      &ThreadIdentifier)) == NULL) {

            // If CreateThread has failed there is nothing that we can do.
            // Just continue...
            AddToMessageLogProcFailure(TEXT("ServiceRequests: CreateThread"), GetLastError());
          }
          else {
            // Unless we close a handle to the thread, it will remain in the
            // system even after its execution has terminated.
            status = CloseHandle(hThread);
            ASSERT(status != 0);
          }
        }

        ASSERT(nThreadsAtClientCompletionPort >= 0);

        // Dequeued an IO completion packet for a successful operation.
        // or for an unsucessful operation.  If Status != 0 then the
        // operation has suceeded.

        // There is at most one async WriteFile outstanding,
        // so only one thread may be executing here for a given request.
        if (dwCompletionKey == IoFile) {
          pReq = (Req *) ((size_t)lpOverlapped - offsetof(Req, FileOl));

#ifdef DEBUG2
          _stprintf(Msg, TEXT("HandleActiveReq: received File IO for req %p\n"), pReq);
          DbgMsgRecord(Msg);
#endif

          EnterCriticalSection(&pReq->Lock);

          // File IO suceeded.
          if (Status) {

            pReq->nWritesOutstanding--;

            pReq->nBytesOutstanding-=dwNumberOfBytesTransferred;

            ASSERT(pReq->nWritesOutstanding >= 0);

            Action = Wait;

            if(pReq->bAllPullsDone &&
               pReq->nWritesOutstanding <= 0 &&
               (pReq->bCallComplete || pReq->bAsyncCallFailureReceived || pReq->bFailureFromWrite)) {

              ClientShutdownRequest(pReq);

              Action = Wait;
            }
            else {
              LeaveCriticalSection(&pReq->Lock);
            }
          }

          // File IO has failed.
          else {
            AddToMessageLogProcFailure(TEXT("HandleActiveReq: WriteFile"), GetLastError());

            pReq->nWritesOutstanding--;

            pReq->nBytesOutstanding-=dwNumberOfBytesTransferred;

            pReq->bFailureFromWrite = TRUE;

            // We do not want to pull any more data once file IO has failed.
            pReq->bAllPullsDone = TRUE;

            ASSERT(pReq->nWritesOutstanding >= 0);

            // If we hit a failure on write we will
            // wait for the async IO to complete.

            // Dump this request.
            pReq->Status = GetLastError();
            if (pReq->Status == 0) {
                pReq->Status = ERROR_OPERATION_ABORTED;
            }

            ClientShutdownRequest(pReq);

            Action = Wait;
          }
        }

        // There is at most one async pull outstanding,
        // so at most one thread may be executing here for a given request.
        // The only possibility that we need to syncronize against is a pull and a write
        // completing simultaneously and racing.
        //
        // The IO completion packets posted by the RPC runtime correspond to
        // sucessful IO only.  Failures are reported as call-complete events.
        else if(dwCompletionKey == IoPipe) {
          pReq = (Req *) lpOverlapped;

#ifdef DEBUG2
          _stprintf(Msg, TEXT("HandleActiveReq: received Pipe IO for req %p\n"), pReq);
          DbgMsgRecord(Msg);
#endif

      EnterCriticalSection(&pReq->Lock);

          //
          // Received a call-complete notification from the RPC runtime.
          //
          if(pReq->Async.Event == RpcCallComplete) {

            // It is possible that the server terminated the call prematurely.
            // If this is the case find an error.
            pReq->Status = RpcAsyncGetCallStatus(&pReq->Async);

            ASSERT(pReq->bCallComplete == FALSE ||
                   pReq->Status == RPC_S_SERVER_UNAVAILABLE ||
                   pReq->Status == RPC_S_CALL_FAILED_DNE ||
                   pReq->Status == RPC_S_CALL_FAILED ||
                   pReq->Status == RPC_S_CALL_CANCELLED);

            // The call did in fact fail.
            if (pReq->Status != RPC_S_OK) {

              // If the call has failed, forget about doing
              // more pulls.
              pReq->bAllPullsDone = TRUE;
              pReq->bPullOutstanding = FALSE;
              pReq->bAsyncCallFailureReceived = TRUE;

              // Try to dump the request.
              ClientShutdownRequest(pReq);

              Action = Wait;
            }

            // The call did not fail.  We received notification of it's
            // sucessful completion.
            else {

              ASSERT(pReq->bAsyncCallFailureReceived == FALSE);

              // Call complete should be the last notification
              // received.  We will note this, and wait for the file
              // IO to completion if necessary.
              pReq->bCallComplete = TRUE;

              Action = Wait;

              if(pReq->bAllPullsDone) {
                ClientShutdownRequest(pReq);
              }
              else {
                LeaveCriticalSection(&pReq->Lock);
              }
            }
          }

          //
          // Got a receive-complete notification from the RPC runtime.
          //
          else if(pReq->Async.Event == RpcReceiveComplete){

            Action = Pull;

            ASSERT(pReq->bCallComplete == FALSE);
            ASSERT(pReq->bPullOutstanding == TRUE);

            // If a pull has completed then there are no more
            // outstanding pulls.
            pReq->bPullOutstanding = FALSE;

            // If an async WriteFile has failed, we would have cancelled the
            // call.  After getting a call-complete notification we
            // will clean it up.
            if (pReq->bCallCancelled) {
              Action = Wait;
              LeaveCriticalSection(&pReq->Lock);
              continue;
            }

            // If the call is still a sucess, then there must be
            // data for us.
            pReq->bDataAvailable = TRUE;

            LeaveCriticalSection(&pReq->Lock);
          }

          // We should never be here.
          else {
            LeaveCriticalSection(&pReq->Lock);

            ASSERT(0);
          }
        }

        //
        // We got a FileRep internal packet to activate a new request.
        //
        else if(dwCompletionKey == IoFileRep) {
          pReq = (Req *) lpOverlapped;

          if(HandleReq(pReq)) {
            Action = Pull;
          }
          else {
            Action = Wait;
          }
        }

        else { // dwCompletionKey
          ASSERT(0);
        }
      }

      else { // Action
        ASSERT(0);
      }
    }
}

VOID SetFileSize | ( | HANDLE | hFile,
 |  | DWORD | Size
 | ) |  |

Definition at line 176 of file FileRepClientProc.cpp.

                                            {
    SetFilePointer(hFile,
                   Size,
                   NULL,
                   FILE_BEGIN);
    SetEndOfFile(hFile);
}

Variable Documentation

HANDLE ClientCompletionPort

Definition at line 143 of file Service.cpp.

LONG nThreadsAtClientCompletionPort

Definition at line 146 of file Service.cpp.

Generated on Wed Nov 13 2024 16:53:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/FileRepAsyncPipe/FileRepServer.cpp File Reference

  • NetDS
  • RPC
  • FileRep
  • FileRepAsyncPipe
Defines | Functions

FileRepServer.cpp File Reference

#include "common.h"
#include <process.h>
#include <tchar.h>
#include <rpc.h>
#include <Ntdsapi.h>
#include <Ntsecapi.h>
#include <Security.h>
#include <Secext.h>
#include <Dsgetdc.h>
#include <Lm.h>
#include "Service.h"

Go to the source code of this file.

Defines

#define | SECURITY_WIN32

Functions

VOID _cdecl | main (int argc, char **argv)

Define Documentation

#define SECURITY_WIN32

Definition at line 29 of file FileRepServer.cpp.

Function Documentation

VOID _cdecl main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 68 of file FileRepServer.cpp.

                                       {
    RPC_STATUS status;

    int nNumArgs;
    LPWSTR *szArgList = CommandLineToArgvW(GetCommandLine(), &nNumArgs);

    if (NULL == szArgList) {
        _tprintf(TEXT("FileRep main: CommandLineToArgW failed"));
        exit(EXIT_FAILURE);
    }

    // Allow the user to override settings with command line switches.
    for (int i = 1; i < nNumArgs; i++) {
        // Well-formed argument switches start with '/' or '-' and are
        // two characters long.
        if (((*szArgList[i] == TEXT('-')) || (*szArgList[i] == TEXT('/'))) && _tcsclen(szArgList[i]) == 2) {

            switch (_totlower(*(szArgList[i]+1))) {

                case TEXT('f'):
      bNoFileIO = true;
      break;

                case TEXT('h'):
                case TEXT('?'):
                default:
                    exit(EXIT_SUCCESS);
            }
        }
        else {
    _tprintf(TEXT("Bad arguments.\n\n"));
    exit(EXIT_FAILURE);
        }
    }

    // Service initialization
    if (!StartFileRepServer()) {
      return;
    } else {
      bServerListening = TRUE;

      // RpcMgmtWaitServerListen() will block until the server has
      // stopped listening.
      status = RpcMgmtWaitServerListen();
      if (status != RPC_S_OK){
        AddToMessageLogProcFailureEEInfo(TEXT("ServiceStart: RpcMgmtWaitServerListen"), status);
        return;
      }
    }

    return;
}

Generated on Wed Nov 13 2024 16:53:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/FileRepAsyncPipe/FileRepServer.idl File Reference

  • NetDS
  • RPC
  • FileRep
  • FileRepAsyncPipe
Classes

FileRepServer.idl File Reference

Go to the source code of this file.

Classes

interface FileRepServer
Generated on Wed Nov 13 2024 16:53:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/FileRepAsyncPipe/FileRepServerProc.cpp File Reference

  • NetDS
  • RPC
  • FileRep
  • FileRepAsyncPipe
Classes | Defines | Typedefs | Enumerations | Functions | Variables

FileRepServerProc.cpp File Reference

#include "common.h"
#include <stdlib.h>
#include <stdio.h>
#include <stddef.h>
#include <tchar.h>
#include <string.h>
#include <time.h>
#include "FileRepServer.h"
#include "Service.h"

Go to the source code of this file.

Classes

struct | tSReq

Defines

#define | ServerCompletionPortTimeout (20*1000)

Typedefs

typedef struct tSReq | SReq
typedef enum tSReqState | SReqState

Enumerations

enum ActionType {
Activate, Pull, Wait, Activate,
Read, Push, Wait
}
enum IoCompletionType {
IoFileRep, IoPipe, IoFile, IoFileRep,
IoPipe, IoFile
}
enum | tSReqState { StateArrived, StateQueued, StateActive }

Functions

VOID | FindAndActivateSReq (VOID)
SReq * | FindSReq (void)
BOOL | HandleSReq (tSReq *pReq)
void | s_RemoteReadAsyncPipe (PRPC_ASYNC_STATE pAsync, handle_t hFileRepClient, TCHAR FileName[128], ASYNC_CHAR_PIPE_TYPE *OutPipe)
VOID | ServerShutdownRequest (SReq *pReq)
VOID | SServiceRequests (VOID)

Variables

LONG | nThreadsAtServerCompletionPort
HANDLE ServerCompletionPort

Define Documentation

#define ServerCompletionPortTimeout (20*1000)

Definition at line 38 of file FileRepServerProc.cpp.

Typedef Documentation

typedef struct tSReq SReq
typedef enum tSReqState SReqState

Enumeration Type Documentation

enum ActionType
Enumerator:
Activate
Pull
Wait
Activate
Read
Push
Wait

Definition at line 53 of file FileRepServerProc.cpp.

             {
  Activate,
  Read,
  Push,
  Wait,
} ActionType;

enum IoCompletionType
Enumerator:
IoFileRep
IoPipe
IoFile
IoFileRep
IoPipe
IoFile

Definition at line 47 of file FileRepServerProc.cpp.

             {
  IoFileRep,
  IoPipe,
  IoFile
} IoCompletionType;

enum tSReqState
Enumerator:
StateArrived
StateQueued
StateActive

Definition at line 41 of file FileRepServerProc.cpp.

                        {
    StateArrived,
    StateQueued,
    StateActive
} SReqState;

Function Documentation

VOID FindAndActivateSReq ( VOID )

Definition at line 227 of file FileRepServerProc.cpp.

                               {
    DWORD status;

    tSReq *pReq = FindSReq();

    if (pReq) {

#ifdef DEBUG1
      QueueAdd(ServerActiveReqQueue, pReq, TRUE);
#endif

      // All that is requeired to activate the request is to queue a completion
      // packet with Activate key and the Req as Overlapped.
      status = PostQueuedCompletionStatus(ServerCompletionPort,
                                          0,
                                          IoFileRep,
                                          (LPOVERLAPPED)pReq);
      ASSERT(status);
    }
}

SReq* FindSReq ( void )

Definition at line 141 of file FileRepServerProc.cpp.

                     {

#ifdef DEBUG2
    TCHAR Msg[MSG_SIZE];
#endif

    SReq *pReq = NULL;

    //
    // We will now go and check if the request or the active request sets of queues have anything that we
    // can service.  If they do not, then this thread can terminate.
    //

    // Check if the request queues have anything on them.  If they do,
    // pick a request off the highest priority queue and handle it, but only if we
    // are not handling enough of those requests already.
    for (UINT pri = NumPriGroups; pri > 0; pri--) {
      pReq = (SReq *) QueueRemove(ServerReqQueues[pri-1]);
      if (pReq != NULL) {
        break;
      }
    }

    if (pReq != NULL) {

#ifdef DEBUG2
      _stprintf(Msg, TEXT("RequestFile: Took req %p off Req queue %p\n"), pReq, ServerReqQueues[pReq->Pri]);
      DbgMsgRecord(Msg);
#endif

      if (CounterIncrement(pServerActiveReqCounters[pReq->Pri])) {
        if (QueueHashIncrementCounter(ServerActiveReqHashCounters[pReq->Pri], pReq->pSID)) {
#ifdef DEBUG2
          _stprintf(Msg, TEXT("Incremented ServerActiveReqCounters[%d] and ServerActiveReqHashCounters[%d]\n"), pReq->Pri, pReq->Pri);
          DbgMsgRecord(Msg);
#endif
          // The request now resides on a new queue.
          CounterDecrement(pServerReqCounters[pReq->Pri]);
#ifdef DEBUG2
          _stprintf(Msg, TEXT("Decremented ServerReqCounters[%d]\n"), pReq->Pri);
          DbgMsgRecord(Msg);
#endif
          pReq->State = StateActive;

#ifdef DEBUG2
          _stprintf(Msg, TEXT("RequestFile: Handling active req %p\n"), pReq);
          DbgMsgRecord(Msg);
#endif
          return pReq;

        }
        else {
          // There were too many requests for a given SID, place the request back
          // onto the queue.

          // Don't forget to decrement the counter for the group!
          CounterDecrement(pServerActiveReqCounters[pReq->Pri]);

          QueueAdd(ServerReqQueues[pReq->Pri], pReq, TRUE);

#ifdef DEBUG2
          _stprintf(Msg, TEXT("Too many active requests for a SID\n"));
          DbgMsgRecord(Msg);
          _stprintf(Msg, TEXT("RequestFile: Put req %p onto Req queue %p\n"), pReq, ServerReqQueues[pReq->Pri]);
          DbgMsgRecord(Msg);
#endif
        }
      }
      else {
        // There were too many active requests for the user group, place the request back
        // onto the queue.

        QueueAdd(ServerReqQueues[pReq->Pri], pReq, TRUE);

#ifdef DEBUG2
        _stprintf(Msg, TEXT("Too many active requests for priority %d\n"), pReq->Pri);
        DbgMsgRecord(Msg);
        _stprintf(Msg, TEXT("RequestFile: Put req %p onto Req queue %p\n"), pReq, ServerReqQueues[pReq->Pri]);
        DbgMsgRecord(Msg);
#endif
      }
    }

    return NULL;
}

BOOL HandleSReq ( tSReq * pReq )

Definition at line 350 of file FileRepServerProc.cpp.

                             {

#ifndef NO_SEC
    // We need to impersonate the user that has issued the
    // remote call.
    // We want to impersonate as soon as possible to minimise
    // the amount of resources that can be consumed by an attack.
    if (ImpersonateLoggedOnUser(pReq->hTokenHandle) == 0) {
        pReq->Status = GetLastError();
        ServerShutdownRequest(pReq);
        AddToMessageLogProcFailure(TEXT("HandleReq: ImpersonateLoggedOnUser"), GetLastError());
        return FALSE;
    }
    pReq->bImpersonating = TRUE;
#endif

    // Attempt to open the local file.
    if ((pReq->hLocalFile = CreateFile(pReq->LocalFileName,
                            GENERIC_READ,
                            FILE_SHARE_READ,
                            NULL,
                            OPEN_EXISTING,
                            FILE_FLAG_OVERLAPPED,
                            NULL)) == INVALID_HANDLE_VALUE) {
        pReq->Status = GetLastError();
        ServerShutdownRequest(pReq);
        AddToMessageLogProcFailure(TEXT("HandleReq: CreateFile"), GetLastError());
        return FALSE;
    }

#ifndef NO_SEC
    // We need to stop impersonating before putting this request back into
    // a queue or quitting.
    if (RevertToSelf() == 0) {
        AddToMessageLogProcFailure(TEXT("HandleReq: RevertToSelf"), GetLastError());
    }
    pReq->bImpersonating = FALSE;
#endif

    // Initialize the request fileds for throtteling the IO

    pReq->FileOl.Offset = 0;
    pReq->FileOl.OffsetHigh = 0;
    pReq->FileOl.hEvent = NULL;

    pReq->Async->u.IOC.dwCompletionKey = IoPipe;
    pReq->Async->u.IOC.lpOverlapped = (LPOVERLAPPED) pReq;

    pReq->bLastDataPushIssued = FALSE;
    pReq->bReadsDone = FALSE;
    pReq->bNullPush = FALSE;

    pReq->Async->Flags = RPC_C_NOTIFY_ON_SEND_COMPLETE;
    pReq->Async->UserInfo = pReq;
    pReq->Async->NotificationType = RpcNotificationTypeIoc;
    pReq->Async->u.IOC.hIOPort = ServerCompletionPort;

    // Link this file to the client requests's IO completion port:
    if ((ServerCompletionPort = CreateIoCompletionPort (pReq->hLocalFile,
                                                        ServerCompletionPort,
                                                        IoFile,
                                                        0)) == NULL) {
        AddToMessageLogProcFailure(TEXT("HandleActiveReq: CreateIoCompletionPort"), GetLastError());
        return FALSE;
    }

    pReq->bReadOutstanding = FALSE;
    pReq->bPushOutstanding = FALSE;
    pReq->bBuf = FALSE;

    // Init the critsec.
    if (InitializeCriticalSectionAndSpinCount(&pReq->Lock, 10) == 0) {
        AddToMessageLogProcFailure(TEXT("HandleActiveReq: InitializeCriticalSectionAndSpinCount"), GetLastError());
        return FALSE;
    }

    return TRUE;
}

void s_RemoteReadAsyncPipe | ( | PRPC_ASYNC_STATE | pAsync,
 |  | handle_t | hFileRepClient,
 |  | TCHAR | FileName[128],
 |  | ASYNC_CHAR_PIPE_TYPE * | OutPipe
 | ) |  |

Definition at line 801 of file FileRepServerProc.cpp.

                                                          {

    int nReply = 1;

    unsigned long ecount = 0;

    SReq *pReq = NULL;

    TCHAR Msg[MSG_SIZE];

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> s_RemoteReadAsyncPipe\n"));
#endif

    if((pReq = (SReq *) AutoHeapAlloc(sizeof(SReq))) == NULL) {
        AddRpcEEInfoAndRaiseException(ERROR_OUTOFMEMORY, TEXT("RequestFile: AutoHeapAlloc failed"));
        return;
    }

    // Set pReq' fields to NULL so that we will know
    // in ServerShutdownRequest which ones have been initialized.
    pReq->hFileRepClient = hFileRepClient;

    pReq->hTokenHandle = NULL;

    pReq->hLocalFile = NULL;
    pReq->bImpersonating = FALSE;
    pReq->Pri = 0;
    pReq->State = StateArrived;

    pReq->pSID = NULL;

    pReq->Status = 0;

    pReq->Lock.DebugInfo = NULL;

    // The out-pipe we use to pull data from the server.
    pReq->OutPipe = OutPipe;

    // The async handle for the call to RemoteOpen.
    pReq->Async = pAsync;

    pReq->fCallInvalidated = FALSE;

#ifdef DEBUG1
    nServerReqs++;
#endif

    if ((pReq->LocalFileName = (LPTSTR) AutoHeapAlloc((_tcslen(FileName)+1) * sizeof(TCHAR))) == NULL) {
        pReq->Status = GetLastError();
        ServerShutdownRequest(pReq);
        AddRpcEEInfoAndRaiseException(ERROR_OUTOFMEMORY, TEXT("RequestFile: AutoHeapAlloc failed"));
        return;
    }
    CopyMemory(pReq->LocalFileName, FileName, (_tcslen(FileName)+1) * sizeof(TCHAR));

    //
    // Check that we are not exceeding the bound on the number
    // of concurrent requests for this user's priority group.
    // And update the number of such requests.
    //

#ifndef NO_SEC
    RPC_STATUS rpcstatus;

    // Impersonate the caller so that we can get the caller's SID
    if ((rpcstatus = RpcImpersonateClient(pReq->hFileRepClient)) != RPC_S_OK) {
        pReq->Status = GetLastError();
        ServerShutdownRequest(pReq);
        AddRpcEEInfoAndRaiseException(rpcstatus, TEXT("RequestFile: RpcImpersonateClient failed"));
        return;
    }
    pReq->bImpersonating = TRUE;

    // We need to write down the access token for the user so that
    // we can use it for impersonation later when the client binding handle
    // gets deallocated.
    if (OpenThreadToken(GetCurrentThread(),
                        TOKEN_QUERY | TOKEN_IMPERSONATE,
                        TRUE,
                        &pReq->hTokenHandle) == 0) {

        pReq->Status = GetLastError();
        ServerShutdownRequest(pReq);
        AddRpcEEInfoAndRaiseException(GetLastError(), TEXT("RequestFile: OpenThreadToken failed"));
        return;
    }

    // Determine current user's priority level.  This corresponds to the
    // priority level of the callee, since we are impersonating.
    pReq->Pri = GetCurrentUserPriority();

    // Write down the SID for the user.
    pReq->pSID = GetUserSID();

    // Stop impersonating.  We got what we wanted.
    if ((rpcstatus = RpcRevertToSelf()) != RPC_S_OK) {
        pReq->bImpersonating = FALSE;

        pReq->Status = GetLastError();
        ServerShutdownRequest(pReq);
        AddRpcEEInfoAndRaiseException(rpcstatus, TEXT("RequestFile: RpcRevertToSelf failed"));
        return;
    }
    pReq->bImpersonating = FALSE;

#else

    pReq->Pri = 1;

    unsigned SidLength = GetLengthSid(pAnonSID);
    if ((pReq->pSID = AutoHeapAlloc(SidLength)) == NULL) {
        pReq->Status = GetLastError();
        ServerShutdownRequest(pReq);
        AddRpcEEInfoAndRaiseException(GetLastError(), TEXT("RequestFile: AutoHeapAlloc failed"));
        return;
    }

    if (CopySid(SidLength, pReq->pSID, pAnonSID) == 0) {
        pReq->Status = GetLastError();
        ServerShutdownRequest(pReq);
        AddRpcEEInfoAndRaiseException(GetLastError(), TEXT("RequestFile: CopySID failed"));
        return;
    }

#endif

#ifdef DEBUG2
    _stprintf(Msg, TEXT("RequestFile: Pri=%d for req %p\n"), pReq->Pri, pReq);
    DbgMsgRecord(Msg);
#endif

    // If there are no workers ot handle the request, create one.

    HANDLE hThread;
    ULONG ThreadIdentifier;
    DWORD status;

    if (nThreadsAtServerCompletionPort < 1) {

      // Go service some requests, remember that you are
      // an RPC thread.
      if ((hThread = CreateThread(NULL,
                                  0,
                                  (LPTHREAD_START_ROUTINE) SServiceRequests,
                                  NULL,
                                  0,
                                  &ThreadIdentifier)) == NULL) {

        pReq->Status = GetLastError();
        ServerShutdownRequest(pReq);
        AddToMessageLogProcFailure(TEXT("SServiceRequests: CreateThread"), GetLastError());
        return;
      }

      // Unless we close a handle to the thread, it will remain in the
      // system even after its execution has terminated.
      status = CloseHandle(hThread);
      ASSERT(status != 0);
    }

    // We need to place request onto the queue only after we know that there is someone
    // who will actually be able to pick it up.  Thus, we need to create the thread first.

    // Increment the counter for the number of concurrent requests.
    if (!CounterIncrement(pServerReqCounters[pReq->Pri])) {

        pReq->Status = GetLastError();
        ServerShutdownRequest(pReq);
        // We have to raise exception after deallocating the data
        // since there is a possibility that a client thread
        // will retry and will attempt to open this local file
        // while it's previous request is still holding a lock.
        // This has been actually hit on an overloaded system.
        AddRpcEEInfoAndRaiseException(RPC_S_SERVER_TOO_BUSY, TEXT("RequestFile: CounterIncrement failed"));
        return;
    }
#ifdef DEBUG2
    _stprintf(Msg, TEXT("Incremented ServerReqCounters[%d]\n"), pReq->Pri);
    DbgMsgRecord(Msg);
#endif

    pReq->State = StateQueued;

#ifdef DEBUG2
    _stprintf(Msg, TEXT("RequestFile: Put req %p onto Req queue %p\n"), pReq, ServerReqQueues[pReq->Pri]);
    DbgMsgRecord(Msg);
#endif

    // Place the request onto the queue.
    QueueAdd(ServerReqQueues[pReq->Pri], pReq, TRUE);

    // After this point the request can be deleted.  Do not touch it.

    // Now if we can, find a queued request and activate it.
    FindAndActivateSReq();

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- RequestFile\n"));
#endif

    return;
}

VOID ServerShutdownRequest ( SReq * pReq )

Definition at line 252 of file FileRepServerProc.cpp.

                                       {
    DWORD status;
    RPC_STATUS rpcstatus;

#ifdef DEBUG2
    TCHAR Msg[MSG_SIZE];

    DbgMsgRecord(TEXT("-> ServerShutdownRequest\n"));
#endif

    ASSERT(pReq != NULL);

#ifdef DEBUG1
nServerReqs--;
#endif

    // We are actually deleting a request, pick a new one from the queue.
    FindAndActivateSReq();

    // Stop impersonating if we are.
    // The first thing we do in handling a request is impersonating the client.
    if (pReq->bImpersonating) {
      rpcstatus = RpcRevertToSelf();
      if (rpcstatus != RPC_S_OK) {
        AddToMessageLogProcFailureEEInfo(TEXT("ServerShutdownRequest: RpcRevertToSelf"), rpcstatus);
      }
    }

    // Complete or cancel the async call, depending on whether an error
    // has occurred.
    if (pReq->Status && !pReq->fCallInvalidated) {
      RpcAsyncAbortCall(pReq->Async,
                        TRUE);
    }
    else {
      RpcAsyncCompleteCall(pReq->Async,
                           &status);
    }

    // Check that hLocalFile has been initialized and that initialization
    // was successful.
    if (pReq->hLocalFile != NULL && pReq->hLocalFile != INVALID_HANDLE_VALUE) {
      status = CloseHandle(pReq->hLocalFile);
      ASSERT(status != 0);
    }

    if (pReq->LocalFileName != NULL) {
      AutoHeapFree(pReq->LocalFileName);
    }

    // Check if any of the counters need to be decremented
    // since we are removing the request.
    if (pReq->State == StateQueued) {
      CounterDecrement(pServerReqCounters[pReq->Pri]);
#ifdef DEBUG2
      _stprintf(Msg, TEXT("Decremented ServerReqCounters[%d]\n"), pReq->Pri);
      DbgMsgRecord(Msg);
#endif
    }
    if (pReq->State == StateActive) {
      CounterDecrement(pServerActiveReqCounters[pReq->Pri]);
      QueueHashDecrementCounter(ServerActiveReqHashCounters[pReq->Pri], pReq->pSID);
#ifdef DEBUG2
      _stprintf(Msg, TEXT("Decremented ServerActiveReqCounters[%d] and ServerActiveReqHashCounters[%d]\n"), pReq->Pri, pReq->Pri);
      DbgMsgRecord(Msg);
#endif

#ifdef DEBUG1
      QueueRemoveData(ServerActiveReqQueue, pReq);
#endif
    }

    if (pReq->hTokenHandle != NULL) {
      status = CloseHandle(pReq->hTokenHandle);
      ASSERT(status != NULL);
    }

    if (pReq->pSID != NULL) {
      AutoHeapFree(pReq->pSID);
    }

    if (pReq->Lock.DebugInfo) {
      DeleteCriticalSection(&pReq->Lock);
    }

    AutoHeapFree(pReq);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- ServerShutdownRequest\n"));
#endif
}

VOID SServiceRequests ( VOID )

Definition at line 432 of file FileRepServerProc.cpp.

                            {
    tSReq *pReq;

#ifdef DEBUG2
    TCHAR Msg[MSG_SIZE];
#endif

    DWORD dwNumberOfBytesTransferred;
    DWORD dwCompletionKey;
    OVERLAPPED *lpOverlapped;

    ActionType Action = Wait;

    while(TRUE) {

      //
      // Read data from file.
      //
      if (Action == Read) {

        EnterCriticalSection(&pReq->Lock);

        ASSERT(!pReq->bBuf);
        ASSERT(!pReq->bReadOutstanding);

        // We did not read anything yet.
        pReq->cbRead = 0;

        pReq->bReadOutstanding = TRUE;

#ifdef DEBUG2
        _stprintf(Msg, TEXT("THREAD %d: SServiceRequests: reading file for req %p\n"), GetCurrentThreadId(), pReq);
        DbgMsgRecord(Msg);
#endif

        if(!ReadFile(pReq->hLocalFile, pReq->pbReadBuf, PUSH_BUFSIZE, &pReq->cbRead, &pReq->FileOl)) {
          if (GetLastError() != ERROR_IO_PENDING) {
            AddToMessageLogProcFailure(TEXT("HandleActiveSReq: WriteFile"), GetLastError());
            pReq->Status = GetLastError();

            LeaveCriticalSection(&pReq->Lock);

            ServerShutdownRequest(pReq);

            Action = Wait;
          }
        }

        Action = Wait;

        LeaveCriticalSection(&pReq->Lock);
      }

      //
      // Push the data to the client.
      //
      else if (Action == Push) {

        EnterCriticalSection(&pReq->Lock);

#ifdef DEBUG2
        _stprintf(Msg, TEXT("THREAD %d: SServiceRequests: pushing a buffer for req %p\n"), GetCurrentThreadId(), pReq);
        DbgMsgRecord(Msg);
#endif

        // Doing a regular Push for the data read from the file.
        if (!pReq->bNullPush) {
          ASSERT(!pReq->bReadOutstanding);
          ASSERT(!pReq->bPushOutstanding);
          ASSERT(pReq->bBuf);

          pReq->bPushOutstanding = TRUE;

          pReq->Status = ((WINAPI_MY_PIPE_PUSH) pReq->OutPipe->push)(pReq->OutPipe->state, (char *)pReq->pbReadBuf, pReq->cbRead);

          pReq->bBuf = FALSE;

          if(pReq->Status != RPC_S_OK) {
            pReq->bReadsDone = TRUE;
            pReq->bPushOutstanding = FALSE;
            pReq->fCallInvalidated = TRUE;

            if (pReq->bReadOutstanding == FALSE) {
              LeaveCriticalSection(&pReq->Lock);
              ServerShutdownRequest(pReq);

              Action = Wait;
            }
            else
              LeaveCriticalSection(&pReq->Lock);
          }
          else {

            if (!pReq->bReadsDone)
              Action = Read;
            else {
              Action = Wait;
              pReq->bLastDataPushIssued = TRUE;
            }

            LeaveCriticalSection(&pReq->Lock);
          }
        }

        // Doing a "NULL" push to signal the end of the pipe out-stream.
        else {
          ASSERT(!pReq->bReadOutstanding);
          ASSERT(!pReq->bPushOutstanding);
          ASSERT(!pReq->bBuf);

          pReq->bPushOutstanding = TRUE;

          WINAPI_MY_PIPE_PUSH pPush = (WINAPI_MY_PIPE_PUSH) pReq->OutPipe->push;

          pReq->Status = pPush(pReq->OutPipe->state, NULL, 0);

          if(pReq->Status != RPC_S_OK) {
            pReq->fCallInvalidated = TRUE;
            LeaveCriticalSection(&pReq->Lock);
            ServerShutdownRequest(pReq);

            Action = Wait;
            }
          else {
            Action = Wait;
            LeaveCriticalSection(&pReq->Lock);
          }
        }
      }

      //
      // Wait on the completion port.
      //
      else if (Action == Wait) {

        InterlockedIncrement(&nThreadsAtServerCompletionPort);

        ASSERT(nThreadsAtServerCompletionPort >= 0);

#ifdef DEBUG2
        _stprintf(Msg, TEXT("THREAD %d: SServiceRequests: waiting on a completion port\n"), GetCurrentThreadId());
        DbgMsgRecord(Msg);
#endif

        if (!GetQueuedCompletionStatus(ServerCompletionPort,
                                       &dwNumberOfBytesTransferred,
                                       (PULONG_PTR)&dwCompletionKey,
                                       &lpOverlapped,
                                       ServerCompletionPortTimeout)) {

          LONG nThreads = InterlockedDecrement(&nThreadsAtServerCompletionPort);

          if (GetLastError() == WAIT_TIMEOUT) {

#ifdef DEBUG2
            _stprintf(Msg, TEXT("THREAD %d: SServiceRequests: timed out waiting on a completion port\n"), GetCurrentThreadId());
            DbgMsgRecord(Msg);
#endif

            if (nThreads != 0) {
              return;
            }
            else {
              continue;
            }
          }
          else {
            AddToMessageLogProcFailure(TEXT("SServiceRequests: GetQueuedCompletionStatus"), GetLastError());

            Action = Wait;
          }
        }

        else {

          // If this is the last thread to come off a completion port,
          // spin up an extra worker thread.
          if (InterlockedDecrement(&nThreadsAtServerCompletionPort) == 0) {
            HANDLE hThread;
            ULONG ThreadIdentifier;
            DWORD status;

            if ((hThread = CreateThread(NULL,
                                        0,
                                        (LPTHREAD_START_ROUTINE) SServiceRequests,
                                        NULL,
                                        0,
                                        &ThreadIdentifier)) == NULL) {

              // If creating a thread fails there is really nothing that we
              // we can do.  Just continue.
              AddToMessageLogProcFailure(TEXT("SServiceRequests: CreateThread"), GetLastError());
            }
            else {
              // Unless we close a handle to the thread, it will remain in the
              // system even after its execution has terminated.
              status = CloseHandle(hThread);
              ASSERT(status != 0);
            }
          }

          ASSERT(nThreadsAtServerCompletionPort >= 0);

          //
          // Received file IO completion.
          //
          if (dwCompletionKey == IoFile) {

            pReq = (SReq *) ((size_t)lpOverlapped - offsetof(SReq, FileOl));

#ifdef DEBUG2
            _stprintf(Msg, TEXT("THREAD %d: SServiceRequests: completed File IO for req %p\n"), GetCurrentThreadId(), pReq);
            DbgMsgRecord(Msg);
#endif

            EnterCriticalSection(&pReq->Lock);

            pReq->cbRead = dwNumberOfBytesTransferred;

            ASSERT(pReq->bReadOutstanding);
            ASSERT(!pReq->bBuf);

            pReq->bReadOutstanding = FALSE;
            pReq->bBuf = TRUE;

            ASSERT(!pReq->bLastDataPushIssued);

            if(pReq->Status != RPC_S_OK) {
              LeaveCriticalSection(&pReq->Lock);
              ServerShutdownRequest(pReq);

              Action = Wait;
            }
            else {

              // If we read less then we asked, then EOF has been reached.
              if (pReq->cbRead != PUSH_BUFSIZE) {

                pReq->bReadsDone = TRUE;

                // If we read 0 bytes, then the previous data push has been
                // the last one.  So the last data push has already been issued.
                if (pReq->cbRead == 0) {
                  pReq->bLastDataPushIssued = TRUE;

                  // If there are no outstanding pushes, we can do a NULL push.
                  if (pReq->bPushOutstanding == FALSE) {
                    pReq->bNullPush = TRUE;
                  }
                }
              }

              pReq->FileOl.Offset += pReq->cbRead;

              // We have at most one outstanding push, since RPC runtime
              // guarantees proper notification if there are no more then
              // one push outstanding.
              if (pReq->bPushOutstanding == TRUE)
                Action = Wait;
              else
                Action = Push;

              LeaveCriticalSection(&pReq->Lock);
            }

          }

          //
          // Received pipe IO completion.
          //
          else if(dwCompletionKey == IoPipe) {

#ifdef DEBUG2
            _stprintf(Msg, TEXT("THREAD %d: SServiceRequests: completed Pipe IO for req %p\n"), GetCurrentThreadId(), pReq);
            DbgMsgRecord(Msg);
#endif

            pReq = (SReq *) lpOverlapped;

            EnterCriticalSection(&pReq->Lock);

            if (pReq->Async->Event != RpcSendComplete) {
              ASSERT(0);
            }

            ASSERT(pReq->bPushOutstanding);

            pReq->bPushOutstanding = FALSE;

            // The completion of the NULL push terminates the request.
            // The reuest is now handled.
            if (pReq->bNullPush) {
              LeaveCriticalSection(&pReq->Lock);
              ServerShutdownRequest(pReq);

              Action = Wait;
            }

            // This is a regular data push.
            else {

              // If there is a read outstanding, wait for it to complete
              // since we do not have any other data to push at present.
              if (pReq->bReadOutstanding)
                Action = Wait;

              // If there is a buffer to send, push it.
              else if (pReq->bBuf)
                Action = Push;

              // If the this is the completion of the last data push, then
              // we just need to do the NULL push.
              else if (pReq->bLastDataPushIssued) {
                Action = Push;
                pReq->bNullPush = TRUE;
              }

              else {
                /*ASSERT(0);*/Action = Wait;
              }

              LeaveCriticalSection(&pReq->Lock);
            }

          }

          //
          // Received an internal FileRep IO completion.
          //
          else if(dwCompletionKey == IoFileRep) {
            pReq = (SReq *) lpOverlapped;

#ifdef DEBUG2
            _stprintf(Msg, TEXT("THREAD %d: SServiceRequests: completed FileRep internal IO for req %p\n"), GetCurrentThreadId(), pReq);
            DbgMsgRecord(Msg);
#endif

            // This is a signal to handle a new request.
            // If the request can be activated, then handle it.
            if(HandleSReq(pReq)) {
              Action = Read;
            }
            // Otherwise, do event.
            else {
              Action = Wait;
            }
          }

          else {
            ASSERT(0);
          }
        }
      }

      else {
        ASSERT(0);
      }
    }
}

Variable Documentation

LONG nThreadsAtServerCompletionPort

Definition at line 147 of file Service.cpp.

HANDLE ServerCompletionPort

Definition at line 144 of file Service.cpp.

Generated on Wed Nov 13 2024 16:53:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/FileRepAsyncPipe/FileRepService.cpp File Reference

  • NetDS
  • RPC
  • FileRep
  • FileRepAsyncPipe
Defines | Functions

FileRepService.cpp File Reference

#include "common.h"
#include <stdio.h>
#include <stdlib.h>
#include <process.h>
#include <tchar.h>
#include <rpc.h>
#include <Ntdsapi.h>
#include <Ntsecapi.h>
#include <Security.h>
#include <Secext.h>
#include <Dsgetdc.h>
#include <Lm.h>
#include "FileRepServer.h"
#include "FileRepClient.h"
#include "Service.h"

Go to the source code of this file.

Defines

#define | SECURITY_WIN32

Functions

VOID _cdecl | main (int argc, char **argv)
VOID WINAPI | ServiceCtrl (DWORD Opcode)
VOID WINAPI | ServiceMain (DWORD dwArgc, LPTSTR *lpszArgv)
VOID | ServiceStart (DWORD dwArgc, LPTSTR *lpszArgv)
VOID | ServiceStop ()
VOID | ServiceStop (VOID)

Define Documentation

#define SECURITY_WIN32

Definition at line 30 of file FileRepService.cpp.

Function Documentation

VOID _cdecl main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 88 of file FileRepService.cpp.

                                       {

    // Since we provide a single service there is only
    // one entry in the service dispatch table
    SERVICE_TABLE_ENTRY DispatchTable[] = {
        { SERVICENAME, (LPSERVICE_MAIN_FUNCTION)ServiceMain },
        { NULL, NULL }
    };

    // The service control manager may be starting the service with
    // this call, so we must call StartServiceCtrlDispatcher.
    if (!StartServiceCtrlDispatcher(DispatchTable)) {
        AddToMessageLog(TEXT("StartServiceCtrlDispatcher failed"));
    }
}

VOID WINAPI ServiceCtrl ( DWORD Opcode )

Definition at line 162 of file FileRepService.cpp.

                                      {

    // We only handle the STOP control requsts.
    switch(Opcode) {

        case SERVICE_CONTROL_STOP:
            // Stop the service.
            ServiceStop();
            break;

        default:
            AddToMessageLog(TEXT("ServiceCtrl: unrecognized or unimplemented opcode\n"));
    }

    return;
}

VOID WINAPI ServiceMain | ( | DWORD | dwArgc,
 |  | LPTSTR * | lpszArgv
 | ) |  |

Definition at line 122 of file FileRepService.cpp.

                                                        {

    // Initial service configuration
    ssStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
    ssStatus.dwCurrentState = SERVICE_START_PENDING;
    ssStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP;
    ssStatus.dwWin32ExitCode = 0;
    ssStatus.dwServiceSpecificExitCode = 0;
    ssStatus.dwCheckPoint = 0;
    ssStatus.dwWaitHint = 0;

    sshStatusHandle = RegisterServiceCtrlHandler(SERVICENAME, ServiceCtrl);

    // Tell the SCM that the service is starting up.
    if (!SetServiceStatus(sshStatusHandle, &ssStatus)) {
        AddToMessageLog(TEXT("ServiceMain: SetServiceStatus failed\n"));
        return;
    }

    // Initialize the service and start it.
    ServiceStart(dwArgc, lpszArgv);

    return;
}

VOID ServiceStart | ( | DWORD | dwArgc,
 |  | LPTSTR * | lpszArgv
 | ) |  |

Definition at line 195 of file FileRepService.cpp.

                                                   {
  RPC_STATUS status;

    // Report the status to the service control manager.
    if (!ReportStatusToSCMgr(&sshStatusHandle, &ssStatus, SERVICE_START_PENDING, NO_ERROR, 1000)) {
        AddToMessageLog(TEXT("ServiceStart: ReportStatusToSCMgr failed\n"));
        ServiceStop();
        return;
    }

    // Allow the user to override settings with command line switches.
    for (unsigned i = 1; i < dwArgc; i++) {
        // Well-formed argument switches start with '/' or '-' and are
        // two characters long.
        if (((*szArgList[i] == TEXT('-')) || (*szArgList[i] == TEXT('/'))) && _tcsclen(szArgList[i]) == 2) {

            switch (_totlower(*(szArgList[i]+1))) {

                case TEXT('f'):
      bNoFileIO = true;
      break;

                default:
      AddToMessageLog(TEXT("ServiceStart: bad arguments"));
      ServiceStop();
      return;
            }
        }
        else {
    AddToMessageLog(TEXT("ServiceStart: bad arguments"));
    ServiceStop();
    return;
        }
    }

    if (!StartFileRepServer()) {
      ServiceStop();
    }
    else {
      bServerListening = TRUE;

      // Tell The SCM that the service is running.
      if (!ReportStatusToSCMgr(&sshStatusHandle, &ssStatus, SERVICE_RUNNING, NO_ERROR, 0)){
        AddToMessageLog(TEXT("ServiceStart: ReportStatusToSCMgr failed"));
        ServiceStop();
        return;
      }

      // RpcMgmtWaitServerListen() will block until the server has
      // stopped listening.
      status = RpcMgmtWaitServerListen();
      if (status != RPC_S_OK){
        AddToMessageLogProcFailureEEInfo(TEXT("ServiceStart: RpcMgmtWaitServerListen"), status);
        ServiceStop();
        return;
      }
    }

    return;
}

VOID ServiceStop ( )

Definition at line 610 of file filerepservice.cpp.

                   {
    RPC_STATUS status;

    // Stops the server, wakes up the main thread.
    if (bServerListening) {
        status = RpcMgmtStopServerListening(NULL);
        if(status != RPC_S_OK) {
                    AddToMessageLogProcFailureEEInfo(TEXT("ServiceStart: RpcMgmtWaitServerListen"), status);
        }
        bServerListening = FALSE;
    }

    // Delete the binding vector.
    status = RpcServerUnregisterIf(NULL, NULL, FALSE);
    if(status != RPC_S_OK){
        AddToMessageLogProcFailureEEInfo(TEXT("ServiceStart: RpcServerUnregisterIf"), status);
    }

    // Tell The SCM that the service is stopped.
    if(!ReportStatusToSCMgr(&sshStatusHandle, &ssStatus, SERVICE_STOPPED, NO_ERROR, 0)) {
        AddToMessageLogProcFailure(TEXT("ServiceStop: ReportStatusToSCMgr"), GetLastError());
    }

    // Wait for the client threads to finish so
    // that we do not deallocate active data structures.
    // We can accomplish this by waiting for the counters
    // to become zero.  Performing a check in this
    // order should prevent race conditions, since
    // pClientActiveReqCounters are incremented before
    // pClientReqCounters are decremented.
    if (fServerReqCountersCreated) {
        if (CountersCheckForNonzero(pServerReqCounters, NumPriGroups)) {
            Sleep(1000);
        }
    }
    if (fClientReqCountersCreated) {
        if (CountersCheckForNonzero(pClientReqCounters, NumPriGroups)) {
            Sleep(1000);
        }
    }
    if (fClientActiveReqCountersCreated) {
        if (CountersCheckForNonzero(pClientActiveReqCounters, NumPriGroups)) {
            Sleep(1000);
        }
    }

    DeleteWellKnownSids();

    // Delete queues and counters.
    if (fServerReqCountersCreated) {
        CountersDelete(pServerReqCounters, NumPriGroups);
        fServerReqCountersCreated = FALSE;
    }
    if (fClientReqCountersCreated) {
        CountersDelete(pClientReqCounters, NumPriGroups);
        fClientReqCountersCreated = FALSE;
    }
    if (fClientActiveReqCountersCreated) {
        CountersDelete(pClientActiveReqCounters, NumPriGroups);
        fClientActiveReqCountersCreated = FALSE;
    }
    if (fClientReqQueuesCreated) {
        QueuesDelete(ClientReqQueues, NumPriGroups);
        fClientReqQueuesCreated = FALSE;
    }
    if (fClientActiveReqHashQueuesCreated) {
        QueuesDelete(ClientActiveReqHashQueues, NumPriGroups);
        fClientActiveReqHashQueuesCreated = FALSE;
    }
    if (fClientActiveReqHashCountersCreated) {
        QueuesDelete(ClientActiveReqHashCounters, NumPriGroups);
        fClientActiveReqHashCountersCreated = FALSE;
    }

#ifdef PROF
    if (fProfOpenedLog) {
        ProfCloseLog();
        fProfOpenedLog = FALSE;
    }
#endif

#ifdef DEBUG
    if (fDbgMsgOpenedLog) {
        DbgMsgCloseLog();
        fDbgMsgOpenedLog = FALSE;
    }
#endif

}

VOID ServiceStop ( VOID )

Definition at line 257 of file FileRepService.cpp.

                       {
  ServerStop();
}

Generated on Wed Nov 13 2024 16:53:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/FileRepAsyncPipe/Prof.cpp File Reference

  • NetDS
  • RPC
  • FileRep
  • FileRepAsyncPipe
Defines | Functions | Variables

Prof.cpp File Reference

#include "common.h"
#include <process.h>
#include "Prof.h"
#include "Service.h"

Go to the source code of this file.

Defines

#define | MAX_ENTRY_SIZE_NOMSG (32)

Functions

VOID | ProfCloseLog (VOID)
VOID | ProfOpenLog (LPTSTR LogFileName)
VOID | ProfRecordTime (UINT id, LPTSTR msg)

Variables

HANDLE | hProfLog = NULL
LARGE_INTEGER | lpCurrentTime
LARGE_INTEGER | lpFrequency
LARGE_INTEGER | lpStartTime
UINT | nProfLogSize = 0
TCHAR | PROF_LOG [PROF_LOG_MAX_SIZE]
CRITICAL_SECTION | ProfCriticalSection

Define Documentation

#define MAX_ENTRY_SIZE_NOMSG (32)

Definition at line 47 of file Prof.cpp.

Function Documentation

VOID ProfCloseLog ( VOID )

Definition at line 108 of file Prof.cpp.

                        {
    ULONG cbWritten;
    DWORD status;

    // Delete the critsec.
    // Here we make the assumption that no outside functions will use
    // the critsec anymore.  This should be valid, since all the profiling data
    // has been written.
    // Also we make an assumption that only one thread will attempt
    // to close the profile log.  This should be valid as well, or the
    // user can inmplement a semaphore to take care of that.
    DeleteCriticalSection(&ProfCriticalSection);

    // Write out the profile log.
    if(!WriteFile(hProfLog,
                  (LPVOID)PROF_LOG,
                  nProfLogSize*sizeof(TCHAR),
                  &cbWritten,
                  NULL)) {

        AddToMessageLogProcFailure(TEXT("ProfCloseLog: WriteFile"), GetLastError());
        return;
    }

    // Close the profile log.
    if (hProfLog != NULL && hProfLog != INVALID_HANDLE_VALUE) {
        status = CloseHandle(hProfLog);
        ASSERT(status);
    }
}

VOID ProfOpenLog ( LPTSTR LogFileName )

Definition at line 51 of file Prof.cpp.

                                     {

    // Init the critsec.
    if (InitializeCriticalSectionAndSpinCount(&ProfCriticalSection, 0) == 0) {
        AddToMessageLogProcFailure(TEXT("ProfOpenLog: InitializeCriticalSectionAndSpinCount"), GetLastError());
        return;
    }

    // Open the profiling log.
    if ((hProfLog = CreateFile(LogFileName,
                               GENERIC_WRITE,
                               0,
                               NULL,
                               CREATE_ALWAYS,
                               FILE_ATTRIBUTE_NORMAL,
                               NULL)) == INVALID_HANDLE_VALUE) {
        AddToMessageLogProcFailure(TEXT("ProfOpenLog: CreateFile"), GetLastError());
        return;
    }

    // Get the current time.
    if (QueryPerformanceCounter(&lpStartTime) == FALSE) {
        AddToMessageLogProcFailure(TEXT("ProfOpenLog: QueryPerformanceCounter"), GetLastError());
        return;
    }

    // Get the frequency.
    if (QueryPerformanceFrequency(&lpFrequency) == FALSE) {
        AddToMessageLogProcFailure(TEXT("ProfOpenLog: QueryPerformanceCounter"), GetLastError());
        return;
    }
}

VOID ProfRecordTime | ( | UINT | id,
 |  | LPTSTR | msg
 | ) |  |

Definition at line 84 of file Prof.cpp.

                                         {
    FLOAT dt;

    EnterCriticalSection(&ProfCriticalSection);

    // Write the entry only if there is enough space left in
    // the log.
    if (nProfLogSize < PROF_LOG_MAX_SIZE - (MAX_ENTRY_SIZE_NOMSG + _tcslen(msg))) {
        if (QueryPerformanceCounter(&lpCurrentTime) == FALSE) {
            AddToMessageLogProcFailure(TEXT("ProfRecordTime: QueryPerformanceCounter"), GetLastError());
            LeaveCriticalSection(&ProfCriticalSection);
            return;
        }

        // Get the time stamp for the event.
        dt = (FLOAT)(lpCurrentTime.QuadPart - lpStartTime.QuadPart)/(FLOAT)(lpFrequency.QuadPart);

        // Append the entry to the log.
        nProfLogSize+=_stprintf(&PROF_LOG[nProfLogSize], TEXT("%d %s %f\n"), id, msg, dt);
    }

    LeaveCriticalSection(&ProfCriticalSection);
}

Variable Documentation

HANDLE hProfLog = NULL

Definition at line 31 of file Prof.cpp.

LARGE_INTEGER lpCurrentTime

Definition at line 34 of file Prof.cpp.

LARGE_INTEGER lpFrequency

Definition at line 34 of file Prof.cpp.

LARGE_INTEGER lpStartTime

Definition at line 34 of file Prof.cpp.

UINT nProfLogSize = 0

Definition at line 42 of file Prof.cpp.

TCHAR PROF_LOG[PROF_LOG_MAX_SIZE]

Definition at line 39 of file Prof.cpp.

CRITICAL_SECTION ProfCriticalSection

Definition at line 49 of file Prof.cpp.

Generated on Wed Nov 13 2024 16:53:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/FileRepAsyncPipe/Prof.h File Reference

  • NetDS
  • RPC
  • FileRep
  • FileRepAsyncPipe
Defines | Functions | Variables

Prof.h File Reference

Go to the source code of this file.

Defines

#define | PROF_LOG_MAX_SIZE (10*1024*1024)

Functions

VOID | ProfCloseLog (VOID)
VOID | ProfOpenLog (LPTSTR LogFileName)
VOID | ProfRecordTime (UINT id, LPTSTR msg)

Variables

CRITICAL_SECTION | ProfCriticalSection

Define Documentation

#define PROF_LOG_MAX_SIZE (10*1024*1024)

Definition at line 25 of file Prof.h.

Function Documentation

VOID ProfCloseLog ( VOID )

Definition at line 108 of file Prof.cpp.

                        {
    ULONG cbWritten;
    DWORD status;

    // Delete the critsec.
    // Here we make the assumption that no outside functions will use
    // the critsec anymore.  This should be valid, since all the profiling data
    // has been written.
    // Also we make an assumption that only one thread will attempt
    // to close the profile log.  This should be valid as well, or the
    // user can inmplement a semaphore to take care of that.
    DeleteCriticalSection(&ProfCriticalSection);

    // Write out the profile log.
    if(!WriteFile(hProfLog,
                  (LPVOID)PROF_LOG,
                  nProfLogSize*sizeof(TCHAR),
                  &cbWritten,
                  NULL)) {

        AddToMessageLogProcFailure(TEXT("ProfCloseLog: WriteFile"), GetLastError());
        return;
    }

    // Close the profile log.
    if (hProfLog != NULL && hProfLog != INVALID_HANDLE_VALUE) {
        status = CloseHandle(hProfLog);
        ASSERT(status);
    }
}

VOID ProfOpenLog ( LPTSTR LogFileName )

Definition at line 51 of file Prof.cpp.

                                     {

    // Init the critsec.
    if (InitializeCriticalSectionAndSpinCount(&ProfCriticalSection, 0) == 0) {
        AddToMessageLogProcFailure(TEXT("ProfOpenLog: InitializeCriticalSectionAndSpinCount"), GetLastError());
        return;
    }

    // Open the profiling log.
    if ((hProfLog = CreateFile(LogFileName,
                               GENERIC_WRITE,
                               0,
                               NULL,
                               CREATE_ALWAYS,
                               FILE_ATTRIBUTE_NORMAL,
                               NULL)) == INVALID_HANDLE_VALUE) {
        AddToMessageLogProcFailure(TEXT("ProfOpenLog: CreateFile"), GetLastError());
        return;
    }

    // Get the current time.
    if (QueryPerformanceCounter(&lpStartTime) == FALSE) {
        AddToMessageLogProcFailure(TEXT("ProfOpenLog: QueryPerformanceCounter"), GetLastError());
        return;
    }

    // Get the frequency.
    if (QueryPerformanceFrequency(&lpFrequency) == FALSE) {
        AddToMessageLogProcFailure(TEXT("ProfOpenLog: QueryPerformanceCounter"), GetLastError());
        return;
    }
}

VOID ProfRecordTime | ( | UINT | id,
 |  | LPTSTR | msg
 | ) |  |

Definition at line 84 of file Prof.cpp.

                                         {
    FLOAT dt;

    EnterCriticalSection(&ProfCriticalSection);

    // Write the entry only if there is enough space left in
    // the log.
    if (nProfLogSize < PROF_LOG_MAX_SIZE - (MAX_ENTRY_SIZE_NOMSG + _tcslen(msg))) {
        if (QueryPerformanceCounter(&lpCurrentTime) == FALSE) {
            AddToMessageLogProcFailure(TEXT("ProfRecordTime: QueryPerformanceCounter"), GetLastError());
            LeaveCriticalSection(&ProfCriticalSection);
            return;
        }

        // Get the time stamp for the event.
        dt = (FLOAT)(lpCurrentTime.QuadPart - lpStartTime.QuadPart)/(FLOAT)(lpFrequency.QuadPart);

        // Append the entry to the log.
        nProfLogSize+=_stprintf(&PROF_LOG[nProfLogSize], TEXT("%d %s %f\n"), id, msg, dt);
    }

    LeaveCriticalSection(&ProfCriticalSection);
}

Variable Documentation

CRITICAL_SECTION ProfCriticalSection

Definition at line 49 of file Prof.cpp.

Generated on Wed Nov 13 2024 16:53:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/FileRepAsyncPipe/Resources.cpp File Reference

  • NetDS
  • RPC
  • FileRep
  • FileRepAsyncPipe
Functions

Resources.cpp File Reference

#include "common.h"
#include "Resources.h"
#include "Service.h"

Go to the source code of this file.

Functions

Counter * | CounterCreate (UINT Bound)
VOID | CounterDecrement (Counter *pCounter)
VOID | CounterDelete (Counter *pCounter)
BOOL | CounterIncrement (Counter *pCounter)
BOOL | CountersCheckForNonzero (Counter *pCounters[], UINT n)
BOOL | CountersCreate (Counter *pCounters[], UINT n, UINT *Bounds)
VOID | CountersDelete (Counter *pCounters[], UINT n)
VOID | QueueAdd (Queue *pQueue, VOID *pData, BOOL EnterCritSec)
Queue * | QueueCreate (BOOL NoCritSec)
VOID | QueueDelete (Queue *pQueue)
VOID | QueueHashAdd (Queue *pQueue, PSID Sid, VOID *pValue, BOOL EnterCritSec)
VOID | QueueHashAddToSubqueue (Queue *pHashQueue, PSID pSID, VOID *pData)
VOID | QueueHashDecrementCounter (Queue *pHashQueue, PSID pSID)
BOOL | QueueHashIncrementCounter (Queue *pHashQueue, PSID pSID)
VOID * | QueueHashLookup (Queue *pQueue, PSID Sid, BOOL EnterCritSec)
VOID * | QueueHashRemoveFromSubqueue (Queue *pQueue)
BOOL | QueueIsEmpty (Queue *pQueue)
VOID | QueueMoveToBack (Queue *pQueue, QueueNode *pNode, QueueNode *pPrevNode)
VOID * | QueueRemove (Queue *pQueue)
VOID * | QueueRemoveData (Queue *pQueue, VOID *pData)
BOOL | QueuesCreate (Queue *Queues[], UINT n, BOOL NoCritSec)
VOID | QueuesDelete (Queue *Queues[], UINT n)

Function Documentation

Counter* CounterCreate ( UINT Bound )

Definition at line 22 of file Resources.cpp.

                                    {
    Counter * pCounter;

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> CounterCreate\n"));
#endif

    pCounter = (Counter *)AutoHeapAlloc(sizeof(Counter));

    if (pCounter == NULL) {
        return NULL;
    }

    pCounter->Value = 0;
    pCounter->Bound = Bound;

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- CounterCreate\n"));
#endif

    return pCounter;
}

VOID CounterDecrement ( Counter * pCounter )

Definition at line 85 of file Resources.cpp.

                                         {

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> CounterDecrement\n"));
#endif

    ASSERT(pCounter != NULL);

    InterlockedDecrement(&pCounter->Value);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- CounterDecrement\n"));
#endif

}

VOID CounterDelete ( Counter * pCounter )

Definition at line 45 of file Resources.cpp.

                                       {

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> CounterDelete\n"));
#endif

    ASSERT(pCounter != NULL);

    AutoHeapFree(pCounter);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- CounterDelete\n"));
#endif
}

BOOL CounterIncrement ( Counter * pCounter )

Definition at line 60 of file Resources.cpp.

                                         {
    BOOL ret = FALSE;

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> CounterIncrement\n"));
#endif

    ASSERT(pCounter != NULL);

    // Check for the bound.
    if (InterlockedIncrement(&pCounter->Value) > pCounter->Bound) {
        ret = FALSE;
        InterlockedDecrement(&pCounter->Value);
    }
    else {
        ret = TRUE;
    }

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- CounterIncrement\n"));
#endif

    return ret;
}

BOOL CountersCheckForNonzero | ( | Counter * | pCounters[],
 |  | UINT | n
 | ) |  |

Definition at line 141 of file Resources.cpp.

                                                           {
    for (UINT i=0; i<n; i++) {
        ASSERT(pCounters[i] != NULL);
        if (pCounters[i]->Value != 0) {
            return TRUE;
        }
    }
    return FALSE;
}

BOOL CountersCreate | ( | Counter * | pCounters[],
 |  | UINT | n,
 |  | UINT * | Bounds
 | ) |  |

Definition at line 101 of file Resources.cpp.

                                                                 {
    BOOL ret = FALSE;

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> CountersCreate\n"));
#endif

    for (UINT i=0; i<n; i++) {
        if ((pCounters[i] = CounterCreate(Bounds[i])) == NULL) {
            CountersDelete(pCounters, i-1);
            ret = FALSE;
            break;
        }
    }
    ret = TRUE;

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- CountersCreate\n"));
#endif

    return ret;
}

VOID CountersDelete | ( | Counter * | pCounters[],
 |  | UINT | n
 | ) |  |

Definition at line 124 of file Resources.cpp.

                                                  {

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> CountersDelete\n"));
#endif

    for (UINT i=0; i<n; i++) {
        ASSERT(pCounters[i] != NULL);
        CounterDelete(pCounters[i]);
        pCounters[i] = NULL;
    }

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- CountersDelete\n"));
#endif
}

VOID QueueAdd | ( | Queue * | pQueue,
 |  | VOID * | pData,
 |  | BOOL | EnterCritSec
 | ) |  |

Definition at line 232 of file Resources.cpp.

                                                             {

    ASSERT(pQueue != NULL);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> QueueAdd\n"));
#endif

    QueueNode * pNode = (QueueNode *) AutoHeapAlloc(sizeof(QueueNode));
    if (pNode == NULL) {
        AddToMessageLog(TEXT("QueueAdd: AutoHeapAlloc failed"));
        return;
    }

    pNode->pNext = NULL;
    pNode->pData = pData;

    if (pQueue->lpCriticalSection != NULL && EnterCritSec) EnterCriticalSection(pQueue->lpCriticalSection);

    if (pQueue->pFirst == NULL) {
        //ASSERT(pQueue->pLast == NULL);
        pQueue->pFirst = pNode;
        pQueue->pLast = pNode;
    }
    else {
        ASSERT(pQueue->pLast->pNext == NULL);
        pQueue->pLast->pNext = pNode;
        pQueue->pLast = pNode;
    }

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- QueueAdd\n"));
#endif

    if (pQueue->lpCriticalSection != NULL && EnterCritSec) LeaveCriticalSection(pQueue->lpCriticalSection);
}

Queue* QueueCreate ( BOOL NoCritSec )

Definition at line 151 of file Resources.cpp.

                                    {
    Queue * pQueue;

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> QueueCreate\n"));
#endif

    pQueue = (Queue *)AutoHeapAlloc(sizeof(Queue));

    if (pQueue == NULL) {
        AddToMessageLog(TEXT("QueueCreate: AutoHeapAlloc failed"));
        return NULL;
    }

    pQueue->pFirst = NULL;
    pQueue->pLast = NULL;

    if (NoCritSec) {
        pQueue->lpCriticalSection = NULL;
    }
    else {
        pQueue->lpCriticalSection = (LPCRITICAL_SECTION) AutoHeapAlloc(sizeof(CRITICAL_SECTION));
        if (InitializeCriticalSectionAndSpinCount(pQueue->lpCriticalSection, 100) == 0) {
            AddToMessageLogProcFailure(TEXT("QueueCreate: InitializeCriticalSectionAndSpinCount"), GetLastError());
            QueueDelete(pQueue);
            return NULL;
        }
    }

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- QueueCreate\n"));
#endif

    return pQueue;
}

VOID QueueDelete ( Queue * pQueue )

Definition at line 187 of file Resources.cpp.

                                 {
    QueueNode *pNextNode;

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> QueueDelete\n"));
#endif

    ASSERT(pQueue != NULL);

    if (pQueue->lpCriticalSection != NULL) {
        DeleteCriticalSection(pQueue->lpCriticalSection);
        AutoHeapFree(pQueue->lpCriticalSection);
    }

    if (pQueue->pFirst != NULL) {
        for (QueueNode *pNode = pQueue->pFirst; pNode != NULL; pNode = pNextNode) {
            pNextNode = pNode->pNext;
            AutoHeapFree(pNode->pData);
            AutoHeapFree(pNode);
        }
    }

    AutoHeapFree(pQueue);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- QueueDelete\n"));
#endif
}

VOID QueueHashAdd | ( | Queue * | pQueue,
 |  | PSID | Sid,
 |  | VOID * | pValue,
 |  | BOOL | EnterCritSec
 | ) |  |

Definition at line 434 of file Resources.cpp.

                                                                            {
    QueueHashNode *pQueueHashNode;
    DWORD SidLength;

    ASSERT(pQueue != NULL);

    if (pQueue->lpCriticalSection != NULL && EnterCritSec) EnterCriticalSection(pQueue->lpCriticalSection);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> QueueHashAdd\n"));
#endif

    pQueueHashNode = (QueueHashNode *) AutoHeapAlloc(sizeof(QueueHashNode));

    SidLength = GetLengthSid(Sid);

    // We need to copy the key so that if the original
    // copy gets deallocated we still have one.
    if ((pQueueHashNode->pKey = AutoHeapAlloc(SidLength)) == NULL) {
        AddToMessageLog(TEXT("QueueHashAdd: AutoHeapAlloc failed"));

        if (pQueue->lpCriticalSection != NULL && EnterCritSec) LeaveCriticalSection(pQueue->lpCriticalSection);
        return;
    }

    if (CopySid(SidLength, pQueueHashNode->pKey, Sid) == 0) {
        AddToMessageLogProcFailure(TEXT("QueueHashAdd: CopySid"), GetLastError());

        if (pQueue->lpCriticalSection != NULL && EnterCritSec) LeaveCriticalSection(pQueue->lpCriticalSection);
        return;
    }

    pQueueHashNode->pValue = pValue;

    QueueAdd(pQueue, (VOID *) pQueueHashNode, FALSE);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- QueueHashAdd\n"));
#endif

    if (pQueue->lpCriticalSection != NULL && EnterCritSec) LeaveCriticalSection(pQueue->lpCriticalSection);
}

VOID QueueHashAddToSubqueue | ( | Queue * | pHashQueue,
 |  | PSID | pSID,
 |  | VOID * | pData
 | ) |  |

Definition at line 508 of file Resources.cpp.

                                                                        {

    ASSERT(pHashQueue != NULL);

    if (pHashQueue->lpCriticalSection != NULL) EnterCriticalSection(pHashQueue->lpCriticalSection);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> QueueHashAddToSubqueue\n"));
#endif

    // Put the request onto the appropriate queue.

    // Lookup the subqueue for the user's sid.
    Queue * pQueue = (Queue *) QueueHashLookup(pHashQueue, pSID, FALSE);
    // If the subqueue does not exist, create it.
    if (pQueue == NULL) {
        if ((pQueue = QueueCreate(TRUE)) == NULL) {
            AddToMessageLog(TEXT("QueueHashAddToSubqueue: QueueCreate failed"));
            if (pHashQueue->lpCriticalSection != NULL) LeaveCriticalSection(pHashQueue->lpCriticalSection);
            return;
  }
        QueueHashAdd(pHashQueue, pSID, pQueue, FALSE);
    }
    // Add the request to the subqueue
    QueueAdd(pQueue, pData, FALSE);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- QueueHashAddToSubqueue\n"));
#endif

    if (pHashQueue->lpCriticalSection != NULL) LeaveCriticalSection(pHashQueue->lpCriticalSection);
}

VOID QueueHashDecrementCounter | ( | Queue * | pHashQueue,
 |  | PSID | pSID
 | ) |  |

Definition at line 637 of file Resources.cpp.

                                                             {
    Counter *pCounter;

    ASSERT(pHashQueue != NULL);

    if (pHashQueue->lpCriticalSection != NULL) EnterCriticalSection(pHashQueue->lpCriticalSection);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> QueueHashDecrementCounter\n"));
#endif

    // Put the counter onto the appropriate queue.
    // Lookup the counter for the user's sid.
    pCounter = (Counter *) QueueHashLookup(pHashQueue, pSID, FALSE);
    // If the counter does not exist, create it.
    if (pCounter == NULL) {
        if ((pCounter = CounterCreate(MaxUserReqs)) == NULL) {
            AddToMessageLog(TEXT("QueueHashIncrementCounter: CounterCreate failed"));
            if (pHashQueue->lpCriticalSection != NULL) LeaveCriticalSection(pHashQueue->lpCriticalSection);
            return;
        }
        QueueHashAdd(pHashQueue, pSID, pCounter, FALSE);
    }
    // Decrement the counter.
    CounterDecrement(pCounter);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- QueueHashDecrementCounter\n"));
#endif

    if (pHashQueue->lpCriticalSection != NULL) LeaveCriticalSection(pHashQueue->lpCriticalSection);
}

BOOL QueueHashIncrementCounter | ( | Queue * | pHashQueue,
 |  | PSID | pSID
 | ) |  |

Definition at line 601 of file Resources.cpp.

                                                             {
    Counter *pCounter;
    BOOL ret;

    ASSERT(pHashQueue != NULL);

    if (pHashQueue->lpCriticalSection != NULL) EnterCriticalSection(pHashQueue->lpCriticalSection);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> QueueHashIncrementCounter\n"));
#endif

    // Put the counter onto the appropriate queue.
    // Lookup the counter for the user's sid.
    pCounter = (Counter *) QueueHashLookup(pHashQueue, pSID, FALSE);
    // If the counter does not exist, create it.
    if (pCounter == NULL) {
        if ((pCounter = CounterCreate(MaxUserReqs)) == NULL) {
            AddToMessageLog(TEXT("QueueHashIncrementCounter: CounterCreate failed"));
            if (pHashQueue->lpCriticalSection != NULL) LeaveCriticalSection(pHashQueue->lpCriticalSection);
            return FALSE;
        }
        QueueHashAdd(pHashQueue, pSID, pCounter, FALSE);
    }
    // Attempt to increment the counter
    ret = CounterIncrement(pCounter);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- QueueHashIncrementCounter\n"));
#endif

    if (pHashQueue->lpCriticalSection != NULL) LeaveCriticalSection(pHashQueue->lpCriticalSection);

    return ret;
}

VOID* QueueHashLookup | ( | Queue * | pQueue,
 |  | PSID | Sid,
 |  | BOOL | EnterCritSec
 | ) |  |

Definition at line 477 of file Resources.cpp.

                                                                   {
    VOID * pValue;
    QueueNode *pNextNode;

    ASSERT(pQueue != NULL);

    if (pQueue->lpCriticalSection != NULL && EnterCritSec) EnterCriticalSection(pQueue->lpCriticalSection);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> QueueHashLookup\n"));
#endif

    pValue = NULL;

    for (QueueNode *pNode = pQueue->pFirst; pNode != NULL; pNode = pNextNode) {
        pNextNode = pNode->pNext;
        if (EqualSid(((QueueHashNode *)(pNode->pData))->pKey, Sid) == TRUE) {
            pValue = ((QueueHashNode *)(pNode->pData))->pValue;
            break;
        }
    }

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- QueueHashLookup\n"));
#endif

    if (pQueue->lpCriticalSection != NULL && EnterCritSec) LeaveCriticalSection(pQueue->lpCriticalSection);

    return pValue;
}

VOID* QueueHashRemoveFromSubqueue ( Queue * pQueue )

Definition at line 541 of file Resources.cpp.

                                                  {
    Queue * pSubQueue;
    QueueNode *pPrevNode;
    VOID * pData;

    ASSERT(pQueue != NULL);

    if (pQueue->lpCriticalSection != NULL) EnterCriticalSection(pQueue->lpCriticalSection);

    pSubQueue = NULL;

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> QueueHashRemoveFromSubqueue\n"));
#endif

    // If the hash queue is not empty.
    if (pQueue->pFirst != NULL) {
        // Find the first nonempty subqueue.
        pPrevNode = NULL;
        for (QueueNode *pNode = pQueue->pFirst; pNode != NULL; pNode = pNode->pNext) {

            // Check if it has elements in it.
            if (!QueueIsEmpty((Queue*) ((QueueHashNode *)pNode->pData)->pValue)) {
                // Select it.  We will extract an element off this subqueue
                // and put the subqueue into the end of the hash queue.
                pSubQueue = (Queue*) ((QueueHashNode *)pNode->pData)->pValue;

                // Take it off the hash queue and put it
                // on the back.
                QueueMoveToBack(pQueue, pNode, pPrevNode);

                break;
            }

            pPrevNode = pNode;
        }
        if (pSubQueue == NULL) {
            // We did not find any nonemoty subqueues.
            pData = NULL;
        }
    }
    else {
        // There are no nonempty subqueues.
        pData = NULL;
    }

    if (pSubQueue != NULL) {
        // Extract an element from the subqueue.
        pData = QueueRemove(pSubQueue);
    }

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- QueueHashRemoveFromSubqueue\n"));
#endif

    if (pQueue->lpCriticalSection != NULL) LeaveCriticalSection(pQueue->lpCriticalSection);

    return pData;
}

BOOL QueueIsEmpty ( Queue * pQueue )

Definition at line 216 of file Resources.cpp.

                                  {
    BOOL Ret = FALSE;

    ASSERT(pQueue != NULL);

    if (pQueue->lpCriticalSection != NULL) EnterCriticalSection(pQueue->lpCriticalSection);

    Ret = (pQueue->pFirst == NULL);

    ASSERT((!Ret) || (pQueue->pFirst == pQueue->pLast));

    if (pQueue->lpCriticalSection != NULL) LeaveCriticalSection(pQueue->lpCriticalSection);

    return Ret;
}

VOID QueueMoveToBack | ( | Queue * | pQueue,
 |  | QueueNode * | pNode,
 |  | QueueNode * | pPrevNode
 | ) |  |

Definition at line 357 of file Resources.cpp.

                                                                            {

    ASSERT(pQueue != NULL);
    ASSERT(pNode != NULL);

    if (pQueue->lpCriticalSection != NULL) EnterCriticalSection(pQueue->lpCriticalSection);

    // If it is the first element.
    if (pPrevNode == NULL) {
        pQueue->pFirst = pNode->pNext;
    }
    // If it has a predecessor in the queue
    else {
        pPrevNode->pNext = pNode->pNext;
    }

    // If it is the last element.
    if (pNode->pNext == NULL) {
        if (pQueue->lpCriticalSection != NULL) LeaveCriticalSection(pQueue->lpCriticalSection);
        return;
    }

    // Put the subqueue onto the back of the queue.
    pNode->pNext = NULL;
    if (QueueIsEmpty(pQueue)) {
        pQueue->pFirst = pNode;
        pQueue->pLast = pNode;
    }
    else {
        pQueue->pLast->pNext = pNode;
        pQueue->pLast = pNode;
    }

    if (pQueue->lpCriticalSection != NULL) LeaveCriticalSection(pQueue->lpCriticalSection);
}

VOID* QueueRemove ( Queue * pQueue )

Definition at line 269 of file Resources.cpp.

                                  {
    VOID * pData;
    QueueNode *pFuturepFirst;
    VOID * pToFree;

    ASSERT(pQueue != NULL);

    if (pQueue->lpCriticalSection != NULL) EnterCriticalSection(pQueue->lpCriticalSection);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> QueueRemove\n"));
#endif

    if (pQueue->pFirst == NULL) {
        ASSERT(pQueue->pFirst == pQueue->pLast);

        if (pQueue->lpCriticalSection != NULL) LeaveCriticalSection(pQueue->lpCriticalSection);
        return NULL;
    }

    pData = pQueue->pFirst->pData;
    pFuturepFirst = pQueue->pFirst->pNext;

    if (pFuturepFirst == NULL) {
        pQueue->pLast = NULL;
    }

    pToFree = pQueue->pFirst;
    pQueue->pFirst = pFuturepFirst;

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- QueueRemove\n"));
#endif

    if (pQueue->lpCriticalSection != NULL) LeaveCriticalSection(pQueue->lpCriticalSection);

    AutoHeapFree(pToFree);

    return pData;
}

VOID* QueueRemoveData | ( | Queue * | pQueue,
 |  | VOID * | pData
 | ) |  |

Definition at line 310 of file Resources.cpp.

                                                   {
    QueueNode *pFuturepFirst = NULL;
    VOID *pToFree = NULL;
    QueueNode *pNodeToFree = NULL;
    QueueNode *pPrevNode = NULL;

    ASSERT(pQueue != NULL);

    if (pQueue->lpCriticalSection != NULL) EnterCriticalSection(pQueue->lpCriticalSection);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> QueueRemoveData\n"));
#endif

    // Find a node to remove.
    // Walk the queue of active client requests
    for (QueueNode *pNode = pQueue->pFirst; pNode != NULL; pNode = pNode->pNext) {
        if (pNode->pData == pData) {
    // If this is not the first node
    if (pPrevNode) {
      pPrevNode->pNext = pNode->pNext;
      if (pQueue->pLast == pNode) {
        ASSERT(pNode->pNext == NULL);
        pQueue->pLast = pPrevNode;
      }
    }
    else {
      pQueue->pFirst = pNode->pNext;
    }
    pToFree = pNode;
    break;
        }

  pPrevNode = pNode;
    }

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- QueueRemoveData\n"));
#endif

    if (pQueue->lpCriticalSection != NULL) LeaveCriticalSection(pQueue->lpCriticalSection);

    AutoHeapFree(pToFree);

    return pData;
}

BOOL QueuesCreate | ( | Queue * | Queues[],
 |  | UINT | n,
 |  | BOOL | NoCritSec
 | ) |  |

Definition at line 393 of file Resources.cpp.

                                                           {
    BOOL ret = FALSE;

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> QueuesCreate\n"));
#endif

    for (UINT i=0; i<n; i++) {
        if ((Queues[i] = QueueCreate(NoCritSec)) == NULL) {
            QueuesDelete(Queues, i-1);
            ret = FALSE;
            break;
        }
    }

    ret = TRUE;

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- QueuesCreate\n"));
#endif

    return ret;
}

VOID QueuesDelete | ( | Queue * | Queues[],
 |  | UINT | n
 | ) |  |

Definition at line 417 of file Resources.cpp.

                                           {

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> QueuesDelete\n"));
#endif

    for (UINT i=0; i<n; i++) {
        QueueDelete(Queues[i]);
        Queues[i] = NULL;
    }

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- QueuesDelete\n"));
#endif

}

Generated on Wed Nov 13 2024 16:53:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/FileRepAsyncPipe/Resources.h File Reference

  • NetDS
  • RPC
  • FileRep
  • FileRepAsyncPipe
Classes | Typedefs | Functions

Resources.h File Reference

Go to the source code of this file.

Classes

struct | _QueueHashNode
struct | _QueueNode
struct | Counter
struct | Queue

Typedefs

typedef struct _QueueHashNode | QueueHashNode
typedef struct _QueueNode | QueueNode

Functions

Counter * | CounterCreate (UINT Bound)
VOID | CounterDecrement (Counter *pCounter)
VOID | CounterDelete (Counter *pCounter)
BOOL | CounterIncrement (Counter *pCounter)
BOOL | CountersCheckForNonzero (Counter *pCounters[], UINT n)
BOOL | CountersCreate (Counter *Counters[], UINT nCounters, UINT *Bounds)
VOID | CountersDelete (Counter *pCounters[], UINT n)
VOID | QueueAdd (Queue *pQueue, VOID *pData, BOOL EnterCritSec)
Queue * | QueueCreate (BOOL NoCritSec)
VOID | QueueDelete (Queue *pQueue)
VOID | QueueHashAdd (Queue *pQueue, PSID Sid, VOID *pValue, BOOL EnterCritSec)
VOID | QueueHashAddToSubqueue (Queue *pHashQueue, PSID pSID, VOID *pData)
VOID | QueueHashDecrementCounter (Queue *pQueue, PSID pSID)
BOOL | QueueHashIncrementCounter (Queue *pHashQueue, PSID pSID)
VOID * | QueueHashLookup (Queue *pQueue, PSID Sid, BOOL EnterCritSec)
VOID * | QueueHashRemoveFromSubqueue (Queue *pQueue)
BOOL | QueueIsEmpty (Queue *pQueue)
VOID | QueueMoveToBack (Queue *pQueue, QueueNode *pNode, QueueNode *pPrevNode)
VOID * | QueueRemove (Queue *pQueue)
VOID * | QueueRemoveData (Queue *pQueue, VOID *pData)
BOOL | QueuesCreate (Queue *Queues[], UINT n, BOOL NoCritSec)
VOID | QueuesDelete (Queue *Queues[], UINT n)

Typedef Documentation

typedef struct _QueueHashNode QueueHashNode
typedef struct _QueueNode QueueNode

Function Documentation

Counter* CounterCreate ( UINT Bound )

Definition at line 22 of file Resources.cpp.

                                    {
    Counter * pCounter;

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> CounterCreate\n"));
#endif

    pCounter = (Counter *)AutoHeapAlloc(sizeof(Counter));

    if (pCounter == NULL) {
        return NULL;
    }

    pCounter->Value = 0;
    pCounter->Bound = Bound;

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- CounterCreate\n"));
#endif

    return pCounter;
}

VOID CounterDecrement ( Counter * pCounter )

Definition at line 85 of file Resources.cpp.

                                         {

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> CounterDecrement\n"));
#endif

    ASSERT(pCounter != NULL);

    InterlockedDecrement(&pCounter->Value);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- CounterDecrement\n"));
#endif

}

VOID CounterDelete ( Counter * pCounter )

Definition at line 45 of file Resources.cpp.

                                       {

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> CounterDelete\n"));
#endif

    ASSERT(pCounter != NULL);

    AutoHeapFree(pCounter);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- CounterDelete\n"));
#endif
}

BOOL CounterIncrement ( Counter * pCounter )

Definition at line 60 of file Resources.cpp.

                                         {
    BOOL ret = FALSE;

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> CounterIncrement\n"));
#endif

    ASSERT(pCounter != NULL);

    // Check for the bound.
    if (InterlockedIncrement(&pCounter->Value) > pCounter->Bound) {
        ret = FALSE;
        InterlockedDecrement(&pCounter->Value);
    }
    else {
        ret = TRUE;
    }

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- CounterIncrement\n"));
#endif

    return ret;
}

BOOL CountersCheckForNonzero | ( | Counter * | pCounters[],
 |  | UINT | n
 | ) |  |

Definition at line 141 of file Resources.cpp.

                                                           {
    for (UINT i=0; i<n; i++) {
        ASSERT(pCounters[i] != NULL);
        if (pCounters[i]->Value != 0) {
            return TRUE;
        }
    }
    return FALSE;
}

BOOL CountersCreate | ( | Counter * | Counters[],
 |  | UINT | nCounters,
 |  | UINT * | Bounds
 | ) |  |

Definition at line 101 of file Resources.cpp.

                                                                 {
    BOOL ret = FALSE;

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> CountersCreate\n"));
#endif

    for (UINT i=0; i<n; i++) {
        if ((pCounters[i] = CounterCreate(Bounds[i])) == NULL) {
            CountersDelete(pCounters, i-1);
            ret = FALSE;
            break;
        }
    }
    ret = TRUE;

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- CountersCreate\n"));
#endif

    return ret;
}

VOID CountersDelete | ( | Counter * | pCounters[],
 |  | UINT | n
 | ) |  |

Definition at line 124 of file Resources.cpp.

                                                  {

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> CountersDelete\n"));
#endif

    for (UINT i=0; i<n; i++) {
        ASSERT(pCounters[i] != NULL);
        CounterDelete(pCounters[i]);
        pCounters[i] = NULL;
    }

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- CountersDelete\n"));
#endif
}

VOID QueueAdd | ( | Queue * | pQueue,
 |  | VOID * | pData,
 |  | BOOL | EnterCritSec
 | ) |  |

Definition at line 232 of file Resources.cpp.

                                                             {

    ASSERT(pQueue != NULL);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> QueueAdd\n"));
#endif

    QueueNode * pNode = (QueueNode *) AutoHeapAlloc(sizeof(QueueNode));
    if (pNode == NULL) {
        AddToMessageLog(TEXT("QueueAdd: AutoHeapAlloc failed"));
        return;
    }

    pNode->pNext = NULL;
    pNode->pData = pData;

    if (pQueue->lpCriticalSection != NULL && EnterCritSec) EnterCriticalSection(pQueue->lpCriticalSection);

    if (pQueue->pFirst == NULL) {
        //ASSERT(pQueue->pLast == NULL);
        pQueue->pFirst = pNode;
        pQueue->pLast = pNode;
    }
    else {
        ASSERT(pQueue->pLast->pNext == NULL);
        pQueue->pLast->pNext = pNode;
        pQueue->pLast = pNode;
    }

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- QueueAdd\n"));
#endif

    if (pQueue->lpCriticalSection != NULL && EnterCritSec) LeaveCriticalSection(pQueue->lpCriticalSection);
}

Queue* QueueCreate ( BOOL NoCritSec )

Definition at line 151 of file Resources.cpp.

                                    {
    Queue * pQueue;

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> QueueCreate\n"));
#endif

    pQueue = (Queue *)AutoHeapAlloc(sizeof(Queue));

    if (pQueue == NULL) {
        AddToMessageLog(TEXT("QueueCreate: AutoHeapAlloc failed"));
        return NULL;
    }

    pQueue->pFirst = NULL;
    pQueue->pLast = NULL;

    if (NoCritSec) {
        pQueue->lpCriticalSection = NULL;
    }
    else {
        pQueue->lpCriticalSection = (LPCRITICAL_SECTION) AutoHeapAlloc(sizeof(CRITICAL_SECTION));
        if (InitializeCriticalSectionAndSpinCount(pQueue->lpCriticalSection, 100) == 0) {
            AddToMessageLogProcFailure(TEXT("QueueCreate: InitializeCriticalSectionAndSpinCount"), GetLastError());
            QueueDelete(pQueue);
            return NULL;
        }
    }

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- QueueCreate\n"));
#endif

    return pQueue;
}

VOID QueueDelete ( Queue * pQueue )

Definition at line 187 of file Resources.cpp.

                                 {
    QueueNode *pNextNode;

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> QueueDelete\n"));
#endif

    ASSERT(pQueue != NULL);

    if (pQueue->lpCriticalSection != NULL) {
        DeleteCriticalSection(pQueue->lpCriticalSection);
        AutoHeapFree(pQueue->lpCriticalSection);
    }

    if (pQueue->pFirst != NULL) {
        for (QueueNode *pNode = pQueue->pFirst; pNode != NULL; pNode = pNextNode) {
            pNextNode = pNode->pNext;
            AutoHeapFree(pNode->pData);
            AutoHeapFree(pNode);
        }
    }

    AutoHeapFree(pQueue);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- QueueDelete\n"));
#endif
}

VOID QueueHashAdd | ( | Queue * | pQueue,
 |  | PSID | Sid,
 |  | VOID * | pValue,
 |  | BOOL | EnterCritSec
 | ) |  |

Definition at line 434 of file Resources.cpp.

                                                                            {
    QueueHashNode *pQueueHashNode;
    DWORD SidLength;

    ASSERT(pQueue != NULL);

    if (pQueue->lpCriticalSection != NULL && EnterCritSec) EnterCriticalSection(pQueue->lpCriticalSection);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> QueueHashAdd\n"));
#endif

    pQueueHashNode = (QueueHashNode *) AutoHeapAlloc(sizeof(QueueHashNode));

    SidLength = GetLengthSid(Sid);

    // We need to copy the key so that if the original
    // copy gets deallocated we still have one.
    if ((pQueueHashNode->pKey = AutoHeapAlloc(SidLength)) == NULL) {
        AddToMessageLog(TEXT("QueueHashAdd: AutoHeapAlloc failed"));

        if (pQueue->lpCriticalSection != NULL && EnterCritSec) LeaveCriticalSection(pQueue->lpCriticalSection);
        return;
    }

    if (CopySid(SidLength, pQueueHashNode->pKey, Sid) == 0) {
        AddToMessageLogProcFailure(TEXT("QueueHashAdd: CopySid"), GetLastError());

        if (pQueue->lpCriticalSection != NULL && EnterCritSec) LeaveCriticalSection(pQueue->lpCriticalSection);
        return;
    }

    pQueueHashNode->pValue = pValue;

    QueueAdd(pQueue, (VOID *) pQueueHashNode, FALSE);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- QueueHashAdd\n"));
#endif

    if (pQueue->lpCriticalSection != NULL && EnterCritSec) LeaveCriticalSection(pQueue->lpCriticalSection);
}

VOID QueueHashAddToSubqueue | ( | Queue * | pHashQueue,
 |  | PSID | pSID,
 |  | VOID * | pData
 | ) |  |

Definition at line 508 of file Resources.cpp.

                                                                        {

    ASSERT(pHashQueue != NULL);

    if (pHashQueue->lpCriticalSection != NULL) EnterCriticalSection(pHashQueue->lpCriticalSection);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> QueueHashAddToSubqueue\n"));
#endif

    // Put the request onto the appropriate queue.

    // Lookup the subqueue for the user's sid.
    Queue * pQueue = (Queue *) QueueHashLookup(pHashQueue, pSID, FALSE);
    // If the subqueue does not exist, create it.
    if (pQueue == NULL) {
        if ((pQueue = QueueCreate(TRUE)) == NULL) {
            AddToMessageLog(TEXT("QueueHashAddToSubqueue: QueueCreate failed"));
            if (pHashQueue->lpCriticalSection != NULL) LeaveCriticalSection(pHashQueue->lpCriticalSection);
            return;
  }
        QueueHashAdd(pHashQueue, pSID, pQueue, FALSE);
    }
    // Add the request to the subqueue
    QueueAdd(pQueue, pData, FALSE);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- QueueHashAddToSubqueue\n"));
#endif

    if (pHashQueue->lpCriticalSection != NULL) LeaveCriticalSection(pHashQueue->lpCriticalSection);
}

VOID QueueHashDecrementCounter | ( | Queue * | pQueue,
 |  | PSID | pSID
 | ) |  |

Definition at line 637 of file Resources.cpp.

                                                             {
    Counter *pCounter;

    ASSERT(pHashQueue != NULL);

    if (pHashQueue->lpCriticalSection != NULL) EnterCriticalSection(pHashQueue->lpCriticalSection);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> QueueHashDecrementCounter\n"));
#endif

    // Put the counter onto the appropriate queue.
    // Lookup the counter for the user's sid.
    pCounter = (Counter *) QueueHashLookup(pHashQueue, pSID, FALSE);
    // If the counter does not exist, create it.
    if (pCounter == NULL) {
        if ((pCounter = CounterCreate(MaxUserReqs)) == NULL) {
            AddToMessageLog(TEXT("QueueHashIncrementCounter: CounterCreate failed"));
            if (pHashQueue->lpCriticalSection != NULL) LeaveCriticalSection(pHashQueue->lpCriticalSection);
            return;
        }
        QueueHashAdd(pHashQueue, pSID, pCounter, FALSE);
    }
    // Decrement the counter.
    CounterDecrement(pCounter);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- QueueHashDecrementCounter\n"));
#endif

    if (pHashQueue->lpCriticalSection != NULL) LeaveCriticalSection(pHashQueue->lpCriticalSection);
}

BOOL QueueHashIncrementCounter | ( | Queue * | pHashQueue,
 |  | PSID | pSID
 | ) |  |

Definition at line 601 of file Resources.cpp.

                                                             {
    Counter *pCounter;
    BOOL ret;

    ASSERT(pHashQueue != NULL);

    if (pHashQueue->lpCriticalSection != NULL) EnterCriticalSection(pHashQueue->lpCriticalSection);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> QueueHashIncrementCounter\n"));
#endif

    // Put the counter onto the appropriate queue.
    // Lookup the counter for the user's sid.
    pCounter = (Counter *) QueueHashLookup(pHashQueue, pSID, FALSE);
    // If the counter does not exist, create it.
    if (pCounter == NULL) {
        if ((pCounter = CounterCreate(MaxUserReqs)) == NULL) {
            AddToMessageLog(TEXT("QueueHashIncrementCounter: CounterCreate failed"));
            if (pHashQueue->lpCriticalSection != NULL) LeaveCriticalSection(pHashQueue->lpCriticalSection);
            return FALSE;
        }
        QueueHashAdd(pHashQueue, pSID, pCounter, FALSE);
    }
    // Attempt to increment the counter
    ret = CounterIncrement(pCounter);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- QueueHashIncrementCounter\n"));
#endif

    if (pHashQueue->lpCriticalSection != NULL) LeaveCriticalSection(pHashQueue->lpCriticalSection);

    return ret;
}

VOID* QueueHashLookup | ( | Queue * | pQueue,
 |  | PSID | Sid,
 |  | BOOL | EnterCritSec
 | ) |  |

Definition at line 477 of file Resources.cpp.

                                                                   {
    VOID * pValue;
    QueueNode *pNextNode;

    ASSERT(pQueue != NULL);

    if (pQueue->lpCriticalSection != NULL && EnterCritSec) EnterCriticalSection(pQueue->lpCriticalSection);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> QueueHashLookup\n"));
#endif

    pValue = NULL;

    for (QueueNode *pNode = pQueue->pFirst; pNode != NULL; pNode = pNextNode) {
        pNextNode = pNode->pNext;
        if (EqualSid(((QueueHashNode *)(pNode->pData))->pKey, Sid) == TRUE) {
            pValue = ((QueueHashNode *)(pNode->pData))->pValue;
            break;
        }
    }

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- QueueHashLookup\n"));
#endif

    if (pQueue->lpCriticalSection != NULL && EnterCritSec) LeaveCriticalSection(pQueue->lpCriticalSection);

    return pValue;
}

VOID* QueueHashRemoveFromSubqueue ( Queue * pQueue )

Definition at line 541 of file Resources.cpp.

                                                  {
    Queue * pSubQueue;
    QueueNode *pPrevNode;
    VOID * pData;

    ASSERT(pQueue != NULL);

    if (pQueue->lpCriticalSection != NULL) EnterCriticalSection(pQueue->lpCriticalSection);

    pSubQueue = NULL;

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> QueueHashRemoveFromSubqueue\n"));
#endif

    // If the hash queue is not empty.
    if (pQueue->pFirst != NULL) {
        // Find the first nonempty subqueue.
        pPrevNode = NULL;
        for (QueueNode *pNode = pQueue->pFirst; pNode != NULL; pNode = pNode->pNext) {

            // Check if it has elements in it.
            if (!QueueIsEmpty((Queue*) ((QueueHashNode *)pNode->pData)->pValue)) {
                // Select it.  We will extract an element off this subqueue
                // and put the subqueue into the end of the hash queue.
                pSubQueue = (Queue*) ((QueueHashNode *)pNode->pData)->pValue;

                // Take it off the hash queue and put it
                // on the back.
                QueueMoveToBack(pQueue, pNode, pPrevNode);

                break;
            }

            pPrevNode = pNode;
        }
        if (pSubQueue == NULL) {
            // We did not find any nonemoty subqueues.
            pData = NULL;
        }
    }
    else {
        // There are no nonempty subqueues.
        pData = NULL;
    }

    if (pSubQueue != NULL) {
        // Extract an element from the subqueue.
        pData = QueueRemove(pSubQueue);
    }

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- QueueHashRemoveFromSubqueue\n"));
#endif

    if (pQueue->lpCriticalSection != NULL) LeaveCriticalSection(pQueue->lpCriticalSection);

    return pData;
}

BOOL QueueIsEmpty ( Queue * pQueue )

Definition at line 216 of file Resources.cpp.

                                  {
    BOOL Ret = FALSE;

    ASSERT(pQueue != NULL);

    if (pQueue->lpCriticalSection != NULL) EnterCriticalSection(pQueue->lpCriticalSection);

    Ret = (pQueue->pFirst == NULL);

    ASSERT((!Ret) || (pQueue->pFirst == pQueue->pLast));

    if (pQueue->lpCriticalSection != NULL) LeaveCriticalSection(pQueue->lpCriticalSection);

    return Ret;
}

VOID QueueMoveToBack | ( | Queue * | pQueue,
 |  | QueueNode * | pNode,
 |  | QueueNode * | pPrevNode
 | ) |  |

Definition at line 357 of file Resources.cpp.

                                                                            {

    ASSERT(pQueue != NULL);
    ASSERT(pNode != NULL);

    if (pQueue->lpCriticalSection != NULL) EnterCriticalSection(pQueue->lpCriticalSection);

    // If it is the first element.
    if (pPrevNode == NULL) {
        pQueue->pFirst = pNode->pNext;
    }
    // If it has a predecessor in the queue
    else {
        pPrevNode->pNext = pNode->pNext;
    }

    // If it is the last element.
    if (pNode->pNext == NULL) {
        if (pQueue->lpCriticalSection != NULL) LeaveCriticalSection(pQueue->lpCriticalSection);
        return;
    }

    // Put the subqueue onto the back of the queue.
    pNode->pNext = NULL;
    if (QueueIsEmpty(pQueue)) {
        pQueue->pFirst = pNode;
        pQueue->pLast = pNode;
    }
    else {
        pQueue->pLast->pNext = pNode;
        pQueue->pLast = pNode;
    }

    if (pQueue->lpCriticalSection != NULL) LeaveCriticalSection(pQueue->lpCriticalSection);
}

VOID* QueueRemove ( Queue * pQueue )

Definition at line 269 of file Resources.cpp.

                                  {
    VOID * pData;
    QueueNode *pFuturepFirst;
    VOID * pToFree;

    ASSERT(pQueue != NULL);

    if (pQueue->lpCriticalSection != NULL) EnterCriticalSection(pQueue->lpCriticalSection);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> QueueRemove\n"));
#endif

    if (pQueue->pFirst == NULL) {
        ASSERT(pQueue->pFirst == pQueue->pLast);

        if (pQueue->lpCriticalSection != NULL) LeaveCriticalSection(pQueue->lpCriticalSection);
        return NULL;
    }

    pData = pQueue->pFirst->pData;
    pFuturepFirst = pQueue->pFirst->pNext;

    if (pFuturepFirst == NULL) {
        pQueue->pLast = NULL;
    }

    pToFree = pQueue->pFirst;
    pQueue->pFirst = pFuturepFirst;

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- QueueRemove\n"));
#endif

    if (pQueue->lpCriticalSection != NULL) LeaveCriticalSection(pQueue->lpCriticalSection);

    AutoHeapFree(pToFree);

    return pData;
}

VOID* QueueRemoveData | ( | Queue * | pQueue,
 |  | VOID * | pData
 | ) |  |

Definition at line 310 of file Resources.cpp.

                                                   {
    QueueNode *pFuturepFirst = NULL;
    VOID *pToFree = NULL;
    QueueNode *pNodeToFree = NULL;
    QueueNode *pPrevNode = NULL;

    ASSERT(pQueue != NULL);

    if (pQueue->lpCriticalSection != NULL) EnterCriticalSection(pQueue->lpCriticalSection);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> QueueRemoveData\n"));
#endif

    // Find a node to remove.
    // Walk the queue of active client requests
    for (QueueNode *pNode = pQueue->pFirst; pNode != NULL; pNode = pNode->pNext) {
        if (pNode->pData == pData) {
    // If this is not the first node
    if (pPrevNode) {
      pPrevNode->pNext = pNode->pNext;
      if (pQueue->pLast == pNode) {
        ASSERT(pNode->pNext == NULL);
        pQueue->pLast = pPrevNode;
      }
    }
    else {
      pQueue->pFirst = pNode->pNext;
    }
    pToFree = pNode;
    break;
        }

  pPrevNode = pNode;
    }

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- QueueRemoveData\n"));
#endif

    if (pQueue->lpCriticalSection != NULL) LeaveCriticalSection(pQueue->lpCriticalSection);

    AutoHeapFree(pToFree);

    return pData;
}

BOOL QueuesCreate | ( | Queue * | Queues[],
 |  | UINT | n,
 |  | BOOL | NoCritSec
 | ) |  |

Definition at line 393 of file Resources.cpp.

                                                           {
    BOOL ret = FALSE;

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> QueuesCreate\n"));
#endif

    for (UINT i=0; i<n; i++) {
        if ((Queues[i] = QueueCreate(NoCritSec)) == NULL) {
            QueuesDelete(Queues, i-1);
            ret = FALSE;
            break;
        }
    }

    ret = TRUE;

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- QueuesCreate\n"));
#endif

    return ret;
}

VOID QueuesDelete | ( | Queue * | Queues[],
 |  | UINT | n
 | ) |  |

Definition at line 417 of file Resources.cpp.

                                           {

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> QueuesDelete\n"));
#endif

    for (UINT i=0; i<n; i++) {
        QueueDelete(Queues[i]);
        Queues[i] = NULL;
    }

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- QueuesDelete\n"));
#endif

}

Generated on Wed Nov 13 2024 16:53:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/FileRepAsyncPipe/Service.cpp File Reference

  • NetDS
  • RPC
  • FileRep
  • FileRepAsyncPipe
Defines | Functions | Variables

Service.cpp File Reference

#include "common.h"
#include <Ntdsapi.h>
#include <Ntsecapi.h>
#include <Security.h>
#include <Secext.h>
#include <Dsgetdc.h>
#include <Lm.h>
#include "FileRepServer.h"
#include "FileRepClient.h"
#include "Service.h"

Go to the source code of this file.

Defines

#define | SECURITY_WIN32

Functions

VOID | AddRpcEEInfo (DWORD Status, LPTSTR Msg)
VOID | AddRpcEEInfoAndRaiseException (DWORD Status, LPTSTR Msg)
VOID | AddToMessageLog (LPTSTR szMsg2)
VOID | AddToMessageLogProcFailure (LPTSTR ProcName, DWORD ErrCode)
VOID | AddToMessageLogProcFailureEEInfo (LPTSTR ProcName, DWORD ErrCode)
VOID | CreateWellKnownSids (VOID)
VOID | DeleteWellKnownSids (VOID)
UINT | GetCurrentUserPriority (VOID)
PTOKEN_GROUPS | GetUserGroups (VOID)
PSID GetUserSID ()
BOOL | IsGroupMember (PSID pSID, PTOKEN_GROUPS pGroupInfo)
VOID __RPC_FAR *__RPC_API | midl_user_allocate (size_t len)
VOID __RPC_API | midl_user_free (VOID __RPC_FAR *ptr)
BOOL | ReportStatusToSCMgr (SERVICE_STATUS_HANDLE *sshStatusHandle, SERVICE_STATUS *ssStatus, DWORD dwCurrentState, DWORD dwWin32ExitCode, DWORD dwWaitHint)
RPC_STATUS __stdcall | RpcServerIfCallback (IN void *Interface, IN void *Context)
VOID | ServerStop ()
BOOL | StartFileRepServer (VOID)

Variables

BOOL | bNoFileIO = FALSE
BOOL | bServerListening = FALSE
const UINT | ClientActiveReqBounds [] = {1, 5, 10}
Queue * ClientActiveReqHashCounters [NumPriGroups]
HANDLE ClientCompletionPort
const UINT | ClientReqBounds [] = {10, 20, 30}
Queue * ClientReqQueues [NumPriGroups]
ULONG | cMaxCallsExecute = 1000
ULONG | cMaxCallsListen = 1000
ULONG | cMinimumThreads = 2
BOOL | fClientActiveReqCountersCreated = FALSE
BOOL | fClientActiveReqHashCountersCreated = FALSE
BOOL | fClientReqCountersCreated = FALSE
BOOL | fClientReqQueuesCreated = FALSE
BOOL | fServerActiveReqCountersCreated = FALSE
BOOL | fServerActiveReqHashCountersCreated = FALSE
BOOL | fServerReqCountersCreated = FALSE
BOOL | fServerReqQueuesCreated = FALSE
const UINT | MaxUserReqs = 5
LONG | nThreadsAtClientCompletionPort
LONG | nThreadsAtServerCompletionPort
const UINT | NumPriGroups = 3
PSID | pAdminSID = NULL
PSID | pAnonSID = NULL
RPC_BINDING_VECTOR * | pBindingVector = NULL
Counter * pClientActiveReqCounters [NumPriGroups]
Counter * pClientReqCounters [NumPriGroups]
Counter * pServerActiveReqCounters [NumPriGroups]
Counter * pServerReqCounters [NumPriGroups]
PSID | pSystemSID = NULL
const UINT | RegUsersPri = 1
HANDLE RpcHeap
const UINT | ServerActiveReqBounds [] = {10, 50, 100}
Queue * ServerActiveReqHashCounters [NumPriGroups]
HANDLE ServerCompletionPort
LPTSTR ServerProtocolArray []
const UINT | ServerReqBounds [] = {10, 20, 30}
Queue * ServerReqQueues [NumPriGroups]
SERVICE_STATUS_HANDLE | sshStatusHandle
SERVICE_STATUS | ssStatus
RPC_STATUS | status

Define Documentation

#define SECURITY_WIN32

Definition at line 35 of file Service.cpp.

Function Documentation

VOID AddRpcEEInfo | ( | DWORD | Status,
 |  | LPTSTR | Msg
 | ) |  |

Definition at line 646 of file Service.cpp.

                                            {
    RPC_STATUS rpcstatus;

    RPC_EXTENDED_ERROR_INFO ErrorInfo;

    ErrorInfo.Version = RPC_EEINFO_VERSION;
    ErrorInfo.ComputerName = NULL;
    ErrorInfo.ProcessID = 0;
    ErrorInfo.GeneratingComponent = 0;
    ErrorInfo.Status = Status;
    ErrorInfo.DetectionLocation = 0;
    ErrorInfo.Flags = 0;
    ErrorInfo.NumberOfParameters = 1;
    ErrorInfo.Parameters[0].ParameterType = eeptUnicodeString;
    ErrorInfo.Parameters[0].u.UnicodeString = Msg;

    rpcstatus = RpcErrorAddRecord(&ErrorInfo);

    RpcRaiseException(Status);
}

VOID AddRpcEEInfoAndRaiseException | ( | DWORD | Status,
 |  | LPTSTR | Msg
 | ) |  |

Definition at line 667 of file Service.cpp.

                                                             {
    AddRpcEEInfo(Status, Msg);
    RpcRaiseException(Status);
}

VOID AddToMessageLog ( LPTSTR szMsg2 )

Definition at line 598 of file Service.cpp.

                                    {
    TCHAR szMsg1[256];
    HANDLE hEventSource;
    LPTSTR lpszStrings[2];
    DWORD dwErr = 0;

    dwErr = GetLastError();

    // Use event logging to log the error.
    hEventSource = RegisterEventSource(NULL, SERVICENAME);

    _stprintf(szMsg1, TEXT("%s error: %d"), SERVICENAME, dwErr);
    lpszStrings[0] = szMsg1;
    lpszStrings[1] = szMsg2;

    if (hEventSource != NULL) {
        ReportEvent(hEventSource, // handle of event source
                    EVENTLOG_ERROR_TYPE, // event type
                    0, // event category
                    0, // event ID
                    NULL, // current user's SID
                    2, // strings in lpszStrings
                    0, // no bytes of raw data
                    (LPCTSTR *) lpszStrings, // array of error strings
                    NULL); // no raw data

        (VOID) DeregisterEventSource(hEventSource);
    }
}

VOID AddToMessageLogProcFailure | ( | LPTSTR | ProcName,
 |  | DWORD | ErrCode
 | ) |  |

Definition at line 628 of file Service.cpp.

                                                                {
    TCHAR Msg[MSG_SIZE];
    _stprintf(Msg, TEXT("%s failed with code %d"), ProcName, ErrCode);
    AddToMessageLog(Msg);
}

VOID AddToMessageLogProcFailureEEInfo | ( | LPTSTR | ProcName,
 |  | DWORD | ErrCode
 | ) |  |

Definition at line 634 of file Service.cpp.

                                                                      {
    TCHAR Msg[MSG_SIZE];
    UINT MsgSize = 0;

    MsgSize += _stprintf(&Msg[MsgSize], TEXT("%s failed with code %d\n"), ProcName, ErrCode);
    GetEEInfoText(Msg, MSG_SIZE, &MsgSize);

    Msg[MsgSize] = 0;

    AddToMessageLog(Msg);
}

VOID CreateWellKnownSids ( VOID )

Definition at line 427 of file Service.cpp.

                               {
    SID_IDENTIFIER_AUTHORITY SIDAuth = SECURITY_NT_AUTHORITY;

    // Generate SID for the system if necessary.
    if (pSystemSID == NULL) {
        if (AllocateAndInitializeSid(&SIDAuth, 1,
                                     SECURITY_LOCAL_SYSTEM_RID,
                                     0, 0, 0, 0, 0, 0, 0,
                                     &pSystemSID) == 0) {
            AddToMessageLogProcFailure(TEXT("CreateWellKnownSids: AllocateAndInitializeSid"), GetLastError());
        }
    }

    // Generate SID for the admin group if necessary.
    if (pAdminSID == NULL) {
        if (AllocateAndInitializeSid(&SIDAuth, 1,
                                     DOMAIN_ALIAS_RID_ADMINS,
                                     0, 0, 0, 0, 0, 0, 0,
                                     &pAdminSID) == 0) {
            AddToMessageLogProcFailure(TEXT("CreateWellKnownSids: AllocateAndInitializeSid"), GetLastError());
        }
    }

    // Generate the anonymous SID if necessary.
    if (pAnonSID == NULL) {
        if (AllocateAndInitializeSid(&SIDAuth, 1,
                                     SECURITY_ANONYMOUS_LOGON_RID,
                                     0, 0, 0, 0, 0, 0, 0,
                                     &pAnonSID) == 0) {
            AddToMessageLogProcFailure(TEXT("CreateWellKnownSids: AllocateAndInitializeSid"), GetLastError());
        }
    }
}

VOID DeleteWellKnownSids ( VOID )

Definition at line 461 of file Service.cpp.

                               {
    AutoHeapFree(pSystemSID);
    pSystemSID = NULL;
    AutoHeapFree(pAdminSID);
    pAdminSID = NULL;
    AutoHeapFree(pAnonSID);
    pAnonSID = NULL;
}

UINT GetCurrentUserPriority ( VOID )

Definition at line 487 of file Service.cpp.

                                  {
    PSID pSID;
    PTOKEN_GROUPS pUserGroups;

    UINT Pri;

    // If well-known sids were not allocated, we can't work.
    if (pSystemSID == NULL || pAdminSID == NULL || pAnonSID == NULL) {
        return 0;
    }

    // The SID gets dynamically allocated inside GetUserSID(), so
    // we need to remember about that.
    if ((pSID = GetUserSID()) == NULL) {
        return 0;
    }

    if ((pUserGroups = GetUserGroups()) == NULL) {
        AutoHeapFree(pSID);
        return 0;
    }

    // Test if current SID is system SID or it
    // is a member of the administrator group.
    if (EqualSid(pSID, pSystemSID) || IsGroupMember(pAdminSID, pUserGroups)) {
        // Return system priority.
        Pri = 2;
    }
    // Test if current SID is anonyous SID.
    else if (EqualSid(pSID, pAnonSID)) {
        // Return anonymous priority.
        Pri = 0;
    }
    else {
        // We are left with the regular user priority.
        Pri = 1;
    }

    AutoHeapFree(pSID);
    AutoHeapFree(pUserGroups);
    return Pri;
}

PTOKEN_GROUPS GetUserGroups ( VOID )

Definition at line 328 of file Service.cpp.

                                  {
    DWORD dwSize;
    DWORD dwResult;
    HANDLE hToken;
    PTOKEN_GROUPS pGroupInfo = NULL;

#ifdef DEBUG2
    DbgMsgRecord(TEXT("->GetUserGroups\n"));
#endif

    // Open a handle to the access token for the calling thread.
    if (!OpenThreadToken(GetCurrentThread(), TOKEN_QUERY, TRUE, &hToken)) {
        AddToMessageLogProcFailure(TEXT("GetUserGroups: OpenProcessToken"), GetLastError());
        return NULL;
    }

    // Call GetTokenInformation to get the buffer size.
    dwSize = 0;
    if(GetTokenInformation(hToken, TokenGroups, NULL, dwSize, &dwSize) == 0) {
        dwResult = GetLastError();
        if(dwResult != ERROR_INSUFFICIENT_BUFFER ) {
            AddToMessageLogProcFailure(TEXT("GetUserGroups: GetTokenInformation"), dwResult);

            CloseHandle(hToken);
            return NULL;
        }
    }
    else {
        // We should have returned with an error above.
        ASSERT(TRUE);
    }

    // Allocate the buffer.
    if ((pGroupInfo = (PTOKEN_GROUPS) AutoHeapAlloc(dwSize)) == NULL) {
        AddToMessageLog(TEXT("GetUserGroups: AutoHeapAlloc failed"));

        CloseHandle(hToken);
        return NULL;
    }

    // Call GetTokenInformation again to get the group information.
    if(GetTokenInformation(hToken, TokenGroups, pGroupInfo, dwSize, &dwSize) == 0) {
        AddToMessageLogProcFailure(TEXT("GetUserGroups: GetTokenInformation"), GetLastError());

        AutoHeapFree(pGroupInfo);
        CloseHandle(hToken);
        return NULL;
    }

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<-GetUserGroups\n"));
#endif

    CloseHandle(hToken);
    return pGroupInfo;
}

PSID GetUserSID ( )

Definition at line 193 of file Service.cpp.

                  {
    SID_NAME_USE snuType;
    PSID pUserSID = NULL;
    DWORD cbUserSID = 0;

    LPTSTR szUserName = NULL;
    DWORD cbUserName = 0;

    LPTSTR szDomainName = NULL;
    DWORD cbDomainName = 0;

    BOOL fAPISuccess;

#ifdef DEBUG2
    TCHAR Msg[MSG_SIZE];

    DbgMsgRecord(TEXT("->GetUserSID\n"));
#endif

    // Get the logged on user name.  First we determine the size
    // of the buffer required and then get the username.

    // Get the size of the name.
    fAPISuccess = GetUserName(szUserName, &cbUserName);

    // API should have failed with insufficient buffer.
    ASSERT(!fAPISuccess);

    if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
        AddToMessageLogProcFailure(TEXT("GetUserSID: GetUserName"), GetLastError());
        return NULL;
    }

#ifdef DEBUG2
    _stprintf(Msg, TEXT("GetUserSID: cbUserName=%d\n"), cbUserName);
    DbgMsgRecord(Msg);
#endif

    // Allocate buffer for the name.
    szUserName = (LPTSTR) AutoHeapAlloc(cbUserName * sizeof(TCHAR));
    if (szUserName == NULL) {
        AddToMessageLog(TEXT("GetUserSID: AutoHeapAlloc failed"));
        return NULL;
    }

    // Finally get the name.
    fAPISuccess = GetUserName(szUserName, &cbUserName);
    if (!fAPISuccess) {
        AutoHeapFree(szUserName);
        AddToMessageLogProcFailure(TEXT("GetUserSID: GetUserName"), GetLastError());
        return NULL;
    }

#ifdef DEBUG2
    _stprintf(Msg, TEXT("GetUserSID: UserName=%s cbUserName=%d\n"), szUserName, cbUserName),
    DbgMsgRecord(Msg);
#endif

    // Do the same for SID.  First get the size and then allocate the buffer
    // and perform the actual call.
    fAPISuccess = LookupAccountName(NULL, szUserName,
                                    pUserSID, &cbUserSID, szDomainName, &cbDomainName, &snuType);

    // API should have failed with insufficient buffer.
    ASSERT(!fAPISuccess);

    if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
        AutoHeapFree(szUserName);
        AddToMessageLogProcFailure(TEXT("GetUserSID: LookupAccountName"), GetLastError());
        return NULL;
    }

#ifdef DEBUG2
    _stprintf(Msg, TEXT("GetUserSID: cbUserSID=%d\n"), cbUserSID),
    DbgMsgRecord(Msg);
#endif

    // Allocate the SID buffer...
    pUserSID = AutoHeapAlloc(cbUserSID);
    if (pUserSID == NULL) {
        AutoHeapFree(szUserName);
        AddToMessageLog(TEXT("GetUserSID: AutoHeapAlloc failed"));
        return NULL;
    }

    // And the domain name buffer.
    szDomainName = (LPTSTR) AutoHeapAlloc(cbDomainName * sizeof(TCHAR));
    if (!szDomainName) {
        AutoHeapFree(szUserName);
        AutoHeapFree(pUserSID);
        AddToMessageLog(TEXT("GetUserSID: AutoHeapAlloc failed"));
        return NULL;
    }

    // Now get the SID.
    fAPISuccess = LookupAccountName(NULL, szUserName,
                                    pUserSID, &cbUserSID, szDomainName, &cbDomainName, &snuType);
    if (!fAPISuccess) {
        AutoHeapFree(szUserName);
        AutoHeapFree(szDomainName);
        AutoHeapFree(pUserSID);
        AddToMessageLogProcFailure(TEXT("GetUserSID: LookupAccountName"), GetLastError());
        return NULL;
    }

    AutoHeapFree(szUserName);
    AutoHeapFree(szDomainName);

#ifdef DEBUG2
    _stprintf(Msg, TEXT("GetUserSID: pUserSID=%p cbUserSID=%d\n"), pUserSID, cbUserSID),
    DbgMsgRecord(Msg);
#endif

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<-GetUserSID\n"));
#endif

    return pUserSID;
}

BOOL IsGroupMember | ( | PSID | pSID,
 |  | PTOKEN_GROUPS | pGroupInfo
 | ) |  |

Definition at line 396 of file Service.cpp.

                                                        {

#ifdef DEBUG2
    DbgMsgRecord(TEXT("->IsGroupMember\n"));
#endif

    // Loop through the group SIDs looking for the administrator SID.
    for(UINT i=0; i<pGroupInfo->GroupCount; i++) {
        if (EqualSid(pSID, pGroupInfo->Groups[i].Sid)) {
            // Find out if the SID is enabled in the token
            if (pGroupInfo->Groups[i].Attributes & SE_GROUP_ENABLED) {

#ifdef DEBUG2
                DbgMsgRecord(TEXT("<-IsGroupMember\n"));
#endif
                return TRUE;
            }
        }
    }

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<-IsGroupMember\n"));
#endif

    return FALSE;
}

VOID __RPC_FAR* __RPC_API midl_user_allocate ( size_t len )

Definition at line 1165 of file Service.cpp.

                                                          {
    return(HeapAlloc(RpcHeap, 0, len));
}

VOID __RPC_API midl_user_free ( VOID __RPC_FAR * ptr )

Definition at line 1169 of file Service.cpp.

                                                    {
    if(ptr != NULL) {
        HeapFree(RpcHeap, 0, ptr);
    }
}

BOOL ReportStatusToSCMgr | ( | SERVICE_STATUS_HANDLE * | sshStatusHandle,
 |  | SERVICE_STATUS * | ssStatus,
 |  | DWORD | dwCurrentState,
 |  | DWORD | dwWin32ExitCode,
 |  | DWORD | dwWaitHint
 | ) |  |

Definition at line 548 of file Service.cpp.

                                          {

    static DWORD dwCheckPoint = 1;
    BOOL fResult = TRUE;

    if (dwCurrentState == SERVICE_START_PENDING) {
        ssStatus->dwControlsAccepted = 0;
    }
    else {
        ssStatus->dwControlsAccepted = SERVICE_ACCEPT_STOP;
    }

    ssStatus->dwCurrentState = dwCurrentState;
    ssStatus->dwWin32ExitCode = dwWin32ExitCode;
    ssStatus->dwWaitHint = dwWaitHint;

    if ((dwCurrentState == SERVICE_RUNNING) || (dwCurrentState == SERVICE_STOPPED)) {
        ssStatus->dwCheckPoint = 0;
    }
    else {
        ssStatus->dwCheckPoint = dwCheckPoint++;
    }

    // Report the status of the service to the service control manager.
    if (!(fResult = SetServiceStatus(*sshStatusHandle, ssStatus))) {
        AddToMessageLog(TEXT("ReportStatusToSCMgr: SetServiceStatus failed"));
    }
    return fResult;
}

RPC_STATUS __stdcall RpcServerIfCallback | ( | IN void * | Interface,
 |  | IN void * | Context
 | ) |  |

Definition at line 709 of file Service.cpp.

  {
    ULONG ulAuthnLevel;
    ULONG ulAuthnSvc;

    // Get client security info.
    if (RpcBindingInqAuthClient(Context,
        NULL,
        NULL,
        &ulAuthnLevel,
        &ulAuthnSvc,
        NULL) != RPC_S_OK) {

        return RPC_S_ACCESS_DENIED;
    }

    // Make sure the client has adequate security measures and uses the expected
    // security provider.
    if (ulAuthnLevel != RPC_C_AUTHN_LEVEL_PKT_PRIVACY || ulAuthnSvc != RPC_C_AUTHN_GSS_KERBEROS) {

        return RPC_S_ACCESS_DENIED;
    }

    return RPC_S_OK;
};

VOID ServerStop ( )

Definition at line 1054 of file Service.cpp.

                  {
    RPC_STATUS status;

    // Stops the server, wakes up the main thread.
    if (bServerListening) {
        status = RpcMgmtStopServerListening(NULL);
        if(status != RPC_S_OK) {
                    AddToMessageLogProcFailureEEInfo(TEXT("ServiceStart: RpcMgmtWaitServerListen"), status);
        }
        bServerListening = FALSE;
    }

    // Delete the binding vector.
    status = RpcServerUnregisterIf(NULL, NULL, FALSE);
    if(status != RPC_S_OK){
        AddToMessageLogProcFailureEEInfo(TEXT("ServiceStart: RpcServerUnregisterIf"), status);
    }

    // Tell The SCM that the service is stopped.
    if(!ReportStatusToSCMgr(&sshStatusHandle, &ssStatus, SERVICE_STOPPED, NO_ERROR, 0)) {
        AddToMessageLogProcFailure(TEXT("ServiceStop: ReportStatusToSCMgr"), GetLastError());
    }

    // Wait for the client threads to finish so
    // that we do not deallocate active data structures.
    // We can accomplish this by waiting for the counters
    // to become zero.  Performing a check in this
    // order should prevent race conditions, since
    // pClientActiveReqCounters are incremented before
    // pClientReqCounters are decremented.
    if (fServerReqCountersCreated) {
        if (CountersCheckForNonzero(pServerReqCounters, NumPriGroups)) {
            Sleep(1000);
        }
    }
    if (fClientReqCountersCreated) {
        if (CountersCheckForNonzero(pClientReqCounters, NumPriGroups)) {
            Sleep(1000);
        }
    }
    if (fServerActiveReqCountersCreated) {
        if (CountersCheckForNonzero(pServerActiveReqCounters, NumPriGroups)) {
            Sleep(1000);
        }
    }
    if (fClientActiveReqCountersCreated) {
        if (CountersCheckForNonzero(pClientActiveReqCounters, NumPriGroups)) {
            Sleep(1000);
        }
    }

    DeleteWellKnownSids();

    // Delete queues and counters.
    if (fServerReqCountersCreated) {
        CountersDelete(pServerReqCounters, NumPriGroups);
        fServerReqCountersCreated = FALSE;
    }
    if (fClientReqCountersCreated) {
        CountersDelete(pClientReqCounters, NumPriGroups);
        fClientReqCountersCreated = FALSE;
    }
    if (fServerActiveReqCountersCreated) {
        CountersDelete(pServerActiveReqCounters, NumPriGroups);
        fServerActiveReqCountersCreated = FALSE;
    }
    if (fServerReqQueuesCreated) {
        QueuesDelete(ServerReqQueues, NumPriGroups);
        fServerReqQueuesCreated = FALSE;
    }
    if (fServerActiveReqHashCountersCreated) {
        QueuesDelete(ServerActiveReqHashCounters, NumPriGroups);
        fServerActiveReqHashCountersCreated = FALSE;
    }
    if (fClientActiveReqCountersCreated) {
        CountersDelete(pClientActiveReqCounters, NumPriGroups);
        fClientActiveReqCountersCreated = FALSE;
    }
    if (fClientReqQueuesCreated) {
        QueuesDelete(ClientReqQueues, NumPriGroups);
        fClientReqQueuesCreated = FALSE;
    }
    if (fClientActiveReqHashCountersCreated) {
        QueuesDelete(ClientActiveReqHashCounters, NumPriGroups);
        fClientActiveReqHashCountersCreated = FALSE;
    }

#ifdef PROF
    if (fProfOpenedLog) {
        ProfCloseLog();
        fProfOpenedLog = FALSE;
    }
#endif

#ifdef DEBUG2
    if (fDbgMsgOpenedLog) {
        DbgMsgCloseLog();
        fDbgMsgOpenedLog = FALSE;
    }
#endif

}

BOOL StartFileRepServer ( VOID )

Definition at line 738 of file Service.cpp.

                               {
  unsigned i;

    // Servere initialization

    // Register the service interfaces.

#ifndef NO_SEC
    // The server interface has a security callback RpcServerIfCallback.
    // The RPC run time will automatically reject unauthenticated calls to
    // this interface.
    status = RpcServerRegisterIfEx(s_FileRepServer_v1_0_s_ifspec,
           NULL,
           NULL,
           RPC_IF_ALLOW_SECURE_ONLY,
           RPC_C_LISTEN_MAX_CALLS_DEFAULT,
           &RpcServerIfCallback);
    if (status != RPC_S_OK){
            AddToMessageLogProcFailureEEInfo(TEXT("ServiceStart: RpcServerRegisterIfEx"), status);
        return false;
    }
#else if
    status = RpcServerRegisterIf(s_FileRepServer_v1_0_s_ifspec, NULL, NULL);
    if (status != RPC_S_OK){
            AddToMessageLogProcFailureEEInfo(TEXT("ServiceStart: RpcServerRegisterIf(FileRepClient_v1_0_s_ifspec, ...)"), status);
        return false;
    }
#endif

    status = RpcServerRegisterIf(FileRepClient_v1_0_s_ifspec, NULL, NULL);
    if (status != RPC_S_OK){
            AddToMessageLogProcFailureEEInfo(TEXT("ServiceStart: RpcServerRegisterIf(FileRepClient_v1_0_s_ifspec, ...)"), status);
        return false;
    }

    for (i = 0; i < sizeof(ServerProtocolArray)/sizeof(unsigned char *); i++) {

        // Use the protocol sequences specified in ProtocolArray
        // for receiving RPCs.
        status = RpcServerUseProtseq((_TUCHAR *)ServerProtocolArray[i], cMaxCallsListen, NULL);
        if (status != RPC_S_OK){
            AddToMessageLogProcFailureEEInfo(TEXT("ServiceStart: RpcServerUseProtseq"), status);
            return false;
        }
    }

    // Obtain a binding vector for the server.
    status = RpcServerInqBindings(&pBindingVector);
    if (status != RPC_S_OK) {
        AddToMessageLogProcFailureEEInfo(TEXT("ServiceStart: RpcServerInqBindings"), status);
        return false;
    }

    // Register the the services in the endpoint map
    // of the host computer.
    status = RpcEpRegister(s_FileRepServer_v1_0_s_ifspec, pBindingVector, NULL, NULL);
    if (status != RPC_S_OK){
        AddToMessageLogProcFailureEEInfo(TEXT("ServiceStart: RpcEpRegister(s_FileRepServer_v1_0_s_ifspec, ...)"), status);
        return false;
    }
    status = RpcEpRegister(FileRepClient_v1_0_s_ifspec, pBindingVector, NULL, NULL);
    if (status != RPC_S_OK){
        AddToMessageLogProcFailureEEInfo(TEXT("ServiceStart: RpcEpRegister(FileRepClient_v1_0_s_ifspec, ...)"), status);
        return false;
    }

    // Message buffer.
    TCHAR Msg[MSG_SIZE];

#ifndef NO_SEC
    // Array of generated SPNs.
    TCHAR **Spn;
    // Number of generated SPNs.
    ULONG ulSpn = 1;

    PDOMAIN_CONTROLLER_INFO pDomainControllerInfo;

    HANDLE hDS;

    TCHAR lpCompDN[128];
    ULONG ulCompDNSize = sizeof(lpCompDN);

    //
    // Set the security info for the client system service.
    //

    // Principal name is NULL for local system service.
    status = RpcServerRegisterAuthInfo(NULL, RPC_C_AUTHN_WINNT, NULL, NULL);
    if (status != RPC_S_OK){
        AddToMessageLogProcFailureEEInfo(TEXT("ServiceStart: RpcServerRegisterAuthInfo"), status);
        return false;
    }

    //
    // Set the security info for the server system service.
    //

    BOOL NoFailure = TRUE;

    // Generate the SPN.
    status = DsGetSpn(DS_SPN_NB_HOST, // Type of SPN to create.
                      SERVICENAME, // Service class
                      NULL, // DN of this service.
                      0, // Use the default instance port.
                      0, // Number of additional instance names.
                      NULL, // No additional instance names.
                      NULL, // No additional instance ports.
                      &ulSpn, // Size of SPN array.
                      &Spn); // Returned SPN(s).
    if (status != RPC_S_OK){
        _stprintf(Msg, TEXT("ServiceStart: DsGetSpn failed with code %d\n"), status);
        AddToMessageLog(Msg);
        return false;
    }

    // Get the name of our domain.
    if (status = DsGetDcName(NULL,
                             NULL,
                             NULL,
                             NULL,
                             DS_RETURN_DNS_NAME,
                             &pDomainControllerInfo) != NO_ERROR) {
        _stprintf(Msg, TEXT("ServiceStart: DsGetDcName failed with code %d\n"), GetLastError());
        AddToMessageLog(Msg);
        NoFailure = FALSE;
    }

    if (NoFailure) {
        // Bind to the domain controller for our domain.
        if ((status = DsBind(NULL,
                             pDomainControllerInfo->DomainName,
                             &hDS)) != ERROR_SUCCESS) {
            _stprintf(Msg, TEXT("ServiceStart: DsBind failed with code %d\n"), GetLastError());
            AddToMessageLog(Msg);
            NoFailure = FALSE;
        }
    }

    if (NoFailure) {
        if ((status = NetApiBufferFree(pDomainControllerInfo)) != NERR_Success) {
            _stprintf(Msg, TEXT("ServiceStart: NetApiBufferFree failed with code %d\n"), status);
            AddToMessageLog(Msg);
            return false;
        }

        if (GetComputerObjectName(NameFullyQualifiedDN, lpCompDN, &ulCompDNSize) == 0) {
            _stprintf(Msg, TEXT("ServiceStart: GetComputerObjectName failed with code %d\n"), GetLastError());
            AddToMessageLog(Msg);
            return false;
  }

        // We could check whether the SPN is already registered for this
        // computer's DN, but we don't have to.  Modification is performed
        // permissively by this function, so that adding a value that already
        // exists does not return an error.  This way we can opt for the internal
        // check instead of doing it ourselves.
        status = DsWriteAccountSpn(hDS, DS_SPN_ADD_SPN_OP, lpCompDN, ulSpn, (LPCTSTR *)Spn);
        if (status != NO_ERROR) {
            _stprintf(Msg, TEXT("ServiceStart: DsWriteAccountSpn failed with code %d\n"), status);
            return false;
        }
        DsUnBind(&hDS);
    }

    // We use Kerberos for authentication on the server.
    status = RpcServerRegisterAuthInfo(Spn[0], RPC_C_AUTHN_GSS_KERBEROS, NULL, NULL);
    if (status != RPC_S_OK){
        AddToMessageLogProcFailureEEInfo(TEXT("ServiceStart: RpcServerRegisterAuthInfo"), status);
        return false;
    }

    // Don't forget to deallocate the principal name array.
    DsFreeSpnArray(ulSpn, Spn);
#endif

    // Create the heap to be used by midl_user_allocate and midl_user_free
    RpcHeap = HeapCreate(0, RPC_HEAP_SIZE_INIT, RPC_HEAP_SIZE_MAX);

#ifdef DEBUG2
    DbgMsgOpenLog(TEXT("c:\\logs\\FileRepService.dbg"));
    fDbgMsgOpenedLog = TRUE;
#endif

#ifdef PROF
    ProfOpenLog(TEXT("c:\\logs\\FileRepService.prof"));
    fProfOpenedLog = TRUE;
#endif

    // Create counters to measure the number of concurrent
    // connections to the server system service.
    if (CountersCreate(pServerReqCounters, NumPriGroups, (UINT *) ServerReqBounds) == NULL) {
        AddToMessageLog(TEXT("ServiceStart: CountersCreate failed\n"));
        return false;
    }
    fServerReqCountersCreated = TRUE;

    // Create the counters and queues for client system service
    // to store requests and request numbers.
    if (CountersCreate(pClientReqCounters, NumPriGroups, (UINT *) ClientReqBounds) == NULL) {
        AddToMessageLog(TEXT("ServiceStart: CountersCreate failed\n"));
        return false;
    }
    fClientReqCountersCreated = TRUE;

    if (CountersCreate(pServerActiveReqCounters, NumPriGroups, (UINT *) ServerActiveReqBounds) == NULL) {
        AddToMessageLog(TEXT("ServiceStart: CountersCreate failed\n"));
        return false;
    }
    fServerActiveReqCountersCreated = TRUE;

    if (CountersCreate(pClientActiveReqCounters, NumPriGroups, (UINT *) ClientActiveReqBounds) == NULL) {
        AddToMessageLog(TEXT("ServiceStart: CountersCreate failed\n"));
        return false;
    }
    fClientActiveReqCountersCreated = TRUE;

    if (QueuesCreate(ServerReqQueues, NumPriGroups, FALSE) == FALSE) {
        AddToMessageLog(TEXT("ServiceStart: QueuesCreate failed\n"));
        return false;
    }
    fServerReqQueuesCreated = TRUE;

    if (QueuesCreate(ClientReqQueues, NumPriGroups, FALSE) == FALSE) {
        AddToMessageLog(TEXT("ServiceStart: QueuesCreate failed\n"));
        return false;
    }
    fServerReqQueuesCreated = TRUE;

#ifdef DEBUG1
    if ((ServerActiveReqQueue = QueueCreate(FALSE)) == NULL) {
        AddToMessageLog(TEXT("ServiceStart: QueuesCreate failed\n"));
        return false;
    }
    fServerActiveReqQueueCreated = TRUE;

    if ((ClientActiveReqQueue = QueueCreate(FALSE)) == NULL) {
        AddToMessageLog(TEXT("ServiceStart: QueuesCreate failed\n"));
        return false;
    }
    fClientActiveReqQueueCreated = TRUE;
#endif

    if (QueuesCreate(ServerActiveReqHashCounters, NumPriGroups, FALSE) == FALSE) {
        AddToMessageLog(TEXT("ServiceStart: QueuesCreate failed\n"));
        return false;
    }
    fServerActiveReqHashCountersCreated = TRUE;

    if (QueuesCreate(ClientActiveReqHashCounters, NumPriGroups, FALSE) == FALSE) {
        AddToMessageLog(TEXT("ServiceStart: QueuesCreate failed\n"));
        return false;
    }
    fClientActiveReqHashCountersCreated = TRUE;

    CreateWellKnownSids();

    if ((ClientCompletionPort = CreateIoCompletionPort (
  INVALID_HANDLE_VALUE,
  NULL,
  0,
  0)) == INVALID_HANDLE_VALUE) {
        AddToMessageLog(TEXT("ServiceStart: CreateIoCompletionPort failed\n"));
        return false;
    }

    if ((ServerCompletionPort = CreateIoCompletionPort (
  INVALID_HANDLE_VALUE,
  NULL,
  0,
  0)) == INVALID_HANDLE_VALUE) {
        AddToMessageLog(TEXT("ServiceStart: CreateIoCompletionPort failed\n"));
        return false;
    }

    nThreadsAtClientCompletionPort = 0;
    nThreadsAtServerCompletionPort = 0;

    // Initialize the LogEvent function.
    typedef RPC_STATUS (__stdcall *PF) (PVOID p, BOOL b, ULONG t, ULONG i);

    HMODULE rpc = LoadLibrary(TEXT("rpcrt4.dll"));

    if (rpc == 0)
        {
        AddToMessageLogProcFailureEEInfo(TEXT("ServiceStart: LoadLibrary"), status);
        return false;
        }

    // Start accepting client calls.
    // The last argument's being 1 indicates that RpcServerListen
    // should return false immediately after completing function processing.
    status = RpcServerListen(cMinimumThreads, cMaxCallsExecute, 1);
    if (status != RPC_S_OK){
        AddToMessageLogProcFailureEEInfo(TEXT("ServiceStart: RpcServerListen"), status);
        return false;
    }

    return true;
}

Variable Documentation

BOOL bNoFileIO = FALSE

Definition at line 149 of file Service.cpp.

BOOL bServerListening = FALSE

Definition at line 120 of file Service.cpp.

const UINT ClientActiveReqBounds[] = {1, 5, 10}

Definition at line 82 of file Service.cpp.

Queue* ClientActiveReqHashCounters[NumPriGroups]

Definition at line 95 of file Service.cpp.

HANDLE ClientCompletionPort

Definition at line 143 of file Service.cpp.

const UINT ClientReqBounds[] = {10, 20, 30}

Definition at line 79 of file Service.cpp.

Queue* ClientReqQueues[NumPriGroups]

Definition at line 94 of file Service.cpp.

ULONG cMaxCallsExecute = 1000

Definition at line 166 of file Service.cpp.

ULONG cMaxCallsListen = 1000

Definition at line 163 of file Service.cpp.

ULONG cMinimumThreads = 2

Definition at line 169 of file Service.cpp.

BOOL fClientActiveReqCountersCreated = FALSE

Definition at line 132 of file Service.cpp.

BOOL fClientActiveReqHashCountersCreated = FALSE

Definition at line 135 of file Service.cpp.

BOOL fClientReqCountersCreated = FALSE

Definition at line 131 of file Service.cpp.

BOOL fClientReqQueuesCreated = FALSE

Definition at line 134 of file Service.cpp.

BOOL fServerActiveReqCountersCreated = FALSE

Definition at line 138 of file Service.cpp.

BOOL fServerActiveReqHashCountersCreated = FALSE

Definition at line 141 of file Service.cpp.

BOOL fServerReqCountersCreated = FALSE

Definition at line 137 of file Service.cpp.

BOOL fServerReqQueuesCreated = FALSE

Definition at line 140 of file Service.cpp.

const UINT MaxUserReqs = 5

Definition at line 84 of file Service.cpp.

LONG nThreadsAtClientCompletionPort

Definition at line 146 of file Service.cpp.

LONG nThreadsAtServerCompletionPort

Definition at line 147 of file Service.cpp.

const UINT NumPriGroups = 3

Definition at line 57 of file Service.cpp.

PSID pAdminSID = NULL

Definition at line 424 of file Service.cpp.

PSID pAnonSID = NULL

Definition at line 425 of file Service.cpp.

RPC_BINDING_VECTOR* pBindingVector = NULL

Definition at line 171 of file Service.cpp.

Counter* pClientActiveReqCounters[NumPriGroups]

Definition at line 89 of file Service.cpp.

Counter* pClientReqCounters[NumPriGroups]

Definition at line 88 of file Service.cpp.

Counter* pServerActiveReqCounters[NumPriGroups]

Definition at line 92 of file Service.cpp.

Counter* pServerReqCounters[NumPriGroups]

Definition at line 91 of file Service.cpp.

PSID pSystemSID = NULL

Definition at line 423 of file Service.cpp.

const UINT RegUsersPri = 1

Definition at line 108 of file Service.cpp.

HANDLE RpcHeap

Definition at line 1159 of file Service.cpp.

const UINT ServerActiveReqBounds[] = {10, 50, 100}

Definition at line 81 of file Service.cpp.

Queue* ServerActiveReqHashCounters[NumPriGroups]

Definition at line 98 of file Service.cpp.

HANDLE ServerCompletionPort

Definition at line 144 of file Service.cpp.

LPTSTR ServerProtocolArray[]
Initial value:
 { TEXT("ncacn_ip_tcp"),
                                 TEXT("ncalrpc") }

Definition at line 158 of file Service.cpp.

const UINT ServerReqBounds[] = {10, 20, 30}

Definition at line 78 of file Service.cpp.

Queue* ServerReqQueues[NumPriGroups]

Definition at line 97 of file Service.cpp.

SERVICE_STATUS_HANDLE sshStatusHandle

Definition at line 115 of file Service.cpp.

SERVICE_STATUS ssStatus

Definition at line 118 of file Service.cpp.

RPC_STATUS status

Definition at line 174 of file Service.cpp.

Generated on Wed Nov 13 2024 16:53:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/FileRepAsyncPipe/Service.h File Reference

  • NetDS
  • RPC
  • FileRep
  • FileRepAsyncPipe
Defines | Functions | Variables

Service.h File Reference

#include "Resources.h"
#include "Resources.h"

Go to the source code of this file.

Defines

#define | APPNAME TEXT("FileRepService")
#define | DEPENDENCIES TEXT("RPCSS\0\0")
#define | RPC_HEAP_SIZE_INIT (1024*1024)
#define | RPC_HEAP_SIZE_MAX (128*1024*1024)
#define | SERVICEDISPLAYNAME TEXT("File Replication Service")
#define | SERVICENAME TEXT("FileRepService")

Functions

VOID | AddRpcEEInfo (DWORD Status, LPTSTR Msg)
VOID | AddRpcEEInfoAndRaiseException (DWORD Status, LPTSTR Msg)
VOID | AddToMessageLog (LPTSTR lpszMsg)
VOID | AddToMessageLogProcFailure (LPTSTR ProcName, DWORD ErrCode)
VOID | AddToMessageLogProcFailureEEInfo (LPTSTR ProcName, DWORD ErrCode)
VOID * | AutoHeapAlloc (size_t dwBytes)
VOID | AutoHeapFree (VOID *lpMem)
VOID | CreateWellKnownSids (VOID)
VOID | DeleteWellKnownSids (VOID)
UINT | GetCurrentUserPriority (VOID)
PTOKEN_GROUPS | GetUserGroups ()
PSID GetUserSID ()
BOOL | IsGroupMember (PSID pSID, PTOKEN_GROUPS pGroupInfo)
BOOL | ReportStatusToSCMgr (SERVICE_STATUS_HANDLE *sshStatusHandle, SERVICE_STATUS *ssStatus, DWORD dwCurrentState, DWORD dwWin32ExitCode, DWORD dwWaitHint)
VOID | ServerStop (VOID)
BOOL | StartFileRepServer (VOID)

Variables

BOOL bNoFileIO
BOOL bServerListening
const UINT | ClientActiveReqBounds []
Queue * ClientActiveReqHashCounters []
const UINT | ClientReqBounds []
Queue * ClientReqQueues []
const UINT | MaxUserReqs
const UINT | NumPriGroups
PSID pAdminSID
PSID pAnonSID
Counter * pClientActiveReqCounters []
Counter * pClientReqCounters []
Counter * pServerActiveReqCounters []
Counter * pServerReqCounters []
PSID pSystemSID
const UINT | RegUsersPri
HANDLE RpcHeap
const UINT | ServerActiveReqBounds []
Queue * ServerActiveReqHashCounters []
const UINT | ServerReqBounds []
Queue * ServerReqQueues []
SERVICE_STATUS_HANDLE | sshStatusHandle
SERVICE_STATUS | ssStatus

Define Documentation

#define APPNAME TEXT("FileRepService")

Definition at line 22 of file Service.h.

#define DEPENDENCIES TEXT("RPCSS\0\0")

Definition at line 31 of file Service.h.

#define RPC_HEAP_SIZE_INIT (1024*1024)

Definition at line 135 of file Service.h.

#define RPC_HEAP_SIZE_MAX (128*1024*1024)

Definition at line 136 of file Service.h.

#define SERVICEDISPLAYNAME TEXT("File Replication Service")

Definition at line 28 of file Service.h.

#define SERVICENAME TEXT("FileRepService")

Definition at line 25 of file Service.h.

Function Documentation

VOID AddRpcEEInfo | ( | DWORD | Status,
 |  | LPTSTR | Msg
 | ) |  |

Definition at line 646 of file Service.cpp.

                                            {
    RPC_STATUS rpcstatus;

    RPC_EXTENDED_ERROR_INFO ErrorInfo;

    ErrorInfo.Version = RPC_EEINFO_VERSION;
    ErrorInfo.ComputerName = NULL;
    ErrorInfo.ProcessID = 0;
    ErrorInfo.GeneratingComponent = 0;
    ErrorInfo.Status = Status;
    ErrorInfo.DetectionLocation = 0;
    ErrorInfo.Flags = 0;
    ErrorInfo.NumberOfParameters = 1;
    ErrorInfo.Parameters[0].ParameterType = eeptUnicodeString;
    ErrorInfo.Parameters[0].u.UnicodeString = Msg;

    rpcstatus = RpcErrorAddRecord(&ErrorInfo);

    RpcRaiseException(Status);
}

VOID AddRpcEEInfoAndRaiseException | ( | DWORD | Status,
 |  | LPTSTR | Msg
 | ) |  |

Definition at line 667 of file Service.cpp.

                                                             {
    AddRpcEEInfo(Status, Msg);
    RpcRaiseException(Status);
}

VOID AddToMessageLog ( LPTSTR lpszMsg )

Definition at line 598 of file Service.cpp.

                                    {
    TCHAR szMsg1[256];
    HANDLE hEventSource;
    LPTSTR lpszStrings[2];
    DWORD dwErr = 0;

    dwErr = GetLastError();

    // Use event logging to log the error.
    hEventSource = RegisterEventSource(NULL, SERVICENAME);

    _stprintf(szMsg1, TEXT("%s error: %d"), SERVICENAME, dwErr);
    lpszStrings[0] = szMsg1;
    lpszStrings[1] = szMsg2;

    if (hEventSource != NULL) {
        ReportEvent(hEventSource, // handle of event source
                    EVENTLOG_ERROR_TYPE, // event type
                    0, // event category
                    0, // event ID
                    NULL, // current user's SID
                    2, // strings in lpszStrings
                    0, // no bytes of raw data
                    (LPCTSTR *) lpszStrings, // array of error strings
                    NULL); // no raw data

        (VOID) DeregisterEventSource(hEventSource);
    }
}

VOID AddToMessageLogProcFailure | ( | LPTSTR | ProcName,
 |  | DWORD | ErrCode
 | ) |  |

Definition at line 628 of file Service.cpp.

                                                                {
    TCHAR Msg[MSG_SIZE];
    _stprintf(Msg, TEXT("%s failed with code %d"), ProcName, ErrCode);
    AddToMessageLog(Msg);
}

VOID AddToMessageLogProcFailureEEInfo | ( | LPTSTR | ProcName,
 |  | DWORD | ErrCode
 | ) |  |

Definition at line 634 of file Service.cpp.

                                                                      {
    TCHAR Msg[MSG_SIZE];
    UINT MsgSize = 0;

    MsgSize += _stprintf(&Msg[MsgSize], TEXT("%s failed with code %d\n"), ProcName, ErrCode);
    GetEEInfoText(Msg, MSG_SIZE, &MsgSize);

    Msg[MsgSize] = 0;

    AddToMessageLog(Msg);
}

VOID* AutoHeapAlloc ( size_t dwBytes )

Definition at line 108 of file common.cpp.

                                     {
    if (hProcessHeap == NULL) {
        hProcessHeap = GetProcessHeap();
    }
    return HeapAlloc(hProcessHeap, 0, dwBytes);
}

VOID AutoHeapFree ( VOID * lpMem )

Definition at line 115 of file common.cpp.

                                {
    DWORD status;
    ASSERT(hProcessHeap != NULL);
    status = HeapFree(hProcessHeap, 0, lpMem);
    ASSERT(status);
}

VOID CreateWellKnownSids ( VOID )

Definition at line 427 of file Service.cpp.

                               {
    SID_IDENTIFIER_AUTHORITY SIDAuth = SECURITY_NT_AUTHORITY;

    // Generate SID for the system if necessary.
    if (pSystemSID == NULL) {
        if (AllocateAndInitializeSid(&SIDAuth, 1,
                                     SECURITY_LOCAL_SYSTEM_RID,
                                     0, 0, 0, 0, 0, 0, 0,
                                     &pSystemSID) == 0) {
            AddToMessageLogProcFailure(TEXT("CreateWellKnownSids: AllocateAndInitializeSid"), GetLastError());
        }
    }

    // Generate SID for the admin group if necessary.
    if (pAdminSID == NULL) {
        if (AllocateAndInitializeSid(&SIDAuth, 1,
                                     DOMAIN_ALIAS_RID_ADMINS,
                                     0, 0, 0, 0, 0, 0, 0,
                                     &pAdminSID) == 0) {
            AddToMessageLogProcFailure(TEXT("CreateWellKnownSids: AllocateAndInitializeSid"), GetLastError());
        }
    }

    // Generate the anonymous SID if necessary.
    if (pAnonSID == NULL) {
        if (AllocateAndInitializeSid(&SIDAuth, 1,
                                     SECURITY_ANONYMOUS_LOGON_RID,
                                     0, 0, 0, 0, 0, 0, 0,
                                     &pAnonSID) == 0) {
            AddToMessageLogProcFailure(TEXT("CreateWellKnownSids: AllocateAndInitializeSid"), GetLastError());
        }
    }
}

VOID DeleteWellKnownSids ( VOID )

Definition at line 461 of file Service.cpp.

                               {
    AutoHeapFree(pSystemSID);
    pSystemSID = NULL;
    AutoHeapFree(pAdminSID);
    pAdminSID = NULL;
    AutoHeapFree(pAnonSID);
    pAnonSID = NULL;
}

UINT GetCurrentUserPriority ( VOID )

Definition at line 487 of file Service.cpp.

                                  {
    PSID pSID;
    PTOKEN_GROUPS pUserGroups;

    UINT Pri;

    // If well-known sids were not allocated, we can't work.
    if (pSystemSID == NULL || pAdminSID == NULL || pAnonSID == NULL) {
        return 0;
    }

    // The SID gets dynamically allocated inside GetUserSID(), so
    // we need to remember about that.
    if ((pSID = GetUserSID()) == NULL) {
        return 0;
    }

    if ((pUserGroups = GetUserGroups()) == NULL) {
        AutoHeapFree(pSID);
        return 0;
    }

    // Test if current SID is system SID or it
    // is a member of the administrator group.
    if (EqualSid(pSID, pSystemSID) || IsGroupMember(pAdminSID, pUserGroups)) {
        // Return system priority.
        Pri = 2;
    }
    // Test if current SID is anonyous SID.
    else if (EqualSid(pSID, pAnonSID)) {
        // Return anonymous priority.
        Pri = 0;
    }
    else {
        // We are left with the regular user priority.
        Pri = 1;
    }

    AutoHeapFree(pSID);
    AutoHeapFree(pUserGroups);
    return Pri;
}

PTOKEN_GROUPS GetUserGroups ( )
PSID GetUserSID ( )

Definition at line 193 of file Service.cpp.

                  {
    SID_NAME_USE snuType;
    PSID pUserSID = NULL;
    DWORD cbUserSID = 0;

    LPTSTR szUserName = NULL;
    DWORD cbUserName = 0;

    LPTSTR szDomainName = NULL;
    DWORD cbDomainName = 0;

    BOOL fAPISuccess;

#ifdef DEBUG2
    TCHAR Msg[MSG_SIZE];

    DbgMsgRecord(TEXT("->GetUserSID\n"));
#endif

    // Get the logged on user name.  First we determine the size
    // of the buffer required and then get the username.

    // Get the size of the name.
    fAPISuccess = GetUserName(szUserName, &cbUserName);

    // API should have failed with insufficient buffer.
    ASSERT(!fAPISuccess);

    if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
        AddToMessageLogProcFailure(TEXT("GetUserSID: GetUserName"), GetLastError());
        return NULL;
    }

#ifdef DEBUG2
    _stprintf(Msg, TEXT("GetUserSID: cbUserName=%d\n"), cbUserName);
    DbgMsgRecord(Msg);
#endif

    // Allocate buffer for the name.
    szUserName = (LPTSTR) AutoHeapAlloc(cbUserName * sizeof(TCHAR));
    if (szUserName == NULL) {
        AddToMessageLog(TEXT("GetUserSID: AutoHeapAlloc failed"));
        return NULL;
    }

    // Finally get the name.
    fAPISuccess = GetUserName(szUserName, &cbUserName);
    if (!fAPISuccess) {
        AutoHeapFree(szUserName);
        AddToMessageLogProcFailure(TEXT("GetUserSID: GetUserName"), GetLastError());
        return NULL;
    }

#ifdef DEBUG2
    _stprintf(Msg, TEXT("GetUserSID: UserName=%s cbUserName=%d\n"), szUserName, cbUserName),
    DbgMsgRecord(Msg);
#endif

    // Do the same for SID.  First get the size and then allocate the buffer
    // and perform the actual call.
    fAPISuccess = LookupAccountName(NULL, szUserName,
                                    pUserSID, &cbUserSID, szDomainName, &cbDomainName, &snuType);

    // API should have failed with insufficient buffer.
    ASSERT(!fAPISuccess);

    if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
        AutoHeapFree(szUserName);
        AddToMessageLogProcFailure(TEXT("GetUserSID: LookupAccountName"), GetLastError());
        return NULL;
    }

#ifdef DEBUG2
    _stprintf(Msg, TEXT("GetUserSID: cbUserSID=%d\n"), cbUserSID),
    DbgMsgRecord(Msg);
#endif

    // Allocate the SID buffer...
    pUserSID = AutoHeapAlloc(cbUserSID);
    if (pUserSID == NULL) {
        AutoHeapFree(szUserName);
        AddToMessageLog(TEXT("GetUserSID: AutoHeapAlloc failed"));
        return NULL;
    }

    // And the domain name buffer.
    szDomainName = (LPTSTR) AutoHeapAlloc(cbDomainName * sizeof(TCHAR));
    if (!szDomainName) {
        AutoHeapFree(szUserName);
        AutoHeapFree(pUserSID);
        AddToMessageLog(TEXT("GetUserSID: AutoHeapAlloc failed"));
        return NULL;
    }

    // Now get the SID.
    fAPISuccess = LookupAccountName(NULL, szUserName,
                                    pUserSID, &cbUserSID, szDomainName, &cbDomainName, &snuType);
    if (!fAPISuccess) {
        AutoHeapFree(szUserName);
        AutoHeapFree(szDomainName);
        AutoHeapFree(pUserSID);
        AddToMessageLogProcFailure(TEXT("GetUserSID: LookupAccountName"), GetLastError());
        return NULL;
    }

    AutoHeapFree(szUserName);
    AutoHeapFree(szDomainName);

#ifdef DEBUG2
    _stprintf(Msg, TEXT("GetUserSID: pUserSID=%p cbUserSID=%d\n"), pUserSID, cbUserSID),
    DbgMsgRecord(Msg);
#endif

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<-GetUserSID\n"));
#endif

    return pUserSID;
}

BOOL IsGroupMember | ( | PSID | pSID,
 |  | PTOKEN_GROUPS | pGroupInfo
 | ) |  |

Definition at line 396 of file Service.cpp.

                                                        {

#ifdef DEBUG2
    DbgMsgRecord(TEXT("->IsGroupMember\n"));
#endif

    // Loop through the group SIDs looking for the administrator SID.
    for(UINT i=0; i<pGroupInfo->GroupCount; i++) {
        if (EqualSid(pSID, pGroupInfo->Groups[i].Sid)) {
            // Find out if the SID is enabled in the token
            if (pGroupInfo->Groups[i].Attributes & SE_GROUP_ENABLED) {

#ifdef DEBUG2
                DbgMsgRecord(TEXT("<-IsGroupMember\n"));
#endif
                return TRUE;
            }
        }
    }

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<-IsGroupMember\n"));
#endif

    return FALSE;
}

BOOL ReportStatusToSCMgr | ( | SERVICE_STATUS_HANDLE * | sshStatusHandle,
 |  | SERVICE_STATUS * | ssStatus,
 |  | DWORD | dwCurrentState,
 |  | DWORD | dwWin32ExitCode,
 |  | DWORD | dwWaitHint
 | ) |  |

Definition at line 548 of file Service.cpp.

                                          {

    static DWORD dwCheckPoint = 1;
    BOOL fResult = TRUE;

    if (dwCurrentState == SERVICE_START_PENDING) {
        ssStatus->dwControlsAccepted = 0;
    }
    else {
        ssStatus->dwControlsAccepted = SERVICE_ACCEPT_STOP;
    }

    ssStatus->dwCurrentState = dwCurrentState;
    ssStatus->dwWin32ExitCode = dwWin32ExitCode;
    ssStatus->dwWaitHint = dwWaitHint;

    if ((dwCurrentState == SERVICE_RUNNING) || (dwCurrentState == SERVICE_STOPPED)) {
        ssStatus->dwCheckPoint = 0;
    }
    else {
        ssStatus->dwCheckPoint = dwCheckPoint++;
    }

    // Report the status of the service to the service control manager.
    if (!(fResult = SetServiceStatus(*sshStatusHandle, ssStatus))) {
        AddToMessageLog(TEXT("ReportStatusToSCMgr: SetServiceStatus failed"));
    }
    return fResult;
}

VOID ServerStop ( VOID )
BOOL StartFileRepServer ( VOID )

Definition at line 738 of file Service.cpp.

                               {
  unsigned i;

    // Servere initialization

    // Register the service interfaces.

#ifndef NO_SEC
    // The server interface has a security callback RpcServerIfCallback.
    // The RPC run time will automatically reject unauthenticated calls to
    // this interface.
    status = RpcServerRegisterIfEx(s_FileRepServer_v1_0_s_ifspec,
           NULL,
           NULL,
           RPC_IF_ALLOW_SECURE_ONLY,
           RPC_C_LISTEN_MAX_CALLS_DEFAULT,
           &RpcServerIfCallback);
    if (status != RPC_S_OK){
            AddToMessageLogProcFailureEEInfo(TEXT("ServiceStart: RpcServerRegisterIfEx"), status);
        return false;
    }
#else if
    status = RpcServerRegisterIf(s_FileRepServer_v1_0_s_ifspec, NULL, NULL);
    if (status != RPC_S_OK){
            AddToMessageLogProcFailureEEInfo(TEXT("ServiceStart: RpcServerRegisterIf(FileRepClient_v1_0_s_ifspec, ...)"), status);
        return false;
    }
#endif

    status = RpcServerRegisterIf(FileRepClient_v1_0_s_ifspec, NULL, NULL);
    if (status != RPC_S_OK){
            AddToMessageLogProcFailureEEInfo(TEXT("ServiceStart: RpcServerRegisterIf(FileRepClient_v1_0_s_ifspec, ...)"), status);
        return false;
    }

    for (i = 0; i < sizeof(ServerProtocolArray)/sizeof(unsigned char *); i++) {

        // Use the protocol sequences specified in ProtocolArray
        // for receiving RPCs.
        status = RpcServerUseProtseq((_TUCHAR *)ServerProtocolArray[i], cMaxCallsListen, NULL);
        if (status != RPC_S_OK){
            AddToMessageLogProcFailureEEInfo(TEXT("ServiceStart: RpcServerUseProtseq"), status);
            return false;
        }
    }

    // Obtain a binding vector for the server.
    status = RpcServerInqBindings(&pBindingVector);
    if (status != RPC_S_OK) {
        AddToMessageLogProcFailureEEInfo(TEXT("ServiceStart: RpcServerInqBindings"), status);
        return false;
    }

    // Register the the services in the endpoint map
    // of the host computer.
    status = RpcEpRegister(s_FileRepServer_v1_0_s_ifspec, pBindingVector, NULL, NULL);
    if (status != RPC_S_OK){
        AddToMessageLogProcFailureEEInfo(TEXT("ServiceStart: RpcEpRegister(s_FileRepServer_v1_0_s_ifspec, ...)"), status);
        return false;
    }
    status = RpcEpRegister(FileRepClient_v1_0_s_ifspec, pBindingVector, NULL, NULL);
    if (status != RPC_S_OK){
        AddToMessageLogProcFailureEEInfo(TEXT("ServiceStart: RpcEpRegister(FileRepClient_v1_0_s_ifspec, ...)"), status);
        return false;
    }

    // Message buffer.
    TCHAR Msg[MSG_SIZE];

#ifndef NO_SEC
    // Array of generated SPNs.
    TCHAR **Spn;
    // Number of generated SPNs.
    ULONG ulSpn = 1;

    PDOMAIN_CONTROLLER_INFO pDomainControllerInfo;

    HANDLE hDS;

    TCHAR lpCompDN[128];
    ULONG ulCompDNSize = sizeof(lpCompDN);

    //
    // Set the security info for the client system service.
    //

    // Principal name is NULL for local system service.
    status = RpcServerRegisterAuthInfo(NULL, RPC_C_AUTHN_WINNT, NULL, NULL);
    if (status != RPC_S_OK){
        AddToMessageLogProcFailureEEInfo(TEXT("ServiceStart: RpcServerRegisterAuthInfo"), status);
        return false;
    }

    //
    // Set the security info for the server system service.
    //

    BOOL NoFailure = TRUE;

    // Generate the SPN.
    status = DsGetSpn(DS_SPN_NB_HOST, // Type of SPN to create.
                      SERVICENAME, // Service class
                      NULL, // DN of this service.
                      0, // Use the default instance port.
                      0, // Number of additional instance names.
                      NULL, // No additional instance names.
                      NULL, // No additional instance ports.
                      &ulSpn, // Size of SPN array.
                      &Spn); // Returned SPN(s).
    if (status != RPC_S_OK){
        _stprintf(Msg, TEXT("ServiceStart: DsGetSpn failed with code %d\n"), status);
        AddToMessageLog(Msg);
        return false;
    }

    // Get the name of our domain.
    if (status = DsGetDcName(NULL,
                             NULL,
                             NULL,
                             NULL,
                             DS_RETURN_DNS_NAME,
                             &pDomainControllerInfo) != NO_ERROR) {
        _stprintf(Msg, TEXT("ServiceStart: DsGetDcName failed with code %d\n"), GetLastError());
        AddToMessageLog(Msg);
        NoFailure = FALSE;
    }

    if (NoFailure) {
        // Bind to the domain controller for our domain.
        if ((status = DsBind(NULL,
                             pDomainControllerInfo->DomainName,
                             &hDS)) != ERROR_SUCCESS) {
            _stprintf(Msg, TEXT("ServiceStart: DsBind failed with code %d\n"), GetLastError());
            AddToMessageLog(Msg);
            NoFailure = FALSE;
        }
    }

    if (NoFailure) {
        if ((status = NetApiBufferFree(pDomainControllerInfo)) != NERR_Success) {
            _stprintf(Msg, TEXT("ServiceStart: NetApiBufferFree failed with code %d\n"), status);
            AddToMessageLog(Msg);
            return false;
        }

        if (GetComputerObjectName(NameFullyQualifiedDN, lpCompDN, &ulCompDNSize) == 0) {
            _stprintf(Msg, TEXT("ServiceStart: GetComputerObjectName failed with code %d\n"), GetLastError());
            AddToMessageLog(Msg);
            return false;
  }

        // We could check whether the SPN is already registered for this
        // computer's DN, but we don't have to.  Modification is performed
        // permissively by this function, so that adding a value that already
        // exists does not return an error.  This way we can opt for the internal
        // check instead of doing it ourselves.
        status = DsWriteAccountSpn(hDS, DS_SPN_ADD_SPN_OP, lpCompDN, ulSpn, (LPCTSTR *)Spn);
        if (status != NO_ERROR) {
            _stprintf(Msg, TEXT("ServiceStart: DsWriteAccountSpn failed with code %d\n"), status);
            return false;
        }
        DsUnBind(&hDS);
    }

    // We use Kerberos for authentication on the server.
    status = RpcServerRegisterAuthInfo(Spn[0], RPC_C_AUTHN_GSS_KERBEROS, NULL, NULL);
    if (status != RPC_S_OK){
        AddToMessageLogProcFailureEEInfo(TEXT("ServiceStart: RpcServerRegisterAuthInfo"), status);
        return false;
    }

    // Don't forget to deallocate the principal name array.
    DsFreeSpnArray(ulSpn, Spn);
#endif

    // Create the heap to be used by midl_user_allocate and midl_user_free
    RpcHeap = HeapCreate(0, RPC_HEAP_SIZE_INIT, RPC_HEAP_SIZE_MAX);

#ifdef DEBUG2
    DbgMsgOpenLog(TEXT("c:\\logs\\FileRepService.dbg"));
    fDbgMsgOpenedLog = TRUE;
#endif

#ifdef PROF
    ProfOpenLog(TEXT("c:\\logs\\FileRepService.prof"));
    fProfOpenedLog = TRUE;
#endif

    // Create counters to measure the number of concurrent
    // connections to the server system service.
    if (CountersCreate(pServerReqCounters, NumPriGroups, (UINT *) ServerReqBounds) == NULL) {
        AddToMessageLog(TEXT("ServiceStart: CountersCreate failed\n"));
        return false;
    }
    fServerReqCountersCreated = TRUE;

    // Create the counters and queues for client system service
    // to store requests and request numbers.
    if (CountersCreate(pClientReqCounters, NumPriGroups, (UINT *) ClientReqBounds) == NULL) {
        AddToMessageLog(TEXT("ServiceStart: CountersCreate failed\n"));
        return false;
    }
    fClientReqCountersCreated = TRUE;

    if (CountersCreate(pServerActiveReqCounters, NumPriGroups, (UINT *) ServerActiveReqBounds) == NULL) {
        AddToMessageLog(TEXT("ServiceStart: CountersCreate failed\n"));
        return false;
    }
    fServerActiveReqCountersCreated = TRUE;

    if (CountersCreate(pClientActiveReqCounters, NumPriGroups, (UINT *) ClientActiveReqBounds) == NULL) {
        AddToMessageLog(TEXT("ServiceStart: CountersCreate failed\n"));
        return false;
    }
    fClientActiveReqCountersCreated = TRUE;

    if (QueuesCreate(ServerReqQueues, NumPriGroups, FALSE) == FALSE) {
        AddToMessageLog(TEXT("ServiceStart: QueuesCreate failed\n"));
        return false;
    }
    fServerReqQueuesCreated = TRUE;

    if (QueuesCreate(ClientReqQueues, NumPriGroups, FALSE) == FALSE) {
        AddToMessageLog(TEXT("ServiceStart: QueuesCreate failed\n"));
        return false;
    }
    fServerReqQueuesCreated = TRUE;

#ifdef DEBUG1
    if ((ServerActiveReqQueue = QueueCreate(FALSE)) == NULL) {
        AddToMessageLog(TEXT("ServiceStart: QueuesCreate failed\n"));
        return false;
    }
    fServerActiveReqQueueCreated = TRUE;

    if ((ClientActiveReqQueue = QueueCreate(FALSE)) == NULL) {
        AddToMessageLog(TEXT("ServiceStart: QueuesCreate failed\n"));
        return false;
    }
    fClientActiveReqQueueCreated = TRUE;
#endif

    if (QueuesCreate(ServerActiveReqHashCounters, NumPriGroups, FALSE) == FALSE) {
        AddToMessageLog(TEXT("ServiceStart: QueuesCreate failed\n"));
        return false;
    }
    fServerActiveReqHashCountersCreated = TRUE;

    if (QueuesCreate(ClientActiveReqHashCounters, NumPriGroups, FALSE) == FALSE) {
        AddToMessageLog(TEXT("ServiceStart: QueuesCreate failed\n"));
        return false;
    }
    fClientActiveReqHashCountersCreated = TRUE;

    CreateWellKnownSids();

    if ((ClientCompletionPort = CreateIoCompletionPort (
  INVALID_HANDLE_VALUE,
  NULL,
  0,
  0)) == INVALID_HANDLE_VALUE) {
        AddToMessageLog(TEXT("ServiceStart: CreateIoCompletionPort failed\n"));
        return false;
    }

    if ((ServerCompletionPort = CreateIoCompletionPort (
  INVALID_HANDLE_VALUE,
  NULL,
  0,
  0)) == INVALID_HANDLE_VALUE) {
        AddToMessageLog(TEXT("ServiceStart: CreateIoCompletionPort failed\n"));
        return false;
    }

    nThreadsAtClientCompletionPort = 0;
    nThreadsAtServerCompletionPort = 0;

    // Initialize the LogEvent function.
    typedef RPC_STATUS (__stdcall *PF) (PVOID p, BOOL b, ULONG t, ULONG i);

    HMODULE rpc = LoadLibrary(TEXT("rpcrt4.dll"));

    if (rpc == 0)
        {
        AddToMessageLogProcFailureEEInfo(TEXT("ServiceStart: LoadLibrary"), status);
        return false;
        }

    // Start accepting client calls.
    // The last argument's being 1 indicates that RpcServerListen
    // should return false immediately after completing function processing.
    status = RpcServerListen(cMinimumThreads, cMaxCallsExecute, 1);
    if (status != RPC_S_OK){
        AddToMessageLogProcFailureEEInfo(TEXT("ServiceStart: RpcServerListen"), status);
        return false;
    }

    return true;
}

Variable Documentation

BOOL bNoFileIO

Definition at line 149 of file Service.cpp.

BOOL bServerListening

Definition at line 120 of file Service.cpp.

const UINT ClientActiveReqBounds[]

Definition at line 82 of file Service.cpp.

Queue* ClientActiveReqHashCounters[]

Definition at line 95 of file Service.cpp.

const UINT ClientReqBounds[]

Definition at line 79 of file Service.cpp.

Queue* ClientReqQueues[]

Definition at line 94 of file Service.cpp.

const UINT MaxUserReqs

Definition at line 84 of file Service.cpp.

const UINT NumPriGroups

Definition at line 57 of file Service.cpp.

PSID pAdminSID

Definition at line 424 of file Service.cpp.

PSID pAnonSID

Definition at line 425 of file Service.cpp.

Counter* pClientActiveReqCounters[]

Definition at line 89 of file Service.cpp.

Counter* pClientReqCounters[]

Definition at line 88 of file Service.cpp.

Counter* pServerActiveReqCounters[]

Definition at line 92 of file Service.cpp.

Counter* pServerReqCounters[]

Definition at line 91 of file Service.cpp.

PSID pSystemSID

Definition at line 423 of file Service.cpp.

const UINT RegUsersPri

Definition at line 108 of file Service.cpp.

HANDLE RpcHeap

Definition at line 1159 of file Service.cpp.

const UINT ServerActiveReqBounds[]

Definition at line 81 of file Service.cpp.

Queue* ServerActiveReqHashCounters[]

Definition at line 98 of file Service.cpp.

const UINT ServerReqBounds[]

Definition at line 78 of file Service.cpp.

Queue* ServerReqQueues[]

Definition at line 97 of file Service.cpp.

SERVICE_STATUS_HANDLE sshStatusHandle

Definition at line 115 of file Service.cpp.

SERVICE_STATUS ssStatus

Definition at line 118 of file Service.cpp.

Generated on Wed Nov 13 2024 16:54:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/filerepmultiuser/common.cpp File Reference

  • NetDS
  • RPC
  • FileRep
  • filerepmultiuser
Functions | Variables

common.cpp File Reference

#include <windows.h>
#include <tchar.h>
#include <stdio.h>
#include <stdlib.h>
#include <crtdbg.h>
#include "common.h"

Go to the source code of this file.

Functions

VOID * | AutoHeapAlloc (size_t dwBytes)
VOID | AutoHeapFree (VOID *lpMem)
VOID | GetEEInfoText (TCHAR *Msg, UINT BuffSize, UINT *MsgSize)
VOID | PrintProcFailureEEInfo (LPTSTR ProcName, DWORD ErrCode)

Variables

HANDLE | hProcessHeap = NULL

Function Documentation

VOID* AutoHeapAlloc ( size_t dwBytes )

Definition at line 110 of file common.cpp.

                                     {
    if (hProcessHeap == NULL) {
        hProcessHeap = GetProcessHeap();
    }
    return HeapAlloc(hProcessHeap, 0, dwBytes);
}

VOID AutoHeapFree ( VOID * lpMem )

Definition at line 117 of file common.cpp.

                                {
    DWORD status;
    ASSERTE(hProcessheap != NULL);
    status = HeapFree(hProcessHeap, 0, lpMem);
    ASSERTE(status);
}

VOID GetEEInfoText | ( | TCHAR * | Msg,
 |  | UINT | BuffSize,
 |  | UINT * | MsgSize
 | ) |  |

Definition at line 23 of file common.cpp.

                                                             {
    RPC_STATUS status;
    RPC_ERROR_ENUM_HANDLE EnumHandle;

  *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("EEInfo:\n"));

    status = RpcErrorStartEnumeration(&EnumHandle);

    if (status == RPC_S_ENTRY_NOT_FOUND) {
        *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("no EEInfo found\n"));
    }
    else if (status != RPC_S_OK) {
        *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("could not get EEInfo\n"));
    }
    else {
        RPC_EXTENDED_ERROR_INFO ErrorInfo;

        while (status == RPC_S_OK) {
            ErrorInfo.Version = RPC_EEINFO_VERSION;
            ErrorInfo.Flags = 0;
            ErrorInfo.NumberOfParameters = 4;

            status = RpcErrorGetNextRecord(&EnumHandle, FALSE, &ErrorInfo);
            if (status == RPC_S_ENTRY_NOT_FOUND) {
                break;
            }
            else if (status != RPC_S_OK) {
                *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("enumeration broke with status %d\n"), status);
                break;
            }
            else {
                INT i;

                *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("GeneratingComponent: %d\n"), ErrorInfo.GeneratingComponent);
                *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("Status: %d\n"), ErrorInfo.Status);
                *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("Detection Location: %d\n"), ErrorInfo.DetectionLocation);
                *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("Flags: %d\n"), ErrorInfo.Flags);
                *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("NumberOfParameters: %d\n"), ErrorInfo.NumberOfParameters);

                for (i = 0; i < ErrorInfo.NumberOfParameters; i++) {
                    switch (ErrorInfo.Parameters[i].ParameterType) {
                    case eeptAnsiString:
                        *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("AnsiString: %s\n"), ErrorInfo.Parameters[i].u.AnsiString);
                        break;

                    case eeptUnicodeString:
                        *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("UnicodeString: %S\n"), ErrorInfo.Parameters[i].u.UnicodeString);
                        break;

                    case eeptLongVal:
                        *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("LongVal: %d\n"), ErrorInfo.Parameters[i].u.LVal);
                        break;

                    case eeptShortVal:
                        *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("ShortVal: %d\n"), ErrorInfo.Parameters[i].u.SVal);
                        break;

                    case eeptPointerVal:
                        *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("PointerVal: %d\n"), ErrorInfo.Parameters[i].u.PVal);
                        break;

                    case eeptNone:
                        *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("Invalid type of parameter %d\n"), ErrorInfo.Parameters[i].ParameterType);
                        break;

                    default:
                        *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("Invalid type of parameter %d\n"), ErrorInfo.Parameters[i].ParameterType);
                    }
                }
            }
        }
    }
}

VOID PrintProcFailureEEInfo | ( | LPTSTR | ProcName,
 |  | DWORD | ErrCode
 | ) |  |

Definition at line 97 of file common.cpp.

                                                            {
    TCHAR Msg[MSG_SIZE];
    UINT MsgSize = 0;

    MsgSize += _stprintf(&Msg[MsgSize], TEXT("%s failed with code %d\n"), ProcName, ErrCode);
  GetEEInfoText(Msg, MSG_SIZE, &MsgSize);

  Msg[MsgSize] = 0;

    _tprintf(TEXT("%s"), Msg);
}

Variable Documentation

HANDLE hProcessHeap = NULL

Definition at line 21 of file common.cpp.

Generated on Wed Nov 13 2024 16:53:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/filerepmultiuser/common.h File Reference

  • NetDS
  • RPC
  • FileRep
  • filerepmultiuser
Defines | Functions

common.h File Reference

#include <windows.h>
#include <crtdbg.h>

Go to the source code of this file.

Defines

#define | ASSERTE _ASSERTE
#define | EXIT_IF_FAIL(x, string)
#define | MSG_SIZE (256)
#define | RPC_EEINFO_EXIT_IF_FAIL(x, string)

Functions

VOID * | AutoHeapAlloc (size_t dwBytes)
VOID | AutoHeapFree (VOID *lpMem)
VOID | GetEEInfoText (TCHAR *Msg, UINT BuffSize, UINT *MsgSize)
VOID | PrintProcFailureEEInfo (LPTSTR ProcName, DWORD ErrCode)

Define Documentation

#define ASSERTE _ASSERTE

Definition at line 30 of file common.h.

#define EXIT_IF_FAIL | ( | x,
 |  | string
 | ) |
Value:
{ \
        ((x) != RPC_S_OK) ? _tprintf(TEXT("%s failed with error %d\n"), \
        TEXT(string), (x)), exit(EXIT_FAILURE) : 0;}

Definition at line 20 of file common.h.

#define MSG_SIZE (256)

Definition at line 34 of file common.h.

#define RPC_EEINFO_EXIT_IF_FAIL | ( | x,
 |  | string
 | ) |
Value:
{ \
        ((x) != RPC_S_OK) ? PrintProcFailureEEInfo(string, x), \
        exit(EXIT_FAILURE) : 0;}

Definition at line 24 of file common.h.

Function Documentation

VOID* AutoHeapAlloc ( size_t dwBytes )

Definition at line 108 of file common.cpp.

                                     {
    if (hProcessHeap == NULL) {
        hProcessHeap = GetProcessHeap();
    }
    return HeapAlloc(hProcessHeap, 0, dwBytes);
}

VOID AutoHeapFree ( VOID * lpMem )

Definition at line 115 of file common.cpp.

                                {
    DWORD status;
    ASSERT(hProcessHeap != NULL);
    status = HeapFree(hProcessHeap, 0, lpMem);
    ASSERT(status);
}

VOID GetEEInfoText | ( | TCHAR * | Msg,
 |  | UINT | BuffSize,
 |  | UINT * | MsgSize
 | ) |  |

Definition at line 21 of file common.cpp.

                                                             {
    RPC_STATUS status;
    RPC_ERROR_ENUM_HANDLE EnumHandle;

  *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("EEInfo:\n"));

    status = RpcErrorStartEnumeration(&EnumHandle);

    if (status == RPC_S_ENTRY_NOT_FOUND) {
        *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("no EEInfo found\n"));
    }
    else if (status != RPC_S_OK) {
        *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("could not get EEInfo\n"));
    }
    else {
        RPC_EXTENDED_ERROR_INFO ErrorInfo;

        while (status == RPC_S_OK) {
            ErrorInfo.Version = RPC_EEINFO_VERSION;
            ErrorInfo.Flags = 0;
            ErrorInfo.NumberOfParameters = 4;

            status = RpcErrorGetNextRecord(&EnumHandle, FALSE, &ErrorInfo);
            if (status == RPC_S_ENTRY_NOT_FOUND) {
                break;
            }
            else if (status != RPC_S_OK) {
                *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("enumeration broke with status %d\n"), status);
                break;
            }
            else {
                INT i;

                *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("GeneratingComponent: %d\n"), ErrorInfo.GeneratingComponent);
                *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("Status: %d\n"), ErrorInfo.Status);
                *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("Detection Location: %d\n"), ErrorInfo.DetectionLocation);
                *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("Flags: %d\n"), ErrorInfo.Flags);
                *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("NumberOfParameters: %d\n"), ErrorInfo.NumberOfParameters);

                for (i = 0; i < ErrorInfo.NumberOfParameters; i++) {
                    switch (ErrorInfo.Parameters[i].ParameterType) {
                    case eeptAnsiString:
                        *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("AnsiString: %s\n"), ErrorInfo.Parameters[i].u.AnsiString);
                        break;

                    case eeptUnicodeString:
                        *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("UnicodeString: %S\n"), ErrorInfo.Parameters[i].u.UnicodeString);
                        break;

                    case eeptLongVal:
                        *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("LongVal: %d\n"), ErrorInfo.Parameters[i].u.LVal);
                        break;

                    case eeptShortVal:
                        *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("ShortVal: %d\n"), ErrorInfo.Parameters[i].u.SVal);
                        break;

                    case eeptPointerVal:
                        *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("PointerVal: %d\n"), ErrorInfo.Parameters[i].u.PVal);
                        break;

                    case eeptNone:
                        *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("Invalid type of parameter %d\n"), ErrorInfo.Parameters[i].ParameterType);
                        break;

                    default:
                        *MsgSize += _sntprintf(&Msg[*MsgSize], BuffSize - *MsgSize, TEXT("Invalid type of parameter %d\n"), ErrorInfo.Parameters[i].ParameterType);
                    }
                }
            }
        }
    }
}

VOID PrintProcFailureEEInfo | ( | LPTSTR | ProcName,
 |  | DWORD | ErrCode
 | ) |  |

Definition at line 95 of file common.cpp.

                                                            {
    TCHAR Msg[MSG_SIZE];
    UINT MsgSize = 0;

    MsgSize += _stprintf(&Msg[MsgSize], TEXT("%s failed with code %d\n"), ProcName, ErrCode);
  GetEEInfoText(Msg, MSG_SIZE, &MsgSize);

  Msg[MsgSize] = 0;

    _tprintf(TEXT("%s"), Msg);
}

Generated on Wed Nov 13 2024 16:53:11 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/filerepmultiuser/dbgmsg.cpp File Reference

  • NetDS
  • RPC
  • FileRep
  • filerepmultiuser
Functions | Variables

dbgmsg.cpp File Reference

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <process.h>
#include <tchar.h>
#include "DbgMsg.h"
#include "Service.h"
#include "common.h"

Go to the source code of this file.

Functions

VOID | DbgMsgCloseLog (VOID)
VOID | DbgMsgOpenLog (LPTSTR LogFileName)
VOID | DbgMsgRecord (LPTSTR msg)

Variables

CRITICAL_SECTION | DbgMsgCriticalSection
HANDLE | hDbgMsgLog = NULL
UINT | nDbgMsgLogSize = 0

Function Documentation

VOID DbgMsgCloseLog ( VOID )

Definition at line 74 of file dbgmsg.cpp.

                          {
    DWORD status;

    // Delete and the critsec.
    DeleteCriticalSection(&DbgMsgCriticalSection);

    // Close the debug log.
    if (hDbgMsgLog != NULL && hDbgMsgLog != INVALID_HANDLE_VALUE) {
        status = CloseHandle(hDbgMsgLog);
        ASSERTE(status);
    }
}

VOID DbgMsgOpenLog ( LPTSTR LogFileName )

Definition at line 30 of file dbgmsg.cpp.

                                       {

    // Init the critsec.
    if (InitializeCriticalSectionAndSpinCount(&DbgMsgCriticalSection, 0) == 0) {
        AddToMessageLogProcFailure(TEXT("DbgMsgOpenLog: InitializeCriticalSectionAndSpinCount"), GetLastError());
        return;
    }

    // Open the profiling log.
    if ((hDbgMsgLog = CreateFile(LogFileName,
                               GENERIC_WRITE,
                               0,
                               NULL,
                               CREATE_ALWAYS,
                               FILE_ATTRIBUTE_NORMAL,
                               NULL)) == INVALID_HANDLE_VALUE) {
        AddToMessageLogProcFailure(TEXT("DbgMsgOpenLog: CreateFile"), GetLastError());
    }
}

VOID DbgMsgRecord ( LPTSTR msg )

Definition at line 50 of file dbgmsg.cpp.

                              {
    ULONG cbWritten;

    EnterCriticalSection(&DbgMsgCriticalSection);

    // Write the entry only if there is enough space left in
    // the log.
    if (nDbgMsgLogSize < DEBUG_LOG_MAX_SIZE + _tcslen(msg)) {

        // Append the entry to the log.
        nDbgMsgLogSize += _tcslen(msg);
        if(!WriteFile(hDbgMsgLog,
                      (LPVOID)msg,
                      _tcslen(msg)*sizeof(TCHAR),
                      &cbWritten,
                      NULL)) {
            AddToMessageLogProcFailure(TEXT("DbgMsgRecord: WriteFile"), GetLastError());
        }
    }

    LeaveCriticalSection(&DbgMsgCriticalSection);
    return;
}

Variable Documentation

CRITICAL_SECTION DbgMsgCriticalSection

Definition at line 28 of file dbgmsg.cpp.

HANDLE hDbgMsgLog = NULL

Definition at line 23 of file dbgmsg.cpp.

UINT nDbgMsgLogSize = 0

Definition at line 26 of file dbgmsg.cpp.

Generated on Wed Nov 13 2024 16:53:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/filerepmultiuser/dbgmsg.h File Reference

  • NetDS
  • RPC
  • FileRep
  • filerepmultiuser
Defines | Functions | Variables

dbgmsg.h File Reference

Go to the source code of this file.

Defines

#define | DEBUG_LOG_MAX_SIZE (10*1024*1024)

Functions

VOID | DbgMsgCloseLog (VOID)
VOID | DbgMsgOpenLog (LPTSTR LogFileName)
VOID | DbgMsgRecord (LPTSTR msg)

Variables

CRITICAL_SECTION | DbgMsgCriticalSection

Define Documentation

#define DEBUG_LOG_MAX_SIZE (10*1024*1024)

Definition at line 21 of file dbgmsg.h.

Function Documentation

VOID DbgMsgCloseLog ( VOID )

Definition at line 69 of file DbgMsg.cpp.

                          {
    DWORD status;

    // Delete and the critsec.
    DeleteCriticalSection(&DbgMsgCriticalSection);

    // Close the debug log.
    if (hDbgMsgLog != NULL && hDbgMsgLog != INVALID_HANDLE_VALUE) {
        status = CloseHandle(hDbgMsgLog);
        ASSERT(status);
    }
}

VOID DbgMsgOpenLog ( LPTSTR LogFileName )

Definition at line 25 of file DbgMsg.cpp.

                                       {

    // Init the critsec.
    if (InitializeCriticalSectionAndSpinCount(&DbgMsgCriticalSection, 0) == 0) {
        AddToMessageLogProcFailure(TEXT("DbgMsgOpenLog: InitializeCriticalSectionAndSpinCount"), GetLastError());
        return;
    }

    // Open the profiling log.
    if ((hDbgMsgLog = CreateFile(LogFileName,
                               GENERIC_WRITE,
                               0,
                               NULL,
                               CREATE_ALWAYS,
                               FILE_ATTRIBUTE_NORMAL,
                               NULL)) == INVALID_HANDLE_VALUE) {
        AddToMessageLogProcFailure(TEXT("DbgMsgOpenLog: CreateFile"), GetLastError());
    }
}

VOID DbgMsgRecord ( LPTSTR msg )

Definition at line 45 of file DbgMsg.cpp.

                              {
    ULONG cbWritten;

    EnterCriticalSection(&DbgMsgCriticalSection);

    // Write the entry only if there is enough space left in
    // the log.
    if (nDbgMsgLogSize < DEBUG_LOG_MAX_SIZE + _tcslen(msg)) {

        // Append the entry to the log.
        nDbgMsgLogSize += _tcslen(msg);
        if(!WriteFile(hDbgMsgLog,
                      (LPVOID)msg,
                      _tcslen(msg)*sizeof(TCHAR),
                      &cbWritten,
                      NULL)) {
            AddToMessageLogProcFailure(TEXT("DbgMsgRecord: WriteFile"), GetLastError());
        }
    }

    LeaveCriticalSection(&DbgMsgCriticalSection);
    return;
}

Variable Documentation

CRITICAL_SECTION DbgMsgCriticalSection

Definition at line 23 of file DbgMsg.cpp.

Generated on Wed Nov 13 2024 16:53:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/filerepmultiuser/filerep.cpp File Reference

  • NetDS
  • RPC
  • FileRep
  • filerepmultiuser
Functions

filerep.cpp File Reference

#include <stdio.h>
#include <stdlib.h>
#include <process.h>
#include <tchar.h>
#include <rpc.h>
#include <Ntdsapi.h>
#include "common.h"
#include "Service.h"
#include "FileRepClient.h"

Go to the source code of this file.

Functions

INT _cdecl | main (int argc, char **argv)
VOID __RPC_FAR *__RPC_API | midl_user_allocate (size_t len)
VOID __RPC_API | midl_user_free (VOID __RPC_FAR *ptr)
void | PrintUsage (TCHAR *ProgName)

Function Documentation

INT _cdecl main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 80 of file filerep.cpp.

                                       {

    INT i;
    RPC_STATUS rpcstatus;

    // Controlls printing out of messages.
    BOOL bDebug = FALSE;

    // Explicit binding handle to the client system service.
    handle_t hFileRepClient = NULL;

    // These are the default values for extablishing connections.
    // Default connection is to a local server over local rpc.
    LPTSTR pszProtocolSequence = TEXT("ncalrpc");
    LPTSTR pszNetworkAddress = NULL;

    // An empty endpoint string is used, since we are going to
    // connect to the endpoint dynamically generated by the
    // RPC run-time library.  Server calls RpcServerUseProtseq to
    // obtain a binding hadnle and a dynamic endpoint.
    LPTSTR pszEndpoint = TEXT("");

    LPTSTR pszUuid = NULL;
    LPTSTR pszOptions = NULL;
    LPTSTR pszStringBinding = NULL;

    LPTSTR ServerName = NULL;
    LPTSTR RemoteFileName = NULL;
    LPTSTR LocalFileName = NULL;

    INT nNumArgs;

    // Quality of service structure to ensure authentication.
    RPC_SECURITY_QOS SecurityQOS;

    // Used in generating the principal name for the local system service.
    TCHAR Name[128];
    DWORD cbName = sizeof(Name);
    TCHAR DomainName[128];
    DWORD cbDomainName = sizeof(DomainName);
    SID_NAME_USE Use;
    SID_IDENTIFIER_AUTHORITY SIDAuth = SECURITY_NT_AUTHORITY;
    BYTE sidBuffer[100];
    PSID pSID = (PSID)&sidBuffer;

    // Get a common handle on the command line arguments for both
    // UNICODE and ASCII
#ifdef _UNICODE
    LPWSTR *szArgList = CommandLineToArgvW(GetCommandLine(), &nNumArgs);
    if (NULL == szArgList) {
        _tprintf(TEXT("FileRep main: CommandLineToArgW failed"));
        exit(EXIT_FAILURE);
    }
#else
    char **szArgList = argv;
    nNumArgs = argc;
#endif

    // Check that the correct number of arguments is given.
    if(nNumArgs<4){
        PrintUsage(szArgList[0]);
        exit(EXIT_FAILURE);
    }

    // Extract the required arguments.
    ServerName = szArgList[1];
    RemoteFileName = szArgList[2];
    LocalFileName = szArgList[3];

    // Allow the user to override settings with command line switches.
    for (i = 4; i < nNumArgs; i++) {
        // Well-formed argument switches start with '/' or '-' and are
        // two characters long.
        if (((*szArgList[i] == TEXT('-')) || (*szArgList[i] == TEXT('/'))) && _tcsclen(szArgList[i]) == 2) {

            switch (_totlower(*(szArgList[i]+1))) {

                case TEXT('p'):

                    // Override protocol sequence.

                    // Check that the next argument exists and is not a
                    // switch.
                    if(i+1 < nNumArgs && *szArgList[i+1] != TEXT('-') && *szArgList[i+1] != TEXT('/')) {
                        pszProtocolSequence = szArgList[++i];
                    }
                    // Otherwise we have an empty protocol sequence.
                    else {
                        // We do not allow an empty protocol sequence.
                        _tprintf(TEXT("Protocol sequence can't be \"\".\n"));
                        exit(EXIT_FAILURE);
                    }

                    break;

                case TEXT('n'):

                    // Override the network address.
                    if(i+1 < nNumArgs && *szArgList[i+1] != TEXT('-') && *szArgList[i+1] != TEXT('/')) {
                        pszNetworkAddress = szArgList[++i];
                    }
                    else {
                        pszNetworkAddress = TEXT("");
                    }

                    break;

                case TEXT('e'):

                    // Override the endpoint.
                    if(i+1 < nNumArgs && *szArgList[i+1] != TEXT('-') && *szArgList[i+1] != TEXT('/')) {
                        pszEndpoint = szArgList[++i];
                    }
                    else {
                        pszEndpoint = TEXT("");
                    }

                    break;

                case TEXT('d'):
                    // Turn on debugging.
                    bDebug = TRUE;
                    break;

                case TEXT('h'):
                case TEXT('?'):
                default:
                    PrintUsage(szArgList[0]);
                    exit(EXIT_SUCCESS);
            }
        }
        else {
            PrintUsage(szArgList[0]);
            exit(EXIT_FAILURE);
        }
    }

    // Concatenate the elements of
    // the string binding into the proper sequence.
    rpcstatus = RpcStringBindingCompose(pszUuid,
                                        pszProtocolSequence,
                                        pszNetworkAddress,
                                        pszEndpoint,
                                        pszOptions,
                                        &pszStringBinding);
    if(bDebug){
        _tprintf(TEXT("RpcStringBindingCompose returned 0x%x\n"), rpcstatus);
        _tprintf(TEXT("pszStringBinding = %s\n"), pszStringBinding);
    }
    RPC_EEINFO_EXIT_IF_FAIL(rpcstatus, TEXT("RpcStringBindingCompose"));

    // Set the binding handle that will be used to bind to the server.
    rpcstatus = RpcBindingFromStringBinding(pszStringBinding, &hFileRepClient);
    if(bDebug) _tprintf(TEXT("RpcBindingFromStringBinding returned 0x%x\n"), rpcstatus);
    RPC_EEINFO_EXIT_IF_FAIL(rpcstatus, TEXT("RpcBindingFromStringBinding"));

    // Free the binding string.
    rpcstatus = RpcStringFree(&pszStringBinding);
    ASSERTE(rpcstatus == RPC_S_OK);

    // Specify quality of service parameters.
    SecurityQOS.Version = RPC_C_SECURITY_QOS_VERSION;
    SecurityQOS.Capabilities = RPC_C_QOS_CAPABILITIES_MUTUAL_AUTH;
    // Dynamic identity tracking is more efficient for a single LRPC call.
    SecurityQOS.IdentityTracking = RPC_C_QOS_IDENTITY_DYNAMIC;
    // The client system service needs to impersonate the security context
    // of the client utility on the remote systems where it may replicate
    // files from.
    // We need to impersonate with level delegate, since the server system
    // service will need to impersonate the user further.
    SecurityQOS.ImpersonationType = RPC_C_IMP_LEVEL_DELEGATE;

    // Generate the principal name for the local system service.
    // We can't just use the a string constant, because then
    // we rely on a particular English-language representation of the
    // principal.

    if (AllocateAndInitializeSid(&SIDAuth, 1,
                                 SECURITY_NETWORK_SERVICE_RID,
                                 0, 0, 0, 0, 0, 0, 0,
                                 &pSID) == 0) {
        printf("AllocateAndInitializeSid failed\n");
        exit(EXIT_FAILURE);
    }

    if (LookupAccountSid(NULL, // name of local or remote computer
                         pSID, // security identifier
                         Name, // account name buffer
                         &cbName, // size of account name buffer
                         DomainName, // domain name
                         &cbDomainName, // size of domain name buffer
                         &Use) == 0) { // SID type
        printf("LookupAccountSid failed\n");
        exit(EXIT_FAILURE);
    }

    if(bDebug) _tprintf(TEXT("Server \"magic name\" is %s\n"), Name);

    // Set authentication and authorisation information for
    // the binding handle.
    // By speciying NULL for the 5th parameter we use the security login
    // context for the current address space.
    // The security level is "PRIVACY" since it is the only level
    // provided by LRPC.
    // We are assured of talking to a local service running with
    // system privileges.
    rpcstatus = RpcBindingSetAuthInfoEx(hFileRepClient, Name, RPC_C_AUTHN_LEVEL_PKT_PRIVACY, RPC_C_AUTHN_WINNT, NULL, NULL, &SecurityQOS);
    RPC_EEINFO_EXIT_IF_FAIL(rpcstatus, TEXT("RpcBindingSetAuthInfo"));

    // Make the RPC to request file replication.
    RpcTryExcept {
        if(bDebug) _tprintf(TEXT("Calling the remote procedure RequestFile(hFileRepClient, %s, %s, %s)\n"), ServerName, RemoteFileName, LocalFileName);

        RequestFile(hFileRepClient, ServerName, RemoteFileName, LocalFileName);

        if(bDebug) _tprintf(TEXT("RequestFile() finished\n"));
    }
    // Return "non-fatal" errors.  Catching fatal errors
    // makes it harder to debug.
    RpcExcept ( ( (RpcExceptionCode() != STATUS_ACCESS_VIOLATION) &&
                  (RpcExceptionCode() != STATUS_DATATYPE_MISALIGNMENT) &&
                  (RpcExceptionCode() != STATUS_PRIVILEGED_INSTRUCTION) &&
                  (RpcExceptionCode() != STATUS_ILLEGAL_INSTRUCTION) &&
                  (RpcExceptionCode() != STATUS_BREAKPOINT))
                  ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH ) {

      PrintProcFailureEEInfo(TEXT("RequestFile"), RpcExceptionCode());
        exit(EXIT_FAILURE);
    }
    RpcEndExcept;

    // Free the binding.
    rpcstatus = RpcBindingFree((VOID **)&hFileRepClient);
    ASSERTE(rpcstatus == RPC_S_OK);

    if(bDebug) _tprintf(TEXT("Success!\n"));

    return(EXIT_SUCCESS);

} // end main()

VOID __RPC_FAR* __RPC_API midl_user_allocate ( size_t len )

Definition at line 325 of file filerep.cpp.

                                                          {
    return(AutoHeapAlloc(len));
}

VOID __RPC_API midl_user_free ( VOID __RPC_FAR * ptr )

Definition at line 329 of file filerep.cpp.

                                                    {
    if(ptr != NULL) {
        AutoHeapFree(ptr);
    }
}

void PrintUsage ( TCHAR * ProgName )

Definition at line 54 of file filerep.cpp.

                                 {
    _tprintf(TEXT("%s - File Replication Client Utility\n\n"), ProgName);
    _tprintf(TEXT("Usage: %s [server name] [remote file] [local file] <options...> \n\n"), ProgName);
    _tprintf(TEXT("Options:\n"));
    _tprintf(TEXT(" -p protocol_sequence\n"));
    _tprintf(TEXT(" -n network_address\n"));
    _tprintf(TEXT(" -e endpoint\n"));
    _tprintf(TEXT(" -d print messages\n"));
}

Generated on Wed Nov 13 2024 16:53:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/filerepmultiuser/filerepclient.idl File Reference

  • NetDS
  • RPC
  • FileRep
  • filerepmultiuser
Classes

filerepclient.idl File Reference

Go to the source code of this file.

Classes

interface FileRepClient
Generated on Wed Nov 13 2024 16:53:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/filerepmultiuser/filerepclientproc.cpp File Reference

  • NetDS
  • RPC
  • FileRep
  • filerepmultiuser
Classes | Typedefs | Enumerations | Functions | Variables

filerepclientproc.cpp File Reference

#include <stdlib.h>
#include <stdio.h>
#include <tchar.h>
#include <rpc.h>
#include <Ntdsapi.h>
#include <time.h>
#include "common.h"
#include "FileRepClient.h"
#include "FileRepServer.h"
#include "Service.h"

Go to the source code of this file.

Classes

struct | tReq

Typedefs

typedef struct tReq | Req
typedef enum tReqState | ReqState

Enumerations

enum tReqState {
StateArrived, StateQueued, StateActive, StateArrived,
StateQueued, StateActive
}

Functions

VOID | HandleActiveReq (tReq *pReq)
VOID | HandleReq (tReq *pReq)
BOOL | IsSecureClient (handle_t hFileRepClient, Req *pReq)
VOID | RequestFile (handle_t hFileRepClient, LPTSTR ServerName, LPTSTR RemoteFileName, LPTSTR LocalFileName)
VOID | ServiceRequests (BOOL bIsRPCThread)
VOID | ShutdownThread (Req *pReq)

Variables

const time_t | tServerThread = 5

Typedef Documentation

typedef struct tReq Req
typedef enum tReqState ReqState

Enumeration Type Documentation

enum tReqState
Enumerator:
StateArrived
StateQueued
StateActive
StateArrived
StateQueued
StateActive

Definition at line 48 of file filerepclientproc.cpp.

                       {
    StateArrived,
    StateQueued,
    StateActive
} ReqState;

Function Documentation

VOID HandleActiveReq ( tReq * pReq )

Definition at line 406 of file filerepclientproc.cpp.

                                 {

    BYTE pbBuf[MAX_BUFSIZE];

    ULONG cbRead, cbWritten;

    //
    // If a request for process is picked of the active request queue.
    // Then we simply need to read another segment and finish the request
    // if necessary.
    //

    // Get the remainder of text from the remote file.  When the
    // server returns a NULL context handle, the read has completed and
    // the file has been closed.

    // We did not read anything yet.
    cbRead = 0;

#ifdef RETRY_EXCEPTION
    // When making aggressive calls to the server, this flag is
    // set when the call succeeded.  This makes the client service attempt
    // to contact the server even after an exception occured.
    BOOL bRetryCall = TRUE;
    while (bRetryCall) {
#endif

        RpcTryExcept {
            c_RemoteRead(pReq->hFileRepServer,
                         &(pReq->phContext),
                         pbBuf,
                         &cbRead);
#ifdef RETRY_EXCEPTION
            bRetryCall = FALSE;
#endif
        }
        RpcExcept ( ( (RpcExceptionCode() != STATUS_ACCESS_VIOLATION) &&
                      (RpcExceptionCode() != STATUS_DATATYPE_MISALIGNMENT) &&
                      (RpcExceptionCode() != STATUS_PRIVILEGED_INSTRUCTION) &&
                      (RpcExceptionCode() != STATUS_ILLEGAL_INSTRUCTION) &&
                      (RpcExceptionCode() != STATUS_BREAKPOINT))
                    ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH ) {

            // Log the error code as well as the error.
            // Msg is sufficiently large and can't overflow.
            AddToMessageLogProcFailureEEInfo(TEXT("HandleActiveReq: c_RemoteRead"), RpcExceptionCode());

#ifdef RETRY_EXCEPTION
            // This code attempts to make aggressive calls, retrying
            // if no endpoints were available.  It is used to put servers
            // under stress.
            if (RpcExceptionCode() != EPT_S_NOT_REGISTERED &&
                RpcExceptionCode() != RPC_S_SERVER_UNAVAILABLE) {
#endif
                // Dump this request.
                ShutdownThread(pReq);
                return;
#ifdef RETRY_EXCEPTION
            }
#endif
        }
        RpcEndExcept;
#ifdef RETRY_EXCEPTION
    }
#endif

    // Access check was done on opening when we were impersonating.
    // Thus we do not need to impersonate in this code.
    if(!WriteFile(pReq->hLocalFile,
                  pbBuf,
                  cbRead,
                  &cbWritten,
                  NULL)) {

        AddToMessageLogProcFailure(TEXT("HandleActiveReq: WriteFile failed with code %d"), GetLastError());
        ShutdownThread(pReq);
        return;
    }

    if (pReq->phContext == NULL) {
#ifdef PROF
        ProfRecordTime(pReq->nReqId, TEXT("handled"));
#endif
        ShutdownThread(pReq);
    }
    else {
        // We are not done and the request needs to go back onto queue.
        // Put the request onto the appropriate active request queue.
        QueueHashAddToSubqueue(ClientActiveReqHashQueues[pReq->Pri], pReq->pSID, pReq);

#ifdef DEBUG
        TCHAR Msg[MSG_SIZE];

        _stprintf(Msg, TEXT("RequestFile: Put req %p onto ActiveReq queue %p\n"), pReq, ClientActiveReqHashQueues[pReq->Pri]);
        DbgMsgRecord(Msg);
#endif
    }
}

VOID HandleReq ( tReq * pReq )

Definition at line 181 of file filerepclientproc.cpp.

                           {

    BYTE pbBuf[MAX_BUFSIZE];

    RPC_STATUS rpcstatus;

    ULONG cbRead, cbWritten;

    // Default connection to server system service is over TCP/IP.
    LPTSTR DefaultProtocolSequence = TEXT("ncacn_ip_tcp");

    // An empty endpoint string is used, since we are going to
    // connect to the endpoint dynamically generated by the
    // RPC run-time library.    Server calls RpcServerUseProtseq to
    // obtain a binding hadnle and a dynamic endpoint.
    LPTSTR DefaultEndpoint = TEXT("");

    LPTSTR pszUuid = NULL;
    LPTSTR pszOptions = NULL;
    LPTSTR pszStringBinding = NULL;

    BOOL FoundReq = TRUE;
    BOOL FoundActiveReq = TRUE;

    //
    // If a request is picked of the request queue.
    // Then we need to set up binding, bind to the server,
    // and do the initial read.
    //

    // We need to impersonate the user that has issued the
    // remote call.
    // We want to impersonate as soon as possible to minimise
    // the amount of resources that can be consumed by an attack.
    if (ImpersonateLoggedOnUser(pReq->hTokenHandle) == 0) {
        ShutdownThread(pReq);
        AddToMessageLogProcFailure(TEXT("HandleReq: ImpersonateLoggedOnUser"), GetLastError());
        return;
    }
    pReq->bImpersonating = TRUE;

    // Prepare the binding information.
    if ((rpcstatus = RpcStringBindingCompose(pszUuid,
                                             DefaultProtocolSequence,
                                             pReq->ServerName,
                                             DefaultEndpoint,
                                             pszOptions,
                                             &pszStringBinding)) != RPC_S_OK) {
        ShutdownThread(pReq);
        AddToMessageLogProcFailureEEInfo(TEXT("HandleReq: RpcStringBindingCompose"), rpcstatus);
        return;
    }

    if ((rpcstatus = RpcBindingFromStringBinding(pszStringBinding, &(pReq->hFileRepServer))) != RPC_S_OK) {
        // The binding handle is invalid
        pReq->hFileRepServer = NULL;

        // Deallocate the string binding.
        rpcstatus = RpcStringFree(&pszStringBinding);
        ASSERTE(rpcstatus == RPC_S_OK);

        ShutdownThread(pReq);
        AddToMessageLogProcFailureEEInfo(TEXT("HandleReq: RpcBindingFromStringBinding"), rpcstatus);
        return;
    }

    // We need to delete the string binding, since it is no longer
    // necessary.  All the binding information is now contained in the
    // binding handle.
    rpcstatus = RpcStringFree(&pszStringBinding);
    ASSERTE(rpcstatus == RPC_S_OK);

    DWORD status;

    // Quality of service structure to ensure authentication.
    RPC_SECURITY_QOS SecurityQOS;

    // The length of the principal name and the principal name
    // for the client system service.
    TCHAR szSpn[MAX_PATH];
    ULONG ulSpn = sizeof(szSpn);

    // Generate a principal name for the local system service.
    if ((status = DsMakeSpn(SERVICENAME,
                            pReq->ServerName,
                            NULL,
                            0,
                            0,
                            &ulSpn,
                            szSpn)) != ERROR_SUCCESS) {
        ShutdownThread(pReq);
        AddToMessageLogProcFailure(TEXT("HandleReq: DsMakeSpn"), GetLastError());
        return;
    }

    // Specify quality of service parameters.
    SecurityQOS.Version = RPC_C_SECURITY_QOS_VERSION;
    SecurityQOS.Capabilities = RPC_C_QOS_CAPABILITIES_MUTUAL_AUTH;
    // Use static identity tracking since we will be issuing multiple
    // RPC calls from this thread with different identities: while
    // impersonating, and while not.  This insures that all the calls will
    // go to server under the identity of the user who created the binding
    // handle.
    SecurityQOS.IdentityTracking = RPC_C_QOS_IDENTITY_STATIC;
    // The client system service needs to impersonate the security context
    // of the client utility on the remote systems where it may replicate
    // files from.  It will also need to obtain client's SID and hence
    // requires impersonation.
    SecurityQOS.ImpersonationType = RPC_C_IMP_LEVEL_IMPERSONATE;

    // Set authentification and authorisation information for
    // the binding handle.
    if ((rpcstatus = RpcBindingSetAuthInfoEx(pReq->hFileRepServer, szSpn, RPC_C_AUTHN_LEVEL_PKT_PRIVACY, RPC_C_AUTHN_GSS_KERBEROS, NULL, RPC_C_AUTHZ_NAME, &SecurityQOS)) != RPC_S_OK) {

        ShutdownThread(pReq);
        AddToMessageLogProcFailureEEInfo(TEXT("HandleReq: RpcBindingSetAuthInfoEx"), rpcstatus);
        return;
    }

    // We did not read anything yet.
    cbRead = 0;

#ifdef RETRY_EXCEPTION
    // When making aggressive calls to the server, this flag is
    // set when the call succeeded.  This makes the client service attempt
    // to contact the server even after an exception occured.
    BOOL bRetryCall = TRUE;
    while (bRetryCall) {
#endif

        // Attempt to open the remote file.
        RpcTryExcept {
            c_RemoteOpen(pReq->hFileRepServer,
                         &(pReq->phContext),
                         pReq->RemoteFileName,
                         pbBuf,
                         &cbRead);
#ifdef RETRY_EXCEPTION
            bRetryCall = FALSE;
#endif
        }
        RpcExcept ( ( (RpcExceptionCode() != STATUS_ACCESS_VIOLATION) &&
                      (RpcExceptionCode() != STATUS_DATATYPE_MISALIGNMENT) &&
                      (RpcExceptionCode() != STATUS_PRIVILEGED_INSTRUCTION) &&
                      (RpcExceptionCode() != STATUS_ILLEGAL_INSTRUCTION) &&
                      (RpcExceptionCode() != STATUS_BREAKPOINT) )
                    ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH ) {

#ifdef RETRY_EXCEPTION
            // This code attempts to make aggressive calls, retrying
            // if no endpoints are available.  It is used to put servers
            // under stress.
            if (RpcExceptionCode() != EPT_S_NOT_REGISTERED &&
                RpcExceptionCode() != RPC_S_SERVER_UNAVAILABLE) {
#endif
                // Deallocate all the thread data before failing.
                ShutdownThread(pReq);
                AddToMessageLogProcFailureEEInfo(TEXT("HandleReq: c_RemoteOpen"), RpcExceptionCode());
                return;
#ifdef RETRY_EXCEPTION
            }
#endif
        }
        RpcEndExcept;
#ifdef RETRY_EXCEPTION
    }
#endif

    // Attempt to open the local file.
    if ((pReq->hLocalFile = CreateFile(pReq->LocalFileName,
                                       GENERIC_WRITE,
                                       0,
                                       NULL,
                                       CREATE_ALWAYS,
                                       FILE_ATTRIBUTE_NORMAL,
                                       NULL)) == INVALID_HANDLE_VALUE) {
        ShutdownThread(pReq);
        AddToMessageLogProcFailure(TEXT("HandleReq: CreateFile"), GetLastError());
        return;
    }

    // We need to stop impersonating before putting this request back into
    // a queue or quitting.
    if (RevertToSelf() == 0) {
        AddToMessageLogProcFailure(TEXT("HandleReq: RevertToSelf"), GetLastError());
    }

    // Write the data received to local file.
    if(!WriteFile(pReq->hLocalFile,
                  pbBuf,
                  cbRead,
                  &cbWritten,
                  NULL)){

        ShutdownThread(pReq);
        AddToMessageLogProcFailure(TEXT("HandleReq: WriteFile"), GetLastError());
        return;
    }

    // If there are no errors and the call returned NULL, then
    // the file was read in a single call and has already been closed.
    // We just need to write the buffer and go for the next round.
    if(pReq->phContext == NULL){
#ifdef PROF
        ProfRecordTime(pReq->nReqId, TEXT("handled"));
#endif
        ShutdownThread(pReq);
        return;
    }

    // Now put the request onto the appropriate active request queue.
    // Lookup the subqueue for the user's sid.
    QueueHashAddToSubqueue(ClientActiveReqHashQueues[pReq->Pri], pReq->pSID, pReq);

#ifdef DEBUG
    TCHAR Msg[MSG_SIZE];

    _stprintf(Msg, TEXT("RequestFile: Put req %p onto ActiveReq queue %p\n"), pReq, ClientActiveReqHashQueues[pReq->Pri]);
    DbgMsgRecord(Msg);
#endif
}

BOOL IsSecureClient | ( | handle_t | hFileRepClient,
 |  | Req * | pReq
 | ) |  |

Definition at line 683 of file filerepclientproc.cpp.

                                                        {
    RPC_AUTHZ_HANDLE hAuth;
    ULONG ulAuthnLevel;

    // Get client security info.
    if (RpcBindingInqAuthClient(pReq->hFileRepClient,
                                &hAuth,
                                NULL,
                                &ulAuthnLevel,
                                NULL,
                                NULL) != RPC_S_OK) {
        AddRpcEEInfo(GetLastError(), TEXT("RequestFile: RpcBindingInqAuthClient failed"));
        return FALSE;
    }

    // Make sure the client has adequate security measures.
    // Since this is LRPC, we get the security level of privacy
    // because it is the only available security level.
    // We do not interoperate with old versions of FileRep
    // client utilities, since appropriate versions should be
    // available with the local system service.
    if (ulAuthnLevel != RPC_C_AUTHN_LEVEL_PKT_PRIVACY) {
        AddRpcEEInfo(RPC_S_SEC_PKG_ERROR, TEXT("RequestFile: ulAuthnLevel != RPC_C_AUTHN_LEVEL_PKT_PRIVACY"));
        return FALSE;
    }

    return TRUE;
}

VOID RequestFile | ( | handle_t | hFileRepClient,
 |  | LPTSTR | ServerName,
 |  | LPTSTR | RemoteFileName,
 |  | LPTSTR | LocalFileName
 | ) |  |

Definition at line 728 of file filerepclientproc.cpp.

                                       {

    RPC_STATUS rpcstatus;

    Req *pReq = NULL;

    // The string binding that is used to make sure clients contact the
    // service via an LRPC call.
    LPTSTR StringBinding;

    // The protocol sequence that gets extracted from the string binding.
    LPTSTR ProtSeq;

    TCHAR Msg[MSG_SIZE];

#ifdef DEBUG
    DbgMsgRecord(TEXT("-> RequestFile\n"));
#endif

    if((pReq = (Req *) AutoHeapAlloc(sizeof(Req))) == NULL) {
        AddRpcEEInfoAndRaiseException(ERROR_OUTOFMEMORY, TEXT("RequestFile: AutoHeapAlloc failed"));
        return;
    }

    // Set pReq' fields to NULL so that we will know
    // in ShutdownThread which ones have been initialized.
    pReq->hFileRepServer = NULL;

    pReq->hFileRepClient = hFileRepClient;

    pReq->hTokenHandle = NULL;

    pReq->hLocalFile = NULL;
    pReq->phContext = NULL;
    pReq->bRpcImpersonating = FALSE;
    pReq->bImpersonating = FALSE;
    pReq->Pri = 0;
    pReq->State = StateArrived;

    pReq->ServerName = NULL;
    pReq->RemoteFileName = NULL;
    pReq->LocalFileName = NULL;

    pReq->pSID = NULL;

    // Copy strings out since they may need to be allocated longer then
    // the arguments that live on the stack.
    // It is conceivable that this thread will put the
    // request on the queue and some other thread will
    // handle the request after this thread has exited.
    if ((pReq->ServerName = (LPTSTR) AutoHeapAlloc((_tcslen(ServerName)+1) * sizeof(TCHAR))) == NULL) {
        ShutdownThread(pReq);
        AddRpcEEInfoAndRaiseException(ERROR_OUTOFMEMORY, TEXT("RequestFile: AutoHeapAlloc failed"));
        return;
    }
    CopyMemory(pReq->ServerName, ServerName, (_tcslen(ServerName)+1) * sizeof(TCHAR));
    if ((pReq->RemoteFileName = (LPTSTR) AutoHeapAlloc((_tcslen(RemoteFileName)+1) * sizeof(TCHAR))) == NULL) {
        ShutdownThread(pReq);
        AddRpcEEInfoAndRaiseException(ERROR_OUTOFMEMORY, TEXT("RequestFile: AutoHeapAlloc failed"));
        return;
    }
    CopyMemory(pReq->RemoteFileName, RemoteFileName, (_tcslen(RemoteFileName)+1) * sizeof(TCHAR));
    if ((pReq->LocalFileName = (LPTSTR) AutoHeapAlloc((_tcslen(LocalFileName)+1) * sizeof(TCHAR))) == NULL) {
        ShutdownThread(pReq);
        AddRpcEEInfoAndRaiseException(ERROR_OUTOFMEMORY, TEXT("RequestFile: AutoHeapAlloc failed"));
        return;
    }
    CopyMemory(pReq->LocalFileName, LocalFileName, (_tcslen(LocalFileName)+1) * sizeof(TCHAR));

#ifdef PROF
    static ULONG nTotalId;

    EnterCriticalSection(&ProfCriticalSection);

    // Record the number of the current request.
    pReq->nReqId = nTotalId;
    // Increment the number of the request.
    nTotalId++;

    LeaveCriticalSection(&ProfCriticalSection);

    _stprintf(Msg, TEXT("name=\"%s\" arrived"), RemoteFileName);

    // Record the time of arrival of this request.
    ProfRecordTime(pReq->nReqId, Msg);
#endif

    // Make sure that the client utility is local.
    // Client system service only services LRPC calls.
    if ((rpcstatus = RpcBindingToStringBinding(pReq->hFileRepClient, &StringBinding)) != RPC_S_OK) {
        ShutdownThread(pReq);
        AddRpcEEInfoAndRaiseException(rpcstatus, TEXT("RequestFile: RpcBindingToStringBinding failed"));
        return;
    }
    if ((rpcstatus = RpcStringBindingParse(StringBinding, NULL, &ProtSeq, NULL, NULL, NULL)) != RPC_S_OK) {

        // Free the string binding.
        rpcstatus = RpcStringFree(&StringBinding);
        ASSERTE(rpcstatus == RPC_S_OK);

        ShutdownThread(pReq);
        AddRpcEEInfoAndRaiseException(rpcstatus, TEXT("RequestFile: RpcStringBindingParse failed"));
        return;
    }
    if (_tcscmp(ProtSeq, TEXT("ncalrpc")) != 0) {

        // Free the string binding.
        rpcstatus = RpcStringFree(&StringBinding);
        ASSERTE(rpcstatus == RPC_S_OK);
        // And the protocol sequence
        rpcstatus = RpcStringFree(&ProtSeq);
        ASSERTE(rpcstatus == RPC_S_OK);

        ShutdownThread(pReq);
        AddRpcEEInfoAndRaiseException(RPC_S_INVALID_RPC_PROTSEQ, TEXT("RequestFile: _tcscmp(ProtSeq, TEXT(\"ncalrpc\")) != 0"));
        return;
    }

    // Free the string binding.
    rpcstatus = RpcStringFree(&StringBinding);
    ASSERTE(rpcstatus == RPC_S_OK);
    // And the protocol sequence.
    rpcstatus = RpcStringFree(&ProtSeq);
    ASSERTE(rpcstatus == RPC_S_OK);

    if (!IsSecureClient(hFileRepClient, pReq)) {
        ShutdownThread(pReq);
        AddRpcEEInfoAndRaiseException(RPC_S_SEC_PKG_ERROR, TEXT("RequestFile: IsSecureClient failed"));
        return;
    }

    //
    // Check that we are not exceeding the bound on the number
    // of concurrent requests for this user's priority group.
    // And update the number of such requests.
    //

    // Impersonate the caller so that we can get the caller's SID
    if ((rpcstatus = RpcImpersonateClient(pReq->hFileRepClient)) != RPC_S_OK) {
        ShutdownThread(pReq);
        AddRpcEEInfoAndRaiseException(rpcstatus, TEXT("RequestFile: RpcImpersonateClient failed"));
        return;
    }
    pReq->bRpcImpersonating = TRUE;

    // We need to write down the access token for the user so that
    // we can use it for impersonation later when the client binding handle
    // gets deallocated.
    if (OpenThreadToken(GetCurrentThread(),
                        TOKEN_QUERY | TOKEN_IMPERSONATE,
                        TRUE,
                        &pReq->hTokenHandle) == 0) {

        ShutdownThread(pReq);
        AddRpcEEInfoAndRaiseException(GetLastError(), TEXT("RequestFile: OpenThreadToken failed"));
        return;
    }

    // Determine current user's priority level.  This corresponds to the
    // priority level of the callee, since we are impersonating.
    pReq->Pri = GetCurrentUserPriority();

    // Write down the SID for the user.
    pReq->pSID = GetUserSID();

    // Stop impersonating.  We got what we wanted.
    if ((rpcstatus = RpcRevertToSelf()) != RPC_S_OK) {
        pReq->bRpcImpersonating = FALSE;

        ShutdownThread(pReq);
        AddRpcEEInfoAndRaiseException(rpcstatus, TEXT("RequestFile: RpcRevertToSelf failed"));
        return;
    }
    pReq->bRpcImpersonating = FALSE;

#ifdef DEBUG
    _stprintf(Msg, TEXT("RequestFile: Pri=%d for req %p\n"), pReq->Pri, pReq);
    DbgMsgRecord(Msg);
#endif

    // Increment the counter for the number of concurrent requests.
    if (!CounterIncrement(pClientReqCounters[pReq->Pri])) {

        ShutdownThread(pReq);
        // We have to raise exception after deallocating the data
        // since there is a possibility that a client thread
        // will retry and will attempt to open this local file
        // while it's previous request is still holding a lock.
        // This has been actually hit on an overloaded system.
        AddRpcEEInfoAndRaiseException(RPC_S_SERVER_TOO_BUSY, TEXT("RequestFile: CounterIncrement failed"));
        return;
    }
#ifdef DEBUG
    _stprintf(Msg, TEXT("Incremented ClientReqCounters[%d]\n"), pReq->Pri);
    DbgMsgRecord(Msg);
#endif

    pReq->State = StateQueued;

    // Place the request onto the queue.
    QueueAdd(ClientReqQueues[pReq->Pri], pReq, TRUE);
#ifdef DEBUG
    _stprintf(Msg, TEXT("RequestFile: Put req %p onto Req queue %p\n"), pReq, ClientReqQueues[pReq->Pri]);
    DbgMsgRecord(Msg);
#endif

    //
    // After this point we can not throw exceptions, because we may be handling
    // a different request after placing the arriving request onto the queue.
    // We will log messages instead.
    //

    // Go service some requests, remember that you are
    // an RPC thread.
    ServiceRequests(TRUE);

#ifdef DEBUG
    DbgMsgRecord(TEXT("<- RequestFile\n"));
#endif

    return;
}

VOID ServiceRequests ( BOOL bIsRPCThread )

Definition at line 509 of file filerepclientproc.cpp.

                                        {

    UINT i = 0;

    time_t tReqArrived;

#ifdef DEBUG
    TCHAR Msg[MSG_SIZE];
#endif

    DWORD status;

    Req *pReq = NULL;

    BOOL FoundReq = TRUE;
    BOOL FoundActiveReq = TRUE;

    ULONG ThreadIdentifier;
    HANDLE hThread;

    tReqArrived = time(NULL);

    //
    // We will now go and check if the request or the active request sets of queues have anything that we
    // can service.  If they do not, then this thread can terminate.
    //

    while(FoundReq || FoundActiveReq) {

        // If this thread has handled too many requests
        // we want to allow it to return.  We will spawn a new
        // worker thread in its place.
        // This way a client will receive the synchronous reply.

        if (bIsRPCThread && ((time(NULL) - tReqArrived) >= tServerThread)) {
            if ((hThread = CreateThread(NULL,
                                        0,
                                        (LPTHREAD_START_ROUTINE) ServiceRequests,
                                        (PVOID) FALSE,
                                        0,
                                        &ThreadIdentifier)) == NULL) {

                ShutdownThread(pReq);
                AddToMessageLogProcFailure(TEXT("ServiceRequests: CreateThread"), GetLastError());
                return;
            }

            // Unless we close a handle to the thread, it will remain in the
            // system even after its execution has terminated.
            status = CloseHandle(hThread);
            ASSERTE(status != 0);

            return;
        }

        // Check if the request queues have anything on them.  If they do,
        // pick a request off the highest priority queue and handle it, but only if we
        // are not handling enough of those requests already.
        for (UINT pri = NumPriGroups; pri > 0; pri--) {
            pReq = (Req *) QueueRemove(ClientReqQueues[pri-1]);
            if (pReq != NULL) {
                break;
            }
  }

        if (pReq != NULL) {

#ifdef DEBUG
            _stprintf(Msg, TEXT("RequestFile: Took req %p off Req queue %p\n"), pReq, ClientReqQueues[pReq->Pri]);
            DbgMsgRecord(Msg);
#endif

            if (CounterIncrement(pClientActiveReqCounters[pReq->Pri])) {
                if (QueueHashIncrementCounter(ClientActiveReqHashCounters[pReq->Pri], pReq->pSID)) {
#ifdef DEBUG
                    _stprintf(Msg, TEXT("Incremented ClientActiveReqCounters[%d] and ClientActiveReqHashCounters[%d]\n"), pReq->Pri, pReq->Pri);
                    DbgMsgRecord(Msg);
#endif
                    FoundReq = TRUE;

                    // The request now resides on a new queue.
                    CounterDecrement(pClientReqCounters[pReq->Pri]);
#ifdef DEBUG
                    _stprintf(Msg, TEXT("Decremented ClientReqCounters[%d]\n"), pReq->Pri);
                    DbgMsgRecord(Msg);
#endif
                    pReq->State = StateActive;

                    HandleReq(pReq);
                }
                else {
                    // There were too many requests for a given SID, place the request back
                    // onto the queue.

                    // Don't forget to decrement the counter for the group!
                    CounterDecrement(pClientActiveReqCounters[pReq->Pri]);

                    QueueAdd(ClientReqQueues[pReq->Pri], pReq, TRUE);

                    // Even though we found a request, we could not process it.
                    // Thus, to ensure that a thread will not spin waiting for space
                    // for an active request we set this flag.
                    FoundReq = FALSE;

#ifdef DEBUG
                    _stprintf(Msg, TEXT("Too many active requests for a SID\n"));
                    DbgMsgRecord(Msg);
                    _stprintf(Msg, TEXT("RequestFile: Put req %p onto Req queue %p\n"), pReq, ClientReqQueues[pReq->Pri]);
                    DbgMsgRecord(Msg);
#endif
                }
            }
            else {
                // There were too many active requests for the user group, place the request back
                // onto the queue.

                QueueAdd(ClientReqQueues[pReq->Pri], pReq, TRUE);

                FoundReq = FALSE;

#ifdef DEBUG
                _stprintf(Msg, TEXT("Too many active requests for priority %d\n"), pReq->Pri);
                DbgMsgRecord(Msg);
                _stprintf(Msg, TEXT("RequestFile: Put req %p onto Req queue %p\n"), pReq, ClientReqQueues[pReq->Pri]);
                DbgMsgRecord(Msg);
#endif
            }
        }
        else {
            // We did not find any passive queued requests to be handled.
            FoundReq = FALSE;
        }

        // Check if the active request queues have anything on them.  If they do,
        // pick a request off the highest priority queue and handle it.
        for (pri = NumPriGroups; pri > 0; pri--) {
            pReq = (Req *) QueueHashRemoveFromSubqueue(ClientActiveReqHashQueues[pri-1]);
            if (pReq != NULL) {
                break;
            }
        }

        if (pReq != NULL) {

            FoundActiveReq = TRUE;

#ifdef DEBUG
            _stprintf(Msg, TEXT("RequestFile: Took req %p off ActiveReq queue %p\n"), pReq, ClientActiveReqHashQueues[pReq->Pri]);
            DbgMsgRecord(Msg);
#endif
            HandleActiveReq(pReq);
        }
        else {
            // We did not find any active requests to be handled.
            FoundActiveReq = FALSE;
        }
    }

    // No requests on either of the queues; the thread can return.
}

VOID ShutdownThread ( Req * pReq )

Definition at line 90 of file filerepclientproc.cpp.

                               {
    DWORD status;
    RPC_STATUS rpcstatus;

#ifdef DEBUG
    TCHAR Msg[MSG_SIZE];

    DbgMsgRecord(TEXT("-> ShutdownThread\n"));
#endif

    if(pReq != NULL) {

        // Stop impersonating if we are.
        // The first thing we do in handling a request is impersonating the client.
        if (pReq->bRpcImpersonating) {
            rpcstatus = RpcRevertToSelf();
            if (rpcstatus != RPC_S_OK) {
                AddToMessageLogProcFailureEEInfo(TEXT("ShutdownThread: RpcRevertToSelf"), rpcstatus);
            }
        }
        if (pReq->bImpersonating) {
            if (RevertToSelf() == 0) {
                AddToMessageLogProcFailure(TEXT("ShutdownThread: RevertToSelf"), GetLastError());
            }
        }

        if(pReq->hFileRepServer != NULL) {
            rpcstatus = RpcBindingFree(&(pReq->hFileRepServer));
            ASSERTE(rpcstatus == RPC_S_OK);
        }
        // Check that hLocalFile has been initialized and that initialization
        // was successful.
        if(pReq->hLocalFile != NULL && pReq->hLocalFile != INVALID_HANDLE_VALUE) {
            status = CloseHandle(pReq->hLocalFile);
            ASSERTE(status != 0);
        }
        if(pReq->phContext != NULL) {
            RpcSsDestroyClientContext((VOID **)&pReq->phContext);
            if (rpcstatus != RPC_S_OK) {
                AddToMessageLogProcFailureEEInfo(TEXT("ShutdownThread: RpcSsDestroyClientContext"), rpcstatus);
            }
        }

        // Check if any of the counters need to be decremented
        // since we are removing the request.
        if (pReq->State == StateQueued) {
            CounterDecrement(pClientReqCounters[pReq->Pri]);
#ifdef DEBUG
            _stprintf(Msg, TEXT("Decremented ClientReqCounters[%d]\n"), pReq->Pri);
            DbgMsgRecord(Msg);
#endif
        }
        if (pReq->State == StateActive) {
            CounterDecrement(pClientActiveReqCounters[pReq->Pri]);
            QueueHashDecrementCounter(ClientActiveReqHashCounters[pReq->Pri], pReq->pSID);
#ifdef DEBUG
            _stprintf(Msg, TEXT("Decremented ClientActiveReqCounters[%d] and ClientActiveReqHashCounters[%d]\n"), pReq->Pri, pReq->Pri);
            DbgMsgRecord(Msg);
#endif
        }

        if (pReq->hTokenHandle != NULL) {
            status = CloseHandle(pReq->hTokenHandle);
            ASSERTE(status != NULL);
        }

        if (pReq->ServerName != NULL) {
            AutoHeapFree(pReq->ServerName);
        }
        if (pReq->RemoteFileName != NULL) {
            AutoHeapFree(pReq->RemoteFileName);
        }
        if (pReq->LocalFileName != NULL) {
            AutoHeapFree(pReq->LocalFileName);
        }

        if (pReq->pSID != NULL) {
            AutoHeapFree(pReq->pSID);
        }

        AutoHeapFree(pReq);
    }

#ifdef DEBUG
    DbgMsgRecord(TEXT("<- ShutdownThread\n"));
#endif
}

Variable Documentation

const time_t tServerThread = 5

Definition at line 46 of file filerepclientproc.cpp.

Generated on Wed Nov 13 2024 16:53:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/filerepmultiuser/filerepserver.idl File Reference

  • NetDS
  • RPC
  • FileRep
  • filerepmultiuser
Classes

filerepserver.idl File Reference

Go to the source code of this file.

Classes

interface FileRepServer
Generated on Wed Nov 13 2024 16:53:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/filerepmultiuser/filerepserverproc.cpp File Reference

  • NetDS
  • RPC
  • FileRep
  • filerepmultiuser
Classes | Functions

filerepserverproc.cpp File Reference

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "common.h"
#include "FileRepServer.h"
#include "Service.h"

Go to the source code of this file.

Classes

struct | FILE_CONTEXT_TYPE

Functions

void __RPC_USER | PCONTEXT_HANDLE_TYPE_rundown (PCONTEXT_HANDLE_TYPE phContext)
VOID | ReadData (HANDLE hFile, VOID *pbBuf, unsigned long nToRead, unsigned long *cbRead, BOOL *bEOF, BYTE *EOFCheck)
VOID | s_RemoteOpen (handle_t hFileRepServer, PCONTEXT_HANDLE_TYPE *pphContext, LPTSTR pszFileName, BYTE *pbBuf, unsigned long *cbRead)
VOID | s_RemoteRead (handle_t hFileRepServer, PCONTEXT_HANDLE_TYPE *pphContext, BYTE *pbBuf, unsigned long *cbRead)

Function Documentation

void __RPC_USER PCONTEXT_HANDLE_TYPE_rundown ( PCONTEXT_HANDLE_TYPE phContext )

Definition at line 355 of file filerepserverproc.cpp.

                                                                             {
    FILE_CONTEXT_TYPE *pFileContext;
    INT status;

    // We need to try and close the file associated with the
    // context handle...

    // Context handle can not be NULL in this section, so we can
    // go ahead and try closing the file.
    pFileContext = (FILE_CONTEXT_TYPE *) phContext;

    // Also, we do not need to worry about pFileContext->hFile's being
    // null since we checked for it when we opened the file.
    status = CloseHandle(pFileContext->hFile);
    ASSERTE(status != 0);

    // And then free the memory taken up by it.
    midl_user_free(phContext);
}

VOID ReadData | ( | HANDLE | hFile,
 |  | VOID * | pbBuf,
 |  | unsigned long | nToRead,
 |  | unsigned long * | cbRead,
 |  | BOOL * | bEOF,
 |  | BYTE * | EOFCheck
 | ) |  |

Definition at line 48 of file filerepserverproc.cpp.

                                                                                {

    if(!ReadFile(hFile, pbBuf, nToRead+1, cbRead, NULL)) {

        // We want to raise an exception but leave the context intact
        // so that subsequent reads may be attempted.  Later versions
        // may implement this feature.

        AddRpcEEInfoAndRaiseException(GetLastError(), TEXT("ReadData: ReadFile failed"));
        return;
    }

    // Check for EOF.
    *bEOF = FALSE;
    // If we read in the whole buffer, save the last byte.
    if(*cbRead == nToRead+1) {
        *EOFCheck = ((BYTE *)pbBuf)[(nToRead+1)-1];

        // return at most nToRead read bytes.
        *cbRead = nToRead;
    }
    // If we did not read the whole buffer then we reached the EOF.
    else{
        *bEOF = TRUE;
    }
}

VOID s_RemoteOpen | ( | handle_t | hFileRepServer,
 |  | PCONTEXT_HANDLE_TYPE * | pphContext,
 |  | LPTSTR | pszFileName,
 |  | BYTE * | pbBuf,
 |  | unsigned long * | cbRead
 | ) |  |

Definition at line 92 of file filerepserverproc.cpp.

{
    HANDLE hFile;
    FILE_CONTEXT_TYPE *pFileContext;
    BOOL bEOF = FALSE;
    BYTE EOFCheck;
    INT status;

    BOOL bImpersonating = FALSE;

    // The priority level of the calling user.
    UINT Pri;

    // Set if we reached the maximum number of concurrent requests.
    BOOL bMaxConcurrentRequests = FALSE;

    RPC_STATUS rpcstatus;

    // We need to impersonate the user that has issued the
    // remote call.  If we impersonate here then we make sure that
    // the user has adequate permissions to open the file.
    if (!bImpersonating) {
        if ((rpcstatus = RpcImpersonateClient(hFileRepServer)) != RPC_S_OK) {
            AddRpcEEInfoAndRaiseException(rpcstatus, TEXT("s_RemoteOpen: RpcImpersonateClient failed"));
            return;
        }
        bImpersonating = TRUE;
    }

    //
    // Check that we are not exceeding the bound on the number
    // of concurrent requests for this user's priority group.
    // And update the number of such requests.
    //

    // Determine current user's priority level.  This corresponds to the
    // priority level of the callee, since we are impersonating.
    Pri = GetCurrentUserPriority();

    // Increment the counter for the number of concurrent requests.
    if (!CounterIncrement(pServerReqCounters[Pri])) {
        AddRpcEEInfoAndRaiseException(RPC_S_SERVER_TOO_BUSY, TEXT("s_RemoteOpen: CounterIncrement failed"));
        return;
    }

    // It is enough to impersonate while opening the file, since this is where all
    // the security checks are done.  We can later read from this handle
    // while not impersonating.
    if ((hFile = CreateFile(pszFileName,
                            GENERIC_READ,
                            FILE_SHARE_READ,
                            NULL,
                            OPEN_EXISTING,
                            FILE_ATTRIBUTE_NORMAL,
                            NULL)) == INVALID_HANDLE_VALUE) {
        if (bImpersonating) {
            if ((rpcstatus = RpcRevertToSelf()) != RPC_S_OK) {
                CounterDecrement(pServerReqCounters[Pri]);
                AddRpcEEInfoAndRaiseException(rpcstatus, TEXT("s_RemoteOpen: RpcRevertToSelf failed"));

                return;
            }
        }

        CounterDecrement(pServerReqCounters[Pri]);
        AddRpcEEInfoAndRaiseException(GetLastError(), TEXT("s_RemoteOpen: CreateFile failed"));

        return;
    }

    // We can now revert to self, since file has been opened while
    // impersonating and hence the security requirements have been met.
    if ((rpcstatus = RpcRevertToSelf()) != RPC_S_OK) {

        CounterDecrement(pServerReqCounters[Pri]);
        AddRpcEEInfoAndRaiseException(rpcstatus, TEXT("s_RemoteOpen: RpcRevertToSelf failed"));

        return;
    }

    // Read data from file into the buffer.
    // This function may throw exceptions, but we would want
    // those to propagate out.
    ReadData(hFile, (VOID *)pbBuf, OPEN_BUFSIZE, cbRead, &bEOF, &EOFCheck);

    // Check if EOF has been reached.
    if(bEOF) {
        // If it has, we can simply return.

        // Since all of the read has completed, the [out] context handle
        // pointer is NULL.
        pFileContext = NULL;
        *pphContext = (PCONTEXT_HANDLE_TYPE) pFileContext;

        status = CloseHandle(hFile);
        ASSERTE(status != 0);

        CounterDecrement(pServerReqCounters[Pri]);
        return;
    }
    else {
        // Otherwise we need to allocate, initialize, and return the
        // context handle.
        if((pFileContext = (FILE_CONTEXT_TYPE *) midl_user_allocate(sizeof(FILE_CONTEXT_TYPE))) == NULL) {

            status = CloseHandle(hFile);
            ASSERTE(status != 0);

            CounterDecrement(pServerReqCounters[Pri]);
            AddRpcEEInfoAndRaiseException(ERROR_OUTOFMEMORY, TEXT("s_RemoteOpen: midl_user_allocate failed"));

            return;
        }

        // Initialize the context handle fields.
        pFileContext->hFile = hFile;

        pFileContext->EOFCheck = EOFCheck;

        *pphContext = (PCONTEXT_HANDLE_TYPE) pFileContext;

        CounterDecrement(pServerReqCounters[Pri]);
        return;
    }
}

VOID s_RemoteRead | ( | handle_t | hFileRepServer,
 |  | PCONTEXT_HANDLE_TYPE * | pphContext,
 |  | BYTE * | pbBuf,
 |  | unsigned long * | cbRead
 | ) |  |

Definition at line 238 of file filerepserverproc.cpp.

{
    FILE_CONTEXT_TYPE *pFileContext;
    BOOL bEOF = FALSE;
    BYTE EOFCheck;
    INT status;
    RPC_STATUS rpcstatus;

    UINT Pri;

    BOOL bMaxConcurrentRequests = FALSE;

    BOOL bImpersonating = FALSE;

    // We need to impersonate the user that has issued the
    // remote call.  We need to do this to determine
    // the priority level of the requests below.
    if (!bImpersonating) {
        if ((rpcstatus = RpcImpersonateClient(hFileRepServer)) != RPC_S_OK) {
            AddRpcEEInfoAndRaiseException(rpcstatus, TEXT("s_RemoteRead: RpcImpersonateClient failed"));
            return;
        }
        bImpersonating = TRUE;
    }

    //
    // Check that we are not exceeding the bound on the number
    // of concurrent requests for this user's priority group.
    // And update the number of such requests.
    //

    // Determine current user's priority level.  This corresponds to the
    // priority level of the callee, since we are impersonating.
    Pri = GetCurrentUserPriority();

    // We can now revert to self, since file has been opened while
    // impersonating and hence the security requirements have been met.
    if (bImpersonating) {
        if ((rpcstatus = RpcRevertToSelf()) != RPC_S_OK) {
            AddRpcEEInfoAndRaiseException(rpcstatus, TEXT("s_RemoteRead: RpcRevertToSelf failed"));

            CounterDecrement(pServerReqCounters[Pri]);
            return;
        }
    }

    // Increment the counter for the number of concurrent requests.
    if (!CounterIncrement(pServerReqCounters[Pri])) {
        AddRpcEEInfoAndRaiseException(RPC_S_SERVER_TOO_BUSY, TEXT("s_RemoteRead: CounterIncrement failed"));
        return;
    }

    if ((rpcstatus = RpcRevertToSelf()) != RPC_S_OK) {
        AddRpcEEInfoAndRaiseException(rpcstatus, TEXT("s_RemoteRead: RpcRevertToSelf failed"));

        CounterDecrement(pServerReqCounters[Pri]);
        return;
    }

    // Clients have already been authenticated in RemoteOpen.
    // Here we operate on the context handle generated in RemoteOpen,
    // hence no additional security precations need to be taken.

    // Make sure that the provided context handle is not NULL.
    if(*pphContext == NULL) {

        AddRpcEEInfoAndRaiseException(RPC_X_SS_IN_NULL_CONTEXT, TEXT("s_RemoteRead: pphContext == NULL"));

        CounterDecrement(pServerReqCounters[Pri]);
        return;
    }

    pFileContext = (FILE_CONTEXT_TYPE *) *pphContext;

    // Remember that we have a byte left over from RemoteOpen EOF check.
    pbBuf[0] = pFileContext->EOFCheck;

    // Read the following bytes from file, but remember that we now only
    // have space for READ_BUFSIZE-1 bytes and we write starting
    // from the 1st index.  We will let possible exceptions propagate out.
    ReadData(pFileContext->hFile, (VOID *)&(pbBuf[1]), READ_BUFSIZE-1, cbRead, &bEOF, &EOFCheck);

    // Since we had the first byte left over from the previous read, pretend
    // that we read it.
    (*cbRead)++;

    if(bEOF){
        // If it has, we can destroy the context handle, close
        // the file and return.
        status = CloseHandle(pFileContext->hFile);
        ASSERTE(status != 0);

        midl_user_free(*pphContext);

        // Return NULL context handle to signify that the file has
        // been completely read.
        pFileContext = NULL;
        *pphContext = (PCONTEXT_HANDLE_TYPE) pFileContext;

        CounterDecrement(pServerReqCounters[Pri]);
        return;
    }

    // Memorize the last byte read for the next read.
    pFileContext->EOFCheck = EOFCheck;

    // Otherwise we just return the number of symbols read in cbRead.
    CounterDecrement(pServerReqCounters[Pri]);
    return;
}

Generated on Wed Nov 13 2024 16:53:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/filerepmultiuser/filerepservice.cpp File Reference

  • NetDS
  • RPC
  • FileRep
  • filerepmultiuser
Defines | Functions | Variables

filerepservice.cpp File Reference

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <process.h>
#include <tchar.h>
#include <rpc.h>
#include <Ntdsapi.h>
#include <Ntsecapi.h>
#include <Security.h>
#include <Secext.h>
#include <Dsgetdc.h>
#include <Lm.h>
#include "FileRepServer.h"
#include "FileRepClient.h"
#include "Service.h"
#include "common.h"

Go to the source code of this file.

Defines

#define | SECURITY_WIN32

Functions

VOID _cdecl | main (int argc, char **argv)
RPC_STATUS __stdcall | RpcServerIfCallback (IN void *Interface, IN void *Context)
VOID WINAPI | ServiceCtrl (DWORD Opcode)
VOID WINAPI | ServiceMain (DWORD dwArgc, LPTSTR *lpszArgv)
VOID | ServiceStart (DWORD dwArgc, LPTSTR *lpszArgv)
VOID | ServiceStop ()

Variables

BOOL | bServerListening = FALSE
ULONG | cMaxCallsExecute = RPC_C_LISTEN_MAX_CALLS_DEFAULT
ULONG | cMaxCallsListen = RPC_C_PROTSEQ_MAX_REQS_DEFAULT
ULONG | cMinimumThreads = 2
BOOL | fClientActiveReqCountersCreated = FALSE
BOOL | fClientActiveReqHashCountersCreated = FALSE
BOOL | fClientActiveReqHashQueuesCreated = FALSE
BOOL | fClientReqCountersCreated = FALSE
BOOL | fClientReqQueuesCreated = FALSE
BOOL | fServerReqCountersCreated = FALSE
RPC_BINDING_VECTOR * | pBindingVector = NULL
LPTSTR ServerProtocolArray []
SERVICE_STATUS_HANDLE | sshStatusHandle
SERVICE_STATUS | ssStatus
RPC_STATUS | status

Define Documentation

#define SECURITY_WIN32

Definition at line 27 of file filerepservice.cpp.

Function Documentation

VOID _cdecl main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 117 of file filerepservice.cpp.

                                       {

    // Since we provide a single service there is only
    // one entry in the service dispatch table
    SERVICE_TABLE_ENTRY DispatchTable[] = {
        { SERVICENAME, (LPSERVICE_MAIN_FUNCTION)ServiceMain },
        { NULL, NULL }
    };

    // The service control manager may be starting the service with
    // this call, so we must call StartServiceCtrlDispatcher.
    if (!StartServiceCtrlDispatcher(DispatchTable)) {
        AddToMessageLog(TEXT("StartServiceCtrlDispatcher failed"));
    }
}

RPC_STATUS __stdcall RpcServerIfCallback | ( | IN void * | Interface,
 |  | IN void * | Context
 | ) |  |

Definition at line 272 of file filerepservice.cpp.

  {
    ULONG ulAuthnLevel;
    ULONG ulAuthnSvc;

    // Get client security info.
    if (RpcBindingInqAuthClient(Context,
        NULL,
        NULL,
        &ulAuthnLevel,
        &ulAuthnSvc,
        NULL) != RPC_S_OK) {

        return RPC_S_ACCESS_DENIED;
    }

    // Make sure the client has adequate security measures and uses the expected
    // security provider.
    if (ulAuthnLevel != RPC_C_AUTHN_LEVEL_PKT_PRIVACY || ulAuthnSvc != RPC_C_AUTHN_GSS_KERBEROS) {

        return RPC_S_ACCESS_DENIED;
    }

    return RPC_S_OK;
};

VOID WINAPI ServiceCtrl ( DWORD Opcode )

Definition at line 191 of file filerepservice.cpp.

                                      {

    // We only handle the STOP control requsts.
    switch(Opcode) {

        case SERVICE_CONTROL_STOP:
            // Stop the service.
            ServiceStop();
            break;

        default:
            AddToMessageLog(TEXT("ServiceCtrl: unrecognized or unimplemented opcode\n"));
    }

    return;
}

VOID WINAPI ServiceMain | ( | DWORD | dwArgc,
 |  | LPTSTR * | lpszArgv
 | ) |  |

Definition at line 151 of file filerepservice.cpp.

                                                        {

    // Initial service configuration
    ssStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
    ssStatus.dwCurrentState = SERVICE_START_PENDING;
    ssStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP;
    ssStatus.dwWin32ExitCode = 0;
    ssStatus.dwServiceSpecificExitCode = 0;
    ssStatus.dwCheckPoint = 0;
    ssStatus.dwWaitHint = 0;

    sshStatusHandle = RegisterServiceCtrlHandler(SERVICENAME, ServiceCtrl);

    // Tell the SCM that the service is starting up.
    if (!SetServiceStatus(sshStatusHandle, &ssStatus)) {
        AddToMessageLog(TEXT("ServiceMain: SetServiceStatus failed\n"));
        return;
    }

    // Initialize the service and start it.
    ServiceStart(dwArgc, lpszArgv);

    return;
}

VOID ServiceStart | ( | DWORD | dwArgc,
 |  | LPTSTR * | lpszArgv
 | ) |  |

Definition at line 316 of file filerepservice.cpp.

                                                  {

    UINT i;

    // Report the status to the service control manager.
    if (!ReportStatusToSCMgr(&sshStatusHandle, &ssStatus, SERVICE_START_PENDING, NO_ERROR, 1000)) {
        AddToMessageLog(TEXT("ServiceStart: ReportStatusToSCMgr failed\n"));
        ServiceStop();
        return;
    }

    // Service initialization

    // Register the service interfaces.

    // The server interface has a security callback RpcServerIfCallback.
    // The RPC run time will automatically reject unauthenticated calls to
    // this interface.
    status = RpcServerRegisterIfEx(s_FileRepServer_v1_0_s_ifspec,
           NULL,
           NULL,
           RPC_IF_ALLOW_SECURE_ONLY,
           RPC_C_LISTEN_MAX_CALLS_DEFAULT,
           &RpcServerIfCallback);
    if (status != RPC_S_OK){
            AddToMessageLogProcFailureEEInfo(TEXT("ServiceStart: RpcServerRegisterIf(s_FileRepServer_v1_0_s_ifspec, ...)"), status);
        ServiceStop();
        return;
    }

    status = RpcServerRegisterIf(FileRepClient_v1_0_s_ifspec, NULL, NULL);
    if (status != RPC_S_OK){
            AddToMessageLogProcFailureEEInfo(TEXT("ServiceStart: RpcServerRegisterIf(FileRepClient_v1_0_s_ifspec, ...)"), status);
        ServiceStop();
        return;
    }

    for (i = 0; i < sizeof(ServerProtocolArray)/sizeof(unsigned char *); i++) {

        // Use the protocol sequences specified in ProtocolArray
        // for receiving RPCs.
        status = RpcServerUseProtseq((_TUCHAR *)ServerProtocolArray[i], cMaxCallsListen, NULL);
        if (status != RPC_S_OK){
            AddToMessageLogProcFailureEEInfo(TEXT("ServiceStart: RpcServerUseProtseq"), status);
            ServiceStop();
            return;
        }
    }

    // Obtain a binding vector for the server.
    status = RpcServerInqBindings(&pBindingVector);
    if (status != RPC_S_OK) {
        AddToMessageLogProcFailureEEInfo(TEXT("ServiceStart: RpcServerInqBindings"), status);
        ServiceStop();
        return;
    }

    // Register the the services in the endpoint map
    // of the host computer.
    status = RpcEpRegister(s_FileRepServer_v1_0_s_ifspec, pBindingVector, NULL, NULL);
    if (status != RPC_S_OK){
        AddToMessageLogProcFailureEEInfo(TEXT("ServiceStart: RpcEpRegister(s_FileRepServer_v1_0_s_ifspec, ...)"), status);
        ServiceStop();
        return;
    }
    status = RpcEpRegister(FileRepClient_v1_0_s_ifspec, pBindingVector, NULL, NULL);
    if (status != RPC_S_OK){
        AddToMessageLogProcFailureEEInfo(TEXT("ServiceStart: RpcEpRegister(FileRepClient_v1_0_s_ifspec, ...)"), status);
        ServiceStop();
        return;
    }

    // Message buffer.
    TCHAR Msg[MSG_SIZE];

    // Array of generated SPNs.
    TCHAR **Spn;
    // Number of generated SPNs.
    ULONG ulSpn = 1;

    PDOMAIN_CONTROLLER_INFO pDomainControllerInfo;

    HANDLE hDS;

    TCHAR lpCompDN[128];
    ULONG ulCompDNSize = sizeof(lpCompDN);

    //
    // Set the security info for the client system service.
    //

    // Principal name is NULL for local system service.
    status = RpcServerRegisterAuthInfo(NULL, RPC_C_AUTHN_WINNT, NULL, NULL);
    if (status != RPC_S_OK){
        AddToMessageLogProcFailureEEInfo(TEXT("ServiceStart: RpcServerRegisterAuthInfo"), status);
        ServiceStop();
        return;
    }

    //
    // Set the security info for the server system service.
    //

    BOOL NoFailure = TRUE;

    // Generate the SPN.
    status = DsGetSpn(DS_SPN_NB_HOST, // Type of SPN to create.
                      SERVICENAME, // Service class
                      NULL, // DN of this service.
                      0, // Use the default instance port.
                      0, // Number of additional instance names.
                      NULL, // No additional instance names.
                      NULL, // No additional instance ports.
                      &ulSpn, // Size of SPN array.
                      &Spn); // Returned SPN(s).
    if (status != RPC_S_OK){
        _stprintf(Msg, TEXT("ServiceStart: DsGetSpn failed with code %d\n"), status);
        AddToMessageLog(Msg);
        ServiceStop();
        return;
    }

    // Get the name of our domain.
    if (status = DsGetDcName(NULL,
                             NULL,
                             NULL,
                             NULL,
                             DS_RETURN_DNS_NAME,
                             &pDomainControllerInfo) != NO_ERROR) {
        _stprintf(Msg, TEXT("ServiceStart: DsGetDcName failed with code %d\n"), status);
        AddToMessageLog(Msg);
        NoFailure = FALSE;
    }

    if (NoFailure) {
        // Bind to the domain controller for our domain.
        if ((status = DsBind(NULL,
                             pDomainControllerInfo->DomainName,
                             &hDS)) != ERROR_SUCCESS) {
            _stprintf(Msg, TEXT("ServiceStart: DsBind failed with code %d\n"), status);
            AddToMessageLog(Msg);
            NoFailure = FALSE;
        }
    }

    if (NoFailure) {
        if ((status = NetApiBufferFree(pDomainControllerInfo)) != NERR_Success) {
            _stprintf(Msg, TEXT("ServiceStart: NetApiBufferFree failed with code %d\n"), status);
            AddToMessageLog(Msg);
            ServiceStop();
            return;
        }

        if (GetComputerObjectName(NameFullyQualifiedDN, lpCompDN, &ulCompDNSize) == 0) {
            _stprintf(Msg, TEXT("ServiceStart: GetComputerObjectName failed with code %d\n"), GetLastError());
            AddToMessageLog(Msg);
            ServiceStop();
            return;
  }

        // We could check whether the SPN is already registered for this
        // computer's DN, but we don't have to.  Modification is performed
        // permissively by this function, so that adding a value that already
        // exists does not return an error.  This way we can opt for the internal
        // check instead of doing it ourselves.
        status = DsWriteAccountSpn(hDS, DS_SPN_ADD_SPN_OP, lpCompDN, ulSpn, (LPCTSTR *)Spn);
        if (status != NO_ERROR) {
            _stprintf(Msg, TEXT("ServiceStart: DsWriteAccountSpn failed with code %d\n"), status);
            AddToMessageLog(Msg);
            return;
        }
        DsUnBind(&hDS);
    }

    // We use Kerberos for authentication on the server.
    status = RpcServerRegisterAuthInfo(Spn[0], RPC_C_AUTHN_GSS_KERBEROS, NULL, NULL);
    if (status != RPC_S_OK){
        AddToMessageLogProcFailureEEInfo(TEXT("ServiceStart: RpcServerRegisterAuthInfo"), status);
        ServiceStop();
        return;
    }

    // Don't forget to deallocate the principal name array.
    DsFreeSpnArray(ulSpn, Spn);

    // Create the heap to be used by midl_user_allocate and midl_user_free
    RpcHeap = HeapCreate(0, RPC_HEAP_SIZE_INIT, RPC_HEAP_SIZE_MAX);

#ifdef DEBUG
    DbgMsgOpenLog(TEXT("c:\\logs\\FileRepService.dbg"));
    fDbgMsgOpenedLog = TRUE;
#endif

#ifdef PROF
    ProfOpenLog(TEXT("c:\\logs\\FileRepService.prof"));
    fProfOpenedLog = TRUE;
#endif

    // Create counters to measure the number of concurrent
    // connections to the server system service.
    if (CountersCreate(pServerReqCounters, NumPriGroups, (UINT *) ServerReqBounds) == NULL) {
        AddToMessageLog(TEXT("ServiceStart: CountersCreate failed\n"));
        ServiceStop();
        return;
    }
    fServerReqCountersCreated = TRUE;

    // Create the counters and queues for client system service
    // to store requests and request numbers.
    if (CountersCreate(pClientReqCounters, NumPriGroups, (UINT *) ClientReqBounds) == NULL) {
        AddToMessageLog(TEXT("ServiceStart: CountersCreate failed\n"));
        ServiceStop();
        return;
    }
    fClientReqCountersCreated = TRUE;

    if (CountersCreate(pClientActiveReqCounters, NumPriGroups, (UINT *) ClientActiveReqBounds) == NULL) {
        AddToMessageLog(TEXT("ServiceStart: CountersCreate failed\n"));
        ServiceStop();
        return;
    }
    fClientActiveReqCountersCreated = TRUE;

    if (QueuesCreate(ClientReqQueues, NumPriGroups, FALSE) == FALSE) {
        AddToMessageLog(TEXT("ServiceStart: QueuesCreate failed\n"));
        ServiceStop();
        return;
    }
    fClientReqQueuesCreated = TRUE;

    if (QueuesCreate(ClientActiveReqHashQueues, NumPriGroups, FALSE) == FALSE) {
        AddToMessageLog(TEXT("ServiceStart: QueuesCreate failed\n"));
        ServiceStop();
        return;
    }
    fClientActiveReqHashQueuesCreated = TRUE;

    if (QueuesCreate(ClientActiveReqHashCounters, NumPriGroups, FALSE) == FALSE) {
        AddToMessageLog(TEXT("ServiceStart: QueuesCreate failed\n"));
        ServiceStop();
        return;
    }
    fClientActiveReqHashCountersCreated = TRUE;

    CreateWellKnownSids();

    // Start accepting client calls.
    // The last argument's being 1 indicates that RpcServerListen
    // should return immediately after completing function processing.
    status = RpcServerListen(cMinimumThreads, cMaxCallsExecute, 1);
    if (status != RPC_S_OK){
        AddToMessageLogProcFailureEEInfo(TEXT("ServiceStart: RpcServerListen"), status);
        ServiceStop();
        return;
    }

    bServerListening = TRUE;

    // Tell The SCM that the service is running.
    if (!ReportStatusToSCMgr(&sshStatusHandle, &ssStatus, SERVICE_RUNNING, NO_ERROR, 0)){
        AddToMessageLog(TEXT("ServiceStart: ReportStatusToSCMgr failed"));
        ServiceStop();
        return;
    }

    // End of initialization

    // RpcMgmtWaitServerListen() will block until the server has
    // stopped listening.
    status = RpcMgmtWaitServerListen();
    if (status != RPC_S_OK){
        AddToMessageLogProcFailureEEInfo(TEXT("ServiceStart: RpcMgmtWaitServerListen"), status);
        ServiceStop();
        return;
    }

    return;
}

VOID ServiceStop ( )

Definition at line 610 of file filerepservice.cpp.

                   {
    RPC_STATUS status;

    // Stops the server, wakes up the main thread.
    if (bServerListening) {
        status = RpcMgmtStopServerListening(NULL);
        if(status != RPC_S_OK) {
                    AddToMessageLogProcFailureEEInfo(TEXT("ServiceStart: RpcMgmtWaitServerListen"), status);
        }
        bServerListening = FALSE;
    }

    // Delete the binding vector.
    status = RpcServerUnregisterIf(NULL, NULL, FALSE);
    if(status != RPC_S_OK){
        AddToMessageLogProcFailureEEInfo(TEXT("ServiceStart: RpcServerUnregisterIf"), status);
    }

    // Tell The SCM that the service is stopped.
    if(!ReportStatusToSCMgr(&sshStatusHandle, &ssStatus, SERVICE_STOPPED, NO_ERROR, 0)) {
        AddToMessageLogProcFailure(TEXT("ServiceStop: ReportStatusToSCMgr"), GetLastError());
    }

    // Wait for the client threads to finish so
    // that we do not deallocate active data structures.
    // We can accomplish this by waiting for the counters
    // to become zero.  Performing a check in this
    // order should prevent race conditions, since
    // pClientActiveReqCounters are incremented before
    // pClientReqCounters are decremented.
    if (fServerReqCountersCreated) {
        if (CountersCheckForNonzero(pServerReqCounters, NumPriGroups)) {
            Sleep(1000);
        }
    }
    if (fClientReqCountersCreated) {
        if (CountersCheckForNonzero(pClientReqCounters, NumPriGroups)) {
            Sleep(1000);
        }
    }
    if (fClientActiveReqCountersCreated) {
        if (CountersCheckForNonzero(pClientActiveReqCounters, NumPriGroups)) {
            Sleep(1000);
        }
    }

    DeleteWellKnownSids();

    // Delete queues and counters.
    if (fServerReqCountersCreated) {
        CountersDelete(pServerReqCounters, NumPriGroups);
        fServerReqCountersCreated = FALSE;
    }
    if (fClientReqCountersCreated) {
        CountersDelete(pClientReqCounters, NumPriGroups);
        fClientReqCountersCreated = FALSE;
    }
    if (fClientActiveReqCountersCreated) {
        CountersDelete(pClientActiveReqCounters, NumPriGroups);
        fClientActiveReqCountersCreated = FALSE;
    }
    if (fClientReqQueuesCreated) {
        QueuesDelete(ClientReqQueues, NumPriGroups);
        fClientReqQueuesCreated = FALSE;
    }
    if (fClientActiveReqHashQueuesCreated) {
        QueuesDelete(ClientActiveReqHashQueues, NumPriGroups);
        fClientActiveReqHashQueuesCreated = FALSE;
    }
    if (fClientActiveReqHashCountersCreated) {
        QueuesDelete(ClientActiveReqHashCounters, NumPriGroups);
        fClientActiveReqHashCountersCreated = FALSE;
    }

#ifdef PROF
    if (fProfOpenedLog) {
        ProfCloseLog();
        fProfOpenedLog = FALSE;
    }
#endif

#ifdef DEBUG
    if (fDbgMsgOpenedLog) {
        DbgMsgCloseLog();
        fDbgMsgOpenedLog = FALSE;
    }
#endif

}

Variable Documentation

BOOL bServerListening = FALSE

Definition at line 83 of file filerepservice.cpp.

ULONG cMaxCallsExecute = RPC_C_LISTEN_MAX_CALLS_DEFAULT

Definition at line 225 of file filerepservice.cpp.

ULONG cMaxCallsListen = RPC_C_PROTSEQ_MAX_REQS_DEFAULT

Definition at line 222 of file filerepservice.cpp.

ULONG cMinimumThreads = 2

Definition at line 228 of file filerepservice.cpp.

BOOL fClientActiveReqCountersCreated = FALSE

Definition at line 95 of file filerepservice.cpp.

BOOL fClientActiveReqHashCountersCreated = FALSE

Definition at line 99 of file filerepservice.cpp.

BOOL fClientActiveReqHashQueuesCreated = FALSE

Definition at line 98 of file filerepservice.cpp.

BOOL fClientReqCountersCreated = FALSE

Definition at line 94 of file filerepservice.cpp.

BOOL fClientReqQueuesCreated = FALSE

Definition at line 97 of file filerepservice.cpp.

BOOL fServerReqCountersCreated = FALSE

Definition at line 93 of file filerepservice.cpp.

RPC_BINDING_VECTOR* pBindingVector = NULL

Definition at line 230 of file filerepservice.cpp.

LPTSTR ServerProtocolArray[]
Initial value:
 { TEXT("ncacn_ip_tcp"),
                                 TEXT("ncalrpc") }

Definition at line 216 of file filerepservice.cpp.

SERVICE_STATUS_HANDLE sshStatusHandle

Definition at line 78 of file filerepservice.cpp.

SERVICE_STATUS ssStatus

Definition at line 81 of file filerepservice.cpp.

RPC_STATUS status

Definition at line 233 of file filerepservice.cpp.

Generated on Wed Nov 13 2024 16:53:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/filerepmultiuser/prof.cpp File Reference

  • NetDS
  • RPC
  • FileRep
  • filerepmultiuser
Defines | Functions | Variables

prof.cpp File Reference

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <process.h>
#include <tchar.h>
#include "Prof.h"
#include "Service.h"
#include "common.h"

Go to the source code of this file.

Defines

#define | MAX_ENTRY_SIZE_NOMSG (32)

Functions

VOID | ProfCloseLog (VOID)
VOID | ProfOpenLog (LPTSTR LogFileName)
VOID | ProfRecordTime (UINT id, LPTSTR msg)

Variables

HANDLE | hProfLog = NULL
LARGE_INTEGER | lpCurrentTime
LARGE_INTEGER | lpFrequency
LARGE_INTEGER | lpStartTime
UINT | nProfLogSize = 0
TCHAR | PROF_LOG [PROF_LOG_MAX_SIZE]
CRITICAL_SECTION | ProfCriticalSection

Define Documentation

#define MAX_ENTRY_SIZE_NOMSG (32)

Definition at line 50 of file prof.cpp.

Function Documentation

VOID ProfCloseLog ( VOID )

Definition at line 111 of file prof.cpp.

                        {
    ULONG cbWritten;
    DWORD status;

    // Delete the critsec.
    // Here we make the assumption that no outside functions will use
    // the critsec anymore.  This should be valid, since all the profiling data
    // has been written.
    // Also we make an assumption that only one thread will attempt
    // to close the profile log.  This should be valid as well, or the
    // user can inmplement a semaphore to take care of that.
    DeleteCriticalSection(&ProfCriticalSection);

    // Write out the profile log.
    if(!WriteFile(hProfLog,
                  (LPVOID)PROF_LOG,
                  nProfLogSize*sizeof(TCHAR),
                  &cbWritten,
                  NULL)) {

        AddToMessageLogProcFailure(TEXT("ProfCloseLog: WriteFile"), GetLastError());
        return;
    }

    // Close the profile log.
    if (hProfLog != NULL && hProfLog != INVALID_HANDLE_VALUE) {
        status = CloseHandle(hProfLog);
        ASSERTE(status);
    }
}

VOID ProfOpenLog ( LPTSTR LogFileName )

Definition at line 54 of file prof.cpp.

                                     {

    // Init the critsec.
    if (InitializeCriticalSectionAndSpinCount(&ProfCriticalSection, 0) == 0) {
        AddToMessageLogProcFailure(TEXT("ProfOpenLog: InitializeCriticalSectionAndSpinCount"), GetLastError());
        return;
    }

    // Open the profiling log.
    if ((hProfLog = CreateFile(LogFileName,
                               GENERIC_WRITE,
                               0,
                               NULL,
                               CREATE_ALWAYS,
                               FILE_ATTRIBUTE_NORMAL,
                               NULL)) == INVALID_HANDLE_VALUE) {
        AddToMessageLogProcFailure(TEXT("ProfOpenLog: CreateFile"), GetLastError());
        return;
    }

    // Get the current time.
    if (QueryPerformanceCounter(&lpStartTime) == FALSE) {
        AddToMessageLogProcFailure(TEXT("ProfOpenLog: QueryPerformanceCounter"), GetLastError());
        return;
    }

    // Get the frequency.
    if (QueryPerformanceFrequency(&lpFrequency) == FALSE) {
        AddToMessageLogProcFailure(TEXT("ProfOpenLog: QueryPerformanceCounter"), GetLastError());
        return;
    }
}

VOID ProfRecordTime | ( | UINT | id,
 |  | LPTSTR | msg
 | ) |  |

Definition at line 87 of file prof.cpp.

                                         {
    FLOAT dt;

    EnterCriticalSection(&ProfCriticalSection);

    // Write the entry only if there is enough space left in
    // the log.
    if (nProfLogSize < PROF_LOG_MAX_SIZE - (MAX_ENTRY_SIZE_NOMSG + _tcslen(msg))) {
        if (QueryPerformanceCounter(&lpCurrentTime) == FALSE) {
            AddToMessageLogProcFailure(TEXT("ProfRecordTime: QueryPerformanceCounter"), GetLastError());
            LeaveCriticalSection(&ProfCriticalSection);
            return;
        }

        // Get the time stamp for the event.
        dt = (FLOAT)(lpCurrentTime.QuadPart - lpStartTime.QuadPart)/(FLOAT)(lpFrequency.QuadPart);

        // Append the entry to the log.
        nProfLogSize+=_stprintf(&PROF_LOG[nProfLogSize], TEXT("%d %s %f\n"), id, msg, dt);
    }

    LeaveCriticalSection(&ProfCriticalSection);
}

Variable Documentation

HANDLE hProfLog = NULL

Definition at line 34 of file prof.cpp.

LARGE_INTEGER lpCurrentTime

Definition at line 37 of file prof.cpp.

LARGE_INTEGER lpFrequency

Definition at line 37 of file prof.cpp.

LARGE_INTEGER lpStartTime

Definition at line 37 of file prof.cpp.

UINT nProfLogSize = 0

Definition at line 45 of file prof.cpp.

TCHAR PROF_LOG[PROF_LOG_MAX_SIZE]

Definition at line 42 of file prof.cpp.

CRITICAL_SECTION ProfCriticalSection

Definition at line 52 of file prof.cpp.

Generated on Wed Nov 13 2024 16:53:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/filerepmultiuser/prof.h File Reference

  • NetDS
  • RPC
  • FileRep
  • filerepmultiuser
Defines | Functions | Variables

prof.h File Reference

Go to the source code of this file.

Defines

#define | PROF_LOG_MAX_SIZE (10*1024*1024)

Functions

VOID | ProfCloseLog (VOID)
VOID | ProfOpenLog (LPTSTR LogFileName)
VOID | ProfRecordTime (UINT id, LPTSTR msg)

Variables

CRITICAL_SECTION | ProfCriticalSection

Define Documentation

#define PROF_LOG_MAX_SIZE (10*1024*1024)

Definition at line 25 of file prof.h.

Function Documentation

VOID ProfCloseLog ( VOID )

Definition at line 108 of file Prof.cpp.

                        {
    ULONG cbWritten;
    DWORD status;

    // Delete the critsec.
    // Here we make the assumption that no outside functions will use
    // the critsec anymore.  This should be valid, since all the profiling data
    // has been written.
    // Also we make an assumption that only one thread will attempt
    // to close the profile log.  This should be valid as well, or the
    // user can inmplement a semaphore to take care of that.
    DeleteCriticalSection(&ProfCriticalSection);

    // Write out the profile log.
    if(!WriteFile(hProfLog,
                  (LPVOID)PROF_LOG,
                  nProfLogSize*sizeof(TCHAR),
                  &cbWritten,
                  NULL)) {

        AddToMessageLogProcFailure(TEXT("ProfCloseLog: WriteFile"), GetLastError());
        return;
    }

    // Close the profile log.
    if (hProfLog != NULL && hProfLog != INVALID_HANDLE_VALUE) {
        status = CloseHandle(hProfLog);
        ASSERT(status);
    }
}

VOID ProfOpenLog ( LPTSTR LogFileName )

Definition at line 51 of file Prof.cpp.

                                     {

    // Init the critsec.
    if (InitializeCriticalSectionAndSpinCount(&ProfCriticalSection, 0) == 0) {
        AddToMessageLogProcFailure(TEXT("ProfOpenLog: InitializeCriticalSectionAndSpinCount"), GetLastError());
        return;
    }

    // Open the profiling log.
    if ((hProfLog = CreateFile(LogFileName,
                               GENERIC_WRITE,
                               0,
                               NULL,
                               CREATE_ALWAYS,
                               FILE_ATTRIBUTE_NORMAL,
                               NULL)) == INVALID_HANDLE_VALUE) {
        AddToMessageLogProcFailure(TEXT("ProfOpenLog: CreateFile"), GetLastError());
        return;
    }

    // Get the current time.
    if (QueryPerformanceCounter(&lpStartTime) == FALSE) {
        AddToMessageLogProcFailure(TEXT("ProfOpenLog: QueryPerformanceCounter"), GetLastError());
        return;
    }

    // Get the frequency.
    if (QueryPerformanceFrequency(&lpFrequency) == FALSE) {
        AddToMessageLogProcFailure(TEXT("ProfOpenLog: QueryPerformanceCounter"), GetLastError());
        return;
    }
}

VOID ProfRecordTime | ( | UINT | id,
 |  | LPTSTR | msg
 | ) |  |

Definition at line 84 of file Prof.cpp.

                                         {
    FLOAT dt;

    EnterCriticalSection(&ProfCriticalSection);

    // Write the entry only if there is enough space left in
    // the log.
    if (nProfLogSize < PROF_LOG_MAX_SIZE - (MAX_ENTRY_SIZE_NOMSG + _tcslen(msg))) {
        if (QueryPerformanceCounter(&lpCurrentTime) == FALSE) {
            AddToMessageLogProcFailure(TEXT("ProfRecordTime: QueryPerformanceCounter"), GetLastError());
            LeaveCriticalSection(&ProfCriticalSection);
            return;
        }

        // Get the time stamp for the event.
        dt = (FLOAT)(lpCurrentTime.QuadPart - lpStartTime.QuadPart)/(FLOAT)(lpFrequency.QuadPart);

        // Append the entry to the log.
        nProfLogSize+=_stprintf(&PROF_LOG[nProfLogSize], TEXT("%d %s %f\n"), id, msg, dt);
    }

    LeaveCriticalSection(&ProfCriticalSection);
}

Variable Documentation

CRITICAL_SECTION ProfCriticalSection

Definition at line 49 of file Prof.cpp.

Generated on Wed Nov 13 2024 16:53:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/filerepmultiuser/resources.cpp File Reference

  • NetDS
  • RPC
  • FileRep
  • filerepmultiuser
Functions

resources.cpp File Reference

#include <Windows.h>
#include "Resources.h"
#include "common.h"
#include "Service.h"

Go to the source code of this file.

Functions

Counter * | CounterCreate (UINT Bound)
VOID | CounterDecrement (Counter *pCounter)
VOID | CounterDelete (Counter *pCounter)
BOOL | CounterIncrement (Counter *pCounter)
BOOL | CountersCheckForNonzero (Counter *pCounters[], UINT n)
BOOL | CountersCreate (Counter *pCounters[], UINT n, UINT *Bounds)
VOID | CountersDelete (Counter *pCounters[], UINT n)
VOID | QueueAdd (Queue *pQueue, VOID *pData, BOOL EnterCritSec)
Queue * | QueueCreate (BOOL NoCritSec)
VOID | QueueDelete (Queue *pQueue)
VOID | QueueHashAdd (Queue *pQueue, PSID Sid, VOID *pValue, BOOL EnterCritSec)
VOID | QueueHashAddToSubqueue (Queue *pHashQueue, PSID pSID, VOID *pData)
VOID | QueueHashDecrementCounter (Queue *pHashQueue, PSID pSID)
BOOL | QueueHashIncrementCounter (Queue *pHashQueue, PSID pSID)
VOID * | QueueHashLookup (Queue *pQueue, PSID Sid, BOOL EnterCritSec)
VOID * | QueueHashRemoveFromSubqueue (Queue *pQueue)
BOOL | QueueIsEmpty (Queue *pQueue)
VOID | QueueMoveToBack (Queue *pQueue, QueueNode *pNode, QueueNode *pPrevNode)
VOID * | QueueRemove (Queue *pQueue)
BOOL | QueuesCreate (Queue *Queues[], UINT n, BOOL NoCritSec)
VOID | QueuesDelete (Queue *Queues[], UINT n)

Function Documentation

Counter* CounterCreate ( UINT Bound )

Definition at line 23 of file resources.cpp.

                                    {
    Counter * pCounter;

#ifdef DEBUG
    DbgMsgRecord(TEXT("-> CounterCreate\n"));
#endif

    pCounter = (Counter *)AutoHeapAlloc(sizeof(Counter));

    if (pCounter == NULL) {
        return NULL;
    }

    pCounter->Value = 0;
    pCounter->Bound = Bound;

#ifdef DEBUG
    DbgMsgRecord(TEXT("<- CounterCreate\n"));
#endif

    return pCounter;
}

VOID CounterDecrement ( Counter * pCounter )

Definition at line 86 of file resources.cpp.

                                         {

#ifdef DEBUG
    DbgMsgRecord(TEXT("-> CounterDecrement\n"));
#endif

    ASSERTE(pCounter != NULL);

    InterlockedDecrement(&pCounter->Value);

#ifdef DEBUG
    DbgMsgRecord(TEXT("<- CounterDecrement\n"));
#endif

}

VOID CounterDelete ( Counter * pCounter )

Definition at line 46 of file resources.cpp.

                                       {

#ifdef DEBUG
    DbgMsgRecord(TEXT("-> CounterDelete\n"));
#endif

    ASSERTE(pCounter != NULL);

    AutoHeapFree(pCounter);

#ifdef DEBUG
    DbgMsgRecord(TEXT("<- QueueDelete\n"));
#endif
}

BOOL CounterIncrement ( Counter * pCounter )

Definition at line 61 of file resources.cpp.

                                         {
    BOOL ret = FALSE;

#ifdef DEBUG
    DbgMsgRecord(TEXT("-> CounterIncrement\n"));
#endif

    ASSERTE(pCounter != NULL);

    // Check for the bound.
    if (InterlockedIncrement(&pCounter->Value) > pCounter->Bound) {
        ret = FALSE;
        InterlockedDecrement(&pCounter->Value);
    }
    else {
        ret = TRUE;
    }

#ifdef DEBUG
    DbgMsgRecord(TEXT("<- CounterIncrement\n"));
#endif

    return ret;
}

BOOL CountersCheckForNonzero | ( | Counter * | pCounters[],
 |  | UINT | n
 | ) |  |

Definition at line 142 of file resources.cpp.

                                                           {
    for (UINT i=0; i<n; i++) {
        ASSERTE(pCounters[i] != NULL);
        if (pCounters[i]->Value != 0) {
            return TRUE;
        }
    }
    return FALSE;
}

BOOL CountersCreate | ( | Counter * | pCounters[],
 |  | UINT | n,
 |  | UINT * | Bounds
 | ) |  |

Definition at line 102 of file resources.cpp.

                                                                 {
    BOOL ret = FALSE;

#ifdef DEBUG
    DbgMsgRecord(TEXT("-> CountersCreate\n"));
#endif

    for (UINT i=0; i<n; i++) {
        if ((pCounters[i] = CounterCreate(Bounds[i])) == NULL) {
            CountersDelete(pCounters, i-1);
            ret = FALSE;
            break;
        }
    }
    ret = TRUE;

#ifdef DEBUG
    DbgMsgRecord(TEXT("<- CountersCreate\n"));
#endif

    return ret;
}

VOID CountersDelete | ( | Counter * | pCounters[],
 |  | UINT | n
 | ) |  |

Definition at line 125 of file resources.cpp.

                                                  {

#ifdef DEBUG
    DbgMsgRecord(TEXT("-> CountersDelete\n"));
#endif

    for (UINT i=0; i<n; i++) {
        ASSERTE(pCounters[i] != NULL);
        CounterDelete(pCounters[i]);
        pCounters[i] = NULL;
    }

#ifdef DEBUG
    DbgMsgRecord(TEXT("<- CountersDelete\n"));
#endif
}

VOID QueueAdd | ( | Queue * | pQueue,
 |  | VOID * | pData,
 |  | BOOL | EnterCritSec
 | ) |  |

Definition at line 233 of file resources.cpp.

                                                             {

    ASSERTE(pQueue != NULL);

#ifdef DEBUG
    DbgMsgRecord(TEXT("-> QueueAdd\n"));
#endif

    QueueNode * pNode = (QueueNode *) AutoHeapAlloc(sizeof(QueueNode));
    if (pNode == NULL) {
        AddToMessageLog(TEXT("QueueAdd: AutoHeapAlloc failed"));
        return;
    }

    pNode->pNext = NULL;
    pNode->pData = pData;

    if (pQueue->lpCriticalSection != NULL && EnterCritSec) EnterCriticalSection(pQueue->lpCriticalSection);

    if (pQueue->pFirst == NULL) {
        ASSERTE(pQueue->pLast == NULL);
        pQueue->pFirst = pNode;
        pQueue->pLast = pNode;
    }
    else {
        ASSERTE(pQueue->pLast->pNext == NULL);
        pQueue->pLast->pNext = pNode;
        pQueue->pLast = pNode;
    }

#ifdef DEBUG
    DbgMsgRecord(TEXT("<- QueueAdd\n"));
#endif

    if (pQueue->lpCriticalSection != NULL && EnterCritSec) LeaveCriticalSection(pQueue->lpCriticalSection);
}

Queue* QueueCreate ( BOOL NoCritSec )

Definition at line 152 of file resources.cpp.

                                    {
    Queue * pQueue;

#ifdef DEBUG
    DbgMsgRecord(TEXT("-> QueueCreate\n"));
#endif

    pQueue = (Queue *)AutoHeapAlloc(sizeof(Queue));

    if (pQueue == NULL) {
        AddToMessageLog(TEXT("QueueCreate: AutoHeapAlloc failed"));
        return NULL;
    }

    pQueue->pFirst = NULL;
    pQueue->pLast = NULL;

    if (NoCritSec) {
        pQueue->lpCriticalSection = NULL;
    }
    else {
        pQueue->lpCriticalSection = (LPCRITICAL_SECTION) AutoHeapAlloc(sizeof(CRITICAL_SECTION));
        if (InitializeCriticalSectionAndSpinCount(pQueue->lpCriticalSection, 0) == 0) {
            AddToMessageLogProcFailure(TEXT("QueueCreate: InitializeCriticalSectionAndSpinCount"), GetLastError());
            QueueDelete(pQueue);
            return NULL;
        }
    }

#ifdef DEBUG
    DbgMsgRecord(TEXT("<- QueueCreate\n"));
#endif

    return pQueue;
}

VOID QueueDelete ( Queue * pQueue )

Definition at line 188 of file resources.cpp.

                                 {
    QueueNode *pNextNode;

#ifdef DEBUG
    DbgMsgRecord(TEXT("-> QueueDelete\n"));
#endif

    ASSERTE(pQueue != NULL);

    if (pQueue->lpCriticalSection != NULL) {
        DeleteCriticalSection(pQueue->lpCriticalSection);
        AutoHeapFree(pQueue->lpCriticalSection);
    }

    if (pQueue->pFirst != NULL) {
        for (QueueNode *pNode = pQueue->pFirst; pNode != NULL; pNode = pNextNode) {
            pNextNode = pNode->pNext;
            AutoHeapFree(pNode->pData);
            AutoHeapFree(pNode);
        }
    }

    AutoHeapFree(pQueue);

#ifdef DEBUG
    DbgMsgRecord(TEXT("<- QueueDelete\n"));
#endif
}

VOID QueueHashAdd | ( | Queue * | pQueue,
 |  | PSID | Sid,
 |  | VOID * | pValue,
 |  | BOOL | EnterCritSec
 | ) |  |

Definition at line 388 of file resources.cpp.

                                                                            {
    QueueHashNode *pQueueHashNode;
    DWORD SidLength;

    ASSERTE(pQueue != NULL);

    if (pQueue->lpCriticalSection != NULL && EnterCritSec) EnterCriticalSection(pQueue->lpCriticalSection);

#ifdef DEBUG
    DbgMsgRecord(TEXT("-> QueueHashAdd\n"));
#endif

    pQueueHashNode = (QueueHashNode *) AutoHeapAlloc(sizeof(QueueHashNode));

    SidLength = GetLengthSid(Sid);

    // We need to copy the key so that if the original
    // copy gets deallocated we still have one.
    if ((pQueueHashNode->pKey = AutoHeapAlloc(SidLength)) == NULL) {
        AddToMessageLog(TEXT("QueueHashAdd: AutoHeapAlloc failed"));

        if (pQueue->lpCriticalSection != NULL && EnterCritSec) LeaveCriticalSection(pQueue->lpCriticalSection);
        return;
    }

    if (CopySid(SidLength, pQueueHashNode->pKey, Sid) == 0) {
        AddToMessageLogProcFailure(TEXT("QueueHashAdd: CopySid"), GetLastError());

        if (pQueue->lpCriticalSection != NULL && EnterCritSec) LeaveCriticalSection(pQueue->lpCriticalSection);
        return;
    }

    pQueueHashNode->pValue = pValue;

    QueueAdd(pQueue, (VOID *) pQueueHashNode, FALSE);

#ifdef DEBUG
    DbgMsgRecord(TEXT("<- QueueHashAdd\n"));
#endif

    if (pQueue->lpCriticalSection != NULL && EnterCritSec) LeaveCriticalSection(pQueue->lpCriticalSection);
}

VOID QueueHashAddToSubqueue | ( | Queue * | pHashQueue,
 |  | PSID | pSID,
 |  | VOID * | pData
 | ) |  |

Definition at line 462 of file resources.cpp.

                                                                        {

    ASSERTE(pHashQueue != NULL);

    if (pHashQueue->lpCriticalSection != NULL) EnterCriticalSection(pHashQueue->lpCriticalSection);

#ifdef DEBUG
    DbgMsgRecord(TEXT("-> QueueHashAddToSubqueue\n"));
#endif

    // Put the request onto the appropriate queue.

    // Lookup the subqueue for the user's sid.
    Queue * pQueue = (Queue *) QueueHashLookup(pHashQueue, pSID, FALSE);
    // If the subqueue does not exist, create it.
    if (pQueue == NULL) {
        if ((pQueue = QueueCreate(TRUE)) == NULL) {
            AddToMessageLog(TEXT("QueueHashAddToSubqueue: QueueCreate failed"));
            if (pHashQueue->lpCriticalSection != NULL) LeaveCriticalSection(pHashQueue->lpCriticalSection);
            return;
  }
        QueueHashAdd(pHashQueue, pSID, pQueue, FALSE);
    }
    // Add the request to the subqueue
    QueueAdd(pQueue, pData, FALSE);

#ifdef DEBUG
    DbgMsgRecord(TEXT("<- QueueHashAddToSubqueue\n"));
#endif

    if (pHashQueue->lpCriticalSection != NULL) LeaveCriticalSection(pHashQueue->lpCriticalSection);
}

VOID QueueHashDecrementCounter | ( | Queue * | pHashQueue,
 |  | PSID | pSID
 | ) |  |

Definition at line 591 of file resources.cpp.

                                                             {
    Counter *pCounter;

    ASSERTE(pHashQueue != NULL);

    if (pHashQueue->lpCriticalSection != NULL) EnterCriticalSection(pHashQueue->lpCriticalSection);

#ifdef DEBUG
    DbgMsgRecord(TEXT("-> QueueHashDecrementCounter\n"));
#endif

    // Put the counter onto the appropriate queue.
    // Lookup the counter for the user's sid.
    pCounter = (Counter *) QueueHashLookup(pHashQueue, pSID, FALSE);
    // If the counter does not exist, create it.
    if (pCounter == NULL) {
        if ((pCounter = CounterCreate(MaxUserReqs)) == NULL) {
            AddToMessageLog(TEXT("QueueHashIncrementCounter: CounterCreate failed"));
            if (pHashQueue->lpCriticalSection != NULL) LeaveCriticalSection(pHashQueue->lpCriticalSection);
            return;
        }
        QueueHashAdd(pHashQueue, pSID, pCounter, FALSE);
    }
    // Decrement the counter.
    CounterDecrement(pCounter);

#ifdef DEBUG
    DbgMsgRecord(TEXT("<- QueueHashDecrementCounter\n"));
#endif

    if (pHashQueue->lpCriticalSection != NULL) LeaveCriticalSection(pHashQueue->lpCriticalSection);
}

BOOL QueueHashIncrementCounter | ( | Queue * | pHashQueue,
 |  | PSID | pSID
 | ) |  |

Definition at line 555 of file resources.cpp.

                                                             {
    Counter *pCounter;
    BOOL ret;

    ASSERTE(pHashQueue != NULL);

    if (pHashQueue->lpCriticalSection != NULL) EnterCriticalSection(pHashQueue->lpCriticalSection);

#ifdef DEBUG
    DbgMsgRecord(TEXT("-> QueueHashIncrementCounter\n"));
#endif

    // Put the counter onto the appropriate queue.
    // Lookup the counter for the user's sid.
    pCounter = (Counter *) QueueHashLookup(pHashQueue, pSID, FALSE);
    // If the counter does not exist, create it.
    if (pCounter == NULL) {
        if ((pCounter = CounterCreate(MaxUserReqs)) == NULL) {
            AddToMessageLog(TEXT("QueueHashIncrementCounter: CounterCreate failed"));
            if (pHashQueue->lpCriticalSection != NULL) LeaveCriticalSection(pHashQueue->lpCriticalSection);
            return FALSE;
        }
        QueueHashAdd(pHashQueue, pSID, pCounter, FALSE);
    }
    // Attempt to increment the counter
    ret = CounterIncrement(pCounter);

#ifdef DEBUG
    DbgMsgRecord(TEXT("<- QueueHashIncrementCounter\n"));
#endif

    if (pHashQueue->lpCriticalSection != NULL) LeaveCriticalSection(pHashQueue->lpCriticalSection);

    return ret;
}

VOID* QueueHashLookup | ( | Queue * | pQueue,
 |  | PSID | Sid,
 |  | BOOL | EnterCritSec
 | ) |  |

Definition at line 431 of file resources.cpp.

                                                                   {
    VOID * pValue;
    QueueNode *pNextNode;

    ASSERTE(pQueue != NULL);

    if (pQueue->lpCriticalSection != NULL && EnterCritSec) EnterCriticalSection(pQueue->lpCriticalSection);

#ifdef DEBUG
    DbgMsgRecord(TEXT("-> QueueHashLookup\n"));
#endif

    pValue = NULL;

    for (QueueNode *pNode = pQueue->pFirst; pNode != NULL; pNode = pNextNode) {
        pNextNode = pNode->pNext;
        if (EqualSid(((QueueHashNode *)(pNode->pData))->pKey, Sid) == TRUE) {
            pValue = ((QueueHashNode *)(pNode->pData))->pValue;
            break;
        }
    }

#ifdef DEBUG
    DbgMsgRecord(TEXT("<- QueueHashLookup\n"));
#endif

    if (pQueue->lpCriticalSection != NULL && EnterCritSec) LeaveCriticalSection(pQueue->lpCriticalSection);

    return pValue;
}

VOID* QueueHashRemoveFromSubqueue ( Queue * pQueue )

Definition at line 495 of file resources.cpp.

                                                  {
    Queue * pSubQueue;
    QueueNode *pPrevNode;
    VOID * pData;

    ASSERTE(pQueue != NULL);

    if (pQueue->lpCriticalSection != NULL) EnterCriticalSection(pQueue->lpCriticalSection);

    pSubQueue = NULL;

#ifdef DEBUG
    DbgMsgRecord(TEXT("-> QueueHashRemoveFromSubqueue\n"));
#endif

    // If the hash queue is not empty.
    if (pQueue->pFirst != NULL) {
        // Find the first nonempty subqueue.
        pPrevNode = NULL;
        for (QueueNode *pNode = pQueue->pFirst; pNode != NULL; pNode = pNode->pNext) {

            // Check if it has elements in it.
            if (!QueueIsEmpty((Queue*) ((QueueHashNode *)pNode->pData)->pValue)) {
                // Select it.  We will extract an element off this subqueue
                // and put the subqueue into the end of the hash queue.
                pSubQueue = (Queue*) ((QueueHashNode *)pNode->pData)->pValue;

                // Take it off the hash queue and put it
                // on the back.
                QueueMoveToBack(pQueue, pNode, pPrevNode);

                break;
            }

            pPrevNode = pNode;
        }
        if (pSubQueue == NULL) {
            // We did not find any nonemoty subqueues.
            pData = NULL;
        }
    }
    else {
        // There are no nonempty subqueues.
        pData = NULL;
    }

    if (pSubQueue != NULL) {
        // Extract an element from the subqueue.
        pData = QueueRemove(pSubQueue);
    }

#ifdef DEBUG
    DbgMsgRecord(TEXT("<- QueueHashRemoveFromSubqueue\n"));
#endif

    if (pQueue->lpCriticalSection != NULL) LeaveCriticalSection(pQueue->lpCriticalSection);

    return pData;
}

BOOL QueueIsEmpty ( Queue * pQueue )

Definition at line 217 of file resources.cpp.

                                  {
    BOOL Ret = FALSE;

    ASSERTE(pQueue != NULL);

    if (pQueue->lpCriticalSection != NULL) EnterCriticalSection(pQueue->lpCriticalSection);

    Ret = (pQueue->pFirst == NULL);

    ASSERTE((!Ret) || (pQueue->pFirst == pQueue->pLast));

    if (pQueue->lpCriticalSection != NULL) LeaveCriticalSection(pQueue->lpCriticalSection);

    return Ret;
}

VOID QueueMoveToBack | ( | Queue * | pQueue,
 |  | QueueNode * | pNode,
 |  | QueueNode * | pPrevNode
 | ) |  |

Definition at line 311 of file resources.cpp.

                                                                            {

    ASSERTE(pQueue != NULL);
    ASSERTE(pNode != NULL);

    if (pQueue->lpCriticalSection != NULL) EnterCriticalSection(pQueue->lpCriticalSection);

    // If it is the first element.
    if (pPrevNode == NULL) {
        pQueue->pFirst = pNode->pNext;
    }
    // If it has a predecessor in the queue
    else {
        pPrevNode->pNext = pNode->pNext;
    }

    // If it is the last element.
    if (pNode->pNext == NULL) {
        if (pQueue->lpCriticalSection != NULL) LeaveCriticalSection(pQueue->lpCriticalSection);
        return;
    }

    // Put the subqueue onto the back of the queue.
    pNode->pNext = NULL;
    if (QueueIsEmpty(pQueue)) {
        pQueue->pFirst = pNode;
        pQueue->pLast = pNode;
    }
    else {
        pQueue->pLast->pNext = pNode;
        pQueue->pLast = pNode;
    }

    if (pQueue->lpCriticalSection != NULL) LeaveCriticalSection(pQueue->lpCriticalSection);
}

VOID* QueueRemove ( Queue * pQueue )

Definition at line 270 of file resources.cpp.

                                  {
    VOID * pData;
    QueueNode *pFuturepFirst;
    VOID * pToFree;

    ASSERTE(pQueue != NULL);

    if (pQueue->lpCriticalSection != NULL) EnterCriticalSection(pQueue->lpCriticalSection);

#ifdef DEBUG
    DbgMsgRecord(TEXT("-> QueueRemove\n"));
#endif

    if (pQueue->pFirst == NULL) {
        ASSERTE(pQueue->pFirst == pQueue->pLast);

        if (pQueue->lpCriticalSection != NULL) LeaveCriticalSection(pQueue->lpCriticalSection);
        return NULL;
    }

    pData = pQueue->pFirst->pData;
    pFuturepFirst = pQueue->pFirst->pNext;

    if (pFuturepFirst == NULL) {
        pQueue->pLast = NULL;
    }

    pToFree = pQueue->pFirst;
    pQueue->pFirst = pFuturepFirst;

#ifdef DEBUG
    DbgMsgRecord(TEXT("<- QueueRemove\n"));
#endif

    if (pQueue->lpCriticalSection != NULL) LeaveCriticalSection(pQueue->lpCriticalSection);

    AutoHeapFree(pToFree);

    return pData;
}

BOOL QueuesCreate | ( | Queue * | Queues[],
 |  | UINT | n,
 |  | BOOL | NoCritSec
 | ) |  |

Definition at line 347 of file resources.cpp.

                                                           {
    BOOL ret = FALSE;

#ifdef DEBUG
    DbgMsgRecord(TEXT("-> QueuesCreate\n"));
#endif

    for (UINT i=0; i<n; i++) {
        if ((Queues[i] = QueueCreate(NoCritSec)) == NULL) {
            QueuesDelete(Queues, i-1);
            ret = FALSE;
            break;
        }
    }

    ret = TRUE;

#ifdef DEBUG
    DbgMsgRecord(TEXT("<- QueuesCreate\n"));
#endif

    return ret;
}

VOID QueuesDelete | ( | Queue * | Queues[],
 |  | UINT | n
 | ) |  |

Definition at line 371 of file resources.cpp.

                                           {

#ifdef DEBUG
    DbgMsgRecord(TEXT("-> QueuesDelete\n"));
#endif

    for (UINT i=0; i<n; i++) {
        QueueDelete(Queues[i]);
        Queues[i] = NULL;
    }

#ifdef DEBUG
    DbgMsgRecord(TEXT("<- QueuesDelete\n"));
#endif

}

Generated on Wed Nov 13 2024 16:53:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/filerepmultiuser/resources.h File Reference

  • NetDS
  • RPC
  • FileRep
  • filerepmultiuser
Classes | Typedefs | Functions

resources.h File Reference

Go to the source code of this file.

Classes

struct | _QueueHashNode
struct | _QueueNode
struct | Counter
struct | Queue

Typedefs

typedef struct _QueueHashNode | QueueHashNode
typedef struct _QueueNode | QueueNode

Functions

Counter * | CounterCreate (UINT Bound)
VOID | CounterDecrement (Counter *pCounter)
VOID | CounterDelete (Counter *pCounter)
BOOL | CounterIncrement (Counter *pCounter)
BOOL | CountersCheckForNonzero (Counter *pCounters[], UINT n)
BOOL | CountersCreate (Counter *Counters[], UINT nCounters, UINT *Bounds)
VOID | CountersDelete (Counter *pCounters[], UINT n)
VOID | QueueAdd (Queue *pQueue, VOID *pData, BOOL EnterCritSec)
Queue * | QueueCreate (BOOL NoCritSec)
VOID | QueueDelete (Queue *pQueue)
VOID | QueueHashAdd (Queue *pQueue, PSID Sid, VOID *pValue, BOOL EnterCritSec)
VOID | QueueHashAddToSubqueue (Queue *pHashQueue, PSID pSID, VOID *pData)
VOID | QueueHashDecrementCounter (Queue *pQueue, PSID pSID)
BOOL | QueueHashIncrementCounter (Queue *pHashQueue, PSID pSID)
VOID * | QueueHashLookup (Queue *pQueue, PSID Sid, BOOL EnterCritSec)
VOID * | QueueHashRemoveFromSubqueue (Queue *pQueue)
BOOL | QueueIsEmpty (Queue *pQueue)
VOID | QueueMoveToBack (Queue *pQueue, QueueNode *pNode, QueueNode *pPrevNode)
VOID * | QueueRemove (Queue *pQueue)
BOOL | QueuesCreate (Queue *Queues[], UINT n, BOOL NoCritSec)
VOID | QueuesDelete (Queue *Queues[], UINT n)

Typedef Documentation

typedef struct _QueueHashNode QueueHashNode
typedef struct _QueueNode QueueNode

Function Documentation

Counter* CounterCreate ( UINT Bound )

Definition at line 22 of file Resources.cpp.

                                    {
    Counter * pCounter;

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> CounterCreate\n"));
#endif

    pCounter = (Counter *)AutoHeapAlloc(sizeof(Counter));

    if (pCounter == NULL) {
        return NULL;
    }

    pCounter->Value = 0;
    pCounter->Bound = Bound;

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- CounterCreate\n"));
#endif

    return pCounter;
}

VOID CounterDecrement ( Counter * pCounter )

Definition at line 85 of file Resources.cpp.

                                         {

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> CounterDecrement\n"));
#endif

    ASSERT(pCounter != NULL);

    InterlockedDecrement(&pCounter->Value);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- CounterDecrement\n"));
#endif

}

VOID CounterDelete ( Counter * pCounter )

Definition at line 45 of file Resources.cpp.

                                       {

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> CounterDelete\n"));
#endif

    ASSERT(pCounter != NULL);

    AutoHeapFree(pCounter);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- CounterDelete\n"));
#endif
}

BOOL CounterIncrement ( Counter * pCounter )

Definition at line 60 of file Resources.cpp.

                                         {
    BOOL ret = FALSE;

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> CounterIncrement\n"));
#endif

    ASSERT(pCounter != NULL);

    // Check for the bound.
    if (InterlockedIncrement(&pCounter->Value) > pCounter->Bound) {
        ret = FALSE;
        InterlockedDecrement(&pCounter->Value);
    }
    else {
        ret = TRUE;
    }

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- CounterIncrement\n"));
#endif

    return ret;
}

BOOL CountersCheckForNonzero | ( | Counter * | pCounters[],
 |  | UINT | n
 | ) |  |

Definition at line 141 of file Resources.cpp.

                                                           {
    for (UINT i=0; i<n; i++) {
        ASSERT(pCounters[i] != NULL);
        if (pCounters[i]->Value != 0) {
            return TRUE;
        }
    }
    return FALSE;
}

BOOL CountersCreate | ( | Counter * | Counters[],
 |  | UINT | nCounters,
 |  | UINT * | Bounds
 | ) |  |

Definition at line 101 of file Resources.cpp.

                                                                 {
    BOOL ret = FALSE;

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> CountersCreate\n"));
#endif

    for (UINT i=0; i<n; i++) {
        if ((pCounters[i] = CounterCreate(Bounds[i])) == NULL) {
            CountersDelete(pCounters, i-1);
            ret = FALSE;
            break;
        }
    }
    ret = TRUE;

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- CountersCreate\n"));
#endif

    return ret;
}

VOID CountersDelete | ( | Counter * | pCounters[],
 |  | UINT | n
 | ) |  |

Definition at line 124 of file Resources.cpp.

                                                  {

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> CountersDelete\n"));
#endif

    for (UINT i=0; i<n; i++) {
        ASSERT(pCounters[i] != NULL);
        CounterDelete(pCounters[i]);
        pCounters[i] = NULL;
    }

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- CountersDelete\n"));
#endif
}

VOID QueueAdd | ( | Queue * | pQueue,
 |  | VOID * | pData,
 |  | BOOL | EnterCritSec
 | ) |  |

Definition at line 232 of file Resources.cpp.

                                                             {

    ASSERT(pQueue != NULL);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> QueueAdd\n"));
#endif

    QueueNode * pNode = (QueueNode *) AutoHeapAlloc(sizeof(QueueNode));
    if (pNode == NULL) {
        AddToMessageLog(TEXT("QueueAdd: AutoHeapAlloc failed"));
        return;
    }

    pNode->pNext = NULL;
    pNode->pData = pData;

    if (pQueue->lpCriticalSection != NULL && EnterCritSec) EnterCriticalSection(pQueue->lpCriticalSection);

    if (pQueue->pFirst == NULL) {
        //ASSERT(pQueue->pLast == NULL);
        pQueue->pFirst = pNode;
        pQueue->pLast = pNode;
    }
    else {
        ASSERT(pQueue->pLast->pNext == NULL);
        pQueue->pLast->pNext = pNode;
        pQueue->pLast = pNode;
    }

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- QueueAdd\n"));
#endif

    if (pQueue->lpCriticalSection != NULL && EnterCritSec) LeaveCriticalSection(pQueue->lpCriticalSection);
}

Queue* QueueCreate ( BOOL NoCritSec )

Definition at line 151 of file Resources.cpp.

                                    {
    Queue * pQueue;

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> QueueCreate\n"));
#endif

    pQueue = (Queue *)AutoHeapAlloc(sizeof(Queue));

    if (pQueue == NULL) {
        AddToMessageLog(TEXT("QueueCreate: AutoHeapAlloc failed"));
        return NULL;
    }

    pQueue->pFirst = NULL;
    pQueue->pLast = NULL;

    if (NoCritSec) {
        pQueue->lpCriticalSection = NULL;
    }
    else {
        pQueue->lpCriticalSection = (LPCRITICAL_SECTION) AutoHeapAlloc(sizeof(CRITICAL_SECTION));
        if (InitializeCriticalSectionAndSpinCount(pQueue->lpCriticalSection, 100) == 0) {
            AddToMessageLogProcFailure(TEXT("QueueCreate: InitializeCriticalSectionAndSpinCount"), GetLastError());
            QueueDelete(pQueue);
            return NULL;
        }
    }

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- QueueCreate\n"));
#endif

    return pQueue;
}

VOID QueueDelete ( Queue * pQueue )

Definition at line 187 of file Resources.cpp.

                                 {
    QueueNode *pNextNode;

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> QueueDelete\n"));
#endif

    ASSERT(pQueue != NULL);

    if (pQueue->lpCriticalSection != NULL) {
        DeleteCriticalSection(pQueue->lpCriticalSection);
        AutoHeapFree(pQueue->lpCriticalSection);
    }

    if (pQueue->pFirst != NULL) {
        for (QueueNode *pNode = pQueue->pFirst; pNode != NULL; pNode = pNextNode) {
            pNextNode = pNode->pNext;
            AutoHeapFree(pNode->pData);
            AutoHeapFree(pNode);
        }
    }

    AutoHeapFree(pQueue);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- QueueDelete\n"));
#endif
}

VOID QueueHashAdd | ( | Queue * | pQueue,
 |  | PSID | Sid,
 |  | VOID * | pValue,
 |  | BOOL | EnterCritSec
 | ) |  |

Definition at line 434 of file Resources.cpp.

                                                                            {
    QueueHashNode *pQueueHashNode;
    DWORD SidLength;

    ASSERT(pQueue != NULL);

    if (pQueue->lpCriticalSection != NULL && EnterCritSec) EnterCriticalSection(pQueue->lpCriticalSection);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> QueueHashAdd\n"));
#endif

    pQueueHashNode = (QueueHashNode *) AutoHeapAlloc(sizeof(QueueHashNode));

    SidLength = GetLengthSid(Sid);

    // We need to copy the key so that if the original
    // copy gets deallocated we still have one.
    if ((pQueueHashNode->pKey = AutoHeapAlloc(SidLength)) == NULL) {
        AddToMessageLog(TEXT("QueueHashAdd: AutoHeapAlloc failed"));

        if (pQueue->lpCriticalSection != NULL && EnterCritSec) LeaveCriticalSection(pQueue->lpCriticalSection);
        return;
    }

    if (CopySid(SidLength, pQueueHashNode->pKey, Sid) == 0) {
        AddToMessageLogProcFailure(TEXT("QueueHashAdd: CopySid"), GetLastError());

        if (pQueue->lpCriticalSection != NULL && EnterCritSec) LeaveCriticalSection(pQueue->lpCriticalSection);
        return;
    }

    pQueueHashNode->pValue = pValue;

    QueueAdd(pQueue, (VOID *) pQueueHashNode, FALSE);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- QueueHashAdd\n"));
#endif

    if (pQueue->lpCriticalSection != NULL && EnterCritSec) LeaveCriticalSection(pQueue->lpCriticalSection);
}

VOID QueueHashAddToSubqueue | ( | Queue * | pHashQueue,
 |  | PSID | pSID,
 |  | VOID * | pData
 | ) |  |

Definition at line 508 of file Resources.cpp.

                                                                        {

    ASSERT(pHashQueue != NULL);

    if (pHashQueue->lpCriticalSection != NULL) EnterCriticalSection(pHashQueue->lpCriticalSection);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> QueueHashAddToSubqueue\n"));
#endif

    // Put the request onto the appropriate queue.

    // Lookup the subqueue for the user's sid.
    Queue * pQueue = (Queue *) QueueHashLookup(pHashQueue, pSID, FALSE);
    // If the subqueue does not exist, create it.
    if (pQueue == NULL) {
        if ((pQueue = QueueCreate(TRUE)) == NULL) {
            AddToMessageLog(TEXT("QueueHashAddToSubqueue: QueueCreate failed"));
            if (pHashQueue->lpCriticalSection != NULL) LeaveCriticalSection(pHashQueue->lpCriticalSection);
            return;
  }
        QueueHashAdd(pHashQueue, pSID, pQueue, FALSE);
    }
    // Add the request to the subqueue
    QueueAdd(pQueue, pData, FALSE);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- QueueHashAddToSubqueue\n"));
#endif

    if (pHashQueue->lpCriticalSection != NULL) LeaveCriticalSection(pHashQueue->lpCriticalSection);
}

VOID QueueHashDecrementCounter | ( | Queue * | pQueue,
 |  | PSID | pSID
 | ) |  |

Definition at line 637 of file Resources.cpp.

                                                             {
    Counter *pCounter;

    ASSERT(pHashQueue != NULL);

    if (pHashQueue->lpCriticalSection != NULL) EnterCriticalSection(pHashQueue->lpCriticalSection);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> QueueHashDecrementCounter\n"));
#endif

    // Put the counter onto the appropriate queue.
    // Lookup the counter for the user's sid.
    pCounter = (Counter *) QueueHashLookup(pHashQueue, pSID, FALSE);
    // If the counter does not exist, create it.
    if (pCounter == NULL) {
        if ((pCounter = CounterCreate(MaxUserReqs)) == NULL) {
            AddToMessageLog(TEXT("QueueHashIncrementCounter: CounterCreate failed"));
            if (pHashQueue->lpCriticalSection != NULL) LeaveCriticalSection(pHashQueue->lpCriticalSection);
            return;
        }
        QueueHashAdd(pHashQueue, pSID, pCounter, FALSE);
    }
    // Decrement the counter.
    CounterDecrement(pCounter);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- QueueHashDecrementCounter\n"));
#endif

    if (pHashQueue->lpCriticalSection != NULL) LeaveCriticalSection(pHashQueue->lpCriticalSection);
}

BOOL QueueHashIncrementCounter | ( | Queue * | pHashQueue,
 |  | PSID | pSID
 | ) |  |

Definition at line 601 of file Resources.cpp.

                                                             {
    Counter *pCounter;
    BOOL ret;

    ASSERT(pHashQueue != NULL);

    if (pHashQueue->lpCriticalSection != NULL) EnterCriticalSection(pHashQueue->lpCriticalSection);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> QueueHashIncrementCounter\n"));
#endif

    // Put the counter onto the appropriate queue.
    // Lookup the counter for the user's sid.
    pCounter = (Counter *) QueueHashLookup(pHashQueue, pSID, FALSE);
    // If the counter does not exist, create it.
    if (pCounter == NULL) {
        if ((pCounter = CounterCreate(MaxUserReqs)) == NULL) {
            AddToMessageLog(TEXT("QueueHashIncrementCounter: CounterCreate failed"));
            if (pHashQueue->lpCriticalSection != NULL) LeaveCriticalSection(pHashQueue->lpCriticalSection);
            return FALSE;
        }
        QueueHashAdd(pHashQueue, pSID, pCounter, FALSE);
    }
    // Attempt to increment the counter
    ret = CounterIncrement(pCounter);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- QueueHashIncrementCounter\n"));
#endif

    if (pHashQueue->lpCriticalSection != NULL) LeaveCriticalSection(pHashQueue->lpCriticalSection);

    return ret;
}

VOID* QueueHashLookup | ( | Queue * | pQueue,
 |  | PSID | Sid,
 |  | BOOL | EnterCritSec
 | ) |  |

Definition at line 477 of file Resources.cpp.

                                                                   {
    VOID * pValue;
    QueueNode *pNextNode;

    ASSERT(pQueue != NULL);

    if (pQueue->lpCriticalSection != NULL && EnterCritSec) EnterCriticalSection(pQueue->lpCriticalSection);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> QueueHashLookup\n"));
#endif

    pValue = NULL;

    for (QueueNode *pNode = pQueue->pFirst; pNode != NULL; pNode = pNextNode) {
        pNextNode = pNode->pNext;
        if (EqualSid(((QueueHashNode *)(pNode->pData))->pKey, Sid) == TRUE) {
            pValue = ((QueueHashNode *)(pNode->pData))->pValue;
            break;
        }
    }

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- QueueHashLookup\n"));
#endif

    if (pQueue->lpCriticalSection != NULL && EnterCritSec) LeaveCriticalSection(pQueue->lpCriticalSection);

    return pValue;
}

VOID* QueueHashRemoveFromSubqueue ( Queue * pQueue )

Definition at line 541 of file Resources.cpp.

                                                  {
    Queue * pSubQueue;
    QueueNode *pPrevNode;
    VOID * pData;

    ASSERT(pQueue != NULL);

    if (pQueue->lpCriticalSection != NULL) EnterCriticalSection(pQueue->lpCriticalSection);

    pSubQueue = NULL;

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> QueueHashRemoveFromSubqueue\n"));
#endif

    // If the hash queue is not empty.
    if (pQueue->pFirst != NULL) {
        // Find the first nonempty subqueue.
        pPrevNode = NULL;
        for (QueueNode *pNode = pQueue->pFirst; pNode != NULL; pNode = pNode->pNext) {

            // Check if it has elements in it.
            if (!QueueIsEmpty((Queue*) ((QueueHashNode *)pNode->pData)->pValue)) {
                // Select it.  We will extract an element off this subqueue
                // and put the subqueue into the end of the hash queue.
                pSubQueue = (Queue*) ((QueueHashNode *)pNode->pData)->pValue;

                // Take it off the hash queue and put it
                // on the back.
                QueueMoveToBack(pQueue, pNode, pPrevNode);

                break;
            }

            pPrevNode = pNode;
        }
        if (pSubQueue == NULL) {
            // We did not find any nonemoty subqueues.
            pData = NULL;
        }
    }
    else {
        // There are no nonempty subqueues.
        pData = NULL;
    }

    if (pSubQueue != NULL) {
        // Extract an element from the subqueue.
        pData = QueueRemove(pSubQueue);
    }

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- QueueHashRemoveFromSubqueue\n"));
#endif

    if (pQueue->lpCriticalSection != NULL) LeaveCriticalSection(pQueue->lpCriticalSection);

    return pData;
}

BOOL QueueIsEmpty ( Queue * pQueue )

Definition at line 216 of file Resources.cpp.

                                  {
    BOOL Ret = FALSE;

    ASSERT(pQueue != NULL);

    if (pQueue->lpCriticalSection != NULL) EnterCriticalSection(pQueue->lpCriticalSection);

    Ret = (pQueue->pFirst == NULL);

    ASSERT((!Ret) || (pQueue->pFirst == pQueue->pLast));

    if (pQueue->lpCriticalSection != NULL) LeaveCriticalSection(pQueue->lpCriticalSection);

    return Ret;
}

VOID QueueMoveToBack | ( | Queue * | pQueue,
 |  | QueueNode * | pNode,
 |  | QueueNode * | pPrevNode
 | ) |  |

Definition at line 357 of file Resources.cpp.

                                                                            {

    ASSERT(pQueue != NULL);
    ASSERT(pNode != NULL);

    if (pQueue->lpCriticalSection != NULL) EnterCriticalSection(pQueue->lpCriticalSection);

    // If it is the first element.
    if (pPrevNode == NULL) {
        pQueue->pFirst = pNode->pNext;
    }
    // If it has a predecessor in the queue
    else {
        pPrevNode->pNext = pNode->pNext;
    }

    // If it is the last element.
    if (pNode->pNext == NULL) {
        if (pQueue->lpCriticalSection != NULL) LeaveCriticalSection(pQueue->lpCriticalSection);
        return;
    }

    // Put the subqueue onto the back of the queue.
    pNode->pNext = NULL;
    if (QueueIsEmpty(pQueue)) {
        pQueue->pFirst = pNode;
        pQueue->pLast = pNode;
    }
    else {
        pQueue->pLast->pNext = pNode;
        pQueue->pLast = pNode;
    }

    if (pQueue->lpCriticalSection != NULL) LeaveCriticalSection(pQueue->lpCriticalSection);
}

VOID* QueueRemove ( Queue * pQueue )

Definition at line 269 of file Resources.cpp.

                                  {
    VOID * pData;
    QueueNode *pFuturepFirst;
    VOID * pToFree;

    ASSERT(pQueue != NULL);

    if (pQueue->lpCriticalSection != NULL) EnterCriticalSection(pQueue->lpCriticalSection);

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> QueueRemove\n"));
#endif

    if (pQueue->pFirst == NULL) {
        ASSERT(pQueue->pFirst == pQueue->pLast);

        if (pQueue->lpCriticalSection != NULL) LeaveCriticalSection(pQueue->lpCriticalSection);
        return NULL;
    }

    pData = pQueue->pFirst->pData;
    pFuturepFirst = pQueue->pFirst->pNext;

    if (pFuturepFirst == NULL) {
        pQueue->pLast = NULL;
    }

    pToFree = pQueue->pFirst;
    pQueue->pFirst = pFuturepFirst;

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- QueueRemove\n"));
#endif

    if (pQueue->lpCriticalSection != NULL) LeaveCriticalSection(pQueue->lpCriticalSection);

    AutoHeapFree(pToFree);

    return pData;
}

BOOL QueuesCreate | ( | Queue * | Queues[],
 |  | UINT | n,
 |  | BOOL | NoCritSec
 | ) |  |

Definition at line 393 of file Resources.cpp.

                                                           {
    BOOL ret = FALSE;

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> QueuesCreate\n"));
#endif

    for (UINT i=0; i<n; i++) {
        if ((Queues[i] = QueueCreate(NoCritSec)) == NULL) {
            QueuesDelete(Queues, i-1);
            ret = FALSE;
            break;
        }
    }

    ret = TRUE;

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- QueuesCreate\n"));
#endif

    return ret;
}

VOID QueuesDelete | ( | Queue * | Queues[],
 |  | UINT | n
 | ) |  |

Definition at line 417 of file Resources.cpp.

                                           {

#ifdef DEBUG2
    DbgMsgRecord(TEXT("-> QueuesDelete\n"));
#endif

    for (UINT i=0; i<n; i++) {
        QueueDelete(Queues[i]);
        Queues[i] = NULL;
    }

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<- QueuesDelete\n"));
#endif

}

Generated on Wed Nov 13 2024 16:53:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/filerepmultiuser/service.cpp File Reference

  • NetDS
  • RPC
  • FileRep
  • filerepmultiuser
Functions | Variables

service.cpp File Reference

#include <windows.h>
#include <stdio.h>
#include <tchar.h>
#include <lm.h>
#include "common.h"
#include "Service.h"

Go to the source code of this file.

Functions

VOID | AddRpcEEInfo (DWORD Status, LPTSTR Msg)
VOID | AddRpcEEInfoAndRaiseException (DWORD Status, LPTSTR Msg)
VOID | AddToMessageLog (LPTSTR szMsg2)
VOID | AddToMessageLogProcFailure (LPTSTR ProcName, DWORD ErrCode)
VOID | AddToMessageLogProcFailureEEInfo (LPTSTR ProcName, DWORD ErrCode)
VOID | CreateWellKnownSids (VOID)
VOID | DeleteWellKnownSids (VOID)
UINT | GetCurrentUserPriority (VOID)
PTOKEN_GROUPS | GetUserGroups (VOID)
PSID GetUserSID ()
BOOL | IsGroupMember (PSID pSID, PTOKEN_GROUPS pGroupInfo)
VOID __RPC_FAR *__RPC_API | midl_user_allocate (size_t len)
VOID __RPC_API | midl_user_free (VOID __RPC_FAR *ptr)
BOOL | ReportStatusToSCMgr (SERVICE_STATUS_HANDLE *sshStatusHandle, SERVICE_STATUS *ssStatus, DWORD dwCurrentState, DWORD dwWin32ExitCode, DWORD dwWaitHint)

Variables

const UINT | ClientActiveReqBounds [] = {1, 5, 10}
Queue * ClientActiveReqHashCounters [NumPriGroups]
Queue * ClientActiveReqHashQueues [NumPriGroups]
const UINT | ClientReqBounds [] = {10, 20, 30}
Queue * ClientReqQueues [NumPriGroups]
const UINT | MaxUserReqs = 5
const UINT | NumPriGroups = 3
PSID | pAdminSID = NULL
PSID | pAnonSID = NULL
Counter * pClientActiveReqCounters [NumPriGroups]
Counter * pClientReqCounters [NumPriGroups]
Counter * pServerReqCounters [NumPriGroups]
PSID | pSystemSID = NULL
const UINT | RegUsersPri = 1
HANDLE RpcHeap
const UINT | ServerReqBounds [] = {10, 20, 30}

Function Documentation

VOID AddRpcEEInfo | ( | DWORD | Status,
 |  | LPTSTR | Msg
 | ) |  |

Definition at line 558 of file service.cpp.

                                            {
    RPC_STATUS rpcstatus;

    RPC_EXTENDED_ERROR_INFO ErrorInfo;

    ErrorInfo.Version = RPC_EEINFO_VERSION;
    ErrorInfo.ComputerName = NULL;
    ErrorInfo.ProcessID = 0;
    ErrorInfo.GeneratingComponent = 0;
    ErrorInfo.Status = Status;
    ErrorInfo.DetectionLocation = 0;
    ErrorInfo.Flags = 0;
    ErrorInfo.NumberOfParameters = 1;
    ErrorInfo.Parameters[0].ParameterType = eeptUnicodeString;
    ErrorInfo.Parameters[0].u.UnicodeString = Msg;

    rpcstatus = RpcErrorAddRecord(&ErrorInfo);

    RpcRaiseException(Status);
}

VOID AddRpcEEInfoAndRaiseException | ( | DWORD | Status,
 |  | LPTSTR | Msg
 | ) |  |

Definition at line 579 of file service.cpp.

                                                             {
    AddRpcEEInfo(Status, Msg);
    RpcRaiseException(Status);
}

VOID AddToMessageLog ( LPTSTR szMsg2 )

Definition at line 510 of file service.cpp.

                                    {
    TCHAR szMsg1[256];
    HANDLE hEventSource;
    LPTSTR lpszStrings[2];
    DWORD dwErr = 0;

    dwErr = GetLastError();

    // Use event logging to log the error.
    hEventSource = RegisterEventSource(NULL, SERVICENAME);

    _stprintf(szMsg1, TEXT("%s error: %d"), SERVICENAME, dwErr);
    lpszStrings[0] = szMsg1;
    lpszStrings[1] = szMsg2;

    if (hEventSource != NULL) {
        ReportEvent(hEventSource, // handle of event source
                    EVENTLOG_ERROR_TYPE, // event type
                    0, // event category
                    0, // event ID
                    NULL, // current user's SID
                    2, // strings in lpszStrings
                    0, // no bytes of raw data
                    (LPCTSTR *) lpszStrings, // array of error strings
                    NULL); // no raw data

        (VOID) DeregisterEventSource(hEventSource);
    }
}

VOID AddToMessageLogProcFailure | ( | LPTSTR | ProcName,
 |  | DWORD | ErrCode
 | ) |  |

Definition at line 540 of file service.cpp.

                                                                {
    TCHAR Msg[MSG_SIZE];
    _stprintf(Msg, TEXT("%s failed with code %d"), ProcName, ErrCode);
    AddToMessageLog(Msg);
}

VOID AddToMessageLogProcFailureEEInfo | ( | LPTSTR | ProcName,
 |  | DWORD | ErrCode
 | ) |  |

Definition at line 546 of file service.cpp.

                                                                      {
    TCHAR Msg[MSG_SIZE];
    UINT MsgSize = 0;

    MsgSize += _stprintf(&Msg[MsgSize], TEXT("%s failed with code %d\n"), ProcName, ErrCode);
    GetEEInfoText(Msg, MSG_SIZE, &MsgSize);

    Msg[MsgSize] = 0;

    AddToMessageLog(Msg);
}

VOID CreateWellKnownSids ( VOID )

Definition at line 339 of file service.cpp.

                               {
    SID_IDENTIFIER_AUTHORITY SIDAuth = SECURITY_NT_AUTHORITY;

    // Generate SID for the system if necessary.
    if (pSystemSID == NULL) {
        if (AllocateAndInitializeSid(&SIDAuth, 1,
                                     SECURITY_LOCAL_SYSTEM_RID,
                                     0, 0, 0, 0, 0, 0, 0,
                                     &pSystemSID) == 0) {
            AddToMessageLogProcFailure(TEXT("CreateWellKnownSids: AllocateAndInitializeSid"), GetLastError());
        }
    }

    // Generate SID for the admin group if necessary.
    if (pAdminSID == NULL) {
        if (AllocateAndInitializeSid(&SIDAuth, 1,
                                     DOMAIN_ALIAS_RID_ADMINS,
                                     0, 0, 0, 0, 0, 0, 0,
                                     &pAdminSID) == 0) {
            AddToMessageLogProcFailure(TEXT("CreateWellKnownSids: AllocateAndInitializeSid"), GetLastError());
        }
    }

    // Generate the anonymous SID if necessary.
    if (pAnonSID == NULL) {
        if (AllocateAndInitializeSid(&SIDAuth, 1,
                                     SECURITY_ANONYMOUS_LOGON_RID,
                                     0, 0, 0, 0, 0, 0, 0,
                                     &pAnonSID) == 0) {
            AddToMessageLogProcFailure(TEXT("CreateWellKnownSids: AllocateAndInitializeSid"), GetLastError());
        }
    }
}

VOID DeleteWellKnownSids ( VOID )

Definition at line 373 of file service.cpp.

                               {
    AutoHeapFree(pSystemSID);
    pSystemSID = NULL;
    AutoHeapFree(pAdminSID);
    pAdminSID = NULL;
    AutoHeapFree(pAnonSID);
    pAnonSID = NULL;
}

UINT GetCurrentUserPriority ( VOID )

Definition at line 399 of file service.cpp.

                                  {
    PSID pSID;
    PTOKEN_GROUPS pUserGroups;

    UINT Pri;

    // If well-known sids were not allocated, we can't work.
    if (pSystemSID == NULL || pAdminSID == NULL || pAnonSID == NULL) {
        return 0;
    }

    // The SID gets dynamically allocated inside GetUserSID(), so
    // we need to remember about that.
    if ((pSID = GetUserSID()) == NULL) {
        return 0;
    }

    if ((pUserGroups = GetUserGroups()) == NULL) {
        AutoHeapFree(pSID);
        return 0;
    }

    // Test if current SID is system SID or it
    // is a member of the administrator group.
    if (EqualSid(pSID, pSystemSID) || IsGroupMember(pAdminSID, pUserGroups)) {
        // Return system priority.
        Pri = 2;
    }
    // Test if current SID is anonyous SID.
    else if (EqualSid(pSID, pAnonSID)) {
        // Return anonymous priority.
        Pri = 0;
    }
    else {
        // We are left with the regular user priority.
        Pri = 1;
    }

    AutoHeapFree(pSID);
    AutoHeapFree(pUserGroups);
    return Pri;
}

PTOKEN_GROUPS GetUserGroups ( VOID )

Definition at line 240 of file service.cpp.

                                  {
    DWORD dwSize;
    DWORD dwResult;
    HANDLE hToken;
    PTOKEN_GROUPS pGroupInfo = NULL;

#ifdef DEBUG
    DbgMsgRecord(TEXT("->GetUserGroups\n"));
#endif

    // Open a handle to the access token for the calling thread.
    if (!OpenThreadToken(GetCurrentThread(), TOKEN_QUERY, TRUE, &hToken)) {
        AddToMessageLogProcFailure(TEXT("GetUserGroups: OpenProcessToken"), GetLastError());
        return NULL;
    }

    // Call GetTokenInformation to get the buffer size.
    dwSize = 0;
    if(GetTokenInformation(hToken, TokenGroups, NULL, dwSize, &dwSize) == 0) {
        dwResult = GetLastError();
        if(dwResult != ERROR_INSUFFICIENT_BUFFER ) {
            AddToMessageLogProcFailure(TEXT("GetUserGroups: GetTokenInformation"), dwResult);

            CloseHandle(hToken);
            return NULL;
        }
    }
    else {
        // We should have returned with an error above.
        ASSERTE(TRUE);
    }

    // Allocate the buffer.
    if ((pGroupInfo = (PTOKEN_GROUPS) AutoHeapAlloc(dwSize)) == NULL) {
        AddToMessageLog(TEXT("GetUserGroups: AutoHeapAlloc failed"));

        CloseHandle(hToken);
        return NULL;
    }

    // Call GetTokenInformation again to get the group information.
    if(GetTokenInformation(hToken, TokenGroups, pGroupInfo, dwSize, &dwSize) == 0) {
        AddToMessageLogProcFailure(TEXT("GetUserGroups: GetTokenInformation"), GetLastError());

        AutoHeapFree(pGroupInfo);
        CloseHandle(hToken);
        return NULL;
    }

#ifdef DEBUG
    DbgMsgRecord(TEXT("<-GetUserGroups\n"));
#endif

    CloseHandle(hToken);
    return pGroupInfo;
}

PSID GetUserSID ( )

Definition at line 105 of file service.cpp.

                  {
    SID_NAME_USE snuType;
    PSID pUserSID = NULL;
    DWORD cbUserSID = 0;

    LPTSTR szUserName = NULL;
    DWORD cbUserName = 0;

    LPTSTR szDomainName = NULL;
    DWORD cbDomainName = 0;

    BOOL fAPISuccess;

#ifdef DEBUG
    TCHAR Msg[MSG_SIZE];

    DbgMsgRecord(TEXT("->GetUserSID\n"));
#endif

    // Get the logged on user name.  First we determine the size
    // of the buffer required and then get the username.

    // Get the size of the name.
    fAPISuccess = GetUserName(szUserName, &cbUserName);

    // API should have failed with insufficient buffer.
    ASSERTE(!fAPISuccess);

#ifdef DEBUG
    _stprintf(Msg, TEXT("GetUserSID: cbUserName=%d\n"), cbUserName);
    DbgMsgRecord(Msg);
#endif

    if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
        AddToMessageLogProcFailure(TEXT("GetUserSID: GetUserName"), GetLastError());
        return NULL;
    }

    // Allocate buffer for the name.
    szUserName = (LPTSTR) AutoHeapAlloc(cbUserName * sizeof(TCHAR));
    if (szUserName == NULL) {
        AddToMessageLog(TEXT("GetUserSID: AutoHeapAlloc failed"));
        return NULL;
    }

    // Finally get the name.
    fAPISuccess = GetUserName(szUserName, &cbUserName);
    if (!fAPISuccess) {
        AutoHeapFree(szUserName);
        AddToMessageLogProcFailure(TEXT("GetUserSID: GetUserName"), GetLastError());
        return NULL;
    }

#ifdef DEBUG
    _stprintf(Msg, TEXT("GetUserSID: UserName=%s cbUserName=%d\n"), szUserName, cbUserName),
    DbgMsgRecord(Msg);
#endif

    // Do the same for SID.  First get the size and then allocate the buffer
    // and perform the actual call.
    fAPISuccess = LookupAccountName(NULL, szUserName,
                                    pUserSID, &cbUserSID, szDomainName, &cbDomainName, &snuType);

    // API should have failed with insufficient buffer.
    ASSERTE(fAPISuccess);

#ifdef DEBUG
    _stprintf(Msg, TEXT("GetUserSID: cbUserSID=%d\n"), cbUserSID),
    DbgMsgRecord(Msg);
#endif

    if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
        AutoHeapFree(szUserName);
        AddToMessageLogProcFailure(TEXT("GetUserSID: LookupAccountName"), GetLastError());
        return NULL;
    }

    // Allocate the SID buffer...
    pUserSID = AutoHeapAlloc(cbUserSID);
    if (pUserSID == NULL) {
        AutoHeapFree(szUserName);
        AddToMessageLog(TEXT("GetUserSID: AutoHeapAlloc failed"));
        return NULL;
    }

    // And the domain name buffer.
    szDomainName = (LPTSTR) AutoHeapAlloc(cbDomainName * sizeof(TCHAR));
    if (!szDomainName) {
        AutoHeapFree(szUserName);
        AutoHeapFree(pUserSID);
        AddToMessageLog(TEXT("GetUserSID: AutoHeapAlloc failed"));
        return NULL;
    }

    // Now get the SID.
    fAPISuccess = LookupAccountName(NULL, szUserName,
                                    pUserSID, &cbUserSID, szDomainName, &cbDomainName, &snuType);
    if (!fAPISuccess) {
        AutoHeapFree(szUserName);
        AutoHeapFree(szDomainName);
        AutoHeapFree(pUserSID);
        AddToMessageLogProcFailure(TEXT("GetUserSID: LookupAccountName"), GetLastError());
        return NULL;
    }

    AutoHeapFree(szUserName);
    AutoHeapFree(szDomainName);

#ifdef DEBUG
    _stprintf(Msg, TEXT("GetUserSID: pUserSID=%p cbUserSID=%d\n"), pUserSID, cbUserSID),
    DbgMsgRecord(Msg);
#endif

#ifdef DEBUG
    DbgMsgRecord(TEXT("<-GetUserSID\n"));
#endif

    return pUserSID;
}

BOOL IsGroupMember | ( | PSID | pSID,
 |  | PTOKEN_GROUPS | pGroupInfo
 | ) |  |

Definition at line 308 of file service.cpp.

                                                        {

#ifdef DEBUG
    DbgMsgRecord(TEXT("->IsGroupMember\n"));
#endif

    // Loop through the group SIDs looking for the administrator SID.
    for(UINT i=0; i<pGroupInfo->GroupCount; i++) {
        if (EqualSid(pSID, pGroupInfo->Groups[i].Sid)) {
            // Find out if the SID is enabled in the token
            if (pGroupInfo->Groups[i].Attributes & SE_GROUP_ENABLED) {

#ifdef DEBUG
                DbgMsgRecord(TEXT("<-IsGroupMember\n"));
#endif
                return TRUE;
            }
        }
    }

#ifdef DEBUG
    DbgMsgRecord(TEXT("<-IsGroupMember\n"));
#endif

    return FALSE;
}

VOID __RPC_FAR* __RPC_API midl_user_allocate ( size_t len )

Definition at line 591 of file service.cpp.

                                                          {
    return(HeapAlloc(RpcHeap, 0, len));
}

VOID __RPC_API midl_user_free ( VOID __RPC_FAR * ptr )

Definition at line 595 of file service.cpp.

                                                    {
    if(ptr != NULL) {
        HeapFree(RpcHeap, 0, ptr);
    }
}

BOOL ReportStatusToSCMgr | ( | SERVICE_STATUS_HANDLE * | sshStatusHandle,
 |  | SERVICE_STATUS * | ssStatus,
 |  | DWORD | dwCurrentState,
 |  | DWORD | dwWin32ExitCode,
 |  | DWORD | dwWaitHint
 | ) |  |

Definition at line 460 of file service.cpp.

                                          {

    static DWORD dwCheckPoint = 1;
    BOOL fResult = TRUE;

    if (dwCurrentState == SERVICE_START_PENDING) {
        ssStatus->dwControlsAccepted = 0;
    }
    else {
        ssStatus->dwControlsAccepted = SERVICE_ACCEPT_STOP;
    }

    ssStatus->dwCurrentState = dwCurrentState;
    ssStatus->dwWin32ExitCode = dwWin32ExitCode;
    ssStatus->dwWaitHint = dwWaitHint;

    if ((dwCurrentState == SERVICE_RUNNING) || (dwCurrentState == SERVICE_STOPPED)) {
        ssStatus->dwCheckPoint = 0;
    }
    else {
        ssStatus->dwCheckPoint = dwCheckPoint++;
    }

    // Report the status of the service to the service control manager.
    if (!(fResult = SetServiceStatus(*sshStatusHandle, ssStatus))) {
        AddToMessageLog(TEXT("ReportStatusToSCMgr: SetServiceStatus failed"));
    }
    return fResult;
}

Variable Documentation

const UINT ClientActiveReqBounds[] = {1, 5, 10}

Definition at line 72 of file service.cpp.

Queue* ClientActiveReqHashCounters[NumPriGroups]

Definition at line 84 of file service.cpp.

Queue* ClientActiveReqHashQueues[NumPriGroups]

Definition at line 83 of file service.cpp.

const UINT ClientReqBounds[] = {10, 20, 30}

Definition at line 70 of file service.cpp.

Queue* ClientReqQueues[NumPriGroups]

Definition at line 82 of file service.cpp.

const UINT MaxUserReqs = 5

Definition at line 74 of file service.cpp.

const UINT NumPriGroups = 3

Definition at line 48 of file service.cpp.

PSID pAdminSID = NULL

Definition at line 336 of file service.cpp.

PSID pAnonSID = NULL

Definition at line 337 of file service.cpp.

Counter* pClientActiveReqCounters[NumPriGroups]

Definition at line 80 of file service.cpp.

Counter* pClientReqCounters[NumPriGroups]

Definition at line 79 of file service.cpp.

Counter* pServerReqCounters[NumPriGroups]

Definition at line 78 of file service.cpp.

PSID pSystemSID = NULL

Definition at line 335 of file service.cpp.

const UINT RegUsersPri = 1

Definition at line 86 of file service.cpp.

HANDLE RpcHeap

Definition at line 585 of file service.cpp.

const UINT ServerReqBounds[] = {10, 20, 30}

Definition at line 68 of file service.cpp.

Generated on Wed Nov 13 2024 16:54:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/filerepmultiuser/service.h File Reference

  • NetDS
  • RPC
  • FileRep
  • filerepmultiuser
Defines | Functions | Variables

service.h File Reference

#include "Resources.h"

Go to the source code of this file.

Defines

#define | APPNAME TEXT("FileRepService")
#define | DEPENDENCIES TEXT("RPCSS\0\0")
#define | RPC_HEAP_SIZE_INIT (1024*1024)
#define | RPC_HEAP_SIZE_MAX (128*1024*1024)
#define | SERVICEDISPLAYNAME TEXT("File Replication Service")
#define | SERVICENAME TEXT("FileRepService")

Functions

VOID | AddRpcEEInfo (DWORD Status, LPTSTR Msg)
VOID | AddRpcEEInfoAndRaiseException (DWORD Status, LPTSTR Msg)
VOID | AddToMessageLog (LPTSTR lpszMsg)
VOID | AddToMessageLogProcFailure (LPTSTR ProcName, DWORD ErrCode)
VOID | AddToMessageLogProcFailureEEInfo (LPTSTR ProcName, DWORD ErrCode)
VOID * | AutoHeapAlloc (size_t dwBytes)
VOID | AutoHeapFree (VOID *lpMem)
VOID | CreateWellKnownSids (VOID)
VOID | DeleteWellKnownSids (VOID)
UINT | GetCurrentUserPriority (VOID)
PTOKEN_GROUPS | GetUserGroups ()
PSID GetUserSID ()
BOOL | IsGroupMember (PSID pSID, PTOKEN_GROUPS pGroupInfo)
BOOL | ReportStatusToSCMgr (SERVICE_STATUS_HANDLE *sshStatusHandle, SERVICE_STATUS *ssStatus, DWORD dwCurrentState, DWORD dwWin32ExitCode, DWORD dwWaitHint)

Variables

const UINT | ClientActiveReqBounds []
Queue * ClientActiveReqHashCounters []
Queue * ClientActiveReqHashQueues []
const UINT | ClientReqBounds []
Queue * ClientReqQueues []
const UINT | MaxUserReqs
const UINT | NumPriGroups
Counter * pClientActiveReqCounters []
Counter * pClientReqCounters []
Counter * pServerReqCounters []
const UINT | RegUsersPri
HANDLE RpcHeap
const UINT | ServerReqBounds []

Define Documentation

#define APPNAME TEXT("FileRepService")

Definition at line 22 of file service.h.

#define DEPENDENCIES TEXT("RPCSS\0\0")

Definition at line 31 of file service.h.

#define RPC_HEAP_SIZE_INIT (1024*1024)

Definition at line 109 of file service.h.

#define RPC_HEAP_SIZE_MAX (128*1024*1024)

Definition at line 110 of file service.h.

#define SERVICEDISPLAYNAME TEXT("File Replication Service")

Definition at line 28 of file service.h.

#define SERVICENAME TEXT("FileRepService")

Definition at line 25 of file service.h.

Function Documentation

VOID AddRpcEEInfo | ( | DWORD | Status,
 |  | LPTSTR | Msg
 | ) |  |

Definition at line 646 of file Service.cpp.

                                            {
    RPC_STATUS rpcstatus;

    RPC_EXTENDED_ERROR_INFO ErrorInfo;

    ErrorInfo.Version = RPC_EEINFO_VERSION;
    ErrorInfo.ComputerName = NULL;
    ErrorInfo.ProcessID = 0;
    ErrorInfo.GeneratingComponent = 0;
    ErrorInfo.Status = Status;
    ErrorInfo.DetectionLocation = 0;
    ErrorInfo.Flags = 0;
    ErrorInfo.NumberOfParameters = 1;
    ErrorInfo.Parameters[0].ParameterType = eeptUnicodeString;
    ErrorInfo.Parameters[0].u.UnicodeString = Msg;

    rpcstatus = RpcErrorAddRecord(&ErrorInfo);

    RpcRaiseException(Status);
}

VOID AddRpcEEInfoAndRaiseException | ( | DWORD | Status,
 |  | LPTSTR | Msg
 | ) |  |

Definition at line 667 of file Service.cpp.

                                                             {
    AddRpcEEInfo(Status, Msg);
    RpcRaiseException(Status);
}

VOID AddToMessageLog ( LPTSTR lpszMsg )

Definition at line 598 of file Service.cpp.

                                    {
    TCHAR szMsg1[256];
    HANDLE hEventSource;
    LPTSTR lpszStrings[2];
    DWORD dwErr = 0;

    dwErr = GetLastError();

    // Use event logging to log the error.
    hEventSource = RegisterEventSource(NULL, SERVICENAME);

    _stprintf(szMsg1, TEXT("%s error: %d"), SERVICENAME, dwErr);
    lpszStrings[0] = szMsg1;
    lpszStrings[1] = szMsg2;

    if (hEventSource != NULL) {
        ReportEvent(hEventSource, // handle of event source
                    EVENTLOG_ERROR_TYPE, // event type
                    0, // event category
                    0, // event ID
                    NULL, // current user's SID
                    2, // strings in lpszStrings
                    0, // no bytes of raw data
                    (LPCTSTR *) lpszStrings, // array of error strings
                    NULL); // no raw data

        (VOID) DeregisterEventSource(hEventSource);
    }
}

VOID AddToMessageLogProcFailure | ( | LPTSTR | ProcName,
 |  | DWORD | ErrCode
 | ) |  |

Definition at line 628 of file Service.cpp.

                                                                {
    TCHAR Msg[MSG_SIZE];
    _stprintf(Msg, TEXT("%s failed with code %d"), ProcName, ErrCode);
    AddToMessageLog(Msg);
}

VOID AddToMessageLogProcFailureEEInfo | ( | LPTSTR | ProcName,
 |  | DWORD | ErrCode
 | ) |  |

Definition at line 634 of file Service.cpp.

                                                                      {
    TCHAR Msg[MSG_SIZE];
    UINT MsgSize = 0;

    MsgSize += _stprintf(&Msg[MsgSize], TEXT("%s failed with code %d\n"), ProcName, ErrCode);
    GetEEInfoText(Msg, MSG_SIZE, &MsgSize);

    Msg[MsgSize] = 0;

    AddToMessageLog(Msg);
}

VOID* AutoHeapAlloc ( size_t dwBytes )

Definition at line 108 of file common.cpp.

                                     {
    if (hProcessHeap == NULL) {
        hProcessHeap = GetProcessHeap();
    }
    return HeapAlloc(hProcessHeap, 0, dwBytes);
}

VOID AutoHeapFree ( VOID * lpMem )

Definition at line 115 of file common.cpp.

                                {
    DWORD status;
    ASSERT(hProcessHeap != NULL);
    status = HeapFree(hProcessHeap, 0, lpMem);
    ASSERT(status);
}

VOID CreateWellKnownSids ( VOID )

Definition at line 427 of file Service.cpp.

                               {
    SID_IDENTIFIER_AUTHORITY SIDAuth = SECURITY_NT_AUTHORITY;

    // Generate SID for the system if necessary.
    if (pSystemSID == NULL) {
        if (AllocateAndInitializeSid(&SIDAuth, 1,
                                     SECURITY_LOCAL_SYSTEM_RID,
                                     0, 0, 0, 0, 0, 0, 0,
                                     &pSystemSID) == 0) {
            AddToMessageLogProcFailure(TEXT("CreateWellKnownSids: AllocateAndInitializeSid"), GetLastError());
        }
    }

    // Generate SID for the admin group if necessary.
    if (pAdminSID == NULL) {
        if (AllocateAndInitializeSid(&SIDAuth, 1,
                                     DOMAIN_ALIAS_RID_ADMINS,
                                     0, 0, 0, 0, 0, 0, 0,
                                     &pAdminSID) == 0) {
            AddToMessageLogProcFailure(TEXT("CreateWellKnownSids: AllocateAndInitializeSid"), GetLastError());
        }
    }

    // Generate the anonymous SID if necessary.
    if (pAnonSID == NULL) {
        if (AllocateAndInitializeSid(&SIDAuth, 1,
                                     SECURITY_ANONYMOUS_LOGON_RID,
                                     0, 0, 0, 0, 0, 0, 0,
                                     &pAnonSID) == 0) {
            AddToMessageLogProcFailure(TEXT("CreateWellKnownSids: AllocateAndInitializeSid"), GetLastError());
        }
    }
}

VOID DeleteWellKnownSids ( VOID )

Definition at line 461 of file Service.cpp.

                               {
    AutoHeapFree(pSystemSID);
    pSystemSID = NULL;
    AutoHeapFree(pAdminSID);
    pAdminSID = NULL;
    AutoHeapFree(pAnonSID);
    pAnonSID = NULL;
}

UINT GetCurrentUserPriority ( VOID )

Definition at line 487 of file Service.cpp.

                                  {
    PSID pSID;
    PTOKEN_GROUPS pUserGroups;

    UINT Pri;

    // If well-known sids were not allocated, we can't work.
    if (pSystemSID == NULL || pAdminSID == NULL || pAnonSID == NULL) {
        return 0;
    }

    // The SID gets dynamically allocated inside GetUserSID(), so
    // we need to remember about that.
    if ((pSID = GetUserSID()) == NULL) {
        return 0;
    }

    if ((pUserGroups = GetUserGroups()) == NULL) {
        AutoHeapFree(pSID);
        return 0;
    }

    // Test if current SID is system SID or it
    // is a member of the administrator group.
    if (EqualSid(pSID, pSystemSID) || IsGroupMember(pAdminSID, pUserGroups)) {
        // Return system priority.
        Pri = 2;
    }
    // Test if current SID is anonyous SID.
    else if (EqualSid(pSID, pAnonSID)) {
        // Return anonymous priority.
        Pri = 0;
    }
    else {
        // We are left with the regular user priority.
        Pri = 1;
    }

    AutoHeapFree(pSID);
    AutoHeapFree(pUserGroups);
    return Pri;
}

PTOKEN_GROUPS GetUserGroups ( )
PSID GetUserSID ( )

Definition at line 193 of file Service.cpp.

                  {
    SID_NAME_USE snuType;
    PSID pUserSID = NULL;
    DWORD cbUserSID = 0;

    LPTSTR szUserName = NULL;
    DWORD cbUserName = 0;

    LPTSTR szDomainName = NULL;
    DWORD cbDomainName = 0;

    BOOL fAPISuccess;

#ifdef DEBUG2
    TCHAR Msg[MSG_SIZE];

    DbgMsgRecord(TEXT("->GetUserSID\n"));
#endif

    // Get the logged on user name.  First we determine the size
    // of the buffer required and then get the username.

    // Get the size of the name.
    fAPISuccess = GetUserName(szUserName, &cbUserName);

    // API should have failed with insufficient buffer.
    ASSERT(!fAPISuccess);

    if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
        AddToMessageLogProcFailure(TEXT("GetUserSID: GetUserName"), GetLastError());
        return NULL;
    }

#ifdef DEBUG2
    _stprintf(Msg, TEXT("GetUserSID: cbUserName=%d\n"), cbUserName);
    DbgMsgRecord(Msg);
#endif

    // Allocate buffer for the name.
    szUserName = (LPTSTR) AutoHeapAlloc(cbUserName * sizeof(TCHAR));
    if (szUserName == NULL) {
        AddToMessageLog(TEXT("GetUserSID: AutoHeapAlloc failed"));
        return NULL;
    }

    // Finally get the name.
    fAPISuccess = GetUserName(szUserName, &cbUserName);
    if (!fAPISuccess) {
        AutoHeapFree(szUserName);
        AddToMessageLogProcFailure(TEXT("GetUserSID: GetUserName"), GetLastError());
        return NULL;
    }

#ifdef DEBUG2
    _stprintf(Msg, TEXT("GetUserSID: UserName=%s cbUserName=%d\n"), szUserName, cbUserName),
    DbgMsgRecord(Msg);
#endif

    // Do the same for SID.  First get the size and then allocate the buffer
    // and perform the actual call.
    fAPISuccess = LookupAccountName(NULL, szUserName,
                                    pUserSID, &cbUserSID, szDomainName, &cbDomainName, &snuType);

    // API should have failed with insufficient buffer.
    ASSERT(!fAPISuccess);

    if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
        AutoHeapFree(szUserName);
        AddToMessageLogProcFailure(TEXT("GetUserSID: LookupAccountName"), GetLastError());
        return NULL;
    }

#ifdef DEBUG2
    _stprintf(Msg, TEXT("GetUserSID: cbUserSID=%d\n"), cbUserSID),
    DbgMsgRecord(Msg);
#endif

    // Allocate the SID buffer...
    pUserSID = AutoHeapAlloc(cbUserSID);
    if (pUserSID == NULL) {
        AutoHeapFree(szUserName);
        AddToMessageLog(TEXT("GetUserSID: AutoHeapAlloc failed"));
        return NULL;
    }

    // And the domain name buffer.
    szDomainName = (LPTSTR) AutoHeapAlloc(cbDomainName * sizeof(TCHAR));
    if (!szDomainName) {
        AutoHeapFree(szUserName);
        AutoHeapFree(pUserSID);
        AddToMessageLog(TEXT("GetUserSID: AutoHeapAlloc failed"));
        return NULL;
    }

    // Now get the SID.
    fAPISuccess = LookupAccountName(NULL, szUserName,
                                    pUserSID, &cbUserSID, szDomainName, &cbDomainName, &snuType);
    if (!fAPISuccess) {
        AutoHeapFree(szUserName);
        AutoHeapFree(szDomainName);
        AutoHeapFree(pUserSID);
        AddToMessageLogProcFailure(TEXT("GetUserSID: LookupAccountName"), GetLastError());
        return NULL;
    }

    AutoHeapFree(szUserName);
    AutoHeapFree(szDomainName);

#ifdef DEBUG2
    _stprintf(Msg, TEXT("GetUserSID: pUserSID=%p cbUserSID=%d\n"), pUserSID, cbUserSID),
    DbgMsgRecord(Msg);
#endif

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<-GetUserSID\n"));
#endif

    return pUserSID;
}

BOOL IsGroupMember | ( | PSID | pSID,
 |  | PTOKEN_GROUPS | pGroupInfo
 | ) |  |

Definition at line 396 of file Service.cpp.

                                                        {

#ifdef DEBUG2
    DbgMsgRecord(TEXT("->IsGroupMember\n"));
#endif

    // Loop through the group SIDs looking for the administrator SID.
    for(UINT i=0; i<pGroupInfo->GroupCount; i++) {
        if (EqualSid(pSID, pGroupInfo->Groups[i].Sid)) {
            // Find out if the SID is enabled in the token
            if (pGroupInfo->Groups[i].Attributes & SE_GROUP_ENABLED) {

#ifdef DEBUG2
                DbgMsgRecord(TEXT("<-IsGroupMember\n"));
#endif
                return TRUE;
            }
        }
    }

#ifdef DEBUG2
    DbgMsgRecord(TEXT("<-IsGroupMember\n"));
#endif

    return FALSE;
}

BOOL ReportStatusToSCMgr | ( | SERVICE_STATUS_HANDLE * | sshStatusHandle,
 |  | SERVICE_STATUS * | ssStatus,
 |  | DWORD | dwCurrentState,
 |  | DWORD | dwWin32ExitCode,
 |  | DWORD | dwWaitHint
 | ) |  |

Definition at line 548 of file Service.cpp.

                                          {

    static DWORD dwCheckPoint = 1;
    BOOL fResult = TRUE;

    if (dwCurrentState == SERVICE_START_PENDING) {
        ssStatus->dwControlsAccepted = 0;
    }
    else {
        ssStatus->dwControlsAccepted = SERVICE_ACCEPT_STOP;
    }

    ssStatus->dwCurrentState = dwCurrentState;
    ssStatus->dwWin32ExitCode = dwWin32ExitCode;
    ssStatus->dwWaitHint = dwWaitHint;

    if ((dwCurrentState == SERVICE_RUNNING) || (dwCurrentState == SERVICE_STOPPED)) {
        ssStatus->dwCheckPoint = 0;
    }
    else {
        ssStatus->dwCheckPoint = dwCheckPoint++;
    }

    // Report the status of the service to the service control manager.
    if (!(fResult = SetServiceStatus(*sshStatusHandle, ssStatus))) {
        AddToMessageLog(TEXT("ReportStatusToSCMgr: SetServiceStatus failed"));
    }
    return fResult;
}

Variable Documentation

const UINT ClientActiveReqBounds[]

Definition at line 82 of file Service.cpp.

Queue* ClientActiveReqHashCounters[]

Definition at line 95 of file Service.cpp.

Queue* ClientActiveReqHashQueues[]

Definition at line 83 of file service.cpp.

const UINT ClientReqBounds[]

Definition at line 79 of file Service.cpp.

Queue* ClientReqQueues[]

Definition at line 94 of file Service.cpp.

const UINT MaxUserReqs

Definition at line 84 of file Service.cpp.

const UINT NumPriGroups

Definition at line 57 of file Service.cpp.

Counter* pClientActiveReqCounters[]

Definition at line 89 of file Service.cpp.

Counter* pClientReqCounters[]

Definition at line 88 of file Service.cpp.

Counter* pServerReqCounters[]

Definition at line 91 of file Service.cpp.

const UINT RegUsersPri

Definition at line 108 of file Service.cpp.

HANDLE RpcHeap

Definition at line 1159 of file Service.cpp.

const UINT ServerReqBounds[]

Definition at line 78 of file Service.cpp.

Generated on Wed Nov 13 2024 16:54:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/filerepsecure/common.cpp File Reference

  • NetDS
  • RPC
  • FileRep
  • filerepsecure
Functions | Variables

common.cpp File Reference

#include <windows.h>
#include <tchar.h>
#include <stdio.h>
#include <stdlib.h>
#include <crtdbg.h>
#include "common.h"

Go to the source code of this file.

Functions

VOID * | AutoHeapAlloc (size_t dwBytes)
VOID | AutoHeapFree (VOID *lpMem)

Variables

HANDLE | hProcessHeap = NULL

Function Documentation

VOID* AutoHeapAlloc ( size_t dwBytes )

Definition at line 23 of file common.cpp.

                                     {
    if (hProcessHeap == NULL) {
        hProcessHeap = GetProcessHeap();
    }
    return HeapAlloc(hProcessHeap, 0, dwBytes);
}

VOID AutoHeapFree ( VOID * lpMem )

Definition at line 30 of file common.cpp.

                                {
    DWORD status;
    ASSERTE(hProcessheap != NULL);
    status = HeapFree(hProcessHeap, 0, lpMem);
    ASSERTE(status);
}

Variable Documentation

HANDLE hProcessHeap = NULL

Definition at line 21 of file common.cpp.

Generated on Wed Nov 13 2024 16:53:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/filerepsecure/common.h File Reference

  • NetDS
  • RPC
  • FileRep
  • filerepsecure
Defines | Functions

common.h File Reference

#include <windows.h>
#include <crtdbg.h>

Go to the source code of this file.

Defines

#define | ASSERTE _ASSERTE
#define | EXIT_IF_FAIL(x, string)
#define | MSG_SIZE (256)

Functions

VOID * | AutoHeapAlloc (size_t dwBytes)
VOID | AutoHeapFree (VOID *lpMem)

Define Documentation

#define ASSERTE _ASSERTE

Definition at line 31 of file common.h.

#define EXIT_IF_FAIL | ( | x,
 |  | string
 | ) |
Value:
{ \
        ((x) != RPC_S_OK) ? _tprintf(TEXT("%s failed with error %d\n"), \
        TEXT(string), (x)), exit(EXIT_FAILURE) : 0;}

Definition at line 25 of file common.h.

#define MSG_SIZE (256)

Definition at line 35 of file common.h.

Function Documentation

VOID* AutoHeapAlloc ( size_t dwBytes )

Definition at line 108 of file common.cpp.

                                     {
    if (hProcessHeap == NULL) {
        hProcessHeap = GetProcessHeap();
    }
    return HeapAlloc(hProcessHeap, 0, dwBytes);
}

VOID AutoHeapFree ( VOID * lpMem )

Definition at line 115 of file common.cpp.

                                {
    DWORD status;
    ASSERT(hProcessHeap != NULL);
    status = HeapFree(hProcessHeap, 0, lpMem);
    ASSERT(status);
}

Generated on Wed Nov 13 2024 16:53:11 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/filerepsecure/filerep.cpp File Reference

  • NetDS
  • RPC
  • FileRep
  • filerepsecure
Functions

filerep.cpp File Reference

#include <stdio.h>
#include <stdlib.h>
#include <process.h>
#include <tchar.h>
#include <rpc.h>
#include <Ntdsapi.h>
#include "common.h"
#include "Service.h"
#include "FileRepClient.h"

Go to the source code of this file.

Functions

INT _cdecl | main (int argc, char **argv)
VOID __RPC_FAR *__RPC_API | midl_user_allocate (size_t len)
VOID __RPC_API | midl_user_free (VOID __RPC_FAR *ptr)
void | PrintUsage (TCHAR *ProgName)

Function Documentation

INT _cdecl main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 79 of file filerep.cpp.

                                       {

    INT i;
    RPC_STATUS rpcstatus;

    // Controlls printing out of messages.
    BOOL bDebug = FALSE;

    // Explicit binding handle to the client system service.
    handle_t hFileRepClient = NULL;

    // These are the default values for extablishing connections.
    // Default connection is to a local server over local rpc.
    LPTSTR pszProtocolSequence = TEXT("ncalrpc");
    LPTSTR pszNetworkAddress = NULL;

    // An empty endpoint string is used, since we are going to
    // connect to the endpoint dynamically generated by the
    // RPC run-time library.  Server calls RpcServerUseProtseq to
    // obtain a binding hadnle and a dynamic endpoint.
    LPTSTR pszEndpoint = TEXT("");

    LPTSTR pszUuid = NULL;
    LPTSTR pszOptions = NULL;
    LPTSTR pszStringBinding = NULL;

    LPTSTR ServerName = NULL;
    LPTSTR RemoteFileName = NULL;
    LPTSTR LocalFileName = NULL;

    INT nNumArgs;

    // Quality of service structure to ensure authentication.
    RPC_SECURITY_QOS SecurityQOS;

    // Used in generating the principal name for the local system service.
    TCHAR Name[128];
    DWORD cbName = sizeof(Name);
    TCHAR DomainName[128];
    DWORD cbDomainName = sizeof(DomainName);
    SID_NAME_USE Use;
    SID_IDENTIFIER_AUTHORITY SIDAuth = SECURITY_NT_AUTHORITY;
    BYTE sidBuffer[100];
    PSID pSID = (PSID)&sidBuffer;

    // Get a common handle on the command line arguments for both
    // UNICODE and ASCII
#ifdef _UNICODE
    LPWSTR *szArgList = CommandLineToArgvW(GetCommandLine(), &nNumArgs);
    if (NULL == szArgList) {
        _tprintf(TEXT("FileRep main: CommandLineToArgW failed"));
        exit(EXIT_FAILURE);
    }
#else
    char **szArgList = argv;
    nNumArgs = argc;
#endif

    // Check that the correct number of arguments is given.
    if(nNumArgs<4){
        PrintUsage(szArgList[0]);
        exit(EXIT_FAILURE);
    }

    // Extract the required arguments.
    ServerName = szArgList[1];
    RemoteFileName = szArgList[2];
    LocalFileName = szArgList[3];

    // Allow the user to override settings with command line switches.
    for (i = 4; i < nNumArgs; i++) {
        // Well-formed argument switches start with '/' or '-' and are
        // two characters long.
        if (((*szArgList[i] == TEXT('-')) || (*szArgList[i] == TEXT('/'))) && _tcsclen(szArgList[i]) == 2) {

            switch (_totlower(*(szArgList[i]+1))) {

                case TEXT('p'):

              // Override protocol sequence.

              // Check that the next argument exists and is not a
              // switch.
                    if(i+1 < nNumArgs && *szArgList[i+1] != TEXT('-') && *szArgList[i+1] != TEXT('/')) {
                  pszProtocolSequence = szArgList[++i];
                    }
              // Otherwise we have an empty protocol sequence.
              else {
            // We do not allow an empty protocol sequence.
            _tprintf(TEXT("Protocol sequence can't be \"\".\n"));
                        exit(EXIT_FAILURE);
              }

        break;

                case TEXT('n'):

        // Override the network address.
        if(i+1 < nNumArgs && *szArgList[i+1] != TEXT('-') && *szArgList[i+1] != TEXT('/')) {
      pszNetworkAddress = szArgList[++i];
        }
        else {
      pszNetworkAddress = TEXT("");
        }

        break;

          case TEXT('e'):

        // Override the endpoint.
        if(i+1 < nNumArgs && *szArgList[i+1] != TEXT('-') && *szArgList[i+1] != TEXT('/')) {
      pszEndpoint = szArgList[++i];
        }
        else {
      pszEndpoint = TEXT("");
        }

        break;

                case TEXT('d'):
        // Turn on debugging.
        bDebug = TRUE;
        break;

                case TEXT('h'):
                case TEXT('?'):
                default:
        PrintUsage(szArgList[0]);
        exit(EXIT_SUCCESS);
            }
        }
        else {
            PrintUsage(szArgList[0]);
            exit(EXIT_FAILURE);
        }
    }

    // Concatenate the elements of
    // the string binding into the proper sequence.
    rpcstatus = RpcStringBindingCompose(pszUuid,
          pszProtocolSequence,
          pszNetworkAddress,
          pszEndpoint,
          pszOptions,
          &pszStringBinding);
    if(bDebug){
        _tprintf(TEXT("RpcStringBindingCompose returned 0x%x\n"), rpcstatus);
        _tprintf(TEXT("pszStringBinding = %s\n"), pszStringBinding);
    }
    EXIT_IF_FAIL(rpcstatus, "RpcStringBindingCompose");

    // Set the binding handle that will be used to bind to the server.
    rpcstatus = RpcBindingFromStringBinding(pszStringBinding, &hFileRepClient);
    if(bDebug) _tprintf(TEXT("RpcBindingFromStringBinding returned 0x%x\n"), rpcstatus);
    EXIT_IF_FAIL(rpcstatus, "RpcBindingFromStringBinding");

    // Free the binding string.
    rpcstatus = RpcStringFree(&pszStringBinding);
    ASSERTE(rpcstatus == RPC_S_OK);

    // Specify quality of service parameters.
    SecurityQOS.Version = RPC_C_SECURITY_QOS_VERSION;
    SecurityQOS.Capabilities = RPC_C_QOS_CAPABILITIES_MUTUAL_AUTH;
    // Dynamic identity tracking is more efficient for a single LRPC call.
    SecurityQOS.IdentityTracking = RPC_C_QOS_IDENTITY_DYNAMIC;
    // The client system service needs to impersonate the security context
    // of the client utility on the remote systems where it may replicate
    // files from.
    // We need to impersonate with level delegate, since the server system
    // service will need to impersonate the user further.
    SecurityQOS.ImpersonationType = RPC_C_IMP_LEVEL_DELEGATE;

    // Generate the principal name for the local system service.
    // We can't just use the a string constant, because then
    // we rely on a particular English-language representation of the
    // principal.

    if (AllocateAndInitializeSid(&SIDAuth, 1,
         SECURITY_NETWORK_SERVICE_RID,
         0, 0, 0, 0, 0, 0, 0,
         &pSID) == 0) {
        printf("AllocateAndInitializeSid failed\n");
  exit(EXIT_FAILURE);
    }

    if (LookupAccountSid(NULL, // name of local or remote computer
       pSID, // security identifier
       Name, // account name buffer
       &cbName, // size of account name buffer
       DomainName, // domain name
       &cbDomainName, // size of domain name buffer
       &Use) == 0) { // SID type
        printf("LookupAccountSid failed\n");
  exit(EXIT_FAILURE);
    }

    if(bDebug) _tprintf(TEXT("Server \"magic name\" is %s\n"), Name);

    // Set authentication and authorisation information for
    // the binding handle.
    // By speciying NULL for the 5th parameter we use the security login
    // context for the current address space.
    // The security level is "PRIVACY" since it is the only level
    // provided by LRPC.
    // We are assured of talking to a local service running with
    // system privileges.
    rpcstatus = RpcBindingSetAuthInfoEx(hFileRepClient, Name, RPC_C_AUTHN_LEVEL_PKT_PRIVACY, RPC_C_AUTHN_WINNT, NULL, NULL, &SecurityQOS);
    EXIT_IF_FAIL(rpcstatus, "RpcBindingSetAuthInfo");

    // Make the RPC to request file replication.
    RpcTryExcept {
        if(bDebug) _tprintf(TEXT("Calling the remote procedure RequestFile(hFileRepClient, %s, %s, %s)\n"), ServerName, RemoteFileName, LocalFileName);

        RequestFile(hFileRepClient, ServerName, RemoteFileName, LocalFileName);

        if(bDebug) _tprintf(TEXT("RequestFile() finished\n"));
    }
    // Return "non-fatal" errors.  Catching fatal errors
    // makes it harder to debug.
    RpcExcept ( ( (RpcExceptionCode() != STATUS_ACCESS_VIOLATION) &&
      (RpcExceptionCode() != STATUS_DATATYPE_MISALIGNMENT) &&
      (RpcExceptionCode() != STATUS_PRIVILEGED_INSTRUCTION) &&
      (RpcExceptionCode() != STATUS_ILLEGAL_INSTRUCTION) &&
      (RpcExceptionCode() != STATUS_BREAKPOINT))
      ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH ) {

        _tprintf(TEXT("Exception: RequestFile failed with code %d\n"), GetExceptionCode());
        exit(EXIT_FAILURE);
    }
    RpcEndExcept;

    // Free the binding.
    rpcstatus = RpcBindingFree((VOID **)&hFileRepClient);
    ASSERTE(rpcstatus == RPC_S_OK);

    if(bDebug) _tprintf(TEXT("Success!\n"));

    return(EXIT_SUCCESS);

} // end main()

VOID __RPC_FAR* __RPC_API midl_user_allocate ( size_t len )

Definition at line 324 of file filerep.cpp.

                                                          {
    return(AutoHeapAlloc(len));
}

VOID __RPC_API midl_user_free ( VOID __RPC_FAR * ptr )

Definition at line 328 of file filerep.cpp.

                                                    {
    if(ptr != NULL) {
        AutoHeapFree(ptr);
    }
}

void PrintUsage ( TCHAR * ProgName )

Definition at line 53 of file filerep.cpp.

                                 {
    _tprintf(TEXT("%s - File Replication Client Utility\n\n"), ProgName);
    _tprintf(TEXT("Usage: %s [server name] [remote file] [local file] <options...> \n\n"), ProgName);
    _tprintf(TEXT("Options:\n"));
    _tprintf(TEXT(" -p protocol_sequence\n"));
    _tprintf(TEXT(" -n network_address\n"));
    _tprintf(TEXT(" -e endpoint\n"));
    _tprintf(TEXT(" -d print messages\n"));
}

Generated on Wed Nov 13 2024 16:53:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/filerepsecure/filerepclient.idl File Reference

  • NetDS
  • RPC
  • FileRep
  • filerepsecure
Classes

filerepclient.idl File Reference

Go to the source code of this file.

Classes

interface FileRepClient
Generated on Wed Nov 13 2024 16:53:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/filerepsecure/filerepclientproc.cpp File Reference

  • NetDS
  • RPC
  • FileRep
  • filerepsecure
Classes | Functions

filerepclientproc.cpp File Reference

#include <stdlib.h>
#include <stdio.h>
#include <tchar.h>
#include <rpc.h>
#include <Ntdsapi.h>
#include "common.h"
#include "FileRepClient.h"
#include "FileRepServer.h"
#include "Service.h"

Go to the source code of this file.

Classes

struct | ThreadArgs

Functions

VOID | RequestFile (handle_t hFileRepClient, LPTSTR ServerName, LPTSTR RemoteFileName, LPTSTR LocalFileName)
VOID | ShutdownThread (ThreadArgs *pArgs)
VOID | ThreadProcRequest (ThreadArgs *pArgs)

Function Documentation

VOID RequestFile | ( | handle_t | hFileRepClient,
 |  | LPTSTR | ServerName,
 |  | LPTSTR | RemoteFileName,
 |  | LPTSTR | LocalFileName
 | ) |  |

Definition at line 211 of file filerepclientproc.cpp.

{
    INT status;
    RPC_STATUS rpcstatus;

    ULONG cbRead, cbWritten;

    // Default connection to server system service is over TCP/IP.
    LPTSTR DefaultProtocolSequence = TEXT("ncacn_ip_tcp");

    // An empty endpoint string is used, since we are going to
    // connect to the endpoint dynamically generated by the
    // RPC run-time library.    Server calls RpcServerUseProtseq to
    // obtain a binding hadnle and a dynamic endpoint.
    LPTSTR DefaultEndpoint = TEXT("");

    LPTSTR pszUuid = NULL;
    LPTSTR pszOptions = NULL;
    LPTSTR pszStringBinding = NULL;

    ULONG ThreadIdentifier;
    HANDLE hThread;

    ThreadArgs *pArgs = NULL;

    ULONG ulAuthnLevel;

    // Quality of service structure to ensure authentication.
    RPC_SECURITY_QOS SecurityQOS;

    // The string binding that is used to make sure clients contact the
    // service via an LRPC call.
    LPTSTR StringBinding;

    // The protocol sequence that gets extracted from the string binding.
    LPTSTR ProtSeq;

    // The length of the principal name and the principal name
    // for the client system service.
    TCHAR szSpn[MAX_PATH];
    ULONG ulSpn = sizeof(szSpn);

    if((pArgs = (ThreadArgs *) AutoHeapAlloc(sizeof(ThreadArgs))) == NULL) {
        RpcRaiseException(ERROR_OUTOFMEMORY);
        return;
    }

    // Set pArgs' fields to NULL so that we will know
    // in ShutdownThread which ones have been initialized.
    pArgs->hFileRepServer = NULL;
    pArgs->hLocalFile = NULL;
    pArgs->phContext = NULL;
    pArgs->bImpersonating = FALSE;

#ifdef PROF
    static ULONG nTotalId;

    if (WaitForSingleObject(hProfMutex, INFINITE) == WAIT_FAILED) {
  ShutdownThread(pArgs);
  RaiseException(GetLastError(), 0, 0, NULL);
  return;
    }

    // Record the number of the current request.
    pArgs->nReqId = nTotalId;
    // Increment the number of the request.
    nTotalId++;

    if (ReleaseMutex(hProfMutex) == FALSE) {
  ShutdownThread(pArgs);
  RaiseException(GetLastError(), 0, 0, NULL);
  return;
    }

    TCHAR ProfMsg[MAX_PATH+16];
    _stprintf(ProfMsg, TEXT("name=\"%s\" arrived"), RemoteFileName);

    // Record the time of arrival of this request.
    ProfRecordTime(pArgs->nReqId, ProfMsg);
#endif

    // Make sure that the client utility is local.
    // Client system service only services LRPC calls.
    if ((rpcstatus = RpcBindingToStringBinding(hFileRepClient, &StringBinding)) != RPC_S_OK) {
  ShutdownThread(pArgs);
        RpcRaiseException(rpcstatus);
  return;
    }
    if ((rpcstatus = RpcStringBindingParse(StringBinding, NULL, &ProtSeq, NULL, NULL, NULL)) != RPC_S_OK) {

  // Free the string binding.
  rpcstatus = RpcStringFree(&StringBinding);
  ASSERTE(rpcstatus == RPC_S_OK);

  ShutdownThread(pArgs);
        RpcRaiseException(rpcstatus);
  return;
    }
    if (_tcscmp(ProtSeq, TEXT("ncalrpc")) != 0) {

  // Free the string binding.
  rpcstatus = RpcStringFree(&StringBinding);
  ASSERTE(rpcstatus == RPC_S_OK);
  // And the protocol sequence
  rpcstatus = RpcStringFree(&ProtSeq);
  ASSERTE(rpcstatus == RPC_S_OK);

  ShutdownThread(pArgs);
        RpcRaiseException(RPC_S_INVALID_RPC_PROTSEQ);
  return;
    }

    // Free the string binding.
    rpcstatus = RpcStringFree(&StringBinding);
    ASSERTE(rpcstatus == RPC_S_OK);
    // And the protocol sequence.
    rpcstatus = RpcStringFree(&ProtSeq);
    ASSERTE(rpcstatus == RPC_S_OK);

    // Get client security info.
    if (RpcBindingInqAuthClient(hFileRepClient,
        NULL,
        NULL,
        &ulAuthnLevel,
        NULL,
        NULL) != RPC_S_OK) {

  ShutdownThread(pArgs);
        RpcRaiseException(GetLastError());
  return;
    }

    // Make sure the client has adequate security measures.
    // Since this is LRPC, we get the security level of privacy
    // because it is the only available security level.
    // We do not interoperate with old versions of FileRep
    // client utilities, since appropriate versions should be
    // available with the local system service.
    if (ulAuthnLevel != RPC_C_AUTHN_LEVEL_PKT_PRIVACY) {
  ShutdownThread(pArgs);
        RpcRaiseException(RPC_S_SEC_PKG_ERROR);
  return;
    }

    // We need to impersonate the user that has issued the
    // remote call.
    // We want to impersonate as soon as possible to minimise
    // the amount of resources that can be consumed by an attack.
    if ((rpcstatus = RpcImpersonateClient(hFileRepClient)) != RPC_S_OK) {
  ShutdownThread(pArgs);
        RpcRaiseException(rpcstatus);
  return;
    }
    pArgs->bImpersonating = TRUE;

    // Prepare the binding information.
    if ((rpcstatus = RpcStringBindingCompose(pszUuid,
               DefaultProtocolSequence,
               ServerName,
               DefaultEndpoint,
               pszOptions,
               &pszStringBinding)) != RPC_S_OK) {

  ShutdownThread(pArgs);
        RpcRaiseException(rpcstatus);
  return;
    }

    if ((rpcstatus = RpcBindingFromStringBinding(pszStringBinding, &(pArgs->hFileRepServer))) != RPC_S_OK) {
  // The binding handle is invalid
  pArgs->hFileRepServer = NULL;

  // Deallocate the string binding.
  rpcstatus = RpcStringFree(&pszStringBinding);
  ASSERTE(rpcstatus == RPC_S_OK);

  ShutdownThread(pArgs);
        RpcRaiseException(rpcstatus);
  return;
    }

    // We need to delete the string binding, since it is no longer
    // necessary.  All the binding information is now contained in the
    // binding handle.
    rpcstatus = RpcStringFree(&pszStringBinding);
    ASSERTE(rpcstatus == RPC_S_OK);

    // Generate a principal name for the local system service.
    if ((status = DsMakeSpn(SERVICENAME,
          ServerName,
          NULL,
          0,
          0,
          &ulSpn,
          szSpn)) != ERROR_SUCCESS) {
  ShutdownThread(pArgs);
        RpcRaiseException(rpcstatus);
  return;
    }

    // Specify quality of service parameters.
    SecurityQOS.Version = RPC_C_SECURITY_QOS_VERSION;
    SecurityQOS.Capabilities = RPC_C_QOS_CAPABILITIES_MUTUAL_AUTH;
    // Use static identity tracking since we will be issuing multiple
    // RPC calls from this thread with different identities: while
    // impersonating, and while not.  This insures that all the calls will
    // go to server under the identity of the user who created the binding
    // handle.
    SecurityQOS.IdentityTracking = RPC_C_QOS_IDENTITY_STATIC;
    // The client system service needs to impersonate the security context
    // of the client utility on the remote systems where it may replicate
    // files from.  It will also need to obtain client's SID and hence
    // requires impersonation.
    SecurityQOS.ImpersonationType = RPC_C_IMP_LEVEL_IMPERSONATE;

    // Set authentification and authorisation information for
    // the binding handle.
    if ((rpcstatus = RpcBindingSetAuthInfoEx(pArgs->hFileRepServer, szSpn, RPC_C_AUTHN_LEVEL_PKT_PRIVACY, RPC_C_AUTHN_GSS_KERBEROS, NULL, RPC_C_AUTHZ_NAME, &SecurityQOS)) != RPC_S_OK) {

  ShutdownThread(pArgs);
        RpcRaiseException(rpcstatus);
  return;
    }

    // We did not read anything yet.
    cbRead = 0;

#ifdef RETRY_EXCEPTION
    // When making aggressive calls to the server, this flag is
    // set when the call succeeded.  This makes the client service attempt
    // to contact the server even after an exception occured.
    BOOL bRetryCall = TRUE;
    while (bRetryCall) {
#endif

    // Attempt to open the remote file.
    RpcTryExcept {
        c_RemoteOpen(pArgs->hFileRepServer,
         &(pArgs->phContext),
         RemoteFileName,
         pArgs->pbBuf,
         &cbRead);

#ifdef RETRY_EXCEPTION
  bRetryCall = FALSE;
#endif

    }
    RpcExcept ( ( (RpcExceptionCode() != STATUS_ACCESS_VIOLATION) &&
      (RpcExceptionCode() != STATUS_DATATYPE_MISALIGNMENT) &&
      (RpcExceptionCode() != STATUS_PRIVILEGED_INSTRUCTION) &&
      (RpcExceptionCode() != STATUS_ILLEGAL_INSTRUCTION) &&
      (RpcExceptionCode() != STATUS_BREAKPOINT) )
      ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH ) {

#ifdef RETRY_EXCEPTION
  // This code attempts to make aggressive calls, retrying
  // if no endpoints are available.  It is used to put servers
  // under stress.
  if (RpcExceptionCode() != EPT_S_NOT_REGISTERED &&
      RpcExceptionCode() != RPC_S_SERVER_UNAVAILABLE) {
#endif

  // Deallocate all the thread data before failing.
  ShutdownThread(pArgs);
        RpcRaiseException(RpcExceptionCode());
  return;

#ifdef RETRY_EXCEPTION
        }
#endif

    }
    RpcEndExcept;

#ifdef RETRY_EXCEPTION
    }
#endif

    // Attempt to open the local file.
    if ((pArgs->hLocalFile = CreateFile(LocalFileName,
          GENERIC_WRITE,
          0,
          NULL,
          CREATE_ALWAYS,
          FILE_ATTRIBUTE_NORMAL,
          NULL)) == INVALID_HANDLE_VALUE) {
  ShutdownThread(pArgs);
        RpcRaiseException(GetLastError());
  return;
    }

    // We need to stop impersonating before thread creation.
    // Also, since all files have been open the required security
    // checks have been done and impersonating is no longer necessary.
    if ((rpcstatus = RpcRevertToSelf()) != RPC_S_OK) {
        pArgs->bImpersonating = FALSE;

        ShutdownThread(pArgs);
  RpcRaiseException(rpcstatus);
  return;
    }
    pArgs->bImpersonating = FALSE;

    // Write the data received to local file.
    if(!WriteFile(pArgs->hLocalFile,
      pArgs->pbBuf,
      cbRead,
      &cbWritten,
      NULL)){

  ShutdownThread(pArgs);
        RpcRaiseException(GetLastError());
        return;
    }

    // If there are no errors and the call returned NULL, then
    // the file was read in a single call and has already been closed.
    // We just need to write the buffer and return.
    if(pArgs->phContext == NULL){

#ifdef PROF
  ProfRecordTime(pArgs->nReqId, TEXT("handled"));
#endif

  ShutdownThread(pArgs);
        return;
    }

    // We need to read and close the file on a different
    // thread so that the client replication utility can return.
    // The data will be transfered in the background.
    if((hThread = CreateThread(NULL,
             0,
             (LPTHREAD_START_ROUTINE) ThreadProcRequest,
             pArgs,
             0,
             &ThreadIdentifier)) == NULL) {

  ShutdownThread(pArgs);
        RpcRaiseException(GetLastError());
  return;
    }

    // Unless we close a handle to the thread, it will remain in the
    // system even after its execution has terminated.
    status = CloseHandle(hThread);
    ASSERTE(status != 0);

    // The memory will be freed and handles closed in ThreadProcRequest.

    return;
}

VOID ShutdownThread ( ThreadArgs * pArgs )

Definition at line 53 of file filerepclientproc.cpp.

                                       {
    INT status;
    RPC_STATUS rpcstatus;

    if(pArgs != NULL) {

        // Stop impersonating if we are.
        // The first thing we do in handling a request is impersonating the client.
        if (pArgs->bImpersonating) {
            if ((rpcstatus = RpcRevertToSelf()) != RPC_S_OK) {

          // Do the remaining cleanup.
          pArgs->bImpersonating = FALSE;
    ShutdownThread(pArgs);

    RpcRaiseException(rpcstatus);
    return;
      }
  }

  if(pArgs->hFileRepServer != NULL) {
      rpcstatus = RpcBindingFree(&(pArgs->hFileRepServer));
      ASSERTE(rpcstatus == RPC_S_OK);
  }
  // Check that hLocalFile has been initialized and that initialization
  // was successful.
  if(pArgs->hLocalFile != NULL && pArgs->hLocalFile != INVALID_HANDLE_VALUE) {
      status = CloseHandle(pArgs->hLocalFile);
      ASSERTE(status != 0);
  }
  if(pArgs->phContext != NULL) {
      RpcSsDestroyClientContext((VOID **)&pArgs->phContext);
  }

  AutoHeapFree(pArgs);
    }
}

VOID ThreadProcRequest ( ThreadArgs * pArgs )

Definition at line 104 of file filerepclientproc.cpp.

                                          {
    UINT i = 0;
    ULONG cbRead, cbWritten;

    TCHAR Msg[MSG_SIZE];

    // Get the remainder of text from the remote file.  When the
    // server returns a NULL context handle, the read has completed and
    // the file has been closed.
    do {

        // We did not read anything yet.
        cbRead = 0;

#ifdef RETRY_EXCEPTION
  // When making aggressive calls to the server, this flag is
  // set when the call succeeded.  This makes the client service attempt
  // to contact the server even after an exception occured.
  BOOL bRetryCall = TRUE;
  while (bRetryCall) {
#endif

        RpcTryExcept {
            c_RemoteRead(pArgs->hFileRepServer,
       &(pArgs->phContext),
       pArgs->pbBuf,
       &cbRead);

#ifdef RETRY_EXCEPTION
      bRetryCall = FALSE;
#endif

  }
        RpcExcept ( ( (RpcExceptionCode() != STATUS_ACCESS_VIOLATION) &&
          (RpcExceptionCode() != STATUS_DATATYPE_MISALIGNMENT) &&
          (RpcExceptionCode() != STATUS_PRIVILEGED_INSTRUCTION) &&
          (RpcExceptionCode() != STATUS_ILLEGAL_INSTRUCTION) &&
          (RpcExceptionCode() != STATUS_BREAKPOINT))
        ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH ) {

      // Log the error code as well as the error.
      // Msg is sufficiently large and can't overflow.
      _stprintf(Msg, TEXT("ThreadProcRequest: Exception: c_RemoteRead failed with code %d"), RpcExceptionCode());
      AddToMessageLog(Msg);

#ifdef RETRY_EXCEPTION
      // This code attempts to make aggressive calls, retrying
      // if no endpoints were available.  It is used to put servers
      // under stress.
      if (RpcExceptionCode() != EPT_S_NOT_REGISTERED &&
    RpcExceptionCode() != RPC_S_SERVER_UNAVAILABLE) {
#endif

      // Deallocate all the thread data before failing.
      ShutdownThread(pArgs);
      RpcRaiseException(RpcExceptionCode());
      return;
#ifdef RETRY_EXCEPTION
      }
#endif
  }
  RpcEndExcept;

#ifdef RETRY_EXCEPTION
  }
#endif

  // Access check was done on opening when we were impersonating.
  // Thus we do not need to impersonate in this code.
  if(!WriteFile(pArgs->hLocalFile,
          pArgs->pbBuf,
          cbRead,
          &cbWritten,
          NULL)) {

      _stprintf(Msg, TEXT("ThreadProcRequest: WriteFile failed with code %d"), GetLastError());
      AddToMessageLog(Msg);

      ShutdownThread(pArgs);
      return;
  }
    } while(pArgs->phContext != NULL);

#ifdef PROF
    ProfRecordTime(pArgs->nReqId, TEXT("handled"));
#endif

    ShutdownThread(pArgs);

    // After this procedure returns the replication request will have
    // been handled.
    return;
}

Generated on Wed Nov 13 2024 16:53:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/filerepsecure/filerepserver.idl File Reference

  • NetDS
  • RPC
  • FileRep
  • filerepsecure
Classes

filerepserver.idl File Reference

Go to the source code of this file.

Classes

interface FileRepServer
Generated on Wed Nov 13 2024 16:53:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/filerepsecure/filerepserverproc.cpp File Reference

  • NetDS
  • RPC
  • FileRep
  • filerepsecure
Classes | Functions

filerepserverproc.cpp File Reference

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "common.h"
#include "FileRepServer.h"
#include "Service.h"

Go to the source code of this file.

Classes

struct | FILE_CONTEXT_TYPE

Functions

void __RPC_USER | PCONTEXT_HANDLE_TYPE_rundown (PCONTEXT_HANDLE_TYPE phContext)
VOID | ReadData (HANDLE hFile, VOID *pbBuf, unsigned long nToRead, unsigned long *cbRead, BOOL *bEOF, BYTE *EOFCheck)
VOID | s_RemoteOpen (handle_t hFileRepServer, PCONTEXT_HANDLE_TYPE *pphContext, LPTSTR pszFileName, BYTE *pbBuf, unsigned long *cbRead)
VOID | s_RemoteRead (handle_t hFileRepServer, PCONTEXT_HANDLE_TYPE *pphContext, BYTE *pbBuf, unsigned long *cbRead)

Function Documentation

void __RPC_USER PCONTEXT_HANDLE_TYPE_rundown ( PCONTEXT_HANDLE_TYPE phContext )

Definition at line 265 of file filerepserverproc.cpp.

                                                                             {
    FILE_CONTEXT_TYPE *pFileContext;
    INT status;

    // We need to try and close the file associated with the
    // context handle...

    // Context handle can not be NULL in this section, so we can
    // go ahead and try closing the file.
    pFileContext = (FILE_CONTEXT_TYPE *) phContext;

    // Also, we do not need to worry about pFileContext->hFile's being
    // null since we checked for it when we opened the file.
    status = CloseHandle(pFileContext->hFile);
    ASSERTE(status != 0);

    // And then free the memory taken up by it.
    midl_user_free(phContext);
}

VOID ReadData | ( | HANDLE | hFile,
 |  | VOID * | pbBuf,
 |  | unsigned long | nToRead,
 |  | unsigned long * | cbRead,
 |  | BOOL * | bEOF,
 |  | BYTE * | EOFCheck
 | ) |  |

Definition at line 48 of file filerepserverproc.cpp.

                                                                                {

    if(!ReadFile(hFile, pbBuf, nToRead+1, cbRead, NULL)) {

  // We want to raise an exception but leave the context intact
  // so that subsequent reads may be attempted.  Later versions
        // may implement this feature.

  RpcRaiseException(GetLastError());
        return;
    }

    // Check for EOF.
    *bEOF = FALSE;
    // If we read in the whole buffer, save the last byte.
    if(*cbRead == nToRead+1) {
  *EOFCheck = ((BYTE *)pbBuf)[(nToRead+1)-1];

  // return at most nToRead read bytes.
  *cbRead = nToRead;
    }
    // If we did not read the whole buffer then we reached the EOF.
    else{
  *bEOF = TRUE;
    }
}

VOID s_RemoteOpen | ( | handle_t | hFileRepServer,
 |  | PCONTEXT_HANDLE_TYPE * | pphContext,
 |  | LPTSTR | pszFileName,
 |  | BYTE * | pbBuf,
 |  | unsigned long * | cbRead
 | ) |  |

Definition at line 92 of file filerepserverproc.cpp.

{
    HANDLE hFile;
    FILE_CONTEXT_TYPE *pFileContext;
    BOOL bEOF = FALSE;
    BYTE EOFCheck;
    INT status;
    RPC_STATUS rpcstatus;

    BOOL bImpersonating = FALSE;

    // We need to impersonate the user that has issued the
    // remote call.  If we impersonate here then we make sure that
    // the user has adequate permissions to open the file.
    if (!bImpersonating) {
        if ((rpcstatus = RpcImpersonateClient(hFileRepServer)) != RPC_S_OK) {
            RpcRaiseException(rpcstatus);
      return;
  }
  bImpersonating = TRUE;
    }

    // It is enough to impersonate while opening the file, since this is where all
    // the security checks are done.  We can later read from this handle
    // while not impersonating.
    if ((hFile = CreateFile(pszFileName,
          GENERIC_READ,
          FILE_SHARE_READ,
          NULL,
          OPEN_EXISTING,
          FILE_ATTRIBUTE_NORMAL,
          NULL)) == INVALID_HANDLE_VALUE) {

        if ((rpcstatus = RpcRevertToSelf()) != RPC_S_OK) {
      RpcRaiseException(rpcstatus);
      return;
  }

  RpcRaiseException(GetLastError());
        return;
    }

    // We can now revert to self, since file has been opened while
    // impersonating and hence the security requirements have been met.
    if (bImpersonating) {
        if ((rpcstatus = RpcRevertToSelf()) != RPC_S_OK) {
            RpcRaiseException(rpcstatus);
      return;
  }
    }

    // Read data from file into the buffer.
    // This function may throw exceptions, but we would want
    // those to propagate out.
    ReadData(hFile, (VOID *)pbBuf, OPEN_BUFSIZE, cbRead, &bEOF, &EOFCheck);

    // Check if EOF has been reached.
    if(bEOF) {
  // If it has, we can simply return.

  // Since all of the read has completed, the [out] context handle
  // pointer is NULL.
  pFileContext = NULL;
  *pphContext = (PCONTEXT_HANDLE_TYPE) pFileContext;

  status = CloseHandle(hFile);
  ASSERTE(status != 0);

  return;
    }
    else {
  // Otherwise we need to allocate, initialize, and return the
  // context handle.
  if((pFileContext = (FILE_CONTEXT_TYPE *) midl_user_allocate(sizeof(FILE_CONTEXT_TYPE))) == NULL) {

      status = CloseHandle(hFile);
      ASSERTE(status != 0);
      RpcRaiseException(ERROR_OUTOFMEMORY);
      return;
  }

  // Initialize the context handle fields.
  pFileContext->hFile = hFile;

  pFileContext->EOFCheck = EOFCheck;

  *pphContext = (PCONTEXT_HANDLE_TYPE) pFileContext;

  return;
    }
}

VOID s_RemoteRead | ( | handle_t | hFileRepServer,
 |  | PCONTEXT_HANDLE_TYPE * | pphContext,
 |  | BYTE * | pbBuf,
 |  | unsigned long * | cbRead
 | ) |  |

Definition at line 204 of file filerepserverproc.cpp.

{
    FILE_CONTEXT_TYPE *pFileContext;
    BOOL bEOF = FALSE;
    BYTE EOFCheck;
    INT status;

    // Clients have already been authenticated in RemoteOpen.
    // Here we operate on the context handle generated in RemoteOpen,
    // hence no additional security precations need to be taken.

    // Make sure that the provided context handle is not NULL.
    if(*pphContext == NULL) {

  RpcRaiseException(RPC_X_SS_IN_NULL_CONTEXT);
        return;
    }

    pFileContext = (FILE_CONTEXT_TYPE *) *pphContext;

    // Remember that we have a byte left over from RemoteOpen EOF check.
    pbBuf[0] = pFileContext->EOFCheck;

    // Read the following bytes from file, but remember that we now only
    // have space for READ_BUFSIZE-1 bytes and we write starting
    // from the 1st index.  We will let possible exceptions propagate out.
    ReadData(pFileContext->hFile, (VOID *)&(pbBuf[1]), READ_BUFSIZE-1, cbRead, &bEOF, &EOFCheck);

    // Since we had the first byte left over from the previous read, pretend
    // that we read it.
    (*cbRead)++;

    if(bEOF){
        // If it has, we can destroy the context handle, close
        // the file and return.
  status = CloseHandle(pFileContext->hFile);
        ASSERTE(status != 0);

  midl_user_free(*pphContext);

  // Return NULL context handle to signify that the file has
  // been completely read.
  pFileContext = NULL;
  *pphContext = (PCONTEXT_HANDLE_TYPE) pFileContext;

  return;
    }

    // Memorize the last byte read for the next read.
    pFileContext->EOFCheck = EOFCheck;

    // Otherwise we just return the number of symbols read in cbRead.
    return;
}

Generated on Wed Nov 13 2024 16:53:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/filerepsecure/filerepservice.cpp File Reference

  • NetDS
  • RPC
  • FileRep
  • filerepsecure
Defines | Functions | Variables

filerepservice.cpp File Reference

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <process.h>
#include <tchar.h>
#include <rpc.h>
#include <Ntdsapi.h>
#include <Ntsecapi.h>
#include <Security.h>
#include <Secext.h>
#include <Dsgetdc.h>
#include <Lm.h>
#include "FileRepServer.h"
#include "FileRepClient.h"
#include "Service.h"
#include "common.h"

Go to the source code of this file.

Defines

#define | SECURITY_WIN32

Functions

VOID _cdecl | main (int argc, char **argv)
RPC_STATUS __stdcall | RpcServerIfCallback (IN void *Interface, IN void *Context)
VOID WINAPI | ServiceCtrl (DWORD Opcode)
VOID WINAPI | ServiceMain (DWORD dwArgc, LPTSTR *lpszArgv)
VOID | ServiceStart (DWORD dwArgc, LPTSTR *lpszArgv)
VOID | ServiceStop ()

Variables

BOOL | bServerListening = FALSE
ULONG | cMaxCallsExecute = RPC_C_LISTEN_MAX_CALLS_DEFAULT
ULONG | cMaxCallsListen = RPC_C_PROTSEQ_MAX_REQS_DEFAULT
ULONG | cMinimumThreads = 2
RPC_BINDING_VECTOR * | pBindingVector = NULL
LPTSTR ServerProtocolArray []
SERVICE_STATUS_HANDLE | sshStatusHandle
SERVICE_STATUS | ssStatus
RPC_STATUS | status

Define Documentation

#define SECURITY_WIN32

Definition at line 27 of file filerepservice.cpp.

Function Documentation

VOID _cdecl main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 93 of file filerepservice.cpp.

                                       {

    // Since we provide a single service there is only
    // one entry in the service dispatch table
    SERVICE_TABLE_ENTRY DispatchTable[] = {
        { SERVICENAME, (LPSERVICE_MAIN_FUNCTION)ServiceMain },
        { NULL, NULL }
    };

    // The service control manager may be starting the service with
    // this call, so we must call StartServiceCtrlDispatcher.
    if (!StartServiceCtrlDispatcher(DispatchTable)) {
        AddToMessageLog(TEXT("StartServiceCtrlDispatcher failed"));
    }
}

RPC_STATUS __stdcall RpcServerIfCallback | ( | IN void * | Interface,
 |  | IN void * | Context
 | ) |  |

Definition at line 248 of file filerepservice.cpp.

  {
    ULONG ulAuthnLevel;
    ULONG ulAuthnSvc;

    // Get client security info.
    if (RpcBindingInqAuthClient(Context,
        NULL,
        NULL,
        &ulAuthnLevel,
        &ulAuthnSvc,
        NULL) != RPC_S_OK) {

        return RPC_S_ACCESS_DENIED;
    }

    // Make sure the client has adequate security measures and uses the expected
    // security provider.
    if (ulAuthnLevel != RPC_C_AUTHN_LEVEL_PKT_PRIVACY || ulAuthnSvc != RPC_C_AUTHN_GSS_KERBEROS) {

        return RPC_S_ACCESS_DENIED;
    }

    return RPC_S_OK;
};

VOID WINAPI ServiceCtrl ( DWORD Opcode )

Definition at line 167 of file filerepservice.cpp.

                                      {

    // We only handle the STOP control requsts.
    switch(Opcode) {

        case SERVICE_CONTROL_STOP:
            // Stop the service.
            ServiceStop();
            break;

        default:
            AddToMessageLog(TEXT("ServiceCtrl: unrecognized or unimplemented opcode\n"));
    }

    return;
}

VOID WINAPI ServiceMain | ( | DWORD | dwArgc,
 |  | LPTSTR * | lpszArgv
 | ) |  |

Definition at line 127 of file filerepservice.cpp.

                                                        {

    // Initial service configuration
    ssStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
    ssStatus.dwCurrentState = SERVICE_START_PENDING;
    ssStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP;
    ssStatus.dwWin32ExitCode = 0;
    ssStatus.dwServiceSpecificExitCode = 0;
    ssStatus.dwCheckPoint = 0;
    ssStatus.dwWaitHint = 0;

    sshStatusHandle = RegisterServiceCtrlHandler(SERVICENAME, ServiceCtrl);

    // Tell the SCM that the service is starting up.
    if (!SetServiceStatus(sshStatusHandle, &ssStatus)) {
        AddToMessageLog(TEXT("ServiceMain: SetServiceStatus failed\n"));
        return;
    }

    // Initialize the service and start it.
    ServiceStart(dwArgc, lpszArgv);

    return;
}

VOID ServiceStart | ( | DWORD | dwArgc,
 |  | LPTSTR * | lpszArgv
 | ) |  |

Definition at line 292 of file filerepservice.cpp.

                                                  {

    UINT i;

    // Array of generated SPNs.
    TCHAR **Spn;
    // Number of generated SPNs.
    ULONG ulSpn = 1;

    PDOMAIN_CONTROLLER_INFO pDomainControllerInfo;

    HANDLE hDS;

    TCHAR lpCompDN[128];
    ULONG ulCompDNSize = sizeof(lpCompDN);

    // Message buffer.
    TCHAR Msg[128];

    // Report the status to the service control manager.
    if (!ReportStatusToSCMgr(&sshStatusHandle, &ssStatus, SERVICE_START_PENDING, NO_ERROR, 1000)) {
        AddToMessageLog(TEXT("ReportStatusToSCMgr failed\n"));
  ServiceStop();
        return;
    }

    // Service initialization

    // Register the service interfaces.

    // The server interface has a security callback RpcServerIfCallback.
    // The RPC run time will automatically reject unauthenticated calls to
    // this interface.
    status = RpcServerRegisterIfEx(s_FileRepServer_v1_0_s_ifspec,
           NULL,
           NULL,
           RPC_IF_ALLOW_SECURE_ONLY,
           RPC_C_LISTEN_MAX_CALLS_DEFAULT,
           &RpcServerIfCallback);
    if (status != RPC_S_OK){
        AddToMessageLog(TEXT("ServiceStart: RpcServerRegisterIf(s_FileRepServer_v1_0_s_ifspec, ...) failed\n"));
  ServiceStop();
        return;
    }

    status = RpcServerRegisterIf(FileRepClient_v1_0_s_ifspec, NULL, NULL);
    if (status != RPC_S_OK){
        AddToMessageLog(TEXT("ServiceStart: RpcServerRegisterIf(FileRepClient_v1_0_s_ifspec, ...) failed\n"));
  ServiceStop();
        return;
    }

    for (i = 0; i < sizeof(ServerProtocolArray)/sizeof(unsigned char *); i++) {

        // Use the protocol sequences specified in ProtocolArray
        // for receiving RPCs.
        status = RpcServerUseProtseq((_TUCHAR *)ServerProtocolArray[i], cMaxCallsListen, NULL);
        if (status != RPC_S_OK){
            AddToMessageLog(TEXT("ServiceStart: RpcServerUseProtseq failed\n"));
      ServiceStop();
            return;
        }
    }

    // Obtain a binding vector for the server.
    status = RpcServerInqBindings(&pBindingVector);
    if (status != RPC_S_OK) {
        AddToMessageLog(TEXT("ServiceStart: RpcServerInqBindings failed\n"));
  ServiceStop();
        return;
    }

    // Register the the services in the endpoint map
    // of the host computer.
    status = RpcEpRegister(s_FileRepServer_v1_0_s_ifspec, pBindingVector, NULL, NULL);
    if (status != RPC_S_OK){
        AddToMessageLog(TEXT("ServiceStart: RpcEpRegister(s_FileRepServer_v1_0_s_ifspec, ...) failed\n"));
  ServiceStop();
        return;
    }
    status = RpcEpRegister(FileRepClient_v1_0_s_ifspec, pBindingVector, NULL, NULL);
    if (status != RPC_S_OK){
        AddToMessageLog(TEXT("ServiceStart: RpcEpRegister(FileRepClient_v1_0_s_ifspec, ...) failed\n"));
  ServiceStop();
        return;
    }

    //
    // Set the security info for the client system service.
    //

    // Principal name is NULL for local system service.
    status = RpcServerRegisterAuthInfo(NULL, RPC_C_AUTHN_WINNT, NULL, NULL);
    if (status != RPC_S_OK){
        AddToMessageLog(TEXT("ServiceStart: RpcServerRegisterAuthInfo failed"));
  ServiceStop();
        return;
    }

    //
    // Set the security info for the server system service.
    //

    BOOL NoFailure = TRUE;

    // Generate the SPN.
    status = DsGetSpn(DS_SPN_NB_HOST, // Type of SPN to create.
                      SERVICENAME, // Service class
                      NULL, // DN of this service.
                      0, // Use the default instance port.
                      0, // Number of additional instance names.
                      NULL, // No additional instance names.
                      NULL, // No additional instance ports.
                      &ulSpn, // Size of SPN array.
                      &Spn); // Returned SPN(s).
    if (status != RPC_S_OK){
        _stprintf(Msg, TEXT("ServiceStart: DsGetSpn failed with code %d\n"), status);
        AddToMessageLog(Msg);
        ServiceStop();
        return;
    }

    // Get the name of our domain.
    if (status = DsGetDcName(NULL,
                             NULL,
                             NULL,
                             NULL,
                             DS_RETURN_DNS_NAME,
                             &pDomainControllerInfo) != NO_ERROR) {
        _stprintf(Msg, TEXT("ServiceStart: DsGetDcName failed with code %d\n"), status);
        AddToMessageLog(Msg);
        NoFailure = FALSE;
    }

        if (NoFailure) {
            // Bind to the domain controller for our domain.
            if ((status = DsBind(pDomainControllerInfo->DomainName, NULL, &hDS)) != ERROR_SUCCESS) {
                _stprintf(Msg, TEXT("ServiceStart: DsBind failed with code %d\n"), status);
                        AddToMessageLog(Msg);
                        NoFailure = FALSE;
            }
        }

        if (NoFailure) {
            if ((status = NetApiBufferFree(pDomainControllerInfo)) != NERR_Success) {
                    _stprintf(Msg, TEXT("ServiceStart: NetApiBufferFree failed with code %d\n"), status);
                        AddToMessageLog(Msg);
                        ServiceStop();
                        return;
                }

            if (GetComputerObjectName(NameFullyQualifiedDN, lpCompDN, &ulCompDNSize) == 0){
            _stprintf(Msg, TEXT("ServiceStart: GetComputerObjectName failed with code %d\n"), GetLastError());
                        AddToMessageLog(Msg);
                        ServiceStop();
                        return;
                }

                // We could check whether the SPN is already registered for this
                // computer's DN, but we don't have to.  Modification is performed
                // permissively by this function, so that adding a value that already
                // exists does not return an error.  This way we can opt for the internal
                // check instead of doing it ourselves.
        status = DsWriteAccountSpn(hDS, DS_SPN_ADD_SPN_OP, lpCompDN, ulSpn, (LPCTSTR *)Spn);
        if (status != NO_ERROR) {
            _stprintf(Msg, TEXT("ServiceStart: DsWriteAccountSpn failed with code %d\n"), status);
            AddToMessageLog(Msg);
            return;
        }
        DsUnBind(&hDS);
        }

    // We use Kerberos for authentication on the server.
    status = RpcServerRegisterAuthInfo(Spn[0], RPC_C_AUTHN_GSS_KERBEROS, NULL, NULL);
    if (status != RPC_S_OK){
        _stprintf(Msg, TEXT("ServiceStart: RpcServerRegisterAuthInfo"), status);
        AddToMessageLog(Msg);
        ServiceStop();
        return;
    }

    // Don't forget to deallocate the principal name array.
    DsFreeSpnArray(ulSpn, Spn);

    // Create the heap to be used by midl_user_allocate and midl_user_free
    RpcHeap = HeapCreate(0, RPC_HEAP_SIZE_INIT, RPC_HEAP_SIZE_MAX);

#ifdef PROF
    ProfOpenLog(TEXT("FileRepService.prof"));
#endif

    // Start accepting client calls.
    // The last argument's being 1 indicates that RpcServerListen
    // should return immediately after completing function processing.
    status = RpcServerListen(cMinimumThreads, cMaxCallsExecute, 1);
    if (status != RPC_S_OK){
        AddToMessageLog(TEXT("ServiceStart: RpcServerListen failed\n"));
  ServiceStop();
        return;
    }

    bServerListening = TRUE;

    // Tell The SCM that the service is running.
    if (!ReportStatusToSCMgr(&sshStatusHandle, &ssStatus, SERVICE_RUNNING, NO_ERROR, 0)){
        AddToMessageLog(TEXT("ServiceStart: ReportStatusToSCMgr failed"));
  ServiceStop();
        return;
    }

    // End of initialization

    // RpcMgmtWaitServerListen() will block until the server has
    // stopped listening.
    status = RpcMgmtWaitServerListen();
    if (status != RPC_S_OK){
        AddToMessageLog(TEXT("ServiceStart: RpcMgmtWaitServerListen failed"));
  ServiceStop();
        return;
    }

    // Cleanup

    // Delete the binding vector.
    status = RpcServerUnregisterIf(NULL, NULL, FALSE);
    if(status != RPC_S_OK){
        AddToMessageLog(TEXT("ServiceStart: RpcServerUnregisterIf failed"));
        return;
    }

    return;
}

VOID ServiceStop ( )

Definition at line 540 of file filerepservice.cpp.

                   {
    RPC_STATUS status;

    // Stops the server, wakes up the main thread.
    if (bServerListening) {
        status = RpcMgmtStopServerListening(NULL);
  if(status != RPC_S_OK) {
      AddToMessageLog(TEXT("ServiceStop: RpcMgmtStopServerListening failed."));
      return;
  }
  bServerListening = FALSE;
    }

    // Tell The SCM that the service is stopped.
    if(!ReportStatusToSCMgr(&sshStatusHandle, &ssStatus, SERVICE_STOPPED, NO_ERROR, 0)) {
        AddToMessageLog(TEXT("ServiceStop: ReportStatusToSCMgr failed"));
        return;
    }

#ifdef PROF
    ProfCloseLog();
#endif

}

Variable Documentation

BOOL bServerListening = FALSE

Definition at line 75 of file filerepservice.cpp.

ULONG cMaxCallsExecute = RPC_C_LISTEN_MAX_CALLS_DEFAULT

Definition at line 201 of file filerepservice.cpp.

ULONG cMaxCallsListen = RPC_C_PROTSEQ_MAX_REQS_DEFAULT

Definition at line 198 of file filerepservice.cpp.

ULONG cMinimumThreads = 2

Definition at line 204 of file filerepservice.cpp.

RPC_BINDING_VECTOR* pBindingVector = NULL

Definition at line 206 of file filerepservice.cpp.

LPTSTR ServerProtocolArray[]
Initial value:
 { TEXT("ncacn_ip_tcp"),
         TEXT("ncalrpc") }

Definition at line 192 of file filerepservice.cpp.

SERVICE_STATUS_HANDLE sshStatusHandle

Definition at line 70 of file filerepservice.cpp.

SERVICE_STATUS ssStatus

Definition at line 73 of file filerepservice.cpp.

RPC_STATUS status

Definition at line 209 of file filerepservice.cpp.

Generated on Wed Nov 13 2024 16:53:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/filerepsecure/prof.cpp File Reference

  • NetDS
  • RPC
  • FileRep
  • filerepsecure
Defines | Functions | Variables

prof.cpp File Reference

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <process.h>
#include <tchar.h>
#include "Prof.h"
#include "Service.h"
#include "common.h"

Go to the source code of this file.

Defines

#define | MAX_ENTRY_SIZE_NOMSG (32)

Functions

VOID | ProfCloseLog (VOID)
VOID | ProfOpenLog (LPTSTR LogFileName)
VOID | ProfRecordTime (UINT id, LPTSTR msg)

Variables

HANDLE | hProfLog = NULL
HANDLE hProfMutex
LARGE_INTEGER | lpCurrentTime
LARGE_INTEGER | lpFrequency
LARGE_INTEGER | lpStartTime
UINT | nProfLogSize = 0
TCHAR | PROF_LOG [PROF_LOG_MAX_SIZE]

Define Documentation

#define MAX_ENTRY_SIZE_NOMSG (32)

Definition at line 50 of file prof.cpp.

Function Documentation

VOID ProfCloseLog ( VOID )

Definition at line 118 of file prof.cpp.

                        {
    ULONG cbWritten;
    DWORD status;

    // Close the mutex.
    // Here we make the assumption that no outside functions will use
    // the mutex anymore.  This should be valid, since all the profiling data
    // has been written.
    status = CloseHandle(hProfMutex);
    ASSERTE(status);

    // Write out the profile log.
    if(!WriteFile(hProfLog,
      (LPVOID)PROF_LOG,
      nProfLogSize*sizeof(TCHAR),
      &cbWritten,
      NULL)) {

  RaiseException(GetLastError(), 0, 0, NULL);
  return;
    }

    // Close the profile log.
    if (hProfLog != NULL && hProfLog != INVALID_HANDLE_VALUE) {
        status = CloseHandle(hProfLog);
        ASSERTE(status);
    }
}

VOID ProfOpenLog ( LPTSTR LogFileName )

Definition at line 54 of file prof.cpp.

                                     {

    // Create the mutex.
    if ((hProfMutex = CreateMutex(NULL,
          FALSE,
          TEXT("ProfMutex"))) == INVALID_HANDLE_VALUE) {
  RaiseException(GetLastError(), 0, 0, NULL);
        return;
    }

    // Open the profiling log.
    if ((hProfLog = CreateFile(LogFileName,
             GENERIC_WRITE,
             0,
             NULL,
             CREATE_ALWAYS,
             FILE_ATTRIBUTE_NORMAL,
             NULL)) == INVALID_HANDLE_VALUE) {
  RaiseException(GetLastError(), 0, 0, NULL);
        return;
    }

    // Get the current time.
    if (QueryPerformanceCounter(&lpStartTime) == FALSE) {
  RaiseException(GetLastError(), 0, 0, NULL);
        return;
    }

    // Get the frequency.
    if (QueryPerformanceFrequency(&lpFrequency) == FALSE) {
  RaiseException(GetLastError(), 0, 0, NULL);
        return;
    }
}

VOID ProfRecordTime | ( | UINT | id,
 |  | LPTSTR | msg
 | ) |  |

Definition at line 89 of file prof.cpp.

                                         {
    FLOAT dt;

    if (WaitForSingleObject(hProfMutex, INFINITE) == WAIT_FAILED) {
  RaiseException(GetLastError(), 0, 0, NULL);
  return;
    }

    // Write the entry only if there is enough space left in
    // the log.
    if (nProfLogSize < PROF_LOG_MAX_SIZE - (MAX_ENTRY_SIZE_NOMSG + _tcslen(msg))) {
  if (QueryPerformanceCounter(&lpCurrentTime) == FALSE) {
      RaiseException(GetLastError(), 0, 0, NULL);
      return;
  }

  // Get the time stamp for the event.
  dt = (FLOAT)(lpCurrentTime.QuadPart - lpStartTime.QuadPart)/(FLOAT)(lpFrequency.QuadPart);

  // Append the entry to the log.
  nProfLogSize+=_stprintf(&PROF_LOG[nProfLogSize], TEXT("%d %s %f\n"), id, msg, dt);
    }

    if (ReleaseMutex(hProfMutex) == FALSE) {
  RaiseException(GetLastError(), 0, 0, NULL);
  return;
    }
}

Variable Documentation

HANDLE hProfLog = NULL

Definition at line 34 of file prof.cpp.

HANDLE hProfMutex

Definition at line 52 of file prof.cpp.

LARGE_INTEGER lpCurrentTime

Definition at line 37 of file prof.cpp.

LARGE_INTEGER lpFrequency

Definition at line 37 of file prof.cpp.

LARGE_INTEGER lpStartTime

Definition at line 37 of file prof.cpp.

UINT nProfLogSize = 0

Definition at line 45 of file prof.cpp.

TCHAR PROF_LOG[PROF_LOG_MAX_SIZE]

Definition at line 42 of file prof.cpp.

Generated on Wed Nov 13 2024 16:53:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/filerepsecure/prof.h File Reference

  • NetDS
  • RPC
  • FileRep
  • filerepsecure
Defines | Functions | Variables

prof.h File Reference

Go to the source code of this file.

Defines

#define | PROF_LOG_MAX_SIZE (10*1024*1024)

Functions

VOID | ProfCloseLog (VOID)
VOID | ProfOpenLog (LPTSTR LogFileName)
VOID | ProfRecordTime (UINT id, LPTSTR msg)

Variables

HANDLE hProfMutex

Define Documentation

#define PROF_LOG_MAX_SIZE (10*1024*1024)

Definition at line 25 of file prof.h.

Function Documentation

VOID ProfCloseLog ( VOID )

Definition at line 108 of file Prof.cpp.

                        {
    ULONG cbWritten;
    DWORD status;

    // Delete the critsec.
    // Here we make the assumption that no outside functions will use
    // the critsec anymore.  This should be valid, since all the profiling data
    // has been written.
    // Also we make an assumption that only one thread will attempt
    // to close the profile log.  This should be valid as well, or the
    // user can inmplement a semaphore to take care of that.
    DeleteCriticalSection(&ProfCriticalSection);

    // Write out the profile log.
    if(!WriteFile(hProfLog,
                  (LPVOID)PROF_LOG,
                  nProfLogSize*sizeof(TCHAR),
                  &cbWritten,
                  NULL)) {

        AddToMessageLogProcFailure(TEXT("ProfCloseLog: WriteFile"), GetLastError());
        return;
    }

    // Close the profile log.
    if (hProfLog != NULL && hProfLog != INVALID_HANDLE_VALUE) {
        status = CloseHandle(hProfLog);
        ASSERT(status);
    }
}

VOID ProfOpenLog ( LPTSTR LogFileName )

Definition at line 51 of file Prof.cpp.

                                     {

    // Init the critsec.
    if (InitializeCriticalSectionAndSpinCount(&ProfCriticalSection, 0) == 0) {
        AddToMessageLogProcFailure(TEXT("ProfOpenLog: InitializeCriticalSectionAndSpinCount"), GetLastError());
        return;
    }

    // Open the profiling log.
    if ((hProfLog = CreateFile(LogFileName,
                               GENERIC_WRITE,
                               0,
                               NULL,
                               CREATE_ALWAYS,
                               FILE_ATTRIBUTE_NORMAL,
                               NULL)) == INVALID_HANDLE_VALUE) {
        AddToMessageLogProcFailure(TEXT("ProfOpenLog: CreateFile"), GetLastError());
        return;
    }

    // Get the current time.
    if (QueryPerformanceCounter(&lpStartTime) == FALSE) {
        AddToMessageLogProcFailure(TEXT("ProfOpenLog: QueryPerformanceCounter"), GetLastError());
        return;
    }

    // Get the frequency.
    if (QueryPerformanceFrequency(&lpFrequency) == FALSE) {
        AddToMessageLogProcFailure(TEXT("ProfOpenLog: QueryPerformanceCounter"), GetLastError());
        return;
    }
}

VOID ProfRecordTime | ( | UINT | id,
 |  | LPTSTR | msg
 | ) |  |

Definition at line 84 of file Prof.cpp.

                                         {
    FLOAT dt;

    EnterCriticalSection(&ProfCriticalSection);

    // Write the entry only if there is enough space left in
    // the log.
    if (nProfLogSize < PROF_LOG_MAX_SIZE - (MAX_ENTRY_SIZE_NOMSG + _tcslen(msg))) {
        if (QueryPerformanceCounter(&lpCurrentTime) == FALSE) {
            AddToMessageLogProcFailure(TEXT("ProfRecordTime: QueryPerformanceCounter"), GetLastError());
            LeaveCriticalSection(&ProfCriticalSection);
            return;
        }

        // Get the time stamp for the event.
        dt = (FLOAT)(lpCurrentTime.QuadPart - lpStartTime.QuadPart)/(FLOAT)(lpFrequency.QuadPart);

        // Append the entry to the log.
        nProfLogSize+=_stprintf(&PROF_LOG[nProfLogSize], TEXT("%d %s %f\n"), id, msg, dt);
    }

    LeaveCriticalSection(&ProfCriticalSection);
}

Variable Documentation

HANDLE hProfMutex

Definition at line 52 of file prof.cpp.

Generated on Wed Nov 13 2024 16:53:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/filerepsecure/service.cpp File Reference

  • NetDS
  • RPC
  • FileRep
  • filerepsecure
Functions | Variables

service.cpp File Reference

#include <windows.h>
#include <stdio.h>
#include <tchar.h>
#include "common.h"
#include "Service.h"

Go to the source code of this file.

Functions

VOID | AddToMessageLog (LPTSTR lpszMsg)
VOID __RPC_FAR *__RPC_API | midl_user_allocate (size_t len)
VOID __RPC_API | midl_user_free (VOID __RPC_FAR *ptr)
BOOL | ReportStatusToSCMgr (SERVICE_STATUS_HANDLE *sshStatusHandle, SERVICE_STATUS *ssStatus, DWORD dwCurrentState, DWORD dwWin32ExitCode, DWORD dwWaitHint)

Variables

HANDLE RpcHeap

Function Documentation

VOID AddToMessageLog ( LPTSTR lpszMsg )

Definition at line 95 of file service.cpp.

                                    {
    TCHAR szMsg[256];
    HANDLE hEventSource;
    LPTSTR lpszStrings[2];
    DWORD dwErr = 0;

    dwErr = GetLastError();

    // Use event logging to log the error.
    hEventSource = RegisterEventSource(NULL, SERVICENAME);

    _stprintf(szMsg, TEXT("%s error: %d"), SERVICENAME, dwErr);
    lpszStrings[0] = szMsg;
    lpszStrings[1] = lpszMsg;

    if (hEventSource != NULL) {
        ReportEvent(hEventSource, // handle of event source
        EVENTLOG_ERROR_TYPE, // event type
        0, // event category
        0, // event ID
        NULL, // current user's SID
        2, // strings in lpszStrings
        0, // no bytes of raw data
        (LPCTSTR *) lpszStrings, // array of error strings
        NULL); // no raw data

        (VOID) DeregisterEventSource(hEventSource);
    }
}

VOID __RPC_FAR* __RPC_API midl_user_allocate ( size_t len )

Definition at line 132 of file service.cpp.

                                                          {
    return(HeapAlloc(RpcHeap, 0, len));
}

VOID __RPC_API midl_user_free ( VOID __RPC_FAR * ptr )

Definition at line 136 of file service.cpp.

                                                    {
    if(ptr != NULL) {
        HeapFree(RpcHeap, 0, ptr);
    }
}

BOOL ReportStatusToSCMgr | ( | SERVICE_STATUS_HANDLE * | sshStatusHandle,
 |  | SERVICE_STATUS * | ssStatus,
 |  | DWORD | dwCurrentState,
 |  | DWORD | dwWin32ExitCode,
 |  | DWORD | dwWaitHint
 | ) |  |

Definition at line 49 of file service.cpp.

                        {

    static DWORD dwCheckPoint = 1;
    BOOL fResult = TRUE;

    if (dwCurrentState == SERVICE_START_PENDING)
        ssStatus->dwControlsAccepted = 0;
    else
        ssStatus->dwControlsAccepted = SERVICE_ACCEPT_STOP;

    ssStatus->dwCurrentState = dwCurrentState;
    ssStatus->dwWin32ExitCode = dwWin32ExitCode;
    ssStatus->dwWaitHint = dwWaitHint;

    if ( ( dwCurrentState == SERVICE_RUNNING ) || ( dwCurrentState == SERVICE_STOPPED ) ) {
        ssStatus->dwCheckPoint = 0;
    }
    else {
        ssStatus->dwCheckPoint = dwCheckPoint++;
    }

    // Report the status of the service to the service control manager.
    if (!(fResult = SetServiceStatus(*sshStatusHandle, ssStatus))) {
        AddToMessageLog(TEXT("SetServiceStatus failed"));
    }
    return fResult;
}

Variable Documentation

HANDLE RpcHeap

Definition at line 126 of file service.cpp.

Generated on Wed Nov 13 2024 16:54:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/filerepsecure/service.h File Reference

  • NetDS
  • RPC
  • FileRep
  • filerepsecure
Defines | Functions | Variables

service.h File Reference

Go to the source code of this file.

Defines

#define | APPNAME TEXT("FileRepService")
#define | DEPENDENCIES TEXT("RPCSS\0\0")
#define | RPC_HEAP_SIZE_INIT (1024*1024)
#define | RPC_HEAP_SIZE_MAX (128*1024*1024)
#define | SERVICEDISPLAYNAME TEXT("File Replication Service")
#define | SERVICENAME TEXT("FileRepService")

Functions

VOID | AddToMessageLog (LPTSTR lpszMsg)
BOOL | ReportStatusToSCMgr (SERVICE_STATUS_HANDLE *sshStatusHandle, SERVICE_STATUS *ssStatus, DWORD dwCurrentState, DWORD dwWin32ExitCode, DWORD dwWaitHint)

Variables

HANDLE RpcHeap

Define Documentation

#define APPNAME TEXT("FileRepService")

Definition at line 20 of file service.h.

#define DEPENDENCIES TEXT("RPCSS\0\0")

Definition at line 29 of file service.h.

#define RPC_HEAP_SIZE_INIT (1024*1024)

Definition at line 49 of file service.h.

#define RPC_HEAP_SIZE_MAX (128*1024*1024)

Definition at line 50 of file service.h.

#define SERVICEDISPLAYNAME TEXT("File Replication Service")

Definition at line 26 of file service.h.

#define SERVICENAME TEXT("FileRepService")

Definition at line 23 of file service.h.

Function Documentation

VOID AddToMessageLog ( LPTSTR lpszMsg )

Definition at line 598 of file Service.cpp.

                                    {
    TCHAR szMsg1[256];
    HANDLE hEventSource;
    LPTSTR lpszStrings[2];
    DWORD dwErr = 0;

    dwErr = GetLastError();

    // Use event logging to log the error.
    hEventSource = RegisterEventSource(NULL, SERVICENAME);

    _stprintf(szMsg1, TEXT("%s error: %d"), SERVICENAME, dwErr);
    lpszStrings[0] = szMsg1;
    lpszStrings[1] = szMsg2;

    if (hEventSource != NULL) {
        ReportEvent(hEventSource, // handle of event source
                    EVENTLOG_ERROR_TYPE, // event type
                    0, // event category
                    0, // event ID
                    NULL, // current user's SID
                    2, // strings in lpszStrings
                    0, // no bytes of raw data
                    (LPCTSTR *) lpszStrings, // array of error strings
                    NULL); // no raw data

        (VOID) DeregisterEventSource(hEventSource);
    }
}

BOOL ReportStatusToSCMgr | ( | SERVICE_STATUS_HANDLE * | sshStatusHandle,
 |  | SERVICE_STATUS * | ssStatus,
 |  | DWORD | dwCurrentState,
 |  | DWORD | dwWin32ExitCode,
 |  | DWORD | dwWaitHint
 | ) |  |

Definition at line 548 of file Service.cpp.

                                          {

    static DWORD dwCheckPoint = 1;
    BOOL fResult = TRUE;

    if (dwCurrentState == SERVICE_START_PENDING) {
        ssStatus->dwControlsAccepted = 0;
    }
    else {
        ssStatus->dwControlsAccepted = SERVICE_ACCEPT_STOP;
    }

    ssStatus->dwCurrentState = dwCurrentState;
    ssStatus->dwWin32ExitCode = dwWin32ExitCode;
    ssStatus->dwWaitHint = dwWaitHint;

    if ((dwCurrentState == SERVICE_RUNNING) || (dwCurrentState == SERVICE_STOPPED)) {
        ssStatus->dwCheckPoint = 0;
    }
    else {
        ssStatus->dwCheckPoint = dwCheckPoint++;
    }

    // Report the status of the service to the service control manager.
    if (!(fResult = SetServiceStatus(*sshStatusHandle, ssStatus))) {
        AddToMessageLog(TEXT("ReportStatusToSCMgr: SetServiceStatus failed"));
    }
    return fResult;
}

Variable Documentation

HANDLE RpcHeap

Definition at line 1159 of file Service.cpp.

Generated on Wed Nov 13 2024 16:54:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/filerepsimple/common.cpp File Reference

  • NetDS
  • RPC
  • FileRep
  • filerepsimple
Functions | Variables

common.cpp File Reference

#include <windows.h>
#include <tchar.h>
#include <stdio.h>
#include <stdlib.h>
#include <crtdbg.h>
#include "common.h"

Go to the source code of this file.

Functions

VOID * | AutoHeapAlloc (size_t dwBytes)
VOID | AutoHeapFree (VOID *lpMem)

Variables

HANDLE | hProcessHeap = NULL

Function Documentation

VOID* AutoHeapAlloc ( size_t dwBytes )

Definition at line 23 of file common.cpp.

                                     {
    if (hProcessHeap == NULL) {
        hProcessHeap = GetProcessHeap();
    }
    return HeapAlloc(hProcessHeap, 0, dwBytes);
}

VOID AutoHeapFree ( VOID * lpMem )

Definition at line 30 of file common.cpp.

                                {
    DWORD status;
    ASSERTE(hProcessheap != NULL);
    status = HeapFree(hProcessHeap, 0, lpMem);
    ASSERTE(status);
}

Variable Documentation

HANDLE hProcessHeap = NULL

Definition at line 21 of file common.cpp.

Generated on Wed Nov 13 2024 16:53:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/filerepsimple/common.h File Reference

  • NetDS
  • RPC
  • FileRep
  • filerepsimple
Defines | Functions

common.h File Reference

#include <windows.h>
#include <crtdbg.h>

Go to the source code of this file.

Defines

#define | ASSERTE _ASSERTE
#define | EXIT_IF_FAIL(x, string)
#define | MSG_SIZE (256)

Functions

VOID * | AutoHeapAlloc (size_t dwBytes)
VOID | AutoHeapFree (VOID *lpMem)

Define Documentation

#define ASSERTE _ASSERTE

Definition at line 31 of file common.h.

#define EXIT_IF_FAIL | ( | x,
 |  | string
 | ) |
Value:
{ \
        ((x) != RPC_S_OK) ? _tprintf(TEXT("%s failed with error %d\n"), \
        TEXT(string), (x)), exit(EXIT_FAILURE) : 0;}

Definition at line 25 of file common.h.

#define MSG_SIZE (256)

Definition at line 35 of file common.h.

Function Documentation

VOID* AutoHeapAlloc ( size_t dwBytes )

Definition at line 108 of file common.cpp.

                                     {
    if (hProcessHeap == NULL) {
        hProcessHeap = GetProcessHeap();
    }
    return HeapAlloc(hProcessHeap, 0, dwBytes);
}

VOID AutoHeapFree ( VOID * lpMem )

Definition at line 115 of file common.cpp.

                                {
    DWORD status;
    ASSERT(hProcessHeap != NULL);
    status = HeapFree(hProcessHeap, 0, lpMem);
    ASSERT(status);
}

Generated on Wed Nov 13 2024 16:53:11 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/filerepsimple/filerep.cpp File Reference

  • NetDS
  • RPC
  • FileRep
  • filerepsimple
Functions

filerep.cpp File Reference

#include <stdio.h>
#include <stdlib.h>
#include <process.h>
#include <tchar.h>
#include <rpc.h>
#include "common.h"
#include "FileRepClient.h"

Go to the source code of this file.

Functions

INT _cdecl | main (int argc, char **argv)
VOID __RPC_FAR *__RPC_API | midl_user_allocate (size_t len)
VOID __RPC_API | midl_user_free (VOID __RPC_FAR *ptr)
void | PrintUsage (TCHAR *ProgName)

Function Documentation

INT _cdecl main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 76 of file filerep.cpp.

                                       {

    INT i;
    RPC_STATUS rpcstatus;

    // Controlls printing out of messages.
    BOOL bDebug = FALSE;

    // Explicit binding handle to the client system service.
    handle_t hFileRepClient = NULL;

    // These are the default values for extablishing connections.
    // Default connection is to a local server over local rpc.
    LPTSTR pszProtocolSequence = TEXT("ncalrpc");
    LPTSTR pszNetworkAddress = NULL;

    // An empty endpoint string is used, since we are going to
    // connect to the endpoint dynamically generated by the
    // RPC run-time library.  Server calls RpcServerUseProtseq to
    // obtain a binding hadnle and a dynamic endpoint.
    LPTSTR pszEndpoint = TEXT("");

    LPTSTR pszUuid = NULL;
    LPTSTR pszOptions = NULL;
    LPTSTR pszStringBinding = NULL;

    LPTSTR ServerName = NULL;
    LPTSTR RemoteFileName = NULL;
    LPTSTR LocalFileName = NULL;

    INT nNumArgs;

    // Get a common handle on the command line arguments for both
    // UNICODE and ASCII
#ifdef _UNICODE
    LPWSTR *szArgList = CommandLineToArgvW(GetCommandLine(), &nNumArgs);
    if (NULL == szArgList) {
        _tprintf(TEXT("FileRep main: CommandLineToArgW failed"));
        exit(EXIT_FAILURE);
    }
#else
    char **szArgList = argv;
    nNumArgs = argc;
#endif

    // Check that the correct number of arguments is given.
    if(nNumArgs<4){
        PrintUsage(szArgList[0]);
        exit(EXIT_FAILURE);
    }

    // Extract the required arguments.
    ServerName = szArgList[1];
    RemoteFileName = szArgList[2];
    LocalFileName = szArgList[3];

    // Allow the user to override settings with command line switches.
    for (i = 4; i < nNumArgs; i++) {
        // Well-formed argument switches start with '/' or '-' and are
        // two characters long.
        if (((*szArgList[i] == TEXT('-')) || (*szArgList[i] == TEXT('/'))) && _tcsclen(szArgList[i]) == 2) {

            switch (_totlower(*(szArgList[i]+1))) {

                case TEXT('p'):

              // Override protocol sequence.

              // Check that the next argument exists and is not a
              // switch.
                    if(i+1 < nNumArgs && *szArgList[i+1] != TEXT('-') && *szArgList[i+1] != TEXT('/')) {
                  pszProtocolSequence = szArgList[++i];
                    }
              // Otherwise we have an empty protocol sequence.
              else {
            // We do not allow an empty protocol sequence.
            _tprintf(TEXT("Protocol sequence can't be \"\".\n"));
                        exit(EXIT_FAILURE);
              }

        break;

                case TEXT('n'):

        // Override the network address.
        if(i+1 < nNumArgs && *szArgList[i+1] != TEXT('-') && *szArgList[i+1] != TEXT('/')) {
      pszNetworkAddress = szArgList[++i];
        }
        else {
      pszNetworkAddress = TEXT("");
        }

        break;

          case TEXT('e'):

        // Override the endpoint.
        if(i+1 < nNumArgs && *szArgList[i+1] != TEXT('-') && *szArgList[i+1] != TEXT('/')) {
      pszEndpoint = szArgList[++i];
        }
        else {
      pszEndpoint = TEXT("");
        }

        break;

                case TEXT('d'):
        // Turn on debugging.
        bDebug = TRUE;
        break;

                case TEXT('h'):
                case TEXT('?'):
                default:
        PrintUsage(szArgList[0]);
        exit(EXIT_SUCCESS);
            }
        }
        else {
            PrintUsage(szArgList[0]);
            exit(EXIT_FAILURE);
        }
    }

    // Concatenate the elements of
    // the string binding into the proper sequence.
    rpcstatus = RpcStringBindingCompose(pszUuid,
             pszProtocolSequence,
             pszNetworkAddress,
             pszEndpoint,
             pszOptions,
             &pszStringBinding);
    if(bDebug){
        _tprintf(TEXT("RpcStringBindingCompose returned 0x%x\n"), rpcstatus);
        _tprintf(TEXT("pszStringBinding = %s\n"), pszStringBinding);
    }
    EXIT_IF_FAIL(rpcstatus, "RpcStringBindingCompose");

    // Set the binding handle that will be used to bind to the server.
    rpcstatus = RpcBindingFromStringBinding(pszStringBinding, &hFileRepClient);
    if(bDebug) _tprintf(TEXT("RpcBindingFromStringBinding returned 0x%x\n"), rpcstatus);
    EXIT_IF_FAIL(rpcstatus, "RpcBindingFromStringBinding");

    // Free the binding string.
    rpcstatus = RpcStringFree(&pszStringBinding);
    ASSERTE(rpcstatus == RPC_S_OK);

    // Make the RPC to request file replication.
    RpcTryExcept {
        if(bDebug) _tprintf(TEXT("Calling the remote procedure RequestFile(hFileRepClient, %s, %s, %s)\n"), ServerName, RemoteFileName, LocalFileName);
        RequestFile(hFileRepClient, ServerName, RemoteFileName, LocalFileName);

        if(bDebug) _tprintf(TEXT("RequestFile() finished\n"));
    }
    // Return "non-fatal" errors.  Catching fatal errors
    // makes it harder to debug.
    RpcExcept ( ( (RpcExceptionCode() != STATUS_ACCESS_VIOLATION) &&
      (RpcExceptionCode() != STATUS_DATATYPE_MISALIGNMENT) &&
      (RpcExceptionCode() != STATUS_PRIVILEGED_INSTRUCTION) &&
      (RpcExceptionCode() != STATUS_ILLEGAL_INSTRUCTION) &&
      (RpcExceptionCode() != STATUS_BREAKPOINT))
      ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH ) {

        _tprintf(TEXT("Exception: RequestFile failed with code %d\n"), GetExceptionCode());
        exit(EXIT_FAILURE);
    }
    RpcEndExcept;

    // Free the binding.
    rpcstatus = RpcBindingFree((VOID **)&hFileRepClient);
    ASSERTE(rpcstatus == RPC_S_OK);

    if(bDebug) _tprintf(TEXT("Success!\n"));

    return(EXIT_SUCCESS);

} // end main()

VOID __RPC_FAR* __RPC_API midl_user_allocate ( size_t len )

Definition at line 258 of file filerep.cpp.

                                                          {
    return(AutoHeapAlloc(len));
}

VOID __RPC_API midl_user_free ( VOID __RPC_FAR * ptr )

Definition at line 262 of file filerep.cpp.

                                                    {
    if(ptr != NULL) {
        AutoHeapFree(ptr);
    }
}

void PrintUsage ( TCHAR * ProgName )

Definition at line 50 of file filerep.cpp.

                                 {
    _tprintf(TEXT("%s - File Replication Client Utility\n\n"), ProgName);
    _tprintf(TEXT("Usage: %s [server name] [remote file] [local file] <options...> \n\n"), ProgName);
    _tprintf(TEXT("Options:\n"));
    _tprintf(TEXT(" -p protocol_sequence\n"));
    _tprintf(TEXT(" -n network_address\n"));
    _tprintf(TEXT(" -e endpoint\n"));
    _tprintf(TEXT(" -d print messages\n"));
}

Generated on Wed Nov 13 2024 16:53:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/filerepsimple/filerepclient.idl File Reference

  • NetDS
  • RPC
  • FileRep
  • filerepsimple
Classes

filerepclient.idl File Reference

Go to the source code of this file.

Classes

interface FileRepClient
Generated on Wed Nov 13 2024 16:53:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/filerepsimple/filerepclientproc.cpp File Reference

  • NetDS
  • RPC
  • FileRep
  • filerepsimple
Classes | Functions

filerepclientproc.cpp File Reference

#include <stdlib.h>
#include <stdio.h>
#include <tchar.h>
#include "common.h"
#include "FileRepClient.h"
#include "FileRepServer.h"
#include "Service.h"

Go to the source code of this file.

Classes

struct | ThreadArgs

Functions

VOID | RequestFile (handle_t hFileRepClient, LPTSTR ServerName, LPTSTR RemoteFileName, LPTSTR LocalFileName)
VOID | ShutdownThread (ThreadArgs *pArgs)
void | ThreadProcRequest (ThreadArgs *pArgs)

Function Documentation

VOID RequestFile | ( | handle_t | hFileRepClient,
 |  | LPTSTR | ServerName,
 |  | LPTSTR | RemoteFileName,
 |  | LPTSTR | LocalFileName
 | ) |  |

Definition at line 184 of file filerepclientproc.cpp.

{
    INT status;
    RPC_STATUS rpcstatus;

    ULONG cbRead, cbWritten;

    // Default connection to server system service is over TCP/IP.
    LPTSTR DefaultProtocolSequence = TEXT("ncacn_ip_tcp");

    // An empty endpoint string is used, since we are going to
    // connect to the endpoint dynamically generated by the
    // RPC run-time library.    Server calls RpcServerUseProtseq to
    // obtain a binding hadnle and a dynamic endpoint.
    LPTSTR DefaultEndpoint = TEXT("");

    LPTSTR pszUuid = NULL;
    LPTSTR pszOptions = NULL;
    LPTSTR pszStringBinding = NULL;

    ULONG ThreadIdentifier;
    HANDLE hThread;

    ThreadArgs *pArgs = NULL;

    if((pArgs = (ThreadArgs *) AutoHeapAlloc(sizeof(ThreadArgs))) == NULL) {
        RpcRaiseException(ERROR_OUTOFMEMORY);
        return;
    }

    // Set pArgs' fields to NULL so that we will know
    // in ShutdownThread which ones have been initialized.
    pArgs->hFileRepServer = NULL;
    pArgs->hLocalFile = NULL;
    pArgs->phContext = NULL;

#ifdef PROF
    static ULONG nTotalId;

    if (WaitForSingleObject(hProfMutex, INFINITE) == WAIT_FAILED) {
  RaiseException(GetLastError(), 0, 0, NULL);
  return;
    }

    // Record the number of the current request.
    pArgs->nReqId = nTotalId;
    // Increment the number of the request.
    nTotalId++;

    if (ReleaseMutex(hProfMutex) == FALSE) {
  RaiseException(GetLastError(), 0, 0, NULL);
  return;
    }

    TCHAR ProfMsg[MAX_PATH+16];
    _stprintf(ProfMsg, TEXT("name=\"%s\" arrived"), RemoteFileName);

    // Record the time of arrival of this request.
    ProfRecordTime(pArgs->nReqId, ProfMsg);
#endif

    // Prepare the binding information.
    if ((rpcstatus = RpcStringBindingCompose(pszUuid,
               DefaultProtocolSequence,
               ServerName,
               DefaultEndpoint,
               pszOptions,
               &pszStringBinding)) != RPC_S_OK) {

  ShutdownThread(pArgs);
        RpcRaiseException(rpcstatus);
  return;
    }

    if ((rpcstatus = RpcBindingFromStringBinding(pszStringBinding, &(pArgs->hFileRepServer))) != RPC_S_OK) {
  // The binding handle is invalid
  pArgs->hFileRepServer = NULL;

  ShutdownThread(pArgs);
        RpcRaiseException(rpcstatus);
  return;
    }

    // We need to delete the string binding, since it is no longer
    // necessary.  All the binding information is now contained in the
    // binding handle.
    rpcstatus = RpcStringFree(&pszStringBinding);
    ASSERTE(rpcstatus == RPC_S_OK);

    // We did not read anything yet.
    cbRead = 0;

#ifdef RETRY_EXCEPTION
    // When making aggressive calls to the server, this flag is
    // set when the call succeeded.  This makes the client service attempt
    // to contact the server even after an exception occured.
    BOOL bRetryCall = TRUE;
    while (bRetryCall) {
#endif

    // Attempt to open the remote file.
    RpcTryExcept {
        c_RemoteOpen(pArgs->hFileRepServer,
         &(pArgs->phContext),
         RemoteFileName,
         pArgs->pbBuf,
         &cbRead);

#ifdef RETRY_EXCEPTION
  bRetryCall = FALSE;
#endif

    }
    RpcExcept ( ( (RpcExceptionCode() != STATUS_ACCESS_VIOLATION) &&
      (RpcExceptionCode() != STATUS_DATATYPE_MISALIGNMENT) &&
      (RpcExceptionCode() != STATUS_PRIVILEGED_INSTRUCTION) &&
      (RpcExceptionCode() != STATUS_ILLEGAL_INSTRUCTION) &&
      (RpcExceptionCode() != STATUS_BREAKPOINT) )
      ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH ) {

#ifdef RETRY_EXCEPTION
  // This code attempts to make aggressive calls, retrying
  // if no endpoints are available.  It is used to put servers
  // under stress.
  if (RpcExceptionCode() != EPT_S_NOT_REGISTERED &&
      RpcExceptionCode() != RPC_S_SERVER_UNAVAILABLE) {
#endif
  ShutdownThread(pArgs);
        RpcRaiseException(RPC_S_CALL_FAILED);
  return;
#ifdef RETRY_EXCEPTION
        }
#endif
    }
    RpcEndExcept;

#ifdef RETRY_EXCEPTION
    }
#endif

    // Attempt to open the local file.
    if ((pArgs->hLocalFile = CreateFile(LocalFileName,
          GENERIC_WRITE,
          0,
          NULL,
          CREATE_ALWAYS,
          FILE_ATTRIBUTE_NORMAL,
          NULL)) == INVALID_HANDLE_VALUE) {
  ShutdownThread(pArgs);
        RpcRaiseException(GetLastError());
  return;
    }

    // Write the data received to local file.
    if(!WriteFile(pArgs->hLocalFile,
      pArgs->pbBuf,
      cbRead,
      &cbWritten,
      NULL)){

  ShutdownThread(pArgs);
        RpcRaiseException(GetLastError());
        return;
    }

    // If there are no errors and the call returned NULL, then
    // the file was read in a single call and has already been closed.
    // We just need to write the buffer and return.
    if(pArgs->phContext == NULL){

#ifdef PROF
  ProfRecordTime(pArgs->nReqId, TEXT("handled"));
#endif

  ShutdownThread(pArgs);
        return;
    }

    // We need to read and close the file on a different
    // thread so that the client replication utility can return.
    // The data will be transfered in the background.
    if((hThread = CreateThread(NULL,
             0,
             (LPTHREAD_START_ROUTINE) ThreadProcRequest,
             pArgs,
             0,
             &ThreadIdentifier)) == NULL) {

  ShutdownThread(pArgs);
        RpcRaiseException(GetLastError());
  return;
    }

    // Unless we close a handle to the thread, it will remain in the
    // system even after its execution has terminated.
    status = CloseHandle(hThread);
    ASSERTE(status != 0);

    // The memory will be freed and handles closed in ThreadProcRequest.

    return;
}

VOID ShutdownThread ( ThreadArgs * pArgs )

Definition at line 47 of file filerepclientproc.cpp.

                                       {
    INT status;
    RPC_STATUS rpcstatus;

    if(pArgs != NULL) {
  if(pArgs->hFileRepServer != NULL) {
      rpcstatus = RpcBindingFree(&(pArgs->hFileRepServer));
      ASSERTE(rpcstatus == RPC_S_OK);
  }
  // Check that hLocalFile has been initialized and that initialization
  // was successful.
  if(pArgs->hLocalFile != NULL && pArgs->hLocalFile != INVALID_HANDLE_VALUE) {
      status = CloseHandle(pArgs->hLocalFile);
      ASSERTE(status != 0);
  }
  if(pArgs->phContext != NULL) {
      RpcSsDestroyClientContext((VOID **)&pArgs->phContext);
  }
  AutoHeapFree(pArgs);
    }
}

void ThreadProcRequest ( ThreadArgs * pArgs )

Definition at line 82 of file filerepclientproc.cpp.

                                          {
    UINT i = 0;
    ULONG cbRead, cbWritten;

    TCHAR Msg[MSG_SIZE];

    // Get the remainder of text from the remote file.  When the
    // server returns a NULL context handle, the read has completed and
    // the file has been closed.
    do {

        // We did not read anything yet.
        cbRead = 0;

#ifdef RETRY_EXCEPTION
  // When making aggressive calls to the server, this flag is
  // set when the call succeeded.  This makes the client service attempt
  // to contact the server even after an exception occured.
  BOOL bRetryCall = TRUE;
  while (bRetryCall) {
#endif

        RpcTryExcept {
            c_RemoteRead(pArgs->hFileRepServer,
       &(pArgs->phContext),
       pArgs->pbBuf,
       &cbRead);

#ifdef RETRY_EXCEPTION
      bRetryCall = FALSE;
#endif

  }
        RpcExcept ( ( (RpcExceptionCode() != STATUS_ACCESS_VIOLATION) &&
          (RpcExceptionCode() != STATUS_DATATYPE_MISALIGNMENT) &&
          (RpcExceptionCode() != STATUS_PRIVILEGED_INSTRUCTION) &&
          (RpcExceptionCode() != STATUS_ILLEGAL_INSTRUCTION) &&
          (RpcExceptionCode() != STATUS_BREAKPOINT))
        ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH ) {

      // Log the error code as well as the error.
      // Msg is sufficiently large and can't overflow.
      _stprintf(Msg, TEXT("ThreadProcRequest: Exception: c_RemoteRead failed with code %d"), RpcExceptionCode());
      AddToMessageLog(Msg);

#ifdef RETRY_EXCEPTION
      // This code attempts to make aggressive calls, retrying
      // if no endpoints were available.  It is used to put servers
      // under stress.
      if (RpcExceptionCode() != EPT_S_NOT_REGISTERED &&
    RpcExceptionCode() != RPC_S_SERVER_UNAVAILABLE) {
#endif
      ShutdownThread(pArgs);
      return;
#ifdef RETRY_EXCEPTION
      }
#endif
  }
  RpcEndExcept;

#ifdef RETRY_EXCEPTION
  }
#endif

  if(!WriteFile(pArgs->hLocalFile,
          pArgs->pbBuf,
          cbRead,
          &cbWritten,
          NULL)) {

      _stprintf(Msg, TEXT("ThreadProcRequest: WriteFile failed with code %d"), GetLastError());
      AddToMessageLog(Msg);

      ShutdownThread(pArgs);
      return;
  }
    } while(pArgs->phContext != NULL);

#ifdef PROF
    ProfRecordTime(pArgs->nReqId, TEXT("handled"));
#endif

    ShutdownThread(pArgs);

    // After this procedure returns the replication request will have
    // been handled.
    return;
}

Generated on Wed Nov 13 2024 16:53:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/filerepsimple/filerepserver.cpp File Reference

  • NetDS
  • RPC
  • FileRep
  • filerepsimple
Functions | Variables

filerepserver.cpp File Reference

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <process.h>
#include <tchar.h>
#include <rpc.h>
#include "FileRepServer.h"
#include "FileRepClient.h"
#include "Service.h"
#include "common.h"

Go to the source code of this file.

Functions

INT _cdecl | main (int argc, char **argv)

Variables

ULONG | cMaxCallsExecute = RPC_C_LISTEN_MAX_CALLS_DEFAULT
ULONG | cMaxCallsListen = RPC_C_PROTSEQ_MAX_REQS_DEFAULT
ULONG | cMinimumThreads = 2
RPC_BINDING_VECTOR * | pBindingVector = NULL
LPTSTR ServerProtocolArray []
RPC_STATUS | status

Function Documentation

INT _cdecl main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 74 of file filerepserver.cpp.

                                       {

    unsigned int i;

    // Register the service interfaces.
    status = RpcServerRegisterIf(s_FileRepServer_v1_0_s_ifspec, NULL, NULL);
    if (status != RPC_S_OK){
        AddToMessageLog(TEXT("ServiceStart: RpcServerRegisterIf(s_FileRepServer_v1_0_s_ifspec, ...) failed\n"));
        exit(status);
    }
    status = RpcServerRegisterIf(FileRepClient_v1_0_s_ifspec, NULL, NULL);
    if (status != RPC_S_OK){
        AddToMessageLog(TEXT("ServiceStart: RpcServerRegisterIf(FileRepClient_v1_0_s_ifspec, ...) failed\n"));
        exit(status);
    }

    for (i = 0; i < sizeof(ServerProtocolArray)/sizeof(unsigned char *); i++) {

        // Use the protocol sequences specified in ProtocolArray
        // for receiving RPCs.
        status = RpcServerUseProtseq((_TUCHAR *)ServerProtocolArray[i], cMaxCallsListen, NULL);

        if (status != RPC_S_OK){
            AddToMessageLog(TEXT("ServiceStart: RpcServerUseProtseq failed\n"));
            exit(status);
        }
    }

    // Obtain a binding vector for the server.
    status = RpcServerInqBindings(&pBindingVector);
    if (status != RPC_S_OK) {
        AddToMessageLog(TEXT("ServiceStart: RpcServerInqBindings failed\n"));
        exit(status);
    }

    // Register the client and the server services in the endpoint map
    // of the host computer.
    status = RpcEpRegister(s_FileRepServer_v1_0_s_ifspec, pBindingVector, NULL, NULL);
    if (status != RPC_S_OK){
        AddToMessageLog(TEXT("ServiceStart: RpcEpRegister(s_FileRepServer_v1_0_s_ifspec, ...) failed\n"));
        exit(status);
    }
    status = RpcEpRegister(FileRepClient_v1_0_s_ifspec, pBindingVector, NULL, NULL);
    if (status != RPC_S_OK){
        AddToMessageLog(TEXT("ServiceStart: RpcEpRegister(FileRepClient_v1_0_s_ifspec, ...) failed\n"));
        exit(status);
    }

    // Create the heap to be used by midl_user_allocate and midl_user_free
    RpcHeap = HeapCreate(0, RPC_HEAP_SIZE_INIT, RPC_HEAP_SIZE_MAX);

#ifdef PROF
    ProfOpenLog(TEXT("FileRepService.prof"));
#endif

    // Start accepting client calls.
    // The last argument's being 1 indicates that RpcServerListen
    // should return immediately after completing function processing.
    status = RpcServerListen(cMinimumThreads, cMaxCallsExecute, 1);
    if (status != RPC_S_OK){
        AddToMessageLog(TEXT("ServiceStart: RpcServerListen failed\n"));
        exit(status);
    }

    // End of initialization

    // RpcMgmtWaitServerListen() will block until the server has
    // stopped listening.
    status = RpcMgmtWaitServerListen();
    if (status != RPC_S_OK){
        AddToMessageLog(TEXT("ServiceStart: RpcMgmtWaitServerListen failed"));
        exit(status);
    }

    // Cleanup

    // Delete the binding vector.
    status = RpcServerUnregisterIf(NULL, NULL, FALSE);
    if(status != RPC_S_OK){
        AddToMessageLog(TEXT("ServiceStart: RpcServerUnregisterIf failed"));
        exit(status);
    }

    return 0;
} // end main()

Variable Documentation

ULONG cMaxCallsExecute = RPC_C_LISTEN_MAX_CALLS_DEFAULT

Definition at line 49 of file filerepserver.cpp.

ULONG cMaxCallsListen = RPC_C_PROTSEQ_MAX_REQS_DEFAULT

Definition at line 46 of file filerepserver.cpp.

ULONG cMinimumThreads = 2

Definition at line 52 of file filerepserver.cpp.

RPC_BINDING_VECTOR* pBindingVector = NULL

Definition at line 54 of file filerepserver.cpp.

LPTSTR ServerProtocolArray[]
Initial value:
 { TEXT("ncacn_ip_tcp"),
         TEXT("ncalrpc") }

Definition at line 40 of file filerepserver.cpp.

RPC_STATUS status

Definition at line 57 of file filerepserver.cpp.

Generated on Wed Nov 13 2024 16:53:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/filerepsimple/filerepserver.idl File Reference

  • NetDS
  • RPC
  • FileRep
  • filerepsimple
Classes

filerepserver.idl File Reference

Go to the source code of this file.

Classes

interface FileRepServer
Generated on Wed Nov 13 2024 16:53:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/filerepsimple/filerepserverproc.cpp File Reference

  • NetDS
  • RPC
  • FileRep
  • filerepsimple
Classes | Functions

filerepserverproc.cpp File Reference

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "common.h"
#include "FileRepServer.h"
#include "Service.h"

Go to the source code of this file.

Classes

struct | FILE_CONTEXT_TYPE

Functions

void __RPC_USER | PCONTEXT_HANDLE_TYPE_rundown (PCONTEXT_HANDLE_TYPE phContext)
VOID | ReadData (HANDLE hFile, VOID *pbBuf, unsigned long nToRead, unsigned long *cbRead, BOOL *bEOF, BYTE *EOFCheck)
VOID | s_RemoteOpen (handle_t hFileRepServer, PCONTEXT_HANDLE_TYPE *pphContext, LPTSTR pszFileName, BYTE *pbBuf, unsigned long *cbRead)
VOID | s_RemoteRead (handle_t hFileRepServer, PCONTEXT_HANDLE_TYPE *pphContext, BYTE *pbBuf, unsigned long *cbRead)

Function Documentation

void __RPC_USER PCONTEXT_HANDLE_TYPE_rundown ( PCONTEXT_HANDLE_TYPE phContext )

Definition at line 231 of file filerepserverproc.cpp.

                                                                             {
    FILE_CONTEXT_TYPE *pFileContext;
    INT status;

    // We need to try and close the file associated with the
    // context handle...

    // Context handle can not be NULL in this section, so we can
    // go ahead and try closing the file.
    pFileContext = (FILE_CONTEXT_TYPE *) phContext;

    // Also, we do not need to worry about pFileContext->hFile's being
    // null since we checked for it when we opened the file.
    status = CloseHandle(pFileContext->hFile);
    ASSERTE(status != 0);

    // And then free the memory taken up by it.
    midl_user_free(phContext);
}

VOID ReadData | ( | HANDLE | hFile,
 |  | VOID * | pbBuf,
 |  | unsigned long | nToRead,
 |  | unsigned long * | cbRead,
 |  | BOOL * | bEOF,
 |  | BYTE * | EOFCheck
 | ) |  |

Definition at line 48 of file filerepserverproc.cpp.

                                                                                {

    if(!ReadFile(hFile, pbBuf, nToRead+1, cbRead, NULL)) {

  // We want to raise an exception but leave the context intact
  // so that subsequent reads may be attempted.

  RpcRaiseException(GetLastError());
        return;
    }

    // Check for EOF.
    *bEOF = FALSE;
    // If we read in the whole buffer, save the last byte.
    if(*cbRead == nToRead+1) {
  *EOFCheck = ((BYTE *)pbBuf)[(nToRead+1)-1];

  // return at most nToRead read bytes.
  *cbRead = nToRead;
    }
    // If we did not read the whole buffer then we reached the EOF.
    else{
  *bEOF = TRUE;
    }
}

VOID s_RemoteOpen | ( | handle_t | hFileRepServer,
 |  | PCONTEXT_HANDLE_TYPE * | pphContext,
 |  | LPTSTR | pszFileName,
 |  | BYTE * | pbBuf,
 |  | unsigned long * | cbRead
 | ) |  |

Definition at line 91 of file filerepserverproc.cpp.

{
    HANDLE hFile;
    FILE_CONTEXT_TYPE *pFileContext;
    BOOL bEOF = FALSE;
    BYTE EOFCheck;
    INT status;

    if ((hFile = CreateFile(pszFileName,
          GENERIC_READ,
          FILE_SHARE_READ,
          NULL,
          OPEN_EXISTING,
          FILE_ATTRIBUTE_NORMAL,
          NULL)) == INVALID_HANDLE_VALUE) {

  RpcRaiseException(GetLastError());

        return;
    }

    // Read data from file into the buffer.
    // This function may throw exceptions, but we would want
    // those to propagate out.
    ReadData(hFile, (VOID *)pbBuf, OPEN_BUFSIZE, cbRead, &bEOF, &EOFCheck);

    // Check if EOF has been reached.
    if(bEOF) {
  // If it has, we can simply return.

  // Since all of the read has completed, the [out] context handle
  // pointer is NULL.
  pFileContext = NULL;
  *pphContext = (PCONTEXT_HANDLE_TYPE) pFileContext;

  status = CloseHandle(hFile);
  ASSERTE(status != 0);

  return;
    }
    else {
  // Otherwise we need to allocate, initialize, and return the
  // context handle.  Actually, we do not have to explicitly
  // allocate it if we do not want to.
  if((pFileContext = (FILE_CONTEXT_TYPE *) midl_user_allocate(sizeof(FILE_CONTEXT_TYPE))) == NULL) {

      status = CloseHandle(hFile);
      ASSERTE(status != 0);
      RpcRaiseException(ERROR_OUTOFMEMORY);
      return;
  }

  // Initialize the context handle fields.
  pFileContext->hFile = hFile;

  pFileContext->EOFCheck = EOFCheck;

  *pphContext = (PCONTEXT_HANDLE_TYPE) pFileContext;

  return;
    }
}

VOID s_RemoteRead | ( | handle_t | hFileRepServer,
 |  | PCONTEXT_HANDLE_TYPE * | pphContext,
 |  | BYTE * | pbBuf,
 |  | unsigned long * | cbRead
 | ) |  |

Definition at line 174 of file filerepserverproc.cpp.

{
    FILE_CONTEXT_TYPE *pFileContext;
    BOOL bEOF = FALSE;
    BYTE EOFCheck;
    INT status;

    // Make sure that the provided context handle is not NULL.
    if(*pphContext == NULL) {

  RpcRaiseException(RPC_X_SS_IN_NULL_CONTEXT);
        return;
    }

    pFileContext = (FILE_CONTEXT_TYPE *) *pphContext;

    // Remember that we have a byte left over from RemoteOpen EOF check.
    pbBuf[0] = pFileContext->EOFCheck;

    // Read the following bytes from file, but remember that we now only
    // have space for READ_BUFSIZE-1 bytes and we write starting
    // from the 1st index.  We will let possible exceptions propagate out.
    ReadData(pFileContext->hFile, (VOID *)&(pbBuf[1]), READ_BUFSIZE-1, cbRead, &bEOF, &EOFCheck);

    // Since we had the first byte left over from the previous read, pretend
    // that we read it.
    (*cbRead)++;

    if(bEOF){
        // If it has, we can destroy the context handle, close
        // the file and return.
  status = CloseHandle(pFileContext->hFile);
        ASSERTE(status != 0);

  midl_user_free(*pphContext);

  // Return NULL context handle to signify that the file has
  // been completely read.
  pFileContext = NULL;
  *pphContext = (PCONTEXT_HANDLE_TYPE) pFileContext;

  return;
    }

    // Memorize the last byte read for the next read.
    pFileContext->EOFCheck = EOFCheck;

    // Otherwise we just return the number of symbols read in cbRead.
    return;
}

Generated on Wed Nov 13 2024 16:53:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/filerepsimple/filerepservice.cpp File Reference

  • NetDS
  • RPC
  • FileRep
  • filerepsimple
Functions | Variables

filerepservice.cpp File Reference

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <process.h>
#include <tchar.h>
#include <rpc.h>
#include "FileRepServer.h"
#include "FileRepClient.h"
#include "Service.h"
#include "common.h"

Go to the source code of this file.

Functions

VOID _cdecl | main (int argc, char **argv)
VOID WINAPI | ServiceCtrl (DWORD Opcode)
VOID WINAPI | ServiceMain (DWORD dwArgc, LPTSTR *lpszArgv)
VOID | ServiceStart (DWORD dwArgc, LPTSTR *lpszArgv)
VOID | ServiceStop ()

Variables

ULONG | cMaxCallsExecute = RPC_C_LISTEN_MAX_CALLS_DEFAULT
ULONG | cMaxCallsListen = RPC_C_PROTSEQ_MAX_REQS_DEFAULT
ULONG | cMinimumThreads = 2
RPC_BINDING_VECTOR * | pBindingVector = NULL
LPTSTR ServerProtocolArray []
SERVICE_STATUS_HANDLE | sshStatusHandle
SERVICE_STATUS | ssStatus
RPC_STATUS | status

Function Documentation

VOID _cdecl main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 81 of file filerepservice.cpp.

                                       {

    // Since we provide a single service there is only
    // one entry in the service dispatch table
    SERVICE_TABLE_ENTRY DispatchTable[] = {
        { TEXT(SERVICENAME), (LPSERVICE_MAIN_FUNCTION)ServiceMain },
        { NULL, NULL }
    };

    // The service control manager may be starting the service with
    // this call, so we must call StartServiceCtrlDispatcher.
    if (!StartServiceCtrlDispatcher(DispatchTable)) {
        AddToMessageLog(TEXT("StartServiceCtrlDispatcher failed"));
    }
}

VOID WINAPI ServiceCtrl ( DWORD Opcode )

Definition at line 155 of file filerepservice.cpp.

                                      {

    // We only handle the STOP control requsts.
    switch(Opcode) {

        case SERVICE_CONTROL_STOP:
            // Stop the service.
            ServiceStop();
      break;

        default:
      AddToMessageLog(TEXT("ServiceCtrl: unrecognized or unimplemented opcode\n"));
    }

    return;
}

VOID WINAPI ServiceMain | ( | DWORD | dwArgc,
 |  | LPTSTR * | lpszArgv
 | ) |  |

Definition at line 115 of file filerepservice.cpp.

                                                        {

    // Initial service configuration
    ssStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
    ssStatus.dwCurrentState = SERVICE_START_PENDING;
    ssStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP;
    ssStatus.dwWin32ExitCode = 0;
    ssStatus.dwServiceSpecificExitCode = 0;
    ssStatus.dwCheckPoint = 0;
    ssStatus.dwWaitHint = 0;

    sshStatusHandle = RegisterServiceCtrlHandler(TEXT(SERVICENAME), ServiceCtrl);

    // Tell the SCM that the service is starting up.
    if (!SetServiceStatus(sshStatusHandle, &ssStatus)) {
        AddToMessageLog(TEXT("ServiceMain: SetServiceStatus failed\n"));
        return;
    }

    // Initialize the service and start it.
    ServiceStart(dwArgc, lpszArgv);

    return;
}

VOID ServiceStart | ( | DWORD | dwArgc,
 |  | LPTSTR * | lpszArgv
 | ) |  |

Definition at line 215 of file filerepservice.cpp.

                                                  {

    unsigned int i;

    // Report the status to the service control manager.
    if (!ReportStatusToSCMgr(&sshStatusHandle, &ssStatus, SERVICE_START_PENDING, NO_ERROR, 1000)) {
        AddToMessageLog(TEXT("ReportStatusToSCMgr failed\n"));
  ServiceStop();
        return;
    }

    // Service initialization

    // Register the service interfaces.
    status = RpcServerRegisterIf(s_FileRepServer_v1_0_s_ifspec, NULL, NULL);
    if (status != RPC_S_OK){
        AddToMessageLog(TEXT("ServiceStart: RpcServerRegisterIf(s_FileRepServer_v1_0_s_ifspec, ...) failed\n"));
  ServiceStop();
        return;
    }
    status = RpcServerRegisterIf(FileRepClient_v1_0_s_ifspec, NULL, NULL);
    if (status != RPC_S_OK){
        AddToMessageLog(TEXT("ServiceStart: RpcServerRegisterIf(FileRepClient_v1_0_s_ifspec, ...) failed\n"));
  ServiceStop();
        return;
    }

    for (i = 0; i < sizeof(ServerProtocolArray)/sizeof(unsigned char *); i++) {

        // Use the protocol sequences specified in ProtocolArray
        // for receiving RPCs.
        status = RpcServerUseProtseq((_TUCHAR *)ServerProtocolArray[i], cMaxCallsListen, NULL);

        if (status != RPC_S_OK){
            AddToMessageLog(TEXT("ServiceStart: RpcServerUseProtseq failed\n"));
      ServiceStop();
            return;
        }
    }

    // Obtain a binding vector for the server.
    status = RpcServerInqBindings(&pBindingVector);
    if (status != RPC_S_OK) {
        AddToMessageLog(TEXT("ServiceStart: RpcServerInqBindings failed\n"));
  ServiceStop();
        return;
    }

    // Register the client and the server services in the endpoint map
    // of the host computer.
    status = RpcEpRegister(s_FileRepServer_v1_0_s_ifspec, pBindingVector, NULL, NULL);
    if (status != RPC_S_OK){
        AddToMessageLog(TEXT("ServiceStart: RpcEpRegister(s_FileRepServer_v1_0_s_ifspec, ...) failed\n"));
  ServiceStop();
        return;
    }
    status = RpcEpRegister(FileRepClient_v1_0_s_ifspec, pBindingVector, NULL, NULL);
    if (status != RPC_S_OK){
        AddToMessageLog(TEXT("ServiceStart: RpcEpRegister(FileRepClient_v1_0_s_ifspec, ...) failed\n"));
  ServiceStop();
        return;
    }

    // Create the heap to be used by midl_user_allocate and midl_user_free
    RpcHeap = HeapCreate(0, RPC_HEAP_SIZE_INIT, RPC_HEAP_SIZE_MAX);

#ifdef PROF
    ProfOpenLog(TEXT("FileRepService.prof"));
#endif

    // Start accepting client calls.
    // The last argument's being 1 indicates that RpcServerListen
    // should return immediately after completing function processing.
    status = RpcServerListen(cMinimumThreads, cMaxCallsExecute, 1);
    if (status != RPC_S_OK){
        AddToMessageLog(TEXT("ServiceStart: RpcServerListen failed\n"));
  ServiceStop();
        return;
    }

    // Tell The SCM that the service is running.
    if (!ReportStatusToSCMgr(&sshStatusHandle, &ssStatus, SERVICE_RUNNING, NO_ERROR, 0)){
        AddToMessageLog(TEXT("ServiceStart: ReportStatusToSCMgr failed"));
  ServiceStop();
        return;
    }

    // End of initialization

    // RpcMgmtWaitServerListen() will block until the server has
    // stopped listening.
    status = RpcMgmtWaitServerListen();
    if (status != RPC_S_OK){
        AddToMessageLog(TEXT("ServiceStart: RpcMgmtWaitServerListen failed"));
  ServiceStop();
        return;
    }

    // Cleanup

    // Delete the binding vector.
    status = RpcServerUnregisterIf(NULL, NULL, FALSE);
    if(status != RPC_S_OK){
        AddToMessageLog(TEXT("ServiceStart: RpcServerUnregisterIf failed"));
        return;
    }

    return;
}

VOID ServiceStop ( )

Definition at line 340 of file filerepservice.cpp.

                   {
    RPC_STATUS status;

    // Stops the server, wakes up the main thread.
    status = RpcMgmtStopServerListening(NULL);
    if(status != RPC_S_OK) {
        AddToMessageLog(TEXT("ServiceStop: RpcMgmtStopServerListening failed."));
        return;
    }

    // Tell The SCM that the service is stopped.
    if(!ReportStatusToSCMgr(&sshStatusHandle, &ssStatus, SERVICE_STOPPED, NO_ERROR, 0)) {
        AddToMessageLog(TEXT("ServiceStop: ReportStatusToSCMgr failed"));
        return;
    }

#ifdef PROF
    ProfCloseLog();
#endif

}

Variable Documentation

ULONG cMaxCallsExecute = RPC_C_LISTEN_MAX_CALLS_DEFAULT

Definition at line 189 of file filerepservice.cpp.

ULONG cMaxCallsListen = RPC_C_PROTSEQ_MAX_REQS_DEFAULT

Definition at line 186 of file filerepservice.cpp.

ULONG cMinimumThreads = 2

Definition at line 192 of file filerepservice.cpp.

RPC_BINDING_VECTOR* pBindingVector = NULL

Definition at line 194 of file filerepservice.cpp.

LPTSTR ServerProtocolArray[]
Initial value:
 { TEXT("ncacn_ip_tcp"),
         TEXT("ncalrpc") }

Definition at line 180 of file filerepservice.cpp.

SERVICE_STATUS_HANDLE sshStatusHandle

Definition at line 60 of file filerepservice.cpp.

SERVICE_STATUS ssStatus

Definition at line 63 of file filerepservice.cpp.

RPC_STATUS status

Definition at line 197 of file filerepservice.cpp.

Generated on Wed Nov 13 2024 16:53:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/filerepsimple/prof.cpp File Reference

  • NetDS
  • RPC
  • FileRep
  • filerepsimple
Defines | Functions | Variables

prof.cpp File Reference

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <process.h>
#include <tchar.h>
#include "Prof.h"
#include "Service.h"
#include "common.h"

Go to the source code of this file.

Defines

#define | MAX_ENTRY_SIZE_NOMSG (32)

Functions

VOID | ProfCloseLog (VOID)
VOID | ProfOpenLog (LPTSTR LogFileName)
VOID | ProfRecordTime (UINT id, LPTSTR msg)

Variables

HANDLE | hProfLog = NULL
HANDLE hProfMutex
LARGE_INTEGER | lpCurrentTime
LARGE_INTEGER | lpFrequency
LARGE_INTEGER | lpStartTime
UINT | nProfLogSize = 0
TCHAR | PROF_LOG [PROF_LOG_MAX_SIZE]

Define Documentation

#define MAX_ENTRY_SIZE_NOMSG (32)

Definition at line 50 of file prof.cpp.

Function Documentation

VOID ProfCloseLog ( VOID )

Definition at line 118 of file prof.cpp.

                        {
    ULONG cbWritten;
    DWORD status;

    // Close the mutex.
    // Here we make the assumption that no outside functions will use
    // the mutex anymore.  This should be valid, since all the profiling data
    // has been written.
    status = CloseHandle(hProfMutex);
    ASSERTE(status);

    // Write out the profile log.
    if(!WriteFile(hProfLog,
      (LPVOID)PROF_LOG,
      nProfLogSize*sizeof(TCHAR),
      &cbWritten,
      NULL)) {

  RaiseException(GetLastError(), 0, 0, NULL);
  return;
    }

    // Close the profile log.
    if (hProfLog != NULL && hProfLog != INVALID_HANDLE_VALUE) {
        status = CloseHandle(hProfLog);
        ASSERTE(status);
    }
}

VOID ProfOpenLog ( LPTSTR LogFileName )

Definition at line 54 of file prof.cpp.

                                     {

    // Create the mutex.
    if ((hProfMutex = CreateMutex(NULL,
          FALSE,
          TEXT("ProfMutex"))) == INVALID_HANDLE_VALUE) {
  RaiseException(GetLastError(), 0, 0, NULL);
        return;
    }

    // Open the profiling log.
    if ((hProfLog = CreateFile(LogFileName,
             GENERIC_WRITE,
             0,
             NULL,
             CREATE_ALWAYS,
             FILE_ATTRIBUTE_NORMAL,
             NULL)) == INVALID_HANDLE_VALUE) {
  RaiseException(GetLastError(), 0, 0, NULL);
        return;
    }

    // Get the current time.
    if (QueryPerformanceCounter(&lpStartTime) == FALSE) {
  RaiseException(GetLastError(), 0, 0, NULL);
        return;
    }

    // Get the frequency.
    if (QueryPerformanceFrequency(&lpFrequency) == FALSE) {
  RaiseException(GetLastError(), 0, 0, NULL);
        return;
    }
}

VOID ProfRecordTime | ( | UINT | id,
 |  | LPTSTR | msg
 | ) |  |

Definition at line 89 of file prof.cpp.

                                         {
    FLOAT dt;

    if (WaitForSingleObject(hProfMutex, INFINITE) == WAIT_FAILED) {
  RaiseException(GetLastError(), 0, 0, NULL);
  return;
    }

    // Write the entry only if there is enough space left in
    // the log.
    if (nProfLogSize < PROF_LOG_MAX_SIZE - (MAX_ENTRY_SIZE_NOMSG + _tcslen(msg))) {
  if (QueryPerformanceCounter(&lpCurrentTime) == FALSE) {
      RaiseException(GetLastError(), 0, 0, NULL);
      return;
  }

  // Get the time stamp for the event.
  dt = (FLOAT)(lpCurrentTime.QuadPart - lpStartTime.QuadPart)/(FLOAT)(lpFrequency.QuadPart);

  // Append the entry to the log.
  nProfLogSize+=_stprintf(&PROF_LOG[nProfLogSize], TEXT("%d %s %f\n"), id, msg, dt);
    }

    if (ReleaseMutex(hProfMutex) == FALSE) {
  RaiseException(GetLastError(), 0, 0, NULL);
  return;
    }
}

Variable Documentation

HANDLE hProfLog = NULL

Definition at line 34 of file prof.cpp.

HANDLE hProfMutex

Definition at line 52 of file prof.cpp.

LARGE_INTEGER lpCurrentTime

Definition at line 37 of file prof.cpp.

LARGE_INTEGER lpFrequency

Definition at line 37 of file prof.cpp.

LARGE_INTEGER lpStartTime

Definition at line 37 of file prof.cpp.

UINT nProfLogSize = 0

Definition at line 45 of file prof.cpp.

TCHAR PROF_LOG[PROF_LOG_MAX_SIZE]

Definition at line 42 of file prof.cpp.

Generated on Wed Nov 13 2024 16:53:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/filerepsimple/prof.h File Reference

  • NetDS
  • RPC
  • FileRep
  • filerepsimple
Defines | Functions | Variables

prof.h File Reference

Go to the source code of this file.

Defines

#define | PROF_LOG_MAX_SIZE (10*1024*1024)

Functions

VOID | ProfCloseLog (VOID)
VOID | ProfOpenLog (LPTSTR LogFileName)
VOID | ProfRecordTime (UINT id, LPTSTR msg)

Variables

HANDLE hProfMutex

Define Documentation

#define PROF_LOG_MAX_SIZE (10*1024*1024)

Definition at line 25 of file prof.h.

Function Documentation

VOID ProfCloseLog ( VOID )

Definition at line 108 of file Prof.cpp.

                        {
    ULONG cbWritten;
    DWORD status;

    // Delete the critsec.
    // Here we make the assumption that no outside functions will use
    // the critsec anymore.  This should be valid, since all the profiling data
    // has been written.
    // Also we make an assumption that only one thread will attempt
    // to close the profile log.  This should be valid as well, or the
    // user can inmplement a semaphore to take care of that.
    DeleteCriticalSection(&ProfCriticalSection);

    // Write out the profile log.
    if(!WriteFile(hProfLog,
                  (LPVOID)PROF_LOG,
                  nProfLogSize*sizeof(TCHAR),
                  &cbWritten,
                  NULL)) {

        AddToMessageLogProcFailure(TEXT("ProfCloseLog: WriteFile"), GetLastError());
        return;
    }

    // Close the profile log.
    if (hProfLog != NULL && hProfLog != INVALID_HANDLE_VALUE) {
        status = CloseHandle(hProfLog);
        ASSERT(status);
    }
}

VOID ProfOpenLog ( LPTSTR LogFileName )

Definition at line 51 of file Prof.cpp.

                                     {

    // Init the critsec.
    if (InitializeCriticalSectionAndSpinCount(&ProfCriticalSection, 0) == 0) {
        AddToMessageLogProcFailure(TEXT("ProfOpenLog: InitializeCriticalSectionAndSpinCount"), GetLastError());
        return;
    }

    // Open the profiling log.
    if ((hProfLog = CreateFile(LogFileName,
                               GENERIC_WRITE,
                               0,
                               NULL,
                               CREATE_ALWAYS,
                               FILE_ATTRIBUTE_NORMAL,
                               NULL)) == INVALID_HANDLE_VALUE) {
        AddToMessageLogProcFailure(TEXT("ProfOpenLog: CreateFile"), GetLastError());
        return;
    }

    // Get the current time.
    if (QueryPerformanceCounter(&lpStartTime) == FALSE) {
        AddToMessageLogProcFailure(TEXT("ProfOpenLog: QueryPerformanceCounter"), GetLastError());
        return;
    }

    // Get the frequency.
    if (QueryPerformanceFrequency(&lpFrequency) == FALSE) {
        AddToMessageLogProcFailure(TEXT("ProfOpenLog: QueryPerformanceCounter"), GetLastError());
        return;
    }
}

VOID ProfRecordTime | ( | UINT | id,
 |  | LPTSTR | msg
 | ) |  |

Definition at line 84 of file Prof.cpp.

                                         {
    FLOAT dt;

    EnterCriticalSection(&ProfCriticalSection);

    // Write the entry only if there is enough space left in
    // the log.
    if (nProfLogSize < PROF_LOG_MAX_SIZE - (MAX_ENTRY_SIZE_NOMSG + _tcslen(msg))) {
        if (QueryPerformanceCounter(&lpCurrentTime) == FALSE) {
            AddToMessageLogProcFailure(TEXT("ProfRecordTime: QueryPerformanceCounter"), GetLastError());
            LeaveCriticalSection(&ProfCriticalSection);
            return;
        }

        // Get the time stamp for the event.
        dt = (FLOAT)(lpCurrentTime.QuadPart - lpStartTime.QuadPart)/(FLOAT)(lpFrequency.QuadPart);

        // Append the entry to the log.
        nProfLogSize+=_stprintf(&PROF_LOG[nProfLogSize], TEXT("%d %s %f\n"), id, msg, dt);
    }

    LeaveCriticalSection(&ProfCriticalSection);
}

Variable Documentation

HANDLE hProfMutex

Definition at line 52 of file prof.cpp.

Generated on Wed Nov 13 2024 16:53:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/filerepsimple/service.cpp File Reference

  • NetDS
  • RPC
  • FileRep
  • filerepsimple
Functions | Variables

service.cpp File Reference

#include <windows.h>
#include <stdio.h>
#include <tchar.h>
#include "common.h"
#include "Service.h"

Go to the source code of this file.

Functions

VOID | AddToMessageLog (LPTSTR lpszMsg)
VOID __RPC_FAR *__RPC_API | midl_user_allocate (size_t len)
VOID __RPC_API | midl_user_free (VOID __RPC_FAR *ptr)
BOOL | ReportStatusToSCMgr (SERVICE_STATUS_HANDLE *sshStatusHandle, SERVICE_STATUS *ssStatus, DWORD dwCurrentState, DWORD dwWin32ExitCode, DWORD dwWaitHint)

Variables

HANDLE RpcHeap

Function Documentation

VOID AddToMessageLog ( LPTSTR lpszMsg )

Definition at line 91 of file service.cpp.

                                    {
    TCHAR szMsg[256];
    HANDLE hEventSource;
    LPTSTR lpszStrings[2];
    DWORD dwErr = 0;

    dwErr = GetLastError();

    // Use event logging to log the error.
    hEventSource = RegisterEventSource(NULL, TEXT(SERVICENAME));

    _stprintf(szMsg, TEXT("%s error: %d"), TEXT(SERVICENAME), dwErr);
    lpszStrings[0] = szMsg;
    lpszStrings[1] = lpszMsg;

    if (hEventSource != NULL) {
        ReportEvent(hEventSource, // handle of event source
        EVENTLOG_ERROR_TYPE, // event type
        0, // event category
        0, // event ID
        NULL, // current user's SID
        2, // strings in lpszStrings
        0, // no bytes of raw data
        (LPCTSTR *) lpszStrings, // array of error strings
        NULL); // no raw data

        (VOID) DeregisterEventSource(hEventSource);
    }
}

VOID __RPC_FAR* __RPC_API midl_user_allocate ( size_t len )

Definition at line 128 of file service.cpp.

                                                          {
    return(HeapAlloc(RpcHeap, 0, len));
}

VOID __RPC_API midl_user_free ( VOID __RPC_FAR * ptr )

Definition at line 132 of file service.cpp.

                                                    {
    if(ptr != NULL) {
        HeapFree(RpcHeap, 0, ptr);
    }
}

BOOL ReportStatusToSCMgr | ( | SERVICE_STATUS_HANDLE * | sshStatusHandle,
 |  | SERVICE_STATUS * | ssStatus,
 |  | DWORD | dwCurrentState,
 |  | DWORD | dwWin32ExitCode,
 |  | DWORD | dwWaitHint
 | ) |  |

Definition at line 46 of file service.cpp.

                        {

    static DWORD dwCheckPoint = 1;
    BOOL fResult = TRUE;

    if (dwCurrentState == SERVICE_START_PENDING)
        ssStatus->dwControlsAccepted = 0;
    else
        ssStatus->dwControlsAccepted = SERVICE_ACCEPT_STOP;

    ssStatus->dwCurrentState = dwCurrentState;
    ssStatus->dwWin32ExitCode = dwWin32ExitCode;
    ssStatus->dwWaitHint = dwWaitHint;

    if ( ( dwCurrentState == SERVICE_RUNNING ) || ( dwCurrentState == SERVICE_STOPPED ) ) {
        ssStatus->dwCheckPoint = 0;
    }
    else {
        ssStatus->dwCheckPoint = dwCheckPoint++;
    }

    // Report the status of the service to the service control manager.
    if (!(fResult = SetServiceStatus(*sshStatusHandle, ssStatus))) {
        AddToMessageLog(TEXT("SetServiceStatus failed"));
    }
    return fResult;
}

Variable Documentation

HANDLE RpcHeap

Definition at line 122 of file service.cpp.

Generated on Wed Nov 13 2024 16:54:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/FileRep/filerepsimple/service.h File Reference

  • NetDS
  • RPC
  • FileRep
  • filerepsimple
Defines | Functions | Variables

service.h File Reference

Go to the source code of this file.

Defines

#define | APPNAME "FileRepService"
#define | DEPENDENCIES "RPCSS\0\0"
#define | RPC_HEAP_SIZE_INIT (1024*1024)
#define | RPC_HEAP_SIZE_MAX (128*1024*1024)
#define | SERVICEDISPLAYNAME "File Replication Service"
#define | SERVICENAME "FileRepService"

Functions

VOID | AddToMessageLog (LPTSTR lpszMsg)
BOOL | ReportStatusToSCMgr (SERVICE_STATUS_HANDLE *sshStatusHandle, SERVICE_STATUS *ssStatus, DWORD dwCurrentState, DWORD dwWin32ExitCode, DWORD dwWaitHint)

Variables

HANDLE RpcHeap

Define Documentation

#define APPNAME "FileRepService"

Definition at line 20 of file service.h.

#define DEPENDENCIES "RPCSS\0\0"

Definition at line 29 of file service.h.

#define RPC_HEAP_SIZE_INIT (1024*1024)

Definition at line 49 of file service.h.

#define RPC_HEAP_SIZE_MAX (128*1024*1024)

Definition at line 50 of file service.h.

#define SERVICEDISPLAYNAME "File Replication Service"

Definition at line 26 of file service.h.

#define SERVICENAME "FileRepService"

Definition at line 23 of file service.h.

Function Documentation

VOID AddToMessageLog ( LPTSTR lpszMsg )

Definition at line 598 of file Service.cpp.

                                    {
    TCHAR szMsg1[256];
    HANDLE hEventSource;
    LPTSTR lpszStrings[2];
    DWORD dwErr = 0;

    dwErr = GetLastError();

    // Use event logging to log the error.
    hEventSource = RegisterEventSource(NULL, SERVICENAME);

    _stprintf(szMsg1, TEXT("%s error: %d"), SERVICENAME, dwErr);
    lpszStrings[0] = szMsg1;
    lpszStrings[1] = szMsg2;

    if (hEventSource != NULL) {
        ReportEvent(hEventSource, // handle of event source
                    EVENTLOG_ERROR_TYPE, // event type
                    0, // event category
                    0, // event ID
                    NULL, // current user's SID
                    2, // strings in lpszStrings
                    0, // no bytes of raw data
                    (LPCTSTR *) lpszStrings, // array of error strings
                    NULL); // no raw data

        (VOID) DeregisterEventSource(hEventSource);
    }
}

BOOL ReportStatusToSCMgr | ( | SERVICE_STATUS_HANDLE * | sshStatusHandle,
 |  | SERVICE_STATUS * | ssStatus,
 |  | DWORD | dwCurrentState,
 |  | DWORD | dwWin32ExitCode,
 |  | DWORD | dwWaitHint
 | ) |  |

Definition at line 548 of file Service.cpp.

                                          {

    static DWORD dwCheckPoint = 1;
    BOOL fResult = TRUE;

    if (dwCurrentState == SERVICE_START_PENDING) {
        ssStatus->dwControlsAccepted = 0;
    }
    else {
        ssStatus->dwControlsAccepted = SERVICE_ACCEPT_STOP;
    }

    ssStatus->dwCurrentState = dwCurrentState;
    ssStatus->dwWin32ExitCode = dwWin32ExitCode;
    ssStatus->dwWaitHint = dwWaitHint;

    if ((dwCurrentState == SERVICE_RUNNING) || (dwCurrentState == SERVICE_STOPPED)) {
        ssStatus->dwCheckPoint = 0;
    }
    else {
        ssStatus->dwCheckPoint = dwCheckPoint++;
    }

    // Report the status of the service to the service control manager.
    if (!(fResult = SetServiceStatus(*sshStatusHandle, ssStatus))) {
        AddToMessageLog(TEXT("ReportStatusToSCMgr: SetServiceStatus failed"));
    }
    return fResult;
}

Variable Documentation

HANDLE RpcHeap

Definition at line 1159 of file Service.cpp.

Generated on Wed Nov 13 2024 16:54:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Handles/cxhndl/Cxhndl.Idl File Reference

  • NetDS
  • RPC
  • Handles
  • cxhndl

Cxhndl.Idl File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Handles/cxhndl/Cxhndlc.c File Reference

  • NetDS
  • RPC
  • Handles
  • cxhndl
Defines | Functions

Cxhndlc.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include "cxhndl.h"

Go to the source code of this file.

Defines

#define | PURPOSE "This Microsoft RPC Version 2.0 sample program demonstrates\n\the use of the [context_handle] attribute. For more information\n\about attributes and RPC API functions, see the RPC programming\n\guide and reference.\n\n"

Functions

void __cdecl | main (int argc, char **argv)
void __RPC_FAR *__RPC_USER | midl_user_allocate (size_t len)
void __RPC_USER | midl_user_free (void __RPC_FAR *ptr)
void | Usage (char *pszProgramName)

Define Documentation

#define PURPOSE "This Microsoft RPC Version 2.0 sample program demonstrates\n\the use of the [context_handle] attribute. For more information\n\about attributes and RPC API functions, see the RPC programming\n\guide and reference.\n\n"

Definition at line 27 of file Cxhndlc.c.

Function Documentation

void __cdecl main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 46 of file Cxhndlc.c.

{
    RPC_STATUS status;
    PCONTEXT_HANDLE_TYPE phContext = NULL;

    unsigned char * pbBuf = NULL;
    short cbRead;    // count of bytes read

    unsigned char * pszUuid             = NULL;
    unsigned char * pszProtocolSequence = "ncacn_np";
    unsigned char * pszNetworkAddress   = NULL;
    unsigned char * pszEndpoint         = "\\pipe\\cxhndl";
    unsigned char * pszOptions          = NULL;
    unsigned char * pszStringBinding    = NULL;
    unsigned char * pszFileName         = "readme.txt";
    int i;

    /* allow the user to override settings with command line switches */
    for (i = 1; i < argc; i++) {
        if ((*argv[i] == '-') || (*argv[i] == '/')) {
            switch (tolower(*(argv[i]+1))) {
            case 'p':  // protocol sequence
                pszProtocolSequence = argv[++i];
                break;
            case 'n':  // network address
                pszNetworkAddress = argv[++i];
                break;
            case 'e':
                pszEndpoint = argv[++i];
                break;
            case 'o':
                pszOptions = argv[++i];
                break;
            case 'f':
                pszFileName = argv[++i];
                break;
            case 'h':
            case '?':
            default:
                Usage(argv[0]);
            }
        }
        else
            Usage(argv[0]);
    }

    pbBuf = (unsigned char *)
            midl_user_allocate(BUFSIZE * sizeof(unsigned char));

    /* Use a convenience function to concatenate the elements of  */
    /* the string binding into the proper sequence.               */
    status = RpcStringBindingCompose(pszUuid,
                                     pszProtocolSequence,
                                     pszNetworkAddress,
                                     pszEndpoint,
                                     pszOptions,
                                     &pszStringBinding);
    printf("RpcStringBindingCompose returned 0x%x\n", status);
    printf("pszStringBinding = %s\n", pszStringBinding);
    if (status) {
        exit(status);
    }

    /* Set the binding handle that will be used to bind to the server. */
    status = RpcBindingFromStringBinding(pszStringBinding,
                                         &hStarter);
    printf("RpcBindingFromStringBinding returned 0x%x\n", status);
    if (status) {
        exit(status);
    }

    printf("Calling the remote procedure RemoteOpen\n");
    if (RemoteOpen(&phContext, pszFileName) < 0) {
        printf("Unable to open %s\n", pszFileName);
        Shutdown();
        exit(2);
    }

    /* Now the context handle also manages the binding. */
    status = RpcBindingFree(&hStarter);
    printf("RpcBindingFree returned 0x%x\n", status);
    if (status) {
        exit(status);
    }

    /*  Free the string binding */
    status = RpcStringFree(&pszStringBinding);
    printf("RpcStringFree returned 0x%x\n", status);
    if (status) {
        exit(status);
    }

    printf("Calling the remote procedure RemoteRead\n");
    while (RemoteRead(phContext, pbBuf, &cbRead) > 0) {
        for (i = 0; i < cbRead; i++)
            putchar(*(pbBuf+i));
    }

    printf("Calling the remote procedure RemoteClose\n");
    if (RemoteClose(&phContext) < 0 ) {
        printf("Close failed on %s\n", pszFileName);
        exit(2);
    }

    exit(0);

}  // end main()

void __RPC_FAR* __RPC_USER midl_user_allocate ( size_t len )

Definition at line 159 of file Cxhndlc.c.

{
    return(malloc(len));
}

void __RPC_USER midl_user_free ( void __RPC_FAR * ptr )

Definition at line 164 of file Cxhndlc.c.

{
    free(ptr);
}

void Usage ( char * pszProgramName )

Definition at line 34 of file Cxhndlc.c.

{
    fprintf(stderr, "%s", PURPOSE);
    fprintf(stderr, "Usage:  %s\n", pszProgramName);
    fprintf(stderr, " -p protocol_sequence\n");
    fprintf(stderr, " -n network_address\n");
    fprintf(stderr, " -e endpoint\n");
    fprintf(stderr, " -o options\n");
    fprintf(stderr, " -f filename\n");
    exit(1);
}

Generated on Wed Nov 13 2024 16:54:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Handles/cxhndl/Cxhndlp.c File Reference

  • NetDS
  • RPC
  • Handles
  • cxhndl
Classes | Functions

Cxhndlp.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "cxhndl.h"

Go to the source code of this file.

Classes

struct | FILE_CONTEXT_TYPE

Functions

void __RPC_USER | PCONTEXT_HANDLE_TYPE_rundown (PCONTEXT_HANDLE_TYPE phContext)
short | RemoteClose (PCONTEXT_HANDLE_TYPE *pphContext)
short | RemoteOpen (PCONTEXT_HANDLE_TYPE *pphContext, unsigned char *pszFileName)
short | RemoteRead (PCONTEXT_HANDLE_TYPE phContext, unsigned char *pbBuf, short *pcbBuf)
void | Shutdown (void)

Function Documentation

void __RPC_USER PCONTEXT_HANDLE_TYPE_rundown ( PCONTEXT_HANDLE_TYPE phContext )

Definition at line 112 of file Cxhndlp.c.

{
    FILE_CONTEXT_TYPE *pFileContext;

    printf("Context rundown routine\n");

    if ( phContext )
    {
        pFileContext = (FILE_CONTEXT_TYPE *) phContext;
        if (pFileContext->hFile != NULL)
            fclose(pFileContext->hFile);

        midl_user_free( phContext );
    }

}

short RemoteClose ( PCONTEXT_HANDLE_TYPE * pphContext )

Definition at line 71 of file Cxhndlp.c.

{
    FILE_CONTEXT_TYPE *pFileContext;

    printf("in RemoteClose\n");

    pFileContext = (FILE_CONTEXT_TYPE *) *pphContext;

    if ( fclose( pFileContext->hFile ) == 0)
        {
        midl_user_free( *pphContext );
        *pphContext = NULL;
        return(0);
        }
    else
        /* Context Rundown routine will attempt to close it again */
        return(-1);
}

short RemoteOpen | ( | PCONTEXT_HANDLE_TYPE * | pphContext,
 |  | unsigned char * | pszFileName
 | ) |  |

Definition at line 32 of file Cxhndlp.c.

{
    FILE *hFile;
    FILE_CONTEXT_TYPE *pFileContext;

    if ((hFile = fopen(pszFileName, "r")) == NULL) {
        *pphContext = (PCONTEXT_HANDLE_TYPE) NULL;
        return(-1);
    }
    else {
        pFileContext = (FILE_CONTEXT_TYPE *)
                       midl_user_allocate(sizeof(FILE_CONTEXT_TYPE));
        pFileContext->hFile = hFile;
        strncpy(pFileContext->achFile, pszFileName, 255);
        *pphContext = (PCONTEXT_HANDLE_TYPE) pFileContext;
        return(0);
    }
}

short RemoteRead | ( | PCONTEXT_HANDLE_TYPE | phContext,
 |  | unsigned char * | pbBuf,
 |  | short * | pcbBuf
 | ) |  |

Definition at line 54 of file Cxhndlp.c.

{
    FILE_CONTEXT_TYPE *pFileContext;

    printf("in RemoteRead\n");

    pFileContext = (FILE_CONTEXT_TYPE *) phContext;
    *pcbBuf = (short) fread(pbBuf,
                            sizeof(char),
                            BUFSIZE,
                            pFileContext->hFile);
    return(*pcbBuf);
}

void Shutdown ( void )

Definition at line 92 of file Cxhndlp.c.

{
    RPC_STATUS status;

    printf("Calling RpcMgmtStopServerListening\n");
    status = RpcMgmtStopServerListening(NULL);
    printf("RpcMgmtStopServerListening returned: 0x%x\n", status);
    if (status) {
        exit(status);
    }

    printf("Calling RpcServerUnregisterIf\n");
    status = RpcServerUnregisterIf(NULL, NULL, FALSE);
    printf("RpcServerUnregisterIf returned 0x%x\n", status);
    if (status) {
        exit(status);
    }
}

Generated on Wed Nov 13 2024 16:54:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Handles/cxhndl/Cxhndls.c File Reference

  • NetDS
  • RPC
  • Handles
  • cxhndl
Defines | Functions

Cxhndls.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include "cxhndl.h"

Go to the source code of this file.

Defines

#define | PURPOSE "This Microsoft RPC Version 2.0 sample program demonstrates\n\the [context_handle] attribute. For more information\n\about this attribute and the RPC API functions, see the\n\RPC programming guide and reference.\n\n"

Functions

void __cdecl | main (int argc, char *argv[])
void __RPC_FAR *__RPC_USER | midl_user_allocate (size_t len)
void __RPC_USER | midl_user_free (void __RPC_FAR *ptr)
void | Usage (char *pszProgramName)

Define Documentation

#define PURPOSE "This Microsoft RPC Version 2.0 sample program demonstrates\n\the [context_handle] attribute. For more information\n\about this attribute and the RPC API functions, see the\n\RPC programming guide and reference.\n\n"

Definition at line 27 of file Cxhndls.c.

Function Documentation

void __cdecl main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 45 of file Cxhndls.c.

{
    RPC_STATUS status;
    unsigned char * pszProtocolSequence = "ncacn_np";
    unsigned char * pszSecurity         = NULL;
    unsigned char * pszEndpoint         = "\\pipe\\cxhndl";
    unsigned int    cMinCalls           = 1;
    unsigned int    cMaxCalls           = 20;
    unsigned int    fDontWait           = FALSE;
    int i;

    /* allow the user to override settings with command line switches */
    for (i = 1; i < argc; i++) {
        if ((*argv[i] == '-') || (*argv[i] == '/')) {
            switch (tolower(*(argv[i]+1))) {
            case 'p':  // protocol sequence
                pszProtocolSequence = argv[++i];
                break;
            case 'e':
                pszEndpoint = argv[++i];
                break;
            case 'm':
                cMaxCalls = (unsigned int) atoi(argv[++i]);
                break;
            case 'n':
                cMinCalls = (unsigned int) atoi(argv[++i]);
                break;
            case 'f':
                fDontWait = (unsigned int) atoi(argv[++i]);
                break;
            case 'h':
            case '?':
            default:
                Usage(argv[0]);
            }
        }
        else
            Usage(argv[0]);
    }

    status = RpcServerUseProtseqEp(pszProtocolSequence,
                                   cMaxCalls,
                                   pszEndpoint,
                                   pszSecurity);  // Security descriptor
    printf("RpcServerUseProtseqEp returned 0x%x\n", status);
    if (status) {
         exit(status);
    }

    status = RpcServerRegisterIf(cxhndl_ServerIfHandle, // interface to register
                                 NULL,   // MgrTypeUuid
                                 NULL);  // MgrEpv; null means use default
    printf("RpcServerRegisterIf returned 0x%x\n", status);
    if (status) {
        exit(status);
    }

    printf("Calling RpcServerListen\n");
    status = RpcServerListen(cMinCalls,
                             cMaxCalls,
                             fDontWait);
    printf("RpcServerListen returned: 0x%x\n", status);
    if (status) {
        exit(status);
    }

    if (fDontWait) {
        printf("Calling RpcMgmtWaitServerListen\n");
        status = RpcMgmtWaitServerListen();  //  wait operation
        printf("RpcMgmtWaitServerListen returned: 0x%x\n", status);
        if (status) {
            exit(status);
        }
    }

} // end main()

void __RPC_FAR* __RPC_USER midl_user_allocate ( size_t len )

Definition at line 127 of file Cxhndls.c.

{
    return(malloc(len));
}

void __RPC_USER midl_user_free ( void __RPC_FAR * ptr )

Definition at line 132 of file Cxhndls.c.

{
    free(ptr);
}

void Usage ( char * pszProgramName )

Definition at line 33 of file Cxhndls.c.

{
    fprintf(stderr, "%s", PURPOSE);
    fprintf(stderr, "Usage:  %s\n", pszProgramName);
    fprintf(stderr, " -p protocol_sequence\n");
    fprintf(stderr, " -e endpoint\n");
    fprintf(stderr, " -m maxcalls\n");
    fprintf(stderr, " -n mincalls\n");
    fprintf(stderr, " -f flag_wait_op\n");
    exit(1);
}

Generated on Wed Nov 13 2024 16:54:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Handles/usrdef/Usrdef.Idl File Reference

  • NetDS
  • RPC
  • Handles
  • usrdef

Usrdef.Idl File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Handles/usrdef/Usrdefc.c File Reference

  • NetDS
  • RPC
  • Handles
  • usrdef
Functions

Usrdefc.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include "usrdef.h"

Go to the source code of this file.

Functions

RPC_BINDING_HANDLE __RPC_USER | DATA_HANDLE_TYPE_bind (DATA_HANDLE_TYPE dh1)
void __RPC_USER | DATA_HANDLE_TYPE_unbind (DATA_HANDLE_TYPE dh1, RPC_BINDING_HANDLE h1)
void __cdecl | main (int argc, char **argv)
void __RPC_FAR *__RPC_USER | midl_user_allocate (size_t len)
void __RPC_USER | midl_user_free (void __RPC_FAR *ptr)
void | Usage (char *pszProgramName)

Function Documentation

RPC_BINDING_HANDLE __RPC_USER DATA_HANDLE_TYPE_bind ( DATA_HANDLE_TYPE dh1 )

Definition at line 91 of file Usrdefc.c.

{
    RPC_STATUS status;    // returned by RPC API functions
    RPC_BINDING_HANDLE hBinding;
    unsigned char * pszStringBinding;

    printf("Within DATA_HANDLE_TYPE_bind function:\n");
    status = RpcStringBindingCompose(dh1->pszUuid,
                                     dh1->pszProtocolSequence,
                                     dh1->pszNetworkAddress,
                                     dh1->pszEndpoint,
                                     dh1->pszOptions,
                                     &pszStringBinding);
    printf("RpcStringBindingCompose returned 0x%x\n", status);
    printf("pszStringBinding = %s\n", pszStringBinding);
    if (status) {
        exit(status);
    }

    status = RpcBindingFromStringBinding(pszStringBinding,
                                         &hBinding);
    printf("RpcBindingFromStringBinding returned 0x%x\n", status);
    if (status) {
        exit(status);
    }

    status = RpcStringFree(&pszStringBinding);  // unbind
    printf("RpcStringFree returned 0x%x\n", status);
    if (status) {
        exit(status);
    }

    return(hBinding);
}

void __RPC_USER DATA_HANDLE_TYPE_unbind | ( | DATA_HANDLE_TYPE | dh1,
 |  | RPC_BINDING_HANDLE | h1
 | ) |  |

Definition at line 128 of file Usrdefc.c.

{
     RPC_STATUS status;    // returned by RPC API functions

     printf("Within DATA_HANDLE_TYPE_unbind function:\n");
     printf("Unbinding handle for %s\n", dh1->pszEndpoint);

     status = RpcBindingFree(&h1);  // unbind
     printf("RpcBindingFree returned 0x%x\n", status);
}

void __cdecl main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 37 of file Usrdefc.c.

{
    int i;
    DATA_HANDLE_TYPE dhBinding;
    unsigned char * pszString = "hello, world";

    dhBinding = (DATA_HANDLE_TYPE) midl_user_allocate(sizeof(DATA_TYPE));
    dhBinding->pszProtocolSequence = "ncacn_np";
    dhBinding->pszUuid             = NULL;
    dhBinding->pszEndpoint         = "\\pipe\\usrdef";
    dhBinding->pszNetworkAddress   = NULL;
    dhBinding->pszOptions          = NULL;

    /* allow the user to override settings with command line switches */
    for (i = 1; i < argc; i++) {
        if ((*argv[i] == '-') || (*argv[i] == '/')) {
            switch (tolower(*(argv[i]+1))) {
            case 'p':  // protocol sequence
                dhBinding->pszProtocolSequence = argv[++i];
                break;
            case 'n':  // network address
                dhBinding->pszNetworkAddress = argv[++i];
                break;
            case 'e':
                dhBinding->pszEndpoint = argv[++i];
                break;
            case 'o':
                dhBinding->pszOptions = argv[++i];
                break;
            case 's':
                pszString = argv[++i];
                break;
            case 'h':
            case '?':
            default:
                Usage(argv[0]);
            }
        }
        else
            Usage(argv[0]);
    }

    printf("Calling the remote procedure 'UsrdefProc'\n");
    UsrdefProc(dhBinding, pszString);  // call the remote procedure

    printf("Calling the remote procedure 'Shutdown'\n");
    Shutdown(dhBinding);  // shut down the server side

    exit(0);

}  // end main()

void __RPC_FAR* __RPC_USER midl_user_allocate ( size_t len )

Definition at line 144 of file Usrdefc.c.

{
    return(malloc(len));
}

void __RPC_USER midl_user_free ( void __RPC_FAR * ptr )

Definition at line 149 of file Usrdefc.c.

{
    free(ptr);
}

void Usage ( char * pszProgramName )

Definition at line 26 of file Usrdefc.c.

{
    fprintf(stderr, "Usage:  %s\n", pszProgramName);
    fprintf(stderr, " -p protocol_sequence\n");
    fprintf(stderr, " -n network_address\n");
    fprintf(stderr, " -e endpoint\n");
    fprintf(stderr, " -o options\n");
    fprintf(stderr, " -s string\n");
    exit(1);
}

Generated on Wed Nov 13 2024 16:54:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Handles/usrdef/Usrdefp.c File Reference

  • NetDS
  • RPC
  • Handles
  • usrdef
Functions

Usrdefp.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include "usrdef.h"

Go to the source code of this file.

Functions

void | Shutdown (DATA_HANDLE_TYPE dh)
void | UsrdefProc (DATA_HANDLE_TYPE dh, unsigned char *pszString)

Function Documentation

void Shutdown ( DATA_HANDLE_TYPE dh )

Definition at line 26 of file Usrdefp.c.

{
    RPC_STATUS status;

    printf("Calling RpcMgmtStopServerListening\n");
    status = RpcMgmtStopServerListening(NULL);
    printf("RpcMgmtStopServerListening returned: 0x%x\n", status);
    if (status) {
        exit(status);
    }

    printf("Calling RpcServerUnregisterIf\n");
    status = RpcServerUnregisterIf(NULL, NULL, FALSE);
    printf("RpcServerUnregisterIf returned 0x%x\n", status);
    if (status) {
        exit(status);
    }
}

void UsrdefProc | ( | DATA_HANDLE_TYPE | dh,
 |  | unsigned char * | pszString
 | ) |  |

Definition at line 21 of file Usrdefp.c.

{
    printf("%s\n", pszString);
}

Generated on Wed Nov 13 2024 16:54:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Handles/usrdef/Usrdefs.c File Reference

  • NetDS
  • RPC
  • Handles
  • usrdef
Defines | Functions

Usrdefs.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include "usrdef.h"

Go to the source code of this file.

Defines

#define | PURPOSE "This Microsoft RPC Version 2.0 sample program demonstrates\n\the use of user-defined handles. For more information\n\about the [handle] attribute and RPC API functions, see the\n\RPC programming guide and reference.\n\n"

Functions

void __cdecl | main (int argc, char *argv[])
void __RPC_FAR *__RPC_USER | midl_user_allocate (size_t len)
void __RPC_USER | midl_user_free (void __RPC_FAR *ptr)
void | Usage (char *pszProgramName)

Define Documentation

#define PURPOSE "This Microsoft RPC Version 2.0 sample program demonstrates\n\the use of user-defined handles. For more information\n\about the [handle] attribute and RPC API functions, see the\n\RPC programming guide and reference.\n\n"

Definition at line 27 of file Usrdefs.c.

Function Documentation

void __cdecl main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 45 of file Usrdefs.c.

{
    RPC_STATUS status;
    unsigned char * pszProtocolSequence = "ncacn_np";
    unsigned char * pszSecurity         = NULL;
    unsigned char * pszEndpoint         = "\\pipe\\usrdef";
    unsigned int    cMinCalls           = 1;
    unsigned int    cMaxCalls           = 20;
    unsigned int    fDontWait           = FALSE;
    int i;

    /* allow the user to override settings with command line switches */
    for (i = 1; i < argc; i++) {
        if ((*argv[i] == '-') || (*argv[i] == '/')) {
            switch (tolower(*(argv[i]+1))) {
            case 'p':  // protocol sequence
                pszProtocolSequence = argv[++i];
                break;
            case 'e':
                pszEndpoint = argv[++i];
                break;
            case 'm':
                cMaxCalls = (unsigned int) atoi(argv[++i]);
                break;
            case 'n':
                cMinCalls = (unsigned int) atoi(argv[++i]);
                break;
            case 'f':
                fDontWait = (unsigned int) atoi(argv[++i]);
                break;
            case 'h':
            case '?':
            default:
                Usage(argv[0]);
            }
        }
        else
            Usage(argv[0]);
    }

    status = RpcServerUseProtseqEp(pszProtocolSequence,
                                   cMaxCalls,
                                   pszEndpoint,
                                   pszSecurity);  // Security descriptor
    printf("RpcServerUseProtseqEp returned 0x%x\n", status);
    if (status) {
        exit(status);
    }

    status = RpcServerRegisterIf(usrdef_ServerIfHandle, // interface to register
                                 NULL,   // MgrTypeUuid
                                 NULL);  // MgrEpv; null means use default
    printf("RpcServerRegisterIf returned 0x%x\n", status);
    if (status) {
        exit(status);
    }

    printf("Calling RpcServerListen\n");
    status = RpcServerListen(cMinCalls,
                             cMaxCalls,
                             fDontWait);
    printf("RpcServerListen returned: 0x%x\n", status);
    if (status) {
        exit(status);
    }

    if (fDontWait) {
        printf("Calling RpcMgmtWaitServerListen\n");
        status = RpcMgmtWaitServerListen();  //  wait operation
        printf("RpcMgmtWaitServerListen returned: 0x%x\n", status);
        if (status) {
            exit(status);
        }
    }

}  // end main()

void __RPC_FAR* __RPC_USER midl_user_allocate ( size_t len )

Definition at line 126 of file Usrdefs.c.

{
    return(malloc(len));
}

void __RPC_USER midl_user_free ( void __RPC_FAR * ptr )

Definition at line 131 of file Usrdefs.c.

{
    free(ptr);
}

void Usage ( char * pszProgramName )

Definition at line 33 of file Usrdefs.c.

{
    fprintf(stderr, "%s", PURPOSE);
    fprintf(stderr, "Usage:  %s\n", pszProgramName);
    fprintf(stderr, " -p protocol_sequence\n");
    fprintf(stderr, " -e endpoint\n");
    fprintf(stderr, " -m maxcalls\n");
    fprintf(stderr, " -n mincalls\n");
    fprintf(stderr, " -f flag_wait_op\n");
    exit(1);
}

Generated on Wed Nov 13 2024 16:54:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Hello/Hello.Idl File Reference

  • NetDS
  • RPC
  • Hello

Hello.Idl File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Hello/Helloc.c File Reference

  • NetDS
  • RPC
  • Hello
Functions

Helloc.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include "hello.h"

Go to the source code of this file.

Functions

void __cdecl | main (int argc, char **argv)
void __RPC_FAR *__RPC_USER | midl_user_allocate (size_t len)
void __RPC_USER | midl_user_free (void __RPC_FAR *ptr)
void | Usage (char *pszProgramName)

Function Documentation

void __cdecl main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 42 of file Helloc.c.

{
    RPC_STATUS status;
    unsigned char * pszUuid             = NULL;
    unsigned char * pszProtocolSequence = "ncacn_np";
    unsigned char * pszNetworkAddress   = NULL;
    unsigned char * pszEndpoint         = "\\pipe\\hello";
    unsigned char * pszOptions          = NULL;
    unsigned char * pszStringBinding    = NULL;
    unsigned char * pszString           = "hello, world";
    unsigned long ulCode;
    int i;

    /* allow the user to override settings with command line switches */
    for (i = 1; i < argc; i++) {
        if ((*argv[i] == '-') || (*argv[i] == '/')) {
            switch (tolower(*(argv[i]+1))) {
            case 'p':  // protocol sequence
                pszProtocolSequence = argv[++i];
                break;
            case 'n':  // network address
                pszNetworkAddress = argv[++i];
                break;
            case 'e':  // endpoint
                pszEndpoint = argv[++i];
                break;
            case 'o':
                pszOptions = argv[++i];
                break;
            case 's':
                pszString = argv[++i];
                break;
            case 'h':
            case '?':
            default:
                Usage(argv[0]);
            }
        }
        else
            Usage(argv[0]);
    }

    /* Use a convenience function to concatenate the elements of */
    /* the string binding into the proper sequence.              */
    status = RpcStringBindingCompose(pszUuid,
                                     pszProtocolSequence,
                                     pszNetworkAddress,
                                     pszEndpoint,
                                     pszOptions,
                                     &pszStringBinding);
    printf("RpcStringBindingCompose returned 0x%x\n", status);
    printf("pszStringBinding = %s\n", pszStringBinding);
    if (status) {
        exit(status);
    }

    /* Set the binding handle that will be used to bind to the server. */
    status = RpcBindingFromStringBinding(pszStringBinding,
                                         &hello_IfHandle);
    printf("RpcBindingFromStringBinding returned 0x%x\n", status);
    if (status) {
        exit(status);
    }

    printf("Calling the remote procedure 'HelloProc'\n");
    printf("Print the string '%s' on the server\n", pszString);

    RpcTryExcept {
        HelloProc(pszString);  // make call with user message
        printf("Calling the remote procedure 'Shutdown'\n");
        Shutdown();  // shut down the server side
    }
    RpcExcept(1) {
        ulCode = RpcExceptionCode();
        printf("Runtime reported exception 0x%lx = %ld\n", ulCode, ulCode);
    }
    RpcEndExcept

    /*  The calls to the remote procedures are complete. */
    /*  Free the string and the binding handle           */
    status = RpcStringFree(&pszStringBinding);  // remote calls done; unbind
    printf("RpcStringFree returned 0x%x\n", status);
    if (status) {
        exit(status);
    }

    status = RpcBindingFree(&hello_IfHandle);  // remote calls done; unbind
    printf("RpcBindingFree returned 0x%x\n", status);
    if (status) {
        exit(status);
    }

    exit(0);

}  // end main()

void __RPC_FAR* __RPC_USER midl_user_allocate ( size_t len )

Definition at line 143 of file Helloc.c.

{
    return(malloc(len));
}

void __RPC_USER midl_user_free ( void __RPC_FAR * ptr )

Definition at line 148 of file Helloc.c.

{
    free(ptr);
}

void Usage ( char * pszProgramName )

Definition at line 31 of file Helloc.c.

{
    fprintf(stderr, "Usage:  %s\n", pszProgramName);
    fprintf(stderr, " -p protocol_sequence\n");
    fprintf(stderr, " -n network_address\n");
    fprintf(stderr, " -e endpoint\n");
    fprintf(stderr, " -o options\n");
    fprintf(stderr, " -s string\n");
    exit(1);
}

Generated on Wed Nov 13 2024 16:54:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Hello/Hellop.c File Reference

  • NetDS
  • RPC
  • Hello
Functions

Hellop.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include "hello.h"

Go to the source code of this file.

Functions

void | HelloProc (unsigned char *pszString)
void | Shutdown (void)

Function Documentation

void HelloProc ( unsigned char * pszString )

Definition at line 26 of file Hellop.c.

{
    printf("%s\n", pszString);
}

void Shutdown ( void )

Definition at line 31 of file Hellop.c.

{
    RPC_STATUS status;

    printf("Calling RpcMgmtStopServerListening\n");
    status = RpcMgmtStopServerListening(NULL);
    printf("RpcMgmtStopServerListening returned: 0x%x\n", status);
    if (status) {
       exit(status);
    }

    printf("Calling RpcServerUnregisterIf\n");
    status = RpcServerUnregisterIf(NULL, NULL, FALSE);
    printf("RpcServerUnregisterIf returned 0x%x\n", status);
    if (status) {
       exit(status);
    }
}

Generated on Wed Nov 13 2024 16:54:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Hello/Hellos.c File Reference

  • NetDS
  • RPC
  • Hello
Defines | Functions

Hellos.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include "hello.h"

Go to the source code of this file.

Defines

#define | PURPOSE "This Microsoft RPC Version 1.0 sample program demonstrates\n\the use of the [string] attribute. For more information\n\about the attributes and the RPC API functions, see the\n\RPC programming guide and reference.\n\n"

Functions

void __cdecl | main (int argc, char *argv[])
void __RPC_FAR *__RPC_USER | midl_user_allocate (size_t len)
void __RPC_USER | midl_user_free (void __RPC_FAR *ptr)
void | Usage (char *pszProgramName)

Define Documentation

#define PURPOSE "This Microsoft RPC Version 1.0 sample program demonstrates\n\the use of the [string] attribute. For more information\n\about the attributes and the RPC API functions, see the\n\RPC programming guide and reference.\n\n"

Definition at line 31 of file Hellos.c.

Function Documentation

void __cdecl main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 50 of file Hellos.c.

{
    RPC_STATUS status;
    unsigned char * pszProtocolSequence = "ncacn_np";
    unsigned char * pszSecurity         = NULL;
    unsigned char * pszEndpoint         = "\\pipe\\hello";
    unsigned int    cMinCalls           = 1;
    unsigned int    cMaxCalls           = 20;
    unsigned int    fDontWait           = FALSE;
    int i;

    /* allow the user to override settings with command line switches */
    for (i = 1; i < argc; i++) {
        if ((*argv[i] == '-') || (*argv[i] == '/')) {
            switch (tolower(*(argv[i]+1))) {
            case 'p':  // protocol sequence
                pszProtocolSequence = argv[++i];
                break;
            case 'e':
                pszEndpoint = argv[++i];
                break;
            case 'm':
                cMaxCalls = (unsigned int) atoi(argv[++i]);
                break;
            case 'n':
                cMinCalls = (unsigned int) atoi(argv[++i]);
                break;
            case 'f':
                fDontWait = (unsigned int) atoi(argv[++i]);
                break;
            case 'h':
            case '?':
            default:
                Usage(argv[0]);
            }
        }
        else
            Usage(argv[0]);
    }

    status = RpcServerUseProtseqEp(pszProtocolSequence,
                                   cMaxCalls,
                                   pszEndpoint,
                                   pszSecurity);  // Security descriptor
    printf("RpcServerUseProtseqEp returned 0x%x\n", status);
    if (status) {
        exit(status);
    }

    status = RpcServerRegisterIf(hello_ServerIfHandle,  // interface to register
                                 NULL,   // MgrTypeUuid
                                 NULL);  // MgrEpv; null means use default
    printf("RpcServerRegisterIf returned 0x%x\n", status);
    if (status) {
        exit(status);
    }

    printf("Calling RpcServerListen\n");
    status = RpcServerListen(cMinCalls,
                             cMaxCalls,
                             fDontWait);
    printf("RpcServerListen returned: 0x%x\n", status);
    if (status) {
        exit(status);
    }

    if (fDontWait) {
        printf("Calling RpcMgmtWaitServerListen\n");
        status = RpcMgmtWaitServerListen();  // wait operation
        printf("RpcMgmtWaitServerListen returned: 0x%x\n", status);
        if (status) {
            exit(status);
        }
    }

}  // end main()

void __RPC_FAR* __RPC_USER midl_user_allocate ( size_t len )

Definition at line 132 of file Hellos.c.

{
    return(malloc(len));
}

void __RPC_USER midl_user_free ( void __RPC_FAR * ptr )

Definition at line 137 of file Hellos.c.

{
    free(ptr);
}

void Usage ( char * pszProgramName )

Definition at line 37 of file Hellos.c.

{
    fprintf(stderr, "%s", PURPOSE);
    fprintf(stderr, "Usage:  %s\n", pszProgramName);
    fprintf(stderr, " -p protocol_sequence\n");
    fprintf(stderr, " -e endpoint\n");
    fprintf(stderr, " -m maxcalls\n");
    fprintf(stderr, " -n mincalls\n");
    fprintf(stderr, " -f flag_wait_op\n");
    exit(1);
}

Generated on Wed Nov 13 2024 16:54:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Pickle/Picklp/Picklp.Idl File Reference

  • NetDS
  • RPC
  • Pickle
  • Picklp

Picklp.Idl File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Pickle/Picklp/Picklpc.c File Reference

  • NetDS
  • RPC
  • Pickle
  • Picklp
Classes | Defines | Typedefs | Functions

Picklpc.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include "picklp.h"

Go to the source code of this file.

Classes

struct | PickleControlBlock

Defines

#define | ALIGN_TO8(p) (char *)((ULONG_PTR)((char *)p + 7) & ~7)
#define | PURPOSE "This Microsoft RPC Version 2.0 sample program demonstrates\n\the use of the [encode,decode] attributes. For more information\n\about the attributes and RPC API functions, see the RPC programming\n\guide and reference.\n\n"

Typedefs

typedef struct PickleControlBlock | PickleControlBlock

Functions

void | DumpData (char *pszComment, char *pszText, OBJECT1 *pObject1, OBJECT2 *pObject2)
void __cdecl | main (int argc, char **argv)
void __RPC_FAR *__RPC_USER | MIDL_user_allocate (size_t s)
void __RPC_USER | MIDL_user_free (void __RPC_FAR *f)
void __RPC_USER | PicAlloc (void *pState, char **ppBuf, unsigned int *pCount)
void __RPC_USER | PicRead (void *pState, char **pBuf, unsigned int *pCount)
void __RPC_USER | PicWrite (void *pState, char *pBuf, unsigned int Count)
void | ReadDataFromFile (char *pszFileName, char *pbBuffer, unsigned long ulBufferSize)
void | Usage (char *pszProgramName)
void | WriteDataToFile (char *pszFileName, char *pbBuffer, unsigned long ulSizeToWrite)

Define Documentation

#define ALIGN_TO8 ( p ) (char *)((ULONG_PTR)((char *)p + 7) & ~7)

Definition at line 362 of file Picklpc.c.

#define PURPOSE "This Microsoft RPC Version 2.0 sample program demonstrates\n\the use of the [encode,decode] attributes. For more information\n\about the attributes and RPC API functions, see the RPC programming\n\guide and reference.\n\n"

Definition at line 25 of file Picklpc.c.

Typedef Documentation

typedef struct PickleControlBlock PickleControlBlock

Function Documentation

void DumpData | ( | char * | pszComment,
 |  | char * | pszText,
 |  | OBJECT1 * | pObject1,
 |  | OBJECT2 * | pObject2
 | ) |  |

Definition at line 58 of file Picklpc.c.

{
    int i;

    printf( "\n%s\n", pszComment );
    printf( "\tString\n\t\t%s\n", pszText );

    printf( "\tObject1");
    for (i=0; i < ARR_SIZE; i++)
        {
        if ( (i % 5) == 0 )
            printf( "\n\t\t");
        printf( "%08xl  ", pObject1->al[i] );
        }
    printf( "\n\t\t%x\n", pObject1->s );

    printf( "\tObject2");
    printf( "\n\t\t%x", pObject2->sSize );
    for (i=0; i < ARR_SIZE; i++)
        {
        if ( (i % 10) == 0 )
            printf( "\n\t\t");
        printf( "%04x  ", pObject2->as[i] );
        }
    printf( "\n" );
}

void __cdecl main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 161 of file Picklpc.c.

{
    RPC_STATUS status;

    unsigned char * pbPicklingBuffer = NULL;

    char * pszStyle      = NULL;
    char * pszFileName   = "pickle.dat";
    int i;
    int fEncode = 1;
    int fFixedStyle = 1;

    /* allow the user to override settings with command line switches */
    for (i = 1; i < argc; i++) {
        if ((*argv[i] == '-') || (*argv[i] == '/')) {
            switch (tolower(*(argv[i]+1))) {
            case 'd':
                fEncode = 0;
                break;
            case 'e':
                fEncode = 1;
                break;
            case 'i':
                fFixedStyle = 0;
                break;
            case 'f':
                pszFileName = argv[i] + 2;
                break;
            case 'h':
            case '?':
            default:
                Usage(argv[0]);
            }
        }
        else
            Usage(argv[0]);
    }

    /* Fixed buffer style: the buffer should be big enough.  */
    /* Please note that the buffer has to be aligned at 8.   */

    pbPicklingBuffer = (unsigned char *)
            midl_user_allocate( BUFSIZE * sizeof(unsigned char));

    if ( pbPicklingBuffer == NULL ) {
        printf("Cannot allocate the pickling buffer\n");
        exit(1);
        }
    else
        memset( pbPicklingBuffer, 0xdd, BUFSIZE );

    /*
        Set the pickling handle that will be used for data serialization.
        The global ImplicitPicHandle is used, but it has to be set up.
    */

    if ( fEncode ) {

        unsigned char * pszNameId;
        OBJECT1         Object1;
        OBJECT2   *     pObject2;
        unsigned long   ulEncodedSize = 0;

        printf("\nEncoding run: use -d for decoding\n\n");

        if ( fFixedStyle ) {

            printf("Creating a fixed buffer encoding handle\n");
            status = MesEncodeFixedBufferHandleCreate( pbPicklingBuffer,
                                                       BUFSIZE,
                                                       & ulEncodedSize,
                                                       & ImplicitPicHandle );
            printf("MesEncodeFixedBufferHandleCreate returned 0x%x\n", status);
            if (status) {
                exit(status);
            }
        }
        else {

            pUserState->LastSize = 0;
            pUserState->pMemBuffer = (char *)pbPicklingBuffer;
            pUserState->pBufferStart = (char *)pbPicklingBuffer;

            printf("Creating an incremental encoding handle\n");
            status = MesEncodeIncrementalHandleCreate( pUserState,
                                                       PicAlloc,
                                                       PicWrite,
                                                       & ImplicitPicHandle );
            printf("MesEncodeIncrementalHandleCreate returned 0x%x\n", status);
            if (status) {
                exit(status);
            }
        }

        /* Creating objects to manipulate */

        pszNameId = "Procedure pickling sample";

        for (i = 0; i < ARR_SIZE; i++)
            Object1.al[i] = 0x37370000 + i;
        Object1.s = 0x4646;

        pObject2 = midl_user_allocate( sizeof(OBJECT2) + ARR_SIZE*sizeof(short) );
        if (pObject2 == NULL ) {
            printf("Out of memory for Object2\n");
            exit(1);
        }

        pObject2->sSize = ARR_SIZE;
        for (i = 0; i < ARR_SIZE; i++)
            pObject2->as[i] = 0x7700 + i;

        DumpData( "Data to be encoded", pszNameId, &Object1, pObject2 );

        printf("\nEncoding all the arguments to the buffer\n\n");
        ProcPickle( pszNameId, & Object1, pObject2 );

        printf("Writing the data to the file: %s\n", pszFileName);
        WriteDataToFile( pszFileName,
                         pbPicklingBuffer,
                         fFixedStyle  ? ulEncodedSize
                                      : pUserState->LastSize);

        midl_user_free( pObject2 );
    }
    else {
        char            acNameBuffer[50];
        OBJECT1         Object1;
        OBJECT2   *     pObject2;

        printf("\nDecoding run: use -e for encoding\n\n");

        printf("Reading the data from the file: %s\n\n", pszFileName );
        ReadDataFromFile( pszFileName,
                          pbPicklingBuffer,
                          BUFSIZE );

        if ( fFixedStyle ) {

            printf("Creating a decoding handle\n");
            status = MesDecodeBufferHandleCreate( pbPicklingBuffer,
                                                  BUFSIZE,
                                                  & ImplicitPicHandle );
            printf("MesDecodeFixedBufferHandleCreate returned 0x%x\n", status);
            if (status) {
                exit(status);
            }
        }
        else {

            pUserState->LastSize = 0;
            pUserState->pMemBuffer = (char *)pbPicklingBuffer;
            pUserState->pBufferStart = (char *)pbPicklingBuffer;

            printf("Creating an incremental decoding handle\n");
            status = MesDecodeIncrementalHandleCreate( pUserState,
                                                       PicRead,
                                                       & ImplicitPicHandle );
            printf("MesDecodeIncrementalHandleCreate returned 0x%x\n", status);
            if (status) {
                exit(status);
            }
        }

        /* Creating objects to manipulate */

        pObject2 = midl_user_allocate( sizeof(OBJECT2) + ARR_SIZE*sizeof(short));
        if (pObject2 == NULL ) {
            printf("Out of memory for Object2\n");
            exit(1);
        }

        printf("\nDecoding all the arguments from the buffer\n");
        ProcPickle( acNameBuffer, & Object1, pObject2 );

        DumpData( "Decoded data", acNameBuffer, &Object1, pObject2 );

        midl_user_free( pObject2 );
    }

    printf("\nData serialization done.\n");

    midl_user_free( pbPicklingBuffer );

    printf("\nFreeing the serialization handle.\n");
    status = MesHandleFree( ImplicitPicHandle );
    printf("MesHandleFree returned 0x%x\n", status);

    exit(0);

}  // end main()

void __RPC_FAR* __RPC_USER MIDL_user_allocate ( size_t s )

Definition at line 364 of file Picklpc.c.

{
    unsigned char * pcAllocated;
    unsigned char * pcUserPtr;

    pcAllocated = (unsigned char *) malloc( s + 15 );
    pcUserPtr =  ALIGN_TO8( pcAllocated );
    if ( pcUserPtr == pcAllocated )
        pcUserPtr = pcAllocated + 8;

    *(pcUserPtr - 1) = (char) (pcUserPtr - pcAllocated);

    return( pcUserPtr );
}

void __RPC_USER MIDL_user_free ( void __RPC_FAR * f )

Definition at line 379 of file Picklpc.c.

{
    unsigned char * pcAllocated;
    unsigned char * pcUserPtr;

    pcUserPtr = (unsigned char *) f;
    pcAllocated = pcUserPtr - *(pcUserPtr - 1);

    free( pcAllocated );
}

void __RPC_USER PicAlloc | ( | void * | pState,
 |  | char ** | ppBuf,
 |  | unsigned int * | pCount
 | ) |  |

Definition at line 395 of file Picklpc.c.

{
    /* This routines "allocates" the next part from the preallocated
       buffer. It could call midl_user_allocate, too.
    */

    PickleControlBlock * pPic = (PickleControlBlock *)pState;

    if ( (pPic->pMemBuffer - pPic->pBufferStart) + *pCount <= BUFSIZE )
        *ppBuf = (char *)pPic->pMemBuffer;
    else {
        printf(" Buffer too small\n");
        exit(1);
    }
}

void __RPC_USER PicRead | ( | void * | pState,
 |  | char ** | pBuf,
 |  | unsigned int * | pCount
 | ) |  |

Definition at line 435 of file Picklpc.c.

{
    /* This routine returns another portion of the preread buffer. */

    PickleControlBlock * pPic = (PickleControlBlock *)pState;

    *ppBuf = (char *)pPic->pMemBuffer;
    pPic->pMemBuffer += *pCount;
}

void __RPC_USER PicWrite | ( | void * | pState,
 |  | char * | pBuf,
 |  | unsigned int | Count
 | ) |  |

Definition at line 415 of file Picklpc.c.

{
    /* This routine just marks how much of the preallocated buffer is used.
    */

    PickleControlBlock * pPic = (PickleControlBlock *)pState;

    if ( pPic->pMemBuffer != pBuf ) {
        printf(" Buffer poiner corrupted\n");
        exit(1);
    }
    pPic->pMemBuffer += Count;
    pPic->LastSize += Count;
}

void ReadDataFromFile | ( | char * | pszFileName,
 |  | char * | pbBuffer,
 |  | unsigned long | ulBufferSize
 | ) |  |

Definition at line 124 of file Picklpc.c.

{
    FILE *          pFile;
    size_t          Count;
    unsigned long   ulWrittenSize;

    if ( pszFileName ) {

        pFile = fopen( pszFileName, "r+b" );
        if ( pFile == NULL ) {
            printf("Cannot open the file for reading\n");
            exit(1);
            }

        Count = sizeof(long);
        if ( fread( &ulWrittenSize, sizeof(byte), Count, pFile) != Count ) {
            printf("Cannot read1 from the file\n");
            exit(1);
            }

        Count = (size_t)ulWrittenSize;
        if ( fread( pbBuffer, sizeof(byte), Count, pFile) != Count ) {
            printf("Cannot read2 from the file\n");
            exit(1);
            }

        if ( fclose( pFile ) != 0) {
            printf("Failed to close the file\n");
            exit(1);
            }
        }
}

void Usage ( char * pszProgramName )

Definition at line 47 of file Picklpc.c.

{
    fprintf(stderr, "%s", PURPOSE);
    fprintf(stderr, "Usage:  %s\n", pszProgramName);
    fprintf(stderr, " -d\n");
    fprintf(stderr, " -e\n");
    fprintf(stderr, " -ffilename\n");
    fprintf(stderr, " -i \n");
    exit(1);
}

void WriteDataToFile | ( | char * | pszFileName,
 |  | char * | pbBuffer,
 |  | unsigned long | ulSizeToWrite
 | ) |  |

Definition at line 89 of file Picklpc.c.

{
    FILE *      pFile;
    size_t      Count;

    if ( pszFileName ) {

        pFile = fopen( pszFileName, "w+b" );
        if ( pFile == NULL ) {
            printf("Cannot open the file for writing\n");
            exit(1);
            }

        Count = sizeof(long);
        if ( fwrite( &ulSizeToWrite, sizeof(byte), Count, pFile) != Count ) {
            printf("Cannot write1 to the file\n");
            exit(1);
            }

        Count = (size_t) ulSizeToWrite;
        if ( fwrite( pbBuffer, sizeof(byte), Count, pFile) != Count ) {
            printf("Cannot write2 to the file\n");
            exit(1);
            }

        if ( fclose( pFile ) != 0) {
            printf("Failed to close the file\n");
            exit(1);
            }
        }
}

Generated on Wed Nov 13 2024 16:54:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Pickle/Picklt/Picklt.Idl File Reference

  • NetDS
  • RPC
  • Pickle
  • Picklt

Picklt.Idl File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Pickle/Picklt/Pickltc.c File Reference

  • NetDS
  • RPC
  • Pickle
  • Picklt
Classes | Defines | Typedefs | Functions

Pickltc.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include "picklt.h"

Go to the source code of this file.

Classes

struct | PickleControlBlock

Defines

#define | ALIGN_TO8(p) (char *)((ULONG_PTR)((char *)p + 7) & ~7)
#define | PURPOSE "This Microsoft RPC Version 2.0 sample program demonstrates\n\the use of the [encode,decode] attributes. For more information\n\about the attributes and RPC API functions, see the RPC programming\n\guide and reference.\n\n"

Typedefs

typedef struct PickleControlBlock | PickleControlBlock

Functions

void | DumpData (char *pszComment, OBJECT2 *pObject2)
void __cdecl | main (int argc, char **argv)
void __RPC_FAR *__RPC_USER | MIDL_user_allocate (size_t s)
void __RPC_USER | MIDL_user_free (void __RPC_FAR *f)
void __RPC_USER | PicAlloc (void *pState, char **ppBuf, unsigned int *pCount)
void __RPC_USER | PicRead (void *pState, char **pBuf, unsigned int *pCount)
void __RPC_USER | PicWrite (void *pState, char *pBuf, unsigned int Count)
void | ReadDataFromFile (char *pszFileName, char *pbBuffer, unsigned long ulBufferSize)
void | Usage (char *pszProgramName)
void | WriteDataToFile (char *pszFileName, char *pbBuffer, unsigned long ulSizeToWrite)

Define Documentation

#define ALIGN_TO8 ( p ) (char *)((ULONG_PTR)((char *)p + 7) & ~7)

Definition at line 385 of file Pickltc.c.

#define PURPOSE "This Microsoft RPC Version 2.0 sample program demonstrates\n\the use of the [encode,decode] attributes. For more information\n\about the attributes and RPC API functions, see the RPC programming\n\guide and reference.\n\n"

Definition at line 25 of file Pickltc.c.

Typedef Documentation

typedef struct PickleControlBlock PickleControlBlock

Function Documentation

void DumpData | ( | char * | pszComment,
 |  | OBJECT2 * | pObject2
 | ) |  |

Definition at line 60 of file Pickltc.c.

{
    int i;

    printf( "\n%s\n", pszComment );

    printf( "\tObject2");
    printf( "\n\t\t%x", pObject2->sData );
    printf( "\n\t\t%p", pObject2->pObject1 );

    if ( pObject2->pObject1 )
        {
        OBJECT1 * pObject1 = pObject2->pObject1;

        printf( "\n\tObject1");
        for (i=0; i < ARR_SIZE; i++)
            {
            if ( (i % 5) == 0 )
                printf( "\n\t\t");
            printf( "%08xl  ", pObject1->al[i] );
            }
        printf( "\n\t\t%x\n", pObject1->s );
        }

    printf( "\n" );
}

void __cdecl main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 161 of file Pickltc.c.

{
    RPC_STATUS status;

    unsigned char * pbPicklingBuffer = NULL;

    char * pszStyle      = NULL;
    char * pszFileName   = "pickle.dat";
    int i;
    int fEncode = 1;
    int fFixedStyle = 1;

    /* allow the user to override settings with command line switches */
    for (i = 1; i < argc; i++) {
        if ((*argv[i] == '-') || (*argv[i] == '/')) {
            switch (tolower(*(argv[i]+1))) {
            case 'd':
                fEncode = 0;
                break;
            case 'e':
                fEncode = 1;
                break;
            case 'i':
                fFixedStyle = 0;
                break;
            case 'f':
                pszFileName = argv[i] + 2;
                break;
            case 'h':
            case '?':
            default:
                Usage(argv[0]);
            }
        }
        else
            Usage(argv[0]);
    }

    /* Fixed buffer style: the buffer should be big enough.
       Please note that a pickling buffer has to be aligned at 8.

       Also note, the buffer doesn't have to be allocated with
       the standard midl_user_allocate - this may be any allocator
       that alignes at 8.
       In general, midl_user_allocate is not required to return
       a buffer aligned at 8.
    */

    pbPicklingBuffer = (unsigned char *)
            midl_user_allocate( BUFSIZE * sizeof(unsigned char));

    if ( pbPicklingBuffer == NULL ) {
        printf("Cannot allocate the pickling buffer\n");
        exit(1);
        }
    else
        memset( pbPicklingBuffer, 0xdd, BUFSIZE );

    /*
        Set the pickling handle that will be used for data serialization.
        The global ImplicitPicHandle is used, but it has to be set up.
    */

    if ( fEncode ) {

        unsigned char * pszNameId;
        OBJECT1         Object1;
        OBJECT2         Object2a,  *pObject2b;

        unsigned long   ulEncodedSize = 0; /* this is a cumulative size */

        printf("\nEncoding run: use -d for decoding\n\n");

        if ( fFixedStyle ) {

            printf("Creating a fixed buffer encoding handle\n");
            status = MesEncodeFixedBufferHandleCreate( pbPicklingBuffer,
                                                       BUFSIZE,
                                                       & ulEncodedSize,
                                                       & ImplicitPicHandle );
            printf("MesEncodeFixedBufferHandleCreate returned 0x%x\n", status);
            if (status) {
                exit(status);
            }
        }
        else {
            /* Incremental style */

            pUserState->LastSize = 0;
            pUserState->pMemBuffer = (char *)pbPicklingBuffer;
            pUserState->pBufferStart = (char *)pbPicklingBuffer;

            printf("Creating an incremental encoding handle\n");
            status = MesEncodeIncrementalHandleCreate( pUserState,
                                                       PicAlloc,
                                                       PicWrite,
                                                       & ImplicitPicHandle );
            printf("MesEncodeIncrementalHandleCreate returned 0x%x\n", status);
            if (status) {
                exit(status);
            }
        }

        /* Creating objects to manipulate */

        pszNameId = "Pickling sample";

        for (i = 0; i < ARR_SIZE; i++)
            Object1.al[i] = 0x73730000 + i;
        Object1.s = 0x6464;

        Object2a.sData = 0xa9a9;
        Object2a.pObject1 = NULL;

        pObject2b = midl_user_allocate( sizeof(OBJECT2) );
        if (pObject2b == NULL ) {
            printf("Out of memory for Object2b\n");
            exit(1);
        }
        pObject2b->sData = 0xb8b8;
        pObject2b->pObject1 = & Object1;

        DumpData( "Data to be encoded", &Object2a );
        printf("\nEncoding Object2a data to the buffer\n");
        OBJECT2_Encode( &Object2a );

        /* The second object is encoded to the same buffer,
           the size used below is cumulative.
           Note that using procedure pickling instead of type pickling,
           both objects could be encoded with one call.
        */

        DumpData( "Data to be encoded", pObject2b );
        printf("\nEncoding Object2b data to the buffer\n\n");
        OBJECT2_Encode( pObject2b );

        printf("Writing the data to the file: %s\n", pszFileName);
        WriteDataToFile( pszFileName,
                         pbPicklingBuffer,
                         fFixedStyle  ? ulEncodedSize
                                      : pUserState->LastSize);

        midl_user_free( pObject2b );
    }
    else {
        OBJECT2      Object2c, Object2d;

        printf("\nDecoding run: use -e for encoding\n\n");

        printf("Reading the data from the file: %s\n\n", pszFileName );
        ReadDataFromFile( pszFileName,
                          pbPicklingBuffer,
                          BUFSIZE );

        if ( fFixedStyle ) {

            printf("Creating a decoding handle\n");
            status = MesDecodeBufferHandleCreate( pbPicklingBuffer,
                                                  BUFSIZE,
                                                  & ImplicitPicHandle );
            printf("MesDecodeFixedBufferHandleCreate returned 0x%x\n", status);
            if (status) {
                exit(status);
            }
        }
        else {

            pUserState->LastSize = 0;
            pUserState->pMemBuffer = (char *)pbPicklingBuffer;
            pUserState->pBufferStart = (char *)pbPicklingBuffer;

            printf("Creating an incremental decoding handle\n");
            status = MesDecodeIncrementalHandleCreate( pUserState,
                                                       PicRead,
                                                       & ImplicitPicHandle );
            printf("MesDecodeIncrementalHandleCreate returned 0x%x\n", status);
            if (status) {
                exit(status);
            }
        }

        /* Creating objects to manipulate */

        Object2c.pObject1 = NULL;
        Object2d.pObject1 = NULL;

        printf("\nDecoding Object2c data from the buffer\n");
        OBJECT2_Decode( & Object2c );
        DumpData( "Decoded data",  &Object2c );

        printf("\nDecoding Object2d data from the buffer\n");
        OBJECT2_Decode( & Object2d );
        DumpData( "Decoded data",  &Object2d );

        /* Need to free Object1 objects as they may have been allocated
           when unmarshalling data.
        */

        if ( Object2c.pObject1 )
            midl_user_free( Object2c.pObject1 );
        if ( Object2d.pObject1 )
            midl_user_free( Object2d.pObject1 );
    }

    printf("\nData serialization done.\n");

    midl_user_free( pbPicklingBuffer );

    printf("\nFreeing the serialization handle.\n");
    status = MesHandleFree( ImplicitPicHandle );
    printf("MesHandleFree returned 0x%x\n", status);

    exit(0);

}  // end main()

void __RPC_FAR* __RPC_USER MIDL_user_allocate ( size_t s )

Definition at line 387 of file Pickltc.c.

{
    unsigned char * pcAllocated;
    unsigned char * pcUserPtr;

    pcAllocated = (unsigned char *) malloc( s + 15 );
    pcUserPtr =  ALIGN_TO8( pcAllocated );
    if ( pcUserPtr == pcAllocated )
        pcUserPtr = pcAllocated + 8;

    *(pcUserPtr - 1) = (char) (pcUserPtr - pcAllocated);

    return( pcUserPtr );
}

void __RPC_USER MIDL_user_free ( void __RPC_FAR * f )

Definition at line 402 of file Pickltc.c.

{
    unsigned char * pcAllocated;
    unsigned char * pcUserPtr;

    pcUserPtr = (unsigned char *) f;
    pcAllocated = pcUserPtr - *(pcUserPtr - 1);

    free( pcAllocated );
}

void __RPC_USER PicAlloc | ( | void * | pState,
 |  | char ** | ppBuf,
 |  | unsigned int * | pCount
 | ) |  |

Definition at line 418 of file Pickltc.c.

{
    /* This routines "allocates" the next part from the preallocated
       buffer. It could call midl_user_allocate, too.
    */

    PickleControlBlock * pPic = (PickleControlBlock *)pState;

    if ( (pPic->pMemBuffer - pPic->pBufferStart) + *pCount <= BUFSIZE )
        *ppBuf = (char *)pPic->pMemBuffer;
    else {
        printf(" Buffer too small\n");
        exit(1);
    }
}

void __RPC_USER PicRead | ( | void * | pState,
 |  | char ** | pBuf,
 |  | unsigned int * | pCount
 | ) |  |

Definition at line 458 of file Pickltc.c.

{
    /* This routine returns another portion of the preread buffer. */

    PickleControlBlock * pPic = (PickleControlBlock *)pState;

    *ppBuf = (char *)pPic->pMemBuffer;
    pPic->pMemBuffer += *pCount;
}

void __RPC_USER PicWrite | ( | void * | pState,
 |  | char * | pBuf,
 |  | unsigned int | Count
 | ) |  |

Definition at line 438 of file Pickltc.c.

{
    /* This routine just marks how much of the preallocated buffer is used.
    */

    PickleControlBlock * pPic = (PickleControlBlock *)pState;

    if ( pPic->pMemBuffer != pBuf ) {
        printf(" Buffer poiner corrupted\n");
        exit(1);
    }
    pPic->pMemBuffer += Count;
    pPic->LastSize += Count;
}

void ReadDataFromFile | ( | char * | pszFileName,
 |  | char * | pbBuffer,
 |  | unsigned long | ulBufferSize
 | ) |  |

Definition at line 124 of file Pickltc.c.

{
    FILE *          pFile;
    size_t          Count;
    unsigned long   ulWrittenSize;

    if ( pszFileName ) {

        pFile = fopen( pszFileName, "r+b" );
        if ( pFile == NULL ) {
            printf("Cannot open the file for reading\n");
            exit(1);
            }

        Count = sizeof(long);
        if ( fread( &ulWrittenSize, sizeof(byte), Count, pFile) != Count ) {
            printf("Cannot read1 from the file\n");
            exit(1);
            }

        Count = (size_t)ulWrittenSize;
        if ( fread( pbBuffer, sizeof(byte), Count, pFile) != Count ) {
            printf("Cannot read2 from the file\n");
            exit(1);
            }

        if ( fclose( pFile ) != 0) {
            printf("Failed to close the file\n");
            exit(1);
            }
        }
}

void Usage ( char * pszProgramName )

Definition at line 49 of file Pickltc.c.

{
    fprintf(stderr, "%s", PURPOSE);
    fprintf(stderr, "Usage:  %s\n", pszProgramName);
    fprintf(stderr, " -d\n");
    fprintf(stderr, " -e\n");
    fprintf(stderr, " -ffilename\n");
    fprintf(stderr, " -i \n");
    exit(1);
}

void WriteDataToFile | ( | char * | pszFileName,
 |  | char * | pbBuffer,
 |  | unsigned long | ulSizeToWrite
 | ) |  |

Definition at line 89 of file Pickltc.c.

{
    FILE *      pFile;
    size_t      Count;

    if ( pszFileName ) {

        pFile = fopen( pszFileName, "w+b" );
        if ( pFile == NULL ) {
            printf("Cannot open the file for writing\n");
            exit(1);
            }

        Count = sizeof(long);
        if ( fwrite( &ulSizeToWrite, sizeof(byte), Count, pFile) != Count ) {
            printf("Cannot write1 to the file\n");
            exit(1);
            }

        Count = (size_t) ulSizeToWrite;
        if ( fwrite( pbBuffer, sizeof(byte), Count, pFile) != Count ) {
            printf("Cannot write2 to the file\n");
            exit(1);
            }

        if ( fclose( pFile ) != 0) {
            printf("Failed to close the file\n");
            exit(1);
            }
        }
}

Generated on Wed Nov 13 2024 16:54:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Pipes/Common.h File Reference

  • NetDS
  • RPC
  • Pipes
Classes | Defines

Common.h File Reference

#include <shellapi.h>
#include <tchar.h>
#include <stdio.h>
#include <stdlib.h>

Go to the source code of this file.

Classes

struct | pipe_state

Defines

#define | __COMMON_PIPE_SAMPLE__
#define | DO_EXCEPTION 1
#define | END_POINT TEXT("\\pipe\\pipe_sample")
#define | EXECUTION_FAILED -1
#define | EXECUTION_OK 0
#define | EXIT_IF_FAIL(x, string)
#define | PROTOCOL_SEQUENCE TEXT("ncacn_np")
#define | SCRAMBLE 1
#define | UNSCRAMBLE 2

Define Documentation

#define __COMMON_PIPE_SAMPLE__

Definition at line 10 of file Common.h.

#define DO_EXCEPTION 1

Definition at line 23 of file Common.h.

#define END_POINT TEXT("\\pipe\\pipe_sample")

Definition at line 29 of file Common.h.

#define EXECUTION_FAILED -1

Definition at line 19 of file Common.h.

#define EXECUTION_OK 0

Definition at line 20 of file Common.h.

#define EXIT_IF_FAIL | ( | x,
 |  | string
 | ) |
Value:
{   \
    ((x) != RPC_S_OK)?_tprintf(TEXT("%s returned with error: %d\n"), \
    TEXT(string), (x)),exit(x):0;}

Definition at line 41 of file Common.h.

#define PROTOCOL_SEQUENCE TEXT("ncacn_np")

Definition at line 28 of file Common.h.

#define SCRAMBLE 1

Definition at line 25 of file Common.h.

#define UNSCRAMBLE 2

Definition at line 26 of file Common.h.

Generated on Wed Nov 13 2024 16:53:11 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Pipes/Pipe.Idl File Reference

  • NetDS
  • RPC
  • Pipes

Pipe.Idl File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Pipes/Pipec.c File Reference

  • NetDS
  • RPC
  • Pipes
Defines | Functions | Variables

Pipec.c File Reference

#include "pipe.h"
#include "common.h"

Go to the source code of this file.

Defines

#define | CLIENT_BUFFER_SIZE 500

Functions

int __cdecl | main (int argc, char *argv[])
void __RPC_FAR *__RPC_API | midl_user_allocate (size_t nLen)
void __RPC_API | midl_user_free (void __RPC_FAR *lpvPointer)
void | PipeAlloc (char *pcStateInfo, unsigned long nReqSize, _TUCHAR **pcAllocatedBuffer, unsigned long *pnAllocatedSize)
void | PipePull (char *pcStateInfo, _TUCHAR *pcBuffer, unsigned long nMaxBufferSize, unsigned long *pnSizeToSend)
void | PipePush (char *nStateInfo, _TUCHAR *pcBuffer, unsigned long nNumberOfElements)
void | Usage (_TUCHAR *pszProgramName)

Variables

pipe_state in_out_pipe_state
_TUCHAR | pcClientBuffer [CLIENT_BUFFER_SIZE]

Define Documentation

#define CLIENT_BUFFER_SIZE 500

Definition at line 30 of file Pipec.c.

Function Documentation

int __cdecl main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 169 of file Pipec.c.

{
    RPC_STATUS      nStatus;        // Status returned from RPC-calls
    CHAR_PIPE_TYPE  in_out_pipe;    // Pipe structure used for the pipe
    TCHAR
        *pszOldFileName,        // Name of the input file
        *pszNewFileName;        // Name of the output file
    unsigned long
        nAction = SCRAMBLE,     // Scramble / Unscramble file
        nIdx,                   // Counter in loops
        nNumArgs;               // The number of args from the command line

    // These variables are used for the implicit binding
    _TUCHAR *pszUuid      = NULL;
    _TUCHAR *pszProtocolSequence= PROTOCOL_SEQUENCE;
    _TUCHAR *pszNetworkAddress  = NULL;
    _TUCHAR *pszEndpoint    = END_POINT;
    _TUCHAR *pszOptions     = NULL;
    _TUCHAR *pszStringBinding = NULL;

    // Get a common handle on the command line arguments for both
    // UNICODE and ASCII
#ifdef _UNICODE
    LPWSTR  *szArglist= CommandLineToArgvW(GetCommandLine(), &nNumArgs);
    if (NULL == szArglist)
    {
        _tprintf(TEXT("SERVER.C : CommandLineToArgW failed"));
        exit(EXECUTION_FAILED);
    }
#else
    char **szArglist  = argv;
    nNumArgs = argc;
#endif

    // Check to see that the call was correct
    if (nNumArgs < 3)
    {
        Usage(szArglist[0]);
    }

    // Allow the user to override settings with commandline switches
    for (nIdx = 3; nIdx < nNumArgs; nIdx++)
    {
        if ((_tcscmp(szArglist[nIdx], TEXT("-n")) == 0) ||
            (_tcscmp(szArglist[nIdx], TEXT("-N")) == 0))
        {
            pszNetworkAddress = szArglist[++nIdx];
        }
        else if((_tcscmp(szArglist[nIdx], TEXT("-p")) == 0) ||
            (_tcscmp(szArglist[nIdx], TEXT("-P")) == 0))
        {
            pszProtocolSequence = szArglist[++nIdx];
        }
        else if((_tcscmp(szArglist[nIdx], TEXT("-e")) == 0) ||
                (_tcscmp(szArglist[nIdx], TEXT("-e")) == 0))
        {
            pszEndpoint = szArglist[++nIdx];
        }
        else if((_tcscmp(szArglist[nIdx], TEXT("-o")) == 0) ||
               (_tcscmp(szArglist[nIdx], TEXT("-O")) == 0))
        {
            pszOptions = szArglist[++nIdx];
        }
        else if((_tcscmp(szArglist[nIdx], TEXT("-s")) == 0) ||
                (_tcscmp(szArglist[nIdx], TEXT("-S")) == 0))
        {
            nAction = SCRAMBLE;
        }
        else if((_tcscmp(szArglist[nIdx], TEXT("-u")) == 0) ||
                (_tcscmp(szArglist[nIdx], TEXT("-U")) == 0))
        {
            nAction = UNSCRAMBLE;
        }
        else
        {
            Usage(szArglist[0]);
        }
    }

    // Allocate space for the filenames
    if(NULL == (pszOldFileName  = (TCHAR *) midl_user_allocate(
        sizeof(TCHAR) * (_tcsclen(szArglist[1]) + 1))))
    {
        _tprintf(TEXT("Memory allocation error\n"));
        exit(EXECUTION_FAILED);
    }
    if(NULL == (pszNewFileName  = (TCHAR *) midl_user_allocate(
        sizeof(TCHAR) * (_tcsclen(szArglist[2]) + 1))))
    {
        _tprintf(TEXT("Memory allocation error\n"));
        exit(EXECUTION_FAILED);
    }

    // Initialize the state variables for the in pipe
    _tcscpy(pszOldFileName, szArglist[1]);
    _tcscpy(pszNewFileName, szArglist[2]);

    // Since we are doing implicit binding, we need to initialize the
    // global varaible global_pipe_sample_handle from the client.
    // Use a function to concatenate the elements of the string
    // binding into the proper sequence
    nStatus = RpcStringBindingCompose(
        pszUuid,
        pszProtocolSequence,
        pszNetworkAddress,
        pszEndpoint,
        pszOptions,
        &pszStringBinding);
    EXIT_IF_FAIL(nStatus, "RpcStringBindingCompose");

    // Set the binding handle that will be used to bind to the server
    nStatus = RpcBindingFromStringBinding(
        pszStringBinding,
        &global_pipe_sample_handle);        // The global handle
    EXIT_IF_FAIL(nStatus, "RpcBindingFromStringBinding");

    /* Initialize pipestructure */
    in_out_pipe_state.hOld = NULL;
    in_out_pipe_state.hNew = NULL;
    in_out_pipe_state.pszOldName = pszOldFileName;
    in_out_pipe_state.pszNewName = pszNewFileName;

    in_out_pipe.state = (char *) &in_out_pipe_state;
    in_out_pipe.alloc = PipeAlloc;
    in_out_pipe.pull  = PipePull;
    in_out_pipe.push  = PipePush;

    RpcTryExcept
    {
        // Call the remote procedure to send the file to remote machine
        _tprintf(TEXT("Calling the remote procedure ScrambleFile()\n"));
        ScrambleFile(nAction, &in_out_pipe);
        _tprintf(TEXT("Call to ScrambleFile() returned\n"));
    }
    RpcExcept(DO_EXCEPTION)
    {
        _tprintf(TEXT("Run-time exception %08X = %d in %s\n"),
                RpcExceptionCode(), RpcExceptionCode(), TEXT(__FILE__));
        exit(EXECUTION_FAILED);
    }
    RpcEndExcept

    // Deallocate the memory used for the names in the state variable
    midl_user_free(pszOldFileName);
    midl_user_free(pszNewFileName);

    // Deallocate the memory used for the ARGLIST if using UNICODE
#ifdef _UNICODE
    if (NULL != szArglist)
        free(szArglist);
#endif

    // Shut down the server
    ShutDown();

    return (EXECUTION_OK);
}

void __RPC_FAR* __RPC_API midl_user_allocate ( size_t nLen )

Definition at line 340 of file Pipec.c.

{
    return (malloc(nLen));
}

void __RPC_API midl_user_free ( void __RPC_FAR * lpvPointer )

Definition at line 345 of file Pipec.c.

{
    if(NULL == lpvPointer)
    {
        free (lpvPointer);
    }
}

void PipeAlloc | ( | char * | pcStateInfo,
 |  | unsigned long | nReqSize,
 |  | _TUCHAR ** | pcAllocatedBuffer,
 |  | unsigned long * | pnAllocatedSize
 | ) |  |

Definition at line 65 of file Pipec.c.

{
    // Since the memory is already allocated, just return a pointer to it
    if(nReqSize > (CLIENT_BUFFER_SIZE * sizeof(_TUCHAR)))
    {
        *pnAllocatedSize = CLIENT_BUFFER_SIZE * sizeof(_TUCHAR);
    }
    else
    {
        *pnAllocatedSize = nReqSize;
    }
    *pcAllocatedBuffer = pcClientBuffer;
}

void PipePull | ( | char * | pcStateInfo,
 |  | _TUCHAR * | pcBuffer,
 |  | unsigned long | nMaxBufferSize,
 |  | unsigned long * | pnSizeToSend
 | ) |  |

Definition at line 89 of file Pipec.c.

{
    // Declare a state variable
    pipe_state  *psState = (pipe_state *) pcStateInfo;

    // Open the local file, if it is not already opened
    if(psState->hOld == NULL)
    {
        if(NULL == (psState->hOld =
            _tfopen(psState->pszOldName, TEXT("rt"))))
        {
            _tprintf(TEXT("Could not open the file %s\n"),
                psState->pszOldName);
            exit(EXECUTION_FAILED);
        }
    }

    // Read max_buffer_size into the buffer
    *pnSizeToSend = (ULONG) fread(
        pcBuffer,
        sizeof(_TUCHAR),
        nMaxBufferSize,
        psState->hOld);

    if(*pnSizeToSend == 0)      // When end of the data is reached
    {                           // cleanup the application
        fclose(psState->hOld);
        psState->hOld = NULL;
    }
}

void PipePush | ( | char * | nStateInfo,
 |  | _TUCHAR * | pcBuffer,
 |  | unsigned long | nNumberOfElements
 | ) |  |

Definition at line 130 of file Pipec.c.

{
    // Declare a state variable
    pipe_state  *psState = (pipe_state *) nStateInfo;

    // Open the New file, if it is not already opened
    if(psState->hNew == NULL)
    {
        if(NULL == (psState->hNew =
            _tfopen(psState->pszNewName, TEXT("w"))))
        {
            _tprintf( TEXT("Unable to create the file %s\n"),
                    psState->pszNewName);
            exit(EXECUTION_FAILED);
        }
    }

    // When number of elements received is 0, this is the end of the pipe
    if(nNumberOfElements == 0)
    {
        // Clean up by closing the opened file
        fclose (psState->hNew);
        psState->hNew = NULL;
    }
    else
    {
        // Write the buffer to the file
        fwrite(pcBuffer, sizeof(_TUCHAR), nNumberOfElements, psState->hNew);
    }
}

void Usage ( _TUCHAR * pszProgramName )

Definition at line 42 of file Pipec.c.

{
    _tprintf(TEXT("USAGE : %s <local_file> <new_file> [-option]\n"),
        pszProgramName);
    _tprintf(TEXT("Options : -s\tTo encode the file\n"));
    _tprintf(TEXT("          -u\tTo Decode the file\n"));
    _tprintf(TEXT("          -n\t<Network Address>\n"));
    _tprintf(TEXT("          -p\t<Protocol Sequence>\n"));
    _tprintf(TEXT("          -e\t<Endpoint>\n"));
    _tprintf(TEXT("          -o\t<Options>\n"));
    exit(EXECUTION_FAILED);
}

Variable Documentation

pipe_state in_out_pipe_state

Definition at line 33 of file Pipec.c.

_TUCHAR pcClientBuffer[CLIENT_BUFFER_SIZE]

Definition at line 34 of file Pipec.c.

Generated on Wed Nov 13 2024 16:54:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Pipes/Pipeproc.c File Reference

  • NetDS
  • RPC
  • Pipes
Defines | Functions

Pipeproc.c File Reference

#include "pipe.h"
#include "common.h"

Go to the source code of this file.

Defines

#define | MAX_BUFFER_SIZE 1000

Functions

void | ScrambleFile (unsigned long nAction, CHAR_PIPE_TYPE *in_out_pipe)
void | ShutDown (void)

Define Documentation

#define MAX_BUFFER_SIZE 1000

Definition at line 17 of file Pipeproc.c.

Function Documentation

void ScrambleFile | ( | unsigned long | nAction,
 |  | CHAR_PIPE_TYPE * | in_out_pipe
 | ) |  |

Definition at line 27 of file Pipeproc.c.

{
    FILE    *fpTemp;                    // Pointer to the temporary file
    _TUCHAR pcBuffer[MAX_BUFFER_SIZE];  // Buffer to store the elements in

    unsigned long
        nActualTransferCount,   // Actual number of elements received
        nIdx,                   // Counter in loop
        nElementsToSend;        // Number of elements to send to the client
    BOOL bDone = FALSE;         // Inidicates when the pipe is done

    // Open up a file to temporary store the pulled data in
    fpTemp = _tfopen(TEXT("tempfile.oak"), TEXT("w+"));

    _tprintf(TEXT("Retrieving data from the client...\n"));
    // First process the entire pull. Input pipes must be transmitted first
    while(FALSE == bDone)
    {
        in_out_pipe->pull(      // Grab a chunck of data from the client
            in_out_pipe->state, // Pointer to the state
            pcBuffer,           // Buffer to put data in
            MAX_BUFFER_SIZE,    // Max number of elements to receive
            &nActualTransferCount); // Actual number of elements received

        // A data transfer count of 0 means the end of the pipe
        if(nActualTransferCount == 0)
        {
            bDone = TRUE;
        }
        else        // Save the data to an intermediate file
        {
            fwrite(pcBuffer, sizeof(_TUCHAR), nActualTransferCount, fpTemp);
        }
    }

    // Reset the flag
    bDone = FALSE;

    // Reset the filehandle to point at start of file
    fseek(fpTemp, 0, SEEK_SET);

    _tprintf(TEXT("Sending the data back to the client...\n"));
    // Now we can send the data back
    while(FALSE == bDone)
    {
        // Read a number of bytes from the file, into the buffer
        nElementsToSend = (ULONG) fread(pcBuffer,
                                  sizeof(_TUCHAR),
                                  MAX_BUFFER_SIZE,
                                  fpTemp);

        // If no more elements to send, we are done. Must send 0 to the
        // client to notify that the pipe is empty
        if(nElementsToSend == 0)
        {
            bDone = TRUE;
        }

        // According to the action, scramble or descramble the data
        for (nIdx = 0; nIdx < nElementsToSend; nIdx++)
        {
            if(nAction == SCRAMBLE)
            {
                pcBuffer[nIdx]++;
            }
            else
            {
                pcBuffer[nIdx]--;
            }
        }

        // Send the buffer to the client
        in_out_pipe->push(      // Send a chunck of data to the client
            in_out_pipe->state, // Pointer to the state
            pcBuffer,             // Date to send is in this buffer
            nElementsToSend);  // The number of elements to send
    } // End while (!done)

    // Close the file
    fclose(fpTemp);
}

void ShutDown ( void )

Definition at line 117 of file Pipeproc.c.

{
    RPC_STATUS nStatus;

    // Tell the server to stop listening for remote procedure calls
    _tprintf(TEXT("Shutting down the server\n"));
    nStatus = RpcMgmtStopServerListening(NULL);
    EXIT_IF_FAIL(nStatus, "RpcMgmtStopServerListening");
}

Generated on Wed Nov 13 2024 16:54:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/Pipes/Pipes.c File Reference

  • NetDS
  • RPC
  • Pipes
Functions

Pipes.c File Reference

#include "pipe.h"
#include "common.h"

Go to the source code of this file.

Functions

void | CleanUpServer ()
int __cdecl | main (int argc, char *argv[])
void __RPC_FAR *__RPC_API | midl_user_allocate (size_t len)
void __RPC_API | midl_user_free (void __RPC_FAR *ptr)
void | Usage (_TUCHAR *pszProgramName)

Function Documentation

void CleanUpServer ( void )

Definition at line 150 of file Pipes.c.

{
    RPC_STATUS nStatus;          // Error status returned from RPC calls

    /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
    /* Unregister the interface from the RPC run-time library           */
    /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
    _tprintf(TEXT("Unregistering the Interface"));
    nStatus = RpcServerUnregisterIf(
        NULL, NULL, // Prevents server from receiving any new remote calls
        FALSE);     // Wait until all the active calls are complete
    EXIT_IF_FAIL(nStatus, "RpcServerUnRegisterIf");
}

int __cdecl main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 38 of file Pipes.c.

{
    RPC_STATUS      nStatus;        // Error status returned
    int             nNumArgs;       // Number of command line arguments
    int             nIdx;           // Counter in loops

    // Variabels used for selecting the protocol and the endpoint
    _TUCHAR *pszProtocolSequence    = PROTOCOL_SEQUENCE;
    _TUCHAR *pszEndpoint            = END_POINT;
    _TUCHAR *pszSecurity            = NULL;

// Get a common handle on the command line arguments for both UNICODE
// and ASCII
#ifdef _UNICODE
    LPWSTR  *szArglist = CommandLineToArgvW(GetCommandLine(), &nNumArgs);
    if (NULL == szArglist)
    {
        _tprintf(TEXT("SERVER.C : CommandLineToArgW failed"));
        exit(EXECUTION_FAILED);
    }
#else
    char **szArglist  = argv;
    nNumArgs = argc;
#endif

    /* Allow the user to override settings with commandline switches    */
    for (nIdx = 1; nIdx < nNumArgs; nIdx++)
    {
        if((_tcscmp(szArglist[nIdx], TEXT("-p")) == 0) ||
           (_tcscmp(szArglist[nIdx], TEXT("-P")) == 0))
        {
            pszProtocolSequence = szArglist[++nIdx];
        }
        else if((_tcscmp(szArglist[nIdx], TEXT("-e")) == 0) ||
                (_tcscmp(szArglist[nIdx], TEXT("-e")) == 0))
        {
            pszEndpoint = szArglist[++nIdx];
        }
        else
        {
            Usage(szArglist[0]);
        }
    }

    /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
    /* Register the interface with the RPC run-time library             */
    /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
    _tprintf(TEXT("Registering the interface\n"));
    nStatus = RpcServerRegisterIf(
        pipe_sample_v1_0_s_ifspec,  // Interface specification
        NULL,                       // UUID to associate with MgrEnv arg.
        NULL);                      // Managers entry point vector. (None)
    EXIT_IF_FAIL(nStatus, "RpcServerRegisterIf");

    /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
    /* Select Protocal sequence : This sample uses namedpipes as the    */
    /* default protocol. The RpcServerUseProtseqEp function tells the   */
    /* RPC run-time library to use the specified protocol sequence      */
    /* combined with the specified endpoint for receiving remote        */
    /* procedure calls                                                  */
    /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
    _tprintf(TEXT("Selecting the protocol sequence to use.\t\"%s\"\n"),
            pszProtocolSequence);
    nStatus = RpcServerUseProtseqEp(
        pszProtocolSequence,            // String with the protocol in
        RPC_C_PROTSEQ_MAX_REQS_DEFAULT, // Max number of calls
        pszEndpoint,                    // Endpoint addres information
        pszSecurity);                   // Security
    EXIT_IF_FAIL(nStatus, "RpcServerUseProtseqsEp");

    /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
    /* Now start listening for remote procedure calls from the client   */
    /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
    RpcTryExcept
    {
        _tprintf(TEXT("Listening for remote calls...\n"));
        nStatus = RpcServerListen(
            1,                              // The minimum number of calls
            RPC_C_LISTEN_MAX_CALLS_DEFAULT, // The maximum number of calls
            FALSE);                         // Continue until stopped
        EXIT_IF_FAIL(nStatus, "RpcServerListen");
    }
    RpcExcept(DO_EXCEPTION)
    {
        // Print out the exception code
        _tprintf(TEXT("Run-time exception %u in %s at line %d\n"),
                RpcExceptionCode(), TEXT(__FILE__), __LINE__);
        exit(EXECUTION_FAILED);
    }
    RpcEndExcept

    // If no exceptions occured, clean up the server and exit
    CleanUpServer();

    // Deallocate the memory used for the ARGLIST if using UNICODE
#ifdef _UNICODE
    if (NULL != szArglist)
        free(szArglist);
#endif

    return (EXECUTION_OK);
}

void __RPC_FAR* __RPC_API midl_user_allocate ( size_t len )

Definition at line 175 of file Pipes.c.

{
    return (malloc(len));
}

void __RPC_API midl_user_free ( void __RPC_FAR * ptr )

Definition at line 180 of file Pipes.c.

{
    if(NULL != ptr)
        free (ptr);
}

void Usage ( _TUCHAR * pszProgramName )

Definition at line 26 of file Pipes.c.

{
    _tprintf(TEXT("USAGE : %s [-option]\n"), pszProgramName);
    _tprintf(TEXT("Options : -p Protocol Sequence\n"));
    _tprintf(TEXT("          -e Endpoint\n"));
    exit(EXECUTION_FAILED);
}

Generated on Wed Nov 13 2024 16:54:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/RPCssm/RPCssm.Idl File Reference

  • NetDS
  • RPC
  • RPCssm

RPCssm.Idl File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/RPCssm/RPCssmc.c File Reference

  • NetDS
  • RPC
  • RPCssm
Defines | Functions

RPCssmc.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include "rpcssm.h"

Go to the source code of this file.

Defines

#define | PURPOSE "This Microsoft RPC Version 2.0 sample program demonstrates\n\the use of the [context_handle] attribute. For more information\n\about attributes and RPC API functions, see the RPC programming\n\guide and reference.\n\n"

Functions

void | AllocateList (PBOX *ppBox, short sListSize)
void | AllocateSmList (PBOX *ppBox, short sListSize)
void | FreeList (PBOX pBox)
void | InitList (PBOX pBox, long lStartValue)
void __cdecl | main (int argc, char **argv)
void | PrintList (PBOX pBox)
void | Usage (char *pszProgramName)

Define Documentation

#define PURPOSE "This Microsoft RPC Version 2.0 sample program demonstrates\n\the use of the [context_handle] attribute. For more information\n\about attributes and RPC API functions, see the RPC programming\n\guide and reference.\n\n"

Definition at line 26 of file RPCssmc.c.

Function Documentation

void AllocateList | ( | PBOX * | ppBox,
 |  | short | sListSize
 | ) |  |
void AllocateSmList | ( | PBOX * | ppBox,
 |  | short | sListSize
 | ) |  |

Definition at line 180 of file RPCssmc.c.

{
    PBOX    pBox, head;
    int     i = 0;

    //.. Allocate a list of boxes, if needed  (when *ppBox==NULL).

    if ( *ppBox == NULL ) {

        RPC_STATUS status;

        head = 0;
        for (i = 0; i < sListSize; i++)
        {
            pBox = (PBOX) RpcSmAllocate( sizeof(LBOX), &status);
            if ( status != RPC_S_OK )
            {
                printf("AllocateList FAILED: not enough memory\n");
                break;
            }
            pBox->next = head;
            head = pBox;
        }
        *ppBox = head;
    }
    printf("%d nodes allocated.\n", i);
}

void FreeList ( PBOX pBox )
void InitList | ( | PBOX | pBox,
 |  | long | lStartValue
 | ) |  |

Definition at line 212 of file RPCssmc.c.

{
    int i = 0;

    while( pBox ) {
        pBox->data = lStartValue + ++i;
        pBox = pBox->next;
    }
    printf("%d nodes inited.\n", i);
}

void __cdecl main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 50 of file RPCssmc.c.

{
    RPC_STATUS status;
    PBOX       pBox = NULL;

    unsigned char * pszUuid             = NULL;
    unsigned char * pszProtocolSequence = "ncacn_np";
    unsigned char * pszNetworkAddress   = NULL;
    unsigned char * pszEndpoint         = "\\pipe\\rpcssm";
    unsigned char * pszOptions          = NULL;
    unsigned char * pszStringBinding    = NULL;
    int i;

    /* allow the user to override settings with command line switches */
    for (i = 1; i < argc; i++) {
        if ((*argv[i] == '-') || (*argv[i] == '/')) {
            switch (tolower(*(argv[i]+1))) {
            case 'p':  // protocol sequence
                pszProtocolSequence = argv[++i];
                break;
            case 'n':  // network address
                pszNetworkAddress = argv[++i];
                break;
            case 'e':
                pszEndpoint = argv[++i];
                break;
            case 'o':
                pszOptions = argv[++i];
                break;
            case 'h':
            case '?':
            default:
                Usage(argv[0]);
            }
        }
        else
            Usage(argv[0]);
    }

    RpcTryExcept {

        /* Use a convenience function to concatenate the elements of  */
        /* the string binding into the proper sequence.               */
        status = RpcStringBindingCompose(pszUuid,
                                         pszProtocolSequence,
                                         pszNetworkAddress,
                                         pszEndpoint,
                                         pszOptions,
                                         &pszStringBinding);
        printf("RpcStringBindingCompose returned 0x%x\n", status);
        printf("pszStringBinding = %s\n", pszStringBinding);
        if (status) {
            exit(status);
        }

        /* Set the binding handle that will be used to bind to the server. */
        status = RpcBindingFromStringBinding(pszStringBinding,
                                             &hStarter);
        printf("RpcBindingFromStringBinding returned 0x%x\n", status);
        if (status) {
            exit(status);
        }

        /* Now a different case: a client stub is in an enabled environment */

        status = RpcSmEnableAllocate();
        printf("RpcSmEnableAllocate returned 0x%x\n", status);
        if (status) {
            exit(status);
        }

        pBox = NULL;
        AllocateSmList( &pBox, 4 );
        InitList( pBox, 0xabcd0000 );
        PrintList( pBox );

        printf("Calling the remote procedure InOutList\n");
        InOutList( &pBox );
        PrintList( pBox );

        /* No need to free the memory allocated with RpcSmAllocate,
           RpcSmDisableAllocate would free it.
        */

        status = RpcSmDisableAllocate();
        printf("RpcSmDisableAllocate returned 0x%x\n", status);
        if (status) {
            exit(status);
        }

        printf(" All nodes from this case freed by RpcSmDisableAllocate().\n" );
        printf(" Client with memory environment done.\n\n" );

        Shutdown();

        /*  Free the string binding */
        status = RpcStringFree(&pszStringBinding);
        printf("RpcStringFree returned 0x%x\n", status);
        if (status) {
            exit(status);
        }

        status = RpcBindingFree(&hStarter);
        printf("RpcBindingFree returned 0x%x\n", status);
        if (status) {
            exit(status);
        }
    }
    RpcExcept(1) {

        #if defined(WIN32)
            printf( "Unexpected exception: %ld\n", RpcExceptionCode() );
        #else
            printf( "Unexpected exception: %d\n", RpcExceptionCode() );
        #endif
        printf("Did you set a net address (like -n server_name etc.)?\n");
        exit(1);
    }
    RpcEndExcept;

    exit(0);

}  // end main()

void PrintList ( PBOX pBox )

Definition at line 226 of file RPCssmc.c.

{
    int i = 0;

    while( pBox ) {

        if ( (i % 4) != 0 )
            printf("  data[%d]= %lx", i, pBox->data);
        else
            printf( "\n  data[%d]= %lx", i, pBox->data);
        pBox = pBox->next;
        i++;
    }
    printf("\n" );
}

void Usage ( char * pszProgramName )

Definition at line 39 of file RPCssmc.c.

{
    fprintf(stderr, "%s", PURPOSE);
    fprintf(stderr, "Usage:  %s\n", pszProgramName);
    fprintf(stderr, " -p protocol_sequence\n");
    fprintf(stderr, " -n network_address\n");
    fprintf(stderr, " -e endpoint\n");
    fprintf(stderr, " -o options\n");
    exit(1);
}

Generated on Wed Nov 13 2024 16:54:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/RPCssm/RPCssmp.c File Reference

  • NetDS
  • RPC
  • RPCssm
Functions | Variables

RPCssmp.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "rpcssm.h"

Go to the source code of this file.

Functions

void | AllocateSmList (PBOX *ppBox, short sListSize)
void | InitList (PBOX pBox, long lStartValue)
void | InOutList (PBOX *ppBox)
void | PrintList (PBOX pBox)
void | Shutdown (void)

Variables

void * | pvNonPersistent = NULL
void * | pvPersistent = NULL

Function Documentation

void AllocateSmList | ( | PBOX * | ppBox,
 |  | short | sListSize
 | ) |  |

Definition at line 94 of file RPCssmp.c.

{
    PBOX    pBox, head;
    int     i = 0;

    //.. Allocate a list of boxes, if needed (when *ppBox==NULL).

    if ( *ppBox == NULL ) {

        RPC_STATUS status;

        head = 0;
        for (i = 0; i < sListSize; i++)
        {
            pBox = (PBOX) RpcSmAllocate( sizeof(LBOX), &status);
            if ( status != RPC_S_OK )
            {
                printf("AllocateList FAILED: not enough memory\n");
                break;
            }
            pBox->next = head;
            head = pBox;
        }
        *ppBox = head;
    }
    printf("%d nodes allocated.\n", i);
}

void InitList | ( | PBOX | pBox,
 |  | long | lStartValue
 | ) |  |

Definition at line 126 of file RPCssmp.c.

{
    int i = 0;

    while( pBox ) {
        pBox->data = lStartValue + ++i;
        pBox = pBox->next;
    }
    printf("%d nodes inited.\n", i);
}

void InOutList ( PBOX * ppBox )

Definition at line 29 of file RPCssmp.c.

{
    /* As this routine executes in the enabled memory environment,
       a convienient way to allocate a non-persistent memory
       is to use RpcSmAllocate or RpcSsAllocate.
    */

    if ( ppBox) {

        PBOX p = *ppBox;
        while ( p->next )
            p = p->next;

        AllocateSmList( & p->next, 2 );
    }
    else {
        AllocateSmList( ppBox, 5 );
    }

    InitList( *ppBox, 0x98760000 );
    PrintList( *ppBox );

    /* To allocate a memory to be available after the call, means other
       than RpcS*Allocate with default allocators should be used.
    */

    if ( pvPersistent == NULL )
        {
        pvPersistent = malloc(100); /* or midl_user_allocate(100) */
        }

    pvNonPersistent = RpcSsAllocate( 100 );
}

void PrintList ( PBOX pBox )

Definition at line 140 of file RPCssmp.c.

{
    int i = 0;

    while( pBox ) {

        if ( (i % 4) != 0 )
            printf("  data[%d]= %lx", i, pBox->data);
        else
            printf("\n  data[%d]= %lx", i, pBox->data);
        pBox = pBox->next;
        i++;
    }
    printf("\n" );
}

void Shutdown ( void )

Definition at line 65 of file RPCssmp.c.

{
    RPC_STATUS status;

    /* Freeing the persistent memory */

    if ( pvPersistent )
        free( pvPersistent );

    printf("Calling RpcMgmtStopServerListening\n");
    status = RpcMgmtStopServerListening(NULL);
    printf("RpcMgmtStopServerListening returned: 0x%x\n", status);
    if (status) {
        exit(status);
    }

    printf("Calling RpcServerUnregisterIf\n");
    status = RpcServerUnregisterIf(NULL, NULL, FALSE);
    printf("RpcServerUnregisterIf returned 0x%x\n", status);
    if (status) {
        exit(status);
    }
}

Variable Documentation

void* pvNonPersistent = NULL

Definition at line 26 of file RPCssmp.c.

void* pvPersistent = NULL

Definition at line 25 of file RPCssmp.c.

Generated on Wed Nov 13 2024 16:54:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/RPCssm/RPCssms.c File Reference

  • NetDS
  • RPC
  • RPCssm
Defines | Functions

RPCssms.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include "rpcssm.h"

Go to the source code of this file.

Defines

#define | PURPOSE "This Microsoft RPC Version 2.0 sample program demonstrates\n\the [context_handle] attribute. For more information\n\about this attribute and the RPC API functions, see the\n\RPC programming guide and reference.\n\n"

Functions

void __cdecl | main (int argc, char *argv[])
void __RPC_FAR *__RPC_USER | midl_user_allocate (size_t len)
void __RPC_USER | midl_user_free (void __RPC_FAR *ptr)
void | Usage (char *pszProgramName)

Define Documentation

#define PURPOSE "This Microsoft RPC Version 2.0 sample program demonstrates\n\the [context_handle] attribute. For more information\n\about this attribute and the RPC API functions, see the\n\RPC programming guide and reference.\n\n"

Definition at line 27 of file RPCssms.c.

Function Documentation

void __cdecl main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 45 of file RPCssms.c.

{
    RPC_STATUS status;
    unsigned char * pszProtocolSequence = "ncacn_np";
    unsigned char * pszSecurity         = NULL;
    unsigned char * pszEndpoint         = "\\pipe\\rpcssm";
    unsigned int    cMinCalls           = 1;
    unsigned int    cMaxCalls           = 20;
    unsigned int    fDontWait           = TRUE;
    int i;

    /* allow the user to override settings with command line switches */
    for (i = 1; i < argc; i++) {
        if ((*argv[i] == '-') || (*argv[i] == '/')) {
            switch (tolower(*(argv[i]+1))) {
            case 'p':  // protocol sequence
                pszProtocolSequence = argv[++i];
                break;
            case 'e':
                pszEndpoint = argv[++i];
                break;
            case 'm':
                cMaxCalls = (unsigned int) atoi(argv[++i]);
                break;
            case 'n':
                cMinCalls = (unsigned int) atoi(argv[++i]);
                break;
            case 'f':
                fDontWait = (unsigned int) atoi(argv[++i]);
                break;
            case 'h':
            case '?':
            default:
                Usage(argv[0]);
            }
        }
        else
            Usage(argv[0]);
    }

    status = RpcServerUseProtseqEp(pszProtocolSequence,
                                   cMaxCalls,
                                   pszEndpoint,
                                   pszSecurity);  // Security descriptor
    printf("RpcServerUseProtseqEp returned 0x%x\n", status);
    if (status) {
         exit(status);
    }

    status = RpcServerRegisterIf(rpcssm_ServerIfHandle, // interface to register
                                 NULL,   // MgrTypeUuid
                                 NULL);  // MgrEpv; null means use default
    printf("RpcServerRegisterIf returned 0x%x\n", status);
    if (status) {
        exit(status);
    }

    printf("Calling RpcServerListen\n");
    status = RpcServerListen(cMinCalls,
                             cMaxCalls,
                             fDontWait);
    printf("RpcServerListen returned: 0x%x\n", status);
    if (status) {
        exit(status);
    }

    if (fDontWait) {
        printf("Calling RpcMgmtWaitServerListen\n");
        status = RpcMgmtWaitServerListen();  //  wait operation
        printf("RpcMgmtWaitServerListen returned: 0x%x\n", status);
        if (status) {
            exit(status);
        }
    }

} // end main()

void __RPC_FAR* __RPC_USER midl_user_allocate ( size_t len )

Definition at line 127 of file RPCssms.c.

{
    return(malloc(len));
}

void __RPC_USER midl_user_free ( void __RPC_FAR * ptr )

Definition at line 132 of file RPCssms.c.

{
    free(ptr);
}

void Usage ( char * pszProgramName )

Definition at line 33 of file RPCssms.c.

{
    fprintf(stderr, "%s", PURPOSE);
    fprintf(stderr, "Usage:  %s\n", pszProgramName);
    fprintf(stderr, " -p protocol_sequence\n");
    fprintf(stderr, " -e endpoint\n");
    fprintf(stderr, " -m maxcalls\n");
    fprintf(stderr, " -n mincalls\n");
    fprintf(stderr, " -f flag_wait_op\n");
    exit(1);
}

Generated on Wed Nov 13 2024 16:54:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/RPCsvc/Client.C File Reference

  • NetDS
  • RPC
  • RPCsvc
Functions | Variables

Client.C File Reference

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <rpc.h>
#include "rpcsvc.h"

Go to the source code of this file.

Functions

void | DoTimings (RPC_BINDING_HANDLE Binding, UINT iIterations)
ULONG EndTime ()
int | main (int argc, char *argv[])
void *__RPC_USER | MIDL_user_allocate (size_t size)
void __RPC_USER | MIDL_user_free (void *pointer)
void | StartTime (void)
void | Usage (void)

Variables

LARGE_INTEGER | Time

Function Documentation

void DoTimings | ( | RPC_BINDING_HANDLE | Binding,
 |  | UINT | iIterations
 | ) |  |

Definition at line 90 of file Client.C.

{
    ULONG mseconds;
    UINT i;
    RPC_STATUS status;
    byte bBuffer[4096];
    ULONG lBufferLength;
    ULONG lBufferSize;

    // Time Pings() (void calls)

    StartTime();
    for(i = iIterations; i; i--)
        {
        status = Ping(Binding);
        if (status != RPC_S_OK)
            goto Cleanup;
        }
    mseconds = EndTime();

    printf("%4d calls in %8d milliseconds - void calls.\n", iIterations, mseconds);

    // Time [in] buffer's
    //

    lBufferLength = BUFFER_SIZE;
    lBufferSize   = BUFFER_SIZE;
    StartTime();
    for(i = iIterations; i; i--)
        {
        status = BufferIn1(Binding, bBuffer, lBufferLength, lBufferSize);
        if (status != RPC_S_OK)
            {
            goto Cleanup;
            }
        }
    mseconds = EndTime();

    printf("%4d calls in %8d milliseconds - 100 byte buffer in (1).\n", iIterations, mseconds);

    lBufferLength = BUFFER_SIZE;

    StartTime();
    for(i = iIterations; i; i--)
        {
        status = BufferIn3(Binding, bBuffer, lBufferLength);
        if (status != RPC_S_OK)
            {
            goto Cleanup;
            }
        }
    mseconds = EndTime();

    printf("%4d calls in %8d milliseconds - 100 byte buffer in (2).\n", iIterations, mseconds);

    lBufferLength = BUFFER_SIZE;

    StartTime();
    for(i = iIterations; i; i--)
        {
        status = BufferIn3(Binding, bBuffer, lBufferLength);
        if (status != RPC_S_OK)
            {
            goto Cleanup;
            }
        }
    mseconds = EndTime();

    printf("%4d calls in %8d milliseconds - 100 byte buffer in (3).\n", iIterations, mseconds);

    // Time [out] buffer's

    lBufferLength = BUFFER_SIZE;

    StartTime();
    for(i = iIterations; i; i--)
        {
        status = BufferOut1(Binding, bBuffer, &lBufferLength);
        if (status != RPC_S_OK)
            {
            goto Cleanup;
            }
        }
    mseconds = EndTime();

    printf("%4d calls in %8d milliseconds - 100 byte buffer out (1).\n", iIterations, mseconds);

    lBufferLength = BUFFER_SIZE;
    lBufferSize   = BUFFER_SIZE;

    StartTime();
    for(i = iIterations; i; i--)
        {
        status = BufferOut2(Binding, bBuffer, lBufferSize, &lBufferLength);
        if (status != RPC_S_OK)
            {
            goto Cleanup;
            }
        }
    mseconds = EndTime();

    printf("%4d calls in %8d milliseconds - 100 byte buffer out (2).\n", iIterations, mseconds);

    StartTime();
    for(i = iIterations; i; i--)
        {
        BUFFER Buffer;
        Buffer.BufferLength = 0;
        Buffer.Buffer = 0;

        status = BufferOut3(Binding, &Buffer);
        if (status != RPC_S_OK)
            {
            goto Cleanup;
            }
        MIDL_user_free(Buffer.Buffer);
        }
    mseconds = EndTime();

    printf("%4d calls in %8d milliseconds - 100 byte buffer out (3).\n", iIterations, mseconds);

    lBufferLength = BUFFER_SIZE;

    StartTime();
    for(i = iIterations; i; i--)
        {
        status = BufferOut4(Binding, bBuffer, &lBufferLength);
        if (status != RPC_S_OK)
            {
            goto Cleanup;
            }
        }
    mseconds = EndTime();

    printf("%4d calls in %8d milliseconds - 100 byte buffer out (4).\n", iIterations, mseconds);

    // Time arrays of structures

    {
    struct BAD1 abad1[50];
    struct BAD2 abad2[50];
    struct GOOD agood[50];

    for (i = 0; i < 50; i++)
        {
        abad2[i].e = (BAD_ENUM)i % 4 + 1;
        agood[i].e = (GOOD_ENUM)i % 4 + 5;
        }

    StartTime();
    for(i = iIterations; i; i--)
        {
        status = StructsIn1(Binding, &abad1[0]);
        if (status != RPC_S_OK)
            {
            goto Cleanup;
            }
        }
    mseconds = EndTime();

    printf("%4d calls in %8d milliseconds - 2 mod 4 aligned structs.\n", iIterations, mseconds);

    StartTime();
    for(i = iIterations; i; i--)
        {
        status = StructsIn2(Binding, &abad2[0]);
        if (status != RPC_S_OK)
            {
            goto Cleanup;
            }
        }
    mseconds = EndTime();

    printf("%4d calls in %8d milliseconds - structs with an enum.\n", iIterations, mseconds);

    StartTime();
    for(i = iIterations; i; i--)
        {
        status = StructsIn3(Binding, &agood[0]);
        if (status != RPC_S_OK)
            {
            goto Cleanup;
            }
        }
    mseconds = EndTime();

    printf("%4d calls in %8d milliseconds - structs with v1_enum.\n", iIterations, mseconds);
    }

    // Linked lists

    {
    LIST list;
    PLIST plist = &list;
    for (i = 0; i < LIST_SIZE - 1; i++)
        {
        plist->pNext = MIDL_user_allocate(sizeof(LIST));
        plist->data = i;
        if (plist->pNext == 0)
            {
            status = RPC_S_OUT_OF_MEMORY;
            goto Cleanup;
            }
        plist = plist->pNext;
        }
    plist->data = i;
    plist->pNext = 0;

    StartTime();
    for(i = iIterations; i; i--)
        {
        status = ListIn(Binding, &list);
        if (status != RPC_S_OK)
            {
            goto Cleanup;
            }
        }
    mseconds = EndTime();

    printf("%4d calls in %8d milliseconds - [in] linked list.\n", iIterations, mseconds);

    StartTime();
    for(i = iIterations; i; i--)
        {
        status = ListOut1(Binding, &list);
        if (status != RPC_S_OK)
            {
            goto Cleanup;
            }
        // Freeing the list here would cause all the elements
        // to be allocated again on the next call.
        }
    mseconds = EndTime();

    printf("%4d calls in %8d milliseconds - [out] linked list (1).\n", iIterations, mseconds);

    StartTime();
    for(i = iIterations; i; i--)
        {
        status = ListOut2(Binding, &list);
        if (status != RPC_S_OK)
            {
            goto Cleanup;
            }
        // Freeing the list here would cause all the elements
        // to be allocated again on the next call.
        }
    mseconds = EndTime();

    printf("%4d calls in %8d milliseconds - [out] linked list (2).\n", iIterations, mseconds);

    // Free allocated elements of the list.
    plist = list.pNext;
    while(plist)
        {
        PLIST tmp = plist;
        plist = plist->pNext;
        MIDL_user_free(tmp);
        }
    }

    // Unions

    {
    BAD_UNION badunionArray[UNION_ARRAY_LEN];
    GOOD_UNION goodunion;
    ARM_ONE armone;
    ULONG ulArray[UNION_ARRAY_LEN];

    goodunion.Tag = 1;
    goodunion.u.pOne = &armone;
    armone.DataLength = UNION_ARRAY_LEN;
    armone.Data = ulArray;

    for(i = 0; i < UNION_ARRAY_LEN; i++)
        {
        ulArray[i] = i;
        badunionArray[i].Tag = 1;
        badunionArray[i].u.ulData = i;
        }

    StartTime();
    for(i = iIterations; i; i--)
        {
        status = UnionCall1(Binding, UNION_ARRAY_LEN, badunionArray);
        if (status != RPC_S_OK)
            {
            goto Cleanup;
            }
        }
    mseconds = EndTime();

    printf("%4d calls in %8d milliseconds - [in] array of unions.\n", iIterations, mseconds);

    StartTime();
    for(i = iIterations; i; i--)
        {
        status = UnionCall2(Binding, &goodunion);
        if (status != RPC_S_OK)
            {
            goto Cleanup;
            }
        }
    mseconds = EndTime();

    printf("%4d calls in %8d milliseconds - [in] union of arrays.\n", iIterations, mseconds);

    }

    // Time pings() (null calls) which impersonate the client.

    StartTime();
    for(i = iIterations; i; i--)
        {

        status = CheckSecurity(Binding);

        if (status != RPC_S_OK)
            {
            if (status == RPC_S_ACCESS_DENIED)
                {
                printf("Access denied, try -s 2 or higher.\n");
                return;
                }
            goto Cleanup;
            }

        }
    mseconds = EndTime();

    printf("%4d calls in %8d milliseconds - void call w/ impersonation\n", iIterations, mseconds);

Cleanup:

    if (status != RPC_S_OK)
        {
        printf("Call failed - %d\n", status);
        }

    return;
}

ULONG EndTime ( )

Definition at line 61 of file Client.C.

{
    LARGE_INTEGER liDiff;
    LARGE_INTEGER liFreq;

    QueryPerformanceCounter(&liDiff);

    liDiff.QuadPart -= Time.QuadPart;
    liDiff.QuadPart *= 1000; // Adjust to milliseconds, shouldn't overflow...

    (void)QueryPerformanceFrequency(&liFreq);

    return ((ULONG)(liDiff.QuadPart / liFreq.QuadPart));
}

int main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 447 of file Client.C.

{
    char *serverAddress = NULL;
    char *protocol = "ncalrpc";
    UINT iIterations = 100;
    unsigned char *stringBinding;
    RPC_BINDING_HANDLE Binding;
    RPC_STATUS status;
    ULONG SecurityLevel = RPC_C_AUTHN_LEVEL_NONE;

    argc--;
    argv++;
    while(argc)
        {
        if (   argv[0][0] != '-'
            && argv[0][0] != '/')
            {
            Usage();
            return(1);
            }

        switch(argv[0][1])
            {
            case 'n':
                if (argc < 2)
                    {
                    Usage();
                    return(1);
                    }
                serverAddress = argv[1];
                argc--;
                argv++;
                break;
            case 't':
                if (argc < 2)
                    {
                    Usage();
                    return(1);
                    }
                protocol = argv[1];
                argc--;
                argv++;
                break;
            case 'i':
                if (argc < 2)
                    {
                    Usage();
                    return(1);
                    }
                iIterations = atoi(argv[1]);
                argc--;
                argv++;
                break;
            case 's':
                if (argc < 2)
                    {
                    Usage();
                    return(1);
                    }
                SecurityLevel = atoi(argv[1]);
                if (SecurityLevel > RPC_C_AUTHN_LEVEL_PKT_PRIVACY)
                    {
                    Usage();
                    return(1);
                    }
                argc--;
                argv++;
                break;
            default:
                Usage();
                return(1);
                break;
            }

        argc--;
        argv++;
        }

    status = RpcStringBindingCompose(0,
                                     protocol,
                                     serverAddress,
                                     0,
                                     0,
                                     &stringBinding);
    if (status != RPC_S_OK)
        {
        printf("RpcStringBindingCompose failed - %d\n", status);
        return(1);
        }

    status = RpcBindingFromStringBinding(stringBinding, &Binding);

    if (status != RPC_S_OK)
        {
        printf("RpcBindingFromStringBinding failed - %d\n", status);
        return(1);
        }

    status =
    RpcBindingSetAuthInfo(Binding,
                          0,
                          SecurityLevel,
                          RPC_C_AUTHN_WINNT,
                          0,
                          0
                         );

    if (status != RPC_S_OK)
        {
        printf("RpcBindingSetAuthInfo failed - %d\n", status);
        return(1);
        }

    status = Ping(Binding);

    if (status != RPC_S_OK)
        {
        printf("Ping failed - %d\n", status);
        }

    printf("Connected.\n");

    //
    // Call and time various RPC calls.
    //

    DoTimings(Binding, iIterations);

    // Cleanup

    status = RpcBindingFree(&Binding);

    // ASSERT(status == RPC_S_OK):

    status = RpcStringFree(&stringBinding);

    // ASSERT(status == RPC_S_OK);

    return(0);
}

void* __RPC_USER MIDL_user_allocate ( size_t size )

Definition at line 588 of file Client.C.

{
    return(HeapAlloc(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS, size));
}

void __RPC_USER MIDL_user_free ( void * pointer )

Definition at line 593 of file Client.C.

{
    HeapFree(GetProcessHeap(), 0, pointer);
}

void StartTime ( void )

Definition at line 56 of file Client.C.

{
    QueryPerformanceCounter(&Time);
}

void Usage ( void )

Definition at line 30 of file Client.C.

{
    printf("Usage:\n"
        "\t-n <server addr>  - Defaults to local machine\n"
        "\t-t <protseq>      - Defaults to ncalrpc (fast, local only)\n"
        "\t-i <iterations>   - Defaults to 100\n"
        "\t-s <security lvl> - Default none, range none (1) to privacy (6)\n"
        );
    return;
}

Variable Documentation

LARGE_INTEGER Time

Definition at line 54 of file Client.C.

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/RPCsvc/RPCsvc.Idl File Reference

  • NetDS
  • RPC
  • RPCsvc

RPCsvc.Idl File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/RPCsvc/Server.c File Reference

  • NetDS
  • RPC
  • RPCsvc
Functions | Variables

Server.c File Reference

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <process.h>
#include <tchar.h>
#include <rpc.h>
#include "service.h"
#include "rpcsvc.h"

Go to the source code of this file.

Functions

error_status_t | BufferIn1 (handle_t h, byte Buffer[], unsigned long Length, unsigned long Size)
error_status_t | BufferIn2 (handle_t h, byte Buffer[], unsigned long Length)
error_status_t | BufferIn3 (handle_t h, byte Buffer[], unsigned long Length)
error_status_t | BufferOut1 (handle_t h, byte Buffer[], unsigned long *pLength)
error_status_t | BufferOut2 (handle_t h, byte Buffer[], unsigned long Size, unsigned long *pLength)
error_status_t | BufferOut3 (handle_t h, BUFFER *pBuffer)
error_status_t | BufferOut4 (handle_t h, byte Buffer[], unsigned long *pLength)
error_status_t | CheckSecurity (handle_t h)
error_status_t | ListIn (handle_t h, PLIST pList)
error_status_t | ListOut1 (handle_t h, LIST *pList)
error_status_t | ListOut2 (handle_t h, LIST *pList)
void *__RPC_USER | MIDL_user_allocate (size_t size)
void __RPC_USER | MIDL_user_free (void *pointer)
error_status_t | Ping (handle_t h)
VOID | ServiceStart (DWORD dwArgc, LPTSTR *lpszArgv)
VOID | ServiceStop ()
error_status_t | StructsIn1 (handle_t h, struct BAD1 array[50])
error_status_t | StructsIn2 (handle_t h, struct BAD2 array[50])
error_status_t | StructsIn3 (handle_t h, struct GOOD array[50])
error_status_t | UnionCall1 (handle_t h, unsigned long Length, BAD_UNION aUnion[])
error_status_t | UnionCall2 (handle_t h, GOOD_UNION *pUnion)

Variables

ULONG | MinimumThreads = 3
TCHAR * | ProtocolArray []
ULONG | ProtocolBuffer = 3

Function Documentation

error_status_t BufferIn1 | ( | handle_t | h,
 |  | byte | Buffer[],
 |  | unsigned long | Length,
 |  | unsigned long | Size
 | ) |  |

Definition at line 319 of file Server.c.

{
    return(0);
}

error_status_t BufferIn2 | ( | handle_t | h,
 |  | byte | Buffer[],
 |  | unsigned long | Length
 | ) |  |

Definition at line 330 of file Server.c.

{
    return(0);
}

error_status_t BufferIn3 | ( | handle_t | h,
 |  | byte | Buffer[],
 |  | unsigned long | Length
 | ) |  |

Definition at line 340 of file Server.c.

{
    return(0);
}

error_status_t BufferOut1 | ( | handle_t | h,
 |  | byte | Buffer[],
 |  | unsigned long * | pLength
 | ) |  |

Definition at line 363 of file Server.c.

{
    *pLength = BUFFER_SIZE;
    return(0);
}

error_status_t BufferOut2 | ( | handle_t | h,
 |  | byte | Buffer[],
 |  | unsigned long | Size,
 |  | unsigned long * | pLength
 | ) |  |

Definition at line 374 of file Server.c.

{
    *pLength = BUFFER_SIZE;
    return(0);
}

error_status_t BufferOut3 | ( | handle_t | h,
 |  | BUFFER * | pBuffer
 | ) |  |

Definition at line 386 of file Server.c.

{
    pBuffer->BufferLength = BUFFER_SIZE;
    pBuffer->Buffer = MIDL_user_allocate(BUFFER_SIZE);

    if (pBuffer->Buffer == 0)
        {
        return(RPC_S_OUT_OF_MEMORY);
        }
    return(0);
}

error_status_t BufferOut4 | ( | handle_t | h,
 |  | byte | Buffer[],
 |  | unsigned long * | pLength
 | ) |  |

Definition at line 402 of file Server.c.

{
    *pLength = BUFFER_SIZE;
    return(0);
}

error_status_t CheckSecurity ( handle_t h )

Definition at line 568 of file Server.c.

{
    RPC_STATUS status;

    // At this point the thread is running in the server
    // security context.  There is guarantee that the client
    // even used a secure connection.

    status = RpcImpersonateClient(h);

    if (status != RPC_S_OK)
        {
        return(RPC_S_ACCESS_DENIED);
        }

    // This thread is now running in the clients security context.

    //
    // The server should now open a file, mutex, event or its own data
    // structure which has an ACL associated with it to check that the
    // client has the right to access the server's protected data.
    //

    status = RpcRevertToSelf();

    // ASSERT(status == RPC_S_OK);

    // This thread is now running in the server's security context.

    return(0);
}

error_status_t ListIn | ( | handle_t | h,
 |  | PLIST | pList
 | ) |  |

Definition at line 470 of file Server.c.

{
    return(0);
}

error_status_t ListOut1 | ( | handle_t | h,
 |  | LIST * | pList
 | ) |  |

Definition at line 479 of file Server.c.

{
    int i;
    for(i = 0; i < LIST_SIZE; i++)
        {
        pList->data = i;
        pList->pNext = MIDL_user_allocate(sizeof(LIST));
        if (pList->pNext == 0)
            {
            return(RPC_S_OUT_OF_MEMORY);
            }
        pList = pList->pNext;
        }

    pList->data = i;
    pList->pNext = 0;

    return(0);
}

error_status_t ListOut2 | ( | handle_t | h,
 |  | LIST * | pList
 | ) |  |

Definition at line 503 of file Server.c.

{
    int i;
    for(i = 0; i < LIST_SIZE; i++)
        {
        pList->data = i;
        pList->pNext = RpcSsAllocate(sizeof(LIST));
        // RpcSsAllocate raises an exception when it
        // fails.  Use RpcSmAllocate is this is
        // undesirable.
        pList = pList->pNext;
        }

    pList->data = i;
    pList->pNext = 0;

    return(0);
}

void* __RPC_USER MIDL_user_allocate ( size_t size )

Definition at line 620 of file Server.c.

{
    return(HeapAlloc(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS, size));
}

void __RPC_USER MIDL_user_free ( void * pointer )

Definition at line 625 of file Server.c.

{
    HeapFree(GetProcessHeap(), 0, pointer);
}

error_status_t Ping ( handle_t h )

Definition at line 298 of file Server.c.

{
    return(0);
}

VOID ServiceStart | ( | DWORD | dwArgc,
 |  | LPTSTR * | lpszArgv
 | ) |  |

Definition at line 77 of file Server.c.

{
    UINT i;
    RPC_BINDING_VECTOR *pbindingVector = 0;
    RPC_STATUS status;
    BOOL fListening = FALSE;

    ///////////////////////////////////////////////////
    //
    // Service initialization
    //

    //
    // Use protocol sequences (protseqs) specified in ProtocolArray.
    //

    for(i = 0; i < sizeof(ProtocolArray)/sizeof(TCHAR *); i++)
        {

        // Report the status to the service control manager.
        if (!ReportStatusToSCMgr(
            SERVICE_START_PENDING, // service state
            NO_ERROR,              // exit code
            3000))                 // wait hint
            return;

        status = RpcServerUseProtseq(ProtocolArray[i],
                                     ProtocolBuffer,
                                     0);

        if (status == RPC_S_OK)
            {
            fListening = TRUE;
            }
        }

    if (!fListening)
        {
        // Unable to listen to any protocol!
        //
        AddToMessageLog(TEXT("RpcServerUseProtseq() failed\n"));
        return;
        }

    // Report the status to the service control manager.
    //
    if (!ReportStatusToSCMgr(
        SERVICE_START_PENDING, // service state
        NO_ERROR,              // exit code
        3000))                 // wait hint
        return;

    // Register the services interface(s).
    //

    status = RpcServerRegisterIf(RpcServiceSample_v1_0_s_ifspec,   // from rpcsvc.h
                                 0,
                                 0);

    if (status != RPC_S_OK)
        return;

    // Report the status to the service control manager.
    //
    if (!ReportStatusToSCMgr(
        SERVICE_START_PENDING, // service state
        NO_ERROR,              // exit code
        3000))                 // wait hint
        return;

    // Register interface(s) and binding(s) (endpoints) with
    // the endpoint mapper.
    //

    status = RpcServerInqBindings(&pbindingVector);

    if (status != RPC_S_OK)
        {
        return;
        }

    status = RpcEpRegister(RpcServiceSample_v1_0_s_ifspec,   // from rpcsvc.h
                           pbindingVector,
                           0,
                           0);

    if (status != RPC_S_OK)
        {
        return;
        }

    // Report the status to the service control manager.
    //
    if (!ReportStatusToSCMgr(
        SERVICE_START_PENDING, // service state
        NO_ERROR,              // exit code
        3000))                 // wait hint
        return;

    // Enable NT LM Security Support Provider (NtLmSsp service)
    //
    status = RpcServerRegisterAuthInfo(0,
                                       RPC_C_AUTHN_WINNT,
                                       0,
                                       0
                                       );
    if (status != RPC_S_OK)
        {
        return;
        }

    // Report the status to the service control manager.
    //
    if (!ReportStatusToSCMgr(
        SERVICE_START_PENDING, // service state
        NO_ERROR,              // exit code
        3000))                 // wait hint
        return;

    // Start accepting client calls.
    //
    status = RpcServerListen(MinimumThreads,
                             RPC_C_LISTEN_MAX_CALLS_DEFAULT,  // rpcdce.h
                             TRUE);                           // don't block.

    if (status != RPC_S_OK)
        {
        return;
        }

    // Report the status to the service control manager.
    //
    if (!ReportStatusToSCMgr(
        SERVICE_RUNNING,       // service state
        NO_ERROR,              // exit code
        0))                    // wait hint
        return;

    //
    // End of initialization
    //
    ////////////////////////////////////////////////////////////

    ////////////////////////////////////////////////////////////
    //
    // Cleanup
    //

    // RpcMgmtWaitServerListen() will block until the server has
    // stopped listening.  If this service had something better to
    // do with this thread, it would delay this call until
    // ServiceStop() had been called. (Set an event in ServiceStop()).
    //
    status = RpcMgmtWaitServerListen();

    // ASSERT(status == RPC_S_OK)

    // Remove entries from the endpoint mapper database.
    //
    RpcEpUnregister(RpcServiceSample_v1_0_s_ifspec,   // from rpcsvc.h
                    pbindingVector,
                    0);

    // Delete the binding vector
    //
    RpcBindingVectorFree(&pbindingVector);

    //
    ////////////////////////////////////////////////////////////
    return;
}

VOID ServiceStop ( )

Definition at line 273 of file Server.c.

{
    // Stop's the server, wakes the main thread.

    RpcMgmtStopServerListening(0);
}

error_status_t StructsIn1 | ( | handle_t | h,
 |  | struct BAD1 | array[50]
 | ) |  |

Definition at line 425 of file Server.c.

{
    return(0);
}

error_status_t StructsIn2 | ( | handle_t | h,
 |  | struct BAD2 | array[50]
 | ) |  |

Definition at line 434 of file Server.c.

{
    return(0);
}

error_status_t StructsIn3 | ( | handle_t | h,
 |  | struct GOOD | array[50]
 | ) |  |

Definition at line 443 of file Server.c.

{
    return(0);
}

error_status_t UnionCall1 | ( | handle_t | h,
 |  | unsigned long | Length,
 |  | BAD_UNION | aUnion[]
 | ) |  |

Definition at line 538 of file Server.c.

{
    return(0);
}

error_status_t UnionCall2 | ( | handle_t | h,
 |  | GOOD_UNION * | pUnion
 | ) |  |

Definition at line 548 of file Server.c.

{
    return(0);
}

Variable Documentation

ULONG MinimumThreads = 3

Definition at line 59 of file Server.c.

TCHAR* ProtocolArray[]
Initial value:
 { TEXT("ncalrpc"),
                           TEXT("ncacn_ip_tcp"),
                           TEXT("ncacn_np"),

                         }

Definition at line 47 of file Server.c.

ULONG ProtocolBuffer = 3

Definition at line 55 of file Server.c.

Generated on Wed Nov 13 2024 16:54:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/RPCsvc/Service.C File Reference

  • NetDS
  • RPC
  • RPCsvc
Functions | Variables

Service.C File Reference

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <process.h>
#include <tchar.h>
#include "service.h"

Go to the source code of this file.

Functions

VOID | AddToMessageLog (LPTSTR lpszMsg)
VOID | CmdDebugService (int argc, char **argv)
VOID | CmdInstallService ()
VOID | CmdRemoveService ()
BOOL WINAPI | ControlHandler (DWORD dwCtrlType)
LPTSTR | GetLastErrorText (LPTSTR lpszBuf, DWORD dwSize)
void | main (int argc, char **argv)
BOOL | ReportStatusToSCMgr (DWORD dwCurrentState, DWORD dwWin32ExitCode, DWORD dwWaitHint)
VOID WINAPI | service_ctrl (DWORD dwCtrlCode)
VOID WINAPI | service_main (DWORD dwArgc, LPTSTR *lpszArgv)

Variables

BOOL | bDebug = FALSE
DWORD | dwErr = 0
SERVICE_STATUS_HANDLE | sshStatusHandle
SERVICE_STATUS | ssStatus
TCHAR | szErr [256]

Function Documentation

VOID AddToMessageLog ( LPTSTR lpszMsg )

Definition at line 292 of file Service.C.

{
    TCHAR   szMsg[256];
    HANDLE  hEventSource;
    LPTSTR  lpszStrings[2];

    if ( !bDebug )
    {
        dwErr = GetLastError();

        // Use event logging to log the error.
        //
        hEventSource = RegisterEventSource(NULL, TEXT(SZSERVICENAME));

        _stprintf(szMsg, TEXT("%s error: %d"), TEXT(SZSERVICENAME), dwErr);
        lpszStrings[0] = szMsg;
        lpszStrings[1] = lpszMsg;

        if (hEventSource != NULL) {
            ReportEvent(hEventSource, // handle of event source
                EVENTLOG_ERROR_TYPE,  // event type
                0,                    // event category
                0,                    // event ID
                NULL,                 // current user's SID
                2,                    // strings in lpszStrings
                0,                    // no bytes of raw data
                lpszStrings,          // array of error strings
                NULL);                // no raw data

            (VOID) DeregisterEventSource(hEventSource);
        }
    }
}

void CmdDebugService | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 496 of file Service.C.

{
    DWORD dwArgc;
    LPTSTR *lpszArgv;

#ifdef UNICODE
    lpszArgv = CommandLineToArgvW(GetCommandLineW(), &(dwArgc) );
#else
    dwArgc   = (DWORD) argc;
    lpszArgv = argv;
#endif

    _tprintf(TEXT("Debugging %s.\n"), TEXT(SZSERVICEDISPLAYNAME));

    SetConsoleCtrlHandler( ControlHandler, TRUE );

    ServiceStart( dwArgc, lpszArgv );
}

void CmdInstallService ( )

Definition at line 349 of file Service.C.

{
    SC_HANDLE   schService;
    SC_HANDLE   schSCManager;

    TCHAR szPath[512];

    if ( GetModuleFileName( NULL, szPath, 512 ) == 0 )
    {
        _tprintf(TEXT("Unable to install %s - %s\n"), TEXT(SZSERVICEDISPLAYNAME), GetLastErrorText(szErr, 256));
        return;
    }

    schSCManager = OpenSCManager(
                        NULL,                   // machine (NULL == local)
                        NULL,                   // database (NULL == default)
                        SC_MANAGER_ALL_ACCESS   // access required
                        );
    if ( schSCManager )
    {
        schService = CreateService(
            schSCManager,               // SCManager database
            TEXT(SZSERVICENAME),        // name of service
            TEXT(SZSERVICEDISPLAYNAME), // name to display
            SERVICE_ALL_ACCESS,         // desired access
            SERVICE_WIN32_OWN_PROCESS,  // service type
            SERVICE_DEMAND_START,       // start type
            SERVICE_ERROR_NORMAL,       // error control type
            szPath,                     // service's binary
            NULL,                       // no load ordering group
            NULL,                       // no tag identifier
            TEXT(SZDEPENDENCIES),       // dependencies
            NULL,                       // LocalSystem account
            NULL);                      // no password

        if ( schService )
        {
            _tprintf(TEXT("%s installed.\n"), TEXT(SZSERVICEDISPLAYNAME) );
            CloseServiceHandle(schService);
        }
        else
        {
            _tprintf(TEXT("CreateService failed - %s\n"), GetLastErrorText(szErr, 256));
        }

        CloseServiceHandle(schSCManager);
    }
    else
        _tprintf(TEXT("OpenSCManager failed - %s\n"), GetLastErrorText(szErr,256));
}

void CmdRemoveService ( )

Definition at line 415 of file Service.C.

{
    SC_HANDLE   schService;
    SC_HANDLE   schSCManager;

    schSCManager = OpenSCManager(
                        NULL,                   // machine (NULL == local)
                        NULL,                   // database (NULL == default)
                        SC_MANAGER_ALL_ACCESS   // access required
                        );
    if ( schSCManager )
    {
        schService = OpenService(schSCManager, TEXT(SZSERVICENAME), SERVICE_ALL_ACCESS);

        if (schService)
        {
            // try to stop the service
            if ( ControlService( schService, SERVICE_CONTROL_STOP, &ssStatus ) )
            {
                _tprintf(TEXT("Stopping %s."), TEXT(SZSERVICEDISPLAYNAME));
                Sleep( 1000 );

                while( QueryServiceStatus( schService, &ssStatus ) )
                {
                    if ( ssStatus.dwCurrentState == SERVICE_STOP_PENDING )
                    {
                        _tprintf(TEXT("."));
                        Sleep( 1000 );
                    }
                    else
                        break;
                }

                if ( ssStatus.dwCurrentState == SERVICE_STOPPED )
                    _tprintf(TEXT("\n%s stopped.\n"), TEXT(SZSERVICEDISPLAYNAME) );
                else
                    _tprintf(TEXT("\n%s failed to stop.\n"), TEXT(SZSERVICEDISPLAYNAME) );

            }

            // now remove the service
            if( DeleteService(schService) )
                _tprintf(TEXT("%s removed.\n"), TEXT(SZSERVICEDISPLAYNAME) );
            else
                _tprintf(TEXT("DeleteService failed - %s\n"), GetLastErrorText(szErr,256));

            CloseServiceHandle(schService);
        }
        else
            _tprintf(TEXT("OpenService failed - %s\n"), GetLastErrorText(szErr,256));

        CloseServiceHandle(schSCManager);
    }
    else
        _tprintf(TEXT("OpenSCManager failed - %s\n"), GetLastErrorText(szErr,256));
}

BOOL WINAPI ControlHandler ( DWORD dwCtrlType )

Definition at line 530 of file Service.C.

{
    switch( dwCtrlType )
    {
        case CTRL_BREAK_EVENT:  // use Ctrl+C or Ctrl+Break to simulate
        case CTRL_C_EVENT:      // SERVICE_CONTROL_STOP in debug mode
            _tprintf(TEXT("Stopping %s.\n"), TEXT(SZSERVICEDISPLAYNAME));
            ServiceStop();
            return TRUE;
            break;

    }
    return FALSE;
}

LPTSTR GetLastErrorText | ( | LPTSTR | lpszBuf,
 |  | DWORD | dwSize
 | ) |  |

Definition at line 559 of file Service.C.

{
    DWORD dwRet;
    LPTSTR lpszTemp = NULL;

    dwRet = FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |FORMAT_MESSAGE_ARGUMENT_ARRAY,
                           NULL,
                           GetLastError(),
                           LANG_NEUTRAL,
                           (LPTSTR)&lpszTemp,
                           0,
                           NULL );

    // supplied buffer is not long enough
    if ( !dwRet || ( (long)dwSize < (long)dwRet+14 ) )
        lpszBuf[0] = TEXT('\0');
    else
    {
        lpszTemp[lstrlen(lpszTemp)-2] = TEXT('\0');  //remove cr and newline character
        _stprintf( lpszBuf, TEXT("%s (0x%x)"), lpszTemp, GetLastError() );
    }

    if ( lpszTemp )
        LocalFree((HLOCAL) lpszTemp );

    return lpszBuf;
}

void main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 73 of file Service.C.

{
    SERVICE_TABLE_ENTRY dispatchTable[] =
    {
        { TEXT(SZSERVICENAME), (LPSERVICE_MAIN_FUNCTION)service_main },
        { NULL, NULL }
    };

    if ( (argc > 1) &&
         ((*argv[1] == '-') || (*argv[1] == '/')) )
    {
        if ( _stricmp( "install", argv[1]+1 ) == 0 )
        {
            CmdInstallService();
        }
        else if ( _stricmp( "remove", argv[1]+1 ) == 0 )
        {
            CmdRemoveService();
        }
        else if ( _stricmp( "debug", argv[1]+1 ) == 0 )
        {
            bDebug = TRUE;
            CmdDebugService(argc, argv);
        }
        else
        {
            goto dispatch;
        }
        exit(0);
    }

    // if it doesn't match any of the above parameters
    // the service control manager may be starting the service
    // so we must call StartServiceCtrlDispatcher
    dispatch:
        // this is just to be friendly
        printf( "%s -install          to install the service\n", SZAPPNAME );
        printf( "%s -remove           to remove the service\n", SZAPPNAME );
        printf( "%s -debug <params>   to run as a console app for debugging\n", SZAPPNAME );
        printf( "\nStartServiceCtrlDispatcher being called.\n" );
        printf( "This may take several seconds.  Please wait.\n" );

        if (!StartServiceCtrlDispatcher(dispatchTable))
            AddToMessageLog(TEXT("StartServiceCtrlDispatcher failed."));
}

BOOL ReportStatusToSCMgr | ( | DWORD | dwCurrentState,
 |  | DWORD | dwWin32ExitCode,
 |  | DWORD | dwWaitHint
 | ) |  |

Definition at line 242 of file Service.C.

{
    static DWORD dwCheckPoint = 1;
    BOOL fResult = TRUE;

    if ( !bDebug ) // when debugging we don't report to the SCM
    {
        if (dwCurrentState == SERVICE_START_PENDING)
            ssStatus.dwControlsAccepted = 0;
        else
            ssStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP;

        ssStatus.dwCurrentState = dwCurrentState;
        ssStatus.dwWin32ExitCode = dwWin32ExitCode;
        ssStatus.dwWaitHint = dwWaitHint;

        if ( ( dwCurrentState == SERVICE_RUNNING ) ||
             ( dwCurrentState == SERVICE_STOPPED ) )
            ssStatus.dwCheckPoint = 0;
        else
            ssStatus.dwCheckPoint = dwCheckPoint++;

        // Report the status of the service to the service control manager.
        //
        if (!(fResult = SetServiceStatus( sshStatusHandle, &ssStatus))) {
            AddToMessageLog(TEXT("SetServiceStatus"));
        }
    }
    return fResult;
}

VOID WINAPI service_ctrl ( DWORD dwCtrlCode )

Definition at line 194 of file Service.C.

{
    // Handle the requested control code.
    //
    switch(dwCtrlCode)
    {
        // Stop the service.
        //
        case SERVICE_CONTROL_STOP:
            ReportStatusToSCMgr(SERVICE_STOP_PENDING, NO_ERROR, 0);
            ServiceStop();
            return;

        // Update the service status.
        //
        case SERVICE_CONTROL_INTERROGATE:
            break;

        // invalid control code
        //
        default:
            break;

    }

    ReportStatusToSCMgr(ssStatus.dwCurrentState, NO_ERROR, 0);

}

void WINAPI service_main | ( | DWORD | dwArgc,
 |  | LPTSTR * | lpszArgv
 | ) |  |

Definition at line 138 of file Service.C.

{

    // register our service control handler:
    //
    sshStatusHandle = RegisterServiceCtrlHandler( TEXT(SZSERVICENAME), service_ctrl);

    if (!sshStatusHandle)
        goto cleanup;

    // SERVICE_STATUS members that don't change in example
    //
    ssStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
    ssStatus.dwServiceSpecificExitCode = 0;

    // report the status to the service control manager.
    //
    if (!ReportStatusToSCMgr(
        SERVICE_START_PENDING, // service state
        NO_ERROR,              // exit code
        3000))                 // wait hint
        goto cleanup;

    ServiceStart( dwArgc, lpszArgv );

cleanup:

    // try to report the stopped status to the service control manager.
    //
    if (sshStatusHandle)
        (VOID)ReportStatusToSCMgr(
                            SERVICE_STOPPED,
                            dwErr,
                            0);

    return;
}

Variable Documentation

BOOL bDebug = FALSE

Definition at line 43 of file Service.C.

DWORD dwErr = 0

Definition at line 42 of file Service.C.

SERVICE_STATUS_HANDLE sshStatusHandle

Definition at line 41 of file Service.C.

SERVICE_STATUS ssStatus

Definition at line 40 of file Service.C.

TCHAR szErr[256]

Definition at line 44 of file Service.C.

Generated on Wed Nov 13 2024 16:54:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/RPCsvc/Service.H File Reference

  • NetDS
  • RPC
  • RPCsvc
Defines | Functions

Service.H File Reference

Go to the source code of this file.

Defines

#define | SZAPPNAME "RpcSvc"
#define | SZDEPENDENCIES "RPCSS\0\0"
#define | SZSERVICEDISPLAYNAME "Simple RPC Service"
#define | SZSERVICENAME "SimpleRpcService"

Functions

void | AddToMessageLog (LPTSTR lpszMsg)
BOOL | ReportStatusToSCMgr (DWORD dwCurrentState, DWORD dwWin32ExitCode, DWORD dwWaitHint)
VOID | ServiceStart (DWORD dwArgc, LPTSTR *lpszArgv)
VOID | ServiceStop ()

Define Documentation

#define SZAPPNAME "RpcSvc"

Definition at line 65 of file Service.H.

#define SZDEPENDENCIES "RPCSS\0\0"

Definition at line 71 of file Service.H.

#define SZSERVICEDISPLAYNAME "Simple RPC Service"

Definition at line 69 of file Service.H.

#define SZSERVICENAME "SimpleRpcService"

Definition at line 67 of file Service.H.

Function Documentation

void AddToMessageLog ( LPTSTR lpszMsg )

Definition at line 598 of file Service.cpp.

                                    {
    TCHAR szMsg1[256];
    HANDLE hEventSource;
    LPTSTR lpszStrings[2];
    DWORD dwErr = 0;

    dwErr = GetLastError();

    // Use event logging to log the error.
    hEventSource = RegisterEventSource(NULL, SERVICENAME);

    _stprintf(szMsg1, TEXT("%s error: %d"), SERVICENAME, dwErr);
    lpszStrings[0] = szMsg1;
    lpszStrings[1] = szMsg2;

    if (hEventSource != NULL) {
        ReportEvent(hEventSource, // handle of event source
                    EVENTLOG_ERROR_TYPE, // event type
                    0, // event category
                    0, // event ID
                    NULL, // current user's SID
                    2, // strings in lpszStrings
                    0, // no bytes of raw data
                    (LPCTSTR *) lpszStrings, // array of error strings
                    NULL); // no raw data

        (VOID) DeregisterEventSource(hEventSource);
    }
}

BOOL ReportStatusToSCMgr | ( | DWORD | dwCurrentState,
 |  | DWORD | dwWin32ExitCode,
 |  | DWORD | dwWaitHint
 | ) |  |

Definition at line 242 of file Service.C.

{
    static DWORD dwCheckPoint = 1;
    BOOL fResult = TRUE;

    if ( !bDebug ) // when debugging we don't report to the SCM
    {
        if (dwCurrentState == SERVICE_START_PENDING)
            ssStatus.dwControlsAccepted = 0;
        else
            ssStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP;

        ssStatus.dwCurrentState = dwCurrentState;
        ssStatus.dwWin32ExitCode = dwWin32ExitCode;
        ssStatus.dwWaitHint = dwWaitHint;

        if ( ( dwCurrentState == SERVICE_RUNNING ) ||
             ( dwCurrentState == SERVICE_STOPPED ) )
            ssStatus.dwCheckPoint = 0;
        else
            ssStatus.dwCheckPoint = dwCheckPoint++;

        // Report the status of the service to the service control manager.
        //
        if (!(fResult = SetServiceStatus( sshStatusHandle, &ssStatus))) {
            AddToMessageLog(TEXT("SetServiceStatus"));
        }
    }
    return fResult;
}

VOID ServiceStart | ( | DWORD | dwArgc,
 |  | LPTSTR * | lpszArgv
 | ) |  |

Definition at line 195 of file FileRepService.cpp.

                                                   {
  RPC_STATUS status;

    // Report the status to the service control manager.
    if (!ReportStatusToSCMgr(&sshStatusHandle, &ssStatus, SERVICE_START_PENDING, NO_ERROR, 1000)) {
        AddToMessageLog(TEXT("ServiceStart: ReportStatusToSCMgr failed\n"));
        ServiceStop();
        return;
    }

    // Allow the user to override settings with command line switches.
    for (unsigned i = 1; i < dwArgc; i++) {
        // Well-formed argument switches start with '/' or '-' and are
        // two characters long.
        if (((*szArgList[i] == TEXT('-')) || (*szArgList[i] == TEXT('/'))) && _tcsclen(szArgList[i]) == 2) {

            switch (_totlower(*(szArgList[i]+1))) {

                case TEXT('f'):
      bNoFileIO = true;
      break;

                default:
      AddToMessageLog(TEXT("ServiceStart: bad arguments"));
      ServiceStop();
      return;
            }
        }
        else {
    AddToMessageLog(TEXT("ServiceStart: bad arguments"));
    ServiceStop();
    return;
        }
    }

    if (!StartFileRepServer()) {
      ServiceStop();
    }
    else {
      bServerListening = TRUE;

      // Tell The SCM that the service is running.
      if (!ReportStatusToSCMgr(&sshStatusHandle, &ssStatus, SERVICE_RUNNING, NO_ERROR, 0)){
        AddToMessageLog(TEXT("ServiceStart: ReportStatusToSCMgr failed"));
        ServiceStop();
        return;
      }

      // RpcMgmtWaitServerListen() will block until the server has
      // stopped listening.
      status = RpcMgmtWaitServerListen();
      if (status != RPC_S_OK){
        AddToMessageLogProcFailureEEInfo(TEXT("ServiceStart: RpcMgmtWaitServerListen"), status);
        ServiceStop();
        return;
      }
    }

    return;
}

VOID ServiceStop ( )

Definition at line 610 of file filerepservice.cpp.

                   {
    RPC_STATUS status;

    // Stops the server, wakes up the main thread.
    if (bServerListening) {
        status = RpcMgmtStopServerListening(NULL);
        if(status != RPC_S_OK) {
                    AddToMessageLogProcFailureEEInfo(TEXT("ServiceStart: RpcMgmtWaitServerListen"), status);
        }
        bServerListening = FALSE;
    }

    // Delete the binding vector.
    status = RpcServerUnregisterIf(NULL, NULL, FALSE);
    if(status != RPC_S_OK){
        AddToMessageLogProcFailureEEInfo(TEXT("ServiceStart: RpcServerUnregisterIf"), status);
    }

    // Tell The SCM that the service is stopped.
    if(!ReportStatusToSCMgr(&sshStatusHandle, &ssStatus, SERVICE_STOPPED, NO_ERROR, 0)) {
        AddToMessageLogProcFailure(TEXT("ServiceStop: ReportStatusToSCMgr"), GetLastError());
    }

    // Wait for the client threads to finish so
    // that we do not deallocate active data structures.
    // We can accomplish this by waiting for the counters
    // to become zero.  Performing a check in this
    // order should prevent race conditions, since
    // pClientActiveReqCounters are incremented before
    // pClientReqCounters are decremented.
    if (fServerReqCountersCreated) {
        if (CountersCheckForNonzero(pServerReqCounters, NumPriGroups)) {
            Sleep(1000);
        }
    }
    if (fClientReqCountersCreated) {
        if (CountersCheckForNonzero(pClientReqCounters, NumPriGroups)) {
            Sleep(1000);
        }
    }
    if (fClientActiveReqCountersCreated) {
        if (CountersCheckForNonzero(pClientActiveReqCounters, NumPriGroups)) {
            Sleep(1000);
        }
    }

    DeleteWellKnownSids();

    // Delete queues and counters.
    if (fServerReqCountersCreated) {
        CountersDelete(pServerReqCounters, NumPriGroups);
        fServerReqCountersCreated = FALSE;
    }
    if (fClientReqCountersCreated) {
        CountersDelete(pClientReqCounters, NumPriGroups);
        fClientReqCountersCreated = FALSE;
    }
    if (fClientActiveReqCountersCreated) {
        CountersDelete(pClientActiveReqCounters, NumPriGroups);
        fClientActiveReqCountersCreated = FALSE;
    }
    if (fClientReqQueuesCreated) {
        QueuesDelete(ClientReqQueues, NumPriGroups);
        fClientReqQueuesCreated = FALSE;
    }
    if (fClientActiveReqHashQueuesCreated) {
        QueuesDelete(ClientActiveReqHashQueues, NumPriGroups);
        fClientActiveReqHashQueuesCreated = FALSE;
    }
    if (fClientActiveReqHashCountersCreated) {
        QueuesDelete(ClientActiveReqHashCounters, NumPriGroups);
        fClientActiveReqHashCountersCreated = FALSE;
    }

#ifdef PROF
    if (fProfOpenedLog) {
        ProfCloseLog();
        fProfOpenedLog = FALSE;
    }
#endif

#ifdef DEBUG
    if (fDbgMsgOpenedLog) {
        DbgMsgCloseLog();
        fDbgMsgOpenedLog = FALSE;
    }
#endif

}

Generated on Wed Nov 13 2024 16:54:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/StrOut/Client.c File Reference

  • NetDS
  • RPC
  • StrOut
Functions

Client.c File Reference

#include "strout.h"
#include "common.h"

Go to the source code of this file.

Functions

int | main (int argc, char *argv[])
void __RPC_FAR *__RPC_API | midl_user_allocate (size_t nLen)
void __RPC_API | midl_user_free (void __RPC_FAR *lpvPointer)
void | Usage (_TUCHAR *pszProgramName)

Function Documentation

int main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 48 of file Client.c.

{
    RPC_STATUS nStatus;     /* Return value from the RPC calls          */
    unsigned int
        nIdx,               /* Counter in loops                         */
        nNumArgs;           /* Number of commandline arguments          */
    unsigned long
        nNumLines = 0;      /* Number of lines in the environment block */
    str *pEnvBlock;         /* Pointer to an array of string pointers   */

    // These variables are used for the implicit binding
    _TUCHAR *pszUuid            = NULL;
    _TUCHAR *pszProtocolSequence= PROTOCOL_SEQUENCE;
    _TUCHAR *pszNetworkAddress  = NULL;
    _TUCHAR *pszEndpoint        = END_POINT;
    _TUCHAR *pszOptions         = NULL;
    _TUCHAR *pszStringBinding   = NULL;

    /* Get a common handle on the command line arguments for both       */
    /* UNICODE and ASCII                                                */
#ifdef _UNICODE
    LPWSTR  *szArglist = CommandLineToArgvW(GetCommandLine(), &nNumArgs);
    if (NULL == szArglist)
    {
        _tprintf(TEXT("SERVER.C : CommandLineToArgW failed"));
        exit(EXECUTION_FAILED);
    }
#else
    char **szArglist= argv;
    nNumArgs = argc;
#endif

    /* Allow the user to override settings with commandline switches    */
    for (nIdx = 1; nIdx < nNumArgs; nIdx++)
    {
        if ((_tcscmp(szArglist[nIdx], TEXT("-n")) == 0) ||
            (_tcscmp(szArglist[nIdx], TEXT("-N")) == 0))
        {
            pszNetworkAddress = szArglist[++nIdx];
        }
        else if((_tcscmp(szArglist[nIdx], TEXT("-p")) == 0) ||
            (_tcscmp(szArglist[nIdx], TEXT("-P")) == 0))
        {
            pszProtocolSequence = szArglist[++nIdx];
        }
        else if((_tcscmp(szArglist[nIdx], TEXT("-e")) == 0) ||
                (_tcscmp(szArglist[nIdx], TEXT("-e")) == 0))
        {
            pszEndpoint = szArglist[++nIdx];
        }
        else if((_tcscmp(szArglist[nIdx], TEXT("-o")) == 0) ||
                (_tcscmp(szArglist[nIdx], TEXT("-O")) == 0))
        {
            pszOptions = szArglist[++nIdx];
        }
        else
        {
            Usage(szArglist[0]);
        }
    }

    /* Since we are using implicit binding, we need to do some binding  */
    /* from the client side as well.                                    */
    /* Use a function to concatenate the elements of the string         */
    /* binding into the proper sequence                                 */
    nStatus = RpcStringBindingCompose(
        pszUuid,
        pszProtocolSequence,
        pszNetworkAddress,
        pszEndpoint,
        pszOptions,
        &pszStringBinding);
    EXIT_IF_FAIL(nStatus, "RpcStringBindingCompose");

    /* Set the binding handle that will be used to bind to the server   */
    nStatus = RpcBindingFromStringBinding(
        pszStringBinding,
        &global_strout_sample_handle);      /* The global handle used   */
    EXIT_IF_FAIL(nStatus, "RpcBindingFromStringBinding");

    /* Initialize the pointer to NULL */
    pEnvBlock = NULL;

    RpcTryExcept                /* Catch any exception that occurs      */
    {
        /* Call the remote procedure */
        _tprintf(TEXT("Calling the remote procedure \'GetRemoteEnv\' \n"));
        GetRemoteEnv(&nNumLines, &pEnvBlock);
    }
    RpcExcept(DO_EXCEPTION)
    {
        _tprintf(TEXT("Run-time exception %08X = %d in %s\n"),
            RpcExceptionCode(), RpcExceptionCode(), TEXT(__FILE__));
        exit(EXECUTION_FAILED);
    }
    RpcEndExcept

    /* Print out the result */
    _tprintf(TEXT("There are %d environment variables\n"), nNumLines);
    _tprintf(TEXT("They are:\n"));
    for (nIdx = 0; nIdx < nNumLines; nIdx++)
    {
        _tprintf(TEXT("\t%s\n"), pEnvBlock[nIdx]);
    }

    // Deallocate all the memory used for the EnvBlock
    for (nIdx = 0; nIdx < nNumLines; nIdx++)
    {
        midl_user_free(pEnvBlock[nIdx]);
    }
    midl_user_free(pEnvBlock);

    // Deallocate the memory used for the ARGLIST if using UNICODE
#ifdef _UNICODE
    if (NULL != szArglist)
        free(szArglist);
#endif

    /* When the call is done, shut down the server application */
    ShutDown();

    return (EXECUTION_OK);
}

void __RPC_FAR* __RPC_API midl_user_allocate ( size_t nLen )

Definition at line 186 of file Client.c.

{
    return (malloc(nLen));
}

void __RPC_API midl_user_free ( void __RPC_FAR * lpvPointer )

Definition at line 191 of file Client.c.

{
    if (lpvPointer != NULL)
        free (lpvPointer);
}

void Usage ( _TUCHAR * pszProgramName )

Definition at line 34 of file Client.c.

{
    _tprintf(TEXT("USAGE : %s [-option]\n"), pszProgramName);
    _tprintf(TEXT("Options : -n Network Address\n"));
    _tprintf(TEXT("          -p Protocol Sequence\n"));
    _tprintf(TEXT("          -e Endpoint\n"));
    _tprintf(TEXT("          -o Options\n"));
    exit(EXECUTION_FAILED);
}

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/StrOut/Common.h File Reference

  • NetDS
  • RPC
  • StrOut
Defines

Common.h File Reference

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <tchar.h>

Go to the source code of this file.

Defines

#define | __COMMON_STROUT__
#define | DO_EXCEPTION 1
#define | END_POINT TEXT("\\pipe\\strout_sample")
#define | EXECUTION_FAILED -1
#define | EXECUTION_OK 0
#define | EXIT_IF_FAIL(x, string)
#define | IGNORE_CHAR TEXT('=')
#define | NULL_CHAR TEXT('\0')
#define | PROTOCOL_SEQUENCE TEXT("ncacn_np")

Define Documentation

#define __COMMON_STROUT__

Definition at line 10 of file Common.h.

#define DO_EXCEPTION 1

Definition at line 22 of file Common.h.

#define END_POINT TEXT("\\pipe\\strout_sample")

Definition at line 32 of file Common.h.

#define EXECUTION_FAILED -1

Definition at line 18 of file Common.h.

#define EXECUTION_OK 0

Definition at line 19 of file Common.h.

#define EXIT_IF_FAIL | ( | x,
 |  | string
 | ) |
Value:
{ \
    ((x) != RPC_S_OK)?_tprintf(TEXT("%s returned with error: %d\n"), \
    TEXT(string), (x)),exit(x):0;}

Definition at line 26 of file Common.h.

#define IGNORE_CHAR TEXT('=')

Definition at line 33 of file Common.h.

#define NULL_CHAR TEXT('\0')

Definition at line 34 of file Common.h.

#define PROTOCOL_SEQUENCE TEXT("ncacn_np")

Definition at line 31 of file Common.h.

Generated on Wed Nov 13 2024 16:53:11 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/StrOut/Remote.c File Reference

  • NetDS
  • RPC
  • StrOut
Functions

Remote.c File Reference

#include "strout.h"
#include "common.h"

Go to the source code of this file.

Functions

void | GetRemoteEnv (unsigned long *nNumLines, str **psEnvironmentBlock)
void | ShutDown (void)

Function Documentation

void GetRemoteEnv | ( | unsigned long * | nNumLines,
 |  | str ** | psEnvironmentBlock
 | ) |  |

Definition at line 22 of file Remote.c.

{
    int nIdx = 0;       // Loop counter
    TCHAR
        *pcTemp,        // Temporary pointer to the environment block
        *pcEnv;         // Pointer to the environment block

    // Get pointer to environment block
    pcEnv = (TCHAR *) GetEnvironmentStrings();

    // First count how many lines, must know how much memory to allocate
    *nNumLines  = 0;            // Initialize number of lines to 0
    pcTemp = pcEnv;             // Set tempptr equal to envptr
    while (*pcTemp != NULL_CHAR)
    {
        // Don't count the lines that starts with IGNORE_CHAR
        if(*pcTemp != IGNORE_CHAR)
        {
            (*nNumLines)++;     // Increase the number of lines
        }

        // Increment the string pointer. Each line ends in \0, and
        // \0\0 means end of block
        pcTemp += (_tcslen(pcTemp) + 1);
    }

    // Allocate the memory needed for the line pointer
    if(NULL == (*psEnvironmentBlock = (str *)
        midl_user_allocate((*nNumLines) * sizeof(str))))
    {
        _tprintf(TEXT("REMOTE.C : Memory allocation error\n"));
        return;
    }

    // Iterate through all the environment strings, allocate memory,
    // and copy them
    while (*pcEnv != NULL_CHAR)
    {
        // Don't count the lines that starts with IGNORE_CHAR
        if(*pcEnv != IGNORE_CHAR)
        {
            // Allocate the space needed for the strings
            (*psEnvironmentBlock)[nIdx] = (str) midl_user_allocate(
                sizeof(TCHAR) * (_tcslen(pcEnv) + 1));

            // Copy the environment string to the allocated memory
            _tcscpy((*psEnvironmentBlock)[nIdx++], pcEnv);
        }

        // Increment the string pointer. Each line ends in \0, and
        // \0\0 means end of block
        pcEnv += (_tcslen(pcEnv) + 1);
    }
}

void ShutDown ( void )

Definition at line 84 of file Remote.c.

{
    RPC_STATUS nStatus;

    // Tell the server to stop listening for remote procedure calls
    _tprintf(TEXT("Shutting down the server\n"));
    nStatus = RpcMgmtStopServerListening(NULL);
    EXIT_IF_FAIL(nStatus, "RpcMgmtStopServerListening");
}

Generated on Wed Nov 13 2024 16:54:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/StrOut/Server.c File Reference

  • NetDS
  • RPC
  • StrOut
Functions

Server.c File Reference

#include "strout.h"
#include "common.h"

Go to the source code of this file.

Functions

void | CleanUpServer (void)
int | main (int argc, char *argv[])
void __RPC_FAR *__RPC_API | midl_user_allocate (size_t nLen)
void __RPC_API | midl_user_free (void __RPC_FAR *lpvPointer)
void | Usage (_TUCHAR *pszProgramName)

Function Documentation

void CleanUpServer ( void )

Definition at line 150 of file Server.c.

{
    RPC_STATUS nStatus;          // Error status returned from RPC calls

    /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
    /* Unregister the interface from the RPC run-time library           */
    /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
    _tprintf(TEXT("Unregistering the Interface"));
    nStatus = RpcServerUnregisterIf(
        NULL, NULL, // Prevents server from receiving new remote calls
        FALSE);     // Wait until all the active calls are complete
    EXIT_IF_FAIL(nStatus, "RpcServerUnRegisterIf");
}

int main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 39 of file Server.c.

{
    int             nNumArgs,   /* The number of command line arguments */
                    nIdx;       /* Counter in loops                     */
    RPC_STATUS      nStatus;    /* Error status returned                */

    // Variabels used for selecting the protocol and the endpoint
    _TUCHAR *pszProtocolSequence    = PROTOCOL_SEQUENCE;
    _TUCHAR *pszEndpoint            = END_POINT;
    _TUCHAR *pszSecurity            = NULL;

/* Get a common handle on the command line arguments for both UNICODE   */
/* and ASCII                                                            */
#ifdef _UNICODE
    LPWSTR  *pArglist = CommandLineToArgvW(GetCommandLine(), &nNumArgs);
    if (NULL == pArglist)
    {
        _tprintf(TEXT("SERVER.C : CommandLineToArgW failed"));
        exit(EXECUTION_FAILED);
    }
#else
    char **pArglist = argv;
    nNumArgs = argc;
#endif

    /* Allow the user to override settings with commandline switches    */
    for (nIdx = 1; nIdx < nNumArgs; nIdx++)
    {
        if((_tcscmp(pArglist[nIdx], TEXT("-p")) == 0) ||
           (_tcscmp(pArglist[nIdx], TEXT("-P")) == 0))
        {
            pszProtocolSequence = pArglist[++nIdx];
        }
        else if((_tcscmp(pArglist[nIdx], TEXT("-e")) == 0) ||
                (_tcscmp(pArglist[nIdx], TEXT("-e")) == 0))
        {
            pszEndpoint = pArglist[++nIdx];
        }
        else
        {
            Usage(pArglist[0]);
        }
    }

    /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
    /* Register the interface with the RPC run-time library             */
    /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
    _tprintf(TEXT("Registering the interface\n"));
    nStatus = RpcServerRegisterIf(
        strout_sample_v1_0_s_ifspec,    // Interface specification
        NULL,                           // UUID to ass. with MgrEnv arg.
        NULL);                          // Managers entry point vector.
    EXIT_IF_FAIL(nStatus, "RpcServerRegisterIf");

    /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
    /* Select Protocal sequence : This sample uses namedpipes as the    */
    /* default protocol. The RpcServerUseProtseqEp function tells the   */
    /* RPC run-time library to use the specified protocol sequence      */
    /* combined with the specified endpoint for receiving remote        */
    /* procedure calls                                                  */
    /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
    _tprintf(TEXT("Selecting the protocol sequence: \"%s\"\n"),
        pszProtocolSequence);
    nStatus = RpcServerUseProtseqEp(
        pszProtocolSequence,            // String with the protocol in
        RPC_C_PROTSEQ_MAX_REQS_DEFAULT, // Max number of calls
        pszEndpoint,                    // Endpoint addres information
        pszSecurity);                   // Security
    EXIT_IF_FAIL(nStatus, "RpcServerUseProtseqsEp");

    /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
    /* Now start listening for remote procedure calls from the client   */
    /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
    RpcTryExcept
    {
        _tprintf(TEXT("Listening for remote calls...\n"));
        nStatus = RpcServerListen(
            1,                              // The minimum number of calls
            RPC_C_LISTEN_MAX_CALLS_DEFAULT, // The maximum number of calls
            FALSE);                         // Cont. until expl. stopped
        EXIT_IF_FAIL(nStatus, "RpcServerListen");
    }
    RpcExcept(DO_EXCEPTION)
    {
        // Print out the exception code
        _tprintf(TEXT("Run-time exception %u in %s at line %d\n"),
                RpcExceptionCode(), TEXT(__FILE__), __LINE__);
        exit(EXECUTION_FAILED);
    }
    RpcEndExcept

    // If no exceptions occured, clean up the server and exit
    CleanUpServer();

    // Deallocate the memory used for the ARGLIST if using UNICODE
#ifdef _UNICODE
    if (NULL != pArglist)
        free(pArglist);
#endif

    return (EXECUTION_OK);
}

void __RPC_FAR* __RPC_API midl_user_allocate ( size_t nLen )

Definition at line 173 of file Server.c.

{
    return (malloc(nLen));
}

void __RPC_API midl_user_free ( void __RPC_FAR * lpvPointer )

Definition at line 178 of file Server.c.

{
    if(NULL != lpvPointer)
        free (lpvPointer);
}

void Usage ( _TUCHAR * pszProgramName )

Definition at line 27 of file Server.c.

{
    _tprintf(TEXT("USAGE : %s [-option]\n"), pszProgramName);
    _tprintf(TEXT("Options : -p Protocol Sequence\n"));
    _tprintf(TEXT("          -e Endpoint\n"));
    exit(EXECUTION_OK);
}

Generated on Wed Nov 13 2024 16:54:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RPC/StrOut/StrOut.Idl File Reference

  • NetDS
  • RPC
  • StrOut

StrOut.Idl File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/Adminapi/Admapit.c File Reference

  • NetDS
  • RRas
  • Adminapi
Defines | Functions | Variables

Admapit.c File Reference

#include <windows.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <lm.h>
#include <stdio.h>
#include <time.h>
#include <ctype.h>
#include <conio.h>
#include <mprapi.h>
#include <memory.h>
#include <tchar.h>
#include "Shlwapi.h"

Go to the source code of this file.

Defines

#define | CELEMS(x) ( ((sizeof(x))/(sizeof(x[0]))) - 1)
#define | Number_Of_Flags 6
#define | sleeptime 10000
#define | WRITE_LOG_FILE(LogFile, szbuf, len, pdwBytesWritten, flag)

Functions

ULONG _cdecl | DbgPrint (PCH Format,...)
VOID | Debug_Print_Connection0 (RAS_CONNECTION_0 *pRasConnection0)
VOID | Debug_Print_Connection1 (RAS_CONNECTION_1 *pRasConnection1)
VOID | Debug_Print_RAS_PORT0 (RAS_PORT_0 *pRasPort0)
VOID | Debug_Print_RAS_PORT1 (RAS_PORT_1 *pRasPort1)
VOID | File_Print_Connection0 (RAS_CONNECTION_0 *pRasConnection0)
VOID | File_Print_Connection1 (RAS_CONNECTION_1 *pRasConnection1)
VOID | File_Print_RAS_PORT0 (RAS_PORT_0 *pRasPort0)
VOID | File_Print_RAS_PORT1 (RAS_PORT_1 *pRasPort1)
VOID | Init1 (void)
VOID | Init2 (void)
INT | IsServiceRunning (WCHAR *RasSrv)
void _cdecl | main (int argc, char **argv)
VOID | PrintClearStats (WCHAR *RasSrv, WCHAR *wszPortName)
VOID | PrintGetStringError (DWORD dwResult)
VOID | PrintPriv (WCHAR *DomainName, WCHAR *UserName)
VOID | ProcConnectionClearStat (HANDLE hConnection)
VOID | ProcConnectionGetInfo (HANDLE hConnection)
VOID | ProcPortClearStat (HANDLE hPort)
VOID | ProcPortDisconnect (HANDLE hPort)
VOID | ProcPortGetInfo (HANDLE hPort)
VOID | ProcPortReset (HANDLE hPort)
DWORD WINAPI | RasAdminClearDisc (LPVOID param)
WCHAR * | StrDupWFromA (CHAR *psz)
VOID | UserPrivilege (WCHAR *DomainName, WCHAR *UserName)

Variables

CHAR | buf [120]
WCHAR | CallbackNumber [255]
BOOL | cErrLogInValid = FALSE
HANDLE | cLogFile = NULL
DWORD | dwBytesWritten = 0
DWORD | dwResult = 0
HANDLE | ErrLogFile = NULL
BOOL | ErrLogInValid = FALSE
BOOL | First_Call = TRUE
BOOL | FirstCall = TRUE
HANDLE | LogFile = NULL
BOOL | LogInValid = TRUE
WCHAR | lpszServerName [50]
RAS_SERVER_HANDLE | phRasServer
PRAS_USER_0 | ppRasUser0
BOOL | Quit = FALSE
WCHAR | RasSrv [64]
RAS_USER_0 | RasUser0
DWORD | Status = 0
CHAR | szBuf [120]
WCHAR | szUserAccountServer [UNLEN+1]

Define Documentation

#define CELEMS ( x ) ( ((sizeof(x))/(sizeof(x[0]))) - 1)

Definition at line 73 of file Admapit.c.

#define Number_Of_Flags 6

Definition at line 114 of file Admapit.c.

#define sleeptime 10000

Definition at line 54 of file Admapit.c.

#define WRITE_LOG_FILE | ( | LogFile,
 |  | szbuf,
 |  | len,
 |  | pdwBytesWritten,
 |  | flag
 | ) |
Value:
{\
   if ((LogFile)!=INVALID_HANDLE_VALUE) \
      WriteFile((LogFile), (szBuf), (len), (pdwBytesWritten), (flag)); \
}

Definition at line 76 of file Admapit.c.

Function Documentation

ULONG _cdecl DbgPrint | ( | PCH | Format,
 |  |  | ...
 | ) |  |

Definition at line 181 of file Admapit.c.

{
    WCHAR buffer[255];
    WCHAR *temp = NULL;
    LPINT lpResult=NULL;
    va_list marker;
    va_start (marker,Format);

    temp = StrDupWFromA(Format);
    if (temp)
    {
        wvnsprintfW(buffer, CELEMS(buffer), temp, marker);
        OutputDebugString (buffer);
        free(temp);
    }

    return TRUE;
}

VOID Debug_Print_Connection0 ( RAS_CONNECTION_0 * pRasConnection0 )

Definition at line 519 of file Admapit.c.

{
   WCHAR *Interface_Type[] =
   {
   L"ROUTER_IF_TYPE_CLIENT",
   L"ROUTER_IF_TYPE_HOME_ROUTER",
   L"ROUTER_IF_TYPE_FULL_ROUTER",
   L"ROUTER_IF_TYPE_DEDICATED",
   L"ROUTER_IF_TYPE_INTERNAL",
   L"ROUTER_IF_TYPE_INTERNAL"
   };

   //dumping pRasConnection0
   DbgPrint("pRasConnection0->hConnection  0x%x\n",pRasConnection0->hConnection);
   DbgPrint("pRasConnection0->hInterface   0x%x\n",pRasConnection0->hInterface);
   DbgPrint("pRasConnection0->dwConnectDuration  %d\n",pRasConnection0->dwConnectDuration);
   DbgPrint("pRasConnection0->dwInterfaceType  %ws\n",Interface_Type[pRasConnection0->dwInterfaceType]);
   DbgPrint("pRasConnection0->dwConnectionFlags  %d\n",pRasConnection0->dwConnectionFlags);
   DbgPrint("pRasConnection0->wszInterfaceName  %ws\n",pRasConnection0->wszInterfaceName);
   DbgPrint("pRasConnection0->wszUserName  %ws\n",pRasConnection0->wszUserName);
   DbgPrint("pRasConnection0->wszLogonDomain  %ws\n",pRasConnection0->wszLogonDomain);
   DbgPrint("pRasConnection0->wszRemoteComputer  %ws\n",pRasConnection0->wszRemoteComputer);

}

VOID Debug_Print_Connection1 ( RAS_CONNECTION_1 * pRasConnection1 )

Definition at line 551 of file Admapit.c.

{
    //dumping pRasConnection1
    DbgPrint( "\n\npRasConnection1->hConnection  0x%x\n",pRasConnection1->hConnection);
    DbgPrint( "pRasConnection1->hInterface   0x%x\n",pRasConnection1->hInterface);
    DbgPrint( "pRasConnection1->PppInfo.nbf.dwError %d\n",pRasConnection1->PppInfo.nbf.dwError);
    DbgPrint( "pRasConnection1->PppInfo.nbf.wszWksta %ws\n",pRasConnection1->PppInfo.nbf.wszWksta);
    DbgPrint( "pRasConnection1->PppInfo.ip.dwError %d\n",pRasConnection1->PppInfo.ip.dwError);
    DbgPrint( "pRasConnection1->PppInfo.ip.wszAddress %ws\n",pRasConnection1->PppInfo.ip.wszAddress);
    DbgPrint( "pRasConnection1->PppInfo.ip.wszRemoteAddress %ws\n",pRasConnection1->PppInfo.ip.wszRemoteAddress);
    DbgPrint( "pRasConnection1->PppInfo.ipx.dwError %d\n",pRasConnection1->PppInfo.ipx.dwError);
    DbgPrint( "pRasConnection1->PppInfo.ipx.wszAddress %ws\n",pRasConnection1->PppInfo.ipx.wszAddress);
    DbgPrint( "pRasConnection1->PppInfo.at.dwError  %d\n",pRasConnection1->PppInfo.at.dwError );
    DbgPrint( "pRasConnection1->PppInfo.at.wszAddress %ws\n",pRasConnection1->PppInfo.at.wszAddress);

    //connection stats
    DbgPrint( "pRasConnection1->dwBytesXmited=%d\n", pRasConnection1->dwBytesXmited );
    DbgPrint( "pRasConnection1->dwBytesRcved=%d\n", pRasConnection1->dwBytesRcved );
    DbgPrint( "pRasConnection1->dwFramesXmited=%d\n", pRasConnection1->dwFramesXmited );
    DbgPrint( "pRasConnection1->dwFramesRcved=%d\n", pRasConnection1->dwFramesRcved);
    DbgPrint( "pRasConnection1->dwCrcErr=%d\n", pRasConnection1->dwCrcErr);
    DbgPrint( "pRasConnection1->dwTimeoutErr=%d\n", pRasConnection1->dwTimeoutErr);
    DbgPrint( "pRasConnection1->dwAlignmentErr=%d\n", pRasConnection1->dwAlignmentErr);
    DbgPrint( "pRasConnection1->dwHardwareOverrunErr=%d\n", pRasConnection1->dwHardwareOverrunErr);
    DbgPrint( "pRasConnection1->dwFramingErr=%d\n", pRasConnection1->dwFramingErr);
    DbgPrint( "pRasConnection1->dwBufferOverrunErr=%d\n", pRasConnection1->dwBufferOverrunErr);
}

VOID Debug_Print_RAS_PORT0 ( RAS_PORT_0 * pRasPort0 )

Definition at line 584 of file Admapit.c.

{
WCHAR *Line_Condition[] =
   {
   L"RAS_PORT_NON_OPERATIONAL",
   L"RAS_PORT_DISCONNECTED",
   L"RAS_PORT_CALLING_BACK",
   L"RAS_PORT_LISTENING",
   L"RAS_PORT_AUTHENTICATING",
   L"RAS_PORT_AUTHENTICATED",
   L"RAS_PORT_INITIALIZING"
   };

WCHAR *Hdw_Error[] =
   {
   L"RAS_HARDWARE_OPERATIONAL",
   L"RAS_HARDWARE_FAILURE"
   };

   //dumping pRasPort0
   DbgPrint("pRasPort0->hPort  %d\n",pRasPort0->hPort);
   DbgPrint("pRasPort0->hConnection   0x%x\n",pRasPort0->hConnection);
   DbgPrint("pRasPort0->dwPortCondition  %ws\n",Line_Condition[pRasPort0->dwPortCondition-1]);
   DbgPrint("pRasPort0->dwTotalNumberOfCalls  %d\n",pRasPort0->dwTotalNumberOfCalls);
   DbgPrint("pRasPort0->dwConnectDuration  %d\n",pRasPort0->dwConnectDuration);
   DbgPrint("pRasPort0->wszPortName  %ws\n",pRasPort0->wszPortName);
   DbgPrint("pRasPort0->wszMediaName  %ws\n",pRasPort0->wszMediaName);
   DbgPrint("pRasPort0->wszDeviceName  %ws\n",pRasPort0->wszDeviceName);
   DbgPrint("pRasPort0->wszDeviceType  %ws\n",pRasPort0->wszDeviceType);

}

VOID Debug_Print_RAS_PORT1 ( RAS_PORT_1 * pRasPort1 )

Definition at line 621 of file Admapit.c.

{
WCHAR *Line_Condition[] =
   {
   L"RAS_PORT_NON_OPERATIONAL",
   L"RAS_PORT_DISCONNECTED",
   L"RAS_PORT_CALLING_BACK",
   L"RAS_PORT_LISTENING",
   L"RAS_PORT_AUTHENTICATING",
   L"RAS_PORT_AUTHENTICATED",
   L"RAS_PORT_INITIALIZING"
   };

WCHAR *Hdw_Error[] =
   {
   L"RAS_HARDWARE_OPERATIONAL",
   L"RAS_HARDWARE_FAILURE"
   };

   //dumping pRasPort1
   DbgPrint("pRasPort1->hPort  %d\n",pRasPort1->hPort);
   DbgPrint("pRasPort1->hConnection   0x%x\n",pRasPort1->hConnection);
   DbgPrint("pRasPort1->dwHardwareCondition  %ws\n",Hdw_Error[pRasPort1->dwHardwareCondition]);

   //connection stats
   DbgPrint( "pRasPort1->dwLineSpeed=%d\n", pRasPort1->dwLineSpeed );
   DbgPrint( "pRasPort1->dwBytesXmited=%d\n", pRasPort1->dwBytesXmited );
   DbgPrint( "pRasPort1->dwBytesRcved=%d\n", pRasPort1->dwBytesRcved );
   DbgPrint( "pRasPort1->dwFramesXmited=%d\n", pRasPort1->dwFramesXmited );
   DbgPrint( "pRasPort1->dwFramesRcved=%d\n", pRasPort1->dwFramesRcved);
   DbgPrint( "pRasPort1->dwCrcErr=%d\n", pRasPort1->dwCrcErr);
   DbgPrint( "pRasPort1->dwTimeoutErr=%d\n", pRasPort1->dwTimeoutErr);
   DbgPrint( "pRasPort1->dwAlignmentErr=%d\n", pRasPort1->dwAlignmentErr);
   DbgPrint( "pRasPort1->dwHardwareOverrunErr=%d\n", pRasPort1->dwHardwareOverrunErr);
   DbgPrint( "pRasPort1->dwFramingErr=%d\n", pRasPort1->dwFramingErr);
   DbgPrint( "pRasPort1->dwBufferOverrunErr=%d\n", pRasPort1->dwBufferOverrunErr);
}

VOID File_Print_Connection0 ( RAS_CONNECTION_0 * pRasConnection0 )

Definition at line 663 of file Admapit.c.

{
WCHAR *Interface_Type[] =
   {
   L"ROUTER_IF_TYPE_CLIENT",
   L"ROUTER_IF_TYPE_HOME_ROUTER",
   L"ROUTER_IF_TYPE_FULL_ROUTER",
   L"ROUTER_IF_TYPE_DEDICATED",
   L"ROUTER_IF_TYPE_INTERNAL",
   L"ROUTER_IF_TYPE_INTERNAL"
   };

   //dumping pRasConnection0
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "dumping pRasConnection0\n\n");
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasConnection0->hConnection  0x%l64x\n",pRasConnection0->hConnection);
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasConnection0->hInterface   0x%l64x\n",pRasConnection0->hInterface);
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasConnection0->dwConnectDuration  %d\n",pRasConnection0->dwConnectDuration);
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasConnection0->dwInterfaceType  %ws\n",Interface_Type[pRasConnection0->dwInterfaceType]);
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasConnection0->dwConnectionFlags  %d\n",pRasConnection0->dwConnectionFlags);
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasConnection0->wszInterfaceName  %ws\n",pRasConnection0->wszInterfaceName);
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasConnection0->wszUserName  %ws\n",pRasConnection0->wszUserName);
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasConnection0->wszLogonDomain  %ws\n",pRasConnection0->wszLogonDomain);
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasConnection0->wszRemoteComputer  %ws\n",pRasConnection0->wszRemoteComputer);
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);

}

VOID File_Print_Connection1 ( RAS_CONNECTION_1 * pRasConnection1 )

Definition at line 704 of file Admapit.c.

{

   //dumping pRasConnection1
   wnsprintfA(buf, CELEMS(buf), "dumping pRasConnection1\n");
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "\n\npRasConnection1->hConnection  0x%l64x\n",pRasConnection1->hConnection);
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasConnection1->hInterface   0x%l64x\n",pRasConnection1->hInterface);
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasConnection1->PppInfo.nbf.dwError %d\n",pRasConnection1->PppInfo.nbf.dwError);
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasConnection1->PppInfo.nbf.wszWksta %ws\n",pRasConnection1->PppInfo.nbf.wszWksta);
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasConnection1->PppInfo.ip.dwError %d\n",pRasConnection1->PppInfo.ip.dwError);
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasConnection1->PppInfo.ip.wszAddress %ws\n",pRasConnection1->PppInfo.ip.wszAddress);
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasConnection1->PppInfo.ip.wszRemoteAddress %ws\n",pRasConnection1->PppInfo.ip.wszRemoteAddress);
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasConnection1->PppInfo.ipx.dwError %d\n",pRasConnection1->PppInfo.ipx.dwError);
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasConnection1->PppInfo.ipx.wszAddress %ws\n",pRasConnection1->PppInfo.ipx.wszAddress);
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasConnection1->PppInfo.at.dwError  %d\n",pRasConnection1->PppInfo.at.dwError );
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasConnection1->PppInfo.at.wszAddress %ws\n",pRasConnection1->PppInfo.at.wszAddress);

   //connection stats
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasConnection1->dwBytesXmited=%d\n", pRasConnection1->dwBytesXmited );
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasConnection1->dwBytesRcved=%d\n", pRasConnection1->dwBytesRcved );
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasConnection1->dwFramesXmited=%d\n", pRasConnection1->dwFramesXmited );
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasConnection1->dwFramesRcved=%d\n", pRasConnection1->dwFramesRcved);
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasConnection1->dwCrcErr=%d\n", pRasConnection1->dwCrcErr);
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasConnection1->dwTimeoutErr=%d\n", pRasConnection1->dwTimeoutErr);
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasConnection1->dwAlignmentErr=%d\n", pRasConnection1->dwAlignmentErr);
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasConnection1->dwHardwareOverrunErr=%d\n", pRasConnection1->dwHardwareOverrunErr);
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasConnection1->dwFramingErr=%d\n", pRasConnection1->dwFramingErr);
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasConnection1->dwBufferOverrunErr=%d\n", pRasConnection1->dwBufferOverrunErr);
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
}

VOID File_Print_RAS_PORT0 ( RAS_PORT_0 * pRasPort0 )

Definition at line 761 of file Admapit.c.

{
WCHAR *Line_Condition[] =
   {
   L"RAS_PORT_NON_OPERATIONAL",
   L"RAS_PORT_DISCONNECTED",
   L"RAS_PORT_CALLING_BACK",
   L"RAS_PORT_LISTENING",
   L"RAS_PORT_AUTHENTICATING",
   L"RAS_PORT_AUTHENTICATED",
   L"RAS_PORT_INITIALIZING"
   };

WCHAR *Hdw_Error[] =
   {
   L"RAS_HARDWARE_OPERATIONAL",
   L"RAS_HARDWARE_FAILURE"
   };

   //dumping pRasPort0 to a file
   wnsprintfA(buf, CELEMS(buf), "dumping pRasPort0 to file\n");
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasPort0->hPort  %l64d\n",pRasPort0->hPort);
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasPort0->hConnection   0x%l64x\n",pRasPort0->hConnection);
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasPort0->dwPortCondition  %ws\n",Line_Condition[pRasPort0->dwPortCondition-1]);
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasPort0->dwTotalNumberOfCalls  %d\n",pRasPort0->dwTotalNumberOfCalls);
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasPort0->dwConnectDuration  %d\n",pRasPort0->dwConnectDuration);
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasPort0->wszPortName  %ws\n",pRasPort0->wszPortName);
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasPort0->wszMediaName  %ws\n",pRasPort0->wszMediaName);
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasPort0->wszDeviceName  %ws\n",pRasPort0->wszDeviceName);
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasPort0->wszDeviceType  %ws\n",pRasPort0->wszDeviceType);
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);

}

VOID File_Print_RAS_PORT1 ( RAS_PORT_1 * pRasPort1 )

Definition at line 809 of file Admapit.c.

{
WCHAR *Line_Condition[] =
   {
   L"RAS_PORT_NON_OPERATIONAL",
   L"RAS_PORT_DISCONNECTED",
   L"RAS_PORT_CALLING_BACK",
   L"RAS_PORT_LISTENING",
   L"RAS_PORT_AUTHENTICATING",
   L"RAS_PORT_AUTHENTICATED",
   L"RAS_PORT_INITIALIZING"
   };

WCHAR *Hdw_Error[] =
   {
   L"RAS_HARDWARE_OPERATIONAL",
   L"RAS_HARDWARE_FAILURE"
   };

   //dumping pRasPort1
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "\n dumping pRasPort1\n");
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasPort1->hPort  %l64d\n",pRasPort1->hPort);
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasPort1->hConnection   0x%l64x\n",pRasPort1->hConnection);
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasPort1->dwHardwareCondition  %ws\n",Hdw_Error[pRasPort1->dwHardwareCondition]);

   //connection stats
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf),  "pRasPort1->dwLineSpeed=%d\n", pRasPort1->dwLineSpeed );
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf),  "pRasPort1->dwBytesXmited=%d\n", pRasPort1->dwBytesXmited );
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf),  "pRasPort1->dwBytesRcved=%d\n", pRasPort1->dwBytesRcved );
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf),  "pRasPort1->dwFramesXmited=%d\n", pRasPort1->dwFramesXmited );
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf),  "pRasPort1->dwFramesRcved=%d\n", pRasPort1->dwFramesRcved);
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf),  "pRasPort1->dwCrcErr=%d\n", pRasPort1->dwCrcErr);
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf),  "pRasPort1->dwTimeoutErr=%d\n", pRasPort1->dwTimeoutErr);
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf),  "pRasPort1->dwAlignmentErr=%d\n", pRasPort1->dwAlignmentErr);
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf),  "pRasPort1->dwHardwareOverrunErr=%d\n", pRasPort1->dwHardwareOverrunErr);
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf),  "pRasPort1->dwFramingErr=%d\n", pRasPort1->dwFramingErr);
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf),  "pRasPort1->dwBufferOverrunErr=%d\n", pRasPort1->dwBufferOverrunErr);
   WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);

}

VOID Init1 ( void )

Definition at line 207 of file Admapit.c.

{
   //Store port  information in this file
   LogInValid = FALSE;
   LogFile = CreateFile(TEXT("Admin.log"),
                        GENERIC_READ|GENERIC_WRITE,
                        FILE_SHARE_READ,
                        (LPSECURITY_ATTRIBUTES) NULL,
                        CREATE_ALWAYS,
                        0,
                        (HANDLE) NULL);

   if (LogFile== INVALID_HANDLE_VALUE)
   {
      LogInValid = TRUE;
   }

}

VOID Init2 ( void )

Definition at line 227 of file Admapit.c.

{
   cErrLogInValid = FALSE;
   ErrLogInValid = FALSE;
   //Stores Statistics and port disconnect information in this file
   cLogFile = CreateFile(TEXT("AdminStats.log"),
                         GENERIC_READ|GENERIC_WRITE,
                         FILE_SHARE_READ,
                         (LPSECURITY_ATTRIBUTES) NULL,
                         CREATE_ALWAYS,
                         0,
                         (HANDLE) NULL);
   if (cLogFile== INVALID_HANDLE_VALUE)
   {
      cErrLogInValid = TRUE;
   }

   //Stores user privilege information in this file
   ErrLogFile = CreateFile(TEXT("AdminUser.log"),
                           GENERIC_READ|GENERIC_WRITE,
                           FILE_SHARE_READ,
                           (LPSECURITY_ATTRIBUTES) NULL,
                           CREATE_ALWAYS,
                           0,
                           (HANDLE) NULL);

   if (ErrLogFile== INVALID_HANDLE_VALUE)
   {
      ErrLogInValid = TRUE;
   }

}

INT IsServiceRunning ( WCHAR * RasSrv )

Definition at line 278 of file Admapit.c.

{
DWORD dwResult;
CHAR  szBuf[120];
DWORD dwBytesWritten = 0;

   //Calling MprAdminIsServiceRunning
   // Parameters:
   // IN LPWSTR   * RasSrv
   dwResult = MprAdminIsServiceRunning(RasSrv);
   //printf("Ras server: %s\n", *RasSrv);
   if (dwResult==TRUE)
   {
      DbgPrint("Ras AND Router Serivce running on the Server\n");
      wnsprintfA(szBuf, CELEMS(szBuf), "Ras AND Router Serivce running on the Server\n");
      WriteFile(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
      //Calling MprAdminServerConnect
      // Parameters
      // IN LPWSTR    * RasSrv
      // OUT RAS_SERVER_HANDLE * phRasServer
      dwResult = MprAdminServerConnect(RasSrv, &phRasServer);
      if (dwResult != NO_ERROR)
      {
         DbgPrint("Failed to Connect to Server\n");
         wnsprintfA(szBuf, CELEMS(szBuf), "Failed to Connect to Server: ERROR %d\n", dwResult);
         WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
         return 0;
      }
   }
   else
   {
      DbgPrint("Ras AND Router Serivce is NOT running on the Server\n");
      wnsprintfA(szBuf, CELEMS(szBuf), "Ras AND Router Serivce is NOT running on the Server: ERROR %d\n", dwResult);
      WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
      return 0;
   }
   return 1;
}

void _cdecl main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 1215 of file Admapit.c.

{
INT LoopPriv = 0;
INT Error = 0;
CHAR szBuf[120];
DWORD dwBytesWritten = 0;
DWORD Dialin = 1;
WORD i = 0;
INT_PTR id = 0;
WCHAR *lpszString;
WCHAR Buf[512];
HANDLE ConnectDiscThread;
LPBYTE lplpbBuffer;
DWORD lpdwEntriesRead = 0;
DWORD lpdwTotalEntries = 0;
LPDWORD lpdwResumeHandle=NULL;
RAS_CONNECTION_0 *pRasConnection0;
LPBYTE plplpbBuffer;
DWORD plpdwPrefMaxLen = 0;
DWORD plpdwEntriesRead = 0;
DWORD plpdwTotalEntries = 0;
DWORD plpdwResumeHandle = 0;
RAS_PORT_0 *pRasPort0;
HANDLE hConnection = 0;
lpszString = &Buf[0];

 if (argc > 1)
 {
    mbstowcs(RasSrv, argv[1], 32) ;
 }
 Init1();
 Init2();
 Error=IsServiceRunning(RasSrv);
 if (!Error)
 {
    printf ("Ras Server is not started on the system");
    exit(0);
 }
 printf("Please specify the Client's phone number or IP address\n");
 scanf("%ws", CallbackNumber);
 ConnectDiscThread = CreateThread (NULL,
                                  0,
                                  &RasAdminClearDisc,
                                  (LPVOID)&id,
                                  0,
                                  (LPDWORD)&id);
 while (!Quit)
 {
 // API Called:     MprAdminConnectionEnum
 // Parameters:
 //  IN RAS_SERVER_HANDLE phRasServer
 //  IN DWORD dwLevel
 //  OUT LPBYTE * lplpbBuffer    (RAS_CONNECTION_0 array)
 //  IN DWORD dwPrefMaxLen
 //  OUT LPDWORD lpdwEntriesRead
 //  OUT LPDWORD lpdwdTotalEntries
 //  IN  LPDWORD lpdwResumeHandle  OPTIONAL

 // Free up lplpbBuffer by calling MprAdminFreeBuffer API

   lpdwEntriesRead = 0;

   Status = MprAdminConnectionEnum(phRasServer,(DWORD) 0,&lplpbBuffer,(DWORD)-1,
                                   &lpdwEntriesRead,&lpdwTotalEntries,lpdwResumeHandle);
   if (Status != NO_ERROR)  //error
   {
      wnsprintfA(szBuf, CELEMS(szBuf), "ERROR MprAdminConnectionEnum   %d\n",Status);
      WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
      dwResult = MprAdminGetErrorString( Status, &lpszString);
      if (dwResult == NO_ERROR)
      {
         wnsprintfA(szBuf, CELEMS(szBuf), "ERROR  MprAdminConnectionEnum      %ws\n",lpszString);
         WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
      }
      else
         PrintGetStringError(dwResult);
   }
   else  //no error
   {
      if (lpdwEntriesRead == lpdwTotalEntries)
      {
         pRasConnection0 = (RAS_CONNECTION_0 *) lplpbBuffer;
         for (i=0; i < (DWORD)lpdwTotalEntries;i++)
         {
            wnsprintfA(szBuf, CELEMS(szBuf), "\n\nDumping RpRasConnection0::Called from MprAdminConnectionEnum\n");
            WRITE_LOG_FILE(cLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
            File_Print_Connection0(&pRasConnection0[i]);
            DbgPrint("\n\nDumping RpRasConnection0::Called from MprAdminConnectionEnum\n");
            Debug_Print_Connection0(&pRasConnection0[i]);
            ProcConnectionGetInfo(pRasConnection0[i].hConnection);
            // pass hConnection = handle from MprAdminConnectionEnum
            hConnection = pRasConnection0[i].hConnection;
            //alternatively, could pass hConnection = INVALID_HANDLE_VALUE;
            Sleep (500);
            // A good idea is to call UserPrivilege outside the loop. It doesn't really
            // make sense to go through the privilege change for every iteration.
            // However, this code is just intended to demonstrate the usage.
            if (lpdwEntriesRead > 0)
        {
        UserPrivilege(pRasConnection0[i].wszLogonDomain,pRasConnection0[i].wszUserName);
        }
            ProcConnectionClearStat(pRasConnection0[i].hConnection);
            // API Called:     MprAdminPortEnum
            // Parameters:
            //  IN RAS_SERVER_HANDLE phRasServer
            //  IN DWORD pdwLevel
            //  HANDLE hConnection
            //  OUT LPBYTE * plplpbBuffer    (RAS_PORT_0 array)
            //  IN DWORD pdwPrefMaxLen
            //  OUT LPDWORD plpdwEntriesRead
            //  OUT LPDWORD plpdwdTotalEntries
            //  IN  LPDWORD plpdwResumeHandle  OPTIONAL

            // Free up lplpbBuffer by calling MprAdminFreeBuffer API
            Status = MprAdminPortEnum(phRasServer,(DWORD) 0,hConnection, &plplpbBuffer,
                        (DWORD) -1, &plpdwEntriesRead, &plpdwTotalEntries, &plpdwResumeHandle);
            if (Status != NO_ERROR)
            {
               wnsprintfA(szBuf, CELEMS(szBuf), "ERROR MprAdminPortEnum   %d\n",Status);
               WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
               dwResult = MprAdminGetErrorString( Status, &lpszString);
               if (dwResult == NO_ERROR)
               {
                  wnsprintfA(szBuf, CELEMS(szBuf), "ERROR  MprAdminPortEnum      %ws\n",lpszString);
                  WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
               }
               else
                  PrintGetStringError(dwResult);
            }
            else
            {
               if (plpdwEntriesRead == plpdwTotalEntries)
               {
                  pRasPort0 = (RAS_PORT_0 *) plplpbBuffer;
                  for (i=0; i < (DWORD)plpdwTotalEntries;i++)
                  {
                     wnsprintfA(szBuf, CELEMS(szBuf), "\n\nDumping pRasPort0::Called from MprAdminPortEnum\n");
                     WRITE_LOG_FILE(cLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
                     File_Print_RAS_PORT0(&pRasPort0[i]);
                     DbgPrint("\n\nDumping RpRasPort0::Called from MprAdminPortEnum\n");
                     Debug_Print_RAS_PORT0(&pRasPort0[i]);
                     ProcPortGetInfo(pRasPort0[i].hPort);
                     Sleep (500);
                     ProcPortClearStat(pRasPort0[i].hPort);
                     Sleep (500);
                     ProcPortReset(pRasPort0[i].hPort);
                     Sleep (500);
                     ProcPortDisconnect(pRasPort0[i].hPort);
                  }
               }
               MprAdminBufferFree(pRasPort0);
            }
         }
      }
      MprAdminBufferFree(pRasConnection0);
   }

   Sleep(sleeptime);

 } //end of loop: while (!Quit)

 WaitForSingleObject(ConnectDiscThread,INFINITE);

 //Calling MprAdminServerDisconnect (type VOID, returns nothing)
 // Parameters
 // IN RAS_SERVER_HANDLE * phRasServer
 MprAdminServerDisconnect(phRasServer);
 DbgPrint("info: called MprAdminServerDisconnect(hRasServer=0x%x)\n", phRasServer);
 wnsprintfA(szBuf, CELEMS(szBuf), "info: called MprAdminServerDisconnect(hRasServer=0x%l64x)\n", phRasServer);
 WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);

 //
 // close logfiles
 //
 CloseHandle(LogFile);
 CloseHandle(cLogFile);
 CloseHandle(ErrLogFile);

} // Main End

VOID PrintClearStats | ( | WCHAR * | RasSrv,
 |  | WCHAR * | wszPortName
 | ) |  |
VOID PrintGetStringError ( DWORD dwResult )

Definition at line 264 of file Admapit.c.

{
CHAR  szBuf[120];
DWORD dwBytesWritten = 0;

   DbgPrint("ERROR  MprAdminGetErrorString      %d\n",dwResult);
   wnsprintfA(szBuf, CELEMS(szBuf), "ERROR  MprAdminGetErrorString      %d\n",dwResult);
   WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
}

VOID PrintPriv | ( | WCHAR * | DomainName,
 |  | WCHAR * | UserName
 | ) |  |

Definition at line 321 of file Admapit.c.

{
DWORD dwBytesWritten = 0;
CHAR  szBuf[120];

     /*********** from mprapi.h ****************************************************/
     //
     // Note: Bit 0 MUST represent NoCallback due to a quirk of the "userparms"
     //       storage method.  When a new LAN Manager user is created, bit 0 of the
     //       userparms field is set to 1 and all other bits are 0.  These bits are
     //       arranged so this "no Dial-In info" state maps to the "default Dial-In
     //       privilege" state.
     //
     // #define RASPRIV_NoCallback        0x01
     // #define RASPRIV_AdminSetCallback  0x02
     // #define RASPRIV_CallerSetCallback 0x04
     // #define RASPRIV_DialinPrivilege   0x08
     //
     // #define RASPRIV_CallbackType (RASPRIV_AdminSetCallback \
     //                             | RASPRIV_CallerSetCallback \
     //                             | RASPRIV_NoCallback)
     /*****************************************************************************/

     wnsprintfA(szBuf, CELEMS(szBuf), "\nDomainName =  %ws\nUserName = %ws\n",DomainName, UserName);
     WRITE_LOG_FILE(ErrLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);

     wnsprintfA(szBuf, CELEMS(szBuf), "ppRasUser0->bfPrivilege = 0x%x\n",ppRasUser0->bfPrivilege);
     WRITE_LOG_FILE(ErrLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);

     //
     // display the privilege flags
     //
     if ((ppRasUser0->bfPrivilege) & (RASPRIV_NoCallback))
     {
        wnsprintfA(szBuf, CELEMS(szBuf), "\t\tRASPRIV_NoCallback        = 0x%x\n", (ppRasUser0->bfPrivilege & (RASPRIV_NoCallback)));
        WRITE_LOG_FILE(ErrLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
     }
     if ((ppRasUser0->bfPrivilege) & (RASPRIV_AdminSetCallback))
     {
        wnsprintfA(szBuf, CELEMS(szBuf), "\t\tRASPRIV_AdminSetCallback  = 0x%x\n", (ppRasUser0->bfPrivilege & (RASPRIV_AdminSetCallback)));
        WRITE_LOG_FILE(ErrLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
     }
     if ((ppRasUser0->bfPrivilege) & (RASPRIV_CallerSetCallback))
     {
        wnsprintfA(szBuf, CELEMS(szBuf), "\t\tRASPRIV_CallerSetCallback = 0x%x\n", (ppRasUser0->bfPrivilege & (RASPRIV_CallerSetCallback)));
        WRITE_LOG_FILE(ErrLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
     }
     if ((ppRasUser0->bfPrivilege) & (RASPRIV_DialinPrivilege))
     {
        wnsprintfA(szBuf, CELEMS(szBuf), "\t\tRASPRIV_DialinPrivilege   = 0x%x\n", (ppRasUser0->bfPrivilege & (RASPRIV_DialinPrivilege)));
        WRITE_LOG_FILE(ErrLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
     }
}

VOID ProcConnectionClearStat ( HANDLE hConnection )

Definition at line 915 of file Admapit.c.

{
DWORD dwBytesWritten = 0;
CHAR szBuf[120];
WCHAR Buf[512];
WCHAR *lpszString;
lpszString = &Buf[0];

   if (phRasServer==NULL)
      return;

   // API Called:     MprAdminConnectionClearStats
   // Parameters:
   // IN RAS_SERVER_HANDLE  phRasServer
   // IN HANDLE  hConnection
   Status = MprAdminConnectionClearStats(phRasServer, hConnection);
   if (Status != NO_ERROR)
   {
      wnsprintfA(szBuf, CELEMS(szBuf), "ERROR MprAdminConnectionClearStats   %d\n",Status);
      WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
      dwResult = MprAdminGetErrorString(Status, &lpszString);
      if (dwResult == ERROR_SUCCESS)
      {
         DbgPrint("ERROR  MprAdminConnectionClearStats      %ws\n",lpszString);
         wnsprintfA(szBuf, CELEMS(szBuf), "ERROR  MprAdminConnectionClearStats      %ws\n",lpszString);
         WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
      }
      else
         PrintGetStringError(dwResult);
   }
   else
   {
      DbgPrint("\n\nMprAdminConnectionClearStats Called From ProcConnectionClearStat, Now dumping structs \n");
      wnsprintfA(szBuf, CELEMS(szBuf), "\n\nMprAdminConnectionClearStats Called From ProcConnectionClearStat, Now dumping structs\n");
      WRITE_LOG_FILE(cLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
      ProcConnectionGetInfo(hConnection);
   }
}

VOID ProcConnectionGetInfo ( HANDLE hConnection )

Definition at line 1064 of file Admapit.c.

{
RAS_CONNECTION_0 *pRasConnection0;
RAS_CONNECTION_1 *pRasConnection1;
LPBYTE lplpbBuffer;
DWORD dwBytesWritten = 0;
CHAR  szBuf[120];
WCHAR *lpszString;
WCHAR Buf[512];
lpszString = &Buf[0];

   if (phRasServer==NULL)
      return;

   // API Called: MprAdminConnectionGetInfo
   // Parameters:
   // IN  RAS_SERVER_HANDLE phRasServer
   // IN DWORD    dwLevel
   // IN HANDLE   hConnection
   // OUT LPBYTE * lplpbBuffer
   Status = MprAdminConnectionGetInfo(phRasServer,0,hConnection,&lplpbBuffer);
   if (Status != NO_ERROR)
   {
      wnsprintfA(szBuf, CELEMS(szBuf), "ERROR MprAdminConnectionGetInfo   %d\n",Status);
      WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
      dwResult = MprAdminGetErrorString( Status, &lpszString);
      if (dwResult == NO_ERROR)
      {
         wnsprintfA(szBuf,CELEMS(szBuf), "ERROR  MprAdminConnectionGetInfo      %ws\n",lpszString);
         WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
      }
      else
         PrintGetStringError(dwResult);
   }
   else
   {
      pRasConnection0 = (RAS_CONNECTION_0 *) lplpbBuffer;
      wnsprintfA(szBuf, CELEMS(szBuf), "\n\nDumping RpRasConnection0::Called from ProcConnectionGetinfo:->MprAdminConnectionGetInfo\n");
              WRITE_LOG_FILE(cLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
      File_Print_Connection0(pRasConnection0);
      DbgPrint("\n\nDumping RpRasConnection0::Called from ProcConnectionGetinfo:->MprAdminConnectionGetInfo\n");
      Debug_Print_Connection0(pRasConnection0);
      MprAdminBufferFree(pRasConnection0);
   }

   Status = MprAdminConnectionGetInfo(phRasServer,1,hConnection,&lplpbBuffer);
   if (Status != NO_ERROR)
   {
      wnsprintfA(szBuf, CELEMS(szBuf), "ERROR MprAdminConnectionGetInfo   %d\n",Status);
      WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
      dwResult = MprAdminGetErrorString( Status, &lpszString);
      if (dwResult == NO_ERROR)
      {
         wnsprintfA(szBuf, CELEMS(szBuf), "ERROR  MprAdminConnectionGetInfo      %ws\n",lpszString);
         WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
      }
      else
         PrintGetStringError(dwResult);
   }
   else
   {
      pRasConnection1 = (RAS_CONNECTION_1 *) lplpbBuffer;
      wnsprintfA(szBuf, CELEMS(szBuf), "\n\nDumping RpRasConnection1::Called from ProcConnectionGetinfo:->MprAdminConnectionGetInfo\n");
      WRITE_LOG_FILE(cLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
      File_Print_Connection1(pRasConnection1);
      DbgPrint("\n\nDumping RpRasConnection1::Called from ProcConnectionGetinfo:->MprAdminConnectionGetInfo\n");
      Debug_Print_Connection1(pRasConnection1);
      MprAdminBufferFree(pRasConnection1);
   }
}

VOID ProcPortClearStat ( HANDLE hPort )

Definition at line 870 of file Admapit.c.

{
DWORD dwBytesWritten = 0;
CHAR szBuf[120];
WCHAR Buf[512];
WCHAR *lpszString;
lpszString = &Buf[0];

   if (phRasServer==NULL)
      return;

   // API Called:     MprAdminPortClearStats
   // Parameters:
   // IN RAS_SERVER_HANDLE phRasServer
   // IN HANDLE  hPort
   Status = MprAdminPortClearStats(phRasServer, hPort);
   if (Status != NO_ERROR)
   {
      wnsprintfA(szBuf, CELEMS(szBuf), "ERROR MprAdminPortClearStats   %d\n",Status);
      WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
      dwResult = MprAdminGetErrorString(Status,&lpszString);
      if (dwResult == ERROR_SUCCESS)
      {
         DbgPrint("ERROR  MprAdminPortClearStats      %ws\n",lpszString);
         wnsprintfA(szBuf, CELEMS(szBuf), "ERROR  MprAdminPortClearStats      %ws\n",lpszString);
         WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
      }
      else
         PrintGetStringError(dwResult);
   }
   else
   {
      DbgPrint("\n\nMprAdminPortClearStats Called From ProcPortClearStat, Now dumping structs \n");
      wnsprintfA(szBuf, CELEMS(szBuf), "\n\nMprAdminPortClearStats Called From ProcPortClearStat, Now dumping structs\n");
      WRITE_LOG_FILE(cLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
      ProcPortGetInfo(hPort);
   }

}

VOID ProcPortDisconnect ( HANDLE hPort )

Definition at line 1001 of file Admapit.c.

{
DWORD dwBytesWritten = 0;
CHAR szBuf[120];
WCHAR Buf[512];
WCHAR *lpszString;
lpszString = &Buf[0];

   if (phRasServer==NULL)
      return;

   // API Called:     MprAdminPortDisconnect
   // Parameters:
   // IN RAS_SERVER_HANDLE  phRasServer
   // IN HANDLE  hPort
   Status = MprAdminPortDisconnect(phRasServer, hPort);
   if (Status != NO_ERROR)
   {
      wnsprintfA(szBuf, CELEMS(szBuf), "ERROR MprAdminPortDisconnect   %d\n",Status);
      WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
      dwResult = MprAdminGetErrorString( Status, &lpszString);
      if (dwResult == ERROR_SUCCESS)
      {
         DbgPrint("ERROR  MprAdminPortDisconnect      %ws\n",lpszString);
         wnsprintfA(szBuf, CELEMS(szBuf), "ERROR  MprAdminPortDisconnect      %ws\n",lpszString);
         WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
      }
      else
         PrintGetStringError(dwResult);
   }
}

VOID ProcPortGetInfo ( HANDLE hPort )

Definition at line 1139 of file Admapit.c.

{
RAS_PORT_0 *pRasPort0;
RAS_PORT_1 *pRasPort1;
LPBYTE lplpbBuffer;
DWORD dwBytesWritten = 0;
CHAR  szBuf[120];
WCHAR *lpszString;
WCHAR Buf[512];
lpszString = &Buf[0];

   if (phRasServer==NULL)
      return;

   // API Called: MprAdminPortGetInfo
   // Parameters:
   // IN  RAS_SERVER_HANDLE phRasServer
   // IN DWORD    dwLevel
   // IN HANDLE   hPort
   // OUT LPBYTE * lplpbBuffer
   Status = MprAdminPortGetInfo(phRasServer,0,hPort,&lplpbBuffer);
   if (Status != NO_ERROR)
   {
      wnsprintfA(szBuf, CELEMS(szBuf), "ERROR MprAdminPortGetInfo   %d\n",Status);
      WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
      dwResult = MprAdminGetErrorString( Status, &lpszString);
      if (dwResult == NO_ERROR)
      {
         wnsprintfA(szBuf, CELEMS(szBuf), "ERROR  MprAdminPortGetInfo      %ws\n",lpszString);
         WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
      }
      else
         PrintGetStringError(dwResult);
   }
   else
   {
      pRasPort0 = (RAS_PORT_0 *) lplpbBuffer;
      wnsprintfA(szBuf, CELEMS(szBuf), "\n\nDumping RpRasPort0::Called from ProcPortGetInfo:-> MprAdminPortGetInfo\n");
      WRITE_LOG_FILE(cLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
      File_Print_RAS_PORT0(pRasPort0);
      DbgPrint("\n\nDumping RpRasPort0::Called from ProcPortGetInfo:->MprAdminPortGetInfo\n");
      Debug_Print_RAS_PORT0(pRasPort0);
      MprAdminBufferFree(pRasPort0);
   }

   Status = MprAdminPortGetInfo(phRasServer,1,hPort,&lplpbBuffer);
   if (Status != NO_ERROR)
   {
      wnsprintfA(szBuf, CELEMS(szBuf), "ERROR MprAdminPortGetInfo   %d\n",Status);
      WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
      dwResult = MprAdminGetErrorString( Status, &lpszString);
      if (dwResult == NO_ERROR)
      {
         wnsprintfA(szBuf,CELEMS(szBuf), "ERROR  MprAdminPortGetInfo      %ws\n",lpszString);
         WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
      }
      else
         PrintGetStringError(dwResult);
   }
   else
   {
      pRasPort1 = (RAS_PORT_1 *) lplpbBuffer;
      wnsprintfA(szBuf, CELEMS(szBuf), "\n\nDumping pRasPort1::Called from ProcPortGetInfo:->MprAdminPortGetInfo\n");
      WRITE_LOG_FILE(cLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
      File_Print_RAS_PORT1(pRasPort1);
      DbgPrint("\n\nDumping RpRasConnection1::Called from ProcPortGetInfo:->MprAdminPortGetInfo\n");
      Debug_Print_RAS_PORT1(pRasPort1);
      MprAdminBufferFree(pRasPort1);
   }
}

VOID ProcPortReset ( HANDLE hPort )

Definition at line 958 of file Admapit.c.

{
DWORD dwBytesWritten = 0;
CHAR szBuf[120];
WCHAR Buf[512];
WCHAR *lpszString;
lpszString = &Buf[0];

   if (phRasServer==NULL)
      return;

   // API Called:     MprAdminPortReset
   // Parameters:
   // IN RAS_SERVER_HANDLE  phRasServer
   // IN HANDLE  hPort
   Status = MprAdminPortReset(phRasServer, hPort);
   if (Status != NO_ERROR)
   {
      wnsprintfA(szBuf, CELEMS(szBuf), "ERROR MprAdminPortReset   %d\n",Status);
      WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
      dwResult = MprAdminGetErrorString(Status, &lpszString);
      if (dwResult == ERROR_SUCCESS)
      {
         DbgPrint("ERROR  MprAdminPortReset      %ws\n",lpszString);
         wnsprintfA(szBuf, CELEMS(szBuf), "ERROR  MprAdminPortReset      %ws\n",lpszString);
         WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
      }
      else
         PrintGetStringError(dwResult);
   }
   else
   {
      DbgPrint("\n\nMprAdminPortReset Called From ProcPortReset, Now dumping structs \n");
      wnsprintfA(szBuf, CELEMS(szBuf), "\n\nMprAdminPortReset Called From ProcPortReset, Now dumping structs\n");
      WRITE_LOG_FILE(cLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
      ProcPortGetInfo(hPort);
   }
}

DWORD WINAPI RasAdminClearDisc ( LPVOID param )

Definition at line 1038 of file Admapit.c.

{
CHAR option= ' ';
WORD i = 0;
INT  k = 0;

   while (!Quit)
   {
      // If the user hits q or Q then this will exit gracefully.
      // It may take some time to exit though.
      printf("Type Q to Quit\n");
      do
      {
         option = (CHAR)_getch();
         option = (CHAR)toupper(option);
         printf("%c\n",option);
      } while (((option) != 'q')&& ((option) != 'Q'));

      if (option == 'Q')
      {
         Quit = TRUE;
      }
   }
   return(0);
}

WCHAR * StrDupWFromA ( CHAR * psz )

Definition at line 143 of file Admapit.c.

{
   WCHAR* pszNew = NULL;

   if (psz)
   {
      DWORD cb;

      cb = MultiByteToWideChar( CP_ACP, 0, psz, -1, NULL, 0 );

      pszNew = malloc( cb * sizeof(WCHAR) );
      if (!pszNew)
      {
         return NULL;
      }

      cb = MultiByteToWideChar( CP_ACP, 0, psz, -1, pszNew, cb );
      if (cb == 0 && strlen(psz)!=0)
      {
         free( pszNew );
         return NULL;
      }
   }
   return pszNew;
}

VOID UserPrivilege | ( | WCHAR * | DomainName,
 |  | WCHAR * | UserName
 | ) |  |

Definition at line 380 of file Admapit.c.

{
DWORD dwResult;
CHAR  szBuf[120];
DWORD dwBytesWritten = 0;
WCHAR Buf[512];
WCHAR *lpszString;
static BYTE Dialin = 9;
lpszString = &Buf[0];
ppRasUser0 = &RasUser0;

   // API Called:     MprAdminGetPDCServer
   // Parameters:
   //  IN WCHAR * lpwsDomainName
   //  IN WCHAR * lpwsServerName
   //  OUT WCHAR * lpwsPDCServer

   dwResult = MprAdminGetPDCServer(DomainName, NULL, &szUserAccountServer[0]);

   if (dwResult != NO_ERROR)
   {
      dwResult = MprAdminGetPDCServer(NULL, RasSrv, &szUserAccountServer[0]);
   }

   if (dwResult == NO_ERROR)
   {
      // API Called:     MprAdminUserGetInfo
      // Parameters:
      // IN WCHAR * lpwsServerName
      // IN WCHAR * lpwsUserName
      // IN DWORD dwLevel
      // OUT LPBYTE *lpbBuffer
      dwResult = MprAdminUserGetInfo(szUserAccountServer, UserName,(DWORD) 0, (LPBYTE) ppRasUser0);
      if (dwResult != NO_ERROR)
      {
         wnsprintfA(szBuf, CELEMS(szBuf), "ERROR MprAdminUserGetInfo     %d\n",dwResult);
         WRITE_LOG_FILE(ErrLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
         wnsprintfA(szBuf, CELEMS(szBuf), "Parameters in:\n\tlpszServer=%ws\n\tlpszUser=%ws\n\tdwLevel=0,\n\tlpbBuffer)\n",
                        szUserAccountServer, UserName);
         WRITE_LOG_FILE(ErrLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);

         dwResult = MprAdminGetErrorString( dwResult, &lpszString);
         if (dwResult == NO_ERROR)
         {
            wnsprintfA(szBuf, CELEMS(szBuf), "ERROR  MprAdminUserGetInfo: string from MprAdminGetErrorString:  %ws\n",lpszString);
            WRITE_LOG_FILE(ErrLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
         }
         else
            PrintGetStringError(dwResult);
      }
      else //MprAdminUserGetInfo returned success
      {
         ppRasUser0->bfPrivilege = (RASPRIV_DialinPrivilege | Dialin  );
         wcsncpy(ppRasUser0->wszPhoneNumber, CallbackNumber,
                sizeof(ppRasUser0->wszPhoneNumber)/sizeof(ppRasUser0->wszPhoneNumber[0]));
         // API Called:     MprAdminUserSetInfo
         // Parameters:
         // IN WCHAR * lpwsServerName
         // IN WCHAR * lpwsUserName
         // IN DWORD dwLevel
         // IN LPBYTE lpbBuffer
         dwResult = MprAdminUserSetInfo(szUserAccountServer, UserName, 0, (LPBYTE)ppRasUser0);
         if (dwResult != NO_ERROR)
         {
            wnsprintfA(szBuf, CELEMS(szBuf), "ERROR: MprAdminUserSetInfo     %d\n",dwResult);
            WRITE_LOG_FILE(ErrLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);

            wnsprintfA(szBuf, CELEMS(szBuf), "Parameters in:\n\tlpszServer=%ws\n\tlpszUser=%ws\n\tdwLevel=0,\n\tlpbBuffer)\n",
                           szUserAccountServer, UserName);
            WRITE_LOG_FILE(ErrLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
            // dump this out to see what privileges were passed in UserSetInfo call
            PrintPriv(szUserAccountServer, UserName);

            dwResult = MprAdminGetErrorString( dwResult, &lpszString);
            if (dwResult == ERROR_SUCCESS)
            {
               wnsprintfA(szBuf, CELEMS(szBuf), "ERROR  MprAdminUserSetInfo: string from MprAdminGetErrorString:  %ws\n",lpszString);
               WRITE_LOG_FILE(ErrLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
            }
            else
               PrintGetStringError(dwResult);
         }
         else
         {
            PrintPriv(szUserAccountServer, UserName);
         }

         //
         // cycle thru these Callback privilege values
         //
         // Dialin = 9 : No Callback
         // Dialin = 10: Admin Sets Callback Number
         // Dialin = 12: Caller Sets Callback Number
         switch (Dialin)
         {
            case 9:
                Dialin = 10;
                break;
            case 10:
                Dialin = 12;
                break;
            case 12:
                Dialin = 9;
                break;
            default:
                break;
         }

      } // end of loop for MprAdminUserGetInfo returning success

   }
   else //MprAdminGetPDCServer returned an error
   {
      DbgPrint("ERROR  MprAdminGetPDCServer     %d\n",dwResult);
      wnsprintfA(szBuf, CELEMS(szBuf), "ERROR  MprAdminGetPDCServer     %d\n",dwResult);
      WRITE_LOG_FILE(ErrLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
      wnsprintfA(szBuf, CELEMS(szBuf), "Parameters in:\n\tlpszDomain=%ws\n\tlpszServer=NULL\n", DomainName);
      WRITE_LOG_FILE(ErrLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);

      dwResult = MprAdminGetErrorString(dwResult, &lpszString);
      if (dwResult == NO_ERROR)
      {
         wnsprintfA(szBuf, CELEMS(szBuf), "ERROR  MprAdminGetPDCServer      %ws\n",lpszString);
         WRITE_LOG_FILE(ErrLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
      }
      else
         PrintGetStringError(dwResult);
   }

}  //end UserPrivilege()

Variable Documentation

CHAR buf[120]

Definition at line 120 of file Admapit.c.

WCHAR CallbackNumber[255]

Definition at line 121 of file Admapit.c.

BOOL cErrLogInValid = FALSE

Definition at line 128 of file Admapit.c.

HANDLE cLogFile = NULL

Definition at line 117 of file Admapit.c.

DWORD dwBytesWritten = 0

Definition at line 125 of file Admapit.c.

DWORD dwResult = 0

Definition at line 124 of file Admapit.c.

HANDLE ErrLogFile = NULL

Definition at line 118 of file Admapit.c.

BOOL ErrLogInValid = FALSE

Definition at line 127 of file Admapit.c.

BOOL First_Call = TRUE

Definition at line 122 of file Admapit.c.

BOOL FirstCall = TRUE

Definition at line 130 of file Admapit.c.

HANDLE LogFile = NULL

Definition at line 116 of file Admapit.c.

BOOL LogInValid = TRUE

Definition at line 129 of file Admapit.c.

WCHAR lpszServerName[50]

Definition at line 134 of file Admapit.c.

RAS_SERVER_HANDLE phRasServer

Definition at line 138 of file Admapit.c.

PRAS_USER_0 ppRasUser0

Definition at line 132 of file Admapit.c.

BOOL Quit = FALSE

Definition at line 136 of file Admapit.c.

WCHAR RasSrv[64]

Definition at line 135 of file Admapit.c.

RAS_USER_0 RasUser0

Definition at line 133 of file Admapit.c.

DWORD Status = 0

Definition at line 123 of file Admapit.c.

CHAR szBuf[120]

Definition at line 126 of file Admapit.c.

WCHAR szUserAccountServer[UNLEN+1]

Definition at line 131 of file Admapit.c.

Generated on Wed Nov 13 2024 16:54:02 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/Callout/AdminDll.c File Reference

  • NetDS
  • RRas
  • Callout
Classes | Defines | Typedefs | Functions | Variables

AdminDll.c File Reference

#include <windows.h>
#include <stdlib.h>
#include <string.h>
#include <lm.h>
#include <stdio.h>
#include <time.h>
#include <mprapi.h>
#include <memory.h>
#include "Shlwapi.h"

Go to the source code of this file.

Classes

struct | Static_Info_Database
struct | Static_Statistic

Defines

#define | CELEMS(x) ((sizeof(x))/(sizeof(x[0])))
#define | Num_Ip_Address 254
#define | Number_Of_Flags 6

Typedefs

typedef struct Static_Info_Database | Static_Info_Database
typedef struct Static_Statistic | Static_Statistic

Functions

ULONG _cdecl | DbgPrint (PCH Format,...)
VOID | Debug_Print_RasConnection (IN RAS_CONNECTION_0 *pRasConnection0, IN RAS_CONNECTION_1 *pRasConnection1)
VOID | Debug_Print_RasPort (IN RAS_PORT_0 *pRasPort0, IN RAS_PORT_1 *pRasPort1)
BOOL | DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved)
VOID | File_Print_RasConnection (IN RAS_CONNECTION_0 *pRasConnection0, IN RAS_CONNECTION_1 *pRasConnection1)
VOID | File_Print_RasPort (IN RAS_PORT_0 *pRasPort0, IN RAS_PORT_1 *pRasPort1)
VOID | Finalize (void)
VOID | Init (void)
VOID | Init2 (void)
BOOL APIENTRY | MprAdminAcceptNewConnection (IN RAS_CONNECTION_0 *pRasConnection0, IN RAS_CONNECTION_1 *pRasConnection1)
BOOL APIENTRY | MprAdminAcceptNewLink (IN RAS_PORT_0 *pRasPort0, IN RAS_PORT_1 *pRasPort1)
VOID APIENTRY | MprAdminConnectionHangupNotification (IN RAS_CONNECTION_0 *pRasConnection0, IN RAS_CONNECTION_1 *pRasConnection1)
DWORD APIENTRY | MprAdminGetIpAddressForUser (IN WCHAR *lpszUserName, IN WCHAR *lpszPortName, IN OUT DWORD *pipAddress, OUT BOOL *pfNotifyDLL)
VOID APIENTRY | MprAdminLinkHangupNotification (IN RAS_PORT_0 *pRasPort0, IN RAS_PORT_1 *pRasPort1)
VOID APIENTRY | MprAdminReleaseIpAddress (IN WCHAR *lpszUserName, IN WCHAR *lpszPortName, IN OUT DWORD *pipAddress)
DWORD APIENTRY | MprAdminTerminateDll ()
WCHAR * | StrDupWFromA (CHAR *psz)

Variables

HANDLE | ConDisFile = NULL
BOOL | ConnectDisconnectInValid = FALSE
HANDLE Connection_Handle
HANDLE | ErrLogFile = NULL
HANDLE | ErrLogFileIP = NULL
BOOL | ErrLogIPInValid = FALSE
BOOL | ErrorLogInValid = FALSE
BOOL | First_Call = TRUE
HANDLE | IPFile = NULL
BOOL | IPFileInValid = FALSE
Static_Statistic | Static_Check_Stats [Num_Ip_Address]
Static_Info_Database | Static_Connection_Info [Num_Ip_Address]
DWORD | TempIpAddress = 0x010A0F0E

Define Documentation

#define CELEMS ( x ) ((sizeof(x))/(sizeof(x[0])))

Definition at line 51 of file AdminDll.c.

#define Num_Ip_Address 254

Definition at line 83 of file AdminDll.c.

#define Number_Of_Flags 6

Definition at line 82 of file AdminDll.c.

Typedef Documentation

typedef struct Static_Info_Database Static_Info_Database
typedef struct Static_Statistic Static_Statistic

Function Documentation

ULONG _cdecl DbgPrint | ( | PCH | Format,
 |  |  | ...
 | ) |  |

Definition at line 169 of file AdminDll.c.

{
    WCHAR buffer[255];
    WCHAR *temp=NULL;
    LPINT lpResult=0;
    va_list marker;
    va_start (marker,Format);

    temp = StrDupWFromA(Format);
    if (temp)
    {
        wvnsprintfW(buffer, CELEMS(buffer), temp, marker);
        OutputDebugString (buffer);
        free(temp);
    }

    return TRUE;

}

VOID Debug_Print_RasConnection | ( | IN RAS_CONNECTION_0 * | pRasConnection0,
 |  | IN RAS_CONNECTION_1 * | pRasConnection1
 | ) |  |

Definition at line 708 of file AdminDll.c.

{
WCHAR *Interface_Type[] =
   {
   L"ROUTER_IF_TYPE_CLIENT",
   L"ROUTER_IF_TYPE_HOME_ROUTER",
   L"ROUTER_IF_TYPE_FULL_ROUTER",
   L"ROUTER_IF_TYPE_DEDICATED",
   L"ROUTER_IF_TYPE_INTERNAL",
   L"ROUTER_IF_TYPE_INTERNAL"
   };

INT i = 0;
DWORD dwBytesWritten = 0;

   if (NULL == pRasConnection0 || NULL == pRasConnection1)
   {
      return;
   }

   //dumping pRasConnection0
   DbgPrint("pRasConnection0->hConnection  %d\n",pRasConnection0->hConnection);
   DbgPrint("pRasConnection0->hInterface   %d\n",pRasConnection0->hInterface);
   DbgPrint("pRasConnection0->dwConnectDuration  %d\n",pRasConnection0->dwConnectDuration);
   DbgPrint("pRasConnection0->dwInterfaceType  %ws\n",Interface_Type[pRasConnection0->dwInterfaceType]);
   DbgPrint("pRasConnection0->dwConnectionFlags  %d\n",pRasConnection0->dwConnectionFlags);
   DbgPrint("pRasConnection0->wszInterfaceName  %ws\n",pRasConnection0->wszInterfaceName);
   DbgPrint("pRasConnection0->wszUserName  %ws\n",pRasConnection0->wszUserName);
   DbgPrint("pRasConnection0->wszLogonDomain  %ws\n",pRasConnection0->wszLogonDomain);
   DbgPrint("pRasConnection0->wszRemoteComputer  %ws\n",pRasConnection0->wszRemoteComputer);

   //dumping pRasConnection1
   DbgPrint( "\n\npRasConnection1->hConnection  %d\n",pRasConnection1->hConnection);
   DbgPrint( "pRasConnection1->hInterface   %d\n",pRasConnection1->hInterface);
   DbgPrint( "pRasConnection1->PppInfo.nbf.dwError %d\n",pRasConnection1->PppInfo.nbf.dwError);
   DbgPrint( "pRasConnection1->PppInfo.nbf.wszWksta %ws\n",pRasConnection1->PppInfo.nbf.wszWksta);
   DbgPrint( "pRasConnection1->PppInfo.ip.dwError %d\n",pRasConnection1->PppInfo.ip.dwError);
   DbgPrint( "pRasConnection1->PppInfo.ip.wszAddress %ws\n",pRasConnection1->PppInfo.ip.wszAddress);
   DbgPrint( "pRasConnection1->PppInfo.ip.wszRemoteAddress %ws\n",pRasConnection1->PppInfo.ip.wszRemoteAddress);
   DbgPrint( "pRasConnection1->PppInfo.ipx.dwError %d\n",pRasConnection1->PppInfo.ipx.dwError);
   DbgPrint( "pRasConnection1->PppInfo.ipx.wszAddress %ws\n",pRasConnection1->PppInfo.ipx.wszAddress);
   DbgPrint( "pRasConnection1->PppInfo.at.dwError  %d\n",pRasConnection1->PppInfo.at.dwError );
   DbgPrint( "pRasConnection1->PppInfo.at.wszAddress %ws\n",pRasConnection1->PppInfo.at.wszAddress);

   //connection stats
   DbgPrint( "pRasConnection1->dwBytesXmited=%d\n", pRasConnection1->dwBytesXmited );
   DbgPrint( "pRasConnection1->dwBytesRcved=%d\n", pRasConnection1->dwBytesRcved );
   DbgPrint( "pRasConnection1->dwFramesXmited=%d\n", pRasConnection1->dwFramesXmited );
   DbgPrint( "pRasConnection1->dwFramesRcved=%d\n", pRasConnection1->dwFramesRcved);
   DbgPrint( "pRasConnection1->dwCrcErr=%d\n", pRasConnection1->dwCrcErr);
   DbgPrint( "pRasConnection1->dwTimeoutErr=%d\n", pRasConnection1->dwTimeoutErr);
   DbgPrint( "pRasConnection1->dwAlignmentErr=%d\n", pRasConnection1->dwAlignmentErr);
   DbgPrint( "pRasConnection1->dwHardwareOverrunErr=%d\n", pRasConnection1->dwHardwareOverrunErr);
   DbgPrint( "pRasConnection1->dwFramingErr=%d\n", pRasConnection1->dwFramingErr);
   DbgPrint( "pRasConnection1->dwBufferOverrunErr=%d\n", pRasConnection1->dwBufferOverrunErr);
}

VOID Debug_Print_RasPort | ( | IN RAS_PORT_0 * | pRasPort0,
 |  | IN RAS_PORT_1 * | pRasPort1
 | ) |  |

Definition at line 866 of file AdminDll.c.

{
   WCHAR *Line_Condition[] =
      {
      L"RAS_PORT_NON_OPERATIONAL",
      L"RAS_PORT_DISCONNECTED",
      L"RAS_PORT_CALLING_BACK",
      L"RAS_PORT_LISTENING",
      L"RAS_PORT_AUTHENTICATING",
      L"RAS_PORT_AUTHENTICATED",
      L"RAS_PORT_INITIALIZING"
      };

   WCHAR *Hdw_Error[] =
      {
      L"RAS_HARDWARE_OPERATIONAL",
      L"RAS_HARDWARE_FAILURE"
      };

   DWORD dwBytesWritten = 0;

   if (NULL == pRasPort0 || NULL == pRasPort1)
   {
        return;
   }

  //dumping pRasPort0
   DbgPrint("pRasPort0->hPort  %d\n",pRasPort0->hPort);
   DbgPrint("pRasPort0->hConnection   %d\n",pRasPort0->hConnection);
   DbgPrint("pRasPort0->dwPortCondition  %ws\n",Line_Condition[pRasPort0->dwPortCondition-1]);
   DbgPrint("pRasPort0->dwTotalNumberOfCalls  %d\n",pRasPort0->dwTotalNumberOfCalls);
   DbgPrint("pRasPort0->dwConnectDuration  %d\n",pRasPort0->dwConnectDuration);
   DbgPrint("pRasPort0->wszPortName  %ws\n",pRasPort0->wszPortName);
   DbgPrint("pRasPort0->wszMediaName  %ws\n",pRasPort0->wszMediaName);
   DbgPrint("pRasPort0->wszDeviceName  %ws\n",pRasPort0->wszDeviceName);
   DbgPrint("pRasPort0->wszDeviceType  %ws\n",pRasPort0->wszDeviceType);

   //dumping pRasPort1
   DbgPrint("pRasPort1->hPort  %d\n",pRasPort1->hPort);
   DbgPrint("pRasPort1->hConnection   %d\n",pRasPort1->hConnection);
   DbgPrint("pRasPort1->dwHardwareCondition  %ws\n",Hdw_Error[pRasPort1->dwHardwareCondition]);

   //connection stats
   DbgPrint( "pRasPort1->dwLineSpeed=%d\n", pRasPort1->dwLineSpeed );
   DbgPrint( "pRasPort1->dwBytesXmited=%d\n", pRasPort1->dwBytesXmited );
   DbgPrint( "pRasPort1->dwBytesRcved=%d\n", pRasPort1->dwBytesRcved );
   DbgPrint( "pRasPort1->dwFramesXmited=%d\n", pRasPort1->dwFramesXmited );
   DbgPrint( "pRasPort1->dwFramesRcved=%d\n", pRasPort1->dwFramesRcved);
   DbgPrint( "pRasPort1->dwCrcErr=%d\n", pRasPort1->dwCrcErr);
   DbgPrint( "pRasPort1->dwTimeoutErr=%d\n", pRasPort1->dwTimeoutErr);
   DbgPrint( "pRasPort1->dwAlignmentErr=%d\n", pRasPort1->dwAlignmentErr);
   DbgPrint( "pRasPort1->dwHardwareOverrunErr=%d\n", pRasPort1->dwHardwareOverrunErr);
   DbgPrint( "pRasPort1->dwFramingErr=%d\n", pRasPort1->dwFramingErr);
   DbgPrint( "pRasPort1->dwBufferOverrunErr=%d\n", pRasPort1->dwBufferOverrunErr);
}

BOOL DllMain | ( | HINSTANCE | hinstDLL,
 |  | DWORD | fdwReason,
 |  | LPVOID | lpReserved
 | ) |  |

Definition at line 283 of file AdminDll.c.

{
    // Perform actions based on the reason for calling.
    switch( fdwReason )
    {
       case DLL_PROCESS_ATTACH:
       // Initialize once for each new process.
       // Return FALSE to fail DLL load.
        break;

       case DLL_THREAD_ATTACH:
       // Do thread-specific initialization.
       break;

       case DLL_THREAD_DETACH:
       // Do thread-specific cleanup.
       break;

       case DLL_PROCESS_DETACH:
       // Perform any necessary cleanup.
       break;

    }

    return TRUE;  // Successful DLL_PROCESS_ATTACH.
}

VOID File_Print_RasConnection | ( | IN RAS_CONNECTION_0 * | pRasConnection0,
 |  | IN RAS_CONNECTION_1 * | pRasConnection1
 | ) |  |

Definition at line 770 of file AdminDll.c.

{
   WCHAR *Interface_Type[] =
     {
     L"ROUTER_IF_TYPE_CLIENT",
     L"ROUTER_IF_TYPE_HOME_ROUTER",
     L"ROUTER_IF_TYPE_FULL_ROUTER",
     L"ROUTER_IF_TYPE_DEDICATED",
     L"ROUTER_IF_TYPE_INTERNAL",
     L"ROUTER_IF_TYPE_INTERNAL"
     };

   INT  i = 0;
   CHAR buf[512];
   DWORD dwBytesWritten = 0;

   if (NULL == pRasConnection0 || NULL == pRasConnection1)
   {
       return;
   }

   //write to file
   //dumping pRasConnection0
   WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasConnection0->hConnection  %l64d\n",pRasConnection0->hConnection);
   WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasConnection0->hInterface   %l64d\n",pRasConnection0->hInterface);
   WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasConnection0->dwConnectDuration  %d\n",pRasConnection0->dwConnectDuration);

   WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasConnection0->dwInterfaceType  %ws\n",Interface_Type[pRasConnection0->dwInterfaceType]);
   WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasConnection0->dwConnectionFlags  %d\n",pRasConnection0->dwConnectionFlags);
   WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasConnection0->wszInterfaceName  %ws\n",pRasConnection0->wszInterfaceName);
   WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasConnection0->wszUserName  %ws\n",pRasConnection0->wszUserName);
   WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasConnection0->wszLogonDomain  %ws\n",pRasConnection0->wszLogonDomain);
   WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "pRasConnection0->wszRemoteComputer  %ws\n",pRasConnection0->wszRemoteComputer);

   //dumping pRasConnection1
   WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "dumping pRasConnection1\n");
   WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf),  "\n\npRasConnection1->hConnection  %l64d\n",pRasConnection1->hConnection);
   WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf),  "pRasConnection1->hInterface   %l64d\n",pRasConnection1->hInterface);
   WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf),  "pRasConnection1->PppInfo.nbf.dwError %d\n",pRasConnection1->PppInfo.nbf.dwError);
   WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf),  "pRasConnection1->PppInfo.nbf.wszWksta %ws\n",pRasConnection1->PppInfo.nbf.wszWksta);
   WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf),  "pRasConnection1->PppInfo.ip.dwError %d\n",pRasConnection1->PppInfo.ip.dwError);
   WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf),  "pRasConnection1->PppInfo.ip.wszAddress %ws\n",pRasConnection1->PppInfo.ip.wszAddress);
   WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf),  "pRasConnection1->PppInfo.ip.wszRemoteAddress %ws\n",pRasConnection1->PppInfo.ip.wszRemoteAddress);
   WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf),  "pRasConnection1->PppInfo.ipx.dwError %d\n",pRasConnection1->PppInfo.ipx.dwError);
   WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf),  "pRasConnection1->PppInfo.ipx.wszAddress %ws\n",pRasConnection1->PppInfo.ipx.wszAddress);
   WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf),  "pRasConnection1->PppInfo.at.dwError  %d\n",pRasConnection1->PppInfo.at.dwError );
   WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf),  "pRasConnection1->PppInfo.at.wszAddress %ws\n",pRasConnection1->PppInfo.at.wszAddress);

   //connection stats
   WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf),  "pRasConnection1->dwBytesXmited=%d\n", pRasConnection1->dwBytesXmited );
   WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf),  "pRasConnection1->dwBytesRcved=%d\n", pRasConnection1->dwBytesRcved );
   WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf),  "pRasConnection1->dwFramesXmited=%d\n", pRasConnection1->dwFramesXmited );
   WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf),  "pRasConnection1->dwFramesRcved=%d\n", pRasConnection1->dwFramesRcved);
   WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf),  "pRasConnection1->dwCrcErr=%d\n", pRasConnection1->dwCrcErr);
   WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf),  "pRasConnection1->dwTimeoutErr=%d\n", pRasConnection1->dwTimeoutErr);
   WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf),  "pRasConnection1->dwAlignmentErr=%d\n", pRasConnection1->dwAlignmentErr);
   WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf),  "pRasConnection1->dwHardwareOverrunErr=%d\n", pRasConnection1->dwHardwareOverrunErr);
   WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf),  "pRasConnection1->dwFramingErr=%d\n", pRasConnection1->dwFramingErr);
   WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf),  "pRasConnection1->dwBufferOverrunErr=%d\n", pRasConnection1->dwBufferOverrunErr);
   WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
}

VOID File_Print_RasPort | ( | IN RAS_PORT_0 * | pRasPort0,
 |  | IN RAS_PORT_1 * | pRasPort1
 | ) |  |

Definition at line 925 of file AdminDll.c.

{
    WCHAR *Line_Condition[] =
    {
      L"RAS_PORT_NON_OPERATIONAL",
      L"RAS_PORT_DISCONNECTED",
      L"RAS_PORT_CALLING_BACK",
      L"RAS_PORT_LISTENING",
      L"RAS_PORT_AUTHENTICATING",
      L"RAS_PORT_AUTHENTICATED",
      L"RAS_PORT_INITIALIZING"
     };

    WCHAR *Hdw_Error[] =
    {
      L"RAS_HARDWARE_OPERATIONAL",
      L"RAS_HARDWARE_FAILURE"
     };

    CHAR  buf[512];
    DWORD dwBytesWritten = 0;

    if (NULL == pRasPort0 || NULL == pRasPort1)
    {
        return;
    }

    //dumping pRasPort0 to a file
    WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
    wnsprintfA(buf, CELEMS(buf), "pRasPort0->hPort  %l64d\n",pRasPort0->hPort);
    WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
    wnsprintfA(buf, CELEMS(buf), "pRasPort0->hConnection   %l64d\n",pRasPort0->hConnection);
    WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
    wnsprintfA(buf, CELEMS(buf), "pRasPort0->dwPortCondition  %ws\n",Line_Condition[pRasPort0->dwPortCondition-1]);
    WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
    wnsprintfA(buf, CELEMS(buf), "pRasPort0->dwTotalNumberOfCalls  %d\n",pRasPort0->dwTotalNumberOfCalls);
    WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
    wnsprintfA(buf, CELEMS(buf), "pRasPort0->dwConnectDuration  %d\n",pRasPort0->dwConnectDuration);
    WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
    wnsprintfA(buf, CELEMS(buf), "pRasPort0->wszPortName  %ws\n",pRasPort0->wszPortName);
    WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
    wnsprintfA(buf, CELEMS(buf), "pRasPort0->wszMediaName  %ws\n",pRasPort0->wszMediaName);
    WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
    wnsprintfA(buf, CELEMS(buf), "pRasPort0->wszDeviceName  %ws\n",pRasPort0->wszDeviceName);
    WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
    wnsprintfA(buf, CELEMS(buf), "pRasPort0->wszDeviceType  %ws\n",pRasPort0->wszDeviceType);

    //dumping pRasPort1
    WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
    wnsprintfA(buf, CELEMS(buf), "\n dumping pRasPort1\n");
    WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
    wnsprintfA(buf, CELEMS(buf), "pRasPort1->hPort  %l64d\n",pRasPort1->hPort);
    WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
    wnsprintfA(buf, CELEMS(buf), "pRasPort1->hConnection   %l64d\n",pRasPort1->hConnection);
    WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
    wnsprintfA(buf, CELEMS(buf), "pRasPort1->dwHardwareCondition  %ws\n",Hdw_Error[pRasPort1->dwHardwareCondition]);

    //connection stats
    WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
    wnsprintfA(buf, CELEMS(buf),  "pRasPort1->dwLineSpeed=%d\n", pRasPort1->dwLineSpeed );
    WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
    wnsprintfA(buf, CELEMS(buf),  "pRasPort1->dwBytesXmited=%d\n", pRasPort1->dwBytesXmited );
    WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
    wnsprintfA(buf, CELEMS(buf),  "pRasPort1->dwBytesRcved=%d\n", pRasPort1->dwBytesRcved );
    WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
    wnsprintfA(buf, CELEMS(buf),  "pRasPort1->dwFramesXmited=%d\n", pRasPort1->dwFramesXmited );
    WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
    wnsprintfA(buf, CELEMS(buf),  "pRasPort1->dwFramesRcved=%d\n", pRasPort1->dwFramesRcved);
    WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
    wnsprintfA(buf, CELEMS(buf),  "pRasPort1->dwCrcErr=%d\n", pRasPort1->dwCrcErr);
    WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
    wnsprintfA(buf, CELEMS(buf),  "pRasPort1->dwTimeoutErr=%d\n", pRasPort1->dwTimeoutErr);
    WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
    wnsprintfA(buf, CELEMS(buf),  "pRasPort1->dwAlignmentErr=%d\n", pRasPort1->dwAlignmentErr);
    WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
    wnsprintfA(buf, CELEMS(buf),  "pRasPort1->dwHardwareOverrunErr=%d\n", pRasPort1->dwHardwareOverrunErr);
    WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
    wnsprintfA(buf, CELEMS(buf),  "pRasPort1->dwFramingErr=%d\n", pRasPort1->dwFramingErr);
    WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
    wnsprintfA(buf, CELEMS(buf),  "pRasPort1->dwBufferOverrunErr=%d\n", pRasPort1->dwBufferOverrunErr);
    WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);

}

VOID Finalize ( void )

Definition at line 274 of file AdminDll.c.

{
    CloseHandle(IPFile);
    CloseHandle(ErrLogFileIP);
    CloseHandle(ConDisFile);
    CloseHandle(ErrLogFile);
}

HRESULT Init ( void )

Definition at line 197 of file AdminDll.c.

{
INT i=0;

   IPFile = CreateFile(TEXT("IpAddress.log"),
                       GENERIC_READ|GENERIC_WRITE,
                       FILE_SHARE_READ,
                       (LPSECURITY_ATTRIBUTES) NULL,
                       CREATE_ALWAYS,
                       0,
                       (HANDLE) NULL);
   if (IPFile== INVALID_HANDLE_VALUE)
   {
      IPFileInValid = TRUE;
   }
   ErrLogFileIP = CreateFile(TEXT("IpAddError.log"),
                             GENERIC_READ|GENERIC_WRITE,
                             FILE_SHARE_READ,
                             (LPSECURITY_ATTRIBUTES) NULL,
                             CREATE_ALWAYS,
                             0,
                             (HANDLE) NULL);

   if (ErrLogFileIP== INVALID_HANDLE_VALUE)
   {
      ErrLogIPInValid = TRUE;
   }

}

VOID Init2 ( void )

Definition at line 231 of file AdminDll.c.

{
INT i=0;

   ConDisFile = CreateFile(TEXT("ConDis.log"),
                           GENERIC_READ|GENERIC_WRITE,
                           FILE_SHARE_READ,
                           (LPSECURITY_ATTRIBUTES) NULL,
                           OPEN_ALWAYS,
                           0,
                           (HANDLE) NULL);
   if (ConDisFile== INVALID_HANDLE_VALUE)
   {
      ConnectDisconnectInValid = TRUE;
   }

   ErrLogFile = CreateFile(TEXT("AdminErr.log"),
                           GENERIC_READ|GENERIC_WRITE,
                           FILE_SHARE_READ,
                           (LPSECURITY_ATTRIBUTES) NULL,
                           OPEN_ALWAYS,
                           0,
                           (HANDLE) NULL);

   if (ErrLogFile == INVALID_HANDLE_VALUE)
   {
      ErrorLogInValid = TRUE;
   }

   for (i=0;i < Num_Ip_Address; i++)
   {
      Static_Check_Stats[i].bTaken=FALSE;
      TempIpAddress += 0x01000000;

      if ((TempIpAddress | 0x0ff000000) == 0x0ff000000)
         TempIpAddress = 0x010A0F0E;

      Static_Check_Stats[i].IpAddress = TempIpAddress;
      Static_Connection_Info[i].bTaken = FALSE;
   }

}

BOOL APIENTRY MprAdminAcceptNewConnection | ( | IN RAS_CONNECTION_0 * | pRasConnection0,
 |  | IN RAS_CONNECTION_1 * | pRasConnection1
 | ) |  |

Definition at line 451 of file AdminDll.c.

{
INT i=0;
CHAR buf[512];
DWORD dwBytesWritten=0;

   DbgPrint("MprAdminAcceptNewConnection Called\n");

   if (NULL == pRasConnection0 || NULL == pRasConnection1)
   {
       DbgPrint("MprAdminAcceptNewConnection Invalid Parameter\n");
        return FALSE;
   }

   Debug_Print_RasConnection(pRasConnection0,pRasConnection1);
   WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf,CELEMS(buf), "MprAdminAcceptNewConnection Called::dumping pRasConnection0\n\n");
   File_Print_RasConnection(pRasConnection0,pRasConnection1);

   if (( lstrcmp( pRasConnection0->wszUserName, TEXT("Administrator") ) ) == 0)
   {
      DbgPrint("Do not Accept Connection\n");
      FlushFileBuffers(ErrLogFile);
      FlushFileBuffers(ConDisFile);
      return( FALSE );
   }
   else
   {
      for (i=0;i < Num_Ip_Address; i++)
         if (!(Static_Connection_Info[i].bTaken))
         {
            Static_Connection_Info[i].bTaken = TRUE;
            Static_Connection_Info[i].hConnection=pRasConnection0->hConnection;
            memcpy(&Static_Connection_Info[i].pRasConnection0,pRasConnection0, sizeof(RAS_CONNECTION_0));
            memcpy(&Static_Connection_Info[i].pRasConnection1,pRasConnection1, sizeof(RAS_CONNECTION_1));
            break;
         }

       DbgPrint("Accept Connection\n");
       FlushFileBuffers(ErrLogFile);
       FlushFileBuffers(ConDisFile);
       return( TRUE );
    }
    return( TRUE );
}

BOOL APIENTRY MprAdminAcceptNewLink | ( | IN RAS_PORT_0 * | pRasPort0,
 |  | IN RAS_PORT_1 * | pRasPort1
 | ) |  |

Definition at line 502 of file AdminDll.c.

{
CHAR  buf[512];
DWORD dwBytesWritten = 0;

    if (NULL == pRasPort0 || NULL == pRasPort1)
    {
        return FALSE;
    }

   Multilink_Count++;
   /* Multilink_Count can be set through regedit.exe to make it little more portable */
   /* Currently it is hard coded in this sample, so that no connection can have more than 2 ports */
   if (Multilink_Count == 1)
      Connection_Handle = pRasPort0->hConnection;/* this is the first port */

   //to check if the call is first rassrv call out. If yes, call Initialize routine
   DbgPrint("MprAdminAcceptNewLink Called, times  %d\n",Multilink_Count);
   Debug_Print_RasPort(pRasPort0,pRasPort1);

   //dumping pRasPort0 to a file
   WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf,CELEMS(buf), "MprAdminAcceptNewLink Called time %d::dumping pRasPort0 to file\n",Multilink_Count);
   File_Print_RasPort(pRasPort0,pRasPort1);

   /* if the Connection_Handle is not same then it is a new call, reset the counter to 1 */
   if (Connection_Handle != pRasPort0->hConnection)
   {
      if (Multilink_Count > 1)
      {
         Connection_Handle = pRasPort0->hConnection;
         Multilink_Count = 1;
         return TRUE;
      }
      else
         return FALSE;
   }
   /* Connection_Handle same as previous port then restrict the number of ports. */
   /* Just return FALSE */
   if (Multilink_Count > 2)
   {
      DbgPrint("MprAdminAcceptNewLink(): Multilink_Count=%d > 2  so return FALSE\n", Multilink_Count);
      return FALSE;
   }

   return TRUE;

}

VOID APIENTRY MprAdminConnectionHangupNotification | ( | IN RAS_CONNECTION_0 * | pRasConnection0,
 |  | IN RAS_CONNECTION_1 * | pRasConnection1
 | ) |  |

Definition at line 583 of file AdminDll.c.

{
INT i = 0;
DWORD dwBytesWritten = 0;
CHAR  buf[120];

   DbgPrint( "\nMprAdminConnectionHangupNotification called \n" );

    if (NULL == pRasConnection0 || NULL == pRasConnection1)
    {
        DbgPrint( "\nMprAdminConnectionHangupNotification Invalid Parameter\n" );
        return;
    }

   Debug_Print_RasConnection(pRasConnection0,pRasConnection1);
   WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf, CELEMS(buf), "MprAdminConnectionHangupNotification called::dumping pRasConnection0\n\n");
   File_Print_RasConnection(pRasConnection0,pRasConnection1);

   //Sanity checks
   for (i=0; i < Num_Ip_Address; i++)
   {
      if ((Static_Connection_Info[i].bTaken) && (Static_Connection_Info[i].hConnection == pRasConnection0->hConnection))
      {
         Static_Connection_Info[i].bTaken = FALSE;
         if (ErrorLogInValid)
         {
            if (Static_Connection_Info[i].pRasConnection0.hConnection != pRasConnection0->hConnection)
               DbgPrint("ERROR Connection Handle differs   %d-> Stored,    %d->Passed\n",
                        Static_Connection_Info[i].pRasConnection0.hConnection, pRasConnection0->hConnection);

            if (Static_Connection_Info[i].pRasConnection0.hInterface != pRasConnection0->hInterface)
               DbgPrint("ERROR Interface Handle differs   %d-> Stored,    %d->Passed\n",
                        Static_Connection_Info[i].pRasConnection0.hInterface, pRasConnection0->hInterface);

            if (Static_Connection_Info[i].pRasConnection0.dwConnectDuration > pRasConnection0->dwConnectDuration)
               DbgPrint("ERROR Duration time is less %d-> Stored,    %d->Passed\n",
                        Static_Connection_Info[i].pRasConnection0.dwConnectDuration, pRasConnection0->dwConnectDuration);

            if (Static_Connection_Info[i].pRasConnection0.dwInterfaceType != pRasConnection0->dwInterfaceType)
               DbgPrint("ERROR Interface Type differs   %d-> Stored,    %d->Passed\n",
                        Static_Connection_Info[i].pRasConnection0.dwInterfaceType != pRasConnection0->dwInterfaceType);

            if (Static_Connection_Info[i].pRasConnection0.dwConnectionFlags != pRasConnection0->dwConnectionFlags)
               DbgPrint("ERROR Connection Flags differs   %d-> Stored,    %d->Passed\n",
                        Static_Connection_Info[i].pRasConnection0.dwConnectionFlags, pRasConnection0->dwConnectionFlags);

            if (wcscmp(Static_Connection_Info[i].pRasConnection0.wszInterfaceName,pRasConnection0->wszInterfaceName) != 0)
               DbgPrint("ERROR Interface Name Differs    %ws ->Stored,   %ws ->Passed\n",
                        Static_Connection_Info[i].pRasConnection0.wszInterfaceName,pRasConnection0->wszInterfaceName);

            if (wcscmp(Static_Connection_Info[i].pRasConnection0.wszUserName,pRasConnection0->wszUserName) != 0)
               DbgPrint("ERROR User Name Differs    %ws ->Stored,   %ws ->Passed\n",
                        Static_Connection_Info[i].pRasConnection0.wszUserName,pRasConnection0->wszUserName);

            if (wcscmp(Static_Connection_Info[i].pRasConnection0.wszLogonDomain,pRasConnection0->wszLogonDomain) != 0)
               DbgPrint("ERROR Logon Name Differs    %ws ->Stored,   %ws ->Passed\n",
                        Static_Connection_Info[i].pRasConnection0.wszLogonDomain,pRasConnection0->wszLogonDomain);

            if (wcscmp(Static_Connection_Info[i].pRasConnection0.wszRemoteComputer,pRasConnection0->wszRemoteComputer) != 0)
               DbgPrint("ERROR Remote Name Differs    %ws ->Stored,   %ws ->Passed\n",
                        Static_Connection_Info[i].pRasConnection0.wszRemoteComputer,pRasConnection0->wszRemoteComputer);
         }
         else
         {
            WriteFile(ErrLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
            if (Static_Connection_Info[i].pRasConnection0.hConnection != pRasConnection0->hConnection)
               wnsprintfA(buf, CELEMS(buf), "ERROR Connection Handle differs   %l64d-> Stored,    %l64d->Passed\n",
                       Static_Connection_Info[i].pRasConnection0.hConnection, pRasConnection0->hConnection);

            WriteFile(ErrLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
            if (Static_Connection_Info[i].pRasConnection0.hInterface != pRasConnection0->hInterface)
               wnsprintfA(buf, CELEMS(buf), "ERROR Interface Handle differs   %l64d-> Stored,    %l64d->Passed\n",
                       Static_Connection_Info[i].pRasConnection0.hInterface, pRasConnection0->hInterface);

            WriteFile(ErrLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
            if (Static_Connection_Info[i].pRasConnection0.dwConnectDuration > pRasConnection0->dwConnectDuration)
               wnsprintfA(buf, CELEMS(buf), "ERROR Duration time is less %d-> Stored,    %d->Passed\n",
                       Static_Connection_Info[i].pRasConnection0.dwConnectDuration, pRasConnection0->dwConnectDuration);
            WriteFile(ErrLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);

            if (Static_Connection_Info[i].pRasConnection0.dwInterfaceType != pRasConnection0->dwInterfaceType)
               wnsprintfA(buf, CELEMS(buf), "ERROR Interface Type differs   %l64d-> Stored,    %l64d->Passed\n",
                       Static_Connection_Info[i].pRasConnection0.dwInterfaceType != pRasConnection0->dwInterfaceType);

            WriteFile(ErrLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);

            if (Static_Connection_Info[i].pRasConnection0.dwConnectionFlags != pRasConnection0->dwConnectionFlags)
               wnsprintfA(buf, CELEMS(buf), "ERROR Connection Flags differs   %d-> Stored,    %d->Passed\n",
                       Static_Connection_Info[i].pRasConnection0.dwConnectionFlags, pRasConnection0->dwConnectionFlags);

            WriteFile(ErrLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);

            if (wcscmp(Static_Connection_Info[i].pRasConnection0.wszInterfaceName,pRasConnection0->wszInterfaceName) != 0)
               wnsprintfA(buf, CELEMS(buf), "ERROR Interface Name Differs    %ws ->Stored,   %ws ->Passed\n",
                       Static_Connection_Info[i].pRasConnection0.wszInterfaceName,pRasConnection0->wszInterfaceName);

            WriteFile(ErrLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);

            if (wcscmp(Static_Connection_Info[i].pRasConnection0.wszUserName,pRasConnection0->wszUserName) != 0)
               wnsprintfA(buf, CELEMS(buf), "ERROR User Name Differs    %ws ->Stored,   %ws ->Passed\n",
                       Static_Connection_Info[i].pRasConnection0.wszUserName,pRasConnection0->wszUserName);

            WriteFile(ErrLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);

            if (wcscmp(Static_Connection_Info[i].pRasConnection0.wszLogonDomain,pRasConnection0->wszLogonDomain) != 0)
               wnsprintfA(buf, CELEMS(buf), "ERROR Logon Name Differs    %ws ->Stored,   %ws ->Passed\n",
                       Static_Connection_Info[i].pRasConnection0.wszLogonDomain,pRasConnection0->wszLogonDomain);

            WriteFile(ErrLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);

            if (wcscmp(Static_Connection_Info[i].pRasConnection0.wszRemoteComputer,pRasConnection0->wszRemoteComputer) != 0)
               wnsprintfA(buf, CELEMS(buf), "ERROR Remote Name Differs    %ws ->Stored,   %ws ->Passed\n",
                       Static_Connection_Info[i].pRasConnection0.wszRemoteComputer,pRasConnection0->wszRemoteComputer);
         }
      }
      FlushFileBuffers(ErrLogFile);
      FlushFileBuffers(ConDisFile);
   }

}

DWORD APIENTRY MprAdminGetIpAddressForUser | ( | IN WCHAR * | lpszUserName,
 |  | IN WCHAR * | lpszPortName,
 |  | IN OUT DWORD * | pipAddress,
 |  | OUT BOOL * | pfNotifyDLL
 | ) |  |

Definition at line 325 of file AdminDll.c.

{
DWORD i=0;
DWORD dwBytesWritten=0;
CHAR buf[120];

    if (NULL == lpszUserName || NULL == lpszPortName || NULL == pipAddress || NULL == pfNotifyDLL)
    {
        return ERROR_INVALID_PARAMETER;
    }

   //to check if the call is first rasman call out. If yes, call Initialize routine
   if (First_Call)
   {
      Init();
      Init2();
      First_Call = FALSE;
   }
   DbgPrint("First_Call  %d\n",First_Call);
   DbgPrint("\nGetIpAddressForUser called UserName=%ws,Port=%ws,IpAddress=%d\n",
            lpszUserName,lpszPortName,(DWORD)*pipAddress );

   for (i=0;i < Num_Ip_Address;i++)
   {
      if (Static_Check_Stats[i].bTaken == FALSE)
      {
         wcsncpy(Static_Check_Stats[i].wszUserName, lpszUserName, CELEMS(Static_Check_Stats[i].wszUserName));
         wcsncpy(Static_Check_Stats[i].wszPortName, lpszPortName, CELEMS(Static_Check_Stats[i].wszPortName));
         *pipAddress = Static_Check_Stats[i].IpAddress;
         DbgPrint("Trying to get the IP Address   %d",(DWORD) *pipAddress);
         Static_Check_Stats[i].bTaken=TRUE;
         break;
      }
   }
   DbgPrint("GetIpAddressForUser setting IpAddress=%d\n",(DWORD)*pipAddress );
   wnsprintfA(buf,CELEMS(buf), "GetIpAddressForUser setting IpAddress=%d\n",(DWORD)*pipAddress );
   WriteFile(IPFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   *pfNotifyDLL = TRUE;

   return( NO_ERROR );
}

VOID APIENTRY MprAdminLinkHangupNotification | ( | IN RAS_PORT_0 * | pRasPort0,
 |  | IN RAS_PORT_1 * | pRasPort1
 | ) |  |

Definition at line 556 of file AdminDll.c.

{
   char buf[512];
   DWORD dwBytesWritten = 0;

   DbgPrint("MprAdminLinkHangupNotification Called\n");

   if (NULL == pRasPort0 || NULL == pRasPort1)
   {
       DbgPrint("MprAdminLinkHangupNotification Invalid Parameter\n");

       return;
   }

   Debug_Print_RasPort(pRasPort0,pRasPort1);
   //dumping pRasPort0 to a file
   WriteFile(ConDisFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
   wnsprintfA(buf,CELEMS(buf), "MprAdminLinkHangupNotification Called::dumping pRasPort0 to file\n");
   File_Print_RasPort(pRasPort0,pRasPort1);

}

VOID APIENTRY MprAdminReleaseIpAddress | ( | IN WCHAR * | lpszUserName,
 |  | IN WCHAR * | lpszPortName,
 |  | IN OUT DWORD * | pipAddress
 | ) |  |

Definition at line 374 of file AdminDll.c.

{
DWORD dwBytesWritten=0;
CHAR buf[120];
int i=0;

    if (NULL == lpszUserName || NULL == lpszPortName)
    {
        DbgPrint( "\nMprAdminReleaseIpAddress - Invalid Parameter");
        return;
    }

    DbgPrint( "\nReleaseIpAddressr called UserName=%ws,Port=%ws,IpAddress=%d\n",
              lpszUserName,lpszPortName,(DWORD)*pipAddress );

    for (i=0;i < Num_Ip_Address;i++)
    {
       if (Static_Check_Stats[i].IpAddress == (DWORD) *pipAddress)
       {
          if (Static_Check_Stats[i].bTaken == TRUE)
          {
             if (wcscmp(Static_Check_Stats[i].wszUserName,lpszUserName) == 0)
             {
                if (wcscmp(Static_Check_Stats[i].wszPortName,lpszPortName) == 0)
                {
                   Static_Check_Stats[i].bTaken = FALSE;
                   break;
                }
                else
                {
                   DbgPrint("ERROR ReleaseIP PortName, Cannot free IP Address    %ws\n",
                            Static_Check_Stats[i].wszPortName);
                   if (!(ErrLogIPInValid))
                   {
                      wnsprintfA(buf,CELEMS(buf), "ERROR ReleaseIP PortName, Cannot free IP Address   %ws\n",
                              Static_Check_Stats[i].wszPortName);
                      WriteFile(ErrLogFileIP, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
                      break;
                   }
                }
             }
             else
             {
                DbgPrint("ERROR ReleaseIP UserName Incorrect, Cannot free IP Address   %ws\n",
                         Static_Check_Stats[i].wszUserName);
                if (!(ErrLogIPInValid))
                {
                   wnsprintfA(buf,CELEMS(buf), "ERROR ReleaseIP UserName Incorrect, Cannot free IP Address   %ws\n",
                           Static_Check_Stats[i].wszUserName);
                   WriteFile(ErrLogFileIP, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
                }
                break;
             }
          }
          else
          {
             DbgPrint("ERROR ReleaseIP Wrong IP address, doesn't exist, Cannot free IP Address    %d\n",
                      Static_Check_Stats[i].IpAddress);
             if (!(ErrLogIPInValid))
             {
                wnsprintfA(buf,CELEMS(buf), "ERROR ReleaseIP Wrong IP Address, doesn't exist Cannot free IP Address   %d\n",
                        Static_Check_Stats[i].IpAddress);
                WriteFile(ErrLogFileIP, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
             }
             break;
          }
       }
    }

}

DWORD APIENTRY MprAdminTerminateDll ( )

Definition at line 315 of file AdminDll.c.

                        {
    DbgPrint("\nMprAdminTerminateDll called\n");
    Finalize();
    return TRUE;

}

WCHAR* StrDupWFromA ( CHAR * psz )

Definition at line 129 of file AdminDll.c.

{
   WCHAR* pszNew = NULL;

   if (psz)
   {
      DWORD cb;

      cb = MultiByteToWideChar( CP_ACP, 0, psz, -1, NULL, 0 );
      pszNew = malloc( cb * sizeof(TCHAR) );
      if (!pszNew)
      {
         return NULL;
      }

      cb = MultiByteToWideChar( CP_ACP, 0, psz, -1, pszNew, cb );
      if (cb == 0)
      {
         free( pszNew );
         return NULL;
      }
   }

   return pszNew;

}

Variable Documentation

HANDLE ConDisFile = NULL

Definition at line 87 of file AdminDll.c.

BOOL ConnectDisconnectInValid = FALSE

Definition at line 91 of file AdminDll.c.

HANDLE Connection_Handle

Definition at line 101 of file AdminDll.c.

HANDLE ErrLogFile = NULL

Definition at line 88 of file AdminDll.c.

HANDLE ErrLogFileIP = NULL

Definition at line 89 of file AdminDll.c.

BOOL ErrLogIPInValid = FALSE

Definition at line 93 of file AdminDll.c.

BOOL ErrorLogInValid = FALSE

Definition at line 92 of file AdminDll.c.

BOOL First_Call = TRUE

Definition at line 94 of file AdminDll.c.

HANDLE IPFile = NULL

Definition at line 86 of file AdminDll.c.

BOOL IPFileInValid = FALSE

Definition at line 90 of file AdminDll.c.

Static_Statistic Static_Check_Stats[Num_Ip_Address]

Definition at line 125 of file AdminDll.c.

Static_Info_Database Static_Connection_Info[Num_Ip_Address]

Definition at line 115 of file AdminDll.c.

DWORD TempIpAddress = 0x010A0F0E

Definition at line 85 of file AdminDll.c.

Generated on Wed Nov 13 2024 16:54:02 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/Eap/CeapCfg.Cpp File Reference

  • NetDS
  • RRas
  • Eap
Functions

CeapCfg.Cpp File Reference

#include "ceapcfg.h"

Go to the source code of this file.

Functions

DWORD | GetIdentity (IN HWND hwndParent, IN BYTE *pUserDataIn, IN DWORD dwSizeOfUserDataIn, OUT BYTE **ppUserDataOut, OUT DWORD *pdwSizeOfUserDataOut, OUT WCHAR **ppwszIdentityOut)
DWORD APIENTRY | RasEapFreeMemory (IN BYTE *pMemory)
DWORD APIENTRY | RasEapInvokeConfigUI (IN DWORD dwEapTypeId, IN HWND hwndParent, IN DWORD dwFlags, IN BYTE *pConnectionDataIn, IN DWORD dwSizeOfConnectionDataIn, OUT BYTE **ppConnectionDataOut, OUT DWORD *pdwSizeOfConnectionDataOut)

Function Documentation

DWORD GetIdentity | ( | IN HWND | hwndParent,
 |  | IN BYTE * | pUserDataIn,
 |  | IN DWORD | dwSizeOfUserDataIn,
 |  | OUT BYTE ** | ppUserDataOut,
 |  | OUT DWORD * | pdwSizeOfUserDataOut,
 |  | OUT WCHAR ** | ppwszIdentityOut
 | ) |  |

Definition at line 1684 of file Eap.c.

{
    EAP_NAME_DIALOG*    pEapNameDialog  = NULL;
    WCHAR*              pwszIdentity     = NULL;
    DWORD               dwErr           = NO_ERROR;

    //
    // Allocate memory for OUT parameters
    //

    pEapNameDialog = LocalAlloc(LPTR, sizeof(EAP_NAME_DIALOG));

    if (NULL == pEapNameDialog)
    {
        EapTrace("Out of memory");
        dwErr = GetLastError();
        goto LDone;
    }

    pwszIdentity = LocalAlloc(LPTR, (UNLEN + 1) * sizeof(WCHAR));

    if (NULL == pwszIdentity)
    {
        EapTrace("Out of memory");
        dwErr = GetLastError();
        goto LDone;
    }

    if (NULL != pUserDataIn)
    {
        //
        // Use the saved credentials if they exist
        //

        CopyMemory(pEapNameDialog, pUserDataIn, sizeof(EAP_NAME_DIALOG));
    }
    else
    {
        //
        // Else prompt for username and password
        //

        GetUsernameAndPassword(hwndParent, pEapNameDialog);
    }

    wcscpy(pwszIdentity, pEapNameDialog->awszIdentity);

    //
    // Set the OUT paramters
    //

    *ppUserDataOut = (BYTE*)pEapNameDialog;
    *pdwSizeOfUserDataOut = sizeof(EAP_NAME_DIALOG);
    *ppwszIdentity = pwszIdentity;

    //
    // We mustn't LocalFree OUT parameters
    //

    pEapNameDialog = NULL;
    pwszIdentity = NULL;

LDone:

    LocalFree(pEapNameDialog);
    LocalFree(pwszIdentity);

    return(dwErr);
}

DWORD APIENTRY RasEapFreeMemory ( IN BYTE * pMemory )

Definition at line 492 of file Eap.c.

{
    EapTrace("RasEapFreeMemory");
    LocalFree(pMemory);
    return(NO_ERROR);
}

DWORD APIENTRY RasEapInvokeConfigUI | ( | IN DWORD | dwEapTypeId,
 |  | IN HWND | hwndParent,
 |  | IN DWORD | dwFlags,
 |  | IN BYTE * | pConnectionDataIn,
 |  | IN DWORD | dwSizeOfConnectionDataIn,
 |  | OUT BYTE ** | ppConnectionDataOut,
 |  | OUT DWORD * | pdwSizeOfConnectionDataOut
 | ) |  |

Definition at line 370 of file Eap.c.

{
    DWORD       dwDisplayedNumber;
    WCHAR       awszMessage[100];
    DWORD       dwErr               = NO_ERROR;

    *ppConnectionDataOut = NULL;
    *pdwSizeOfConnectionDataOut = 0;

    if (   (NULL == pConnectionDataIn)
        || (0 == dwSizeOfConnectionDataIn))
    {
        //
        // We are configuring for the first time
        //

        dwDisplayedNumber = 1;
    }
    else
    {
        //
        // How many times has this been configured?
        //

        dwDisplayedNumber = *(DWORD*)pConnectionDataIn;
    }

    swprintf(awszMessage, L"%5d times", dwDisplayedNumber);

    MessageBox(hwndParent, awszMessage,
        L"You have configured this interface...", MB_OK | MB_ICONINFORMATION);

    //
    // Allocate memory for the OUT parameter
    //

    *ppConnectionDataOut = (BYTE*)LocalAlloc(LPTR, sizeof(DWORD));

    if (NULL == *ppConnectionDataOut)
    {
        dwErr = ERROR_NOT_ENOUGH_MEMORY;
        goto LDone;
    }

    //
    // This has been configured one more time
    //

    dwDisplayedNumber += 1;

    //
    // Set the OUT parameters
    //

    CopyMemory(*ppConnectionDataOut, (BYTE*)&dwDisplayedNumber,
        sizeof(DWORD));
    *pdwSizeOfConnectionDataOut = sizeof(DWORD);

LDone:

    return(dwErr);
}

Generated on Wed Nov 13 2024 16:54:02 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/Eap/CeapCfg.h File Reference

  • NetDS
  • RRas
  • Eap
Classes | Defines | Variables

CeapCfg.h File Reference

#include <atlbase.h>
#include <atlcom.h>
#include <rrascfg.h>
#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Classes

class | CEapCfg

Defines

#define | _ATL_APARTMENT_THREADED
#define | IMPL

Variables

CComModule | _Module
const CLSID | CLSID_EapCfg

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 18 of file CeapCfg.h.

#define IMPL

Definition at line 28 of file CeapCfg.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

const CLSID CLSID_EapCfg

Definition at line 34 of file Exports.Cpp.

Generated on Wed Nov 13 2024 16:54:02 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/Eap/Eap.c File Reference

  • NetDS
  • RRas
  • Eap
Defines | Functions

Eap.c File Reference

#include <windows.h>
#include <winuser.h>
#include <lmcons.h>
#include <string.h>
#include <stdlib.h>
#include <raseapif.h>
#include <raserror.h>
#include <rtutils.h>
#include <stdio.h>
#include "eap.h"
#include "resource.h"

Go to the source code of this file.

Defines

#define | RASEAPGLOBALS
#define | SDEBUGGLOBALS

Functions

DWORD | AuthenticateeMakeMessage (IN EAPCB *pwb, IN PPP_EAP_PACKET *pReceiveBuf, OUT PPP_EAP_PACKET *pSendBuf, IN DWORD cbSendBuf, IN PPP_EAP_INPUT *pInput, OUT PPP_EAP_OUTPUT *pResult)
DWORD | AuthenticatorMakeMessage (IN EAPCB *pwb, IN PPP_EAP_PACKET *pReceiveBuf, OUT PPP_EAP_PACKET *pSendBuf, IN DWORD cbSendBuf, IN PPP_EAP_INPUT *pInput, OUT PPP_EAP_OUTPUT *pResult)
DWORD APIENTRY | EapBegin (OUT VOID **ppWorkBuf, IN VOID *pInfo)
DWORD APIENTRY | EapEnd (IN VOID *pWorkBuf)
DWORD APIENTRY | EapMakeMessage (IN VOID *pWorkBuf, IN PPP_EAP_PACKET *pReceiveBuf, OUT PPP_EAP_PACKET *pSendBuf, IN DWORD cbSendBuf, OUT PPP_EAP_OUTPUT *pResult, IN PPP_EAP_INPUT *pInput)
VOID | EapTrace (IN CHAR *Format,...)
DWORD | GetIdentity (IN HWND hwndParent, IN BYTE *pUserDataIn, IN DWORD dwSizeOfUserDataIn, OUT BYTE **ppUserDataOut, OUT DWORD *pdwSizeOfUserDataOut, OUT WCHAR **ppwszIdentity)
DWORD | GetPasswordFromResponse (IN PPP_EAP_PACKET *pReceiveBuf, OUT CHAR *pszPassword)
VOID | GetUsernameAndPassword (IN HWND hwndParent, IN EAP_NAME_DIALOG *pEapNameDialog)
VOID | HostToWireFormat16 (IN WORD wHostFormat, IN OUT PBYTE pWireFormat)
VOID | HostToWireFormat32 (IN DWORD dwHostFormat, IN OUT PBYTE pWireFormat)
BOOL | InitUsernameDialog (IN HWND hWnd, IN LPARAM lParam)
DWORD | MakeAuthenticationAttributes (IN CHAR *szUserName, IN CHAR *szPassword, IN EAPCB *pwb)
DWORD | MakeMPPEKeyAttributes (IN EAPCB *pwb)
VOID | MakeRequestMessage (IN EAPCB *pwb, OUT PPP_EAP_PACKET *pSendBuf, IN DWORD cbSendBuf)
VOID | MakeResponseMessage (IN EAPCB *pwb, IN PPP_EAP_PACKET *pReceiveBuf, OUT PPP_EAP_PACKET *pSendBuf, IN DWORD cbSendBuf)
VOID | MakeResponseMessage1 (IN EAPCB *pwb, OUT PPP_EAP_PACKET *pSendBuf, IN DWORD cbSendBuf)
VOID | MakeResultMessage (IN EAPCB *pwb, IN DWORD dwError, OUT PPP_EAP_PACKET *pSendBuf, IN DWORD cbSendBuf)
DWORD APIENTRY | RasEapFreeMemory (IN BYTE *pMemory)
DWORD APIENTRY | RasEapGetIdentity (IN DWORD dwEapTypeId, IN HWND hwndParent, IN DWORD dwFlags, IN const WCHAR *pwszPhonebook, IN const WCHAR *pwszEntry, IN BYTE *pConnectionDataIn, IN DWORD dwSizeOfConnectionDataIn, IN BYTE *pUserDataIn, IN DWORD dwSizeOfUserDataIn, OUT BYTE **ppUserDataOut, OUT DWORD *pdwSizeOfUserDataOut, OUT WCHAR **ppwszIdentity)
DWORD APIENTRY | RasEapGetInfo (IN DWORD dwEapTypeId, OUT PPP_EAP_INFO *pInfo)
DWORD APIENTRY | RasEapInvokeConfigUI (IN DWORD dwEapTypeId, IN HWND hwndParent, IN DWORD dwFlags, IN BYTE *pConnectionDataIn, IN DWORD dwSizeOfConnectionDataIn, OUT BYTE **ppConnectionDataOut, OUT DWORD *pdwSizeOfConnectionDataOut)
DWORD APIENTRY | RasEapInvokeInteractiveUI (IN DWORD dwEapTypeId, IN HWND hWndParent, IN PBYTE pUIContextData, IN DWORD dwSizeofUIContextData, OUT PBYTE *ppDataFromInteractiveUI, OUT DWORD *lpdwSizeOfDataFromInteractiveUI)
BOOL | UsernameCommand (IN EAP_NAME_DIALOG *pEapNameDialog, IN WORD wId, IN HWND hWndDlg)
INT_PTR CALLBACK | UsernameDialogProc (IN HWND hWnd, IN UINT unMsg, IN WPARAM wParam, IN LPARAM lParam)
WORD | WireToHostFormat16 (IN PBYTE pWireFormat)

Define Documentation

#define RASEAPGLOBALS

Definition at line 37 of file Eap.c.

#define SDEBUGGLOBALS

Definition at line 36 of file Eap.c.

Function Documentation

DWORD AuthenticateeMakeMessage | ( | IN EAPCB * | pwb,
 |  | IN PPP_EAP_PACKET * | pReceiveBuf,
 |  | OUT PPP_EAP_PACKET * | pSendBuf,
 |  | IN DWORD | cbSendBuf,
 |  | IN PPP_EAP_INPUT * | pInput,
 |  | OUT PPP_EAP_OUTPUT * | pResult
 | ) |  |

Definition at line 592 of file Eap.c.

{
    DWORD dwRetCode = NO_ERROR;
    BYTE* pDataFromInteractiveUI;
    DWORD dwSizeOfDataFromInteractiveUI;

    EapTrace("AuthenticateeMakeMessage");

    switch(pwb->EapState)
    {
        case MYSTATE_Initial:

            if (pwb->fFlags & RAS_EAP_FLAG_ROUTER)
            {
                pwb->EapState = MYSTATE_WaitForRequest;

                break;
            }
            pwb->bRecvPacketId = pReceiveBuf->Id;
            if (NULL == pwb->pDataFromInteractiveUI)
            {
                WCHAR * pUIContextData = L"You are being authenticated by a Sample EAP";
                //
                // Bring up interactive UI to notify user that he/she is being
                // authenticated via the sample EAP
                //

                pResult->fInvokeInteractiveUI = TRUE;

                pResult->dwSizeOfUIContextData =
                   (wcslen(pUIContextData)+1) *
                       sizeof(WCHAR);

                pResult->pUIContextData = LocalAlloc(
                                              LPTR,
                                              pResult->dwSizeOfUIContextData);

                if (pResult->pUIContextData == NULL)
                {
                    EapTrace("OUt of memory");
                    return(ERROR_NOT_ENOUGH_MEMORY);
                }

                wcsncpy((WCHAR*)pResult->pUIContextData,
                       pUIContextData,
                       wcslen(pUIContextData)
                      );

                pwb->pUIContext = pResult->pUIContextData;

                pwb->EapState = MYSTATE_WaitForUserOK;

                break;
            }

            //
            // Else, fall through
            //

        case MYSTATE_WaitForUserOK:

            //
            // Wait for response from user
            //

            if (   pInput->fDataReceivedFromInteractiveUI
                || (NULL != pwb->pDataFromInteractiveUI))
            {
                if (pInput->fDataReceivedFromInteractiveUI)
                {
                    pDataFromInteractiveUI =
                            pInput->pDataFromInteractiveUI;
                    dwSizeOfDataFromInteractiveUI =
                            pInput->dwSizeOfDataFromInteractiveUI;
                }
                else
                {
                    pDataFromInteractiveUI =
                            pwb->pDataFromInteractiveUI;
                    dwSizeOfDataFromInteractiveUI =
                            pwb->dwSizeOfDataFromInteractiveUI;
                }

                LocalFree(pwb->pUIContext);
                pwb->pUIContext = NULL;

                //
                // If user doesn't like this, then we hangup the line
                //

                if (dwSizeOfDataFromInteractiveUI !=
                            (wcslen(L"OK")+1) * sizeof(WCHAR))
                {
                    EapTrace("User chose to cancel");
                    dwRetCode = ERROR_ACCESS_DENIED;
                    break;
                }

                if (wcscmp((WCHAR*)pDataFromInteractiveUI, L"OK") != 0)
                {
                    EapTrace("User chose to cancel");
                    dwRetCode = ERROR_ACCESS_DENIED;
                    break;
                }

                pwb->EapState = MYSTATE_WaitForRequest;
            }
            else
            {
                //
                // Ignore all other events.
                //

                pResult->Action = EAPACTION_NoAction;
            }

            if ( !(pwb->fFlags & RAS_EAP_FLAG_8021X_AUTH ) )
            {
                //
                // if this is a VPN client, we can rely on
                // retransmission.  But with wireless client
                // we cannot do that.
                //
                break;
            }
            //fall thru

        case MYSTATE_WaitForRequest:

            if ( (pwb->fFlags & RAS_EAP_FLAG_8021X_AUTH ) )
            {
                //
                // Build the response packet
                //
                MakeResponseMessage1(pwb, pSendBuf, cbSendBuf);

                //
                // Response packets should not be sent with any timeout
                //

                pResult->Action = EAPACTION_Send;

                //
                // We are done so we change to MYSTATE_Done
                //

                pwb->EapState = MYSTATE_Done;

                break;

            }
            else if (pReceiveBuf != NULL )
            {
                //
                // If we received a request packet from the server then we
                // process it.
                //

                if (pReceiveBuf->Code == EAPCODE_Request)
                {
                    //
                    // Build the response packet
                    //

                    MakeResponseMessage(pwb, pReceiveBuf, pSendBuf, cbSendBuf);

                    //
                    // Response packets should not be sent with any timeout
                    //

                    pResult->Action = EAPACTION_Send;

                    //
                    // We are done so we change to MYSTATE_Done
                    //

                    pwb->EapState = MYSTATE_Done;

                    break;
                }
                else
                {
                    //
                    // We shouldn't get any other packet in this state so
                    // we simply drop this invalid packet
                    //

                    pResult->Action = EAPACTION_NoAction;
                    dwRetCode = ERROR_PPP_INVALID_PACKET;
                    break;
                }
            }

            break;

        case MYSTATE_Done:
        {
            if (pReceiveBuf == NULL)
            {
                //
                // If we did not receive a packet then we check to see if
                // the fSuccessPacketReceived flag is set
                //

                if ((pInput != NULL) && (pInput->fSuccessPacketReceived))
                {
                    //
                    // We are done
                    //

                    //
                    // Create the MPPE Key Attribute and give it to the EAP-PPP
                    // engine.
                    //

                    dwRetCode = MakeMPPEKeyAttributes(pwb);

                    if (NO_ERROR == dwRetCode)
                    {
                        pResult->pUserAttributes = pwb->pMPPEKeyAttributes;
                    }

                    pResult->Action = EAPACTION_Done;
                    pwb->EapState   = MYSTATE_Done;
                }
                else
                {
                    //
                    // Otherwise we ignore this event
                    //

                    pResult->Action = EAPACTION_NoAction;
                }

                break;
            }

            if ((pReceiveBuf->Code == EAPCODE_Success) ||
                (pReceiveBuf->Code == EAPCODE_Failure))
            {
                if (pReceiveBuf->Code == EAPCODE_Success)
                {
                    //
                    // If we received success or failure, we are done, but first
                    // make sure the ID's match
                    //

                    //
                    // Create the MPPE Key Attribute and give it to the EAP-PPP
                    // engine.
                    //

                    dwRetCode = MakeMPPEKeyAttributes(pwb);

                    if (NO_ERROR == dwRetCode)
                    {
                        pResult->pUserAttributes = pwb->pMPPEKeyAttributes;
                    }

                    pResult->Action = EAPACTION_Done;
                    pwb->EapState   = MYSTATE_Done;
                }
                else
                {
                    //
                    // Otherwise drop the packet
                    //

                    pResult->Action = EAPACTION_NoAction;
                    dwRetCode       = ERROR_PPP_INVALID_PACKET;
                }

                break;
            }
            else if (pReceiveBuf->Code == EAPCODE_Request)
            {
                //
                // We must always respond to requests
                //

                MakeResponseMessage(pwb, pReceiveBuf, pSendBuf, cbSendBuf);

                //
                // Response packets should not be sent with any timeout
                //

                pResult->Action = EAPACTION_Send;
            }
            else
            {
                //
                // Otherwise we received an illegal packet, wrong code set
                // So simply drop the packet.
                //

                pResult->Action = EAPACTION_NoAction;
                dwRetCode       = ERROR_PPP_INVALID_PACKET;
            }
        }
    }

    return(dwRetCode);
}

DWORD AuthenticatorMakeMessage | ( | IN EAPCB * | pwb,
 |  | IN PPP_EAP_PACKET * | pReceiveBuf,
 |  | OUT PPP_EAP_PACKET * | pSendBuf,
 |  | IN DWORD | cbSendBuf,
 |  | IN PPP_EAP_INPUT * | pInput,
 |  | OUT PPP_EAP_OUTPUT * | pResult
 | ) |  |

Definition at line 1143 of file Eap.c.

{
    DWORD dwRetCode = NO_ERROR;

    EapTrace("AuthenticatorMakeMessage");

    switch(pwb->EapState)
    {
        case MYSTATE_ReqSent:

            if (pReceiveBuf != NULL)
            {
                //
                // If we received a packet
                //

                if (pReceiveBuf->Code == EAPCODE_Response)
                {
                    //
                    // If we received a response to our identity request,
                    // then process it. There is no need to check the Id
                    // here since the PPP engine will only pass on packets
                    // whose Id matches those set with the
                    // EAPACTION_SendWithTimeout action.
                    //

                    dwRetCode = GetPasswordFromResponse(pReceiveBuf,
                                                         pwb->aszPassword);

                    if (dwRetCode != NO_ERROR)
                    {
                        if (dwRetCode != ERROR_PPP_INVALID_PACKET)
                        {
                            //
                            // Fatal error, we fail the connection.
                            //

                            return(dwRetCode);
                        }
                    }
                    else
                    {
                        //
                        // Request authentication provider to authenticate
                        // this user.
                        //

                        dwRetCode = MakeAuthenticationAttributes(
                                                            pwb->aszIdentity,
                                                            pwb->aszPassword,
                                                            pwb);

                        if (dwRetCode != NO_ERROR)
                        {
                            return(dwRetCode);
                        }
                        else
                        {
                            //
                            // Authentication request completed successfully.
                            // This is an asynchronous call so we change state
                            // and wait for the provider to complete the
                            // authentication.
                            //

                            pResult->pUserAttributes = pwb->pUserAttributes;

                            pResult->Action = EAPACTION_Authenticate;

                            //
                            // Save Id so that we can send the correct one
                            // in the success/failure packet
                            //

                            pwb->dwIdExpected = pReceiveBuf->Id;

                            pwb->EapState =
                                    MYSTATE_WaitForAuthenticationToComplete;
                        }
                    }

                    break;
                }
                else
                {
                    //
                    // Otherwise silently drop the packet.
                    // We should only get requests
                    //

                    pResult->Action = EAPACTION_NoAction;

                    break;
                }
            }

            break;

        case MYSTATE_Initial:

            //
            // Create Request packet
            //

            MakeRequestMessage(pwb, pSendBuf, cbSendBuf);

            //
            // Request messages must be sent with a timeout
            //

            pResult->Action = EAPACTION_SendWithTimeoutInteractive;

            //
            // Since we have sent a request we change to the ReqSent state
            // where we will wait for a response.
            //

            pwb->EapState = MYSTATE_ReqSent;

            break;

        case MYSTATE_WaitForAuthenticationToComplete:
        {
            if (pInput != NULL)
            {
                //
                // Did the authentication provider complete the authentication?
                //

                if (pInput->fAuthenticationComplete)
                {
                    //
                    // If the user failed to authenticate, save the failure
                    // code.
                    //

                    if (pInput->dwAuthResultCode != NO_ERROR)
                    {
                        pwb->dwResult = pInput->dwAuthResultCode;
                    }

                    pResult->Action = EAPACTION_SendAndDone;
                    pwb->EapState   = MYSTATE_Done;

                    //
                    // fall thru to the MYSTATE_Done state where we will
                    // send a Success or Failure packet
                    //
                }
            }

            if ((pInput == NULL) || (!pInput->fAuthenticationComplete))
            {
                //
                // Ignore everything if authentication is not complete
                //

                pResult->Action = EAPACTION_NoAction;

                break;
            }

            //
            // ...fall thru to the MYSTATE_Done state where we will
            // send a Success or Failure packet
            //
        }

        case MYSTATE_Done:
        {
            //
            // Make Success or Failure packet.
            //

            MakeResultMessage(pwb, pwb->dwResult, pSendBuf, cbSendBuf);

            if (NO_ERROR == pwb->dwResult)
            {
                //
                // If we made a Success packet, create the MPPE Key Attribute
                // and give it to the EAP-PPP engine.
                //

                dwRetCode = MakeMPPEKeyAttributes(pwb);

                if (NO_ERROR == dwRetCode)
                {
                    pResult->pUserAttributes = pwb->pMPPEKeyAttributes;
                }
            }

            pResult->Action = EAPACTION_SendAndDone;

            pResult->dwAuthResultCode = pwb->dwResult;

            break;
        }

        default:

            break;
    }

    return(dwRetCode);

}

DWORD APIENTRY EapBegin | ( | OUT VOID ** | ppWorkBuf,
 |  | IN VOID * | pInfo
 | ) |  |

Definition at line 92 of file Eap.c.

{
    PPP_EAP_INPUT* pInput = (PPP_EAP_INPUT*)pInfo;
    EAPCB*         pwb;

    EapTrace("EapBegin(%ws)", pInput->pwszIdentity);

    //
    // Allocate work buffer.
    //

    if ((pwb = (EAPCB*)LocalAlloc(LPTR, sizeof(EAPCB))) == NULL)
    {
        EapTrace("Not enough memory");
        return(ERROR_NOT_ENOUGH_MEMORY);
    }

    //
    // Save information passed in, will be used later
    //

    pwb->fFlags             = pInput->fFlags;
    pwb->fAuthenticator     = pInput->fAuthenticator;
    pwb->EapState           = MYSTATE_Initial;
    pwb->dwInitialPacketId  = pInput->bInitialId;

    if (pInput->pDataFromInteractiveUI != NULL)
    {
        pwb->dwSizeOfDataFromInteractiveUI =
            pInput->dwSizeOfDataFromInteractiveUI;
        pwb->pDataFromInteractiveUI =
            LocalAlloc(LPTR, pwb->dwSizeOfDataFromInteractiveUI);

        if (NULL != pwb->pDataFromInteractiveUI)
        {
            CopyMemory(pwb->pDataFromInteractiveUI,
                pInput->pDataFromInteractiveUI,
                pwb->dwSizeOfDataFromInteractiveUI);
        }
    }

    //
    // Save the identity. On the authenticatee side, this is obtained by user
    // input; on the authenticator side this was obtained by the Identity
    // request message.
    //

    WideCharToMultiByte(
        CP_ACP,
        0,
        pInput->pwszIdentity,
        -1,
        pwb->aszIdentity,
        UNLEN + 1,
        NULL,
        NULL );

    //
    // If we are an authenticatee, then use the password passed in
    //

    if (!pwb->fAuthenticator)
    {
        if (   (NULL != pInput->pUserData)
            && (sizeof(EAP_NAME_DIALOG) == pInput->dwSizeOfUserData))
        {
            WideCharToMultiByte(
                CP_ACP,
                0,
                ((EAP_NAME_DIALOG*)(pInput->pUserData))->awszPassword,
                -1,
                pwb->aszPassword,
                PWLEN + 1,
                NULL,
                NULL );
        }
    }

    //
    // Register work buffer with engine.
    //

    *ppWorkBuf = pwb;

    return(NO_ERROR);
}

DWORD APIENTRY EapEnd ( IN VOID * pWorkBuf )

Definition at line 191 of file Eap.c.

{
    EAPCB* pwb = (EAPCB *)pWorkBuf;

    if (pwb == NULL)
    {
        return(NO_ERROR);
    }

    //
    // Release all resources used by this authentication session.
    //

    EapTrace("EapEnd(%s)", pwb->aszIdentity);

    LocalFree(pwb->pUIContext);
    LocalFree(pwb->pDataFromInteractiveUI);

    if (pwb->pUserAttributes != NULL)
    {
        //
        // Free up Attributes
        //

        LocalFree(pwb->pUserAttributes[0].Value);
        LocalFree(pwb->pUserAttributes[1].Value);
        LocalFree(pwb->pUserAttributes);
    }

    if (pwb->pMPPEKeyAttributes != NULL)
    {
        //
        // Free up the MPPE Key Attributes
        //

        LocalFree(pwb->pMPPEKeyAttributes[0].Value);
        LocalFree(pwb->pMPPEKeyAttributes);
    }

    ZeroMemory(pwb, sizeof(EAPCB));

    LocalFree(pwb);

    return(NO_ERROR);
}

DWORD APIENTRY EapMakeMessage | ( | IN VOID * | pWorkBuf,
 |  | IN PPP_EAP_PACKET * | pReceiveBuf,
 |  | OUT PPP_EAP_PACKET * | pSendBuf,
 |  | IN DWORD | cbSendBuf,
 |  | OUT PPP_EAP_OUTPUT * | pResult,
 |  | IN PPP_EAP_INPUT * | pInput
 | ) |  |

Definition at line 248 of file Eap.c.

{
    EAPCB*  pwb = (EAPCB*)pWorkBuf;

    EapTrace("EapMakeMessage(%s)", pwb->aszIdentity);

    //
    // Call the appropriate routine to process the event.
    //

    if (pwb->fAuthenticator)
    {
        return(AuthenticatorMakeMessage(pwb,
                                        pReceiveBuf,
                                        pSendBuf,
                                        cbSendBuf,
                                        pInput,
                                        pResult));
    }
    else
    {
        return(AuthenticateeMakeMessage(pwb,
                                        pReceiveBuf,
                                        pSendBuf,
                                        cbSendBuf,
                                        pInput,
                                        pResult));
    }
}

VOID EapTrace | ( | IN CHAR * | Format,
 |  |  | ...
 | ) |  |

Definition at line 513 of file Eap.c.

{
    va_list arglist;

    va_start(arglist, Format);

    TraceVprintfExA(g_dwEapTraceId,
        0x00010000 | TRACE_USE_MASK | TRACE_USE_MSEC,
        Format,
        arglist);

    va_end(arglist);
}

DWORD GetIdentity | ( | IN HWND | hwndParent,
 |  | IN BYTE * | pUserDataIn,
 |  | IN DWORD | dwSizeOfUserDataIn,
 |  | OUT BYTE ** | ppUserDataOut,
 |  | OUT DWORD * | pdwSizeOfUserDataOut,
 |  | OUT WCHAR ** | ppwszIdentity
 | ) |  |

Definition at line 1684 of file Eap.c.

{
    EAP_NAME_DIALOG*    pEapNameDialog  = NULL;
    WCHAR*              pwszIdentity     = NULL;
    DWORD               dwErr           = NO_ERROR;

    //
    // Allocate memory for OUT parameters
    //

    pEapNameDialog = LocalAlloc(LPTR, sizeof(EAP_NAME_DIALOG));

    if (NULL == pEapNameDialog)
    {
        EapTrace("Out of memory");
        dwErr = GetLastError();
        goto LDone;
    }

    pwszIdentity = LocalAlloc(LPTR, (UNLEN + 1) * sizeof(WCHAR));

    if (NULL == pwszIdentity)
    {
        EapTrace("Out of memory");
        dwErr = GetLastError();
        goto LDone;
    }

    if (NULL != pUserDataIn)
    {
        //
        // Use the saved credentials if they exist
        //

        CopyMemory(pEapNameDialog, pUserDataIn, sizeof(EAP_NAME_DIALOG));
    }
    else
    {
        //
        // Else prompt for username and password
        //

        GetUsernameAndPassword(hwndParent, pEapNameDialog);
    }

    wcscpy(pwszIdentity, pEapNameDialog->awszIdentity);

    //
    // Set the OUT paramters
    //

    *ppUserDataOut = (BYTE*)pEapNameDialog;
    *pdwSizeOfUserDataOut = sizeof(EAP_NAME_DIALOG);
    *ppwszIdentity = pwszIdentity;

    //
    // We mustn't LocalFree OUT parameters
    //

    pEapNameDialog = NULL;
    pwszIdentity = NULL;

LDone:

    LocalFree(pEapNameDialog);
    LocalFree(pwszIdentity);

    return(dwErr);
}

DWORD GetPasswordFromResponse | ( | IN PPP_EAP_PACKET * | pReceiveBuf,
 |  | OUT CHAR * | pszPassword
 | ) |  |

Definition at line 1369 of file Eap.c.

{
    BYTE* pcbPassword;
    CHAR* pchPassword;
    WORD  cbPacket;

    EapTrace("GetPasswordFromResponse");

    cbPacket = WireToHostFormat16(pReceiveBuf->Length);

    //
    // Extract the password
    //

    if (cbPacket < (PPP_EAP_PACKET_HDR_LEN + 1 + 1))
    {
        EapTrace("Number of bytes in the EAP packet is only %d", cbPacket);

        return(ERROR_PPP_INVALID_PACKET);
    }

    pcbPassword = pReceiveBuf->Data + 1;
    pchPassword = pcbPassword + 1;

    if (cbPacket < PPP_EAP_PACKET_HDR_LEN + 1 + 1 + *pcbPassword)
    {
        EapTrace("Number of characters in password is %d", *pcbPassword);
        EapTrace("Number of bytes in the EAP packet is only %d", cbPacket);

        return ERROR_PPP_INVALID_PACKET;
    }
    if ( *pcbPassword >  PWLEN )
    {
        EapTrace ("Password length received in the packet is > PWLEN" );
        return ERROR_PPP_INVALID_PACKET;
    }
    CopyMemory(pszPassword, pchPassword, *pcbPassword);

    //
    // NULL terminate the password
    //

    pszPassword[ *pcbPassword ] = '\0';

    return(NO_ERROR);
}

VOID GetUsernameAndPassword | ( | IN HWND | hwndParent,
 |  | IN EAP_NAME_DIALOG * | pEapNameDialog
 | ) |  |

Definition at line 1775 of file Eap.c.

{
    DialogBoxParam(
        g_hInstance,
        MAKEINTRESOURCE(IDD_DIALOG),
        hwndParent,
        UsernameDialogProc,
        (LPARAM)pEapNameDialog);
}

VOID HostToWireFormat16 | ( | IN WORD | wHostFormat,
 |  | IN OUT PBYTE | pWireFormat
 | ) |  |

Definition at line 557 of file Eap.c.

{
    *((PBYTE)(pWireFormat)+0) = (BYTE) ((DWORD)(wHostFormat) >>  8);
    *((PBYTE)(pWireFormat)+1) = (BYTE) (wHostFormat);
}

VOID HostToWireFormat32 | ( | IN DWORD | dwHostFormat,
 |  | IN OUT PBYTE | pWireFormat
 | ) |  |

Definition at line 538 of file Eap.c.

{
    *((PBYTE)(pWireFormat)+0) = (BYTE) ((DWORD)(dwHostFormat) >> 24);
    *((PBYTE)(pWireFormat)+1) = (BYTE) ((DWORD)(dwHostFormat) >> 16);
    *((PBYTE)(pWireFormat)+2) = (BYTE) ((DWORD)(dwHostFormat) >>  8);
    *((PBYTE)(pWireFormat)+3) = (BYTE) (dwHostFormat);
}

BOOL InitUsernameDialog | ( | IN HWND | hWnd,
 |  | IN LPARAM | lParam
 | ) |  |

Definition at line 1833 of file Eap.c.

{
    HWND    hWndEdit;

    SetWindowLongPtr(hWnd, DWLP_USER, lParam);

    return(FALSE);
}

DWORD MakeAuthenticationAttributes | ( | IN CHAR * | szUserName,
 |  | IN CHAR * | szPassword,
 |  | IN EAPCB * | pwb
 | ) |  |

Definition at line 1428 of file Eap.c.

{
    EapTrace("MakeAuthenticationAttributes");

    if (pwb->pUserAttributes != NULL)
    {
        LocalFree(pwb->pUserAttributes[0].Value);
        LocalFree(pwb->pUserAttributes[1].Value);
        LocalFree(pwb->pUserAttributes);

        pwb->pUserAttributes = NULL;
    }

    pwb->pUserAttributes = (RAS_AUTH_ATTRIBUTE *)
                           LocalAlloc(LPTR, sizeof (RAS_AUTH_ATTRIBUTE) * 3);

    if (pwb->pUserAttributes == NULL)
    {
        return(GetLastError());
    }

    //
    // for user name
    //

    pwb->pUserAttributes[0].raaType  = raatUserName;
    pwb->pUserAttributes[0].dwLength = strlen(szUserName);
    pwb->pUserAttributes[0].Value    = LocalAlloc(LPTR, (strlen(szUserName)+1));

    if (pwb->pUserAttributes[0].Value == NULL)
    {
        LocalFree(pwb->pUserAttributes);

        pwb->pUserAttributes = NULL;

        return(GetLastError());
    }

    CopyMemory(pwb->pUserAttributes[0].Value,szUserName, strlen(szUserName));

    //
    // for password
    //

    pwb->pUserAttributes[1].raaType  = raatUserPassword;
    pwb->pUserAttributes[1].dwLength = strlen(szPassword);
    pwb->pUserAttributes[1].Value    = LocalAlloc(LPTR, (strlen(szPassword)+1));

    if (pwb->pUserAttributes[1].Value == NULL)
    {
        LocalFree(pwb->pUserAttributes[0].Value);

        LocalFree(pwb->pUserAttributes);

        pwb->pUserAttributes = NULL;

        return(GetLastError());
    }

    CopyMemory(pwb->pUserAttributes[1].Value,szPassword, strlen(szPassword));

    //
    // For Termination
    //

    pwb->pUserAttributes[2].raaType  = raatMinimum;
    pwb->pUserAttributes[2].dwLength = 0;
    pwb->pUserAttributes[2].Value    = NULL;

    return(NO_ERROR);
}

DWORD MakeMPPEKeyAttributes ( IN EAPCB * pwb )

Definition at line 1511 of file Eap.c.

{
    DWORD   dwErr           = NO_ERROR;
    DWORD   dwIndex;
    DWORD   dwSendPattern;
    DWORD   dwRecvPattern;
    BYTE*   pByte;

    EapTrace("MakeMPPEKeyAttributes");

    if (NULL != pwb->pMPPEKeyAttributes)
    {
        //
        // Free up the MPPE Key Attributes if they exist
        //

        LocalFree(pwb->pMPPEKeyAttributes[0].Value);
        LocalFree(pwb->pMPPEKeyAttributes[1].Value);
        LocalFree(pwb->pMPPEKeyAttributes);
        pwb->pMPPEKeyAttributes = NULL;
    }

    //
    // We need 3 RAS_AUTH_ATTRIBUTE structs: for MS-MPPE-Send-Key,
    // MS-MPPE-Recv-Key, and termination
    //

    pwb->pMPPEKeyAttributes = (RAS_AUTH_ATTRIBUTE *) LocalAlloc(
                LPTR, sizeof(RAS_AUTH_ATTRIBUTE) * 3);

    if (NULL == pwb->pMPPEKeyAttributes)
    {
        dwErr = GetLastError();
        goto LDone;
    }

    if (pwb->fAuthenticator)
    {
        dwSendPattern = 0xAB;
        dwRecvPattern = 0xCD;
    }
    else
    {
        dwSendPattern = 0xCD;
        dwRecvPattern = 0xAB;
    }

    //
    // Bytes needed:
    //      4: Vendor-Id
    //      1: Vendor-Type
    //      1: Vendor-Length
    //      2: Salt
    //      1: Key-Length
    //     32: Key
    //     15: Padding
    //     -----------------
    //     56: Total
    //

    //
    // Copy MS-MPPE-Send-Key
    //

    pwb->pMPPEKeyAttributes[0].Value = LocalAlloc(LPTR, 56);

    if (pwb->pMPPEKeyAttributes[0].Value == NULL)
    {
        dwErr = GetLastError();
        goto LDone;
    }

    pByte = pwb->pMPPEKeyAttributes[0].Value;

    HostToWireFormat32(311, pByte); // Vendor-Id
    pByte[4] = 16;                  // Vendor-Type (MS-MPPE-Send-Key)
    pByte[5] = 56 - 4;              // Vendor-Length (all except Vendor-Id)
    // pByte[6-7] is the zero-filled salt field
    pByte[8] = 32;                  // Key-Length

    {
        //
        // This is just an example. Copy a real key here.
        //

        CopyMemory(pByte + 9, pwb->aszPassword, 32);

        for (dwIndex = 0; dwIndex < 32; dwIndex++)
        {
            pByte[9 + dwIndex] ^= dwSendPattern;
        }
    }

    // pByte[41-55] is the Padding (zero octets)

    pwb->pMPPEKeyAttributes[0].dwLength = 56;
    pwb->pMPPEKeyAttributes[0].raaType  = raatVendorSpecific;

    //
    // Copy MS-MPPE-Recv-Key
    //

    pwb->pMPPEKeyAttributes[1].Value = LocalAlloc(LPTR, 56);

    if (pwb->pMPPEKeyAttributes[1].Value == NULL)
    {
        dwErr = GetLastError();
        goto LDone;
    }

    pByte = pwb->pMPPEKeyAttributes[1].Value;

    HostToWireFormat32(311, pByte); // Vendor-Id
    pByte[4] = 17;                  // Vendor-Type (MS-MPPE-Recv-Key)
    pByte[5] = 56 - 4;              // Vendor-Length (all except Vendor-Id)
    // pByte[6-7] is the zero-filled salt field
    pByte[8] = 32;                  // Key-Length

    {
        //
        // This is just an example. Copy a real key here.
        //

        CopyMemory(pByte + 9, pwb->aszPassword, 32);

        for (dwIndex = 0; dwIndex < 32; dwIndex++)
        {
            pByte[9 + dwIndex] ^= dwRecvPattern;
        }
    }

    // pByte[41-55] is the Padding (zero octets)

    pwb->pMPPEKeyAttributes[1].dwLength = 56;
    pwb->pMPPEKeyAttributes[1].raaType  = raatVendorSpecific;

    //
    // For Termination
    //

    pwb->pMPPEKeyAttributes[2].raaType  = raatMinimum;
    pwb->pMPPEKeyAttributes[2].dwLength = 0;
    pwb->pMPPEKeyAttributes[2].Value    = NULL;

LDone:

    if (NO_ERROR != dwErr)
    {
        //
        // If something failed, free the allocated memory
        //

        if (pwb->pMPPEKeyAttributes != NULL)
        {
            LocalFree(pwb->pMPPEKeyAttributes[0].Value);
            LocalFree(pwb->pMPPEKeyAttributes[1].Value);
            LocalFree(pwb->pMPPEKeyAttributes);
            pwb->pMPPEKeyAttributes = NULL;
        }
    }

    return(dwErr);
}

VOID MakeRequestMessage | ( | IN EAPCB * | pwb,
 |  | OUT PPP_EAP_PACKET * | pSendBuf,
 |  | IN DWORD | cbSendBuf
 | ) |  |

Definition at line 1089 of file Eap.c.

{
    BYTE *pcbPeerMessage;
    CHAR *pchPeerMessage;

    EapTrace("MakeRequestMessage");

    pcbPeerMessage  = pSendBuf->Data + 1;

    *pcbPeerMessage = (BYTE)strlen("send password");

    pchPeerMessage  = pcbPeerMessage + 1;

    strncpy(pchPeerMessage, "send password", strlen ("send password"));

    //
    // Set the Request Code
    //

    pSendBuf->Code = EAPCODE_Request;

    //
    // Set the request packet identifier. Start with the Id that was give to us
    //

    pSendBuf->Id = (BYTE)pwb->dwInitialPacketId;

    //
    // Set the length
    //

    HostToWireFormat16((WORD)(PPP_EAP_PACKET_HDR_LEN+1+*pcbPeerMessage+1),
                              pSendBuf->Length);

    //
    // Set the EAP Type Id
    //

    pSendBuf->Data[0] = PPP_EAP_PROTOCOL_ID;

}

VOID MakeResponseMessage | ( | IN EAPCB * | pwb,
 |  | IN PPP_EAP_PACKET * | pReceiveBuf,
 |  | OUT PPP_EAP_PACKET * | pSendBuf,
 |  | IN DWORD | cbSendBuf
 | ) |  |

Definition at line 972 of file Eap.c.

{
    BYTE* pcbPassword;
    CHAR* pchPassword;

    EapTrace("MakeResponseMessage");

    (void)cbSendBuf;

    //
    // Fill in the password.
    //

    pcbPassword = pSendBuf->Data + 1;

    *pcbPassword = (BYTE)strlen(pwb->aszPassword);

    pchPassword = pcbPassword + 1;

    strcpy(pchPassword, pwb->aszPassword);

    //
    // Set the response code
    //

    pSendBuf->Code = (BYTE)EAPCODE_Response;

    //
    // The Reponse packet Id MUST match the Request packet Id.
    //

    pSendBuf->Id = pReceiveBuf->Id;

    //
    // The Success/Failure packet that we get must match the ID of the last
    // response sent
    //

    pwb->dwIdExpected = pSendBuf->Id;

    //
    // Set the EAP type ID
    //

    pSendBuf->Data[0] = (BYTE)PPP_EAP_PROTOCOL_ID;

    //
    // Set the length of the packet
    //

    HostToWireFormat16((WORD)(PPP_EAP_PACKET_HDR_LEN+1+*pcbPassword+1),
                       pSendBuf->Length);
}

VOID MakeResponseMessage1 | ( | IN EAPCB * | pwb,
 |  | OUT PPP_EAP_PACKET * | pSendBuf,
 |  | IN DWORD | cbSendBuf
 | ) |  |

Definition at line 906 of file Eap.c.

{
    BYTE* pcbPassword;
    CHAR* pchPassword;

    EapTrace("MakeResponseMessage1");

    (void)cbSendBuf;

    //
    // Fill in the password.
    //

    pcbPassword = pSendBuf->Data + 1;

    *pcbPassword = (BYTE)strlen(pwb->aszPassword);

    pchPassword = pcbPassword + 1;

    strcpy(pchPassword, pwb->aszPassword);

    //
    // Set the response code
    //

    pSendBuf->Code = (BYTE)EAPCODE_Response;

    //
    // The Reponse packet Id MUST match the Request packet Id.
    //

    pSendBuf->Id = pwb->bRecvPacketId;

    //
    // The Success/Failure packet that we get must match the ID of the last
    // response sent
    //

    pwb->dwIdExpected = pSendBuf->Id;

    //
    // Set the EAP type ID
    //

    pSendBuf->Data[0] = (BYTE)PPP_EAP_PROTOCOL_ID;

    //
    // Set the length of the packet
    //

    HostToWireFormat16((WORD)(PPP_EAP_PACKET_HDR_LEN+1+*pcbPassword+1),
                       pSendBuf->Length);
}

VOID MakeResultMessage | ( | IN EAPCB * | pwb,
 |  | IN DWORD | dwError,
 |  | OUT PPP_EAP_PACKET * | pSendBuf,
 |  | IN DWORD | cbSendBuf
 | ) |  |

Definition at line 1042 of file Eap.c.

{
    EapTrace("MakeResultMessage");

    (void)cbSendBuf;

    //
    // If there was no error then we send a Success packet, otherwise we send
    // a failure message
    //

    if (dwError == NO_ERROR)
    {
        pSendBuf->Code = EAPCODE_Success;
    }
    else
    {
        pSendBuf->Code = EAPCODE_Failure;
    }

    //
    // The Id of a success or failure message MUST match the Id of the last
    // response received from the client according to the EAP spec.
    //

    pSendBuf->Id = (BYTE)pwb->dwInitialPacketId;

    //
    // Set the length
    //

    HostToWireFormat16((WORD)PPP_EAP_PACKET_HDR_LEN, (PBYTE)pSendBuf->Length);
}

DWORD APIENTRY RasEapFreeMemory ( IN BYTE * pMemory )

Definition at line 492 of file Eap.c.

{
    EapTrace("RasEapFreeMemory");
    LocalFree(pMemory);
    return(NO_ERROR);
}

DWORD APIENTRY RasEapGetIdentity | ( | IN DWORD | dwEapTypeId,
 |  | IN HWND | hwndParent,
 |  | IN DWORD | dwFlags,
 |  | IN const WCHAR * | pwszPhonebook,
 |  | IN const WCHAR * | pwszEntry,
 |  | IN BYTE * | pConnectionDataIn,
 |  | IN DWORD | dwSizeOfConnectionDataIn,
 |  | IN BYTE * | pUserDataIn,
 |  | IN DWORD | dwSizeOfUserDataIn,
 |  | OUT BYTE ** | ppUserDataOut,
 |  | OUT DWORD * | pdwSizeOfUserDataOut,
 |  | OUT WCHAR ** | ppwszIdentity
 | ) |  |

Definition at line 293 of file Eap.c.

{
    DWORD               dwErr           = NO_ERROR;

    if ( dwFlags & RAS_EAP_FLAG_NON_INTERACTIVE )
    {
        dwErr = ERROR_INTERACTIVE_MODE;
        goto LDone;
    }

    if ( dwFlags & RAS_EAP_FLAG_MACHINE_AUTH )
    {
        dwErr = ERROR_NOT_SUPPORTED;
        goto LDone;
    }

    if (dwFlags & RAS_EAP_FLAG_ROUTER)
    {
        //
        // A routing interface must have its credentials set beforehand
        //

        if (   (NULL == pUserDataIn)
            || (sizeof(EAP_NAME_DIALOG) != dwSizeOfUserDataIn))
        {
            //
            // Bad saved credentials
            //

            EapTrace("Credentials for this interface have not been set");
            dwErr = E_FAIL;
            goto LDone;
        }
    }
    else
    {
        //
        // Ignore old values. Prompt for username and password.
        //

        pUserDataIn = NULL;
    }

    dwErr = GetIdentity(
                    hwndParent,
                    pUserDataIn,
                    dwSizeOfUserDataIn,
                    ppUserDataOut,
                    pdwSizeOfUserDataOut,
                    ppwszIdentity);

LDone:

    return(dwErr);
}

DWORD APIENTRY RasEapGetInfo | ( | IN DWORD | dwEapTypeId,
 |  | OUT PPP_EAP_INFO * | pInfo
 | ) |  |

Definition at line 52 of file Eap.c.

{
    EapTrace("RasEapGetInfo");

    if (dwEapTypeId != PPP_EAP_PROTOCOL_ID)
    {
        //
        // We only support PPP_EAP_PROTOCOL_ID eap type
        //

        EapTrace("Type ID %d is not supported", dwEapTypeId);

        return(ERROR_NOT_SUPPORTED);
    }

    ZeroMemory(pInfo, sizeof(PPP_EAP_INFO));

    //
    // Fill in the required information
    //

    pInfo->dwEapTypeId       = PPP_EAP_PROTOCOL_ID;
    pInfo->RasEapBegin       = EapBegin;
    pInfo->RasEapEnd         = EapEnd;
    pInfo->RasEapMakeMessage = EapMakeMessage;

    return(NO_ERROR);
}

DWORD APIENTRY RasEapInvokeConfigUI | ( | IN DWORD | dwEapTypeId,
 |  | IN HWND | hwndParent,
 |  | IN DWORD | dwFlags,
 |  | IN BYTE * | pConnectionDataIn,
 |  | IN DWORD | dwSizeOfConnectionDataIn,
 |  | OUT BYTE ** | ppConnectionDataOut,
 |  | OUT DWORD * | pdwSizeOfConnectionDataOut
 | ) |  |

Definition at line 370 of file Eap.c.

{
    DWORD       dwDisplayedNumber;
    WCHAR       awszMessage[100];
    DWORD       dwErr               = NO_ERROR;

    *ppConnectionDataOut = NULL;
    *pdwSizeOfConnectionDataOut = 0;

    if (   (NULL == pConnectionDataIn)
        || (0 == dwSizeOfConnectionDataIn))
    {
        //
        // We are configuring for the first time
        //

        dwDisplayedNumber = 1;
    }
    else
    {
        //
        // How many times has this been configured?
        //

        dwDisplayedNumber = *(DWORD*)pConnectionDataIn;
    }

    swprintf(awszMessage, L"%5d times", dwDisplayedNumber);

    MessageBox(hwndParent, awszMessage,
        L"You have configured this interface...", MB_OK | MB_ICONINFORMATION);

    //
    // Allocate memory for the OUT parameter
    //

    *ppConnectionDataOut = (BYTE*)LocalAlloc(LPTR, sizeof(DWORD));

    if (NULL == *ppConnectionDataOut)
    {
        dwErr = ERROR_NOT_ENOUGH_MEMORY;
        goto LDone;
    }

    //
    // This has been configured one more time
    //

    dwDisplayedNumber += 1;

    //
    // Set the OUT parameters
    //

    CopyMemory(*ppConnectionDataOut, (BYTE*)&dwDisplayedNumber,
        sizeof(DWORD));
    *pdwSizeOfConnectionDataOut = sizeof(DWORD);

LDone:

    return(dwErr);
}

DWORD APIENTRY RasEapInvokeInteractiveUI | ( | IN DWORD | dwEapTypeId,
 |  | IN HWND | hWndParent,
 |  | IN PBYTE | pUIContextData,
 |  | IN DWORD | dwSizeofUIContextData,
 |  | OUT PBYTE * | ppDataFromInteractiveUI,
 |  | OUT DWORD * | lpdwSizeOfDataFromInteractiveUI
 | ) |  |

Definition at line 449 of file Eap.c.

{
    EapTrace("RasEapInvokeInteractiveUI");

    if (MessageBox(hWndParent,
                      (WCHAR*)pUIContextData,
                      L"EAP sample",
                      MB_OKCANCEL) == IDOK)
    {
        *lpdwSizeOfDataFromInteractiveUI = (wcslen(L"OK") + 1) * sizeof(WCHAR);

        if ((*ppDataFromInteractiveUI =
                    LocalAlloc(LPTR, *lpdwSizeOfDataFromInteractiveUI)) == NULL)
        {
            return(ERROR_NOT_ENOUGH_MEMORY);
        }

        wcsncpy((WCHAR*)*ppDataFromInteractiveUI, L"OK", (*lpdwSizeOfDataFromInteractiveUI) - 1);
    }
    else
    {
        *ppDataFromInteractiveUI         = NULL;
        *lpdwSizeOfDataFromInteractiveUI = 0;
    }

    return(NO_ERROR);
}

BOOL UsernameCommand | ( | IN EAP_NAME_DIALOG * | pEapNameDialog,
 |  | IN WORD | wId,
 |  | IN HWND | hWndDlg
 | ) |  |

Definition at line 1857 of file Eap.c.

{
    HWND    hWnd;

    switch(wId)
    {
    case IDOK:

        //
        // Save whatever the user typed in as the user name
        //

        hWnd = GetDlgItem(hWndDlg, IDC_EDIT_NAME);
        GetWindowText(hWnd, pEapNameDialog->awszIdentity, UNLEN + 1);

        //
        // Save whatever the user typed in as the password
        //

        hWnd = GetDlgItem(hWndDlg, IDC_EDIT_PASSWD);
        GetWindowText(hWnd, pEapNameDialog->awszPassword, PWLEN + 1);

        // Fall through

    case IDCANCEL:

        EndDialog(hWndDlg, wId);
        return(TRUE);

    default:

        return(FALSE);
    }
}

INT_PTR CALLBACK UsernameDialogProc | ( | IN HWND | hWnd,
 |  | IN UINT | unMsg,
 |  | IN WPARAM | wParam,
 |  | IN LPARAM | lParam
 | ) |  |

Definition at line 1797 of file Eap.c.

{
    EAP_NAME_DIALOG*    pEapNameDialog;

    switch (unMsg)
    {
    case WM_INITDIALOG:

        return(InitUsernameDialog(hWnd, lParam));

    case WM_COMMAND:

        pEapNameDialog = (EAP_NAME_DIALOG*)GetWindowLongPtr(hWnd, DWLP_USER);

        return(UsernameCommand(pEapNameDialog, LOWORD(wParam), hWnd));
    }

    return(FALSE);
}

WORD WireToHostFormat16 ( IN PBYTE pWireFormat )

Definition at line 574 of file Eap.c.

{
    WORD wHostFormat = ((*((PBYTE)(pWireFormat)+0) << 8) +
                        (*((PBYTE)(pWireFormat)+1)));

    return(wHostFormat);
}

Generated on Wed Nov 13 2024 16:54:02 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/Eap/Eap.h File Reference

  • NetDS
  • RRas
  • Eap
Classes | Defines | Typedefs | Enumerations | Functions | Variables

Eap.h File Reference

Go to the source code of this file.

Classes

struct | _EAP_NAME_DIALOG
struct | _EAPCB

Defines

#define | PPP_EAP_PROTOCOL_ID 20

Typedefs

typedef struct _EAP_NAME_DIALOG | EAP_NAME_DIALOG
typedef struct _EAPCB | EAPCB
typedef enum _MYSTATE | MYSTATE

Enumerations

enum _MYSTATE {
MYSTATE_Initial, MYSTATE_WaitForUserOK, MYSTATE_WaitForRequest, MYSTATE_ReqSent,
MYSTATE_WaitForAuthenticationToComplete, MYSTATE_Done
}

Functions

DWORD | AuthenticateeMakeMessage (IN EAPCB *pwb, IN PPP_EAP_PACKET *pReceiveBuf, OUT PPP_EAP_PACKET *pSendBuf, IN DWORD cbSendBuf, IN PPP_EAP_INPUT *pInput, OUT PPP_EAP_OUTPUT *pResult)
DWORD | AuthenticatorMakeMessage (IN EAPCB *pwb, IN PPP_EAP_PACKET *pReceiveBuf, OUT PPP_EAP_PACKET *pSendBuf, IN DWORD cbSendBuf, IN PPP_EAP_INPUT *pInput, OUT PPP_EAP_OUTPUT *pResult)
DWORD APIENTRY | EapBegin (OUT VOID **ppWorkBuf, IN VOID *pInfo)
DWORD APIENTRY | EapEnd (IN VOID *pWorkBuf)
DWORD APIENTRY | EapMakeMessage (IN VOID *pWorkBuf, IN PPP_EAP_PACKET *pReceiveBuf, OUT PPP_EAP_PACKET *pSendBuf, IN DWORD cbSendBuf, OUT PPP_EAP_OUTPUT *pResult, IN PPP_EAP_INPUT *pInput)
VOID | EapTrace (IN CHAR *Format,...)
DWORD | GetIdentity (IN HWND hwndParent, IN BYTE *pUserDataIn, IN DWORD dwSizeOfUserDataIn, OUT BYTE **ppUserDataOut, OUT DWORD *pdwSizeOfUserDataOut, OUT WCHAR **ppwszIdentityOut)
DWORD | GetPasswordFromResponse (IN PPP_EAP_PACKET *pReceiveBuf, OUT CHAR *pszUserName)
VOID | GetUsernameAndPassword (IN HWND hwndParent, IN EAP_NAME_DIALOG *pEapNameDialog)
BOOL | InitUsernameDialog (IN HWND hWnd, IN LPARAM lParam)
DWORD | MakeAuthenticationAttributes (IN CHAR *szUserName, IN CHAR *szPassword, IN EAPCB *pwb)
DWORD | MakeMPPEKeyAttributes (IN EAPCB *pwb)
VOID | MakeResponseMessage (IN EAPCB *pwb, IN PPP_EAP_PACKET *pReceiveBuf, OUT PPP_EAP_PACKET *pSendBuf, IN DWORD cbSendBuf)
VOID | MakeResponseMessage1 (IN EAPCB *pwb, OUT PPP_EAP_PACKET *pSendBuf, IN DWORD cbSendBuf)
VOID | MakeResultMessage (IN EAPCB *pwb, IN DWORD dwError, OUT PPP_EAP_PACKET *pSendBuf, IN DWORD cbSendBuf)
BOOL | UsernameCommand (IN EAP_NAME_DIALOG *pEapNameDialog, IN WORD wId, IN HWND hWndDlg)
INT_PTR CALLBACK | UsernameDialogProc (IN HWND hWnd, IN UINT unMsg, IN WPARAM wParam, IN LPARAM lParam)

Variables

DWORD g_dwEapTraceId
HINSTANCE | g_hInstance

Define Documentation

#define PPP_EAP_PROTOCOL_ID 20

Definition at line 15 of file Eap.h.

Typedef Documentation

typedef struct _EAP_NAME_DIALOG EAP_NAME_DIALOG
typedef struct _EAPCB EAPCB
typedef enum _MYSTATE MYSTATE

Enumeration Type Documentation

enum _MYSTATE
Enumerator:
MYSTATE_Initial
MYSTATE_WaitForUserOK
MYSTATE_WaitForRequest
MYSTATE_ReqSent
MYSTATE_WaitForAuthenticationToComplete
MYSTATE_Done

Definition at line 19 of file Eap.h.

{
    MYSTATE_Initial,
    MYSTATE_WaitForUserOK,
    MYSTATE_WaitForRequest,
    MYSTATE_ReqSent,
    MYSTATE_WaitForAuthenticationToComplete,
    MYSTATE_Done

} MYSTATE;

Function Documentation

DWORD AuthenticateeMakeMessage | ( | IN EAPCB * | pwb,
 |  | IN PPP_EAP_PACKET * | pReceiveBuf,
 |  | OUT PPP_EAP_PACKET * | pSendBuf,
 |  | IN DWORD | cbSendBuf,
 |  | IN PPP_EAP_INPUT * | pInput,
 |  | OUT PPP_EAP_OUTPUT * | pResult
 | ) |  |

Definition at line 592 of file Eap.c.

{
    DWORD dwRetCode = NO_ERROR;
    BYTE* pDataFromInteractiveUI;
    DWORD dwSizeOfDataFromInteractiveUI;

    EapTrace("AuthenticateeMakeMessage");

    switch(pwb->EapState)
    {
        case MYSTATE_Initial:

            if (pwb->fFlags & RAS_EAP_FLAG_ROUTER)
            {
                pwb->EapState = MYSTATE_WaitForRequest;

                break;
            }
            pwb->bRecvPacketId = pReceiveBuf->Id;
            if (NULL == pwb->pDataFromInteractiveUI)
            {
                WCHAR * pUIContextData = L"You are being authenticated by a Sample EAP";
                //
                // Bring up interactive UI to notify user that he/she is being
                // authenticated via the sample EAP
                //

                pResult->fInvokeInteractiveUI = TRUE;

                pResult->dwSizeOfUIContextData =
                   (wcslen(pUIContextData)+1) *
                       sizeof(WCHAR);

                pResult->pUIContextData = LocalAlloc(
                                              LPTR,
                                              pResult->dwSizeOfUIContextData);

                if (pResult->pUIContextData == NULL)
                {
                    EapTrace("OUt of memory");
                    return(ERROR_NOT_ENOUGH_MEMORY);
                }

                wcsncpy((WCHAR*)pResult->pUIContextData,
                       pUIContextData,
                       wcslen(pUIContextData)
                      );

                pwb->pUIContext = pResult->pUIContextData;

                pwb->EapState = MYSTATE_WaitForUserOK;

                break;
            }

            //
            // Else, fall through
            //

        case MYSTATE_WaitForUserOK:

            //
            // Wait for response from user
            //

            if (   pInput->fDataReceivedFromInteractiveUI
                || (NULL != pwb->pDataFromInteractiveUI))
            {
                if (pInput->fDataReceivedFromInteractiveUI)
                {
                    pDataFromInteractiveUI =
                            pInput->pDataFromInteractiveUI;
                    dwSizeOfDataFromInteractiveUI =
                            pInput->dwSizeOfDataFromInteractiveUI;
                }
                else
                {
                    pDataFromInteractiveUI =
                            pwb->pDataFromInteractiveUI;
                    dwSizeOfDataFromInteractiveUI =
                            pwb->dwSizeOfDataFromInteractiveUI;
                }

                LocalFree(pwb->pUIContext);
                pwb->pUIContext = NULL;

                //
                // If user doesn't like this, then we hangup the line
                //

                if (dwSizeOfDataFromInteractiveUI !=
                            (wcslen(L"OK")+1) * sizeof(WCHAR))
                {
                    EapTrace("User chose to cancel");
                    dwRetCode = ERROR_ACCESS_DENIED;
                    break;
                }

                if (wcscmp((WCHAR*)pDataFromInteractiveUI, L"OK") != 0)
                {
                    EapTrace("User chose to cancel");
                    dwRetCode = ERROR_ACCESS_DENIED;
                    break;
                }

                pwb->EapState = MYSTATE_WaitForRequest;
            }
            else
            {
                //
                // Ignore all other events.
                //

                pResult->Action = EAPACTION_NoAction;
            }

            if ( !(pwb->fFlags & RAS_EAP_FLAG_8021X_AUTH ) )
            {
                //
                // if this is a VPN client, we can rely on
                // retransmission.  But with wireless client
                // we cannot do that.
                //
                break;
            }
            //fall thru

        case MYSTATE_WaitForRequest:

            if ( (pwb->fFlags & RAS_EAP_FLAG_8021X_AUTH ) )
            {
                //
                // Build the response packet
                //
                MakeResponseMessage1(pwb, pSendBuf, cbSendBuf);

                //
                // Response packets should not be sent with any timeout
                //

                pResult->Action = EAPACTION_Send;

                //
                // We are done so we change to MYSTATE_Done
                //

                pwb->EapState = MYSTATE_Done;

                break;

            }
            else if (pReceiveBuf != NULL )
            {
                //
                // If we received a request packet from the server then we
                // process it.
                //

                if (pReceiveBuf->Code == EAPCODE_Request)
                {
                    //
                    // Build the response packet
                    //

                    MakeResponseMessage(pwb, pReceiveBuf, pSendBuf, cbSendBuf);

                    //
                    // Response packets should not be sent with any timeout
                    //

                    pResult->Action = EAPACTION_Send;

                    //
                    // We are done so we change to MYSTATE_Done
                    //

                    pwb->EapState = MYSTATE_Done;

                    break;
                }
                else
                {
                    //
                    // We shouldn't get any other packet in this state so
                    // we simply drop this invalid packet
                    //

                    pResult->Action = EAPACTION_NoAction;
                    dwRetCode = ERROR_PPP_INVALID_PACKET;
                    break;
                }
            }

            break;

        case MYSTATE_Done:
        {
            if (pReceiveBuf == NULL)
            {
                //
                // If we did not receive a packet then we check to see if
                // the fSuccessPacketReceived flag is set
                //

                if ((pInput != NULL) && (pInput->fSuccessPacketReceived))
                {
                    //
                    // We are done
                    //

                    //
                    // Create the MPPE Key Attribute and give it to the EAP-PPP
                    // engine.
                    //

                    dwRetCode = MakeMPPEKeyAttributes(pwb);

                    if (NO_ERROR == dwRetCode)
                    {
                        pResult->pUserAttributes = pwb->pMPPEKeyAttributes;
                    }

                    pResult->Action = EAPACTION_Done;
                    pwb->EapState   = MYSTATE_Done;
                }
                else
                {
                    //
                    // Otherwise we ignore this event
                    //

                    pResult->Action = EAPACTION_NoAction;
                }

                break;
            }

            if ((pReceiveBuf->Code == EAPCODE_Success) ||
                (pReceiveBuf->Code == EAPCODE_Failure))
            {
                if (pReceiveBuf->Code == EAPCODE_Success)
                {
                    //
                    // If we received success or failure, we are done, but first
                    // make sure the ID's match
                    //

                    //
                    // Create the MPPE Key Attribute and give it to the EAP-PPP
                    // engine.
                    //

                    dwRetCode = MakeMPPEKeyAttributes(pwb);

                    if (NO_ERROR == dwRetCode)
                    {
                        pResult->pUserAttributes = pwb->pMPPEKeyAttributes;
                    }

                    pResult->Action = EAPACTION_Done;
                    pwb->EapState   = MYSTATE_Done;
                }
                else
                {
                    //
                    // Otherwise drop the packet
                    //

                    pResult->Action = EAPACTION_NoAction;
                    dwRetCode       = ERROR_PPP_INVALID_PACKET;
                }

                break;
            }
            else if (pReceiveBuf->Code == EAPCODE_Request)
            {
                //
                // We must always respond to requests
                //

                MakeResponseMessage(pwb, pReceiveBuf, pSendBuf, cbSendBuf);

                //
                // Response packets should not be sent with any timeout
                //

                pResult->Action = EAPACTION_Send;
            }
            else
            {
                //
                // Otherwise we received an illegal packet, wrong code set
                // So simply drop the packet.
                //

                pResult->Action = EAPACTION_NoAction;
                dwRetCode       = ERROR_PPP_INVALID_PACKET;
            }
        }
    }

    return(dwRetCode);
}

DWORD AuthenticatorMakeMessage | ( | IN EAPCB * | pwb,
 |  | IN PPP_EAP_PACKET * | pReceiveBuf,
 |  | OUT PPP_EAP_PACKET * | pSendBuf,
 |  | IN DWORD | cbSendBuf,
 |  | IN PPP_EAP_INPUT * | pInput,
 |  | OUT PPP_EAP_OUTPUT * | pResult
 | ) |  |

Definition at line 1143 of file Eap.c.

{
    DWORD dwRetCode = NO_ERROR;

    EapTrace("AuthenticatorMakeMessage");

    switch(pwb->EapState)
    {
        case MYSTATE_ReqSent:

            if (pReceiveBuf != NULL)
            {
                //
                // If we received a packet
                //

                if (pReceiveBuf->Code == EAPCODE_Response)
                {
                    //
                    // If we received a response to our identity request,
                    // then process it. There is no need to check the Id
                    // here since the PPP engine will only pass on packets
                    // whose Id matches those set with the
                    // EAPACTION_SendWithTimeout action.
                    //

                    dwRetCode = GetPasswordFromResponse(pReceiveBuf,
                                                         pwb->aszPassword);

                    if (dwRetCode != NO_ERROR)
                    {
                        if (dwRetCode != ERROR_PPP_INVALID_PACKET)
                        {
                            //
                            // Fatal error, we fail the connection.
                            //

                            return(dwRetCode);
                        }
                    }
                    else
                    {
                        //
                        // Request authentication provider to authenticate
                        // this user.
                        //

                        dwRetCode = MakeAuthenticationAttributes(
                                                            pwb->aszIdentity,
                                                            pwb->aszPassword,
                                                            pwb);

                        if (dwRetCode != NO_ERROR)
                        {
                            return(dwRetCode);
                        }
                        else
                        {
                            //
                            // Authentication request completed successfully.
                            // This is an asynchronous call so we change state
                            // and wait for the provider to complete the
                            // authentication.
                            //

                            pResult->pUserAttributes = pwb->pUserAttributes;

                            pResult->Action = EAPACTION_Authenticate;

                            //
                            // Save Id so that we can send the correct one
                            // in the success/failure packet
                            //

                            pwb->dwIdExpected = pReceiveBuf->Id;

                            pwb->EapState =
                                    MYSTATE_WaitForAuthenticationToComplete;
                        }
                    }

                    break;
                }
                else
                {
                    //
                    // Otherwise silently drop the packet.
                    // We should only get requests
                    //

                    pResult->Action = EAPACTION_NoAction;

                    break;
                }
            }

            break;

        case MYSTATE_Initial:

            //
            // Create Request packet
            //

            MakeRequestMessage(pwb, pSendBuf, cbSendBuf);

            //
            // Request messages must be sent with a timeout
            //

            pResult->Action = EAPACTION_SendWithTimeoutInteractive;

            //
            // Since we have sent a request we change to the ReqSent state
            // where we will wait for a response.
            //

            pwb->EapState = MYSTATE_ReqSent;

            break;

        case MYSTATE_WaitForAuthenticationToComplete:
        {
            if (pInput != NULL)
            {
                //
                // Did the authentication provider complete the authentication?
                //

                if (pInput->fAuthenticationComplete)
                {
                    //
                    // If the user failed to authenticate, save the failure
                    // code.
                    //

                    if (pInput->dwAuthResultCode != NO_ERROR)
                    {
                        pwb->dwResult = pInput->dwAuthResultCode;
                    }

                    pResult->Action = EAPACTION_SendAndDone;
                    pwb->EapState   = MYSTATE_Done;

                    //
                    // fall thru to the MYSTATE_Done state where we will
                    // send a Success or Failure packet
                    //
                }
            }

            if ((pInput == NULL) || (!pInput->fAuthenticationComplete))
            {
                //
                // Ignore everything if authentication is not complete
                //

                pResult->Action = EAPACTION_NoAction;

                break;
            }

            //
            // ...fall thru to the MYSTATE_Done state where we will
            // send a Success or Failure packet
            //
        }

        case MYSTATE_Done:
        {
            //
            // Make Success or Failure packet.
            //

            MakeResultMessage(pwb, pwb->dwResult, pSendBuf, cbSendBuf);

            if (NO_ERROR == pwb->dwResult)
            {
                //
                // If we made a Success packet, create the MPPE Key Attribute
                // and give it to the EAP-PPP engine.
                //

                dwRetCode = MakeMPPEKeyAttributes(pwb);

                if (NO_ERROR == dwRetCode)
                {
                    pResult->pUserAttributes = pwb->pMPPEKeyAttributes;
                }
            }

            pResult->Action = EAPACTION_SendAndDone;

            pResult->dwAuthResultCode = pwb->dwResult;

            break;
        }

        default:

            break;
    }

    return(dwRetCode);

}

DWORD APIENTRY EapBegin | ( | OUT VOID ** | ppWorkBuf,
 |  | IN VOID * | pInfo
 | ) |  |

Definition at line 92 of file Eap.c.

{
    PPP_EAP_INPUT* pInput = (PPP_EAP_INPUT*)pInfo;
    EAPCB*         pwb;

    EapTrace("EapBegin(%ws)", pInput->pwszIdentity);

    //
    // Allocate work buffer.
    //

    if ((pwb = (EAPCB*)LocalAlloc(LPTR, sizeof(EAPCB))) == NULL)
    {
        EapTrace("Not enough memory");
        return(ERROR_NOT_ENOUGH_MEMORY);
    }

    //
    // Save information passed in, will be used later
    //

    pwb->fFlags             = pInput->fFlags;
    pwb->fAuthenticator     = pInput->fAuthenticator;
    pwb->EapState           = MYSTATE_Initial;
    pwb->dwInitialPacketId  = pInput->bInitialId;

    if (pInput->pDataFromInteractiveUI != NULL)
    {
        pwb->dwSizeOfDataFromInteractiveUI =
            pInput->dwSizeOfDataFromInteractiveUI;
        pwb->pDataFromInteractiveUI =
            LocalAlloc(LPTR, pwb->dwSizeOfDataFromInteractiveUI);

        if (NULL != pwb->pDataFromInteractiveUI)
        {
            CopyMemory(pwb->pDataFromInteractiveUI,
                pInput->pDataFromInteractiveUI,
                pwb->dwSizeOfDataFromInteractiveUI);
        }
    }

    //
    // Save the identity. On the authenticatee side, this is obtained by user
    // input; on the authenticator side this was obtained by the Identity
    // request message.
    //

    WideCharToMultiByte(
        CP_ACP,
        0,
        pInput->pwszIdentity,
        -1,
        pwb->aszIdentity,
        UNLEN + 1,
        NULL,
        NULL );

    //
    // If we are an authenticatee, then use the password passed in
    //

    if (!pwb->fAuthenticator)
    {
        if (   (NULL != pInput->pUserData)
            && (sizeof(EAP_NAME_DIALOG) == pInput->dwSizeOfUserData))
        {
            WideCharToMultiByte(
                CP_ACP,
                0,
                ((EAP_NAME_DIALOG*)(pInput->pUserData))->awszPassword,
                -1,
                pwb->aszPassword,
                PWLEN + 1,
                NULL,
                NULL );
        }
    }

    //
    // Register work buffer with engine.
    //

    *ppWorkBuf = pwb;

    return(NO_ERROR);
}

DWORD APIENTRY EapEnd ( IN VOID * pWorkBuf )

Definition at line 191 of file Eap.c.

{
    EAPCB* pwb = (EAPCB *)pWorkBuf;

    if (pwb == NULL)
    {
        return(NO_ERROR);
    }

    //
    // Release all resources used by this authentication session.
    //

    EapTrace("EapEnd(%s)", pwb->aszIdentity);

    LocalFree(pwb->pUIContext);
    LocalFree(pwb->pDataFromInteractiveUI);

    if (pwb->pUserAttributes != NULL)
    {
        //
        // Free up Attributes
        //

        LocalFree(pwb->pUserAttributes[0].Value);
        LocalFree(pwb->pUserAttributes[1].Value);
        LocalFree(pwb->pUserAttributes);
    }

    if (pwb->pMPPEKeyAttributes != NULL)
    {
        //
        // Free up the MPPE Key Attributes
        //

        LocalFree(pwb->pMPPEKeyAttributes[0].Value);
        LocalFree(pwb->pMPPEKeyAttributes);
    }

    ZeroMemory(pwb, sizeof(EAPCB));

    LocalFree(pwb);

    return(NO_ERROR);
}

DWORD APIENTRY EapMakeMessage | ( | IN VOID * | pWorkBuf,
 |  | IN PPP_EAP_PACKET * | pReceiveBuf,
 |  | OUT PPP_EAP_PACKET * | pSendBuf,
 |  | IN DWORD | cbSendBuf,
 |  | OUT PPP_EAP_OUTPUT * | pResult,
 |  | IN PPP_EAP_INPUT * | pInput
 | ) |  |

Definition at line 248 of file Eap.c.

{
    EAPCB*  pwb = (EAPCB*)pWorkBuf;

    EapTrace("EapMakeMessage(%s)", pwb->aszIdentity);

    //
    // Call the appropriate routine to process the event.
    //

    if (pwb->fAuthenticator)
    {
        return(AuthenticatorMakeMessage(pwb,
                                        pReceiveBuf,
                                        pSendBuf,
                                        cbSendBuf,
                                        pInput,
                                        pResult));
    }
    else
    {
        return(AuthenticateeMakeMessage(pwb,
                                        pReceiveBuf,
                                        pSendBuf,
                                        cbSendBuf,
                                        pInput,
                                        pResult));
    }
}

VOID EapTrace | ( | IN CHAR * | Format,
 |  |  | ...
 | ) |  |

Definition at line 513 of file Eap.c.

{
    va_list arglist;

    va_start(arglist, Format);

    TraceVprintfExA(g_dwEapTraceId,
        0x00010000 | TRACE_USE_MASK | TRACE_USE_MSEC,
        Format,
        arglist);

    va_end(arglist);
}

DWORD GetIdentity | ( | IN HWND | hwndParent,
 |  | IN BYTE * | pUserDataIn,
 |  | IN DWORD | dwSizeOfUserDataIn,
 |  | OUT BYTE ** | ppUserDataOut,
 |  | OUT DWORD * | pdwSizeOfUserDataOut,
 |  | OUT WCHAR ** | ppwszIdentityOut
 | ) |  |

Definition at line 1684 of file Eap.c.

{
    EAP_NAME_DIALOG*    pEapNameDialog  = NULL;
    WCHAR*              pwszIdentity     = NULL;
    DWORD               dwErr           = NO_ERROR;

    //
    // Allocate memory for OUT parameters
    //

    pEapNameDialog = LocalAlloc(LPTR, sizeof(EAP_NAME_DIALOG));

    if (NULL == pEapNameDialog)
    {
        EapTrace("Out of memory");
        dwErr = GetLastError();
        goto LDone;
    }

    pwszIdentity = LocalAlloc(LPTR, (UNLEN + 1) * sizeof(WCHAR));

    if (NULL == pwszIdentity)
    {
        EapTrace("Out of memory");
        dwErr = GetLastError();
        goto LDone;
    }

    if (NULL != pUserDataIn)
    {
        //
        // Use the saved credentials if they exist
        //

        CopyMemory(pEapNameDialog, pUserDataIn, sizeof(EAP_NAME_DIALOG));
    }
    else
    {
        //
        // Else prompt for username and password
        //

        GetUsernameAndPassword(hwndParent, pEapNameDialog);
    }

    wcscpy(pwszIdentity, pEapNameDialog->awszIdentity);

    //
    // Set the OUT paramters
    //

    *ppUserDataOut = (BYTE*)pEapNameDialog;
    *pdwSizeOfUserDataOut = sizeof(EAP_NAME_DIALOG);
    *ppwszIdentity = pwszIdentity;

    //
    // We mustn't LocalFree OUT parameters
    //

    pEapNameDialog = NULL;
    pwszIdentity = NULL;

LDone:

    LocalFree(pEapNameDialog);
    LocalFree(pwszIdentity);

    return(dwErr);
}

DWORD GetPasswordFromResponse | ( | IN PPP_EAP_PACKET * | pReceiveBuf,
 |  | OUT CHAR * | pszUserName
 | ) |  |

Definition at line 1369 of file Eap.c.

{
    BYTE* pcbPassword;
    CHAR* pchPassword;
    WORD  cbPacket;

    EapTrace("GetPasswordFromResponse");

    cbPacket = WireToHostFormat16(pReceiveBuf->Length);

    //
    // Extract the password
    //

    if (cbPacket < (PPP_EAP_PACKET_HDR_LEN + 1 + 1))
    {
        EapTrace("Number of bytes in the EAP packet is only %d", cbPacket);

        return(ERROR_PPP_INVALID_PACKET);
    }

    pcbPassword = pReceiveBuf->Data + 1;
    pchPassword = pcbPassword + 1;

    if (cbPacket < PPP_EAP_PACKET_HDR_LEN + 1 + 1 + *pcbPassword)
    {
        EapTrace("Number of characters in password is %d", *pcbPassword);
        EapTrace("Number of bytes in the EAP packet is only %d", cbPacket);

        return ERROR_PPP_INVALID_PACKET;
    }
    if ( *pcbPassword >  PWLEN )
    {
        EapTrace ("Password length received in the packet is > PWLEN" );
        return ERROR_PPP_INVALID_PACKET;
    }
    CopyMemory(pszPassword, pchPassword, *pcbPassword);

    //
    // NULL terminate the password
    //

    pszPassword[ *pcbPassword ] = '\0';

    return(NO_ERROR);
}

VOID GetUsernameAndPassword | ( | IN HWND | hwndParent,
 |  | IN EAP_NAME_DIALOG * | pEapNameDialog
 | ) |  |

Definition at line 1775 of file Eap.c.

{
    DialogBoxParam(
        g_hInstance,
        MAKEINTRESOURCE(IDD_DIALOG),
        hwndParent,
        UsernameDialogProc,
        (LPARAM)pEapNameDialog);
}

BOOL InitUsernameDialog | ( | IN HWND | hWnd,
 |  | IN LPARAM | lParam
 | ) |  |

Definition at line 1833 of file Eap.c.

{
    HWND    hWndEdit;

    SetWindowLongPtr(hWnd, DWLP_USER, lParam);

    return(FALSE);
}

DWORD MakeAuthenticationAttributes | ( | IN CHAR * | szUserName,
 |  | IN CHAR * | szPassword,
 |  | IN EAPCB * | pwb
 | ) |  |

Definition at line 1428 of file Eap.c.

{
    EapTrace("MakeAuthenticationAttributes");

    if (pwb->pUserAttributes != NULL)
    {
        LocalFree(pwb->pUserAttributes[0].Value);
        LocalFree(pwb->pUserAttributes[1].Value);
        LocalFree(pwb->pUserAttributes);

        pwb->pUserAttributes = NULL;
    }

    pwb->pUserAttributes = (RAS_AUTH_ATTRIBUTE *)
                           LocalAlloc(LPTR, sizeof (RAS_AUTH_ATTRIBUTE) * 3);

    if (pwb->pUserAttributes == NULL)
    {
        return(GetLastError());
    }

    //
    // for user name
    //

    pwb->pUserAttributes[0].raaType  = raatUserName;
    pwb->pUserAttributes[0].dwLength = strlen(szUserName);
    pwb->pUserAttributes[0].Value    = LocalAlloc(LPTR, (strlen(szUserName)+1));

    if (pwb->pUserAttributes[0].Value == NULL)
    {
        LocalFree(pwb->pUserAttributes);

        pwb->pUserAttributes = NULL;

        return(GetLastError());
    }

    CopyMemory(pwb->pUserAttributes[0].Value,szUserName, strlen(szUserName));

    //
    // for password
    //

    pwb->pUserAttributes[1].raaType  = raatUserPassword;
    pwb->pUserAttributes[1].dwLength = strlen(szPassword);
    pwb->pUserAttributes[1].Value    = LocalAlloc(LPTR, (strlen(szPassword)+1));

    if (pwb->pUserAttributes[1].Value == NULL)
    {
        LocalFree(pwb->pUserAttributes[0].Value);

        LocalFree(pwb->pUserAttributes);

        pwb->pUserAttributes = NULL;

        return(GetLastError());
    }

    CopyMemory(pwb->pUserAttributes[1].Value,szPassword, strlen(szPassword));

    //
    // For Termination
    //

    pwb->pUserAttributes[2].raaType  = raatMinimum;
    pwb->pUserAttributes[2].dwLength = 0;
    pwb->pUserAttributes[2].Value    = NULL;

    return(NO_ERROR);
}

DWORD MakeMPPEKeyAttributes ( IN EAPCB * pwb )

Definition at line 1511 of file Eap.c.

{
    DWORD   dwErr           = NO_ERROR;
    DWORD   dwIndex;
    DWORD   dwSendPattern;
    DWORD   dwRecvPattern;
    BYTE*   pByte;

    EapTrace("MakeMPPEKeyAttributes");

    if (NULL != pwb->pMPPEKeyAttributes)
    {
        //
        // Free up the MPPE Key Attributes if they exist
        //

        LocalFree(pwb->pMPPEKeyAttributes[0].Value);
        LocalFree(pwb->pMPPEKeyAttributes[1].Value);
        LocalFree(pwb->pMPPEKeyAttributes);
        pwb->pMPPEKeyAttributes = NULL;
    }

    //
    // We need 3 RAS_AUTH_ATTRIBUTE structs: for MS-MPPE-Send-Key,
    // MS-MPPE-Recv-Key, and termination
    //

    pwb->pMPPEKeyAttributes = (RAS_AUTH_ATTRIBUTE *) LocalAlloc(
                LPTR, sizeof(RAS_AUTH_ATTRIBUTE) * 3);

    if (NULL == pwb->pMPPEKeyAttributes)
    {
        dwErr = GetLastError();
        goto LDone;
    }

    if (pwb->fAuthenticator)
    {
        dwSendPattern = 0xAB;
        dwRecvPattern = 0xCD;
    }
    else
    {
        dwSendPattern = 0xCD;
        dwRecvPattern = 0xAB;
    }

    //
    // Bytes needed:
    //      4: Vendor-Id
    //      1: Vendor-Type
    //      1: Vendor-Length
    //      2: Salt
    //      1: Key-Length
    //     32: Key
    //     15: Padding
    //     -----------------
    //     56: Total
    //

    //
    // Copy MS-MPPE-Send-Key
    //

    pwb->pMPPEKeyAttributes[0].Value = LocalAlloc(LPTR, 56);

    if (pwb->pMPPEKeyAttributes[0].Value == NULL)
    {
        dwErr = GetLastError();
        goto LDone;
    }

    pByte = pwb->pMPPEKeyAttributes[0].Value;

    HostToWireFormat32(311, pByte); // Vendor-Id
    pByte[4] = 16;                  // Vendor-Type (MS-MPPE-Send-Key)
    pByte[5] = 56 - 4;              // Vendor-Length (all except Vendor-Id)
    // pByte[6-7] is the zero-filled salt field
    pByte[8] = 32;                  // Key-Length

    {
        //
        // This is just an example. Copy a real key here.
        //

        CopyMemory(pByte + 9, pwb->aszPassword, 32);

        for (dwIndex = 0; dwIndex < 32; dwIndex++)
        {
            pByte[9 + dwIndex] ^= dwSendPattern;
        }
    }

    // pByte[41-55] is the Padding (zero octets)

    pwb->pMPPEKeyAttributes[0].dwLength = 56;
    pwb->pMPPEKeyAttributes[0].raaType  = raatVendorSpecific;

    //
    // Copy MS-MPPE-Recv-Key
    //

    pwb->pMPPEKeyAttributes[1].Value = LocalAlloc(LPTR, 56);

    if (pwb->pMPPEKeyAttributes[1].Value == NULL)
    {
        dwErr = GetLastError();
        goto LDone;
    }

    pByte = pwb->pMPPEKeyAttributes[1].Value;

    HostToWireFormat32(311, pByte); // Vendor-Id
    pByte[4] = 17;                  // Vendor-Type (MS-MPPE-Recv-Key)
    pByte[5] = 56 - 4;              // Vendor-Length (all except Vendor-Id)
    // pByte[6-7] is the zero-filled salt field
    pByte[8] = 32;                  // Key-Length

    {
        //
        // This is just an example. Copy a real key here.
        //

        CopyMemory(pByte + 9, pwb->aszPassword, 32);

        for (dwIndex = 0; dwIndex < 32; dwIndex++)
        {
            pByte[9 + dwIndex] ^= dwRecvPattern;
        }
    }

    // pByte[41-55] is the Padding (zero octets)

    pwb->pMPPEKeyAttributes[1].dwLength = 56;
    pwb->pMPPEKeyAttributes[1].raaType  = raatVendorSpecific;

    //
    // For Termination
    //

    pwb->pMPPEKeyAttributes[2].raaType  = raatMinimum;
    pwb->pMPPEKeyAttributes[2].dwLength = 0;
    pwb->pMPPEKeyAttributes[2].Value    = NULL;

LDone:

    if (NO_ERROR != dwErr)
    {
        //
        // If something failed, free the allocated memory
        //

        if (pwb->pMPPEKeyAttributes != NULL)
        {
            LocalFree(pwb->pMPPEKeyAttributes[0].Value);
            LocalFree(pwb->pMPPEKeyAttributes[1].Value);
            LocalFree(pwb->pMPPEKeyAttributes);
            pwb->pMPPEKeyAttributes = NULL;
        }
    }

    return(dwErr);
}

VOID MakeResponseMessage | ( | IN EAPCB * | pwb,
 |  | IN PPP_EAP_PACKET * | pReceiveBuf,
 |  | OUT PPP_EAP_PACKET * | pSendBuf,
 |  | IN DWORD | cbSendBuf
 | ) |  |

Definition at line 972 of file Eap.c.

{
    BYTE* pcbPassword;
    CHAR* pchPassword;

    EapTrace("MakeResponseMessage");

    (void)cbSendBuf;

    //
    // Fill in the password.
    //

    pcbPassword = pSendBuf->Data + 1;

    *pcbPassword = (BYTE)strlen(pwb->aszPassword);

    pchPassword = pcbPassword + 1;

    strcpy(pchPassword, pwb->aszPassword);

    //
    // Set the response code
    //

    pSendBuf->Code = (BYTE)EAPCODE_Response;

    //
    // The Reponse packet Id MUST match the Request packet Id.
    //

    pSendBuf->Id = pReceiveBuf->Id;

    //
    // The Success/Failure packet that we get must match the ID of the last
    // response sent
    //

    pwb->dwIdExpected = pSendBuf->Id;

    //
    // Set the EAP type ID
    //

    pSendBuf->Data[0] = (BYTE)PPP_EAP_PROTOCOL_ID;

    //
    // Set the length of the packet
    //

    HostToWireFormat16((WORD)(PPP_EAP_PACKET_HDR_LEN+1+*pcbPassword+1),
                       pSendBuf->Length);
}

VOID MakeResponseMessage1 | ( | IN EAPCB * | pwb,
 |  | OUT PPP_EAP_PACKET * | pSendBuf,
 |  | IN DWORD | cbSendBuf
 | ) |  |

Definition at line 906 of file Eap.c.

{
    BYTE* pcbPassword;
    CHAR* pchPassword;

    EapTrace("MakeResponseMessage1");

    (void)cbSendBuf;

    //
    // Fill in the password.
    //

    pcbPassword = pSendBuf->Data + 1;

    *pcbPassword = (BYTE)strlen(pwb->aszPassword);

    pchPassword = pcbPassword + 1;

    strcpy(pchPassword, pwb->aszPassword);

    //
    // Set the response code
    //

    pSendBuf->Code = (BYTE)EAPCODE_Response;

    //
    // The Reponse packet Id MUST match the Request packet Id.
    //

    pSendBuf->Id = pwb->bRecvPacketId;

    //
    // The Success/Failure packet that we get must match the ID of the last
    // response sent
    //

    pwb->dwIdExpected = pSendBuf->Id;

    //
    // Set the EAP type ID
    //

    pSendBuf->Data[0] = (BYTE)PPP_EAP_PROTOCOL_ID;

    //
    // Set the length of the packet
    //

    HostToWireFormat16((WORD)(PPP_EAP_PACKET_HDR_LEN+1+*pcbPassword+1),
                       pSendBuf->Length);
}

VOID MakeResultMessage | ( | IN EAPCB * | pwb,
 |  | IN DWORD | dwError,
 |  | OUT PPP_EAP_PACKET * | pSendBuf,
 |  | IN DWORD | cbSendBuf
 | ) |  |

Definition at line 1042 of file Eap.c.

{
    EapTrace("MakeResultMessage");

    (void)cbSendBuf;

    //
    // If there was no error then we send a Success packet, otherwise we send
    // a failure message
    //

    if (dwError == NO_ERROR)
    {
        pSendBuf->Code = EAPCODE_Success;
    }
    else
    {
        pSendBuf->Code = EAPCODE_Failure;
    }

    //
    // The Id of a success or failure message MUST match the Id of the last
    // response received from the client according to the EAP spec.
    //

    pSendBuf->Id = (BYTE)pwb->dwInitialPacketId;

    //
    // Set the length
    //

    HostToWireFormat16((WORD)PPP_EAP_PACKET_HDR_LEN, (PBYTE)pSendBuf->Length);
}

BOOL UsernameCommand | ( | IN EAP_NAME_DIALOG * | pEapNameDialog,
 |  | IN WORD | wId,
 |  | IN HWND | hWndDlg
 | ) |  |

Definition at line 1857 of file Eap.c.

{
    HWND    hWnd;

    switch(wId)
    {
    case IDOK:

        //
        // Save whatever the user typed in as the user name
        //

        hWnd = GetDlgItem(hWndDlg, IDC_EDIT_NAME);
        GetWindowText(hWnd, pEapNameDialog->awszIdentity, UNLEN + 1);

        //
        // Save whatever the user typed in as the password
        //

        hWnd = GetDlgItem(hWndDlg, IDC_EDIT_PASSWD);
        GetWindowText(hWnd, pEapNameDialog->awszPassword, PWLEN + 1);

        // Fall through

    case IDCANCEL:

        EndDialog(hWndDlg, wId);
        return(TRUE);

    default:

        return(FALSE);
    }
}

INT_PTR CALLBACK UsernameDialogProc | ( | IN HWND | hWnd,
 |  | IN UINT | unMsg,
 |  | IN WPARAM | wParam,
 |  | IN LPARAM | lParam
 | ) |  |

Definition at line 1797 of file Eap.c.

{
    EAP_NAME_DIALOG*    pEapNameDialog;

    switch (unMsg)
    {
    case WM_INITDIALOG:

        return(InitUsernameDialog(hWnd, lParam));

    case WM_COMMAND:

        pEapNameDialog = (EAP_NAME_DIALOG*)GetWindowLongPtr(hWnd, DWLP_USER);

        return(UsernameCommand(pEapNameDialog, LOWORD(wParam), hWnd));
    }

    return(FALSE);
}

Variable Documentation

DWORD g_dwEapTraceId
HINSTANCE g_hInstance

Definition at line 104 of file SServer.Cpp.

Generated on Wed Nov 13 2024 16:54:02 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/Eap/Exports.Cpp File Reference

  • NetDS
  • RRas
  • Eap
Functions | Variables

Exports.Cpp File Reference

#include <windows.h>
#include <lmcons.h>
#include <raseapif.h>
#include <rtutils.h>
#include "ceapcfg.h"
#include <initguid.h>
#include <atlimpl.cpp>

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (VOID)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (VOID)
STDAPI | DllUnregisterServer (VOID)

Variables

CComModule | _Module
const CLSID | CLSID_EapCfg
DWORD g_dwEapTraceId
HINSTANCE | g_hInstance
const IID | IID_IEAPProviderConfig

Function Documentation

STDAPI DllCanUnloadNow ( VOID )

Definition at line 85 of file Exports.Cpp.

{
    if (0 == _Module.GetLockCount())
    {
        return(S_OK);
    }
    else
    {
        return(S_FALSE);
    }
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 107 of file Exports.Cpp.

{
    return(_Module.GetClassObject(rclsid, riid, ppv));
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 54 of file Exports.Cpp.

{
    if (dwReason == DLL_PROCESS_ATTACH)
    {
        g_hInstance = hInstance;
        g_dwEapTraceId = TraceRegister(L"SampleEAP");
        _Module.Init(ObjectMap, hInstance);
        DisableThreadLibraryCalls(hInstance);
    }
    else if (dwReason == DLL_PROCESS_DETACH)
    {
        TraceDeregister(g_dwEapTraceId);
        g_dwEapTraceId = INVALID_TRACEID;
        _Module.Term();
    }

    return(TRUE);
}

STDAPI DllRegisterServer ( VOID )

Definition at line 125 of file Exports.Cpp.

{
    return(_Module.RegisterServer(FALSE /* bRegTypeLib */));
}

STDAPI DllUnregisterServer ( VOID )

Definition at line 140 of file Exports.Cpp.

{
    _Module.UnregisterServer();
    return(S_OK);
}

Variable Documentation

CComModule _Module

Definition at line 24 of file Exports.Cpp.

const CLSID CLSID_EapCfg
Initial value:
 {
    0x3b9aae60,
    0xa032,
    0x11d2,
    {0x95, 0xf6, 0x00, 0x10, 0x4b, 0x98, 0xf3, 0xf5}
}

Definition at line 34 of file Exports.Cpp.

DWORD g_dwEapTraceId
HINSTANCE g_hInstance

Definition at line 104 of file SServer.Cpp.

const IID IID_IEAPProviderConfig
Initial value:
 {
    0x66A2DB19,
    0xD706,
    0x11D0,
    {0xA3, 0x7B, 0x00, 0xC0, 0x4F, 0xC9, 0xDA, 0x04}
}

Definition at line 26 of file Exports.Cpp.

Generated on Wed Nov 13 2024 16:54:02 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/Eap/Resource.h File Reference

  • NetDS
  • RRas
  • Eap
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_EDIT_NAME 1003
#define | IDC_EDIT_PASSWD 1004
#define | IDC_STATIC (-1)
#define | IDD_DIALOG 1002
#define | IDR_EAPCFG 1001

Define Documentation

#define IDC_EDIT_NAME 1003

Definition at line 4 of file Resource.h.

#define IDC_EDIT_PASSWD 1004

Definition at line 5 of file Resource.h.

#define IDC_STATIC (-1)

Definition at line 1 of file Resource.h.

#define IDD_DIALOG 1002

Definition at line 3 of file Resource.h.

#define IDR_EAPCFG 1001

Definition at line 2 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/ip/configentry.c File Reference

  • NetDS
  • RRas
  • ip
Functions

configentry.c File Reference

#include "pchsample.h"

Go to the source code of this file.

Functions

DWORD | CE_Cleanup (IN PCONFIGURATION_ENTRY pce, IN BOOL bCleanupWinsock)
DWORD | CE_Create (IN PCONFIGURATION_ENTRY pce)
DWORD | CE_Destroy (IN PCONFIGURATION_ENTRY pce)
DWORD | CE_Initialize (IN PCONFIGURATION_ENTRY pce, IN HANDLE hMgrNotificationEvent, IN PSUPPORT_FUNCTIONS psfSupportFunctions, IN PIPSAMPLE_GLOBAL_CONFIG pigc)
DWORD | DequeueEvent (OUT ROUTING_PROTOCOL_EVENTS *prpeEvent, OUT MESSAGE *pmMessage)
DWORD | EE_Create (IN ROUTING_PROTOCOL_EVENTS rpeEvent, IN MESSAGE mMessage, OUT PEVENT_ENTRY *ppeeEventEntry)
DWORD | EE_Destroy (IN PEVENT_ENTRY peeEventEntry)
DWORD | EnqueueEvent (IN ROUTING_PROTOCOL_EVENTS rpeEvent, IN MESSAGE mMessage)

Function Documentation

DWORD CE_Cleanup | ( | IN PCONFIGURATION_ENTRY | pce,
 |  | IN BOOL | bCleanupWinsock
 | ) |  |

Definition at line 621 of file configentry.c.

        : However, pce->rwlLock should NOT actually be held!  The call to
    DeleteTimerQueueEx blocks till all queued callbacks finish execution.
    These callbacks may acquire pce->rwlLock, causing deadlock.

Arguments
    pce                 pointer to the configuration entry
    bCleanupWinsock
Return Value
    NO_ERROR            always

--*/
{
    DWORD dwErr = NO_ERROR;

    // Network Entry
    NE_Destroy(pce->pneNetworkEntry);
    pce->pneNetworkEntry        = NULL;

    // MGM Information (later)
    pce->hMgmHandle = NULL;

    // RTMv2 Information
    if (pce->hRtmNotificationHandle)
    {
        dwErr = RTM_DeregisterFromChangeNotification(
            pce->hRtmHandle,
            pce->hRtmNotificationHandle);

        if (dwErr != NO_ERROR)
            TRACE1(CONFIGURATION,
                   "Error %u deregistering for change from RTM", dwErr);
    }
    pce->hRtmNotificationHandle = NULL;

    if (pce->hRtmHandle)
    {
        dwErr = RTM_DeregisterEntity(pce->hRtmHandle);

        if (dwErr != NO_ERROR)
            TRACE1(CONFIGURATION,
                   "Error %u deregistering from RTM", dwErr);
    }
    pce->hRtmHandle             = NULL;

    // Router Manager Information
    // valid till overwritten, needed to signal the ip router manager
    //     pce->hMgrNotificationEvent
    //     pce->sfSupportFunctions

    // Timer Entry
    if (pce->hTimerQueue)
        DeleteTimerQueueEx(pce->hTimerQueue, INVALID_HANDLE_VALUE);
    pce->hTimerQueue            = NULL;

    // Store of Dynamic Locks
    if (DYNAMIC_LOCKS_STORE_INITIALIZED(&(pce->dlsDynamicLocksStore)))
    {
        dwErr = DeInitializeDynamicLocksStore(&(pce->dlsDynamicLocksStore));

        // all dynamic locks should have been free
        RTASSERT(dwErr is NO_ERROR);
    }

    if (bCleanupWinsock)
        WSACleanup();

    // protocol state
    pce->iscStatus = IPSAMPLE_STATUS_STOPPED;

    return NO_ERROR;
}

DWORD CE_Create ( IN PCONFIGURATION_ENTRY pce )

Definition at line 286 of file configentry.c.

{
    DWORD dwErr = NO_ERROR;

    // initialize to default values
    ZeroMemory(pce, sizeof(CONFIGURATION_ENTRY));
    pce->dwTraceID = INVALID_TRACEID;

    do                          // breakout loop
    {
        // initialize the read-write lock
        CREATE_READ_WRITE_LOCK(&(pce->rwlLock));
        if (!READ_WRITE_LOCK_CREATED(&(pce->rwlLock)))
        {
            dwErr = GetLastError();

            TRACE1(CONFIGURATION, "Error %u creating read-write-lock", dwErr);
            LOGERR0(CREATE_RWL_FAILED, dwErr);

            break;
        }

        // initialize the global heap
        pce->hGlobalHeap = HeapCreate(0, 0, 0);
        if (pce->hGlobalHeap is NULL)
        {
            dwErr = GetLastError();
            TRACE1(CONFIGURATION, "Error %u creating global heap", dwErr);
            LOGERR0(HEAP_CREATE_FAILED, dwErr);

            break;
        }

        //
        // initialize the count of threads that are active in IPSAMPLE
        // create the semaphore released by each thread when it is done
        // required for clean stop to the protocol
        //
        pce->ulActivityCount = 0;
        pce->hActivitySemaphore = CreateSemaphore(NULL, 0, 0xfffffff, NULL);
        if (pce->hActivitySemaphore is NULL)
        {
            dwErr = GetLastError();
            TRACE1(CONFIGURATION, "Error %u creating semaphore", dwErr);
            LOGERR0(CREATE_SEMAPHORE_FAILED, dwErr);
            break;
        }

        // Logging & Tracing Information
        pce->dwLogLevel = IPSAMPLE_LOGGING_INFO;
        pce->hLogHandle = RouterLogRegister("IPSAMPLE");
        pce->dwTraceID  = TraceRegister("IPSAMPLE");

        // Event Queue
        INITIALIZE_LOCKED_QUEUE(&(pce->lqEventQueue));
        if (!LOCKED_QUEUE_INITIALIZED(&(pce->lqEventQueue)))
        {
            dwErr = GetLastError();
            TRACE1(CONFIGURATION, "Error %u initializing locked queue", dwErr);
            LOGERR0(INIT_CRITSEC_FAILED, dwErr);
            break;
        }

        // Protocol State
        pce->iscStatus = IPSAMPLE_STATUS_STOPPED;

        // Store of Dynamic Locks
        // pce->dlsDynamicLocksStore    zero'ed out

        // Timer Entry
        // pce->hTimerQueue             = NULL;

        // Router Manager Information (later)
        // pce->hMgrNotificationEvent   = NULL
        // pce->sfSupportFunctions      zero'ed out

        // RTMv2 Information
        // pce->reiRtmEntity            zero'ed out
        // pce->rrpRtmProfile           zero'ed out
        // pce->hRtmHandle              = NULL
        // pce->hRtmNotificationHandle  = NULL

        // MGM Information
        // pce->hMgmHandle              = NULL

        // Network Entry
        // pce->pneNetworkEntry         = NULL;

        // Global Statistics
        // pce->igsStats                zero'ed out

    } while (FALSE);

    if (dwErr != NO_ERROR)
    {
        // something went wrong, so cleanup.
        TRACE0(CONFIGURATION, "Failed to create configuration entry");
        CE_Destroy(pce);
    }

    return dwErr;
}

DWORD CE_Destroy ( IN PCONFIGURATION_ENTRY pce )

Definition at line 410 of file configentry.c.

{
    // Network Entry

    // MGM Information

    // RTMv2 Information

    // Router Manager Information

    // Timer Entry

    // Store of Dynamic Locks

    // protocol state should be such...
    RTASSERT(pce->iscStatus is IPSAMPLE_STATUS_STOPPED);

    // Event Queue
    if (LOCKED_QUEUE_INITIALIZED(&(pce->lqEventQueue)))
        DELETE_LOCKED_QUEUE((&(pce->lqEventQueue)), FreeEventEntry);

    // Logging & Tracing Information
    if (pce->dwTraceID != INVALID_TRACEID)
    {
        TraceDeregister(pce->dwTraceID);
        pce->dwTraceID = INVALID_TRACEID;
    }
    if (pce->hLogHandle != NULL)
    {
        RouterLogDeregister(pce->hLogHandle);
        pce->hLogHandle = NULL;
    }

    // destroy the semaphore released by each thread when it is done
    if (pce->hActivitySemaphore != NULL)
    {
        CloseHandle(pce->hActivitySemaphore);
        pce->hActivitySemaphore = NULL;
    }

    if (pce->hGlobalHeap != NULL)
    {
        HeapDestroy(pce->hGlobalHeap);
        pce->hGlobalHeap = NULL;
    }

    // delete the read-write lock
    if (READ_WRITE_LOCK_CREATED(&(pce->rwlLock)))
        DELETE_READ_WRITE_LOCK(&(pce->rwlLock));

    return NO_ERROR;
}

DWORD CE_Initialize | ( | IN PCONFIGURATION_ENTRY | pce,
 |  | IN HANDLE | hMgrNotificationEvent,
 |  | IN PSUPPORT_FUNCTIONS | psfSupportFunctions,
 |  | IN PIPSAMPLE_GLOBAL_CONFIG | pigc
 | ) |  |

Definition at line 482 of file configentry.c.

{
    WORD    wVersionRequested   = MAKEWORD(1,1);
    WSADATA wsaData;
    BOOL    bCleanupWinsock     = FALSE;

    DWORD   dwErr               = NO_ERROR;

    // validate environment
    RTASSERT(pce->ulActivityCount is 0);
    RTASSERT(pce->iscStatus is IPSAMPLE_STATUS_STOPPED);

    do                          // breakout loop
    {
        pce->ulActivityCount    = 0;
        pce->dwLogLevel         = pigc->dwLoggingLevel;

        dwErr = (DWORD) WSAStartup(wVersionRequested, &wsaData);
        if (dwErr != 0)
        {
            TRACE1(CONFIGURATION, "Error %u starting windows sockets", dwErr);
            LOGERR0(WSASTARTUP_FAILED, dwErr);
            break;
        }
        bCleanupWinsock = TRUE;

        // Store of Dynamic Locks
        dwErr = InitializeDynamicLocksStore(&(pce->dlsDynamicLocksStore),
                                            GLOBAL_HEAP);
        if (dwErr != NO_ERROR)
        {
            TRACE1(CONFIGURATION, "Error %u initializing locks store", dwErr);
            LOGERR0(INIT_CRITSEC_FAILED, dwErr);
            break;
        }

        // Timer Entry
        pce->hTimerQueue = CreateTimerQueue();
        if (!pce->hTimerQueue)
        {
            dwErr = GetLastError();
            TRACE1(CONFIGURATION, "Error %u registering timer queue", dwErr);
            LOGERR0(CREATE_TIMER_QUEUE_FAILED, dwErr);
            break;
        }

        // Router Manager Information
        pce->hMgrNotificationEvent   = hMgrNotificationEvent;
        if (psfSupportFunctions)
            pce->sfSupportFunctions      = *psfSupportFunctions;

        // RTMv2 Information
        pce->reiRtmEntity.RtmInstanceId = 0;
        pce->reiRtmEntity.AddressFamily = AF_INET;
        pce->reiRtmEntity.EntityId.EntityProtocolId = PROTO_IP_SAMPLE;
        pce->reiRtmEntity.EntityId.EntityInstanceId = 0;

        dwErr = RTM_RegisterEntity(
            &pce->reiRtmEntity,     // IN   my RTM_ENTITY_INFO
            NULL,                   // IN   my exported methods
            RTM_CallbackEvent,      // IN   my callback function
            TRUE,                   // IN   reserve opaque pointer?
            &pce->rrpRtmProfile,    // OUT  my RTM_REGN_PROFILE
            &pce->hRtmHandle);      // OUT  my RTMv2 handle
        if (dwErr != NO_ERROR)
        {
            TRACE1(CONFIGURATION, "Error %u registering with RTM", dwErr);
            LOGERR0(RTM_REGISTER_FAILED, dwErr);
            break;
        }

        dwErr = RTM_RegisterForChangeNotification(
            pce->hRtmHandle,        // IN   my RTMv2 handle
            RTM_VIEW_MASK_MCAST,    // IN   route table views relevant to moi
            RTM_CHANGE_TYPE_BEST,   // IN   change types interesting to moi
            NULL,                   // IN   context in callback function
            &pce->hRtmNotificationHandle); // OUT   my notification handle
        if (dwErr != NO_ERROR)
        {
            TRACE1(CONFIGURATION,
                   "Error %u registering for change with RTM", dwErr);
            LOGERR0(RTM_REGISTER_FAILED, dwErr);
            break;
        }

        // MGM Information
        // pce->hMgmHandle (later)

        // Network Entry
        dwErr = NE_Create(&(pce->pneNetworkEntry));
        if (dwErr != NO_ERROR)
            break;

        // Global Statistics
        ZeroMemory(&(pce->igsStats), sizeof(IPSAMPLE_GLOBAL_STATS));

        pce->iscStatus = IPSAMPLE_STATUS_RUNNING;
    } while (FALSE);

    // something went wrong, cleanup
    if (dwErr != NO_ERROR)
        CE_Cleanup(pce, bCleanupWinsock);

    return dwErr;
}

DWORD DequeueEvent | ( | OUT ROUTING_PROTOCOL_EVENTS * | prpeEvent,
 |  | OUT MESSAGE * | pmMessage
 | ) |  |

Definition at line 230 of file configentry.c.

{
    DWORD           dwErr   = NO_ERROR;
    PQUEUE_ENTRY    pqe     = NULL;
    PEVENT_ENTRY    pee     = NULL;

    ACQUIRE_QUEUE_LOCK(&(g_ce.lqEventQueue));

    do                          // breakout loop
    {
        if (IsQueueEmpty(&(g_ce.lqEventQueue.head)))
        {
            dwErr = ERROR_NO_MORE_ITEMS;
            TRACE0(CONFIGURATION, "Error no events in the queue");
            LOGWARN0(EVENT_QUEUE_EMPTY, dwErr);
            break;
        }

        pqe = Dequeue(&(g_ce.lqEventQueue.head));

        pee = CONTAINING_RECORD(pqe, EVENT_ENTRY, qeEventQueueLink);
        *(prpeEvent) = pee->rpeEvent;
        *(pmMessage) = pee->mMessage;

        // created in EE_EnqueueEvent
        EE_Destroy(pee);
        pee = NULL;
    } while (FALSE);

    RELEASE_QUEUE_LOCK(&(g_ce.lqEventQueue));

    return dwErr;
}

DWORD EE_Create | ( | IN ROUTING_PROTOCOL_EVENTS | rpeEvent,
 |  | IN MESSAGE | mMessage,
 |  | OUT PEVENT_ENTRY * | ppeeEventEntry
 | ) |  |

Definition at line 71 of file configentry.c.

{
    DWORD               dwErr = NO_ERROR;
    PEVENT_ENTRY        peeEntry; // scratch

    // validate parameters
    if (!ppeeEventEntry)
        return ERROR_INVALID_PARAMETER;

    *ppeeEventEntry = NULL;

    // allocate the interface entry structure
    MALLOC(&peeEntry, sizeof(EVENT_ENTRY), &dwErr);
    if (dwErr != NO_ERROR)
        return dwErr;

    // initialize various fields
    InitializeQueueHead(&(peeEntry->qeEventQueueLink));

    peeEntry->rpeEvent = rpeEvent;
    peeEntry->mMessage = mMessage;

    *ppeeEventEntry = peeEntry;
    return dwErr;
}

DWORD EE_Destroy ( IN PEVENT_ENTRY peeEventEntry )

Definition at line 121 of file configentry.c.

{
    if (!peeEventEntry)
        return NO_ERROR;

    FREE(peeEventEntry);

    return NO_ERROR;
}

DWORD EnqueueEvent | ( | IN ROUTING_PROTOCOL_EVENTS | rpeEvent,
 |  | IN MESSAGE | mMessage
 | ) |  |

Definition at line 188 of file configentry.c.

{
    DWORD           dwErr = NO_ERROR;
    PEVENT_ENTRY    peeEntry = NULL;

    dwErr = EE_Create(rpeEvent, mMessage, &peeEntry);
    // destroyed in EE_DequeueEvent

    if (dwErr is NO_ERROR)
    {
        ACQUIRE_QUEUE_LOCK(&(g_ce.lqEventQueue));

        Enqueue(&(g_ce.lqEventQueue.head), &(peeEntry->qeEventQueueLink));

        RELEASE_QUEUE_LOCK(&(g_ce.lqEventQueue));
    }

    return dwErr;
}

Generated on Wed Nov 13 2024 16:54:02 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/ip/configentry.h File Reference

  • NetDS
  • RRas
  • ip
Classes | Defines | Typedefs | Enumerations | Functions

configentry.h File Reference

Go to the source code of this file.

Classes

struct | _CONFIGURATION_ENTRY
struct | _EVENT_ENTRY

Defines

#define | CE_Display(pce)
#define | EE_Display(peeEventEntry)

Typedefs

typedef struct _CONFIGURATION_ENTRY | CONFIGURATION_ENTRY
typedef struct _EVENT_ENTRY | EVENT_ENTRY
typedef enum _IPSAMPLE_STATUS_CODE | IPSAMPLE_STATUS_CODE
typedef struct
_CONFIGURATION_ENTRY * 		PCONFIGURATION_ENTRY
typedef struct _EVENT_ENTRY * | PEVENT_ENTRY
typedef enum
_IPSAMPLE_STATUS_CODE * 		PIPSAMPLE_STATUS_CODE

Enumerations

enum | _IPSAMPLE_STATUS_CODE { IPSAMPLE_STATUS_RUNNING = 101, IPSAMPLE_STATUS_STOPPING = 102, IPSAMPLE_STATUS_STOPPED = 103 }

Functions

DWORD | CE_Cleanup (IN PCONFIGURATION_ENTRY pce, IN BOOL bCleanupWinsock)
DWORD | CE_Create (IN PCONFIGURATION_ENTRY pce)
DWORD | CE_Destroy (IN PCONFIGURATION_ENTRY pce)
DWORD | CE_Initialize (IN PCONFIGURATION_ENTRY pce, IN HANDLE hMgrNotificationEvent, IN PSUPPORT_FUNCTIONS psfSupportFunctions, IN PIPSAMPLE_GLOBAL_CONFIG pigc)
DWORD | DequeueEvent (OUT ROUTING_PROTOCOL_EVENTS *prpeEvent, OUT MESSAGE *pmMessage)
DWORD | EE_Create (IN ROUTING_PROTOCOL_EVENTS rpeEvent, IN MESSAGE mMessage, OUT PEVENT_ENTRY *ppeeEventEntry)
DWORD | EE_Destroy (IN PEVENT_ENTRY peeEventEntry)
DWORD | EnqueueEvent (IN ROUTING_PROTOCOL_EVENTS rpeEvent, IN MESSAGE mMessage)

Define Documentation

#define CE_Display ( pce )

Definition at line 179 of file configentry.h.

#define EE_Display ( peeEventEntry )

Definition at line 50 of file configentry.h.

Typedef Documentation

typedef struct _CONFIGURATION_ENTRY CONFIGURATION_ENTRY
typedef struct _EVENT_ENTRY EVENT_ENTRY
typedef enum _IPSAMPLE_STATUS_CODE IPSAMPLE_STATUS_CODE
typedef struct _CONFIGURATION_ENTRY * PCONFIGURATION_ENTRY
typedef struct _EVENT_ENTRY * PEVENT_ENTRY
typedef enum _IPSAMPLE_STATUS_CODE * PIPSAMPLE_STATUS_CODE

Enumeration Type Documentation

enum _IPSAMPLE_STATUS_CODE
Enumerator:
IPSAMPLE_STATUS_RUNNING
IPSAMPLE_STATUS_STOPPING
IPSAMPLE_STATUS_STOPPED

Definition at line 69 of file configentry.h.

{
    IPSAMPLE_STATUS_RUNNING     = 101,
    IPSAMPLE_STATUS_STOPPING    = 102,
    IPSAMPLE_STATUS_STOPPED     = 103
} IPSAMPLE_STATUS_CODE, *PIPSAMPLE_STATUS_CODE;

Function Documentation

DWORD CE_Cleanup | ( | IN PCONFIGURATION_ENTRY | pce,
 |  | IN BOOL | bCleanupWinsock
 | ) |  |

Definition at line 621 of file configentry.c.

        : However, pce->rwlLock should NOT actually be held!  The call to
    DeleteTimerQueueEx blocks till all queued callbacks finish execution.
    These callbacks may acquire pce->rwlLock, causing deadlock.

Arguments
    pce                 pointer to the configuration entry
    bCleanupWinsock
Return Value
    NO_ERROR            always

--*/
{
    DWORD dwErr = NO_ERROR;

    // Network Entry
    NE_Destroy(pce->pneNetworkEntry);
    pce->pneNetworkEntry        = NULL;

    // MGM Information (later)
    pce->hMgmHandle = NULL;

    // RTMv2 Information
    if (pce->hRtmNotificationHandle)
    {
        dwErr = RTM_DeregisterFromChangeNotification(
            pce->hRtmHandle,
            pce->hRtmNotificationHandle);

        if (dwErr != NO_ERROR)
            TRACE1(CONFIGURATION,
                   "Error %u deregistering for change from RTM", dwErr);
    }
    pce->hRtmNotificationHandle = NULL;

    if (pce->hRtmHandle)
    {
        dwErr = RTM_DeregisterEntity(pce->hRtmHandle);

        if (dwErr != NO_ERROR)
            TRACE1(CONFIGURATION,
                   "Error %u deregistering from RTM", dwErr);
    }
    pce->hRtmHandle             = NULL;

    // Router Manager Information
    // valid till overwritten, needed to signal the ip router manager
    //     pce->hMgrNotificationEvent
    //     pce->sfSupportFunctions

    // Timer Entry
    if (pce->hTimerQueue)
        DeleteTimerQueueEx(pce->hTimerQueue, INVALID_HANDLE_VALUE);
    pce->hTimerQueue            = NULL;

    // Store of Dynamic Locks
    if (DYNAMIC_LOCKS_STORE_INITIALIZED(&(pce->dlsDynamicLocksStore)))
    {
        dwErr = DeInitializeDynamicLocksStore(&(pce->dlsDynamicLocksStore));

        // all dynamic locks should have been free
        RTASSERT(dwErr is NO_ERROR);
    }

    if (bCleanupWinsock)
        WSACleanup();

    // protocol state
    pce->iscStatus = IPSAMPLE_STATUS_STOPPED;

    return NO_ERROR;
}

DWORD CE_Create ( IN PCONFIGURATION_ENTRY pce )

Definition at line 286 of file configentry.c.

{
    DWORD dwErr = NO_ERROR;

    // initialize to default values
    ZeroMemory(pce, sizeof(CONFIGURATION_ENTRY));
    pce->dwTraceID = INVALID_TRACEID;

    do                          // breakout loop
    {
        // initialize the read-write lock
        CREATE_READ_WRITE_LOCK(&(pce->rwlLock));
        if (!READ_WRITE_LOCK_CREATED(&(pce->rwlLock)))
        {
            dwErr = GetLastError();

            TRACE1(CONFIGURATION, "Error %u creating read-write-lock", dwErr);
            LOGERR0(CREATE_RWL_FAILED, dwErr);

            break;
        }

        // initialize the global heap
        pce->hGlobalHeap = HeapCreate(0, 0, 0);
        if (pce->hGlobalHeap is NULL)
        {
            dwErr = GetLastError();
            TRACE1(CONFIGURATION, "Error %u creating global heap", dwErr);
            LOGERR0(HEAP_CREATE_FAILED, dwErr);

            break;
        }

        //
        // initialize the count of threads that are active in IPSAMPLE
        // create the semaphore released by each thread when it is done
        // required for clean stop to the protocol
        //
        pce->ulActivityCount = 0;
        pce->hActivitySemaphore = CreateSemaphore(NULL, 0, 0xfffffff, NULL);
        if (pce->hActivitySemaphore is NULL)
        {
            dwErr = GetLastError();
            TRACE1(CONFIGURATION, "Error %u creating semaphore", dwErr);
            LOGERR0(CREATE_SEMAPHORE_FAILED, dwErr);
            break;
        }

        // Logging & Tracing Information
        pce->dwLogLevel = IPSAMPLE_LOGGING_INFO;
        pce->hLogHandle = RouterLogRegister("IPSAMPLE");
        pce->dwTraceID  = TraceRegister("IPSAMPLE");

        // Event Queue
        INITIALIZE_LOCKED_QUEUE(&(pce->lqEventQueue));
        if (!LOCKED_QUEUE_INITIALIZED(&(pce->lqEventQueue)))
        {
            dwErr = GetLastError();
            TRACE1(CONFIGURATION, "Error %u initializing locked queue", dwErr);
            LOGERR0(INIT_CRITSEC_FAILED, dwErr);
            break;
        }

        // Protocol State
        pce->iscStatus = IPSAMPLE_STATUS_STOPPED;

        // Store of Dynamic Locks
        // pce->dlsDynamicLocksStore    zero'ed out

        // Timer Entry
        // pce->hTimerQueue             = NULL;

        // Router Manager Information (later)
        // pce->hMgrNotificationEvent   = NULL
        // pce->sfSupportFunctions      zero'ed out

        // RTMv2 Information
        // pce->reiRtmEntity            zero'ed out
        // pce->rrpRtmProfile           zero'ed out
        // pce->hRtmHandle              = NULL
        // pce->hRtmNotificationHandle  = NULL

        // MGM Information
        // pce->hMgmHandle              = NULL

        // Network Entry
        // pce->pneNetworkEntry         = NULL;

        // Global Statistics
        // pce->igsStats                zero'ed out

    } while (FALSE);

    if (dwErr != NO_ERROR)
    {
        // something went wrong, so cleanup.
        TRACE0(CONFIGURATION, "Failed to create configuration entry");
        CE_Destroy(pce);
    }

    return dwErr;
}

DWORD CE_Destroy ( IN PCONFIGURATION_ENTRY pce )

Definition at line 410 of file configentry.c.

{
    // Network Entry

    // MGM Information

    // RTMv2 Information

    // Router Manager Information

    // Timer Entry

    // Store of Dynamic Locks

    // protocol state should be such...
    RTASSERT(pce->iscStatus is IPSAMPLE_STATUS_STOPPED);

    // Event Queue
    if (LOCKED_QUEUE_INITIALIZED(&(pce->lqEventQueue)))
        DELETE_LOCKED_QUEUE((&(pce->lqEventQueue)), FreeEventEntry);

    // Logging & Tracing Information
    if (pce->dwTraceID != INVALID_TRACEID)
    {
        TraceDeregister(pce->dwTraceID);
        pce->dwTraceID = INVALID_TRACEID;
    }
    if (pce->hLogHandle != NULL)
    {
        RouterLogDeregister(pce->hLogHandle);
        pce->hLogHandle = NULL;
    }

    // destroy the semaphore released by each thread when it is done
    if (pce->hActivitySemaphore != NULL)
    {
        CloseHandle(pce->hActivitySemaphore);
        pce->hActivitySemaphore = NULL;
    }

    if (pce->hGlobalHeap != NULL)
    {
        HeapDestroy(pce->hGlobalHeap);
        pce->hGlobalHeap = NULL;
    }

    // delete the read-write lock
    if (READ_WRITE_LOCK_CREATED(&(pce->rwlLock)))
        DELETE_READ_WRITE_LOCK(&(pce->rwlLock));

    return NO_ERROR;
}

DWORD CE_Initialize | ( | IN PCONFIGURATION_ENTRY | pce,
 |  | IN HANDLE | hMgrNotificationEvent,
 |  | IN PSUPPORT_FUNCTIONS | psfSupportFunctions,
 |  | IN PIPSAMPLE_GLOBAL_CONFIG | pigc
 | ) |  |

Definition at line 482 of file configentry.c.

{
    WORD    wVersionRequested   = MAKEWORD(1,1);
    WSADATA wsaData;
    BOOL    bCleanupWinsock     = FALSE;

    DWORD   dwErr               = NO_ERROR;

    // validate environment
    RTASSERT(pce->ulActivityCount is 0);
    RTASSERT(pce->iscStatus is IPSAMPLE_STATUS_STOPPED);

    do                          // breakout loop
    {
        pce->ulActivityCount    = 0;
        pce->dwLogLevel         = pigc->dwLoggingLevel;

        dwErr = (DWORD) WSAStartup(wVersionRequested, &wsaData);
        if (dwErr != 0)
        {
            TRACE1(CONFIGURATION, "Error %u starting windows sockets", dwErr);
            LOGERR0(WSASTARTUP_FAILED, dwErr);
            break;
        }
        bCleanupWinsock = TRUE;

        // Store of Dynamic Locks
        dwErr = InitializeDynamicLocksStore(&(pce->dlsDynamicLocksStore),
                                            GLOBAL_HEAP);
        if (dwErr != NO_ERROR)
        {
            TRACE1(CONFIGURATION, "Error %u initializing locks store", dwErr);
            LOGERR0(INIT_CRITSEC_FAILED, dwErr);
            break;
        }

        // Timer Entry
        pce->hTimerQueue = CreateTimerQueue();
        if (!pce->hTimerQueue)
        {
            dwErr = GetLastError();
            TRACE1(CONFIGURATION, "Error %u registering timer queue", dwErr);
            LOGERR0(CREATE_TIMER_QUEUE_FAILED, dwErr);
            break;
        }

        // Router Manager Information
        pce->hMgrNotificationEvent   = hMgrNotificationEvent;
        if (psfSupportFunctions)
            pce->sfSupportFunctions      = *psfSupportFunctions;

        // RTMv2 Information
        pce->reiRtmEntity.RtmInstanceId = 0;
        pce->reiRtmEntity.AddressFamily = AF_INET;
        pce->reiRtmEntity.EntityId.EntityProtocolId = PROTO_IP_SAMPLE;
        pce->reiRtmEntity.EntityId.EntityInstanceId = 0;

        dwErr = RTM_RegisterEntity(
            &pce->reiRtmEntity,     // IN   my RTM_ENTITY_INFO
            NULL,                   // IN   my exported methods
            RTM_CallbackEvent,      // IN   my callback function
            TRUE,                   // IN   reserve opaque pointer?
            &pce->rrpRtmProfile,    // OUT  my RTM_REGN_PROFILE
            &pce->hRtmHandle);      // OUT  my RTMv2 handle
        if (dwErr != NO_ERROR)
        {
            TRACE1(CONFIGURATION, "Error %u registering with RTM", dwErr);
            LOGERR0(RTM_REGISTER_FAILED, dwErr);
            break;
        }

        dwErr = RTM_RegisterForChangeNotification(
            pce->hRtmHandle,        // IN   my RTMv2 handle
            RTM_VIEW_MASK_MCAST,    // IN   route table views relevant to moi
            RTM_CHANGE_TYPE_BEST,   // IN   change types interesting to moi
            NULL,                   // IN   context in callback function
            &pce->hRtmNotificationHandle); // OUT   my notification handle
        if (dwErr != NO_ERROR)
        {
            TRACE1(CONFIGURATION,
                   "Error %u registering for change with RTM", dwErr);
            LOGERR0(RTM_REGISTER_FAILED, dwErr);
            break;
        }

        // MGM Information
        // pce->hMgmHandle (later)

        // Network Entry
        dwErr = NE_Create(&(pce->pneNetworkEntry));
        if (dwErr != NO_ERROR)
            break;

        // Global Statistics
        ZeroMemory(&(pce->igsStats), sizeof(IPSAMPLE_GLOBAL_STATS));

        pce->iscStatus = IPSAMPLE_STATUS_RUNNING;
    } while (FALSE);

    // something went wrong, cleanup
    if (dwErr != NO_ERROR)
        CE_Cleanup(pce, bCleanupWinsock);

    return dwErr;
}

DWORD DequeueEvent | ( | OUT ROUTING_PROTOCOL_EVENTS * | prpeEvent,
 |  | OUT MESSAGE * | pmMessage
 | ) |  |

Definition at line 230 of file configentry.c.

{
    DWORD           dwErr   = NO_ERROR;
    PQUEUE_ENTRY    pqe     = NULL;
    PEVENT_ENTRY    pee     = NULL;

    ACQUIRE_QUEUE_LOCK(&(g_ce.lqEventQueue));

    do                          // breakout loop
    {
        if (IsQueueEmpty(&(g_ce.lqEventQueue.head)))
        {
            dwErr = ERROR_NO_MORE_ITEMS;
            TRACE0(CONFIGURATION, "Error no events in the queue");
            LOGWARN0(EVENT_QUEUE_EMPTY, dwErr);
            break;
        }

        pqe = Dequeue(&(g_ce.lqEventQueue.head));

        pee = CONTAINING_RECORD(pqe, EVENT_ENTRY, qeEventQueueLink);
        *(prpeEvent) = pee->rpeEvent;
        *(pmMessage) = pee->mMessage;

        // created in EE_EnqueueEvent
        EE_Destroy(pee);
        pee = NULL;
    } while (FALSE);

    RELEASE_QUEUE_LOCK(&(g_ce.lqEventQueue));

    return dwErr;
}

DWORD EE_Create | ( | IN ROUTING_PROTOCOL_EVENTS | rpeEvent,
 |  | IN MESSAGE | mMessage,
 |  | OUT PEVENT_ENTRY * | ppeeEventEntry
 | ) |  |

Definition at line 71 of file configentry.c.

{
    DWORD               dwErr = NO_ERROR;
    PEVENT_ENTRY        peeEntry; // scratch

    // validate parameters
    if (!ppeeEventEntry)
        return ERROR_INVALID_PARAMETER;

    *ppeeEventEntry = NULL;

    // allocate the interface entry structure
    MALLOC(&peeEntry, sizeof(EVENT_ENTRY), &dwErr);
    if (dwErr != NO_ERROR)
        return dwErr;

    // initialize various fields
    InitializeQueueHead(&(peeEntry->qeEventQueueLink));

    peeEntry->rpeEvent = rpeEvent;
    peeEntry->mMessage = mMessage;

    *ppeeEventEntry = peeEntry;
    return dwErr;
}

DWORD EE_Destroy ( IN PEVENT_ENTRY peeEventEntry )

Definition at line 121 of file configentry.c.

{
    if (!peeEventEntry)
        return NO_ERROR;

    FREE(peeEventEntry);

    return NO_ERROR;
}

DWORD EnqueueEvent | ( | IN ROUTING_PROTOCOL_EVENTS | rpeEvent,
 |  | IN MESSAGE | mMessage
 | ) |  |

Definition at line 188 of file configentry.c.

{
    DWORD           dwErr = NO_ERROR;
    PEVENT_ENTRY    peeEntry = NULL;

    dwErr = EE_Create(rpeEvent, mMessage, &peeEntry);
    // destroyed in EE_DequeueEvent

    if (dwErr is NO_ERROR)
    {
        ACQUIRE_QUEUE_LOCK(&(g_ce.lqEventQueue));

        Enqueue(&(g_ce.lqEventQueue.head), &(peeEntry->qeEventQueueLink));

        RELEASE_QUEUE_LOCK(&(g_ce.lqEventQueue));
    }

    return dwErr;
}

Generated on Wed Nov 13 2024 16:54:02 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/ip/configmgr.c File Reference

  • NetDS
  • RRas
  • ip
Functions | Variables

configmgr.c File Reference

#include "pchsample.h"

Go to the source code of this file.

Functions

DWORD | CM_GetEventMessage (OUT ROUTING_PROTOCOL_EVENTS *prpeEvent, OUT MESSAGE *pmMessage)
DWORD | CM_GetGlobalInfo (IN PVOID pvGlobalInfo, IN OUT PULONG pulBufferSize, OUT PULONG pulStructureVersion, OUT PULONG pulStructureSize, OUT PULONG pulStructureCount)
DWORD | CM_SetGlobalInfo (IN PVOID pvGlobalInfo)
DWORD | CM_StartProtocol (IN HANDLE hMgrNotificationEvent, IN PSUPPORT_FUNCTIONS psfSupportFunctions, IN PVOID pvGlobalInfo)
DWORD CM_StopProtocol ()
VOID | CM_WorkerFinishStopProtocol (IN PVOID pvContext)
BOOL | ValidateGlobalConfig (IN PIPSAMPLE_GLOBAL_CONFIG pigc)

Variables

CONFIGURATION_ENTRY g_ce

Function Documentation

DWORD CM_GetEventMessage | ( | OUT ROUTING_PROTOCOL_EVENTS * | prpeEvent,
 |  | OUT MESSAGE * | pmMessage
 | ) |  |

Definition at line 441 of file configmgr.c.

{
    DWORD           dwErr       = NO_ERROR;

    // NOTE: this can be called after the protocol is stopped, as in when
    // the ip router manager is retrieving the ROUTER_STOPPED message, so
    // we do not call ENTER_SAMPLE_API()/LEAVE_SAMPLE_API()

    dwErr = DequeueEvent(prpeEvent, pmMessage);

    return dwErr;
}

DWORD CM_GetGlobalInfo | ( | IN PVOID | pvGlobalInfo,
 |  | IN OUT PULONG | pulBufferSize,
 |  | OUT PULONG | pulStructureVersion,
 |  | OUT PULONG | pulStructureSize,
 |  | OUT PULONG | pulStructureCount
 | ) |  |

Definition at line 316 of file configmgr.c.

{
    DWORD                   dwErr = NO_ERROR;
    PIPSAMPLE_GLOBAL_CONFIG pigc;
    ULONG                   ulSize = sizeof(IPSAMPLE_GLOBAL_CONFIG);

    if (!ENTER_SAMPLE_API()) { return ERROR_CAN_NOT_COMPLETE; }

    do                          // breakout loop
    {
        if((*pulBufferSize < ulSize) or (pvGlobalInfo is NULL))
        {
            // either the size was too small or there was no storage
            dwErr = ERROR_INSUFFICIENT_BUFFER;
            TRACE1(CONFIGURATION,
                   "CM_GetGlobalInfo: *ulBufferSize %u",
                   *pulBufferSize);

            *pulBufferSize = ulSize;

            break;
        }

        *pulBufferSize = ulSize;

        if (pulStructureVersion)    *pulStructureVersion    = 1;
        if (pulStructureSize)       *pulStructureSize       = ulSize;
        if (pulStructureCount)      *pulStructureCount      = 1;

        // so we have a good buffer to write our info into...
        pigc = (PIPSAMPLE_GLOBAL_CONFIG) pvGlobalInfo;

        // copy out the global configuration
        ACQUIRE_READ_LOCK(&(g_ce.rwlLock));

        pigc->dwLoggingLevel = g_ce.dwLogLevel;

        RELEASE_READ_LOCK(&(g_ce.rwlLock));
    } while (FALSE);

    LEAVE_SAMPLE_API();

    return dwErr;
}

DWORD CM_SetGlobalInfo ( IN PVOID pvGlobalInfo )

Definition at line 390 of file configmgr.c.

{
    DWORD                   dwErr = NO_ERROR;
    PIPSAMPLE_GLOBAL_CONFIG pigc;

    if (!ENTER_SAMPLE_API()) { return ERROR_CAN_NOT_COMPLETE; }

    do                          // breakout loop
    {
        pigc = (PIPSAMPLE_GLOBAL_CONFIG) pvGlobalInfo;

        if (!ValidateGlobalConfig(pigc))
        {
            dwErr = ERROR_INVALID_PARAMETER;
            break;
        }

        // copy in the global configuration
        ACQUIRE_WRITE_LOCK(&(g_ce.rwlLock));

        g_ce.dwLogLevel = pigc->dwLoggingLevel;

        RELEASE_WRITE_LOCK(&(g_ce.rwlLock));
    } while (FALSE);

    LEAVE_SAMPLE_API();

    return dwErr;
}

DWORD CM_StartProtocol | ( | IN HANDLE | hMgrNotificationEvent,
 |  | IN PSUPPORT_FUNCTIONS | psfSupportFunctions,
 |  | IN PVOID | pvGlobalInfo
 | ) |  |

Definition at line 167 of file configmgr.c.

{
    DWORD dwErr = NO_ERROR;

    // NOTE: since this is called when SAMPLE is stopped, there is no need
    // for it to use ENTER_SAMPLE_API()/LEAVE_SAMPLE_API()

    ACQUIRE_WRITE_LOCK(&(g_ce.rwlLock));

    do                          // breakout loop
    {
        if (g_ce.iscStatus != IPSAMPLE_STATUS_STOPPED)
        {
            TRACE0(CONFIGURATION, "Error ip sample already installed");
            LOGWARN0(SAMPLE_ALREADY_STARTED, NO_ERROR);
            dwErr = ERROR_CAN_NOT_COMPLETE;

            break;
        }

        if (!ValidateGlobalConfig((PIPSAMPLE_GLOBAL_CONFIG) pvGlobalInfo))
        {
            dwErr = ERROR_INVALID_PARAMETER;
            break;
        }

        dwErr = CE_Initialize(&g_ce,
                              hMgrNotificationEvent,
                              psfSupportFunctions,
                              (PIPSAMPLE_GLOBAL_CONFIG) pvGlobalInfo);
    } while (FALSE);

    RELEASE_WRITE_LOCK(&(g_ce.rwlLock));

    if (dwErr is NO_ERROR)
    {
        TRACE0(CONFIGURATION, "ip sample has successfully started");
        LOGINFO0(SAMPLE_STARTED, dwErr);
    }
    else
    {
        TRACE1(CONFIGURATION, "Error ip sample failed to start", dwErr);
        LOGERR0(SAMPLE_START_FAILED, dwErr);
    }

    return dwErr;
}

DWORD CM_StopProtocol ( )

Definition at line 240 of file configmgr.c.

{
    DWORD dwErr         = NO_ERROR;
    BOOL  bSuccess      = FALSE;
    ULONG ulThreadCount = 0;

    // NOTE: no need to use ENTER_SAMPLE_API()/LEAVE_SAMPLE_API()
    // Does not use QueueSampleWorker

    ACQUIRE_WRITE_LOCK(&(g_ce.rwlLock));

    do                          // breakout loop
    {
        // cannot stop if already stopped
        if (g_ce.iscStatus != IPSAMPLE_STATUS_RUNNING)
        {
            TRACE0(CONFIGURATION, "Error ip sample already stopped");
            LOGWARN0(SAMPLE_ALREADY_STOPPED, NO_ERROR);
            dwErr = ERROR_CAN_NOT_COMPLETE;

            break;
        }

        // set IPSAMPLE's status to STOPPING; this prevents any more
        // work-items from being queued, and it prevents the ones already
        // queued from executing
        g_ce.iscStatus = IPSAMPLE_STATUS_STOPPING;

        // find out how many threads are either queued or active in SAMPLE;
        // we will have to wait for this many threads to exit before we
        // clean up SAMPLE's resources
        ulThreadCount = g_ce.ulActivityCount;
        TRACE1(CONFIGURATION,
               "%u threads are active in SAMPLE", ulThreadCount);
    } while (FALSE);

    RELEASE_WRITE_LOCK(&(g_ce.rwlLock));

    if (dwErr is NO_ERROR)
    {
        bSuccess = QueueUserWorkItem(
            (LPTHREAD_START_ROUTINE)CM_WorkerFinishStopProtocol,
            (PVOID) ulThreadCount,
            0); // no flags

        dwErr = (bSuccess) ? ERROR_PROTOCOL_STOP_PENDING : GetLastError();
    }

    return dwErr;
}

VOID CM_WorkerFinishStopProtocol ( IN PVOID pvContext )

Definition at line 97 of file configmgr.c.

{
    DWORD           dwErr = NO_ERROR;
    MESSAGE         mMessage;

    ULONG           ulThreadCount = 0;

    ulThreadCount = (ULONG)pvContext;

    TRACE1(ENTER, "Entering WorkerFinishStopProtocol: active threads %u",
           ulThreadCount);

    // NOTE: since this is called while the router is stopping, there is no
    // need for it to use ENTER_SAMPLE_WORKER()/LEAVE_SAMPLE_WORKER()

    // waits for all threads to stop
    while (ulThreadCount-- > 0)
        WaitForSingleObject(g_ce.hActivitySemaphore, INFINITE);

   // acquire the lock and release it, just to be sure that all threads
   // have quit their calls to LeaveSampleWorker()

    ACQUIRE_WRITE_LOCK(&(g_ce.rwlLock));
    RELEASE_WRITE_LOCK(&(g_ce.rwlLock));

    // NOTE: there is no need to acquire g_ce.rwlLock for the call to
    // CE_Cleanup since there are no threads competing for access to the
    // fields being cleaned up.  new competing threads aren't created till
    // CE_Cleanup sets the protocol state to IPSAMPLE_STATUS_STOPPED, which
    // is the last thing it does.

    CE_Cleanup(&g_ce, TRUE);

    LOGINFO0(SAMPLE_STOPPED, NO_ERROR);

    // inform router manager that we are done
    ZeroMemory(&mMessage, sizeof(MESSAGE));
    if (EnqueueEvent(ROUTER_STOPPED, mMessage) is NO_ERROR)
        SetEvent(g_ce.hMgrNotificationEvent);

    TRACE0(LEAVE, "Leaving  WorkerFinishStopProtocol");
}

BOOL ValidateGlobalConfig ( IN PIPSAMPLE_GLOBAL_CONFIG pigc )

Definition at line 28 of file configmgr.c.

{
    DWORD dwErr = NO_ERROR;

    do                          // breakout loop
    {
        if (pigc is NULL)
        {
            dwErr = ERROR_INVALID_PARAMETER;
            TRACE0(CONFIGURATION, "Error null global config");

            break;
        }

        //
        // check range of each field
        //

        // ensure that the logging level is within bounds
        if((pigc->dwLoggingLevel < IPSAMPLE_LOGGING_NONE) or
           (pigc->dwLoggingLevel > IPSAMPLE_LOGGING_INFO))
        {
            dwErr = ERROR_INVALID_PARAMETER;
            TRACE0(CONFIGURATION, "Error log level out of range");

            break;
        }

        // add more here...

    } while (FALSE);

    if (!(dwErr is NO_ERROR))
    {
        TRACE0(CONFIGURATION, "Error corrupt global config");
        LOGERR0(CORRUPT_GLOBAL_CONFIG, dwErr);

        return FALSE;
    }

    return TRUE;
}

Variable Documentation

CONFIGURATION_ENTRY g_ce

Definition at line 21 of file configmgr.c.

Generated on Wed Nov 13 2024 16:54:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/ip/configmgr.h File Reference

  • NetDS
  • RRas
  • ip
Functions | Variables

configmgr.h File Reference

Go to the source code of this file.

Functions

DWORD | CM_GetEventMessage (OUT ROUTING_PROTOCOL_EVENTS *prpeEvent, OUT MESSAGE *pmMessage)
DWORD | CM_GetGlobalInfo (IN PVOID pvGlobalInfo, IN OUT PULONG pulBufferSize, OUT PULONG pulStructureVersion, OUT PULONG pulStructureSize, OUT PULONG pulStructureCount)
DWORD | CM_SetGlobalInfo (IN PVOID pvGlobalInfo)
DWORD | CM_StartProtocol (IN HANDLE hMgrNotificationEvent, IN PSUPPORT_FUNCTIONS psfSupportFunctions, IN PVOID pvGlobalInfo)
DWORD CM_StopProtocol ()

Variables

CONFIGURATION_ENTRY g_ce

Function Documentation

DWORD CM_GetEventMessage | ( | OUT ROUTING_PROTOCOL_EVENTS * | prpeEvent,
 |  | OUT MESSAGE * | pmMessage
 | ) |  |

Definition at line 441 of file configmgr.c.

{
    DWORD           dwErr       = NO_ERROR;

    // NOTE: this can be called after the protocol is stopped, as in when
    // the ip router manager is retrieving the ROUTER_STOPPED message, so
    // we do not call ENTER_SAMPLE_API()/LEAVE_SAMPLE_API()

    dwErr = DequeueEvent(prpeEvent, pmMessage);

    return dwErr;
}

DWORD CM_GetGlobalInfo | ( | IN PVOID | pvGlobalInfo,
 |  | IN OUT PULONG | pulBufferSize,
 |  | OUT PULONG | pulStructureVersion,
 |  | OUT PULONG | pulStructureSize,
 |  | OUT PULONG | pulStructureCount
 | ) |  |

Definition at line 316 of file configmgr.c.

{
    DWORD                   dwErr = NO_ERROR;
    PIPSAMPLE_GLOBAL_CONFIG pigc;
    ULONG                   ulSize = sizeof(IPSAMPLE_GLOBAL_CONFIG);

    if (!ENTER_SAMPLE_API()) { return ERROR_CAN_NOT_COMPLETE; }

    do                          // breakout loop
    {
        if((*pulBufferSize < ulSize) or (pvGlobalInfo is NULL))
        {
            // either the size was too small or there was no storage
            dwErr = ERROR_INSUFFICIENT_BUFFER;
            TRACE1(CONFIGURATION,
                   "CM_GetGlobalInfo: *ulBufferSize %u",
                   *pulBufferSize);

            *pulBufferSize = ulSize;

            break;
        }

        *pulBufferSize = ulSize;

        if (pulStructureVersion)    *pulStructureVersion    = 1;
        if (pulStructureSize)       *pulStructureSize       = ulSize;
        if (pulStructureCount)      *pulStructureCount      = 1;

        // so we have a good buffer to write our info into...
        pigc = (PIPSAMPLE_GLOBAL_CONFIG) pvGlobalInfo;

        // copy out the global configuration
        ACQUIRE_READ_LOCK(&(g_ce.rwlLock));

        pigc->dwLoggingLevel = g_ce.dwLogLevel;

        RELEASE_READ_LOCK(&(g_ce.rwlLock));
    } while (FALSE);

    LEAVE_SAMPLE_API();

    return dwErr;
}

DWORD CM_SetGlobalInfo ( IN PVOID pvGlobalInfo )

Definition at line 390 of file configmgr.c.

{
    DWORD                   dwErr = NO_ERROR;
    PIPSAMPLE_GLOBAL_CONFIG pigc;

    if (!ENTER_SAMPLE_API()) { return ERROR_CAN_NOT_COMPLETE; }

    do                          // breakout loop
    {
        pigc = (PIPSAMPLE_GLOBAL_CONFIG) pvGlobalInfo;

        if (!ValidateGlobalConfig(pigc))
        {
            dwErr = ERROR_INVALID_PARAMETER;
            break;
        }

        // copy in the global configuration
        ACQUIRE_WRITE_LOCK(&(g_ce.rwlLock));

        g_ce.dwLogLevel = pigc->dwLoggingLevel;

        RELEASE_WRITE_LOCK(&(g_ce.rwlLock));
    } while (FALSE);

    LEAVE_SAMPLE_API();

    return dwErr;
}

DWORD CM_StartProtocol | ( | IN HANDLE | hMgrNotificationEvent,
 |  | IN PSUPPORT_FUNCTIONS | psfSupportFunctions,
 |  | IN PVOID | pvGlobalInfo
 | ) |  |

Definition at line 167 of file configmgr.c.

{
    DWORD dwErr = NO_ERROR;

    // NOTE: since this is called when SAMPLE is stopped, there is no need
    // for it to use ENTER_SAMPLE_API()/LEAVE_SAMPLE_API()

    ACQUIRE_WRITE_LOCK(&(g_ce.rwlLock));

    do                          // breakout loop
    {
        if (g_ce.iscStatus != IPSAMPLE_STATUS_STOPPED)
        {
            TRACE0(CONFIGURATION, "Error ip sample already installed");
            LOGWARN0(SAMPLE_ALREADY_STARTED, NO_ERROR);
            dwErr = ERROR_CAN_NOT_COMPLETE;

            break;
        }

        if (!ValidateGlobalConfig((PIPSAMPLE_GLOBAL_CONFIG) pvGlobalInfo))
        {
            dwErr = ERROR_INVALID_PARAMETER;
            break;
        }

        dwErr = CE_Initialize(&g_ce,
                              hMgrNotificationEvent,
                              psfSupportFunctions,
                              (PIPSAMPLE_GLOBAL_CONFIG) pvGlobalInfo);
    } while (FALSE);

    RELEASE_WRITE_LOCK(&(g_ce.rwlLock));

    if (dwErr is NO_ERROR)
    {
        TRACE0(CONFIGURATION, "ip sample has successfully started");
        LOGINFO0(SAMPLE_STARTED, dwErr);
    }
    else
    {
        TRACE1(CONFIGURATION, "Error ip sample failed to start", dwErr);
        LOGERR0(SAMPLE_START_FAILED, dwErr);
    }

    return dwErr;
}

DWORD CM_StopProtocol ( )

Definition at line 240 of file configmgr.c.

{
    DWORD dwErr         = NO_ERROR;
    BOOL  bSuccess      = FALSE;
    ULONG ulThreadCount = 0;

    // NOTE: no need to use ENTER_SAMPLE_API()/LEAVE_SAMPLE_API()
    // Does not use QueueSampleWorker

    ACQUIRE_WRITE_LOCK(&(g_ce.rwlLock));

    do                          // breakout loop
    {
        // cannot stop if already stopped
        if (g_ce.iscStatus != IPSAMPLE_STATUS_RUNNING)
        {
            TRACE0(CONFIGURATION, "Error ip sample already stopped");
            LOGWARN0(SAMPLE_ALREADY_STOPPED, NO_ERROR);
            dwErr = ERROR_CAN_NOT_COMPLETE;

            break;
        }

        // set IPSAMPLE's status to STOPPING; this prevents any more
        // work-items from being queued, and it prevents the ones already
        // queued from executing
        g_ce.iscStatus = IPSAMPLE_STATUS_STOPPING;

        // find out how many threads are either queued or active in SAMPLE;
        // we will have to wait for this many threads to exit before we
        // clean up SAMPLE's resources
        ulThreadCount = g_ce.ulActivityCount;
        TRACE1(CONFIGURATION,
               "%u threads are active in SAMPLE", ulThreadCount);
    } while (FALSE);

    RELEASE_WRITE_LOCK(&(g_ce.rwlLock));

    if (dwErr is NO_ERROR)
    {
        bSuccess = QueueUserWorkItem(
            (LPTHREAD_START_ROUTINE)CM_WorkerFinishStopProtocol,
            (PVOID) ulThreadCount,
            0); // no flags

        dwErr = (bSuccess) ? ERROR_PROTOCOL_STOP_PENDING : GetLastError();
    }

    return dwErr;
}

Variable Documentation

CONFIGURATION_ENTRY g_ce

Definition at line 21 of file configmgr.c.

Generated on Wed Nov 13 2024 16:54:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/ip/defs.h File Reference

  • NetDS
  • RRas
  • ip
Defines | Typedefs

defs.h File Reference

Go to the source code of this file.

Defines

#define | ACQUIRE_READ_DLOCK(pLock) AcquireDynamicReadwriteLock(&pLock, READ_MODE, LOCKSTORE)
#define | ACQUIRE_WRITE_DLOCK(pLock) AcquireDynamicReadwriteLock(&pLock, WRITE_MODE, LOCKSTORE)
#define | and &&
#define | CREATE_TIMER(phHandle, pfnCallback, pvContext, ulWhen, pdwErr)
#define | DELETE_TIMER(hHandle, pdwErr)
#define | ENTER_SAMPLE_API() EnterSampleAPI()
#define | ENTER_SAMPLE_WORKER() EnterSampleWorker()
#define | FREE(ptr)
#define | FREE_NOT_NULL(ptr)
#define | GLOBAL_HEAP g_ce.hGlobalHeap
#define | INET_NTOA(x) (inet_ntoa(*(struct in_addr*)&(x)))
#define | INFINITE_INTERVAL 0x7fffffff
#define | INTERFACE_TABLE_BUCKETS 29
#define | IP_ASSIGN(pip, ip) *(pip) = (ip)
#define | IP_COMPARE(a, b)
#define | IP_HIGHEST 0xffffffff
#define | IP_LOWEST 0x00000000
#define | IP_VALID(ip) (IP_COMPARE(ip, IP_HIGHEST) is -1)
#define | IPSAMPLE_TRACE_ANY ((DWORD)0xFFFF0000 | TRACE_USE_MASK)
#define | IPSAMPLE_TRACE_CONFIGURATION ((DWORD)0x00100000 | TRACE_USE_MASK)
#define | IPSAMPLE_TRACE_DEBUG ((DWORD)0x00040000 | TRACE_USE_MASK)
#define | IPSAMPLE_TRACE_ENTER ((DWORD)0x00010000 | TRACE_USE_MASK)
#define | IPSAMPLE_TRACE_LEAVE ((DWORD)0x00020000 | TRACE_USE_MASK)
#define | IPSAMPLE_TRACE_MIB ((DWORD)0x01000000 | TRACE_USE_MASK)
#define | IPSAMPLE_TRACE_NETWORK ((DWORD)0x00200000 | TRACE_USE_MASK)
#define | IPSAMPLE_TRACE_PACKET ((DWORD)0x00400000 | TRACE_USE_MASK)
#define | IPSAMPLE_TRACE_TIMER ((DWORD)0x00800000 | TRACE_USE_MASK)
#define | is ==
#define | LEAVE_SAMPLE_API() LeaveSampleWorker()
#define | LEAVE_SAMPLE_WORKER() LeaveSampleWorker()
#define | LOCKSTORE g_ce.dlsDynamicLocksStore
#define | LOGERR RouterLogError
#define | LOGERR0(msg, err)
#define | LOGERR1(msg, a, err)
#define | LOGERR2(msg, a, b, err)
#define | LOGERR3(msg, a, b, c, err)
#define | LOGERR4(msg, a, b, c, d, err)
#define | LOGHANDLE g_ce.hLogHandle
#define | LOGINFO RouterLogInformation
#define | LOGINFO0(msg, err)
#define | LOGINFO1(msg, a, err)
#define | LOGINFO2(msg, a, b, err)
#define | LOGINFO3(msg, a, b, c, err)
#define | LOGINFO4(msg, a, b, c, d, err)
#define | LOGLEVEL g_ce.dwLogLevel
#define | LOGWARN RouterLogWarning
#define | LOGWARN0(msg, err)
#define | LOGWARN1(msg, a, err)
#define | LOGWARN2(msg, a, b, err)
#define | LOGWARN3(msg, a, b, c, err)
#define | LOGWARN4(msg, a, b, c, d, err)
#define | LOGWARNDATA RouterLogWarningData
#define | LOGWARNDATA2(msg, a, b, dw, buf)
#define | MALLOC(ppPointer, ulSize, pdwErr)
#define | MAX(a, b) (((a) >= (b)) ? (a) : (b))
#define | MAX_PACKET_LENGTH 512
#define | MIN(a, b) (((a) <= (b)) ? (a) : (b))
#define | NOW 0
#define | or ||
#define | PERIODIC_INTERVAL 5
#define | REALLOC(ptr, size) HeapReAlloc(GLOBAL_HEAP, 0, ptr, size)
#define | RELEASE_READ_DLOCK(pLock) ReleaseDynamicReadwriteLock(pLock, READ_MODE, LOCKSTORE)
#define | RELEASE_WRITE_DLOCK(pLock) ReleaseDynamicReadwriteLock(pLock, WRITE_MODE, LOCKSTORE)
#define | RESTART_TIMER(hHandle, ulWhen, pdwErr)
#define | SECTOMILLISEC(x) ((x) * 1000)
#define | STAR 0x00000000
#define | TRACE0(l, a)
#define | TRACE1(l, a, b)
#define | TRACE2(l, a, b, c)
#define | TRACE3(l, a, b, c, d)
#define | TRACE4(l, a, b, c, d, e)
#define | TRACE5(l, a, b, c, d, e, f)
#define | TRACEID g_ce.dwTraceID

Typedefs

typedef DWORD | IPADDRESS
typedef DWORD * | PIPADDRESS

Define Documentation

#define ACQUIRE_READ_DLOCK ( pLock ) AcquireDynamicReadwriteLock(&pLock, READ_MODE, LOCKSTORE)

Definition at line 59 of file defs.h.

#define ACQUIRE_WRITE_DLOCK ( pLock ) AcquireDynamicReadwriteLock(&pLock, WRITE_MODE, LOCKSTORE)

Definition at line 63 of file defs.h.

#define and &&

Definition at line 41 of file defs.h.

#define CREATE_TIMER | ( | phHandle,
 |  | pfnCallback,
 |  | pvContext,
 |  | ulWhen,
 |  | pdwErr
 | ) |
Value:
{                                                                           \
    if (CreateTimerQueueTimer((phHandle),                                   \
                              g_ce.hTimerQueue,                             \
                              (pfnCallback),                                \
                              (pvContext),                                  \
                              SECTOMILLISEC(ulWhen),                        \
                              INFINITE_INTERVAL,                            \
                              0))                                           \
    {                                                                       \
        *(pdwErr) = NO_ERROR;                                               \
    }                                                                       \
    else                                                                    \
    {                                                                       \
        *(pdwErr) = GetLastError();                                         \
        TRACE1(ANY, "Error %u creating timer", *(pdwErr));                  \
        LOGERR0(CREATE_TIMER_FAILED, *(pdwErr));                            \
    }                                                                       \
}

Definition at line 111 of file defs.h.

#define DELETE_TIMER | ( | hHandle,
 |  | pdwErr
 | ) |
Value:
{                                                                           \
    if (DeleteTimerQueueTimer(g_ce.hTimerQueue,                             \
                              (hHandle),                                    \
                              NULL))                                        \
    {                                                                       \
        *(pdwErr) = NO_ERROR;                                               \
    }                                                                       \
    else                                                                    \
    {                                                                       \
        *(pdwErr) = GetLastError();                                         \
        TRACE1(ANY, "Error %u deleting timer, continuing...", *(pdwErr));   \
    }                                                                       \
}

Definition at line 133 of file defs.h.

#define ENTER_SAMPLE_API ( ) EnterSampleAPI()

Definition at line 51 of file defs.h.

#define ENTER_SAMPLE_WORKER ( ) EnterSampleWorker()

Definition at line 52 of file defs.h.

#define FREE ( ptr )
Value:
{                                                           \
     HeapFree(GLOBAL_HEAP, 0, (ptr));                       \
     (ptr) = NULL;                                          \
}

Definition at line 183 of file defs.h.

#define FREE_NOT_NULL ( ptr )
Value:
{                                                           \
     if (!(ptr)) HeapFree(GLOBAL_HEAP, 0, (ptr));           \
     (ptr) = NULL;                                          \
}

Definition at line 189 of file defs.h.

#define GLOBAL_HEAP g_ce.hGlobalHeap

Definition at line 44 of file defs.h.

#define INET_NTOA ( x ) (inet_ntoa(*(struct in_addr*)&(x)))

Definition at line 103 of file defs.h.

#define INFINITE_INTERVAL 0x7fffffff

Definition at line 31 of file defs.h.

#define INTERFACE_TABLE_BUCKETS 29

Definition at line 28 of file defs.h.

#define IP_ASSIGN | ( | pip,
 |  | ip |
 | ) |  | *(pip) = (ip)

Definition at line 97 of file defs.h.

#define IP_COMPARE | ( | a,
 |  | b
 | ) |
Value:
(((a) < (b)) ? -1       \
                                                 : (((a) is (b)) ? 0 : 1))

Definition at line 93 of file defs.h.

#define IP_HIGHEST 0xffffffff

Definition at line 86 of file defs.h.

#define IP_LOWEST 0x00000000

Definition at line 85 of file defs.h.

#define IP_VALID ( ip ) (IP_COMPARE(ip, IP_HIGHEST) is -1)

Definition at line 100 of file defs.h.

#define IPSAMPLE_TRACE_ANY ((DWORD)0xFFFF0000 | TRACE_USE_MASK)

Definition at line 200 of file defs.h.

#define IPSAMPLE_TRACE_CONFIGURATION ((DWORD)0x00100000 | TRACE_USE_MASK)

Definition at line 204 of file defs.h.

#define IPSAMPLE_TRACE_DEBUG ((DWORD)0x00040000 | TRACE_USE_MASK)

Definition at line 203 of file defs.h.

#define IPSAMPLE_TRACE_ENTER ((DWORD)0x00010000 | TRACE_USE_MASK)

Definition at line 201 of file defs.h.

#define IPSAMPLE_TRACE_LEAVE ((DWORD)0x00020000 | TRACE_USE_MASK)

Definition at line 202 of file defs.h.

#define IPSAMPLE_TRACE_MIB ((DWORD)0x01000000 | TRACE_USE_MASK)

Definition at line 208 of file defs.h.

#define IPSAMPLE_TRACE_NETWORK ((DWORD)0x00200000 | TRACE_USE_MASK)

Definition at line 205 of file defs.h.

#define IPSAMPLE_TRACE_PACKET ((DWORD)0x00400000 | TRACE_USE_MASK)

Definition at line 206 of file defs.h.

#define IPSAMPLE_TRACE_TIMER ((DWORD)0x00800000 | TRACE_USE_MASK)

Definition at line 207 of file defs.h.

#define is ==

Definition at line 40 of file defs.h.

#define LEAVE_SAMPLE_API ( ) LeaveSampleWorker()

Definition at line 55 of file defs.h.

#define LEAVE_SAMPLE_WORKER ( ) LeaveSampleWorker()

Definition at line 56 of file defs.h.

#define LOCKSTORE g_ce.dlsDynamicLocksStore

Definition at line 48 of file defs.h.

#define LOGERR RouterLogError

Definition at line 236 of file defs.h.

#define LOGERR0 | ( | msg,
 |  | err
 | ) |
Value:
if (LOGLEVEL >= IPSAMPLE_LOGGING_ERROR)                         \
            LOGERR(LOGHANDLE,IPSAMPLELOG_ ## msg,0,NULL,(err))

Definition at line 245 of file defs.h.

#define LOGERR1 | ( | msg,
 |  | a,
 |  | err
 | ) |
Value:
if (LOGLEVEL >= IPSAMPLE_LOGGING_ERROR)                         \
            LOGERR(LOGHANDLE,IPSAMPLELOG_ ## msg,1,&(a),(err))

Definition at line 248 of file defs.h.

#define LOGERR2 | ( | msg,
 |  | a,
 |  | b,
 |  | err
 | ) |
Value:
if (LOGLEVEL >= IPSAMPLE_LOGGING_ERROR) {                       \
            LPSTR _asz[2] = { (a), (b) };                               \
            LOGERR(LOGHANDLE,IPSAMPLELOG_ ## msg,2,_asz,(err));         \
        }

Definition at line 251 of file defs.h.

#define LOGERR3 | ( | msg,
 |  | a,
 |  | b,
 |  | c,
 |  | err
 | ) |
Value:
if (LOGLEVEL >= IPSAMPLE_LOGGING_ERROR) {                       \
            LPSTR _asz[3] = { (a), (b), (c) };                          \
            LOGERR(LOGHANDLE,IPSAMPLELOG_ ## msg,3,_asz,(err));         \
        }

Definition at line 256 of file defs.h.

#define LOGERR4 | ( | msg,
 |  | a,
 |  | b,
 |  | c,
 |  | d,
 |  | err
 | ) |
Value:
if (LOGLEVEL >= IPSAMPLE_LOGGING_ERROR) {                       \
            LPSTR _asz[4] = { (a), (b), (c), (d) };                     \
            LOGERR(LOGHANDLE,IPSAMPLELOG_ ## msg,4,_asz,(err));         \
        }

Definition at line 261 of file defs.h.

#define LOGHANDLE g_ce.hLogHandle

Definition at line 47 of file defs.h.

#define LOGINFO RouterLogInformation

Definition at line 238 of file defs.h.

#define LOGINFO0 | ( | msg,
 |  | err
 | ) |
Value:
if (LOGLEVEL >= IPSAMPLE_LOGGING_INFO)                          \
            LOGINFO(LOGHANDLE,IPSAMPLELOG_ ## msg,0,NULL,(err))

Definition at line 297 of file defs.h.

#define LOGINFO1 | ( | msg,
 |  | a,
 |  | err
 | ) |
Value:
if (LOGLEVEL >= IPSAMPLE_LOGGING_INFO)                          \
            LOGINFO(LOGHANDLE,IPSAMPLELOG_ ## msg,1,&(a),(err))

Definition at line 300 of file defs.h.

#define LOGINFO2 | ( | msg,
 |  | a,
 |  | b,
 |  | err
 | ) |
Value:
if (LOGLEVEL >= IPSAMPLE_LOGGING_INFO) {                        \
            LPSTR _asz[2] = { (a), (b) };                               \
            LOGINFO(LOGHANDLE,IPSAMPLELOG_ ## msg,2,_asz,(err));        \
        }

Definition at line 303 of file defs.h.

#define LOGINFO3 | ( | msg,
 |  | a,
 |  | b,
 |  | c,
 |  | err
 | ) |
Value:
if (LOGLEVEL >= IPSAMPLE_LOGGING_INFO) {                        \
            LPSTR _asz[3] = { (a), (b), (c) };                          \
            LOGINFO(LOGHANDLE,IPSAMPLELOG_ ## msg,3,_asz,(err));        \
        }

Definition at line 308 of file defs.h.

#define LOGINFO4 | ( | msg,
 |  | a,
 |  | b,
 |  | c,
 |  | d,
 |  | err
 | ) |
Value:
if (LOGLEVEL >= IPSAMPLE_LOGGING_INFO) {                        \
            LPSTR _asz[4] = { (a), (b), (c), (d) };                     \
            LOGINFO(LOGHANDLE,IPSAMPLELOG_ ## msg,4,_asz,(err));        \
        }

Definition at line 313 of file defs.h.

#define LOGLEVEL g_ce.dwLogLevel

Definition at line 46 of file defs.h.

#define LOGWARN RouterLogWarning

Definition at line 237 of file defs.h.

#define LOGWARN0 | ( | msg,
 |  | err
 | ) |
Value:
if (LOGLEVEL >= IPSAMPLE_LOGGING_WARN)                          \
            LOGWARN(LOGHANDLE,IPSAMPLELOG_ ## msg,0,NULL,(err))

Definition at line 268 of file defs.h.

#define LOGWARN1 | ( | msg,
 |  | a,
 |  | err
 | ) |
Value:
if (LOGLEVEL >= IPSAMPLE_LOGGING_WARN)                          \
            LOGWARN(LOGHANDLE,IPSAMPLELOG_ ## msg,1,&(a),(err))

Definition at line 271 of file defs.h.

#define LOGWARN2 | ( | msg,
 |  | a,
 |  | b,
 |  | err
 | ) |
Value:
if (LOGLEVEL >= IPSAMPLE_LOGGING_WARN) {                        \
            LPSTR _asz[2] = { (a), (b) };                               \
            LOGWARN(LOGHANDLE,IPSAMPLELOG_ ## msg,2,_asz,(err));        \
        }

Definition at line 274 of file defs.h.

#define LOGWARN3 | ( | msg,
 |  | a,
 |  | b,
 |  | c,
 |  | err
 | ) |
Value:
if (LOGLEVEL >= IPSAMPLE_LOGGING_WARN) {                        \
            LPSTR _asz[3] = { (a), (b), (c) };                          \
            LOGWARN(LOGHANDLE,IPSAMPLELOG_ ## msg,3,_asz,(err));        \
        }

Definition at line 279 of file defs.h.

#define LOGWARN4 | ( | msg,
 |  | a,
 |  | b,
 |  | c,
 |  | d,
 |  | err
 | ) |
Value:
if (LOGLEVEL >= IPSAMPLE_LOGGING_WARN) {                        \
            LPSTR _asz[4] = { (a), (b), (c), (d) };                     \
            LOGWARN(LOGHANDLE,IPSAMPLELOG_ ## msg,4,_asz,(err));        \
        }

Definition at line 284 of file defs.h.

#define LOGWARNDATA RouterLogWarningData

Definition at line 239 of file defs.h.

#define LOGWARNDATA2 | ( | msg,
 |  | a,
 |  | b,
 |  | dw,
 |  | buf
 | ) |
Value:
if (LOGLEVEL >= IPSAMPLE_LOGGING_WARN) {                        \
            LPSTR _asz[2] = { (a), (b) };                               \
            LOGWARNDATA(LOGHANDLE,IPSAMPLELOG_ ## msg,2,_asz,(dw),(buf)); \
        }

Definition at line 290 of file defs.h.

#define MALLOC | ( | ppPointer,
 |  | ulSize,
 |  | pdwErr
 | ) |
Value:
{                                                                           \
    if (*(ppPointer) = HeapAlloc(GLOBAL_HEAP, HEAP_ZERO_MEMORY, (ulSize)))  \
    {                                                                       \
        *(pdwErr) = NO_ERROR;                                               \
    }                                                                       \
    else                                                                    \
    {                                                                       \
        *(pdwErr) = ERROR_NOT_ENOUGH_MEMORY;                                \
        TRACE1(ANY, "Error allocating %u bytes", (ulSize));                 \
        LOGERR0(HEAP_ALLOC_FAILED, *(pdwErr));                              \
    }                                                                       \
}

Definition at line 169 of file defs.h.

#define MAX | ( | a,
 |  | b |
 | ) |  | (((a) >= (b)) ? (a) : (b))

Definition at line 73 of file defs.h.

#define MAX_PACKET_LENGTH 512

Definition at line 34 of file defs.h.

#define MIN | ( | a,
 |  | b |
 | ) |  | (((a) <= (b)) ? (a) : (b))

Definition at line 74 of file defs.h.

#define NOW 0

Definition at line 30 of file defs.h.

#define or ||

Definition at line 42 of file defs.h.

#define PERIODIC_INTERVAL 5

Definition at line 32 of file defs.h.

#define REALLOC | ( | ptr,
 |  | size |
 | ) |  | HeapReAlloc(GLOBAL_HEAP, 0, ptr, size)

Definition at line 182 of file defs.h.

#define RELEASE_READ_DLOCK ( pLock ) ReleaseDynamicReadwriteLock(pLock, READ_MODE, LOCKSTORE)

Definition at line 61 of file defs.h.

#define RELEASE_WRITE_DLOCK ( pLock ) ReleaseDynamicReadwriteLock(pLock, WRITE_MODE, LOCKSTORE)

Definition at line 65 of file defs.h.

#define RESTART_TIMER | ( | hHandle,
 |  | ulWhen,
 |  | pdwErr
 | ) |
Value:
{                                                                           \
    if (ChangeTimerQueueTimer(g_ce.hTimerQueue,                             \
                              (hHandle),                                    \
                              SECTOMILLISEC(ulWhen),                        \
                              INFINITE_INTERVAL))                           \
    {                                                                       \
        *(pdwErr) = NO_ERROR;                                               \
    }                                                                       \
    else                                                                    \
    {                                                                       \
        *(pdwErr) = GetLastError();                                         \
        TRACE1(ANY, "Error %u restarting timer, continuing...", *(pdwErr)); \
    }                                                                       \
}

Definition at line 148 of file defs.h.

#define SECTOMILLISEC ( x ) ((x) * 1000)

Definition at line 72 of file defs.h.

#define STAR 0x00000000

Definition at line 87 of file defs.h.

#define TRACE0 | ( | l,
 |  | a
 | ) |
Value:
if (TRACEID != INVALID_TRACEID)                                     \
        TracePrintfEx(TRACEID, IPSAMPLE_TRACE_ ## l, a)

Definition at line 212 of file defs.h.

#define TRACE1 | ( | l,
 |  | a,
 |  | b
 | ) |
Value:
if (TRACEID != INVALID_TRACEID)                                     \
        TracePrintfEx(TRACEID, IPSAMPLE_TRACE_ ## l, a, b)

Definition at line 215 of file defs.h.

#define TRACE2 | ( | l,
 |  | a,
 |  | b,
 |  | c
 | ) |
Value:
if (TRACEID != INVALID_TRACEID)                                     \
        TracePrintfEx(TRACEID, IPSAMPLE_TRACE_ ## l, a, b, c)

Definition at line 218 of file defs.h.

#define TRACE3 | ( | l,
 |  | a,
 |  | b,
 |  | c,
 |  | d
 | ) |
Value:
if (TRACEID != INVALID_TRACEID)                                     \
        TracePrintfEx(TRACEID, IPSAMPLE_TRACE_ ## l, a, b, c, d)

Definition at line 221 of file defs.h.

#define TRACE4 | ( | l,
 |  | a,
 |  | b,
 |  | c,
 |  | d,
 |  | e
 | ) |
Value:
if (TRACEID != INVALID_TRACEID)                                     \
        TracePrintfEx(TRACEID, IPSAMPLE_TRACE_ ## l, a, b, c, d, e)

Definition at line 224 of file defs.h.

#define TRACE5 | ( | l,
 |  | a,
 |  | b,
 |  | c,
 |  | d,
 |  | e,
 |  | f
 | ) |
Value:
if (TRACEID != INVALID_TRACEID)                                     \
        TracePrintfEx(TRACEID, IPSAMPLE_TRACE_ ## l, a, b, c, d, e, f)

Definition at line 227 of file defs.h.

#define TRACEID g_ce.dwTraceID

Definition at line 45 of file defs.h.

Typedef Documentation

typedef DWORD IPADDRESS

Definition at line 81 of file defs.h.

typedef DWORD * PIPADDRESS

Definition at line 81 of file defs.h.

Generated on Wed Nov 13 2024 16:54:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/ip/hashtable.c File Reference

  • NetDS
  • RRas
  • ip
Functions

hashtable.c File Reference

#include "pchsample.h"

Go to the source code of this file.

Functions

DWORD | HT_Cleanup (IN PHASH_TABLE phtHashTable)
DWORD | HT_Create (IN HANDLE hHeap, IN ULONG ulNumBuckets, IN PDISPLAY_FUNCTION pfnDisplay OPTIONAL, IN PFREE_FUNCTION pfnFree, IN PHASH_FUNCTION pfnHash, IN PCOMPARE_FUNCTION pfnCompare, OUT PHASH_TABLE *pphtHashTable)
DWORD | HT_DeleteEntry (IN PHASH_TABLE phtHashTable, IN PLIST_ENTRY pleKey, OUT PLIST_ENTRY *ppleEntry)
DWORD | HT_Destroy (IN HANDLE hHeap, IN PHASH_TABLE phtHashTable)
DWORD | HT_GetEntry (IN PHASH_TABLE phtHashTable, IN PLIST_ENTRY pleKey, OUT PLIST_ENTRY *ppleEntry)
DWORD | HT_InsertEntry (IN PHASH_TABLE phtHashTable, IN PLIST_ENTRY pleEntry)
BOOL | HT_IsPresentEntry (IN PHASH_TABLE phtHashTable, IN PLIST_ENTRY pleKey)
DWORD | HT_MapCar (IN PHASH_TABLE phtHashTable, IN PVOID_FUNCTION pfnVoidFunction)

Function Documentation

DWORD HT_Cleanup ( IN PHASH_TABLE phtHashTable )

Definition at line 156 of file hashtable.c.

{
    ULONG i;
    PLIST_ENTRY pleList = NULL;

    // validate parameters
    if (!phtHashTable)
        return NO_ERROR;

    // deallocate the entries
    for (i = 0; i < phtHashTable->ulNumBuckets; i++)
    {
        pleList = phtHashTable->pleBuckets + i;
        FreeList(pleList, phtHashTable->pfnFree);
    }

    phtHashTable->ulNumEntries  = 0;

    return NO_ERROR;
}

DWORD HT_Create | ( | IN HANDLE | hHeap,
 |  | IN ULONG | ulNumBuckets,
 |  | IN PDISPLAY_FUNCTION pfnDisplay | OPTIONAL,
 |  | IN PFREE_FUNCTION | pfnFree,
 |  | IN PHASH_FUNCTION | pfnHash,
 |  | IN PCOMPARE_FUNCTION | pfnCompare,
 |  | OUT PHASH_TABLE * | pphtHashTable
 | ) |  |

Definition at line 20 of file hashtable.c.

{
    DWORD       dwErr = NO_ERROR;
    ULONG       i = 0, ulSize = 0;
    PHASH_TABLE phtTable;

    // validate parameters
    if (!hHeap or
        !ulNumBuckets or
        !pfnFree or
        !pfnHash or
        !pfnCompare or
        !pphtHashTable)
        return ERROR_INVALID_PARAMETER;

    *pphtHashTable = NULL;

    do                          // breakout loop
    {
        // allocate the hash table structure
        ulSize = sizeof(HASH_TABLE);
        phtTable = HeapAlloc(hHeap, 0, ulSize);
        if (phtTable is NULL)
        {
            dwErr = GetLastError();
            break;
        }

        // allocate the buckets
        ulSize = ulNumBuckets * sizeof(LIST_ENTRY);
        phtTable->pleBuckets = HeapAlloc(hHeap, 0, ulSize);
        if (phtTable->pleBuckets is NULL)
        {
            HeapFree(hHeap, 0, phtTable); // undo allocation
            dwErr = GetLastError();
            break;
        }

        // initialize the buckets
        for (i = 0; i < ulNumBuckets; i++)
            InitializeListHead(phtTable->pleBuckets + i);

        // initialize the hash table structure's members
        phtTable->ulNumBuckets  = ulNumBuckets;
        phtTable->ulNumEntries  = 0;
        phtTable->pfnDisplay    = pfnDisplay;
        phtTable->pfnFree       = pfnFree;
        phtTable->pfnHash       = pfnHash;
        phtTable->pfnCompare    = pfnCompare;

        *pphtHashTable = phtTable;
    } while (FALSE);

    return dwErr;
}

DWORD HT_DeleteEntry | ( | IN PHASH_TABLE | phtHashTable,
 |  | IN PLIST_ENTRY | pleKey,
 |  | OUT PLIST_ENTRY * | ppleEntry
 | ) |  |

Definition at line 291 of file hashtable.c.

{
    DWORD dwErr = NO_ERROR;

    // validate parameters
    if (!phtHashTable or !pleKey or !ppleEntry)
        return ERROR_INVALID_PARAMETER;

    do                          // breakout loop
    {
        dwErr = HT_GetEntry(phtHashTable, pleKey, ppleEntry);

        // entry not found, fail
        if (dwErr != NO_ERROR)
            break;

        // entry found, delete from hash table and reset pointers
        RemoveEntryList(*ppleEntry);
        phtHashTable->ulNumEntries--;
    } while (FALSE);

    return dwErr;
}

DWORD HT_Destroy | ( | IN HANDLE | hHeap,
 |  | IN PHASH_TABLE | phtHashTable
 | ) |  |

Definition at line 108 of file hashtable.c.

{
    ULONG i;
    PLIST_ENTRY pleList = NULL;

    // validate parameters
    if (!hHeap or
        !phtHashTable)
        return NO_ERROR;

    // deallocate the entries
    for (i = 0; i < phtHashTable->ulNumBuckets; i++)
    {
        pleList = phtHashTable->pleBuckets + i;
        FreeList(pleList, phtHashTable->pfnFree);
    }

    // deallocate the buckets
    HeapFree(hHeap, 0, phtHashTable->pleBuckets);

    // deallocate the hash table structure
    HeapFree(hHeap, 0, phtHashTable);

    return NO_ERROR;
}

DWORD HT_GetEntry | ( | IN PHASH_TABLE | phtHashTable,
 |  | IN PLIST_ENTRY | pleKey,
 |  | OUT PLIST_ENTRY * | ppleEntry
 | ) |  |

Definition at line 247 of file hashtable.c.

{
    DWORD dwErr = NO_ERROR;
    PLIST_ENTRY pleList = NULL;

    // validate parameters
    if (!phtHashTable or !pleKey or !ppleEntry)
        return ERROR_INVALID_PARAMETER;

    pleList = phtHashTable->pleBuckets +
        (*phtHashTable->pfnHash)(pleKey);

    FindList(pleList, pleKey, ppleEntry, phtHashTable->pfnCompare);

    // entry not found, fail
    if (*ppleEntry is NULL)
        dwErr = ERROR_INVALID_PARAMETER;

    return dwErr;
}

DWORD HT_InsertEntry | ( | IN PHASH_TABLE | phtHashTable,
 |  | IN PLIST_ENTRY | pleEntry
 | ) |  |

Definition at line 196 of file hashtable.c.

{
    DWORD dwErr = NO_ERROR;
    PLIST_ENTRY pleList = NULL;

    // validate parameters
    if (!phtHashTable or !pleEntry)
        return ERROR_INVALID_PARAMETER;

    do                          // breakout loop
    {
        // entry exists, fail
        if (HT_IsPresentEntry(phtHashTable, pleEntry))
        {
            dwErr = ERROR_INVALID_PARAMETER;
            break;
        }

        // insert the entry in the hash table
        pleList = phtHashTable->pleBuckets +
            (*phtHashTable->pfnHash)(pleEntry);
        InsertHeadList(pleList, pleEntry);
        phtHashTable->ulNumEntries++;
    } while (FALSE);

    return dwErr;
}

BOOL HT_IsPresentEntry | ( | IN PHASH_TABLE | phtHashTable,
 |  | IN PLIST_ENTRY | pleKey
 | ) |  |

Definition at line 340 of file hashtable.c.

{
    DWORD       dwErr;
    PLIST_ENTRY pleEntry = NULL;

    // validate parameters
    if (!phtHashTable or !pleKey)
        return FALSE;

    dwErr = HT_GetEntry(phtHashTable, pleKey, &pleEntry);

    // entry not found, fail
    if (dwErr != NO_ERROR)
        return FALSE;

    // entry found, delete from hash table
    return TRUE;
}

DWORD HT_MapCar | ( | IN PHASH_TABLE | phtHashTable,
 |  | IN PVOID_FUNCTION | pfnVoidFunction
 | ) |  |

Definition at line 381 of file hashtable.c.

{
    ULONG i;
    PLIST_ENTRY pleList = NULL;

    // validate parameters
    if (!phtHashTable or !pfnVoidFunction)
        return NO_ERROR;

    for (i = 0; i < phtHashTable->ulNumBuckets; i++)
    {
        pleList = phtHashTable->pleBuckets + i;
        MapCarList(pleList, pfnVoidFunction);
    }

    return NO_ERROR;
}

Generated on Wed Nov 13 2024 16:54:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/ip/hashtable.h File Reference

  • NetDS
  • RRas
  • ip
Classes | Defines | Typedefs | Functions

hashtable.h File Reference

Go to the source code of this file.

Classes

struct | _HASH_TABLE

Defines

#define | HT_Display(phtHashTable)
#define | HT_IsEmpty(phtHashTable)
#define | HT_RemoveEntry(phtHashTable, pleEntry)
#define | HT_Size(phtHashTable)

Typedefs

typedef struct _HASH_TABLE | HASH_TABLE
typedef LONG(* | PCOMPARE_FUNCTION )(PLIST_ENTRY pleTableEntry, PLIST_ENTRY pleKeyEntry)
typedef PVOID_FUNCTION | PDISPLAY_FUNCTION
typedef PVOID_FUNCTION | PFREE_FUNCTION
typedef ULONG(* | PHASH_FUNCTION )(PLIST_ENTRY pleEntry)
typedef struct _HASH_TABLE * | PHASH_TABLE
typedef VOID(* | PVOID_FUNCTION )(PLIST_ENTRY pleEntry)

Functions

DWORD | HT_Cleanup (IN PHASH_TABLE phtHashTable)
DWORD | HT_Create (IN HANDLE hHeap, IN ULONG ulNumBuckets, IN PDISPLAY_FUNCTION pfnDisplay OPTIONAL, IN PFREE_FUNCTION pfnFree, IN PHASH_FUNCTION pfnHash, IN PCOMPARE_FUNCTION pfnCompare, OUT PHASH_TABLE *pphtHashTable)
DWORD | HT_DeleteEntry (IN PHASH_TABLE phtHashTable, IN PLIST_ENTRY pleKey, OUT PLIST_ENTRY *ppleEntry)
DWORD | HT_Destroy (IN HANDLE hHeap, IN PHASH_TABLE phtTable)
DWORD | HT_GetEntry (IN PHASH_TABLE phtHashTable, IN PLIST_ENTRY pleKey, OUT PLIST_ENTRY *ppleEntry)
DWORD | HT_InsertEntry (IN PHASH_TABLE phtHashTable, IN PLIST_ENTRY pleEntry)
BOOL | HT_IsPresentEntry (IN PHASH_TABLE phtHashTable, IN PLIST_ENTRY pleKey)
DWORD | HT_MapCar (IN PHASH_TABLE phtHashTable, IN PVOID_FUNCTION pfnVoidFunction)

Define Documentation

#define HT_Display ( phtHashTable )
Value:
{                                                                   \
    if (phtHashTable)                                               \
        HT_MapCar(phtHashTable, phtHashTable->pfnDisplay);          \
}

Definition at line 74 of file hashtable.h.

#define HT_IsEmpty ( phtHashTable )
Value:
(                                                       \
    HT_Size(phtHashTable) is 0                          \
)

Definition at line 87 of file hashtable.h.

#define HT_RemoveEntry | ( | phtHashTable,
 |  | pleEntry
 | ) |
Value:
(                                                       \
    RemoveEntryList(pleEntry)                           \
    phtHashTable->ulNumEntries--;                       \
)

Definition at line 113 of file hashtable.h.

#define HT_Size ( phtHashTable )
Value:
(                                                       \
    phtHashTable->ulNumEntries                          \
)

Definition at line 81 of file hashtable.h.

Typedef Documentation

typedef struct _HASH_TABLE HASH_TABLE
typedef LONG(* PCOMPARE_FUNCTION)(PLIST_ENTRY pleTableEntry, PLIST_ENTRY pleKeyEntry)

Definition at line 33 of file hashtable.h.

typedef PVOID_FUNCTION PDISPLAY_FUNCTION

Definition at line 22 of file hashtable.h.

typedef PVOID_FUNCTION PFREE_FUNCTION

Definition at line 24 of file hashtable.h.

typedef ULONG(* PHASH_FUNCTION)(PLIST_ENTRY pleEntry)

Definition at line 27 of file hashtable.h.

typedef struct _HASH_TABLE * PHASH_TABLE
typedef VOID(* PVOID_FUNCTION)(PLIST_ENTRY pleEntry)

Definition at line 20 of file hashtable.h.

Function Documentation

DWORD HT_Cleanup ( IN PHASH_TABLE phtHashTable )

Definition at line 156 of file hashtable.c.

{
    ULONG i;
    PLIST_ENTRY pleList = NULL;

    // validate parameters
    if (!phtHashTable)
        return NO_ERROR;

    // deallocate the entries
    for (i = 0; i < phtHashTable->ulNumBuckets; i++)
    {
        pleList = phtHashTable->pleBuckets + i;
        FreeList(pleList, phtHashTable->pfnFree);
    }

    phtHashTable->ulNumEntries  = 0;

    return NO_ERROR;
}

DWORD HT_Create | ( | IN HANDLE | hHeap,
 |  | IN ULONG | ulNumBuckets,
 |  | IN PDISPLAY_FUNCTION pfnDisplay | OPTIONAL,
 |  | IN PFREE_FUNCTION | pfnFree,
 |  | IN PHASH_FUNCTION | pfnHash,
 |  | IN PCOMPARE_FUNCTION | pfnCompare,
 |  | OUT PHASH_TABLE * | pphtHashTable
 | ) |  |

Definition at line 20 of file hashtable.c.

{
    DWORD       dwErr = NO_ERROR;
    ULONG       i = 0, ulSize = 0;
    PHASH_TABLE phtTable;

    // validate parameters
    if (!hHeap or
        !ulNumBuckets or
        !pfnFree or
        !pfnHash or
        !pfnCompare or
        !pphtHashTable)
        return ERROR_INVALID_PARAMETER;

    *pphtHashTable = NULL;

    do                          // breakout loop
    {
        // allocate the hash table structure
        ulSize = sizeof(HASH_TABLE);
        phtTable = HeapAlloc(hHeap, 0, ulSize);
        if (phtTable is NULL)
        {
            dwErr = GetLastError();
            break;
        }

        // allocate the buckets
        ulSize = ulNumBuckets * sizeof(LIST_ENTRY);
        phtTable->pleBuckets = HeapAlloc(hHeap, 0, ulSize);
        if (phtTable->pleBuckets is NULL)
        {
            HeapFree(hHeap, 0, phtTable); // undo allocation
            dwErr = GetLastError();
            break;
        }

        // initialize the buckets
        for (i = 0; i < ulNumBuckets; i++)
            InitializeListHead(phtTable->pleBuckets + i);

        // initialize the hash table structure's members
        phtTable->ulNumBuckets  = ulNumBuckets;
        phtTable->ulNumEntries  = 0;
        phtTable->pfnDisplay    = pfnDisplay;
        phtTable->pfnFree       = pfnFree;
        phtTable->pfnHash       = pfnHash;
        phtTable->pfnCompare    = pfnCompare;

        *pphtHashTable = phtTable;
    } while (FALSE);

    return dwErr;
}

DWORD HT_DeleteEntry | ( | IN PHASH_TABLE | phtHashTable,
 |  | IN PLIST_ENTRY | pleKey,
 |  | OUT PLIST_ENTRY * | ppleEntry
 | ) |  |

Definition at line 291 of file hashtable.c.

{
    DWORD dwErr = NO_ERROR;

    // validate parameters
    if (!phtHashTable or !pleKey or !ppleEntry)
        return ERROR_INVALID_PARAMETER;

    do                          // breakout loop
    {
        dwErr = HT_GetEntry(phtHashTable, pleKey, ppleEntry);

        // entry not found, fail
        if (dwErr != NO_ERROR)
            break;

        // entry found, delete from hash table and reset pointers
        RemoveEntryList(*ppleEntry);
        phtHashTable->ulNumEntries--;
    } while (FALSE);

    return dwErr;
}

DWORD HT_Destroy | ( | IN HANDLE | hHeap,
 |  | IN PHASH_TABLE | phtTable
 | ) |  |

Definition at line 108 of file hashtable.c.

{
    ULONG i;
    PLIST_ENTRY pleList = NULL;

    // validate parameters
    if (!hHeap or
        !phtHashTable)
        return NO_ERROR;

    // deallocate the entries
    for (i = 0; i < phtHashTable->ulNumBuckets; i++)
    {
        pleList = phtHashTable->pleBuckets + i;
        FreeList(pleList, phtHashTable->pfnFree);
    }

    // deallocate the buckets
    HeapFree(hHeap, 0, phtHashTable->pleBuckets);

    // deallocate the hash table structure
    HeapFree(hHeap, 0, phtHashTable);

    return NO_ERROR;
}

DWORD HT_GetEntry | ( | IN PHASH_TABLE | phtHashTable,
 |  | IN PLIST_ENTRY | pleKey,
 |  | OUT PLIST_ENTRY * | ppleEntry
 | ) |  |

Definition at line 247 of file hashtable.c.

{
    DWORD dwErr = NO_ERROR;
    PLIST_ENTRY pleList = NULL;

    // validate parameters
    if (!phtHashTable or !pleKey or !ppleEntry)
        return ERROR_INVALID_PARAMETER;

    pleList = phtHashTable->pleBuckets +
        (*phtHashTable->pfnHash)(pleKey);

    FindList(pleList, pleKey, ppleEntry, phtHashTable->pfnCompare);

    // entry not found, fail
    if (*ppleEntry is NULL)
        dwErr = ERROR_INVALID_PARAMETER;

    return dwErr;
}

DWORD HT_InsertEntry | ( | IN PHASH_TABLE | phtHashTable,
 |  | IN PLIST_ENTRY | pleEntry
 | ) |  |

Definition at line 196 of file hashtable.c.

{
    DWORD dwErr = NO_ERROR;
    PLIST_ENTRY pleList = NULL;

    // validate parameters
    if (!phtHashTable or !pleEntry)
        return ERROR_INVALID_PARAMETER;

    do                          // breakout loop
    {
        // entry exists, fail
        if (HT_IsPresentEntry(phtHashTable, pleEntry))
        {
            dwErr = ERROR_INVALID_PARAMETER;
            break;
        }

        // insert the entry in the hash table
        pleList = phtHashTable->pleBuckets +
            (*phtHashTable->pfnHash)(pleEntry);
        InsertHeadList(pleList, pleEntry);
        phtHashTable->ulNumEntries++;
    } while (FALSE);

    return dwErr;
}

BOOL HT_IsPresentEntry | ( | IN PHASH_TABLE | phtHashTable,
 |  | IN PLIST_ENTRY | pleKey
 | ) |  |

Definition at line 340 of file hashtable.c.

{
    DWORD       dwErr;
    PLIST_ENTRY pleEntry = NULL;

    // validate parameters
    if (!phtHashTable or !pleKey)
        return FALSE;

    dwErr = HT_GetEntry(phtHashTable, pleKey, &pleEntry);

    // entry not found, fail
    if (dwErr != NO_ERROR)
        return FALSE;

    // entry found, delete from hash table
    return TRUE;
}

DWORD HT_MapCar | ( | IN PHASH_TABLE | phtHashTable,
 |  | IN PVOID_FUNCTION | pfnVoidFunction
 | ) |  |

Definition at line 381 of file hashtable.c.

{
    ULONG i;
    PLIST_ENTRY pleList = NULL;

    // validate parameters
    if (!phtHashTable or !pfnVoidFunction)
        return NO_ERROR;

    for (i = 0; i < phtHashTable->ulNumBuckets; i++)
    {
        pleList = phtHashTable->pleBuckets + i;
        MapCarList(pleList, pfnVoidFunction);
    }

    return NO_ERROR;
}

Generated on Wed Nov 13 2024 16:54:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/ip/ipsample.c File Reference

  • NetDS
  • RRas
  • ip
Defines | Functions

ipsample.c File Reference

#include "pchsample.h"
#include "ipsample.h"

Go to the source code of this file.

Defines

#define | SAMPLEAPI __declspec(dllexport)

Functions

BOOL WINAPI | DllMain (IN HINSTANCE hInstance, IN DWORD dwReason, IN PVOID pvImpLoad)

Define Documentation

#define SAMPLEAPI __declspec(dllexport)

Definition at line 18 of file ipsample.c.

Function Documentation

BOOL WINAPI DllMain | ( | IN HINSTANCE | hInstance,
 |  | IN DWORD | dwReason,
 |  | IN PVOID | pvImpLoad
 | ) |  |

Definition at line 23 of file ipsample.c.

{
    BOOL bError = TRUE;

    UNREFERENCED_PARAMETER(hInstance);
    UNREFERENCED_PARAMETER(pvImpLoad);

    switch(dwReason)
    {
        case DLL_PROCESS_ATTACH:
            DisableThreadLibraryCalls(hInstance);
            bError = (CE_Create(&g_ce) is NO_ERROR) ? TRUE : FALSE;

            break;

        case DLL_PROCESS_DETACH:
            CE_Destroy(&g_ce);

            break;

        default:

            break;
    }

    return bError;
}

Generated on Wed Nov 13 2024 16:54:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/ip/ipsample.h File Reference

  • NetDS
  • RRas
  • ip
Defines | Functions

ipsample.h File Reference

Go to the source code of this file.

Defines

#define | SAMPLEAPI __declspec(dllimport)

Functions

SAMPLEAPI VOID WINAPI | TestProtocol (VOID)

Define Documentation

#define SAMPLEAPI __declspec(dllimport)

Definition at line 24 of file ipsample.h.

Function Documentation

SAMPLEAPI VOID WINAPI TestProtocol ( VOID )

Definition at line 469 of file test.c.

{
    TRACE0(ANY, "Hello World!");
}

Generated on Wed Nov 13 2024 16:54:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/ip/ipsamplerm.h File Reference

  • NetDS
  • RRas
  • ip
Classes | Defines | Typedefs

ipsamplerm.h File Reference

Go to the source code of this file.

Classes

struct | _IPSAMPLE_GLOBAL_CONFIG
struct | _IPSAMPLE_GLOBAL_STATS
struct | _IPSAMPLE_IF_BINDING
struct | _IPSAMPLE_IF_CONFIG
struct | _IPSAMPLE_IF_STATS
struct | _IPSAMPLE_IP_ADDRESS
struct | _IPSAMPLE_MIB_GET_INPUT_DATA
struct | _IPSAMPLE_MIB_GET_OUTPUT_DATA
struct | _IPSAMPLE_MIB_SET_INPUT_DATA

Defines

#define | ANY_SIZE 0
#define | IPSAMPLE_GLOBAL_CONFIG_ID 1
#define | IPSAMPLE_GLOBAL_STATS_ID 0
#define | IPSAMPLE_IF_ADDRESS_TABLE(bind) ((PIPSAMPLE_IP_ADDRESS)((bind) + 1))
#define | IPSAMPLE_IF_BINDING_ID 4
#define | IPSAMPLE_IF_BINDING_SIZE(bind)
#define | IPSAMPLE_IF_CONFIG_ID 3
#define | IPSAMPLE_IF_STATS_ID 2
#define | IPSAMPLE_LOGGING_ERROR 1
#define | IPSAMPLE_LOGGING_INFO 3
#define | IPSAMPLE_LOGGING_NONE 0
#define | IPSAMPLE_LOGGING_WARN 2
#define | IPSAMPLE_METRIC_INFINITE 16
#define | IPSAMPLE_STATE_ACTIVE 0x00000001
#define | IPSAMPLE_STATE_BOUND 0x00000002
#define | MS_IP_SAMPLE PROTOCOL_ID(PROTO_TYPE_UCAST, PROTO_VENDOR_MS0, PROTO_IP_SAMPLE)
#define | PROTO_IP_SAMPLE 200
#define | SAMPLE_PROTOCOL_MULTICAST_GROUP ((DWORD)0x640000E0)

Typedefs

typedef struct
_IPSAMPLE_GLOBAL_CONFIG 		IPSAMPLE_GLOBAL_CONFIG
typedef struct
_IPSAMPLE_GLOBAL_STATS 		IPSAMPLE_GLOBAL_STATS
typedef struct _IPSAMPLE_IF_BINDING | IPSAMPLE_IF_BINDING
typedef struct _IPSAMPLE_IF_CONFIG | IPSAMPLE_IF_CONFIG
typedef struct _IPSAMPLE_IF_STATS | IPSAMPLE_IF_STATS
typedef struct _IPSAMPLE_IP_ADDRESS | IPSAMPLE_IP_ADDRESS
typedef struct
_IPSAMPLE_MIB_GET_INPUT_DATA 		IPSAMPLE_MIB_GET_INPUT_DATA
typedef struct
_IPSAMPLE_MIB_GET_OUTPUT_DATA 		IPSAMPLE_MIB_GET_OUTPUT_DATA
typedef struct
_IPSAMPLE_MIB_SET_INPUT_DATA 		IPSAMPLE_MIB_SET_INPUT_DATA
typedef struct
_IPSAMPLE_GLOBAL_CONFIG * 		PIPSAMPLE_GLOBAL_CONFIG
typedef struct
_IPSAMPLE_GLOBAL_STATS * 		PIPSAMPLE_GLOBAL_STATS
typedef struct
_IPSAMPLE_IF_BINDING * 		PIPSAMPLE_IF_BINDING
typedef struct
_IPSAMPLE_IF_CONFIG * 		PIPSAMPLE_IF_CONFIG
typedef struct _IPSAMPLE_IF_STATS * | PIPSAMPLE_IF_STATS
typedef struct
_IPSAMPLE_IP_ADDRESS * 		PIPSAMPLE_IP_ADDRESS
typedef struct
_IPSAMPLE_MIB_GET_INPUT_DATA * 		PIPSAMPLE_MIB_GET_INPUT_DATA
typedef struct
_IPSAMPLE_MIB_GET_OUTPUT_DATA * 		PIPSAMPLE_MIB_GET_OUTPUT_DATA
typedef struct
_IPSAMPLE_MIB_SET_INPUT_DATA * 		PIPSAMPLE_MIB_SET_INPUT_DATA

Define Documentation

#define ANY_SIZE 0

Definition at line 22 of file ipsamplerm.h.

#define IPSAMPLE_GLOBAL_CONFIG_ID 1

Definition at line 42 of file ipsamplerm.h.

#define IPSAMPLE_GLOBAL_STATS_ID 0

Definition at line 41 of file ipsamplerm.h.

#define IPSAMPLE_IF_ADDRESS_TABLE ( bind ) ((PIPSAMPLE_IP_ADDRESS)((bind) + 1))

Definition at line 216 of file ipsamplerm.h.

#define IPSAMPLE_IF_BINDING_ID 4

Definition at line 45 of file ipsamplerm.h.

#define IPSAMPLE_IF_BINDING_SIZE ( bind )
Value:
(sizeof(IPSAMPLE_IF_BINDING) +                              \
     (bind)->ulCount * sizeof(IPSAMPLE_IP_ADDRESS))

Definition at line 212 of file ipsamplerm.h.

#define IPSAMPLE_IF_CONFIG_ID 3

Definition at line 44 of file ipsamplerm.h.

#define IPSAMPLE_IF_STATS_ID 2

Definition at line 43 of file ipsamplerm.h.

#define IPSAMPLE_LOGGING_ERROR 1

Definition at line 53 of file ipsamplerm.h.

#define IPSAMPLE_LOGGING_INFO 3

Definition at line 55 of file ipsamplerm.h.

#define IPSAMPLE_LOGGING_NONE 0

Definition at line 52 of file ipsamplerm.h.

#define IPSAMPLE_LOGGING_WARN 2

Definition at line 54 of file ipsamplerm.h.

#define IPSAMPLE_METRIC_INFINITE 16

Definition at line 63 of file ipsamplerm.h.

#define IPSAMPLE_STATE_ACTIVE 0x00000001

Definition at line 71 of file ipsamplerm.h.

#define IPSAMPLE_STATE_BOUND 0x00000002

Definition at line 72 of file ipsamplerm.h.

#define MS_IP_SAMPLE PROTOCOL_ID(PROTO_TYPE_UCAST, PROTO_VENDOR_MS0, PROTO_IP_SAMPLE)

Definition at line 31 of file ipsamplerm.h.

#define PROTO_IP_SAMPLE 200

Definition at line 30 of file ipsamplerm.h.

#define SAMPLE_PROTOCOL_MULTICAST_GROUP ((DWORD)0x640000E0)

Definition at line 34 of file ipsamplerm.h.

Typedef Documentation

typedef struct _IPSAMPLE_GLOBAL_CONFIG IPSAMPLE_GLOBAL_CONFIG
typedef struct _IPSAMPLE_GLOBAL_STATS IPSAMPLE_GLOBAL_STATS
typedef struct _IPSAMPLE_IF_BINDING IPSAMPLE_IF_BINDING
typedef struct _IPSAMPLE_IF_CONFIG IPSAMPLE_IF_CONFIG
typedef struct _IPSAMPLE_IF_STATS IPSAMPLE_IF_STATS
typedef struct _IPSAMPLE_IP_ADDRESS IPSAMPLE_IP_ADDRESS
typedef struct _IPSAMPLE_MIB_GET_INPUT_DATA IPSAMPLE_MIB_GET_INPUT_DATA
typedef struct _IPSAMPLE_MIB_GET_OUTPUT_DATA IPSAMPLE_MIB_GET_OUTPUT_DATA
typedef struct _IPSAMPLE_MIB_SET_INPUT_DATA IPSAMPLE_MIB_SET_INPUT_DATA
typedef struct _IPSAMPLE_GLOBAL_CONFIG * PIPSAMPLE_GLOBAL_CONFIG
typedef struct _IPSAMPLE_GLOBAL_STATS * PIPSAMPLE_GLOBAL_STATS
typedef struct _IPSAMPLE_IF_BINDING * PIPSAMPLE_IF_BINDING
typedef struct _IPSAMPLE_IF_CONFIG * PIPSAMPLE_IF_CONFIG
typedef struct _IPSAMPLE_IF_STATS * PIPSAMPLE_IF_STATS
typedef struct _IPSAMPLE_IP_ADDRESS * PIPSAMPLE_IP_ADDRESS
typedef struct _IPSAMPLE_MIB_GET_INPUT_DATA * PIPSAMPLE_MIB_GET_INPUT_DATA
typedef struct _IPSAMPLE_MIB_GET_OUTPUT_DATA * PIPSAMPLE_MIB_GET_OUTPUT_DATA
typedef struct _IPSAMPLE_MIB_SET_INPUT_DATA * PIPSAMPLE_MIB_SET_INPUT_DATA
Generated on Wed Nov 13 2024 16:54:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/ip/list.h File Reference

  • NetDS
  • RRas
  • ip
Defines

list.h File Reference

Go to the source code of this file.

Defines

#define | Dequeue(QueueHead) RemoveHeadList(QueueHead)
#define | Enqueue(QueueHead, Entry) InsertTailList(QueueHead, Entry)
#define | FindList(ListHead, Key, Entry, CompareFunction)
#define | FindSortedList(ListHead, Key, Entry, CompareFunction)
#define | FreeList(ListHead, FreeFunction)
#define | FreeQueue(QueueHead, FreeFunction) FreeList(QueueHead, FreeFunction)
#define | FreeStack(StackHead, FreeFunction) FreeList(StackHead, FreeFunction)
#define | InitializeListHead(ListHead) ((ListHead)->Flink = (ListHead)->Blink = (ListHead))
#define | InitializeQueueHead(QueueHead) InitializeListHead(QueueHead)
#define | InitializeStackHead(StackHead) InitializeListHead(StackHead)
#define | InsertHeadList(ListHead, Entry)
#define | InsertSortedList(ListHead, Entry, CompareFunction)
#define | InsertTailList(ListHead, Entry)
#define | IsListEmpty(ListHead) ((ListHead)->Flink == (ListHead))
#define | IsQueueEmpty(QueueHead) IsListEmpty(QueueHead)
#define | IsStackEmpty(StackHead) IsListEmpty(StackHead)
#define | MapCarList(ListHead, VoidFunction)
#define | MapCarQueue(QueueHead, VoidFunction) MapCarList(QueueHead, VoidFunction)
#define | MapCarStack(StackHead, VoidFunction) MapCarList(StackHead, VoidFunction)
#define | Pop(StackHead) RemoveHeadList(StackHead)
#define | PQUEUE_ENTRY PLIST_ENTRY
#define | PSTACK_ENTRY PLIST_ENTRY
#define | Push(StackHead, Entry) InsertHeadList(StackHead, Entry)
#define | QUEUE_ENTRY LIST_ENTRY
#define | RemoveEntryList(Entry)
#define | RemoveHeadList(ListHead)
#define | RemoveTailList(ListHead)
#define | STACK_ENTRY LIST_ENTRY

Define Documentation

#define Dequeue ( QueueHead ) RemoveHeadList(QueueHead)

Definition at line 334 of file list.h.

#define Enqueue | ( | QueueHead,
 |  | Entry |
 | ) |  | InsertTailList(QueueHead, Entry)

Definition at line 325 of file list.h.

#define FindList | ( | ListHead,
 |  | Key,
 |  | Entry,
 |  | CompareFunction
 | ) |
Value:
{                                                               \
    PLIST_ENTRY _EX_Entry;                                      \
    *(Entry) = NULL;                                            \
    for (_EX_Entry = (ListHead)->Flink;                         \
         _EX_Entry != (ListHead);                               \
         _EX_Entry = _EX_Entry->Flink)                          \
        if ((*(CompareFunction))((Key), _EX_Entry) is 0)        \
        {                                                       \
            *(Entry) = _EX_Entry;                               \
            break;                                              \
        }                                                       \
}

Definition at line 209 of file list.h.

#define FindSortedList | ( | ListHead,
 |  | Key,
 |  | Entry,
 |  | CompareFunction
 | ) |
Value:
{                                                               \
    PLIST_ENTRY _EX_Entry;                                      \
    *(Entry) = NULL;                                            \
    for (_EX_Entry = (ListHead)->Flink;                         \
         _EX_Entry != (ListHead);                               \
         _EX_Entry = _EX_Entry->Flink)                          \
        if ((*(CompareFunction))((Key), _EX_Entry) <= 0)        \
        {                                                       \
            *(Entry) = _EX_Entry;                               \
            break;                                              \
        }                                                       \
}

Definition at line 237 of file list.h.

#define FreeList | ( | ListHead,
 |  | FreeFunction
 | ) |
Value:
{                                                               \
    PLIST_ENTRY _EX_Head;                                       \
    while (!IsListEmpty(ListHead))                              \
    {                                                           \
        _EX_Head = RemoveHeadList(ListHead);                    \
        (*(FreeFunction))(_EX_Head);                            \
    }                                                           \
}

Definition at line 284 of file list.h.

#define FreeQueue | ( | QueueHead,
 |  | FreeFunction |
 | ) |  | FreeList(QueueHead, FreeFunction)

Definition at line 344 of file list.h.

#define FreeStack | ( | StackHead,
 |  | FreeFunction |
 | ) |  | FreeList(StackHead, FreeFunction)

Definition at line 408 of file list.h.

#define InitializeListHead ( ListHead ) ((ListHead)->Flink = (ListHead)->Blink = (ListHead))

Definition at line 64 of file list.h.

#define InitializeQueueHead ( QueueHead ) InitializeListHead(QueueHead)

Definition at line 306 of file list.h.

#define InitializeStackHead ( StackHead ) InitializeListHead(StackHead)

Definition at line 370 of file list.h.

#define InsertHeadList | ( | ListHead,
 |  | Entry
 | ) |
Value:
{                                                               \
    PLIST_ENTRY _EX_Flink;                                      \
    PLIST_ENTRY _EX_ListHead;                                   \
    _EX_ListHead = (ListHead);                                  \
    _EX_Flink = _EX_ListHead->Flink;                            \
    (Entry)->Flink = _EX_Flink;                                 \
    (Entry)->Blink = _EX_ListHead;                              \
    _EX_Flink->Blink = (Entry);                                 \
    _EX_ListHead->Flink = (Entry);                              \
}

Definition at line 156 of file list.h.

#define InsertSortedList | ( | ListHead,
 |  | Entry,
 |  | CompareFunction
 | ) |
Value:
{                                                               \
    PLIST_ENTRY _EX_Entry;                                      \
    PLIST_ENTRY _EX_Blink;                                      \
    for (_EX_Entry = (ListHead)->Flink;                         \
         _EX_Entry != (ListHead);                               \
         _EX_Entry = _EX_Entry->Flink)                          \
        if ((*(CompareFunction))((Entry), _EX_Entry) <= 0)      \
            break;                                              \
    _EX_Blink = _EX_Entry->Blink;                               \
    _EX_Blink->Flink = (Entry);                                 \
    _EX_Entry->Blink = (Entry);                                 \
    (Entry)->Flink     = _EX_Entry;                             \
    (Entry)->Blink     = _EX_Blink;                             \
}

Definition at line 179 of file list.h.

#define InsertTailList | ( | ListHead,
 |  | Entry
 | ) |
Value:
{                                                               \
    PLIST_ENTRY _EX_Blink;                                      \
    PLIST_ENTRY _EX_ListHead;                                   \
    _EX_ListHead = (ListHead);                                  \
    _EX_Blink = _EX_ListHead->Blink;                            \
    (Entry)->Flink = _EX_ListHead;                              \
    (Entry)->Blink = _EX_Blink;                                 \
    _EX_Blink->Flink = (Entry);                                 \
    _EX_ListHead->Blink = (Entry);                              \
}

Definition at line 134 of file list.h.

#define IsListEmpty ( ListHead ) ((ListHead)->Flink == (ListHead))

Definition at line 76 of file list.h.

#define IsQueueEmpty ( QueueHead ) IsListEmpty(QueueHead)

Definition at line 315 of file list.h.

#define IsStackEmpty ( StackHead ) IsListEmpty(StackHead)

Definition at line 379 of file list.h.

#define MapCarList | ( | ListHead,
 |  | VoidFunction
 | ) |
Value:
{                                                               \
    PLIST_ENTRY _EX_Entry;                                      \
    for (_EX_Entry = (ListHead)->Flink;                         \
         _EX_Entry != (ListHead);                               \
         _EX_Entry = _EX_Entry->Flink)                          \
        (*(VoidFunction))(_EX_Entry);                           \
}

Definition at line 263 of file list.h.

#define MapCarQueue | ( | QueueHead,
 |  | VoidFunction |
 | ) |  | MapCarList(QueueHead, VoidFunction)

Definition at line 355 of file list.h.

#define MapCarStack | ( | StackHead,
 |  | VoidFunction |
 | ) |  | MapCarList(StackHead, VoidFunction)

Definition at line 419 of file list.h.

#define Pop ( StackHead ) RemoveHeadList(StackHead)

Definition at line 398 of file list.h.

#define PQUEUE_ENTRY PLIST_ENTRY

Definition at line 297 of file list.h.

#define PSTACK_ENTRY PLIST_ENTRY

Definition at line 361 of file list.h.

#define Push | ( | StackHead,
 |  | Entry |
 | ) |  | InsertHeadList(StackHead, Entry)

Definition at line 389 of file list.h.

#define QUEUE_ENTRY LIST_ENTRY

Definition at line 296 of file list.h.

#define RemoveEntryList ( Entry )
Value:
{                                                               \
    PLIST_ENTRY _EX_Blink;                                      \
    PLIST_ENTRY _EX_Flink;                                      \
    _EX_Flink = (Entry)->Flink;                                 \
    _EX_Blink = (Entry)->Blink;                                 \
    _EX_Blink->Flink = _EX_Flink;                               \
    _EX_Flink->Blink = _EX_Blink;                               \
}

Definition at line 114 of file list.h.

#define RemoveHeadList ( ListHead )
Value:
(ListHead)->Flink;                                          \
    {RemoveEntryList((ListHead)->Flink)}

Definition at line 88 of file list.h.

#define RemoveTailList ( ListHead )
Value:
(ListHead)->Blink;                                          \
    {RemoveEntryList((ListHead)->Blink)}

Definition at line 101 of file list.h.

#define STACK_ENTRY LIST_ENTRY

Definition at line 360 of file list.h.

Generated on Wed Nov 13 2024 16:53:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/ip/log.h File Reference

  • NetDS
  • RRas
  • ip
Defines

log.h File Reference

Go to the source code of this file.

Defines

#define | IPSAMPLELOG_BASE 43000
#define | IPSAMPLELOG_BIND_IF_FAILED (IPSAMPLELOG_BASE + 13)
#define | IPSAMPLELOG_CORRUPT_GLOBAL_CONFIG (IPSAMPLELOG_BASE + 26)
#define | IPSAMPLELOG_CORRUPT_INTERFACE_CONFIG (IPSAMPLELOG_BASE + 31)
#define | IPSAMPLELOG_CREATE_EVENT_FAILED (IPSAMPLELOG_BASE + 3)
#define | IPSAMPLELOG_CREATE_HASHTABLE_FAILED (IPSAMPLELOG_BASE + 8)
#define | IPSAMPLELOG_CREATE_RWL_FAILED (IPSAMPLELOG_BASE + 4)
#define | IPSAMPLELOG_CREATE_SEMAPHORE_FAILED (IPSAMPLELOG_BASE + 2)
#define | IPSAMPLELOG_CREATE_SOCKET_FAILED (IPSAMPLELOG_BASE + 10)
#define | IPSAMPLELOG_CREATE_TIMER_FAILED (IPSAMPLELOG_BASE + 38)
#define | IPSAMPLELOG_CREATE_TIMER_QUEUE_FAILED (IPSAMPLELOG_BASE + 29)
#define | IPSAMPLELOG_DESTROY_SOCKET_FAILED (IPSAMPLELOG_BASE + 11)
#define | IPSAMPLELOG_ENUM_NETWORK_EVENTS_FAILED (IPSAMPLELOG_BASE + 18)
#define | IPSAMPLELOG_EVENT_QUEUE_EMPTY (IPSAMPLELOG_BASE + 28)
#define | IPSAMPLELOG_EVENTSELECT_FAILED (IPSAMPLELOG_BASE + 12)
#define | IPSAMPLELOG_HEAP_ALLOC_FAILED (IPSAMPLELOG_BASE + 7)
#define | IPSAMPLELOG_HEAP_CREATE_FAILED (IPSAMPLELOG_BASE + 6)
#define | IPSAMPLELOG_INIT_CRITSEC_FAILED (IPSAMPLELOG_BASE + 1)
#define | IPSAMPLELOG_INPUT_RECORD_ERROR (IPSAMPLELOG_BASE + 19)
#define | IPSAMPLELOG_INTERFACE_ABSENT (IPSAMPLELOG_BASE + 33)
#define | IPSAMPLELOG_INTERFACE_PRESENT (IPSAMPLELOG_BASE + 32)
#define | IPSAMPLELOG_JOIN_GROUP_FAILED (IPSAMPLELOG_BASE + 17)
#define | IPSAMPLELOG_NETWORK_MODULE_ERROR (IPSAMPLELOG_BASE + 30)
#define | IPSAMPLELOG_PACKET_HEADER_CORRUPT (IPSAMPLELOG_BASE + 35)
#define | IPSAMPLELOG_PACKET_TOO_SMALL (IPSAMPLELOG_BASE + 34)
#define | IPSAMPLELOG_PACKET_VERSION_INVALID (IPSAMPLELOG_BASE + 36)
#define | IPSAMPLELOG_PROTOCOL_MODULE_ERROR (IPSAMPLELOG_BASE + 39)
#define | IPSAMPLELOG_RECVFROM_FAILED (IPSAMPLELOG_BASE + 14)
#define | IPSAMPLELOG_REGISTER_WAIT_FAILED (IPSAMPLELOG_BASE + 5)
#define | IPSAMPLELOG_RTM_REGISTER_FAILED (IPSAMPLELOG_BASE + 27)
#define | IPSAMPLELOG_SAMPLE_ALREADY_STARTED (IPSAMPLELOG_BASE + 21)
#define | IPSAMPLELOG_SAMPLE_ALREADY_STOPPED (IPSAMPLELOG_BASE + 24)
#define | IPSAMPLELOG_SAMPLE_START_FAILED (IPSAMPLELOG_BASE + 22)
#define | IPSAMPLELOG_SAMPLE_STARTED (IPSAMPLELOG_BASE + 20)
#define | IPSAMPLELOG_SAMPLE_STOP_FAILED (IPSAMPLELOG_BASE + 25)
#define | IPSAMPLELOG_SAMPLE_STOPPED (IPSAMPLELOG_BASE + 23)
#define | IPSAMPLELOG_SENDTO_FAILED (IPSAMPLELOG_BASE + 15)
#define | IPSAMPLELOG_SET_MCAST_IF_FAILED (IPSAMPLELOG_BASE + 16)
#define | IPSAMPLELOG_TIMER_MODULE_ERROR (IPSAMPLELOG_BASE + 37)
#define | IPSAMPLELOG_WSASTARTUP_FAILED (IPSAMPLELOG_BASE + 9)

Define Documentation

#define IPSAMPLELOG_BASE 43000

Definition at line 20 of file log.h.

#define IPSAMPLELOG_BIND_IF_FAILED (IPSAMPLELOG_BASE + 13)

Definition at line 94 of file log.h.

#define IPSAMPLELOG_CORRUPT_GLOBAL_CONFIG (IPSAMPLELOG_BASE + 26)

Definition at line 170 of file log.h.

#define IPSAMPLELOG_CORRUPT_INTERFACE_CONFIG (IPSAMPLELOG_BASE + 31)

Definition at line 200 of file log.h.

#define IPSAMPLELOG_CREATE_EVENT_FAILED (IPSAMPLELOG_BASE + 3)

Definition at line 34 of file log.h.

#define IPSAMPLELOG_CREATE_HASHTABLE_FAILED (IPSAMPLELOG_BASE + 8)

Definition at line 64 of file log.h.

#define IPSAMPLELOG_CREATE_RWL_FAILED (IPSAMPLELOG_BASE + 4)

Definition at line 40 of file log.h.

#define IPSAMPLELOG_CREATE_SEMAPHORE_FAILED (IPSAMPLELOG_BASE + 2)

Definition at line 28 of file log.h.

#define IPSAMPLELOG_CREATE_SOCKET_FAILED (IPSAMPLELOG_BASE + 10)

Definition at line 76 of file log.h.

#define IPSAMPLELOG_CREATE_TIMER_FAILED (IPSAMPLELOG_BASE + 38)

Definition at line 243 of file log.h.

#define IPSAMPLELOG_CREATE_TIMER_QUEUE_FAILED (IPSAMPLELOG_BASE + 29)

Definition at line 188 of file log.h.

#define IPSAMPLELOG_DESTROY_SOCKET_FAILED (IPSAMPLELOG_BASE + 11)

Definition at line 82 of file log.h.

#define IPSAMPLELOG_ENUM_NETWORK_EVENTS_FAILED (IPSAMPLELOG_BASE + 18)

Definition at line 127 of file log.h.

#define IPSAMPLELOG_EVENT_QUEUE_EMPTY (IPSAMPLELOG_BASE + 28)

Definition at line 182 of file log.h.

#define IPSAMPLELOG_EVENTSELECT_FAILED (IPSAMPLELOG_BASE + 12)

Definition at line 88 of file log.h.

#define IPSAMPLELOG_HEAP_ALLOC_FAILED (IPSAMPLELOG_BASE + 7)

Definition at line 58 of file log.h.

#define IPSAMPLELOG_HEAP_CREATE_FAILED (IPSAMPLELOG_BASE + 6)

Definition at line 52 of file log.h.

#define IPSAMPLELOG_INIT_CRITSEC_FAILED (IPSAMPLELOG_BASE + 1)

Definition at line 22 of file log.h.

#define IPSAMPLELOG_INPUT_RECORD_ERROR (IPSAMPLELOG_BASE + 19)

Definition at line 133 of file log.h.

#define IPSAMPLELOG_INTERFACE_ABSENT (IPSAMPLELOG_BASE + 33)

Definition at line 210 of file log.h.

#define IPSAMPLELOG_INTERFACE_PRESENT (IPSAMPLELOG_BASE + 32)

Definition at line 205 of file log.h.

#define IPSAMPLELOG_JOIN_GROUP_FAILED (IPSAMPLELOG_BASE + 17)

Definition at line 120 of file log.h.

#define IPSAMPLELOG_NETWORK_MODULE_ERROR (IPSAMPLELOG_BASE + 30)

Definition at line 194 of file log.h.

#define IPSAMPLELOG_PACKET_HEADER_CORRUPT (IPSAMPLELOG_BASE + 35)

Definition at line 222 of file log.h.

#define IPSAMPLELOG_PACKET_TOO_SMALL (IPSAMPLELOG_BASE + 34)

Definition at line 215 of file log.h.

#define IPSAMPLELOG_PACKET_VERSION_INVALID (IPSAMPLELOG_BASE + 36)

Definition at line 229 of file log.h.

#define IPSAMPLELOG_PROTOCOL_MODULE_ERROR (IPSAMPLELOG_BASE + 39)

Definition at line 249 of file log.h.

#define IPSAMPLELOG_RECVFROM_FAILED (IPSAMPLELOG_BASE + 14)

Definition at line 101 of file log.h.

#define IPSAMPLELOG_REGISTER_WAIT_FAILED (IPSAMPLELOG_BASE + 5)

Definition at line 46 of file log.h.

#define IPSAMPLELOG_RTM_REGISTER_FAILED (IPSAMPLELOG_BASE + 27)

Definition at line 176 of file log.h.

#define IPSAMPLELOG_SAMPLE_ALREADY_STARTED (IPSAMPLELOG_BASE + 21)

Definition at line 145 of file log.h.

#define IPSAMPLELOG_SAMPLE_ALREADY_STOPPED (IPSAMPLELOG_BASE + 24)

Definition at line 160 of file log.h.

#define IPSAMPLELOG_SAMPLE_START_FAILED (IPSAMPLELOG_BASE + 22)

Definition at line 150 of file log.h.

#define IPSAMPLELOG_SAMPLE_STARTED (IPSAMPLELOG_BASE + 20)

Definition at line 140 of file log.h.

#define IPSAMPLELOG_SAMPLE_STOP_FAILED (IPSAMPLELOG_BASE + 25)

Definition at line 165 of file log.h.

#define IPSAMPLELOG_SAMPLE_STOPPED (IPSAMPLELOG_BASE + 23)

Definition at line 155 of file log.h.

#define IPSAMPLELOG_SENDTO_FAILED (IPSAMPLELOG_BASE + 15)

Definition at line 107 of file log.h.

#define IPSAMPLELOG_SET_MCAST_IF_FAILED (IPSAMPLELOG_BASE + 16)

Definition at line 113 of file log.h.

#define IPSAMPLELOG_TIMER_MODULE_ERROR (IPSAMPLELOG_BASE + 37)

Definition at line 237 of file log.h.

#define IPSAMPLELOG_WSASTARTUP_FAILED (IPSAMPLELOG_BASE + 9)

Definition at line 70 of file log.h.

Generated on Wed Nov 13 2024 16:54:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/ip/makefile.inc File Reference

  • NetDS
  • RRas
  • ip

makefile.inc File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/ip/mibmgr.c File Reference

  • NetDS
  • RRas
  • ip
Functions

mibmgr.c File Reference

#include "pchsample.h"

Go to the source code of this file.

Functions

DWORD WINAPI | MM_MibGet (IN PIPSAMPLE_MIB_GET_INPUT_DATA pimgid, OUT PIPSAMPLE_MIB_GET_OUTPUT_DATA pimgod, IN OUT PULONG pulOutputSize, IN MODE mMode)
DWORD WINAPI | MM_MibSet (IN PIPSAMPLE_MIB_SET_INPUT_DATA pimsid)

Function Documentation

DWORD WINAPI MM_MibGet | ( | IN PIPSAMPLE_MIB_GET_INPUT_DATA | pimgid,
 |  | OUT PIPSAMPLE_MIB_GET_OUTPUT_DATA | pimgod,
 |  | IN OUT PULONG | pulOutputSize,
 |  | IN MODE | mMode
 | ) |  |

Definition at line 108 of file mibmgr.c.

                           : EXACT, FIRST, and NEXT, which correspond to
    MibGet(), MibGetFirst(), and MibGetNext() respectively.

Locks
    Acquires shared      (g_ce.pneNetworkEntry)->rwlLock
    Releases             (g_ce.pneNetworkEntry)->rwlLock

Arguments
    pimgid              input data
    pimgod              output buffer
    pulOutputSize       IN  size of output buffer given
                        OUT size of output buffer needed
    mMode               query type

Return Value
    NO_ERROR            success
    Error Code          o/w

--*/
{
    DWORD               dwErr           = NO_ERROR;
    ULONG               ulSizeGiven     = 0;
    ULONG               ulSizeNeeded    = 0;
    PINTERFACE_ENTRY    pie;

    if (!ENTER_SAMPLE_API()) { return ERROR_CAN_NOT_COMPLETE; }

    // compute the size of the buffer available for storing
    // returned structures (the size of IMGOD_Buffer)
    if (*pulOutputSize < sizeof(IPSAMPLE_MIB_GET_OUTPUT_DATA))
        ulSizeGiven = 0;
    else
        ulSizeGiven = *pulOutputSize - sizeof(IPSAMPLE_MIB_GET_OUTPUT_DATA);

    switch (pimgid->IMGID_TypeID)
    {
        // the global statistics struct is fixed-length.
        // there is a single instance.
        case IPSAMPLE_GLOBAL_STATS_ID:
        {
            PIPSAMPLE_GLOBAL_STATS pigsdst, pigssrc;

            // only GET_EXACT and GET_FIRST are valid for the
            // global stats object since there is only one entry
            if (mMode is GET_NEXT)
            {
                dwErr = ERROR_NO_MORE_ITEMS;
                break;
            }

            // set the output size required for this entry
            ulSizeNeeded = sizeof(IPSAMPLE_GLOBAL_STATS);

            // check that the output buffer is big enough
            if (ulSizeGiven < ulSizeNeeded)
            {
                dwErr = ERROR_INSUFFICIENT_BUFFER;
                break;
            }

            pimgod->IMGOD_TypeID = IPSAMPLE_GLOBAL_STATS_ID;

            // since access to this structure is synchronized through
            // locked increments/decrements, we must copy it field by field
            pigssrc = &(g_ce.igsStats);
            pigsdst = (PIPSAMPLE_GLOBAL_STATS) pimgod->IMGOD_Buffer;

            pigsdst->ulNumInterfaces = pigssrc->ulNumInterfaces;

            break;
        }

        // the global configuration structure may be of variable size.
        // there is a single instance.
        case IPSAMPLE_GLOBAL_CONFIG_ID:
        {
            // only GET_EXACT and GET_FIRST are valid for the
            // global configuration object since there is only one entry
            if (mMode is GET_NEXT)
            {
                dwErr = ERROR_NO_MORE_ITEMS;
                break;
            }

            // CM_GetGlobalInfo() decides whether the buffer size is
            // sufficient.  if so, it retrieves the global configuration.
            // either case it sets the required output buffer size.
            dwErr = CM_GetGlobalInfo ((PVOID) pimgod->IMGOD_Buffer,
                                      &ulSizeGiven,
                                      NULL,
                                      NULL,
                                      NULL);
            ulSizeNeeded = ulSizeGiven;

            // check that the output buffer was big enough
            if (dwErr != NO_ERROR)
                break;

            pimgod->IMGOD_TypeID = IPSAMPLE_GLOBAL_CONFIG_ID;

            break;
        }

        // the interface statistics struct is fixed-length.
        // there may be multiple instances.
        case IPSAMPLE_IF_STATS_ID:
        {
            PIPSAMPLE_IF_STATS  piisdst, piissrc;

            ACQUIRE_READ_LOCK(&(g_ce.pneNetworkEntry)->rwlLock);

            do                  // breakout loop
            {
                // retrieve the interface whose stats are to be read
                dwErr = IE_GetIndex(pimgid->IMGID_IfIndex,
                                    mMode,
                                    &pie);
                if (dwErr != NO_ERROR)
                    break;

                // set the output size required for this entry
                ulSizeNeeded = sizeof(IPSAMPLE_IF_STATS);

                // check that the output buffer is big enough
                if (ulSizeGiven < ulSizeNeeded)
                {
                    dwErr = ERROR_INSUFFICIENT_BUFFER;
                    break;
                }

                pimgod->IMGOD_TypeID = IPSAMPLE_IF_STATS_ID;
                pimgod->IMGOD_IfIndex = pie->dwIfIndex;

                // access to this structure is synchronized through locked
                // increments/decrements, so we copy it field by field
                piissrc = &(pie->iisStats);
                piisdst = (PIPSAMPLE_IF_STATS) pimgod->IMGOD_Buffer;

                piisdst->ulNumPackets = piissrc->ulNumPackets;
            } while (FALSE);

            RELEASE_READ_LOCK(&(g_ce.pneNetworkEntry)->rwlLock);

            break;
        }

        // the interface configuration structure may be of variable size.
        // there may be multiple instances.
        case IPSAMPLE_IF_CONFIG_ID:
        {
            // get the queried interface's index
            ACQUIRE_READ_LOCK(&(g_ce.pneNetworkEntry)->rwlLock);

            do                  // breakout loop
            {
                dwErr = IE_GetIndex(pimgid->IMGID_IfIndex,
                                    mMode,
                                    &pie);
                if (dwErr != NO_ERROR)
                    break;

                // read lock acuired again, which is fine :)
                dwErr = NM_GetInterfaceInfo(pie->dwIfIndex,
                                            (PVOID) pimgod->IMGOD_Buffer,
                                            &ulSizeGiven,
                                            NULL,
                                            NULL,
                                            NULL);
                ulSizeNeeded = ulSizeGiven;

                // check that the output buffer was big enough
                if (dwErr != NO_ERROR)
                    break;

                pimgod->IMGOD_TypeID    = IPSAMPLE_IF_CONFIG_ID;
                pimgod->IMGOD_IfIndex   = pie->dwIfIndex;
            } while (FALSE);

            RELEASE_READ_LOCK(&(g_ce.pneNetworkEntry)->rwlLock);

            break;
        }

        // the interface binding structure is of variable size.
        // there may be multiple instances.
        case IPSAMPLE_IF_BINDING_ID:
        {
            PIPSAMPLE_IF_BINDING    piib;
            PIPSAMPLE_IP_ADDRESS    piia;

            ACQUIRE_READ_LOCK(&(g_ce.pneNetworkEntry)->rwlLock);

            do                  // breakout loop
            {
                // retrieve the interface whose stats are to be read
                dwErr = IE_GetIndex(pimgid->IMGID_IfIndex,
                                    mMode,
                                    &pie);
                if (dwErr != NO_ERROR)
                    break;

                // set the output size required for this entry
                ulSizeNeeded = sizeof(IPSAMPLE_IF_BINDING) +
                    pie->ulNumBindings * sizeof(IPSAMPLE_IP_ADDRESS);

                // check that the output buffer is big enough
                if (ulSizeGiven < ulSizeNeeded)
                {
                    dwErr = ERROR_INSUFFICIENT_BUFFER;
                    break;
                }

                pimgod->IMGOD_TypeID    = IPSAMPLE_IF_BINDING_ID;
                pimgod->IMGOD_IfIndex   = pie->dwIfIndex;

                piib = (PIPSAMPLE_IF_BINDING) pimgod->IMGOD_Buffer;
                piia = IPSAMPLE_IF_ADDRESS_TABLE(piib);

                if (INTERFACE_IS_ACTIVE(pie))
                    piib->dwState |= IPSAMPLE_STATE_ACTIVE;

                if (INTERFACE_IS_BOUND(pie))
                    piib->dwState |= IPSAMPLE_STATE_BOUND;

                piib->ulCount = pie->ulNumBindings;
                CopyMemory((PVOID) piia, // address,mask pairs
                           (PVOID) pie->pbeBindingTable, // ditto
                           pie->ulNumBindings * sizeof(IPSAMPLE_IP_ADDRESS));
            } while (FALSE);

            RELEASE_READ_LOCK(&(g_ce.pneNetworkEntry)->rwlLock);

            break;
        }

        default:
        {
            dwErr = ERROR_INVALID_PARAMETER;
            break;
        }
    }

    *pulOutputSize = sizeof(IPSAMPLE_MIB_GET_OUTPUT_DATA) + ulSizeNeeded;

    LEAVE_SAMPLE_API();

    return dwErr;
}

DWORD WINAPI MM_MibSet ( IN PIPSAMPLE_MIB_SET_INPUT_DATA pimsid )

Definition at line 25 of file mibmgr.c.

{
    DWORD                   dwErr = NO_ERROR;
    ROUTING_PROTOCOL_EVENTS rpeEvent;
    MESSAGE                 mMessage = {0, 0, 0};

    if (!ENTER_SAMPLE_API()) { return ERROR_CAN_NOT_COMPLETE; }

    do                          // breakout loop
    {
        // set global configuration
        if (pimsid->IMSID_TypeID is IPSAMPLE_GLOBAL_CONFIG_ID)
        {
            if (pimsid->IMSID_BufferSize < sizeof(IPSAMPLE_GLOBAL_CONFIG))
            {
                dwErr = ERROR_INVALID_PARAMETER;
                break;
            }

            dwErr = CM_SetGlobalInfo((PVOID) pimsid->IMSID_Buffer);
            if (dwErr != NO_ERROR)
                break;

            rpeEvent = SAVE_GLOBAL_CONFIG_INFO;
        }
        // set interface configuration
        else if (pimsid->IMSID_TypeID is IPSAMPLE_IF_CONFIG_ID)
        {
            if (pimsid->IMSID_BufferSize < sizeof(IPSAMPLE_IF_CONFIG))
            {
                dwErr = ERROR_INVALID_PARAMETER;
                break;
            }

            dwErr = NM_SetInterfaceInfo(pimsid->IMSID_IfIndex,
                                        (PVOID) pimsid->IMSID_Buffer);
            if (dwErr != NO_ERROR)
                break;

            rpeEvent                = SAVE_INTERFACE_CONFIG_INFO;
            mMessage.InterfaceIndex = pimsid->IMSID_IfIndex;
        }
        // error, unexpected type
        else
        {
            dwErr = ERROR_INVALID_PARAMETER;
            break;
        }

        // notify router manager
        if (EnqueueEvent(rpeEvent, mMessage) is NO_ERROR)
            SetEvent(g_ce.hMgrNotificationEvent);

    } while(FALSE);

    LEAVE_SAMPLE_API();

    return dwErr;
}

Generated on Wed Nov 13 2024 16:54:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/ip/mibmgr.h File Reference

  • NetDS
  • RRas
  • ip
Functions

mibmgr.h File Reference

Go to the source code of this file.

Functions

DWORD WINAPI | MM_MibGet (IN PIPSAMPLE_MIB_GET_INPUT_DATA pimgid, OUT PIPSAMPLE_MIB_GET_OUTPUT_DATA pimgod, IN OUT PULONG pulOutputSize, IN MODE mMode)
DWORD WINAPI | MM_MibSet (IN PIPSAMPLE_MIB_SET_INPUT_DATA pimsid)

Function Documentation

DWORD WINAPI MM_MibGet | ( | IN PIPSAMPLE_MIB_GET_INPUT_DATA | pimgid,
 |  | OUT PIPSAMPLE_MIB_GET_OUTPUT_DATA | pimgod,
 |  | IN OUT PULONG | pulOutputSize,
 |  | IN MODE | mMode
 | ) |  |

Definition at line 108 of file mibmgr.c.

                           : EXACT, FIRST, and NEXT, which correspond to
    MibGet(), MibGetFirst(), and MibGetNext() respectively.

Locks
    Acquires shared      (g_ce.pneNetworkEntry)->rwlLock
    Releases             (g_ce.pneNetworkEntry)->rwlLock

Arguments
    pimgid              input data
    pimgod              output buffer
    pulOutputSize       IN  size of output buffer given
                        OUT size of output buffer needed
    mMode               query type

Return Value
    NO_ERROR            success
    Error Code          o/w

--*/
{
    DWORD               dwErr           = NO_ERROR;
    ULONG               ulSizeGiven     = 0;
    ULONG               ulSizeNeeded    = 0;
    PINTERFACE_ENTRY    pie;

    if (!ENTER_SAMPLE_API()) { return ERROR_CAN_NOT_COMPLETE; }

    // compute the size of the buffer available for storing
    // returned structures (the size of IMGOD_Buffer)
    if (*pulOutputSize < sizeof(IPSAMPLE_MIB_GET_OUTPUT_DATA))
        ulSizeGiven = 0;
    else
        ulSizeGiven = *pulOutputSize - sizeof(IPSAMPLE_MIB_GET_OUTPUT_DATA);

    switch (pimgid->IMGID_TypeID)
    {
        // the global statistics struct is fixed-length.
        // there is a single instance.
        case IPSAMPLE_GLOBAL_STATS_ID:
        {
            PIPSAMPLE_GLOBAL_STATS pigsdst, pigssrc;

            // only GET_EXACT and GET_FIRST are valid for the
            // global stats object since there is only one entry
            if (mMode is GET_NEXT)
            {
                dwErr = ERROR_NO_MORE_ITEMS;
                break;
            }

            // set the output size required for this entry
            ulSizeNeeded = sizeof(IPSAMPLE_GLOBAL_STATS);

            // check that the output buffer is big enough
            if (ulSizeGiven < ulSizeNeeded)
            {
                dwErr = ERROR_INSUFFICIENT_BUFFER;
                break;
            }

            pimgod->IMGOD_TypeID = IPSAMPLE_GLOBAL_STATS_ID;

            // since access to this structure is synchronized through
            // locked increments/decrements, we must copy it field by field
            pigssrc = &(g_ce.igsStats);
            pigsdst = (PIPSAMPLE_GLOBAL_STATS) pimgod->IMGOD_Buffer;

            pigsdst->ulNumInterfaces = pigssrc->ulNumInterfaces;

            break;
        }

        // the global configuration structure may be of variable size.
        // there is a single instance.
        case IPSAMPLE_GLOBAL_CONFIG_ID:
        {
            // only GET_EXACT and GET_FIRST are valid for the
            // global configuration object since there is only one entry
            if (mMode is GET_NEXT)
            {
                dwErr = ERROR_NO_MORE_ITEMS;
                break;
            }

            // CM_GetGlobalInfo() decides whether the buffer size is
            // sufficient.  if so, it retrieves the global configuration.
            // either case it sets the required output buffer size.
            dwErr = CM_GetGlobalInfo ((PVOID) pimgod->IMGOD_Buffer,
                                      &ulSizeGiven,
                                      NULL,
                                      NULL,
                                      NULL);
            ulSizeNeeded = ulSizeGiven;

            // check that the output buffer was big enough
            if (dwErr != NO_ERROR)
                break;

            pimgod->IMGOD_TypeID = IPSAMPLE_GLOBAL_CONFIG_ID;

            break;
        }

        // the interface statistics struct is fixed-length.
        // there may be multiple instances.
        case IPSAMPLE_IF_STATS_ID:
        {
            PIPSAMPLE_IF_STATS  piisdst, piissrc;

            ACQUIRE_READ_LOCK(&(g_ce.pneNetworkEntry)->rwlLock);

            do                  // breakout loop
            {
                // retrieve the interface whose stats are to be read
                dwErr = IE_GetIndex(pimgid->IMGID_IfIndex,
                                    mMode,
                                    &pie);
                if (dwErr != NO_ERROR)
                    break;

                // set the output size required for this entry
                ulSizeNeeded = sizeof(IPSAMPLE_IF_STATS);

                // check that the output buffer is big enough
                if (ulSizeGiven < ulSizeNeeded)
                {
                    dwErr = ERROR_INSUFFICIENT_BUFFER;
                    break;
                }

                pimgod->IMGOD_TypeID = IPSAMPLE_IF_STATS_ID;
                pimgod->IMGOD_IfIndex = pie->dwIfIndex;

                // access to this structure is synchronized through locked
                // increments/decrements, so we copy it field by field
                piissrc = &(pie->iisStats);
                piisdst = (PIPSAMPLE_IF_STATS) pimgod->IMGOD_Buffer;

                piisdst->ulNumPackets = piissrc->ulNumPackets;
            } while (FALSE);

            RELEASE_READ_LOCK(&(g_ce.pneNetworkEntry)->rwlLock);

            break;
        }

        // the interface configuration structure may be of variable size.
        // there may be multiple instances.
        case IPSAMPLE_IF_CONFIG_ID:
        {
            // get the queried interface's index
            ACQUIRE_READ_LOCK(&(g_ce.pneNetworkEntry)->rwlLock);

            do                  // breakout loop
            {
                dwErr = IE_GetIndex(pimgid->IMGID_IfIndex,
                                    mMode,
                                    &pie);
                if (dwErr != NO_ERROR)
                    break;

                // read lock acuired again, which is fine :)
                dwErr = NM_GetInterfaceInfo(pie->dwIfIndex,
                                            (PVOID) pimgod->IMGOD_Buffer,
                                            &ulSizeGiven,
                                            NULL,
                                            NULL,
                                            NULL);
                ulSizeNeeded = ulSizeGiven;

                // check that the output buffer was big enough
                if (dwErr != NO_ERROR)
                    break;

                pimgod->IMGOD_TypeID    = IPSAMPLE_IF_CONFIG_ID;
                pimgod->IMGOD_IfIndex   = pie->dwIfIndex;
            } while (FALSE);

            RELEASE_READ_LOCK(&(g_ce.pneNetworkEntry)->rwlLock);

            break;
        }

        // the interface binding structure is of variable size.
        // there may be multiple instances.
        case IPSAMPLE_IF_BINDING_ID:
        {
            PIPSAMPLE_IF_BINDING    piib;
            PIPSAMPLE_IP_ADDRESS    piia;

            ACQUIRE_READ_LOCK(&(g_ce.pneNetworkEntry)->rwlLock);

            do                  // breakout loop
            {
                // retrieve the interface whose stats are to be read
                dwErr = IE_GetIndex(pimgid->IMGID_IfIndex,
                                    mMode,
                                    &pie);
                if (dwErr != NO_ERROR)
                    break;

                // set the output size required for this entry
                ulSizeNeeded = sizeof(IPSAMPLE_IF_BINDING) +
                    pie->ulNumBindings * sizeof(IPSAMPLE_IP_ADDRESS);

                // check that the output buffer is big enough
                if (ulSizeGiven < ulSizeNeeded)
                {
                    dwErr = ERROR_INSUFFICIENT_BUFFER;
                    break;
                }

                pimgod->IMGOD_TypeID    = IPSAMPLE_IF_BINDING_ID;
                pimgod->IMGOD_IfIndex   = pie->dwIfIndex;

                piib = (PIPSAMPLE_IF_BINDING) pimgod->IMGOD_Buffer;
                piia = IPSAMPLE_IF_ADDRESS_TABLE(piib);

                if (INTERFACE_IS_ACTIVE(pie))
                    piib->dwState |= IPSAMPLE_STATE_ACTIVE;

                if (INTERFACE_IS_BOUND(pie))
                    piib->dwState |= IPSAMPLE_STATE_BOUND;

                piib->ulCount = pie->ulNumBindings;
                CopyMemory((PVOID) piia, // address,mask pairs
                           (PVOID) pie->pbeBindingTable, // ditto
                           pie->ulNumBindings * sizeof(IPSAMPLE_IP_ADDRESS));
            } while (FALSE);

            RELEASE_READ_LOCK(&(g_ce.pneNetworkEntry)->rwlLock);

            break;
        }

        default:
        {
            dwErr = ERROR_INVALID_PARAMETER;
            break;
        }
    }

    *pulOutputSize = sizeof(IPSAMPLE_MIB_GET_OUTPUT_DATA) + ulSizeNeeded;

    LEAVE_SAMPLE_API();

    return dwErr;
}

DWORD WINAPI MM_MibSet ( IN PIPSAMPLE_MIB_SET_INPUT_DATA pimsid )

Definition at line 25 of file mibmgr.c.

{
    DWORD                   dwErr = NO_ERROR;
    ROUTING_PROTOCOL_EVENTS rpeEvent;
    MESSAGE                 mMessage = {0, 0, 0};

    if (!ENTER_SAMPLE_API()) { return ERROR_CAN_NOT_COMPLETE; }

    do                          // breakout loop
    {
        // set global configuration
        if (pimsid->IMSID_TypeID is IPSAMPLE_GLOBAL_CONFIG_ID)
        {
            if (pimsid->IMSID_BufferSize < sizeof(IPSAMPLE_GLOBAL_CONFIG))
            {
                dwErr = ERROR_INVALID_PARAMETER;
                break;
            }

            dwErr = CM_SetGlobalInfo((PVOID) pimsid->IMSID_Buffer);
            if (dwErr != NO_ERROR)
                break;

            rpeEvent = SAVE_GLOBAL_CONFIG_INFO;
        }
        // set interface configuration
        else if (pimsid->IMSID_TypeID is IPSAMPLE_IF_CONFIG_ID)
        {
            if (pimsid->IMSID_BufferSize < sizeof(IPSAMPLE_IF_CONFIG))
            {
                dwErr = ERROR_INVALID_PARAMETER;
                break;
            }

            dwErr = NM_SetInterfaceInfo(pimsid->IMSID_IfIndex,
                                        (PVOID) pimsid->IMSID_Buffer);
            if (dwErr != NO_ERROR)
                break;

            rpeEvent                = SAVE_INTERFACE_CONFIG_INFO;
            mMessage.InterfaceIndex = pimsid->IMSID_IfIndex;
        }
        // error, unexpected type
        else
        {
            dwErr = ERROR_INVALID_PARAMETER;
            break;
        }

        // notify router manager
        if (EnqueueEvent(rpeEvent, mMessage) is NO_ERROR)
            SetEvent(g_ce.hMgrNotificationEvent);

    } while(FALSE);

    LEAVE_SAMPLE_API();

    return dwErr;
}

Generated on Wed Nov 13 2024 16:54:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/ip/networkentry.c File Reference

  • NetDS
  • RRas
  • ip
Defines | Functions

networkentry.c File Reference

#include "pchsample.h"

Go to the source code of this file.

Defines

#define | DisplayIndexInterfaceEntry NULL
#define | DisplayInterfaceEntry NULL

Functions

DWORD | BE_CreateTable (IN PIP_ADAPTER_BINDING_INFO pBinding, OUT PBINDING_ENTRY *ppbeBindingTable, OUT PIPADDRESS pipLowestAddress)
DWORD | BE_DestroyTable (IN PBINDING_ENTRY pbeBindingTable)
DWORD | IE_ActivateInterface (IN PINTERFACE_ENTRY pie)
DWORD | IE_BindInterface (IN PINTERFACE_ENTRY pie, IN PIP_ADAPTER_BINDING_INFO pBinding)
DWORD | IE_Create (IN PWCHAR pwszIfName, IN DWORD dwIfIndex, IN WORD wAccessType, OUT PINTERFACE_ENTRY *ppieInterfaceEntry)
DWORD | IE_DeactivateInterface (IN PINTERFACE_ENTRY pie)
DWORD | IE_Delete (IN DWORD dwIfIndex, OUT PINTERFACE_ENTRY *ppieIfEntry)
DWORD | IE_Destroy (IN PINTERFACE_ENTRY pieInterfaceEntry)
DWORD | IE_Get (IN DWORD dwIfIndex, OUT PINTERFACE_ENTRY *ppieIfEntry)
DWORD | IE_GetIndex (IN DWORD dwIfIndex, IN MODE mMode, OUT PINTERFACE_ENTRY *ppieIfEntry)
DWORD | IE_Insert (IN PINTERFACE_ENTRY pieIfEntry)
BOOL | IE_IsPresent (IN DWORD dwIfIndex)
DWORD | IE_UnBindInterface (IN PINTERFACE_ENTRY pie)
DWORD | NE_Create (OUT PNETWORK_ENTRY *ppneNetworkEntry)
DWORD | NE_Destroy (IN PNETWORK_ENTRY pneNetworkEntry)

Define Documentation

#define DisplayIndexInterfaceEntry NULL

Definition at line 336 of file networkentry.c.

#define DisplayInterfaceEntry NULL

Definition at line 199 of file networkentry.c.

Function Documentation

DWORD BE_CreateTable | ( | IN PIP_ADAPTER_BINDING_INFO | pBinding,
 |  | OUT PBINDING_ENTRY * | ppbeBindingTable,
 |  | OUT PIPADDRESS | pipLowestAddress
 | ) |  |

Definition at line 21 of file networkentry.c.

{
    ULONG               i;
    DWORD               dwErr = NO_ERROR;
    PBINDING_ENTRY      pbe; // scratch

    // validate parameters
    if (!pBinding or !ppbeBindingTable or !pipLowestAddress)
        return ERROR_INVALID_PARAMETER;

    // a binding already exists
    if (*ppbeBindingTable != NULL)
        return ERROR_INVALID_PARAMETER;

    IP_ASSIGN(pipLowestAddress, IP_HIGHEST);

    do                          // breakout loop
    {
        if (pBinding->AddressCount is 0)
        {
            dwErr = ERROR_INVALID_PARAMETER;
            TRACE0(NETWORK, "Error, no bindings specified");
            break;
        }

        for (i = 0; i < pBinding->AddressCount; i++)
            if (!IP_VALID((pBinding->Address)[i].Address))
                break;
        if (i != pBinding->AddressCount)
        {
            dwErr = ERROR_INVALID_PARAMETER;
            TRACE0(NETWORK, "Error, an invalid binding specified");
            break;
        }

        // allocate the binding table
        MALLOC(&pbe, pBinding->AddressCount * sizeof(BINDING_ENTRY), &dwErr);
        if (dwErr != NO_ERROR)
            break;

        for (i = 0; i < pBinding->AddressCount; i++)
        {
            // initialize fields
            IP_ASSIGN(&(pbe[i].ipAddress), (pBinding->Address)[i].Address);
            IP_ASSIGN(&(pbe[i].ipMask), pBinding->Address[i].Mask);

            // update lowest ip address
            if (IP_COMPARE(pbe[i].ipAddress, *pipLowestAddress) is -1)
                IP_ASSIGN(pipLowestAddress,pbe[i].ipAddress);
        }

        *ppbeBindingTable = pbe;

    } while (FALSE);

    return dwErr;
}

DWORD BE_DestroyTable ( IN PBINDING_ENTRY pbeBindingTable )

Definition at line 104 of file networkentry.c.

{
    if (!pbeBindingTable)
        return NO_ERROR;

    FREE(pbeBindingTable);

    return NO_ERROR;
}

DWORD IE_ActivateInterface ( IN PINTERFACE_ENTRY pie )

Definition at line 1025 of file networkentry.c.

{
    DWORD   dwErr = NO_ERROR;

    do                          // breakout loop
    {
        // fail if the interface is already active
        if (INTERFACE_IS_ACTIVE(pie))
        {
            dwErr = ERROR_INVALID_PARAMETER;
            TRACE0(NETWORK, "Interface already active");
            break;
        }

        // set the "active" flag
        pie->dwFlags |= IEFLAG_ACTIVE;

        // create a socket for the interface
        dwErr = SocketCreate(pie->ipAddress,
                             pie->hReceiveEvent,
                             &(pie->sRawSocket));
        if (dwErr != NO_ERROR)
        {
            TRACE1(NETWORK, "Error creating socket for %s",
                   INET_NTOA(pie->ipAddress));
            break;
        }

        // start timer for sending protocol packets
        CREATE_TIMER(&pie->hPeriodicTimer ,
                     NM_CallbackPeriodicTimer,
                     (PVOID) pie->dwIfIndex,
                     PERIODIC_INTERVAL,
                     &dwErr);
        if (dwErr != NO_ERROR)
            break;
    } while (FALSE);

    if (dwErr != NO_ERROR)
    {
        TRACE3(NETWORK, "Error %u activating interface %S (%u)",
               dwErr, pie->pwszIfName, pie->dwIfIndex);
        IE_DeactivateInterface(pie);
    }

    return dwErr;
}

DWORD IE_BindInterface | ( | IN PINTERFACE_ENTRY | pie,
 |  | IN PIP_ADAPTER_BINDING_INFO | pBinding
 | ) |  |

Definition at line 924 of file networkentry.c.

{
    DWORD   dwErr = NO_ERROR;

    do                          // breakout loop
    {
        // fail if the interface is already bound
        if (INTERFACE_IS_BOUND(pie))
        {
            dwErr = ERROR_INVALID_PARAMETER;
            TRACE2(NETWORK, "Error interface %S (%u) is already bound",
                   pie->pwszIfName, pie->dwIfIndex);
            break;
        }

        dwErr = BE_CreateTable (pBinding,
                                &(pie->pbeBindingTable),
                                &(pie->ipAddress));
        if (dwErr != NO_ERROR)
            break;

        pie->ulNumBindings = pBinding->AddressCount;

        // set the "bound" flag
        pie->dwFlags |= IEFLAG_BOUND;
    } while (FALSE);

    return dwErr;
}

DWORD IE_Create | ( | IN PWCHAR | pwszIfName,
 |  | IN DWORD | dwIfIndex,
 |  | IN WORD | wAccessType,
 |  | OUT PINTERFACE_ENTRY * | ppieInterfaceEntry
 | ) |  |

Definition at line 382 of file networkentry.c.

{
    DWORD               dwErr = NO_ERROR;
    ULONG               ulNameLength;
    PINTERFACE_ENTRY    pieEntry; // scratch

    // validate parameters
    if (!ppieInterfaceEntry || !pwszIfName)
        return ERROR_INVALID_PARAMETER;

    *ppieInterfaceEntry = NULL;

    do                          // breakout loop
    {
        // allocate and zero out the interface entry structure
        MALLOC(&pieEntry, sizeof(INTERFACE_ENTRY), &dwErr);
        if (dwErr != NO_ERROR)
            break;

        // initialize fields with default values

        InitializeListHead(&(pieEntry->leInterfaceTableLink));
        InitializeListHead(&(pieEntry->leIndexSortedListLink));

        // pieEntry->pwszIfName         = NULL;

        pieEntry->dwIfIndex             = dwIfIndex;

        // pieEntry->ulNumBindings      = 0;
        // pieEntry->pbeBindingTable    = NULL;

        // pieEntry->dwFlags            = 0; // disabled unbound pointtopoint
        if (wAccessType is IF_ACCESS_BROADCAST)
            pieEntry->dwFlags           |= IEFLAG_MULTIACCESS;

        IP_ASSIGN(&(pieEntry->ipAddress), IP_LOWEST);
        pieEntry->sRawSocket            = INVALID_SOCKET;

        // pieEntry->hReceiveEvent      = NULL;
        // pieEntry->hReceiveWait       = NULL;

        // pieEntry->hPeriodicTimer     = NULL;

        // pieEntry->ulMetric           = 0;

        // pieEntry->iisStats           zero'ed out

        // initialize name
        ulNameLength = wcslen(pwszIfName) + 1;
        MALLOC(&(pieEntry->pwszIfName), ulNameLength * sizeof(WCHAR), &dwErr);
        if(dwErr != NO_ERROR)
            break;
        wcsncpy(pieEntry->pwszIfName, pwszIfName, ulNameLength-1);

        // initialize   ReceiveEvent (signalled when input arrives).
        // Auto-Reset Event: state automatically reset to nonsignaled after
        // a single waiting thread is released.  Initially non signalled
        pieEntry->hReceiveEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
        if (pieEntry->hReceiveEvent is NULL)
        {
            dwErr = GetLastError();
            TRACE1(NETWORK, "Error %u creating Receive Event", dwErr);
            LOGERR0(CREATE_EVENT_FAILED, dwErr);

            break;
        }

        // register     ReceiveWait for this interface
        if (!RegisterWaitForSingleObject(&(pieEntry->hReceiveWait),
                                         pieEntry->hReceiveEvent,
                                         NM_CallbackNetworkEvent,
                                         (PVOID) dwIfIndex,
                                         INFINITE,
                                         WT_EXECUTEONLYONCE))
        {
            dwErr = GetLastError();
            TRACE1(NETWORK, "Error %u registering ReceiveWait", dwErr);
            LOGERR0(REGISTER_WAIT_FAILED, dwErr);

            break;
        }

        *ppieInterfaceEntry = pieEntry; // all's well :)
    } while (FALSE);

    if (dwErr != NO_ERROR)
    {
        // something went wrong, so cleanup.
        TRACE2(NETWORK, "Failed to create interface entry for %S (%u)",
               pwszIfName, dwIfIndex);
        IE_Destroy(pieEntry);
    }

    return dwErr;
}

DWORD IE_DeactivateInterface ( IN PINTERFACE_ENTRY pie )

Definition at line 1095 of file networkentry.c.

{
    DWORD   dwErr = NO_ERROR;

    do                          // breakout loop
    {
        // fail if the interface is already inactive
        if (INTERFACE_IS_INACTIVE(pie))
        {
            dwErr = ERROR_INVALID_PARAMETER;
            TRACE2(NETWORK, "interface %S (%u) already inactive",
                   pie->pwszIfName, pie->dwIfIndex);
            break;
        }

        // stop the timer
        if (pie->hPeriodicTimer)
            DELETE_TIMER(pie->hPeriodicTimer, &dwErr);
        pie->hPeriodicTimer = NULL;

        // destroy the socket for the interface
        dwErr = SocketDestroy(pie->sRawSocket);
        pie->sRawSocket     = INVALID_SOCKET;

        // clear the "active" flag
        pie->dwFlags &= ~IEFLAG_ACTIVE;
    } while (FALSE);

    return dwErr;
}

DWORD IE_Delete | ( | IN DWORD | dwIfIndex,
 |  | OUT PINTERFACE_ENTRY * | ppieIfEntry
 | ) |  |

Definition at line 669 of file networkentry.c.

{
    DWORD           dwErr           = NO_ERROR;
    INTERFACE_ENTRY ieKey;
    PLIST_ENTRY     pleListEntry    = NULL;

    *ppieIfEntry = NULL;

    do                          // breakout loop
    {
        // remove from interface table (primary)
        ZeroMemory(&ieKey, sizeof(INTERFACE_ENTRY));
        ieKey.dwIfIndex = dwIfIndex;

        dwErr = HT_DeleteEntry((g_ce.pneNetworkEntry)->phtInterfaceTable,
                               &(ieKey.leInterfaceTableLink),
                               &pleListEntry);
        if (dwErr != NO_ERROR)
        {
            TRACE1(NETWORK, "Error interface %u has vanished", dwIfIndex);
            LOGWARN0(INTERFACE_ABSENT, dwErr);
            break;
        }

        *ppieIfEntry = CONTAINING_RECORD(pleListEntry,
                                         INTERFACE_ENTRY,
                                         leInterfaceTableLink);

        // remove from all other tables, lists... (secondary)
        RemoveEntryList(&((*ppieIfEntry)->leIndexSortedListLink));

        // initialize pointers to indicate that the entry has been deleted
        InitializeListHead(&((*ppieIfEntry)->leInterfaceTableLink));
        InitializeListHead(&((*ppieIfEntry)->leIndexSortedListLink));
    } while (FALSE);

    return dwErr;
}

DWORD IE_Destroy ( IN PINTERFACE_ENTRY pieInterfaceEntry )

Definition at line 507 of file networkentry.c.

        : Should NOT be called with g_ce.neNetworkEntry.rwlLock held!  The
    call to UnregisterWaitEx blocks till all queued callbacks for
    pieInterfaceEntry->hReceiveEvent finish execution.  These callbacks may
    acquire g_ce.neNetworkEntry.rwlLock, causing deadlock.

Arguments
    pieInterfaceEntry   pointer to the interface entry

Return Value
    NO_ERROR            always

--*/
{
    if (!pieInterfaceEntry)
        return NO_ERROR;

    if (INTERFACE_IS_BOUND(pieInterfaceEntry))
        IE_UnBindInterface(pieInterfaceEntry);

    if (INTERFACE_IS_ACTIVE(pieInterfaceEntry))
        IE_DeactivateInterface(pieInterfaceEntry);

    // PeriodicTimer should have been destroyed
    RTASSERT(pieInterfaceEntry->hPeriodicTimer is NULL);

    // deregister   ReceiveWait
    if (pieInterfaceEntry->hReceiveWait)
        UnregisterWaitEx(pieInterfaceEntry->hReceiveWait,
                         INVALID_HANDLE_VALUE);

    // delete       ReceiveEvent
    if (pieInterfaceEntry->hReceiveEvent)
        CloseHandle(pieInterfaceEntry->hReceiveEvent);

    // BindingTable and RawSocket should have been destroyed
    RTASSERT(pieInterfaceEntry->pbeBindingTable is NULL);
    RTASSERT(pieInterfaceEntry->sRawSocket is INVALID_SOCKET);

    // delete       IfName
    FREE(pieInterfaceEntry->pwszIfName);

    // Entry should have been removed from all access structures
    RTASSERT(IsListEmpty(&(pieInterfaceEntry->leInterfaceTableLink)));
    RTASSERT(IsListEmpty(&(pieInterfaceEntry->leIndexSortedListLink)));

    // deallocate the interface entry structure
    FREE(pieInterfaceEntry);

    return NO_ERROR;
}

DWORD IE_Get | ( | IN DWORD | dwIfIndex,
 |  | OUT PINTERFACE_ENTRY * | ppieIfEntry
 | ) |  |

Definition at line 765 of file networkentry.c.

{
    DWORD           dwErr           = NO_ERROR;
    INTERFACE_ENTRY ieKey;
    PLIST_ENTRY     pleListEntry    = NULL;

    *ppieIfEntry = NULL;

    do                          // breakout loop
    {
        ZeroMemory(&ieKey, sizeof(INTERFACE_ENTRY));
        ieKey.dwIfIndex = dwIfIndex;

        dwErr = HT_GetEntry((g_ce.pneNetworkEntry)->phtInterfaceTable,
                            &(ieKey.leInterfaceTableLink),
                            &pleListEntry);

        if (dwErr != NO_ERROR)
        {
            TRACE1(NETWORK, "Error interface %u has vanished", dwIfIndex);
            LOGWARN0(INTERFACE_ABSENT, dwErr);
            break;
        }

        *ppieIfEntry = CONTAINING_RECORD(pleListEntry,
                                         INTERFACE_ENTRY,
                                         leInterfaceTableLink);
    } while (FALSE);

    return dwErr;
}

DWORD IE_GetIndex | ( | IN DWORD | dwIfIndex,
 |  | IN MODE | mMode,
 |  | OUT PINTERFACE_ENTRY * | ppieIfEntry
 | ) |  |

Definition at line 821 of file networkentry.c.

{
    INTERFACE_ENTRY ieKey;
    PLIST_ENTRY     pleHead = NULL, pleEntry = NULL;

    if (!ppieIfEntry)
    {
        return ERROR_INVALID_PARAMETER;
    }

    *ppieIfEntry = NULL;

    pleHead = &((g_ce.pneNetworkEntry)->leIndexSortedList);

    if (IsListEmpty(pleHead))
        return ERROR_NO_MORE_ITEMS;

    ZeroMemory(&ieKey, sizeof(INTERFACE_ENTRY));
    ieKey.dwIfIndex = (mMode is GET_FIRST) ? 0 : dwIfIndex;

    // this either gets the exact match or the next entry
    FindSortedList(pleHead,
                   &(ieKey.leIndexSortedListLink),
                   &pleEntry,
                   CompareIndexInterfaceEntry);

    // reached end of list
    if (pleEntry is NULL)
    {
        RTASSERT(mMode != GET_FIRST); // should have got the first entry
        return ERROR_NO_MORE_ITEMS;
    }

    *ppieIfEntry = CONTAINING_RECORD(pleEntry,
                                     INTERFACE_ENTRY,
                                     leIndexSortedListLink);

    switch (mMode)
    {
        case GET_FIRST:
            return NO_ERROR;

        case GET_EXACT:
            // found an exact match
            if ((*ppieIfEntry)->dwIfIndex is dwIfIndex)
                return NO_ERROR;
            else
            {
                *ppieIfEntry = NULL;
                return ERROR_NO_MORE_ITEMS;
            }

        case GET_NEXT:
            // found an exact match
            if ((*ppieIfEntry)->dwIfIndex is dwIfIndex)
            {
                pleEntry = pleEntry->Flink; // get next entry
                if (pleEntry is pleHead)    // end of list
                {
                    *ppieIfEntry = NULL;
                    return ERROR_NO_MORE_ITEMS;
                }

                *ppieIfEntry = CONTAINING_RECORD(pleEntry,
                                                 INTERFACE_ENTRY,
                                                 leIndexSortedListLink);
            }

            return NO_ERROR;

        default:
            RTASSERT(FALSE);    // never reached
    }

    return NO_ERROR;
}

DWORD IE_Insert ( IN PINTERFACE_ENTRY pieIfEntry )

Definition at line 622 of file networkentry.c.

{
    DWORD dwErr = NO_ERROR;

    do                          // breakout loop
    {
        dwErr = HT_InsertEntry((g_ce.pneNetworkEntry)->phtInterfaceTable,
                               &(pieIfEntry->leInterfaceTableLink));
        if (dwErr != NO_ERROR)
        {
            TRACE2(NETWORK, "Error interface %S (%u) already exists",
                   pieIfEntry->pwszIfName, pieIfEntry->dwIfIndex);
            LOGERR0(INTERFACE_PRESENT, dwErr);
            break;
        }

        // insert in all tables, lists...
        InsertSortedList(&((g_ce.pneNetworkEntry)->leIndexSortedList),
                         &(pieIfEntry->leIndexSortedListLink),
                         CompareIndexInterfaceEntry);
    } while (FALSE);

    return dwErr;
}

BOOL IE_IsPresent ( IN DWORD dwIfIndex )

Definition at line 732 of file networkentry.c.

{
    DWORD           dwErr = NO_ERROR;
    INTERFACE_ENTRY ieKey;

    ZeroMemory(&ieKey, sizeof(INTERFACE_ENTRY));
    ieKey.dwIfIndex = dwIfIndex;

    return HT_IsPresentEntry((g_ce.pneNetworkEntry)->phtInterfaceTable,
                             &(ieKey.leInterfaceTableLink));
}

DWORD IE_UnBindInterface ( IN PINTERFACE_ENTRY pie )

Definition at line 977 of file networkentry.c.

{
    DWORD   dwErr = NO_ERROR;

    do                          // breakout loop
    {
        // fail if the interface is already unbound
        if (INTERFACE_IS_UNBOUND(pie))
        {
            dwErr = ERROR_INVALID_PARAMETER;
            TRACE2(NETWORK, "interface %S (%u) already unbound",
                   pie->pwszIfName, pie->dwIfIndex);
            break;
        }

        // clear the "bound" flag
        pie->dwFlags &= ~IEFLAG_BOUND;

        IP_ASSIGN(&(pie->ipAddress), IP_LOWEST);

        BE_DestroyTable(pie->pbeBindingTable);
        pie->pbeBindingTable    = NULL;
        pie->ulNumBindings      = 0;
    } while (FALSE);

    return dwErr;
}

DWORD NE_Create ( OUT PNETWORK_ENTRY * ppneNetworkEntry )

Definition at line 1146 of file networkentry.c.

{
    DWORD           dwErr = NO_ERROR;
    PNETWORK_ENTRY  pneEntry;   // scratch

    // validate parameters
    if (!ppneNetworkEntry)
        return ERROR_INVALID_PARAMETER;

    *ppneNetworkEntry = NULL;

    do                          // breakout loop
    {
        // allocate and zero out the network entry structure
        MALLOC(&pneEntry, sizeof(NETWORK_ENTRY), &dwErr);
        if (dwErr != NO_ERROR)
            break;

        // initialize fields with default values

        // pneEntry->rwlLock                zero'ed out

        // pneEntry->phtInterfaceTable      = NULL;

        InitializeListHead(&(pneEntry->leIndexSortedList));

        // initialize the read-write lock
        dwErr = CREATE_READ_WRITE_LOCK(&(pneEntry->rwlLock));
        if (dwErr != NO_ERROR)
        {
            TRACE1(NETWORK, "Error %u creating read-write-lock", dwErr);
            LOGERR0(CREATE_RWL_FAILED, dwErr);

            break;
        }

        // allocate the interface table
        dwErr = HT_Create(GLOBAL_HEAP,
                          INTERFACE_TABLE_BUCKETS,
                          DisplayInterfaceEntry,
                          FreeInterfaceEntry,
                          HashInterfaceEntry,
                          CompareInterfaceEntry,
                          &(pneEntry->phtInterfaceTable));
        if (dwErr != NO_ERROR)
        {
            TRACE1(NETWORK, "Error %u creating hash-table", dwErr);
            LOGERR0(CREATE_HASHTABLE_FAILED, dwErr);

            break;
        }

        *ppneNetworkEntry = pneEntry;
    } while (FALSE);

    if (dwErr != NO_ERROR)
    {
        // something went wrong, so cleanup.
        TRACE0(NETWORK, "Failed to create nework entry");
        NE_Destroy(pneEntry);
        pneEntry = NULL;
    }

    return dwErr;
}

DWORD NE_Destroy ( IN PNETWORK_ENTRY pneNetworkEntry )

Definition at line 1236 of file networkentry.c.

{
    if (!pneNetworkEntry)
        return NO_ERROR;

    // deallocate the interface table...
    // this removes the interface entries from all secondary access
    // structures (IndexSortedList, ...) as well since all of them
    // share interface entries by containing pointers to the same object.
    HT_Destroy(GLOBAL_HEAP, pneNetworkEntry->phtInterfaceTable);
    pneNetworkEntry->phtInterfaceTable = NULL;

    RTASSERT(IsListEmpty(&(pneNetworkEntry->leIndexSortedList)));

    // delete read-write-lock
    if (READ_WRITE_LOCK_CREATED(&(pneNetworkEntry->rwlLock)))
        DELETE_READ_WRITE_LOCK(&(pneNetworkEntry->rwlLock));

    // deallocate the network entry structure
    FREE(pneNetworkEntry);

    return NO_ERROR;
}

Generated on Wed Nov 13 2024 16:54:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/ip/networkentry.h File Reference

  • NetDS
  • RRas
  • ip
Classes | Defines | Typedefs | Enumerations | Functions

networkentry.h File Reference

Go to the source code of this file.

Classes

struct | _BINDING_ENTRY
struct | _INTERFACE_ENTRY
struct | _NETWORK_ENTRY

Defines

#define | BE_Display(pbe)
#define | BE_FindTable(table, num, address, mask, pindex)
#define | IE_Display(pieInterfaceEntry)
#define | IEFLAG_ACTIVE 0x00000001
#define | IEFLAG_BOUND 0x00000002
#define | IEFLAG_MULTIACCESS 0x00000004
#define | INTERFACE_IS_ACTIVE(i) ((i)->dwFlags & IEFLAG_ACTIVE)
#define | INTERFACE_IS_BOUND(i) ((i)->dwFlags & IEFLAG_BOUND)
#define | INTERFACE_IS_INACTIVE(i) !INTERFACE_IS_ACTIVE(i)
#define | INTERFACE_IS_MULTIACCESS(i) ((i)->dwFlags & IEFLAG_MULTIACCESS)
#define | INTERFACE_IS_POINTTOPOINT(i) !INTERFACE_IS_MULTIACCESS(i)
#define | INTERFACE_IS_UNBOUND(i) !INTERFACE_IS_BOUND(i)
#define | NE_Display(pneNetworkEntry)

Typedefs

typedef struct _BINDING_ENTRY | BINDING_ENTRY
typedef struct _INTERFACE_ENTRY | INTERFACE_ENTRY
typedef struct _NETWORK_ENTRY | NETWORK_ENTRY
typedef struct _BINDING_ENTRY * | PBINDING_ENTRY
typedef struct _INTERFACE_ENTRY * | PINTERFACE_ENTRY
typedef struct _NETWORK_ENTRY * | PNETWORK_ENTRY

Enumerations

enum | MODE { GET_EXACT, GET_FIRST, GET_NEXT }

Functions

DWORD | BE_CreateTable (IN PIP_ADAPTER_BINDING_INFO pBinding, OUT PBINDING_ENTRY *ppbeBindingTable, OUT PIPADDRESS pipLowestAddress)
DWORD | BE_DestroyTable (IN PBINDING_ENTRY pbeBindingTable)
DWORD | IE_ActivateInterface (IN PINTERFACE_ENTRY pie)
DWORD | IE_BindInterface (IN PINTERFACE_ENTRY pie, IN PIP_ADAPTER_BINDING_INFO pBinding)
DWORD | IE_Create (IN PWCHAR pwszIfName, IN DWORD dwIfIndex, IN WORD wAccessType, OUT PINTERFACE_ENTRY *ppieInterfaceEntry)
DWORD | IE_DeactivateInterface (IN PINTERFACE_ENTRY pie)
DWORD | IE_Delete (IN DWORD dwIfIndex, OUT PINTERFACE_ENTRY *ppieIfEntry)
DWORD | IE_Destroy (IN PINTERFACE_ENTRY pieInterfaceEntry)
DWORD | IE_Get (IN DWORD dwIfIndex, OUT PINTERFACE_ENTRY *ppieIfEntry)
DWORD | IE_GetIndex (IN DWORD dwIfIndex, IN MODE mMode, OUT PINTERFACE_ENTRY *ppieIfEntry)
DWORD | IE_Insert (IN PINTERFACE_ENTRY pieIfEntry)
BOOL | IE_IsPresent (IN DWORD dwIfIndex)
DWORD | IE_UnBindInterface (IN PINTERFACE_ENTRY pie)
DWORD | NE_Create (OUT PNETWORK_ENTRY *ppneNetworkEntry)
DWORD | NE_Destroy (IN PNETWORK_ENTRY pneNetworkEntry)

Define Documentation

#define BE_Display ( pbe )

Definition at line 55 of file networkentry.h.

#define BE_FindTable | ( | table,
 |  | num,
 |  | address,
 |  | mask,
 |  | pindex
 | ) |
Value:
{                                                                       \
    for (*(pindex) = 0; *(pindex) < (num); (*(pindex))++)               \
        if (!IP_COMPARE((table)[*(pindex)].ipAddress, (address)) and    \
            !IP_COMPARE((table)[*(pindex)].ipMask, (mask)))             \
            break;                                                      \
}

Definition at line 69 of file networkentry.h.

#define IE_Display ( pieInterfaceEntry )

Definition at line 173 of file networkentry.h.

#define IEFLAG_ACTIVE 0x00000001

Definition at line 131 of file networkentry.h.

#define IEFLAG_BOUND 0x00000002

Definition at line 132 of file networkentry.h.

#define IEFLAG_MULTIACCESS 0x00000004

Definition at line 133 of file networkentry.h.

#define INTERFACE_IS_ACTIVE ( i ) ((i)->dwFlags & IEFLAG_ACTIVE)

Definition at line 137 of file networkentry.h.

#define INTERFACE_IS_BOUND ( i ) ((i)->dwFlags & IEFLAG_BOUND)

Definition at line 143 of file networkentry.h.

#define INTERFACE_IS_INACTIVE ( i ) !INTERFACE_IS_ACTIVE(i)

Definition at line 140 of file networkentry.h.

#define INTERFACE_IS_MULTIACCESS ( i ) ((i)->dwFlags & IEFLAG_MULTIACCESS)

Definition at line 149 of file networkentry.h.

#define INTERFACE_IS_POINTTOPOINT ( i ) !INTERFACE_IS_MULTIACCESS(i)

Definition at line 152 of file networkentry.h.

#define INTERFACE_IS_UNBOUND ( i ) !INTERFACE_IS_BOUND(i)

Definition at line 146 of file networkentry.h.

#define NE_Display ( pneNetworkEntry )

Definition at line 258 of file networkentry.h.

Typedef Documentation

typedef struct _BINDING_ENTRY BINDING_ENTRY
typedef struct _INTERFACE_ENTRY INTERFACE_ENTRY
typedef struct _NETWORK_ENTRY NETWORK_ENTRY
typedef struct _BINDING_ENTRY * PBINDING_ENTRY
typedef struct _INTERFACE_ENTRY * PINTERFACE_ENTRY
typedef struct _NETWORK_ENTRY * PNETWORK_ENTRY

Enumeration Type Documentation

enum MODE
Enumerator:
GET_EXACT
GET_FIRST
GET_NEXT

Definition at line 89 of file networkentry.h.

{ GET_EXACT, GET_FIRST, GET_NEXT } MODE;

Function Documentation

DWORD BE_CreateTable | ( | IN PIP_ADAPTER_BINDING_INFO | pBinding,
 |  | OUT PBINDING_ENTRY * | ppbeBindingTable,
 |  | OUT PIPADDRESS | pipLowestAddress
 | ) |  |

Definition at line 21 of file networkentry.c.

{
    ULONG               i;
    DWORD               dwErr = NO_ERROR;
    PBINDING_ENTRY      pbe; // scratch

    // validate parameters
    if (!pBinding or !ppbeBindingTable or !pipLowestAddress)
        return ERROR_INVALID_PARAMETER;

    // a binding already exists
    if (*ppbeBindingTable != NULL)
        return ERROR_INVALID_PARAMETER;

    IP_ASSIGN(pipLowestAddress, IP_HIGHEST);

    do                          // breakout loop
    {
        if (pBinding->AddressCount is 0)
        {
            dwErr = ERROR_INVALID_PARAMETER;
            TRACE0(NETWORK, "Error, no bindings specified");
            break;
        }

        for (i = 0; i < pBinding->AddressCount; i++)
            if (!IP_VALID((pBinding->Address)[i].Address))
                break;
        if (i != pBinding->AddressCount)
        {
            dwErr = ERROR_INVALID_PARAMETER;
            TRACE0(NETWORK, "Error, an invalid binding specified");
            break;
        }

        // allocate the binding table
        MALLOC(&pbe, pBinding->AddressCount * sizeof(BINDING_ENTRY), &dwErr);
        if (dwErr != NO_ERROR)
            break;

        for (i = 0; i < pBinding->AddressCount; i++)
        {
            // initialize fields
            IP_ASSIGN(&(pbe[i].ipAddress), (pBinding->Address)[i].Address);
            IP_ASSIGN(&(pbe[i].ipMask), pBinding->Address[i].Mask);

            // update lowest ip address
            if (IP_COMPARE(pbe[i].ipAddress, *pipLowestAddress) is -1)
                IP_ASSIGN(pipLowestAddress,pbe[i].ipAddress);
        }

        *ppbeBindingTable = pbe;

    } while (FALSE);

    return dwErr;
}

DWORD BE_DestroyTable ( IN PBINDING_ENTRY pbeBindingTable )

Definition at line 104 of file networkentry.c.

{
    if (!pbeBindingTable)
        return NO_ERROR;

    FREE(pbeBindingTable);

    return NO_ERROR;
}

DWORD IE_ActivateInterface ( IN PINTERFACE_ENTRY pie )

Definition at line 1025 of file networkentry.c.

{
    DWORD   dwErr = NO_ERROR;

    do                          // breakout loop
    {
        // fail if the interface is already active
        if (INTERFACE_IS_ACTIVE(pie))
        {
            dwErr = ERROR_INVALID_PARAMETER;
            TRACE0(NETWORK, "Interface already active");
            break;
        }

        // set the "active" flag
        pie->dwFlags |= IEFLAG_ACTIVE;

        // create a socket for the interface
        dwErr = SocketCreate(pie->ipAddress,
                             pie->hReceiveEvent,
                             &(pie->sRawSocket));
        if (dwErr != NO_ERROR)
        {
            TRACE1(NETWORK, "Error creating socket for %s",
                   INET_NTOA(pie->ipAddress));
            break;
        }

        // start timer for sending protocol packets
        CREATE_TIMER(&pie->hPeriodicTimer ,
                     NM_CallbackPeriodicTimer,
                     (PVOID) pie->dwIfIndex,
                     PERIODIC_INTERVAL,
                     &dwErr);
        if (dwErr != NO_ERROR)
            break;
    } while (FALSE);

    if (dwErr != NO_ERROR)
    {
        TRACE3(NETWORK, "Error %u activating interface %S (%u)",
               dwErr, pie->pwszIfName, pie->dwIfIndex);
        IE_DeactivateInterface(pie);
    }

    return dwErr;
}

DWORD IE_BindInterface | ( | IN PINTERFACE_ENTRY | pie,
 |  | IN PIP_ADAPTER_BINDING_INFO | pBinding
 | ) |  |

Definition at line 924 of file networkentry.c.

{
    DWORD   dwErr = NO_ERROR;

    do                          // breakout loop
    {
        // fail if the interface is already bound
        if (INTERFACE_IS_BOUND(pie))
        {
            dwErr = ERROR_INVALID_PARAMETER;
            TRACE2(NETWORK, "Error interface %S (%u) is already bound",
                   pie->pwszIfName, pie->dwIfIndex);
            break;
        }

        dwErr = BE_CreateTable (pBinding,
                                &(pie->pbeBindingTable),
                                &(pie->ipAddress));
        if (dwErr != NO_ERROR)
            break;

        pie->ulNumBindings = pBinding->AddressCount;

        // set the "bound" flag
        pie->dwFlags |= IEFLAG_BOUND;
    } while (FALSE);

    return dwErr;
}

DWORD IE_Create | ( | IN PWCHAR | pwszIfName,
 |  | IN DWORD | dwIfIndex,
 |  | IN WORD | wAccessType,
 |  | OUT PINTERFACE_ENTRY * | ppieInterfaceEntry
 | ) |  |

Definition at line 382 of file networkentry.c.

{
    DWORD               dwErr = NO_ERROR;
    ULONG               ulNameLength;
    PINTERFACE_ENTRY    pieEntry; // scratch

    // validate parameters
    if (!ppieInterfaceEntry || !pwszIfName)
        return ERROR_INVALID_PARAMETER;

    *ppieInterfaceEntry = NULL;

    do                          // breakout loop
    {
        // allocate and zero out the interface entry structure
        MALLOC(&pieEntry, sizeof(INTERFACE_ENTRY), &dwErr);
        if (dwErr != NO_ERROR)
            break;

        // initialize fields with default values

        InitializeListHead(&(pieEntry->leInterfaceTableLink));
        InitializeListHead(&(pieEntry->leIndexSortedListLink));

        // pieEntry->pwszIfName         = NULL;

        pieEntry->dwIfIndex             = dwIfIndex;

        // pieEntry->ulNumBindings      = 0;
        // pieEntry->pbeBindingTable    = NULL;

        // pieEntry->dwFlags            = 0; // disabled unbound pointtopoint
        if (wAccessType is IF_ACCESS_BROADCAST)
            pieEntry->dwFlags           |= IEFLAG_MULTIACCESS;

        IP_ASSIGN(&(pieEntry->ipAddress), IP_LOWEST);
        pieEntry->sRawSocket            = INVALID_SOCKET;

        // pieEntry->hReceiveEvent      = NULL;
        // pieEntry->hReceiveWait       = NULL;

        // pieEntry->hPeriodicTimer     = NULL;

        // pieEntry->ulMetric           = 0;

        // pieEntry->iisStats           zero'ed out

        // initialize name
        ulNameLength = wcslen(pwszIfName) + 1;
        MALLOC(&(pieEntry->pwszIfName), ulNameLength * sizeof(WCHAR), &dwErr);
        if(dwErr != NO_ERROR)
            break;
        wcsncpy(pieEntry->pwszIfName, pwszIfName, ulNameLength-1);

        // initialize   ReceiveEvent (signalled when input arrives).
        // Auto-Reset Event: state automatically reset to nonsignaled after
        // a single waiting thread is released.  Initially non signalled
        pieEntry->hReceiveEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
        if (pieEntry->hReceiveEvent is NULL)
        {
            dwErr = GetLastError();
            TRACE1(NETWORK, "Error %u creating Receive Event", dwErr);
            LOGERR0(CREATE_EVENT_FAILED, dwErr);

            break;
        }

        // register     ReceiveWait for this interface
        if (!RegisterWaitForSingleObject(&(pieEntry->hReceiveWait),
                                         pieEntry->hReceiveEvent,
                                         NM_CallbackNetworkEvent,
                                         (PVOID) dwIfIndex,
                                         INFINITE,
                                         WT_EXECUTEONLYONCE))
        {
            dwErr = GetLastError();
            TRACE1(NETWORK, "Error %u registering ReceiveWait", dwErr);
            LOGERR0(REGISTER_WAIT_FAILED, dwErr);

            break;
        }

        *ppieInterfaceEntry = pieEntry; // all's well :)
    } while (FALSE);

    if (dwErr != NO_ERROR)
    {
        // something went wrong, so cleanup.
        TRACE2(NETWORK, "Failed to create interface entry for %S (%u)",
               pwszIfName, dwIfIndex);
        IE_Destroy(pieEntry);
    }

    return dwErr;
}

DWORD IE_DeactivateInterface ( IN PINTERFACE_ENTRY pie )

Definition at line 1095 of file networkentry.c.

{
    DWORD   dwErr = NO_ERROR;

    do                          // breakout loop
    {
        // fail if the interface is already inactive
        if (INTERFACE_IS_INACTIVE(pie))
        {
            dwErr = ERROR_INVALID_PARAMETER;
            TRACE2(NETWORK, "interface %S (%u) already inactive",
                   pie->pwszIfName, pie->dwIfIndex);
            break;
        }

        // stop the timer
        if (pie->hPeriodicTimer)
            DELETE_TIMER(pie->hPeriodicTimer, &dwErr);
        pie->hPeriodicTimer = NULL;

        // destroy the socket for the interface
        dwErr = SocketDestroy(pie->sRawSocket);
        pie->sRawSocket     = INVALID_SOCKET;

        // clear the "active" flag
        pie->dwFlags &= ~IEFLAG_ACTIVE;
    } while (FALSE);

    return dwErr;
}

DWORD IE_Delete | ( | IN DWORD | dwIfIndex,
 |  | OUT PINTERFACE_ENTRY * | ppieIfEntry
 | ) |  |

Definition at line 669 of file networkentry.c.

{
    DWORD           dwErr           = NO_ERROR;
    INTERFACE_ENTRY ieKey;
    PLIST_ENTRY     pleListEntry    = NULL;

    *ppieIfEntry = NULL;

    do                          // breakout loop
    {
        // remove from interface table (primary)
        ZeroMemory(&ieKey, sizeof(INTERFACE_ENTRY));
        ieKey.dwIfIndex = dwIfIndex;

        dwErr = HT_DeleteEntry((g_ce.pneNetworkEntry)->phtInterfaceTable,
                               &(ieKey.leInterfaceTableLink),
                               &pleListEntry);
        if (dwErr != NO_ERROR)
        {
            TRACE1(NETWORK, "Error interface %u has vanished", dwIfIndex);
            LOGWARN0(INTERFACE_ABSENT, dwErr);
            break;
        }

        *ppieIfEntry = CONTAINING_RECORD(pleListEntry,
                                         INTERFACE_ENTRY,
                                         leInterfaceTableLink);

        // remove from all other tables, lists... (secondary)
        RemoveEntryList(&((*ppieIfEntry)->leIndexSortedListLink));

        // initialize pointers to indicate that the entry has been deleted
        InitializeListHead(&((*ppieIfEntry)->leInterfaceTableLink));
        InitializeListHead(&((*ppieIfEntry)->leIndexSortedListLink));
    } while (FALSE);

    return dwErr;
}

DWORD IE_Destroy ( IN PINTERFACE_ENTRY pieInterfaceEntry )

Definition at line 507 of file networkentry.c.

        : Should NOT be called with g_ce.neNetworkEntry.rwlLock held!  The
    call to UnregisterWaitEx blocks till all queued callbacks for
    pieInterfaceEntry->hReceiveEvent finish execution.  These callbacks may
    acquire g_ce.neNetworkEntry.rwlLock, causing deadlock.

Arguments
    pieInterfaceEntry   pointer to the interface entry

Return Value
    NO_ERROR            always

--*/
{
    if (!pieInterfaceEntry)
        return NO_ERROR;

    if (INTERFACE_IS_BOUND(pieInterfaceEntry))
        IE_UnBindInterface(pieInterfaceEntry);

    if (INTERFACE_IS_ACTIVE(pieInterfaceEntry))
        IE_DeactivateInterface(pieInterfaceEntry);

    // PeriodicTimer should have been destroyed
    RTASSERT(pieInterfaceEntry->hPeriodicTimer is NULL);

    // deregister   ReceiveWait
    if (pieInterfaceEntry->hReceiveWait)
        UnregisterWaitEx(pieInterfaceEntry->hReceiveWait,
                         INVALID_HANDLE_VALUE);

    // delete       ReceiveEvent
    if (pieInterfaceEntry->hReceiveEvent)
        CloseHandle(pieInterfaceEntry->hReceiveEvent);

    // BindingTable and RawSocket should have been destroyed
    RTASSERT(pieInterfaceEntry->pbeBindingTable is NULL);
    RTASSERT(pieInterfaceEntry->sRawSocket is INVALID_SOCKET);

    // delete       IfName
    FREE(pieInterfaceEntry->pwszIfName);

    // Entry should have been removed from all access structures
    RTASSERT(IsListEmpty(&(pieInterfaceEntry->leInterfaceTableLink)));
    RTASSERT(IsListEmpty(&(pieInterfaceEntry->leIndexSortedListLink)));

    // deallocate the interface entry structure
    FREE(pieInterfaceEntry);

    return NO_ERROR;
}

DWORD IE_Get | ( | IN DWORD | dwIfIndex,
 |  | OUT PINTERFACE_ENTRY * | ppieIfEntry
 | ) |  |

Definition at line 765 of file networkentry.c.

{
    DWORD           dwErr           = NO_ERROR;
    INTERFACE_ENTRY ieKey;
    PLIST_ENTRY     pleListEntry    = NULL;

    *ppieIfEntry = NULL;

    do                          // breakout loop
    {
        ZeroMemory(&ieKey, sizeof(INTERFACE_ENTRY));
        ieKey.dwIfIndex = dwIfIndex;

        dwErr = HT_GetEntry((g_ce.pneNetworkEntry)->phtInterfaceTable,
                            &(ieKey.leInterfaceTableLink),
                            &pleListEntry);

        if (dwErr != NO_ERROR)
        {
            TRACE1(NETWORK, "Error interface %u has vanished", dwIfIndex);
            LOGWARN0(INTERFACE_ABSENT, dwErr);
            break;
        }

        *ppieIfEntry = CONTAINING_RECORD(pleListEntry,
                                         INTERFACE_ENTRY,
                                         leInterfaceTableLink);
    } while (FALSE);

    return dwErr;
}

DWORD IE_GetIndex | ( | IN DWORD | dwIfIndex,
 |  | IN MODE | mMode,
 |  | OUT PINTERFACE_ENTRY * | ppieIfEntry
 | ) |  |

Definition at line 821 of file networkentry.c.

{
    INTERFACE_ENTRY ieKey;
    PLIST_ENTRY     pleHead = NULL, pleEntry = NULL;

    if (!ppieIfEntry)
    {
        return ERROR_INVALID_PARAMETER;
    }

    *ppieIfEntry = NULL;

    pleHead = &((g_ce.pneNetworkEntry)->leIndexSortedList);

    if (IsListEmpty(pleHead))
        return ERROR_NO_MORE_ITEMS;

    ZeroMemory(&ieKey, sizeof(INTERFACE_ENTRY));
    ieKey.dwIfIndex = (mMode is GET_FIRST) ? 0 : dwIfIndex;

    // this either gets the exact match or the next entry
    FindSortedList(pleHead,
                   &(ieKey.leIndexSortedListLink),
                   &pleEntry,
                   CompareIndexInterfaceEntry);

    // reached end of list
    if (pleEntry is NULL)
    {
        RTASSERT(mMode != GET_FIRST); // should have got the first entry
        return ERROR_NO_MORE_ITEMS;
    }

    *ppieIfEntry = CONTAINING_RECORD(pleEntry,
                                     INTERFACE_ENTRY,
                                     leIndexSortedListLink);

    switch (mMode)
    {
        case GET_FIRST:
            return NO_ERROR;

        case GET_EXACT:
            // found an exact match
            if ((*ppieIfEntry)->dwIfIndex is dwIfIndex)
                return NO_ERROR;
            else
            {
                *ppieIfEntry = NULL;
                return ERROR_NO_MORE_ITEMS;
            }

        case GET_NEXT:
            // found an exact match
            if ((*ppieIfEntry)->dwIfIndex is dwIfIndex)
            {
                pleEntry = pleEntry->Flink; // get next entry
                if (pleEntry is pleHead)    // end of list
                {
                    *ppieIfEntry = NULL;
                    return ERROR_NO_MORE_ITEMS;
                }

                *ppieIfEntry = CONTAINING_RECORD(pleEntry,
                                                 INTERFACE_ENTRY,
                                                 leIndexSortedListLink);
            }

            return NO_ERROR;

        default:
            RTASSERT(FALSE);    // never reached
    }

    return NO_ERROR;
}

DWORD IE_Insert ( IN PINTERFACE_ENTRY pieIfEntry )

Definition at line 622 of file networkentry.c.

{
    DWORD dwErr = NO_ERROR;

    do                          // breakout loop
    {
        dwErr = HT_InsertEntry((g_ce.pneNetworkEntry)->phtInterfaceTable,
                               &(pieIfEntry->leInterfaceTableLink));
        if (dwErr != NO_ERROR)
        {
            TRACE2(NETWORK, "Error interface %S (%u) already exists",
                   pieIfEntry->pwszIfName, pieIfEntry->dwIfIndex);
            LOGERR0(INTERFACE_PRESENT, dwErr);
            break;
        }

        // insert in all tables, lists...
        InsertSortedList(&((g_ce.pneNetworkEntry)->leIndexSortedList),
                         &(pieIfEntry->leIndexSortedListLink),
                         CompareIndexInterfaceEntry);
    } while (FALSE);

    return dwErr;
}

BOOL IE_IsPresent ( IN DWORD dwIfIndex )

Definition at line 732 of file networkentry.c.

{
    DWORD           dwErr = NO_ERROR;
    INTERFACE_ENTRY ieKey;

    ZeroMemory(&ieKey, sizeof(INTERFACE_ENTRY));
    ieKey.dwIfIndex = dwIfIndex;

    return HT_IsPresentEntry((g_ce.pneNetworkEntry)->phtInterfaceTable,
                             &(ieKey.leInterfaceTableLink));
}

DWORD IE_UnBindInterface ( IN PINTERFACE_ENTRY pie )

Definition at line 977 of file networkentry.c.

{
    DWORD   dwErr = NO_ERROR;

    do                          // breakout loop
    {
        // fail if the interface is already unbound
        if (INTERFACE_IS_UNBOUND(pie))
        {
            dwErr = ERROR_INVALID_PARAMETER;
            TRACE2(NETWORK, "interface %S (%u) already unbound",
                   pie->pwszIfName, pie->dwIfIndex);
            break;
        }

        // clear the "bound" flag
        pie->dwFlags &= ~IEFLAG_BOUND;

        IP_ASSIGN(&(pie->ipAddress), IP_LOWEST);

        BE_DestroyTable(pie->pbeBindingTable);
        pie->pbeBindingTable    = NULL;
        pie->ulNumBindings      = 0;
    } while (FALSE);

    return dwErr;
}

DWORD NE_Create ( OUT PNETWORK_ENTRY * ppneNetworkEntry )

Definition at line 1146 of file networkentry.c.

{
    DWORD           dwErr = NO_ERROR;
    PNETWORK_ENTRY  pneEntry;   // scratch

    // validate parameters
    if (!ppneNetworkEntry)
        return ERROR_INVALID_PARAMETER;

    *ppneNetworkEntry = NULL;

    do                          // breakout loop
    {
        // allocate and zero out the network entry structure
        MALLOC(&pneEntry, sizeof(NETWORK_ENTRY), &dwErr);
        if (dwErr != NO_ERROR)
            break;

        // initialize fields with default values

        // pneEntry->rwlLock                zero'ed out

        // pneEntry->phtInterfaceTable      = NULL;

        InitializeListHead(&(pneEntry->leIndexSortedList));

        // initialize the read-write lock
        dwErr = CREATE_READ_WRITE_LOCK(&(pneEntry->rwlLock));
        if (dwErr != NO_ERROR)
        {
            TRACE1(NETWORK, "Error %u creating read-write-lock", dwErr);
            LOGERR0(CREATE_RWL_FAILED, dwErr);

            break;
        }

        // allocate the interface table
        dwErr = HT_Create(GLOBAL_HEAP,
                          INTERFACE_TABLE_BUCKETS,
                          DisplayInterfaceEntry,
                          FreeInterfaceEntry,
                          HashInterfaceEntry,
                          CompareInterfaceEntry,
                          &(pneEntry->phtInterfaceTable));
        if (dwErr != NO_ERROR)
        {
            TRACE1(NETWORK, "Error %u creating hash-table", dwErr);
            LOGERR0(CREATE_HASHTABLE_FAILED, dwErr);

            break;
        }

        *ppneNetworkEntry = pneEntry;
    } while (FALSE);

    if (dwErr != NO_ERROR)
    {
        // something went wrong, so cleanup.
        TRACE0(NETWORK, "Failed to create nework entry");
        NE_Destroy(pneEntry);
        pneEntry = NULL;
    }

    return dwErr;
}

DWORD NE_Destroy ( IN PNETWORK_ENTRY pneNetworkEntry )

Definition at line 1236 of file networkentry.c.

{
    if (!pneNetworkEntry)
        return NO_ERROR;

    // deallocate the interface table...
    // this removes the interface entries from all secondary access
    // structures (IndexSortedList, ...) as well since all of them
    // share interface entries by containing pointers to the same object.
    HT_Destroy(GLOBAL_HEAP, pneNetworkEntry->phtInterfaceTable);
    pneNetworkEntry->phtInterfaceTable = NULL;

    RTASSERT(IsListEmpty(&(pneNetworkEntry->leIndexSortedList)));

    // delete read-write-lock
    if (READ_WRITE_LOCK_CREATED(&(pneNetworkEntry->rwlLock)))
        DELETE_READ_WRITE_LOCK(&(pneNetworkEntry->rwlLock));

    // deallocate the network entry structure
    FREE(pneNetworkEntry);

    return NO_ERROR;
}

Generated on Wed Nov 13 2024 16:54:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/ip/networkmgr.c File Reference

  • NetDS
  • RRas
  • ip
Functions

networkmgr.c File Reference

#include "pchsample.h"

Go to the source code of this file.

Functions

DWORD | NM_AddInterface (IN LPWSTR pwszInterfaceName, IN DWORD dwInterfaceIndex, IN WORD wAccessType, IN PVOID pvInterfaceInfo)
VOID WINAPI | NM_CallbackNetworkEvent (IN PVOID pvContext, IN BOOLEAN bTimerOrWaitFired)
VOID WINAPI | NM_CallbackPeriodicTimer (IN PVOID pvContext, IN BOOLEAN bTimerOrWaitFired)
DWORD | NM_DeleteInterface (IN DWORD dwInterfaceIndex)
DWORD | NM_DoUpdateRoutes (IN DWORD dwInterfaceIndex)
DWORD | NM_GetInterfaceInfo (IN DWORD dwInterfaceIndex, IN PVOID pvInterfaceInfo, IN OUT PULONG pulBufferSize, OUT PULONG pulStructureVersion, OUT PULONG pulStructureSize, OUT PULONG pulStructureCount)
DWORD | NM_InterfaceStatus (IN DWORD dwInterfaceIndex, IN BOOL bInterfaceActive, IN DWORD dwStatusType, IN PVOID pvStatusInfo)
DWORD | NM_ProcessRouteChange (VOID)
DWORD | NM_SetInterfaceInfo (IN DWORD dwInterfaceIndex, IN PVOID pvInterfaceInfo)
BOOL | ValidateInterfaceConfig (IN PIPSAMPLE_IF_CONFIG piic)

Function Documentation

DWORD NM_AddInterface | ( | IN LPWSTR | pwszInterfaceName,
 |  | IN DWORD | dwInterfaceIndex,
 |  | IN WORD | wAccessType,
 |  | IN PVOID | pvInterfaceInfo
 | ) |  |

Definition at line 287 of file networkmgr.c.

{
    DWORD               dwErr   = NO_ERROR;
    PIPSAMPLE_IF_CONFIG piic    = NULL;
    PINTERFACE_ENTRY    pieEntry = NULL;

    if (!ENTER_SAMPLE_API()) { return ERROR_CAN_NOT_COMPLETE; }

    ACQUIRE_WRITE_LOCK(&((g_ce.pneNetworkEntry)->rwlLock));

    do                          // breakout loop
    {
        piic = (PIPSAMPLE_IF_CONFIG) pvInterfaceInfo;

        // validate the configuration parameters
        if (!ValidateInterfaceConfig(piic))
        {
            dwErr = ERROR_INVALID_PARAMETER;
            break;
        }

        // fail if the interface exists
        if (IE_IsPresent(dwInterfaceIndex))
        {
            dwErr = ERROR_INVALID_PARAMETER;
            TRACE2(NETWORK, "Error interface %S (%u) already exists",
                   pwszInterfaceName, dwInterfaceIndex);
            LOGERR0(INTERFACE_PRESENT, dwErr);

            break;
        }

        // create an interface entry
        dwErr = IE_Create(pwszInterfaceName,
                          dwInterfaceIndex,
                          wAccessType,
                          &pieEntry);
        if (dwErr != NO_ERROR)
            break;

        // initialize interface configuration fields
        pieEntry->ulMetric          = piic->ulMetric;

        // insert the interface in all access structures
        dwErr = IE_Insert(pieEntry);
        RTASSERT(dwErr is NO_ERROR); // no reason to fail!

        // update global statistics
        InterlockedIncrement(&(g_ce.igsStats.ulNumInterfaces));
    } while (FALSE);

    RELEASE_WRITE_LOCK(&((g_ce.pneNetworkEntry)->rwlLock));

    LEAVE_SAMPLE_API();

    return dwErr;
}

VOID WINAPI NM_CallbackNetworkEvent | ( | IN PVOID | pvContext,
 |  | IN BOOLEAN | bTimerOrWaitFired
 | ) |  |

Definition at line 100 of file networkmgr.c.

        : The interface might have been deleted.

Locks
    Acquires shared      (g_ce.pneNetworkEntry)->rwlLock
    Releases             (g_ce.pneNetworkEntry)->rwlLock

Arguments
    pvContext           dwIfIndex

Return Value
   None

--*/
{
    DWORD               dwErr               = NO_ERROR;
    DWORD               dwIfIndex           = 0;
    PINTERFACE_ENTRY    pieInterfaceEntry   = NULL;
    PACKET              Packet;

    dwIfIndex = (DWORD) pvContext;

    TRACE1(ENTER, "Entering NM_CallbackNetworkEvent: %u", dwIfIndex);

    if (!ENTER_SAMPLE_API()) { return; } // cannot return anything

    ACQUIRE_READ_LOCK(&((g_ce.pneNetworkEntry)->rwlLock));

    do                          // breakout loop
    {
        // fail if the interface does not exist
        dwErr = IE_Get(dwIfIndex, &pieInterfaceEntry);
        if (dwErr != NO_ERROR)
            break;

        // fail if interface is inactive
        if (!INTERFACE_IS_ACTIVE(pieInterfaceEntry))
        {
            TRACE1(NETWORK, "Error interface %u is inactive", dwIfIndex);
            break;
        }

        RTASSERT(pieInterfaceEntry->sRawSocket != INVALID_SOCKET);

        if (SocketReceiveEvent(pieInterfaceEntry->sRawSocket))
        {
            if (SocketReceive(pieInterfaceEntry->sRawSocket,
                              &Packet) is NO_ERROR)
                PacketDisplay(&Packet);
        }
        else
        {
            TRACE1(NETWORK, "Error interface %u false alarm", dwIfIndex);
            break;
        }

    } while (FALSE);

    // reregister ReceiveWait if the interface exists
    if (pieInterfaceEntry)
    {
        if (!RegisterWaitForSingleObject(&pieInterfaceEntry->hReceiveWait,
                                         pieInterfaceEntry->hReceiveEvent,
                                         NM_CallbackNetworkEvent,
                                         (PVOID) pieInterfaceEntry->dwIfIndex,
                                         INFINITE,
                                         WT_EXECUTEONLYONCE))
        {
            dwErr = GetLastError();
            TRACE2(NETWORK, "Error %u registering wait for %u, continuing",
                   dwErr, pieInterfaceEntry->dwIfIndex);
            LOGERR0(REGISTER_WAIT_FAILED, dwErr);
        }
    }

    RELEASE_READ_LOCK(&((g_ce.pneNetworkEntry)->rwlLock));

    LEAVE_SAMPLE_API();

    TRACE0(LEAVE, "Leaving  NM_CallbackNetworkEvent");
}

VOID WINAPI NM_CallbackPeriodicTimer | ( | IN PVOID | pvContext,
 |  | IN BOOLEAN | bTimerOrWaitFired
 | ) |  |

Definition at line 194 of file networkmgr.c.

        : The interface might have been deleted.

Locks
    Acquires shared      (g_ce.pneNetworkEntry)->rwlLock
    Releases             (g_ce.pneNetworkEntry)->rwlLock

Arguments
    pvContext           dwIfIndex

Return Value
   None

--*/
{
    DWORD               dwErr               = NO_ERROR;
    DWORD               dwIfIndex           = 0;
    PINTERFACE_ENTRY    pieInterfaceEntry   = NULL;
    PPACKET             pPacket;

    dwIfIndex = (DWORD) pvContext;

    TRACE1(ENTER, "Entering NM_CallbackPeriodicTimer: %u", dwIfIndex);

    if (!ENTER_SAMPLE_API()) { return; } // cannot return anything

    ACQUIRE_READ_LOCK(&((g_ce.pneNetworkEntry)->rwlLock));

    do                          // breakout loop
    {
        // fail if the interface does not exist
        dwErr = IE_Get(dwIfIndex, &pieInterfaceEntry);
        if (dwErr != NO_ERROR)
            break;

        // fail if interface is inactive
        if (!INTERFACE_IS_ACTIVE(pieInterfaceEntry))
            break;

        RTASSERT(pieInterfaceEntry->sRawSocket != INVALID_SOCKET);

        // fail if packet cannot be created
        if (PacketCreate(&pPacket) != NO_ERROR)
            break;

        PacketDisplay(pPacket);
        dwErr = SocketSend(pieInterfaceEntry->sRawSocket,
                           SAMPLE_PROTOCOL_MULTICAST_GROUP,
                           pPacket);
        if (dwErr != NO_ERROR)
        {
            PacketDestroy(pPacket);
            break;
        }

        // update interface statistics
        InterlockedIncrement(&(pieInterfaceEntry->iisStats.ulNumPackets));
    } while (FALSE);

    // restart timer if the interface exists and is active
    if ((pieInterfaceEntry) and INTERFACE_IS_ACTIVE(pieInterfaceEntry))
    {
        RESTART_TIMER(pieInterfaceEntry->hPeriodicTimer,
                      PERIODIC_INTERVAL,
                      &dwErr);
    }

    RELEASE_READ_LOCK(&((g_ce.pneNetworkEntry)->rwlLock));

    LEAVE_SAMPLE_API();

    TRACE0(LEAVE, "Leaving  NM_CallbackPeriodicTimer");
}

DWORD NM_DeleteInterface ( IN DWORD dwInterfaceIndex )

Definition at line 380 of file networkmgr.c.

{
    DWORD               dwErr               = NO_ERROR;
    PINTERFACE_ENTRY    pieInterfaceEntry   = NULL;

    if (!ENTER_SAMPLE_API()) { return ERROR_CAN_NOT_COMPLETE; }

    do                          // breakout loop
    {
        // remove from all tables, lists...
        ACQUIRE_WRITE_LOCK(&((g_ce.pneNetworkEntry)->rwlLock));

        dwErr = IE_Delete(dwInterfaceIndex, &pieInterfaceEntry);

        RELEASE_WRITE_LOCK(&((g_ce.pneNetworkEntry)->rwlLock));

        // fail if the interface does not exist
        if (dwErr != NO_ERROR)
        {
            TRACE1(NETWORK, "Error interface %u does not exist",
                   dwInterfaceIndex);
            break;
        }

        // destroy the interface entry, deregisters ReceiveWait
        // hence best not to hold any locks to prevent deadlocks.
        IE_Destroy(pieInterfaceEntry);

        // update global statistics
        InterlockedDecrement(&(g_ce.igsStats.ulNumInterfaces));
    } while (FALSE);

    LEAVE_SAMPLE_API();

    return dwErr;
}

DWORD NM_DoUpdateRoutes ( IN DWORD dwInterfaceIndex )

Definition at line 692 of file networkmgr.c.

{
    DWORD               dwErr               = NO_ERROR;
    PINTERFACE_ENTRY    pieInterfaceEntry   = NULL;
    MESSAGE             mMessage;

    if (!ENTER_SAMPLE_API()) { return ERROR_CAN_NOT_COMPLETE; }

    ACQUIRE_READ_LOCK(&((g_ce.pneNetworkEntry)->rwlLock));

    do                          // breakout loop
    {
        // fail if the interface does not exist
        dwErr = IE_Get(dwInterfaceIndex, &pieInterfaceEntry);
        if (dwErr != NO_ERROR)
            break;

        // ensure interface is active
        if (INTERFACE_IS_INACTIVE(pieInterfaceEntry))
        {
            dwErr = ERROR_CAN_NOT_COMPLETE;
            TRACE1(NETWORK, "Error, interface %u inactive", dwInterfaceIndex);
            break;
        }

        // here we do protocol specific processing,
        // for sample nothing :)

    } while (FALSE);

    RELEASE_READ_LOCK(&((g_ce.pneNetworkEntry)->rwlLock));

    mMessage.UpdateCompleteMessage.InterfaceIndex   = dwInterfaceIndex;
    mMessage.UpdateCompleteMessage.UpdateType       = RF_DEMAND_UPDATE_ROUTES;
    mMessage.UpdateCompleteMessage.UpdateStatus     = dwErr;
    if (EnqueueEvent(UPDATE_COMPLETE, mMessage) is NO_ERROR)
        SetEvent(g_ce.hMgrNotificationEvent);

    LEAVE_SAMPLE_API();

    return dwErr;
}

DWORD NM_GetInterfaceInfo | ( | IN DWORD | dwInterfaceIndex,
 |  | IN PVOID | pvInterfaceInfo,
 |  | IN OUT PULONG | pulBufferSize,
 |  | OUT PULONG | pulStructureVersion,
 |  | OUT PULONG | pulStructureSize,
 |  | OUT PULONG | pulStructureCount
 | ) |  |

Definition at line 544 of file networkmgr.c.

{
    DWORD               dwErr               = NO_ERROR;
    PIPSAMPLE_IF_CONFIG piic;
    ULONG               ulSize              = sizeof(IPSAMPLE_IF_CONFIG);
    PINTERFACE_ENTRY    pieInterfaceEntry   = NULL;

    if (!ENTER_SAMPLE_API()) { return ERROR_CAN_NOT_COMPLETE; }

    ACQUIRE_READ_LOCK(&((g_ce.pneNetworkEntry)->rwlLock));

    do                          // breakout loop
    {
        // fail if the interface does not exist
        dwErr = IE_Get(dwInterfaceIndex, &pieInterfaceEntry);
        if (dwErr != NO_ERROR)
            break;

        // fail if the size was too small or there was no storage
        if((*pulBufferSize < ulSize) or (pvInterfaceInfo is NULL))
        {
            TRACE1(NETWORK, "NM_GetInterfaceInfo: *ulBufferSize %u",
                   *pulBufferSize);

            *pulBufferSize = ulSize;
            dwErr = ERROR_INSUFFICIENT_BUFFER;
            break;
        }

        // set the OUT parameters
        *pulBufferSize = ulSize;
        if (pulStructureVersion)    *pulStructureVersion    = 1;
        if (pulStructureSize)       *pulStructureSize       = ulSize;
        if (pulStructureCount)      *pulStructureCount      = 1;

        // copy out the interface configuration
        piic = (PIPSAMPLE_IF_CONFIG) pvInterfaceInfo;
        piic->ulMetric = pieInterfaceEntry->ulMetric;
    } while (FALSE);

    RELEASE_READ_LOCK(&((g_ce.pneNetworkEntry)->rwlLock));

    LEAVE_SAMPLE_API();

    return dwErr;
}

DWORD NM_InterfaceStatus | ( | IN DWORD | dwInterfaceIndex,
 |  | IN BOOL | bInterfaceActive,
 |  | IN DWORD | dwStatusType,
 |  | IN PVOID | pvStatusInfo
 | ) |  |

Definition at line 442 of file networkmgr.c.

{
    DWORD                       dwErr               = NO_ERROR;
    PINTERFACE_ENTRY            pieInterfaceEntry   = NULL;
    PIP_ADAPTER_BINDING_INFO    pBinding            = NULL;
    BOOL                        bBindingChanged     = FALSE;

    if (!ENTER_SAMPLE_API()) { return ERROR_CAN_NOT_COMPLETE; }

    ACQUIRE_WRITE_LOCK(&((g_ce.pneNetworkEntry)->rwlLock));

    do                          // breakout loop
    {
        // fail if the interface does not exist
        dwErr = IE_Get(dwInterfaceIndex, &pieInterfaceEntry);
        if (dwErr != NO_ERROR)
            break;

        // the only status we care about is a change in interface binding
        if (dwStatusType is RIS_INTERFACE_ADDRESS_CHANGE)
        {
            // destroy existing binding
            if (INTERFACE_IS_BOUND(pieInterfaceEntry))
            {
                bBindingChanged = TRUE;
                dwErr = IE_UnBindInterface(pieInterfaceEntry);
                RTASSERT(dwErr is NO_ERROR);
            }

            // create new binding
            pBinding = (PIP_ADAPTER_BINDING_INFO) pvStatusInfo;
            if(pBinding->AddressCount)
            {
                bBindingChanged = TRUE;
                dwErr = IE_BindInterface(pieInterfaceEntry, pBinding);
                if (dwErr != NO_ERROR)
                    break;
            }
        }

        // interface needs to be deactivated even when the binding changes!
        // this restriction is due to the fact that the socket is bound to
        // the interface address and not the interface index...
        if (INTERFACE_IS_ACTIVE(pieInterfaceEntry) and
            (bBindingChanged or !bInterfaceActive))
        {
            dwErr = IE_DeactivateInterface(pieInterfaceEntry);
            if (dwErr != NO_ERROR)
                break;
        }

        // activate interface only when a binding exists!
        // i.e. we do not support unnumbered interfaces for now...
        if (INTERFACE_IS_INACTIVE(pieInterfaceEntry) and
            INTERFACE_IS_BOUND(pieInterfaceEntry) and
            bInterfaceActive)
        {
            dwErr = IE_ActivateInterface(pieInterfaceEntry);
            if (dwErr != NO_ERROR)
                break;
        }
    } while (FALSE);

    RELEASE_WRITE_LOCK(&((g_ce.pneNetworkEntry)->rwlLock));

    LEAVE_SAMPLE_API();

    return dwErr;
}

DWORD NM_ProcessRouteChange ( VOID )

Definition at line 758 of file networkmgr.c.

{
    DWORD           dwErr           = NO_ERROR;
    RTM_DEST_INFO   rdiDestination;             // 1 view registered for change
    BOOL            bDone           = FALSE;
    UINT            uiNumDests;

    if (!ENTER_SAMPLE_API()) { return ERROR_CAN_NOT_COMPLETE; }

    // loop dequeueing messages until RTM says there are no more left
    while (!bDone)
    {
        // retrieve route changes
        uiNumDests = 1;
        dwErr = RTM_GetChangedDests(
            g_ce.hRtmHandle,                    // my RTMv2 handle
            g_ce.hRtmNotificationHandle,        // my notification handle
            &uiNumDests,                        // IN   # dest info's required
                                                // OUT  # dest info's supplied
            &rdiDestination);                   // OUT  buffer for dest info's

        switch (dwErr)
        {
            case ERROR_NO_MORE_ITEMS:
                bDone = TRUE;
                dwErr = NO_ERROR;
                if (uiNumDests < 1)
                    break;
                // else continue below to process the last destination

            case NO_ERROR:
                RTASSERT(uiNumDests is 1);
                RTM_DisplayDestInfo(&rdiDestination);

                // release the destination info
                if (RTM_ReleaseChangedDests(
                    g_ce.hRtmHandle,            // my RTMv2 handle
                    g_ce.hRtmNotificationHandle,// my notif handle
                    uiNumDests,                 // 1
                    &rdiDestination             // released dest info
                    ) != NO_ERROR)
                    TRACE0(NETWORK, "Error releasing changed dests");

                break;

            default:
                bDone = TRUE;
                TRACE1(NETWORK, "Error %u RtmGetChangedDests", dwErr);
                break;
        }
    } // while

    LEAVE_SAMPLE_API();

    return dwErr;
}

DWORD NM_SetInterfaceInfo | ( | IN DWORD | dwInterfaceIndex,
 |  | IN PVOID | pvInterfaceInfo
 | ) |  |

Definition at line 625 of file networkmgr.c.

{
    DWORD               dwErr               = NO_ERROR;
    PIPSAMPLE_IF_CONFIG piic;
    PINTERFACE_ENTRY    pieInterfaceEntry   = NULL;

    if (!ENTER_SAMPLE_API()) { return ERROR_CAN_NOT_COMPLETE; }

    ACQUIRE_WRITE_LOCK(&((g_ce.pneNetworkEntry)->rwlLock));

    do                          // breakout loop
    {
        // fail if the interface does not exist
        dwErr = IE_Get(dwInterfaceIndex, &pieInterfaceEntry);
        if (dwErr != NO_ERROR)
            break;

        // fail if the configuration is invalid
        piic = (PIPSAMPLE_IF_CONFIG) pvInterfaceInfo;
        if(!ValidateInterfaceConfig(piic))
        {
            dwErr = ERROR_INVALID_PARAMETER;
            break;
        }

        // update our configuration
        pieInterfaceEntry->ulMetric         = piic->ulMetric;

        // might need additional processing depending on the state change
        // caused by the updated interface configuration and the protocol
        // behavior.  for instance, sockets may need to be created/shutdown

    } while (FALSE);

    RELEASE_WRITE_LOCK(&((g_ce.pneNetworkEntry)->rwlLock));

    LEAVE_SAMPLE_API();

    return dwErr;
}

BOOL ValidateInterfaceConfig ( IN PIPSAMPLE_IF_CONFIG piic )

Definition at line 28 of file networkmgr.c.

{
    DWORD dwErr = NO_ERROR;

    do                          // breakout loop
    {
        if (piic is NULL)
        {
            dwErr = ERROR_INVALID_PARAMETER;
            TRACE0(NETWORK, "Error null interface config");

            break;
        }

        //
        // check range of each field
        //

        // ensure that the metric is within bounds

        if (piic->ulMetric > IPSAMPLE_METRIC_INFINITE)
        {
            dwErr = ERROR_INVALID_PARAMETER;
            TRACE0(NETWORK, "Error metric out of range");

            break;
        }

        // ensure that protocol flags are fine, for now they'll always be

        // add more here...

    } while (FALSE);

    if (!(dwErr is NO_ERROR))
    {
        TRACE0(NETWORK, "Error corrupt interface config");
        LOGERR0(CORRUPT_INTERFACE_CONFIG, dwErr);

        return FALSE;
    }

    return TRUE;
}

Generated on Wed Nov 13 2024 16:54:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/ip/networkmgr.h File Reference

  • NetDS
  • RRas
  • ip
Functions

networkmgr.h File Reference

Go to the source code of this file.

Functions

DWORD | NM_AddInterface (IN LPWSTR pwszInterfaceName, IN DWORD dwInterfaceIndex, IN WORD wAccessType, IN PVOID pvInterfaceInfo)
VOID WINAPI | NM_CallbackNetworkEvent (IN PVOID pvContext, IN BOOLEAN bTimerOrWaitFired)
VOID WINAPI | NM_CallbackPeriodicTimer (IN PVOID pvContext, IN BOOLEAN bTimerOrWaitFired)
DWORD | NM_DeleteInterface (IN DWORD dwInterfaceIndex)
DWORD | NM_DoUpdateRoutes (IN DWORD dwInterfaceIndex)
DWORD | NM_GetInterfaceInfo (IN DWORD dwInterfaceIndex, IN PVOID pvInterfaceInfo, IN OUT PULONG pulBufferSize, OUT PULONG pulStructureVersion, OUT PULONG pulStructureSize, OUT PULONG pulStructureCount)
DWORD | NM_InterfaceStatus (IN DWORD dwInterfaceIndex, IN BOOL bInterfaceActive, IN DWORD dwStatusType, IN PVOID pvStatusInfo)
DWORD | NM_ProcessRouteChange (VOID)
DWORD | NM_SetInterfaceInfo (IN DWORD dwInterfaceIndex, IN PVOID pvInterfaceInfo)

Function Documentation

DWORD NM_AddInterface | ( | IN LPWSTR | pwszInterfaceName,
 |  | IN DWORD | dwInterfaceIndex,
 |  | IN WORD | wAccessType,
 |  | IN PVOID | pvInterfaceInfo
 | ) |  |

Definition at line 287 of file networkmgr.c.

{
    DWORD               dwErr   = NO_ERROR;
    PIPSAMPLE_IF_CONFIG piic    = NULL;
    PINTERFACE_ENTRY    pieEntry = NULL;

    if (!ENTER_SAMPLE_API()) { return ERROR_CAN_NOT_COMPLETE; }

    ACQUIRE_WRITE_LOCK(&((g_ce.pneNetworkEntry)->rwlLock));

    do                          // breakout loop
    {
        piic = (PIPSAMPLE_IF_CONFIG) pvInterfaceInfo;

        // validate the configuration parameters
        if (!ValidateInterfaceConfig(piic))
        {
            dwErr = ERROR_INVALID_PARAMETER;
            break;
        }

        // fail if the interface exists
        if (IE_IsPresent(dwInterfaceIndex))
        {
            dwErr = ERROR_INVALID_PARAMETER;
            TRACE2(NETWORK, "Error interface %S (%u) already exists",
                   pwszInterfaceName, dwInterfaceIndex);
            LOGERR0(INTERFACE_PRESENT, dwErr);

            break;
        }

        // create an interface entry
        dwErr = IE_Create(pwszInterfaceName,
                          dwInterfaceIndex,
                          wAccessType,
                          &pieEntry);
        if (dwErr != NO_ERROR)
            break;

        // initialize interface configuration fields
        pieEntry->ulMetric          = piic->ulMetric;

        // insert the interface in all access structures
        dwErr = IE_Insert(pieEntry);
        RTASSERT(dwErr is NO_ERROR); // no reason to fail!

        // update global statistics
        InterlockedIncrement(&(g_ce.igsStats.ulNumInterfaces));
    } while (FALSE);

    RELEASE_WRITE_LOCK(&((g_ce.pneNetworkEntry)->rwlLock));

    LEAVE_SAMPLE_API();

    return dwErr;
}

VOID WINAPI NM_CallbackNetworkEvent | ( | IN PVOID | pvContext,
 |  | IN BOOLEAN | bTimerOrWaitFired
 | ) |  |

Definition at line 100 of file networkmgr.c.

        : The interface might have been deleted.

Locks
    Acquires shared      (g_ce.pneNetworkEntry)->rwlLock
    Releases             (g_ce.pneNetworkEntry)->rwlLock

Arguments
    pvContext           dwIfIndex

Return Value
   None

--*/
{
    DWORD               dwErr               = NO_ERROR;
    DWORD               dwIfIndex           = 0;
    PINTERFACE_ENTRY    pieInterfaceEntry   = NULL;
    PACKET              Packet;

    dwIfIndex = (DWORD) pvContext;

    TRACE1(ENTER, "Entering NM_CallbackNetworkEvent: %u", dwIfIndex);

    if (!ENTER_SAMPLE_API()) { return; } // cannot return anything

    ACQUIRE_READ_LOCK(&((g_ce.pneNetworkEntry)->rwlLock));

    do                          // breakout loop
    {
        // fail if the interface does not exist
        dwErr = IE_Get(dwIfIndex, &pieInterfaceEntry);
        if (dwErr != NO_ERROR)
            break;

        // fail if interface is inactive
        if (!INTERFACE_IS_ACTIVE(pieInterfaceEntry))
        {
            TRACE1(NETWORK, "Error interface %u is inactive", dwIfIndex);
            break;
        }

        RTASSERT(pieInterfaceEntry->sRawSocket != INVALID_SOCKET);

        if (SocketReceiveEvent(pieInterfaceEntry->sRawSocket))
        {
            if (SocketReceive(pieInterfaceEntry->sRawSocket,
                              &Packet) is NO_ERROR)
                PacketDisplay(&Packet);
        }
        else
        {
            TRACE1(NETWORK, "Error interface %u false alarm", dwIfIndex);
            break;
        }

    } while (FALSE);

    // reregister ReceiveWait if the interface exists
    if (pieInterfaceEntry)
    {
        if (!RegisterWaitForSingleObject(&pieInterfaceEntry->hReceiveWait,
                                         pieInterfaceEntry->hReceiveEvent,
                                         NM_CallbackNetworkEvent,
                                         (PVOID) pieInterfaceEntry->dwIfIndex,
                                         INFINITE,
                                         WT_EXECUTEONLYONCE))
        {
            dwErr = GetLastError();
            TRACE2(NETWORK, "Error %u registering wait for %u, continuing",
                   dwErr, pieInterfaceEntry->dwIfIndex);
            LOGERR0(REGISTER_WAIT_FAILED, dwErr);
        }
    }

    RELEASE_READ_LOCK(&((g_ce.pneNetworkEntry)->rwlLock));

    LEAVE_SAMPLE_API();

    TRACE0(LEAVE, "Leaving  NM_CallbackNetworkEvent");
}

VOID WINAPI NM_CallbackPeriodicTimer | ( | IN PVOID | pvContext,
 |  | IN BOOLEAN | bTimerOrWaitFired
 | ) |  |

Definition at line 194 of file networkmgr.c.

        : The interface might have been deleted.

Locks
    Acquires shared      (g_ce.pneNetworkEntry)->rwlLock
    Releases             (g_ce.pneNetworkEntry)->rwlLock

Arguments
    pvContext           dwIfIndex

Return Value
   None

--*/
{
    DWORD               dwErr               = NO_ERROR;
    DWORD               dwIfIndex           = 0;
    PINTERFACE_ENTRY    pieInterfaceEntry   = NULL;
    PPACKET             pPacket;

    dwIfIndex = (DWORD) pvContext;

    TRACE1(ENTER, "Entering NM_CallbackPeriodicTimer: %u", dwIfIndex);

    if (!ENTER_SAMPLE_API()) { return; } // cannot return anything

    ACQUIRE_READ_LOCK(&((g_ce.pneNetworkEntry)->rwlLock));

    do                          // breakout loop
    {
        // fail if the interface does not exist
        dwErr = IE_Get(dwIfIndex, &pieInterfaceEntry);
        if (dwErr != NO_ERROR)
            break;

        // fail if interface is inactive
        if (!INTERFACE_IS_ACTIVE(pieInterfaceEntry))
            break;

        RTASSERT(pieInterfaceEntry->sRawSocket != INVALID_SOCKET);

        // fail if packet cannot be created
        if (PacketCreate(&pPacket) != NO_ERROR)
            break;

        PacketDisplay(pPacket);
        dwErr = SocketSend(pieInterfaceEntry->sRawSocket,
                           SAMPLE_PROTOCOL_MULTICAST_GROUP,
                           pPacket);
        if (dwErr != NO_ERROR)
        {
            PacketDestroy(pPacket);
            break;
        }

        // update interface statistics
        InterlockedIncrement(&(pieInterfaceEntry->iisStats.ulNumPackets));
    } while (FALSE);

    // restart timer if the interface exists and is active
    if ((pieInterfaceEntry) and INTERFACE_IS_ACTIVE(pieInterfaceEntry))
    {
        RESTART_TIMER(pieInterfaceEntry->hPeriodicTimer,
                      PERIODIC_INTERVAL,
                      &dwErr);
    }

    RELEASE_READ_LOCK(&((g_ce.pneNetworkEntry)->rwlLock));

    LEAVE_SAMPLE_API();

    TRACE0(LEAVE, "Leaving  NM_CallbackPeriodicTimer");
}

DWORD NM_DeleteInterface ( IN DWORD dwInterfaceIndex )

Definition at line 380 of file networkmgr.c.

{
    DWORD               dwErr               = NO_ERROR;
    PINTERFACE_ENTRY    pieInterfaceEntry   = NULL;

    if (!ENTER_SAMPLE_API()) { return ERROR_CAN_NOT_COMPLETE; }

    do                          // breakout loop
    {
        // remove from all tables, lists...
        ACQUIRE_WRITE_LOCK(&((g_ce.pneNetworkEntry)->rwlLock));

        dwErr = IE_Delete(dwInterfaceIndex, &pieInterfaceEntry);

        RELEASE_WRITE_LOCK(&((g_ce.pneNetworkEntry)->rwlLock));

        // fail if the interface does not exist
        if (dwErr != NO_ERROR)
        {
            TRACE1(NETWORK, "Error interface %u does not exist",
                   dwInterfaceIndex);
            break;
        }

        // destroy the interface entry, deregisters ReceiveWait
        // hence best not to hold any locks to prevent deadlocks.
        IE_Destroy(pieInterfaceEntry);

        // update global statistics
        InterlockedDecrement(&(g_ce.igsStats.ulNumInterfaces));
    } while (FALSE);

    LEAVE_SAMPLE_API();

    return dwErr;
}

DWORD NM_DoUpdateRoutes ( IN DWORD dwInterfaceIndex )

Definition at line 692 of file networkmgr.c.

{
    DWORD               dwErr               = NO_ERROR;
    PINTERFACE_ENTRY    pieInterfaceEntry   = NULL;
    MESSAGE             mMessage;

    if (!ENTER_SAMPLE_API()) { return ERROR_CAN_NOT_COMPLETE; }

    ACQUIRE_READ_LOCK(&((g_ce.pneNetworkEntry)->rwlLock));

    do                          // breakout loop
    {
        // fail if the interface does not exist
        dwErr = IE_Get(dwInterfaceIndex, &pieInterfaceEntry);
        if (dwErr != NO_ERROR)
            break;

        // ensure interface is active
        if (INTERFACE_IS_INACTIVE(pieInterfaceEntry))
        {
            dwErr = ERROR_CAN_NOT_COMPLETE;
            TRACE1(NETWORK, "Error, interface %u inactive", dwInterfaceIndex);
            break;
        }

        // here we do protocol specific processing,
        // for sample nothing :)

    } while (FALSE);

    RELEASE_READ_LOCK(&((g_ce.pneNetworkEntry)->rwlLock));

    mMessage.UpdateCompleteMessage.InterfaceIndex   = dwInterfaceIndex;
    mMessage.UpdateCompleteMessage.UpdateType       = RF_DEMAND_UPDATE_ROUTES;
    mMessage.UpdateCompleteMessage.UpdateStatus     = dwErr;
    if (EnqueueEvent(UPDATE_COMPLETE, mMessage) is NO_ERROR)
        SetEvent(g_ce.hMgrNotificationEvent);

    LEAVE_SAMPLE_API();

    return dwErr;
}

DWORD NM_GetInterfaceInfo | ( | IN DWORD | dwInterfaceIndex,
 |  | IN PVOID | pvInterfaceInfo,
 |  | IN OUT PULONG | pulBufferSize,
 |  | OUT PULONG | pulStructureVersion,
 |  | OUT PULONG | pulStructureSize,
 |  | OUT PULONG | pulStructureCount
 | ) |  |

Definition at line 544 of file networkmgr.c.

{
    DWORD               dwErr               = NO_ERROR;
    PIPSAMPLE_IF_CONFIG piic;
    ULONG               ulSize              = sizeof(IPSAMPLE_IF_CONFIG);
    PINTERFACE_ENTRY    pieInterfaceEntry   = NULL;

    if (!ENTER_SAMPLE_API()) { return ERROR_CAN_NOT_COMPLETE; }

    ACQUIRE_READ_LOCK(&((g_ce.pneNetworkEntry)->rwlLock));

    do                          // breakout loop
    {
        // fail if the interface does not exist
        dwErr = IE_Get(dwInterfaceIndex, &pieInterfaceEntry);
        if (dwErr != NO_ERROR)
            break;

        // fail if the size was too small or there was no storage
        if((*pulBufferSize < ulSize) or (pvInterfaceInfo is NULL))
        {
            TRACE1(NETWORK, "NM_GetInterfaceInfo: *ulBufferSize %u",
                   *pulBufferSize);

            *pulBufferSize = ulSize;
            dwErr = ERROR_INSUFFICIENT_BUFFER;
            break;
        }

        // set the OUT parameters
        *pulBufferSize = ulSize;
        if (pulStructureVersion)    *pulStructureVersion    = 1;
        if (pulStructureSize)       *pulStructureSize       = ulSize;
        if (pulStructureCount)      *pulStructureCount      = 1;

        // copy out the interface configuration
        piic = (PIPSAMPLE_IF_CONFIG) pvInterfaceInfo;
        piic->ulMetric = pieInterfaceEntry->ulMetric;
    } while (FALSE);

    RELEASE_READ_LOCK(&((g_ce.pneNetworkEntry)->rwlLock));

    LEAVE_SAMPLE_API();

    return dwErr;
}

DWORD NM_InterfaceStatus | ( | IN DWORD | dwInterfaceIndex,
 |  | IN BOOL | bInterfaceActive,
 |  | IN DWORD | dwStatusType,
 |  | IN PVOID | pvStatusInfo
 | ) |  |

Definition at line 442 of file networkmgr.c.

{
    DWORD                       dwErr               = NO_ERROR;
    PINTERFACE_ENTRY            pieInterfaceEntry   = NULL;
    PIP_ADAPTER_BINDING_INFO    pBinding            = NULL;
    BOOL                        bBindingChanged     = FALSE;

    if (!ENTER_SAMPLE_API()) { return ERROR_CAN_NOT_COMPLETE; }

    ACQUIRE_WRITE_LOCK(&((g_ce.pneNetworkEntry)->rwlLock));

    do                          // breakout loop
    {
        // fail if the interface does not exist
        dwErr = IE_Get(dwInterfaceIndex, &pieInterfaceEntry);
        if (dwErr != NO_ERROR)
            break;

        // the only status we care about is a change in interface binding
        if (dwStatusType is RIS_INTERFACE_ADDRESS_CHANGE)
        {
            // destroy existing binding
            if (INTERFACE_IS_BOUND(pieInterfaceEntry))
            {
                bBindingChanged = TRUE;
                dwErr = IE_UnBindInterface(pieInterfaceEntry);
                RTASSERT(dwErr is NO_ERROR);
            }

            // create new binding
            pBinding = (PIP_ADAPTER_BINDING_INFO) pvStatusInfo;
            if(pBinding->AddressCount)
            {
                bBindingChanged = TRUE;
                dwErr = IE_BindInterface(pieInterfaceEntry, pBinding);
                if (dwErr != NO_ERROR)
                    break;
            }
        }

        // interface needs to be deactivated even when the binding changes!
        // this restriction is due to the fact that the socket is bound to
        // the interface address and not the interface index...
        if (INTERFACE_IS_ACTIVE(pieInterfaceEntry) and
            (bBindingChanged or !bInterfaceActive))
        {
            dwErr = IE_DeactivateInterface(pieInterfaceEntry);
            if (dwErr != NO_ERROR)
                break;
        }

        // activate interface only when a binding exists!
        // i.e. we do not support unnumbered interfaces for now...
        if (INTERFACE_IS_INACTIVE(pieInterfaceEntry) and
            INTERFACE_IS_BOUND(pieInterfaceEntry) and
            bInterfaceActive)
        {
            dwErr = IE_ActivateInterface(pieInterfaceEntry);
            if (dwErr != NO_ERROR)
                break;
        }
    } while (FALSE);

    RELEASE_WRITE_LOCK(&((g_ce.pneNetworkEntry)->rwlLock));

    LEAVE_SAMPLE_API();

    return dwErr;
}

DWORD NM_ProcessRouteChange ( VOID )

Definition at line 758 of file networkmgr.c.

{
    DWORD           dwErr           = NO_ERROR;
    RTM_DEST_INFO   rdiDestination;             // 1 view registered for change
    BOOL            bDone           = FALSE;
    UINT            uiNumDests;

    if (!ENTER_SAMPLE_API()) { return ERROR_CAN_NOT_COMPLETE; }

    // loop dequeueing messages until RTM says there are no more left
    while (!bDone)
    {
        // retrieve route changes
        uiNumDests = 1;
        dwErr = RTM_GetChangedDests(
            g_ce.hRtmHandle,                    // my RTMv2 handle
            g_ce.hRtmNotificationHandle,        // my notification handle
            &uiNumDests,                        // IN   # dest info's required
                                                // OUT  # dest info's supplied
            &rdiDestination);                   // OUT  buffer for dest info's

        switch (dwErr)
        {
            case ERROR_NO_MORE_ITEMS:
                bDone = TRUE;
                dwErr = NO_ERROR;
                if (uiNumDests < 1)
                    break;
                // else continue below to process the last destination

            case NO_ERROR:
                RTASSERT(uiNumDests is 1);
                RTM_DisplayDestInfo(&rdiDestination);

                // release the destination info
                if (RTM_ReleaseChangedDests(
                    g_ce.hRtmHandle,            // my RTMv2 handle
                    g_ce.hRtmNotificationHandle,// my notif handle
                    uiNumDests,                 // 1
                    &rdiDestination             // released dest info
                    ) != NO_ERROR)
                    TRACE0(NETWORK, "Error releasing changed dests");

                break;

            default:
                bDone = TRUE;
                TRACE1(NETWORK, "Error %u RtmGetChangedDests", dwErr);
                break;
        }
    } // while

    LEAVE_SAMPLE_API();

    return dwErr;
}

DWORD NM_SetInterfaceInfo | ( | IN DWORD | dwInterfaceIndex,
 |  | IN PVOID | pvInterfaceInfo
 | ) |  |

Definition at line 625 of file networkmgr.c.

{
    DWORD               dwErr               = NO_ERROR;
    PIPSAMPLE_IF_CONFIG piic;
    PINTERFACE_ENTRY    pieInterfaceEntry   = NULL;

    if (!ENTER_SAMPLE_API()) { return ERROR_CAN_NOT_COMPLETE; }

    ACQUIRE_WRITE_LOCK(&((g_ce.pneNetworkEntry)->rwlLock));

    do                          // breakout loop
    {
        // fail if the interface does not exist
        dwErr = IE_Get(dwInterfaceIndex, &pieInterfaceEntry);
        if (dwErr != NO_ERROR)
            break;

        // fail if the configuration is invalid
        piic = (PIPSAMPLE_IF_CONFIG) pvInterfaceInfo;
        if(!ValidateInterfaceConfig(piic))
        {
            dwErr = ERROR_INVALID_PARAMETER;
            break;
        }

        // update our configuration
        pieInterfaceEntry->ulMetric         = piic->ulMetric;

        // might need additional processing depending on the state change
        // caused by the updated interface configuration and the protocol
        // behavior.  for instance, sockets may need to be created/shutdown

    } while (FALSE);

    RELEASE_WRITE_LOCK(&((g_ce.pneNetworkEntry)->rwlLock));

    LEAVE_SAMPLE_API();

    return dwErr;
}

Generated on Wed Nov 13 2024 16:54:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/ip/packet.c File Reference

  • NetDS
  • RRas
  • ip
Defines | Functions

packet.c File Reference

#include "pchsample.h"

Go to the source code of this file.

Defines

#define | CELEMS(x) ((sizeof(x))/(sizeof(x[0])))

Functions

DWORD | PacketCreate (OUT PPACKET *ppPacket)
DWORD | PacketDestroy (IN PPACKET pPacket)

Define Documentation

#define CELEMS ( x ) ((sizeof(x))/(sizeof(x[0])))

Definition at line 19 of file packet.c.

Function Documentation

DWORD PacketCreate ( OUT PPACKET * ppPacket )

Definition at line 22 of file packet.c.

{
    DWORD   dwErr   = NO_ERROR;

    // validate parameters
    if (!ppPacket)
        return ERROR_INVALID_PARAMETER;

    do                          // breakout loop
    {
        // allocate and zero out the packet structure
        MALLOC(ppPacket, sizeof(PACKET), &dwErr);
        if (dwErr != NO_ERROR)
            break;

        // initialize fields

        // ((*ppPacket)->ipSource  zero'ed out

        _snprintf((*ppPacket)->rgbyBuffer, CELEMS((*ppPacket)->rgbyBuffer), "hello world!"); // for now

        (*ppPacket)->wsaBuffer.buf = (*ppPacket)->rgbyBuffer;
        (*ppPacket)->wsaBuffer.len = strlen((*ppPacket)->rgbyBuffer);

    } while (FALSE);

    return dwErr;
}

DWORD PacketDestroy ( IN PPACKET pPacket )

Definition at line 71 of file packet.c.

{
    // validate parameters
    if (!pPacket)
        return NO_ERROR;

    FREE(pPacket);

    return NO_ERROR;
}

Generated on Wed Nov 13 2024 16:54:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/ip/packet.h File Reference

  • NetDS
  • RRas
  • ip
Classes | Defines | Typedefs | Functions

packet.h File Reference

Go to the source code of this file.

Classes

struct | _PACKET

Defines

#define | PacketDisplay(pPacket)

Typedefs

typedef struct _PACKET | PACKET
typedef struct _PACKET * | PPACKET

Functions

DWORD | PacketCreate (OUT PPACKET *ppPacket)
DWORD | PacketDestroy (IN PPACKET pPacket)

Define Documentation

#define PacketDisplay ( pPacket )

Definition at line 46 of file packet.h.

Typedef Documentation

typedef struct _PACKET PACKET
typedef struct _PACKET * PPACKET

Function Documentation

DWORD PacketCreate ( OUT PPACKET * ppPacket )

Definition at line 22 of file packet.c.

{
    DWORD   dwErr   = NO_ERROR;

    // validate parameters
    if (!ppPacket)
        return ERROR_INVALID_PARAMETER;

    do                          // breakout loop
    {
        // allocate and zero out the packet structure
        MALLOC(ppPacket, sizeof(PACKET), &dwErr);
        if (dwErr != NO_ERROR)
            break;

        // initialize fields

        // ((*ppPacket)->ipSource  zero'ed out

        _snprintf((*ppPacket)->rgbyBuffer, CELEMS((*ppPacket)->rgbyBuffer), "hello world!"); // for now

        (*ppPacket)->wsaBuffer.buf = (*ppPacket)->rgbyBuffer;
        (*ppPacket)->wsaBuffer.len = strlen((*ppPacket)->rgbyBuffer);

    } while (FALSE);

    return dwErr;
}

DWORD PacketDestroy ( IN PPACKET pPacket )

Definition at line 71 of file packet.c.

{
    // validate parameters
    if (!pPacket)
        return NO_ERROR;

    FREE(pPacket);

    return NO_ERROR;
}

Generated on Wed Nov 13 2024 16:54:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/ip/pchsample.h File Reference

  • NetDS
  • RRas
  • ip
Defines

pchsample.h File Reference

#include <winsock2.h>
#include <ws2tcpip.h>
#include <routprot.h>
#include <rtmv2.h>
#include <iprtrmib.h>
#include <mgm.h>
#include <mprerror.h>
#include <rtutils.h>
#include <stdio.h>
#include <wchar.h>
#include "ipsamplerm.h"
#include "list.h"
#include "hashtable.h"
#include "sync.h"
#include "log.h"
#include "defs.h"
#include "utils.h"
#include "packet.h"
#include "socket.h"
#include "networkentry.h"
#include "networkmgr.h"
#include "configentry.h"
#include "configmgr.h"
#include "mibmgr.h"
#include "rtmapi.h"
#include "ipsamplerm.h"
#include "list.h"
#include "defs.h"
#include "utils.h"

Go to the source code of this file.

Defines

#define FD_SETSIZE 256

Define Documentation

#define FD_SETSIZE 256

Definition at line 23 of file pchsample.h.

Generated on Wed Nov 13 2024 16:54:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/ip/rmapi.c File Reference

  • NetDS
  • RRas
  • ip
Functions

rmapi.c File Reference

#include "pchsample.h"

Go to the source code of this file.

Functions

DWORD WINAPI | AddInterface (IN LPWSTR InterfaceName, IN ULONG InterfaceIndex, IN NET_INTERFACE_TYPE InterfaceType, IN DWORD MediaType, IN WORD AccessType, IN WORD ConnectionType, IN PVOID InterfaceInfo, IN ULONG StructureVersion, IN ULONG StructureSize, IN ULONG StructureCount)
DWORD WINAPI | DeleteInterface (IN ULONG InterfaceIndex)
DWORD WINAPI | DoUpdateRoutes (IN ULONG InterfaceIndex)
DWORD WINAPI | GetEventMessage (OUT ROUTING_PROTOCOL_EVENTS *Event, OUT MESSAGE *Result)
DWORD WINAPI | GetGlobalInfo (IN PVOID GlobalInfo, IN OUT PULONG BufferSize, OUT PULONG StructureVersion, OUT PULONG StructureSize, OUT PULONG StructureCount)
DWORD WINAPI | GetInterfaceConfigInfo (IN ULONG InterfaceIndex, IN PVOID InterfaceInfo, IN OUT PULONG BufferSize, OUT PULONG StructureVersion, OUT PULONG StructureSize, OUT PULONG StructureCount)
DWORD WINAPI | InterfaceStatus (IN ULONG InterfaceIndex, IN BOOL InterfaceActive, IN DWORD StatusType, IN PVOID StatusInfo)
DWORD WINAPI | MibCreate (IN ULONG InputDataSize, IN PVOID InputData)
DWORD WINAPI | MibDelete (IN ULONG InputDataSize, IN PVOID InputData)
DWORD WINAPI | MibGet (IN ULONG InputDataSize, IN PVOID InputData, IN OUT PULONG OutputDataSize, OUT PVOID OutputData)
DWORD WINAPI | MibGetFirst (IN ULONG InputDataSize, IN PVOID InputData, IN OUT PULONG OutputDataSize, OUT PVOID OutputData)
DWORD WINAPI | MibGetNext (IN ULONG InputDataSize, IN PVOID InputData, IN OUT PULONG OutputDataSize, OUT PVOID OutputData)
DWORD WINAPI | MibGetTrapInfo (IN ULONG InputDataSize, IN PVOID InputData, OUT PULONG OutputDataSize, OUT PVOID OutputData)
DWORD WINAPI | MibSet (IN ULONG InputDataSize, IN PVOID InputData)
DWORD WINAPI | MibSetTrapInfo (IN HANDLE Event, IN ULONG InputDataSize, IN PVOID InputData, OUT PULONG OutputDataSize, OUT PVOID OutputData)
DWORD APIENTRY | RegisterProtocol (IN OUT PMPR_ROUTING_CHARACTERISTICS pRoutingChar, IN OUT PMPR_SERVICE_CHARACTERISTICS pServiceChar)
DWORD WINAPI | SetGlobalInfo (IN PVOID GlobalInfo, IN ULONG StructureVersion, IN ULONG StructureSize, IN ULONG StructureCount)
DWORD WINAPI | SetInterfaceConfigInfo (IN ULONG InterfaceIndex, IN PVOID InterfaceInfo, IN ULONG StructureVersion, IN ULONG StructureSize, IN ULONG StructureCount)
DWORD WINAPI | StartComplete (VOID)
DWORD WINAPI | StartProtocol (IN HANDLE NotificationEvent, IN PSUPPORT_FUNCTIONS SupportFunctions, IN LPVOID GlobalInfo, IN ULONG StructureVersion, IN ULONG StructureSize, IN ULONG StructureCount)
DWORD WINAPI | StopProtocol (VOID)

Function Documentation

DWORD WINAPI AddInterface | ( | IN LPWSTR | InterfaceName,
 |  | IN ULONG | InterfaceIndex,
 |  | IN NET_INTERFACE_TYPE | InterfaceType,
 |  | IN DWORD | MediaType,
 |  | IN WORD | AccessType,
 |  | IN WORD | ConnectionType,
 |  | IN PVOID | InterfaceInfo,
 |  | IN ULONG | StructureVersion,
 |  | IN ULONG | StructureSize,
 |  | IN ULONG | StructureCount
 | ) |  |

Definition at line 232 of file rmapi.c.

{
    DWORD dwErr = NO_ERROR;

    TRACE4(ENTER, "Entering AddInterface: %S %u %u 0x%08x",
           InterfaceName, InterfaceIndex, AccessType, InterfaceInfo);

    // interface properties unused for now
    UNREFERENCED_PARAMETER(InterfaceType);
    UNREFERENCED_PARAMETER(MediaType);
    UNREFERENCED_PARAMETER(ConnectionType);

    if (AccessType != IF_ACCESS_POINTTOPOINT)
        AccessType = IF_ACCESS_BROADCAST;

    do                          // breakout loop
    {
        // validate parameters
        if ((wcslen(InterfaceName) is 0) or
            !((AccessType is IF_ACCESS_BROADCAST) or
              (AccessType is IF_ACCESS_POINTTOPOINT)) or
            !InterfaceInfo)
        {
            dwErr = ERROR_INVALID_PARAMETER;
            break;
        }

        dwErr = NM_AddInterface(InterfaceName,
                                InterfaceIndex,
                                AccessType,
                                InterfaceInfo);
    } while(FALSE);

    TRACE1(LEAVE, "Leaving  AddInterface: %u", dwErr);

    return dwErr;
}

DWORD WINAPI DeleteInterface ( IN ULONG InterfaceIndex )

Definition at line 306 of file rmapi.c.

{
    DWORD dwErr = NO_ERROR;

    TRACE1(ENTER, "Entering DeleteInterface: %u", InterfaceIndex);

    dwErr = NM_DeleteInterface(InterfaceIndex);

    TRACE1(LEAVE, "Leaving  DeleteInterface: %u", dwErr);

    return dwErr;
}

DWORD WINAPI DoUpdateRoutes ( IN ULONG InterfaceIndex )

Definition at line 593 of file rmapi.c.

{
    DWORD dwErr = NO_ERROR;

    TRACE1(ENTER, "Entering DoUpdateRoutes: %u", InterfaceIndex);

    dwErr = NM_DoUpdateRoutes(InterfaceIndex);

    TRACE1(LEAVE, "Leaving  DoUpdateRoutes: %u", dwErr);

    return dwErr;
}

DWORD WINAPI GetEventMessage | ( | OUT ROUTING_PROTOCOL_EVENTS * | Event,
 |  | OUT MESSAGE * | Result
 | ) |  |

Definition at line 545 of file rmapi.c.

{
    DWORD dwErr = NO_ERROR;

    TRACE2(ENTER, "Entering GetEventMessage: 0x%08x 0x%08x",
           Event, Result);

    do                          // breakout loop
    {
        // validate parameters
        if (!Event or !Result)
        {
            dwErr = ERROR_INVALID_PARAMETER;
            break;
        }

        dwErr = CM_GetEventMessage(Event, Result);

    } while(FALSE);

    TRACE1(LEAVE, "Leaving  GetEventMessage: %u", dwErr);

    return dwErr;
}

DWORD WINAPI GetGlobalInfo | ( | IN PVOID | GlobalInfo,
 |  | IN OUT PULONG | BufferSize,
 |  | OUT PULONG | StructureVersion,
 |  | OUT PULONG | StructureSize,
 |  | OUT PULONG | StructureCount
 | ) |  |

Definition at line 126 of file rmapi.c.

{
    DWORD dwErr = NO_ERROR;

    TRACE2(ENTER, "Entering GetGlobalInfo: 0x%08x 0x%08x",
           GlobalInfo, BufferSize);

    do                          // breakout loop
    {
        // validate parameters
        if (!BufferSize)
        {
            dwErr = ERROR_INVALID_PARAMETER;
            break;
        }

        dwErr = CM_GetGlobalInfo(GlobalInfo,
                                 BufferSize,
                                 StructureVersion,
                                 StructureSize,
                                 StructureCount);
    } while(FALSE);

    TRACE1(LEAVE, "Leaving  GetGlobalInfo: %u", dwErr);

    return dwErr;
}

DWORD WINAPI GetInterfaceConfigInfo | ( | IN ULONG | InterfaceIndex,
 |  | IN PVOID | InterfaceInfo,
 |  | IN OUT PULONG | BufferSize,
 |  | OUT PULONG | StructureVersion,
 |  | OUT PULONG | StructureSize,
 |  | OUT PULONG | StructureCount
 | ) |  |

Definition at line 431 of file rmapi.c.

{
    DWORD dwErr = NO_ERROR;

    TRACE3(ENTER, "Entering GetInterfaceConfigInfo: %u 0x%08x 0x%08x",
           InterfaceIndex, InterfaceInfo, BufferSize);

    do                          // breakout loop
    {
        // validate parameters
        if(BufferSize is NULL)
        {
            dwErr = ERROR_INVALID_PARAMETER;
            break;
        }

        dwErr = NM_GetInterfaceInfo(InterfaceIndex,
                                    InterfaceInfo,
                                    BufferSize,
                                    StructureVersion,
                                    StructureSize,
                                    StructureCount);
    } while(FALSE);

    TRACE1(LEAVE, "Leaving  GetInterfaceConfigInfo: %u",
           dwErr);

    return dwErr;
}

DWORD WINAPI InterfaceStatus | ( | IN ULONG | InterfaceIndex,
 |  | IN BOOL | InterfaceActive,
 |  | IN DWORD | StatusType,
 |  | IN PVOID | StatusInfo
 | ) |  |

Definition at line 339 of file rmapi.c.

{
    DWORD dwErr = NO_ERROR;

    TRACE4(ENTER, "Entering InterfaceStatus: %u %u %u 0x%08x",
           InterfaceIndex, InterfaceActive, StatusType, StatusInfo);

    do                          // breakout loop
    {
        dwErr = NM_InterfaceStatus(InterfaceIndex,
                                   InterfaceActive,
                                   StatusType,
                                   StatusInfo);
    } while(FALSE);

    TRACE1(LEAVE, "Leaving  InterfaceStatus: %u", dwErr);

    return dwErr;
}

DWORD WINAPI MibCreate | ( | IN ULONG | InputDataSize,
 |  | IN PVOID | InputData
 | ) |  |

Definition at line 636 of file rmapi.c.

{
    DWORD dwErr = ERROR_CAN_NOT_COMPLETE;

    TRACE2(ENTER, "Entering MibCreate: %u 0x%08x",
           InputDataSize, InputData);

    TRACE1(LEAVE, "Leaving  MibCreate: %u", dwErr);

    return dwErr;
}

DWORD WINAPI MibDelete | ( | IN ULONG | InputDataSize,
 |  | IN PVOID | InputData
 | ) |  |

Definition at line 672 of file rmapi.c.

{
    DWORD dwErr = ERROR_CAN_NOT_COMPLETE;

    TRACE2(ENTER, "Entering MibDelete: %u 0x%08x",
           InputDataSize, InputData);

    TRACE1(LEAVE, "Leaving  MibDelete: %u", dwErr);

    return dwErr;
}

DWORD WINAPI MibGet | ( | IN ULONG | InputDataSize,
 |  | IN PVOID | InputData,
 |  | IN OUT PULONG | OutputDataSize,
 |  | OUT PVOID | OutputData
 | ) |  |

Definition at line 754 of file rmapi.c.

{
    DWORD dwErr = NO_ERROR;

    TRACE4(ENTER, "Entering MibGet: %u 0x%08x 0x%08x 0x%08x",
           InputDataSize, InputData, OutputDataSize, OutputData);

    do                          // breakout loop
    {
        // validate parameters
        if ((!InputData) or
            (InputDataSize < sizeof(IPSAMPLE_MIB_GET_INPUT_DATA)) or
            (!OutputDataSize))
        {
            dwErr = ERROR_INVALID_PARAMETER;
            break;
        }

        dwErr = MM_MibGet((PIPSAMPLE_MIB_GET_INPUT_DATA) InputData,
                          (PIPSAMPLE_MIB_GET_OUTPUT_DATA) OutputData,
                          OutputDataSize,
                          GET_EXACT);

    } while(FALSE);

    TRACE1(LEAVE, "Leaving  MibGet: %u", dwErr);

    return dwErr;
}

DWORD WINAPI MibGetFirst | ( | IN ULONG | InputDataSize,
 |  | IN PVOID | InputData,
 |  | IN OUT PULONG | OutputDataSize,
 |  | OUT PVOID | OutputData
 | ) |  |

Definition at line 819 of file rmapi.c.

{
    DWORD dwErr = NO_ERROR;

    TRACE4(ENTER, "Entering MibGetFirst: %u 0x%08x 0x%08x 0x%08x",
           InputDataSize, InputData, OutputDataSize, OutputData);

    do                          // breakout loop
    {
        // validate parameters
        if ((!InputData) or
            (InputDataSize < sizeof(IPSAMPLE_MIB_GET_INPUT_DATA)) or
            (!OutputDataSize))
        {
            dwErr = ERROR_INVALID_PARAMETER;
            break;
        }

        dwErr = MM_MibGet((PIPSAMPLE_MIB_GET_INPUT_DATA) InputData,
                          (PIPSAMPLE_MIB_GET_OUTPUT_DATA) OutputData,
                          OutputDataSize,
                          GET_FIRST);

    } while(FALSE);

    TRACE1(LEAVE, "Leaving  MibGetFirst: %u", dwErr);

    return dwErr;
}

DWORD WINAPI MibGetNext | ( | IN ULONG | InputDataSize,
 |  | IN PVOID | InputData,
 |  | IN OUT PULONG | OutputDataSize,
 |  | OUT PVOID | OutputData
 | ) |  |

Definition at line 886 of file rmapi.c.

{
    DWORD                           dwErr   = NO_ERROR;

    TRACE4(ENTER, "Entering MibGetFirst: %u 0x%08x 0x%08x 0x%08x",
           InputDataSize, InputData, OutputDataSize, OutputData);

    do                          // breakout loop
    {
        // validate parameters
        if ((!InputData) or
            (InputDataSize < sizeof(IPSAMPLE_MIB_GET_INPUT_DATA)) or
            (!OutputDataSize))
        {
            dwErr = ERROR_INVALID_PARAMETER;
            break;
        }

        dwErr = MM_MibGet((PIPSAMPLE_MIB_GET_INPUT_DATA) InputData,
                          (PIPSAMPLE_MIB_GET_OUTPUT_DATA) OutputData,
                          OutputDataSize,
                          GET_NEXT);

    } while(FALSE);

    TRACE1(LEAVE, "Leaving  MibGetNext: %u", dwErr);

    return dwErr;
}

DWORD WINAPI MibGetTrapInfo | ( | IN ULONG | InputDataSize,
 |  | IN PVOID | InputData,
 |  | OUT PULONG | OutputDataSize,
 |  | OUT PVOID | OutputData
 | ) |  |

Definition at line 987 of file rmapi.c.

{
    DWORD dwErr = ERROR_CAN_NOT_COMPLETE;

    TRACE0(ENTER, "Entering MibGetTrapInfo");
    TRACE1(LEAVE, "Leaving  MibGetTrapInfo: %u", dwErr);

    return dwErr;
}

DWORD WINAPI MibSet | ( | IN ULONG | InputDataSize,
 |  | IN PVOID | InputData
 | ) |  |

Definition at line 707 of file rmapi.c.

{
    DWORD dwErr = NO_ERROR;

    TRACE2(ENTER, "Entering MibSet: %u 0x%08x",
           InputDataSize, InputData);

    do                          // breakout loop
    {
        // validate parameters
        if ((!InputData) or
            (InputDataSize < sizeof(IPSAMPLE_MIB_SET_INPUT_DATA)))
        {
            dwErr = ERROR_INVALID_PARAMETER;
            break;
        }

        dwErr = MM_MibSet((PIPSAMPLE_MIB_SET_INPUT_DATA) InputData);

    } while(FALSE);

    TRACE1(LEAVE, "Leaving  MibSet: %u", dwErr);

    return dwErr;
}

DWORD WINAPI MibSetTrapInfo | ( | IN HANDLE | Event,
 |  | IN ULONG | InputDataSize,
 |  | IN PVOID | InputData,
 |  | OUT PULONG | OutputDataSize,
 |  | OUT PVOID | OutputData
 | ) |  |

Definition at line 958 of file rmapi.c.

{
    DWORD dwErr = ERROR_CAN_NOT_COMPLETE;

    TRACE0(ENTER, "Entering MibSetTrapInfo");
    TRACE1(LEAVE, "Leaving  MibSetTrapInfo: %u", dwErr);

    return dwErr;
}

DWORD APIENTRY RegisterProtocol | ( | IN OUT PMPR_ROUTING_CHARACTERISTICS | pRoutingChar,
 |  | IN OUT PMPR_SERVICE_CHARACTERISTICS | pServiceChar
 | ) |  |

Definition at line 1021 of file rmapi.c.

{
    DWORD   dwErr = NO_ERROR;

    TRACE0(ENTER, "Entering RegisterProtocol");

    do                          // breakout loop
    {
        if(pRoutingChar->dwProtocolId != MS_IP_SAMPLE)
        {
            dwErr = ERROR_NOT_SUPPORTED;
            break;
        }

        if  ((pRoutingChar->fSupportedFunctionality
              & (RF_ROUTING|RF_DEMAND_UPDATE_ROUTES)) !=
             (RF_ROUTING|RF_DEMAND_UPDATE_ROUTES))
        {
            dwErr = ERROR_NOT_SUPPORTED;
            break;
        }

        pRoutingChar->fSupportedFunctionality =
            (RF_ROUTING | RF_DEMAND_UPDATE_ROUTES);

        // Since we are not a service advertiser (and IPX thing)
        pServiceChar->fSupportedFunctionality = 0;

        pRoutingChar->pfnStartProtocol      = StartProtocol;
        pRoutingChar->pfnStartComplete      = StartComplete;
        pRoutingChar->pfnStopProtocol       = StopProtocol;
        pRoutingChar->pfnGetGlobalInfo      = GetGlobalInfo;
        pRoutingChar->pfnSetGlobalInfo      = SetGlobalInfo;
        pRoutingChar->pfnQueryPower         = NULL;
        pRoutingChar->pfnSetPower           = NULL;

        pRoutingChar->pfnAddInterface       = AddInterface;
        pRoutingChar->pfnDeleteInterface    = DeleteInterface;
        pRoutingChar->pfnInterfaceStatus    = InterfaceStatus;
        pRoutingChar->pfnGetInterfaceInfo   = GetInterfaceConfigInfo;
        pRoutingChar->pfnSetInterfaceInfo   = SetInterfaceConfigInfo;

        pRoutingChar->pfnGetEventMessage    = GetEventMessage;

        pRoutingChar->pfnUpdateRoutes       = DoUpdateRoutes;

        pRoutingChar->pfnConnectClient      = NULL;
        pRoutingChar->pfnDisconnectClient   = NULL;

        pRoutingChar->pfnGetNeighbors       = NULL;
        pRoutingChar->pfnGetMfeStatus       = NULL;

        pRoutingChar->pfnMibCreateEntry     = MibCreate;
        pRoutingChar->pfnMibDeleteEntry     = MibDelete;
        pRoutingChar->pfnMibGetEntry        = MibGet;
        pRoutingChar->pfnMibSetEntry        = MibSet;
        pRoutingChar->pfnMibGetFirstEntry   = MibGetFirst;
        pRoutingChar->pfnMibGetNextEntry    = MibGetNext;
        pRoutingChar->pfnMibSetTrapInfo     = MibSetTrapInfo;
        pRoutingChar->pfnMibGetTrapInfo     = MibGetTrapInfo;
    } while (FALSE);

    TRACE1(LEAVE, "Leaving RegisterProtocol: %u", dwErr);

    return dwErr;
}

DWORD WINAPI SetGlobalInfo | ( | IN PVOID | GlobalInfo,
 |  | IN ULONG | StructureVersion,
 |  | IN ULONG | StructureSize,
 |  | IN ULONG | StructureCount
 | ) |  |

Definition at line 182 of file rmapi.c.

{
    DWORD dwErr = NO_ERROR;

    TRACE1(ENTER, "Entering SetGlobalInfo: 0x%08x", GlobalInfo);

    do                          // breakout loop
    {
        // validate parameters
        if (!GlobalInfo)
        {
            dwErr = ERROR_INVALID_PARAMETER;
            break;
        }

        dwErr = CM_SetGlobalInfo(GlobalInfo);

    } while(FALSE);

    TRACE1(LEAVE, "Leaving  SetGlobalInfo: %u", dwErr);

    return NO_ERROR;
}

DWORD WINAPI SetInterfaceConfigInfo | ( | IN ULONG | InterfaceIndex,
 |  | IN PVOID | InterfaceInfo,
 |  | IN ULONG | StructureVersion,
 |  | IN ULONG | StructureSize,
 |  | IN ULONG | StructureCount
 | ) |  |

Definition at line 492 of file rmapi.c.

{
    DWORD dwErr = NO_ERROR;

    TRACE2(ENTER, "Entering SetInterfaceConfigInfo: %u 0x%08x",
           InterfaceIndex, InterfaceInfo);

    do                          // breakout loop
    {
        // validate parameters
        if(InterfaceInfo is NULL)
        {
            dwErr = ERROR_INVALID_PARAMETER;
            break;
        }

        dwErr = NM_SetInterfaceInfo(InterfaceIndex, InterfaceInfo);
    } while(FALSE);

    TRACE1(LEAVE, "Leaving  SetInterfaceConfigInfo: %u", dwErr);

    return dwErr;
}

DWORD WINAPI StartComplete ( VOID )

Definition at line 77 of file rmapi.c.

{
    TRACE0(ENTER, "Entering StartComplete");
    TRACE0(LEAVE, "Leaving  StartComplete");

    return NO_ERROR;
}

DWORD WINAPI StartProtocol | ( | IN HANDLE | NotificationEvent,
 |  | IN PSUPPORT_FUNCTIONS | SupportFunctions,
 |  | IN LPVOID | GlobalInfo,
 |  | IN ULONG | StructureVersion,
 |  | IN ULONG | StructureSize,
 |  | IN ULONG | StructureCount
 | ) |  |

Definition at line 21 of file rmapi.c.

{
    DWORD dwErr = NO_ERROR;

    TRACE3(ENTER, "Entering StartProtocol 0x%08x 0x%08x 0x%08x",
           NotificationEvent, SupportFunctions, GlobalInfo);

    do                          // breakout loop
    {
        // validate parameters
        if (!NotificationEvent or
            !SupportFunctions  or
            !GlobalInfo)
        {
            dwErr = ERROR_INVALID_PARAMETER;
            break;
        }

        dwErr = CM_StartProtocol(NotificationEvent,
                                 SupportFunctions,
                                 GlobalInfo);
    } while(FALSE);

    TRACE1(LEAVE, "Leaving  StartProtocol: %u", dwErr);

    return dwErr;
}

DWORD WINAPI StopProtocol ( VOID )

Definition at line 90 of file rmapi.c.

{
    DWORD dwErr = NO_ERROR;

    TRACE0(ENTER, "Entering StopProtocol");

    dwErr = CM_StopProtocol();

    TRACE1(LEAVE, "Leaving  StopProtocol: %u", dwErr);

    return dwErr;
}

Generated on Wed Nov 13 2024 16:54:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/ip/rmapi.h File Reference

  • NetDS
  • RRas
  • ip
Functions

rmapi.h File Reference

Go to the source code of this file.

Functions

DWORD APIENTRY RegisterProtocol (IN OUT PMPR_ROUTING_CHARACTERISTICS pRoutingChar, IN OUT PMPR_SERVICE_CHARACTERISTICS pServiceChar)

Function Documentation

DWORD APIENTRY RegisterProtocol | ( | IN OUT PMPR_ROUTING_CHARACTERISTICS | pRoutingChar,
 |  | IN OUT PMPR_SERVICE_CHARACTERISTICS | pServiceChar
 | ) |  |

Definition at line 1021 of file rmapi.c.

{
    DWORD   dwErr = NO_ERROR;

    TRACE0(ENTER, "Entering RegisterProtocol");

    do                          // breakout loop
    {
        if(pRoutingChar->dwProtocolId != MS_IP_SAMPLE)
        {
            dwErr = ERROR_NOT_SUPPORTED;
            break;
        }

        if  ((pRoutingChar->fSupportedFunctionality
              & (RF_ROUTING|RF_DEMAND_UPDATE_ROUTES)) !=
             (RF_ROUTING|RF_DEMAND_UPDATE_ROUTES))
        {
            dwErr = ERROR_NOT_SUPPORTED;
            break;
        }

        pRoutingChar->fSupportedFunctionality =
            (RF_ROUTING | RF_DEMAND_UPDATE_ROUTES);

        // Since we are not a service advertiser (and IPX thing)
        pServiceChar->fSupportedFunctionality = 0;

        pRoutingChar->pfnStartProtocol      = StartProtocol;
        pRoutingChar->pfnStartComplete      = StartComplete;
        pRoutingChar->pfnStopProtocol       = StopProtocol;
        pRoutingChar->pfnGetGlobalInfo      = GetGlobalInfo;
        pRoutingChar->pfnSetGlobalInfo      = SetGlobalInfo;
        pRoutingChar->pfnQueryPower         = NULL;
        pRoutingChar->pfnSetPower           = NULL;

        pRoutingChar->pfnAddInterface       = AddInterface;
        pRoutingChar->pfnDeleteInterface    = DeleteInterface;
        pRoutingChar->pfnInterfaceStatus    = InterfaceStatus;
        pRoutingChar->pfnGetInterfaceInfo   = GetInterfaceConfigInfo;
        pRoutingChar->pfnSetInterfaceInfo   = SetInterfaceConfigInfo;

        pRoutingChar->pfnGetEventMessage    = GetEventMessage;

        pRoutingChar->pfnUpdateRoutes       = DoUpdateRoutes;

        pRoutingChar->pfnConnectClient      = NULL;
        pRoutingChar->pfnDisconnectClient   = NULL;

        pRoutingChar->pfnGetNeighbors       = NULL;
        pRoutingChar->pfnGetMfeStatus       = NULL;

        pRoutingChar->pfnMibCreateEntry     = MibCreate;
        pRoutingChar->pfnMibDeleteEntry     = MibDelete;
        pRoutingChar->pfnMibGetEntry        = MibGet;
        pRoutingChar->pfnMibSetEntry        = MibSet;
        pRoutingChar->pfnMibGetFirstEntry   = MibGetFirst;
        pRoutingChar->pfnMibGetNextEntry    = MibGetNext;
        pRoutingChar->pfnMibSetTrapInfo     = MibSetTrapInfo;
        pRoutingChar->pfnMibGetTrapInfo     = MibGetTrapInfo;
    } while (FALSE);

    TRACE1(LEAVE, "Leaving RegisterProtocol: %u", dwErr);

    return dwErr;
}

Generated on Wed Nov 13 2024 16:54:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/ip/rtmapi.c File Reference

  • NetDS
  • RRas
  • ip
Defines | Functions

rtmapi.c File Reference

#include "pchsample.h"

Go to the source code of this file.

Defines

#define | DisplayRtmDestInfo(prdi)

Functions

DWORD APIENTRY | RTM_CallbackEvent (IN RTM_ENTITY_HANDLE hRtmHandle, IN RTM_EVENT_TYPE retEvent, IN PVOID pvContext1, IN PVOID pvContext2)
DWORD | RTM_NextHop (IN PRTM_DEST_INFO prdiDestination, OUT PDWORD pdwIfIndex, OUT PIPADDRESS pipNeighbor)

Define Documentation

#define DisplayRtmDestInfo ( prdi )

Definition at line 51 of file rtmapi.c.

Function Documentation

DWORD APIENTRY RTM_CallbackEvent | ( | IN RTM_ENTITY_HANDLE | hRtmHandle,
 |  | IN RTM_EVENT_TYPE | retEvent,
 |  | IN PVOID | pvContext1,
 |  | IN PVOID | pvContext2
 | ) |  |

Definition at line 160 of file rtmapi.c.

{
    DWORD dwErr = NO_ERROR;

    TRACE1(ENTER, "Entering RTM_CallbackEvent: %u", retEvent);

    do                          // breakout loop
    {
        UNREFERENCED_PARAMETER(hRtmHandle);
        UNREFERENCED_PARAMETER(pvContext1);
        UNREFERENCED_PARAMETER(pvContext2);

        // only route change notifications are processed
        if (retEvent != RTM_CHANGE_NOTIFICATION)
        {
            dwErr = ERROR_NOT_SUPPORTED;
            break;
        }

        dwErr = NM_ProcessRouteChange();
    } while (FALSE);

    TRACE0(LEAVE, "Leaving  RTM_CallbackEvent");

    return dwErr;
}

DWORD RTM_NextHop | ( | IN PRTM_DEST_INFO | prdiDestination,
 |  | OUT PDWORD | pdwIfIndex,
 |  | OUT PIPADDRESS | pipNeighbor
 | ) |  |

Definition at line 57 of file rtmapi.c.

{
    DWORD               dwErr = NO_ERROR;
    PRTM_ROUTE_INFO     prriRoute;
    RTM_NEXTHOP_INFO    rniNextHop;
    BOOL                bRoute, bNextHop;

    // flags indicating handles held
    bRoute = bNextHop = FALSE;

    do                          // breakout loop
    {
        // allocate route info structure
        MALLOC(&prriRoute,
               RTM_SIZE_OF_ROUTE_INFO(g_ce.rrpRtmProfile.MaxNextHopsInRoute),
               &dwErr);
        if (dwErr != NO_ERROR)
            break;

        // get route info (best route in mcast view)
        dwErr = RtmGetRouteInfo (
            g_ce.hRtmHandle,
            prdiDestination->ViewInfo[0].Route,
            prriRoute,
            NULL);
        if (dwErr != NO_ERROR)
        {
            TRACE1(ANY, "Error %u getting route", dwErr);
            break;
        }
        bRoute = TRUE;

        // get nexthop info (first next hop for now...)
        dwErr = RtmGetNextHopInfo(
            g_ce.hRtmHandle,
            prriRoute->NextHopsList.NextHops[0],
            &rniNextHop);
        if (dwErr != NO_ERROR)
        {
            TRACE1(ANY, "Error %u getting next hop", dwErr);
            break;
        }
        bNextHop = TRUE;

        // finally!!! THIS SHOULD NOT BE A REMOTE NEXT HOP!!!
        *(pdwIfIndex) = rniNextHop.InterfaceIndex;
        RTM_GetAddress(pipNeighbor,
                       &(rniNextHop.NextHopAddress));
    } while (FALSE);

    if (dwErr != NO_ERROR)
        TRACE1(ANY, "Error %u obtaining next hop", dwErr);

    // release the handle to the next hop
    if (bNextHop)
    {
        if (RtmReleaseNextHopInfo(g_ce.hRtmHandle, &rniNextHop) != NO_ERROR)
            TRACE0(ANY, "Error releasing next hop, continuing...");
    }

    // release the handle to the route
    if (bRoute)
    {
        if (RtmReleaseRouteInfo(g_ce.hRtmHandle, prriRoute) != NO_ERROR)
            TRACE0(ANY, "Error releasing route, continuing...");
    }

    // deallocate route info structure
    if (prriRoute)
        FREE(prriRoute);

    return dwErr;
}

Generated on Wed Nov 13 2024 16:54:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/ip/rtmapi.h File Reference

  • NetDS
  • RRas
  • ip
Defines | Functions

rtmapi.h File Reference

Go to the source code of this file.

Defines

#define | RTM_DeregisterEntity(hHandle) RtmDeregisterEntity(hHandle)
#define | RTM_DeregisterFromChangeNotification(hHandle,hNotificationHandle)
#define | RTM_DisplayDestInfo(prdi)
#define | RTM_GetAddress(pipAddress,prnaAddress)
#define | RTM_GetChangedDests(hRtmHandle,hNotificationHandle,puiNumDests,pRtmDestInfo)
#define | RTM_GetMostSpecificDestination
#define | RTM_GetOpaqueInformationPointer
#define | RTM_IsMarkedForChangeNotification
#define | RTM_MarkDestForChangeNotification
#define | RTM_RegisterEntity(preiEntity,preemMethods,recCallback,bReserve,rrpProfile,phHandle)
#define | RTM_RegisterForChangeNotification(hHandle,rvsViews,rnfFlags,pvContext,phNotificationHandle)
#define | RTM_ReleaseChangedDests(hRtmHandle,hNotificationHandle,uiNumDests,pRtmDestInfo)
#define | RTM_ReleaseDestInfo
#define | RTM_SetAddress(prnaAddress,ipAddress)

Functions

DWORD APIENTRY | RTM_CallbackEvent (IN RTM_ENTITY_HANDLE hRtmHandle, IN RTM_EVENT_TYPE retEvent, IN PVOID pvContext1, IN PVOID pvContext2)
DWORD | RTM_NextHop (IN PRTM_DEST_INFO prdiDestination, OUT PDWORD pdwIfIndex, OUT PIPADDRESS pipNeighbor)

Define Documentation

#define RTM_DeregisterEntity ( hHandle ) RtmDeregisterEntity(hHandle)

Definition at line 36 of file rtmapi.h.

#define RTM_DeregisterFromChangeNotification | ( | hHandle,
 |  | hNotificationHandle
 | ) |
Value:
RtmDeregisterFromChangeNotification(hHandle,                        \
                                    hNotificationHandle)

Definition at line 54 of file rtmapi.h.

#define RTM_DisplayDestInfo ( prdi )

Definition at line 144 of file rtmapi.h.

#define RTM_GetAddress | ( | pipAddress,
 |  | prnaAddress
 | ) |
Value:
(                                                                   \
    IP_ASSIGN((pipAddress), (* (ULONG *)  (prnaAddress)->AddrBits)) \
)

Definition at line 87 of file rtmapi.h.

#define RTM_GetChangedDests | ( | hRtmHandle,
 |  | hNotificationHandle,
 |  | puiNumDests,
 |  | pRtmDestInfo
 | ) |
Value:
RtmGetChangedDests(hRtmHandle,                                      \
                   hNotificationHandle,                             \
                   puiNumDests,                                     \
                   pRtmDestInfo)

Definition at line 63 of file rtmapi.h.

#define RTM_GetMostSpecificDestination
Value:
(RtmRegHandle,               \
                                        DestAddress,                \
                                        ProtocolId,                 \
                                        TargetView,                 \
                                        DestInfo)                   \
RtmGetMostSpecificDestination (RtmRegHandle,                        \
                               DestAddress,                         \
                               ProtocolId,                          \
                               TargetView,                          \
                               DestInfo)

Definition at line 92 of file rtmapi.h.

#define RTM_GetOpaqueInformationPointer
Value:
(RtmRegHandle,              \
                                         DestHandle,                \
                                         OpaqueInfoPointer)         \
RtmGetOpaqueInformationPointer (RtmRegHandle,                       \
                                DestHandle,                         \
                                OpaqueInfoPointer)

Definition at line 126 of file rtmapi.h.

#define RTM_IsMarkedForChangeNotification
Value:
(RtmRegHandle,            \
                                           NotifyHandle,            \
                                           DestHandle,              \
                                           DestMarked)              \
RtmIsMarkedForChangeNotification (RtmRegHandle,                     \
                                  NotifyHandle,                     \
                                  DestHandle,                       \
                                  DestMarked)

Definition at line 117 of file rtmapi.h.

#define RTM_MarkDestForChangeNotification
Value:
(RtmRegHandle,            \
                                           NotifyHandle,            \
                                           DestHandle,              \
                                           MarkDest)                \
RtmMarkDestForChangeNotification (RtmRegHandle,                     \
                                  NotifyHandle,                     \
                                  DestHandle,                       \
                                  MarkDest)

Definition at line 108 of file rtmapi.h.

#define RTM_RegisterEntity | ( | preiEntity,
 |  | preemMethods,
 |  | recCallback,
 |  | bReserve,
 |  | rrpProfile,
 |  | phHandle
 | ) |
Value:
RtmRegisterEntity(preiEntity,                                       \
                  preemMethods,                                     \
                  recCallback,                                      \
                  bReserve,                                         \
                  rrpProfile,                                       \
                  phHandle)

Definition at line 27 of file rtmapi.h.

#define RTM_RegisterForChangeNotification | ( | hHandle,
 |  | rvsViews,
 |  | rnfFlags,
 |  | pvContext,
 |  | phNotificationHandle
 | ) |
Value:
RtmRegisterForChangeNotification(hHandle,                           \
                                 rvsViews,                          \
                                 rnfFlags,                          \
                                 pvContext,                         \
                                 phNotificationHandle)

Definition at line 45 of file rtmapi.h.

#define RTM_ReleaseChangedDests | ( | hRtmHandle,
 |  | hNotificationHandle,
 |  | uiNumDests,
 |  | pRtmDestInfo
 | ) |
Value:
RtmReleaseChangedDests(hRtmHandle,                                  \
                      hNotificationHandle,                          \
                      uiNumDests,                                   \
                      pRtmDestInfo)

Definition at line 73 of file rtmapi.h.

#define RTM_ReleaseDestInfo
Value:
(RtmRegHandle,                          \
                             DestInfo)                              \
RtmReleaseDestInfo (RtmRegHandle,                                   \
                    DestInfo)

Definition at line 103 of file rtmapi.h.

#define RTM_SetAddress | ( | prnaAddress,
 |  | ipAddress
 | ) |
Value:
RTM_IPV4_SET_ADDR_AND_LEN(prnaAddress,                              \
                          ipAddress,                                \
                          sizeof(IPADDRESS))

Definition at line 81 of file rtmapi.h.

Function Documentation

DWORD APIENTRY RTM_CallbackEvent | ( | IN RTM_ENTITY_HANDLE | hRtmHandle,
 |  | IN RTM_EVENT_TYPE | retEvent,
 |  | IN PVOID | pvContext1,
 |  | IN PVOID | pvContext2
 | ) |  |

Definition at line 160 of file rtmapi.c.

{
    DWORD dwErr = NO_ERROR;

    TRACE1(ENTER, "Entering RTM_CallbackEvent: %u", retEvent);

    do                          // breakout loop
    {
        UNREFERENCED_PARAMETER(hRtmHandle);
        UNREFERENCED_PARAMETER(pvContext1);
        UNREFERENCED_PARAMETER(pvContext2);

        // only route change notifications are processed
        if (retEvent != RTM_CHANGE_NOTIFICATION)
        {
            dwErr = ERROR_NOT_SUPPORTED;
            break;
        }

        dwErr = NM_ProcessRouteChange();
    } while (FALSE);

    TRACE0(LEAVE, "Leaving  RTM_CallbackEvent");

    return dwErr;
}

DWORD RTM_NextHop | ( | IN PRTM_DEST_INFO | prdiDestination,
 |  | OUT PDWORD | pdwIfIndex,
 |  | OUT PIPADDRESS | pipNeighbor
 | ) |  |

Definition at line 57 of file rtmapi.c.

{
    DWORD               dwErr = NO_ERROR;
    PRTM_ROUTE_INFO     prriRoute;
    RTM_NEXTHOP_INFO    rniNextHop;
    BOOL                bRoute, bNextHop;

    // flags indicating handles held
    bRoute = bNextHop = FALSE;

    do                          // breakout loop
    {
        // allocate route info structure
        MALLOC(&prriRoute,
               RTM_SIZE_OF_ROUTE_INFO(g_ce.rrpRtmProfile.MaxNextHopsInRoute),
               &dwErr);
        if (dwErr != NO_ERROR)
            break;

        // get route info (best route in mcast view)
        dwErr = RtmGetRouteInfo (
            g_ce.hRtmHandle,
            prdiDestination->ViewInfo[0].Route,
            prriRoute,
            NULL);
        if (dwErr != NO_ERROR)
        {
            TRACE1(ANY, "Error %u getting route", dwErr);
            break;
        }
        bRoute = TRUE;

        // get nexthop info (first next hop for now...)
        dwErr = RtmGetNextHopInfo(
            g_ce.hRtmHandle,
            prriRoute->NextHopsList.NextHops[0],
            &rniNextHop);
        if (dwErr != NO_ERROR)
        {
            TRACE1(ANY, "Error %u getting next hop", dwErr);
            break;
        }
        bNextHop = TRUE;

        // finally!!! THIS SHOULD NOT BE A REMOTE NEXT HOP!!!
        *(pdwIfIndex) = rniNextHop.InterfaceIndex;
        RTM_GetAddress(pipNeighbor,
                       &(rniNextHop.NextHopAddress));
    } while (FALSE);

    if (dwErr != NO_ERROR)
        TRACE1(ANY, "Error %u obtaining next hop", dwErr);

    // release the handle to the next hop
    if (bNextHop)
    {
        if (RtmReleaseNextHopInfo(g_ce.hRtmHandle, &rniNextHop) != NO_ERROR)
            TRACE0(ANY, "Error releasing next hop, continuing...");
    }

    // release the handle to the route
    if (bRoute)
    {
        if (RtmReleaseRouteInfo(g_ce.hRtmHandle, prriRoute) != NO_ERROR)
            TRACE0(ANY, "Error releasing route, continuing...");
    }

    // deallocate route info structure
    if (prriRoute)
        FREE(prriRoute);

    return dwErr;
}

Generated on Wed Nov 13 2024 16:54:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/ip/sampletest.cxx File Reference

  • NetDS
  • RRas
  • ip
Functions

sampletest.cxx File Reference

#include "sampletest.h"

Go to the source code of this file.

Functions

int _cdecl main ()

Function Documentation

int _cdecl main ( void )

Definition at line 18 of file sampletest.cxx.

{
    TestProtocol();

    return 0;
}

Generated on Wed Nov 13 2024 16:54:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/ip/sampletest.h File Reference

  • NetDS
  • RRas
  • ip

sampletest.h File Reference

#include <windows.h>
#include "ipsample.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/ip/socket.c File Reference

  • NetDS
  • RRas
  • ip
Defines | Functions

socket.c File Reference

#include "pchsample.h"

Go to the source code of this file.

Defines

#define | FINISH_SAMPLE_IO() LEAVE_SAMPLE_API()
#define | IPv4_LENGTH_OFFSET 2
#define | IPv4_PREVIEW_SIZE 4
#define | START_SAMPLE_IO() ENTER_SAMPLE_API()

Functions

VOID WINAPI | SocketCallbackSendCompletion (IN DWORD dwErr, IN DWORD dwNumSent, IN LPOVERLAPPED lpOverlapped)
DWORD | SocketCreate (IN IPADDRESS ipAddress, IN HANDLE hEvent, OUT SOCKET *psSocket)
DWORD | SocketDestroy (IN SOCKET sSocket)
DWORD | SocketReceive (IN SOCKET sSocket, IN PPACKET pPacket)
BOOL | SocketReceiveEvent (IN SOCKET sSocket)
DWORD | SocketSend (IN SOCKET sSocket, IN IPADDRESS ipDestination, IN PPACKET pPacket)

Define Documentation

#define FINISH_SAMPLE_IO ( ) LEAVE_SAMPLE_API()

Definition at line 23 of file socket.c.

#define IPv4_LENGTH_OFFSET 2
#define IPv4_PREVIEW_SIZE 4
#define START_SAMPLE_IO ( ) ENTER_SAMPLE_API()

Definition at line 21 of file socket.c.

Function Documentation

VOID WINAPI SocketCallbackSendCompletion | ( | IN DWORD | dwErr,
 |  | IN DWORD | dwNumSent,
 |  | IN LPOVERLAPPED | lpOverlapped
 | ) |  |

Definition at line 33 of file socket.c.

         :
    dwErr                   system-supplied error code
    dwNumSent               system-supplied byte-count
    lpOverlapped            caller-supplied context area

Return Value:
    None.

--*/
{
    PPACKET pPacket = CONTAINING_RECORD(lpOverlapped, PACKET, oOverlapped);

    TRACE3(ENTER, "Entering SocketCallbackSendCompletion: %u %u 0x%08x",
           dwErr, dwNumSent, lpOverlapped);
    PacketDisplay(pPacket);

    if ((dwErr != NO_ERROR) or                      // operation aborted
        (dwNumSent != pPacket->wsaBuffer.len))      // data not sent entirely
    {
        TRACE1(NETWORK, "Error %u sending packet", dwErr);
        LOGERR0(SENDTO_FAILED, dwErr);

    }

    PacketDestroy(pPacket);     // destroy the packet structure

    TRACE0(LEAVE, "Leaving  SocketCallbackSendCompletion");

    FINISH_SAMPLE_IO();
}

DWORD SocketCreate | ( | IN IPADDRESS | ipAddress,
 |  | IN HANDLE | hEvent,
 |  | OUT SOCKET * | psSocket
 | ) |  |

Definition at line 88 of file socket.c.

{
    DWORD           dwErr = NO_ERROR;
    PCHAR           pszBuffer;
    SOCKADDR_IN     sinSockAddr;
    BOOL            bDontLinger, bReuse, bLoopback;
    struct linger   lLinger = { 0, 0 };
    UCHAR           ucTTL;
    struct ip_mreq  imMulticast;

    // validate parameters
    if ((!psSocket or (*psSocket != INVALID_SOCKET)) or
        !IP_VALID(ipAddress) or
        (hEvent is INVALID_HANDLE_VALUE))
        return ERROR_INVALID_PARAMETER;

    // default return value
    *psSocket = INVALID_SOCKET;

    pszBuffer = INET_NTOA(ipAddress);

    do                          // breakout loop
    {
        // create socket
        *psSocket = WSASocket(AF_INET,            // address family
                              SOCK_RAW,           // type
                              PROTO_IP_SAMPLE,    // protocol
                              NULL,
                              0,
                              WSA_FLAG_OVERLAPPED);
        if(*psSocket is INVALID_SOCKET)
        {
            dwErr = WSAGetLastError();
            TRACE0(NETWORK, "Could not create socket");
            break;
        }

        // associate the socket with our I/O completion port.  the callback
        // function is invoked when an overlapped I/O operation completes.
        // this would be the send operation!
        dwErr = SetIoCompletionProc((HANDLE) *psSocket,
                                    SocketCallbackSendCompletion);
        if (dwErr != NO_ERROR)
        {
            TRACE0(NETWORK, "Could not associate callback function");
            break;
        }

        // set SO_LINGER to off
        // do not linger on close waiting for unsent data to be sent
        bDontLinger = TRUE;
        if (setsockopt(*psSocket,
                       SOL_SOCKET,
                       SO_DONTLINGER,
                       (const char *) &bDontLinger,
                       sizeof(BOOL)) is SOCKET_ERROR)
        {
            TRACE2(NETWORK,
                   "Error %u setting linger option on %s, continuing...",
                   WSAGetLastError(), pszBuffer);
        }

        // set to SO_REUSEADDR
        // allow socket to be bound to an address that is already in use
        bReuse = TRUE;
        if (setsockopt(*psSocket,
                       SOL_SOCKET,
                       SO_REUSEADDR,
                       (const char *) &bReuse,
                       sizeof(BOOL)) is SOCKET_ERROR)
        {
            TRACE2(NETWORK,
                   "Error %u seting reuse option on %s, continuing...",
                   WSAGetLastError(), pszBuffer);
        }

        // bind to the specified IPv4 addresses
        ZeroMemory(&sinSockAddr, sizeof(SOCKADDR_IN));
        sinSockAddr.sin_family      = AF_INET;
        sinSockAddr.sin_addr.s_addr = ipAddress;
        sinSockAddr.sin_port        = 0;
        if (bind(*psSocket, (LPSOCKADDR) &sinSockAddr, sizeof(SOCKADDR_IN))
            is SOCKET_ERROR)
        {
            dwErr = WSAGetLastError();
            TRACE0(NETWORK, "Could not bind socket");
            LOGERR1(BIND_IF_FAILED, pszBuffer, dwErr);
            break;
        }

        // allow multicast traffic to be sent out this interface
        if (setsockopt(*psSocket,
                       IPPROTO_IP,
                       IP_MULTICAST_IF,
                       (const char *) &sinSockAddr.sin_addr,
                       sizeof(IN_ADDR)) is SOCKET_ERROR)
        {
            dwErr = WSAGetLastError();
            TRACE2(NETWORK,
                   "Error %u setting interface %s as multicast...",
                   dwErr, pszBuffer);
            LOGERR1(SET_MCAST_IF_FAILED, pszBuffer, dwErr);
            break;
        }

        // set loopback to ignore self generated packets.
        bLoopback   = FALSE;
        if (setsockopt(*psSocket,
                       IPPROTO_IP,
                       IP_MULTICAST_LOOP,
                       (const char *) &bLoopback,
                       sizeof(BOOL)) is SOCKET_ERROR)
        {
            TRACE2(NETWORK,
                   "Error %u setting loopback to FALSE on %s, continuing...",
                   WSAGetLastError(), pszBuffer);
        }

        // set TTL to 1 to restrict packet to within subnet (default anyway)
        ucTTL  = 1;
        if (setsockopt(*psSocket,
                       IPPROTO_IP,
                       IP_MULTICAST_TTL,
                       (const char *) &ucTTL,
                       sizeof(UCHAR)) is SOCKET_ERROR)
        {
            TRACE2(NETWORK,
                   "Error %u setting mcast ttl to 1 on %s, continuing...",
                   WSAGetLastError(), pszBuffer);
        }

        // join the multicast session on SAMPLE_PROTOCOL_MULTICAST_GROUP.
        imMulticast.imr_multiaddr.s_addr = SAMPLE_PROTOCOL_MULTICAST_GROUP;
        imMulticast.imr_interface.s_addr = ipAddress;
        if (setsockopt(*psSocket,
                       IPPROTO_IP,
                       IP_ADD_MEMBERSHIP,
                       (const char *) &imMulticast,
                       sizeof(struct ip_mreq)) is SOCKET_ERROR)
        {
            dwErr = WSAGetLastError();
            TRACE0(NETWORK, "Could not join multicast group on socket");
            LOGERR1(JOIN_GROUP_FAILED, pszBuffer, dwErr);
            break;
        }

        // associate hReceiveEvent with the receive network event
        if (WSAEventSelect(*psSocket, (WSAEVENT) hEvent, FD_READ)
            is SOCKET_ERROR)
        {
            dwErr = WSAGetLastError();
            TRACE1(NETWORK, "Error %u calling WSAEventSelect()", dwErr);
            LOGERR0(EVENTSELECT_FAILED, dwErr);
            break;
        }
    } while(FALSE);

    if (dwErr != NO_ERROR)
    {
        TRACE2(NETWORK, "Error %u creating socket for %s", dwErr, pszBuffer);
        LOGERR0(CREATE_SOCKET_FAILED, dwErr);
        SocketDestroy(*psSocket);
        *psSocket = INVALID_SOCKET;
    }

    return dwErr;
}

DWORD SocketDestroy ( IN SOCKET sSocket )

Definition at line 285 of file socket.c.

{
    DWORD dwErr = NO_ERROR;

    if (sSocket is INVALID_SOCKET)
        return NO_ERROR;

    /*
    // closing a socket with closesocket also cancels the association and
    // selection of network events specified in WSAEventSelect.  redundant!
    if (WSAEventSelect(sSocket, (WSAEVENT) NULL, 0) is SOCKET_ERROR)
    {
        dwErr = WSAGetLastError();
        TRACE1(NETWORK, "Error %u clearing socket-event association", dwErr);
        LOGERR0(EVENTSELECT_FAILED, dwErr);
    }
    */

    // close the socket
    if (closesocket(sSocket) != NO_ERROR)
    {
        dwErr = WSAGetLastError();
        TRACE1(NETWORK, "Error %u closing socket", dwErr);
        LOGERR0(DESTROY_SOCKET_FAILED, dwErr);
    }

    return dwErr;
}

DWORD SocketReceive | ( | IN SOCKET | sSocket,
 |  | IN PPACKET | pPacket
 | ) |  |

Definition at line 404 of file socket.c.

{
    DWORD       dwErr = NO_ERROR;
    BYTE        rgbyPreview[IPv4_PREVIEW_SIZE];
    DWORD       dwNumReceived, dwFlags;
    INT         iSourceLength;
    SOCKADDR_IN sinSource;
    DWORD       dwPacketLength;

    // validate parameters
    if ((sSocket is INVALID_SOCKET) or !pPacket)
        return ERROR_INVALID_PARAMETER;

    do                          // breakout loop
    {
        // read enuf to figure length
        pPacket->wsaBuffer.buf  = rgbyPreview;
        pPacket->wsaBuffer.len  = IPv4_PREVIEW_SIZE;
        dwFlags                 = MSG_PEEK;
        iSourceLength = sizeof(SOCKADDR_IN);

        dwErr = WSARecvFrom(sSocket,
                            &(pPacket->wsaBuffer),  // buffer and length
                            1,                      // only one wsabuf exists
                            &dwNumReceived,         // # bytes received
                            &dwFlags,               // flags
                            (PSOCKADDR) &sinSource,
                            &iSourceLength,
                            NULL,                   // no context
                            NULL);                  // no completion routine
        if (dwErr != SOCKET_ERROR)  // there should have been an error
            break;
        dwErr = WSAGetLastError();
        if (dwErr != WSAEMSGSIZE)   // of this kind
            break;
        if (dwNumReceived != pPacket->wsaBuffer.len)
        {
            dwErr = ERROR_CAN_NOT_COMPLETE;
            break;
        }

        // calculate the packet length
        dwPacketLength = ntohs(*((PUSHORT)(rgbyPreview + IPv4_LENGTH_OFFSET)));
        if (dwPacketLength > MAX_PACKET_LENGTH)
        {
            dwErr = ERROR_CAN_NOT_COMPLETE;
            break;
        }

        // read the entire packet, the buffer could be dynamically allocated
        pPacket->wsaBuffer.buf  = pPacket->rgbyBuffer;
        pPacket->wsaBuffer.len  = dwPacketLength;
        dwFlags                 = 0;
        iSourceLength = sizeof(SOCKADDR_IN);

        dwErr = WSARecvFrom(sSocket,
                            &(pPacket->wsaBuffer),  // buffer and length
                            1,                      // only one wsabuf exists
                            &dwNumReceived,         // # bytes received
                            &dwFlags,               // flags
                            (PSOCKADDR) &sinSource,
                            &iSourceLength,
                            NULL,                   // no context
                            NULL);                  // no completion routine
        if (dwErr is SOCKET_ERROR)
        {
            dwErr = WSAGetLastError();
            break;
        }
        if (dwPacketLength != dwNumReceived)
        {
            dwErr = ERROR_CAN_NOT_COMPLETE;
            break;
        }

        pPacket->ipSource       = sinSource.sin_addr.s_addr;
        pPacket->wsaBuffer.len  = dwNumReceived;

        dwErr = NO_ERROR;
    } while (FALSE);

    if (dwErr != NO_ERROR)
    {
        TRACE1(NETWORK, "Error %u receiving packet", dwErr);
        LOGERR0(RECVFROM_FAILED, dwErr);
    }

    return dwErr;
}

BOOL SocketReceiveEvent ( IN SOCKET sSocket )

Definition at line 523 of file socket.c.

{
    DWORD               dwErr = NO_ERROR;
    WSANETWORKEVENTS    wsaEvent;

    // validate parameters
    if (sSocket is INVALID_SOCKET)
        return ERROR_INVALID_PARAMETER;

    do                          // breakout loop
    {
        // enumerate network events to see if any packets have arrived on
        dwErr = WSAEnumNetworkEvents(sSocket, NULL, &wsaEvent);
        if (dwErr != NO_ERROR)
        {
            TRACE1(NETWORK, "Error %u enumerating network events", dwErr);
            LOGERR0(ENUM_NETWORK_EVENTS_FAILED, dwErr);
            break;
        }

        // see if the input bit is set
        if (!(wsaEvent.lNetworkEvents & FD_READ))
        {
            dwErr = SOCKET_ERROR;
            break;
        }

        // the input bit is set, now see if there was an error
        dwErr = wsaEvent.iErrorCode[FD_READ_BIT];
        if (dwErr != NO_ERROR)
        {
            TRACE1(NETWORK, "Error %u in input record", dwErr);
            LOGERR0(INPUT_RECORD_ERROR, dwErr);
            break;
        }
    } while (FALSE);

    if (dwErr is NO_ERROR)
        return TRUE;

    return FALSE;
}

DWORD SocketSend | ( | IN SOCKET | sSocket,
 |  | IN IPADDRESS | ipDestination,
 |  | IN PPACKET | pPacket
 | ) |  |

Definition at line 334 of file socket.c.

{
    DWORD           dwErr = NO_ERROR;
    SOCKADDR_IN     sinDestination;
    DWORD           dwScratch;

    if (!START_SAMPLE_IO()) { return ERROR_CAN_NOT_COMPLETE; }

    // validate parameters
    if ((sSocket is INVALID_SOCKET) or !pPacket)
        return ERROR_INVALID_PARAMETER;

    ZeroMemory(&sinDestination, sizeof(SOCKADDR_IN));
    sinDestination.sin_family      = AF_INET;
    sinDestination.sin_addr.s_addr = ipDestination;
    sinDestination.sin_port        = 0;
    dwErr = WSASendTo(sSocket,
                      &(pPacket->wsaBuffer),        // buffer and length
                      1,                            // only one wsabuf exists
                      &dwScratch,                   // unused
                      0,                            // no flags
                      (PSOCKADDR) &sinDestination,
                      sizeof(SOCKADDR_IN),
                      &pPacket->oOverlapped,        // context upon completion
                      NULL);                        // no completion routine

    // completion routine (SocketCallbackSendCompletion) queued
    if (((dwErr is SOCKET_ERROR) and (WSAGetLastError() is WSA_IO_PENDING)) or
        (dwErr is NO_ERROR))
    {
        return NO_ERROR;
    }

    // completion routine (SocketCallbackSendCompletion) not queued
    dwErr = WSAGetLastError();
    TRACE1(NETWORK, "Error %u sending packet", dwErr);
    LOGERR0(SENDTO_FAILED, dwErr);

    FINISH_SAMPLE_IO();

    return dwErr;
}

Generated on Wed Nov 13 2024 16:54:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/ip/socket.h File Reference

  • NetDS
  • RRas
  • ip
Functions

socket.h File Reference

Go to the source code of this file.

Functions

DWORD | SocketCreate (IN IPADDRESS ipAddress, IN HANDLE hEvent, OUT SOCKET *psSocket)
DWORD | SocketDestroy (IN SOCKET sSocket)
DWORD | SocketReceive (IN SOCKET sSocket, IN PPACKET pPacket)
BOOL | SocketReceiveEvent (IN SOCKET sSocket)
DWORD | SocketSend (IN SOCKET sSocket, IN IPADDRESS ipDestination, IN PPACKET pPacket)

Function Documentation

DWORD SocketCreate | ( | IN IPADDRESS | ipAddress,
 |  | IN HANDLE | hEvent,
 |  | OUT SOCKET * | psSocket
 | ) |  |

Definition at line 88 of file socket.c.

{
    DWORD           dwErr = NO_ERROR;
    PCHAR           pszBuffer;
    SOCKADDR_IN     sinSockAddr;
    BOOL            bDontLinger, bReuse, bLoopback;
    struct linger   lLinger = { 0, 0 };
    UCHAR           ucTTL;
    struct ip_mreq  imMulticast;

    // validate parameters
    if ((!psSocket or (*psSocket != INVALID_SOCKET)) or
        !IP_VALID(ipAddress) or
        (hEvent is INVALID_HANDLE_VALUE))
        return ERROR_INVALID_PARAMETER;

    // default return value
    *psSocket = INVALID_SOCKET;

    pszBuffer = INET_NTOA(ipAddress);

    do                          // breakout loop
    {
        // create socket
        *psSocket = WSASocket(AF_INET,            // address family
                              SOCK_RAW,           // type
                              PROTO_IP_SAMPLE,    // protocol
                              NULL,
                              0,
                              WSA_FLAG_OVERLAPPED);
        if(*psSocket is INVALID_SOCKET)
        {
            dwErr = WSAGetLastError();
            TRACE0(NETWORK, "Could not create socket");
            break;
        }

        // associate the socket with our I/O completion port.  the callback
        // function is invoked when an overlapped I/O operation completes.
        // this would be the send operation!
        dwErr = SetIoCompletionProc((HANDLE) *psSocket,
                                    SocketCallbackSendCompletion);
        if (dwErr != NO_ERROR)
        {
            TRACE0(NETWORK, "Could not associate callback function");
            break;
        }

        // set SO_LINGER to off
        // do not linger on close waiting for unsent data to be sent
        bDontLinger = TRUE;
        if (setsockopt(*psSocket,
                       SOL_SOCKET,
                       SO_DONTLINGER,
                       (const char *) &bDontLinger,
                       sizeof(BOOL)) is SOCKET_ERROR)
        {
            TRACE2(NETWORK,
                   "Error %u setting linger option on %s, continuing...",
                   WSAGetLastError(), pszBuffer);
        }

        // set to SO_REUSEADDR
        // allow socket to be bound to an address that is already in use
        bReuse = TRUE;
        if (setsockopt(*psSocket,
                       SOL_SOCKET,
                       SO_REUSEADDR,
                       (const char *) &bReuse,
                       sizeof(BOOL)) is SOCKET_ERROR)
        {
            TRACE2(NETWORK,
                   "Error %u seting reuse option on %s, continuing...",
                   WSAGetLastError(), pszBuffer);
        }

        // bind to the specified IPv4 addresses
        ZeroMemory(&sinSockAddr, sizeof(SOCKADDR_IN));
        sinSockAddr.sin_family      = AF_INET;
        sinSockAddr.sin_addr.s_addr = ipAddress;
        sinSockAddr.sin_port        = 0;
        if (bind(*psSocket, (LPSOCKADDR) &sinSockAddr, sizeof(SOCKADDR_IN))
            is SOCKET_ERROR)
        {
            dwErr = WSAGetLastError();
            TRACE0(NETWORK, "Could not bind socket");
            LOGERR1(BIND_IF_FAILED, pszBuffer, dwErr);
            break;
        }

        // allow multicast traffic to be sent out this interface
        if (setsockopt(*psSocket,
                       IPPROTO_IP,
                       IP_MULTICAST_IF,
                       (const char *) &sinSockAddr.sin_addr,
                       sizeof(IN_ADDR)) is SOCKET_ERROR)
        {
            dwErr = WSAGetLastError();
            TRACE2(NETWORK,
                   "Error %u setting interface %s as multicast...",
                   dwErr, pszBuffer);
            LOGERR1(SET_MCAST_IF_FAILED, pszBuffer, dwErr);
            break;
        }

        // set loopback to ignore self generated packets.
        bLoopback   = FALSE;
        if (setsockopt(*psSocket,
                       IPPROTO_IP,
                       IP_MULTICAST_LOOP,
                       (const char *) &bLoopback,
                       sizeof(BOOL)) is SOCKET_ERROR)
        {
            TRACE2(NETWORK,
                   "Error %u setting loopback to FALSE on %s, continuing...",
                   WSAGetLastError(), pszBuffer);
        }

        // set TTL to 1 to restrict packet to within subnet (default anyway)
        ucTTL  = 1;
        if (setsockopt(*psSocket,
                       IPPROTO_IP,
                       IP_MULTICAST_TTL,
                       (const char *) &ucTTL,
                       sizeof(UCHAR)) is SOCKET_ERROR)
        {
            TRACE2(NETWORK,
                   "Error %u setting mcast ttl to 1 on %s, continuing...",
                   WSAGetLastError(), pszBuffer);
        }

        // join the multicast session on SAMPLE_PROTOCOL_MULTICAST_GROUP.
        imMulticast.imr_multiaddr.s_addr = SAMPLE_PROTOCOL_MULTICAST_GROUP;
        imMulticast.imr_interface.s_addr = ipAddress;
        if (setsockopt(*psSocket,
                       IPPROTO_IP,
                       IP_ADD_MEMBERSHIP,
                       (const char *) &imMulticast,
                       sizeof(struct ip_mreq)) is SOCKET_ERROR)
        {
            dwErr = WSAGetLastError();
            TRACE0(NETWORK, "Could not join multicast group on socket");
            LOGERR1(JOIN_GROUP_FAILED, pszBuffer, dwErr);
            break;
        }

        // associate hReceiveEvent with the receive network event
        if (WSAEventSelect(*psSocket, (WSAEVENT) hEvent, FD_READ)
            is SOCKET_ERROR)
        {
            dwErr = WSAGetLastError();
            TRACE1(NETWORK, "Error %u calling WSAEventSelect()", dwErr);
            LOGERR0(EVENTSELECT_FAILED, dwErr);
            break;
        }
    } while(FALSE);

    if (dwErr != NO_ERROR)
    {
        TRACE2(NETWORK, "Error %u creating socket for %s", dwErr, pszBuffer);
        LOGERR0(CREATE_SOCKET_FAILED, dwErr);
        SocketDestroy(*psSocket);
        *psSocket = INVALID_SOCKET;
    }

    return dwErr;
}

DWORD SocketDestroy ( IN SOCKET sSocket )

Definition at line 285 of file socket.c.

{
    DWORD dwErr = NO_ERROR;

    if (sSocket is INVALID_SOCKET)
        return NO_ERROR;

    /*
    // closing a socket with closesocket also cancels the association and
    // selection of network events specified in WSAEventSelect.  redundant!
    if (WSAEventSelect(sSocket, (WSAEVENT) NULL, 0) is SOCKET_ERROR)
    {
        dwErr = WSAGetLastError();
        TRACE1(NETWORK, "Error %u clearing socket-event association", dwErr);
        LOGERR0(EVENTSELECT_FAILED, dwErr);
    }
    */

    // close the socket
    if (closesocket(sSocket) != NO_ERROR)
    {
        dwErr = WSAGetLastError();
        TRACE1(NETWORK, "Error %u closing socket", dwErr);
        LOGERR0(DESTROY_SOCKET_FAILED, dwErr);
    }

    return dwErr;
}

DWORD SocketReceive | ( | IN SOCKET | sSocket,
 |  | IN PPACKET | pPacket
 | ) |  |

Definition at line 404 of file socket.c.

{
    DWORD       dwErr = NO_ERROR;
    BYTE        rgbyPreview[IPv4_PREVIEW_SIZE];
    DWORD       dwNumReceived, dwFlags;
    INT         iSourceLength;
    SOCKADDR_IN sinSource;
    DWORD       dwPacketLength;

    // validate parameters
    if ((sSocket is INVALID_SOCKET) or !pPacket)
        return ERROR_INVALID_PARAMETER;

    do                          // breakout loop
    {
        // read enuf to figure length
        pPacket->wsaBuffer.buf  = rgbyPreview;
        pPacket->wsaBuffer.len  = IPv4_PREVIEW_SIZE;
        dwFlags                 = MSG_PEEK;
        iSourceLength = sizeof(SOCKADDR_IN);

        dwErr = WSARecvFrom(sSocket,
                            &(pPacket->wsaBuffer),  // buffer and length
                            1,                      // only one wsabuf exists
                            &dwNumReceived,         // # bytes received
                            &dwFlags,               // flags
                            (PSOCKADDR) &sinSource,
                            &iSourceLength,
                            NULL,                   // no context
                            NULL);                  // no completion routine
        if (dwErr != SOCKET_ERROR)  // there should have been an error
            break;
        dwErr = WSAGetLastError();
        if (dwErr != WSAEMSGSIZE)   // of this kind
            break;
        if (dwNumReceived != pPacket->wsaBuffer.len)
        {
            dwErr = ERROR_CAN_NOT_COMPLETE;
            break;
        }

        // calculate the packet length
        dwPacketLength = ntohs(*((PUSHORT)(rgbyPreview + IPv4_LENGTH_OFFSET)));
        if (dwPacketLength > MAX_PACKET_LENGTH)
        {
            dwErr = ERROR_CAN_NOT_COMPLETE;
            break;
        }

        // read the entire packet, the buffer could be dynamically allocated
        pPacket->wsaBuffer.buf  = pPacket->rgbyBuffer;
        pPacket->wsaBuffer.len  = dwPacketLength;
        dwFlags                 = 0;
        iSourceLength = sizeof(SOCKADDR_IN);

        dwErr = WSARecvFrom(sSocket,
                            &(pPacket->wsaBuffer),  // buffer and length
                            1,                      // only one wsabuf exists
                            &dwNumReceived,         // # bytes received
                            &dwFlags,               // flags
                            (PSOCKADDR) &sinSource,
                            &iSourceLength,
                            NULL,                   // no context
                            NULL);                  // no completion routine
        if (dwErr is SOCKET_ERROR)
        {
            dwErr = WSAGetLastError();
            break;
        }
        if (dwPacketLength != dwNumReceived)
        {
            dwErr = ERROR_CAN_NOT_COMPLETE;
            break;
        }

        pPacket->ipSource       = sinSource.sin_addr.s_addr;
        pPacket->wsaBuffer.len  = dwNumReceived;

        dwErr = NO_ERROR;
    } while (FALSE);

    if (dwErr != NO_ERROR)
    {
        TRACE1(NETWORK, "Error %u receiving packet", dwErr);
        LOGERR0(RECVFROM_FAILED, dwErr);
    }

    return dwErr;
}

BOOL SocketReceiveEvent ( IN SOCKET sSocket )

Definition at line 523 of file socket.c.

{
    DWORD               dwErr = NO_ERROR;
    WSANETWORKEVENTS    wsaEvent;

    // validate parameters
    if (sSocket is INVALID_SOCKET)
        return ERROR_INVALID_PARAMETER;

    do                          // breakout loop
    {
        // enumerate network events to see if any packets have arrived on
        dwErr = WSAEnumNetworkEvents(sSocket, NULL, &wsaEvent);
        if (dwErr != NO_ERROR)
        {
            TRACE1(NETWORK, "Error %u enumerating network events", dwErr);
            LOGERR0(ENUM_NETWORK_EVENTS_FAILED, dwErr);
            break;
        }

        // see if the input bit is set
        if (!(wsaEvent.lNetworkEvents & FD_READ))
        {
            dwErr = SOCKET_ERROR;
            break;
        }

        // the input bit is set, now see if there was an error
        dwErr = wsaEvent.iErrorCode[FD_READ_BIT];
        if (dwErr != NO_ERROR)
        {
            TRACE1(NETWORK, "Error %u in input record", dwErr);
            LOGERR0(INPUT_RECORD_ERROR, dwErr);
            break;
        }
    } while (FALSE);

    if (dwErr is NO_ERROR)
        return TRUE;

    return FALSE;
}

DWORD SocketSend | ( | IN SOCKET | sSocket,
 |  | IN IPADDRESS | ipDestination,
 |  | IN PPACKET | pPacket
 | ) |  |

Definition at line 334 of file socket.c.

{
    DWORD           dwErr = NO_ERROR;
    SOCKADDR_IN     sinDestination;
    DWORD           dwScratch;

    if (!START_SAMPLE_IO()) { return ERROR_CAN_NOT_COMPLETE; }

    // validate parameters
    if ((sSocket is INVALID_SOCKET) or !pPacket)
        return ERROR_INVALID_PARAMETER;

    ZeroMemory(&sinDestination, sizeof(SOCKADDR_IN));
    sinDestination.sin_family      = AF_INET;
    sinDestination.sin_addr.s_addr = ipDestination;
    sinDestination.sin_port        = 0;
    dwErr = WSASendTo(sSocket,
                      &(pPacket->wsaBuffer),        // buffer and length
                      1,                            // only one wsabuf exists
                      &dwScratch,                   // unused
                      0,                            // no flags
                      (PSOCKADDR) &sinDestination,
                      sizeof(SOCKADDR_IN),
                      &pPacket->oOverlapped,        // context upon completion
                      NULL);                        // no completion routine

    // completion routine (SocketCallbackSendCompletion) queued
    if (((dwErr is SOCKET_ERROR) and (WSAGetLastError() is WSA_IO_PENDING)) or
        (dwErr is NO_ERROR))
    {
        return NO_ERROR;
    }

    // completion routine (SocketCallbackSendCompletion) not queued
    dwErr = WSAGetLastError();
    TRACE1(NETWORK, "Error %u sending packet", dwErr);
    LOGERR0(SENDTO_FAILED, dwErr);

    FINISH_SAMPLE_IO();

    return dwErr;
}

Generated on Wed Nov 13 2024 16:54:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/ip/sync.c File Reference

  • NetDS
  • RRas
  • ip
Functions

sync.c File Reference

#include "pchsample.h"

Go to the source code of this file.

Functions

DWORD | AcquireDynamicReadwriteLock (PDYNAMIC_READWRITE_LOCK *ppLock, LOCK_MODE lmMode, PDYNAMIC_LOCKS_STORE pStore)
VOID | AcquireReadLock (PREAD_WRITE_LOCK pRWL)
VOID | AcquireWriteLock (PREAD_WRITE_LOCK pRWL)
DWORD | CreateReadWriteLock (PREAD_WRITE_LOCK pRWL)
DWORD | DeInitializeDynamicLocksStore (PDYNAMIC_LOCKS_STORE pStore)
VOID | DeleteReadWriteLock (PREAD_WRITE_LOCK pRWL)
VOID | FreeDynamicReadwriteLock (PDYNAMIC_READWRITE_LOCK pLock, PDYNAMIC_LOCKS_STORE pStore)
PDYNAMIC_READWRITE_LOCK | GetDynamicReadwriteLock (PDYNAMIC_LOCKS_STORE pStore)
DWORD | InitializeDynamicLocksStore (PDYNAMIC_LOCKS_STORE pStore, HANDLE hHeap)
VOID | ReleaseDynamicReadwriteLock (PDYNAMIC_READWRITE_LOCK *ppLock, LOCK_MODE lmMode, PDYNAMIC_LOCKS_STORE pStore)
VOID | ReleaseReadLock (PREAD_WRITE_LOCK pRWL)
VOID | ReleaseWriteLock (PREAD_WRITE_LOCK pRWL)

Function Documentation

DWORD AcquireDynamicReadwriteLock | ( | PDYNAMIC_READWRITE_LOCK * | ppLock,
 |  | LOCK_MODE | lmMode,
 |  | PDYNAMIC_LOCKS_STORE | pStore
 | ) |  |

Definition at line 321 of file sync.c.

      {

    // acquire the lock for the free locks list
    ACQUIRE_LIST_LOCK(&pStore->llFreeLocksList);

    // if it is does not already exist, allocate a new dynamic lock
    if (*ppLock == NULL)
    {
        *ppLock = GetDynamicReadwriteLock(pStore);

        // if could not get a lock we are in serious trouble
        if (*ppLock == NULL)
        {
            RELEASE_LIST_LOCK(&pStore->llFreeLocksList);
            return ERROR_CAN_NOT_COMPLETE;
        }
    }

    // increment count in the dynamic lock
    (*ppLock)->ulCount++;

    // release the lock for the free locks list
    RELEASE_LIST_LOCK(&pStore->llFreeLocksList);

    // acquire dynamic lock
    if (lmMode == READ_MODE)
        ACQUIRE_READ_LOCK(&(*ppLock)->rwlLock);
    else
        ACQUIRE_WRITE_LOCK(&(*ppLock)->rwlLock);

    return NO_ERROR;
}

VOID AcquireReadLock ( PREAD_WRITE_LOCK pRWL )

Definition at line 80 of file sync.c.

      {

    EnterCriticalSection(&pRWL->RWL_ReadWriteBlock);
    InterlockedIncrement(&pRWL->RWL_ReaderCount);
    LeaveCriticalSection(&pRWL->RWL_ReadWriteBlock);
}

VOID AcquireWriteLock ( PREAD_WRITE_LOCK pRWL )

Definition at line 121 of file sync.c.

      {

    EnterCriticalSection(&pRWL->RWL_ReadWriteBlock);
    if (InterlockedDecrement(&pRWL->RWL_ReaderCount) >= 0) {
        WaitForSingleObject(pRWL->RWL_ReaderDoneEvent, INFINITE);
    }
}

DWORD CreateReadWriteLock ( PREAD_WRITE_LOCK pRWL )

Definition at line 28 of file sync.c.

      {

    pRWL->RWL_ReaderCount = 0;

    __try {
        InitializeCriticalSection(&(pRWL)->RWL_ReadWriteBlock);
    }
    __except(EXCEPTION_EXECUTE_HANDLER) {
        return GetLastError();
    }

    pRWL->RWL_ReaderDoneEvent = CreateEvent(NULL,FALSE,FALSE,NULL);
    if (pRWL->RWL_ReaderDoneEvent != NULL) {
        return GetLastError();
    }

    return NO_ERROR;
}

DWORD DeInitializeDynamicLocksStore ( PDYNAMIC_LOCKS_STORE pStore )

Definition at line 188 of file sync.c.

      {

    PDYNAMIC_READWRITE_LOCK pLock;
    PLIST_ENTRY             pleHead, ple;

    if (pStore->ulCountFree)
        return ERROR_CAN_NOT_COMPLETE;

    // deinitialize the count of the number of free and allocated locks
    pStore->ulCountAllocated = pStore->ulCountFree = 0;

    // deinitialize the FreeLocksList
    pStore->llFreeLocksList.created = 0;

    // delete all dynamic readwrite locks and free the memory.
    pleHead = &(pStore->llFreeLocksList.head);
    for (ple = pleHead->Flink; ple != pleHead; ple = ple->Flink)
    {
        pLock = CONTAINING_RECORD(ple, DYNAMIC_READWRITE_LOCK, leLink);
        DELETE_READ_WRITE_LOCK(&pLock->rwlLock);
        HeapFree(pStore->hHeap, 0, pLock);
    }

    DeleteCriticalSection(&(pStore->llFreeLocksList.lock));

    // deinitialize the heap from where dynamic locks are allocated
    pStore->hHeap = NULL;

    return NO_ERROR;
}

VOID DeleteReadWriteLock ( PREAD_WRITE_LOCK pRWL )

Definition at line 58 of file sync.c.

      {

    CloseHandle(pRWL->RWL_ReaderDoneEvent);
    pRWL->RWL_ReaderDoneEvent = NULL;
    DeleteCriticalSection(&pRWL->RWL_ReadWriteBlock);
    pRWL->RWL_ReaderCount = 0;
}

VOID FreeDynamicReadwriteLock | ( | PDYNAMIC_READWRITE_LOCK | pLock,
 |  | PDYNAMIC_LOCKS_STORE | pStore
 | ) |  |

Definition at line 280 of file sync.c.

      {

    PLIST_ENTRY             pleHead;

    // decrement count of allocated locks
    pStore->ulCountAllocated--;

    // if there are too many dynamic readwrite locks, then free this lock
    if ((pStore->ulCountAllocated + pStore->ulCountFree + 1) >
        DYNAMIC_LOCKS_HIGH_THRESHOLD)
    {
        DELETE_READ_WRITE_LOCK(&pLock->rwlLock);
        HeapFree(pStore->hHeap, 0, pLock);
    }
    else                        // insert into the list of free locks
    {
        pleHead = &(pStore->llFreeLocksList.head);
        InsertHeadList(pleHead, &pLock->leLink);
        pStore->ulCountFree++;
    }

    return;
}

PDYNAMIC_READWRITE_LOCK GetDynamicReadwriteLock ( PDYNAMIC_LOCKS_STORE pStore )

Definition at line 232 of file sync.c.

      {

    PDYNAMIC_READWRITE_LOCK pLock;
    PLIST_ENTRY             pleHead, ple;

    // a free dynamic lock is available. Return it
    pleHead = &(pStore->llFreeLocksList.head);
    if (!IsListEmpty(pleHead))
    {
        pStore->ulCountFree--;
        ple = RemoveHeadList(pleHead);
        pLock = CONTAINING_RECORD(ple, DYNAMIC_READWRITE_LOCK, leLink);
        return pLock;
    }

    // allocate memory for a new dynamic lock
    pLock = HeapAlloc(pStore->hHeap, 0, sizeof(DYNAMIC_READWRITE_LOCK));
    if (pLock ==  NULL)
        return NULL;

    // initialize the fields
    CREATE_READ_WRITE_LOCK(&(pLock->rwlLock));
    if (!READ_WRITE_LOCK_CREATED(&(pLock->rwlLock)))
    {
        HeapFree(pStore->hHeap, 0, pLock);
        return NULL;
    }
    pLock->ulCount = 0;

    pStore->ulCountAllocated++;

    return pLock;
}

DWORD InitializeDynamicLocksStore | ( | PDYNAMIC_LOCKS_STORE | pStore,
 |  | HANDLE | hHeap
 | ) |  |

Definition at line 160 of file sync.c.

      {

    // initialize the heap from where dynamic locks are allocated
    pStore->hHeap = hHeap;

    INITIALIZE_LOCKED_LIST(&pStore->llFreeLocksList);
    if (!LOCKED_LIST_INITIALIZED(&pStore->llFreeLocksList))
        return GetLastError();

    // initialize the count of the number of free and allocated locks
    pStore->ulCountAllocated = pStore->ulCountFree = 0;

    return NO_ERROR;
}

VOID ReleaseDynamicReadwriteLock | ( | PDYNAMIC_READWRITE_LOCK * | ppLock,
 |  | LOCK_MODE | lmMode,
 |  | PDYNAMIC_LOCKS_STORE | pStore
 | ) |  |

Definition at line 371 of file sync.c.

      {

    // acquire the lock for the free locks list
    ACQUIRE_LIST_LOCK(&pStore->llFreeLocksList);

    // release the dynamic readwrite lock
    if (lmMode == READ_MODE)
        RELEASE_READ_LOCK(&(*ppLock)->rwlLock);
    else
        RELEASE_WRITE_LOCK(&(*ppLock)->rwlLock);

    // decrement count in the dynamic lock, free it if count becomes 0
    if (!(*ppLock)->ulCount--)
    {
        FreeDynamicReadwriteLock(*ppLock, pStore);
        *ppLock = NULL;         // so it is known that it doesn't exist
    }

    // release the lock for the free locks list
    RELEASE_LIST_LOCK(&pStore->llFreeLocksList);

    return;
}

VOID ReleaseReadLock ( PREAD_WRITE_LOCK pRWL )

Definition at line 100 of file sync.c.

      {

    if (InterlockedDecrement(&pRWL->RWL_ReaderCount) < 0) {
        SetEvent(pRWL->RWL_ReaderDoneEvent);
    }
}

VOID ReleaseWriteLock ( PREAD_WRITE_LOCK pRWL )

Definition at line 143 of file sync.c.

      {

    InterlockedIncrement(&pRWL->RWL_ReaderCount);
    LeaveCriticalSection(&(pRWL)->RWL_ReadWriteBlock);
}

Generated on Wed Nov 13 2024 16:54:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/ip/sync.h File Reference

  • NetDS
  • RRas
  • ip
Classes | Defines | Typedefs | Enumerations | Functions

sync.h File Reference

Go to the source code of this file.

Classes

struct | _DYNAMIC_LOCKS_STORE
struct | _DYNAMIC_READWRITE_LOCK
struct | _LOCKED_LIST
struct | _READ_WRITE_LOCK

Defines

#define | ACQUIRE_LIST_LOCK(pLL) EnterCriticalSection(&(pLL)->lock)
#define | ACQUIRE_QUEUE_LOCK(pLQ) ACQUIRE_LIST_LOCK(pLQ)
#define | ACQUIRE_READ_LOCK(pRWL) AcquireReadLock(pRWL)
#define | ACQUIRE_WRITE_LOCK(pRWL) AcquireWriteLock(pRWL)
#define | CREATE_READ_WRITE_LOCK(pRWL) CreateReadWriteLock(pRWL)
#define | DELETE_LOCKED_LIST(pLL, FreeFunction)
#define | DELETE_LOCKED_QUEUE(pLQ, FreeFunction) DELETE_LOCKED_LIST(pLQ, FreeFunction)
#define | DELETE_READ_WRITE_LOCK(pRWL) DeleteReadWriteLock(pRWL)
#define | DYNAMIC_LOCKS_HIGH_THRESHOLD 7
#define | DYNAMIC_LOCKS_STORE_INITIALIZED(pStore) (LOCKED_LIST_INITIALIZED(&(pStore)->llFreeLocksList))
#define | INITIALIZE_LOCKED_LIST(pLL)
#define | INITIALIZE_LOCKED_QUEUE(pLQ) INITIALIZE_LOCKED_LIST(pLQ)
#define | LOCKED_LIST_INITIALIZED(pLL) ((pLL)->created == 0x12345678)
#define | LOCKED_QUEUE LOCKED_LIST
#define | LOCKED_QUEUE_INITIALIZED(pLQ) LOCKED_LIST_INITIALIZED(pLQ)
#define | PLOCKED_QUEUE PLOCKED_LIST
#define | READ_WRITE_LOCK_CREATED(pRWL) ((pRWL)->RWL_ReaderDoneEvent != NULL)
#define | RELEASE_LIST_LOCK(pLL) LeaveCriticalSection(&(pLL)->lock)
#define | RELEASE_QUEUE_LOCK(pLQ) RELEASE_LIST_LOCK(pLQ)
#define | RELEASE_READ_LOCK(pRWL) ReleaseReadLock(pRWL)
#define | RELEASE_WRITE_LOCK(pRWL) ReleaseWriteLock(pRWL)
#define | WRITE_LOCK_TO_READ_LOCK(pRWL)

Typedefs

typedef struct _DYNAMIC_LOCKS_STORE | DYNAMIC_LOCKS_STORE
typedef struct
_DYNAMIC_READWRITE_LOCK 		DYNAMIC_READWRITE_LOCK
typedef struct _LOCKED_LIST | LOCKED_LIST
typedef struct
_DYNAMIC_LOCKS_STORE * 		PDYNAMIC_LOCKS_STORE
typedef struct
_DYNAMIC_READWRITE_LOCK * 		PDYNAMIC_READWRITE_LOCK
typedef struct _LOCKED_LIST * | PLOCKED_LIST
typedef struct _READ_WRITE_LOCK * | PREAD_WRITE_LOCK
typedef struct _READ_WRITE_LOCK | READ_WRITE_LOCK

Enumerations

enum | LOCK_MODE { READ_MODE, WRITE_MODE }

Functions

DWORD | AcquireDynamicReadwriteLock (PDYNAMIC_READWRITE_LOCK *ppLock, LOCK_MODE lmMode, PDYNAMIC_LOCKS_STORE pStore)
VOID | AcquireReadLock (PREAD_WRITE_LOCK pRWL)
VOID | AcquireWriteLock (PREAD_WRITE_LOCK pRWL)
DWORD | CreateReadWriteLock (PREAD_WRITE_LOCK pRWL)
DWORD | DeInitializeDynamicLocksStore (PDYNAMIC_LOCKS_STORE pStore)
VOID | DeleteReadWriteLock (PREAD_WRITE_LOCK pRWL)
DWORD | InitializeDynamicLocksStore (PDYNAMIC_LOCKS_STORE pStore, HANDLE hHeap)
VOID | ReleaseDynamicReadwriteLock (PDYNAMIC_READWRITE_LOCK *ppLock, LOCK_MODE lmMode, PDYNAMIC_LOCKS_STORE pStore)
VOID | ReleaseReadLock (PREAD_WRITE_LOCK pRWL)
VOID | ReleaseWriteLock (PREAD_WRITE_LOCK pRWL)

Define Documentation

#define ACQUIRE_LIST_LOCK ( pLL ) EnterCriticalSection(&(pLL)->lock)

Definition at line 142 of file sync.h.

#define ACQUIRE_QUEUE_LOCK ( pLQ ) ACQUIRE_LIST_LOCK(pLQ)

Definition at line 160 of file sync.h.

#define ACQUIRE_READ_LOCK ( pRWL ) AcquireReadLock(pRWL)

Definition at line 69 of file sync.h.

#define ACQUIRE_WRITE_LOCK ( pRWL ) AcquireWriteLock(pRWL)

Definition at line 73 of file sync.h.

#define CREATE_READ_WRITE_LOCK ( pRWL ) CreateReadWriteLock(pRWL)

Definition at line 62 of file sync.h.

#define DELETE_LOCKED_LIST | ( | pLL,
 |  | FreeFunction
 | ) |
Value:
{                                                                   \
     (pLL)->created = 0;                                            \
     FreeList(&((pLL)->head), FreeFunction);                        \
     DeleteCriticalSection(&(pLL)->lock);                           \
}

Definition at line 135 of file sync.h.

#define DELETE_LOCKED_QUEUE | ( | pLQ,
 |  | FreeFunction |
 | ) |  | DELETE_LOCKED_LIST(pLQ, FreeFunction)

Definition at line 158 of file sync.h.

#define DELETE_READ_WRITE_LOCK ( pRWL ) DeleteReadWriteLock(pRWL)

Definition at line 64 of file sync.h.

#define DYNAMIC_LOCKS_HIGH_THRESHOLD 7

Definition at line 196 of file sync.h.

#define DYNAMIC_LOCKS_STORE_INITIALIZED ( pStore ) (LOCKED_LIST_INITIALIZED(&(pStore)->llFreeLocksList))

Definition at line 198 of file sync.h.

#define INITIALIZE_LOCKED_LIST ( pLL )
Value:
{                                                                   \
    do                                                              \
    {                                                               \
        __try {                                                     \
            InitializeCriticalSection(&((pLL)->lock));              \
        }                                                           \
        __except (EXCEPTION_EXECUTE_HANDLER) {                      \
            break;                                                  \
        }                                                           \
        InitializeListHead(&((pLL)->head));                         \
        (pLL)->created = 0x12345678;                                \
    } while (FALSE);                                                \
}

Definition at line 104 of file sync.h.

#define INITIALIZE_LOCKED_QUEUE ( pLQ ) INITIALIZE_LOCKED_LIST(pLQ)

Definition at line 154 of file sync.h.

#define LOCKED_LIST_INITIALIZED ( pLL ) ((pLL)->created == 0x12345678)

Definition at line 125 of file sync.h.

#define LOCKED_QUEUE LOCKED_LIST

Definition at line 150 of file sync.h.

#define LOCKED_QUEUE_INITIALIZED ( pLQ ) LOCKED_LIST_INITIALIZED(pLQ)

Definition at line 156 of file sync.h.

#define PLOCKED_QUEUE PLOCKED_LIST

Definition at line 151 of file sync.h.

#define READ_WRITE_LOCK_CREATED ( pRWL ) ((pRWL)->RWL_ReaderDoneEvent != NULL)

Definition at line 66 of file sync.h.

#define RELEASE_LIST_LOCK ( pLL ) LeaveCriticalSection(&(pLL)->lock)

Definition at line 145 of file sync.h.

#define RELEASE_QUEUE_LOCK ( pLQ ) RELEASE_LIST_LOCK(pLQ)

Definition at line 162 of file sync.h.

#define RELEASE_READ_LOCK ( pRWL ) ReleaseReadLock(pRWL)

Definition at line 71 of file sync.h.

#define RELEASE_WRITE_LOCK ( pRWL ) ReleaseWriteLock(pRWL)

Definition at line 75 of file sync.h.

#define WRITE_LOCK_TO_READ_LOCK ( pRWL )
Value:
{                                                                   \
    ACQUIRE_READ_LOCK(pRWL);                                        \
    RELEASE_WRITE_LOCK(pRWL);                                       \
}

Definition at line 79 of file sync.h.

Typedef Documentation

typedef struct _DYNAMIC_LOCKS_STORE DYNAMIC_LOCKS_STORE
typedef struct _DYNAMIC_READWRITE_LOCK DYNAMIC_READWRITE_LOCK
typedef struct _LOCKED_LIST LOCKED_LIST
typedef struct _DYNAMIC_LOCKS_STORE * PDYNAMIC_LOCKS_STORE
typedef struct _DYNAMIC_READWRITE_LOCK * PDYNAMIC_READWRITE_LOCK
typedef struct _LOCKED_LIST * PLOCKED_LIST
typedef struct _READ_WRITE_LOCK * PREAD_WRITE_LOCK
typedef struct _READ_WRITE_LOCK READ_WRITE_LOCK

Enumeration Type Documentation

enum LOCK_MODE
Enumerator:
READ_MODE
WRITE_MODE

Definition at line 201 of file sync.h.

{ READ_MODE, WRITE_MODE } LOCK_MODE;

Function Documentation

DWORD AcquireDynamicReadwriteLock | ( | PDYNAMIC_READWRITE_LOCK * | ppLock,
 |  | LOCK_MODE | lmMode,
 |  | PDYNAMIC_LOCKS_STORE | pStore
 | ) |  |

Definition at line 321 of file sync.c.

      {

    // acquire the lock for the free locks list
    ACQUIRE_LIST_LOCK(&pStore->llFreeLocksList);

    // if it is does not already exist, allocate a new dynamic lock
    if (*ppLock == NULL)
    {
        *ppLock = GetDynamicReadwriteLock(pStore);

        // if could not get a lock we are in serious trouble
        if (*ppLock == NULL)
        {
            RELEASE_LIST_LOCK(&pStore->llFreeLocksList);
            return ERROR_CAN_NOT_COMPLETE;
        }
    }

    // increment count in the dynamic lock
    (*ppLock)->ulCount++;

    // release the lock for the free locks list
    RELEASE_LIST_LOCK(&pStore->llFreeLocksList);

    // acquire dynamic lock
    if (lmMode == READ_MODE)
        ACQUIRE_READ_LOCK(&(*ppLock)->rwlLock);
    else
        ACQUIRE_WRITE_LOCK(&(*ppLock)->rwlLock);

    return NO_ERROR;
}

VOID AcquireReadLock ( PREAD_WRITE_LOCK pRWL )

Definition at line 80 of file sync.c.

      {

    EnterCriticalSection(&pRWL->RWL_ReadWriteBlock);
    InterlockedIncrement(&pRWL->RWL_ReaderCount);
    LeaveCriticalSection(&pRWL->RWL_ReadWriteBlock);
}

VOID AcquireWriteLock ( PREAD_WRITE_LOCK pRWL )

Definition at line 121 of file sync.c.

      {

    EnterCriticalSection(&pRWL->RWL_ReadWriteBlock);
    if (InterlockedDecrement(&pRWL->RWL_ReaderCount) >= 0) {
        WaitForSingleObject(pRWL->RWL_ReaderDoneEvent, INFINITE);
    }
}

DWORD CreateReadWriteLock ( PREAD_WRITE_LOCK pRWL )

Definition at line 28 of file sync.c.

      {

    pRWL->RWL_ReaderCount = 0;

    __try {
        InitializeCriticalSection(&(pRWL)->RWL_ReadWriteBlock);
    }
    __except(EXCEPTION_EXECUTE_HANDLER) {
        return GetLastError();
    }

    pRWL->RWL_ReaderDoneEvent = CreateEvent(NULL,FALSE,FALSE,NULL);
    if (pRWL->RWL_ReaderDoneEvent != NULL) {
        return GetLastError();
    }

    return NO_ERROR;
}

DWORD DeInitializeDynamicLocksStore ( PDYNAMIC_LOCKS_STORE pStore )

Definition at line 188 of file sync.c.

      {

    PDYNAMIC_READWRITE_LOCK pLock;
    PLIST_ENTRY             pleHead, ple;

    if (pStore->ulCountFree)
        return ERROR_CAN_NOT_COMPLETE;

    // deinitialize the count of the number of free and allocated locks
    pStore->ulCountAllocated = pStore->ulCountFree = 0;

    // deinitialize the FreeLocksList
    pStore->llFreeLocksList.created = 0;

    // delete all dynamic readwrite locks and free the memory.
    pleHead = &(pStore->llFreeLocksList.head);
    for (ple = pleHead->Flink; ple != pleHead; ple = ple->Flink)
    {
        pLock = CONTAINING_RECORD(ple, DYNAMIC_READWRITE_LOCK, leLink);
        DELETE_READ_WRITE_LOCK(&pLock->rwlLock);
        HeapFree(pStore->hHeap, 0, pLock);
    }

    DeleteCriticalSection(&(pStore->llFreeLocksList.lock));

    // deinitialize the heap from where dynamic locks are allocated
    pStore->hHeap = NULL;

    return NO_ERROR;
}

VOID DeleteReadWriteLock ( PREAD_WRITE_LOCK pRWL )

Definition at line 58 of file sync.c.

      {

    CloseHandle(pRWL->RWL_ReaderDoneEvent);
    pRWL->RWL_ReaderDoneEvent = NULL;
    DeleteCriticalSection(&pRWL->RWL_ReadWriteBlock);
    pRWL->RWL_ReaderCount = 0;
}

DWORD InitializeDynamicLocksStore | ( | PDYNAMIC_LOCKS_STORE | pStore,
 |  | HANDLE | hHeap
 | ) |  |

Definition at line 160 of file sync.c.

      {

    // initialize the heap from where dynamic locks are allocated
    pStore->hHeap = hHeap;

    INITIALIZE_LOCKED_LIST(&pStore->llFreeLocksList);
    if (!LOCKED_LIST_INITIALIZED(&pStore->llFreeLocksList))
        return GetLastError();

    // initialize the count of the number of free and allocated locks
    pStore->ulCountAllocated = pStore->ulCountFree = 0;

    return NO_ERROR;
}

VOID ReleaseDynamicReadwriteLock | ( | PDYNAMIC_READWRITE_LOCK * | ppLock,
 |  | LOCK_MODE | lmMode,
 |  | PDYNAMIC_LOCKS_STORE | pStore
 | ) |  |

Definition at line 371 of file sync.c.

      {

    // acquire the lock for the free locks list
    ACQUIRE_LIST_LOCK(&pStore->llFreeLocksList);

    // release the dynamic readwrite lock
    if (lmMode == READ_MODE)
        RELEASE_READ_LOCK(&(*ppLock)->rwlLock);
    else
        RELEASE_WRITE_LOCK(&(*ppLock)->rwlLock);

    // decrement count in the dynamic lock, free it if count becomes 0
    if (!(*ppLock)->ulCount--)
    {
        FreeDynamicReadwriteLock(*ppLock, pStore);
        *ppLock = NULL;         // so it is known that it doesn't exist
    }

    // release the lock for the free locks list
    RELEASE_LIST_LOCK(&pStore->llFreeLocksList);

    return;
}

VOID ReleaseReadLock ( PREAD_WRITE_LOCK pRWL )

Definition at line 100 of file sync.c.

      {

    if (InterlockedDecrement(&pRWL->RWL_ReaderCount) < 0) {
        SetEvent(pRWL->RWL_ReaderDoneEvent);
    }
}

VOID ReleaseWriteLock ( PREAD_WRITE_LOCK pRWL )

Definition at line 143 of file sync.c.

      {

    InterlockedIncrement(&pRWL->RWL_ReaderCount);
    LeaveCriticalSection(&(pRWL)->RWL_ReadWriteBlock);
}

Generated on Wed Nov 13 2024 16:54:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/ip/test.c File Reference

  • NetDS
  • RRas
  • ip
Defines | Functions

test.c File Reference

#include "pchsample.h"

Go to the source code of this file.

Defines

#define | CELEMS(x) ((sizeof(x))/(sizeof(x[0])))

Functions

VOID WINAPI | TestProtocol (VOID)

Define Documentation

#define CELEMS ( x ) ((sizeof(x))/(sizeof(x[0])))

Definition at line 19 of file test.c.

Function Documentation

VOID WINAPI TestProtocol ( VOID )

Definition at line 469 of file test.c.

{
    TRACE0(ANY, "Hello World!");
}

Generated on Wed Nov 13 2024 16:54:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/ip/utils.c File Reference

  • NetDS
  • RRas
  • ip
Functions

utils.c File Reference

#include "pchsample.h"

Go to the source code of this file.

Functions

BOOL EnterSampleAPI ()
BOOL EnterSampleWorker ()
VOID | LeaveSampleWorker ()
DWORD | QueueSampleWorker (IN WORKERFUNCTION pfnFunction, IN PVOID pvContext)

Function Documentation

BOOL EnterSampleAPI ( )

Definition at line 76 of file utils.c.

{
    BOOL    bEntered    = FALSE;

    ACQUIRE_WRITE_LOCK(&(g_ce.rwlLock));

    if (g_ce.iscStatus is IPSAMPLE_STATUS_RUNNING)
    {
        // SAMPLE is running, so continue
        g_ce.ulActivityCount++;
        bEntered = TRUE;
    }

    RELEASE_WRITE_LOCK(&(g_ce.rwlLock));

    return bEntered;
}

BOOL EnterSampleWorker ( )

Definition at line 118 of file utils.c.

{
    BOOL    bEntered    = FALSE;

    ACQUIRE_WRITE_LOCK(&(g_ce.rwlLock));

    do                          // breakout loop
    {
        // SAMPLE is running, so the function may continue
        if (g_ce.iscStatus is IPSAMPLE_STATUS_RUNNING)
        {
            bEntered = TRUE;
            break;
        }

        // SAMPLE is not running, but it was, so the function must stop
        if (g_ce.iscStatus is IPSAMPLE_STATUS_STOPPING)
        {
            g_ce.ulActivityCount--;
            ReleaseSemaphore(g_ce.hActivitySemaphore, 1, NULL);
            break;
        }

        // SAMPLE probably never started. quit
    } while (FALSE);

    RELEASE_WRITE_LOCK(&(g_ce.rwlLock));

    return bEntered;
}

VOID LeaveSampleWorker ( )

Definition at line 175 of file utils.c.

{
    ACQUIRE_WRITE_LOCK(&(g_ce.rwlLock));

    g_ce.ulActivityCount--;

    if (g_ce.iscStatus is IPSAMPLE_STATUS_STOPPING)
        ReleaseSemaphore(g_ce.hActivitySemaphore, 1, NULL);

    RELEASE_WRITE_LOCK(&(g_ce.rwlLock));
}

DWORD QueueSampleWorker | ( | IN WORKERFUNCTION | pfnFunction,
 |  | IN PVOID | pvContext
 | ) |  |

Definition at line 20 of file utils.c.

{
    DWORD   dwErr       = NO_ERROR;
    BOOL    bSuccess    = FALSE;

    ACQUIRE_WRITE_LOCK(&(g_ce.rwlLock));

    do                          // breakout loop
    {
        // cannot queue a work function when SAMPLE has quit or is quitting
        if (g_ce.iscStatus != IPSAMPLE_STATUS_RUNNING)
        {
            dwErr = ERROR_CAN_NOT_COMPLETE;
            break;
        }

        bSuccess = QueueUserWorkItem((LPTHREAD_START_ROUTINE)pfnFunction,
                                     pvContext,
                                     0); // no flags
        if (bSuccess)
            g_ce.ulActivityCount++;
        else
            dwErr = GetLastError();
    } while (FALSE);

    RELEASE_WRITE_LOCK(&(g_ce.rwlLock));

    return dwErr;
}

Generated on Wed Nov 13 2024 16:54:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/ip/utils.h File Reference

  • NetDS
  • RRas
  • ip
Functions

utils.h File Reference

Go to the source code of this file.

Functions

BOOL EnterSampleAPI ()
BOOL EnterSampleWorker ()
VOID | LeaveSampleWorker ()
DWORD | QueueSampleWorker (IN WORKERFUNCTION pfnFunction, IN PVOID pvContext)

Function Documentation

BOOL EnterSampleAPI ( )

Definition at line 76 of file utils.c.

{
    BOOL    bEntered    = FALSE;

    ACQUIRE_WRITE_LOCK(&(g_ce.rwlLock));

    if (g_ce.iscStatus is IPSAMPLE_STATUS_RUNNING)
    {
        // SAMPLE is running, so continue
        g_ce.ulActivityCount++;
        bEntered = TRUE;
    }

    RELEASE_WRITE_LOCK(&(g_ce.rwlLock));

    return bEntered;
}

BOOL EnterSampleWorker ( )

Definition at line 118 of file utils.c.

{
    BOOL    bEntered    = FALSE;

    ACQUIRE_WRITE_LOCK(&(g_ce.rwlLock));

    do                          // breakout loop
    {
        // SAMPLE is running, so the function may continue
        if (g_ce.iscStatus is IPSAMPLE_STATUS_RUNNING)
        {
            bEntered = TRUE;
            break;
        }

        // SAMPLE is not running, but it was, so the function must stop
        if (g_ce.iscStatus is IPSAMPLE_STATUS_STOPPING)
        {
            g_ce.ulActivityCount--;
            ReleaseSemaphore(g_ce.hActivitySemaphore, 1, NULL);
            break;
        }

        // SAMPLE probably never started. quit
    } while (FALSE);

    RELEASE_WRITE_LOCK(&(g_ce.rwlLock));

    return bEntered;
}

VOID LeaveSampleWorker ( )

Definition at line 175 of file utils.c.

{
    ACQUIRE_WRITE_LOCK(&(g_ce.rwlLock));

    g_ce.ulActivityCount--;

    if (g_ce.iscStatus is IPSAMPLE_STATUS_STOPPING)
        ReleaseSemaphore(g_ce.hActivitySemaphore, 1, NULL);

    RELEASE_WRITE_LOCK(&(g_ce.rwlLock));
}

DWORD QueueSampleWorker | ( | IN WORKERFUNCTION | pfnFunction,
 |  | IN PVOID | pvContext
 | ) |  |

Definition at line 20 of file utils.c.

{
    DWORD   dwErr       = NO_ERROR;
    BOOL    bSuccess    = FALSE;

    ACQUIRE_WRITE_LOCK(&(g_ce.rwlLock));

    do                          // breakout loop
    {
        // cannot queue a work function when SAMPLE has quit or is quitting
        if (g_ce.iscStatus != IPSAMPLE_STATUS_RUNNING)
        {
            dwErr = ERROR_CAN_NOT_COMPLETE;
            break;
        }

        bSuccess = QueueUserWorkItem((LPTHREAD_START_ROUTINE)pfnFunction,
                                     pvContext,
                                     0); // no flags
        if (bSuccess)
            g_ce.ulActivityCount++;
        else
            dwErr = GetLastError();
    } while (FALSE);

    RELEASE_WRITE_LOCK(&(g_ce.rwlLock));

    return dwErr;
}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/LoadProtocol/ipsamplerm.h File Reference

  • NetDS
  • RRas
  • LoadProtocol
Classes | Defines | Typedefs

ipsamplerm.h File Reference

Go to the source code of this file.

Classes

struct | _IPSAMPLE_GLOBAL_CONFIG
struct | _IPSAMPLE_GLOBAL_STATS
struct | _IPSAMPLE_IF_BINDING
struct | _IPSAMPLE_IF_CONFIG
struct | _IPSAMPLE_IF_STATS
struct | _IPSAMPLE_IP_ADDRESS
struct | _IPSAMPLE_MIB_GET_INPUT_DATA
struct | _IPSAMPLE_MIB_GET_OUTPUT_DATA
struct | _IPSAMPLE_MIB_SET_INPUT_DATA

Defines

#define | ANY_SIZE 0
#define | IPSAMPLE_GLOBAL_CONFIG_ID 1
#define | IPSAMPLE_GLOBAL_STATS_ID 0
#define | IPSAMPLE_IF_ADDRESS_TABLE(bind) ((PIPSAMPLE_IP_ADDRESS)((bind) + 1))
#define | IPSAMPLE_IF_BINDING_ID 4
#define | IPSAMPLE_IF_BINDING_SIZE(bind)
#define | IPSAMPLE_IF_CONFIG_ID 3
#define | IPSAMPLE_IF_STATS_ID 2
#define | IPSAMPLE_LOGGING_ERROR 1
#define | IPSAMPLE_LOGGING_INFO 3
#define | IPSAMPLE_LOGGING_NONE 0
#define | IPSAMPLE_LOGGING_WARN 2
#define | IPSAMPLE_METRIC_INFINITE 16
#define | IPSAMPLE_STATE_ACTIVE 0x00000001
#define | IPSAMPLE_STATE_BOUND 0x00000002
#define | MS_IP_SAMPLE PROTOCOL_ID(PROTO_TYPE_UCAST, PROTO_VENDOR_MS0, PROTO_IP_SAMPLE)
#define | PROTO_IP_SAMPLE 200
#define | SAMPLE_PROTOCOL_MULTICAST_GROUP ((DWORD)0x640000E0)

Typedefs

typedef struct
_IPSAMPLE_GLOBAL_CONFIG 		IPSAMPLE_GLOBAL_CONFIG
typedef struct
_IPSAMPLE_GLOBAL_STATS 		IPSAMPLE_GLOBAL_STATS
typedef struct _IPSAMPLE_IF_BINDING | IPSAMPLE_IF_BINDING
typedef struct _IPSAMPLE_IF_CONFIG | IPSAMPLE_IF_CONFIG
typedef struct _IPSAMPLE_IF_STATS | IPSAMPLE_IF_STATS
typedef struct _IPSAMPLE_IP_ADDRESS | IPSAMPLE_IP_ADDRESS
typedef struct
_IPSAMPLE_MIB_GET_INPUT_DATA 		IPSAMPLE_MIB_GET_INPUT_DATA
typedef struct
_IPSAMPLE_MIB_GET_OUTPUT_DATA 		IPSAMPLE_MIB_GET_OUTPUT_DATA
typedef struct
_IPSAMPLE_MIB_SET_INPUT_DATA 		IPSAMPLE_MIB_SET_INPUT_DATA
typedef struct
_IPSAMPLE_GLOBAL_CONFIG * 		PIPSAMPLE_GLOBAL_CONFIG
typedef struct
_IPSAMPLE_GLOBAL_STATS * 		PIPSAMPLE_GLOBAL_STATS
typedef struct
_IPSAMPLE_IF_BINDING * 		PIPSAMPLE_IF_BINDING
typedef struct
_IPSAMPLE_IF_CONFIG * 		PIPSAMPLE_IF_CONFIG
typedef struct _IPSAMPLE_IF_STATS * | PIPSAMPLE_IF_STATS
typedef struct
_IPSAMPLE_IP_ADDRESS * 		PIPSAMPLE_IP_ADDRESS
typedef struct
_IPSAMPLE_MIB_GET_INPUT_DATA * 		PIPSAMPLE_MIB_GET_INPUT_DATA
typedef struct
_IPSAMPLE_MIB_GET_OUTPUT_DATA * 		PIPSAMPLE_MIB_GET_OUTPUT_DATA
typedef struct
_IPSAMPLE_MIB_SET_INPUT_DATA * 		PIPSAMPLE_MIB_SET_INPUT_DATA

Define Documentation

#define ANY_SIZE 0

Definition at line 22 of file ipsamplerm.h.

#define IPSAMPLE_GLOBAL_CONFIG_ID 1

Definition at line 42 of file ipsamplerm.h.

#define IPSAMPLE_GLOBAL_STATS_ID 0

Definition at line 41 of file ipsamplerm.h.

#define IPSAMPLE_IF_ADDRESS_TABLE ( bind ) ((PIPSAMPLE_IP_ADDRESS)((bind) + 1))

Definition at line 216 of file ipsamplerm.h.

#define IPSAMPLE_IF_BINDING_ID 4

Definition at line 45 of file ipsamplerm.h.

#define IPSAMPLE_IF_BINDING_SIZE ( bind )
Value:
(sizeof(IPSAMPLE_IF_BINDING) +                              \
     (bind)->ulCount * sizeof(IPSAMPLE_IP_ADDRESS))

Definition at line 212 of file ipsamplerm.h.

#define IPSAMPLE_IF_CONFIG_ID 3

Definition at line 44 of file ipsamplerm.h.

#define IPSAMPLE_IF_STATS_ID 2

Definition at line 43 of file ipsamplerm.h.

#define IPSAMPLE_LOGGING_ERROR 1

Definition at line 53 of file ipsamplerm.h.

#define IPSAMPLE_LOGGING_INFO 3

Definition at line 55 of file ipsamplerm.h.

#define IPSAMPLE_LOGGING_NONE 0

Definition at line 52 of file ipsamplerm.h.

#define IPSAMPLE_LOGGING_WARN 2

Definition at line 54 of file ipsamplerm.h.

#define IPSAMPLE_METRIC_INFINITE 16

Definition at line 63 of file ipsamplerm.h.

#define IPSAMPLE_STATE_ACTIVE 0x00000001

Definition at line 71 of file ipsamplerm.h.

#define IPSAMPLE_STATE_BOUND 0x00000002

Definition at line 72 of file ipsamplerm.h.

#define MS_IP_SAMPLE PROTOCOL_ID(PROTO_TYPE_UCAST, PROTO_VENDOR_MS0, PROTO_IP_SAMPLE)

Definition at line 31 of file ipsamplerm.h.

#define PROTO_IP_SAMPLE 200

Definition at line 30 of file ipsamplerm.h.

#define SAMPLE_PROTOCOL_MULTICAST_GROUP ((DWORD)0x640000E0)

Definition at line 34 of file ipsamplerm.h.

Typedef Documentation

typedef struct _IPSAMPLE_GLOBAL_CONFIG IPSAMPLE_GLOBAL_CONFIG
typedef struct _IPSAMPLE_GLOBAL_STATS IPSAMPLE_GLOBAL_STATS
typedef struct _IPSAMPLE_IF_BINDING IPSAMPLE_IF_BINDING
typedef struct _IPSAMPLE_IF_CONFIG IPSAMPLE_IF_CONFIG
typedef struct _IPSAMPLE_IF_STATS IPSAMPLE_IF_STATS
typedef struct _IPSAMPLE_IP_ADDRESS IPSAMPLE_IP_ADDRESS
typedef struct _IPSAMPLE_MIB_GET_INPUT_DATA IPSAMPLE_MIB_GET_INPUT_DATA
typedef struct _IPSAMPLE_MIB_GET_OUTPUT_DATA IPSAMPLE_MIB_GET_OUTPUT_DATA
typedef struct _IPSAMPLE_MIB_SET_INPUT_DATA IPSAMPLE_MIB_SET_INPUT_DATA
typedef struct _IPSAMPLE_GLOBAL_CONFIG * PIPSAMPLE_GLOBAL_CONFIG
typedef struct _IPSAMPLE_GLOBAL_STATS * PIPSAMPLE_GLOBAL_STATS
typedef struct _IPSAMPLE_IF_BINDING * PIPSAMPLE_IF_BINDING
typedef struct _IPSAMPLE_IF_CONFIG * PIPSAMPLE_IF_CONFIG
typedef struct _IPSAMPLE_IF_STATS * PIPSAMPLE_IF_STATS
typedef struct _IPSAMPLE_IP_ADDRESS * PIPSAMPLE_IP_ADDRESS
typedef struct _IPSAMPLE_MIB_GET_INPUT_DATA * PIPSAMPLE_MIB_GET_INPUT_DATA
typedef struct _IPSAMPLE_MIB_GET_OUTPUT_DATA * PIPSAMPLE_MIB_GET_OUTPUT_DATA
typedef struct _IPSAMPLE_MIB_SET_INPUT_DATA * PIPSAMPLE_MIB_SET_INPUT_DATA
Generated on Wed Nov 13 2024 16:54:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/LoadProtocol/loadprotocol.c File Reference

  • NetDS
  • RRas
  • LoadProtocol
Defines | Functions | Variables

loadprotocol.c File Reference

#include <windows.h>
#include <winbase.h>
#include <mprapi.h>
#include <rtinfo.h>
#include "ipsamplerm.h"

Go to the source code of this file.

Defines

#define | UNICODE
#define | YOUR_PROTOCOL_BLOCK_SIZE 0x0004
#define | YOUR_PROTOCOL_ID 0x00c8
#define | YOUR_PROTOCOL_INFO_BLOCK_DATA (&igc)

Functions

HRESULT | AddProtocolToServer (LPCWSTR pswzServerName)
void | main ()

Variables

IPSAMPLE_GLOBAL_CONFIG | igc = {0}

Define Documentation

#define UNICODE

Definition at line 11 of file loadprotocol.c.

#define YOUR_PROTOCOL_BLOCK_SIZE 0x0004

Definition at line 24 of file loadprotocol.c.

#define YOUR_PROTOCOL_ID 0x00c8

Definition at line 23 of file loadprotocol.c.

#define YOUR_PROTOCOL_INFO_BLOCK_DATA (&igc)

Definition at line 22 of file loadprotocol.c.

Function Documentation

HRESULT AddProtocolToServer ( LPCWSTR pswzServerName )

Definition at line 28 of file loadprotocol.c.

{
    HRESULT     hr = S_OK;
    DWORD       dwErr = ERROR_SUCCESS;
    DWORD       dwErrT = ERROR_SUCCESS;
    MPR_SERVER_HANDLE   hMprServer = NULL;
    HANDLE   hMprConfig = NULL;
    LPBYTE      pByte = NULL;
    LPVOID        pHeader = NULL;
    LPVOID        pNewHeader = NULL;
    DWORD       dwSize = 0;
    HANDLE      hTransport = NULL;

    // Connect to the server
    // ----------------------------------------------------------------
    dwErr = MprAdminServerConnect((LPWSTR) pswzServerName, &hMprServer);
    if (dwErr == ERROR_SUCCESS)
    {
        // Ok, get the infobase from the server
        // ------------------------------------------------------------
        dwErr = MprAdminTransportGetInfo(hMprServer,
                                         PID_IP,
                                         &pByte,
                                         &dwSize,
                                         NULL,
                                         NULL);

        if (dwErr == ERROR_SUCCESS)
        {
            // Call MprInfoDuplicate to create a duplicate of
            // the infoblock
            // --------------------------------------------------------
            MprInfoDuplicate(pByte, &pHeader);
            MprAdminBufferFree(pByte);
            pByte = NULL;
            dwSize = 0;
        }
    }

    // We also have to open the hMprConfig, but we can ignore the error
    // ----------------------------------------------------------------
    dwErrT = MprConfigServerConnect((LPWSTR) pswzServerName, &hMprConfig);
    if (dwErrT == ERROR_SUCCESS)
    {
        dwErrT = MprConfigTransportGetHandle(hMprConfig, PID_IP, &hTransport);
    }

    if (dwErr != ERROR_SUCCESS)
    {
        // Ok, try to use the MprConfig calls.
        // ------------------------------------------------------------
        MprConfigTransportGetInfo(hMprConfig,
                                  hTransport,
                                  &pByte,
                                  &dwSize,
                                  NULL,
                                  NULL,
                                  NULL);

        // Call MprInfoDuplicate to create a duplicate of
        // the infoblock
        // ------------------------------------------------------------
        MprInfoDuplicate(pByte, &pHeader);
        MprConfigBufferFree(pByte);
        pByte = NULL;
        dwSize = 0;
    }

    // Call MprInfoBlockRemove to remove the old protocol block
    MprInfoBlockRemove(pHeader, YOUR_PROTOCOL_ID, &pNewHeader);

    // Did we remove the block?
    if (pNewHeader != NULL)
    {
        // The block was found and removed, so use the new header.
        MprInfoDelete(pHeader);
        pHeader = pNewHeader;
        pNewHeader = NULL;
    }

    // Add protocol to the infoblock here!
    MprInfoBlockAdd(pHeader,
                    YOUR_PROTOCOL_ID,
                    YOUR_PROTOCOL_BLOCK_SIZE,
                    1,
                    (LPBYTE) YOUR_PROTOCOL_INFO_BLOCK_DATA,
                    &pNewHeader);
    MprInfoDelete(pHeader);
    pHeader = NULL;

    if (hMprServer)
    {

        MprAdminTransportSetInfo(hMprServer,
                                 PID_IP,
                                 (BYTE*)pNewHeader,
                                 MprInfoBlockQuerySize(pNewHeader),
                                 NULL,
                                 0);
    }

    if (hMprConfig && hTransport)
    {

        MprConfigTransportSetInfo(hMprConfig,
                                  hTransport,
                                  (BYTE*)pNewHeader,
                                  MprInfoBlockQuerySize(pNewHeader),
                                  NULL,
                                  0,
                                  NULL);
    }

    if (pHeader)
        MprInfoDelete(pHeader);

    if (pNewHeader)
        MprInfoDelete(pNewHeader);

    if (hMprConfig)
        MprConfigServerDisconnect(hMprConfig);

    if (hMprServer)
        MprAdminServerDisconnect(hMprServer);

    return hr;
}

void main ( void )

Definition at line 159 of file loadprotocol.c.

{
    //The first parameter is the name of the server. to execute on the local machine pass in NULL
    // as shown
    AddProtocolToServer(NULL);
}

Variable Documentation

IPSAMPLE_GLOBAL_CONFIG igc = {0}

Definition at line 21 of file loadprotocol.c.

Generated on Wed Nov 13 2024 16:54:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/rqs/client/main.cpp File Reference

  • NetDS
  • RRas
  • rqs
  • client
Defines | Functions | Variables

main.cpp File Reference

#include "rasutil.h"
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <ras.h>
#include <raserror.h>

Go to the source code of this file.

Defines

#define | MBCS
#define | RASCONN_V401_A struct tagRASCONN_V401_A

Functions

HRASCONN | FindConnectionByName (LPRASCONNA pRasConn, DWORD dwCount, LPTSTR pszConnection)
PCHAR | GenerateUserName (PCHAR pszUsername, PCHAR pszDomain)
DWORD | GetClientAndServerAddresses (LPTSTR pszConnectionName, LPTSTR pszTunnelConnectionName, OUT LPTSTR pszClientIpAddress, UINT cchClientIpAddress, OUT LPTSTR pszServerIpAddress, UINT cchServerIpAddress)
BOOL IsNT4OrBetter ()
int __cdecl | main (int argc, char *argv[], char *envp[])
void | PrintUsage (char *argv[])
VOID | RqcTrace (IN LPSTR pszTrace, IN...)

Variables

RASCONN_V401_A DWORD | dwSize
DWORD dwSubEntry
HRASCONN | hrasconn
CHAR | szDeviceName [RAS_MaxDeviceName+1]
CHAR | szDeviceType [RAS_MaxDeviceType+1]
CHAR | szEntryName [RAS_MaxEntryName+1]
CHAR | szPhonebook [MAX_PATH]

Define Documentation

#define MBCS

Definition at line 11 of file main.cpp.

#define RASCONN_V401_A struct tagRASCONN_V401_A

Definition at line 26 of file main.cpp.

Function Documentation

HRASCONN FindConnectionByName | ( | LPRASCONNA | pRasConn,
 |  | DWORD | dwCount,
 |  | LPTSTR | pszConnection
 | ) |  |

Definition at line 98 of file main.cpp.

{
    HRASCONN hConnection = NULL;

    if (pRasConn && pszConnection)
    {
        for (DWORD dwIndex = 0; dwIndex < dwCount; dwIndex++)
        {
            //
            //  Increment the array index manually since we could have a v4.0 RASCONNA
            //  struct or a v4.1 RASCONNA struct.
            //
            LPRASCONNA pTmpRasConn = (LPRASCONNA)((BYTE*)pRasConn + (pRasConn->dwSize)*dwIndex);

            if (0 == lstrcmpi(pszConnection, pTmpRasConn->szEntryName))
            {
                //
                //  We have one complication though...  On certain platforms both
                //  parts of a double dial CM connection (dialup part and tunnel part)
                //  have the same name.  We can tell the difference by looking at the
                //  phonebook parameter.  If it has _CMPhone as the phonebook file name
                //  then we know it is actually the dialup part of the double dial connection.
                //
                if (IsNT4OrBetter())
                {
                    TCHAR szFileName[_MAX_FNAME];

                    _splitpath(((RASCONN_V401_A*)pTmpRasConn)->szPhonebook, NULL, NULL, szFileName, NULL);

                    if (0 != lstrcmpi(TEXT("_cmphone"), szFileName))
                    {
                        //
                        //  Okay, we have a match
                        //
                        hConnection = pTmpRasConn->hrasconn;
                        break;
                    }
                }
                else
                {
                    //
                    //  Okay, we have a match
                    //
                    hConnection = pTmpRasConn->hrasconn;
                    break;
                }
            }
        }
    }

    return hConnection;
}

PCHAR GenerateUserName | ( | PCHAR | pszUsername,
 |  | PCHAR | pszDomain
 | ) |  |

Definition at line 314 of file main.cpp.

{
    BOOL bHaveUserName = pszUsername && (0 != lstrcmpi(pszUsername, "NULL"));
    BOOL bHaveDomain = pszDomain && (0 != lstrcmpi(pszDomain, "NULL"));

    //  Allocate the maximum amount of memory we will need.  Note that
    //  we add 3 extra, one for the \, one for the :, and one for the null
    //  terminator.
    //
    PCHAR pszReturn = (PCHAR)RuAlloc(3 + (bHaveDomain ? (UINT)strlen(pszDomain) : 0) + (bHaveUserName ? (UINT)strlen(pszUsername) : 0), TRUE);
    if (pszReturn)
    {
        if (bHaveUserName)
        {
            if (bHaveDomain)
            {
                // return domain + \ + username
                sprintf(pszReturn, "%s\\%s:", pszDomain, pszUsername);
            }
            else
            {
               // return dup of username
                sprintf(pszReturn, "%s:", pszUsername);
            }
        }
    }

    return pszReturn;
}

DWORD GetClientAndServerAddresses | ( | LPTSTR | pszConnectionName,
 |  | LPTSTR | pszTunnelConnectionName,
 |  | OUT LPTSTR | pszClientIpAddress,
 |  | UINT | cchClientIpAddress,
 |  | OUT LPTSTR | pszServerIpAddress,
 |  | UINT | cchServerIpAddress
 | ) |  |

Definition at line 157 of file main.cpp.

{
    //
    //  Check inputs
    //
    if ((NULL == pszConnectionName) || (NULL == pszTunnelConnectionName) || (NULL == pszClientIpAddress) || (NULL == pszServerIpAddress) || (0 == cchClientIpAddress) || (0 == cchServerIpAddress))
    {
        return ERROR_INVALID_PARAMETER;
    }

    pszClientIpAddress[0] = TEXT('\0');
    pszServerIpAddress[0] = TEXT('\0');

    //
    //  First we need to call loadlibrary on RasApi32.dll and then get the function addresses for
    //  RasEnumConnections and RasGetProjectionInfo
    //
    DWORD dwRet = ERROR_SUCCESS;
    HMODULE hRasApi32 = NULL;
    LPRASCONNA pRasConn = NULL;
    typedef DWORD (WINAPI *pfnRasEnumConnectionsSpec)(LPRASCONNA, LPDWORD, LPDWORD);
    typedef DWORD (WINAPI *pfnRasGetProjectionInfoSpec)(HRASCONN, RASPROJECTION, LPVOID, LPDWORD);

    pfnRasEnumConnectionsSpec pfnRasEnumConnections = NULL;
    pfnRasGetProjectionInfoSpec pfnRasGetProjectionInfo = NULL;

    __try
    {
        hRasApi32 = LoadLibrary("rasapi32.dll");

        if (hRasApi32)
        {
            pfnRasEnumConnections = (pfnRasEnumConnectionsSpec)GetProcAddress(hRasApi32, "RasEnumConnectionsA");
            pfnRasGetProjectionInfo = (pfnRasGetProjectionInfoSpec)GetProcAddress(hRasApi32, "RasGetProjectionInfoA");

            if ((NULL == pfnRasEnumConnections) || (NULL == pfnRasGetProjectionInfo))
            {
                dwRet = ERROR_PROC_NOT_FOUND;
                __leave;
            }
        }
        else
        {
            dwRet = GetLastError();
            __leave;
        }

        //
        //  Okay, now call EnumRasConnections to get a list of active connections
        //
        DWORD dwCount = 0;
        DWORD dwSizeOfRasConn = IsNT4OrBetter() ? sizeof(RASCONN_V401_A) : sizeof(RASCONNA);
        DWORD dwSize = dwSizeOfRasConn;

        do
        {
            LocalFree(pRasConn);

            pRasConn = (RASCONNA*)LocalAlloc(LMEM_ZEROINIT, dwSize);

            if (pRasConn)
            {
                pRasConn->dwSize = dwSizeOfRasConn;

                dwRet = pfnRasEnumConnections(pRasConn, &dwSize, &dwCount);

                if ((ERROR_BUFFER_TOO_SMALL != dwRet) && (ERROR_SUCCESS != dwRet))
                {
                    //
                    //  RAS error, bail.
                    //
                    __leave;
                }
            }
            else
            {
                dwRet = ERROR_NOT_ENOUGH_MEMORY;
                __leave;
            }

        } while (ERROR_BUFFER_TOO_SMALL == dwRet);

        //
        //  Okay, so now we have a buffer of connections.  Let's look
        //  through them for a match to the passed in connection name.
        //  Figure out if we are looking for the tunnel connection name
        //  or the dialup connection name
        //
        LPTSTR pszConnection = pszTunnelConnectionName;
        HRASCONN hConnection = NULL;

        if (0 == lstrcmpi(pszTunnelConnectionName, TEXT("NULL")))
        {
            pszConnection = pszConnectionName;
        }
        //else use pszTunnelConnectionName as saved above

        hConnection = FindConnectionByName (pRasConn, dwCount, pszConnection);

        //
        //  Okay, now we have the right connection so we can call RasGetProjectionInfo to actually get the data we want
        //
        if (hConnection)
        {
            RASPROJECTION RasProj = RASP_PppIp;
            RASPPPIP RasPPPIP;
            DWORD dwBufSize = sizeof(RASPPPIP);

            ZeroMemory(&RasPPPIP, dwBufSize);
            RasPPPIP.dwSize = dwBufSize;

            dwRet = pfnRasGetProjectionInfo(hConnection, RASP_PppIp, (PVOID)&RasPPPIP, &dwBufSize);

            if (ERROR_SUCCESS == dwRet)
            {
                lstrcpyn(pszClientIpAddress, RasPPPIP.szIpAddress, cchClientIpAddress);
                lstrcpyn(pszServerIpAddress, RasPPPIP.szServerIpAddress, cchClientIpAddress);
            }
        }
        else
        {
            dwRet = ERROR_NO_CONNECTION;
            __leave;
        }

    }

    __finally
    {
        if (hRasApi32)
        {
            FreeLibrary(hRasApi32);
        }

        LocalFree(pRasConn);
    }

    if (ERROR_SUCCESS != dwRet)
    {
        RqcTrace("GetClientAndServerAddresses failed with error = %d", dwRet);
    }

    return dwRet;
}

BOOL IsNT4OrBetter ( )

Definition at line 73 of file main.cpp.

{
    OSVERSIONINFO oviVersion;
    BOOL bReturn = FALSE;

    ZeroMemory(&oviVersion,sizeof(oviVersion));
    oviVersion.dwOSVersionInfoSize = sizeof(oviVersion);

    if (GetVersionEx(&oviVersion))
    {
        if ((oviVersion.dwPlatformId == VER_PLATFORM_WIN32_NT) &&
            (oviVersion.dwMajorVersion >= 4))
        {
            bReturn = TRUE;
        }
    }

    return bReturn;
}

int __cdecl main | ( | int | argc,
 |  | char * | argv[],
 |  | char * | envp[]
 | ) |  |

Definition at line 389 of file main.cpp.

{
    HRESULT hr;
    RuSocket Socket;
    ULONG ulPort;
    UINT uiStringSize, uiBufSize, uiSizeOrig;
    CHAR pszResponse[4], pszPrefix[64];
    INT iRet;

    PCHAR pszConnectionName, pszTunnelConnectionName, pszPort;
    PCHAR pszDomain, pszUsername, pszString;
    PCHAR pszUsernameAndDomain = NULL;
    CHAR szMyIp[RAS_MaxIpAddress + 1];
    CHAR szDstIp[RAS_MaxIpAddress + 1];

    //
    //  Check to see if they asked for a usage message
    //
    if ((argc == 2) && (strcmp(argv[1], "/?") == 0))
    {
        PrintUsage(argv);
        return -1;
    }

    //
    //  Make sure we got the required number of arguments
    //
    if (argc < 7)
    {
        return -1;
    }

    // Save the input params
    //
    pszConnectionName = argv[1];
    pszTunnelConnectionName = argv[2];
    pszPort = argv[3];
    pszDomain = argv[4];
    pszUsername = argv[5];
    pszString = argv[6];

    iRet = -1;

    // Get the client and server IP's
    //
    if (ERROR_SUCCESS != GetClientAndServerAddresses(pszConnectionName,
                                                     pszTunnelConnectionName,
                                                     szMyIp,
                                                     sizeof(szMyIp)/sizeof(szMyIp[0]),
                                                     szDstIp,
                                                     sizeof(szDstIp)/sizeof(szDstIp[0])))
    {
        RqcTrace("GetClientAndServerAddresses failed!");
        iRet = -1;
        goto exit;
    }

    //  Generate the username and domain string
    //
    pszUsernameAndDomain = GenerateUserName(pszUsername, pszDomain);

    if (NULL == pszUsernameAndDomain)
    {
        RqcTrace("GenerateUserName failed!");
        iRet = -1;
        goto exit;
    }

    // Calculate the sizes
    //
    uiStringSize = (UINT)strlen(pszString) + (UINT)(strlen(pszUsernameAndDomain)) + 1;

    if ((uiStringSize == 0) || (uiStringSize > 1024))
    {
        RqcTrace("Invalid string length. %d", uiStringSize);
        iRet = -1;
        goto exit;
    }
    uiBufSize = uiStringSize + 3;       // 3 = len(":1:")

    // Initialize the socket library
    //
    RqcTrace("Initializing sockets api");
    hr = RuSocket::Initialize();
    if (S_OK != hr)
    {
        RqcTrace("Unable to use sockets. %1!d!", hr);
        iRet = -1;
        goto exit;
    }

    // Covert the port over
    //
    ulPort = (UINT) atoi(pszPort);
    if ((ulPort == 0) || (ulPort == ULONG_MAX) || (ulPort > 65 * 1024))
    {
        RqcTrace("Invalid port.  %d", ulPort);
        goto exit;
    }

    // Open the socket
    //
    RqcTrace("Opening socket...");
    hr = Socket.Open(ulPort, szDstIp, szMyIp);
    if (S_OK != hr)
    {
        RqcTrace("Unable to open socket 0x%x", hr);
        iRet = 1;
        goto exit;
    }

    // Send the prefix.  Size:1:
    //
    RqcTrace("Writing prefix...");
    sprintf(pszPrefix, "%04d:1:", uiBufSize);
    uiSizeOrig = uiBufSize = (UINT)strlen(pszPrefix);
    hr = Socket.Write((BYTE*)pszPrefix, &uiBufSize);
    if ((S_OK != hr) || (uiSizeOrig != uiBufSize))
    {
        RqcTrace(
            "Can't write prefix 0x%x, %d %d",
            hr,
            uiBufSize,
            uiSizeOrig);
        iRet = 1;
        goto exit;
    }

    //
    // Send the Username and Domain
    RqcTrace("Writing username...");
    uiSizeOrig = uiBufSize = (UINT)strlen(pszUsernameAndDomain);
    hr = Socket.Write((BYTE*)pszUsernameAndDomain, &uiBufSize);
    if ((S_OK != hr) || (uiSizeOrig != uiBufSize))
    {
        RqcTrace(
            "Can't write the username 0x%x, %d %d",
            hr,
            uiBufSize,
            uiSizeOrig);

        iRet = 1;
        goto exit;
    }

    // Send the string
    //
    RqcTrace("Writing version string...");
    uiSizeOrig = uiBufSize = (UINT)strlen(pszString) + 1;
    hr = Socket.Write((BYTE*)pszString, &uiBufSize);
    if ((S_OK != hr) || (uiSizeOrig != uiBufSize))
    {
        RqcTrace(
            "Can't write string 0x%x, %d %d",
            hr,
            uiBufSize,
            uiSizeOrig);

        iRet = 1;
        goto exit;
    }

    // Receive the response
    //
    RqcTrace("Reading response...");
    ZeroMemory(pszResponse, sizeof(pszResponse));
    uiSizeOrig = uiBufSize = sizeof(pszResponse) - 1;
    hr = Socket.Read((BYTE*)pszResponse, &uiBufSize);
    if ((S_OK != hr) || (uiSizeOrig != uiBufSize))
    {
        RqcTrace(
            "Can't read, 0x%x, %d %d",
            hr,
            uiBufSize,
            uiSizeOrig);

        goto exit;
    }

    RqcTrace("Response: %s", pszResponse);

    if (strcmp(pszResponse, "Ok") == 0)
    {
        iRet = 0;
    }
    else if (strcmp(pszResponse, "No") == 0)
    {
        iRet = 2;
    }

exit:
    RuFree(pszUsernameAndDomain);
    RqcTrace("Closing socket...");
    Socket.Close();
    RqcTrace("Cleanup socket api...");
    RuSocket::Cleanup();

    return iRet;
}

void PrintUsage ( char * argv[] )

Definition at line 349 of file main.cpp.

{
    printf("\nRemote Access Quarantine Client\n");

    printf("\nUsage:\n\n");
    printf("%s <ConnName> <TunnelConnName> <Port> <Domain> <Username> <String>\n\n", argv[0]);
    printf("  ConnName:\t\tthe name of the RAS connection on this host\n");
    printf("  TunnelConnName:\tthe name of the RAS tunnel connection on this host\n");
    printf("  Port:\t\t\tthe port to send the quarantine string to\n");
    printf("  Domain:\t\tthe domain of the connecting user\n");
    printf("  Username:\t\tthe username of the connecting user\n");
    printf("  String:\t\tthe string to send\n");
    printf("\n");

    printf("%s /?\t\t\n\n  Display this help\n", argv[0]);
}

VOID RqcTrace | ( | IN LPSTR | pszTrace,
 |  | IN... |
 | ) |  |

Definition at line 48 of file main.cpp.

{
    va_list arglist;
    CHAR szTemp[256];

    szTemp[0] = 0;

    va_start(arglist, pszTrace);
    _vsnprintf(szTemp, sizeof(szTemp)/sizeof(szTemp[0]) - 1, pszTrace, arglist);
    va_end(arglist);

    szTemp[255] = '\0'; // make sure to NULL terminate as _vsnprintf doesn't guarantee that

    OutputDebugString(szTemp);
    OutputDebugString(TEXT("\n"));
}

Variable Documentation

RASCONN_V401_A DWORD dwSize

Definition at line 29 of file main.cpp.

DWORD dwSubEntry

Definition at line 35 of file main.cpp.

HRASCONN hrasconn

Definition at line 30 of file main.cpp.

CHAR szDeviceName[RAS_MaxDeviceName+1]

Definition at line 33 of file main.cpp.

CHAR szDeviceType[RAS_MaxDeviceType+1]

Definition at line 32 of file main.cpp.

CHAR szEntryName[RAS_MaxEntryName+1]

Definition at line 31 of file main.cpp.

CHAR szPhonebook[MAX_PATH]

Definition at line 34 of file main.cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/rqs/common/rcusync.cpp File Reference

  • NetDS
  • RRas
  • rqs
  • common

rcusync.cpp File Reference

#include "rasutil.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/rqs/common/rumem.cpp File Reference

  • NetDS
  • RRas
  • rqs
  • common
Functions

rumem.cpp File Reference

#include "RuMem.h"

Go to the source code of this file.

Functions

PVOID | RuAlloc (IN DWORD dwSize, IN BOOL fZero)
BOOL | RuFree (IN PVOID pvMem)

Function Documentation

PVOID RuAlloc | ( | IN DWORD | dwSize,
 |  | IN BOOL | fZero
 | ) |  |

Definition at line 45 of file rumem.cpp.

{
    PVOID  pvMem = NULL;

    HANDLE hHeap = GetProcessHeap();

    if ( NULL == hHeap )
    {
        return NULL;
    }

    pvMem = HeapAlloc( hHeap,
                       fZero ? HEAP_ZERO_MEMORY: 0,
                       dwSize);
    return pvMem;
}

BOOL RuFree ( IN PVOID pvMem )

Definition at line 16 of file rumem.cpp.

{
    BOOL fSuccess = FALSE;

    do
    {
        if ( NULL == pvMem )
        {
            fSuccess = FALSE;
            break;
        }

        HANDLE hHeap = GetProcessHeap();

        fSuccess = HeapFree(hHeap,
                            0,
                            pvMem);
    }
    while(FALSE);

    return fSuccess;
}

Generated on Wed Nov 13 2024 16:54:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/rqs/common/rureg.cpp File Reference

  • NetDS
  • RRas
  • rqs
  • common
Classes | Defines | Typedefs | Functions

rureg.cpp File Reference

#include "RasUtil.h"
#include <shlwapi.h>

Go to the source code of this file.

Classes

struct | _RURASREGROOT

Defines

#define | RURASREGROOTNUM RU_ELEMENT_COUNT(g_ruRegRoot)

Typedefs

typedef struct _RURASREGROOT | RURASREGROOT

Functions

VOID | RuRegFreeValues (IN CONST RUREGVALUE *pValues, IN UINT uiCount)
HRESULT | RuRegGet (IN CONST PWSTR pszKeyPath, IN OUT RUREGVALUE *pRegVal, IN DWORD dwCount)
HRESULT | RuRegOpenKey (IN CONST PWSTR pszKeyPath, IN BOOL fCreate, OUT HKEY *phKey)

Define Documentation

#define RURASREGROOTNUM RU_ELEMENT_COUNT(g_ruRegRoot)

Definition at line 51 of file rureg.cpp.

Typedef Documentation

typedef struct _RURASREGROOT RURASREGROOT

Function Documentation

VOID RuRegFreeValues | ( | IN CONST RUREGVALUE * | pValues,
 |  | IN UINT | uiCount
 | ) |  |

Definition at line 287 of file rureg.cpp.

{
    UINT i;

    for (i = 0; i < uiCount; i++)
    {
        if (pValues[i].pbData)
        {
            RuFree(pValues[i].pbData);
        }
    }
}

HRESULT RuRegGet | ( | IN CONST PWSTR | pszKeyPath,
 |  | IN OUT RUREGVALUE * | pRegVal,
 |  | IN DWORD | dwCount
 | ) |  |

Definition at line 182 of file rureg.cpp.

{
    HKEY hKey=0L;
    DWORD i, iSuccess;
    DWORD dwErr = NO_ERROR;
    HRESULT hr;

    do
    {
        if( NULL == pszKeyPath ||
            NULL == pRegVal    ||
            0 == dwCount )
        {
            hr = E_INVALIDARG;
            break;
        }

        hr = RuRegOpenKey(pszKeyPath, FALSE, &hKey);
        RU_BREAK_IF_NOT_OK(hr);

        for( i = 0; i < dwCount; i++)
        {
            pRegVal[i].dwSize = 0L;
            pRegVal[i].pbData = NULL;
        }

        iSuccess = 0;
        for ( i = 0; i < dwCount; i++ )
        {
            //Get the size of the data
            //
            pRegVal[i].pbData = NULL;
            dwErr = RegQueryValueExW(
                        hKey,
                        pRegVal[i].pszName,
                        0,
                        &pRegVal[i].dwType,
                        NULL,
                        &pRegVal[i].dwSize
                        );
            if( ERROR_SUCCESS != dwErr )
            {
                pRegVal[i].hr = HRESULT_FROM_WIN32(dwErr);
                continue;
            }

            pRegVal[i].pbData = (BYTE*)RuAlloc(pRegVal[i].dwSize,0);
            if( NULL == pRegVal[i].pbData)
            {
                pRegVal[i].hr = E_OUTOFMEMORY;
                continue;
            }

            dwErr = RegQueryValueExW(
                hKey,
                pRegVal[i].pszName,
                0,
                &pRegVal[i].dwType,
                pRegVal[i].pbData,
                &pRegVal[i].dwSize
                );

            if( ERROR_SUCCESS != dwErr)
            {
                pRegVal[i].hr = HRESULT_FROM_WIN32(dwErr);
                continue;
            }

            iSuccess++;
        }

        // If nothing was successfully read, then return the error code from
        // the first value
        //
        if (iSuccess == 0)
        {
            hr = pRegVal[0].hr;
        }
        else
        {
            hr = S_OK;
        }

    }
    while(FALSE);

    if(hKey)
    {
        RegCloseKey(hKey);
    }

    return hr;
}

HRESULT RuRegOpenKey | ( | IN CONST PWSTR | pszKeyPath,
 |  | IN BOOL | fCreate,
 |  | OUT HKEY * | phKey
 | ) |  |

Definition at line 117 of file rureg.cpp.

{
    HRESULT hr;
    HKEY hkRoot = NULL;
    PWSTR pszSubPath = NULL;

    hr = RuGetRegRootIndex(pszKeyPath, &hkRoot, &pszSubPath);
    if (hr != S_OK)
    {
        return hr;
    }

    if (fCreate)
    {
        hr = RegCreateKeyExW(
                     hkRoot,
                     pszSubPath,
                     0,
                     NULL,
                     REG_OPTION_NON_VOLATILE,
                     KEY_ALL_ACCESS,
                     NULL,
                     phKey,
                     NULL
                     );
    }
    else
    {
        hr = RegOpenKeyExW(
                    hkRoot,
                    pszSubPath,
                    0,
                    KEY_ALL_ACCESS,
                    phKey);
    }

    if( S_OK != hr )
    {
        hr = HRESULT_FROM_WIN32(hr);
    }

    return hr;
}

Generated on Wed Nov 13 2024 16:54:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/rqs/common/rusocket.cpp File Reference

  • NetDS
  • RRas
  • rqs
  • common
Classes | Typedefs | Functions

rusocket.cpp File Reference

#include "rasutil.h"
#include <winsock2.h>

Go to the source code of this file.

Classes

struct | _RU_SOCKET

Typedefs

typedef struct _RU_SOCKET | RU_SOCKET

Functions

pfnWSAEventSelectSpec LookupWSAEventSelect ()
HRESULT | RuSocketCleanup ()
HRESULT | RuSocketClose (IN HSOCKET pSocket)
HRESULT | RuSocketCreate (IN RU_SOCKET_CREATE_DATA *pCreateData, OUT HSOCKET *phSocket)
HRESULT | RuSocketCreateServer (IN RU_SOCKET_CREATE_DATA *pCreateData, OUT HSOCKET *phServerSock)
HRESULT | RuSocketGetAddress (IN HSOCKET pSocket, OUT DWORD *lpdwAddress)
HRESULT | RuSocketInit ()
HRESULT | RuSocketListen (IN HSOCKET pServer, OUT HSOCKET *phSocket)
HRESULT | RuSocketRead (IN HSOCKET pSocket, IN BYTE *pbBuffer, IN OUT UINT *lpdwBufSize)
HRESULT | RuSocketReadBlock (IN HSOCKET pSocket, IN BYTE *pbBuffer, IN OUT UINT *lpuiBufSize)
HRESULT | RuSocketReadCurrent (IN HSOCKET pSocket, IN BYTE *pbBuffer, IN OUT UINT *lpdwBufSize, OUT BOOL *pbNoMore)
HRESULT | RuSocketReadLine (IN HSOCKET pSocket, IN BYTE *pbBuffer, IN OUT UINT *lpdwBufSize)
HRESULT | RuSocketWrite (IN HSOCKET pSocket, IN BYTE *pbBuffer, IN OUT UINT *lpdwBufSize)
HRESULT | RuSocketWriteLine (IN HSOCKET pSocket, IN BYTE *pbBuffer, IN OUT UINT *lpdwBufSize)

Typedef Documentation

typedef struct _RU_SOCKET RU_SOCKET

Function Documentation

pfnWSAEventSelectSpec LookupWSAEventSelect ( )

Definition at line 22 of file rusocket.cpp.

{
    pfnWSAEventSelectSpec pfnWSAEventSelect = NULL;

    HMODULE hWinsock2 = GetModuleHandle(TEXT("ws2_32.dll"));

    if (hWinsock2)
    {
        pfnWSAEventSelect = (pfnWSAEventSelectSpec)GetProcAddress(hWinsock2, "WSAEventSelect");
    }

    return pfnWSAEventSelect;
}

HRESULT RuSocketCleanup ( )

Definition at line 75 of file rusocket.cpp.

{
    INT iErr;

    iErr = WSACleanup();
    if (iErr != 0)
    {
        return HRESULT_FROM_WIN32(WSAGetLastError());
    }

    return S_OK;
}

HRESULT RuSocketClose ( IN HSOCKET pSocket )

Definition at line 357 of file rusocket.cpp.

{
    // Validate
    //
    if (! pSocket)
    {
        return E_INVALIDARG;
    }

    // Close the socket
    //
    closesocket (pSocket->Socket);

    // Free
    //
    RuFree (pSocket);

    return S_OK;
}

HRESULT RuSocketCreate | ( | IN RU_SOCKET_CREATE_DATA * | pCreateData,
 |  | OUT HSOCKET * | phSocket
 | ) |  |

Definition at line 94 of file rusocket.cpp.

{
    u_short uPort = (u_short)pCreateData->uiPort;
    RU_SOCKET* pSocket = NULL;
    struct hostent * pHost;
    SOCKADDR_IN sin, bindsin;
    SOCKET Socket;
    DWORD dwAddress, dwAddressS;
    HRESULT hr = S_OK;
    BOOL bOk = FALSE;
    INT iErr;

    // Lookup the host
    //
    pHost = gethostbyname (pCreateData->pszDest);
    if (pHost)
    {
        dwAddress = (DWORD)(*((DWORD*)(pHost->h_addr_list[0])));
    }
    else
    {
        dwAddress = inet_addr (pCreateData->pszDest);
    }

    dwAddressS = INADDR_ANY;
    if (pCreateData->pszSrc)
    {
        dwAddressS = inet_addr (pCreateData->pszSrc);
    }

    // Initialize the address
    //
    sin.sin_family = AF_INET;
    sin.sin_addr.s_addr = dwAddress;
    sin.sin_port = htons (uPort);

    // Initialize the binding information
    //
    bindsin.sin_family = AF_INET;
    bindsin.sin_addr.s_addr = dwAddressS;
    bindsin.sin_port = 0;

    // Initailiaze the return value
    //
    *phSocket = NULL;
    pSocket = (RU_SOCKET*) RuAlloc(sizeof(RU_SOCKET), TRUE);
    if (! pSocket)
    {
        return E_OUTOFMEMORY;
    }
    pSocket->uiSize = sizeof(pSocket->addr);

    __try
    {
        // Create a new socket
        //
        Socket = socket (PF_INET, SOCK_STREAM, 0);
        if (Socket == INVALID_SOCKET)
        {
            hr = HRESULT_FROM_WIN32(WSAGetLastError());
            __leave;
        }

        // Bind the socket to the given port
        //
        iErr = bind(Socket, (LPSOCKADDR)&bindsin, sizeof(bindsin));
        if (iErr != 0)
        {
            hr = HRESULT_FROM_WIN32(WSAGetLastError());
            __leave;
        }

        // Connect to the remote machine
        //
        iErr = connect(Socket, (LPSOCKADDR)&sin, sizeof(sin));
        if (iErr != 0)
        {
            hr = HRESULT_FROM_WIN32(WSAGetLastError());
            __leave;
        }

        pSocket->Socket = Socket;
        bOk = TRUE;

    }

    __finally
    {
        if (! bOk)
        {
            RuFree (pSocket);
            pSocket = NULL;
        }
    }

    // Set the return value
    *phSocket = pSocket;

    return hr;
}

HRESULT RuSocketCreateServer | ( | IN RU_SOCKET_CREATE_DATA * | pCreateData,
 |  | OUT HSOCKET * | phServerSock
 | ) |  |

Definition at line 203 of file rusocket.cpp.

{
    RU_SOCKET* pSocket = NULL;
    SOCKADDR_IN sin;
    SOCKET Socket;
    BOOL bOk = FALSE;
    INT iErr;
    HRESULT hr = S_OK;
    DWORD dwAddress;

    // Initialize the addr
    //
    sin.sin_family = AF_INET;
    sin.sin_addr.s_addr = 0;
    sin.sin_port = htons ((USHORT)pCreateData->uiPort);

    // Initailiaze the return value
    //
    *phServerSock = NULL;
    pSocket = (RU_SOCKET*) RuAlloc(sizeof(RU_SOCKET), TRUE);
    if (! pSocket)
    {
        return E_OUTOFMEMORY;
    }
    pSocket->uiSize = sizeof(pSocket->addr);

    __try
    {
        if (pCreateData->pszDest)
        {
            dwAddress = inet_addr (pCreateData->pszDest);
            sin.sin_addr.s_addr = dwAddress;
        }

        // Create a new socket
        //
        Socket = socket (PF_INET, SOCK_STREAM, 0);
        if (Socket == INVALID_SOCKET)
        {
            hr = HRESULT_FROM_WIN32(WSAGetLastError());
            __leave;
        }

        // Bind the socket to the given port
        //
        iErr = bind(Socket, (LPSOCKADDR)&sin, sizeof(sin));
        if (iErr != 0)
        {
            hr = HRESULT_FROM_WIN32(WSAGetLastError());
            __leave;
        }

        // Listen
        //
        iErr = listen (Socket, SOMAXCONN);
        if (iErr != 0)
        {
            hr = HRESULT_FROM_WIN32(WSAGetLastError());
            __leave;
        }

        pSocket->Socket = Socket;
        bOk = TRUE;

    }

    __finally
    {
        if (! bOk)
        {
            RuFree (pSocket);
            pSocket = NULL;
        }
    }

    // Set the return value
    //
    *phServerSock = pSocket;

    return hr;

}

HRESULT RuSocketGetAddress | ( | IN HSOCKET | pSocket,
 |  | OUT DWORD * | lpdwAddress
 | ) |  |

Definition at line 667 of file rusocket.cpp.

{
    struct sockaddr_in* pData = (struct sockaddr_in*)&(pSocket->addr);
    *lpdwAddress = *((DWORD*)&(pData->sin_addr));

    return S_OK;
}

HRESULT RuSocketInit ( )

Definition at line 55 of file rusocket.cpp.

{
    INT iErr;
    WSADATA wsaData;

    iErr = WSAStartup (MAKEWORD(2, 0), &wsaData);
    if (iErr != 0)
    {
        return HRESULT_FROM_WIN32(iErr);
    }

    return S_OK;
}

HRESULT RuSocketListen | ( | IN HSOCKET | pServer,
 |  | OUT HSOCKET * | phSocket
 | ) |  |

Definition at line 295 of file rusocket.cpp.

{
    RU_SOCKET* pClient = NULL;
    HRESULT hr = S_OK;

    if (! pServer)
    {
        return E_INVALIDARG;
    }

    // Initailiaze the return value
    //
    *phSocket = NULL;
    pClient = (RU_SOCKET*) RuAlloc(sizeof(RU_SOCKET), TRUE);
    if (! pClient)
    {
        return E_OUTOFMEMORY;
    }
    pClient->uiSize = sizeof(pClient->addr);

    __try
    {
        // Accept the connection
        //
        pClient->Socket = accept (
                            pServer->Socket,
                            &(pClient->addr),
                            (INT*)&(pClient->uiSize));
        if (pClient->Socket == INVALID_SOCKET)
        {
            hr = HRESULT_FROM_WIN32(WSAGetLastError());
            __leave;
        }

        // Assign the return value
        //
        *phSocket = pClient;

    }

    __finally
    {
        if (hr != S_OK)
        {
            if (pClient)
            {
                RuFree(pClient);
            }
        }
    }

    return hr;
}

HRESULT RuSocketRead | ( | IN HSOCKET | pSocket,
 |  | IN BYTE * | pbBuffer,
 |  | IN OUT UINT * | lpdwBufSize
 | ) |  |

Definition at line 384 of file rusocket.cpp.

{
    INT iRet;

    // Validate
    //
    if (! pSocket)
    {
        return E_INVALIDARG;
    }

    // Read from the socket
    //
    iRet = recv (pSocket->Socket, (CHAR*)pbBuffer, *lpdwBufSize, 0);
    if (iRet == SOCKET_ERROR)
    {
        return HRESULT_FROM_WIN32(WSAGetLastError());
    }

    // Record the bytes read
    //
    *lpdwBufSize = iRet;

    return S_OK;
}

HRESULT RuSocketReadBlock | ( | IN HSOCKET | pSocket,
 |  | IN BYTE * | pbBuffer,
 |  | IN OUT UINT * | lpuiBufSize
 | ) |  |

Definition at line 419 of file rusocket.cpp.

{
    HRESULT hr;
    INT iRet;
    fd_set fdSet;

    hr = RuSocketRead(pSocket, pbBuffer, lpuiBufSize);
    if (S_OK == hr)
    {
        return hr;
    }
    else if (HRESULT_FROM_WIN32(WSAEWOULDBLOCK) == hr)
    {
        ZeroMemory(&fdSet, sizeof(fdSet));
        FD_SET(pSocket->Socket, &fdSet);

        // Block until there is read data
        //
        iRet = select(0, &fdSet, NULL, NULL, NULL);
        if (iRet == SOCKET_ERROR)
        {
            return HRESULT_FROM_WIN32(WSAGetLastError());
        }

        // Read the data that has arrived
        //
        hr = RuSocketRead(pSocket, pbBuffer, lpuiBufSize);
    }

    return hr;
}

HRESULT RuSocketReadCurrent | ( | IN HSOCKET | pSocket,
 |  | IN BYTE * | pbBuffer,
 |  | IN OUT UINT * | lpdwBufSize,
 |  | OUT BOOL * | pbNoMore
 | ) |  |

Definition at line 466 of file rusocket.cpp.

{
    HRESULT hr = S_OK;
    fd_set fdSet;
    int iRet;
    struct timeval timeout;

    // Initialize the socket set
    //
    ZeroMemory(&fdSet, sizeof(fdSet));
    FD_SET(pSocket->Socket, &fdSet);

    // Initialize the timeout
    //
    ZeroMemory(&timeout, sizeof(timeout));
    timeout.tv_sec = 0;
    timeout.tv_usec = 1000;

    // Get the read status of the socket
    //
    iRet = select(0, &fdSet, NULL, NULL, &timeout);

    // Error
    //
    if (iRet == SOCKET_ERROR)
    {
        return HRESULT_FROM_WIN32(WSAGetLastError());
    }

    // Timeout -- there is nothing to read
    //
    if (iRet == 0)
    {
        *pbNoMore = TRUE;
        return S_OK;
    }

    // There's something to read
    //
    *pbNoMore = FALSE;
    return RuSocketRead(pSocket, pbBuffer, lpdwBufSize);

}

HRESULT RuSocketReadLine | ( | IN HSOCKET | pSocket,
 |  | IN BYTE * | pbBuffer,
 |  | IN OUT UINT * | lpdwBufSize
 | ) |  |

Definition at line 520 of file rusocket.cpp.

{
    HRESULT dwMaxSize = *lpdwBufSize, i = 0;
    INT iRet;
    BYTE bCur = '\n';
    HRESULT hr = S_OK;

    // Validate
    //
    if (! pSocket)
    {
        return E_INVALIDARG;
    }

    while (i < dwMaxSize)
    {
        iRet = recv (pSocket->Socket, (CHAR*)&bCur, 1, 0);
        if (iRet == SOCKET_ERROR)
        {
            return HRESULT_FROM_WIN32(WSAGetLastError());
        }
        else if (iRet == 0)
        {
            hr = HRESULT_FROM_WIN32(ERROR_HANDLE_EOF);
            break;
        }
        if (bCur == '\r')
        {
            continue;
        }
        if (bCur == '\n')
        {
            break;
        }
        *pbBuffer = bCur;
        pbBuffer++;
        i++;
    }

    *pbBuffer = 0;
    if (i > 0)
    {
        i++;
    }

    // Record the bytes read
    //
    *lpdwBufSize = i;

    return hr;
}

HRESULT RuSocketWrite | ( | IN HSOCKET | pSocket,
 |  | IN BYTE * | pbBuffer,
 |  | IN OUT UINT * | lpdwBufSize
 | ) |  |

Definition at line 581 of file rusocket.cpp.

{
    INT iRet;

    // Validate
    //
    if (! pSocket)
    {
        return E_INVALIDARG;
    }

    // Read from the socket
    //
    iRet = send (pSocket->Socket, (const CHAR*)pbBuffer, *lpdwBufSize, 0);
    if (iRet == SOCKET_ERROR)
    {
        return HRESULT_FROM_WIN32(WSAGetLastError());
    }

    // Record the bytes read
    //
    *lpdwBufSize = iRet;

    return S_OK;
}

HRESULT RuSocketWriteLine | ( | IN HSOCKET | pSocket,
 |  | IN BYTE * | pbBuffer,
 |  | IN OUT UINT * | lpdwBufSize
 | ) |  |

Definition at line 617 of file rusocket.cpp.

{
    DWORD dwMaxSize = *lpdwBufSize, i = 0, uiSize;
    INT iRet;
    BYTE bCur = 0;

    // Validate
    //
    if (! pSocket)
    {
        return E_INVALIDARG;
    }

    // Send on the socket
    //
    while ((i < dwMaxSize) && (bCur != '\r') && (bCur != '\n'))
    {
        uiSize = sizeof(bCur);
        bCur = *pbBuffer;
        iRet = send (pSocket->Socket, (CHAR*)&bCur, 1, 0);
        if (iRet == SOCKET_ERROR)
        {
            return HRESULT_FROM_WIN32(WSAGetLastError());
        }
        pbBuffer++;
        i++;
    }

    // Send the newline
    //
    send (pSocket->Socket, "\r\n", 2, 0);

    // Record the bytes read
    //
    *lpdwBufSize = i;

    return S_OK;
}

Generated on Wed Nov 13 2024 16:54:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/rqs/common/rustring.cpp File Reference

  • NetDS
  • RRas
  • rqs
  • common
Functions

rustring.cpp File Reference

#include "rasutil.h"
#include "RuString.h"

Go to the source code of this file.

Functions

PWSTR | RuStringDupAtoW (IN PSTR pszansi)
PSTR | RuStringDupWtoA (IN PWSTR psz)

Function Documentation

PWSTR RuStringDupAtoW ( IN PSTR pszansi )

Definition at line 99 of file rustring.cpp.

{
    PWSTR psz = NULL;
    HRESULT hr = RuStringNarrowToWideInternal(pszansi, CP_ACP, &psz, 0);
    return ((hr == S_OK) ? psz : NULL);
}

PSTR RuStringDupWtoA ( IN PWSTR psz )

Definition at line 53 of file rustring.cpp.

{
    PSTR    pszansi = NULL;
    HRESULT hr = RuStringWideToNarrowInternal(psz, &pszansi, 0, CP_ACP);
    return ((hr == S_OK) ? pszansi : NULL);
}

Generated on Wed Nov 13 2024 16:54:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/rqs/inc/rasutil.h File Reference

  • NetDS
  • RRas
  • rqs
  • inc
Defines

rasutil.h File Reference

#include "RuSocket.h"
#include "RuMem.h"
#include "RuReg.h"
#include "RuString.h"
#include "RcuSync.h"

Go to the source code of this file.

Defines

#define | RU_BREAK_HR_IF_NULL(x, ret) if ( NULL == (x) ) { hr = (ret); break; }
#define | RU_BREAK_IF_NOT_OK(x) if (S_OK != (x)) break;
#define | RU_BREAK_IF_NULL(x) if ( NULL == (x)) break;
#define | RU_ELEMENT_COUNT(x) ( sizeof( x ) / sizeof( *x ) )
#define | RU_LEAVE_HR_IF_NULL(x, ret) if ( NULL == (x) ) { hr = (ret); __leave; }
#define | RU_LEAVE_IF_NOT_OK(x) if ( S_OK != (x)) __leave;
#define | RU_LEAVE_IF_NULL(x) if ( NULL == (x)) __leave;
#define | RU_RETURN_IF_NOT_OK(x) if ( S_OK != (x)) return (x);
#define | RU_RETURN_IF_NULL_PARAM(x) if ( NULL == (x) ) return E_INVALIDARG;
#define | S_RU_EQUALS ((HRESULT)0x000abc01L)
#define | S_RU_GREATER ((HRESULT)0x000abc02L)
#define | S_RU_LESS ((HRESULT)0x000abc03L)

Define Documentation

#define RU_BREAK_HR_IF_NULL | ( | x,
 |  | ret |
 | ) |  | if ( NULL == (x) ) { hr = (ret); break; }

Definition at line 35 of file rasutil.h.

#define RU_BREAK_IF_NOT_OK ( x ) if (S_OK != (x)) break;

Definition at line 33 of file rasutil.h.

#define RU_BREAK_IF_NULL ( x ) if ( NULL == (x)) break;

Definition at line 34 of file rasutil.h.

#define RU_ELEMENT_COUNT ( x ) ( sizeof( x ) / sizeof( *x ) )

Definition at line 24 of file rasutil.h.

#define RU_LEAVE_HR_IF_NULL | ( | x,
 |  | ret |
 | ) |  | if ( NULL == (x) ) { hr = (ret); __leave; }

Definition at line 28 of file rasutil.h.

#define RU_LEAVE_IF_NOT_OK ( x ) if ( S_OK != (x)) __leave;

Definition at line 26 of file rasutil.h.

#define RU_LEAVE_IF_NULL ( x ) if ( NULL == (x)) __leave;

Definition at line 27 of file rasutil.h.

#define RU_RETURN_IF_NOT_OK ( x ) if ( S_OK != (x)) return (x);

Definition at line 30 of file rasutil.h.

#define RU_RETURN_IF_NULL_PARAM ( x ) if ( NULL == (x) ) return E_INVALIDARG;

Definition at line 31 of file rasutil.h.

#define S_RU_EQUALS ((HRESULT)0x000abc01L)

Definition at line 37 of file rasutil.h.

#define S_RU_GREATER ((HRESULT)0x000abc02L)

Definition at line 38 of file rasutil.h.

#define S_RU_LESS ((HRESULT)0x000abc03L)

Definition at line 39 of file rasutil.h.

Generated on Wed Nov 13 2024 16:54:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/rqs/inc/rcusync.h File Reference

  • NetDS
  • RRas
  • rqs
  • inc

rcusync.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/rqs/inc/rumem.h File Reference

  • NetDS
  • RRas
  • rqs
  • inc
Functions

rumem.h File Reference

#include "RasUtil.h"

Go to the source code of this file.

Functions

PVOID | RuAlloc (IN DWORD dwSize, IN BOOL fZero)
BOOL | RuFree (IN PVOID pvMem)

Function Documentation

PVOID RuAlloc | ( | IN DWORD | dwSize,
 |  | IN BOOL | fZero
 | ) |  |

Definition at line 45 of file rumem.cpp.

{
    PVOID  pvMem = NULL;

    HANDLE hHeap = GetProcessHeap();

    if ( NULL == hHeap )
    {
        return NULL;
    }

    pvMem = HeapAlloc( hHeap,
                       fZero ? HEAP_ZERO_MEMORY: 0,
                       dwSize);
    return pvMem;
}

BOOL RuFree ( IN PVOID pvMem )

Definition at line 16 of file rumem.cpp.

{
    BOOL fSuccess = FALSE;

    do
    {
        if ( NULL == pvMem )
        {
            fSuccess = FALSE;
            break;
        }

        HANDLE hHeap = GetProcessHeap();

        fSuccess = HeapFree(hHeap,
                            0,
                            pvMem);
    }
    while(FALSE);

    return fSuccess;
}

Generated on Wed Nov 13 2024 16:54:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/rqs/inc/rureg.h File Reference

  • NetDS
  • RRas
  • rqs
  • inc
Classes | Typedefs | Functions

rureg.h File Reference

#include "RasUtil.h"

Go to the source code of this file.

Classes

struct | _RUREGVALUE

Typedefs

typedef struct _RUREGVALUE * | PRUREGVALUE
typedef struct _RUREGVALUE | RUREGVALUE

Functions

VOID | RuRegFreeValues (IN CONST RUREGVALUE *pValues, IN UINT uiCount)
HRESULT | RuRegGet (IN CONST PWSTR pszKeyPath, IN OUT RUREGVALUE *pRegVal, IN DWORD dwCount)
HRESULT | RuRegOpenKey (IN CONST PWSTR pszKeyPath, IN BOOL fCreate, OUT HKEY *phKey)

Typedef Documentation

typedef struct _RUREGVALUE * PRUREGVALUE
typedef struct _RUREGVALUE RUREGVALUE

Function Documentation

VOID RuRegFreeValues | ( | IN CONST RUREGVALUE * | pValues,
 |  | IN UINT | uiCount
 | ) |  |

Definition at line 287 of file rureg.cpp.

{
    UINT i;

    for (i = 0; i < uiCount; i++)
    {
        if (pValues[i].pbData)
        {
            RuFree(pValues[i].pbData);
        }
    }
}

HRESULT RuRegGet | ( | IN CONST PWSTR | pszKeyPath,
 |  | IN OUT RUREGVALUE * | pRegVal,
 |  | IN DWORD | dwCount
 | ) |  |

Definition at line 182 of file rureg.cpp.

{
    HKEY hKey=0L;
    DWORD i, iSuccess;
    DWORD dwErr = NO_ERROR;
    HRESULT hr;

    do
    {
        if( NULL == pszKeyPath ||
            NULL == pRegVal    ||
            0 == dwCount )
        {
            hr = E_INVALIDARG;
            break;
        }

        hr = RuRegOpenKey(pszKeyPath, FALSE, &hKey);
        RU_BREAK_IF_NOT_OK(hr);

        for( i = 0; i < dwCount; i++)
        {
            pRegVal[i].dwSize = 0L;
            pRegVal[i].pbData = NULL;
        }

        iSuccess = 0;
        for ( i = 0; i < dwCount; i++ )
        {
            //Get the size of the data
            //
            pRegVal[i].pbData = NULL;
            dwErr = RegQueryValueExW(
                        hKey,
                        pRegVal[i].pszName,
                        0,
                        &pRegVal[i].dwType,
                        NULL,
                        &pRegVal[i].dwSize
                        );
            if( ERROR_SUCCESS != dwErr )
            {
                pRegVal[i].hr = HRESULT_FROM_WIN32(dwErr);
                continue;
            }

            pRegVal[i].pbData = (BYTE*)RuAlloc(pRegVal[i].dwSize,0);
            if( NULL == pRegVal[i].pbData)
            {
                pRegVal[i].hr = E_OUTOFMEMORY;
                continue;
            }

            dwErr = RegQueryValueExW(
                hKey,
                pRegVal[i].pszName,
                0,
                &pRegVal[i].dwType,
                pRegVal[i].pbData,
                &pRegVal[i].dwSize
                );

            if( ERROR_SUCCESS != dwErr)
            {
                pRegVal[i].hr = HRESULT_FROM_WIN32(dwErr);
                continue;
            }

            iSuccess++;
        }

        // If nothing was successfully read, then return the error code from
        // the first value
        //
        if (iSuccess == 0)
        {
            hr = pRegVal[0].hr;
        }
        else
        {
            hr = S_OK;
        }

    }
    while(FALSE);

    if(hKey)
    {
        RegCloseKey(hKey);
    }

    return hr;
}

HRESULT RuRegOpenKey | ( | IN CONST PWSTR | pszKeyPath,
 |  | IN BOOL | fCreate,
 |  | OUT HKEY * | phKey
 | ) |  |

Definition at line 117 of file rureg.cpp.

{
    HRESULT hr;
    HKEY hkRoot = NULL;
    PWSTR pszSubPath = NULL;

    hr = RuGetRegRootIndex(pszKeyPath, &hkRoot, &pszSubPath);
    if (hr != S_OK)
    {
        return hr;
    }

    if (fCreate)
    {
        hr = RegCreateKeyExW(
                     hkRoot,
                     pszSubPath,
                     0,
                     NULL,
                     REG_OPTION_NON_VOLATILE,
                     KEY_ALL_ACCESS,
                     NULL,
                     phKey,
                     NULL
                     );
    }
    else
    {
        hr = RegOpenKeyExW(
                    hkRoot,
                    pszSubPath,
                    0,
                    KEY_ALL_ACCESS,
                    phKey);
    }

    if( S_OK != hr )
    {
        hr = HRESULT_FROM_WIN32(hr);
    }

    return hr;
}

Generated on Wed Nov 13 2024 16:54:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/rqs/inc/rusocket.h File Reference

  • NetDS
  • RRas
  • rqs
  • inc
Classes | Typedefs | Functions

rusocket.h File Reference

#include <winsock2.h>

Go to the source code of this file.

Classes

struct | _RU_SOCKET_CREATE_DATA

Typedefs

typedef struct _RU_SOCKET * | HSOCKET
typedef int(WINAPI * | pfnWSAEventSelectSpec )(SOCKET, WSAEVENT, long)
typedef struct
_RU_SOCKET_CREATE_DATA 		RU_SOCKET_CREATE_DATA

Functions

pfnWSAEventSelectSpec LookupWSAEventSelect ()
HRESULT | RuSocketCleanup ()
HRESULT | RuSocketClose (IN HSOCKET IN phSocket)
HRESULT | RuSocketCreate (IN RU_SOCKET_CREATE_DATA *pCreateData, OUT HSOCKET *phSocket)
HRESULT | RuSocketCreateServer (IN RU_SOCKET_CREATE_DATA *pCreateData, OUT HSOCKET *phServerSock)
HRESULT | RuSocketGetAddress (IN HSOCKET hSocket, OUT DWORD *lpdwAddress)
HRESULT | RuSocketInit ()
HRESULT | RuSocketListen (IN HSOCKET hServerSock, OUT HSOCKET *phSocket)
HRESULT | RuSocketRead (IN HSOCKET hSocket, IN BYTE *pbBuffer, IN OUT UINT *lpuiBufSize)
HRESULT | RuSocketReadBlock (IN HSOCKET hSocket, IN BYTE *pbBuffer, IN OUT UINT *lpuiBufSize)
HRESULT | RuSocketReadCurrent (IN HSOCKET hSocket, IN BYTE *pbBuffer, IN OUT UINT *lpuiBufSize, OUT BOOL *pbNoMore)
HRESULT | RuSocketReadLine (IN HSOCKET hSocket, IN BYTE *pbBuffer, IN OUT UINT *lpuiBufSize)
HRESULT | RuSocketWrite (IN HSOCKET hSocket, IN BYTE *pbBuffer, IN OUT UINT *lpuiBufSize)
HRESULT | RuSocketWriteLine (IN HSOCKET hSocket, IN BYTE *pbBuffer, IN OUT UINT *lpuiBufSize)

Typedef Documentation

typedef struct _RU_SOCKET* HSOCKET

Definition at line 26 of file rusocket.h.

typedef int(WINAPI * pfnWSAEventSelectSpec)(SOCKET, WSAEVENT, long)

Definition at line 22 of file rusocket.h.

typedef struct _RU_SOCKET_CREATE_DATA RU_SOCKET_CREATE_DATA

Function Documentation

pfnWSAEventSelectSpec LookupWSAEventSelect ( )

Definition at line 22 of file rusocket.cpp.

{
    pfnWSAEventSelectSpec pfnWSAEventSelect = NULL;

    HMODULE hWinsock2 = GetModuleHandle(TEXT("ws2_32.dll"));

    if (hWinsock2)
    {
        pfnWSAEventSelect = (pfnWSAEventSelectSpec)GetProcAddress(hWinsock2, "WSAEventSelect");
    }

    return pfnWSAEventSelect;
}

HRESULT RuSocketCleanup ( )

Definition at line 75 of file rusocket.cpp.

{
    INT iErr;

    iErr = WSACleanup();
    if (iErr != 0)
    {
        return HRESULT_FROM_WIN32(WSAGetLastError());
    }

    return S_OK;
}

HRESULT RuSocketClose ( IN HSOCKET IN phSocket )
HRESULT RuSocketCreate | ( | IN RU_SOCKET_CREATE_DATA * | pCreateData,
 |  | OUT HSOCKET * | phSocket
 | ) |  |

Definition at line 94 of file rusocket.cpp.

{
    u_short uPort = (u_short)pCreateData->uiPort;
    RU_SOCKET* pSocket = NULL;
    struct hostent * pHost;
    SOCKADDR_IN sin, bindsin;
    SOCKET Socket;
    DWORD dwAddress, dwAddressS;
    HRESULT hr = S_OK;
    BOOL bOk = FALSE;
    INT iErr;

    // Lookup the host
    //
    pHost = gethostbyname (pCreateData->pszDest);
    if (pHost)
    {
        dwAddress = (DWORD)(*((DWORD*)(pHost->h_addr_list[0])));
    }
    else
    {
        dwAddress = inet_addr (pCreateData->pszDest);
    }

    dwAddressS = INADDR_ANY;
    if (pCreateData->pszSrc)
    {
        dwAddressS = inet_addr (pCreateData->pszSrc);
    }

    // Initialize the address
    //
    sin.sin_family = AF_INET;
    sin.sin_addr.s_addr = dwAddress;
    sin.sin_port = htons (uPort);

    // Initialize the binding information
    //
    bindsin.sin_family = AF_INET;
    bindsin.sin_addr.s_addr = dwAddressS;
    bindsin.sin_port = 0;

    // Initailiaze the return value
    //
    *phSocket = NULL;
    pSocket = (RU_SOCKET*) RuAlloc(sizeof(RU_SOCKET), TRUE);
    if (! pSocket)
    {
        return E_OUTOFMEMORY;
    }
    pSocket->uiSize = sizeof(pSocket->addr);

    __try
    {
        // Create a new socket
        //
        Socket = socket (PF_INET, SOCK_STREAM, 0);
        if (Socket == INVALID_SOCKET)
        {
            hr = HRESULT_FROM_WIN32(WSAGetLastError());
            __leave;
        }

        // Bind the socket to the given port
        //
        iErr = bind(Socket, (LPSOCKADDR)&bindsin, sizeof(bindsin));
        if (iErr != 0)
        {
            hr = HRESULT_FROM_WIN32(WSAGetLastError());
            __leave;
        }

        // Connect to the remote machine
        //
        iErr = connect(Socket, (LPSOCKADDR)&sin, sizeof(sin));
        if (iErr != 0)
        {
            hr = HRESULT_FROM_WIN32(WSAGetLastError());
            __leave;
        }

        pSocket->Socket = Socket;
        bOk = TRUE;

    }

    __finally
    {
        if (! bOk)
        {
            RuFree (pSocket);
            pSocket = NULL;
        }
    }

    // Set the return value
    *phSocket = pSocket;

    return hr;
}

HRESULT RuSocketCreateServer | ( | IN RU_SOCKET_CREATE_DATA * | pCreateData,
 |  | OUT HSOCKET * | phServerSock
 | ) |  |

Definition at line 203 of file rusocket.cpp.

{
    RU_SOCKET* pSocket = NULL;
    SOCKADDR_IN sin;
    SOCKET Socket;
    BOOL bOk = FALSE;
    INT iErr;
    HRESULT hr = S_OK;
    DWORD dwAddress;

    // Initialize the addr
    //
    sin.sin_family = AF_INET;
    sin.sin_addr.s_addr = 0;
    sin.sin_port = htons ((USHORT)pCreateData->uiPort);

    // Initailiaze the return value
    //
    *phServerSock = NULL;
    pSocket = (RU_SOCKET*) RuAlloc(sizeof(RU_SOCKET), TRUE);
    if (! pSocket)
    {
        return E_OUTOFMEMORY;
    }
    pSocket->uiSize = sizeof(pSocket->addr);

    __try
    {
        if (pCreateData->pszDest)
        {
            dwAddress = inet_addr (pCreateData->pszDest);
            sin.sin_addr.s_addr = dwAddress;
        }

        // Create a new socket
        //
        Socket = socket (PF_INET, SOCK_STREAM, 0);
        if (Socket == INVALID_SOCKET)
        {
            hr = HRESULT_FROM_WIN32(WSAGetLastError());
            __leave;
        }

        // Bind the socket to the given port
        //
        iErr = bind(Socket, (LPSOCKADDR)&sin, sizeof(sin));
        if (iErr != 0)
        {
            hr = HRESULT_FROM_WIN32(WSAGetLastError());
            __leave;
        }

        // Listen
        //
        iErr = listen (Socket, SOMAXCONN);
        if (iErr != 0)
        {
            hr = HRESULT_FROM_WIN32(WSAGetLastError());
            __leave;
        }

        pSocket->Socket = Socket;
        bOk = TRUE;

    }

    __finally
    {
        if (! bOk)
        {
            RuFree (pSocket);
            pSocket = NULL;
        }
    }

    // Set the return value
    //
    *phServerSock = pSocket;

    return hr;

}

HRESULT RuSocketGetAddress | ( | IN HSOCKET | hSocket,
 |  | OUT DWORD * | lpdwAddress
 | ) |  |

Definition at line 667 of file rusocket.cpp.

{
    struct sockaddr_in* pData = (struct sockaddr_in*)&(pSocket->addr);
    *lpdwAddress = *((DWORD*)&(pData->sin_addr));

    return S_OK;
}

HRESULT RuSocketInit ( )

Definition at line 55 of file rusocket.cpp.

{
    INT iErr;
    WSADATA wsaData;

    iErr = WSAStartup (MAKEWORD(2, 0), &wsaData);
    if (iErr != 0)
    {
        return HRESULT_FROM_WIN32(iErr);
    }

    return S_OK;
}

HRESULT RuSocketListen | ( | IN HSOCKET | hServerSock,
 |  | OUT HSOCKET * | phSocket
 | ) |  |

Definition at line 295 of file rusocket.cpp.

{
    RU_SOCKET* pClient = NULL;
    HRESULT hr = S_OK;

    if (! pServer)
    {
        return E_INVALIDARG;
    }

    // Initailiaze the return value
    //
    *phSocket = NULL;
    pClient = (RU_SOCKET*) RuAlloc(sizeof(RU_SOCKET), TRUE);
    if (! pClient)
    {
        return E_OUTOFMEMORY;
    }
    pClient->uiSize = sizeof(pClient->addr);

    __try
    {
        // Accept the connection
        //
        pClient->Socket = accept (
                            pServer->Socket,
                            &(pClient->addr),
                            (INT*)&(pClient->uiSize));
        if (pClient->Socket == INVALID_SOCKET)
        {
            hr = HRESULT_FROM_WIN32(WSAGetLastError());
            __leave;
        }

        // Assign the return value
        //
        *phSocket = pClient;

    }

    __finally
    {
        if (hr != S_OK)
        {
            if (pClient)
            {
                RuFree(pClient);
            }
        }
    }

    return hr;
}

HRESULT RuSocketRead | ( | IN HSOCKET | hSocket,
 |  | IN BYTE * | pbBuffer,
 |  | IN OUT UINT * | lpuiBufSize
 | ) |  |

Definition at line 384 of file rusocket.cpp.

{
    INT iRet;

    // Validate
    //
    if (! pSocket)
    {
        return E_INVALIDARG;
    }

    // Read from the socket
    //
    iRet = recv (pSocket->Socket, (CHAR*)pbBuffer, *lpdwBufSize, 0);
    if (iRet == SOCKET_ERROR)
    {
        return HRESULT_FROM_WIN32(WSAGetLastError());
    }

    // Record the bytes read
    //
    *lpdwBufSize = iRet;

    return S_OK;
}

HRESULT RuSocketReadBlock | ( | IN HSOCKET | hSocket,
 |  | IN BYTE * | pbBuffer,
 |  | IN OUT UINT * | lpuiBufSize
 | ) |  |

Definition at line 419 of file rusocket.cpp.

{
    HRESULT hr;
    INT iRet;
    fd_set fdSet;

    hr = RuSocketRead(pSocket, pbBuffer, lpuiBufSize);
    if (S_OK == hr)
    {
        return hr;
    }
    else if (HRESULT_FROM_WIN32(WSAEWOULDBLOCK) == hr)
    {
        ZeroMemory(&fdSet, sizeof(fdSet));
        FD_SET(pSocket->Socket, &fdSet);

        // Block until there is read data
        //
        iRet = select(0, &fdSet, NULL, NULL, NULL);
        if (iRet == SOCKET_ERROR)
        {
            return HRESULT_FROM_WIN32(WSAGetLastError());
        }

        // Read the data that has arrived
        //
        hr = RuSocketRead(pSocket, pbBuffer, lpuiBufSize);
    }

    return hr;
}

HRESULT RuSocketReadCurrent | ( | IN HSOCKET | hSocket,
 |  | IN BYTE * | pbBuffer,
 |  | IN OUT UINT * | lpuiBufSize,
 |  | OUT BOOL * | pbNoMore
 | ) |  |

Definition at line 466 of file rusocket.cpp.

{
    HRESULT hr = S_OK;
    fd_set fdSet;
    int iRet;
    struct timeval timeout;

    // Initialize the socket set
    //
    ZeroMemory(&fdSet, sizeof(fdSet));
    FD_SET(pSocket->Socket, &fdSet);

    // Initialize the timeout
    //
    ZeroMemory(&timeout, sizeof(timeout));
    timeout.tv_sec = 0;
    timeout.tv_usec = 1000;

    // Get the read status of the socket
    //
    iRet = select(0, &fdSet, NULL, NULL, &timeout);

    // Error
    //
    if (iRet == SOCKET_ERROR)
    {
        return HRESULT_FROM_WIN32(WSAGetLastError());
    }

    // Timeout -- there is nothing to read
    //
    if (iRet == 0)
    {
        *pbNoMore = TRUE;
        return S_OK;
    }

    // There's something to read
    //
    *pbNoMore = FALSE;
    return RuSocketRead(pSocket, pbBuffer, lpdwBufSize);

}

HRESULT RuSocketReadLine | ( | IN HSOCKET | hSocket,
 |  | IN BYTE * | pbBuffer,
 |  | IN OUT UINT * | lpuiBufSize
 | ) |  |

Definition at line 520 of file rusocket.cpp.

{
    HRESULT dwMaxSize = *lpdwBufSize, i = 0;
    INT iRet;
    BYTE bCur = '\n';
    HRESULT hr = S_OK;

    // Validate
    //
    if (! pSocket)
    {
        return E_INVALIDARG;
    }

    while (i < dwMaxSize)
    {
        iRet = recv (pSocket->Socket, (CHAR*)&bCur, 1, 0);
        if (iRet == SOCKET_ERROR)
        {
            return HRESULT_FROM_WIN32(WSAGetLastError());
        }
        else if (iRet == 0)
        {
            hr = HRESULT_FROM_WIN32(ERROR_HANDLE_EOF);
            break;
        }
        if (bCur == '\r')
        {
            continue;
        }
        if (bCur == '\n')
        {
            break;
        }
        *pbBuffer = bCur;
        pbBuffer++;
        i++;
    }

    *pbBuffer = 0;
    if (i > 0)
    {
        i++;
    }

    // Record the bytes read
    //
    *lpdwBufSize = i;

    return hr;
}

HRESULT RuSocketWrite | ( | IN HSOCKET | hSocket,
 |  | IN BYTE * | pbBuffer,
 |  | IN OUT UINT * | lpuiBufSize
 | ) |  |

Definition at line 581 of file rusocket.cpp.

{
    INT iRet;

    // Validate
    //
    if (! pSocket)
    {
        return E_INVALIDARG;
    }

    // Read from the socket
    //
    iRet = send (pSocket->Socket, (const CHAR*)pbBuffer, *lpdwBufSize, 0);
    if (iRet == SOCKET_ERROR)
    {
        return HRESULT_FROM_WIN32(WSAGetLastError());
    }

    // Record the bytes read
    //
    *lpdwBufSize = iRet;

    return S_OK;
}

HRESULT RuSocketWriteLine | ( | IN HSOCKET | hSocket,
 |  | IN BYTE * | pbBuffer,
 |  | IN OUT UINT * | lpuiBufSize
 | ) |  |

Definition at line 617 of file rusocket.cpp.

{
    DWORD dwMaxSize = *lpdwBufSize, i = 0, uiSize;
    INT iRet;
    BYTE bCur = 0;

    // Validate
    //
    if (! pSocket)
    {
        return E_INVALIDARG;
    }

    // Send on the socket
    //
    while ((i < dwMaxSize) && (bCur != '\r') && (bCur != '\n'))
    {
        uiSize = sizeof(bCur);
        bCur = *pbBuffer;
        iRet = send (pSocket->Socket, (CHAR*)&bCur, 1, 0);
        if (iRet == SOCKET_ERROR)
        {
            return HRESULT_FROM_WIN32(WSAGetLastError());
        }
        pbBuffer++;
        i++;
    }

    // Send the newline
    //
    send (pSocket->Socket, "\r\n", 2, 0);

    // Record the bytes read
    //
    *lpdwBufSize = i;

    return S_OK;
}

Generated on Wed Nov 13 2024 16:54:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/rqs/inc/rustring.h File Reference

  • NetDS
  • RRas
  • rqs
  • inc
Functions

rustring.h File Reference

Go to the source code of this file.

Functions

PWSTR | RuStringDupAtoW (IN PSTR pszansi)
PSTR | RuStringDupWtoA (IN PWSTR psz)

Function Documentation

PWSTR RuStringDupAtoW ( IN PSTR pszansi )

Definition at line 99 of file rustring.cpp.

{
    PWSTR psz = NULL;
    HRESULT hr = RuStringNarrowToWideInternal(pszansi, CP_ACP, &psz, 0);
    return ((hr == S_OK) ? psz : NULL);
}

PSTR RuStringDupWtoA ( IN PWSTR psz )

Definition at line 53 of file rustring.cpp.

{
    PSTR    pszansi = NULL;
    HRESULT hr = RuStringWideToNarrowInternal(psz, &pszansi, 0, CP_ACP);
    return ((hr == S_OK) ? pszansi : NULL);
}

Generated on Wed Nov 13 2024 16:54:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/rqs/rqsmsg/rqsmsg.cpp File Reference

  • NetDS
  • RRas
  • rqs
  • rqsmsg
Functions

rqsmsg.cpp File Reference

#include <windows.h>

Go to the source code of this file.

Functions

BOOL WINAPI DLLMAIN (IN HINSTANCE hInstance, IN DWORD dwReason, IN PVOID pUnused)

Function Documentation

BOOL WINAPI DLLMAIN | ( | IN HINSTANCE | hInstance,
 |  | IN DWORD | dwReason,
 |  | IN PVOID | pUnused
 | ) |  |

Definition at line 20 of file rqsmsg.cpp.

{
    switch(dwReason)
    {
        case DLL_PROCESS_ATTACH:
            DisableThreadLibraryCalls(hInstance);
            break;

        case DLL_PROCESS_DETACH:
            break;

        default:
            break;
    }

    return TRUE;
}

Generated on Wed Nov 13 2024 16:54:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/rqs/server/clntlst.h File Reference

  • NetDS
  • RRas
  • rqs
  • server
Classes

clntlst.h File Reference

#include <shlwapi.h>
#include "rqs.h"

Go to the source code of this file.

Classes

class | ClientList
struct | ClientList::_tag_LIST_NODE
class | ClientList::Iterator
Generated on Wed Nov 13 2024 16:54:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/rqs/server/main.cpp File Reference

  • NetDS
  • RRas
  • rqs
  • server
Defines | Functions

main.cpp File Reference

#include <Rqs.h>
#include <conio.h>

Go to the source code of this file.

Defines

#define | RQS_CONTROLS_ACCEPTED SERVICE_ACCEPT_STOP;

Functions

int __cdecl | main (int argc, char *argv[], char *envp[])
INT | MainConsole (int argc, char **argv)
INT | MainExecute ()
DWORD WINAPI | MainThread (IN LPVOID lpParameter)
DWORD WINAPI | ServiceHandlerEx (DWORD fdwControl, DWORD fdwEventType, LPVOID lpEventData, LPVOID lpContext)
VOID WINAPI | ServiceMain (DWORD dwArgc, LPTSTR *lpszArgv)

Define Documentation

#define RQS_CONTROLS_ACCEPTED SERVICE_ACCEPT_STOP;

Definition at line 14 of file main.cpp.

Function Documentation

int __cdecl main | ( | int | argc,
 |  | char * | argv[],
 |  | char * | envp[]
 | ) |  |

Definition at line 292 of file main.cpp.

{
    SERVICE_TABLE_ENTRY DispatchTable[] =
    {
        { L"rqs",        ServiceMain },
        {  NULL,         NULL}
    };

    if (argc == 1)
    {
        StartServiceCtrlDispatcher( DispatchTable);
    }
    else
    {
        MainConsole(argc, argv);
    }

    return 0;
}

INT MainConsole | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 109 of file main.cpp.

{
    //  Note that argc > 1 was verified in main()
    //
    if (strcmp(argv[1], "/?") == 0)
    {
        printf("Usage:\n");
        printf("  %s /run         Execute quarantine engine\n", argv[0]);
        printf("  %s /?           Display this help\n", argv[0]);
        printf("\n");
    }

    else if (strcmp(argv[1], "/run") == 0)
    {
        MainExecute();
    }

    return 0;
}

INT MainExecute ( )

Definition at line 52 of file main.cpp.

{
    HRESULT hr;
    HANDLE hThread = NULL;
    RqsEngine Engine;

    hr = RuSocket::Initialize();
    if (S_OK != hr)
    {
        printf("Socket initialization failed %x\n", hr);
        return -1;
    }

    Engine.SetConsoleTracing(TRUE);

    // Create a thread to execute the server
    //
    hThread = CreateThread(
                    NULL,
                    0,
                    MainThread,
                    (LPVOID)&Engine,
                    0,
                    NULL);
    if (hThread)
    {
        // Wait for the user to enter something.  Signal that we're done when it
        // happens
        //
        printf("Press any key to stop...\n");
        _getch();

        printf("Stopping...\n");
        Engine.Stop();

        // Wait for the engine to complete its stop
        //
        WaitForSingleObjectEx(hThread, INFINITE, FALSE);
        printf("Stop complete.\n");
        CloseHandle(hThread);
    }
    else
    {
        printf("Unable to create execution thread. %x\n", GetLastError());
    }

    RuSocket::Cleanup();

    return 0;
}

DWORD WINAPI MainThread ( IN LPVOID lpParameter )

Definition at line 24 of file main.cpp.

{
    RqsEngine* pEngine = (RqsEngine*)lpParameter;
    HRESULT hr = S_OK;

    hr = pEngine->Initialize();
    if (S_OK != hr)
    {
        printf("Unable to initialize engine %x\n", hr);
        return hr;
    }

    hr = pEngine->Execute();
    if (S_OK != hr)
    {
        printf("Engine execute error: %x\n", hr);
    }

    return hr;
}

DWORD WINAPI ServiceHandlerEx | ( | DWORD | fdwControl,
 |  | DWORD | fdwEventType,
 |  | LPVOID | lpEventData,
 |  | LPVOID | lpContext
 | ) |  |

Definition at line 139 of file main.cpp.

{
    RqsEngine* pEngine = reinterpret_cast<RqsEngine*>(lpContext);

    if (NULL == pEngine)
    {
        return ERROR_INVALID_PARAMETER;
    }

    pEngine->Trace(
        "ServiceHandlerEx enter.  ctrl=%d type=%d",
        fdwControl,
        fdwEventType);

    DWORD dwRetCode =  ERROR_SUCCESS;
    SERVICE_STATUS status;
    ZeroMemory (&status, sizeof(status));
    status.dwServiceType = SERVICE_WIN32_OWN_PROCESS;

    switch (fdwControl)
    {
        case SERVICE_CONTROL_INTERROGATE:
            pEngine->Trace("ServiceHandlerEx: pause/cont/interrogate");
            status.dwCurrentState       = SERVICE_RUNNING;
            status.dwControlsAccepted   = RQS_CONTROLS_ACCEPTED;
            status.dwCheckPoint         = pEngine->GetCheckpoint();
            SetServiceStatus(pEngine->GetServiceHandle(), &status);
            break;

            // Do not worry about shutdown as we do not want to slow down
            // down shutdown time.  We do not need to clean up anything that
            // the reboot would not on its own.  On service stop, make sure to
            // clean up connections in progress.
            //
        case SERVICE_CONTROL_STOP:
            pEngine->Trace("ServiceHandlerEx: stop/shutdown");
            status.dwCurrentState = SERVICE_STOP_PENDING;
            SetServiceStatus(pEngine->GetServiceHandle(), &status);
            pEngine->Stop();
            break;

        default:
            //  We should never get here, but just in case we get a state we did not
            //  expect we will return an invalid parameter error.
            //
            dwRetCode = ERROR_CALL_NOT_IMPLEMENTED;
    }

    return dwRetCode;
} // ServiceHandler

VOID WINAPI ServiceMain | ( | DWORD | dwArgc,
 |  | LPTSTR * | lpszArgv
 | ) |  |

Definition at line 200 of file main.cpp.

{
    SERVICE_STATUS sStatus;
    HRESULT hr;
    RqsEngine Engine;
    SERVICE_STATUS_HANDLE hService;

    Engine.Trace("Service Main entered.");

    ZeroMemory (&sStatus, sizeof(sStatus));
    sStatus.dwServiceType = SERVICE_WIN32_SHARE_PROCESS;

    // Register the control request handler.
    //
    hService = RegisterServiceCtrlHandlerEx(
                    TEXT("rqs"),
                    ServiceHandlerEx,
                    (LPVOID)&Engine);
    if (NULL == hService)
    {
        Engine.Trace("Unable to set service control handler");
        return;
    }
    Engine.SetServiceHandle(hService);

    // Mark the service as start pending
    //
    sStatus.dwCheckPoint = 1;
    sStatus.dwWaitHint = 5000; // Our best guess of RQS's initialization is that it should take no more than 5 seconds
    sStatus.dwCurrentState = SERVICE_START_PENDING;
    SetServiceStatus(hService, &sStatus);

    // Perform initialization.
    //
    BOOL bSocketInitialized = FALSE;
    hr = RuSocket::Initialize();
    if (S_OK != hr)
    {
        Engine.Trace("Socket initialization failed %x", hr);
        sStatus.dwWin32ExitCode = HRESULT_CODE(hr);
        goto exit;
    }

    bSocketInitialized = TRUE;

    hr = Engine.Initialize();
    if (S_OK != hr)
    {
        Engine.Trace("Initialization failed %x", hr);
        sStatus.dwWin32ExitCode = HRESULT_CODE(hr);
        goto exit;
    }

    // Initialization succeeded.  Update status.
    //
    sStatus.dwControlsAccepted = RQS_CONTROLS_ACCEPTED;
    sStatus.dwCurrentState     = SERVICE_RUNNING;
    SetServiceStatus(hService, &sStatus);

    // Tell the engine to execute. This method will return when all
    // pending clients are serviced and we are ready to stop.
    //
    Engine.Execute();

    //
    // Update return code status.
    //
    sStatus.dwWin32ExitCode = NO_ERROR;
    sStatus.dwServiceSpecificExitCode = 0;

exit:

    if (bSocketInitialized)
    {
        RuSocket::Cleanup();
    }

    sStatus.dwControlsAccepted = 0;
    sStatus.dwCurrentState     = SERVICE_STOPPED;
    SetServiceStatus(hService, &sStatus);
}

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/rqs/server/rqs.h File Reference

  • NetDS
  • RRas
  • rqs
  • server
Defines

rqs.h File Reference

#include <winsock2.h>
#include <stdio.h>
#include <stdlib.h>
#include <rasutil.h>
#include <mprapi.h>
#include <rtutils.h>
#include <iprtrmib.h>
#include <iphlpapi.h>
#include <mprerror.h>
#include "rqsmsg.h"
#include "RqsClient.h"
#include "clntlst.h"
#include "RqsConfig.h"
#include "RqsEngine.h"

Go to the source code of this file.

Defines

#define | IP1(x) ((x>>24) & 0xff)
#define | IP2(x) ((x>>16) & 0xff)
#define | IP3(x) ((x>>8) & 0xff)
#define | IP4(x) (x & 0xff)

Define Documentation

#define IP1 ( x ) ((x>>24) & 0xff)

Definition at line 30 of file rqs.h.

#define IP2 ( x ) ((x>>16) & 0xff)

Definition at line 31 of file rqs.h.

#define IP3 ( x ) ((x>>8) & 0xff)

Definition at line 32 of file rqs.h.

#define IP4 ( x ) (x & 0xff)

Definition at line 33 of file rqs.h.

Generated on Wed Nov 13 2024 16:54:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/rqs/server/rqsclient.cpp File Reference

  • NetDS
  • RRas
  • rqs
  • server

rqsclient.cpp File Reference

#include <rqs.h>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/rqs/server/rqsclient.h File Reference

  • NetDS
  • RRas
  • rqs
  • server
Classes | Defines | Enumerations

rqsclient.h File Reference

Go to the source code of this file.

Classes

class | RqsClient

Defines

#define | RQS_MESSAGE_LENGH_SIZE 4
#define | RQS_MESSAGE_PREFIX_SIZE (3 + RQS_MESSAGE_LENGH_SIZE)
#define | RQS_MESSAGE_SIZE (1024 + RQS_MESSAGE_PREFIX_SIZE)

Enumerations

enum RqsClientState {
Receiving, ReceiveComplete, Responding, RespondComplete,
ClientError
}

Define Documentation

#define RQS_MESSAGE_LENGH_SIZE 4

Definition at line 15 of file rqsclient.h.

#define RQS_MESSAGE_PREFIX_SIZE (3 + RQS_MESSAGE_LENGH_SIZE)

Definition at line 16 of file rqsclient.h.

#define RQS_MESSAGE_SIZE (1024 + RQS_MESSAGE_PREFIX_SIZE)

Definition at line 17 of file rqsclient.h.

Enumeration Type Documentation

enum RqsClientState
Enumerator:
Receiving
ReceiveComplete
Responding
RespondComplete
ClientError

Definition at line 29 of file rqsclient.h.

{
    Receiving,
    ReceiveComplete,
    Responding,
    RespondComplete,
    ClientError
};

Generated on Wed Nov 13 2024 16:54:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/rqs/server/rqsconfig.cpp File Reference

  • NetDS
  • RRas
  • rqs
  • server

rqsconfig.cpp File Reference

#include <Rqs.h>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/rqs/server/rqsconfig.h File Reference

  • NetDS
  • RRas
  • rqs
  • server
Classes | Typedefs

rqsconfig.h File Reference

Go to the source code of this file.

Classes

struct | _RqsConfigString
class | RqsConfig

Typedefs

typedef struct _RqsConfigString | RqsConfigString

Typedef Documentation

typedef struct _RqsConfigString RqsConfigString
Generated on Wed Nov 13 2024 16:54:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/rqs/server/rqsengine.cpp File Reference

  • NetDS
  • RRas
  • rqs
  • server
Classes | Typedefs

rqsengine.cpp File Reference

#include <rqs.h>

Go to the source code of this file.

Classes

struct | _RqsEngineCbInfo

Typedefs

typedef struct _RqsEngineCbInfo | RqsEngineCbInfo

Typedef Documentation

typedef struct _RqsEngineCbInfo RqsEngineCbInfo
Generated on Wed Nov 13 2024 16:54:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/RRas/rqs/server/rqsengine.h File Reference

  • NetDS
  • RRas
  • rqs
  • server
Classes | Enumerations | Functions | Variables

rqsengine.h File Reference

Go to the source code of this file.

Classes

class | RqsEngine

Enumerations

enum RqsEvent {
Connect, Read, UpdateConfig, UpdateTrace,
Quit, ConfigServerSocket, Error
}

Functions

typedef | DWORD (APIENTRY *RqsRemoveQuarantineFunc)(HANDLE

Variables

typedef | BOOL
typedef | HANDLE

Enumeration Type Documentation

enum RqsEvent
Enumerator:
Connect
Read
UpdateConfig
UpdateTrace
Quit
ConfigServerSocket
Error

Definition at line 26 of file rqsengine.h.

{
    Connect,
    Read,
    UpdateConfig,
    UpdateTrace,
    Quit,
    ConfigServerSocket,
    Error
};

Function Documentation

typedef DWORD ( APIENTRY * RqsRemoveQuarantineFunc )

Variable Documentation

typedef BOOL

Definition at line 19 of file rqsengine.h.

typedef HANDLE

Definition at line 19 of file rqsengine.h.

Generated on Wed Nov 13 2024 16:54:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/rtc/Client/CPP/RTCIncoming/Resource.h File Reference

  • NetDS
  • rtc
  • Client
  • CPP
  • RTCIncoming
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_ANSWER 1002
#define | IDC_CHECKAUTO 1000
#define | IDC_DISCONNECT 1003
#define | IDC_EXIT 1006
#define | IDC_LOCAL 1005
#define | IDC_STATUS 1007
#define | IDC_VRECV 1009
#define | IDC_VSEND 1010
#define | IDD_ABOUTBOX 100
#define | IDD_RTCINCOMING_DIALOG 102
#define | IDM_ABOUTBOX 0x0010
#define | IDR_MAINFRAME 128
#define | IDS_ABOUTBOX 101

Define Documentation

#define IDC_ANSWER 1002

Definition at line 11 of file Resource.h.

#define IDC_CHECKAUTO 1000

Definition at line 10 of file Resource.h.

#define IDC_DISCONNECT 1003

Definition at line 12 of file Resource.h.

#define IDC_EXIT 1006

Definition at line 14 of file Resource.h.

#define IDC_LOCAL 1005

Definition at line 13 of file Resource.h.

#define IDC_STATUS 1007

Definition at line 15 of file Resource.h.

#define IDC_VRECV 1009

Definition at line 16 of file Resource.h.

#define IDC_VSEND 1010

Definition at line 17 of file Resource.h.

#define IDD_ABOUTBOX 100

Definition at line 6 of file Resource.h.

#define IDD_RTCINCOMING_DIALOG 102

Definition at line 8 of file Resource.h.

#define IDM_ABOUTBOX 0x0010

Definition at line 5 of file Resource.h.

#define IDR_MAINFRAME 128

Definition at line 9 of file Resource.h.

#define IDS_ABOUTBOX 101

Definition at line 7 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/rtc/Client/CPP/RTCIncoming/RTCIncoming.cpp File Reference

  • NetDS
  • rtc
  • Client
  • CPP
  • RTCIncoming
Variables

RTCIncoming.cpp File Reference

#include "stdafx.h"
#include "RTCIncoming.h"
#include "RTCIncomingDlg.h"

Go to the source code of this file.

Variables

CRTCIncomingApp theApp

Variable Documentation

CRTCIncomingApp theApp

Definition at line 60 of file RTCIncoming.cpp.

Generated on Wed Nov 13 2024 16:54:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/rtc/Client/CPP/RTCIncoming/RTCIncoming.h File Reference

  • NetDS
  • rtc
  • Client
  • CPP
  • RTCIncoming
Classes

RTCIncoming.h File Reference

#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Classes

class CRTCIncomingApp
Generated on Wed Nov 13 2024 16:54:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/rtc/Client/CPP/RTCIncoming/RTCIncomingDlg.cpp File Reference

  • NetDS
  • rtc
  • Client
  • CPP
  • RTCIncoming
Classes

RTCIncomingDlg.cpp File Reference

#include "stdafx.h"
#include "RTCIncoming.h"
#include "RTCIncomingDlg.h"
#include "Utils.h"

Go to the source code of this file.

Classes

class CAboutDlg
Generated on Wed Nov 13 2024 16:54:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/rtc/Client/CPP/RTCIncoming/RTCIncomingDlg.h File Reference

  • NetDS
  • rtc
  • Client
  • CPP
  • RTCIncoming
Classes | Defines

RTCIncomingDlg.h File Reference

Go to the source code of this file.

Classes

class | CRTCIncomingDlg

Defines

#define | MAX_RTCTIMEOUT 5000
#define | PREVVID_BOTTOM 18
#define | PREVVID_LEFT 25
#define | PREVVID_RIGHT 10
#define | PREVVID_TOP 115
#define | RECVVID_BOTTOM 18
#define | RECVVID_LEFT 168
#define | RECVVID_RIGHT 10
#define | RECVVID_TOP 115
#define | WM_RTCCORE_EVENT WM_USER+501

Define Documentation

#define MAX_RTCTIMEOUT 5000

Definition at line 43 of file RTCIncomingDlg.h.

#define PREVVID_BOTTOM 18

Definition at line 41 of file RTCIncomingDlg.h.

#define PREVVID_LEFT 25

Definition at line 38 of file RTCIncomingDlg.h.

#define PREVVID_RIGHT 10

Definition at line 40 of file RTCIncomingDlg.h.

#define PREVVID_TOP 115

Definition at line 39 of file RTCIncomingDlg.h.

#define RECVVID_BOTTOM 18

Definition at line 36 of file RTCIncomingDlg.h.

#define RECVVID_LEFT 168

Definition at line 33 of file RTCIncomingDlg.h.

#define RECVVID_RIGHT 10

Definition at line 35 of file RTCIncomingDlg.h.

#define RECVVID_TOP 115

Definition at line 34 of file RTCIncomingDlg.h.

#define WM_RTCCORE_EVENT WM_USER+501

Definition at line 31 of file RTCIncomingDlg.h.

Generated on Wed Nov 13 2024 16:54:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/rtc/Client/CPP/RTCIncoming/StdAfx.cpp File Reference

  • NetDS
  • rtc
  • Client
  • CPP
  • RTCIncoming

StdAfx.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/rtc/Client/CPP/RTCIncoming/StdAfx.h File Reference

  • NetDS
  • rtc
  • Client
  • CPP
  • RTCIncoming
Defines

StdAfx.h File Reference

#include <afxwin.h>
#include <afxext.h>
#include <afxdisp.h>
#include <afxdtctl.h>
#include <afxcmn.h>
#include "process.h"
#include "rtccore.h"
#include "rtcerr.h"
#include <windows.h>
#include <atlbase.h>
#include "objbase.h"
#include <tchar.h>
#include "ocidl.h"
#include "crtdbg.h"

Go to the source code of this file.

Defines

#define VC_EXTRALEAN

Define Documentation

#define VC_EXTRALEAN

Definition at line 21 of file StdAfx.h.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/rtc/Client/CPP/RTCIncoming/Utils.cpp File Reference

  • NetDS
  • rtc
  • Client
  • CPP
  • RTCIncoming
Functions

Utils.cpp File Reference

#include "Stdafx.h"
#include "Utils.h"

Go to the source code of this file.

Functions

int | DBLOGGER (TCHAR *str,...)
void | LOGMSGERROR (TCHAR *str,...)

Function Documentation

int DBLOGGER | ( | TCHAR * | str,
 |  |  | ...
 | ) |  |

Definition at line 38 of file Utils.cpp.

{

#ifdef _DEBUG

  _ASSERTE( str != NULL);

  TCHAR buffer[512] = {_T('\0')};

  va_list v;
  va_start(v,str);
  _vsntprintf(buffer,511,str,v);
  ::OutputDebugString(buffer);

  va_end(v);
#endif

  return 1;
}

void LOGMSGERROR | ( | TCHAR * | str,
 |  |  | ...
 | ) |  |

Definition at line 75 of file Utils.cpp.

{

  _ASSERT(NULL != str);

  TCHAR buffer[512] = {_T('\0')};

  va_list v;
  va_start(v,str);
  _vsntprintf(buffer,511,str,v);

  MessageBox(NULL, buffer, _T("RTCIn Error"), MB_OK);

  va_end(v);
}

Generated on Wed Nov 13 2024 16:53:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/rtc/Client/CPP/RTCIncoming/Utils.h File Reference

  • NetDS
  • rtc
  • Client
  • CPP
  • RTCIncoming
Defines | Functions

Utils.h File Reference

Go to the source code of this file.

Defines

#define | FREE_BSTR_IF(bstrVal) { if (NULL != bstrVal) { SysFreeString(bstrVal); bstrVal = NULL ;} else bstrVal = NULL; }

Functions

int | DBLOGGER (TCHAR *str,...)
void | LOGMSGERROR (TCHAR *str,...)

Define Documentation

#define FREE_BSTR_IF ( bstrVal ) { if (NULL != bstrVal) { SysFreeString(bstrVal); bstrVal = NULL ;} else bstrVal = NULL; }

Definition at line 23 of file Utils.h.

Function Documentation

int DBLOGGER | ( | TCHAR * | str,
 |  |  | ...
 | ) |  |

Definition at line 38 of file Utils.cpp.

{

#ifdef _DEBUG

  _ASSERTE( str != NULL);

  TCHAR buffer[512] = {_T('\0')};

  va_list v;
  va_start(v,str);
  _vsntprintf(buffer,511,str,v);
  ::OutputDebugString(buffer);

  va_end(v);
#endif

  return 1;
}

void LOGMSGERROR | ( | TCHAR * | str,
 |  |  | ...
 | ) |  |

Definition at line 75 of file Utils.cpp.

{

  _ASSERT(NULL != str);

  TCHAR buffer[512] = {_T('\0')};

  va_list v;
  va_start(v,str);
  _vsntprintf(buffer,511,str,v);

  MessageBox(NULL, buffer, _T("RTCIn Error"), MB_OK);

  va_end(v);
}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/rtc/Client/CPP/RTCOutgoing/Resource.h File Reference

  • NetDS
  • rtc
  • Client
  • CPP
  • RTCOutgoing
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_ADDPARTY 1022
#define | IDC_APPSHARING 1016
#define | IDC_CONNECT 1013
#define | IDC_DISCONNECT 1014
#define | IDC_DURI 1008
#define | IDC_DURISTATIC 1024
#define | IDC_EXIT 1015
#define | IDC_LURI 1009
#define | IDC_LURISTATIC 1025
#define | IDC_PARTYLIST 1020
#define | IDC_PARTYSTATIC 1021
#define | IDC_PCPCRADIO 1010
#define | IDC_PCPHRADIO 1011
#define | IDC_PHPHRADIO 1012
#define | IDC_REMOVEPARTY 1023
#define | IDC_STATUS 1031
#define | IDC_TUNE 1017
#define | IDC_VRECVS 1027
#define | IDC_VRECVSTATIC 1027
#define | IDC_VSENDS 1026
#define | IDC_VSENDSTATIC 1026
#define | IDD_ABOUTBOX 100
#define | IDD_RTCOUTGOING_DIALOG 102
#define | IDM_ABOUTBOX 0x0010
#define | IDR_MAINFRAME 128
#define | IDS_ABOUTBOX 101

Define Documentation

#define IDC_ADDPARTY 1022

Definition at line 22 of file Resource.h.

#define IDC_APPSHARING 1016

Definition at line 18 of file Resource.h.

#define IDC_CONNECT 1013

Definition at line 15 of file Resource.h.

#define IDC_DISCONNECT 1014

Definition at line 16 of file Resource.h.

#define IDC_DURI 1008

Definition at line 10 of file Resource.h.

#define IDC_DURISTATIC 1024

Definition at line 24 of file Resource.h.

#define IDC_EXIT 1015

Definition at line 17 of file Resource.h.

#define IDC_LURI 1009

Definition at line 11 of file Resource.h.

#define IDC_LURISTATIC 1025

Definition at line 25 of file Resource.h.

#define IDC_PARTYLIST 1020

Definition at line 20 of file Resource.h.

#define IDC_PARTYSTATIC 1021

Definition at line 21 of file Resource.h.

#define IDC_PCPCRADIO 1010

Definition at line 12 of file Resource.h.

#define IDC_PCPHRADIO 1011

Definition at line 13 of file Resource.h.

#define IDC_PHPHRADIO 1012

Definition at line 14 of file Resource.h.

#define IDC_REMOVEPARTY 1023

Definition at line 23 of file Resource.h.

#define IDC_STATUS 1031

Definition at line 30 of file Resource.h.

#define IDC_TUNE 1017

Definition at line 19 of file Resource.h.

#define IDC_VRECVS 1027

Definition at line 29 of file Resource.h.

#define IDC_VRECVSTATIC 1027

Definition at line 28 of file Resource.h.

#define IDC_VSENDS 1026

Definition at line 27 of file Resource.h.

#define IDC_VSENDSTATIC 1026

Definition at line 26 of file Resource.h.

#define IDD_ABOUTBOX 100

Definition at line 6 of file Resource.h.

#define IDD_RTCOUTGOING_DIALOG 102

Definition at line 8 of file Resource.h.

#define IDM_ABOUTBOX 0x0010

Definition at line 5 of file Resource.h.

#define IDR_MAINFRAME 128

Definition at line 9 of file Resource.h.

#define IDS_ABOUTBOX 101

Definition at line 7 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/rtc/Client/CPP/RTCOutgoing/RTCOutgoing.cpp File Reference

  • NetDS
  • rtc
  • Client
  • CPP
  • RTCOutgoing
Variables

RTCOutgoing.cpp File Reference

#include "stdafx.h"
#include "RTCOutgoing.h"
#include "RTCOutgoingDlg.h"

Go to the source code of this file.

Variables

CRTCOutgoingApp theApp

Variable Documentation

CRTCOutgoingApp theApp

Definition at line 64 of file RTCOutgoing.cpp.

Generated on Wed Nov 13 2024 16:54:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/rtc/Client/CPP/RTCOutgoing/RTCOutgoing.h File Reference

  • NetDS
  • rtc
  • Client
  • CPP
  • RTCOutgoing
Classes

RTCOutgoing.h File Reference

#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Classes

class CRTCOutgoingApp
Generated on Wed Nov 13 2024 16:54:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/rtc/Client/CPP/RTCOutgoing/RTCOutgoingDlg.cpp File Reference

  • NetDS
  • rtc
  • Client
  • CPP
  • RTCOutgoing
Classes

RTCOutgoingDlg.cpp File Reference

#include "stdafx.h"
#include "RTCOutgoing.h"
#include "RTCOutgoingDlg.h"

Go to the source code of this file.

Classes

class CAboutDlg
Generated on Wed Nov 13 2024 16:54:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/rtc/Client/CPP/RTCOutgoing/RTCOutgoingDlg.h File Reference

  • NetDS
  • rtc
  • Client
  • CPP
  • RTCOutgoing
Classes | Defines

RTCOutgoingDlg.h File Reference

Go to the source code of this file.

Classes

class | CRTCOutgoingDlg

Defines

#define | MAX_RTCTIMEOUT 5000
#define | PREVVID_BOTTOM 20
#define | PREVVID_LEFT 420
#define | PREVVID_RIGHT 13
#define | PREVVID_TOP 35
#define | RECVVID_BOTTOM 20
#define | RECVVID_LEFT 420
#define | RECVVID_RIGHT 13
#define | RECVVID_TOP 170
#define | WM_RTCCORE_EVENT WM_USER+501

Define Documentation

#define MAX_RTCTIMEOUT 5000

Definition at line 43 of file RTCOutgoingDlg.h.

#define PREVVID_BOTTOM 20

Definition at line 40 of file RTCOutgoingDlg.h.

#define PREVVID_LEFT 420

Definition at line 37 of file RTCOutgoingDlg.h.

#define PREVVID_RIGHT 13

Definition at line 39 of file RTCOutgoingDlg.h.

#define PREVVID_TOP 35

Definition at line 38 of file RTCOutgoingDlg.h.

#define RECVVID_BOTTOM 20

Definition at line 34 of file RTCOutgoingDlg.h.

#define RECVVID_LEFT 420

Definition at line 31 of file RTCOutgoingDlg.h.

#define RECVVID_RIGHT 13

Definition at line 33 of file RTCOutgoingDlg.h.

#define RECVVID_TOP 170

Definition at line 32 of file RTCOutgoingDlg.h.

#define WM_RTCCORE_EVENT WM_USER+501

Definition at line 29 of file RTCOutgoingDlg.h.

Generated on Wed Nov 13 2024 16:54:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/rtc/Client/CPP/RTCOutgoing/StdAfx.cpp File Reference

  • NetDS
  • rtc
  • Client
  • CPP
  • RTCOutgoing

StdAfx.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/rtc/Client/CPP/RTCOutgoing/StdAfx.h File Reference

  • NetDS
  • rtc
  • Client
  • CPP
  • RTCOutgoing
Defines

StdAfx.h File Reference

#include <afxwin.h>
#include <afxext.h>
#include <afxdisp.h>
#include <afxdtctl.h>
#include <afxcmn.h>
#include "Utils.h"
#include "process.h"
#include "rtccore.h"
#include "rtcerr.h"
#include <windows.h>
#include <atlbase.h>
#include "objbase.h"
#include <tchar.h>
#include "ocidl.h"
#include "crtdbg.h"
#include "Utils.h"

Go to the source code of this file.

Defines

#define VC_EXTRALEAN

Define Documentation

#define VC_EXTRALEAN

Definition at line 22 of file StdAfx.h.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/rtc/Client/CPP/RTCOutgoing/Utils.cpp File Reference

  • NetDS
  • rtc
  • Client
  • CPP
  • RTCOutgoing
Functions

Utils.cpp File Reference

#include "Stdafx.h"
#include "Utils.h"

Go to the source code of this file.

Functions

int | DBLOGGER (TCHAR *str,...)
void | LOGMSG (TCHAR *str,...)
void | LOGMSGERROR (TCHAR *str,...)

Function Documentation

int DBLOGGER | ( | TCHAR * | str,
 |  |  | ...
 | ) |  |

Definition at line 36 of file Utils.cpp.

{

  _ASSERTE( str != NULL);

  TCHAR buffer[512] = {_T('\0')};

  va_list v;
  va_start(v,str);
  _tcscpy(buffer,_T("\n"));
  _vsntprintf(buffer,511,str,v);
  ::OutputDebugString(buffer);

  va_end(v);
  return 1;
}

void LOGMSG | ( | TCHAR * | str,
 |  |  | ...
 | ) |  |

Definition at line 105 of file Utils.cpp.

{

  _ASSERT(NULL != str);

  TCHAR buffer[512] = {_T('\0')};

  va_list v;
  va_start(v,str);
  _tcscpy(buffer,_T("\n"));
  _vsntprintf(buffer,511,str,v);

  MessageBox(NULL, buffer, _T("RTCOut Info"), MB_OK);

  va_end(v);
}

void LOGMSGERROR | ( | TCHAR * | str,
 |  |  | ...
 | ) |  |

Definition at line 70 of file Utils.cpp.

{

  _ASSERT(NULL != str);

  TCHAR buffer[512] = {_T('\0')};

  va_list v;
  va_start(v,str);
  _tcscpy(buffer,_T("\n"));
  _vsntprintf(buffer,511,str,v);

  MessageBox(NULL, buffer, _T("RTCOut Error"), MB_OK);

  va_end(v);
}

Generated on Wed Nov 13 2024 16:53:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/rtc/Client/CPP/RTCOutgoing/Utils.h File Reference

  • NetDS
  • rtc
  • Client
  • CPP
  • RTCOutgoing
Defines | Functions

Utils.h File Reference

Go to the source code of this file.

Defines

#define | FREE_BSTR_IF(bstrVal) { if (NULL != bstrVal) { SysFreeString(bstrVal); bstrVal = NULL ;} else bstrVal = NULL; }

Functions

int | DBLOGGER (TCHAR *str,...)
void | LOGMSG (TCHAR *str,...)
void | LOGMSGERROR (TCHAR *str,...)

Define Documentation

#define FREE_BSTR_IF ( bstrVal ) { if (NULL != bstrVal) { SysFreeString(bstrVal); bstrVal = NULL ;} else bstrVal = NULL; }

Definition at line 21 of file Utils.h.

Function Documentation

int DBLOGGER | ( | TCHAR * | str,
 |  |  | ...
 | ) |  |

Definition at line 38 of file Utils.cpp.

{

#ifdef _DEBUG

  _ASSERTE( str != NULL);

  TCHAR buffer[512] = {_T('\0')};

  va_list v;
  va_start(v,str);
  _vsntprintf(buffer,511,str,v);
  ::OutputDebugString(buffer);

  va_end(v);
#endif

  return 1;
}

void LOGMSG | ( | TCHAR * | str,
 |  |  | ...
 | ) |  |

Definition at line 105 of file Utils.cpp.

{

  _ASSERT(NULL != str);

  TCHAR buffer[512] = {_T('\0')};

  va_list v;
  va_start(v,str);
  _tcscpy(buffer,_T("\n"));
  _vsntprintf(buffer,511,str,v);

  MessageBox(NULL, buffer, _T("RTCOut Info"), MB_OK);

  va_end(v);
}

void LOGMSGERROR | ( | TCHAR * | str,
 |  |  | ...
 | ) |  |

Definition at line 75 of file Utils.cpp.

{

  _ASSERT(NULL != str);

  TCHAR buffer[512] = {_T('\0')};

  va_list v;
  va_start(v,str);
  _vsntprintf(buffer,511,str,v);

  MessageBox(NULL, buffer, _T("RTCIn Error"), MB_OK);

  va_end(v);
}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/rtc/Client/CPP/rtcsample/resource.h File Reference

  • NetDS
  • rtc
  • Client
  • CPP
  • rtcsample
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | ID_ACTION_ADDBUDDY 40004
#define | ID_ACTION_CALL 40005
#define | ID_ACTION_MESSAGE 40006
#define | ID_BUDDY_CALL 40008
#define | ID_BUDDY_MESSAGE 40009
#define | ID_BUDDY_REMOVE 40010
#define | ID_FILE_EXIT 40003
#define | ID_FILE_LOGOFF 40002
#define | ID_FILE_LOGON 40001
#define | ID_FILE_PRESENCESTATUS_AWAY 40013
#define | ID_FILE_PRESENCESTATUS_BERIGHTBACK 40016
#define | ID_FILE_PRESENCESTATUS_BUSY 40015
#define | ID_FILE_PRESENCESTATUS_IDLE 40014
#define | ID_FILE_PRESENCESTATUS_OFFLINE 40011
#define | ID_FILE_PRESENCESTATUS_ONLINE 40012
#define | ID_FILE_PRESENCESTATUS_ONTHEPHONE 40017
#define | ID_FILE_PRESENCESTATUS_OUTTOLUNCH 40018
#define | ID_TOOLS_TUNINGWIZARD 40007
#define | IDC_BUDDYLIST 2001
#define | IDC_BUTTON_SESSION_ACCEPT 1010
#define | IDC_BUTTON_SESSION_REJECT 1011
#define | IDC_BUTTON_WATCHER_ALLOW 1002
#define | IDC_BUTTON_WATCHER_BLOCK 1003
#define | IDC_CHECK_WATCHER_ADD_BUDDY 1004
#define | IDC_COMBO_LOGON_TRANSPORT 1001
#define | IDC_EDIT_ADDRESS_NAME 1007
#define | IDC_EDIT_ADDRESS_URI 1006
#define | IDC_EDIT_AUTH_ACCOUNT 1012
#define | IDC_EDIT_AUTH_PASSWORD 1014
#define | IDC_EDIT_AUTH_USERURI 1013
#define | IDC_EDIT_LOGON_SERVER 1002
#define | IDC_EDIT_LOGON_USERURI 1000
#define | IDC_IM_DISPLAY 2002
#define | IDC_IM_EDIT 2003
#define | IDC_IM_SEND 2004
#define | IDC_MIC_MUTE 2006
#define | IDC_MIC_VOL 2005
#define | IDC_SPK_MUTE 2008
#define | IDC_SPK_VOL 2007
#define | IDC_STATIC_SESSION_NAME 1008
#define | IDC_STATIC_SESSION_URI 1009
#define | IDC_STATIC_WATCHER_NAME 1006
#define | IDC_STATIC_WATCHER_URI 1005
#define | IDC_STATUSBAR 2000
#define | IDD_DIALOG_ADDRESS 105
#define | IDD_DIALOG_ADDRESS_NAME 104
#define | IDD_DIALOG_AUTH 107
#define | IDD_DIALOG_LOGON 101
#define | IDD_DIALOG_SESSION 106
#define | IDD_DIALOG_WATCHER 102
#define | IDR_MENU1 103
#define | IDR_MENU_APP 103
#define | IDR_MENU_AV 106
#define | IDR_MENU_BUDDY 107
#define | IDR_MENU_IM 105

Define Documentation

#define ID_ACTION_ADDBUDDY 40004

Definition at line 45 of file resource.h.

#define ID_ACTION_CALL 40005

Definition at line 46 of file resource.h.

#define ID_ACTION_MESSAGE 40006

Definition at line 47 of file resource.h.

#define ID_BUDDY_CALL 40008

Definition at line 49 of file resource.h.

#define ID_BUDDY_MESSAGE 40009

Definition at line 50 of file resource.h.

#define ID_BUDDY_REMOVE 40010

Definition at line 51 of file resource.h.

#define ID_FILE_EXIT 40003

Definition at line 44 of file resource.h.

#define ID_FILE_LOGOFF 40002

Definition at line 43 of file resource.h.

#define ID_FILE_LOGON 40001

Definition at line 42 of file resource.h.

#define ID_FILE_PRESENCESTATUS_AWAY 40013

Definition at line 54 of file resource.h.

#define ID_FILE_PRESENCESTATUS_BERIGHTBACK 40016

Definition at line 57 of file resource.h.

#define ID_FILE_PRESENCESTATUS_BUSY 40015

Definition at line 56 of file resource.h.

#define ID_FILE_PRESENCESTATUS_IDLE 40014

Definition at line 55 of file resource.h.

#define ID_FILE_PRESENCESTATUS_OFFLINE 40011

Definition at line 52 of file resource.h.

#define ID_FILE_PRESENCESTATUS_ONLINE 40012

Definition at line 53 of file resource.h.

#define ID_FILE_PRESENCESTATUS_ONTHEPHONE 40017

Definition at line 58 of file resource.h.

#define ID_FILE_PRESENCESTATUS_OUTTOLUNCH 40018

Definition at line 59 of file resource.h.

#define ID_TOOLS_TUNINGWIZARD 40007

Definition at line 48 of file resource.h.

#define IDC_BUDDYLIST 2001

Definition at line 34 of file resource.h.

#define IDC_BUTTON_SESSION_ACCEPT 1010

Definition at line 28 of file resource.h.

#define IDC_BUTTON_SESSION_REJECT 1011

Definition at line 29 of file resource.h.

#define IDC_BUTTON_WATCHER_ALLOW 1002

Definition at line 19 of file resource.h.

#define IDC_BUTTON_WATCHER_BLOCK 1003

Definition at line 20 of file resource.h.

#define IDC_CHECK_WATCHER_ADD_BUDDY 1004

Definition at line 21 of file resource.h.

#define IDC_COMBO_LOGON_TRANSPORT 1001

Definition at line 17 of file resource.h.

#define IDC_EDIT_ADDRESS_NAME 1007

Definition at line 25 of file resource.h.

#define IDC_EDIT_ADDRESS_URI 1006

Definition at line 24 of file resource.h.

#define IDC_EDIT_AUTH_ACCOUNT 1012

Definition at line 30 of file resource.h.

#define IDC_EDIT_AUTH_PASSWORD 1014

Definition at line 32 of file resource.h.

#define IDC_EDIT_AUTH_USERURI 1013

Definition at line 31 of file resource.h.

#define IDC_EDIT_LOGON_SERVER 1002

Definition at line 18 of file resource.h.

#define IDC_EDIT_LOGON_USERURI 1000

Definition at line 16 of file resource.h.

#define IDC_IM_DISPLAY 2002

Definition at line 35 of file resource.h.

#define IDC_IM_EDIT 2003

Definition at line 36 of file resource.h.

#define IDC_IM_SEND 2004

Definition at line 37 of file resource.h.

#define IDC_MIC_MUTE 2006

Definition at line 39 of file resource.h.

#define IDC_MIC_VOL 2005

Definition at line 38 of file resource.h.

#define IDC_SPK_MUTE 2008

Definition at line 41 of file resource.h.

#define IDC_SPK_VOL 2007

Definition at line 40 of file resource.h.

#define IDC_STATIC_SESSION_NAME 1008

Definition at line 26 of file resource.h.

#define IDC_STATIC_SESSION_URI 1009

Definition at line 27 of file resource.h.

#define IDC_STATIC_WATCHER_NAME 1006

Definition at line 23 of file resource.h.

#define IDC_STATIC_WATCHER_URI 1005

Definition at line 22 of file resource.h.

#define IDC_STATUSBAR 2000

Definition at line 33 of file resource.h.

#define IDD_DIALOG_ADDRESS 105

Definition at line 10 of file resource.h.

#define IDD_DIALOG_ADDRESS_NAME 104

Definition at line 9 of file resource.h.

#define IDD_DIALOG_AUTH 107

Definition at line 15 of file resource.h.

#define IDD_DIALOG_LOGON 101

Definition at line 5 of file resource.h.

#define IDD_DIALOG_SESSION 106

Definition at line 13 of file resource.h.

#define IDD_DIALOG_WATCHER 102

Definition at line 6 of file resource.h.

#define IDR_MENU1 103

Definition at line 7 of file resource.h.

#define IDR_MENU_APP 103

Definition at line 8 of file resource.h.

#define IDR_MENU_AV 106

Definition at line 12 of file resource.h.

#define IDR_MENU_BUDDY 107

Definition at line 14 of file resource.h.

#define IDR_MENU_IM 105

Definition at line 11 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/rtc/Client/CPP/rtcsample/rtcav.cpp File Reference

  • NetDS
  • rtc
  • Client
  • CPP
  • rtcsample

rtcav.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/rtc/Client/CPP/rtcsample/rtcav.h File Reference

  • NetDS
  • rtc
  • Client
  • CPP
  • rtcsample
Classes

rtcav.h File Reference

Go to the source code of this file.

Classes

class CRTCAVSession
Generated on Wed Nov 13 2024 16:54:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/rtc/Client/CPP/rtcsample/rtcdialogs.cpp File Reference

  • NetDS
  • rtc
  • Client
  • CPP
  • rtcsample
Classes | Functions

rtcdialogs.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Classes

struct | ADDRESS_DATA
struct | AUTH_DATA
struct | LOGON_DATA
struct | SESSION_DATA
struct | WATCHER_DATA

Functions

INT_PTR CALLBACK | AddressDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
INT_PTR CALLBACK | AuthDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
void | CleanUserURI (WCHAR *szURI)
INT_PTR CALLBACK | LogonDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
INT_PTR CALLBACK | SessionDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
HRESULT | ShowAddressDialog (HWND hWndParent, PWSTR szTitle, BOOL fGetName, BSTR *pbstrURI, BSTR *pbstrName)
HRESULT | ShowAuthDialog (HWND hWndParent, BSTR bstrOldURI, BSTR *pbstrURI, BSTR *pbstrAccount, BSTR *pbstrPassword)
HRESULT | ShowLogonDialog (HWND hWndParent, BSTR *pbstrURI, BSTR *pbstrServer, BSTR *pbstrTransport)
HRESULT | ShowSessionDialog (HWND hWndParent, BSTR bstrName, BSTR bstrURI, BOOL *pfAccept)
HRESULT | ShowWatcherDialog (HWND hWndParent, BSTR bstrName, BSTR bstrURI, BOOL *pfAllow, BOOL *pfAddBuddy)
INT_PTR CALLBACK | WatcherDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)

Function Documentation

INT_PTR CALLBACK AddressDialogProc | ( | HWND | hwndDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 478 of file rtcdialogs.cpp.

{
    ADDRESS_DATA *pAD;
    pAD = (ADDRESS_DATA *)GetWindowLong(hwndDlg, DWL_USER);

    switch (uMsg)
    {
    case WM_INITDIALOG:
        {
            // Store the ADDRESS_DATA pointer in the
            // window's user data
            SetWindowLong(hwndDlg, DWL_USER, lParam);
            pAD = (ADDRESS_DATA *)lParam;

            // Set the dialog title
            SetWindowText(hwndDlg, pAD->szTitle);
        }
        return TRUE;

    case WM_COMMAND:
        switch (LOWORD(wParam))
        {
        case IDOK:
            {
                GetDlgItemTextW(
                    hwndDlg,
                    IDC_EDIT_ADDRESS_URI,
                    pAD->szURI,
                    MAX_STRING
                    );

                GetDlgItemTextW(
                    hwndDlg,
                    IDC_EDIT_ADDRESS_NAME,
                    pAD->szName,
                    MAX_STRING
                    );

                // Fall through
            }

        case IDCANCEL:
            EndDialog(hwndDlg, wParam);
            return TRUE;
        }
    }

    return FALSE;
}

INT_PTR CALLBACK AuthDialogProc | ( | HWND | hwndDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 203 of file rtcdialogs.cpp.

{
    AUTH_DATA *pAD;
    pAD = (AUTH_DATA *)GetWindowLong(hwndDlg, DWL_USER);

    switch (uMsg)
    {
    case WM_INITDIALOG:
        {
            // Store the AUTH_DATA pointer in the
            // window's user data
            SetWindowLong(hwndDlg, DWL_USER, lParam);

            pAD = (AUTH_DATA *)lParam;

            // Populate the user URI edit box
            SetDlgItemTextW(hwndDlg, IDC_EDIT_AUTH_USERURI,
                            pAD->bstrOldURI);
        }
        return TRUE;

    case WM_COMMAND:
        switch (LOWORD(wParam))
        {
        case IDOK:
            {
                GetDlgItemTextW(
                    hwndDlg,
                    IDC_EDIT_AUTH_USERURI,
                    pAD->szUserURI,
                    MAX_STRING
                    );

                GetDlgItemTextW(
                    hwndDlg,
                    IDC_EDIT_AUTH_ACCOUNT,
                    pAD->szAccount,
                    MAX_STRING
                    );

                GetDlgItemTextW(
                    hwndDlg,
                    IDC_EDIT_AUTH_PASSWORD,
                    pAD->szPassword,
                    MAX_STRING
                    );

                // Fall through
            }

        case IDCANCEL:
            EndDialog(hwndDlg, wParam);
            return TRUE;
        }
    }

    return FALSE;
}

void CleanUserURI ( WCHAR * szURI )

Definition at line 13 of file rtcdialogs.cpp.

{
    // If the user URI does not start with sip: then
    // add it
    if (wcsncmp(szURI, L"sip:", 4))
    {
        WCHAR szTemp[MAX_STRING];

        wcscpy(szTemp, szURI);
        _snwprintf(szURI, MAX_STRING, L"sip:%s", szTemp);
    szURI[MAX_STRING-1] = L'\0';

    }

    // Also, strip off any parameters to the user URI
    WCHAR *ch = wcschr(szURI, L';');

    if (ch != NULL)
    {
        *ch = L'\0';
    }
}

INT_PTR CALLBACK LogonDialogProc | ( | HWND | hwndDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 53 of file rtcdialogs.cpp.

{
    LOGON_DATA *pLD;
    pLD = (LOGON_DATA *)GetWindowLong(hwndDlg, DWL_USER);

    switch (uMsg)
    {
    case WM_INITDIALOG:
        {
            // Store the LOGON_DATA pointer in the
            // window's user data
            SetWindowLong(hwndDlg, DWL_USER, lParam);

            // Populate the transport combo box
            HWND hwndCombo = GetDlgItem(hwndDlg, IDC_COMBO_LOGON_TRANSPORT);

            SendMessageW(hwndCombo, CB_ADDSTRING, 0, (LPARAM)L"TCP");
            SendMessageW(hwndCombo, CB_ADDSTRING, 0, (LPARAM)L"UDP");
            SendMessageW(hwndCombo, CB_ADDSTRING, 0, (LPARAM)L"TLS");
            SendMessage(hwndCombo, CB_SETCURSEL, 0, 0);
        }
        return TRUE;

    case WM_COMMAND:
        switch (LOWORD(wParam))
        {
        case IDOK:
            {
                GetDlgItemTextW(
                    hwndDlg,
                    IDC_EDIT_LOGON_USERURI,
                    pLD->szUserURI,
                    MAX_STRING
                    );

                GetDlgItemTextW(
                    hwndDlg,
                    IDC_EDIT_LOGON_SERVER,
                    pLD->szServer,
                    MAX_STRING
                    );

                GetDlgItemTextW(
                    hwndDlg,
                    IDC_COMBO_LOGON_TRANSPORT,
                    pLD->szTransport,
                    MAX_STRING
                    );

                // Fall through
            }

        case IDCANCEL:
            EndDialog(hwndDlg, wParam);
            return TRUE;
        }
    }

    return FALSE;
}

INT_PTR CALLBACK SessionDialogProc | ( | HWND | hwndDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 608 of file rtcdialogs.cpp.

{
    SESSION_DATA *pSD;
    pSD = (SESSION_DATA *)GetWindowLong(hwndDlg, DWL_USER);

    switch (uMsg)
    {
    case WM_INITDIALOG:
        {
            // Store the SESSION_DATA pointer in the
            // window's user data
            SetWindowLong(hwndDlg, DWL_USER, lParam);
            pSD = (SESSION_DATA *)lParam;

            // Populate the session text
            SendDlgItemMessageW(hwndDlg, IDC_STATIC_SESSION_NAME,
                WM_SETTEXT, 0, (LPARAM)(pSD->bstrName));

            SendDlgItemMessageW(hwndDlg, IDC_STATIC_SESSION_URI,
                WM_SETTEXT, 0, (LPARAM)(pSD->bstrURI));
        }
        return TRUE;

    case WM_COMMAND:
        switch (LOWORD(wParam))
        {
        case IDC_BUTTON_SESSION_ACCEPT:
            {
                pSD->fAccept = TRUE;

                EndDialog(hwndDlg, IDOK);
            }
            return TRUE;

        case IDC_BUTTON_SESSION_REJECT:
        case IDCANCEL:
            {
                pSD->fAccept = FALSE;

                EndDialog(hwndDlg, IDOK);
            }
            return TRUE;
        }
    }

    return FALSE;
}

HRESULT ShowAddressDialog | ( | HWND | hWndParent,
 |  | PWSTR | szTitle,
 |  | BOOL | fGetName,
 |  | BSTR * | pbstrURI,
 |  | BSTR * | pbstrName
 | ) |  |

Definition at line 538 of file rtcdialogs.cpp.

{
    int iRes;
    ADDRESS_DATA ad;

    ad.szTitle = szTitle;

    // Show the dialog
    iRes = DialogBoxParam(
        GetModuleHandle(NULL),
        MAKEINTRESOURCE(fGetName ? IDD_DIALOG_ADDRESS_NAME : IDD_DIALOG_ADDRESS),
        hWndParent,
        (DLGPROC)AddressDialogProc,
        (LPARAM)&ad
        );

    if (iRes == IDOK)
    {
        // Check for empty strings
        if (ad.szURI[0] == L'\0')
        {
            return E_FAIL;
        }

        *pbstrURI = SysAllocString(ad.szURI);

        if (!(*pbstrURI))
        {
            // Out of memory
            return E_OUTOFMEMORY;
        }

        if (fGetName)
        {
            *pbstrName = SysAllocString(ad.szName);

            if (!(*pbstrName))
            {
                // Out of memory
                SAFE_FREE_STRING(*pbstrURI);

                return E_OUTOFMEMORY;
            }
        }

        return S_OK;
    }

    return E_FAIL;
}

HRESULT ShowAuthDialog | ( | HWND | hWndParent,
 |  | BSTR | bstrOldURI,
 |  | BSTR * | pbstrURI,
 |  | BSTR * | pbstrAccount,
 |  | BSTR * | pbstrPassword
 | ) |  |

Definition at line 272 of file rtcdialogs.cpp.

{
    int iRes;
    AUTH_DATA ad;

    ad.bstrOldURI = bstrOldURI;

    // Show the dialog
    iRes = DialogBoxParam(
        GetModuleHandle(NULL),
        MAKEINTRESOURCE(IDD_DIALOG_AUTH),
        hWndParent,
        (DLGPROC)AuthDialogProc,
        (LPARAM)&ad
        );

    if (iRes == IDOK)
    {
        // Check for empty strings
        if ((ad.szUserURI[0] == L'\0') ||
            (ad.szAccount[0] == L'\0') ||
            (ad.szPassword[0] == L'\0'))
        {
            return E_FAIL;
        }

        // Cleanup the user URI
        CleanUserURI(ad.szUserURI);

        *pbstrURI = SysAllocString(ad.szUserURI);

        if (!(*pbstrURI))
        {
            // Out of memory
            return E_OUTOFMEMORY;
        }

        *pbstrAccount = SysAllocString(ad.szAccount);

        if (!(*pbstrAccount))
        {
            // Out of memory
            SAFE_FREE_STRING(*pbstrURI);
            return E_OUTOFMEMORY;
        }

        *pbstrPassword = SysAllocString(ad.szPassword);

        if (!(*pbstrPassword))
        {
            // Out of memory
            SAFE_FREE_STRING(*pbstrURI);
            SAFE_FREE_STRING(*pbstrAccount);
            return E_OUTOFMEMORY;
        }

        return S_OK;
    }

    return E_FAIL;
}

HRESULT ShowLogonDialog | ( | HWND | hWndParent,
 |  | BSTR * | pbstrURI,
 |  | BSTR * | pbstrServer,
 |  | BSTR * | pbstrTransport
 | ) |  |

Definition at line 124 of file rtcdialogs.cpp.

{
    int iRes;
    LOGON_DATA ld;

    // Show the dialog
    iRes = DialogBoxParam(
        GetModuleHandle(NULL),
        MAKEINTRESOURCE(IDD_DIALOG_LOGON),
        hWndParent,
        (DLGPROC)LogonDialogProc,
        (LPARAM)&ld
        );

    if (iRes == IDOK)
    {
        // Check for empty strings
        if ((ld.szUserURI[0] == L'\0') ||
            (ld.szServer[0] == L'\0') ||
            (ld.szTransport[0] == L'\0'))
        {
            return E_FAIL;
        }

        // Cleanup the user URI
        CleanUserURI(ld.szUserURI);

        *pbstrURI = SysAllocString(ld.szUserURI);

        if (!(*pbstrURI))
        {
            // Out of memory
            return E_OUTOFMEMORY;
        }

        *pbstrServer = SysAllocString(ld.szServer);

        if (!(*pbstrServer))
        {
            // Out of memory
            SAFE_FREE_STRING(*pbstrURI);
            return E_OUTOFMEMORY;
        }

        *pbstrTransport = SysAllocString(ld.szTransport);

        if (!(*pbstrTransport))
        {
            // Out of memory
            SAFE_FREE_STRING(*pbstrURI);
            SAFE_FREE_STRING(*pbstrServer);
            return E_OUTOFMEMORY;
        }

        return S_OK;
    }

    return E_FAIL;
}

HRESULT ShowSessionDialog | ( | HWND | hWndParent,
 |  | BSTR | bstrName,
 |  | BSTR | bstrURI,
 |  | BOOL * | pfAccept
 | ) |  |

Definition at line 666 of file rtcdialogs.cpp.

{
    int iRes;
    SESSION_DATA sd;

    sd.bstrName = bstrName;
    sd.bstrURI = bstrURI;

    // Show the dialog
    iRes = DialogBoxParam(
        GetModuleHandle(NULL),
        MAKEINTRESOURCE(IDD_DIALOG_SESSION),
        hWndParent,
        (DLGPROC)SessionDialogProc,
        (LPARAM)&sd
        );

    if (iRes == IDOK)
    {
        *pfAccept = sd.fAccept;

        return S_OK;
    }

    return E_FAIL;
}

HRESULT ShowWatcherDialog | ( | HWND | hWndParent,
 |  | BSTR | bstrName,
 |  | BSTR | bstrURI,
 |  | BOOL * | pfAllow,
 |  | BOOL * | pfAddBuddy
 | ) |  |

Definition at line 430 of file rtcdialogs.cpp.

{
    int iRes;
    WATCHER_DATA wd;

    wd.bstrName = bstrName;
    wd.bstrURI = bstrURI;

    // Show the dialog
    iRes = DialogBoxParam(
        GetModuleHandle(NULL),
        MAKEINTRESOURCE(IDD_DIALOG_WATCHER),
        hWndParent,
        (DLGPROC)WatcherDialogProc,
        (LPARAM)&wd
        );

    if (iRes == IDOK)
    {
        *pfAllow = wd.fAllow;
        *pfAddBuddy = wd.fAddBuddy;

        return S_OK;
    }

    return E_FAIL;
}

INT_PTR CALLBACK WatcherDialogProc | ( | HWND | hwndDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 353 of file rtcdialogs.cpp.

{
    WATCHER_DATA *pWD;
    pWD = (WATCHER_DATA *)GetWindowLong(hwndDlg, DWL_USER);

    switch (uMsg)
    {
    case WM_INITDIALOG:
        {
            // Store the WATCHER_DATA pointer in the
            // window's user data
            SetWindowLong(hwndDlg, DWL_USER, lParam);
            pWD = (WATCHER_DATA *)lParam;

            // Populate the watcher text
            SendDlgItemMessageW(hwndDlg, IDC_STATIC_WATCHER_NAME,
                WM_SETTEXT, 0, (LPARAM)(pWD->bstrName));

            SendDlgItemMessageW(hwndDlg, IDC_STATIC_WATCHER_URI,
                WM_SETTEXT, 0, (LPARAM)(pWD->bstrURI));

            // Check the add buddy box by default
            SendDlgItemMessage(hwndDlg, IDC_CHECK_WATCHER_ADD_BUDDY,
                                BM_SETCHECK, BST_CHECKED, 0);
        }
        return TRUE;

    case WM_COMMAND:
        switch (LOWORD(wParam))
        {
        case IDC_BUTTON_WATCHER_ALLOW:
            {
                pWD->fAddBuddy = (SendDlgItemMessage(
                                hwndDlg,
                                IDC_CHECK_WATCHER_ADD_BUDDY,
                                BM_GETCHECK,
                                0, 0) == BST_CHECKED);

                pWD->fAllow = TRUE;

                EndDialog(hwndDlg, IDOK);
            }
            return TRUE;

        case IDC_BUTTON_WATCHER_BLOCK:
            {
                pWD->fAddBuddy = (SendDlgItemMessage(
                                hwndDlg,
                                IDC_CHECK_WATCHER_ADD_BUDDY,
                                BM_GETSTATE,
                                0, 0) == BST_CHECKED);

                pWD->fAllow = FALSE;

                EndDialog(hwndDlg, IDOK);
            }
            return TRUE;

        case IDCANCEL:
            EndDialog(hwndDlg, wParam);
            return TRUE;
        }
    }

    return FALSE;
}

Generated on Wed Nov 13 2024 16:54:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/rtc/Client/CPP/rtcsample/rtcdialogs.h File Reference

  • NetDS
  • rtc
  • Client
  • CPP
  • rtcsample
Functions

rtcdialogs.h File Reference

Go to the source code of this file.

Functions

HRESULT | ShowAddressDialog (HWND hWndParent, PWSTR szTitle, BOOL fGetName, BSTR *pbstrURI, BSTR *pbstrName)
HRESULT | ShowAuthDialog (HWND hWndParent, BSTR bstrOldURI, BSTR *pbstrURI, BSTR *pbstrAccount, BSTR *pbstrPassword)
HRESULT | ShowLogonDialog (HWND hWndParent, BSTR *pbstrURI, BSTR *pbstrServer, BSTR *pbstrTransport)
HRESULT | ShowSessionDialog (HWND hwndParent, BSTR bstrName, BSTR bstrURI, BOOL *pfAccept)
HRESULT | ShowWatcherDialog (HWND hWndParent, BSTR bstrName, BSTR bstrURI, BOOL *pfAllow, BOOL *pfAddBuddy)

Function Documentation

HRESULT ShowAddressDialog | ( | HWND | hWndParent,
 |  | PWSTR | szTitle,
 |  | BOOL | fGetName,
 |  | BSTR * | pbstrURI,
 |  | BSTR * | pbstrName
 | ) |  |

Definition at line 538 of file rtcdialogs.cpp.

{
    int iRes;
    ADDRESS_DATA ad;

    ad.szTitle = szTitle;

    // Show the dialog
    iRes = DialogBoxParam(
        GetModuleHandle(NULL),
        MAKEINTRESOURCE(fGetName ? IDD_DIALOG_ADDRESS_NAME : IDD_DIALOG_ADDRESS),
        hWndParent,
        (DLGPROC)AddressDialogProc,
        (LPARAM)&ad
        );

    if (iRes == IDOK)
    {
        // Check for empty strings
        if (ad.szURI[0] == L'\0')
        {
            return E_FAIL;
        }

        *pbstrURI = SysAllocString(ad.szURI);

        if (!(*pbstrURI))
        {
            // Out of memory
            return E_OUTOFMEMORY;
        }

        if (fGetName)
        {
            *pbstrName = SysAllocString(ad.szName);

            if (!(*pbstrName))
            {
                // Out of memory
                SAFE_FREE_STRING(*pbstrURI);

                return E_OUTOFMEMORY;
            }
        }

        return S_OK;
    }

    return E_FAIL;
}

HRESULT ShowAuthDialog | ( | HWND | hWndParent,
 |  | BSTR | bstrOldURI,
 |  | BSTR * | pbstrURI,
 |  | BSTR * | pbstrAccount,
 |  | BSTR * | pbstrPassword
 | ) |  |

Definition at line 272 of file rtcdialogs.cpp.

{
    int iRes;
    AUTH_DATA ad;

    ad.bstrOldURI = bstrOldURI;

    // Show the dialog
    iRes = DialogBoxParam(
        GetModuleHandle(NULL),
        MAKEINTRESOURCE(IDD_DIALOG_AUTH),
        hWndParent,
        (DLGPROC)AuthDialogProc,
        (LPARAM)&ad
        );

    if (iRes == IDOK)
    {
        // Check for empty strings
        if ((ad.szUserURI[0] == L'\0') ||
            (ad.szAccount[0] == L'\0') ||
            (ad.szPassword[0] == L'\0'))
        {
            return E_FAIL;
        }

        // Cleanup the user URI
        CleanUserURI(ad.szUserURI);

        *pbstrURI = SysAllocString(ad.szUserURI);

        if (!(*pbstrURI))
        {
            // Out of memory
            return E_OUTOFMEMORY;
        }

        *pbstrAccount = SysAllocString(ad.szAccount);

        if (!(*pbstrAccount))
        {
            // Out of memory
            SAFE_FREE_STRING(*pbstrURI);
            return E_OUTOFMEMORY;
        }

        *pbstrPassword = SysAllocString(ad.szPassword);

        if (!(*pbstrPassword))
        {
            // Out of memory
            SAFE_FREE_STRING(*pbstrURI);
            SAFE_FREE_STRING(*pbstrAccount);
            return E_OUTOFMEMORY;
        }

        return S_OK;
    }

    return E_FAIL;
}

HRESULT ShowLogonDialog | ( | HWND | hWndParent,
 |  | BSTR * | pbstrURI,
 |  | BSTR * | pbstrServer,
 |  | BSTR * | pbstrTransport
 | ) |  |

Definition at line 124 of file rtcdialogs.cpp.

{
    int iRes;
    LOGON_DATA ld;

    // Show the dialog
    iRes = DialogBoxParam(
        GetModuleHandle(NULL),
        MAKEINTRESOURCE(IDD_DIALOG_LOGON),
        hWndParent,
        (DLGPROC)LogonDialogProc,
        (LPARAM)&ld
        );

    if (iRes == IDOK)
    {
        // Check for empty strings
        if ((ld.szUserURI[0] == L'\0') ||
            (ld.szServer[0] == L'\0') ||
            (ld.szTransport[0] == L'\0'))
        {
            return E_FAIL;
        }

        // Cleanup the user URI
        CleanUserURI(ld.szUserURI);

        *pbstrURI = SysAllocString(ld.szUserURI);

        if (!(*pbstrURI))
        {
            // Out of memory
            return E_OUTOFMEMORY;
        }

        *pbstrServer = SysAllocString(ld.szServer);

        if (!(*pbstrServer))
        {
            // Out of memory
            SAFE_FREE_STRING(*pbstrURI);
            return E_OUTOFMEMORY;
        }

        *pbstrTransport = SysAllocString(ld.szTransport);

        if (!(*pbstrTransport))
        {
            // Out of memory
            SAFE_FREE_STRING(*pbstrURI);
            SAFE_FREE_STRING(*pbstrServer);
            return E_OUTOFMEMORY;
        }

        return S_OK;
    }

    return E_FAIL;
}

HRESULT ShowSessionDialog | ( | HWND | hwndParent,
 |  | BSTR | bstrName,
 |  | BSTR | bstrURI,
 |  | BOOL * | pfAccept
 | ) |  |

Definition at line 666 of file rtcdialogs.cpp.

{
    int iRes;
    SESSION_DATA sd;

    sd.bstrName = bstrName;
    sd.bstrURI = bstrURI;

    // Show the dialog
    iRes = DialogBoxParam(
        GetModuleHandle(NULL),
        MAKEINTRESOURCE(IDD_DIALOG_SESSION),
        hWndParent,
        (DLGPROC)SessionDialogProc,
        (LPARAM)&sd
        );

    if (iRes == IDOK)
    {
        *pfAccept = sd.fAccept;

        return S_OK;
    }

    return E_FAIL;
}

HRESULT ShowWatcherDialog | ( | HWND | hWndParent,
 |  | BSTR | bstrName,
 |  | BSTR | bstrURI,
 |  | BOOL * | pfAllow,
 |  | BOOL * | pfAddBuddy
 | ) |  |

Definition at line 430 of file rtcdialogs.cpp.

{
    int iRes;
    WATCHER_DATA wd;

    wd.bstrName = bstrName;
    wd.bstrURI = bstrURI;

    // Show the dialog
    iRes = DialogBoxParam(
        GetModuleHandle(NULL),
        MAKEINTRESOURCE(IDD_DIALOG_WATCHER),
        hWndParent,
        (DLGPROC)WatcherDialogProc,
        (LPARAM)&wd
        );

    if (iRes == IDOK)
    {
        *pfAllow = wd.fAllow;
        *pfAddBuddy = wd.fAddBuddy;

        return S_OK;
    }

    return E_FAIL;
}

Generated on Wed Nov 13 2024 16:54:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/rtc/Client/CPP/rtcsample/rtcevents.h File Reference

  • NetDS
  • rtc
  • Client
  • CPP
  • rtcsample
Classes

rtcevents.h File Reference

Go to the source code of this file.

Classes

class CRTCEvents
Generated on Wed Nov 13 2024 16:54:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/rtc/Client/CPP/rtcsample/rtcim.cpp File Reference

  • NetDS
  • rtc
  • Client
  • CPP
  • rtcsample

rtcim.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/rtc/Client/CPP/rtcsample/rtcim.h File Reference

  • NetDS
  • rtc
  • Client
  • CPP
  • rtcsample
Classes

rtcim.h File Reference

Go to the source code of this file.

Classes

class CRTCIMSession
Generated on Wed Nov 13 2024 16:54:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/rtc/Client/CPP/rtcsample/rtcsample.cpp File Reference

  • NetDS
  • rtc
  • Client
  • CPP
  • rtcsample
Functions

rtcsample.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Functions

int APIENTRY WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

Function Documentation

int APIENTRY WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 11 of file rtcsample.cpp.

{
    HRESULT hr;

    // Initialize COM
    hr = CoInitialize(NULL);

    if (FAILED(hr))
    {
        // CoInitialize failed
        return 0;
    }

    // Initialize windows common controls
    InitCommonControls();

    // Load the rich edit library
    HMODULE hRichEdit;

    hRichEdit = LoadLibraryW(L"riched20.dll");

    if (hRichEdit == NULL)
    {
        // LoadLibrary failed
        return 0;
    }

    // Register the window classes
    CRTCWin::RegisterClass();
    CRTCIMSession::RegisterClass();
    CRTCAVSession::RegisterClass();

    // Create the main window
    HWND hWnd;

    hWnd = CreateWindowExW(
                0,
                APP_CLASS,
                APP_TITLE,
                WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
                CW_USEDEFAULT, CW_USEDEFAULT,
                APP_WIDTH, APP_HEIGHT,
                NULL,
                NULL,
                hInstance,
                NULL);

    if ( !hWnd )
    {
        // CreateWindowExW failed
        return 0;
    }

    // Make the main window visible
    ShowWindow( hWnd, nCmdShow );
    UpdateWindow( hWnd );

    // Message loop
    BOOL bRet;
    MSG msg;

    while( (bRet = GetMessage( &msg, NULL, 0, 0 )) != 0)
    {
        if (bRet == -1)
        {
            // GetMessage failed
            return 0;
        }
        else
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
    }

    // Free the rich edit library
    FreeLibrary(hRichEdit);

    // Shutdown COM
    CoUninitialize();

  return msg.wParam;
}

Generated on Wed Nov 13 2024 16:54:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/rtc/Client/CPP/rtcsample/rtcsession.cpp File Reference

  • NetDS
  • rtc
  • Client
  • CPP
  • rtcsample

rtcsession.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/rtc/Client/CPP/rtcsample/rtcsession.h File Reference

  • NetDS
  • rtc
  • Client
  • CPP
  • rtcsample
Classes

rtcsession.h File Reference

Go to the source code of this file.

Classes

class CRTCSession
Generated on Wed Nov 13 2024 16:54:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/rtc/Client/CPP/rtcsample/rtcwin.cpp File Reference

  • NetDS
  • rtc
  • Client
  • CPP
  • rtcsample

rtcwin.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/rtc/Client/CPP/rtcsample/rtcwin.h File Reference

  • NetDS
  • rtc
  • Client
  • CPP
  • rtcsample
Classes | Defines

rtcwin.h File Reference

Go to the source code of this file.

Classes

class | CRTCWin

Defines

#define | WM_RTC_EVENT WM_USER+100

Define Documentation

#define WM_RTC_EVENT WM_USER+100

Definition at line 9 of file rtcwin.h.

Generated on Wed Nov 13 2024 16:54:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/rtc/Client/CPP/rtcsample/StdAfx.cpp File Reference

  • NetDS
  • rtc
  • Client
  • CPP
  • rtcsample

StdAfx.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/rtc/Client/CPP/rtcsample/StdAfx.h File Reference

  • NetDS
  • rtc
  • Client
  • CPP
  • rtcsample
Defines

StdAfx.h File Reference

#include <windows.h>
#include <stdio.h>
#include <commctrl.h>
#include <richedit.h>
#include <tchar.h>
#include <rtccore.h>
#include <rtcerr.h>
#include <string.h>
#include <vector>
#include "rtcwin.h"
#include "rtcevents.h"
#include "rtcdialogs.h"
#include "rtcsession.h"
#include "rtcim.h"
#include "rtcav.h"
#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Defines

#define | _UNICODE
#define | APP_CLASS L"RTCAPP"
#define | APP_HEIGHT 400
#define | APP_TITLE L"RTC Sample"
#define | APP_WIDTH 250
#define | AV_CLASS L"RTCAV"
#define | AV_HEIGHT 355
#define | AV_TITLE L"RTC Audio/Video Call"
#define | AV_WIDTH 250
#define | IM_CLASS L"RTCIM"
#define | IM_HEIGHT 400
#define | IM_TITLE L"RTC Message"
#define | IM_WIDTH 400
#define | MAX_STRING 256
#define | MAX_XML_STRING 4096
#define | QCIF_CX_SIZE 176
#define | QCIF_CY_SIZE 144
#define | QQCIF_CX_SIZE (QCIF_CX_SIZE/2)
#define | QQCIF_CY_SIZE (QCIF_CY_SIZE/2)
#define | SAFE_FREE_STRING(x) {if(x){SysFreeString(x);(x)=NULL;}}
#define | SAFE_RELEASE(x) {if(x){(x)->Release();(x)=NULL;}}
#define | UNICODE
#define | WIN32_LEAN_AND_MEAN

Define Documentation

#define _UNICODE

Definition at line 24 of file StdAfx.h.

#define APP_CLASS L"RTCAPP"

Definition at line 29 of file StdAfx.h.

#define APP_HEIGHT 400

Definition at line 31 of file StdAfx.h.

#define APP_TITLE L"RTC Sample"

Definition at line 28 of file StdAfx.h.

#define APP_WIDTH 250

Definition at line 30 of file StdAfx.h.

#define AV_CLASS L"RTCAV"

Definition at line 41 of file StdAfx.h.

#define AV_HEIGHT 355

Definition at line 43 of file StdAfx.h.

#define AV_TITLE L"RTC Audio/Video Call"

Definition at line 40 of file StdAfx.h.

#define AV_WIDTH 250

Definition at line 42 of file StdAfx.h.

#define IM_CLASS L"RTCIM"

Definition at line 35 of file StdAfx.h.

#define IM_HEIGHT 400

Definition at line 37 of file StdAfx.h.

#define IM_TITLE L"RTC Message"

Definition at line 34 of file StdAfx.h.

#define IM_WIDTH 400

Definition at line 36 of file StdAfx.h.

#define MAX_STRING 256

Definition at line 46 of file StdAfx.h.

#define MAX_XML_STRING 4096

Definition at line 47 of file StdAfx.h.

#define QCIF_CX_SIZE 176

Definition at line 50 of file StdAfx.h.

#define QCIF_CY_SIZE 144

Definition at line 51 of file StdAfx.h.

#define QQCIF_CX_SIZE (QCIF_CX_SIZE/2)

Definition at line 52 of file StdAfx.h.

#define QQCIF_CY_SIZE (QCIF_CY_SIZE/2)

Definition at line 53 of file StdAfx.h.

#define SAFE_FREE_STRING ( x ) {if(x){SysFreeString(x);(x)=NULL;}}

Definition at line 57 of file StdAfx.h.

#define SAFE_RELEASE ( x ) {if(x){(x)->Release();(x)=NULL;}}

Definition at line 56 of file StdAfx.h.

#define UNICODE

Definition at line 20 of file StdAfx.h.

#define WIN32_LEAN_AND_MEAN

Definition at line 15 of file StdAfx.h.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Snmp/SnmpUtil/SnmpUtil.C File Reference

  • NetDS
  • Snmp
  • SnmpUtil
Defines | Functions

SnmpUtil.C File Reference

#include <windows.h>
#include <stdio.h>
#include <string.h>
#include <snmp.h>
#include <mgmtapi.h>

Go to the source code of this file.

Defines

#define | GET 1
#define | GETNEXT 2
#define | RETRIES 3
#define | TIMEOUT 6000
#define | TRAP 4
#define | WALK 3

Functions

INT _CRTAPI1 | main (IN int argumentCount, IN char *argumentVector[])

Define Documentation

#define GET 1

Definition at line 51 of file SnmpUtil.C.

#define GETNEXT 2

Definition at line 52 of file SnmpUtil.C.

#define RETRIES 3

Definition at line 57 of file SnmpUtil.C.

#define TIMEOUT 6000

Definition at line 56 of file SnmpUtil.C.

#define TRAP 4

Definition at line 54 of file SnmpUtil.C.

#define WALK 3

Definition at line 53 of file SnmpUtil.C.

Function Documentation

INT _CRTAPI1 main | ( | IN int | argumentCount,
 |  | IN char * | argumentVector[]
 | ) |  |

Definition at line 61 of file SnmpUtil.C.

    {
    INT                operation;
    LPSTR              agent;
    LPSTR              community;
    RFC1157VarBindList variableBindings;
    LPSNMP_MGR_SESSION session;

    INT        timeout = TIMEOUT;
    INT        retries = RETRIES;

    BYTE       requestType;
    AsnInteger errorStatus;
    AsnInteger errorIndex;

    // Parse command line arguments to determine requested operation.

    // Verify number of arguments...
    if      (argumentCount < 5 && argumentCount != 2)
        {
        printf("Error:  Incorrect number of arguments specified.\n");
        printf(
"\nusage:  snmputil [get|getnext|walk] agent community oid [oid ...]\n");
        printf(
  "        snmputil trap\n");

        return 1;
        }

    // Get/verify operation...
    argumentVector++;
    argumentCount--;
    if      (!strcmp(*argumentVector, "get"))
        operation = GET;
    else if (!strcmp(*argumentVector, "getnext"))
        operation = GETNEXT;
    else if (!strcmp(*argumentVector, "walk"))
        operation = WALK;
    else if (!strcmp(*argumentVector, "trap"))
        operation = TRAP;
    else
        {
        printf("Error:  Invalid operation, '%s', specified.\n",
               *argumentVector);

        return 1;
        }

    if (operation != TRAP)
        {
        if (argumentCount < 4)
            {
            printf("Error:  Incorrect number of arguments specified.\n");
            printf(
"\nusage:  snmputil [get|getnext|walk] agent community oid [oid ...]\n");
            printf(
  "        snmputil trap\n");

            return 1;
            }

        // Get agent address...
        argumentVector++;
        argumentCount--;
        agent = (LPSTR)SnmpUtilMemAlloc((UINT)(strlen(*argumentVector) + 1));
        if (agent != NULL)
            strcpy(agent, *argumentVector);
        else
            {
            printf("Error: SnmpUtilMemAlloc failed to allocate memory.\n");
            return 1;
            }

        // Get agent community...
        argumentVector++;
        argumentCount--;
        community = (LPSTR)SnmpUtilMemAlloc((UINT)(strlen(*argumentVector) + 1));
        if (community != NULL)
            strcpy(community, *argumentVector);
        else
            {
            printf("Error: SnmpUtilMemAlloc failed to allocate memory.\n");
            SnmpUtilMemFree(agent);
            return 1;
            }

        // Get oid's...
        variableBindings.list = NULL;
        variableBindings.len = 0;

        while(--argumentCount)
            {
            AsnObjectIdentifier reqObject;
            RFC1157VarBind * tmpVb;

            argumentVector++;

            // Convert the string representation to an internal representation.
            if (!SnmpMgrStrToOid(*argumentVector, &reqObject))
                {
                printf("Error: Invalid oid, %s, specified.\n", *argumentVector);
                SnmpUtilMemFree(agent);
                SnmpUtilMemFree(community);
                SnmpUtilVarBindListFree(&variableBindings);
                return 1;
                }
            else
                {
                // Since sucessfull, add to the variable bindings list.
                variableBindings.len++;
                if ((tmpVb = (RFC1157VarBind *)SnmpUtilMemReAlloc(
                    variableBindings.list, sizeof(RFC1157VarBind) *
                    variableBindings.len)) == NULL)
                    {
                    printf("Error: Error allocating oid, %s.\n",
                           *argumentVector);
                    SnmpUtilMemFree(agent);
                    SnmpUtilMemFree(community);
                    SnmpUtilOidFree(&reqObject);
                    variableBindings.len--;
                    SnmpUtilVarBindListFree(&variableBindings);

                    return 1;
                    }
                variableBindings.list = tmpVb;

                variableBindings.list[variableBindings.len - 1].name =
                    reqObject; // NOTE!  structure copy
                variableBindings.list[variableBindings.len - 1].value.asnType =
                    ASN_NULL;
                }
            } // end while()

        // Make sure only one variable binding was specified if operation
        // is WALK.
        if (operation == WALK && variableBindings.len != 1)
            {
            printf("Error: Multiple oids specified for WALK.\n");
            SnmpUtilMemFree(agent);
            SnmpUtilMemFree(community);
            SnmpUtilVarBindListFree(&variableBindings);
            return 1;
            }

        // Establish a SNMP session to communicate with the remote agent.  The
        // community, communications timeout, and communications retry count
        // for the session are also required.

        if ((session = SnmpMgrOpen(agent, community, timeout, retries)) == NULL)
            {
            printf("error on SnmpMgrOpen %d\n", GetLastError());
            SnmpUtilMemFree(agent);
            SnmpUtilMemFree(community);
            SnmpUtilVarBindListFree(&variableBindings);

            return 1;
            }

        } // end if(TRAP)

    // Determine and perform the requested operation.

    if      (operation == GET || operation == GETNEXT)
        {
        // Get and GetNext are relatively simple operations to perform.
        // Simply initiate the request and process the result and/or
        // possible error conditions.

        if (operation == GET)
            requestType = ASN_RFC1157_GETREQUEST;
        else
            requestType = ASN_RFC1157_GETNEXTREQUEST;

        // Request that the API carry out the desired operation.

        if (!SnmpMgrRequest(session, requestType, &variableBindings,
                            &errorStatus, &errorIndex))
            {
            // The API is indicating an error.

            printf("error on SnmpMgrRequest %d\n", GetLastError());
            }
        else
            {
            // The API succeeded, errors may be indicated from the remote
            // agent.

            if (errorStatus > 0)
                {
                printf("Error: errorStatus=%d, errorIndex=%d\n",
                       errorStatus, errorIndex);
                }
            else
                {
                // Display the resulting variable bindings.

                UINT i;

                for(i=0; i < variableBindings.len; i++)
                    {
                    char *string = NULL;

                    if (SnmpMgrOidToStr(&variableBindings.list[i].name, &string))
                        {
                        printf("Variable = %s\n", string);
                        if (string) SnmpUtilMemFree(string);
                        }
                    printf("Value    = ");
                    SnmpUtilPrintAsnAny(&variableBindings.list[i].value);

                    printf("\n");
                    } // end for()
                }
            }

        // Free the variable bindings that have been allocated.

        SnmpUtilVarBindListFree(&variableBindings);

        // Free other allocated resources

        SnmpUtilMemFree(agent);
        SnmpUtilMemFree(community);

        }
    else if (operation == WALK)
        {
        // Walk is a common term used to indicate that all MIB variables
        // under a given OID are to be traversed and displayed.  This is
        // a more complex operation requiring tests and looping in addition
        // to the steps for get/getnext above.

        AsnObjectIdentifier root;
        AsnObjectIdentifier tempOid;

        if (!SnmpUtilOidCpy(&root, &variableBindings.list[0].name))
            {
            printf("error on SnmpUtilOidCpy\n");
            SnmpUtilMemFree(agent);
            SnmpUtilMemFree(community);
            SnmpUtilVarBindListFree(&variableBindings);
            return 1;
            }

        requestType = ASN_RFC1157_GETNEXTREQUEST;

        while(1)
            {
            if (!SnmpMgrRequest(session, requestType, &variableBindings,
                &errorStatus, &errorIndex))
                {
                // The API is indicating an error.

                printf("error on SnmpMgrRequest %d\n", GetLastError());

                break;
                }
            else
                {
                // The API succeeded, errors may be indicated from the remote
                // agent.

                // Test for end of subtree or end of MIB.

                if (errorStatus == SNMP_ERRORSTATUS_NOSUCHNAME ||
                    SnmpUtilOidNCmp(&variableBindings.list[0].name,
                    &root, root.idLength))
                    {
                    printf("End of MIB subtree.\n\n");

                    break;
                    }

                // Test for general error conditions or sucesss.

                if (errorStatus > 0)
                    {
                    printf("Error: errorStatus=%d, errorIndex=%d \n",
                        errorStatus, errorIndex);

                    break;
                    }
                else
                    {
                    // Display resulting variable binding for this iteration.

                    char *string = NULL;

                    if (SnmpMgrOidToStr(&variableBindings.list[0].name, &string))
                        {
                        printf("Variable = %s\n", string);
                        if (string) SnmpUtilMemFree(string);
                        }
                    printf("Value    = ");
                    SnmpUtilPrintAsnAny(&variableBindings.list[0].value);

                    printf("\n");
                    }
                } // end if()

            // Prepare for the next iteration.  Make sure returned oid is
            // preserved and the returned value is freed.

            if (!SnmpUtilOidCpy(&tempOid, &variableBindings.list[0].name))
                {
                printf("error on SnmpUtilOidCpy\n");
                SnmpUtilOidFree(&root);
                SnmpUtilMemFree(agent);
                SnmpUtilMemFree(community);
                SnmpUtilVarBindListFree(&variableBindings);
                return 1;
                }

            SnmpUtilVarBindFree(&variableBindings.list[0]);

            if (!SnmpUtilOidCpy(&variableBindings.list[0].name, &tempOid))
                {
                printf("error on SnmpUtilOidCpy\n");
                SnmpUtilOidFree(&tempOid);
                SnmpUtilOidFree(&root);
                SnmpUtilMemFree(agent);
                SnmpUtilMemFree(community);
                SnmpUtilVarBindListFree(&variableBindings);
                return 1;
                }
            variableBindings.list[0].value.asnType = ASN_NULL;

            SnmpUtilOidFree(&tempOid);

        } // end while()

        // Free the variable bindings that have been allocated.

        SnmpUtilVarBindListFree(&variableBindings);

        // Free other allocated resources

        SnmpUtilOidFree(&root);
        SnmpUtilMemFree(agent);
        SnmpUtilMemFree(community);

    }
    else if (operation == TRAP)
        {
        // Trap handling can be done two different ways: event driven or
        // polled.  The following code illustrates the steps to use event
        // driven trap reception in a management application.

        HANDLE hNewTraps = NULL;

        if (!SnmpMgrTrapListen(&hNewTraps))
            {
            printf("error on SnmpMgrTrapListen %d\n", GetLastError());
            return 1;
            }
        else
            {
            printf("snmputil: listening for traps...\n");
            }

        while(1)
            {
            DWORD dwResult;

            if ((dwResult = WaitForSingleObject(hNewTraps, INFINITE))
                == WAIT_FAILED)
                {
                printf("error on WaitForSingleObject %d\n",
                       GetLastError());
                }
            else if (dwResult != WAIT_OBJECT_0)
                {
                    printf("hNewTraps is not signaled\n");
                }
            else if (!ResetEvent(hNewTraps))
                {
                printf("error on ResetEvent %d\n", GetLastError());
                }
            else
                {
                AsnObjectIdentifier enterprise;
                AsnNetworkAddress   agentAddress;
                AsnNetworkAddress   sourceAddress;
                AsnInteger          genericTrap;
                AsnInteger          specificTrap;
                AsnOctetString      communityTrap;
                AsnTimeticks        timeStamp;
                RFC1157VarBindList  variableBindingsTrap;

                UINT i;

                while(SnmpMgrGetTrapEx(
                        &enterprise,
                        &agentAddress,
                        &sourceAddress,
                        &genericTrap,
                        &specificTrap,
                        &communityTrap,
                        &timeStamp,
                        &variableBindingsTrap))
                    {

                    LPSTR string = NULL;

                    printf("Incoming Trap:\n"
                           "  generic    = %d\n"
                           "  specific   = %d\n"
                           "  timeStamp  = %u\n",
                           genericTrap,
                           specificTrap,
                           timeStamp);

                    if (SnmpMgrOidToStr(&enterprise, &string))
                        {
                        printf ("  enterprise = %s\n", string);
                        if (string)
                            SnmpUtilMemFree(string);
                        }
                    SnmpUtilOidFree(&enterprise);

                    if (agentAddress.length == 4)
                        {
                        printf ("  agent      = %d.%d.%d.%d\n",
                             (int)agentAddress.stream[0],
                             (int)agentAddress.stream[1],
                             (int)agentAddress.stream[2],
                             (int)agentAddress.stream[3]);
                        }
                    if (agentAddress.dynamic)
                        {
                        SnmpUtilMemFree(agentAddress.stream);
                        }

                    if (sourceAddress.length == 4)
                        {
                        printf ("  source IP  = %d.%d.%d.%d\n",
                             (int)sourceAddress.stream[0],
                             (int)sourceAddress.stream[1],
                             (int)sourceAddress.stream[2],
                             (int)sourceAddress.stream[3]);
                        }
                    else if (sourceAddress.length == 10)
                        {
                        printf ("  source IPX = %.2x%.2x%.2x%.2x."
                                "%.2x%.2x%.2x%.2x%.2x%.2x\n",
                             (int)sourceAddress.stream[0],
                             (int)sourceAddress.stream[1],
                             (int)sourceAddress.stream[2],
                             (int)sourceAddress.stream[3],
                             (int)sourceAddress.stream[4],
                             (int)sourceAddress.stream[5],
                             (int)sourceAddress.stream[6],
                             (int)sourceAddress.stream[7],
                             (int)sourceAddress.stream[8],
                             (int)sourceAddress.stream[9]);
                        }
                    if (sourceAddress.dynamic)
                        {
                        SnmpUtilMemFree(sourceAddress.stream);
                        }

                    if (communityTrap.length)
                        {
                        string = (LPSTR)SnmpUtilMemAlloc (communityTrap.length + 1);
                        if (string)
                            {
                            memcpy (string, communityTrap.stream, communityTrap.length);
                            string[communityTrap.length] = '\0';
                            printf ("  community  = %s\n", string);
                            SnmpUtilMemFree(string);
                            }
                        }
                    if (communityTrap.dynamic)
                        {
                        SnmpUtilMemFree(communityTrap.stream);
                        }

                    for(i=0; i < variableBindingsTrap.len; i++)
                        {

                        string = NULL;
                        if (SnmpMgrOidToStr(&variableBindingsTrap.list[i].name, &string))
                            {
                            printf("  variable   = %s\n", string);
                            if (string) SnmpUtilMemFree(string);
                            }

                        printf("  value      = ");
                        SnmpUtilPrintAsnAny(&variableBindingsTrap.list[i].value);
                        } // end for()
                    printf("\n");

                    SnmpUtilVarBindListFree(&variableBindingsTrap);
                    }

                dwResult = GetLastError(); // check for errors...

                if ((dwResult != NOERROR) && (dwResult != SNMP_MGMTAPI_NOTRAPS))
                    {
                    printf("error on SnmpMgrGetTrap %d\n", dwResult);
                    }
                }

            } // end while()

        } // end if(operation)

    if (operation != TRAP)
        {
        // Close SNMP session with the remote agent.

        if (!SnmpMgrClose(session))
            {
            printf("error on SnmpMgrClose %d\n", GetLastError());

            return 1;
            }
        }

    // Let the command interpreter know things went ok.

    return 0;

    }

Generated on Wed Nov 13 2024 16:54:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Snmp/TestDll/TestDll.C File Reference

  • NetDS
  • Snmp
  • TestDll
Functions | Variables

TestDll.C File Reference

#include <windows.h>
#include <snmp.h>
#include "testmib.h"

Go to the source code of this file.

Functions

BOOL WINAPI | DllMain (HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
BOOL WINAPI | SnmpExtensionInit (IN DWORD dwTimeZeroReference, OUT HANDLE *hPollForTrapEvent, OUT AsnObjectIdentifier *supportedView)
BOOL WINAPI | SnmpExtensionQuery (IN BYTE requestType, IN OUT RFC1157VarBindList *variableBindings, OUT AsnInteger *errorStatus, OUT AsnInteger *errorIndex)
BOOL WINAPI | SnmpExtensionTrap (OUT AsnObjectIdentifier *enterprise, OUT AsnInteger *genericTrap, OUT AsnInteger *specificTrap, OUT AsnTimeticks *timeStamp, OUT RFC1157VarBindList *variableBindings)

Variables

DWORD | dwTimeZero = 0
HANDLE | hSimulateTrap = NULL

Function Documentation

BOOL WINAPI DllMain | ( | HANDLE | hDll,
 |  | DWORD | dwReason,
 |  | LPVOID | lpReserved
 | ) |  |

Definition at line 70 of file TestDll.C.

    {
    switch(dwReason)
        {
        case DLL_PROCESS_ATTACH:
        case DLL_PROCESS_DETACH:
        case DLL_THREAD_ATTACH:
        case DLL_THREAD_DETACH:
        default:
            break;

        } // end switch()

    return TRUE;

    } // end DllEntryPoint()

BOOL WINAPI SnmpExtensionInit | ( | IN DWORD | dwTimeZeroReference,
 |  | OUT HANDLE * | hPollForTrapEvent,
 |  | OUT AsnObjectIdentifier * | supportedView
 | ) |  |

Definition at line 98 of file TestDll.C.

    {

    // Record the time reference provided by the Extendible Agent.

    dwTimeZero = dwTimeZeroReference;

    // Create an Event that will be used to communicate the occurence of traps
    // to the Extendible Agent.  The Extension Agent will assert this Event
    // when a trap has occured.  This is explained further later in this file.

    if ((*hPollForTrapEvent = CreateEvent(NULL, FALSE, FALSE, NULL)) == NULL)
        {
        // Indicate error?, be sure that NULL is returned to Extendible Agent.
        }

    // Indicate the MIB view supported by this Extension Agent, an object
    // identifier representing the sub root of the MIB that is supported.

    *supportedView = MIB_OidPrefix; // NOTE!  structure copy

    // Record the trap Event.  This example Extension Agent simulates traps by
    // generating a trap after every given number of processed requests.

    hSimulateTrap = *hPollForTrapEvent;

    // Indicate that Extension Agent initialization was sucessfull.

    return TRUE;

    } // end SnmpExtensionInit()

BOOL WINAPI SnmpExtensionQuery | ( | IN BYTE | requestType,
 |  | IN OUT RFC1157VarBindList * | variableBindings,
 |  | OUT AsnInteger * | errorStatus,
 |  | OUT AsnInteger * | errorIndex
 | ) |  |

Definition at line 215 of file TestDll.C.

    {
    static unsigned long requestCount = 0;  // Supports the trap simulation.
    UINT    I;

    // Iterate through the variable bindings list to resolve individual
    // variable bindings.

    for ( I=0;I < variableBindings->len;I++ )
        {
        *errorStatus = ResolveVarBind( &variableBindings->list[I],
                                       requestType );

        // Test and handle case where Get Next past end of MIB view supported
        // by this Extension Agent occurs.  Special processing is required to
        // communicate this situation to the Extendible Agent so it can take
        // appropriate action, possibly querying other Extension Agents.

        if ( *errorStatus == SNMP_ERRORSTATUS_NOSUCHNAME &&
             requestType == MIB_ACTION_GETNEXT )
           {
           *errorStatus = SNMP_ERRORSTATUS_NOERROR;

           // Modify variable binding of such variables so the OID points
           // just outside the MIB view supported by this Extension Agent.
           // The Extendible Agent tests for this, and takes appropriate
           // action.

           SnmpUtilOidFree( &variableBindings->list[I].name );
           SnmpUtilOidCpy( &variableBindings->list[I].name, &MIB_OidPrefix );
           variableBindings->list[I].name.ids[MIB_PREFIX_LEN-1] ++;
           }

        // If an error was indicated, communicate error status and error
        // index to the Extendible Agent.  The Extendible Agent will ensure
        // that the origional variable bindings are returned in the response
        // packet.

        if ( *errorStatus != SNMP_ERRORSTATUS_NOERROR )
           {
     *errorIndex = I+1;
     goto Exit;
     }
        }

Exit:

    // Supports the trap simulation.

    if (++requestCount % 3 == 0 && hSimulateTrap != NULL)
        SetEvent(hSimulateTrap);

    // Indicate that Extension Agent processing was sucessfull.

    return SNMPAPI_NOERROR;

    } // end SnmpExtensionQuery()

BOOL WINAPI SnmpExtensionTrap | ( | OUT AsnObjectIdentifier * | enterprise,
 |  | OUT AsnInteger * | genericTrap,
 |  | OUT AsnInteger * | specificTrap,
 |  | OUT AsnTimeticks * | timeStamp,
 |  | OUT RFC1157VarBindList * | variableBindings
 | ) |  |

Definition at line 145 of file TestDll.C.

    {
    // The body of this routine is an extremely simple example/simulation of
    // the trap functionality.  A real implementation will be more complex.

    // The following define data inserted into the trap below.  The Lan Manager
    // bytesAvailAlert from the Lan Manager Alerts-2 MIB is generated with an
    // empty variable bindings list.

    static UINT OidList[]  = { 1, 3, 6, 1, 4, 1, 77, 2 };
    static UINT OidListLen = 8;

    // The following variable is used for the simulation, it allows a single
    // trap to be generated and then causes FALSE to be returned indicating
    // no more traps.

    static whichTime = 0;

    // The following if/else support the simulation.

    if (whichTime == 0)
        {
        whichTime = 1;    // Supports the simulation.

        // Communicate the trap data to the Extendible Agent.

        enterprise->idLength = OidListLen;
        enterprise->ids = OidList;

        *genericTrap      = SNMP_GENERICTRAP_ENTERSPECIFIC;

        *specificTrap     = 1;                    // the bytesAvailAlert trap

        *timeStamp        = GetCurrentTime() - dwTimeZero;

        variableBindings->list = NULL;
        variableBindings->len  = 0;

        // Indicate that valid trap data exists in the parameters.

        return TRUE;
        }
    else
        {
        whichTime = 0;    // Supports the simulation.

        // Indicate that no more traps are available and parameters do not
        // refer to any valid data.

        return FALSE;
        }

    } // end SnmpExtensionTrap()

Variable Documentation

DWORD dwTimeZero = 0

Definition at line 54 of file TestDll.C.

HANDLE hSimulateTrap = NULL

Definition at line 63 of file TestDll.C.

Generated on Wed Nov 13 2024 16:54:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Snmp/TestDll/TestMIB.C File Reference

  • NetDS
  • Snmp
  • TestDll
Functions | Variables

TestMIB.C File Reference

#include <windows.h>
#include <snmp.h>
#include "testmib.h"

Go to the source code of this file.

Functions

UINT | MIB_control_func (IN UINT Action, IN MIB_ENTRY *MibPtr, IN RFC1157VarBind *VarBind)
UINT | MIB_doneness_func (IN UINT Action, IN MIB_ENTRY *MibPtr, IN RFC1157VarBind *VarBind)
UINT | MIB_leaf_func (IN UINT Action, IN MIB_ENTRY *MibPtr, IN RFC1157VarBind *VarBind)
UINT | MIB_toasttype_func (IN UINT Action, IN MIB_ENTRY *MibPtr, IN RFC1157VarBind *VarBind)
UINT | ResolveVarBind (IN OUT RFC1157VarBind *VarBind, IN UINT PduAction)

Variables

MIB_ENTRY Mib []
UINT | MIB_num_variables = sizeof Mib / sizeof( MIB_ENTRY )
AsnObjectIdentifier | MIB_OidPrefix = { OID_SIZEOF(OID_Prefix), OID_Prefix }
UINT | MIB_toaster [] = { 2 }
UINT | MIB_toasterControl [] = { 2, 3, 0 }
AsnInteger | MIB_toasterControlStor = 1
UINT | MIB_toasterDoneness [] = { 2, 4, 0 }
AsnInteger | MIB_toasterDonenessStor = 2
char | MIB_toasterManStor [] = "Microsoft Corporation"
UINT | MIB_toasterManufacturer [] = { 2, 1, 0 }
UINT | MIB_toasterModelNumber [] = { 2, 2, 0 }
char | MIB_toasterModelStor [] = "Example SNMP Extension Agent for Windows/NT (TOASTER-MIB)."
UINT | MIB_toasterToastType [] = { 2, 5, 0 }
AsnInteger | MIB_toasterToastTypeStor = 3
UINT | OID_Prefix [] = { 1, 3, 6, 1, 4, 1, 12 }

Function Documentation

UINT MIB_control_func | ( | IN UINT | Action,
 |  | IN MIB_ENTRY * | MibPtr,
 |  | IN RFC1157VarBind * | VarBind
 | ) |  |

Definition at line 448 of file TestMIB.C.

{
UINT   ErrStat;

   switch ( Action )
      {
      case MIB_ACTION_SET:
         // Make sure that this variable's ACCESS is SET'able
   if ( MibPtr->Access != MIB_ACCESS_READWRITE &&
        MibPtr->Access != MIB_ACCESS_WRITE )
      {
      ErrStat = SNMP_ERRORSTATUS_NOSUCHNAME;
            goto Exit;
      }

         // Check for proper type before setting
         if ( MibPtr->Type != VarBind->value.asnType )
      {
      ErrStat = SNMP_ERRORSTATUS_BADVALUE;
      goto Exit;
      }

         // Make sure the value is valid
         if ( MIB_TOASTER_UP > VarBind->value.asnValue.number ||
              MIB_TOASTER_DOWN < VarBind->value.asnValue.number )
            {
      ErrStat = SNMP_ERRORSTATUS_BADVALUE;
      goto Exit;
            }

         // Let fall through purposefully for further processing by
         // generic leaf function.

      case MIB_ACTION_GETNEXT:
      case MIB_ACTION_GET:
   // Call the more generic function to perform the action
         ErrStat = MIB_leaf_func( Action, MibPtr, VarBind );
         break;

      default:
   ErrStat = SNMP_ERRORSTATUS_GENERR;
   goto Exit;
      } // switch

Exit:
   return ErrStat;
} // MIB_control_func

UINT MIB_doneness_func | ( | IN UINT | Action,
 |  | IN MIB_ENTRY * | MibPtr,
 |  | IN RFC1157VarBind * | VarBind
 | ) |  |

Definition at line 515 of file TestMIB.C.

{
UINT   ErrStat;

   switch ( Action )
      {
      case MIB_ACTION_SET:
         // Make sure that this variable's ACCESS is SET'able
   if ( MibPtr->Access != MIB_ACCESS_READWRITE &&
        MibPtr->Access != MIB_ACCESS_WRITE )
      {
      ErrStat = SNMP_ERRORSTATUS_NOSUCHNAME;
            goto Exit;
      }

         // Check for proper type before setting
         if ( MibPtr->Type != VarBind->value.asnType )
      {
      ErrStat = SNMP_ERRORSTATUS_BADVALUE;
      goto Exit;
      }

         // Make sure the value is valid
         if ( MIB_TOASTER_LIGHTLYWARM > VarBind->value.asnValue.number ||
              MIB_TOASTER_BURNT < VarBind->value.asnValue.number )
            {
      ErrStat = SNMP_ERRORSTATUS_BADVALUE;
      goto Exit;
            }

         // Let fall through purposefully for further processing by
         // generic leaf function.

      case MIB_ACTION_GETNEXT:
      case MIB_ACTION_GET:
   // Call the more generic function to perform the action
         ErrStat = MIB_leaf_func( Action, MibPtr, VarBind );
         break;

      default:
   ErrStat = SNMP_ERRORSTATUS_GENERR;
   goto Exit;
      } // switch

Exit:
   return ErrStat;
} // MIB_doneness_func

UINT MIB_leaf_func | ( | IN UINT | Action,
 |  | IN MIB_ENTRY * | MibPtr,
 |  | IN RFC1157VarBind * | VarBind
 | ) |  |

Definition at line 303 of file TestMIB.C.

{
UINT   ErrStat;

   switch ( Action )
      {
      case MIB_ACTION_GETNEXT:
   // If there is no GET-NEXT pointer, this is the end of this MIB
   if ( MibPtr->MibNext == NULL )
      {
      ErrStat = SNMP_ERRORSTATUS_NOSUCHNAME;
      goto Exit;
      }

         // Setup var bind name of NEXT MIB variable
         SnmpUtilOidFree( &VarBind->name );
         SnmpUtilOidCpy( &VarBind->name, &MIB_OidPrefix );
         SnmpUtilOidAppend( &VarBind->name, &MibPtr->MibNext->Oid );

         // Call function to process request.  Each MIB entry has a function
   // pointer that knows how to process its MIB variable.
         ErrStat = (*MibPtr->MibNext->MibFunc)( MIB_ACTION_GET,
                                          MibPtr->MibNext, VarBind );
         break;

      case MIB_ACTION_GET:
         // Make sure that this variable's ACCESS is GET'able
   if ( MibPtr->Access != MIB_ACCESS_READ &&
        MibPtr->Access != MIB_ACCESS_READWRITE )
      {
      ErrStat = SNMP_ERRORSTATUS_NOSUCHNAME;
      goto Exit;
      }

   // Setup varbind's return value
   VarBind->value.asnType = MibPtr->Type;
   switch ( VarBind->value.asnType )
      {
            case ASN_RFC1155_COUNTER:
            case ASN_RFC1155_GAUGE:
            case ASN_INTEGER:
               VarBind->value.asnValue.number = *(AsnInteger *)(MibPtr->Storage);
         break;

            case ASN_OCTETSTRING: // This entails ASN_RFC1213_DISPSTRING also
         VarBind->value.asnValue.string.length =
                                 (int)(strlen( (LPSTR)MibPtr->Storage ));

         if ( NULL ==
                    (VarBind->value.asnValue.string.stream =
                    SnmpUtilMemAlloc(VarBind->value.asnValue.string.length *
                           sizeof(char))) )
            {
            ErrStat = SNMP_ERRORSTATUS_GENERR;
            goto Exit;
            }

         memcpy( VarBind->value.asnValue.string.stream,
                 (LPSTR)MibPtr->Storage,
                 VarBind->value.asnValue.string.length );
         VarBind->value.asnValue.string.dynamic = TRUE;

         break;

      default:
         ErrStat = SNMP_ERRORSTATUS_GENERR;
         goto Exit;
      }

   break;

      case MIB_ACTION_SET:
         // Make sure that this variable's ACCESS is SET'able
   if ( MibPtr->Access != MIB_ACCESS_READWRITE &&
        MibPtr->Access != MIB_ACCESS_WRITE )
      {
      ErrStat = SNMP_ERRORSTATUS_NOSUCHNAME;
            goto Exit;
      }

         // Check for proper type before setting
         if ( MibPtr->Type != VarBind->value.asnType )
      {
      ErrStat = SNMP_ERRORSTATUS_BADVALUE;
      goto Exit;
      }

   // Save value in MIB
   switch ( VarBind->value.asnType )
      {
            case ASN_RFC1155_COUNTER:
            case ASN_RFC1155_GAUGE:
            case ASN_INTEGER:
               *(AsnInteger *)(MibPtr->Storage) = VarBind->value.asnValue.number;
         break;

            case ASN_OCTETSTRING: // This entails ASN_RFC1213_DISPSTRING also
               // The storage must be adequate to contain the new string
               // including a NULL terminator.
               memcpy( (LPSTR)MibPtr->Storage,
                       VarBind->value.asnValue.string.stream,
                       VarBind->value.asnValue.string.length );

         ((LPSTR)MibPtr->Storage)[VarBind->value.asnValue.string.length] =
                                                                          '\0';
         break;

      default:
         ErrStat = SNMP_ERRORSTATUS_GENERR;
         goto Exit;
      }

         break;

      default:
   ErrStat = SNMP_ERRORSTATUS_GENERR;
   goto Exit;
      } // switch

   // Signal no error occurred
   ErrStat = SNMP_ERRORSTATUS_NOERROR;

Exit:
   return ErrStat;
} // MIB_leaf_func

UINT MIB_toasttype_func | ( | IN UINT | Action,
 |  | IN MIB_ENTRY * | MibPtr,
 |  | IN RFC1157VarBind * | VarBind
 | ) |  |

Definition at line 582 of file TestMIB.C.

{
UINT   ErrStat;

   switch ( Action )
      {
      case MIB_ACTION_SET:
         // Make sure that this variable's ACCESS is SET'able
   if ( MibPtr->Access != MIB_ACCESS_READWRITE &&
        MibPtr->Access != MIB_ACCESS_WRITE )
      {
      ErrStat = SNMP_ERRORSTATUS_NOSUCHNAME;
            goto Exit;
      }

         // Check for proper type before setting
         if ( MibPtr->Type != VarBind->value.asnType )
      {
      ErrStat = SNMP_ERRORSTATUS_BADVALUE;
      goto Exit;
      }

         // Make sure the value is valid
         if ( MIB_TOASTER_WHITEBREAD > VarBind->value.asnValue.number ||
              MIB_TOASTER_OTHERBREAD < VarBind->value.asnValue.number )
            {
      ErrStat = SNMP_ERRORSTATUS_BADVALUE;
      goto Exit;
            }

         // Let fall through purposefully for further processing by
         // generic leaf function.

      case MIB_ACTION_GETNEXT:
      case MIB_ACTION_GET:
   // Call the more generic function to perform the action
         ErrStat = MIB_leaf_func( Action, MibPtr, VarBind );
         break;

      default:
   ErrStat = SNMP_ERRORSTATUS_GENERR;
   goto Exit;
      } // switch

Exit:
   return ErrStat;
} // MIB_toasttype_func

UINT ResolveVarBind | ( | IN OUT RFC1157VarBind * | VarBind,
 |  | IN UINT | PduAction
 | ) |  |

Definition at line 212 of file TestMIB.C.

{
MIB_ENTRY            *MibPtr;
AsnObjectIdentifier  TempOid;
int                  CompResult;
UINT                 I;
UINT                 nResult;

   // Search for var bind name in the MIB
   I      = 0;
   MibPtr = NULL;
   while ( MibPtr == NULL && I < MIB_num_variables )
      {
      // Construct OID with complete prefix for comparison purposes
      SnmpUtilOidCpy( &TempOid, &MIB_OidPrefix );
      SnmpUtilOidAppend( &TempOid, &Mib[I].Oid );

      // Check for OID in MIB - On a GET-NEXT the OID does not have to exactly
      // match a variable in the MIB, it must only fall under the MIB root.
      CompResult = SnmpUtilOidCmp( &VarBind->name, &TempOid );
      if ( 0 > CompResult )
   {
   // Since there is not an exact match, the only valid action is GET-NEXT
   if ( MIB_ACTION_GETNEXT != PduAction )
      {
      nResult = SNMP_ERRORSTATUS_NOSUCHNAME;
      goto Exit;
      }

   // Since the match was not exact, but var bind name is within MIB,
   // we are at the NEXT MIB variable down from the one specified.
   PduAction = MIB_ACTION_GET;
   MibPtr = &Mib[I];

         // Replace var bind name with new name
         SnmpUtilOidFree( &VarBind->name );
         SnmpUtilOidCpy( &VarBind->name, &MIB_OidPrefix );
         SnmpUtilOidAppend( &VarBind->name, &MibPtr->Oid );
   }
      else
         {
   // An exact match was found.
         if ( 0 == CompResult )
            {
      MibPtr = &Mib[I];
      }
   }

      // Free OID memory before checking another variable
      SnmpUtilOidFree( &TempOid );

      I++;
      } // while

   // If OID not within scope of MIB, then no such name
   if ( MibPtr == NULL )
      {
      nResult = SNMP_ERRORSTATUS_NOSUCHNAME;
      goto Exit;
      }

   // Call function to process request.  Each MIB entry has a function pointer
   // that knows how to process its MIB variable.
   nResult = (*MibPtr->MibFunc)( PduAction, MibPtr, VarBind );

   // Free temp memory
   SnmpUtilOidFree( &TempOid );

Exit:
   return nResult;
} // ResolveVarBind

Variable Documentation

MIB_ENTRY Mib[]
Initial value:
 {
      { { OID_SIZEOF(MIB_toasterManufacturer), MIB_toasterManufacturer },
        &MIB_toasterManStor, ASN_RFC1213_DISPSTRING,
        MIB_ACCESS_READ, MIB_leaf_func, &Mib[1] },

      { { OID_SIZEOF(MIB_toasterModelNumber), MIB_toasterModelNumber },
        &MIB_toasterModelStor, ASN_RFC1213_DISPSTRING,
        MIB_ACCESS_READ, MIB_leaf_func, &Mib[2] },

      { { OID_SIZEOF(MIB_toasterControl), MIB_toasterControl },
        &MIB_toasterControlStor, ASN_INTEGER,
        MIB_ACCESS_READWRITE, MIB_control_func, &Mib[3] },

      { { OID_SIZEOF(MIB_toasterDoneness), MIB_toasterDoneness },
        &MIB_toasterDonenessStor, ASN_INTEGER,
        MIB_ACCESS_READWRITE, MIB_doneness_func, &Mib[4] },

      { { OID_SIZEOF(MIB_toasterToastType), MIB_toasterToastType },
        &MIB_toasterToastTypeStor, ASN_INTEGER,
        MIB_ACCESS_READWRITE, MIB_toasttype_func, NULL }
      }

Definition at line 173 of file TestMIB.C.

UINT MIB_num_variables = sizeof Mib / sizeof( MIB_ENTRY )

Definition at line 195 of file TestMIB.C.

AsnObjectIdentifier MIB_OidPrefix = { OID_SIZEOF(OID_Prefix), OID_Prefix }

Definition at line 132 of file TestMIB.C.

UINT MIB_toaster[] = { 2 }

Definition at line 143 of file TestMIB.C.

UINT MIB_toasterControl[] = { 2, 3, 0 }

Definition at line 152 of file TestMIB.C.

AsnInteger MIB_toasterControlStor = 1

Definition at line 165 of file TestMIB.C.

UINT MIB_toasterDoneness[] = { 2, 4, 0 }

Definition at line 153 of file TestMIB.C.

AsnInteger MIB_toasterDonenessStor = 2

Definition at line 166 of file TestMIB.C.

char MIB_toasterManStor[] = "Microsoft Corporation"

Definition at line 162 of file TestMIB.C.

UINT MIB_toasterManufacturer[] = { 2, 1, 0 }

Definition at line 150 of file TestMIB.C.

UINT MIB_toasterModelNumber[] = { 2, 2, 0 }

Definition at line 151 of file TestMIB.C.

char MIB_toasterModelStor[] = "Example SNMP Extension Agent for Windows/NT (TOASTER-MIB)."

Definition at line 163 of file TestMIB.C.

UINT MIB_toasterToastType[] = { 2, 5, 0 }

Definition at line 154 of file TestMIB.C.

AsnInteger MIB_toasterToastTypeStor = 3

Definition at line 167 of file TestMIB.C.

UINT OID_Prefix[] = { 1, 3, 6, 1, 4, 1, 12 }

Definition at line 131 of file TestMIB.C.

Generated on Wed Nov 13 2024 16:54:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Snmp/TestDll/TestMIB.h File Reference

  • NetDS
  • Snmp
  • TestDll
Classes | Defines | Typedefs | Functions | Variables

TestMIB.h File Reference

#include <snmp.h>

Go to the source code of this file.

Classes

struct | mib_entry

Defines

#define | MAX_STRING_LEN 255
#define | MIB_ACCESS_READ 0
#define | MIB_ACCESS_READWRITE 2
#define | MIB_ACCESS_WRITE 1
#define | MIB_ACTION_GET ASN_RFC1157_GETREQUEST
#define | MIB_ACTION_GETNEXT ASN_RFC1157_GETNEXTREQUEST
#define | MIB_ACTION_SET ASN_RFC1157_SETREQUEST
#define | MIB_PREFIX_LEN MIB_OidPrefix.idLength
#define | MIB_TOASTER_BURNT 10
#define | MIB_TOASTER_DOWN 2
#define | MIB_TOASTER_LIGHTLYWARM 1
#define | MIB_TOASTER_OTHERBREAD 7
#define | MIB_TOASTER_UP 1
#define | MIB_TOASTER_WHITEBREAD 1
#define | OID_SIZEOF(Oid) ( sizeof Oid / sizeof(UINT) )

Typedefs

typedef struct mib_entry | MIB_ENTRY

Functions

UINT | MIB_control_func (IN UINT Action, IN MIB_ENTRY *MibPtr, IN RFC1157VarBind *VarBind)
UINT | MIB_doneness_func (IN UINT Action, IN MIB_ENTRY *MibPtr, IN RFC1157VarBind *VarBind)
UINT | MIB_leaf_func (IN UINT Action, IN MIB_ENTRY *MibPtr, IN RFC1157VarBind *VarBind)
UINT | MIB_toasttype_func (IN UINT Action, IN MIB_ENTRY *MibPtr, IN RFC1157VarBind *VarBind)
UINT | ResolveVarBind (IN OUT RFC1157VarBind *VarBind, IN UINT PduAction)

Variables

MIB_ENTRY Mib []
UINT MIB_num_variables
AsnObjectIdentifier | MIB_OidPrefix

Define Documentation

#define MAX_STRING_LEN 255

Definition at line 33 of file TestMIB.h.

#define MIB_ACCESS_READ 0

Definition at line 57 of file TestMIB.h.

#define MIB_ACCESS_READWRITE 2

Definition at line 59 of file TestMIB.h.

#define MIB_ACCESS_WRITE 1

Definition at line 58 of file TestMIB.h.

#define MIB_ACTION_GET ASN_RFC1157_GETREQUEST

Definition at line 50 of file TestMIB.h.

#define MIB_ACTION_GETNEXT ASN_RFC1157_GETNEXTREQUEST

Definition at line 52 of file TestMIB.h.

#define MIB_ACTION_SET ASN_RFC1157_SETREQUEST

Definition at line 51 of file TestMIB.h.

#define MIB_PREFIX_LEN MIB_OidPrefix.idLength

Definition at line 32 of file TestMIB.h.

#define MIB_TOASTER_BURNT 10

Definition at line 42 of file TestMIB.h.

#define MIB_TOASTER_DOWN 2

Definition at line 39 of file TestMIB.h.

#define MIB_TOASTER_LIGHTLYWARM 1

Definition at line 41 of file TestMIB.h.

#define MIB_TOASTER_OTHERBREAD 7

Definition at line 45 of file TestMIB.h.

#define MIB_TOASTER_UP 1

Definition at line 38 of file TestMIB.h.

#define MIB_TOASTER_WHITEBREAD 1

Definition at line 44 of file TestMIB.h.

#define OID_SIZEOF ( Oid ) ( sizeof Oid / sizeof(UINT) )

Definition at line 64 of file TestMIB.h.

Typedef Documentation

typedef struct mib_entry MIB_ENTRY

Function Documentation

UINT MIB_control_func | ( | IN UINT | Action,
 |  | IN MIB_ENTRY * | MibPtr,
 |  | IN RFC1157VarBind * | VarBind
 | ) |  |

Definition at line 448 of file TestMIB.C.

{
UINT   ErrStat;

   switch ( Action )
      {
      case MIB_ACTION_SET:
         // Make sure that this variable's ACCESS is SET'able
   if ( MibPtr->Access != MIB_ACCESS_READWRITE &&
        MibPtr->Access != MIB_ACCESS_WRITE )
      {
      ErrStat = SNMP_ERRORSTATUS_NOSUCHNAME;
            goto Exit;
      }

         // Check for proper type before setting
         if ( MibPtr->Type != VarBind->value.asnType )
      {
      ErrStat = SNMP_ERRORSTATUS_BADVALUE;
      goto Exit;
      }

         // Make sure the value is valid
         if ( MIB_TOASTER_UP > VarBind->value.asnValue.number ||
              MIB_TOASTER_DOWN < VarBind->value.asnValue.number )
            {
      ErrStat = SNMP_ERRORSTATUS_BADVALUE;
      goto Exit;
            }

         // Let fall through purposefully for further processing by
         // generic leaf function.

      case MIB_ACTION_GETNEXT:
      case MIB_ACTION_GET:
   // Call the more generic function to perform the action
         ErrStat = MIB_leaf_func( Action, MibPtr, VarBind );
         break;

      default:
   ErrStat = SNMP_ERRORSTATUS_GENERR;
   goto Exit;
      } // switch

Exit:
   return ErrStat;
} // MIB_control_func

UINT MIB_doneness_func | ( | IN UINT | Action,
 |  | IN MIB_ENTRY * | MibPtr,
 |  | IN RFC1157VarBind * | VarBind
 | ) |  |

Definition at line 515 of file TestMIB.C.

{
UINT   ErrStat;

   switch ( Action )
      {
      case MIB_ACTION_SET:
         // Make sure that this variable's ACCESS is SET'able
   if ( MibPtr->Access != MIB_ACCESS_READWRITE &&
        MibPtr->Access != MIB_ACCESS_WRITE )
      {
      ErrStat = SNMP_ERRORSTATUS_NOSUCHNAME;
            goto Exit;
      }

         // Check for proper type before setting
         if ( MibPtr->Type != VarBind->value.asnType )
      {
      ErrStat = SNMP_ERRORSTATUS_BADVALUE;
      goto Exit;
      }

         // Make sure the value is valid
         if ( MIB_TOASTER_LIGHTLYWARM > VarBind->value.asnValue.number ||
              MIB_TOASTER_BURNT < VarBind->value.asnValue.number )
            {
      ErrStat = SNMP_ERRORSTATUS_BADVALUE;
      goto Exit;
            }

         // Let fall through purposefully for further processing by
         // generic leaf function.

      case MIB_ACTION_GETNEXT:
      case MIB_ACTION_GET:
   // Call the more generic function to perform the action
         ErrStat = MIB_leaf_func( Action, MibPtr, VarBind );
         break;

      default:
   ErrStat = SNMP_ERRORSTATUS_GENERR;
   goto Exit;
      } // switch

Exit:
   return ErrStat;
} // MIB_doneness_func

UINT MIB_leaf_func | ( | IN UINT | Action,
 |  | IN MIB_ENTRY * | MibPtr,
 |  | IN RFC1157VarBind * | VarBind
 | ) |  |

Definition at line 303 of file TestMIB.C.

{
UINT   ErrStat;

   switch ( Action )
      {
      case MIB_ACTION_GETNEXT:
   // If there is no GET-NEXT pointer, this is the end of this MIB
   if ( MibPtr->MibNext == NULL )
      {
      ErrStat = SNMP_ERRORSTATUS_NOSUCHNAME;
      goto Exit;
      }

         // Setup var bind name of NEXT MIB variable
         SnmpUtilOidFree( &VarBind->name );
         SnmpUtilOidCpy( &VarBind->name, &MIB_OidPrefix );
         SnmpUtilOidAppend( &VarBind->name, &MibPtr->MibNext->Oid );

         // Call function to process request.  Each MIB entry has a function
   // pointer that knows how to process its MIB variable.
         ErrStat = (*MibPtr->MibNext->MibFunc)( MIB_ACTION_GET,
                                          MibPtr->MibNext, VarBind );
         break;

      case MIB_ACTION_GET:
         // Make sure that this variable's ACCESS is GET'able
   if ( MibPtr->Access != MIB_ACCESS_READ &&
        MibPtr->Access != MIB_ACCESS_READWRITE )
      {
      ErrStat = SNMP_ERRORSTATUS_NOSUCHNAME;
      goto Exit;
      }

   // Setup varbind's return value
   VarBind->value.asnType = MibPtr->Type;
   switch ( VarBind->value.asnType )
      {
            case ASN_RFC1155_COUNTER:
            case ASN_RFC1155_GAUGE:
            case ASN_INTEGER:
               VarBind->value.asnValue.number = *(AsnInteger *)(MibPtr->Storage);
         break;

            case ASN_OCTETSTRING: // This entails ASN_RFC1213_DISPSTRING also
         VarBind->value.asnValue.string.length =
                                 (int)(strlen( (LPSTR)MibPtr->Storage ));

         if ( NULL ==
                    (VarBind->value.asnValue.string.stream =
                    SnmpUtilMemAlloc(VarBind->value.asnValue.string.length *
                           sizeof(char))) )
            {
            ErrStat = SNMP_ERRORSTATUS_GENERR;
            goto Exit;
            }

         memcpy( VarBind->value.asnValue.string.stream,
                 (LPSTR)MibPtr->Storage,
                 VarBind->value.asnValue.string.length );
         VarBind->value.asnValue.string.dynamic = TRUE;

         break;

      default:
         ErrStat = SNMP_ERRORSTATUS_GENERR;
         goto Exit;
      }

   break;

      case MIB_ACTION_SET:
         // Make sure that this variable's ACCESS is SET'able
   if ( MibPtr->Access != MIB_ACCESS_READWRITE &&
        MibPtr->Access != MIB_ACCESS_WRITE )
      {
      ErrStat = SNMP_ERRORSTATUS_NOSUCHNAME;
            goto Exit;
      }

         // Check for proper type before setting
         if ( MibPtr->Type != VarBind->value.asnType )
      {
      ErrStat = SNMP_ERRORSTATUS_BADVALUE;
      goto Exit;
      }

   // Save value in MIB
   switch ( VarBind->value.asnType )
      {
            case ASN_RFC1155_COUNTER:
            case ASN_RFC1155_GAUGE:
            case ASN_INTEGER:
               *(AsnInteger *)(MibPtr->Storage) = VarBind->value.asnValue.number;
         break;

            case ASN_OCTETSTRING: // This entails ASN_RFC1213_DISPSTRING also
               // The storage must be adequate to contain the new string
               // including a NULL terminator.
               memcpy( (LPSTR)MibPtr->Storage,
                       VarBind->value.asnValue.string.stream,
                       VarBind->value.asnValue.string.length );

         ((LPSTR)MibPtr->Storage)[VarBind->value.asnValue.string.length] =
                                                                          '\0';
         break;

      default:
         ErrStat = SNMP_ERRORSTATUS_GENERR;
         goto Exit;
      }

         break;

      default:
   ErrStat = SNMP_ERRORSTATUS_GENERR;
   goto Exit;
      } // switch

   // Signal no error occurred
   ErrStat = SNMP_ERRORSTATUS_NOERROR;

Exit:
   return ErrStat;
} // MIB_leaf_func

UINT MIB_toasttype_func | ( | IN UINT | Action,
 |  | IN MIB_ENTRY * | MibPtr,
 |  | IN RFC1157VarBind * | VarBind
 | ) |  |

Definition at line 582 of file TestMIB.C.

{
UINT   ErrStat;

   switch ( Action )
      {
      case MIB_ACTION_SET:
         // Make sure that this variable's ACCESS is SET'able
   if ( MibPtr->Access != MIB_ACCESS_READWRITE &&
        MibPtr->Access != MIB_ACCESS_WRITE )
      {
      ErrStat = SNMP_ERRORSTATUS_NOSUCHNAME;
            goto Exit;
      }

         // Check for proper type before setting
         if ( MibPtr->Type != VarBind->value.asnType )
      {
      ErrStat = SNMP_ERRORSTATUS_BADVALUE;
      goto Exit;
      }

         // Make sure the value is valid
         if ( MIB_TOASTER_WHITEBREAD > VarBind->value.asnValue.number ||
              MIB_TOASTER_OTHERBREAD < VarBind->value.asnValue.number )
            {
      ErrStat = SNMP_ERRORSTATUS_BADVALUE;
      goto Exit;
            }

         // Let fall through purposefully for further processing by
         // generic leaf function.

      case MIB_ACTION_GETNEXT:
      case MIB_ACTION_GET:
   // Call the more generic function to perform the action
         ErrStat = MIB_leaf_func( Action, MibPtr, VarBind );
         break;

      default:
   ErrStat = SNMP_ERRORSTATUS_GENERR;
   goto Exit;
      } // switch

Exit:
   return ErrStat;
} // MIB_toasttype_func

UINT ResolveVarBind | ( | IN OUT RFC1157VarBind * | VarBind,
 |  | IN UINT | PduAction
 | ) |  |

Definition at line 212 of file TestMIB.C.

{
MIB_ENTRY            *MibPtr;
AsnObjectIdentifier  TempOid;
int                  CompResult;
UINT                 I;
UINT                 nResult;

   // Search for var bind name in the MIB
   I      = 0;
   MibPtr = NULL;
   while ( MibPtr == NULL && I < MIB_num_variables )
      {
      // Construct OID with complete prefix for comparison purposes
      SnmpUtilOidCpy( &TempOid, &MIB_OidPrefix );
      SnmpUtilOidAppend( &TempOid, &Mib[I].Oid );

      // Check for OID in MIB - On a GET-NEXT the OID does not have to exactly
      // match a variable in the MIB, it must only fall under the MIB root.
      CompResult = SnmpUtilOidCmp( &VarBind->name, &TempOid );
      if ( 0 > CompResult )
   {
   // Since there is not an exact match, the only valid action is GET-NEXT
   if ( MIB_ACTION_GETNEXT != PduAction )
      {
      nResult = SNMP_ERRORSTATUS_NOSUCHNAME;
      goto Exit;
      }

   // Since the match was not exact, but var bind name is within MIB,
   // we are at the NEXT MIB variable down from the one specified.
   PduAction = MIB_ACTION_GET;
   MibPtr = &Mib[I];

         // Replace var bind name with new name
         SnmpUtilOidFree( &VarBind->name );
         SnmpUtilOidCpy( &VarBind->name, &MIB_OidPrefix );
         SnmpUtilOidAppend( &VarBind->name, &MibPtr->Oid );
   }
      else
         {
   // An exact match was found.
         if ( 0 == CompResult )
            {
      MibPtr = &Mib[I];
      }
   }

      // Free OID memory before checking another variable
      SnmpUtilOidFree( &TempOid );

      I++;
      } // while

   // If OID not within scope of MIB, then no such name
   if ( MibPtr == NULL )
      {
      nResult = SNMP_ERRORSTATUS_NOSUCHNAME;
      goto Exit;
      }

   // Call function to process request.  Each MIB entry has a function pointer
   // that knows how to process its MIB variable.
   nResult = (*MibPtr->MibFunc)( PduAction, MibPtr, VarBind );

   // Free temp memory
   SnmpUtilOidFree( &TempOid );

Exit:
   return nResult;
} // ResolveVarBind

Variable Documentation

MIB_ENTRY Mib[]

Definition at line 173 of file TestMIB.C.

UINT MIB_num_variables

Definition at line 195 of file TestMIB.C.

AsnObjectIdentifier MIB_OidPrefix

Definition at line 132 of file TestMIB.C.

Generated on Wed Nov 13 2024 16:54:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Snmp/WSnmp/Helper.Cpp File Reference

  • NetDS
  • Snmp
  • WSnmp
Functions

Helper.Cpp File Reference

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <winsock2.h>
#include <winsnmp.h>
#include <snmp.h>
#include <mgmtapi.h>
#include "wsnmputil.h"

Go to the source code of this file.

Functions

void | ConvertStringToSmiValue (smiVALUE *pValue)
BOOL | ConvertTexttoIp (char *agentAddress)
void | ParseAndPrintv2Trap (PSNMP_MGR_SESSION pSession)
BOOL | ParseCommandLine (int argc, char **argv)
void | PrintDbgMessage (LPSTR szFormat,...)
void | PrintOidValue (smiVALUE *pValue)
BOOL | PrintVarBind (PSNMP_MGR_SESSION pSession)
void | Usage ()

Function Documentation

void ConvertStringToSmiValue ( smiVALUE * pValue )

Definition at line 347 of file Helper.Cpp.

{

    int     i;
    DWORD   ipAddr;
    BYTE    *pBytePtr;

    switch( pValue->syntax )
    {

        case SNMP_SYNTAX_INT:
            pValue->value.sNumber = atol( gVars.pSetValue );
            break;

        case SNMP_SYNTAX_UINT32:
        case SNMP_SYNTAX_CNTR32:
        case SNMP_SYNTAX_GAUGE32:
        case SNMP_SYNTAX_TIMETICKS:
            pValue->value.uNumber = atol( gVars.pSetValue );
            break;

        case SNMP_SYNTAX_CNTR64:
            pValue->value.hNumber.hipart = ( smiUINT32 )( _atoi64( gVars.pSetValue ) >> 32);
            pValue->value.hNumber.lopart = (smiUINT32)( _atoi64( gVars.pSetValue ) & 0xFFFFFFFF);
            break;

        case SNMP_SYNTAX_OCTETS:
        case SNMP_SYNTAX_BITS:
        case SNMP_SYNTAX_OPAQUE:
            pValue->value.string.len = (int) strlen( gVars.pSetValue );
            pValue->value.string.ptr = ( smiBYTE * )SnmpUtilMemAlloc( pValue->value.string.len * sizeof( smiBYTE ) );

            if ( pValue->value.string.ptr )
            {

                memcpy( pValue->value.string.ptr,
                        gVars.pSetValue,
                        pValue->value.string.len * sizeof( smiBYTE )
                      );
            }
            break;
        case SNMP_SYNTAX_NSAPADDR:
            break;
        case SNMP_SYNTAX_IPADDR:

            pValue->value.string.len = 4;        // len of IPAddress field.
            pValue->value.string.ptr = ( smiBYTE * )SnmpUtilMemAlloc( pValue->value.string.len * sizeof( smiBYTE ) );

            ipAddr = inet_addr( gVars.pSetValue );

            pBytePtr = ( BYTE * )&ipAddr;

            for( i = 0; i < 4; i++ )
            {
                pValue->value.string.ptr[ i ] = *pBytePtr++;
            }

            break;
        case SNMP_SYNTAX_NULL:
        case SNMP_SYNTAX_NOSUCHOBJECT:
        case SNMP_SYNTAX_NOSUCHINSTANCE:
        case SNMP_SYNTAX_ENDOFMIBVIEW:
            pValue->value.empty = 0;
            break;

        default:
            break;
    }

}  //end of ConvertStringToSmiValue

BOOL ConvertTexttoIp ( char * agentAddress )

Definition at line 70 of file Helper.Cpp.

{

    DWORD           ipAddr;
    struct hostent *phost = NULL;

    if ( agentAddress == NULL )
        return ( FALSE );

    gVars.agentSockAddr.sin_family = AF_INET;

    if ( (ipAddr = inet_addr( agentAddress )) == INADDR_NONE )
    {
        if ( (phost = gethostbyname( agentAddress )) == NULL )
        {
            return ( FALSE );
        }
        else
            memcpy( (char *)&gVars.agentSockAddr.sin_addr, (char *)phost->h_addr, sizeof(unsigned long) );
    }
    else
        memcpy( (char *)&gVars.agentSockAddr.sin_addr, (char *)&ipAddr, sizeof(unsigned long) );

    return (TRUE);

} // end of ConvertTexttoIp

void ParseAndPrintv2Trap ( PSNMP_MGR_SESSION pSession )

Definition at line 648 of file Helper.Cpp.

{
    smiOID      sysUpTime,
                snmpTrapOid,
                snmpTrapEnterprise,
                snmpTraps,
                snmpTrapEnterpriseOID,
                tmpOid;

    smiINT      result;
    smiVALUE    value;

    DWORD       oidCount;
    DWORD       index;
    int         genTrap;
    char        szBuf[ MAX_BUFFER_LEN ];
    char        szSecString[ MAX_BUFFER_LEN ];
    AsnObjectIdentifier  Oid;      //unfortunate that there is no better way
    LPSTR       string = NULL;
    BOOL        entOid = FALSE;

    if ( pSession == NULL )
        return;

    // convert to oids.

    if ( SNMP_FAILURE( SnmpStrToOid( "1.3.6.1.2.1.1.3", &sysUpTime ) ) )
        return;
    if ( SNMP_FAILURE( SnmpStrToOid( "1.3.6.1.6.3.1.1.4", &snmpTrapOid ) ) )
        return;
    if ( SNMP_FAILURE( SnmpStrToOid( "1.3.6.1.6.3.1.1.4", &snmpTrapEnterprise ) ) )
        return;
    if ( SNMP_FAILURE( SnmpStrToOid( "1.3.6.1.6.3.1.1.5", &snmpTraps ) ) )
        return;
    if ( SNMP_FAILURE( SnmpStrToOid( "1.3.6.1.6.3.1.1.4.3.0", &snmpTrapEnterpriseOID ) ) )
        return;

    oidCount = SnmpCountVbl ( pSession->hVbl );

    for( index = 1; index <= oidCount; index++ )
    {
        // print out varbind (name, value) pair in format of:
        // Name in numerical form
        // Name in string form
        // value
        // generic trap name (if this varbind is a generic trap)
        SnmpGetVb( pSession->hVbl, index, &tmpOid, &value );
        printf( "OID :" );
        memset( szBuf, 0, MAX_BUFFER_LEN );
        SnmpOidToStr( &tmpOid, MAX_BUFFER_LEN, szBuf );
        printf( szBuf );
        printf ( "\n\r" );

        if (index == oidCount)
        {
            // Check if the last variable binding equals to "snmpTrapEnterpriseOID.0"
            SnmpOidCompare( &snmpTrapEnterpriseOID, &tmpOid, snmpTrapEnterpriseOID.len, &result );
            entOid = (result == 0);
        }

        // The old mgmtapi requires a leading dot....
        strcpy( szSecString, "." );
        strcat( szSecString, szBuf );

        if ( SnmpMgrStrToOid( szSecString, &Oid ) )
        {
            SnmpMgrOidToStr( &Oid, &string );
        }

        if ( string )
        {
            printf( "OID string: %s \n", string );
            SnmpUtilMemFree( string );
            SnmpUtilOidFree ( &Oid);
        }
        else
        {
            printf( "OID string: <Can't convert oid to string form>\n");
        }
        SnmpFreeDescriptor ( SNMP_SYNTAX_OID, (smiLPOPAQUE)&tmpOid);

        PrintOidValue( &value );

        // process generic traps only ..
        if ( value.syntax == SNMP_SYNTAX_OID )
        {
            tmpOid = value.value.oid; // structure copy ..

            SnmpOidCompare( &snmpTraps, &tmpOid, snmpTraps.len, &result );

            if ( !result )
            {
                if ( tmpOid.len == ( snmpTraps.len + 1 ) )
                {
                    genTrap = tmpOid.ptr[ snmpTraps.len ];

                    switch( genTrap )
                        {
                        case 1:
                            PrintDbgMessage( "ColdStart \n" );
                            break;
                        case 2:
                            PrintDbgMessage( "WarmStart \n" );
                            break;
                        case 3:
                            PrintDbgMessage( "LinkDown \n" );
                            break;
                        case 4:
                            PrintDbgMessage( "LinkUp \n" );
                            break;
                        case 5:
                            PrintDbgMessage( "Authentication Failure \n" );
                            break;
                        case 6:
                            PrintDbgMessage( "EGP Neighbor Loss \n" );
                            break;
                        case 7:
                            PrintDbgMessage( "enterprise specific \n" );
                            break;
                        default:
                            break;
                        }
                }
            }
        }

        printf( "\n\r\n\r" );

        if ( entOid )
        {
            PrintDbgMessage( "Enterprise specific oid from v1 trap \n" );
            PrintDbgMessage( "\n\r\n\r" );
        }

        if  ( value.syntax == SNMP_SYNTAX_OCTETS )
        {
            SnmpFreeDescriptor ( SNMP_SYNTAX_OCTETS, (smiLPOPAQUE)&value.value.string);
        }
        if  ( value.syntax == SNMP_SYNTAX_OID )
        {
            SnmpFreeDescriptor ( SNMP_SYNTAX_OID, (smiLPOPAQUE)&value.value.oid);
        }
    }

        SnmpFreeDescriptor ( SNMP_SYNTAX_OID, (smiLPOPAQUE)&sysUpTime);
        SnmpFreeDescriptor ( SNMP_SYNTAX_OID, (smiLPOPAQUE)&snmpTrapOid);
        SnmpFreeDescriptor ( SNMP_SYNTAX_OID, (smiLPOPAQUE)&snmpTrapEnterprise);
        SnmpFreeDescriptor ( SNMP_SYNTAX_OID, (smiLPOPAQUE)&snmpTraps);
        SnmpFreeDescriptor ( SNMP_SYNTAX_OID, (smiLPOPAQUE)&snmpTrapEnterpriseOID);

}

BOOL ParseCommandLine | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 110 of file Helper.Cpp.

{

    char        localOid[] = "1.3.6.1.2.1";

    // should we wait for traps?
    if ( (argc < 5) && (argc != 2) )
    {
        Usage( );
        return ( FALSE );
    }
    else if ( (_stricmp( argv[1], "trap")) && (argc < 5) )
    {
        Usage( );
        return ( FALSE );
    }

    // init the class
    gVars.oidCount = 0;

    // update the pointers.
    ++argv;
    --argc;

    if ( !_stricmp( *argv, "trap" ) )
    {
        gVars.operation = TRAP;        // wait for traps.
        return ( TRUE );
    }
    else if ( !_stricmp(*argv, "-v2") )
    {
        gVars.version = TRUE;   // use v2c mode.
    }
    else if ( !_stricmp(*argv, "-v1") )
    {
        gVars.version = FALSE;   // use v1 mode.
    }

    // update the pointers.
    ++argv;
    --argc;

    // check the operation specified.
    if ( !_stricmp( *argv, "get" ) )
    {
        gVars.operation = GET;        // do a get.
    }
    else if ( !_stricmp( *argv, "getnext" ) )
    {
        gVars.operation = GET_NEXT;    // do get next.
    }
    else if ( !_stricmp( *argv, "walk" ) )
    {
        gVars.operation = WALK;        // do a walk.
    }
    else if ( !_stricmp( *argv, "set" ) )
    {
        gVars.operation = SET;        // do a set.
    }
    else if ( !_stricmp( *argv, "getbulk" ) )
    {
        gVars.operation = GET_BULK;    // do get bulk operation.
    }
    else if ( !_stricmp( *argv, "subtree" ) )
    {
        gVars.operation = SUB_TREE;    // go through the sub tree.
    }
    else
    {
        Usage( );
        return ( FALSE );
    }

    // Get agent address...
    argv++;
    argc--;

    gVars.pAgentStrAddr = (LPSTR)SnmpUtilMemAlloc( (int) (strlen(*argv) + 1) );
    if ( gVars.pAgentStrAddr == NULL )
    {
        PrintDbgMessage( "wsnmputil: Memory allocation failed ..\n" );
        return ( FALSE );
    }

    strcpy( gVars.pAgentStrAddr, *argv );

    // convert the string to IP address.
    if ( ConvertTexttoIp(*argv) == FALSE )
    {
        PrintDbgMessage( "Invalid SNMP agent ..\n" );
        return ( FALSE );
    }

    // Get agent community...
    argv++;
    argc--;

    gVars.pAgentCommunity = (LPSTR)SnmpUtilMemAlloc( (int) (strlen( *argv ) + 1 ));
    if ( gVars.pAgentCommunity == NULL )
    {
        PrintDbgMessage( "wsnmputil: Memory allocation failed ..\n" );
        return ( FALSE );
    }

    strcpy( gVars.pAgentCommunity, *argv );

    //   If it is a GetBulkRequest
    //   Get non_repeaters field and max_repetitions field for
    //   SNMP_PDU_GETBULK PDU.

    if (gVars.operation == GET_BULK)
    {
        argv++;
        argc--;
        if (argc)
            gVars.non_repeaters = atol(*argv);
        else
            return FALSE;
        argv++;
        argc--;
        if (argc)
            gVars.max_repetitions = atol(*argv);
        else
            return FALSE;
    }

    // ensure that the command line arguments are less than CMD_LINE_ARGS
    while( ( --argc ) && ( gVars.oidCount < CMD_LINE_ARGS ) )
    {
        argv++;

        if ( ( ( gVars.operation == WALK  ) || ( gVars.operation == SUB_TREE ) )
             && ( strlen( *argv ) <= 3 ) )
        {

            if ( ( *argv[0] ) == '.' )
            {
                // trying to preserve old snmputil behavior.
                // if the user wants to browse a tree starting from .1
                // or if the user wants to browse the tree from .2

                gVars.pszOid[ gVars.oidCount ] = (LPSTR)SnmpUtilMemAlloc( (int)(strlen( localOid )) + (int) (strlen( *argv ) + 1 ));
                if ( gVars.pszOid[ gVars.oidCount ] == NULL )
                {
                    PrintDbgMessage( "wsnmputil: Memory allocation failed ..\n" );
                    return ( FALSE );
                }
                strcpy( gVars.pszOid[ gVars.oidCount ], localOid );
                strcat( gVars.pszOid[ gVars.oidCount ], *argv );
            }
            else if ( isdigit( *argv[0] ) != 0 )
            {
                // if the user wants to browse the tree from 1 or 2

                gVars.pszOid[ gVars.oidCount ] = (LPSTR)SnmpUtilMemAlloc( (int)(strlen( localOid )) + (int) (strlen( *argv ) + 2 ));
                if ( gVars.pszOid[ gVars.oidCount ] == NULL )
                {
                    PrintDbgMessage( "wsnmputil: Memory allocation failed ..\n" );
                    return ( FALSE );
                }
                strcpy( gVars.pszOid[ gVars.oidCount ], localOid );
                strcat( gVars.pszOid[ gVars.oidCount ], "." );
                strcat( gVars.pszOid[ gVars.oidCount ], *argv );
            }
            else
            {
                gVars.pszOid[ gVars.oidCount ] = (LPSTR)SnmpUtilMemAlloc( (int)(strlen( *argv ) + 1 ));
                if ( gVars.pszOid[ gVars.oidCount ] == NULL )
                {
                    PrintDbgMessage( "wsnmputil: Memory allocation failed ..\n" );
                    return ( FALSE );
                }
                strcpy( gVars.pszOid[ gVars.oidCount ], *argv );
            }

            ++gVars.oidCount;
            // do a walk or SUB_TREE on one oid.
            break;
        }
        else if ( gVars.operation == SET )
        {
            if ( gVars.pszOid[ gVars.oidCount ] == NULL )
            {
                gVars.pszOid[ gVars.oidCount ] = ( LPSTR )SnmpUtilMemAlloc( (int) (strlen( ( *argv ) ) + 1 ));
                if ( gVars.pszOid[ gVars.oidCount ] == NULL )
                {
                    PrintDbgMessage( "wsnmputil: Memory allocation failed ..\n" );
                    return ( FALSE );
                }
                strcpy( gVars.pszOid[ gVars.oidCount ], *argv );
            }
            else
            {
                gVars.pSetValue = ( LPSTR )SnmpUtilMemAlloc( (int)(strlen( *argv ) + 1 ));
                if ( gVars.pszOid[ gVars.oidCount ] == NULL )
                {
                    PrintDbgMessage( "wsnmputil: Memory allocation failed ..\n" );
                    return ( FALSE );
                }
                strcpy( gVars.pSetValue, *argv );
                break; // we only do a SET for 1 pair of (name, value) varbinding
            }

        }
        else
        {
            gVars.pszOid[ gVars.oidCount ] = (LPSTR)SnmpUtilMemAlloc( (int)(strlen( *argv ) + 1 ));
            if ( gVars.pszOid[ gVars.oidCount ] == NULL )
            {
                PrintDbgMessage( "wsnmputil: Memory allocation failed ..\n" );
                return ( FALSE );
            }
            strcpy( gVars.pszOid[ gVars.oidCount ], *argv );
            ++gVars.oidCount;
        }

    }

    if (gVars.operation == GET_BULK)
    {
        //check if user has entered valid arguments for GET_BULK operation
        if (gVars.non_repeaters < 0 || gVars.max_repetitions < 0 )
            return (FALSE);
        if (gVars.oidCount < gVars.non_repeaters)
            return (FALSE);
    }

    return ( TRUE );
}  // end of ParseCommandLine

void PrintDbgMessage | ( | LPSTR | szFormat,
 |  |  | ...
 | ) |  |

Definition at line 51 of file Helper.Cpp.

{
    va_list argList;
    char    szBuf[ 1024 ];

    va_start ( argList, szFormat );
    vsprintf     ( szBuf, szFormat, argList );
    va_end     ( argList );

    printf     ( szBuf );
}  //end of PrintDbgMessage

void PrintOidValue ( smiVALUE * pValue )

Definition at line 425 of file Helper.Cpp.

{

    if ( pValue == NULL )
        return;

    switch( pValue->syntax )
    {
        case SNMP_SYNTAX_INT32:
            printf( "INTEGER: %ld \n", pValue->value.sNumber );
            break;
        case SNMP_SYNTAX_UINT32:
            printf( "UNSIGNED INTEGER: %ld \n", pValue->value.uNumber );
            break;
        case SNMP_SYNTAX_CNTR32:
            printf( "COUNTER: %ld \n", pValue->value.uNumber );
            break;
        case SNMP_SYNTAX_GAUGE32:
            printf( "GAUGE: %ld \n", pValue->value.uNumber );
            break;
        case SNMP_SYNTAX_TIMETICKS:
            printf( "TIMETICKS: %ld \n", pValue->value.uNumber );
            break;
        case SNMP_SYNTAX_CNTR64:
            printf( "COUNTER64: %ld%ld \n", pValue->value.hNumber.hipart,
                                        pValue->value.hNumber.lopart );
            break;
        case SNMP_SYNTAX_OCTETS:
        {
            UINT  J;
            BOOL  IsDisplayString = TRUE;
            LPSTR StringFormat;
            for ( J=0; J < pValue->value.string.len && IsDisplayString; J++ )
            {
                IsDisplayString = isprint( pValue->value.string.ptr[J] );
            }
            StringFormat = IsDisplayString ? "%c" : "<0x%02x>" ;

            printf( "OCTET STRING - " );
            for ( J=0; J < pValue->value.string.len; J++ )
            {
                printf( StringFormat, pValue->value.string.ptr[J] );
            }
            putchar( '\n' );
        }
            break;

        case SNMP_SYNTAX_BITS:
        {
            UINT J;
            printf( "Bits - " );
            for ( J=0; J < pValue->value.string.len; J++ )
            {
                printf( "0x%x ", pValue->value.string.ptr[J] );
            }
            putchar( '\n' );
        }
            break;

        case SNMP_SYNTAX_OPAQUE:
        {
            UINT J;
            printf( "Opaque - " );
            for ( J=0; J < pValue->value.string.len; J++ )
            {
                printf( "0x%x ", pValue->value.string.ptr[J] );
            }
            putchar( '\n' );
        }
            break;

        case SNMP_SYNTAX_IPADDR:
        {
            printf( "IpAddress - " );
            printf( "%d.%d.%d.%d ",
                  pValue->value.string.ptr[0] ,
                  pValue->value.string.ptr[1] ,
                  pValue->value.string.ptr[2] ,
                  pValue->value.string.ptr[3] );
            putchar( '\n' );
        }
            break;

        case SNMP_SYNTAX_NSAPADDR:
            break;

        case SNMP_SYNTAX_OID:
        {
            UINT J;
            printf( "OBJECT IDENTIFIER - " );
            for ( J=0; J < pValue->value.oid.len; J++ )
            {
                printf( ".%d", pValue->value.oid.ptr[J] );
            }
            putchar( '\n' );
        }
            break;

        case SNMP_SYNTAX_NULL:
            printf( "NULL - NULL \n" );
            break;

        case SNMP_SYNTAX_NOSUCHOBJECT:
            printf( "No such object ..\n" );
            break;

        case SNMP_SYNTAX_NOSUCHINSTANCE:
            printf( "No such instance ..\n" );
            break;

        case SNMP_SYNTAX_ENDOFMIBVIEW:
            printf( " End of MibView ..\n " );
            break;

        default:
            printf( "Invalid Type ..\n" );
            break;
    }

}  //end of PrintOidValue

BOOL PrintVarBind ( PSNMP_MGR_SESSION pSession )

Definition at line 554 of file Helper.Cpp.

{
    char                 szBuf[ MAX_BUFFER_LEN ];
    char                 szSecString[ MAX_BUFFER_LEN ];
    int                     oidCount;
    int                     i;
    smiINT               result;
    AsnObjectIdentifier  Oid;      //unfortunate that there is no better way
    LPSTR                string = NULL;

    oidCount = SnmpCountVbl( pSession->hVbl );

    // using gVars.oid for walk operation.
    // doesnt hurt when using get, get next operations as well.

    for( i = 1; i <= oidCount; i++ )
    {

        if (i > 1) //free the last gVars.oid before getting a new one
        {
            SnmpFreeDescriptor ( SNMP_SYNTAX_OID, (smiLPOPAQUE)&gVars.oid);
            if  ( gVars.value.syntax == SNMP_SYNTAX_OCTETS )
            {
                SnmpFreeDescriptor ( SNMP_SYNTAX_OCTETS, (smiLPOPAQUE)&gVars.value.value.string);
            }
            if  ( gVars.value.syntax == SNMP_SYNTAX_OID )
            {
                SnmpFreeDescriptor ( SNMP_SYNTAX_OID, (smiLPOPAQUE)&gVars.value.value.oid);
            }
        }

        SnmpGetVb( pSession->hVbl, i, &gVars.oid, &gVars.value );

        // a special case for SUB_TREE walk.
        if ( gVars.operation == SUB_TREE )
        {
            SnmpOidCompare( &gVars.startOid, &gVars.oid, ( gVars.startOid.len ), &result );
            if ( result != 0 )
                    return FALSE;
        }
        // a special case for WALK operation.
        if (gVars.operation == WALK && gVars.value.syntax == SNMP_SYNTAX_ENDOFMIBVIEW)
        {
            return FALSE;
        }

        if ( gVars.doSet == FALSE )
        {
            printf( "OID :" );
            memset( szBuf, 0, MAX_BUFFER_LEN );
            SnmpOidToStr( &gVars.oid, MAX_BUFFER_LEN, szBuf );
            printf( szBuf );
            printf ( "\n\r" );

            // The old mgmtapi requires a leading dot....
            strcpy( szSecString, "." );
            strcat( szSecString, szBuf );

            if ( SnmpMgrStrToOid( szSecString, &Oid ) )
            {
                SnmpMgrOidToStr( &Oid, &string );
            }

            if ( string )
            {
                printf( "%s \n", string );
                SnmpUtilMemFree( string );
                SnmpUtilOidFree ( &Oid);
            }

            PrintOidValue( &gVars.value );
            printf( "\n\r\n\r" );
        }

    }

    return TRUE;

}  //PrintVarBind

void Usage ( void )

Definition at line 31 of file Helper.Cpp.

{
    printf("\nusage:  wsnmputil [-v1|-v2] [get|getnext|walk|getbulk|subtree] agent community [non_repeaters max_repetitions] oid [oid ...]\n");
    printf("Examples:\n");
    printf("  wsnmputil trap\n");
    printf("  wsnmputil -v1 get localhost public 1.3.6.1.2.1.1.1.0\n");
    printf("  wsnmputil -v1 getnext localhost public 1.3.6.1.2.1.1.1.0\n");
    printf("  wsnmputil -v1 subtree localhost public 1.3.6.1.2.1.1\n");
    printf("  wsnmputil -v1 set toaster public 1.3.6.1.4.1.12.2.5.0   2\n");
    printf("  wsnmputil -v2 walk localhost public 1\n");
    printf("  wsnmputil -v2 getbulk toaster public 1  2   1.3.6.1.2.1.1.2.0  1.3.6.1.2.1.4.22.1.2  1.3.6.1.2.1.4.22.1.4\n");
}  // end of Usage

Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Snmp/WSnmp/WSnmpUtil.Cpp File Reference

  • NetDS
  • Snmp
  • WSnmp
Functions | Variables

WSnmpUtil.Cpp File Reference

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <winsock2.h>
#include <winsnmp.h>
#include <snmp.h>
#include <mgmtapi.h>
#include "wsnmputil.h"

Go to the source code of this file.

Functions

BOOL | CloseWinSNMPSession (PSNMP_MGR_SESSION pSession)
BOOL | CreateNotificationWindow (PSNMP_MGR_SESSION pSession)
BOOL | CreatePduSendRequest (PSNMP_MGR_SESSION pSession, smiVALUE *pValue)
BOOL | CreateVbl (PSNMP_MGR_SESSION pSession, smiOID *pOid, smiVALUE *pValue)
BOOL | DestroyNotificationWindow (PSNMP_MGR_SESSION pSession)
void | FreeVblandPdu (PSNMP_MGR_SESSION pSession)
int __cdecl | main (int argc, char **argv)
LRESULT CALLBACK | NotificationWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
BOOL | OpenWinSNMPSession (PSNMP_MGR_SESSION pSession)
BOOL | ProcessAgentResponse (PSNMP_MGR_SESSION pSession)
BOOL | ProcessNotification (PSNMP_MGR_SESSION pSession)
BOOL | WaitForTraps (PSNMP_MGR_SESSION pSession)

Variables

GlobalVars gVars

Function Documentation

BOOL CloseWinSNMPSession ( PSNMP_MGR_SESSION pSession )

Definition at line 348 of file WSnmpUtil.Cpp.

{

    BOOL fOk = TRUE;
    SNMPAPI_STATUS status;

    // validate session ptr
    if ( pSession == NULL )
        return FALSE;

    // check if window opened
    if ( pSession->hWnd != (HWND)NULL )
    {
        // destroy notification window
        fOk = DestroyNotificationWindow( pSession );
    }

    // close view context
    if ( pSession->hViewContext  != (HSNMP_CONTEXT) NULL)
    {
        SnmpFreeContext( pSession->hViewContext );
    }

    // check if agent entity allocated
    if ( pSession->hAgentEntity != (HSNMP_ENTITY)NULL )
    {

        // close the entity handle
        status = SnmpFreeEntity( pSession->hAgentEntity );

        // validate status
        if ( status == SNMPAPI_FAILURE )
        {
            // failure
            fOk = FALSE;
        }

        // re-initialize
        pSession->hAgentEntity = (HSNMP_ENTITY)NULL;
    }

    // check if manager entity allocated
    if ( pSession->hManagerEntity != (HSNMP_ENTITY)NULL )
    {

        // close the entity handle
        status = SnmpFreeEntity( pSession->hManagerEntity );

        // validate status
        if ( status == SNMPAPI_FAILURE )
        {

            // failure
            fOk = FALSE;
        }

        // re-initialize
        pSession->hManagerEntity = (HSNMP_ENTITY)NULL;
    }

    // check if session allocated
    if ( pSession->hSnmpSession != (HSNMP_SESSION)NULL )
    {

        // close the winsnmp session
        status = SnmpClose( pSession->hSnmpSession );

        // validate status
        if ( status == SNMPAPI_FAILURE )
        {
            // failure
            fOk = FALSE;
        }

        // re-initialize
        pSession->hSnmpSession = (HSNMP_SESSION)NULL;
    }

    return fOk;

} // end of CloseWinSNMPSession

BOOL CreateNotificationWindow ( PSNMP_MGR_SESSION pSession )

Definition at line 443 of file WSnmpUtil.Cpp.

{

    BOOL    fOk;
    WNDCLASS wc;

    if ( pSession == NULL )
    {
        return FALSE;
    }

    // initialize notification window class
    wc.lpfnWndProc   = (WNDPROC)NotificationWndProc;
    wc.lpszClassName = NOTIFICATION_CLASS;
    wc.lpszMenuName  = NULL;
    wc.hInstance     = gVars.g_hInst;
    wc.hIcon         = NULL;
    wc.hCursor       = NULL;
    wc.hbrBackground = NULL;
    wc.cbWndExtra    = sizeof(PSNMP_MGR_SESSION);
    wc.cbClsExtra    = 0;
    wc.style         = 0;    // register class
    fOk = RegisterClass(&wc);

    if (!fOk)
    {
        PrintDbgMessage( "snmputil: RegisterClass returned %d.\n", GetLastError() );
        return (FALSE);
    }
    // create notification window
    pSession->hWnd = CreateWindow(
                      NOTIFICATION_CLASS,
                      "SNMP Util Class",                // pointer to window name
                      WS_OVERLAPPEDWINDOW,              // window style
                      0,                                // horizontal position of window
                      0,                                // vertical position of window
                      0,                                // window width
                      0,                                // window height
                      NULL,                             // handle to parent or owner window
                      NULL,                             // handle to menu or child-window identifier
                      gVars.g_hInst,                    // handle to application instance
                      NULL                              // pointer to window-creation data
                    );

    // validate window handle
    if ( pSession->hWnd != NULL )
    {
        // store pointer to session in window
        SetWindowLongPtr( pSession->hWnd, 0, (INT_PTR)pSession );

        // success
        fOk = TRUE;
    }
    else
    {
        // failure
        fOk = FALSE;
    }

    return fOk;

} // end of CreateNotificationWindow

BOOL CreatePduSendRequest | ( | PSNMP_MGR_SESSION | pSession,
 |  | smiVALUE * | pValue
 | ) |  |

Definition at line 843 of file WSnmpUtil.Cpp.

{

    // check for the validity of the structure.
    if ( pSession == NULL )
        return (FALSE);

    // set the pdu type.
    switch ( gVars.operation )
    {
        case GET:
            pSession->nPduType = SNMP_PDU_GET;
            break;
        case GET_NEXT:
            pSession->nPduType = SNMP_PDU_GETNEXT;
            break;
        case WALK:
            pSession->nPduType = SNMP_PDU_GETNEXT;
            break;
        case SET:
            pSession->nPduType = SNMP_PDU_SET;
            break;
        case SUB_TREE:
            pSession->nPduType = SNMP_PDU_GETNEXT;
            break;
        case GET_BULK:
            pSession->nPduType = SNMP_PDU_GETBULK;
        default:
            break;
    }

    // first time around, walk: always use the first oid
    if ( ( gVars.nRequestId  == 1 ) && ( ( gVars.operation == WALK ) || ( gVars.operation == SUB_TREE ) ) ) // || ( gVars.operation == GET_BULK ) ) )
    {
        if ( SNMP_FAILURE ( SnmpStrToOid( gVars.pszOid[0] , &gVars.oid ) ) )
        {
            if ( SnmpMgrStrToOid( gVars.pszOid[0] , (AsnObjectIdentifier *)&gVars.oid ) == FALSE )
            {
                PrintDbgMessage( "snmputil: Failed in SnmpStrToOid( ) or SnmpMgrStrToOid( ) function ..\n" );
                return ( FALSE );
            }
        }
        else
        {
            // copy the var bind
            gVars.startOid = gVars.oid;
        }
    }

    // create the appropriate Varbind lists depending on the operation.
    if ( ( gVars.operation == WALK ) || ( gVars.operation == SUB_TREE ) )
    {
        if ( ( CreateVbl( pSession, &gVars.oid, NULL ) ) == FALSE )
            return ( FALSE );
    }
    else if ( ( gVars.operation == GET_NEXT ) || ( gVars.operation == GET ) )
    {

        if ( SNMP_FAILURE ( SnmpStrToOid( gVars.pszOid[ gVars.nRequestId - 1 ] ,
                                      &gVars.oid ) ) )
        {
            if ( SnmpMgrStrToOid( gVars.pszOid[gVars.nRequestId - 1] , (AsnObjectIdentifier *)&gVars.oid ) == FALSE )
            {
                PrintDbgMessage( "snmputil: Failed in SnmpStrToOid( ) or SnmpMgrStrToOid( ) function ..\n" );
                return ( FALSE );
            }
        }

        if ( ( CreateVbl( pSession, &gVars.oid, NULL ) ) == FALSE )
                return ( FALSE );

    }
    else if ( gVars.operation == SET )
    {
        pSession->hVbl = SnmpCreateVbl( pSession->hSnmpSession,
                                        &gVars.oid,
                                        pValue
                                        );
       }

    else if ( gVars.operation == GET_BULK )
    {
        //CreateVbl first then add OIDs to the Vbl
        pSession->hVbl =
            SnmpCreateVbl(  pSession->hSnmpSession,  // handle to the WinSNMP session
                            NULL,                    // pointer to the variable name
                            NULL                     // pointer to the value to associate with the variable
                            );

        if ( SNMP_FAILURE( pSession->hVbl ) )
            return (FALSE);
        for (int i = 0; i < gVars.oidCount; i++)
        {
            //the very last gVars.oid in the loop will be freed later.
            if (i > 0)
            {
                    SnmpFreeDescriptor ( SNMP_SYNTAX_OID, (smiLPOPAQUE)&gVars.oid);
            }

            if ( SNMP_FAILURE ( SnmpStrToOid( gVars.pszOid[i] , &gVars.oid ) ) )
            {
                if ( SnmpMgrStrToOid( gVars.pszOid[i] , (AsnObjectIdentifier *)&gVars.oid ) == FALSE )
                {
                    PrintDbgMessage( "snmputil: Failed in SnmpStrToOid( ) or SnmpMgrStrToOid( ) function ..\n" );
                    return ( FALSE );
                }
            }
            // append vb to Vbl
            if ( SNMP_FAILURE ( SnmpSetVb(pSession->hVbl,    0, &gVars.oid, NULL    ) ) )
            {
                PrintDbgMessage( "snmputil: Failed in SnmpSetVb( ) function ..\n" );
                return ( FALSE );
            }
        }

    }

    pSession->nRequestId = gVars.nRequestId++;

    // create a pdu using the parameters in pSession structure
    pSession->hPdu = SnmpCreatePdu( pSession->hSnmpSession,
                                      pSession->nPduType,
                                      pSession->nRequestId,
                                      ( ( gVars.operation == GET_BULK ) ? gVars.non_repeaters : 0 ),
                                      ( ( gVars.operation == GET_BULK ) ? gVars.max_repetitions : 0 ),
                                      pSession->hVbl );

    if ( SNMP_FAILURE ( pSession->hPdu ) )
    {
        PrintDbgMessage( "snmputil: Failed in creating PDU ..\n " );
        return (FALSE);
    }

    // send the message to the agent
    pSession->nError = SnmpSendMsg(    pSession->hSnmpSession,
                                        pSession->hManagerEntity,
                                        pSession->hAgentEntity,
                                        pSession->hViewContext,
                                        pSession->hPdu );

    if ( gVars.operation != SUB_TREE ) SnmpFreeDescriptor ( SNMP_SYNTAX_OID, (smiLPOPAQUE)&gVars.oid);

    // check error status and return.
    if ( SNMP_FAILURE( pSession->nError ) )
    {

         pSession->nError = SnmpGetLastError( pSession->hSnmpSession );
         PrintDbgMessage( "snmputil: Failed in send message, Last Error %d \n", pSession->nError );
         FreeVblandPdu( pSession );
         return (FALSE);
    }
    else
    {

        FreeVblandPdu( pSession );
        return ( ProcessAgentResponse ( pSession ) );
    }

} //end of CreatePduSendRequest

BOOL CreateVbl | ( | PSNMP_MGR_SESSION | pSession,
 |  | smiOID * | pOid,
 |  | smiVALUE * | pValue
 | ) |  |

Definition at line 787 of file WSnmpUtil.Cpp.

{

    // check for NULL pointers
    if ( ( pOid == NULL )    ||
         ( pSession == NULL ) )
         return FALSE;

    // create the var bind list.
    pSession->hVbl = SnmpCreateVbl( pSession->hSnmpSession,
                                      pOid,
                                    ( ( pSession->nPduType == SNMP_PDU_SET ) ? pValue : NULL ) );

    if ( SNMP_FAILURE( pSession->hVbl ) )
        return FALSE;
    else
        return TRUE;

} //end of CreateVbl

BOOL DestroyNotificationWindow ( PSNMP_MGR_SESSION pSession )

Definition at line 513 of file WSnmpUtil.Cpp.

{
    BOOL    fOk;

    // destroy the notification window.
    return( fOk = DestroyWindow( pSession->hWnd ) );
} // end of DestroyNotificationWindow

void FreeVblandPdu ( PSNMP_MGR_SESSION pSession )

Definition at line 813 of file WSnmpUtil.Cpp.

{
    if ( pSession == NULL )
        return;

    pSession->nError = SnmpFreeVbl( pSession->hVbl );
    if ( SNMP_FAILURE( pSession->nError ) )
    {
        pSession->nError = SnmpGetLastError( pSession->hSnmpSession );
        PrintDbgMessage( "snmputil: failure in SnmpFreeVbl %d \n ", pSession->nError );
    }

    pSession->nError = SnmpFreePdu( pSession->hPdu );
    if ( SNMP_FAILURE( pSession->nError ) )
    {
        pSession->nError = SnmpGetLastError( pSession->hSnmpSession );
        PrintDbgMessage( "snmputil: failure in SnmpFreePdu %d \n ", pSession->nError );
    }

} // end of FreeVblandPdu

int __cdecl main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 35 of file WSnmpUtil.Cpp.

{

    PSNMP_MGR_SESSION    pSession = NULL;
    int                  nReturn = 0;
    BOOL                 result;
    int                  i = 0;
    smiVALUE             lvalue;
    SNMPAPI_STATUS       status;
    WSAData              wsaData;

    // initialize start params
    smiUINT32 nMajorVersion   = 0;
    smiUINT32 nMinorVersion   = 0;
    smiUINT32 nLevel          = 0;

    smiUINT32 nTranslateMode  = 0;
    smiUINT32 nRetransmitMode = 0;

    __try
    {
        //SNMPAPI_UNTRANSLATED_V1 & SNMPAPI_UNTRANSLATED_V2 require transport address
        //and we will use winsock api to get transport address from host names
        if ( WSAStartup( 0x202, &wsaData ) != 0 )
        {
            nReturn = -1;
            __leave;
        }

        // WinSnmp is supported on Windows NT 5.0 or later.
        OSVERSIONINFO osvi;

        memset(&osvi, 0, sizeof(OSVERSIONINFO));
        osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
        GetVersionEx (&osvi);
        if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT)
        {
            if (osvi.dwMajorVersion <= 4)
            {
                PrintDbgMessage( "wsnmputil: WinSnmp is supported on Windows NT 5.0 or later ..\n" );
                nReturn = -1;
                __leave;
            }
        }
        else
        {
            PrintDbgMessage( "wsnmputil: WinSnmp is supported on Windows NT 5.0 or later ..\n" );
            nReturn = -1;
            __leave;
        }

        // parse the command line parameters first.
        result = ParseCommandLine( argc, argv );
        if ( result == FALSE )
        {
            nReturn = -1;
            __leave;
        }

        // start winsnmp
        status = SnmpStartup(
                      &nMajorVersion,
                      &nMinorVersion,
                      &nLevel,
                      &nTranslateMode,
                      &nRetransmitMode
                      );

        if ( !SNMP_FAILURE(status) )
        {
            if ( gVars.version == FALSE )
                SnmpSetTranslateMode( SNMPAPI_UNTRANSLATED_V1 );
            else
                SnmpSetTranslateMode( SNMPAPI_UNTRANSLATED_V2 );
        }
        else
        {
            nReturn = -1;
            __leave;
        }

        pSession = ( PSNMP_MGR_SESSION )SnmpUtilMemAlloc( sizeof( SNMP_MGR_SESSION ) );

        if ( pSession == NULL )
        {
            PrintDbgMessage( "wsnmputil: Memory allocation failed ..\n" );
            nReturn = -1;
            __leave;
        }

        if ( !CreateNotificationWindow( pSession ) )
        {
            PrintDbgMessage( "wsnmputil: Fail to create notification window ..\n" );
            nReturn = -1;
            __leave;
        }

        result = OpenWinSNMPSession( pSession );

        if ( result == FALSE )
        {
            PrintDbgMessage( "wsnmputil: Open session failed ..\n" );
            nReturn = -1;
            __leave;
        }

        switch (gVars.operation)
        {
            case TRAP:
                // WaitForTraps will block in While (ProcessAgentResponse()) loop
                // Util user hits Ctrl+C to exit the program
                WaitForTraps( pSession );
                break;

            case WALK:
                while ( pSession->nErrorStatus == SNMP_ERROR_NOERROR )
                {
                    if ( ! ( result = CreatePduSendRequest( pSession, NULL ) ) )
                        break;
                    if ( gVars.fDone == TRUE )
                        break;
                }
                break;

            case GET:
            case GET_NEXT:
                // do create a pdu and send a request.
                for( i = 0; i < gVars.oidCount; i++ )
                    result = CreatePduSendRequest( pSession, NULL );
                break;

            case GET_BULK:
                result = CreatePduSendRequest( pSession, NULL );
                break;

            case SUB_TREE:
                while ( pSession->nErrorStatus == SNMP_ERROR_NOERROR )
                {
                    result = CreatePduSendRequest( pSession, NULL );

                    // check the return status.
                    if ( result == FALSE )
                       break;

                    // check if we hit the end of the subtree ..
                    if ( gVars.fDone == TRUE )
                        break;
                }
                break;

            case SET:
                result = FALSE;
                gVars.doSet = TRUE;

                if ( gVars.pSetValue != NULL )
                {
                    gVars.operation = GET;
                    result = CreatePduSendRequest( pSession, NULL );
                }

                if ( result != FALSE )
                {
                    gVars.operation = SET;

                    // copy the object type. Ex: INT UINT32 etc..
                    lvalue.syntax = gVars.value.syntax;

                    ConvertStringToSmiValue( &lvalue );

                    result = CreatePduSendRequest( pSession, &lvalue );

                    // check the error status on pSession.
                    if( pSession->nErrorStatus != 0 )
                        PrintDbgMessage( "Failed in setting the OID value ..\n" );
                    else
                        PrintDbgMessage( "Succeeded in setting the OID value ..\n" );

                }
                break;

        }  //end switch

    }  // end try block
    __finally
    {
        // free memory ..
        for( i = 0; i < gVars.oidCount; i++ )
        {
            if ( gVars.pszOid[ i ] )
                SnmpUtilMemFree( gVars.pszOid[ i ] );
        }

        if ( gVars.pAgentStrAddr )
            SnmpUtilMemFree( gVars.pAgentStrAddr );

        if ( gVars.pAgentStrAddr != NULL )
            SnmpUtilMemFree( gVars.pAgentCommunity );

        if ( gVars.pSetValue )
            SnmpUtilMemFree( gVars.pSetValue );

        if (
            ( ( lvalue.syntax == SNMP_SYNTAX_OCTETS )
             || ( lvalue.syntax == SNMP_SYNTAX_BITS )
             || ( lvalue.syntax == SNMP_SYNTAX_OPAQUE )
             || ( lvalue.syntax == SNMP_SYNTAX_IPADDR )
             || ( lvalue.syntax == SNMP_SYNTAX_OID ) )
             &&  lvalue.value.string.ptr )
        {
            SnmpUtilMemFree (lvalue.value.string.ptr);
        }

        // close the winsnmp session
        CloseWinSNMPSession ( pSession );

        if ( pSession ) SnmpUtilMemFree( pSession );

        // do SnmpCleanup( )
        SnmpCleanup( );

        // shut off windows sockets.
        WSACleanup( );

    }  // end finally block

    return ( nReturn );

} //end of main()

LRESULT CALLBACK NotificationWndProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 545 of file WSnmpUtil.Cpp.

{
    // check for winsnmp notification
    if (uMsg == WM_SNMP_INCOMING)
    {

        PSNMP_MGR_SESSION pSession;

        // retrieve session pointer from window
        pSession = (PSNMP_MGR_SESSION)GetWindowLongPtr(hWnd, 0);

        // validate session ptr
        if ( pSession == NULL )
            return (LRESULT)0;

        // process notification message
        if ( ProcessNotification( pSession ) )
        {
            // post message to break out of message pump
            PostMessage( pSession->hWnd, WM_SNMP_DONE, (WPARAM)0, (LPARAM)0 );
        }

        return (LRESULT)0;

    }
    else
    {
        // forward all other messages to windows
        return DefWindowProc(hWnd, uMsg, wParam, lParam);
    }

} // end of NotificationWndProc

BOOL OpenWinSNMPSession ( PSNMP_MGR_SESSION pSession )

Definition at line 272 of file WSnmpUtil.Cpp.

{

    smiOCTETS smiCommunity;

    if ( pSession == NULL )
        return ( FALSE );

    // create a remote session
    pSession->hSnmpSession = SnmpOpen( pSession->hWnd, WM_SNMP_INCOMING );

    if ( SNMP_FAILURE( pSession->hSnmpSession ) )
        return ( FALSE );

    if ( gVars.pAgentStrAddr != NULL )
    {

        // create a remote agent entity
        pSession->hAgentEntity = SnmpStrToEntity( pSession->hSnmpSession,
                                            inet_ntoa( gVars.agentSockAddr.sin_addr ) );

        if ( SNMP_FAILURE( pSession->hAgentEntity ) )
            return ( FALSE );

        // attach timeout specified with agent
        SnmpSetTimeout( pSession->hAgentEntity, gVars.nTimeOut / 10 );

        // attach retries specified with agent
        SnmpSetRetry( pSession->hAgentEntity, gVars.nRetries );

        // create local manager entity
        pSession->hManagerEntity = SnmpStrToEntity(
                                     pSession->hSnmpSession,
                                     DEFAULT_ADDRESS_IP );
        if ( SNMP_FAILURE( pSession->hManagerEntity ) )
            return ( FALSE );

        // attach timeout specified with manager
        SnmpSetTimeout( pSession->hManagerEntity, gVars.nTimeOut / 10 );

        // attach retries specified with manager
        SnmpSetRetry( pSession->hManagerEntity, gVars.nRetries );

    } // end of if ( pAgentStrAddr )

        // validate pointer
    if ( gVars.pAgentCommunity != NULL)
    {

        // transfer community string
        smiCommunity.ptr = (smiLPBYTE)gVars.pAgentCommunity;
        smiCommunity.len = gVars.pAgentCommunity ? lstrlen( gVars.pAgentCommunity) : 0;

        // obtain context from community string
        pSession->hViewContext = SnmpStrToContext(
                                     pSession->hSnmpSession,
                                     &smiCommunity
                                    );

        // validate context handle
        if ( SNMP_FAILURE( pSession->hViewContext) )
            return ( FALSE );

    }

    // success
    return (TRUE);

}  //end of OpenWinSNMP Session

BOOL ProcessAgentResponse ( PSNMP_MGR_SESSION pSession )

Definition at line 747 of file WSnmpUtil.Cpp.

{

    MSG        uMsg;
    BOOL    fOk = FALSE;

    if ( pSession == NULL )
        return FALSE;

    // get the next message for this session
    while ( GetMessage( &uMsg, pSession->hWnd, 0, 0) )
    {

        // check for private message
        if ( uMsg.message != WM_SNMP_DONE)
        {
            TranslateMessage(&uMsg);
            DispatchMessage(&uMsg);
        }
        else
        {
            // success
            fOk = TRUE;
            break;
        }
    }

    return fOk;

} // end of ProcessAgentResponse

BOOL ProcessNotification ( PSNMP_MGR_SESSION pSession )

Definition at line 590 of file WSnmpUtil.Cpp.

{

    BOOL           fDone = TRUE;
    SNMPAPI_STATUS status;
    HSNMP_ENTITY   hAgentEntity   = (HSNMP_ENTITY)NULL;
    HSNMP_ENTITY   hManagerEntity = (HSNMP_ENTITY)NULL;
    HSNMP_CONTEXT  hViewContext   = (HSNMP_CONTEXT)NULL;
    smiINT32       nPduType;
    smiINT32       nRequestId;
    char           szBuf[1024];

    // validate pointer
    if ( pSession == NULL )
        return FALSE;

    // retrieve message
    status = SnmpRecvMsg(
                pSession->hSnmpSession,
                &hAgentEntity,
                &hManagerEntity,
                &hViewContext,
                &pSession->hPdu
                );

    // validate return code
    if ( status != SNMPAPI_FAILURE )
    {
        // retrieve pdu data
        status = SnmpGetPduData(
                    pSession->hPdu,
                    &nPduType,
                    &nRequestId,
                    &pSession->nErrorStatus,
                    &pSession->nErrorIndex,
                    &pSession->hVbl
                    );

        // validate return code
        if ( status != SNMPAPI_FAILURE )
        {

            // process reponse to request
            if (nPduType == SNMP_PDU_RESPONSE)
            {
                // validate context information
                if (( pSession->nRequestId   == nRequestId ) &&
                    ( pSession->hViewContext == hViewContext ) &&
                    ( pSession->hAgentEntity == hAgentEntity ) &&
                    ( pSession->hManagerEntity == hManagerEntity ) )
                {

                    // if we hit the end of tree, break.
                    if ( PrintVarBind( pSession ) == FALSE )
                        gVars.fDone = TRUE;

                }
                else
                {
                    // continue
                    fDone = FALSE;
                }

            }
            else if (nPduType == SNMP_PDU_TRAP)
            {

                status = SnmpEntityToStr( hAgentEntity, 1024, szBuf );
                if ( ! (SNMP_FAILURE ( status )  ) )
                    PrintDbgMessage( "Agent : %s \n\n", szBuf );

                // Process the TRAP
                ParseAndPrintv2Trap( pSession );

            }
            else
            {
                PrintDbgMessage( "snmputil: Invalid PDU type %d \n", nPduType );
                // continue
                fDone = FALSE;
            }

        }
        else
            PrintDbgMessage( "snmputil: SnmpGetPduData returned error %d \n", SnmpGetLastError( pSession->hSnmpSession ) );

        // release temporary entity
        SnmpFreeEntity(hAgentEntity);

        // release temporary entity
        SnmpFreeEntity(hManagerEntity);

        // release temporary context
        SnmpFreeContext(hViewContext);

    }

    // release pdu
    FreeVblandPdu( pSession );

    return fDone;

}  //end of ProcessNotification

BOOL WaitForTraps ( PSNMP_MGR_SESSION pSession )

Definition at line 702 of file WSnmpUtil.Cpp.

{
    SNMPAPI_STATUS    status;

    if ( pSession == NULL )
        return( FALSE );

    // re-iniialize.

    pSession->nError = 0;

    // register
    status = SnmpRegister(
                 pSession->hSnmpSession,
                (HSNMP_ENTITY)NULL,     // hManagerEntity
                (HSNMP_ENTITY)NULL,     // hAgentEntity
                (HSNMP_CONTEXT)NULL,    // hViewContext
                (smiLPCOID)NULL,        // notification
                SNMPAPI_ON
                );

    if ( SNMP_FAILURE( status ) )
    {
        pSession->nError = SnmpGetLastError( pSession->hSnmpSession );
        PrintDbgMessage( "snmputil: Failed in SnmpRegister %d \n", pSession->nError );
        return (FALSE);
    }
    else
    {
        printf("WSnmpUtil: listening for traps...\n");
        while( ProcessAgentResponse ( pSession ) )
        {
        }
    }
    return TRUE;

} //end of WaitForTraps

Variable Documentation

GlobalVars gVars

Definition at line 24 of file WSnmpUtil.Cpp.

Generated on Wed Nov 13 2024 16:54:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Snmp/WSnmp/WSnmpUtil.h File Reference

  • NetDS
  • Snmp
  • WSnmp
Classes | Defines | Typedefs | Functions | Variables

WSnmpUtil.h File Reference

Go to the source code of this file.

Classes

struct | _SNMP_MGR_SESSION
class | GlobalVars

Defines

#define | BUFFER_LEN 255
#define | CMD_LINE_ARGS 255
#define | DEFAULT_ADDRESS_IP "127.0.0.1"
#define | GET 1
#define | GET_BULK 6
#define | GET_NEXT 2
#define | IPADDRLEN 4
#define | MAX_BUFFER_LEN 2048
#define | MAX_GETBLK_OIDS 10
#define | MAXENTITYSTRLEN 128
#define | MINVARBINDLEN 2
#define | NOTIFICATION_CLASS "SNMPUTIL NOTIFICATION CLASS"
#define | SET 4
#define | SNMP_FAILURE(s) ((s) == SNMPAPI_FAILURE)
#define | SNMPTRAPOIDINDEX 1
#define | SUB_TREE 7
#define | SYSUPTIMEINDEX 0
#define | TRAP 5
#define | WALK 3
#define | WM_SNMP_DONE (WM_USER + 2)
#define | WM_SNMP_INCOMING (WM_USER + 1)

Typedefs

typedef struct _SNMP_MGR_SESSION * | PSNMP_MGR_SESSION
typedef struct _SNMP_MGR_SESSION | SNMP_MGR_SESSION

Functions

BOOL | CloseWinSNMPSession (PSNMP_MGR_SESSION pSession)
void | ConvertStringToSmiValue (smiVALUE *pValue)
BOOL | ConvertTexttoIp (char *agentAddress)
BOOL | CreateNotificationWindow (PSNMP_MGR_SESSION pSession)
BOOL | CreatePduSendRequest (PSNMP_MGR_SESSION pSession, smiVALUE *pValue)
BOOL | CreateVbl (PSNMP_MGR_SESSION pSession, smiOID *pOid, smiVALUE *pValue)
BOOL | DestroyNotificationWindow (PSNMP_MGR_SESSION pSession)
void | FreeVblandPdu (PSNMP_MGR_SESSION pSession)
LRESULT CALLBACK | NotificationWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
BOOL | OpenWinSNMPSession (PSNMP_MGR_SESSION pSession)
void | ParseAndPrintv2Trap (PSNMP_MGR_SESSION pSession)
BOOL | ParseCommandLine (int argc, char **argv)
void | PrintDbgMessage (LPSTR,...)
void | PrintOidValue (smiVALUE *value)
BOOL | PrintVarBind (PSNMP_MGR_SESSION pSession)
BOOL | ProcessAgentResponse (PSNMP_MGR_SESSION pSession)
BOOL | ProcessNotification (PSNMP_MGR_SESSION pSession)
void | Usage ()
BOOL | WaitForTraps (PSNMP_MGR_SESSION pSession)

Variables

GlobalVars gVars

Define Documentation

#define BUFFER_LEN 255

Definition at line 20 of file WSnmpUtil.h.

#define CMD_LINE_ARGS 255

Definition at line 27 of file WSnmpUtil.h.

#define DEFAULT_ADDRESS_IP "127.0.0.1"

Definition at line 26 of file WSnmpUtil.h.

#define GET 1

Definition at line 33 of file WSnmpUtil.h.

#define GET_BULK 6

Definition at line 38 of file WSnmpUtil.h.

#define GET_NEXT 2

Definition at line 34 of file WSnmpUtil.h.

#define IPADDRLEN 4

Definition at line 22 of file WSnmpUtil.h.

#define MAX_BUFFER_LEN 2048

Definition at line 29 of file WSnmpUtil.h.

#define MAX_GETBLK_OIDS 10

Definition at line 28 of file WSnmpUtil.h.

#define MAXENTITYSTRLEN 128

Definition at line 21 of file WSnmpUtil.h.

#define MINVARBINDLEN 2

Definition at line 23 of file WSnmpUtil.h.

#define NOTIFICATION_CLASS "SNMPUTIL NOTIFICATION CLASS"

Definition at line 18 of file WSnmpUtil.h.

#define SET 4

Definition at line 36 of file WSnmpUtil.h.

#define SNMP_FAILURE ( s ) ((s) == SNMPAPI_FAILURE)

Definition at line 19 of file WSnmpUtil.h.

#define SNMPTRAPOIDINDEX 1

Definition at line 25 of file WSnmpUtil.h.

#define SUB_TREE 7

Definition at line 39 of file WSnmpUtil.h.

#define SYSUPTIMEINDEX 0

Definition at line 24 of file WSnmpUtil.h.

#define TRAP 5

Definition at line 37 of file WSnmpUtil.h.

#define WALK 3

Definition at line 35 of file WSnmpUtil.h.

#define WM_SNMP_DONE (WM_USER + 2)

Definition at line 17 of file WSnmpUtil.h.

#define WM_SNMP_INCOMING (WM_USER + 1)

Definition at line 16 of file WSnmpUtil.h.

Typedef Documentation

typedef struct _SNMP_MGR_SESSION * PSNMP_MGR_SESSION
typedef struct _SNMP_MGR_SESSION SNMP_MGR_SESSION

Function Documentation

BOOL CloseWinSNMPSession ( PSNMP_MGR_SESSION pSession )

Definition at line 348 of file WSnmpUtil.Cpp.

{

    BOOL fOk = TRUE;
    SNMPAPI_STATUS status;

    // validate session ptr
    if ( pSession == NULL )
        return FALSE;

    // check if window opened
    if ( pSession->hWnd != (HWND)NULL )
    {
        // destroy notification window
        fOk = DestroyNotificationWindow( pSession );
    }

    // close view context
    if ( pSession->hViewContext  != (HSNMP_CONTEXT) NULL)
    {
        SnmpFreeContext( pSession->hViewContext );
    }

    // check if agent entity allocated
    if ( pSession->hAgentEntity != (HSNMP_ENTITY)NULL )
    {

        // close the entity handle
        status = SnmpFreeEntity( pSession->hAgentEntity );

        // validate status
        if ( status == SNMPAPI_FAILURE )
        {
            // failure
            fOk = FALSE;
        }

        // re-initialize
        pSession->hAgentEntity = (HSNMP_ENTITY)NULL;
    }

    // check if manager entity allocated
    if ( pSession->hManagerEntity != (HSNMP_ENTITY)NULL )
    {

        // close the entity handle
        status = SnmpFreeEntity( pSession->hManagerEntity );

        // validate status
        if ( status == SNMPAPI_FAILURE )
        {

            // failure
            fOk = FALSE;
        }

        // re-initialize
        pSession->hManagerEntity = (HSNMP_ENTITY)NULL;
    }

    // check if session allocated
    if ( pSession->hSnmpSession != (HSNMP_SESSION)NULL )
    {

        // close the winsnmp session
        status = SnmpClose( pSession->hSnmpSession );

        // validate status
        if ( status == SNMPAPI_FAILURE )
        {
            // failure
            fOk = FALSE;
        }

        // re-initialize
        pSession->hSnmpSession = (HSNMP_SESSION)NULL;
    }

    return fOk;

} // end of CloseWinSNMPSession

void ConvertStringToSmiValue ( smiVALUE * pValue )

Definition at line 347 of file Helper.Cpp.

{

    int     i;
    DWORD   ipAddr;
    BYTE    *pBytePtr;

    switch( pValue->syntax )
    {

        case SNMP_SYNTAX_INT:
            pValue->value.sNumber = atol( gVars.pSetValue );
            break;

        case SNMP_SYNTAX_UINT32:
        case SNMP_SYNTAX_CNTR32:
        case SNMP_SYNTAX_GAUGE32:
        case SNMP_SYNTAX_TIMETICKS:
            pValue->value.uNumber = atol( gVars.pSetValue );
            break;

        case SNMP_SYNTAX_CNTR64:
            pValue->value.hNumber.hipart = ( smiUINT32 )( _atoi64( gVars.pSetValue ) >> 32);
            pValue->value.hNumber.lopart = (smiUINT32)( _atoi64( gVars.pSetValue ) & 0xFFFFFFFF);
            break;

        case SNMP_SYNTAX_OCTETS:
        case SNMP_SYNTAX_BITS:
        case SNMP_SYNTAX_OPAQUE:
            pValue->value.string.len = (int) strlen( gVars.pSetValue );
            pValue->value.string.ptr = ( smiBYTE * )SnmpUtilMemAlloc( pValue->value.string.len * sizeof( smiBYTE ) );

            if ( pValue->value.string.ptr )
            {

                memcpy( pValue->value.string.ptr,
                        gVars.pSetValue,
                        pValue->value.string.len * sizeof( smiBYTE )
                      );
            }
            break;
        case SNMP_SYNTAX_NSAPADDR:
            break;
        case SNMP_SYNTAX_IPADDR:

            pValue->value.string.len = 4;        // len of IPAddress field.
            pValue->value.string.ptr = ( smiBYTE * )SnmpUtilMemAlloc( pValue->value.string.len * sizeof( smiBYTE ) );

            ipAddr = inet_addr( gVars.pSetValue );

            pBytePtr = ( BYTE * )&ipAddr;

            for( i = 0; i < 4; i++ )
            {
                pValue->value.string.ptr[ i ] = *pBytePtr++;
            }

            break;
        case SNMP_SYNTAX_NULL:
        case SNMP_SYNTAX_NOSUCHOBJECT:
        case SNMP_SYNTAX_NOSUCHINSTANCE:
        case SNMP_SYNTAX_ENDOFMIBVIEW:
            pValue->value.empty = 0;
            break;

        default:
            break;
    }

}  //end of ConvertStringToSmiValue

BOOL ConvertTexttoIp ( char * agentAddress )

Definition at line 70 of file Helper.Cpp.

{

    DWORD           ipAddr;
    struct hostent *phost = NULL;

    if ( agentAddress == NULL )
        return ( FALSE );

    gVars.agentSockAddr.sin_family = AF_INET;

    if ( (ipAddr = inet_addr( agentAddress )) == INADDR_NONE )
    {
        if ( (phost = gethostbyname( agentAddress )) == NULL )
        {
            return ( FALSE );
        }
        else
            memcpy( (char *)&gVars.agentSockAddr.sin_addr, (char *)phost->h_addr, sizeof(unsigned long) );
    }
    else
        memcpy( (char *)&gVars.agentSockAddr.sin_addr, (char *)&ipAddr, sizeof(unsigned long) );

    return (TRUE);

} // end of ConvertTexttoIp

BOOL CreateNotificationWindow ( PSNMP_MGR_SESSION pSession )

Definition at line 443 of file WSnmpUtil.Cpp.

{

    BOOL    fOk;
    WNDCLASS wc;

    if ( pSession == NULL )
    {
        return FALSE;
    }

    // initialize notification window class
    wc.lpfnWndProc   = (WNDPROC)NotificationWndProc;
    wc.lpszClassName = NOTIFICATION_CLASS;
    wc.lpszMenuName  = NULL;
    wc.hInstance     = gVars.g_hInst;
    wc.hIcon         = NULL;
    wc.hCursor       = NULL;
    wc.hbrBackground = NULL;
    wc.cbWndExtra    = sizeof(PSNMP_MGR_SESSION);
    wc.cbClsExtra    = 0;
    wc.style         = 0;    // register class
    fOk = RegisterClass(&wc);

    if (!fOk)
    {
        PrintDbgMessage( "snmputil: RegisterClass returned %d.\n", GetLastError() );
        return (FALSE);
    }
    // create notification window
    pSession->hWnd = CreateWindow(
                      NOTIFICATION_CLASS,
                      "SNMP Util Class",                // pointer to window name
                      WS_OVERLAPPEDWINDOW,              // window style
                      0,                                // horizontal position of window
                      0,                                // vertical position of window
                      0,                                // window width
                      0,                                // window height
                      NULL,                             // handle to parent or owner window
                      NULL,                             // handle to menu or child-window identifier
                      gVars.g_hInst,                    // handle to application instance
                      NULL                              // pointer to window-creation data
                    );

    // validate window handle
    if ( pSession->hWnd != NULL )
    {
        // store pointer to session in window
        SetWindowLongPtr( pSession->hWnd, 0, (INT_PTR)pSession );

        // success
        fOk = TRUE;
    }
    else
    {
        // failure
        fOk = FALSE;
    }

    return fOk;

} // end of CreateNotificationWindow

BOOL CreatePduSendRequest | ( | PSNMP_MGR_SESSION | pSession,
 |  | smiVALUE * | pValue
 | ) |  |

Definition at line 843 of file WSnmpUtil.Cpp.

{

    // check for the validity of the structure.
    if ( pSession == NULL )
        return (FALSE);

    // set the pdu type.
    switch ( gVars.operation )
    {
        case GET:
            pSession->nPduType = SNMP_PDU_GET;
            break;
        case GET_NEXT:
            pSession->nPduType = SNMP_PDU_GETNEXT;
            break;
        case WALK:
            pSession->nPduType = SNMP_PDU_GETNEXT;
            break;
        case SET:
            pSession->nPduType = SNMP_PDU_SET;
            break;
        case SUB_TREE:
            pSession->nPduType = SNMP_PDU_GETNEXT;
            break;
        case GET_BULK:
            pSession->nPduType = SNMP_PDU_GETBULK;
        default:
            break;
    }

    // first time around, walk: always use the first oid
    if ( ( gVars.nRequestId  == 1 ) && ( ( gVars.operation == WALK ) || ( gVars.operation == SUB_TREE ) ) ) // || ( gVars.operation == GET_BULK ) ) )
    {
        if ( SNMP_FAILURE ( SnmpStrToOid( gVars.pszOid[0] , &gVars.oid ) ) )
        {
            if ( SnmpMgrStrToOid( gVars.pszOid[0] , (AsnObjectIdentifier *)&gVars.oid ) == FALSE )
            {
                PrintDbgMessage( "snmputil: Failed in SnmpStrToOid( ) or SnmpMgrStrToOid( ) function ..\n" );
                return ( FALSE );
            }
        }
        else
        {
            // copy the var bind
            gVars.startOid = gVars.oid;
        }
    }

    // create the appropriate Varbind lists depending on the operation.
    if ( ( gVars.operation == WALK ) || ( gVars.operation == SUB_TREE ) )
    {
        if ( ( CreateVbl( pSession, &gVars.oid, NULL ) ) == FALSE )
            return ( FALSE );
    }
    else if ( ( gVars.operation == GET_NEXT ) || ( gVars.operation == GET ) )
    {

        if ( SNMP_FAILURE ( SnmpStrToOid( gVars.pszOid[ gVars.nRequestId - 1 ] ,
                                      &gVars.oid ) ) )
        {
            if ( SnmpMgrStrToOid( gVars.pszOid[gVars.nRequestId - 1] , (AsnObjectIdentifier *)&gVars.oid ) == FALSE )
            {
                PrintDbgMessage( "snmputil: Failed in SnmpStrToOid( ) or SnmpMgrStrToOid( ) function ..\n" );
                return ( FALSE );
            }
        }

        if ( ( CreateVbl( pSession, &gVars.oid, NULL ) ) == FALSE )
                return ( FALSE );

    }
    else if ( gVars.operation == SET )
    {
        pSession->hVbl = SnmpCreateVbl( pSession->hSnmpSession,
                                        &gVars.oid,
                                        pValue
                                        );
       }

    else if ( gVars.operation == GET_BULK )
    {
        //CreateVbl first then add OIDs to the Vbl
        pSession->hVbl =
            SnmpCreateVbl(  pSession->hSnmpSession,  // handle to the WinSNMP session
                            NULL,                    // pointer to the variable name
                            NULL                     // pointer to the value to associate with the variable
                            );

        if ( SNMP_FAILURE( pSession->hVbl ) )
            return (FALSE);
        for (int i = 0; i < gVars.oidCount; i++)
        {
            //the very last gVars.oid in the loop will be freed later.
            if (i > 0)
            {
                    SnmpFreeDescriptor ( SNMP_SYNTAX_OID, (smiLPOPAQUE)&gVars.oid);
            }

            if ( SNMP_FAILURE ( SnmpStrToOid( gVars.pszOid[i] , &gVars.oid ) ) )
            {
                if ( SnmpMgrStrToOid( gVars.pszOid[i] , (AsnObjectIdentifier *)&gVars.oid ) == FALSE )
                {
                    PrintDbgMessage( "snmputil: Failed in SnmpStrToOid( ) or SnmpMgrStrToOid( ) function ..\n" );
                    return ( FALSE );
                }
            }
            // append vb to Vbl
            if ( SNMP_FAILURE ( SnmpSetVb(pSession->hVbl,    0, &gVars.oid, NULL    ) ) )
            {
                PrintDbgMessage( "snmputil: Failed in SnmpSetVb( ) function ..\n" );
                return ( FALSE );
            }
        }

    }

    pSession->nRequestId = gVars.nRequestId++;

    // create a pdu using the parameters in pSession structure
    pSession->hPdu = SnmpCreatePdu( pSession->hSnmpSession,
                                      pSession->nPduType,
                                      pSession->nRequestId,
                                      ( ( gVars.operation == GET_BULK ) ? gVars.non_repeaters : 0 ),
                                      ( ( gVars.operation == GET_BULK ) ? gVars.max_repetitions : 0 ),
                                      pSession->hVbl );

    if ( SNMP_FAILURE ( pSession->hPdu ) )
    {
        PrintDbgMessage( "snmputil: Failed in creating PDU ..\n " );
        return (FALSE);
    }

    // send the message to the agent
    pSession->nError = SnmpSendMsg(    pSession->hSnmpSession,
                                        pSession->hManagerEntity,
                                        pSession->hAgentEntity,
                                        pSession->hViewContext,
                                        pSession->hPdu );

    if ( gVars.operation != SUB_TREE ) SnmpFreeDescriptor ( SNMP_SYNTAX_OID, (smiLPOPAQUE)&gVars.oid);

    // check error status and return.
    if ( SNMP_FAILURE( pSession->nError ) )
    {

         pSession->nError = SnmpGetLastError( pSession->hSnmpSession );
         PrintDbgMessage( "snmputil: Failed in send message, Last Error %d \n", pSession->nError );
         FreeVblandPdu( pSession );
         return (FALSE);
    }
    else
    {

        FreeVblandPdu( pSession );
        return ( ProcessAgentResponse ( pSession ) );
    }

} //end of CreatePduSendRequest

BOOL CreateVbl | ( | PSNMP_MGR_SESSION | pSession,
 |  | smiOID * | pOid,
 |  | smiVALUE * | pValue
 | ) |  |

Definition at line 787 of file WSnmpUtil.Cpp.

{

    // check for NULL pointers
    if ( ( pOid == NULL )    ||
         ( pSession == NULL ) )
         return FALSE;

    // create the var bind list.
    pSession->hVbl = SnmpCreateVbl( pSession->hSnmpSession,
                                      pOid,
                                    ( ( pSession->nPduType == SNMP_PDU_SET ) ? pValue : NULL ) );

    if ( SNMP_FAILURE( pSession->hVbl ) )
        return FALSE;
    else
        return TRUE;

} //end of CreateVbl

BOOL DestroyNotificationWindow ( PSNMP_MGR_SESSION pSession )

Definition at line 513 of file WSnmpUtil.Cpp.

{
    BOOL    fOk;

    // destroy the notification window.
    return( fOk = DestroyWindow( pSession->hWnd ) );
} // end of DestroyNotificationWindow

void FreeVblandPdu ( PSNMP_MGR_SESSION pSession )

Definition at line 813 of file WSnmpUtil.Cpp.

{
    if ( pSession == NULL )
        return;

    pSession->nError = SnmpFreeVbl( pSession->hVbl );
    if ( SNMP_FAILURE( pSession->nError ) )
    {
        pSession->nError = SnmpGetLastError( pSession->hSnmpSession );
        PrintDbgMessage( "snmputil: failure in SnmpFreeVbl %d \n ", pSession->nError );
    }

    pSession->nError = SnmpFreePdu( pSession->hPdu );
    if ( SNMP_FAILURE( pSession->nError ) )
    {
        pSession->nError = SnmpGetLastError( pSession->hSnmpSession );
        PrintDbgMessage( "snmputil: failure in SnmpFreePdu %d \n ", pSession->nError );
    }

} // end of FreeVblandPdu

LRESULT CALLBACK NotificationWndProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 545 of file WSnmpUtil.Cpp.

{
    // check for winsnmp notification
    if (uMsg == WM_SNMP_INCOMING)
    {

        PSNMP_MGR_SESSION pSession;

        // retrieve session pointer from window
        pSession = (PSNMP_MGR_SESSION)GetWindowLongPtr(hWnd, 0);

        // validate session ptr
        if ( pSession == NULL )
            return (LRESULT)0;

        // process notification message
        if ( ProcessNotification( pSession ) )
        {
            // post message to break out of message pump
            PostMessage( pSession->hWnd, WM_SNMP_DONE, (WPARAM)0, (LPARAM)0 );
        }

        return (LRESULT)0;

    }
    else
    {
        // forward all other messages to windows
        return DefWindowProc(hWnd, uMsg, wParam, lParam);
    }

} // end of NotificationWndProc

BOOL OpenWinSNMPSession ( PSNMP_MGR_SESSION pSession )

Definition at line 272 of file WSnmpUtil.Cpp.

{

    smiOCTETS smiCommunity;

    if ( pSession == NULL )
        return ( FALSE );

    // create a remote session
    pSession->hSnmpSession = SnmpOpen( pSession->hWnd, WM_SNMP_INCOMING );

    if ( SNMP_FAILURE( pSession->hSnmpSession ) )
        return ( FALSE );

    if ( gVars.pAgentStrAddr != NULL )
    {

        // create a remote agent entity
        pSession->hAgentEntity = SnmpStrToEntity( pSession->hSnmpSession,
                                            inet_ntoa( gVars.agentSockAddr.sin_addr ) );

        if ( SNMP_FAILURE( pSession->hAgentEntity ) )
            return ( FALSE );

        // attach timeout specified with agent
        SnmpSetTimeout( pSession->hAgentEntity, gVars.nTimeOut / 10 );

        // attach retries specified with agent
        SnmpSetRetry( pSession->hAgentEntity, gVars.nRetries );

        // create local manager entity
        pSession->hManagerEntity = SnmpStrToEntity(
                                     pSession->hSnmpSession,
                                     DEFAULT_ADDRESS_IP );
        if ( SNMP_FAILURE( pSession->hManagerEntity ) )
            return ( FALSE );

        // attach timeout specified with manager
        SnmpSetTimeout( pSession->hManagerEntity, gVars.nTimeOut / 10 );

        // attach retries specified with manager
        SnmpSetRetry( pSession->hManagerEntity, gVars.nRetries );

    } // end of if ( pAgentStrAddr )

        // validate pointer
    if ( gVars.pAgentCommunity != NULL)
    {

        // transfer community string
        smiCommunity.ptr = (smiLPBYTE)gVars.pAgentCommunity;
        smiCommunity.len = gVars.pAgentCommunity ? lstrlen( gVars.pAgentCommunity) : 0;

        // obtain context from community string
        pSession->hViewContext = SnmpStrToContext(
                                     pSession->hSnmpSession,
                                     &smiCommunity
                                    );

        // validate context handle
        if ( SNMP_FAILURE( pSession->hViewContext) )
            return ( FALSE );

    }

    // success
    return (TRUE);

}  //end of OpenWinSNMP Session

void ParseAndPrintv2Trap ( PSNMP_MGR_SESSION pSession )

Definition at line 648 of file Helper.Cpp.

{
    smiOID      sysUpTime,
                snmpTrapOid,
                snmpTrapEnterprise,
                snmpTraps,
                snmpTrapEnterpriseOID,
                tmpOid;

    smiINT      result;
    smiVALUE    value;

    DWORD       oidCount;
    DWORD       index;
    int         genTrap;
    char        szBuf[ MAX_BUFFER_LEN ];
    char        szSecString[ MAX_BUFFER_LEN ];
    AsnObjectIdentifier  Oid;      //unfortunate that there is no better way
    LPSTR       string = NULL;
    BOOL        entOid = FALSE;

    if ( pSession == NULL )
        return;

    // convert to oids.

    if ( SNMP_FAILURE( SnmpStrToOid( "1.3.6.1.2.1.1.3", &sysUpTime ) ) )
        return;
    if ( SNMP_FAILURE( SnmpStrToOid( "1.3.6.1.6.3.1.1.4", &snmpTrapOid ) ) )
        return;
    if ( SNMP_FAILURE( SnmpStrToOid( "1.3.6.1.6.3.1.1.4", &snmpTrapEnterprise ) ) )
        return;
    if ( SNMP_FAILURE( SnmpStrToOid( "1.3.6.1.6.3.1.1.5", &snmpTraps ) ) )
        return;
    if ( SNMP_FAILURE( SnmpStrToOid( "1.3.6.1.6.3.1.1.4.3.0", &snmpTrapEnterpriseOID ) ) )
        return;

    oidCount = SnmpCountVbl ( pSession->hVbl );

    for( index = 1; index <= oidCount; index++ )
    {
        // print out varbind (name, value) pair in format of:
        // Name in numerical form
        // Name in string form
        // value
        // generic trap name (if this varbind is a generic trap)
        SnmpGetVb( pSession->hVbl, index, &tmpOid, &value );
        printf( "OID :" );
        memset( szBuf, 0, MAX_BUFFER_LEN );
        SnmpOidToStr( &tmpOid, MAX_BUFFER_LEN, szBuf );
        printf( szBuf );
        printf ( "\n\r" );

        if (index == oidCount)
        {
            // Check if the last variable binding equals to "snmpTrapEnterpriseOID.0"
            SnmpOidCompare( &snmpTrapEnterpriseOID, &tmpOid, snmpTrapEnterpriseOID.len, &result );
            entOid = (result == 0);
        }

        // The old mgmtapi requires a leading dot....
        strcpy( szSecString, "." );
        strcat( szSecString, szBuf );

        if ( SnmpMgrStrToOid( szSecString, &Oid ) )
        {
            SnmpMgrOidToStr( &Oid, &string );
        }

        if ( string )
        {
            printf( "OID string: %s \n", string );
            SnmpUtilMemFree( string );
            SnmpUtilOidFree ( &Oid);
        }
        else
        {
            printf( "OID string: <Can't convert oid to string form>\n");
        }
        SnmpFreeDescriptor ( SNMP_SYNTAX_OID, (smiLPOPAQUE)&tmpOid);

        PrintOidValue( &value );

        // process generic traps only ..
        if ( value.syntax == SNMP_SYNTAX_OID )
        {
            tmpOid = value.value.oid; // structure copy ..

            SnmpOidCompare( &snmpTraps, &tmpOid, snmpTraps.len, &result );

            if ( !result )
            {
                if ( tmpOid.len == ( snmpTraps.len + 1 ) )
                {
                    genTrap = tmpOid.ptr[ snmpTraps.len ];

                    switch( genTrap )
                        {
                        case 1:
                            PrintDbgMessage( "ColdStart \n" );
                            break;
                        case 2:
                            PrintDbgMessage( "WarmStart \n" );
                            break;
                        case 3:
                            PrintDbgMessage( "LinkDown \n" );
                            break;
                        case 4:
                            PrintDbgMessage( "LinkUp \n" );
                            break;
                        case 5:
                            PrintDbgMessage( "Authentication Failure \n" );
                            break;
                        case 6:
                            PrintDbgMessage( "EGP Neighbor Loss \n" );
                            break;
                        case 7:
                            PrintDbgMessage( "enterprise specific \n" );
                            break;
                        default:
                            break;
                        }
                }
            }
        }

        printf( "\n\r\n\r" );

        if ( entOid )
        {
            PrintDbgMessage( "Enterprise specific oid from v1 trap \n" );
            PrintDbgMessage( "\n\r\n\r" );
        }

        if  ( value.syntax == SNMP_SYNTAX_OCTETS )
        {
            SnmpFreeDescriptor ( SNMP_SYNTAX_OCTETS, (smiLPOPAQUE)&value.value.string);
        }
        if  ( value.syntax == SNMP_SYNTAX_OID )
        {
            SnmpFreeDescriptor ( SNMP_SYNTAX_OID, (smiLPOPAQUE)&value.value.oid);
        }
    }

        SnmpFreeDescriptor ( SNMP_SYNTAX_OID, (smiLPOPAQUE)&sysUpTime);
        SnmpFreeDescriptor ( SNMP_SYNTAX_OID, (smiLPOPAQUE)&snmpTrapOid);
        SnmpFreeDescriptor ( SNMP_SYNTAX_OID, (smiLPOPAQUE)&snmpTrapEnterprise);
        SnmpFreeDescriptor ( SNMP_SYNTAX_OID, (smiLPOPAQUE)&snmpTraps);
        SnmpFreeDescriptor ( SNMP_SYNTAX_OID, (smiLPOPAQUE)&snmpTrapEnterpriseOID);

}

BOOL ParseCommandLine | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 110 of file Helper.Cpp.

{

    char        localOid[] = "1.3.6.1.2.1";

    // should we wait for traps?
    if ( (argc < 5) && (argc != 2) )
    {
        Usage( );
        return ( FALSE );
    }
    else if ( (_stricmp( argv[1], "trap")) && (argc < 5) )
    {
        Usage( );
        return ( FALSE );
    }

    // init the class
    gVars.oidCount = 0;

    // update the pointers.
    ++argv;
    --argc;

    if ( !_stricmp( *argv, "trap" ) )
    {
        gVars.operation = TRAP;        // wait for traps.
        return ( TRUE );
    }
    else if ( !_stricmp(*argv, "-v2") )
    {
        gVars.version = TRUE;   // use v2c mode.
    }
    else if ( !_stricmp(*argv, "-v1") )
    {
        gVars.version = FALSE;   // use v1 mode.
    }

    // update the pointers.
    ++argv;
    --argc;

    // check the operation specified.
    if ( !_stricmp( *argv, "get" ) )
    {
        gVars.operation = GET;        // do a get.
    }
    else if ( !_stricmp( *argv, "getnext" ) )
    {
        gVars.operation = GET_NEXT;    // do get next.
    }
    else if ( !_stricmp( *argv, "walk" ) )
    {
        gVars.operation = WALK;        // do a walk.
    }
    else if ( !_stricmp( *argv, "set" ) )
    {
        gVars.operation = SET;        // do a set.
    }
    else if ( !_stricmp( *argv, "getbulk" ) )
    {
        gVars.operation = GET_BULK;    // do get bulk operation.
    }
    else if ( !_stricmp( *argv, "subtree" ) )
    {
        gVars.operation = SUB_TREE;    // go through the sub tree.
    }
    else
    {
        Usage( );
        return ( FALSE );
    }

    // Get agent address...
    argv++;
    argc--;

    gVars.pAgentStrAddr = (LPSTR)SnmpUtilMemAlloc( (int) (strlen(*argv) + 1) );
    if ( gVars.pAgentStrAddr == NULL )
    {
        PrintDbgMessage( "wsnmputil: Memory allocation failed ..\n" );
        return ( FALSE );
    }

    strcpy( gVars.pAgentStrAddr, *argv );

    // convert the string to IP address.
    if ( ConvertTexttoIp(*argv) == FALSE )
    {
        PrintDbgMessage( "Invalid SNMP agent ..\n" );
        return ( FALSE );
    }

    // Get agent community...
    argv++;
    argc--;

    gVars.pAgentCommunity = (LPSTR)SnmpUtilMemAlloc( (int) (strlen( *argv ) + 1 ));
    if ( gVars.pAgentCommunity == NULL )
    {
        PrintDbgMessage( "wsnmputil: Memory allocation failed ..\n" );
        return ( FALSE );
    }

    strcpy( gVars.pAgentCommunity, *argv );

    //   If it is a GetBulkRequest
    //   Get non_repeaters field and max_repetitions field for
    //   SNMP_PDU_GETBULK PDU.

    if (gVars.operation == GET_BULK)
    {
        argv++;
        argc--;
        if (argc)
            gVars.non_repeaters = atol(*argv);
        else
            return FALSE;
        argv++;
        argc--;
        if (argc)
            gVars.max_repetitions = atol(*argv);
        else
            return FALSE;
    }

    // ensure that the command line arguments are less than CMD_LINE_ARGS
    while( ( --argc ) && ( gVars.oidCount < CMD_LINE_ARGS ) )
    {
        argv++;

        if ( ( ( gVars.operation == WALK  ) || ( gVars.operation == SUB_TREE ) )
             && ( strlen( *argv ) <= 3 ) )
        {

            if ( ( *argv[0] ) == '.' )
            {
                // trying to preserve old snmputil behavior.
                // if the user wants to browse a tree starting from .1
                // or if the user wants to browse the tree from .2

                gVars.pszOid[ gVars.oidCount ] = (LPSTR)SnmpUtilMemAlloc( (int)(strlen( localOid )) + (int) (strlen( *argv ) + 1 ));
                if ( gVars.pszOid[ gVars.oidCount ] == NULL )
                {
                    PrintDbgMessage( "wsnmputil: Memory allocation failed ..\n" );
                    return ( FALSE );
                }
                strcpy( gVars.pszOid[ gVars.oidCount ], localOid );
                strcat( gVars.pszOid[ gVars.oidCount ], *argv );
            }
            else if ( isdigit( *argv[0] ) != 0 )
            {
                // if the user wants to browse the tree from 1 or 2

                gVars.pszOid[ gVars.oidCount ] = (LPSTR)SnmpUtilMemAlloc( (int)(strlen( localOid )) + (int) (strlen( *argv ) + 2 ));
                if ( gVars.pszOid[ gVars.oidCount ] == NULL )
                {
                    PrintDbgMessage( "wsnmputil: Memory allocation failed ..\n" );
                    return ( FALSE );
                }
                strcpy( gVars.pszOid[ gVars.oidCount ], localOid );
                strcat( gVars.pszOid[ gVars.oidCount ], "." );
                strcat( gVars.pszOid[ gVars.oidCount ], *argv );
            }
            else
            {
                gVars.pszOid[ gVars.oidCount ] = (LPSTR)SnmpUtilMemAlloc( (int)(strlen( *argv ) + 1 ));
                if ( gVars.pszOid[ gVars.oidCount ] == NULL )
                {
                    PrintDbgMessage( "wsnmputil: Memory allocation failed ..\n" );
                    return ( FALSE );
                }
                strcpy( gVars.pszOid[ gVars.oidCount ], *argv );
            }

            ++gVars.oidCount;
            // do a walk or SUB_TREE on one oid.
            break;
        }
        else if ( gVars.operation == SET )
        {
            if ( gVars.pszOid[ gVars.oidCount ] == NULL )
            {
                gVars.pszOid[ gVars.oidCount ] = ( LPSTR )SnmpUtilMemAlloc( (int) (strlen( ( *argv ) ) + 1 ));
                if ( gVars.pszOid[ gVars.oidCount ] == NULL )
                {
                    PrintDbgMessage( "wsnmputil: Memory allocation failed ..\n" );
                    return ( FALSE );
                }
                strcpy( gVars.pszOid[ gVars.oidCount ], *argv );
            }
            else
            {
                gVars.pSetValue = ( LPSTR )SnmpUtilMemAlloc( (int)(strlen( *argv ) + 1 ));
                if ( gVars.pszOid[ gVars.oidCount ] == NULL )
                {
                    PrintDbgMessage( "wsnmputil: Memory allocation failed ..\n" );
                    return ( FALSE );
                }
                strcpy( gVars.pSetValue, *argv );
                break; // we only do a SET for 1 pair of (name, value) varbinding
            }

        }
        else
        {
            gVars.pszOid[ gVars.oidCount ] = (LPSTR)SnmpUtilMemAlloc( (int)(strlen( *argv ) + 1 ));
            if ( gVars.pszOid[ gVars.oidCount ] == NULL )
            {
                PrintDbgMessage( "wsnmputil: Memory allocation failed ..\n" );
                return ( FALSE );
            }
            strcpy( gVars.pszOid[ gVars.oidCount ], *argv );
            ++gVars.oidCount;
        }

    }

    if (gVars.operation == GET_BULK)
    {
        //check if user has entered valid arguments for GET_BULK operation
        if (gVars.non_repeaters < 0 || gVars.max_repetitions < 0 )
            return (FALSE);
        if (gVars.oidCount < gVars.non_repeaters)
            return (FALSE);
    }

    return ( TRUE );
}  // end of ParseCommandLine

void PrintDbgMessage | ( | LPSTR | ,
 |  |  | ...
 | ) |  |

Definition at line 51 of file Helper.Cpp.

{
    va_list argList;
    char    szBuf[ 1024 ];

    va_start ( argList, szFormat );
    vsprintf     ( szBuf, szFormat, argList );
    va_end     ( argList );

    printf     ( szBuf );
}  //end of PrintDbgMessage

void PrintOidValue ( smiVALUE * value )

Definition at line 425 of file Helper.Cpp.

{

    if ( pValue == NULL )
        return;

    switch( pValue->syntax )
    {
        case SNMP_SYNTAX_INT32:
            printf( "INTEGER: %ld \n", pValue->value.sNumber );
            break;
        case SNMP_SYNTAX_UINT32:
            printf( "UNSIGNED INTEGER: %ld \n", pValue->value.uNumber );
            break;
        case SNMP_SYNTAX_CNTR32:
            printf( "COUNTER: %ld \n", pValue->value.uNumber );
            break;
        case SNMP_SYNTAX_GAUGE32:
            printf( "GAUGE: %ld \n", pValue->value.uNumber );
            break;
        case SNMP_SYNTAX_TIMETICKS:
            printf( "TIMETICKS: %ld \n", pValue->value.uNumber );
            break;
        case SNMP_SYNTAX_CNTR64:
            printf( "COUNTER64: %ld%ld \n", pValue->value.hNumber.hipart,
                                        pValue->value.hNumber.lopart );
            break;
        case SNMP_SYNTAX_OCTETS:
        {
            UINT  J;
            BOOL  IsDisplayString = TRUE;
            LPSTR StringFormat;
            for ( J=0; J < pValue->value.string.len && IsDisplayString; J++ )
            {
                IsDisplayString = isprint( pValue->value.string.ptr[J] );
            }
            StringFormat = IsDisplayString ? "%c" : "<0x%02x>" ;

            printf( "OCTET STRING - " );
            for ( J=0; J < pValue->value.string.len; J++ )
            {
                printf( StringFormat, pValue->value.string.ptr[J] );
            }
            putchar( '\n' );
        }
            break;

        case SNMP_SYNTAX_BITS:
        {
            UINT J;
            printf( "Bits - " );
            for ( J=0; J < pValue->value.string.len; J++ )
            {
                printf( "0x%x ", pValue->value.string.ptr[J] );
            }
            putchar( '\n' );
        }
            break;

        case SNMP_SYNTAX_OPAQUE:
        {
            UINT J;
            printf( "Opaque - " );
            for ( J=0; J < pValue->value.string.len; J++ )
            {
                printf( "0x%x ", pValue->value.string.ptr[J] );
            }
            putchar( '\n' );
        }
            break;

        case SNMP_SYNTAX_IPADDR:
        {
            printf( "IpAddress - " );
            printf( "%d.%d.%d.%d ",
                  pValue->value.string.ptr[0] ,
                  pValue->value.string.ptr[1] ,
                  pValue->value.string.ptr[2] ,
                  pValue->value.string.ptr[3] );
            putchar( '\n' );
        }
            break;

        case SNMP_SYNTAX_NSAPADDR:
            break;

        case SNMP_SYNTAX_OID:
        {
            UINT J;
            printf( "OBJECT IDENTIFIER - " );
            for ( J=0; J < pValue->value.oid.len; J++ )
            {
                printf( ".%d", pValue->value.oid.ptr[J] );
            }
            putchar( '\n' );
        }
            break;

        case SNMP_SYNTAX_NULL:
            printf( "NULL - NULL \n" );
            break;

        case SNMP_SYNTAX_NOSUCHOBJECT:
            printf( "No such object ..\n" );
            break;

        case SNMP_SYNTAX_NOSUCHINSTANCE:
            printf( "No such instance ..\n" );
            break;

        case SNMP_SYNTAX_ENDOFMIBVIEW:
            printf( " End of MibView ..\n " );
            break;

        default:
            printf( "Invalid Type ..\n" );
            break;
    }

}  //end of PrintOidValue

BOOL PrintVarBind ( PSNMP_MGR_SESSION pSession )

Definition at line 554 of file Helper.Cpp.

{
    char                 szBuf[ MAX_BUFFER_LEN ];
    char                 szSecString[ MAX_BUFFER_LEN ];
    int                     oidCount;
    int                     i;
    smiINT               result;
    AsnObjectIdentifier  Oid;      //unfortunate that there is no better way
    LPSTR                string = NULL;

    oidCount = SnmpCountVbl( pSession->hVbl );

    // using gVars.oid for walk operation.
    // doesnt hurt when using get, get next operations as well.

    for( i = 1; i <= oidCount; i++ )
    {

        if (i > 1) //free the last gVars.oid before getting a new one
        {
            SnmpFreeDescriptor ( SNMP_SYNTAX_OID, (smiLPOPAQUE)&gVars.oid);
            if  ( gVars.value.syntax == SNMP_SYNTAX_OCTETS )
            {
                SnmpFreeDescriptor ( SNMP_SYNTAX_OCTETS, (smiLPOPAQUE)&gVars.value.value.string);
            }
            if  ( gVars.value.syntax == SNMP_SYNTAX_OID )
            {
                SnmpFreeDescriptor ( SNMP_SYNTAX_OID, (smiLPOPAQUE)&gVars.value.value.oid);
            }
        }

        SnmpGetVb( pSession->hVbl, i, &gVars.oid, &gVars.value );

        // a special case for SUB_TREE walk.
        if ( gVars.operation == SUB_TREE )
        {
            SnmpOidCompare( &gVars.startOid, &gVars.oid, ( gVars.startOid.len ), &result );
            if ( result != 0 )
                    return FALSE;
        }
        // a special case for WALK operation.
        if (gVars.operation == WALK && gVars.value.syntax == SNMP_SYNTAX_ENDOFMIBVIEW)
        {
            return FALSE;
        }

        if ( gVars.doSet == FALSE )
        {
            printf( "OID :" );
            memset( szBuf, 0, MAX_BUFFER_LEN );
            SnmpOidToStr( &gVars.oid, MAX_BUFFER_LEN, szBuf );
            printf( szBuf );
            printf ( "\n\r" );

            // The old mgmtapi requires a leading dot....
            strcpy( szSecString, "." );
            strcat( szSecString, szBuf );

            if ( SnmpMgrStrToOid( szSecString, &Oid ) )
            {
                SnmpMgrOidToStr( &Oid, &string );
            }

            if ( string )
            {
                printf( "%s \n", string );
                SnmpUtilMemFree( string );
                SnmpUtilOidFree ( &Oid);
            }

            PrintOidValue( &gVars.value );
            printf( "\n\r\n\r" );
        }

    }

    return TRUE;

}  //PrintVarBind

BOOL ProcessAgentResponse ( PSNMP_MGR_SESSION pSession )

Definition at line 747 of file WSnmpUtil.Cpp.

{

    MSG        uMsg;
    BOOL    fOk = FALSE;

    if ( pSession == NULL )
        return FALSE;

    // get the next message for this session
    while ( GetMessage( &uMsg, pSession->hWnd, 0, 0) )
    {

        // check for private message
        if ( uMsg.message != WM_SNMP_DONE)
        {
            TranslateMessage(&uMsg);
            DispatchMessage(&uMsg);
        }
        else
        {
            // success
            fOk = TRUE;
            break;
        }
    }

    return fOk;

} // end of ProcessAgentResponse

BOOL ProcessNotification ( PSNMP_MGR_SESSION pSession )

Definition at line 590 of file WSnmpUtil.Cpp.

{

    BOOL           fDone = TRUE;
    SNMPAPI_STATUS status;
    HSNMP_ENTITY   hAgentEntity   = (HSNMP_ENTITY)NULL;
    HSNMP_ENTITY   hManagerEntity = (HSNMP_ENTITY)NULL;
    HSNMP_CONTEXT  hViewContext   = (HSNMP_CONTEXT)NULL;
    smiINT32       nPduType;
    smiINT32       nRequestId;
    char           szBuf[1024];

    // validate pointer
    if ( pSession == NULL )
        return FALSE;

    // retrieve message
    status = SnmpRecvMsg(
                pSession->hSnmpSession,
                &hAgentEntity,
                &hManagerEntity,
                &hViewContext,
                &pSession->hPdu
                );

    // validate return code
    if ( status != SNMPAPI_FAILURE )
    {
        // retrieve pdu data
        status = SnmpGetPduData(
                    pSession->hPdu,
                    &nPduType,
                    &nRequestId,
                    &pSession->nErrorStatus,
                    &pSession->nErrorIndex,
                    &pSession->hVbl
                    );

        // validate return code
        if ( status != SNMPAPI_FAILURE )
        {

            // process reponse to request
            if (nPduType == SNMP_PDU_RESPONSE)
            {
                // validate context information
                if (( pSession->nRequestId   == nRequestId ) &&
                    ( pSession->hViewContext == hViewContext ) &&
                    ( pSession->hAgentEntity == hAgentEntity ) &&
                    ( pSession->hManagerEntity == hManagerEntity ) )
                {

                    // if we hit the end of tree, break.
                    if ( PrintVarBind( pSession ) == FALSE )
                        gVars.fDone = TRUE;

                }
                else
                {
                    // continue
                    fDone = FALSE;
                }

            }
            else if (nPduType == SNMP_PDU_TRAP)
            {

                status = SnmpEntityToStr( hAgentEntity, 1024, szBuf );
                if ( ! (SNMP_FAILURE ( status )  ) )
                    PrintDbgMessage( "Agent : %s \n\n", szBuf );

                // Process the TRAP
                ParseAndPrintv2Trap( pSession );

            }
            else
            {
                PrintDbgMessage( "snmputil: Invalid PDU type %d \n", nPduType );
                // continue
                fDone = FALSE;
            }

        }
        else
            PrintDbgMessage( "snmputil: SnmpGetPduData returned error %d \n", SnmpGetLastError( pSession->hSnmpSession ) );

        // release temporary entity
        SnmpFreeEntity(hAgentEntity);

        // release temporary entity
        SnmpFreeEntity(hManagerEntity);

        // release temporary context
        SnmpFreeContext(hViewContext);

    }

    // release pdu
    FreeVblandPdu( pSession );

    return fDone;

}  //end of ProcessNotification

void Usage ( )

Definition at line 1619 of file ComPerf.Cpp.

{
  _tprintf(TEXT("Usage: COMPERF [machine name | IP address | /? | -?]\n\n"));
  _tprintf(TEXT("/?\t\t\tDisplays this help screen.\n"));
  _tprintf(TEXT("machine name\t\tName of remote machine.\n"));
  _tprintf(TEXT("IP address\t\tIP address of remote machine.\n\n"));
  _tprintf("%s", PURPOSE);
}

BOOL WaitForTraps ( PSNMP_MGR_SESSION pSession )

Definition at line 702 of file WSnmpUtil.Cpp.

{
    SNMPAPI_STATUS    status;

    if ( pSession == NULL )
        return( FALSE );

    // re-iniialize.

    pSession->nError = 0;

    // register
    status = SnmpRegister(
                 pSession->hSnmpSession,
                (HSNMP_ENTITY)NULL,     // hManagerEntity
                (HSNMP_ENTITY)NULL,     // hAgentEntity
                (HSNMP_CONTEXT)NULL,    // hViewContext
                (smiLPCOID)NULL,        // notification
                SNMPAPI_ON
                );

    if ( SNMP_FAILURE( status ) )
    {
        pSession->nError = SnmpGetLastError( pSession->hSnmpSession );
        PrintDbgMessage( "snmputil: Failed in SnmpRegister %d \n", pSession->nError );
        return (FALSE);
    }
    else
    {
        printf("WSnmpUtil: listening for traps...\n");
        while( ProcessAgentResponse ( pSession ) )
        {
        }
    }
    return TRUE;

} //end of WaitForTraps

Variable Documentation

GlobalVars gVars

Definition at line 24 of file WSnmpUtil.Cpp.

Generated on Wed Nov 13 2024 16:54:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/SyncMgr/SyncDir/Alloc.Cpp File Reference

  • NetDS
  • SyncMgr
  • SyncDir
Functions

Alloc.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

LPVOID | ALLOC (ULONG cb)
void | FREE (void *pv)
void __cdecl | operator delete (void FAR *lpv)
void *__cdecl | operator new (size_t size)
LPVOID | REALLOC (void *pv, ULONG cb)

Function Documentation

LPVOID ALLOC ( ULONG cb )

Definition at line 66 of file Alloc.Cpp.

{
void *pv;

    pv = LocalAlloc(LMEM_FIXED,cb);

#ifdef _DEBUG
    if (NULL != pv) // under debug always initialize to -1 to catch unitialize errors.
    {
        memset(pv,MEMINITVALUE,cb);
    }
#endif // _DEBUG

    return pv;
}

void FREE ( void * pv )

Definition at line 98 of file Alloc.Cpp.

{
#ifdef _DEBUG
    if (NULL != pv) // under debug always initialize to -1 to catch unitialize errors.
    {
    UINT cb;

        Assert(LMEM_INVALID_HANDLE != LocalFlags(pv));

        cb = (UINT)LocalSize(pv); // returns zero on failure
        memset(pv,MEMFREEVALUE,cb);
    }

    Assert(pv);

#endif // _DEBUG

    LocalFree(pv);
}

void __cdecl operator delete ( void FAR * lpv ) [inline]

Definition at line 46 of file Alloc.Cpp.

{
    FREE(lpv);
}

void* __cdecl operator new ( size_t size ) [inline]

Definition at line 27 of file Alloc.Cpp.

{
    return((void *)ALLOC(size));
}

LPVOID REALLOC | ( | void * | pv,
 |  | ULONG | cb
 | ) |  |

Definition at line 134 of file Alloc.Cpp.

{

    Assert(pv);

    pv =  LocalReAlloc(pv,cb,LMEM_MOVEABLE);

    return pv;
}

Generated on Wed Nov 13 2024 16:54:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/SyncMgr/SyncDir/Alloc.h File Reference

  • NetDS
  • SyncMgr
  • SyncDir
Functions

Alloc.h File Reference

Go to the source code of this file.

Functions

LPVOID | ALLOC (ULONG cb)
void | FREE (void *pv)
void __cdecl | operator delete (void FAR *lpv)
void *__cdecl | operator new (size_t size)
LPVOID | REALLOC (void *pv, ULONG cb)

Function Documentation

LPVOID ALLOC ( ULONG cb )

Definition at line 66 of file Alloc.Cpp.

{
void *pv;

    pv = LocalAlloc(LMEM_FIXED,cb);

#ifdef _DEBUG
    if (NULL != pv) // under debug always initialize to -1 to catch unitialize errors.
    {
        memset(pv,MEMINITVALUE,cb);
    }
#endif // _DEBUG

    return pv;
}

void FREE ( void * pv )

Definition at line 98 of file Alloc.Cpp.

{
#ifdef _DEBUG
    if (NULL != pv) // under debug always initialize to -1 to catch unitialize errors.
    {
    UINT cb;

        Assert(LMEM_INVALID_HANDLE != LocalFlags(pv));

        cb = (UINT)LocalSize(pv); // returns zero on failure
        memset(pv,MEMFREEVALUE,cb);
    }

    Assert(pv);

#endif // _DEBUG

    LocalFree(pv);
}

void __cdecl operator delete ( void FAR * lpv ) [inline]

Definition at line 46 of file Alloc.Cpp.

{
    FREE(lpv);
}

void* __cdecl operator new ( size_t size ) [inline]

Definition at line 17 of file heap.Cpp.

{
  return HeapAlloc(g_hGeneralHeap, 0, nSize);
}

LPVOID REALLOC | ( | void * | pv,
 |  | ULONG | cb
 | ) |  |

Definition at line 134 of file Alloc.Cpp.

{

    Assert(pv);

    pv =  LocalReAlloc(pv,cb,LMEM_MOVEABLE);

    return pv;
}

Generated on Wed Nov 13 2024 16:54:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/SyncMgr/SyncDir/Cfact.Cpp File Reference

  • NetDS
  • SyncMgr
  • SyncDir
Functions | Variables

Cfact.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CClassFactory

Variables

EXTERN_C const GUID | CLSID_SyncMgrHandler
UINT g_cRefThisDll
HINSTANCE | g_hmodThisDll

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 130 of file Cfact.Cpp.

{
    if (--m_cRef)
        return m_cRef;

    delete this;

    return 0L;
}

Variable Documentation

EXTERN_C const GUID CLSID_SyncMgrHandler

Definition at line 18 of file Cfact.Cpp.

UINT g_cRefThisDll

Definition at line 24 of file DllMain.Cpp.

HINSTANCE g_hmodThisDll

Definition at line 25 of file DllMain.Cpp.

Generated on Wed Nov 13 2024 16:54:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/SyncMgr/SyncDir/Cfact.h File Reference

  • NetDS
  • SyncMgr
  • SyncDir
Classes | Typedefs

Cfact.h File Reference

Go to the source code of this file.

Classes

class | CClassFactory

Typedefs

typedef CClassFactory * | LPCClassFactory

Typedef Documentation

typedef CClassFactory* LPCClassFactory

Definition at line 34 of file Cfact.h.

Generated on Wed Nov 13 2024 16:54:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/SyncMgr/SyncDir/Critsect.Cpp File Reference

  • NetDS
  • SyncMgr
  • SyncDir

Critsect.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/SyncMgr/SyncDir/Critsect.h File Reference

  • NetDS
  • SyncMgr
  • SyncDir
Classes | Defines

Critsect.h File Reference

Go to the source code of this file.

Classes

class | CCriticalSection
class | CLock
class | CLockHandler

Defines

#define | ASSERT_LOCKHELD(pLockHandler) Assert(pLockHandler->GetLockThreadId() == GetCurrentThreadId());
#define | ASSERT_LOCKNOTHELD(pLockHandler) Assert(pLockHandler->GetLockThreadId() == 0);

Define Documentation

#define ASSERT_LOCKHELD ( pLockHandler ) Assert(pLockHandler->GetLockThreadId() == GetCurrentThreadId());

Definition at line 143 of file Critsect.h.

#define ASSERT_LOCKNOTHELD ( pLockHandler ) Assert(pLockHandler->GetLockThreadId() == 0);

Definition at line 144 of file Critsect.h.

Generated on Wed Nov 13 2024 16:54:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/SyncMgr/SyncDir/Debug.Cpp File Reference

  • NetDS
  • SyncMgr
  • SyncDir

Debug.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/SyncMgr/SyncDir/Debug.h File Reference

  • NetDS
  • SyncMgr
  • SyncDir
Defines

Debug.h File Reference

Go to the source code of this file.

Defines

#define | Assert(a)
#define | AssertSz(a, b)
#define | Puts(s)
#define | TRACE(s)

Define Documentation

#define Assert ( a )

Definition at line 40 of file Debug.h.

#define AssertSz | ( | a,
 |  | b
 | ) |

Definition at line 41 of file Debug.h.

#define Puts ( s )

Definition at line 42 of file Debug.h.

#define TRACE ( s )

Definition at line 43 of file Debug.h.

Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/SyncMgr/SyncDir/DllMain.Cpp File Reference

  • NetDS
  • SyncMgr
  • SyncDir
Functions | Variables

DllMain.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvOut)
int APIENTRY | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

EXTERN_C const GUID | CLSID_SyncMgrHandler
UINT | g_cRefThisDll = 0
HINSTANCE | g_hmodThisDll = NULL
CSettings * | g_pSettings = NULL
TCHAR | szCLSIDDescription [] = TEXT("Sample Synchronization Manager Handler")
WCHAR | wszCLSIDDescription [] = "Sample Synchronization Handler Handler"

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 222 of file DllMain.Cpp.

{
    return (g_cRefThisDll == 0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvOut
 | ) |  |

Definition at line 241 of file DllMain.Cpp.

{
    *ppvOut = NULL;

    if (IsEqualIID(rclsid, CLSID_SyncMgrHandler))
    {
        CClassFactory *pcf = new CClassFactory;

        return pcf->QueryInterface(riid, ppvOut);
    }

    return CLASS_E_CLASSNOTAVAILABLE;
}

int APIENTRY DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID | lpReserved
 | ) |  |

Definition at line 43 of file DllMain.Cpp.

{
    if (dwReason == DLL_PROCESS_ATTACH)
    {
        // Extension DLL one-time initialization
        g_hmodThisDll = hInstance;

        g_pSettings = new CSettings;
        if (NULL == g_pSettings)
        {
            return FALSE;
        }

        //initialize the common controls for property sheets
    INITCOMMONCONTROLSEX controlsEx;
    controlsEx.dwSize = sizeof(INITCOMMONCONTROLSEX);
    controlsEx.dwICC = ICC_USEREX_CLASSES | ICC_WIN95_CLASSES;
    InitCommonControlsEx(&controlsEx);

    }
    else if (dwReason == DLL_PROCESS_DETACH)
    {
    DWORD cRefs;
    CSettings *pSettings = g_pSettings;  // ptr to global settings class.

        g_pSettings = NULL;
        Assert(0 == g_cRefThisDll);

        if (pSettings)
        {
            cRefs = pSettings->Release();
            Assert(0 == cRefs);
        }

    }

    return TRUE;
}

STDAPI DllRegisterServer ( void )

Definition at line 97 of file DllMain.Cpp.

{
HRESULT  hr = NOERROR;
#ifndef _UNICODE
WCHAR   wszID[GUID_SIZE+1];
#endif // !_UNICODE
TCHAR    szID[GUID_SIZE+1];
TCHAR    szCLSID[GUID_SIZE+1];
TCHAR    szModulePath[MAX_PATH];

  // Obtain the path to this module's executable file for later use.
  GetModuleFileName(
    g_hmodThisDll,
    szModulePath,
    sizeof(szModulePath)/sizeof(TCHAR));

  /*-------------------------------------------------------------------------
    Create registry entries for the DllSndBall Component.
  -------------------------------------------------------------------------*/
  // Create some base key strings.
#ifdef _UNICODE
  StringFromGUID2(CLSID_SyncMgrHandler, szID, GUID_SIZE);
#else
  BOOL fUsedDefaultChar;

  StringFromGUID2(CLSID_SyncMgrHandler, wszID, GUID_SIZE);

  WideCharToMultiByte(CP_ACP ,0,
    wszID,-1,szID,GUID_SIZE + 1,
    NULL,&fUsedDefaultChar);

#endif // _UNICODE

  lstrcpy(szCLSID, TEXT("CLSID\\"));
  lstrcat(szCLSID, szID);

  // Create entries under CLSID.

  SetRegKeyValue(HKEY_CLASSES_ROOT,
    szCLSID,
    NULL,
    szCLSIDDescription);

  SetRegKeyValue(HKEY_CLASSES_ROOT,
    szCLSID,
    TEXT("InProcServer32"),
    szModulePath);

  AddRegNamedValue(
    szCLSID,
    TEXT("InProcServer32"),
    TEXT("ThreadingModel"),
    TEXT("Apartment"));

  // register with SyncMgr
    LPSYNCMGRREGISTER lpSyncMgrRegister;

    hr = CoCreateInstance(CLSID_SyncMgr,NULL,CLSCTX_SERVER,IID_ISyncMgrRegister,
                                            (LPVOID *) &lpSyncMgrRegister);

    if (SUCCEEDED(hr))
    {
        hr = lpSyncMgrRegister->RegisterSyncMgrHandler(CLSID_SyncMgrHandler,
            wszCLSIDDescription,0 /* dwSyncMgrRegisterFlags */);

        AssertSz(SUCCEEDED(hr),"Registration Failed");

        lpSyncMgrRegister->Release();
    }

    return hr;
}

STDAPI DllUnregisterServer ( void )

Definition at line 185 of file DllMain.Cpp.

{
HRESULT hr;

  // UnRegister with SyncMgr
    LPSYNCMGRREGISTER lpSyncMgrRegister;

    hr = CoCreateInstance(CLSID_SyncMgr,NULL,CLSCTX_SERVER,IID_ISyncMgrRegister,
                                            (LPVOID *) &lpSyncMgrRegister);

    if (SUCCEEDED(hr))
    {
        hr = lpSyncMgrRegister->UnregisterSyncMgrHandler(CLSID_SyncMgrHandler,0);
        lpSyncMgrRegister->Release();
    }

    return hr;

}

Variable Documentation

EXTERN_C const GUID CLSID_SyncMgrHandler

Definition at line 15 of file DllMain.Cpp.

UINT g_cRefThisDll = 0

Definition at line 24 of file DllMain.Cpp.

HINSTANCE g_hmodThisDll = NULL

Definition at line 25 of file DllMain.Cpp.

CSettings* g_pSettings = NULL

Definition at line 26 of file DllMain.Cpp.

TCHAR szCLSIDDescription[] = TEXT("Sample Synchronization Manager Handler")

Definition at line 17 of file DllMain.Cpp.

WCHAR wszCLSIDDescription[] = "Sample Synchronization Handler Handler"

Definition at line 18 of file DllMain.Cpp.

Generated on Wed Nov 13 2024 16:54:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/SyncMgr/SyncDir/DllMain.h File Reference

  • NetDS
  • SyncMgr
  • SyncDir
Functions

DllMain.h File Reference

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvOut)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 53 of file ComSpyAudit.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvOut
 | ) |  |

Definition at line 61 of file ComSpyAudit.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

STDAPI DllRegisterServer ( void )

Definition at line 69 of file ComSpyAudit.Cpp.

{
  // registers object, typelib and all interfaces in typelib
  return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 78 of file ComSpyAudit.Cpp.

{
  _Module.UnregisterServer();
  return S_OK;
}

Generated on Wed Nov 13 2024 16:54:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/SyncMgr/SyncDir/Enum.Cpp File Reference

  • NetDS
  • SyncMgr
  • SyncDir
Functions | Variables

Enum.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

BOOL | AddItemToList (LPGENERICITEMLIST lpGenericList, LPGENERICITEM pNewGenericItem)
LPGENERICITEM | AddNewItemToList (LPGENERICITEMLIST lpGenericList, ULONG cbSize)
DWORD | AddRef_ItemList (LPGENERICITEMLIST pGenericItemList)
LPGENERICITEMLIST CreateItemList ()
LPGENERICITEM | CreateNewListItem (ULONG cbSize)
BOOL | DeleteItemFromList (LPGENERICITEMLIST lpGenericList, LPGENERICITEM pGenericItem)
LPGENERICITEMLIST | DuplicateItemList (LPGENERICITEMLIST pItemList)
DWORD | Release_ItemList (LPGENERICITEMLIST pGenericItemList)
STDMETHODIMP_ (ULONG) CGenericEnum

Variables

HINSTANCE | g_hmodThisDll

Function Documentation

BOOL AddItemToList | ( | LPGENERICITEMLIST | lpGenericList,
 |  | LPGENERICITEM | pNewGenericItem
 | ) |  |

Definition at line 457 of file Enum.Cpp.

{
LPGENERICITEM pGenericItem;

    if (!pNewGenericItem || !lpGenericList)
    {
        Assert(lpGenericList);
        Assert(pNewGenericItem);
        return FALSE;
    }

    if (pNewGenericItem)
    {
        Assert(pNewGenericItem->cbSize >= sizeof(GENERICITEM));

        pGenericItem = lpGenericList->pFirstGenericItem;

        if (NULL == pGenericItem)
        {
            lpGenericList->pFirstGenericItem = pNewGenericItem;
        }
        else
        {
            while (pGenericItem->pNextGenericItem)
                pGenericItem = pGenericItem->pNextGenericItem;

            pGenericItem->pNextGenericItem = pNewGenericItem;

        }

    ++lpGenericList->dwNumItems;
    }

    return TRUE;
}

LPGENERICITEM AddNewItemToList | ( | LPGENERICITEMLIST | lpGenericList,
 |  | ULONG | cbSize
 | ) |  |

Definition at line 424 of file Enum.Cpp.

{
LPGENERICITEM pNewGenericItem;

    pNewGenericItem = CreateNewListItem(cbSize);

    if (pNewGenericItem)
    {
        if (!AddItemToList(lpGenericList,pNewGenericItem))
        {
            FREE(pNewGenericItem);
            pNewGenericItem = NULL;
        }
    }

    return pNewGenericItem;
}

DWORD AddRef_ItemList ( LPGENERICITEMLIST pGenericItemList )

Definition at line 288 of file Enum.Cpp.

{
    return ++pGenericItemList->_cRefs;
}

LPGENERICITEMLIST CreateItemList ( )

Definition at line 347 of file Enum.Cpp.

{
LPGENERICITEMLIST lpGenericList = (LPGENERICITEMLIST) ALLOC(sizeof(GENERICITEMLIST));

    if (lpGenericList)
    {
    memset(lpGenericList,0,sizeof(GENERICITEMLIST));
    AddRef_ItemList(lpGenericList);
    }

    return lpGenericList;
}

LPGENERICITEM CreateNewListItem ( ULONG cbSize )

Definition at line 570 of file Enum.Cpp.

{
LPGENERICITEM pNewGenericItem;

    // size must be at least size of the base generic item.
    if (cbSize < sizeof(GENERICITEM))
    return NULL;

     pNewGenericItem = (LPGENERICITEM) ALLOC(cbSize);

    // add item to the end of the list so if commit we do
    // it in the same order items were added.

    if (pNewGenericItem)
    {
    // initialize to zero, and then add it to the list.
    memset(pNewGenericItem,0,cbSize);
        pNewGenericItem->cbSize = cbSize;
    }

    return pNewGenericItem;
}

BOOL DeleteItemFromList | ( | LPGENERICITEMLIST | lpGenericList,
 |  | LPGENERICITEM | pGenericItem
 | ) |  |

Definition at line 507 of file Enum.Cpp.

{

    if (!pGenericItem || !lpGenericList)
    {
        Assert(lpGenericList);
        Assert(pGenericItem);
        return FALSE;
    }

    if (pGenericItem)
    {
    LPGENERICITEM pCurItem;
    GENERICITEM  GenericItemTempHead;

        Assert(pGenericItem->cbSize >= sizeof(GENERICITEM));

        GenericItemTempHead.pNextGenericItem = lpGenericList->pFirstGenericItem;
        pCurItem = &GenericItemTempHead;

        while(pCurItem->pNextGenericItem)
        {

            if (pCurItem->pNextGenericItem == pGenericItem)
            {

                pCurItem->pNextGenericItem = pGenericItem->pNextGenericItem;
                FREE(pGenericItem);

                // update the head
                lpGenericList->pFirstGenericItem = GenericItemTempHead.pNextGenericItem;

                // update the number of items in the list
                --lpGenericList->dwNumItems;

                return TRUE;
            }

            pCurItem = pCurItem->pNextGenericItem;
        }

    }

    AssertSz(0,"Didn't find item in List");
    return FALSE; // didn't find anything.
}

LPGENERICITEMLIST DuplicateItemList ( LPGENERICITEMLIST pItemList )

Definition at line 374 of file Enum.Cpp.

{
LPGENERICITEMLIST lpNewItemList;
LPGENERICITEM pCurItem;

    lpNewItemList = CreateItemList();
    if (!lpNewItemList)
    {
        return NULL;
    }

    pCurItem = pItemList->pFirstGenericItem;

    while (pCurItem)
    {
    LPGENERICITEM pNewItemInList;

        Assert(pCurItem->cbSize >= sizeof(GENERICITEM));

        pNewItemInList = CreateNewListItem(pCurItem->cbSize);

        if (pNewItemInList)
        {
            memcpy(pNewItemInList,pCurItem,pCurItem->cbSize);
            pNewItemInList->pNextGenericItem = NULL;
            AddItemToList(lpNewItemList,pNewItemInList);
        }

        pCurItem = pCurItem->pNextGenericItem;
    }

    return lpNewItemList;
}

DWORD Release_ItemList ( LPGENERICITEMLIST pGenericItemList )

Definition at line 307 of file Enum.Cpp.

{
DWORD cRefs;

    // bug, not threadsafe
    cRefs = --pGenericItemList->_cRefs;

    if (0 == pGenericItemList->_cRefs)
    {
    LPGENERICITEM pCurItem = pGenericItemList->pFirstGenericItem;

        while(pCurItem)
        {
        LPGENERICITEM pFreeItem = pCurItem;

            pCurItem = pCurItem->pNextGenericItem;
            FREE(pFreeItem);
        }

    FREE(pGenericItemList);
    }

    return cRefs;
}

STDMETHODIMP_ ( ULONG )

Definition at line 133 of file Enum.Cpp.

{
    if (--m_cRef)
        return m_cRef;

    DeleteThisObject();

    return 0L;
}

Variable Documentation

HINSTANCE g_hmodThisDll

Definition at line 25 of file DllMain.Cpp.

Generated on Wed Nov 13 2024 16:53:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/SyncMgr/SyncDir/Enum.h File Reference

  • NetDS
  • SyncMgr
  • SyncDir
Classes | Typedefs | Functions

Enum.h File Reference

Go to the source code of this file.

Classes

struct | _tagGENERICITEM
struct | _tagGENERICITEMLIST
class | CGenericEnum

Typedefs

typedef struct _tagGENERICITEM | GENERICITEM
typedef struct _tagGENERICITEMLIST | GENERICITEMLIST
typedef GENERICITEM * | LPGENERICITEM
typedef GENERICITEMLIST * | LPGENERICITEMLIST

Functions

BOOL | AddItemToList (LPGENERICITEMLIST lpGenericList, LPGENERICITEM pGenericItem)
LPGENERICITEM | AddNewItemToList (LPGENERICITEMLIST lpGenericList, ULONG cbSize)
DWORD | AddRef_ItemList (LPGENERICITEMLIST pGenericItemList)
LPGENERICITEMLIST CreateItemList ()
LPGENERICITEM | CreateNewListItem (ULONG cbSize)
BOOL | DeleteItemFromList (LPGENERICITEMLIST lpGenericList, LPGENERICITEM pGenericItem)
LPGENERICITEMLIST | DuplicateItemList (LPGENERICITEMLIST pItemList)
DWORD | Release_ItemList (LPGENERICITEMLIST pGenericItemList)

Typedef Documentation

typedef struct _tagGENERICITEM GENERICITEM
typedef struct _tagGENERICITEMLIST GENERICITEMLIST
typedef GENERICITEM* LPGENERICITEM

Definition at line 26 of file Enum.h.

typedef GENERICITEMLIST* LPGENERICITEMLIST

Definition at line 35 of file Enum.h.

Function Documentation

BOOL AddItemToList | ( | LPGENERICITEMLIST | lpGenericList,
 |  | LPGENERICITEM | pGenericItem
 | ) |  |

Definition at line 457 of file Enum.Cpp.

{
LPGENERICITEM pGenericItem;

    if (!pNewGenericItem || !lpGenericList)
    {
        Assert(lpGenericList);
        Assert(pNewGenericItem);
        return FALSE;
    }

    if (pNewGenericItem)
    {
        Assert(pNewGenericItem->cbSize >= sizeof(GENERICITEM));

        pGenericItem = lpGenericList->pFirstGenericItem;

        if (NULL == pGenericItem)
        {
            lpGenericList->pFirstGenericItem = pNewGenericItem;
        }
        else
        {
            while (pGenericItem->pNextGenericItem)
                pGenericItem = pGenericItem->pNextGenericItem;

            pGenericItem->pNextGenericItem = pNewGenericItem;

        }

    ++lpGenericList->dwNumItems;
    }

    return TRUE;
}

LPGENERICITEM AddNewItemToList | ( | LPGENERICITEMLIST | lpGenericList,
 |  | ULONG | cbSize
 | ) |  |

Definition at line 424 of file Enum.Cpp.

{
LPGENERICITEM pNewGenericItem;

    pNewGenericItem = CreateNewListItem(cbSize);

    if (pNewGenericItem)
    {
        if (!AddItemToList(lpGenericList,pNewGenericItem))
        {
            FREE(pNewGenericItem);
            pNewGenericItem = NULL;
        }
    }

    return pNewGenericItem;
}

DWORD AddRef_ItemList ( LPGENERICITEMLIST pGenericItemList )

Definition at line 288 of file Enum.Cpp.

{
    return ++pGenericItemList->_cRefs;
}

LPGENERICITEMLIST CreateItemList ( )

Definition at line 347 of file Enum.Cpp.

{
LPGENERICITEMLIST lpGenericList = (LPGENERICITEMLIST) ALLOC(sizeof(GENERICITEMLIST));

    if (lpGenericList)
    {
    memset(lpGenericList,0,sizeof(GENERICITEMLIST));
    AddRef_ItemList(lpGenericList);
    }

    return lpGenericList;
}

LPGENERICITEM CreateNewListItem ( ULONG cbSize )

Definition at line 570 of file Enum.Cpp.

{
LPGENERICITEM pNewGenericItem;

    // size must be at least size of the base generic item.
    if (cbSize < sizeof(GENERICITEM))
    return NULL;

     pNewGenericItem = (LPGENERICITEM) ALLOC(cbSize);

    // add item to the end of the list so if commit we do
    // it in the same order items were added.

    if (pNewGenericItem)
    {
    // initialize to zero, and then add it to the list.
    memset(pNewGenericItem,0,cbSize);
        pNewGenericItem->cbSize = cbSize;
    }

    return pNewGenericItem;
}

BOOL DeleteItemFromList | ( | LPGENERICITEMLIST | lpGenericList,
 |  | LPGENERICITEM | pGenericItem
 | ) |  |

Definition at line 507 of file Enum.Cpp.

{

    if (!pGenericItem || !lpGenericList)
    {
        Assert(lpGenericList);
        Assert(pGenericItem);
        return FALSE;
    }

    if (pGenericItem)
    {
    LPGENERICITEM pCurItem;
    GENERICITEM  GenericItemTempHead;

        Assert(pGenericItem->cbSize >= sizeof(GENERICITEM));

        GenericItemTempHead.pNextGenericItem = lpGenericList->pFirstGenericItem;
        pCurItem = &GenericItemTempHead;

        while(pCurItem->pNextGenericItem)
        {

            if (pCurItem->pNextGenericItem == pGenericItem)
            {

                pCurItem->pNextGenericItem = pGenericItem->pNextGenericItem;
                FREE(pGenericItem);

                // update the head
                lpGenericList->pFirstGenericItem = GenericItemTempHead.pNextGenericItem;

                // update the number of items in the list
                --lpGenericList->dwNumItems;

                return TRUE;
            }

            pCurItem = pCurItem->pNextGenericItem;
        }

    }

    AssertSz(0,"Didn't find item in List");
    return FALSE; // didn't find anything.
}

LPGENERICITEMLIST DuplicateItemList ( LPGENERICITEMLIST pItemList )

Definition at line 374 of file Enum.Cpp.

{
LPGENERICITEMLIST lpNewItemList;
LPGENERICITEM pCurItem;

    lpNewItemList = CreateItemList();
    if (!lpNewItemList)
    {
        return NULL;
    }

    pCurItem = pItemList->pFirstGenericItem;

    while (pCurItem)
    {
    LPGENERICITEM pNewItemInList;

        Assert(pCurItem->cbSize >= sizeof(GENERICITEM));

        pNewItemInList = CreateNewListItem(pCurItem->cbSize);

        if (pNewItemInList)
        {
            memcpy(pNewItemInList,pCurItem,pCurItem->cbSize);
            pNewItemInList->pNextGenericItem = NULL;
            AddItemToList(lpNewItemList,pNewItemInList);
        }

        pCurItem = pCurItem->pNextGenericItem;
    }

    return lpNewItemList;
}

DWORD Release_ItemList ( LPGENERICITEMLIST pGenericItemList )

Definition at line 307 of file Enum.Cpp.

{
DWORD cRefs;

    // bug, not threadsafe
    cRefs = --pGenericItemList->_cRefs;

    if (0 == pGenericItemList->_cRefs)
    {
    LPGENERICITEM pCurItem = pGenericItemList->pFirstGenericItem;

        while(pCurItem)
        {
        LPGENERICITEM pFreeItem = pCurItem;

            pCurItem = pCurItem->pNextGenericItem;
            FREE(pFreeItem);
        }

    FREE(pGenericItemList);
    }

    return cRefs;
}

Generated on Wed Nov 13 2024 16:54:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/SyncMgr/SyncDir/Guid.c File Reference

  • NetDS
  • SyncMgr
  • SyncDir
Defines

Guid.c File Reference

#include <objbase.h>
#include <initguid.h>
#include <mobsync.h>
#include "guid.h"

Go to the source code of this file.

Defines

#define INITGUID

Define Documentation

#define INITGUID

Definition at line 13 of file Guid.c.

Generated on Wed Nov 13 2024 16:54:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/SyncMgr/SyncDir/Guid.h File Reference

  • NetDS
  • SyncMgr
  • SyncDir
Functions

Guid.h File Reference

Go to the source code of this file.

Functions

DEFINE_GUID (CLSID_SyncMgrHandler, 0x97484ba5, 0x26c7, 0x11d1, 0x9a, 0x39, 0x0, 0x20, 0xaf, 0xda, 0x97, 0xb0)

Function Documentation

DEFINE_GUID | ( | CLSID_SyncMgrHandler | ,
 |  | 0x97484ba5 | ,
 |  | 0x26c7 | ,
 |  | 0x11d1 | ,
 |  | 0x9a | ,
 |  | 0x39 | ,
 |  | 0x0 | ,
 |  | 0x20 | ,
 |  | 0xaf | ,
 |  | 0xda | ,
 |  | 0x97 | ,
 |  | 0xb0 |
 | ) |  |
Generated on Wed Nov 13 2024 16:54:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/SyncMgr/SyncDir/Handler.Cpp File Reference

  • NetDS
  • SyncMgr
  • SyncDir
Functions | Variables

Handler.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

LRESULT CALLBACK | HandlerThreadWndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
BOOL | RegisterHandlerWndClasses (void)
STDMETHODIMP_ (ULONG) CSyncMgrHandler
DWORD WINAPI | WorkerThread (LPVOID lpArg)
LRESULT CALLBACK | WorkerThreadWndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)

Variables

UINT g_cRefThisDll
BOOL | g_fWndRegistered = FALSE
HINSTANCE | g_hmodThisDll
CSettings * g_pSettings

Function Documentation

LRESULT CALLBACK HandlerThreadWndProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 2161 of file Handler.Cpp.

{
CSyncMgrHandler *pThis = (CSyncMgrHandler *) GetWindowLongPtr(hWnd, DWL_THREADWNDPROCCLASS);
METHODARGS *pMethodArgs = (METHODARGS *) lParam;
BOOL fMethodCall = FALSE;

    switch (msg)
    {
    case WM_CREATE :
        {
        CREATESTRUCT *pCreateStruct = (CREATESTRUCT *) lParam;

        SetWindowLongPtr(hWnd, DWL_THREADWNDPROCCLASS,(LONG_PTR) pCreateStruct->lpCreateParams );
        pThis = (CSyncMgrHandler *) pCreateStruct->lpCreateParams ;
        }
        break;
        case WM_DESTROY:
        break;
        case WM_WORKERMSG_PROGRESS:
            Assert(pMethodArgs);
            fMethodCall = TRUE;

            if (pMethodArgs)
            {
                pMethodArgs->hr = E_UNEXPECTED;

                if (pThis->m_pSyncMgrSynchronizeCallback)
                {
                PROGRESSMSG *pMsg = &(pMethodArgs->ProgressMsg);

                    Assert(msg == pMethodArgs->dwWorkerMsg);

                    pMethodArgs->hr =
                        pThis->m_pSyncMgrSynchronizeCallback->Progress(
                                   pMsg->ItemID,
                                   pMsg->lpSyncProgressItem);
                }

                Assert(!pMethodArgs->fAsync);
            }
            break;
        case WM_WORKERMSG_PREPAREFORSYNCCOMPLETED:
            Assert(pMethodArgs);
            fMethodCall = TRUE;

            if (pMethodArgs)
            {
                pMethodArgs->hr = E_UNEXPECTED;

                if (pThis->m_pSyncMgrSynchronizeCallback)
                {
                PREPAREFORSYNCCOMPLETEDMSG *pMsg = &(pMethodArgs->PrepareForSyncCompletedMsg);

                    Assert(msg == pMethodArgs->dwWorkerMsg);

                    pMethodArgs->hr =
                        pThis->m_pSyncMgrSynchronizeCallback->PrepareForSyncCompleted(
                                   pMsg->hr);
                }

                Assert(!pMethodArgs->fAsync);
            }
            break;
        case WM_WORKERMSG_SYNCHRONIZECOMPLETED:
            Assert(pMethodArgs);
            fMethodCall = TRUE;

            if (pMethodArgs)
            {
                pMethodArgs->hr = E_UNEXPECTED;

                if (pThis->m_pSyncMgrSynchronizeCallback)
                {
                SYNCHRONIZECOMPLETEDMSG *pMsg = &(pMethodArgs->SynchronizeCompletedMsg);

                    Assert(msg == pMethodArgs->dwWorkerMsg);

                    pMethodArgs->hr =
                        pThis->m_pSyncMgrSynchronizeCallback->SynchronizeCompleted(
                                   pMsg->hr);
                }

                Assert(!pMethodArgs->fAsync);
            }
            break;
        case WM_WORKERMSG_SHOWPROPERTIESCOMPLETED:
            Assert(pMethodArgs);
            fMethodCall = TRUE;

            if (pMethodArgs)
            {
                pMethodArgs->hr = E_UNEXPECTED;

                if (pThis->m_pSyncMgrSynchronizeCallback)
                {
                SHOWPROPERTIESCOMPLETEDMSG *pMsg = &(pMethodArgs->ShowPropertiesCompletedMsg);

                    Assert(msg == pMethodArgs->dwWorkerMsg);

                    pMethodArgs->hr =
                        pThis->m_pSyncMgrSynchronizeCallback->ShowPropertiesCompleted(
                                  pMsg->hr);
                }

                Assert(!pMethodArgs->fAsync);
            }
            break;
        case WM_WORKERMSG_SHOWERRORCOMPLETED:
            Assert(pMethodArgs);
            fMethodCall = TRUE;

            if (pMethodArgs)
            {
                pMethodArgs->hr = E_UNEXPECTED;

                if (pThis->m_pSyncMgrSynchronizeCallback)
                {
                SHOWERRORCOMPLETEDMSG *pMsg = &(pMethodArgs->ShowErrorCompletedMsg);

                    Assert(msg == pMethodArgs->dwWorkerMsg);

                    pMethodArgs->hr =
                        pThis->m_pSyncMgrSynchronizeCallback->ShowErrorCompleted(
                                   pMsg->hr,
                                   pMsg->cbNumItems,
                                   pMsg->pItemIDs
                                   );
                }

                Assert(!pMethodArgs->fAsync);
            }
            break;
        case WM_WORKERMSG_ENABLEMODELESS:
            Assert(pMethodArgs);
            fMethodCall = TRUE;

            if (pMethodArgs)
            {
                pMethodArgs->hr = E_UNEXPECTED;

                if (pThis->m_pSyncMgrSynchronizeCallback)
                {
                ENABLEMODELESSMSG *pMsg = &(pMethodArgs->EnableModelessMsg);

                    Assert(msg == pMethodArgs->dwWorkerMsg);

                    pMethodArgs->hr =
                        pThis->m_pSyncMgrSynchronizeCallback->EnableModeless(
                            pMsg->fEnable);
                }

                Assert(!pMethodArgs->fAsync);
            }
            break;
        case WM_WORKERMSG_LOGERROR:
            Assert(pMethodArgs);
            fMethodCall = TRUE;

            if (pMethodArgs)
            {
                pMethodArgs->hr = E_UNEXPECTED;

                if (pThis->m_pSyncMgrSynchronizeCallback)
                {
                LOGERRORMSG *pMsg = &(pMethodArgs->LogErrorMsg);

                    Assert(msg == pMethodArgs->dwWorkerMsg);

                    pMethodArgs->hr =
                        pThis->m_pSyncMgrSynchronizeCallback->LogError(
                                   pMsg->dwErrorLevel,
                                   pMsg->lpcErrorText,
                                   pMsg->lpSyncLogError);
                }

                Assert(!pMethodArgs->fAsync);
            }
            break;
        case WM_WORKERMSG_DELETELOGERROR:
            Assert(pMethodArgs);
            fMethodCall = TRUE;

            if (pMethodArgs)
            {
                pMethodArgs->hr = E_UNEXPECTED;

                if (pThis->m_pSyncMgrSynchronizeCallback)
                {
                DELETELOGERRORMSG *pMsg = &(pMethodArgs->DeleteLogErrorMsg);

                    Assert(msg == pMethodArgs->dwWorkerMsg);

                    pMethodArgs->hr =
                        pThis->m_pSyncMgrSynchronizeCallback->DeleteLogError(
                                   pMsg->ErrorID,
                                   pMsg->dwReserved);
                }

                Assert(!pMethodArgs->fAsync);
            }
            break;
        case WM_WORKERMSG_ESTABLISHCONNECTION:
            Assert(pMethodArgs);
            fMethodCall = TRUE;

            if (pMethodArgs)
            {
                pMethodArgs->hr = E_UNEXPECTED;

                if (pThis->m_pSyncMgrSynchronizeCallback)
                {
                ESTABLISHCONNECTIONMSG *pMsg = &(pMethodArgs->EstablishConnectionMsg);

                    Assert(msg == pMethodArgs->dwWorkerMsg);

                    pMethodArgs->hr =
                        pThis->m_pSyncMgrSynchronizeCallback->EstablishConnection(
                                   pMsg->lpwszConnection,
                                   pMsg->dwReserved
                                   );
                }

                Assert(!pMethodArgs->fAsync);
            }
            break;
    default:
        break;
    }

    // if this was a method call and async then free methodArgs,
    // on synchronous calls up to the caller to free.
    if (fMethodCall && pMethodArgs && pMethodArgs->fAsync)
    {
        FREE(pMethodArgs);
    }

    return DefWindowProc(hWnd, msg, wParam, lParam);
}

BOOL RegisterHandlerWndClasses ( void )

Definition at line 2610 of file Handler.Cpp.

{

    if (!g_fWndRegistered)
    {
    ATOM aWndClass;
    WNDCLASS        xClass;

        // register class for window created on handler thread.
    xClass.style         = 0;
    xClass.lpfnWndProc   = HandlerThreadWndProc;
    xClass.cbClsExtra    = 0;

    xClass.cbWndExtra    = sizeof(DWORD); // room for class this ptr
    xClass.hInstance     = g_hmodThisDll;
    xClass.hIcon         = NULL;
    xClass.hCursor       = NULL;
    xClass.hbrBackground = (HBRUSH) (COLOR_BACKGROUND + 1);
    xClass.lpszMenuName  = NULL;
    xClass.lpszClassName = SZ_SAMPLESYNCMGRHANDLERWNDCLASS;

    aWndClass = RegisterClass( &xClass );

        // Register windows class.we need for handling thread communication
    xClass.style         = 0;
    xClass.lpfnWndProc   = WorkerThreadWndProc;
    xClass.cbClsExtra    = 0;

    xClass.cbWndExtra    = sizeof(DWORD); // room for class this ptr
    xClass.hInstance     = g_hmodThisDll;
    xClass.hIcon         = NULL;
    xClass.hCursor       = NULL;
    xClass.hbrBackground = (HBRUSH) (COLOR_BACKGROUND + 1);
    xClass.lpszMenuName  = NULL;
    xClass.lpszClassName = SZ_SAMPLESYNCMGRWORKERWNDCLASS;

    aWndClass = RegisterClass( &xClass );

        g_fWndRegistered = TRUE;
    }

    return g_fWndRegistered;

}

STDMETHODIMP_ ( ULONG )

Definition at line 2695 of file Handler.Cpp.

{
DWORD cRefs;

    --m_cRef;

    cRefs = m_cRef;

    if (0 == m_cRef)
    {
        delete this;
    }

    return cRefs;
}

DWORD WINAPI WorkerThread ( LPVOID lpArg )

Definition at line 2541 of file Handler.Cpp.

{
MSG msg;
HRESULT hr;
HRESULT hrCoInitialize;
WorkerThreadArgs *pThreadArgs = (WorkerThreadArgs *) lpArg;
HWND hwndWorker;

   pThreadArgs->hr = NOERROR;

   hrCoInitialize = CoInitialize(NULL);

   // need to do a PeekMessage and then set an event to make sure
   // a message loop is created before the first PostMessage is sent.

   PeekMessage(&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE);

   // initialize the dialog box before returning to main thread.
   if (FAILED(hrCoInitialize) )
   {
    pThreadArgs->hr = E_OUTOFMEMORY;
   }
   else
   {

    hwndWorker = CreateWindowEx(0,
              SZ_SAMPLESYNCMGRWORKERWNDCLASS,
              TEXT(""),
              // must use WS_POPUP so the window does not get
              // assigned a hot key by user.
              (WS_DISABLED | WS_POPUP),
              CW_USEDEFAULT,
              CW_USEDEFAULT,
              CW_USEDEFAULT,
              CW_USEDEFAULT,
              NULL,
              NULL,
              g_hmodThisDll,
              pThreadArgs->pThis);

        pThreadArgs->hwnd = hwndWorker;
    pThreadArgs->hr =  hwndWorker ? NOERROR : E_UNEXPECTED;
    }

   hr = pThreadArgs->hr;

   // let the caller know the thread is done initializing.
   if (pThreadArgs->hEvent)
     SetEvent(pThreadArgs->hEvent);

   if (NOERROR == hr)
   {
       // sit in loop receiving messages.
       while (GetMessage(&msg, NULL, 0, 0))
       {
         TranslateMessage(&msg);
         DispatchMessage(&msg);
    }
   }

   if (SUCCEEDED(hrCoInitialize))
       CoUninitialize();

   return 0;
}

LRESULT CALLBACK WorkerThreadWndProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 2418 of file Handler.Cpp.

{
CSyncMgrHandler *pThis = (CSyncMgrHandler *) GetWindowLongPtr(hWnd, DWL_THREADWNDPROCCLASS);
METHODARGS *pMethodArgs = (METHODARGS *) lParam;
BOOL fMethodCall = FALSE;

    switch (msg)
    {
    case WM_CREATE :
        {
        CREATESTRUCT *pCreateStruct = (CREATESTRUCT *) lParam;

        SetWindowLongPtr(hWnd, DWL_THREADWNDPROCCLASS,(LONG_PTR) pCreateStruct->lpCreateParams );
        pThis = (CSyncMgrHandler *) pCreateStruct->lpCreateParams ;
        }
        break;
    case WM_DESTROY:
        PostQuitMessage(0); // shut down this thread.
        break;
    case WM_WORKERMSG_SHOWPROPERTIES:
            Assert(pMethodArgs);
            fMethodCall = TRUE;
            if (pMethodArgs)
            {
            SHOWPROPERTIESMSG *pShowPropertiesMsg = &(pMethodArgs->ShowPropertiesMsg);

                Assert(WM_WORKERMSG_SHOWPROPERTIES == pMethodArgs->dwWorkerMsg);

                pThis->ShowPropertiesCall(pShowPropertiesMsg->hWndParent,
                                                pShowPropertiesMsg->ItemID);

                Assert(pMethodArgs->fAsync);
            }

        break;
    case WM_WORKERMSG_PREPFORSYNC:

            Assert(pMethodArgs);
            fMethodCall = TRUE;

            if (pMethodArgs)
            {
            PREPAREFORSYNCMSG *pPrepareForSyncMsg = &(pMethodArgs->PrepareForSyncMsg);

                Assert(WM_WORKERMSG_PREPFORSYNC == pMethodArgs->dwWorkerMsg);

            pThis->PrepareForSyncCall(pPrepareForSyncMsg->cbNumItems,
                           pPrepareForSyncMsg->pItemIDs,
               pPrepareForSyncMsg->hWndParent,
                           pPrepareForSyncMsg->dwReserved);

                if (pPrepareForSyncMsg->pItemIDs)
                {
                    FREE(pPrepareForSyncMsg->pItemIDs);
                }

                Assert(pMethodArgs->fAsync);
            }
        break;
    case WM_WORKERMSG_SYNCHRONIZE:
            Assert(pMethodArgs);
            fMethodCall = TRUE;
            if (pMethodArgs)
            {
            SYNCHRONIZEMSG *pSynchronizeMsg = &(pMethodArgs->SynchronizeMsg);

                Assert(WM_WORKERMSG_SYNCHRONIZE == pMethodArgs->dwWorkerMsg);
                Assert(pMethodArgs->fAsync);
                pThis->SynchronizeCall(pSynchronizeMsg->hWndParent);

            }

        break;
    case WM_WORKERMSG_SHOWERROR:
            Assert(pMethodArgs);

            fMethodCall = TRUE;
            if (pMethodArgs)
            {
            SHOWERRORMSG *pShowErrorMsg = &(pMethodArgs->ShowErrorMsg);

                Assert(pMethodArgs->fAsync);
                Assert(WM_WORKERMSG_SHOWERROR == pMethodArgs->dwWorkerMsg);

                pThis->ShowErrorCall(pShowErrorMsg->hWndParent,
                                                pShowErrorMsg->ErrorID);

            }

        break;
        case WM_WORKERMSG_RELEASE:
            DestroyWindow(hWnd);
            break;
    default:
        break;
    }

    // if this was a method call and async then free methodArgs,
    // on synchronous calls up to the caller to free.
    if (fMethodCall && pMethodArgs && pMethodArgs->fAsync)
    {
        FREE(pMethodArgs);
    }

    return DefWindowProc(hWnd, msg, wParam, lParam);
}

Variable Documentation

UINT g_cRefThisDll

Definition at line 24 of file DllMain.Cpp.

BOOL g_fWndRegistered = FALSE

Definition at line 2608 of file Handler.Cpp.

HINSTANCE g_hmodThisDll

Definition at line 25 of file DllMain.Cpp.

CSettings* g_pSettings

Definition at line 26 of file DllMain.Cpp.

Generated on Wed Nov 13 2024 16:53:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/SyncMgr/SyncDir/Handler.h File Reference

  • NetDS
  • SyncMgr
  • SyncDir
Classes | Defines | Typedefs | Functions

Handler.h File Reference

Go to the source code of this file.

Classes

struct | _tagDELETELOGERRORMSG
struct | _tagENABLEMODELESSMSG
struct | _tagESTABLISHCONNECTIONMSG
struct | _tagFILEOBJECT
struct | _tagHANDLERITEM_SYNCSTATUS
struct | _tagLOGERRORMSG
struct | _tagMETHODARGS
struct | _tagPREPAREFORSYNCCOMPLETEDMSG
struct | _tagPREPAREFORSYNCMSG
struct | _tagPROGRESSMSG
struct | _tagSHOWERRORCOMPLETEDMSG
struct | _tagSHOWERRORMSG
struct | _tagSHOWPROPERTIESCOMPLETEDMSG
struct | _tagSHOWPROPERTIESMSG
struct | _tagSYNCHRONIZECOMPLETEDMSG
struct | _tagSYNCHRONIZEMSG
struct | _tagWorkerThreadArgs
class | CCallbackWrapper
class | CSyncMgrHandler

Defines

#define | DWL_THREADWNDPROCCLASS 0
#define | SZ_SAMPLESYNCMGRHANDLERWNDCLASS TEXT("Sample SyncMgr HandlerThread hwnd")
#define | SZ_SAMPLESYNCMGRWORKERWNDCLASS TEXT("Sample SyncMgr WorkThread hwnd")
#define | WM_WORKERMSG_DELETELOGERROR (WM_USER+27)
#define | WM_WORKERMSG_ENABLEMODELESS (WM_USER+25)
#define | WM_WORKERMSG_ESTABLISHCONNECTION (WM_USER+28)
#define | WM_WORKERMSG_LOGERROR (WM_USER+26)
#define | WM_WORKERMSG_PREPAREFORSYNCCOMPLETED (WM_USER+21)
#define | WM_WORKERMSG_PREPFORSYNC (WM_USER+2)
#define | WM_WORKERMSG_PROGRESS (WM_USER+20)
#define | WM_WORKERMSG_RELEASE (WM_USER+5)
#define | WM_WORKERMSG_SHOWERROR (WM_USER+4)
#define | WM_WORKERMSG_SHOWERRORCOMPLETED (WM_USER+24)
#define | WM_WORKERMSG_SHOWPROPERTIES (WM_USER+1)
#define | WM_WORKERMSG_SHOWPROPERTIESCOMPLETED (WM_USER+23)
#define | WM_WORKERMSG_SYNCHRONIZE (WM_USER+3)
#define | WM_WORKERMSG_SYNCHRONIZECOMPLETED (WM_USER+22)

Typedefs

typedef struct
_tagDELETELOGERRORMSG 		DELETELOGERRORMSG
typedef struct
_tagENABLEMODELESSMSG 		ENABLEMODELESSMSG
typedef struct
_tagESTABLISHCONNECTIONMSG 		ESTABLISHCONNECTIONMSG
typedef struct _tagFILEOBJECT | FILEOBJECT
typedef GENERICITEMLIST | FILEOBJECTLIST
typedef struct
_tagHANDLERITEM_SYNCSTATUS 		HANDLERITEM_SYNCSTATUS
typedef struct _tagLOGERRORMSG | LOGERRORMSG
typedef FILEOBJECT * | LPFILEOBJECT
typedef LPGENERICITEMLIST | LPFILEOBJECTLIST
typedef HANDLERITEM_SYNCSTATUS * | LPHANDLERITEM_SYNCSTATUS
typedef struct _tagMETHODARGS | METHODARGS
typedef struct
_tagPREPAREFORSYNCCOMPLETEDMSG 		PREPAREFORSYNCCOMPLETEDMSG
typedef struct
_tagPREPAREFORSYNCMSG 		PREPAREFORSYNCMSG
typedef struct _tagPROGRESSMSG | PROGRESSMSG
typedef struct
_tagSHOWERRORCOMPLETEDMSG 		SHOWERRORCOMPLETEDMSG
typedef struct _tagSHOWERRORMSG | SHOWERRORMSG
typedef struct
_tagSHOWPROPERTIESCOMPLETEDMSG 		SHOWPROPERTIESCOMPLETEDMSG
typedef struct
_tagSHOWPROPERTIESMSG 		SHOWPROPERTIESMSG
typedef struct
_tagSYNCHRONIZECOMPLETEDMSG 		SYNCHRONIZECOMPLETEDMSG
typedef struct _tagSYNCHRONIZEMSG | SYNCHRONIZEMSG
typedef struct _tagWorkerThreadArgs | WorkerThreadArgs

Functions

LRESULT CALLBACK | HandlerThreadWndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
BOOL | RegisterHandlerWndClasses (void)
DWORD WINAPI | WorkerThread (LPVOID lpArg)
LRESULT CALLBACK | WorkerThreadWndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)

Define Documentation

#define DWL_THREADWNDPROCCLASS 0

Definition at line 306 of file Handler.h.

#define SZ_SAMPLESYNCMGRHANDLERWNDCLASS TEXT("Sample SyncMgr HandlerThread hwnd")

Definition at line 308 of file Handler.h.

#define SZ_SAMPLESYNCMGRWORKERWNDCLASS TEXT("Sample SyncMgr WorkThread hwnd")

Definition at line 309 of file Handler.h.

#define WM_WORKERMSG_DELETELOGERROR (WM_USER+27)

Definition at line 303 of file Handler.h.

#define WM_WORKERMSG_ENABLEMODELESS (WM_USER+25)

Definition at line 301 of file Handler.h.

#define WM_WORKERMSG_ESTABLISHCONNECTION (WM_USER+28)

Definition at line 304 of file Handler.h.

#define WM_WORKERMSG_LOGERROR (WM_USER+26)

Definition at line 302 of file Handler.h.

#define WM_WORKERMSG_PREPAREFORSYNCCOMPLETED (WM_USER+21)

Definition at line 297 of file Handler.h.

#define WM_WORKERMSG_PREPFORSYNC (WM_USER+2)

Definition at line 290 of file Handler.h.

#define WM_WORKERMSG_PROGRESS (WM_USER+20)

Definition at line 296 of file Handler.h.

#define WM_WORKERMSG_RELEASE (WM_USER+5)

Definition at line 293 of file Handler.h.

#define WM_WORKERMSG_SHOWERROR (WM_USER+4)

Definition at line 292 of file Handler.h.

#define WM_WORKERMSG_SHOWERRORCOMPLETED (WM_USER+24)

Definition at line 300 of file Handler.h.

#define WM_WORKERMSG_SHOWPROPERTIES (WM_USER+1)

Definition at line 289 of file Handler.h.

#define WM_WORKERMSG_SHOWPROPERTIESCOMPLETED (WM_USER+23)

Definition at line 299 of file Handler.h.

#define WM_WORKERMSG_SYNCHRONIZE (WM_USER+3)

Definition at line 291 of file Handler.h.

#define WM_WORKERMSG_SYNCHRONIZECOMPLETED (WM_USER+22)

Definition at line 298 of file Handler.h.

Typedef Documentation

typedef struct _tagDELETELOGERRORMSG DELETELOGERRORMSG
typedef struct _tagENABLEMODELESSMSG ENABLEMODELESSMSG
typedef struct _tagESTABLISHCONNECTIONMSG ESTABLISHCONNECTIONMSG
typedef struct _tagFILEOBJECT FILEOBJECT
typedef GENERICITEMLIST FILEOBJECTLIST

Definition at line 41 of file Handler.h.

typedef struct _tagHANDLERITEM_SYNCSTATUS HANDLERITEM_SYNCSTATUS
typedef struct _tagLOGERRORMSG LOGERRORMSG
typedef FILEOBJECT* LPFILEOBJECT

Definition at line 39 of file Handler.h.

typedef LPGENERICITEMLIST LPFILEOBJECTLIST

Definition at line 42 of file Handler.h.

typedef HANDLERITEM_SYNCSTATUS* LPHANDLERITEM_SYNCSTATUS

Definition at line 26 of file Handler.h.

typedef struct _tagMETHODARGS METHODARGS
typedef struct _tagPREPAREFORSYNCCOMPLETEDMSG PREPAREFORSYNCCOMPLETEDMSG
typedef struct _tagPREPAREFORSYNCMSG PREPAREFORSYNCMSG
typedef struct _tagPROGRESSMSG PROGRESSMSG
typedef struct _tagSHOWERRORCOMPLETEDMSG SHOWERRORCOMPLETEDMSG
typedef struct _tagSHOWERRORMSG SHOWERRORMSG
typedef struct _tagSHOWPROPERTIESCOMPLETEDMSG SHOWPROPERTIESCOMPLETEDMSG
typedef struct _tagSHOWPROPERTIESMSG SHOWPROPERTIESMSG
typedef struct _tagSYNCHRONIZECOMPLETEDMSG SYNCHRONIZECOMPLETEDMSG
typedef struct _tagSYNCHRONIZEMSG SYNCHRONIZEMSG
typedef struct _tagWorkerThreadArgs WorkerThreadArgs

Function Documentation

LRESULT CALLBACK HandlerThreadWndProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 2161 of file Handler.Cpp.

{
CSyncMgrHandler *pThis = (CSyncMgrHandler *) GetWindowLongPtr(hWnd, DWL_THREADWNDPROCCLASS);
METHODARGS *pMethodArgs = (METHODARGS *) lParam;
BOOL fMethodCall = FALSE;

    switch (msg)
    {
    case WM_CREATE :
        {
        CREATESTRUCT *pCreateStruct = (CREATESTRUCT *) lParam;

        SetWindowLongPtr(hWnd, DWL_THREADWNDPROCCLASS,(LONG_PTR) pCreateStruct->lpCreateParams );
        pThis = (CSyncMgrHandler *) pCreateStruct->lpCreateParams ;
        }
        break;
        case WM_DESTROY:
        break;
        case WM_WORKERMSG_PROGRESS:
            Assert(pMethodArgs);
            fMethodCall = TRUE;

            if (pMethodArgs)
            {
                pMethodArgs->hr = E_UNEXPECTED;

                if (pThis->m_pSyncMgrSynchronizeCallback)
                {
                PROGRESSMSG *pMsg = &(pMethodArgs->ProgressMsg);

                    Assert(msg == pMethodArgs->dwWorkerMsg);

                    pMethodArgs->hr =
                        pThis->m_pSyncMgrSynchronizeCallback->Progress(
                                   pMsg->ItemID,
                                   pMsg->lpSyncProgressItem);
                }

                Assert(!pMethodArgs->fAsync);
            }
            break;
        case WM_WORKERMSG_PREPAREFORSYNCCOMPLETED:
            Assert(pMethodArgs);
            fMethodCall = TRUE;

            if (pMethodArgs)
            {
                pMethodArgs->hr = E_UNEXPECTED;

                if (pThis->m_pSyncMgrSynchronizeCallback)
                {
                PREPAREFORSYNCCOMPLETEDMSG *pMsg = &(pMethodArgs->PrepareForSyncCompletedMsg);

                    Assert(msg == pMethodArgs->dwWorkerMsg);

                    pMethodArgs->hr =
                        pThis->m_pSyncMgrSynchronizeCallback->PrepareForSyncCompleted(
                                   pMsg->hr);
                }

                Assert(!pMethodArgs->fAsync);
            }
            break;
        case WM_WORKERMSG_SYNCHRONIZECOMPLETED:
            Assert(pMethodArgs);
            fMethodCall = TRUE;

            if (pMethodArgs)
            {
                pMethodArgs->hr = E_UNEXPECTED;

                if (pThis->m_pSyncMgrSynchronizeCallback)
                {
                SYNCHRONIZECOMPLETEDMSG *pMsg = &(pMethodArgs->SynchronizeCompletedMsg);

                    Assert(msg == pMethodArgs->dwWorkerMsg);

                    pMethodArgs->hr =
                        pThis->m_pSyncMgrSynchronizeCallback->SynchronizeCompleted(
                                   pMsg->hr);
                }

                Assert(!pMethodArgs->fAsync);
            }
            break;
        case WM_WORKERMSG_SHOWPROPERTIESCOMPLETED:
            Assert(pMethodArgs);
            fMethodCall = TRUE;

            if (pMethodArgs)
            {
                pMethodArgs->hr = E_UNEXPECTED;

                if (pThis->m_pSyncMgrSynchronizeCallback)
                {
                SHOWPROPERTIESCOMPLETEDMSG *pMsg = &(pMethodArgs->ShowPropertiesCompletedMsg);

                    Assert(msg == pMethodArgs->dwWorkerMsg);

                    pMethodArgs->hr =
                        pThis->m_pSyncMgrSynchronizeCallback->ShowPropertiesCompleted(
                                  pMsg->hr);
                }

                Assert(!pMethodArgs->fAsync);
            }
            break;
        case WM_WORKERMSG_SHOWERRORCOMPLETED:
            Assert(pMethodArgs);
            fMethodCall = TRUE;

            if (pMethodArgs)
            {
                pMethodArgs->hr = E_UNEXPECTED;

                if (pThis->m_pSyncMgrSynchronizeCallback)
                {
                SHOWERRORCOMPLETEDMSG *pMsg = &(pMethodArgs->ShowErrorCompletedMsg);

                    Assert(msg == pMethodArgs->dwWorkerMsg);

                    pMethodArgs->hr =
                        pThis->m_pSyncMgrSynchronizeCallback->ShowErrorCompleted(
                                   pMsg->hr,
                                   pMsg->cbNumItems,
                                   pMsg->pItemIDs
                                   );
                }

                Assert(!pMethodArgs->fAsync);
            }
            break;
        case WM_WORKERMSG_ENABLEMODELESS:
            Assert(pMethodArgs);
            fMethodCall = TRUE;

            if (pMethodArgs)
            {
                pMethodArgs->hr = E_UNEXPECTED;

                if (pThis->m_pSyncMgrSynchronizeCallback)
                {
                ENABLEMODELESSMSG *pMsg = &(pMethodArgs->EnableModelessMsg);

                    Assert(msg == pMethodArgs->dwWorkerMsg);

                    pMethodArgs->hr =
                        pThis->m_pSyncMgrSynchronizeCallback->EnableModeless(
                            pMsg->fEnable);
                }

                Assert(!pMethodArgs->fAsync);
            }
            break;
        case WM_WORKERMSG_LOGERROR:
            Assert(pMethodArgs);
            fMethodCall = TRUE;

            if (pMethodArgs)
            {
                pMethodArgs->hr = E_UNEXPECTED;

                if (pThis->m_pSyncMgrSynchronizeCallback)
                {
                LOGERRORMSG *pMsg = &(pMethodArgs->LogErrorMsg);

                    Assert(msg == pMethodArgs->dwWorkerMsg);

                    pMethodArgs->hr =
                        pThis->m_pSyncMgrSynchronizeCallback->LogError(
                                   pMsg->dwErrorLevel,
                                   pMsg->lpcErrorText,
                                   pMsg->lpSyncLogError);
                }

                Assert(!pMethodArgs->fAsync);
            }
            break;
        case WM_WORKERMSG_DELETELOGERROR:
            Assert(pMethodArgs);
            fMethodCall = TRUE;

            if (pMethodArgs)
            {
                pMethodArgs->hr = E_UNEXPECTED;

                if (pThis->m_pSyncMgrSynchronizeCallback)
                {
                DELETELOGERRORMSG *pMsg = &(pMethodArgs->DeleteLogErrorMsg);

                    Assert(msg == pMethodArgs->dwWorkerMsg);

                    pMethodArgs->hr =
                        pThis->m_pSyncMgrSynchronizeCallback->DeleteLogError(
                                   pMsg->ErrorID,
                                   pMsg->dwReserved);
                }

                Assert(!pMethodArgs->fAsync);
            }
            break;
        case WM_WORKERMSG_ESTABLISHCONNECTION:
            Assert(pMethodArgs);
            fMethodCall = TRUE;

            if (pMethodArgs)
            {
                pMethodArgs->hr = E_UNEXPECTED;

                if (pThis->m_pSyncMgrSynchronizeCallback)
                {
                ESTABLISHCONNECTIONMSG *pMsg = &(pMethodArgs->EstablishConnectionMsg);

                    Assert(msg == pMethodArgs->dwWorkerMsg);

                    pMethodArgs->hr =
                        pThis->m_pSyncMgrSynchronizeCallback->EstablishConnection(
                                   pMsg->lpwszConnection,
                                   pMsg->dwReserved
                                   );
                }

                Assert(!pMethodArgs->fAsync);
            }
            break;
    default:
        break;
    }

    // if this was a method call and async then free methodArgs,
    // on synchronous calls up to the caller to free.
    if (fMethodCall && pMethodArgs && pMethodArgs->fAsync)
    {
        FREE(pMethodArgs);
    }

    return DefWindowProc(hWnd, msg, wParam, lParam);
}

BOOL RegisterHandlerWndClasses ( void )

Definition at line 2610 of file Handler.Cpp.

{

    if (!g_fWndRegistered)
    {
    ATOM aWndClass;
    WNDCLASS        xClass;

        // register class for window created on handler thread.
    xClass.style         = 0;
    xClass.lpfnWndProc   = HandlerThreadWndProc;
    xClass.cbClsExtra    = 0;

    xClass.cbWndExtra    = sizeof(DWORD); // room for class this ptr
    xClass.hInstance     = g_hmodThisDll;
    xClass.hIcon         = NULL;
    xClass.hCursor       = NULL;
    xClass.hbrBackground = (HBRUSH) (COLOR_BACKGROUND + 1);
    xClass.lpszMenuName  = NULL;
    xClass.lpszClassName = SZ_SAMPLESYNCMGRHANDLERWNDCLASS;

    aWndClass = RegisterClass( &xClass );

        // Register windows class.we need for handling thread communication
    xClass.style         = 0;
    xClass.lpfnWndProc   = WorkerThreadWndProc;
    xClass.cbClsExtra    = 0;

    xClass.cbWndExtra    = sizeof(DWORD); // room for class this ptr
    xClass.hInstance     = g_hmodThisDll;
    xClass.hIcon         = NULL;
    xClass.hCursor       = NULL;
    xClass.hbrBackground = (HBRUSH) (COLOR_BACKGROUND + 1);
    xClass.lpszMenuName  = NULL;
    xClass.lpszClassName = SZ_SAMPLESYNCMGRWORKERWNDCLASS;

    aWndClass = RegisterClass( &xClass );

        g_fWndRegistered = TRUE;
    }

    return g_fWndRegistered;

}

DWORD WINAPI WorkerThread ( LPVOID lpArg )

Definition at line 2541 of file Handler.Cpp.

{
MSG msg;
HRESULT hr;
HRESULT hrCoInitialize;
WorkerThreadArgs *pThreadArgs = (WorkerThreadArgs *) lpArg;
HWND hwndWorker;

   pThreadArgs->hr = NOERROR;

   hrCoInitialize = CoInitialize(NULL);

   // need to do a PeekMessage and then set an event to make sure
   // a message loop is created before the first PostMessage is sent.

   PeekMessage(&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE);

   // initialize the dialog box before returning to main thread.
   if (FAILED(hrCoInitialize) )
   {
    pThreadArgs->hr = E_OUTOFMEMORY;
   }
   else
   {

    hwndWorker = CreateWindowEx(0,
              SZ_SAMPLESYNCMGRWORKERWNDCLASS,
              TEXT(""),
              // must use WS_POPUP so the window does not get
              // assigned a hot key by user.
              (WS_DISABLED | WS_POPUP),
              CW_USEDEFAULT,
              CW_USEDEFAULT,
              CW_USEDEFAULT,
              CW_USEDEFAULT,
              NULL,
              NULL,
              g_hmodThisDll,
              pThreadArgs->pThis);

        pThreadArgs->hwnd = hwndWorker;
    pThreadArgs->hr =  hwndWorker ? NOERROR : E_UNEXPECTED;
    }

   hr = pThreadArgs->hr;

   // let the caller know the thread is done initializing.
   if (pThreadArgs->hEvent)
     SetEvent(pThreadArgs->hEvent);

   if (NOERROR == hr)
   {
       // sit in loop receiving messages.
       while (GetMessage(&msg, NULL, 0, 0))
       {
         TranslateMessage(&msg);
         DispatchMessage(&msg);
    }
   }

   if (SUCCEEDED(hrCoInitialize))
       CoUninitialize();

   return 0;
}

LRESULT CALLBACK WorkerThreadWndProc | ( | HWND | hWnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 2418 of file Handler.Cpp.

{
CSyncMgrHandler *pThis = (CSyncMgrHandler *) GetWindowLongPtr(hWnd, DWL_THREADWNDPROCCLASS);
METHODARGS *pMethodArgs = (METHODARGS *) lParam;
BOOL fMethodCall = FALSE;

    switch (msg)
    {
    case WM_CREATE :
        {
        CREATESTRUCT *pCreateStruct = (CREATESTRUCT *) lParam;

        SetWindowLongPtr(hWnd, DWL_THREADWNDPROCCLASS,(LONG_PTR) pCreateStruct->lpCreateParams );
        pThis = (CSyncMgrHandler *) pCreateStruct->lpCreateParams ;
        }
        break;
    case WM_DESTROY:
        PostQuitMessage(0); // shut down this thread.
        break;
    case WM_WORKERMSG_SHOWPROPERTIES:
            Assert(pMethodArgs);
            fMethodCall = TRUE;
            if (pMethodArgs)
            {
            SHOWPROPERTIESMSG *pShowPropertiesMsg = &(pMethodArgs->ShowPropertiesMsg);

                Assert(WM_WORKERMSG_SHOWPROPERTIES == pMethodArgs->dwWorkerMsg);

                pThis->ShowPropertiesCall(pShowPropertiesMsg->hWndParent,
                                                pShowPropertiesMsg->ItemID);

                Assert(pMethodArgs->fAsync);
            }

        break;
    case WM_WORKERMSG_PREPFORSYNC:

            Assert(pMethodArgs);
            fMethodCall = TRUE;

            if (pMethodArgs)
            {
            PREPAREFORSYNCMSG *pPrepareForSyncMsg = &(pMethodArgs->PrepareForSyncMsg);

                Assert(WM_WORKERMSG_PREPFORSYNC == pMethodArgs->dwWorkerMsg);

            pThis->PrepareForSyncCall(pPrepareForSyncMsg->cbNumItems,
                           pPrepareForSyncMsg->pItemIDs,
               pPrepareForSyncMsg->hWndParent,
                           pPrepareForSyncMsg->dwReserved);

                if (pPrepareForSyncMsg->pItemIDs)
                {
                    FREE(pPrepareForSyncMsg->pItemIDs);
                }

                Assert(pMethodArgs->fAsync);
            }
        break;
    case WM_WORKERMSG_SYNCHRONIZE:
            Assert(pMethodArgs);
            fMethodCall = TRUE;
            if (pMethodArgs)
            {
            SYNCHRONIZEMSG *pSynchronizeMsg = &(pMethodArgs->SynchronizeMsg);

                Assert(WM_WORKERMSG_SYNCHRONIZE == pMethodArgs->dwWorkerMsg);
                Assert(pMethodArgs->fAsync);
                pThis->SynchronizeCall(pSynchronizeMsg->hWndParent);

            }

        break;
    case WM_WORKERMSG_SHOWERROR:
            Assert(pMethodArgs);

            fMethodCall = TRUE;
            if (pMethodArgs)
            {
            SHOWERRORMSG *pShowErrorMsg = &(pMethodArgs->ShowErrorMsg);

                Assert(pMethodArgs->fAsync);
                Assert(WM_WORKERMSG_SHOWERROR == pMethodArgs->dwWorkerMsg);

                pThis->ShowErrorCall(pShowErrorMsg->hWndParent,
                                                pShowErrorMsg->ErrorID);

            }

        break;
        case WM_WORKERMSG_RELEASE:
            DestroyWindow(hWnd);
            break;
    default:
        break;
    }

    // if this was a method call and async then free methodArgs,
    // on synchronous calls up to the caller to free.
    if (fMethodCall && pMethodArgs && pMethodArgs->fAsync)
    {
        FREE(pMethodArgs);
    }

    return DefWindowProc(hWnd, msg, wParam, lParam);
}

Generated on Wed Nov 13 2024 16:53:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/SyncMgr/SyncDir/Helper.Cpp File Reference

  • NetDS
  • SyncMgr
  • SyncDir
Functions

Helper.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

int | CalcListViewWidth (HWND hwndList, int iDefault)
TCHAR * | FormatDateTime (FILETIME *pft, TCHAR *pszDatetimeBuf, DWORD cbBufSize)
BOOL | IsValidDir (TCHAR *pDirName)
LPWSTR | lstrcpyX (LPWSTR lpString1, LPCWSTR lpString2)

Function Documentation

int CalcListViewWidth | ( | HWND | hwndList,
 |  | int | iDefault
 | ) |  |

Definition at line 31 of file Helper.Cpp.

{
NONCLIENTMETRICSA metrics;
RECT rcClientRect;

    metrics.cbSize = sizeof(metrics);

    // explicitly ask for ANSI version of SystemParametersInfo since we just
    // care about the ScrollWidth and don't want to conver the LOGFONT info.
    if (GetClientRect(hwndList,&rcClientRect)
        && SystemParametersInfoA(SPI_GETNONCLIENTMETRICS,sizeof(metrics),(PVOID) &metrics,0))
    {
        // subtract off scroll bar distance
        rcClientRect.right -= (metrics.iScrollWidth);
    }
    else
    {
        rcClientRect.right = iDefault;  // if fail, use default
    }

    return rcClientRect.right;
}

TCHAR* FormatDateTime | ( | FILETIME * | pft,
 |  | TCHAR * | pszDatetimeBuf,
 |  | DWORD | cbBufSize
 | ) |  |

Definition at line 103 of file Helper.Cpp.

{
TCHAR * pDateTime = pszDatetimeBuf;
int cchWritten;
SYSTEMTIME sysTime;
FILETIME ftLocal;

  FileTimeToLocalFileTime(pft,&ftLocal);
  FileTimeToSystemTime(&ftLocal,&sysTime);

    // insert date in form of date<space>hour
    *pDateTime = NULL;

    // want to insert the date
    if (cchWritten = GetDateFormat(NULL,DATE_SHORTDATE,&sysTime,NULL,pDateTime,cbBufSize))
    {
        pDateTime += (cchWritten -1); // move number of characters written. (cchWritten includes the NULL)
        *pDateTime = TEXT(' '); // pDateTime is now ponting at the NULL character.
        ++pDateTime;

        // no try to get the hours if fails we make sure that the last char is NULL;
        if (!GetTimeFormat(NULL,TIME_NOSECONDS,&sysTime,NULL,pDateTime,cbBufSize - cchWritten))
        {
            *pDateTime = NULL;
        }
    }

    return pszDatetimeBuf;
}

BOOL IsValidDir ( TCHAR * pDirName )

Definition at line 71 of file Helper.Cpp.

{
BOOL fReturn = FALSE;
HANDLE hFind;
WIN32_FIND_DATA finddata;

    hFind = FindFirstFile(pDirName, &finddata);

    if (hFind != (HANDLE) -1)
    {

       fReturn = (finddata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? TRUE : FALSE;
       FindClose(hFind);
    }

    return fReturn;
}

LPWSTR lstrcpyX | ( | LPWSTR | lpString1,
 |  | LPCWSTR | lpString2
 | ) |  |

Definition at line 150 of file Helper.Cpp.

{
    LPWSTR lpDest = lpString1;

    Assert(lpString1);
    Assert(lpString2);

    while( *lpDest++ = *lpString2++ )
        ;
    return lpString1;
}

Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/SyncMgr/SyncDir/Helper.h File Reference

  • NetDS
  • SyncMgr
  • SyncDir
Defines | Functions

Helper.h File Reference

Go to the source code of this file.

Defines

#define | lstrcpyW lstrcpyX

Functions

int | CalcListViewWidth (HWND hwndList, int iDefault)
TCHAR * | FormatDateTime (FILETIME *pft, TCHAR *pszDatetimeBuf, DWORD cbBufSize)
BOOL | IsValidDir (TCHAR *pDirName)
LPWSTR | lstrcpyX (LPWSTR lpString1, LPCWSTR lpString2)

Define Documentation

#define lstrcpyW lstrcpyX

Definition at line 22 of file Helper.h.

Function Documentation

int CalcListViewWidth | ( | HWND | hwndList,
 |  | int | iDefault
 | ) |  |

Definition at line 31 of file Helper.Cpp.

{
NONCLIENTMETRICSA metrics;
RECT rcClientRect;

    metrics.cbSize = sizeof(metrics);

    // explicitly ask for ANSI version of SystemParametersInfo since we just
    // care about the ScrollWidth and don't want to conver the LOGFONT info.
    if (GetClientRect(hwndList,&rcClientRect)
        && SystemParametersInfoA(SPI_GETNONCLIENTMETRICS,sizeof(metrics),(PVOID) &metrics,0))
    {
        // subtract off scroll bar distance
        rcClientRect.right -= (metrics.iScrollWidth);
    }
    else
    {
        rcClientRect.right = iDefault;  // if fail, use default
    }

    return rcClientRect.right;
}

TCHAR* FormatDateTime | ( | FILETIME * | pft,
 |  | TCHAR * | pszDatetimeBuf,
 |  | DWORD | cbBufSize
 | ) |  |

Definition at line 103 of file Helper.Cpp.

{
TCHAR * pDateTime = pszDatetimeBuf;
int cchWritten;
SYSTEMTIME sysTime;
FILETIME ftLocal;

  FileTimeToLocalFileTime(pft,&ftLocal);
  FileTimeToSystemTime(&ftLocal,&sysTime);

    // insert date in form of date<space>hour
    *pDateTime = NULL;

    // want to insert the date
    if (cchWritten = GetDateFormat(NULL,DATE_SHORTDATE,&sysTime,NULL,pDateTime,cbBufSize))
    {
        pDateTime += (cchWritten -1); // move number of characters written. (cchWritten includes the NULL)
        *pDateTime = TEXT(' '); // pDateTime is now ponting at the NULL character.
        ++pDateTime;

        // no try to get the hours if fails we make sure that the last char is NULL;
        if (!GetTimeFormat(NULL,TIME_NOSECONDS,&sysTime,NULL,pDateTime,cbBufSize - cchWritten))
        {
            *pDateTime = NULL;
        }
    }

    return pszDatetimeBuf;
}

BOOL IsValidDir ( TCHAR * pDirName )

Definition at line 71 of file Helper.Cpp.

{
BOOL fReturn = FALSE;
HANDLE hFind;
WIN32_FIND_DATA finddata;

    hFind = FindFirstFile(pDirName, &finddata);

    if (hFind != (HANDLE) -1)
    {

       fReturn = (finddata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? TRUE : FALSE;
       FindClose(hFind);
    }

    return fReturn;
}

LPWSTR lstrcpyX | ( | LPWSTR | lpString1,
 |  | LPCWSTR | lpString2
 | ) |  |

Definition at line 150 of file Helper.Cpp.

{
    LPWSTR lpDest = lpString1;

    Assert(lpString1);
    Assert(lpString2);

    while( *lpDest++ = *lpString2++ )
        ;
    return lpString1;
}

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/SyncMgr/SyncDir/PreComp.h File Reference

  • NetDS
  • SyncMgr
  • SyncDir

PreComp.h File Reference

#include <objbase.h>
#include <windows.h>
#include <shlobj.h>
#include <commctrl.h>
#include <advpub.h>
#include <mobsync.h>
#include "resource.h"
#include "debug.h"
#include "alloc.h"
#include "critsect.h"
#include "helper.h"
#include "enum.h"
#include "guid.h"
#include "settings.h"
#include "cfact.h"
#include "reg.h"
#include "dllmain.h"
#include "handler.h"
#include "resource.h"
#include "guid.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/SyncMgr/SyncDir/Reg.Cpp File Reference

  • NetDS
  • SyncMgr
  • SyncDir
Defines | Functions

Reg.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Defines

#define | HANDLERITEMSKEY TEXT("\\HandlerItems")
#define | HANDLERVALUE_DIR1 TEXT("Dir1")
#define | HANDLERVALUE_DIR2 TEXT("Dir2")
#define | HANDLERVALUE_DISPLAYNAME TEXT("DisplayName")
#define | HANDLERVALUE_FILETIME TEXT("TimeStamp")
#define | HANDLERVALUE_RECURSIVE TEXT("Recursive")

Functions

BOOL | AddRegNamedValue (LPTSTR pszKey, LPTSTR pszSubkey, LPTSTR pszValueName, LPTSTR pszValue)
HKEY | CreateHandlerItemPrefKey (CLSID CLSIDServer, SYNCMGRITEMID ItemID)
HKEY | CreateHandlerItemPrefKey (HKEY hkeyHandler, SYNCMGRITEMID ItemID)
HKEY | CreateHandlerPrefKey (CLSID CLSIDServer)
LRESULT | GetRegKeyValue (HKEY hkeyParent, LPCTSTR pcszSubKey, LPCTSTR pcszValue, PDWORD pdwValueType, PBYTE pbyteBuf, PDWORD pdwcbBufLen)
STDMETHODIMP | Reg_DeleteItemIdForHandlerItem (CLSID CLSIDServer, SYNCMGRITEMID ItemID)
STDMETHODIMP | Reg_GetItemSettingsForHandlerItem (HKEY hKeyHandler, SYNCMGRITEMID ItemID, LPSAMPLEITEMSETTINGS pSampleItemSettings)
STDMETHODIMP | Reg_SetItemSettingsForHandlerItem (CLSID CLSIDServer, SYNCMGRITEMID ItemID, LPSAMPLEITEMSETTINGS pSampleItemSettings)
BOOL | RegGetTimeStamp (HKEY hKey, FILETIME *pft)
BOOL | RegWriteTimeStamp (HKEY hkey, FILETIME *pft)
BOOL | SetRegKeyValue (HKEY hKeyTop, LPTSTR pszKey, LPTSTR pszSubkey, LPTSTR pszValue)

Define Documentation

#define HANDLERITEMSKEY TEXT("\\HandlerItems")

Definition at line 14 of file Reg.Cpp.

#define HANDLERVALUE_DIR1 TEXT("Dir1")

Definition at line 16 of file Reg.Cpp.

#define HANDLERVALUE_DIR2 TEXT("Dir2")

Definition at line 17 of file Reg.Cpp.

#define HANDLERVALUE_DISPLAYNAME TEXT("DisplayName")

Definition at line 18 of file Reg.Cpp.

#define HANDLERVALUE_FILETIME TEXT("TimeStamp")

Definition at line 19 of file Reg.Cpp.

#define HANDLERVALUE_RECURSIVE TEXT("Recursive")

Definition at line 20 of file Reg.Cpp.

Function Documentation

BOOL AddRegNamedValue | ( | LPTSTR | pszKey,
 |  | LPTSTR | pszSubkey,
 |  | LPTSTR | pszValueName,
 |  | LPTSTR | pszValue
 | ) |  |

Definition at line 142 of file Reg.Cpp.

{
  BOOL bOk = FALSE;
  LONG ec;
  HKEY hKey;
  TCHAR szKey[MAX_STRING_LENGTH];

  lstrcpy(szKey, pszKey);

  if (NULL != pszSubkey)
  {
    lstrcat(szKey, TEXT("\\"));
    lstrcat(szKey, pszSubkey);
  }

  ec = RegOpenKeyEx(
         HKEY_CLASSES_ROOT,
         szKey,
         0,
         KEY_READ | KEY_WRITE,
         &hKey);

  if (NULL != pszValue && ERROR_SUCCESS == ec)
  {
    ec = RegSetValueEx(
           hKey,
           pszValueName,
           0,
           REG_SZ,
           (BYTE *)pszValue,
           (lstrlen(pszValue)+1)*sizeof(TCHAR));
    if (ERROR_SUCCESS == ec)
      bOk = TRUE;
    RegCloseKey(hKey);
  }

  return bOk;
}

HKEY CreateHandlerItemPrefKey | ( | CLSID | CLSIDServer,
 |  | SYNCMGRITEMID | ItemID
 | ) |  |

Definition at line 378 of file Reg.Cpp.

{
HKEY hKeyHandler;
HKEY hKeyItem;

  if (hKeyHandler = CreateHandlerPrefKey(CLSIDServer))
  {
      hKeyItem = CreateHandlerItemPrefKey(hKeyHandler,ItemID);

      RegCloseKey(hKeyHandler); // close handler key.
  }

  return hKeyItem;

}

HKEY CreateHandlerItemPrefKey | ( | HKEY | hkeyHandler,
 |  | SYNCMGRITEMID | ItemID
 | ) |  |

Definition at line 329 of file Reg.Cpp.

{
TCHAR szGUID[GUID_SIZE+1];
LONG lResult = -1;
HKEY hKeyItem;

 // try to open/create item key
    #ifdef _UNICODE
      StringFromGUID2(ItemID, szGUID, GUID_SIZE);
    #else
      BOOL fUsedDefaultChar;
      WCHAR wszID[GUID_SIZE+1];

      // convert clsidServer
      StringFromGUID2(ItemID, wszID, GUID_SIZE);

      WideCharToMultiByte(CP_ACP ,0,
        wszID,-1,szGUID,GUID_SIZE + 1,
        NULL,&fUsedDefaultChar);

    #endif // _UNICODE

  // try to open handler items keyfs
   lResult = RegCreateKeyEx(
         hkeyHandler,
         szGUID,
         0,NULL,REG_OPTION_NON_VOLATILE,
         KEY_READ | KEY_WRITE,NULL,
         &hKeyItem,NULL);

  return (ERROR_SUCCESS == lResult) ? hKeyItem : NULL;

}

HKEY CreateHandlerPrefKey ( CLSID CLSIDServer )

Definition at line 277 of file Reg.Cpp.

{
TCHAR szFullKeyName[MAX_PATH];
TCHAR szGUID[GUID_SIZE+1];
LONG lResult = -1;
HKEY hKey;

#ifdef _UNICODE
  StringFromGUID2(CLSIDServer, szGUID, GUID_SIZE);
#else
  BOOL fUsedDefaultChar;
  WCHAR wszID[GUID_SIZE+1];

  // convert clsidServer
  StringFromGUID2(CLSIDServer, wszID, GUID_SIZE);

  WideCharToMultiByte(CP_ACP ,0,
    wszID,-1,szGUID,GUID_SIZE + 1,
    NULL,&fUsedDefaultChar);

#endif // _UNICODE

  lstrcpy(szFullKeyName, TEXT("CLSID\\"));
  lstrcat(szFullKeyName, szGUID);
  lstrcat(szFullKeyName,HANDLERITEMSKEY);

  // try to open handler items keyfs
  lResult = RegCreateKeyEx(
         HKEY_CLASSES_ROOT,
         szFullKeyName,
         0,NULL,REG_OPTION_NON_VOLATILE,
         KEY_READ | KEY_WRITE,NULL,
         &hKey,NULL);

  return (ERROR_SUCCESS == lResult) ? hKey : NULL;

}

LRESULT GetRegKeyValue | ( | HKEY | hkeyParent,
 |  | LPCTSTR | pcszSubKey,
 |  | LPCTSTR | pcszValue,
 |  | PDWORD | pdwValueType,
 |  | PBYTE | pbyteBuf,
 |  | PDWORD | pdwcbBufLen
 | ) |  |

Definition at line 100 of file Reg.Cpp.

{
LONG lResult;
HKEY hkeySubKey;

    lResult = RegOpenKeyEx(hkeyParent, pcszSubKey, 0, KEY_QUERY_VALUE,
                           &hkeySubKey);

    if (lResult == ERROR_SUCCESS)
    {
        LONG lResultClose;

        lResult = RegQueryValueEx(hkeySubKey, pcszValue, NULL, pdwValueType,
                                  pbyteBuf, pdwcbBufLen);

        lResultClose = RegCloseKey(hkeySubKey);

        if (lResult == ERROR_SUCCESS)
            lResult = lResultClose;
    }

    return(lResult);
}

STDMETHODIMP Reg_DeleteItemIdForHandlerItem | ( | CLSID | CLSIDServer,
 |  | SYNCMGRITEMID | ItemID
 | ) |  |

Definition at line 578 of file Reg.Cpp.

{
HKEY hKeyHandler;

    if (hKeyHandler = CreateHandlerPrefKey( CLSIDServer))
    {
    TCHAR szGUID[GUID_SIZE+1];

        #ifdef _UNICODE
          StringFromGUID2(ItemID, szGUID, GUID_SIZE);
        #else
          BOOL fUsedDefaultChar;
          WCHAR wszID[GUID_SIZE+1];

          // convert clsidServer
          StringFromGUID2(ItemID, wszID, GUID_SIZE);

          WideCharToMultiByte(CP_ACP ,0,
            wszID,-1,szGUID,GUID_SIZE + 1,
            NULL,&fUsedDefaultChar);

         #endif // _UNICODE

        RegDeleteKey(hKeyHandler,szGUID);

        RegCloseKey(hKeyHandler);
    }

    return NOERROR;
}

STDMETHODIMP Reg_GetItemSettingsForHandlerItem | ( | HKEY | hKeyHandler,
 |  | SYNCMGRITEMID | ItemID,
 |  | LPSAMPLEITEMSETTINGS | pSampleItemSettings
 | ) |  |

Definition at line 408 of file Reg.Cpp.

{
HKEY hKey;
TCHAR *pDisplayName;
DWORD dwType;
DWORD dwSize;

    hKey = CreateHandlerItemPrefKey(hKeyHandler,ItemID);
    if (!hKey)
    {
        Assert(hKey);
        return E_UNEXPECTED;
    }

    pSampleItemSettings->syncmgrItem.ItemID = ItemID;

   // write out our info.
    #ifdef _UNICODE
        pDisplayName = pSampleItemSettings->syncmgrItem.wszItemName;
    #else
      char szDisplayName[MAX_SYNCMGRITEMNAME];

      pDisplayName = szDisplayName;
    #endif // _UNICODE

    // read in the values,
    dwType = REG_SZ;
    dwSize = MAX_SYNCMGRITEMNAME*sizeof(TCHAR);
    RegQueryValueEx( hKey,
                          HANDLERVALUE_DISPLAYNAME,
                          NULL,
                          &dwType,
                          (BYTE *) pDisplayName,
                          &dwSize);

    #ifndef _UNICODE

      MultiByteToWideChar(CP_ACP, 0,
                            pDisplayName,-1,
                            pSampleItemSettings->syncmgrItem.wszItemName,
                           MAX_SYNCMGRITEMNAME);

    #endif

    dwType = REG_SZ;
    dwSize = MAX_PATH*sizeof(TCHAR);
    RegQueryValueEx( hKey,
                          HANDLERVALUE_DIR1,
                          NULL,
                          &dwType,
                          (BYTE *) pSampleItemSettings->dir1,
                          &dwSize);
    dwType = REG_SZ;
    dwSize = MAX_PATH*sizeof(TCHAR);
    RegQueryValueEx( hKey,
                          HANDLERVALUE_DIR2,
                          NULL,
                          &dwType,
                          (BYTE *) pSampleItemSettings->dir2,
                          &dwSize);

    dwType = REG_DWORD;
    dwSize = sizeof(DWORD);
    RegQueryValueEx( hKey,
                          HANDLERVALUE_RECURSIVE,
                          NULL,
                          &dwType,
                          (BYTE *) &(pSampleItemSettings->fRecursive),
                          &dwSize);

    RegGetTimeStamp(hKey,&(pSampleItemSettings->syncmgrItem.ftLastUpdate));

    RegCloseKey(hKey);

    return NOERROR;
}

STDMETHODIMP Reg_SetItemSettingsForHandlerItem | ( | CLSID | CLSIDServer,
 |  | SYNCMGRITEMID | ItemID,
 |  | LPSAMPLEITEMSETTINGS | pSampleItemSettings
 | ) |  |

Definition at line 505 of file Reg.Cpp.

{
HKEY hKey;
TCHAR *pDisplayName;

    hKey = CreateHandlerItemPrefKey(CLSIDServer,ItemID);
    if (!hKey)
    {
        Assert(hKey);
        return E_UNEXPECTED;
    }

   // write out our info.
    #ifdef _UNICODE
        pDisplayName = pSampleItemSettings->syncmgrItem.wszItemName;
    #else
      BOOL fUsedDefaultChar;
      char szDisplayName[MAX_SYNCMGRITEMNAME];

      WideCharToMultiByte(CP_ACP ,0,
        pSampleItemSettings->syncmgrItem.wszItemName,-1,
            szDisplayName,MAX_SYNCMGRITEMNAME,
        NULL,&fUsedDefaultChar);

      pDisplayName = szDisplayName;
    #endif // _UNICODE

    RegSetValueEx(hKey,HANDLERVALUE_DISPLAYNAME,
           0,
           REG_SZ,
           (BYTE *) pDisplayName,
           (lstrlen(pDisplayName) + 1)*sizeof(TCHAR));

    RegSetValueEx(hKey,HANDLERVALUE_DIR1,
           0,
           REG_SZ,
           (BYTE *) pSampleItemSettings->dir1,
           (lstrlen(pSampleItemSettings->dir1) + 1)*sizeof(TCHAR));

    RegSetValueEx(hKey,HANDLERVALUE_DIR2,
           0,
           REG_SZ,
           (BYTE *) pSampleItemSettings->dir2,
           (lstrlen(pSampleItemSettings->dir2) + 1)*sizeof(TCHAR));

    RegSetValueEx(hKey,HANDLERVALUE_RECURSIVE,
           0,
           REG_DWORD,
           (BYTE *) &(pSampleItemSettings->fRecursive),
           sizeof(DWORD));

    RegWriteTimeStamp(hKey,&(pSampleItemSettings->syncmgrItem.ftLastUpdate));

    RegCloseKey(hKey);

   return NOERROR;
}

BOOL RegGetTimeStamp | ( | HKEY | hKey,
 |  | FILETIME * | pft
 | ) |  |

Definition at line 200 of file Reg.Cpp.

{
DWORD dwType;
FILETIME ft;
LONG lr;
DWORD dwSize = sizeof(FILETIME);

    Assert(pft);

    lr = RegQueryValueEx( hKey,
                          HANDLERVALUE_FILETIME,
                          NULL,
                          &dwType,
                          (BYTE *)&ft,
                          &dwSize );

    if ( lr == ERROR_SUCCESS )
    {
        Assert( dwSize == sizeof(FILETIME) && dwType == REG_BINARY );
        *pft = ft;
    }
    else
    {
        // set the filetime to way back when to
        // any compares will just say older instead
        // of having to check success code
        (*pft).dwLowDateTime = 0;
        (*pft).dwHighDateTime = 0;
    }

    return TRUE;
}

BOOL RegWriteTimeStamp | ( | HKEY | hkey,
 |  | FILETIME * | pft
 | ) |  |

Definition at line 248 of file Reg.Cpp.

{
LRESULT lr;

    lr = RegSetValueEx( hkey,
            HANDLERVALUE_FILETIME,
            NULL,
            REG_BINARY,
            (BYTE *) pft,
            sizeof(FILETIME) );

    return (ERROR_SUCCESS == lr) ? TRUE : FALSE;
}

BOOL SetRegKeyValue | ( | HKEY | hKeyTop,
 |  | LPTSTR | pszKey,
 |  | LPTSTR | pszSubkey,
 |  | LPTSTR | pszValue
 | ) |  |

Definition at line 38 of file Reg.Cpp.

{
  BOOL bOk = FALSE;
  LONG ec;
  HKEY hKey;
  TCHAR szKey[MAX_STRING_LENGTH];

  lstrcpy(szKey, pszKey);

  if (NULL != pszSubkey)
  {
    lstrcat(szKey, TEXT("\\"));
    lstrcat(szKey, pszSubkey);
  }

  ec = RegCreateKeyEx(
         hKeyTop,
         szKey,
         0,
         NULL,
         REG_OPTION_NON_VOLATILE,
         KEY_READ | KEY_WRITE,
         NULL,
         &hKey,
         NULL);

  if (NULL != pszValue && ERROR_SUCCESS == ec)
  {
    ec = RegSetValueEx(
           hKey,
           NULL,
           0,
           REG_SZ,
           (BYTE *)pszValue,
           (lstrlen(pszValue)+1)*sizeof(TCHAR));
    if (ERROR_SUCCESS == ec)
      bOk = TRUE;
    RegCloseKey(hKey);
  }

  return bOk;
}

Generated on Wed Nov 13 2024 16:54:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/SyncMgr/SyncDir/Reg.h File Reference

  • NetDS
  • SyncMgr
  • SyncDir
Defines | Functions

Reg.h File Reference

Go to the source code of this file.

Defines

#define | GUID_SIZE 128
#define | MAX_STRING_LENGTH 256

Functions

BOOL | AddRegNamedValue (LPTSTR pszKey, LPTSTR pszSubkey, LPTSTR pszValueName, LPTSTR pszValue)
HKEY | CreateHandlerPrefKey (CLSID CLSIDServer)
STDMETHODIMP | Reg_DeleteItemIdForHandlerItem (CLSID CLSIDServer, SYNCMGRITEMID ItemID)
STDMETHODIMP | Reg_GetItemSettingsForHandlerItem (HKEY hKeyHandler, SYNCMGRITEMID ItemID, LPSAMPLEITEMSETTINGS pSampleItemSettings)
STDMETHODIMP | Reg_SetItemSettingsForHandlerItem (CLSID CLSIDServer, SYNCMGRITEMID ItemID, LPSAMPLEITEMSETTINGS pSampleItemSettings)
BOOL | SetRegKeyValue (HKEY hKeyTop, LPTSTR pszKey, LPTSTR pszSubkey, LPTSTR pszValue)

Define Documentation

#define GUID_SIZE 128

Definition at line 17 of file Reg.h.

#define MAX_STRING_LENGTH 256

Definition at line 18 of file Reg.h.

Function Documentation

BOOL AddRegNamedValue | ( | LPTSTR | pszKey,
 |  | LPTSTR | pszSubkey,
 |  | LPTSTR | pszValueName,
 |  | LPTSTR | pszValue
 | ) |  |

Definition at line 2811 of file AppUtil.Cpp.

{
  BOOL bOk = FALSE;
  LONG ec;
  HKEY hKey;
  TCHAR szKey[MAX_STRING_LENGTH];

  lstrcpyn(szKey, pszKey, MAX_STRING_LENGTH);

  if (NULL != pszSubkey)
  {
    lstrncat(szKey, TEXT("\\"), MAX_STRING_LENGTH - lstrlen(szKey));
    lstrncat(szKey, pszSubkey, MAX_STRING_LENGTH - lstrlen(szKey));
  }

  ec = RegOpenKeyEx(
         HKEY_CLASSES_ROOT,
         szKey,
         0,
         KEY_ALL_ACCESS,
         &hKey);

  if (NULL != pszValue && ERROR_SUCCESS == ec)
  {
    ec = RegSetValueEx(
           hKey,
           pszValueName,
           0,
           REG_SZ,
           (BYTE *)pszValue,
           (lstrlen(pszValue)+1)*sizeof(TCHAR));
    if (ERROR_SUCCESS == ec)
      bOk = TRUE;
    RegCloseKey(hKey);
  }

  return bOk;
}

HKEY CreateHandlerPrefKey ( CLSID CLSIDServer )

Definition at line 277 of file Reg.Cpp.

{
TCHAR szFullKeyName[MAX_PATH];
TCHAR szGUID[GUID_SIZE+1];
LONG lResult = -1;
HKEY hKey;

#ifdef _UNICODE
  StringFromGUID2(CLSIDServer, szGUID, GUID_SIZE);
#else
  BOOL fUsedDefaultChar;
  WCHAR wszID[GUID_SIZE+1];

  // convert clsidServer
  StringFromGUID2(CLSIDServer, wszID, GUID_SIZE);

  WideCharToMultiByte(CP_ACP ,0,
    wszID,-1,szGUID,GUID_SIZE + 1,
    NULL,&fUsedDefaultChar);

#endif // _UNICODE

  lstrcpy(szFullKeyName, TEXT("CLSID\\"));
  lstrcat(szFullKeyName, szGUID);
  lstrcat(szFullKeyName,HANDLERITEMSKEY);

  // try to open handler items keyfs
  lResult = RegCreateKeyEx(
         HKEY_CLASSES_ROOT,
         szFullKeyName,
         0,NULL,REG_OPTION_NON_VOLATILE,
         KEY_READ | KEY_WRITE,NULL,
         &hKey,NULL);

  return (ERROR_SUCCESS == lResult) ? hKey : NULL;

}

STDMETHODIMP Reg_DeleteItemIdForHandlerItem | ( | CLSID | CLSIDServer,
 |  | SYNCMGRITEMID | ItemID
 | ) |  |

Definition at line 578 of file Reg.Cpp.

{
HKEY hKeyHandler;

    if (hKeyHandler = CreateHandlerPrefKey( CLSIDServer))
    {
    TCHAR szGUID[GUID_SIZE+1];

        #ifdef _UNICODE
          StringFromGUID2(ItemID, szGUID, GUID_SIZE);
        #else
          BOOL fUsedDefaultChar;
          WCHAR wszID[GUID_SIZE+1];

          // convert clsidServer
          StringFromGUID2(ItemID, wszID, GUID_SIZE);

          WideCharToMultiByte(CP_ACP ,0,
            wszID,-1,szGUID,GUID_SIZE + 1,
            NULL,&fUsedDefaultChar);

         #endif // _UNICODE

        RegDeleteKey(hKeyHandler,szGUID);

        RegCloseKey(hKeyHandler);
    }

    return NOERROR;
}

STDMETHODIMP Reg_GetItemSettingsForHandlerItem | ( | HKEY | hKeyHandler,
 |  | SYNCMGRITEMID | ItemID,
 |  | LPSAMPLEITEMSETTINGS | pSampleItemSettings
 | ) |  |

Definition at line 408 of file Reg.Cpp.

{
HKEY hKey;
TCHAR *pDisplayName;
DWORD dwType;
DWORD dwSize;

    hKey = CreateHandlerItemPrefKey(hKeyHandler,ItemID);
    if (!hKey)
    {
        Assert(hKey);
        return E_UNEXPECTED;
    }

    pSampleItemSettings->syncmgrItem.ItemID = ItemID;

   // write out our info.
    #ifdef _UNICODE
        pDisplayName = pSampleItemSettings->syncmgrItem.wszItemName;
    #else
      char szDisplayName[MAX_SYNCMGRITEMNAME];

      pDisplayName = szDisplayName;
    #endif // _UNICODE

    // read in the values,
    dwType = REG_SZ;
    dwSize = MAX_SYNCMGRITEMNAME*sizeof(TCHAR);
    RegQueryValueEx( hKey,
                          HANDLERVALUE_DISPLAYNAME,
                          NULL,
                          &dwType,
                          (BYTE *) pDisplayName,
                          &dwSize);

    #ifndef _UNICODE

      MultiByteToWideChar(CP_ACP, 0,
                            pDisplayName,-1,
                            pSampleItemSettings->syncmgrItem.wszItemName,
                           MAX_SYNCMGRITEMNAME);

    #endif

    dwType = REG_SZ;
    dwSize = MAX_PATH*sizeof(TCHAR);
    RegQueryValueEx( hKey,
                          HANDLERVALUE_DIR1,
                          NULL,
                          &dwType,
                          (BYTE *) pSampleItemSettings->dir1,
                          &dwSize);
    dwType = REG_SZ;
    dwSize = MAX_PATH*sizeof(TCHAR);
    RegQueryValueEx( hKey,
                          HANDLERVALUE_DIR2,
                          NULL,
                          &dwType,
                          (BYTE *) pSampleItemSettings->dir2,
                          &dwSize);

    dwType = REG_DWORD;
    dwSize = sizeof(DWORD);
    RegQueryValueEx( hKey,
                          HANDLERVALUE_RECURSIVE,
                          NULL,
                          &dwType,
                          (BYTE *) &(pSampleItemSettings->fRecursive),
                          &dwSize);

    RegGetTimeStamp(hKey,&(pSampleItemSettings->syncmgrItem.ftLastUpdate));

    RegCloseKey(hKey);

    return NOERROR;
}

STDMETHODIMP Reg_SetItemSettingsForHandlerItem | ( | CLSID | CLSIDServer,
 |  | SYNCMGRITEMID | ItemID,
 |  | LPSAMPLEITEMSETTINGS | pSampleItemSettings
 | ) |  |

Definition at line 505 of file Reg.Cpp.

{
HKEY hKey;
TCHAR *pDisplayName;

    hKey = CreateHandlerItemPrefKey(CLSIDServer,ItemID);
    if (!hKey)
    {
        Assert(hKey);
        return E_UNEXPECTED;
    }

   // write out our info.
    #ifdef _UNICODE
        pDisplayName = pSampleItemSettings->syncmgrItem.wszItemName;
    #else
      BOOL fUsedDefaultChar;
      char szDisplayName[MAX_SYNCMGRITEMNAME];

      WideCharToMultiByte(CP_ACP ,0,
        pSampleItemSettings->syncmgrItem.wszItemName,-1,
            szDisplayName,MAX_SYNCMGRITEMNAME,
        NULL,&fUsedDefaultChar);

      pDisplayName = szDisplayName;
    #endif // _UNICODE

    RegSetValueEx(hKey,HANDLERVALUE_DISPLAYNAME,
           0,
           REG_SZ,
           (BYTE *) pDisplayName,
           (lstrlen(pDisplayName) + 1)*sizeof(TCHAR));

    RegSetValueEx(hKey,HANDLERVALUE_DIR1,
           0,
           REG_SZ,
           (BYTE *) pSampleItemSettings->dir1,
           (lstrlen(pSampleItemSettings->dir1) + 1)*sizeof(TCHAR));

    RegSetValueEx(hKey,HANDLERVALUE_DIR2,
           0,
           REG_SZ,
           (BYTE *) pSampleItemSettings->dir2,
           (lstrlen(pSampleItemSettings->dir2) + 1)*sizeof(TCHAR));

    RegSetValueEx(hKey,HANDLERVALUE_RECURSIVE,
           0,
           REG_DWORD,
           (BYTE *) &(pSampleItemSettings->fRecursive),
           sizeof(DWORD));

    RegWriteTimeStamp(hKey,&(pSampleItemSettings->syncmgrItem.ftLastUpdate));

    RegCloseKey(hKey);

   return NOERROR;
}

BOOL SetRegKeyValue | ( | HKEY | hKeyTop,
 |  | LPTSTR | pszKey,
 |  | LPTSTR | pszSubkey,
 |  | LPTSTR | pszValue
 | ) |  |

Definition at line 38 of file Reg.Cpp.

{
  BOOL bOk = FALSE;
  LONG ec;
  HKEY hKey;
  TCHAR szKey[MAX_STRING_LENGTH];

  lstrcpy(szKey, pszKey);

  if (NULL != pszSubkey)
  {
    lstrcat(szKey, TEXT("\\"));
    lstrcat(szKey, pszSubkey);
  }

  ec = RegCreateKeyEx(
         hKeyTop,
         szKey,
         0,
         NULL,
         REG_OPTION_NON_VOLATILE,
         KEY_READ | KEY_WRITE,
         NULL,
         &hKey,
         NULL);

  if (NULL != pszValue && ERROR_SUCCESS == ec)
  {
    ec = RegSetValueEx(
           hKey,
           NULL,
           0,
           REG_SZ,
           (BYTE *)pszValue,
           (lstrlen(pszValue)+1)*sizeof(TCHAR));
    if (ERROR_SUCCESS == ec)
      bOk = TRUE;
    RegCloseKey(hKey);
  }

  return bOk;
}

Generated on Wed Nov 13 2024 16:53:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/SyncMgr/SyncDir/Resource.h File Reference

  • NetDS
  • SyncMgr
  • SyncDir
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_CONFIGDIALOG_ADD 203
#define | IDC_CONFIGDIALOG_CONFIGTEXT 202
#define | IDC_CONFIGDIALOG_EDIT 205
#define | IDC_CONFIGDIALOG_ITEMLIST 201
#define | IDC_CONFIGDIALOG_REMOVE 204
#define | IDC_CONFIGDIALOG_SUMMARYTEXT 206
#define | IDC_ITEMCONFIGDIALOG_EDIT_DIR1NAME 304
#define | IDC_ITEMCONFIGDIALOG_EDIT_DIR2NAME 306
#define | IDC_ITEMCONFIGDIALOG_EDIT_DISPLAYNAME 302
#define | IDC_ITEMCONFIGDIALOG_INCLUDESUBDIRS 307
#define | IDC_ITEMCONFIGDIALOG_STATIC_DIR1NAME 303
#define | IDC_ITEMCONFIGDIALOG_STATIC_DIR2NAME 305
#define | IDC_ITEMCONFIGDIALOG_STATIC_DISPLAYNAME 301
#define | IDD_CONFIGDIALOG 200
#define | IDD_ITEMCONFIGDIALOG 300
#define | IDI_SAMPLEHANDLERICON 129
#define | IDI_SAMPLEHANDLERITEMICON 130
#define | IDS_CONFIG_TAB 500
#define | IDS_CONFIG_TITLE 501
#define | IDS_ITEMCONFIG_TAB 502

Define Documentation

#define IDC_CONFIGDIALOG_ADD 203

Definition at line 11 of file Resource.h.

#define IDC_CONFIGDIALOG_CONFIGTEXT 202

Definition at line 10 of file Resource.h.

#define IDC_CONFIGDIALOG_EDIT 205

Definition at line 13 of file Resource.h.

#define IDC_CONFIGDIALOG_ITEMLIST 201

Definition at line 9 of file Resource.h.

#define IDC_CONFIGDIALOG_REMOVE 204

Definition at line 12 of file Resource.h.

#define IDC_CONFIGDIALOG_SUMMARYTEXT 206

Definition at line 14 of file Resource.h.

#define IDC_ITEMCONFIGDIALOG_EDIT_DIR1NAME 304

Definition at line 20 of file Resource.h.

#define IDC_ITEMCONFIGDIALOG_EDIT_DIR2NAME 306

Definition at line 22 of file Resource.h.

#define IDC_ITEMCONFIGDIALOG_EDIT_DISPLAYNAME 302

Definition at line 18 of file Resource.h.

#define IDC_ITEMCONFIGDIALOG_INCLUDESUBDIRS 307

Definition at line 23 of file Resource.h.

#define IDC_ITEMCONFIGDIALOG_STATIC_DIR1NAME 303

Definition at line 19 of file Resource.h.

#define IDC_ITEMCONFIGDIALOG_STATIC_DIR2NAME 305

Definition at line 21 of file Resource.h.

#define IDC_ITEMCONFIGDIALOG_STATIC_DISPLAYNAME 301

Definition at line 17 of file Resource.h.

#define IDD_CONFIGDIALOG 200

Definition at line 8 of file Resource.h.

#define IDD_ITEMCONFIGDIALOG 300

Definition at line 16 of file Resource.h.

#define IDI_SAMPLEHANDLERICON 129

Definition at line 6 of file Resource.h.

#define IDI_SAMPLEHANDLERITEMICON 130

Definition at line 7 of file Resource.h.

#define IDS_CONFIG_TAB 500

Definition at line 25 of file Resource.h.

#define IDS_CONFIG_TITLE 501

Definition at line 26 of file Resource.h.

#define IDS_ITEMCONFIG_TAB 502

Definition at line 27 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/SyncMgr/SyncDir/Settings.Cpp File Reference

  • NetDS
  • SyncMgr
  • SyncDir
Functions | Variables

Settings.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

BOOL CALLBACK | ConfigureDlgProc (HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam)
BOOL CALLBACK | ItemConfigDlgProc (HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam)
STDMETHODIMP_ (ULONG) CSettings

Variables

HINSTANCE | g_hmodThisDll
CSettings * g_pSettings

Function Documentation

BOOL CALLBACK ConfigureDlgProc | ( | HWND | hWnd,
 |  | UINT | uMessage,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 1356 of file Settings.Cpp.

{
WORD wNotifyCode = HIWORD(wParam); // notification code
BOOL bResult = FALSE;
CONFIGSETTINGSLPARAM *pConfigSettingslParam = (CONFIGSETTINGSLPARAM *) GetWindowLongPtr(hWnd,DWLP_USER);

    if (WM_INITDIALOG == uMessage)
    {
        pConfigSettingslParam =  (CONFIGSETTINGSLPARAM *) ((PROPSHEETPAGE *) lParam)->lParam;
        SetWindowLongPtr(hWnd, DWLP_USER, (LONG_PTR) pConfigSettingslParam);

        pConfigSettingslParam->pSettings->OnConfigDlgInit(hWnd,pConfigSettingslParam,uMessage,wParam,lParam);
    }
    else if (pConfigSettingslParam)
    {
        switch (uMessage)
        {
            case WM_DESTROY:
                pConfigSettingslParam->pSettings->OnConfigDlgDestroy(hWnd,pConfigSettingslParam,uMessage,wParam,lParam);
            break;
            case WM_NOTIFY:
                switch (((NMHDR FAR *)lParam)->code)
                {
                    case PSN_APPLY:

                        // if anything changed mark OK even if later cancel, can't undo
                        break;
                  default:
                        pConfigSettingslParam->pSettings->OnConfigDlgNotify(hWnd,pConfigSettingslParam,uMessage,wParam,lParam);
                     break;
                }
                break;
        case WM_COMMAND:
                pConfigSettingslParam->pSettings->OnConfigDlgCommand(hWnd,pConfigSettingslParam,uMessage,wParam,lParam);
            break;
        default:
                break;
        }
    }

    return bResult;
}

BOOL CALLBACK ItemConfigDlgProc | ( | HWND | hWnd,
 |  | UINT | uMessage,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 1724 of file Settings.Cpp.

{
WORD wNotifyCode = HIWORD(wParam); // notification code
BOOL bResult = FALSE;
ITEMCONFIGSETTINGSLPARAM *pItemConfigDlglParam = (ITEMCONFIGSETTINGSLPARAM *) GetWindowLongPtr(hWnd,DWLP_USER);

    if (WM_INITDIALOG == uMessage)
    {
        pItemConfigDlglParam =  (ITEMCONFIGSETTINGSLPARAM *) ((PROPSHEETPAGE *) lParam)->lParam;
        SetWindowLongPtr(hWnd, DWLP_USER, (LONG_PTR) pItemConfigDlglParam);

        pItemConfigDlglParam->pSettings->OnItemConfigDlgInit(hWnd,pItemConfigDlglParam,uMessage,wParam,lParam);

    }
    else if (pItemConfigDlglParam)
    {
        switch (uMessage)
        {
            case WM_DESTROY:
                pItemConfigDlglParam->pSettings->OnItemConfigDlgDestroy(hWnd,pItemConfigDlglParam,uMessage,wParam,lParam);
            break;
            case WM_NOTIFY:
                switch (((NMHDR FAR *)lParam)->code)
                {
                    case PSN_APPLY:

                        // after a successful apply the item has changed.
                        // so set return value to S_OK:
                        if (pItemConfigDlglParam->pSettings->OnItemConfigDlgApply(hWnd,pItemConfigDlglParam,uMessage,wParam,lParam))
                        {
                           SetWindowLongPtr(hWnd,DWLP_MSGRESULT,PSNRET_NOERROR);
                        }
                        else
                        {
                            SetWindowLongPtr(hWnd,DWLP_MSGRESULT,PSNRET_INVALID);
                        }

                        return TRUE; // !!!return true so SetWindowLong DWL_MSGRESULT is applied
                        break;
                    default:
                        pItemConfigDlglParam->pSettings->OnItemConfigDlgNotify(hWnd,pItemConfigDlglParam,uMessage,wParam,lParam);
                        break;
                }
                break;
        case WM_COMMAND:
                pItemConfigDlglParam->pSettings->OnItemConfigDlgCommand(hWnd,pItemConfigDlglParam,uMessage,wParam,lParam);
        break;
        default:
                break;
        }
    }

    return bResult;
}

STDMETHODIMP_ ( ULONG )

Definition at line 1881 of file Settings.Cpp.

{
    return CGenericEnum::Release();
}

Variable Documentation

HINSTANCE g_hmodThisDll

Definition at line 25 of file DllMain.Cpp.

CSettings* g_pSettings

Definition at line 26 of file DllMain.Cpp.

Generated on Wed Nov 13 2024 16:54:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/SyncMgr/SyncDir/Settings.h File Reference

  • NetDS
  • SyncMgr
  • SyncDir
Classes | Typedefs | Functions

Settings.h File Reference

Go to the source code of this file.

Classes

struct | _tagCONFIGITEMLISTVIEWLPARAM
struct | _tagCONFIGSETTINGSLPARAM
struct | _tagHANDLERITEMSETTINGS
struct | _tagITEMCONFIGSETTINGSLPARAM
struct | _tagSAMPLEITEMSETTINGS
class | CEnumSyncMgrItems
class | CSettings

Typedefs

typedef struct
_tagCONFIGITEMLISTVIEWLPARAM 		CONFIGITEMLISTVIEWLPARAM
typedef struct
_tagCONFIGSETTINGSLPARAM 		CONFIGSETTINGSLPARAM
typedef struct
_tagHANDLERITEMSETTINGS 		HANDLERITEMSETTINGS
typedef struct
_tagITEMCONFIGSETTINGSLPARAM 		ITEMCONFIGSETTINGSLPARAM
typedef HANDLERITEMSETTINGS * | LPHANDLERITEMSETTINGS
typedef SAMPLEITEMSETTINGS * | LPSAMPLEITEMSETTINGS
typedef struct
_tagSAMPLEITEMSETTINGS 		SAMPLEITEMSETTINGS

Functions

BOOL CALLBACK | ConfigureDlgProc (HWND hDlg, UINT uMessage, WPARAM wParam, LPARAM lParam)
BOOL CALLBACK | ItemConfigDlgProc (HWND hDlg, UINT uMessage, WPARAM wParam, LPARAM lParam)

Typedef Documentation

typedef struct _tagCONFIGITEMLISTVIEWLPARAM CONFIGITEMLISTVIEWLPARAM
typedef struct _tagCONFIGSETTINGSLPARAM CONFIGSETTINGSLPARAM
typedef struct _tagHANDLERITEMSETTINGS HANDLERITEMSETTINGS
typedef struct _tagITEMCONFIGSETTINGSLPARAM ITEMCONFIGSETTINGSLPARAM
typedef HANDLERITEMSETTINGS* LPHANDLERITEMSETTINGS

Definition at line 30 of file Settings.h.

typedef SAMPLEITEMSETTINGS* LPSAMPLEITEMSETTINGS

Definition at line 54 of file Settings.h.

typedef struct _tagSAMPLEITEMSETTINGS SAMPLEITEMSETTINGS

Function Documentation

BOOL CALLBACK ConfigureDlgProc | ( | HWND | hDlg,
 |  | UINT | uMessage,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 1356 of file Settings.Cpp.

{
WORD wNotifyCode = HIWORD(wParam); // notification code
BOOL bResult = FALSE;
CONFIGSETTINGSLPARAM *pConfigSettingslParam = (CONFIGSETTINGSLPARAM *) GetWindowLongPtr(hWnd,DWLP_USER);

    if (WM_INITDIALOG == uMessage)
    {
        pConfigSettingslParam =  (CONFIGSETTINGSLPARAM *) ((PROPSHEETPAGE *) lParam)->lParam;
        SetWindowLongPtr(hWnd, DWLP_USER, (LONG_PTR) pConfigSettingslParam);

        pConfigSettingslParam->pSettings->OnConfigDlgInit(hWnd,pConfigSettingslParam,uMessage,wParam,lParam);
    }
    else if (pConfigSettingslParam)
    {
        switch (uMessage)
        {
            case WM_DESTROY:
                pConfigSettingslParam->pSettings->OnConfigDlgDestroy(hWnd,pConfigSettingslParam,uMessage,wParam,lParam);
            break;
            case WM_NOTIFY:
                switch (((NMHDR FAR *)lParam)->code)
                {
                    case PSN_APPLY:

                        // if anything changed mark OK even if later cancel, can't undo
                        break;
                  default:
                        pConfigSettingslParam->pSettings->OnConfigDlgNotify(hWnd,pConfigSettingslParam,uMessage,wParam,lParam);
                     break;
                }
                break;
        case WM_COMMAND:
                pConfigSettingslParam->pSettings->OnConfigDlgCommand(hWnd,pConfigSettingslParam,uMessage,wParam,lParam);
            break;
        default:
                break;
        }
    }

    return bResult;
}

BOOL CALLBACK ItemConfigDlgProc | ( | HWND | hDlg,
 |  | UINT | uMessage,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 1724 of file Settings.Cpp.

{
WORD wNotifyCode = HIWORD(wParam); // notification code
BOOL bResult = FALSE;
ITEMCONFIGSETTINGSLPARAM *pItemConfigDlglParam = (ITEMCONFIGSETTINGSLPARAM *) GetWindowLongPtr(hWnd,DWLP_USER);

    if (WM_INITDIALOG == uMessage)
    {
        pItemConfigDlglParam =  (ITEMCONFIGSETTINGSLPARAM *) ((PROPSHEETPAGE *) lParam)->lParam;
        SetWindowLongPtr(hWnd, DWLP_USER, (LONG_PTR) pItemConfigDlglParam);

        pItemConfigDlglParam->pSettings->OnItemConfigDlgInit(hWnd,pItemConfigDlglParam,uMessage,wParam,lParam);

    }
    else if (pItemConfigDlglParam)
    {
        switch (uMessage)
        {
            case WM_DESTROY:
                pItemConfigDlglParam->pSettings->OnItemConfigDlgDestroy(hWnd,pItemConfigDlglParam,uMessage,wParam,lParam);
            break;
            case WM_NOTIFY:
                switch (((NMHDR FAR *)lParam)->code)
                {
                    case PSN_APPLY:

                        // after a successful apply the item has changed.
                        // so set return value to S_OK:
                        if (pItemConfigDlglParam->pSettings->OnItemConfigDlgApply(hWnd,pItemConfigDlglParam,uMessage,wParam,lParam))
                        {
                           SetWindowLongPtr(hWnd,DWLP_MSGRESULT,PSNRET_NOERROR);
                        }
                        else
                        {
                            SetWindowLongPtr(hWnd,DWLP_MSGRESULT,PSNRET_INVALID);
                        }

                        return TRUE; // !!!return true so SetWindowLong DWL_MSGRESULT is applied
                        break;
                    default:
                        pItemConfigDlglParam->pSettings->OnItemConfigDlgNotify(hWnd,pItemConfigDlglParam,uMessage,wParam,lParam);
                        break;
                }
                break;
        case WM_COMMAND:
                pItemConfigDlglParam->pSettings->OnItemConfigDlgCommand(hWnd,pItemConfigDlglParam,uMessage,wParam,lParam);
        break;
        default:
                break;
        }
    }

    return bResult;
}

Generated on Wed Nov 13 2024 16:54:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi2/Atsp32/Atsp.c File Reference

  • NetDS
  • Tapi
  • Tapi2
  • Atsp32
Defines | Functions

Atsp.c File Reference

#include "atsp.h"

Go to the source code of this file.

Defines

#define | LINECONFIG_SIZE (2 * (MAX_DEV_NAME_LENGTH + 1) + 40)
#define | PROVIDER_INFO_SIZE (37 * sizeof (WCHAR))
#define | TAPI_CURRENT_VERSION 0x00030000

Functions

void | CommThread (PDRVLINE pLine)
BOOL CALLBACK | ConfigDlgProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
BOOL WINAPI | DllMain (HANDLE hDLL, DWORD dwReason, LPVOID lpReserved)
void PASCAL | DropActiveCall (PDRVLINE pLine)
LPVOID PASCAL | DrvAlloc (DWORD dwSize)
VOID PASCAL | DrvFree (LPVOID lp)
void PASCAL | EnableChildren (HWND hwnd, BOOL bEnable)
LPWSTR PASCAL | My_lstrcpyW (WCHAR *pString1, WCHAR *pString2)
LONG PASCAL | ProviderInstall (char *pszProviderName, BOOL bNoMultipleInstance)
void PASCAL | SelectDevice (HWND hwnd, LRESULT iDevice)
void PASCAL | SetCallState (PDRVLINE pLine, DWORD dwCallState, DWORD dwCallStateMode)
LONG TSPIAPI | TSPI_lineClose (HDRVLINE hdLine)
LONG TSPIAPI | TSPI_lineCloseCall (HDRVCALL hdCall)
LONG TSPIAPI | TSPI_lineCloseMSPInstance (HDRVMSPLINE hdMSPLine)
LONG TSPIAPI | TSPI_lineConditionalMediaDetection (HDRVLINE hdLine, DWORD dwMediaModes, LPLINECALLPARAMS const lpCallParams)
LONG TSPIAPI | TSPI_lineCreateMSPInstance (HDRVLINE hdLine, DWORD dwAddressID, HTAPIMSPLINE htMSPLine, LPHDRVMSPLINE phdMSPLine)
LONG TSPIAPI | TSPI_lineDrop (DRV_REQUESTID dwRequestID, HDRVCALL hdCall, LPCSTR lpsUserUserInfo, DWORD dwSize)
LONG TSPIAPI | TSPI_lineGetAddressCaps (DWORD dwDeviceID, DWORD dwAddressID, DWORD dwTSPIVersion, DWORD dwExtVersion, LPLINEADDRESSCAPS lpAddressCaps)
LONG TSPIAPI | TSPI_lineGetAddressStatus (HDRVLINE hdLine, DWORD dwAddressID, LPLINEADDRESSSTATUS lpAddressStatus)
LONG TSPIAPI | TSPI_lineGetCallAddressID (HDRVCALL hdCall, LPDWORD lpdwAddressID)
LONG TSPIAPI | TSPI_lineGetCallInfo (HDRVCALL hdCall, LPLINECALLINFO lpLineInfo)
LONG TSPIAPI | TSPI_lineGetCallStatus (HDRVCALL hdCall, LPLINECALLSTATUS lpLineStatus)
LONG TSPIAPI | TSPI_lineGetDevCaps (DWORD dwDeviceID, DWORD dwTSPIVersion, DWORD dwExtVersion, LPLINEDEVCAPS lpLineDevCaps)
LONG TSPIAPI | TSPI_lineGetID (HDRVLINE hdLine, DWORD dwAddressID, HDRVCALL hdCall, DWORD dwSelect, LPVARSTRING lpDeviceID, LPCWSTR lpszDeviceClass, HANDLE hTargetProcess)
LONG TSPIAPI | TSPI_lineGetLineDevStatus (HDRVLINE hdLine, LPLINEDEVSTATUS lpLineDevStatus)
LONG TSPIAPI | TSPI_lineGetNumAddressIDs (HDRVLINE hdLine, LPDWORD lpdwNumAddressIDs)
LONG TSPIAPI | TSPI_lineMakeCall (DRV_REQUESTID dwRequestID, HDRVLINE hdLine, HTAPICALL htCall, LPHDRVCALL lphdCall, LPCWSTR lpszDestAddress, DWORD dwCountryCode, LPLINECALLPARAMS const lpCallParams)
LONG TSPIAPI | TSPI_lineMSPIdentify (DWORD dwDeviceID, GUID *pCLSID)
LONG TSPIAPI | TSPI_lineNegotiateTSPIVersion (DWORD dwDeviceID, DWORD dwLowVersion, DWORD dwHighVersion, LPDWORD lpdwTSPIVersion)
LONG TSPIAPI | TSPI_lineOpen (DWORD dwDeviceID, HTAPILINE htLine, LPHDRVLINE lphdLine, DWORD dwTSPIVersion, LINEEVENT lpfnEventProc)
LONG TSPIAPI | TSPI_lineReceiveMSPData (HDRVLINE hdLine, HDRVCALL hdCall, HDRVMSPLINE hdMSPLine, LPBYTE pBuffer, DWORD dwSize)
LONG TSPIAPI | TSPI_lineSetDefaultMediaDetection (HDRVLINE hdLine, DWORD dwMediaModes)
LONG TSPIAPI | TSPI_providerConfig (HWND hwndOwner, DWORD dwPermanentProviderID)
LONG TSPIAPI | TSPI_providerEnumDevices (DWORD dwPermanentProviderID, LPDWORD lpdwNumLines, LPDWORD lpdwNumPhones, HPROVIDER hProvider, LINEEVENT lpfnLineCreateProc, PHONEEVENT lpfnPhoneCreateProc)
LONG TSPIAPI | TSPI_providerGenericDialogData (DWORD_PTR dwObjectID, DWORD dwObjectType, LPVOID lpParams, DWORD dwSize)
LONG TSPIAPI | TSPI_providerInit (DWORD dwTSPIVersion, DWORD dwPermanentProviderID, DWORD dwLineDeviceIDBase, DWORD dwPhoneDeviceIDBase, DWORD_PTR dwNumLines, DWORD_PTR dwNumPhones, ASYNC_COMPLETION lpfnCompletionProc, LPDWORD lpdwTSPIOptions)
LONG TSPIAPI | TSPI_providerInstall (HWND hwndOwner, DWORD dwPermanentProviderID)
LONG TSPIAPI | TSPI_providerRemove (HWND hwndOwner, DWORD dwPermanentProviderID)
LONG TSPIAPI | TSPI_providerShutdown (DWORD dwTSPIVersion, DWORD dwPermanentProviderID)
LONG TSPIAPI | TSPI_providerUIIdentify (LPWSTR lpszUIDLLName)
LONG TSPIAPI | TUISPI_lineConfigDialog (TUISPIDLLCALLBACK lpfnUIDLLCallback, DWORD dwDeviceID, HWND hwndOwner, LPCWSTR lpszDeviceClass)
LONG TSPIAPI | TUISPI_providerConfig (TUISPIDLLCALLBACK lpfnUIDLLCallback, HWND hwndOwner, DWORD dwPermanentProviderID)
LONG TSPIAPI | TUISPI_providerInstall (TUISPIDLLCALLBACK lpfnUIDLLCallback, HWND hwndOwner, DWORD dwPermanentProviderID)
LONG TSPIAPI | TUISPI_providerRemove (TUISPIDLLCALLBACK lpfnUIDLLCallback, HWND hwndOwner, DWORD dwPermanentProviderID)

Define Documentation

#define LINECONFIG_SIZE (2 * (MAX_DEV_NAME_LENGTH + 1) + 40)
#define PROVIDER_INFO_SIZE (37 * sizeof (WCHAR))
#define TAPI_CURRENT_VERSION 0x00030000

Definition at line 14 of file Atsp.c.

Function Documentation

void CommThread ( PDRVLINE pLine )

Definition at line 68 of file Atsp.c.

{
    char            buf[4];
    DWORD           dwThreadID = GetCurrentThreadId(), dwNumBytes;
    HANDLE          hComm = pLine->hComm, hEvent;
    LPOVERLAPPED    pOverlapped = &pLine->Overlapped;

    DBGOUT((
        3,
        "CommThread (id=%d): enter, port=%s",
        dwThreadID,
        pLine->szComm
        ));

    hEvent = pOverlapped->hEvent;
    buf[0] = buf[1] = '.';

    //
    // Loop waiting for i/o to complete (either the Write done in
    // TSPI_lineMakeCall or the Reads done to retrieve status info).
    // Note that TSPI_lineDrop or TSPI_lineCloseCall may set the
    // event to alert us that they're tearing down the call, in
    // which case we just exit.
    //

    for (;;)
    {
        if (WaitForSingleObject (hEvent, ATSP_TIMEOUT) == WAIT_OBJECT_0)
        {
            if (pLine->bDropInProgress == TRUE)
            {
                DBGOUT((2, "CommThread (id=%d): drop in progress"));
                goto CommThread_exit;
            }

            GetOverlappedResult (hComm, pOverlapped, &dwNumBytes, FALSE);
            ResetEvent (hEvent);
        }
        else
        {
            DBGOUT((2, "CommThread (id=%d): wait timeout"));
            SetCallState (pLine, LINECALLSTATE_IDLE, 0);
            goto CommThread_exit;
        }

        buf[1] &= 0x7f; // nuke the parity bit

        DBGOUT((
            3,
            "CommThread (id=%d): read '%c'",
            dwThreadID,
            (buf[1] == '\r' ? '.' : buf[1])
            ));

        switch ((buf[0] << 8) + buf[1])
        {
        case 'CT':  // "CONNECT"
        case 'OK':  // "OK"

            SetCallState (pLine, LINECALLSTATE_CONNECTED, 0);
            goto CommThread_exit;

        case 'SY':  // "BUSY"
        case 'OR':  // "ERROR"
        case 'NO':  // "NO ANSWER", "NO DIALTONE", "NO CARRIER"

            SetCallState (pLine, LINECALLSTATE_IDLE, 0);
            goto CommThread_exit;

        default:

            break;
        }

        buf[0] = buf[1];

        ZeroMemory (pOverlapped, sizeof (OVERLAPPED) - sizeof (HANDLE));
        ReadFile (hComm, &buf[1], 1, &dwNumBytes, pOverlapped);
    }

CommThread_exit:

    CloseHandle (hEvent);
    DBGOUT((3, "CommThread (id=%d): exit", dwThreadID));
    ExitThread (0);
}

BOOL CALLBACK ConfigDlgProc | ( | HWND | hwnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 1929 of file Atsp.c.

{
    static  HKEY    hAtspKey;

    DWORD   dwDataSize;
    DWORD   dwDataType;

    switch (msg)
    {
    case WM_INITDIALOG:
    {
        char   *pBuf;
        DWORD   i, iNumLines;

        //
        // Create or open our configuration key in the registry.  If the
        // create fails it may well be that the current user does not
        // have write access to this portion of the registry, so we'll
        // just show a "read only" dialog and not allow user to make any
        // changes
        //

        {
            LONG    lResult;
            DWORD   dwDisposition;

            if ((lResult = RegCreateKeyEx(
                    HKEY_LOCAL_MACHINE,
                    gszAtspKey,
                    0,
                    "",
                    REG_OPTION_NON_VOLATILE,
                    KEY_ALL_ACCESS,
                    (LPSECURITY_ATTRIBUTES) NULL,
                    &hAtspKey,
                    &dwDisposition

                    )) != ERROR_SUCCESS)
            {
                DBGOUT((
                    3,
                    "RegCreateKeyEx(%s,ALL_ACCESS) failed, err=%d",
                    gszAtspKey,
                    lResult
                    ));

                if ((lResult = RegOpenKeyEx(
                        HKEY_LOCAL_MACHINE,
                        gszAtspKey,
                        0,
                        KEY_QUERY_VALUE,
                        &hAtspKey

                        )) != ERROR_SUCCESS)
                {
                    DBGOUT((
                        3,
                        "RegOpenKeyEx(%s,ALL_ACCESS) failed, err=%d",
                        gszAtspKey,
                        lResult
                        ));

                    EndDialog (hwnd, 0);
                    return FALSE;
                }

                {
                    int i;
                    static int aiControlIDs[] =
                    {
                        IDC_NAME,
                        IDC_PORT,
                        IDC_COMMANDS,
                        IDC_ADD,
                        IDC_REMOVE,
                        IDOK,
                        0
                    };

                    for (i = 0; aiControlIDs[i]; i++)
                    {
                        EnableWindow(
                            GetDlgItem (hwnd, aiControlIDs[i]),
                            FALSE
                            );
                    }
                }
            }
        }

        //
        // Retrieve our configuration info from the registry
        //

        dwDataSize = sizeof(iNumLines);
        iNumLines = 0;

        RegQueryValueEx(
            hAtspKey,
            gszNumLines,
            0,
            &dwDataType,
            (LPBYTE) &iNumLines,
            &dwDataSize
            );

        SendDlgItemMessage(
            hwnd,
            IDC_NAME,
            EM_LIMITTEXT,
            MAX_DEV_NAME_LENGTH,
            0
            );

        SendDlgItemMessage(
            hwnd,
            IDC_COMMANDS,
            EM_LIMITTEXT,
            MAX_DEV_NAME_LENGTH,
            0
            );

        if (!(pBuf = DrvAlloc (256)))
          break;

        for (i = 0; i < iNumLines; i++)
        {
            char           *p, *p2, szLineN[8];
            PDRVLINECONFIG  pLineConfig;
            LONG            lResult;

       if (!(pLineConfig = DrvAlloc (sizeof(DRVLINECONFIG))))
        break;

            wsprintf (szLineN, "Line%d", i);

            dwDataSize = 256;

            lResult = RegQueryValueEx(
                hAtspKey,
                szLineN,
                0,
                &dwDataType,
                (LPBYTE) pBuf,
                &dwDataSize
                );

            //
            // If there was a problem, use the default config
            //

            if (0 != lResult)
            {
               strncpy (pBuf, gszDefLineConfigParams, 255);
        pBuf[255] = '\0';
            }

            for (p = pBuf; *p != ','; p++);
            *p = 0;

            SendDlgItemMessage(
                hwnd,
                IDC_DEVICES,
                LB_ADDSTRING,
                0,
                (LPARAM) pBuf
                );

            SendDlgItemMessage(
                hwnd,
                IDC_DEVICES,
                LB_SETITEMDATA,
                i,
                (LPARAM) pLineConfig
                );

            p++;
            for (p2 = p; *p2 != ','; p2++);
            *p2 = 0;

            strncpy (pLineConfig->szPort, p, 7 );
      pLineConfig->szPort[7] = '\0';

            p = p2 + 1;

            strncpy (pLineConfig->szCommands, p,63);
      pLineConfig->szCommands[63] = '\0';
        }

        DrvFree (pBuf);

        //
        // Fill up the various controls with configuration options
        //

        {
            static char *aszPorts[] = { "COM1","COM2","COM3",NULL };

            for (i = 0; aszPorts[i]; i++)
            {
                SendDlgItemMessage(
                    hwnd,
                    IDC_PORT,
                    LB_ADDSTRING,
                    0,
                    (LPARAM) aszPorts[i]
                    );
            }
        }

        if (iNumLines == 0)
        {
            EnableChildren (hwnd, FALSE);
        }
        else
        {
            SelectDevice (hwnd, 0);
        }

        break;
    }
    case WM_COMMAND:
    {
        LRESULT             iSelection;
        PDRVLINECONFIG  pLineConfig;

        iSelection = SendDlgItemMessage(
            hwnd,
            IDC_DEVICES,
            LB_GETCURSEL,
            0,
            0
            );

        pLineConfig = (PDRVLINECONFIG) SendDlgItemMessage(
            hwnd,
            IDC_DEVICES,
            LB_GETITEMDATA,
            (WPARAM) iSelection,
            0
            );

        switch (LOWORD((DWORD)wParam))
        {
        case IDC_DEVICES:

            if (HIWORD(wParam) == LBN_SELCHANGE)
            {
                char buf[MAX_DEV_NAME_LENGTH + 1];

                SendDlgItemMessage(
                    hwnd,
                    IDC_DEVICES,
                    LB_GETTEXT,
                    iSelection,
                    (LPARAM) buf
                    );

                SetDlgItemText (hwnd, IDC_NAME, buf);

                SendDlgItemMessage(
                    hwnd,
                    IDC_PORT,
                    LB_SELECTSTRING,
                    (WPARAM) -1,
                    (LPARAM) pLineConfig->szPort
                    );

                SetDlgItemText (hwnd, IDC_COMMANDS, pLineConfig->szCommands);
            }

            break;

        case IDC_NAME:

            if ((HIWORD(wParam) == EN_CHANGE) && (iSelection != LB_ERR))
            {
                char    buf[MAX_DEV_NAME_LENGTH + 1];

                GetDlgItemText (hwnd, IDC_NAME, buf, MAX_DEV_NAME_LENGTH);

                SendDlgItemMessage(
                    hwnd,
                    IDC_DEVICES,
                    LB_DELETESTRING,
                    iSelection,
                    0
                    );

                SendDlgItemMessage(
                    hwnd,
                    IDC_DEVICES,
                    LB_INSERTSTRING,
                    iSelection,
                    (LPARAM) buf
                    );

                SendDlgItemMessage(
                    hwnd,
                    IDC_DEVICES,
                    LB_SETCURSEL,
                    iSelection,
                    0
                    );

                SendDlgItemMessage(
                    hwnd,
                    IDC_DEVICES,
                    LB_SETITEMDATA,
                    iSelection,
                    (LPARAM) pLineConfig
                    );
            }

            break;

        case IDC_PORT:

            if (HIWORD(wParam) == LBN_SELCHANGE)
            {
                iSelection = SendDlgItemMessage(
                    hwnd,
                    IDC_PORT,
                    LB_GETCURSEL,
                    0,
                    0
                    );

                SendDlgItemMessage(
                    hwnd,
                    IDC_PORT,
                    LB_GETTEXT,
                    iSelection,
                    (LPARAM) pLineConfig->szPort
                    );
            }

            break;

        case IDC_COMMANDS:

            if ((HIWORD(wParam) == EN_CHANGE) && (iSelection != LB_ERR))
            {
                GetDlgItemText(
                    hwnd,
                    IDC_COMMANDS,
                    pLineConfig->szCommands,
                    63
                    );
            }

            break;

        case IDC_ADD:
        {
            LRESULT             iNumLines;
      int       i = 2;
            char            szLineName[32];
            PDRVLINECONFIG  pLineConfig;

            if(!(pLineConfig = DrvAlloc (sizeof(DRVLINECONFIG))))
              break;

            iNumLines = SendDlgItemMessage(
                hwnd,
                IDC_DEVICES,
                LB_GETCOUNT,
                0,
                0
                );

            strncpy (pLineConfig->szPort, "COM1", 7);
      pLineConfig->szPort[7] = '\0';

            strncpy (szLineName, "my new line",31 );
      szLineName[31] = '\0';

find_unique_line_name:

            if (SendDlgItemMessage(
                    hwnd,
                    IDC_DEVICES,
                    LB_FINDSTRING,
                    (WPARAM) -1,
                    (LPARAM) szLineName

                    ) != LB_ERR)
            {
                wsprintf (szLineName, "my new line%d", i++);
                goto find_unique_line_name;
            }

            SendDlgItemMessage(
                hwnd,
                IDC_DEVICES,
                LB_ADDSTRING,
                0,
                (LPARAM) szLineName
                );

            SendDlgItemMessage(
                hwnd,
                IDC_DEVICES,
                LB_SETITEMDATA,
                iNumLines,
                (LPARAM) pLineConfig
                );

            EnableChildren (hwnd, TRUE);

            SelectDevice (hwnd, iNumLines);

            SetFocus (GetDlgItem (hwnd, IDC_NAME));

            SendDlgItemMessage(
                hwnd,
                IDC_NAME,
                EM_SETSEL,
                0,
                (LPARAM) -1
                );

            break;
        }
        case IDC_REMOVE:
        {
            LRESULT iNumLines;

            DrvFree (pLineConfig);

            iNumLines = SendDlgItemMessage(
                hwnd,
                IDC_DEVICES,
                LB_DELETESTRING,
                iSelection,
                0
                );

            if (iNumLines == 0)
            {
                SetDlgItemText (hwnd, IDC_NAME, "");
                SetDlgItemText (hwnd, IDC_COMMANDS, "");

                EnableChildren (hwnd, FALSE);
            }
            else
            {
                SelectDevice (hwnd, 0);
            }

            break;
        }
        case IDOK:
        {
            int     i;
      LRESULT iNumLines;
            char   *pBuf;

            //
            // Update the num lines & num phones values
            //

            if (!(pBuf = DrvAlloc (256)))
              break;

            iNumLines = SendDlgItemMessage(
                hwnd,
                IDC_DEVICES,
                LB_GETCOUNT,
                0,
                0
                );

            RegSetValueEx(
                hAtspKey,
                gszNumLines,
                0,
                REG_DWORD,
                (LPBYTE) &iNumLines,
                sizeof(DWORD)
                );

            //
            // For each installed device save it's config info
            //

            for (i = 0; i < iNumLines; i++)
            {
                char szLineN[8];
                PDRVLINECONFIG pLineConfig;

                SendDlgItemMessage(
                    hwnd,
                    IDC_DEVICES,
                    LB_GETTEXT,
                    i,
                    (LPARAM) pBuf
                    );

                pLineConfig = (PDRVLINECONFIG) SendDlgItemMessage(
                    hwnd,
                    IDC_DEVICES,
                    LB_GETITEMDATA,
                    i,
                    0
                    );

                wsprintf(
                    pBuf + strlen (pBuf),
                    ",%s,%s",
                    pLineConfig->szPort,
                    pLineConfig->szCommands
                    );

                wsprintf (szLineN, "Line%d", i);

                RegSetValueEx(
                    hAtspKey,
                    szLineN,
                    0,
                    REG_SZ,
                    (LPBYTE) pBuf,
                    lstrlen (pBuf) + 1
                    );

                DrvFree (pLineConfig);
            }

            DrvFree (pBuf);

            // fall thru to EndDialog...
        }
        case IDCANCEL:

            RegCloseKey (hAtspKey);
            EndDialog (hwnd, 0);
            break;

        } // switch (LOWORD((DWORD)wParam))

        break;
    }
    } // switch (msg)

    return FALSE;
}

BOOL WINAPI DllMain | ( | HANDLE | hDLL,
 |  | DWORD | dwReason,
 |  | LPVOID | lpReserved
 | ) |  |

Definition at line 20 of file Atsp.c.

{
    if (dwReason ==  DLL_PROCESS_ATTACH)
    {
        ghInst = hDLL;

#if DBG
        {
            HKEY    hKey;
            DWORD   dwDataSize, dwDataType;
            char    szAtsp32DebugLevel[] = "Atsp32DebugLevel";

            RegOpenKeyExA(
                HKEY_LOCAL_MACHINE,
                gszAtspKey,
                0,
                KEY_ALL_ACCESS,
                &hKey
                );

            dwDataSize = sizeof (DWORD);
            gdwDebugLevel=0;

            RegQueryValueEx(
                hKey,
                szAtsp32DebugLevel,
                0,
                &dwDataType,
                (LPBYTE) &gdwDebugLevel,
                &dwDataSize
                );

            RegCloseKey (hKey);
        }
#endif

    }

    return TRUE;
}

void PASCAL DropActiveCall ( PDRVLINE pLine )

Definition at line 2797 of file Atsp.c.

{
    if (pLine->hComm)
    {
        DWORD       dwNumBytes, dwError;
        OVERLAPPED  overlapped;

        pLine->bDropInProgress = TRUE;

        SetEvent (pLine->Overlapped.hEvent);

        ZeroMemory (&overlapped, sizeof (OVERLAPPED));

        overlapped.hEvent = CreateEvent (NULL, TRUE, FALSE, NULL);

        if (pLine->dwMediaMode != LINEMEDIAMODE_INTERACTIVEVOICE)
        {
            if (!WriteFile(
                    pLine->hComm,
                    "+++\r", 4,
                    &dwNumBytes,
                    &overlapped
                    ))
            {
                if ((dwError = GetLastError()) == ERROR_IO_PENDING)
                {
                    GetOverlappedResult(
                        pLine->hComm,
                        &overlapped,
                        &dwNumBytes,
                        TRUE
                        );

                    ResetEvent (overlapped.hEvent);
                }
                else
                {
                }
            }
        }

        if (!WriteFile (pLine->hComm, "ATH\r", 4, &dwNumBytes, &overlapped))
        {
            if ((dwError = GetLastError()) == ERROR_IO_PENDING)
            {
                GetOverlappedResult(
                    pLine->hComm,
                    &overlapped,
                    &dwNumBytes,
                    TRUE
                    );
            }
            else
            {
            }
        }

        CloseHandle (overlapped.hEvent);
        CloseHandle (pLine->hComm);
        pLine->hComm = NULL;
    }
}

LPVOID PASCAL DrvAlloc ( DWORD dwSize )

Definition at line 2499 of file Atsp.c.

{
    return (LocalAlloc (LPTR, dwSize));
}

VOID PASCAL DrvFree ( LPVOID lp )

Definition at line 2509 of file Atsp.c.

{
    LocalFree (lp);
}

void PASCAL EnableChildren | ( | HWND | hwnd,
 |  | BOOL | bEnable
 | ) |  |

Definition at line 1891 of file Atsp.c.

{
    int i;
    static int aiControlIDs[] =
    {
        IDC_DEVICES,
        IDC_NAME,
        IDC_PORT,
        IDC_COMMANDS,
        IDC_REMOVE,
        0
    };

    for (i = 0; aiControlIDs[i]; i++)
    {
        EnableWindow (GetDlgItem (hwnd, aiControlIDs[i]), bEnable);
    }
}

LPWSTR PASCAL My_lstrcpyW | ( | WCHAR * | pString1,
 |  | WCHAR * | pString2
 | ) |  |

Definition at line 1876 of file Atsp.c.

{
    WCHAR *p = pString1;

    for (; (*p = *pString2); p++, pString2++);
    return pString1;
}

LONG PASCAL ProviderInstall | ( | char * | pszProviderName,
 |  | BOOL | bNoMultipleInstance
 | ) |  |

Definition at line 2629 of file Atsp.c.

{
    LONG    lResult;

    //
    // If only one installation instance of this provider is
    // allowed then we want to check the provider list to see
    // if the provider is already installed
    //

    if (bNoMultipleInstance)
    {
        LONG                (WINAPI *pfnGetProviderList)();
        DWORD               dwTotalSize, i;
        HINSTANCE           hTapi32;
        LPLINEPROVIDERLIST  pProviderList;
        LPLINEPROVIDERENTRY pProviderEntry;

        //
        // Load Tapi32.dll & get a pointer to the lineGetProviderList
        // func.  We don't want to statically link because this module
        // plays the part of both core SP & UI DLL, and we don't want
        // to incur the performance hit of automatically loading
        // Tapi32.dll when running as a core SP within Tapisrv.exe's
        // context.
        //

        if (!(hTapi32 = LoadLibrary ("tapi32.dll")))
        {
            DBGOUT((
                1,
                "LoadLibrary(tapi32.dll) failed, err=%d",
                GetLastError()
                ));

            lResult = LINEERR_OPERATIONFAILED;
            goto ProviderInstall_return;
        }

        if (!(pfnGetProviderList = (LONG (WINAPI *)())GetProcAddress(
                hTapi32,
                (LPCSTR) "lineGetProviderList"
                )))
        {
            DBGOUT((
                1,
                "GetProcAddr(lineGetProviderList) failed, err=%d",
                GetLastError()
                ));

            lResult = LINEERR_OPERATIONFAILED;
            goto ProviderInstall_unloadTapi32;
        }

        //
        // Loop until we get the full provider list
        //

        dwTotalSize = sizeof (LINEPROVIDERLIST);

        goto ProviderInstall_allocProviderList;

ProviderInstall_getProviderList:

        if ((lResult = (*pfnGetProviderList)(0x00020000, pProviderList)) != 0)
        {
            goto ProviderInstall_freeProviderList;
        }

        if (pProviderList->dwNeededSize > pProviderList->dwTotalSize)
        {
            dwTotalSize = pProviderList->dwNeededSize;

            LocalFree (pProviderList);

ProviderInstall_allocProviderList:

            if (!(pProviderList = LocalAlloc (LPTR, dwTotalSize)))
            {
                lResult = LINEERR_NOMEM;
                goto ProviderInstall_unloadTapi32;
            }

            pProviderList->dwTotalSize = dwTotalSize;

            goto ProviderInstall_getProviderList;
        }

        //
        // Inspect the provider list entries to see if this provider
        // is already installed
        //

        pProviderEntry = (LPLINEPROVIDERENTRY) (((LPBYTE) pProviderList) +
            pProviderList->dwProviderListOffset);

        for (i = 0; i < pProviderList->dwNumProviders; i++)
        {
            char   *pszInstalledProviderName = ((char *) pProviderList) +
                        pProviderEntry->dwProviderFilenameOffset,
                   *p;

            //
            // Make sure pszInstalledProviderName points at <filename>
            // and not <path>\filename by walking backeards thru the
            // string searching for last '\\'
            //

            p = pszInstalledProviderName +
                lstrlen (pszInstalledProviderName) - 1;

            for (; *p != '\\'  &&  p != pszInstalledProviderName; p--);

            pszInstalledProviderName =
                (p == pszInstalledProviderName ? p : p + 1);

            if (lstrcmpiA (pszInstalledProviderName, pszProviderName) == 0)
            {
                lResult = LINEERR_NOMULTIPLEINSTANCE;
                goto ProviderInstall_freeProviderList;
            }

            pProviderEntry++;
        }

        //
        // If here then the provider isn't currently installed,
        // so do whatever configuration stuff is necessary and
        // indicate SUCCESS
        //

        lResult = 0;

ProviderInstall_freeProviderList:

        LocalFree (pProviderList);

ProviderInstall_unloadTapi32:

        FreeLibrary (hTapi32);
    }
    else
    {
        //
        // Do whatever configuration stuff is necessary and return SUCCESS
        //

        lResult = 0;
    }

ProviderInstall_return:

    return lResult;
}

void PASCAL SelectDevice | ( | HWND | hwnd,
 |  | LRESULT | iDevice
 | ) |  |

Definition at line 1917 of file Atsp.c.

{
    SendDlgItemMessage (hwnd, IDC_DEVICES, LB_SETCURSEL, iDevice, 0);
    PostMessage(hwnd, WM_COMMAND, IDC_DEVICES | (LBN_SELCHANGE << 16), 0);
}

void PASCAL SetCallState | ( | PDRVLINE | pLine,
 |  | DWORD | dwCallState,
 |  | DWORD | dwCallStateMode
 | ) |  |

Definition at line 2519 of file Atsp.c.

{
    if (dwCallState != pLine->dwCallState)
    {
        pLine->dwCallState     = dwCallState;
        pLine->dwCallStateMode = dwCallStateMode;

        (*pLine->pfnEventProc)(
            pLine->htLine,
            pLine->htCall,
            LINE_CALLSTATE,
            dwCallState,
            dwCallStateMode,
            pLine->dwMediaMode
            );
    }
}

LONG TSPIAPI TSPI_lineClose ( HDRVLINE hdLine )

Definition at line 346 of file Atsp.c.

{
    LONG        lResult = 0;
#if DBG
    FUNC_PARAM  params[] =
    {
        { gszhdLine, hdLine }
    };
    FUNC_INFO   info =
    {
        "TSPI_lineClose",
        1,
        params,
    };
#endif

    Prolog (&info);
    DrvFree ((PDRVLINE) hdLine);
    return (Epilog (&info, lResult));
}

LONG TSPIAPI TSPI_lineCloseCall ( HDRVCALL hdCall )

Definition at line 372 of file Atsp.c.

{
    PDRVLINE    pLine = (PDRVLINE) hdCall;
#if DBG
    FUNC_PARAM  params[] =
    {
        { gszhdCall, hdCall  }
    };
    FUNC_INFO   info =
    {
        "TSPI_lineCloseCall",
        1,
        params
    };
#endif

    //
    // Note that in TAPI 2.0 TSPI_lineCloseCall can get called
    // without TSPI_lineDrop ever being called, so we need to
    // be prepared for either case.
    //

    Prolog (&info);
    DropActiveCall (pLine);
    pLine->htCall = NULL;
    return (Epilog (&info, 0));
}

LONG TSPIAPI TSPI_lineCloseMSPInstance ( HDRVMSPLINE hdMSPLine )

Definition at line 308 of file Atsp.c.

{
   LONG  lResult = 0;

#if DBG
    FUNC_PARAM  params[] =
    {
        { "hdMSPLine", hdMSPLine}
    };

    FUNC_INFO   info =
    {
        "TSPI_lineCloseMSPInstance",
        1,
        params
    };

#endif

    Prolog (&info);

  //
  // no - op there is no information stored with the
  // msp so we dont need to free anything or remove anything
  //

    return (Epilog (&info, lResult));

}

LONG TSPIAPI TSPI_lineConditionalMediaDetection | ( | HDRVLINE | hdLine,
 |  | DWORD | dwMediaModes,
 |  | LPLINECALLPARAMS const | lpCallParams
 | ) |  |

Definition at line 406 of file Atsp.c.

{
#if DBG
    FUNC_PARAM  params[] =
    {
        { gszhdLine,        hdLine       },
        { "dwMediaModes",   dwMediaModes },
        { gszlpCallParams,  lpCallParams }
    };
    FUNC_INFO   info =
    {
        "TSPI_lineConditionalMediaDetection",
        3,
        params
    };
#endif

    //
    // This func is really a no-op for us, since we don't look
    // for incoming calls (though we do say we support them to
    // make apps happy)
    //

    Prolog (&info);
    return (Epilog (&info, 0));
}

LONG TSPIAPI TSPI_lineCreateMSPInstance | ( | HDRVLINE | hdLine,
 |  | DWORD | dwAddressID,
 |  | HTAPIMSPLINE | htMSPLine,
 |  | LPHDRVMSPLINE | phdMSPLine
 | ) |  |

Definition at line 257 of file Atsp.c.

{
    LONG    lResult = 0;
  PDRVLINE    pLine   = (PDRVLINE) hdLine;

#if DBG
    FUNC_PARAM  params[] =
    {
        { gszhdLine,      hdLine},
        { "dwAddressID",  dwAddressID },
        { "htMSPLine",    htMSPLine  }
    };
    FUNC_INFO   info =
    {
        "TSPI_lineCreateMSPInstance",
        3,
        params
    };

#endif

    Prolog (&info);

  //
  // we save the TAPI MSP handle as a member value
  // in the line in order to be able to send MSP messages
  // with the line/client identification to TAPISRV.
  // tapisrv identifies the client with the call handle and or the
  // MSP handle.. both cannot be ambiguous.
  //

  pLine->htMSPLineHandle = htMSPLine;

  //
  // we fake a TTSP handle for TAPI we are not keeping track of this
  //

  *phdMSPLine = 0;

  return (Epilog (&info, lResult));

}

LONG TSPIAPI TSPI_lineDrop | ( | DRV_REQUESTID | dwRequestID,
 |  | HDRVCALL | hdCall,
 |  | LPCSTR | lpsUserUserInfo,
 |  | DWORD | dwSize
 | ) |  |

Definition at line 441 of file Atsp.c.

{
    PDRVLINE    pLine = (PDRVLINE) hdCall;
#if DBG
    FUNC_PARAM  params[] =
    {
        { gszdwRequestID,        dwRequestID     },
        { gszhdCall,             hdCall          },
        { "lpsUserUserInfo",    lpsUserUserInfo },
        { gszdwSize,             dwSize          }
    };
    FUNC_INFO   info =
    {
        "TSPI_lineDrop",
        4,
        params
    };
#endif

    Prolog (&info);
    DropActiveCall (pLine);
    SetCallState (pLine, LINECALLSTATE_IDLE, 0);
    (*gpfnCompletionProc)(dwRequestID, 0);
    return (Epilog (&info, dwRequestID));
}

LONG TSPIAPI TSPI_lineGetAddressCaps | ( | DWORD | dwDeviceID,
 |  | DWORD | dwAddressID,
 |  | DWORD | dwTSPIVersion,
 |  | DWORD | dwExtVersion,
 |  | LPLINEADDRESSCAPS | lpAddressCaps
 | ) |  |

Definition at line 476 of file Atsp.c.

{

#if DBG
    FUNC_PARAM  params[] =
    {
        { gszdwDeviceID,     dwDeviceID      },
        { "dwAddressID",    dwAddressID     },
        { "dwTSPIVersion",  dwTSPIVersion   },
        { "dwExtVersion",   dwExtVersion    },
        { "lpAddressCaps",  lpAddressCaps   }
    };
    FUNC_INFO   info =
    {
        "TSPI_lineGetAddressCaps",
        5,
        params
    };
#endif

    LONG        lResult = 0;

    Prolog (&info);

    if (dwAddressID != 0)
    {
        lResult = LINEERR_INVALADDRESSID;
    }

    lpAddressCaps->dwNeededSize =
    lpAddressCaps->dwUsedSize   = sizeof(LINEADDRESSCAPS);

    lpAddressCaps->dwLineDeviceID       = dwDeviceID;
    lpAddressCaps->dwAddressSharing     = LINEADDRESSSHARING_PRIVATE;
    lpAddressCaps->dwCallInfoStates     = LINECALLINFOSTATE_MEDIAMODE |
                                          LINECALLINFOSTATE_APPSPECIFIC;
    lpAddressCaps->dwCallerIDFlags      =
    lpAddressCaps->dwCalledIDFlags      =
    lpAddressCaps->dwRedirectionIDFlags =
    lpAddressCaps->dwRedirectingIDFlags = LINECALLPARTYID_UNAVAIL;
    lpAddressCaps->dwCallStates         = LINECALLSTATE_IDLE |
                                          LINECALLSTATE_OFFERING |
                                          LINECALLSTATE_ACCEPTED |
                                          LINECALLSTATE_DIALTONE |
                                          LINECALLSTATE_DIALING |
                                          LINECALLSTATE_CONNECTED |
                                          LINECALLSTATE_PROCEEDING |
                                          LINECALLSTATE_DISCONNECTED |
                                          LINECALLSTATE_UNKNOWN;
    lpAddressCaps->dwDialToneModes      = LINEDIALTONEMODE_UNAVAIL;
    lpAddressCaps->dwBusyModes          = LINEBUSYMODE_UNAVAIL;
    lpAddressCaps->dwSpecialInfo        = LINESPECIALINFO_UNAVAIL;
    lpAddressCaps->dwDisconnectModes    = LINEDISCONNECTMODE_NORMAL |
                                          LINEDISCONNECTMODE_BUSY |
                                          LINEDISCONNECTMODE_NOANSWER |
                                          LINEDISCONNECTMODE_UNAVAIL |
                                          LINEDISCONNECTMODE_NODIALTONE;
    lpAddressCaps->dwMaxNumActiveCalls  = 1;
    lpAddressCaps->dwAddrCapFlags       = LINEADDRCAPFLAGS_DIALED;
    lpAddressCaps->dwCallFeatures       = LINECALLFEATURE_ACCEPT |
                                          LINECALLFEATURE_ANSWER |
                                          LINECALLFEATURE_DROP |
                                          LINECALLFEATURE_SETCALLPARAMS;
    lpAddressCaps->dwAddressFeatures    = LINEADDRFEATURE_MAKECALL;

    return (Epilog (&info, lResult));
}

LONG TSPIAPI TSPI_lineGetAddressStatus | ( | HDRVLINE | hdLine,
 |  | DWORD | dwAddressID,
 |  | LPLINEADDRESSSTATUS | lpAddressStatus
 | ) |  |

Definition at line 554 of file Atsp.c.

{
#if DBG
    FUNC_PARAM  params[] =
    {
        { gszhdLine,             hdLine         },
        { "dwAddressID",        dwAddressID     },
        { "lpAddressStatus",    lpAddressStatus }
    };
    FUNC_INFO   info =
    {
        "TSPI_lineGetAddressStatus",
        3,
        params
    };
#endif

    LONG        lResult = 0;
    PDRVLINE    pLine = (PDRVLINE) hdLine;

    Prolog (&info);

    lpAddressStatus->dwNeededSize =
    lpAddressStatus->dwUsedSize   = sizeof(LINEADDRESSSTATUS);

    lpAddressStatus->dwNumActiveCalls  = (pLine->htCall ? 1 : 0);
    lpAddressStatus->dwAddressFeatures = LINEADDRFEATURE_MAKECALL;

    return (Epilog (&info, lResult));
}

LONG TSPIAPI TSPI_lineGetCallAddressID | ( | HDRVCALL | hdCall,
 |  | LPDWORD | lpdwAddressID
 | ) |  |

Definition at line 593 of file Atsp.c.

{
#if DBG
    FUNC_PARAM  params[] =
    {
        { gszhdCall,        hdCall          },
        { "lpdwAddressID",  lpdwAddressID   }
    };
    FUNC_INFO   info =
    {
        "TSPI_lineGetCallAddressID",
        2,
        params
    };
#endif

    //
    // We only support 1 address (id=0)
    //

    Prolog (&info);
    *lpdwAddressID = 0;
    return (Epilog (&info, 0));
}

LONG TSPIAPI TSPI_lineGetCallInfo | ( | HDRVCALL | hdCall,
 |  | LPLINECALLINFO | lpLineInfo
 | ) |  |

Definition at line 625 of file Atsp.c.

{
#if DBG
    FUNC_PARAM  params[] =
    {
        { gszhdCall,     hdCall      },
        { "lpLineInfo", lpLineInfo  }
    };
    FUNC_INFO   info =
    {
        "TSPI_lineGetCallInfo",
        2,
        params
    };
#endif
    LONG        lResult = 0;
    PDRVLINE    pLine = (PDRVLINE) hdCall;

    Prolog (&info);

    lpLineInfo->dwNeededSize =
    lpLineInfo->dwUsedSize   = sizeof(LINECALLINFO);

    lpLineInfo->dwBearerMode         = LINEBEARERMODE_VOICE;
    lpLineInfo->dwMediaMode          = pLine->dwMediaMode;
    lpLineInfo->dwCallStates         = LINECALLSTATE_IDLE |
                                       LINECALLSTATE_DIALTONE |
                                       LINECALLSTATE_DIALING |
                                       LINECALLSTATE_CONNECTED |
                                       LINECALLSTATE_PROCEEDING |
                                       LINECALLSTATE_DISCONNECTED |
                                       LINECALLSTATE_UNKNOWN;
    lpLineInfo->dwOrigin             = LINECALLORIGIN_OUTBOUND;
    lpLineInfo->dwReason             = LINECALLREASON_DIRECT;
    lpLineInfo->dwCallerIDFlags      =
    lpLineInfo->dwCalledIDFlags      =
    lpLineInfo->dwConnectedIDFlags   =
    lpLineInfo->dwRedirectionIDFlags =
    lpLineInfo->dwRedirectingIDFlags = LINECALLPARTYID_UNAVAIL;

    return (Epilog (&info, lResult));
}

LONG TSPIAPI TSPI_lineGetCallStatus | ( | HDRVCALL | hdCall,
 |  | LPLINECALLSTATUS | lpLineStatus
 | ) |  |

Definition at line 675 of file Atsp.c.

{
#if DBG
    FUNC_PARAM  params[] =
    {
        { gszhdCall,         hdCall          },
        { "lpLineStatus",   lpLineStatus    }
    };
    FUNC_INFO   info =
    {
        "TSPI_lineGetCallStatus",
        2,
        params
    };
#endif
    LONG        lResult = 0;
    PDRVLINE    pLine = (PDRVLINE) hdCall;

    Prolog (&info);

    lpLineStatus->dwNeededSize =
    lpLineStatus->dwUsedSize   = sizeof(LINECALLSTATUS);

    lpLineStatus->dwCallState  = pLine->dwCallState;

    if (pLine->dwCallState != LINECALLSTATE_IDLE)
    {
        lpLineStatus->dwCallFeatures = LINECALLFEATURE_DROP;
    }

    return (Epilog (&info, lResult));
}

LONG TSPIAPI TSPI_lineGetDevCaps | ( | DWORD | dwDeviceID,
 |  | DWORD | dwTSPIVersion,
 |  | DWORD | dwExtVersion,
 |  | LPLINEDEVCAPS | lpLineDevCaps
 | ) |  |

Definition at line 715 of file Atsp.c.

{
#if DBG
    FUNC_PARAM  params[] =
    {
        { gszdwDeviceID,     dwDeviceID      },
        { "dwTSPIVersion",  dwTSPIVersion   },
        { "dwExtVersion",   dwExtVersion    },
        { "lpLineDevCaps",  lpLineDevCaps   }
    };
    FUNC_INFO   info =
    {
        "TSPI_lineGetDevCaps",
        4,
        params
    };
#endif

    LONG            lResult = 0;
    static WCHAR    szProviderInfo[] = L"AT-compatible modem service provider";

    #define PROVIDER_INFO_SIZE (37 * sizeof (WCHAR))

    Prolog (&info);

    lpLineDevCaps->dwNeededSize = sizeof (LINEDEVCAPS) + PROVIDER_INFO_SIZE +
        (MAX_DEV_NAME_LENGTH + 1) * sizeof (WCHAR);

    if (lpLineDevCaps->dwTotalSize >= lpLineDevCaps->dwNeededSize)
    {
        #define LINECONFIG_SIZE   (2 * (MAX_DEV_NAME_LENGTH + 1) + 40)

        char    szLineConfig[LINECONFIG_SIZE], szLineN[16], *p;
        HKEY    hKey;
        DWORD   dwDataSize, dwDataType;

        lpLineDevCaps->dwUsedSize = lpLineDevCaps->dwNeededSize;

        lpLineDevCaps->dwProviderInfoSize   = PROVIDER_INFO_SIZE;
        lpLineDevCaps->dwProviderInfoOffset = sizeof(LINEDEVCAPS);

        My_lstrcpyW ((WCHAR *)(lpLineDevCaps + 1), szProviderInfo);

        RegOpenKeyEx(
            HKEY_LOCAL_MACHINE,
            gszAtspKey,
            0,
            KEY_ALL_ACCESS,
            &hKey
            );

        dwDataSize = LINECONFIG_SIZE;
        wsprintf (szLineN, "Line%d", dwDeviceID - gdwLineDeviceIDBase);
        strncpy (szLineConfig, gszDefLineConfigParams, LINECONFIG_SIZE-1);
    szLineConfig[LINECONFIG_SIZE-1] = '\0';

        RegQueryValueEx(
            hKey,
            szLineN,
            0,
            &dwDataType,
            (LPBYTE) szLineConfig,
            &dwDataSize
            );

        RegCloseKey (hKey);

        for (p = szLineConfig; *p != ','; p++);
        *p = 0;

        lpLineDevCaps->dwLineNameSize   = (lstrlen (szLineConfig) + 1) *
            sizeof (WCHAR);
        lpLineDevCaps->dwLineNameOffset = sizeof(LINEDEVCAPS) +
            PROVIDER_INFO_SIZE;

        MultiByteToWideChar(
            CP_ACP,
            MB_PRECOMPOSED,
            szLineConfig,
            -1,
            (WCHAR *) ((LPBYTE) (lpLineDevCaps + 1) + PROVIDER_INFO_SIZE),
            (lpLineDevCaps->dwLineNameSize)/sizeof(WCHAR)
            );
    }
    else
    {
        lpLineDevCaps->dwUsedSize = sizeof(LINEDEVCAPS);
    }

    lpLineDevCaps->dwStringFormat      = STRINGFORMAT_ASCII;
    lpLineDevCaps->dwAddressModes      = LINEADDRESSMODE_ADDRESSID;
    lpLineDevCaps->dwNumAddresses      = 1;
    lpLineDevCaps->dwBearerModes       = LINEBEARERMODE_VOICE;
    lpLineDevCaps->dwMaxRate           = 9600;
    lpLineDevCaps->dwMediaModes        = LINEMEDIAMODE_INTERACTIVEVOICE |
                                         LINEMEDIAMODE_DATAMODEM;

  //
  // Specify  LINEDEVCAPFLAGS_MSP so tapi knows to call lineMSPIdentify for
  // the MSP CLSID. Note: version must be 3.0 or higher
  //

    lpLineDevCaps->dwDevCapFlags       = LINEDEVCAPFLAGS_CLOSEDROP |
                                         LINEDEVCAPFLAGS_DIALBILLING |
                                         LINEDEVCAPFLAGS_DIALQUIET |
                                         LINEDEVCAPFLAGS_DIALDIALTONE |
                     LINEDEVCAPFLAGS_MSP;

  lpLineDevCaps->dwAddressTypes    =  LINEADDRESSTYPE_PHONENUMBER;

    lpLineDevCaps->dwMaxNumActiveCalls = 1;
    lpLineDevCaps->dwRingModes         = 1;
    lpLineDevCaps->dwLineFeatures      = LINEFEATURE_MAKECALL;

    return (Epilog (&info, lResult));
}

LONG TSPIAPI TSPI_lineGetID | ( | HDRVLINE | hdLine,
 |  | DWORD | dwAddressID,
 |  | HDRVCALL | hdCall,
 |  | DWORD | dwSelect,
 |  | LPVARSTRING | lpDeviceID,
 |  | LPCWSTR | lpszDeviceClass,
 |  | HANDLE | hTargetProcess
 | ) |  |

Definition at line 842 of file Atsp.c.

{
#if DBG
    FUNC_PARAM  params[] =
    {
        { gszhdLine,             hdLine          },
        { "dwAddressID",        dwAddressID     },
        { gszhdCall,             hdCall          },
        { "dwSelect",           dwSelect        },
        { "lpDeviceID",         lpDeviceID      },
        { "lpszDeviceClass",    lpszDeviceClass },
        { "hTargetProcess",     hTargetProcess  }
    };
    FUNC_INFO   info =
    {
        "TSPI_lineGetID",
        7,
        params
    };
#endif

    DWORD       dwNeededSize = sizeof(VARSTRING) + sizeof (DWORD);
    LONG        lResult = 0;
    PDRVLINE    pLine = (dwSelect == LINECALLSELECT_CALL ?
                    (PDRVLINE) hdCall : (PDRVLINE) hdLine);

    Prolog (&info);

    if (lstrcmpiW (lpszDeviceClass, L"tapi/line") == 0)
    {
        if (lpDeviceID->dwTotalSize < dwNeededSize)
        {
            lpDeviceID->dwUsedSize = 3*sizeof(DWORD);
        }
        else
        {
            lpDeviceID->dwUsedSize = dwNeededSize;

            lpDeviceID->dwStringFormat = STRINGFORMAT_BINARY;
            lpDeviceID->dwStringSize   = sizeof(DWORD);
            lpDeviceID->dwStringOffset = sizeof(VARSTRING);

            *((LPDWORD)(lpDeviceID + 1)) = pLine->dwDeviceID;
        }

        lpDeviceID->dwNeededSize = dwNeededSize;
    }
    else if (lstrcmpiW (lpszDeviceClass, L"comm/datamodem") == 0)
    {
#ifdef _WIN64
        dwNeededSize += ((DWORD)strlen(pLine->szComm) + 1) * sizeof (WCHAR);
#else
        dwNeededSize += (strlen (pLine->szComm) + 1) * sizeof (WCHAR);
#endif

        if (lpDeviceID->dwTotalSize < dwNeededSize)
        {
            lpDeviceID->dwUsedSize = 3 * sizeof(DWORD);
        }
        else
        {
            HANDLE hCommDup = NULL;

            if (!pLine->htCall)
            {
                DBGOUT((1, "TSPI_lineGetID32: error, no active call"));

                lResult = LINEERR_OPERATIONFAILED;

                goto TSPI_lineGetID_epilog;
            }

            if (!DuplicateHandle(
                    GetCurrentProcess(),
                    pLine->hComm,
                    hTargetProcess,
                    &hCommDup,
                    0,
                    TRUE,
                    DUPLICATE_SAME_ACCESS
                    ))
            {
                DBGOUT((
                    1,
                    "TSPI_lineGetID: DupHandle failed, err=%ld",
                    GetLastError()
                    ));

                lResult = LINEERR_OPERATIONFAILED;

                goto TSPI_lineGetID_epilog;
            }

            lpDeviceID->dwUsedSize = dwNeededSize;

            lpDeviceID->dwStringFormat = STRINGFORMAT_BINARY;
            lpDeviceID->dwStringSize   = dwNeededSize - sizeof(VARSTRING);
            lpDeviceID->dwStringOffset = sizeof(VARSTRING);

            *((HANDLE *)(lpDeviceID + 1)) = hCommDup;

            strncpy(
                ((char *)(lpDeviceID + 1)) + sizeof (HANDLE),
                pLine->szComm,
        lpDeviceID->dwTotalSize - sizeof(VARSTRING) -sizeof(HANDLE)
                );
        *(char * ) (lpDeviceID + lpDeviceID->dwTotalSize-1) = '\0';

            MultiByteToWideChar(
                CP_ACP,
                0,
                pLine->szComm,
                -1,
                ((WCHAR *)(lpDeviceID + 1)) + sizeof (HANDLE),
                (lpDeviceID->dwTotalSize - sizeof(VARSTRING) -sizeof(HANDLE))/sizeof(WCHAR)
                );
        }

        lpDeviceID->dwNeededSize = dwNeededSize;
    }
    else
    {
        lResult = LINEERR_NODEVICE;
    }

TSPI_lineGetID_epilog:

    return (Epilog (&info, lResult));
}

LONG TSPIAPI TSPI_lineGetLineDevStatus | ( | HDRVLINE | hdLine,
 |  | LPLINEDEVSTATUS | lpLineDevStatus
 | ) |  |

Definition at line 985 of file Atsp.c.

{
#if DBG
    FUNC_PARAM  params[] =
    {
        { gszhdLine,            hdLine          },
        { "lpLineDevStatus",    lpLineDevStatus }
    };
    FUNC_INFO   info =
    {
        "TSPI_lineGetLineDevStatus",
        2,
        params
    };
#endif

    LONG        lResult = 0;
    PDRVLINE    pLine = (PDRVLINE) hdLine;

    Prolog (&info);

    lpLineDevStatus->dwUsedSize =
    lpLineDevStatus->dwNeededSize = sizeof (LINEDEVSTATUS);

    lpLineDevStatus->dwNumActiveCalls = (pLine->htCall ? 1 : 0);
    //lpLineDevStatus->dwLineFeatures =
    lpLineDevStatus->dwDevStatusFlags = LINEDEVSTATUSFLAGS_CONNECTED |
                                        LINEDEVSTATUSFLAGS_INSERVICE;
    return (Epilog (&info, lResult));
}

LONG TSPIAPI TSPI_lineGetNumAddressIDs | ( | HDRVLINE | hdLine,
 |  | LPDWORD | lpdwNumAddressIDs
 | ) |  |

Definition at line 1023 of file Atsp.c.

{
#if DBG
    FUNC_PARAM  params[] =
    {
        { gszhdLine,            hdLine            },
        { "lpdwNumAddressIDs",  lpdwNumAddressIDs }
    };
    FUNC_INFO   info =
    {
        "TSPI_lineGetNumAddressIDs",
        2,
        params
    };
#endif

    LONG        lResult = 0;
    PDRVLINE    pLine = (PDRVLINE) hdLine;

    //
    // We only support 1 address (id=0)
    //

    Prolog (&info);
    *lpdwNumAddressIDs = 1;
    return (Epilog (&info, lResult));
}

LONG TSPIAPI TSPI_lineMakeCall | ( | DRV_REQUESTID | dwRequestID,
 |  | HDRVLINE | hdLine,
 |  | HTAPICALL | htCall,
 |  | LPHDRVCALL | lphdCall,
 |  | LPCWSTR | lpszDestAddress,
 |  | DWORD | dwCountryCode,
 |  | LPLINECALLPARAMS const | lpCallParams
 | ) |  |

Definition at line 1058 of file Atsp.c.

{
    char        szCommands[64], szCommand[64], szDestAddress[128];
    DWORD       dwThreadID, dwNumBytes, dwError;
    PDRVLINE    pLine = (PDRVLINE) hdLine;
#if DBG
    FUNC_PARAM  params[] =
    {
        { gszdwRequestID,       dwRequestID     },
        { gszhdLine,            hdLine          },
        { "htCall",             htCall          },
        { "lphdCall",           lphdCall        },
        { "lpszDestAddress",    szDestAddress   },
        { "dwCountryCode",      dwCountryCode   },
        { gszlpCallParams,      lpCallParams    }
    };
    FUNC_INFO info =
    {
        "TSPI_lineMakeCall",
        7,
        params
    };
#endif

    if (lpszDestAddress)
    {
        WideCharToMultiByte(
            CP_ACP,
            0,
            lpszDestAddress,
            -1,
            (LPSTR) szDestAddress,
            128,
            NULL,
            NULL
            );
    }

    Prolog (&info);

    //
    // Check to see if there's already another call
    //

    if (pLine->htCall)
    {
        (*gpfnCompletionProc)(dwRequestID, LINEERR_CALLUNAVAIL);
        goto TSPI_lineMakeCall_return;
    }

    //
    // Since we don't support TSPI_lineDial, fail if app tries
    // to pass a NULL lpszDestAddress (implying that app just
    // wants to go offhook)
    //

    if (lpszDestAddress == NULL)
    {
        (*gpfnCompletionProc)(dwRequestID, LINEERR_INVALADDRESS);
        goto TSPI_lineMakeCall_return;
    }

    //
    // Get the line's config info
    //

    {
        HKEY    hKey;
        DWORD   dwDataSize, dwDataType;
        char    szLineN[8], *pszConfig, *p, *p2;

        wsprintf(
            szLineN,
            "Line%d",
            ((PDRVLINE) hdLine)->dwDeviceID - gdwLineDeviceIDBase
            );

        dwDataSize = 256;

        pszConfig = DrvAlloc (dwDataSize);

        if (!pszConfig) {
        (*gpfnCompletionProc)(dwRequestID, LINEERR_NOMEM);
          goto TSPI_lineMakeCall_return;
        }

        RegOpenKeyEx(
            HKEY_LOCAL_MACHINE,
            gszAtspKey,
            0,
            KEY_ALL_ACCESS,
            &hKey
            );

        RegQueryValueEx(
            hKey,
            szLineN,
            0,
            &dwDataType,
            (LPBYTE) pszConfig,
            &dwDataSize
            );

        pszConfig[dwDataSize] = '\0';       // *pszConfig = "MyLine,COM1,L0"

        RegCloseKey (hKey);

        //
        // szComm
        //

        for (p = pszConfig; *p != ','; p++);
        p++;                                // *p = "COM1,L0"
        for (p2 = p; *p2 != ','; p2++);
        *p2 = 0;                            // *p = "COM1"

        strncpy (pLine->szComm, p, 7 );
    pLine->szComm[7] = '\0';

        //
        // szCommands
        //

        p2++;                               // *p2 = "L0"
        strncpy (szCommands, p2, 63);
    szCommands[63] = '\0';

        DrvFree (pszConfig);
    }

    //
    // Open the port
    //

    if ((pLine->hComm = CreateFile(
            pLine->szComm,
            GENERIC_READ | GENERIC_WRITE,
            0, //FILE_SHARE_READ | FILE_SHARE_WRITE,
            NULL, // no security attrs
            OPEN_EXISTING,
            FILE_FLAG_OVERLAPPED,
            NULL  // no template file

            )) == INVALID_HANDLE_VALUE)
    {
        DBGOUT((
            3,
            "TSPI_lineMakeCall: CreateFile(%s) failed, err=%ld",
            pLine->szComm,
            GetLastError()
            ));

        (*gpfnCompletionProc)(dwRequestID, LINEERR_RESOURCEUNAVAIL);
        goto TSPI_lineMakeCall_return;
    }

    //
    // Setup up the modem command string.  If there's an initial 'T'
    // or 'P' (for Tone or Pulse) in the dest address then disregard
    // it.  Also if it's a voice call add the semi colon so we return
    // to cmd mode.
    //

    {
        char *p = (char *) szDestAddress;

        if (*p == 'T'  ||  *p == 'P')
        {
            p++;
        }

        if (lpCallParams &&
            lpCallParams->dwMediaMode != LINEMEDIAMODE_INTERACTIVEVOICE)
        {
            wsprintf (szCommand, "AT%sDT%s\r", szCommands, p);
        }
        else
        {
            wsprintf (szCommand, "AT%sDT%s;\r", szCommands, p);
        }
    }

    //
    // Init the data structure & tell tapi our handle to the call
    //

    pLine->htCall          = htCall;
    pLine->bDropInProgress = FALSE;
    pLine->dwMediaMode     = (lpCallParams ? lpCallParams->dwMediaMode :
        LINEMEDIAMODE_INTERACTIVEVOICE);

    *lphdCall = (HDRVCALL) pLine;

    //
    // Do an overlapped write, the comm thread will deal with the results
    //

    pLine->Overlapped.hEvent = CreateEvent (NULL, TRUE, FALSE, NULL);

    if (!WriteFile(
            pLine->hComm,
            szCommand,
            lstrlen (szCommand),
            &dwNumBytes,
            &pLine->Overlapped
            )

        && (dwError = GetLastError()) != ERROR_IO_PENDING)
    {
        DBGOUT((
            1,
            "TSPI_lineMakeCall: WriteFile(%s) failed, error=%d",
            pLine->szComm,
            dwError
            ));

        pLine->htCall = NULL;
        CloseHandle (pLine->hComm);
        CloseHandle (pLine->Overlapped.hEvent);
        (*gpfnCompletionProc)(dwRequestID, LINEERR_OPERATIONFAILED);
        goto TSPI_lineMakeCall_return;
    }

    //
    // Complete the requests & set the initial call state
    //

    (*gpfnCompletionProc)(dwRequestID, 0);
    SetCallState (pLine, LINECALLSTATE_DIALING, 0);

    //
    // Spin the comm thread to handle the results of the Write above
    //

    {
        HANDLE hCommThread;

        if (!(hCommThread = CreateThread(
                (LPSECURITY_ATTRIBUTES) NULL,
                0,
                (LPTHREAD_START_ROUTINE) CommThread,
                pLine,
                0,
                &dwThreadID
                )))
        {
            DBGOUT((
                1,
                "TSPI_lineMakeCall: CreateThread failed, err=%ld",
                GetLastError()
                ));

            GetOverlappedResult(
                pLine->hComm,
                &pLine->Overlapped,
                &dwNumBytes,
                TRUE
                );

            SetCallState (pLine, LINECALLSTATE_IDLE, 0);
            CloseHandle (pLine->hComm);
            CloseHandle (pLine->Overlapped.hEvent);
            goto TSPI_lineMakeCall_return;
        }

        CloseHandle (hCommThread);
    }

TSPI_lineMakeCall_return:

    return (Epilog (&info, dwRequestID));
}

LONG TSPIAPI TSPI_lineMSPIdentify | ( | DWORD | dwDeviceID,
 |  | GUID * | pCLSID
 | ) |  |

Definition at line 176 of file Atsp.c.

{

   LONG  lResult = 0;

#if DBG
    FUNC_PARAM  params[] =
    {
        { "dwDeviceID", dwDeviceID }
    };

    FUNC_INFO   info =
    {
        "TSPI_lineMSPIdentify",
        1,
        params
    };

#endif

    Prolog (&info);

  //
  // Identify the CLSID of the our MSP
  // this is the CLSID of Sample MSP in the
  // TAPI3 SDK
  //

    *pCLSID = CLSID_SAMPMSP;

    return (Epilog (&info, lResult));

}

LONG TSPIAPI TSPI_lineNegotiateTSPIVersion | ( | DWORD | dwDeviceID,
 |  | DWORD | dwLowVersion,
 |  | DWORD | dwHighVersion,
 |  | LPDWORD | lpdwTSPIVersion
 | ) |  |

Definition at line 1358 of file Atsp.c.

{
    LONG        lResult = 0;
#if DBG
    FUNC_PARAM  params[] =
    {
        { gszdwDeviceID,        dwDeviceID      },
        { "dwLowVersion",       dwLowVersion    },
        { "dwHighVersion",      dwHighVersion   },
        { "lpdwTSPIVersion",    lpdwTSPIVersion }
    };
    FUNC_INFO   info =
    {
        "TSPI_lineNegotiateTSPIVersion",
        4,
        params
    };
#endif

    Prolog (&info);

  // version 3.0 to allow MSP usage
  //

    *lpdwTSPIVersion = 0x00030000;
    return (Epilog (&info, lResult));
}

LONG TSPIAPI TSPI_lineOpen | ( | DWORD | dwDeviceID,
 |  | HTAPILINE | htLine,
 |  | LPHDRVLINE | lphdLine,
 |  | DWORD | dwTSPIVersion,
 |  | LINEEVENT | lpfnEventProc
 | ) |  |

Definition at line 1394 of file Atsp.c.

{
    LONG        lResult;
    PDRVLINE    pLine;
#if DBG
    FUNC_PARAM  params[] =
    {
        { gszdwDeviceID,    dwDeviceID      },
        { "htLine",         htLine          },
        { "lphdLine",       lphdLine        },
        { "dwTSPIVersion",  dwTSPIVersion   },
        { "lpfnEventProc",  lpfnEventProc   }
    };
    FUNC_INFO   info =
    {
        "TSPI_lineOpen",
        5,
        params
    };
#endif

    Prolog (&info);

    if ((pLine = DrvAlloc (sizeof (DRVLINE))))
    {
        pLine->htLine       = htLine;
        pLine->pfnEventProc = lpfnEventProc;
        pLine->dwDeviceID   = dwDeviceID;

        *lphdLine = (HDRVLINE) pLine;

        lResult = 0;
    }
    else
    {
        lResult = LINEERR_NOMEM;
    }

    return (Epilog (&info, lResult));
}

LONG TSPIAPI TSPI_lineReceiveMSPData | ( | HDRVLINE | hdLine,
 |  | HDRVCALL | hdCall,
 |  | HDRVMSPLINE | hdMSPLine,
 |  | LPBYTE | pBuffer,
 |  | DWORD | dwSize
 | ) |  |

Definition at line 216 of file Atsp.c.

{
  LONG lResult             = 0;

#if DBG
  FUNC_PARAM  params[] =
  {
    {  gszhdLine, hdLine },
    {  gszhdCall, hdCall},
    { "hdMSPLine", hdMSPLine},
    { "pBuffer"  , pBuffer},
    { "dwSize" , dwSize}

  };

  FUNC_INFO   info =
  {
    "TSPI_lineReceiveMSPData",
    5,
    params
  };

#endif

  Prolog (&info);

  //
  // Place code to Process Data received from the MSP
  //

  return (Epilog (&info, lResult));
}

LONG TSPIAPI TSPI_lineSetDefaultMediaDetection | ( | HDRVLINE | hdLine,
 |  | DWORD | dwMediaModes
 | ) |  |

Definition at line 1445 of file Atsp.c.

{
#if DBG
    FUNC_PARAM  params[] =
    {
        { gszhdLine,        hdLine       },
        { "dwMediaModes",   dwMediaModes }
    };
    FUNC_INFO   info =
    {
        "TSPI_lineSetDefaultMediaDetection",
        2,
        params
    };
#endif

    //
    // This func is really a no-op for us, since we don't look
    // for incoming calls (though we do say we support them to
    // make apps happy)
    //

    Prolog (&info);
    return (Epilog (&info, 0));
}

LONG TSPIAPI TSPI_providerConfig | ( | HWND | hwndOwner,
 |  | DWORD | dwPermanentProviderID
 | ) |  |

Definition at line 1482 of file Atsp.c.

{
    //
    // Although this func is never called by TAPI v2.0, we export
    // it so that the Telephony Control Panel Applet knows that it
    // can configure this provider via lineConfigProvider(),
    // otherwise Telephon.cpl will not consider it configurable
    //

    return 0;
}

LONG TSPIAPI TSPI_providerEnumDevices | ( | DWORD | dwPermanentProviderID,
 |  | LPDWORD | lpdwNumLines,
 |  | LPDWORD | lpdwNumPhones,
 |  | HPROVIDER | hProvider,
 |  | LINEEVENT | lpfnLineCreateProc,
 |  | PHONEEVENT | lpfnPhoneCreateProc
 | ) |  |

Definition at line 1639 of file Atsp.c.

{
   HKEY     hKey;
   DWORD    dwNumLines, dwDataType, dwDataSize;

   //
   // Retrieve the number of devices we're
   // configured for from our registry section
   //

   RegOpenKeyEx(
       HKEY_LOCAL_MACHINE,
       gszAtspKey,
       0,
       KEY_ALL_ACCESS,
       &hKey
       );

   dwDataSize = sizeof(dwNumLines);
   dwNumLines = 0;

   RegQueryValueEx(
       hKey,
       gszNumLines,
       0,
       &dwDataType,
       (LPBYTE) &dwNumLines,
       &dwDataSize
       );

   RegCloseKey (hKey);

   *lpdwNumLines  = dwNumLines;
   *lpdwNumPhones = 0;
   return 0;
}

LONG TSPIAPI TSPI_providerGenericDialogData | ( | DWORD_PTR | dwObjectID,
 |  | DWORD | dwObjectType,
 |  | LPVOID | lpParams,
 |  | DWORD | dwSize
 | ) |  |

Definition at line 1500 of file Atsp.c.

{
    LONG        lResult = 0;
#if DBG
    FUNC_PARAM  params[] =
    {
        { "dwObjectID",     dwObjectID      },
        { "dwObjectType",   dwObjectType    },
        { "lpParams",       lpParams        },
        { "dwSize",         dwSize          }
    };
    FUNC_INFO   info =
    {
        "TSPI_providerGenericDialogData",
        4,
        params
    };
#endif

    Prolog (&info);
    return (Epilog (&info, lResult));
}

LONG TSPIAPI TSPI_providerInit | ( | DWORD | dwTSPIVersion,
 |  | DWORD | dwPermanentProviderID,
 |  | DWORD | dwLineDeviceIDBase,
 |  | DWORD | dwPhoneDeviceIDBase,
 |  | DWORD_PTR | dwNumLines,
 |  | DWORD_PTR | dwNumPhones,
 |  | ASYNC_COMPLETION | lpfnCompletionProc,
 |  | LPDWORD | lpdwTSPIOptions
 | ) |  |

Definition at line 1532 of file Atsp.c.

{
    LONG        lResult = 0;
#if DBG
    FUNC_PARAM  params[] =
    {
        { "dwTSPIVersion",          dwTSPIVersion           },
        { gszdwPermanentProviderID, dwPermanentProviderID   },
        { "dwLineDeviceIDBase",     dwLineDeviceIDBase      },
        { "dwPhoneDeviceIDBase",    dwPhoneDeviceIDBase     },
        { "dwNumLines",             dwNumLines              },
        { "dwNumPhones",            dwNumPhones             },
        { "lpfnCompletionProc",     lpfnCompletionProc      }
    };
    FUNC_INFO   info =
    {
        "TSPI_providerInit",
        7,
        params
    };
#endif

    Prolog (&info);
    gdwLineDeviceIDBase = dwLineDeviceIDBase;
    gpfnCompletionProc  = lpfnCompletionProc;
    *lpdwTSPIOptions = LINETSPIOPTION_NONREENTRANT;
    return (Epilog (&info, lResult));
}

LONG TSPIAPI TSPI_providerInstall | ( | HWND | hwndOwner,
 |  | DWORD | dwPermanentProviderID
 | ) |  |

Definition at line 1573 of file Atsp.c.

{
    //
    // Although this func is never called by TAPI v2.0, we export
    // it so that the Telephony Control Panel Applet knows that it
    // can add this provider via lineAddProvider(), otherwise
    // Telephon.cpl will not consider it installable
    //
    //

    return 0;
}

LONG TSPIAPI TSPI_providerRemove | ( | HWND | hwndOwner,
 |  | DWORD | dwPermanentProviderID
 | ) |  |

Definition at line 1592 of file Atsp.c.

{
    //
    // Although this func is never called by TAPI v2.0, we export
    // it so that the Telephony Control Panel Applet knows that it
    // can remove this provider via lineRemoveProvider(), otherwise
    // Telephon.cpl will not consider it removable
    //

    return 0;
}

LONG TSPIAPI TSPI_providerShutdown | ( | DWORD | dwTSPIVersion,
 |  | DWORD | dwPermanentProviderID
 | ) |  |

Definition at line 1610 of file Atsp.c.

{
    LONG        lResult = 0;
#if DBG
    FUNC_PARAM  params[] =
    {
        { "dwTSPIVersion",          dwTSPIVersion },
        { gszdwPermanentProviderID, dwPermanentProviderID   }
    };
    FUNC_INFO   info =
    {
        "TSPI_providerShutdown",
        2,
        params
    };
#endif

    Prolog (&info);

    return (Epilog (&info, lResult));
}

LONG TSPIAPI TSPI_providerUIIdentify ( LPWSTR lpszUIDLLName )

Definition at line 1687 of file Atsp.c.

{
    LONG        lResult = 0;
#if DBG
    FUNC_PARAM  params[] =
    {
        { "lpsUIDLLName",  lpszUIDLLName }
    };
    FUNC_INFO   info =
    {
        "TSPI_providerUIIdentify",
        1,
        params
    };
#endif

    Prolog (&info);
    My_lstrcpyW(lpszUIDLLName, L"atsp32.tsp");
    return (Epilog (&info, lResult));
}

LONG TSPIAPI TUISPI_lineConfigDialog | ( | TUISPIDLLCALLBACK | lpfnUIDLLCallback,
 |  | DWORD | dwDeviceID,
 |  | HWND | hwndOwner,
 |  | LPCWSTR | lpszDeviceClass
 | ) |  |

Definition at line 1718 of file Atsp.c.

{
    char        szDeviceClass[128];
    LONG        lResult = 0;
#if DBG
    FUNC_PARAM  params[] =
    {
        { "lpfnUIDLLCallback",   lpfnUIDLLCallback },
        { gszdwDeviceID,         dwDeviceID        },
        { gszhwndOwner,          hwndOwner         },
        { "lpszDeviceClass",     szDeviceClass     }
    };
    FUNC_INFO   info =
    {
        "TUISPI_lineConfigDialog",
        4,
        params
    };
#endif

    if (lpszDeviceClass)
    {
        WideCharToMultiByte(
            CP_ACP,
            0,
            lpszDeviceClass,
            -1,
            (LPSTR) szDeviceClass,
            128,
            NULL,
            NULL
            );
    }

    Prolog (&info);

    DialogBoxParam(
        ghInst,
        MAKEINTRESOURCE(IDD_DIALOG1),
        hwndOwner,
        (DLGPROC) ConfigDlgProc,
        0
        );

    return (Epilog (&info, lResult));
}

LONG TSPIAPI TUISPI_providerConfig | ( | TUISPIDLLCALLBACK | lpfnUIDLLCallback,
 |  | HWND | hwndOwner,
 |  | DWORD | dwPermanentProviderID
 | ) |  |

Definition at line 1774 of file Atsp.c.

{
    LONG        lResult = 0;
#if DBG
    FUNC_PARAM  params[] =
    {
        { "lpfnUIDLLCallback",      lpfnUIDLLCallback },
        { gszhwndOwner,             hwndOwner    },
        { gszdwPermanentProviderID, dwPermanentProviderID   }
    };
    FUNC_INFO   info =
    {
        "TUISPI_providerConfig",
        3,
        params
    };
#endif

    Prolog (&info);

    DialogBoxParam(
        ghInst,
        MAKEINTRESOURCE(IDD_DIALOG1),
        hwndOwner,
        (DLGPROC) ConfigDlgProc,
        0
        );

    return (Epilog (&info, lResult));
}

LONG TSPIAPI TUISPI_providerInstall | ( | TUISPIDLLCALLBACK | lpfnUIDLLCallback,
 |  | HWND | hwndOwner,
 |  | DWORD | dwPermanentProviderID
 | ) |  |

Definition at line 1813 of file Atsp.c.

{
    LONG    lResult;

    if ((lResult = ProviderInstall ("atsp32.tsp", TRUE)) == 0)
    {
        DialogBoxParam(
            ghInst,
            MAKEINTRESOURCE(IDD_DIALOG1),
            hwndOwner,
            (DLGPROC) ConfigDlgProc,
            0
            );
    }

    return lResult;
}

LONG TSPIAPI TUISPI_providerRemove | ( | TUISPIDLLCALLBACK | lpfnUIDLLCallback,
 |  | HWND | hwndOwner,
 |  | DWORD | dwPermanentProviderID
 | ) |  |

Definition at line 1839 of file Atsp.c.

{
    HKEY    hKey;
    char    szSoftwareMsft[] = "Software\\Microsoft", szATSP[] = "ATSP";

    //
    // Clean up our registry section
    //

    RegOpenKeyExA(
        HKEY_LOCAL_MACHINE,
        szSoftwareMsft,
        0,
        KEY_ALL_ACCESS,
        &hKey
        );

    RegDeleteKeyA (hKey, szATSP);
    RegCloseKey (hKey);
    return 0;
}

Generated on Wed Nov 13 2024 16:54:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi2/Atsp32/Atsp.h File Reference

  • NetDS
  • Tapi
  • Tapi2
  • Atsp32
Classes | Defines | Typedefs | Functions | Variables

Atsp.h File Reference

#include <windows.h>
#include "tapi.h"
#include "tspi.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <string.h>
#include "resource.h"
#include <initguid.h>
#include "resource.h"

Go to the source code of this file.

Classes

struct | _ASYNC_REQUEST
struct | _DRVLINE
struct | _DRVLINECONFIG
struct | _FUNC_INFO

Defines

#define | ATSP_TIMEOUT 60000
#define | DBGOUT(arg)
#define | Epilog(pAsyncRequestInfo, lResult) (lResult)
#define | MAX_DEV_NAME_LENGTH 63
#define | Prolog(pAsyncRequestInfo)

Typedefs

typedef struct _ASYNC_REQUEST | ASYNC_REQUEST
typedef struct _DRVLINE | DRVLINE
typedef struct _DRVLINECONFIG | DRVLINECONFIG
typedef struct _FUNC_INFO | FUNC_INFO
typedef struct _ASYNC_REQUEST * | PASYNC_REQUEST
typedef struct _DRVLINE * | PDRVLINE
typedef struct _DRVLINECONFIG * | PDRVLINECONFIG
typedef struct _FUNC_INFO * | PFUNC_INFO

Functions

BOOL CALLBACK | ConfigDlgProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
DEFINE_GUID (CLSID_SAMPMSP, 0x23F7C678, 0x24E1, 0x48db, 0xAE, 0xAC, 0x54, 0xA6, 0xF2, 0xA0, 0x10, 0xA0)
void PASCAL | DropActiveCall (PDRVLINE pLine)
LPVOID PASCAL | DrvAlloc (DWORD dwSize)
VOID PASCAL | DrvFree (LPVOID lp)
LPWSTR PASCAL | My_lstrcpyW (WCHAR *pString1, WCHAR *pString2)
LONG PASCAL | ProviderInstall (char *pszProviderName, BOOL bNoMultipleInstance)
void PASCAL | SetCallState (PDRVLINE pLine, DWORD dwCallState, DWORD dwCallStateMode)

Variables

DWORD gdwLineDeviceIDBase
DWORD gdwPermanentProviderID
HANDLE ghInst
ASYNC_COMPLETION | gpfnCompletionProc
char | gszAtspKey [] = "Software\\Microsoft\\ATSP"
char | gszDefLineConfigParams [] = "my new line,COM1,L0"
char | gszNumLines [] = "NumLines"

Define Documentation

#define ATSP_TIMEOUT 60000

Definition at line 37 of file Atsp.h.

#define DBGOUT ( arg )

Definition at line 176 of file Atsp.h.

#define Epilog | ( | pAsyncRequestInfo,
 |  | lResult |
 | ) |  | (lResult)

Definition at line 178 of file Atsp.h.

#define MAX_DEV_NAME_LENGTH 63

Definition at line 36 of file Atsp.h.

#define Prolog ( pAsyncRequestInfo )

Definition at line 180 of file Atsp.h.

Typedef Documentation

typedef struct _ASYNC_REQUEST ASYNC_REQUEST
typedef struct _DRVLINE DRVLINE
typedef struct _DRVLINECONFIG DRVLINECONFIG
typedef struct _FUNC_INFO FUNC_INFO
typedef struct _ASYNC_REQUEST * PASYNC_REQUEST
typedef struct _DRVLINE* PDRVLINE
typedef struct _DRVLINECONFIG* PDRVLINECONFIG
typedef struct _FUNC_INFO * PFUNC_INFO

Function Documentation

BOOL CALLBACK ConfigDlgProc | ( | HWND | hwnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 1929 of file Atsp.c.

{
    static  HKEY    hAtspKey;

    DWORD   dwDataSize;
    DWORD   dwDataType;

    switch (msg)
    {
    case WM_INITDIALOG:
    {
        char   *pBuf;
        DWORD   i, iNumLines;

        //
        // Create or open our configuration key in the registry.  If the
        // create fails it may well be that the current user does not
        // have write access to this portion of the registry, so we'll
        // just show a "read only" dialog and not allow user to make any
        // changes
        //

        {
            LONG    lResult;
            DWORD   dwDisposition;

            if ((lResult = RegCreateKeyEx(
                    HKEY_LOCAL_MACHINE,
                    gszAtspKey,
                    0,
                    "",
                    REG_OPTION_NON_VOLATILE,
                    KEY_ALL_ACCESS,
                    (LPSECURITY_ATTRIBUTES) NULL,
                    &hAtspKey,
                    &dwDisposition

                    )) != ERROR_SUCCESS)
            {
                DBGOUT((
                    3,
                    "RegCreateKeyEx(%s,ALL_ACCESS) failed, err=%d",
                    gszAtspKey,
                    lResult
                    ));

                if ((lResult = RegOpenKeyEx(
                        HKEY_LOCAL_MACHINE,
                        gszAtspKey,
                        0,
                        KEY_QUERY_VALUE,
                        &hAtspKey

                        )) != ERROR_SUCCESS)
                {
                    DBGOUT((
                        3,
                        "RegOpenKeyEx(%s,ALL_ACCESS) failed, err=%d",
                        gszAtspKey,
                        lResult
                        ));

                    EndDialog (hwnd, 0);
                    return FALSE;
                }

                {
                    int i;
                    static int aiControlIDs[] =
                    {
                        IDC_NAME,
                        IDC_PORT,
                        IDC_COMMANDS,
                        IDC_ADD,
                        IDC_REMOVE,
                        IDOK,
                        0
                    };

                    for (i = 0; aiControlIDs[i]; i++)
                    {
                        EnableWindow(
                            GetDlgItem (hwnd, aiControlIDs[i]),
                            FALSE
                            );
                    }
                }
            }
        }

        //
        // Retrieve our configuration info from the registry
        //

        dwDataSize = sizeof(iNumLines);
        iNumLines = 0;

        RegQueryValueEx(
            hAtspKey,
            gszNumLines,
            0,
            &dwDataType,
            (LPBYTE) &iNumLines,
            &dwDataSize
            );

        SendDlgItemMessage(
            hwnd,
            IDC_NAME,
            EM_LIMITTEXT,
            MAX_DEV_NAME_LENGTH,
            0
            );

        SendDlgItemMessage(
            hwnd,
            IDC_COMMANDS,
            EM_LIMITTEXT,
            MAX_DEV_NAME_LENGTH,
            0
            );

        if (!(pBuf = DrvAlloc (256)))
          break;

        for (i = 0; i < iNumLines; i++)
        {
            char           *p, *p2, szLineN[8];
            PDRVLINECONFIG  pLineConfig;
            LONG            lResult;

       if (!(pLineConfig = DrvAlloc (sizeof(DRVLINECONFIG))))
        break;

            wsprintf (szLineN, "Line%d", i);

            dwDataSize = 256;

            lResult = RegQueryValueEx(
                hAtspKey,
                szLineN,
                0,
                &dwDataType,
                (LPBYTE) pBuf,
                &dwDataSize
                );

            //
            // If there was a problem, use the default config
            //

            if (0 != lResult)
            {
               strncpy (pBuf, gszDefLineConfigParams, 255);
        pBuf[255] = '\0';
            }

            for (p = pBuf; *p != ','; p++);
            *p = 0;

            SendDlgItemMessage(
                hwnd,
                IDC_DEVICES,
                LB_ADDSTRING,
                0,
                (LPARAM) pBuf
                );

            SendDlgItemMessage(
                hwnd,
                IDC_DEVICES,
                LB_SETITEMDATA,
                i,
                (LPARAM) pLineConfig
                );

            p++;
            for (p2 = p; *p2 != ','; p2++);
            *p2 = 0;

            strncpy (pLineConfig->szPort, p, 7 );
      pLineConfig->szPort[7] = '\0';

            p = p2 + 1;

            strncpy (pLineConfig->szCommands, p,63);
      pLineConfig->szCommands[63] = '\0';
        }

        DrvFree (pBuf);

        //
        // Fill up the various controls with configuration options
        //

        {
            static char *aszPorts[] = { "COM1","COM2","COM3",NULL };

            for (i = 0; aszPorts[i]; i++)
            {
                SendDlgItemMessage(
                    hwnd,
                    IDC_PORT,
                    LB_ADDSTRING,
                    0,
                    (LPARAM) aszPorts[i]
                    );
            }
        }

        if (iNumLines == 0)
        {
            EnableChildren (hwnd, FALSE);
        }
        else
        {
            SelectDevice (hwnd, 0);
        }

        break;
    }
    case WM_COMMAND:
    {
        LRESULT             iSelection;
        PDRVLINECONFIG  pLineConfig;

        iSelection = SendDlgItemMessage(
            hwnd,
            IDC_DEVICES,
            LB_GETCURSEL,
            0,
            0
            );

        pLineConfig = (PDRVLINECONFIG) SendDlgItemMessage(
            hwnd,
            IDC_DEVICES,
            LB_GETITEMDATA,
            (WPARAM) iSelection,
            0
            );

        switch (LOWORD((DWORD)wParam))
        {
        case IDC_DEVICES:

            if (HIWORD(wParam) == LBN_SELCHANGE)
            {
                char buf[MAX_DEV_NAME_LENGTH + 1];

                SendDlgItemMessage(
                    hwnd,
                    IDC_DEVICES,
                    LB_GETTEXT,
                    iSelection,
                    (LPARAM) buf
                    );

                SetDlgItemText (hwnd, IDC_NAME, buf);

                SendDlgItemMessage(
                    hwnd,
                    IDC_PORT,
                    LB_SELECTSTRING,
                    (WPARAM) -1,
                    (LPARAM) pLineConfig->szPort
                    );

                SetDlgItemText (hwnd, IDC_COMMANDS, pLineConfig->szCommands);
            }

            break;

        case IDC_NAME:

            if ((HIWORD(wParam) == EN_CHANGE) && (iSelection != LB_ERR))
            {
                char    buf[MAX_DEV_NAME_LENGTH + 1];

                GetDlgItemText (hwnd, IDC_NAME, buf, MAX_DEV_NAME_LENGTH);

                SendDlgItemMessage(
                    hwnd,
                    IDC_DEVICES,
                    LB_DELETESTRING,
                    iSelection,
                    0
                    );

                SendDlgItemMessage(
                    hwnd,
                    IDC_DEVICES,
                    LB_INSERTSTRING,
                    iSelection,
                    (LPARAM) buf
                    );

                SendDlgItemMessage(
                    hwnd,
                    IDC_DEVICES,
                    LB_SETCURSEL,
                    iSelection,
                    0
                    );

                SendDlgItemMessage(
                    hwnd,
                    IDC_DEVICES,
                    LB_SETITEMDATA,
                    iSelection,
                    (LPARAM) pLineConfig
                    );
            }

            break;

        case IDC_PORT:

            if (HIWORD(wParam) == LBN_SELCHANGE)
            {
                iSelection = SendDlgItemMessage(
                    hwnd,
                    IDC_PORT,
                    LB_GETCURSEL,
                    0,
                    0
                    );

                SendDlgItemMessage(
                    hwnd,
                    IDC_PORT,
                    LB_GETTEXT,
                    iSelection,
                    (LPARAM) pLineConfig->szPort
                    );
            }

            break;

        case IDC_COMMANDS:

            if ((HIWORD(wParam) == EN_CHANGE) && (iSelection != LB_ERR))
            {
                GetDlgItemText(
                    hwnd,
                    IDC_COMMANDS,
                    pLineConfig->szCommands,
                    63
                    );
            }

            break;

        case IDC_ADD:
        {
            LRESULT             iNumLines;
      int       i = 2;
            char            szLineName[32];
            PDRVLINECONFIG  pLineConfig;

            if(!(pLineConfig = DrvAlloc (sizeof(DRVLINECONFIG))))
              break;

            iNumLines = SendDlgItemMessage(
                hwnd,
                IDC_DEVICES,
                LB_GETCOUNT,
                0,
                0
                );

            strncpy (pLineConfig->szPort, "COM1", 7);
      pLineConfig->szPort[7] = '\0';

            strncpy (szLineName, "my new line",31 );
      szLineName[31] = '\0';

find_unique_line_name:

            if (SendDlgItemMessage(
                    hwnd,
                    IDC_DEVICES,
                    LB_FINDSTRING,
                    (WPARAM) -1,
                    (LPARAM) szLineName

                    ) != LB_ERR)
            {
                wsprintf (szLineName, "my new line%d", i++);
                goto find_unique_line_name;
            }

            SendDlgItemMessage(
                hwnd,
                IDC_DEVICES,
                LB_ADDSTRING,
                0,
                (LPARAM) szLineName
                );

            SendDlgItemMessage(
                hwnd,
                IDC_DEVICES,
                LB_SETITEMDATA,
                iNumLines,
                (LPARAM) pLineConfig
                );

            EnableChildren (hwnd, TRUE);

            SelectDevice (hwnd, iNumLines);

            SetFocus (GetDlgItem (hwnd, IDC_NAME));

            SendDlgItemMessage(
                hwnd,
                IDC_NAME,
                EM_SETSEL,
                0,
                (LPARAM) -1
                );

            break;
        }
        case IDC_REMOVE:
        {
            LRESULT iNumLines;

            DrvFree (pLineConfig);

            iNumLines = SendDlgItemMessage(
                hwnd,
                IDC_DEVICES,
                LB_DELETESTRING,
                iSelection,
                0
                );

            if (iNumLines == 0)
            {
                SetDlgItemText (hwnd, IDC_NAME, "");
                SetDlgItemText (hwnd, IDC_COMMANDS, "");

                EnableChildren (hwnd, FALSE);
            }
            else
            {
                SelectDevice (hwnd, 0);
            }

            break;
        }
        case IDOK:
        {
            int     i;
      LRESULT iNumLines;
            char   *pBuf;

            //
            // Update the num lines & num phones values
            //

            if (!(pBuf = DrvAlloc (256)))
              break;

            iNumLines = SendDlgItemMessage(
                hwnd,
                IDC_DEVICES,
                LB_GETCOUNT,
                0,
                0
                );

            RegSetValueEx(
                hAtspKey,
                gszNumLines,
                0,
                REG_DWORD,
                (LPBYTE) &iNumLines,
                sizeof(DWORD)
                );

            //
            // For each installed device save it's config info
            //

            for (i = 0; i < iNumLines; i++)
            {
                char szLineN[8];
                PDRVLINECONFIG pLineConfig;

                SendDlgItemMessage(
                    hwnd,
                    IDC_DEVICES,
                    LB_GETTEXT,
                    i,
                    (LPARAM) pBuf
                    );

                pLineConfig = (PDRVLINECONFIG) SendDlgItemMessage(
                    hwnd,
                    IDC_DEVICES,
                    LB_GETITEMDATA,
                    i,
                    0
                    );

                wsprintf(
                    pBuf + strlen (pBuf),
                    ",%s,%s",
                    pLineConfig->szPort,
                    pLineConfig->szCommands
                    );

                wsprintf (szLineN, "Line%d", i);

                RegSetValueEx(
                    hAtspKey,
                    szLineN,
                    0,
                    REG_SZ,
                    (LPBYTE) pBuf,
                    lstrlen (pBuf) + 1
                    );

                DrvFree (pLineConfig);
            }

            DrvFree (pBuf);

            // fall thru to EndDialog...
        }
        case IDCANCEL:

            RegCloseKey (hAtspKey);
            EndDialog (hwnd, 0);
            break;

        } // switch (LOWORD((DWORD)wParam))

        break;
    }
    } // switch (msg)

    return FALSE;
}

DEFINE_GUID | ( | CLSID_SAMPMSP | ,
 |  | 0x23F7C678 | ,
 |  | 0x24E1 | ,
 |  | 0x48db | ,
 |  | 0xAE | ,
 |  | 0xAC | ,
 |  | 0x54 | ,
 |  | 0xA6 | ,
 |  | 0xF2 | ,
 |  | 0xA0 | ,
 |  | 0x10 | ,
 |  | 0xA0 |
 | ) |  |
void PASCAL DropActiveCall ( PDRVLINE pLine )

Definition at line 2797 of file Atsp.c.

{
    if (pLine->hComm)
    {
        DWORD       dwNumBytes, dwError;
        OVERLAPPED  overlapped;

        pLine->bDropInProgress = TRUE;

        SetEvent (pLine->Overlapped.hEvent);

        ZeroMemory (&overlapped, sizeof (OVERLAPPED));

        overlapped.hEvent = CreateEvent (NULL, TRUE, FALSE, NULL);

        if (pLine->dwMediaMode != LINEMEDIAMODE_INTERACTIVEVOICE)
        {
            if (!WriteFile(
                    pLine->hComm,
                    "+++\r", 4,
                    &dwNumBytes,
                    &overlapped
                    ))
            {
                if ((dwError = GetLastError()) == ERROR_IO_PENDING)
                {
                    GetOverlappedResult(
                        pLine->hComm,
                        &overlapped,
                        &dwNumBytes,
                        TRUE
                        );

                    ResetEvent (overlapped.hEvent);
                }
                else
                {
                }
            }
        }

        if (!WriteFile (pLine->hComm, "ATH\r", 4, &dwNumBytes, &overlapped))
        {
            if ((dwError = GetLastError()) == ERROR_IO_PENDING)
            {
                GetOverlappedResult(
                    pLine->hComm,
                    &overlapped,
                    &dwNumBytes,
                    TRUE
                    );
            }
            else
            {
            }
        }

        CloseHandle (overlapped.hEvent);
        CloseHandle (pLine->hComm);
        pLine->hComm = NULL;
    }
}

LPVOID PASCAL DrvAlloc ( DWORD dwSize )

Definition at line 2499 of file Atsp.c.

{
    return (LocalAlloc (LPTR, dwSize));
}

VOID PASCAL DrvFree ( LPVOID lp )

Definition at line 2509 of file Atsp.c.

{
    LocalFree (lp);
}

LPWSTR PASCAL My_lstrcpyW | ( | WCHAR * | pString1,
 |  | WCHAR * | pString2
 | ) |  |

Definition at line 1876 of file Atsp.c.

{
    WCHAR *p = pString1;

    for (; (*p = *pString2); p++, pString2++);
    return pString1;
}

LONG PASCAL ProviderInstall | ( | char * | pszProviderName,
 |  | BOOL | bNoMultipleInstance
 | ) |  |

Definition at line 2629 of file Atsp.c.

{
    LONG    lResult;

    //
    // If only one installation instance of this provider is
    // allowed then we want to check the provider list to see
    // if the provider is already installed
    //

    if (bNoMultipleInstance)
    {
        LONG                (WINAPI *pfnGetProviderList)();
        DWORD               dwTotalSize, i;
        HINSTANCE           hTapi32;
        LPLINEPROVIDERLIST  pProviderList;
        LPLINEPROVIDERENTRY pProviderEntry;

        //
        // Load Tapi32.dll & get a pointer to the lineGetProviderList
        // func.  We don't want to statically link because this module
        // plays the part of both core SP & UI DLL, and we don't want
        // to incur the performance hit of automatically loading
        // Tapi32.dll when running as a core SP within Tapisrv.exe's
        // context.
        //

        if (!(hTapi32 = LoadLibrary ("tapi32.dll")))
        {
            DBGOUT((
                1,
                "LoadLibrary(tapi32.dll) failed, err=%d",
                GetLastError()
                ));

            lResult = LINEERR_OPERATIONFAILED;
            goto ProviderInstall_return;
        }

        if (!(pfnGetProviderList = (LONG (WINAPI *)())GetProcAddress(
                hTapi32,
                (LPCSTR) "lineGetProviderList"
                )))
        {
            DBGOUT((
                1,
                "GetProcAddr(lineGetProviderList) failed, err=%d",
                GetLastError()
                ));

            lResult = LINEERR_OPERATIONFAILED;
            goto ProviderInstall_unloadTapi32;
        }

        //
        // Loop until we get the full provider list
        //

        dwTotalSize = sizeof (LINEPROVIDERLIST);

        goto ProviderInstall_allocProviderList;

ProviderInstall_getProviderList:

        if ((lResult = (*pfnGetProviderList)(0x00020000, pProviderList)) != 0)
        {
            goto ProviderInstall_freeProviderList;
        }

        if (pProviderList->dwNeededSize > pProviderList->dwTotalSize)
        {
            dwTotalSize = pProviderList->dwNeededSize;

            LocalFree (pProviderList);

ProviderInstall_allocProviderList:

            if (!(pProviderList = LocalAlloc (LPTR, dwTotalSize)))
            {
                lResult = LINEERR_NOMEM;
                goto ProviderInstall_unloadTapi32;
            }

            pProviderList->dwTotalSize = dwTotalSize;

            goto ProviderInstall_getProviderList;
        }

        //
        // Inspect the provider list entries to see if this provider
        // is already installed
        //

        pProviderEntry = (LPLINEPROVIDERENTRY) (((LPBYTE) pProviderList) +
            pProviderList->dwProviderListOffset);

        for (i = 0; i < pProviderList->dwNumProviders; i++)
        {
            char   *pszInstalledProviderName = ((char *) pProviderList) +
                        pProviderEntry->dwProviderFilenameOffset,
                   *p;

            //
            // Make sure pszInstalledProviderName points at <filename>
            // and not <path>\filename by walking backeards thru the
            // string searching for last '\\'
            //

            p = pszInstalledProviderName +
                lstrlen (pszInstalledProviderName) - 1;

            for (; *p != '\\'  &&  p != pszInstalledProviderName; p--);

            pszInstalledProviderName =
                (p == pszInstalledProviderName ? p : p + 1);

            if (lstrcmpiA (pszInstalledProviderName, pszProviderName) == 0)
            {
                lResult = LINEERR_NOMULTIPLEINSTANCE;
                goto ProviderInstall_freeProviderList;
            }

            pProviderEntry++;
        }

        //
        // If here then the provider isn't currently installed,
        // so do whatever configuration stuff is necessary and
        // indicate SUCCESS
        //

        lResult = 0;

ProviderInstall_freeProviderList:

        LocalFree (pProviderList);

ProviderInstall_unloadTapi32:

        FreeLibrary (hTapi32);
    }
    else
    {
        //
        // Do whatever configuration stuff is necessary and return SUCCESS
        //

        lResult = 0;
    }

ProviderInstall_return:

    return lResult;
}

void PASCAL SetCallState | ( | PDRVLINE | pLine,
 |  | DWORD | dwCallState,
 |  | DWORD | dwCallStateMode
 | ) |  |

Definition at line 2519 of file Atsp.c.

{
    if (dwCallState != pLine->dwCallState)
    {
        pLine->dwCallState     = dwCallState;
        pLine->dwCallStateMode = dwCallStateMode;

        (*pLine->pfnEventProc)(
            pLine->htLine,
            pLine->htCall,
            LINE_CALLSTATE,
            dwCallState,
            dwCallStateMode,
            pLine->dwMediaMode
            );
    }
}

Variable Documentation

DWORD gdwLineDeviceIDBase

Definition at line 128 of file Atsp.h.

DWORD gdwPermanentProviderID

Definition at line 129 of file Atsp.h.

HANDLE ghInst

Name of app.

Definition at line 130 of file Atsp.h.

ASYNC_COMPLETION gpfnCompletionProc

Definition at line 131 of file Atsp.h.

char gszAtspKey[] = "Software\\Microsoft\\ATSP"

Definition at line 133 of file Atsp.h.

char gszDefLineConfigParams[] = "my new line,COM1,L0"

Definition at line 135 of file Atsp.h.

char gszNumLines[] = "NumLines"

Definition at line 134 of file Atsp.h.

Generated on Wed Nov 13 2024 16:54:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi2/Atsp32/Resource.h File Reference

  • NetDS
  • Tapi
  • Tapi2
  • Atsp32
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_ADD 1005
#define | IDC_COMMANDS 1004
#define | IDC_DEVICES 1001
#define | IDC_NAME 1002
#define | IDC_PORT 1003
#define | IDC_REMOVE 1006
#define | IDD_DIALOG1 101

Define Documentation

#define IDC_ADD 1005

Definition at line 6 of file Resource.h.

#define IDC_COMMANDS 1004

Definition at line 5 of file Resource.h.

#define IDC_DEVICES 1001

Definition at line 2 of file Resource.h.

#define IDC_NAME 1002

Definition at line 3 of file Resource.h.

#define IDC_PORT 1003

Definition at line 4 of file Resource.h.

#define IDC_REMOVE 1006

Definition at line 7 of file Resource.h.

#define IDD_DIALOG1 101

Definition at line 1 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi2/Dialer/Dialer.c File Reference

  • NetDS
  • Tapi
  • Tapi2
  • Dialer
Classes | Defines | Typedefs | Enumerations | Functions | Variables

Dialer.c File Reference

#include "dialer.h"
#include "string.h"
#include "stdlib.h"
#include "shellapi.h"

Go to the source code of this file.

Classes

struct | tagLINEINFO

Defines

#define | ISDIGIT(x) (((x) - '0') >= 0) && (((x) - '0') <= 9)

Typedefs

typedef struct tagLINEINFO | LINEINFO
typedef struct tagLINEINFO * | LPLINEINFO

Enumerations

enum | NumberTypes { LOCAL_NUMBER = 7, EXTENDED_LOCAL_NUMBER, LONG_DISTANCE_NUMBER = 10, EXTENDED_LONG_DISTANCE_NUMBER }

Functions

BOOL CALLBACK | AboutProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
VOID | AddToRedialList (LPCSTR szNumber)
VOID | AmpersandCompensate (LPCSTR lpszSrc, LPSTR lpszDst)
VOID | AmpersandDeCompensate (LPCSTR lpszSrc, LPSTR lpszDst)
VOID | ButtonFontSetup (VOID)
VOID | CloseTAPI (VOID)
BOOL CALLBACK | ConnectUsingProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
LPVOID | DialerAlloc (size_t cbToAlloc)
VOID | DialerCleanup (VOID)
LPVOID | DialerFree (LPVOID lpMem)
VOID | DialerLineClose (VOID)
VOID | DialerLineClose ()
BOOL CALLBACK | DialingProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
VOID | DisableDialButtons (BOOL fDisable)
VOID | DrawButton (HDC hdc, RECT rcBtn, BOOL fHighlighted)
VOID | DrawButtonText (HDC hdc, RECT rcBtn, BOOL fHighlighted, UINT IDD_Btn)
int | errString (HWND hWnd, UINT errCode, UINT uFlags)
VOID | FitTextToButton (HWND, INT, LPSTR)
LPSTR | GetAddressName (DWORD iLine, DWORD iAddress)
DWORD | GetLineInfo (DWORD iLine, LPLINEINFO lpLineInfo)
VOID | GetLineInfoFailed (DWORD iLine, LPLINEDEVCAPS lpDevCaps, LPLINEINFO lpLineInfo)
BOOL | InitializeAddressBox (HWND hwndLineBox, HWND hwndAddressBox)
BOOL | InitializeLineBox (HWND hwndLineBox)
DWORD | InitializeTAPI (VOID)
VOID | InitiateCall (LPCSTR szNumber, LPCSTR szName)
BOOL | Is911 (LPLINETRANSLATEOUTPUT lpTransOut)
BOOL CALLBACK | LineInUseProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
BOOL CALLBACK | MainWndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
BOOL | MakeCanonicalNumber (LPCSTR szName, LPSTR szCanNumber)
VOID | ManageAssistedTelephony (VOID)
VOID | ReadINI (VOID)
BOOL CALLBACK | SpeedDial1Proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
BOOL CALLBACK | SpeedDial2Proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
VOID CALLBACK | tapiCallback (DWORD hDevice, DWORD dwMsg, DWORD dwCallbackInstance, DWORD dwParam1, DWORD dwParam2, DWORD dwParam3)
int WINAPI | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

Variables

LINEINFO gCurrentLineInfo
LONG | gDropCallRequestID = 0
DWORD gdwEndSel
DWORD * gdwPLID
DWORD gdwStartSel
BOOL | gfCallRequest = FALSE
BOOL | gfCurrentLineAvail = TRUE
BOOL | gfMakeCallReplyPending = FALSE
BOOL | gfNeedToReinit = FALSE
BOOL gfRegistered
HCALL | ghCall = (HCALL)((ULONG_PTR)NULL)
HFONT | ghFontBtn
HFONT | ghFontBtnStar
HFONT | ghFontBtnText
HINSTANCE | ghInst = 0
HLINEAPP | ghLineApp = (HLINEAPP)((ULONG_PTR)NULL)
HWND | ghWndDialing = NULL
HWND | ghWndMain
DWORD | giCurrentAddress = 0
DWORD | giCurrentLine = (DWORD)-1
LONG | gMakeCallRequestID = 0
DWORD * gnAddr
DWORD | gnAvailDevices = 0
LPSTR | gszCurrentName = NULL
LPSTR | gszCurrentNumber = NULL
TCHAR const | gszNULL [] = ""
TCHAR | gszSDNumber [NSPEEDDIALS+1][TAPIMAXDESTADDRESSSIZE]

Define Documentation

#define ISDIGIT ( x ) (((x) - '0') >= 0) && (((x) - '0') <= 9)

Definition at line 18 of file Dialer.c.

Typedef Documentation

typedef struct tagLINEINFO LINEINFO
typedef struct tagLINEINFO * LPLINEINFO

Enumeration Type Documentation

enum NumberTypes
Enumerator:
LOCAL_NUMBER
EXTENDED_LOCAL_NUMBER
LONG_DISTANCE_NUMBER
EXTENDED_LONG_DISTANCE_NUMBER

Definition at line 19 of file Dialer.c.

{
  LOCAL_NUMBER = 7,
  EXTENDED_LOCAL_NUMBER,
  LONG_DISTANCE_NUMBER = 10,
  EXTENDED_LONG_DISTANCE_NUMBER
};

Function Documentation

BOOL CALLBACK AboutProc | ( | HWND | hwnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 2087 of file Dialer.c.

{
    switch(msg)
    {
        case WM_INITDIALOG:
        {
            return TRUE;
        }

        case WM_CLOSE:
            EndDialog(hwnd, TRUE);
            return TRUE;

        case WM_COMMAND:
            if(LOWORD((DWORD)wParam) == IDOK)
            {
                EndDialog(hwnd, TRUE);
                return TRUE;
            }

            break;
    }

    return FALSE;

}

VOID AddToRedialList ( LPCSTR szNumber )

Definition at line 1508 of file Dialer.c.

{
  // NLASTDIALED == 10
  WORD cNum;
  HWND hWndCombo = GetDlgItem(ghWndMain, IDD_DCOMBO);
  LRESULT nMatch;

  // if valid number
  if ( szNumber[0] )
  {
    // if list box has entries, check if this number
    // is already present.  If so delete old entry
    cNum = (WORD) SendMessage(hWndCombo, CB_GETCOUNT, 0, 0);
    if ( cNum != 0 )
    {
      nMatch = SendMessage ( hWndCombo, CB_FINDSTRING, 0, (LPARAM)szNumber );
      if ( nMatch != CB_ERR )
      {
        SendMessage(hWndCombo, CB_DELETESTRING, nMatch, 0);
      }
      else
      {
        // if the list is full, remove oldest
        if ( cNum == NLASTDIALED )
        {
          SendMessage( hWndCombo, CB_DELETESTRING, NLASTDIALED - 1, 0 );
        }
      }
    }
    SendMessage(hWndCombo, CB_INSERTSTRING, 0, (LPARAM)szNumber);
    SendMessage(hWndCombo, CB_SETCURSEL, 0, 0L);
    EnableWindow ( GetDlgItem( ghWndMain, IDD_DDIAL ), TRUE );
  }
}

VOID AmpersandCompensate | ( | LPCSTR | lpszSrc,
 |  | LPSTR | lpszDst
 | ) |  |

Definition at line 4086 of file Dialer.c.

{
  // check if the name has an & in it.  If so replace
  // it with &&.
  INT cCnt, cInd;

  for ( cCnt = 0, cInd = 0;
      cInd < TAPIMAXCALLEDPARTYSIZE;
      cInd++, cCnt++ )
  {
    if ( lpszSrc[ cCnt ] == '&' )
    {
      lpszDst[ cInd++ ] = '&';
    }
    lpszDst[ cInd ] = lpszSrc[ cCnt ];

    if ( lpszSrc[ cCnt ] == '\0' )
      break;
  }

  // make sure string is null terminated.
  lpszDst[ TAPIMAXCALLEDPARTYSIZE - 1 ] = '\0';

  return;
}

VOID AmpersandDeCompensate | ( | LPCSTR | lpszSrc,
 |  | LPSTR | lpszDst
 | ) |  |

Definition at line 4129 of file Dialer.c.

 {
  // check if the name has an & in it.  If so replace
  // it with &&.
  INT cCnt, cInd;

  for ( cCnt = 0, cInd = 0;
      cInd < TAPIMAXCALLEDPARTYSIZE;
      cInd++, cCnt++ )
  {
    if  ( ( lpszSrc[ cInd ] == '&' ) &&
        ( lpszSrc[ cInd + 1 ] == '&' ) )
    {
      cInd++;
    }
    lpszDst[ cCnt ] = lpszSrc[ cInd ] ;

    if ( lpszSrc [ cInd ] == '\0' )
    {
      break;
    }
  }

  lpszDst[ TAPIMAXCALLEDPARTYSIZE - 1 ] = '\0';

  return;
 }

VOID ButtonFontSetup ( VOID )

Definition at line 671 of file Dialer.c.

    {
    HDC hdc;
    int IDD;

    // define the fonts for the buttons
    hdc = GetDC(GetDesktopWindow());

    ghFontBtn = CreateFont(
        (-10)*GetDeviceCaps(hdc, LOGPIXELSY)/72,
        0,
        0,
        0,
        FW_BOLD,
        FALSE,
        FALSE,
        FALSE,
        ANSI_CHARSET,
        OUT_DEFAULT_PRECIS,
        CLIP_DEFAULT_PRECIS,
        PROOF_QUALITY,
        VARIABLE_PITCH | FF_SWISS,
        (LPSTR)"Arial"
        );

    ghFontBtnText = CreateFont(
        (-6)*GetDeviceCaps(hdc, LOGPIXELSY)/72,
        0,
        0,
        0,
        FW_NORMAL,
        FALSE,
        FALSE,
        FALSE,
        ANSI_CHARSET,
        OUT_DEFAULT_PRECIS,
        CLIP_DEFAULT_PRECIS,
        PROOF_QUALITY,
        VARIABLE_PITCH | FF_SWISS,
        NULL
        );

    ghFontBtnStar = CreateFont(
        (-18)*GetDeviceCaps(hdc, LOGPIXELSY)/72,
        0,
        0,
        0,
        FW_BOLD,
        FALSE,
        FALSE,
        FALSE,
        SYMBOL_CHARSET,
        OUT_TT_PRECIS,
        CLIP_DEFAULT_PRECIS,
        PROOF_QUALITY,
        VARIABLE_PITCH | FF_DONTCARE,
        (LPSTR)"Symbol"
        );

    ReleaseDC(GetDesktopWindow(), hdc);

    // set the fonts for the buttons
    if(ghFontBtn)
        {
        // set fonts on number buttons
            for(IDD = IDD_DBUTTON1; IDD <= IDD_DBUTTON0; ++IDD)
            // the order is IDD_DBUTTON1, 2, 3, ..., 0 (thus from 1 to 0)
            SendMessage(
                GetDlgItem(ghWndMain, IDD),
                WM_SETFONT,
                (WPARAM)ghFontBtn,
                0L
                );

        // set fonts on * and # buttons
        SendMessage(
            GetDlgItem(ghWndMain, IDD_DBUTTONSTAR),
            WM_SETFONT,
            (WPARAM)ghFontBtnStar,
            0L
            );
        SendMessage(
                    GetDlgItem(ghWndMain, IDD_DBUTTONPOUND),
            WM_SETFONT,
            (WPARAM)ghFontBtnStar,
            0L
            );
        }
    }

VOID CloseTAPI ( VOID )

Definition at line 996 of file Dialer.c.

{

  // unregister as call manager
  lineRegisterRequestRecipient (
                  ghLineApp,
                  0, // registration instance
                  LINEREQUESTMODE_MAKECALL,
                  FALSE
                 );

  if ( gCurrentLineInfo.hLine )
  {
    lineClose ( gCurrentLineInfo.hLine );
    gfCurrentLineAvail = FALSE;
    gCurrentLineInfo.hLine = (HLINE)((ULONG_PTR)NULL);
  }

  lineShutdown(ghLineApp);
}

BOOL CALLBACK ConnectUsingProc | ( | HWND | hwnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 2119 of file Dialer.c.

{
  switch(msg)
  {
    case WM_INITDIALOG:
    {
      BOOL fEnable;
      DWORD dwPriority;

      //
      // Is there any point in even showing this dialog box?
      if ( gnAvailDevices == 0 )
      {
        // Nope.  Let's tell the user what we don't like.
        errString ( ghWndMain, ERR_NOLINES, MB_ICONEXCLAMATION | MB_OK );

        EndDialog(hwnd, FALSE);
        return TRUE;
      }

      // if not brought up by InitializeTAPI()
      if ( lParam != INVALID_LINE )
      {
        // hide error text
        EnableWindow( GetDlgItem( hwnd, IDD_CUERRORTEXT ), FALSE );
      }

      // get list of lines into the line list box.
      fEnable = InitializeLineBox( GetDlgItem(hwnd, IDD_CULISTLINE) );
      EnableWindow( GetDlgItem( hwnd, IDD_CULISTLINE ), fEnable);

      // get list of addresses into the address list box.
      fEnable = fEnable &&
            InitializeAddressBox (
                        GetDlgItem(hwnd, IDD_CULISTLINE),
                        GetDlgItem(hwnd, IDD_CULISTADDRESS)
                       );
      EnableWindow( GetDlgItem( hwnd, IDD_CULISTADDRESS ), fEnable );
      EnableWindow( GetDlgItem( hwnd, IDOK ), fEnable );

      EnableWindow( GetDlgItem( hwnd, IDD_CUPROPERTIES ), fEnable );

      lineGetAppPriority (
                "DIALER.EXE",
                0, // checking app priority for Assisted Telephony requests
                NULL,
                LINEREQUESTMODE_MAKECALL,
                NULL,
                &dwPriority
                 );
      CheckDlgButton(hwnd, IDD_CUSIMPLETAPICHKBOX, (dwPriority == 1));

      // if dwPriority == 1, we're supporting Assisted Telephony AND
      // have the highest priority.
      EnableWindow (
              GetDlgItem(hwnd, IDD_CUSIMPLETAPICHKBOX),
              gfRegistered
             );

      return FALSE;
    }

    case WM_COMMAND:
    {
      switch ( LOWORD( (DWORD)wParam ) )
      {
        case IDD_CULISTLINE:
          if ( HIWORD( wParam ) == CBN_SELENDOK )
            // update address box
            InitializeAddressBox (
                        GetDlgItem(hwnd, IDD_CULISTLINE),
                        GetDlgItem(hwnd, IDD_CULISTADDRESS)
                       );
          break;

        case IDD_CUPROPERTIES:
        {
          HWND hW = GetDlgItem(hwnd, IDD_CULISTLINE);

          lineConfigDialog (
                    // device ID
                    (DWORD) SendMessage (
                                hW,
                                CB_GETITEMDATA,
                                (WORD) SendMessage(hW, CB_GETCURSEL, 0, 0),
                                0
                                ),
                    hwnd,
                    NULL
                   );
          break;
        }

        case IDOK:
        {
          HWND hwndBox;
          char szBuffer[MAXBUFSIZE];
          DWORD dwPriority;

          // Update line
          hwndBox = GetDlgItem( hwnd, IDD_CULISTLINE );
          giCurrentLine = (DWORD)SendMessage (
                          hwndBox,
                          CB_GETITEMDATA,
                          SendMessage( hwndBox, CB_GETCURSEL, 0, 0 ),
                          0
                        );

          // base 10
          itoa( gdwPLID[giCurrentLine], szBuffer, 10 );
          WritePrivateProfileString (
                        "Preference",
                        "Preferred Line",
                        szBuffer,
                        gszINIfilename
                        );

          // Update address
          hwndBox = GetDlgItem( hwnd, IDD_CULISTADDRESS );
          giCurrentAddress = (DWORD)SendMessage (
                          hwndBox,
                          CB_GETITEMDATA,
                          SendMessage(hwndBox, CB_GETCURSEL, 0, 0),
                          0
                           );

          itoa( giCurrentAddress, szBuffer, 10 );
          WritePrivateProfileString (
                        "Preference",
                        "Preferred Address",
                        szBuffer,
                        gszINIfilename
                        );

          // Update application priority
          if ( SendDlgItemMessage (
                        hwnd,
                        IDD_CUSIMPLETAPICHKBOX,
                        BM_GETCHECK,
                        0,
                        0L
                      )
              == 0)
          {
            dwPriority = 0;
          }
          else
          {
            dwPriority = 1;
          }

          lineSetAppPriority (
                    "DIALER.EXE",
                    0,
                    NULL,
                    LINEREQUESTMODE_MAKECALL,
                    NULL,
                    dwPriority
                     );

          EndDialog(hwnd, TRUE);
          return TRUE;
        }

        case IDCANCEL:
          EndDialog(hwnd, FALSE);
          return TRUE;
      }
    }

    default:
        ;

  }

  return FALSE;
}

LPVOID DialerAlloc ( size_t cbToAlloc )

Definition at line 520 of file Dialer.c.

{
  return LocalAlloc(LPTR, cbToAlloc);
}

VOID DialerCleanup ( VOID )

Definition at line 933 of file Dialer.c.

    {
    RECT rc;
    WORD cItem; // count of numbers in combo box
    DWORD cLastDialed;
    char szPt[MAXBUFSIZE];
    char szNumber[TAPIMAXDESTADDRESSSIZE];
    char szFieldName[MAXBUFSIZE];

    CloseTAPI(); // unregister and line close

    if(!IsIconic(ghWndMain)) // if the window is not minimized, record position
        {
        GetWindowRect(ghWndMain, &rc);
        wsprintf(szPt, "%ld, %ld", rc.left, rc.top);
        WritePrivateProfileString(
            "Preference",
            "Main Window Left/Top",
            szPt,
            gszINIfilename
            );
        }

    cItem = (WORD)SendDlgItemMessage(ghWndMain, IDD_DCOMBO, CB_GETCOUNT, 0, 0);

    // write out last dialed numbers from combo box (write to INI)
    for(cLastDialed = 1; cLastDialed <= NLASTDIALED; ++cLastDialed)
        {
        if(cLastDialed <= cItem)
            SendDlgItemMessage(
                ghWndMain,
                IDD_DCOMBO,
                CB_GETLBTEXT,
                cLastDialed - 1, // it's a zero-based count
                (LPARAM)(LPCSTR)szNumber);

        else
            szNumber[0] = 0;

        wsprintf(szFieldName, "Last dialed %d", cLastDialed);
        WritePrivateProfileString(
            "Last dialed numbers",
            szFieldName,
            szNumber,
            gszINIfilename
            );

        }

    DestroyWindow(ghWndMain);
    ghWndMain = NULL;

    DeleteObject(ghFontBtn);
    DeleteObject(ghFontBtnText);
    DeleteObject(ghFontBtnStar);
    }

LPVOID DialerFree ( LPVOID lpMem )

Definition at line 526 of file Dialer.c.

{
  return LocalFree( lpMem );
}

VOID DialerLineClose ( VOID )
VOID DialerLineClose ( )

Definition at line 3419 of file Dialer.c.

{
  DWORD errCode;

  if ( gCurrentLineInfo.hLine )
  {
    if ( errCode = lineClose ( gCurrentLineInfo.hLine ) )
    {
      errString ( ghWndMain, errCode, MB_ICONSTOP | MB_OK );
    }
    gCurrentLineInfo.hLine = (HLINE)((ULONG_PTR)NULL);
  }

  // re-initialize TAPI if it needs to be re-initialized
  if ( gfNeedToReinit )
  {
    CloseTAPI();

    errCode = InitializeTAPI();
    if(errCode)
    {
      errString(ghWndMain, errCode, MB_APPLMODAL | MB_ICONEXCLAMATION );
      DialerCleanup(); // terminate program if we can't init
      return;
    }

    errCode = lineRegisterRequestRecipient (
                        ghLineApp,
                        0,
                        LINEREQUESTMODE_MAKECALL,
                        TRUE
                         );
    if (errCode)
    {
      errString(ghWndMain, errCode, MB_ICONEXCLAMATION | MB_OK );
    }

    gfNeedToReinit = FALSE;
  }
}

BOOL CALLBACK DialingProc | ( | HWND | hwnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 2020 of file Dialer.c.

{

  switch(msg)
  {
    char szTemp[ TAPIMAXCALLEDPARTYSIZE ];

    case WM_INITDIALOG:
      // set global handle to window
      ghWndDialing = hwnd;

      AmpersandCompensate( gszCurrentName, szTemp );

      SetDlgItemText(hwnd, IDD_DGNUMBERTEXT, gszCurrentNumber);
      SetDlgItemText(hwnd, IDD_DGNAMETEXT, szTemp );
      break;

    case WM_COMMAND:
      switch ( LOWORD( (DWORD)wParam ) )
      {
        // hang up
        case IDCANCEL:
          //gfDropping = TRUE;

          // if lineMakeCall has completed
          // only then drop call.
          if ( !gfMakeCallReplyPending && ghCall )
          {
            if ( ( gDropCallRequestID = lineDrop ( ghCall, NULL, 0 ) ) < 0 )
            {
              errString ( ghWndDialing, gDropCallRequestID, MB_ICONSTOP | MB_OK );
            }
          }
          else
          {
            DialerLineClose();
            gfCurrentLineAvail = TRUE;
            gfMakeCallReplyPending = FALSE;
          }

          ghWndDialing = NULL;
          EndDialog(hwnd, FALSE);

          return TRUE;

        // something else terminated the call
        // all we have to do is terminate this dialog box
        case IDOK:
          ghWndDialing = NULL;
          EndDialog(hwnd, TRUE);

          return TRUE;
      }
      break;

    default:
      ;
  }
  return FALSE;
}

VOID DisableDialButtons ( BOOL fDisable )

Definition at line 914 of file Dialer.c.

{
  int IDD;

  // Disable/enable Dial button
  EnableWindow( GetDlgItem( ghWndMain, IDD_DDIAL ),!fDisable) ;

  // Disable/enable Speed dial buttons
  for ( IDD = IDD_DSPEEDDIAL1; IDD <= IDD_DSPEEDDIAL8; ++IDD )
  {
    EnableWindow(GetDlgItem(ghWndMain, IDD),!fDisable);
  }
}

VOID DrawButton | ( | HDC | hdc,
 |  | RECT | rcBtn,
 |  | BOOL | fHighlighted
 | ) |  |

Definition at line 768 of file Dialer.c.

    {
    HPEN hPenPrev, hPenShadow, hPenHighlight, hPenBlack;
    HBRUSH hBrushPrev, hBrushFace;
    int RopPrev;

    --rcBtn.right;
    --rcBtn.bottom;

    // set up pens/brush
    hPenShadow = CreatePen(PS_SOLID,0,GetSysColor(COLOR_3DSHADOW));
    hPenHighlight = CreatePen(PS_SOLID,0,GetSysColor(COLOR_3DHILIGHT));
    hPenBlack = GetStockObject(BLACK_PEN);
    hBrushFace = GetSysColorBrush(COLOR_3DFACE);

    // get current state so we can put it back at the end of DrawButton
    hPenPrev = SelectObject(hDC, hPenBlack);
    RopPrev = SetROP2(hDC, R2_COPYPEN);
    hBrushPrev = SelectObject(hDC, hBrushFace);

    PatBlt(
        hDC,
        rcBtn.left + 1,
        rcBtn.top + 1,
        rcBtn.right - rcBtn.left - 1,
        rcBtn.bottom - rcBtn.top - 1,
        PATCOPY
        );

    if(fHighlighted)
        {
        SelectObject(hDC, hPenBlack);
        MoveToEx(hDC, rcBtn.left, rcBtn.bottom - 1, NULL);
        LineTo(hDC, rcBtn.left, rcBtn.top);  //  _
        LineTo(hDC, rcBtn.right, rcBtn.top); // |

        SelectObject(hDC, hPenHighlight);
        MoveToEx(hDC, rcBtn.right, rcBtn.top, NULL);
        LineTo(hDC, rcBtn.right, rcBtn.bottom);
        LineTo(hDC, rcBtn.left - 1, rcBtn.bottom); // _|

        SelectObject(hDC, hPenShadow);
        MoveToEx(hDC, rcBtn.left + 1, rcBtn.bottom - 2, NULL);
        LineTo(hDC, rcBtn.left + 1, rcBtn.top + 1);
        LineTo(hDC, rcBtn.right - 1, rcBtn.top + 1);
        }
    else
        {
        SelectObject(hDC, hPenHighlight);
        MoveToEx(hDC, rcBtn.left, rcBtn.bottom - 1, NULL);
        LineTo(hDC, rcBtn.left, rcBtn.top);  //  _
        LineTo(hDC, rcBtn.right, rcBtn.top); // |

        SelectObject(hDC, hPenBlack);
        MoveToEx(hDC, rcBtn.right, rcBtn.top, NULL);
        LineTo(hDC, rcBtn.right, rcBtn.bottom);
        LineTo(hDC, rcBtn.left - 1, rcBtn.bottom); // _|

        SelectObject(hDC, hPenShadow);
        MoveToEx(hDC, rcBtn.left + 1, rcBtn.bottom - 1, NULL);
        LineTo(hDC, rcBtn.right - 1, rcBtn.bottom - 1);
        LineTo(hDC, rcBtn.right - 1, rcBtn.top);
        }

    // put everything back how it was
    SetROP2(hDC, RopPrev);
    SelectObject(hDC, hBrushPrev);
    SelectObject(hDC, hPenPrev);

    DeleteObject(hPenBlack);
    DeleteObject(hPenShadow);
    DeleteObject(hPenHighlight);
    DeleteObject(hBrushFace);
    }

VOID DrawButtonText | ( | HDC | hdc,
 |  | RECT | rcBtn,
 |  | BOOL | fHighlighted,
 |  | UINT | IDD_Btn
 | ) |  |

Definition at line 848 of file Dialer.c.

    {
    char szLine1[MAXBUFSIZE]; // text in button up to '\n'
    LPSTR pszLine2; // text in button after '\n'
    int BkModePrev;
    HFONT hFontPrev = NULL;
    TEXTMETRIC tm;
    RECT rcText = rcBtn;

    BkModePrev = SetBkMode(hDC, TRANSPARENT);

    GetDlgItemText(ghWndMain, IDD_Btn, szLine1, MAXBUFSIZE);
    pszLine2 = strstr(szLine1, "\n");
    if(pszLine2)
        {
        *pszLine2 = 0; // 1 -> "TEST1 \n TEST2" becomes "TEST 1 \0"
        ++pszLine2; // now 2 -> " TEST 2"
        }

    // now szLine1 points to the null terminated first string and
    // pszLine2 points to either the null terminated second string or NULL
    // if there was no second string

    if(szLine1[0])
        {
        if(ghFontBtnText && pszLine2)
            hFontPrev = SelectObject(hDC, ghFontBtnText);

        GetTextMetrics(hDC, &tm);
        rcText.bottom = (rcBtn.bottom + rcBtn.top)/2 - 2;
        rcText.top = rcText.bottom - (tm.tmHeight - 1);

        if(pszLine2 == NULL)
            OffsetRect(&rcText, 0, (rcText.bottom - rcText.top)/2);

        if(fHighlighted)
            OffsetRect(&rcText, 1, 1);

        DrawText(hDC, szLine1, -1, &rcText, DT_SINGLELINE | DT_CENTER);

        if(hFontPrev)
            SelectObject(hDC, hFontPrev);
        }
    if(pszLine2) // recall that pszLine2 == NULL to represent no second string
        {
        GetTextMetrics(hDC, &tm);
        if(IDD_Btn == IDD_DBUTTONSTAR || IDD_Btn == IDD_DBUTTONPOUND)
            rcText.top = (rcBtn.bottom + rcBtn.top)/2 - (tm.tmHeight)/2;
        else
            rcText.top = (rcBtn.bottom + rcBtn.top)/2 - 2;
        rcText.bottom = rcText.top + tm.tmHeight;

        if(fHighlighted)
            OffsetRect(&rcText, 1, 1);

        DrawText(hDC, pszLine2, -1, &rcText, DT_SINGLELINE | DT_CENTER);
        }

    SetBkMode(hDC, BkModePrev);
    }

int errString | ( | HWND | hWnd,
 |  | UINT | errCode,
 |  | UINT | uFlags
 | ) |  |

Definition at line 3466 of file Dialer.c.

{
  PTSTR ptStrTitle;
  PTSTR ptStrError;
  int   nResult;
    BOOL  bDefault = FALSE;

  ptStrTitle = DialerAlloc( MAXBUFSIZE );
  if ( NULL == ptStrTitle )
  {
     // Now, _this_ is a problem.
     return 0;
  }

  ptStrError = DialerAlloc( MAXBUFSIZE );
  if ( NULL == ptStrError )
  {
     // Now, _this_ is a problem.
     DialerFree( ptStrTitle);
     return 0;
  }

  switch(errCode)
  {
    case ERR_NOLINES:
      errCode = ikszErrNoVoiceLine;
      break;

    case ERR_NOVOICELINE:
      errCode = ikszErrNoVoiceLine;
      break;

    case ERR_LINECLOSE:
      errCode = ikszErrLineClose;
      break;

    case ERR_911WARN:
      errCode = ikszWarningFor911;
      break;

    case ERR_NEWDEFAULT:
      errCode = ikszWarningNewDefault;
      break;

    case LINEERR_NODRIVER:
      errCode = ikszErrLineInitNoDriver;
      break;

    case LINEERR_NODEVICE:
      errCode = ikszErrLineInitNoDevice;
      break;

    case LINEERR_INIFILECORRUPT:
      errCode = ikszErrLineInitBadIniFile ;
      break;

    case LINEERR_NOMEM:
      errCode = ikszErrOOM;
      break;

    case LINEERR_INCOMPATIBLEAPIVERSION:
      errCode = ikszErrLineInitWrongDrivers ;
      break;

    case LINEERR_OPERATIONFAILED:
      errCode = ikszErrTAPI;
      break;

    case LINEERR_INVALADDRESS:
      errCode = ikszErrInvalAddress;
      break;

    case LINEERR_ADDRESSBLOCKED:
      errCode = ikszErrAddrBlocked;
      break;

    case LINEERR_BILLINGREJECTED:
      errCode = ikszErrBillingRejected;
      break;

    case LINEERR_RESOURCEUNAVAIL:
    case LINEERR_ALLOCATED:
    case LINEERR_INUSE:
      errCode = ikszErrResUnavail;
      break;

    case LINEERR_NOMULTIPLEINSTANCE:
      errCode = ikszErrNoMultipleInstance;
      break;

    case LINEERR_INVALCALLSTATE:
      errCode = ikszErrInvalCallState;
      break;

        case LINEERR_INVALCOUNTRYCODE:
            errCode = ikszErrInvalidCountryCode;
            break;

    default:
            bDefault = TRUE;
            break;

  }

    if (bDefault)
    {
        // if using default error, get TAPI's
        // error message from FormatError()
        if (!FormatMessage(FORMAT_MESSAGE_FROM_HMODULE,
                           (LPCVOID)GetModuleHandle(TEXT("TAPI32.DLL")),
                           (DWORD)TAPIERROR_FORMATMESSAGE(errCode),
                           0,
                           (LPTSTR)ptStrError,
                           MAXBUFSIZE,
                           NULL))
        {
            // if this fails, fall back on default
            LoadString( ghInst, ikszErrDefault, ptStrError, MAXBUFSIZE);
        }

    }
    else    // not the default error message
    {

        if ( 0 == LoadString( ghInst, errCode, ptStrError, MAXBUFSIZE ) )
        {
#if DBG
            TCHAR buf[200];
            wsprintf( buf, "Cannot load string: hinst:0x%p errcode: %ld", ghInst,(DWORD)errCode);
            OutputDebugString( buf );
            MessageBox( NULL, buf, "Dialer", MB_OK);
#endif

            LoadString( ghInst, ikszErrDefault, ptStrError, MAXBUFSIZE );
        }
    }

    LoadString( ghInst, ikszWarningTitle, ptStrTitle, MAXBUFSIZE );

  nResult = MessageBox( hWndOwner, ptStrError, ptStrTitle, uFlags );

  DialerFree( ptStrTitle );
  DialerFree( ptStrError );

  return nResult;
}

VOID FitTextToButton | ( | HWND | hDlg,
 |  | INT | nButtonID,
 |  | LPSTR | szName
 | ) |  |

Definition at line 3634 of file Dialer.c.

{

  HDC hDC = 0;
  HFONT hFont = 0, hOldFont = 0;
  HWND hWnd = 0;

  do
  {
    // calculate number of chars. that can fit on
    // the button
    int nLen;
    RECT rect;
    SIZE size;
    POINT pt;
    char buf [TAPIMAXCALLEDPARTYSIZE + 1];

    // get button dimensions
    hWnd = GetDlgItem( hDlg, nButtonID );
    if ( hWnd == NULL )
      break;

    if ( !GetClientRect( hWnd, &rect ) )
      break;

    // get character dimensions
    hDC = GetDC( hWnd );
    if ( hDC == NULL )
      break;

    hFont = (HFONT) SendMessage( hWnd, WM_GETFONT, 0, 0 );
    if ( hFont == NULL )
      hOldFont = SelectObject( hDC, GetStockObject( SYSTEM_FONT ) );
    else
      hOldFont = SelectObject( hDC, hFont );

    // add an extra char at the end to compensate for
    // leading space,
    strncpy ( buf, szName, TAPIMAXCALLEDPARTYSIZE );
    buf[TAPIMAXCALLEDPARTYSIZE] = '\0';
    nLen = lstrlen( buf );
    buf [ nLen ] = 'X';
    buf [ nLen + 1 ] = '\0';

    if ( !GetTextExtentPoint32( hDC, buf, nLen + 1, &size ) )
      break;

    pt.x = size.cx;
    if ( !LPtoDP( hDC, &pt, 1 ) )
      break;

    // check if name fits on button
    if (  pt.x > rect.right )
    {
      // find how much of the name fits
      int i = 0;

      nLen = lstrlen( szName );
      for ( i = 0; i < nLen; i++ )
      {
        buf[ i ] = szName[ i ];
        // an extra char is stuffed to compensate for the
        // leading space left by the left alignment
        buf [ i + 1 ] = 'X';
        buf [ i + 2 ] = '\0';

        // break out in cases of error condition
        if ( !GetTextExtentPoint32( hDC, buf, i + 2, &size ) )
        {
          i = nLen;
          break;
        }

        pt.x = size.cx;
        if ( !LPtoDP( hDC, &pt, 1 ) )
        {
          i = nLen;
          break;
        }

        if ( pt.x > rect.right )
          break;
      }

            // error
      if ( i >= nLen )
        break;

      // name is too long. truncate and add ellipses
      if (nLen > 3)
      {
        szName [i - 3] = '\0';
        strncat( szName, "...", 3);
      }

    }

  } while( FALSE );

  if ( hDC )
  {
    SelectObject( hDC, hOldFont );
    ReleaseDC( hWnd, hDC );
  }

  return;
}

LPSTR GetAddressName | ( | DWORD | iLine,
 |  | DWORD | iAddress
 | ) |  |

Definition at line 1937 of file Dialer.c.

{
  DWORD errCode = 0;
  DWORD dwNeededSize = 0;
  LPSTR pszAddressName = NULL;
  LPLINEADDRESSCAPS lpAddressCaps = NULL;

  // allocate space for lineGetAddressCaps data
  dwNeededSize = sizeof( LINEADDRESSCAPS );

  do
  {
    lpAddressCaps = ( LPLINEADDRESSCAPS )DialerAlloc( dwNeededSize );
    if ( !lpAddressCaps )
    {
      goto error;
    }

    lpAddressCaps->dwTotalSize = dwNeededSize;
    errCode = lineGetAddressCaps (
                    ghLineApp,
                    iLine,
                    iAddress,
                    gCurrentLineInfo.dwAPIVersion,
                    0,
                    lpAddressCaps
                   );
    if ( errCode )
    {
      errString( ghWndMain, errCode, MB_ICONSTOP | MB_OK );
      goto error;
    }

    if ( lpAddressCaps-> dwNeededSize <= lpAddressCaps-> dwTotalSize )
    {
      break;
    }

    dwNeededSize = lpAddressCaps->dwNeededSize;
    DialerFree( lpAddressCaps );
    lpAddressCaps = NULL;

  } while( TRUE );

  // get the address name
  pszAddressName = DialerAlloc( MAXBUFSIZE );
  if ( !pszAddressName )
  {
    goto error;
  }

  if ( lpAddressCaps-> dwAddressSize > 0 )
  {
    // keep string length bounded
      strncpy(
          pszAddressName,
          (LPSTR) lpAddressCaps + lpAddressCaps->dwAddressOffset,
          MAXBUFSIZE - 1
           );
      pszAddressName[ MAXBUFSIZE - 1] = '\0';

  }
  else
  // use default name
  {
    wsprintf(pszAddressName, "Address %d", iAddress);
  }

error:
  if ( lpAddressCaps )
  {
    DialerFree( lpAddressCaps );
  }

  return pszAddressName;
}

DWORD GetLineInfo | ( | DWORD | iLine,
 |  | LPLINEINFO | lpLineInfo
 | ) |  |

Definition at line 1812 of file Dialer.c.

{
  DWORD errCode = 0;
  DWORD dwNeededSize = 0;
  LINEEXTENSIONID ExtensionID;

  LPSTR pszLineName = NULL;
  LPLINEDEVCAPS lpDevCaps = NULL;

  errCode = lineNegotiateAPIVersion (
                    ghLineApp,
                    iLine,
                    TAPI_VERSION_1_0,
                    TAPI_CURRENT_VERSION,
                    &( lpLineInfo->dwAPIVersion ),
                    &ExtensionID
                    );
  if ( errCode )
  {
    GetLineInfoFailed( iLine, lpDevCaps, lpLineInfo );
    goto error;
  }

  dwNeededSize = sizeof( LINEDEVCAPS );
  do
  {
    lpDevCaps = ( LPLINEDEVCAPS ) DialerAlloc( dwNeededSize );
    if ( !lpDevCaps )
    {
      GetLineInfoFailed( iLine, lpDevCaps, lpLineInfo );
      errCode = LINEERR_NOMEM;
      goto error;
    }

    lpDevCaps->dwTotalSize = dwNeededSize;
    errCode = lineGetDevCaps (
                  ghLineApp,
                  iLine,
                  lpLineInfo->dwAPIVersion,
                  0,
                  lpDevCaps
                 );
    if ( errCode )
    {
      GetLineInfoFailed( iLine, lpDevCaps, lpLineInfo );
      goto error;
    }

    if ( lpDevCaps-> dwNeededSize <= lpDevCaps-> dwTotalSize )
    {
      break;
    }

    dwNeededSize = lpDevCaps->dwNeededSize;
    DialerFree( lpDevCaps );
    lpDevCaps = NULL;

  } while ( TRUE );

  lpLineInfo->nAddr = lpDevCaps->dwNumAddresses;
  lpLineInfo->fVoiceLine =
    ( (lpDevCaps->dwMediaModes & LINEMEDIAMODE_INTERACTIVEVOICE) != 0 );

  pszLineName = (LPSTR) DialerAlloc( MAXBUFSIZE );
  if ( !pszLineName )
  {
    errCode = LINEERR_NOMEM;
    goto error;
  }
  if ( lpDevCaps->dwLineNameSize > 0 )
  {
    strncpy (
         pszLineName,
         (LPSTR) lpDevCaps + lpDevCaps->dwLineNameOffset,
         MAXBUFSIZE - 1
        );

    pszLineName[ MAXBUFSIZE - 1 ] = '\0';

  }
  else
  {
    wsprintf ( pszLineName, "Line %d", iLine );
  }

  strncpy( lpLineInfo->szLineName, pszLineName,MAXBUFSIZE - 1 );
  lpLineInfo->szLineName[ MAXBUFSIZE - 1 ] = '\0';
  lpLineInfo->dwPermanentLineID = lpDevCaps->dwPermanentLineID;

error:
  if ( lpDevCaps )
    DialerFree( lpDevCaps );

  if ( pszLineName )
    DialerFree( pszLineName );

  return errCode;
}

VOID GetLineInfoFailed | ( | DWORD | iLine,
 |  | LPLINEDEVCAPS | lpDevCaps,
 |  | LPLINEINFO | lpLineInfo
 | ) |  |

Definition at line 1919 of file Dialer.c.

{
  if ( lpDevCaps )
    DialerFree(lpDevCaps);

  lpLineInfo->nAddr = 0;
  lpLineInfo->fVoiceLine = FALSE;
  lpLineInfo->dwAPIVersion = 0;
  lpLineInfo->hLine = (HLINE)0;
  lpLineInfo->dwPermanentLineID = 0;
  lpLineInfo->szLineName[0] = 0;
}

BOOL InitializeAddressBox | ( | HWND | hwndLineBox,
 |  | HWND | hwndAddressBox
 | ) |  |

Definition at line 3256 of file Dialer.c.

{
  DWORD errCode;
  DWORD iAddress, iItem, iItemCurrent = (DWORD)-1;
  DWORD iLineBoxCurrent;
  LPSTR pszAddressName;

  if ( SendMessage( hwndLineBox, CB_GETCOUNT, 0, 0 ) == 0 )
  {
    return FALSE;
  }

  // select current entry in line box
  iLineBoxCurrent = (DWORD)SendMessage (
                  hwndLineBox,
                  CB_GETITEMDATA,
                  SendMessage( hwndLineBox, CB_GETCURSEL, 0, 0 ),
                  0
                  );
  // empty address list box
  SendMessage ( hwndAddressBox, CB_RESETCONTENT, 0, 0);

  // get all the address for this line
  for ( iAddress = 0; iAddress < gnAddr[iLineBoxCurrent]; ++iAddress )
  {
    pszAddressName = GetAddressName( iLineBoxCurrent, iAddress );

    // if this address if fails, try the next one
    if ( !pszAddressName )
      continue;

    iItem = (DWORD)SendMessage (
                hwndAddressBox,
                CB_ADDSTRING,
                0,
                (LPARAM) (LPCSTR) (pszAddressName)
              );

    // error, bail out
    if ( iItem == CB_ERR || iItem == CB_ERRSPACE )
      return FALSE;

    errCode = (DWORD)SendMessage (
                hwndAddressBox,
                CB_SETITEMDATA,
                (WPARAM) iItem,
                (LPARAM) iAddress
                );

    if ( iLineBoxCurrent == giCurrentLine )
    {
      if(iAddress == giCurrentAddress)
      {
        iItemCurrent = iItem;
      }
      else
      {
        // if the item we are putting is before the
        // "current" item, we must increment iItemCur
        // to reflect that something is being placed
        // before it, due to sorting
        if ( iItemCurrent != -1 && iItem <= iItemCurrent )
        {
          ++iItemCurrent;
        }
      }
    }

    DialerFree( pszAddressName );
  }

  if ( iLineBoxCurrent != giCurrentLine )
  {
    // if we're not looking at the current line
    // then highlight address 0
    iItemCurrent = 0;
  }

  SendMessage (
          hwndAddressBox,
          CB_SETCURSEL,
          iItemCurrent,
          0
        );
  return TRUE;
}

BOOL InitializeLineBox ( HWND hwndLineBox )

Definition at line 3166 of file Dialer.c.

{

  DWORD iLine, iItem, iItemCurrent = (DWORD)-1;
  DWORD errCode;

  LPLINEINFO lpLineInfo = NULL;

  // allocate buffer for storing LINEINFO for all of
  // the available lines.  Always allocate space for
  // at least one line
  if ( gnAvailDevices == 0 )
  {
    lpLineInfo = (LPLINEINFO) DialerAlloc( sizeof(LINEINFO) );
  }
  else
  {
    lpLineInfo = (LPLINEINFO) DialerAlloc ( sizeof(LINEINFO) * (int)gnAvailDevices );
  }

  // if no space was set aside...
  if ( lpLineInfo == NULL )
    return LINEERR_NOMEM;

  // fill lpLineInfo[] and open each line
  for ( iLine = 0; iLine < gnAvailDevices; ++iLine )
  {
    // skip remaining processing for this line if it didn't open
    if ( GetLineInfo( iLine, &lpLineInfo[iLine] ) != ERR_NONE )
    {
      continue;
    }

    iItem = (DWORD)SendMessage (
                hwndLineBox,
                CB_ADDSTRING,
                0,
                (LPARAM)(LPCSTR)(lpLineInfo[iLine].szLineName)
              );

    // error, bail out.
    if ( iItem == CB_ERR || iItem == CB_ERRSPACE )
    {
            if (lpLineInfo)
            {
                DialerFree(lpLineInfo);
            }

      return FALSE;
    }

    errCode = (DWORD)SendMessage (
                hwndLineBox,
                CB_SETITEMDATA,
                (WPARAM)iItem,
                (LPARAM)iLine
                );

    if ( iLine == giCurrentLine )
    {
      iItemCurrent = iItem;
    }
    else if ( iItemCurrent != -1 && iItem <= iItemCurrent )
    {
      // if the item we are putting is before the
      // "current" item, we must increment iItemCurrent
      // to reflect that something is being placed before
      // it, due to sorting
      ++iItemCurrent;
    }
  }

  if ( iItemCurrent == (DWORD)-1 )
    iItemCurrent = 0;

  if ( SendMessage( hwndLineBox, CB_GETCOUNT, 0, 0) != 0 )
  {
    SendMessage( hwndLineBox, CB_SETCURSEL, (WPARAM)iItemCurrent, 0 );
    return TRUE;
  }

    DialerFree(lpLineInfo);
  return FALSE;
}

DWORD InitializeTAPI ( VOID )

Definition at line 156 of file Dialer.c.

{
  INT cvLine;

  DWORD iLine;
  DWORD dwPreferredPLID, dwID = (DWORD) -1;

  MSG msg;

  LPLINEINFO lpLineInfo = NULL; // LINEINFO for each available line

    DWORD errCode;
    DWORD tc = GetTickCount();
    DWORD dwReturn = ERR_NONE;

  char szBuffer[MAXBUFSIZE];    // to read in dwPreferredPLID as a string first

  errCode = lineInitialize (
                &ghLineApp,
                ghInst,
                (LINECALLBACK) tapiCallback,
                gszAppName,
                &gnAvailDevices
               );
  if ( errCode == LINEERR_REINIT )
  {
    // take away dialer functionality
    EnableWindow( ghWndMain, FALSE );
    DisableDialButtons(TRUE);

    // keep trying until the user cancels
    // or we stop getting LINEERR_REINIT
    while ( ( errCode = lineInitialize (
                      &ghLineApp,
                      ghInst,
                      (LINECALLBACK)tapiCallback,
                      gszAppName,
                      &gnAvailDevices
                        ) )
         == LINEERR_REINIT )
    {
      // flush queue & yield
      while ( PeekMessage( &msg, 0, 0, 0, PM_REMOVE ) )
      {
        TranslateMessage( &msg );
        DispatchMessage( &msg );
      }

      // bring up the box if 5 seconds have passed since
      if(GetTickCount() > 5000 + tc)
      {
        if ( errString( ghWndMain, ikszWarningTapiReInit, MB_RETRYCANCEL )
           == IDCANCEL )
        {
          break;
        }
        // reset the relative counter
        tc = GetTickCount();
      }
    }

    // give back dialer functionality
    DisableDialButtons( FALSE );
    EnableWindow( ghWndMain, TRUE );
  }

  if ( errCode )
    {
        dwReturn = errCode;
        goto tapiinit_exit;
    }

  // retrieve preferred line info from INI file
  GetPrivateProfileString (
                "Preference",
                "Preferred Line",
                gszNULL,
                szBuffer,
                MAXBUFSIZE,
                gszINIfilename
              );

  // if szBuffer is not empty.
  if ( lstrcmp ( gszNULL, szBuffer ) )
  {
    dwPreferredPLID = (DWORD) atoi( szBuffer );
  }
  else
  {
    dwPreferredPLID = (DWORD) -1;
  }

  // -1 default - tells us if it ever gets set
  giCurrentLine = (DWORD) -1;

  // allocate buffer for storing LINEINFO for all of the available lines
  // always allocate space for at least one line
  if ( gnAvailDevices == 0 )
  {
    gnAddr = (DWORD *) DialerAlloc( sizeof( DWORD ) );
    gdwPLID = (DWORD *) DialerAlloc( sizeof( DWORD ) );
    lpLineInfo = (LPLINEINFO) DialerAlloc( sizeof( LINEINFO ) );
  }
  else
  {
    gnAddr = (DWORD *) DialerAlloc( sizeof( DWORD ) * (int)gnAvailDevices);
    gdwPLID = (DWORD *) DialerAlloc( sizeof( DWORD ) * (int)gnAvailDevices);
    lpLineInfo = (LPLINEINFO) DialerAlloc( sizeof( LINEINFO ) * (int)gnAvailDevices );
  }

  // if no space was set aside...
  if ( lpLineInfo == NULL || gdwPLID == NULL || gnAddr == NULL )
    {
        dwReturn = LINEERR_NOMEM;
        goto tapiinit_exit;
    }

  // fill lpLineInfo[] and open each line
  for ( iLine = 0, cvLine = 0; iLine < gnAvailDevices; ++iLine )
  {
    // skip remaining processing for this if it didn't open
    if ( GetLineInfo( iLine, &lpLineInfo[iLine] ) != ERR_NONE )
      continue;

    gnAddr [ iLine ] = lpLineInfo[iLine].nAddr;
    gdwPLID[ iLine ] = lpLineInfo[iLine].dwPermanentLineID;

    if ( lpLineInfo[iLine].dwPermanentLineID == dwPreferredPLID )
      giCurrentLine = iLine;

    // note number of lines with Interactive voice caps.
    // used to select a preferred line by default
    if ( lpLineInfo [ iLine ].fVoiceLine )
    {
      cvLine++;
      dwID = iLine;
    }
  }

  // if we couldn't find the preferred line,
  // try and assign one by default
  // else bring up connect using dialog
  if (  giCurrentLine == (DWORD)-1 )
  {
    // check if there is only one line
    // that has interactive voice caps,
    // make it default line
    if ( cvLine == 1 )
    {
      giCurrentLine = dwID;

      // if the preferred address read from the INI file
      // was different i.e we are changing setting, inform
      // the user
      if ( dwPreferredPLID != -1 )
      {
        errString( ghWndMain, ERR_NEWDEFAULT, MB_ICONEXCLAMATION | MB_OK );
      }
    }
    else
    {
      gCurrentLineInfo = lpLineInfo[0];
      if ( DialogBoxParam (
                  ghInst,
                  MAKEINTRESOURCE(IDD_CONNECTUSING),
                  ghWndMain,
                  (DLGPROC)ConnectUsingProc,
                  INVALID_LINE
                )
         == -1)
      {
                dwReturn = (DWORD) -1;
      }
      else
      {
                dwReturn = ERR_NONE;
      }

            goto tapiinit_exit;
    }
  }
  gCurrentLineInfo = lpLineInfo[ giCurrentLine ];

  // select default address
  giCurrentAddress = 0;

  // get the name of the preferred address from ini file
  GetPrivateProfileString (
                "Preference",
                "Preferred Address",
                gszNULL,
                szBuffer,
                MAXBUFSIZE,
                gszINIfilename
              );

  // if preferred address read from INI file
  if ( lstrcmp( gszNULL, szBuffer ) )
  {
    giCurrentAddress = (DWORD) atoi( szBuffer );

    // if the address is invalid, set default
    if ( giCurrentAddress >= gCurrentLineInfo.nAddr )
      giCurrentAddress = 0;
  }

tapiinit_exit:

    if (lpLineInfo)
    {
        DialerFree(lpLineInfo);
    }

  return dwReturn;;
}

VOID InitiateCall | ( | LPCSTR | szNumber,
 |  | LPCSTR | szName
 | ) |  |

Definition at line 1548 of file Dialer.c.

{
  HLINE hLine = (HLINE)((ULONG_PTR)NULL);

  DWORD errCode;

  // struct size info
  DWORD dwLTPSize = sizeof ( LINETRANSLATEOUTPUT );
  DWORD dwNameLen = lstrlen( szName ) + 1;
  DWORD dwLCPSize = sizeof( LINECALLPARAMS );

  LPLINETRANSLATEOUTPUT lpTransOut = NULL;
  LPLINECALLPARAMS lpLineCallParams = NULL;

  char szCanNumber[ TAPIMAXDESTADDRESSSIZE ];

  DWORD dwRemainingLength ;

  // Open a line
  errCode = lineOpen (
            ghLineApp,
            giCurrentLine,
            &hLine,
            gCurrentLineInfo.dwAPIVersion,
            0,
            0,
            LINECALLPRIVILEGE_NONE,
            0,
            NULL
             );
  if (errCode)
  {
    errString ( ghWndMain, errCode, MB_ICONEXCLAMATION | MB_OK );
    goto error;
  }

  // call translate address before dialing
  do
  {
    lpTransOut = (LPLINETRANSLATEOUTPUT) DialerAlloc( dwLTPSize );
    if ( !lpTransOut )
    {
      errString( ghWndMain, LINEERR_NOMEM, MB_ICONSTOP | MB_OK );
      goto error;
    }
    lpTransOut-> dwTotalSize = dwLTPSize;

    if ( !MakeCanonicalNumber( szNumber, szCanNumber ) )
    {
      strncpy( szCanNumber, szNumber, TAPIMAXDESTADDRESSSIZE -1 );
      szCanNumber[TAPIMAXDESTADDRESSSIZE-1] = '\0';
    }

    errCode = lineTranslateAddress (
                    ghLineApp,
                    giCurrentLine,
                    gCurrentLineInfo.dwAPIVersion,
                    szCanNumber,
                    0,
                    0,
                    lpTransOut
                     );
    if ( ((LONG)errCode) < 0 )
    {
      errString( ghWndMain, errCode, MB_ICONEXCLAMATION | MB_OK );
      goto error;
    }

    if ( lpTransOut-> dwNeededSize <= lpTransOut->dwTotalSize  )
    {
      // ok we are done
      break;
    }
    else
    {
      dwLTPSize = lpTransOut-> dwNeededSize;
      DialerFree ( lpTransOut );
      lpTransOut = NULL;
    }

  } while ( TRUE );

  // if number dialed is 911, bring up a warning
  if ( Is911( lpTransOut) )
  {
    INT nRes = errString ( ghWndMain, ERR_911WARN, MB_ICONSTOP | MB_YESNO );
    if ( nRes == IDNO )
    {
      goto error;
    }
  }

  // set call parameters
  dwLCPSize += dwNameLen + lpTransOut-> dwDisplayableStringSize;

  lpLineCallParams = (LPLINECALLPARAMS) DialerAlloc( dwLCPSize );
  if ( !lpLineCallParams )
  {
    errString( ghWndMain, LINEERR_NOMEM, MB_ICONSTOP | MB_OK );
    goto error;
  }

  lpLineCallParams->dwTotalSize = dwLCPSize;
  lpLineCallParams->dwBearerMode = LINEBEARERMODE_VOICE;
  lpLineCallParams->dwMediaMode = LINEMEDIAMODE_INTERACTIVEVOICE;
  lpLineCallParams->dwCallParamFlags = LINECALLPARAMFLAGS_IDLE;
  lpLineCallParams->dwAddressMode = LINEADDRESSMODE_ADDRESSID;
  lpLineCallParams->dwAddressID = giCurrentAddress;

  if ( szName[ 0 ] )
  {
    lpLineCallParams->dwCalledPartySize = dwNameLen;
    lpLineCallParams->dwCalledPartyOffset = sizeof( LINECALLPARAMS );

    dwRemainingLength = lpLineCallParams->dwTotalSize - sizeof(LINECALLPARAMS) -1 ;

    strncpy (
          (LPSTR) lpLineCallParams + sizeof(LINECALLPARAMS),
          szName,
          dwRemainingLength
          );
    ((LPSTR)lpLineCallParams)[lpLineCallParams->dwTotalSize-1] = '\0';

  }

  lpLineCallParams-> dwDisplayableAddressSize = lpTransOut-> dwDisplayableStringSize;
  lpLineCallParams-> dwDisplayableAddressOffset = sizeof( LINECALLPARAMS ) + dwNameLen;
  dwRemainingLength = lpLineCallParams->dwTotalSize - sizeof(LINECALLPARAMS) -
            lstrlen((LPSTR) lpLineCallParams + sizeof(LINECALLPARAMS))-1;
  if (dwRemainingLength >0)
  {
    strncpy (
        (LPSTR) lpLineCallParams + sizeof(LINECALLPARAMS) + dwNameLen,
        (LPSTR) lpTransOut + lpTransOut-> dwDisplayableStringOffset,
        dwRemainingLength);
    ((LPSTR)lpLineCallParams)[lpLineCallParams->dwTotalSize-1] = '\0';

  }

  // save dialing information
  // Free old allocs.
  if ( gszCurrentName )
  {
    DialerFree ( gszCurrentName );
  }

  if ( gszCurrentNumber )
  {
    DialerFree ( gszCurrentNumber );
  }

  // save new stuff
  gszCurrentName = (LPSTR) DialerAlloc( dwNameLen );
  if ( !gszCurrentName )
  {
    errString( ghWndMain, LINEERR_NOMEM, MB_ICONSTOP | MB_OK );
    goto error;
  }
  strncpy ( gszCurrentName, szName, dwNameLen );
  gszCurrentName[dwNameLen-1] = '\0';
  gszCurrentNumber = (LPSTR) DialerAlloc( lpTransOut-> dwDisplayableStringSize );
  if ( !gszCurrentNumber )
  {
    errString( ghWndMain, LINEERR_NOMEM, MB_ICONSTOP | MB_OK );
    goto error;
  }

  strncpy (
       gszCurrentNumber,
       (LPSTR) lpTransOut + lpTransOut-> dwDisplayableStringOffset ,
      lpTransOut-> dwDisplayableStringSize-1
      );

  gszCurrentNumber[lpTransOut-> dwDisplayableStringSize-1] = '\0';
  gCurrentLineInfo.hLine = hLine;
  ghCall = (HCALL)((ULONG_PTR)NULL);

  // finally make the call.
  gMakeCallRequestID = 0;

  gMakeCallRequestID = lineMakeCall (
                    hLine,
                    &ghCall,
                    (LPSTR) lpTransOut + lpTransOut-> dwDialableStringOffset,
                    0,
                    lpLineCallParams
                    );

  // async request ID
  // - the call is going out
  if ( (LONG) gMakeCallRequestID > 0 )
  {
    gfCurrentLineAvail = FALSE;
    gfMakeCallReplyPending = TRUE;
    DialogBoxParam (
            ghInst,
            MAKEINTRESOURCE(IDD_DIALING),
            ghWndMain,
            (DLGPROC)DialingProc,
            0
             );

  }

  else
  {
    if ( gMakeCallRequestID == LINEERR_CALLUNAVAIL )
    {
      DialogBoxParam (
              ghInst,
              MAKEINTRESOURCE(IDD_CALLFAILED),
              ghWndMain,
              (DLGPROC)LineInUseProc,
              0
               );
    }

    else
    {
      errString( ghWndMain, gMakeCallRequestID, MB_ICONEXCLAMATION | MB_OK );
    }

    DialerLineClose();
    gfCurrentLineAvail = TRUE;
  }

error :
  if ( lpLineCallParams )
  {
    DialerFree( lpLineCallParams );
  }

  if ( lpTransOut )
  {
    DialerFree( lpTransOut );
  }

  // if makecall did not succeed but line
  // was opened, close it.
  if ( ( gMakeCallRequestID <= 0 ) && ( gCurrentLineInfo.hLine ) )
  {
    DialerLineClose ();
    gfCurrentLineAvail = TRUE;
  }

  SetFocus( GetDlgItem( ghWndMain, IDD_DCOMBO ) );

  return;

}

BOOL Is911 ( LPLINETRANSLATEOUTPUT lpTransOut )

Definition at line 3763 of file Dialer.c.

{

  DWORD i = 0, j = 0;
  LPSTR lpDialDigits = (LPSTR)lpTransOut + lpTransOut-> dwDialableStringOffset;
  char sz3Pref [ 4 ] = "";

  // if this is not the US
  if ( lpTransOut-> dwCurrentCountry != 1 )
    return FALSE;

  // skip non digit characters and extract
  // the first 3 digits in the dialable number
  for ( i = 0, j = 0; i < lpTransOut-> dwDialableStringSize ; i++ )
  {
    if ( ISDIGIT( lpDialDigits[i] ) )
    {
      sz3Pref[ j++ ] = lpDialDigits [ i ];
      sz3Pref[ j ] = '\0';
      if ( j == 3 )
        break;
    }
  }

  if ( !lstrcmp( sz3Pref, "911" ) )
  {
    return TRUE;
  }

  return FALSE;
}

BOOL CALLBACK LineInUseProc | ( | HWND | hwnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 2304 of file Dialer.c.

    {
    LPARAM lNewParam = lParam;
    PTSTR  ptStr;

    switch(msg)
        {
        case WM_INITDIALOG:
            {
            switch(lParam)
                {
                case LINEDISCONNECTMODE_REJECT:
                    lNewParam = ikszDisconnectedReject;
                    break;

                case LINEDISCONNECTMODE_BUSY:
                    lNewParam = ikszDisconnectedBusy;
                    break;

                case LINEDISCONNECTMODE_NOANSWER:
                    lNewParam = ikszDisconnectedNoAnswer;
                    break;

                case LINEDISCONNECTMODE_CONGESTION:
                    lNewParam = ikszDisconnectedNetwork;
                    break;

                case LINEDISCONNECTMODE_INCOMPATIBLE:
                    lNewParam = ikszDisconnectedIncompatible;
                    break;

                case LINEDISCONNECTMODE_NODIALTONE:
                    lNewParam = ikszDisconnectedNoDialTone;
                    break;

                default:
                    lNewParam = ikszDisconnectedCantDo;
                    break;
                }
            return TRUE;
            }

        case WM_COMMAND:
            if(LOWORD((DWORD)wParam) == IDOK)
                {
                EndDialog(hwnd, TRUE);
                return TRUE;
                }
            break;

        default:
              ;
//            return DefDlgProc( hwnd, msg, wParam, lParam );

        }

    if (ptStr = DialerAlloc( MAXBUFSIZE )) {

      LoadString( ghInst, (UINT)lNewParam, ptStr, MAXBUFSIZE );

      SetDlgItemText(
         hwnd,
          IDD_CFTEXT,
         ptStr
          );

      DialerFree( ptStr );
    }

    return FALSE;
    }

BOOL CALLBACK MainWndProc | ( | HWND | hwnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 1022 of file Dialer.c.

{
  static HICON hIcon;

        switch (msg)
        {
            case WM_INITDIALOG:
                hIcon = LoadIcon( ghInst, (LPCSTR) MAKEINTRESOURCE( IDI_DIALER ) );
                return TRUE;

            case WM_SYSCOMMAND:
                switch( (DWORD) wParam )
                {
                    case SC_CLOSE:
                        PostQuitMessage(0);
                }
                break;

            case WM_INITMENUPOPUP:
                // if edit menu
                if ( LOWORD(lParam) == 1 )
                {
                    UINT wEnable;

                    if ( GetParent( GetFocus() ) != GetDlgItem( ghWndMain, IDD_DCOMBO ) )
                    {
                        wEnable = MF_GRAYED;
                    }
                    else
                    {
                        LONG lSelect = (LONG)SendDlgItemMessage (
                            ghWndMain,
                            IDD_DCOMBO,
                            CB_GETEDITSEL,
                            0,
                            0
                            );

                        if ( HIWORD( lSelect ) != LOWORD( lSelect ) )
                            wEnable = MF_ENABLED;
                        else
                            wEnable = MF_GRAYED;
                    }

                    EnableMenuItem((HMENU)wParam, IDM_EDIT_CUT, wEnable);
                    EnableMenuItem((HMENU)wParam, IDM_EDIT_COPY, wEnable);
                    EnableMenuItem((HMENU)wParam, IDM_EDIT_DELETE, wEnable);

                    // enable paste option is there is data
                    // in the clipboard
                    if ( IsClipboardFormatAvailable( CF_TEXT ) )
                    {
                        if ( GetClipboardData ( CF_TEXT ) )
                        {
                            wEnable = MF_ENABLED;
                        }
                        else
                        {
                            wEnable = MF_GRAYED;
                        }
                    }
                    else
                    {
                        wEnable = MF_GRAYED;
                    }

                }
                break;

            case WM_COMMAND:
            {
                char szName[TAPIMAXCALLEDPARTYSIZE] = {'\0'};
                char szNumber[TAPIMAXDESTADDRESSSIZE] = {'\0'};

                switch( LOWORD( (DWORD)wParam ) )
                {
                    // FILE menu
                    case IDM_EXIT:
                        PostQuitMessage(0);
                        return TRUE;

                        // EDIT menu
                    case IDM_EDIT_CUT:
                        SendDlgItemMessage(ghWndMain, IDD_DCOMBO, WM_CUT, 0, 0);
                        return TRUE;

                    case IDM_EDIT_COPY:
                        SendDlgItemMessage(ghWndMain, IDD_DCOMBO, WM_COPY, 0, 0);
                        return TRUE;

                    case IDM_EDIT_PASTE:
                        SendDlgItemMessage(ghWndMain, IDD_DCOMBO, WM_PASTE, 0, 0);
                        return TRUE;

                    case IDM_EDIT_DELETE:
                        SendDlgItemMessage(ghWndMain, IDD_DCOMBO, WM_CLEAR, 0, 0);
                        return TRUE;

                    case IDM_EDIT_SPEEDDIAL:
                        DialogBoxParam (
                                        ghInst,
                                        MAKEINTRESOURCE(IDD_SD1),
                                        ghWndMain,
                                        (DLGPROC)SpeedDial1Proc,
                                        0
                                       );
                        SetFocus(GetDlgItem(ghWndMain, IDD_DDIAL));
                        return TRUE;

                        // TOOLS menu
                    case IDM_CONNECTUSING:
                        DialogBoxParam (
                                        ghInst,
                                        MAKEINTRESOURCE(IDD_CONNECTUSING),
                                        ghWndMain,
                                        (DLGPROC)ConnectUsingProc,
                                        MENU_CHOICE
                                       );
                        return TRUE;

                    case IDM_LOCATION:
                    {
                        char szCanNumber[ TAPIMAXDESTADDRESSSIZE ] ;

                        // fetch the number to be dialed
                        if ( GetDlgItemText (
                                              ghWndMain,
                                              IDD_DCOMBO,
                                              szNumber,
                                              TAPIMAXDESTADDRESSSIZE
                                            )
                           )
                        {
                            // if a number exists, convert it to
                            // its canonical form.
                            if ( !MakeCanonicalNumber ( szNumber, szCanNumber ) )
                            {
                                strncpy( szCanNumber, szNumber,(sizeof(szCanNumber)-1));
                szCanNumber[TAPIMAXDESTADDRESSSIZE-1] = '\0';
              }
                        }

                        lineTranslateDialog (
                                             ghLineApp,
                                             0,
                                             TAPI_CURRENT_VERSION,
                                             ghWndMain,
                                             szCanNumber
                                            );
                        return TRUE;

                    }
                    // HELP menu

                    case IDM_ABOUT:
                        DialogBoxParam(
                                       ghInst,
                                       MAKEINTRESOURCE(IDD_ABOUT),
                                       ghWndMain,
                                       (DLGPROC)AboutProc,
                                       0
                                      );

                        return TRUE;

                        // Accelerator processing
                    case IDM_ACCEL_NUMTODIAL:
                        if(GetActiveWindow() == ghWndMain)
                            SetFocus(GetDlgItem(ghWndMain, IDD_DCOMBO));
                        return TRUE;

                        // Buttons
                    case IDD_DDIAL:

                    {
                        DWORD cSDEntry;
                        char szSDNumber[TAPIMAXDESTADDRESSSIZE];
                        char szFieldName[MAXBUFSIZE];

                        // check if number entered is dialable
                        if ( SendMessage (
                                          GetDlgItem(ghWndMain, IDD_DCOMBO),
                                          WM_GETTEXTLENGTH,
                                          0,
                                          0
                                         ) > 0
                           )
                        {
                            // get the number to be dialed
                            GetDlgItemText (
                                            ghWndMain,
                                            IDD_DCOMBO,
                                            (LPSTR)szNumber,
                                            TAPIMAXDESTADDRESSSIZE
                                           );

                            // check if it is a speed dial number.
                            // If so choose the name to be displayed.
                            for( cSDEntry = 1; cSDEntry <= NSPEEDDIALS; ++cSDEntry)
                            {
                                wsprintf(szFieldName, "Number%d", cSDEntry);
                                GetPrivateProfileString (
                                    "Speed Dial Settings",
                                    szFieldName,
                                    gszNULL,
                                    szSDNumber,
                                    TAPIMAXCALLEDPARTYSIZE - 1,
                                    gszINIfilename
                                    );

                                // if the number matches, get the name
                                if ( lstrcmp(szSDNumber, szNumber) == 0 )
                                {
                                    wsprintf( szFieldName, "Name%d", cSDEntry);
                                    GetPrivateProfileString (
                                        "Speed Dial Settings",
                                        szFieldName,
                                        gszNULL,
                                        szName,
                                        TAPIMAXCALLEDPARTYSIZE - 1,
                                        gszINIfilename
                                        );
                                    break;
                                }
                            }

                            SetFocus( GetDlgItem( ghWndMain, IDD_DDIAL ) );

                            // once the currentline has been set
                            // using the connect proc
                            // the user must hit dial again
                            if ( giCurrentLine == (DWORD)-1 )
                            {
                                DialogBoxParam (
                                                ghInst,
                                                MAKEINTRESOURCE(IDD_CONNECTUSING),
                                                ghWndMain,
                                                (DLGPROC)ConnectUsingProc,
                                                INVALID_LINE
                                               );
                            }
                            else
                            {
                                AddToRedialList(szNumber);
                                InitiateCall(szNumber, szName);
                            }
                        }
                        return TRUE;
                    }

                    case IDD_DBUTTON1:
                    case IDD_DBUTTON2:
                    case IDD_DBUTTON3:
                    case IDD_DBUTTON4:
                    case IDD_DBUTTON5:
                    case IDD_DBUTTON6:
                    case IDD_DBUTTON7:
                    case IDD_DBUTTON8:
                    case IDD_DBUTTON9:
                    case IDD_DBUTTON0:
                    case IDD_DBUTTONSTAR:
                    case IDD_DBUTTONPOUND:
                    {
                        int     i;
                        TCHAR   szBuffer[TAPIMAXDESTADDRESSSIZE+1];

                        static const char digits[] = { '1', '2', '3', '4',
                        '5', '6', '7', '8',
                        '9', '0', '*', '#' };

                        i = (int)SendDlgItemMessage(ghWndMain,
                                               IDD_DCOMBO,
                                               WM_GETTEXT,
                                               (WPARAM)TAPIMAXDESTADDRESSSIZE+1,
                                               (LPARAM)szBuffer);

                        if (i < TAPIMAXDESTADDRESSSIZE)
                        {
                            MoveMemory(szBuffer+gdwStartSel+1,
                                       szBuffer+gdwEndSel,
                                       i - ( gdwEndSel ) + 1 );

                            szBuffer[gdwStartSel] = digits[LOWORD(wParam) - IDD_DBUTTON1];

                            SendDlgItemMessage(ghWndMain,
                                               IDD_DCOMBO,
                                               WM_SETTEXT,
                                               0,
                                               (LPARAM)szBuffer);

                            gdwStartSel++;
                            gdwEndSel = gdwStartSel;
                        }

                        SetFocus(GetDlgItem(ghWndMain, IDD_DDIAL));
                        EnableWindow(GetDlgItem(ghWndMain, IDD_DDIAL), TRUE);

                        return TRUE;
                    }

                    case IDD_DCOMBO:

                        if (HIWORD(wParam) == CBN_SELENDOK)
                        {
                            EnableWindow( GetDlgItem(ghWndMain, IDD_DDIAL), TRUE );
                        }

                        if ((HIWORD(wParam) == CBN_SELENDOK) ||
                            (HIWORD(wParam) == CBN_SELENDCANCEL))
                        {

                            (DWORD)SendDlgItemMessage(ghWndMain,
                                IDD_DCOMBO,
                                CB_GETEDITSEL,
                                (WPARAM)&gdwStartSel,
                                (LPARAM)&gdwEndSel);
                            return FALSE;
                        }

                        if ( HIWORD( wParam ) == CBN_EDITCHANGE )
                        {
                            EnableWindow (
                                          GetDlgItem( ghWndMain, IDD_DDIAL ),
                                          (BOOL) GetWindowTextLength (
                                GetDlgItem (
                                            ghWndMain,
                                            IDD_DCOMBO
                                           )
                                )
                                         );
                            return TRUE;
                        }

                        break;

                    case IDD_DSPEEDDIAL1:
                    case IDD_DSPEEDDIAL2:
                    case IDD_DSPEEDDIAL3:
                    case IDD_DSPEEDDIAL4:
                    case IDD_DSPEEDDIAL5:
                    case IDD_DSPEEDDIAL6:
                    case IDD_DSPEEDDIAL7:
                    case IDD_DSPEEDDIAL8:
                    {
                        DWORD cSDEntry = LOWORD( (DWORD) wParam)  - IDD_DSPEEDDIAL1 + 1;
                        char szFieldName [MAXBUFSIZE];

                        // get information for the speed dial button
                        // from the INI file
                        wsprintf(szFieldName, "Name%d", cSDEntry);
                        GetPrivateProfileString (
                            "Speed Dial Settings",
                            szFieldName,
                            gszNULL,
                            szName,
                            TAPIMAXCALLEDPARTYSIZE - 1,
                            gszINIfilename
                                                );

                        wsprintf(szFieldName, "%s%d", "Number", cSDEntry);
                        GetPrivateProfileString (
                            "Speed Dial Settings",
                            szFieldName,
                            gszNULL,
                            gszSDNumber[cSDEntry],
                            TAPIMAXDESTADDRESSSIZE - 1,
                            gszINIfilename
                                                );

                        // entry not set yet
                        if( gszSDNumber[cSDEntry][0] == 0 )
                        {
                            DialogBoxParam (
                                            ghInst,
                                            MAKEINTRESOURCE(IDD_SD2),
                                            ghWndMain,
                                            (DLGPROC)SpeedDial2Proc,
                                            MAKELPARAM(wParam,0)
                                           );
                        }

                        // no line open
                        // once the currentline has been set
                        // using the connect proc
                        // the user must hit dial again
                        else if ( giCurrentLine == (DWORD)-1)
                        {
                            DialogBoxParam (
                                            ghInst,
                                            MAKEINTRESOURCE(IDD_CONNECTUSING),
                                            ghWndMain,
                                            (DLGPROC)ConnectUsingProc,
                                            INVALID_LINE
                                           );
                        }
                        // entry is set and valid voice line is open
                        else
                        {
                            // add number to list box combo.
                            AddToRedialList( gszSDNumber[cSDEntry] );
                            InitiateCall( gszSDNumber[cSDEntry], szName );
                        }
                        break;
                    }
                           } // end switch (LOWORD((DWORD)wParam)) { ... }

                            break; // end case WM_COMMAND
                            }

                                            case WM_PAINT:
                                            {
                                                PAINTSTRUCT ps;

                                                BeginPaint(ghWndMain, &ps);

                                                if(IsIconic(ghWndMain))
                                                    DrawIcon(ps.hdc, 0, 0, hIcon);
                                                else
                                                {
                                                    HBRUSH hBrush;

                                                    hBrush = GetSysColorBrush( COLOR_3DFACE );
                                                    //                FillRect(ps.hdc, &ps.rcPaint, GetStockObject(LTGRAY_BRUSH));
                                                    FillRect(ps.hdc, &ps.rcPaint, hBrush);
                                                }

                                                EndPaint(ghWndMain, &ps);

                                                return TRUE;
                                            }

                                            case WM_DRAWITEM:
                                            {
                                                LPDRAWITEMSTRUCT lpdis = (LPDRAWITEMSTRUCT)lParam;
                                                BOOL fHighlighted = (BOOL)(SendDlgItemMessage(
                                                    ghWndMain,
                                                    lpdis->CtlID,
                                                    BM_GETSTATE,
                                                    0,
                                                    0
                                                    ) & 0x0004);

                                                DrawButton(lpdis->hDC, lpdis->rcItem, fHighlighted);
                                                DrawButtonText(
                                                    lpdis->hDC,
                                                    lpdis->rcItem,
                                                    fHighlighted,
                                                    lpdis->CtlID
                                                    );
                                                return TRUE;
                                            }

                                            case WM_CTLCOLORLISTBOX:
                                            case WM_CTLCOLORBTN:
                                            case WM_CTLCOLORSTATIC:
                                                SetBkColor((HDC)wParam, GetSysColor(COLOR_BTNFACE));
                                                return (BOOL)((ULONG_PTR)GetSysColorBrush( COLOR_3DFACE ));

                                            default:
                                                ;
                                                //            return DefDlgProc( hwnd, msg, wParam, lParam );
                                                //            return DefWindowProc( hwnd, msg, wParam, lParam );

                    } // switch (msg) { ... }

  return FALSE;
  }

BOOL MakeCanonicalNumber | ( | LPCSTR | szName,
 |  | LPSTR | szCanNumber
 | ) |  |

Definition at line 3814 of file Dialer.c.

{
  char szDigits [ TAPIMAXDESTADDRESSSIZE ];
  char szPref [ TAPIMAXDESTADDRESSSIZE ];

  BOOL bRes = FALSE;

  INT errCode = -1;
  INT nLenPref, nLenDigits, cPos, i;

  DWORD dwSize = 0;
  DWORD dwInd = 0;

  LPLINETRANSLATEOUTPUT lpTransOut = NULL;
  LPLINETRANSLATECAPS lpTransCaps = NULL;

  dwSize = sizeof ( LINETRANSLATEOUTPUT );
  do
  {
    lpTransOut = ( LPLINETRANSLATEOUTPUT ) DialerAlloc ( dwSize );
    if ( !lpTransOut )
    {
      errString( ghWndMain, LINEERR_NOMEM, MB_ICONSTOP | MB_OK );
      goto error;
    }

    lpTransOut-> dwTotalSize = dwSize;
    errCode = lineTranslateAddress (
                      ghLineApp,
                      giCurrentLine,
                      gCurrentLineInfo.dwAPIVersion,
                      szNumber,
                      0,
                      0,
                      lpTransOut
                     );
    if ( errCode )
    {
      goto error;
    }

    if ( lpTransOut-> dwNeededSize <= lpTransOut-> dwTotalSize )
      break;

    dwSize = lpTransOut-> dwNeededSize;
    DialerFree( lpTransOut );

  } while( TRUE );

  // check if input number is already in
  // canonical form.
  if ( lpTransOut-> dwTranslateResults & LINETRANSLATERESULT_CANONICAL )
    goto error;

  // ensure country is the USA.
  if ( lpTransOut-> dwCurrentCountry != 1 )
    goto error;

  // Extract the digits from given string
  // allowed formatting characters that are ignored are
  // space, (, ), -, .
  // presence of other characters will render the string invalid.

  // find the prefix of the address upto the | mark.
  // the rest of the string can be ignored
  nLenPref = (int) strcspn ( szNumber, "|" );
  strncpy( szPref, szNumber, nLenPref );
  szPref[ nLenPref ] = '\0';

  // if string is not composed entirely of digits
  // and allowable formating characters, quit conversion
  if ( strspn( szPref, " 0123456789()-." ) != (size_t) nLenPref )
    goto error;

  // collect digits ignoring formating characters.
  szDigits[ 0 ] = '\0';
  for ( i = 0, nLenDigits = 0; i < nLenPref; i++ )
  {
    if ( ISDIGIT( szNumber[ i ] ) )
    {
      szDigits[ nLenDigits++ ] = szNumber[ i ];
    }
  }
  szDigits[ nLenDigits ] = '\0';

  // if "internal" number
  if ( nLenDigits < LOCAL_NUMBER )
    goto error;

  switch ( nLenDigits )
  {
    // Local number ( 7 digits) preceeded by a 0/1
    // Strip leading 0/1 and treat as a local number
    case EXTENDED_LOCAL_NUMBER:
      if ( szDigits[ 0 ] == '0' || szDigits[ 0 ] == '1' )
      {
        nLenDigits--;
        memmove( szDigits, &(szDigits[1]), nLenDigits );
        szDigits[ nLenDigits ] = '\0';

        cPos = (int) strcspn( szPref, "01" );
        nLenPref--;
        memmove( &(szPref[ cPos ]), &(szPref[ cPos + 1 ]), nLenPref - cPos );
        szPref[ nLenPref ] = '\0';
      }
      else
      {
        goto error;
      }

    case LOCAL_NUMBER :
    {
      LPLINELOCATIONENTRY lpLocLst;

      // if leading digit is 0 or 1, it is
      // illegal in the US
      if ( szDigits[ 0 ] == '0' || szDigits[ 0 ] == '1' )
      {
        goto error;
      }

      // get area code nformation for local number
      dwSize = sizeof( LINETRANSLATECAPS );
      do
      {
        lpTransCaps = (LPLINETRANSLATECAPS) DialerAlloc( dwSize );
        if ( !lpTransCaps )
        {
          errString( ghWndMain, LINEERR_NOMEM, MB_ICONSTOP | MB_OK );
          goto error;
        }

        lpTransCaps-> dwTotalSize = dwSize;
        errCode = lineGetTranslateCaps (
                        ghLineApp,
                        gCurrentLineInfo.dwAPIVersion,
                        lpTransCaps
                         );
        if ( errCode )
        {
          errString( ghWndMain, errCode, MB_ICONSTOP | MB_OK );
          goto error;
        }

        if ( lpTransCaps-> dwNeededSize <= lpTransCaps-> dwTotalSize )
        {
          break;
        }

        dwSize = lpTransCaps-> dwNeededSize;
        DialerFree( lpTransCaps );

      } while ( TRUE );

      // skip entries till you locate information for current location
      dwSize = sizeof( LINELOCATIONENTRY );
      lpLocLst = (LPLINELOCATIONENTRY) ( (LPSTR) lpTransCaps +
                        lpTransCaps-> dwLocationListOffset );

      for ( dwInd = 0; dwInd < lpTransCaps-> dwNumLocations ; dwInd++ )
      {
        if ( lpLocLst[ dwInd ].dwPermanentLocationID == lpTransCaps-> dwCurrentLocationID )
          break;
      }

      // current location no found ?????
      // login error
      if ( dwInd == lpTransCaps-> dwNumLocations )
      {
        goto error;
      }

      // construct canonical form as
      szCanNumber[ 0 ]= '\0';
      strncat( szCanNumber, "+1 (",(sizeof(szCanNumber)-1));
      strncat( szCanNumber, (LPSTR) lpTransCaps + lpLocLst[ dwInd ].dwCityCodeOffset,
          sizeof(szCanNumber)- 5);
      strncat( szCanNumber, ") ",
          ((sizeof(szCanNumber))-(5 + (lpTransCaps-> dwTotalSize) + (lpLocLst[ dwInd ].dwCityCodeSize)  )));
      strncat( szCanNumber, szDigits,
        ((sizeof(szCanNumber))- (5 + (lpTransCaps-> dwTotalSize) + (lpLocLst[ dwInd ].dwCityCodeSize) + 2 )));

      cPos = (int) strcspn( szNumber, "|" );
      if ( cPos != lstrlen( szNumber ) )
      {
        strncat( szCanNumber, &(szNumber[ cPos ]),
          ((sizeof(szCanNumber) )- (5 + (lpTransCaps-> dwTotalSize) + (lpLocLst[ dwInd ].dwCityCodeSize) + 2 +
          lstrlen(szDigits))));
      }

      bRes = TRUE;
      break;
    }

    case EXTENDED_LONG_DISTANCE_NUMBER:
    {
      // Long distance number ( 10 digits) preceeded by a 0/1
      // Strip leading 0/1 and treat as a long distance number
      if ( szDigits[ 0 ] == '0' || szDigits[ 0 ] == '1' )
      {
        nLenDigits--;
        memmove( szDigits, &(szDigits[1]), nLenDigits );
        szDigits[ nLenDigits ] = '\0';

        cPos = (int) strcspn( szPref, "01" );
        nLenPref--;
        memmove( &(szPref[ cPos ]), &(szPref[ cPos + 1 ]), nLenPref - cPos );
        szPref[ nLenPref ] = '\0';
      }
      else
      {
        goto error;
      }

    }

    case LONG_DISTANCE_NUMBER:
    {
      // if first or fourth digit is 0/1, illegal number
      if ( szDigits[ 0 ] == '0' || szDigits[ 0 ] == '1' ||
         szDigits[ 3 ] == '0' || szDigits[ 3 ] == '1' )
      {
        goto error;
      }

      szCanNumber[ 0 ] = '\0';
      strncat( szCanNumber, "+1 (" , (sizeof(szCanNumber)-1));
      strncat( szCanNumber, szDigits, (sizeof(szCanNumber)-5));
      strncat( szCanNumber, ") ", (sizeof(szCanNumber)-5-lstrlen(szDigits)));

      strncat( szCanNumber, &(szDigits[ 3 ]),
        (sizeof(szCanNumber)-5-lstrlen(szDigits)-2));

      bRes = TRUE;
    }
    break;

    default :
      goto error;
  }

error:
  if ( lpTransOut )
    DialerFree( lpTransOut );

  if ( lpTransCaps )
    DialerFree( lpTransCaps );

  return bRes;
}

VOID ManageAssistedTelephony ( VOID )

Definition at line 3348 of file Dialer.c.

{
  DWORD errCode;
  LPLINEREQMAKECALL lpRequestBuffer;

  lpRequestBuffer = (LPLINEREQMAKECALL) DialerAlloc( sizeof( LINEREQMAKECALL ) );
  if ( !lpRequestBuffer )
  {
    goto error;
  }

    // bring window to front
    SetForegroundWindow(ghWndMain);

  // get next queued request.
  errCode = lineGetRequest (
                ghLineApp,
                LINEREQUESTMODE_MAKECALL,
                lpRequestBuffer

               );
  if ( errCode )
  {
    // if no more call requests pending, reset flag.
    if ( errCode == LINEERR_NOREQUEST )
    {
      gfCallRequest = FALSE;
    }
    else
    {
      errString ( ghWndMain, errCode, MB_ICONEXCLAMATION | MB_OK );
    }
    goto error;
  }

  // if a line has not been selected
  if ( giCurrentLine == (DWORD)-1 )
  {
    if (!DialogBoxParam (
            ghInst,
            MAKEINTRESOURCE(IDD_CONNECTUSING),
            ghWndMain,
            (DLGPROC) ConnectUsingProc,
            INVALID_LINE
            ))
        {
            // failed to get a line
            goto error;
        }
  }

  // make the reuested call.
  InitiateCall (
          lpRequestBuffer->szDestAddress,
          lpRequestBuffer->szCalledParty
         );

error :
  if ( lpRequestBuffer )
  {
    DialerFree( lpRequestBuffer );
  }
  return;
}

VOID ReadINI ( VOID )

Definition at line 536 of file Dialer.c.

{
    WORD cSDEntry, cLastDialed;
    DWORD cComma;

    POINT ptLeftTop;

    char szName[ TAPIMAXCALLEDPARTYSIZE ];
    char szTemp[ TAPIMAXCALLEDPARTYSIZE ];

    char szNum[MAXBUFSIZE];
    char szFieldName[MAXBUFSIZE];
    char szPt[MAXBUFSIZE];

    // get speed dial settings from INI file
    for(cSDEntry = 1; cSDEntry <= NSPEEDDIALS; ++cSDEntry)
    {

        wsprintf(szFieldName, "Name%d", cSDEntry);
        GetPrivateProfileString (
                  "Speed Dial Settings",
                  szFieldName,
                  gszNULL,
                  szName,
                  TAPIMAXCALLEDPARTYSIZE - 1,
                  gszINIfilename
                );

        wsprintf(szFieldName, "Number%d", cSDEntry);
        GetPrivateProfileString (
                  "Speed Dial Settings",
                  szFieldName,
                  gszNULL,
                  gszSDNumber[cSDEntry],
                  TAPIMAXDESTADDRESSSIZE - 1,
                  gszINIfilename
                );

    if ( !lstrcmp( gszNULL, szName ) )
    {
      strncpy( szName, gszSDNumber[ cSDEntry ], (sizeof(szName)-1));
    }

    szName[TAPIMAXCALLEDPARTYSIZE-1] = '\0';

    FitTextToButton( ghWndMain, IDD_DSPEEDDIAL1 + cSDEntry - 1, szName );

    AmpersandCompensate( szName, szTemp );
    SetDlgItemText (
            ghWndMain,
            IDD_DSPEEDDIAL1 + cSDEntry - 1,
            (LPCSTR)szTemp
             ); // Label the speed dial button
  }

  // set up last dialed numbers in combo box (read from INI)
  for(cLastDialed = 1; cLastDialed <= NLASTDIALED; ++cLastDialed)
  {
    wsprintf(szFieldName, "Last dialed %d", cLastDialed);
    GetPrivateProfileString (
                  "Last dialed numbers",
                  szFieldName,
                  gszNULL,
                  szNum,
                  MAXBUFSIZE - 1,
                  gszINIfilename
                );
    if ( szNum[0] ) // i.e. if szNum isn't simply "" - if we read something
            // from the INI - put it in the combo box
      SendDlgItemMessage(
                ghWndMain,
                IDD_DCOMBO,
                CB_ADDSTRING,
                0,
                (LPARAM)(LPCSTR)szNum
                );
  }

  // set defaults
  ptLeftTop.x = 100;
  ptLeftTop.y = 100;

  // set the window position based on the INI data
  GetPrivateProfileString (
                "Preference",
                "Main Window Left/Top",
                gszNULL,
                szPt,
                MAXBUFSIZE - 1,
                gszINIfilename
              );

  if ( szPt[0] )
  {
    cComma = (int) strcspn(szPt, ",");
    szPt[cComma] = 0;
    ptLeftTop.x = atoi(szPt);

    // a possibly absurd check to see that the string
    // wasn't akin to "320," with no second entry
    if ( *(szPt + cComma + 1 ) )
      ptLeftTop.y = atoi( szPt + cComma + 1 );

    // check to see that the box is on the screen - the upper left
    // must be on the screen, along with a 50x50 box below and to
    // the right of it
    if ( ptLeftTop.x < 0
      || ptLeftTop.x + 50 >= GetSystemMetrics(SM_CXSCREEN)
      || ptLeftTop.y < 0
      || ptLeftTop.y + 50 >= GetSystemMetrics(SM_CYSCREEN)
       )
    {
      ptLeftTop.x = 100; // set defaults if the box is off of the screen
      ptLeftTop.y = 100; // set defaults if the box is off of the screen
    }
  }

  SetWindowPos (
          ghWndMain,
          NULL,
          ptLeftTop.x,
          ptLeftTop.y,
          0,
          0,
          SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOREDRAW | SWP_NOZORDER
         );
}

BOOL CALLBACK SpeedDial1Proc | ( | HWND | hwnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 2384 of file Dialer.c.

{
  static DWORD nCurrentSpeedDial;

  // buffer to store speed dial names till they are saved.
  static TCHAR szSDName[NSPEEDDIALS + 1][TAPIMAXDESTADDRESSSIZE];

  switch(msg)
  {
    case WM_INITDIALOG:
    {
      DWORD cSDEntry;
      DWORD idFirstEmpty = (DWORD) -1;

      char szName[TAPIMAXCALLEDPARTYSIZE];
      char szTemp[TAPIMAXCALLEDPARTYSIZE];
      char szFieldName[MAXBUFSIZE];

      // Retrieve speed dial info from INI file
      for(cSDEntry = 1; cSDEntry <= NSPEEDDIALS; ++cSDEntry)
      {
        wsprintf(szFieldName, "Name%d", cSDEntry);
        GetPrivateProfileString (
                      "Speed Dial Settings",
                      szFieldName,
                      gszNULL,
                      szSDName[ cSDEntry ],
                      TAPIMAXCALLEDPARTYSIZE - 1,
                      gszINIfilename
                    );

        // set the first empty speed dial button
        if ( idFirstEmpty == -1 &&
           szSDName[ cSDEntry ][0] == '\0' &&
           gszSDNumber[ cSDEntry ][ 0 ] == '\0' )
          idFirstEmpty = cSDEntry;

        wsprintf(szFieldName, "Number%d", cSDEntry);
        GetPrivateProfileString (
                      "Speed Dial Settings",
                      szFieldName,
                      gszNULL,
                      gszSDNumber[cSDEntry],
                      MAXBUFSIZE - 1,
                      gszINIfilename
                    );

        // get a copy of the name for editing
        // if name is empty, use the number as the
        // name.
        if ( lstrcmp( gszNULL, szSDName[ cSDEntry ] ) )
        {
          strncpy( szName, szSDName[ cSDEntry], TAPIMAXCALLEDPARTYSIZE-1 );
        }

        else
        {
          strncpy( szName, gszSDNumber[ cSDEntry ],TAPIMAXCALLEDPARTYSIZE-1 );
        }
        szName[TAPIMAXCALLEDPARTYSIZE-1] = '\0';

        FitTextToButton( hwnd, IDD_SD1SPEEDDIAL1 + cSDEntry - 1, szName );
        AmpersandCompensate( szName, szTemp );

        SetDlgItemText (
                hwnd,
                IDD_SD1SPEEDDIAL1 + cSDEntry - 1,
                (LPCSTR) szTemp
                 );

      }

      // for the edit speed dial dialog
      // limit the lengths of text
      SendDlgItemMessage (
                hwnd,
                IDD_SD1EDITNAME,
                EM_LIMITTEXT,
                (WPARAM)(TAPIMAXCALLEDPARTYSIZE - 1),
                0
                 );

      SendDlgItemMessage (
                hwnd,
                IDD_SD1EDITNUMBER,
                EM_LIMITTEXT,
                (WPARAM)(TAPIMAXDESTADDRESSSIZE - 1),
                0
                 );

      // select the first empty button
      // nothing empty, then edit #1
      if ( -1 == idFirstEmpty )
      {
        nCurrentSpeedDial = 1;
        SetDlgItemText(
                hwnd,
                IDD_SD1EDITNAME,
                (LPCSTR) szSDName[ 1 ]
                );

        SetDlgItemText(
                hwnd,
                IDD_SD1EDITNUMBER,
                (LPCSTR) gszSDNumber[ 1 ]
                );
      }
      else
      {
        nCurrentSpeedDial = idFirstEmpty;
      }

      SetFocus( GetDlgItem( hwnd, IDD_SD1EDITNAME ) );
      return FALSE;
    }

    case WM_COMMAND:
    {
      char szName[TAPIMAXCALLEDPARTYSIZE];
      char szTemp[ TAPIMAXCALLEDPARTYSIZE ];

      switch( LOWORD( (DWORD) wParam ) )
      {
        case IDOK:
        {
          DWORD cSDEntry;
          char szFieldName[MAXBUFSIZE];

          // save new speed dial settings
          for ( cSDEntry = 1; cSDEntry <= NSPEEDDIALS; ++cSDEntry )
          {
            wsprintf(szFieldName, "Name%d", cSDEntry);
            WritePrivateProfileString (
                          "Speed Dial Settings",
                          szFieldName,
                          szSDName [cSDEntry],
                          gszINIfilename
                          );

            wsprintf(szFieldName, "Number%d", cSDEntry);
            WritePrivateProfileString (
                          "Speed Dial Settings",
                          szFieldName,
                          gszSDNumber[cSDEntry],
                          gszINIfilename
                          );

            // set the text for the corresponding
            // main window button
            if ( szSDName[ cSDEntry ][ 0 ] == '\0' )
            {
              strncpy( szName, gszSDNumber[ cSDEntry ],TAPIMAXCALLEDPARTYSIZE-1);
            }
            else
            {
              strncpy( szName, szSDName[ cSDEntry ],TAPIMAXCALLEDPARTYSIZE-1);
            }
            szName[TAPIMAXCALLEDPARTYSIZE-1] = '\0';

            FitTextToButton(
                    ghWndMain,
                    IDD_DSPEEDDIAL1 + cSDEntry - 1,
                    szName
                     );

            AmpersandCompensate( szName, szTemp );
            SetDlgItemText (
                    ghWndMain,
                    IDD_DSPEEDDIAL1 + cSDEntry - 1,
                    (LPCSTR) szTemp
                     );
          }

          EndDialog(hwnd, TRUE);
          return TRUE;
        }

        case IDCANCEL:
          EndDialog(hwnd, FALSE);
          return TRUE;

        case IDD_SD1SPEEDDIAL1:
        case IDD_SD1SPEEDDIAL2:
        case IDD_SD1SPEEDDIAL3:
        case IDD_SD1SPEEDDIAL4:
        case IDD_SD1SPEEDDIAL5:
        case IDD_SD1SPEEDDIAL6:
        case IDD_SD1SPEEDDIAL7:
        case IDD_SD1SPEEDDIAL8:

          nCurrentSpeedDial = LOWORD( (DWORD) wParam ) - IDD_SD1SPEEDDIAL1 + 1;

          SetDlgItemText (
                  hwnd,
                  IDD_SD1EDITNAME,
                  szSDName [ nCurrentSpeedDial ]
                   );
          SetDlgItemText (
                  hwnd,
                  IDD_SD1EDITNUMBER,
                  gszSDNumber[nCurrentSpeedDial]
                   );

          SetFocus( GetDlgItem( hwnd, IDD_SD1EDITNAME ) );
          SendDlgItemMessage(
                    hwnd,
                    IDD_SD1EDITNAME,
                    EM_SETSEL,
                    0,
                    MAKELPARAM(0, -1)
                  );
          break;

        case IDD_SD1EDITNAME:
          if ( HIWORD( wParam ) == EN_CHANGE )
          {

            GetDlgItemText (
                    hwnd,
                    IDD_SD1EDITNAME,
                    szName,
                    TAPIMAXCALLEDPARTYSIZE
                     );

            // if there is no name, label the button with
            // the number
            if ( szName[ 0 ] == '\0' )
            {
              szSDName[ nCurrentSpeedDial ][ 0 ] = '\0';
              strncpy( szName, gszSDNumber[ nCurrentSpeedDial ],TAPIMAXCALLEDPARTYSIZE-1 );
              szName[TAPIMAXCALLEDPARTYSIZE-1] = '\0';
            }
            else
            {
              strncpy( szSDName[ nCurrentSpeedDial ], szName,TAPIMAXDESTADDRESSSIZE-1 );
              szSDName[ nCurrentSpeedDial ][TAPIMAXDESTADDRESSSIZE-1] = '\0';
            }

            FitTextToButton (
                      hwnd,
                      IDD_SD1SPEEDDIAL1 + nCurrentSpeedDial - 1,
                      szName
                    );
            AmpersandCompensate( szName, szTemp );

            SetDlgItemText (
                    hwnd,
                    IDD_SD1SPEEDDIAL1 + nCurrentSpeedDial - 1,
                    szTemp
                     );
          }
          break;

        case IDD_SD1EDITNUMBER:
          if ( HIWORD( wParam ) == EN_CHANGE )
          {
            GetDlgItemText (
                    hwnd,
                    IDD_SD1EDITNUMBER,
                    gszSDNumber[nCurrentSpeedDial],
                    TAPIMAXDESTADDRESSSIZE
                     );

            if ( gszSDNumber[ nCurrentSpeedDial ][ 0 ] == '\0' )
            {
              GetDlgItemText (
                      hwnd,
                      IDD_SD1EDITNAME,
                      szName,
                      TAPIMAXDESTADDRESSSIZE
                       );

              if ( szName[ 0 ] == '\0' )
              {
                SetDlgItemText (
                        hwnd,
                        IDD_SD1SPEEDDIAL1 + nCurrentSpeedDial - 1,
                        szName
                         );

              }
            }
          }
          break;
        } // switch(LOWORD((DWORD)wParam))
      break;

    } // case WM_COMMAND:

    default:
        ;

  } // switch(msg)

  return FALSE;
}

BOOL CALLBACK SpeedDial2Proc | ( | HWND | hwnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 2686 of file Dialer.c.

{
  static DWORD nCurrentSpeedDial;

  switch(msg)
  {
    case WM_INITDIALOG:
    {
      char szFieldName [MAXBUFSIZE];
      char szName [TAPIMAXCALLEDPARTYSIZE];

      nCurrentSpeedDial = LOWORD( lParam ) - IDD_DSPEEDDIAL1 + 1;

      // retrieve speed dial button info
      wsprintf(szFieldName, "Name%d", nCurrentSpeedDial);
      GetPrivateProfileString (
                    "Speed Dial Settings",
                    szFieldName,
                    gszNULL,
                    szName,
                    TAPIMAXCALLEDPARTYSIZE - 1,
                    gszINIfilename
                  );
      SetDlgItemText (
              hwnd,
              IDD_SD2EDITNAME,
              szName
               );

      SetDlgItemText (
              hwnd,
              IDD_SD2EDITNUMBER,
              gszSDNumber[nCurrentSpeedDial]
               );

      // limit the lengths of the texts
      SendDlgItemMessage (
                hwnd,
                IDD_SD2EDITNAME,
                EM_LIMITTEXT,
                (WPARAM)(TAPIMAXCALLEDPARTYSIZE - 1),
                0
                 );

      SendDlgItemMessage (
                hwnd,
                IDD_SD2EDITNUMBER,
                EM_LIMITTEXT,
                (WPARAM)(TAPIMAXDESTADDRESSSIZE - 1),
                0
                 );

      SetFocus( GetDlgItem( hwnd, IDD_SD2EDITNAME ) );
      SendDlgItemMessage (
                hwnd,
                IDD_SD2EDITNAME,
                EM_SETSEL,
                0,
                MAKELPARAM(0, -1)
                 );

      return FALSE;
    }

    case WM_COMMAND:
    {
      char szName[ TAPIMAXCALLEDPARTYSIZE ];
      char szTemp[ TAPIMAXCALLEDPARTYSIZE ];
      char szFieldName[MAXBUFSIZE];

      switch ( LOWORD( (DWORD) wParam ) )
      {
        case IDOK:
        case IDD_SD2SAVEANDDIAL:
        {
          GetDlgItemText (
                  hwnd,
                  IDD_SD2EDITNAME,
                  (LPTSTR) szName,
                  TAPIMAXCALLEDPARTYSIZE
                   );

          GetDlgItemText (
                  hwnd,
                  IDD_SD2EDITNUMBER,
                  (LPTSTR) gszSDNumber[nCurrentSpeedDial],
                  TAPIMAXCALLEDPARTYSIZE
                   );

          wsprintf ( szFieldName, "Name%d", nCurrentSpeedDial );

          WritePrivateProfileString (
                        "Speed Dial Settings",
                        szFieldName,
                        szName,
                        gszINIfilename
                        );

          wsprintf ( szFieldName, "Number%d", nCurrentSpeedDial );
          WritePrivateProfileString (
                        "Speed Dial Settings",
                        szFieldName,
                        gszSDNumber[nCurrentSpeedDial],
                        gszINIfilename
                        );

          // update main window buttons
          // is only number has been entered, label button with it.
          if ( szName[ 0 ] == '\0' )
          {
            strncpy( szName, gszSDNumber[ nCurrentSpeedDial ], TAPIMAXCALLEDPARTYSIZE-1);
            szName[TAPIMAXCALLEDPARTYSIZE-1] = '\0';
          }

          FitTextToButton (
                    ghWndMain,
                    IDD_DSPEEDDIAL1 + nCurrentSpeedDial - 1,
                    (LPSTR) szName
                  );

          AmpersandCompensate( szName, szTemp );

          SetDlgItemText (
                  ghWndMain,
                  IDD_DSPEEDDIAL1 + nCurrentSpeedDial - 1,
                  (LPCSTR)szTemp
                   );

          // if save and dial, then post dial message to main window
          if ( LOWORD( (DWORD) wParam ) == IDD_SD2SAVEANDDIAL )
          {
            PostMessage (
                    ghWndMain,
                    WM_COMMAND,
                    MAKEWPARAM (
                          nCurrentSpeedDial + IDD_DSPEEDDIAL1 - 1,
                          BN_CLICKED
                           ),
                    (LPARAM) GetDlgItem (
                                ghWndMain,
                                nCurrentSpeedDial + IDD_DSPEEDDIAL1 - 1
                              )
                  );
          }
          EndDialog(hwnd, TRUE);
          return TRUE;
        }

        case IDCANCEL:
          EndDialog(hwnd, FALSE);
          return TRUE;

        case IDD_SD2EDITNAME:
        case IDD_SD2EDITNUMBER:
          if ( HIWORD( wParam ) == EN_CHANGE)
          {
            EnableWindow (
                    GetDlgItem( hwnd, IDD_SD2SAVEANDDIAL ),
                    GetWindowTextLength ( GetDlgItem( hwnd, IDD_SD2EDITNUMBER ) ) > 0
                   );
          }
          break;

      } // switch(LOWORD((DWORD)wParam))
      break;
    }

    default:
        ;

  } // switch(msg)

  return FALSE;
}

VOID CALLBACK tapiCallback | ( | DWORD | hDevice,
 |  | DWORD | dwMsg,
 |  | DWORD | dwCallbackInstance,
 |  | DWORD | dwParam1,
 |  | DWORD | dwParam2,
 |  | DWORD | dwParam3
 | ) |  |

Definition at line 2869 of file Dialer.c.

{
  switch (dwMsg)
  {
    INT errCode;

    case LINE_ADDRESSSTATE:
      break;

    case LINE_CALLINFO:
      break;

    case LINE_CALLSTATE:
      if ( (HCALL)hDevice != ghCall )
        return;

      switch ( dwParam1 ) // new state
      {
        case LINECALLSTATE_IDLE:

          // tell "Dialing" window to terminate
          if ( ghWndDialing )
          {
            SendMessage (
                    ghWndDialing,
                    WM_COMMAND,
                    MAKEWPARAM( IDOK, 0 ),
                    0
                  );
          }

          // tapi call cleanup
          if ( !gfMakeCallReplyPending && ghCall )
          {
            if ( ( errCode = lineDeallocateCall( ghCall ) ) < 0 )
            {
              errString ( ghWndMain, errCode, MB_ICONSTOP | MB_OK );
            }
            ghCall = (HCALL)((ULONG_PTR)NULL);
          }
          DialerLineClose();
          gfCurrentLineAvail = TRUE;

          // update main window
          DisableDialButtons( FALSE );
          break;

        case LINECALLSTATE_BUSY:
          tapiCallback (
                  hDevice,
                  dwMsg,
                  dwCBInstance,
                  LINECALLSTATE_DISCONNECTED,
                  LINEDISCONNECTMODE_BUSY,
                  dwParam3
                 );
          break;

        case LINECALLSTATE_SPECIALINFO:
          tapiCallback (
                  hDevice,
                  dwMsg,
                  dwCBInstance,
                  LINECALLSTATE_DISCONNECTED,
                  LINEDISCONNECTMODE_UNREACHABLE,
                  dwParam3
                 );
          break;

        case LINECALLSTATE_DISCONNECTED:
        {
          BOOL fCallOK;
          DWORD LineDisconnectMode;

          if ( dwParam2 == 0 )
            LineDisconnectMode = LINEDISCONNECTMODE_NORMAL;
          else
            LineDisconnectMode = dwParam2;

          fCallOK = ( LineDisconnectMode == LINEDISCONNECTMODE_NORMAL   ||
                LineDisconnectMode == LINEDISCONNECTMODE_UNKNOWN  ||
                LineDisconnectMode == LINEDISCONNECTMODE_PICKUP   ||
                LineDisconnectMode == LINEDISCONNECTMODE_FORWARDED  ||
                LineDisconnectMode == LINEDISCONNECTMODE_UNAVAIL
                );

          if ( !gfMakeCallReplyPending && ghCall )
          {
            //gfDropping = TRUE;
            if ( ( gDropCallRequestID = lineDrop ( ghCall, NULL, 0 ) ) < 0 )
            {
              errString ( ghWndMain, gDropCallRequestID, MB_ICONSTOP | MB_OK );
            }
          }

          if ( !fCallOK )
            DialogBoxParam (
                    ghInst,
                    MAKEINTRESOURCE(IDD_CALLFAILED),
                    ghWndMain,
                    (DLGPROC)LineInUseProc,
                    LineDisconnectMode
                     );
          break;
        }
      }
      break;

    case LINE_CLOSE:
      if ( gCurrentLineInfo.hLine == (HLINE)hDevice )
      {
        errString(ghWndMain, ERR_LINECLOSE, MB_ICONEXCLAMATION | MB_OK );
        gCurrentLineInfo.hLine = (HLINE)((ULONG_PTR)NULL);
        gfCurrentLineAvail = FALSE;
        DisableDialButtons(FALSE);
      }
      break;

    case LINE_CREATE:
      // dwParam1 is the new device's ID
      if ( dwParam1 >= gnAvailDevices )
      {
        DWORD* gnAddrTemp;
        DWORD iLine;
        LINEINFO LineInfo;

        // we record new device's address count.

                // we are assuming here that we're just adding a new
                // line and it's sequential and it's the last one

                gnAvailDevices = dwParam1 + 1;

        if (!(gnAddrTemp = (DWORD *) DialerAlloc ( sizeof(DWORD) * (int)(gnAvailDevices))))
          break;

        for ( iLine = 0; iLine < (gnAvailDevices-1); ++iLine )
          gnAddrTemp[iLine] = gnAddr[iLine];

        DialerFree( gnAddr );

        // we have effectively added one more
        // space in the gnAddr array
        gnAddr = gnAddrTemp;

        if ( GetLineInfo( dwParam1, &LineInfo ) != ERR_NONE )
          break;

        gnAddr[dwParam1] = LineInfo.nAddr;
      }
      break;

    case LINE_DEVSPECIFIC:
      break;

    case LINE_DEVSPECIFICFEATURE:
      break;

    case LINE_GATHERDIGITS:
      break;

    case LINE_GENERATE:
      break;

    case LINE_LINEDEVSTATE:
      if ( dwParam1 & LINEDEVSTATE_REINIT )
      {
        if(dwParam2 != 0)
        {
          // this is another msg translated into REINIT
          tapiCallback( hDevice, dwParam2, dwCBInstance, dwParam3, 0, 0 );
        }
        else
        {
          // Re-initialize TAPI
          gfNeedToReinit = TRUE;
        }
      }

      if ( dwParam1 & LINEDEVSTATE_REMOVED )
      {
        DialerLineClose();
        tapiCallback(hDevice, LINE_CLOSE, dwCBInstance, 0, 0, 0); // is this needed?
      }
      break;

    case LINE_MONITORDIGITS:
      break;

    case LINE_MONITORMEDIA:
      break;

    case LINE_MONITORTONE:
      break;

    // async reply from lineMakeCall() or lineDrop()
    case LINE_REPLY:

      // reply for lineMakeCall
      if ( (LONG) dwParam1 == gMakeCallRequestID )
      {
        // error on make call
        if ( dwParam2 != ERR_NONE )
        {
          // Get rid of the Dialing Dialog box if it's up
          if ( ghWndDialing )
          {
             SendMessage(
                  ghWndDialing,
                  WM_COMMAND,
                  MAKEWPARAM(IDOK,0),
                  0
                  );
          }

          if ( dwParam2 == LINEERR_CALLUNAVAIL )
          {
            DialogBoxParam (
                    ghInst,
                    MAKEINTRESOURCE(IDD_CALLFAILED),
                    ghWndMain,
                    (DLGPROC)LineInUseProc,
                    0
                     );
          }
          else
          {
            errString ( ghWndMain, dwParam2, MB_ICONEXCLAMATION | MB_OK );
          }

          ghCall = (HCALL)((ULONG_PTR)NULL);
          DialerLineClose();
          gfCurrentLineAvail = TRUE;
        }

        gfMakeCallReplyPending = FALSE;
      }

      // reply from lineDrop()
      if ( (LONG) dwParam1 == gDropCallRequestID )
      {
        //gfDropping = FALSE;

        // tell "Dialing" window to terminate
        if ( ghWndDialing )
        {
          SendMessage (
                  ghWndDialing,
                  WM_COMMAND,
                  MAKEWPARAM( IDOK,0 ),
                  0
                );
        }

        // tapi call cleanup
        if ( dwParam2 == ERR_NONE )
        {
          if ( !gfMakeCallReplyPending && ghCall )
          {
            if ( ( errCode = lineDeallocateCall( ghCall ) ) < 0 )
            {
              errString ( ghWndMain, errCode, MB_ICONSTOP | MB_OK );
            }
            ghCall = (HCALL)((ULONG_PTR)NULL);
          }
        }
        DialerLineClose ();
        gfCurrentLineAvail = TRUE;
      }

      break;

    case LINE_REQUEST:
      // Simple TAPI request
      if ( dwParam1 == LINEREQUESTMODE_MAKECALL )
      {
        gfCallRequest = TRUE;
      }
      break;
  }
}

int WINAPI WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 379 of file Dialer.c.

{
  HACCEL hAccel;
  MSG msg;
  DWORD errCode;
  HANDLE hImHere;

  ghInst = GetModuleHandle( NULL );
  LoadString( ghInst, ikszAppFriendlyName, gszAppName, sizeof(gszAppName)/sizeof(TCHAR) );

  //
  // Now, let's see if we've already got an instance of ourself
  hImHere = CreateMutex(NULL, TRUE, "DialersIveBeenStartedMutex");

  //
  // Is there another one of us already here?
  if ( ERROR_ALREADY_EXISTS == GetLastError() )
  {
        HWND        hDialerWnd;

        hDialerWnd = FindWindow(gszDialerClassName,
                                NULL);

        SetForegroundWindow(hDialerWnd);

     CloseHandle( hImHere );
     return 0;
  }

  {
    WNDCLASS wc;
    wc.style = CS_DBLCLKS | CS_SAVEBITS | CS_BYTEALIGNWINDOW;
    wc.lpfnWndProc = DefDlgProc;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = DLGWINDOWEXTRA;
    wc.hInstance = ghInst;
    wc.hIcon = LoadIcon(ghInst, MAKEINTRESOURCE(IDI_DIALER) );
    wc.hCursor = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
    wc.lpszMenuName = NULL;
    wc.lpszClassName = gszDialerClassName;
    RegisterClass(&wc);
  }

  // create the dialog box and set it with info
  // from the .INI file
  ghWndMain = CreateDialog (
                ghInst,
                (LPCSTR)MAKEINTRESOURCE(IDD_DIALER),
                (HWND)NULL,
                (DLGPROC)MainWndProc
               );

  ReadINI();
  ButtonFontSetup();

  ShowWindow(ghWndMain, SW_SHOW);
  UpdateWindow(ghWndMain);

  // limit text in Number field to TAPIMAXDESTADDRESSSIZE
  SendDlgItemMessage (
            ghWndMain,
            IDD_DCOMBO,
            CB_LIMITTEXT,
            (WPARAM)TAPIMAXDESTADDRESSSIZE,
            0
             );

  // 0 (ERR_NONE) error code registers success - otherwise terminate
  errCode = InitializeTAPI();
  if(errCode)
  {
    errString(ghWndMain, errCode, MB_APPLMODAL | MB_ICONEXCLAMATION );

    DialerCleanup();
    return errCode;
  }

  errCode = lineRegisterRequestRecipient (
                      ghLineApp,
                      0, // registration instance
                      LINEREQUESTMODE_MAKECALL,
                      TRUE
                       );

  if(errCode)
  {
    gfRegistered = FALSE;
    errString(ghWndMain, errCode, MB_ICONEXCLAMATION | MB_OK );
  }
  else
  {
    gfRegistered = TRUE;
  }

  hAccel = LoadAccelerators(ghInst, gszAppName);

  while ( GetMessage( &msg, NULL, 0, 0 ) )
  {
    if ( ghWndMain == NULL || !IsDialogMessage( ghWndMain, &msg ) )
    {
      if(!TranslateAccelerator(ghWndMain, hAccel, &msg))
      {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
      }
    }

    // If: 1) Dialer is a call manager (if not, ignore requests)
    //     2) the currently chosen line is available
    //     3) there is a Simple TAPI request
    // Then: process the request
    if ( gfCurrentLineAvail && gfCallRequest )
    {
      ManageAssistedTelephony();
    }
  }

  DialerCleanup();

  CloseHandle( hImHere );

  return (int)(msg.wParam);
}

Variable Documentation

LINEINFO gCurrentLineInfo

Definition at line 79 of file Dialer.c.

LONG gDropCallRequestID = 0

Definition at line 76 of file Dialer.c.

DWORD gdwEndSel

Definition at line 84 of file Dialer.c.

DWORD* gdwPLID

Definition at line 86 of file Dialer.c.

DWORD gdwStartSel

Definition at line 83 of file Dialer.c.

BOOL gfCallRequest = FALSE

Definition at line 70 of file Dialer.c.

BOOL gfCurrentLineAvail = TRUE

Definition at line 71 of file Dialer.c.

BOOL gfMakeCallReplyPending = FALSE

Definition at line 73 of file Dialer.c.

BOOL gfNeedToReinit = FALSE

Definition at line 68 of file Dialer.c.

BOOL gfRegistered

Definition at line 64 of file Dialer.c.

HCALL ghCall = (HCALL)((ULONG_PTR)NULL)

Definition at line 59 of file Dialer.c.

HFONT ghFontBtn

Definition at line 55 of file Dialer.c.

HFONT ghFontBtnStar

Definition at line 57 of file Dialer.c.

HFONT ghFontBtnText

Definition at line 56 of file Dialer.c.

HINSTANCE ghInst = 0

Name of app.

Definition at line 46 of file Dialer.c.

HLINEAPP ghLineApp = (HLINEAPP)((ULONG_PTR)NULL)

Definition at line 58 of file Dialer.c.

HWND ghWndDialing = NULL

Definition at line 45 of file Dialer.c.

HWND ghWndMain

Handle to instance.

Definition at line 44 of file Dialer.c.

DWORD giCurrentAddress = 0

Definition at line 88 of file Dialer.c.

DWORD giCurrentLine = (DWORD)-1

Definition at line 87 of file Dialer.c.

LONG gMakeCallRequestID = 0

Definition at line 75 of file Dialer.c.

DWORD* gnAddr

Definition at line 80 of file Dialer.c.

DWORD gnAvailDevices = 0

Definition at line 78 of file Dialer.c.

LPSTR gszCurrentName = NULL

Definition at line 62 of file Dialer.c.

LPSTR gszCurrentNumber = NULL

Definition at line 61 of file Dialer.c.

TCHAR const gszNULL[] = ""

Definition at line 52 of file Dialer.c.

TCHAR gszSDNumber[NSPEEDDIALS+1][TAPIMAXDESTADDRESSSIZE]

Definition at line 92 of file Dialer.c.

Generated on Wed Nov 13 2024 16:54:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi2/Dialer/Dialer.h File Reference

  • NetDS
  • Tapi
  • Tapi2
  • Dialer
Defines

Dialer.h File Reference

#include <windows.h>
#include "tapi.h"
#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Defines

#define | ERR_911WARN 4
#define | ERR_LINECLOSE 2
#define | ERR_NEWDEFAULT 5
#define | ERR_NOLINES 3
#define | ERR_NONE 0
#define | ERR_NOVOICELINE 1
#define | INVALID_LINE 2
#define | itoa(x, y, z) _itoa(x,y,z)
#define | MAXBUFSIZE 256
#define | MAXNUMLENGTH 64
#define | MENU_CHOICE 1
#define | NLASTDIALED 20
#define | NSPEEDDIALS 8
#define | TAPI_CURRENT_VERSION TAPI_VERSION_2_0
#define | TAPI_VERSION_1_0 0x00010003
#define | TAPI_VERSION_1_4 0x00010004
#define | TAPI_VERSION_2_0 0x00020000

Define Documentation

#define ERR_911WARN 4

Definition at line 46 of file Dialer.h.

#define ERR_LINECLOSE 2

Definition at line 44 of file Dialer.h.

#define ERR_NEWDEFAULT 5

Definition at line 47 of file Dialer.h.

#define ERR_NOLINES 3

Definition at line 45 of file Dialer.h.

#define ERR_NONE 0

Definition at line 42 of file Dialer.h.

#define ERR_NOVOICELINE 1

Definition at line 43 of file Dialer.h.

#define INVALID_LINE 2

Definition at line 34 of file Dialer.h.

#define itoa | ( | x,
 |  | y,
 |  | z |
 | ) |  | _itoa(x,y,z)

Definition at line 49 of file Dialer.h.

#define MAXBUFSIZE 256

Definition at line 38 of file Dialer.h.

#define MAXNUMLENGTH 64

Definition at line 37 of file Dialer.h.

#define MENU_CHOICE 1

Definition at line 33 of file Dialer.h.

#define NLASTDIALED 20

Definition at line 40 of file Dialer.h.

#define NSPEEDDIALS 8

Definition at line 39 of file Dialer.h.

#define TAPI_CURRENT_VERSION TAPI_VERSION_2_0

Definition at line 27 of file Dialer.h.

#define TAPI_VERSION_1_0 0x00010003

Definition at line 24 of file Dialer.h.

#define TAPI_VERSION_1_4 0x00010004

Definition at line 25 of file Dialer.h.

#define TAPI_VERSION_2_0 0x00020000

Definition at line 26 of file Dialer.h.

Generated on Wed Nov 13 2024 16:54:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi2/Dialer/Dialhelp.h File Reference

  • NetDS
  • Tapi
  • Tapi2
  • Dialer
Defines

Dialhelp.h File Reference

Go to the source code of this file.

Defines

#define | IDH_DIALER_BUTTONS 1025
#define | IDH_DIALER_CHANGE_DIAL_HELPER 1000
#define | IDH_DIALER_CHANGE_DIGITS 1001
#define | IDH_DIALER_CHANGE_OPTIONS 1002
#define | IDH_DIALER_CHANGE_REDIAL_BUTTON 1003
#define | IDH_DIALER_DIAL_BUTTON 1021
#define | IDH_DIALER_DIAL_KEYPAD 1022
#define | IDH_DIALER_DIAL_NUMBER 1019
#define | IDH_DIALER_DIAL_SPEED_CHOOSE 1020
#define | IDH_DIALER_DIALING_LOGNAME 1004
#define | IDH_DIALER_DIALING_STATUS 1005
#define | IDH_DIALER_HANGUP 1006
#define | IDH_DIALER_LOG 1023
#define | IDH_DIALER_LOG_IN 1007
#define | IDH_DIALER_LOG_OUT 1008
#define | IDH_DIALER_OPTIONS_ADDRESS 1009
#define | IDH_DIALER_OPTIONS_LINE 1010
#define | IDH_DIALER_OPTIONS_NONVOICE 1011
#define | IDH_DIALER_OPTIONS_PROPERTIES 1024
#define | IDH_DIALER_OPTIONS_VOICE 1012
#define | IDH_DIALER_PAUSE_CONTINUE 1013
#define | IDH_DIALER_SPEED_CHOOSE 1014
#define | IDH_DIALER_SPEED_NAME 1015
#define | IDH_DIALER_SPEED_NUMBER 1016
#define | IDH_DIALER_SPEED_SAVE 1017
#define | IDH_DIALER_SPEED_SAVE_DIAL 1018

Define Documentation

#define IDH_DIALER_BUTTONS 1025

Definition at line 29 of file Dialhelp.h.

#define IDH_DIALER_CHANGE_DIAL_HELPER 1000

Definition at line 4 of file Dialhelp.h.

#define IDH_DIALER_CHANGE_DIGITS 1001

Definition at line 5 of file Dialhelp.h.

#define IDH_DIALER_CHANGE_OPTIONS 1002

Definition at line 6 of file Dialhelp.h.

#define IDH_DIALER_CHANGE_REDIAL_BUTTON 1003

Definition at line 7 of file Dialhelp.h.

#define IDH_DIALER_DIAL_BUTTON 1021

Definition at line 25 of file Dialhelp.h.

#define IDH_DIALER_DIAL_KEYPAD 1022

Definition at line 26 of file Dialhelp.h.

#define IDH_DIALER_DIAL_NUMBER 1019

Definition at line 23 of file Dialhelp.h.

#define IDH_DIALER_DIAL_SPEED_CHOOSE 1020

Definition at line 24 of file Dialhelp.h.

#define IDH_DIALER_DIALING_LOGNAME 1004

Definition at line 8 of file Dialhelp.h.

#define IDH_DIALER_DIALING_STATUS 1005

Definition at line 9 of file Dialhelp.h.

#define IDH_DIALER_HANGUP 1006

Definition at line 10 of file Dialhelp.h.

#define IDH_DIALER_LOG 1023

Definition at line 27 of file Dialhelp.h.

#define IDH_DIALER_LOG_IN 1007

Definition at line 11 of file Dialhelp.h.

#define IDH_DIALER_LOG_OUT 1008

Definition at line 12 of file Dialhelp.h.

#define IDH_DIALER_OPTIONS_ADDRESS 1009

Definition at line 13 of file Dialhelp.h.

#define IDH_DIALER_OPTIONS_LINE 1010

Definition at line 14 of file Dialhelp.h.

#define IDH_DIALER_OPTIONS_NONVOICE 1011

Definition at line 15 of file Dialhelp.h.

#define IDH_DIALER_OPTIONS_PROPERTIES 1024

Definition at line 28 of file Dialhelp.h.

#define IDH_DIALER_OPTIONS_VOICE 1012

Definition at line 16 of file Dialhelp.h.

#define IDH_DIALER_PAUSE_CONTINUE 1013

Definition at line 17 of file Dialhelp.h.

#define IDH_DIALER_SPEED_CHOOSE 1014

Definition at line 18 of file Dialhelp.h.

#define IDH_DIALER_SPEED_NAME 1015

Definition at line 19 of file Dialhelp.h.

#define IDH_DIALER_SPEED_NUMBER 1016

Definition at line 20 of file Dialhelp.h.

#define IDH_DIALER_SPEED_SAVE 1017

Definition at line 21 of file Dialhelp.h.

#define IDH_DIALER_SPEED_SAVE_DIAL 1018

Definition at line 22 of file Dialhelp.h.

Generated on Wed Nov 13 2024 16:54:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi2/Dialer/Resource.h File Reference

  • NetDS
  • Tapi
  • Tapi2
  • Dialer
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDA_DIALER 117
#define | IDD_ABOUT 700
#define | IDD_AICON 701
#define | IDD_ATEXTCOPYRIGHT 707
#define | IDD_ATEXTFREEMEM 705
#define | IDD_ATEXTRESOURCE 706
#define | IDD_ATEXTTITLE 702
#define | IDD_ATEXTVERSION 703
#define | IDD_ATEXTWINMODE 704
#define | IDD_CALLFAILED 1300
#define | IDD_CFTEXT 1301
#define | IDD_CONNECTUSING 500
#define | IDD_CUERRORTEXT -1
#define | IDD_CULISTADDRESS 502
#define | IDD_CULISTLINE 501
#define | IDD_CUPROPERTIES 506
#define | IDD_CUSIMPLETAPICHKBOX 503
#define | IDD_CUTEXTADDRESS 505
#define | IDD_CUTEXTLINE 504
#define | IDD_DBUTTON0 211
#define | IDD_DBUTTON1 202
#define | IDD_DBUTTON2 203
#define | IDD_DBUTTON3 204
#define | IDD_DBUTTON4 205
#define | IDD_DBUTTON5 206
#define | IDD_DBUTTON6 207
#define | IDD_DBUTTON7 208
#define | IDD_DBUTTON8 209
#define | IDD_DBUTTON9 210
#define | IDD_DBUTTONPOUND 213
#define | IDD_DBUTTONSTAR 212
#define | IDD_DCOMBO 201
#define | IDD_DDIAL 1
#define | IDD_DGNAMETEXT 1004
#define | IDD_DGNUMBER -1
#define | IDD_DGNUMBERTEXT 1002
#define | IDD_DIALER 200
#define | IDD_DIALING 9115
#define | IDD_DNUMTODIAL 223
#define | IDD_DRECTSEPARATOR 224
#define | IDD_DSPEEDDIAL1 214
#define | IDD_DSPEEDDIAL2 215
#define | IDD_DSPEEDDIAL3 216
#define | IDD_DSPEEDDIAL4 217
#define | IDD_DSPEEDDIAL5 218
#define | IDD_DSPEEDDIAL6 219
#define | IDD_DSPEEDDIAL7 220
#define | IDD_DSPEEDDIAL8 221
#define | IDD_DSPEEDDIALGRP 222
#define | IDD_DSPEEDDIALTEXT1 225
#define | IDD_DSPEEDDIALTEXT2 226
#define | IDD_DSPEEDDIALTEXT3 227
#define | IDD_DSPEEDDIALTEXT4 228
#define | IDD_DSPEEDDIALTEXT5 229
#define | IDD_DSPEEDDIALTEXT6 230
#define | IDD_DSPEEDDIALTEXT7 231
#define | IDD_DSPEEDDIALTEXT8 232
#define | IDD_INUSE 900
#define | IDD_IUICON 901
#define | IDD_IUTEXT1 902
#define | IDD_IUTEXT2 903
#define | IDD_SD1 300
#define | IDD_SD1EDITNAME 317
#define | IDD_SD1EDITNUMBER 318
#define | IDD_SD1RECTSEPARATOR 323
#define | IDD_SD1SPEEDDIAL1 301
#define | IDD_SD1SPEEDDIAL2 302
#define | IDD_SD1SPEEDDIAL3 303
#define | IDD_SD1SPEEDDIAL4 304
#define | IDD_SD1SPEEDDIAL5 305
#define | IDD_SD1SPEEDDIAL6 306
#define | IDD_SD1SPEEDDIAL7 307
#define | IDD_SD1SPEEDDIAL8 308
#define | IDD_SD1SPEEDDIALTEXT1 324
#define | IDD_SD1SPEEDDIALTEXT2 325
#define | IDD_SD1SPEEDDIALTEXT3 326
#define | IDD_SD1SPEEDDIALTEXT4 327
#define | IDD_SD1SPEEDDIALTEXT5 328
#define | IDD_SD1SPEEDDIALTEXT6 329
#define | IDD_SD1SPEEDDIALTEXT7 330
#define | IDD_SD1SPEEDDIALTEXT8 331
#define | IDD_SD1TEXTCHOOSE 319
#define | IDD_SD1TEXTENTER 320
#define | IDD_SD1TEXTNAME 321
#define | IDD_SD1TEXTNUMBER 322
#define | IDD_SD2 400
#define | IDD_SD2EDITNAME 402
#define | IDD_SD2EDITNUMBER 403
#define | IDD_SD2SAVEANDDIAL 401
#define | IDD_SD2TEXTENTER 404
#define | IDD_SD2TEXTNAME 405
#define | IDD_SD2TEXTNUMBER 406
#define | IDI_DIALER 1
#define | IDI_LINEBUSY 116
#define | IDM_ABOUT 1011
#define | IDM_ACCEL_HELP 1013
#define | IDM_ACCEL_NUMTODIAL 1012
#define | IDM_CONNECTUSING 1006
#define | IDM_EDIT_COPY 1002
#define | IDM_EDIT_CUT 1001
#define | IDM_EDIT_DELETE 1004
#define | IDM_EDIT_PASTE 1003
#define | IDM_EDIT_SPEEDDIAL 1005
#define | IDM_EXIT 1000
#define | IDM_LOCATION 1008
#define | IDM_MENU 118
#define | ikszAppFriendlyName 902
#define | ikszAppName 901
#define | ikszDisconnectedBusy 1546
#define | ikszDisconnectedCantDo 1548
#define | ikszDisconnectedIncompatible 1550
#define | ikszDisconnectedNetwork 1549
#define | ikszDisconnectedNoAnswer 1547
#define | ikszDisconnectedNoDialTone 1554
#define | ikszDisconnectedReject 1545
#define | ikszErrAddrBlocked 950
#define | ikszErrBadTAPIAddr 1015
#define | ikszErrBillingRejected 952
#define | ikszErrDefault 940
#define | ikszErrInvalAddress 945
#define | ikszErrInvalCallState 1551
#define | ikszErrInvalidCountryCode 1555
#define | ikszErrLineClose 1553
#define | ikszErrLineInitBadIniFile 1013
#define | ikszErrLineInitNoDevice 1016
#define | ikszErrLineInitNoDriver 1014
#define | ikszErrLineInitWrongDrivers 949
#define | ikszErrNoMultipleInstance 1020
#define | ikszErrNoVoiceLine 943
#define | ikszErrOOM 941
#define | ikszErrResUnavail 956
#define | ikszErrTAPI 942
#define | ikszWarning911 1544
#define | ikszWarningFor911 978
#define | ikszWarningNewDefault 979
#define | ikszWarningRegisterSTapi 978
#define | ikszWarningTapiReInit 1552
#define | ikszWarningTitle 977

Define Documentation

#define IDA_DIALER 117

Definition at line 8 of file Resource.h.

#define IDD_ABOUT 700

Definition at line 81 of file Resource.h.

#define IDD_AICON 701

Definition at line 82 of file Resource.h.

#define IDD_ATEXTCOPYRIGHT 707

Definition at line 88 of file Resource.h.

#define IDD_ATEXTFREEMEM 705

Definition at line 86 of file Resource.h.

#define IDD_ATEXTRESOURCE 706

Definition at line 87 of file Resource.h.

#define IDD_ATEXTTITLE 702

Definition at line 83 of file Resource.h.

#define IDD_ATEXTVERSION 703

Definition at line 84 of file Resource.h.

#define IDD_ATEXTWINMODE 704

Definition at line 85 of file Resource.h.

#define IDD_CALLFAILED 1300

Definition at line 126 of file Resource.h.

#define IDD_CFTEXT 1301

Definition at line 127 of file Resource.h.

#define IDD_CONNECTUSING 500

Definition at line 74 of file Resource.h.

#define IDD_CUERRORTEXT -1

Definition at line 141 of file Resource.h.

#define IDD_CULISTADDRESS 502

Definition at line 76 of file Resource.h.

#define IDD_CULISTLINE 501

Definition at line 75 of file Resource.h.

#define IDD_CUPROPERTIES 506

Definition at line 80 of file Resource.h.

#define IDD_CUSIMPLETAPICHKBOX 503

Definition at line 77 of file Resource.h.

#define IDD_CUTEXTADDRESS 505

Definition at line 79 of file Resource.h.

#define IDD_CUTEXTLINE 504

Definition at line 78 of file Resource.h.

#define IDD_DBUTTON0 211

Definition at line 21 of file Resource.h.

#define IDD_DBUTTON1 202

Definition at line 12 of file Resource.h.

#define IDD_DBUTTON2 203

Definition at line 13 of file Resource.h.

#define IDD_DBUTTON3 204

Definition at line 14 of file Resource.h.

#define IDD_DBUTTON4 205

Definition at line 15 of file Resource.h.

#define IDD_DBUTTON5 206

Definition at line 16 of file Resource.h.

#define IDD_DBUTTON6 207

Definition at line 17 of file Resource.h.

#define IDD_DBUTTON7 208

Definition at line 18 of file Resource.h.

#define IDD_DBUTTON8 209

Definition at line 19 of file Resource.h.

#define IDD_DBUTTON9 210

Definition at line 20 of file Resource.h.

#define IDD_DBUTTONPOUND 213

Definition at line 23 of file Resource.h.

#define IDD_DBUTTONSTAR 212

Definition at line 22 of file Resource.h.

#define IDD_DCOMBO 201

Definition at line 11 of file Resource.h.

#define IDD_DDIAL 1

Definition at line 6 of file Resource.h.

#define IDD_DGNAMETEXT 1004

Definition at line 114 of file Resource.h.

#define IDD_DGNUMBER -1

Definition at line 142 of file Resource.h.

#define IDD_DGNUMBERTEXT 1002

Definition at line 111 of file Resource.h.

#define IDD_DIALER 200

Definition at line 10 of file Resource.h.

#define IDD_DIALING 9115

Definition at line 140 of file Resource.h.

#define IDD_DNUMTODIAL 223

Definition at line 33 of file Resource.h.

#define IDD_DRECTSEPARATOR 224

Definition at line 34 of file Resource.h.

#define IDD_DSPEEDDIAL1 214

Definition at line 24 of file Resource.h.

#define IDD_DSPEEDDIAL2 215

Definition at line 25 of file Resource.h.

#define IDD_DSPEEDDIAL3 216

Definition at line 26 of file Resource.h.

#define IDD_DSPEEDDIAL4 217

Definition at line 27 of file Resource.h.

#define IDD_DSPEEDDIAL5 218

Definition at line 28 of file Resource.h.

#define IDD_DSPEEDDIAL6 219

Definition at line 29 of file Resource.h.

#define IDD_DSPEEDDIAL7 220

Definition at line 30 of file Resource.h.

#define IDD_DSPEEDDIAL8 221

Definition at line 31 of file Resource.h.

#define IDD_DSPEEDDIALGRP 222

Definition at line 32 of file Resource.h.

#define IDD_DSPEEDDIALTEXT1 225

Definition at line 35 of file Resource.h.

#define IDD_DSPEEDDIALTEXT2 226

Definition at line 36 of file Resource.h.

#define IDD_DSPEEDDIALTEXT3 227

Definition at line 37 of file Resource.h.

#define IDD_DSPEEDDIALTEXT4 228

Definition at line 38 of file Resource.h.

#define IDD_DSPEEDDIALTEXT5 229

Definition at line 39 of file Resource.h.

#define IDD_DSPEEDDIALTEXT6 230

Definition at line 40 of file Resource.h.

#define IDD_DSPEEDDIALTEXT7 231

Definition at line 41 of file Resource.h.

#define IDD_DSPEEDDIALTEXT8 232

Definition at line 42 of file Resource.h.

#define IDD_INUSE 900

Definition at line 89 of file Resource.h.

#define IDD_IUICON 901

Definition at line 90 of file Resource.h.

#define IDD_IUTEXT1 902

Definition at line 92 of file Resource.h.

#define IDD_IUTEXT2 903

Definition at line 94 of file Resource.h.

#define IDD_SD1 300

Definition at line 43 of file Resource.h.

#define IDD_SD1EDITNAME 317

Definition at line 52 of file Resource.h.

#define IDD_SD1EDITNUMBER 318

Definition at line 53 of file Resource.h.

#define IDD_SD1RECTSEPARATOR 323

Definition at line 58 of file Resource.h.

#define IDD_SD1SPEEDDIAL1 301

Definition at line 44 of file Resource.h.

#define IDD_SD1SPEEDDIAL2 302

Definition at line 45 of file Resource.h.

#define IDD_SD1SPEEDDIAL3 303

Definition at line 46 of file Resource.h.

#define IDD_SD1SPEEDDIAL4 304

Definition at line 47 of file Resource.h.

#define IDD_SD1SPEEDDIAL5 305

Definition at line 48 of file Resource.h.

#define IDD_SD1SPEEDDIAL6 306

Definition at line 49 of file Resource.h.

#define IDD_SD1SPEEDDIAL7 307

Definition at line 50 of file Resource.h.

#define IDD_SD1SPEEDDIAL8 308

Definition at line 51 of file Resource.h.

#define IDD_SD1SPEEDDIALTEXT1 324

Definition at line 59 of file Resource.h.

#define IDD_SD1SPEEDDIALTEXT2 325

Definition at line 60 of file Resource.h.

#define IDD_SD1SPEEDDIALTEXT3 326

Definition at line 61 of file Resource.h.

#define IDD_SD1SPEEDDIALTEXT4 327

Definition at line 62 of file Resource.h.

#define IDD_SD1SPEEDDIALTEXT5 328

Definition at line 63 of file Resource.h.

#define IDD_SD1SPEEDDIALTEXT6 329

Definition at line 64 of file Resource.h.

#define IDD_SD1SPEEDDIALTEXT7 330

Definition at line 65 of file Resource.h.

#define IDD_SD1SPEEDDIALTEXT8 331

Definition at line 66 of file Resource.h.

#define IDD_SD1TEXTCHOOSE 319

Definition at line 54 of file Resource.h.

#define IDD_SD1TEXTENTER 320

Definition at line 55 of file Resource.h.

#define IDD_SD1TEXTNAME 321

Definition at line 56 of file Resource.h.

#define IDD_SD1TEXTNUMBER 322

Definition at line 57 of file Resource.h.

#define IDD_SD2 400

Definition at line 67 of file Resource.h.

#define IDD_SD2EDITNAME 402

Definition at line 69 of file Resource.h.

#define IDD_SD2EDITNUMBER 403

Definition at line 70 of file Resource.h.

#define IDD_SD2SAVEANDDIAL 401

Definition at line 68 of file Resource.h.

#define IDD_SD2TEXTENTER 404

Definition at line 71 of file Resource.h.

#define IDD_SD2TEXTNAME 405

Definition at line 72 of file Resource.h.

#define IDD_SD2TEXTNUMBER 406

Definition at line 73 of file Resource.h.

#define IDI_DIALER 1

Definition at line 5 of file Resource.h.

#define IDI_LINEBUSY 116

Definition at line 7 of file Resource.h.

#define IDM_ABOUT 1011

Definition at line 118 of file Resource.h.

#define IDM_ACCEL_HELP 1013

Definition at line 121 of file Resource.h.

#define IDM_ACCEL_NUMTODIAL 1012

Definition at line 119 of file Resource.h.

#define IDM_CONNECTUSING 1006

Definition at line 116 of file Resource.h.

#define IDM_EDIT_COPY 1002

Definition at line 110 of file Resource.h.

#define IDM_EDIT_CUT 1001

Definition at line 109 of file Resource.h.

#define IDM_EDIT_DELETE 1004

Definition at line 113 of file Resource.h.

#define IDM_EDIT_PASTE 1003

Definition at line 112 of file Resource.h.

#define IDM_EDIT_SPEEDDIAL 1005

Definition at line 115 of file Resource.h.

#define IDM_EXIT 1000

Definition at line 108 of file Resource.h.

#define IDM_LOCATION 1008

Definition at line 117 of file Resource.h.

#define IDM_MENU 118

Definition at line 9 of file Resource.h.

#define ikszAppFriendlyName 902

Definition at line 93 of file Resource.h.

#define ikszAppName 901

Definition at line 91 of file Resource.h.

#define ikszDisconnectedBusy 1546

Definition at line 130 of file Resource.h.

#define ikszDisconnectedCantDo 1548

Definition at line 132 of file Resource.h.

#define ikszDisconnectedIncompatible 1550

Definition at line 134 of file Resource.h.

#define ikszDisconnectedNetwork 1549

Definition at line 133 of file Resource.h.

#define ikszDisconnectedNoAnswer 1547

Definition at line 131 of file Resource.h.

#define ikszDisconnectedNoDialTone 1554

Definition at line 138 of file Resource.h.

#define ikszDisconnectedReject 1545

Definition at line 129 of file Resource.h.

#define ikszErrAddrBlocked 950

Definition at line 101 of file Resource.h.

#define ikszErrBadTAPIAddr 1015

Definition at line 123 of file Resource.h.

#define ikszErrBillingRejected 952

Definition at line 102 of file Resource.h.

#define ikszErrDefault 940

Definition at line 95 of file Resource.h.

#define ikszErrInvalAddress 945

Definition at line 99 of file Resource.h.

#define ikszErrInvalCallState 1551

Definition at line 135 of file Resource.h.

#define ikszErrInvalidCountryCode 1555

Definition at line 139 of file Resource.h.

#define ikszErrLineClose 1553

Definition at line 137 of file Resource.h.

#define ikszErrLineInitBadIniFile 1013

Definition at line 120 of file Resource.h.

#define ikszErrLineInitNoDevice 1016

Definition at line 124 of file Resource.h.

#define ikszErrLineInitNoDriver 1014

Definition at line 122 of file Resource.h.

#define ikszErrLineInitWrongDrivers 949

Definition at line 100 of file Resource.h.

#define ikszErrNoMultipleInstance 1020

Definition at line 125 of file Resource.h.

#define ikszErrNoVoiceLine 943

Definition at line 98 of file Resource.h.

#define ikszErrOOM 941

Definition at line 96 of file Resource.h.

#define ikszErrResUnavail 956

Definition at line 103 of file Resource.h.

#define ikszErrTAPI 942

Definition at line 97 of file Resource.h.

#define ikszWarning911 1544

Definition at line 128 of file Resource.h.

#define ikszWarningFor911 978

Definition at line 106 of file Resource.h.

#define ikszWarningNewDefault 979

Definition at line 107 of file Resource.h.

#define ikszWarningRegisterSTapi 978

Definition at line 105 of file Resource.h.

#define ikszWarningTapiReInit 1552

Definition at line 136 of file Resource.h.

#define ikszWarningTitle 977

Definition at line 104 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi2/TapiComm/ABOUT.c File Reference

  • NetDS
  • Tapi
  • Tapi2
  • TapiComm
Defines | Functions | Variables

ABOUT.c File Reference

#include <windows.h>
#include <windowsx.h>
#include "globals.h"

Go to the source code of this file.

Defines

#define | POINTSIZE 8

Functions

LRESULT CALLBACK | About (HWND, UINT, WPARAM, LPARAM)
LRESULT | CmdAbout (HWND hwnd, WORD wCommand, WORD wNotify, HWND hwndCtrl)
LRESULT | CmdAboutDone (HWND, WORD, WORD, HWND)
LRESULT | MsgAboutCommand (HWND, UINT, WPARAM, LPARAM)
LRESULT | MsgAboutInit (HWND, UINT, WPARAM, LPARAM)

Variables

CMDI cmdiAbout
HFONT | hFontCopyright
MSDI msdiAbout
CMD rgcmdAbout []
MSD rgmsdAbout []

Define Documentation

#define POINTSIZE 8

Function Documentation

LRESULT CALLBACK About | ( | HWND | hdlg,
 |  | UINT | uMessage,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 115 of file ABOUT.c.

{
    return DispMessage(&msdiAbout, hdlg, uMessage, wparam, lparam);
}

LRESULT CmdAbout | ( | HWND | hwnd,
 |  | WORD | wCommand,
 |  | WORD | wNotify,
 |  | HWND | hwndCtrl
 | ) |  |

Definition at line 85 of file ABOUT.c.

{
    DialogBox(hInst, "AboutBox", hwnd, (DLGPROC)About);
    return 0;
}

LRESULT CmdAboutDone | ( | HWND | hdlg,
 |  | WORD | wCommand,
 |  | WORD | wNotify,
 |  | HWND | hwndCtrl
 | ) |  |

Definition at line 268 of file ABOUT.c.

{
    if (hFontCopyright)
       DeleteObject(hFontCopyright);

    EndDialog(hdlg, TRUE);          // Exit the dialog
    return TRUE;
}

LRESULT MsgAboutCommand | ( | HWND | hwnd,
 |  | UINT | uMessage,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 242 of file ABOUT.c.

{
    return DispCommand(&cmdiAbout, hwnd, wparam, lparam);
}

LRESULT MsgAboutInit | ( | HWND | hdlg,
 |  | UINT | uMessage,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 140 of file ABOUT.c.

{
    #define POINTSIZE 8

    char  szFullPath[256];
    DWORD dwVerHnd;
    DWORD dwVerInfoSize;
    HDC   hDC;
    int   iLogPixelsY, iPointSize;

    // Center the dialog over the application window
    CenterWindow(hdlg, GetWindow(hdlg, GW_OWNER));

    // Set the copyright font to something smaller than default
    hDC = GetDC(hdlg);
    iLogPixelsY = GetDeviceCaps(hDC, LOGPIXELSY);
    ReleaseDC(hdlg, hDC);
    iPointSize = MulDiv(iLogPixelsY, POINTSIZE, 72);
    iPointSize *= -1;

    hFontCopyright = CreateFont(iPointSize,
                                0, 0, 0,
                                FW_BOLD,
                                0, 0, 0, 0,
                                0, 0, 0, 0,
                                "Arial");

    SendDlgItemMessage(hdlg,
                       IDD_VERLAST,
                       WM_SETFONT,
                       (WPARAM)hFontCopyright,
                       0L);

    // Get version information from the application
    GetModuleFileName(hInst, szFullPath, sizeof(szFullPath));
    dwVerInfoSize = GetFileVersionInfoSize(szFullPath, &dwVerHnd);
    if (dwVerInfoSize)
    {
        // If we were able to get the information, process it:
        HANDLE  hMem;
        LPVOID  lpvMem;
        char    szGetName[256];
        int     cchRoot;
        int     i;
    DWORD dwRemainingLength;

        hMem = GlobalAlloc(GMEM_MOVEABLE, dwVerInfoSize);
        lpvMem = GlobalLock(hMem);
        GetFileVersionInfo(szFullPath, dwVerHnd, dwVerInfoSize, lpvMem);
        strncpy(szGetName, "\\StringFileInfo\\040904E4\\",255 );
    szGetName[255] = '\0';
        cchRoot = lstrlen(szGetName);

        // Walk through the dialog items that we want to replace:
        for (i = IDD_VERFIRST; i <= IDD_VERLAST; i++)
        {
            BOOL  fRet;
            UINT  cchVer = 0;
            LPSTR lszVer = NULL;
            char  szResult[256];

            GetDlgItemText(hdlg, i, szResult, sizeof(szResult));
      dwRemainingLength = 255 - strlen(szGetName);
            strncpy(&szGetName[cchRoot], szResult, dwRemainingLength);
      szGetName[255] = '\0';
            fRet = VerQueryValue(lpvMem, szGetName, &lszVer, &cchVer);

            if (fRet && cchVer && lszVer)
            {
                // Replace dialog item text with version info

                strncpy(szResult, lszVer, 255);
        szResult[255] = '\0';
                SetDlgItemText(hdlg, i, szResult);
            }
        }
        GlobalUnlock(hMem);
        GlobalFree(hMem);
    }
    return TRUE;
}

Variable Documentation

CMDI cmdiAbout
Initial value:
{
    sizeof(rgcmdAbout) / sizeof(CMD),
    rgcmdAbout,
    edwpNone
}

Definition at line 54 of file ABOUT.c.

HFONT hFontCopyright

Definition at line 64 of file ABOUT.c.

MSDI msdiAbout
Initial value:
{
    sizeof(rgmsdAbout) / sizeof(MSD),
    rgmsdAbout,
    edwpNone
}

Definition at line 40 of file ABOUT.c.

CMD rgcmdAbout[]
Initial value:
{
    {IDOK,     CmdAboutDone},
    {IDCANCEL, CmdAboutDone}
}

Definition at line 48 of file ABOUT.c.

MSD rgmsdAbout[]
Initial value:
{
    {WM_COMMAND,    MsgAboutCommand},
    {WM_INITDIALOG, MsgAboutInit}
}

Definition at line 34 of file ABOUT.c.

Generated on Wed Nov 13 2024 16:54:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi2/TapiComm/CommCode.c File Reference

  • NetDS
  • Tapi
  • Tapi2
  • TapiComm
Defines | Functions | Variables

CommCode.c File Reference

#include <windows.h>
#include <string.h>
#include "TapiCode.h"
#include "CommCode.h"
#include "globals.h"
#include "TapiInfo.h"
#include "EditCtls.h"

Go to the source code of this file.

Defines

#define | INPUTBUFFERSIZE 2048
#define | PWM_COMMWRITE WM_USER+1

Functions

void | CloseReadThread ()
void | CloseWriteThread ()
BOOL | HandleCommEvent (LPOVERLAPPED lpOverlappedCommEvent, LPDWORD lpfdwEvtMask, BOOL fRetrieveEvent)
BOOL | HandleReadData (LPCSTR lpszInputBuffer, DWORD dwSizeofBuffer)
BOOL | HandleReadEvent (LPOVERLAPPED lpOverlappedRead, LPSTR lpszInputBuffer, DWORD dwSizeofBuffer, LPDWORD lpnNumberOfBytesRead)
BOOL | HandleWriteData (LPOVERLAPPED lpOverlappedWrite, LPCSTR lpszStringToWrite, DWORD dwNumberOfBytesToWrite)
BOOL | SetupCommEvent (LPOVERLAPPED lpOverlappedCommEvent, LPDWORD lpfdwEvtMask)
BOOL | SetupReadEvent (LPOVERLAPPED lpOverlappedRead, LPSTR lpszInputBuffer, DWORD dwSizeofBuffer, LPDWORD lpnNumberOfBytesRead)
BOOL | StartComm (HANDLE hNewCommFile)
DWORD WINAPI | StartReadThreadProc (LPVOID lpvParam)
DWORD WINAPI | StartWriteThreadProc (LPVOID lpvParam)
void | StopComm ()
BOOL | WriteCommString (LPCSTR lpszStringToWrite, DWORD dwSizeofStringToWrite)

Variables

DWORD | g_dwReadThreadID = 0
DWORD | g_dwWriteThreadID = 0
HANDLE | g_hCloseEvent = NULL
HANDLE | g_hCommFile = NULL
HANDLE | g_hReadThread = NULL
HANDLE | g_hWriteThread = NULL

Define Documentation

#define INPUTBUFFERSIZE 2048

Definition at line 50 of file CommCode.c.

#define PWM_COMMWRITE WM_USER+1

Definition at line 47 of file CommCode.c.

Function Documentation

void CloseReadThread ( )

Definition at line 350 of file CommCode.c.

{
    // If it exists...
    if (g_hReadThread)
    {
        OutputDebugString("Closing Read Thread\n");

        // Signal the event to close the worker threads.
        SetEvent(g_hCloseEvent);

        // Purge all outstanding reads
        PurgeComm(g_hCommFile, PURGE_RXABORT | PURGE_RXCLEAR);

        // Wait 10 seconds for it to exit.  Shouldn't happen.
        if (WaitForSingleObject(g_hReadThread, 10000) == WAIT_TIMEOUT)
        {
            OutputDebugString("Read thread not exiting.  Terminating it.\n");

            TerminateThread(g_hReadThread, 0);

            // The ReadThread cleans up these itself if it terminates
            // normally.
            CloseHandle(g_hReadThread);
            g_hReadThread = 0;
            g_dwReadThreadID = 0;
        }
    }
}

void CloseWriteThread ( )

Definition at line 403 of file CommCode.c.

{
    // If it exists...
    if (g_hWriteThread)
    {
        OutputDebugString("Closing Write Thread\n");

        // Signal the event to close the worker threads.
        SetEvent(g_hCloseEvent);

        // Purge all outstanding writes.
        PurgeComm(g_hCommFile, PURGE_TXABORT | PURGE_TXCLEAR);

        // Wait 10 seconds for it to exit.  Shouldn't happen.
        if (WaitForSingleObject(g_hWriteThread, 10000) == WAIT_TIMEOUT)
        {
            OutputDebugString("Write thread not exiting.  Terminating it.\n");

            TerminateThread(g_hWriteThread, 0);

            // The WriteThread cleans up these itself if it terminates
            // normally.
            CloseHandle(g_hWriteThread);
            g_hWriteThread = 0;
            g_dwWriteThreadID = 0;

        }
    }
}

BOOL HandleCommEvent | ( | LPOVERLAPPED | lpOverlappedCommEvent,
 |  | LPDWORD | lpfdwEvtMask,
 |  | BOOL | fRetrieveEvent
 | ) |  |

Definition at line 1230 of file CommCode.c.

{
    DWORD dwDummy;
    LPSTR lpszOutput;
    char szError[128] = "";
    DWORD dwErrors;
    DWORD nOutput;
    DWORD dwLastError;
  DWORD dwRemainingLength;

    lpszOutput = LocalAlloc(LPTR,256);
    if (lpszOutput == NULL)
    {
        OutputDebugLastError(GetLastError(), "LocalAlloc: ");
        return FALSE;
    }

    // If this fails, it could be because the file was closed (and I/O is
    // finished) or because the overlapped I/O is still in progress.  In
    // either case (or any others) its a bug and return FALSE.
    if (fRetrieveEvent)
        if (!GetOverlappedResult(g_hCommFile,
                lpOverlappedCommEvent, &dwDummy, FALSE))
        {
            dwLastError = GetLastError();

            // Its possible for this error to occur if the
            // service provider has closed the port.  Time to end.
            if (dwLastError == ERROR_INVALID_HANDLE)
            {
                OutputDebugString("ERROR_INVALID_HANDLE, "
                    "Likely that the Service Provider has closed the port.\n");
                return FALSE;
            }

            OutputDebugLastError(dwLastError,
                "Unexpected GetOverlappedResult for WaitCommEvent: ");
            return FALSE;
        }

    // Was the event an error?
    if (*lpfdwEvtMask & EV_ERR)
    {
        // Which error was it?
        if (!ClearCommError(g_hCommFile, &dwErrors, NULL))
        {
            dwLastError = GetLastError();

            // Its possible for this error to occur if the
            // service provider has closed the port.  Time to end.
            if (dwLastError == ERROR_INVALID_HANDLE)
            {
                OutputDebugString("ERROR_INVALID_HANDLE, "
                    "Likely that the Service Provider has closed the port.\n");
                return FALSE;
            }

            OutputDebugLastError(GetLastError(),"ClearCommError: ");
            return FALSE;
        }

        // Its possible that multiple errors occured and were handled
        // in the last ClearCommError.  Because all errors were signaled
        // individually, but cleared all at once, pending comm events
        // can yield EV_ERR while dwErrors equals 0.  Ignore this event.
        if (dwErrors == 0)
        {
      dwRemainingLength = 127 - strlen(szError);
            strncat(szError, "NULL Error",dwRemainingLength);
      szError [127] = '\0';

        }

        if (dwErrors & CE_FRAME)
        {
      dwRemainingLength = 127 - strlen(szError);
            if (szError[0])
      {
                strncat(szError," and ",dwRemainingLength);
        szError [127] = '\0';
      }

      dwRemainingLength = 127 - strlen(szError);
            strncat(szError,"CE_FRAME",dwRemainingLength);
      szError [127] = '\0';

        }

        if (dwErrors & CE_OVERRUN)
        {
      dwRemainingLength = 127 - strlen(szError);
            if (szError[0])
      {
                strncat(szError," and ",dwRemainingLength);
        szError [127] = '\0';
      }
      dwRemainingLength = 127 - strlen(szError);
            strncat(szError,"CE_OVERRUN",dwRemainingLength);
      szError [127] = '\0';
        }

        if (dwErrors & CE_RXPARITY)
        {
            dwRemainingLength = 127 - strlen(szError);
      if (szError[0])
      {
                strncat(szError," and ",dwRemainingLength);
        szError [127] = '\0';
      }
      dwRemainingLength = 127 - strlen(szError);
            strncat(szError,"CE_RXPARITY",dwRemainingLength);
      szError [127] = '\0';
        }

        if (dwErrors & ~ (CE_FRAME | CE_OVERRUN | CE_RXPARITY))
        {
            dwRemainingLength = 127 - strlen(szError);
      if (szError[0])
      {
                strncat(szError," and ",dwRemainingLength);
        szError [127] = '\0';
      }
      dwRemainingLength = 127 - strlen(szError);
            strncat(szError,"EV_ERR Unknown EvtMask",dwRemainingLength);
      szError [127] = '\0';
        }

        nOutput = wsprintf(lpszOutput,
            "Comm Event: '%s', EvtMask = '%lx'\n",
            szError, dwErrors);

        PostWriteToDisplayCtl(lpszOutput, nOutput);
        return TRUE;

    }

    // Should not have gotten here.  Only interested in ERR conditions.

    OutputDebugPrintf("Unexpected comm event %lx",*lpfdwEvtMask);
    return FALSE;
}

BOOL HandleReadData | ( | LPCSTR | lpszInputBuffer,
 |  | DWORD | dwSizeofBuffer
 | ) |  |

Definition at line 1098 of file CommCode.c.

{
    // If we got data and didn't just time out empty...
    if (dwSizeofBuffer)
    {
        LPSTR lpszPostedBytes;

        // Do something with the bytes read.
        OutputDebugString("Got something from Comm port!!!\n");

        lpszPostedBytes = LocalAlloc(LPTR,dwSizeofBuffer+1);
        if (lpszPostedBytes == NULL)
        {
            OutputDebugLastError(GetLastError(), "LocalAlloc: ");
            return FALSE;
        }

        memcpy(lpszPostedBytes, lpszInputBuffer, dwSizeofBuffer);
        lpszPostedBytes[dwSizeofBuffer] = '\0';

        return PostWriteToDisplayCtl(lpszPostedBytes, dwSizeofBuffer);
    }
  return FALSE;

}

BOOL HandleReadEvent | ( | LPOVERLAPPED | lpOverlappedRead,
 |  | LPSTR | lpszInputBuffer,
 |  | DWORD | dwSizeofBuffer,
 |  | LPDWORD | lpnNumberOfBytesRead
 | ) |  |

Definition at line 1039 of file CommCode.c.

{
    DWORD dwLastError;

    if (GetOverlappedResult(g_hCommFile,
            lpOverlappedRead, lpnNumberOfBytesRead, FALSE))
    {
        return HandleReadData(lpszInputBuffer, *lpnNumberOfBytesRead);
    }

    // Error in GetOverlappedResult; handle it.

    dwLastError = GetLastError();

    // Its possible for this error to occur if the
    // service provider has closed the port.  Time to end.
    if (dwLastError == ERROR_INVALID_HANDLE)
    {
        OutputDebugString("ERROR_INVALID_HANDLE, "
            "Likely that the Service Provider has closed the port.\n");
        return FALSE;
    }

    OutputDebugLastError(dwLastError,
        "Unexpected GetOverlappedResult Read Error: ");

    PostHangupCall();
    return FALSE;
}

BOOL HandleWriteData | ( | LPOVERLAPPED | lpOverlappedWrite,
 |  | LPCSTR | lpszStringToWrite,
 |  | DWORD | dwNumberOfBytesToWrite
 | ) |  |

Definition at line 614 of file CommCode.c.

{
    DWORD dwLastError;

    DWORD dwNumberOfBytesWritten = 0;
    DWORD dwWhereToStartWriting = 0; // Start at the beginning.

    DWORD dwHandleSignaled;
    HANDLE HandlesToWaitFor[2];

    HandlesToWaitFor[0] = g_hCloseEvent;
    HandlesToWaitFor[1] = lpOverlappedWrite -> hEvent;

    // Keep looping until all characters have been written.
    do
    {
        // Start the overlapped I/O.
        if (!WriteFile(g_hCommFile,
                &lpszStringToWrite[ dwWhereToStartWriting ],
                dwNumberOfBytesToWrite, &dwNumberOfBytesWritten,
                lpOverlappedWrite))
        {
            // WriteFile failed.  Expected; lets handle it.
            dwLastError = GetLastError();

            // Its possible for this error to occur if the
            // service provider has closed the port.  Time to end.
            if (dwLastError == ERROR_INVALID_HANDLE)
            {
                OutputDebugString("ERROR_INVALID_HANDLE, "
                    "Likely that the Service Provider has closed the port.\n");
                return FALSE;
            }

            // Unexpected error.  No idea what.
            if (dwLastError != ERROR_IO_PENDING)
            {
                OutputDebugLastError(dwLastError,
                    "Error to writing to CommFile");

                OutputDebugString("Closing TAPI\n");
                PostHangupCall();
                return FALSE;
            }

            // This is the expected ERROR_IO_PENDING case.

            // Wait for either overlapped I/O completion,
            // or for the CloseEvent to get signaled.
            dwHandleSignaled =
                WaitForMultipleObjects(2, HandlesToWaitFor,
                    FALSE, INFINITE);

            switch(dwHandleSignaled)
            {
                case WAIT_OBJECT_0:     // CloseEvent signaled!
                {
                    // Time to exit.
                    return FALSE;
                }

                case WAIT_OBJECT_0 + 1: // Wait finished.
                {
                    // Time to get the results of the WriteFile
                    break;
                }

                case WAIT_FAILED: // Wait failed.  Shouldn't happen.
                {
                    OutputDebugLastError(GetLastError(),
                        "Write WAIT_FAILED: ");
                    PostHangupCall();
                    return FALSE;
                }

                default: // This case should never occur.
                {
                    OutputDebugPrintf(
                        "Unexpected Wait return value '%lx'",
                        dwHandleSignaled);
                    PostHangupCall();
                    return FALSE;
                }
            }

            if (!GetOverlappedResult(g_hCommFile,
                     lpOverlappedWrite,
                     &dwNumberOfBytesWritten, TRUE))
            {
                dwLastError = GetLastError();

                // Its possible for this error to occur if the
                // service provider has closed the port.
                if (dwLastError == ERROR_INVALID_HANDLE)
                {
                    OutputDebugString("ERROR_INVALID_HANDLE, "
                        "Likely that the Service Provider has closed the port.\n");
                    return FALSE;
                }

                // No idea what could cause another error.
                OutputDebugLastError(dwLastError,
                    "Error writing to CommFile while waiting");
                OutputDebugString("Closing TAPI\n");
                PostHangupCall();
                return FALSE;
            }
        }

        // Some data was written.  Make sure it all got written.

        dwNumberOfBytesToWrite -= dwNumberOfBytesWritten;
        dwWhereToStartWriting += dwNumberOfBytesWritten;
    }
    while(dwNumberOfBytesToWrite > 0);  // Write the whole thing!

    // Wrote the whole string.
    return TRUE;
}

BOOL SetupCommEvent | ( | LPOVERLAPPED | lpOverlappedCommEvent,
 |  | LPDWORD | lpfdwEvtMask
 | ) |  |

Definition at line 1147 of file CommCode.c.

{
    DWORD dwLastError;

  StartSetupCommEvent:

    // Make sure the CloseEvent hasn't been signaled yet.
    // Check is needed because this function is potentially recursive.
    if (WAIT_TIMEOUT != WaitForSingleObject(g_hCloseEvent,0))
        return FALSE;

    // Start waiting for Comm Errors.
    if (WaitCommEvent(g_hCommFile, lpfdwEvtMask, lpOverlappedCommEvent))
    {
        // This could happen if there was an error waiting on the
        // comm port.  Lets try and handle it.

        OutputDebugString("Event (Error) waiting before WaitCommEvent.\n");

        if (!HandleCommEvent(NULL, lpfdwEvtMask, FALSE))
            return FALSE;

        // What could cause infinite recursion at this point?
        goto StartSetupCommEvent;
    }

    // We expect ERROR_IO_PENDING returned from WaitCommEvent
    // because we are waiting with an overlapped structure.

    dwLastError = GetLastError();

    // LastError was ERROR_IO_PENDING, as expected.
    if (dwLastError == ERROR_IO_PENDING)
    {
        OutputDebugString("Waiting for a CommEvent (Error) to occur.\n");
        return TRUE;
    }

    // Its possible for this error to occur if the
    // service provider has closed the port.  Time to end.
    if (dwLastError == ERROR_INVALID_HANDLE)
    {
        OutputDebugString("ERROR_INVALID_HANDLE, "
            "Likely that the Service Provider has closed the port.\n");
        return FALSE;
    }

    // Unexpected error. No idea what could cause this to happen.
    OutputDebugLastError(dwLastError, "Unexpected WaitCommEvent error: ");
    return FALSE;
}

BOOL SetupReadEvent | ( | LPOVERLAPPED | lpOverlappedRead,
 |  | LPSTR | lpszInputBuffer,
 |  | DWORD | dwSizeofBuffer,
 |  | LPDWORD | lpnNumberOfBytesRead
 | ) |  |

Definition at line 955 of file CommCode.c.

{
    DWORD dwLastError;

  StartSetupReadEvent:

    // Make sure the CloseEvent hasn't been signaled yet.
    // Check is needed because this function is potentially recursive.
    if (WAIT_TIMEOUT != WaitForSingleObject(g_hCloseEvent,0))
        return FALSE;

    // Start the overlapped ReadFile.
    if (ReadFile(g_hCommFile,
            lpszInputBuffer, dwSizeofBuffer,
            lpnNumberOfBytesRead, lpOverlappedRead))
    {
        // This would only happen if there was data waiting to be read.

        OutputDebugString("Data waiting for ReadFile.\n");

        // Handle the data.
        if (!HandleReadData(lpszInputBuffer, *lpnNumberOfBytesRead))
        {
            return FALSE;
        }

        // Start waiting for more data.
        goto StartSetupReadEvent;
    }

    // ReadFile failed.  Expected because of overlapped I/O.
    dwLastError = GetLastError();

    // LastError was ERROR_IO_PENDING, as expected.
    if (dwLastError == ERROR_IO_PENDING)
    {
        OutputDebugString("Waiting for data from comm connection.\n");
        return TRUE;
    }

    // Its possible for this error to occur if the
    // service provider has closed the port.  Time to end.
    if (dwLastError == ERROR_INVALID_HANDLE)
    {
        OutputDebugString("ERROR_INVALID_HANDLE, "
            "Likely that the Service Provider has closed the port.\n");
        return FALSE;
    }

    // Unexpected error. No idea what could cause this to happen.
    OutputDebugLastError(dwLastError,"Unexpected ReadFile error: ");

    PostHangupCall();
    return FALSE;
}

BOOL StartComm ( HANDLE hNewCommFile )

Definition at line 125 of file CommCode.c.

{
    // Is this a valid comm handle?
    if (GetFileType(hNewCommFile) != FILE_TYPE_CHAR)
    {
        OutputDebugString("File handle is not a comm handle.\n");
        return FALSE;
    }

    // Are we already doing comm?
    if (g_hCommFile != NULL)
    {
        OutputDebugString("Already have a comm file open\n");
        return FALSE;
    }

    // Its ok to continue.

    g_hCommFile = hNewCommFile;

    // Setting and querying the comm port configurations.

    { // Configure the comm settings.
        COMMTIMEOUTS commtimeouts;
        DCB dcb;
        COMMPROP commprop;
        DWORD fdwEvtMask;

        // These are here just so you can set a breakpoint
        // and see what the comm settings are.  Most Comm settings
        // are already set through TAPI.
        GetCommState(hNewCommFile, &dcb);
        GetCommProperties(hNewCommFile, &commprop);
        GetCommMask(g_hCommFile, &fdwEvtMask);
        GetCommTimeouts(g_hCommFile, &commtimeouts);

        // The CommTimeout numbers will very likely change if you are
        // coding to meet some kind of specification where
        // you need to reply within a certain amount of time after
        // recieving the last byte.  However,  If 1/4th of a second
        // goes by between recieving two characters, its a good
        // indication that the transmitting end has finished, even
        // assuming a 1200 baud modem.

        commtimeouts.ReadIntervalTimeout         = 250;
        commtimeouts.ReadTotalTimeoutMultiplier  = 0;
        commtimeouts.ReadTotalTimeoutConstant    = 0;
        commtimeouts.WriteTotalTimeoutMultiplier = 0;
        commtimeouts.WriteTotalTimeoutConstant   = 0;

        SetCommTimeouts(g_hCommFile, &commtimeouts);

        // fAbortOnError is the only DCB dependancy in TapiComm.
        // Can't guarentee that the SP will set this to what we expect.
        dcb.fAbortOnError = FALSE;
        SetCommState(hNewCommFile, &dcb);
    }

    // Create the event that will signal the threads to close.
    g_hCloseEvent = CreateEvent(NULL, TRUE, FALSE, NULL);

    if (g_hCloseEvent == NULL)
    {
        OutputDebugLastError(GetLastError(), "Unable to CreateEvent: ");
        g_hCommFile = NULL;
        return FALSE;
    }

    // Create the Read thread.
    g_hReadThread =
        CreateThread(NULL, 0, StartReadThreadProc, 0, 0, &g_dwReadThreadID);

    if (g_hReadThread == NULL)
    {
        OutputDebugLastError(GetLastError(),"Unable to create Read thread");

        g_dwReadThreadID = 0;
        g_hCommFile = 0;
        return FALSE;
    }

    // Comm threads should to have a higher base priority than the UI thread.
    // If they don't, then any temporary priority boost the UI thread gains
    // could cause the COMM threads to loose data.
    SetThreadPriority(g_hReadThread, THREAD_PRIORITY_HIGHEST);

    // Create the Write thread.
    g_hWriteThread =
        CreateThread(NULL, 0, StartWriteThreadProc, 0, 0, &g_dwWriteThreadID);

    if (g_hWriteThread == NULL)
    {
        OutputDebugLastError(GetLastError(),"Unable to create Write thread");

        CloseReadThread();
        g_dwWriteThreadID = 0;
        g_hCommFile = 0;
        return FALSE;
    }

    SetThreadPriority(g_hWriteThread, THREAD_PRIORITY_ABOVE_NORMAL);

    // Everything was created ok.  Ready to go!
    return TRUE;
}

DWORD WINAPI StartReadThreadProc ( LPVOID lpvParam )

Definition at line 771 of file CommCode.c.

{
    char szInputBuffer[INPUTBUFFERSIZE];
    DWORD nNumberOfBytesRead;

    HANDLE HandlesToWaitFor[3];
    DWORD dwHandleSignaled;

    DWORD fdwEvtMask;

    // Needed for overlapped I/O (ReadFile)
    OVERLAPPED overlappedRead  = {0, 0, 0, 0, NULL};

    // Needed for overlapped Comm Event handling.
    OVERLAPPED overlappedCommEvent = {0, 0, 0, 0, NULL};

    // Lets put an event in the Read overlapped structure.
    overlappedRead.hEvent = CreateEvent(NULL, TRUE, TRUE, NULL);
    if (overlappedRead.hEvent == NULL)
    {
        OutputDebugLastError(GetLastError(), "Unable to CreateEvent: ");
        PostHangupCall();
        goto EndReadThread;
    }

    // And an event for the CommEvent overlapped structure.
    overlappedCommEvent.hEvent = CreateEvent(NULL, TRUE, TRUE, NULL);
    if (overlappedCommEvent.hEvent == NULL)
    {
        OutputDebugLastError(GetLastError(), "Unable to CreateEvent: ");
        PostHangupCall();
        goto EndReadThread;
    }

    // We will be waiting on these objects.
    HandlesToWaitFor[0] = g_hCloseEvent;
    HandlesToWaitFor[1] = overlappedCommEvent.hEvent;
    HandlesToWaitFor[2] = overlappedRead.hEvent;

    // Setup CommEvent handling.

    // Set the comm mask so we receive error signals.
    if (!SetCommMask(g_hCommFile, EV_ERR))
    {
        OutputDebugLastError(GetLastError(),"Unable to SetCommMask: ");
        PostHangupCall();
        goto EndReadThread;
    }

    // Start waiting for CommEvents (Errors)
    if (!SetupCommEvent(&overlappedCommEvent, &fdwEvtMask))
    {
        PostHangupCall();
        goto EndReadThread;
    }

    // Start waiting for Read events.
    if (!SetupReadEvent(&overlappedRead,
                szInputBuffer, INPUTBUFFERSIZE,
                &nNumberOfBytesRead))
    {
        PostHangupCall();
        goto EndReadThread;
    }

    // Keep looping until we break out.
    while (TRUE)
    {
        // Wait until some event occurs (data to read; error; stopping).
        dwHandleSignaled =
            WaitForMultipleObjects(3, HandlesToWaitFor,
                FALSE, INFINITE);

        // Which event occured?
        switch(dwHandleSignaled)
        {
            case WAIT_OBJECT_0:     // Signal to end the thread.
            {
                // Time to exit.
                goto EndReadThread;
            }

            case WAIT_OBJECT_0 + 1: // CommEvent signaled.
            {
                // Handle the CommEvent.
                if (!HandleCommEvent(&overlappedCommEvent, &fdwEvtMask, TRUE))
                {
                    PostHangupCall();
                    goto EndReadThread;
                }

                // Start waiting for the next CommEvent.
                if (!SetupCommEvent(&overlappedCommEvent, &fdwEvtMask))
                {
                    PostHangupCall();
                    goto EndReadThread;
                }
                break;
            }

            case WAIT_OBJECT_0 + 2: // Read Event signaled.
            {
                // Get the new data!
                if (!HandleReadEvent(&overlappedRead,
                            szInputBuffer, INPUTBUFFERSIZE,
                            &nNumberOfBytesRead))
                {
                    PostHangupCall();
                    goto EndReadThread;
                }

                // Wait for more new data.
                if (!SetupReadEvent(&overlappedRead,
                            szInputBuffer, INPUTBUFFERSIZE,
                            &nNumberOfBytesRead))
                {
                    PostHangupCall();
                    goto EndReadThread;
                }
                break;
            }

            case WAIT_FAILED:       // Wait failed.  Shouldn't happen.
            {
                OutputDebugLastError(GetLastError(),"Read WAIT_FAILED: ");
                PostHangupCall();
                goto EndReadThread;
            }

            default:    // This case should never occur.
            {
                OutputDebugPrintf("Unexpected Wait return value '%lx'",
                    dwHandleSignaled);
                PostHangupCall();
                goto EndReadThread;
            }
        } // End of switch(dwHandleSignaled).

    } // End of while(TRUE) loop.

    // Time to clean up Read Thread.
  EndReadThread:

    OutputDebugString("Read thread shutting down\n");
    PurgeComm(g_hCommFile, PURGE_RXABORT | PURGE_RXCLEAR);
    CloseHandle(overlappedRead.hEvent);
    CloseHandle(overlappedCommEvent.hEvent);
    g_dwReadThreadID = 0;
    CloseHandle(g_hReadThread);
    g_hReadThread = 0;
    return 0;
}

DWORD WINAPI StartWriteThreadProc ( LPVOID lpvParam )

Definition at line 455 of file CommCode.c.

{
    MSG msg;
    DWORD dwHandleSignaled;

    // Needed for overlapped I/O.
    OVERLAPPED overlappedWrite = {0, 0, 0, 0, NULL};

    overlappedWrite.hEvent = CreateEvent(NULL, TRUE, TRUE, NULL);
    if (overlappedWrite.hEvent == NULL)
    {
        OutputDebugLastError(GetLastError(), "Unable to CreateEvent: ");
        PostHangupCall();
        goto EndWriteThread;
    }

    // This is the main loop.  Loop until we break out.
    while (TRUE)
    {
        if (!PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
        {
            // If there are no messages pending, wait for a message or
            // the CloseEvent.
            dwHandleSignaled =
                MsgWaitForMultipleObjects(1, &g_hCloseEvent, FALSE,
                    INFINITE, QS_ALLINPUT);

            switch(dwHandleSignaled)
            {
                case WAIT_OBJECT_0:     // CloseEvent signaled!
                {
                    // Time to exit.
                    goto EndWriteThread;
                }

                case WAIT_OBJECT_0 + 1: // New message was received.
                {
                    // Get the message that woke us up by looping again.
                    continue;
                }

                case WAIT_FAILED:       // Wait failed.  Shouldn't happen.
                {
                    OutputDebugLastError(GetLastError(),"Write WAIT_FAILED: ");
                    PostHangupCall();
                    goto EndWriteThread;
                }

                default:                // This case should never occur.
                {
                    OutputDebugPrintf("Unexpected Wait return value '%lx'",
                        dwHandleSignaled);
                    PostHangupCall();
                    goto EndWriteThread;
                }

            }
        }

        // Make sure the CloseEvent isn't signaled while retrieving messages.
        if (WAIT_TIMEOUT != WaitForSingleObject(g_hCloseEvent,0))
            goto EndWriteThread;

        // Process the message.

        // This could happen if a dialog is created on this thread.
        // This doesn't occur in this sample, but might if modified.
        if (msg.hwnd != NULL)
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);

            continue;
        }

        // Handle the message.
        switch(msg.message)
        {
            case PWM_COMMWRITE:  // New string to write to Comm port.
            {
                OutputDebugString("Writing to comm port\n");

                // Write the string to the comm port.  HandleWriteData
                // does not return until the whole string has been written,
                // an error occurs or until the CloseEvent is signaled.
                if (!HandleWriteData(&overlappedWrite,
                        (LPSTR) msg.lParam, (DWORD) msg.wParam))
                {
                    // If it failed, either we got a signal to end or there
                    // really was a failure.

                    LocalFree((HLOCAL) msg.lParam);
                    goto EndWriteThread;
                }

                // Data was sent in a LocalAlloc()d buffer.  Must free it.
                LocalFree((HLOCAL) msg.lParam);
                break;
            }

            // What other messages could the thread get?
            default:
            {
                char Output[256];

                wsprintf(Output,
                    "Unexpected message posted to Write thread: %ui\n",
                    msg.message );

                OutputDebugString(Output);
                break;
            }
        } // End of switch(message)

    } // End of main loop.

    // Thats the end.  Now clean up.
  EndWriteThread:

    OutputDebugString("Write thread shutting down\n");

    PurgeComm(g_hCommFile, PURGE_TXABORT | PURGE_TXCLEAR);

    CloseHandle(overlappedWrite.hEvent);

    g_dwWriteThreadID = 0;
    CloseHandle(g_hWriteThread);
    g_hWriteThread = 0;

    return 0;
}

void StopComm ( )

Definition at line 251 of file CommCode.c.

{
    // No need to continue if we're not communicating.
    if (g_hCommFile == NULL)
        return;

    OutputDebugString("Stopping the Comm\n");

    // Close the threads.
    CloseReadThread();
    CloseWriteThread();

    // Not needed anymore.
    CloseHandle(g_hCloseEvent);

    // Now close the comm port handle.
    CloseHandle(g_hCommFile);
    g_hCommFile = NULL;
}

BOOL WriteCommString | ( | LPCSTR | lpszStringToWrite,
 |  | DWORD | dwSizeofStringToWrite
 | ) |  |

Definition at line 300 of file CommCode.c.

{
    if (g_hWriteThread)
    {
        if (PostThreadMessage(g_dwWriteThreadID, PWM_COMMWRITE,
                (WPARAM) dwSizeofStringToWrite, (LPARAM) lpszStringToWrite))
        {
            return TRUE;
        }
        else
            OutputDebugString("Failed to Post to Write thread.\n");
    }
    else
        OutputDebugString("Write thread not created\n");

    return FALSE;
}

Variable Documentation

DWORD g_dwReadThreadID = 0

Definition at line 58 of file CommCode.c.

DWORD g_dwWriteThreadID = 0

Definition at line 59 of file CommCode.c.

HANDLE g_hCloseEvent = NULL

Definition at line 63 of file CommCode.c.

HANDLE g_hCommFile = NULL

Definition at line 56 of file CommCode.c.

HANDLE g_hReadThread = NULL

Definition at line 60 of file CommCode.c.

HANDLE g_hWriteThread = NULL

Definition at line 61 of file CommCode.c.

Generated on Wed Nov 13 2024 16:54:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi2/TapiComm/CommCode.h File Reference

  • NetDS
  • Tapi
  • Tapi2
  • TapiComm
Functions

CommCode.h File Reference

Go to the source code of this file.

Functions

BOOL | StartComm (HANDLE hNewCommFile)
void | StopComm ()
BOOL | WriteCommString (LPCSTR pszStringToWrite, DWORD nSizeofStringToWrite)

Function Documentation

BOOL StartComm ( HANDLE hNewCommFile )

Definition at line 125 of file CommCode.c.

{
    // Is this a valid comm handle?
    if (GetFileType(hNewCommFile) != FILE_TYPE_CHAR)
    {
        OutputDebugString("File handle is not a comm handle.\n");
        return FALSE;
    }

    // Are we already doing comm?
    if (g_hCommFile != NULL)
    {
        OutputDebugString("Already have a comm file open\n");
        return FALSE;
    }

    // Its ok to continue.

    g_hCommFile = hNewCommFile;

    // Setting and querying the comm port configurations.

    { // Configure the comm settings.
        COMMTIMEOUTS commtimeouts;
        DCB dcb;
        COMMPROP commprop;
        DWORD fdwEvtMask;

        // These are here just so you can set a breakpoint
        // and see what the comm settings are.  Most Comm settings
        // are already set through TAPI.
        GetCommState(hNewCommFile, &dcb);
        GetCommProperties(hNewCommFile, &commprop);
        GetCommMask(g_hCommFile, &fdwEvtMask);
        GetCommTimeouts(g_hCommFile, &commtimeouts);

        // The CommTimeout numbers will very likely change if you are
        // coding to meet some kind of specification where
        // you need to reply within a certain amount of time after
        // recieving the last byte.  However,  If 1/4th of a second
        // goes by between recieving two characters, its a good
        // indication that the transmitting end has finished, even
        // assuming a 1200 baud modem.

        commtimeouts.ReadIntervalTimeout         = 250;
        commtimeouts.ReadTotalTimeoutMultiplier  = 0;
        commtimeouts.ReadTotalTimeoutConstant    = 0;
        commtimeouts.WriteTotalTimeoutMultiplier = 0;
        commtimeouts.WriteTotalTimeoutConstant   = 0;

        SetCommTimeouts(g_hCommFile, &commtimeouts);

        // fAbortOnError is the only DCB dependancy in TapiComm.
        // Can't guarentee that the SP will set this to what we expect.
        dcb.fAbortOnError = FALSE;
        SetCommState(hNewCommFile, &dcb);
    }

    // Create the event that will signal the threads to close.
    g_hCloseEvent = CreateEvent(NULL, TRUE, FALSE, NULL);

    if (g_hCloseEvent == NULL)
    {
        OutputDebugLastError(GetLastError(), "Unable to CreateEvent: ");
        g_hCommFile = NULL;
        return FALSE;
    }

    // Create the Read thread.
    g_hReadThread =
        CreateThread(NULL, 0, StartReadThreadProc, 0, 0, &g_dwReadThreadID);

    if (g_hReadThread == NULL)
    {
        OutputDebugLastError(GetLastError(),"Unable to create Read thread");

        g_dwReadThreadID = 0;
        g_hCommFile = 0;
        return FALSE;
    }

    // Comm threads should to have a higher base priority than the UI thread.
    // If they don't, then any temporary priority boost the UI thread gains
    // could cause the COMM threads to loose data.
    SetThreadPriority(g_hReadThread, THREAD_PRIORITY_HIGHEST);

    // Create the Write thread.
    g_hWriteThread =
        CreateThread(NULL, 0, StartWriteThreadProc, 0, 0, &g_dwWriteThreadID);

    if (g_hWriteThread == NULL)
    {
        OutputDebugLastError(GetLastError(),"Unable to create Write thread");

        CloseReadThread();
        g_dwWriteThreadID = 0;
        g_hCommFile = 0;
        return FALSE;
    }

    SetThreadPriority(g_hWriteThread, THREAD_PRIORITY_ABOVE_NORMAL);

    // Everything was created ok.  Ready to go!
    return TRUE;
}

void StopComm ( )

Definition at line 251 of file CommCode.c.

{
    // No need to continue if we're not communicating.
    if (g_hCommFile == NULL)
        return;

    OutputDebugString("Stopping the Comm\n");

    // Close the threads.
    CloseReadThread();
    CloseWriteThread();

    // Not needed anymore.
    CloseHandle(g_hCloseEvent);

    // Now close the comm port handle.
    CloseHandle(g_hCommFile);
    g_hCommFile = NULL;
}

BOOL WriteCommString | ( | LPCSTR | pszStringToWrite,
 |  | DWORD | nSizeofStringToWrite
 | ) |  |

Definition at line 300 of file CommCode.c.

{
    if (g_hWriteThread)
    {
        if (PostThreadMessage(g_dwWriteThreadID, PWM_COMMWRITE,
                (WPARAM) dwSizeofStringToWrite, (LPARAM) lpszStringToWrite))
        {
            return TRUE;
        }
        else
            OutputDebugString("Failed to Post to Write thread.\n");
    }
    else
        OutputDebugString("Write thread not created\n");

    return FALSE;
}

Generated on Wed Nov 13 2024 16:54:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi2/TapiComm/DISPATCH.c File Reference

  • NetDS
  • Tapi
  • Tapi2
  • TapiComm
Functions

DISPATCH.c File Reference

#include <windows.h>
#include <windowsx.h>
#include "globals.h"

Go to the source code of this file.

Functions

LRESULT | DispCommand (LPCMDI lpcmdi, HWND hwnd, WPARAM wparam, LPARAM lparam)
LRESULT | DispDefault (EDWP, HWND, UINT, WPARAM, LPARAM)
LRESULT | DispMessage (LPMSDI lpmsdi, HWND hwnd, UINT uMessage, WPARAM wparam, LPARAM lparam)

Function Documentation

LRESULT DispCommand | ( | LPCMDI | lpcmdi,
 |  | HWND | hwnd,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 97 of file DISPATCH.c.

{
    LRESULT lRet = 0;
    WORD    wCommand = GET_WM_COMMAND_ID(wparam, lparam);
    int     icmd;

    CMD    *rgcmd = lpcmdi->rgcmd;
    int     ccmd  = lpcmdi->ccmd;

    // Message packing of wparam and lparam have changed for Win32,
    // so use the GET_WM_COMMAND macro to unpack the commnad

    for (icmd = 0; icmd < ccmd; icmd++)
    {
        if (rgcmd[icmd].wCommand == wCommand)
        {
            return rgcmd[icmd].pfncmd(hwnd,
                                      wCommand,
                                      GET_WM_COMMAND_CMD(wparam, lparam),
                                      GET_WM_COMMAND_HWND(wparam, lparam));
        }
    }

    return DispDefault(lpcmdi->edwp, hwnd, WM_COMMAND, wparam, lparam);
}

LRESULT DispDefault | ( | EDWP | edwp,
 |  | HWND | hwnd,
 |  | UINT | uMessage,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 148 of file DISPATCH.c.

{
    switch (edwp)
    {
        case edwpNone:
            return 0;
        case edwpWindow:
            return DefWindowProc(hwnd, uMessage, wparam, lparam);
        case edwpDialog:
            return DefDlgProc(hwnd, uMessage, wparam, lparam);
        case edwpMDIFrame:
            return DefFrameProc(hwnd, hwndMDIClient, uMessage, wparam, lparam);
        case edwpMDIChild:
            return DefMDIChildProc(hwnd, uMessage, wparam, lparam);
    }
    return 0;
}

LRESULT DispMessage | ( | LPMSDI | lpmsdi,
 |  | HWND | hwnd,
 |  | UINT | uMessage,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 51 of file DISPATCH.c.

{
    int  imsd = 0;

    MSD *rgmsd = lpmsdi->rgmsd;
    int  cmsd  = lpmsdi->cmsd;

    for (imsd = 0; imsd < cmsd; imsd++)
    {
        if (rgmsd[imsd].uMessage == uMessage)
            return rgmsd[imsd].pfnmsg(hwnd, uMessage, wparam, lparam);
    }

    return DispDefault(lpmsdi->edwp, hwnd, uMessage, wparam, lparam);
}

Generated on Wed Nov 13 2024 16:54:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi2/TapiComm/EDITCTLS.c File Reference

  • NetDS
  • Tapi
  • Tapi2
  • TapiComm
Defines | Functions | Variables

EDITCTLS.c File Reference

#include <windows.h>
#include <string.h>
#include "globals.h"
#include "EditCtls.h"
#include "CommCode.h"
#include "toolbar.h"
#include "statbar.h"

Go to the source code of this file.

Defines

#define | MAXDISPLAYSIZE 0xF000
#define | MAXINPUTSIZE 0x400
#define | PWM_WRITESTRING WM_USER + 741

Functions

BOOL | InitEditCtls (HWND hWndMain)
BOOL | PostWriteToDisplayCtl (LPSTR lpNewString, DWORD dwSizeofNewString)
void | SetFocusEditCtls ()
void | SizeEditCtls ()
LRESULT CALLBACK | SubclassInputEditProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
void | WriteToDisplayCtl (LPSTR lpNewString, DWORD dwSizeofNewString)

Variables

HWND | hWndDisplayCtl
HWND | hWndInputCtl
HWND | hWndParent
WNDPROC | lpfnInputEdit

Define Documentation

#define MAXDISPLAYSIZE 0xF000

Definition at line 46 of file EDITCTLS.c.

#define MAXINPUTSIZE 0x400

Definition at line 47 of file EDITCTLS.c.

#define PWM_WRITESTRING WM_USER + 741

Definition at line 49 of file EDITCTLS.c.

Function Documentation

BOOL InitEditCtls ( HWND hWndMain )

Definition at line 80 of file EDITCTLS.c.

{
    hWndParent = hWndMain;

    if (!hWndMain)
    {
        OutputDebugString("Invalid parent hWnd for EditCtls!\n");
        return FALSE;
    }

    hWndDisplayCtl = CreateWindowEx(
        WS_EX_CLIENTEDGE,
        "EDIT","",
        WS_CHILD | WS_HSCROLL | WS_VSCROLL | ES_MULTILINE
        | ES_OEMCONVERT | WS_VISIBLE | WS_BORDER,
        0, 0, 0, 0, hWndParent,
        NULL, hInst, NULL);

    hWndInputCtl = CreateWindowEx(
        WS_EX_CLIENTEDGE,
        "EDIT","",
        WS_CHILD | ES_AUTOHSCROLL | WS_VISIBLE | WS_BORDER,
        0, 0, 0, 0, hWndParent,
        NULL, hInst, NULL);

    if (!hWndDisplayCtl || !hWndInputCtl)
    {
        OutputDebugString("Unable to create EditCtls.\n");
        return FALSE;
    }

    SendMessage(hWndInputCtl, EM_LIMITTEXT, MAXINPUTSIZE, 0);
    SendMessage(hWndDisplayCtl, EM_LIMITTEXT, MAXDISPLAYSIZE, 0);

        // This is where we subclass the input edit control
        // so we can catch the 'enter' keystroke
    lpfnInputEdit = (WNDPROC)
        SetWindowLongPtr(hWndInputCtl, GWLP_WNDPROC, (LONG_PTR)SubclassInputEditProc);

    return TRUE;
}

BOOL PostWriteToDisplayCtl | ( | LPSTR | lpNewString,
 |  | DWORD | dwSizeofNewString
 | ) |  |

Definition at line 380 of file EDITCTLS.c.

{
    return PostMessage(hWndInputCtl, PWM_WRITESTRING,
        (WPARAM)dwSizeofNewString, (LPARAM) lpNewString);
}

void SetFocusEditCtls ( )

Definition at line 216 of file EDITCTLS.c.

{
    DefWindowProc(hWndParent, WM_SETFOCUS, (WPARAM) NULL, (LPARAM) NULL);

    if (GetFocus() == hWndParent)
        SetFocus(hWndInputCtl);

    return;
}

void SizeEditCtls ( )

Definition at line 142 of file EDITCTLS.c.

{
    RECT rectParent, rectTemp;
    LONG HeightToolbar, HeightStatusbar;
    LONG HeightDisplayCtl, HeightInputCtl;
    LONG WidthCtls;
    LONG yposTopInputCtl, yposTopDisplayCtl;
    HDC hdc;
    TEXTMETRIC tm;

    // Get the client area of the parent.
    if (!GetClientRect(hWndParent, &rectParent))
    {
        OutputDebugString("GetClientRect on EditCtls parent failed\n");
        return;
    }

    // leave a pixel on each side
    WidthCtls = rectParent.right - 2;

    // Allow for the toolbar at the top.
    GetWindowRect(hWndToolbar, &rectTemp);
    HeightToolbar = rectTemp.bottom - rectTemp.top;

    // Allow for the statusbar at the bottom.
    GetWindowRect(hWndStatusbar, &rectTemp);
    HeightStatusbar = rectTemp.bottom - rectTemp.top;

    // How high should the input control be?
    hdc = GetDC(hWndInputCtl);
    GetTextMetrics(hdc, &tm);
    ReleaseDC(hWndInputCtl, hdc);
    HeightInputCtl = tm.tmHeight + tm.tmExternalLeading + 6;
        // 6 == 3 extra pixels between text and edit control vertical borders.

    // Position Input control.
    yposTopInputCtl = rectParent.bottom - HeightStatusbar - HeightInputCtl - 1;

    // Position Display control.
    yposTopDisplayCtl = rectParent.top + HeightToolbar + 2;
    HeightDisplayCtl = yposTopInputCtl - yposTopDisplayCtl - 1;

    // Move them both.
    MoveWindow(
        hWndInputCtl,
        1, yposTopInputCtl,
        WidthCtls, HeightInputCtl,
        TRUE);

    MoveWindow(
        hWndDisplayCtl,
        1, yposTopDisplayCtl,
        WidthCtls, HeightDisplayCtl,
        TRUE);
}

LRESULT CALLBACK SubclassInputEditProc | ( | HWND | hWnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 252 of file EDITCTLS.c.

{
    switch(message)
    {
        case WM_CHAR:

            // Found a RETURN keystroke!
            if ((TCHAR) wParam == VK_RETURN)
            {

                LPSTR pszString;
                long lSizeofString;

                // Get the size of the string to send.
                lSizeofString =
                    (LONG)SendMessage(hWndInputCtl, WM_GETTEXTLENGTH, 0, 0);

                // Allocate enough space for the string and "\r\0"
                if (!(pszString = (LPSTR) LocalAlloc(LPTR, lSizeofString +2)))
                  break;

                // Get the string
                SendMessage(hWndInputCtl, WM_GETTEXT,
                    lSizeofString + 1, (LPARAM) pszString);

                // Terminate it.
                strncat(pszString, "\r",lSizeofString+1);
        pszString[lSizeofString+1] = '\0';
                lSizeofString += 1;

                // If the write to Comm failed, its probably because
                // a connection isn't made yet.
                if (WriteCommString(pszString, lSizeofString))
                {
                    // This is what we'd do to local echo user input
                    // Unnecessary usually.
                    //WriteToOutputEdit(pszString, lSizeofString);
                    ;
                }
                else
                {
                    WriteToDisplayCtl("Not yet connected\r", 20);

                    // The comm code refused the string, so we must free it.
                    LocalFree(pszString);
                }

                // Clear the Input control.
                SendMessage(hWndInputCtl, WM_SETTEXT, 0, (LPARAM) "");

                // Don't let default processing handle the RETURN key.
                return 0;
            }

            break;

        case PWM_WRITESTRING:
            WriteToDisplayCtl((LPSTR) lParam, (DWORD) wParam);
            LocalFree((LPSTR) lParam);
            break;

        default:
            break;
    }
    return CallWindowProc(lpfnInputEdit, hWnd, message, wParam, lParam);
}

void WriteToDisplayCtl | ( | LPSTR | lpNewString,
 |  | DWORD | dwSizeofNewString
 | ) |  |

Definition at line 336 of file EDITCTLS.c.

{
    DWORD dwSizeofEdit;

    dwSizeofEdit = (DWORD)SendMessage(hWndDisplayCtl, WM_GETTEXTLENGTH, 0, 0);

    if ((dwSizeofEdit + dwSizeofNewString) > MAXDISPLAYSIZE)
    {
        // Suggestion for future additions:
        // Handle edit control overflow by deleting from top of edit control
    }

    // Actually place the string into the Display control.
    SendMessage(hWndDisplayCtl, EM_SETSEL, dwSizeofEdit, dwSizeofEdit);
    SendMessage(hWndDisplayCtl, EM_REPLACESEL, 0, (LPARAM) lpNewString);
    SendMessage(hWndDisplayCtl, EM_SETSEL,
        dwSizeofEdit+dwSizeofNewString, dwSizeofEdit+dwSizeofNewString);
}

Variable Documentation

HWND hWndDisplayCtl

Definition at line 52 of file EDITCTLS.c.

HWND hWndInputCtl

Definition at line 51 of file EDITCTLS.c.

HWND hWndParent

Definition at line 53 of file EDITCTLS.c.

WNDPROC lpfnInputEdit

Definition at line 55 of file EDITCTLS.c.

Generated on Wed Nov 13 2024 16:54:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi2/TapiComm/EDITCTLS.h File Reference

  • NetDS
  • Tapi
  • Tapi2
  • TapiComm
Functions

EDITCTLS.h File Reference

Go to the source code of this file.

Functions

BOOL | InitEditCtls (HWND hWndParent)
BOOL | PostWriteToDisplayCtl (LPSTR lpNewString, DWORD dwSizeofNewString)
void | SetFocusEditCtls ()
void | SizeEditCtls ()
void | WriteToDisplayCtl (LPSTR lpNewString, DWORD dwSizeofNewString)

Function Documentation

BOOL InitEditCtls ( HWND hWndParent )

Definition at line 80 of file EDITCTLS.c.

{
    hWndParent = hWndMain;

    if (!hWndMain)
    {
        OutputDebugString("Invalid parent hWnd for EditCtls!\n");
        return FALSE;
    }

    hWndDisplayCtl = CreateWindowEx(
        WS_EX_CLIENTEDGE,
        "EDIT","",
        WS_CHILD | WS_HSCROLL | WS_VSCROLL | ES_MULTILINE
        | ES_OEMCONVERT | WS_VISIBLE | WS_BORDER,
        0, 0, 0, 0, hWndParent,
        NULL, hInst, NULL);

    hWndInputCtl = CreateWindowEx(
        WS_EX_CLIENTEDGE,
        "EDIT","",
        WS_CHILD | ES_AUTOHSCROLL | WS_VISIBLE | WS_BORDER,
        0, 0, 0, 0, hWndParent,
        NULL, hInst, NULL);

    if (!hWndDisplayCtl || !hWndInputCtl)
    {
        OutputDebugString("Unable to create EditCtls.\n");
        return FALSE;
    }

    SendMessage(hWndInputCtl, EM_LIMITTEXT, MAXINPUTSIZE, 0);
    SendMessage(hWndDisplayCtl, EM_LIMITTEXT, MAXDISPLAYSIZE, 0);

        // This is where we subclass the input edit control
        // so we can catch the 'enter' keystroke
    lpfnInputEdit = (WNDPROC)
        SetWindowLongPtr(hWndInputCtl, GWLP_WNDPROC, (LONG_PTR)SubclassInputEditProc);

    return TRUE;
}

BOOL PostWriteToDisplayCtl | ( | LPSTR | lpNewString,
 |  | DWORD | dwSizeofNewString
 | ) |  |

Definition at line 380 of file EDITCTLS.c.

{
    return PostMessage(hWndInputCtl, PWM_WRITESTRING,
        (WPARAM)dwSizeofNewString, (LPARAM) lpNewString);
}

void SetFocusEditCtls ( )

Definition at line 216 of file EDITCTLS.c.

{
    DefWindowProc(hWndParent, WM_SETFOCUS, (WPARAM) NULL, (LPARAM) NULL);

    if (GetFocus() == hWndParent)
        SetFocus(hWndInputCtl);

    return;
}

void SizeEditCtls ( )

Definition at line 142 of file EDITCTLS.c.

{
    RECT rectParent, rectTemp;
    LONG HeightToolbar, HeightStatusbar;
    LONG HeightDisplayCtl, HeightInputCtl;
    LONG WidthCtls;
    LONG yposTopInputCtl, yposTopDisplayCtl;
    HDC hdc;
    TEXTMETRIC tm;

    // Get the client area of the parent.
    if (!GetClientRect(hWndParent, &rectParent))
    {
        OutputDebugString("GetClientRect on EditCtls parent failed\n");
        return;
    }

    // leave a pixel on each side
    WidthCtls = rectParent.right - 2;

    // Allow for the toolbar at the top.
    GetWindowRect(hWndToolbar, &rectTemp);
    HeightToolbar = rectTemp.bottom - rectTemp.top;

    // Allow for the statusbar at the bottom.
    GetWindowRect(hWndStatusbar, &rectTemp);
    HeightStatusbar = rectTemp.bottom - rectTemp.top;

    // How high should the input control be?
    hdc = GetDC(hWndInputCtl);
    GetTextMetrics(hdc, &tm);
    ReleaseDC(hWndInputCtl, hdc);
    HeightInputCtl = tm.tmHeight + tm.tmExternalLeading + 6;
        // 6 == 3 extra pixels between text and edit control vertical borders.

    // Position Input control.
    yposTopInputCtl = rectParent.bottom - HeightStatusbar - HeightInputCtl - 1;

    // Position Display control.
    yposTopDisplayCtl = rectParent.top + HeightToolbar + 2;
    HeightDisplayCtl = yposTopInputCtl - yposTopDisplayCtl - 1;

    // Move them both.
    MoveWindow(
        hWndInputCtl,
        1, yposTopInputCtl,
        WidthCtls, HeightInputCtl,
        TRUE);

    MoveWindow(
        hWndDisplayCtl,
        1, yposTopDisplayCtl,
        WidthCtls, HeightDisplayCtl,
        TRUE);
}

void WriteToDisplayCtl | ( | LPSTR | lpNewString,
 |  | DWORD | dwSizeofNewString
 | ) |  |

Definition at line 336 of file EDITCTLS.c.

{
    DWORD dwSizeofEdit;

    dwSizeofEdit = (DWORD)SendMessage(hWndDisplayCtl, WM_GETTEXTLENGTH, 0, 0);

    if ((dwSizeofEdit + dwSizeofNewString) > MAXDISPLAYSIZE)
    {
        // Suggestion for future additions:
        // Handle edit control overflow by deleting from top of edit control
    }

    // Actually place the string into the Display control.
    SendMessage(hWndDisplayCtl, EM_SETSEL, dwSizeofEdit, dwSizeofEdit);
    SendMessage(hWndDisplayCtl, EM_REPLACESEL, 0, (LPARAM) lpNewString);
    SendMessage(hWndDisplayCtl, EM_SETSEL,
        dwSizeofEdit+dwSizeofNewString, dwSizeofEdit+dwSizeofNewString);
}

Generated on Wed Nov 13 2024 16:54:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi2/TapiComm/GLOBALS.h File Reference

  • NetDS
  • Tapi
  • Tapi2
  • TapiComm
Classes | Defines | Typedefs | Enumerations | Functions | Variables

GLOBALS.h File Reference

Go to the source code of this file.

Classes

struct | _CMD
struct | _CMDI
struct | _MSD
struct | _MSDI

Defines

#define | APPNAME TAPICOMM
#define | hwndMDIClient NULL
#define | ICONFILE TAPICOMM.ICO
#define | IDD_VERFIRST 100
#define | IDD_VERLAST 104
#define | IDM_ABOUT 3001
#define | IDM_EDITCLEAR 2005
#define | IDM_EDITCOPY 2003
#define | IDM_EDITCUT 2002
#define | IDM_EDITPASTE 2004
#define | IDM_EDITUNDO 2001
#define | IDM_EXIT 1009
#define | IDM_FILECLOSE 1005
#define | IDM_FILENEW 1001
#define | IDM_FILEOPEN 1002
#define | IDM_FILEPAGESU 1007
#define | IDM_FILEPRINT 1006
#define | IDM_FILEPRINTSU 1008
#define | IDM_FILESAVE 1003
#define | IDM_FILESAVEAS 1004
#define | IDM_HANGUPCALL 1011
#define | IDM_MAKECALL 1010
#define | IDS_APPNAME 1
#define | IDS_DESCRIPTION 2
#define | IDS_EDITMENU 2000
#define | IDS_FILEMENU 1000
#define | IDS_HELPMENU 3000
#define | SZABOUT "About TAPICOMM"
#define | SZAPPNAME "TAPICOMM"
#define | SZDESCRIPTION "TAPI/COMM Sample"
#define | SZRAPPNAME "InternalName"
#define | SZRCOMPANYNAME "CompanyName"
#define | SZRCOPYRIGHT "LegalCopyright"
#define | SZRDESCRIPTION "FileDescription"
#define | SZRPRODNAME "ProductName"
#define | SZRPRODVER "ProuctVersion"
#define | SZRTRADEMARK "LegalTrademarks"
#define | SZRVERSION "FileVersion"
#define | SZVERSION "4.0"

Typedefs

typedef struct _CMD | CMD
typedef struct _CMDI | CMDI
typedef struct _CMDI * | LPCMDI
typedef struct _MSDI * | LPMSDI
typedef struct _MSD | MSD
typedef struct _MSDI | MSDI
typedef LRESULT(* | PFNCMD )(HWND, WORD, WORD, HWND)
typedef LRESULT(* | PFNMSG )(HWND, UINT, WPARAM, LPARAM)

Enumerations

enum EDWP {
edwpNone, edwpWindow, edwpDialog, edwpMDIChild,
edwpMDIFrame, edwpNone, edwpWindow, edwpDialog,
edwpMDIChild, edwpMDIFrame
}

Functions

BOOL | CenterWindow (HWND, HWND)
LRESULT | CmdAbout (HWND, WORD, WORD, HWND)
LRESULT | CmdExit (HWND, WORD, WORD, HWND)
LRESULT | CmdHangupCall (HWND, WORD, WORD, HWND)
LRESULT | CmdMakeCall (HWND, WORD, WORD, HWND)
LRESULT | CmdStub (HWND, WORD, WORD, HWND)
LRESULT | DispCommand (LPCMDI, HWND, WPARAM, LPARAM)
LRESULT | DispMessage (LPMSDI, HWND, UINT, WPARAM, LPARAM)
BOOL | InitApplication (HINSTANCE, int)
LRESULT | MsgClose (HWND, UINT, WPARAM, LPARAM)
LRESULT | MsgCommand (HWND, UINT, WPARAM, LPARAM)
LRESULT | MsgCreate (HWND, UINT, WPARAM, LPARAM)
LRESULT | MsgDestroy (HWND, UINT, WPARAM, LPARAM)
LRESULT | MsgMenuSelect (HWND, UINT, WPARAM, LPARAM)
LRESULT | MsgMousemove (HWND, UINT, WPARAM, LPARAM)
LRESULT | MsgNotify (HWND, UINT, WPARAM, LPARAM)
LRESULT | MsgPaint (HWND, UINT, WPARAM, LPARAM)
LRESULT | MsgSetFocus (HWND, UINT, WPARAM, LPARAM)
LRESULT | MsgSize (HWND, UINT, WPARAM, LPARAM)
LRESULT | MsgTimer (HWND, UINT, WPARAM, LPARAM)
LRESULT CALLBACK | WndProc (HWND, UINT, WPARAM, LPARAM)

Variables

CMDI cmdiMain
HINSTANCE | hInst
MSDI msdiMain
char | szAppName []
char | szTitle []

Define Documentation

#define APPNAME TAPICOMM

Definition at line 18 of file GLOBALS.h.

#define hwndMDIClient NULL

Definition at line 143 of file GLOBALS.h.

#define ICONFILE TAPICOMM.ICO

Definition at line 19 of file GLOBALS.h.

#define IDD_VERFIRST 100

Definition at line 127 of file GLOBALS.h.

#define IDD_VERLAST 104

Definition at line 128 of file GLOBALS.h.

#define IDM_ABOUT 3001

Definition at line 116 of file GLOBALS.h.

#define IDM_EDITCLEAR 2005

Definition at line 112 of file GLOBALS.h.

#define IDM_EDITCOPY 2003

Definition at line 110 of file GLOBALS.h.

#define IDM_EDITCUT 2002

Definition at line 109 of file GLOBALS.h.

#define IDM_EDITPASTE 2004

Definition at line 111 of file GLOBALS.h.

#define IDM_EDITUNDO 2001

Definition at line 108 of file GLOBALS.h.

#define IDM_EXIT 1009

Definition at line 102 of file GLOBALS.h.

#define IDM_FILECLOSE 1005

Definition at line 98 of file GLOBALS.h.

#define IDM_FILENEW 1001

Definition at line 94 of file GLOBALS.h.

#define IDM_FILEOPEN 1002

Definition at line 95 of file GLOBALS.h.

#define IDM_FILEPAGESU 1007

Definition at line 100 of file GLOBALS.h.

#define IDM_FILEPRINT 1006

Definition at line 99 of file GLOBALS.h.

#define IDM_FILEPRINTSU 1008

Definition at line 101 of file GLOBALS.h.

#define IDM_FILESAVE 1003

Definition at line 96 of file GLOBALS.h.

#define IDM_FILESAVEAS 1004

Definition at line 97 of file GLOBALS.h.

#define IDM_HANGUPCALL 1011

Definition at line 104 of file GLOBALS.h.

#define IDM_MAKECALL 1010

Definition at line 103 of file GLOBALS.h.

#define IDS_APPNAME 1

Definition at line 121 of file GLOBALS.h.

#define IDS_DESCRIPTION 2

Definition at line 122 of file GLOBALS.h.

#define IDS_EDITMENU 2000

Definition at line 107 of file GLOBALS.h.

#define IDS_FILEMENU 1000

Definition at line 93 of file GLOBALS.h.

#define IDS_HELPMENU 3000

Definition at line 115 of file GLOBALS.h.

#define SZABOUT "About TAPICOMM"

Definition at line 22 of file GLOBALS.h.

#define SZAPPNAME "TAPICOMM"

Definition at line 20 of file GLOBALS.h.

#define SZDESCRIPTION "TAPI/COMM Sample"

Definition at line 21 of file GLOBALS.h.

#define SZRAPPNAME "InternalName"

Definition at line 220 of file GLOBALS.h.

#define SZRCOMPANYNAME "CompanyName"

Definition at line 217 of file GLOBALS.h.

#define SZRCOPYRIGHT "LegalCopyright"

Definition at line 221 of file GLOBALS.h.

#define SZRDESCRIPTION "FileDescription"

Definition at line 218 of file GLOBALS.h.

#define SZRPRODNAME "ProductName"

Definition at line 223 of file GLOBALS.h.

#define SZRPRODVER "ProuctVersion"

Definition at line 224 of file GLOBALS.h.

#define SZRTRADEMARK "LegalTrademarks"

Definition at line 222 of file GLOBALS.h.

#define SZRVERSION "FileVersion"

Definition at line 219 of file GLOBALS.h.

#define SZVERSION "4.0"

Definition at line 23 of file GLOBALS.h.

Typedef Documentation

typedef struct _CMD CMD
typedef struct _CMDI CMDI
typedef struct _CMDI* LPCMDI
typedef struct _MSDI* LPMSDI
typedef struct _MSD MSD
typedef struct _MSDI MSDI
typedef LRESULT(* PFNCMD)(HWND, WORD, WORD, HWND)

Definition at line 156 of file GLOBALS.h.

typedef LRESULT(* PFNMSG)(HWND, UINT, WPARAM, LPARAM)

Definition at line 153 of file GLOBALS.h.

Enumeration Type Documentation

enum EDWP
Enumerator:
edwpNone
edwpWindow
edwpDialog
edwpMDIChild
edwpMDIFrame
edwpNone
edwpWindow
edwpDialog
edwpMDIChild
edwpMDIFrame

Definition at line 161 of file GLOBALS.h.

{
   edwpNone,            // Do not call any default procedure.
   edwpWindow,          // Call DefWindowProc.
   edwpDialog,          // Call DefDlgProc (This should be used only for
                        // custom dialogs - standard dialog use edwpNone).
   edwpMDIChild,        // Call DefMDIChildProc.
   edwpMDIFrame         // Call DefFrameProc.
} EDWP;                // Enumeration for Default Window Procedures

Function Documentation

BOOL CenterWindow | ( | HWND | ,
 |  | HWND |
 | ) |  |

Definition at line 676 of file Generic.C.

{
   RECT    rChild, rParent, rWorkArea;
   int     wChild, hChild, wParent, hParent;
   int     xNew, yNew;
   BOOL  bResult;

   // Get the Height and Width of the child window
   GetWindowRect (hwndChild, &rChild);
   wChild = rChild.right - rChild.left;
   hChild = rChild.bottom - rChild.top;

   // Get the Height and Width of the parent window
   GetWindowRect (hwndParent, &rParent);
   wParent = rParent.right - rParent.left;
   hParent = rParent.bottom - rParent.top;

   // Get the limits of the 'workarea'
   bResult = SystemParametersInfo(
      SPI_GETWORKAREA,  // system parameter to query or set
      sizeof(RECT),
      &rWorkArea,
      0);
   if (!bResult) {
      rWorkArea.left = rWorkArea.top = 0;
      rWorkArea.right = GetSystemMetrics(SM_CXSCREEN);
      rWorkArea.bottom = GetSystemMetrics(SM_CYSCREEN);
   }

   // Calculate new X position, then adjust for workarea
   xNew = rParent.left + ((wParent - wChild) /2);
   if (xNew < rWorkArea.left) {
      xNew = rWorkArea.left;
   } else if ((xNew+wChild) > rWorkArea.right) {
      xNew = rWorkArea.right - wChild;
   }

   // Calculate new Y position, then adjust for workarea
   yNew = rParent.top  + ((hParent - hChild) /2);
   if (yNew < rWorkArea.top) {
      yNew = rWorkArea.top;
   } else if ((yNew+hChild) > rWorkArea.bottom) {
      yNew = rWorkArea.bottom - hChild;
   }

   // Set it, and return
   return SetWindowPos (hwndChild, NULL, xNew, yNew, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
}

LRESULT CmdAbout | ( | HWND | ,
 |  | WORD | ,
 |  | WORD | ,
 |  | HWND |
 | ) |  |

Definition at line 85 of file ABOUT.c.

{
    DialogBox(hInst, "AboutBox", hwnd, (DLGPROC)About);
    return 0;
}

LRESULT CmdExit | ( | HWND | ,
 |  | WORD | ,
 |  | WORD | ,
 |  | HWND |
 | ) |  |

Definition at line 389 of file TapiComm.c.

{
    char szBuffer[50];
    int  cbWritten = 0;

    ShutdownTAPI();

    cbWritten = LoadString(hInst, wCommand, szBuffer, sizeof(szBuffer));
    if(cbWritten == 0)
        strncpy(szBuffer, "Unknown Command", 49);
  szBuffer[49] = '\0';

    UpdateStatusBar(szBuffer, 0, 0);

    DestroyWindow(hwnd);
    return 0;
}

LRESULT CmdHangupCall | ( | HWND | ,
 |  | WORD | ,
 |  | WORD | ,
 |  | HWND |
 | ) |  |

Definition at line 429 of file TapiComm.c.

{
    HangupCall();
    return 0;
}

LRESULT CmdMakeCall | ( | HWND | ,
 |  | WORD | ,
 |  | WORD | ,
 |  | HWND |
 | ) |  |

Definition at line 457 of file TapiComm.c.

{
    DialCall();
    return 0;
}

LRESULT CmdStub | ( | HWND | ,
 |  | WORD | ,
 |  | WORD | ,
 |  | HWND |
 | ) |  |

Definition at line 121 of file Misc.c.

{
    char szBuffer[50];
    int  cbWritten = 0;

    cbWritten = LoadString(hInst, wCommand, szBuffer, sizeof(szBuffer));
    if(cbWritten == 0)
    {
        strncpy(szBuffer, "Unknown Command", 49);
    szBuffer[49] = '\0';
        UpdateStatusBar(szBuffer, 0, 0);
    }
    else
    {
        UpdateStatusBar(szBuffer, 0, 0);
        MessageBox (hwnd,
                    "Command Not Implemented:\r\n Demonstration Purposes Only",
                    "TAPICOMM",
                    MB_OK | MB_ICONEXCLAMATION);
    }
     /*
      * Once the command is executed, set the statusbar text to
      * original text.
      */
    UpdateStatusBar(SZDESCRIPTION, 0, 0);

    return 0;
}

LRESULT DispCommand | ( | LPCMDI | ,
 |  | HWND | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 97 of file DISPATCH.c.

{
    LRESULT lRet = 0;
    WORD    wCommand = GET_WM_COMMAND_ID(wparam, lparam);
    int     icmd;

    CMD    *rgcmd = lpcmdi->rgcmd;
    int     ccmd  = lpcmdi->ccmd;

    // Message packing of wparam and lparam have changed for Win32,
    // so use the GET_WM_COMMAND macro to unpack the commnad

    for (icmd = 0; icmd < ccmd; icmd++)
    {
        if (rgcmd[icmd].wCommand == wCommand)
        {
            return rgcmd[icmd].pfncmd(hwnd,
                                      wCommand,
                                      GET_WM_COMMAND_CMD(wparam, lparam),
                                      GET_WM_COMMAND_HWND(wparam, lparam));
        }
    }

    return DispDefault(lpcmdi->edwp, hwnd, WM_COMMAND, wparam, lparam);
}

LRESULT DispMessage | ( | LPMSDI | ,
 |  | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 51 of file DISPATCH.c.

{
    int  imsd = 0;

    MSD *rgmsd = lpmsdi->rgmsd;
    int  cmsd  = lpmsdi->cmsd;

    for (imsd = 0; imsd < cmsd; imsd++)
    {
        if (rgmsd[imsd].uMessage == uMessage)
            return rgmsd[imsd].pfnmsg(hwnd, uMessage, wparam, lparam);
    }

    return DispDefault(lpmsdi->edwp, hwnd, uMessage, wparam, lparam);
}

BOOL InitApplication | ( | HINSTANCE | ,
 |  | int |
 | ) |  |

Definition at line 54 of file INIT.c.

{
    WNDCLASS  wc;
    HWND      hwnd; // Main window handle.

    // Load the application name and description strings.

    LoadString(hInstance, IDS_APPNAME, szAppName, sizeof(szAppName));
    LoadString(hInstance, IDS_DESCRIPTION, szTitle, sizeof(szTitle));

    // Save the instance handle in static variable, which will be used in
    // many subsequence calls from this application to Windows.

    hInst = hInstance; // Store instance handle in our global variable

    // Fill in window class structure with parameters that describe the
    // main window.

    wc.style         = CS_HREDRAW | CS_VREDRAW; // Class style(s).
    wc.lpfnWndProc   = (WNDPROC)WndProc;        // Window Procedure
    wc.cbClsExtra    = 0;                       // No per-class extra data.
    wc.cbWndExtra    = 0;                       // No per-window extra data.
    wc.hInstance     = hInstance;               // Owner of this class
    wc.hIcon         = LoadIcon (hInstance, szAppName); // Icon name from .RC
    wc.hCursor       = LoadCursor(NULL, IDC_ARROW); // Cursor
    wc.hbrBackground = CreateSolidBrush(GetSysColor(COLOR_3DFACE));
    wc.lpszMenuName  = szAppName;               // Menu name from .RC
    wc.lpszClassName = szAppName;               // Name to register as

    // Register the window class and return FALSE if unsuccesful.

    if (!RegisterClass(&wc))
    {
        return FALSE;
    }

    // Create a main window for this application instance.
    hwnd = CreateWindow(szAppName,           // See RegisterClass() call
                        szTitle,             // Text for window title bar
                        WS_OVERLAPPEDWINDOW, // Window style
                        CW_USEDEFAULT, 0,    // Use default positioning
                        CW_USEDEFAULT, 0,    // Use default size
                        NULL,                // Overlapped has no parent
                        NULL,                // Use the window class menu
                        hInstance,           // This instance owns this window
                        NULL                 // Don't need data in WM_CREATE
    );

    // If window could not be created, return "failure"
    if (!hwnd)
        return FALSE;

    // Make the window visible; update its client area; and return "success"
    ShowWindow(hwnd, nCmdShow);  // Show the window
    UpdateWindow(hwnd);          // Sends WM_PAINT message

    return TRUE;                 // We succeeded...
}

LRESULT MsgClose | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 325 of file TapiComm.c.

{
    ShutdownTAPI();

    DestroyWindow(hwnd);
    return 0;
}

LRESULT MsgCommand | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 156 of file TapiComm.c.

{
    return DispCommand(&cmdiMain, hwnd, wparam, lparam);
}

LRESULT MsgCreate | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 184 of file TapiComm.c.

{
    InitCommonControls() ; // Initialize the common control library.

    if (InitEditCtls(hwnd) == FALSE)
        return -1;

    InitializeTAPI(hwnd);

    if(!(CreateTBar(hwnd) && CreateSBar(hwnd)))
        return -1;   // Tool and status bars were not created, so return -1.

    UpdateStatusBar("Ready to make a call.",1,0);

    EnableMakeCall(hwnd, TRUE);
    EnableHangupCall(hwnd, FALSE);
    return 0;
}

LRESULT MsgDestroy | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 296 of file TapiComm.c.

{
    PostQuitMessage(0);
    return 0;
}

LRESULT MsgMenuSelect | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 84 of file STATBAR.c.

{
    static char szBuffer[128];
    UINT   nStringID = 0;
    UINT   fuFlags = GET_WM_MENUSELECT_FLAGS(wparam, lparam) & 0xffff;
    UINT   uCmd    = GET_WM_MENUSELECT_CMD(wparam, lparam);
    HMENU  hMenu   = GET_WM_MENUSELECT_HMENU(wparam, lparam);

    szBuffer[0] = 0;                            // First reset the buffer

    if (fuFlags == 0xffff && hMenu == NULL)     // Menu has been closed
        nStringID = IDS_DESCRIPTION;

    else if (fuFlags & MFT_SEPARATOR)           // Ignore separators
        nStringID = 0;

    else if (fuFlags & MF_POPUP)                // Popup menu
    {
#ifdef MENUHACK                 // This code shouldn't be necessary...
        UINT i;
        for (i = 0; i < sizeof(idPopup)/sizeof(idPopup[0]); i++)
        {
            if(GetSubMenu(hMenu, i) == (HMENU)((UINT_PTR)uCmd))
            {
                uCmd = i;
                break;
            }
        }
#endif
        if (fuFlags & MF_SYSMENU)               // System menu
            nStringID = IDS_SYSMENU;

        else
            // Get string ID for popup menu from idPopup array.
            nStringID = ((uCmd < sizeof(idPopup)/sizeof(idPopup[0])) ?
                            idPopup[uCmd] : 0);
    }  // for MF_POPUP

    else                                        // Must be a command item
        nStringID = uCmd;                       // String ID == Command ID

    // Load the string if we have an ID
    if (0 != nStringID)
        LoadString(hInst, nStringID, szBuffer, sizeof(szBuffer));

    // Finally... send the string to the status bar
    UpdateStatusBar(szBuffer, 0, 0);

    return 0;
}

LRESULT MsgMousemove | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |
LRESULT MsgNotify | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 116 of file ToolBar.c.

{
    LPTOOLTIPTEXT lpToolTipText;
    static char   szBuffer[64];

    lpToolTipText = (LPTOOLTIPTEXT)lparam;
    if (lpToolTipText->hdr.code == TTN_NEEDTEXT)
    {
        LoadString(hInst,
                   (UINT)(lpToolTipText->hdr.idFrom),   // string ID == command ID
                   szBuffer,
                   sizeof(szBuffer));

        lpToolTipText->lpszText = szBuffer;
    }
    return 0;
}

LRESULT MsgPaint | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 357 of file TapiComm.c.

{
    HDC hdc;
    PAINTSTRUCT ps;

    hdc = BeginPaint(hwnd, &ps);

    EndPaint(hwnd, &ps);
    return 0;
}

LRESULT MsgSetFocus | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 268 of file TapiComm.c.

{
    SetFocusEditCtls();

    return 0 ;
}

LRESULT MsgSize | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 231 of file TapiComm.c.

{
    SendMessage(hWndStatusbar,  uMessage, wparam, lparam);
    SendMessage(hWndToolbar, uMessage, wparam, lparam);

    // Re-position the panes in the status bar
    InitializeStatusBar(hwnd);

    SizeEditCtls();

    return 0 ;
}

LRESULT MsgTimer | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |
LRESULT CALLBACK WndProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 290 of file Generic.C.

{
   int wmId, wmEvent;
   PAINTSTRUCT ps;
   HDC hdc;
      POINT pnt;
   HMENU hMenu;
      BOOL bGotHelp;

   switch (message) {

      case WM_COMMAND:
         wmId    = LOWORD(wParam); // Remember, these are...
         wmEvent = HIWORD(wParam); // ...different for Win32!

         //Parse the menu selections:
         switch (wmId) {

            case IDM_ABOUT:
               DialogBox(hInst, "AboutBox", hWnd, (DLGPROC)About);
               break;

            case IDM_EXIT:
               DestroyWindow (hWnd);
               break;

            case IDM_HELPTOPICS: // Only called in Windows 95
               bGotHelp = WinHelp (hWnd, APPNAME".HLP", HELP_FINDER,(DWORD)0);
               if (!bGotHelp)
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            case IDM_HELPCONTENTS: // Not called in Windows 95
               bGotHelp = WinHelp (hWnd, APPNAME".HLP", HELP_CONTENTS,(DWORD)0);
               if (!bGotHelp)
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            case IDM_HELPSEARCH: // Not called in Windows 95
               if (!WinHelp(hWnd, APPNAME".HLP", HELP_PARTIALKEY,
                           (ULONG_PTR)(LPSTR)""))
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            case IDM_HELPHELP: // Not called in Windows 95
               if(!WinHelp(hWnd, (LPSTR)NULL, HELP_HELPONHELP, 0))
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            // Here are all the other possible menu options,
            // all of these are currently disabled:
            case IDM_NEW:
            case IDM_OPEN:
            case IDM_SAVE:
            case IDM_SAVEAS:
            case IDM_UNDO:
            case IDM_CUT:
            case IDM_COPY:
            case IDM_PASTE:
            case IDM_LINK:
            case IDM_LINKS:

            default:
               return (DefWindowProc(hWnd, message, wParam, lParam));
         }
         break;

      case WM_NCRBUTTONUP: // RightClick on windows non-client area...
         if (IS_WIN95 && SendMessage(hWnd, WM_NCHITTEST, 0, lParam) == HTSYSMENU)
         {
            // The user has clicked the right button on the applications
            // 'System Menu'. Here is where you would alter the default
            // system menu to reflect your application. Notice how the
            // explorer deals with this. For this app, we aren't doing
            // anything
            return (DefWindowProc(hWnd, message, wParam, lParam));
         } else {
            // Nothing we are interested in, allow default handling...
            return (DefWindowProc(hWnd, message, wParam, lParam));
         }
            break;

        case WM_RBUTTONDOWN: // RightClick in windows client area...
            pnt.x = LOWORD(lParam);
            pnt.y = HIWORD(lParam);
            ClientToScreen(hWnd, (LPPOINT) &pnt);
      // This is where you would determine the appropriate 'context'
      // menu to bring up. Since this app has no real functionality,
      // we will just bring up the 'Help' menu:
            hMenu = GetSubMenu (GetMenu (hWnd), 2);
            if (hMenu) {
                TrackPopupMenu (hMenu, 0, pnt.x, pnt.y, 0, hWnd, NULL);
            } else {
            // Couldn't find the menu...
                MessageBeep(0);
            }
            break;

      case WM_DISPLAYCHANGE: // Only comes through on plug'n'play systems
      {
         SIZE  szScreen;
         DWORD dwBitsPerPixel = (DWORD)wParam;

         szScreen.cx = LOWORD(lParam);
         szScreen.cy = HIWORD(lParam);

         MessageBox (GetFocus(), GetStringRes(IDS_DISPLAYCHANGED),
                     szAppName, 0);
      }
      break;

      case WM_PAINT:
         hdc = BeginPaint (hWnd, &ps);
         // Add any drawing code here...
         EndPaint (hWnd, &ps);
         break;

      case WM_DESTROY:
         // Tell WinHelp we don't need it any more...
               WinHelp (hWnd, APPNAME".HLP", HELP_QUIT,(DWORD)0);
         PostQuitMessage(0);
         break;

      default:
         return (DefWindowProc(hWnd, message, wParam, lParam));
   }
   return (0);
}

Variable Documentation

CMDI cmdiMain

Definition at line 95 of file TapiComm.c.

HINSTANCE hInst

Definition at line 37 of file Demo.c.

MSDI msdiMain

Definition at line 71 of file TapiComm.c.

char szAppName[]

Definition at line 56 of file Generic.C.

char szTitle[]

Definition at line 57 of file Generic.C.

Generated on Wed Nov 13 2024 16:54:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi2/TapiComm/INIT.c File Reference

  • NetDS
  • Tapi
  • Tapi2
  • TapiComm
Functions | Variables

INIT.c File Reference

#include <windows.h>
#include "globals.h"

Go to the source code of this file.

Functions

BOOL | InitApplication (HINSTANCE hInstance, int nCmdShow)

Variables

HINSTANCE | hInst
char | szAppName [9]
char | szTitle [40]

Function Documentation

BOOL InitApplication | ( | HINSTANCE | hInstance,
 |  | int | nCmdShow
 | ) |  |

Definition at line 54 of file INIT.c.

{
    WNDCLASS  wc;
    HWND      hwnd; // Main window handle.

    // Load the application name and description strings.

    LoadString(hInstance, IDS_APPNAME, szAppName, sizeof(szAppName));
    LoadString(hInstance, IDS_DESCRIPTION, szTitle, sizeof(szTitle));

    // Save the instance handle in static variable, which will be used in
    // many subsequence calls from this application to Windows.

    hInst = hInstance; // Store instance handle in our global variable

    // Fill in window class structure with parameters that describe the
    // main window.

    wc.style         = CS_HREDRAW | CS_VREDRAW; // Class style(s).
    wc.lpfnWndProc   = (WNDPROC)WndProc;        // Window Procedure
    wc.cbClsExtra    = 0;                       // No per-class extra data.
    wc.cbWndExtra    = 0;                       // No per-window extra data.
    wc.hInstance     = hInstance;               // Owner of this class
    wc.hIcon         = LoadIcon (hInstance, szAppName); // Icon name from .RC
    wc.hCursor       = LoadCursor(NULL, IDC_ARROW); // Cursor
    wc.hbrBackground = CreateSolidBrush(GetSysColor(COLOR_3DFACE));
    wc.lpszMenuName  = szAppName;               // Menu name from .RC
    wc.lpszClassName = szAppName;               // Name to register as

    // Register the window class and return FALSE if unsuccesful.

    if (!RegisterClass(&wc))
    {
        return FALSE;
    }

    // Create a main window for this application instance.
    hwnd = CreateWindow(szAppName,           // See RegisterClass() call
                        szTitle,             // Text for window title bar
                        WS_OVERLAPPEDWINDOW, // Window style
                        CW_USEDEFAULT, 0,    // Use default positioning
                        CW_USEDEFAULT, 0,    // Use default size
                        NULL,                // Overlapped has no parent
                        NULL,                // Use the window class menu
                        hInstance,           // This instance owns this window
                        NULL                 // Don't need data in WM_CREATE
    );

    // If window could not be created, return "failure"
    if (!hwnd)
        return FALSE;

    // Make the window visible; update its client area; and return "success"
    ShowWindow(hwnd, nCmdShow);  // Show the window
    UpdateWindow(hwnd);          // Sends WM_PAINT message

    return TRUE;                 // We succeeded...
}

Variable Documentation

HINSTANCE hInst

Definition at line 21 of file INIT.c.

char szAppName[9]

Definition at line 23 of file INIT.c.

char szTitle[40]

Definition at line 24 of file INIT.c.

Generated on Wed Nov 13 2024 16:53:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi2/TapiComm/Misc.c File Reference

  • NetDS
  • Tapi
  • Tapi2
  • TapiComm
Functions

Misc.c File Reference

#include <windows.h>
#include <windowsx.h>
#include "globals.h"
#include "statbar.h"

Go to the source code of this file.

Functions

BOOL | CenterWindow (HWND hwndChild, HWND hwndParent)
LRESULT | CmdStub (HWND hwnd, WORD wCommand, WORD wNotify, HWND hwndCtrl)

Function Documentation

BOOL CenterWindow | ( | HWND | hwndChild,
 |  | HWND | hwndParent
 | ) |  |

Definition at line 47 of file Misc.c.

{
    RECT    rcChild, rcParent;
    int     cxChild, cyChild, cxParent, cyParent;
    int     cxScreen, cyScreen, xNew, yNew;
    HDC     hdc;

    // Get the Height and Width of the child window
    GetWindowRect(hwndChild, &rcChild);
    cxChild = rcChild.right - rcChild.left;
    cyChild = rcChild.bottom - rcChild.top;

    // Get the Height and Width of the parent window
    GetWindowRect(hwndParent, &rcParent);
    cxParent = rcParent.right - rcParent.left;
    cyParent = rcParent.bottom - rcParent.top;

    // Get the display limits
    hdc = GetDC(hwndChild);
    cxScreen = GetDeviceCaps(hdc, HORZRES);
    cyScreen = GetDeviceCaps(hdc, VERTRES);
    ReleaseDC(hwndChild, hdc);

    // Calculate new X position, then adjust for screen
    xNew = rcParent.left + ((cxParent - cxChild) / 2);
    if (xNew < 0)
    {
        xNew = 0;
    }
    else if ((xNew + cxChild) > cxScreen)
    {
        xNew = cxScreen - cxChild;
    }

    // Calculate new Y position, then adjust for screen
    yNew = rcParent.top  + ((cyParent - cyChild) / 2);
    if (yNew < 0)
    {
        yNew = 0;
    }
    else if ((yNew + cyChild) > cyScreen)
    {
        yNew = cyScreen - cyChild;
    }

    // Set it, and return
    return SetWindowPos(hwndChild,
                        NULL,
                        xNew, yNew,
                        0, 0,
                        SWP_NOSIZE | SWP_NOZORDER);
}

LRESULT CmdStub | ( | HWND | hwnd,
 |  | WORD | wCommand,
 |  | WORD | wNotify,
 |  | HWND | hwndCtrl
 | ) |  |

Definition at line 121 of file Misc.c.

{
    char szBuffer[50];
    int  cbWritten = 0;

    cbWritten = LoadString(hInst, wCommand, szBuffer, sizeof(szBuffer));
    if(cbWritten == 0)
    {
        strncpy(szBuffer, "Unknown Command", 49);
    szBuffer[49] = '\0';
        UpdateStatusBar(szBuffer, 0, 0);
    }
    else
    {
        UpdateStatusBar(szBuffer, 0, 0);
        MessageBox (hwnd,
                    "Command Not Implemented:\r\n Demonstration Purposes Only",
                    "TAPICOMM",
                    MB_OK | MB_ICONEXCLAMATION);
    }
     /*
      * Once the command is executed, set the statusbar text to
      * original text.
      */
    UpdateStatusBar(SZDESCRIPTION, 0, 0);

    return 0;
}

Generated on Wed Nov 13 2024 16:54:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi2/TapiComm/Resource.h File Reference

  • NetDS
  • Tapi
  • Tapi2
  • TapiComm
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_AREACODE 1006
#define | IDC_CALLINGCARD 1007
#define | IDC_CANONICALNUMBER 1010
#define | IDC_CONFIGURATIONCHANGED 1201
#define | IDC_CONFIGURELINE 1002
#define | IDC_COUNTRYCODE 1000
#define | IDC_DIAL 1005
#define | IDC_DIALABLENUMBER 1012
#define | IDC_DIALINGPROPERTIES 1003
#define | IDC_DISPLAYABLENUMBER 1011
#define | IDC_LINECREATE 1202
#define | IDC_LINEICON 1022
#define | IDC_LOCATION 1009
#define | IDC_NOHELPCONTROLS 1101
#define | IDC_PHONENUMBER 1004
#define | IDC_STATIC -1
#define | IDC_STATICAREACODE 1014
#define | IDC_STATICCALLINGCARD 1017
#define | IDC_STATICCANONICAL 1019
#define | IDC_STATICCONNECTUSING 1104
#define | IDC_STATICCOUNTRYCODE 1013
#define | IDC_STATICDIALABLE 1020
#define | IDC_STATICDISPLAYABLE 1021
#define | IDC_STATICHOWTODIAL 1103
#define | IDC_STATICLOCATION 1016
#define | IDC_STATICPHONENUMBER 1015
#define | IDC_STATICPHONENUMBERS 1105
#define | IDC_STATICTAPILINE 1018
#define | IDC_STATICWHERETODIAL 1102
#define | IDC_TAPILINE 1001
#define | IDC_USEDIALINGRULES 1008

Define Documentation

#define IDC_AREACODE 1006

Definition at line 11 of file Resource.h.

#define IDC_CALLINGCARD 1007

Definition at line 12 of file Resource.h.

#define IDC_CANONICALNUMBER 1010

Definition at line 15 of file Resource.h.

#define IDC_CONFIGURATIONCHANGED 1201

Definition at line 35 of file Resource.h.

#define IDC_CONFIGURELINE 1002

Definition at line 7 of file Resource.h.

#define IDC_COUNTRYCODE 1000

Definition at line 5 of file Resource.h.

#define IDC_DIAL 1005

Definition at line 10 of file Resource.h.

#define IDC_DIALABLENUMBER 1012

Definition at line 17 of file Resource.h.

#define IDC_DIALINGPROPERTIES 1003

Definition at line 8 of file Resource.h.

#define IDC_DISPLAYABLENUMBER 1011

Definition at line 16 of file Resource.h.

#define IDC_LINECREATE 1202

Definition at line 36 of file Resource.h.

#define IDC_LINEICON 1022

Definition at line 27 of file Resource.h.

#define IDC_LOCATION 1009

Definition at line 14 of file Resource.h.

#define IDC_NOHELPCONTROLS 1101

Definition at line 29 of file Resource.h.

#define IDC_PHONENUMBER 1004

Definition at line 9 of file Resource.h.

#define IDC_STATIC -1

Definition at line 38 of file Resource.h.

#define IDC_STATICAREACODE 1014

Definition at line 19 of file Resource.h.

#define IDC_STATICCALLINGCARD 1017

Definition at line 22 of file Resource.h.

#define IDC_STATICCANONICAL 1019

Definition at line 24 of file Resource.h.

#define IDC_STATICCONNECTUSING 1104

Definition at line 32 of file Resource.h.

#define IDC_STATICCOUNTRYCODE 1013

Definition at line 18 of file Resource.h.

#define IDC_STATICDIALABLE 1020

Definition at line 25 of file Resource.h.

#define IDC_STATICDISPLAYABLE 1021

Definition at line 26 of file Resource.h.

#define IDC_STATICHOWTODIAL 1103

Definition at line 31 of file Resource.h.

#define IDC_STATICLOCATION 1016

Definition at line 21 of file Resource.h.

#define IDC_STATICPHONENUMBER 1015

Definition at line 20 of file Resource.h.

#define IDC_STATICPHONENUMBERS 1105

Definition at line 33 of file Resource.h.

#define IDC_STATICTAPILINE 1018

Definition at line 23 of file Resource.h.

#define IDC_STATICWHERETODIAL 1102

Definition at line 30 of file Resource.h.

#define IDC_TAPILINE 1001

Definition at line 6 of file Resource.h.

#define IDC_USEDIALINGRULES 1008

Definition at line 13 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi2/TapiComm/STATBAR.c File Reference

  • NetDS
  • Tapi
  • Tapi2
  • TapiComm
Defines | Functions | Variables

STATBAR.c File Reference

#include <windows.h>
#include <windowsx.h>
#include <commctrl.h>
#include "globals.h"
#include "statbar.h"

Go to the source code of this file.

Defines

#define | MENUHACK 1

Functions

BOOL | CreateSBar (HWND hwndParent)
void | InitializeStatusBar (HWND hwndParent)
LRESULT | MsgMenuSelect (HWND hwnd, UINT uMessage, WPARAM wparam, LPARAM lparam)
void | UpdateStatusBar (LPSTR lpszStatusString, WORD partNumber, WORD displayFlags)

Variables

HWND | hWndStatusbar
UINT idPopup []

Define Documentation

#define MENUHACK 1

Definition at line 82 of file STATBAR.c.

Function Documentation

BOOL CreateSBar ( HWND hwndParent )

Definition at line 210 of file STATBAR.c.

{
    hWndStatusbar = CreateStatusWindow(WS_CHILD | WS_VISIBLE | WS_BORDER,
                                       SZDESCRIPTION,
                                       hwndParent,
                                       IDM_STATUSBAR);
    if(hWndStatusbar)
    {
        InitializeStatusBar(hwndParent);
        return TRUE;
    }

    return FALSE;
}

void InitializeStatusBar ( HWND hwndParent )

Definition at line 163 of file STATBAR.c.

{
    const cSpaceInBetween = 8;
    int   ptArray[2];   // Array defining the number of parts/sections
    SIZE  size = {0,0};         // the Status bar will display.
    RECT  rect;
    HDC   hDC;

   /*
    * Fill in the ptArray...
    */

    hDC = GetDC(hwndParent);
    GetClientRect(hwndParent, &rect);
    ReleaseDC(hwndParent, hDC);

    ptArray[0] = (rect.right) / 2;
    ptArray[1] = rect.right;

    SendMessage(hWndStatusbar,
                SB_SETPARTS,
                sizeof(ptArray)/sizeof(ptArray[0]),
                (LPARAM)(LPINT)ptArray);

    UpdateStatusBar(SZDESCRIPTION, 0, 0);
}

LRESULT MsgMenuSelect | ( | HWND | hwnd,
 |  | UINT | uMessage,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 84 of file STATBAR.c.

{
    static char szBuffer[128];
    UINT   nStringID = 0;
    UINT   fuFlags = GET_WM_MENUSELECT_FLAGS(wparam, lparam) & 0xffff;
    UINT   uCmd    = GET_WM_MENUSELECT_CMD(wparam, lparam);
    HMENU  hMenu   = GET_WM_MENUSELECT_HMENU(wparam, lparam);

    szBuffer[0] = 0;                            // First reset the buffer

    if (fuFlags == 0xffff && hMenu == NULL)     // Menu has been closed
        nStringID = IDS_DESCRIPTION;

    else if (fuFlags & MFT_SEPARATOR)           // Ignore separators
        nStringID = 0;

    else if (fuFlags & MF_POPUP)                // Popup menu
    {
#ifdef MENUHACK                 // This code shouldn't be necessary...
        UINT i;
        for (i = 0; i < sizeof(idPopup)/sizeof(idPopup[0]); i++)
        {
            if(GetSubMenu(hMenu, i) == (HMENU)((UINT_PTR)uCmd))
            {
                uCmd = i;
                break;
            }
        }
#endif
        if (fuFlags & MF_SYSMENU)               // System menu
            nStringID = IDS_SYSMENU;

        else
            // Get string ID for popup menu from idPopup array.
            nStringID = ((uCmd < sizeof(idPopup)/sizeof(idPopup[0])) ?
                            idPopup[uCmd] : 0);
    }  // for MF_POPUP

    else                                        // Must be a command item
        nStringID = uCmd;                       // String ID == Command ID

    // Load the string if we have an ID
    if (0 != nStringID)
        LoadString(hInst, nStringID, szBuffer, sizeof(szBuffer));

    // Finally... send the string to the status bar
    UpdateStatusBar(szBuffer, 0, 0);

    return 0;
}

void UpdateStatusBar | ( | LPSTR | lpszStatusString,
 |  | WORD | partNumber,
 |  | WORD | displayFlags
 | ) |  |

Definition at line 247 of file STATBAR.c.

{
    SendMessage(hWndStatusbar,
                SB_SETTEXT,
                partNumber | displayFlags,
                (LPARAM)lpszStatusString);
}

Variable Documentation

HWND hWndStatusbar

Definition at line 33 of file STATBAR.c.

UINT idPopup[]
Initial value:
{
    IDS_FILEMENU,
    IDS_EDITMENU,
    IDS_HELPMENU,
}

Definition at line 49 of file STATBAR.c.

Generated on Wed Nov 13 2024 16:54:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi2/TapiComm/STATBAR.h File Reference

  • NetDS
  • Tapi
  • Tapi2
  • TapiComm
Defines | Functions | Variables

STATBAR.h File Reference

Go to the source code of this file.

Defines

#define | IDM_STATUSBAR 501
#define | IDM_TIMER 701
#define | IDS_SYSMENU 900
#define | TIMER_TIMEOUT 1000

Functions

BOOL | CreateSBar (HWND)
void | InitializeStatusBar (HWND)
void | UpdateStatusBar (LPSTR, WORD, WORD)

Variables

HWND | hWndStatusbar

Define Documentation

#define IDM_STATUSBAR 501

Definition at line 13 of file STATBAR.h.

#define IDM_TIMER 701

Definition at line 14 of file STATBAR.h.

#define IDS_SYSMENU 900

Definition at line 19 of file STATBAR.h.

#define TIMER_TIMEOUT 1000

Definition at line 15 of file STATBAR.h.

Function Documentation

BOOL CreateSBar ( HWND )

Definition at line 210 of file STATBAR.c.

{
    hWndStatusbar = CreateStatusWindow(WS_CHILD | WS_VISIBLE | WS_BORDER,
                                       SZDESCRIPTION,
                                       hwndParent,
                                       IDM_STATUSBAR);
    if(hWndStatusbar)
    {
        InitializeStatusBar(hwndParent);
        return TRUE;
    }

    return FALSE;
}

void InitializeStatusBar ( HWND )

Definition at line 163 of file STATBAR.c.

{
    const cSpaceInBetween = 8;
    int   ptArray[2];   // Array defining the number of parts/sections
    SIZE  size = {0,0};         // the Status bar will display.
    RECT  rect;
    HDC   hDC;

   /*
    * Fill in the ptArray...
    */

    hDC = GetDC(hwndParent);
    GetClientRect(hwndParent, &rect);
    ReleaseDC(hwndParent, hDC);

    ptArray[0] = (rect.right) / 2;
    ptArray[1] = rect.right;

    SendMessage(hWndStatusbar,
                SB_SETPARTS,
                sizeof(ptArray)/sizeof(ptArray[0]),
                (LPARAM)(LPINT)ptArray);

    UpdateStatusBar(SZDESCRIPTION, 0, 0);
}

void UpdateStatusBar | ( | LPSTR | ,
 |  | WORD | ,
 |  | WORD |
 | ) |  |

Definition at line 247 of file STATBAR.c.

{
    SendMessage(hWndStatusbar,
                SB_SETTEXT,
                partNumber | displayFlags,
                (LPARAM)lpszStatusString);
}

Variable Documentation

HWND hWndStatusbar

Definition at line 33 of file STATBAR.c.

Generated on Wed Nov 13 2024 16:54:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi2/TapiComm/TapiCode.c File Reference

  • NetDS
  • Tapi
  • Tapi2
  • TapiComm
Classes | Defines | Functions | Variables

TapiCode.c File Reference

#include <tapi.h>
#include <windows.h>
#include <string.h>
#include "globals.h"
#include "TapiInfo.h"
#include "TapiCode.h"
#include "CommCode.h"
#include "resource.h"
#include "statbar.h"
#include "toolbar.h"

Go to the source code of this file.

Classes

struct | NONDIALTOKENS

Defines

#define | g_sizeofNonDialable (sizeof(g_sNonDialable)/sizeof(g_sNonDialable[0]))
#define | I_LINECALLSTATE_ANY 0
#define | LINENOTUSEABLE_ALLOCATED 5
#define | LINENOTUSEABLE_ERROR 1
#define | LINENOTUSEABLE_INUSE 6
#define | LINENOTUSEABLE_NOCOMMDATAMODEM 7
#define | LINENOTUSEABLE_NODATAMODEM 3
#define | LINENOTUSEABLE_NOMAKECALL 4
#define | LINENOTUSEABLE_NOVOICE 2
#define | SAMPLE_TAPI_VERSION 0x00010004
#define | SUCCESS 0
#define | WAITERR_WAITABORTED 1
#define | WAITERR_WAITTIMEDOUT 2
#define | WAITTIMEOUT 30000

Functions

LPVOID | CheckAndReAllocBuffer (LPVOID lpBuffer, size_t sizeBufferMinimum, LPCSTR szApiPhrase)
LPLINECALLPARAMS | CreateCallParams (LPLINECALLPARAMS lpCallParams, LPCSTR lpszDisplayableAddress)
BOOL DialCall ()
BOOL | DialCallInParts (LPLINEDEVCAPS lpLineDevCaps, LPCSTR lpszAddress, LPCSTR lpszDisplayableAddress)
INT_PTR CALLBACK | DialDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
void | DisplayPhoneNumber (HWND hwndDlg)
void | DoLineCallState (DWORD dwDevice, DWORD dwMsg, DWORD dwCallbackInstance, DWORD dwParam1, DWORD dwParam2, DWORD dwParam3)
void | DoLineClose (DWORD dwDevice, DWORD dwMsg, DWORD dwCallbackInstance, DWORD dwParam1, DWORD dwParam2, DWORD dwParam3)
void | DoLineCreate (DWORD dwDevice, DWORD dwMessage, DWORD dwCallbackInstance, DWORD dwParam1, DWORD dwParam2, DWORD dwParam3)
void | DoLineDevState (DWORD dwDevice, DWORD dwsg, DWORD dwCallbackInstance, DWORD dwParam1, DWORD dwParam2, DWORD dwParam3)
void | DoLineReply (DWORD dwDevice, DWORD dwMsg, DWORD dwCallbackInstance, DWORD dwParam1, DWORD dwParam2, DWORD dwParam3)
void | FillCountryCodeList (HWND hwndDlg, DWORD dwDefaultCountryID)
void | FillLocationInfo (HWND hwndDlg, LPSTR lpszCurrentLocation, LPDWORD lpdwCountryID, LPSTR lpszAreaCode)
void | FillTAPILine (HWND hwndDlg)
BOOL GetAddressToDial ()
BOOL HandleIniFileCorrupt ()
BOOL | HandleLineErr (long lLineErr)
BOOL HandleNoDevicesInstalled ()
BOOL HandleNoDriver ()
BOOL HandleNoMem ()
BOOL HandleNoMultipleInstance ()
BOOL HandleOperationFailed ()
BOOL HandleReInit ()
BOOL HandleResourceUnavail ()
BOOL HangupCall ()
LPLINEADDRESSCAPS | I_lineGetAddressCaps (LPLINEADDRESSCAPS lpLineAddressCaps, DWORD dwDeviceID, DWORD dwAddressID, DWORD dwAPIVersion, DWORD dwExtVersion)
LPLINEADDRESSSTATUS | I_lineGetAddressStatus (LPLINEADDRESSSTATUS lpLineAddressStatus, HLINE hLine, DWORD dwAddressID)
LPLINECALLSTATUS | I_lineGetCallStatus (LPLINECALLSTATUS lpLineCallStatus, HCALL hCall)
LPLINEDEVCAPS | I_lineGetDevCaps (LPLINEDEVCAPS lpLineDevCaps, DWORD dwDeviceID, DWORD dwAPIVersion)
DWORD | I_lineNegotiateAPIVersion (DWORD dwDeviceID)
DWORD | I_lineNegotiateLegacyAPIVersion (DWORD dwDeviceID)
LPLINETRANSLATEOUTPUT | I_lineTranslateAddress (LPLINETRANSLATEOUTPUT lpLineTranslateOutput, DWORD dwDeviceID, DWORD dwAPIVersion, LPCSTR lpszDialAddress)
BOOL | InitializeTAPI (HWND hWndParent)
BOOL LaunchModemControlPanelAdd ()
void CALLBACK | lineCallbackFunc (DWORD hDevice, DWORD dwMsg, DWORD dwCallbackInstance, DWORD dwParam1, DWORD dwParam2, DWORD dwParam3)
void | PostHangupCall ()
void | PreConfigureDevice (HWND hwndDlg, DWORD dwDeviceID)
BOOL ShutdownTAPI ()
void | UseDialingRules (HWND hwndDlg)
BOOL | VerifyAndWarnUsableLine (HWND hwndDlg)
long | VerifyUsableLine (DWORD dwDeviceID)
long | WaitForCallState (DWORD dwNewCallState)
long | WaitForReply (long lRequestID)
void | WarningBox (LPCSTR lpszMessage)

Variables

DWORD g_adwSampleMenuHelpIDs []
BOOL g_bCallStateReceived
BOOL | g_bConnected = FALSE
BOOL | g_bInitializing = FALSE
BOOL g_bReplyRecieved
BOOL | g_bShuttingDown = FALSE
BOOL | g_bStoppingCall = FALSE
BOOL | g_bTapiInUse = FALSE
DWORD | g_dwAPIVersion = 0
DWORD | g_dwCallState = 0
DWORD | g_dwDeviceID = 0
DWORD | g_dwNumDevs = 0
DWORD g_dwRequestedID
DWORD g_dwSizeDeviceConfig
HCALL | g_hCall = (HCALL)((ULONG_PTR)NULL)
HWND | g_hDialog = NULL
HWND | g_hDlgParentWindow = NULL
HLINE | g_hLine = (HLINE)((ULONG_PTR)NULL)
HLINEAPP | g_hLineApp = (HLINEAPP)((ULONG_PTR)NULL)
HWND | g_hWndMainWindow = NULL
long | g_lAsyncReply
LPVOID | g_lpDeviceConfig = NULL
NONDIALTOKENS g_sNonDialable []
char | g_szDialableAddress [1024] = ""
char | g_szDisplayableAddress [1024] = ""

Define Documentation

#define g_sizeofNonDialable (sizeof(g_sNonDialable)/sizeof(g_sNonDialable[0]))

Definition at line 152 of file TapiCode.c.

#define I_LINECALLSTATE_ANY 0

Definition at line 104 of file TapiCode.c.

#define LINENOTUSEABLE_ALLOCATED 5

Definition at line 98 of file TapiCode.c.

#define LINENOTUSEABLE_ERROR 1

Definition at line 94 of file TapiCode.c.

#define LINENOTUSEABLE_INUSE 6

Definition at line 99 of file TapiCode.c.

#define LINENOTUSEABLE_NOCOMMDATAMODEM 7

Definition at line 100 of file TapiCode.c.

#define LINENOTUSEABLE_NODATAMODEM 3

Definition at line 96 of file TapiCode.c.

#define LINENOTUSEABLE_NOMAKECALL 4

Definition at line 97 of file TapiCode.c.

#define LINENOTUSEABLE_NOVOICE 2

Definition at line 95 of file TapiCode.c.

#define SAMPLE_TAPI_VERSION 0x00010004

Definition at line 110 of file TapiCode.c.

#define SUCCESS 0

Definition at line 87 of file TapiCode.c.

#define WAITERR_WAITABORTED 1

Definition at line 90 of file TapiCode.c.

#define WAITERR_WAITTIMEDOUT 2

Definition at line 91 of file TapiCode.c.

#define WAITTIMEOUT 30000

Definition at line 107 of file TapiCode.c.

Function Documentation

LPVOID CheckAndReAllocBuffer | ( | LPVOID | lpBuffer,
 |  | size_t | sizeBufferMinimum,
 |  | LPCSTR | szApiPhrase
 | ) |  |

Definition at line 2140 of file TapiCode.c.

{
    size_t sizeBuffer;

    if (lpBuffer == NULL)  // Allocate the buffer if necessary.
    {
        sizeBuffer = sizeBufferMinimum;
        lpBuffer = (LPVOID) LocalAlloc(LPTR, sizeBuffer);

        if (lpBuffer == NULL)
        {
            OutputDebugString(szApiPhrase);
            OutputDebugLastError(GetLastError(),"LocalAlloc : ");
            HandleNoMem();
            return NULL;
        }
    }
    else // If the structure already exists, make sure its good.
    {
        sizeBuffer = (size_t)LocalSize((HLOCAL) lpBuffer);

        if (sizeBuffer == 0) // Bad pointer?
        {
            OutputDebugString(szApiPhrase);
            OutputDebugLastError(GetLastError(),"LocalSize : ");
            return NULL;
        }

        // Was the buffer big enough for the structure?
        if (sizeBuffer < sizeBufferMinimum)
        {
            OutputDebugString(szApiPhrase);
            OutputDebugString("Reallocating structure\n");
            LocalFree(lpBuffer);
            return CheckAndReAllocBuffer(NULL, sizeBufferMinimum, szApiPhrase);
        }

        // Lets zero the buffer out.
        memset(lpBuffer, 0, sizeBuffer);
    }

    ((LPVARSTRING) lpBuffer ) -> dwTotalSize = (DWORD) sizeBuffer;
    return lpBuffer;
}

LPLINECALLPARAMS CreateCallParams | ( | LPLINECALLPARAMS | lpCallParams,
 |  | LPCSTR | lpszDisplayableAddress
 | ) |  |

Definition at line 1243 of file TapiCode.c.

{
    size_t sizeDisplayableAddress;
  DWORD dwRemainingLength;

    if (lpszDisplayableAddress == NULL)
        lpszDisplayableAddress = "";

    sizeDisplayableAddress = strlen(lpszDisplayableAddress) + 1;

    lpCallParams = (LPLINECALLPARAMS) CheckAndReAllocBuffer(
        (LPVOID) lpCallParams,
        sizeof(LINECALLPARAMS) + sizeDisplayableAddress,
        "CreateCallParams: ");

    if (lpCallParams == NULL)
        return NULL;

    // This is where we configure the line for DATAMODEM usage.
    lpCallParams -> dwBearerMode = LINEBEARERMODE_VOICE;
    lpCallParams -> dwMediaMode  = LINEMEDIAMODE_DATAMODEM;

    // This specifies that we want to use only IDLE calls and
    // don't want to cut into a call that might not be IDLE (ie, in use).
    lpCallParams -> dwCallParamFlags = LINECALLPARAMFLAGS_IDLE;

    // if there are multiple addresses on line, use first anyway.
    // It will take a more complex application than a simple tty app
    // to use multiple addresses on a line anyway.
    lpCallParams -> dwAddressMode = LINEADDRESSMODE_ADDRESSID;
    lpCallParams -> dwAddressID = 0;

    // Since we don't know where we originated, leave these blank.
    lpCallParams -> dwOrigAddressSize = 0;
    lpCallParams -> dwOrigAddressOffset = 0;

    // Unimodem ignores these values.
    (lpCallParams -> DialParams) . dwDialSpeed = 0;
    (lpCallParams -> DialParams) . dwDigitDuration = 0;
    (lpCallParams -> DialParams) . dwDialPause = 0;
    (lpCallParams -> DialParams) . dwWaitForDialtone = 0;

    // Address we are dialing.
    lpCallParams -> dwDisplayableAddressOffset = sizeof(LINECALLPARAMS);
    lpCallParams -> dwDisplayableAddressSize = (DWORD) sizeDisplayableAddress;
  dwRemainingLength = lpCallParams -> dwTotalSize - sizeof(LINECALLPARAMS);
    strncpy((LPSTR)lpCallParams + sizeof(LINECALLPARAMS),
           lpszDisplayableAddress, dwRemainingLength);
  *((LPSTR)lpCallParams + sizeof(LINECALLPARAMS) + (DWORD) sizeDisplayableAddress -1) = '\0';

    return lpCallParams;
}

BOOL DialCall ( )

Definition at line 716 of file TapiCode.c.

{
    long lReturn;
    LPLINEADDRESSSTATUS lpLineAddressStatus = NULL;
    LPLINEDEVCAPS lpLineDevCaps = NULL;

    if (g_bTapiInUse)
    {
        OutputDebugString("A call is already being handled\n");
        return FALSE;
    }

    // If TAPI isn't initialized, its either because we couldn't initialize
    // at startup (and this might have been corrected by now), or because
    // a REINIT event was received.  In either case, try to init now.

    if (!g_hLineApp)
    {
        if (!InitializeTAPI(NULL))
            return FALSE;
    }

    // If there are no line devices installed on the machine, lets give
    // the user the opportunity to install one.
    if (g_dwNumDevs < 1)
    {
        if (!HandleNoDevicesInstalled())
            return FALSE;
    }

    // We now have a call active.  Prevent future calls.
    g_bTapiInUse = TRUE;
    EnableMakeCall(g_hWndMainWindow, FALSE);

    // Get a phone number from the user.
    // Phone number will be placed in global variables if successful
    if (!GetAddressToDial())
    {
        HangupCall();
        goto DeleteBuffers;
    }

    // Negotiate the API version to use for this device.
    g_dwAPIVersion = I_lineNegotiateAPIVersion(g_dwDeviceID);
    if (g_dwAPIVersion == 0)
    {
        MessageBox(g_hDlgParentWindow,
            "Line Version unsupported by this Sample",
            "Unable to Use Line",MB_OK);
        HangupCall();
        goto DeleteBuffers;
    }

    // Need to check the DevCaps to make sure this line is usable.
    // The 'Dial' dialog checks also, but better safe than sorry.
    lpLineDevCaps = I_lineGetDevCaps(lpLineDevCaps,
        g_dwDeviceID, g_dwAPIVersion);
    if (lpLineDevCaps == NULL)
    {
        HangupCall();
        MessageBox(g_hDlgParentWindow,
            "Error on Requested line",
            "Unable to Use Line",MB_OK);
        goto DeleteBuffers;
    }

    if (!(lpLineDevCaps->dwBearerModes & LINEBEARERMODE_VOICE ))
    {
        HangupCall();
        MessageBox(g_hDlgParentWindow,
            "Error on Requested line",
            "The selected line doesn't support VOICE capabilities",
            MB_OK);
        goto DeleteBuffers;
    }

    if (!(lpLineDevCaps->dwMediaModes & LINEMEDIAMODE_DATAMODEM))
    {
        HangupCall();
        MessageBox(g_hDlgParentWindow,
            "Error on Requested line",
            "The selected line doesn't support DATAMODEM capabilities",
            MB_OK);
        goto DeleteBuffers;
    }

    // Does this line have the capability to make calls?
    // It is possible that some lines can't make outbound calls.
    if (!(lpLineDevCaps->dwLineFeatures & LINEFEATURE_MAKECALL))
    {
        HangupCall();
        MessageBox(g_hDlgParentWindow,
            "Error on Requested line",
            "The selected line doesn't support MAKECALL capabilities",
            MB_OK);
        goto DeleteBuffers;
    }

    // Open the Line for an outgoing DATAMODEM call.
    do
    {
        lReturn = lineOpen(g_hLineApp, g_dwDeviceID, &g_hLine,
            g_dwAPIVersion, 0, 0,
            LINECALLPRIVILEGE_NONE, LINEMEDIAMODE_DATAMODEM,
            0);

        if(lReturn == LINEERR_ALLOCATED)
        {
            HangupCall();
            MessageBox(g_hDlgParentWindow,
                "Line is already in use by a non-TAPI application "
                "or by another TAPI Service Provider.",
                "Unable to Use Line",MB_OK);
            goto DeleteBuffers;
        }

        if (HandleLineErr(lReturn))
            continue;
        else
        {
            OutputDebugLineError(lReturn, "lineOpen unhandled error: ");
            MessageBox(g_hDlgParentWindow,
                "Error on Requested line",
                "Unable to Use Line",MB_OK);
            HangupCall();
            goto DeleteBuffers;
        }
    }
    while(lReturn != SUCCESS);

    // Tell the service provider that we want all notifications that
    // have anything to do with this line.
    do
    {
        // Set the messages we are interested in.

        // Note that while most applications aren't really interested
        // in dealing with all of the possible messages, its interesting
        // to see which come through the callback for testing purposes.

        lReturn = lineSetStatusMessages(g_hLine,
            LINEDEVSTATE_OTHER          |
            LINEDEVSTATE_RINGING        |
            LINEDEVSTATE_CONNECTED      |  // Important state!
            LINEDEVSTATE_DISCONNECTED   |  // Important state!
            LINEDEVSTATE_MSGWAITON      |
            LINEDEVSTATE_MSGWAITOFF     |
            LINEDEVSTATE_INSERVICE      |
            LINEDEVSTATE_OUTOFSERVICE   |  // Important state!
            LINEDEVSTATE_MAINTENANCE    |  // Important state!
            LINEDEVSTATE_OPEN           |
            LINEDEVSTATE_CLOSE          |
            LINEDEVSTATE_NUMCALLS       |
            LINEDEVSTATE_NUMCOMPLETIONS |
            LINEDEVSTATE_TERMINALS      |
            LINEDEVSTATE_ROAMMODE       |
            LINEDEVSTATE_BATTERY        |
            LINEDEVSTATE_SIGNAL         |
            LINEDEVSTATE_DEVSPECIFIC    |
            LINEDEVSTATE_REINIT         |  // Not allowed to disable this.
            LINEDEVSTATE_LOCK           |
            LINEDEVSTATE_CAPSCHANGE     |
            LINEDEVSTATE_CONFIGCHANGE   |
            LINEDEVSTATE_COMPLCANCEL    ,

            LINEADDRESSSTATE_OTHER      |
            LINEADDRESSSTATE_DEVSPECIFIC|
            LINEADDRESSSTATE_INUSEZERO  |
            LINEADDRESSSTATE_INUSEONE   |
            LINEADDRESSSTATE_INUSEMANY  |
            LINEADDRESSSTATE_NUMCALLS   |
            LINEADDRESSSTATE_FORWARD    |
            LINEADDRESSSTATE_TERMINALS  |
            LINEADDRESSSTATE_CAPSCHANGE);

        if (HandleLineErr(lReturn))
            continue;
        else
        {
            // If we do get an unhandled problem, we don't care.
            // We just won't get notifications.
            OutputDebugLineError(lReturn,
                "lineSetStatusMessages unhandled error: ");
            break;
        }
    }
    while(lReturn != SUCCESS);

    // Get LineAddressStatus so we can make sure the line
    // isn't already in use by a TAPI application.
    lpLineAddressStatus =
        I_lineGetAddressStatus(lpLineAddressStatus, g_hLine, 0);

    if (lpLineAddressStatus == NULL)
    {
        HangupCall();
        MessageBox(g_hDlgParentWindow,
            "Error on Requested line",
            "Unable to Use Line",MB_OK);
        goto DeleteBuffers;
    }

    // MAKECALL will be set if there are any available call appearances
    if ( ! ((lpLineAddressStatus -> dwAddressFeatures) &
            LINEADDRFEATURE_MAKECALL) )
    {
        OutputDebugString("This line is not available to place a call.\n");
        HangupCall();
        MessageBox(g_hDlgParentWindow,
            "Requested line is already in use",
            "Unable to Use Line",MB_OK);
        goto DeleteBuffers;
    }

    // If the line was configured in the 'Dial' dialog, then
    // we need to actually complete the configuration.
    if (g_lpDeviceConfig)
        lineSetDevConfig(g_dwDeviceID, g_lpDeviceConfig,
            g_dwSizeDeviceConfig, "comm/datamodem");

    // Start dialing the number
    if (DialCallInParts(lpLineDevCaps, g_szDialableAddress,
            g_szDisplayableAddress))
    {
        OutputDebugString("DialCallInParts succeeded.\n");
    }
    else
    {
        OutputDebugString("DialCallInParts failed.\n");
        HangupCall();
        goto DeleteBuffers;
    }

DeleteBuffers:

    if (lpLineAddressStatus)
        LocalFree(lpLineAddressStatus);
    if (lpLineDevCaps)
        LocalFree(lpLineDevCaps);
    if (g_bTapiInUse)
        EnableHangupCall(g_hWndMainWindow, TRUE);

    return g_bTapiInUse;
}

BOOL DialCallInParts | ( | LPLINEDEVCAPS | lpLineDevCaps,
 |  | LPCSTR | lpszAddress,
 |  | LPCSTR | lpszDisplayableAddress
 | ) |  |

Definition at line 998 of file TapiCode.c.

{
    LPLINECALLPARAMS  lpCallParams = NULL;
    LPLINEADDRESSCAPS lpAddressCaps = NULL;
    LPLINECALLSTATUS  lpLineCallStatus = NULL;

    long lReturn;
    int i;
    DWORD dwDevCapFlags;
    char szFilter[1+sizeof(g_sNonDialable)] = "";
    BOOL bFirstDial = TRUE;
  DWORD dwRemainingLength;

    // Variables to handle Dialable Substring dialing.
    LPSTR lpDS; // This is just so we can free lpszDialableSubstring later.
    LPSTR lpszDialableSubstring;
    int nAddressLength = 0;
    int nCurrentAddress = 0;
    char chUnhandledCharacter;

    // Get the capabilities for the line device we're going to use.
    lpAddressCaps = I_lineGetAddressCaps(lpAddressCaps,
        g_dwDeviceID, 0, g_dwAPIVersion, 0);
    if (lpAddressCaps == NULL)
        return FALSE;

    // Setup our CallParams for DATAMODEM settings.
    lpCallParams = CreateCallParams (lpCallParams, lpszDisplayableAddress);
    if (lpCallParams == NULL)
        return FALSE;

    // Determine which special characters the service provider
    // does *not* handle so we can handle them manually.
    // Keep list of unhandled characters in szFilter.

    dwDevCapFlags = lpLineDevCaps -> dwDevCapFlags;  // SP handled characters.
    for (i = 0; i < g_sizeofNonDialable ; i++)
    {
        if ((dwDevCapFlags & g_sNonDialable[i].dwDevCapFlag) == 0)
        {
      dwRemainingLength = sizeof(g_sNonDialable) - strlen(szFilter);
            strncat(szFilter, g_sNonDialable[i].szToken,dwRemainingLength );
      szFilter[sizeof(g_sNonDialable)] = '\0';
        }
    }

    // szFilter now contains the set of tokens which delimit dialable substrings

    // Setup the strings for substring dialing.

    nAddressLength = (int) strlen(lpszAddress);
    lpDS = lpszDialableSubstring = (LPSTR) LocalAlloc(LPTR, nAddressLength + 1);
    if (lpszDialableSubstring == NULL)
    {
        OutputDebugLastError(GetLastError(), "LocalAlloc failed: ");
        HandleNoMem();
        goto errExit;
    }

    // Lets start dialing substrings!
    while (nCurrentAddress < nAddressLength)
    {
  retryAfterError:

        // Find the next undialable character
        i = (int) strcspn(&lpszAddress[nCurrentAddress], szFilter);

        // Was there one before the end of the Address string?
        if (i + nCurrentAddress < nAddressLength)
        {
            // Make sure this device can handle partial dial.
            if (! (lpAddressCaps -> dwAddrCapFlags &
                   LINEADDRCAPFLAGS_PARTIALDIAL))
            {
                MessageBox(g_hDlgParentWindow,
                    "This line doesn't support partial dialing.\n",
                    "Warning",MB_OK);
                goto errExit;
            }
            // Remember what the unhandled character is so we can handle it.
            chUnhandledCharacter = lpszAddress[nCurrentAddress+i];

            // Copy the dialable string to the Substring.
            memcpy(lpszDialableSubstring, &lpszAddress[nCurrentAddress], i);

            // Terminate the substring with a ';' to signify the partial dial.
            lpszDialableSubstring[i] = ';';
            lpszDialableSubstring[i+1] = '\0';

            // Increment the address for next iteration.
            nCurrentAddress += i + 1;
        }
        else // No more partial dials.  Dial the rest of the Address.
        {
            lpszDialableSubstring = (LPSTR) &lpszAddress[nCurrentAddress];
            chUnhandledCharacter = 0;
            nCurrentAddress = nAddressLength;
        }

        do
        {
            if (bFirstDial)
                lReturn = WaitForReply(
                    lineMakeCall(g_hLine, &g_hCall, lpszDialableSubstring,
                        0, lpCallParams) );
            else
                lReturn = WaitForReply(
                    lineDial(g_hCall, lpszDialableSubstring, 0) );

            switch(lReturn)
            {
                // We should not have received these errors because of the
                // prefiltering strategy, but there may be some ill-behaved
                // service providers which do not correctly set their
                // devcapflags.  Add the character corresponding to the error
                // to the filter set and retry dialing.
                //
                case LINEERR_DIALBILLING:
                case LINEERR_DIALDIALTONE:
                case LINEERR_DIALQUIET:
                case LINEERR_DIALPROMPT:
                {
                    OutputDebugString("Service Provider incorrectly sets dwDevCapFlags\n");

                    for (i = 0; i < g_sizeofNonDialable; i++)
                        if (lReturn == g_sNonDialable[i].lError)
                        {
                           dwRemainingLength = sizeof(g_sNonDialable) - strlen(szFilter);
              strncat(szFilter, g_sNonDialable[i].szToken,dwRemainingLength);
              szFilter[sizeof(g_sNonDialable)] = '\0';
                        }

                    goto retryAfterError;
                }

                case WAITERR_WAITABORTED:
                    OutputDebugString("While Dialing, WaitForReply aborted.\n");
                    goto errExit;

            }

            if (HandleLineErr(lReturn))
                continue;
            else
            {
                if (bFirstDial)
                    OutputDebugLineError(lReturn, "lineMakeCall unhandled error: ");
                else
                    OutputDebugLineError(lReturn, "lineDial unhandled error: ");

                goto errExit;
            }

        }
        while (lReturn != SUCCESS);

        bFirstDial = FALSE;

        // The dial was successful; now handle characters the service
        // provider didn't (if any).
        if (chUnhandledCharacter)
        {
            LPSTR lpMsg = "";

            // First, wait until we know we can continue dialing.  While the
            // last string is still pending to be dialed, we can't dial another.

            while(TRUE)
            {

                lpLineCallStatus = I_lineGetCallStatus(lpLineCallStatus, g_hCall);
                if (lpLineCallStatus == NULL)
                    goto errExit;

                // Does CallStatus say we can dial now?
                if ((lpLineCallStatus->dwCallFeatures) & LINECALLFEATURE_DIAL)
                {
                    OutputDebugString("Ok to continue dialing.\n");
                    break;
                }

                // We can't dial yet, so wait for a CALLSTATE message
                OutputDebugString("Waiting for dialing to be enabled.\n");

                if (WaitForCallState(I_LINECALLSTATE_ANY) != SUCCESS)
                    goto errExit;
            }

            for (i = 0; i < g_sizeofNonDialable; i++)
                if (chUnhandledCharacter == g_sNonDialable[i].szToken[0])
                    lpMsg = g_sNonDialable[i].szMsg;

            MessageBox(g_hDlgParentWindow, lpMsg, "Dialing Paused", MB_OK);
        }

    } // continue dialing until we dial all Dialable Substrings.

    LocalFree(lpCallParams);
    LocalFree(lpDS);
    LocalFree(lpAddressCaps);
    if (lpLineCallStatus)
        LocalFree(lpLineCallStatus);

    return TRUE;

  errExit:
        // if lineMakeCall has already been successfully called, there's a call in progress.
        // let the invoking routine shut down the call.
        // if the invoker did not clean up the call, it should be done here.

    if (lpLineCallStatus)
        LocalFree(lpLineCallStatus);
    if (lpDS)
        LocalFree(lpDS);
    if (lpCallParams)
        LocalFree(lpCallParams);
    if (lpAddressCaps)
        LocalFree(lpAddressCaps);

    return FALSE;
}

INT_PTR CALLBACK DialDialogProc | ( | HWND | hwndDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 4327 of file TapiCode.c.

{
    // Static variables to store the information from last time the
    // "Dial" dialog was displayed.  That way the phone number can be
    // typed once but used several times.

    static char szCountryName[512] = "";
    static char szAreaCode[256] = "Not Valid";
    static char szPhoneNumber[512] = "Not Valid";
    static DWORD dwUsedDeviceID = MAXDWORD;
    static BOOL bUsedCountryAndArea = FALSE;
    static BOOL bHistoryValid = FALSE;

    switch(uMsg)
    {
        case WM_INITDIALOG:
        {
            DWORD dwCountryID = 0;

            // Store the Dialog Window so it can be dismissed if necessary
            g_hDialog = hwndDlg;

            // This dialog should be parent to all dialogs.
            g_hDlgParentWindow = hwndDlg;

            // Initialize the Dialog Box. Lots to do here.

            FillTAPILine(hwndDlg);
            if (g_lpDeviceConfig)
            {
                LocalFree(g_lpDeviceConfig);
                g_lpDeviceConfig = NULL;
            }

            // If there is a valid history, use it to initialize the controls.
            if (bHistoryValid)
            {
                FillLocationInfo(hwndDlg, NULL, NULL, NULL);
                FillCountryCodeList(hwndDlg, 0);

                SendDlgItemMessage(hwndDlg, IDC_COUNTRYCODE, CB_SELECTSTRING,
                    (WPARAM) -1, (LPARAM) (LPCTSTR) szCountryName);

                SendDlgItemMessage(hwndDlg, IDC_PHONENUMBER, WM_SETTEXT, 0,
                    (LPARAM) (LPCTSTR) szPhoneNumber);

                SendDlgItemMessage(hwndDlg, IDC_USEDIALINGRULES,
                    BM_SETCHECK, (WPARAM) bUsedCountryAndArea, 0);

                SendDlgItemMessage(hwndDlg, IDC_TAPILINE, CB_SETCURSEL,
                    g_dwDeviceID, 0);
            }
            else
            {
                FillLocationInfo(hwndDlg, NULL, &dwCountryID, szAreaCode);
                FillCountryCodeList(hwndDlg, dwCountryID);
                SendDlgItemMessage(hwndDlg, IDC_USEDIALINGRULES,
                    BM_SETCHECK, 1, 0);
            }

            SendDlgItemMessage(hwndDlg, IDC_AREACODE, WM_SETTEXT,
                0, (LPARAM) (LPCTSTR) szAreaCode);

            UseDialingRules(hwndDlg);
            DisplayPhoneNumber(hwndDlg);
            VerifyAndWarnUsableLine(hwndDlg);

            return TRUE;
        }

        case WM_COMMAND:
        {
            switch(LOWORD(wParam))
            {
                case IDC_TAPILINE:
                    if (HIWORD(wParam) == CBN_SELENDOK)
                    {
                        if (g_lpDeviceConfig)
                        {
                            LocalFree(g_lpDeviceConfig);
                            g_lpDeviceConfig = NULL;
                        }
                        DisplayPhoneNumber(hwndDlg);
                        VerifyAndWarnUsableLine(hwndDlg);
                    }
                    return TRUE;

                case IDC_CONFIGURELINE:
                {
                    DWORD dwDeviceID;
                    dwDeviceID = (DWORD)SendDlgItemMessage(hwndDlg, IDC_TAPILINE,
                        CB_GETCURSEL, 0, 0);
                    PreConfigureDevice(hwndDlg, dwDeviceID);
                    DisplayPhoneNumber(hwndDlg);
                    return TRUE;
                }

                case IDC_COUNTRYCODE:
                    if (HIWORD(wParam) == CBN_SELENDOK)
                        DisplayPhoneNumber(hwndDlg);
                    return TRUE;

                case IDC_AREACODE:
                case IDC_PHONENUMBER:
                    if (HIWORD(wParam) == EN_CHANGE)
                        DisplayPhoneNumber(hwndDlg);
                    return TRUE;

                case IDC_USEDIALINGRULES:
                    if (HIWORD(wParam) == BN_CLICKED)
                    {
                        UseDialingRules(hwndDlg);
                        DisplayPhoneNumber(hwndDlg);
                    }
                    return TRUE;

                case IDC_LOCATION:
                    if (HIWORD(wParam) == CBN_CLOSEUP)
                    {
                        char szCurrentLocation[1024];
                        int nCurrentSelection;

                        nCurrentSelection = (int)SendDlgItemMessage(hwndDlg,
                            IDC_LOCATION, CB_GETCURSEL, 0, 0);
                        SendDlgItemMessage(hwndDlg, IDC_LOCATION,
                            CB_GETLBTEXT, nCurrentSelection,
                            (LPARAM) (LPCTSTR) szCurrentLocation);

                        // If the user selected a 'location', make it current.
                        FillLocationInfo(hwndDlg, szCurrentLocation, NULL, NULL);
                        DisplayPhoneNumber(hwndDlg);
                    }
                    return TRUE;

                case IDC_DIALINGPROPERTIES:
                {
                    char szAddress[1024];
                    DWORD dwDeviceID;
                    long lReturn;

                    dwDeviceID = (DWORD)SendDlgItemMessage(hwndDlg, IDC_TAPILINE,
                            CB_GETCURSEL, 0, 0);

                    SendDlgItemMessage(hwndDlg, IDC_CANONICALNUMBER,
                        WM_GETTEXT, 1023, (LPARAM) (LPCTSTR) szAddress);

                    lReturn = lineTranslateDialog(g_hLineApp, dwDeviceID,
                        SAMPLE_TAPI_VERSION, hwndDlg, szAddress);

                    if (lReturn != SUCCESS)
                        OutputDebugLineError(lReturn,"lineTranslateDialog: ");

                    // The user could have changed the default location, or
                    // added or removed a location while in the 'Dialing
                    // Properties' dialog.  Refill the Location Info.
                    FillLocationInfo(hwndDlg, NULL, NULL, NULL);
                    DisplayPhoneNumber(hwndDlg);

                    return TRUE;
                }

                case IDCANCEL:
                    EndDialog(hwndDlg, FALSE);
                    return TRUE;

                case IDC_DIAL:
                {
                    // The Dial button has to be enabled and the line has
                    // to be currently usable to continue.
                    if (!(IsWindowEnabled((HWND)lParam) &&
                          VerifyAndWarnUsableLine(hwndDlg)))
                        return TRUE;

                    DisplayPhoneNumber(hwndDlg);

                    // Get the displayable and dialable numbers and store
                    // them in global variables to be used while dialing.
                    SendDlgItemMessage(hwndDlg, IDC_DISPLAYABLENUMBER,
                        WM_GETTEXT, 1023, (LPARAM) (LPCTSTR) g_szDisplayableAddress);

                    SendDlgItemMessage(hwndDlg, IDC_DIALABLENUMBER,
                        WM_GETTEXT, 1023, (LPARAM) (LPCTSTR) g_szDialableAddress);

                    // Store all the relavent information in static
                    // variables so they will be available the next time a
                    // number is dialed.
                    SendDlgItemMessage(hwndDlg, IDC_COUNTRYCODE,
                        WM_GETTEXT, 511, (LPARAM) (LPCTSTR) szCountryName);

                    SendDlgItemMessage(hwndDlg, IDC_AREACODE,
                        WM_GETTEXT, 255, (LPARAM) (LPCTSTR) szAreaCode);

                    SendDlgItemMessage(hwndDlg, IDC_PHONENUMBER,
                        WM_GETTEXT, 511, (LPARAM) (LPCTSTR) szPhoneNumber);

                    bUsedCountryAndArea = (BOOL) SendDlgItemMessage(hwndDlg,
                        IDC_USEDIALINGRULES, BM_GETCHECK, 0, 0);

                    bHistoryValid = TRUE;

                    EndDialog(hwndDlg, TRUE);
                    return TRUE;
                }

                // This message is actually posted to the dialog from the
                // lineCallbackFunc when it receives a
                // LINEDEVSTATE_TRANSLATECHANGE message.  Notify the user and
                // retranslate the number.  Also refill the Location Info
                // since this could have been generated by a location change.
                case IDC_CONFIGURATIONCHANGED:
                {
                    FillLocationInfo(hwndDlg, NULL, NULL, NULL);
                    DisplayPhoneNumber(hwndDlg);

                    MessageBox(hwndDlg,
                        "Location Configuration has been changed.",
                        "Warning",MB_OK);

                    return TRUE;
                }

                // If we get a LINE_CREATE message, all that needs to be done
                // is to reset this controls contents.  The selected line
                // won't change and no lines will be removed.
                case IDC_LINECREATE:
                {
                    FillTAPILine(hwndDlg);
                    return TRUE;
                }

                default:
                    break;
            }

            break;
        }

        // This dialog has the DS_CONTEXTMENU flag so that the right mouse
        // button will send this message.  Bring up the appropriate help page.
        case WM_CONTEXTMENU:
        {

            if (hwndDlg != (HWND) wParam)
                WinHelp ((HWND)wParam,
                    "TAPICOMM.HLP",
                     HELP_CONTEXTMENU,
                    (DWORD_PTR)(LPVOID) g_adwSampleMenuHelpIDs);
            break;
        }

        // Bring up the appropriate help page.
        case WM_HELP:
        {
            LPHELPINFO lphi;

            lphi = (LPHELPINFO)lParam;
            if ((lphi->iContextType == HELPINFO_WINDOW) &&
                (hwndDlg != lphi->hItemHandle) &&
                (lphi->iCtrlId < IDC_NOHELPCONTROLS))
            {
                WinHelp (lphi->hItemHandle,
                    "TAPICOMM.HLP",
                    HELP_WM_HELP,
                    (DWORD_PTR)(LPVOID) g_adwSampleMenuHelpIDs);
            }

          return TRUE;
        }

        default:
            break;
    }

    return FALSE;
}

void DisplayPhoneNumber ( HWND hwndDlg )

Definition at line 3990 of file TapiCode.c.

{
    char szPreTranslatedNumber[1024] = "";
    int  nPreTranslatedSize = 0;
    char szTempBuffer[512];
    int  i;
    DWORD dwDeviceID;
    LPLINETRANSLATEOUTPUT lpLineTranslateOutput = NULL;
  DWORD dwRemainingLength;

    // Disable the 'dial' button if there isn't a number to dial
    if (0 == SendDlgItemMessage(hwndDlg, IDC_PHONENUMBER,
            WM_GETTEXTLENGTH, 0, 0))
    {
        SendDlgItemMessage(hwndDlg, IDC_CANONICALNUMBER, WM_SETTEXT, 0,
            (LPARAM) NULL);
        SendDlgItemMessage(hwndDlg, IDC_DIALABLENUMBER, WM_SETTEXT, 0,
            (LPARAM) NULL);
        SendDlgItemMessage(hwndDlg, IDC_DISPLAYABLENUMBER, WM_SETTEXT, 0,
            (LPARAM) (LPCTSTR) "No Phone Number");

        EnableWindow(GetDlgItem(hwndDlg, IDC_DIAL), FALSE);
        return;
    }

    // If we use the dialing rules, lets make canonical format.
    // Canonical format is explained in the TAPI documentation and the
    // string format needs to be followed very strictly.
    if (SendDlgItemMessage(hwndDlg, IDC_USEDIALINGRULES,
        BM_GETCHECK, 0, 0))
    {
        // First character *has* to be the plus sign.
        szPreTranslatedNumber[0] = '+';
        nPreTranslatedSize = 1;

        // The country code *has* to be next.
        // Country code was stored in the string with the country
        // name and needs to be extracted at this point.
        i = (int)SendDlgItemMessage(hwndDlg, IDC_COUNTRYCODE,
                CB_GETCURSEL, 0, 0);
        SendDlgItemMessage(hwndDlg, IDC_COUNTRYCODE,
            CB_GETLBTEXT, (WPARAM) i, (LPARAM) (LPCTSTR) szTempBuffer);

        // Country code is at the end of the string, surounded by parens.
        // This makes it easy to identify the country code.
        i = (int) strlen(szTempBuffer);
        while(szTempBuffer[--i] != '(');

        while(szTempBuffer[++i] != ')')
            szPreTranslatedNumber[nPreTranslatedSize++] = szTempBuffer[i];

        // Next is the area code.
        i = (int)SendDlgItemMessage(hwndDlg, IDC_AREACODE, WM_GETTEXT,
                510, (LPARAM) (LPCTSTR) szTempBuffer);

        // Note that the area code is optional.  If it is included,
        // then it has to be preceeded by *exactly* one space and it
        // *has* to be surrounded by parens.
        if (i)
            nPreTranslatedSize +=
                wsprintf(&szPreTranslatedNumber[nPreTranslatedSize],
                    " (%s)", szTempBuffer);

        // There has to be *exactly* one space before the rest of the number.
        szPreTranslatedNumber[nPreTranslatedSize++] = ' ';

        // At this point, the phone number is appended to the
        // canonical number.  The next step is the same whether canonical
        // format is used or not; just the prepended area code and
        // country code are different.
    }

    SendDlgItemMessage(hwndDlg, IDC_PHONENUMBER, WM_GETTEXT,
        510, (LPARAM) (LPCTSTR) szTempBuffer);
  dwRemainingLength = 1023 - strlen(szPreTranslatedNumber);
    strncat(&szPreTranslatedNumber[nPreTranslatedSize], szTempBuffer,dwRemainingLength );
  szPreTranslatedNumber[1023] = '\0';

    dwDeviceID = (DWORD)SendDlgItemMessage(hwndDlg, IDC_TAPILINE,
                        CB_GETCURSEL, 0, 0);

    // Translate the address!
    lpLineTranslateOutput = I_lineTranslateAddress(
        lpLineTranslateOutput, dwDeviceID, SAMPLE_TAPI_VERSION,
        szPreTranslatedNumber);

    // Unable to translate it?
    if (lpLineTranslateOutput == NULL)
    {
        SendDlgItemMessage(hwndDlg, IDC_CANONICALNUMBER, WM_SETTEXT, 0,
            (LPARAM) NULL);
        SendDlgItemMessage(hwndDlg, IDC_DIALABLENUMBER, WM_SETTEXT, 0,
            (LPARAM) NULL);
        SendDlgItemMessage(hwndDlg, IDC_DISPLAYABLENUMBER, WM_SETTEXT, 0,
            (LPARAM) (LPCTSTR) "Invalid Phone Number or Area Code");

        EnableWindow(GetDlgItem(hwndDlg, IDC_DIAL), FALSE);
        return;
    }

    // Is the selected device useable with TapiComm?
    if (g_dwDeviceID != MAXDWORD)
        EnableWindow(GetDlgItem(hwndDlg, IDC_DIAL), TRUE);

    // Fill the appropriate phone number controls.
    SendDlgItemMessage(hwndDlg, IDC_CANONICALNUMBER, WM_SETTEXT, 0,
        (LPARAM) (LPCTSTR) szPreTranslatedNumber);

    SendDlgItemMessage(hwndDlg, IDC_DIALABLENUMBER, WM_SETTEXT, 0,
        (LPARAM) ((LPSTR) lpLineTranslateOutput +
            lpLineTranslateOutput -> dwDialableStringOffset));

    SendDlgItemMessage(hwndDlg, IDC_DISPLAYABLENUMBER, WM_SETTEXT, 0,
        (LPARAM) ((LPSTR) lpLineTranslateOutput +
            lpLineTranslateOutput -> dwDisplayableStringOffset));

    LocalFree(lpLineTranslateOutput);

}

void DoLineCallState | ( | DWORD | dwDevice,
 |  | DWORD | dwMsg,
 |  | DWORD | dwCallbackInstance,
 |  | DWORD | dwParam1,
 |  | DWORD | dwParam2,
 |  | DWORD | dwParam3
 | ) |  |

Definition at line 1832 of file TapiCode.c.

{

    // Error if this CALLSTATE doesn't apply to our call in progress.
    if ((HCALL) dwDevice != g_hCall)
    {
        OutputDebugPrintf("LINE_CALLSTATE: Unknown device ID '0x%lx'.",
            dwDevice);
        return;
    }

    // This sets the global g_dwCallState variable so if we are waiting
    // for a specific call state change, we will know when it happens.
    g_dwCallState = dwParam1;
    g_bCallStateReceived = TRUE;

    // dwParam3 contains changes to LINECALLPRIVILEGE, if there are any.
    switch (dwParam3)
    {
        case 0:
            break; // no change to call state

         // close line if we are made monitor.  Shouldn't happen!
         case LINECALLPRIVILEGE_MONITOR:
            OutputDebugString("line given monitor privilege; closing\n");
            HangupCall();
            return;

         // close line if we are made owner.  Shouldn't happen!
        case LINECALLPRIVILEGE_OWNER:
            OutputDebugString("line given owner privilege; closing\n");
            HangupCall();
            break;

        default: // Shouldn't happen!  All cases handled.
            OutputDebugString("Unknown LINECALLPRIVILEGE message: closing\n");
            HangupCall();
            return;
    }

    // dwParam1 is the specific CALLSTATE change that is occurring.
    switch (dwParam1)
    {
        case LINECALLSTATE_DIALTONE:
            UpdateStatusBar("Dial Tone",1,0);
            OutputDebugString("Dial Tone\n");
            break;

        case LINECALLSTATE_DIALING:
            UpdateStatusBar("Dialing Call",1,0);
            OutputDebugString("Dialing\n");
            break;

        case LINECALLSTATE_PROCEEDING:
            UpdateStatusBar("Call is Proceeding",1,0);
            OutputDebugString("Proceeding\n");
            break;

        case LINECALLSTATE_RINGBACK:
            UpdateStatusBar("RingBack",1,0);
            OutputDebugString("RingBack\n");
            break;

        case LINECALLSTATE_BUSY:
            UpdateStatusBar("Line is busy",1,0);
            OutputDebugString("Line busy, shutting down\n");
            HangupCall();
            break;

        case LINECALLSTATE_IDLE:
            UpdateStatusBar("Line is idle",1,0);
            OutputDebugString("Line idle\n");
            HangupCall();
            break;

        case LINECALLSTATE_SPECIALINFO:
            UpdateStatusBar(
                "Special Info, probably couldn't dial number",1,0);
            OutputDebugString(
                "Special Info, probably couldn't dial number\n");
            HangupCall();
            break;

        case LINECALLSTATE_DISCONNECTED:
        {
            LPSTR pszReasonDisconnected;

            switch (dwParam2)
            {
                case LINEDISCONNECTMODE_NORMAL:
                    pszReasonDisconnected = "Remote Party Disconnected";
                    break;

                case LINEDISCONNECTMODE_UNKNOWN:
                    pszReasonDisconnected = "Disconnected: Unknown reason";
                    break;

                case LINEDISCONNECTMODE_REJECT:
                    pszReasonDisconnected = "Remote Party rejected call";
                    break;

                case LINEDISCONNECTMODE_PICKUP:
                    pszReasonDisconnected =
                        "Disconnected: Local phone picked up";
                    break;

                case LINEDISCONNECTMODE_FORWARDED:
                    pszReasonDisconnected = "Disconnected: Forwarded";
                    break;

                case LINEDISCONNECTMODE_BUSY:
                    pszReasonDisconnected = "Disconnected: Busy";
                    break;

                case LINEDISCONNECTMODE_NOANSWER:
                    pszReasonDisconnected = "Disconnected: No Answer";
                    break;

                case LINEDISCONNECTMODE_BADADDRESS:
                    pszReasonDisconnected = "Disconnected: Bad Address";
                    break;

                case LINEDISCONNECTMODE_UNREACHABLE:
                    pszReasonDisconnected = "Disconnected: Unreachable";
                    break;

                case LINEDISCONNECTMODE_CONGESTION:
                    pszReasonDisconnected = "Disconnected: Congestion";
                    break;

                case LINEDISCONNECTMODE_INCOMPATIBLE:
                    pszReasonDisconnected = "Disconnected: Incompatible";
                    break;

                case LINEDISCONNECTMODE_UNAVAIL:
                    pszReasonDisconnected = "Disconnected: Unavail";
                    break;

                case LINEDISCONNECTMODE_NODIALTONE:
                    pszReasonDisconnected = "Disconnected: No Dial Tone";
                    break;

                default:
                    pszReasonDisconnected =
                        "Disconnected: LINECALLSTATE; Bad Reason";
                    break;

            }

            UpdateStatusBar(pszReasonDisconnected,1,0);
            OutputDebugString(pszReasonDisconnected);
            OutputDebugString("\n");
            HangupCall();
            break;
        }

        case LINECALLSTATE_CONNECTED:  // CONNECTED!!!
        {
            LPVARSTRING lpVarString = NULL;
            DWORD dwSizeofVarString = sizeof(VARSTRING) + 1024;
            HANDLE hCommFile = NULL;
            long lReturn;

            // Very first, make sure this isn't a duplicated message.
            // A CALLSTATE message can be sent whenever there is a
            // change to the capabilities of a line, meaning that it is
            // possible to receive multiple CONNECTED messages per call.
            // The CONNECTED CALLSTATE message is the only one in TapiComm
            // where it would cause problems if it where sent more
            // than once.

            if (g_bConnected)
                break;

            g_bConnected = TRUE;

            // Get the handle to the comm port from the driver so we can start
            // communicating.  This is returned in a LPVARSTRING structure.
            do
            {
                // Allocate the VARSTRING structure
                lpVarString = CheckAndReAllocBuffer((LPVOID) lpVarString,
                    dwSizeofVarString,"lineGetID: ");

                if (lpVarString == NULL)
                    goto ErrorConnecting;

                // Fill the VARSTRING structure
                lReturn = lineGetID(0, 0, g_hCall, LINECALLSELECT_CALL,
                    lpVarString, "comm/datamodem");

                if (HandleLineErr(lReturn))
                    ; // Still need to check if structure was big enough.
                else
                {
                    OutputDebugLineError(lReturn,
                        "lineGetID unhandled error: ");
                    goto ErrorConnecting;
                }

                // If the VARSTRING wasn't big enough, loop again.
                if ((lpVarString -> dwNeededSize) > (lpVarString -> dwTotalSize))
                {
                    dwSizeofVarString = lpVarString -> dwNeededSize;
                    lReturn = -1; // Lets loop again.
                }
            }
            while(lReturn != SUCCESS);

            OutputDebugString("Connected!  Starting communications!\n");

            // Again, the handle to the comm port is contained in a
            // LPVARSTRING structure.  Thus, the handle is the very first
            // thing after the end of the structure.  Note that the name of
            // the comm port is right after the handle, but I don't want it.
            hCommFile =
                *((LPHANDLE)((LPBYTE)lpVarString +
                    lpVarString -> dwStringOffset));

            // Started communications!
            if (StartComm(hCommFile))
            {
                char szBuff[300];

                wsprintf(szBuff,"Connected to '%s'",g_szDisplayableAddress);
                UpdateStatusBar(szBuff, 1, 0);

                LocalFree(lpVarString);
                break;
            }

            // Couldn't start communications.  Clean up instead.
          ErrorConnecting:

            // Its very important that we close all Win32 handles.
            // The CommCode module is responsible for closing the hCommFile
            // handle if it succeeds in starting communications.
            if (hCommFile)
                CloseHandle(hCommFile);

            HangupCall();
            {
                char szBuff[300];
                wsprintf(szBuff,"Failed to Connect to '%s'",
                    g_szDisplayableAddress);
                UpdateStatusBar(szBuff, 1, 0);
            }

            if (lpVarString)
                LocalFree(lpVarString);

            break;
        }

        default:
            OutputDebugString("Unhandled LINECALLSTATE message\n");
            break;
    }
}

void DoLineClose | ( | DWORD | dwDevice,
 |  | DWORD | dwMsg,
 |  | DWORD | dwCallbackInstance,
 |  | DWORD | dwParam1,
 |  | DWORD | dwParam2,
 |  | DWORD | dwParam3
 | ) |  |

Definition at line 1643 of file TapiCode.c.

{
    // Line has been shut down.  Clean up our internal variables.
    g_hLine = (HLINE)((ULONG_PTR)NULL);
    g_hCall = (HCALL)((ULONG_PTR)NULL);
    UpdateStatusBar("Call was shut down.",1,0);
    MessageBox(g_hDlgParentWindow,
        "Call was shut down.","Warning",MB_OK);
    HangupCall();
}

void DoLineCreate | ( | DWORD | dwDevice,
 |  | DWORD | dwMessage,
 |  | DWORD | dwCallbackInstance,
 |  | DWORD | dwParam1,
 |  | DWORD | dwParam2,
 |  | DWORD | dwParam3
 | ) |  |

Definition at line 1793 of file TapiCode.c.

{
    // dwParam1 is the Device ID of the new line.
    // Add one to get the number of total devices.
    if (g_dwNumDevs <= dwParam1)
        g_dwNumDevs = dwParam1+1;
    if (g_hDialog)
        PostMessage(g_hDialog, WM_COMMAND, IDC_LINECREATE, 0);

}

void DoLineDevState | ( | DWORD | dwDevice,
 |  | DWORD | dwsg,
 |  | DWORD | dwCallbackInstance,
 |  | DWORD | dwParam1,
 |  | DWORD | dwParam2,
 |  | DWORD | dwParam3
 | ) |  |

Definition at line 1684 of file TapiCode.c.

{
    switch(dwParam1)
    {
        case LINEDEVSTATE_RINGING:
            UpdateStatusBar("Line Ringing",1,0);
            OutputDebugString("Line Ringing.\n");
            break;

        case LINEDEVSTATE_REINIT:
        // This is an important case!  Usually means that a service provider
        // has changed in such a way that requires TAPI to REINIT.
        // Note that there are both 'soft' REINITs and 'hard' REINITs.
        // Soft REINITs don't actually require a full shutdown but is instead
        // just an informational change that historically required a REINIT
        // to force the application to deal with.  TAPI API Version 1.3 apps
        // will still need to do a full REINIT for both hard and soft REINITs.

            switch(dwParam2)
            {
                // This is the hard REINIT.  No reason given, just REINIT.
                // TAPI is waiting for everyone to shutdown.
                // Our response is to immediately shutdown any calls,
                // shutdown our use of TAPI and notify the user.
                case 0:
                    ShutdownTAPI();
                    WarningBox("Tapi line configuration has changed.");
                    break;

                case LINE_CREATE:
                    OutputDebugString("Soft REINIT: LINE_CREATE.\n");
                    DoLineCreate(dwDevice, dwParam2, dwCallbackInstance,
                        dwParam3, 0, 0);
                    break;

                case LINE_LINEDEVSTATE:
                    OutputDebugString("Soft REINIT: LINE_LINEDEVSTATE.\n");
                    DoLineDevState(dwDevice, dwParam2, dwCallbackInstance,
                        dwParam3, 0, 0);
                    break;

                // There might be other reasons to send a soft reinit.
                // No need to to shutdown for these.
                default:
                    OutputDebugString("Ignoring soft REINIT\n");
                    break;
            }
            break;

        case LINEDEVSTATE_OUTOFSERVICE:
            WarningBox("Line selected is now Out of Service.");
            HangupCall();
            break;

        case LINEDEVSTATE_DISCONNECTED:
            WarningBox("Line selected is now disconnected.");
            HangupCall();
            break;

        case LINEDEVSTATE_MAINTENANCE:
            WarningBox("Line selected is now out for maintenance.");
            HangupCall();
            break;

        case LINEDEVSTATE_TRANSLATECHANGE:
            if (g_hDialog)
                PostMessage(g_hDialog, WM_COMMAND, IDC_CONFIGURATIONCHANGED, 0);
            break;

        case LINEDEVSTATE_REMOVED:
            OutputDebugString("A Line device has been removed;"
                " no action taken.\n");
            break;

        default:
            OutputDebugString("Unhandled LINEDEVSTATE message\n");
    }
}

void DoLineReply | ( | DWORD | dwDevice,
 |  | DWORD | dwMsg,
 |  | DWORD | dwCallbackInstance,
 |  | DWORD | dwParam1,
 |  | DWORD | dwParam2,
 |  | DWORD | dwParam3
 | ) |  |

Definition at line 1599 of file TapiCode.c.

{
    if ((long) dwParam2 != SUCCESS)
        OutputDebugLineError((long) dwParam2, "LINE_REPLY error: ");
    else
        OutputDebugString("LINE_REPLY: successfully replied.\n");

    // If we are currently waiting for this async Request ID
    // then set the global variables to acknowledge it.
    if (g_dwRequestedID == dwParam1)
    {
        g_bReplyRecieved = TRUE;
        g_lAsyncReply = (long) dwParam2;
    }
}

void FillCountryCodeList | ( | HWND | hwndDlg,
 |  | DWORD | dwDefaultCountryID
 | ) |  |

Definition at line 3641 of file TapiCode.c.

{
    LPLINECOUNTRYLIST lpLineCountryList = NULL;
    DWORD dwSizeofCountryList = sizeof(LINECOUNTRYLIST);
    long lReturn;
    DWORD dwCountry;
    LPLINECOUNTRYENTRY lpLineCountryEntries;
    char szRenamedCountry[256];

    // Get the country information stored in TAPI
    do
    {
        lpLineCountryList = (LPLINECOUNTRYLIST) CheckAndReAllocBuffer(
            (LPVOID) lpLineCountryList, dwSizeofCountryList,
            "FillCountryCodeList");

        if (lpLineCountryList == NULL)
            return;

        lReturn = lineGetCountry (0, SAMPLE_TAPI_VERSION, lpLineCountryList);

        if (HandleLineErr(lReturn))
            ;
        else
        {
            OutputDebugLineError(lReturn, "lineGetCountry unhandled error: ");
            LocalFree(lpLineCountryList);
            return;
        }

        if ((lpLineCountryList -> dwNeededSize) >
            (lpLineCountryList -> dwTotalSize))
        {
            dwSizeofCountryList = lpLineCountryList ->dwNeededSize;
            lReturn = -1; // Lets loop again.
        }
    }
    while (lReturn != SUCCESS);

    // Find the first country entry
    lpLineCountryEntries = (LPLINECOUNTRYENTRY)
        (((LPBYTE) lpLineCountryList)
         + lpLineCountryList -> dwCountryListOffset);

    // Now enumerate through all the countries
    for (dwCountry = 0;
         dwCountry < lpLineCountryList -> dwNumCountries;
         dwCountry++)
    {
        // append the country code to the country name
        wsprintf(szRenamedCountry,"%s (%lu)",
            (((LPSTR) lpLineCountryList) +
                lpLineCountryEntries[dwCountry].dwCountryNameOffset),
            lpLineCountryEntries[dwCountry].dwCountryCode);

        // Now put this country name / code string into the combobox
        lReturn = (long)SendDlgItemMessage(hwndDlg, IDC_COUNTRYCODE, CB_ADDSTRING,
                    0, (LPARAM) (LPCTSTR) szRenamedCountry);

        // If this country is the default country, select it.
        if (lpLineCountryEntries[dwCountry].dwCountryID
            == dwDefaultCountryID)
        {
            SendDlgItemMessage(hwndDlg, IDC_COUNTRYCODE, CB_SETCURSEL, lReturn, 0);
        }
    }

    LocalFree(lpLineCountryList);
    return;
}

void FillLocationInfo | ( | HWND | hwndDlg,
 |  | LPSTR | lpszCurrentLocation,
 |  | LPDWORD | lpdwCountryID,
 |  | LPSTR | lpszAreaCode
 | ) |  |

Definition at line 3754 of file TapiCode.c.

{
    LPLINETRANSLATECAPS lpTranslateCaps = NULL;
    DWORD dwSizeofTranslateCaps = sizeof(LINETRANSLATECAPS);
    long lReturn;
    DWORD dwCounter;
    LPLINELOCATIONENTRY lpLocationEntry;
    LPLINECARDENTRY lpLineCardEntry = NULL;
    DWORD dwPreferredCardID = MAXDWORD;
  DWORD dwRemainingLength;

    // First, get the TRANSLATECAPS
    do
    {
        lpTranslateCaps = (LPLINETRANSLATECAPS) CheckAndReAllocBuffer(
            (LPVOID) lpTranslateCaps, dwSizeofTranslateCaps,
            "FillLocationInfo");

        if (lpTranslateCaps == NULL)
            return;

        lReturn = lineGetTranslateCaps(g_hLineApp, SAMPLE_TAPI_VERSION,
                    lpTranslateCaps);

        if (HandleLineErr(lReturn))
            ;
        else
        {
            OutputDebugLineError(lReturn,
                "lineGetTranslateCaps unhandled error: ");
            LocalFree(lpTranslateCaps);
            return;
        }

        if ((lpTranslateCaps -> dwNeededSize) >
            (lpTranslateCaps -> dwTotalSize))
        {
            dwSizeofTranslateCaps = lpTranslateCaps ->dwNeededSize;
            lReturn = -1; // Lets loop again.
        }
    }
    while(lReturn != SUCCESS);

    // Find the location information in the TRANSLATECAPS
    lpLocationEntry = (LPLINELOCATIONENTRY)
        (((LPBYTE) lpTranslateCaps) + lpTranslateCaps->dwLocationListOffset);

    // If lpszCurrentLocation, then make that location 'current'
    if (lpszCurrentLocation)
    {
        // loop through all locations, looking for a location match
        for(dwCounter = 0;
            dwCounter < lpTranslateCaps -> dwNumLocations;
            dwCounter++)
        {
            if (strcmp((((LPSTR) lpTranslateCaps) +
                            lpLocationEntry[dwCounter].dwLocationNameOffset),
                        lpszCurrentLocation)
                == 0)
            {
                // Found it!  Set the current location.
                lineSetCurrentLocation(g_hLineApp,
                    lpLocationEntry[dwCounter].dwPermanentLocationID);

                // Set the return values.
                if (lpdwCountryID)
                    *lpdwCountryID = lpLocationEntry[dwCounter].dwCountryID;

        dwRemainingLength = 255 - lstrlen(lpszAreaCode);

                if (lpszAreaCode)
                    strncpy(lpszAreaCode, (((LPSTR) lpTranslateCaps) +
                            lpLocationEntry[dwCounter].dwCityCodeOffset),dwRemainingLength);
        lpszAreaCode[255] = '\0';

                // Store the preferred card ID for later use.
                dwPreferredCardID = lpLocationEntry[dwCounter].dwPreferredCardID;
                break;
            }
        }

        // Was a match for lpszCurrentLocation found?
        if (dwPreferredCardID == MAXDWORD)
        {
            OutputDebugString("lpszCurrentLocation not found\n");
            SendDlgItemMessage(hwndDlg, IDC_CALLINGCARD, WM_SETTEXT, 0,
                (LPARAM) (LPCSTR) "Invalid Location Selected");
            LocalFree(lpTranslateCaps);
            return;
        }
    }
    else // fill the combobox and use the TAPI 'current' location.
    {
        // First empty the combobox
        SendDlgItemMessage(hwndDlg, IDC_LOCATION, CB_RESETCONTENT, 0, 0);

        // enumerate all the locations
        for(dwCounter = 0;
            dwCounter < lpTranslateCaps -> dwNumLocations;
            dwCounter++)
        {
            // Put each one into the combobox
            lReturn = (long)SendDlgItemMessage(hwndDlg, IDC_LOCATION, CB_ADDSTRING,
                0, (LPARAM) (((LPBYTE) lpTranslateCaps) +
                    lpLocationEntry[dwCounter].dwLocationNameOffset));

            // Is this location the 'current' location?
            if (lpLocationEntry[dwCounter].dwPermanentLocationID ==
                lpTranslateCaps->dwCurrentLocationID)
            {
                // Return the requested information
                if (lpdwCountryID)
                    *lpdwCountryID = lpLocationEntry[dwCounter].dwCountryID;
        dwRemainingLength = 255 - lstrlen(lpszAreaCode);
                if (lpszAreaCode)
                    strncpy(lpszAreaCode, (((LPSTR) lpTranslateCaps) +
                            lpLocationEntry[dwCounter].dwCityCodeOffset),dwRemainingLength);
        lpszAreaCode[255] = '\0';

                // Set this to be the active location.
                SendDlgItemMessage(hwndDlg, IDC_LOCATION, CB_SETCURSEL, lReturn, 0);
                dwPreferredCardID = lpLocationEntry[dwCounter].dwPreferredCardID;
            }
        }
    }

    // Now locate the prefered card and display it.

    lpLineCardEntry = (LPLINECARDENTRY)
        (((LPBYTE) lpTranslateCaps) + lpTranslateCaps->dwCardListOffset);

    for(dwCounter = 0;
        dwCounter < lpTranslateCaps -> dwNumCards;
        dwCounter++)
    {
        if (lpLineCardEntry[dwCounter].dwPermanentCardID == dwPreferredCardID)
        {
            SendDlgItemMessage(hwndDlg, IDC_CALLINGCARD, WM_SETTEXT, 0,
                (LPARAM) (((LPBYTE) lpTranslateCaps) +
                    lpLineCardEntry[dwCounter].dwCardNameOffset));
            break;
        }
    }

    LocalFree(lpTranslateCaps);
}

void FillTAPILine ( HWND hwndDlg )

Definition at line 3376 of file TapiCode.c.

{
    DWORD dwDeviceID;
    DWORD dwAPIVersion;
    LPLINEDEVCAPS lpLineDevCaps = NULL;
    char szLineUnavail[] = "Line Unavailable";
    char szLineUnnamed[] = "Line Unnamed";
    char szLineNameEmpty[] = "Line Name is Empty";
    LPSTR lpszLineName;
    long lReturn;
    DWORD dwDefaultDevice = MAXDWORD;

    // Make sure the control is empty.  If it isn't,
    // hold onto the currently selected ID and then reset it.
    if (SendDlgItemMessage(hwndDlg, IDC_TAPILINE, CB_GETCOUNT, 0, 0))
    {
        dwDefaultDevice = (DWORD)SendDlgItemMessage(hwndDlg, IDC_TAPILINE,
            CB_GETCURSEL, 0, 0);
        SendDlgItemMessage(hwndDlg, IDC_TAPILINE, CB_RESETCONTENT, 0, 0);
    }

    for (dwDeviceID = 0; dwDeviceID < g_dwNumDevs; dwDeviceID ++)
    {
        dwAPIVersion = I_lineNegotiateLegacyAPIVersion(dwDeviceID);
        if (dwAPIVersion)
        {
            lpLineDevCaps = I_lineGetDevCaps(lpLineDevCaps,
                dwDeviceID, dwAPIVersion);
            if (lpLineDevCaps)
            {
                if ((lpLineDevCaps -> dwLineNameSize) &&
                    (lpLineDevCaps -> dwLineNameOffset) &&
                    (lpLineDevCaps -> dwStringFormat == STRINGFORMAT_ASCII))
                {
                    // This is the name of the device.
                    lpszLineName = ((char *) lpLineDevCaps) +
                        lpLineDevCaps -> dwLineNameOffset;

                    if (lpszLineName[0] != '\0')
                    {
        // Reverse indented to make this fit

        // Make sure the device name is null terminated.
        if (lpszLineName[lpLineDevCaps->dwLineNameSize -1] != '\0')
        {
            // If the device name is not null terminated, null
            // terminate it.  Yes, this looses the end character.
            // Its a bug in the service provider.
            lpszLineName[lpLineDevCaps->dwLineNameSize-1] = '\0';
            OutputDebugPrintf(
                "Device name for device 0x%lx is not null terminated.\n",
                dwDeviceID);
        }
                    }
                    else // Line name started with a NULL.
                        lpszLineName = szLineNameEmpty;
                }
                else  // DevCaps doesn't have a valid line name.  Unnamed.
                    lpszLineName = szLineUnnamed;
            }
            else  // Couldn't GetDevCaps.  Line is unavail.
                lpszLineName = szLineUnavail;
        }
        else  // Couldn't NegotiateAPIVersion.  Line is unavail.
            lpszLineName = szLineUnavail;

        // Put the device name into the control
        lReturn = (long)SendDlgItemMessage(hwndDlg, IDC_TAPILINE,
            CB_ADDSTRING, 0, (LPARAM) (LPCTSTR) lpszLineName);

        // If this line is usable and we don't have a default initial
        // line yet, make this the initial line.
        if ((lpszLineName != szLineUnavail) &&
            (dwDefaultDevice == MAXDWORD) &&
            (VerifyUsableLine(dwDeviceID) == SUCCESS))
        {
            dwDefaultDevice = dwDeviceID;
        }
    }

    if (lpLineDevCaps)
        LocalFree(lpLineDevCaps);

    if (dwDefaultDevice == MAXDWORD)
        dwDefaultDevice = 0;

    // Set the initial default line
    SendDlgItemMessage(hwndDlg, IDC_TAPILINE,
        CB_SETCURSEL, dwDefaultDevice, 0);
}

BOOL GetAddressToDial ( )

Definition at line 4286 of file TapiCode.c.

{
    BOOL bRet;

    UpdateStatusBar("Getting Number to Dial",1,0);
    bRet = (BOOL)DialogBoxParam(hInst, "DialDialog", g_hDlgParentWindow,
        DialDialogProc, 0);
    g_hDialog = NULL;
    g_hDlgParentWindow = g_hWndMainWindow;

    if (bRet == FALSE)
        UpdateStatusBar("Dial aborted",1,0);

    return bRet;
}

BOOL HandleIniFileCorrupt ( )

Definition at line 2777 of file TapiCode.c.

{
    if (IDCANCEL == MessageBox(g_hDlgParentWindow,
        "Configuration information relating to Telephony "
        "services appears to be corrupt.\n"
        "This could be the first time you have used the Telephony services.\n"
        "Would you like to configure the Telephony services?",
        "Warning",MB_OKCANCEL))
    {
        return FALSE;
    }

    lineTranslateDialog(g_hLineApp, 0, SAMPLE_TAPI_VERSION,
        g_hDlgParentWindow, NULL);

    return TRUE;
}

BOOL HandleLineErr ( long lLineErr )

Definition at line 2715 of file TapiCode.c.

{
    // lLineErr is really an async request ID, not an error.
    if (lLineErr > SUCCESS)
        return FALSE;

    // All we do is dispatch the correct error handler.
    switch(lLineErr)
    {
        case SUCCESS:
            return TRUE;

        case LINEERR_INVALCARD:
        case LINEERR_INVALLOCATION:
        case LINEERR_INIFILECORRUPT:
            return HandleIniFileCorrupt();

        case LINEERR_NODRIVER:
            return HandleNoDriver();

        case LINEERR_REINIT:
            return HandleReInit();

        case LINEERR_NOMULTIPLEINSTANCE:
            return HandleNoMultipleInstance();

        case LINEERR_NOMEM:
            return HandleNoMem();

        case LINEERR_OPERATIONFAILED:
            return HandleOperationFailed();

        case LINEERR_RESOURCEUNAVAIL:
            return HandleResourceUnavail();

        // Unhandled errors fail.
        default:
            return FALSE;
    }
}

BOOL HandleNoDevicesInstalled ( )

Definition at line 2978 of file TapiCode.c.

{
    int mbRet;
    mbRet = MessageBox(g_hDlgParentWindow,
       "There are no devices configured for Telephony use.\n"
       "Would you like to run the Modem Control Panel to add a modem driver?",
       "Warning",MB_YESNO);

    if (mbRet == IDYES)
    {
        if (LaunchModemControlPanelAdd())
            return TRUE;
    }

    return FALSE;
}

BOOL HandleNoDriver ( )

Definition at line 2812 of file TapiCode.c.

{
    int mbRet;
    mbRet = MessageBox(g_hDlgParentWindow,
        "One of the components of the Telephony device driver is missing.\n"
            "Use the Control Panel to set up the driver properly.",
        "Warning",MB_OK);

    return FALSE;
}

BOOL HandleNoMem ( )

Definition at line 2891 of file TapiCode.c.

{
    MessageBox(g_hDlgParentWindow,
        "Out of Memory error, canceling action.","Error", MB_OK);
    return FALSE;
}

BOOL HandleNoMultipleInstance ( )

Definition at line 2840 of file TapiCode.c.

{
    MessageBox(g_hDlgParentWindow,
        "You have two copies of the same Telephony driver installed.\n"
            "Use the Control Panel to remove one of the copies.",
        "Warning",MB_OK);

    return FALSE;
}

BOOL HandleOperationFailed ( )

Definition at line 2915 of file TapiCode.c.

{
    MessageBox(g_hDlgParentWindow,
        "TAPI Operation Failed for unknown reasons.",
        "Error", MB_OK);
    return FALSE;
}

BOOL HandleReInit ( )

Definition at line 2867 of file TapiCode.c.

{
    ShutdownTAPI();
    return FALSE;
}

BOOL HandleResourceUnavail ( )

Definition at line 2940 of file TapiCode.c.

{
    int mbRet;

    mbRet = MessageBox(g_hDlgParentWindow,
        "A Telephony resource is temporarily unavaiable.  "
        "This could mean a short wait is necessary or "
        "that a non-TAPI application is using the line.",
        "Warning",MB_RETRYCANCEL);

    if (mbRet == IDRETRY)
        return TRUE;

    return FALSE;
}

BOOL HangupCall ( )

Definition at line 519 of file TapiCode.c.

{
    LPLINECALLSTATUS pLineCallStatus = NULL;
    long lReturn;

    // Prevent HangupCall re-entrancy problems.
    if (g_bStoppingCall)
        return TRUE;

    // if the 'Call' dialog is up, dismiss it.
    if (g_hDialog)
        PostMessage(g_hDialog, WM_COMMAND, IDCANCEL, 0);

    // If Tapi is not being used right now, then the call is hung up.
    if (!g_bTapiInUse)
        return TRUE;

    g_bStoppingCall = TRUE;
    OutputDebugString("Stopping Call in progress\n");

    // Disable the 'hangup call' user interface.
    EnableHangupCall(g_hWndMainWindow, FALSE);

    // Stop any data communications on the comm port.
    StopComm();

    // If there is a call in progress, drop and deallocate it.
    if (g_hCall)
    {
        // I_lineGetCallStatus returns a LocalAlloc()d buffer
        pLineCallStatus = I_lineGetCallStatus(pLineCallStatus, g_hCall);
        if (pLineCallStatus == NULL)
        {
            ShutdownTAPI();
            g_bStoppingCall = FALSE;
            return FALSE;
        }

        // Only drop the call when the line is not IDLE.
        if (!((pLineCallStatus -> dwCallState) & LINECALLSTATE_IDLE))
        {
            do
            {
                lReturn = WaitForReply(lineDrop(g_hCall, NULL, 0));

                if (lReturn == WAITERR_WAITTIMEDOUT)
                {
                    OutputDebugString("Call timed out in WaitForReply.\n");
                    break;
                }

                if (lReturn == WAITERR_WAITABORTED)
                {
                    OutputDebugString("lineDrop: WAITERR_WAITABORTED.\n");
                    break;
                }

                // Was the call already in IDLE?
                if (lReturn == LINEERR_INVALCALLSTATE)
                    break;

                if (HandleLineErr(lReturn))
                    continue;
                else
                {
                    OutputDebugLineError(lReturn,
                        "lineDrop unhandled error: ");
                    break;
                }
            }
            while(lReturn != SUCCESS);

            // Wait for the dropped call to go IDLE before continuing.
            lReturn = WaitForCallState(LINECALLSTATE_IDLE);

            if (lReturn == WAITERR_WAITTIMEDOUT)
                OutputDebugString("Call timed out waiting for IDLE state.\n");

            if (lReturn == WAITERR_WAITABORTED)
                OutputDebugString(
                    "WAITERR_WAITABORTED while waiting for IDLE state.\n");

            OutputDebugString("Call Dropped.\n");
        }

        // The call is now idle.  Deallocate it!
        do
        {
            lReturn = lineDeallocateCall(g_hCall);
            if (HandleLineErr(lReturn))
                continue;
            else
            {
                OutputDebugLineError(lReturn,
                    "lineDeallocateCall unhandled error: ");
                break;
            }
        }
        while(lReturn != SUCCESS);

        OutputDebugString("Call Deallocated.\n");
    }

    // if we have a line open, close it.
    if (g_hLine)
    {
        do
        {
            lReturn = lineClose(g_hLine);
            if (HandleLineErr(lReturn))
                continue;
            else
            {
                OutputDebugLineError(lReturn,
                    "lineClose unhandled error: ");
                break;
            }
        }
        while(lReturn != SUCCESS);

        OutputDebugString("Line Closed.\n");
    }

    // Call and Line are taken care of.  Finish cleaning up.

    // If there is device configuration information, free the memory.
    if (g_lpDeviceConfig)
        LocalFree(g_lpDeviceConfig);
    g_lpDeviceConfig = NULL;

    g_hCall = (HCALL)((ULONG_PTR)NULL);
    g_hLine = (HLINE)((ULONG_PTR)NULL);
    g_bConnected = FALSE;

    g_bTapiInUse = FALSE;
    g_bStoppingCall = FALSE; // allow HangupCall to be called again.
    OutputDebugString("Call stopped\n");

    // Update the user interface.
    UpdateStatusBar("Ready to make a call.",1,0);
    EnableMakeCall(g_hWndMainWindow, TRUE);

    // Need to free LocalAlloc()d buffer returned from I_lineGetCallStatus
    if (pLineCallStatus)
        LocalFree(pLineCallStatus);

    return TRUE;
}

LPLINEADDRESSCAPS I_lineGetAddressCaps | ( | LPLINEADDRESSCAPS | lpLineAddressCaps,
 |  | DWORD | dwDeviceID,
 |  | DWORD | dwAddressID,
 |  | DWORD | dwAPIVersion,
 |  | DWORD | dwExtVersion
 | ) |  |

Definition at line 2629 of file TapiCode.c.

{
    size_t sizeofLineAddressCaps = sizeof(LINEADDRESSCAPS) + 1024;
    long lReturn;

    // Continue this loop until the structure is big enough.
    while(TRUE)
    {
        // Make sure the buffer exists, is valid and big enough.
        lpLineAddressCaps =
            (LPLINEADDRESSCAPS) CheckAndReAllocBuffer(
                (LPVOID) lpLineAddressCaps,
                sizeofLineAddressCaps,
                "lineGetAddressCaps");

        if (lpLineAddressCaps == NULL)
            return NULL;

        // Make the call to fill the structure.
        do
        {
            lReturn =
                lineGetAddressCaps(g_hLineApp,
                    dwDeviceID, dwAddressID, dwAPIVersion, dwExtVersion,
                    lpLineAddressCaps);

            if (HandleLineErr(lReturn))
                continue;
            else
            {
                OutputDebugLineError(lReturn,
                    "lineGetAddressCaps unhandled error: ");
                LocalFree(lpLineAddressCaps);
                return NULL;
            }
        }
        while (lReturn != SUCCESS);

        // If the buffer was big enough, then succeed.
        if ((lpLineAddressCaps -> dwNeededSize) <=
            (lpLineAddressCaps -> dwTotalSize))
        {
            return lpLineAddressCaps;
        }

        // Buffer wasn't big enough.  Make it bigger and try again.
        sizeofLineAddressCaps = lpLineAddressCaps -> dwNeededSize;
    }
}

LPLINEADDRESSSTATUS I_lineGetAddressStatus | ( | LPLINEADDRESSSTATUS | lpLineAddressStatus,
 |  | HLINE | hLine,
 |  | DWORD | dwAddressID
 | ) |  |

Definition at line 2360 of file TapiCode.c.

{
    size_t sizeofLineAddressStatus = sizeof(LINEADDRESSSTATUS) + 1024;
    long lReturn;

    // Continue this loop until the structure is big enough.
    while(TRUE)
    {
        // Make sure the buffer exists, is valid and big enough.
        lpLineAddressStatus =
            (LPLINEADDRESSSTATUS) CheckAndReAllocBuffer(
                (LPVOID) lpLineAddressStatus,
                sizeofLineAddressStatus,
                "lineGetAddressStatus");

        if (lpLineAddressStatus == NULL)
            return NULL;

        // Make the call to fill the structure.
        do
        {
            lReturn =
                lineGetAddressStatus(hLine, dwAddressID, lpLineAddressStatus);

            if (HandleLineErr(lReturn))
                continue;
            else
            {
                OutputDebugLineError(lReturn,
                    "lineGetAddressStatus unhandled error: ");
                LocalFree(lpLineAddressStatus);
                return NULL;
            }
        }
        while (lReturn != SUCCESS);

        // If the buffer was big enough, then succeed.
        if ((lpLineAddressStatus -> dwNeededSize) <=
            (lpLineAddressStatus -> dwTotalSize))
        {
            return lpLineAddressStatus;
        }

        // Buffer wasn't big enough.  Make it bigger and try again.
        sizeofLineAddressStatus = lpLineAddressStatus -> dwNeededSize;
    }
}

LPLINECALLSTATUS I_lineGetCallStatus | ( | LPLINECALLSTATUS | lpLineCallStatus,
 |  | HCALL | hCall
 | ) |  |

Definition at line 2444 of file TapiCode.c.

{
    size_t sizeofLineCallStatus = sizeof(LINECALLSTATUS) + 1024;
    long lReturn;

    // Continue this loop until the structure is big enough.
    while(TRUE)
    {
        // Make sure the buffer exists, is valid and big enough.
        lpLineCallStatus =
            (LPLINECALLSTATUS) CheckAndReAllocBuffer(
                (LPVOID) lpLineCallStatus,
                sizeofLineCallStatus,
                "lineGetCallStatus");

        if (lpLineCallStatus == NULL)
            return NULL;

        // Make the call to fill the structure.
        do
        {
            lReturn =
                lineGetCallStatus(hCall, lpLineCallStatus);

            if (HandleLineErr(lReturn))
                continue;
            else
            {
                OutputDebugLineError(lReturn,
                    "lineGetCallStatus unhandled error: ");
                LocalFree(lpLineCallStatus);
                return NULL;
            }
        }
        while (lReturn != SUCCESS);

        // If the buffer was big enough, then succeed.
        if ((lpLineCallStatus -> dwNeededSize) <=
            (lpLineCallStatus -> dwTotalSize))
        {
            return lpLineCallStatus;
        }

        // Buffer wasn't big enough.  Make it bigger and try again.
        sizeofLineCallStatus = lpLineCallStatus -> dwNeededSize;
    }
}

LPLINEDEVCAPS I_lineGetDevCaps | ( | LPLINEDEVCAPS | lpLineDevCaps,
 |  | DWORD | dwDeviceID,
 |  | DWORD | dwAPIVersion
 | ) |  |

Definition at line 2275 of file TapiCode.c.

{
    size_t sizeofLineDevCaps = sizeof(LINEDEVCAPS) + 1024;
    long lReturn;

    // Continue this loop until the structure is big enough.
    while(TRUE)
    {
        // Make sure the buffer exists, is valid and big enough.
        lpLineDevCaps =
            (LPLINEDEVCAPS) CheckAndReAllocBuffer(
                (LPVOID) lpLineDevCaps, // Pointer to existing buffer, if any
                sizeofLineDevCaps,      // Minimum size the buffer should be
                "lineGetDevCaps");      // Phrase to tag errors, if any.

        if (lpLineDevCaps == NULL)
            return NULL;

        // Make the call to fill the structure.
        do
        {
            lReturn =
                lineGetDevCaps(g_hLineApp,
                    dwDeviceID, dwAPIVersion, 0, lpLineDevCaps);

            if (HandleLineErr(lReturn))
                continue;
            else
            {
                OutputDebugLineError(lReturn,
                    "lineGetDevCaps unhandled error: ");
                LocalFree(lpLineDevCaps);
                return NULL;
            }
        }
        while (lReturn != SUCCESS);

        // If the buffer was big enough, then succeed.
        if ((lpLineDevCaps -> dwNeededSize) <= (lpLineDevCaps -> dwTotalSize))
            return lpLineDevCaps;

        // Buffer wasn't big enough.  Make it bigger and try again.
        sizeofLineDevCaps = lpLineDevCaps -> dwNeededSize;
    }
}

DWORD I_lineNegotiateAPIVersion ( DWORD dwDeviceID )

Definition at line 2207 of file TapiCode.c.

{
    LINEEXTENSIONID LineExtensionID;
    long lReturn;
    DWORD dwLocalAPIVersion;

    do
    {
        lReturn = lineNegotiateAPIVersion(g_hLineApp, dwDeviceID,
            SAMPLE_TAPI_VERSION, SAMPLE_TAPI_VERSION,
            &dwLocalAPIVersion, &LineExtensionID);

        if (lReturn == LINEERR_INCOMPATIBLEAPIVERSION)
        {
            OutputDebugString(
                "lineNegotiateAPIVersion, INCOMPATIBLEAPIVERSION.\n");
            return 0;
        }

        if (HandleLineErr(lReturn))
            continue;
        else
        {
            OutputDebugLineError(lReturn,
                "lineNegotiateAPIVersion unhandled error: ");
            return 0;
        }
    }
    while(lReturn != SUCCESS);

    return dwLocalAPIVersion;
}

DWORD I_lineNegotiateLegacyAPIVersion ( DWORD dwDeviceID )

Definition at line 3144 of file TapiCode.c.

{
    LINEEXTENSIONID LineExtensionID;
    long lReturn;
    DWORD dwLocalAPIVersion;

    do
    {
        lReturn = lineNegotiateAPIVersion(g_hLineApp, dwDeviceID,
            0x00010003, SAMPLE_TAPI_VERSION,
            &dwLocalAPIVersion, &LineExtensionID);

        if (lReturn == LINEERR_INCOMPATIBLEAPIVERSION)
        {
            OutputDebugString("INCOMPATIBLEAPIVERSION in Dial Dialog.\n");
            return 0;
        }

        if (HandleLineErr(lReturn))
            continue;
        else
        {
            OutputDebugLineError(lReturn,
                "lineNegotiateAPIVersion in Dial Dialog unhandled error: ");
            return 0;
        }
    }
    while(lReturn != SUCCESS);

    return dwLocalAPIVersion;
}

LPLINETRANSLATEOUTPUT I_lineTranslateAddress | ( | LPLINETRANSLATEOUTPUT | lpLineTranslateOutput,
 |  | DWORD | dwDeviceID,
 |  | DWORD | dwAPIVersion,
 |  | LPCSTR | lpszDialAddress
 | ) |  |

Definition at line 2531 of file TapiCode.c.

{
    size_t sizeofLineTranslateOutput = sizeof(LINETRANSLATEOUTPUT) + 1024;
    long lReturn;

    // Continue this loop until the structure is big enough.
    while(TRUE)
    {
        // Make sure the buffer exists, is valid and big enough.
        lpLineTranslateOutput =
            (LPLINETRANSLATEOUTPUT) CheckAndReAllocBuffer(
                (LPVOID) lpLineTranslateOutput,
                sizeofLineTranslateOutput,
                "lineTranslateOutput");

        if (lpLineTranslateOutput == NULL)
            return NULL;

        // Make the call to fill the structure.
        do
        {
            // Note that CALLWAITING is disabled
            // (assuming the service provider can disable it)
            lReturn =
                lineTranslateAddress(g_hLineApp, dwDeviceID, dwAPIVersion,
                    lpszDialAddress, 0,
                    LINETRANSLATEOPTION_CANCELCALLWAITING,
                    lpLineTranslateOutput);

            // If the address isn't translatable, notify the user.
            if (lReturn == LINEERR_INVALADDRESS)
                MessageBox(g_hDlgParentWindow,
                    "Unable to translate phone number","Warning",MB_OK);

            if (HandleLineErr(lReturn))
                continue;
            else
            {
                OutputDebugLineError(lReturn,
                    "lineTranslateOutput unhandled error: ");
                LocalFree(lpLineTranslateOutput);
                return NULL;
            }
        }
        while (lReturn != SUCCESS);

        // If the buffer was big enough, then succeed.
        if ((lpLineTranslateOutput -> dwNeededSize) <=
            (lpLineTranslateOutput -> dwTotalSize))
        {
            return lpLineTranslateOutput;
        }

        // Buffer wasn't big enough.  Make it bigger and try again.
        sizeofLineTranslateOutput = lpLineTranslateOutput -> dwNeededSize;
    }
}

BOOL InitializeTAPI ( HWND hWndParent )

Definition at line 333 of file TapiCode.c.

{
    long lReturn;
    BOOL bTryReInit = TRUE;

    // If we're already initialized, then initialization succeeds.
    if (g_hLineApp)
        return TRUE;

    // If we're in the middle of initializing, then fail, we're not done.
    if (g_bInitializing)
        return FALSE;

    g_bInitializing = TRUE;

    // Initialize TAPI
    do
    {
        lReturn = lineInitialize(&g_hLineApp, hInst,
            (LINECALLBACK) lineCallbackFunc, (LPCSTR)"TapiComm", (LPDWORD)&g_dwNumDevs);

        // If we get this error, its because some other app has yet
        // to respond to the REINIT message.  Wait 5 seconds and try
        // again.  If it still doesn't respond, tell the user.
        if (lReturn == LINEERR_REINIT)
        {
            if (bTryReInit)
            {
                MSG msg;
                DWORD dwTimeStarted;

                dwTimeStarted = GetTickCount();

                while(GetTickCount() - dwTimeStarted < 5000)
                {
                    if (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
                    {
                        TranslateMessage(&msg);
                        DispatchMessage(&msg);
                    }
                }

                bTryReInit = FALSE;
                continue;
            }
            else
            {
                MessageBox(g_hDlgParentWindow,
                    "A change to the system configuration requires that "
                    "all Telephony applications relinquish their use of "
                    "Telephony before any can progress.  "
                    "Some have not yet done so."
                    ,"Warning",MB_OK);
                g_bInitializing = FALSE;
                return FALSE;
            }
        }

        if (lReturn == LINEERR_NODEVICE)
        {
            if (HandleNoDevicesInstalled())
                continue;
            else
            {
                OutputDebugString("No devices installed.\n");
                g_bInitializing = FALSE;
                return FALSE;
            }
        }

        if (HandleLineErr(lReturn))
            continue;
        else
        {
            OutputDebugLineError(lReturn,
                "lineInitialize unhandled error: ");
            g_bInitializing = FALSE;
            return FALSE;
        }
    }
    while(lReturn != SUCCESS);

    // if hWndParent is a valid hWnd, we keep it as the parent for
    // all dialogs.
    if (IsWindow(hWndParent))
    {
        g_hDlgParentWindow = g_hWndMainWindow = hWndParent;
    }
    else
    {
        // Has the old g_hWndMainWindow gone away?
        if (!IsWindow(g_hWndMainWindow))
        {
            OutputDebugString("Main window unavailable.\n");
            g_hDlgParentWindow = g_hWndMainWindow = NULL;
        }
    }

    g_hCall = (HCALL)((ULONG_PTR)NULL);
    g_hLine = (HLINE)((ULONG_PTR)NULL);

    OutputDebugString("Tapi initialized.\n");
    g_bInitializing = FALSE;
    return TRUE;
}

BOOL LaunchModemControlPanelAdd ( )

Definition at line 3012 of file TapiCode.c.

{
    PROCESS_INFORMATION piProcInfo;
    STARTUPINFO siStartupInfo;

    siStartupInfo.cb = sizeof(STARTUPINFO);
    siStartupInfo.lpReserved = NULL;
    siStartupInfo.lpDesktop = NULL;
    siStartupInfo.lpTitle = NULL;
    siStartupInfo.dwFlags = STARTF_USESHOWWINDOW;
    siStartupInfo.wShowWindow = SW_SHOWNORMAL;
    siStartupInfo.cbReserved2 = 0;
    siStartupInfo.lpReserved2 = NULL;

    // The string to launch the modem control panel is *VERY* likely
    // to change on NT.  If nothing else, this is 'contrl32' on NT
    // instead of 'control'.
    if (CreateProcess(
            NULL,
            "CONTROL.EXE MODEM.CPL,,ADD",
            NULL, NULL, FALSE,
            NORMAL_PRIORITY_CLASS,
            NULL, NULL,
            &siStartupInfo,
            &piProcInfo))
    {
        CloseHandle(piProcInfo.hThread);

        // Control panel 'Add New Modem' has been launched.  Now we should
        // wait for it to go away before continueing.

        // If we WaitForSingleObject for the control panel to exit, then we
        // get into a deadlock situation if we need to respond to any messages
        // from the control panel.

        // If we use a PeekMessage loop to wait, we run into
        // message re-entrancy problems.  (The user can get back to our UI
        // and click 'dial' again).

        // Instead, we take the easy way out and return FALSE to abort
        // the current operation.

        CloseHandle(piProcInfo.hProcess);
    }
    else
    {
        OutputDebugLastError(GetLastError(),
            "Unable to LaunchModemControlPanelAdd: ");
        MessageBox(g_hDlgParentWindow,
            "Unable to launch the Modem Control Panel",
            "Warning", MB_OK);
    }

    return FALSE;
}

void CALLBACK lineCallbackFunc | ( | DWORD | hDevice,
 |  | DWORD | dwMsg,
 |  | DWORD | dwCallbackInstance,
 |  | DWORD | dwParam1,
 |  | DWORD | dwParam2,
 |  | DWORD | dwParam3
 | ) |  |

Definition at line 1522 of file TapiCode.c.

{

    OutputDebugLineCallback(
        dwDevice, dwMsg, dwCallbackInstance,
        dwParam1, dwParam2, dwParam3);

    // All we do is dispatch the dwMsg to the correct handler.
    switch(dwMsg)
    {
        case LINE_CALLSTATE:
            DoLineCallState(dwDevice, dwMsg, dwCallbackInstance,
                dwParam1, dwParam2, dwParam3);
            break;

        case LINE_CLOSE:
            DoLineClose(dwDevice, dwMsg, dwCallbackInstance,
                dwParam1, dwParam2, dwParam3);
            break;

        case LINE_LINEDEVSTATE:
            DoLineDevState(dwDevice, dwMsg, dwCallbackInstance,
                dwParam1, dwParam2, dwParam3);
            break;

        case LINE_REPLY:
            DoLineReply(dwDevice, dwMsg, dwCallbackInstance,
                dwParam1, dwParam2, dwParam3);
            break;

        case LINE_CREATE:
            DoLineCreate(dwDevice, dwMsg, dwCallbackInstance,
                dwParam1, dwParam2, dwParam3);
            break;

        default:
            OutputDebugString("lineCallbackFunc message ignored\n");
            break;

    }

    return;

}

void PostHangupCall ( )

Definition at line 691 of file TapiCode.c.

{
    PostMessage(g_hWndMainWindow, WM_COMMAND, IDM_HANGUPCALL, 0);
}

void PreConfigureDevice | ( | HWND | hwndDlg,
 |  | DWORD | dwDeviceID
 | ) |  |

Definition at line 4138 of file TapiCode.c.

{
    long lReturn;
    LPVARSTRING lpVarString = NULL;
    DWORD dwSizeofVarString = sizeof(VARSTRING);

    // If there isn't already any device configuration information,
    // then we need to get some.
    if (g_lpDeviceConfig == NULL)
    {
        do
        {
            lpVarString = (LPVARSTRING) CheckAndReAllocBuffer(
                (LPVOID) lpVarString, dwSizeofVarString,
                "PreConfigureDevice - lineGetDevConfig: ");

            if (lpVarString == NULL)
                return;

            lReturn = lineGetDevConfig(dwDeviceID, lpVarString,
                "comm/datamodem");

            if (HandleLineErr(lReturn))
                ;
            else
            {
                OutputDebugLineError(lReturn,
                    "lineGetDevCaps unhandled error: ");
                LocalFree(lpVarString);
                return;
            }

            if ((lpVarString -> dwNeededSize) > (lpVarString -> dwTotalSize))
            {
                dwSizeofVarString = lpVarString -> dwNeededSize;
                lReturn = -1; // Lets loop again.
            }
        }
        while (lReturn != SUCCESS);

        g_dwSizeDeviceConfig = lpVarString -> dwStringSize;

        // The extra byte allocated is in case dwStringSize is 0.
        g_lpDeviceConfig = CheckAndReAllocBuffer(
                g_lpDeviceConfig, g_dwSizeDeviceConfig+1,
                "PreConfigureDevice - Allocate device config: ");

        if (!g_lpDeviceConfig)
        {
            LocalFree(lpVarString);
            return;
        }

        memcpy(g_lpDeviceConfig,
            ((LPBYTE) lpVarString + lpVarString -> dwStringOffset),
            g_dwSizeDeviceConfig);
    }

    // Next make the lineConfigDialogEdit call.

    // Note that we determine the initial size of the VARSTRING
    // structure based on the known size of the existing configuration
    // information.  I make the assumption that this configuration
    // information is very unlikely to grow by more than 5K or by
    // more than 5 times.  This is a *very* conservative number.
    // We do *not* want lineConfigDialogEdit to fail just because there
    // wasn't enough room to stored the data.  This would require the user
    // to go through configuration again and that would be annoying.

    dwSizeofVarString = 5 * g_dwSizeDeviceConfig + 5000;

    do
    {
        lpVarString = (LPVARSTRING) CheckAndReAllocBuffer(
            (LPVOID) lpVarString, dwSizeofVarString,
            "PreConfigureDevice - lineConfigDialogEdit: ");

        if (lpVarString == NULL)
            return;

        lReturn = lineConfigDialogEdit(dwDeviceID, hwndDlg, "comm/datamodem",
            g_lpDeviceConfig, g_dwSizeDeviceConfig, lpVarString);

        if (HandleLineErr(lReturn))
            ;
        else
        {
            OutputDebugLineError(lReturn,
                "lineConfigDialogEdit unhandled error: ");
            LocalFree(lpVarString);
            return;
        }

        if ((lpVarString -> dwNeededSize) > (lpVarString -> dwTotalSize))
        {
            // We had been conservative about making sure the structure was
            // big enough.  Unfortunately, not conservative enough.  Hopefully,
            // this will not happen a second time because we are *DOUBLING*
            // the NeededSize.
            MessageBox(hwndDlg,
                "Internal Error: Unable to set line configuration.\n"
                "Please try again.",
                "Oops", MB_OK);
            dwSizeofVarString = (lpVarString -> dwNeededSize) * 2;
            lReturn = -1; // Lets loop again.
        }
    }
    while (lReturn != SUCCESS);

    // Store the configuration information into a global structure
    // so it can be set at a later time.
    g_dwSizeDeviceConfig = lpVarString -> dwStringSize;
    g_lpDeviceConfig = CheckAndReAllocBuffer(
            g_lpDeviceConfig, g_dwSizeDeviceConfig+1,
            "PreConfigureDevice - Reallocate device config: ");

    if (!g_lpDeviceConfig)
    {
        LocalFree(lpVarString);
        return;
    }

    memcpy(g_lpDeviceConfig,
        ((LPBYTE) lpVarString + lpVarString -> dwStringOffset),
        g_dwSizeDeviceConfig);

    LocalFree(lpVarString);
}

BOOL ShutdownTAPI ( )

Definition at line 459 of file TapiCode.c.

{
    long lReturn;

    // If we aren't initialized, then Shutdown is unnecessary.
    if (g_hLineApp == (HLINE)((ULONG_PTR)NULL))
        return TRUE;

    // Prevent ShutdownTAPI re-entrancy problems.
    if (g_bShuttingDown)
        return TRUE;

    g_bShuttingDown = TRUE;

    HangupCall();

    do
    {
        lReturn = lineShutdown(g_hLineApp);
        if (HandleLineErr(lReturn))
            continue;
        else
        {
            OutputDebugLineError(lReturn, "lineShutdown unhandled error: ");
            break;
        }
    }
    while(lReturn != SUCCESS);

    g_bTapiInUse = FALSE;
    g_bConnected = FALSE;
    g_hLineApp = (HLINE)((ULONG_PTR)NULL);
    g_hCall = (HCALL)((ULONG_PTR)NULL);
    g_hLine = (HLINE)((ULONG_PTR)NULL);
    g_bShuttingDown = FALSE;
    OutputDebugString("TAPI uninitialized.\n");
    return TRUE;
}

void UseDialingRules ( HWND hwndDlg )

Definition at line 3924 of file TapiCode.c.

{
    HWND hControl;
    BOOL bEnableWindow;

    bEnableWindow = (BOOL)SendDlgItemMessage(hwndDlg,
        IDC_USEDIALINGRULES, BM_GETCHECK, 0, 0);

    hControl = GetDlgItem(hwndDlg, IDC_STATICCOUNTRYCODE);
    EnableWindow(hControl, bEnableWindow);

    hControl = GetDlgItem(hwndDlg, IDC_COUNTRYCODE);
    EnableWindow(hControl, bEnableWindow);

    hControl = GetDlgItem(hwndDlg, IDC_STATICAREACODE);
    EnableWindow(hControl, bEnableWindow);

    hControl = GetDlgItem(hwndDlg, IDC_AREACODE);
    EnableWindow(hControl, bEnableWindow);

    hControl = GetDlgItem(hwndDlg, IDC_STATICLOCATION);
    EnableWindow(hControl, bEnableWindow);

    hControl = GetDlgItem(hwndDlg, IDC_LOCATION);
    EnableWindow(hControl, bEnableWindow);

    hControl = GetDlgItem(hwndDlg, IDC_STATICCALLINGCARD);
    EnableWindow(hControl, bEnableWindow);

    hControl = GetDlgItem(hwndDlg, IDC_CALLINGCARD);
    EnableWindow(hControl, bEnableWindow);

    if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CONFIGURELINE)))
    {
        hControl = GetDlgItem(hwndDlg, IDC_DIALINGPROPERTIES);
        EnableWindow(hControl, bEnableWindow);
    }
}

BOOL VerifyAndWarnUsableLine ( HWND hwndDlg )

Definition at line 3493 of file TapiCode.c.

{
    DWORD dwDeviceID;
    long lReturn;
    HICON hIcon = 0;
    HWND hControlWnd;

    // Get the selected line device.
    dwDeviceID = (DWORD)SendDlgItemMessage(hwndDlg, IDC_TAPILINE,
                        CB_GETCURSEL, 0, 0);

    // Get the "comm" device icon associated with this line device.
    lReturn = lineGetIcon(dwDeviceID, "comm", &hIcon);

    if (lReturn == SUCCESS)
        SendDlgItemMessage(hwndDlg, IDC_LINEICON, STM_SETICON,
            (WPARAM) hIcon, 0);
    else
        // Any failure to get an icon makes us use the default icon.
        SendDlgItemMessage(hwndDlg, IDC_LINEICON, WM_SETTEXT,
            0, (LPARAM) (LPCTSTR) "TapiComm");

/*  // It turns out that TAPI will always return an icon, even if
    // the device class isn't supported by the TSP or even if the TSP
    // doesn't return any icons at all.  This code is unnecessary.
    // The only reason lineGetIcon would fail is due to resource problems.

    else
    {
        // If the line doesn't have a "comm" device icon, use its default one.
        lReturn = lineGetIcon(dwDeviceID, NULL, &hIcon);
        if (lReturn == SUCCESS)
        {
            OutputDebugString("Line doesn't support a \"comm\" icon.\n");
            SendDlgItemMessage(hwndDlg, IDC_LINEICON, STM_SETICON,
                (WPARAM) hIcon, 0);
        }
        else
        {
            // If lineGetIcon fails, just use TapiComms icon.
            OutputDebugLineError(lReturn, "lineGetIcon: ");
            SendDlgItemMessage(hwndDlg, IDC_LINEICON, WM_SETTEXT,
                0, (LPARAM) (LPCTSTR) "TapiComm");
        }
    }
*/

    // Verify if the device is usable by TapiComm.
    lReturn = VerifyUsableLine(dwDeviceID);

    // Enable or disable the 'Dial' button, depending on if the line is ok.
    // Make sure there is a number to dial before enabling the button.
    hControlWnd = GetDlgItem(hwndDlg, IDC_DIAL);
    if (SendDlgItemMessage(hwndDlg, IDC_CANONICALNUMBER,
        WM_GETTEXTLENGTH, 0, 0) == 0)
    {
        EnableWindow(hControlWnd, FALSE);
    }
    else
        EnableWindow(hControlWnd, (lReturn == SUCCESS));

    // Any errors on this line prevent us from configuring it
    // or using dialing properties.
    if (lReturn == LINENOTUSEABLE_ERROR)
    {
        EnableWindow(GetDlgItem(hwndDlg, IDC_CONFIGURELINE), FALSE);
        EnableWindow(GetDlgItem(hwndDlg, IDC_DIALINGPROPERTIES), FALSE);
    }
    else
    {
        EnableWindow(GetDlgItem(hwndDlg, IDC_CONFIGURELINE), TRUE);
        if (SendDlgItemMessage(hwndDlg, IDC_USEDIALINGRULES, BM_GETCHECK, 0, 0))
            EnableWindow(GetDlgItem(hwndDlg, IDC_DIALINGPROPERTIES), TRUE);
    }

    switch(lReturn)
    {
        case SUCCESS:
            g_dwDeviceID = dwDeviceID;
            return TRUE;

        case LINENOTUSEABLE_ERROR:
            MessageBox(hwndDlg,
                "The selected line is incompatible with the TapiComm sample",
                "Warning",MB_OK);
            break;
        case LINENOTUSEABLE_NOVOICE:
            MessageBox(hwndDlg,
                "The selected line doesn't support VOICE capabilities",
                "Warning",MB_OK);
            break;
        case LINENOTUSEABLE_NODATAMODEM:
            MessageBox(hwndDlg,
                "The selected line doesn't support DATAMODEM capabilities",
                "Warning",MB_OK);
            break;
        case LINENOTUSEABLE_NOMAKECALL:
            MessageBox(hwndDlg,
                "The selected line doesn't support MAKECALL capabilities",
                "Warning",MB_OK);
            break;
        case LINENOTUSEABLE_ALLOCATED:
            MessageBox(hwndDlg,
                "The selected line is already in use by a non-TAPI application",
                "Warning",MB_OK);
            break;
        case LINENOTUSEABLE_INUSE:
            MessageBox(hwndDlg,
                "The selected line is already in use by a TAPI application",
                "Warning",MB_OK);
            break;

        case LINENOTUSEABLE_NOCOMMDATAMODEM:
            MessageBox(hwndDlg,
                "The selected line doesn't support the COMM/DATAMODEM device class",
                "Warning",MB_OK);
            break;
    }

    // g_dwDeviceID == MAXDWORD mean the selected device isn't usable.
    g_dwDeviceID = MAXDWORD;
    return FALSE;
}

long VerifyUsableLine ( DWORD dwDeviceID )

Definition at line 3196 of file TapiCode.c.

{
    LPLINEDEVCAPS lpLineDevCaps = NULL;
    LPLINEADDRESSSTATUS lpLineAddressStatus = NULL;
    LPVARSTRING lpVarString = NULL;
    DWORD dwAPIVersion;
    long lReturn;
    long lUsableLine = SUCCESS;
    HLINE hLine = 0;

    OutputDebugPrintf("Testing Line ID '0x%lx'",dwDeviceID);

    // The line device must support an API Version that TapiComm does.
    dwAPIVersion = I_lineNegotiateAPIVersion(dwDeviceID);
    if (dwAPIVersion == 0)
        return LINENOTUSEABLE_ERROR;

    lpLineDevCaps = I_lineGetDevCaps(lpLineDevCaps,
        dwDeviceID, dwAPIVersion);

    if (lpLineDevCaps == NULL)
        return LINENOTUSEABLE_ERROR;

    // Must support LINEBEARERMODE_VOICE
    if (!(lpLineDevCaps->dwBearerModes & LINEBEARERMODE_VOICE ))
    {
        lUsableLine = LINENOTUSEABLE_NOVOICE;
        OutputDebugString("LINEBEARERMODE_VOICE not supported\n");
        goto DeleteBuffers;
    }

    // Must support LINEMEDIAMODE_DATAMODEM
    if (!(lpLineDevCaps->dwMediaModes & LINEMEDIAMODE_DATAMODEM))
    {
        lUsableLine = LINENOTUSEABLE_NODATAMODEM;
        OutputDebugString("LINEMEDIAMODE_DATAMODEM not supported\n");
        goto DeleteBuffers;
    }

    // Must be able to make calls
    if (!(lpLineDevCaps->dwLineFeatures & LINEFEATURE_MAKECALL))
    {
        lUsableLine = LINENOTUSEABLE_NOMAKECALL;
        OutputDebugString("LINEFEATURE_MAKECALL not supported\n");
        goto DeleteBuffers;
    }

    // It is necessary to open the line so we can check if
    // there are any call appearances available.  Other TAPI
    // applications could be using all call appearances.
    // Opening the line also checks for other possible problems.
    do
    {
        lReturn = lineOpen(g_hLineApp, dwDeviceID, &hLine,
            dwAPIVersion, 0, 0,
            LINECALLPRIVILEGE_NONE, LINEMEDIAMODE_DATAMODEM,
            0);

        if(lReturn == LINEERR_ALLOCATED)
        {
            OutputDebugString(
                "Line is already in use by a non-TAPI app or"
                " another Service Provider.\n");
            lUsableLine = LINENOTUSEABLE_ALLOCATED;
            goto DeleteBuffers;
        }

        if (HandleLineErr(lReturn))
            continue;
        else
        {
            OutputDebugLineError(lReturn, "lineOpen unhandled error: ");
            lUsableLine = LINENOTUSEABLE_ERROR;
            goto DeleteBuffers;
        }
    }
    while(lReturn != SUCCESS);

    // Get LineAddressStatus to make sure the line isn't already in use.
    lpLineAddressStatus =
        I_lineGetAddressStatus(lpLineAddressStatus, hLine, 0);

    if (lpLineAddressStatus == NULL)
    {
        lUsableLine = LINENOTUSEABLE_ERROR;
        goto DeleteBuffers;
    }

    // Are there any available call appearances (ie: is it in use)?
    if ( !((lpLineAddressStatus -> dwAddressFeatures) &
           LINEADDRFEATURE_MAKECALL) )
    {
        OutputDebugString("LINEADDRFEATURE_MAKECALL not available\n");
        lUsableLine = LINENOTUSEABLE_INUSE;
        goto DeleteBuffers;
    }

    // Make sure the "comm/datamodem" device class is supported
    // Note that we don't want any of the 'extra' information
    // normally returned in the VARSTRING structure.  All we care
    // about is if lineGetID succeeds.
    do
    {
        lpVarString = CheckAndReAllocBuffer((LPVOID) lpVarString,
            sizeof(VARSTRING),"VerifyUsableLine:lineGetID: ");

        if (lpVarString == NULL)
        {
            lUsableLine = LINENOTUSEABLE_ERROR;
            goto DeleteBuffers;
        }

        lReturn = lineGetID(hLine, 0, 0, LINECALLSELECT_LINE,
            lpVarString, "comm/datamodem");

        if (HandleLineErr(lReturn))
            continue;
        else
        {
            OutputDebugLineError(lReturn,
                "lineGetID unhandled error: ");
            lUsableLine = LINENOTUSEABLE_NOCOMMDATAMODEM;
            goto DeleteBuffers;
        }
    }
    while(lReturn != SUCCESS);

    OutputDebugString("Line is suitable and available for use.\n");

  DeleteBuffers:

    if (hLine)
        lineClose(hLine);
    if (lpLineAddressStatus)
        LocalFree(lpLineAddressStatus);
    if (lpLineDevCaps)
        LocalFree(lpLineDevCaps);
    if (lpVarString)
        LocalFree(lpVarString);

    return lUsableLine;
}

long WaitForCallState ( DWORD dwNewCallState )

Definition at line 1436 of file TapiCode.c.

{
    MSG msg;
    DWORD dwTimeStarted;
    static BOOL bReentered;

    bReentered = FALSE;

    dwTimeStarted = GetTickCount();

    g_bCallStateReceived = FALSE;

    while ((dwDesiredCallState == I_LINECALLSTATE_ANY) ||
           (g_dwCallState != dwDesiredCallState))
    {
        if (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }

        // If we are waiting for any call state and get one, succeed.
        if ((dwDesiredCallState == I_LINECALLSTATE_ANY) &&
            g_bCallStateReceived)
        {
            break;
        }

        // This should only occur if the line is shut down while waiting.
        if (!g_bTapiInUse || bReentered)
        {
            bReentered = TRUE;
            OutputDebugString("WAITABORTED\n");
            return WAITERR_WAITABORTED;
        }

        // If we don't get the reply in a reasonable time, we time out.
        if (GetTickCount() - dwTimeStarted > WAITTIMEOUT)
        {
            bReentered = TRUE;
            OutputDebugString("WAITTIMEDOUT\n");
            return WAITERR_WAITTIMEDOUT;
        }

    }

    bReentered = TRUE;
    return SUCCESS;
}

long WaitForReply ( long lRequestID )

Definition at line 1341 of file TapiCode.c.

{
    static BOOL bReentered;
    bReentered = FALSE;

    if (lRequestID > SUCCESS)
    {
        MSG msg;
        DWORD dwTimeStarted;

        g_bReplyRecieved = FALSE;
        g_dwRequestedID = (DWORD) lRequestID;

        // Initializing this just in case there is a bug
        // that sets g_bReplyRecieved without setting the reply value.
        g_lAsyncReply = LINEERR_OPERATIONFAILED;

        dwTimeStarted = GetTickCount();

        while(!g_bReplyRecieved)
        {
            if (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
            {
                TranslateMessage(&msg);
                DispatchMessage(&msg);
            }

            // This should only occur if the line is shut down while waiting.
            if (!g_bTapiInUse || bReentered)
            {
                bReentered = TRUE;
                return WAITERR_WAITABORTED;
            }

            // Its a really bad idea to timeout a wait for a LINE_REPLY.
            // If we are execting a LINE_REPLY, we should wait till we get
            // it; it might take a long time to dial (for example).

            // If 5 seconds go by without a reply, it might be a good idea
            // to display a dialog box to tell the user that a
            // wait is in progress and to give the user the capability to
            // abort the wait.
        }

        bReentered = TRUE;
        return g_lAsyncReply;
    }

    bReentered = TRUE;
    return lRequestID;
}

void WarningBox ( LPCSTR lpszMessage )

Definition at line 3088 of file TapiCode.c.

{
    char szBuff[1024];
  DWORD dwRemainingLength;

    strncpy(szBuff, lpszMessage, 1023);
  szBuff[1023] = '\0';

   dwRemainingLength = 1023 - strlen(szBuff);

    // If there is a call open, tell user we're going to close it.
    if (g_hCall)
        strncat(szBuff, "\nClosing existing call.", dwRemainingLength);

    MessageBox(g_hDlgParentWindow, szBuff, "Warning", MB_OK);
  dwRemainingLength = 1023 - strlen(szBuff);
    strncat(szBuff, "\r\n",dwRemainingLength );
  szBuff[1023] = '\0';
    OutputDebugString(szBuff);
}

Variable Documentation

DWORD g_adwSampleMenuHelpIDs[]

Definition at line 175 of file TapiCode.c.

BOOL g_bCallStateReceived

Definition at line 149 of file TapiCode.c.

BOOL g_bConnected = FALSE

Definition at line 141 of file TapiCode.c.

BOOL g_bInitializing = FALSE

Definition at line 126 of file TapiCode.c.

BOOL g_bReplyRecieved

Definition at line 146 of file TapiCode.c.

BOOL g_bShuttingDown = FALSE

Definition at line 124 of file TapiCode.c.

BOOL g_bStoppingCall = FALSE

Definition at line 125 of file TapiCode.c.

BOOL g_bTapiInUse = FALSE

Definition at line 130 of file TapiCode.c.

DWORD g_dwAPIVersion = 0

Definition at line 137 of file TapiCode.c.

DWORD g_dwCallState = 0

Definition at line 138 of file TapiCode.c.

DWORD g_dwDeviceID = 0

Definition at line 136 of file TapiCode.c.

DWORD g_dwNumDevs = 0

Definition at line 117 of file TapiCode.c.

DWORD g_dwRequestedID

Definition at line 147 of file TapiCode.c.

DWORD g_dwSizeDeviceConfig

Definition at line 143 of file TapiCode.c.

HCALL g_hCall = (HCALL)((ULONG_PTR)NULL)

Definition at line 134 of file TapiCode.c.

HWND g_hDialog = NULL

Definition at line 121 of file TapiCode.c.

HWND g_hDlgParentWindow = NULL

Definition at line 115 of file TapiCode.c.

HLINE g_hLine = (HLINE)((ULONG_PTR)NULL)

Definition at line 135 of file TapiCode.c.

HLINEAPP g_hLineApp = (HLINEAPP)((ULONG_PTR)NULL)

Definition at line 116 of file TapiCode.c.

HWND g_hWndMainWindow = NULL

Definition at line 114 of file TapiCode.c.

long g_lAsyncReply

Definition at line 148 of file TapiCode.c.

LPVOID g_lpDeviceConfig = NULL

Definition at line 142 of file TapiCode.c.

NONDIALTOKENS g_sNonDialable[]
Initial value:
 {
    {LINEERR_DIALBILLING,  LINEDEVCAPFLAGS_DIALBILLING,  "$",
            "Wait for the credit card bong tone" },
    {LINEERR_DIALDIALTONE, LINEDEVCAPFLAGS_DIALDIALTONE, "W",
            "Wait for the second dial tone" },
    {LINEERR_DIALDIALTONE, LINEDEVCAPFLAGS_DIALDIALTONE, "w",
            "Wait for the second dial tone" },
    {LINEERR_DIALQUIET,    LINEDEVCAPFLAGS_DIALQUIET,    "@",
            "Wait for the remote end to answer" },
    {LINEERR_DIALPROMPT,   0,                            "?",
            "Press OK when you are ready to continue dialing"},
}

Definition at line 161 of file TapiCode.c.

char g_szDialableAddress[1024] = ""

Definition at line 140 of file TapiCode.c.

char g_szDisplayableAddress[1024] = ""

Definition at line 139 of file TapiCode.c.

Generated on Wed Nov 13 2024 16:54:11 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi2/TapiComm/TapiCode.h File Reference

  • NetDS
  • Tapi
  • Tapi2
  • TapiComm
Functions

TapiCode.h File Reference

Go to the source code of this file.

Functions

BOOL DialCall ()
BOOL HangupCall ()
BOOL | InitializeTAPI (HWND hParentWnd)
void | PostHangupCall ()
BOOL ShutdownTAPI ()

Function Documentation

BOOL DialCall ( )

Definition at line 716 of file TapiCode.c.

{
    long lReturn;
    LPLINEADDRESSSTATUS lpLineAddressStatus = NULL;
    LPLINEDEVCAPS lpLineDevCaps = NULL;

    if (g_bTapiInUse)
    {
        OutputDebugString("A call is already being handled\n");
        return FALSE;
    }

    // If TAPI isn't initialized, its either because we couldn't initialize
    // at startup (and this might have been corrected by now), or because
    // a REINIT event was received.  In either case, try to init now.

    if (!g_hLineApp)
    {
        if (!InitializeTAPI(NULL))
            return FALSE;
    }

    // If there are no line devices installed on the machine, lets give
    // the user the opportunity to install one.
    if (g_dwNumDevs < 1)
    {
        if (!HandleNoDevicesInstalled())
            return FALSE;
    }

    // We now have a call active.  Prevent future calls.
    g_bTapiInUse = TRUE;
    EnableMakeCall(g_hWndMainWindow, FALSE);

    // Get a phone number from the user.
    // Phone number will be placed in global variables if successful
    if (!GetAddressToDial())
    {
        HangupCall();
        goto DeleteBuffers;
    }

    // Negotiate the API version to use for this device.
    g_dwAPIVersion = I_lineNegotiateAPIVersion(g_dwDeviceID);
    if (g_dwAPIVersion == 0)
    {
        MessageBox(g_hDlgParentWindow,
            "Line Version unsupported by this Sample",
            "Unable to Use Line",MB_OK);
        HangupCall();
        goto DeleteBuffers;
    }

    // Need to check the DevCaps to make sure this line is usable.
    // The 'Dial' dialog checks also, but better safe than sorry.
    lpLineDevCaps = I_lineGetDevCaps(lpLineDevCaps,
        g_dwDeviceID, g_dwAPIVersion);
    if (lpLineDevCaps == NULL)
    {
        HangupCall();
        MessageBox(g_hDlgParentWindow,
            "Error on Requested line",
            "Unable to Use Line",MB_OK);
        goto DeleteBuffers;
    }

    if (!(lpLineDevCaps->dwBearerModes & LINEBEARERMODE_VOICE ))
    {
        HangupCall();
        MessageBox(g_hDlgParentWindow,
            "Error on Requested line",
            "The selected line doesn't support VOICE capabilities",
            MB_OK);
        goto DeleteBuffers;
    }

    if (!(lpLineDevCaps->dwMediaModes & LINEMEDIAMODE_DATAMODEM))
    {
        HangupCall();
        MessageBox(g_hDlgParentWindow,
            "Error on Requested line",
            "The selected line doesn't support DATAMODEM capabilities",
            MB_OK);
        goto DeleteBuffers;
    }

    // Does this line have the capability to make calls?
    // It is possible that some lines can't make outbound calls.
    if (!(lpLineDevCaps->dwLineFeatures & LINEFEATURE_MAKECALL))
    {
        HangupCall();
        MessageBox(g_hDlgParentWindow,
            "Error on Requested line",
            "The selected line doesn't support MAKECALL capabilities",
            MB_OK);
        goto DeleteBuffers;
    }

    // Open the Line for an outgoing DATAMODEM call.
    do
    {
        lReturn = lineOpen(g_hLineApp, g_dwDeviceID, &g_hLine,
            g_dwAPIVersion, 0, 0,
            LINECALLPRIVILEGE_NONE, LINEMEDIAMODE_DATAMODEM,
            0);

        if(lReturn == LINEERR_ALLOCATED)
        {
            HangupCall();
            MessageBox(g_hDlgParentWindow,
                "Line is already in use by a non-TAPI application "
                "or by another TAPI Service Provider.",
                "Unable to Use Line",MB_OK);
            goto DeleteBuffers;
        }

        if (HandleLineErr(lReturn))
            continue;
        else
        {
            OutputDebugLineError(lReturn, "lineOpen unhandled error: ");
            MessageBox(g_hDlgParentWindow,
                "Error on Requested line",
                "Unable to Use Line",MB_OK);
            HangupCall();
            goto DeleteBuffers;
        }
    }
    while(lReturn != SUCCESS);

    // Tell the service provider that we want all notifications that
    // have anything to do with this line.
    do
    {
        // Set the messages we are interested in.

        // Note that while most applications aren't really interested
        // in dealing with all of the possible messages, its interesting
        // to see which come through the callback for testing purposes.

        lReturn = lineSetStatusMessages(g_hLine,
            LINEDEVSTATE_OTHER          |
            LINEDEVSTATE_RINGING        |
            LINEDEVSTATE_CONNECTED      |  // Important state!
            LINEDEVSTATE_DISCONNECTED   |  // Important state!
            LINEDEVSTATE_MSGWAITON      |
            LINEDEVSTATE_MSGWAITOFF     |
            LINEDEVSTATE_INSERVICE      |
            LINEDEVSTATE_OUTOFSERVICE   |  // Important state!
            LINEDEVSTATE_MAINTENANCE    |  // Important state!
            LINEDEVSTATE_OPEN           |
            LINEDEVSTATE_CLOSE          |
            LINEDEVSTATE_NUMCALLS       |
            LINEDEVSTATE_NUMCOMPLETIONS |
            LINEDEVSTATE_TERMINALS      |
            LINEDEVSTATE_ROAMMODE       |
            LINEDEVSTATE_BATTERY        |
            LINEDEVSTATE_SIGNAL         |
            LINEDEVSTATE_DEVSPECIFIC    |
            LINEDEVSTATE_REINIT         |  // Not allowed to disable this.
            LINEDEVSTATE_LOCK           |
            LINEDEVSTATE_CAPSCHANGE     |
            LINEDEVSTATE_CONFIGCHANGE   |
            LINEDEVSTATE_COMPLCANCEL    ,

            LINEADDRESSSTATE_OTHER      |
            LINEADDRESSSTATE_DEVSPECIFIC|
            LINEADDRESSSTATE_INUSEZERO  |
            LINEADDRESSSTATE_INUSEONE   |
            LINEADDRESSSTATE_INUSEMANY  |
            LINEADDRESSSTATE_NUMCALLS   |
            LINEADDRESSSTATE_FORWARD    |
            LINEADDRESSSTATE_TERMINALS  |
            LINEADDRESSSTATE_CAPSCHANGE);

        if (HandleLineErr(lReturn))
            continue;
        else
        {
            // If we do get an unhandled problem, we don't care.
            // We just won't get notifications.
            OutputDebugLineError(lReturn,
                "lineSetStatusMessages unhandled error: ");
            break;
        }
    }
    while(lReturn != SUCCESS);

    // Get LineAddressStatus so we can make sure the line
    // isn't already in use by a TAPI application.
    lpLineAddressStatus =
        I_lineGetAddressStatus(lpLineAddressStatus, g_hLine, 0);

    if (lpLineAddressStatus == NULL)
    {
        HangupCall();
        MessageBox(g_hDlgParentWindow,
            "Error on Requested line",
            "Unable to Use Line",MB_OK);
        goto DeleteBuffers;
    }

    // MAKECALL will be set if there are any available call appearances
    if ( ! ((lpLineAddressStatus -> dwAddressFeatures) &
            LINEADDRFEATURE_MAKECALL) )
    {
        OutputDebugString("This line is not available to place a call.\n");
        HangupCall();
        MessageBox(g_hDlgParentWindow,
            "Requested line is already in use",
            "Unable to Use Line",MB_OK);
        goto DeleteBuffers;
    }

    // If the line was configured in the 'Dial' dialog, then
    // we need to actually complete the configuration.
    if (g_lpDeviceConfig)
        lineSetDevConfig(g_dwDeviceID, g_lpDeviceConfig,
            g_dwSizeDeviceConfig, "comm/datamodem");

    // Start dialing the number
    if (DialCallInParts(lpLineDevCaps, g_szDialableAddress,
            g_szDisplayableAddress))
    {
        OutputDebugString("DialCallInParts succeeded.\n");
    }
    else
    {
        OutputDebugString("DialCallInParts failed.\n");
        HangupCall();
        goto DeleteBuffers;
    }

DeleteBuffers:

    if (lpLineAddressStatus)
        LocalFree(lpLineAddressStatus);
    if (lpLineDevCaps)
        LocalFree(lpLineDevCaps);
    if (g_bTapiInUse)
        EnableHangupCall(g_hWndMainWindow, TRUE);

    return g_bTapiInUse;
}

BOOL HangupCall ( )

Definition at line 519 of file TapiCode.c.

{
    LPLINECALLSTATUS pLineCallStatus = NULL;
    long lReturn;

    // Prevent HangupCall re-entrancy problems.
    if (g_bStoppingCall)
        return TRUE;

    // if the 'Call' dialog is up, dismiss it.
    if (g_hDialog)
        PostMessage(g_hDialog, WM_COMMAND, IDCANCEL, 0);

    // If Tapi is not being used right now, then the call is hung up.
    if (!g_bTapiInUse)
        return TRUE;

    g_bStoppingCall = TRUE;
    OutputDebugString("Stopping Call in progress\n");

    // Disable the 'hangup call' user interface.
    EnableHangupCall(g_hWndMainWindow, FALSE);

    // Stop any data communications on the comm port.
    StopComm();

    // If there is a call in progress, drop and deallocate it.
    if (g_hCall)
    {
        // I_lineGetCallStatus returns a LocalAlloc()d buffer
        pLineCallStatus = I_lineGetCallStatus(pLineCallStatus, g_hCall);
        if (pLineCallStatus == NULL)
        {
            ShutdownTAPI();
            g_bStoppingCall = FALSE;
            return FALSE;
        }

        // Only drop the call when the line is not IDLE.
        if (!((pLineCallStatus -> dwCallState) & LINECALLSTATE_IDLE))
        {
            do
            {
                lReturn = WaitForReply(lineDrop(g_hCall, NULL, 0));

                if (lReturn == WAITERR_WAITTIMEDOUT)
                {
                    OutputDebugString("Call timed out in WaitForReply.\n");
                    break;
                }

                if (lReturn == WAITERR_WAITABORTED)
                {
                    OutputDebugString("lineDrop: WAITERR_WAITABORTED.\n");
                    break;
                }

                // Was the call already in IDLE?
                if (lReturn == LINEERR_INVALCALLSTATE)
                    break;

                if (HandleLineErr(lReturn))
                    continue;
                else
                {
                    OutputDebugLineError(lReturn,
                        "lineDrop unhandled error: ");
                    break;
                }
            }
            while(lReturn != SUCCESS);

            // Wait for the dropped call to go IDLE before continuing.
            lReturn = WaitForCallState(LINECALLSTATE_IDLE);

            if (lReturn == WAITERR_WAITTIMEDOUT)
                OutputDebugString("Call timed out waiting for IDLE state.\n");

            if (lReturn == WAITERR_WAITABORTED)
                OutputDebugString(
                    "WAITERR_WAITABORTED while waiting for IDLE state.\n");

            OutputDebugString("Call Dropped.\n");
        }

        // The call is now idle.  Deallocate it!
        do
        {
            lReturn = lineDeallocateCall(g_hCall);
            if (HandleLineErr(lReturn))
                continue;
            else
            {
                OutputDebugLineError(lReturn,
                    "lineDeallocateCall unhandled error: ");
                break;
            }
        }
        while(lReturn != SUCCESS);

        OutputDebugString("Call Deallocated.\n");
    }

    // if we have a line open, close it.
    if (g_hLine)
    {
        do
        {
            lReturn = lineClose(g_hLine);
            if (HandleLineErr(lReturn))
                continue;
            else
            {
                OutputDebugLineError(lReturn,
                    "lineClose unhandled error: ");
                break;
            }
        }
        while(lReturn != SUCCESS);

        OutputDebugString("Line Closed.\n");
    }

    // Call and Line are taken care of.  Finish cleaning up.

    // If there is device configuration information, free the memory.
    if (g_lpDeviceConfig)
        LocalFree(g_lpDeviceConfig);
    g_lpDeviceConfig = NULL;

    g_hCall = (HCALL)((ULONG_PTR)NULL);
    g_hLine = (HLINE)((ULONG_PTR)NULL);
    g_bConnected = FALSE;

    g_bTapiInUse = FALSE;
    g_bStoppingCall = FALSE; // allow HangupCall to be called again.
    OutputDebugString("Call stopped\n");

    // Update the user interface.
    UpdateStatusBar("Ready to make a call.",1,0);
    EnableMakeCall(g_hWndMainWindow, TRUE);

    // Need to free LocalAlloc()d buffer returned from I_lineGetCallStatus
    if (pLineCallStatus)
        LocalFree(pLineCallStatus);

    return TRUE;
}

BOOL InitializeTAPI ( HWND hParentWnd )

Definition at line 333 of file TapiCode.c.

{
    long lReturn;
    BOOL bTryReInit = TRUE;

    // If we're already initialized, then initialization succeeds.
    if (g_hLineApp)
        return TRUE;

    // If we're in the middle of initializing, then fail, we're not done.
    if (g_bInitializing)
        return FALSE;

    g_bInitializing = TRUE;

    // Initialize TAPI
    do
    {
        lReturn = lineInitialize(&g_hLineApp, hInst,
            (LINECALLBACK) lineCallbackFunc, (LPCSTR)"TapiComm", (LPDWORD)&g_dwNumDevs);

        // If we get this error, its because some other app has yet
        // to respond to the REINIT message.  Wait 5 seconds and try
        // again.  If it still doesn't respond, tell the user.
        if (lReturn == LINEERR_REINIT)
        {
            if (bTryReInit)
            {
                MSG msg;
                DWORD dwTimeStarted;

                dwTimeStarted = GetTickCount();

                while(GetTickCount() - dwTimeStarted < 5000)
                {
                    if (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
                    {
                        TranslateMessage(&msg);
                        DispatchMessage(&msg);
                    }
                }

                bTryReInit = FALSE;
                continue;
            }
            else
            {
                MessageBox(g_hDlgParentWindow,
                    "A change to the system configuration requires that "
                    "all Telephony applications relinquish their use of "
                    "Telephony before any can progress.  "
                    "Some have not yet done so."
                    ,"Warning",MB_OK);
                g_bInitializing = FALSE;
                return FALSE;
            }
        }

        if (lReturn == LINEERR_NODEVICE)
        {
            if (HandleNoDevicesInstalled())
                continue;
            else
            {
                OutputDebugString("No devices installed.\n");
                g_bInitializing = FALSE;
                return FALSE;
            }
        }

        if (HandleLineErr(lReturn))
            continue;
        else
        {
            OutputDebugLineError(lReturn,
                "lineInitialize unhandled error: ");
            g_bInitializing = FALSE;
            return FALSE;
        }
    }
    while(lReturn != SUCCESS);

    // if hWndParent is a valid hWnd, we keep it as the parent for
    // all dialogs.
    if (IsWindow(hWndParent))
    {
        g_hDlgParentWindow = g_hWndMainWindow = hWndParent;
    }
    else
    {
        // Has the old g_hWndMainWindow gone away?
        if (!IsWindow(g_hWndMainWindow))
        {
            OutputDebugString("Main window unavailable.\n");
            g_hDlgParentWindow = g_hWndMainWindow = NULL;
        }
    }

    g_hCall = (HCALL)((ULONG_PTR)NULL);
    g_hLine = (HLINE)((ULONG_PTR)NULL);

    OutputDebugString("Tapi initialized.\n");
    g_bInitializing = FALSE;
    return TRUE;
}

void PostHangupCall ( )

Definition at line 691 of file TapiCode.c.

{
    PostMessage(g_hWndMainWindow, WM_COMMAND, IDM_HANGUPCALL, 0);
}

BOOL ShutdownTAPI ( )

Definition at line 459 of file TapiCode.c.

{
    long lReturn;

    // If we aren't initialized, then Shutdown is unnecessary.
    if (g_hLineApp == (HLINE)((ULONG_PTR)NULL))
        return TRUE;

    // Prevent ShutdownTAPI re-entrancy problems.
    if (g_bShuttingDown)
        return TRUE;

    g_bShuttingDown = TRUE;

    HangupCall();

    do
    {
        lReturn = lineShutdown(g_hLineApp);
        if (HandleLineErr(lReturn))
            continue;
        else
        {
            OutputDebugLineError(lReturn, "lineShutdown unhandled error: ");
            break;
        }
    }
    while(lReturn != SUCCESS);

    g_bTapiInUse = FALSE;
    g_bConnected = FALSE;
    g_hLineApp = (HLINE)((ULONG_PTR)NULL);
    g_hCall = (HCALL)((ULONG_PTR)NULL);
    g_hLine = (HLINE)((ULONG_PTR)NULL);
    g_bShuttingDown = FALSE;
    OutputDebugString("TAPI uninitialized.\n");
    return TRUE;
}

Generated on Wed Nov 13 2024 16:54:11 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi2/TapiComm/TapiComm.c File Reference

  • NetDS
  • Tapi
  • Tapi2
  • TapiComm
Functions | Variables

TapiComm.c File Reference

#include <windows.h>
#include <windowsx.h>
#include <commctrl.h>
#include "globals.h"
#include "statbar.h"
#include "toolbar.h"
#include "EditCtls.h"
#include "TapiCode.h"
#include "resource.h"

Go to the source code of this file.

Functions

LRESULT | CmdCreateFile1 (HWND hWnd, WORD wCommand, WORD wNotify, HWND hwndCtrl)
LRESULT | CmdCreateFile2 (HWND hWnd, WORD wCommand, WORD wNotify, HWND hwndCtrl)
LRESULT | CmdExit (HWND hwnd, WORD wCommand, WORD wNotify, HWND hwndCtrl)
LRESULT | CmdHangupCall (HWND hWnd, WORD wCommand, WORD wNotify, HWND hwndCtrl)
LRESULT | CmdMakeCall (HWND hWnd, WORD wCommand, WORD wNotify, HWND hwndCtrl)
LRESULT | MsgClose (HWND hwnd, UINT uMessage, WPARAM wparam, LPARAM lparam)
LRESULT | MsgCommand (HWND hwnd, UINT uMessage, WPARAM wparam, LPARAM lparam)
LRESULT | MsgCreate (HWND hwnd, UINT uMessage, WPARAM wparam, LPARAM lparam)
LRESULT | MsgDestroy (HWND hwnd, UINT uMessage, WPARAM wparam, LPARAM lparam)
LRESULT | MsgPaint (HWND hwnd, UINT uMessage, WPARAM wparam, LPARAM lparam)
LRESULT | MsgSetFocus (HWND hwnd, UINT uMessage, WPARAM wparam, LPARAM lparam)
LRESULT | MsgSize (HWND hwnd, UINT uMessage, WPARAM wparam, LPARAM lparam)
LRESULT CALLBACK | WndProc (HWND hwnd, UINT uMessage, WPARAM wparam, LPARAM lparam)

Variables

CMDI cmdiMain
MSDI msdiMain
CMD rgcmd []
MSD rgmsd []

Function Documentation

LRESULT CmdCreateFile1 | ( | HWND | hWnd,
 |  | WORD | wCommand,
 |  | WORD | wNotify,
 |  | HWND | hwndCtrl
 | ) |  |
LRESULT CmdCreateFile2 | ( | HWND | hWnd,
 |  | WORD | wCommand,
 |  | WORD | wNotify,
 |  | HWND | hwndCtrl
 | ) |  |
LRESULT CmdExit | ( | HWND | hwnd,
 |  | WORD | wCommand,
 |  | WORD | wNotify,
 |  | HWND | hwndCtrl
 | ) |  |

Definition at line 389 of file TapiComm.c.

{
    char szBuffer[50];
    int  cbWritten = 0;

    ShutdownTAPI();

    cbWritten = LoadString(hInst, wCommand, szBuffer, sizeof(szBuffer));
    if(cbWritten == 0)
        strncpy(szBuffer, "Unknown Command", 49);
  szBuffer[49] = '\0';

    UpdateStatusBar(szBuffer, 0, 0);

    DestroyWindow(hwnd);
    return 0;
}

LRESULT CmdHangupCall | ( | HWND | hWnd,
 |  | WORD | wCommand,
 |  | WORD | wNotify,
 |  | HWND | hwndCtrl
 | ) |  |

Definition at line 429 of file TapiComm.c.

{
    HangupCall();
    return 0;
}

LRESULT CmdMakeCall | ( | HWND | hWnd,
 |  | WORD | wCommand,
 |  | WORD | wNotify,
 |  | HWND | hwndCtrl
 | ) |  |

Definition at line 457 of file TapiComm.c.

{
    DialCall();
    return 0;
}

LRESULT MsgClose | ( | HWND | hwnd,
 |  | UINT | uMessage,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 325 of file TapiComm.c.

{
    ShutdownTAPI();

    DestroyWindow(hwnd);
    return 0;
}

LRESULT MsgCommand | ( | HWND | hwnd,
 |  | UINT | uMessage,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 156 of file TapiComm.c.

{
    return DispCommand(&cmdiMain, hwnd, wparam, lparam);
}

LRESULT MsgCreate | ( | HWND | hwnd,
 |  | UINT | uMessage,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 184 of file TapiComm.c.

{
    InitCommonControls() ; // Initialize the common control library.

    if (InitEditCtls(hwnd) == FALSE)
        return -1;

    InitializeTAPI(hwnd);

    if(!(CreateTBar(hwnd) && CreateSBar(hwnd)))
        return -1;   // Tool and status bars were not created, so return -1.

    UpdateStatusBar("Ready to make a call.",1,0);

    EnableMakeCall(hwnd, TRUE);
    EnableHangupCall(hwnd, FALSE);
    return 0;
}

LRESULT MsgDestroy | ( | HWND | hwnd,
 |  | UINT | uMessage,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 296 of file TapiComm.c.

{
    PostQuitMessage(0);
    return 0;
}

LRESULT MsgPaint | ( | HWND | hwnd,
 |  | UINT | uMessage,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 357 of file TapiComm.c.

{
    HDC hdc;
    PAINTSTRUCT ps;

    hdc = BeginPaint(hwnd, &ps);

    EndPaint(hwnd, &ps);
    return 0;
}

LRESULT MsgSetFocus | ( | HWND | hwnd,
 |  | UINT | uMessage,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 268 of file TapiComm.c.

{
    SetFocusEditCtls();

    return 0 ;
}

LRESULT MsgSize | ( | HWND | hwnd,
 |  | UINT | uMessage,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 231 of file TapiComm.c.

{
    SendMessage(hWndStatusbar,  uMessage, wparam, lparam);
    SendMessage(hWndToolbar, uMessage, wparam, lparam);

    // Re-position the panes in the status bar
    InitializeStatusBar(hwnd);

    SizeEditCtls();

    return 0 ;
}

LRESULT CALLBACK WndProc | ( | HWND | hwnd,
 |  | UINT | uMessage,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 125 of file TapiComm.c.

{
    return DispMessage(&msdiMain, hwnd, uMessage, wparam, lparam);
}

Variable Documentation

CMDI cmdiMain
Initial value:
{
    sizeof(rgcmd) / sizeof(CMD),
    rgcmd,
    edwpWindow
}

Definition at line 95 of file TapiComm.c.

MSDI msdiMain
Initial value:
{
    sizeof(rgmsd) / sizeof(MSD),
    rgmsd,
    edwpWindow
}

Definition at line 71 of file TapiComm.c.

CMD rgcmd[]
Initial value:
{
    {IDM_MAKECALL,    CmdMakeCall},
    {IDM_HANGUPCALL,  CmdHangupCall},
    {IDM_EXIT,        CmdExit},

    {IDM_EDITUNDO,    CmdStub},
    {IDM_EDITCUT,     CmdStub},
    {IDM_EDITCOPY,    CmdStub},
    {IDM_EDITPASTE,   CmdStub},
    {IDM_EDITCLEAR,   CmdStub},

    {IDM_ABOUT,       CmdAbout},
}

Definition at line 80 of file TapiComm.c.

MSD rgmsd[]
Initial value:
{
    {WM_COMMAND,    MsgCommand   },
    {WM_MENUSELECT, MsgMenuSelect},
    {WM_SIZE,       MsgSize      },
    {WM_NOTIFY,     MsgNotify    },
    {WM_CLOSE,      MsgClose     },
    {WM_CREATE,     MsgCreate    },
    {WM_SETFOCUS,   MsgSetFocus  },

    {WM_DESTROY,    MsgDestroy   }
}

Definition at line 58 of file TapiComm.c.

Generated on Wed Nov 13 2024 16:54:11 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi2/TapiComm/TapiInfo.c File Reference

  • NetDS
  • Tapi
  • Tapi2
  • TapiComm
Defines | Functions | Variables

TapiInfo.c File Reference

#include <windows.h>
#include <tapi.h>
#include "TapiInfo.h"

Go to the source code of this file.

Defines

#define | MAXOUTPUTSTRINGLENGTH 4096
#define | sizeofArray(pArray) (sizeof(pArray) / sizeof((pArray)[0]))

Functions

LPSTR | FormatLastError (DWORD dwLastError, LPSTR szOutputBuffer, DWORD dwSizeofOutputBuffer)
LPSTR | FormatLineCallback (LPSTR szOutputBuffer, DWORD dwDevice, DWORD dwMsg, DWORD dwCallbackInstance, DWORD dwParam1, DWORD dwParam2, DWORD dwParam3)
LPSTR | FormatLineError (long lLineError, LPSTR szOutputBuffer, DWORD dwSizeofOutputBuffer)
void | OutputDebugLastErrorFileLine (DWORD dwLastError, LPSTR szPrefix, LPSTR szFileName, DWORD nLineNumber)
void | OutputDebugLineCallback (DWORD dwDevice, DWORD dwMsg, DWORD dwCallbackInstance, DWORD dwParam1, DWORD dwParam2, DWORD dwParam3)
void | OutputDebugLineErrorFileLine (long lLineError, LPSTR szPrefix, LPSTR szFileName, DWORD nLineNumber)
void __cdecl | OutputDebugPrintf (LPCSTR lpszFormat,...)

Variables

LPSTR psz_dwMsg []
LPSTR pszfLINEADDRESSSTATE []
LPSTR pszfLINEBUSYMODE []
LPSTR pszfLINECALLINFOSTATE []
LPSTR pszfLINECALLPRIVILEGE []
LPSTR pszfLINECALLSTATE []
LPSTR pszfLINEDEVSTATE []
LPSTR pszfLINEDIALTONEMODE []
LPSTR pszfLINEDIGITMODE []
LPSTR pszfLINEDISCONNECTED []
LPSTR pszfLINEGATHERTERM []
LPSTR pszfLINEGENERATETERM []
LPSTR pszfLINEMEDIAMODE []
LPSTR pszfLINEREQUESTMODE []
LPSTR pszfLINESPECIALINFO []
LPSTR pszLineErrorNameArray []

Define Documentation

#define MAXOUTPUTSTRINGLENGTH 4096

Definition at line 35 of file TapiInfo.c.

#define sizeofArray ( pArray ) (sizeof(pArray) / sizeof((pArray)[0]))

Definition at line 38 of file TapiInfo.c.

Function Documentation

LPSTR FormatLastError | ( | DWORD | dwLastError,
 |  | LPSTR | szOutputBuffer,
 |  | DWORD | dwSizeofOutputBuffer
 | ) |  |

Definition at line 711 of file TapiInfo.c.

{
    DWORD dwRetFM;
    DWORD dwFlags = FORMAT_MESSAGE_FROM_SYSTEM;

    // Should we allocate a buffer?
    if (szOutputBuffer == NULL)
    {
        // Actually, we make FormatMessage allocate the buffer, if needed.
        dwFlags |= FORMAT_MESSAGE_ALLOCATE_BUFFER;

        // minimum size FormatMessage should allocate.
        dwSizeofOutputBuffer = 1;
    }

    // Make FormatMessage pretty print the system error.
    dwRetFM = FormatMessage(
        dwFlags, NULL, dwLastError,
        MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
        (LPTSTR) &szOutputBuffer, dwSizeofOutputBuffer,
        NULL);

    // FormatMessage failed to print the error.
    if (dwRetFM == 0)
    {
        DWORD dwGetLastError;
        LPSTR szFormatMessageError;

        dwGetLastError = GetLastError();

        // If we asked FormatMessage to allocate a buffer, then it
        // might have allocated one.  Lets be safe and LocalFree it.
        if (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER)
        {
            __try
            {
                LocalFree(szOutputBuffer);
            }
            __except(EXCEPTION_EXECUTE_HANDLER)
            {
                // Actually, we do nothing for this fault.  If
                // there was a fault, it meant the buffer wasn't
                // allocated, and the LocalFree was unnecessary.
                ;
            }

            szOutputBuffer = LocalAlloc(LPTR, MAXOUTPUTSTRINGLENGTH);
            dwSizeofOutputBuffer = MAXOUTPUTSTRINGLENGTH;

            if (szOutputBuffer == NULL)
            {
                OutputDebugString("Out of memory trying to FormatLastError\r\n");
                return NULL;
            }
        }

        szFormatMessageError =
            FormatLastError(dwGetLastError, NULL, 0);

        if (szFormatMessageError == NULL)
            return NULL;

        wsprintf(szOutputBuffer,
            "FormatMessage failed on error 0x%lx for the following reason: %s",
            dwLastError, szFormatMessageError);

        LocalFree(szFormatMessageError);
    }

    return szOutputBuffer;
}

LPSTR FormatLineCallback | ( | LPSTR | szOutputBuffer,
 |  | DWORD | dwDevice,
 |  | DWORD | dwMsg,
 |  | DWORD | dwCallbackInstance,
 |  | DWORD | dwParam1,
 |  | DWORD | dwParam2,
 |  | DWORD | dwParam3
 | ) |  |

Definition at line 844 of file TapiInfo.c.

{
    long lBufferIndex = 0;

    // Allocate the buffer if necessary.
    if (szOutputBuffer == NULL)
    {
        szOutputBuffer = (LPSTR) LocalAlloc(LPTR, MAXOUTPUTSTRINGLENGTH);

        if (szOutputBuffer == NULL)
            return NULL;
    }

    // Is this a known message?
    if (dwMsg >= sizeofArray(psz_dwMsg))
    {
        wsprintf(szOutputBuffer, "lineCallback: Unknown dwMsg: '0x%lx', "
            "dwDevice: '0x%lx', dwCallbackInstance: '0x%lx', "
            "dwParam1: '0x%lx', dwParam2: '0x%lx', dwParam3: '0x%lx'", dwMsg,
            dwDevice, dwCallbackInstance, dwParam1, dwParam2, dwParam3);
        return szOutputBuffer;
    }

    // Lets start pretty printing.
    lBufferIndex +=
        wsprintf(szOutputBuffer, "lineCallback: %s; dwDevice: '0x%lx'; ",
            psz_dwMsg[dwMsg], dwDevice);

    // Which message was it?  And start decoding it!
    // How the message is decoded depends entirely on the message.
    // READ THE HELP FILES if you more information on this.
    switch(dwMsg)
    {
        case LINE_ADDRESSSTATE:
        {
            lBufferIndex +=
                wsprintf(&(szOutputBuffer[lBufferIndex]),
                    "Address ID: 0x%lx, Address State: ", dwParam1);

            lBufferIndex +=
                strBinaryArrayAppend(&(szOutputBuffer[lBufferIndex]),
                    dwParam2,
                    pszfLINEADDRESSSTATE, sizeofArray(pszfLINEADDRESSSTATE));

            break;
        }

        case LINE_CALLINFO:
        {
            lBufferIndex +=
                strBinaryArrayAppend(&(szOutputBuffer[lBufferIndex]),
                    dwParam1,
                    pszfLINECALLINFOSTATE, sizeofArray(pszfLINECALLINFOSTATE));

            break;
        }

        case LINE_CALLSTATE:
        {

            lBufferIndex +=
                strBinaryArrayAppend(&(szOutputBuffer[lBufferIndex]),
                    dwParam3,
                    pszfLINECALLPRIVILEGE, sizeofArray(pszfLINECALLPRIVILEGE));
            lBufferIndex +=
                wsprintf(&(szOutputBuffer[lBufferIndex]),
                    "; ");

            lBufferIndex +=
                strBinaryArrayAppend(&(szOutputBuffer[lBufferIndex]),
                    dwParam1,
                    pszfLINECALLSTATE, sizeofArray(pszfLINECALLSTATE));

            switch(dwParam1)
            {
                case LINECALLSTATE_DIALTONE:
                {
                    lBufferIndex +=
                        wsprintf(&(szOutputBuffer[lBufferIndex]),
                            ": ");

                    lBufferIndex +=
                        strBinaryArrayAppend(&(szOutputBuffer[lBufferIndex]),
                        dwParam2,
                        pszfLINEDIALTONEMODE, sizeofArray(pszfLINEDIALTONEMODE));

                    break;
                }

                case LINECALLSTATE_BUSY:
                {
                    lBufferIndex +=
                        wsprintf(&(szOutputBuffer[lBufferIndex]),
                            ": ");

                    lBufferIndex +=
                        strBinaryArrayAppend(&(szOutputBuffer[lBufferIndex]),
                        dwParam2,
                        pszfLINEBUSYMODE, sizeofArray(pszfLINEBUSYMODE));

                    break;
                }

                case LINECALLSTATE_SPECIALINFO:
                {
                    lBufferIndex +=
                        wsprintf(&(szOutputBuffer[lBufferIndex]),
                            ": ");

                    lBufferIndex +=
                        strBinaryArrayAppend(&(szOutputBuffer[lBufferIndex]),
                        dwParam2,
                        pszfLINESPECIALINFO, sizeofArray(pszfLINESPECIALINFO));

                    break;
                }

                case LINECALLSTATE_DISCONNECTED:
                {
                    lBufferIndex +=
                        wsprintf(&(szOutputBuffer[lBufferIndex]),
                            ": ");

                    lBufferIndex +=
                        strBinaryArrayAppend(&(szOutputBuffer[lBufferIndex]),
                        dwParam2,
                        pszfLINEDISCONNECTED, sizeofArray(pszfLINEDISCONNECTED));

                    break;
                }

                case LINECALLSTATE_CONFERENCED:
                {
                    lBufferIndex +=
                        wsprintf(&(szOutputBuffer[lBufferIndex]),
                            ": Parent conference call handle: 0x%lx", dwParam2);

                    break;
                }
            }

            break;
        }

        case LINE_CLOSE:
            break;

        case LINE_DEVSPECIFIC:
            break;

        case LINE_DEVSPECIFICFEATURE:
            break;

        case LINE_GATHERDIGITS:
        {
            lBufferIndex +=
                strBinaryArrayAppend(&(szOutputBuffer[lBufferIndex]),
                    dwParam1,
                    pszfLINEGATHERTERM, sizeofArray(pszfLINEGATHERTERM));

            break;
        }

        case LINE_GENERATE:
        {
            lBufferIndex +=
                strBinaryArrayAppend(&(szOutputBuffer[lBufferIndex]),
                    dwParam1,
                    pszfLINEGENERATETERM, sizeofArray(pszfLINEGENERATETERM));

            break;
        }

        case LINE_LINEDEVSTATE:
        {
            lBufferIndex +=
                strBinaryArrayAppend(&(szOutputBuffer[lBufferIndex]),
                    dwParam1,
                    pszfLINEDEVSTATE, sizeofArray(pszfLINEDEVSTATE));

            switch(dwParam1)
            {
                case LINEDEVSTATE_RINGING:
                    lBufferIndex +=
                        wsprintf(&(szOutputBuffer[lBufferIndex]),
                            "; Ring Mode: 0x%lx, Ring Count: %lu"
                            ,dwParam2, dwParam3);
                    break;

                case LINEDEVSTATE_REINIT:
                {
                    switch(dwParam2)
                    {
                        case LINE_CREATE:
                            lBufferIndex +=
                                wsprintf(&(szOutputBuffer[lBufferIndex]),
                                    "; ReInit reason: LINE_CREATE, "
                                        "New Line Device ID '0x%lx'"
                                    , dwParam3);
                            break;

                        case LINE_LINEDEVSTATE:
                            lBufferIndex +=
                                wsprintf(&(szOutputBuffer[lBufferIndex]),
                                    "; ReInit reason: LINE_LINEDEVSTATE, ");

                            lBufferIndex +=
                                strBinaryArrayAppend(&(szOutputBuffer[lBufferIndex]),
                                    dwParam3,
                                    pszfLINEDEVSTATE, sizeofArray(pszfLINEDEVSTATE));

                            break;

                        case 0:
                            break;
                        default:
                            lBufferIndex +=
                                wsprintf(&(szOutputBuffer[lBufferIndex]),
                                    "; ReInit reason: %s, dwParam3: 0x%lx"
                                    ,psz_dwMsg[dwParam2], dwParam3);
                            break;

                    }

                    break;
                }

                default:
                    break;
            }

            break;
        }

        case LINE_MONITORDIGITS:
        {
            lBufferIndex +=
                strBinaryArrayAppend(&(szOutputBuffer[lBufferIndex]),
                dwParam2,
                pszfLINEDIGITMODE, sizeofArray(pszfLINEDIGITMODE));

            lBufferIndex +=
                wsprintf(&(szOutputBuffer[lBufferIndex]),
                    ", Received: '%c'", LOBYTE(LOWORD(dwParam1)));

            break;
        }

        case LINE_MONITORMEDIA:
        {
            lBufferIndex +=
                strBinaryArrayAppend(&(szOutputBuffer[lBufferIndex]),
                    dwParam1,
                    pszfLINEMEDIAMODE, sizeofArray(pszfLINEMEDIAMODE));

            break;
        }

        case LINE_MONITORTONE:
        {
            lBufferIndex +=
                wsprintf(&(szOutputBuffer[lBufferIndex]),
                    "AppSpecific tone '%lu'", dwParam1);
            break;
        }

        case LINE_REPLY:
        {
            if (dwParam2 == 0)
            {
                lBufferIndex +=
                    wsprintf(&(szOutputBuffer[lBufferIndex]),
                        "Request ID: 0x%lx; Successful reply!", dwParam1);
            }
            else
            {
                char szTmpBuff[256];

                FormatLineError((long) dwParam2, szTmpBuff, 255);

                lBufferIndex +=
                    wsprintf(&(szOutputBuffer[lBufferIndex]),
                        "Request ID: 0x%lx; UnSuccessful reply; %s",
                        dwParam1, szTmpBuff);
            }

            break;
        }

        case LINE_REQUEST:
        {
            lBufferIndex +=
                strBinaryArrayAppend(&(szOutputBuffer[lBufferIndex]),
                dwParam1,
                pszfLINEREQUESTMODE, sizeofArray(pszfLINEREQUESTMODE));

            switch(dwParam1)
            {
                case LINEREQUESTMODE_DROP:
                {
                    char szHwndName[1024];

                    SendMessage((HWND)(DWORD_PTR) dwParam2, WM_GETTEXT, 1024, (LPARAM) szHwndName);

                    lBufferIndex +=
                        wsprintf(&(szOutputBuffer[lBufferIndex]),
                            ": hwnd dropping = 0x%lx, \"%s\"; wRequestID = %u",
                            dwParam2, szHwndName, LOWORD(dwParam3));
                    break;
                }
                default:
                    break;
            }

            break;
        }

        case LINE_CREATE:
        {
            lBufferIndex +=
                wsprintf(&(szOutputBuffer[lBufferIndex]),
                    "New Line Device ID '0x%lx'", dwParam1);
            break;
        }

        case PHONE_CREATE:
        {
            lBufferIndex +=
                wsprintf(&(szOutputBuffer[lBufferIndex]),
                    "New Phone Device ID '0x%lx'", dwParam1);
            break;
        }

        default:
            lBufferIndex +=
                wsprintf(&(szOutputBuffer[lBufferIndex]),
                    "dwParam1: 0x%lx , dwParam2: 0x%lx , dwParam3: 0x%lx",
                    dwParam1, dwParam2, dwParam3);
            break;

    } // End switch(dwMsg)

    // return that pointer!
    return szOutputBuffer;

}

LPSTR FormatLineError | ( | long | lLineError,
 |  | LPSTR | szOutputBuffer,
 |  | DWORD | dwSizeofOutputBuffer
 | ) |  |

Definition at line 528 of file TapiInfo.c.

{
    char szUnknownLineError[256];
    LPSTR szLineError;
    int nSizeofLineError;
    long lErrorIndex;
    DWORD * pdwLineError;

    // Strip off the high bit to make the error code positive.
    pdwLineError = &lLineError;
    lErrorIndex = (long) (0x7FFFFFFF & *pdwLineError);

    // Is it an unknown error?
    if ((lErrorIndex >= sizeofArray(pszLineErrorNameArray)) ||
        (lErrorIndex < 0))
    {
        nSizeofLineError =
            wsprintf(szUnknownLineError, "Unknown TAPI line error code: 0x%lx",
                lLineError);
        szLineError = szUnknownLineError;
    }
    else
    {
        szLineError = pszLineErrorNameArray[lErrorIndex];
        nSizeofLineError = (int) strlen(szLineError);
    }

    // allocate a buffer if necessary
    if (szOutputBuffer == NULL)
    {
        szOutputBuffer = (LPSTR) LocalAlloc(LPTR, nSizeofLineError + 1);
        if (szOutputBuffer == NULL)
            return NULL;
    }
    else // truncate string if it won't fit in the specified buffer.
    {
        if ((DWORD) nSizeofLineError >= dwSizeofOutputBuffer)
            nSizeofLineError = dwSizeofOutputBuffer - 1;
    }

    // Put the string into the buffer and null terminate.
    memcpy(szOutputBuffer, szLineError, nSizeofLineError);
    szOutputBuffer[nSizeofLineError] = '\0';

    return szOutputBuffer;
}

void OutputDebugLastErrorFileLine | ( | DWORD | dwLastError,
 |  | LPSTR | szPrefix,
 |  | LPSTR | szFileName,
 |  | DWORD | nLineNumber
 | ) |  |

Definition at line 637 of file TapiInfo.c.

{
    LPSTR szLastError;
    char szOutputLastError[MAXOUTPUTSTRINGLENGTH];

    if (szPrefix == NULL)
        szPrefix = "";

    // Pretty print the error.
    szLastError = FormatLastError(dwLastError, NULL, 0);

    // The only reason FormatLastError should fail is "Out of memory".
    if (szLastError == NULL)
    {
        if (szFileName == NULL)
            wsprintf(szOutputLastError, "%sOut of memory\r\n", szPrefix);
        else
            wsprintf(szOutputLastError, "%sOut of memory in file %s, line %d\r\n",
                szPrefix, szFileName, nLineNumber);

        OutputDebugString(szOutputLastError);

        return;
    }

    // If szFileName, then use it; else don't.
    if (szFileName != NULL)
    {
        wsprintf(szOutputLastError,
            "%sGetLastError returned: \"%s\" in File \"%s\", Line %d\r\n",
            szPrefix, szLastError, szFileName, nLineNumber);
    }
    else
    {
        wsprintf(szOutputLastError,
            "%sGetLastError returned: \"%s\"\r\n",
            szPrefix, szLastError);
    }

    // Pointer returned from FormatLineError *must* be freed!
    LocalFree(szLastError);

    // Print it!
    OutputDebugString(szOutputLastError);
    return;
}

void OutputDebugLineCallback | ( | DWORD | dwDevice,
 |  | DWORD | dwMsg,
 |  | DWORD | dwCallbackInstance,
 |  | DWORD | dwParam1,
 |  | DWORD | dwParam2,
 |  | DWORD | dwParam3
 | ) |  |

Definition at line 805 of file TapiInfo.c.

{
    char szOutputBuff[MAXOUTPUTSTRINGLENGTH];

    FormatLineCallback(szOutputBuff,
        dwDevice, dwMsg, dwCallbackInstance,
        dwParam1, dwParam2, dwParam3);

    strcat(szOutputBuff,"\r\n");

    OutputDebugString(szOutputBuff);
}

void OutputDebugLineErrorFileLine | ( | long | lLineError,
 |  | LPSTR | szPrefix,
 |  | LPSTR | szFileName,
 |  | DWORD | nLineNumber
 | ) |  |

Definition at line 452 of file TapiInfo.c.

{
    LPSTR szLineError;
    char szOutputLineError[MAXOUTPUTSTRINGLENGTH];

    if (szPrefix == NULL)
        szPrefix = "";

    // Pretty print the error message.
    szLineError = FormatLineError(lLineError, NULL, 0);

    // The only reason FormatLineError should fail is "Out of memory".
    if (szLineError == NULL)
    {
        if (szFileName == NULL)
            wsprintf(szOutputLineError, "%sOut of memory", szPrefix);
        else
            wsprintf(szOutputLineError,
                "%sOut of memory in file %s, line %d\r\n",
                szPrefix, szFileName, nLineNumber);

        OutputDebugString(szOutputLineError);

        return;
    }

    // If szFileName, then use it; else don't.
    if (szFileName != NULL)
    {
        wsprintf(szOutputLineError,
            "%sTapi Line Error: \"%s\" in File \"%s\", Line %d\r\n",
            szPrefix, szLineError, szFileName, nLineNumber);
    }
    else
    {
        wsprintf(szOutputLineError,
            "%sTapi Line Error: \"%s\"\r\n",
            szPrefix, szLineError);
    }

    // Pointer returned from FormatLineError *must* be freed!
    LocalFree(szLineError);

    // Print it!
    OutputDebugString(szOutputLineError);

    return;
}

void __cdecl OutputDebugPrintf | ( | LPCSTR | lpszFormat,
 |  |  | ...
 | ) |  |

Definition at line 1296 of file TapiInfo.c.

{
    char szOutput[MAXOUTPUTSTRINGLENGTH];
    va_list v1;
    DWORD dwSize;

    va_start(v1, lpszFormat);

    dwSize = wvsprintf(szOutput, lpszFormat, v1);

    if (szOutput[dwSize-1] != '\n')
        strcat(szOutput, "\r\n");

    OutputDebugString(szOutput);
}

Variable Documentation

LPSTR psz_dwMsg[]
Initial value:
 {
    "LINE_ADDRESSSTATE",
    "LINE_CALLINFO",
    "LINE_CALLSTATE",
    "LINE_CLOSE",
    "LINE_DEVSPECIFIC",
    "LINE_DEVSPECIFICFEATURE",
    "LINE_GATHERDIGITS",
    "LINE_GENERATE",
    "LINE_LINEDEVSTATE",
    "LINE_MONITORDIGITS",
    "LINE_MONITORMEDIA",
    "LINE_MONITORTONE",
    "LINE_REPLY",
    "LINE_REQUEST",
    "PHONE_BUTTON",
    "PHONE_CLOSE",
    "PHONE_DEVSPECIFIC",
    "PHONE_REPLY",
    "PHONE_STATE",
    "LINE_CREATE",
    "PHONE_CREATE"
}

Definition at line 146 of file TapiInfo.c.

LPSTR pszfLINEADDRESSSTATE[]
Initial value:

{
    "Unknown LINEADDRESSSTATE information",
    "LINEADDRESSSTATE_OTHER",
    "LINEADDRESSSTATE_DEVSPECIFIC",
    "LINEADDRESSSTATE_INUSEZERO",
    "LINEADDRESSSTATE_INUSEONE",
    "LINEADDRESSSTATE_INUSEMANY",
    "LINEADDRESSSTATE_NUMCALLS",
    "LINEADDRESSSTATE_FORWARD",
    "LINEADDRESSSTATE_TERMINALS",
    "LINEADDRESSSTATE_CAPSCHANGE"
}

Definition at line 171 of file TapiInfo.c.

LPSTR pszfLINEBUSYMODE[]
Initial value:
{
    "Unknown LINEBUSYMODE information",
    "LINEBUSYMODE_STATION",
    "LINEBUSYMODE_TRUNK",
    "LINEBUSYMODE_UNKNOWN",
    "LINEBUSYMODE_UNAVAIL"
}

Definition at line 254 of file TapiInfo.c.

LPSTR pszfLINECALLINFOSTATE[]

Definition at line 186 of file TapiInfo.c.

LPSTR pszfLINECALLPRIVILEGE[]
Initial value:
{
    "No change to LINECALLPRIVILEGE",
    "LINECALLPRIVILEGE_NONE",
    "LINECALLPRIVILEGE_MONITOR",
    "LINECALLPRIVILEGE_OWNER"
}

Definition at line 294 of file TapiInfo.c.

LPSTR pszfLINECALLSTATE[]
Initial value:

{
    "Unknown LINECALLSTATE state",
    "LINECALLSTATE_IDLE",
    "LINECALLSTATE_OFFERING",
    "LINECALLSTATE_ACCEPTED",
    "LINECALLSTATE_DIALTONE",
    "LINECALLSTATE_DIALING",
    "LINECALLSTATE_RINGBACK",
    "LINECALLSTATE_BUSY",
    "LINECALLSTATE_SPECIALINFO",
    "LINECALLSTATE_CONNECTED",
    "LINECALLSTATE_PROCEEDING",
    "LINECALLSTATE_ONHOLD",
    "LINECALLSTATE_CONFERENCED",
    "LINECALLSTATE_ONHOLDPENDCONF",
    "LINECALLSTATE_ONHOLDPENDTRANSFER",
    "LINECALLSTATE_DISCONNECTED",
    "LINECALLSTATE_UNKNOWN"
}

Definition at line 220 of file TapiInfo.c.

LPSTR pszfLINEDEVSTATE[]
Initial value:
{
    "Unknown LINEDEVESTATE state",
    "LINEDEVSTATE_OTHER",
    "LINEDEVSTATE_RINGING",
    "LINEDEVSTATE_CONNECTED",
    "LINEDEVSTATE_DISCONNECTED",
    "LINEDEVSTATE_MSGWAITON",
    "LINEDEVSTATE_MSGWAITOFF",
    "LINEDEVSTATE_INSERVICE",
    "LINEDEVSTATE_OUTOFSERVICE",
    "LINEDEVSTATE_MAINTENANCE",
    "LINEDEVSTATE_OPEN",
    "LINEDEVSTATE_CLOSE",
    "LINEDEVSTATE_NUMCALLS",
    "LINEDEVSTATE_NUMCOMPLETIONS",
    "LINEDEVSTATE_TERMINALS",
    "LINEDEVSTATE_ROAMMODE",
    "LINEDEVSTATE_BATTERY",
    "LINEDEVSTATE_SIGNAL",
    "LINEDEVSTATE_DEVSPECIFIC",
    "LINEDEVSTATE_REINIT",
    "LINEDEVSTATE_LOCK",
    "LINEDEVSTATE_CAPSCHANGE",
    "LINEDEVSTATE_CONFIGCHANGE",
    "LINEDEVSTATE_TRANSLATECHANGE",
    "LINEDEVSTATE_COMPLCANCEL",
    "LINEDEVSTATE_REMOVED"
}

Definition at line 322 of file TapiInfo.c.

LPSTR pszfLINEDIALTONEMODE[]
Initial value:
{
    "Unknown LINEDIALTONE information",
    "LINEDIALTONEMODE_NORMAL",
    "LINEDIALTONEMODE_SPECIAL",
    "LINEDIALTONEMODE_INTERNAL",
    "LINEDIALTONEMODE_EXTERNAL",
    "LINEDIALTONEMODE_UNKNOWN",
    "LINEDIALTONEMODE_UNAVAIL"
}

Definition at line 242 of file TapiInfo.c.

LPSTR pszfLINEDIGITMODE[]
Initial value:
{
    "Unknown LINEDIGITMODE mode",
    "LINEDIGITMODE_PULSE",
    "LINEDIGITMODE_DTMF",
    "LINEDIGITMODE_DTMFEND"
}

Definition at line 353 of file TapiInfo.c.

LPSTR pszfLINEDISCONNECTED[]
Initial value:
{
    "Unknown LINEDISCONNECTED information",
    "LINEDISCONNECTMODE_NORMAL",
    "LINEDISCONNECTMODE_UNKNOWN",
    "LINEDISCONNECTMODE_REJECT",
    "LINEDISCONNECTMODE_PICKUP",
    "LINEDISCONNECTMODE_FORWARDED",
    "LINEDISCONNECTMODE_BUSY",
    "LINEDISCONNECTMODE_NOANSWER",
    "LINEDISCONNECTMODE_BADADDRESS",
    "LINEDISCONNECTMODE_UNREACHABLE",
    "LINEDISCONNECTMODE_CONGESTION",
    "LINEDISCONNECTMODE_INCOMPATIBLE",
    "LINEDISCONNECTMODE_UNAVAIL",
    "LINEDISCONNECTMODE_NODIALTONE"
}

Definition at line 275 of file TapiInfo.c.

LPSTR pszfLINEGATHERTERM[]
Initial value:
{
    "Unknown LINEGATHERTERM message",
    "LINEGATHERTERM_BUFFERFULL",
    "LINEGATHERTERM_TERMDIGIT",
    "LINEGATHERTERM_FIRSTTIMEOUT",
    "LINEGATHERTERM_INTERTIMEOUT",
    "LINEGATHERTERM_CANCEL"
}

Definition at line 303 of file TapiInfo.c.

LPSTR pszfLINEGENERATETERM[]
Initial value:

{
    "Unknown LINEGENERATETERM message",
    "LINEGENERATETERM_DONE",
    "LINEGENERATETERM_CANCEL"
}

Definition at line 314 of file TapiInfo.c.

LPSTR pszfLINEMEDIAMODE[]
Initial value:
{
    "Unknown LINEMEDIAMODE mode",
    "UnUsed LINEMEDIAMODE mode, ERROR!!",
    "LINEMEDIAMODE_UNKNOWN",
    "LINEMEDIAMODE_INTERACTIVEVOICE",
    "LINEMEDIAMODE_AUTOMATEDVOICE",
    "LINEMEDIAMODE_DATAMODEM",
    "LINEMEDIAMODE_G3FAX",
    "LINEMEDIAMODE_TDD",
    "LINEMEDIAMODE_G4FAX",
    "LINEMEDIAMODE_DIGITALDATA",
    "LINEMEDIAMODE_TELETEX",
    "LINEMEDIAMODE_VIDEOTEX",
    "LINEMEDIAMODE_TELEX",
    "LINEMEDIAMODE_MIXED",
    "LINEMEDIAMODE_ADSI",
    "LINEMEDIAMODE_VOICEVIEW"
}

Definition at line 362 of file TapiInfo.c.

LPSTR pszfLINEREQUESTMODE[]
Initial value:
{
    "Unknown LINEREQUESTMODE message",
    "LINEREQUESTMODE_MAKECALL",
    "LINEREQUESTMODE_MEDIACALL",
    "LINEREQUESTMODE_DROP"
}

Definition at line 383 of file TapiInfo.c.

LPSTR pszfLINESPECIALINFO[]
Initial value:
{
    "Unknown LINESPECIALINFO information",
    "LINESPECIALINFO_NOCIRCUIT",
    "LINESPECIALINFO_CUSTIRREG",
    "LINESPECIALINFO_REORDER",
    "LINESPECIALINFO_UNKNOWN",
    "LINESPECIALINFO_UNAVAIL"
}

Definition at line 264 of file TapiInfo.c.

LPSTR pszLineErrorNameArray[]

Definition at line 54 of file TapiInfo.c.

Generated on Wed Nov 13 2024 16:54:11 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi2/TapiComm/TapiInfo.h File Reference

  • NetDS
  • Tapi
  • Tapi2
  • TapiComm
Defines | Functions

TapiInfo.h File Reference

Go to the source code of this file.

Defines

#define | OutputDebugLastError(dwLastError, pszPrefix)
#define | OutputDebugLineError(lLineError, pszPrefix)

Functions

LPSTR | FormatLastError (DWORD dwLastError, LPSTR szOutputBuffer, DWORD dwSizeofOutputBuffer)
LPSTR | FormatLineCallback (LPSTR pszOutputBuffer, DWORD dwDevice, DWORD dwMsg, DWORD dwCallbackInstance, DWORD dwParam1, DWORD dwParam2, DWORD dwParam3)
LPSTR | FormatLineError (long lLineError, LPSTR szOutputBuffer, DWORD dwSizeofOutputBuffer)
void | OutputDebugLastErrorFileLine (DWORD dwLastError, LPSTR szPrefix, LPSTR szFileName, DWORD nLineNumber)
void | OutputDebugLineCallback (DWORD dwDevice, DWORD dwMsg, DWORD dwCallbackInstance, DWORD dwParam1, DWORD dwParam2, DWORD dwParam3)
void | OutputDebugLineErrorFileLine (long lLineError, LPSTR szPrefix, LPSTR szFileName, DWORD nLineNumber)
void __cdecl | OutputDebugPrintf (LPCSTR lpszFormat,...)

Define Documentation

#define OutputDebugLastError | ( | dwLastError,
 |  | pszPrefix
 | ) |
Value:
OutputDebugLastErrorFileLine(dwLastError, pszPrefix,\
        __FILE__, __LINE__)

Definition at line 16 of file TapiInfo.h.

#define OutputDebugLineError | ( | lLineError,
 |  | pszPrefix
 | ) |
Value:
OutputDebugLineErrorFileLine(lLineError, pszPrefix,\
        __FILE__, __LINE__)

Definition at line 12 of file TapiInfo.h.

Function Documentation

LPSTR FormatLastError | ( | DWORD | dwLastError,
 |  | LPSTR | szOutputBuffer,
 |  | DWORD | dwSizeofOutputBuffer
 | ) |  |

Definition at line 711 of file TapiInfo.c.

{
    DWORD dwRetFM;
    DWORD dwFlags = FORMAT_MESSAGE_FROM_SYSTEM;

    // Should we allocate a buffer?
    if (szOutputBuffer == NULL)
    {
        // Actually, we make FormatMessage allocate the buffer, if needed.
        dwFlags |= FORMAT_MESSAGE_ALLOCATE_BUFFER;

        // minimum size FormatMessage should allocate.
        dwSizeofOutputBuffer = 1;
    }

    // Make FormatMessage pretty print the system error.
    dwRetFM = FormatMessage(
        dwFlags, NULL, dwLastError,
        MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
        (LPTSTR) &szOutputBuffer, dwSizeofOutputBuffer,
        NULL);

    // FormatMessage failed to print the error.
    if (dwRetFM == 0)
    {
        DWORD dwGetLastError;
        LPSTR szFormatMessageError;

        dwGetLastError = GetLastError();

        // If we asked FormatMessage to allocate a buffer, then it
        // might have allocated one.  Lets be safe and LocalFree it.
        if (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER)
        {
            __try
            {
                LocalFree(szOutputBuffer);
            }
            __except(EXCEPTION_EXECUTE_HANDLER)
            {
                // Actually, we do nothing for this fault.  If
                // there was a fault, it meant the buffer wasn't
                // allocated, and the LocalFree was unnecessary.
                ;
            }

            szOutputBuffer = LocalAlloc(LPTR, MAXOUTPUTSTRINGLENGTH);
            dwSizeofOutputBuffer = MAXOUTPUTSTRINGLENGTH;

            if (szOutputBuffer == NULL)
            {
                OutputDebugString("Out of memory trying to FormatLastError\r\n");
                return NULL;
            }
        }

        szFormatMessageError =
            FormatLastError(dwGetLastError, NULL, 0);

        if (szFormatMessageError == NULL)
            return NULL;

        wsprintf(szOutputBuffer,
            "FormatMessage failed on error 0x%lx for the following reason: %s",
            dwLastError, szFormatMessageError);

        LocalFree(szFormatMessageError);
    }

    return szOutputBuffer;
}

LPSTR FormatLineCallback | ( | LPSTR | pszOutputBuffer,
 |  | DWORD | dwDevice,
 |  | DWORD | dwMsg,
 |  | DWORD | dwCallbackInstance,
 |  | DWORD | dwParam1,
 |  | DWORD | dwParam2,
 |  | DWORD | dwParam3
 | ) |  |

Definition at line 844 of file TapiInfo.c.

{
    long lBufferIndex = 0;

    // Allocate the buffer if necessary.
    if (szOutputBuffer == NULL)
    {
        szOutputBuffer = (LPSTR) LocalAlloc(LPTR, MAXOUTPUTSTRINGLENGTH);

        if (szOutputBuffer == NULL)
            return NULL;
    }

    // Is this a known message?
    if (dwMsg >= sizeofArray(psz_dwMsg))
    {
        wsprintf(szOutputBuffer, "lineCallback: Unknown dwMsg: '0x%lx', "
            "dwDevice: '0x%lx', dwCallbackInstance: '0x%lx', "
            "dwParam1: '0x%lx', dwParam2: '0x%lx', dwParam3: '0x%lx'", dwMsg,
            dwDevice, dwCallbackInstance, dwParam1, dwParam2, dwParam3);
        return szOutputBuffer;
    }

    // Lets start pretty printing.
    lBufferIndex +=
        wsprintf(szOutputBuffer, "lineCallback: %s; dwDevice: '0x%lx'; ",
            psz_dwMsg[dwMsg], dwDevice);

    // Which message was it?  And start decoding it!
    // How the message is decoded depends entirely on the message.
    // READ THE HELP FILES if you more information on this.
    switch(dwMsg)
    {
        case LINE_ADDRESSSTATE:
        {
            lBufferIndex +=
                wsprintf(&(szOutputBuffer[lBufferIndex]),
                    "Address ID: 0x%lx, Address State: ", dwParam1);

            lBufferIndex +=
                strBinaryArrayAppend(&(szOutputBuffer[lBufferIndex]),
                    dwParam2,
                    pszfLINEADDRESSSTATE, sizeofArray(pszfLINEADDRESSSTATE));

            break;
        }

        case LINE_CALLINFO:
        {
            lBufferIndex +=
                strBinaryArrayAppend(&(szOutputBuffer[lBufferIndex]),
                    dwParam1,
                    pszfLINECALLINFOSTATE, sizeofArray(pszfLINECALLINFOSTATE));

            break;
        }

        case LINE_CALLSTATE:
        {

            lBufferIndex +=
                strBinaryArrayAppend(&(szOutputBuffer[lBufferIndex]),
                    dwParam3,
                    pszfLINECALLPRIVILEGE, sizeofArray(pszfLINECALLPRIVILEGE));
            lBufferIndex +=
                wsprintf(&(szOutputBuffer[lBufferIndex]),
                    "; ");

            lBufferIndex +=
                strBinaryArrayAppend(&(szOutputBuffer[lBufferIndex]),
                    dwParam1,
                    pszfLINECALLSTATE, sizeofArray(pszfLINECALLSTATE));

            switch(dwParam1)
            {
                case LINECALLSTATE_DIALTONE:
                {
                    lBufferIndex +=
                        wsprintf(&(szOutputBuffer[lBufferIndex]),
                            ": ");

                    lBufferIndex +=
                        strBinaryArrayAppend(&(szOutputBuffer[lBufferIndex]),
                        dwParam2,
                        pszfLINEDIALTONEMODE, sizeofArray(pszfLINEDIALTONEMODE));

                    break;
                }

                case LINECALLSTATE_BUSY:
                {
                    lBufferIndex +=
                        wsprintf(&(szOutputBuffer[lBufferIndex]),
                            ": ");

                    lBufferIndex +=
                        strBinaryArrayAppend(&(szOutputBuffer[lBufferIndex]),
                        dwParam2,
                        pszfLINEBUSYMODE, sizeofArray(pszfLINEBUSYMODE));

                    break;
                }

                case LINECALLSTATE_SPECIALINFO:
                {
                    lBufferIndex +=
                        wsprintf(&(szOutputBuffer[lBufferIndex]),
                            ": ");

                    lBufferIndex +=
                        strBinaryArrayAppend(&(szOutputBuffer[lBufferIndex]),
                        dwParam2,
                        pszfLINESPECIALINFO, sizeofArray(pszfLINESPECIALINFO));

                    break;
                }

                case LINECALLSTATE_DISCONNECTED:
                {
                    lBufferIndex +=
                        wsprintf(&(szOutputBuffer[lBufferIndex]),
                            ": ");

                    lBufferIndex +=
                        strBinaryArrayAppend(&(szOutputBuffer[lBufferIndex]),
                        dwParam2,
                        pszfLINEDISCONNECTED, sizeofArray(pszfLINEDISCONNECTED));

                    break;
                }

                case LINECALLSTATE_CONFERENCED:
                {
                    lBufferIndex +=
                        wsprintf(&(szOutputBuffer[lBufferIndex]),
                            ": Parent conference call handle: 0x%lx", dwParam2);

                    break;
                }
            }

            break;
        }

        case LINE_CLOSE:
            break;

        case LINE_DEVSPECIFIC:
            break;

        case LINE_DEVSPECIFICFEATURE:
            break;

        case LINE_GATHERDIGITS:
        {
            lBufferIndex +=
                strBinaryArrayAppend(&(szOutputBuffer[lBufferIndex]),
                    dwParam1,
                    pszfLINEGATHERTERM, sizeofArray(pszfLINEGATHERTERM));

            break;
        }

        case LINE_GENERATE:
        {
            lBufferIndex +=
                strBinaryArrayAppend(&(szOutputBuffer[lBufferIndex]),
                    dwParam1,
                    pszfLINEGENERATETERM, sizeofArray(pszfLINEGENERATETERM));

            break;
        }

        case LINE_LINEDEVSTATE:
        {
            lBufferIndex +=
                strBinaryArrayAppend(&(szOutputBuffer[lBufferIndex]),
                    dwParam1,
                    pszfLINEDEVSTATE, sizeofArray(pszfLINEDEVSTATE));

            switch(dwParam1)
            {
                case LINEDEVSTATE_RINGING:
                    lBufferIndex +=
                        wsprintf(&(szOutputBuffer[lBufferIndex]),
                            "; Ring Mode: 0x%lx, Ring Count: %lu"
                            ,dwParam2, dwParam3);
                    break;

                case LINEDEVSTATE_REINIT:
                {
                    switch(dwParam2)
                    {
                        case LINE_CREATE:
                            lBufferIndex +=
                                wsprintf(&(szOutputBuffer[lBufferIndex]),
                                    "; ReInit reason: LINE_CREATE, "
                                        "New Line Device ID '0x%lx'"
                                    , dwParam3);
                            break;

                        case LINE_LINEDEVSTATE:
                            lBufferIndex +=
                                wsprintf(&(szOutputBuffer[lBufferIndex]),
                                    "; ReInit reason: LINE_LINEDEVSTATE, ");

                            lBufferIndex +=
                                strBinaryArrayAppend(&(szOutputBuffer[lBufferIndex]),
                                    dwParam3,
                                    pszfLINEDEVSTATE, sizeofArray(pszfLINEDEVSTATE));

                            break;

                        case 0:
                            break;
                        default:
                            lBufferIndex +=
                                wsprintf(&(szOutputBuffer[lBufferIndex]),
                                    "; ReInit reason: %s, dwParam3: 0x%lx"
                                    ,psz_dwMsg[dwParam2], dwParam3);
                            break;

                    }

                    break;
                }

                default:
                    break;
            }

            break;
        }

        case LINE_MONITORDIGITS:
        {
            lBufferIndex +=
                strBinaryArrayAppend(&(szOutputBuffer[lBufferIndex]),
                dwParam2,
                pszfLINEDIGITMODE, sizeofArray(pszfLINEDIGITMODE));

            lBufferIndex +=
                wsprintf(&(szOutputBuffer[lBufferIndex]),
                    ", Received: '%c'", LOBYTE(LOWORD(dwParam1)));

            break;
        }

        case LINE_MONITORMEDIA:
        {
            lBufferIndex +=
                strBinaryArrayAppend(&(szOutputBuffer[lBufferIndex]),
                    dwParam1,
                    pszfLINEMEDIAMODE, sizeofArray(pszfLINEMEDIAMODE));

            break;
        }

        case LINE_MONITORTONE:
        {
            lBufferIndex +=
                wsprintf(&(szOutputBuffer[lBufferIndex]),
                    "AppSpecific tone '%lu'", dwParam1);
            break;
        }

        case LINE_REPLY:
        {
            if (dwParam2 == 0)
            {
                lBufferIndex +=
                    wsprintf(&(szOutputBuffer[lBufferIndex]),
                        "Request ID: 0x%lx; Successful reply!", dwParam1);
            }
            else
            {
                char szTmpBuff[256];

                FormatLineError((long) dwParam2, szTmpBuff, 255);

                lBufferIndex +=
                    wsprintf(&(szOutputBuffer[lBufferIndex]),
                        "Request ID: 0x%lx; UnSuccessful reply; %s",
                        dwParam1, szTmpBuff);
            }

            break;
        }

        case LINE_REQUEST:
        {
            lBufferIndex +=
                strBinaryArrayAppend(&(szOutputBuffer[lBufferIndex]),
                dwParam1,
                pszfLINEREQUESTMODE, sizeofArray(pszfLINEREQUESTMODE));

            switch(dwParam1)
            {
                case LINEREQUESTMODE_DROP:
                {
                    char szHwndName[1024];

                    SendMessage((HWND)(DWORD_PTR) dwParam2, WM_GETTEXT, 1024, (LPARAM) szHwndName);

                    lBufferIndex +=
                        wsprintf(&(szOutputBuffer[lBufferIndex]),
                            ": hwnd dropping = 0x%lx, \"%s\"; wRequestID = %u",
                            dwParam2, szHwndName, LOWORD(dwParam3));
                    break;
                }
                default:
                    break;
            }

            break;
        }

        case LINE_CREATE:
        {
            lBufferIndex +=
                wsprintf(&(szOutputBuffer[lBufferIndex]),
                    "New Line Device ID '0x%lx'", dwParam1);
            break;
        }

        case PHONE_CREATE:
        {
            lBufferIndex +=
                wsprintf(&(szOutputBuffer[lBufferIndex]),
                    "New Phone Device ID '0x%lx'", dwParam1);
            break;
        }

        default:
            lBufferIndex +=
                wsprintf(&(szOutputBuffer[lBufferIndex]),
                    "dwParam1: 0x%lx , dwParam2: 0x%lx , dwParam3: 0x%lx",
                    dwParam1, dwParam2, dwParam3);
            break;

    } // End switch(dwMsg)

    // return that pointer!
    return szOutputBuffer;

}

LPSTR FormatLineError | ( | long | lLineError,
 |  | LPSTR | szOutputBuffer,
 |  | DWORD | dwSizeofOutputBuffer
 | ) |  |

Definition at line 528 of file TapiInfo.c.

{
    char szUnknownLineError[256];
    LPSTR szLineError;
    int nSizeofLineError;
    long lErrorIndex;
    DWORD * pdwLineError;

    // Strip off the high bit to make the error code positive.
    pdwLineError = &lLineError;
    lErrorIndex = (long) (0x7FFFFFFF & *pdwLineError);

    // Is it an unknown error?
    if ((lErrorIndex >= sizeofArray(pszLineErrorNameArray)) ||
        (lErrorIndex < 0))
    {
        nSizeofLineError =
            wsprintf(szUnknownLineError, "Unknown TAPI line error code: 0x%lx",
                lLineError);
        szLineError = szUnknownLineError;
    }
    else
    {
        szLineError = pszLineErrorNameArray[lErrorIndex];
        nSizeofLineError = (int) strlen(szLineError);
    }

    // allocate a buffer if necessary
    if (szOutputBuffer == NULL)
    {
        szOutputBuffer = (LPSTR) LocalAlloc(LPTR, nSizeofLineError + 1);
        if (szOutputBuffer == NULL)
            return NULL;
    }
    else // truncate string if it won't fit in the specified buffer.
    {
        if ((DWORD) nSizeofLineError >= dwSizeofOutputBuffer)
            nSizeofLineError = dwSizeofOutputBuffer - 1;
    }

    // Put the string into the buffer and null terminate.
    memcpy(szOutputBuffer, szLineError, nSizeofLineError);
    szOutputBuffer[nSizeofLineError] = '\0';

    return szOutputBuffer;
}

void OutputDebugLastErrorFileLine | ( | DWORD | dwLastError,
 |  | LPSTR | szPrefix,
 |  | LPSTR | szFileName,
 |  | DWORD | nLineNumber
 | ) |  |

Definition at line 637 of file TapiInfo.c.

{
    LPSTR szLastError;
    char szOutputLastError[MAXOUTPUTSTRINGLENGTH];

    if (szPrefix == NULL)
        szPrefix = "";

    // Pretty print the error.
    szLastError = FormatLastError(dwLastError, NULL, 0);

    // The only reason FormatLastError should fail is "Out of memory".
    if (szLastError == NULL)
    {
        if (szFileName == NULL)
            wsprintf(szOutputLastError, "%sOut of memory\r\n", szPrefix);
        else
            wsprintf(szOutputLastError, "%sOut of memory in file %s, line %d\r\n",
                szPrefix, szFileName, nLineNumber);

        OutputDebugString(szOutputLastError);

        return;
    }

    // If szFileName, then use it; else don't.
    if (szFileName != NULL)
    {
        wsprintf(szOutputLastError,
            "%sGetLastError returned: \"%s\" in File \"%s\", Line %d\r\n",
            szPrefix, szLastError, szFileName, nLineNumber);
    }
    else
    {
        wsprintf(szOutputLastError,
            "%sGetLastError returned: \"%s\"\r\n",
            szPrefix, szLastError);
    }

    // Pointer returned from FormatLineError *must* be freed!
    LocalFree(szLastError);

    // Print it!
    OutputDebugString(szOutputLastError);
    return;
}

void OutputDebugLineCallback | ( | DWORD | dwDevice,
 |  | DWORD | dwMsg,
 |  | DWORD | dwCallbackInstance,
 |  | DWORD | dwParam1,
 |  | DWORD | dwParam2,
 |  | DWORD | dwParam3
 | ) |  |

Definition at line 805 of file TapiInfo.c.

{
    char szOutputBuff[MAXOUTPUTSTRINGLENGTH];

    FormatLineCallback(szOutputBuff,
        dwDevice, dwMsg, dwCallbackInstance,
        dwParam1, dwParam2, dwParam3);

    strcat(szOutputBuff,"\r\n");

    OutputDebugString(szOutputBuff);
}

void OutputDebugLineErrorFileLine | ( | long | lLineError,
 |  | LPSTR | szPrefix,
 |  | LPSTR | szFileName,
 |  | DWORD | nLineNumber
 | ) |  |

Definition at line 452 of file TapiInfo.c.

{
    LPSTR szLineError;
    char szOutputLineError[MAXOUTPUTSTRINGLENGTH];

    if (szPrefix == NULL)
        szPrefix = "";

    // Pretty print the error message.
    szLineError = FormatLineError(lLineError, NULL, 0);

    // The only reason FormatLineError should fail is "Out of memory".
    if (szLineError == NULL)
    {
        if (szFileName == NULL)
            wsprintf(szOutputLineError, "%sOut of memory", szPrefix);
        else
            wsprintf(szOutputLineError,
                "%sOut of memory in file %s, line %d\r\n",
                szPrefix, szFileName, nLineNumber);

        OutputDebugString(szOutputLineError);

        return;
    }

    // If szFileName, then use it; else don't.
    if (szFileName != NULL)
    {
        wsprintf(szOutputLineError,
            "%sTapi Line Error: \"%s\" in File \"%s\", Line %d\r\n",
            szPrefix, szLineError, szFileName, nLineNumber);
    }
    else
    {
        wsprintf(szOutputLineError,
            "%sTapi Line Error: \"%s\"\r\n",
            szPrefix, szLineError);
    }

    // Pointer returned from FormatLineError *must* be freed!
    LocalFree(szLineError);

    // Print it!
    OutputDebugString(szOutputLineError);

    return;
}

void __cdecl OutputDebugPrintf | ( | LPCSTR | lpszFormat,
 |  |  | ...
 | ) |  |

Definition at line 1296 of file TapiInfo.c.

{
    char szOutput[MAXOUTPUTSTRINGLENGTH];
    va_list v1;
    DWORD dwSize;

    va_start(v1, lpszFormat);

    dwSize = wvsprintf(szOutput, lpszFormat, v1);

    if (szOutput[dwSize-1] != '\n')
        strcat(szOutput, "\r\n");

    OutputDebugString(szOutput);
}

Generated on Wed Nov 13 2024 16:54:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi2/TapiComm/ToolBar.c File Reference

  • NetDS
  • Tapi
  • Tapi2
  • TapiComm
Defines | Functions | Variables

ToolBar.c File Reference

#include <windows.h>
#include <windowsx.h>
#include <commctrl.h>
#include "globals.h"
#include "toolbar.h"

Go to the source code of this file.

Defines

#define | BUTTONHEIGHT 0
#define | BUTTONWIDTH 0
#define | IMAGEHEIGHT 17
#define | IMAGEWIDTH 18
#define | NUMIMAGES 9

Functions

BOOL | CreateTBar (HWND hwnd)
void | EnableHangupCall (HWND hWnd, BOOL bEnable)
void | EnableMakeCall (HWND hWnd, BOOL bEnable)
LRESULT | MsgNotify (HWND hwnd, UINT uMessage, WPARAM wparam, LPARAM lparam)

Variables

HWND | hWndToolbar
TBBUTTON | tbButton []

Define Documentation

#define BUTTONHEIGHT 0

Definition at line 42 of file ToolBar.c.

#define BUTTONWIDTH 0

Definition at line 41 of file ToolBar.c.

#define IMAGEHEIGHT 17

Definition at line 40 of file ToolBar.c.

#define IMAGEWIDTH 18

Definition at line 39 of file ToolBar.c.

#define NUMIMAGES 9

Definition at line 38 of file ToolBar.c.

Function Documentation

BOOL CreateTBar ( HWND hwnd )

Definition at line 75 of file ToolBar.c.

{
    hWndToolbar = CreateToolbarEx(hwnd,
                                  WS_CHILD | WS_VISIBLE | TBSTYLE_TOOLTIPS,
                                  IDM_TOOLBAR,
                                  NUMIMAGES,
                                  hInst,
                                  IDB_BMP,
                                  tbButton,
                                  sizeof(tbButton)/sizeof(TBBUTTON),
                                  BUTTONWIDTH,
                                  BUTTONHEIGHT,
                                  IMAGEWIDTH,
                                  IMAGEHEIGHT,
                                  sizeof(TBBUTTON));

    return (hWndToolbar != NULL);
}

void EnableHangupCall | ( | HWND | hWnd,
 |  | BOOL | bEnable
 | ) |  |

Definition at line 143 of file ToolBar.c.

{
    EnableMenuItem(GetMenu(hWnd), IDM_HANGUPCALL, MF_BYCOMMAND |
        (bEnable ? MF_ENABLED : MF_GRAYED));
    SendMessage(hWndToolbar, TB_ENABLEBUTTON, (WPARAM) IDM_HANGUPCALL,
        (LPARAM) MAKELONG(bEnable, 0));
}

void EnableMakeCall | ( | HWND | hWnd,
 |  | BOOL | bEnable
 | ) |  |

Definition at line 134 of file ToolBar.c.

{
    EnableMenuItem(GetMenu(hWnd), IDM_MAKECALL, MF_BYCOMMAND |
        (bEnable ? MF_ENABLED : MF_GRAYED));
    SendMessage(hWndToolbar, TB_ENABLEBUTTON, (WPARAM) IDM_MAKECALL,
        (LPARAM) MAKELONG(bEnable, 0));

}

LRESULT MsgNotify | ( | HWND | hwnd,
 |  | UINT | uMessage,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 116 of file ToolBar.c.

{
    LPTOOLTIPTEXT lpToolTipText;
    static char   szBuffer[64];

    lpToolTipText = (LPTOOLTIPTEXT)lparam;
    if (lpToolTipText->hdr.code == TTN_NEEDTEXT)
    {
        LoadString(hInst,
                   (UINT)(lpToolTipText->hdr.idFrom),   // string ID == command ID
                   szBuffer,
                   sizeof(szBuffer));

        lpToolTipText->lpszText = szBuffer;
    }
    return 0;
}

Variable Documentation

HWND hWndToolbar

Definition at line 27 of file ToolBar.c.

TBBUTTON tbButton[]
Initial value:
{
    {1, IDM_MAKECALL,   TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0},
    {2, IDM_HANGUPCALL, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0},
    {0, 0,              TBSTATE_ENABLED, TBSTYLE_SEP,    0, 0},
    {7, IDM_ABOUT,      TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0},
}

Definition at line 47 of file ToolBar.c.

Generated on Wed Nov 13 2024 16:54:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi2/TapiComm/ToolBar.h File Reference

  • NetDS
  • Tapi
  • Tapi2
  • TapiComm
Defines | Functions | Variables

ToolBar.h File Reference

Go to the source code of this file.

Defines

#define | IDB_BMP 700
#define | IDM_TOOLBAR 500

Functions

BOOL | CreateTBar (HWND)
void | EnableHangupCall (HWND hWnd, BOOL bEnable)
void | EnableMakeCall (HWND hWnd, BOOL bEnable)

Variables

HWND | hWndToolbar

Define Documentation

#define IDB_BMP 700

Definition at line 14 of file ToolBar.h.

#define IDM_TOOLBAR 500

Definition at line 13 of file ToolBar.h.

Function Documentation

BOOL CreateTBar ( HWND )

Definition at line 75 of file ToolBar.c.

{
    hWndToolbar = CreateToolbarEx(hwnd,
                                  WS_CHILD | WS_VISIBLE | TBSTYLE_TOOLTIPS,
                                  IDM_TOOLBAR,
                                  NUMIMAGES,
                                  hInst,
                                  IDB_BMP,
                                  tbButton,
                                  sizeof(tbButton)/sizeof(TBBUTTON),
                                  BUTTONWIDTH,
                                  BUTTONHEIGHT,
                                  IMAGEWIDTH,
                                  IMAGEHEIGHT,
                                  sizeof(TBBUTTON));

    return (hWndToolbar != NULL);
}

void EnableHangupCall | ( | HWND | hWnd,
 |  | BOOL | bEnable
 | ) |  |

Definition at line 143 of file ToolBar.c.

{
    EnableMenuItem(GetMenu(hWnd), IDM_HANGUPCALL, MF_BYCOMMAND |
        (bEnable ? MF_ENABLED : MF_GRAYED));
    SendMessage(hWndToolbar, TB_ENABLEBUTTON, (WPARAM) IDM_HANGUPCALL,
        (LPARAM) MAKELONG(bEnable, 0));
}

void EnableMakeCall | ( | HWND | hWnd,
 |  | BOOL | bEnable
 | ) |  |

Definition at line 134 of file ToolBar.c.

{
    EnableMenuItem(GetMenu(hWnd), IDM_MAKECALL, MF_BYCOMMAND |
        (bEnable ? MF_ENABLED : MF_GRAYED));
    SendMessage(hWndToolbar, TB_ENABLEBUTTON, (WPARAM) IDM_MAKECALL,
        (LPARAM) MAKELONG(bEnable, 0));

}

Variable Documentation

HWND hWndToolbar

Definition at line 27 of file ToolBar.c.

Generated on Wed Nov 13 2024 16:54:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi2/TapiComm/WinMain.c File Reference

  • NetDS
  • Tapi
  • Tapi2
  • TapiComm
Functions

WinMain.c File Reference

#include <windows.h>
#include "globals.h"

Go to the source code of this file.

Functions

int APIENTRY WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

Function Documentation

int APIENTRY WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 63 of file WinMain.c.

{
    MSG msg;
    HANDLE hAccelTable;

    // Initialize application by setting up the main window.
    if (!InitApplication(hInstance, nCmdShow))
    {
        return FALSE;           // Exits if unable to initialize
    }

    hAccelTable = LoadAccelerators(hInstance, szAppName);

    // Acquire and dispatch messages until a WM_QUIT message is received.
    while( GetMessage(&msg, NULL, 0, 0))
    {

        if (!TranslateAccelerator (msg.hwnd, hAccelTable, &msg))
        {
            TranslateMessage(&msg);  // Translates virtual key codes
            DispatchMessage(&msg);   // Dispatches message to window
        }
    }
    return (int)msg.wParam;  // Returns the value from PostQuitMessage
}

Generated on Wed Nov 13 2024 16:54:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/FileTerm/CallNot.cpp File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • FileTerm
Functions | Variables

CallNot.cpp File Reference

#include <windows.h>
#include <stdio.h>
#include <tchar.h>
#include <tapi3.h>
#include "callnot.h"
#include "FileTerm.h"
#include "resource.h"

Go to the source code of this file.

Functions

HRESULT | CheckStreamDir (IN ITStream *pITStream, IN TERMINAL_DIRECTION td)
HRESULT | CheckStreamMT (IN ITStream *pITStream, IN long mt)
HRESULT | CreateAndSelectFileRecordTerminal ()
HRESULT | DoCallMedia (IN IDispatch *pEvent)
HRESULT | DoCallNotification (IN IDispatch *pEvent)
HRESULT | DoCallState (IN IDispatch *pEvent)
HRESULT | DoFileEvent (IN IDispatch *pEvent)
HRESULT | GetTerminalFromStreamEvent (IN ITCallMediaEvent *pCallMediaEvent, OUT ITTerminal **ppTerminal)
HRESULT | OnTapiEvent (IN TAPI_EVENT TapiEvent, IN IDispatch *pEvent)
bool | SameCall (ITCallStateEvent *pCallStateEvent)

Variables

DWORD | g_dwMessages = 0
HWND | g_hDlg
ITBasicCallControl * | g_pCall
ITTerminal * | g_pPlayFileTerm
ITTerminal * | g_pRecordFileTerm

Function Documentation

HRESULT CheckStreamDir | ( | IN ITStream * | pITStream,
 |  | IN TERMINAL_DIRECTION | td
 | ) |  |

Definition at line 254 of file CallNot.cpp.

{
  TERMINAL_DIRECTION tdStream = TD_CAPTURE ;
  HRESULT hr =E_FAIL;
  if(FAILED(hr=pITStream->get_Direction(&tdStream)))
  {
    return hr;
  }
  if(td!=tdStream)
  {
    return S_FALSE;
  }
  else
  {
    return S_OK;
  }
}

HRESULT CheckStreamMT | ( | IN ITStream * | pITStream,
 |  | IN long | mt
 | ) |  |

Definition at line 228 of file CallNot.cpp.

{
  long mtStream = TAPIMEDIATYPE_AUDIO;
  HRESULT hr = E_FAIL;
  if(FAILED(hr=pITStream->get_MediaType(&mtStream)))
  {
    return hr;
  }
  if(!(mt&mtStream))
  {
    return S_FALSE;
  }
  else
  {
    return S_OK;
  }
}

HRESULT CreateAndSelectFileRecordTerminal ( )

Definition at line 282 of file CallNot.cpp.

{

  //
    // we should already have the call
    //
    if (NULL == g_pCall)
    {
        DoMessage( _T("CreateAndSelectFileRecordTerminal: we do not have a call"));
        return E_UNEXPECTED;
    }

    //
    // get the ITStreamControl interface for this call
    //
  ITStreamControl* pStreamControl = NULL;
    HRESULT hr = g_pCall->QueryInterface( IID_ITStreamControl, (void**)&pStreamControl );
    if (FAILED(hr))
    {
        DoMessage( _T("CreateAndSelectFileRecordTerminal: QI for ITStreamControl failed"));
        return E_FAIL;
    }

  //
  // make sure the record terminal was released
  //
  if(NULL != g_pRecordFileTerm)
  {
    g_pRecordFileTerm->Release();
    g_pRecordFileTerm = NULL;
  }

    //
  // QI for ITBasicCallControl2 - prepare to request the terminal
  //
  ITBasicCallControl2* pITBCC2 = NULL;
    hr = g_pCall->QueryInterface( IID_ITBasicCallControl2, (void**)&pITBCC2 );
  if(FAILED(hr))
  {
    pStreamControl->Release();
    DoMessage( _T("CreateAndSelectFileRecordTerminal: QI for ITBasicCallControl2 failed"));
    return hr;
  }

  //
  // get the BSTR CLSID used for ReqestTerminal
  //
  BSTR bstrCLSID = NULL;
  hr = StringFromCLSID(CLSID_FileRecordingTerminal, &bstrCLSID);
  if(FAILED(hr))
  {
    pITBCC2->Release();
    pStreamControl->Release();
    DoMessage( _T("CreateAndSelectFileRecordTerminal: StringFromCLSID failed"));
    return hr;
  }
  //
  // request the record terminal - use the right direction and media type
  //
  hr = pITBCC2->RequestTerminal(bstrCLSID,
                  TAPIMEDIATYPE_AUDIO,
                  TD_RENDER,
                  &g_pRecordFileTerm);
  //
  //clean up
  //
  ::CoTaskMemFree(bstrCLSID);
  pITBCC2->Release();
  if(FAILED(hr))
  {
    pStreamControl->Release();
    DoMessage( _T("CreateAndSelectFileRecordTerminal: RequestTerminal failed"));
    return hr;
  }

    //
    // get to the ITMediaRecord interface so we can put_FileName
  // we can NOT select before put_FileName
    //
  ITMediaRecord* pITMediaRec = NULL;
    hr = g_pRecordFileTerm->QueryInterface( IID_ITMediaRecord, (void**)&pITMediaRec );
  if(FAILED(hr))
  {
    pStreamControl->Release();
    DoMessage( _T("CreateAndSelectFileRecordTerminal: QI ITMediaRecord failed"));
    return hr;
  }

  //
  // we will have a file for each message
  //
  WCHAR wchFileName[MAX_PATH+1] = {0};
  _snwprintf(wchFileName, MAX_PATH,
                _T("%s%ld%s"), REC_FILENAME,
                  g_dwMessages, REC_FILEEXT);

  wchFileName[MAX_PATH] = 0;
  BSTR bstrFileName = ::SysAllocString(wchFileName);
  if(NULL == bstrFileName)
  {
    pStreamControl->Release();
    DoMessage( _T("CreateAndSelectFileRecordTerminal: SysAllocString failed"));
    return E_OUTOFMEMORY;
  }

  //
  // put_FileName
  //
  hr = pITMediaRec->put_FileName(bstrFileName);

  //
  //clean up
  //
  ::SysFreeString(bstrFileName);
  pITMediaRec->Release();

  if(FAILED(hr))
  {
    pStreamControl->Release();
    DoMessage( _T("CreateAndSelectFileRecordTerminal: put_FileName failed"));
    return hr;
  }

    //
    // get to the ITMultiTrackTerminal interface so we can create tracks
    //
  ITMultiTrackTerminal* pMTRecTerminal = NULL;
    hr = g_pRecordFileTerm->QueryInterface( IID_ITMultiTrackTerminal, (void**)&pMTRecTerminal );
  if(FAILED(hr))
  {
    pStreamControl->Release();
    DoMessage( _T("CreateAndSelectFileRecordTerminal: QI IID_ITMultiTrackTerminal failed"));
    return hr;
  }

    //
    // enumerate the streams on the call
    //
    IEnumStream* pEnumStreams = NULL;
    hr = pStreamControl->EnumerateStreams(&pEnumStreams);
    pStreamControl->Release();

    if (FAILED(hr))
    {
    pMTRecTerminal->Release();
    DoMessage( _T("CreateAndSelectFileRecordTerminal: EnumerateStreams failed"));
    return hr;
    }

  //
  // only do audio for now
  //
  long lMediaTypes = TAPIMEDIATYPE_AUDIO;

    //
    // walk through the list of streams on the call
    // create what we need to
    //
  ITStream* pStream = NULL;
    while (S_OK == pEnumStreams->Next(1, &pStream, NULL))
    {

        if ( (S_OK==CheckStreamMT(pStream,lMediaTypes))
        && (S_OK==CheckStreamDir(pStream,TD_RENDER)))
        {
            //
            // if we have a recording terminal, attempt to create a track terminal
            //
            ITTerminal* pRecordingTrack = NULL;

      //
      //check stream for media type - when we check we have an &
      //
      long lStreamMediaType=0;
      hr = pStream->get_MediaType(&lStreamMediaType);
            if (FAILED(hr))
            {
        pStream->Release();
        pStream=NULL;
                continue;

            }

      //
      // create track terminal
      //
            hr = pMTRecTerminal->CreateTrackTerminal(lStreamMediaType, TD_RENDER, &pRecordingTrack);
      if (FAILED(hr))
            {
        pStream->Release();
        pStream=NULL;
        //
        //will fail at the end anyway - lMediaTypes!=0 - so break here
        //
                break;

            }

            //
      //select it on stream
      //
      hr = pStream->SelectTerminal(pRecordingTrack);

      //
      //clean up
      //
      pStream->Release();
      pStream=NULL;
            pRecordingTrack->Release();
      pRecordingTrack=NULL;

            if (FAILED(hr))
            {
        //
        //will fail at the end anyway - lMediaTypes!=0 - so break here
        //
                break;
            }

      lMediaTypes^=lStreamMediaType;

      if(lMediaTypes==0)
      {
              //
        //we selected terminals for all media types we needed, we're done
        //
        break;
      }

        }
    //
    // clean up
    //
    if(pStream!=NULL)
    {
      pStream->Release();
      pStream = NULL;
    }

    } // while (enumerating streams on the call)

  //
  //clean up
  //
    pMTRecTerminal->Release();
  pEnumStreams->Release();

  //
  //check if we were able to select for all media types
  //
    if (lMediaTypes==0)
    {
        return S_OK;
    }
    else
    {
    DoMessage( _T("CreateAndSelectFileRecordTerminal: no streams available"));
        return E_FAIL;
    }
}

HRESULT DoCallMedia ( IN IDispatch * pEvent )

Definition at line 799 of file CallNot.cpp.

{

    CALL_MEDIA_EVENT    cme = CME_STREAM_INACTIVE;
    ITCallMediaEvent  * pCallMediaEvent = NULL;

  //
  // check if we still have a call
  //
  if(NULL == g_pCall)
  {
    return E_UNEXPECTED;
  }

    //
  // Get the interface
  //
    HRESULT hr = pEvent->QueryInterface( IID_ITCallMediaEvent, (void **)&pCallMediaEvent );
  if(FAILED(hr))
  {
        DoMessage( _T("ITCallMediaEvent, but failed to get the interface"));
    return hr;
  }

    //
  // get the CALL_MEDIA_EVENT that we are being notified of.
  //
    hr = pCallMediaEvent->get_Event( &cme );
  if(FAILED(hr))
  {
    pCallMediaEvent->Release();
    DoMessage( _T("ITCallMediaEvent, but failed to get_Event"));
    return hr;
  }

    switch ( cme )
    {
    //
    // the only event we process
    //
        case CME_STREAM_ACTIVE:
        {
            //
            // Get the terminal that's now active.
            //
            ITTerminal * pTerminal = NULL;
            hr = GetTerminalFromStreamEvent(pCallMediaEvent, &pTerminal);

            if ( FAILED(hr) )
      {
        DoMessage(_T("ITCallMediaEvent: GetTerminalFromStreamEvent failed"));
        g_pCall->Disconnect(DC_NORMAL);
        break;
      }

            //
            // Process this terminal based on the direction.
            //
            TERMINAL_DIRECTION td;
            hr = pTerminal->get_Direction( &td);
      //
      //clean up
      //
            pTerminal->Release();

            if ( FAILED(hr) )
            {
              DoMessage(_T("ITCallMediaEvent: get_Direction failed"));
        g_pCall->Disconnect(DC_NORMAL);
                break;
            }

      //
      // if TD_CAPTURE and we have playback terminal start streaming
      //
            if ( TD_CAPTURE == td && NULL != g_pPlayFileTerm)
            {
        ITMediaControl* pITMC = NULL;

        hr = g_pPlayFileTerm->QueryInterface(IID_ITMediaControl, (void**)&pITMC);
        //
        // get ITMediaControl so we can start streaming
        //
        if(FAILED(hr))
        {
          DoMessage(_T("ITCallMediaEvent: g_pPlayFileTerm QI for ITMediaControl failed"));
          g_pCall->Disconnect(DC_NORMAL);
          break;
        }
        //
        // Start streaming
        //
        hr = pITMC->Start();
        pITMC->Release();
        if(SUCCEEDED(hr))
        {
          SetStatusMessage(_T("File Playback Terminal started "));
        }
        else
        {
                DoMessage(_T("ITCallMediaEvent: ITMediaControl::Start() failed"));
          g_pCall->Disconnect(DC_NORMAL);
        }
      }

            break;
        }

        default:
            break;
    }

    //
  // clean up
  //
    pCallMediaEvent->Release();

  return hr;
}

HRESULT DoCallNotification ( IN IDispatch * pEvent )

Definition at line 623 of file CallNot.cpp.

{

    ITCallNotificationEvent         * pNotify = NULL;

    HRESULT hr = pEvent->QueryInterface( IID_ITCallNotificationEvent, (void **)&pNotify );

    if (FAILED(hr))
    {
        DoMessage( _T("Incoming call, but failed to get the interface"));
    return hr;
    }

    CALL_PRIVILEGE          cp = CP_MONITOR;
    ITCallInfo *            pCall = NULL;

    //
    // get the call
    //
    hr = pNotify->get_Call( &pCall );

    //
    // release the event object
    //
    pNotify->Release();

  if(FAILED(hr))
  {
    DoMessage( _T("Incoming call, but failed to get the call"));
    return hr;
  }

    //
    // check to see if we own the call
    //

    hr = pCall->get_Privilege( &cp );

  if(FAILED(hr))
  {
    pCall->Release();
    DoMessage( _T("Incoming call, but failed to get_Privilege"));
    return hr;
  }

    if ( CP_OWNER != cp )
    {
        //
    // just ignore it if we don't own it
    //
        pCall->Release();
    return hr;
    }

  //
  //check if we already have a call - if yes reject it
  //
  if(NULL != g_pCall)
  {
    ITBasicCallControl* pITBCC = NULL;

      hr = pCall->QueryInterface( IID_ITBasicCallControl, (void**)&pITBCC );
        pCall->Release();
    //
    //sanity check
    //
    if(SUCCEEDED(hr))
    {
      //
      //disconnect - we'll handle the other events from this call later
      //
      pITBCC->Disconnect(DC_REJECTED);
          pITBCC->Release();
    }
    return hr;
  }

  //
  //get the call if do not have already one
  //
    hr = pCall->QueryInterface( IID_ITBasicCallControl, (void**)&g_pCall );
  pCall->Release();
  if(FAILED(hr))
  {
    DoMessage( _T("Incoming call, but failed to QI ITBasicCallControl"));
  }
  else
  {
    //
    // update UI
    //
    SetStatusMessage(_T("Incoming Owner Call"));
  }

  //
  //clean up
  //

  return hr;
}

HRESULT DoCallState ( IN IDispatch * pEvent )

Definition at line 732 of file CallNot.cpp.

{

    CALL_STATE         cs = CS_IDLE;
    ITCallStateEvent * pCallStateEvent = NULL;

    //
  // Get the interface
  //
    HRESULT hr = pEvent->QueryInterface( IID_ITCallStateEvent, (void **)&pCallStateEvent );
  if(FAILED(hr))
  {
        DoMessage( _T("CallStateEvent, but failed to get the interface"));
    return hr;
  }

  //
  //check if same call - if it is not do not process the event
  //
  if(false == SameCall(pCallStateEvent))
  {
    pCallStateEvent->Release();
    return hr;
  }

  //
    // get the CallState that we are being notified of.
  //
    hr = pCallStateEvent->get_State( &cs );

    pCallStateEvent->Release();

  if(FAILED(hr))
  {
        DoMessage( _T("ITCallStateEvent, but failed to get_State"));
    return hr;
  }

    //
  // send messages to main dialog procedure
  //
    if (CS_OFFERING == cs)
    {
    PostMessage(g_hDlg, WM_COMMAND, IDC_ANSWER, 0);
    }
    else if (CS_DISCONNECTED == cs)
    {
        PostMessage(g_hDlg, WM_COMMAND, IDC_DISCONNECTED, 0);
    }
    else if (CS_CONNECTED == cs)
    {
        PostMessage(g_hDlg, WM_COMMAND, IDC_CONNECTED, 0);
    }

  return hr;
}

HRESULT DoFileEvent ( IN IDispatch * pEvent )

Definition at line 928 of file CallNot.cpp.

{

  //
  // check if we still have a call
  //
  if(NULL == g_pCall)
  {
    return E_UNEXPECTED;
  }

  ITFileTerminalEvent* pITFTEvent = NULL;
  HRESULT hr = pEvent->QueryInterface( IID_ITFileTerminalEvent,
                   reinterpret_cast<void **>(&pITFTEvent) );

  if (FAILED(hr))
  {
    //
    // fatal error - can not continue - disconnect the call
    //
        DoMessage( _T("ITFileTerminalEvent, but failed to get the interface"));
    g_pCall->Disconnect(DC_NORMAL);
    return hr;
  }

  //
  // get the state - we'll make some decision based on this
  //
  TERMINAL_MEDIA_STATE ftState=TMS_ACTIVE;
  hr = pITFTEvent->get_State(&ftState);
  if(FAILED(hr))
  {
    //
    // fatal error - can not continue - disconnect the call
    //
    pITFTEvent->Release();
        DoMessage( _T("ITFileTerminalEvent, but failed to get_State"));
    g_pCall->Disconnect(DC_NORMAL);
    return hr;
  }

  //
  // we are interesred in TMS_IDLE because we will unselect playback and
  // select recording
  //
  if(ftState != TMS_IDLE)
  {
    pITFTEvent->Release();
    return hr;
  }
  //
  // get the terminal
  //
  ITTerminal *pTerminal = NULL;
  hr = pITFTEvent->get_Terminal(&pTerminal);
  //
  // do not need this anymore
  //
  pITFTEvent->Release();

  if(FAILED(hr))
  {
    //
    // fatal error - can not continue - disconnect the call
    //
        DoMessage( _T("ITFileTerminalEvent, but failed to get_Terminal"));
    g_pCall->Disconnect(DC_NORMAL);
    return hr;
  }

    TERMINAL_DIRECTION td;
    hr = pTerminal->get_Direction( &td);
    pTerminal->Release();
  if(FAILED(hr))
  {
    //
    // fatal error - can not continue - disconnect the call
    //
        DoMessage( _T("ITFileTerminalEvent, but failed to get_Direction"));
    g_pCall->Disconnect(DC_NORMAL);
    return hr;
  }
  if((td == TD_CAPTURE) && (NULL != g_pPlayFileTerm))
  {
    //
    // unselect playback - it is done - we reached the end or an error
    //
    ITBasicCallControl2 *pITBCC2 = NULL;
    hr = g_pCall->QueryInterface(IID_ITBasicCallControl2, (void**)&pITBCC2);
    if(FAILED(hr))
    {
      //
      // fatal error - can not continue - disconnect the call
      //
          DoMessage( _T("ITFileTerminalEvent, but failed to QI for ITBasicCallControl2"));
      g_pCall->Disconnect(DC_NORMAL);
      return hr;
    }
    //
    // use ITBasicCallControl2 methods - much easier than
    // enumerate stream, terminals, etc
    //
    hr = pITBCC2->UnselectTerminalOnCall(g_pPlayFileTerm);
    g_pPlayFileTerm->Release();
    g_pPlayFileTerm = NULL;
    pITBCC2->Release();
    if(FAILED(hr))
    {
      //
      // fatal error - can not continue - disconnect the call
      //
          DoMessage( _T("ITFileTerminalEvent, but failed to ITBasicCallControl2::UnselectTerminalOnCall"));
      g_pCall->Disconnect(DC_NORMAL);
      return hr;
    }
    //
    // select record - do not use automatic selection
    // we'll see how to use ITMultiTrackTerminal methods
    //
    hr = CreateAndSelectFileRecordTerminal();
    if(FAILED(hr))
    {
      //
      // fatal error - can not continue - disconnect the call
      //
      g_pCall->Disconnect(DC_NORMAL);
      SetStatusMessage(_T("CreateAndSelectFileRecordTerminal failed"));
      return hr;
    }

    //
    // get ITMediaControl interface - we need to call Start
    //
    ITMediaControl* pITMC = NULL;
    hr = g_pRecordFileTerm->QueryInterface(IID_ITMediaControl, (void**)&pITMC);
    if(FAILED(hr))
    {
      //
      // fatal error - can not continue - disconnect the call
      //
          DoMessage( _T("ITFileTerminalEvent, but failed to QI ITMediaControl"));
      g_pCall->Disconnect(DC_NORMAL);
      return hr;
    }

    hr = pITMC->Start();
    pITMC->Release();
    if(FAILED(hr))
    {
      //
      // fatal error - can not continue - disconnect the call
      //
          DoMessage( _T("ITFileTerminalEvent, but ITMediaControl::Start"));
      g_pCall->Disconnect(DC_NORMAL);
      return hr;
    }

    SetStatusMessage(_T("File Record Terminal started "));

    //
    // will stop recording after one minute
    //
    SetTimer(g_hDlg, TIMER_ID, MAX_REC_TIME, NULL);
    g_dwMessages++;

  }

  return hr;
}

HRESULT GetTerminalFromStreamEvent | ( | IN ITCallMediaEvent * | pCallMediaEvent,
 |  | OUT ITTerminal ** | ppTerminal
 | ) |  |

Definition at line 49 of file CallNot.cpp.

{
  //
  //do not return bogus value
  //
    *ppTerminal = NULL;

    //
    // Get the stream for this event.
    //
    ITStream * pStream = NULL;
    HRESULT hr = pCallMediaEvent->get_Stream( &pStream );
    if (FAILED(hr))
  {
        DoMessage( _T("GetTerminalFromStreamEvent: get_Stream failed"));
    return E_FAIL;
  }

    //
    // Enumerate the terminals on this stream.
    //
    IEnumTerminal * pEnumTerminal = NULL;
    hr = pStream->EnumerateTerminals( &pEnumTerminal );

  //
  //not need this anymore
  //
    pStream->Release();

    if ( FAILED(hr) )
  {
        DoMessage(_T("GetTerminalFromStreamEvent: EnumerateTerminals failed"));
    return hr;
  }

    //
    // Get the first terminal -- if there aren't any, return E_FAIL so that
    // we skip this event (this happens when the terminal is on the other
    // stream).
    //
    hr = pEnumTerminal->Next(1, ppTerminal, NULL);

  //
  //clean up
  //
    pEnumTerminal->Release();

  //
  //map anything but S_OK to failure - even S_FALSE
  //
    if ( hr != S_OK )
  {
        return E_FAIL;
  }

    return S_OK;

}

HRESULT OnTapiEvent | ( | IN TAPI_EVENT | TapiEvent,
 |  | IN IDispatch * | pEvent
 | ) |  |

Definition at line 165 of file CallNot.cpp.

{
    HRESULT hr = E_FAIL;

    switch ( TapiEvent )
    {
        case TE_CALLNOTIFICATION:
        {
            // TE_CALLNOTIFICATION means that the application is being notified
            // of a new call.
            //
      hr = DoCallNotification(pEvent);
            break;
        }//TE_CALLNOTIFICATION

        case TE_CALLSTATE:
        {
            //
      // TE_CALLSTATE is a call state event.  pEvent is
            // an ITCallStateEvent
      //
      hr = DoCallState(pEvent);
            break;
        }//TE_CALLSTATE

        case TE_CALLMEDIA:
        {
      //
      // TE_CALLMEDIA is a media event.  pEvent is an ITCallMediaEvent
      //
      hr = DoCallMedia(pEvent);
            break;
        }//TE_CALLMEDIA

    case TE_FILETERMINAL:
    {
            //
      // TE_FILETERMINAL is a file terminal event.  pEvent is an ITFileTerminalEvent
      //
      hr = DoFileEvent(pEvent);
      break;
    }//TE_FILETERMINAL

    default:
      break;
    }

    pEvent->Release(); // we addrefed CTAPIEventNotification::Event()

    return S_OK;
}

bool SameCall ( ITCallStateEvent * pCallStateEvent )

Definition at line 553 of file CallNot.cpp.

{

  //
  // sanity check
  //
  if(NULL == pCallStateEvent)
  {
    return false;
  }

  //
  //get call object
  //
  ITCallInfo* pCallInfo = NULL;
  HRESULT hr = pCallStateEvent->get_Call(&pCallInfo);
  //
  //check if we have a call and get_Call succeded
  //
  if(NULL != pCallInfo &&  ( SUCCEEDED(hr) && NULL != g_pCall) )
  {
    bool bIsEqual = true;
    //
    //get and compare IUnknown for both objects
    //
    IUnknown* pIUnkCallInfo = NULL;
    IUnknown* pIUnkCallControl = NULL;
    pCallInfo->QueryInterface(IID_IUnknown, (void**)&pIUnkCallInfo);
    g_pCall->QueryInterface(IID_IUnknown, (void**)&pIUnkCallControl);
    //
    //compare
    //
    if(pIUnkCallInfo != pIUnkCallControl)
    {
      bIsEqual = false;
    }

    //
    //clean up
    //
    pCallInfo->Release();
    if(NULL != pIUnkCallInfo)
    {
      pIUnkCallInfo->Release();
    }
    if(NULL != pIUnkCallControl)
    {
      pIUnkCallControl->Release();
    }
    return bIsEqual;
  }
  else
  {
    return false;
  }

}

Variable Documentation

DWORD g_dwMessages = 0

Definition at line 41 of file CallNot.cpp.

HWND g_hDlg

Definition at line 51 of file bankdlg.Cpp.

ITBasicCallControl* g_pCall

Definition at line 50 of file FileTerm.cpp.

ITTerminal* g_pPlayFileTerm

Definition at line 55 of file FileTerm.cpp.

ITTerminal* g_pRecordFileTerm

Definition at line 56 of file FileTerm.cpp.

Generated on Wed Nov 13 2024 16:54:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/FileTerm/CallNot.h File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • FileTerm
Classes | Defines | Functions

CallNot.h File Reference

Go to the source code of this file.

Classes

class | CTAPIEventNotification

Defines

#define | MAX_REC_TIME 60000
#define | PLAY_FILENAME _T("Welcome.wav")
#define | REC_FILEEXT _T(".avi")
#define | REC_FILENAME _T("Message")
#define | TIMER_ID 1
#define | WM_PRIVATETAPIEVENT WM_USER+101

Functions

HRESULT | CreateAndSelectFileRecordTerminal ()
HRESULT | DoCallMedia (IN IDispatch *pEvent)
HRESULT | DoCallNotification (IN IDispatch *pEvent)
HRESULT | DoCallState (IN IDispatch *pEvent)
HRESULT | DoFileEvent (IN IDispatch *pEvent)
HRESULT | OnTapiEvent (IN TAPI_EVENT TapiEvent, IN IDispatch *pEvent)
bool | SameCall (IN ITCallStateEvent *pCallStateEvent)

Define Documentation

#define MAX_REC_TIME 60000

Definition at line 15 of file CallNot.h.

#define PLAY_FILENAME _T("Welcome.wav")

Definition at line 18 of file CallNot.h.

#define REC_FILEEXT _T(".avi")

Definition at line 20 of file CallNot.h.

#define REC_FILENAME _T("Message")

Definition at line 19 of file CallNot.h.

#define TIMER_ID 1

Definition at line 16 of file CallNot.h.

#define WM_PRIVATETAPIEVENT WM_USER+101

Definition at line 14 of file CallNot.h.

Function Documentation

HRESULT CreateAndSelectFileRecordTerminal ( )

Definition at line 282 of file CallNot.cpp.

{

  //
    // we should already have the call
    //
    if (NULL == g_pCall)
    {
        DoMessage( _T("CreateAndSelectFileRecordTerminal: we do not have a call"));
        return E_UNEXPECTED;
    }

    //
    // get the ITStreamControl interface for this call
    //
  ITStreamControl* pStreamControl = NULL;
    HRESULT hr = g_pCall->QueryInterface( IID_ITStreamControl, (void**)&pStreamControl );
    if (FAILED(hr))
    {
        DoMessage( _T("CreateAndSelectFileRecordTerminal: QI for ITStreamControl failed"));
        return E_FAIL;
    }

  //
  // make sure the record terminal was released
  //
  if(NULL != g_pRecordFileTerm)
  {
    g_pRecordFileTerm->Release();
    g_pRecordFileTerm = NULL;
  }

    //
  // QI for ITBasicCallControl2 - prepare to request the terminal
  //
  ITBasicCallControl2* pITBCC2 = NULL;
    hr = g_pCall->QueryInterface( IID_ITBasicCallControl2, (void**)&pITBCC2 );
  if(FAILED(hr))
  {
    pStreamControl->Release();
    DoMessage( _T("CreateAndSelectFileRecordTerminal: QI for ITBasicCallControl2 failed"));
    return hr;
  }

  //
  // get the BSTR CLSID used for ReqestTerminal
  //
  BSTR bstrCLSID = NULL;
  hr = StringFromCLSID(CLSID_FileRecordingTerminal, &bstrCLSID);
  if(FAILED(hr))
  {
    pITBCC2->Release();
    pStreamControl->Release();
    DoMessage( _T("CreateAndSelectFileRecordTerminal: StringFromCLSID failed"));
    return hr;
  }
  //
  // request the record terminal - use the right direction and media type
  //
  hr = pITBCC2->RequestTerminal(bstrCLSID,
                  TAPIMEDIATYPE_AUDIO,
                  TD_RENDER,
                  &g_pRecordFileTerm);
  //
  //clean up
  //
  ::CoTaskMemFree(bstrCLSID);
  pITBCC2->Release();
  if(FAILED(hr))
  {
    pStreamControl->Release();
    DoMessage( _T("CreateAndSelectFileRecordTerminal: RequestTerminal failed"));
    return hr;
  }

    //
    // get to the ITMediaRecord interface so we can put_FileName
  // we can NOT select before put_FileName
    //
  ITMediaRecord* pITMediaRec = NULL;
    hr = g_pRecordFileTerm->QueryInterface( IID_ITMediaRecord, (void**)&pITMediaRec );
  if(FAILED(hr))
  {
    pStreamControl->Release();
    DoMessage( _T("CreateAndSelectFileRecordTerminal: QI ITMediaRecord failed"));
    return hr;
  }

  //
  // we will have a file for each message
  //
  WCHAR wchFileName[MAX_PATH+1] = {0};
  _snwprintf(wchFileName, MAX_PATH,
                _T("%s%ld%s"), REC_FILENAME,
                  g_dwMessages, REC_FILEEXT);

  wchFileName[MAX_PATH] = 0;
  BSTR bstrFileName = ::SysAllocString(wchFileName);
  if(NULL == bstrFileName)
  {
    pStreamControl->Release();
    DoMessage( _T("CreateAndSelectFileRecordTerminal: SysAllocString failed"));
    return E_OUTOFMEMORY;
  }

  //
  // put_FileName
  //
  hr = pITMediaRec->put_FileName(bstrFileName);

  //
  //clean up
  //
  ::SysFreeString(bstrFileName);
  pITMediaRec->Release();

  if(FAILED(hr))
  {
    pStreamControl->Release();
    DoMessage( _T("CreateAndSelectFileRecordTerminal: put_FileName failed"));
    return hr;
  }

    //
    // get to the ITMultiTrackTerminal interface so we can create tracks
    //
  ITMultiTrackTerminal* pMTRecTerminal = NULL;
    hr = g_pRecordFileTerm->QueryInterface( IID_ITMultiTrackTerminal, (void**)&pMTRecTerminal );
  if(FAILED(hr))
  {
    pStreamControl->Release();
    DoMessage( _T("CreateAndSelectFileRecordTerminal: QI IID_ITMultiTrackTerminal failed"));
    return hr;
  }

    //
    // enumerate the streams on the call
    //
    IEnumStream* pEnumStreams = NULL;
    hr = pStreamControl->EnumerateStreams(&pEnumStreams);
    pStreamControl->Release();

    if (FAILED(hr))
    {
    pMTRecTerminal->Release();
    DoMessage( _T("CreateAndSelectFileRecordTerminal: EnumerateStreams failed"));
    return hr;
    }

  //
  // only do audio for now
  //
  long lMediaTypes = TAPIMEDIATYPE_AUDIO;

    //
    // walk through the list of streams on the call
    // create what we need to
    //
  ITStream* pStream = NULL;
    while (S_OK == pEnumStreams->Next(1, &pStream, NULL))
    {

        if ( (S_OK==CheckStreamMT(pStream,lMediaTypes))
        && (S_OK==CheckStreamDir(pStream,TD_RENDER)))
        {
            //
            // if we have a recording terminal, attempt to create a track terminal
            //
            ITTerminal* pRecordingTrack = NULL;

      //
      //check stream for media type - when we check we have an &
      //
      long lStreamMediaType=0;
      hr = pStream->get_MediaType(&lStreamMediaType);
            if (FAILED(hr))
            {
        pStream->Release();
        pStream=NULL;
                continue;

            }

      //
      // create track terminal
      //
            hr = pMTRecTerminal->CreateTrackTerminal(lStreamMediaType, TD_RENDER, &pRecordingTrack);
      if (FAILED(hr))
            {
        pStream->Release();
        pStream=NULL;
        //
        //will fail at the end anyway - lMediaTypes!=0 - so break here
        //
                break;

            }

            //
      //select it on stream
      //
      hr = pStream->SelectTerminal(pRecordingTrack);

      //
      //clean up
      //
      pStream->Release();
      pStream=NULL;
            pRecordingTrack->Release();
      pRecordingTrack=NULL;

            if (FAILED(hr))
            {
        //
        //will fail at the end anyway - lMediaTypes!=0 - so break here
        //
                break;
            }

      lMediaTypes^=lStreamMediaType;

      if(lMediaTypes==0)
      {
              //
        //we selected terminals for all media types we needed, we're done
        //
        break;
      }

        }
    //
    // clean up
    //
    if(pStream!=NULL)
    {
      pStream->Release();
      pStream = NULL;
    }

    } // while (enumerating streams on the call)

  //
  //clean up
  //
    pMTRecTerminal->Release();
  pEnumStreams->Release();

  //
  //check if we were able to select for all media types
  //
    if (lMediaTypes==0)
    {
        return S_OK;
    }
    else
    {
    DoMessage( _T("CreateAndSelectFileRecordTerminal: no streams available"));
        return E_FAIL;
    }
}

HRESULT DoCallMedia ( IN IDispatch * pEvent )

Definition at line 799 of file CallNot.cpp.

{

    CALL_MEDIA_EVENT    cme = CME_STREAM_INACTIVE;
    ITCallMediaEvent  * pCallMediaEvent = NULL;

  //
  // check if we still have a call
  //
  if(NULL == g_pCall)
  {
    return E_UNEXPECTED;
  }

    //
  // Get the interface
  //
    HRESULT hr = pEvent->QueryInterface( IID_ITCallMediaEvent, (void **)&pCallMediaEvent );
  if(FAILED(hr))
  {
        DoMessage( _T("ITCallMediaEvent, but failed to get the interface"));
    return hr;
  }

    //
  // get the CALL_MEDIA_EVENT that we are being notified of.
  //
    hr = pCallMediaEvent->get_Event( &cme );
  if(FAILED(hr))
  {
    pCallMediaEvent->Release();
    DoMessage( _T("ITCallMediaEvent, but failed to get_Event"));
    return hr;
  }

    switch ( cme )
    {
    //
    // the only event we process
    //
        case CME_STREAM_ACTIVE:
        {
            //
            // Get the terminal that's now active.
            //
            ITTerminal * pTerminal = NULL;
            hr = GetTerminalFromStreamEvent(pCallMediaEvent, &pTerminal);

            if ( FAILED(hr) )
      {
        DoMessage(_T("ITCallMediaEvent: GetTerminalFromStreamEvent failed"));
        g_pCall->Disconnect(DC_NORMAL);
        break;
      }

            //
            // Process this terminal based on the direction.
            //
            TERMINAL_DIRECTION td;
            hr = pTerminal->get_Direction( &td);
      //
      //clean up
      //
            pTerminal->Release();

            if ( FAILED(hr) )
            {
              DoMessage(_T("ITCallMediaEvent: get_Direction failed"));
        g_pCall->Disconnect(DC_NORMAL);
                break;
            }

      //
      // if TD_CAPTURE and we have playback terminal start streaming
      //
            if ( TD_CAPTURE == td && NULL != g_pPlayFileTerm)
            {
        ITMediaControl* pITMC = NULL;

        hr = g_pPlayFileTerm->QueryInterface(IID_ITMediaControl, (void**)&pITMC);
        //
        // get ITMediaControl so we can start streaming
        //
        if(FAILED(hr))
        {
          DoMessage(_T("ITCallMediaEvent: g_pPlayFileTerm QI for ITMediaControl failed"));
          g_pCall->Disconnect(DC_NORMAL);
          break;
        }
        //
        // Start streaming
        //
        hr = pITMC->Start();
        pITMC->Release();
        if(SUCCEEDED(hr))
        {
          SetStatusMessage(_T("File Playback Terminal started "));
        }
        else
        {
                DoMessage(_T("ITCallMediaEvent: ITMediaControl::Start() failed"));
          g_pCall->Disconnect(DC_NORMAL);
        }
      }

            break;
        }

        default:
            break;
    }

    //
  // clean up
  //
    pCallMediaEvent->Release();

  return hr;
}

HRESULT DoCallNotification ( IN IDispatch * pEvent )

Definition at line 623 of file CallNot.cpp.

{

    ITCallNotificationEvent         * pNotify = NULL;

    HRESULT hr = pEvent->QueryInterface( IID_ITCallNotificationEvent, (void **)&pNotify );

    if (FAILED(hr))
    {
        DoMessage( _T("Incoming call, but failed to get the interface"));
    return hr;
    }

    CALL_PRIVILEGE          cp = CP_MONITOR;
    ITCallInfo *            pCall = NULL;

    //
    // get the call
    //
    hr = pNotify->get_Call( &pCall );

    //
    // release the event object
    //
    pNotify->Release();

  if(FAILED(hr))
  {
    DoMessage( _T("Incoming call, but failed to get the call"));
    return hr;
  }

    //
    // check to see if we own the call
    //

    hr = pCall->get_Privilege( &cp );

  if(FAILED(hr))
  {
    pCall->Release();
    DoMessage( _T("Incoming call, but failed to get_Privilege"));
    return hr;
  }

    if ( CP_OWNER != cp )
    {
        //
    // just ignore it if we don't own it
    //
        pCall->Release();
    return hr;
    }

  //
  //check if we already have a call - if yes reject it
  //
  if(NULL != g_pCall)
  {
    ITBasicCallControl* pITBCC = NULL;

      hr = pCall->QueryInterface( IID_ITBasicCallControl, (void**)&pITBCC );
        pCall->Release();
    //
    //sanity check
    //
    if(SUCCEEDED(hr))
    {
      //
      //disconnect - we'll handle the other events from this call later
      //
      pITBCC->Disconnect(DC_REJECTED);
          pITBCC->Release();
    }
    return hr;
  }

  //
  //get the call if do not have already one
  //
    hr = pCall->QueryInterface( IID_ITBasicCallControl, (void**)&g_pCall );
  pCall->Release();
  if(FAILED(hr))
  {
    DoMessage( _T("Incoming call, but failed to QI ITBasicCallControl"));
  }
  else
  {
    //
    // update UI
    //
    SetStatusMessage(_T("Incoming Owner Call"));
  }

  //
  //clean up
  //

  return hr;
}

HRESULT DoCallState ( IN IDispatch * pEvent )

Definition at line 732 of file CallNot.cpp.

{

    CALL_STATE         cs = CS_IDLE;
    ITCallStateEvent * pCallStateEvent = NULL;

    //
  // Get the interface
  //
    HRESULT hr = pEvent->QueryInterface( IID_ITCallStateEvent, (void **)&pCallStateEvent );
  if(FAILED(hr))
  {
        DoMessage( _T("CallStateEvent, but failed to get the interface"));
    return hr;
  }

  //
  //check if same call - if it is not do not process the event
  //
  if(false == SameCall(pCallStateEvent))
  {
    pCallStateEvent->Release();
    return hr;
  }

  //
    // get the CallState that we are being notified of.
  //
    hr = pCallStateEvent->get_State( &cs );

    pCallStateEvent->Release();

  if(FAILED(hr))
  {
        DoMessage( _T("ITCallStateEvent, but failed to get_State"));
    return hr;
  }

    //
  // send messages to main dialog procedure
  //
    if (CS_OFFERING == cs)
    {
    PostMessage(g_hDlg, WM_COMMAND, IDC_ANSWER, 0);
    }
    else if (CS_DISCONNECTED == cs)
    {
        PostMessage(g_hDlg, WM_COMMAND, IDC_DISCONNECTED, 0);
    }
    else if (CS_CONNECTED == cs)
    {
        PostMessage(g_hDlg, WM_COMMAND, IDC_CONNECTED, 0);
    }

  return hr;
}

HRESULT DoFileEvent ( IN IDispatch * pEvent )

Definition at line 928 of file CallNot.cpp.

{

  //
  // check if we still have a call
  //
  if(NULL == g_pCall)
  {
    return E_UNEXPECTED;
  }

  ITFileTerminalEvent* pITFTEvent = NULL;
  HRESULT hr = pEvent->QueryInterface( IID_ITFileTerminalEvent,
                   reinterpret_cast<void **>(&pITFTEvent) );

  if (FAILED(hr))
  {
    //
    // fatal error - can not continue - disconnect the call
    //
        DoMessage( _T("ITFileTerminalEvent, but failed to get the interface"));
    g_pCall->Disconnect(DC_NORMAL);
    return hr;
  }

  //
  // get the state - we'll make some decision based on this
  //
  TERMINAL_MEDIA_STATE ftState=TMS_ACTIVE;
  hr = pITFTEvent->get_State(&ftState);
  if(FAILED(hr))
  {
    //
    // fatal error - can not continue - disconnect the call
    //
    pITFTEvent->Release();
        DoMessage( _T("ITFileTerminalEvent, but failed to get_State"));
    g_pCall->Disconnect(DC_NORMAL);
    return hr;
  }

  //
  // we are interesred in TMS_IDLE because we will unselect playback and
  // select recording
  //
  if(ftState != TMS_IDLE)
  {
    pITFTEvent->Release();
    return hr;
  }
  //
  // get the terminal
  //
  ITTerminal *pTerminal = NULL;
  hr = pITFTEvent->get_Terminal(&pTerminal);
  //
  // do not need this anymore
  //
  pITFTEvent->Release();

  if(FAILED(hr))
  {
    //
    // fatal error - can not continue - disconnect the call
    //
        DoMessage( _T("ITFileTerminalEvent, but failed to get_Terminal"));
    g_pCall->Disconnect(DC_NORMAL);
    return hr;
  }

    TERMINAL_DIRECTION td;
    hr = pTerminal->get_Direction( &td);
    pTerminal->Release();
  if(FAILED(hr))
  {
    //
    // fatal error - can not continue - disconnect the call
    //
        DoMessage( _T("ITFileTerminalEvent, but failed to get_Direction"));
    g_pCall->Disconnect(DC_NORMAL);
    return hr;
  }
  if((td == TD_CAPTURE) && (NULL != g_pPlayFileTerm))
  {
    //
    // unselect playback - it is done - we reached the end or an error
    //
    ITBasicCallControl2 *pITBCC2 = NULL;
    hr = g_pCall->QueryInterface(IID_ITBasicCallControl2, (void**)&pITBCC2);
    if(FAILED(hr))
    {
      //
      // fatal error - can not continue - disconnect the call
      //
          DoMessage( _T("ITFileTerminalEvent, but failed to QI for ITBasicCallControl2"));
      g_pCall->Disconnect(DC_NORMAL);
      return hr;
    }
    //
    // use ITBasicCallControl2 methods - much easier than
    // enumerate stream, terminals, etc
    //
    hr = pITBCC2->UnselectTerminalOnCall(g_pPlayFileTerm);
    g_pPlayFileTerm->Release();
    g_pPlayFileTerm = NULL;
    pITBCC2->Release();
    if(FAILED(hr))
    {
      //
      // fatal error - can not continue - disconnect the call
      //
          DoMessage( _T("ITFileTerminalEvent, but failed to ITBasicCallControl2::UnselectTerminalOnCall"));
      g_pCall->Disconnect(DC_NORMAL);
      return hr;
    }
    //
    // select record - do not use automatic selection
    // we'll see how to use ITMultiTrackTerminal methods
    //
    hr = CreateAndSelectFileRecordTerminal();
    if(FAILED(hr))
    {
      //
      // fatal error - can not continue - disconnect the call
      //
      g_pCall->Disconnect(DC_NORMAL);
      SetStatusMessage(_T("CreateAndSelectFileRecordTerminal failed"));
      return hr;
    }

    //
    // get ITMediaControl interface - we need to call Start
    //
    ITMediaControl* pITMC = NULL;
    hr = g_pRecordFileTerm->QueryInterface(IID_ITMediaControl, (void**)&pITMC);
    if(FAILED(hr))
    {
      //
      // fatal error - can not continue - disconnect the call
      //
          DoMessage( _T("ITFileTerminalEvent, but failed to QI ITMediaControl"));
      g_pCall->Disconnect(DC_NORMAL);
      return hr;
    }

    hr = pITMC->Start();
    pITMC->Release();
    if(FAILED(hr))
    {
      //
      // fatal error - can not continue - disconnect the call
      //
          DoMessage( _T("ITFileTerminalEvent, but ITMediaControl::Start"));
      g_pCall->Disconnect(DC_NORMAL);
      return hr;
    }

    SetStatusMessage(_T("File Record Terminal started "));

    //
    // will stop recording after one minute
    //
    SetTimer(g_hDlg, TIMER_ID, MAX_REC_TIME, NULL);
    g_dwMessages++;

  }

  return hr;
}

HRESULT OnTapiEvent | ( | IN TAPI_EVENT | TapiEvent,
 |  | IN IDispatch * | pEvent
 | ) |  |

Definition at line 165 of file CallNot.cpp.

{
    HRESULT hr = E_FAIL;

    switch ( TapiEvent )
    {
        case TE_CALLNOTIFICATION:
        {
            // TE_CALLNOTIFICATION means that the application is being notified
            // of a new call.
            //
      hr = DoCallNotification(pEvent);
            break;
        }//TE_CALLNOTIFICATION

        case TE_CALLSTATE:
        {
            //
      // TE_CALLSTATE is a call state event.  pEvent is
            // an ITCallStateEvent
      //
      hr = DoCallState(pEvent);
            break;
        }//TE_CALLSTATE

        case TE_CALLMEDIA:
        {
      //
      // TE_CALLMEDIA is a media event.  pEvent is an ITCallMediaEvent
      //
      hr = DoCallMedia(pEvent);
            break;
        }//TE_CALLMEDIA

    case TE_FILETERMINAL:
    {
            //
      // TE_FILETERMINAL is a file terminal event.  pEvent is an ITFileTerminalEvent
      //
      hr = DoFileEvent(pEvent);
      break;
    }//TE_FILETERMINAL

    default:
      break;
    }

    pEvent->Release(); // we addrefed CTAPIEventNotification::Event()

    return S_OK;
}

bool SameCall ( IN ITCallStateEvent * pCallStateEvent )
Generated on Wed Nov 13 2024 16:54:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/FileTerm/FileTerm.cpp File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • FileTerm
Functions | Variables

FileTerm.cpp File Reference

#include <windows.h>
#include <tchar.h>
#include <tapi3.h>
#include "FileTerm.h"
#include "callnot.h"
#include "resource.h"

Go to the source code of this file.

Functions

HRESULT | AnswerTheCall ()
HRESULT | DisconnectTheCall ()
void | DoMessage (IN LPWSTR pszMessage)
HRESULT | InitializeTapi ()
HRESULT | ListenOnAddresses ()
HRESULT | ListenOnThisAddress (IN ITAddress *pAddress)
INT_PTR CALLBACK | MainDialogProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
HRESULT | PutPlayList (IN ITTerminal *pITTerminal, IN BSTR bstrFileName)
HRESULT | RegisterTapiEventInterface ()
void | ReleaseTheCall ()
void | SetStatusMessage (IN LPWSTR pszMessage)
void | ShutdownTapi ()
HRESULT | UnRegisterTapiEventInterface ()
int WINAPI | WinMain (HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow)

Variables

HWND | g_hDlg = NULL
ITBasicCallControl * | g_pCall = NULL
ITTerminal * | g_pPlayFileTerm = NULL
ITTerminal * | g_pRecordFileTerm = NULL
ITTAPI * | g_pTapi = NULL
ULONG | g_ulAdvise = 0

Function Documentation

HRESULT AnswerTheCall ( )

Definition at line 739 of file FileTerm.cpp.

{

  //
  // check if call available
  //
    if (NULL == g_pCall)
    {
        DoMessage( _T("AnswerTheCall: call not available"));
        return E_UNEXPECTED;
    }

  //
  // it should not happen, but if you have already the terminal release it
  //
    if(NULL != g_pPlayFileTerm)
  {
    g_pPlayFileTerm->Release();
    g_pPlayFileTerm = NULL;
  }

    //
  // prepare to request the terminal - need ITBasicCallControl2 interface
  //
    ITBasicCallControl2*    pITBCC2 = NULL;
    HRESULT hr = g_pCall->QueryInterface( IID_ITBasicCallControl2, (void**)&pITBCC2 );
  if(FAILED(hr))
  {
        DoMessage( _T("AnswerTheCall: QI ITBasicCallControl2 failed"));
        g_pCall->Disconnect(DC_NORMAL);
    return hr;
  }

    //
  // prepare to request the terminal - need CLSID BSTR
  //
  BSTR bstrCLSID = NULL;
  hr = StringFromCLSID(CLSID_FilePlaybackTerminal, &bstrCLSID);
  if(FAILED(hr))
  {
    pITBCC2->Release();
        DoMessage( _T("AnswerTheCall: StringFromCLSID failed"));
        g_pCall->Disconnect(DC_NORMAL);
    return hr;
  }

  //
  //request the terminal using right media type and direction
  //
  hr = pITBCC2->RequestTerminal(bstrCLSID,
                  TAPIMEDIATYPE_AUDIO,
                  TD_CAPTURE,
                  &g_pPlayFileTerm);
  //
  //clean up
  //
  ::CoTaskMemFree(bstrCLSID);

  if(FAILED(hr))
  {
    pITBCC2->Release();
        DoMessage( _T("AnswerTheCall: RequestTerminal failed"));
        g_pCall->Disconnect(DC_NORMAL);
    return hr;
  }

  //
  // prepare to put the file name
  //
  BSTR bstrFileName = ::SysAllocString(PLAY_FILENAME);

  if(NULL == bstrFileName)
  {
    g_pPlayFileTerm->Release();
    g_pPlayFileTerm = NULL;
    pITBCC2->Release();
        DoMessage( _T("AnswerTheCall: SysAllocString for play list failed"));
        g_pCall->Disconnect(DC_NORMAL);
    return E_OUTOFMEMORY;
  }

  //
  // call helper method for put_PlayList
  //
  hr = PutPlayList(g_pPlayFileTerm, bstrFileName);

  //
  // free the file name
  //
  ::SysFreeString(bstrFileName);

  if(FAILED(hr))
  {
    g_pPlayFileTerm->Release();
    g_pPlayFileTerm = NULL;
    pITBCC2->Release();
    DoMessage( _T("AnswerTheCall: PutPlayList failed"));
    g_pCall->Disconnect(DC_NORMAL);
    return hr;
  }

  //
  //select the terminal using ITBasicCallControl2 method
  //
  hr = pITBCC2->SelectTerminalOnCall(g_pPlayFileTerm);
  if(FAILED(hr))
  {
    g_pPlayFileTerm->Release();
    g_pPlayFileTerm = NULL;
    pITBCC2->Release();
        DoMessage( _T("AnswerTheCall: SelectTerminalOnCall failed"));
        g_pCall->Disconnect(DC_NORMAL);
    return hr;
  }

  //
  //finally answer the call
  //
    hr = g_pCall->Answer();
  if(FAILED(hr))
  {
    g_pPlayFileTerm->Release();
    g_pPlayFileTerm = NULL;
    pITBCC2->Release();
        DoMessage( _T("AnswerTheCall: Answer failed"));
        g_pCall->Disconnect(DC_NORMAL);
    return hr;
  }

  //
  //if we are here we are OK
  //
  pITBCC2->Release();
    return S_OK;
}

HRESULT DisconnectTheCall ( )

Definition at line 884 of file FileTerm.cpp.

{
  //
  //disconnect the call
  //
    if (NULL != g_pCall)
    {
    //
    // we will release the call and terminals on disconnected notification.
    //
        return g_pCall->Disconnect( DC_NORMAL );

    }

    return E_FAIL;
}

void DoMessage ( IN LPWSTR pszMessage )

Definition at line 954 of file FileTerm.cpp.

{
    ::MessageBox(
               g_hDlg,
               pszMessage,
               MSGBOX_NAME,
               MB_OK
              );
}

HRESULT InitializeTapi ( )

Definition at line 123 of file FileTerm.cpp.

{
    HRESULT         hr;

    //
  // cocreate the TAPI object
  //
    hr = CoCreateInstance(
                          CLSID_TAPI,
                          NULL,
                          CLSCTX_INPROC_SERVER,
                          IID_ITTAPI,
                          (LPVOID *)&g_pTapi
                         );

    if (FAILED(hr))
    {
        DoMessage(_T("InitializeTapi: CoCreateInstance on TAPI failed"));
        return hr;
    }

    //
  // call initialize.  this must be called before any other tapi functions are called.
  //
    hr = g_pTapi->Initialize();

    if (FAILED(hr))
    {
        g_pTapi->Release();
        g_pTapi = NULL;
        DoMessage(_T("InitializeTapi: TAPI failed to initialize"));
        return hr;
    }

  //
  //register event callback object
  //
    hr = RegisterTapiEventInterface();
    if (FAILED(hr))
  {
        //
        // shutdown and release TAPI
        //
        g_pTapi->Shutdown();
        g_pTapi->Release();
        g_pTapi = NULL;
        DoMessage(_T("InitializeTapi: RegisterTapiEventInterface failed"));
        return hr;
  }

    //
  // put the Event filter to only give us only the events we process
  //
    hr = g_pTapi->put_EventFilter(TE_CALLNOTIFICATION | TE_CALLSTATE | TE_CALLMEDIA | TE_FILETERMINAL);
    if (FAILED(hr))
  {
        //
        // unregister callback
        //
    UnRegisterTapiEventInterface();
        //
        // shutdown and release TAPI
        //
        g_pTapi->Shutdown();
        g_pTapi->Release();
        g_pTapi = NULL;
        DoMessage(_T("InitializeTapi: put_EventFilter failed"));
        return hr;
  }

    // find all address objects that
    // we will use to listen for calls on
    hr = ListenOnAddresses();

    if (FAILED(hr))
    {
        //
        // unregister callback
        //
    UnRegisterTapiEventInterface();
        //
        // shutdown and release TAPI
        //
        g_pTapi->Shutdown();
        g_pTapi->Release();
        g_pTapi = NULL;
        DoMessage(_T("InitializeTapi: ListenOnAddresses failed"));
    }

    return hr;

}

HRESULT ListenOnAddresses ( )

Definition at line 613 of file FileTerm.cpp.

{
    HRESULT             hr = S_OK;
    IEnumAddress *      pEnumAddress = NULL;
    ITAddress *         pAddress = NULL;
    ITMediaSupport *    pMediaSupport = NULL;
    VARIANT_BOOL        bSupport = VARIANT_FALSE;
  BOOL        bAddressFound = FALSE;

    // enumerate the addresses
    hr = g_pTapi->EnumerateAddresses( &pEnumAddress );

    if (FAILED(hr))
    {
        DoMessage(_T("ListenOnAddresses: EnumerateAddresses failed"));
        return hr;
    }

  //
  // loop for all addresses
  //

    while ( S_OK == pEnumAddress->Next( 1, &pAddress, NULL ) )
    {

        hr = pAddress->QueryInterface( IID_ITMediaSupport, (void **)&pMediaSupport );
    if(FAILED(hr))
    {
          pAddress->Release();
      continue;
    }

    //
        // does it support Audio
    //
        hr = pMediaSupport->QueryMediaType(
                                      TAPIMEDIATYPE_AUDIO,
                                      &bSupport
                                     );

        pMediaSupport->Release();

    if(FAILED(hr))
    {
          pAddress->Release();
      continue;
    }

        if (bSupport)
        {
            //
      // If it does support then we'll listen.
      //
            hr = ListenOnThisAddress( pAddress );
            if (SUCCEEDED(hr))
            {
                bAddressFound = TRUE;
            }
        }
        pAddress->Release();
    }

  //
  //clean up
  //

    pEnumAddress->Release();

  if(!bAddressFound)
  {
        DoMessage(_T("ListenOnAddresses: not address found"));
    return E_FAIL;
  }
  else
  {
    return S_OK;
  }

}

HRESULT ListenOnThisAddress ( IN ITAddress * pAddress )

Definition at line 706 of file FileTerm.cpp.

{

    //
    // RegisterCallNotifications takes a media type bitmap indicating
    // the set of media types we are interested in. We know the
    // address supports audio.
    //

    long     lRegister = 0;

    return g_pTapi->RegisterCallNotifications(
                                           pAddress,
                                           VARIANT_FALSE,
                                           VARIANT_TRUE,
                                           TAPIMEDIATYPE_AUDIO,
                                           0,
                                           &lRegister
                                          );

}

INT_PTR CALLBACK MainDialogProc | ( | HWND | hDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 319 of file FileTerm.cpp.

{
    switch (uMsg)
    {
        case WM_PRIVATETAPIEVENT:
        {
      //
      //Process TAPI event
      //
          OnTapiEvent(
                        (TAPI_EVENT) wParam,
                        (IDispatch *) lParam
                       );

            return 0;
        }

        case WM_INITDIALOG:
        {
            //
      // store dialog window handle
      //
            g_hDlg = hDlg;

            SetStatusMessage( _T("Waiting for a call..."));

            return 0;
        }

        case WM_COMMAND:
        {
            if ( LOWORD(wParam) == IDCANCEL )
            {

        ShutdownTapi();
                //
                // quit
                //
                EndDialog( hDlg, 0 );

                return 1;
            }

            switch ( LOWORD(wParam) )
            {
                //
        // offering notification
        //
                case IDC_ANSWER:
                {
                    SetStatusMessage(_T("Answering..."));
                    // answer the call
                    if ( S_OK == AnswerTheCall() )
                    {
                        SetStatusMessage(_T("Connecting..."));
                    }
                    else
                    {
                        DoMessage(_T("Answer failed"));
                        SetStatusMessage(_T("Waiting for a call..."));
                    }

                    return 1;
                }

                //
        // connect notification
        //
                case IDC_CONNECTED:
                {
                    SetStatusMessage(_T("Connected; waiting for file playback terminal to run..."));

                    return 1;
                }

                //
        // disconnected notification
        //
                case IDC_DISCONNECTED:
                {
                    //
          // release internal call objetcs
          //
                    ReleaseTheCall();

                    SetStatusMessage(_T("Waiting for a call..."));

                    return 1;
                }
                default:

                    return 0;
            }
        }
        case WM_TIMER:
        {
      //
      //disconnect the call when maximum record time is reached
      //it will unselect the terminal too
      //
            if ( g_pCall != NULL )
            {
                SetStatusMessage(_T("Disconnecting..."));

                //
        // disconnect the call
        //
                if (S_OK != DisconnectTheCall())
                {
                    DoMessage(_T("Disconnect failed"));
                }
            }

            return 1;
        }
        default:

            return 0;
    }
}

HRESULT PutPlayList | ( | IN ITTerminal * | pITTerminal,
 |  | IN BSTR | bstrFileName
 | ) |  |

Definition at line 990 of file FileTerm.cpp.

{
  //
  //check if really have a terminal
  //
  if(NULL == pITTerminal)
  {
        DoMessage( _T("PutPlayList: playback terminal NULL"));
    return E_UNEXPECTED;
  }

  //
    // Get ITMediaPlayback interface - only playback terminal object
  // exposes this interface
  //
    ITMediaPlayback*    pMediaPlayback = NULL;

    HRESULT hr = pITTerminal->QueryInterface(
                    IID_ITMediaPlayback,
                    (void**)&pMediaPlayback);

  if(FAILED(hr))
  {
        DoMessage( _T("PutPlayList: QI ITMediaPlayback failed"));
    return hr;
  }

  //
  //VARIANT to be passed to put_PlayList
  //
  VARIANT varPlaylist;
  VariantInit(&varPlaylist);

  //
  //Prepare SAFEARRAYBOUND for SAFEARRAY
  //Put file name into array with one element
  //
    SAFEARRAYBOUND DimensionBounds;
    DimensionBounds.lLbound = 1;

  //
  //number of files in play list - modify for more files
  //
    DimensionBounds.cElements = 1;

    //
  // Put file name into array at index 1 - see lLbound
  //
    long lArrayPos = 1;

  //
  //variant that will hold the BSTR - it will be added to SAFEARRAY
  //
    VARIANT* pvarArrayEntry = new VARIANT;
    if( pvarArrayEntry == NULL)
    {
        DoMessage( _T("PutPlayList: new VARIANT failed"));
        return E_OUTOFMEMORY;
    }
  VariantInit(pvarArrayEntry);

    //
  // Create SAFEARRAY
  //
    SAFEARRAY *pPlayListArray = NULL;
    pPlayListArray = SafeArrayCreate( VT_VARIANT, 1, &DimensionBounds);
    if( pPlayListArray == NULL)
    {
        DoMessage( _T("PutPlayList: SafeArrayCreate failed"));
    delete pvarArrayEntry;
        return E_OUTOFMEMORY;
    }

  //
  //repeat this for each file you want to add
  //you need to increment lArrayPos
  //
    pvarArrayEntry->vt = VT_BSTR;
    pvarArrayEntry->bstrVal = ::SysAllocString(bstrFileName);
    SafeArrayPutElement( pPlayListArray, &lArrayPos, pvarArrayEntry);
  VariantClear(pvarArrayEntry);

  //
  //prepare the variant for put_PlayList
  //
    V_VT(&varPlaylist) = VT_ARRAY | VT_VARIANT;
    V_ARRAY(&varPlaylist) = pPlayListArray;

  //
  //finally put play list
  //
    hr = pMediaPlayback->put_PlayList(varPlaylist);
    if(FAILED(hr))
    {
        DoMessage( _T("PutPlayList: put_PlayList failed"));
    delete pvarArrayEntry;
        return E_OUTOFMEMORY;
    }

  //
  //clean up
  //
  delete pvarArrayEntry;
    pMediaPlayback->Release();
  VariantClear(&varPlaylist);

    return hr;
}

HRESULT RegisterTapiEventInterface ( )

Definition at line 460 of file FileTerm.cpp.

{
    HRESULT                       hr = S_OK;
    IConnectionPointContainer   * pCPC = NULL;
    IConnectionPoint            * pCP = NULL;

    hr = g_pTapi->QueryInterface(
                                IID_IConnectionPointContainer,
                                (void **)&pCPC
                               );

    if (!SUCCEEDED(hr))
    {
        DoMessage(_T("RegisterTapiEventInterface: ")
                 _T("Failed to get IConnectionPointContainer on TAPI"));
        return hr;
    }

    hr = pCPC->FindConnectionPoint(
                                   IID_ITTAPIEventNotification,
                                   &pCP
                                  );
    pCPC->Release();

    if (!SUCCEEDED(hr))
    {
        DoMessage(_T("RegisterTapiEventInterface: Failed to get a connection point for ")
                 _T("ITTAPIEventNotification"));
        return hr;
    }

  //
  //create event callback object
  //
    CTAPIEventNotification* pTAPIEventNotification = new CTAPIEventNotification;
  if(NULL == pTAPIEventNotification)
  {
        DoMessage(_T("RegisterTapiEventInterface: Could not create CTAPIEventNotification"));
        return E_OUTOFMEMORY;
  }
  //
  //advise the callback object - it will be released by Unadvise
  //
    hr = pCP->Advise(
                      pTAPIEventNotification,
                      &g_ulAdvise
                     );

    pCP->Release();
    //
    // whether Advise failed or succeeded - Advise already addrefed the object,
  // we no longer need a reference to the callback object
    //
    pTAPIEventNotification->Release();
    pTAPIEventNotification = NULL;

    if (FAILED(hr))
  {
        DoMessage(_T("RegisterTapiEventInterface: Advise failed"));
  }

    return hr;

}

void ReleaseTheCall ( )

Definition at line 909 of file FileTerm.cpp.

{
  //
  //do not the timer anymore anymore
  //
  KillTimer(g_hDlg, TIMER_ID);

  //
  //release the terminals
  //
  if(NULL != g_pPlayFileTerm)
  {
    g_pPlayFileTerm->Release();
    g_pPlayFileTerm = NULL;
  }
  if(NULL != g_pRecordFileTerm)
  {
    g_pRecordFileTerm->Release();
    g_pRecordFileTerm = NULL;
  }
  //
  //release the call object - this will unselect all selected terminals
  //
    if (NULL != g_pCall)
    {
        g_pCall->Release();
        g_pCall = NULL;
    }
}

void SetStatusMessage ( IN LPWSTR pszMessage )

Definition at line 973 of file FileTerm.cpp.

{
    ::SetDlgItemText(
                   g_hDlg,
                   IDC_STATUS,
                   pszMessage
                  );
}

void ShutdownTapi ( )

Definition at line 226 of file FileTerm.cpp.

{
    //
    // unregister callback
    //
  UnRegisterTapiEventInterface();
    //
    // if there is still a call, disconnect and release it
    //
    DisconnectTheCall();
  //
  //
  //
    ReleaseTheCall();
  //
  //wait for TAPI to cool off (2 sec. may be too short)
  //maybe there was an event sent by PostMessage but not processed yet
    //
  {
    //
    //we need an event for MsgWaitForMultipleObjectsEx
    //
    HANDLE hDumbEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
    while(NULL != hDumbEvent)
    {

      DWORD dwStatus;
      MSG msg;

      dwStatus=::MsgWaitForMultipleObjectsEx(1,
                    &hDumbEvent,
                    TAPI_TIMEOUT,
                    QS_ALLPOSTMESSAGE,
                    MWMO_ALERTABLE);
      if(dwStatus != WAIT_TIMEOUT)
      {
        while(TRUE == ::PeekMessage(&msg,
            g_hDlg,//only from post thread
            NULL,
            NULL,
            PM_REMOVE))
        {
          //
          //if not TAPI event translate and dispatch it
          //
          if(msg.message != WM_PRIVATETAPIEVENT)
          {
            ::TranslateMessage(&msg);
            ::DispatchMessage(&msg);
          }
          //
          //TAPI event
          //
          else
          {
            if((IDispatch *) msg.lParam != NULL)
            {
              //release the event
              ((IDispatch *) msg.lParam)->Release();
              msg.lParam = NULL;
            }
          }
        }
      }
      else
      {
        ::CloseHandle(hDumbEvent);
        hDumbEvent = NULL;
      }
    }
  }
    //
    // release main TAPI object.
    //

    if (NULL != g_pTapi)
    {
        g_pTapi->Shutdown();
        g_pTapi->Release();
    g_pTapi = NULL;

    }
}

HRESULT UnRegisterTapiEventInterface ( )

Definition at line 544 of file FileTerm.cpp.

{
    HRESULT hr = S_OK;
    IConnectionPointContainer *pCPC = NULL;
    IConnectionPoint *pCP = NULL;

    //
    // get connection point container on the tapi object
    //

    hr = g_pTapi->QueryInterface(IID_IConnectionPointContainer,
                                (void **)&pCPC);

    if (FAILED(hr))
    {
        DoMessage(_T("UnRegisterTapiEventInterface: ")
                 _T("Failed to get IConnectionPointContainer on TAPI"));
        return hr;
    }

    //
    // find connection point for our interface
    //

    hr = pCPC->FindConnectionPoint(IID_ITTAPIEventNotification,
                                           &pCP);

    pCPC->Release();
    pCPC = NULL;

    if (FAILED(hr))
    {
        DoMessage(_T("UnRegisterTapiEventInterface: Failed to get a connection point for ")
                 _T("ITTAPIEventNotification"));

        return hr;
    }

    //
    // unregister the callback
    //

    hr = pCP->Unadvise(g_ulAdvise);

    pCP->Release();
    pCP = NULL;

    g_ulAdvise = 0;

    if (FAILED(hr))
  {
        DoMessage(_T("UnRegisterTapiEventInterface: Unadvise failed"));
  }

    return hr;
}

int WINAPI WinMain | ( | HINSTANCE | hInst,
 |  | HINSTANCE | hPrevInst,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 74 of file FileTerm.cpp.

{
  //
  // need to coinitialize
  //
    if (!SUCCEEDED(CoInitializeEx(NULL, COINIT_MULTITHREADED)))
    {
        return 0;
    }

  //
  // do all tapi initialization
  //
    if (S_OK == InitializeTapi())
    {
    //
    // everything is initialized, so start the main dialog box
    //
    DialogBox(
          hInst,
          MAKEINTRESOURCE(IDD_MAINDLG),
          NULL,
          MainDialogProc
         );
  }

    //
    // When EndDialog is called, we get here; clean up and exit.
    //

    CoUninitialize();

    return 1;
}

Variable Documentation

HWND g_hDlg = NULL

Definition at line 44 of file FileTerm.cpp.

ITBasicCallControl* g_pCall = NULL

Definition at line 50 of file FileTerm.cpp.

ITTerminal* g_pPlayFileTerm = NULL

Definition at line 55 of file FileTerm.cpp.

ITTerminal* g_pRecordFileTerm = NULL

Definition at line 56 of file FileTerm.cpp.

ITTAPI* g_pTapi = NULL

Definition at line 49 of file FileTerm.cpp.

ULONG g_ulAdvise = 0

Definition at line 61 of file FileTerm.cpp.

Generated on Wed Nov 13 2024 16:54:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/FileTerm/FileTerm.h File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • FileTerm
Defines | Functions

FileTerm.h File Reference

Go to the source code of this file.

Defines

#define | MSGBOX_NAME _T("TAPI 3.1 File Terminals Sample")
#define | TAPI_TIMEOUT 2000

Functions

HRESULT | AnswerTheCall ()
HRESULT | DisconnectTheCall ()
void | DoMessage (IN LPWSTR pszMessage)
HRESULT | GetTerminal (IN ITAddress *, IN BSTR bstrMedia, OUT ITTerminal **ppTerminal)
HRESULT | InitializeTapi ()
HRESULT | ListenOnAddresses ()
HRESULT | ListenOnThisAddress (IN ITAddress *pAddress)
INT_PTR CALLBACK | MainDialogProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
HRESULT | PutPlayList (IN ITTerminal *pITTerminal, IN BSTR bstrFileName)
HRESULT | RegisterTapiEventInterface ()
void | ReleaseTheCall ()
void | SetStatusMessage (IN LPWSTR pszMessage)
void | ShutdownTapi ()
HRESULT | UnRegisterTapiEventInterface ()

Define Documentation

#define MSGBOX_NAME _T("TAPI 3.1 File Terminals Sample")

Definition at line 14 of file FileTerm.h.

#define TAPI_TIMEOUT 2000

Definition at line 13 of file FileTerm.h.

Function Documentation

HRESULT AnswerTheCall ( )

Definition at line 739 of file FileTerm.cpp.

{

  //
  // check if call available
  //
    if (NULL == g_pCall)
    {
        DoMessage( _T("AnswerTheCall: call not available"));
        return E_UNEXPECTED;
    }

  //
  // it should not happen, but if you have already the terminal release it
  //
    if(NULL != g_pPlayFileTerm)
  {
    g_pPlayFileTerm->Release();
    g_pPlayFileTerm = NULL;
  }

    //
  // prepare to request the terminal - need ITBasicCallControl2 interface
  //
    ITBasicCallControl2*    pITBCC2 = NULL;
    HRESULT hr = g_pCall->QueryInterface( IID_ITBasicCallControl2, (void**)&pITBCC2 );
  if(FAILED(hr))
  {
        DoMessage( _T("AnswerTheCall: QI ITBasicCallControl2 failed"));
        g_pCall->Disconnect(DC_NORMAL);
    return hr;
  }

    //
  // prepare to request the terminal - need CLSID BSTR
  //
  BSTR bstrCLSID = NULL;
  hr = StringFromCLSID(CLSID_FilePlaybackTerminal, &bstrCLSID);
  if(FAILED(hr))
  {
    pITBCC2->Release();
        DoMessage( _T("AnswerTheCall: StringFromCLSID failed"));
        g_pCall->Disconnect(DC_NORMAL);
    return hr;
  }

  //
  //request the terminal using right media type and direction
  //
  hr = pITBCC2->RequestTerminal(bstrCLSID,
                  TAPIMEDIATYPE_AUDIO,
                  TD_CAPTURE,
                  &g_pPlayFileTerm);
  //
  //clean up
  //
  ::CoTaskMemFree(bstrCLSID);

  if(FAILED(hr))
  {
    pITBCC2->Release();
        DoMessage( _T("AnswerTheCall: RequestTerminal failed"));
        g_pCall->Disconnect(DC_NORMAL);
    return hr;
  }

  //
  // prepare to put the file name
  //
  BSTR bstrFileName = ::SysAllocString(PLAY_FILENAME);

  if(NULL == bstrFileName)
  {
    g_pPlayFileTerm->Release();
    g_pPlayFileTerm = NULL;
    pITBCC2->Release();
        DoMessage( _T("AnswerTheCall: SysAllocString for play list failed"));
        g_pCall->Disconnect(DC_NORMAL);
    return E_OUTOFMEMORY;
  }

  //
  // call helper method for put_PlayList
  //
  hr = PutPlayList(g_pPlayFileTerm, bstrFileName);

  //
  // free the file name
  //
  ::SysFreeString(bstrFileName);

  if(FAILED(hr))
  {
    g_pPlayFileTerm->Release();
    g_pPlayFileTerm = NULL;
    pITBCC2->Release();
    DoMessage( _T("AnswerTheCall: PutPlayList failed"));
    g_pCall->Disconnect(DC_NORMAL);
    return hr;
  }

  //
  //select the terminal using ITBasicCallControl2 method
  //
  hr = pITBCC2->SelectTerminalOnCall(g_pPlayFileTerm);
  if(FAILED(hr))
  {
    g_pPlayFileTerm->Release();
    g_pPlayFileTerm = NULL;
    pITBCC2->Release();
        DoMessage( _T("AnswerTheCall: SelectTerminalOnCall failed"));
        g_pCall->Disconnect(DC_NORMAL);
    return hr;
  }

  //
  //finally answer the call
  //
    hr = g_pCall->Answer();
  if(FAILED(hr))
  {
    g_pPlayFileTerm->Release();
    g_pPlayFileTerm = NULL;
    pITBCC2->Release();
        DoMessage( _T("AnswerTheCall: Answer failed"));
        g_pCall->Disconnect(DC_NORMAL);
    return hr;
  }

  //
  //if we are here we are OK
  //
  pITBCC2->Release();
    return S_OK;
}

HRESULT DisconnectTheCall ( )

Definition at line 884 of file FileTerm.cpp.

{
  //
  //disconnect the call
  //
    if (NULL != g_pCall)
    {
    //
    // we will release the call and terminals on disconnected notification.
    //
        return g_pCall->Disconnect( DC_NORMAL );

    }

    return E_FAIL;
}

void DoMessage ( IN LPWSTR pszMessage )

Definition at line 954 of file FileTerm.cpp.

{
    ::MessageBox(
               g_hDlg,
               pszMessage,
               MSGBOX_NAME,
               MB_OK
              );
}

HRESULT GetTerminal | ( | IN ITAddress * | ,
 |  | IN BSTR | bstrMedia,
 |  | OUT ITTerminal ** | ppTerminal
 | ) |  |
HRESULT InitializeTapi ( )

Definition at line 123 of file FileTerm.cpp.

{
    HRESULT         hr;

    //
  // cocreate the TAPI object
  //
    hr = CoCreateInstance(
                          CLSID_TAPI,
                          NULL,
                          CLSCTX_INPROC_SERVER,
                          IID_ITTAPI,
                          (LPVOID *)&g_pTapi
                         );

    if (FAILED(hr))
    {
        DoMessage(_T("InitializeTapi: CoCreateInstance on TAPI failed"));
        return hr;
    }

    //
  // call initialize.  this must be called before any other tapi functions are called.
  //
    hr = g_pTapi->Initialize();

    if (FAILED(hr))
    {
        g_pTapi->Release();
        g_pTapi = NULL;
        DoMessage(_T("InitializeTapi: TAPI failed to initialize"));
        return hr;
    }

  //
  //register event callback object
  //
    hr = RegisterTapiEventInterface();
    if (FAILED(hr))
  {
        //
        // shutdown and release TAPI
        //
        g_pTapi->Shutdown();
        g_pTapi->Release();
        g_pTapi = NULL;
        DoMessage(_T("InitializeTapi: RegisterTapiEventInterface failed"));
        return hr;
  }

    //
  // put the Event filter to only give us only the events we process
  //
    hr = g_pTapi->put_EventFilter(TE_CALLNOTIFICATION | TE_CALLSTATE | TE_CALLMEDIA | TE_FILETERMINAL);
    if (FAILED(hr))
  {
        //
        // unregister callback
        //
    UnRegisterTapiEventInterface();
        //
        // shutdown and release TAPI
        //
        g_pTapi->Shutdown();
        g_pTapi->Release();
        g_pTapi = NULL;
        DoMessage(_T("InitializeTapi: put_EventFilter failed"));
        return hr;
  }

    // find all address objects that
    // we will use to listen for calls on
    hr = ListenOnAddresses();

    if (FAILED(hr))
    {
        //
        // unregister callback
        //
    UnRegisterTapiEventInterface();
        //
        // shutdown and release TAPI
        //
        g_pTapi->Shutdown();
        g_pTapi->Release();
        g_pTapi = NULL;
        DoMessage(_T("InitializeTapi: ListenOnAddresses failed"));
    }

    return hr;

}

HRESULT ListenOnAddresses ( )

Definition at line 613 of file FileTerm.cpp.

{
    HRESULT             hr = S_OK;
    IEnumAddress *      pEnumAddress = NULL;
    ITAddress *         pAddress = NULL;
    ITMediaSupport *    pMediaSupport = NULL;
    VARIANT_BOOL        bSupport = VARIANT_FALSE;
  BOOL        bAddressFound = FALSE;

    // enumerate the addresses
    hr = g_pTapi->EnumerateAddresses( &pEnumAddress );

    if (FAILED(hr))
    {
        DoMessage(_T("ListenOnAddresses: EnumerateAddresses failed"));
        return hr;
    }

  //
  // loop for all addresses
  //

    while ( S_OK == pEnumAddress->Next( 1, &pAddress, NULL ) )
    {

        hr = pAddress->QueryInterface( IID_ITMediaSupport, (void **)&pMediaSupport );
    if(FAILED(hr))
    {
          pAddress->Release();
      continue;
    }

    //
        // does it support Audio
    //
        hr = pMediaSupport->QueryMediaType(
                                      TAPIMEDIATYPE_AUDIO,
                                      &bSupport
                                     );

        pMediaSupport->Release();

    if(FAILED(hr))
    {
          pAddress->Release();
      continue;
    }

        if (bSupport)
        {
            //
      // If it does support then we'll listen.
      //
            hr = ListenOnThisAddress( pAddress );
            if (SUCCEEDED(hr))
            {
                bAddressFound = TRUE;
            }
        }
        pAddress->Release();
    }

  //
  //clean up
  //

    pEnumAddress->Release();

  if(!bAddressFound)
  {
        DoMessage(_T("ListenOnAddresses: not address found"));
    return E_FAIL;
  }
  else
  {
    return S_OK;
  }

}

HRESULT ListenOnThisAddress ( IN ITAddress * pAddress )

Definition at line 706 of file FileTerm.cpp.

{

    //
    // RegisterCallNotifications takes a media type bitmap indicating
    // the set of media types we are interested in. We know the
    // address supports audio.
    //

    long     lRegister = 0;

    return g_pTapi->RegisterCallNotifications(
                                           pAddress,
                                           VARIANT_FALSE,
                                           VARIANT_TRUE,
                                           TAPIMEDIATYPE_AUDIO,
                                           0,
                                           &lRegister
                                          );

}

INT_PTR CALLBACK MainDialogProc | ( | HWND | hDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 319 of file FileTerm.cpp.

{
    switch (uMsg)
    {
        case WM_PRIVATETAPIEVENT:
        {
      //
      //Process TAPI event
      //
          OnTapiEvent(
                        (TAPI_EVENT) wParam,
                        (IDispatch *) lParam
                       );

            return 0;
        }

        case WM_INITDIALOG:
        {
            //
      // store dialog window handle
      //
            g_hDlg = hDlg;

            SetStatusMessage( _T("Waiting for a call..."));

            return 0;
        }

        case WM_COMMAND:
        {
            if ( LOWORD(wParam) == IDCANCEL )
            {

        ShutdownTapi();
                //
                // quit
                //
                EndDialog( hDlg, 0 );

                return 1;
            }

            switch ( LOWORD(wParam) )
            {
                //
        // offering notification
        //
                case IDC_ANSWER:
                {
                    SetStatusMessage(_T("Answering..."));
                    // answer the call
                    if ( S_OK == AnswerTheCall() )
                    {
                        SetStatusMessage(_T("Connecting..."));
                    }
                    else
                    {
                        DoMessage(_T("Answer failed"));
                        SetStatusMessage(_T("Waiting for a call..."));
                    }

                    return 1;
                }

                //
        // connect notification
        //
                case IDC_CONNECTED:
                {
                    SetStatusMessage(_T("Connected; waiting for file playback terminal to run..."));

                    return 1;
                }

                //
        // disconnected notification
        //
                case IDC_DISCONNECTED:
                {
                    //
          // release internal call objetcs
          //
                    ReleaseTheCall();

                    SetStatusMessage(_T("Waiting for a call..."));

                    return 1;
                }
                default:

                    return 0;
            }
        }
        case WM_TIMER:
        {
      //
      //disconnect the call when maximum record time is reached
      //it will unselect the terminal too
      //
            if ( g_pCall != NULL )
            {
                SetStatusMessage(_T("Disconnecting..."));

                //
        // disconnect the call
        //
                if (S_OK != DisconnectTheCall())
                {
                    DoMessage(_T("Disconnect failed"));
                }
            }

            return 1;
        }
        default:

            return 0;
    }
}

HRESULT PutPlayList | ( | IN ITTerminal * | pITTerminal,
 |  | IN BSTR | bstrFileName
 | ) |  |

Definition at line 990 of file FileTerm.cpp.

{
  //
  //check if really have a terminal
  //
  if(NULL == pITTerminal)
  {
        DoMessage( _T("PutPlayList: playback terminal NULL"));
    return E_UNEXPECTED;
  }

  //
    // Get ITMediaPlayback interface - only playback terminal object
  // exposes this interface
  //
    ITMediaPlayback*    pMediaPlayback = NULL;

    HRESULT hr = pITTerminal->QueryInterface(
                    IID_ITMediaPlayback,
                    (void**)&pMediaPlayback);

  if(FAILED(hr))
  {
        DoMessage( _T("PutPlayList: QI ITMediaPlayback failed"));
    return hr;
  }

  //
  //VARIANT to be passed to put_PlayList
  //
  VARIANT varPlaylist;
  VariantInit(&varPlaylist);

  //
  //Prepare SAFEARRAYBOUND for SAFEARRAY
  //Put file name into array with one element
  //
    SAFEARRAYBOUND DimensionBounds;
    DimensionBounds.lLbound = 1;

  //
  //number of files in play list - modify for more files
  //
    DimensionBounds.cElements = 1;

    //
  // Put file name into array at index 1 - see lLbound
  //
    long lArrayPos = 1;

  //
  //variant that will hold the BSTR - it will be added to SAFEARRAY
  //
    VARIANT* pvarArrayEntry = new VARIANT;
    if( pvarArrayEntry == NULL)
    {
        DoMessage( _T("PutPlayList: new VARIANT failed"));
        return E_OUTOFMEMORY;
    }
  VariantInit(pvarArrayEntry);

    //
  // Create SAFEARRAY
  //
    SAFEARRAY *pPlayListArray = NULL;
    pPlayListArray = SafeArrayCreate( VT_VARIANT, 1, &DimensionBounds);
    if( pPlayListArray == NULL)
    {
        DoMessage( _T("PutPlayList: SafeArrayCreate failed"));
    delete pvarArrayEntry;
        return E_OUTOFMEMORY;
    }

  //
  //repeat this for each file you want to add
  //you need to increment lArrayPos
  //
    pvarArrayEntry->vt = VT_BSTR;
    pvarArrayEntry->bstrVal = ::SysAllocString(bstrFileName);
    SafeArrayPutElement( pPlayListArray, &lArrayPos, pvarArrayEntry);
  VariantClear(pvarArrayEntry);

  //
  //prepare the variant for put_PlayList
  //
    V_VT(&varPlaylist) = VT_ARRAY | VT_VARIANT;
    V_ARRAY(&varPlaylist) = pPlayListArray;

  //
  //finally put play list
  //
    hr = pMediaPlayback->put_PlayList(varPlaylist);
    if(FAILED(hr))
    {
        DoMessage( _T("PutPlayList: put_PlayList failed"));
    delete pvarArrayEntry;
        return E_OUTOFMEMORY;
    }

  //
  //clean up
  //
  delete pvarArrayEntry;
    pMediaPlayback->Release();
  VariantClear(&varPlaylist);

    return hr;
}

HRESULT RegisterTapiEventInterface ( )

Definition at line 460 of file FileTerm.cpp.

{
    HRESULT                       hr = S_OK;
    IConnectionPointContainer   * pCPC = NULL;
    IConnectionPoint            * pCP = NULL;

    hr = g_pTapi->QueryInterface(
                                IID_IConnectionPointContainer,
                                (void **)&pCPC
                               );

    if (!SUCCEEDED(hr))
    {
        DoMessage(_T("RegisterTapiEventInterface: ")
                 _T("Failed to get IConnectionPointContainer on TAPI"));
        return hr;
    }

    hr = pCPC->FindConnectionPoint(
                                   IID_ITTAPIEventNotification,
                                   &pCP
                                  );
    pCPC->Release();

    if (!SUCCEEDED(hr))
    {
        DoMessage(_T("RegisterTapiEventInterface: Failed to get a connection point for ")
                 _T("ITTAPIEventNotification"));
        return hr;
    }

  //
  //create event callback object
  //
    CTAPIEventNotification* pTAPIEventNotification = new CTAPIEventNotification;
  if(NULL == pTAPIEventNotification)
  {
        DoMessage(_T("RegisterTapiEventInterface: Could not create CTAPIEventNotification"));
        return E_OUTOFMEMORY;
  }
  //
  //advise the callback object - it will be released by Unadvise
  //
    hr = pCP->Advise(
                      pTAPIEventNotification,
                      &g_ulAdvise
                     );

    pCP->Release();
    //
    // whether Advise failed or succeeded - Advise already addrefed the object,
  // we no longer need a reference to the callback object
    //
    pTAPIEventNotification->Release();
    pTAPIEventNotification = NULL;

    if (FAILED(hr))
  {
        DoMessage(_T("RegisterTapiEventInterface: Advise failed"));
  }

    return hr;

}

void ReleaseTheCall ( )

Definition at line 909 of file FileTerm.cpp.

{
  //
  //do not the timer anymore anymore
  //
  KillTimer(g_hDlg, TIMER_ID);

  //
  //release the terminals
  //
  if(NULL != g_pPlayFileTerm)
  {
    g_pPlayFileTerm->Release();
    g_pPlayFileTerm = NULL;
  }
  if(NULL != g_pRecordFileTerm)
  {
    g_pRecordFileTerm->Release();
    g_pRecordFileTerm = NULL;
  }
  //
  //release the call object - this will unselect all selected terminals
  //
    if (NULL != g_pCall)
    {
        g_pCall->Release();
        g_pCall = NULL;
    }
}

void SetStatusMessage ( IN LPWSTR pszMessage )

Definition at line 973 of file FileTerm.cpp.

{
    ::SetDlgItemText(
                   g_hDlg,
                   IDC_STATUS,
                   pszMessage
                  );
}

void ShutdownTapi ( )

Definition at line 226 of file FileTerm.cpp.

{
    //
    // unregister callback
    //
  UnRegisterTapiEventInterface();
    //
    // if there is still a call, disconnect and release it
    //
    DisconnectTheCall();
  //
  //
  //
    ReleaseTheCall();
  //
  //wait for TAPI to cool off (2 sec. may be too short)
  //maybe there was an event sent by PostMessage but not processed yet
    //
  {
    //
    //we need an event for MsgWaitForMultipleObjectsEx
    //
    HANDLE hDumbEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
    while(NULL != hDumbEvent)
    {

      DWORD dwStatus;
      MSG msg;

      dwStatus=::MsgWaitForMultipleObjectsEx(1,
                    &hDumbEvent,
                    TAPI_TIMEOUT,
                    QS_ALLPOSTMESSAGE,
                    MWMO_ALERTABLE);
      if(dwStatus != WAIT_TIMEOUT)
      {
        while(TRUE == ::PeekMessage(&msg,
            g_hDlg,//only from post thread
            NULL,
            NULL,
            PM_REMOVE))
        {
          //
          //if not TAPI event translate and dispatch it
          //
          if(msg.message != WM_PRIVATETAPIEVENT)
          {
            ::TranslateMessage(&msg);
            ::DispatchMessage(&msg);
          }
          //
          //TAPI event
          //
          else
          {
            if((IDispatch *) msg.lParam != NULL)
            {
              //release the event
              ((IDispatch *) msg.lParam)->Release();
              msg.lParam = NULL;
            }
          }
        }
      }
      else
      {
        ::CloseHandle(hDumbEvent);
        hDumbEvent = NULL;
      }
    }
  }
    //
    // release main TAPI object.
    //

    if (NULL != g_pTapi)
    {
        g_pTapi->Shutdown();
        g_pTapi->Release();
    g_pTapi = NULL;

    }
}

HRESULT UnRegisterTapiEventInterface ( )

Definition at line 544 of file FileTerm.cpp.

{
    HRESULT hr = S_OK;
    IConnectionPointContainer *pCPC = NULL;
    IConnectionPoint *pCP = NULL;

    //
    // get connection point container on the tapi object
    //

    hr = g_pTapi->QueryInterface(IID_IConnectionPointContainer,
                                (void **)&pCPC);

    if (FAILED(hr))
    {
        DoMessage(_T("UnRegisterTapiEventInterface: ")
                 _T("Failed to get IConnectionPointContainer on TAPI"));
        return hr;
    }

    //
    // find connection point for our interface
    //

    hr = pCPC->FindConnectionPoint(IID_ITTAPIEventNotification,
                                           &pCP);

    pCPC->Release();
    pCPC = NULL;

    if (FAILED(hr))
    {
        DoMessage(_T("UnRegisterTapiEventInterface: Failed to get a connection point for ")
                 _T("ITTAPIEventNotification"));

        return hr;
    }

    //
    // unregister the callback
    //

    hr = pCP->Unadvise(g_ulAdvise);

    pCP->Release();
    pCP = NULL;

    g_ulAdvise = 0;

    if (FAILED(hr))
  {
        DoMessage(_T("UnRegisterTapiEventInterface: Unadvise failed"));
  }

    return hr;
}

Generated on Wed Nov 13 2024 16:54:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/FileTerm/Resource.h File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • FileTerm
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_ANSWER 1001
#define | IDC_CONNECTED 1003
#define | IDC_DISCONNECTED 1002
#define | IDC_STATIC -1
#define | IDC_STATUS 1000
#define | IDD_MAINDLG 101

Define Documentation

#define IDC_ANSWER 1001

Definition at line 13 of file Resource.h.

#define IDC_CONNECTED 1003

Definition at line 15 of file Resource.h.

#define IDC_DISCONNECTED 1002

Definition at line 14 of file Resource.h.

#define IDC_STATIC -1

Definition at line 16 of file Resource.h.

#define IDC_STATUS 1000

Definition at line 12 of file Resource.h.

#define IDD_MAINDLG 101

Definition at line 11 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/Incoming/Callnot.Cpp File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • Incoming
Enumerations | Functions | Variables

Callnot.Cpp File Reference

#include <windows.h>
#include <tapi3.h>
#include <control.h>
#include <strmif.h>
#include "callnot.h"
#include "resource.h"

Go to the source code of this file.

Enumerations

enum | { VWP_LEFT = 20, VWP_TOP = 100 }

Functions

void | DisableButton (int ID)
void | DoMessage (LPWSTR pszMessage)
void | EnableButton (int ID)
HRESULT | GetVideoRenderTerminalFromStreamEvent (ITCallMediaEvent *pCallMediaEvent, ITTerminal **ppTerminal, BOOL *pfRenderStream)
void | HostWindow (IVideoWindow *pVideoWindow, int iWhere)
HRESULT | OnTapiEvent (TAPI_EVENT TapiEvent, IDispatch *pEvent)
void | SetStatusMessage (LPWSTR pszMessage)

Variables

BSTR | gbstrVideo
BOOL gfAutoAnswer
HWND | ghDlg
ITBasicCallControl * | gpCall

Enumeration Type Documentation

anonymous enum
Enumerator:
VWP_LEFT
VWP_TOP

Definition at line 57 of file Callnot.Cpp.

     {
    VWP_LEFT = 20,
    VWP_TOP = 100
};

Function Documentation

void DisableButton ( int ID )

Definition at line 1052 of file Incoming.Cpp.

{
    SendDlgItemMessage(
                       ghDlg,
                       ID,
                       BM_SETSTYLE,
                       BS_PUSHBUTTON,
                       0
                      );
    EnableWindow(
                 GetDlgItem( ghDlg, ID ),
                 FALSE
                );
}

void DoMessage ( LPWSTR pszMessage )

Definition at line 989 of file Incoming.Cpp.

{
    MessageBox(
               ghDlg,
               pszMessage,
               gszTapi30,
               MB_OK
              );
}

void EnableButton ( int ID )

Definition at line 1025 of file Incoming.Cpp.

{
    SendDlgItemMessage(
                       ghDlg,
                       ID,
                       BM_SETSTYLE,
                       BS_DEFPUSHBUTTON,
                       0
                      );
    EnableWindow(
                 GetDlgItem( ghDlg, ID ),
                 TRUE
                );
    SetFocus(
             GetDlgItem( ghDlg, ID )
            );
}

HRESULT GetVideoRenderTerminalFromStreamEvent | ( | ITCallMediaEvent * | pCallMediaEvent,
 |  | ITTerminal ** | ppTerminal,
 |  | BOOL * | pfRenderStream
 | ) |  |

Definition at line 105 of file Callnot.Cpp.

{
    HRESULT hr;

    //
    // Get the stream for this event.
    //

    ITStream * pStream;

    hr = pCallMediaEvent->get_Stream( &pStream );

    if ( FAILED(hr) || (pStream == NULL) )
    {
        return E_FAIL;
    }

    //
    // Find out if this is a video stream. If not, fail --
    // we don't care about this stream.
    //

    long lMediaType;

    hr = pStream->get_MediaType(&lMediaType);

    if ( FAILED(hr) )
    {
        pStream->Release();

        return hr;
    }

    if ( lMediaType != TAPIMEDIATYPE_VIDEO )
    {
        pStream->Release();

        return E_FAIL;
    }

    //
    // Find out the direction of this stream. We will return this info to the
    // caller.
    //

    TERMINAL_DIRECTION td;

    hr = pStream->get_Direction(&td);

    if ( FAILED(hr) )
    {
        pStream->Release();

        return hr;
    }

    *pfRenderStream = (td == TD_RENDER);

    //
    // Enumerate the terminals on this stream.
    //

    IEnumTerminal * pEnumTerminal;

    hr = pStream->EnumerateTerminals( &pEnumTerminal );

    pStream->Release();

    if ( FAILED(hr) )
    {
        return hr;
    }

    //
    // Search for the first video render terminal and return it. If there are
    // none, fail -- we don't care about this stream.
    //

    while ( S_OK == pEnumTerminal->Next(1, ppTerminal, NULL) )
    {
        if ( SUCCEEDED( (*ppTerminal)->get_Direction(&td) ) )
        {
            if ( td == TD_RENDER )
            {
                // found it; done with enum, but keep ref on terminal
                pEnumTerminal->Release();

                return S_OK;
            }
        }

        // this is not the right one
        (*ppTerminal)->Release();
    }

    pEnumTerminal->Release();

    return E_FAIL; // no terminal found
}

void HostWindow | ( | IVideoWindow * | pVideoWindow,
 |  | int | iWhere
 | ) |  |

Definition at line 73 of file Callnot.Cpp.

{

    pVideoWindow->put_Owner( (LONG_PTR)ghDlg );
    pVideoWindow->put_WindowStyle( WS_CHILDWINDOW | WS_BORDER );

    long lWidth, lHeight;
    pVideoWindow->get_Width( &lWidth );
    pVideoWindow->get_Height( &lHeight );

    pVideoWindow->SetWindowPosition( VWP_LEFT + (iWhere * (VWP_LEFT + lWidth)),
                                     VWP_TOP,
                                     lWidth,
                                     lHeight );

    pVideoWindow->put_Visible( VARIANT_TRUE );
}

HRESULT OnTapiEvent | ( | TAPI_EVENT | TapiEvent,
 |  | IDispatch * | pEvent
 | ) |  |

Definition at line 255 of file Callnot.Cpp.

{
    HRESULT hr;

    switch ( TapiEvent )
    {
        case TE_CALLNOTIFICATION:
        {
            //
            // TE_CALLNOTIFICATION means that the application is being notified
            // of a new call.
            //
            // Note that we don't answer to call at this point.  The application
            // should wait for a CS_OFFERING CallState message before answering
            // the call.
            //

            ITCallNotificationEvent         * pNotify;

            hr = pEvent->QueryInterface( IID_ITCallNotificationEvent, (void **)&pNotify );

            if (S_OK != hr)
            {
                DoMessage( L"Incoming call, but failed to get the interface");
            }
            else
            {
                CALL_PRIVILEGE          cp;
                ITCallInfo *            pCall;

                //
                // get the call
                //

                hr = pNotify->get_Call( &pCall );

                pNotify->Release();

                if ( SUCCEEDED(hr) )
                {
                    //
                    // check to see if we own the call
                    //

                    hr = pCall->get_Privilege( &cp );

                    if ( FAILED(hr) || (CP_OWNER != cp) )
                    {
                        //
                        // just ignore it if we don't own it
                        //

                        pCall->Release();

                        pEvent->Release(); // we addrefed it CTAPIEventNotification::Event()

                        return S_OK;
                    }

                    //
                    // Get the ITBasicCallControl interface
                    //

                    //
                    // If we're already in a call, disconnect the new call.  Otherwise,
                    // save it in our global variable.
                    //

                    ITBasicCallControl * pCallControl;

                    hr = pCall->QueryInterface( IID_ITBasicCallControl,
                                                (void**)&pCallControl );

                    pCall->Release();

                    if ( SUCCEEDED(hr) )
                    {
                        if (gpCall == NULL)
                        {
                            gpCall = pCallControl;

                            //
                            // update UI
                            //

                            EnableButton( IDC_ANSWER );
                            DisableButton( IDC_DISCONNECT );
                            SetStatusMessage(L"Incoming Owner Call");
                        }
                        else
                        {
                            //
                            // Reject this call since we're already in a call
                            //

                            hr = pCallControl->Disconnect(DC_REJECTED);

                            pCallControl->Release();

                            if (FAILED(hr))
                            {
                                break;
                            }
                        }
                    }

                }
            }

            break;
        }

        case TE_CALLSTATE:
        {
            // TE_CALLSTATE is a call state event.  pEvent is
            // an ITCallStateEvent

            CALL_STATE           cs;
            ITCallStateEvent   * pCallStateEvent;
            ITCallInfo *         pCall;
            ITBasicCallControl * pCallControl;

            // Get the interface
            hr = pEvent->QueryInterface( IID_ITCallStateEvent, (void **)&pCallStateEvent );

            if ( FAILED(hr) )
            {
                break;
            }

            // get the CallInfo interface
            hr = pCallStateEvent->get_Call( &pCall );

            if ( FAILED(hr) )
            {
                pCallStateEvent->Release();
                break;
            }

            //get the ITBasicCallControl interface and compare it to our existing call
            hr = pCall->QueryInterface( IID_ITBasicCallControl,(void**)&pCallControl );

            pCall->Release();

            if (FAILED(hr))
            {
                pCallStateEvent->Release();
                break;
            }

            //ignore call state events for other calls
            if (pCallControl != gpCall)
            {
                pCallControl->Release();
                pCallStateEvent->Release();
                break;
            }
            pCallControl->Release();

            //
            // This is a call state event for our call
            //

            // get the CallState that we are being notified of.
            hr = pCallStateEvent->get_State( &cs );

            // Release the interface
            pCallStateEvent->Release();

            if ( FAILED(hr) )
            {
                break;
            }

            // if it's offering, update our UI
            if (CS_OFFERING == cs)
            {
                if (gfAutoAnswer)
                {
                    PostMessage(ghDlg, WM_COMMAND, IDC_ANSWER, 0);
                }
                else
                {
                    SetStatusMessage(L"Click the Answer button");
                }
            }
            else if (CS_DISCONNECTED == cs)
            {
                PostMessage(ghDlg, WM_COMMAND, IDC_DISCONNECTED, 0);
            }
            else if (CS_CONNECTED == cs)
            {
                // nothing to do -- we handle connection synchronously
            }

            break;
        }

        case TE_CALLMEDIA:
        {
            // TE_CALLMEDIA is a media event.  pEvent is
            // an ITCallMediaEvent

            CALL_MEDIA_EVENT    cme;
            ITCallMediaEvent  * pCallMediaEvent;

            // Get the interface
            hr = pEvent->QueryInterface( IID_ITCallMediaEvent, (void **)&pCallMediaEvent );

            if ( FAILED(hr) )
            {
                break;
            }

            // get the CALL_MEDIA_EVENT that we are being notified of.
            hr = pCallMediaEvent->get_Event( &cme );

            if ( SUCCEEDED(hr) )
            {
                switch ( cme )
                {
                case CME_STREAM_NOT_USED:
                case CME_STREAM_INACTIVE:
                case CME_NEW_STREAM:
                    break;

                case CME_STREAM_FAIL:
                    DoMessage( L"Call media event: stream failed");
                    break;

                case CME_TERMINAL_FAIL:
                    DoMessage( L"Call media event: terminal failed");
                    break;

                case CME_STREAM_ACTIVE:
                {
                    //
                    // Find out if this stream has a video render terminal. If not,
                    // we don't need to do anything with this stream. Also note
                    // if this is the video capture stream or the video render
                    // stream.
                    //

                    ITTerminal * pTerminal;
                    BOOL         fRenderStream;

                    hr = GetVideoRenderTerminalFromStreamEvent(
                                                               pCallMediaEvent,
                                                               &pTerminal,
                                                               &fRenderStream
                                                              );

                    if ( SUCCEEDED(hr) )
                    {
                        // Get the video window interface for the terminal
                        IVideoWindow *pVideoWindow = NULL;

                        hr = pTerminal->QueryInterface( IID_IVideoWindow, (void**)&pVideoWindow );

                        pTerminal->Release();

                        if ( SUCCEEDED(hr) )
                        {
                            // Put this window in our dialog
                            HostWindow(pVideoWindow, fRenderStream);

                            pVideoWindow->Release();
                        }
                    }

                    break;
                }

                default:
                    break;
                }
            }

            // We no longer need this interface.
            pCallMediaEvent->Release();

            break;
        }

        default:
            break;
    }

    pEvent->Release(); // we addrefed it CTAPIEventNotification::Event()

    return S_OK;
}

void SetStatusMessage ( LPWSTR pszMessage )

Definition at line 1007 of file Incoming.Cpp.

{
    SetDlgItemText(
                   ghDlg,
                   IDC_STATUS,
                   pszMessage
                  );
}

Variable Documentation

BSTR gbstrVideo
BOOL gfAutoAnswer

Definition at line 44 of file Incoming.Cpp.

HWND ghDlg

Definition at line 42 of file Incoming.Cpp.

ITBasicCallControl* gpCall

Definition at line 41 of file Incoming.Cpp.

Generated on Wed Nov 13 2024 16:54:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/Incoming/Callnot.h File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • Incoming
Classes | Defines | Functions

Callnot.h File Reference

Go to the source code of this file.

Classes

class | CTAPIEventNotification

Defines

#define | WM_PRIVATETAPIEVENT WM_USER+101

Functions

HRESULT | OnTapiEvent (TAPI_EVENT TapiEvent, IDispatch *pEvent)

Define Documentation

#define WM_PRIVATETAPIEVENT WM_USER+101

Definition at line 17 of file Callnot.h.

Function Documentation

HRESULT OnTapiEvent | ( | TAPI_EVENT | TapiEvent,
 |  | IDispatch * | pEvent
 | ) |  |

Definition at line 255 of file Callnot.Cpp.

{
    HRESULT hr;

    switch ( TapiEvent )
    {
        case TE_CALLNOTIFICATION:
        {
            //
            // TE_CALLNOTIFICATION means that the application is being notified
            // of a new call.
            //
            // Note that we don't answer to call at this point.  The application
            // should wait for a CS_OFFERING CallState message before answering
            // the call.
            //

            ITCallNotificationEvent         * pNotify;

            hr = pEvent->QueryInterface( IID_ITCallNotificationEvent, (void **)&pNotify );

            if (S_OK != hr)
            {
                DoMessage( L"Incoming call, but failed to get the interface");
            }
            else
            {
                CALL_PRIVILEGE          cp;
                ITCallInfo *            pCall;

                //
                // get the call
                //

                hr = pNotify->get_Call( &pCall );

                pNotify->Release();

                if ( SUCCEEDED(hr) )
                {
                    //
                    // check to see if we own the call
                    //

                    hr = pCall->get_Privilege( &cp );

                    if ( FAILED(hr) || (CP_OWNER != cp) )
                    {
                        //
                        // just ignore it if we don't own it
                        //

                        pCall->Release();

                        pEvent->Release(); // we addrefed it CTAPIEventNotification::Event()

                        return S_OK;
                    }

                    //
                    // Get the ITBasicCallControl interface
                    //

                    //
                    // If we're already in a call, disconnect the new call.  Otherwise,
                    // save it in our global variable.
                    //

                    ITBasicCallControl * pCallControl;

                    hr = pCall->QueryInterface( IID_ITBasicCallControl,
                                                (void**)&pCallControl );

                    pCall->Release();

                    if ( SUCCEEDED(hr) )
                    {
                        if (gpCall == NULL)
                        {
                            gpCall = pCallControl;

                            //
                            // update UI
                            //

                            EnableButton( IDC_ANSWER );
                            DisableButton( IDC_DISCONNECT );
                            SetStatusMessage(L"Incoming Owner Call");
                        }
                        else
                        {
                            //
                            // Reject this call since we're already in a call
                            //

                            hr = pCallControl->Disconnect(DC_REJECTED);

                            pCallControl->Release();

                            if (FAILED(hr))
                            {
                                break;
                            }
                        }
                    }

                }
            }

            break;
        }

        case TE_CALLSTATE:
        {
            // TE_CALLSTATE is a call state event.  pEvent is
            // an ITCallStateEvent

            CALL_STATE           cs;
            ITCallStateEvent   * pCallStateEvent;
            ITCallInfo *         pCall;
            ITBasicCallControl * pCallControl;

            // Get the interface
            hr = pEvent->QueryInterface( IID_ITCallStateEvent, (void **)&pCallStateEvent );

            if ( FAILED(hr) )
            {
                break;
            }

            // get the CallInfo interface
            hr = pCallStateEvent->get_Call( &pCall );

            if ( FAILED(hr) )
            {
                pCallStateEvent->Release();
                break;
            }

            //get the ITBasicCallControl interface and compare it to our existing call
            hr = pCall->QueryInterface( IID_ITBasicCallControl,(void**)&pCallControl );

            pCall->Release();

            if (FAILED(hr))
            {
                pCallStateEvent->Release();
                break;
            }

            //ignore call state events for other calls
            if (pCallControl != gpCall)
            {
                pCallControl->Release();
                pCallStateEvent->Release();
                break;
            }
            pCallControl->Release();

            //
            // This is a call state event for our call
            //

            // get the CallState that we are being notified of.
            hr = pCallStateEvent->get_State( &cs );

            // Release the interface
            pCallStateEvent->Release();

            if ( FAILED(hr) )
            {
                break;
            }

            // if it's offering, update our UI
            if (CS_OFFERING == cs)
            {
                if (gfAutoAnswer)
                {
                    PostMessage(ghDlg, WM_COMMAND, IDC_ANSWER, 0);
                }
                else
                {
                    SetStatusMessage(L"Click the Answer button");
                }
            }
            else if (CS_DISCONNECTED == cs)
            {
                PostMessage(ghDlg, WM_COMMAND, IDC_DISCONNECTED, 0);
            }
            else if (CS_CONNECTED == cs)
            {
                // nothing to do -- we handle connection synchronously
            }

            break;
        }

        case TE_CALLMEDIA:
        {
            // TE_CALLMEDIA is a media event.  pEvent is
            // an ITCallMediaEvent

            CALL_MEDIA_EVENT    cme;
            ITCallMediaEvent  * pCallMediaEvent;

            // Get the interface
            hr = pEvent->QueryInterface( IID_ITCallMediaEvent, (void **)&pCallMediaEvent );

            if ( FAILED(hr) )
            {
                break;
            }

            // get the CALL_MEDIA_EVENT that we are being notified of.
            hr = pCallMediaEvent->get_Event( &cme );

            if ( SUCCEEDED(hr) )
            {
                switch ( cme )
                {
                case CME_STREAM_NOT_USED:
                case CME_STREAM_INACTIVE:
                case CME_NEW_STREAM:
                    break;

                case CME_STREAM_FAIL:
                    DoMessage( L"Call media event: stream failed");
                    break;

                case CME_TERMINAL_FAIL:
                    DoMessage( L"Call media event: terminal failed");
                    break;

                case CME_STREAM_ACTIVE:
                {
                    //
                    // Find out if this stream has a video render terminal. If not,
                    // we don't need to do anything with this stream. Also note
                    // if this is the video capture stream or the video render
                    // stream.
                    //

                    ITTerminal * pTerminal;
                    BOOL         fRenderStream;

                    hr = GetVideoRenderTerminalFromStreamEvent(
                                                               pCallMediaEvent,
                                                               &pTerminal,
                                                               &fRenderStream
                                                              );

                    if ( SUCCEEDED(hr) )
                    {
                        // Get the video window interface for the terminal
                        IVideoWindow *pVideoWindow = NULL;

                        hr = pTerminal->QueryInterface( IID_IVideoWindow, (void**)&pVideoWindow );

                        pTerminal->Release();

                        if ( SUCCEEDED(hr) )
                        {
                            // Put this window in our dialog
                            HostWindow(pVideoWindow, fRenderStream);

                            pVideoWindow->Release();
                        }
                    }

                    break;
                }

                default:
                    break;
                }
            }

            // We no longer need this interface.
            pCallMediaEvent->Release();

            break;
        }

        default:
            break;
    }

    pEvent->Release(); // we addrefed it CTAPIEventNotification::Event()

    return S_OK;
}

Generated on Wed Nov 13 2024 16:54:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/Incoming/Incoming.Cpp File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • Incoming
Functions | Variables

Incoming.Cpp File Reference

#include <windows.h>
#include <tapi3.h>
#include <control.h>
#include "callnot.h"
#include "resource.h"

Go to the source code of this file.

Functions

BOOL | AddressSupportsMediaType (ITAddress *pAddress, long lMediaType)
HRESULT | AnswerTheCall ()
void | DisableButton (int ID)
HRESULT | DisconnectTheCall ()
void | DoMessage (LPWSTR pszMessage)
void | EnableButton (int ID)
HRESULT | EnablePreview (ITAddress *pAddress, ITStream *pStream)
HRESULT | GetTerminal (ITAddress *pAddress, ITStream *pStream, ITTerminal **ppTerminal)
HRESULT | GetVideoRenderTerminal (ITAddress *pAddress, ITTerminal **ppTerminal)
HRESULT | InitializeTapi ()
BOOL | IsVideoCaptureStream (ITStream *pStream)
HRESULT | ListenOnAddresses ()
HRESULT | ListenOnThisAddress (ITAddress *pAddress)
INT_PTR CALLBACK | MainDialogProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
HRESULT | RegisterTapiEventInterface (CTAPIEventNotification *pTAPIEventNotification)
void | ReleaseTheCall ()
HRESULT | SelectTerminalsOnCall (ITAddress *pAddress, ITBasicCallControl *pCall)
void | SetStatusMessage (LPWSTR pszMessage)
void | ShutdownTapi ()
int WINAPI | WinMain (HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow)

Variables

BOOL | gfAutoAnswer = FALSE
HWND | ghDlg = NULL
HINSTANCE | ghInst
ITBasicCallControl * | gpCall
ITTAPI * | gpTapi
WCHAR | gszTapi30 [] = "TAPI 3.0 Incoming Call Sample"
ULONG gulAdvise
const DWORD | MAXTERMINALS = 5

Function Documentation

BOOL AddressSupportsMediaType | ( | ITAddress * | pAddress,
 |  | long | lMediaType
 | ) |  |

Definition at line 1077 of file Incoming.Cpp.

{
    VARIANT_BOOL     bSupport = VARIANT_FALSE;
    ITMediaSupport * pMediaSupport;

    if ( SUCCEEDED( pAddress->QueryInterface( IID_ITMediaSupport,
                                              (void **)&pMediaSupport ) ) )
    {
        //
        // does it support this media type?
        //

        pMediaSupport->QueryMediaType(
                                      lMediaType,
                                      &bSupport
                                     );

        pMediaSupport->Release();
    }

    return (bSupport == VARIANT_TRUE);
}

HRESULT AnswerTheCall ( )

Definition at line 879 of file Incoming.Cpp.

{
    HRESULT                 hr;
    ITCallInfo *            pCallInfo;
    ITAddress *             pAddress;

    if (NULL == gpCall)
    {
        return E_UNEXPECTED;
    }

    //
    // get the address object of this call
    //

    hr = gpCall->QueryInterface( IID_ITCallInfo, (void**)&pCallInfo );

    if ( FAILED(hr) )
    {
        gpCall->Release();
        gpCall = NULL;

        return hr;
    }

    hr = pCallInfo->get_Address( &pAddress );

    pCallInfo->Release();

    if ( FAILED(hr) )
    {
        gpCall->Release();
        gpCall = NULL;

        return hr;
    }

    //
    // Select our terminals on the call; if any of the selections fail
    // we proceed without that terminal
    //

    hr = SelectTerminalsOnCall( pAddress, gpCall );

    pAddress->Release();

    //
    // Now we can actually answer the call
    //

    hr = gpCall->Answer();

    return hr;
}

void DisableButton ( int ID )

Definition at line 1052 of file Incoming.Cpp.

{
    SendDlgItemMessage(
                       ghDlg,
                       ID,
                       BM_SETSTYLE,
                       BS_PUSHBUTTON,
                       0
                      );
    EnableWindow(
                 GetDlgItem( ghDlg, ID ),
                 FALSE
                );
}

HRESULT DisconnectTheCall ( )

Definition at line 944 of file Incoming.Cpp.

{
    HRESULT         hr = S_OK;

    if (NULL != gpCall)
    {
        hr = gpCall->Disconnect( DC_NORMAL );

        // Do not release the call yet, as that would prevent
        // us from receiving the disconnected notification.

        return hr;
    }

    return S_FALSE;
}

void DoMessage ( LPWSTR pszMessage )

Definition at line 989 of file Incoming.Cpp.

{
    MessageBox(
               ghDlg,
               pszMessage,
               gszTapi30,
               MB_OK
              );
}

void EnableButton ( int ID )

Definition at line 1025 of file Incoming.Cpp.

{
    SendDlgItemMessage(
                       ghDlg,
                       ID,
                       BM_SETSTYLE,
                       BS_DEFPUSHBUTTON,
                       0
                      );
    EnableWindow(
                 GetDlgItem( ghDlg, ID ),
                 TRUE
                );
    SetFocus(
             GetDlgItem( ghDlg, ID )
            );
}

HRESULT EnablePreview | ( | ITAddress * | pAddress,
 |  | ITStream * | pStream
 | ) |  |

Definition at line 698 of file Incoming.Cpp.

{
    ITTerminal * pTerminal;

    HRESULT hr = GetVideoRenderTerminal(pAddress, &pTerminal);

    if ( SUCCEEDED(hr) )
    {
        hr = pStream->SelectTerminal(pTerminal);

        pTerminal->Release();
    }

    return hr;
}

HRESULT GetTerminal | ( | ITAddress * | pAddress,
 |  | ITStream * | pStream,
 |  | ITTerminal ** | ppTerminal
 | ) |  |

Definition at line 725 of file Incoming.Cpp.

{
    //
    // Determine the media type and direction of this stream.
    //

    HRESULT            hr;
    long               lMediaType;
    TERMINAL_DIRECTION dir;

    hr = pStream->get_MediaType( &lMediaType );
    if ( FAILED(hr) ) return hr;

    hr = pStream->get_Direction( &dir );
    if ( FAILED(hr) ) return hr;

    //
    // Since video render is a dynamic terminal, the procedure for creating
    // it is different.
    //

    if ( ( lMediaType == TAPIMEDIATYPE_VIDEO ) &&
         ( dir        == TD_RENDER ) )
    {
        return GetVideoRenderTerminal(pAddress, ppTerminal);
    }

    //
    // For all other terminals we use GetDefaultStaticTerminal.
    // First, get the terminal support interface.
    //

    ITTerminalSupport * pTerminalSupport;

    hr = pAddress->QueryInterface( IID_ITTerminalSupport,
                                   (void **)&pTerminalSupport);

    if ( SUCCEEDED(hr) )
    {
        //
        // get the default terminal for this MediaType and direction
        //

        hr = pTerminalSupport->GetDefaultStaticTerminal(lMediaType,
                                                        dir,
                                                        ppTerminal);

        pTerminalSupport->Release();
    }

    return hr;

}

HRESULT GetVideoRenderTerminal | ( | ITAddress * | pAddress,
 |  | ITTerminal ** | ppTerminal
 | ) |  |

Definition at line 622 of file Incoming.Cpp.

{
    //
    // Construct a BSTR for the correct IID.
    //

    LPOLESTR            lpTerminalClass;

    HRESULT             hr;

    hr = StringFromIID(CLSID_VideoWindowTerm,
                       &lpTerminalClass);

    if ( SUCCEEDED(hr) )
    {
        BSTR                bstrTerminalClass;

        bstrTerminalClass = SysAllocString ( lpTerminalClass );

        CoTaskMemFree( lpTerminalClass );

        if ( bstrTerminalClass == NULL )
        {
            hr = E_OUTOFMEMORY;
        }
        else
        {

            //
            // Get the terminal support interface
            //

            ITTerminalSupport * pTerminalSupport;

            hr = pAddress->QueryInterface(IID_ITTerminalSupport,
                                          (void **)&pTerminalSupport);

            if ( SUCCEEDED(hr) )
            {
                //
                // Create the video render terminal.
                //

                hr = pTerminalSupport->CreateTerminal(bstrTerminalClass,
                                                      TAPIMEDIATYPE_VIDEO,
                                                      TD_RENDER,
                                                      ppTerminal);

                pTerminalSupport->Release();

                //
                // We do not make the window visible now -- we will do that
                // when the CME_STREAM_ACTIVE event is received for the stream
                // (and we have placed the window within our frame).
                //
            }

            SysFreeString( bstrTerminalClass );
        }
    }

    return hr;
}

HRESULT InitializeTapi ( )

Definition at line 189 of file Incoming.Cpp.

{
    HRESULT         hr;

    //
    // cocreate the TAPI object
    //

    hr = CoCreateInstance(
                          CLSID_TAPI,
                          NULL,
                          CLSCTX_INPROC_SERVER,
                          IID_ITTAPI,
                          (LPVOID *)&gpTapi
                         );

    if ( FAILED(hr) )
    {
        DoMessage(L"CoCreateInstance on TAPI failed");
        return hr;
    }

    //
    // call initialize.  this must be called before
    // any other tapi functions are called.
    //

    hr = gpTapi->Initialize();

    if ( FAILED(hr) )
    {
        DoMessage(L"TAPI failed to initialize");

        gpTapi->Release();
        gpTapi = NULL;

        return hr;
    }

    //
    // Create our own event notification object and register it
    // see callnot.h and callnot.cpp
    //

    CTAPIEventNotification *pTAPIEventNotification = new CTAPIEventNotification;

    hr = RegisterTapiEventInterface(pTAPIEventNotification);

    //
    // no longer need a reference to the callback object. tapi will keep a
    // reference to it for as long as it is using it.
    //

    pTAPIEventNotification->Release();

    // Set the Event filter to only give us only the events we process
    gpTapi->put_EventFilter(TE_CALLNOTIFICATION | TE_CALLSTATE | TE_CALLMEDIA);

    //
    // find all address objects that
    // we will use to listen for calls on
    //

    hr = ListenOnAddresses();

    if ( FAILED(hr) )
    {
        DoMessage(L"Could not find any addresses to listen on");

        gpTapi->Release();
        gpTapi = NULL;

        return hr;
    }

    return S_OK;
}

BOOL IsVideoCaptureStream ( ITStream * pStream )

Definition at line 601 of file Incoming.Cpp.

{
    TERMINAL_DIRECTION tdStreamDirection;
    long               lStreamMediaType;

    if ( FAILED( pStream  ->get_Direction(&tdStreamDirection)   ) ) { return FALSE; }
    if ( FAILED( pStream  ->get_MediaType(&lStreamMediaType)    ) ) { return FALSE; }

    return (tdStreamDirection == TD_CAPTURE) &&
           (lStreamMediaType  == TAPIMEDIATYPE_VIDEO);
}

HRESULT ListenOnAddresses ( )

Definition at line 490 of file Incoming.Cpp.

{
    HRESULT             hr = S_OK;
    IEnumAddress *      pEnumAddress;
    ITAddress *         pAddress;

    //
    // enumerate the addresses
    //

    hr = gpTapi->EnumerateAddresses( &pEnumAddress );

    if ( FAILED(hr) )
    {
        return hr;
    }

    while ( TRUE )
    {
        //
        // get the next address
        //

        hr = pEnumAddress->Next( 1, &pAddress, NULL );

        if (S_OK != hr)
        {
            break;
        }

        //
        // does the address support audio?
        //

        if ( AddressSupportsMediaType(pAddress, TAPIMEDIATYPE_AUDIO) )
        {
            //
            // If it does then we'll listen.
            //

            hr = ListenOnThisAddress( pAddress );

            if ( FAILED(hr) )
            {
                DoMessage(L"Listen failed on an address");
            }
        }

        pAddress->Release();
    }

    pEnumAddress->Release();

    return S_OK;
}

HRESULT ListenOnThisAddress ( ITAddress * pAddress )

Definition at line 559 of file Incoming.Cpp.

{

    //
    // RegisterCallNotifications takes a media type bitmap indicating
    // the set of media types we are interested in. We know the
    // address supports audio, but let's add in video as well
    // if the address supports it.
    //

    long lMediaTypes = TAPIMEDIATYPE_AUDIO;

    if ( AddressSupportsMediaType(pAddress, TAPIMEDIATYPE_VIDEO) )
    {
        lMediaTypes |= TAPIMEDIATYPE_VIDEO;
    }

    HRESULT  hr;
    long     lRegister;

    hr = gpTapi->RegisterCallNotifications(
                                           pAddress,
                                           VARIANT_TRUE,
                                           VARIANT_TRUE,
                                           lMediaTypes,
                                           0,
                                           &lRegister
                                          );

    return hr;
}

INT_PTR CALLBACK MainDialogProc | ( | HWND | hDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 308 of file Incoming.Cpp.

{
    switch (uMsg)
    {
        case WM_PRIVATETAPIEVENT:
        {
            OnTapiEvent(
                        (TAPI_EVENT) wParam,
                        (IDispatch *) lParam
                       );

            return 0;
        }

        case WM_INITDIALOG:
        {
            //
            // set up dialog
            //

            ghDlg = hDlg;

            DisableButton( IDC_ANSWER );
            DisableButton( IDC_DISCONNECT );

            SetStatusMessage( L"Waiting for a call..." );

            return 0;
        }

        case WM_COMMAND:
        {
            if ( LOWORD(wParam) == IDCANCEL )
            {
                //
                // quit
                //

                EndDialog( hDlg, 0 );

                return 1;
            }

            switch ( LOWORD(wParam) )
            {
                case IDC_AUTOANSWER:
                {
                    //
                    // auto answer check box was fiddled around with
                    //

                    gfAutoAnswer = !gfAutoAnswer;
                    return 1;
                }

                case IDC_ANSWER:
                {
                    //
                    // answer the call
                    //

                    SetStatusMessage(L"Answering...");

                    if ( S_OK == AnswerTheCall() )
                    {
                        SetStatusMessage(L"Connected");

                        EnableButton( IDC_DISCONNECT );
                        DisableButton( IDC_ANSWER );
                    }
                    else
                    {
                        DisableButton( IDC_ANSWER );
                        DoMessage(L"Answer failed");
                        SetStatusMessage(L"Waiting for a call...");
                    }

                    return 1;
                }

                case IDC_DISCONNECT:
                {
                    //
                    // disconnect request
                    //

                    SetStatusMessage(L"Disconnecting...");
                    if (S_OK != DisconnectTheCall())
                    {
                        DoMessage(L"Disconnect failed");
                    }

                    return 1;
                }

                case IDC_DISCONNECTED:
                {
                    //
                    // disconnected notification -- release the call
                    //

                    ReleaseTheCall();

                    EnableButton( IDOK );
                    DisableButton( IDC_DISCONNECT );

                    SetStatusMessage(L"Waiting for a call...");

                    return 1;
                }
                default:

                    return 0;
            }
        }
        default:

            return 0;
    }
}

HRESULT RegisterTapiEventInterface ( CTAPIEventNotification * pTAPIEventNotification )

Definition at line 440 of file Incoming.Cpp.

{
    HRESULT                       hr = S_OK;
    IConnectionPointContainer   * pCPC;
    IConnectionPoint            * pCP;

    hr = gpTapi->QueryInterface(
                                IID_IConnectionPointContainer,
                                (void **)&pCPC
                               );

    if ( FAILED(hr) )
    {
        return hr;
    }

    hr = pCPC->FindConnectionPoint(
                                   IID_ITTAPIEventNotification,
                                   &pCP
                                  );

    pCPC->Release();

    if ( FAILED(hr) )
    {
        return hr;
    }

    hr = pCP->Advise(
                      pTAPIEventNotification,
                      &gulAdvise
                     );

    pCP->Release();

    return hr;

}

void ReleaseTheCall ( )

Definition at line 967 of file Incoming.Cpp.

{
    if (NULL != gpCall)
    {
        gpCall->Release();
        gpCall = NULL;
    }
}

HRESULT SelectTerminalsOnCall | ( | ITAddress * | pAddress,
 |  | ITBasicCallControl * | pCall
 | ) |  |

Definition at line 791 of file Incoming.Cpp.

{
    HRESULT hr;

    //
    // get the ITStreamControl interface for this call
    //

    ITStreamControl * pStreamControl;

    hr = pCall->QueryInterface(IID_ITStreamControl,
                               (void **) &pStreamControl);

    if ( SUCCEEDED(hr) )
    {
        //
        // enumerate the streams
        //

        IEnumStream * pEnumStreams;

        hr = pStreamControl->EnumerateStreams(&pEnumStreams);

        pStreamControl->Release();

        if ( SUCCEEDED(hr) )
        {
            //
            // for each stream
            //

            ITStream * pStream;

            while ( S_OK == pEnumStreams->Next(1, &pStream, NULL) )
            {
                ITTerminal * pTerminal;

                //
                // Find out the media type and direction of this stream,
                // and create the default terminal for this media type and
                // direction.
                //

                hr = GetTerminal(pAddress,
                                 pStream,
                                 &pTerminal);

                if ( SUCCEEDED(hr) )
                {
                    //
                    // Select the terminal on the stream.
                    //

                    hr = pStream->SelectTerminal(pTerminal);

                    if ( SUCCEEDED(hr) )
                    {
                        //
                        // Also enable preview on the video capture stream.
                        //

                        if ( IsVideoCaptureStream( pStream ) )
                        {
                            EnablePreview( pAddress, pStream );
                        }
                    }

                    pTerminal->Release();
                }

                pStream->Release();
            }

            pEnumStreams->Release();
        }
    }

    return hr;
}

void SetStatusMessage ( LPWSTR pszMessage )

Definition at line 1007 of file Incoming.Cpp.

{
    SetDlgItemText(
                   ghDlg,
                   IDC_STATUS,
                   pszMessage
                  );
}

void ShutdownTapi ( )

Definition at line 277 of file Incoming.Cpp.

{
    //
    // if there is still a call, release it
    //

    if (NULL != gpCall)
    {
        gpCall->Release();
        gpCall = NULL;
    }

    //
    // release main object.
    //

    if (NULL != gpTapi)
    {
        gpTapi->Shutdown();
        gpTapi->Release();
    }

}

int WINAPI WinMain | ( | HINSTANCE | hInst,
 |  | HINSTANCE | hPrevInst,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 126 of file Incoming.Cpp.

{
    ghInst = hInst;

    //
    // Initialize COM.
    //

    if (!SUCCEEDED(CoInitializeEx(NULL, COINIT_MULTITHREADED)))
    {
        return 0;
    }

    //
    // do all tapi initialization
    //

    if (S_OK != InitializeTapi())
    {
        return 0;
    }

    //
    // everything is initialized, so
    // start the main dialog box
    //

    DialogBox(
              ghInst,
              MAKEINTRESOURCE(IDD_MAINDLG),
              NULL,
              MainDialogProc
             );

    //
    // clean up tapi
    //

    ShutdownTapi();

    //
    // Shut down COM.
    //

    CoUninitialize();

    return 1;
}

Variable Documentation

BOOL gfAutoAnswer = FALSE

Definition at line 44 of file Incoming.Cpp.

HWND ghDlg = NULL

Definition at line 42 of file Incoming.Cpp.

HINSTANCE ghInst

Name of app.

Definition at line 39 of file Incoming.Cpp.

ITBasicCallControl* gpCall

Definition at line 41 of file Incoming.Cpp.

ITTAPI* gpTapi

Definition at line 40 of file Incoming.Cpp.

WCHAR gszTapi30[] = "TAPI 3.0 Incoming Call Sample"

Definition at line 46 of file Incoming.Cpp.

ULONG gulAdvise

Definition at line 49 of file Incoming.Cpp.

const DWORD MAXTERMINALS = 5

Definition at line 33 of file Incoming.Cpp.

Generated on Wed Nov 13 2024 16:54:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/Incoming/Resource.h File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • Incoming
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_ANSWER 1001
#define | IDC_AUTOANSWER 1004
#define | IDC_DISCONNECT 1002
#define | IDC_DISCONNECTED 1003
#define | IDC_STATIC -1
#define | IDC_STATUS 1000
#define | IDD_MAINDLG 101

Define Documentation

#define IDC_ANSWER 1001

Definition at line 7 of file Resource.h.

#define IDC_AUTOANSWER 1004

Definition at line 10 of file Resource.h.

#define IDC_DISCONNECT 1002

Definition at line 8 of file Resource.h.

#define IDC_DISCONNECTED 1003

Definition at line 9 of file Resource.h.

#define IDC_STATIC -1

Definition at line 11 of file Resource.h.

#define IDC_STATUS 1000

Definition at line 6 of file Resource.h.

#define IDD_MAINDLG 101

Definition at line 5 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/Msp/MSPBase/dtevntsk.cpp File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • Msp
  • MSPBase
Functions

dtevntsk.cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

HRESULT FreeEventInfo (MSP_EVENT_INFO *pEvent)

Function Documentation

HRESULT FreeEventInfo ( MSP_EVENT_INFO * pEvent )

Definition at line 23 of file dtevntsk.cpp.

{

    LOG((MSP_TRACE, "FreeEventInfo -  enter"));

    switch ( pEvent->Event )
    {

        case ME_ADDRESS_EVENT:

            if (NULL != pEvent->MSP_ADDRESS_EVENT_INFO.pTerminal)
            {
                (pEvent->MSP_ADDRESS_EVENT_INFO.pTerminal)->Release();
            }

            break;

        case ME_CALL_EVENT:

            if (NULL != pEvent->MSP_CALL_EVENT_INFO.pTerminal)
            {
                (pEvent->MSP_CALL_EVENT_INFO.pTerminal)->Release();
            }

            if (NULL != pEvent->MSP_CALL_EVENT_INFO.pStream)
            {
                (pEvent->MSP_CALL_EVENT_INFO.pStream)->Release();
            }

            break;

        case ME_TSP_DATA:

            break;

        case ME_PRIVATE_EVENT:

            if ( NULL != pEvent->MSP_PRIVATE_EVENT_INFO.pEvent )
            {
                (pEvent->MSP_PRIVATE_EVENT_INFO.pEvent)->Release();
            }

            break;

        case ME_FILE_TERMINAL_EVENT:

            if( NULL != pEvent->MSP_FILE_TERMINAL_EVENT_INFO.pParentFileTerminal)
            {
                (pEvent->MSP_FILE_TERMINAL_EVENT_INFO.pParentFileTerminal)->Release();
                pEvent->MSP_FILE_TERMINAL_EVENT_INFO.pParentFileTerminal = NULL;
            }

            if( NULL != pEvent->MSP_FILE_TERMINAL_EVENT_INFO.pFileTrack )
            {
                (pEvent->MSP_FILE_TERMINAL_EVENT_INFO.pFileTrack)->Release();
                pEvent->MSP_FILE_TERMINAL_EVENT_INFO.pFileTrack = NULL;
            }

            break;

        case ME_ASR_TERMINAL_EVENT:

            if( NULL != pEvent->MSP_ASR_TERMINAL_EVENT_INFO.pASRTerminal)
            {
                (pEvent->MSP_ASR_TERMINAL_EVENT_INFO.pASRTerminal)->Release();
            }

            break;

        case ME_TTS_TERMINAL_EVENT:

            if( NULL != pEvent->MSP_TTS_TERMINAL_EVENT_INFO.pTTSTerminal)
            {
                (pEvent->MSP_TTS_TERMINAL_EVENT_INFO.pTTSTerminal)->Release();
            }

            break;

        case ME_TONE_TERMINAL_EVENT:

            if( NULL != pEvent->MSP_TONE_TERMINAL_EVENT_INFO.pToneTerminal)
            {
                (pEvent->MSP_TONE_TERMINAL_EVENT_INFO.pToneTerminal)->Release();
            }

            break;

        default:

            break;
    }

    LOG((MSP_TRACE, "FreeEventInfo -  finished"));

    return S_OK;
}

Generated on Wed Nov 13 2024 16:54:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/Msp/MSPBase/mspaddr.cpp File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • Msp
  • MSPBase
Functions

mspaddr.cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

MSPEVENTITEM * | AllocateEventItem (SIZE_T nExtraBytes)
BOOL | FreeEventItem (MSPEVENTITEM *pEventItemToBeFreed)

Function Documentation

MSPEVENTITEM* AllocateEventItem ( SIZE_T nExtraBytes )

Definition at line 40 of file mspaddr.cpp.

{

    LOG((MSP_TRACE, "AllocateEventItem - enter, extra bytes = 0x%p", nExtraBytes));

    //
    // if the caller passes us too big a number, fail.
    //

    if ( ( MAXULONG_PTR - sizeof(MSPEVENTITEM) )  < nExtraBytes )
    {
        SetLastError(ERROR_OUTOFMEMORY);

        LOG((MSP_ERROR,
            "AllocateEventItem - the caller requested an unreasonably large memory block"));

        return NULL;
    }

    //
    // allocate on the process' heap. get the current process' heap handle.
    //

    HANDLE hHeapHandle = GetProcessHeap();

    if (NULL == hHeapHandle)
    {

        //
        // failed to get process's heap. nothing much we can do here.
        // this will cause a leak.
        //

        LOG((MSP_ERROR,
            "AllocateEventItem - failed to get current process heap. LastError [%ld]",
            GetLastError()));

        return NULL;
    }

    //
    // calculate the number of bytes to allocate
    //

    SIZE_T nTotalAllocationSize = sizeof(MSPEVENTITEM) + nExtraBytes;

    //
    // attempt to allocate memory and return result of the allocation
    //

    MSPEVENTITEM *pMspEventItem =
         (MSPEVENTITEM *)HeapAlloc(hHeapHandle, 0, nTotalAllocationSize);

    if (NULL == pMspEventItem)
    {

        LOG((MSP_ERROR,
            "AllocateEventItem - failed to allocate [0x%p] bytes. Heap Handle [%p] LastError [%ld]",
            nTotalAllocationSize, hHeapHandle, GetLastError()));
    }
    else
    {

        LOG((MSP_TRACE, "AllocateEventItem - exit. pMspEventItem = [%p]", pMspEventItem));
    }

    return pMspEventItem;
}

BOOL FreeEventItem ( MSPEVENTITEM * pEventItemToBeFreed )

Definition at line 126 of file mspaddr.cpp.

{

    LOG((MSP_TRACE, "FreeEventItem - enter. pEventItemToBeFreed = [%p]",
        pEventItemToBeFreed));

    //
    // always allow freeing NULL
    //

    if (NULL == pEventItemToBeFreed)
    {

        LOG((MSP_TRACE, "FreeEventItem - finish. NULL -- nothing to do"));

        return TRUE;
    }

    //
    // the event item should have been allocated on the process' heap.
    // get the current process' heap hadle.
    //

    HANDLE hHeapHandle = GetProcessHeap();

    if (NULL == hHeapHandle)
    {

        //
        // failed to get process's heap. nothing much we can do here.
        // this will cause a leak.
        //

        LOG((MSP_ERROR,
            "FreeEventItem - failed to get current process heap. LastError = %ld",
            GetLastError()));

        return FALSE;
    }

    //
    // attempt to free memory and return result of the operation
    //

    BOOL bFreeSuccess = HeapFree( hHeapHandle, 0, pEventItemToBeFreed );

    if (bFreeSuccess)
    {
         LOG((MSP_TRACE, "FreeEventItem - exit."));
    }
    else
    {
         LOG((MSP_ERROR,
             "FreeEventItem - failed to free. Heap Handle [%p] LastError = %ld",
             hHeapHandle, GetLastError()));
    }

    return bFreeSuccess;
}

Generated on Wed Nov 13 2024 16:54:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/Msp/MSPBase/mspcall.cpp File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • Msp
  • MSPBase
Functions

mspcall.cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

DWORD WINAPI AsyncMultiGraphEvent (LPVOID pVoid)

Function Documentation

DWORD WINAPI AsyncMultiGraphEvent ( LPVOID pVoid )

Definition at line 881 of file mspcall.cpp.

{
    MULTI_GRAPH_EVENT_DATA * pData = ( MULTI_GRAPH_EVENT_DATA * ) pVoid;

    //
    // Handle the event.
    //

    (pData->pCall)->ProcessGraphEvent(pData->pITStream,
                                      pData->lEventCode,
                                      pData->lParam1,
                                      pData->lParam2);

    //
    // These were addrefed when the event was queued.
    // but we used our special inner object addref for the call
    //

    pData->pCall->MSPCallRelease();
    pData->pITStream->Release();

    //
    // if we have IMediaEvent pointer, free event params and release the media
    // event interface pointer
    //

    if (NULL != pData->pIMediaEvent)
    {
        pData->pIMediaEvent->FreeEventParams(pData->lEventCode,
                                             pData->lParam1,
                                             pData->lParam2);
        pData->pIMediaEvent->Release();
        pData->pIMediaEvent = NULL;
    }

    //
    // Free the event data structure.
    //

    delete pData;

    return 0;
}

Generated on Wed Nov 13 2024 16:54:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/Msp/MSPBase/msplog.cpp File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • Msp
  • MSPBase

msplog.cpp File Reference

#include "precomp.h"
#include <stdio.h>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/Msp/MSPBase/mspstrm.cpp File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • Msp
  • MSPBase

mspstrm.cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/Msp/MSPBase/mspterm.cpp File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • Msp
  • MSPBase

mspterm.cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/Msp/MSPBase/mspthrd.cpp File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • Msp
  • MSPBase
Functions | Variables

mspthrd.cpp File Reference

#include "precomp.h"
#include <dbt.h>

Go to the source code of this file.

Functions

DWORD WINAPI | gfThreadProc (LPVOID p)

Variables

CMSPThread | g_Thread

Function Documentation

DWORD WINAPI gfThreadProc ( LPVOID p )

Definition at line 23 of file mspthrd.cpp.

{
    return ((CMSPThread *)p)->ThreadProc();
}

Variable Documentation

CMSPThread g_Thread

Definition at line 21 of file mspthrd.cpp.

Generated on Wed Nov 13 2024 16:54:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/Msp/MSPBase/msptrmac.cpp File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • Msp
  • MSPBase
Defines

msptrmac.cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Defines

#define MAX_LONG 0xefffffff

Define Documentation

#define MAX_LONG 0xefffffff

Definition at line 18 of file msptrmac.cpp.

Generated on Wed Nov 13 2024 16:54:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/Msp/MSPBase/msptrmar.cpp File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • Msp
  • MSPBase
Variables

msptrmar.cpp File Reference

#include "precomp.h"
#include <mmsystem.h>

Go to the source code of this file.

Variables

const long | AX_MAX_VOLUME = 0
const long | AX_MIN_VOLUME = -9640

Variable Documentation

const long AX_MAX_VOLUME = 0

Definition at line 22 of file msptrmar.cpp.

const long AX_MIN_VOLUME = -9640

Definition at line 21 of file msptrmar.cpp.

Generated on Wed Nov 13 2024 16:54:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/Msp/MSPBase/msptrmvc.cpp File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • Msp
  • MSPBase

msptrmvc.cpp File Reference

#include "precomp.h"
#include <amvideo.h>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/Msp/MSPBase/msputils.cpp File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • Msp
  • MSPBase
Functions

msputils.cpp File Reference

#include "precomp.h"
#include "mspbase.h"
#include "msputils.h"

Go to the source code of this file.

Functions

BOOL IsNodeOnList (PLIST_ENTRY ListHead, PLIST_ENTRY Entry)

Function Documentation

BOOL IsNodeOnList | ( | PLIST_ENTRY | ListHead,
 |  | PLIST_ENTRY | Entry
 | ) |  |

Definition at line 23 of file msputils.cpp.

{
    PLIST_ENTRY pCurrent = ListHead;
    while(pCurrent->Flink != Entry)
    {
        pCurrent = pCurrent->Flink;
        if(pCurrent == 0)
        {
            return FALSE;
        }
    }
    return TRUE;
}

Generated on Wed Nov 13 2024 16:54:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/Msp/MSPBase/precomp.h File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • Msp
  • MSPBase
Defines

precomp.h File Reference

#include <mspbase.h>
#include <msptrmac.h>
#include <msptrmar.h>
#include <msptrmvc.h>

Go to the source code of this file.

Defines

#define MSPB_IsBadWritePtr(x, y) IsBadWritePtr((x), (y))

Define Documentation

#define MSPB_IsBadWritePtr | ( | x,
 |  | y |
 | ) |  | IsBadWritePtr((x), (y))

Definition at line 6 of file precomp.h.

Generated on Wed Nov 13 2024 16:53:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/Msp/SampleMSP/Common.h File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • Msp
  • SampleMSP

Common.h File Reference

#include <mmsystem.h>
#include <mmreg.h>
#include <evcode.h>
#include "sampmsp.h"
#include "sampaddr.h"
#include "sampstrm.h"
#include "sampcall.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:11 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/Msp/SampleMSP/Resource.h File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • Msp
  • SampleMSP
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_SampleMSP 101
#define | IDS_CAPTURE_STREAM 105
#define | IDS_PROJNAME 100
#define | IDS_RENDER_STREAM 106

Define Documentation

#define IDR_SampleMSP 101

Definition at line 6 of file Resource.h.

#define IDS_CAPTURE_STREAM 105

Definition at line 7 of file Resource.h.

#define IDS_PROJNAME 100

Definition at line 5 of file Resource.h.

#define IDS_RENDER_STREAM 106

Definition at line 8 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/Msp/SampleMSP/SampAddr.Cpp File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • Msp
  • SampleMSP

SampAddr.Cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/Msp/SampleMSP/SampAddr.h File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • Msp
  • SampleMSP
Classes

SampAddr.h File Reference

#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Classes

class CSampleMSP
Generated on Wed Nov 13 2024 16:54:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/Msp/SampleMSP/SampCall.Cpp File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • Msp
  • SampleMSP

SampCall.Cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/Msp/SampleMSP/SampCall.h File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • Msp
  • SampleMSP
Classes

SampCall.h File Reference

Go to the source code of this file.

Classes

class CSampleMSPCall
Generated on Wed Nov 13 2024 16:54:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/Msp/SampleMSP/SampMsp.Cpp File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • Msp
  • SampleMSP
Functions | Variables

SampMsp.Cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include "initguid.h"
#include "sampmsp_i.c"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 100 of file SampMsp.Cpp.

{
#ifdef _MERGE_PROXYSTUB
  if (PrxDllCanUnloadNow() != S_OK)
    return S_FALSE;
#endif
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 112 of file SampMsp.Cpp.

{
#ifdef _MERGE_PROXYSTUB
  if (PrxDllGetClassObject(rclsid, riid, ppv) == S_OK)
    return S_OK;
#endif
  return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID | lpReserved
 | ) |  |

Definition at line 62 of file SampMsp.Cpp.

{
  lpReserved;

#ifdef _MERGE_PROXYSTUB
    if (!PrxDllMain(hInstance, dwReason, lpReserved))
    {
    return FALSE;
    }
#endif

    if (dwReason == DLL_PROCESS_ATTACH)
  {

#ifdef DEBUG_HEAPS
      // turn on leak detection on process exit
      _CrtSetDbgFlag( _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF );
#endif // DEBUG_HEAPS

        _Module.Init(ObjectMap, hInstance);
    DisableThreadLibraryCalls(hInstance);

        // Register for trace output.
        MSPLOGREGISTER(_T("sampmsp"));
  }
  else if (dwReason == DLL_PROCESS_DETACH)
    {
        // Deregister for trace output.
        MSPLOGDEREGISTER();

        _Module.Term();
    }
  return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 124 of file SampMsp.Cpp.

{
#ifdef _MERGE_PROXYSTUB
  HRESULT hRes = PrxDllRegisterServer();
  if (FAILED(hRes))
    return hRes;
#endif
  // registers object, typelib and all interfaces in typelib
  return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 138 of file SampMsp.Cpp.

{
#ifdef _MERGE_PROXYSTUB
  PrxDllUnregisterServer();
#endif
  _Module.UnregisterServer();
  return S_OK;
}

Variable Documentation

CComModule _Module

Definition at line 52 of file SampMsp.Cpp.

Generated on Wed Nov 13 2024 16:54:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/Msp/SampleMSP/SampMsp.Idl File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • Msp
  • SampleMSP
Functions | Variables

SampMsp.Idl File Reference

Go to the source code of this file.

Functions

library SampleMSPLib | importlib ("stdole32.tlb")
importlib ("stdole2.tlb")

Variables

import msp | idl

Function Documentation

library SampleMSPLib importlib ( "stdole32.tlb" )
importlib ( "stdole2.tlb" )

Variable Documentation

import msp idl

Definition at line 21 of file SampMsp.Idl.

Generated on Wed Nov 13 2024 16:54:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/Msp/SampleMSP/SampStrm.Cpp File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • Msp
  • SampleMSP

SampStrm.Cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/Msp/SampleMSP/SampStrm.h File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • Msp
  • SampleMSP
Classes

SampStrm.h File Reference

Go to the source code of this file.

Classes

class CSampleMSPStream
Generated on Wed Nov 13 2024 16:54:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/Msp/SampleMSP/stdafx.h File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • Msp
  • SampleMSP

stdafx.h File Reference

#include <atlbase.h>
#include <mspbase.h>
#include "common.h"
#include "common.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/Outgoing/Outgoing.Cpp File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • Outgoing
Defines | Functions | Variables

Outgoing.Cpp File Reference

#include <windows.h>
#include <tapi3.h>
#include <strmif.h>
#include <control.h>
#include "resource.h"

Go to the source code of this file.

Defines

#define | UNICODE

Functions

BOOL | AddressSupportsMediaType (ITAddress *pAddress, long lMediaType)
void | DisableButton (HWND hDlg, int ID)
HRESULT | DisconnectTheCall ()
void | DoMessage (LPWSTR pszMessage)
void | EnableButton (HWND hDlg, int ID)
HRESULT | EnablePreview (ITStream *pStream)
HRESULT | FindAnAddress (DWORD dwAddressType, BSTR *ppName)
HRESULT | GetTerminal (ITStream *pStream, ITTerminal **ppTerminal)
HRESULT | GetVideoRenderTerminal (ITTerminal **ppTerminal)
void | InitAddressTypeComboBox (HWND hComboBox)
HRESULT | InitializeTapi ()
BOOL | IsVideoCaptureStream (ITStream *pStream)
INT_PTR CALLBACK | MainDialogProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
HRESULT | MakeTheCall (DWORD dwAddressType, PWCHAR szAddressToCall)
HRESULT | SelectTerminalsOnCall (ITBasicCallControl *pCall)
void | ShutdownTapi ()
int WINAPI | WinMain (HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow)

Variables

const DWORD | ADDRESSLENGTH = 128
HWND | ghDlg = NULL
HINSTANCE | ghInst
ITAddress * | gpAddress = NULL
ITBasicCallControl * | gpCall
ITTAPI * | gpTapi
const WCHAR *const | gszConferenceName = "Conference Name"
const WCHAR *const | gszEmailName = "Email Name"
const WCHAR *const | gszIPAddress = "IP Address"
const WCHAR *const | gszMachineName = "Machine Name"
const WCHAR *const | gszPhoneNumber = "Phone Number"
const WCHAR *const | gszTapi30 = "TAPI 3.0 Outgoing Call Sample"
const DWORD | MAXTERMINALS = 5

Define Documentation

#define UNICODE

Definition at line 7 of file Outgoing.Cpp.

Function Documentation

BOOL AddressSupportsMediaType | ( | ITAddress * | pAddress,
 |  | long | lMediaType
 | ) |  |

Definition at line 1037 of file Outgoing.Cpp.

{
    VARIANT_BOOL     bSupport = VARIANT_FALSE;
    ITMediaSupport * pMediaSupport;

    if ( SUCCEEDED( pAddress->QueryInterface( IID_ITMediaSupport,
                                              (void **)&pMediaSupport ) ) )
    {
        // does it support this media type?
        pMediaSupport->QueryMediaType(
                                      lMediaType,
                                      &bSupport
                                     );

        pMediaSupport->Release();
    }

    return (bSupport == VARIANT_TRUE);
}

void DisableButton | ( | HWND | hDlg,
 |  | int | ID
 | ) |  |

Definition at line 1011 of file Outgoing.Cpp.

{
    SendDlgItemMessage(
                       hDlg,
                       ID,
                       BM_SETSTYLE,
                       BS_PUSHBUTTON,
                       0
                      );
    EnableWindow(
                 GetDlgItem( hDlg, ID ),
                 FALSE
                );
}

HRESULT DisconnectTheCall ( )

Definition at line 936 of file Outgoing.Cpp.

{
    HRESULT         hr = S_OK;

    if (NULL != gpCall)
    {
        hr = gpCall->Disconnect( DC_NORMAL );

        gpCall->Release();
        gpCall = NULL;

        return hr;
    }

    return S_FALSE;
}

void DoMessage ( LPWSTR pszMessage )

Definition at line 966 of file Outgoing.Cpp.

{
    MessageBox(
               ghDlg,
               pszMessage,
               gszTapi30,
               MB_OK
              );
}

void EnableButton | ( | HWND | hDlg,
 |  | int | ID
 | ) |  |

Definition at line 984 of file Outgoing.Cpp.

{
    SendDlgItemMessage(
                       hDlg,
                       ID,
                       BM_SETSTYLE,
                       BS_DEFPUSHBUTTON,
                       0
                      );
    EnableWindow(
                 GetDlgItem( hDlg, ID ),
                 TRUE
                );
    SetFocus(
             GetDlgItem( hDlg, ID )
            );
}

HRESULT EnablePreview ( ITStream * pStream )

Definition at line 549 of file Outgoing.Cpp.

{
    ITTerminal * pTerminal;

    HRESULT hr = GetVideoRenderTerminal(&pTerminal);

    if ( SUCCEEDED(hr) )
    {
        hr = pStream->SelectTerminal(pTerminal);

        pTerminal->Release();
    }

    return hr;
}

HRESULT FindAnAddress | ( | DWORD | dwAddressType,
 |  | BSTR * | ppName
 | ) |  |

Definition at line 432 of file Outgoing.Cpp.

{
    HRESULT                 hr = S_OK;
    BOOL                    bFoundAddress = FALSE;
    IEnumAddress          * pEnumAddress;
    ITAddress             * pAddress;
    ITAddressCapabilities * pAddressCaps;
    long                    lType = 0;

    // if we have an address object
    // release it
    if (NULL != gpAddress)
    {
        gpAddress->Release();
        gpAddress = NULL;
    }

    // enumerate the addresses
    hr = gpTapi->EnumerateAddresses( &pEnumAddress );

    if ( FAILED(hr) )
    {
        return hr;
    }

    while ( !bFoundAddress )
    {
        // get the next address
        hr = pEnumAddress->Next( 1, &pAddress, NULL );

        if (S_OK != hr)
        {
            break;
        }

        hr = pAddress->QueryInterface(IID_ITAddressCapabilities, (void**)&pAddressCaps);

        if ( SUCCEEDED(hr) )
        {

            hr = pAddressCaps->get_AddressCapability( AC_ADDRESSTYPES, &lType );

            pAddressCaps->Release();

            if ( SUCCEEDED(hr) )
            {
                // is the type we are looking for?
                if ( dwAddressType & lType )
                {
                    // does it support audio?
                    if ( AddressSupportsMediaType(pAddress, TAPIMEDIATYPE_AUDIO) )
                    {
                        // does it have a name?
                        if ( SUCCEEDED( pAddress->get_AddressName(ppName) ) )
                        {
                            // save it in the global variable
                            // since we break out of the loop, this one won't
                            // get released

                            gpAddress = pAddress;

                            bFoundAddress = TRUE;

                            break;
                        }
                    }
                }
            }
        }

        pAddress->Release();

    } // end while loop

    pEnumAddress->Release();

    if (!bFoundAddress)
    {
        return E_FAIL;
    }

    return S_OK;
}

HRESULT GetTerminal | ( | ITStream * | pStream,
 |  | ITTerminal ** | ppTerminal
 | ) |  |

Definition at line 775 of file Outgoing.Cpp.

{
    //
    // Determine the media type and direction of this stream.
    //

    HRESULT            hr;
    long               lMediaType;
    TERMINAL_DIRECTION dir;

    hr = pStream->get_MediaType( &lMediaType );
    if ( FAILED(hr) ) return hr;

    hr = pStream->get_Direction( &dir );
    if ( FAILED(hr) ) return hr;

    //
    // Since video render is a dynamic terminal, the procedure for creating
    // it is different.
    //

    if ( ( lMediaType == TAPIMEDIATYPE_VIDEO ) &&
         ( dir        == TD_RENDER ) )
    {
        return GetVideoRenderTerminal(ppTerminal);
    }

    //
    // For all other terminals we use GetDefaultStaticTerminal.
    // First, get the terminal support interface.
    //

    ITTerminalSupport * pTerminalSupport;

    hr = gpAddress->QueryInterface( IID_ITTerminalSupport,
                                    (void **)&pTerminalSupport);

    if ( SUCCEEDED(hr) )
    {
        //
        // get the default terminal for this MediaType and direction
        //

        hr = pTerminalSupport->GetDefaultStaticTerminal(lMediaType,
                                                        dir,
                                                        ppTerminal);

        pTerminalSupport->Release();
    }

    return hr;

}

HRESULT GetVideoRenderTerminal ( ITTerminal ** ppTerminal )

Definition at line 839 of file Outgoing.Cpp.

{
    //
    // Construct a BSTR for the correct IID.
    //

    LPOLESTR            lpTerminalClass;

    HRESULT             hr;

    hr = StringFromIID(CLSID_VideoWindowTerm,
                       &lpTerminalClass);

    if ( SUCCEEDED(hr) )
    {
        BSTR                bstrTerminalClass;

        bstrTerminalClass = SysAllocString ( lpTerminalClass );

        CoTaskMemFree( lpTerminalClass );

        if ( bstrTerminalClass == NULL )
        {
            hr = E_OUTOFMEMORY;
        }
        else
        {

            //
            // Get the terminal support interface
            //

            ITTerminalSupport * pTerminalSupport;

            hr = gpAddress->QueryInterface(IID_ITTerminalSupport,
                                           (void **)&pTerminalSupport);

            if ( SUCCEEDED(hr) )
            {
                //
                // Create the video render terminal.
                //

                hr = pTerminalSupport->CreateTerminal(bstrTerminalClass,
                                                      TAPIMEDIATYPE_VIDEO,
                                                      TD_RENDER,
                                                      ppTerminal);

                pTerminalSupport->Release();

                if ( SUCCEEDED(hr) )
                {
                    // Get the video window interface for the terminal
                    IVideoWindow *pVideoWindow = NULL;

                    hr = (*ppTerminal)->QueryInterface(IID_IVideoWindow,
                                                       (void**)&pVideoWindow);

                    if ( SUCCEEDED(hr) )
                    {
                        //
                        // Set the AutoShow member to true
                        //
                        // Note that the AutoShow property is the only one
                        // we can use on this terminal's IVideoWindow and
                        // IBasicVideo interfaces before the CME_STREAM_ACTIVE
                        // event is received for the stream. All other methods
                        // will fail until CME_STREAM_ACTIVE has been sent.
                        // Applications that need to control more about a video
                        // window than just its visibility must listen for the
                        // CME_STREAM_ACTIVE event. See the "t3in.exe" sample
                        // for how to do this.
                        //

                        hr = pVideoWindow->put_AutoShow( VARIANT_TRUE );

                        pVideoWindow->Release();
                    }
                }
            }

            SysFreeString( bstrTerminalClass );
        }
    }

    return hr;
}

void InitAddressTypeComboBox ( HWND hComboBox )

Definition at line 248 of file Outgoing.Cpp.

{
    int i;

    i = (int)SendMessage( hComboBox, CB_ADDSTRING, 0, (LONG_PTR)gszConferenceName );

    SendMessage(
                hComboBox,
                CB_SETITEMDATA ,
                i,
                (LONG_PTR)LINEADDRESSTYPE_SDP
               );

    i = (int)SendMessage( hComboBox, CB_ADDSTRING, 0, (LONG_PTR)gszEmailName );

    SendMessage(
                hComboBox,
                CB_SETITEMDATA ,
                i,
                (LONG_PTR)LINEADDRESSTYPE_EMAILNAME
               );

    i = (int)SendMessage( hComboBox, CB_ADDSTRING, 0, (LONG_PTR)gszMachineName );

    SendMessage(
                hComboBox,
                CB_SETITEMDATA ,
                i,
                (LONG_PTR)LINEADDRESSTYPE_DOMAINNAME
               );

    i = (int)SendMessage( hComboBox, CB_ADDSTRING, 0, (LONG_PTR)gszPhoneNumber );

    SendMessage(
                hComboBox,
                CB_SETITEMDATA ,
                i,
                (LONG_PTR)LINEADDRESSTYPE_PHONENUMBER
               );

    SendMessage( hComboBox, CB_SETCURSEL, i, 0 );

    i = (int)SendMessage( hComboBox, CB_ADDSTRING, 0, (LONG_PTR)gszIPAddress );

    SendMessage(
                hComboBox,
                CB_SETITEMDATA ,
                i,
                (LONG_PTR)LINEADDRESSTYPE_IPADDRESS
               );

}

HRESULT InitializeTapi ( )

Definition at line 170 of file Outgoing.Cpp.

{
    HRESULT         hr;

    // cocreate the TAPI object
    hr = CoCreateInstance(
                          CLSID_TAPI,
                          NULL,
                          CLSCTX_INPROC_SERVER,
                          IID_ITTAPI,
                          (LPVOID *)&gpTapi
                         );

    if ( FAILED(hr) )
    {
        DoMessage(L"CoCreateInstance on TAPI failed");
        return hr;
    }

    // call initialize.  this must be called before
    // any other tapi functions are called.
    hr = gpTapi->Initialize();

    if (S_OK != hr)
    {
        DoMessage(L"TAPI failed to initialize");

        gpTapi->Release();
        gpTapi = NULL;

        return hr;
    }

    return S_OK;
}

BOOL IsVideoCaptureStream ( ITStream * pStream )

Definition at line 527 of file Outgoing.Cpp.

{
    TERMINAL_DIRECTION tdStreamDirection;
    long               lStreamMediaType;

    if ( FAILED( pStream  ->get_Direction(&tdStreamDirection)   ) ) { return FALSE; }
    if ( FAILED( pStream  ->get_MediaType(&lStreamMediaType)    ) ) { return FALSE; }

    return (tdStreamDirection == TD_CAPTURE) &&
           (lStreamMediaType  == TAPIMEDIATYPE_VIDEO);
}

INT_PTR CALLBACK MainDialogProc | ( | HWND | hDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 312 of file Outgoing.Cpp.

{
    switch (uMsg)
    {
        case WM_INITDIALOG:
        {
            HWND hComboBox;

            // set up dialog
            ghDlg = hDlg;

            EnableButton( hDlg, IDOK );
            DisableButton( hDlg, IDC_DISCONNECT );

            hComboBox = GetDlgItem( hDlg, IDC_ADDRESSTYPE );

            InitAddressTypeComboBox(hComboBox);

            SetFocus( hComboBox );

            return 0;
        }

        case WM_COMMAND:
        {
            if ( LOWORD(wParam) == IDCANCEL )
            {
                // quit
                EndDialog( hDlg, 0 );

                return 1;
            }

            // dial request
            if ( LOWORD(wParam) == IDOK )
            {
                HWND hComboBox;
                DWORD dwIndex;
                DWORD dwAddressType;
                WCHAR szAddressToCall[ADDRESSLENGTH];

                // get the address type the user selected.
                hComboBox = GetDlgItem( hDlg, IDC_ADDRESSTYPE );
                dwIndex = (DWORD)SendMessage( hComboBox, CB_GETCURSEL, 0, 0 );

                dwAddressType = (DWORD)SendMessage(
                                             hComboBox,
                                             CB_GETITEMDATA,
                                             dwIndex,
                                             0
                                           );

                // get the address the user wants to call
                GetDlgItemText(
                               hDlg,
                               IDC_ADDRESS,
                               szAddressToCall,
                               ADDRESSLENGTH
                              );

                // make the call
                if ( S_OK == MakeTheCall(dwAddressType, szAddressToCall) )
                {
                    EnableButton( hDlg, IDC_DISCONNECT );
                    DisableButton( hDlg, IDOK );
                }
                else
                {
                    DoMessage(L"The call failed to connect");
                }

                return 1;
            }

            // disconnect request
            if ( LOWORD( wParam ) == IDC_DISCONNECT )
            {
                // disconnect
                if (S_OK == DisconnectTheCall())
                {
                    EnableButton( hDlg, IDOK );
                    DisableButton( hDlg, IDC_DISCONNECT );
                }
                else
                {
                    DoMessage(L"The call failed to disconnect");
                }

                return 1;
            }

            return 0;
        }
        default:

            return 0;
    }
}

HRESULT MakeTheCall | ( | DWORD | dwAddressType,
 |  | PWCHAR | szAddressToCall
 | ) |  |

Definition at line 665 of file Outgoing.Cpp.

{
    HRESULT                 hr = S_OK;
    BSTR                    bstrAddressToCall;
    BSTR                    pAddressName;

    // find an address object that
    // we will use to make calls on

    hr = FindAnAddress(dwAddressType, &pAddressName);

    if ( FAILED(hr) )
    {
        DoMessage(L"Could not find a TAPI address for making calls.");

        return hr;
    }

    WCHAR pText[200];

    wsprintf(pText, L"Using address: %s", pAddressName);

    SysFreeString(pAddressName);

    DoMessage(pText);

    //
    // find out which media types this address supports
    //

    long lMediaTypes = 0;

    if ( AddressSupportsMediaType(gpAddress, TAPIMEDIATYPE_AUDIO) )
    {
        lMediaTypes |= TAPIMEDIATYPE_AUDIO; // we will use audio
    }

    if ( AddressSupportsMediaType(gpAddress, TAPIMEDIATYPE_VIDEO) )
    {
        lMediaTypes |= TAPIMEDIATYPE_VIDEO; // we will use video
    }

    //
    // Create the call.
    //

    bstrAddressToCall = SysAllocString( szAddressToCall );

    hr = gpAddress->CreateCall( bstrAddressToCall,
                                dwAddressType,
                                lMediaTypes,
                                &gpCall);

    SysFreeString ( bstrAddressToCall );

    if ( FAILED(hr) )
    {
        DoMessage(L"Could not create a call.");

        return hr;
    }

    //
    // Select our terminals on the call; if any of the selections fail we
    // proceed without that terminal.
    //

    hr = SelectTerminalsOnCall( gpCall );

    //
    // We're now ready to call connect.
    //
    // the VARIANT_TRUE parameter indicates that this
    // call is sychronous - that is, it won't
    // return until the call is in the connected
    // state (or fails to connect)
    // Since this is called in the UI thread,
    // this means that the app will appear
    // to hang until this function returns.
    // Some TAPI service providers may take a long
    // time for a call to reach the connected state.
    //

    hr = gpCall->Connect( VARIANT_TRUE );

    if ( FAILED(hr) )
    {
        gpCall->Release();
        gpCall = NULL;

        DoMessage(L"Could not connect the call.");

        return hr;
    }

    return S_OK;
}

HRESULT SelectTerminalsOnCall ( ITBasicCallControl * pCall )

Definition at line 575 of file Outgoing.Cpp.

{
    HRESULT hr;

    //
    // get the ITStreamControl interface for this call
    //

    ITStreamControl * pStreamControl;

    hr = pCall->QueryInterface(IID_ITStreamControl,
                               (void **) &pStreamControl);

    if ( SUCCEEDED(hr) )
    {
        //
        // enumerate the streams
        //

        IEnumStream * pEnumStreams;

        hr = pStreamControl->EnumerateStreams(&pEnumStreams);

        pStreamControl->Release();

        if ( SUCCEEDED(hr) )
        {
            //
            // for each stream
            //

            ITStream * pStream;

            while ( S_OK == pEnumStreams->Next(1, &pStream, NULL) )
            {
                ITTerminal * pTerminal;

                //
                // Find out the media type and direction of this stream,
                // and create the default terminal for this media type and
                // direction.
                //

                hr = GetTerminal(pStream,
                                 &pTerminal);

                if ( SUCCEEDED(hr) )
                {
                    //
                    // Select the terminal on the stream.
                    //

                    hr = pStream->SelectTerminal(pTerminal);

                    if ( SUCCEEDED(hr) )
                    {
                        //
                        // Also enable preview on the video capture stream.
                        //

                        if ( IsVideoCaptureStream( pStream ) )
                        {
                            EnablePreview( pStream );
                        }
                    }

                    pTerminal->Release();
                }

                pStream->Release();

            }

            pEnumStreams->Release();
        }
    }

    return hr;
}

void ShutdownTapi ( )

Definition at line 212 of file Outgoing.Cpp.

{
    // if there is still a call,
    // release it
    if (NULL != gpCall)
    {
        gpCall->Release();
        gpCall = NULL;
    }

    // if we have an address object
    // release it
    if (NULL != gpAddress)
    {
        gpAddress->Release();
        gpAddress = NULL;
    }

    // release main object.
    if (NULL != gpTapi)
    {
        gpTapi->Shutdown();
        gpTapi->Release();
        gpTapi = NULL;
    }

}

int WINAPI WinMain | ( | HINSTANCE | hInst,
 |  | HINSTANCE | hPrevInst,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 125 of file Outgoing.Cpp.

{
    ghInst = hInst;

    // need to coinit
    if ( FAILED( CoInitialize(NULL) ) )
    {
        return 0;
    }

    if ( FAILED( InitializeTapi() ) )
    {
        return 0;
    }

    // everything is initialized, so
    // start the main dialog box
    DialogBox(
              ghInst,
              MAKEINTRESOURCE(IDD_MAINDLG),
              NULL,
              MainDialogProc
             );

    ShutdownTapi();

    CoUninitialize();

    return 1;
}

Variable Documentation

const DWORD ADDRESSLENGTH = 128

Definition at line 34 of file Outgoing.Cpp.

HWND ghDlg = NULL

Definition at line 49 of file Outgoing.Cpp.

HINSTANCE ghInst

Name of app.

Definition at line 48 of file Outgoing.Cpp.

ITAddress* gpAddress = NULL

Definition at line 51 of file Outgoing.Cpp.

ITBasicCallControl* gpCall

Definition at line 52 of file Outgoing.Cpp.

ITTAPI* gpTapi

Definition at line 50 of file Outgoing.Cpp.

const WCHAR* const gszConferenceName = "Conference Name"

Definition at line 39 of file Outgoing.Cpp.

const WCHAR* const gszEmailName = "Email Name"

Definition at line 40 of file Outgoing.Cpp.

const WCHAR* const gszIPAddress = "IP Address"

Definition at line 43 of file Outgoing.Cpp.

const WCHAR* const gszMachineName = "Machine Name"

Definition at line 41 of file Outgoing.Cpp.

const WCHAR* const gszPhoneNumber = "Phone Number"

Definition at line 42 of file Outgoing.Cpp.

const WCHAR* const gszTapi30 = "TAPI 3.0 Outgoing Call Sample"

Definition at line 37 of file Outgoing.Cpp.

const DWORD MAXTERMINALS = 5

Definition at line 35 of file Outgoing.Cpp.

Generated on Wed Nov 13 2024 16:54:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/Outgoing/Resource.h File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • Outgoing
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_ADDRESS 1009
#define | IDC_ADDRESSTYPE 1002
#define | IDC_DISCONNECT 1001
#define | IDC_STATIC -1
#define | IDD_MAINDLG 102

Define Documentation

#define IDC_ADDRESS 1009

Definition at line 7 of file Resource.h.

#define IDC_ADDRESSTYPE 1002

Definition at line 6 of file Resource.h.

#define IDC_DISCONNECT 1001

Definition at line 8 of file Resource.h.

#define IDC_STATIC -1

Definition at line 9 of file Resource.h.

#define IDD_MAINDLG 102

Definition at line 5 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/pluggable/guids.h File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • pluggable
Functions

guids.h File Reference

Go to the source code of this file.

Functions

DEFINE_GUID (CLSID_PlgTermSampleClass, 0xc0c93fd9, 0xae0c, 0x43db, 0xa3, 0xd0, 0xd0, 0x60, 0xb7, 0x84, 0x7a, 0xe2)
DEFINE_GUID (CLSID_PlgSamplePin, 0x9702faaa, 0x40da, 0x4a37, 0x90, 0x2e, 0xf0, 0x50, 0xbf, 0x3b, 0xb6, 0x37)
DEFINE_GUID (CLSID_PlgSampleFilter, 0x880b259b, 0xe851, 0x4315, 0xab, 0x63, 0xe7, 0xcd, 0xc8, 0x70, 0x3e, 0x41)
DEFINE_GUID (CLSID_PlgSuperSampleClass, 0x41b0921d, 0x7119, 0x4ba4, 0x9b, 0x6b, 0xd3, 0x15, 0xc5, 0x2b, 0x93, 0xb2)

Function Documentation

DEFINE_GUID | ( | CLSID_PlgTermSampleClass | ,
 |  | 0xc0c93fd9 | ,
 |  | 0xae0c | ,
 |  | 0x43db | ,
 |  | 0xa3 | ,
 |  | 0xd0 | ,
 |  | 0xd0 | ,
 |  | 0x60 | ,
 |  | 0xb7 | ,
 |  | 0x84 | ,
 |  | 0x7a | ,
 |  | 0xe2 |
 | ) |  |
DEFINE_GUID | ( | CLSID_PlgSamplePin | ,
 |  | 0x9702faaa | ,
 |  | 0x40da | ,
 |  | 0x4a37 | ,
 |  | 0x90 | ,
 |  | 0x2e | ,
 |  | 0xf0 | ,
 |  | 0x50 | ,
 |  | 0xbf | ,
 |  | 0x3b | ,
 |  | 0xb6 | ,
 |  | 0x37 |
 | ) |  |
DEFINE_GUID | ( | CLSID_PlgSampleFilter | ,
 |  | 0x880b259b | ,
 |  | 0xe851 | ,
 |  | 0x4315 | ,
 |  | 0xab | ,
 |  | 0x63 | ,
 |  | 0xe7 | ,
 |  | 0xcd | ,
 |  | 0xc8 | ,
 |  | 0x70 | ,
 |  | 0x3e | ,
 |  | 0x41 |
 | ) |  |
DEFINE_GUID | ( | CLSID_PlgSuperSampleClass | ,
 |  | 0x41b0921d | ,
 |  | 0x7119 | ,
 |  | 0x4ba4 | ,
 |  | 0x9b | ,
 |  | 0x6b | ,
 |  | 0xd3 | ,
 |  | 0x15 | ,
 |  | 0xc5 | ,
 |  | 0x2b | ,
 |  | 0x93 | ,
 |  | 0xb2 |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/pluggable/plgterm.cpp File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • pluggable

plgterm.cpp File Reference

#include "stdafx.h"
#include "PlgTerm.h"
#include <initguid.h>
#include "GUIDs.h"
#include "PlgTermFilter.h"
#include "PlgTermSample_i.c"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/pluggable/plgterm.h File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • pluggable
Classes | Defines

plgterm.h File Reference

#include "PlgTermPriv.h"

Go to the source code of this file.

Classes

class | CPlgTermSample

Defines

#define | SZTERMNAME _T("Pluggable Sample Terminal")

Define Documentation

#define SZTERMNAME _T("Pluggable Sample Terminal")

Definition at line 12 of file plgterm.h.

Generated on Wed Nov 13 2024 16:54:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/pluggable/plgtermfilter.cpp File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • pluggable

plgtermfilter.cpp File Reference

#include "stdafx.h"
#include <initguid.h>
#include "PlgTermPin.h"
#include "GUIDs.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/pluggable/plgtermfilter.h File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • pluggable
Classes

plgtermfilter.h File Reference

#include "PlgTermPriv.h"
#include "stdafx.h"
#include <streams.h>

Go to the source code of this file.

Classes

class CPlgFilter
Generated on Wed Nov 13 2024 16:54:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/pluggable/plgtermpin.cpp File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • pluggable

plgtermpin.cpp File Reference

#include "stdafx.h"
#include "PlgTermPin.h"
#include <initguid.h>
#include "GUIDs.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/pluggable/plgtermpin.h File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • pluggable
Classes

plgtermpin.h File Reference

#include "PlgTermFilter.h"
#include <source.h>

Go to the source code of this file.

Classes

class CPlgPin
Generated on Wed Nov 13 2024 16:54:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/pluggable/plgtermpriv.h File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • pluggable
Functions

plgtermpriv.h File Reference

#include <objbase.h>
#include <initguid.H>

Go to the source code of this file.

Functions

interface __declspec (uuid("26b65f6d-f315-4162-95a0-637b21c0cb6f")) ITPlgPrivEventSink
DEFINE_GUID (IID_ITPlgPrivEventSink, 0x26b65f6d, 0xf315, 0x4162, 0x95, 0xa0, 0x63, 0x7b, 0x21, 0xc0, 0xcb, 0x6f)

Function Documentation

interface __declspec ( uuid("26b65f6d-f315-4162-95a0-637b21c0cb6f") )

Definition at line 13 of file plgtermpriv.h.

                                                                                : public IUnknown
//
// ITPlgPrivEventSink
//
//interface DECLSPEC_NOVTABLE ITPlgPrivEventSink : IUnknown
//DECLARE_INTERFACE_(
//    ITPlgPrivEventSink, IUnknown)
{
    STDMETHOD (FireEvent)(long lEventCode) = 0;
};

DEFINE_GUID | ( | IID_ITPlgPrivEventSink | ,
 |  | 0x26b65f6d | ,
 |  | 0xf315 | ,
 |  | 0x4162 | ,
 |  | 0x95 | ,
 |  | 0xa0 | ,
 |  | 0x63 | ,
 |  | 0x7b | ,
 |  | 0x21 | ,
 |  | 0xc0 | ,
 |  | 0xcb | ,
 |  | 0x6f |
 | ) |  |
Generated on Wed Nov 13 2024 16:54:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/pluggable/plgtermsample.idl File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • pluggable
Classes | Namespaces | Defines | Functions

plgtermsample.idl File Reference

Go to the source code of this file.

Classes

class | PLGTRMSMPLib::PlgTermSample

Namespaces

namespace | PLGTRMSMPLib

Defines

#define | __PLG_TERMSAMPLE_IDL__

Functions

PLGTRMSMPLib::importlib ("stdole32.tlb")
PLGTRMSMPLib::importlib ("stdole2.tlb")

Define Documentation

#define __PLG_TERMSAMPLE_IDL__

Definition at line 12 of file plgtermsample.idl.

Generated on Wed Nov 13 2024 16:54:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/pluggable/pluggable.cpp File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • pluggable
Functions | Variables

pluggable.cpp File Reference

#include "stdafx.h"
#include <termmgr.h>
#include "PlgTerm.h"
#include <initguid.h>
#include "GUIDs.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)
HRESULT | PTRegister ()
HRESULT | PTRegisterPluggable (BSTR bstrSuperclassCLSID)
HRESULT | PTUnregister ()

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 377 of file pluggable.cpp.

{
#ifdef _MERGE_PROXYSTUB
    if ( PrxDllCanUnloadNow() != S_OK )
    {
        return S_FALSE;
    }
#endif

    if ( _Module.GetLockCount() == 0 )
    {
        //
        // All references to COM objects in this DLL have been released, so
        // the DLL can now be safely unloaded. After this returns, DllMain
        // will be called with dwReason == DLL_PROCESS_DETACH.
        //
        return S_OK;
    }
    else
    {
        return S_FALSE;
    }
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 404 of file pluggable.cpp.

{
#ifdef _MERGE_PROXYSTUB
    if ( PrxDllGetClassObject(rclsid, riid, ppv) == S_OK )
    {
        return S_OK;
    }
#endif
    return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID | lpReserved
 | ) |  |

Definition at line 342 of file pluggable.cpp.

{
    lpReserved;

#ifdef _MERGE_PROXYSTUB
    if (!PrxDllMain(hInstance, dwReason, lpReserved))
    {
        return FALSE;
    }
#endif

    if (dwReason == DLL_PROCESS_ATTACH)
    {

#ifdef DEBUG_HEAPS
        // turn on leak detection on process exit
        _CrtSetDbgFlag( _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF );
#endif // DEBUG_HEAPS

        _Module.Init(ObjectMap, hInstance);
        DisableThreadLibraryCalls(hInstance);
        MSPLOGREGISTER(_T("sampleterm"));

    }
    else if (dwReason == DLL_PROCESS_DETACH)
    {
        MSPLOGDEREGISTER();
        _Module.Term();
    }
    return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 418 of file pluggable.cpp.

{
    //
    // Register terminals
    //
    PTRegister();

#ifdef _MERGE_PROXYSTUB
    HRESULT hRes = PrxDllRegisterServer();

    if ( FAILED(hRes) )
    {
        return hRes;
    }
#endif

    // registers object, typelib and all interfaces in typelib
    return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 441 of file pluggable.cpp.

{
    //
    // Unregister terminals
    //
    PTUnregister();

#ifdef _MERGE_PROXYSTUB
    PrxDllUnregisterServer();
#endif

    _Module.UnregisterServer();

    return S_OK;
}

HRESULT PTRegister ( )

Definition at line 164 of file pluggable.cpp.

{

    LOG((MSP_TRACE, "PTRegister enter"));

    HRESULT hr=E_FAIL;

    //
    // need to register superclass terminals
    //
    CComPtr<ITPluggableTerminalSuperclassRegistration> pITPTSuperReg=NULL;
    hr=CoCreateInstance(CLSID_PluggableSuperclassRegistration,
              NULL,
              CLSCTX_INPROC_SERVER,
              IID_ITPluggableTerminalSuperclassRegistration,
              reinterpret_cast<void**>(&pITPTSuperReg));
    if(FAILED(hr))
    {
        LOG((MSP_ERROR, "CoCreateInstance - ITPluggableTerminalSuperclassRegistration 0x%08x", hr));
        return hr;
    }

    //
    //we need to put_CLSID - first operation - need for GetTerminalSuperclassInfo
    //
    LPOLESTR bstrSuperCLSID = NULL;
    hr = StringFromCLSID(CLSID_PlgSuperSampleClass, &bstrSuperCLSID);

    if(FAILED(hr))
    {
        LOG((MSP_ERROR, "StringFromCLSID 0x%08x", hr));
        return hr;
    }

    hr=pITPTSuperReg->put_CLSID(bstrSuperCLSID);

    //
    //clean up
    //
    CoTaskMemFree(bstrSuperCLSID);
    bstrSuperCLSID=NULL;

    if(FAILED(hr))
    {
        LOG((MSP_ERROR, "ITPluggableTerminalSuperclassRegistration::put_CLSID 0x%08x", hr));
        return hr;
    }
    if(FAILED(pITPTSuperReg->GetTerminalSuperclassInfo()))
    {
  //
  //it's ok just add one
  //
  BSTR bstrName = SysAllocString( _T("PluggableTerminalsSamples") );
        if(bstrName==NULL)
        {
            LOG((MSP_ERROR, "SysAllocString failed"));
            return E_OUTOFMEMORY;
        }
        //
        //try to put name
        //
        pITPTSuperReg->put_Name(bstrName);
        //
        //clean up
        //
        ::SysFreeString(bstrName);
        bstrName=NULL;

        hr=pITPTSuperReg->Add();
        if(FAILED(hr))
        {
            LOG((MSP_ERROR, "ITPluggableTerminalSuperclassRegistration::Add 0x%08x", hr));
            return hr;
        }
    }

    hr = StringFromCLSID(CLSID_PlgSuperSampleClass, &bstrSuperCLSID);

    if(FAILED(hr))
    {
        LOG((MSP_ERROR, "StringFromCLSID 0x%08x", hr));
        return hr;
    }

    //
    //register the class
    //
    hr=PTRegisterPluggable(bstrSuperCLSID);

    //
    //clean up
    //
    CoTaskMemFree(bstrSuperCLSID);
    bstrSuperCLSID=NULL;

    if(FAILED(hr))
    {
        LOG((MSP_ERROR, "PTRegisterPluggable 0x%08x", hr));
    }

    LOG((MSP_TRACE, "PTRegisterPluggable exit - 0x%08x", hr));
    return hr;
}

HRESULT PTRegisterPluggable ( BSTR bstrSuperclassCLSID )

Definition at line 49 of file pluggable.cpp.

{
    LOG((MSP_TRACE, "PTRegisterPluggable enter"));

    HRESULT hr=E_FAIL;
    CComPtr<ITPluggableTerminalClassRegistration> pITPTClassReg=NULL;
    hr=CoCreateInstance(CLSID_PluggableTerminalRegistration,
              NULL,
              CLSCTX_INPROC_SERVER,
              IID_ITPluggableTerminalClassRegistration,
              reinterpret_cast<void**>(&pITPTClassReg));
    if(FAILED(hr))
    {
        LOG((MSP_ERROR, "CoCreateInstance - ITPluggableTerminalClassRegistration 0x%08x", hr));
        return hr;
    }

    //
    // Get the TerminalClass id
    //

    LPOLESTR pszTerminalCLSID = NULL;
    hr = StringFromCLSID(CLSID_PlgTermSampleClass, &pszTerminalCLSID);
    if (FAILED(hr))
    {
        LOG((MSP_ERROR, "StringFromCLSID 0x%08x", hr));
        return hr;
    }

    hr=pITPTClassReg->put_TerminalClass(pszTerminalCLSID);
    CoTaskMemFree(pszTerminalCLSID);
    if(FAILED(hr))
    {
        LOG((MSP_ERROR, "ITPluggableTerminalClassRegistration::put_TerminalClass 0x%08x", hr));
        return hr;
    }

    //
    // Get terminal's com class id
    //

    LPOLESTR pszCOMClassID = NULL;
    hr = StringFromCLSID(CLSID_PlgTermSample, &pszCOMClassID);
    if (FAILED(hr))
    {
        LOG((MSP_ERROR, "StringFromCLSID 0x%08x", hr));
        return hr;
    }

    hr=pITPTClassReg->put_CLSID(pszCOMClassID);
    CoTaskMemFree(pszCOMClassID);
    if(FAILED(hr))
    {
        LOG((MSP_ERROR, "ITPluggableTerminalClassRegistration::put_CLSID 0x%08x", hr));
        return hr;
    }

    //
    // Set other terminal attributes - don't care if FAILs or bstrTemp == NULL
    //

    //
    //name
    //
    BSTR bstrTemp = SysAllocString(SZTERMNAME);
    pITPTClassReg->put_Name(bstrTemp);
    ::SysFreeString(bstrTemp);

    //
    //company
    //
    bstrTemp = SysAllocString( _T("Sample SDK") );
    pITPTClassReg->put_Company(bstrTemp);
    ::SysFreeString(bstrTemp);

    //
    //version
    //
    bstrTemp = SysAllocString( _T("1.2") );
    pITPTClassReg->put_Version(bstrTemp);
    ::SysFreeString(bstrTemp);

    //
    //direction
    //
    TMGR_DIRECTION   td = TMGR_TD_RENDER;
    pITPTClassReg->put_Direction(td);

    //
    //media type
    //
    long lMediaType=TAPIMEDIATYPE_AUDIO;
    pITPTClassReg->put_MediaTypes(lMediaType);

    //
    // Register terminal
    //
    hr = pITPTClassReg->Add( bstrSuperclassCLSID );
    if(FAILED(hr))
    {
        LOG((MSP_ERROR, "ITPluggableTerminalClassRegistration::Add 0x%08x", hr));
    }
    LOG((MSP_TRACE, "PTRegisterPluggable exit - 0x%08x", hr));
    return hr;
}

HRESULT PTUnregister ( )

Definition at line 274 of file pluggable.cpp.

{
    LOG((MSP_TRACE, "PTUnregister enter"));

    HRESULT hr=E_FAIL;
    CComPtr<ITPluggableTerminalClassRegistration> pITPTClassReg=NULL;
    hr=CoCreateInstance(CLSID_PluggableTerminalRegistration,
              NULL,
              CLSCTX_INPROC_SERVER,
              IID_ITPluggableTerminalClassRegistration,
              reinterpret_cast<void**>(&pITPTClassReg));
    if(FAILED(hr))
    {
        LOG((MSP_ERROR, "CoCreateInstance - ITPluggableTerminalClassRegistration 0x%08x", hr));
        return hr;
    }

    //
    // Get the TerminalClass id
    //

    LPOLESTR pszTerminalCLSID = NULL;
    hr = StringFromCLSID(CLSID_PlgTermSampleClass, &pszTerminalCLSID);
    if (FAILED(hr))
    {
        LOG((MSP_ERROR, "StringFromCLSID 0x%08x", hr));
        return hr;
    }

    hr=pITPTClassReg->put_TerminalClass(pszTerminalCLSID);
    CoTaskMemFree(pszTerminalCLSID);
    if(FAILED(hr))
    {
        LOG((MSP_ERROR, "ITPluggableTerminalClassRegistration::put_TerminalClass 0x%08x", hr));
        return hr;
    }

    //
    //CLSID for superclass
    //

    LPOLESTR bstrSuperCLSID = NULL;
    hr = StringFromCLSID(CLSID_PlgSuperSampleClass, &bstrSuperCLSID);

    if(FAILED(hr))
    {
        LOG((MSP_ERROR, "StringFromCLSID 0x%08x", hr));
        return hr;
    }

    hr=pITPTClassReg->Delete(bstrSuperCLSID);

    //
    //clean up
    //
    CoTaskMemFree(bstrSuperCLSID);
    bstrSuperCLSID=NULL;

    LOG((MSP_TRACE, "PTUnregister exit - 0x%08x", hr));
    return hr;

}

Variable Documentation

CComModule _Module

Definition at line 34 of file pluggable.cpp.

Generated on Wed Nov 13 2024 16:54:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/pluggable/resource.h File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • pluggable
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_PLG_TEST 120
#define | IDS_TERMINAL_NAME 121

Define Documentation

#define IDR_PLG_TEST 120

Definition at line 5 of file resource.h.

#define IDS_TERMINAL_NAME 121

Definition at line 6 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/pluggable/stdafx.cpp File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • pluggable
Defines

stdafx.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Defines

#define INITGUID

Define Documentation

#define INITGUID

Definition at line 7 of file stdafx.cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/pluggable/stdafx.h File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • pluggable
Defines | Variables

stdafx.h File Reference

#include <atlbase.h>
#include <atlcom.h>
#include <mspbase.h>
#include "resource.h"
#include "PlgTermSample.h"
#include "resource.h"

Go to the source code of this file.

Defines

#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define STRICT

Definition at line 15 of file stdafx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/Rend/RendSam.Cpp File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • Rend
Defines | Functions | Variables

RendSam.Cpp File Reference

#include <windows.h>
#include <objbase.h>
#include <comdef.h>
#include <stdio.h>
#include <winsock.h>
#include <rend.h>
#include <sdpblb.h>
#include <strsafe.h>

Go to the source code of this file.

Defines

#define | END_STEP(hr)
#define | RELEASE_COM_IF(pInterface)
#define | RETURN_IF_FAILED(hr)
#define | RND_MAX_STRING_FORMAT 4096
#define | START_STEP(wszStep)

Functions

HRESULT | AddConference (ITRendezvous *pIRend, ITDirectory *pIDir, _bstr_t bstrtConfName)
HRESULT | AddUser (ITRendezvous *pIRend, ITDirectory *pIDir, _bstr_t bstrtUserName, _bstr_t bstrtIPPhonePrimary)
HRESULT | ConfigConference (ITDirectoryObject *pIObj)
HRESULT | ConfigUser (ITDirectoryObject *pIObj)
HRESULT | CreateUser (ITRendezvous *pIRend, bstr_t bstrtUserName, bstr_t bstrtIPPhonePriamry, ITDirectoryObject **ppIObj)
HRESULT | DeleteConference (ITRendezvous *pIRend, ITDirectory *pIDir, _bstr_t bstrtConfName)
HRESULT | DeleteUser (ITRendezvous *pIRend, ITDirectory *pIDir, _bstr_t bstrtUserName, _bstr_t bstrtIPPhonePrimary)
HRESULT | EnumObjects (ITDirectory *pIDir, DIRECTORY_OBJECT_TYPE DirectoryObjectType, _bstr_t bstrtFilter)
HRESULT | ListObject (ITDirectoryObject *pIObj)
int _cdecl | main (int argc, char *argv[])
HRESULT | OpenILS (ITRendezvous *pIRend, _bstr_t bstrtILS, ITDirectory **ppIDir)
HRESULT | SetConnectionIP (ITDirectoryObjectConference *pIConf, _bstr_t bstrtMediaName, _bstr_t bstrtIP)

Variables

const _bstr_t | bstrtEMPTY = _bstr_t(L"")
WCHAR | szText [RND_MAX_STRING_FORMAT]

Define Documentation

#define END_STEP ( hr )
Value:
{   \
        if (FAILED(hr)) \
        {               \
           wprintf(L"\tFailed with error 0x%x\n", hr);\
           return hr;   \
        }               \
        else            \
        {               \
            wprintf(L"\tDone.\n");\
        }               \
    }

Definition at line 88 of file RendSam.Cpp.

#define RELEASE_COM_IF ( pInterface )
Value:
{   \
        if (NULL != pInterface) \
        {                       \
            pInterface->Release();\
            pInterface = NULL;  \
        }                       \
    }

Definition at line 73 of file RendSam.Cpp.

#define RETURN_IF_FAILED ( hr )
Value:
{   \
        if (FAILED(hr)) \
        {               \
            return hr;  \
        }               \
    }

Definition at line 65 of file RendSam.Cpp.

#define RND_MAX_STRING_FORMAT 4096

Definition at line 63 of file RendSam.Cpp.

#define START_STEP ( wszStep )
Value:
{  \
  StringCbPrintfW(szText, RND_MAX_STRING_FORMAT, L"%s ...\n", wszStep); \
  _putws(szText);  \
}

Definition at line 82 of file RendSam.Cpp.

Function Documentation

HRESULT AddConference | ( | ITRendezvous * | pIRend,
 |  | ITDirectory * | pIDir,
 |  | _bstr_t | bstrtConfName
 | ) |  |

Definition at line 425 of file RendSam.Cpp.

                   :

    Add a conference to an ILS server. Use ConfigConference to set selected
    attributes of the conference.
    Existing conference with same name is deleted first to avoid "Object
    already exists" error.

Arguments:

    pIRend  : an ITRendezvous interface
    pIDir   : an ITDirectory interface
    bstrtConfName : name of the conference

Return Value:

    HRESULT

--*/
{
    //
    // verify parameter validity
    //
    if ((NULL == pIRend) || (NULL == pIDir))
    {
        return E_POINTER;
    }

    if (bstrtEMPTY == bstrtConfName)
    {
        return E_INVALIDARG;
    }

    ITDirectoryObject   *pIObj;

    //
    // create an conference object
    //
    HRESULT hr = pIRend->CreateDirectoryObject(OT_CONFERENCE,
                                               bstrtConfName,
                                               &pIObj
                                              );
    RETURN_IF_FAILED(hr);

    // to ensure a successful creating, delete it first in case a same
    // name conference already exists. since it'll fail if the conference
    // does not exist, i don't bother checking the error code
    pIDir->DeleteDirectoryObject(pIObj);

    //
    // cofigure the conference
    //
    RETURN_IF_FAILED(ConfigConference(pIObj));

    //
    // add the conference to the ILS server
    //
    hr = pIDir->AddDirectoryObject(pIObj);

    // release the ITDirectoryObject interface
    RELEASE_COM_IF(pIObj);

    RETURN_IF_FAILED(hr);

    return S_OK;

} // AddConference

HRESULT AddUser | ( | ITRendezvous * | pIRend,
 |  | ITDirectory * | pIDir,
 |  | _bstr_t | bstrtUserName,
 |  | _bstr_t | bstrtIPPhonePrimary
 | ) |  |

Definition at line 621 of file RendSam.Cpp.

                   :

    Add a user object to the ILS server.
    Existing user with same IPPhonePrimary is deleted first to avoid "Object
    already exists" error.

Arguments:

    pIRend  : an ITRendezvous interface
    pIDir   : an ITDirectory interface
    bstrtUserName       : name of the user
    bstrtIPPhonePrimary : IPPhonePrimary value

Return Value:

    HRESULT

--*/
{
    if (NULL == pIDir)
    {
        return E_POINTER;
    }

    // no need to check other parameter validity. will be done in CreatUser

    ITDirectoryObject   *pIObj;

    //
    // create the user object with given IPPhonePrimary
    //
    RETURN_IF_FAILED(CreateUser(pIRend,
                                bstrtUserName,
                                bstrtIPPhonePrimary,
                                &pIObj)
                    );

    //
    // configure other attributes of the user object
    //
    RETURN_IF_FAILED(ConfigUser(pIObj));

    // to ensure a successful creating, delete it first in case a same
    // name user with same IPPhonePrimary already exists. since it'll fail
    // if the conference does not exist, i won't bother checking the error
    // code
    pIDir->DeleteDirectoryObject(pIObj);

    //
    // add the user object to the ILS server
    //
    HRESULT hr = pIDir->AddDirectoryObject(pIObj);

    // release the ITDirectoryObject interface
    RELEASE_COM_IF(pIObj);

    return S_OK;

} // AddUser

HRESULT ConfigConference ( ITDirectoryObject * pIObj )

Definition at line 336 of file RendSam.Cpp.

                   :

    Configure a conference's selected attributes:
    1. set StartTime as current, and StopTime as 1 day later
    2. set the conference's default multicast IP address
    3. set "video" media's multicast IP address. "audio" media will use the
       conference's default IP address set in the above step

Arguments:

    pIObj : ITDirectoryObject interface

Return Value:

    HRESULT

--*/
{
    if (NULL == pIObj)
    {
        return E_POINTER;
    }

    //
    // query the ITDirectoryObjectConference interface
    //

    ITDirectoryObjectConference *   pIConf;
    HRESULT hr = pIObj->QueryInterface(IID_ITDirectoryObjectConference,
                                       (void **) &pIConf
                                       );
    RETURN_IF_FAILED(hr);

    //
    // set StartTime to current local time
    //

    SYSTEMTIME  LocalSysTime;
    GetLocalTime(&LocalSysTime);

    double vTime;
    SystemTimeToVariantTime(&LocalSysTime, &vTime);

    RETURN_IF_FAILED(pIConf->put_StartTime(vTime));

    //
    // set StopTime to one day later
    //

    hr = pIConf->put_StopTime(vTime + 1);

    //
    // set the conference's default multicast IP address
    // use an arbitrary IP address for simplicity
    //

    hr = SetConnectionIP(pIConf,
                         bstrtEMPTY,
                         _bstr_t(L"224.0.0.1"));
    RETURN_IF_FAILED(hr);

    //
    // set media "video"'s multicast IP address
    // for simplicity, use an arbitrary IP address
    //

    hr = SetConnectionIP(pIConf,
                         _bstr_t(L"video"),
                         _bstr_t(L"224.0.0.2"));
    RETURN_IF_FAILED(hr);

    //
    // clean-up
    //

    RELEASE_COM_IF(pIConf);

    return hr;

} // ConfigConference

HRESULT ConfigUser ( ITDirectoryObject * pIObj )

Definition at line 572 of file RendSam.Cpp.

                   :

    Configure selected attributes of a user object.
    Currently none is selected, so this routine does nothing.
    Will expand this routine when more attributes are defined.

Arguments:

    pIObj               : ITDirectoryObject interface

Return Value:

    HRESULT

--*/
{
    if (NULL == pIObj)
    {
        return E_POINTER;
    }

    //
    // query the ITDirectoryObjectUser interface
    //
    ITDirectoryObjectUser *   pIUser;
    HRESULT hr = pIObj->QueryInterface(IID_ITDirectoryObjectUser,
                                       (void **) &pIUser
                                       );
    RETURN_IF_FAILED(hr);

    //
    // config selected attributes: currently none
    //

    // release the ITDirectoryObjectUser interface
    RELEASE_COM_IF(pIUser);

    return hr;

} // ConfigUser

HRESULT CreateUser | ( | ITRendezvous * | pIRend,
 |  | bstr_t | bstrtUserName,
 |  | bstr_t | bstrtIPPhonePriamry,
 |  | ITDirectoryObject ** | ppIObj
 | ) |  |

Definition at line 503 of file RendSam.Cpp.

                   :

    Create an ITDirectoryObject of type user with specified IPPhonePrimary.

Arguments:

    bstrtUserName       : user name
    bstrtIPPhonePriamry : IPPhonePriamry value
    ppIObj              : return the pointer to an ITDirectoryObject pointer

Return Value:

    HRESULT

--*/
{
    if ((NULL == pIRend) || (NULL == ppIObj))
    {
        return E_POINTER;
    }

    if ((bstrtEMPTY == bstrtUserName) ||
        (bstrtEMPTY == bstrtIPPhonePriamry))
    {
        return E_INVALIDARG;
    }

    //
    // create an conference object
    //
    HRESULT hr = pIRend->CreateDirectoryObject(OT_USER,
                                               bstrtUserName,
                                               ppIObj
                                              );
    RETURN_IF_FAILED(hr);

    //
    // query the ITDirectoryObjectUser interface
    //
    ITDirectoryObjectUser *   pIUser;
    hr = (*ppIObj)->QueryInterface(IID_ITDirectoryObjectUser,
                                   (void **) &pIUser
                                  );
    RETURN_IF_FAILED(hr);

    //
    // set IPPhonePriamry
    //
    hr = pIUser->put_IPPhonePrimary((BSTR) bstrtIPPhonePriamry);
    RETURN_IF_FAILED(hr);

    // release the ITDirectoryObjectUser interface
    RELEASE_COM_IF(pIUser);

    return hr;

} // CreateUser

HRESULT DeleteConference | ( | ITRendezvous * | pIRend,
 |  | ITDirectory * | pIDir,
 |  | _bstr_t | bstrtConfName
 | ) |  |

Definition at line 894 of file RendSam.Cpp.

                   :

    Delete an object

Arguments:

    pIRend  : pointer to an ITRendezvous interface
    pIDir   : pointer to the ILS server's ITDirectory interface
    bstrtConfName : name of the conference to delete

Return Value:

    HRESULT

--*/
{
    if ((NULL == pIRend) || (NULL == pIDir))
    {
        return E_POINTER;
    }

    if (bstrtEMPTY == bstrtConfName)
    {
        return E_INVALIDARG;
    }

    //
    // create the object
    //
    ITDirectoryObject * pIObj;
    HRESULT hr = pIRend->CreateDirectoryObject(OT_CONFERENCE,
                                               bstrtConfName,
                                               &pIObj
                                               );
    RETURN_IF_FAILED(hr);

    //
    // delete it
    //

    hr = pIDir->DeleteDirectoryObject(pIObj);

    RELEASE_COM_IF(pIObj);

    return hr;

} // DeleteConference

HRESULT DeleteUser | ( | ITRendezvous * | pIRend,
 |  | ITDirectory * | pIDir,
 |  | _bstr_t | bstrtUserName,
 |  | _bstr_t | bstrtIPPhonePrimary
 | ) |  |

Definition at line 952 of file RendSam.Cpp.

                   :

    Delete a user object from the ILS server.

Arguments:

    pIRend  : an ITRendezvous interface
    pIDir   : an ITDirectory interface
    bstrtUserName       : name of the user
    bstrtIPPhonePrimary : IPPhonePrimary value

Return Value:

    HRESULT

--*/
{
    // no need to other check parameter validity. will be done in CreatUser
    if (NULL == pIDir)
    {
        return E_POINTER;
    }

    ITDirectoryObject   *pIObj;

    //
    // create the user object with given IPPhonePrimary
    //
    RETURN_IF_FAILED(CreateUser(pIRend,
                                bstrtUserName,
                                bstrtIPPhonePrimary,
                                &pIObj)
                    );

    HRESULT hr = pIDir->DeleteDirectoryObject(pIObj);

    // release the ITDirectoryObject interface
    RELEASE_COM_IF(pIObj);

    return hr;

} // AddUser

HRESULT EnumObjects | ( | ITDirectory * | pIDir,
 |  | DIRECTORY_OBJECT_TYPE | DirectoryObjectType,
 |  | _bstr_t | bstrtFilter
 | ) |  |

Definition at line 814 of file RendSam.Cpp.

                   :

    Enumerate all conference or user objects whose names starting with a
    string specified by bstrtFilter.

Arguments:

    pIDir   : an ITDirectory interface
    DirectoryObjectType : type of objects to enumerate
    bstrtFilter : conference name filter

Return Value:

    HRESULT

--*/
{
    //
    // verify parameter validity
    //
    if (NULL == pIDir)
    {
        return E_POINTER;
    }

    if (bstrtEMPTY == bstrtFilter)
    {
        return E_INVALIDARG;
    }

    //
    // get the enumerator
    //
    IEnumDirectoryObject *  pIEnumObjects;
    HRESULT hr = pIDir->EnumerateDirectoryObjects(DirectoryObjectType,
                                                  bstrtFilter,
                                                  &pIEnumObjects
                                                  );
    RETURN_IF_FAILED(hr);

    //
    // enumerate objects returned in the enumerator
    //
    while (1)
    {
        ITDirectoryObject * pIObj;
        ULONG   cFetched;

        //
        // get an object
        //
        hr = pIEnumObjects->Next(1, &pIObj, &cFetched);

        if (S_OK != hr)
        {
            // either reach the end of the enumerator: hr == S_FALSE
            // or get an error: FAILED(hr) == TRUE
            break;
        }

        ListObject(pIObj);

        RELEASE_COM_IF(pIObj);
    }

    RELEASE_COM_IF(pIEnumObjects);

    return hr;
} // EnumObjects

HRESULT ListObject ( ITDirectoryObject * pIObj )

Definition at line 693 of file RendSam.Cpp.

                   :

    Print out selected object attributes.
    For a conference, conference name and description will be printed.
    For a user, user name and IPPhonePrimary will be printed.

Arguments:

    pIObj   : an ITDirectoryObject interface

Return Value:

    HREULST

--*/
{
    if (NULL == pIObj)
    {
        return E_POINTER;
    }

    //
    // get the object type
    //
    DIRECTORY_OBJECT_TYPE DirectoryObjectType;
    HRESULT hr = pIObj->get_ObjectType(&DirectoryObjectType);
    RETURN_IF_FAILED(hr);

    //
    // get and print object name
    //
    BSTR bstrName;
    hr = pIObj->get_Name( &bstrName);
    RETURN_IF_FAILED(hr);

    if (OT_CONFERENCE == DirectoryObjectType)
    {
        wprintf(L"\t<CONF> ");
    }
    else
    {
        wprintf(L"\t<USER> ");
    }

  WCHAR szName[RND_MAX_STRING_FORMAT];
    StringCbPrintfW(szName, RND_MAX_STRING_FORMAT, L"%s\n",(WCHAR *) bstrName);
    _putws(szName);

    ::SysFreeString (bstrName);

    if (OT_CONFERENCE == DirectoryObjectType)
    {
        ITDirectoryObjectConference * pIConf;
        hr = pIObj->QueryInterface(IID_ITDirectoryObjectConference,
                                   (void **) &pIConf
                                  );
        RETURN_IF_FAILED(hr);

        //
        // get the ITConferenceBlob interface
        //
        ITConferenceBlob *  pIConfBlob;
        hr = pIConf->QueryInterface(IID_ITConferenceBlob,
                                    (void **) &pIConfBlob
                                    );
        RETURN_IF_FAILED(hr);

        //
        // get and print the conference's blob
        //

        BSTR bstrBlob;
        hr = pIConfBlob->get_ConferenceBlob(&bstrBlob);
        RELEASE_COM_IF(pIConfBlob);
        RELEASE_COM_IF(pIConf);
        RETURN_IF_FAILED(hr);

    WCHAR szBlob[RND_MAX_STRING_FORMAT];
    StringCbPrintfW(szBlob, RND_MAX_STRING_FORMAT, L"\t\tBlob:\n%s", (WCHAR *) bstrBlob);
    _putws(szBlob);

        ::SysFreeString (bstrBlob);
    }
    else
    {   // OT_USER
        ITDirectoryObjectUser * pIUser;
        hr = pIObj->QueryInterface(IID_ITDirectoryObjectUser,
                                   (void **) &pIUser
                                  );
        RETURN_IF_FAILED(hr);

        //
        // get and print the user's IPPhonePrimary
        //

        BSTR bstrIPPhonePrimary;
        hr = pIUser->get_IPPhonePrimary(&bstrIPPhonePrimary);
        RELEASE_COM_IF(pIUser);
        RETURN_IF_FAILED(hr);

    WCHAR szPrimary[RND_MAX_STRING_FORMAT];
    StringCbPrintfW(szPrimary, RND_MAX_STRING_FORMAT, L"\t\tIPPhonePrimary: %s\n", (WCHAR *) bstrIPPhonePrimary);
    _putws(szPrimary);

        ::SysFreeString(bstrIPPhonePrimary);
    }

    return S_OK;

} // ListObject

int _cdecl main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 1007 of file RendSam.Cpp.

{
    /*
     * 0. Get ILS server name, if it is specified
     */
    if (argc != 2)
    {
        wprintf(L"No ILS server specified.\n");
        return 1;
    }

    _bstr_t bstrtILSServer = _bstr_t(argv[1]);

    /*
     * 1. Create ITRendezvous interface
     */

    wprintf(L"\n\n");
    START_STEP(L"Initialize Rendezvous Control");

    ::CoInitializeEx(NULL, COINIT_MULTITHREADED);

    // create an ITRendezvous interface
    ITRendezvous    *pIRend;
    HRESULT hr = ::CoCreateInstance(CLSID_Rendezvous,
                                    NULL,
                                    CLSCTX_INPROC_SERVER,
                                    IID_ITRendezvous,
                                    (void**)&pIRend
                                   );
    END_STEP(hr);

    /*
     * 2. Connect and bind to the ILS server
     */

    START_STEP(L"Connect and Bind to the ILS server");
    ITDirectory *pIDir;
    hr = OpenILS(pIRend,
                 bstrtILSServer,
                 &pIDir
                );
    END_STEP(hr);

    /*
     * 3. Add a conference
     */

    START_STEP(L"Add a conference");
    _bstr_t bstrtConfName = _bstr_t(L"Rendezvous Controls Sample Program");
    hr = AddConference(pIRend,
                       pIDir,
                       bstrtConfName
                      );
    END_STEP(hr);

    /*
     * 4. Enumerate conferences
     */

    // use the conference name as a filter for enumeration to limit the set of
    // conferences that will be retrieved.
    // if no filter is set, all conferences will be retrieved

    START_STEP(L"Enumerate conferences");
    hr = EnumObjects(pIDir,
                     OT_CONFERENCE,
                     bstrtConfName);
    END_STEP(hr);

    /*
     * 5. Delete a conference
     */

    START_STEP(L"Delete a conference");
    hr = DeleteConference(pIRend,
                          pIDir,
                          bstrtConfName);
    END_STEP(hr);

    /*
     * 6. Add a user: must specify the IPPhonePrimary value associated with
     *    this user
     */

    //
    // get the local machine's name
    // note: WSAStartup is called in creating ITRendezvous *, so no need to
    // start Winsock for the gethostbyname call
    //

    const int MAXHOSTNAMELEN = 255;
    CHAR        LocalHostName[MAXHOSTNAMELEN];

    if (SOCKET_ERROR == gethostname(LocalHostName, MAXHOSTNAMELEN))
    {
        wprintf(L"Can't find local host name.\n");
        return E_FAIL;
    }

    _bstr_t bstrtUserName = _bstr_t(L"TAPI3 Rend SDK User");
    _bstr_t bstrtIPPhonePrimary = _bstr_t(LocalHostName);

    START_STEP(L"Add a user");
    hr = AddUser(pIRend,
                 pIDir,
                 bstrtUserName,
                 bstrtIPPhonePrimary
                );
    END_STEP(hr);

    /*
     * 7. Enumerate users
     */

    // use the user name as a filter for enumeration to limit the set of
    // users that will be retrieved. all user objects (may having different
    // IPPhonePrimary) with this name will be retrieved
    // if no filter is set, all users will be retrieved

    START_STEP(L"Enumerate users");
    hr = EnumObjects(pIDir,
                     OT_USER,
                     bstrtUserName);
    END_STEP(hr);

    /*
     * 8. Delete a user: must specify the IPPhonePrimary associated with
     *    this user to identify which entry to delete. Note one user may
     *    have several different IPPhonePrimary values.
     */

    START_STEP(L"Delete a user");
    hr = DeleteUser(pIRend,
                    pIDir,
                    bstrtUserName,
                    bstrtIPPhonePrimary);
    END_STEP(hr);

    /*
     * 9. Clean-up
     */

    RELEASE_COM_IF(pIDir);
    RELEASE_COM_IF(pIRend);

    ::CoUninitialize();

    wprintf(L"\n\n");

    return 0;

} // end of main

HRESULT OpenILS | ( | ITRendezvous * | pIRend,
 |  | _bstr_t | bstrtILS,
 |  | ITDirectory ** | ppIDir
 | ) |  |

Definition at line 266 of file RendSam.Cpp.

           :

    Connect to a specified ILS server, then Bind with currently logged on
    credentials. Since the program does not require logging into a domain,
    the Bind operation may fail, and this routine will ignore Bind error.

    An unsecured channel will be used in Connect, as "secured channel" is not
    supported as of the day this is written (NT5 Beta3)

Arguments:

    pIRend  : pointer to an ITRendezvous interface
    bstrtILS: ILS server name
    ppIDir  : pointer to an ITDirectory interface pointer

Return value:

    HRESULT. Bind error will be ignored.

--*/
{
    //
    // check parameter validity
    //
    if ((NULL == pIRend) || (NULL == ppIDir))
    {
        return E_POINTER;
    }

    if (bstrtEMPTY == bstrtILS)
    {
        return E_INVALIDARG;
    }

    //
    // create an ITDirectory object
    //
    HRESULT hr = pIRend->CreateDirectory(DT_ILS, bstrtILS, ppIDir);
    RETURN_IF_FAILED(hr);

    //
    // Connect to the ILS server using an unsecured connection
    //
    hr = (*ppIDir)->Connect(VARIANT_FALSE);
    RETURN_IF_FAILED(hr);

    //
    // Bind to the ILS server with default credentials
    //
    (*ppIDir)->Bind(NULL,
                    NULL,
                    NULL,
                    RENDBIND_DEFAULTCREDENTIALS || RENDBIND_AUTHENTICATE
                   );

    return hr;

} // OpenILS

HRESULT SetConnectionIP | ( | ITDirectoryObjectConference * | pIConf,
 |  | _bstr_t | bstrtMediaName,
 |  | _bstr_t | bstrtIP
 | ) |  |

Definition at line 113 of file RendSam.Cpp.

                   :

    Set a multicast IP address of the specified media. If no media is specified,
    the conference's default connection will be used.

    Note: 1. For simplicity, it is assumed there is at most one ITConnection
             for each media
          2. Will not check if the given IP address is a valid multicast IP

Arguments:

    pIConf          : the conference
    bstrtMediaName  : name of the media, in lower case, such as "audio" or
                      "video". if it's an empty string, then the conference's
                      default connection will be used
    bstrtIP         : the multicast IP address

Return Value:

    HRESULT

--*/
{
    //
    // check parameters
    //

    if (NULL == pIConf)
    {
        return E_POINTER;
    }

    if (bstrtEMPTY == bstrtIP)
    {
        return E_INVALIDARG;
    }

    BOOL    fDefault = FALSE;   // if it's the conference's default connection
    if (bstrtEMPTY == bstrtMediaName)
    {
        fDefault = TRUE;
    }

    //
    // get ITConnection interface
    //

    ITConnection *  pIConnection;
    HRESULT         hr;

    if (fDefault)
    {   // the conference's default connection
        hr = pIConf->QueryInterface(IID_ITConnection,
                                    (void **) &pIConnection);
        RETURN_IF_FAILED(hr);
    }
    else
    {   // search for the specified media, then use its first connection

        //
        // get the media enumerator
        //

        ITSdp * pISdp;
        hr = pIConf->QueryInterface(IID_ITSdp, (void **) &pISdp);
        RETURN_IF_FAILED(hr);

        ITMediaCollection * pIMediaCollec;
        hr = pISdp->get_MediaCollection(&pIMediaCollec);
        RELEASE_COM_IF(pISdp);
        RETURN_IF_FAILED(hr);

        IEnumMedia *    pIEnumMedia;
        hr = pIMediaCollec->get_EnumerationIf(&pIEnumMedia);
        RELEASE_COM_IF(pIMediaCollec);
        RETURN_IF_FAILED(hr);

        //
        // parse each media in the collection to find the one specified
        //

        ITMedia *   pIMedia;
        while ( 1 )
        {
            hr = pIEnumMedia->Next(1, &pIMedia, NULL);

            if (FAILED(hr))
            {
                return hr;
            }
            if (S_FALSE == hr)
            {
                // reach the end of the enumerator, not finding the media
                return E_FAIL;
            }

            //
            // get MediaName then compare it with the given media
            //

            BSTR bstrCurrentMediaName;
            hr = pIMedia->get_MediaName(&bstrCurrentMediaName);
            RETURN_IF_FAILED(hr);

            BOOL fFound = bstrtMediaName == _bstr_t(bstrCurrentMediaName);
            ::SysFreeString (bstrCurrentMediaName );

            if (fFound)
            {
                break;
            }
            else
            {
                RELEASE_COM_IF(pIMedia);
            }
        }

        RELEASE_COM_IF(pIEnumMedia);

        //
        // query ITConnection interface
        //

        hr = pIMedia->QueryInterface(IID_ITConnection,
                                     (void **) &pIConnection);
        RELEASE_COM_IF(pIMedia);
        RETURN_IF_FAILED(hr);
    }

    //
    // set the IP address
    //
    hr = pIConnection->SetAddressInfo((BSTR) bstrtIP,
                                      1,
                                      15);

    RELEASE_COM_IF(pIConnection);

    return hr;

} // SetConnectionIP

Variable Documentation

const _bstr_t bstrtEMPTY = _bstr_t(L"")

Definition at line 54 of file RendSam.Cpp.

WCHAR szText[RND_MAX_STRING_FORMAT]

Definition at line 64 of file RendSam.Cpp.

Generated on Wed Nov 13 2024 16:54:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/tapirecv/avifilewriter.cpp File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • tapirecv

avifilewriter.cpp File Reference

#include "common.h"
#include "AVIFileWriter.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/tapirecv/avifilewriter.h File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • tapirecv
Classes

avifilewriter.h File Reference

Go to the source code of this file.

Classes

class CAVIFileWriter
Generated on Wed Nov 13 2024 16:54:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/tapirecv/common.h File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • tapirecv
Defines | Functions | Variables

common.h File Reference

#include <stdio.h>
#include <windows.h>
#include <tapi3.h>
#include <crtdbg.h>
#include <control.h>
#include <strmif.h>
#include <uuids.h>
#include <mmsystem.h>
#include <amstream.h>
#include <vfw.h>
#include <Mtype.h>
#include <strsafe.h>
#include "WorkerThread.h"

Go to the source code of this file.

Defines

#define | _WIN32_DCOM
#define | LogError LogMessage
#define | WM_PRIVATETAPIEVENT WM_USER+101

Functions

void * | AllocateMemory (SIZE_T nMemorySize)
void | FreeMemory (void *pMemory)
void | LogFormat (const WAVEFORMATEX *pWaveFormat)
void | LogMessage (CHAR *pszFormat,...)
HRESULT | OnTapiEvent (TAPI_EVENT TapiEvent, IDispatch *pEvent)

Variables

CRITICAL_SECTION | g_CurrentCallCritSection
HANDLE g_hExitEvent
ITBasicCallControl * | g_pCurrentCall
ITTAPI * | g_pTapi
CWorkerThread g_WorkerThread

Define Documentation

#define _WIN32_DCOM

Definition at line 18 of file common.h.

#define LogError LogMessage

Definition at line 83 of file common.h.

#define WM_PRIVATETAPIEVENT WM_USER+101

Definition at line 20 of file common.h.

Function Documentation

void* AllocateMemory ( SIZE_T nMemorySize )

Definition at line 198 of file tapirecv.cpp.

{

    //
    // use HeapAlloc to allocate and clear memory
    //

    return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, nMemorySize);
}

void FreeMemory ( void * pMemory )

Definition at line 220 of file tapirecv.cpp.

{

    //
    // get size of the allocated memory
    //

    SIZE_T nMemorySize = HeapSize(GetProcessHeap(), 0, pMemory);

    if (-1 == nMemorySize)
    {
        LogError("FreeMemory: failed to get size of the memory block %p",
                 pMemory);

        //
        // don't exit -- try freeing anyway
        //

    }
    else
    {
        //
        // fill memory with 0xdd's before freeing, so it is easier to debug
        // failures caused by using pointer to deallocated memory
        //

        if (NULL != pMemory)
        {
            FillMemory(pMemory, nMemorySize, 0xdd);
        }

    }

    //
    // use HeapFree to free memory. use return code to log the result, but
    // do not return it to the caller
    //

    BOOL bFreeSuccess = HeapFree(GetProcessHeap(), 0, pMemory);

    if (FALSE == bFreeSuccess)
    {
        LogError("FreeMemory: HeapFree failed");

        //
        // if this assertion fires, it is likely there is a problem with the
        // memory we are trying to deallocate. Was it allocated using heapalloc
        // and on the same heap? Is this a valid pointer?
        //

        _ASSERTE(FALSE);
    }

}

void LogFormat ( const WAVEFORMATEX * pWaveFormat )

Definition at line 176 of file tapirecv.cpp.

{
    LogMessage("    Format: ");
    LogMessage("        tag: %u", pWaveFormat->wFormatTag);
    LogMessage("        channels: %u", pWaveFormat->nChannels);
    LogMessage("        samples/sec: %lu", pWaveFormat->nSamplesPerSec);
    LogMessage("        align: %u", pWaveFormat->nBlockAlign);
    LogMessage("        bits/sample: %u", pWaveFormat->wBitsPerSample);

}

void LogMessage | ( | CHAR * | pszFormat,
 |  |  | ...
 | ) |  |

Definition at line 70 of file tapirecv.cpp.

{

    //
    // output buffer -- note: hardcoded limit
    //

    static const BUFFER_SIZE = 1280;

    char szBuffer[BUFFER_SIZE];

    //
    // get current time
    //

    SYSTEMTIME SystemTime;

    GetLocalTime(&SystemTime);

    //
    // format thread id and time
    //

    StringCbPrintf( szBuffer, BUFFER_SIZE, "[%lx]:[%02u:%02u:%02u.%03u]::",
             GetCurrentThreadId(),
             SystemTime.wHour,
             SystemTime.wMinute,
             SystemTime.wSecond,
             SystemTime.wMilliseconds);

    size_t iStringLength = 0;

    HRESULT hr = StringCbLength(szBuffer, BUFFER_SIZE, &iStringLength);

    if (FAILED(hr))
    {
        // either this code is wrong, or someone else in the process corrupted
        // our memory.
        return;
    }

    //
    // get the actual message
    //

    va_list vaArguments;

    va_start(vaArguments, pszFormat);

    size_t iBytesLeft = BUFFER_SIZE - iStringLength;

    //
    // not checking the return code of this function. even if it fails, we will
    // have a null-terminated string that we will be able to log.
    //

    StringCbVPrintf( &(szBuffer[iStringLength]), iBytesLeft, pszFormat, vaArguments);

    va_end(vaArguments);

    //
    // how big is the string now, and how many bytes do we have left?
    //

    hr = StringCbLength(szBuffer, BUFFER_SIZE, &iStringLength);

    if (FAILED(hr))
    {
        // either this code is wrong, or someone else in the process corrupted
        // our memory.
        return;
    }

    iBytesLeft = BUFFER_SIZE - iStringLength;

    //
    // append a carriage return to the string. ignore the result code, the
    // result string will be null-terminated no matter what.
    //

    StringCbCat(szBuffer, iBytesLeft, "\n");

    //
    // log the buffer
    //

    printf(szBuffer);
}

HRESULT OnTapiEvent | ( | TAPI_EVENT | TapiEvent,
 |  | IDispatch * | pEvent
 | ) |  |

Definition at line 255 of file Callnot.Cpp.

{
    HRESULT hr;

    switch ( TapiEvent )
    {
        case TE_CALLNOTIFICATION:
        {
            //
            // TE_CALLNOTIFICATION means that the application is being notified
            // of a new call.
            //
            // Note that we don't answer to call at this point.  The application
            // should wait for a CS_OFFERING CallState message before answering
            // the call.
            //

            ITCallNotificationEvent         * pNotify;

            hr = pEvent->QueryInterface( IID_ITCallNotificationEvent, (void **)&pNotify );

            if (S_OK != hr)
            {
                DoMessage( L"Incoming call, but failed to get the interface");
            }
            else
            {
                CALL_PRIVILEGE          cp;
                ITCallInfo *            pCall;

                //
                // get the call
                //

                hr = pNotify->get_Call( &pCall );

                pNotify->Release();

                if ( SUCCEEDED(hr) )
                {
                    //
                    // check to see if we own the call
                    //

                    hr = pCall->get_Privilege( &cp );

                    if ( FAILED(hr) || (CP_OWNER != cp) )
                    {
                        //
                        // just ignore it if we don't own it
                        //

                        pCall->Release();

                        pEvent->Release(); // we addrefed it CTAPIEventNotification::Event()

                        return S_OK;
                    }

                    //
                    // Get the ITBasicCallControl interface
                    //

                    //
                    // If we're already in a call, disconnect the new call.  Otherwise,
                    // save it in our global variable.
                    //

                    ITBasicCallControl * pCallControl;

                    hr = pCall->QueryInterface( IID_ITBasicCallControl,
                                                (void**)&pCallControl );

                    pCall->Release();

                    if ( SUCCEEDED(hr) )
                    {
                        if (gpCall == NULL)
                        {
                            gpCall = pCallControl;

                            //
                            // update UI
                            //

                            EnableButton( IDC_ANSWER );
                            DisableButton( IDC_DISCONNECT );
                            SetStatusMessage(L"Incoming Owner Call");
                        }
                        else
                        {
                            //
                            // Reject this call since we're already in a call
                            //

                            hr = pCallControl->Disconnect(DC_REJECTED);

                            pCallControl->Release();

                            if (FAILED(hr))
                            {
                                break;
                            }
                        }
                    }

                }
            }

            break;
        }

        case TE_CALLSTATE:
        {
            // TE_CALLSTATE is a call state event.  pEvent is
            // an ITCallStateEvent

            CALL_STATE           cs;
            ITCallStateEvent   * pCallStateEvent;
            ITCallInfo *         pCall;
            ITBasicCallControl * pCallControl;

            // Get the interface
            hr = pEvent->QueryInterface( IID_ITCallStateEvent, (void **)&pCallStateEvent );

            if ( FAILED(hr) )
            {
                break;
            }

            // get the CallInfo interface
            hr = pCallStateEvent->get_Call( &pCall );

            if ( FAILED(hr) )
            {
                pCallStateEvent->Release();
                break;
            }

            //get the ITBasicCallControl interface and compare it to our existing call
            hr = pCall->QueryInterface( IID_ITBasicCallControl,(void**)&pCallControl );

            pCall->Release();

            if (FAILED(hr))
            {
                pCallStateEvent->Release();
                break;
            }

            //ignore call state events for other calls
            if (pCallControl != gpCall)
            {
                pCallControl->Release();
                pCallStateEvent->Release();
                break;
            }
            pCallControl->Release();

            //
            // This is a call state event for our call
            //

            // get the CallState that we are being notified of.
            hr = pCallStateEvent->get_State( &cs );

            // Release the interface
            pCallStateEvent->Release();

            if ( FAILED(hr) )
            {
                break;
            }

            // if it's offering, update our UI
            if (CS_OFFERING == cs)
            {
                if (gfAutoAnswer)
                {
                    PostMessage(ghDlg, WM_COMMAND, IDC_ANSWER, 0);
                }
                else
                {
                    SetStatusMessage(L"Click the Answer button");
                }
            }
            else if (CS_DISCONNECTED == cs)
            {
                PostMessage(ghDlg, WM_COMMAND, IDC_DISCONNECTED, 0);
            }
            else if (CS_CONNECTED == cs)
            {
                // nothing to do -- we handle connection synchronously
            }

            break;
        }

        case TE_CALLMEDIA:
        {
            // TE_CALLMEDIA is a media event.  pEvent is
            // an ITCallMediaEvent

            CALL_MEDIA_EVENT    cme;
            ITCallMediaEvent  * pCallMediaEvent;

            // Get the interface
            hr = pEvent->QueryInterface( IID_ITCallMediaEvent, (void **)&pCallMediaEvent );

            if ( FAILED(hr) )
            {
                break;
            }

            // get the CALL_MEDIA_EVENT that we are being notified of.
            hr = pCallMediaEvent->get_Event( &cme );

            if ( SUCCEEDED(hr) )
            {
                switch ( cme )
                {
                case CME_STREAM_NOT_USED:
                case CME_STREAM_INACTIVE:
                case CME_NEW_STREAM:
                    break;

                case CME_STREAM_FAIL:
                    DoMessage( L"Call media event: stream failed");
                    break;

                case CME_TERMINAL_FAIL:
                    DoMessage( L"Call media event: terminal failed");
                    break;

                case CME_STREAM_ACTIVE:
                {
                    //
                    // Find out if this stream has a video render terminal. If not,
                    // we don't need to do anything with this stream. Also note
                    // if this is the video capture stream or the video render
                    // stream.
                    //

                    ITTerminal * pTerminal;
                    BOOL         fRenderStream;

                    hr = GetVideoRenderTerminalFromStreamEvent(
                                                               pCallMediaEvent,
                                                               &pTerminal,
                                                               &fRenderStream
                                                              );

                    if ( SUCCEEDED(hr) )
                    {
                        // Get the video window interface for the terminal
                        IVideoWindow *pVideoWindow = NULL;

                        hr = pTerminal->QueryInterface( IID_IVideoWindow, (void**)&pVideoWindow );

                        pTerminal->Release();

                        if ( SUCCEEDED(hr) )
                        {
                            // Put this window in our dialog
                            HostWindow(pVideoWindow, fRenderStream);

                            pVideoWindow->Release();
                        }
                    }

                    break;
                }

                default:
                    break;
                }
            }

            // We no longer need this interface.
            pCallMediaEvent->Release();

            break;
        }

        default:
            break;
    }

    pEvent->Release(); // we addrefed it CTAPIEventNotification::Event()

    return S_OK;
}

Variable Documentation

CRITICAL_SECTION g_CurrentCallCritSection

Definition at line 52 of file tapirecv.cpp.

HANDLE g_hExitEvent

Definition at line 25 of file dhcpnotify.cpp.

ITBasicCallControl* g_pCurrentCall

Definition at line 45 of file tapirecv.cpp.

ITTAPI* g_pTapi

Definition at line 49 of file FileTerm.cpp.

CWorkerThread g_WorkerThread

Definition at line 44 of file Processing.cpp.

Generated on Wed Nov 13 2024 16:53:11 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/tapirecv/Processing.cpp File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • tapirecv
Defines | Functions | Variables

Processing.cpp File Reference

#include "common.h"
#include "Processing.h"
#include "WorkerThread.h"
#include "AVIFileWriter.h"

Go to the source code of this file.

Defines

#define | SZ_OUTPUTFILENAME "recording.wav"

Functions

HANDLE * | AllocateEvents (IN DWORD nNumberOfEvents)
IStreamSample ** | AllocateStreamSamples (IN IMediaStream *pMediaStream, IN DWORD nNumberOfSamples)
HRESULT | AssociateEventsWithSamples (IN HANDLE *pSampleReadyEvents, IN IStreamSample **ppStreamSamples, IN DWORD nNumberOfSamples)
HRESULT | CreateAndSelectMST ()
ITTerminal * | CreateRenderMediaStreamingTerminal (IN ITBasicCallControl *pCallControl)
HRESULT | GetAddressFromCall (IN ITBasicCallControl *pCallControl, OUT ITAddress **ppAddress)
WAVEFORMATEX * | GetAudioFormat (IMediaStream *pTerminalMediaStream)
HRESULT | GetNumberOfSamplesOnStream (IN IMediaStream *pTerminalMediaStream, IN OUT DWORD *pnNumberOfSamples)
HRESULT | GetSampleID (IN DWORD nWaitCode, IN DWORD nNumberOfSamples, IN OUT DWORD *pnSampleID)
HRESULT | GetTerminalFromMediaEvent (IN ITCallMediaEvent *pCallMediaEvent, OUT ITTerminal **ppTerminal)
HRESULT | GetTerminalFromStreamEvent (IN ITCallMediaEvent *pCallMediaEvent, OUT ITTerminal **ppTerminal)
BOOL | IsAudioStream (ITStream *pStream)
BOOL | IsMessageForActiveCall (IN ITCallStateEvent *pCallStateEvent)
BOOL | IsRenderingStream (ITStream *pStream)
HRESULT | OnTapiEvent (TAPI_EVENT TapiEvent, IDispatch *pEvent)
HRESULT | ProcessCallMediaEvent (IDispatch *pEvent)
HRESULT | ProcessCallNotificationEvent (IDispatch *pEvent)
HRESULT | ProcessCallStateEvent (IDispatch *pEvent)
HRESULT | RecordMessage (IN ITTerminal *pRecordTerm)
void | ReleaseEvents (IN OUT HANDLE *pEvents, IN DWORD nNumberOfEvents)
void | ReleaseSamples (IN OUT IStreamSample **ppStreamSamples, IN DWORD nNumberOfSamples)
HRESULT | SelectAndInitializeTerminal (IN ITTerminal *pRecordTerminal, IN ITStream *pStream)
HRESULT | SetAllocatorProperties (IN ITTerminal *pTerminal)
HRESULT | SetAudioFormat (IN ITTerminal *pTerminal)
HRESULT | WriteSampleToFile (IN IStreamSample *pStreamSample, IN CAVIFileWriter *pFileWriter)
HRESULT | WriteStreamToFile (IN IMediaStream *pTerminalMediaStream)

Variables

CWorkerThread g_WorkerThread

Define Documentation

#define SZ_OUTPUTFILENAME "recording.wav"

Definition at line 37 of file Processing.cpp.

Function Documentation

HANDLE* AllocateEvents ( IN DWORD nNumberOfEvents )

Definition at line 1346 of file Processing.cpp.

{

    //
    // pointer to an array of event handles
    //

    HANDLE *pSampleReadyEvents = NULL;

    pSampleReadyEvents =
        (HANDLE*)AllocateMemory(sizeof(HANDLE) * nNumberOfEvents);

    if (NULL == pSampleReadyEvents)
    {
        LogError("AllocateEvents: Failed to allocate sample ready events.");

        return NULL;
    }

    //
    // create an event for every allocated handle
    //

    for (DWORD i = 0; i < nNumberOfEvents; i++)
    {

        pSampleReadyEvents[i] = CreateEvent(NULL, FALSE, FALSE, NULL);

        if (NULL == pSampleReadyEvents[i])
        {

            LogError("AllocateEvents: "
                     "Failed to create event for sample %d", i);

            //
            // close handles we have created already
            //

            for (DWORD j = 0; j< i; j++)
            {
                CloseHandle(pSampleReadyEvents[j]);

                pSampleReadyEvents[j] = NULL;
            }

            FreeMemory(pSampleReadyEvents);
            pSampleReadyEvents = NULL;

            return NULL;

        }

    } // creating events for each sample

    //
    // succeded creating events. return the pointer to the array
    //

    return pSampleReadyEvents;

}

IStreamSample** AllocateStreamSamples | ( | IN IMediaStream * | pMediaStream,
 |  | IN DWORD | nNumberOfSamples
 | ) |  |

Definition at line 1461 of file Processing.cpp.

{

    //
    // allocate stream sample array
    //

    IStreamSample **ppStreamSamples = (IStreamSample **)
        AllocateMemory( sizeof(IStreamSample*) * nNumberOfSamples );

    if (NULL == ppStreamSamples)
    {
        LogError("AllocateStreamSamples: Failed to allocate stream sample array");

        return NULL;
    }

    //
    // allocate samples from the stream and put them into the array
    //

    for (DWORD i = 0; i < nNumberOfSamples; i++)
    {

        HRESULT hr = pMediaStream->AllocateSample(0, &ppStreamSamples[i]);

        if (FAILED(hr))
        {

            LogError("AllocateStreamSamples: Failed to allocateSample. "
                     "Sample #%d", i);

            for (DWORD j = 0; j < i; j++)
            {
                ppStreamSamples[j]->Release();
                ppStreamSamples[j] = NULL;
            }

            FreeMemory(ppStreamSamples);
            ppStreamSamples = NULL;

            return NULL;

        } // failed AllocateSample()

    } // allocating samples on the stream

    //
    // succeeded allocating samples
    //

    return ppStreamSamples;

}

HRESULT AssociateEventsWithSamples | ( | IN HANDLE * | pSampleReadyEvents,
 |  | IN IStreamSample ** | ppStreamSamples,
 |  | IN DWORD | nNumberOfSamples
 | ) |  |

Definition at line 1532 of file Processing.cpp.

{

    for (DWORD i = 0; i < nNumberOfSamples; i++)
    {

        //
        // the event passed to Update will be signaled when the sample is
        // filled with data
        //

        HRESULT hr =
            ppStreamSamples[i]->Update(0, pSampleReadyEvents[i], NULL, 0);

        if (FAILED(hr))
        {

            LogError("AssociateEventsWithSamples: "
                     "Failed to call update on sample #%d", i);

            //
            // abort the samples we have Update()'d
            //

            for (DWORD j = 0; j < i; j++)
            {

                //
                // no need to check the return code here -- best effort attempt
                // if failed -- too bad
                //

                ppStreamSamples[j]->CompletionStatus(COMPSTAT_WAIT |
                                                     COMPSTAT_ABORT,
                                                     INFINITE);
            }

            return hr;

        } // Update() failed

    } // Update()'ing all samples

    return S_OK;
}

HRESULT CreateAndSelectMST ( )

Definition at line 960 of file Processing.cpp.

{

    LogMessage("CreateAndSelectMST: started");

    //
    // we should already have the call
    //

    if (NULL == g_pCurrentCall)
    {
        LogError("CreateAndSelectMST: g_pCurrentCall is NULL");

        return E_UNEXPECTED;
    }

    HRESULT hr = E_FAIL;

    //
    // get the ITStreamControl interface for this call
    //

    ITStreamControl *pStreamControl = NULL;

    hr = g_pCurrentCall->QueryInterface(IID_ITStreamControl,
                                        (void**)&pStreamControl);

    if (FAILED(hr))
    {
        LogError("CreateAndSelectMST: failed to QI call for ITStreamControl");

        return hr;
    }

    //
    // enumerate the streams on the call
    //

    IEnumStream *pEnumStreams = NULL;

    hr = pStreamControl->EnumerateStreams(&pEnumStreams);

    pStreamControl->Release();
    pStreamControl = NULL;

    if (FAILED(hr))
    {
        LogError("CreateAndSelectMST: failed to enumerate streams on call");

        return hr;
    }

    //
    // walk through the list of streams on the call
    // for the first incoming audio stream, create a media streaming terminal
    // and select it on the stream
    //

    BOOL bTerminalCreatedAndSelected = FALSE;

    while (!bTerminalCreatedAndSelected)
    {

        ITStream *pStream = NULL;

        hr = pEnumStreams->Next(1, &pStream, NULL);

        if (S_OK != hr)
        {
            //
            // no more streams or error
            //

            LogError("CreateAndSelectMST: didn't find an incoming audio stream."
                     " terminal not selected.");

            break;
        }

        //
        // create and select media streaming terminal on the first incoming
        // audio stream
        //

        if ( IsRenderingStream(pStream) && IsAudioStream(pStream))
        {

            LogMessage("CreateAndSelectMST: creating mst");

            //
            // create media streaming terminal and select it on the stream
            //

            ITTerminal *pRecordTerminal = NULL;

            pRecordTerminal = CreateRenderMediaStreamingTerminal(g_pCurrentCall);

            if (NULL != pRecordTerminal)
            {

                hr = SelectAndInitializeTerminal(pRecordTerminal, pStream);

                pRecordTerminal->Release();
                pRecordTerminal = NULL;

                if (SUCCEEDED(hr))
                {
                    //
                    // set the flag, so we can break out of the loop
                    //

                    bTerminalCreatedAndSelected = TRUE;
                }

            } // media streaming terminal created successfully

        } // stream is rendering and audio
        else
        {
            //
            // the stream is of wrong direction, or type
            //

        }

        pStream->Release();
        pStream = NULL;

    } // while (enumerating streams on the call)

    //
    // done with the stream enumeration. release
    //

    pEnumStreams->Release();
    pEnumStreams = NULL;

    if (bTerminalCreatedAndSelected)
    {
        LogMessage("CreateAndSelectMST: terminal selected");

        return S_OK;
    }
    else
    {
        LogMessage("CreateAndSelectMST: no terminal selected");

        return S_FALSE;
    }

}

ITTerminal* CreateRenderMediaStreamingTerminal ( IN ITBasicCallControl * pCallControl )

Definition at line 408 of file Processing.cpp.

{

    HRESULT hr = E_FAIL;

    //
    // get address from call
    //

    ITAddress *pAddress = NULL;

    hr = GetAddressFromCall(pCallControl, &pAddress);

    if (FAILED(hr))
    {
        LogError("CreateRenderMediaStreamingTerminal: failed to get address from call");

        return NULL;
    }

    //
    // get the terminal support interface from the address
    //

    ITTerminalSupport *pTerminalSupport = NULL;

    hr = pAddress->QueryInterface( IID_ITTerminalSupport,
                                   (void **)&pTerminalSupport );

    pAddress->Release();
    pAddress = NULL;

    if (FAILED(hr))
    {
        LogError("CreateRenderMediaStreamingTerminal: "
                 "failed to QI pAddress for ITTerminalSupport");

        return NULL;
    }

    //
    // get string for the terminal's class id
    //

    WCHAR *pszTerminalClass = NULL;

    hr = StringFromIID(CLSID_MediaStreamTerminal, &pszTerminalClass);

    if (FAILED(hr))
    {
        LogError("CreateRenderMediaStreamingTerminal: "
                 "Failed to generate string from terminal's class id");

        pTerminalSupport->Release();
        pTerminalSupport = NULL;

        return NULL;
    }

    //
    // make bstr out of the class id
    //

    BSTR bstrTerminalClass = SysAllocString (pszTerminalClass);

    //
    // free the string returned by StringFromIID
    //

    CoTaskMemFree(pszTerminalClass);
    pszTerminalClass = NULL;

    //
    // create media streaming terminal for rendering
    //

    ITTerminal *pTerminal = NULL;

    hr = pTerminalSupport->CreateTerminal(bstrTerminalClass,
                                          TAPIMEDIATYPE_AUDIO,
                                          TD_RENDER,
                                          &pTerminal);

    //
    // release resources no longer needed
    //

    SysFreeString(bstrTerminalClass);
    bstrTerminalClass = NULL;

    pTerminalSupport->Release();
    pTerminalSupport = NULL;

    if (FAILED(hr))
    {
        LogError("CreateRenderMediaStreamingTerminal: "
                 "failed to create media streaming terminal hr = 0x%lx", hr);

        return NULL;
    }

    //
    // successfully created media streaming terminal. return.
    //

    LogMessage("CreateRenderMediaStreamingTerminal: "
               "Terminal created successfully");

    return pTerminal;

}

HRESULT GetAddressFromCall | ( | IN ITBasicCallControl * | pCallControl,
 |  | OUT ITAddress ** | ppAddress
 | ) |  |

Definition at line 339 of file Processing.cpp.

{

    HRESULT hr = E_FAIL;

    //
    // don't return garbage
    //

    *ppAddress = NULL;

    //
    // get ITCallInfo so we can get the call's address
    //

    ITCallInfo *pCallInfo = NULL;

    hr = pCallControl->QueryInterface(IID_ITCallInfo, (void**)&pCallInfo);

    if (FAILED(hr))
    {
        LogError("GetAddressFromCall: "
                 "Failed to QI call for ITCallInfo");

        return hr;
    }

    //
    // get the call's address
    //

    ITAddress *pAddress = NULL;

    hr = pCallInfo->get_Address(&pAddress);

    pCallInfo->Release();
    pCallInfo = NULL;

    if (FAILED(hr))
    {
        LogError("GetAddressFromCall: failed to get address");

    }
    else
    {
        *ppAddress = pAddress;
    }

    return hr;
}

WAVEFORMATEX* GetAudioFormat ( IMediaStream * pTerminalMediaStream )

Definition at line 1596 of file Processing.cpp.

{

    //
    // get ITAMMediaFormat interface on the terminal, so we can query for
    // audio format
    //

    ITAMMediaFormat *pITMediaFormat = NULL;

    HRESULT hr = pTerminalMediaStream->QueryInterface(IID_ITAMMediaFormat,
                                                     (void **)&pITMediaFormat);

    if (FAILED(hr))
    {
        LogError("GetAudioFormat: "
                 "failed to QI terminal for ITAMMediaFormat");

        return NULL;
    }

    //
    // use ITAMMediaFormat to get terminal's media format
    //

    AM_MEDIA_TYPE *pMediaType = NULL;

    hr = pITMediaFormat->get_MediaFormat(&pMediaType);

    pITMediaFormat->Release();
    pITMediaFormat = NULL;

    if (FAILED(hr))
    {
        LogError("GetAudioFormat: failed to get_MediaFormat hr = 0x%lx", hr);

        return NULL;
    }

    //
    // did we get back a format that we can use?
    //

    if ((pMediaType->pbFormat == NULL) ||
        pMediaType->formattype != FORMAT_WaveFormatEx)
    {

        LogError("GetAudioFormat: invalid format");

        DeleteMediaType(pMediaType);
        pMediaType = NULL;

        return NULL;
    }

    //
    // allocate and return wave format
    //

    WAVEFORMATEX *pFormat =
        (WAVEFORMATEX *)AllocateMemory(pMediaType->cbFormat);

    if (NULL != pFormat)
    {
        CopyMemory(pFormat, pMediaType->pbFormat, pMediaType->cbFormat);
    }
    else
    {
        LogError("GetAudioFormat: Failed to allocate memory for audio format");
    }

    //
    // remember to release AM_MEDIA_TYPE that we no longer need
    //

    DeleteMediaType(pMediaType);
    pMediaType = NULL;

    return pFormat;

}

HRESULT GetNumberOfSamplesOnStream | ( | IN IMediaStream * | pTerminalMediaStream,
 |  | IN OUT DWORD * | pnNumberOfSamples
 | ) |  |

Definition at line 1233 of file Processing.cpp.

{

    HRESULT hr = S_OK;

    //
    // don't return garbage
    //

    *pnNumberOfSamples = 0;

    //
    // get allocator properties
    //

    ITAllocatorProperties *pAllocProperites = NULL;

    hr = pTerminalMediaStream->QueryInterface(IID_ITAllocatorProperties,
                                        (void **)&pAllocProperites);

    if (FAILED(hr))
    {
        LogError("GetNumberOfSamplesOnStream: "
                 "Failed to QI terminal for ITAllocatorProperties");

        return hr;
    }

    //
    // we want to know the number of samples we will be getting
    //

    ALLOCATOR_PROPERTIES AllocProperties;

    hr = pAllocProperites->GetAllocatorProperties(&AllocProperties);

    pAllocProperites->Release();
    pAllocProperites = NULL;

    if (FAILED(hr))
    {
        LogError("GetNumberOfSamplesOnStream: "
                 "Failed to get terminal's allocator properties");

        return hr;
    }

    *pnNumberOfSamples = AllocProperties.cBuffers;

    //
    // log the number of buffers and their sizes
    //

    LogMessage("GetNumberOfSamplesOnStream: [%ld] samples, [%ld] bytes each",
               *pnNumberOfSamples, AllocProperties.cbBuffer);

    return S_OK;
}

HRESULT GetSampleID | ( | IN DWORD | nWaitCode,
 |  | IN DWORD | nNumberOfSamples,
 |  | IN OUT DWORD * | pnSampleID
 | ) |  |

Definition at line 1781 of file Processing.cpp.

{

    //
    // event abandoned?
    //

    if ( (nWaitCode >= WAIT_ABANDONED_0) &&
         (nWaitCode < WAIT_ABANDONED_0 + nNumberOfSamples) )
    {

        LogError("GetSampleID: event for sample #%lu abandoned.",
                 nWaitCode - WAIT_ABANDONED_0);

        return E_FAIL;
    }

    //
    // any other error?
    //

    if ( (WAIT_OBJECT_0 > nWaitCode) ||
         (WAIT_OBJECT_0 + nNumberOfSamples <= nWaitCode) )
    {
        LogMessage("GetSampleID: "
                   "waiting for samples failed or timed out. "
                   "WaitForMultipleObjects returned %lu", nWaitCode);

        return E_FAIL;
    }

    //
    // which sample was signaled?
    //

    *pnSampleID = nWaitCode - WAIT_OBJECT_0;

    return S_OK;
}

HRESULT GetTerminalFromMediaEvent | ( | IN ITCallMediaEvent * | pCallMediaEvent,
 |  | OUT ITTerminal ** | ppTerminal
 | ) |  |

Definition at line 1131 of file Processing.cpp.

{

    HRESULT hr = E_FAIL;

    //
    // don't return garbage if we fail
    //

    *ppTerminal = NULL;

    //
    // get the stream corresponding to this event
    //

    ITStream *pStream = NULL;

    hr = pCallMediaEvent->get_Stream(&pStream);

    if ( FAILED(hr) )
    {
        LogError("GetTerminalFromMediaEvent: "
                 "failed to get stream hr = 0x%lx", hr);

        return hr;
    }

    //
    // find the terminal on this stream
    //

    //
    // get terminal enumeration on the stream
    //

    IEnumTerminal *pEnumTerminal = NULL;

    hr = pStream->EnumerateTerminals(&pEnumTerminal);

    pStream->Release();
    pStream = NULL;

    if ( FAILED(hr) )
    {
        LogError("GetTerminalFromMediaEvent: failed to enumerate terminals, "
            "hr = 0x%lx", hr);

        return hr;

    }

    //
    // walk through terminal enumeration
    //

    ULONG nTerminalsFetched = 0;

    ITTerminal *pStreamTerminal = NULL;

    //
    // assuming there is at most one terminal selected on the stream
    //

    hr = pEnumTerminal->Next(1, &pStreamTerminal, &nTerminalsFetched);

    pEnumTerminal->Release();
    pEnumTerminal = NULL;

    if (S_OK != hr)
    {
        LogError("GetTerminalFromMediaEvent: enumeration returned no "
                 "terminals, hr = 0x%lx", hr);

        return hr;

    }

    *ppTerminal = pStreamTerminal;

    LogMessage("GetTerminalFromMediaEvent: succeeded");

    return S_OK;
}

HRESULT GetTerminalFromStreamEvent | ( | IN ITCallMediaEvent * | pCallMediaEvent,
 |  | OUT ITTerminal ** | ppTerminal
 | ) |  |

Definition at line 101 of file Processing.cpp.

{

    HRESULT hr = E_FAIL;

    //
    // don't return garbage
    //

    *ppTerminal = NULL;

    //
    // Get the stream for this event.
    //

    ITStream *pStream = NULL;

    hr = pCallMediaEvent->get_Stream(&pStream);

    if ( FAILED(hr) )
    {

        LogMessage("GetTerminalFromStreamEvent: "
                   "Failed to get stream from pCallMediaEvent hr = 0x%lx", hr);

        return hr;
    }

    //
    // Enumerate terminals on this stream.
    //

    IEnumTerminal *pEnumTerminal = NULL;

    hr = pStream->EnumerateTerminals(&pEnumTerminal);

    pStream->Release();
    pStream = NULL;

    if ( FAILED(hr) )
    {
        LogMessage("GetTerminalFromStreamEvent: "
                   "Failed to enumerate terminals hr = 0x%lx", hr);
        return hr;
    }

    //
    // we should have at most one terminal selected on the stream, so
    // get the first terminal
    //

    ITTerminal *pTerminal = NULL;

    hr = pEnumTerminal->Next(1, &pTerminal, NULL);

    if ( hr != S_OK )
    {
        LogMessage("GetTerminalFromStreamEvent: "
                   "Failed to get a terminal from enumeration hr = 0x%lx", hr);

        pEnumTerminal->Release();
        pEnumTerminal = NULL;

        return E_FAIL;
    }

    *ppTerminal = pTerminal;

    pTerminal = NULL;

    //
    // we should not have any more terminals on this stream,
    // double-check this.
    //

    hr = pEnumTerminal->Next(1, &pTerminal, NULL);

    if (hr == S_OK)
    {
        LogError("GetTerminalFromStreamEvent: "
                 "more than one terminal on the stream!");

        _ASSERTE(FALSE);

        pTerminal->Release();
        pTerminal = NULL;

    }

    pEnumTerminal->Release();
    pEnumTerminal = NULL;

    return S_OK;
}

BOOL IsAudioStream ( ITStream * pStream )

Definition at line 908 of file Processing.cpp.

{

    //
    // check the stream's media type
    //

    long nMediaType = 0;

    HRESULT hr = pStream->get_MediaType(&nMediaType);

    if (FAILED(hr))
    {
        LogError("IsAudioStream: Failed to get media type");

        return FALSE;
    }

    //
    // return true if the stream is audio
    //

    if (TAPIMEDIATYPE_AUDIO == nMediaType)
    {

        return TRUE;
    }
    else
    {

        return FALSE;
    }

}

BOOL IsMessageForActiveCall ( IN ITCallStateEvent * pCallStateEvent )

Definition at line 215 of file Processing.cpp.

{

    EnterCriticalSection(&g_CurrentCallCritSection);

    //
    // if we don't have an active call we have not received call notification
    // for a call that we own, so return FALSE
    //

    if (NULL == g_pCurrentCall)
    {
        LogMessage("IsMessageForActiveCall: no active call. return FALSE");

        LeaveCriticalSection(&g_CurrentCallCritSection);

        return FALSE;
    }

    //
    // get the call corresponding to the event
    //

    ITCallInfo *pCallInfo = NULL;

    HRESULT hr = pCallStateEvent->get_Call(&pCallInfo);

    if (FAILED(hr))
    {
        LogError("IsMessageForActiveCall: failed to get call. "
                 "returning FALSE");

        LeaveCriticalSection(&g_CurrentCallCritSection);

        return FALSE;
    }

    //
    // get IUnknown of the call from the event
    //

    IUnknown *pIncomingCallUnk = NULL;

    hr = pCallInfo->QueryInterface(IID_IUnknown, (void**)&pIncomingCallUnk);

    pCallInfo->Release();
    pCallInfo = NULL;

    if (FAILED(hr))
    {
        LogError("IsMessageForActiveCall: "
                 "failed to qi incoming call for IUnknown. returning FALSE");

        LeaveCriticalSection(&g_CurrentCallCritSection);

        return FALSE;
    }

    //
    // get IUnknown of the call from the event
    //

    IUnknown *pCurrentCallUnk = NULL;

    hr = g_pCurrentCall->QueryInterface(IID_IUnknown, (void**)&pCurrentCallUnk);

    LeaveCriticalSection(&g_CurrentCallCritSection);

    if (FAILED(hr))
    {
        LogError("IsMessageForActiveCall: "
                 "Failed to QI current call for IUnknown. returning FALSE.");

        pIncomingCallUnk->Release();
        pIncomingCallUnk = NULL;

        return FALSE;
    }

    //
    // compare IUnknowns of the current call and the event call
    // if they are the same, this is the same call
    //

    BOOL bSameCall = FALSE;

    if (pCurrentCallUnk == pIncomingCallUnk)
    {
        bSameCall = TRUE;
    }
    else
    {
        LogMessage("IsMessageForActiveCall: "
                    "current and event calls are different. returning FALSE.");

        bSameCall = FALSE;
    }

    pCurrentCallUnk->Release();
    pCurrentCallUnk = NULL;

    pIncomingCallUnk->Release();
    pIncomingCallUnk = NULL;

    return bSameCall;
}

BOOL IsRenderingStream ( ITStream * pStream )

Definition at line 870 of file Processing.cpp.

{

    //
    // check the stream's direction
    //

    TERMINAL_DIRECTION TerminalDirection;

    HRESULT hr = pStream->get_Direction(&TerminalDirection);

    if (FAILED(hr))
    {
        LogError("IsRenderingStream: Failed to get stream direction");

        return FALSE;
    }

    if (TD_RENDER == TerminalDirection)
    {
        return TRUE;
    }
    else
    {
        return FALSE;
    }
}

HRESULT OnTapiEvent | ( | TAPI_EVENT | TapiEvent,
 |  | IDispatch * | pEvent
 | ) |  |

Definition at line 2830 of file Processing.cpp.

{

    LogMessage("OnTapiEvent: message received");

    HRESULT hr = S_OK;

    switch ( TapiEvent )
    {

        case TE_CALLNOTIFICATION:
        {

            LogMessage("OnTapiEvent: received TE_CALLNOTIFICATION");

            hr = ProcessCallNotificationEvent(pEvent);

            break;

        } // TE_CALLNOTIFICATION

        case TE_CALLSTATE:
        {
            LogMessage("OnTapiEvent: received TE_CALLSTATE");

            hr = ProcessCallStateEvent(pEvent);

            break;

        } // TE_CALLSTATE

        case TE_CALLMEDIA:
        {

            LogMessage("OnTapiEvent: received TE_CALLMEDIA");

            hr = ProcessCallMediaEvent(pEvent);

            break;

        } // case TE_CALLMEDIA

    default:

        LogMessage("OnTapiEvent: received message %d. not handled.", TapiEvent);

        break;

    }

    //
    // the event was AddRef()'ed when it was posted for asynchronous processing
    // no longer need the event, release it.
    //

    pEvent->Release();
    pEvent = NULL;

    LogMessage("OnTapiEvent: exiting.");

    return hr;
}

HRESULT ProcessCallMediaEvent ( IDispatch * pEvent )

Definition at line 2419 of file Processing.cpp.

{

    //
    // Get ITCallMediaEvent interface from the event
    //

    ITCallMediaEvent *pCallMediaEvent = NULL;

    HRESULT hr = pEvent->QueryInterface( IID_ITCallMediaEvent,
                                 (void **)&pCallMediaEvent );

    if (FAILED(hr))
    {

        //
        // the event does not have the interface we want
        //

        LogError("ProcessCallMediaEvent: TE_CALLMEDIA. "
                 "Failed to QI event for ITCallMediaEvent");

        return hr;
    }

    //
    // get the CALL_MEDIA_EVENT that we are being notified of.
    //

    CALL_MEDIA_EVENT CallMediaEvent;

    hr = pCallMediaEvent->get_Event(&CallMediaEvent);

    if ( FAILED(hr) )
    {

        //
        // failed to get call media event
        //

        LogError("ProcessCallMediaEvent: TE_CALLMEDIA. "
                 "Failed to get call media event hr = 0x%lx", hr);

        pCallMediaEvent->Release();
        pCallMediaEvent = NULL;

        return hr;
    }

    LogMessage("ProcessCallMediaEvent: processing call media event");

    switch (CallMediaEvent)
    {

        case CME_STREAM_INACTIVE:
        {

            LogMessage("ProcessCallMediaEvent: CME_STREAM_INACTIVE");

            break;
        }

        case CME_STREAM_NOT_USED:

            LogMessage("ProcessCallMediaEvent: CME_STREAM_NOT_USED");

            break;

        case CME_NEW_STREAM:

            LogMessage("ProcessCallMediaEvent: CME_NEW_STREAM received");

            break;

        case CME_STREAM_FAIL:

            LogError("ProcessCallMediaEvent: CME_STREAM_FAIL received");

            break;

        case CME_TERMINAL_FAIL:

            LogError("ProcessCallMediaEvent: CME_STREAM_FAIL received");

            break;

        case CME_STREAM_ACTIVE:
        {

            LogError("ProcessCallMediaEvent: CME_STREAM_ACTIVE received");

            //
            // Get the terminal on the active stream
            //

            ITTerminal *pRecordStreamTerminal = NULL;

            hr = GetTerminalFromMediaEvent(pCallMediaEvent,
                                           &pRecordStreamTerminal);

            if ( FAILED(hr) )
            {
                //
                // the stream has no terminals associated with it
                //

                LogError("ProcessCallMediaEvent: "
                         "failed to get terminal on the active stream");

                break;
            }

            //
            // make sure the direction is right -- we are recording, so the
            // terminal should be TD_RENDER
            //

            TERMINAL_DIRECTION td;

            hr = pRecordStreamTerminal->get_Direction( &td);

            if ( FAILED(hr) )
            {

                LogError("ProcessCallMediaEvent: "
                         "failed to get record terminal's direction.");

                pRecordStreamTerminal->Release();
                pRecordStreamTerminal = NULL;

                break;
            }

            //
            // double check that the terminal is rendering terminal
            // since we are the recording side
            //

            if ( TD_RENDER != td )
            {

                //
                // this should never ever happen
                //

                LogError("ProcessCallMediaEvent: bad terminal direction");

                pRecordStreamTerminal->Release();
                pRecordStreamTerminal = NULL;

                hr = E_FAIL;

                break;

            }

            //
            // Now do the actual streaming.
            //

            //
            // this will block until:
            //
            // the call is disconnected, or
            // the user chooses to close the app, or
            // there is an error
            //
            // Since we are in the message processing thread,
            // the application will not be able to process messages
            // (the messages will still be queued) until this call
            // returns.
            //
            // If it is important that messages are processed while
            // file is being recorded, recording should be done on
            // a different thread.
            //

            RecordMessage(pRecordStreamTerminal);

            pRecordStreamTerminal->Release();
            pRecordStreamTerminal = NULL;

            break;
        }

        default:

            break;

    } // switch (call media event)

    //
    // We no longer need the event interface.
    //

    pCallMediaEvent->Release();
    pCallMediaEvent = NULL;

    return S_OK;

}

HRESULT ProcessCallNotificationEvent ( IDispatch * pEvent )

Definition at line 2236 of file Processing.cpp.

{

    HRESULT hr = E_FAIL;

    //
    // we are being notified of a new call
    //
    // if we own the call and there is not other active call
    // consider this to be the active call
    //
    // wait for CS_OFFERING message before answering the call
    //

    ITCallNotificationEvent *pCallNotificationEvent = NULL;

    hr = pEvent->QueryInterface( IID_ITCallNotificationEvent,
                                (void **)&pCallNotificationEvent);

    if (FAILED(hr))
    {
        LogError("ProcessCallNotificationEvent: "
                 "Failed to QI event for ITCallNotificationEvent");

        return hr;
    }

    //
    // get the call from notification event
    //

    ITCallInfo *pCall = NULL;

    hr = pCallNotificationEvent->get_Call(&pCall);

    //
    // release the ITCallNotificationEvent interface
    //

    pCallNotificationEvent->Release();
    pCallNotificationEvent = NULL;

    if (FAILED(hr))
    {
        LogError("ProcessCallNotificationEvent: "
                 "Failed to get call from Call notification event");

        return hr;
    }

    //
    // if we already have an active call, reject the new incoming call
    //

    EnterCriticalSection(&g_CurrentCallCritSection);

    if (NULL != g_pCurrentCall)
    {

        LeaveCriticalSection(&g_CurrentCallCritSection);

        LogMessage("ProcessCallNotificationEvent: "
                   "incoming call while another call in progress");

        ITBasicCallControl *pSecondCall = NULL;

        hr = pCall->QueryInterface(IID_ITBasicCallControl,
                                   (void**)&pSecondCall);

        pCall->Release();
        pCall = NULL;

        if (FAILED(hr))
        {
            LogError("ProcessCallNotificationEvent: failed to qi incoming call "
                     "for ITBasicCallConrtrol");

            return hr;
        }

        //
        // reject the incoming call
        //

        LogMessage("ProcessCallNotificationEvent: rejecting the incoming call");

        hr = pSecondCall->Disconnect(DC_REJECTED);

        pSecondCall->Release();
        pSecondCall = NULL;

        return E_FAIL;
    }

    //
    // check to see if we own the call
    //

    CALL_PRIVILEGE cp;

    hr = pCall->get_Privilege( &cp );

    if ( FAILED(hr) )
    {
        LogError("ProcessCallNotificationEvent: Failed to get call owner info");

        pCall->Release();
        pCall = NULL;

        LeaveCriticalSection(&g_CurrentCallCritSection);

        return hr;
    }

    if ( CP_OWNER != cp )
    {

        //
        // we don't own the call. ignore it.
        //

        LogMessage("ProcessCallNotificationEvent: We don't own the call.");

        pCall->Release();
        pCall = NULL;

        LeaveCriticalSection(&g_CurrentCallCritSection);

        return E_FAIL;
    }
    else
    {
        LogMessage("ProcessCallNotificationEvent: Incoming call.");
    }

    //
    // keep the call for future use
    //

    hr = pCall->QueryInterface(IID_ITBasicCallControl,
                               (void**)&g_pCurrentCall);

    if (FAILED(hr))
    {
        LogError("ProcessCallNotificationEvent: failed to qi incoming call for"
                  "ITBasicCallControl.");

        g_pCurrentCall = NULL;
    }

    LeaveCriticalSection(&g_CurrentCallCritSection);

    pCall->Release();
    pCall = NULL;

    return hr;

} // ProcessCallNotificationEvent

HRESULT ProcessCallStateEvent ( IDispatch * pEvent )

Definition at line 2640 of file Processing.cpp.

{

    HRESULT hr = S_OK;

    //
    // TE_CALLSTATE is a call state event.
    // pEvent is an ITCallStateEvent
    //

    ITCallStateEvent *pCallStateEvent = NULL;

    //
    // Get the interface
    //

    hr = pEvent->QueryInterface(IID_ITCallStateEvent,
                                (void **)&pCallStateEvent);

    if ( FAILED(hr) )
    {

        LogError("ProcessCallStateEvent: "
                 "Failed to QI event for ITCallStateEvent");

        return hr;
    }

    //
    // make sure the message is for the active call!
    //

    EnterCriticalSection(&g_CurrentCallCritSection);

    if (!IsMessageForActiveCall(pCallStateEvent))
    {
        LogMessage("ProcessCallStateEvent: received TE_CALLSTATE message "
                   "for a different call. ignoring.");

        pCallStateEvent->Release();
        pCallStateEvent = NULL;

        LeaveCriticalSection(&g_CurrentCallCritSection);

        return E_FAIL;
    }

    //
    // get the CallState that we are being notified of.
    //

    CALL_STATE CallState;

    hr = pCallStateEvent->get_State(&CallState);

    //
    // no longer need the event
    //

    pCallStateEvent->Release();
    pCallStateEvent = NULL;

    if (FAILED(hr))
    {
         LogError("ProcessCallStateEvent: "
                  "failed to get state from call state event.");

         LeaveCriticalSection(&g_CurrentCallCritSection);

         return hr;
    }

    //
    // log the new call state
    //

    if (CS_OFFERING == CallState)
    {

        LogMessage("ProcessCallStateEvent: call state is CS_OFFERING");

        //
        // try to create and select media streaming terminal on one of
        // the call's incoming audio streams
        //

        hr = CreateAndSelectMST();

        if (S_OK == hr)
        {

            //
            // we have selected a terminal on one of the streams
            // answer the call
            //

            LogMessage("ProcessCallStateEvent: answering the call");

            hr = g_pCurrentCall->Answer();

            if (FAILED(hr))
            {
                LogError("ProcessCallStateEvent: Failed to answer the call");
            }

        }
        else
        {

            //
            // we could not create mst on any of the streams of
            // the incoming call. reject the call.
            //

            LogMessage("ProcessCallStateEvent: rejecting the call");

            HRESULT hr2 = g_pCurrentCall->Disconnect(DC_REJECTED);

            if (FAILED(hr2))
            {
                LogError("ProcessCallStateEvent: Failed to reject the call");
            }

        }

    } // CS_OFFERING
    else if (CS_DISCONNECTED == CallState)
    {

        LogMessage("ProcessCallStateEvent: call state is CS_DISCONNECTED. "
                   "Releasing the call.");

        //
        // release the call -- no longer need it!
        //

        g_pCurrentCall->Release();
        g_pCurrentCall = NULL;

        //
        // signal the main thread that it can exit if it is time to exit
        //

        LogMessage("ProcessCallStateEvent: signaling main thread.");

        SetEvent(g_hExitEvent);

    } // CS_DISCONNECTED
    else if (CS_CONNECTED == CallState)
    {

        LogMessage("ProcessCallStateEvent: call state is CS_CONNECTED");

    } // CS_CONNECTED

    //
    // no longer need to protect current call
    //

    LeaveCriticalSection(&g_CurrentCallCritSection);

    return hr;

}

HRESULT RecordMessage ( IN ITTerminal * pRecordTerm )

Definition at line 2181 of file Processing.cpp.

{

    LogMessage("RecordMessage: started");

    HRESULT hr = E_FAIL;

    //
    // get IMediaStream interface on the terminal
    //

    IMediaStream *pTerminalMediaStream = NULL;

    hr = pRecordTerm->QueryInterface(IID_IMediaStream,
                                     (void**)&pTerminalMediaStream);

    if (FAILED(hr))
    {
        LogError("RecordMessage: Failed to qi terminal for IMediaStream.");

        return hr;
    }

    //
    // write terminal stream data to a file
    //

    hr = WriteStreamToFile(pTerminalMediaStream);

    //
    // done with the terminal stream, release.
    //

    pTerminalMediaStream->Release();
    pTerminalMediaStream = NULL;

    LogMessage("RecordMessage: finished");

    return hr;

}

void ReleaseEvents | ( | IN OUT HANDLE * | pEvents,
 |  | IN DWORD | nNumberOfEvents
 | ) |  |

Definition at line 1310 of file Processing.cpp.

{

    //
    // close all the handles in the array
    //

    for (DWORD i = 0; i < nNumberOfEvents; i++)
    {
        CloseHandle(pEvents[i]);
        pEvents[i] = NULL;
    }

    //
    // free the array itself
    //

    FreeMemory(pEvents);
    pEvents = NULL;
}

void ReleaseSamples | ( | IN OUT IStreamSample ** | ppStreamSamples,
 |  | IN DWORD | nNumberOfSamples
 | ) |  |

Definition at line 1425 of file Processing.cpp.

{

    for (DWORD i = 0; i < nNumberOfSamples; i++)
    {
        ppStreamSamples[i]->CompletionStatus(COMPSTAT_WAIT |
                                             COMPSTAT_ABORT,
                                             INFINITE);

        //
        // regardless of the error code, release the sample
        //

        ppStreamSamples[i]->Release();
        ppStreamSamples[i] = NULL;
    }

    FreeMemory(ppStreamSamples);
    ppStreamSamples = NULL;
}

HRESULT SelectAndInitializeTerminal | ( | IN ITTerminal * | pRecordTerminal,
 |  | IN ITStream * | pStream
 | ) |  |

Definition at line 796 of file Processing.cpp.

{

    HRESULT hr = E_FAIL;

    //
    // set audio format on the created terminal
    //

    hr = SetAudioFormat(pRecordTerminal);

    if (FAILED(hr))
    {

        //
        // the terminal does not support the wave format we wanted.
        // no big deal for the receiver, we'll just have to create the
        // file in the format requested by MST.
        //

        LogMessage("CreateAndSelectMST: "
                   "Failed to set audio format on recording terminal. "
                   "Continuing");

    }

    //
    // set allocator properties for this terminal
    //

    hr = SetAllocatorProperties(pRecordTerminal);

    if (FAILED(hr))
    {

        //
        // not a fatal error. our allocator props were rejected,
        // but this does not necessarily mean streaming will fail.
        //

        LogError("CreateAndSelectMST: Failed to set "
                 "allocator properties on recording terminal");
    }

    //
    // select terminal on the stream
    //

    hr = pStream->SelectTerminal(pRecordTerminal);

    if (FAILED(hr))
    {

        LogError("CreateAndSelectMST: Failed to select "
                 "terminal on the stream");
    }

    return hr;

}

HRESULT SetAllocatorProperties ( IN ITTerminal * pTerminal )

Definition at line 682 of file Processing.cpp.

{

    //
    // different buffer sizes may produce different sound quality, depending
    // on the underlying transport that is being used.
    //
    // this function illustrates how an app can control the number and size of
    // buffers. A multiple of 30 ms (480 bytes at 16-bit 8 KHz PCM) is the most
    // appropriate sample size for IP (especailly G.723.1).
    //
    // However, small buffers can cause poor audio quality on some voice boards.
    //
    // If this method is not called, the allocator properties suggested by the
    // connecting filter will be used.
    //

    HRESULT hr = E_FAIL;

    //
    // get ITAllocator properties interface on the terminal
    //

    ITAllocatorProperties *pITAllocatorProperties = NULL;

    hr = pTerminal->QueryInterface(IID_ITAllocatorProperties,
                                   (void **)&pITAllocatorProperties);

    if (FAILED(hr))
    {
        LogError("SetAllocatorProperties: "
                 "failed to QI terminal for ITAllocatorProperties");

        return hr;
    }

    //
    // configure allocator properties
    //
    // suggest the size and number of the samples for MST to pre-allocate.
    //

    ALLOCATOR_PROPERTIES AllocProps;

    AllocProps.cBuffers   = 5;    // ask MST to allocate 5 buffers
    AllocProps.cbBuffer   = 4800; // 4800 bytes each
    AllocProps.cbAlign    = 1;    // no need to align buffers
    AllocProps.cbPrefix   = 0;    // no extra memory preceeding the actual data

    hr = pITAllocatorProperties->SetAllocatorProperties(&AllocProps);

    if (FAILED(hr))
    {
        LogError("SetAllocatorProperties: "
                 "failed to set allocator properties. hr = 0x%lx", hr);

        pITAllocatorProperties->Release();
        pITAllocatorProperties = NULL;

        return hr;
    }

    //
    // ask media streaming terminal to allocate buffers for us.
    // TRUE is the default, so strictly speaking, we didn't have to call
    // this method.
    //

    hr = pITAllocatorProperties->SetAllocateBuffers(TRUE);

    pITAllocatorProperties->Release();
    pITAllocatorProperties = NULL;

    if (FAILED(hr))
    {
        LogError("SetAllocatorProperties: "
                 "failed to SetAllocateBuffers, hr = 0x%lx", hr);

        return hr;
    }

    //
    // succeeded setting allocator properties
    //

    LogMessage("SetAllocatorProperties: succeeded.");

    return S_OK;

}

HRESULT SetAudioFormat ( IN ITTerminal * pTerminal )

Definition at line 539 of file Processing.cpp.

{

    HRESULT hr = E_FAIL;

    //
    // get ITAMMediaFormat interface on the terminal
    //

    ITAMMediaFormat *pITMediaFormat = NULL;

    hr = pTerminal->QueryInterface(IID_ITAMMediaFormat,
                                   (void **)&pITMediaFormat);

    if (FAILED(hr))
    {
        LogError("SetAudioFormat: failed to QI terminal for ITAMMediaFormat");

        return hr;
    }

    //
    // will ask media streaming terminal for audio in this format
    //

    WAVEFORMATEX WaveFormat;

    ZeroMemory(&WaveFormat, sizeof(WAVEFORMATEX));

    WaveFormat.wFormatTag = WAVE_FORMAT_PCM; // pcm
    WaveFormat.nChannels = 1;                // mono
    WaveFormat.nSamplesPerSec = 8000;        // 8 khz
    WaveFormat.nAvgBytesPerSec = 16000;      // 16000 bytes per sec
    WaveFormat.nBlockAlign = 2;              // 2 bytes per block
    WaveFormat.wBitsPerSample = 16;          // 16 bits per sample
    WaveFormat.cbSize = 0;                   // no extra format-specific data

    //
    // configure the wave format we want
    //

    AM_MEDIA_TYPE MediaType;

    MediaType.majortype            = MEDIATYPE_Audio;
    MediaType.subtype              = MEDIASUBTYPE_PCM;
    MediaType.bFixedSizeSamples    = TRUE;
    MediaType.bTemporalCompression = FALSE;
    MediaType.lSampleSize          = 0;
    MediaType.formattype           = FORMAT_WaveFormatEx;
    MediaType.pUnk                 = NULL;
    MediaType.cbFormat             = sizeof(WAVEFORMATEX);
    MediaType.pbFormat             = (BYTE*)&WaveFormat;

    //
    // log the wave format we are setting on the terminal
    //

    LogMessage("SetAudioFormat: setting wave format on terminal. ");
    LogFormat(&WaveFormat);

    //
    // set the format
    //

    hr = pITMediaFormat->put_MediaFormat(&MediaType);

    if (FAILED(hr))
    {

        //
        // try to see what format the terminal wanted
        //

        LogError("SetAudioFormat: failed to set format");

        AM_MEDIA_TYPE *pMediaFormat = NULL;

        HRESULT hr2 = pITMediaFormat->get_MediaFormat(&pMediaFormat);

        if (SUCCEEDED(hr2))
        {

            if (pMediaFormat->formattype == FORMAT_WaveFormatEx)
            {

                //
                // log the terminal's format
                //

                LogError("SetAudioFormat: terminal's format is");
                LogFormat((WAVEFORMATEX*) pMediaFormat->pbFormat);

            }
            else
            {

                LogError("SetAudioFormat: "
                         "terminal's format is not WAVEFORMATEX");
            }

            //
            // note: we are responsible for deallocating the format returned by
            // get_MediaFormat
            //

            DeleteMediaType(pMediaFormat);

        } //  succeeded getting terminal's format
        else
        {

            LogError("SetAudioFormat: failed to get terminal's format");

        }

    }

    pITMediaFormat->Release();
    pITMediaFormat = NULL;

    LogError("SetAudioFormat: completed");

    return hr;

}

HRESULT WriteSampleToFile | ( | IN IStreamSample * | pStreamSample,
 |  | IN CAVIFileWriter * | pFileWriter
 | ) |  |

Definition at line 1692 of file Processing.cpp.

{

    //
    // get the sample's IMemoryData interface so we can get to the
    // sample's data
    //

    IMemoryData *pSampleMemoryData = NULL;

    HRESULT hr = pStreamSample->QueryInterface(IID_IMemoryData,
                                               (void **)&pSampleMemoryData);

    if (FAILED(hr))
    {

        LogError("WriteSampleToFile: "
                 "Failed to qi sample for IMemoryData");

        return hr;
    }

    //
    // get to the sample's data buffer
    //

    DWORD nBufferSize = 0;

    BYTE *pnDataBuffer = NULL;

    DWORD nActualDataSize = 0;

    hr = pSampleMemoryData->GetInfo(&nBufferSize,
                                    &pnDataBuffer,
                                    &nActualDataSize);

    pSampleMemoryData->Release();
    pSampleMemoryData = NULL;

    if (FAILED(hr))
    {
        LogError("WriteSampleToFile: "
                 "Failed to get to the sample's data");

        return hr;
    }

    //
    // write the data buffer to the avi file
    //

    LogMessage("WriteSampleToFile: received a sample of size %ld bytes",
                nActualDataSize);

    ULONG nBytesWritten = 0;

    hr = pFileWriter->Write(pnDataBuffer,
                            nActualDataSize,
                            &nBytesWritten);

    if (FAILED(hr) || (0 == nBytesWritten))
    {
        LogError("WriteSampleToFile: FileWriter.Write() wrote no data.");

        return E_FAIL;
    }

    return hr;
}

HRESULT WriteStreamToFile ( IN IMediaStream * pTerminalMediaStream )

Definition at line 1839 of file Processing.cpp.

{

    LogMessage("WriteStreamToFile: started");

    HRESULT hr = E_FAIL;

    //
    // get the number of stream samples we will be using
    //

    DWORD nNumberOfSamples = 0;

    hr = GetNumberOfSamplesOnStream(pTerminalMediaStream, &nNumberOfSamples);

    if (FAILED(hr))
    {
        LogError("WriteStreamToFile: failed to get the number of samples");

        return hr;
    }

    //
    // the number of samples directly corresponds the number of events we will
    // be waiting on later. WaitForMultipleObjects has a limit of
    // MAXIMUM_WAIT_OBJECTS events.
    //

    if (nNumberOfSamples > MAXIMUM_WAIT_OBJECTS)
    {

        LogError("WriteStreamToFile: the number of samples [%ld] "
                 "exceeds the number allowed by the design of this "
                 "application [%ld]",
                 nNumberOfSamples, MAXIMUM_WAIT_OBJECTS);

        return E_FAIL;

    }

    //
    // allocate events that will be signaled when each sample is ready to be
    // saved to a file
    //

    HANDLE *pSampleReadyEvents = NULL;

    pSampleReadyEvents = AllocateEvents(nNumberOfSamples);

    if (NULL == pSampleReadyEvents)
    {
        LogError("WriteStreamToFile: Failed to allocate sample ready events.");

        return E_OUTOFMEMORY;
    }

    //
    // allocate array of stream samples
    //

    IStreamSample **ppStreamSamples = NULL;

    ppStreamSamples = AllocateStreamSamples(pTerminalMediaStream,
                                            nNumberOfSamples);

    if (NULL == ppStreamSamples)
    {

        LogError("WriteStreamToFile: Failed to allocate stream sample array");

        //
        // release events we have allocated
        //

        ReleaseEvents(pSampleReadyEvents, nNumberOfSamples);
        pSampleReadyEvents = NULL;

        return E_FAIL;
    }

    //
    // we have the samples, we have the events.
    // associate events with samples so events get signaled when the
    // corresponding samples are ready to be written to a file
    //

    hr = AssociateEventsWithSamples(pSampleReadyEvents,
                                    ppStreamSamples,
                                    nNumberOfSamples);

    if (FAILED(hr))
    {
        LogError("WriteStreamToFile: Failed to associate events with samples");

        //
        // release events and samples we have allocated
        //

        ReleaseEvents(pSampleReadyEvents, nNumberOfSamples);
        pSampleReadyEvents = NULL;

        ReleaseSamples(ppStreamSamples, nNumberOfSamples);
        ppStreamSamples = NULL;

        return E_FAIL;
    }

    //
    // get the format of the data delivered by media streaming terminal
    //

    WAVEFORMATEX *pAudioFormat = NULL;

    pAudioFormat = GetAudioFormat(pTerminalMediaStream);

    if (NULL == pAudioFormat)
    {
        LogError("WriteStreamToFile: Failed to get audio format");

        //
        // release events and samples we have allocated
        //

        ReleaseEvents(pSampleReadyEvents, nNumberOfSamples);
        pSampleReadyEvents = NULL;

        ReleaseSamples(ppStreamSamples, nNumberOfSamples);
        ppStreamSamples = NULL;

        return E_FAIL;

    }

    //
    // create a file with the required name and format.
    //

    CAVIFileWriter FileWriter;

    hr = FileWriter.Initialize(SZ_OUTPUTFILENAME, *pAudioFormat);

    //
    // no longer need audio format
    //

    FreeMemory(pAudioFormat);
    pAudioFormat = NULL;

    if (FAILED(hr))
    {
        LogError("WriteStreamToFile: open file");

        //
        // release events and samples we have allocated
        //

        ReleaseEvents(pSampleReadyEvents, nNumberOfSamples);
        pSampleReadyEvents = NULL;

        ReleaseSamples(ppStreamSamples, nNumberOfSamples);
        ppStreamSamples = NULL;

        return hr;

    }

    //
    // just for logging, count the number of samples we have recorded
    //

    ULONG nStreamSamplesRecorded = 0;

    while(TRUE)
    {

        //
        // wait for the events associated with the samples
        // when a samples has data, the corresponding event will be
        // signaled
        //

        DWORD nWaitCode = WaitForMultipleObjects(nNumberOfSamples,
                                                 pSampleReadyEvents,
                                                 FALSE,
                                                 INFINITE);

        //
        // get the id of the sample that was signaled. fail if Wait returned
        // error
        //

        DWORD nSampleID = 0;

        hr = GetSampleID(nWaitCode, nNumberOfSamples, &nSampleID);

        if (FAILED(hr))
        {
            LogError("WriteStreamToFile: wait failed");

            break;
        }

        //
        // we filtered out all invalid error codes. so nSampleID has no
        // choice but be a valid sample index.
        //

        _ASSERTE(nSampleID < nNumberOfSamples);

        //
        // make sure the sample is ready to be read
        //

        hr = ppStreamSamples[nSampleID]->CompletionStatus(COMPSTAT_WAIT, 0);

        //
        // check against S_OK explicitly -- not all success codes mean the
        // sample is ready to be used (MS_S_ENDOFSTREAM, etc)
        //

        if (S_OK != hr)
        {

            if (E_ABORT == hr)
            {

                //
                // recording was aborted, probably because
                // the call was disconnected
                //

                LogMessage("WriteStreamToFile: recording aborted");
            }
            else
            {

                LogMessage("WriteStreamToFile: sample is not completed. "
                            "hr = 0x%lx", hr);
            }

            break;
        }

        //
        // we have the sample that was signaled and which is now ready to be
        // saved to a file. Record the sample.
        //

        hr = WriteSampleToFile(ppStreamSamples[nSampleID], &FileWriter);

        if (FAILED(hr))
        {
            LogError("WriteStreamToFile: failed to write sample to file");

            break;
        }

        //
        // one more sample was recorded. update the count.
        //

        nStreamSamplesRecorded++;

        //
        // we are done with this sample. return it to the source stream
        // to be refilled with data
        //

        hr = ppStreamSamples[nSampleID]->Update(0,
                                               pSampleReadyEvents[nSampleID],
                                               NULL,
                                               0);

        if (FAILED(hr))
        {
            LogError("WriteStreamToFile: "
                     "Failed to Update the sample recorded. "
                     "hr = 0x%lx", hr);

            break;
        }

    } // sample-writing loop

    LogMessage("WriteStreamToFile: wrote the total of %lu samples",
                nStreamSamplesRecorded);

    //
    // release samples and events
    //

    ReleaseSamples(ppStreamSamples, nNumberOfSamples);
    ppStreamSamples = NULL;

    ReleaseEvents(pSampleReadyEvents, nNumberOfSamples);
    pSampleReadyEvents = NULL;

    //
    // deallocated samples and events. safe to exit.
    //

    LogMessage("WriteStreamToFile: completed, hr = 0x%lx", hr);

    return hr;
}

Variable Documentation

CWorkerThread g_WorkerThread

Definition at line 44 of file Processing.cpp.

Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/tapirecv/Processing.h File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • tapirecv
Classes

Processing.h File Reference

Go to the source code of this file.

Classes

class CTAPIEventNotification
Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/tapirecv/tapirecv.cpp File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • tapirecv
Functions | Variables

tapirecv.cpp File Reference

#include "common.h"
#include "Processing.h"

Go to the source code of this file.

Functions

BOOL | AddressSupportsAudio (IN ITAddress *pAddress)
BOOL | AddressSupportsMST (IN ITAddress *pAddress)
void * | AllocateMemory (SIZE_T nMemorySize)
BOOL | CtrlHandler (DWORD nEventType)
void | DisconnectAndReleaseCall ()
void | FreeMemory (void *pMemory)
HRESULT | InitializeTAPI ()
HRESULT | ListenOnAddress (ITAddress *pAddress)
void | LogFormat (const WAVEFORMATEX *pWaveFormat)
void | LogMessage (CHAR *pszFormat,...)
int __cdecl | main (int argc, char *argv[])
HRESULT | RegisterCallback ()
void | ShutdownTapi ()
HRESULT | StartListening ()
HRESULT | UnRegisterCallBack ()

Variables

CRITICAL_SECTION | g_CurrentCallCritSection
HANDLE | g_hExitEvent = NULL
ULONG | g_nTAPINotificationCookie = 0
ITBasicCallControl * | g_pCurrentCall = NULL
ITTAPI * | g_pTapi = NULL

Function Documentation

BOOL AddressSupportsAudio ( IN ITAddress * pAddress )

Definition at line 476 of file tapirecv.cpp.

{

    //
    // get the address's ITMediaSupport so we can check
    // the media type it supports
    //

    ITMediaSupport *pMediaSupport = NULL;

    HRESULT hr = pAddress->QueryInterface(IID_ITMediaSupport,
                                          (void**)&pMediaSupport);

    if (FAILED(hr))
    {
        LogError("AddressSupportsAudio: "
                 "Failed to QI address for ITMediaSupport");

        return FALSE;
    }

    //
    // does the address support audio?
    //

    VARIANT_BOOL bAudioSupported = VARIANT_FALSE;

    hr = pMediaSupport->QueryMediaType(TAPIMEDIATYPE_AUDIO, &bAudioSupported);

    pMediaSupport->Release();
    pMediaSupport = NULL;

    if (FAILED(hr))
    {
        LogError("AddressSupportsAudio: Failed to QueryMediaType");

        return FALSE;
    }

    if (VARIANT_TRUE == bAudioSupported)
    {
        LogMessage("AddressSupportsAudio: audio supported on this address");

        return TRUE;

    }
    else
    {
        LogMessage("AddressSupportsAudio: "
                   "audio NOT supported on this address");

        return FALSE;

    }
}

BOOL AddressSupportsMST ( IN ITAddress * pAddress )

Definition at line 544 of file tapirecv.cpp.

{

    //
    // get the address's ITTerminalSupport so we can check
    // the terminals it supports
    //

    ITTerminalSupport *pTerminalSupport = NULL;

    HRESULT hr = pAddress->QueryInterface( IID_ITTerminalSupport,
                                           (void **)&pTerminalSupport );

    if (FAILED(hr))
    {
        LogError("AddressSupportsMST: Failed to QI address for ITTerminalSupport");

        return FALSE;
    }

    //
    // get enumeration of dynamic terminal classes this address supports
    //

    IEnumTerminalClass *pTerminalClassEnumerator = NULL;

    hr = pTerminalSupport->EnumerateDynamicTerminalClasses(&pTerminalClassEnumerator);

    pTerminalSupport->Release();
    pTerminalSupport = NULL;

    if (FAILED(hr))
    {

        LogError("AddressSupportsMST: Failed to get dynamic terminal classes");

        return FALSE;

    }

    //
    // walk through terminal class enumeration and see if the
    // media streaming terminal is in it
    //

    while (TRUE)
    {

        GUID guid;

        hr = pTerminalClassEnumerator->Next(1, &guid, NULL);

        if (S_OK != hr)
        {
            LogMessage("AddressSupportsMST: no more terminal classes. "
                       "MST not supported on this address");

            break;
        }

        if ( IsEqualGUID(guid, CLSID_MediaStreamTerminal))
        {
            LogMessage("AddressSupportsMST: media streaming terminal supported");

            break;
        }
    }

    //
    // no longer need the enumeration
    //

    pTerminalClassEnumerator->Release();
    pTerminalClassEnumerator = NULL;

    //
    // if we did not break out of the loop because the enumeration ended,
    // media streaming terminal was not in the list of supported terminals
    //

    if (S_OK == hr)
    {
        return TRUE;
    }
    else
    {
        return FALSE;
    }

}

void* AllocateMemory ( SIZE_T nMemorySize )

Definition at line 198 of file tapirecv.cpp.

{

    //
    // use HeapAlloc to allocate and clear memory
    //

    return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, nMemorySize);
}

BOOL CtrlHandler ( DWORD nEventType )

Definition at line 1096 of file tapirecv.cpp.

{

    static BOOL bShutdownInProgress = FALSE;

    //
    // are we in the middle of shutting down?
    //

    if (TRUE == bShutdownInProgress)
    {
        LogMessage("CtrlHandler: Shutdown already in progress");

        return TRUE;
    }

    //
    // any exit event (close, ctrl+break/C, logoff, shutdown)
    // is a signal for the application to exit.
    //

    switch (nEventType)
    {

        case CTRL_C_EVENT:
        case CTRL_CLOSE_EVENT:
        case CTRL_BREAK_EVENT:
        case CTRL_LOGOFF_EVENT:
        case CTRL_SHUTDOWN_EVENT:

            LogMessage("CtrlHandler: Initiating shutdown.");

            //
            // ignore subsequent shutdown requests...
            //

            bShutdownInProgress = TRUE;

            //
            // signal shutdown
            //

            SetEvent(g_hExitEvent);
            break;

        default:
            break;

    }

    return TRUE;
}

void DisconnectAndReleaseCall ( )

Definition at line 983 of file tapirecv.cpp.

{

    //
    // g_pCurrentCall can be accessed from event-processing thread and
    // needs to be protected
    //

    EnterCriticalSection(&g_CurrentCallCritSection);

    if (NULL != g_pCurrentCall)
    {

        //
        // if the call exists, attempt to disconnect it
        //

        LogMessage("DisconnectAndReleaseCall: disconnecting the call");

        g_pCurrentCall->Disconnect(DC_NORMAL);

        //
        // succeded or failed, release the call
        //

        g_pCurrentCall->Release();
        g_pCurrentCall = NULL;
    }

    LeaveCriticalSection(&g_CurrentCallCritSection);
}

void FreeMemory ( void * pMemory )

Definition at line 220 of file tapirecv.cpp.

{

    //
    // get size of the allocated memory
    //

    SIZE_T nMemorySize = HeapSize(GetProcessHeap(), 0, pMemory);

    if (-1 == nMemorySize)
    {
        LogError("FreeMemory: failed to get size of the memory block %p",
                 pMemory);

        //
        // don't exit -- try freeing anyway
        //

    }
    else
    {
        //
        // fill memory with 0xdd's before freeing, so it is easier to debug
        // failures caused by using pointer to deallocated memory
        //

        if (NULL != pMemory)
        {
            FillMemory(pMemory, nMemorySize, 0xdd);
        }

    }

    //
    // use HeapFree to free memory. use return code to log the result, but
    // do not return it to the caller
    //

    BOOL bFreeSuccess = HeapFree(GetProcessHeap(), 0, pMemory);

    if (FALSE == bFreeSuccess)
    {
        LogError("FreeMemory: HeapFree failed");

        //
        // if this assertion fires, it is likely there is a problem with the
        // memory we are trying to deallocate. Was it allocated using heapalloc
        // and on the same heap? Is this a valid pointer?
        //

        _ASSERTE(FALSE);
    }

}

HRESULT InitializeTAPI ( )

Definition at line 848 of file tapirecv.cpp.

{

    LogMessage("InitializeTAPI: started");

    HRESULT hr = E_FAIL;

    //
    // cocreate the TAPI object
    //

    hr = CoCreateInstance(
                          CLSID_TAPI,
                          NULL,
                          CLSCTX_INPROC_SERVER,
                          IID_ITTAPI,
                          (LPVOID *)&g_pTapi
                         );

    if (FAILED(hr))
    {
        LogError("InitializeTAPI: failed to CoCreateInstance TAPI");

        return hr;
    }

    //
    // cannot use tapi until it's initialized
    //

    hr = g_pTapi->Initialize();

    if (FAILED(hr))
    {
        LogError("InitializeTAPI: TAPI failed to initialize");

        g_pTapi->Release();
        g_pTapi = NULL;

        return hr;
    }

    //
    // register the callback object that will receive tapi notifications
    //

    hr = RegisterCallback();

    if (FAILED(hr))
    {
        LogError("InitializeTAPI: failed to register callback");

        g_pTapi->Shutdown();
        g_pTapi->Release();
        g_pTapi = NULL;

        return hr;
    }

    //
    // we want to be notified of these events:
    //

    hr = g_pTapi->put_EventFilter(TE_CALLNOTIFICATION |
                                  TE_CALLSTATE |
                                  TE_CALLMEDIA);

    if (FAILED(hr))
    {
        LogError("InitializeTAPI: Failed to put_EventFilter");

        //
        // unregister callback
        //

        UnRegisterCallBack();

        //
        // shutdown and release TAPI
        //

        g_pTapi->Shutdown();
        g_pTapi->Release();
        g_pTapi = NULL;

        return hr;
    }

    //
    // start listening on the addresses that support audio
    //

    hr = StartListening();

    if (S_OK != hr)
    {
        LogError("InitializeTAPI: Failed to start listening");

        //
        // unregister callback
        //

        UnRegisterCallBack();

        //
        // shutdown and release TAPI
        //

        g_pTapi->Shutdown();
        g_pTapi->Release();
        g_pTapi = NULL;

        return hr;
    }

    LogMessage("InitializeTAPI: succeeded");

    return S_OK;
}

HRESULT ListenOnAddress ( ITAddress * pAddress )

Definition at line 650 of file tapirecv.cpp.

{

    long ulCallNotificationCookie = 0;

    //
    // we want to be notified of the status of this address
    //
    // the app can keep the cookies to later unregister from events
    // from specific addresses (by calling ITTAPI::UnregisterNotifications)
    // when it no longer wants to receive events for this specific address.
    // this sample does not do this for simplicity.
    //

    HRESULT  hr= g_pTapi->RegisterCallNotifications(pAddress,
                                                   VARIANT_TRUE,
                                                   VARIANT_TRUE,
                                                   TAPIMEDIATYPE_AUDIO,
                                                   g_nTAPINotificationCookie,
                                                   &ulCallNotificationCookie
                                                   );

    return hr;
}

void LogFormat ( const WAVEFORMATEX * pWaveFormat )

Definition at line 176 of file tapirecv.cpp.

{
    LogMessage("    Format: ");
    LogMessage("        tag: %u", pWaveFormat->wFormatTag);
    LogMessage("        channels: %u", pWaveFormat->nChannels);
    LogMessage("        samples/sec: %lu", pWaveFormat->nSamplesPerSec);
    LogMessage("        align: %u", pWaveFormat->nBlockAlign);
    LogMessage("        bits/sample: %u", pWaveFormat->wBitsPerSample);

}

void LogMessage | ( | CHAR * | pszFormat,
 |  |  | ...
 | ) |  |

Definition at line 70 of file tapirecv.cpp.

{

    //
    // output buffer -- note: hardcoded limit
    //

    static const BUFFER_SIZE = 1280;

    char szBuffer[BUFFER_SIZE];

    //
    // get current time
    //

    SYSTEMTIME SystemTime;

    GetLocalTime(&SystemTime);

    //
    // format thread id and time
    //

    StringCbPrintf( szBuffer, BUFFER_SIZE, "[%lx]:[%02u:%02u:%02u.%03u]::",
             GetCurrentThreadId(),
             SystemTime.wHour,
             SystemTime.wMinute,
             SystemTime.wSecond,
             SystemTime.wMilliseconds);

    size_t iStringLength = 0;

    HRESULT hr = StringCbLength(szBuffer, BUFFER_SIZE, &iStringLength);

    if (FAILED(hr))
    {
        // either this code is wrong, or someone else in the process corrupted
        // our memory.
        return;
    }

    //
    // get the actual message
    //

    va_list vaArguments;

    va_start(vaArguments, pszFormat);

    size_t iBytesLeft = BUFFER_SIZE - iStringLength;

    //
    // not checking the return code of this function. even if it fails, we will
    // have a null-terminated string that we will be able to log.
    //

    StringCbVPrintf( &(szBuffer[iStringLength]), iBytesLeft, pszFormat, vaArguments);

    va_end(vaArguments);

    //
    // how big is the string now, and how many bytes do we have left?
    //

    hr = StringCbLength(szBuffer, BUFFER_SIZE, &iStringLength);

    if (FAILED(hr))
    {
        // either this code is wrong, or someone else in the process corrupted
        // our memory.
        return;
    }

    iBytesLeft = BUFFER_SIZE - iStringLength;

    //
    // append a carriage return to the string. ignore the result code, the
    // result string will be null-terminated no matter what.
    //

    StringCbCat(szBuffer, iBytesLeft, "\n");

    //
    // log the buffer
    //

    printf(szBuffer);
}

int __cdecl main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 1158 of file tapirecv.cpp.

{

    LogMessage("main: started");

    //
    // this event be signalled when it's time to exit
    //

    g_hExitEvent = CreateEvent(NULL, FALSE, FALSE, NULL);

    if (NULL == g_hExitEvent)
    {
        LogError("main: Failed to create exit event");

        return 1;
    }

    //
    // we want to handle ctrl+c and ctrl+break events so we can cleanup on exit
    // proceed even in case of failure
    //

    SetConsoleCtrlHandler( (PHANDLER_ROUTINE)CtrlHandler, TRUE);

    //
    // initialize COM
    //

    HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);

    if ( FAILED(hr))
    {
        LogError("main: Failed to CoInitialize");

        CloseHandle(g_hExitEvent);
        g_hExitEvent = NULL;

        return 1;
    }

    //
    // start worker thread for tapi message processing
    //

    hr = g_WorkerThread.Initialize();

    if (FAILED(hr))
    {
        LogError("main: Failed to initialize worker thread");

        CoUninitialize();

        CloseHandle(g_hExitEvent);
        g_hExitEvent = NULL;

        return 1;
    }

    //
    // initialize critical section used to serialize access to global
    // current call
    //
    // note: InitializeCriticalSection can raise STATUS_NO_MEMORY exception
    //

    InitializeCriticalSection(&g_CurrentCallCritSection);

    //
    // create and initialize tapi object, register the callback object
    // and start listening
    //

    hr = InitializeTAPI();

    if (FAILED(hr))
    {

        g_WorkerThread.Shutdown();

        CloseHandle(g_hExitEvent);
        g_hExitEvent = NULL;

        DeleteCriticalSection(&g_CurrentCallCritSection);

        CoUninitialize();
        return 1;
    }

    //
    // wait until ctrl+break handler or CS_DISCONNECT handler signal exit event
    //

    LogMessage("main: waiting for exit event");

    DWORD nWaitResult = WaitForSingleObject(g_hExitEvent, INFINITE);

    LogMessage("main: exit event signaled");

    //
    // disconnect and release call, if it exists
    //

    DisconnectAndReleaseCall();

    //
    // cleanup tapi
    //

    ShutdownTapi();

    //
    // stop the worker thread
    //

    g_WorkerThread.Shutdown();

    //
    // no longer need the critical section
    //

    DeleteCriticalSection(&g_CurrentCallCritSection);

    //
    // release com
    //

    CoUninitialize();

    //
    // no longer need the event
    //

    CloseHandle(g_hExitEvent);
    g_hExitEvent = NULL;

    //
    // exiting... we no longer want to handle ctrl+c and ctrl+break
    //

    SetConsoleCtrlHandler( (PHANDLER_ROUTINE) CtrlHandler, FALSE);

    //
    // was the event signaled, or wait failed?
    //

    if (WAIT_OBJECT_0 != nWaitResult)
    {
        LogError("main: Failed to wait for exit event");
        return 1;
    }

    LogMessage("main: exiting");

  return 0;
}

HRESULT RegisterCallback ( )

Definition at line 286 of file tapirecv.cpp.

{
    LogMessage("RegisterCallback: started");

    HRESULT hr = S_OK;

    //
    // get connection point container on the tapi object
    //

    IConnectionPointContainer *pCPContainer = NULL;

    hr = g_pTapi->QueryInterface(
                                IID_IConnectionPointContainer,
                                (void **)&pCPContainer
                               );

    if (FAILED(hr))
    {
        LogError("RegisterCallback: "
                 "Failed to get IConnectionPointContainer on TAPI");

        return hr;
    }

    //
    // find connection point for our interface
    //

    IConnectionPoint *pCP = NULL;

    hr = pCPContainer->FindConnectionPoint(IID_ITTAPIEventNotification, &pCP);

    pCPContainer->Release();
    pCPContainer = NULL;

    if (FAILED(hr))
    {
        LogError("RegisterCallback: "
                 "Failed to get a connecion point for ITTAPIEventNotification");

        return hr;
    }

    //
    // create the callback object and register it with TAPI.
    // for simplicity, the callback in this sample is not a
    // full-fledged COM object. So create is with new.
    //

    ITTAPIEventNotification *pTAPIEventNotification =
                                                new CTAPIEventNotification;

    if (NULL == pTAPIEventNotification)
    {

        LogError("RegisterCallback: Failed to create a tapi event notification object.");

        pCP->Release();
        pCP = NULL;

        return E_OUTOFMEMORY;
    }

    //
    // will use the cookie later to register for events from addresses
    // and to unregister the callback when we no longer needs the events
    //

    hr = pCP->Advise(pTAPIEventNotification,
                     &g_nTAPINotificationCookie);

    pCP->Release();
    pCP = NULL;

    //
    // whether Advise failed or succeeded, we no longer need a reference to
    // the callback
    //

    pTAPIEventNotification->Release();
    pTAPIEventNotification = NULL;

    if (FAILED(hr))
    {
        g_nTAPINotificationCookie = 0;

        LogError("RegisterCallback: Failed to Advise");
    }

    LogMessage("RegisterCallback: completed");

    return hr;
}

void ShutdownTapi ( )

Definition at line 1027 of file tapirecv.cpp.

{

    LogMessage("ShutdownTapi: started");

    //
    // if there is still a call, disconnect it
    //

    HRESULT hr = E_FAIL;

    //
    // by now, the call is released and disconnected.
    // shutdown tapi
    //

    if (NULL != g_pTapi)
    {
        //
        // unregister callback
        //

        UnRegisterCallBack();

        //
        // shutdown and release the TAPI object
        //

        g_pTapi->Shutdown();
        g_pTapi->Release();
        g_pTapi = NULL;

    }

    //
    // in the unlikely case another call was received after we released the
    // call that we had, release the new call.
    //

    EnterCriticalSection(&g_CurrentCallCritSection);

    if (NULL != g_pCurrentCall)
    {

        g_pCurrentCall->Release();
        g_pCurrentCall = NULL;

    }

    LeaveCriticalSection(&g_CurrentCallCritSection);

    LogMessage("ShutdownTapi: succeeded");
}

HRESULT StartListening ( )

Definition at line 685 of file tapirecv.cpp.

{

    HRESULT hr = S_OK;

    LogMessage("StartListening: started");

    //
    // enumerate available addresses
    //

    IEnumAddress *pEnumAddress = NULL;

    hr = g_pTapi->EnumerateAddresses( &pEnumAddress );

    if (FAILED(hr))
    {
        LogError("StartListening: Failed to enumerate addresses");

        return hr;
    }

    //
    // this flag remains false until we succeded starting listening on at
    // least one address
    //

    BOOL bListenStarted = FALSE;

    //
    // walk through all the addresses and start listening on the ones that
    // support audio
    //

    while (TRUE)
    {
        //
        // check the next address
        //

        ITAddress *pAddress = NULL;

        hr = pEnumAddress->Next(1, &pAddress, NULL);

        if (S_OK != hr)
        {

            //
            // no more addresses or error
            //

            break;
        }

        //
        // log the name of the address
        //

        BSTR bstrAddressName;
        hr = pAddress->get_AddressName(&bstrAddressName);

        if (SUCCEEDED(hr))
        {

            LogMessage("StartListening: -> found address [%S]",
                        bstrAddressName);

            SysFreeString(bstrAddressName);
        }
        else
        {
            LogError("StartListening: failed to get address name");
        }

        //
        // if the address supports audio and media streaming terminal,
        // start listening
        //

        if ( AddressSupportsAudio(pAddress) && AddressSupportsMST(pAddress) )
        {

            //
            // start listening on this address
            //

            LogMessage("StartListening: Starting listening.");

            hr = ListenOnAddress(pAddress);

            if (SUCCEEDED(hr))
            {

                //
                // we are listening on at least one address
                //

                bListenStarted = TRUE;

                LogMessage("StartListening: "
                           "-> started listening on this address");

            }
            else
            {
                //
                // log an error and continue
                //

                LogError("StartListening: -> failed starting listening on this address, "
                         "hr = 0x%lx", hr);
            }
        }
        else
        {
            LogMessage("StartListening: -> no audio or MST support on this address.");
        }

        pAddress->Release();
        pAddress = NULL;

    }

    pEnumAddress->Release();
    pEnumAddress = NULL;

    //
    // depending on whether we started listening or not, log a message and
    // return the appropriate error code.
    //

    if (bListenStarted)
    {
        LogMessage("StartListening: completed. "
                   "Listening on one or more addresses");

        return S_OK;
    }
    else
    {
        LogMessage("StartListening: completed. Not listening on any address.");

        return E_FAIL;
    }
}

HRESULT UnRegisterCallBack ( )

Definition at line 397 of file tapirecv.cpp.

{
    LogMessage("UnRegisterCallBack: started");

    HRESULT hr = S_OK;

    //
    // get connection point container on the tapi object
    //

    IConnectionPointContainer *pCPContainer = NULL;

    hr = g_pTapi->QueryInterface(IID_IConnectionPointContainer,
                                (void **)&pCPContainer);

    if (FAILED(hr))
    {
        LogError("UnRegisterCallBack: "
                 "Failed to get IConnectionPointContainer on TAPI");

        return hr;
    }

    //
    // find connection point for our interface
    //

    IConnectionPoint *pConnectionPoint = NULL;

    hr = pCPContainer->FindConnectionPoint(IID_ITTAPIEventNotification,
                                           &pConnectionPoint);

    pCPContainer->Release();
    pCPContainer = NULL;

    if (FAILED(hr))
    {
        LogError("RegisterCallback: Failed to get a connection point for "
                 "ITTAPIEventNotification");

        return hr;
    }

    //
    // unregister the callback
    //

    hr = pConnectionPoint->Unadvise(g_nTAPINotificationCookie);

    pConnectionPoint->Release();
    pConnectionPoint = NULL;

    g_nTAPINotificationCookie = 0;

    if (FAILED(hr))
    {
        LogError("UnRegisterCallBack: Unadvise failed");
    }
    else
    {
        LogMessage("UnRegisterCallBack: succeeded");
    }

    return hr;
}

Variable Documentation

CRITICAL_SECTION g_CurrentCallCritSection

Definition at line 52 of file tapirecv.cpp.

HANDLE g_hExitEvent = NULL

Definition at line 31 of file tapirecv.cpp.

ULONG g_nTAPINotificationCookie = 0

Definition at line 58 of file tapirecv.cpp.

ITBasicCallControl* g_pCurrentCall = NULL

Definition at line 45 of file tapirecv.cpp.

ITTAPI* g_pTapi = NULL

Definition at line 38 of file tapirecv.cpp.

Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/tapirecv/workerthread.cpp File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • tapirecv

workerthread.cpp File Reference

#include "common.h"
#include "WorkerThread.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/tapirecv/workerthread.h File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • tapirecv
Classes

workerthread.h File Reference

Go to the source code of this file.

Classes

class CWorkerThread
Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/tapisend/avifilereader.cpp File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • tapisend

avifilereader.cpp File Reference

#include "common.h"
#include "AVIFileReader.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/tapisend/avifilereader.h File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • tapisend
Classes

avifilereader.h File Reference

Go to the source code of this file.

Classes

class CAVIFileReader
Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/tapisend/common.h File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • tapisend
Defines | Functions

common.h File Reference

#include <stdio.h>
#include <windows.h>
#include <tapi3.h>
#include <vfw.h>
#include <crtdbg.h>
#include <uuids.h>
#include <Mtype.h>
#include <amstream.h>
#include <vfwmsgs.h>
#include <deque>
#include <strsafe.h>

Go to the source code of this file.

Defines

#define | _WIN32_DCOM
#define | LogError LogMessage

Functions

void * | AllocateMemory (SIZE_T nMemorySize)
void | FreeMemory (void *pMemory)
void | LogFormat (WAVEFORMATEX *pWaveFormat)
void | LogMessage (CHAR *pszFormat,...)

Define Documentation

#define _WIN32_DCOM

Definition at line 19 of file common.h.

#define LogError LogMessage

Definition at line 47 of file common.h.

Function Documentation

void* AllocateMemory ( SIZE_T nMemorySize )

Definition at line 198 of file tapirecv.cpp.

{

    //
    // use HeapAlloc to allocate and clear memory
    //

    return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, nMemorySize);
}

void FreeMemory ( void * pMemory )

Definition at line 220 of file tapirecv.cpp.

{

    //
    // get size of the allocated memory
    //

    SIZE_T nMemorySize = HeapSize(GetProcessHeap(), 0, pMemory);

    if (-1 == nMemorySize)
    {
        LogError("FreeMemory: failed to get size of the memory block %p",
                 pMemory);

        //
        // don't exit -- try freeing anyway
        //

    }
    else
    {
        //
        // fill memory with 0xdd's before freeing, so it is easier to debug
        // failures caused by using pointer to deallocated memory
        //

        if (NULL != pMemory)
        {
            FillMemory(pMemory, nMemorySize, 0xdd);
        }

    }

    //
    // use HeapFree to free memory. use return code to log the result, but
    // do not return it to the caller
    //

    BOOL bFreeSuccess = HeapFree(GetProcessHeap(), 0, pMemory);

    if (FALSE == bFreeSuccess)
    {
        LogError("FreeMemory: HeapFree failed");

        //
        // if this assertion fires, it is likely there is a problem with the
        // memory we are trying to deallocate. Was it allocated using heapalloc
        // and on the same heap? Is this a valid pointer?
        //

        _ASSERTE(FALSE);
    }

}

void LogFormat ( WAVEFORMATEX * pWaveFormat )
void LogMessage | ( | CHAR * | pszFormat,
 |  |  | ...
 | ) |  |

Definition at line 70 of file tapirecv.cpp.

{

    //
    // output buffer -- note: hardcoded limit
    //

    static const BUFFER_SIZE = 1280;

    char szBuffer[BUFFER_SIZE];

    //
    // get current time
    //

    SYSTEMTIME SystemTime;

    GetLocalTime(&SystemTime);

    //
    // format thread id and time
    //

    StringCbPrintf( szBuffer, BUFFER_SIZE, "[%lx]:[%02u:%02u:%02u.%03u]::",
             GetCurrentThreadId(),
             SystemTime.wHour,
             SystemTime.wMinute,
             SystemTime.wSecond,
             SystemTime.wMilliseconds);

    size_t iStringLength = 0;

    HRESULT hr = StringCbLength(szBuffer, BUFFER_SIZE, &iStringLength);

    if (FAILED(hr))
    {
        // either this code is wrong, or someone else in the process corrupted
        // our memory.
        return;
    }

    //
    // get the actual message
    //

    va_list vaArguments;

    va_start(vaArguments, pszFormat);

    size_t iBytesLeft = BUFFER_SIZE - iStringLength;

    //
    // not checking the return code of this function. even if it fails, we will
    // have a null-terminated string that we will be able to log.
    //

    StringCbVPrintf( &(szBuffer[iStringLength]), iBytesLeft, pszFormat, vaArguments);

    va_end(vaArguments);

    //
    // how big is the string now, and how many bytes do we have left?
    //

    hr = StringCbLength(szBuffer, BUFFER_SIZE, &iStringLength);

    if (FAILED(hr))
    {
        // either this code is wrong, or someone else in the process corrupted
        // our memory.
        return;
    }

    iBytesLeft = BUFFER_SIZE - iStringLength;

    //
    // append a carriage return to the string. ignore the result code, the
    // result string will be null-terminated no matter what.
    //

    StringCbCat(szBuffer, iBytesLeft, "\n");

    //
    // log the buffer
    //

    printf(szBuffer);
}

Generated on Wed Nov 13 2024 16:53:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/Tapi/Tapi3/Cpp/tapisend/tapisend.cpp File Reference

  • NetDS
  • Tapi
  • Tapi3
  • Cpp
  • tapisend
Defines | Functions | Variables

tapisend.cpp File Reference

#include "common.h"
#include "avifilereader.h"

Go to the source code of this file.

Defines

#define | LogError LogMessage

Functions

void * | AllocateMemory (SIZE_T nMemorySize)
HRESULT | Call (IN char *szDestinationAddress, IN char *szAddressType, OUT ITBasicCallControl **ppCall)
HRESULT | CreateAndConnectCall (IN ITAddress *pAddress, IN char *pszDestinationAddress, IN long nAddressType, OUT ITBasicCallControl **ppCall)
HRESULT | CreateAndSelectTerminal (IN ITBasicCallControl *pCall, IN WAVEFORMATEX *pWaveFormat, OUT ITTerminal **ppTerminal)
BSTR | CreateBSTRfromString (IN char *pszString)
ITTerminal * | CreateCaptureMediaStreamingTerminal (IN ITBasicCallControl *pCall)
BOOL | CtrlHandler (DWORD nEventType)
HRESULT | FindAddress (IN long nAddressType, OUT ITAddress **ppAddress)
HRESULT | FindAudioStream (IN ITBasicCallControl *pCall, OUT ITStream **ppStream)
void | FreeMemory (void *pMemory)
HRESULT | GetAddressType (IN char *pszRequestedAddressType, IN OUT long *pnAddressType)
void | HelpScreen ()
HRESULT | InitializeTAPI ()
BOOL | IsValidAudioFile (IN char *pszFileName)
void | LogFormat (IN WAVEFORMATEX *pWaveFormat)
void | LogMessage (IN CHAR *pszFormat,...)
int __cdecl | main (int argc, char *argv[])
HRESULT | ReadFileIntoTerminal (IN CAVIFileReader *pFileReader, IN ITTerminal *pPlaybackTerminal)
HRESULT | SetAllocatorProperties (IN ITTerminal *pTerminal)
HRESULT | SetTerminalFormat (IN ITTerminal *pTerminal, IN WAVEFORMATEX *pWaveFormat)
void | ShutdownTAPI ()
HRESULT | StreamFile (IN char *szFileName, IN char *szAddressString, IN char *szAddressType)

Variables

BOOL | g_bExitRequested = FALSE
long | g_nAddressTypeConstants []
const UINT | g_nNumberOfAddressTypes
ITTAPI * | g_pTapi = NULL
char * | g_szAddressTypes []

Define Documentation

#define LogError LogMessage

Definition at line 171 of file tapisend.cpp.

Function Documentation

void* AllocateMemory ( SIZE_T nMemorySize )

Definition at line 203 of file tapisend.cpp.

{

    //
    // use HeapAlloc to allocate and clear memory
    //

    return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, nMemorySize);
}

HRESULT Call | ( | IN char * | szDestinationAddress,
 |  | IN char * | szAddressType,
 |  | OUT ITBasicCallControl ** | ppCall
 | ) |  |

Definition at line 898 of file tapisend.cpp.

{
    HRESULT hr = E_FAIL;

    //
    // we don't want to return garbage even if we fail
    //

    *ppCall = NULL;

    //
    // find address type
    //

    long nAddressType = 0;

    hr = GetAddressType(szAddressType, &nAddressType);

    if (FAILED(hr))
    {
        LogError("Call: failed to recognize address type %s", szAddressType);

        return hr;
    }

    //
    // find an address for this address type that supports audio
    //

    ITAddress *pAddress = NULL;

    hr = FindAddress(nAddressType, &pAddress);

    if (FAILED(hr))
    {
        LogError("Call: failed to find an address with audio for type %s",
                 szAddressType);

        return hr;
    }

    //
    // have the address. create and connect call
    //

    ITBasicCallControl *pCall = NULL;

    hr = CreateAndConnectCall(pAddress,
                              szDestinationAddress,
                              nAddressType,
                              &pCall);

    pAddress->Release();
    pAddress = NULL;

    if (FAILED(hr))
    {
        LogError("Call: Failed to create and connect call");

        return hr;
    }

    //
    // we have a connected call. return it.
    //

    *ppCall = pCall;

    LogMessage("Call: succeeded.");

    return S_OK;
}

HRESULT CreateAndConnectCall | ( | IN ITAddress * | pAddress,
 |  | IN char * | pszDestinationAddress,
 |  | IN long | nAddressType,
 |  | OUT ITBasicCallControl ** | ppCall
 | ) |  |

Definition at line 804 of file tapisend.cpp.

{

    HRESULT hr = E_FAIL;

    //
    // don't return garbage
    //

    *ppCall = NULL;

    //
    // create a call on the address
    //

    BSTR bstrDestinationAddress = CreateBSTRfromString(pszDestinationAddress);

    ITBasicCallControl *pCall = NULL;

    hr = pAddress->CreateCall(bstrDestinationAddress,
                              nAddressType,
                              TAPIMEDIATYPE_AUDIO,
                              &pCall);

    SysFreeString (bstrDestinationAddress);

    if (FAILED(hr))
    {
        LogError("CreateAndConnectCall: Failed to create a call");

        return hr;
    }

    //
    // call created. attempt to connect synchronously
    //

    LogMessage("CreateAndConnectCall: attempting a synchronous connect");

    hr = pCall->Connect(VARIANT_TRUE);

    if (S_OK != hr)
    {

        LogError("CreateAndConnectCall: failed to connect, hr = 0x%lx", hr);

        pCall->Disconnect(DC_NORMAL);

        //
        // we don't need the call object if it failed to connect
        //

        pCall->Release();
        pCall = NULL;

        hr = E_FAIL;

    }
    else
    {
        //
        // call is successful. return the call object
        //

        LogMessage("CreateAndConnectCall: call connected successfully");

        *ppCall = pCall;
    }

    return hr;
}

HRESULT CreateAndSelectTerminal | ( | IN ITBasicCallControl * | pCall,
 |  | IN WAVEFORMATEX * | pWaveFormat,
 |  | OUT ITTerminal ** | ppTerminal
 | ) |  |

Definition at line 1989 of file tapisend.cpp.

{

    HRESULT hr = E_FAIL;

    //
    // don't return garbage
    //

    *ppTerminal = NULL;

    //
    // find an outgoing audio stream on the call
    //

    ITStream *pStream = NULL;

    hr = FindAudioStream(pCall, &pStream);

    if (FAILED(hr))
    {
        LogError("CreateAndSelectTerminal: failed to find an outgoing audio stream");

        return hr;
    }

    //
    // create media streaming terminal
    //

    ITTerminal *pTerminal = NULL;

    pTerminal = CreateCaptureMediaStreamingTerminal(pCall);

    if (NULL == pTerminal)
    {

        LogError("CreateAndSelectTerminal: Failed to create media streaming terminal");

        pStream->Release();
        pStream = NULL;

        return hr;

    }

    //
    // tell media streaming terminal format of the data
    // we are going to send. If the terminal cannot handle this format
    // return an error
    //

    hr = SetTerminalFormat(pTerminal, pWaveFormat);

    if (FAILED(hr))
    {
        LogMessage("CreateAndSelectTerminal: "
                   "terminal does not support requested format");

        pStream->Release();
        pStream = NULL;

        pTerminal->Release();
        pTerminal = NULL;

        return hr;
    }

    //
    // set allocator properties.
    //
    // calling ITAllocatorProperties::SetAllocatorProperties with the
    // properties that are not optimal for the MSP in use can result
    // in loss of sound quality.
    //
    // So make sure that you only call this function if you know you
    // need it.
    //
    // Do not use ITAllocatorProperties::SetAllocatorProperties to set
    // the size of the buffer you want to get when you fill samples,
    // ITAllocatorProperties::SetBufferSize will accomplish that without
    // affecting terminal's allocator properties.
    //

    // hr = SetAllocatorProperties(pTerminal);

    if (FAILED(hr))
    {

        //
        // not fatal -- we are still likely to successfully stream data
        //

        LogMessage("CreateAndSelectTerminal: "
                   "failed to set allocator properties. continuing.");
    }

    //
    // select the terminal on the stream
    //

    hr = pStream->SelectTerminal(pTerminal);

    //
    // don't need the stream anymore
    //

    pStream->Release();
    pStream = NULL;

    if (FAILED(hr))
    {
        LogError("CreateAndSelectTerminal: Failed to select terminal on the stream");

        pTerminal->Release();
        pTerminal = NULL;

    }

    //
    // if everything went smoothly pTerminal has a pointer to configured
    // and selected terminal. otherwise pTerminal is null and all resources
    // have been released
    //

    *ppTerminal = pTerminal;

    return hr;

}

BSTR CreateBSTRfromString ( IN char * pszString )

Definition at line 731 of file tapisend.cpp.

{

    //
    // convert to wchar so we can create bstr
    //
    // allocate buffer for resulting string of wchars
    //

    size_t nStringLength = strlen(pszString) + 1;

    WCHAR *pwsString = (WCHAR *)AllocateMemory(sizeof(WCHAR) *  nStringLength);

    if (NULL == pwsString)
    {
        LogError("CreateBSTRfromString: "
                 "failed to allocate memory for address string.");

        return NULL;
    }

    //
    // convert to wchar
    //

    int rc = MultiByteToWideChar(CP_ACP,
                                 0,
                                 pszString,
                                 -1,
                                 pwsString,
                                 (int)nStringLength);

    if (0 == rc)
    {
        LogError("CreateBSTRfromString: Failed to convert char to wchar");

        FreeMemory(pwsString);
        pwsString = NULL;

        return NULL;
    }

    //
    // create bstr
    //

    BSTR bstr = SysAllocString(pwsString);

    //
    // no longer needed, deallocate
    //

    FreeMemory(pwsString);
    pwsString = NULL;

    return bstr;

}

ITTerminal* CreateCaptureMediaStreamingTerminal ( IN ITBasicCallControl * pCall )

Definition at line 1194 of file tapisend.cpp.

{

    HRESULT hr = E_FAIL;

    //
    // get the call's call info so we can get the call's address
    //

    ITCallInfo *pCallInfo = NULL;

    hr = pCall->QueryInterface(IID_ITCallInfo, (void**)&pCallInfo);

    if (FAILED(hr))
    {
        LogError("CreateCaptureMediaStreamingTerminal: "
                 "failed to qi call for ITCallInfo");

        return NULL;
    }

    //
    // now we can get the address
    //

    ITAddress *pAddress = NULL;

    hr = pCallInfo->get_Address(&pAddress);

    pCallInfo->Release();
    pCallInfo = NULL;

    if (FAILED(hr))
    {
        LogError("CreateCaptureMediaStreamingTerminal: "
                 "failed to get call's address");
        return NULL;
    }

    //
    // get the terminal support interface
    //

    ITTerminalSupport *pTerminalSupport = NULL;

    hr = pAddress->QueryInterface( IID_ITTerminalSupport,
                                   (void **)&pTerminalSupport );

    pAddress->Release();
    pAddress = NULL;

    if (FAILED(hr))
    {
        LogError("CreateCaptureMediaStreamingTerminal: "
                 "failed to QI pAddress for ITTerminalSupport");

        return NULL;
    }

    //
    // get string for the terminal's class id
    //

    LPOLESTR psTerminalClass = NULL;

    hr = StringFromIID(CLSID_MediaStreamTerminal, &psTerminalClass);

    if (FAILED(hr))
    {
        LogError("CreateCaptureMediaStreamingTerminal: "
                 "Failed to generate string from terminal's class id");

        pTerminalSupport->Release();
        pTerminalSupport = NULL;

        return NULL;
    }

    //
    // make bstr out of the class id
    //

    BSTR bstrTerminalClass = SysAllocString (psTerminalClass);

    //
    // free the string returned by StringFromIID
    //

    CoTaskMemFree(psTerminalClass);
    psTerminalClass = NULL;

    if (NULL == bstrTerminalClass)
    {

        LogError("CreateCaptureMediaStreamingTerminal: "
                 "Failed to allocate BSTR for terminal class");

        pTerminalSupport->Release();
        pTerminalSupport = NULL;

        return NULL;
    }

    //
    // create media streaming terminal
    //

    ITTerminal *pTerminal = NULL;

    hr = pTerminalSupport->CreateTerminal(bstrTerminalClass,
                                          TAPIMEDIATYPE_AUDIO,
                                          TD_CAPTURE,
                                          &pTerminal);

    //
    // release resources no longer needed
    //

    SysFreeString(bstrTerminalClass);

    pTerminalSupport->Release();
    pTerminalSupport = NULL;

    if (FAILED(hr))
    {
        LogError("CreateCaptureMediaStreamingTerminal: "
                 "failed to create media streaming terminal hr = 0x%lx", hr);

        return NULL;
    }

    //
    // successfully created media streaming terminal. return.
    //

    LogMessage("CreateCaptureMediaStreamingTerminal: "
               "Terminal created successfully");

    return pTerminal;

}

BOOL CtrlHandler ( DWORD nEventType )

Definition at line 2372 of file tapisend.cpp.

{

    //
    // are we in the middle of shutting down?
    //

    if (TRUE == g_bExitRequested)
    {
        LogMessage("CtrlHandler: shutdown is already in progress");

        return TRUE;
    }

    //
    // any exit event (close, ctrl+break/C, logoff, shutdown)
    // is a signal for the application to exit.
    //

    switch (nEventType)
    {

        case CTRL_C_EVENT:
        case CTRL_CLOSE_EVENT:
        case CTRL_BREAK_EVENT:
        case CTRL_LOGOFF_EVENT:
        case CTRL_SHUTDOWN_EVENT:

            LogMessage("CtrlHandler: Initiating shutdown.");

            //
            // signal shutdown
            //

            g_bExitRequested = TRUE;

    }

    return TRUE;
}

HRESULT FindAddress | ( | IN long | nAddressType,
 |  | OUT ITAddress ** | ppAddress
 | ) |  |

Definition at line 447 of file tapisend.cpp.

{

    HRESULT hr = E_FAIL;

    //
    // don't return garbage even if we fail
    //

    *ppAddress = NULL;

    //
    // enumerate all available addresses
    //

    IEnumAddress *pEnumAddress = NULL;

    hr = g_pTapi->EnumerateAddresses(&pEnumAddress);

    if (FAILED(hr))
    {
        LogError("FindAddress: Failed to enumerate addresses");

        return hr;
    }

    //
    // walk through the enumeration of addresses and look for those which are
    // of requested type and supports audio
    //

    while (TRUE)
    {
        //
        // get the next address from the enumeration
        //

        ITAddress *pAddress = NULL;

        hr = pEnumAddress->Next( 1, &pAddress, NULL );

        if (S_OK != hr)
        {

            //
            // no more addresses
            //

            LogMessage("FindAddress: no more addresses");

            break;
        }

        //
        // we got an address. check its capabilities
        //

        ITAddressCapabilities *pAddressCaps = NULL;

        hr = pAddress->QueryInterface( IID_ITAddressCapabilities,
                                       (void**)&pAddressCaps );

        if (FAILED(hr))
        {

            LogError("FindAddress: "
                     "Failed to QI address for address capabilities");

            //
            // just continue to the next address
            //

            pAddress->Release();
            pAddress = NULL;

            continue;
        }

        //
        // is this the right address type?
        //

        long nType = 0;

        hr = pAddressCaps->get_AddressCapability(AC_ADDRESSTYPES, &nType);

        pAddressCaps->Release();
        pAddressCaps = NULL;

        if (FAILED(hr))
        {
            LogError("FindAddress: Failed to get_AddressCapability");

            pAddress->Release();
            pAddress = NULL;

            continue;
        }

        if (nType & nAddressType)
        {

            //
            // this address is of the right type. does it support audio?
            //

            ITMediaSupport *pMediaSupport = NULL;

            hr = pAddress->QueryInterface(IID_ITMediaSupport,
                                           (void **)&pMediaSupport);

            if (FAILED(hr))
            {

                //
                // continue to the next address
                //

                LogError("FindAddress: "
                         "failed to qi address for ITMediaSupport");

                pAddress->Release();
                pAddress = NULL;

                continue;
            }

            VARIANT_BOOL bAudioSupported = VARIANT_FALSE;

            hr = pMediaSupport->QueryMediaType(TAPIMEDIATYPE_AUDIO,
                                               &bAudioSupported);

            pMediaSupport->Release();
            pMediaSupport = NULL;

            if (SUCCEEDED(hr) && (VARIANT_TRUE == bAudioSupported))
            {

                LogMessage("FindAddress: address found");

                //
                // log the name of this address
                //

                BSTR bstrAddressName = NULL;

                hr = pAddress->get_AddressName(&bstrAddressName);

                if (FAILED(hr))
                {
                    LogError("FindAddress: failed to get address name");
                }
                else
                {
                    LogMessage("   %S\n", bstrAddressName);
                }

                SysFreeString(bstrAddressName);

                //
                // will use this address
                //

                *ppAddress = pAddress;

                break;;
            }
        }

        //
        // can't use this address. release it
        //

        pAddress->Release();
        pAddress = NULL;

    }

    //
    // done with the enumeration. release.
    //

    pEnumAddress->Release();
    pEnumAddress = NULL;

    //
    // log a message if no address was found
    //

    if (NULL == *ppAddress)
    {
        LogError("FindAddress: no address found");

        return E_FAIL;

    }

    LogMessage("FindAddress: completed");

    return S_OK;
}

HRESULT FindAudioStream | ( | IN ITBasicCallControl * | pCall,
 |  | OUT ITStream ** | ppStream
 | ) |  |

Definition at line 989 of file tapisend.cpp.

{

    HRESULT hr = E_FAIL;

    LogMessage("FindAudioStream: started");

    //
    // don't return garbage
    //

    *ppStream = NULL;

    //
    // enumerate streams on the call
    //

    //
    // get the ITStreamControl interface for this call
    //

    ITStreamControl *pStreamControl = NULL;

    hr = pCall->QueryInterface(IID_ITStreamControl,
                                (void **) &pStreamControl);

    if (FAILED(hr))
    {
        LogError("FindAudioStream: failed to QI call for ITStreamControl");

        return hr;
    }

    //
    // enumerate the streams
    //

    IEnumStream *pEnumStreams = NULL;

    hr = pStreamControl->EnumerateStreams(&pEnumStreams);

    pStreamControl->Release();
    pStreamControl = NULL;

    if (FAILED(hr))
    {
        LogError("CreateAndSelectMST: failed to enumerate streams on call");

        return hr;
    }

    //
    // walk through the streams on the call
    // return the first outgoing audio stream
    //

    while (TRUE)
    {
        ITStream *pStream = NULL;

        hr = pEnumStreams->Next(1, &pStream, NULL);

        if (S_OK != hr)
        {
            //
            // no more streams
            //

            break;
        }

        //
        // check the stream's direction
        //

        TERMINAL_DIRECTION td;

        hr = pStream->get_Direction(&td);

        if (FAILED(hr))
        {
            LogError("CreateAndSelectMST: Failed to get stream direction");

            pStream->Release();
            pStream = NULL;

            //
            // proceed to the next stream, if any
            //

            continue;
        }

        //
        // is the stream of the right direction?
        //

        if (TD_CAPTURE != td)
        {

            //
            // incoming stream. we need outgoing.
            // release the stream and continue
            //

            pStream->Release();
            pStream = NULL;

            continue;
        }

        //
        // check the stream's media type
        //

        long lMediaType = 0;

        hr = pStream->get_MediaType(&lMediaType);

        if (FAILED(hr))
        {
            LogError("CreateAndSelectMST: Failed to get media type");

            pStream->Release();
            pStream = NULL;

            continue;
        }

        //
        // Does this stream have the right media type?
        // Streams are defined as having exactly one media type
        // (not a bitmask).
        //

        if ( lMediaType == TAPIMEDIATYPE_AUDIO )
        {

            LogMessage("FindAudioStream: stream found");

            //
            // this is what we need, so stop looking
            //

            *ppStream = pStream;

            break;
        }

        pStream->Release();
        pStream = NULL;

    } // while (walking through the call's streams)

    //
    // release stream enumeration
    //

    pEnumStreams->Release();
    pEnumStreams = NULL;

    //
    // return the error code, depending on whether we found a stream or not
    //

    if (NULL == *ppStream)
    {
        LogMessage("FindAudioStream: didn't find an audio stream");

        return E_FAIL;
    }

    LogMessage("FindAudioStream: succeded");

    return S_OK;

}

void FreeMemory ( void * pMemory )

Definition at line 224 of file tapisend.cpp.

{

    //
    // get size of the allocated memory
    //

    SIZE_T nMemorySize = HeapSize(GetProcessHeap(), 0, pMemory);

    if (-1 == nMemorySize)
    {
        LogError("FreeMemory: failed to get size of the memory block %p",
                 pMemory);

        //
        // don't exit -- try freeing anyway
        //

    }
    else
    {
        //
        // fill memory with 0xdd's before freeing, so it is easier to debug
        // failures caused by using pointer to deallocated memory
        //

        if (0 != pMemory)
        {
            FillMemory(pMemory, nMemorySize, 0xdd);
        }

    }

    //
    // use HeapFree to free memory. use return code to log the result, but
    // do not return it to the caller
    //

    BOOL bFreeSuccess = HeapFree(GetProcessHeap(), 0, pMemory);

    if (FALSE == bFreeSuccess)
    {
        LogError("FreeMemory: HeapFree failed");

        //
        // if this assertion fires, it is likely there is a problem with the
        // memory we are trying to deallocate. Was it allocated using heapalloc
        // and on the same heap? Is this a valid pointer?
        //

        _ASSERTE(FALSE);
    }

}

HRESULT GetAddressType | ( | IN char * | pszRequestedAddressType,
 |  | IN OUT long * | pnAddressType
 | ) |  |

Definition at line 678 of file tapisend.cpp.

{

    //
    // match address type specified by the user to one of the known
    // address types
    //

    *pnAddressType = 0;

    for (int i = 0; i < g_nNumberOfAddressTypes; i++)
    {

        if (0 == _stricmp(g_szAddressTypes[i], pszRequestedAddressType))
        {

            //
            // get the address type constant corresponding to the string
            //

            *pnAddressType =  g_nAddressTypeConstants[i];

            LogMessage("GetAddressType: "
                       "matched address type [%s] to address type [%d]",
                       pszRequestedAddressType, *pnAddressType);

            return S_OK;
        }

    }

    LogError("GetAddressType: unrecognized address type [%s]",
              pszRequestedAddressType);

    return E_FAIL;
}

void HelpScreen ( )

Definition at line 2344 of file tapisend.cpp.

{

    printf("Usage:\n\n"
               "  TAPISend filename address addresstype\n\n"
               "  where addresstype is [ ");

    for (int i = 0; i < g_nNumberOfAddressTypes - 1; ++i)
    {
        printf("%s | ", g_szAddressTypes[i]);
    }

    printf("%s ]\n", g_szAddressTypes[i]);

}

HRESULT InitializeTAPI ( )

Definition at line 289 of file tapisend.cpp.

{

    HRESULT hr = E_FAIL;

    LogMessage("InitializeTAPI: started");

    //
    // create the TAPI object
    //

    hr = CoCreateInstance(
                          CLSID_TAPI,
                          NULL,
                          CLSCTX_INPROC_SERVER,
                          IID_ITTAPI,
                          (LPVOID *)&g_pTapi
                         );

    if (FAILED(hr))
    {
        LogError("InitializeTAPI: CoCreateInstance on TAPI failed");

        return hr;
    }

    //
    // must initialize tapi object before using it
    //

    LogMessage("InitializeTAPI: calling ITTAPI::Initialize()");

    hr = g_pTapi->Initialize();

    if (FAILED(hr))
    {
        LogError("InitializeTAPI: TAPI failed to initialize");

        g_pTapi->Release();
        g_pTapi = NULL;

        return hr;
    }

    //
    // setting event filtering -- this is required for synchronous
    // ITBasicCallControl->Connect to work
    //

    LogMessage("InitializeTAPI: calling ITTAPI::put_EventFilter()");

    hr = g_pTapi->put_EventFilter(TE_CALLSTATE);

    if (FAILED(hr))
    {
        LogError("InitializeTAPI: TAPI failed to put event filtering");

        g_pTapi->Shutdown();

        g_pTapi->Release();
        g_pTapi = NULL;

        return hr;
    }

    LogMessage("InitializeTAPI: succeeded");

    return S_OK;
}

BOOL IsValidAudioFile ( IN char * pszFileName )

Definition at line 404 of file tapisend.cpp.

{

    //
    // open the file
    //

    CAVIFileReader FileReader;

    HRESULT hr = FileReader.Initialize(pszFileName);

    //
    // see if it is a valid audio file
    //

    if ((FAILED(hr)) || !FileReader.IsValidAudioFile())
    {
        LogError("IsValidAudioFile: file [%s] does not exist or is not "
                 "a valid wav file", pszFileName);

        return FALSE;
    }
    else
    {
        LogMessage("IsValidAudioFile: file [%s] is a valid audio file",
                    pszFileName);

        return TRUE;
    }

}

void LogFormat ( IN WAVEFORMATEX * pWaveFormat )

Definition at line 182 of file tapisend.cpp.

{
    LogMessage("    Format: ");
    LogMessage("        tag: %u", pWaveFormat->wFormatTag);
    LogMessage("        channels: %u", pWaveFormat->nChannels);
    LogMessage("        samples/sec: %lu", pWaveFormat->nSamplesPerSec);
    LogMessage("        align: %u", pWaveFormat->nBlockAlign);
    LogMessage("        bits/sample: %u", pWaveFormat->wBitsPerSample);

}

void LogMessage | ( | IN CHAR * | pszFormat,
 |  |  | ...
 | ) |  |

Definition at line 73 of file tapisend.cpp.

{

    //
    // output buffer -- note: hardcoded limit
    //

    static const BUFFER_SIZE = 1280;

    char szBuffer[BUFFER_SIZE];

    //
    // get current time
    //

    SYSTEMTIME SystemTime;

    GetLocalTime(&SystemTime);

    //
    // format thread id and time
    //

    StringCbPrintf( szBuffer, BUFFER_SIZE, "[%lx]:[%02u:%02u:%02u.%03u]::",
             GetCurrentThreadId(),
             SystemTime.wHour,
             SystemTime.wMinute,
             SystemTime.wSecond,
             SystemTime.wMilliseconds);

    size_t iStringLength = 0;

    HRESULT hr = StringCbLength(szBuffer, BUFFER_SIZE, &iStringLength);

    if (FAILED(hr))
    {
        // either this code is wrong, or someone else in the process corrupted
        // our memory.
        return;
    }

    //
    // get the actual message
    //

    va_list vaArguments;

    va_start(vaArguments, pszFormat);

    size_t iBytesLeft = BUFFER_SIZE - iStringLength;

    //
    // not checking the return code of this function. even if it fails, we will
    // have a null-terminated string that we will be able to log.
    //

    StringCbVPrintf( &(szBuffer[iStringLength]), iBytesLeft, pszFormat, vaArguments);

    va_end(vaArguments);

    //
    // how big is the string now, and how many bytes do we have left?
    //

    hr = StringCbLength(szBuffer, BUFFER_SIZE, &iStringLength);

    if (FAILED(hr))
    {
        // either this code is wrong, or someone else in the process corrupted
        // our memory.
        return;
    }

    iBytesLeft = BUFFER_SIZE - iStringLength;

    //
    // append a carriage return to the string. ignore the result code, the
    // result string will be null-terminated no matter what.
    //

    StringCbCat(szBuffer, iBytesLeft, "\n");

    //
    // log the buffer
    //

    printf(szBuffer);
}

int __cdecl main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 2427 of file tapisend.cpp.

{

    LogMessage("main: started");

    //
    // validate arguments
    //

    if (argc != 4)
    {
        HelpScreen();

        LogMessage("main: invalid arguments, exiting.");

        return 1;
    }

    //
    // we want to handle ctrl+c and ctrl+break events so we can cleanup on exit
    // proceed even in case of failure
    //

    SetConsoleCtrlHandler( (PHANDLER_ROUTINE)CtrlHandler, TRUE);

    //
    // open the file, connect to the remote machine and stream the file over
    //

    HRESULT hr = StreamFile(argv[1], argv[2], argv[3]);

    //
    // exiting... we no longer want to handle ctrl+c and ctrl+break
    //

    SetConsoleCtrlHandler( (PHANDLER_ROUTINE) CtrlHandler, FALSE);

    //
    // was file streaming successful?
    //

    if (FAILED(hr))
    {
        LogError("main: Failed to stream file");

        return 1;
    }

    LogMessage("main: completed");

    return 0;

}

HRESULT ReadFileIntoTerminal | ( | IN CAVIFileReader * | pFileReader,
 |  | IN ITTerminal * | pPlaybackTerminal
 | ) |  |

Definition at line 1613 of file tapisend.cpp.

{

    HRESULT hr = E_FAIL;

    LogMessage("ReadFileIntoTerminal: started.");

    Sleep(20000);

    //
    // get terminal's IMediaStream interface
    //

    IMediaStream *pTerminalMediaStream = NULL;

    hr = pPlaybackTerminal->QueryInterface(IID_IMediaStream,
                                           (void**)&pTerminalMediaStream);

    if (FAILED(hr))
    {
        LogError("ReadFileIntoTerminal: "
                 "failed to QI terminal for IMediaStream");

        return hr;
    }

    //
    // create a queue (STL deque) that will hold all the samples that we ever
    // submitted to media streaming terminal
    //
    // we need this so when we are finished reading the file, we can go through
    // the list of all the samples that we have submitted and make sure mst
    // is finished processing them
    //
    // note that samples get reused, the same samples will be put in the queue
    // more than once. so the size of the queue will be proportional to the
    // size of the file being played. this might cause problems if
    // the file is big or the source of the samples is unlimited (live audio
    // feed). In this case, the logic can be modified to only enqueue each
    // sample once, by comparing against existing queue entries.
    //

    std::deque<IStreamSample*> SampleQ;

    //
    // count the number of samples that have been submitted
    //

    ULONG nSampleCount = 0;

    //
    // keep reading samples from file and sending them.
    // (until user requests exit, there is no more data, or failure)
    //

    while (!g_bExitRequested)
    {

        //
        // allocate a sample on the terminal's media stream
        //
        // Note: the call to AllocateSample() will block if we filled all the
        // samples with data, and there are no more samples for us to fill
        // (waiting for media streaming terminal to process samples we have
        // submitted). When MST is is done with at least one sample, the call
        // will return. This logic will ensure that MST always has work and is
        // never starved for samples.
        //

        IStreamSample *pStreamSample = NULL;

        hr = pTerminalMediaStream->AllocateSample(0, &pStreamSample);

        if (FAILED(hr))
        {
            LogError("ReadFileIntoTerminal: "
                     "failed to allocate a sample on terminal's stream");

            break;
        }

        //
        // get IMemoryData on the sample so we can get to the sample's memory
        // data
        //

        IMemoryData *pSampleMemoryData = NULL;

        hr = pStreamSample->QueryInterface(IID_IMemoryData,
                                           (void**)&pSampleMemoryData);

        if (FAILED(hr))
        {
            LogError("ReadFileIntoTerminal: failed to qi sample for IMemoryData");

            pStreamSample->Release();
            pStreamSample = NULL;

            break;

        }

        //
        // get to the sample's memory buffer
        //

        DWORD nBufferSize = 0;

        BYTE *pBuffer = NULL;

        hr = pSampleMemoryData->GetInfo(&nBufferSize, &pBuffer, NULL);

        if (FAILED(hr))
        {

            LogError("ReadFileIntoTerminal: "
                     "failed to get info on sample's memory");

            pStreamSample->Release();
            pStreamSample = NULL;

            pSampleMemoryData->Release();
            pSampleMemoryData = NULL;

            break;

        }

        //
        // read file into memory buffer provided by the sample
        //

        LONG nBytesRead = 0;

        hr = pFileReader->Read(pBuffer, nBufferSize, &nBytesRead);

        if (FAILED(hr))
        {
            LogError("ReadFileIntoTerminal: failed to read data from file");

            pStreamSample->Release();
            pStreamSample = NULL;

            pSampleMemoryData->Release();
            pSampleMemoryData = NULL;

            break;

        }
        else if (S_FALSE == hr)
        {
            //
            // no more data
            //

            LogMessage("ReadFileIntoTerminal: finished reading file");

            pStreamSample->Release();
            pStreamSample = NULL;

            pSampleMemoryData->Release();
            pSampleMemoryData = NULL;

            break;
        }

        //
        // tell the sample how many useful bytes are in the sample's buffer
        //

        hr = pSampleMemoryData->SetActual(nBytesRead);

        pSampleMemoryData->Release();
        pSampleMemoryData = NULL;

        if (FAILED(hr))
        {

            LogError("ReadFileIntoTerminal: failed to SetActual (%ld bytes) "
                     "on the sample.", nBytesRead);

            pStreamSample->Release();
            pStreamSample = NULL;

            break;

        }

        //
        // we are done with the sample. now let media streaming terminal
        // process it asynchronously. when the terminal is finished with
        // the sample, this sample will be returned to us from the call
        // to AllocateSample()
        //

        hr = pStreamSample->Update(SSUPDATE_ASYNC, NULL, NULL, 0);

        //
        // with some MSPs, starting the stream can be done asynchronously, so
        // there may be a delay between the time when terminal is selected
        // (or call connected) and the time when the stream becomes usable.
        //
        // attempting to use the stream before the stream is active would
        // result in the Update() returning error VFW_E_NOT_COMMITTED.
        //
        // Usually an application would not start using the stream until
        // it gets media event CME_STREAM_ACTIVE. This requires the app
        // to register a callback interface by calling
        // ITTAPI::RegisterCallNotifications. Refer to documentation and other
        // samples for more details on how this is done.
        //
        // To keep things simple, this sample doesn't do event processing.
        // To deal with the problem of using the stream before it becomes
        // active, we retry Update() until we succeed.
        //
        // Note that there is still a danger that the stream becomes
        // disconnected before we process the first sample, in which case
        // we will be stuck in a loop, which can be exited when the user
        // presses ctrl+break
        //

        while ( (hr == VFW_E_NOT_COMMITTED)
                && (0 == nSampleCount)
                && !g_bExitRequested )
        {
            LogMessage("ReadFileIntoTerminal: "
                       "Update returned VFW_E_NOT_COMMITTED. "
                       "Likely cause: stream not yet started. Retrying.");

            Sleep( 1000 );

            hr = pStreamSample->Update(SSUPDATE_ASYNC, NULL, NULL, 0);
        }

        if (FAILED(hr))
        {
            LogError("ReadFileIntoTerminal: failed to Update the sample");

            pStreamSample->Release();
            pStreamSample = NULL;

            break;

        }

        //
        // the sample was submitted successfully. update count
        //

        nSampleCount++;

        if (nSampleCount == 300)
        {

            LogError("ReadFileIntoTerminal: sleeping 10 seconds");

            Sleep(30000);

            LogError("ReadFileIntoTerminal: woke up");
        }

        //
        // keep the sample we have just submitted. on exit, we will wait
        // for it to be processed by mst
        //

        SampleQ.push_back(pStreamSample);

    } // file reading/sample-filling loop

    LogMessage("ReadFileIntoTerminal: processed %lu samples", nSampleCount);

    //
    // walk through the list of all the samples we have submitted and wait for
    // each sample to be done
    //

    while (!SampleQ.empty())
    {

        //
        // get and remove a sample from the queue
        //

        IStreamSample *pStreamSample = SampleQ.front();

        SampleQ.pop_front();

        //
        // wait for the Media Streaming Terminal to finish
        // processing the sample
        //

        pStreamSample->CompletionStatus(COMPSTAT_WAIT, INFINITE);

        //
        // ignore the error code -- release the sample in any case
        //

        pStreamSample->Release();
        pStreamSample = NULL;

    }

    LogMessage("ReadFileIntoTerminal: released all submitted samples");

    //
    // tell media streaming terminal's stream that there is no more data
    //

    pTerminalMediaStream->SendEndOfStream(0);

    //
    // ignore the error code
    //

    pTerminalMediaStream->Release();
    pTerminalMediaStream = NULL;

    //
    // if we disconnect the call right away, the call may be dropped before
    // receiver gets all the samples. An application should wait for
    // STREAM_INACTIVE media event before disconnecting the call.
    //
    // Since, for simplicity, we are not processing events in this sample,
    // wait several seconds to give the receiver a little time to complete
    // processing.
    //

    LogMessage("ReadFileIntoTerminal: Sleeping to give the receiver time "
               "to process everything we have sent.");

    Sleep(7500);

    LogMessage("ReadFileIntoTerminal: completed");

    return hr;
}

HRESULT SetAllocatorProperties ( IN ITTerminal * pTerminal )

Definition at line 1488 of file tapisend.cpp.

{

    //
    // different buffer sizes may produce different sound quality, depending
    // on the underlying transport that is being used.
    //
    // this function illustrates how an app can control the number and size of
    // buffers. A multiple of 30 ms (480 bytes at 16-bit 8 KHz PCM) is the most
    // appropriate sample size for IP (especailly G.723.1).
    //
    // However, small buffers can cause poor audio quality on some voice boards.
    //
    // If this method is not called, the allocator properties suggested by the
    // connecting filter will be used.
    //
    // Note: do not set allocator properties in the applications unless you are
    // sure that sound quality will not degrade as a result. Some MSPs can have
    // their own preferred allocator properties, and will not be able to
    // provide the best quality if the app sets its own properties, different
    // from what is preferred by the msp.
    //
    // Also note that ITAllocatorProperties::SetBufferSize allows the app to
    // specify preferred size of the buffer allocated to the application
    // without affecting terminal's allocator properties.
    //

    LogMessage("SetAllocatorProperties: starting.");

    HRESULT hr = E_FAIL;

    //
    // get ITAllocator properties interface on the terminal
    //

    ITAllocatorProperties *pITAllocatorProperties = NULL;

    hr = pTerminal->QueryInterface(IID_ITAllocatorProperties,
                                   (void **)&pITAllocatorProperties);

    if (FAILED(hr))
    {
        LogError("SetAllocatorProperties: "
                 "failed to QI terminal for ITAllocatorProperties");

        return hr;
    }

    //
    // configure allocator properties
    //

    ALLOCATOR_PROPERTIES AllocProps;

    AllocProps.cbBuffer   = 4800;
    AllocProps.cBuffers   = 5;
    AllocProps.cbAlign    = 1;
    AllocProps.cbPrefix   = 0;

    hr = pITAllocatorProperties->SetAllocatorProperties(&AllocProps);

    if (FAILED(hr))
    {
        LogError("SetAllocatorProperties: failed to set allocator properties. "
                 "hr = 0x%lx", hr);

        pITAllocatorProperties->Release();
        pITAllocatorProperties = NULL;

        return hr;
    }

    //
    // ask media streaming terminal to allocate buffers for us.
    // TRUE is the default, so strictly speaking, we didn't have to call
    // this method.
    //

    hr = pITAllocatorProperties->SetAllocateBuffers(TRUE);

    pITAllocatorProperties->Release();
    pITAllocatorProperties = NULL;

    if (FAILED(hr))
    {
        LogError("SetAllocatorProperties: failed to SetAllocateBuffers, "
                 "hr = 0x%lx", hr);

        return hr;
    }

    //
    // succeeded setting allocator properties
    //

    LogMessage("SetAllocatorProperties: completed");

    return S_OK;
}

HRESULT SetTerminalFormat | ( | IN ITTerminal * | pTerminal,
 |  | IN WAVEFORMATEX * | pWaveFormat
 | ) |  |

Definition at line 1360 of file tapisend.cpp.

{

    HRESULT hr = E_FAIL;

    //
    // log format requested
    //

    LogMessage("SetTerminalFormat: starting.");
    LogFormat(pWaveFormat);

    ITAMMediaFormat *pIMediaFormat = NULL;

    hr = pTerminal->QueryInterface(IID_ITAMMediaFormat,
                                   (void **)&pIMediaFormat);

    if (FAILED(hr))
    {

        LogError("SetTerminalFormat: Failed to set terminal format");

        return hr;
    }

    //
    // fill the media format structure
    //

    AM_MEDIA_TYPE MediaType;

    ZeroMemory(&MediaType, sizeof(AM_MEDIA_TYPE));

    MediaType.majortype            = MEDIATYPE_Audio;
    MediaType.subtype              = MEDIASUBTYPE_PCM;
    MediaType.bFixedSizeSamples    = TRUE;
    MediaType.bTemporalCompression = FALSE;
    MediaType.lSampleSize          = pWaveFormat->nBlockAlign;
    MediaType.formattype           = FORMAT_WaveFormatEx;
    MediaType.pUnk                 = NULL;

    MediaType.cbFormat             = sizeof(WAVEFORMATEX) +
                                     pWaveFormat->cbSize;

    MediaType.pbFormat             = (BYTE*)pWaveFormat;

    //
    // set the requested format
    //

    hr = pIMediaFormat->put_MediaFormat(&MediaType);

    if (FAILED(hr))
    {

        //
        // try to see what format the terminal wanted
        //

        LogError("SetTerminalFormat: failed to set format");

        AM_MEDIA_TYPE *pMediaFormat = NULL;

        HRESULT hr2 = pIMediaFormat->get_MediaFormat(&pMediaFormat);

        if (SUCCEEDED(hr2))
        {

            if (pMediaFormat->formattype == FORMAT_WaveFormatEx)
            {

                //
                // log the terminal's format
                //

                LogError("SetTerminalFormat: terminal's format is");
                LogFormat((WAVEFORMATEX*) pMediaFormat->pbFormat);

            }
            else
            {

                LogError("SetTerminalFormat: "
                         "terminal's format is not WAVEFORMATEX");
            }

            //
            // note: we are responsible for deallocating the format returned by
            // get_MediaFormat
            //

            DeleteMediaType(pMediaFormat);

        } //  succeeded to get terminal's format
        else
        {

            LogError("SetTerminalFormat: failed to get terminal's format");

        }

    } // failed to set format

    pIMediaFormat->Release();
    pIMediaFormat = NULL;

    LogMessage("SetTerminalFormat: completed");

    return hr;
}

void ShutdownTAPI ( )

Definition at line 374 of file tapisend.cpp.

{

    LogMessage("ShutdownTAPI: started");

    if (NULL != g_pTapi)
    {

        g_pTapi->Shutdown();

        g_pTapi->Release();
        g_pTapi = NULL;
    }

    LogMessage("ShutdownTAPI: completed");

}

HRESULT StreamFile | ( | IN char * | szFileName,
 |  | IN char * | szAddressString,
 |  | IN char * | szAddressType
 | ) |  |

Definition at line 2143 of file tapisend.cpp.

{

    HRESULT hr = E_FAIL;

    LogMessage("StreamFile: file [%s] address [%s] address type [%s]",
                szFileName, szAddressString, szAddressType);

    //
    // check if the file is valid
    //

    if (!IsValidAudioFile(szFileName))
    {

        LogError("StreamFile: file not valid [%s]", szFileName);

        return E_FAIL;
    }

    //
    // initialize COM libraries -- used by TAPI
    //

    hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);

    if ( FAILED(hr))
    {
        LogError("StreamFile: Failed to CoInitialize");

        return hr;
    }

    //
    // create and initialize TAPI
    //

    hr = InitializeTAPI();

    if (SUCCEEDED(hr))
    {

        //
        // try to make a call
        //

        ITBasicCallControl *pCall = NULL;

        hr = Call(szAddressString, szAddressType, &pCall);

        if (SUCCEEDED(hr))
        {

            //
            // construct the file reader object
            // to be used to read file's data
            //
            // note: If you want to play more than one file in one call, reuse
            // the same terminal for the duration of the call. Under
            // Windows 2000, all data submitted via the Media Streaming Terminal
            // during the call must have the same format. Changing a Media
            // Streaming Terminal's format after it is initially configured will
            // always return an error code, regardless of the OS version.
            // Unselecting a Media Streaming Terminal and creating and selecting
            // a new terminal on the same stream from the same call with a
            // different format is not supported on Windows 2000. This may,
            // however, be supported on other versions of Windows. For the latest
            // information on which versions of Windows support this, please
            // refer to the latest Platform SDK documentation.
            //

            CAVIFileReader FileReader;

            hr =  FileReader.Initialize(szFileName);

            //
            // get the file's format. remember to deallocate when done.
            //

            WAVEFORMATEX *pWaveFormat = NULL;

            if (SUCCEEDED(hr) &&
                SUCCEEDED(hr = FileReader.GetFormat(&pWaveFormat)))
            {

                //
                // create and configure a media streaming terminal and select it on this call
                //
                //

                ITTerminal *pPlaybackTerminal = NULL;

                hr = CreateAndSelectTerminal(pCall, pWaveFormat, &pPlaybackTerminal);

                if (SUCCEEDED(hr))
                {

                    //
                    // use the terminal to send the file
                    //

                    hr = ReadFileIntoTerminal(&FileReader, pPlaybackTerminal);

                    if (FAILED(hr))
                    {
                        LogError("StreamFile: failed to ReadFileIntoTerminal");
                    }
                    else
                    {
                        LogError("StreamFile: succeeded");
                    }

                    //
                    // release the terminal, we no longer need it
                    //

                    pPlaybackTerminal->Release();
                    pPlaybackTerminal = NULL;

                }
                else
                {
                    LogError("StreamFile: failed to create and select terminal");

                }

                //
                // no longer need wave format. free memory.
                //

                FreeMemory(pWaveFormat);
                pWaveFormat = NULL;

            }  // got file format
            else
            {
                LogError("StreamFile: failed to get file's format");

            }

            //
            // there is not much we can do if disconnect fails,
            // so ignore its return code
            //

            pCall->Disconnect(DC_NORMAL);

            pCall->Release();
            pCall = NULL;

        }   // call connected
        else
        {

            LogError("StreamFile: failed to connect to %s", szAddressString);

        }

        //
        // tapi has been initialized. shutdown now.
        //

        ShutdownTAPI();

    } // initialized tapi
    else
    {

        LogError("StreamFile: Failed to initialize TAPI");

    }

    CoUninitialize();

    return hr;
}

Variable Documentation

BOOL g_bExitRequested = FALSE

Definition at line 38 of file tapisend.cpp.

long g_nAddressTypeConstants[]
Initial value:

            { LINEADDRESSTYPE_PHONENUMBER,
              LINEADDRESSTYPE_SDP,
              LINEADDRESSTYPE_EMAILNAME,
              LINEADDRESSTYPE_DOMAINNAME,
              LINEADDRESSTYPE_IPADDRESS }

Definition at line 49 of file tapisend.cpp.

const UINT g_nNumberOfAddressTypes
Initial value:

                    sizeof(g_szAddressTypes)/sizeof(g_szAddressTypes[0])

Definition at line 60 of file tapisend.cpp.

ITTAPI* g_pTapi = NULL

Definition at line 31 of file tapisend.cpp.

char* g_szAddressTypes[]
Initial value:

            {"PHONENUMBER", "CONFERENCE", "EMAIL", "MACHINE", "IP"}

Definition at line 45 of file tapisend.cpp.

Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/DCO_DimmerService/DeviceDll.cpp File Reference

  • NetDS
  • upnp
  • DCO_DimmerService
Functions | Variables

DeviceDll.cpp File Reference

#include <stdio.h>
#include <atlbase.h>
#include "DeviceDll.h"
#include <atlcom.h>
#include <objbase.h>
#include <upnphost.h>
#include "resource.h"
#include "dimmerdevice.h"
#include "DimmerService.h"
#include "DimmerDeviceDCO.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 59 of file DeviceDll.cpp.

{
   return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 70 of file DeviceDll.cpp.

{
   return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 40 of file DeviceDll.cpp.

{
   if (dwReason == DLL_PROCESS_ATTACH)
   {
      _Module.Init(ObjectMap, hInstance);
      DisableThreadLibraryCalls(hInstance);
   }
   else
      if (dwReason == DLL_PROCESS_DETACH)
         _Module.Term();

   return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 80 of file DeviceDll.cpp.

{
   // registers object, typelib and all interfaces in typelib
   return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 91 of file DeviceDll.cpp.

{
   return _Module.UnregisterServer(FALSE);
}

Variable Documentation

CComModule _Module

Definition at line 20 of file DeviceDll.cpp.

Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/DCO_DimmerService/DeviceDll.h File Reference

  • NetDS
  • upnp
  • DCO_DimmerService
Variables

DeviceDll.h File Reference

Go to the source code of this file.

Variables

EXTERN_C CComModule _Module

Variable Documentation

EXTERN_C CComModule _Module

Definition at line 6 of file DeviceDll.h.

Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/DCO_DimmerService/DimmerDevice.idl File Reference

  • NetDS
  • upnp
  • DCO_DimmerService
Classes | Namespaces | Typedefs | Enumerations | Functions

DimmerDevice.idl File Reference

Go to the source code of this file.

Classes

interface | SDKDimmerServiceLib::IUPnPService_DimmingService_SCPD
class | SDKDimmerServiceLib::UPNPSampleDimmerDevice

Namespaces

namespace | SDKDimmerServiceLib

Typedefs

typedef enum
SDKDimmerServiceLib::DIMMINGSERVICE_SCPD_DISPIDS 		SDKDimmerServiceLib::DIMMINGSERVICE_SCPD_DISPIDS

Enumerations

enum SDKDimmerServiceLib::DIMMINGSERVICE_SCPD_DISPIDS {
SDKDimmerServiceLib::DISPID_POWER = 1, SDKDimmerServiceLib::DISPID_DIMLEVEL, SDKDimmerServiceLib::DISPID_POWERON, SDKDimmerServiceLib::DISPID_POWEROFF,
SDKDimmerServiceLib::DISPID_GETPOWERVALUE, SDKDimmerServiceLib::DISPID_SETDIMLEVEL, SDKDimmerServiceLib::DISPID_GETDIMLEVEL, SDKDimmerServiceLib::DISPID_GETCONFIGDETAILS
}

Functions

SDKDimmerServiceLib::importlib ("stdole32.tlb")
Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/DCO_DimmerService/DimmerDeviceDCO.cpp File Reference

  • NetDS
  • upnp
  • DCO_DimmerService

DimmerDeviceDCO.cpp File Reference

#include <atlbase.h>
#include "resource.h"
#include "DeviceDll.h"
#include <atlcom.h>
#include <upnphost.h>
#include <initguid.h>
#include "dimmerdevice.h"
#include "dimmerdevice_i.c"
#include "DimmerService.h"
#include "DimmerDeviceDCO.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/DCO_DimmerService/DimmerDeviceDCO.h File Reference

  • NetDS
  • upnp
  • DCO_DimmerService
Classes | Defines

DimmerDeviceDCO.h File Reference

Go to the source code of this file.

Classes

class | UPNPDimmerDevice

Defines

#define | MAX_NOSERVICE_PER_DEVICE 1
#define | NUM_TEMPLATE_UDNS_IN_DESCDOC 1

Define Documentation

#define MAX_NOSERVICE_PER_DEVICE 1

Definition at line 19 of file DimmerDeviceDCO.h.

#define NUM_TEMPLATE_UDNS_IN_DESCDOC 1

Definition at line 16 of file DimmerDeviceDCO.h.

Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/DCO_DimmerService/DimmerService.cpp File Reference

  • NetDS
  • upnp
  • DCO_DimmerService

DimmerService.cpp File Reference

#include <stdio.h>
#include <windows.h>
#include <tchar.h>
#include <objbase.h>
#include <atlbase.h>
#include "DeviceDll.h"
#include <atlcom.h>
#include <initguid.h>
#include <upnphost.h>
#include "resource.h"
#include "dimmerdevice.h"
#include "DimmerService.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/DCO_DimmerService/DimmerService.h File Reference

  • NetDS
  • upnp
  • DCO_DimmerService
Classes

DimmerService.h File Reference

Go to the source code of this file.

Classes

class UPNPDimmerService
Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/DCO_DimmerService/resource.h File Reference

  • NetDS
  • upnp
  • DCO_DimmerService
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define IDR_UPNPDIMMERDEVICE 100

Define Documentation

#define IDR_UPNPDIMMERDEVICE 100

Definition at line 15 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/FunctionDelegator/cbklib.idl File Reference

  • NetDS
  • upnp
  • FunctionDelegator
Classes | Namespaces | Functions

cbklib.idl File Reference

Go to the source code of this file.

Classes

interface | CallbackIUnknownLib::DeviceFinderCallBackInterface
interface | CallbackIUnknownLib::ServiceCallBackInterface

Namespaces

namespace | CallbackIUnknownLib

Functions

CallbackIUnknownLib::importlib ("stdole2.tlb")
Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/GenericUCP/CPP/deviceprop.cpp File Reference

  • NetDS
  • upnp
  • GenericUCP
  • CPP
Defines

deviceprop.cpp File Reference

#include "stdafx.h"
#include "genericucp.h"
#include "DeviceProp.h"

Go to the source code of this file.

Defines

#define DATA_BUFSIZE 2048

Define Documentation

#define DATA_BUFSIZE 2048

Definition at line 21 of file deviceprop.cpp.

Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/GenericUCP/CPP/deviceprop.h File Reference

  • NetDS
  • upnp
  • GenericUCP
  • CPP
Classes

deviceprop.h File Reference

#include "util.h"
#include "genericucpdlg.h"
#include "util.h"

Go to the source code of this file.

Classes

class CDeviceProp
Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/GenericUCP/CPP/genericucp.cpp File Reference

  • NetDS
  • upnp
  • GenericUCP
  • CPP
Variables

genericucp.cpp File Reference

#include "stdafx.h"
#include "GenericUCP.h"
#include "GenericUCPDlg.h"

Go to the source code of this file.

Variables

CComModule _Module
CGenericUCPApp theApp

Variable Documentation

CComModule _Module

Definition at line 22 of file genericucp.cpp.

CGenericUCPApp theApp

Definition at line 43 of file genericucp.cpp.

Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/GenericUCP/CPP/genericucp.h File Reference

  • NetDS
  • upnp
  • GenericUCP
  • CPP
Classes

genericucp.h File Reference

#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Classes

class CGenericUCPApp
Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/GenericUCP/CPP/GenericUCPDlg.cpp File Reference

  • NetDS
  • upnp
  • GenericUCP
  • CPP
Classes

GenericUCPDlg.cpp File Reference

#include "stdafx.h"
#include "GenericUCP.h"
#include "GenericUCPDlg.h"
#include "deviceprop.h"
#include "util.h"

Go to the source code of this file.

Classes

class CAboutDlg
Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/GenericUCP/CPP/genericucpdlg.h File Reference

  • NetDS
  • upnp
  • GenericUCP
  • CPP
Classes | Defines

genericucpdlg.h File Reference

#include <objbase.h>
#include <upnp.h>

Go to the source code of this file.

Classes

class | CDeviceFinderCallback
class | CGenericUCPDlg
class | CServiceCallback

Defines

#define | DATA_BUFSIZE 2048

Define Documentation

#define DATA_BUFSIZE 2048

Definition at line 20 of file genericucpdlg.h.

Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/GenericUCP/CPP/resource.h File Reference

  • NetDS
  • upnp
  • GenericUCP
  • CPP
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_ACTIONINARGUMENT 1041
#define | IDC_ACTIONNAME 1045
#define | IDC_ACTIONOUTARGUMENT 1040
#define | IDC_ASYNCFIND 1044
#define | IDC_CLOSE 1033
#define | IDC_COMBODEVICE 1002
#define | IDC_COMBOFIND 1001
#define | IDC_COMBOSERVICE 1003
#define | IDC_DEVPROP 1037
#define | IDC_DISCOVERY 1038
#define | IDC_EDITDEVICETYPE 1057
#define | IDC_EDITFRIENDLYNAME 1058
#define | IDC_EDITMANUFACTURER 1055
#define | IDC_EDITMANUFACTURERURL 1054
#define | IDC_EDITMODELDESCRIPTION 1051
#define | IDC_EDITMODELNAME 1053
#define | IDC_EDITMODELNUMBER 1052
#define | IDC_EDITMODELURL 1050
#define | IDC_EDITPRESENTATIONURL 1056
#define | IDC_EDITSERIALNUMBER 1048
#define | IDC_EDITUDN 1059
#define | IDC_EDITUPC 1049
#define | IDC_EVENTS 1047
#define | IDC_FINDBYTYPE 1042
#define | IDC_FINDBYUDN 1043
#define | IDC_INVOKEACTION 1032
#define | IDC_OK 1060
#define | IDC_PRESENTATION 1036
#define | IDC_QUERYVARIABLE 1034
#define | IDC_SCPDURL 1039
#define | IDC_STATUS 1046
#define | IDC_VARIABLENAME 1048
#define | IDC_VIEWSCPD 1035
#define | IDD_ABOUTBOX 100
#define | IDD_DEVPROP_DIALOG 139
#define | IDD_GENERICUCP_DIALOG 102
#define | IDM_ABOUTBOX 0x0010
#define | IDR_MAINFRAME 128
#define | IDR_MENUGC 130
#define | IDS_ABOUTBOX 101

Define Documentation

#define IDC_ACTIONINARGUMENT 1041

Definition at line 30 of file resource.h.

#define IDC_ACTIONNAME 1045

Definition at line 34 of file resource.h.

#define IDC_ACTIONOUTARGUMENT 1040

Definition at line 29 of file resource.h.

#define IDC_ASYNCFIND 1044

Definition at line 33 of file resource.h.

#define IDC_CLOSE 1033

Definition at line 22 of file resource.h.

#define IDC_COMBODEVICE 1002

Definition at line 19 of file resource.h.

#define IDC_COMBOFIND 1001

Definition at line 18 of file resource.h.

#define IDC_COMBOSERVICE 1003

Definition at line 20 of file resource.h.

#define IDC_DEVPROP 1037

Definition at line 26 of file resource.h.

#define IDC_DISCOVERY 1038

Definition at line 27 of file resource.h.

#define IDC_EDITDEVICETYPE 1057

Definition at line 47 of file resource.h.

#define IDC_EDITFRIENDLYNAME 1058

Definition at line 48 of file resource.h.

#define IDC_EDITMANUFACTURER 1055

Definition at line 45 of file resource.h.

#define IDC_EDITMANUFACTURERURL 1054

Definition at line 44 of file resource.h.

#define IDC_EDITMODELDESCRIPTION 1051

Definition at line 41 of file resource.h.

#define IDC_EDITMODELNAME 1053

Definition at line 43 of file resource.h.

#define IDC_EDITMODELNUMBER 1052

Definition at line 42 of file resource.h.

#define IDC_EDITMODELURL 1050

Definition at line 40 of file resource.h.

#define IDC_EDITPRESENTATIONURL 1056

Definition at line 46 of file resource.h.

#define IDC_EDITSERIALNUMBER 1048

Definition at line 37 of file resource.h.

#define IDC_EDITUDN 1059

Definition at line 49 of file resource.h.

#define IDC_EDITUPC 1049

Definition at line 39 of file resource.h.

#define IDC_EVENTS 1047

Definition at line 36 of file resource.h.

#define IDC_FINDBYTYPE 1042

Definition at line 31 of file resource.h.

#define IDC_FINDBYUDN 1043

Definition at line 32 of file resource.h.

#define IDC_INVOKEACTION 1032

Definition at line 21 of file resource.h.

#define IDC_OK 1060

Definition at line 50 of file resource.h.

#define IDC_PRESENTATION 1036

Definition at line 25 of file resource.h.

#define IDC_QUERYVARIABLE 1034

Definition at line 23 of file resource.h.

#define IDC_SCPDURL 1039

Definition at line 28 of file resource.h.

#define IDC_STATUS 1046

Definition at line 35 of file resource.h.

#define IDC_VARIABLENAME 1048

Definition at line 38 of file resource.h.

#define IDC_VIEWSCPD 1035

Definition at line 24 of file resource.h.

#define IDD_ABOUTBOX 100

Definition at line 12 of file resource.h.

#define IDD_DEVPROP_DIALOG 139

Definition at line 17 of file resource.h.

#define IDD_GENERICUCP_DIALOG 102

Definition at line 14 of file resource.h.

#define IDM_ABOUTBOX 0x0010

Definition at line 11 of file resource.h.

#define IDR_MAINFRAME 128

Definition at line 15 of file resource.h.

#define IDR_MENUGC 130

Definition at line 16 of file resource.h.

#define IDS_ABOUTBOX 101

Definition at line 13 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/GenericUCP/CPP/stdafx.cpp File Reference

  • NetDS
  • upnp
  • GenericUCP
  • CPP

stdafx.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/GenericUCP/CPP/stdafx.h File Reference

  • NetDS
  • upnp
  • GenericUCP
  • CPP
Defines | Variables

stdafx.h File Reference

#include <afxwin.h>
#include <afxext.h>
#include <afxdisp.h>
#include <afxdtctl.h>
#include <afxcoll.h>
#include <afxtempl.h>
#include <afxcmn.h>
#include <winsock2.h>
#include <windows.h>
#include <upnp.h>
#include <atldef.h>
#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Defines

#define | VC_EXTRALEAN

Variables

CComModule | _Module

Define Documentation

#define VC_EXTRALEAN

Definition at line 19 of file stdafx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/GenericUCP/CPP/util.cpp File Reference

  • NetDS
  • upnp
  • GenericUCP
  • CPP
Functions

util.cpp File Reference

#include "stdafx.h"
#include "Resource.h"
#include "util.h"
#include <upnp.h>

Go to the source code of this file.

Functions

HRESULT | HrCreateArgVariants (DWORD dwArgs, VARIANT ***pppVars)
HRESULT | HrCreateSafeArray (VARTYPE vt, int nArgs, SAFEARRAY **ppsa)
HRESULT | HrDestroyArgVariants (DWORD dwArgs, VARIANT ***pppVars)
HRESULT | HrGetSafeArrayBounds (SAFEARRAY *psa, long *plLBound, long *plUBound)
HRESULT | HrGetVariantElement (SAFEARRAY *psa, int lPosition, VARIANT *pvar)
void | PrintErrorText (HRESULT hr)
void | ReleaseObj (IUnknown *pInterface)
void | SafeStrCopy (TCHAR *src, TCHAR *dst, size_t srcBufLen)
void | VariantSetArray (SAFEARRAY *psa, VARIANT &va)
void | VariantSetVar (VARIANT *pvarToSet, VARIANT &va)

Function Documentation

HRESULT HrCreateArgVariants | ( | DWORD | dwArgs,
 |  | VARIANT *** | pppVars
 | ) |  |

Definition at line 292 of file util.cpp.

{
    HRESULT             hr = S_OK;
    DWORD               i = 0;

  if(0 == dwArgs){
        *pppVars = NULL;
        return hr;
    }
    *pppVars = new VARIANT* [dwArgs];
    if(NULL == *pppVars){
    return E_OUTOFMEMORY;
    }
  ZeroMemory(*pppVars, dwArgs*sizeof(VARIANT *));

  for(i = 0; i < dwArgs; i++){
        (*pppVars)[i] = new VARIANT;
        if(NULL == (*pppVars)[i])
        {
            hr = E_OUTOFMEMORY;
            goto error;
        }
        VariantInit((*pppVars)[i]);
    }

    goto exit;

error:
    for(i = 0; i < dwArgs; i++)
    {
        if( NULL != (*pppVars)[i] )
        {
            delete ((*pppVars)[i]);
            (*pppVars)[i] = NULL;
        }
    }
    delete [] *pppVars;
    *pppVars = NULL;

exit:
    return hr;

}

HRESULT HrCreateSafeArray | ( | VARTYPE | vt,
 |  | int | nArgs,
 |  | SAFEARRAY ** | ppsa
 | ) |  |

Definition at line 253 of file util.cpp.

{
    SAFEARRAYBOUND    aDim[1];
    int               nEmpty = 0;

  if(0 == nArgs){
        aDim[0].lLbound = 0;
        aDim[0].cElements = 0;
    }
    else{
        aDim[0].lLbound = 1;
        aDim[0].cElements = nArgs;
    }

    *ppsa = SafeArrayCreate(vt, 1, aDim);
    if(NULL == *ppsa){
        return E_OUTOFMEMORY;
    }

    return S_OK;
}

HRESULT HrDestroyArgVariants | ( | DWORD | dwArgs,
 |  | VARIANT *** | pppVars
 | ) |  |

Definition at line 354 of file util.cpp.

{
    int                 nEmpty = 0;
    HRESULT             hr = S_OK;
    VARIANT             *pVar = NULL;

  ASSERT(pppVars && *pppVars);
    if(0 == dwArgs)
    {
        return hr;
    }

    for(DWORD i = 0; i < dwArgs; i++)
    {
        pVar = (*pppVars)[i];
        if(NULL != pVar)
        {
            VariantClear(pVar);
            delete pVar;
            pVar = NULL;;
        }
    }

    delete [] *pppVars;
    *pppVars = NULL;

    return hr;
}

HRESULT HrGetSafeArrayBounds | ( | SAFEARRAY * | psa,
 |  | long * | plLBound,
 |  | long * | plUBound
 | ) |  |

Definition at line 448 of file util.cpp.

{
    HRESULT hr = S_OK;

    if(NULL == psa)
    {
        return E_POINTER;
    }

    hr = SafeArrayGetLBound(psa, 1, plLBound);
    if(FAILED(hr))
    {
        return hr;
    }
    hr = SafeArrayGetUBound(psa, 1, plUBound);
    return hr;
}

HRESULT HrGetVariantElement | ( | SAFEARRAY * | psa,
 |  | int | lPosition,
 |  | VARIANT * | pvar
 | ) |  |

Definition at line 484 of file util.cpp.

{
    HRESULT hr = S_OK;
    long    alPos[1];

    if(NULL == psa)
    {
        return E_POINTER;
    }

    alPos[0] = lPosition;

    hr = SafeArrayGetElement(psa,
                             alPos,
                             pvar);
    return hr;
}

void PrintErrorText ( HRESULT hr )

Definition at line 50 of file util.cpp.

                               {

  // First check whether it is a UPnP error
        DWORD dwRet = 0;
  TCHAR tszErrorString[1024];
  switch(hr){
    // All the upnp error codes are from upnp.h
    case UPNP_E_ROOT_ELEMENT_EXPECTED:
      SafeStrCopy(
                            tszErrorString,
                            "Root Element Expected",
                            1024
                            );
      break;
    case UPNP_E_DEVICE_ELEMENT_EXPECTED:
      SafeStrCopy(
                            tszErrorString,
                            "Device Element Expected",
                            1024
                            );
      break;
    case UPNP_E_SERVICE_ELEMENT_EXPECTED:
      SafeStrCopy(
                            tszErrorString,
                            "Service Element Expected",
                            1024
                            );
      break;
    case UPNP_E_SERVICE_NODE_INCOMPLETE:
      SafeStrCopy(
                            tszErrorString,
                            "Service Node Incomplete",
                            1024
                            );
      break;
    case UPNP_E_DEVICE_NODE_INCOMPLETE:
      SafeStrCopy(
                            tszErrorString,
                            "Device Node Incomplete",
                            1024
                            );
      break;
    case UPNP_E_ICON_ELEMENT_EXPECTED:
      SafeStrCopy(
                            tszErrorString,
                            "Icon Element Expected",
                            1024
                            );
      break;
    case UPNP_E_ICON_NODE_INCOMPLETE:
      SafeStrCopy(
                            tszErrorString,
                            "Icon Node Incomplete",
                            1024
                            );
      break;
    case UPNP_E_INVALID_ACTION:
      SafeStrCopy(
                           tszErrorString,
                           "Invalid Action",
                           1024
                           );
      break;
    case UPNP_E_INVALID_ARGUMENTS:
      SafeStrCopy(
                           tszErrorString,
                           "Invalid Arguments",
                           1024
                           );
      break;
    case UPNP_E_OUT_OF_SYNC:
      SafeStrCopy(
                            tszErrorString,
                            "Out of Sync",
                            1024
                            );
      break;
    case UPNP_E_ACTION_REQUEST_FAILED:
      SafeStrCopy(
                            tszErrorString,
                            "Action Request Failed",
                            1024
                            );
      break;
    case UPNP_E_TRANSPORT_ERROR:
      SafeStrCopy(
                            tszErrorString,
                            "Transport Error",
                            1024
                            );
      break;
    case UPNP_E_VARIABLE_VALUE_UNKNOWN:
      SafeStrCopy(
                            tszErrorString,
                            "Variable Value Unknown",
                            1024
                            );
      break;
    case UPNP_E_INVALID_VARIABLE:
      SafeStrCopy(
                            tszErrorString,
                            "Invalid Variable",
                            1024
                            );
      break;
    case UPNP_E_DEVICE_ERROR:
      SafeStrCopy(
                            tszErrorString,
                            "Device Error",
                           1024
                            );
      break;
    case UPNP_E_PROTOCOL_ERROR:
      SafeStrCopy(
                            tszErrorString,
                            "Protocol Error",
                            1024
                            );
      break;
    case UPNP_E_ERROR_PROCESSING_RESPONSE:
      SafeStrCopy(
                            tszErrorString,
                            "Error Processing Response",
                            1024
                            );
      break;
    case UPNP_E_DEVICE_TIMEOUT:
      SafeStrCopy(
                            tszErrorString,
                            "Device Timeout",
                            1024
                            );
      break;
    case UPNP_E_INVALID_DOCUMENT:
      SafeStrCopy(
                            tszErrorString,
                            "Invalid Document",
                            1024
                            );
      break;
    case UPNP_E_EVENT_SUBSCRIPTION_FAILED:
      SafeStrCopy(
                            tszErrorString,
                            "Event Subscription Failed",
                            1024
                            );
      break;
    default:
                   if ((hr>=UPNP_E_ACTION_SPECIFIC_BASE) &&
                       (hr <= UPNP_E_ACTION_SPECIFIC_MAX))
                   {
      SafeStrCopy(
                            tszErrorString,
                            "Action Specific Error",
                            1024
                            );
      break;
       }
       LPVOID lpMsgBuf = NULL;
       dwRet = FormatMessage(
                            FORMAT_MESSAGE_ALLOCATE_BUFFER |
                            FORMAT_MESSAGE_FROM_SYSTEM |
                            FORMAT_MESSAGE_IGNORE_INSERTS,
                            NULL,
                            GetLastError(),
                            MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
                            (LPTSTR) &lpMsgBuf,
                            0,
                            NULL
                            );

                        if ( dwRet != 0 )
                        {
                            // Display the string.
                            MessageBox( NULL, (LPCTSTR)lpMsgBuf, "Error", MB_OK );

                            // Free the buffer.
                            LocalFree( lpMsgBuf );
                        }

      return;
  }
  MessageBox( NULL, (LPCTSTR)tszErrorString, "Error", MB_OK );
}

void ReleaseObj ( IUnknown * pInterface )

Definition at line 28 of file util.cpp.

                                     {
  if(pInterface){
    pInterface->Release();
  }
}

void SafeStrCopy | ( | TCHAR * | src,
 |  | TCHAR * | dst,
 |  | size_t | srcBufLen
 | ) |  |

Definition at line 521 of file util.cpp.

{
   ASSERT(src != NULL);
   ASSERT(dst != NULL);
   ASSERT(srcBufLen != 0);

   _tcsncpy(src, dst, (srcBufLen - 1));

   // Put a NULL terminator at the end of the buffer. tcsncpy will not NULL
   // terminate the string if the dst length is greater than the size
   // specified.
   src[srcBufLen - 1] = NULL;

}

void VariantSetArray | ( | SAFEARRAY * | psa,
 |  | VARIANT & | va
 | ) |  |

Definition at line 423 of file util.cpp.

{
    VariantInit(&va);
    va.vt = VT_VARIANT | VT_ARRAY | VT_BYREF;
    va.pparray = &psa;
}

void VariantSetVar | ( | VARIANT * | pvarToSet,
 |  | VARIANT & | va
 | ) |  |

Definition at line 400 of file util.cpp.

{
    VariantInit(&va);
    va.vt = VT_VARIANT | VT_BYREF;
    va.pvarVal = pvarToSet;
}

Generated on Wed Nov 13 2024 16:53:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/GenericUCP/CPP/util.h File Reference

  • NetDS
  • upnp
  • GenericUCP
  • CPP
Functions

util.h File Reference

Go to the source code of this file.

Functions

HRESULT | HrCreateArgVariants (DWORD dwArgs, VARIANT ***pppVars)
HRESULT | HrCreateSafeArray (VARTYPE vt, int nArgs, SAFEARRAY **ppsa)
HRESULT | HrDestroyArgVariants (DWORD dwArgs, VARIANT ***pppVars)
HRESULT | HrGetSafeArrayBounds (SAFEARRAY *psa, long *plLBound, long *plUBound)
HRESULT | HrGetVariantElement (SAFEARRAY *psa, int lPosition, VARIANT *pvar)
void | PrintErrorText (HRESULT hr)
void | ReleaseObj (IUnknown *pInterface)
void | SafeStrCopy (TCHAR *src, TCHAR *dst, size_t srcBufLen)
void | VariantSetArray (SAFEARRAY *psa, VARIANT &va)
void | VariantSetVar (VARIANT *pvarToSet, VARIANT &va)

Function Documentation

HRESULT HrCreateArgVariants | ( | DWORD | dwArgs,
 |  | VARIANT *** | pppVars
 | ) |  |

Definition at line 292 of file util.cpp.

{
    HRESULT             hr = S_OK;
    DWORD               i = 0;

  if(0 == dwArgs){
        *pppVars = NULL;
        return hr;
    }
    *pppVars = new VARIANT* [dwArgs];
    if(NULL == *pppVars){
    return E_OUTOFMEMORY;
    }
  ZeroMemory(*pppVars, dwArgs*sizeof(VARIANT *));

  for(i = 0; i < dwArgs; i++){
        (*pppVars)[i] = new VARIANT;
        if(NULL == (*pppVars)[i])
        {
            hr = E_OUTOFMEMORY;
            goto error;
        }
        VariantInit((*pppVars)[i]);
    }

    goto exit;

error:
    for(i = 0; i < dwArgs; i++)
    {
        if( NULL != (*pppVars)[i] )
        {
            delete ((*pppVars)[i]);
            (*pppVars)[i] = NULL;
        }
    }
    delete [] *pppVars;
    *pppVars = NULL;

exit:
    return hr;

}

HRESULT HrCreateSafeArray | ( | VARTYPE | vt,
 |  | int | nArgs,
 |  | SAFEARRAY ** | ppsa
 | ) |  |

Definition at line 253 of file util.cpp.

{
    SAFEARRAYBOUND    aDim[1];
    int               nEmpty = 0;

  if(0 == nArgs){
        aDim[0].lLbound = 0;
        aDim[0].cElements = 0;
    }
    else{
        aDim[0].lLbound = 1;
        aDim[0].cElements = nArgs;
    }

    *ppsa = SafeArrayCreate(vt, 1, aDim);
    if(NULL == *ppsa){
        return E_OUTOFMEMORY;
    }

    return S_OK;
}

HRESULT HrDestroyArgVariants | ( | DWORD | dwArgs,
 |  | VARIANT *** | pppVars
 | ) |  |

Definition at line 354 of file util.cpp.

{
    int                 nEmpty = 0;
    HRESULT             hr = S_OK;
    VARIANT             *pVar = NULL;

  ASSERT(pppVars && *pppVars);
    if(0 == dwArgs)
    {
        return hr;
    }

    for(DWORD i = 0; i < dwArgs; i++)
    {
        pVar = (*pppVars)[i];
        if(NULL != pVar)
        {
            VariantClear(pVar);
            delete pVar;
            pVar = NULL;;
        }
    }

    delete [] *pppVars;
    *pppVars = NULL;

    return hr;
}

HRESULT HrGetSafeArrayBounds | ( | SAFEARRAY * | psa,
 |  | long * | plLBound,
 |  | long * | plUBound
 | ) |  |

Definition at line 448 of file util.cpp.

{
    HRESULT hr = S_OK;

    if(NULL == psa)
    {
        return E_POINTER;
    }

    hr = SafeArrayGetLBound(psa, 1, plLBound);
    if(FAILED(hr))
    {
        return hr;
    }
    hr = SafeArrayGetUBound(psa, 1, plUBound);
    return hr;
}

HRESULT HrGetVariantElement | ( | SAFEARRAY * | psa,
 |  | int | lPosition,
 |  | VARIANT * | pvar
 | ) |  |

Definition at line 484 of file util.cpp.

{
    HRESULT hr = S_OK;
    long    alPos[1];

    if(NULL == psa)
    {
        return E_POINTER;
    }

    alPos[0] = lPosition;

    hr = SafeArrayGetElement(psa,
                             alPos,
                             pvar);
    return hr;
}

void PrintErrorText ( HRESULT hr )

Definition at line 50 of file util.cpp.

                               {

  // First check whether it is a UPnP error
        DWORD dwRet = 0;
  TCHAR tszErrorString[1024];
  switch(hr){
    // All the upnp error codes are from upnp.h
    case UPNP_E_ROOT_ELEMENT_EXPECTED:
      SafeStrCopy(
                            tszErrorString,
                            "Root Element Expected",
                            1024
                            );
      break;
    case UPNP_E_DEVICE_ELEMENT_EXPECTED:
      SafeStrCopy(
                            tszErrorString,
                            "Device Element Expected",
                            1024
                            );
      break;
    case UPNP_E_SERVICE_ELEMENT_EXPECTED:
      SafeStrCopy(
                            tszErrorString,
                            "Service Element Expected",
                            1024
                            );
      break;
    case UPNP_E_SERVICE_NODE_INCOMPLETE:
      SafeStrCopy(
                            tszErrorString,
                            "Service Node Incomplete",
                            1024
                            );
      break;
    case UPNP_E_DEVICE_NODE_INCOMPLETE:
      SafeStrCopy(
                            tszErrorString,
                            "Device Node Incomplete",
                            1024
                            );
      break;
    case UPNP_E_ICON_ELEMENT_EXPECTED:
      SafeStrCopy(
                            tszErrorString,
                            "Icon Element Expected",
                            1024
                            );
      break;
    case UPNP_E_ICON_NODE_INCOMPLETE:
      SafeStrCopy(
                            tszErrorString,
                            "Icon Node Incomplete",
                            1024
                            );
      break;
    case UPNP_E_INVALID_ACTION:
      SafeStrCopy(
                           tszErrorString,
                           "Invalid Action",
                           1024
                           );
      break;
    case UPNP_E_INVALID_ARGUMENTS:
      SafeStrCopy(
                           tszErrorString,
                           "Invalid Arguments",
                           1024
                           );
      break;
    case UPNP_E_OUT_OF_SYNC:
      SafeStrCopy(
                            tszErrorString,
                            "Out of Sync",
                            1024
                            );
      break;
    case UPNP_E_ACTION_REQUEST_FAILED:
      SafeStrCopy(
                            tszErrorString,
                            "Action Request Failed",
                            1024
                            );
      break;
    case UPNP_E_TRANSPORT_ERROR:
      SafeStrCopy(
                            tszErrorString,
                            "Transport Error",
                            1024
                            );
      break;
    case UPNP_E_VARIABLE_VALUE_UNKNOWN:
      SafeStrCopy(
                            tszErrorString,
                            "Variable Value Unknown",
                            1024
                            );
      break;
    case UPNP_E_INVALID_VARIABLE:
      SafeStrCopy(
                            tszErrorString,
                            "Invalid Variable",
                            1024
                            );
      break;
    case UPNP_E_DEVICE_ERROR:
      SafeStrCopy(
                            tszErrorString,
                            "Device Error",
                           1024
                            );
      break;
    case UPNP_E_PROTOCOL_ERROR:
      SafeStrCopy(
                            tszErrorString,
                            "Protocol Error",
                            1024
                            );
      break;
    case UPNP_E_ERROR_PROCESSING_RESPONSE:
      SafeStrCopy(
                            tszErrorString,
                            "Error Processing Response",
                            1024
                            );
      break;
    case UPNP_E_DEVICE_TIMEOUT:
      SafeStrCopy(
                            tszErrorString,
                            "Device Timeout",
                            1024
                            );
      break;
    case UPNP_E_INVALID_DOCUMENT:
      SafeStrCopy(
                            tszErrorString,
                            "Invalid Document",
                            1024
                            );
      break;
    case UPNP_E_EVENT_SUBSCRIPTION_FAILED:
      SafeStrCopy(
                            tszErrorString,
                            "Event Subscription Failed",
                            1024
                            );
      break;
    default:
                   if ((hr>=UPNP_E_ACTION_SPECIFIC_BASE) &&
                       (hr <= UPNP_E_ACTION_SPECIFIC_MAX))
                   {
      SafeStrCopy(
                            tszErrorString,
                            "Action Specific Error",
                            1024
                            );
      break;
       }
       LPVOID lpMsgBuf = NULL;
       dwRet = FormatMessage(
                            FORMAT_MESSAGE_ALLOCATE_BUFFER |
                            FORMAT_MESSAGE_FROM_SYSTEM |
                            FORMAT_MESSAGE_IGNORE_INSERTS,
                            NULL,
                            GetLastError(),
                            MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
                            (LPTSTR) &lpMsgBuf,
                            0,
                            NULL
                            );

                        if ( dwRet != 0 )
                        {
                            // Display the string.
                            MessageBox( NULL, (LPCTSTR)lpMsgBuf, "Error", MB_OK );

                            // Free the buffer.
                            LocalFree( lpMsgBuf );
                        }

      return;
  }
  MessageBox( NULL, (LPCTSTR)tszErrorString, "Error", MB_OK );
}

void ReleaseObj ( IUnknown * pInterface )

Definition at line 28 of file util.cpp.

                                     {
  if(pInterface){
    pInterface->Release();
  }
}

void SafeStrCopy | ( | TCHAR * | src,
 |  | TCHAR * | dst,
 |  | size_t | srcBufLen
 | ) |  |

Definition at line 521 of file util.cpp.

{
   ASSERT(src != NULL);
   ASSERT(dst != NULL);
   ASSERT(srcBufLen != 0);

   _tcsncpy(src, dst, (srcBufLen - 1));

   // Put a NULL terminator at the end of the buffer. tcsncpy will not NULL
   // terminate the string if the dst length is greater than the size
   // specified.
   src[srcBufLen - 1] = NULL;

}

void VariantSetArray | ( | SAFEARRAY * | psa,
 |  | VARIANT & | va
 | ) |  |

Definition at line 423 of file util.cpp.

{
    VariantInit(&va);
    va.vt = VT_VARIANT | VT_ARRAY | VT_BYREF;
    va.pparray = &psa;
}

void VariantSetVar | ( | VARIANT * | pvarToSet,
 |  | VARIANT & | va
 | ) |  |

Definition at line 400 of file util.cpp.

{
    VariantInit(&va);
    va.vt = VT_VARIANT | VT_BYREF;
    va.pvarVal = pvarToSet;
}

Generated on Wed Nov 13 2024 16:53:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/RegisterDevice/RegDevice.cpp File Reference

  • NetDS
  • upnp
  • RegisterDevice
Defines | Functions

RegDevice.cpp File Reference

#include <stdio.h>
#include <conio.h>
#include <tchar.h>
#include <objbase.h>
#include <initguid.h>
#include <atlbase.h>
#include <upnphost.h>
#include "dimmerdevice.h"
#include "dimmerdevice_i.c"

Go to the source code of this file.

Defines

#define | DEFAULT_DEVICE_LIFETIME 3200

Functions

BOOL | DescriptionDocToBSTR (WCHAR *szDDocFilename, BSTR *pdXMLDoc)
int _cdecl | main ()

Define Documentation

#define DEFAULT_DEVICE_LIFETIME 3200

Definition at line 23 of file RegDevice.cpp.

Function Documentation

BOOL DescriptionDocToBSTR | ( | WCHAR * | szDDocFilename,
 |  | BSTR * | pdXMLDoc
 | ) |  |

Definition at line 25 of file RegDevice.cpp.

{
   // This function reads in the description doc and converts it to a BSTR that
   // can be passed to the Device Host during Registration.
   // Memory is allocated for the BSTR here and freed when we are done with registration

   HANDLE fHandle = NULL;
   BOOL retVal = TRUE;
   BOOL status = TRUE;
   DWORD lowerFileSize = 0;
   LPVOID pBuffer = NULL;
   WCHAR *pwBuffer = NULL;
   DWORD numBytesRead = 0;

   if ((szDDocFilename==NULL) || (pdXMLDoc==NULL))
   {
      goto error;
   }

   fHandle = CreateFile(
      szDDocFilename,         // file name
      GENERIC_READ,           // access mode
      FILE_SHARE_READ,        // share mode
      NULL,                   // SD
      OPEN_EXISTING,          // how to create
      FILE_ATTRIBUTE_NORMAL,  // file attributes
      NULL                    // handle to template file
      );

   if (fHandle == INVALID_HANDLE_VALUE)
   {
      fHandle = NULL;
      goto error;
   }

   // Otherwise we read the contents of the file and convert it to a BSTR
   lowerFileSize = GetFileSize (fHandle, NULL);

   if (lowerFileSize == INVALID_FILE_SIZE)
   {
      // Do not support such large file sizes or GetFileSize returned an error
      goto error;
   }

   pBuffer = CoTaskMemAlloc(lowerFileSize);
   if (pBuffer == NULL)
   {
      goto error;
   }

   pwBuffer= (WCHAR *) CoTaskMemAlloc((lowerFileSize+1)*sizeof(WCHAR));

   if (pwBuffer==NULL)
   {
      goto error;
   }

   // Else read from the file into the buffer
   status = ReadFile(
      fHandle,
      pBuffer,
      lowerFileSize,
      &numBytesRead,
      NULL
      );
   if (!status || (numBytesRead == 0))
   {
      goto error;
   }

   // Convert to a WCHAR string
   if (MultiByteToWideChar(CP_ACP, // code page
      MB_PRECOMPOSED,              // character-type options
      (LPCSTR) pBuffer,            // string to map
      lowerFileSize,               // number of bytes in string
      pwBuffer,                    // wide-character buffer
      lowerFileSize                // size of wide char buffer
      )==0)
   {
      goto error;
   }

   //adding a "\0" to the end of the buffer
   pwBuffer[lowerFileSize]=_TEXT('\0');
   //now convert the file to a BSTR
   *pdXMLDoc = NULL;
   *pdXMLDoc = SysAllocString(pwBuffer);

   if (*pdXMLDoc == NULL)
   {
      goto error;
   }

   CloseHandle(fHandle);
   CoTaskMemFree(pBuffer);
   CoTaskMemFree(pwBuffer);

   // Have copied the description doc to a BSTR and so return TRUE
   return retVal;

error:

   retVal = FALSE;
   if (fHandle)
   {
      CloseHandle(fHandle);
   }
   CoTaskMemFree(pBuffer);
   CoTaskMemFree(pwBuffer);
   return retVal;

}

int _cdecl main ( void )

Definition at line 140 of file RegDevice.cpp.

{
   // This executable makes the call to the Device Host to register a device

   HRESULT hr = S_OK;
   IUnknown *punk = NULL;
   IDispatch *pIDisp = NULL;
   IUPnPRegistrar *pReg = NULL;
   IUPnPReregistrar *pRereg = NULL;
   LPWSTR resourcePath = NULL;
   DWORD dwSize = 0;
   WCHAR fileDescriptionDoc[] = L"DimmerDevice-Desc.xml";
   WCHAR initString[] = L"DimmerDevice SDK Sample";
   LONG lifeTime = DEFAULT_DEVICE_LIFETIME;
   BSTR DeviceID = NULL;
   BSTR desDoc = NULL;
   BSTR initBSTR = NULL;
   BSTR resourcePathBSTR = NULL;
   CHAR option;
   INT getMsgRet = 0;

   BOOL retVal = TRUE;

   printf("\nSetup:");
   printf("\nBefore running this program please make sure that the two XML files");
   printf("\nare in the same directory as the EXE.\n");
   printf("\nAlso make sure that the command 'regsvr32 UPNPSampleDimmerDevice.dll'");
   printf("\nhas been run to register device-specific COM object.\n");

   hr = CoInitializeEx (NULL, COINIT_MULTITHREADED);
   if (FAILED(hr))
   {
      printf("\nCould not initialize COM library");
      return 0;
   }

   hr = CoInitializeSecurity(
      NULL,
      -1,
      NULL,
      NULL,
      RPC_C_AUTHN_LEVEL_DEFAULT,
      RPC_C_IMP_LEVEL_IMPERSONATE,
      NULL,
      EOAC_SECURE_REFS,
      NULL
      );

   if (FAILED(hr))
   {
      printf("\nCould not initialize COM security");
      goto error;
   }

   // Now try to instantiate the Device Control Object
   hr = CoCreateInstance(
      CLSID_UPNPSampleDimmerDevice,
      NULL,
      CLSCTX_INPROC_SERVER,
      IID_IUnknown,
      (LPVOID *) &punk
      );

   if (FAILED(hr))
   {
      printf("\nCould not Instantiate the Device Control Object. - %x",hr);
      printf("\nCheck that the dll UPNPSampleDimmerDevice.dll has been registered");
      goto error;
   }

   // Continue with the registration and register the running device with the Device Host
   // get the resource path or the current directory where the XML files are located

   // Call GetCurrentDirectory() specifying nBufferLength = 0 to get the size of the
   // required buffer to hold path, then call this function again to fill in the buffer
   dwSize = GetCurrentDirectoryW(0, NULL);
   resourcePath = (WCHAR *) CoTaskMemAlloc((dwSize + 1) * sizeof (WCHAR)); // add for for trailing "\"
   if (resourcePath == NULL)
   {
      printf("\nMemory Allocation Failure.. exiting");
      goto error;
   }

   if (GetCurrentDirectoryW(dwSize, resourcePath) == 0)
   {
      printf("\nCould not get the current directory Path where the XML files are located");
      goto error;
   }

   wcscat(resourcePath,L"\\");

   //now we try to read in the description doc for the DimmerDevice
   retVal = DescriptionDocToBSTR(fileDescriptionDoc, &desDoc);

   if (retVal==FALSE)
   {
      printf("\nCould not load the description document for the device");
      goto error;
   }

   initBSTR = SysAllocString(initString);
   if (initBSTR==NULL)
   {
      printf("\nMemory Allocation Failure.. exiting");
      goto error;
   }

   resourcePathBSTR = SysAllocString(resourcePath);
   if (resourcePathBSTR == NULL)
   {
      printf("\nMemory Allocation Failure.. exiting");
      goto error;
   }

   //now register the device with the Device Host service
   hr = CoCreateInstance(
      CLSID_UPnPRegistrar,
      NULL,
      CLSCTX_LOCAL_SERVER,
      IID_IUPnPRegistrar,
      (LPVOID *) &pReg
      );
   if (FAILED(hr))
   {
      printf("\nCould not get a pointer to the IUPnPRegistrar Interface failed - %x",hr);
      printf("\nCheck that the UPNP Device Host Component is installed on this machine");
      goto error;
   }

   //now get a pointer to the IID_IUPnPReregistrar
   hr = CoCreateInstance(
      CLSID_UPnPRegistrar,
      NULL,
      CLSCTX_LOCAL_SERVER,
      IID_IUPnPReregistrar,
      (LPVOID *) &pRereg
      );

   if (FAILED(hr))
   {
      printf("\nCould not get the pointer to the IUPnPReregistrar Interface - %x",hr);
      printf("\nCheck that the UPNP Device Host Component is installed on this machine");
      goto error;
   }

   hr = pReg->RegisterRunningDevice(desDoc,punk,initBSTR,resourcePathBSTR,lifeTime,&DeviceID);

   if (FAILED(hr))
   {
      printf("Could not register the device with the Device Host - %x",hr);
      goto error;
   }

   printf("\nDevice Registered Successfully with the UPNP Device Host...");
   printf("\nHit d to unregister the device -  ");
   while (1)
   {
      option =  (CHAR)_getche();
      if((option=='d')||(option=='D'))
      {
         break;
      }
   }

   printf("\nUnregistering the device with the UPNP Device Host and Quitting ..");
   //deregister the device
   hr = pReg->UnregisterDevice(DeviceID,TRUE);

   if (SUCCEEDED(hr))
   {
      printf("\nDevice was unregistered successfully");
   }
   else
   {
      printf("\nDevice could not be unregistered - %x",hr);
   }

   CoTaskMemFree(resourcePath);
   SysFreeString(desDoc);
   SysFreeString(initBSTR);
   SysFreeString(resourcePathBSTR);
   //release the references to the interfaces
   pRereg->Release();
   punk->Release();
   pReg->Release();
   CoUninitialize();
   return 1;

error:

   CoTaskMemFree(resourcePath);
   SysFreeString(desDoc);
   SysFreeString(initBSTR);
   SysFreeString(resourcePathBSTR);
   if (punk)
   {
      punk->Release();
   }
   if (pRereg)
   {
      pRereg->Release();
   }
   if (pReg)
   {
      pReg->Release();
   }
   CoUninitialize();
   return 0;
}

Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/StepByStep/Step1/DimmingService_SCPD.idl File Reference

  • NetDS
  • upnp
  • StepByStep
  • Step1
Classes | Typedefs | Enumerations

DimmingService_SCPD.idl File Reference

Go to the source code of this file.

Classes

interface IUPnPService_DimmingService_SCPD

Typedefs

typedef enum
DIMMINGSERVICE_SCPD_DISPIDS 		DIMMINGSERVICE_SCPD_DISPIDS

Enumerations

enum DIMMINGSERVICE_SCPD_DISPIDS {
DISPID_POWER = 1, DISPID_DIMLEVEL, DISPID_POWERON, DISPID_POWEROFF,
DISPID_GETPOWERVALUE, DISPID_SETDIMLEVEL, DISPID_GETDIMLEVEL, DISPID_GETCONFIGDETAILS,
DISPID_POWER = 1, DISPID_DIMLEVEL = DISPID_POWER + 1, DISPID_POWERON = DISPID_DIMLEVEL + 1, DISPID_POWEROFF = DISPID_POWERON + 1,
DISPID_GETPOWERVALUE = DISPID_POWEROFF + 1, DISPID_SETDIMLEVEL = DISPID_GETPOWERVALUE + 1, DISPID_GETDIMLEVEL = DISPID_SETDIMLEVEL + 1, DISPID_GETCONFIGDETAILS = DISPID_GETDIMLEVEL + 1,
DISPID_POWER = 1, DISPID_DIMLEVEL = DISPID_POWER + 1, DISPID_POWERON = DISPID_DIMLEVEL + 1, DISPID_POWEROFF = DISPID_POWERON + 1,
DISPID_GETPOWERVALUE = DISPID_POWEROFF + 1, DISPID_SETDIMLEVEL = DISPID_GETPOWERVALUE + 1, DISPID_GETDIMLEVEL = DISPID_SETDIMLEVEL + 1, DISPID_GETCONFIGDETAILS = DISPID_GETDIMLEVEL + 1
}

Typedef Documentation

typedef enum DIMMINGSERVICE_SCPD_DISPIDS DIMMINGSERVICE_SCPD_DISPIDS

Enumeration Type Documentation

enum DIMMINGSERVICE_SCPD_DISPIDS
Enumerator:
DISPID_POWER
DISPID_DIMLEVEL
DISPID_POWERON
DISPID_POWEROFF
DISPID_GETPOWERVALUE
DISPID_SETDIMLEVEL
DISPID_GETDIMLEVEL
DISPID_GETCONFIGDETAILS
DISPID_POWER
DISPID_DIMLEVEL
DISPID_POWERON
DISPID_POWEROFF
DISPID_GETPOWERVALUE
DISPID_SETDIMLEVEL
DISPID_GETDIMLEVEL
DISPID_GETCONFIGDETAILS
DISPID_POWER
DISPID_DIMLEVEL
DISPID_POWERON
DISPID_POWEROFF
DISPID_GETPOWERVALUE
DISPID_SETDIMLEVEL
DISPID_GETDIMLEVEL
DISPID_GETCONFIGDETAILS

Definition at line 1 of file DimmingService_SCPD.idl.

{
   DISPID_POWER = 1,
   DISPID_DIMLEVEL,
   DISPID_POWERON,
   DISPID_POWEROFF,
   DISPID_GETPOWERVALUE,
   DISPID_SETDIMLEVEL,
   DISPID_GETDIMLEVEL,
   DISPID_GETCONFIGDETAILS

} DIMMINGSERVICE_SCPD_DISPIDS;

Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/StepByStep/Step2/Dimmer.cpp File Reference

  • NetDS
  • upnp
  • StepByStep
  • Step2

Dimmer.cpp File Reference

#include "stdafx.h"
#include "MyDevice.h"
#include "Dimmer.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/StepByStep/Step2/Dimmer.h File Reference

  • NetDS
  • upnp
  • StepByStep
  • Step2
Classes

Dimmer.h File Reference

#include "resource.h"
#import "C:\UPnPSample\SDKDimmer\DimmerDevice\StepByStep\Step2\Debug\upnphost.tlb"
#include "resource.h"

Go to the source code of this file.

Classes

class CDimmer
Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/StepByStep/Step2/DimmerService.cpp File Reference

  • NetDS
  • upnp
  • StepByStep
  • Step2

DimmerService.cpp File Reference

#include "stdafx.h"
#include "MyDevice.h"
#include "DimmerService.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/StepByStep/Step2/DimmerService.h File Reference

  • NetDS
  • upnp
  • StepByStep
  • Step2
Classes

DimmerService.h File Reference

#include "resource.h"
#import "C:\UPnPSample\SDKDimmer\DimmerDevice\StepByStep\Step2\Debug\upnphost.tlb"

Go to the source code of this file.

Classes

class CDimmerService
Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/StepByStep/Step2/dlldata.c File Reference

  • NetDS
  • upnp
  • StepByStep
  • Step2
Functions

dlldata.c File Reference

#include <rpcproxy.h>

Go to the source code of this file.

Functions

PROXYFILE_LIST_START REFERENCE_PROXY_FILE (upnphost)

Function Documentation

PROXYFILE_LIST_START REFERENCE_PROXY_FILE ( upnphost )
Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/StepByStep/Step2/MyDevice.cpp File Reference

  • NetDS
  • upnp
  • StepByStep
  • Step2
Functions | Variables

MyDevice.cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include "MyDevice.h"
#include "MyDevice_i.c"
#include "Dimmer.h"
#include "DimmerService.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 44 of file MyDevice.cpp.

{
    return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 52 of file MyDevice.cpp.

{
    return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 29 of file MyDevice.cpp.

{
    if (dwReason == DLL_PROCESS_ATTACH)
    {
        _Module.Init(ObjectMap, hInstance, &LIBID_MYDEVICELib);
        DisableThreadLibraryCalls(hInstance);
    }
    else if (dwReason == DLL_PROCESS_DETACH)
        _Module.Term();
    return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 60 of file MyDevice.cpp.

{
    // registers object, typelib and all interfaces in typelib
    return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 69 of file MyDevice.cpp.

{
    return _Module.UnregisterServer(TRUE);
}

Variable Documentation

CComModule _Module

Definition at line 18 of file MyDevice.cpp.

Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/StepByStep/Step2/MyDevice.h File Reference

  • NetDS
  • upnp
  • StepByStep
  • Step2

MyDevice.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/StepByStep/Step2/MyDevice.idl File Reference

  • NetDS
  • upnp
  • StepByStep
  • Step2
Classes | Namespaces | Typedefs | Enumerations | Functions

MyDevice.idl File Reference

Go to the source code of this file.

Classes

interface | IDimmer
interface | IDimmerService
class | MYDEVICELib::Dimmer
class | MYDEVICELib::DimmerService
interface | MYDEVICELib::IUPnPService_DimmingService_SCPD

Namespaces

namespace | MYDEVICELib

Typedefs

typedef enum
MYDEVICELib::DIMMINGSERVICE_SCPD_DISPIDS 		MYDEVICELib::DIMMINGSERVICE_SCPD_DISPIDS

Enumerations

enum MYDEVICELib::DIMMINGSERVICE_SCPD_DISPIDS {
MYDEVICELib::DISPID_POWER = 1, MYDEVICELib::DISPID_DIMLEVEL, MYDEVICELib::DISPID_POWERON, MYDEVICELib::DISPID_POWEROFF,
MYDEVICELib::DISPID_GETPOWERVALUE, MYDEVICELib::DISPID_SETDIMLEVEL, MYDEVICELib::DISPID_GETDIMLEVEL, MYDEVICELib::DISPID_GETCONFIGDETAILS,
MYDEVICELib::DISPID_POWER = 1, MYDEVICELib::DISPID_DIMLEVEL, MYDEVICELib::DISPID_POWERON, MYDEVICELib::DISPID_POWEROFF,
MYDEVICELib::DISPID_GETPOWERVALUE, MYDEVICELib::DISPID_SETDIMLEVEL, MYDEVICELib::DISPID_GETDIMLEVEL, MYDEVICELib::DISPID_GETCONFIGDETAILS,
MYDEVICELib::DISPID_POWER = 1, MYDEVICELib::DISPID_DIMLEVEL, MYDEVICELib::DISPID_POWERON, MYDEVICELib::DISPID_POWEROFF,
MYDEVICELib::DISPID_GETPOWERVALUE, MYDEVICELib::DISPID_SETDIMLEVEL, MYDEVICELib::DISPID_GETDIMLEVEL, MYDEVICELib::DISPID_GETCONFIGDETAILS
}

Functions

MYDEVICELib::importlib ("stdole32.tlb")
MYDEVICELib::importlib ("stdole2.tlb")
Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/StepByStep/Step2/resource.h File Reference

  • NetDS
  • upnp
  • StepByStep
  • Step2
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_DIMMER 101
#define | IDR_DIMMERSERVICE 102
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_DIMMER 101

Definition at line 6 of file resource.h.

#define IDR_DIMMERSERVICE 102

Definition at line 7 of file resource.h.

#define IDS_PROJNAME 100

Definition at line 5 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/StepByStep/Step2/StdAfx.cpp File Reference

  • NetDS
  • upnp
  • StepByStep
  • Step2

StdAfx.cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/StepByStep/Step2/StdAfx.h File Reference

  • NetDS
  • upnp
  • StepByStep
  • Step2
Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0400
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 16 of file StdAfx.h.

#define _WIN32_WINNT 0x0400

Definition at line 14 of file StdAfx.h.

#define STRICT

Definition at line 12 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/StepByStep/Step3/Dimmer.cpp File Reference

  • NetDS
  • upnp
  • StepByStep
  • Step3

Dimmer.cpp File Reference

#include "stdafx.h"
#include "MyDevice.h"
#include "Dimmer.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/StepByStep/Step3/Dimmer.h File Reference

  • NetDS
  • upnp
  • StepByStep
  • Step3
Classes

Dimmer.h File Reference

#include "resource.h"
#import "C:\UPnPSample\SDKDimmer\DimmerDevice\StepByStep\Step2\Debug\upnphost.tlb"
#include "resource.h"

Go to the source code of this file.

Classes

class CDimmer
Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/StepByStep/Step3/DimmerService.cpp File Reference

  • NetDS
  • upnp
  • StepByStep
  • Step3

DimmerService.cpp File Reference

#include "stdafx.h"
#include "MyDevice.h"
#include "DimmerService.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/StepByStep/Step3/DimmerService.h File Reference

  • NetDS
  • upnp
  • StepByStep
  • Step3
Classes

DimmerService.h File Reference

#include "resource.h"
#import "C:\UPnPSample\SDKDimmer\DimmerDevice\StepByStep\Step2\Debug\upnphost.tlb"

Go to the source code of this file.

Classes

class CDimmerService
Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/StepByStep/Step3/dlldata.c File Reference

  • NetDS
  • upnp
  • StepByStep
  • Step3
Functions

dlldata.c File Reference

#include <rpcproxy.h>

Go to the source code of this file.

Functions

PROXYFILE_LIST_START REFERENCE_PROXY_FILE (upnphost)

Function Documentation

PROXYFILE_LIST_START REFERENCE_PROXY_FILE ( upnphost )
Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/StepByStep/Step3/MyDevice.cpp File Reference

  • NetDS
  • upnp
  • StepByStep
  • Step3
Functions | Variables

MyDevice.cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include "MyDevice.h"
#include "MyDevice_i.c"
#include "Dimmer.h"
#include "DimmerService.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 44 of file MyDevice.cpp.

{
    return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 52 of file MyDevice.cpp.

{
    return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 29 of file MyDevice.cpp.

{
    if (dwReason == DLL_PROCESS_ATTACH)
    {
        _Module.Init(ObjectMap, hInstance, &LIBID_MYDEVICELib);
        DisableThreadLibraryCalls(hInstance);
    }
    else if (dwReason == DLL_PROCESS_DETACH)
        _Module.Term();
    return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 60 of file MyDevice.cpp.

{
    // registers object, typelib and all interfaces in typelib
    return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 69 of file MyDevice.cpp.

{
    return _Module.UnregisterServer(TRUE);
}

Variable Documentation

CComModule _Module

Definition at line 18 of file MyDevice.cpp.

Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/StepByStep/Step3/MyDevice.h File Reference

  • NetDS
  • upnp
  • StepByStep
  • Step3
Classes | Defines | Typedefs | Enumerations | Functions | Variables

MyDevice.h File Reference

#include "rpc.h"
#include "rpcndr.h"
#include "oaidl.h"
#include "ocidl.h"

Go to the source code of this file.

Classes

struct | IUPnPService_DimmingService_SCPDVtbl

Defines

#define | __Dimmer_FWD_DEFINED__
#define | __IUPnPService_DimmingService_SCPD_FWD_DEFINED__
#define | __IUPnPService_DimmingService_SCPD_INTERFACE_DEFINED__
#define | __MYDEVICELib_LIBRARY_DEFINED__
#define | __REQUIRED_RPCNDR_H_VERSION__ 440

Typedefs

typedef struct Dimmer | Dimmer
typedef enum
DIMMINGSERVICE_SCPD_DISPIDS 		DIMMINGSERVICE_SCPD_DISPIDS
typedef interface
IUPnPService_DimmingService_SCPD 		IUPnPService_DimmingService_SCPD
typedef struct
IUPnPService_DimmingService_SCPDVtbl 		IUPnPService_DimmingService_SCPDVtbl

Enumerations

enum DIMMINGSERVICE_SCPD_DISPIDS {
DISPID_POWER = 1, DISPID_DIMLEVEL, DISPID_POWERON, DISPID_POWEROFF,
DISPID_GETPOWERVALUE, DISPID_SETDIMLEVEL, DISPID_GETDIMLEVEL, DISPID_GETCONFIGDETAILS,
DISPID_POWER = 1, DISPID_DIMLEVEL = DISPID_POWER + 1, DISPID_POWERON = DISPID_DIMLEVEL + 1, DISPID_POWEROFF = DISPID_POWERON + 1,
DISPID_GETPOWERVALUE = DISPID_POWEROFF + 1, DISPID_SETDIMLEVEL = DISPID_GETPOWERVALUE + 1, DISPID_GETDIMLEVEL = DISPID_SETDIMLEVEL + 1, DISPID_GETCONFIGDETAILS = DISPID_GETDIMLEVEL + 1,
DISPID_POWER = 1, DISPID_DIMLEVEL = DISPID_POWER + 1, DISPID_POWERON = DISPID_DIMLEVEL + 1, DISPID_POWEROFF = DISPID_POWERON + 1,
DISPID_GETPOWERVALUE = DISPID_POWEROFF + 1, DISPID_SETDIMLEVEL = DISPID_GETPOWERVALUE + 1, DISPID_GETDIMLEVEL = DISPID_SETDIMLEVEL + 1, DISPID_GETCONFIGDETAILS = DISPID_GETDIMLEVEL + 1
}

Functions

HRESULT STDMETHODCALLTYPE | IUPnPService_DimmingService_SCPD_get_dimLevel_Proxy (IUPnPService_DimmingService_SCPD __RPC_FAR *This, long __RPC_FAR *pdimLevel)
void __RPC_STUB | IUPnPService_DimmingService_SCPD_get_dimLevel_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IUPnPService_DimmingService_SCPD_get_Power_Proxy (IUPnPService_DimmingService_SCPD __RPC_FAR *This, VARIANT_BOOL __RPC_FAR *pPower)
void __RPC_STUB | IUPnPService_DimmingService_SCPD_get_Power_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IUPnPService_DimmingService_SCPD_GetConfigDetails_Proxy (IUPnPService_DimmingService_SCPD __RPC_FAR *This, VARIANT_BOOL __RPC_FAR *ppowerVal, long __RPC_FAR *pdLevel)
void __RPC_STUB | IUPnPService_DimmingService_SCPD_GetConfigDetails_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IUPnPService_DimmingService_SCPD_GetDimLevel_Proxy (IUPnPService_DimmingService_SCPD __RPC_FAR *This, long __RPC_FAR *pdLevel)
void __RPC_STUB | IUPnPService_DimmingService_SCPD_GetDimLevel_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IUPnPService_DimmingService_SCPD_GetPowerValue_Proxy (IUPnPService_DimmingService_SCPD __RPC_FAR *This, VARIANT_BOOL __RPC_FAR *ppowerVall)
void __RPC_STUB | IUPnPService_DimmingService_SCPD_GetPowerValue_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IUPnPService_DimmingService_SCPD_PowerOff_Proxy (IUPnPService_DimmingService_SCPD __RPC_FAR *This)
void __RPC_STUB | IUPnPService_DimmingService_SCPD_PowerOff_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IUPnPService_DimmingService_SCPD_PowerOn_Proxy (IUPnPService_DimmingService_SCPD __RPC_FAR *This)
void __RPC_STUB | IUPnPService_DimmingService_SCPD_PowerOn_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IUPnPService_DimmingService_SCPD_SetDimLevel_Proxy (IUPnPService_DimmingService_SCPD __RPC_FAR *This, long dLevel)
void __RPC_STUB | IUPnPService_DimmingService_SCPD_SetDimLevel_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
void __RPC_FAR *__RPC_USER | MIDL_user_allocate (size_t)
void __RPC_USER | MIDL_user_free (void __RPC_FAR *)

Variables

EXTERN_C const CLSID | CLSID_Dimmer
EXTERN_C const IID | IID_IUPnPService_DimmingService_SCPD
EXTERN_C const IID | LIBID_MYDEVICELib
interface
IUPnPService_DimmingService_SCPD
CONST_VTBL struct
IUPnPService_DimmingService_SCPDVtbl
__RPC_FAR * 		lpVtbl

Define Documentation

#define __Dimmer_FWD_DEFINED__

Definition at line 38 of file MyDevice.h.

#define __IUPnPService_DimmingService_SCPD_FWD_DEFINED__

Definition at line 32 of file MyDevice.h.

#define __IUPnPService_DimmingService_SCPD_INTERFACE_DEFINED__

Definition at line 79 of file MyDevice.h.

#define __MYDEVICELib_LIBRARY_DEFINED__

Definition at line 58 of file MyDevice.h.

#define __REQUIRED_RPCNDR_H_VERSION__ 440

Definition at line 16 of file MyDevice.h.

Typedef Documentation

typedef struct Dimmer Dimmer

Definition at line 43 of file MyDevice.h.

typedef enum DIMMINGSERVICE_SCPD_DISPIDS DIMMINGSERVICE_SCPD_DISPIDS
typedef interface IUPnPService_DimmingService_SCPD IUPnPService_DimmingService_SCPD

Definition at line 33 of file MyDevice.h.

typedef struct IUPnPService_DimmingService_SCPDVtbl IUPnPService_DimmingService_SCPDVtbl

Enumeration Type Documentation

enum DIMMINGSERVICE_SCPD_DISPIDS
Enumerator:
DISPID_POWER
DISPID_DIMLEVEL
DISPID_POWERON
DISPID_POWEROFF
DISPID_GETPOWERVALUE
DISPID_SETDIMLEVEL
DISPID_GETDIMLEVEL
DISPID_GETCONFIGDETAILS
DISPID_POWER
DISPID_DIMLEVEL
DISPID_POWERON
DISPID_POWEROFF
DISPID_GETPOWERVALUE
DISPID_SETDIMLEVEL
DISPID_GETDIMLEVEL
DISPID_GETCONFIGDETAILS
DISPID_POWER
DISPID_DIMLEVEL
DISPID_POWERON
DISPID_POWEROFF
DISPID_GETPOWERVALUE
DISPID_SETDIMLEVEL
DISPID_GETDIMLEVEL
DISPID_GETCONFIGDETAILS

Definition at line 64 of file MyDevice.h.

    { DISPID_POWER  = 1,
  DISPID_DIMLEVEL = DISPID_POWER + 1,
  DISPID_POWERON  = DISPID_DIMLEVEL + 1,
  DISPID_POWEROFF = DISPID_POWERON + 1,
  DISPID_GETPOWERVALUE  = DISPID_POWEROFF + 1,
  DISPID_SETDIMLEVEL  = DISPID_GETPOWERVALUE + 1,
  DISPID_GETDIMLEVEL  = DISPID_SETDIMLEVEL + 1,
  DISPID_GETCONFIGDETAILS = DISPID_GETDIMLEVEL + 1
    } DIMMINGSERVICE_SCPD_DISPIDS;

Function Documentation

HRESULT STDMETHODCALLTYPE IUPnPService_DimmingService_SCPD_get_dimLevel_Proxy | ( | IUPnPService_DimmingService_SCPD __RPC_FAR * | This,
 |  | long __RPC_FAR * | pdimLevel
 | ) |  |
void __RPC_STUB IUPnPService_DimmingService_SCPD_get_dimLevel_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IUPnPService_DimmingService_SCPD_get_Power_Proxy | ( | IUPnPService_DimmingService_SCPD __RPC_FAR * | This,
 |  | VARIANT_BOOL __RPC_FAR * | pPower
 | ) |  |
void __RPC_STUB IUPnPService_DimmingService_SCPD_get_Power_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IUPnPService_DimmingService_SCPD_GetConfigDetails_Proxy | ( | IUPnPService_DimmingService_SCPD __RPC_FAR * | This,
 |  | VARIANT_BOOL __RPC_FAR * | ppowerVal,
 |  | long __RPC_FAR * | pdLevel
 | ) |  |
void __RPC_STUB IUPnPService_DimmingService_SCPD_GetConfigDetails_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IUPnPService_DimmingService_SCPD_GetDimLevel_Proxy | ( | IUPnPService_DimmingService_SCPD __RPC_FAR * | This,
 |  | long __RPC_FAR * | pdLevel
 | ) |  |
void __RPC_STUB IUPnPService_DimmingService_SCPD_GetDimLevel_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IUPnPService_DimmingService_SCPD_GetPowerValue_Proxy | ( | IUPnPService_DimmingService_SCPD __RPC_FAR * | This,
 |  | VARIANT_BOOL __RPC_FAR * | ppowerVall
 | ) |  |
void __RPC_STUB IUPnPService_DimmingService_SCPD_GetPowerValue_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IUPnPService_DimmingService_SCPD_PowerOff_Proxy ( IUPnPService_DimmingService_SCPD __RPC_FAR * This )
void __RPC_STUB IUPnPService_DimmingService_SCPD_PowerOff_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IUPnPService_DimmingService_SCPD_PowerOn_Proxy ( IUPnPService_DimmingService_SCPD __RPC_FAR * This )
void __RPC_STUB IUPnPService_DimmingService_SCPD_PowerOn_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IUPnPService_DimmingService_SCPD_SetDimLevel_Proxy | ( | IUPnPService_DimmingService_SCPD __RPC_FAR * | This,
 |  | long | dLevel
 | ) |  |
void __RPC_STUB IUPnPService_DimmingService_SCPD_SetDimLevel_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
void __RPC_FAR* __RPC_USER MIDL_user_allocate ( size_t )

Definition at line 364 of file Picklpc.c.

{
    unsigned char * pcAllocated;
    unsigned char * pcUserPtr;

    pcAllocated = (unsigned char *) malloc( s + 15 );
    pcUserPtr =  ALIGN_TO8( pcAllocated );
    if ( pcUserPtr == pcAllocated )
        pcUserPtr = pcAllocated + 8;

    *(pcUserPtr - 1) = (char) (pcUserPtr - pcAllocated);

    return( pcUserPtr );
}

void __RPC_USER MIDL_user_free ( void __RPC_FAR * )

Definition at line 379 of file Picklpc.c.

{
    unsigned char * pcAllocated;
    unsigned char * pcUserPtr;

    pcUserPtr = (unsigned char *) f;
    pcAllocated = pcUserPtr - *(pcUserPtr - 1);

    free( pcAllocated );
}

Variable Documentation

EXTERN_C const CLSID CLSID_Dimmer

Definition at line 361 of file MyDevice.h.

EXTERN_C const IID IID_IUPnPService_DimmingService_SCPD

Definition at line 85 of file MyDevice.h.

EXTERN_C const IID LIBID_MYDEVICELib

Definition at line 76 of file MyDevice.h.

interface IUPnPService_DimmingService_SCPD CONST_VTBL struct IUPnPService_DimmingService_SCPDVtbl __RPC_FAR* lpVtbl

Definition at line 200 of file MyDevice.h.

Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/StepByStep/Step3/MyDevice.idl File Reference

  • NetDS
  • upnp
  • StepByStep
  • Step3
Classes | Namespaces | Enumerations | Functions

MyDevice.idl File Reference

Go to the source code of this file.

Classes

class | MYDEVICELib::Dimmer
interface | MYDEVICELib::IUPnPService_DimmingService_SCPD

Namespaces

namespace | MYDEVICELib

Enumerations

enum MYDEVICELib::DIMMINGSERVICE_SCPD_DISPIDS {
MYDEVICELib::DISPID_POWER = 1, MYDEVICELib::DISPID_DIMLEVEL, MYDEVICELib::DISPID_POWERON, MYDEVICELib::DISPID_POWEROFF,
MYDEVICELib::DISPID_GETPOWERVALUE, MYDEVICELib::DISPID_SETDIMLEVEL, MYDEVICELib::DISPID_GETDIMLEVEL, MYDEVICELib::DISPID_GETCONFIGDETAILS,
MYDEVICELib::DISPID_POWER = 1, MYDEVICELib::DISPID_DIMLEVEL, MYDEVICELib::DISPID_POWERON, MYDEVICELib::DISPID_POWEROFF,
MYDEVICELib::DISPID_GETPOWERVALUE, MYDEVICELib::DISPID_SETDIMLEVEL, MYDEVICELib::DISPID_GETDIMLEVEL, MYDEVICELib::DISPID_GETCONFIGDETAILS,
MYDEVICELib::DISPID_POWER = 1, MYDEVICELib::DISPID_DIMLEVEL, MYDEVICELib::DISPID_POWERON, MYDEVICELib::DISPID_POWEROFF,
MYDEVICELib::DISPID_GETPOWERVALUE, MYDEVICELib::DISPID_SETDIMLEVEL, MYDEVICELib::DISPID_GETDIMLEVEL, MYDEVICELib::DISPID_GETCONFIGDETAILS
}

Functions

MYDEVICELib::importlib ("stdole32.tlb")
MYDEVICELib::importlib ("stdole2.tlb")
Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/StepByStep/Step3/MyDevice_i.c File Reference

  • NetDS
  • upnp
  • StepByStep
  • Step3
Classes | Defines | Typedefs | Variables

MyDevice_i.c File Reference

Go to the source code of this file.

Classes

struct | _IID

Defines

#define | __IID_DEFINED__
#define | CLSID_DEFINED

Typedefs

typedef IID | CLSID
typedef struct _IID | IID

Variables

const CLSID | CLSID_Dimmer = {0xd31b8f49,0x367e,0x41b7,{0x8f,0xc4,0x50,0xe2,0x3d,0x36,0x62,0x5d}}
const IID | IID_IUPnPService_DimmingService_SCPD = {0xa315fcbd,0x7f4b,0x4081,{0xa1,0x72,0x2f,0x53,0x4c,0x43,0x89,0x57}}
const IID | LIBID_MYDEVICELib = {0x51AC2F4C,0x3F4F,0x48B3,{0xA0,0x18,0x91,0x0E,0x81,0x67,0x7E,0xEF}}

Define Documentation

#define __IID_DEFINED__

Definition at line 21 of file MyDevice_i.c.

#define CLSID_DEFINED

Definition at line 34 of file MyDevice_i.c.

Typedef Documentation

typedef IID CLSID

Definition at line 35 of file MyDevice_i.c.

typedef struct _IID IID

Variable Documentation

const CLSID CLSID_Dimmer = {0xd31b8f49,0x367e,0x41b7,{0x8f,0xc4,0x50,0xe2,0x3d,0x36,0x62,0x5d}}

Definition at line 44 of file MyDevice_i.c.

const IID IID_IUPnPService_DimmingService_SCPD = {0xa315fcbd,0x7f4b,0x4081,{0xa1,0x72,0x2f,0x53,0x4c,0x43,0x89,0x57}}

Definition at line 41 of file MyDevice_i.c.

const IID LIBID_MYDEVICELib = {0x51AC2F4C,0x3F4F,0x48B3,{0xA0,0x18,0x91,0x0E,0x81,0x67,0x7E,0xEF}}

Definition at line 38 of file MyDevice_i.c.

Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/StepByStep/Step3/resource.h File Reference

  • NetDS
  • upnp
  • StepByStep
  • Step3
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_DIMMER 101
#define | IDR_DIMMERSERVICE 102
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_DIMMER 101

Definition at line 6 of file resource.h.

#define IDR_DIMMERSERVICE 102

Definition at line 7 of file resource.h.

#define IDS_PROJNAME 100

Definition at line 5 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/StepByStep/Step3/StdAfx.cpp File Reference

  • NetDS
  • upnp
  • StepByStep
  • Step3

StdAfx.cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/StepByStep/Step3/StdAfx.h File Reference

  • NetDS
  • upnp
  • StepByStep
  • Step3
Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0400
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 16 of file StdAfx.h.

#define _WIN32_WINNT 0x0400

Definition at line 14 of file StdAfx.h.

#define STRICT

Definition at line 12 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/StepByStep/Step4/Dimmer.cpp File Reference

  • NetDS
  • upnp
  • StepByStep
  • Step4

Dimmer.cpp File Reference

#include "stdafx.h"
#include "MyDevice.h"
#include "Dimmer.h"
#include "DimmerService.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/StepByStep/Step4/Dimmer.h File Reference

  • NetDS
  • upnp
  • StepByStep
  • Step4
Classes | Defines

Dimmer.h File Reference

#include "resource.h"
#import "C:\UPnPSample\SDKDimmer\DimmerDevice\StepByStep\Step2\Debug\upnphost.tlb"
#include "resource.h"

Go to the source code of this file.

Classes

class | CDimmer

Defines

#define | MAX_NOSERVICE_PER_DEVICE 1
#define | NUM_TEMPLATE_UDNS_IN_DESCDOC 1

Define Documentation

#define MAX_NOSERVICE_PER_DEVICE 1

Definition at line 10 of file Dimmer.h.

#define NUM_TEMPLATE_UDNS_IN_DESCDOC 1

Definition at line 9 of file Dimmer.h.

Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/StepByStep/Step4/DimmerService.cpp File Reference

  • NetDS
  • upnp
  • StepByStep
  • Step4

DimmerService.cpp File Reference

#include "stdafx.h"
#include "MyDevice.h"
#include "DimmerService.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/StepByStep/Step4/DimmerService.h File Reference

  • NetDS
  • upnp
  • StepByStep
  • Step4
Classes

DimmerService.h File Reference

#include "resource.h"
#import "C:\UPnPSample\SDKDimmer\DimmerDevice\StepByStep\Step2\Debug\upnphost.tlb"

Go to the source code of this file.

Classes

class CDimmerService
Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/StepByStep/Step4/dlldata.c File Reference

  • NetDS
  • upnp
  • StepByStep
  • Step4
Functions

dlldata.c File Reference

#include <rpcproxy.h>

Go to the source code of this file.

Functions

PROXYFILE_LIST_START REFERENCE_PROXY_FILE (upnphost)

Function Documentation

PROXYFILE_LIST_START REFERENCE_PROXY_FILE ( upnphost )
Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/StepByStep/Step4/MyDevice.cpp File Reference

  • NetDS
  • upnp
  • StepByStep
  • Step4
Functions | Variables

MyDevice.cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include "MyDevice.h"
#include "MyDevice_i.c"
#include "Dimmer.h"
#include "DimmerService.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 44 of file MyDevice.cpp.

{
    return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 52 of file MyDevice.cpp.

{
    return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 29 of file MyDevice.cpp.

{
    if (dwReason == DLL_PROCESS_ATTACH)
    {
        _Module.Init(ObjectMap, hInstance, &LIBID_MYDEVICELib);
        DisableThreadLibraryCalls(hInstance);
    }
    else if (dwReason == DLL_PROCESS_DETACH)
        _Module.Term();
    return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 60 of file MyDevice.cpp.

{
    // registers object, typelib and all interfaces in typelib
    return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 69 of file MyDevice.cpp.

{
    return _Module.UnregisterServer(TRUE);
}

Variable Documentation

CComModule _Module

Definition at line 18 of file MyDevice.cpp.

Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/StepByStep/Step4/MyDevice.h File Reference

  • NetDS
  • upnp
  • StepByStep
  • Step4
Classes | Defines | Typedefs | Enumerations | Functions | Variables

MyDevice.h File Reference

#include "rpc.h"
#include "rpcndr.h"
#include "oaidl.h"
#include "ocidl.h"

Go to the source code of this file.

Classes

struct | IUPnPService_DimmingService_SCPDVtbl

Defines

#define | __Dimmer_FWD_DEFINED__
#define | __IUPnPService_DimmingService_SCPD_FWD_DEFINED__
#define | __IUPnPService_DimmingService_SCPD_INTERFACE_DEFINED__
#define | __MYDEVICELib_LIBRARY_DEFINED__
#define | __REQUIRED_RPCNDR_H_VERSION__ 440

Typedefs

typedef struct Dimmer | Dimmer
typedef enum
DIMMINGSERVICE_SCPD_DISPIDS 		DIMMINGSERVICE_SCPD_DISPIDS
typedef interface
IUPnPService_DimmingService_SCPD 		IUPnPService_DimmingService_SCPD
typedef struct
IUPnPService_DimmingService_SCPDVtbl 		IUPnPService_DimmingService_SCPDVtbl

Enumerations

enum DIMMINGSERVICE_SCPD_DISPIDS {
DISPID_POWER = 1, DISPID_DIMLEVEL, DISPID_POWERON, DISPID_POWEROFF,
DISPID_GETPOWERVALUE, DISPID_SETDIMLEVEL, DISPID_GETDIMLEVEL, DISPID_GETCONFIGDETAILS,
DISPID_POWER = 1, DISPID_DIMLEVEL = DISPID_POWER + 1, DISPID_POWERON = DISPID_DIMLEVEL + 1, DISPID_POWEROFF = DISPID_POWERON + 1,
DISPID_GETPOWERVALUE = DISPID_POWEROFF + 1, DISPID_SETDIMLEVEL = DISPID_GETPOWERVALUE + 1, DISPID_GETDIMLEVEL = DISPID_SETDIMLEVEL + 1, DISPID_GETCONFIGDETAILS = DISPID_GETDIMLEVEL + 1,
DISPID_POWER = 1, DISPID_DIMLEVEL = DISPID_POWER + 1, DISPID_POWERON = DISPID_DIMLEVEL + 1, DISPID_POWEROFF = DISPID_POWERON + 1,
DISPID_GETPOWERVALUE = DISPID_POWEROFF + 1, DISPID_SETDIMLEVEL = DISPID_GETPOWERVALUE + 1, DISPID_GETDIMLEVEL = DISPID_SETDIMLEVEL + 1, DISPID_GETCONFIGDETAILS = DISPID_GETDIMLEVEL + 1
}

Functions

HRESULT STDMETHODCALLTYPE | IUPnPService_DimmingService_SCPD_get_dimLevel_Proxy (IUPnPService_DimmingService_SCPD __RPC_FAR *This, long __RPC_FAR *pdimLevel)
void __RPC_STUB | IUPnPService_DimmingService_SCPD_get_dimLevel_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IUPnPService_DimmingService_SCPD_get_Power_Proxy (IUPnPService_DimmingService_SCPD __RPC_FAR *This, VARIANT_BOOL __RPC_FAR *pPower)
void __RPC_STUB | IUPnPService_DimmingService_SCPD_get_Power_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IUPnPService_DimmingService_SCPD_GetConfigDetails_Proxy (IUPnPService_DimmingService_SCPD __RPC_FAR *This, VARIANT_BOOL __RPC_FAR *ppowerVal, long __RPC_FAR *pdLevel)
void __RPC_STUB | IUPnPService_DimmingService_SCPD_GetConfigDetails_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IUPnPService_DimmingService_SCPD_GetDimLevel_Proxy (IUPnPService_DimmingService_SCPD __RPC_FAR *This, long __RPC_FAR *pdLevel)
void __RPC_STUB | IUPnPService_DimmingService_SCPD_GetDimLevel_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IUPnPService_DimmingService_SCPD_GetPowerValue_Proxy (IUPnPService_DimmingService_SCPD __RPC_FAR *This, VARIANT_BOOL __RPC_FAR *ppowerVall)
void __RPC_STUB | IUPnPService_DimmingService_SCPD_GetPowerValue_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IUPnPService_DimmingService_SCPD_PowerOff_Proxy (IUPnPService_DimmingService_SCPD __RPC_FAR *This)
void __RPC_STUB | IUPnPService_DimmingService_SCPD_PowerOff_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IUPnPService_DimmingService_SCPD_PowerOn_Proxy (IUPnPService_DimmingService_SCPD __RPC_FAR *This)
void __RPC_STUB | IUPnPService_DimmingService_SCPD_PowerOn_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IUPnPService_DimmingService_SCPD_SetDimLevel_Proxy (IUPnPService_DimmingService_SCPD __RPC_FAR *This, long dLevel)
void __RPC_STUB | IUPnPService_DimmingService_SCPD_SetDimLevel_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
void __RPC_FAR *__RPC_USER | MIDL_user_allocate (size_t)
void __RPC_USER | MIDL_user_free (void __RPC_FAR *)

Variables

EXTERN_C const CLSID | CLSID_Dimmer
EXTERN_C const IID | IID_IUPnPService_DimmingService_SCPD
EXTERN_C const IID | LIBID_MYDEVICELib
interface
IUPnPService_DimmingService_SCPD
CONST_VTBL struct
IUPnPService_DimmingService_SCPDVtbl
__RPC_FAR * 		lpVtbl

Define Documentation

#define __Dimmer_FWD_DEFINED__

Definition at line 38 of file MyDevice.h.

#define __IUPnPService_DimmingService_SCPD_FWD_DEFINED__

Definition at line 32 of file MyDevice.h.

#define __IUPnPService_DimmingService_SCPD_INTERFACE_DEFINED__

Definition at line 79 of file MyDevice.h.

#define __MYDEVICELib_LIBRARY_DEFINED__

Definition at line 58 of file MyDevice.h.

#define __REQUIRED_RPCNDR_H_VERSION__ 440

Definition at line 16 of file MyDevice.h.

Typedef Documentation

typedef struct Dimmer Dimmer

Definition at line 43 of file MyDevice.h.

typedef enum DIMMINGSERVICE_SCPD_DISPIDS DIMMINGSERVICE_SCPD_DISPIDS
typedef interface IUPnPService_DimmingService_SCPD IUPnPService_DimmingService_SCPD

Definition at line 33 of file MyDevice.h.

typedef struct IUPnPService_DimmingService_SCPDVtbl IUPnPService_DimmingService_SCPDVtbl

Enumeration Type Documentation

enum DIMMINGSERVICE_SCPD_DISPIDS
Enumerator:
DISPID_POWER
DISPID_DIMLEVEL
DISPID_POWERON
DISPID_POWEROFF
DISPID_GETPOWERVALUE
DISPID_SETDIMLEVEL
DISPID_GETDIMLEVEL
DISPID_GETCONFIGDETAILS
DISPID_POWER
DISPID_DIMLEVEL
DISPID_POWERON
DISPID_POWEROFF
DISPID_GETPOWERVALUE
DISPID_SETDIMLEVEL
DISPID_GETDIMLEVEL
DISPID_GETCONFIGDETAILS
DISPID_POWER
DISPID_DIMLEVEL
DISPID_POWERON
DISPID_POWEROFF
DISPID_GETPOWERVALUE
DISPID_SETDIMLEVEL
DISPID_GETDIMLEVEL
DISPID_GETCONFIGDETAILS

Definition at line 64 of file MyDevice.h.

    { DISPID_POWER  = 1,
  DISPID_DIMLEVEL = DISPID_POWER + 1,
  DISPID_POWERON  = DISPID_DIMLEVEL + 1,
  DISPID_POWEROFF = DISPID_POWERON + 1,
  DISPID_GETPOWERVALUE  = DISPID_POWEROFF + 1,
  DISPID_SETDIMLEVEL  = DISPID_GETPOWERVALUE + 1,
  DISPID_GETDIMLEVEL  = DISPID_SETDIMLEVEL + 1,
  DISPID_GETCONFIGDETAILS = DISPID_GETDIMLEVEL + 1
    } DIMMINGSERVICE_SCPD_DISPIDS;

Function Documentation

HRESULT STDMETHODCALLTYPE IUPnPService_DimmingService_SCPD_get_dimLevel_Proxy | ( | IUPnPService_DimmingService_SCPD __RPC_FAR * | This,
 |  | long __RPC_FAR * | pdimLevel
 | ) |  |
void __RPC_STUB IUPnPService_DimmingService_SCPD_get_dimLevel_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IUPnPService_DimmingService_SCPD_get_Power_Proxy | ( | IUPnPService_DimmingService_SCPD __RPC_FAR * | This,
 |  | VARIANT_BOOL __RPC_FAR * | pPower
 | ) |  |
void __RPC_STUB IUPnPService_DimmingService_SCPD_get_Power_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IUPnPService_DimmingService_SCPD_GetConfigDetails_Proxy | ( | IUPnPService_DimmingService_SCPD __RPC_FAR * | This,
 |  | VARIANT_BOOL __RPC_FAR * | ppowerVal,
 |  | long __RPC_FAR * | pdLevel
 | ) |  |
void __RPC_STUB IUPnPService_DimmingService_SCPD_GetConfigDetails_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IUPnPService_DimmingService_SCPD_GetDimLevel_Proxy | ( | IUPnPService_DimmingService_SCPD __RPC_FAR * | This,
 |  | long __RPC_FAR * | pdLevel
 | ) |  |
void __RPC_STUB IUPnPService_DimmingService_SCPD_GetDimLevel_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IUPnPService_DimmingService_SCPD_GetPowerValue_Proxy | ( | IUPnPService_DimmingService_SCPD __RPC_FAR * | This,
 |  | VARIANT_BOOL __RPC_FAR * | ppowerVall
 | ) |  |
void __RPC_STUB IUPnPService_DimmingService_SCPD_GetPowerValue_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IUPnPService_DimmingService_SCPD_PowerOff_Proxy ( IUPnPService_DimmingService_SCPD __RPC_FAR * This )
void __RPC_STUB IUPnPService_DimmingService_SCPD_PowerOff_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IUPnPService_DimmingService_SCPD_PowerOn_Proxy ( IUPnPService_DimmingService_SCPD __RPC_FAR * This )
void __RPC_STUB IUPnPService_DimmingService_SCPD_PowerOn_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IUPnPService_DimmingService_SCPD_SetDimLevel_Proxy | ( | IUPnPService_DimmingService_SCPD __RPC_FAR * | This,
 |  | long | dLevel
 | ) |  |
void __RPC_STUB IUPnPService_DimmingService_SCPD_SetDimLevel_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
void __RPC_FAR* __RPC_USER MIDL_user_allocate ( size_t )

Definition at line 364 of file Picklpc.c.

{
    unsigned char * pcAllocated;
    unsigned char * pcUserPtr;

    pcAllocated = (unsigned char *) malloc( s + 15 );
    pcUserPtr =  ALIGN_TO8( pcAllocated );
    if ( pcUserPtr == pcAllocated )
        pcUserPtr = pcAllocated + 8;

    *(pcUserPtr - 1) = (char) (pcUserPtr - pcAllocated);

    return( pcUserPtr );
}

void __RPC_USER MIDL_user_free ( void __RPC_FAR * )

Definition at line 379 of file Picklpc.c.

{
    unsigned char * pcAllocated;
    unsigned char * pcUserPtr;

    pcUserPtr = (unsigned char *) f;
    pcAllocated = pcUserPtr - *(pcUserPtr - 1);

    free( pcAllocated );
}

Variable Documentation

EXTERN_C const CLSID CLSID_Dimmer

Definition at line 361 of file MyDevice.h.

EXTERN_C const IID IID_IUPnPService_DimmingService_SCPD

Definition at line 85 of file MyDevice.h.

EXTERN_C const IID LIBID_MYDEVICELib

Definition at line 76 of file MyDevice.h.

interface IUPnPService_DimmingService_SCPD CONST_VTBL struct IUPnPService_DimmingService_SCPDVtbl __RPC_FAR* lpVtbl

Definition at line 200 of file MyDevice.h.

Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/StepByStep/Step4/MyDevice.idl File Reference

  • NetDS
  • upnp
  • StepByStep
  • Step4
Classes | Namespaces | Enumerations | Functions

MyDevice.idl File Reference

Go to the source code of this file.

Classes

class | MYDEVICELib::Dimmer
interface | MYDEVICELib::IUPnPService_DimmingService_SCPD

Namespaces

namespace | MYDEVICELib

Enumerations

enum MYDEVICELib::DIMMINGSERVICE_SCPD_DISPIDS {
MYDEVICELib::DISPID_POWER = 1, MYDEVICELib::DISPID_DIMLEVEL, MYDEVICELib::DISPID_POWERON, MYDEVICELib::DISPID_POWEROFF,
MYDEVICELib::DISPID_GETPOWERVALUE, MYDEVICELib::DISPID_SETDIMLEVEL, MYDEVICELib::DISPID_GETDIMLEVEL, MYDEVICELib::DISPID_GETCONFIGDETAILS,
MYDEVICELib::DISPID_POWER = 1, MYDEVICELib::DISPID_DIMLEVEL, MYDEVICELib::DISPID_POWERON, MYDEVICELib::DISPID_POWEROFF,
MYDEVICELib::DISPID_GETPOWERVALUE, MYDEVICELib::DISPID_SETDIMLEVEL, MYDEVICELib::DISPID_GETDIMLEVEL, MYDEVICELib::DISPID_GETCONFIGDETAILS,
MYDEVICELib::DISPID_POWER = 1, MYDEVICELib::DISPID_DIMLEVEL, MYDEVICELib::DISPID_POWERON, MYDEVICELib::DISPID_POWEROFF,
MYDEVICELib::DISPID_GETPOWERVALUE, MYDEVICELib::DISPID_SETDIMLEVEL, MYDEVICELib::DISPID_GETDIMLEVEL, MYDEVICELib::DISPID_GETCONFIGDETAILS
}

Functions

MYDEVICELib::importlib ("stdole32.tlb")
MYDEVICELib::importlib ("stdole2.tlb")
Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/StepByStep/Step4/MyDevice_i.c File Reference

  • NetDS
  • upnp
  • StepByStep
  • Step4
Classes | Defines | Typedefs | Variables

MyDevice_i.c File Reference

Go to the source code of this file.

Classes

struct | _IID

Defines

#define | __IID_DEFINED__
#define | CLSID_DEFINED

Typedefs

typedef IID | CLSID
typedef struct _IID | IID

Variables

const CLSID | CLSID_Dimmer = {0xd31b8f49,0x367e,0x41b7,{0x8f,0xc4,0x50,0xe2,0x3d,0x36,0x62,0x5d}}
const IID | IID_IUPnPService_DimmingService_SCPD = {0xa315fcbd,0x7f4b,0x4081,{0xa1,0x72,0x2f,0x53,0x4c,0x43,0x89,0x57}}
const IID | LIBID_MYDEVICELib = {0x51AC2F4C,0x3F4F,0x48B3,{0xA0,0x18,0x91,0x0E,0x81,0x67,0x7E,0xEF}}

Define Documentation

#define __IID_DEFINED__

Definition at line 21 of file MyDevice_i.c.

#define CLSID_DEFINED

Definition at line 34 of file MyDevice_i.c.

Typedef Documentation

typedef IID CLSID

Definition at line 35 of file MyDevice_i.c.

typedef struct _IID IID

Variable Documentation

const CLSID CLSID_Dimmer = {0xd31b8f49,0x367e,0x41b7,{0x8f,0xc4,0x50,0xe2,0x3d,0x36,0x62,0x5d}}

Definition at line 44 of file MyDevice_i.c.

const IID IID_IUPnPService_DimmingService_SCPD = {0xa315fcbd,0x7f4b,0x4081,{0xa1,0x72,0x2f,0x53,0x4c,0x43,0x89,0x57}}

Definition at line 41 of file MyDevice_i.c.

const IID LIBID_MYDEVICELib = {0x51AC2F4C,0x3F4F,0x48B3,{0xA0,0x18,0x91,0x0E,0x81,0x67,0x7E,0xEF}}

Definition at line 38 of file MyDevice_i.c.

Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/StepByStep/Step4/resource.h File Reference

  • NetDS
  • upnp
  • StepByStep
  • Step4
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_DIMMER 101
#define | IDR_DIMMERSERVICE 102
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_DIMMER 101

Definition at line 6 of file resource.h.

#define IDR_DIMMERSERVICE 102

Definition at line 7 of file resource.h.

#define IDS_PROJNAME 100

Definition at line 5 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/StepByStep/Step4/StdAfx.cpp File Reference

  • NetDS
  • upnp
  • StepByStep
  • Step4

StdAfx.cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/upnp/StepByStep/Step4/StdAfx.h File Reference

  • NetDS
  • upnp
  • StepByStep
  • Step4
Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0400
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 16 of file StdAfx.h.

#define _WIN32_WINNT 0x0400

Definition at line 14 of file StdAfx.h.

#define STRICT

Definition at line 12 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinNT/NetApi/ChngPass/ChngPass.c File Reference

  • NetDS
  • WinNT
  • NetApi
  • ChngPass
Defines | Functions

ChngPass.c File Reference

#include <windows.h>
#include <stdio.h>
#include <lm.h>

Go to the source code of this file.

Defines

#define | RTN_ERROR 13
#define | RTN_OK 0
#define | RTN_USAGE 1

Functions

void | DisplayErrorText (DWORD dwLastError)
int __cdecl | wmain (int argc, wchar_t *argv[])

Define Documentation

#define RTN_ERROR 13

Definition at line 53 of file ChngPass.c.

#define RTN_OK 0

Definition at line 51 of file ChngPass.c.

#define RTN_USAGE 1

Definition at line 52 of file ChngPass.c.

Function Documentation

void DisplayErrorText ( DWORD dwLastError )

Definition at line 181 of file ChngPass.c.

{
    HMODULE hModule = NULL; // default to system source
    LPSTR MessageBuffer;
    DWORD dwBufferLength;
    DWORD dwFormatFlags;

    dwFormatFlags = FORMAT_MESSAGE_ALLOCATE_BUFFER |
                    FORMAT_MESSAGE_IGNORE_INSERTS |
                    FORMAT_MESSAGE_FROM_SYSTEM ;

    //
    // if dwLastError is in the network range, load the message source
    //
    if (dwLastError >= NERR_BASE && dwLastError <= MAX_NERR)
    {

        TCHAR tcharPath[MAX_PATH+1];  // Space for the System32 path, the DLL, and the Null termination
        UINT  uiRet;                  // Length of the System32 Path returned by GetSystemDirectory

        // We know our DLL lives in the System32 directory, get the path and build the correct path
        // To make sure everything fits within our buffer, pass in the size of MAX_PATH minus the size of
        // our dll string.
        uiRet = GetSystemDirectory(tcharPath, MAX_PATH - 10 );

        // Make sure the call succeeded
        if ( (MAX_PATH - 10 > uiRet) && (0 != uiRet) )
        {
            // Concatenate the dll to our string
            lstrcat(tcharPath, TEXT("\\netmsg.dll") );

            // Call LoadLibraryEX with the complete path
            hModule = LoadLibraryEx(
                                   tcharPath,       // the complete path to the netmsg.dll
                                   NULL,
                                   LOAD_LIBRARY_AS_DATAFILE
                                   );

        }
        // Did the LoadLibrary Succeed
        if (hModule != NULL)
            dwFormatFlags |= FORMAT_MESSAGE_FROM_HMODULE;

    }

    //
    // call FormatMessage() to allow for message text to be acquired
    // from the system or the supplied module handle
    //
    if(dwBufferLength = FormatMessageA(
        dwFormatFlags,
        hModule, // module to get message from (NULL == system)
        dwLastError,
        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // default language
        (LPSTR) &MessageBuffer,
        0,
        NULL
        ))
    {
        DWORD dwBytesWritten;

        //
        // Output message string on stderr
        //
        WriteFile(
            GetStdHandle(STD_ERROR_HANDLE),
            MessageBuffer,
            dwBufferLength,
            &dwBytesWritten,
            NULL
            );

        //
        // free the buffer allocated by the system
        //
        LocalFree(MessageBuffer);
    }

    //
    // if we loaded a message source, unload it
    //
    if(hModule != NULL)
        FreeLibrary(hModule);
}

int __cdecl wmain | ( | int | argc,
 |  | wchar_t * | argv[]
 | ) |  |

Definition at line 66 of file ChngPass.c.

{
    LPWSTR          wUserName;
    LPWSTR          wComputerName = NULL; // default to local machine
    LPWSTR          wOldPassword;
    LPWSTR          wNewPassword;
    USER_INFO_1003  pi1003;
    NET_API_STATUS  nas;

    if( argc < 3 ) {
        fprintf(stderr, "Usage: %ls <user> <new_password> "
                        "[\\\\machine | domain] [old_password]\n",
                        argv[0]);
        return RTN_USAGE;
    }

    //
    // process command line arguments
    //

    wUserName = argv[1];
    wNewPassword = argv[2];

    if( argc >= 4 && *argv[3] != L'\0' ) {

        //
        // obtain target machine name, if appropriate
        // always in Unicode, as that is what the API takes
        //

        if(argv[3][0] == L'\\' && argv[3][1] == L'\\') {

            //
            // target specified machine name
            //

            wComputerName = argv[3];
        }
        else {

            //
            // the user specified a domain name.  Lookup the PDC
            //

            nas = NetGetDCName(
                NULL,
                argv[3],
                (LPBYTE *)&wComputerName
                );

            if(nas != NERR_Success) {
                DisplayErrorText( nas );
                return RTN_ERROR;
            }
        }
    }

    if(argc == 5) {
        wOldPassword = argv[4];
    } else {
        wOldPassword = NULL;
    }

    if(wOldPassword == NULL) {

        //
        // administrative over-ride of existing password
        //

        pi1003.usri1003_password = wNewPassword;

        nas = NetUserSetInfo(
                wComputerName,  // computer name
                wUserName,      // username
                1003,           // info level
                (LPBYTE)&pi1003,     // new info
                NULL
                );
    } else {

        //
        // allows user to change their own password
        //

        nas = NetUserChangePassword(
                wComputerName,
                wUserName,
                wOldPassword,
                wNewPassword
                );
    }

    if(wComputerName != NULL && wComputerName != argv[3]) {

        //
        // a buffer was allocated for the PDC name, free it
        //

        NetApiBufferFree(wComputerName);
    }

    if(nas != NERR_Success) {
        DisplayErrorText( nas );
        return RTN_ERROR;
    }

    return RTN_OK;
}

Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinNT/NetApi/NetShare/NetShare.c File Reference

  • NetDS
  • WinNT
  • NetApi
  • NetShare
Defines | Functions

NetShare.c File Reference

#include <windows.h>
#include <lm.h>
#include <stdio.h>

Go to the source code of this file.

Defines

#define | RTN_ERROR 13
#define | RTN_OK 0
#define | RTN_USAGE 1
#define | SID_SIZE 96

Functions

int __cdecl | wmain (int argc, wchar_t *argv[])

Define Documentation

#define RTN_ERROR 13

Definition at line 28 of file NetShare.c.

#define RTN_OK 0

Definition at line 26 of file NetShare.c.

#define RTN_USAGE 1

Definition at line 27 of file NetShare.c.

#define SID_SIZE 96

Function Documentation

int __cdecl wmain | ( | int | argc,
 |  | wchar_t * | argv[]
 | ) |  |

Definition at line 37 of file NetShare.c.

{
    LPWSTR DirectoryToShare;
    LPWSTR Sharename;
    LPWSTR Username;
    LPWSTR Server;

    PSID pSid = NULL;
    DWORD cbSid;

    WCHAR RefDomain[DNLEN + 1];
    DWORD cchDomain = DNLEN + 1;
    SID_NAME_USE peUse;

    SECURITY_DESCRIPTOR sd;
    PACL pDacl = NULL;
    DWORD dwAclSize;

    SHARE_INFO_502 si502;
    NET_API_STATUS nas;

    BOOL bSuccess = FALSE; // assume this function fails

    if(argc < 4) {
        printf("Usage: %ls <directory> <sharename> <user/group> [\\\\Server]\n", argv[0]);
        printf(" directory is fullpath of directory to share\n");
        printf(" sharename is name of share on server\n");
        printf(" user/group is an WinNT user/groupname (REDMOND\\sfield, Administrators, etc)\n");
        printf(" optional Server is the name of the computer to create the share on\n");
        printf("\nExample: %ls c:\\public public Everyone\n", argv[0]);
        printf("c:\\public shared as public granting Everyone full access\n");
        printf("\nExample: %ls c:\\private cool$ REDMOND\\sfield \\\\WINBASE\n", argv[0]);
        printf("c:\\private on \\\\WINBASE shared as cool$ (hidden) granting REDMOND\\sfield access\n");

        return RTN_USAGE;
    }

    //
    // since the commandline was Unicode, just provide pointers to
    // the relevant items
    //

    DirectoryToShare = argv[1];
    Sharename = argv[2];
    Username = argv[3];

    if( argc > 4 ) {
        Server = argv[4];
    } else {
        Server = NULL; // local machine
    }

    //
    // initial allocation attempt for Sid
    //
#define SID_SIZE 96
    cbSid = SID_SIZE;

    pSid = (PSID)HeapAlloc(GetProcessHeap(), 0, cbSid);
    if(pSid == NULL) {
        printf("HeapAlloc error!\n");
        return RTN_ERROR;
    }

    //
    // get the Sid associated with the supplied user/group name
    // force Unicode API since we always pass Unicode string
    //

    if(!LookupAccountNameW(
        NULL,       // default lookup logic
        Username,   // user/group of interest from commandline
        pSid,       // Sid buffer
        &cbSid,     // size of Sid
        RefDomain,  // Domain account found on (unused)
        &cchDomain, // size of domain in chars
        &peUse
        )) {

        //
        // if the buffer wasn't large enough, try again
        //

        if(GetLastError() == ERROR_INSUFFICIENT_BUFFER) {

            PSID psidTemp;

            psidTemp = (PSID)HeapReAlloc(GetProcessHeap(), 0, pSid, cbSid);

            if(psidTemp == NULL) {
                printf("HeapReAlloc error!\n");
                goto cleanup;
            }
            else
            {
                pSid = psidTemp;
            }

            cchDomain = DNLEN + 1;

            if(!LookupAccountNameW(
                NULL,       // default lookup logic
                Username,   // user/group of interest from commandline
                pSid,       // Sid buffer
                &cbSid,     // size of Sid
                RefDomain,  // Domain account found on (unused)
                &cchDomain, // size of domain in chars
                &peUse
                )) {
                    printf("LookupAccountName error! (rc=%lu)\n", GetLastError());
                    goto cleanup;
                }

        } else {
            printf("LookupAccountName error! (rc=%lu)\n", GetLastError());
            goto cleanup;
        }
    }

    //
    // compute size of new acl
    //

    dwAclSize = sizeof(ACL) +
        1 * ( sizeof(ACCESS_ALLOWED_ACE) - sizeof(DWORD) ) +
        GetLengthSid(pSid) ;

    //
    // allocate storage for Acl
    //

    pDacl = (PACL)HeapAlloc(GetProcessHeap(), 0, dwAclSize);
    if(pDacl == NULL) goto cleanup;

    if(!InitializeAcl(pDacl, dwAclSize, ACL_REVISION))
        goto cleanup;

    //
    // grant GENERIC_ALL (Full Control) access
    //

    if(!AddAccessAllowedAce(
        pDacl,
        ACL_REVISION,
        GENERIC_ALL,
        pSid
        )) goto cleanup;

    if(!InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION))
        goto cleanup;

    if(!SetSecurityDescriptorDacl(&sd, TRUE, pDacl, FALSE)) {
        fprintf(stderr, "SetSecurityDescriptorDacl error! (rc=%lu)\n",
            GetLastError());
        goto cleanup;
    }

    //
    // setup share info structure
    //

    si502.shi502_netname = (LMSTR) Sharename;
    si502.shi502_type = STYPE_DISKTREE;
    si502.shi502_remark = NULL;
    si502.shi502_permissions = 0;
    si502.shi502_max_uses = SHI_USES_UNLIMITED;
    si502.shi502_current_uses = 0;
    si502.shi502_path = (LMSTR) DirectoryToShare;
    si502.shi502_passwd = NULL;
    si502.shi502_reserved = 0;
    si502.shi502_security_descriptor = &sd;

    nas = NetShareAdd(
        (LMSTR) Server,         // share is on local machine
        502,            // info-level
        (LPBYTE)&si502, // info-buffer
        NULL            // don't bother with parm
        );

    if(nas != NO_ERROR) {
        printf("NetShareAdd error! (rc=%lu)\n", nas);
        goto cleanup;
    }

    bSuccess = TRUE; // indicate success

cleanup:

    //
    // free allocated resources
    //
    if(pDacl != NULL)
        HeapFree(GetProcessHeap(), 0, pDacl);

    if(pSid != NULL)
        HeapFree(GetProcessHeap(), 0, pSid);

    if(!bSuccess) {
        return RTN_ERROR;
    }

    return RTN_OK;
}

Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/Accept/ASAccept.cpp File Reference

  • NetDS
  • WinSock
  • Accept
Functions

ASAccept.cpp File Reference

#include "common.h"

Go to the source code of this file.

Functions

void | AsyncSelectAcceptMain ()
HWND | CreateAcceptWindow (void)
const char * | FDImage (long lEvent)
LRESULT CALLBACK | MainWndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
void | ProcessAsyncSelectMessage (WPARAM wParam, LPARAM lParam)

Function Documentation

void AsyncSelectAcceptMain ( )

Definition at line 347 of file ASAccept.cpp.

{
    PSOCK_INFO pSockInfo;
    int rc;
    MSG msg;

    printf("Entering AsyncSelectAcceptMain()\n");

    // create a dummy hidden window to receive the async select messages.
    g_AcceptContext.hAcceptWindow = CreateAcceptWindow();
    if (g_AcceptContext.hAcceptWindow == NULL)
    {
        printf("Error in creating the accept window.\n");
        goto CLEANUP;
    }

    // Set for all the listening sockets to be signalled on FD_ACCEPT event.
    for(pSockInfo = g_AcceptContext.pSockList; pSockInfo != NULL;
                                               pSockInfo = pSockInfo->next)
    {
        // request asynchronous notifications for the FD_ACCEPT and FD_CLOSE
        // events to be sent to the hAcceptWindow for this sock.
        rc = WSAAsyncSelect(pSockInfo->sock,
                            g_AcceptContext.hAcceptWindow,
                            WM_USER_ASYNCSELECT_MSG,
                            FD_ACCEPT | FD_CLOSE);
        if (rc == SOCKET_ERROR)
        {
            printf("ERROR: WSAAsyncSelect failed for sock %d. Error = %d\n",
                                    pSockInfo->sock, WSAGetLastError());
            continue;
        }
    }

    // Main message loop to process messages to the Accept Window.
    // This will indirectly call MainWndProc which will in turn call
    // ProcessAsyncSelectMessage.
    while (GetMessage(&msg, (HWND) NULL, 0, 0)) {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }

CLEANUP:

    printf("Exiting AsyncSelectAcceptMain()\n");
    return ;
}

HWND CreateAcceptWindow ( void )

Definition at line 290 of file ASAccept.cpp.

{
  WNDCLASS window;
  HWND windowHandle = NULL;

    // set the window properties.
  memset(&window, 0, sizeof(WNDCLASS));
  window.lpszClassName = "Accept Window";
  window.hInstance = NULL;
  window.lpfnWndProc = (WNDPROC) MainWndProc;
  window.hCursor = NULL;
  window.hIcon = NULL;
  window.lpszMenuName = NULL;
  window.hbrBackground = NULL;
  window.style = 0;
  window.cbClsExtra = 0;
  window.cbWndExtra = 0;

  // register the window class.
  if (!RegisterClass(&window)) {
    printf("Registerclass failed %d\n", GetLastError());
        goto CLEANUP;
  }

  // create the window.
  windowHandle = CreateWindow("Accept Window",
                "Accept Window",
                WS_OVERLAPPEDWINDOW,  //WS_MINIMIZE,
                CW_USEDEFAULT,
                CW_USEDEFAULT,
                CW_USEDEFAULT,
                CW_USEDEFAULT,
                (HWND) NULL,
                (HMENU) NULL,
                (HINSTANCE) NULL,
                (LPVOID) NULL);

  // check if a window was created.
  if (windowHandle == NULL)
  {
    printf("CreateWindow failed %d\n", GetLastError());
    return NULL;
  }

    // uncomment the line below to see the window on the taskbar.
    // ShowWindow(windowHandle, SW_MINIMIZE);

CLEANUP:

  return windowHandle;
}

const char* FDImage ( long lEvent )

Definition at line 21 of file ASAccept.cpp.

{
    const char *szRetVal;

    // return the printable strings corresponding to the event.
    switch(lEvent)
    {
        case FD_READ:       szRetVal = "FD_READ";
                            break;
        case FD_WRITE:      szRetVal = "FD_WRITE";
                            break;
        case FD_ACCEPT:     szRetVal = "FD_ACCEPT";
                            break;
        case FD_CLOSE:      szRetVal = "FD_CLOSE";
                            break;
        default:            szRetVal = "Unexpected";
                            break;
    }

    return szRetVal;
}

LRESULT CALLBACK MainWndProc | ( | HWND | hWnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 259 of file ASAccept.cpp.

{
    LRESULT res = 0;

    // check what the message type is.
    switch (message) {

        case WM_DESTROY:
        PostQuitMessage(0);
            break;

      // this is the message that that we gave in WSAAsyncSelect which
      // winsock will send us back for notifying us of socket events.
        case WM_USER_ASYNCSELECT_MSG:
          ProcessAsyncSelectMessage(wParam, lParam);
        break;

      default:
        res = DefWindowProc(hWnd, message, wParam, lParam);
            break;
    }

  return res;
}

void ProcessAsyncSelectMessage | ( | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 50 of file ASAccept.cpp.

{
    // get the socket handle from wParam.
    SOCKET sock = (SOCKET) wParam;

    // get the type of event using the macro below.
    long event = WSAGETSELECTEVENT(lParam);

    // get the error associated with the event, if any, using the macro below.
    int error = WSAGETSELECTERROR(lParam);
    BOOL bSocketToBeClosed = FALSE;
    PSOCK_INFO pSockInfo;
    int rc;

    printf("Entering ProcessAsyncSelectMessage() for "
           "Sock = %d, Event = %s, Error = %d\n",
            sock, FDImage(event), error);

    // first, get the SockInfo object corresponding to the signalled socket
    // to retrieve the context of this socket.
    for(pSockInfo = g_AcceptContext.pSockList;pSockInfo;
                                              pSockInfo = pSockInfo->next)
    {
        if (sock == pSockInfo->sock)
            break; // found.
    }

    // check if we found one.
    if (!pSockInfo)
    {
        // no, we couldn't find one. This will happen usually because of
        // dummy FD_READs that we are posting which might show up even
        // after we closed the socket and removed the SockInfo structure
        // from the global sockets list. This condition is not an error,
        // but a normal timing condition. So, we don't have to do anything
        // with this socket.
        printf("Couldn't find SockInfo. Socket might have been closed.\n");
        goto CLEANUP;
    }

    // if we were signalled an error event instead of a positive event
    // then we don't have to process the socket.
    if (error)
    {
        // some error has happened on this socket.
        // need to close the socket.
        bSocketToBeClosed = TRUE;
        goto CLEANUP;
    }

    // take the corresponding action depending on the event signalled.
    switch(event)
    {
        case FD_ACCEPT:

            // Accept the new connection.
            pSockInfo = ProcessAcceptEvent(pSockInfo);
            if (pSockInfo == NULL)
            {
                // some error in accepting the connection or allocating
                // resources for the new socket.
                break;
            }

            // request the specified events to be notified asynchronously
            // to the hAcceptWindow for the given sock.
            rc = WSAAsyncSelect(pSockInfo->sock,
                                g_AcceptContext.hAcceptWindow,
                                WM_USER_ASYNCSELECT_MSG,
                                FD_READ | FD_WRITE | FD_CLOSE);

            // check if the request went through.
            if (rc == SOCKET_ERROR)
            {
                printf("ERROR: WSAAsyncSelect failed on sock %d. Error = %d\n",
                       pSockInfo->sock, WSAGetLastError());
                bSocketToBeClosed = TRUE;
            }
            break;

        case FD_READ:

            // Read data from the socket, if there's room for the new data.
            bSocketToBeClosed = ProcessReadEvent(pSockInfo);

            // check if the recv call indicated that the remote side has closed
            // the socket and that we should also close it.
            if (bSocketToBeClosed == FALSE)
            {
                // no, it didn't. so, go ahead and echo the received data back
                // if possible.
                bSocketToBeClosed = SendData(pSockInfo);

                // check if the echo was successful.
                if (bSocketToBeClosed == FALSE)
                {
                    // yes it was.
                    // now, if this happens to be the last piece of the
                    // incoming data, and a FD_CLOSE was already notified to
                    // us, we may not receive any more FD_READ notifications.
                    // So, we need to post a dummy FD_READ notification to
                    // this socket so that we again do a recv until we get
                    // a 0 from recv, which means graceful disconnect from
                    // other side or until we receive an error from recv.
                    if (pSockInfo->isFdCloseRecd)
                    {
                        // post ourselves another FD_READ in case
                        // there's no data left.
                        printf("Posting a dummy FD_READ \n");
                        PostMessage(g_AcceptContext.hAcceptWindow,
                                    WM_USER_ASYNCSELECT_MSG,
                                    pSockInfo->sock,
                                    FD_READ);
                    }
                }
            }
            break;

        case FD_WRITE:

            // since we usually echo the data immediately after receiving it
            // in the FD_READ case above, we may not need this case, except
            // for one important condition: when send fails with WSAEWOULDBLOCK
            // then we'll be notified with this event once the remote side
            // has started consuming the data and we can continue our send.
            bSocketToBeClosed = SendData(pSockInfo);

            // in this case, most likely, while the previous data wasn't
            // sent, there would have been a FD_READ which didn't result
            // in a recv call. Hence, there won't be another FD_READ posted
            // unless we call recv. So, we post a dummy FD_READ ourselves
            // to allow the FD_READ handling code to be explicitly called.

            // Note: In a real implementation, we would have to maintain
            // more elaborate state to avoid posting these possibly redundant
            // window messages.

            printf("Posting a dummy FD_READ \n");
            PostMessage(g_AcceptContext.hAcceptWindow,
                        WM_USER_ASYNCSELECT_MSG,
                        pSockInfo->sock,
                        FD_READ);

            break;

        case FD_CLOSE:

            // even though the remote side has closed the socket, there might
            // still be data that's left to read. so, we should just remember
            // that we received a FD_CLOSE but not close the socket until
            // we have read all the data.
            pSockInfo->isFdCloseRecd = TRUE;

            // post ourselves another FD_READ in case there's no data
            // left in which case, we'll actually close the socket when recv
            // returns 0.
            printf("Posting a dummy FD_READ \n");
            PostMessage(g_AcceptContext.hAcceptWindow,
                        WM_USER_ASYNCSELECT_MSG,
                        pSockInfo->sock,
                        FD_READ);

            break;

        default:
            printf("Unexpected event: 0x%x for socket %d\n", event, sock);
            bSocketToBeClosed = TRUE;
            break;
    }

CLEANUP:

    // if we were told in any of the above cases to close the socket,
    // e.g. remote side closed and we got an error or recv returned 0,etc.
    // then we close our socket.
    if (bSocketToBeClosed)
    {
        // make sure we cancel the WSAAsyncSelect event with the event mask 0.
        WSAAsyncSelect(pSockInfo->sock, g_AcceptContext.hAcceptWindow, 0, 0);

        // shutdown the socket so as not to hang the client just in case it
        // expects us to send any more data.
        if (shutdown(pSockInfo->sock, SD_SEND) == SOCKET_ERROR)
            printf("ERROR: Shutdown failed. Error = %d\n", WSAGetLastError());

        // close the socket.
        closesocket(pSockInfo->sock);
        printf("Closed socket %d. "
               "Total Bytes Recd = %d, "
               "Total Bytes Sent = %d\n",
                pSockInfo->sock,
                pSockInfo->nTotalRecd,
                pSockInfo->nTotalSent);

        // delete it from the global list and free the memory.
        DeleteSockInfoFromList(&g_AcceptContext.pSockList,
                               pSockInfo);
    }

    printf("Exiting ProcessAsyncSelectMessage()\n");
  return ;
}

Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/Accept/common.cpp File Reference

  • NetDS
  • WinSock
  • Accept
Functions

common.cpp File Reference

#include "common.h"

Go to the source code of this file.

Functions

void | CreateListeningSockets ()
void | DestroyListeningSockets ()
void | PrintAddressString (LPSOCKADDR pSockAddr, DWORD dwSockAddrLen)
PSOCK_INFO | ProcessAcceptEvent (PSOCK_INFO pSockInfo)
BOOL | ProcessReadEvent (PSOCK_INFO pSockInfo)
BOOL | SendData (PSOCK_INFO pSockInfo)

Function Documentation

void CreateListeningSockets ( )

Definition at line 60 of file common.cpp.

{
    struct addrinfo hints;
    struct addrinfo *res;
    struct addrinfo *pAddr;
    SOCKET newSock;
    PSOCK_INFO pNewSockInfo;
    int i;
    unsigned long nonBlocking = 1;

    printf("Entering CreateListeningSockets()\n");

    printf("Creating the list of sockets to listen for ...\n");

    // prepare the hints for the type of socket we are interested in.
    memset(&hints, 0, sizeof(hints));
    hints.ai_family = g_AcceptContext.addressFamily;
    hints.ai_protocol = IPPROTO_TCP;
    hints.ai_socktype = SOCK_STREAM;
    hints.ai_flags = AI_PASSIVE; // since we're going to bind on this socket.

    // getaddrinfo is the protocol independent version of GetHostByName.
    // the res contains the result.
    if (getaddrinfo(g_AcceptContext.szInterface,
                g_AcceptContext.szPort,
                &hints,
                &res) != NO_ERROR)
    {
        printf("getaddrinfo failed. Error = %d\n", WSAGetLastError());
        goto CLEANUP;
    }

    if (res == NULL)
    {
        printf("getaddrinfo returned res = NULL\n");
        goto CLEANUP;
    }

    printf("getaddrinfo successful.Enumerating the returned addresses ...\n\n");

    // for each returned interface, create a listening socket.
    for (pAddr = res, i = 1; pAddr != NULL; pAddr = pAddr->ai_next, i++)
    {
        printf("Processing Address %d returned by getaddrinfo : ", i);
        PrintAddressString(pAddr->ai_addr, pAddr->ai_addrlen);

        // create a suitable socket for this interface.
        newSock = WSASocket(pAddr->ai_family,
                            pAddr->ai_socktype,
                            pAddr->ai_protocol,
                            NULL,
                            NULL,
                            0);
        if (newSock == INVALID_SOCKET)
        {
            printf("WSASocket failed. Error = %d\n", WSAGetLastError());
            printf("Ignoring this address and continuing with the next. \n\n");

            // anyway, let's continue with other addresses.
            continue;
        }

        printf("Created socket with handle = %d\n", newSock);

        // bind the socket.
        if (bind(newSock, pAddr->ai_addr, pAddr->ai_addrlen) != NO_ERROR)
        {
            printf("bind failed. Error = %d\n", WSAGetLastError());
            closesocket(newSock);
            continue;
        }

        printf("Socket bound successfully\n");

        // listen for upto MAX_CLIENTS number of clients.
        if (listen(newSock, MAX_CLIENTS) != NO_ERROR)
        {
            printf("listen failed. Error = %d\n", WSAGetLastError());
            closesocket(newSock);
            continue;
        }

        printf("Listen successful\n");

        // for non-blocking select, we need to explicitly make the socket
        // non-blocking by this call, whereas for WSAAsyncSelect this is
        // not required as WSAAsyncSelect itself makes the socket non-blocking.
        if (g_AcceptContext.typeOfAccept == NON_BLOCKING_ACCEPT)
        {
            if (ioctlsocket(newSock, FIONBIO, &nonBlocking) == SOCKET_ERROR)
            {
                printf("Can't put socket into non-blocking mode. Error = %d\n",
                        WSAGetLastError());
            }
        }

        // allocate a socket info and store this socket.
        pNewSockInfo = AllocAndInitSockInfo();
        if (pNewSockInfo == NULL)
        {
            printf("AllocAndInitSockInfo failed.\n");
            closesocket(newSock);
            continue;
        }

        pNewSockInfo->sock = newSock;
        pNewSockInfo->isSocketListening = TRUE;

        // all went well. add this to the list of listening sockets.
        AddSockInfoToList(&g_AcceptContext.pSockList, pNewSockInfo);
        printf("Added socket to list of listening sockets\n\n");
    }

CLEANUP:

    // if getaddrinfo was successful, it would have allocated memory for the
    // res pointer which needs to be freed.
    if (res)
    {
        freeaddrinfo(res);
        printf("Freed the memory allocated for res by getaddrinfo\n");
    }

    printf("Exiting CreateListeningSockets()\n");
    return;
}

void DestroyListeningSockets ( )

Definition at line 193 of file common.cpp.

{
    PSOCK_INFO pSockInfo,
               pNextSockInfo;

    printf("Entering DestroyListeningSockets()\n");

    // iterate through all the listening sockets and free one by one.
    pSockInfo = g_AcceptContext.pSockList;
    while (pSockInfo != NULL)
    {
        // if the socket hasn't been closed already, close it.
        if (pSockInfo->sock != INVALID_SOCKET)
        {
            closesocket(pSockInfo->sock);
            printf("Closed socket with handle %d\n", pSockInfo->sock);
        }

        // free this socket and go to the next.
        pNextSockInfo = pSockInfo->next;
        FreeSockInfo(pSockInfo);
        pSockInfo = pNextSockInfo;
    }

    printf("Exiting DestroyListeningSockets()\n");
    return ;
}

void PrintAddressString | ( | LPSOCKADDR | pSockAddr,
 |  | DWORD | dwSockAddrLen
 | ) |  |

Definition at line 26 of file common.cpp.

{
    // INET6_ADDRSTRLEN is the maximum size of a valid IPv6 address
    // including port,colons,NULL,etc.
    char buf[INET6_ADDRSTRLEN];
    DWORD dwBufSize = 0;

    memset(buf,0,sizeof(buf));
    dwBufSize = sizeof(buf);

    // This function converts the pSockAddr to a printable format into buf.
    if (WSAAddressToString(pSockAddr,
                           dwSockAddrLen,
                           NULL,
                           buf,
                           &dwBufSize) == SOCKET_ERROR)
    {
        printf("ERROR: WSAAddressToString failed %d \n", WSAGetLastError());
        goto CLEANUP;
    }

    printf("%s\n", buf);

CLEANUP:
    return;
}

PSOCK_INFO ProcessAcceptEvent ( PSOCK_INFO pSockInfo )

Definition at line 227 of file common.cpp.

{
    SOCKADDR_STORAGE clientAddress;
    int clientAddressLen = sizeof(clientAddress);
    SOCKET newSock;
    PSOCK_INFO pNewSockInfo = NULL;
    unsigned long nonBlocking = 1;

    printf("Entering ProcessAcceptEvent() on socket %d\n", pSockInfo->sock);

    // accept the new connection.
    newSock = WSAAccept(pSockInfo->sock,
                  (LPSOCKADDR)&clientAddress,
                  &clientAddressLen,
                  NULL,
                  NULL);
    if (newSock == INVALID_SOCKET)
    {
        printf("ERROR: WSAAccept failed. Error = %d\n", WSAGetLastError());
        goto CLEANUP;
    }

    printf("Accepted connection from client:");
    PrintAddressString((LPSOCKADDR) &clientAddress, clientAddressLen);

    // set the connected socket to non-blocking mode.
    if (ioctlsocket(pSockInfo->sock, FIONBIO, &nonBlocking) == SOCKET_ERROR)
    {
        printf("Can't put socket into non-blocking mode. Error = %d\n",
                WSAGetLastError());
    }

    // add this socket to the global sockets list.
    pNewSockInfo = AllocAndInitSockInfo();
    if (pNewSockInfo == NULL)
    {
        printf("AllocAndInitSockInfo failed.\n");
        closesocket(newSock);
        goto CLEANUP;
    }

    pNewSockInfo->sock = newSock;
    pNewSockInfo->isSocketListening = FALSE;
    AddSockInfoToList(&g_AcceptContext.pSockList, pNewSockInfo);
    printf("Added accepted socket %d to list of sockets\n", newSock);

CLEANUP:
    printf("Exiting ProcessAcceptEvent()\n");
    return pNewSockInfo;
}

BOOL ProcessReadEvent ( PSOCK_INFO pSockInfo )

Definition at line 284 of file common.cpp.

{
    BOOL bSocketError = FALSE;
    int nBytesRecd;
    int err;

    printf("Entering ProcessReadEvent() on socket %d\n", pSockInfo->sock);

    // check if the previously received data has been fully sent or not.
    if (pSockInfo->recdData.isNewData)
    {
        printf("Previously recd data not yet fully sent.\n");
        // here, since we are using only a fixed buffer size for outstanding
        // sends, we're not reading the data and hence there might be a
        // deadlock if the remote side only sends but doesn't receive at all.
        // also, if the remote side has closed without reading all the
        // data in the pipe, we may not know about it as we might get the
        // FD_CLOSE event only after all the FD_READ events have been
        // processed. so, to avoid these, the app should implement a timeout
        // on each socket so that malicious clients don't make the server
        // run out of resources and do a denial-of-service attack.

        // on the other hand, if we dynamically allocated memory for each
        // recv and queued it, we may not hit this deadlock, but still such
        // malicious clients can send too many data and not read at all and
        // thus perform a denial-of-service attack by making server run out
        // of memory. so, there has to be a upper limit for per-socket
        // memory usage or timeout to avoid such attacks.
        Sleep(2000);
        goto CLEANUP;
    }

    // previous data fully sent, now, recv the new data.
    memset(&pSockInfo->recdData,0,sizeof(pSockInfo->recdData));

    nBytesRecd = recv(pSockInfo->sock,
                      pSockInfo->recdData.buf,
                      RECV_DATA_SIZE - 1,
                      0);
    if (nBytesRecd < 0)
    {
        err = WSAGetLastError();
        if (err == WSAEWOULDBLOCK)
        {
            printf("recv got WSAEWOULDBLOCK. Will retry recv later ...\n");
            bSocketError = FALSE; // not a real error.
        }
        else
        {
            printf("ERROR: recv failed. error = %d\n", err);
            bSocketError = TRUE;
        }
        goto CLEANUP;
    }
    if (nBytesRecd == 0)
    {
        printf("recv returned 0. Remote side has closed gracefully. Good.\n");
        bSocketError = TRUE;
        goto CLEANUP;
    }

    // update the stats.
    pSockInfo->recdData.dataSize = nBytesRecd;
    pSockInfo->nTotalRecd += nBytesRecd;
    pSockInfo->recdData.isNewData = TRUE;

    printf("Received data = %s, length = %d\n", pSockInfo->recdData.buf,
                                                nBytesRecd);

CLEANUP:

    printf("Exiting ProcessReadEvent()\n");
    return bSocketError;

}

BOOL SendData ( PSOCK_INFO pSockInfo )

Definition at line 368 of file common.cpp.

{
    BOOL bSocketError = FALSE;
    int nBytesSent;
    int err;

    printf("Entering SendData() on socket %d\n", pSockInfo->sock);

    // check if there's any data received in the buffer after the last one
    // we sent out.
    if (!pSockInfo->recdData.isNewData || pSockInfo->recdData.dataSize <= 0)
    {
        printf("No data pending to be sent.\n");
        goto CLEANUP;
    }

    // if the data buffer contains new data, begin sending from the start
    // otherwise, begin sending from the point we left in the last call.
    nBytesSent = send(pSockInfo->sock,
                      pSockInfo->recdData.buf + pSockInfo->recdData.sendOffset,
                      pSockInfo->recdData.dataSize,
                      0);
    if (nBytesSent == SOCKET_ERROR)
    {
        err = WSAGetLastError();
        if (err == WSAEWOULDBLOCK)
        {
            printf("send got WSAEWOULDBLOCK. Will retry send later ...\n");
            bSocketError = FALSE; // not a real error.
        }
        else
        {
            printf("ERROR: send failed. error = %d\n", err);
            bSocketError = TRUE;
        }
        goto CLEANUP;
    }

    // update the stats.
    pSockInfo->recdData.sendOffset += nBytesSent;
    pSockInfo->recdData.dataSize -= nBytesSent;

    // consider data as "fully" sent only when the entire buf has been sent.
    if (pSockInfo->recdData.dataSize == 0)
        pSockInfo->recdData.isNewData = FALSE;
    pSockInfo->nTotalSent += nBytesSent;
    printf("Sent %d bytes. Remaining = %d bytes.\n", nBytesSent,
                                        pSockInfo->recdData.dataSize);

CLEANUP:

    printf("Exiting SendData()\n");
    return bSocketError;
}

Generated on Wed Nov 13 2024 16:53:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/Accept/common.h File Reference

  • NetDS
  • WinSock
  • Accept
Classes | Defines | Typedefs | Functions | Variables

common.h File Reference

#include <winsock2.h>
#include <windows.h>
#include <ws2tcpip.h>
#include <wspiapi.h>
#include <strsafe.h>
#include <stdio.h>

Go to the source code of this file.

Classes

struct | _AcceptContext
struct | _DATA_BUFFER
struct | _SOCK_INFO

Defines

#define | DEFAULT_ADDRESS_FAMILY AF_UNSPEC
#define | DEFAULT_INTERFACE NULL
#define | DEFAULT_PORT "7243"
#define | DEFAULT_TYPE_OF_ACCEPT NON_BLOCKING_ACCEPT
#define | MAX_CLIENTS FD_SETSIZE
#define | RECV_DATA_SIZE 4096
#define | WM_USER_ASYNCSELECT_MSG WM_USER + 1

Typedefs

typedef struct _AcceptContext | AcceptContext
typedef struct _DATA_BUFFER | DATA_BUFFER
typedef struct _SOCK_INFO * | PSOCK_INFO
typedef struct _SOCK_INFO | SOCK_INFO

Functions

void | AddSockInfoToList (PSOCK_INFO *ppHead, PSOCK_INFO pNewSockInfo)
PSOCK_INFO AllocAndInitSockInfo ()
void | AsyncSelectAcceptMain ()
void | CreateListeningSockets ()
void | DeleteSockInfoFromList (PSOCK_INFO *ppHead, PSOCK_INFO pDelSockInfo)
void | DestroyListeningSockets ()
void | FreeSockInfo (PSOCK_INFO pSockInfo)
void | NonBlockingAcceptMain ()
void | PrintAddressString (LPSOCKADDR pSockAddr, DWORD dwSockAddrLen)
PSOCK_INFO | ProcessAcceptEvent (PSOCK_INFO pSockInfo)
BOOL | ProcessReadEvent (PSOCK_INFO pSockInfo)
BOOL | SendData (PSOCK_INFO pSockInfo)

Variables

const BYTE | ASYNC_SELECT_ACCEPT = 2
AcceptContext g_AcceptContext
const BYTE | NON_BLOCKING_ACCEPT = 1

Define Documentation

#define DEFAULT_ADDRESS_FAMILY AF_UNSPEC

Definition at line 58 of file common.h.

#define DEFAULT_INTERFACE NULL

Definition at line 61 of file common.h.

#define DEFAULT_PORT "7243"

Definition at line 64 of file common.h.

#define DEFAULT_TYPE_OF_ACCEPT NON_BLOCKING_ACCEPT

Definition at line 67 of file common.h.

#define MAX_CLIENTS FD_SETSIZE

Definition at line 31 of file common.h.

#define RECV_DATA_SIZE 4096

Definition at line 35 of file common.h.

#define WM_USER_ASYNCSELECT_MSG WM_USER + 1

Definition at line 52 of file common.h.

Typedef Documentation

typedef struct _AcceptContext AcceptContext
typedef struct _DATA_BUFFER DATA_BUFFER
typedef struct _SOCK_INFO * PSOCK_INFO
typedef struct _SOCK_INFO SOCK_INFO

Function Documentation

void AddSockInfoToList | ( | PSOCK_INFO * | ppHead,
 |  | PSOCK_INFO | pNewSockInfo
 | ) |  |

Definition at line 62 of file SockInfo.cpp.

{
    // add the new sock info at the head, for sake of simiplicity as we
    // don't care about the order of these structures.

    // this is going to be the first node.
    pNewSockInfo->prev = NULL;

    // the earlier list follows this node.
    pNewSockInfo->next = *ppHead;

    // this node is the previous node for the earlier head node.
    if (*ppHead != NULL)
        (*ppHead)->prev = pNewSockInfo;

    // the new head is this new node, as we inserted at the head.
    *ppHead = pNewSockInfo;

    printf("Added SockInfo %p to list\n", pNewSockInfo);
    return;
}

PSOCK_INFO AllocAndInitSockInfo ( )

Definition at line 22 of file SockInfo.cpp.

{
    PSOCK_INFO pNewSockInfo;

    // allocate a new structure. this should be freed by calling FreeSockInfo
    // by the caller of this function.
    pNewSockInfo = (PSOCK_INFO) malloc(sizeof(SOCK_INFO));
    if (pNewSockInfo == NULL)
    {
        printf("AllocAndInitSockInfo: malloc returned NULL.\n");
        goto CLEANUP;
    }

    printf("Allocated SockInfo at %p\n", pNewSockInfo);

    // Initialize the SOCK_INFO structure with the suitable initial values
    // for each field.
    memset(pNewSockInfo,0,sizeof(SOCK_INFO));
    pNewSockInfo->sock = INVALID_SOCKET;

CLEANUP:
    return pNewSockInfo;
}

void AsyncSelectAcceptMain ( )

Definition at line 347 of file ASAccept.cpp.

{
    PSOCK_INFO pSockInfo;
    int rc;
    MSG msg;

    printf("Entering AsyncSelectAcceptMain()\n");

    // create a dummy hidden window to receive the async select messages.
    g_AcceptContext.hAcceptWindow = CreateAcceptWindow();
    if (g_AcceptContext.hAcceptWindow == NULL)
    {
        printf("Error in creating the accept window.\n");
        goto CLEANUP;
    }

    // Set for all the listening sockets to be signalled on FD_ACCEPT event.
    for(pSockInfo = g_AcceptContext.pSockList; pSockInfo != NULL;
                                               pSockInfo = pSockInfo->next)
    {
        // request asynchronous notifications for the FD_ACCEPT and FD_CLOSE
        // events to be sent to the hAcceptWindow for this sock.
        rc = WSAAsyncSelect(pSockInfo->sock,
                            g_AcceptContext.hAcceptWindow,
                            WM_USER_ASYNCSELECT_MSG,
                            FD_ACCEPT | FD_CLOSE);
        if (rc == SOCKET_ERROR)
        {
            printf("ERROR: WSAAsyncSelect failed for sock %d. Error = %d\n",
                                    pSockInfo->sock, WSAGetLastError());
            continue;
        }
    }

    // Main message loop to process messages to the Accept Window.
    // This will indirectly call MainWndProc which will in turn call
    // ProcessAsyncSelectMessage.
    while (GetMessage(&msg, (HWND) NULL, 0, 0)) {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }

CLEANUP:

    printf("Exiting AsyncSelectAcceptMain()\n");
    return ;
}

void CreateListeningSockets ( )

Definition at line 60 of file common.cpp.

{
    struct addrinfo hints;
    struct addrinfo *res;
    struct addrinfo *pAddr;
    SOCKET newSock;
    PSOCK_INFO pNewSockInfo;
    int i;
    unsigned long nonBlocking = 1;

    printf("Entering CreateListeningSockets()\n");

    printf("Creating the list of sockets to listen for ...\n");

    // prepare the hints for the type of socket we are interested in.
    memset(&hints, 0, sizeof(hints));
    hints.ai_family = g_AcceptContext.addressFamily;
    hints.ai_protocol = IPPROTO_TCP;
    hints.ai_socktype = SOCK_STREAM;
    hints.ai_flags = AI_PASSIVE; // since we're going to bind on this socket.

    // getaddrinfo is the protocol independent version of GetHostByName.
    // the res contains the result.
    if (getaddrinfo(g_AcceptContext.szInterface,
                g_AcceptContext.szPort,
                &hints,
                &res) != NO_ERROR)
    {
        printf("getaddrinfo failed. Error = %d\n", WSAGetLastError());
        goto CLEANUP;
    }

    if (res == NULL)
    {
        printf("getaddrinfo returned res = NULL\n");
        goto CLEANUP;
    }

    printf("getaddrinfo successful.Enumerating the returned addresses ...\n\n");

    // for each returned interface, create a listening socket.
    for (pAddr = res, i = 1; pAddr != NULL; pAddr = pAddr->ai_next, i++)
    {
        printf("Processing Address %d returned by getaddrinfo : ", i);
        PrintAddressString(pAddr->ai_addr, pAddr->ai_addrlen);

        // create a suitable socket for this interface.
        newSock = WSASocket(pAddr->ai_family,
                            pAddr->ai_socktype,
                            pAddr->ai_protocol,
                            NULL,
                            NULL,
                            0);
        if (newSock == INVALID_SOCKET)
        {
            printf("WSASocket failed. Error = %d\n", WSAGetLastError());
            printf("Ignoring this address and continuing with the next. \n\n");

            // anyway, let's continue with other addresses.
            continue;
        }

        printf("Created socket with handle = %d\n", newSock);

        // bind the socket.
        if (bind(newSock, pAddr->ai_addr, pAddr->ai_addrlen) != NO_ERROR)
        {
            printf("bind failed. Error = %d\n", WSAGetLastError());
            closesocket(newSock);
            continue;
        }

        printf("Socket bound successfully\n");

        // listen for upto MAX_CLIENTS number of clients.
        if (listen(newSock, MAX_CLIENTS) != NO_ERROR)
        {
            printf("listen failed. Error = %d\n", WSAGetLastError());
            closesocket(newSock);
            continue;
        }

        printf("Listen successful\n");

        // for non-blocking select, we need to explicitly make the socket
        // non-blocking by this call, whereas for WSAAsyncSelect this is
        // not required as WSAAsyncSelect itself makes the socket non-blocking.
        if (g_AcceptContext.typeOfAccept == NON_BLOCKING_ACCEPT)
        {
            if (ioctlsocket(newSock, FIONBIO, &nonBlocking) == SOCKET_ERROR)
            {
                printf("Can't put socket into non-blocking mode. Error = %d\n",
                        WSAGetLastError());
            }
        }

        // allocate a socket info and store this socket.
        pNewSockInfo = AllocAndInitSockInfo();
        if (pNewSockInfo == NULL)
        {
            printf("AllocAndInitSockInfo failed.\n");
            closesocket(newSock);
            continue;
        }

        pNewSockInfo->sock = newSock;
        pNewSockInfo->isSocketListening = TRUE;

        // all went well. add this to the list of listening sockets.
        AddSockInfoToList(&g_AcceptContext.pSockList, pNewSockInfo);
        printf("Added socket to list of listening sockets\n\n");
    }

CLEANUP:

    // if getaddrinfo was successful, it would have allocated memory for the
    // res pointer which needs to be freed.
    if (res)
    {
        freeaddrinfo(res);
        printf("Freed the memory allocated for res by getaddrinfo\n");
    }

    printf("Exiting CreateListeningSockets()\n");
    return;
}

void DeleteSockInfoFromList | ( | PSOCK_INFO * | ppHead,
 |  | PSOCK_INFO | pDelSockInfo
 | ) |  |

Definition at line 88 of file SockInfo.cpp.

{
    // make the previous and the next nodes to point to each other,
    // insteade of pointing to pDelSockInfo.
    if (pDelSockInfo->prev != NULL)
        pDelSockInfo->prev->next = pDelSockInfo->next;
    if (pDelSockInfo->next != NULL)
        pDelSockInfo->next->prev = pDelSockInfo->prev;

    // if the head node is being deleted, make the next node as the head.
    if (*ppHead == pDelSockInfo)
        *ppHead = pDelSockInfo->next;

    // now, pDelSockInfo can be safely deleted as nobody points to it.
    FreeSockInfo(pDelSockInfo);

    printf("Deleted and freed SockInfo %p\n", pDelSockInfo);
    return;
}

void DestroyListeningSockets ( )

Definition at line 193 of file common.cpp.

{
    PSOCK_INFO pSockInfo,
               pNextSockInfo;

    printf("Entering DestroyListeningSockets()\n");

    // iterate through all the listening sockets and free one by one.
    pSockInfo = g_AcceptContext.pSockList;
    while (pSockInfo != NULL)
    {
        // if the socket hasn't been closed already, close it.
        if (pSockInfo->sock != INVALID_SOCKET)
        {
            closesocket(pSockInfo->sock);
            printf("Closed socket with handle %d\n", pSockInfo->sock);
        }

        // free this socket and go to the next.
        pNextSockInfo = pSockInfo->next;
        FreeSockInfo(pSockInfo);
        pSockInfo = pNextSockInfo;
    }

    printf("Exiting DestroyListeningSockets()\n");
    return ;
}

void FreeSockInfo ( PSOCK_INFO pSockInfo )

Definition at line 51 of file SockInfo.cpp.

{
    // free the SOCK_INFO structure allocated earlier by AllocAndInitSockInfo
    free(pSockInfo);
    printf("Freed SockInfo at %p\n", pSockInfo);
    return;
}

void NonBlockingAcceptMain ( )

Definition at line 24 of file NBAccept.cpp.

{
    // prints a "i am still awake" message every few seconds.
    const long HEART_BEAT_INTERVAL = 30;
    PSOCK_INFO pSockInfo,
               pNextSock;
    FD_SET readFDSet;
    struct timeval interval;
    int nReady;
    BOOL bSocketError;
    int nSocksInFDSet;

    printf("Entering NonBlockingAcceptMain()\n");

    // process the available sockets in the global socket list.
    while(g_AcceptContext.pSockList)
    {
        // first, prepare the FD_SET for passing to select.

        // initialize the FD_SET
        FD_ZERO(&readFDSet);
        nSocksInFDSet = 0;

        // include each socket in the FD_SET. For listening sockets,
        // read means a new connection is available.
        for(pSockInfo = g_AcceptContext.pSockList;  pSockInfo != NULL;
                                                    pSockInfo = pSockInfo->next)
        {
            // the FD_SET will take only upto FD_SETSIZE number of sockets.
            // so, we signal an error if we exceed the MAX_CLIENTS which is
            // less than or equal to FD_SETSIZE. If more clients need to be
            // supported, then FD_SETSIZE can be redefined before including
            // winsock2.h
            if (nSocksInFDSet < MAX_CLIENTS)
            {
                FD_SET(pSockInfo->sock, &readFDSet);
                nSocksInFDSet++;
            }
            else
            {
                printf("ERROR: Number of sockets in FD Set exceeds MAX_CLIENTS (%d)\n", MAX_CLIENTS);
                break;
            }
        }
        printf("Num sockets in FD_SET: %d\n", nSocksInFDSet);

        // wait on select for HEART_BEAT_INTEVAL seconds to see if any of
        // the sockets are signalled.
        interval.tv_sec = HEART_BEAT_INTERVAL;
        interval.tv_usec = 0;
        printf("Waiting in select for data/connections ...\n");

        // currently we use only the read set, which signals all the
        // three events required:
        //      accept for listening sockets,
        //      read for connected sockets and
        //      close for both type of sockets on error.
        nReady = select(0, &readFDSet, NULL, NULL, &interval);
        if (nReady == SOCKET_ERROR)
        {
            printf("ERROR: select failed. Error = %d\n", WSAGetLastError());

            // pause so as not to output frequently in case of repeated errors.
            Sleep(3000);
            continue;
        }

        // check if some socket was signalled.
        if (nReady == 0)
        {
            printf("No connections/data in the last %d seconds. \n",
                                                HEART_BEAT_INTERVAL);
            continue;
        }

        // find out which socket was signalled and process that socket.
        // since nReady indicates how many sockets are in the signalled
        // state, we don't need to loop if we have already processed that
        // many sockets.
        pSockInfo = g_AcceptContext.pSockList;
        while (pSockInfo != NULL && nReady > 0)
        {
            // check if this socket is set.
            if (FD_ISSET(pSockInfo->sock, &readFDSet))
            {
                nReady--;

                // for listening sockets, signalling on a read set means
                // a new connection is available.
                if (pSockInfo->isSocketListening)
                {
                    // accept the connection and add the new socket to the
                    // beginning of the list (not the end, so that we won't
                    // come across the newly added sockets before they are
                    // included in the next select call later).
                    ProcessAcceptEvent(pSockInfo);
                }
                else
                {
                    // this read event for a connected socket means data
                    // is available or socket is closed.

                    // read data if available and if we have buffer space.
                    bSocketError = ProcessReadEvent(pSockInfo);

                    // if we already found that the socket is closed due to
                    // some errors, we don't need to send the data
                    if (!bSocketError)
                    {
                        // so far no error, so try echoing the data back.
                        bSocketError = SendData(pSockInfo);
                    }

                    // if there was an error in recv/send, close the
                    // socket.
                    if (bSocketError)
                    {
                        // close the socket
                        closesocket(pSockInfo->sock);
                        printf("Closed socket %d. "
                               "Total Bytes Recd = %d, "
                               "Total Bytes Sent = %d\n",
                                pSockInfo->sock,
                                pSockInfo->nTotalRecd,
                                pSockInfo->nTotalSent);

                        // delete the SockInfo structure and free the memory.
                        pNextSock = pSockInfo->next;
                        DeleteSockInfoFromList(&g_AcceptContext.pSockList,
                                               pSockInfo);
                        pSockInfo = pNextSock;
                        continue;
                    }
                }
            }

            // move on to the next socket. as mentioned earlier, since
            // new sockets are added only in the beginning of the list
            // we won't be processing them until they are included in the
            // next select call.
            pSockInfo = pSockInfo->next;
        }

    }

    printf("Exiting NonBlockingAcceptMain()\n");
    return;
}

void PrintAddressString | ( | LPSOCKADDR | pSockAddr,
 |  | DWORD | dwSockAddrLen
 | ) |  |

Definition at line 26 of file common.cpp.

{
    // INET6_ADDRSTRLEN is the maximum size of a valid IPv6 address
    // including port,colons,NULL,etc.
    char buf[INET6_ADDRSTRLEN];
    DWORD dwBufSize = 0;

    memset(buf,0,sizeof(buf));
    dwBufSize = sizeof(buf);

    // This function converts the pSockAddr to a printable format into buf.
    if (WSAAddressToString(pSockAddr,
                           dwSockAddrLen,
                           NULL,
                           buf,
                           &dwBufSize) == SOCKET_ERROR)
    {
        printf("ERROR: WSAAddressToString failed %d \n", WSAGetLastError());
        goto CLEANUP;
    }

    printf("%s\n", buf);

CLEANUP:
    return;
}

PSOCK_INFO ProcessAcceptEvent ( PSOCK_INFO pSockInfo )

Definition at line 227 of file common.cpp.

{
    SOCKADDR_STORAGE clientAddress;
    int clientAddressLen = sizeof(clientAddress);
    SOCKET newSock;
    PSOCK_INFO pNewSockInfo = NULL;
    unsigned long nonBlocking = 1;

    printf("Entering ProcessAcceptEvent() on socket %d\n", pSockInfo->sock);

    // accept the new connection.
    newSock = WSAAccept(pSockInfo->sock,
                  (LPSOCKADDR)&clientAddress,
                  &clientAddressLen,
                  NULL,
                  NULL);
    if (newSock == INVALID_SOCKET)
    {
        printf("ERROR: WSAAccept failed. Error = %d\n", WSAGetLastError());
        goto CLEANUP;
    }

    printf("Accepted connection from client:");
    PrintAddressString((LPSOCKADDR) &clientAddress, clientAddressLen);

    // set the connected socket to non-blocking mode.
    if (ioctlsocket(pSockInfo->sock, FIONBIO, &nonBlocking) == SOCKET_ERROR)
    {
        printf("Can't put socket into non-blocking mode. Error = %d\n",
                WSAGetLastError());
    }

    // add this socket to the global sockets list.
    pNewSockInfo = AllocAndInitSockInfo();
    if (pNewSockInfo == NULL)
    {
        printf("AllocAndInitSockInfo failed.\n");
        closesocket(newSock);
        goto CLEANUP;
    }

    pNewSockInfo->sock = newSock;
    pNewSockInfo->isSocketListening = FALSE;
    AddSockInfoToList(&g_AcceptContext.pSockList, pNewSockInfo);
    printf("Added accepted socket %d to list of sockets\n", newSock);

CLEANUP:
    printf("Exiting ProcessAcceptEvent()\n");
    return pNewSockInfo;
}

BOOL ProcessReadEvent ( PSOCK_INFO pSockInfo )

Definition at line 284 of file common.cpp.

{
    BOOL bSocketError = FALSE;
    int nBytesRecd;
    int err;

    printf("Entering ProcessReadEvent() on socket %d\n", pSockInfo->sock);

    // check if the previously received data has been fully sent or not.
    if (pSockInfo->recdData.isNewData)
    {
        printf("Previously recd data not yet fully sent.\n");
        // here, since we are using only a fixed buffer size for outstanding
        // sends, we're not reading the data and hence there might be a
        // deadlock if the remote side only sends but doesn't receive at all.
        // also, if the remote side has closed without reading all the
        // data in the pipe, we may not know about it as we might get the
        // FD_CLOSE event only after all the FD_READ events have been
        // processed. so, to avoid these, the app should implement a timeout
        // on each socket so that malicious clients don't make the server
        // run out of resources and do a denial-of-service attack.

        // on the other hand, if we dynamically allocated memory for each
        // recv and queued it, we may not hit this deadlock, but still such
        // malicious clients can send too many data and not read at all and
        // thus perform a denial-of-service attack by making server run out
        // of memory. so, there has to be a upper limit for per-socket
        // memory usage or timeout to avoid such attacks.
        Sleep(2000);
        goto CLEANUP;
    }

    // previous data fully sent, now, recv the new data.
    memset(&pSockInfo->recdData,0,sizeof(pSockInfo->recdData));

    nBytesRecd = recv(pSockInfo->sock,
                      pSockInfo->recdData.buf,
                      RECV_DATA_SIZE - 1,
                      0);
    if (nBytesRecd < 0)
    {
        err = WSAGetLastError();
        if (err == WSAEWOULDBLOCK)
        {
            printf("recv got WSAEWOULDBLOCK. Will retry recv later ...\n");
            bSocketError = FALSE; // not a real error.
        }
        else
        {
            printf("ERROR: recv failed. error = %d\n", err);
            bSocketError = TRUE;
        }
        goto CLEANUP;
    }
    if (nBytesRecd == 0)
    {
        printf("recv returned 0. Remote side has closed gracefully. Good.\n");
        bSocketError = TRUE;
        goto CLEANUP;
    }

    // update the stats.
    pSockInfo->recdData.dataSize = nBytesRecd;
    pSockInfo->nTotalRecd += nBytesRecd;
    pSockInfo->recdData.isNewData = TRUE;

    printf("Received data = %s, length = %d\n", pSockInfo->recdData.buf,
                                                nBytesRecd);

CLEANUP:

    printf("Exiting ProcessReadEvent()\n");
    return bSocketError;

}

BOOL SendData ( PSOCK_INFO pSockInfo )

Definition at line 368 of file common.cpp.

{
    BOOL bSocketError = FALSE;
    int nBytesSent;
    int err;

    printf("Entering SendData() on socket %d\n", pSockInfo->sock);

    // check if there's any data received in the buffer after the last one
    // we sent out.
    if (!pSockInfo->recdData.isNewData || pSockInfo->recdData.dataSize <= 0)
    {
        printf("No data pending to be sent.\n");
        goto CLEANUP;
    }

    // if the data buffer contains new data, begin sending from the start
    // otherwise, begin sending from the point we left in the last call.
    nBytesSent = send(pSockInfo->sock,
                      pSockInfo->recdData.buf + pSockInfo->recdData.sendOffset,
                      pSockInfo->recdData.dataSize,
                      0);
    if (nBytesSent == SOCKET_ERROR)
    {
        err = WSAGetLastError();
        if (err == WSAEWOULDBLOCK)
        {
            printf("send got WSAEWOULDBLOCK. Will retry send later ...\n");
            bSocketError = FALSE; // not a real error.
        }
        else
        {
            printf("ERROR: send failed. error = %d\n", err);
            bSocketError = TRUE;
        }
        goto CLEANUP;
    }

    // update the stats.
    pSockInfo->recdData.sendOffset += nBytesSent;
    pSockInfo->recdData.dataSize -= nBytesSent;

    // consider data as "fully" sent only when the entire buf has been sent.
    if (pSockInfo->recdData.dataSize == 0)
        pSockInfo->recdData.isNewData = FALSE;
    pSockInfo->nTotalSent += nBytesSent;
    printf("Sent %d bytes. Remaining = %d bytes.\n", nBytesSent,
                                        pSockInfo->recdData.dataSize);

CLEANUP:

    printf("Exiting SendData()\n");
    return bSocketError;
}

Variable Documentation

const BYTE ASYNC_SELECT_ACCEPT = 2

Definition at line 46 of file common.h.

AcceptContext g_AcceptContext

Definition at line 18 of file main.cpp.

const BYTE NON_BLOCKING_ACCEPT = 1

Definition at line 42 of file common.h.

Generated on Wed Nov 13 2024 16:53:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/Accept/main.cpp File Reference

  • NetDS
  • WinSock
  • Accept
Functions | Variables

main.cpp File Reference

#include "common.h"

Go to the source code of this file.

Functions

const char * | AcceptTypeImage (BYTE typeOfAccept)
const char * | AFImage (BYTE addressFamily)
int _cdecl | main (int argc, char *argv[])
BOOL | ParseArguments (int argc, char *argv[])
void | PrintUsage (char *szProgramName)

Variables

AcceptContext g_AcceptContext

Function Documentation

const char* AcceptTypeImage ( BYTE typeOfAccept )

Definition at line 52 of file main.cpp.

{
    char *szRetVal;

    // return a string equivalent of the accept type for displaying
    // to the user of his choices.
    switch (typeOfAccept)
    {
        case NON_BLOCKING_ACCEPT : szRetVal = "NON_BLOCKING_ACCEPT";
                                   break;
        case ASYNC_SELECT_ACCEPT : szRetVal = "ASYNC_SELECT_ACCEPT";
                                   break;
        default                  : szRetVal = "Unrecognized";
                                   break;
    }

    return szRetVal;
}

const char* AFImage ( BYTE addressFamily )

Definition at line 25 of file main.cpp.

{
    char *szRetVal;

    // return the printable string equivalent of the corresponding
    // address family.
    switch (addressFamily)
    {
        case AF_UNSPEC : szRetVal = "AF_UNSPEC";
                         break;
        case AF_INET   : szRetVal = "AF_INET";
                         break;
        case AF_INET6  : szRetVal = "AF_INET6";
                         break;
        default        : szRetVal = "Unrecognized";
                         break;
    }

    return szRetVal;
}

int _cdecl main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 324 of file main.cpp.

{
    // holds the return value from this function.
    // 0 indicates success, non-zero indicates failure.
    int retVal;

    WSADATA wsaData;

    printf("Entering main()\n");

    // parse and validate the given arguments and determine if we should
    // continue the execution or return error.
    if (ParseArguments(argc, argv) == FALSE)
    {
        // error input. return a non-zero error code.
        retVal = 1;
        goto CLEANUP;
    }

    // call WSAStartup before calling any of the Winsock API functions.
    retVal = WSAStartup(MAKEWORD(2,2), &wsaData);
    if (retVal != 0)
    {
        printf("WSAStartup failed. Error = %d\n", retVal);
        goto CLEANUP;
    }

    // Depending on the command-line options given, create one or more
    // listening sockets on the requested interface(s).
    CreateListeningSockets();

    // Depending on the type of accept requested, call the suitable function.
    switch(g_AcceptContext.typeOfAccept)
    {
        case NON_BLOCKING_ACCEPT:
            NonBlockingAcceptMain();
            break;

        case ASYNC_SELECT_ACCEPT:
            AsyncSelectAcceptMain();
            break;

        default:
            // some error. return a non-zero error code.
            retVal = 1;
            break;
    }

    // we may not come here as per the current implementation since
    // the XXXAcceptMain functions themselves are waiting forever for
    // connections or data. But in case we add a timeout option in future
    // we might come here and so we'll cleanup everything properly.

    // Close all the listening sockets and remove them from the global
    // list. In case there are some accepted sockets still in the list,
    // (due to some error), they'll also be closed as well.
    DestroyListeningSockets();

    // Inform Winsock that we're done with all the Winsock APIs.
    WSACleanup();

CLEANUP:

    printf("Exiting main()\n");
    return retVal;
}

BOOL ParseArguments | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 111 of file main.cpp.

{
    // holds the return value from this function.
    // TRUE indicates that all the supplied arguments are valid.
    // FALSE indicates incorrect or insufficient number of arguments.
    BOOL retVal = FALSE;

    // loop index to go over the command-line arguments one by one.
    int i;

    printf("Entering ParseArguments()\n");

    // fill up the default arguments and let the user options override these.
    g_AcceptContext.addressFamily = DEFAULT_ADDRESS_FAMILY;
    g_AcceptContext.szInterface = DEFAULT_INTERFACE;
    g_AcceptContext.szPort = DEFAULT_PORT;
    g_AcceptContext.typeOfAccept = DEFAULT_TYPE_OF_ACCEPT;

    // process each argument in the argv list.
    for (i = 1; i < argc ; i++)
    {
        char firstChar = argv[i][0];

        // make sure the option begins with a hyphen or a forward slash.
        if (!(firstChar == '-' || firstChar == '/'))
        {
            printf("ERROR: Option has to begin with - or / : %s\n", argv[i]);
            PrintUsage(argv[0]);
            goto CLEANUP;
        }

        // process the option.
        switch(argv[i][1])
        {
            case 'a' :

                // Address Family.
                // should be -a 0 or -a 4 or -a 6

                // first check if there's one more argument.
                if (i + 1 >= argc)
                {
                    printf("ERROR: Argument 0/4/6 needed for -a option\n");
                    PrintUsage(argv[0]);
                    goto CLEANUP;
                }

                // extract and validate the AF number.
                switch(atoi(argv[i+1]))
                {
                    // Unspecified.
                    case 0:
                      g_AcceptContext.addressFamily = AF_UNSPEC;
                      break;

                    // IPv4.
                    case 4:
                      g_AcceptContext.addressFamily = AF_INET;
                      break;

                    // IPv6.
                    case 6:
                      g_AcceptContext.addressFamily = AF_INET6;
                      break;

                    // Invalid value.
                    default:
                      printf("ERROR: Invalid address family. Must be 0/4/6\n");
                      PrintUsage(argv[0]);
                      goto CLEANUP;
                }

                // indicate that we have processed the next argument as well.
                i++;

                // AF was fine. continue.
                break;

            case 'i' :

                // Interface to listen on.
                // should be -i <interface>

                // first check if there's one more argument.
                if (i + 1 >= argc)
                {
                    printf("ERROR: Interface needed for -i option\n");
                    PrintUsage(argv[0]);
                    goto CLEANUP;
                }

                // make sure the input string length is less than
                // the INET6_ADDRSTRLEN, the maximum valid IP address length.
                if (FAILED(StringCchLength(argv[i+1],INET6_ADDRSTRLEN, NULL)))
                {
                    printf("ERROR: Interface string too long. "
                           "can't exceed %d characters\n",
                           INET6_ADDRSTRLEN);
                    PrintUsage(argv[0]);
                    goto CLEANUP;
                }

                // remember the interface string.
                g_AcceptContext.szInterface = argv[i+1];

                // indicate that we have processed the next argument as well.
                i++;

                // continue.
                break;

            case 'e' :

                // Endpoint or Port.
                // should be -e <port number>

                // first check if there's one more argument.
                if (i + 1 >= argc)
                {
                    printf("ERROR: Port number needed for -e option\n");
                    PrintUsage(argv[0]);
                    goto CLEANUP;
                }

                // make sure the input string length is less than
                // the maximum length for a service name.
                if (FAILED(StringCchLength(argv[i+1], NI_MAXSERV, NULL)))
                {
                    printf("ERROR: Port number too long. "
                           "can't exceed %d characters\n",
                           NI_MAXSERV);

                    PrintUsage(argv[0]);
                    goto CLEANUP;
                }

                // remember the port number string.
                g_AcceptContext.szPort = argv[i+1];

                // indicate that we have processed the next argument as well.
                i++;

                // continue.
                break;

            case 't' :

                // Type of Accept.
                // should be -t 1 or -t 2

                // first check if there's one more argument.
                if (i + 1 >= argc)
                {
                    printf("ERROR: Argument 1 or 2 needed for -t option\n");
                    PrintUsage(argv[0]);
                    goto CLEANUP;
                }

                // extract the type value
                g_AcceptContext.typeOfAccept = (BYTE) atoi(argv[i+1]);

                // indicate that we have processed the next argument as well.
                i++;

                // validate the accept type.
                if (!(g_AcceptContext.typeOfAccept == 1 ||
                      g_AcceptContext.typeOfAccept == 2))
                {
                    printf("ERROR: Invalid accept type: %d. Must be 1 or 2\n",
                            g_AcceptContext.addressFamily);
                    PrintUsage(argv[0]);
                    goto CLEANUP;
                }

                // Accept type was fine. continue.
                break;

            case 'h' : // help
            case '?' : // help
                        PrintUsage(argv[0]);
                        goto CLEANUP;
            default  :
                        printf("ERROR: Unrecognized option: %s\n", argv[i]);
                        PrintUsage(argv[0]);
                        goto CLEANUP;
        }
    }

    // echo the final list of values that'll be used.
    // remember, these need not be the same as the input arguments.
    // rather, this is what we'll use inside our program.
    printf("Parsed input arguments. The following values will be used : \n");
    printf("\tAddress Family = %s\n", AFImage(g_AcceptContext.addressFamily));
    printf("\tInterface = %s\n",g_AcceptContext.szInterface);
    printf("\tPort = %s\n", g_AcceptContext.szPort);
    printf("\tType of Accept = %s\n",
                            AcceptTypeImage(g_AcceptContext.typeOfAccept));

    // all went well, signal that we can proceed.
    retVal = TRUE;

CLEANUP:

    printf("Exiting ParseArguments()\n");
    return retVal;
}

void PrintUsage ( char * szProgramName )

Definition at line 78 of file main.cpp.

{
    printf("\n\n"
           "Usage:\n"
           "------\n"
           "   %s <options> \n\n"
           "where <options> is one or more of the following: \n\n"
           "   -a <0|4|6>      Address Family: 0 for Either\n"
           "                                   4 for IPv4\n"
           "                                   6 for IPv6\n"
           "                   Default: %d\n\n"
           "   -i <interface>  Interface address\n"
           "                   Default: %s\n\n"
           "   -e <endpoint>   Port number\n"
           "                   Default: %s\n\n"
           "   -t <1|2>        Type of Accept: 1 for Non-blocking accept\n"
           "                                   2 for Accept with WSAAsyncSelect\n"
           "                   Default: %d\n\n"
           "\n",
           szProgramName,
           DEFAULT_ADDRESS_FAMILY,
          ( DEFAULT_INTERFACE == NULL ? "NULL" : DEFAULT_INTERFACE),
           DEFAULT_PORT,
           DEFAULT_TYPE_OF_ACCEPT
           );

    return;
}

Variable Documentation

AcceptContext g_AcceptContext

Definition at line 18 of file main.cpp.

Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/Accept/NBAccept.cpp File Reference

  • NetDS
  • WinSock
  • Accept
Functions

NBAccept.cpp File Reference

#include "common.h"

Go to the source code of this file.

Functions

void NonBlockingAcceptMain ()

Function Documentation

void NonBlockingAcceptMain ( )

Definition at line 24 of file NBAccept.cpp.

{
    // prints a "i am still awake" message every few seconds.
    const long HEART_BEAT_INTERVAL = 30;
    PSOCK_INFO pSockInfo,
               pNextSock;
    FD_SET readFDSet;
    struct timeval interval;
    int nReady;
    BOOL bSocketError;
    int nSocksInFDSet;

    printf("Entering NonBlockingAcceptMain()\n");

    // process the available sockets in the global socket list.
    while(g_AcceptContext.pSockList)
    {
        // first, prepare the FD_SET for passing to select.

        // initialize the FD_SET
        FD_ZERO(&readFDSet);
        nSocksInFDSet = 0;

        // include each socket in the FD_SET. For listening sockets,
        // read means a new connection is available.
        for(pSockInfo = g_AcceptContext.pSockList;  pSockInfo != NULL;
                                                    pSockInfo = pSockInfo->next)
        {
            // the FD_SET will take only upto FD_SETSIZE number of sockets.
            // so, we signal an error if we exceed the MAX_CLIENTS which is
            // less than or equal to FD_SETSIZE. If more clients need to be
            // supported, then FD_SETSIZE can be redefined before including
            // winsock2.h
            if (nSocksInFDSet < MAX_CLIENTS)
            {
                FD_SET(pSockInfo->sock, &readFDSet);
                nSocksInFDSet++;
            }
            else
            {
                printf("ERROR: Number of sockets in FD Set exceeds MAX_CLIENTS (%d)\n", MAX_CLIENTS);
                break;
            }
        }
        printf("Num sockets in FD_SET: %d\n", nSocksInFDSet);

        // wait on select for HEART_BEAT_INTEVAL seconds to see if any of
        // the sockets are signalled.
        interval.tv_sec = HEART_BEAT_INTERVAL;
        interval.tv_usec = 0;
        printf("Waiting in select for data/connections ...\n");

        // currently we use only the read set, which signals all the
        // three events required:
        //      accept for listening sockets,
        //      read for connected sockets and
        //      close for both type of sockets on error.
        nReady = select(0, &readFDSet, NULL, NULL, &interval);
        if (nReady == SOCKET_ERROR)
        {
            printf("ERROR: select failed. Error = %d\n", WSAGetLastError());

            // pause so as not to output frequently in case of repeated errors.
            Sleep(3000);
            continue;
        }

        // check if some socket was signalled.
        if (nReady == 0)
        {
            printf("No connections/data in the last %d seconds. \n",
                                                HEART_BEAT_INTERVAL);
            continue;
        }

        // find out which socket was signalled and process that socket.
        // since nReady indicates how many sockets are in the signalled
        // state, we don't need to loop if we have already processed that
        // many sockets.
        pSockInfo = g_AcceptContext.pSockList;
        while (pSockInfo != NULL && nReady > 0)
        {
            // check if this socket is set.
            if (FD_ISSET(pSockInfo->sock, &readFDSet))
            {
                nReady--;

                // for listening sockets, signalling on a read set means
                // a new connection is available.
                if (pSockInfo->isSocketListening)
                {
                    // accept the connection and add the new socket to the
                    // beginning of the list (not the end, so that we won't
                    // come across the newly added sockets before they are
                    // included in the next select call later).
                    ProcessAcceptEvent(pSockInfo);
                }
                else
                {
                    // this read event for a connected socket means data
                    // is available or socket is closed.

                    // read data if available and if we have buffer space.
                    bSocketError = ProcessReadEvent(pSockInfo);

                    // if we already found that the socket is closed due to
                    // some errors, we don't need to send the data
                    if (!bSocketError)
                    {
                        // so far no error, so try echoing the data back.
                        bSocketError = SendData(pSockInfo);
                    }

                    // if there was an error in recv/send, close the
                    // socket.
                    if (bSocketError)
                    {
                        // close the socket
                        closesocket(pSockInfo->sock);
                        printf("Closed socket %d. "
                               "Total Bytes Recd = %d, "
                               "Total Bytes Sent = %d\n",
                                pSockInfo->sock,
                                pSockInfo->nTotalRecd,
                                pSockInfo->nTotalSent);

                        // delete the SockInfo structure and free the memory.
                        pNextSock = pSockInfo->next;
                        DeleteSockInfoFromList(&g_AcceptContext.pSockList,
                                               pSockInfo);
                        pSockInfo = pNextSock;
                        continue;
                    }
                }
            }

            // move on to the next socket. as mentioned earlier, since
            // new sockets are added only in the beginning of the list
            // we won't be processing them until they are included in the
            // next select call.
            pSockInfo = pSockInfo->next;
        }

    }

    printf("Exiting NonBlockingAcceptMain()\n");
    return;
}

Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/Accept/SockInfo.cpp File Reference

  • NetDS
  • WinSock
  • Accept
Functions

SockInfo.cpp File Reference

#include "common.h"

Go to the source code of this file.

Functions

void | AddSockInfoToList (PSOCK_INFO *ppHead, PSOCK_INFO pNewSockInfo)
PSOCK_INFO AllocAndInitSockInfo ()
void | DeleteSockInfoFromList (PSOCK_INFO *ppHead, PSOCK_INFO pDelSockInfo)
void | FreeSockInfo (PSOCK_INFO pSockInfo)

Function Documentation

void AddSockInfoToList | ( | PSOCK_INFO * | ppHead,
 |  | PSOCK_INFO | pNewSockInfo
 | ) |  |

Definition at line 62 of file SockInfo.cpp.

{
    // add the new sock info at the head, for sake of simiplicity as we
    // don't care about the order of these structures.

    // this is going to be the first node.
    pNewSockInfo->prev = NULL;

    // the earlier list follows this node.
    pNewSockInfo->next = *ppHead;

    // this node is the previous node for the earlier head node.
    if (*ppHead != NULL)
        (*ppHead)->prev = pNewSockInfo;

    // the new head is this new node, as we inserted at the head.
    *ppHead = pNewSockInfo;

    printf("Added SockInfo %p to list\n", pNewSockInfo);
    return;
}

PSOCK_INFO AllocAndInitSockInfo ( )

Definition at line 22 of file SockInfo.cpp.

{
    PSOCK_INFO pNewSockInfo;

    // allocate a new structure. this should be freed by calling FreeSockInfo
    // by the caller of this function.
    pNewSockInfo = (PSOCK_INFO) malloc(sizeof(SOCK_INFO));
    if (pNewSockInfo == NULL)
    {
        printf("AllocAndInitSockInfo: malloc returned NULL.\n");
        goto CLEANUP;
    }

    printf("Allocated SockInfo at %p\n", pNewSockInfo);

    // Initialize the SOCK_INFO structure with the suitable initial values
    // for each field.
    memset(pNewSockInfo,0,sizeof(SOCK_INFO));
    pNewSockInfo->sock = INVALID_SOCKET;

CLEANUP:
    return pNewSockInfo;
}

void DeleteSockInfoFromList | ( | PSOCK_INFO * | ppHead,
 |  | PSOCK_INFO | pDelSockInfo
 | ) |  |

Definition at line 88 of file SockInfo.cpp.

{
    // make the previous and the next nodes to point to each other,
    // insteade of pointing to pDelSockInfo.
    if (pDelSockInfo->prev != NULL)
        pDelSockInfo->prev->next = pDelSockInfo->next;
    if (pDelSockInfo->next != NULL)
        pDelSockInfo->next->prev = pDelSockInfo->prev;

    // if the head node is being deleted, make the next node as the head.
    if (*ppHead == pDelSockInfo)
        *ppHead = pDelSockInfo->next;

    // now, pDelSockInfo can be safely deleted as nobody points to it.
    FreeSockInfo(pDelSockInfo);

    printf("Deleted and freed SockInfo %p\n", pDelSockInfo);
    return;
}

void FreeSockInfo ( PSOCK_INFO pSockInfo )

Definition at line 51 of file SockInfo.cpp.

{
    // free the SOCK_INFO structure allocated earlier by AllocAndInitSockInfo
    free(pSockInfo);
    printf("Freed SockInfo at %p\n", pSockInfo);
    return;
}

Generated on Wed Nov 13 2024 16:54:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/Accept/TestAccept.cpp File Reference

  • NetDS
  • WinSock
  • Accept
Classes | Defines | Typedefs | Enumerations | Functions | Variables

TestAccept.cpp File Reference

#include <winsock2.h>
#include <windows.h>
#include <ws2tcpip.h>
#include <wspiapi.h>
#include <strsafe.h>
#include <stdio.h>

Go to the source code of this file.

Classes

struct | _ClientContext

Defines

#define | DEFAULT_ADDRESS_FAMILY AF_UNSPEC
#define | DEFAULT_DELAY 5000
#define | DEFAULT_LOOP_COUNT 1
#define | DEFAULT_PORT "7243"
#define | DEFAULT_RECV_BUFFER_SIZE 10240
#define | DEFAULT_SCENARIO 5
#define | DEFAULT_SEND_BUFFER_SIZE 1024
#define | DEFAULT_SERVER "localhost"

Typedefs

typedef struct _ClientContext | ClientContext

Enumerations

enum {
SC_SEND_THEN_RECV = 1, SC_SEND_NO_RECV = 2, SC_SEND_WAIT_RECV = 3, SC_WAIT_SEND_RECV = 4,
SC_IDEAL_SEND_RECV = 5, SC_NUM_SCENARIOS = 5
}

Functions

const char * | AFImage (BYTE addressFamily)
SOCKET | CreateClientSocket ()
void | DoIdealSendRecv ()
int | DoRecvOnce ()
void | DoRecvUntilDone ()
void | DoSendNoRecv ()
int | DoSendOnce ()
void | DoSendThenRecv ()
void | DoSendUntilDone ()
void | DoSendWaitRecv ()
void | DoShutDown ()
void | DoWaitSendRecv ()
void | FreeRecvBuffer ()
void | FreeSendBuffer ()
int _cdecl | main (int argc, char *argv[])
BOOL | ParseArguments (int argc, char *argv[])
BOOL PrepareRecvBuffer ()
BOOL PrepareSendBuffer ()
void | PrintAddressString (LPSOCKADDR pSockAddr, DWORD dwSockAddrLen)
void | PrintUsage (char *szProgramName)
DWORD WINAPI | ReceiverThread (LPVOID pv)

Variables

ClientContext g_ClientContext

Define Documentation

#define DEFAULT_ADDRESS_FAMILY AF_UNSPEC

Definition at line 26 of file TestAccept.cpp.

#define DEFAULT_DELAY 5000

Definition at line 32 of file TestAccept.cpp.

#define DEFAULT_LOOP_COUNT 1

Definition at line 31 of file TestAccept.cpp.

#define DEFAULT_PORT "7243"

Definition at line 28 of file TestAccept.cpp.

#define DEFAULT_RECV_BUFFER_SIZE 10240

Definition at line 30 of file TestAccept.cpp.

#define DEFAULT_SCENARIO 5

Definition at line 33 of file TestAccept.cpp.

#define DEFAULT_SEND_BUFFER_SIZE 1024

Definition at line 29 of file TestAccept.cpp.

#define DEFAULT_SERVER "localhost"

Definition at line 27 of file TestAccept.cpp.

Typedef Documentation

typedef struct _ClientContext ClientContext

Enumeration Type Documentation

anonymous enum
Enumerator:
SC_SEND_THEN_RECV
SC_SEND_NO_RECV
SC_SEND_WAIT_RECV
SC_WAIT_SEND_RECV
SC_IDEAL_SEND_RECV
SC_NUM_SCENARIOS

Definition at line 42 of file TestAccept.cpp.

{
    SC_SEND_THEN_RECV = 1,
    SC_SEND_NO_RECV = 2,
    SC_SEND_WAIT_RECV = 3,
    SC_WAIT_SEND_RECV = 4,
    SC_IDEAL_SEND_RECV = 5,
    SC_NUM_SCENARIOS = 5
};

Function Documentation

const char* AFImage ( BYTE addressFamily )

Definition at line 79 of file TestAccept.cpp.

{
    char *szRetVal;

    // return the corresponding string for the given address family.
    switch (addressFamily)
    {
        case AF_UNSPEC : szRetVal = "AF_UNSPEC";
                         break;
        case AF_INET   : szRetVal = "AF_INET";
                         break;
        case AF_INET6  : szRetVal = "AF_INET6";
                         break;
        default        : szRetVal = "Unrecognized";
                         break;
    }

    return szRetVal;
}

SOCKET CreateClientSocket ( )

Definition at line 483 of file TestAccept.cpp.

{
    struct addrinfo hints;
    struct addrinfo *res;
    struct addrinfo *pAddr;
    SOCKET clientSock = INVALID_SOCKET;
    int i;
    int rc;

    printf("Entering CreateClientSocket()\n");

    memset(&hints, 0, sizeof(hints));

    hints.ai_family = g_ClientContext.addressFamily;
    hints.ai_protocol = IPPROTO_TCP;
    hints.ai_socktype = SOCK_STREAM;

    // get the local addresses that are suitable for connecting to the
    // given server address.
    if (getaddrinfo(g_ClientContext.szServer,
                g_ClientContext.szPort,
                &hints,
                &res) != NO_ERROR)
    {
        printf("getaddrinfo failed. Error = %d\n", WSAGetLastError());
        goto CLEANUP;
    }

    if (res == NULL)
    {
        printf("getaddrinfo returned res = NULL\n");
        goto CLEANUP;
    }

    printf("getaddrinfo successful.Enumerating the returned addresses ...\n\n");

    for (pAddr = res, i = 1; pAddr != NULL; pAddr = pAddr->ai_next, i++)
    {
        printf("Processing Address %d returned by getaddrinfo : ", i);
        PrintAddressString(pAddr->ai_addr, pAddr->ai_addrlen);
        clientSock = WSASocket(pAddr->ai_family,
                            pAddr->ai_socktype,
                            pAddr->ai_protocol,
                            NULL,
                            NULL,
                            0);
        if (clientSock == INVALID_SOCKET)
        {
            printf("WSASocket failed. Error = %d\n", WSAGetLastError());
            printf("Ignoring this address and continuing with the next. \n\n");

            // anyway, let's continue with other addresses.
            continue;
        }

        printf("Created client socket with handle = %d\n", clientSock);

        rc = connect(clientSock, pAddr->ai_addr, pAddr->ai_addrlen);
        if (rc == SOCKET_ERROR)
        {
            printf("connect failed. Error = %d\n", WSAGetLastError());
            closesocket(clientSock);
            clientSock = INVALID_SOCKET;
            continue;
        }

        printf("Connected successfully\n");
        break;
    }

CLEANUP:

    // if getaddrinfo succeeded, it would have allocated memory for the
    // res structure which we have to free.
    if (res)
    {
        freeaddrinfo(res);
        printf("Freed the memory allocated for res by getaddrinfo\n");
    }

    printf("Exiting CreateClientSocket()\n");
    return clientSock;
}

void DoIdealSendRecv ( )

Definition at line 906 of file TestAccept.cpp.

{
    HANDLE hThread;

    // start the receiver thread.
    hThread = CreateThread(NULL, 0, ReceiverThread, NULL, 0, NULL);
    if (hThread == NULL)
    {
        printf("ERROR: CreateThread failed. Error = %d\n", GetLastError());
        goto CLEANUP;
    }

    // In this thread, send all data until done.
    DoSendUntilDone();
    DoShutDown();

    // wait till recv thread is done.
    if (WaitForSingleObject(hThread, INFINITE) != WAIT_OBJECT_0)
    {
        printf("ERROR: WaitForSingleObject failed: %d\n", GetLastError());
        goto CLEANUP;
    }
    printf("Recv Thread done.\n");

CLEANUP:

    return;
}

int DoRecvOnce ( )

Definition at line 701 of file TestAccept.cpp.

{
    int nBytesRecd;

    printf("Entering DoRecvOnce()\n");

    // receive into the same global receive buffer, overwriting the previous
    // contents, as we are only interested in the number of bytes received
    // for verification.
    nBytesRecd = recv(g_ClientContext.sock,
                      g_ClientContext.pRecvBuf,
                      g_ClientContext.recvBufSize,
                      0);

    if (nBytesRecd == SOCKET_ERROR)
    {
        printf("recv returned: %d\n", WSAGetLastError());
        goto CLEANUP;
    }

    // update the stats.
    g_ClientContext.nBytesRecd += nBytesRecd;
    printf("Recd %d bytes so far\n", g_ClientContext.nBytesRecd);

CLEANUP:

    printf("Exiting DoRecvOnce()\n");
    return nBytesRecd;
}

void DoRecvUntilDone ( )

Definition at line 779 of file TestAccept.cpp.

{
    int err;

    printf("Entering DoRecvUntilDone()\n");
    do
    {
        // get the job done by calling DoRecvOnce.
        switch(DoRecvOnce())
        {
            case 0:
                printf("Recv returned 0. Remote socket must have been "
                       "gracefully closed.\n");
                goto CLEANUP;

            case SOCKET_ERROR:
                err = WSAGetLastError();
                if (err == WSAEWOULDBLOCK)
                {
                    printf("Got WSAEWOULDBLOCK from recv.\n");
                    printf("Waiting for 1 second before retrying send ...\n");
                    Sleep(1000);
                }
                else
                {
                    printf("ERROR: recv returned : %d\n", err);
                    goto CLEANUP;
                }
                break;

            default:
                // > 0 bytes read. let's continue.
                break;
        }
    } while (1);

CLEANUP:
    printf("Exiting DoRecvUntilDone()\n");
    return;
}

void DoSendNoRecv ( )

Definition at line 852 of file TestAccept.cpp.

{
    DoSendUntilDone();
    DoShutDown();
}

int DoSendOnce ( )

Definition at line 664 of file TestAccept.cpp.

{
    int nBytesSent;
    int startPosition;
    int err = 0;

    printf("Entering DoSendOnce()\n");

    // send from the position where we left off last.
    startPosition = g_ClientContext.sendBufSize -
                    g_ClientContext.nBytesRemainingToBeSent;
    nBytesSent = send(g_ClientContext.sock,
                      g_ClientContext.pSendBuf + startPosition,
                      g_ClientContext.nBytesRemainingToBeSent,
                      0);

    if (nBytesSent == SOCKET_ERROR)
    {
        err = WSAGetLastError();
        goto CLEANUP;
    }

    // remember where to begin send next time.
    g_ClientContext.nBytesRemainingToBeSent -= nBytesSent;
    printf("Sent %d bytes so far\n", startPosition + nBytesSent);

CLEANUP:

    printf("Exiting DoSendOnce()\n");
    return err;
}

void DoSendThenRecv ( )

Definition at line 840 of file TestAccept.cpp.

{
    DoSendUntilDone();
    DoShutDown();
    DoRecvUntilDone();
}

void DoSendUntilDone ( )

Definition at line 736 of file TestAccept.cpp.

{
    int err;

    printf("Entering DoSendUntilDone()\n");
    do
    {
        // Get the job done by callnig DoSendOnce.
        err = DoSendOnce();

        // handle error cases as appropriate.
        switch(err)
        {
            case 0:
                if (g_ClientContext.nBytesRemainingToBeSent == 0)
                {
                    printf("Send completed\n");
                    goto CLEANUP;
                }
                break;

            case WSAEWOULDBLOCK:
                printf("Got WSAEWOULDBLOCK from send.\n");
                printf("Waiting for 1 second before retrying send ...\n");
                Sleep(1000);
                break;

            default:
                // other errors.
                printf("ERROR: send failed: Error = %d\n", err);
                goto CLEANUP;
        }
    } while (1);

CLEANUP:
    printf("Exiting DoSendUntilDone()\n");
    return;
}

void DoSendWaitRecv ( )

Definition at line 863 of file TestAccept.cpp.

{
    DoSendUntilDone();
    DoShutDown();
    printf("Waiting before doing recv ...\n");
    Sleep(g_ClientContext.delay);
    DoRecvUntilDone();
}

void DoShutDown ( )

Definition at line 828 of file TestAccept.cpp.

{
    if (shutdown(g_ClientContext.sock, SD_SEND) == SOCKET_ERROR)
        printf("shutdown failed. err = %d\n", WSAGetLastError());
    else
        printf("shutdown successful\n");
}

void DoWaitSendRecv ( )

Definition at line 876 of file TestAccept.cpp.

{
    printf("Waiting before doing initial send ...\n");
    Sleep(g_ClientContext.delay);
    DoSendUntilDone();
    DoShutDown();
    DoRecvUntilDone();
}

void FreeRecvBuffer ( )

Definition at line 651 of file TestAccept.cpp.

{
    if (g_ClientContext.pRecvBuf != NULL)
    {
        free(g_ClientContext.pRecvBuf);
        printf("Freed Recv Buffer : %p\n", g_ClientContext.pRecvBuf);
        g_ClientContext.pRecvBuf = NULL;
    }
}

void FreeSendBuffer ( )

Definition at line 604 of file TestAccept.cpp.

{
    if (g_ClientContext.pSendBuf != NULL)
    {
        free(g_ClientContext.pSendBuf);
        printf("Freed Send Buffer : %p\n", g_ClientContext.pSendBuf);
        g_ClientContext.pSendBuf = NULL;
    }
}

int _cdecl main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 939 of file TestAccept.cpp.

{
    // holds the return value from this function.
    // 0 indicates success, non-zero indicates failure.
    int retVal;
    int i;
    BOOL bStartupSuccessful = FALSE;

    WSADATA wsaData;

    printf("Entering main()\n");

    // parse and validate the given arguments and determine if we should
    // continue the execution or return error.
    if (ParseArguments(argc, argv) == FALSE)
    {
        // error input. return a non-zero error code.
        retVal = 1;
        goto CLEANUP;
    }

    // call WSAStartup to initialize Winsock before calling any of its APIs.
    retVal = WSAStartup(MAKEWORD(2,2), &wsaData);
    if (retVal != 0)
    {
        printf("WSAStartup failed. Error = %d\n", retVal);
        goto CLEANUP;
    }

    // remember that the WSAStartup was successful so as to call WSACleanup
    // once, correspondingly.
    bStartupSuccessful = TRUE;

    for(i = 1; i <= g_ClientContext.loopCount; i++)
    {
        printf("\n\nPerforming Iteration : %d\n"
                   "-------------------------\n",i);

        // create a socket that's connected to the server.
        g_ClientContext.sock = CreateClientSocket();
        if (g_ClientContext.sock == INVALID_SOCKET)
            goto CLEANUP;

        // allocate and initialize the buffer to be sent.
        if (PrepareSendBuffer() == FALSE)
            goto CLOSE_SOCKET;

        // allocate and initialize a buffer for receiving.
        if (PrepareRecvBuffer() == FALSE)
            goto CLOSE_SOCKET;

        // perform the sends/recv according to the requested scenario.
        switch(g_ClientContext.scenario)
        {
            case SC_SEND_THEN_RECV :    DoSendThenRecv();
                                        break;
            case SC_SEND_NO_RECV :      DoSendNoRecv();
                                        break;
            case SC_SEND_WAIT_RECV :    DoSendWaitRecv();
                                        break;
            case SC_WAIT_SEND_RECV :    DoWaitSendRecv();
                                        break;
            case SC_IDEAL_SEND_RECV:    DoIdealSendRecv();
                                        break;
            default:                    printf("Unrecognized scenario\n");
                                        break;
        }

CLOSE_SOCKET:

        // free the send and recv buffers.
        FreeSendBuffer();
        FreeRecvBuffer();

        // close the client socket.
        closesocket(g_ClientContext.sock);
        printf("Closed socket %d. "
           "Total Bytes Recd = %d, "
           "Total Bytes Sent = %d\n",
            g_ClientContext.sock,
            g_ClientContext.nBytesRecd,
            g_ClientContext.sendBufSize -
            g_ClientContext.nBytesRemainingToBeSent);

    }

CLEANUP:

    // call WSACleanup only if WSAStartup was successful.
    if (bStartupSuccessful)
    {
        // Inform Winsock that we are done with all the APIs.
        WSACleanup();
    }

    printf("Exiting main()\n");
    return retVal;
}

BOOL ParseArguments | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 151 of file TestAccept.cpp.

{
    // holds the return value from this function.
    // TRUE indicates that all the supplied arguments are valid.
    // FALSE indicates incorrect or insufficient number of arguments.
    BOOL retVal = FALSE;

    // loop index to go over the command-line arguments one by one.
    int i;

    printf("Entering ParseArguments()\n");

    // fill up the default arguments and let the user options override these.
    g_ClientContext.addressFamily = DEFAULT_ADDRESS_FAMILY;
    g_ClientContext.szServer = DEFAULT_SERVER;
    g_ClientContext.szPort = DEFAULT_PORT;
    g_ClientContext.sendBufSize = DEFAULT_SEND_BUFFER_SIZE;
    g_ClientContext.recvBufSize = DEFAULT_RECV_BUFFER_SIZE;
    g_ClientContext.loopCount = DEFAULT_LOOP_COUNT;
    g_ClientContext.delay = DEFAULT_DELAY;
    g_ClientContext.scenario = DEFAULT_SCENARIO;

    // process each argument in the argv list.
    for (i = 1; i < argc ; i++)
    {
        char firstChar = argv[i][0];

        // make sure the option begins with a - or /
        if (!(firstChar == '-' || firstChar == '/'))
        {
            printf("ERROR: Option has to begin with - or / : %s\n", argv[i]);
            PrintUsage(argv[0]);
            goto CLEANUP;
        }

        // process the option.
        switch(argv[i][1])
        {
            case 'a' :

                // Address Family.
                // should be -a 0 or -a 4 or -a 6

                // first check if there's one more argument.
                if (i + 1 >= argc)
                {
                    printf("ERROR: Argument 0/4/6 needed for -a option\n");
                    PrintUsage(argv[0]);
                    goto CLEANUP;
                }

                // extract and validate the AF number.
                switch(atoi(argv[i+1]))
                {
                    // Unspecified.
                    case 0:
                      g_ClientContext.addressFamily = AF_UNSPEC;
                      break;

                    // IPv4.
                    case 4:
                      g_ClientContext.addressFamily = AF_INET;
                      break;

                    // IPv6.
                    case 6:
                      g_ClientContext.addressFamily = AF_INET6;
                      break;

                    // Invalid value.
                    default:
                      printf("ERROR: Invalid address family. Must be 0/4/6\n");
                      PrintUsage(argv[0]);
                      goto CLEANUP;
                }

                // indicate that we have processed the next argument as well.
                i++;

                // AF was fine. continue.
                break;

            case 'n' :

                // Interface to listen on.
                // should be -n <server Name>

                // first check if there's one more argument.
                if (i + 1 >= argc)
                {
                    printf("ERROR: Server name needed for -n option\n");
                    PrintUsage(argv[0]);
                    goto CLEANUP;
                }

                // make sure the input string length is less than
                // the INET6_ADDRSTRLEN, the maximum valid IP address length.
                if (FAILED(StringCchLength(argv[i+1],INET6_ADDRSTRLEN, NULL)))
                {
                    printf("ERROR: Server name string too long. "
                           "can't exceed %d characters\n",
                           INET6_ADDRSTRLEN);
                    PrintUsage(argv[0]);
                    goto CLEANUP;
                }

                // remember the interface string.
                g_ClientContext.szServer = argv[i+1];

                // indicate that we have processed the next argument as well.
                i++;

                // continue.
                break;

            case 'e' :

                // Endpoint or Port.
                // should be -e <port number>

                // first check if there's one more argument.
                if (i + 1 >= argc)
                {
                    printf("ERROR: Port number needed for -e option\n");
                    PrintUsage(argv[0]);
                    goto CLEANUP;
                }

                // make sure the input string length is less than
                // the maximum length for a service name.
                if (FAILED(StringCchLength(argv[i+1], NI_MAXSERV, NULL)))
                {
                    printf("ERROR: Port number too long. "
                           "can't exceed %d characters\n",
                           NI_MAXSERV);

                    PrintUsage(argv[0]);
                    goto CLEANUP;
                }

                // remember the port number string.
                g_ClientContext.szPort = argv[i+1];

                // indicate that we have processed the next argument as well.
                i++;

                // continue.
                break;

            case 'b' :

                // Bytes to Send
                // should be -b <bytes>.

                // first check if there's one more argument.
                if (i + 1 >= argc)
                {
                    printf("ERROR: Number of bytes needed for -b option\n");
                    PrintUsage(argv[0]);
                    goto CLEANUP;
                }

                // extract the bytes value
                g_ClientContext.sendBufSize = atol(argv[i+1]);

                // indicate that we have processed the next argument as well.
                i++;

                // validate the buffer size.
                if (g_ClientContext.sendBufSize < 0)
                {
                    printf("ERROR: Number of bytes must be > 0 \n");
                    PrintUsage(argv[0]);
                    goto CLEANUP;
                }

                // Continue.
                break;

            case 'l' :

                // Loop Count
                // should be -l or -l <count>.

                // if there's one more argument, parse it.
                if (i + 1 < argc)
                {
                    g_ClientContext.loopCount = atol(argv[i+1]);

                    // make sure loop count is 1 or more, if specified.
                    if (g_ClientContext.loopCount < 1)
                    {
                        printf("ERROR: Loop Count must be > 0 : %d\n",
                                g_ClientContext.loopCount);
                        PrintUsage(argv[0]);
                        goto CLEANUP;
                    }

                    // indicate that we have processed the next argument
                    // as well.
                    i++;
                }

                // Continue.
                break;

            case 'd' :

                // Delay in milliseconds.
                // should be -d <millisecs>.

                // first check if there's one more argument.
                if (i + 1 >= argc)
                {
                    printf("ERROR: Number of milliseconds needed "
                           "for -d option\n");
                    PrintUsage(argv[0]);
                    goto CLEANUP;
                }

                // extract the delay value
                g_ClientContext.delay = atol(argv[i+1]);

                // indicate that we have processed the next argument as well.
                i++;

                // Continue.
                break;

            case 's' :

                // Scenario Number.
                // should be -s <scenario number>.

                // first check if there's one more argument.
                if (i + 1 >= argc)
                {
                    printf("ERROR: Scenario Number needed for -s option\n");
                    PrintUsage(argv[0]);
                    goto CLEANUP;
                }

                // extract the scenario value
                g_ClientContext.scenario = (BYTE) atoi(argv[i+1]);

                // indicate that we have processed the next argument as well.
                i++;

                // validate the scenario type.
                if (g_ClientContext.scenario < 1 ||
                    g_ClientContext.scenario > SC_NUM_SCENARIOS)
                {
                    printf("ERROR: Invalid scenario type: %d. Must be between "
                           "1 to %d\n",g_ClientContext.scenario,
                           SC_NUM_SCENARIOS);
                    PrintUsage(argv[0]);
                    goto CLEANUP;
                }

                // Continue.
                break;

            case 'h' : // help
            case '?' : // help
                        PrintUsage(argv[0]);
                        goto CLEANUP;
            default  :
                        printf("ERROR: Unrecognized option: %s\n", argv[i]);
                        PrintUsage(argv[0]);
                        goto CLEANUP;
        }
    }

    // echo the final list of values that'll be used.
    // remember, these need not be the same as the input arguments.
    // rather, this is what we'll use inside our program.
    printf("Parsed input arguments. The following values will be used : \n");
    printf("\tAddress Family = %s\n", AFImage(g_ClientContext.addressFamily));
    printf("\tServer = %s\n",g_ClientContext.szServer);
    printf("\tPort = %s\n", g_ClientContext.szPort);
    printf("\tBytes to Send = %ld\n", g_ClientContext.sendBufSize);
    printf("\tReceive buffer size = %ld\n", g_ClientContext.recvBufSize);
    printf("\tIterations  = %ld\n", g_ClientContext.loopCount);
    printf("\tDelay = %ld\n", g_ClientContext.delay);
    printf("\tScenario = %d\n", g_ClientContext.scenario);

    // all went well, signal that we can proceed.
    retVal = TRUE;

CLEANUP:

    printf("Exiting ParseArguments()\n");
    return retVal;
}

BOOL PrepareRecvBuffer ( )

Definition at line 622 of file TestAccept.cpp.

{
    BOOL bSuccess = FALSE;

    printf("Entering PrepareRecvBuffer()\n");

    g_ClientContext.pRecvBuf = (char *) malloc(g_ClientContext.recvBufSize + 1);
    if (g_ClientContext.pRecvBuf == NULL)
    {
        printf("malloc failed.\n");
        goto CLEANUP;
    }

    printf("Allocated Recv Buffer: %p\n", g_ClientContext.pRecvBuf);

    memset(g_ClientContext.pRecvBuf, 0, g_ClientContext.recvBufSize + 1);
    g_ClientContext.nBytesRecd = 0;

    bSuccess = TRUE;

CLEANUP:
    printf("Exiting PrepareRecvBuffer()\n");
    return bSuccess;
}

BOOL PrepareSendBuffer ( )

Definition at line 573 of file TestAccept.cpp.

{
    BOOL bSuccess = FALSE;

    printf("Entering PrepareSendBuffer()\n");

    g_ClientContext.pSendBuf = (char *) malloc(g_ClientContext.sendBufSize + 1);
    if (g_ClientContext.pSendBuf == NULL)
    {
        printf("malloc failed.\n");
        goto CLEANUP;
    }

    printf("Allocated Send Buffer: %p\n", g_ClientContext.pSendBuf);

    // fill up with some info. here we are just sending 1 character.
    memset(g_ClientContext.pSendBuf, 'H', g_ClientContext.sendBufSize);
    g_ClientContext.pSendBuf[g_ClientContext.sendBufSize] = '\0';
    g_ClientContext.nBytesRemainingToBeSent = g_ClientContext.sendBufSize;

    bSuccess = TRUE;

CLEANUP:
    printf("Exiting PrepareSendBuffer()\n");
    return bSuccess;
}

void PrintAddressString | ( | LPSOCKADDR | pSockAddr,
 |  | DWORD | dwSockAddrLen
 | ) |  |

Definition at line 451 of file TestAccept.cpp.

{
    // INET6_ADDRSTRLEN is the maximum size of a valid IPv6 address
    // including port,colons,NULL,etc.
    char buf[INET6_ADDRSTRLEN];
    DWORD dwBufSize = 0;

    memset(buf,0,sizeof(buf));
    dwBufSize = sizeof(buf);

    // This function converts the pSockAddr to a printable format into buf.
    if (WSAAddressToString(pSockAddr,
                           dwSockAddrLen,
                           NULL,
                           buf,
                           &dwBufSize) == SOCKET_ERROR)
    {
        printf("ERROR: WSAAddressToString failed %d \n", WSAGetLastError());
        goto CLEANUP;
    }

    printf("%s\n", buf);

CLEANUP:
    return;
}

void PrintUsage ( char * szProgramName )

Definition at line 105 of file TestAccept.cpp.

{
    printf("\n\n"
           "Usage:\n"
           "------\n"
           "   %s <options> \n\n"
           "where <options> is one or more of the following: \n\n"
           "   -a <0|4|6>      Address Family: 0 for Either\n"
           "                                   4 for IPv4\n"
           "                                   6 for IPv6\n"
           "                   Default: %d\n\n"
           "   -n <server>     Server Name or IP\n"
           "                   Default: %s\n\n"
           "   -e <endpoint>   Port number\n"
           "                   Default: %s\n\n"
           "   -b <bytes>      Bytes to send\n"
           "                   Default: %d\n\n"
           "   -l <count>      Loop count times \n"
           "                   Default: %d\n\n"
           "   -d <millisecs>  Delay after or before send (see -s 3 & -s 4)\n"
           "                   Default: %d\n\n"
           "   -s <1..5>       Scenario: \n"
           "                      1 : Finish all sends, then recv\n"
           "                      2 : Finish all sends, no recv\n"
           "                      3 : Finish all sends, wait, then recv\n"
           "                      4 : First wait, then send, then recv\n"
           "                      5 : Ideal Send and Recv sequence\n"
           "                   Default: %d\n\n"
           "\n",
           szProgramName,
           DEFAULT_ADDRESS_FAMILY,
           DEFAULT_SERVER,
           DEFAULT_PORT,
           DEFAULT_SEND_BUFFER_SIZE,
           DEFAULT_LOOP_COUNT,
           DEFAULT_DELAY,
           DEFAULT_SCENARIO
           );

    return;
}

DWORD WINAPI ReceiverThread ( LPVOID pv )

Definition at line 891 of file TestAccept.cpp.

{
    DoRecvUntilDone();
    return 0;
}

Variable Documentation

ClientContext g_ClientContext

Definition at line 73 of file TestAccept.cpp.

Generated on Wed Nov 13 2024 16:54:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/appletalk/PrPerf.c File Reference

  • NetDS
  • WinSock
  • appletalk
Classes | Defines | Typedefs | Functions | Variables

PrPerf.c File Reference

#include <winsock.h>
#include <windows.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <time.h>
#include <atalkwsh.h>
#include "prsamp.h"

Go to the source code of this file.

Classes

struct | Sock_Info

Defines

#define | BLOCKSIZE 4096
#define | DEF_QUEUE_LEN 5
#define | DEF_SERVER_NAME "Windows Adsp"
#define | DEF_SERVER_TYPE "Windows Sockets"
#define | DEF_SERVER_ZONE "*"
#define | PROTOCOL_LEN 10
#define | SOCKET_COUNT 32

Typedefs

typedef struct Sock_Info * | PTEST_INFO
typedef struct Sock_Info | TEST_INFO

Functions

BOOL | CheckForRecv (SOCKET s)
BOOL | CheckForSend (SOCKET s)
BOOL DoClient ()
BOOL DoServer ()
void | InsertSockInfo (TEST_INFO **head, TEST_INFO *info)
int __cdecl | main (int argc, char **argv)
BOOL OpenSocketRegisterAndListen ()
unsigned long | PerfThread (PTEST_INFO lpvTest)
void | RemoveSockInfo (TEST_INFO **head, TEST_INFO *info)
void | usage ()

Variables

double | AvgThroughPut
CHAR | DataString [] = {"0123456789abcdefghijklmnopqrstuvwxyz~!@#$%^&*()_+"}
FILETIME FileTime
BOOL | fRDM = FALSE
BOOL | fVerify = FALSE
CRITICAL_SECTION | gListCritSec
size_t | gNumTimes = 5
CHAR | gProtocolName [PROTOCOL_LEN] = "ADSP"
CHAR | gServerName [MAX_ENTITY] = DEF_SERVER_NAME
CHAR | gServerType [MAX_ENTITY] = DEF_SERVER_TYPE
CHAR | gServerZone [MAX_ENTITY] = DEF_SERVER_ZONE
PTEST_INFO | gSocketList = NULL
int | loop = 1
int | looptot
double | MaxThroughPut
double | MinThroughPut
SYSTEMTIME | SystemEndTime
SYSTEMTIME | SystemStartTime
double | Throughput

Define Documentation

#define BLOCKSIZE 4096

Definition at line 37 of file PrPerf.c.

#define DEF_QUEUE_LEN 5

Definition at line 39 of file PrPerf.c.

#define DEF_SERVER_NAME "Windows Adsp"

Definition at line 34 of file PrPerf.c.

#define DEF_SERVER_TYPE "Windows Sockets"

Definition at line 35 of file PrPerf.c.

#define DEF_SERVER_ZONE "*"

Definition at line 36 of file PrPerf.c.

#define PROTOCOL_LEN 10

Definition at line 40 of file PrPerf.c.

#define SOCKET_COUNT 32

Definition at line 32 of file PrPerf.c.

Typedef Documentation

typedef struct Sock_Info * PTEST_INFO
typedef struct Sock_Info TEST_INFO

Function Documentation

BOOL CheckForRecv ( SOCKET s )

Definition at line 1234 of file PrPerf.c.

{

   fd_set readfds;
   int r;

   FD_ZERO(&readfds);
   FD_SET(s, &readfds);

#ifdef DEBUG
   printf("\t\tChecking for Recv..\n");
#endif

   r = select(0, &readfds, NULL, NULL, NULL);

   if (r != 1)
   {
       printf("select:error = %d\n", WSAGetLastError());
       return(FALSE);
   }
   return(TRUE);
}

BOOL CheckForSend ( SOCKET s )

Definition at line 1199 of file PrPerf.c.

{

   fd_set writefds;
   int r;

#ifdef DEBUG
   printf("\t\tChecking for Send..\n");
#endif

   FD_ZERO(&writefds);
   FD_SET(s, &writefds);

   //
   // indefinite wait select
   //
   r = select(0, NULL, &writefds, NULL, NULL);

   if (r != 1)
   {
       printf("select:error = %d\n", WSAGetLastError());
       return(FALSE);
   }
   return(TRUE);
}

BOOL DoClient ( )

Definition at line 765 of file PrPerf.c.

{
    int                  r = 0;             // return code
    BOOL                 fRet = FALSE;      //
    CHAR                 LookupBuffer[512]; // LookUp results return buffer
    PCHAR                ptupleBuffer;
    PWSH_LOOKUP_NAME     pLookup;
    PWSH_NBP_TUPLE       pTempTuple;
    SOCKADDR_AT          ataddress;
    int                  WrittenSize;
    SOCKET               clntsock;
    u_long               blockmode = 1;          // for ioctlsocket
    int                  BytesTransferred = 0;
    char *               memhandle;
    DWORD                hourdiff;          //, minutediff, seconddiff;
    double               StartSecond, EndSecond, ElapsedSeconds;
    int                  sendleft, sendoffset, recvleft, recvoffset;
    int                  sockettype = SOCK_STREAM;
    int                  prototype = ATPROTO_ADSP;
    size_t               i,copycount;

    if (!_strnicmp(gProtocolName, "PAP", 3))
    {
        sockettype = SOCK_RDM;
        prototype = ATPROTO_PAP;
    }
    else if (fRDM)
    {
        sockettype = SOCK_RDM;
    }

    do
    {
        //
        // See socket call in OpenSocketRegisterAndListen for desc
        //
        clntsock = socket(AF_APPLETALK, sockettype, prototype);

        if(clntsock == INVALID_SOCKET)
        {
            printf("Open Socket: Error = %ld\n", WSAGetLastError());
            r = SOCKET_ERROR;
            break;
        }

        ataddress.sat_socket = 0;
        ataddress.sat_family = AF_APPLETALK;

        r = bind(clntsock, (struct sockaddr *)&ataddress, sizeof(SOCKADDR_AT));

        if (r == SOCKET_ERROR)
        {
            printf("Bind:Error = %d\n", WSAGetLastError());
            break;
        }

        //
        // end point has now been created on the AppleTalk Protocol.
        // lookup the server name.
        //

        pLookup = (PWSH_LOOKUP_NAME)LookupBuffer;

        strncpy(pLookup->LookupTuple.NbpName.ObjectName, gServerName, MAX_ENTITY-1);
        pLookup->LookupTuple.NbpName.ObjectNameLen = (char) strlen(gServerName);

        strncpy(pLookup->LookupTuple.NbpName.TypeName,  gServerType, MAX_ENTITY-1);
        pLookup->LookupTuple.NbpName.TypeNameLen = (char) strlen(gServerType);

        strncpy(pLookup->LookupTuple.NbpName.ZoneName, gServerZone, MAX_ENTITY-1);
        pLookup->LookupTuple.NbpName.ZoneNameLen = (char) strlen(gServerZone);

        printf("Looking up %s:%s@%s\n",
                pLookup->LookupTuple.NbpName.ObjectName,
                pLookup->LookupTuple.NbpName.TypeName,
                pLookup->LookupTuple.NbpName.ZoneName);

        WrittenSize = sizeof(LookupBuffer);

        r = getsockopt(clntsock, SOL_APPLETALK, SO_LOOKUP_NAME,
                (char*)LookupBuffer,
                &WrittenSize);

        if(r == SOCKET_ERROR)
        {
            printf("getsockopt:error = %d\n", WSAGetLastError());
            break;

        }

        if (pLookup->NoTuples <= 0)
        {
            printf("LookupName failed - no tuples found\n");
            r=-1;
            break;
        }

        ptupleBuffer = (char *)pLookup+sizeof(WSH_LOOKUP_NAME);
        pTempTuple = (PWSH_NBP_TUPLE)ptupleBuffer;

        ataddress.sat_family = AF_APPLETALK;
        ataddress.sat_net = pTempTuple[0].Address.Network;
        ataddress.sat_node = pTempTuple[0].Address.Node;
        ataddress.sat_socket = pTempTuple[0].Address.Socket;

        printf("server address = %lx.%lx.%lx.\n", ataddress.sat_net,
                ataddress.sat_node,
                ataddress.sat_socket);

        //
        // lookup succeeded. Use the address in ataddress to connect to the
        // server
        //

        r =  connect(clntsock, (struct sockaddr *)&ataddress, sizeof(SOCKADDR_AT));

        if (r == SOCKET_ERROR)
        {
            printf("connect: error = %d\n", WSAGetLastError());
            break;
        }

#ifdef DEBUG
        //       printf("Connect Succeeded\n");
#endif

    }while(FALSE);

    if (r == SOCKET_ERROR)
    {
        if (clntsock != INVALID_SOCKET)
        {
            closesocket(clntsock);
            clntsock = INVALID_SOCKET;
        }
        return(FALSE);
    }

    //
    //  Set Socket to non blocking mode
    //

    r = ioctlsocket(clntsock, FIONBIO, &blockmode);

#ifdef DEBUG
    //       printf("ioctlsocket Succeeded\n");
#endif

    if( r == SOCKET_ERROR)
    {
        printf("ioctlsocket: error = %d\n", WSAGetLastError());
        return FALSE;
    }

    //
    // Fill Up Send Buffer with Data
    //
    memhandle = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, BLOCKSIZE);
    if (memhandle == NULL)
    {
        printf("LocalAlloc Failed %d\n", GetLastError());
        closesocket(clntsock);
        return(FALSE);
    }

    //
    // fill the buffer with Data
    //
    i = 0;
    while (i < BLOCKSIZE)
    {
        if (i+strlen(DataString) <= BLOCKSIZE)
            copycount = strlen(DataString);
        else
            copycount = BLOCKSIZE - i;
        memcpy(&memhandle[i], DataString, copycount);
        i += copycount;
    }
    memhandle[BLOCKSIZE-1] = '\0';

    fRet = CheckForSend(clntsock);

    if(fRet == FALSE)
    {
        closesocket(clntsock);
        HeapFree(GetProcessHeap(), 0, memhandle);
        return FALSE;
    }

    GetLocalTime(&SystemStartTime);

#ifdef DEBUG
    printf("Data Size = %d\n", lstrlen(memhandle)+1);
    //   printf("Base Data sent: %s\n",DataStartPtr);
    printf("Start Time:%d:%2d:%2d:%2d\t", SystemStartTime.wHour,
            SystemStartTime.wMinute,
            SystemStartTime.wSecond,
            SystemStartTime.wMilliseconds);
#endif

    for( i= 0; i < gNumTimes; i++)
    {
        //
        // Can I send - CheckForSend calls select to find if we can send
        // without blocking
        //

        sendleft   = BLOCKSIZE;
        sendoffset = 0;

        do
        {
            fRet = CheckForSend(clntsock);

            if(fRet == FALSE)
            {
                printf("send select error\n");
                break;
            }

            r = send(clntsock, &memhandle[sendoffset], sendleft, 0);

            if ( r == SOCKET_ERROR )
            {

                if( WSAGetLastError() == WSAEWOULDBLOCK )
                {
                    printf("send: wouldblock\n");
                    continue;
                }
                else
                {
                    printf("send: error = %d\n", WSAGetLastError());
                    fRet = FALSE;
                    break;
                }

            }

            sendleft   -= r;
            sendoffset += r;

        } while(sendleft > 0);

        if (fRet == FALSE)
            break;

        printf("Sent %d bytes\n", sendoffset);

        if ((fVerify) && (sendleft == 0))
        {
            CHAR buffer[BLOCKSIZE];
            int recvflag = 0;
            int rr, pos = 0;

            //
            // Prime a Read here. This will enable the receive to complete
            // This is PAP specific. For other AppleTalk protocols -
            // ADSP and DDP a recv can be posted directly
            //

            if(!_strnicmp(gProtocolName, "PAP", 3))
            {
                rr = setsockopt(clntsock,
                        SOL_APPLETALK,
                        SO_PAP_PRIME_READ,
                        buffer,
                        sizeof(buffer));

                if (rr == SOCKET_ERROR)
                {
                    printf("primeread: error = %d\n", WSAGetLastError());
                    fRet = FALSE;
                    break;
                }
            }

            recvleft   = sendoffset;
            recvoffset = 0;
            do
            {

                fRet = CheckForRecv(clntsock);

                if(fRet == FALSE)
                    break;

                recvflag = 0;
                rr = WSARecvEx(clntsock, &buffer[recvoffset], recvleft, &recvflag);

                if( rr == SOCKET_ERROR)
                {
                    if (WSAGetLastError() == WSAEWOULDBLOCK)
                        continue;
                    else
                    {
                        printf("recv: error = %d\n", WSAGetLastError());
                        fRet = FALSE;
                        break;
                    }
                }

                recvoffset += rr;
                recvleft   -= rr;

                printf("Recv'd %d bytes\n", rr);

                if ( (recvflag == 0) || (sockettype == SOCK_RDM) ||
                        (recvleft == 0)  )
                    break;

            } while(recvleft > 0);

            if ((memcmp(memhandle, buffer, BLOCKSIZE) != 0) && (fRet != FALSE))
            {
                printf("Strings do not compare\n");
#ifdef DEBUG
                //                       printf("Data sent: \n%s\n",memhandle);
                //                       printf("Data recv'd: \n%s\n",buffer);
#endif

            }

        } // IF (fVerify)

        BytesTransferred += sendoffset;

    } // FOR

    GetLocalTime(&SystemEndTime);

#ifdef DEBUG
    printf("End Time:%d:%2d:%2d:%2d\t", SystemEndTime.wHour,
            SystemEndTime.wMinute,
            SystemEndTime.wSecond,
            SystemEndTime.wMilliseconds);
#endif

    //
    // calculate the difference
    //

    hourdiff = SystemEndTime.wHour - SystemStartTime.wHour;

    StartSecond = (SystemStartTime.wHour * 3600) +
        (SystemStartTime.wMinute * 60) +
        SystemStartTime.wSecond +
        (SystemStartTime.wMilliseconds * 0.001);

    EndSecond = 0;

    if(SystemEndTime.wMonth != SystemStartTime.wMonth)
    {
        EndSecond = (SystemEndTime.wDay * 24) * 3600;
        switch (SystemStartTime.wMonth)
        {
            case 1:
            case 3:
            case 5:
            case 7:
            case 8:
            case 10:
            case 12:
                EndSecond = ((31 - SystemStartTime.wDay) * 24) + EndSecond;
                break;
            case 4:
            case 6:
            case 9:
            case 11:
                EndSecond = ((30 - SystemStartTime.wDay) * 24) + EndSecond;
                break;
            case 2:
                if((SystemStartTime.wYear % 400 == 0) ||
                        ((SystemStartTime.wYear % 4 == 0) &&
                         (SystemStartTime.wYear % 100 != 0)))
                    EndSecond = ((29 - SystemStartTime.wDay) *
                            24) + EndSecond;
                else
                    EndSecond = ((28 - SystemStartTime.wDay) *
                            24) + EndSecond;
                break;
        }
    }
    else
        if(SystemEndTime.wDay > SystemStartTime.wDay)
        {
            EndSecond = ((SystemEndTime.wDay - SystemStartTime.wDay) * 24) * 3600;
        }

    EndSecond = EndSecond + (SystemEndTime.wHour * 3600) +
        (SystemEndTime.wMinute * 60) + SystemEndTime.wSecond +
        (SystemEndTime.wMilliseconds * 0.001);

    ElapsedSeconds = EndSecond-StartSecond;

#ifdef DEBUG
    printf("Elapsed Time (secs) = %6.3f\n", ElapsedSeconds);
    printf("Bytes Transferred = %ld\n", BytesTransferred);
    printf("Send All Done\n");
#endif

    if(ElapsedSeconds !=0)
    {
        Throughput = (BytesTransferred)/(ElapsedSeconds) ;

#ifdef DEBUG
        printf("Throughput (bytes/sec) = %6.2f\n", Throughput);
#endif

    }

    printf("\n");

    closesocket(clntsock);

    HeapFree(GetProcessHeap(), 0, memhandle);

    return(TRUE);

}

BOOL DoServer ( )

Definition at line 277 of file PrPerf.c.

{
    BOOL   fRet = FALSE;

    //
    // register the name specified on the command line  or use the
    // defaults.
    //

    fRet = OpenSocketRegisterAndListen();

    return(fRet);

}

void InsertSockInfo | ( | TEST_INFO ** | head,
 |  | TEST_INFO * | info
 | ) |  |

Definition at line 82 of file PrPerf.c.

{
    info->next = info->prev = NULL;

    if (*head == NULL)
    {
        *head = info;
    }
    else
    {
        (*head)->prev = info;
        info->next    = *head;
        *head         = info;
    }
}

int __cdecl main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 127 of file PrPerf.c.

{
    WSADATA WsaData;
    BOOL    fClient = FALSE;
    BOOL    fServer = FALSE;
    int     i, r;

    for(i = 1; i < argc; i++)
    {
        if ( (strlen(argv[i]) == 2) && ( (argv[i][0] == '/') || (argv[i][0] == '-') ) )
        {
            switch(tolower(argv[i][1]))
            {
                case 'n':
                    if (i+1 >= argc)
                        usage();
                    strncpy(gServerName, argv[++i], MAX_ENTITY-1);
                    break;
                case 't':
                    if (i+1 >= argc)
                        usage();
                    strncpy(gServerType, argv[++i], MAX_ENTITY-1);
                    break;
                case 'z':
                    if (i+1 >= argc)
                        usage();
                    strncpy(gServerZone, argv[++i], MAX_ENTITY-1);
                    break;
                case 's':
                    if (fClient == TRUE)
                        usage();
                    fServer = TRUE;
                    break;
                case 'c':
                    if (fServer == TRUE)
                        usage();
                    fClient = TRUE;
                    break;
                case 'p':
                    if (i+1 >= argc)
                        usage();
                    strncpy(gProtocolName, argv[++i], PROTOCOL_LEN-1);
                    break;
                case 'b':
                    if (i+1 >= argc)
                        usage();
                    gNumTimes = atoi(argv[++i]);
                    break;
                case 'l':
                    if (i+1 >= argc)
                        usage();
                    loop = atoi(argv[++i]);
                    break;
                case 'v':
                    fVerify = TRUE;
                    break;
                case 'y':
                    fRDM = TRUE;
                    break;
                case '?':
                default:
                    usage();

            }
        }
        else
        {
            usage();
        }

    }

    printf("Server Name %s\n", gServerName);
    printf("Server Type %s\n", gServerType);
    printf("Server Zone %s\n", gServerZone);

    printf("%s throughput measurement\n", gProtocolName);

    if(_strnicmp(gProtocolName, "ADSP", 4) && _strnicmp(gProtocolName, "PAP", 3))
    {
        printf("\nInvalid Protocol Specified\n\n");
        usage();
    }

    if(!(fClient || fServer))
        usage();

    // Load winsock
    r = WSAStartup(0x0101, &WsaData);
    if (r != 0)
    {
        printf("Startup failed: %d\n", r);
        WSACleanup();
        return(0);
    }

    if(fClient)
    {
        BOOL DClnt;

        looptot       = 0;
        MaxThroughPut = 0;
        AvgThroughPut = 0;

        while (looptot < loop)
        {
            DClnt = DoClient();
            if(DClnt)
            {
                if ((looptot == 0) || (MinThroughPut > Throughput))
                    MinThroughPut = Throughput;

                if (MaxThroughPut < Throughput)
                    MaxThroughPut = Throughput;

                AvgThroughPut = ((AvgThroughPut * looptot) + Throughput)
                    / (looptot+1);
                printf("Loop %2d/%d Throughput Cur/Min/Max/Ave :", ++looptot, loop);
                printf(" %6.2f/%6.2f/%6.2f/%6.2f\n\n\n", Throughput,
                        MinThroughPut,
                        MaxThroughPut,
                        AvgThroughPut);
                Throughput = 0.0;
            }
            else
            {
                break;
            }
        }
    }
    else if (fServer)
    {
        DoServer();
    }

    WSACleanup();

    return(0);
}

BOOL OpenSocketRegisterAndListen ( )

Definition at line 303 of file PrPerf.c.

{

    int                  r = 0;         // return from socket calls
    BOOL                 fRet = TRUE;
    SOCKET               sock, newsock; // SOCKET descriptor
    SOCKADDR_AT          atalkaddr;     // See atalkwsh.h
    WSH_REGISTER_NAME    nbpname;       // structure for registering NBP name
                                        // see atalkwsh.h
    fd_set               readfds;       // fd_set strutture for select call
    int                  addrlen;
    PTEST_INFO           test;
    int                  sockettype = SOCK_STREAM;
    int                  protocoltype = ATPROTO_ADSP;
    unsigned long        ThreadId;
    struct timeval       tval;
    TEST_INFO           *sockptr,
                        *socktmp;

    //
    // open a appletalk socket. The protocol family should be AF_APPLETALK,
    // the socket type can be SOCK_STREAM or SOCK_RDM, and the ProtocolType
    // for PAP socket must be ATPROTO_PAP. Note that opening a socket does
    // not yet create an endpoint on the AppleTalk Protocol. A bind must
    // happen before this socket can be used with AppleTalk;
    //

    do
    {
        if (!_strnicmp(gProtocolName, "PAP", 3))
        {
            sockettype = SOCK_RDM;
            protocoltype = ATPROTO_PAP;
        }
        else if (fRDM)
        {
            sockettype = SOCK_RDM;
        }

        sock = socket(AF_APPLETALK, sockettype, protocoltype);

        if (sock == INVALID_SOCKET)
        {
            printf("Open Socket: Error = %ld\n", WSAGetLastError());
            r = SOCKET_ERROR;
            break;
        }

        atalkaddr.sat_socket = 0;
        atalkaddr.sat_family = AF_APPLETALK;

        r = bind(sock, (struct sockaddr *)&atalkaddr, sizeof(SOCKADDR_AT));
        if(r == SOCKET_ERROR)
        {
            printf("Bind:Error = %d\n", WSAGetLastError());
            break;
        }

        //
        // end point has now been created on the AppleTalk Protocol
        // now register the name that the client will look up.
        //

        strncpy(nbpname.ObjectName, gServerName, MAX_ENTITY-1);
        nbpname.ObjectNameLen = (char) strlen(nbpname.ObjectName);

        strncpy(nbpname.TypeName, gServerType, MAX_ENTITY-1);
        nbpname.TypeNameLen = (char) strlen(nbpname.TypeName);

        strncpy(nbpname.ZoneName, "*", MAX_ENTITY-1);
        nbpname.ZoneNameLen = (char) strlen(nbpname.ZoneName);

        printf("Registering %s:%s@%s\n",
                nbpname.ObjectName,
                nbpname.TypeName,
                nbpname.ZoneName);

        r = setsockopt(
                sock,                          // socket descriptor
                SOL_APPLETALK,                 // socket level - always SOL_APPLETALK
                SO_REGISTER_NAME,              // socket option
                (char *)&nbpname,              // nbp name structure
                sizeof(WSH_NBP_NAME));         // size of nbp name structure

        if (r == SOCKET_ERROR)
        {
            printf("Register Name: Error = %d\n", WSAGetLastError());
            break;
        }

        printf("Socket bound and registered\n");

    } while(FALSE);

    if(r == SOCKET_ERROR)
    {
        closesocket(sock);
        return(FALSE);
    }

    //
    // Post a listen on this socket. The default queue length is 5
    //

    r =  listen(sock, DEF_QUEUE_LEN);
    if (r == SOCKET_ERROR)
    {
        printf("Listen:Error = %d\n", WSAGetLastError());
        closesocket(sock);
        return FALSE;
    }

    __try {
        InitializeCriticalSection(&gListCritSec);
    }
    __except(EXCEPTION_EXECUTE_HANDLER) {
        fprintf(stderr, "Unable to initialize critical section!\n");
        closesocket(sock);
        return FALSE;
    }

    //
    // listen is successful. select the socket for reading
    //

    do
    {
        FD_ZERO(&readfds);            // clear set
        FD_SET(sock, &readfds);       // add sock to set

        tval.tv_sec  = 1;
        tval.tv_usec = 0;

        //
        // this is a blocking select. Select will complete when
        // a client connects.
        //

        r = select(0, &readfds, NULL, NULL, &tval);

        if (r == SOCKET_ERROR)
        {
            printf("Select: Error = %d\n", WSAGetLastError());
            fRet = FALSE;
            break;
        }

        if (r == 0)
        {

            // Timeout, check for exiting threads
            sockptr     = gSocketList;
            while (sockptr)
            {
                r = WaitForSingleObject(sockptr->thread, 0);
                if ((r != WAIT_FAILED) && (r != WAIT_TIMEOUT))
                {
                    printf("Freeing client connection ...\n");

                    EnterCriticalSection(&gListCritSec);
                    if (sockptr->socket == INVALID_SOCKET)
                    {
                        closesocket(sockptr->socket);
                        sockptr->socket = INVALID_SOCKET;
                    }
                    socktmp = sockptr->next;

                    CloseHandle(sockptr->thread);
                    RemoveSockInfo(&gSocketList, sockptr);
                    HeapFree(GetProcessHeap(), 0, sockptr);

                    LeaveCriticalSection(&gListCritSec);

                    sockptr = socktmp;
                }
                else if (r == WAIT_TIMEOUT)
                {
                    sockptr = sockptr->next;
                }
                else if (r == WAIT_FAILED)
                {
                    fRet = FALSE;
                    break;
                }
            }
            if (fRet == FALSE)
                break;

            continue;
        }

        //
        // Accept an incoming request.
        //

        addrlen = sizeof(SOCKADDR_AT);
        newsock = accept(sock, (struct sockaddr *)&atalkaddr, &addrlen);

        if (newsock == INVALID_SOCKET)
        {
            printf("Accept: Socket Error = %d\n", WSAGetLastError());

            fRet = FALSE;
            break;
        }

        printf("Accepted connection from %x:%x:%x\n",
                atalkaddr.sat_net,
                atalkaddr.sat_node,
                atalkaddr.sat_socket);

        test = (PTEST_INFO) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(TEST_INFO));
        if (test == NULL)
        {
            fprintf(stderr, "HeapAlloc failed: %d\n", GetLastError());
            closesocket(newsock);
            fRet = FALSE;
            break;
        }

        test->socket_type = sockettype;
        test->protocol    = protocoltype;
        test->socket      = newsock;

        InsertSockInfo(&gSocketList, test);

        test->thread = CreateThread(
                 NULL,
                 0,
                 (LPTHREAD_START_ROUTINE)PerfThread,
                 (PTEST_INFO) test,
                 0,
                 &ThreadId);
        if (test->thread == NULL)
        {
            fprintf(stderr,"CreateThread NULL 0 PerfThread(%d, 0, %d, 0, %p)",
                    test->socket_type, test->protocol, &ThreadId);
            fRet = FALSE;
            break;
        }

        if (fRet == FALSE)
        {
            break;
        }

    } while (TRUE);

    closesocket(sock);

    //
    // send all done - force client threads to close if outstanding
    //
    sockptr = gSocketList;
    while (sockptr)
    {
        // Close the socket
        EnterCriticalSection(&gListCritSec);
        if (sockptr->socket != INVALID_SOCKET)
        {
            closesocket(sockptr->socket);
            sockptr->socket = INVALID_SOCKET;
        }
        LeaveCriticalSection(&gListCritSec);

        // Once socket is closed, client thread should exit thread on an error
        r = WaitForSingleObject(sockptr->thread, 10000);
        if (r == WAIT_FAILED)
        {
            fprintf(stderr, "WaitForSingleObject failed: %d\n", GetLastError());
        }
        else if (r == WAIT_TIMEOUT)
        {
            fprintf(stderr, "Thread not closing in a timely fashion!\n");
        }

        // Close the thread handle and free the structure
        socktmp = sockptr->next;

        CloseHandle(sockptr->thread);
        RemoveSockInfo(&gSocketList, sockptr);
        HeapFree(GetProcessHeap(), 0, sockptr);

        sockptr = socktmp;
    }

    DeleteCriticalSection(&gListCritSec);

    return(TRUE);
}

unsigned long PerfThread ( PTEST_INFO lpvTest )

Definition at line 609 of file PrPerf.c.

{
    int     r;                          // return from socket calls
    int     recvflags = 0;              // see WSARecvEx call
    CHAR    recvbuf[BLOCKSIZE];         // recv buffer
    u_long  blockmode = 1;              // see ioctlsocket call
    BOOL    fRet = TRUE;
    int     NumBytesRecvd = 0;

    //
    // make socket non blocking. As far as possible, use non
    // blocking sockets to improve performance of app.
    //
    //

    r = ioctlsocket(lpvTest->socket, FIONBIO, &blockmode);

    if( r == SOCKET_ERROR)
    {
        printf("ioctlsocket: error = %d\n", WSAGetLastError());
        fRet = FALSE;
        ExitThread(FALSE);
    }

    do
    {
        //
        // Prime a Read here. This will enable the receive to complete
        // This is PAP specific. For other AppleTalk protocols -
        // ADSP and DDP a recv can be posted directly
        //

        if(!_strnicmp(gProtocolName, "PAP", 3))
        {

            r = setsockopt(lpvTest->socket,
                    SOL_APPLETALK,
                    SO_PAP_PRIME_READ,
                    recvbuf,
                    sizeof(recvbuf));

            if (r == SOCKET_ERROR)
            {
                printf("primeread: error = %d\n", WSAGetLastError());
                fRet = FALSE;
                break;
            }
        }

        fRet = CheckForRecv(lpvTest->socket);

        if (fRet == FALSE)
            break;

        recvflags = 0;
        r = WSARecvEx(lpvTest->socket,recvbuf,sizeof(recvbuf), &recvflags);

        if( r == SOCKET_ERROR)
        {

            if (WSAGetLastError() == WSAEWOULDBLOCK)
            {
                continue;
            }
            else
            {
                if(WSAGetLastError() == WSAENOTCONN || WSAGetLastError() == WSAEFAULT)
                    break;
                printf("recv: error = %d\n", WSAGetLastError());
                fRet = FALSE;
                break;
            }

        }
        if (r == 0)
             break;

        if ((lpvTest->socket_type == SOCK_RDM) && (r < sizeof(recvbuf)))
        {
            printf("Did not receive entire message (%d bytes)\n", r);
            fRet = FALSE;
            break;
        }

        printf("Recvd %d bytes\n", r);

        if (fVerify)
        {
            int rr, sendoffset, sendleft;

            sendoffset = 0;
            sendleft   = r;

            do
            {
                fRet = CheckForSend(lpvTest->socket);

                if (fRet == FALSE)
                {
                    printf("send select error\n");
                    break;
                }

                rr = send(lpvTest->socket, &recvbuf[sendoffset], sendleft, 0);

                if ( rr == SOCKET_ERROR )
                {
                    if(WSAGetLastError() == WSAEWOULDBLOCK)
                    {
                        printf("Send: error = WSAEWOULDBLOCK\n");
                        continue;
                    }
                    else
                    {
                        printf("send: error = %d\n", WSAGetLastError());
                        break;
                    }

                }

                printf("Bytes Sent %d\n", rr);

                sendoffset += rr;
                sendleft   -= rr;

            } while(sendleft > 0);

        }  // endif Verify

        NumBytesRecvd += r;

    } while(TRUE);

    printf("Total Number of Bytes Received = %d \n",NumBytesRecvd);

    EnterCriticalSection(&gListCritSec);

    closesocket(lpvTest->socket);
    lpvTest->socket = INVALID_SOCKET;

    LeaveCriticalSection(&gListCritSec);

    ExitThread(TRUE);
}

void RemoveSockInfo | ( | TEST_INFO ** | head,
 |  | TEST_INFO * | info
 | ) |  |

Definition at line 106 of file PrPerf.c.

{
    if (info->next)
        info->next->prev = info->prev;
    if (info->prev)
        info->prev->next = info->next;

    if (info == *head)
    {
        *head = info->next;
    }
}

void usage ( )

Definition at line 1257 of file PrPerf.c.

{

   printf("prperf -s/c <options>\n");
   printf("\t-s/c\t Server/Client\n");
   printf("\t-n\t Server Name\n");
   printf("\t-t\t Server Type \n");
   printf("\t-z\t Server Zone \n");
   printf("\t-p\t Protocol Name (ADSP/PAP)\n");
   printf("\t-b\t Number of times to send a 4k buffer (Default = 5) \n");
   printf("\t-l\t Number of times to re-start prperf (Default = 1) (Client only)\n");
   printf("\t-v\t Verify Integrity of data transmission. \n");
   printf("\t-y\t Change ADSP to use SOCK_RDM instead of SOCK_STREAM. \n");
   printf("\n");
   exit(1);

}

Variable Documentation

double AvgThroughPut

Definition at line 56 of file PrPerf.c.

CHAR DataString[] = {"0123456789abcdefghijklmnopqrstuvwxyz~!@#$%^&*()_+"}

Definition at line 58 of file PrPerf.c.

FILETIME FileTime

Definition at line 50 of file PrPerf.c.

BOOL fRDM = FALSE

Definition at line 53 of file PrPerf.c.

BOOL fVerify = FALSE

Definition at line 52 of file PrPerf.c.

CRITICAL_SECTION gListCritSec

Definition at line 72 of file PrPerf.c.

size_t gNumTimes = 5

Definition at line 46 of file PrPerf.c.

CHAR gProtocolName[PROTOCOL_LEN] = "ADSP"

Definition at line 45 of file PrPerf.c.

CHAR gServerName[MAX_ENTITY] = DEF_SERVER_NAME

Definition at line 42 of file PrPerf.c.

CHAR gServerType[MAX_ENTITY] = DEF_SERVER_TYPE

Definition at line 43 of file PrPerf.c.

CHAR gServerZone[MAX_ENTITY] = DEF_SERVER_ZONE

Definition at line 44 of file PrPerf.c.

PTEST_INFO gSocketList = NULL

Definition at line 71 of file PrPerf.c.

int loop = 1

Definition at line 55 of file PrPerf.c.

int looptot

Definition at line 55 of file PrPerf.c.

double MaxThroughPut

Definition at line 56 of file PrPerf.c.

double MinThroughPut

Definition at line 56 of file PrPerf.c.

SYSTEMTIME SystemEndTime

Definition at line 49 of file PrPerf.c.

SYSTEMTIME SystemStartTime

Definition at line 48 of file PrPerf.c.

double Throughput

Definition at line 56 of file PrPerf.c.

Generated on Wed Nov 13 2024 16:54:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/appletalk/PrSamp.h File Reference

  • NetDS
  • WinSock
  • appletalk
Functions

PrSamp.h File Reference

Go to the source code of this file.

Functions

BOOL | CheckForRecv (SOCKET s)
BOOL | CheckForSend (SOCKET s)
BOOL DoClient ()
BOOL DoServer ()
BOOL OpenSocketRegisterAndListen ()
unsigned long | PerfThread (LPVOID lpvTest)
void | usage ()

Function Documentation

BOOL CheckForRecv ( SOCKET s )

Definition at line 1234 of file PrPerf.c.

{

   fd_set readfds;
   int r;

   FD_ZERO(&readfds);
   FD_SET(s, &readfds);

#ifdef DEBUG
   printf("\t\tChecking for Recv..\n");
#endif

   r = select(0, &readfds, NULL, NULL, NULL);

   if (r != 1)
   {
       printf("select:error = %d\n", WSAGetLastError());
       return(FALSE);
   }
   return(TRUE);
}

BOOL CheckForSend ( SOCKET s )

Definition at line 1199 of file PrPerf.c.

{

   fd_set writefds;
   int r;

#ifdef DEBUG
   printf("\t\tChecking for Send..\n");
#endif

   FD_ZERO(&writefds);
   FD_SET(s, &writefds);

   //
   // indefinite wait select
   //
   r = select(0, NULL, &writefds, NULL, NULL);

   if (r != 1)
   {
       printf("select:error = %d\n", WSAGetLastError());
       return(FALSE);
   }
   return(TRUE);
}

BOOL DoClient ( )

Definition at line 765 of file PrPerf.c.

{
    int                  r = 0;             // return code
    BOOL                 fRet = FALSE;      //
    CHAR                 LookupBuffer[512]; // LookUp results return buffer
    PCHAR                ptupleBuffer;
    PWSH_LOOKUP_NAME     pLookup;
    PWSH_NBP_TUPLE       pTempTuple;
    SOCKADDR_AT          ataddress;
    int                  WrittenSize;
    SOCKET               clntsock;
    u_long               blockmode = 1;          // for ioctlsocket
    int                  BytesTransferred = 0;
    char *               memhandle;
    DWORD                hourdiff;          //, minutediff, seconddiff;
    double               StartSecond, EndSecond, ElapsedSeconds;
    int                  sendleft, sendoffset, recvleft, recvoffset;
    int                  sockettype = SOCK_STREAM;
    int                  prototype = ATPROTO_ADSP;
    size_t               i,copycount;

    if (!_strnicmp(gProtocolName, "PAP", 3))
    {
        sockettype = SOCK_RDM;
        prototype = ATPROTO_PAP;
    }
    else if (fRDM)
    {
        sockettype = SOCK_RDM;
    }

    do
    {
        //
        // See socket call in OpenSocketRegisterAndListen for desc
        //
        clntsock = socket(AF_APPLETALK, sockettype, prototype);

        if(clntsock == INVALID_SOCKET)
        {
            printf("Open Socket: Error = %ld\n", WSAGetLastError());
            r = SOCKET_ERROR;
            break;
        }

        ataddress.sat_socket = 0;
        ataddress.sat_family = AF_APPLETALK;

        r = bind(clntsock, (struct sockaddr *)&ataddress, sizeof(SOCKADDR_AT));

        if (r == SOCKET_ERROR)
        {
            printf("Bind:Error = %d\n", WSAGetLastError());
            break;
        }

        //
        // end point has now been created on the AppleTalk Protocol.
        // lookup the server name.
        //

        pLookup = (PWSH_LOOKUP_NAME)LookupBuffer;

        strncpy(pLookup->LookupTuple.NbpName.ObjectName, gServerName, MAX_ENTITY-1);
        pLookup->LookupTuple.NbpName.ObjectNameLen = (char) strlen(gServerName);

        strncpy(pLookup->LookupTuple.NbpName.TypeName,  gServerType, MAX_ENTITY-1);
        pLookup->LookupTuple.NbpName.TypeNameLen = (char) strlen(gServerType);

        strncpy(pLookup->LookupTuple.NbpName.ZoneName, gServerZone, MAX_ENTITY-1);
        pLookup->LookupTuple.NbpName.ZoneNameLen = (char) strlen(gServerZone);

        printf("Looking up %s:%s@%s\n",
                pLookup->LookupTuple.NbpName.ObjectName,
                pLookup->LookupTuple.NbpName.TypeName,
                pLookup->LookupTuple.NbpName.ZoneName);

        WrittenSize = sizeof(LookupBuffer);

        r = getsockopt(clntsock, SOL_APPLETALK, SO_LOOKUP_NAME,
                (char*)LookupBuffer,
                &WrittenSize);

        if(r == SOCKET_ERROR)
        {
            printf("getsockopt:error = %d\n", WSAGetLastError());
            break;

        }

        if (pLookup->NoTuples <= 0)
        {
            printf("LookupName failed - no tuples found\n");
            r=-1;
            break;
        }

        ptupleBuffer = (char *)pLookup+sizeof(WSH_LOOKUP_NAME);
        pTempTuple = (PWSH_NBP_TUPLE)ptupleBuffer;

        ataddress.sat_family = AF_APPLETALK;
        ataddress.sat_net = pTempTuple[0].Address.Network;
        ataddress.sat_node = pTempTuple[0].Address.Node;
        ataddress.sat_socket = pTempTuple[0].Address.Socket;

        printf("server address = %lx.%lx.%lx.\n", ataddress.sat_net,
                ataddress.sat_node,
                ataddress.sat_socket);

        //
        // lookup succeeded. Use the address in ataddress to connect to the
        // server
        //

        r =  connect(clntsock, (struct sockaddr *)&ataddress, sizeof(SOCKADDR_AT));

        if (r == SOCKET_ERROR)
        {
            printf("connect: error = %d\n", WSAGetLastError());
            break;
        }

#ifdef DEBUG
        //       printf("Connect Succeeded\n");
#endif

    }while(FALSE);

    if (r == SOCKET_ERROR)
    {
        if (clntsock != INVALID_SOCKET)
        {
            closesocket(clntsock);
            clntsock = INVALID_SOCKET;
        }
        return(FALSE);
    }

    //
    //  Set Socket to non blocking mode
    //

    r = ioctlsocket(clntsock, FIONBIO, &blockmode);

#ifdef DEBUG
    //       printf("ioctlsocket Succeeded\n");
#endif

    if( r == SOCKET_ERROR)
    {
        printf("ioctlsocket: error = %d\n", WSAGetLastError());
        return FALSE;
    }

    //
    // Fill Up Send Buffer with Data
    //
    memhandle = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, BLOCKSIZE);
    if (memhandle == NULL)
    {
        printf("LocalAlloc Failed %d\n", GetLastError());
        closesocket(clntsock);
        return(FALSE);
    }

    //
    // fill the buffer with Data
    //
    i = 0;
    while (i < BLOCKSIZE)
    {
        if (i+strlen(DataString) <= BLOCKSIZE)
            copycount = strlen(DataString);
        else
            copycount = BLOCKSIZE - i;
        memcpy(&memhandle[i], DataString, copycount);
        i += copycount;
    }
    memhandle[BLOCKSIZE-1] = '\0';

    fRet = CheckForSend(clntsock);

    if(fRet == FALSE)
    {
        closesocket(clntsock);
        HeapFree(GetProcessHeap(), 0, memhandle);
        return FALSE;
    }

    GetLocalTime(&SystemStartTime);

#ifdef DEBUG
    printf("Data Size = %d\n", lstrlen(memhandle)+1);
    //   printf("Base Data sent: %s\n",DataStartPtr);
    printf("Start Time:%d:%2d:%2d:%2d\t", SystemStartTime.wHour,
            SystemStartTime.wMinute,
            SystemStartTime.wSecond,
            SystemStartTime.wMilliseconds);
#endif

    for( i= 0; i < gNumTimes; i++)
    {
        //
        // Can I send - CheckForSend calls select to find if we can send
        // without blocking
        //

        sendleft   = BLOCKSIZE;
        sendoffset = 0;

        do
        {
            fRet = CheckForSend(clntsock);

            if(fRet == FALSE)
            {
                printf("send select error\n");
                break;
            }

            r = send(clntsock, &memhandle[sendoffset], sendleft, 0);

            if ( r == SOCKET_ERROR )
            {

                if( WSAGetLastError() == WSAEWOULDBLOCK )
                {
                    printf("send: wouldblock\n");
                    continue;
                }
                else
                {
                    printf("send: error = %d\n", WSAGetLastError());
                    fRet = FALSE;
                    break;
                }

            }

            sendleft   -= r;
            sendoffset += r;

        } while(sendleft > 0);

        if (fRet == FALSE)
            break;

        printf("Sent %d bytes\n", sendoffset);

        if ((fVerify) && (sendleft == 0))
        {
            CHAR buffer[BLOCKSIZE];
            int recvflag = 0;
            int rr, pos = 0;

            //
            // Prime a Read here. This will enable the receive to complete
            // This is PAP specific. For other AppleTalk protocols -
            // ADSP and DDP a recv can be posted directly
            //

            if(!_strnicmp(gProtocolName, "PAP", 3))
            {
                rr = setsockopt(clntsock,
                        SOL_APPLETALK,
                        SO_PAP_PRIME_READ,
                        buffer,
                        sizeof(buffer));

                if (rr == SOCKET_ERROR)
                {
                    printf("primeread: error = %d\n", WSAGetLastError());
                    fRet = FALSE;
                    break;
                }
            }

            recvleft   = sendoffset;
            recvoffset = 0;
            do
            {

                fRet = CheckForRecv(clntsock);

                if(fRet == FALSE)
                    break;

                recvflag = 0;
                rr = WSARecvEx(clntsock, &buffer[recvoffset], recvleft, &recvflag);

                if( rr == SOCKET_ERROR)
                {
                    if (WSAGetLastError() == WSAEWOULDBLOCK)
                        continue;
                    else
                    {
                        printf("recv: error = %d\n", WSAGetLastError());
                        fRet = FALSE;
                        break;
                    }
                }

                recvoffset += rr;
                recvleft   -= rr;

                printf("Recv'd %d bytes\n", rr);

                if ( (recvflag == 0) || (sockettype == SOCK_RDM) ||
                        (recvleft == 0)  )
                    break;

            } while(recvleft > 0);

            if ((memcmp(memhandle, buffer, BLOCKSIZE) != 0) && (fRet != FALSE))
            {
                printf("Strings do not compare\n");
#ifdef DEBUG
                //                       printf("Data sent: \n%s\n",memhandle);
                //                       printf("Data recv'd: \n%s\n",buffer);
#endif

            }

        } // IF (fVerify)

        BytesTransferred += sendoffset;

    } // FOR

    GetLocalTime(&SystemEndTime);

#ifdef DEBUG
    printf("End Time:%d:%2d:%2d:%2d\t", SystemEndTime.wHour,
            SystemEndTime.wMinute,
            SystemEndTime.wSecond,
            SystemEndTime.wMilliseconds);
#endif

    //
    // calculate the difference
    //

    hourdiff = SystemEndTime.wHour - SystemStartTime.wHour;

    StartSecond = (SystemStartTime.wHour * 3600) +
        (SystemStartTime.wMinute * 60) +
        SystemStartTime.wSecond +
        (SystemStartTime.wMilliseconds * 0.001);

    EndSecond = 0;

    if(SystemEndTime.wMonth != SystemStartTime.wMonth)
    {
        EndSecond = (SystemEndTime.wDay * 24) * 3600;
        switch (SystemStartTime.wMonth)
        {
            case 1:
            case 3:
            case 5:
            case 7:
            case 8:
            case 10:
            case 12:
                EndSecond = ((31 - SystemStartTime.wDay) * 24) + EndSecond;
                break;
            case 4:
            case 6:
            case 9:
            case 11:
                EndSecond = ((30 - SystemStartTime.wDay) * 24) + EndSecond;
                break;
            case 2:
                if((SystemStartTime.wYear % 400 == 0) ||
                        ((SystemStartTime.wYear % 4 == 0) &&
                         (SystemStartTime.wYear % 100 != 0)))
                    EndSecond = ((29 - SystemStartTime.wDay) *
                            24) + EndSecond;
                else
                    EndSecond = ((28 - SystemStartTime.wDay) *
                            24) + EndSecond;
                break;
        }
    }
    else
        if(SystemEndTime.wDay > SystemStartTime.wDay)
        {
            EndSecond = ((SystemEndTime.wDay - SystemStartTime.wDay) * 24) * 3600;
        }

    EndSecond = EndSecond + (SystemEndTime.wHour * 3600) +
        (SystemEndTime.wMinute * 60) + SystemEndTime.wSecond +
        (SystemEndTime.wMilliseconds * 0.001);

    ElapsedSeconds = EndSecond-StartSecond;

#ifdef DEBUG
    printf("Elapsed Time (secs) = %6.3f\n", ElapsedSeconds);
    printf("Bytes Transferred = %ld\n", BytesTransferred);
    printf("Send All Done\n");
#endif

    if(ElapsedSeconds !=0)
    {
        Throughput = (BytesTransferred)/(ElapsedSeconds) ;

#ifdef DEBUG
        printf("Throughput (bytes/sec) = %6.2f\n", Throughput);
#endif

    }

    printf("\n");

    closesocket(clntsock);

    HeapFree(GetProcessHeap(), 0, memhandle);

    return(TRUE);

}

BOOL DoServer ( )

Definition at line 277 of file PrPerf.c.

{
    BOOL   fRet = FALSE;

    //
    // register the name specified on the command line  or use the
    // defaults.
    //

    fRet = OpenSocketRegisterAndListen();

    return(fRet);

}

BOOL OpenSocketRegisterAndListen ( )

Definition at line 303 of file PrPerf.c.

{

    int                  r = 0;         // return from socket calls
    BOOL                 fRet = TRUE;
    SOCKET               sock, newsock; // SOCKET descriptor
    SOCKADDR_AT          atalkaddr;     // See atalkwsh.h
    WSH_REGISTER_NAME    nbpname;       // structure for registering NBP name
                                        // see atalkwsh.h
    fd_set               readfds;       // fd_set strutture for select call
    int                  addrlen;
    PTEST_INFO           test;
    int                  sockettype = SOCK_STREAM;
    int                  protocoltype = ATPROTO_ADSP;
    unsigned long        ThreadId;
    struct timeval       tval;
    TEST_INFO           *sockptr,
                        *socktmp;

    //
    // open a appletalk socket. The protocol family should be AF_APPLETALK,
    // the socket type can be SOCK_STREAM or SOCK_RDM, and the ProtocolType
    // for PAP socket must be ATPROTO_PAP. Note that opening a socket does
    // not yet create an endpoint on the AppleTalk Protocol. A bind must
    // happen before this socket can be used with AppleTalk;
    //

    do
    {
        if (!_strnicmp(gProtocolName, "PAP", 3))
        {
            sockettype = SOCK_RDM;
            protocoltype = ATPROTO_PAP;
        }
        else if (fRDM)
        {
            sockettype = SOCK_RDM;
        }

        sock = socket(AF_APPLETALK, sockettype, protocoltype);

        if (sock == INVALID_SOCKET)
        {
            printf("Open Socket: Error = %ld\n", WSAGetLastError());
            r = SOCKET_ERROR;
            break;
        }

        atalkaddr.sat_socket = 0;
        atalkaddr.sat_family = AF_APPLETALK;

        r = bind(sock, (struct sockaddr *)&atalkaddr, sizeof(SOCKADDR_AT));
        if(r == SOCKET_ERROR)
        {
            printf("Bind:Error = %d\n", WSAGetLastError());
            break;
        }

        //
        // end point has now been created on the AppleTalk Protocol
        // now register the name that the client will look up.
        //

        strncpy(nbpname.ObjectName, gServerName, MAX_ENTITY-1);
        nbpname.ObjectNameLen = (char) strlen(nbpname.ObjectName);

        strncpy(nbpname.TypeName, gServerType, MAX_ENTITY-1);
        nbpname.TypeNameLen = (char) strlen(nbpname.TypeName);

        strncpy(nbpname.ZoneName, "*", MAX_ENTITY-1);
        nbpname.ZoneNameLen = (char) strlen(nbpname.ZoneName);

        printf("Registering %s:%s@%s\n",
                nbpname.ObjectName,
                nbpname.TypeName,
                nbpname.ZoneName);

        r = setsockopt(
                sock,                          // socket descriptor
                SOL_APPLETALK,                 // socket level - always SOL_APPLETALK
                SO_REGISTER_NAME,              // socket option
                (char *)&nbpname,              // nbp name structure
                sizeof(WSH_NBP_NAME));         // size of nbp name structure

        if (r == SOCKET_ERROR)
        {
            printf("Register Name: Error = %d\n", WSAGetLastError());
            break;
        }

        printf("Socket bound and registered\n");

    } while(FALSE);

    if(r == SOCKET_ERROR)
    {
        closesocket(sock);
        return(FALSE);
    }

    //
    // Post a listen on this socket. The default queue length is 5
    //

    r =  listen(sock, DEF_QUEUE_LEN);
    if (r == SOCKET_ERROR)
    {
        printf("Listen:Error = %d\n", WSAGetLastError());
        closesocket(sock);
        return FALSE;
    }

    __try {
        InitializeCriticalSection(&gListCritSec);
    }
    __except(EXCEPTION_EXECUTE_HANDLER) {
        fprintf(stderr, "Unable to initialize critical section!\n");
        closesocket(sock);
        return FALSE;
    }

    //
    // listen is successful. select the socket for reading
    //

    do
    {
        FD_ZERO(&readfds);            // clear set
        FD_SET(sock, &readfds);       // add sock to set

        tval.tv_sec  = 1;
        tval.tv_usec = 0;

        //
        // this is a blocking select. Select will complete when
        // a client connects.
        //

        r = select(0, &readfds, NULL, NULL, &tval);

        if (r == SOCKET_ERROR)
        {
            printf("Select: Error = %d\n", WSAGetLastError());
            fRet = FALSE;
            break;
        }

        if (r == 0)
        {

            // Timeout, check for exiting threads
            sockptr     = gSocketList;
            while (sockptr)
            {
                r = WaitForSingleObject(sockptr->thread, 0);
                if ((r != WAIT_FAILED) && (r != WAIT_TIMEOUT))
                {
                    printf("Freeing client connection ...\n");

                    EnterCriticalSection(&gListCritSec);
                    if (sockptr->socket == INVALID_SOCKET)
                    {
                        closesocket(sockptr->socket);
                        sockptr->socket = INVALID_SOCKET;
                    }
                    socktmp = sockptr->next;

                    CloseHandle(sockptr->thread);
                    RemoveSockInfo(&gSocketList, sockptr);
                    HeapFree(GetProcessHeap(), 0, sockptr);

                    LeaveCriticalSection(&gListCritSec);

                    sockptr = socktmp;
                }
                else if (r == WAIT_TIMEOUT)
                {
                    sockptr = sockptr->next;
                }
                else if (r == WAIT_FAILED)
                {
                    fRet = FALSE;
                    break;
                }
            }
            if (fRet == FALSE)
                break;

            continue;
        }

        //
        // Accept an incoming request.
        //

        addrlen = sizeof(SOCKADDR_AT);
        newsock = accept(sock, (struct sockaddr *)&atalkaddr, &addrlen);

        if (newsock == INVALID_SOCKET)
        {
            printf("Accept: Socket Error = %d\n", WSAGetLastError());

            fRet = FALSE;
            break;
        }

        printf("Accepted connection from %x:%x:%x\n",
                atalkaddr.sat_net,
                atalkaddr.sat_node,
                atalkaddr.sat_socket);

        test = (PTEST_INFO) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(TEST_INFO));
        if (test == NULL)
        {
            fprintf(stderr, "HeapAlloc failed: %d\n", GetLastError());
            closesocket(newsock);
            fRet = FALSE;
            break;
        }

        test->socket_type = sockettype;
        test->protocol    = protocoltype;
        test->socket      = newsock;

        InsertSockInfo(&gSocketList, test);

        test->thread = CreateThread(
                 NULL,
                 0,
                 (LPTHREAD_START_ROUTINE)PerfThread,
                 (PTEST_INFO) test,
                 0,
                 &ThreadId);
        if (test->thread == NULL)
        {
            fprintf(stderr,"CreateThread NULL 0 PerfThread(%d, 0, %d, 0, %p)",
                    test->socket_type, test->protocol, &ThreadId);
            fRet = FALSE;
            break;
        }

        if (fRet == FALSE)
        {
            break;
        }

    } while (TRUE);

    closesocket(sock);

    //
    // send all done - force client threads to close if outstanding
    //
    sockptr = gSocketList;
    while (sockptr)
    {
        // Close the socket
        EnterCriticalSection(&gListCritSec);
        if (sockptr->socket != INVALID_SOCKET)
        {
            closesocket(sockptr->socket);
            sockptr->socket = INVALID_SOCKET;
        }
        LeaveCriticalSection(&gListCritSec);

        // Once socket is closed, client thread should exit thread on an error
        r = WaitForSingleObject(sockptr->thread, 10000);
        if (r == WAIT_FAILED)
        {
            fprintf(stderr, "WaitForSingleObject failed: %d\n", GetLastError());
        }
        else if (r == WAIT_TIMEOUT)
        {
            fprintf(stderr, "Thread not closing in a timely fashion!\n");
        }

        // Close the thread handle and free the structure
        socktmp = sockptr->next;

        CloseHandle(sockptr->thread);
        RemoveSockInfo(&gSocketList, sockptr);
        HeapFree(GetProcessHeap(), 0, sockptr);

        sockptr = socktmp;
    }

    DeleteCriticalSection(&gListCritSec);

    return(TRUE);
}

unsigned long PerfThread ( LPVOID lpvTest )
void usage ( )

Definition at line 23 of file client.cxx.

{
   cout << endl << "Usage: client <OPTION>" << endl << endl
           << "OPTION : PIPE_AS_IN_PARAMETER | PIPE_AS_OUT_PARAMETER | "
           << " PIPE_AS_IN_OUT_PARAMETER | PIPES_AS_IN_IN_OUT_PARAMETERS "
           << endl << endl;
   return;
}

Generated on Wed Nov 13 2024 16:54:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/ATMEvent/ATMEvent.Cpp File Reference

  • NetDS
  • WinSock
  • ATMEvent
Defines | Functions

ATMEvent.Cpp File Reference

#include "atmevent.h"

Go to the source code of this file.

Defines

#define | ATMEVENT_MAIN

Functions

int __cdecl | main (int argc, char **argv)

Define Documentation

#define ATMEVENT_MAIN

Definition at line 64 of file ATMEvent.Cpp.

Function Documentation

int __cdecl main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 75 of file ATMEvent.Cpp.

{
    int n = 0;
    OPTIONS options;
    WSADATA WSAData;

    if (!ValidOptions(argc, argv, &options))
        return 1;

    if (0 != (n = WSAStartup(MAKEWORD(2,2), &WSAData)))
    {
        printf("WSAStartup failed w/%d\n", n);
        return 1;
    }

    if (!FindATMServiceProvider(&options.protocolInfo))
    {
        printf("No matching service provider found\n");
    } else
    {
        PrintOptions(&options);
        if (CMD_RECEIVER == options.cmd)
            Receiver(&options);
        else if (CMD_SENDER == options.cmd)
            Sender(&options);
        else // enumerate ATM interfaces
            Enumerator(&options);
    }

    if (options.buf) Free(options.buf);
    WSACleanup();
    return 0;
}

Generated on Wed Nov 13 2024 16:54:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/ATMEvent/ATMEvent.h File Reference

  • NetDS
  • WinSock
  • ATMEvent
Classes | Defines | Typedefs | Enumerations | Functions

ATMEvent.h File Reference

#include <winsock2.h>
#include <ws2atm.h>
#include <stdlib.h>
#include <stdio.h>

Go to the source code of this file.

Classes

struct | _OPTIONS

Defines

#define | Free(x) HeapFree(GetProcessHeap(),0,(x))
#define | Malloc(x) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (x))
#define | MAX_ATM_INTERFACE_LEN 41

Typedefs

typedef struct _OPTIONS | OPTIONS

Enumerations

enum | CMD_TYPE { CMD_SENDER, CMD_RECEIVER, CMD_ENUMERATOR }

Functions

VOID | Enumerator (OPTIONS *pOptions)
void | PrintQos (QOS *qos, CHAR *lpszIndent)
VOID | Receiver (OPTIONS *pOptions)
VOID | Sender (OPTIONS *pOptions)

Define Documentation

#define Free ( x ) HeapFree(GetProcessHeap(),0,(x))

Definition at line 28 of file ATMEvent.h.

#define Malloc ( x ) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (x))

Definition at line 27 of file ATMEvent.h.

#define MAX_ATM_INTERFACE_LEN 41

Definition at line 32 of file ATMEvent.h.

Typedef Documentation

typedef struct _OPTIONS OPTIONS

Enumeration Type Documentation

enum CMD_TYPE
Enumerator:
CMD_SENDER
CMD_RECEIVER
CMD_ENUMERATOR

Definition at line 34 of file ATMEvent.h.

{
    CMD_SENDER,
    CMD_RECEIVER,
    CMD_ENUMERATOR
} CMD_TYPE;

Function Documentation

VOID Enumerator ( OPTIONS * pOptions )

Definition at line 28 of file Enumerator.Cpp.

{
    SOCKET          sd = INVALID_SOCKET;
    SOCKADDR_ATM    atm_addr = {0};
    CHAR            szAddress[MAX_ATM_INTERFACE_LEN] = {'\0'};
    DWORD           dwNumInterfaces = 0;
    DWORD           dwAddrLen = 0;
    DWORD           dwBytes=sizeof(DWORD);
    int             nRet = 0;

    sd = WSASocket(FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO,
                   &pOptions->protocolInfo, 0, WSA_FLAG_OVERLAPPED);
    if (INVALID_SOCKET == sd)
    {
        printf("WSASocket: %d\n", WSAGetLastError());
        return;
    }

    nRet = WSAIoctl(sd, SIO_GET_NUMBER_OF_ATM_DEVICES,
                    NULL, 0,
                    (LPVOID)&dwNumInterfaces, sizeof(dwNumInterfaces), &dwBytes,
                    NULL, NULL);
    if (SOCKET_ERROR == nRet)
    {
        printf("WSAIoctl:SIO_GET_NUMBER_OF_ATM_DEVICES: %d\n", WSAGetLastError());
        return;
    }

    for (DWORD i=0; i < dwNumInterfaces ;i++)
    {
        ZeroMemory(&atm_addr, sizeof(SOCKADDR_ATM));

        nRet = WSAIoctl(sd, SIO_GET_ATM_ADDRESS,
                        (LPVOID)&i, sizeof(DWORD),
                        (LPVOID)&atm_addr.satm_number, sizeof(atm_addr.satm_number), &dwBytes,
                        NULL, NULL);
        if (SOCKET_ERROR == nRet)
        {
            printf("WSAIoctl:SIO_GET_ATM_ADDRESS: %d\n", WSAGetLastError());
            return;
        }

        // fill in remainder of ATM address structure
        atm_addr.satm_family                 = AF_ATM;
        atm_addr.satm_number.AddressType     = ATM_NSAP;
        atm_addr.satm_number.NumofDigits     = ATM_ADDR_SIZE;
        atm_addr.satm_blli.Layer2Protocol    = SAP_FIELD_ANY;
        atm_addr.satm_blli.Layer3Protocol    = SAP_FIELD_ABSENT;
        atm_addr.satm_bhli.HighLayerInfoType = SAP_FIELD_ABSENT;

        ZeroMemory(szAddress, sizeof(szAddress));
        dwAddrLen = sizeof(szAddress);
        if (SOCKET_ERROR == WSAAddressToString((LPSOCKADDR)&atm_addr, sizeof(atm_addr),
                               &pOptions->protocolInfo, szAddress, &dwAddrLen))
        {
            printf("WSAAddressToString: %d\n", WSAGetLastError());
            break;
        }
        printf("ATM Interface [%d]: <%s>\n", i, szAddress);
    }

    if (INVALID_SOCKET != sd)
    {
        closesocket(sd);
        sd = INVALID_SOCKET;
    }
    return;
}

void PrintQos | ( | QOS * | qos,
 |  | CHAR * | lpszIndent
 | ) |  |

Definition at line 55 of file PrintQos.Cpp.

{
    CHAR szIndent[24];

    strncpy(szIndent, lpszIndent, sizeof(szIndent));
    szIndent[sizeof(szIndent)-1] = '\0';

    if (NULL == qos)
    {
        printf("%sQOS structure is NULL\n", szIndent);
        return;
    }

    printf("%sSendingFlowSpec\n", szIndent);
    PrintFlowspec(&qos->SendingFlowspec, szIndent);

    printf("%sReceivingingFlowSpec\n", szIndent);
    PrintFlowspec(&qos->ReceivingFlowspec, szIndent);

    printf("%sProviderSpecific - len = %d\n", szIndent,
                qos->ProviderSpecific.len);
    PrintProviderSpecific(&qos->ProviderSpecific, szIndent);

    printf("\n");
    return;
}

VOID Receiver ( OPTIONS * pOptions )

Definition at line 53 of file Receiver.Cpp.

{
    WSANETWORKEVENTS NetworkEvents = {0};
    long lNetworkEvents = 0;
    BOOL bProcessEventsDone = FALSE;
    RECV_INFO RecvInfo = {0};
    int i = 0;

    printf("Receiver\n");

    //init RecvInfo sockets/event handles
    for (i = 0; i < MAXCLIENTS+1; i++)
    {
        RecvInfo.sd[i] = INVALID_SOCKET;
        RecvInfo.hEvents[i] = WSA_INVALID_EVENT;
    }

    for (i=0; i<MAXCLIENTS+1; i++)
    {
        if (WSA_INVALID_EVENT == (RecvInfo.hEvents[i] = WSACreateEvent()))
        {
            printf("WSACreateEvent(%d): %d\n", i, WSAGetLastError());
            goto CLEANUP;
        }
    }

    // create the receiving/listening socket
    if (!CreateReceivingSocket(&RecvInfo, pOptions))
        goto CLEANUP;

    lNetworkEvents = (FD_ACCEPT|FD_READ|FD_CLOSE);
    if (SOCKET_ERROR == WSAEventSelect(RecvInfo.sd[0], RecvInfo.hEvents[0], lNetworkEvents))
    {
        printf("WSAEventSelect: %d\n", WSAGetLastError());
        goto CLEANUP;
    }

    bProcessEventsDone = FALSE;
    while (!bProcessEventsDone)
    {
        DWORD dwEvent;

        dwEvent = WSAWaitForMultipleEvents((MAXCLIENTS+1), RecvInfo.hEvents, FALSE, WSA_INFINITE, FALSE);
        switch (dwEvent)
        {
        case WSA_WAIT_FAILED:
            printf("WSAEventSelect: %d\n", WSAGetLastError());
            bProcessEventsDone = TRUE;
            break;
        case WAIT_IO_COMPLETION:
        case WSA_WAIT_TIMEOUT:
            break;

        default:
            // lets see what network activity trigged this event
            NetworkEvents.lNetworkEvents = 0;
            if (SOCKET_ERROR == WSAEnumNetworkEvents(RecvInfo.sd[dwEvent], RecvInfo.hEvents[dwEvent], &NetworkEvents))
            {
                printf("WSAEnumNetworkEvent: %d dwEvent %d lNetworkEvent %X\n",
                       WSAGetLastError(), dwEvent, NetworkEvents.lNetworkEvents);
                NetworkEvents.lNetworkEvents = 0;
                bProcessEventsDone = TRUE;
            } else
            {
                // it is possible that more than one notification triggered the event
                //printf("WSAEnumNetworkEvents %X\n", NetworkEvents.lNetworkEvents);
                if (FD_ACCEPT & NetworkEvents.lNetworkEvents)
                    bProcessEventsDone |=
                    fd_accept_func(dwEvent, &NetworkEvents, &RecvInfo, pOptions);
                if (FD_READ   & NetworkEvents.lNetworkEvents)
                    bProcessEventsDone |=
                    fd_read_func(dwEvent, &NetworkEvents, &RecvInfo, pOptions);
                if (FD_CLOSE  & NetworkEvents.lNetworkEvents)
                    bProcessEventsDone |=
                    fd_close_func(dwEvent, &NetworkEvents, &RecvInfo, pOptions);
            }
            break;
        }
    } // while (!bProcessEventsDone)

    CLEANUP:
    for (i = 0; i < MAXCLIENTS+1; i++)
    {
        if (INVALID_SOCKET != RecvInfo.sd[i])
        {
            closesocket(RecvInfo.sd[i]);
            RecvInfo.sd[i] = INVALID_SOCKET;
        }

        if (WSA_INVALID_EVENT != RecvInfo.hEvents[i])
        {
            WSACloseEvent(RecvInfo.hEvents[i]);
            RecvInfo.hEvents[i] = WSA_INVALID_EVENT;
        }
    }

    return;
}

VOID Sender ( OPTIONS * pOptions )

Definition at line 65 of file Sender.Cpp.

{
    WSANETWORKEVENTS    NetworkEvents = {0};
    BOOL                bProcessEventsDone = FALSE;
    SEND_INFO           SendInfo = {0};
    int                 i = 0;
    BOOL                bDisableQos = TRUE;
    ULONG               cbAlternateCount = 0;

    printf("Sender\n");

    SendInfo.sd = INVALID_SOCKET;

    for (i = 0; i < TOTAL_EVENTS; i++)
        SendInfo.hEvents[i] = WSA_INVALID_EVENT;

    for (i=0; i<TOTAL_EVENTS; i++)
    {
        if (WSA_INVALID_EVENT == (SendInfo.hEvents[i] = WSACreateEvent()))
        {
            printf("WSACreateEvent(%d): failed w/%d\n", i, WSAGetLastError());
            goto CLEANUP;
        }
    }
    SendInfo.sd           = INVALID_SOCKET;
    ZeroMemory((char *)&SendInfo.ovr, sizeof(SendInfo.ovr));
    SendInfo.ovr.hEvent   = SendInfo.hEvents[WSASEND_EVENT];
    SendInfo.sndbuf.buf   = pOptions->buf;
    SendInfo.sndbuf.len   = pOptions->nBufSize;
    SendInfo.nTotalSends  = 0;
    SendInfo.bSendEnabled = TRUE;

    if (!CreateSendingSocket(&SendInfo, pOptions))
        goto CLEANUP;

    while (!bProcessEventsDone)
    {
        DWORD dwEvent;

        dwEvent = WSAWaitForMultipleEvents(TOTAL_EVENTS, SendInfo.hEvents, FALSE, WSA_INFINITE, FALSE);
        switch (dwEvent)
        {
        case WSA_WAIT_FAILED:
            printf("WSAEventSelect: %d\n", WSAGetLastError());
            break;
        case WAIT_IO_COMPLETION:
        case WSA_WAIT_TIMEOUT:
            break;

        default:
            dwEvent -= WSA_WAIT_EVENT_0;

            if (WSAEVENTSELECT_EVENT == dwEvent)
            {
                // lets see what network activity trigged this event
                if (SOCKET_ERROR == WSAEnumNetworkEvents(SendInfo.sd, SendInfo.hEvents[WSAEVENTSELECT_EVENT], &NetworkEvents))
                {
                    printf("WSAEnumNetworkEvent: failed w/%d lNetworkEvent %X\n",
                           WSAGetLastError(), NetworkEvents.lNetworkEvents);
                    NetworkEvents.lNetworkEvents = 0;
                } else
                {
                    if (FD_CONNECT     & NetworkEvents.lNetworkEvents)
                        bProcessEventsDone |=
                        fd_connect_func(dwEvent, &NetworkEvents, &SendInfo, pOptions);
                    if (FD_CLOSE   & NetworkEvents.lNetworkEvents)
                        bProcessEventsDone |=
                        fd_close_func(dwEvent, &NetworkEvents, &SendInfo, pOptions);
                }
            } else
            {
                bProcessEventsDone = CompleteSend(&SendInfo, pOptions);
            }
        }

        // allow pauses between notifications
        if (pOptions->dwSleep)
            Sleep(pOptions->dwSleep);

    } // while (!bProcessEventsDone)

    CLEANUP:
    if (INVALID_SOCKET != SendInfo.sd)
    {
        closesocket(SendInfo.sd);
        SendInfo.sd = INVALID_SOCKET;
    }
    for (i=0; i<TOTAL_EVENTS; i++)
        if(WSA_INVALID_EVENT != SendInfo.hEvents[i])
        {
            WSACloseEvent(SendInfo.hEvents[i]);
            SendInfo.hEvents[i] = WSA_INVALID_EVENT;
        }

    return;
}

Generated on Wed Nov 13 2024 16:54:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/ATMEvent/Enumerator.Cpp File Reference

  • NetDS
  • WinSock
  • ATMEvent
Functions

Enumerator.Cpp File Reference

#include "atmevent.h"

Go to the source code of this file.

Functions

void Enumerator (OPTIONS *pOptions)

Function Documentation

void Enumerator ( OPTIONS * pOptions )

Definition at line 28 of file Enumerator.Cpp.

{
    SOCKET          sd = INVALID_SOCKET;
    SOCKADDR_ATM    atm_addr = {0};
    CHAR            szAddress[MAX_ATM_INTERFACE_LEN] = {'\0'};
    DWORD           dwNumInterfaces = 0;
    DWORD           dwAddrLen = 0;
    DWORD           dwBytes=sizeof(DWORD);
    int             nRet = 0;

    sd = WSASocket(FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO,
                   &pOptions->protocolInfo, 0, WSA_FLAG_OVERLAPPED);
    if (INVALID_SOCKET == sd)
    {
        printf("WSASocket: %d\n", WSAGetLastError());
        return;
    }

    nRet = WSAIoctl(sd, SIO_GET_NUMBER_OF_ATM_DEVICES,
                    NULL, 0,
                    (LPVOID)&dwNumInterfaces, sizeof(dwNumInterfaces), &dwBytes,
                    NULL, NULL);
    if (SOCKET_ERROR == nRet)
    {
        printf("WSAIoctl:SIO_GET_NUMBER_OF_ATM_DEVICES: %d\n", WSAGetLastError());
        return;
    }

    for (DWORD i=0; i < dwNumInterfaces ;i++)
    {
        ZeroMemory(&atm_addr, sizeof(SOCKADDR_ATM));

        nRet = WSAIoctl(sd, SIO_GET_ATM_ADDRESS,
                        (LPVOID)&i, sizeof(DWORD),
                        (LPVOID)&atm_addr.satm_number, sizeof(atm_addr.satm_number), &dwBytes,
                        NULL, NULL);
        if (SOCKET_ERROR == nRet)
        {
            printf("WSAIoctl:SIO_GET_ATM_ADDRESS: %d\n", WSAGetLastError());
            return;
        }

        // fill in remainder of ATM address structure
        atm_addr.satm_family                 = AF_ATM;
        atm_addr.satm_number.AddressType     = ATM_NSAP;
        atm_addr.satm_number.NumofDigits     = ATM_ADDR_SIZE;
        atm_addr.satm_blli.Layer2Protocol    = SAP_FIELD_ANY;
        atm_addr.satm_blli.Layer3Protocol    = SAP_FIELD_ABSENT;
        atm_addr.satm_bhli.HighLayerInfoType = SAP_FIELD_ABSENT;

        ZeroMemory(szAddress, sizeof(szAddress));
        dwAddrLen = sizeof(szAddress);
        if (SOCKET_ERROR == WSAAddressToString((LPSOCKADDR)&atm_addr, sizeof(atm_addr),
                               &pOptions->protocolInfo, szAddress, &dwAddrLen))
        {
            printf("WSAAddressToString: %d\n", WSAGetLastError());
            break;
        }
        printf("ATM Interface [%d]: <%s>\n", i, szAddress);
    }

    if (INVALID_SOCKET != sd)
    {
        closesocket(sd);
        sd = INVALID_SOCKET;
    }
    return;
}

Generated on Wed Nov 13 2024 16:54:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/ATMEvent/Receiver.Cpp File Reference

  • NetDS
  • WinSock
  • ATMEvent
Classes | Defines | Typedefs | Functions

Receiver.Cpp File Reference

#include "atmevent.h"

Go to the source code of this file.

Classes

struct | _RECV_INFO

Defines

#define | MAXCLIENTS 4

Typedefs

typedef struct _RECV_INFO | RECV_INFO

Functions

int CALLBACK | AcceptCondFunc (LPWSABUF, LPWSABUF, LPQOS, LPQOS, LPWSABUF, LPWSABUF, GROUP FAR *, DWORD_PTR)
VOID | Receiver (OPTIONS *pOptions)

Define Documentation

#define MAXCLIENTS 4

Definition at line 23 of file Receiver.Cpp.

Typedef Documentation

typedef struct _RECV_INFO RECV_INFO

Function Documentation

int CALLBACK AcceptCondFunc | ( | LPWSABUF | lpCallerId,
 |  | LPWSABUF | lpCallerData,
 |  | LPQOS | lpSQos,
 |  | LPQOS | lpGQos,
 |  | LPWSABUF | lpCalleeId,
 |  | LPWSABUF | lpCalleeData,
 |  | GROUP FAR * | Group,
 |  | DWORD_PTR | CallbackData
 | ) |  |

Definition at line 413 of file Receiver.Cpp.

{
    int     nRet        = CF_ACCEPT;
    OPTIONS *pOptions   = (OPTIONS *)CallbackData;

    printf("    AcceptCondFunc\n");
    if (MAXCLIENTS == pOptions->dwTotalClients)
    {
        printf("      Rejecting connection, limit of %d clients reached\n",
               pOptions->dwTotalClients);
        nRet = CF_REJECT;
        // At this point a connection will already have been established,
        // this will just cause the connection to be reset.
    } else
        pOptions->dwTotalClients++;

    return nRet;
}

VOID Receiver ( OPTIONS * pOptions )

Definition at line 53 of file Receiver.Cpp.

{
    WSANETWORKEVENTS NetworkEvents = {0};
    long lNetworkEvents = 0;
    BOOL bProcessEventsDone = FALSE;
    RECV_INFO RecvInfo = {0};
    int i = 0;

    printf("Receiver\n");

    //init RecvInfo sockets/event handles
    for (i = 0; i < MAXCLIENTS+1; i++)
    {
        RecvInfo.sd[i] = INVALID_SOCKET;
        RecvInfo.hEvents[i] = WSA_INVALID_EVENT;
    }

    for (i=0; i<MAXCLIENTS+1; i++)
    {
        if (WSA_INVALID_EVENT == (RecvInfo.hEvents[i] = WSACreateEvent()))
        {
            printf("WSACreateEvent(%d): %d\n", i, WSAGetLastError());
            goto CLEANUP;
        }
    }

    // create the receiving/listening socket
    if (!CreateReceivingSocket(&RecvInfo, pOptions))
        goto CLEANUP;

    lNetworkEvents = (FD_ACCEPT|FD_READ|FD_CLOSE);
    if (SOCKET_ERROR == WSAEventSelect(RecvInfo.sd[0], RecvInfo.hEvents[0], lNetworkEvents))
    {
        printf("WSAEventSelect: %d\n", WSAGetLastError());
        goto CLEANUP;
    }

    bProcessEventsDone = FALSE;
    while (!bProcessEventsDone)
    {
        DWORD dwEvent;

        dwEvent = WSAWaitForMultipleEvents((MAXCLIENTS+1), RecvInfo.hEvents, FALSE, WSA_INFINITE, FALSE);
        switch (dwEvent)
        {
        case WSA_WAIT_FAILED:
            printf("WSAEventSelect: %d\n", WSAGetLastError());
            bProcessEventsDone = TRUE;
            break;
        case WAIT_IO_COMPLETION:
        case WSA_WAIT_TIMEOUT:
            break;

        default:
            // lets see what network activity trigged this event
            NetworkEvents.lNetworkEvents = 0;
            if (SOCKET_ERROR == WSAEnumNetworkEvents(RecvInfo.sd[dwEvent], RecvInfo.hEvents[dwEvent], &NetworkEvents))
            {
                printf("WSAEnumNetworkEvent: %d dwEvent %d lNetworkEvent %X\n",
                       WSAGetLastError(), dwEvent, NetworkEvents.lNetworkEvents);
                NetworkEvents.lNetworkEvents = 0;
                bProcessEventsDone = TRUE;
            } else
            {
                // it is possible that more than one notification triggered the event
                //printf("WSAEnumNetworkEvents %X\n", NetworkEvents.lNetworkEvents);
                if (FD_ACCEPT & NetworkEvents.lNetworkEvents)
                    bProcessEventsDone |=
                    fd_accept_func(dwEvent, &NetworkEvents, &RecvInfo, pOptions);
                if (FD_READ   & NetworkEvents.lNetworkEvents)
                    bProcessEventsDone |=
                    fd_read_func(dwEvent, &NetworkEvents, &RecvInfo, pOptions);
                if (FD_CLOSE  & NetworkEvents.lNetworkEvents)
                    bProcessEventsDone |=
                    fd_close_func(dwEvent, &NetworkEvents, &RecvInfo, pOptions);
            }
            break;
        }
    } // while (!bProcessEventsDone)

    CLEANUP:
    for (i = 0; i < MAXCLIENTS+1; i++)
    {
        if (INVALID_SOCKET != RecvInfo.sd[i])
        {
            closesocket(RecvInfo.sd[i]);
            RecvInfo.sd[i] = INVALID_SOCKET;
        }

        if (WSA_INVALID_EVENT != RecvInfo.hEvents[i])
        {
            WSACloseEvent(RecvInfo.hEvents[i]);
            RecvInfo.hEvents[i] = WSA_INVALID_EVENT;
        }
    }

    return;
}

Generated on Wed Nov 13 2024 16:53:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/ATMEvent/Sender.Cpp File Reference

  • NetDS
  • WinSock
  • ATMEvent
Classes | Defines | Typedefs | Functions

Sender.Cpp File Reference

#include "atmevent.h"

Go to the source code of this file.

Classes

struct | _SEND_INFO

Defines

#define | TOTAL_EVENTS 2
#define | WSAEVENTSELECT_EVENT 0
#define | WSASEND_EVENT 1

Typedefs

typedef struct _SEND_INFO | SEND_INFO

Functions

VOID | Sender (OPTIONS *pOptions)

Define Documentation

#define TOTAL_EVENTS 2

Definition at line 26 of file Sender.Cpp.

#define WSAEVENTSELECT_EVENT 0

Definition at line 24 of file Sender.Cpp.

#define WSASEND_EVENT 1

Definition at line 25 of file Sender.Cpp.

Typedef Documentation

typedef struct _SEND_INFO SEND_INFO

Function Documentation

VOID Sender ( OPTIONS * pOptions )

Definition at line 65 of file Sender.Cpp.

{
    WSANETWORKEVENTS    NetworkEvents = {0};
    BOOL                bProcessEventsDone = FALSE;
    SEND_INFO           SendInfo = {0};
    int                 i = 0;
    BOOL                bDisableQos = TRUE;
    ULONG               cbAlternateCount = 0;

    printf("Sender\n");

    SendInfo.sd = INVALID_SOCKET;

    for (i = 0; i < TOTAL_EVENTS; i++)
        SendInfo.hEvents[i] = WSA_INVALID_EVENT;

    for (i=0; i<TOTAL_EVENTS; i++)
    {
        if (WSA_INVALID_EVENT == (SendInfo.hEvents[i] = WSACreateEvent()))
        {
            printf("WSACreateEvent(%d): failed w/%d\n", i, WSAGetLastError());
            goto CLEANUP;
        }
    }
    SendInfo.sd           = INVALID_SOCKET;
    ZeroMemory((char *)&SendInfo.ovr, sizeof(SendInfo.ovr));
    SendInfo.ovr.hEvent   = SendInfo.hEvents[WSASEND_EVENT];
    SendInfo.sndbuf.buf   = pOptions->buf;
    SendInfo.sndbuf.len   = pOptions->nBufSize;
    SendInfo.nTotalSends  = 0;
    SendInfo.bSendEnabled = TRUE;

    if (!CreateSendingSocket(&SendInfo, pOptions))
        goto CLEANUP;

    while (!bProcessEventsDone)
    {
        DWORD dwEvent;

        dwEvent = WSAWaitForMultipleEvents(TOTAL_EVENTS, SendInfo.hEvents, FALSE, WSA_INFINITE, FALSE);
        switch (dwEvent)
        {
        case WSA_WAIT_FAILED:
            printf("WSAEventSelect: %d\n", WSAGetLastError());
            break;
        case WAIT_IO_COMPLETION:
        case WSA_WAIT_TIMEOUT:
            break;

        default:
            dwEvent -= WSA_WAIT_EVENT_0;

            if (WSAEVENTSELECT_EVENT == dwEvent)
            {
                // lets see what network activity trigged this event
                if (SOCKET_ERROR == WSAEnumNetworkEvents(SendInfo.sd, SendInfo.hEvents[WSAEVENTSELECT_EVENT], &NetworkEvents))
                {
                    printf("WSAEnumNetworkEvent: failed w/%d lNetworkEvent %X\n",
                           WSAGetLastError(), NetworkEvents.lNetworkEvents);
                    NetworkEvents.lNetworkEvents = 0;
                } else
                {
                    if (FD_CONNECT     & NetworkEvents.lNetworkEvents)
                        bProcessEventsDone |=
                        fd_connect_func(dwEvent, &NetworkEvents, &SendInfo, pOptions);
                    if (FD_CLOSE   & NetworkEvents.lNetworkEvents)
                        bProcessEventsDone |=
                        fd_close_func(dwEvent, &NetworkEvents, &SendInfo, pOptions);
                }
            } else
            {
                bProcessEventsDone = CompleteSend(&SendInfo, pOptions);
            }
        }

        // allow pauses between notifications
        if (pOptions->dwSleep)
            Sleep(pOptions->dwSleep);

    } // while (!bProcessEventsDone)

    CLEANUP:
    if (INVALID_SOCKET != SendInfo.sd)
    {
        closesocket(SendInfo.sd);
        SendInfo.sd = INVALID_SOCKET;
    }
    for (i=0; i<TOTAL_EVENTS; i++)
        if(WSA_INVALID_EVENT != SendInfo.hEvents[i])
        {
            WSACloseEvent(SendInfo.hEvents[i]);
            SendInfo.hEvents[i] = WSA_INVALID_EVENT;
        }

    return;
}

Generated on Wed Nov 13 2024 16:53:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/Bcast/Bcast.c File Reference

  • NetDS
  • WinSock
  • Bcast
Defines | Typedefs | Enumerations | Functions | Variables

Bcast.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <windows.h>
#include <strsafe.h>
#include <winsock.h>
#include <wsipx.h>
#include <wsnwlink.h>

Go to the source code of this file.

Defines

#define | MAX_ADDLEN 80
#define | MAX_MSGLEN 80
#define | MAX_MSLOTNAME 80

Typedefs

typedef enum _MODE | MODE
typedef enum _PROTOCOL | PROTOCOL

Enumerations

enum | _MODE { CLIENT = 0, SERVER }
enum | _PROTOCOL { UDP = 0, IPX, MAILSLOT }

Functions

BOOL __stdcall | CtrlCHandler (DWORD dwEvent)
void __stdcall | DoCleanup (void)
void __stdcall | DoIpx (MODE mRole, USHORT usEndPoint)
void __stdcall | DoIpxClient (USHORT usEndPoint)
void __stdcall | DoIpxServer (USHORT usEndPoint)
void __stdcall | DoMailSlot (MODE mRole, LPSTR lpsEndPoint, LPSTR lpsDomainName)
void __stdcall | DoMailSlotClient (LPSTR lpsEndPoint, LPSTR lpsDomainName)
void __stdcall | DoMailSlotServer (LPSTR lpsEndPoint)
void __stdcall | DoStartup (void)
void __stdcall | DoUdp (MODE mRole, USHORT usEndPoint)
void __stdcall | DoUdpClient (USHORT usEndPoint)
void __stdcall | DoUdpServer (USHORT usEndPoint)
CHAR *__stdcall | IpxnetAddr (CHAR *lpBuffer, CHAR *lpsNetnum, CHAR *lpsNodenum)
void __cdecl | main (INT argc, CHAR **argv)
void __stdcall | PrintError (LPSTR lpszRoutine, LPSTR lpszCallName, DWORD dwError)
void __stdcall | Usage (CHAR *pszProgramName)

Variables

BOOL | fStarted = FALSE
HANDLE | hSlot = INVALID_HANDLE_VALUE
SOCKET | sock = INVALID_SOCKET

Define Documentation

#define MAX_ADDLEN 80

Definition at line 78 of file Bcast.c.

#define MAX_MSGLEN 80

Definition at line 77 of file Bcast.c.

#define MAX_MSLOTNAME 80

Definition at line 79 of file Bcast.c.

Typedef Documentation

typedef enum _MODE MODE
typedef enum _PROTOCOL PROTOCOL

Enumeration Type Documentation

enum _MODE
Enumerator:
CLIENT
SERVER

Definition at line 81 of file Bcast.c.

{
    CLIENT=0, SERVER
} MODE;

enum _PROTOCOL
Enumerator:
UDP
IPX
MAILSLOT

Definition at line 85 of file Bcast.c.

{
    UDP=0, IPX, MAILSLOT
} PROTOCOL;

Function Documentation

BOOL __stdcall CtrlCHandler ( DWORD dwEvent )

Definition at line 336 of file Bcast.c.

{
    if ( ( CTRL_C_EVENT == dwEvent ) || ( CTRL_BREAK_EVENT == dwEvent ) )
    {
        DoCleanup ( );
    }

    return FALSE;
}

void DoCleanup ( void )

Definition at line 1237 of file Bcast.c.

{
    if ( INVALID_SOCKET != sock )
    {
        closesocket ( sock );
        sock = INVALID_SOCKET;
    }

    if (INVALID_HANDLE_VALUE != hSlot)
    {
        CloseHandle(hSlot);
        hSlot = INVALID_HANDLE_VALUE;
    }

    if ( TRUE == fStarted )
    {
        WSACleanup ( );
    }

    fprintf ( stdout, "DONE\n" );

    return;
}

void __stdcall DoIpx | ( | MODE | mRole,
 |  | USHORT | usEndPoint
 | ) |  |

Definition at line 378 of file Bcast.c.

{
    //
    // Initialize the global socket descriptor.
    //
    sock = socket ( AF_IPX, SOCK_DGRAM, NSPROTO_IPX );

    if ( INVALID_SOCKET ==  sock )
    {
        PrintError( "DoIpx", "socket", WSAGetLastError ( ) );
    }

    switch ( mRole )
    {
    case CLIENT:
        DoIpxClient ( usEndPoint );
        break;

    default:
        DoIpxServer ( usEndPoint );
    }
    return;
}

void __stdcall DoIpxClient ( USHORT usEndPoint )

Definition at line 1031 of file Bcast.c.

{

    // IPX address structures needed to fill the source and destination
    // addresses.
    SOCKADDR_IPX saIpxServ = {0}, saIpxCli = {0};
    INT err = 0;
    CHAR achMessage[MAX_MSGLEN] = {'\0'};
    HRESULT hRet;
    size_t dwSize;

    // Variable to set the broadcast option with setsockopt ().
    BOOL fBroadcast = TRUE;

    err = setsockopt ( sock,
                       SOL_SOCKET,
                       SO_BROADCAST,
                       (CHAR *) &fBroadcast,
                       sizeof ( BOOL )
                     );

    if ( SOCKET_ERROR == err )
    {
        PrintError ( "DoIpxClient", "setsockopt", WSAGetLastError ( ) );
    }

    //
    // bind to a local socket and an interface.
    //
    saIpxCli.sa_family = AF_IPX;
    saIpxCli.sa_socket = (USHORT) 0;
    memset ( saIpxCli.sa_netnum, 0, sizeof ( saIpxCli.sa_netnum ) );
    memset ( saIpxCli.sa_nodenum, 0, sizeof ( saIpxCli.sa_nodenum ) );

    err = bind ( sock, (SOCKADDR  *) &saIpxCli, sizeof ( SOCKADDR_IPX ) );

    if ( SOCKET_ERROR == err )
    {
        PrintError ( "DoIpxClient", "bind", WSAGetLastError() );
    }

    //
    // Fill an IPX address structure, to send an IPX broadcast. The
    // packet will be broadcasted to the specified socket.
    //
    saIpxServ.sa_family = AF_IPX;
    saIpxServ.sa_socket = usEndPoint;
    memset ( saIpxServ.sa_netnum, 0, sizeof ( saIpxServ.sa_netnum ) );
    memset ( saIpxServ.sa_nodenum, 0xFF, sizeof ( saIpxServ.sa_nodenum ) );

    if(FAILED(hRet = StringCchCopy(achMessage,MAX_MSGLEN,"A Broadcast Datagram")))
    {
        PrintError("DoIpxClient","StringCchCopy",hRet);
    }

    if(FAILED(hRet = StringCbLength(achMessage,MAX_MSGLEN,&dwSize)))
    {
        PrintError("DoIpxClient","StringCbLength",hRet);
    }

    err = sendto ( sock,
                   achMessage,
                   (int)dwSize,
                   0,
                   (SOCKADDR *) &saIpxServ,
                   sizeof ( SOCKADDR_IPX )
                 );

    if ( SOCKET_ERROR == err )
    {
        PrintError ( "DoIpxClient", "sendto", WSAGetLastError ( ) );
    }

    fprintf ( stdout, "%d bytes of data broadcasted\n", err);

    //
    // Call the cleanup routine.
    //
    DoCleanup ( );

    return;
}

void __stdcall DoIpxServer ( USHORT usEndPoint )

Definition at line 918 of file Bcast.c.

{

    // IPX address structures needed to bind to a local socket and get the
    // sender's information.
    SOCKADDR_IPX saIpxServ = {0}, saIpxCli = {0};

    INT err = 0, nSize = 0;

    CHAR achBuffer[MAX_MSGLEN] = {'\0'},
    achAddress[MAX_ADDLEN] = {'\0'};

    OSVERSIONINFO osVer = {0};

    // Variable to set the broadcast option with setsockopt ().
    BOOL fResult = FALSE, fBroadcast = TRUE;

    //
    // Check the platform.
    //
    osVer.dwOSVersionInfoSize = sizeof ( OSVERSIONINFO );
    fResult  = GetVersionEx ( &osVer);

    if ( FALSE == fResult)
    {
        PrintError ( "DoIpxServer", "GetVersionEx", GetLastError ( ) );
    }

    //
    // If the platform is Windows 95, call setsockopt ().
    //
    if ( VER_PLATFORM_WIN32_WINDOWS == osVer.dwPlatformId )
    {
        err = setsockopt ( sock,
                           SOL_SOCKET,
                           SO_BROADCAST,
                           (CHAR *) &fBroadcast,
                           sizeof ( BOOL )
                         );

        if ( SOCKET_ERROR == err )
        {
            PrintError ( "DoIpxServer", "setsockopt", WSAGetLastError() );
        }
    }

    //
    // bind to the specified socket.
    //
    saIpxServ.sa_family = AF_IPX;
    saIpxServ.sa_socket = usEndPoint;
    memset ( saIpxServ.sa_netnum, 0, sizeof (saIpxServ.sa_netnum ) );
    memset ( saIpxServ.sa_nodenum, 0, sizeof (saIpxServ.sa_nodenum ) );

    err = bind ( sock, (SOCKADDR *) &saIpxServ, sizeof (SOCKADDR_IPX) );

    if ( SOCKET_ERROR == err )
    {
        PrintError ( "DoIpxServer", "bind", WSAGetLastError ( ) );
    }

    //
    // receive a datagram on the bound socket number.
    //
    nSize = sizeof ( SOCKADDR_IPX );
    err = recvfrom ( sock,
                     achBuffer,
                     MAX_MSGLEN,
                     0,
                     (SOCKADDR *) &saIpxCli,
                     &nSize
                   );

    if ( SOCKET_ERROR == err )
    {
        PrintError ( "DoIpxServer", "recvfrom", WSAGetLastError ( ) );
    }

    //
    // print the sender's information.
    //
    achBuffer[err] = '\0';
    fprintf ( stdout,
              "An Ipx Datagram of length %d bytes received from ",
              err );
    fprintf ( stdout,
              "\n\tIPX Adress->%s ",
              IpxnetAddr ( achAddress,
                           saIpxCli.sa_netnum,
                           saIpxCli.sa_nodenum
                         )
            );
    fprintf ( stdout, "\n\tSocket Number->%d\n", saIpxCli.sa_socket );
    fprintf ( stdout, "MessageText->%s\n", achBuffer );

    //
    // Call the cleanup routine.
    //
    DoCleanup ( );
    return;

}

void __stdcall DoMailSlot | ( | MODE | mRole,
 |  | LPSTR | lpsEndPoint,
 |  | LPSTR | lpsDomainName
 | ) |  |

Definition at line 354 of file Bcast.c.

{
    switch ( mRole )
    {
    case CLIENT:
        DoMailSlotClient ( lpsEndPoint, lpsDomainName );
        break;

    default:
        DoMailSlotServer ( lpsEndPoint );
    }
    return;
}

void __stdcall DoMailSlotClient | ( | LPSTR | lpsEndPoint,
 |  | LPSTR | lpsDomainName
 | ) |  |

Definition at line 639 of file Bcast.c.

{
    // Variables that store MessageID, number of bytes to write/written.
    DWORD dwMessageID = 0,
    cbWritten = 0,
    cbToWrite = 0;
    HRESULT hRet;

    BOOL fResult = FALSE;

    CHAR achMailSlotName[MAX_MSLOTNAME],
    achBuffer[MAX_MSGLEN + sizeof ( DWORD ) ];

    if ( NULL == lpsDomainName )
    {
        fprintf ( stdout,
                  "Domain/Workgroup name must be specified....Exiting\n"
                );
        exit ( 1 );
    }

    //
    // Create a string for the mailslot name.
    //

    if(FAILED(hRet = StringCchPrintf(achMailSlotName,
                           MAX_MSLOTNAME,
                           "\\\\%s\\mailslot\\%s",
                           lpsDomainName,
                           lpsEndPoint
                          )))
    {
        PrintError("DoMailSlotClient","StringCchPrintf",hRet);
    }

    //
    // Open a handle to the mailslot.
    //
    hSlot = CreateFile ( achMailSlotName,
                         GENERIC_WRITE,
                         FILE_SHARE_READ,
                         (LPSECURITY_ATTRIBUTES) NULL,
                         OPEN_EXISTING,
                         FILE_ATTRIBUTE_NORMAL,
                         (HANDLE) NULL
                       );

    if ( INVALID_HANDLE_VALUE == hSlot)
    {
        PrintError ( "DoMailSlotClient", "CreateFile", GetLastError ( ) );
    }

    //
    // Generate a Message ID.
    //
    srand ( (UINT) time ( NULL) );
    dwMessageID = rand ( );

    if(FAILED(hRet = StringCbPrintf(achBuffer,sizeof(DWORD),"%d",dwMessageID)))
    {
        PrintError("DoMailSlotClient","StringCchPrintf",hRet);
    }

    if(FAILED(hRet = StringCchCopy(achBuffer + sizeof(DWORD),MAX_MSGLEN,"A MailSlot Broadcast Message")))
    {
        PrintError("DoMailSlotClient","StringCchCopy",hRet);
    }

    //
    // Total number of bytes to write.
    //
    cbToWrite = sizeof ( DWORD ) + (int) ( strlen ( achBuffer + sizeof ( DWORD ) ) );

    //
    // Send a mailslot message.
    //
    fResult = WriteFile ( hSlot,
                          achBuffer,
                          cbToWrite,
                          &cbWritten,
                          (LPOVERLAPPED) NULL
                        );

    if ( TRUE != fResult )
    {
        PrintError ( "DoMailSlotClient", "WriteFile", GetLastError ( ) );
    }

    fprintf ( stdout,
              "%d bytes of MailSlot data broadcasted with ID %d\n",
              cbWritten,
              dwMessageID
            );

    //
    // Close the mailslot handle.
    //
    fResult = CloseHandle ( hSlot );

    if ( TRUE != fResult )
    {
        PrintError ( "DoMailSlotClient", "CloseHandle", GetLastError() );
    }
    return;
}

void __stdcall DoMailSlotServer ( LPSTR lpsEndPoint )

Definition at line 446 of file Bcast.c.

{

    // Variables that store MessageID, previous messageID, number of bytes to
    // read/read, size of next available message and the number of messages.
    DWORD dwMessageID = 0,
    dwPrevID = 0,
    cbMessage = 0,
    cbRead = 0,
    cbToRead = 0,
    nMessages  = 0;
    HRESULT hRet;
    size_t dwSize;

    BOOL fResult = FALSE;

    CHAR achMailSlotName[MAX_MSLOTNAME],
    achBuffer[MAX_MSGLEN + sizeof ( DWORD )];

    // Variable that points past the message ID part in the message.
    LPSTR lpsMessage = NULL;

    //
    // Create a string for the mailslot name.
    //

    if(FAILED(hRet = StringCchPrintf(achMailSlotName, MAX_MSLOTNAME, "\\\\.\\mailslot\\%s", lpsEndPoint)))
    {
        PrintError("DoMailSlotServer","StringCchPrintf",hRet);
    }

    //
    // Create the mailslot.
    //
    hSlot = CreateMailslot ( achMailSlotName,
                             0,
                             MAILSLOT_WAIT_FOREVER,
                             (LPSECURITY_ATTRIBUTES) NULL
                           );

    if ( INVALID_HANDLE_VALUE == hSlot )
    {
        PrintError ( "DoMailSlotServer",  "CreateMailSlot", GetLastError() );
    }

    //
    // Post ReadFile() and read a message.
    //
    cbToRead = MAX_MSGLEN + sizeof (DWORD);

    fResult = ReadFile ( hSlot,
                         achBuffer,
                         cbToRead,
                         &cbRead,
                         (LPOVERLAPPED) NULL
                       );

    if ( TRUE != fResult )
    {
        PrintError ( "DoMailSlotServer", "ReadFile", GetLastError() );
    }

    achBuffer[cbRead] = '\0';

    //
    // Get the message ID part from the message.
    //

    memcpy ( &dwMessageID, achBuffer, sizeof ( DWORD ) );

    //
    // Adjust the actual message pointer.
    //
    lpsMessage = achBuffer + sizeof ( DWORD );

    hRet = StringCbLength(lpsMessage,cbRead,&dwSize);

    //
    // Print the message
    //
    fprintf ( stdout,
              "A MailSlot Message of %d bytes received with ID %d\n",
              dwSize,
              dwMessageID
            );

    fprintf ( stdout, "MessageText->%s\n", lpsMessage );

    //
    // Check for duplicate messages.
    //
    dwPrevID = dwMessageID;

    while ( TRUE )
    {
        //
        // get information on pending messages.
        //
        fResult = GetMailslotInfo ( hSlot,
                                    (LPDWORD) NULL,
                                    &cbMessage,
                                    &nMessages,
                                    (LPDWORD) NULL
                                  );
        if ( TRUE != fResult )
        {
            PrintError ( "DoMailSlotServer",
                         "GetMailSlotInfo",
                         GetLastError ( )
                       );
        }

        //
        // Break if no more messages.
        //
        if ( MAILSLOT_NO_MESSAGE == cbMessage )
            break;

        //
        // We now know how much to read.
        //
        cbToRead = cbMessage;
        fResult = ReadFile ( hSlot,
                             achBuffer,
                             cbToRead,
                             &cbRead,
                             (LPOVERLAPPED) NULL
                           );

        if ( TRUE != fResult )
        {
            PrintError ( "DoMailSlotServer",
                         "ReadFile",
                         GetLastError ( )
                       );
        }

        achBuffer[cbRead] = '\0';
        memcpy ( &dwMessageID, achBuffer, sizeof (DWORD) );

        //
        // print the message only if it is not a duplicate.
        //
        lpsMessage = achBuffer + sizeof (DWORD);
        hRet = StringCbLength(lpsMessage,cbRead,&dwSize);
        if ( dwMessageID != dwPrevID )
        {

            fprintf ( stdout,
                      "A MailSlot Message of %d bytes received with ID %d\n",
                      dwSize,
                      dwMessageID
                    );

            fprintf ( stdout, "MessageText->%s\n", achBuffer );
        }

        dwPrevID = dwMessageID;
    }

    //
    // Close the handle to our mailslot.
    //
    fResult = CloseHandle ( hSlot );

    if ( TRUE != fResult )
    {
        PrintError ( "DoMailSlotServer", "CloseHandle", GetLastError() );
    }
    return;
}

void __stdcall DoStartup ( void )

Definition at line 1210 of file Bcast.c.

{
    WSADATA wsaData;

    INT iRetVal = 0;

    iRetVal = WSAStartup ( MAKEWORD ( 1,1 ), &wsaData );

    if ( 0 != iRetVal)
    {
        PrintError ( "DoStartup", "WSAStartup", iRetVal );
    }

    //
    // Set the global flag.
    //
    fStarted = TRUE;

    return;
}

void __stdcall DoUdp | ( | MODE | mRole,
 |  | USHORT | usEndPoint
 | ) |  |

Definition at line 412 of file Bcast.c.

{
    //
    // Initialize the global socket descriptor.
    //
    sock = socket ( AF_INET, SOCK_DGRAM, 0 );

    if ( INVALID_SOCKET ==  sock)
    {
        PrintError ( "DoUdp", "socket", WSAGetLastError() );
    }

    switch ( mRole )
    {
    case CLIENT:
        DoUdpClient ( usEndPoint );
        break;

    default:
        DoUdpServer ( usEndPoint );
    }
    return;
}

void __stdcall DoUdpClient ( USHORT usEndPoint )

Definition at line 824 of file Bcast.c.

{

    // IP address structures needed to fill the source and destination
    // addresses.
    SOCKADDR_IN saUdpServ = {0}, saUdpCli = {0};
    INT err = 0;
    CHAR achMessage[MAX_MSGLEN] = {'\0'};
    HRESULT hRet;
    size_t dwSize;

    // Variable to set the broadcast option with setsockopt ().
    BOOL fBroadcast = TRUE;

    err = setsockopt ( sock,
                       SOL_SOCKET,
                       SO_BROADCAST,
                       (CHAR *) &fBroadcast,
                       sizeof ( BOOL )
                     );

    if ( SOCKET_ERROR == err )
    {
        PrintError ( "DoUdpClient", "setsockopt", WSAGetLastError ( )  );
    }

    //
    // bind to a local socket and an interface.
    //
    saUdpCli.sin_family = AF_INET;
    saUdpCli.sin_addr.s_addr = htonl ( INADDR_ANY );
    saUdpCli.sin_port = htons ( 0 );

    err = bind ( sock, (SOCKADDR *) &saUdpCli, sizeof (SOCKADDR_IN) );

    if ( SOCKET_ERROR == err )
    {
        PrintError ( "DoUdpClient", "bind", WSAGetLastError ( ) );
    }

    //
    // Fill an IP address structure, to send an IP broadcast. The
    // packet will be broadcasted to the specified port.
    //
    saUdpServ.sin_family = AF_INET;
    saUdpServ.sin_addr.s_addr = htonl ( INADDR_BROADCAST );
    saUdpServ.sin_port = htons ( usEndPoint );

    if(FAILED(hRet = StringCchCopy(achMessage,MAX_MSGLEN,"A Broadcast Datagram")))
    {
        PrintError("DoUdpClient","StringCchCopy",hRet);
    }

    if(FAILED(hRet = StringCbLength(achMessage,MAX_MSGLEN,&dwSize)))
    {
        PrintError("DoUdpClient","StringCbLength",hRet);
    }

    err = sendto ( sock,
                   achMessage,
                   (int)dwSize,
                   0,
                   (SOCKADDR *) &saUdpServ,
                   (int)sizeof ( SOCKADDR_IN )
                 );

    if ( SOCKET_ERROR == err )
    {
        PrintError ( "DoUdpClient", "sendto", WSAGetLastError ( ) );
    }

    fprintf ( stdout, "%d bytes of data broadcasted\n", err );

    //
    // Call the cleanup routine.
    //
    DoCleanup ( );

    return;
}

void __stdcall DoUdpServer ( USHORT usEndPoint )

Definition at line 755 of file Bcast.c.

{

    // IP address structures needed to bind to a local port and get the sender's
    // information.
    SOCKADDR_IN saUdpServ = {0}, saUdpCli = {0};

    INT err = 0, nSize = 0;

    CHAR achBuffer[MAX_MSGLEN] = {'\0'};

    //
    // bind to the specified port.
    //
    saUdpServ.sin_family = AF_INET;
    saUdpServ.sin_addr.s_addr = htonl ( INADDR_ANY );
    saUdpServ.sin_port = htons ( usEndPoint );

    err = bind ( sock, (SOCKADDR FAR *)&saUdpServ, sizeof ( SOCKADDR_IN ) );

    if ( SOCKET_ERROR == err )
    {
        PrintError ( "DoUdpServer", "bind", WSAGetLastError ( ) );
    }

    //
    // receive a datagram on the bound port number.
    //
    nSize = sizeof ( SOCKADDR_IN );
    err = recvfrom ( sock,
                     achBuffer,
                     MAX_MSGLEN,
                     0,
                     (SOCKADDR FAR *) &saUdpCli,
                     &nSize
                   );

    if ( SOCKET_ERROR == err )
    {
        PrintError ( "DoUdpServer", "recvfrom", WSAGetLastError ( ) );
    }

    //
    // print the sender's information.
    //
    achBuffer[err] = '\0';
    fprintf ( stdout, "A Udp Datagram of length %d bytes received from ", err );
    fprintf ( stdout, "\n\tIP Adress->%s ", inet_ntoa ( saUdpCli.sin_addr ) );
    fprintf ( stdout, "\n\tPort Number->%d\n", ntohs ( saUdpCli.sin_port ) );
    fprintf ( stdout, "MessageText->%s\n", achBuffer );

    //
    // Call the cleanup routine
    //
    DoCleanup ( );

    return;
}

CHAR *__stdcall IpxnetAddr | ( | CHAR * | lpBuffer,
 |  | CHAR * | lpsNetnum,
 |  | CHAR * | lpsNodenum
 | ) |  |

Definition at line 1170 of file Bcast.c.

{

    HRESULT hRet;

    if (NULL == lpBuffer)
        return NULL;
    if (NULL == lpsNetnum)
        return NULL;
    if (NULL == lpsNodenum)
        return NULL;

    if(FAILED(hRet = StringCchPrintf(lpBuffer,
                           MAX_MSGLEN,
                           "%02X%02X%02X%02X.%02X%02X%02X%02X%02X%02X",
                           (UCHAR) lpsNetnum[0], (UCHAR) lpsNetnum[1],
                           (UCHAR) lpsNetnum[2], (UCHAR) lpsNetnum[3],
                           (UCHAR) lpsNodenum[0], (UCHAR) lpsNodenum[1],
                           (UCHAR) lpsNodenum[2], (UCHAR) lpsNodenum[3],
                           (UCHAR) lpsNodenum[4], (USHORT) lpsNodenum[5]
                          )))
    {
        PrintError("IpxnetAddr","StringCchPrintf",hRet);
    }

    return( lpBuffer);
}

void __cdecl main | ( | INT | argc,
 |  | CHAR ** | argv
 | ) |  |

Definition at line 184 of file Bcast.c.

{

    // Default role of the application is SERVER, which means receiver of
    // the broadcast messages.
    MODE mRole = SERVER;

    // Deafult protocol used is UDP.
    PROTOCOL pProto = UDP;

    // Default Endpoint.
    USHORT usEndPoint = 5005;

    // Strings pointing to Endpoint and DomainName(necessary for Mailslots).
    LPSTR lpsEndPoint = NULL, lpsDomainName = NULL;
    INT  i = 0;
    CHAR chProto = '\0';

    //
    // Install the CTRL+BREAK Handler
    //
    if ( FALSE == SetConsoleCtrlHandler ( (PHANDLER_ROUTINE) CtrlCHandler,
                                          TRUE
                                        ) )
    {
        PrintError ( "main", "SetConsoleCtrlHandler", GetLastError ( ) );
    }

    //
    // allow the user to override settings with command line switches
    //
    for ( i = 1; i < argc; i++ )
    {
        if ( ( *argv[i] == '-' ) || ( *argv[i] == '/' ) )
        {
            switch ( tolower ( *( argv[i]+1 ) ) )
            {
            //
            // Role of the application (Client - Sender of broadcasts).
            //
            case 'c':
                mRole = CLIENT;
                break;

                //
                // Role of the application (Server - Receiver of broadcasts)
                //
            case 's':
                mRole = SERVER;
                break;

                //
                // Network protocol (Mailslots, IPX or UDP).
                //
            case 'p':
                chProto = (char)tolower ( *argv[++i] );
                if ( 'm' == (char)chProto )
                {
                    pProto = MAILSLOT;
                } else if ( 'i' == chProto )
                {
                    pProto = IPX;
                } else
                    pProto = UDP;
                break;

                //
                // EndPoint.
                //
            case 'e':
                lpsEndPoint = argv[++i];
                break;

                //
                // DomainName (Important for Mailslot broadcasts, only).
                //
            case 'd':
                lpsDomainName = argv[++i];
                break;

                //
                // Help.
                //
            case 'h':
            case '?':
            default:
                Usage ( argv[0] );
            }
        } else
            //
            // Help.
            //
            Usage ( argv[0] );
    }

    //
    // If the protocol specified is not MAILSLOT, convert the endpoint
    // information to integer format from the string format.
    //
    if ( MAILSLOT != pProto )
    {
        if (lpsEndPoint != NULL)
            usEndPoint = (USHORT)atoi ( lpsEndPoint );
    }

    //
    // Print a Summary of the switches specfied
    // Helpful for debugging
    //
    fprintf ( stdout, "SUMMARY:\n" );
    fprintf ( stdout, "\tRole-> %s\n", (CLIENT == mRole)?"Client":"Server" );
    fprintf ( stdout, "\tProtocol-> %s\n",
              ( MAILSLOT == pProto ) ? "MAILSLOT" :
              ( IPX == pProto ) ? "IPX" : "UDP" );
    if (lpsEndPoint != NULL)
        fprintf ( stdout, "\tEndpoint-> %s\n", lpsEndPoint );
    else
        fprintf ( stdout, "\tEndPoint-> %d\n", usEndPoint );

    //
    // Check the protocol specified.
    // Call the appropriate handler rouine. By default the protocol
    // is UDP.
    //
    switch ( pProto )
    {
    case MAILSLOT :
        DoMailSlot ( mRole, lpsEndPoint, lpsDomainName );
        break;

    case IPX:
        DoStartup ( );
        DoIpx ( mRole, usEndPoint );
        break;

    default:
        DoStartup ( );
        DoUdp ( mRole, usEndPoint );
        break;
    }

    return;
}

void __stdcall PrintError | ( | LPSTR | lpszRoutine,
 |  | LPSTR | lpszCallName,
 |  | DWORD | dwError
 | ) |  |

Definition at line 1145 of file Bcast.c.

{

    fprintf ( stderr,
              "The Call to %s() in routine() %s failed with error %d\n",
              lpszCallName,
              lpszRoutine,
              dwError
            );

    DoCleanup ( );

    exit ( 1 );
}

void __stdcall Usage ( CHAR * pszProgramName )

Definition at line 1121 of file Bcast.c.

{
    fprintf ( stderr, "Usage:  %s\n", pszProgramName );
    fprintf ( stderr,
              "\t-s or -c (s - server, c - client, default - server)\n" );
    fprintf ( stderr,
              "\t-p <i or m or u> (i - IPX, m - Mailslots, u - UDP)\n" );
    fprintf ( stderr, "\t-e <Endpoint>\n" );
    fprintf ( stderr,
              "\t-d <DomainName> - needed only for a Mailslot client\n" );
    fprintf ( stderr,
              "\n\tDefault Values-> Role:Server, Protocol:UDP, EndPoint:5005\n" );

    exit ( 1 );
}

Variable Documentation

BOOL fStarted = FALSE

Definition at line 175 of file Bcast.c.

HANDLE hSlot = INVALID_HANDLE_VALUE

Definition at line 181 of file Bcast.c.

SOCKET sock = INVALID_SOCKET

Definition at line 178 of file Bcast.c.

Generated on Wed Nov 13 2024 16:54:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/Dt_Dll/CStack.h File Reference

  • NetDS
  • WinSock
  • Dt_Dll
Classes | Defines

CStack.h File Reference

#include "nowarn.h"
#include <windows.h>
#include "nideque.h"
#include "stack.h"

Go to the source code of this file.

Classes

class | Cstack_c

Defines

#define | _WINSOCKAPI_

Define Documentation

#define _WINSOCKAPI_

Definition at line 20 of file CStack.h.

Generated on Wed Nov 13 2024 16:54:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/Dt_Dll/Dt.h File Reference

  • NetDS
  • WinSock
  • Dt_Dll
Classes | Defines | Typedefs | Functions | Variables

Dt.h File Reference

Go to the source code of this file.

Classes

struct | _INITDATA

Defines

#define | DEBUGGER 4
#define | EC_CHILD 1
#define | FILE_AND_WINDOW 3
#define | FILE_ONLY 1
#define | MAX_FP 128
#define | NO_OUTPUT 0
#define | TEXT_LEN 2048
#define | WINDOW_ONLY 2

Typedefs

typedef struct _INITDATA | INITDATA
typedef struct _INITDATA * | PINITDATA

Functions

BOOL | DTTextOut (IN HANDLE FileHandle, IN char *String, IN DWORD Style)

Variables

char | Buffer [TEXT_LEN]
HANDLE LogFileHandle
DWORD OutputStyle

Define Documentation

#define DEBUGGER 4

Definition at line 22 of file Dt.h.

#define EC_CHILD 1

Definition at line 23 of file Dt.h.

#define FILE_AND_WINDOW 3

Definition at line 21 of file Dt.h.

#define FILE_ONLY 1

Definition at line 19 of file Dt.h.

#define MAX_FP 128

Definition at line 25 of file Dt.h.

#define NO_OUTPUT 0

Definition at line 18 of file Dt.h.

#define TEXT_LEN 2048

Definition at line 24 of file Dt.h.

#define WINDOW_ONLY 2

Definition at line 20 of file Dt.h.

Typedef Documentation

typedef struct _INITDATA INITDATA
typedef struct _INITDATA * PINITDATA

Function Documentation

BOOL DTTextOut | ( | IN HANDLE | FileHandle,
 |  | IN char * | String,
 |  | IN DWORD | Style
 | ) |  |

Variable Documentation

char Buffer[TEXT_LEN]

Definition at line 56 of file Dt_Dll.Cpp.

HANDLE LogFileHandle

Definition at line 54 of file Dt_Dll.Cpp.

DWORD OutputStyle

Definition at line 55 of file Dt_Dll.Cpp.

Generated on Wed Nov 13 2024 16:54:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/Dt_Dll/Dt_Dll.Cpp File Reference

  • NetDS
  • WinSock
  • Dt_Dll
Defines | Functions | Variables

Dt_Dll.Cpp File Reference

#include "nowarn.h"
#include <windows.h>
#include <winsock2.h>
#include <stdarg.h>
#include <ws2spi.h>
#include <commdlg.h>
#include <stdio.h>
#include <stdlib.h>
#include "dt_dll.h"
#include "cstack.h"
#include "dt.h"
#include "handlers.h"

Go to the source code of this file.

Defines

#define | _WINSOCKAPI_
#define | SCRATCH_BUFFER (TEXT_LEN + 60)

Functions

BOOL WINAPI | DllMain (HINSTANCE DllInstHandle, DWORD Reason, LPVOID Reserved)
BOOL | DTTextOut (IN HANDLE FileHandle, IN char *String, DWORD Style)
BOOL WINAPIV | WSAPostApiNotify (IN INT NotificationCode, OUT LPVOID ReturnCode, IN LPSTR LibraryName,...)
BOOL WINAPIV | WSAPreApiNotify (IN INT NotificationCode, OUT LPVOID ReturnCode, IN LPSTR LibraryName,...)

Variables

char | Buffer [TEXT_LEN]
HANDLE | LogFileHandle = INVALID_HANDLE_VALUE
ULONG | OutputStyle = NO_OUTPUT
char * | szDtRegKey = "System\\CurrentControlSet\\Services\\Winsock2\\Parameters\\DT_DLL_App_Data"

Define Documentation

#define _WINSOCKAPI_

Definition at line 24 of file Dt_Dll.Cpp.

#define SCRATCH_BUFFER (TEXT_LEN + 60)

Function Documentation

BOOL WINAPI DllMain | ( | HINSTANCE | DllInstHandle,
 |  | DWORD | Reason,
 |  | LPVOID | Reserved
 | ) |  |

Definition at line 81 of file Dt_Dll.Cpp.

                      :

      Please see Windows documentation for DllEntryPoint.

  Arguments:

      Please see windows documentation.

  Return Value:

      Please see windows documentation.

--*/
{

    Cstack_c   *ThreadCstack;   // points to Cstack objects in tls
    PINITDATA   InitDataPtr;    // to pass to the window creation thread
    HKEY        hkeyAppData;
    char        szSubKeyStr[sizeof(szDtRegKey)+256],
               *ptr=NULL;
    int         ModuleLen=0;

    // OutputDebugString ("DllMain called.\n");
    switch(Reason) {

        // Determine the reason for the call and act accordingly.
        case DLL_PROCESS_ATTACH:

            if ((ModuleLen = GetModuleFileName (NULL, ModuleFileName, sizeof (ModuleFileName)))==0)
                return FALSE;

            // Allocate a TLS index.
            TlsIndex = TlsAlloc();
            if (TlsIndex==0xFFFFFFFF)
                return FALSE;

            DllInstHandle = InstanceHandle;
            __try {
                InitializeCriticalSection(&CrSec);
          }
            __except(EXCEPTION_EXECUTE_HANDLER) {
                OutputStyle = NO_OUTPUT;
                return FALSE;
            }

            TextOutEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
            if (TextOutEvent==NULL)
                return FALSE;

            // Fill in the handler function table.
            DTHandlerInit(HdlFuncTable, MAX_DTCODE);

            // Build the log file name
            strcpy (LogFileName, ModuleFileName);
            strcat (LogFileName, ".log");

            // See if the reg key exists for this EXE
            ptr = &ModuleFileName[ModuleLen-1];
            while ( (ptr != ModuleFileName) &&  (*ptr != '\\') )
                ptr--;
            if (*ptr == '\\')
                ptr++;

            // Build the key
            _snprintf(szSubKeyStr, sizeof(szDtRegKey)+255,
                    "%s\\%s", szDtRegKey, ptr);

            OutputDebugString("Looking for key: ");
            OutputDebugString(szSubKeyStr);
            OutputDebugString("\r\n");

            if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
                        szSubKeyStr,
                        0,
                        KEY_QUERY_VALUE,
                        &hkeyAppData) == NO_ERROR)
            {
                OutputDebugString("Found the registry key\r\n");
                OutputStyle = FILE_ONLY;

                RegCloseKey(hkeyAppData);
            }
            else
            {
                OutputStyle = NO_OUTPUT;
            }

            if (OutputStyle == FILE_ONLY)
            {
                LogFileHandle = CreateFile(LogFileName,
                        GENERIC_WRITE,
                        FILE_SHARE_READ | FILE_SHARE_WRITE,
                        NULL,
                        CREATE_ALWAYS,
                        FILE_ATTRIBUTE_NORMAL,
                        NULL);
                if (LogFileHandle == INVALID_HANDLE_VALUE) {
                    OutputDebugString("Unable to create log file!\r\n");
                    OutputStyle = NO_OUTPUT;
                }
            }

            // Get some information for later output to the debug window
            // or file -- get the time, PID, and TID of the calling
            // process and put into a INITDATA struct.  This memory will
            // be freed by the thread it is passed to.
            InitDataPtr = (PINITDATA) LocalAlloc(0, sizeof(INITDATA));
            GetLocalTime(&(InitDataPtr->LocalTime));
            InitDataPtr->TID = GetCurrentThreadId();
            InitDataPtr->PID = GetCurrentProcessId();

            // Normally the window thread does a DTTextOut of the time
            // and process info that we saved just above.  But in this
            // case,  there is no window thread so spit it out to the
            // file or debugger.

            _snprintf(Buffer, TEXT_LEN-1, "Log initiated: %d-%d-%d, %d:%d:%d\r\n",
                    InitDataPtr->LocalTime.wMonth,
                    InitDataPtr->LocalTime.wDay,
                    InitDataPtr->LocalTime.wYear,
                    InitDataPtr->LocalTime.wHour,
                    InitDataPtr->LocalTime.wMinute,
                    InitDataPtr->LocalTime.wSecond);
            DTTextOut(LogFileHandle, Buffer, OutputStyle);
            _snprintf(Buffer, TEXT_LEN-1, "Process ID: 0x%X   Thread ID: 0x%X\r\n",
                    InitDataPtr->PID,
                    InitDataPtr->TID);
            DTTextOut(LogFileHandle, Buffer, OutputStyle);

            // Setting this event allows {Pre|Post}ApiNotify to
            // proceed.  This event isn't really needed in this case
            // (because there is only one thread, and we know the code
            // above has been executed before WSAPre|PostApiNotify).
            SetEvent(TextOutEvent);

            // flow through...

        case DLL_THREAD_ATTACH:

            // Store a pointer to a new Cstack_c in the slot for this
            // thread.
            ThreadCstack = new Cstack_c();
            TlsSetValue(TlsIndex, (LPVOID)ThreadCstack);

            break;

        case DLL_PROCESS_DETACH:

            // Free up some resources.  This is like cleaning up your room
            // before the tornado strikes, but hey, it's good practice.
            TlsFree(TlsIndex);
            DeleteCriticalSection(&CrSec);

            CloseHandle(LogFileHandle);

            break;

        case DLL_THREAD_DETACH:

            // Get the pointer to this thread's Cstack, and delete the
            // object.
            ThreadCstack = (Cstack_c *)TlsGetValue(TlsIndex);
            delete ThreadCstack;

            break;

        default:

            break;
    } // switch (Reason)

    return TRUE;
} // DllMain()

BOOL DTTextOut | ( | IN HANDLE | FileHandle,
 |  | IN char * | String,
 |  | DWORD | Style
 | ) |  |

Definition at line 478 of file Dt_Dll.Cpp.

                      :

      This function outputs a string to a debug window and/or file.

  Arguments:

      FileHandle -- handle to an open file for debug output.

      String -- the string to output.

      Style -- specifies whether the output should go to the window,
      the file, or both.

  Return Value:

      Returns TRUE if the output succeeds, FALSE otherwise.

--*/
{
#define SCRATCH_BUFFER  (TEXT_LEN + 60)

    DWORD NumWritten;               // WriteFile takes an address to this
    BOOL  Result;                   // result of WriteFile
    char  Output[SCRATCH_BUFFER];   // scratch buffer

    static DWORD LineCount = 0;     // text output line number
    DWORD  BufIndex = 0;            // index into output string

    if ((Style==NO_OUTPUT) || (FileHandle == INVALID_HANDLE_VALUE))
        return TRUE;

    // Build a new string with the line-number and pid.tid in front.
    BufIndex += _snprintf(Output, SCRATCH_BUFFER-1, "(%d-%X.%X) ", LineCount++,
                                    GetCurrentProcessId (),
                                    GetCurrentThreadId ());
    strncat(Output, String, SCRATCH_BUFFER - BufIndex - 1);

    Result = WriteFile(FileHandle, (LPCVOID)Output, (int) strlen(Output),
                       &NumWritten, NULL);
    if (!Result) {

        CloseHandle(FileHandle);
        FileHandle = INVALID_HANDLE_VALUE;
        return FALSE;
    }

    return TRUE;

} // DTTextOut()

BOOL WINAPIV WSAPostApiNotify | ( | IN INT | NotificationCode,
 |  | OUT LPVOID | ReturnCode,
 |  | IN LPSTR | LibraryName,
 |  |  | ...
 | ) |  |

Definition at line 386 of file Dt_Dll.Cpp.

                      :

      Like PreApiNotify, builds a string and passes it, along with
      information about the call, to a handler function.

  Arguments:

      NotificationCode  -- specifies which API function called us.

      ReturnCode -- a generic pointer to the return value of the API
      function.

      ...    -- variable number argument list.  These are pointers
      to the actual parameters of the API functions.

  Return Value:

      Returns value is currently meaningless.

--*/
{
    va_list          vl;            // used for variable arg-list parsing
    Cstack_c         *ThreadCstack; // the Cstack_c object for this thread
    int              Index = 0;     // index into string we are creating
    int              Counter;       // counter we pop off the cstack
    LPFNDTHANDLER    HdlFunc;       // pointer to handler function
    int              OriginalError; // any pending error is saved

    if (OutputStyle==NO_OUTPUT)
        return FALSE;

    OriginalError = GetLastError();

    EnterCriticalSection(&CrSec);

    // Wait until it's ok to send output.
    WaitForSingleObject(TextOutEvent, INFINITE);

  va_start(vl, LibraryName);

  // Get the cstack object from TLS, pop the Counter.
    ThreadCstack = (Cstack_c *) TlsGetValue(TlsIndex);

    if (!ThreadCstack){
        ThreadCstack = new Cstack_c();
        TlsSetValue(TlsIndex, (LPVOID)ThreadCstack);
        _snprintf(Buffer, TEXT_LEN-1, "0x%X Foriegn thread\n",
                 GetCurrentThreadId());
        DTTextOut(LogFileHandle, Buffer, OutputStyle);
    } //if

    ThreadCstack->CPop(Counter);

    Index = _snprintf(Buffer, TEXT_LEN-1, "Function Call: %d   ", Counter);

    // Set the error to what it originally was.
    SetLastError(OriginalError);

    // Call the appropriate handling function, output the buffer.
    if ((NotificationCode < MAX_DTCODE) && HdlFuncTable[NotificationCode]) {
        HdlFunc = HdlFuncTable[NotificationCode];
        (*HdlFunc)(vl, ReturnCode,
                   LibraryName,
                   Buffer,
                   Index,
                   TEXT_LEN,
                   FALSE);
    } else {

        _snprintf(Buffer + Index, TEXT_LEN - Index - 1, "Unknown function returned!\r\n");
        DTTextOut(LogFileHandle, Buffer, OutputStyle);
    }

    LeaveCriticalSection(&CrSec);
    // In case the error has changed since the handler returned, we
    // want to set it back.
    SetLastError(OriginalError);
    return(FALSE);

} // WSAPostApiNotify()

BOOL WINAPIV WSAPreApiNotify | ( | IN INT | NotificationCode,
 |  | OUT LPVOID | ReturnCode,
 |  | IN LPSTR | LibraryName,
 |  |  | ...
 | ) |  |

Definition at line 270 of file Dt_Dll.Cpp.

                      :

      Builds a string for output and passes it, along with information
      about the call, to a handler function.

  Arguments:

      NotificationCode -- specifies which API function called us.

      ReturnCode -- a generic pointer to the return value of the API
      function.  Can be used to change the return value in the
      case of a short-circuit (see how the return value from
      PreApiNotify works for more information on short-circuiting
      the API function).

      LibraryName -- a string pointing to the name of the library that
      called us.

      ...    -- variable number argument list.  These are pointers
      to the actual parameters of the API functions.

  Return Value:

      Returns TRUE if we want to short-circuit the API function;
      in other words, returning non-zero here forces the API function
      to return immediately before any other actions take place.

      Returns FALSE if we want to proceed with the API function.

--*/
{
    va_list          vl;            // used for variable arg-list parsing
    Cstack_c         *ThreadCstack; // the Cstack_c object for this thread
    int              Index = 0;     // index into string we are creating
    BOOL             ReturnValue;   // value to return
    LPFNDTHANDLER    HdlFunc;       // pointer to handler function
    int              Counter;       // counter popped off the cstack
    int              OriginalError; // any pending error is saved

    if (OutputStyle==NO_OUTPUT)
        return FALSE;

    OriginalError = GetLastError();

    EnterCriticalSection(&CrSec);

    // Wait until the debug window is ready to receive text for output.
    WaitForSingleObject(TextOutEvent, INFINITE);
    va_start(vl, LibraryName);

    // Get the Cstack_c object for this thread.
    ThreadCstack = (Cstack_c *)TlsGetValue(TlsIndex);
    if (!ThreadCstack){
        ThreadCstack = new Cstack_c();
        TlsSetValue(TlsIndex, (LPVOID)ThreadCstack);
        _snprintf(Buffer, TEXT_LEN-1, "0x%X Foriegn thread\n",
                 GetCurrentThreadId());
        DTTextOut(LogFileHandle, Buffer, OutputStyle);
    } //if

    // Start building an output string with some info that's
    // independent of which API function called us.
    Index = _snprintf(Buffer, TEXT_LEN-1, "Function call: %d   ",
                      ThreadCstack->CGetCounter());

    // Push the counter & increment.
    ThreadCstack->CPush();

    // Reset the error to what it was when the function started.
    SetLastError(OriginalError);

    // Call the appropriate handling function, output the buffer.
    if ((NotificationCode < MAX_DTCODE) && HdlFuncTable[NotificationCode]) {
        HdlFunc = HdlFuncTable[NotificationCode];
        ReturnValue = (*HdlFunc)(vl, ReturnCode,
                                 LibraryName,
                                 Buffer,
                                 Index,
                                 TEXT_LEN,
                                 TRUE);

    } else {

        _snprintf(Buffer + Index, TEXT_LEN - Index - 1, "Unknown function called!\r\n");
        DTTextOut(LogFileHandle, Buffer, OutputStyle);
        ReturnValue = FALSE;
    }

    // If we are returning TRUE, then the API/SPI function will be
    // short-circuited.  We must pop the thread stack, since no
    // corresponding WSAPostApiNotify will be called.
    if (ReturnValue) {
        ThreadCstack->CPop(Counter);
    }

    LeaveCriticalSection(&CrSec);
    // In case the error has changed since the handler returned, we
    // want to set it back.
    SetLastError(OriginalError);
    return(ReturnValue);

} // WSAPreApiNotify()

Variable Documentation

char Buffer[TEXT_LEN]

Definition at line 56 of file Dt_Dll.Cpp.

HANDLE LogFileHandle = INVALID_HANDLE_VALUE

Definition at line 54 of file Dt_Dll.Cpp.

ULONG OutputStyle = NO_OUTPUT

Definition at line 55 of file Dt_Dll.Cpp.

char* szDtRegKey = "System\\CurrentControlSet\\Services\\Winsock2\\Parameters\\DT_DLL_App_Data"

Definition at line 57 of file Dt_Dll.Cpp.

Generated on Wed Nov 13 2024 16:54:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/Dt_Dll/Dt_Dll.h File Reference

  • NetDS
  • WinSock
  • Dt_Dll
Defines | Typedefs | Functions

Dt_Dll.h File Reference

#include "nowarn.h"
#include <winsock2.h>

Go to the source code of this file.

Defines

#define | DTCODE___WSAFDIsSet 122
#define | DTCODE_accept 1
#define | DTCODE_bind 2
#define | DTCODE_closesocket 3
#define | DTCODE_connect 4
#define | DTCODE_gethostbyaddr 57
#define | DTCODE_gethostbyname 58
#define | DTCODE_gethostname 59
#define | DTCODE_getpeername 5
#define | DTCODE_getprotobyname 60
#define | DTCODE_getprotobynumber 61
#define | DTCODE_getservbyname 62
#define | DTCODE_getservbyport 63
#define | DTCODE_getsockname 6
#define | DTCODE_getsockopt 7
#define | DTCODE_htonl 8
#define | DTCODE_htons 9
#define | DTCODE_inet_addr 64
#define | DTCODE_inet_ntoa 65
#define | DTCODE_ioctlsocket 10
#define | DTCODE_listen 11
#define | DTCODE_NSPAddressToString 145
#define | DTCODE_NSPEnumNameSpaceProviders 155
#define | DTCODE_NSPGetAddressByName 150
#define | DTCODE_NSPGetServiceClassInfo 154
#define | DTCODE_NSPGetServiceClassNameByClassId 156
#define | DTCODE_NSPInstallServiceClass 151
#define | DTCODE_NSPLookupServiceBegin 147
#define | DTCODE_NSPLookupServiceEnd 149
#define | DTCODE_NSPLookupServiceNext 148
#define | DTCODE_NSPRemoveServiceClass 153
#define | DTCODE_NSPSetService 152
#define | DTCODE_NSPStringToAddress 146
#define | DTCODE_ntohl 12
#define | DTCODE_ntohs 13
#define | DTCODE_recv 14
#define | DTCODE_recvfrom 15
#define | DTCODE_select 16
#define | DTCODE_send 17
#define | DTCODE_sendto 18
#define | DTCODE_setsockopt 19
#define | DTCODE_shutdown 20
#define | DTCODE_socket 21
#define | DTCODE_WPUCloseEvent 103
#define | DTCODE_WPUCloseSocketHandle 104
#define | DTCODE_WPUCreateEvent 105
#define | DTCODE_WPUCreateSocketHandle 106
#define | DTCODE_WPUFDIsSet 118
#define | DTCODE_WPUGetProviderPath 116
#define | DTCODE_WPUModifyIFSHandle 109
#define | DTCODE_WPUPostMessage 117
#define | DTCODE_WPUQueryBlockingCallback 110
#define | DTCODE_WPUQuerySocketHandleContext 111
#define | DTCODE_WPUQueueApc 112
#define | DTCODE_WPUResetEvent 113
#define | DTCODE_WPUSetEvent 114
#define | DTCODE_WSAAccept 22
#define | DTCODE_WSAAddressToStringA 123
#define | DTCODE_WSAAddressToStringW 124
#define | DTCODE_WSAAsyncGetHostByAddr 66
#define | DTCODE_WSAAsyncGetHostByName 67
#define | DTCODE_WSAAsyncGetProtoByName 68
#define | DTCODE_WSAAsyncGetProtoByNumber 69
#define | DTCODE_WSAAsyncGetServByName 70
#define | DTCODE_WSAAsyncGetServByPort 71
#define | DTCODE_WSAAsyncSelect 23
#define | DTCODE_WSACancelAsyncRequest 72
#define | DTCODE_WSACancelBlockingCall 24
#define | DTCODE_WSACleanup 25
#define | DTCODE_WSACloseEvent 26
#define | DTCODE_WSAConnect 27
#define | DTCODE_WSACreateEvent 28
#define | DTCODE_WSADuplicateSocketA 29
#define | DTCODE_WSADuplicateSocketW 119
#define | DTCODE_WSAEnumNameSpaceProvidersA 141
#define | DTCODE_WSAEnumNameSpaceProvidersW 142
#define | DTCODE_WSAEnumNetworkEvents 30
#define | DTCODE_WSAEnumProtocolsA 31
#define | DTCODE_WSAEnumProtocolsW 120
#define | DTCODE_WSAEventSelect 32
#define | DTCODE_WSAGetLastError 33
#define | DTCODE_WSAGetOverlappedResult 34
#define | DTCODE_WSAGetQOSByName 35
#define | DTCODE_WSAGetServiceClassInfoA 139
#define | DTCODE_WSAGetServiceClassInfoW 140
#define | DTCODE_WSAGetServiceClassNameByClassIdA 143
#define | DTCODE_WSAGetServiceClassNameByClassIdW 144
#define | DTCODE_WSAHtonl 36
#define | DTCODE_WSAHtons 37
#define | DTCODE_WSAInstallServiceClassA 134
#define | DTCODE_WSAInstallServiceClassW 135
#define | DTCODE_WSAIoctl 38
#define | DTCODE_WSAIsBlocking 39
#define | DTCODE_WSAJoinLeaf 40
#define | DTCODE_WSALookupServiceBeginA 127
#define | DTCODE_WSALookupServiceBeginW 128
#define | DTCODE_WSALookupServiceEnd 131
#define | DTCODE_WSALookupServiceNextA 129
#define | DTCODE_WSALookupServiceNextW 130
#define | DTCODE_WSANtohl 41
#define | DTCODE_WSANtohs 42
#define | DTCODE_WSARecv 43
#define | DTCODE_WSARecvDisconnect 44
#define | DTCODE_WSARecvFrom 45
#define | DTCODE_WSARemoveServiceClass 138
#define | DTCODE_WSAResetEvent 46
#define | DTCODE_WSASend 47
#define | DTCODE_WSASendDisconnect 48
#define | DTCODE_WSASendTo 49
#define | DTCODE_WSASetBlockingHook 50
#define | DTCODE_WSASetEvent 51
#define | DTCODE_WSASetLastError 52
#define | DTCODE_WSASetServiceA 136
#define | DTCODE_WSASetServiceW 137
#define | DTCODE_WSASocketA 53
#define | DTCODE_WSASocketW 121
#define | DTCODE_WSAStartup 54
#define | DTCODE_WSAStringToAddressA 125
#define | DTCODE_WSAStringToAddressW 126
#define | DTCODE_WSAUnhookBlockingHook 55
#define | DTCODE_WSAWaitForMultipleEvents 56
#define | DTCODE_WSCDeinstallProvider 107
#define | DTCODE_WSCEnableNSProvider 160
#define | DTCODE_WSCEnumProtocols 115
#define | DTCODE_WSCGetProviderPath 157
#define | DTCODE_WSCInstallNameSpace 158
#define | DTCODE_WSCInstallProvider 108
#define | DTCODE_WSCUnInstallNameSpace 159
#define | DTCODE_WSPAccept 73
#define | DTCODE_WSPAddressToString 161
#define | DTCODE_WSPAsyncSelect 74
#define | DTCODE_WSPBind 75
#define | DTCODE_WSPCancelBlockingCall 76
#define | DTCODE_WSPCleanup 77
#define | DTCODE_WSPCloseSocket 78
#define | DTCODE_WSPConnect 79
#define | DTCODE_WSPDuplicateSocket 80
#define | DTCODE_WSPEnumNetworkEvents 81
#define | DTCODE_WSPEventSelect 82
#define | DTCODE_WSPGetOverlappedResult 83
#define | DTCODE_WSPGetPeerName 84
#define | DTCODE_WSPGetQOSByName 88
#define | DTCODE_WSPGetSockName 86
#define | DTCODE_WSPGetSockOpt 87
#define | DTCODE_WSPIoctl 89
#define | DTCODE_WSPJoinLeaf 90
#define | DTCODE_WSPListen 91
#define | DTCODE_WSPRecv 92
#define | DTCODE_WSPRecvDisconnect 93
#define | DTCODE_WSPRecvFrom 94
#define | DTCODE_WSPSelect 95
#define | DTCODE_WSPSend 96
#define | DTCODE_WSPSendDisconnect 97
#define | DTCODE_WSPSendTo 98
#define | DTCODE_WSPSetSockOpt 99
#define | DTCODE_WSPShutdown 100
#define | DTCODE_WSPSocket 101
#define | DTCODE_WSPStartup 102
#define | DTCODE_WSPStringToAddress 162
#define | MAX_DTCODE DTCODE_WSPStringToAddress

Typedefs

typedef VOID(WINAPI * | LPFNWSAEXCEPTIONNOTIFY )(IN LPEXCEPTION_POINTERS ExceptionPointers)
typedef BOOL(WINAPIV * | LPFNWSANOTIFY )(IN INT NotificationCode, OUT LPVOID ReturnCode, IN LPSTR LibraryName,...)

Functions

VOID WINAPI | WSAExceptionNotify (IN LPEXCEPTION_POINTERS ExceptionPointers)
BOOL WINAPIV | WSAPostApiNotify (IN INT NotificationCode, OUT LPVOID ReturnCode, IN LPSTR LibraryName,...)
BOOL WINAPIV | WSAPreApiNotify (IN INT NotificationCode, OUT LPVOID ReturnCode, IN LPSTR LibraryName,...)

Define Documentation

#define DTCODE___WSAFDIsSet 122

Definition at line 202 of file Dt_Dll.h.

#define DTCODE_accept 1

Definition at line 79 of file Dt_Dll.h.

#define DTCODE_bind 2

Definition at line 80 of file Dt_Dll.h.

#define DTCODE_closesocket 3

Definition at line 81 of file Dt_Dll.h.

#define DTCODE_connect 4

Definition at line 82 of file Dt_Dll.h.

#define DTCODE_gethostbyaddr 57

Definition at line 135 of file Dt_Dll.h.

#define DTCODE_gethostbyname 58

Definition at line 136 of file Dt_Dll.h.

#define DTCODE_gethostname 59

Definition at line 137 of file Dt_Dll.h.

#define DTCODE_getpeername 5

Definition at line 83 of file Dt_Dll.h.

#define DTCODE_getprotobyname 60

Definition at line 138 of file Dt_Dll.h.

#define DTCODE_getprotobynumber 61

Definition at line 139 of file Dt_Dll.h.

#define DTCODE_getservbyname 62

Definition at line 140 of file Dt_Dll.h.

#define DTCODE_getservbyport 63

Definition at line 141 of file Dt_Dll.h.

#define DTCODE_getsockname 6

Definition at line 84 of file Dt_Dll.h.

#define DTCODE_getsockopt 7

Definition at line 85 of file Dt_Dll.h.

#define DTCODE_htonl 8

Definition at line 86 of file Dt_Dll.h.

#define DTCODE_htons 9

Definition at line 87 of file Dt_Dll.h.

#define DTCODE_inet_addr 64

Definition at line 142 of file Dt_Dll.h.

#define DTCODE_inet_ntoa 65

Definition at line 143 of file Dt_Dll.h.

#define DTCODE_ioctlsocket 10

Definition at line 88 of file Dt_Dll.h.

#define DTCODE_listen 11

Definition at line 89 of file Dt_Dll.h.

#define DTCODE_NSPAddressToString 145

Definition at line 228 of file Dt_Dll.h.

#define DTCODE_NSPEnumNameSpaceProviders 155

Definition at line 238 of file Dt_Dll.h.

#define DTCODE_NSPGetAddressByName 150

Definition at line 233 of file Dt_Dll.h.

#define DTCODE_NSPGetServiceClassInfo 154

Definition at line 237 of file Dt_Dll.h.

#define DTCODE_NSPGetServiceClassNameByClassId 156

Definition at line 239 of file Dt_Dll.h.

#define DTCODE_NSPInstallServiceClass 151

Definition at line 234 of file Dt_Dll.h.

#define DTCODE_NSPLookupServiceBegin 147

Definition at line 230 of file Dt_Dll.h.

#define DTCODE_NSPLookupServiceEnd 149

Definition at line 232 of file Dt_Dll.h.

#define DTCODE_NSPLookupServiceNext 148

Definition at line 231 of file Dt_Dll.h.

#define DTCODE_NSPRemoveServiceClass 153

Definition at line 236 of file Dt_Dll.h.

#define DTCODE_NSPSetService 152

Definition at line 235 of file Dt_Dll.h.

#define DTCODE_NSPStringToAddress 146

Definition at line 229 of file Dt_Dll.h.

#define DTCODE_ntohl 12

Definition at line 90 of file Dt_Dll.h.

#define DTCODE_ntohs 13

Definition at line 91 of file Dt_Dll.h.

#define DTCODE_recv 14

Definition at line 92 of file Dt_Dll.h.

#define DTCODE_recvfrom 15

Definition at line 93 of file Dt_Dll.h.

#define DTCODE_select 16

Definition at line 94 of file Dt_Dll.h.

#define DTCODE_send 17

Definition at line 95 of file Dt_Dll.h.

#define DTCODE_sendto 18

Definition at line 96 of file Dt_Dll.h.

#define DTCODE_setsockopt 19

Definition at line 97 of file Dt_Dll.h.

#define DTCODE_shutdown 20

Definition at line 98 of file Dt_Dll.h.

#define DTCODE_socket 21

Definition at line 99 of file Dt_Dll.h.

#define DTCODE_WPUCloseEvent 103

Definition at line 183 of file Dt_Dll.h.

#define DTCODE_WPUCloseSocketHandle 104

Definition at line 184 of file Dt_Dll.h.

#define DTCODE_WPUCreateEvent 105

Definition at line 185 of file Dt_Dll.h.

#define DTCODE_WPUCreateSocketHandle 106

Definition at line 186 of file Dt_Dll.h.

#define DTCODE_WPUFDIsSet 118

Definition at line 198 of file Dt_Dll.h.

#define DTCODE_WPUGetProviderPath 116

Definition at line 196 of file Dt_Dll.h.

#define DTCODE_WPUModifyIFSHandle 109

Definition at line 189 of file Dt_Dll.h.

#define DTCODE_WPUPostMessage 117

Definition at line 197 of file Dt_Dll.h.

#define DTCODE_WPUQueryBlockingCallback 110

Definition at line 190 of file Dt_Dll.h.

#define DTCODE_WPUQuerySocketHandleContext 111

Definition at line 191 of file Dt_Dll.h.

#define DTCODE_WPUQueueApc 112

Definition at line 192 of file Dt_Dll.h.

#define DTCODE_WPUResetEvent 113

Definition at line 193 of file Dt_Dll.h.

#define DTCODE_WPUSetEvent 114

Definition at line 194 of file Dt_Dll.h.

#define DTCODE_WSAAccept 22

Definition at line 100 of file Dt_Dll.h.

#define DTCODE_WSAAddressToStringA 123

Definition at line 203 of file Dt_Dll.h.

#define DTCODE_WSAAddressToStringW 124

Definition at line 204 of file Dt_Dll.h.

#define DTCODE_WSAAsyncGetHostByAddr 66

Definition at line 144 of file Dt_Dll.h.

#define DTCODE_WSAAsyncGetHostByName 67

Definition at line 145 of file Dt_Dll.h.

#define DTCODE_WSAAsyncGetProtoByName 68

Definition at line 146 of file Dt_Dll.h.

#define DTCODE_WSAAsyncGetProtoByNumber 69

Definition at line 147 of file Dt_Dll.h.

#define DTCODE_WSAAsyncGetServByName 70

Definition at line 148 of file Dt_Dll.h.

#define DTCODE_WSAAsyncGetServByPort 71

Definition at line 149 of file Dt_Dll.h.

#define DTCODE_WSAAsyncSelect 23

Definition at line 101 of file Dt_Dll.h.

#define DTCODE_WSACancelAsyncRequest 72

Definition at line 150 of file Dt_Dll.h.

#define DTCODE_WSACancelBlockingCall 24

Definition at line 102 of file Dt_Dll.h.

#define DTCODE_WSACleanup 25

Definition at line 103 of file Dt_Dll.h.

#define DTCODE_WSACloseEvent 26

Definition at line 104 of file Dt_Dll.h.

#define DTCODE_WSAConnect 27

Definition at line 105 of file Dt_Dll.h.

#define DTCODE_WSACreateEvent 28

Definition at line 106 of file Dt_Dll.h.

#define DTCODE_WSADuplicateSocketA 29

Definition at line 107 of file Dt_Dll.h.

#define DTCODE_WSADuplicateSocketW 119

Definition at line 199 of file Dt_Dll.h.

#define DTCODE_WSAEnumNameSpaceProvidersA 141

Definition at line 224 of file Dt_Dll.h.

#define DTCODE_WSAEnumNameSpaceProvidersW 142

Definition at line 225 of file Dt_Dll.h.

#define DTCODE_WSAEnumNetworkEvents 30

Definition at line 108 of file Dt_Dll.h.

#define DTCODE_WSAEnumProtocolsA 31

Definition at line 109 of file Dt_Dll.h.

#define DTCODE_WSAEnumProtocolsW 120

Definition at line 200 of file Dt_Dll.h.

#define DTCODE_WSAEventSelect 32

Definition at line 110 of file Dt_Dll.h.

#define DTCODE_WSAGetLastError 33

Definition at line 111 of file Dt_Dll.h.

#define DTCODE_WSAGetOverlappedResult 34

Definition at line 112 of file Dt_Dll.h.

#define DTCODE_WSAGetQOSByName 35

Definition at line 113 of file Dt_Dll.h.

#define DTCODE_WSAGetServiceClassInfoA 139

Definition at line 222 of file Dt_Dll.h.

#define DTCODE_WSAGetServiceClassInfoW 140

Definition at line 223 of file Dt_Dll.h.

#define DTCODE_WSAGetServiceClassNameByClassIdA 143

Definition at line 226 of file Dt_Dll.h.

#define DTCODE_WSAGetServiceClassNameByClassIdW 144

Definition at line 227 of file Dt_Dll.h.

#define DTCODE_WSAHtonl 36

Definition at line 114 of file Dt_Dll.h.

#define DTCODE_WSAHtons 37

Definition at line 115 of file Dt_Dll.h.

#define DTCODE_WSAInstallServiceClassA 134

Definition at line 217 of file Dt_Dll.h.

#define DTCODE_WSAInstallServiceClassW 135

Definition at line 218 of file Dt_Dll.h.

#define DTCODE_WSAIoctl 38

Definition at line 116 of file Dt_Dll.h.

#define DTCODE_WSAIsBlocking 39

Definition at line 117 of file Dt_Dll.h.

#define DTCODE_WSAJoinLeaf 40

Definition at line 118 of file Dt_Dll.h.

#define DTCODE_WSALookupServiceBeginA 127

Definition at line 207 of file Dt_Dll.h.

#define DTCODE_WSALookupServiceBeginW 128

Definition at line 208 of file Dt_Dll.h.

#define DTCODE_WSALookupServiceEnd 131

Definition at line 211 of file Dt_Dll.h.

#define DTCODE_WSALookupServiceNextA 129

Definition at line 209 of file Dt_Dll.h.

#define DTCODE_WSALookupServiceNextW 130

Definition at line 210 of file Dt_Dll.h.

#define DTCODE_WSANtohl 41

Definition at line 119 of file Dt_Dll.h.

#define DTCODE_WSANtohs 42

Definition at line 120 of file Dt_Dll.h.

#define DTCODE_WSARecv 43

Definition at line 121 of file Dt_Dll.h.

#define DTCODE_WSARecvDisconnect 44

Definition at line 122 of file Dt_Dll.h.

#define DTCODE_WSARecvFrom 45

Definition at line 123 of file Dt_Dll.h.

#define DTCODE_WSARemoveServiceClass 138

Definition at line 221 of file Dt_Dll.h.

#define DTCODE_WSAResetEvent 46

Definition at line 124 of file Dt_Dll.h.

#define DTCODE_WSASend 47

Definition at line 125 of file Dt_Dll.h.

#define DTCODE_WSASendDisconnect 48

Definition at line 126 of file Dt_Dll.h.

#define DTCODE_WSASendTo 49

Definition at line 127 of file Dt_Dll.h.

#define DTCODE_WSASetBlockingHook 50

Definition at line 128 of file Dt_Dll.h.

#define DTCODE_WSASetEvent 51

Definition at line 129 of file Dt_Dll.h.

#define DTCODE_WSASetLastError 52

Definition at line 130 of file Dt_Dll.h.

#define DTCODE_WSASetServiceA 136

Definition at line 219 of file Dt_Dll.h.

#define DTCODE_WSASetServiceW 137

Definition at line 220 of file Dt_Dll.h.

#define DTCODE_WSASocketA 53

Definition at line 131 of file Dt_Dll.h.

#define DTCODE_WSASocketW 121

Definition at line 201 of file Dt_Dll.h.

#define DTCODE_WSAStartup 54

Definition at line 132 of file Dt_Dll.h.

#define DTCODE_WSAStringToAddressA 125

Definition at line 205 of file Dt_Dll.h.

#define DTCODE_WSAStringToAddressW 126

Definition at line 206 of file Dt_Dll.h.

#define DTCODE_WSAUnhookBlockingHook 55

Definition at line 133 of file Dt_Dll.h.

#define DTCODE_WSAWaitForMultipleEvents 56

Definition at line 134 of file Dt_Dll.h.

#define DTCODE_WSCDeinstallProvider 107

Definition at line 187 of file Dt_Dll.h.

#define DTCODE_WSCEnableNSProvider 160

Definition at line 243 of file Dt_Dll.h.

#define DTCODE_WSCEnumProtocols 115

Definition at line 195 of file Dt_Dll.h.

#define DTCODE_WSCGetProviderPath 157

Definition at line 240 of file Dt_Dll.h.

#define DTCODE_WSCInstallNameSpace 158

Definition at line 241 of file Dt_Dll.h.

#define DTCODE_WSCInstallProvider 108

Definition at line 188 of file Dt_Dll.h.

#define DTCODE_WSCUnInstallNameSpace 159

Definition at line 242 of file Dt_Dll.h.

#define DTCODE_WSPAccept 73

Definition at line 151 of file Dt_Dll.h.

#define DTCODE_WSPAddressToString 161

Definition at line 244 of file Dt_Dll.h.

#define DTCODE_WSPAsyncSelect 74

Definition at line 152 of file Dt_Dll.h.

#define DTCODE_WSPBind 75

Definition at line 153 of file Dt_Dll.h.

#define DTCODE_WSPCancelBlockingCall 76

Definition at line 154 of file Dt_Dll.h.

#define DTCODE_WSPCleanup 77

Definition at line 155 of file Dt_Dll.h.

#define DTCODE_WSPCloseSocket 78

Definition at line 156 of file Dt_Dll.h.

#define DTCODE_WSPConnect 79

Definition at line 157 of file Dt_Dll.h.

#define DTCODE_WSPDuplicateSocket 80

Definition at line 158 of file Dt_Dll.h.

#define DTCODE_WSPEnumNetworkEvents 81

Definition at line 159 of file Dt_Dll.h.

#define DTCODE_WSPEventSelect 82

Definition at line 160 of file Dt_Dll.h.

#define DTCODE_WSPGetOverlappedResult 83

Definition at line 161 of file Dt_Dll.h.

#define DTCODE_WSPGetPeerName 84

Definition at line 162 of file Dt_Dll.h.

#define DTCODE_WSPGetQOSByName 88

Definition at line 168 of file Dt_Dll.h.

#define DTCODE_WSPGetSockName 86

Definition at line 166 of file Dt_Dll.h.

#define DTCODE_WSPGetSockOpt 87

Definition at line 167 of file Dt_Dll.h.

#define DTCODE_WSPIoctl 89

Definition at line 169 of file Dt_Dll.h.

#define DTCODE_WSPJoinLeaf 90

Definition at line 170 of file Dt_Dll.h.

#define DTCODE_WSPListen 91

Definition at line 171 of file Dt_Dll.h.

#define DTCODE_WSPRecv 92

Definition at line 172 of file Dt_Dll.h.

#define DTCODE_WSPRecvDisconnect 93

Definition at line 173 of file Dt_Dll.h.

#define DTCODE_WSPRecvFrom 94

Definition at line 174 of file Dt_Dll.h.

#define DTCODE_WSPSelect 95

Definition at line 175 of file Dt_Dll.h.

#define DTCODE_WSPSend 96

Definition at line 176 of file Dt_Dll.h.

#define DTCODE_WSPSendDisconnect 97

Definition at line 177 of file Dt_Dll.h.

#define DTCODE_WSPSendTo 98

Definition at line 178 of file Dt_Dll.h.

#define DTCODE_WSPSetSockOpt 99

Definition at line 179 of file Dt_Dll.h.

#define DTCODE_WSPShutdown 100

Definition at line 180 of file Dt_Dll.h.

#define DTCODE_WSPSocket 101

Definition at line 181 of file Dt_Dll.h.

#define DTCODE_WSPStartup 102

Definition at line 182 of file Dt_Dll.h.

#define DTCODE_WSPStringToAddress 162

Definition at line 245 of file Dt_Dll.h.

#define MAX_DTCODE DTCODE_WSPStringToAddress

Definition at line 247 of file Dt_Dll.h.

Typedef Documentation

typedef VOID(WINAPI * LPFNWSAEXCEPTIONNOTIFY)(IN LPEXCEPTION_POINTERS ExceptionPointers)

Definition at line 57 of file Dt_Dll.h.

typedef BOOL(WINAPIV * LPFNWSANOTIFY)(IN INT NotificationCode, OUT LPVOID ReturnCode, IN LPSTR LibraryName,...)

Definition at line 27 of file Dt_Dll.h.

Function Documentation

VOID WINAPI WSAExceptionNotify ( IN LPEXCEPTION_POINTERS ExceptionPointers )
BOOL WINAPIV WSAPostApiNotify | ( | IN INT | NotificationCode,
 |  | OUT LPVOID | ReturnCode,
 |  | IN LPSTR | LibraryName,
 |  |  | ...
 | ) |  |

Definition at line 386 of file Dt_Dll.Cpp.

                      :

      Like PreApiNotify, builds a string and passes it, along with
      information about the call, to a handler function.

  Arguments:

      NotificationCode  -- specifies which API function called us.

      ReturnCode -- a generic pointer to the return value of the API
      function.

      ...    -- variable number argument list.  These are pointers
      to the actual parameters of the API functions.

  Return Value:

      Returns value is currently meaningless.

--*/
{
    va_list          vl;            // used for variable arg-list parsing
    Cstack_c         *ThreadCstack; // the Cstack_c object for this thread
    int              Index = 0;     // index into string we are creating
    int              Counter;       // counter we pop off the cstack
    LPFNDTHANDLER    HdlFunc;       // pointer to handler function
    int              OriginalError; // any pending error is saved

    if (OutputStyle==NO_OUTPUT)
        return FALSE;

    OriginalError = GetLastError();

    EnterCriticalSection(&CrSec);

    // Wait until it's ok to send output.
    WaitForSingleObject(TextOutEvent, INFINITE);

  va_start(vl, LibraryName);

  // Get the cstack object from TLS, pop the Counter.
    ThreadCstack = (Cstack_c *) TlsGetValue(TlsIndex);

    if (!ThreadCstack){
        ThreadCstack = new Cstack_c();
        TlsSetValue(TlsIndex, (LPVOID)ThreadCstack);
        _snprintf(Buffer, TEXT_LEN-1, "0x%X Foriegn thread\n",
                 GetCurrentThreadId());
        DTTextOut(LogFileHandle, Buffer, OutputStyle);
    } //if

    ThreadCstack->CPop(Counter);

    Index = _snprintf(Buffer, TEXT_LEN-1, "Function Call: %d   ", Counter);

    // Set the error to what it originally was.
    SetLastError(OriginalError);

    // Call the appropriate handling function, output the buffer.
    if ((NotificationCode < MAX_DTCODE) && HdlFuncTable[NotificationCode]) {
        HdlFunc = HdlFuncTable[NotificationCode];
        (*HdlFunc)(vl, ReturnCode,
                   LibraryName,
                   Buffer,
                   Index,
                   TEXT_LEN,
                   FALSE);
    } else {

        _snprintf(Buffer + Index, TEXT_LEN - Index - 1, "Unknown function returned!\r\n");
        DTTextOut(LogFileHandle, Buffer, OutputStyle);
    }

    LeaveCriticalSection(&CrSec);
    // In case the error has changed since the handler returned, we
    // want to set it back.
    SetLastError(OriginalError);
    return(FALSE);

} // WSAPostApiNotify()

BOOL WINAPIV WSAPreApiNotify | ( | IN INT | NotificationCode,
 |  | OUT LPVOID | ReturnCode,
 |  | IN LPSTR | LibraryName,
 |  |  | ...
 | ) |  |

Definition at line 270 of file Dt_Dll.Cpp.

                      :

      Builds a string for output and passes it, along with information
      about the call, to a handler function.

  Arguments:

      NotificationCode -- specifies which API function called us.

      ReturnCode -- a generic pointer to the return value of the API
      function.  Can be used to change the return value in the
      case of a short-circuit (see how the return value from
      PreApiNotify works for more information on short-circuiting
      the API function).

      LibraryName -- a string pointing to the name of the library that
      called us.

      ...    -- variable number argument list.  These are pointers
      to the actual parameters of the API functions.

  Return Value:

      Returns TRUE if we want to short-circuit the API function;
      in other words, returning non-zero here forces the API function
      to return immediately before any other actions take place.

      Returns FALSE if we want to proceed with the API function.

--*/
{
    va_list          vl;            // used for variable arg-list parsing
    Cstack_c         *ThreadCstack; // the Cstack_c object for this thread
    int              Index = 0;     // index into string we are creating
    BOOL             ReturnValue;   // value to return
    LPFNDTHANDLER    HdlFunc;       // pointer to handler function
    int              Counter;       // counter popped off the cstack
    int              OriginalError; // any pending error is saved

    if (OutputStyle==NO_OUTPUT)
        return FALSE;

    OriginalError = GetLastError();

    EnterCriticalSection(&CrSec);

    // Wait until the debug window is ready to receive text for output.
    WaitForSingleObject(TextOutEvent, INFINITE);
    va_start(vl, LibraryName);

    // Get the Cstack_c object for this thread.
    ThreadCstack = (Cstack_c *)TlsGetValue(TlsIndex);
    if (!ThreadCstack){
        ThreadCstack = new Cstack_c();
        TlsSetValue(TlsIndex, (LPVOID)ThreadCstack);
        _snprintf(Buffer, TEXT_LEN-1, "0x%X Foriegn thread\n",
                 GetCurrentThreadId());
        DTTextOut(LogFileHandle, Buffer, OutputStyle);
    } //if

    // Start building an output string with some info that's
    // independent of which API function called us.
    Index = _snprintf(Buffer, TEXT_LEN-1, "Function call: %d   ",
                      ThreadCstack->CGetCounter());

    // Push the counter & increment.
    ThreadCstack->CPush();

    // Reset the error to what it was when the function started.
    SetLastError(OriginalError);

    // Call the appropriate handling function, output the buffer.
    if ((NotificationCode < MAX_DTCODE) && HdlFuncTable[NotificationCode]) {
        HdlFunc = HdlFuncTable[NotificationCode];
        ReturnValue = (*HdlFunc)(vl, ReturnCode,
                                 LibraryName,
                                 Buffer,
                                 Index,
                                 TEXT_LEN,
                                 TRUE);

    } else {

        _snprintf(Buffer + Index, TEXT_LEN - Index - 1, "Unknown function called!\r\n");
        DTTextOut(LogFileHandle, Buffer, OutputStyle);
        ReturnValue = FALSE;
    }

    // If we are returning TRUE, then the API/SPI function will be
    // short-circuited.  We must pop the thread stack, since no
    // corresponding WSAPostApiNotify will be called.
    if (ReturnValue) {
        ThreadCstack->CPop(Counter);
    }

    LeaveCriticalSection(&CrSec);
    // In case the error has changed since the handler returned, we
    // want to set it back.
    SetLastError(OriginalError);
    return(ReturnValue);

} // WSAPreApiNotify()

Generated on Wed Nov 13 2024 16:54:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/Dt_Dll/Handlers.Cpp File Reference

  • NetDS
  • WinSock
  • Dt_Dll
Defines | Functions

Handlers.Cpp File Reference

#include "nowarn.h"
#include <windows.h>
#include <winsock2.h>
#include <ws2spi.h>
#include <stdio.h>
#include <stdlib.h>
#include "handlers.h"
#include "dt_dll.h"
#include "dt.h"

Go to the source code of this file.

Defines

#define | _WINSOCKAPI_

Functions

BOOL CALLBACK | DTHandler___WSAFDIsSet (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_accept (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_bind (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_closesocket (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_connect (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_gethostbyaddr (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_gethostbyname (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_gethostname (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_getpeername (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_getprotobyname (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_getprotobynumber (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_getservbyname (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_getservbyport (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_getsockname (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_getsockopt (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_htonl (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_htons (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_inet_addr (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_inet_ntoa (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_ioctlsocket (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_listen (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_NSPAddressToString (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_NSPGetAddressByName (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_NSPGetServiceClassInfo (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_NSPGetServiceClassNameByClassId (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_NSPInstallServiceClass (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_NSPLookupServiceBegin (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_NSPLookupServiceEnd (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_NSPLookupServiceNext (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_NSPRemoveServiceClass (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_NSPSetService (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_NSPStringToAddress (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_ntohl (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_ntohs (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_recv (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_recvfrom (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_select (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_send (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_sendto (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_setsockopt (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_shutdown (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_socket (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WPUCloseEvent (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WPUCloseSocketHandle (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WPUCreateEvent (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WPUCreateSocketHandle (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WPUFDIsSet (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WPUGetProviderPath (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WPUModifyIFSHandle (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WPUPostMessage (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WPUQueryBlockingCallback (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WPUQuerySocketHandleContext (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WPUQueueApc (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WPUResetEvent (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WPUSetEvent (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAAccept (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAAddressToStringA (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAAddressToStringW (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAAsyncGetHostByAddr (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAAsyncGetHostByName (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAAsyncGetProtoByName (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAAsyncGetProtoByNumber (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAAsyncGetServByName (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAAsyncGetServByPort (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAAsyncSelect (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSACancelAsyncRequest (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSACancelBlockingCall (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSACleanup (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSACloseEvent (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAConnect (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSACreateEvent (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSADuplicateSocketA (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSADuplicateSocketW (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAEnumNameSpaceProvidersA (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAEnumNameSpaceProvidersW (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAEnumNetworkEvents (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAEnumProtocolsA (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAEnumProtocolsW (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAEventSelect (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAGetAddressByNameA (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAGetAddressByNameW (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAGetLastError (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAGetOverlappedResult (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAGetQOSByName (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAGetServiceClassInfoA (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAGetServiceClassInfoW (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAGetServiceClassNameByClassIdA (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAGetServiceClassNameByClassIdW (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAHtonl (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAHtons (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAInstallServiceClassA (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAInstallServiceClassW (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAIoctl (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAIsBlocking (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAJoinLeaf (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSALookupServiceBeginA (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSALookupServiceBeginW (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSALookupServiceEnd (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSALookupServiceNextA (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSALookupServiceNextW (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSANtohl (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSANtohs (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSARecv (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSARecvDisconnect (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSARecvFrom (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSARemoveServiceClass (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAResetEvent (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSASend (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSASendDisconnect (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSASendTo (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSASetBlockingHook (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSASetEvent (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSASetLastError (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSASetServiceA (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSASetServiceW (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSASocketA (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSASocketW (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAStartup (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAStringToAddressA (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAStringToAddressW (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAUnhookBlockingHook (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAWaitForMultipleEvents (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSCDeinstallProvider (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSCEnumProtocols (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSCInstallProvider (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPAccept (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPAsyncSelect (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPBind (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPCancelBlockingCall (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPCleanup (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPCloseSocket (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPConnect (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPDuplicateSocket (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPEnumNetworkEvents (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPEventSelect (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPGetOverlappedResult (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPGetPeerName (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPGetQOSByName (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPGetSockName (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPGetSockOpt (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPIoctl (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPJoinLeaf (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPListen (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPRecv (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPRecvDisconnect (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPRecvFrom (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPSelect (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPSend (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPSendDisconnect (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPSendTo (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPSetSockOpt (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPShutdown (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPSocket (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPStartup (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL | DTHandlerInit (OUT LPLPFNDTHANDLER HandlerFuncTable, int NumEntries)

Define Documentation

#define _WINSOCKAPI_

Definition at line 17 of file Handlers.Cpp.

Function Documentation

BOOL CALLBACK DTHandler___WSAFDIsSet | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3194 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    fd_set FAR **set = va_arg(vl, fd_set FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "__WSAFDIsSet() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_accept | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 329 of file Handlers.Cpp.

{
    SOCKET *RetVal = (SOCKET *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    struct sockaddr FAR **addr = va_arg(vl, struct sockaddr FAR **);
    int FAR **addrlen = va_arg(vl, int FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "accept() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_bind | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 352 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    struct sockaddr FAR **name = va_arg(vl, struct sockaddr FAR **);
    int *namelen = va_arg(vl, int *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "bind() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_closesocket | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 375 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "closesocket() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_connect | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 396 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    struct sockaddr FAR **name = va_arg(vl, struct sockaddr FAR **);
    int *namelen = va_arg(vl, int *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "connect() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_gethostbyaddr | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1710 of file Handlers.Cpp.

{
    struct hostent FAR **RetVal = (struct hostent FAR **)ReturnValue;
    char FAR **addr = va_arg(vl, char FAR **);
    int *len = va_arg(vl, int *);
    int *type = va_arg(vl, int *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "gethostbyaddr() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_gethostbyname | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1733 of file Handlers.Cpp.

{
    struct hostent FAR **RetVal = (struct hostent FAR **)ReturnValue;
    char FAR **name = va_arg(vl, char FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "gethostbyname() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_gethostname | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1754 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    char FAR **name = va_arg(vl, char FAR **);
    int *namelen = va_arg(vl, int *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "gethostname() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_getpeername | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 419 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    struct sockaddr FAR **name = va_arg(vl, struct sockaddr FAR **);
    int FAR **namelen = va_arg(vl, int FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "getpeername() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_getprotobyname | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1776 of file Handlers.Cpp.

{
    struct protoent FAR **RetVal = (struct protoent FAR **)ReturnValue;
    char FAR **name = va_arg(vl, char FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "getprotobyname() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_getprotobynumber | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1797 of file Handlers.Cpp.

{
    struct protoent FAR **RetVal = (struct protoent FAR **)ReturnValue;
    int *number = va_arg(vl, int *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "getprotobynumber() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_getservbyname | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1818 of file Handlers.Cpp.

{
    struct servent FAR **RetVal = (struct servent FAR **)ReturnValue;
    char FAR **name = va_arg(vl, char FAR **);
    char FAR **proto = va_arg(vl, char FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "getservbyname() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_getservbyport | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1840 of file Handlers.Cpp.

{
    struct servent FAR **RetVal = (struct servent FAR **)ReturnValue;
    int *port = va_arg(vl, int *);
    char FAR **proto = va_arg(vl, char FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "getservbyport() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_getsockname | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 442 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    struct sockaddr FAR **name = va_arg(vl, struct sockaddr FAR **);
    int FAR **namelen = va_arg(vl, int FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "getsockname() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_getsockopt | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 465 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    int *level = va_arg(vl, int *);
    int *optname = va_arg(vl, int *);
    char FAR **optval = va_arg(vl, char FAR **);
    int FAR **optlen = va_arg(vl, int FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "getsockopt() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_htonl | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 490 of file Handlers.Cpp.

{
    u_long *RetVal = (u_long *)ReturnValue;
    u_long *hostlong = va_arg(vl, u_long *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "htonl() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_htons | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 511 of file Handlers.Cpp.

{
    u_short *RetVal = (u_short *)ReturnValue;
    u_short *hostshort = va_arg(vl, u_short *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "htons() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_inet_addr | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1862 of file Handlers.Cpp.

{
    unsigned long *RetVal = (unsigned long *)ReturnValue;
    char FAR **cp = va_arg(vl, char FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "inet_addr() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_inet_ntoa | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1883 of file Handlers.Cpp.

{
    char FAR **RetVal = (char FAR **)ReturnValue;
    struct in_addr *in = va_arg(vl, struct in_addr *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "inet_ntoa() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_ioctlsocket | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 532 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    long *cmd = va_arg(vl, long *);
    u_long FAR **argp = va_arg(vl, u_long FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "ioctlsocket() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_listen | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 555 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    int *backlog = va_arg(vl, int *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "listen() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_NSPAddressToString | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3757 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPSOCKADDR *lpsaAddress = va_arg(vl, LPSOCKADDR *);
    DWORD *dwAddressLength= va_arg(vl, DWORD *);
    LPWSAPROTOCOL_INFOW *lpProtocolInfo= va_arg(vl, LPWSAPROTOCOL_INFOW *);
    LPWSTR *lpszAddressString= va_arg(vl, LPWSTR *);
    LPDWORD *lpdwAddressStringLength= va_arg(vl, LPDWORD *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "NSPAddressToString() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_NSPGetAddressByName | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3881 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPWSTR *lpszServiceInstanceName = va_arg(vl, LPWSTR*);
    LPGUID *lpServiceClassId = va_arg(vl, LPGUID*);
    DWORD *dwNameSpace = va_arg(vl, DWORD*);
    LPDWORD *lpdwBufferLength = va_arg(vl, LPDWORD*);
    LPWSAQUERYSETW *lpqsResults = va_arg(vl, LPWSAQUERYSETW*);
    DWORD *dwResolution = va_arg(vl, DWORD*);
    LPWSTR *lpszAliasBuffer = va_arg(vl, LPWSTR*);
    LPDWORD *lpdwAliasBufferLength  = va_arg(vl, LPDWORD*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "NSPGetAddressByName() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_NSPGetServiceClassInfo | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3979 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPGUID *lpProviderId = va_arg(vl, LPGUID*);
    LPGUID *lpServiceClassId = va_arg(vl, LPGUID*);
    LPDWORD *lpdwBufSize = va_arg(vl, LPDWORD*);
    LPWSASERVICECLASSINFOW *lpServiceClassInfo =
        va_arg(vl, LPWSASERVICECLASSINFOW*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "NSPGetServiceClassInfo() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_NSPGetServiceClassNameByClassId | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 4004 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPGUID *lpServiceClassId = va_arg(vl, LPGUID*);
    LPWSTR *lpszServiceClassName = va_arg(vl, LPWSTR*);
    LPDWORD *lpdwBufferLength = va_arg(vl, LPDWORD*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "NSPGetServiceClassNameByClassId() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_NSPInstallServiceClass | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3910 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPWSASERVICECLASSINFOW *lpServiceClassInfo =
        va_arg(vl, LPWSASERVICECLASSINFOW*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "NSPInstallServiceClass() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_NSPLookupServiceBegin | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3809 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPWSAQUERYSETW *lpqsRestrictions = va_arg(vl, LPWSAQUERYSETW*);
    DWORD *dwControlFlags = va_arg(vl, DWORD*);
    LPHANDLE *lphLookup  = va_arg(vl, LPHANDLE*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "NSPLookupServiceBegin() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_NSPLookupServiceEnd | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3859 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    HANDLE *hLookup = va_arg(vl, HANDLE*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "NSPLookupServiceEnd() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_NSPLookupServiceNext | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3833 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    HANDLE *hLookup = va_arg(vl, HANDLE*);
    DWORD *dwControlFlags = va_arg(vl, DWORD*);
    LPDWORD *lpdwBufferLength = va_arg(vl, LPDWORD*);
    LPWSAQUERYSETW *lpqsResults = va_arg(vl, LPWSAQUERYSETW*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "NSPLookupServiceNext() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_NSPRemoveServiceClass | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3957 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPGUID *lpServiceClassId = va_arg(vl, LPGUID*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "NSPRemoveServiceClass() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_NSPSetService | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3933 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPWSAQUERYSETW *lpqsRegInfo = va_arg(vl, LPWSAQUERYSETW*);
    WSAESETSERVICEOP *essOperation = va_arg(vl, WSAESETSERVICEOP*);
    DWORD *dwControlFlags = va_arg(vl, DWORD*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "NSPSetService() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_NSPStringToAddress | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3783 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPWSTR *AddressString = va_arg(vl, LPWSTR*);
    INT *AddressFamily = va_arg(vl, INT *);
    LPWSAPROTOCOL_INFOW *lpProtocolInfo = va_arg(vl, LPWSAPROTOCOL_INFOW*);
    LPSOCKADDR *lpAddress = va_arg(vl, LPSOCKADDR*);
    LPINT *lpAddressLength = va_arg(vl, LPINT*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "NSPStringToAddress() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_ntohl | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 577 of file Handlers.Cpp.

{
    u_long *RetVal = (u_long *)ReturnValue;
    u_long *netlong = va_arg(vl, u_long *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "ntohl() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_ntohs | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 598 of file Handlers.Cpp.

{
    u_short *RetVal = (u_short *)ReturnValue;
    u_short *netshort = va_arg(vl, u_short *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "ntohs() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_recv | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 619 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    char FAR **buf = va_arg(vl, char FAR **);
    int *len = va_arg(vl, int *);
    int *flags = va_arg(vl, int *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "recv() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_recvfrom | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 643 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    char FAR **buf = va_arg(vl, char FAR **);
    int *len = va_arg(vl, int *);
    int *flags = va_arg(vl, int *);
    struct sockaddr FAR **from = va_arg(vl, struct sockaddr FAR **);
    int FAR **fromlen = va_arg(vl, int FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "recvfrom() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_select | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 669 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    int *nfds = va_arg(vl, int *);
    fd_set FAR **readfds = va_arg(vl, fd_set FAR **);
    fd_set FAR **writefds = va_arg(vl, fd_set FAR **);
    fd_set FAR **exceptfds = va_arg(vl, fd_set FAR **);
    struct timeval FAR **timeout = va_arg(vl, struct timeval FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "select() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_send | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 694 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    char FAR **buf = va_arg(vl, char FAR **);
    int *len = va_arg(vl, int *);
    int *flags = va_arg(vl, int *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "send() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_sendto | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 718 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    char FAR **buf = va_arg(vl, char FAR **);
    int *len = va_arg(vl, int *);
    int *flags = va_arg(vl, int *);
    struct sockaddr FAR **to = va_arg(vl, struct sockaddr FAR **);
    int *tolen = va_arg(vl, int *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "sendto() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_setsockopt | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 744 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    int *level = va_arg(vl, int *);
    int *optname = va_arg(vl, int *);
    char FAR **optval = va_arg(vl, char FAR **);
    int *optlen = va_arg(vl, int *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "setsockopt() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_shutdown | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 769 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    int *how = va_arg(vl, int *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "shutdown() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_socket | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 791 of file Handlers.Cpp.

{
    SOCKET *RetVal = (SOCKET *)ReturnValue;
    int *af = va_arg(vl, int *);
    int *type = va_arg(vl, int *);
    int *protocol = va_arg(vl, int *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "socket() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WPUCloseEvent | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2824 of file Handlers.Cpp.

{
    BOOL *RetVal = (BOOL *)ReturnValue;
    WSAEVENT *hEvent = va_arg(vl, WSAEVENT *);
    LPINT *lpErrno = va_arg(vl, LPINT *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WPUCloseEvent() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WPUCloseSocketHandle | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2846 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    LPINT *lpErrno = va_arg(vl, LPINT *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WPUCloseSocketHandle() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WPUCreateEvent | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2868 of file Handlers.Cpp.

{
    WSAEVENT *RetVal = (WSAEVENT *)ReturnValue;
    LPINT *lpErrno = va_arg(vl, LPINT *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WPUCreateEvent() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WPUCreateSocketHandle | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2889 of file Handlers.Cpp.

{
    SOCKET *RetVal = (SOCKET *)ReturnValue;
    DWORD *dwCatalogEntryId = va_arg(vl, DWORD *);
    DWORD *dwContext = va_arg(vl, DWORD *);
    LPINT *lpErrno = va_arg(vl, LPINT *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WPUCreateSocketHandle() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WPUFDIsSet | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3100 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    fd_set FAR **set = va_arg(vl, fd_set FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WPUFDIsSet() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WPUGetProviderPath | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3122 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    DWORD *dwProviderId = va_arg(vl, DWORD *);
    char FAR **lpszProviderDllPath = va_arg(vl, char FAR **);
    LPINT *lpProviderDllPathLen = va_arg(vl, LPINT *);
    LPINT *lpErrno = va_arg(vl, LPINT *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WPUGetProviderPath() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WPUModifyIFSHandle | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2960 of file Handlers.Cpp.

{
    SOCKET *RetVal = (SOCKET *)ReturnValue;
    DWORD *dwCatalogEntryId = va_arg(vl, DWORD *);
    SOCKET *ProposedHandle = va_arg(vl, SOCKET *);
    LPINT *lpErrno = va_arg(vl, LPINT *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WPUModifyIFSHandle() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WPUPostMessage | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3146 of file Handlers.Cpp.

{
    BOOL *RetVal = (BOOL *)ReturnValue;
    HWND *hWnd = va_arg(vl, HWND *);
    UINT *Msg = va_arg(vl, UINT *);
    WPARAM *wParam = va_arg(vl, WPARAM *);
    LPARAM *lParam = va_arg(vl, LPARAM *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WPUPostMessage() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WPUQueryBlockingCallback | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2983 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    DWORD *dwCatalogEntryId = va_arg(vl, DWORD *);
    LPBLOCKINGCALLBACK FAR **lplpfnCallback =
      va_arg(vl, LPBLOCKINGCALLBACK FAR **);
    LPDWORD *lpdwContext = va_arg(vl, LPDWORD *);
    LPINT *lpErrno = va_arg(vl, LPINT *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WPUQueryBlockingCallback() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WPUQuerySocketHandleContext | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3008 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    LPDWORD *lpContext = va_arg(vl, LPDWORD *);
    LPINT *lpErrno = va_arg(vl, LPINT *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WPUQuerySocketHandleContext() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WPUQueueApc | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3031 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPWSATHREADID *lpThreadId = va_arg(vl, LPWSATHREADID *);
    LPWSAUSERAPC *lpfnUserApc = va_arg(vl, LPWSAUSERAPC *);
    DWORD *dwContext = va_arg(vl, DWORD *);
    LPINT *lpErrno = va_arg(vl, LPINT *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WPUQueueApc() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WPUResetEvent | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3055 of file Handlers.Cpp.

{
    BOOL *RetVal = (BOOL *)ReturnValue;
    WSAEVENT *hEvent = va_arg(vl, WSAEVENT *);
    LPINT *lpErrno = va_arg(vl, LPINT *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WPUResetEvent() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WPUSetEvent | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3077 of file Handlers.Cpp.

{
    BOOL *RetVal = (BOOL *)ReturnValue;
    WSAEVENT *hEvent = va_arg(vl, WSAEVENT *);
    LPINT *lpErrno = va_arg(vl, LPINT *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WPUSetEvent() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAAccept | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 814 of file Handlers.Cpp.

{
    SOCKET *RetVal = (SOCKET *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    struct sockaddr FAR **addr = va_arg(vl, struct sockaddr FAR **);
    LPINT *addrlen = va_arg(vl, LPINT *);
    LPCONDITIONPROC *lpfnCondition = va_arg(vl, LPCONDITIONPROC *);
    DWORD *dwCallbackData = va_arg(vl, DWORD *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAAccept() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAAddressToStringA | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3216 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPSOCKADDR *lpsaAddress = va_arg(vl, LPSOCKADDR *);
    DWORD *dwAddressLength= va_arg(vl, DWORD *);
    LPWSAPROTOCOL_INFOA *lpProtocolInfo= va_arg(vl, LPWSAPROTOCOL_INFOA *);
    LPSTR *lpszAddressString= va_arg(vl, LPSTR *);
    LPDWORD *lpdwAddressStringLength= va_arg(vl, LPDWORD *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAAddressToStringA() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAAddressToStringW | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3242 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPSOCKADDR *lpsaAddress = va_arg(vl, LPSOCKADDR *);
    DWORD *dwAddressLength= va_arg(vl, DWORD *);
    LPWSAPROTOCOL_INFOW *lpProtocolInfo= va_arg(vl, LPWSAPROTOCOL_INFOW *);
    LPWSTR *lpszAddressString= va_arg(vl, LPWSTR *);
    LPDWORD *lpdwAddressStringLength= va_arg(vl, LPDWORD *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAAddressToStringW() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAAsyncGetHostByAddr | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1904 of file Handlers.Cpp.

{
    HANDLE *RetVal = (HANDLE *)ReturnValue;
    HWND *hWnd = va_arg(vl, HWND *);
    u_int *wMsg = va_arg(vl, u_int *);
    char FAR **addr = va_arg(vl, char FAR **);
    int *len = va_arg(vl, int *);
    int *type = va_arg(vl, int *);
    char FAR **buf = va_arg(vl, char FAR **);
    int *buflen = va_arg(vl, int *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAAsyncGetHostByAddr() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAAsyncGetHostByName | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1931 of file Handlers.Cpp.

{
    HANDLE *RetVal = (HANDLE *)ReturnValue;
    HWND *hWnd = va_arg(vl, HWND *);
    u_int *wMsg = va_arg(vl, u_int *);
    char FAR **name = va_arg(vl, char FAR **);
    char FAR **buf = va_arg(vl, char FAR **);
    int *buflen = va_arg(vl, int *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAAsyncGetHostByName() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAAsyncGetProtoByName | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1956 of file Handlers.Cpp.

{
    HANDLE *RetVal = (HANDLE *)ReturnValue;
    HWND *hWnd = va_arg(vl, HWND *);
    u_int *wMsg = va_arg(vl, u_int *);
    char FAR **name = va_arg(vl, char FAR **);
    char FAR **buf = va_arg(vl, char FAR **);
    int *buflen = va_arg(vl, int *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAAsyncGetProtoByName() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAAsyncGetProtoByNumber | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1981 of file Handlers.Cpp.

{
    HANDLE *RetVal = (HANDLE *)ReturnValue;
    HWND *hWnd = va_arg(vl, HWND *);
    u_int *wMsg = va_arg(vl, u_int *);
    int *number = va_arg(vl, int *);
    char FAR **buf = va_arg(vl, char FAR **);
    int *buflen = va_arg(vl, int *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAAsyncGetProtoByNumber() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAAsyncGetServByName | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2006 of file Handlers.Cpp.

{
    HANDLE *RetVal = (HANDLE *)ReturnValue;
    HWND *hWnd = va_arg(vl, HWND *);
    u_int *wMsg = va_arg(vl, u_int *);
    char FAR **name = va_arg(vl, char FAR **);
    char FAR **proto = va_arg(vl, char FAR **);
    char FAR **buf = va_arg(vl, char FAR **);
    int *buflen = va_arg(vl, int *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAAsyncGetServByName() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAAsyncGetServByPort | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2032 of file Handlers.Cpp.

{
    HANDLE *RetVal = (HANDLE *)ReturnValue;
    HWND *hWnd = va_arg(vl, HWND *);
    u_int *wMsg = va_arg(vl, u_int *);
    int *port = va_arg(vl, int *);
    char FAR **proto = va_arg(vl, char FAR **);
    char FAR **buf = va_arg(vl, char FAR **);
    int *buflen = va_arg(vl, int *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAAsyncGetServByPort() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAAsyncSelect | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 839 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    HWND *hWnd = va_arg(vl, HWND *);
    u_int *wMsg = va_arg(vl, u_int *);
    long *lEvent = va_arg(vl, long *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAAsyncSelect() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSACancelAsyncRequest | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2058 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    HANDLE *hAsyncTaskHandle = va_arg(vl, HANDLE *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSACancelAsyncRequest() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSACancelBlockingCall | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 863 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSACancelBlockingCall() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSACleanup | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 883 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSACleanup() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSACloseEvent | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 903 of file Handlers.Cpp.

{
    BOOL *RetVal = (BOOL *)ReturnValue;
    WSAEVENT *hEvent = va_arg(vl, WSAEVENT *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSACloseEvent() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAConnect | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 924 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    struct sockaddr FAR **name = va_arg(vl, struct sockaddr FAR **);
    int *namelen = va_arg(vl, int *);
    LPWSABUF *lpCallerData = va_arg(vl, LPWSABUF *);
    LPWSABUF *lpCalleeData = va_arg(vl, LPWSABUF *);
    LPQOS *lpSQOS = va_arg(vl, LPQOS *);
    LPQOS *lpGQOS = va_arg(vl, LPQOS *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAConnect() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSACreateEvent | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 951 of file Handlers.Cpp.

{
    WSAEVENT *RetVal = (WSAEVENT *)ReturnValue;

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSACreateEvent() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSADuplicateSocketA | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 971 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    DWORD *dwProcessId = va_arg(vl, DWORD *);
    LPWSAPROTOCOL_INFOA *lpProtocolInfo = va_arg(vl, LPWSAPROTOCOL_INFOA *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSADuplicateSocketA() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSADuplicateSocketW | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 994 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    DWORD *dwProcessId = va_arg(vl, DWORD *);
    LPWSAPROTOCOL_INFOW *lpProtocolInfo = va_arg(vl, LPWSAPROTOCOL_INFOW *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSADuplicateSocketW() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAEnumNameSpaceProvidersA | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3666 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPDWORD *lpdwBufferLength = va_arg(vl, LPDWORD*);
    LPWSANAMESPACE_INFOA *Lpnspbuffer = va_arg(vl,  LPWSANAMESPACE_INFOA*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAEnumNameSpaceProvidersA() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAEnumNameSpaceProvidersW | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3688 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPDWORD *lpdwBufferLength = va_arg(vl, LPDWORD*);
    LPWSANAMESPACE_INFOW *Lpnspbuffer = va_arg(vl,  LPWSANAMESPACE_INFOW*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAEnumNameSpaceProvidersW() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAEnumNetworkEvents | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1017 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    WSAEVENT *hEventObject = va_arg(vl, WSAEVENT *);
    LPWSANETWORKEVENTS *lpNetworkEvents = va_arg(vl, LPWSANETWORKEVENTS *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAEnumNetworkEvents() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAEnumProtocolsA | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1040 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPINT *lpiProtocols = va_arg(vl, LPINT *);
    LPWSAPROTOCOL_INFOA *lpProtocolBuffer = va_arg(vl, LPWSAPROTOCOL_INFOA *);
    LPDWORD *lpdwBufferLength = va_arg(vl, LPDWORD *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAEnumProtocolsA() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAEnumProtocolsW | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1063 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPINT *lpiProtocols = va_arg(vl, LPINT *);
    LPWSAPROTOCOL_INFOW *lpProtocolBuffer = va_arg(vl, LPWSAPROTOCOL_INFOW *);
    LPDWORD *lpdwBufferLength = va_arg(vl, LPDWORD *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAEnumProtocolsW() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAEventSelect | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1086 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    WSAEVENT *hEventObject = va_arg(vl, WSAEVENT *);
    long *lNetworkEvents = va_arg(vl, long *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAEventSelect() %s.\r\n",
         PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAGetAddressByNameA | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3439 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPSTR *lpszServiceInstanceName = va_arg(vl, LPSTR*);
    LPGUID *lpServiceClassId = va_arg(vl, LPGUID*);
    DWORD *dwNameSpace = va_arg(vl, DWORD*);
    LPDWORD *lpdwBufferLength = va_arg(vl, LPDWORD*);
    LPWSAQUERYSETA *lpqsResults = va_arg(vl, LPWSAQUERYSETA*);
    DWORD *dwResolution = va_arg(vl, DWORD*);
    LPSTR *lpszAliasBuffer = va_arg(vl, LPSTR*);
    LPDWORD *lpdwAliasBufferLength  = va_arg(vl, LPDWORD*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAGetAddressByNameA() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAGetAddressByNameW | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3467 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPWSTR *lpszServiceInstanceName = va_arg(vl, LPWSTR*);
    LPGUID *lpServiceClassId = va_arg(vl, LPGUID*);
    DWORD *dwNameSpace = va_arg(vl, DWORD*);
    LPDWORD *lpdwBufferLength = va_arg(vl, LPDWORD*);
    LPWSAQUERYSETW *lpqsResults = va_arg(vl, LPWSAQUERYSETW*);
    DWORD *dwResolution = va_arg(vl, DWORD*);
    LPWSTR *lpszAliasBuffer = va_arg(vl, LPWSTR*);
    LPDWORD *lpdwAliasBufferLength  = va_arg(vl, LPDWORD*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAGetAddressByNameW() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAGetLastError | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1109 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAGetLastError() %s.\r\n",
         PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAGetOverlappedResult | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1129 of file Handlers.Cpp.

{
    BOOL *RetVal = (BOOL *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    LPWSAOVERLAPPED *lpOverlapped = va_arg(vl, LPWSAOVERLAPPED *);
    LPDWORD *lpcbTransfer = va_arg(vl, LPDWORD *);
    BOOL *fWait = va_arg(vl, BOOL *);
    LPDWORD *lpdwFlags = va_arg(vl, LPDWORD *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAGetOverlappedResult() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAGetQOSByName | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1154 of file Handlers.Cpp.

{
    BOOL *RetVal = (BOOL *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    LPWSABUF *lpQOSName = va_arg(vl, LPWSABUF *);
    LPQOS *lpQOS = va_arg(vl, LPQOS *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAGetQOSByName() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAGetServiceClassInfoA | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3613 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPGUID *lpProviderId = va_arg(vl, LPGUID*);
    LPGUID *lpServiceClassId = va_arg(vl, LPGUID*);
    LPDWORD *lpdwBufSize = va_arg(vl, LPDWORD*);
    LPWSASERVICECLASSINFOA *lpServiceClassInfo =
        va_arg(vl, LPWSASERVICECLASSINFOA*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAGetServiceClassInfoA() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAGetServiceClassInfoW | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3639 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPGUID *lpProviderId = va_arg(vl, LPGUID*);
    LPGUID *lpServiceClassId = va_arg(vl, LPGUID*);
    LPDWORD *lpdwBufSize = va_arg(vl, LPDWORD*);
    LPWSASERVICECLASSINFOW *lpServiceClassInfo =
        va_arg(vl, LPWSASERVICECLASSINFOW*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAGetServiceClassInfoW() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAGetServiceClassNameByClassIdA | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3712 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPGUID *lpServiceClassId = va_arg(vl, LPGUID*);
    LPSTR *lpszServiceClassName = va_arg(vl, LPSTR*);
    LPDWORD *lpdwBufferLength = va_arg(vl, LPDWORD*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAGetServiceClassNameByClassIdA() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAGetServiceClassNameByClassIdW | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3735 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPGUID *lpServiceClassId = va_arg(vl, LPGUID*);
    LPWSTR *lpszServiceClassName = va_arg(vl, LPWSTR*);
    LPDWORD *lpdwBufferLength = va_arg(vl, LPDWORD*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAGetServiceClassNameByClassIdW() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAHtonl | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1177 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    u_long *hostlong = va_arg(vl, u_long *);
    u_long FAR **lpnetlong = va_arg(vl, u_long FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAHtonl() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAHtons | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1200 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    u_short *hostshort = va_arg(vl, u_short *);
    u_short FAR **lpnetshort = va_arg(vl, u_short FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAHtons() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAInstallServiceClassA | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3497 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPWSASERVICECLASSINFOA *lpServiceClassInfo =
        va_arg(vl, LPWSASERVICECLASSINFOA*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAInstallServiceClassA() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAInstallServiceClassW | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3519 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPWSASERVICECLASSINFOW *lpServiceClassInfo =
        va_arg(vl, LPWSASERVICECLASSINFOW*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAInstallServiceClassW() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAIoctl | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1223 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    DWORD *dwIoControlCode = va_arg(vl, DWORD *);
    LPVOID *lpvInBuffer = va_arg(vl, LPVOID *);
    DWORD *cbInBuffer = va_arg(vl, DWORD *);
    LPVOID *lpvOutBuffer = va_arg(vl, LPVOID *);
    DWORD *cbOutBuffer = va_arg(vl, DWORD *);
    LPDWORD *lpcbBytesReturned = va_arg(vl, LPDWORD *);
    LPWSAOVERLAPPED *lpOverlapped = va_arg(vl, LPWSAOVERLAPPED *);
    LPWSAOVERLAPPED_COMPLETION_ROUTINE *lpCompletionRoutine =
      va_arg(vl, LPWSAOVERLAPPED_COMPLETION_ROUTINE *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAIoctl() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAIsBlocking | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1253 of file Handlers.Cpp.

{
    BOOL *RetVal = (BOOL *)ReturnValue;

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAIsBlocking() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAJoinLeaf | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1273 of file Handlers.Cpp.

{
    SOCKET *RetVal = (SOCKET *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    struct sockaddr FAR **name = va_arg(vl, struct sockaddr FAR **);
    int *namelen = va_arg(vl, int *);
    LPWSABUF *lpCallerData = va_arg(vl, LPWSABUF *);
    LPWSABUF *lpCalleeData = va_arg(vl, LPWSABUF *);
    LPQOS *lpSQOS = va_arg(vl, LPQOS *);
    LPQOS *lpGQOS = va_arg(vl, LPQOS *);
    DWORD *dwFlags = va_arg(vl, DWORD *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAJoinLeaf() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSALookupServiceBeginA | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3319 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPWSAQUERYSETA *lpqsRestrictions = va_arg(vl, LPWSAQUERYSETA*);
    DWORD *dwControlFlags = va_arg(vl, DWORD*);
    LPHANDLE *lphLookup  = va_arg(vl, LPHANDLE*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSALookupServiceBeginA() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSALookupServiceBeginW | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3342 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPWSAQUERYSETW *lpqsRestrictions = va_arg(vl, LPWSAQUERYSETW*);
    DWORD *dwControlFlags = va_arg(vl, DWORD*);
    LPHANDLE *lphLookup  = va_arg(vl, LPHANDLE*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSALookupServiceBeginW() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSALookupServiceEnd | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3416 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    HANDLE *hLookup = va_arg(vl, HANDLE*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSALookupServiceEnd() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSALookupServiceNextA | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3366 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    HANDLE *hLookup = va_arg(vl, HANDLE*);
    DWORD *dwControlFlags = va_arg(vl, DWORD*);
    LPDWORD *lpdwBufferLength = va_arg(vl, LPDWORD*);
    LPWSAQUERYSETA *lpqsResults = va_arg(vl, LPWSAQUERYSETA*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSALookupServiceNextA() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSALookupServiceNextW | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3390 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    HANDLE *hLookup = va_arg(vl, HANDLE*);
    DWORD *dwControlFlags = va_arg(vl, DWORD*);
    LPDWORD *lpdwBufferLength = va_arg(vl, LPDWORD*);
    LPWSAQUERYSETW *lpqsResults = va_arg(vl, LPWSAQUERYSETW*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSALookupServiceNextW() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSANtohl | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1301 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    u_long *netlong = va_arg(vl, u_long *);
    u_long FAR **lphostlong = va_arg(vl, u_long FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSANtohl() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSANtohs | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1324 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    u_short *netshort = va_arg(vl, u_short *);
    u_short FAR **lphostshort = va_arg(vl, u_short FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSANtohs() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSARecv | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1347 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    LPWSABUF *lpBuffers = va_arg(vl, LPWSABUF *);
    DWORD *dwBufferCount = va_arg(vl, DWORD *);
    LPDWORD *lpNumberOfBytesRecvd = va_arg(vl, LPDWORD *);
    LPDWORD *lpFlags = va_arg(vl, LPDWORD *);
    LPWSAOVERLAPPED *lpOverlapped = va_arg(vl, LPWSAOVERLAPPED *);
    LPWSAOVERLAPPED_COMPLETION_ROUTINE *lpCompletionRoutine =
      va_arg(vl, LPWSAOVERLAPPED_COMPLETION_ROUTINE *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSARecv() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSARecvDisconnect | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1375 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    LPWSABUF *lpInboundDisconnectData = va_arg(vl, LPWSABUF *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSARecvDisconnect() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSARecvFrom | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1397 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    LPWSABUF *lpBuffers = va_arg(vl, LPWSABUF *);
    DWORD *dwBufferCount = va_arg(vl, DWORD *);
    LPDWORD *lpNumberOfBytesRecvd = va_arg(vl, LPDWORD *);
    LPDWORD *lpFlags = va_arg(vl, LPDWORD *);
    struct sockaddr FAR **lpFrom = va_arg(vl, struct sockaddr FAR **);
    LPINT *lpFromlen = va_arg(vl, LPINT *);
    LPWSAOVERLAPPED *lpOverlapped = va_arg(vl, LPWSAOVERLAPPED *);
    LPWSAOVERLAPPED_COMPLETION_ROUTINE *lpCompletionRoutine =
      va_arg(vl, LPWSAOVERLAPPED_COMPLETION_ROUTINE *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSARecvFrom() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSARemoveServiceClass | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3590 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPGUID *lpServiceClassId = va_arg(vl, LPGUID*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSARemoveServiceClass() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAResetEvent | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1427 of file Handlers.Cpp.

{
    BOOL *RetVal = (BOOL *)ReturnValue;
    WSAEVENT *hEvent = va_arg(vl, WSAEVENT *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAResetEvent() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSASend | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1448 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    LPWSABUF *lpBuffers = va_arg(vl, LPWSABUF *);
    DWORD *dwBufferCount = va_arg(vl, DWORD *);
    LPDWORD *lpNumberOfBytesSent = va_arg(vl, LPDWORD *);
    DWORD *dwFlags = va_arg(vl, DWORD *);
    LPWSAOVERLAPPED *lpOverlapped = va_arg(vl, LPWSAOVERLAPPED *);
    LPWSAOVERLAPPED_COMPLETION_ROUTINE *lpCompletionRoutine =
      va_arg(vl, LPWSAOVERLAPPED_COMPLETION_ROUTINE *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSASend() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSASendDisconnect | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1476 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    LPWSABUF *lpOutboundDisconnectData = va_arg(vl, LPWSABUF *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSASendDisconnect() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSASendTo | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1498 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    LPWSABUF *lpBuffers = va_arg(vl, LPWSABUF *);
    DWORD *dwBufferCount = va_arg(vl, DWORD *);
    LPDWORD *lpNumberOfBytesSent = va_arg(vl, LPDWORD *);
    DWORD *dwFlags = va_arg(vl, DWORD *);
    struct sockaddr FAR **lpTo = va_arg(vl, struct sockaddr FAR **);
    int *iTolen = va_arg(vl, int *);
    LPWSAOVERLAPPED *lpOverlapped = va_arg(vl, LPWSAOVERLAPPED *);
    LPWSAOVERLAPPED_COMPLETION_ROUTINE *lpCompletionRoutine =
      va_arg(vl, LPWSAOVERLAPPED_COMPLETION_ROUTINE *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSASendTo() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSASetBlockingHook | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1528 of file Handlers.Cpp.

{
    FARPROC *RetVal = (FARPROC *)ReturnValue;
    FARPROC *lpBlockFunc = va_arg(vl, FARPROC *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSASetBlockingHook() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSASetEvent | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1549 of file Handlers.Cpp.

{
    BOOL *RetVal = (BOOL *)ReturnValue;
    WSAEVENT *hEvent = va_arg(vl, WSAEVENT *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSASetEvent() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSASetLastError | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1570 of file Handlers.Cpp.

{
    // WSASetLastError returns void, so ReturnValue should be NULL
    int *iError = va_arg(vl, int *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSASetLastError() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSASetServiceA | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3542 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPWSAQUERYSETA *lpqsRegInfo = va_arg(vl, LPWSAQUERYSETA*);
    WSAESETSERVICEOP *essOperation = va_arg(vl, WSAESETSERVICEOP*);
    DWORD *dwControlFlags = va_arg(vl, DWORD*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSASetServiceA() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSASetServiceW | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3566 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPWSAQUERYSETW *lpqsRegInfo = va_arg(vl, LPWSAQUERYSETW*);
    WSAESETSERVICEOP *essOperation = va_arg(vl, WSAESETSERVICEOP*);
    DWORD *dwControlFlags = va_arg(vl, DWORD*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSASetServiceW() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSASocketA | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1591 of file Handlers.Cpp.

{
    SOCKET *RetVal = (SOCKET *)ReturnValue;
    int *af = va_arg(vl, int *);
    int *type = va_arg(vl, int *);
    int *protocol = va_arg(vl, int *);
    LPWSAPROTOCOL_INFOA *lpProtocolInfo = va_arg(vl, LPWSAPROTOCOL_INFOA *);
    GROUP *g = va_arg(vl, GROUP *);
    DWORD *dwFlags = va_arg(vl, DWORD *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSASocketA() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSASocketW | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1617 of file Handlers.Cpp.

{
    SOCKET *RetVal = (SOCKET *)ReturnValue;
    int *af = va_arg(vl, int *);
    int *type = va_arg(vl, int *);
    int *protocol = va_arg(vl, int *);
    LPWSAPROTOCOL_INFOW *lpProtocolInfo = va_arg(vl, LPWSAPROTOCOL_INFOW *);
    GROUP *g = va_arg(vl, GROUP *);
    DWORD *dwFlags = va_arg(vl, DWORD *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSASocketW() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAStartup | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1643 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    WORD *wVersionRequested = va_arg(vl, WORD *);
    LPWSADATA *lpWSAData = va_arg(vl, LPWSADATA *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAStartup() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAStringToAddressA | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3268 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPSTR *AddressString = va_arg(vl, LPSTR*);
    INT *AddressFamily = va_arg(vl, INT *);
    LPWSAPROTOCOL_INFOA *lpProtocolInfo = va_arg(vl, LPWSAPROTOCOL_INFOA*);
    LPSOCKADDR *lpAddress = va_arg(vl, LPSOCKADDR*);
    LPINT *lpAddressLength = va_arg(vl, LPINT*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAStringToAddressA() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAStringToAddressW | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3293 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPWSTR *AddressString = va_arg(vl, LPWSTR*);
    INT *AddressFamily = va_arg(vl, INT *);
    LPWSAPROTOCOL_INFOW *lpProtocolInfo = va_arg(vl, LPWSAPROTOCOL_INFOW*);
    LPSOCKADDR *lpAddress = va_arg(vl, LPSOCKADDR*);
    LPINT *lpAddressLength = va_arg(vl, LPINT*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAStringToAddressW() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAUnhookBlockingHook | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1665 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAUnhookBlockingHook() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAWaitForMultipleEvents | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1685 of file Handlers.Cpp.

{
    DWORD *RetVal = (DWORD *)ReturnValue;
    DWORD *cEvents = va_arg(vl, DWORD *);
    WSAEVENT FAR **lphEvents = va_arg(vl, WSAEVENT FAR **);
    BOOL *fWaitAll = va_arg(vl, BOOL *);
    DWORD *dwTimeout = va_arg(vl, DWORD *);
    BOOL *fAlertable = va_arg(vl, BOOL *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAWaitForMultipleEvents() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSCDeinstallProvider | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2912 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    DWORD *dwProviderId = va_arg(vl, DWORD *);
    LPINT *lpErrno = va_arg(vl, LPINT *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSCDeinstallProvider() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSCEnumProtocols | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3170 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPINT *lpiProtocols = va_arg(vl, LPINT *);
    LPWSAPROTOCOL_INFO *lpProtocolBuffer = va_arg(vl, LPWSAPROTOCOL_INFO *);
    LPDWORD *lpdwBufferLength = va_arg(vl, LPDWORD *);
    LPINT *lpErrno = va_arg(vl, LPINT *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSCEnumProtocols() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSCInstallProvider | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2934 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    char FAR **lpszProviderName = va_arg(vl, char FAR **);
    char FAR **lpszProviderDllPath = va_arg(vl, char FAR **);
    LPWSAPROTOCOL_INFO *lpProtocolInfoList = va_arg(vl, LPWSAPROTOCOL_INFO *);
    DWORD *dwNumberOfEntries = va_arg(vl, DWORD *);
    LPDWORD *lpdwProviderId = va_arg(vl, LPDWORD *);
    LPINT *lpErrno = va_arg(vl, LPINT *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSCInstallProvider() %s.\r\n",
         PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPAccept | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2079 of file Handlers.Cpp.

{
    SOCKET *RetVal = (SOCKET *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    struct sockaddr FAR **addr = va_arg(vl, struct sockaddr FAR **);
    INT FAR **addrlen = va_arg(vl, INT FAR **);
    LPCONDITIONPROC *lpfnCondition = va_arg(vl, LPCONDITIONPROC *);
    DWORD *dwCallbackData = va_arg(vl, DWORD *);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPAccept() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPAsyncSelect | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2105 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    HWND *hWnd = va_arg(vl, HWND *);
    unsigned int *wMsg = va_arg(vl, unsigned int *);
    long *lEvent = va_arg(vl, long *);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPAsyncSelect() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPBind | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2130 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    struct sockaddr FAR **name = va_arg(vl, struct sockaddr FAR **);
    INT *namelen = va_arg(vl, INT *);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPBind() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPCancelBlockingCall | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2154 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPCancelBlockingCall() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPCleanup | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2175 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPCleanup() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPCloseSocket | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2196 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPCloseSocket() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPConnect | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2218 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    struct sockaddr FAR **name = va_arg(vl, struct sockaddr FAR **);
    INT *namelen = va_arg(vl, INT *);
    LPWSABUF *lpCallerData = va_arg(vl, LPWSABUF *);
    LPWSABUF *lpCalleeData = va_arg(vl, LPWSABUF *);
    LPQOS *lpSQOS = va_arg(vl, LPQOS *);
    LPQOS *lpGQOS = va_arg(vl, LPQOS *);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPConnect() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPDuplicateSocket | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2246 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    DWORD *dwProcessID = va_arg(vl, DWORD *);
    LPWSAPROTOCOL_INFO *lpProtocolInfo = va_arg(vl, LPWSAPROTOCOL_INFO *);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPDuplicateSocket() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPEnumNetworkEvents | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2270 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    WSAEVENT *hEventObject = va_arg(vl, WSAEVENT *);
    LPWSANETWORKEVENTS *lpNetworkEvents = va_arg(vl, LPWSANETWORKEVENTS *);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPEnumNetworkEvents() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPEventSelect | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2294 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    WSAEVENT *hEventObject = va_arg(vl, WSAEVENT *);
    long *lNetworkEvents = va_arg(vl, long *);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPEventSelect() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPGetOverlappedResult | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2318 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    LPWSAOVERLAPPED *lpOverlapped = va_arg(vl, LPWSAOVERLAPPED *);
    LPDWORD *lpcbTransfer = va_arg(vl, LPDWORD *);
    BOOL *fWait = va_arg(vl, BOOL *);
    LPDWORD *lpdwFlags = va_arg(vl, LPDWORD *);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPGetOverlappedResult() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPGetPeerName | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2344 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    struct sockaddr FAR **name = va_arg(vl, struct sockaddr FAR **);
    INT FAR **namelen = va_arg(vl, INT FAR **);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPGetPeerName() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPGetQOSByName | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2419 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    LPWSABUF *lpQOSName = va_arg(vl, LPWSABUF *);
    LPQOS *lpQOS = va_arg(vl, LPQOS *);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPGetQOSByName() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPGetSockName | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2369 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    struct sockaddr FAR **name = va_arg(vl, struct sockaddr FAR **);
    INT FAR **namelen = va_arg(vl, INT FAR **);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPGetSockName() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPGetSockOpt | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2393 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    INT *level = va_arg(vl, INT *);
    INT *optname = va_arg(vl, INT *);
    char FAR **optval = va_arg(vl, char FAR **);
    INT FAR **optlen = va_arg(vl, INT FAR **);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPGetSockOpt() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPIoctl | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2443 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    DWORD *dwIoControlCode = va_arg(vl, DWORD *);
    LPVOID *lpvInBuffer = va_arg(vl, LPVOID *);
    DWORD *cbInBuffer = va_arg(vl, DWORD *);
    LPVOID *lpvOutBuffer = va_arg(vl, LPVOID *);
    DWORD *cbOutBuffer = va_arg(vl, DWORD *);
    LPDWORD *lpcbBytesReturned = va_arg(vl, LPDWORD *);
    LPWSAOVERLAPPED *lpOverlapped = va_arg(vl, LPWSAOVERLAPPED *);
    LPWSAOVERLAPPED_COMPLETION_ROUTINE *lpCompletionRoutine =
      va_arg(vl, LPWSAOVERLAPPED_COMPLETION_ROUTINE *);
    LPWSATHREADID *lpThreadId = va_arg(vl, LPWSATHREADID *);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPIoctl() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPJoinLeaf | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2475 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    struct sockaddr FAR **name = va_arg(vl, struct sockaddr FAR **);
    INT *namelen = va_arg(vl, INT *);
    LPWSABUF *lpCallerData = va_arg(vl, LPWSABUF *);
    LPWSABUF *lpCalleeData = va_arg(vl, LPWSABUF *);
    LPQOS *lpSQOS = va_arg(vl, LPQOS *);
    LPQOS *lpGQOS = va_arg(vl, LPQOS *);
    DWORD *dwFlags = va_arg(vl, DWORD *);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPJoinLeaf() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPListen | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2504 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    INT *backlog = va_arg(vl, INT *);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPListen() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPRecv | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2527 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    LPWSABUF *lpBuffers = va_arg(vl, LPWSABUF *);
    DWORD *dwBufferCount = va_arg(vl, DWORD *);
    LPDWORD *lpNumberOfBytesRecvd = va_arg(vl, LPDWORD *);
    LPDWORD *lpFlags = va_arg(vl, LPDWORD *);
    LPWSAOVERLAPPED *lpOverlapped = va_arg(vl, LPWSAOVERLAPPED *);
    LPWSAOVERLAPPED_COMPLETION_ROUTINE *lpCompletionRoutine =
      va_arg(vl, LPWSAOVERLAPPED_COMPLETION_ROUTINE *);
    LPWSATHREADID *lpThreadId = va_arg(vl, LPWSATHREADID *);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPRecv() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPRecvDisconnect | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2557 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    LPWSABUF *lpInboundDisconnectData = va_arg(vl, LPWSABUF *);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPRecvDisconnect() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPRecvFrom | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2580 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    LPWSABUF *lpBuffers = va_arg(vl, LPWSABUF *);
    DWORD *dwBufferCount = va_arg(vl, DWORD *);
    LPDWORD *lpNumberOfBytesRecvd = va_arg(vl, LPDWORD *);
    LPDWORD *lpFlags = va_arg(vl, LPDWORD *);
    struct sockaddr FAR **lpFrom = va_arg(vl, struct sockaddr FAR **);
    LPINT *lpFromlen = va_arg(vl, LPINT *);
    LPWSAOVERLAPPED *lpOverlapped = va_arg(vl, LPWSAOVERLAPPED *);
    LPWSAOVERLAPPED_COMPLETION_ROUTINE *lpCompletionRoutine =
      va_arg(vl, LPWSAOVERLAPPED_COMPLETION_ROUTINE *);
    LPWSATHREADID *lpThreadId = va_arg(vl, LPWSATHREADID *);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPRecvFrom() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPSelect | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2612 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    INT *nfds = va_arg(vl, INT *);
    fd_set FAR **readfds = va_arg(vl, fd_set FAR **);
    fd_set FAR **writefds = va_arg(vl, fd_set FAR **);
    fd_set FAR **exceptfds = va_arg(vl, fd_set FAR **);
    struct timeval FAR **timeout = va_arg(vl, struct timeval FAR **);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPSelect() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPSend | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2638 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    LPWSABUF *lpBuffers = va_arg(vl, LPWSABUF *);
    DWORD *dwBufferCount = va_arg(vl, DWORD *);
    LPDWORD *lpNumberOfBytesSent = va_arg(vl, LPDWORD *);
    DWORD *dwFlags = va_arg(vl, DWORD *);
    LPWSAOVERLAPPED *lpOverlapped = va_arg(vl, LPWSAOVERLAPPED *);
    LPWSAOVERLAPPED_COMPLETION_ROUTINE *lpCompletionRoutine =
      va_arg(vl, LPWSAOVERLAPPED_COMPLETION_ROUTINE *);
    LPWSATHREADID *lpThreadId = va_arg(vl, LPWSATHREADID *);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPSend() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPSendDisconnect | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2668 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    LPWSABUF *lpOutboundDisconnectData = va_arg(vl, LPWSABUF *);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPSendDisconnect() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPSendTo | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2691 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    LPWSABUF *lpBuffers = va_arg(vl, LPWSABUF *);
    DWORD *dbBufferCount = va_arg(vl, DWORD *);
    LPDWORD *lpNumberOfBytesSent = va_arg(vl, LPDWORD *);
    DWORD *dwFlags = va_arg(vl, DWORD *);
    struct sockaddr FAR **lpTo = va_arg(vl, struct sockaddr FAR **);
    INT *iTolen = va_arg(vl, INT *);
    LPWSAOVERLAPPED *lpOverlapped = va_arg(vl, LPWSAOVERLAPPED *);
    LPWSAOVERLAPPED_COMPLETION_ROUTINE *lpCompletionRoutine =
      va_arg(vl, LPWSAOVERLAPPED_COMPLETION_ROUTINE *);
    LPWSATHREADID *lpThreadId = va_arg(vl, LPWSATHREADID *);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPSendTo() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPSetSockOpt | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2723 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    INT *level = va_arg(vl, INT *);
    INT *optname = va_arg(vl, INT *);
    char FAR **optval = va_arg(vl, char FAR **);
    INT *optlen = va_arg(vl, INT *);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPSetSockOpt() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPShutdown | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2749 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    INT *how = va_arg(vl, INT *);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPShutdown() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPSocket | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2772 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    int *af = va_arg(vl, int *);
    int *type = va_arg(vl, int *);
    int *protocol = va_arg(vl, int *);
    LPWSAPROTOCOL_INFO *lpProtocolInfo = va_arg(vl, LPWSAPROTOCOL_INFO *);
    GROUP *g = va_arg(vl, GROUP *);
    DWORD *dwFlags = va_arg(vl, DWORD *);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPSocket() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPStartup | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2799 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    WORD *wVersionRequested = va_arg(vl, WORD *);
    LPWSPDATA *lpWSPData = va_arg(vl, LPWSPDATA *);
    LPWSAPROTOCOL_INFOA *lpProtocolInfo = va_arg(vl, LPWSAPROTOCOL_INFOA *);
    WSPUPCALLTABLE *UpcallTable = va_arg(vl, WSPUPCALLTABLE *);
    LPWSPPROC_TABLE *lpProcTable = va_arg(vl, LPWSPPROC_TABLE *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPStartup() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL DTHandlerInit | ( | OUT LPLPFNDTHANDLER | HandlerFuncTable,
 |  | int | NumEntries
 | ) |  |

Definition at line 43 of file Handlers.Cpp.

                      :

      Fills in the given HandlerFuncTable with pointers to all the
      appropriate handler functions, based on notification code.

  Arguments:

      HandlerFuncTable -- an uninitialized array of pointers of type
      LPFNDTHANDLER, which point to handler functions (see handlers.h)

      NumEntries -- the number of entries in the array.  Currently
      only used to zero out the array.

  Return Value:

      Always returns TRUE.

--*/
{
    memset((char *)HandlerFuncTable, 0, NumEntries * sizeof(LPFNDTHANDLER));

    HandlerFuncTable[DTCODE_accept] = DTHandler_accept;
    HandlerFuncTable[DTCODE_bind] = DTHandler_bind;
    HandlerFuncTable[DTCODE_closesocket] = DTHandler_closesocket;
    HandlerFuncTable[DTCODE_connect] = DTHandler_connect;
    HandlerFuncTable[DTCODE_getpeername] = DTHandler_getpeername;
    HandlerFuncTable[DTCODE_getsockname] = DTHandler_getsockname;
    HandlerFuncTable[DTCODE_getsockopt] = DTHandler_getsockopt;
    HandlerFuncTable[DTCODE_htonl] = DTHandler_htonl;
    HandlerFuncTable[DTCODE_htons] = DTHandler_htons;
    HandlerFuncTable[DTCODE_ioctlsocket] = DTHandler_ioctlsocket;
    HandlerFuncTable[DTCODE_listen] = DTHandler_listen;
    HandlerFuncTable[DTCODE_ntohl] = DTHandler_ntohl;
    HandlerFuncTable[DTCODE_ntohs] = DTHandler_ntohs;
    HandlerFuncTable[DTCODE_recv] = DTHandler_recv;
    HandlerFuncTable[DTCODE_recvfrom] = DTHandler_recvfrom;
    HandlerFuncTable[DTCODE_select] = DTHandler_select;
    HandlerFuncTable[DTCODE_send] = DTHandler_send;
    HandlerFuncTable[DTCODE_sendto] = DTHandler_sendto;
    HandlerFuncTable[DTCODE_setsockopt] = DTHandler_setsockopt;
    HandlerFuncTable[DTCODE_shutdown] = DTHandler_shutdown;
    HandlerFuncTable[DTCODE_socket] = DTHandler_socket;
    HandlerFuncTable[DTCODE_WSAAccept] = DTHandler_WSAAccept;
    HandlerFuncTable[DTCODE_WSAAsyncSelect] = DTHandler_WSAAsyncSelect;
    HandlerFuncTable[DTCODE_WSACancelBlockingCall] =
      DTHandler_WSACancelBlockingCall;
    HandlerFuncTable[DTCODE_WSACleanup] = DTHandler_WSACleanup;
    HandlerFuncTable[DTCODE_WSACloseEvent] = DTHandler_WSACloseEvent;
    HandlerFuncTable[DTCODE_WSAConnect] = DTHandler_WSAConnect;
    HandlerFuncTable[DTCODE_WSACreateEvent] = DTHandler_WSACreateEvent;
    HandlerFuncTable[DTCODE_WSADuplicateSocketA] =
      DTHandler_WSADuplicateSocketA;
    HandlerFuncTable[DTCODE_WSADuplicateSocketW] =
      DTHandler_WSADuplicateSocketW;
    HandlerFuncTable[DTCODE_WSAEnumNetworkEvents] =
      DTHandler_WSAEnumNetworkEvents;
    HandlerFuncTable[DTCODE_WSAEnumProtocolsA] = DTHandler_WSAEnumProtocolsA;
    HandlerFuncTable[DTCODE_WSAEnumProtocolsW] = DTHandler_WSAEnumProtocolsW;
    HandlerFuncTable[DTCODE_WSAEventSelect] = DTHandler_WSAEventSelect;
    HandlerFuncTable[DTCODE_WSAGetLastError] = DTHandler_WSAGetLastError;
    HandlerFuncTable[DTCODE_WSAGetOverlappedResult] =
      DTHandler_WSAGetOverlappedResult;
    HandlerFuncTable[DTCODE_WSAGetQOSByName] = DTHandler_WSAGetQOSByName;
    HandlerFuncTable[DTCODE_WSAHtonl] = DTHandler_WSAHtonl;
    HandlerFuncTable[DTCODE_WSAHtons] = DTHandler_WSAHtons;
    HandlerFuncTable[DTCODE_WSAIoctl] = DTHandler_WSAIoctl;
    HandlerFuncTable[DTCODE_WSAIsBlocking] = DTHandler_WSAIsBlocking;
    HandlerFuncTable[DTCODE_WSAJoinLeaf] = DTHandler_WSAJoinLeaf;
    HandlerFuncTable[DTCODE_WSANtohl] = DTHandler_WSANtohl;
    HandlerFuncTable[DTCODE_WSANtohs] = DTHandler_WSANtohs;
    HandlerFuncTable[DTCODE_WSARecv] = DTHandler_WSARecv;
    HandlerFuncTable[DTCODE_WSARecvDisconnect] =
      DTHandler_WSARecvDisconnect;
    HandlerFuncTable[DTCODE_WSARecvFrom] = DTHandler_WSARecvFrom;
    HandlerFuncTable[DTCODE_WSAResetEvent] = DTHandler_WSAResetEvent;
    HandlerFuncTable[DTCODE_WSASend] = DTHandler_WSASend;
    HandlerFuncTable[DTCODE_WSASendDisconnect] =
      DTHandler_WSASendDisconnect;
    HandlerFuncTable[DTCODE_WSASendTo] = DTHandler_WSASendTo;
    HandlerFuncTable[DTCODE_WSASetBlockingHook] =
      DTHandler_WSASetBlockingHook;
    HandlerFuncTable[DTCODE_WSASetEvent] = DTHandler_WSASetEvent;
    HandlerFuncTable[DTCODE_WSASetLastError] = DTHandler_WSASetLastError;
    HandlerFuncTable[DTCODE_WSASocketA] = DTHandler_WSASocketA;
    HandlerFuncTable[DTCODE_WSASocketW] = DTHandler_WSASocketW;
    HandlerFuncTable[DTCODE_WSAStartup] = DTHandler_WSAStartup;
    HandlerFuncTable[DTCODE_WSAUnhookBlockingHook] =
      DTHandler_WSAUnhookBlockingHook;
    HandlerFuncTable[DTCODE_WSAWaitForMultipleEvents] =
      DTHandler_WSAWaitForMultipleEvents;
    HandlerFuncTable[DTCODE_gethostbyaddr] = DTHandler_gethostbyaddr;
    HandlerFuncTable[DTCODE_gethostbyname] = DTHandler_gethostbyname;
    HandlerFuncTable[DTCODE_gethostname] = DTHandler_gethostname;
    HandlerFuncTable[DTCODE_getprotobyname] = DTHandler_getprotobyname;
    HandlerFuncTable[DTCODE_getprotobynumber] = DTHandler_getprotobynumber;
    HandlerFuncTable[DTCODE_getservbyname] = DTHandler_getservbyname;
    HandlerFuncTable[DTCODE_getservbyport] = DTHandler_getservbyport;
    HandlerFuncTable[DTCODE_inet_addr] = DTHandler_inet_addr;
    HandlerFuncTable[DTCODE_inet_ntoa] = DTHandler_inet_ntoa;
    HandlerFuncTable[DTCODE_WSAAsyncGetHostByAddr] =
      DTHandler_WSAAsyncGetHostByAddr;
    HandlerFuncTable[DTCODE_WSAAsyncGetHostByName] =
      DTHandler_WSAAsyncGetHostByName;
    HandlerFuncTable[DTCODE_WSAAsyncGetProtoByName] =
      DTHandler_WSAAsyncGetProtoByName;
    HandlerFuncTable[DTCODE_WSAAsyncGetProtoByNumber] =
      DTHandler_WSAAsyncGetProtoByNumber;
    HandlerFuncTable[DTCODE_WSAAsyncGetServByName] =
      DTHandler_WSAAsyncGetServByName;
    HandlerFuncTable[DTCODE_WSAAsyncGetServByPort] =
      DTHandler_WSAAsyncGetServByPort;
    HandlerFuncTable[DTCODE_WSACancelAsyncRequest] =
      DTHandler_WSACancelAsyncRequest;
    HandlerFuncTable[DTCODE_WSPAccept] = DTHandler_WSPAccept;
    HandlerFuncTable[DTCODE_WSPAsyncSelect] = DTHandler_WSPAsyncSelect;
    HandlerFuncTable[DTCODE_WSPBind] = DTHandler_WSPBind;
    HandlerFuncTable[DTCODE_WSPCancelBlockingCall] =
      DTHandler_WSPCancelBlockingCall;
    HandlerFuncTable[DTCODE_WSPCleanup] = DTHandler_WSPCleanup;
    HandlerFuncTable[DTCODE_WSPCloseSocket] = DTHandler_WSPCloseSocket;
    HandlerFuncTable[DTCODE_WSPConnect] = DTHandler_WSPConnect;
    HandlerFuncTable[DTCODE_WSPDuplicateSocket] =
      DTHandler_WSPDuplicateSocket;
    HandlerFuncTable[DTCODE_WSPEnumNetworkEvents] =
      DTHandler_WSPEnumNetworkEvents;
    HandlerFuncTable[DTCODE_WSPEventSelect] = DTHandler_WSPEventSelect;
    HandlerFuncTable[DTCODE_WSPGetOverlappedResult] =
      DTHandler_WSPGetOverlappedResult;
    HandlerFuncTable[DTCODE_WSPGetPeerName] = DTHandler_WSPGetPeerName;
    HandlerFuncTable[DTCODE_WSPGetSockName] = DTHandler_WSPGetSockName;
    HandlerFuncTable[DTCODE_WSPGetSockOpt] = DTHandler_WSPGetSockOpt;
    HandlerFuncTable[DTCODE_WSPGetQOSByName] = DTHandler_WSPGetQOSByName;
    HandlerFuncTable[DTCODE_WSPIoctl] = DTHandler_WSPIoctl;
    HandlerFuncTable[DTCODE_WSPJoinLeaf] = DTHandler_WSPJoinLeaf;
    HandlerFuncTable[DTCODE_WSPListen] = DTHandler_WSPListen;
    HandlerFuncTable[DTCODE_WSPRecv] = DTHandler_WSPRecv;
    HandlerFuncTable[DTCODE_WSPRecvDisconnect] =
      DTHandler_WSPRecvDisconnect;
    HandlerFuncTable[DTCODE_WSPRecvFrom] = DTHandler_WSPRecvFrom;
    HandlerFuncTable[DTCODE_WSPSelect] = DTHandler_WSPSelect;
    HandlerFuncTable[DTCODE_WSPSend] = DTHandler_WSPSend;
    HandlerFuncTable[DTCODE_WSPSendDisconnect] =
      DTHandler_WSPSendDisconnect;
    HandlerFuncTable[DTCODE_WSPSendTo] = DTHandler_WSPSendTo;
    HandlerFuncTable[DTCODE_WSPSetSockOpt] = DTHandler_WSPSetSockOpt;
    HandlerFuncTable[DTCODE_WSPShutdown] = DTHandler_WSPShutdown;
    HandlerFuncTable[DTCODE_WSPSocket] = DTHandler_WSPSocket;
    HandlerFuncTable[DTCODE_WSPStartup] = DTHandler_WSPStartup;
    HandlerFuncTable[DTCODE_WPUCloseEvent] = DTHandler_WPUCloseEvent;
    HandlerFuncTable[DTCODE_WPUCloseSocketHandle] =
      DTHandler_WPUCloseSocketHandle;
    HandlerFuncTable[DTCODE_WPUCreateEvent] = DTHandler_WPUCreateEvent;
    HandlerFuncTable[DTCODE_WPUCreateSocketHandle] =
      DTHandler_WPUCreateSocketHandle;
    HandlerFuncTable[DTCODE_WSCDeinstallProvider] =
      DTHandler_WSCDeinstallProvider;
    HandlerFuncTable[DTCODE_WSCInstallProvider] =
      DTHandler_WSCInstallProvider;
    HandlerFuncTable[DTCODE_WPUModifyIFSHandle] =
      DTHandler_WPUModifyIFSHandle;
    HandlerFuncTable[DTCODE_WPUQueryBlockingCallback] =
      DTHandler_WPUQueryBlockingCallback;
    HandlerFuncTable[DTCODE_WPUQuerySocketHandleContext] =
      DTHandler_WPUQuerySocketHandleContext;
    HandlerFuncTable[DTCODE_WPUQueueApc] = DTHandler_WPUQueueApc;
    HandlerFuncTable[DTCODE_WPUResetEvent] = DTHandler_WPUResetEvent;
    HandlerFuncTable[DTCODE_WPUSetEvent] = DTHandler_WPUSetEvent;
    HandlerFuncTable[DTCODE_WSCEnumProtocols] = DTHandler_WSCEnumProtocols;
    HandlerFuncTable[DTCODE_WPUGetProviderPath] = DTHandler_WPUGetProviderPath;
    HandlerFuncTable[DTCODE_WPUPostMessage] = DTHandler_WPUPostMessage;
    HandlerFuncTable[DTCODE_WPUFDIsSet] = DTHandler_WPUFDIsSet;
    HandlerFuncTable[DTCODE___WSAFDIsSet] = DTHandler___WSAFDIsSet;
    HandlerFuncTable[DTCODE_WSAAddressToStringA] =
        DTHandler_WSAAddressToStringA;
    HandlerFuncTable[DTCODE_WSAAddressToStringW] =
        DTHandler_WSAAddressToStringW;
    HandlerFuncTable[DTCODE_WSAStringToAddressA] =
        DTHandler_WSAStringToAddressA;
    HandlerFuncTable[DTCODE_WSAStringToAddressW] =
        DTHandler_WSAStringToAddressW;
    HandlerFuncTable[DTCODE_WSALookupServiceBeginA] =
        DTHandler_WSALookupServiceBeginA;
    HandlerFuncTable[DTCODE_WSALookupServiceBeginW] =
        DTHandler_WSALookupServiceBeginW;
    HandlerFuncTable[DTCODE_WSALookupServiceNextA] =
        DTHandler_WSALookupServiceNextA;
    HandlerFuncTable[DTCODE_WSALookupServiceNextW] =
        DTHandler_WSALookupServiceNextW;
    HandlerFuncTable[DTCODE_WSALookupServiceEnd] =
        DTHandler_WSALookupServiceEnd;
    HandlerFuncTable[DTCODE_WSAInstallServiceClassA] =
        DTHandler_WSAInstallServiceClassA;
    HandlerFuncTable[DTCODE_WSAInstallServiceClassW] =
        DTHandler_WSAInstallServiceClassW;
    HandlerFuncTable[DTCODE_WSASetServiceA] =
        DTHandler_WSASetServiceA;
    HandlerFuncTable[DTCODE_WSASetServiceW] =
        DTHandler_WSASetServiceW;
    HandlerFuncTable[DTCODE_WSARemoveServiceClass] =
        DTHandler_WSARemoveServiceClass;
    HandlerFuncTable[DTCODE_WSAGetServiceClassInfoA] =
        DTHandler_WSAGetServiceClassInfoA;
    HandlerFuncTable[DTCODE_WSAGetServiceClassInfoW] =
        DTHandler_WSAGetServiceClassInfoW;
    HandlerFuncTable[DTCODE_WSAEnumNameSpaceProvidersA] =
        DTHandler_WSAEnumNameSpaceProvidersA;
    HandlerFuncTable[DTCODE_WSAEnumNameSpaceProvidersW] =
        DTHandler_WSAEnumNameSpaceProvidersW;
    HandlerFuncTable[DTCODE_WSAGetServiceClassNameByClassIdA] =
        DTHandler_WSAGetServiceClassNameByClassIdA;
    HandlerFuncTable[DTCODE_WSAGetServiceClassNameByClassIdW] =
        DTHandler_WSAGetServiceClassNameByClassIdW;
    HandlerFuncTable[DTCODE_NSPLookupServiceBegin] =
        DTHandler_NSPLookupServiceBegin;
    HandlerFuncTable[DTCODE_NSPLookupServiceNext] =
        DTHandler_NSPLookupServiceNext;
    HandlerFuncTable[DTCODE_NSPLookupServiceEnd] =
        DTHandler_NSPLookupServiceEnd;
    HandlerFuncTable[DTCODE_NSPInstallServiceClass] =
        DTHandler_NSPInstallServiceClass;
    HandlerFuncTable[DTCODE_NSPSetService] =
        DTHandler_NSPSetService;
    HandlerFuncTable[DTCODE_NSPRemoveServiceClass] =
        DTHandler_NSPRemoveServiceClass;
    HandlerFuncTable[DTCODE_NSPGetServiceClassInfo] =
        DTHandler_NSPGetServiceClassInfo;

    return(TRUE);
}

Generated on Wed Nov 13 2024 16:54:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/Dt_Dll/Handlers.h File Reference

  • NetDS
  • WinSock
  • Dt_Dll
Typedefs | Functions

Handlers.h File Reference

Go to the source code of this file.

Typedefs

typedef BOOL(CALLBACK * | LPFNDTHANDLER )(IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
typedef LPFNDTHANDLER * | LPLPFNDTHANDLER

Functions

BOOL CALLBACK | DTHandler___WSAFDIsSet (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_accept (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_bind (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_closesocket (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_connect (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_gethostbyaddr (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_gethostbyname (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_gethostname (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_getpeername (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_getprotobyname (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_getprotobynumber (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_getservbyname (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_getservbyport (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_getsockname (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_getsockopt (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_htonl (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_htons (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_inet_addr (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_inet_ntoa (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_ioctlsocket (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_listen (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_NSPCleanup (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_NSPGetServiceClassInfo (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_NSPInstallServiceClass (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_NSPLookupServiceBegin (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_NSPLookupServiceEnd (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_NSPLookupServiceNext (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_NSPRemoveServiceClass (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_NSPSetService (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_ntohl (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_ntohs (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_recv (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_recvfrom (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_select (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_send (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_sendto (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_setsockopt (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_shutdown (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_socket (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WPUCloseEvent (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WPUCloseSocketHandle (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WPUCreateEvent (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WPUCreateSocketHandle (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WPUFDIsSet (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WPUGetProviderPath (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WPUModifyIFSHandle (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WPUPostMessage (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WPUQueryBlockingCallback (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WPUQuerySocketHandleContext (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WPUQueueApc (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WPUResetEvent (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WPUSetEvent (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAAccept (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAAddressToStringA (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAAddressToStringW (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAAsyncGetHostByAddr (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAAsyncGetHostByName (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAAsyncGetProtoByName (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAAsyncGetProtoByNumber (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAAsyncGetServByName (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAAsyncGetServByPort (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAAsyncSelect (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSACancelAsyncRequest (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSACancelBlockingCall (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSACleanup (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSACloseEvent (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAConnect (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSACreateEvent (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSADuplicateSocketA (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSADuplicateSocketW (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAEnumNameSpaceProvidersA (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAEnumNameSpaceProvidersW (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAEnumNetworkEvents (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAEnumProtocolsA (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAEnumProtocolsW (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAEventSelect (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAGetAddressByNameA (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAGetAddressByNameW (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAGetLastError (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAGetOverlappedResult (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAGetQOSByName (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAGetServiceClassInfoA (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAGetServiceClassInfoW (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAGetServiceClassNameByClassIdA (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAGetServiceClassNameByClassIdW (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAHtonl (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAHtons (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAInstallServiceClassA (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAInstallServiceClassW (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAIoctl (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAIsBlocking (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAJoinLeaf (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSALookupServiceBeginA (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSALookupServiceBeginW (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSALookupServiceEnd (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSALookupServiceNextA (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSALookupServiceNextW (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSANtohl (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSANtohs (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSARecv (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSARecvDisconnect (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSARecvFrom (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSARemoveServiceClass (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAResetEvent (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSASend (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSASendDisconnect (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSASendTo (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSASetBlockingHook (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSASetEvent (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSASetLastError (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSASetServiceA (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSASetServiceW (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSASocketA (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSASocketW (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAStartup (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAStringToAddressA (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAStringToAddressW (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAUnhookBlockingHook (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSAWaitForMultipleEvents (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSCDeinstallProvider (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSCEnumProtocols (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSCInstallProvider (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPAccept (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPAsyncSelect (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPBind (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPCancelBlockingCall (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPCleanup (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPCloseSocket (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPConnect (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPDuplicateSocket (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPEnumNetworkEvents (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPEventSelect (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPGetOverlappedResult (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPGetPeerName (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPGetQOSByName (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPGetSockName (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPGetSockOpt (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPIoctl (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPJoinLeaf (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPListen (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPRecv (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPRecvDisconnect (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPRecvFrom (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPSelect (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPSend (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPSendDisconnect (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPSendTo (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPSetSockOpt (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPShutdown (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPSocket (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL CALLBACK | DTHandler_WSPStartup (IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)
BOOL | DTHandlerInit (OUT LPLPFNDTHANDLER HandlerFuncTable, int NumEntries)

Typedef Documentation

typedef BOOL(CALLBACK * LPFNDTHANDLER)(IN va_list vl, IN OUT LPVOID ReturnValue, IN LPSTR LibraryName, OUT char *Buffer, IN int Index, IN int BufLen, IN BOOL PreOrPost)

Definition at line 22 of file Handlers.h.

typedef LPFNDTHANDLER* LPLPFNDTHANDLER

Definition at line 31 of file Handlers.h.

Function Documentation

BOOL CALLBACK DTHandler___WSAFDIsSet | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3194 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    fd_set FAR **set = va_arg(vl, fd_set FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "__WSAFDIsSet() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_accept | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 329 of file Handlers.Cpp.

{
    SOCKET *RetVal = (SOCKET *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    struct sockaddr FAR **addr = va_arg(vl, struct sockaddr FAR **);
    int FAR **addrlen = va_arg(vl, int FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "accept() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_bind | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 352 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    struct sockaddr FAR **name = va_arg(vl, struct sockaddr FAR **);
    int *namelen = va_arg(vl, int *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "bind() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_closesocket | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 375 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "closesocket() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_connect | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 396 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    struct sockaddr FAR **name = va_arg(vl, struct sockaddr FAR **);
    int *namelen = va_arg(vl, int *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "connect() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_gethostbyaddr | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1710 of file Handlers.Cpp.

{
    struct hostent FAR **RetVal = (struct hostent FAR **)ReturnValue;
    char FAR **addr = va_arg(vl, char FAR **);
    int *len = va_arg(vl, int *);
    int *type = va_arg(vl, int *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "gethostbyaddr() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_gethostbyname | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1733 of file Handlers.Cpp.

{
    struct hostent FAR **RetVal = (struct hostent FAR **)ReturnValue;
    char FAR **name = va_arg(vl, char FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "gethostbyname() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_gethostname | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1754 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    char FAR **name = va_arg(vl, char FAR **);
    int *namelen = va_arg(vl, int *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "gethostname() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_getpeername | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 419 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    struct sockaddr FAR **name = va_arg(vl, struct sockaddr FAR **);
    int FAR **namelen = va_arg(vl, int FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "getpeername() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_getprotobyname | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1776 of file Handlers.Cpp.

{
    struct protoent FAR **RetVal = (struct protoent FAR **)ReturnValue;
    char FAR **name = va_arg(vl, char FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "getprotobyname() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_getprotobynumber | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1797 of file Handlers.Cpp.

{
    struct protoent FAR **RetVal = (struct protoent FAR **)ReturnValue;
    int *number = va_arg(vl, int *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "getprotobynumber() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_getservbyname | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1818 of file Handlers.Cpp.

{
    struct servent FAR **RetVal = (struct servent FAR **)ReturnValue;
    char FAR **name = va_arg(vl, char FAR **);
    char FAR **proto = va_arg(vl, char FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "getservbyname() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_getservbyport | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1840 of file Handlers.Cpp.

{
    struct servent FAR **RetVal = (struct servent FAR **)ReturnValue;
    int *port = va_arg(vl, int *);
    char FAR **proto = va_arg(vl, char FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "getservbyport() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_getsockname | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 442 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    struct sockaddr FAR **name = va_arg(vl, struct sockaddr FAR **);
    int FAR **namelen = va_arg(vl, int FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "getsockname() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_getsockopt | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 465 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    int *level = va_arg(vl, int *);
    int *optname = va_arg(vl, int *);
    char FAR **optval = va_arg(vl, char FAR **);
    int FAR **optlen = va_arg(vl, int FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "getsockopt() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_htonl | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 490 of file Handlers.Cpp.

{
    u_long *RetVal = (u_long *)ReturnValue;
    u_long *hostlong = va_arg(vl, u_long *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "htonl() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_htons | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 511 of file Handlers.Cpp.

{
    u_short *RetVal = (u_short *)ReturnValue;
    u_short *hostshort = va_arg(vl, u_short *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "htons() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_inet_addr | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1862 of file Handlers.Cpp.

{
    unsigned long *RetVal = (unsigned long *)ReturnValue;
    char FAR **cp = va_arg(vl, char FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "inet_addr() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_inet_ntoa | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1883 of file Handlers.Cpp.

{
    char FAR **RetVal = (char FAR **)ReturnValue;
    struct in_addr *in = va_arg(vl, struct in_addr *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "inet_ntoa() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_ioctlsocket | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 532 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    long *cmd = va_arg(vl, long *);
    u_long FAR **argp = va_arg(vl, u_long FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "ioctlsocket() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_listen | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 555 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    int *backlog = va_arg(vl, int *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "listen() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_NSPCleanup | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |
BOOL CALLBACK DTHandler_NSPGetServiceClassInfo | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3979 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPGUID *lpProviderId = va_arg(vl, LPGUID*);
    LPGUID *lpServiceClassId = va_arg(vl, LPGUID*);
    LPDWORD *lpdwBufSize = va_arg(vl, LPDWORD*);
    LPWSASERVICECLASSINFOW *lpServiceClassInfo =
        va_arg(vl, LPWSASERVICECLASSINFOW*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "NSPGetServiceClassInfo() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_NSPInstallServiceClass | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3910 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPWSASERVICECLASSINFOW *lpServiceClassInfo =
        va_arg(vl, LPWSASERVICECLASSINFOW*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "NSPInstallServiceClass() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_NSPLookupServiceBegin | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3809 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPWSAQUERYSETW *lpqsRestrictions = va_arg(vl, LPWSAQUERYSETW*);
    DWORD *dwControlFlags = va_arg(vl, DWORD*);
    LPHANDLE *lphLookup  = va_arg(vl, LPHANDLE*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "NSPLookupServiceBegin() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_NSPLookupServiceEnd | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3859 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    HANDLE *hLookup = va_arg(vl, HANDLE*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "NSPLookupServiceEnd() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_NSPLookupServiceNext | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3833 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    HANDLE *hLookup = va_arg(vl, HANDLE*);
    DWORD *dwControlFlags = va_arg(vl, DWORD*);
    LPDWORD *lpdwBufferLength = va_arg(vl, LPDWORD*);
    LPWSAQUERYSETW *lpqsResults = va_arg(vl, LPWSAQUERYSETW*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "NSPLookupServiceNext() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_NSPRemoveServiceClass | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3957 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPGUID *lpServiceClassId = va_arg(vl, LPGUID*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "NSPRemoveServiceClass() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_NSPSetService | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3933 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPWSAQUERYSETW *lpqsRegInfo = va_arg(vl, LPWSAQUERYSETW*);
    WSAESETSERVICEOP *essOperation = va_arg(vl, WSAESETSERVICEOP*);
    DWORD *dwControlFlags = va_arg(vl, DWORD*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "NSPSetService() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_ntohl | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 577 of file Handlers.Cpp.

{
    u_long *RetVal = (u_long *)ReturnValue;
    u_long *netlong = va_arg(vl, u_long *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "ntohl() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_ntohs | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 598 of file Handlers.Cpp.

{
    u_short *RetVal = (u_short *)ReturnValue;
    u_short *netshort = va_arg(vl, u_short *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "ntohs() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_recv | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 619 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    char FAR **buf = va_arg(vl, char FAR **);
    int *len = va_arg(vl, int *);
    int *flags = va_arg(vl, int *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "recv() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_recvfrom | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 643 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    char FAR **buf = va_arg(vl, char FAR **);
    int *len = va_arg(vl, int *);
    int *flags = va_arg(vl, int *);
    struct sockaddr FAR **from = va_arg(vl, struct sockaddr FAR **);
    int FAR **fromlen = va_arg(vl, int FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "recvfrom() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_select | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 669 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    int *nfds = va_arg(vl, int *);
    fd_set FAR **readfds = va_arg(vl, fd_set FAR **);
    fd_set FAR **writefds = va_arg(vl, fd_set FAR **);
    fd_set FAR **exceptfds = va_arg(vl, fd_set FAR **);
    struct timeval FAR **timeout = va_arg(vl, struct timeval FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "select() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_send | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 694 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    char FAR **buf = va_arg(vl, char FAR **);
    int *len = va_arg(vl, int *);
    int *flags = va_arg(vl, int *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "send() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_sendto | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 718 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    char FAR **buf = va_arg(vl, char FAR **);
    int *len = va_arg(vl, int *);
    int *flags = va_arg(vl, int *);
    struct sockaddr FAR **to = va_arg(vl, struct sockaddr FAR **);
    int *tolen = va_arg(vl, int *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "sendto() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_setsockopt | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 744 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    int *level = va_arg(vl, int *);
    int *optname = va_arg(vl, int *);
    char FAR **optval = va_arg(vl, char FAR **);
    int *optlen = va_arg(vl, int *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "setsockopt() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_shutdown | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 769 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    int *how = va_arg(vl, int *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "shutdown() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_socket | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 791 of file Handlers.Cpp.

{
    SOCKET *RetVal = (SOCKET *)ReturnValue;
    int *af = va_arg(vl, int *);
    int *type = va_arg(vl, int *);
    int *protocol = va_arg(vl, int *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "socket() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WPUCloseEvent | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2824 of file Handlers.Cpp.

{
    BOOL *RetVal = (BOOL *)ReturnValue;
    WSAEVENT *hEvent = va_arg(vl, WSAEVENT *);
    LPINT *lpErrno = va_arg(vl, LPINT *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WPUCloseEvent() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WPUCloseSocketHandle | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2846 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    LPINT *lpErrno = va_arg(vl, LPINT *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WPUCloseSocketHandle() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WPUCreateEvent | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2868 of file Handlers.Cpp.

{
    WSAEVENT *RetVal = (WSAEVENT *)ReturnValue;
    LPINT *lpErrno = va_arg(vl, LPINT *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WPUCreateEvent() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WPUCreateSocketHandle | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2889 of file Handlers.Cpp.

{
    SOCKET *RetVal = (SOCKET *)ReturnValue;
    DWORD *dwCatalogEntryId = va_arg(vl, DWORD *);
    DWORD *dwContext = va_arg(vl, DWORD *);
    LPINT *lpErrno = va_arg(vl, LPINT *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WPUCreateSocketHandle() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WPUFDIsSet | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3100 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    fd_set FAR **set = va_arg(vl, fd_set FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WPUFDIsSet() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WPUGetProviderPath | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3122 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    DWORD *dwProviderId = va_arg(vl, DWORD *);
    char FAR **lpszProviderDllPath = va_arg(vl, char FAR **);
    LPINT *lpProviderDllPathLen = va_arg(vl, LPINT *);
    LPINT *lpErrno = va_arg(vl, LPINT *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WPUGetProviderPath() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WPUModifyIFSHandle | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2960 of file Handlers.Cpp.

{
    SOCKET *RetVal = (SOCKET *)ReturnValue;
    DWORD *dwCatalogEntryId = va_arg(vl, DWORD *);
    SOCKET *ProposedHandle = va_arg(vl, SOCKET *);
    LPINT *lpErrno = va_arg(vl, LPINT *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WPUModifyIFSHandle() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WPUPostMessage | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3146 of file Handlers.Cpp.

{
    BOOL *RetVal = (BOOL *)ReturnValue;
    HWND *hWnd = va_arg(vl, HWND *);
    UINT *Msg = va_arg(vl, UINT *);
    WPARAM *wParam = va_arg(vl, WPARAM *);
    LPARAM *lParam = va_arg(vl, LPARAM *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WPUPostMessage() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WPUQueryBlockingCallback | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2983 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    DWORD *dwCatalogEntryId = va_arg(vl, DWORD *);
    LPBLOCKINGCALLBACK FAR **lplpfnCallback =
      va_arg(vl, LPBLOCKINGCALLBACK FAR **);
    LPDWORD *lpdwContext = va_arg(vl, LPDWORD *);
    LPINT *lpErrno = va_arg(vl, LPINT *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WPUQueryBlockingCallback() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WPUQuerySocketHandleContext | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3008 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    LPDWORD *lpContext = va_arg(vl, LPDWORD *);
    LPINT *lpErrno = va_arg(vl, LPINT *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WPUQuerySocketHandleContext() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WPUQueueApc | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3031 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPWSATHREADID *lpThreadId = va_arg(vl, LPWSATHREADID *);
    LPWSAUSERAPC *lpfnUserApc = va_arg(vl, LPWSAUSERAPC *);
    DWORD *dwContext = va_arg(vl, DWORD *);
    LPINT *lpErrno = va_arg(vl, LPINT *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WPUQueueApc() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WPUResetEvent | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3055 of file Handlers.Cpp.

{
    BOOL *RetVal = (BOOL *)ReturnValue;
    WSAEVENT *hEvent = va_arg(vl, WSAEVENT *);
    LPINT *lpErrno = va_arg(vl, LPINT *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WPUResetEvent() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WPUSetEvent | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3077 of file Handlers.Cpp.

{
    BOOL *RetVal = (BOOL *)ReturnValue;
    WSAEVENT *hEvent = va_arg(vl, WSAEVENT *);
    LPINT *lpErrno = va_arg(vl, LPINT *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WPUSetEvent() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAAccept | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 814 of file Handlers.Cpp.

{
    SOCKET *RetVal = (SOCKET *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    struct sockaddr FAR **addr = va_arg(vl, struct sockaddr FAR **);
    LPINT *addrlen = va_arg(vl, LPINT *);
    LPCONDITIONPROC *lpfnCondition = va_arg(vl, LPCONDITIONPROC *);
    DWORD *dwCallbackData = va_arg(vl, DWORD *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAAccept() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAAddressToStringA | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3216 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPSOCKADDR *lpsaAddress = va_arg(vl, LPSOCKADDR *);
    DWORD *dwAddressLength= va_arg(vl, DWORD *);
    LPWSAPROTOCOL_INFOA *lpProtocolInfo= va_arg(vl, LPWSAPROTOCOL_INFOA *);
    LPSTR *lpszAddressString= va_arg(vl, LPSTR *);
    LPDWORD *lpdwAddressStringLength= va_arg(vl, LPDWORD *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAAddressToStringA() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAAddressToStringW | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3242 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPSOCKADDR *lpsaAddress = va_arg(vl, LPSOCKADDR *);
    DWORD *dwAddressLength= va_arg(vl, DWORD *);
    LPWSAPROTOCOL_INFOW *lpProtocolInfo= va_arg(vl, LPWSAPROTOCOL_INFOW *);
    LPWSTR *lpszAddressString= va_arg(vl, LPWSTR *);
    LPDWORD *lpdwAddressStringLength= va_arg(vl, LPDWORD *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAAddressToStringW() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAAsyncGetHostByAddr | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1904 of file Handlers.Cpp.

{
    HANDLE *RetVal = (HANDLE *)ReturnValue;
    HWND *hWnd = va_arg(vl, HWND *);
    u_int *wMsg = va_arg(vl, u_int *);
    char FAR **addr = va_arg(vl, char FAR **);
    int *len = va_arg(vl, int *);
    int *type = va_arg(vl, int *);
    char FAR **buf = va_arg(vl, char FAR **);
    int *buflen = va_arg(vl, int *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAAsyncGetHostByAddr() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAAsyncGetHostByName | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1931 of file Handlers.Cpp.

{
    HANDLE *RetVal = (HANDLE *)ReturnValue;
    HWND *hWnd = va_arg(vl, HWND *);
    u_int *wMsg = va_arg(vl, u_int *);
    char FAR **name = va_arg(vl, char FAR **);
    char FAR **buf = va_arg(vl, char FAR **);
    int *buflen = va_arg(vl, int *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAAsyncGetHostByName() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAAsyncGetProtoByName | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1956 of file Handlers.Cpp.

{
    HANDLE *RetVal = (HANDLE *)ReturnValue;
    HWND *hWnd = va_arg(vl, HWND *);
    u_int *wMsg = va_arg(vl, u_int *);
    char FAR **name = va_arg(vl, char FAR **);
    char FAR **buf = va_arg(vl, char FAR **);
    int *buflen = va_arg(vl, int *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAAsyncGetProtoByName() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAAsyncGetProtoByNumber | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1981 of file Handlers.Cpp.

{
    HANDLE *RetVal = (HANDLE *)ReturnValue;
    HWND *hWnd = va_arg(vl, HWND *);
    u_int *wMsg = va_arg(vl, u_int *);
    int *number = va_arg(vl, int *);
    char FAR **buf = va_arg(vl, char FAR **);
    int *buflen = va_arg(vl, int *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAAsyncGetProtoByNumber() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAAsyncGetServByName | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2006 of file Handlers.Cpp.

{
    HANDLE *RetVal = (HANDLE *)ReturnValue;
    HWND *hWnd = va_arg(vl, HWND *);
    u_int *wMsg = va_arg(vl, u_int *);
    char FAR **name = va_arg(vl, char FAR **);
    char FAR **proto = va_arg(vl, char FAR **);
    char FAR **buf = va_arg(vl, char FAR **);
    int *buflen = va_arg(vl, int *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAAsyncGetServByName() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAAsyncGetServByPort | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2032 of file Handlers.Cpp.

{
    HANDLE *RetVal = (HANDLE *)ReturnValue;
    HWND *hWnd = va_arg(vl, HWND *);
    u_int *wMsg = va_arg(vl, u_int *);
    int *port = va_arg(vl, int *);
    char FAR **proto = va_arg(vl, char FAR **);
    char FAR **buf = va_arg(vl, char FAR **);
    int *buflen = va_arg(vl, int *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAAsyncGetServByPort() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAAsyncSelect | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 839 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    HWND *hWnd = va_arg(vl, HWND *);
    u_int *wMsg = va_arg(vl, u_int *);
    long *lEvent = va_arg(vl, long *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAAsyncSelect() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSACancelAsyncRequest | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2058 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    HANDLE *hAsyncTaskHandle = va_arg(vl, HANDLE *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSACancelAsyncRequest() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSACancelBlockingCall | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 863 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSACancelBlockingCall() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSACleanup | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 883 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSACleanup() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSACloseEvent | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 903 of file Handlers.Cpp.

{
    BOOL *RetVal = (BOOL *)ReturnValue;
    WSAEVENT *hEvent = va_arg(vl, WSAEVENT *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSACloseEvent() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAConnect | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 924 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    struct sockaddr FAR **name = va_arg(vl, struct sockaddr FAR **);
    int *namelen = va_arg(vl, int *);
    LPWSABUF *lpCallerData = va_arg(vl, LPWSABUF *);
    LPWSABUF *lpCalleeData = va_arg(vl, LPWSABUF *);
    LPQOS *lpSQOS = va_arg(vl, LPQOS *);
    LPQOS *lpGQOS = va_arg(vl, LPQOS *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAConnect() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSACreateEvent | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 951 of file Handlers.Cpp.

{
    WSAEVENT *RetVal = (WSAEVENT *)ReturnValue;

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSACreateEvent() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSADuplicateSocketA | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 971 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    DWORD *dwProcessId = va_arg(vl, DWORD *);
    LPWSAPROTOCOL_INFOA *lpProtocolInfo = va_arg(vl, LPWSAPROTOCOL_INFOA *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSADuplicateSocketA() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSADuplicateSocketW | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 994 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    DWORD *dwProcessId = va_arg(vl, DWORD *);
    LPWSAPROTOCOL_INFOW *lpProtocolInfo = va_arg(vl, LPWSAPROTOCOL_INFOW *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSADuplicateSocketW() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAEnumNameSpaceProvidersA | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3666 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPDWORD *lpdwBufferLength = va_arg(vl, LPDWORD*);
    LPWSANAMESPACE_INFOA *Lpnspbuffer = va_arg(vl,  LPWSANAMESPACE_INFOA*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAEnumNameSpaceProvidersA() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAEnumNameSpaceProvidersW | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3688 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPDWORD *lpdwBufferLength = va_arg(vl, LPDWORD*);
    LPWSANAMESPACE_INFOW *Lpnspbuffer = va_arg(vl,  LPWSANAMESPACE_INFOW*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAEnumNameSpaceProvidersW() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAEnumNetworkEvents | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1017 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    WSAEVENT *hEventObject = va_arg(vl, WSAEVENT *);
    LPWSANETWORKEVENTS *lpNetworkEvents = va_arg(vl, LPWSANETWORKEVENTS *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAEnumNetworkEvents() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAEnumProtocolsA | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1040 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPINT *lpiProtocols = va_arg(vl, LPINT *);
    LPWSAPROTOCOL_INFOA *lpProtocolBuffer = va_arg(vl, LPWSAPROTOCOL_INFOA *);
    LPDWORD *lpdwBufferLength = va_arg(vl, LPDWORD *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAEnumProtocolsA() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAEnumProtocolsW | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1063 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPINT *lpiProtocols = va_arg(vl, LPINT *);
    LPWSAPROTOCOL_INFOW *lpProtocolBuffer = va_arg(vl, LPWSAPROTOCOL_INFOW *);
    LPDWORD *lpdwBufferLength = va_arg(vl, LPDWORD *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAEnumProtocolsW() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAEventSelect | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1086 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    WSAEVENT *hEventObject = va_arg(vl, WSAEVENT *);
    long *lNetworkEvents = va_arg(vl, long *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAEventSelect() %s.\r\n",
         PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAGetAddressByNameA | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3439 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPSTR *lpszServiceInstanceName = va_arg(vl, LPSTR*);
    LPGUID *lpServiceClassId = va_arg(vl, LPGUID*);
    DWORD *dwNameSpace = va_arg(vl, DWORD*);
    LPDWORD *lpdwBufferLength = va_arg(vl, LPDWORD*);
    LPWSAQUERYSETA *lpqsResults = va_arg(vl, LPWSAQUERYSETA*);
    DWORD *dwResolution = va_arg(vl, DWORD*);
    LPSTR *lpszAliasBuffer = va_arg(vl, LPSTR*);
    LPDWORD *lpdwAliasBufferLength  = va_arg(vl, LPDWORD*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAGetAddressByNameA() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAGetAddressByNameW | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3467 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPWSTR *lpszServiceInstanceName = va_arg(vl, LPWSTR*);
    LPGUID *lpServiceClassId = va_arg(vl, LPGUID*);
    DWORD *dwNameSpace = va_arg(vl, DWORD*);
    LPDWORD *lpdwBufferLength = va_arg(vl, LPDWORD*);
    LPWSAQUERYSETW *lpqsResults = va_arg(vl, LPWSAQUERYSETW*);
    DWORD *dwResolution = va_arg(vl, DWORD*);
    LPWSTR *lpszAliasBuffer = va_arg(vl, LPWSTR*);
    LPDWORD *lpdwAliasBufferLength  = va_arg(vl, LPDWORD*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAGetAddressByNameW() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAGetLastError | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1109 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAGetLastError() %s.\r\n",
         PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAGetOverlappedResult | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1129 of file Handlers.Cpp.

{
    BOOL *RetVal = (BOOL *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    LPWSAOVERLAPPED *lpOverlapped = va_arg(vl, LPWSAOVERLAPPED *);
    LPDWORD *lpcbTransfer = va_arg(vl, LPDWORD *);
    BOOL *fWait = va_arg(vl, BOOL *);
    LPDWORD *lpdwFlags = va_arg(vl, LPDWORD *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAGetOverlappedResult() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAGetQOSByName | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1154 of file Handlers.Cpp.

{
    BOOL *RetVal = (BOOL *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    LPWSABUF *lpQOSName = va_arg(vl, LPWSABUF *);
    LPQOS *lpQOS = va_arg(vl, LPQOS *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAGetQOSByName() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAGetServiceClassInfoA | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3613 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPGUID *lpProviderId = va_arg(vl, LPGUID*);
    LPGUID *lpServiceClassId = va_arg(vl, LPGUID*);
    LPDWORD *lpdwBufSize = va_arg(vl, LPDWORD*);
    LPWSASERVICECLASSINFOA *lpServiceClassInfo =
        va_arg(vl, LPWSASERVICECLASSINFOA*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAGetServiceClassInfoA() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAGetServiceClassInfoW | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3639 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPGUID *lpProviderId = va_arg(vl, LPGUID*);
    LPGUID *lpServiceClassId = va_arg(vl, LPGUID*);
    LPDWORD *lpdwBufSize = va_arg(vl, LPDWORD*);
    LPWSASERVICECLASSINFOW *lpServiceClassInfo =
        va_arg(vl, LPWSASERVICECLASSINFOW*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAGetServiceClassInfoW() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAGetServiceClassNameByClassIdA | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3712 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPGUID *lpServiceClassId = va_arg(vl, LPGUID*);
    LPSTR *lpszServiceClassName = va_arg(vl, LPSTR*);
    LPDWORD *lpdwBufferLength = va_arg(vl, LPDWORD*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAGetServiceClassNameByClassIdA() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAGetServiceClassNameByClassIdW | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3735 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPGUID *lpServiceClassId = va_arg(vl, LPGUID*);
    LPWSTR *lpszServiceClassName = va_arg(vl, LPWSTR*);
    LPDWORD *lpdwBufferLength = va_arg(vl, LPDWORD*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAGetServiceClassNameByClassIdW() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAHtonl | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1177 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    u_long *hostlong = va_arg(vl, u_long *);
    u_long FAR **lpnetlong = va_arg(vl, u_long FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAHtonl() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAHtons | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1200 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    u_short *hostshort = va_arg(vl, u_short *);
    u_short FAR **lpnetshort = va_arg(vl, u_short FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAHtons() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAInstallServiceClassA | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3497 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPWSASERVICECLASSINFOA *lpServiceClassInfo =
        va_arg(vl, LPWSASERVICECLASSINFOA*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAInstallServiceClassA() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAInstallServiceClassW | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3519 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPWSASERVICECLASSINFOW *lpServiceClassInfo =
        va_arg(vl, LPWSASERVICECLASSINFOW*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAInstallServiceClassW() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAIoctl | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1223 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    DWORD *dwIoControlCode = va_arg(vl, DWORD *);
    LPVOID *lpvInBuffer = va_arg(vl, LPVOID *);
    DWORD *cbInBuffer = va_arg(vl, DWORD *);
    LPVOID *lpvOutBuffer = va_arg(vl, LPVOID *);
    DWORD *cbOutBuffer = va_arg(vl, DWORD *);
    LPDWORD *lpcbBytesReturned = va_arg(vl, LPDWORD *);
    LPWSAOVERLAPPED *lpOverlapped = va_arg(vl, LPWSAOVERLAPPED *);
    LPWSAOVERLAPPED_COMPLETION_ROUTINE *lpCompletionRoutine =
      va_arg(vl, LPWSAOVERLAPPED_COMPLETION_ROUTINE *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAIoctl() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAIsBlocking | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1253 of file Handlers.Cpp.

{
    BOOL *RetVal = (BOOL *)ReturnValue;

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAIsBlocking() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAJoinLeaf | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1273 of file Handlers.Cpp.

{
    SOCKET *RetVal = (SOCKET *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    struct sockaddr FAR **name = va_arg(vl, struct sockaddr FAR **);
    int *namelen = va_arg(vl, int *);
    LPWSABUF *lpCallerData = va_arg(vl, LPWSABUF *);
    LPWSABUF *lpCalleeData = va_arg(vl, LPWSABUF *);
    LPQOS *lpSQOS = va_arg(vl, LPQOS *);
    LPQOS *lpGQOS = va_arg(vl, LPQOS *);
    DWORD *dwFlags = va_arg(vl, DWORD *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAJoinLeaf() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSALookupServiceBeginA | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3319 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPWSAQUERYSETA *lpqsRestrictions = va_arg(vl, LPWSAQUERYSETA*);
    DWORD *dwControlFlags = va_arg(vl, DWORD*);
    LPHANDLE *lphLookup  = va_arg(vl, LPHANDLE*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSALookupServiceBeginA() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSALookupServiceBeginW | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3342 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPWSAQUERYSETW *lpqsRestrictions = va_arg(vl, LPWSAQUERYSETW*);
    DWORD *dwControlFlags = va_arg(vl, DWORD*);
    LPHANDLE *lphLookup  = va_arg(vl, LPHANDLE*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSALookupServiceBeginW() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSALookupServiceEnd | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3416 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    HANDLE *hLookup = va_arg(vl, HANDLE*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSALookupServiceEnd() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSALookupServiceNextA | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3366 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    HANDLE *hLookup = va_arg(vl, HANDLE*);
    DWORD *dwControlFlags = va_arg(vl, DWORD*);
    LPDWORD *lpdwBufferLength = va_arg(vl, LPDWORD*);
    LPWSAQUERYSETA *lpqsResults = va_arg(vl, LPWSAQUERYSETA*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSALookupServiceNextA() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSALookupServiceNextW | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3390 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    HANDLE *hLookup = va_arg(vl, HANDLE*);
    DWORD *dwControlFlags = va_arg(vl, DWORD*);
    LPDWORD *lpdwBufferLength = va_arg(vl, LPDWORD*);
    LPWSAQUERYSETW *lpqsResults = va_arg(vl, LPWSAQUERYSETW*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSALookupServiceNextW() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSANtohl | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1301 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    u_long *netlong = va_arg(vl, u_long *);
    u_long FAR **lphostlong = va_arg(vl, u_long FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSANtohl() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSANtohs | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1324 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    u_short *netshort = va_arg(vl, u_short *);
    u_short FAR **lphostshort = va_arg(vl, u_short FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSANtohs() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSARecv | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1347 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    LPWSABUF *lpBuffers = va_arg(vl, LPWSABUF *);
    DWORD *dwBufferCount = va_arg(vl, DWORD *);
    LPDWORD *lpNumberOfBytesRecvd = va_arg(vl, LPDWORD *);
    LPDWORD *lpFlags = va_arg(vl, LPDWORD *);
    LPWSAOVERLAPPED *lpOverlapped = va_arg(vl, LPWSAOVERLAPPED *);
    LPWSAOVERLAPPED_COMPLETION_ROUTINE *lpCompletionRoutine =
      va_arg(vl, LPWSAOVERLAPPED_COMPLETION_ROUTINE *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSARecv() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSARecvDisconnect | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1375 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    LPWSABUF *lpInboundDisconnectData = va_arg(vl, LPWSABUF *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSARecvDisconnect() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSARecvFrom | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1397 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    LPWSABUF *lpBuffers = va_arg(vl, LPWSABUF *);
    DWORD *dwBufferCount = va_arg(vl, DWORD *);
    LPDWORD *lpNumberOfBytesRecvd = va_arg(vl, LPDWORD *);
    LPDWORD *lpFlags = va_arg(vl, LPDWORD *);
    struct sockaddr FAR **lpFrom = va_arg(vl, struct sockaddr FAR **);
    LPINT *lpFromlen = va_arg(vl, LPINT *);
    LPWSAOVERLAPPED *lpOverlapped = va_arg(vl, LPWSAOVERLAPPED *);
    LPWSAOVERLAPPED_COMPLETION_ROUTINE *lpCompletionRoutine =
      va_arg(vl, LPWSAOVERLAPPED_COMPLETION_ROUTINE *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSARecvFrom() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSARemoveServiceClass | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3590 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPGUID *lpServiceClassId = va_arg(vl, LPGUID*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSARemoveServiceClass() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAResetEvent | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1427 of file Handlers.Cpp.

{
    BOOL *RetVal = (BOOL *)ReturnValue;
    WSAEVENT *hEvent = va_arg(vl, WSAEVENT *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAResetEvent() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSASend | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1448 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    LPWSABUF *lpBuffers = va_arg(vl, LPWSABUF *);
    DWORD *dwBufferCount = va_arg(vl, DWORD *);
    LPDWORD *lpNumberOfBytesSent = va_arg(vl, LPDWORD *);
    DWORD *dwFlags = va_arg(vl, DWORD *);
    LPWSAOVERLAPPED *lpOverlapped = va_arg(vl, LPWSAOVERLAPPED *);
    LPWSAOVERLAPPED_COMPLETION_ROUTINE *lpCompletionRoutine =
      va_arg(vl, LPWSAOVERLAPPED_COMPLETION_ROUTINE *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSASend() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSASendDisconnect | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1476 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    LPWSABUF *lpOutboundDisconnectData = va_arg(vl, LPWSABUF *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSASendDisconnect() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSASendTo | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1498 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    LPWSABUF *lpBuffers = va_arg(vl, LPWSABUF *);
    DWORD *dwBufferCount = va_arg(vl, DWORD *);
    LPDWORD *lpNumberOfBytesSent = va_arg(vl, LPDWORD *);
    DWORD *dwFlags = va_arg(vl, DWORD *);
    struct sockaddr FAR **lpTo = va_arg(vl, struct sockaddr FAR **);
    int *iTolen = va_arg(vl, int *);
    LPWSAOVERLAPPED *lpOverlapped = va_arg(vl, LPWSAOVERLAPPED *);
    LPWSAOVERLAPPED_COMPLETION_ROUTINE *lpCompletionRoutine =
      va_arg(vl, LPWSAOVERLAPPED_COMPLETION_ROUTINE *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSASendTo() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSASetBlockingHook | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1528 of file Handlers.Cpp.

{
    FARPROC *RetVal = (FARPROC *)ReturnValue;
    FARPROC *lpBlockFunc = va_arg(vl, FARPROC *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSASetBlockingHook() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSASetEvent | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1549 of file Handlers.Cpp.

{
    BOOL *RetVal = (BOOL *)ReturnValue;
    WSAEVENT *hEvent = va_arg(vl, WSAEVENT *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSASetEvent() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSASetLastError | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1570 of file Handlers.Cpp.

{
    // WSASetLastError returns void, so ReturnValue should be NULL
    int *iError = va_arg(vl, int *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSASetLastError() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSASetServiceA | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3542 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPWSAQUERYSETA *lpqsRegInfo = va_arg(vl, LPWSAQUERYSETA*);
    WSAESETSERVICEOP *essOperation = va_arg(vl, WSAESETSERVICEOP*);
    DWORD *dwControlFlags = va_arg(vl, DWORD*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSASetServiceA() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSASetServiceW | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3566 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPWSAQUERYSETW *lpqsRegInfo = va_arg(vl, LPWSAQUERYSETW*);
    WSAESETSERVICEOP *essOperation = va_arg(vl, WSAESETSERVICEOP*);
    DWORD *dwControlFlags = va_arg(vl, DWORD*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSASetServiceW() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSASocketA | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1591 of file Handlers.Cpp.

{
    SOCKET *RetVal = (SOCKET *)ReturnValue;
    int *af = va_arg(vl, int *);
    int *type = va_arg(vl, int *);
    int *protocol = va_arg(vl, int *);
    LPWSAPROTOCOL_INFOA *lpProtocolInfo = va_arg(vl, LPWSAPROTOCOL_INFOA *);
    GROUP *g = va_arg(vl, GROUP *);
    DWORD *dwFlags = va_arg(vl, DWORD *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSASocketA() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSASocketW | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1617 of file Handlers.Cpp.

{
    SOCKET *RetVal = (SOCKET *)ReturnValue;
    int *af = va_arg(vl, int *);
    int *type = va_arg(vl, int *);
    int *protocol = va_arg(vl, int *);
    LPWSAPROTOCOL_INFOW *lpProtocolInfo = va_arg(vl, LPWSAPROTOCOL_INFOW *);
    GROUP *g = va_arg(vl, GROUP *);
    DWORD *dwFlags = va_arg(vl, DWORD *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSASocketW() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAStartup | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1643 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    WORD *wVersionRequested = va_arg(vl, WORD *);
    LPWSADATA *lpWSAData = va_arg(vl, LPWSADATA *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAStartup() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAStringToAddressA | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3268 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPSTR *AddressString = va_arg(vl, LPSTR*);
    INT *AddressFamily = va_arg(vl, INT *);
    LPWSAPROTOCOL_INFOA *lpProtocolInfo = va_arg(vl, LPWSAPROTOCOL_INFOA*);
    LPSOCKADDR *lpAddress = va_arg(vl, LPSOCKADDR*);
    LPINT *lpAddressLength = va_arg(vl, LPINT*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAStringToAddressA() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAStringToAddressW | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3293 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPWSTR *AddressString = va_arg(vl, LPWSTR*);
    INT *AddressFamily = va_arg(vl, INT *);
    LPWSAPROTOCOL_INFOW *lpProtocolInfo = va_arg(vl, LPWSAPROTOCOL_INFOW*);
    LPSOCKADDR *lpAddress = va_arg(vl, LPSOCKADDR*);
    LPINT *lpAddressLength = va_arg(vl, LPINT*);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAStringToAddressW() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAUnhookBlockingHook | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1665 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAUnhookBlockingHook() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSAWaitForMultipleEvents | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 1685 of file Handlers.Cpp.

{
    DWORD *RetVal = (DWORD *)ReturnValue;
    DWORD *cEvents = va_arg(vl, DWORD *);
    WSAEVENT FAR **lphEvents = va_arg(vl, WSAEVENT FAR **);
    BOOL *fWaitAll = va_arg(vl, BOOL *);
    DWORD *dwTimeout = va_arg(vl, DWORD *);
    BOOL *fAlertable = va_arg(vl, BOOL *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSAWaitForMultipleEvents() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut(LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSCDeinstallProvider | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2912 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    DWORD *dwProviderId = va_arg(vl, DWORD *);
    LPINT *lpErrno = va_arg(vl, LPINT *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSCDeinstallProvider() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSCEnumProtocols | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 3170 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    LPINT *lpiProtocols = va_arg(vl, LPINT *);
    LPWSAPROTOCOL_INFO *lpProtocolBuffer = va_arg(vl, LPWSAPROTOCOL_INFO *);
    LPDWORD *lpdwBufferLength = va_arg(vl, LPDWORD *);
    LPINT *lpErrno = va_arg(vl, LPINT *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSCEnumProtocols() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSCInstallProvider | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2934 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    char FAR **lpszProviderName = va_arg(vl, char FAR **);
    char FAR **lpszProviderDllPath = va_arg(vl, char FAR **);
    LPWSAPROTOCOL_INFO *lpProtocolInfoList = va_arg(vl, LPWSAPROTOCOL_INFO *);
    DWORD *dwNumberOfEntries = va_arg(vl, DWORD *);
    LPDWORD *lpdwProviderId = va_arg(vl, LPDWORD *);
    LPINT *lpErrno = va_arg(vl, LPINT *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSCInstallProvider() %s.\r\n",
         PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPAccept | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2079 of file Handlers.Cpp.

{
    SOCKET *RetVal = (SOCKET *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    struct sockaddr FAR **addr = va_arg(vl, struct sockaddr FAR **);
    INT FAR **addrlen = va_arg(vl, INT FAR **);
    LPCONDITIONPROC *lpfnCondition = va_arg(vl, LPCONDITIONPROC *);
    DWORD *dwCallbackData = va_arg(vl, DWORD *);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPAccept() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPAsyncSelect | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2105 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    HWND *hWnd = va_arg(vl, HWND *);
    unsigned int *wMsg = va_arg(vl, unsigned int *);
    long *lEvent = va_arg(vl, long *);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPAsyncSelect() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPBind | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2130 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    struct sockaddr FAR **name = va_arg(vl, struct sockaddr FAR **);
    INT *namelen = va_arg(vl, INT *);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPBind() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPCancelBlockingCall | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2154 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPCancelBlockingCall() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPCleanup | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2175 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPCleanup() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPCloseSocket | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2196 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPCloseSocket() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPConnect | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2218 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    struct sockaddr FAR **name = va_arg(vl, struct sockaddr FAR **);
    INT *namelen = va_arg(vl, INT *);
    LPWSABUF *lpCallerData = va_arg(vl, LPWSABUF *);
    LPWSABUF *lpCalleeData = va_arg(vl, LPWSABUF *);
    LPQOS *lpSQOS = va_arg(vl, LPQOS *);
    LPQOS *lpGQOS = va_arg(vl, LPQOS *);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPConnect() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPDuplicateSocket | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2246 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    DWORD *dwProcessID = va_arg(vl, DWORD *);
    LPWSAPROTOCOL_INFO *lpProtocolInfo = va_arg(vl, LPWSAPROTOCOL_INFO *);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPDuplicateSocket() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPEnumNetworkEvents | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2270 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    WSAEVENT *hEventObject = va_arg(vl, WSAEVENT *);
    LPWSANETWORKEVENTS *lpNetworkEvents = va_arg(vl, LPWSANETWORKEVENTS *);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPEnumNetworkEvents() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPEventSelect | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2294 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    WSAEVENT *hEventObject = va_arg(vl, WSAEVENT *);
    long *lNetworkEvents = va_arg(vl, long *);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPEventSelect() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPGetOverlappedResult | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2318 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    LPWSAOVERLAPPED *lpOverlapped = va_arg(vl, LPWSAOVERLAPPED *);
    LPDWORD *lpcbTransfer = va_arg(vl, LPDWORD *);
    BOOL *fWait = va_arg(vl, BOOL *);
    LPDWORD *lpdwFlags = va_arg(vl, LPDWORD *);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPGetOverlappedResult() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPGetPeerName | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2344 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    struct sockaddr FAR **name = va_arg(vl, struct sockaddr FAR **);
    INT FAR **namelen = va_arg(vl, INT FAR **);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPGetPeerName() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPGetQOSByName | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2419 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    LPWSABUF *lpQOSName = va_arg(vl, LPWSABUF *);
    LPQOS *lpQOS = va_arg(vl, LPQOS *);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPGetQOSByName() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPGetSockName | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2369 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    struct sockaddr FAR **name = va_arg(vl, struct sockaddr FAR **);
    INT FAR **namelen = va_arg(vl, INT FAR **);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPGetSockName() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPGetSockOpt | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2393 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    INT *level = va_arg(vl, INT *);
    INT *optname = va_arg(vl, INT *);
    char FAR **optval = va_arg(vl, char FAR **);
    INT FAR **optlen = va_arg(vl, INT FAR **);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPGetSockOpt() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPIoctl | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2443 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    DWORD *dwIoControlCode = va_arg(vl, DWORD *);
    LPVOID *lpvInBuffer = va_arg(vl, LPVOID *);
    DWORD *cbInBuffer = va_arg(vl, DWORD *);
    LPVOID *lpvOutBuffer = va_arg(vl, LPVOID *);
    DWORD *cbOutBuffer = va_arg(vl, DWORD *);
    LPDWORD *lpcbBytesReturned = va_arg(vl, LPDWORD *);
    LPWSAOVERLAPPED *lpOverlapped = va_arg(vl, LPWSAOVERLAPPED *);
    LPWSAOVERLAPPED_COMPLETION_ROUTINE *lpCompletionRoutine =
      va_arg(vl, LPWSAOVERLAPPED_COMPLETION_ROUTINE *);
    LPWSATHREADID *lpThreadId = va_arg(vl, LPWSATHREADID *);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPIoctl() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPJoinLeaf | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2475 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    struct sockaddr FAR **name = va_arg(vl, struct sockaddr FAR **);
    INT *namelen = va_arg(vl, INT *);
    LPWSABUF *lpCallerData = va_arg(vl, LPWSABUF *);
    LPWSABUF *lpCalleeData = va_arg(vl, LPWSABUF *);
    LPQOS *lpSQOS = va_arg(vl, LPQOS *);
    LPQOS *lpGQOS = va_arg(vl, LPQOS *);
    DWORD *dwFlags = va_arg(vl, DWORD *);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPJoinLeaf() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPListen | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2504 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    INT *backlog = va_arg(vl, INT *);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPListen() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPRecv | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2527 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    LPWSABUF *lpBuffers = va_arg(vl, LPWSABUF *);
    DWORD *dwBufferCount = va_arg(vl, DWORD *);
    LPDWORD *lpNumberOfBytesRecvd = va_arg(vl, LPDWORD *);
    LPDWORD *lpFlags = va_arg(vl, LPDWORD *);
    LPWSAOVERLAPPED *lpOverlapped = va_arg(vl, LPWSAOVERLAPPED *);
    LPWSAOVERLAPPED_COMPLETION_ROUTINE *lpCompletionRoutine =
      va_arg(vl, LPWSAOVERLAPPED_COMPLETION_ROUTINE *);
    LPWSATHREADID *lpThreadId = va_arg(vl, LPWSATHREADID *);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPRecv() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPRecvDisconnect | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2557 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    LPWSABUF *lpInboundDisconnectData = va_arg(vl, LPWSABUF *);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPRecvDisconnect() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPRecvFrom | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2580 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    LPWSABUF *lpBuffers = va_arg(vl, LPWSABUF *);
    DWORD *dwBufferCount = va_arg(vl, DWORD *);
    LPDWORD *lpNumberOfBytesRecvd = va_arg(vl, LPDWORD *);
    LPDWORD *lpFlags = va_arg(vl, LPDWORD *);
    struct sockaddr FAR **lpFrom = va_arg(vl, struct sockaddr FAR **);
    LPINT *lpFromlen = va_arg(vl, LPINT *);
    LPWSAOVERLAPPED *lpOverlapped = va_arg(vl, LPWSAOVERLAPPED *);
    LPWSAOVERLAPPED_COMPLETION_ROUTINE *lpCompletionRoutine =
      va_arg(vl, LPWSAOVERLAPPED_COMPLETION_ROUTINE *);
    LPWSATHREADID *lpThreadId = va_arg(vl, LPWSATHREADID *);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPRecvFrom() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPSelect | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2612 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    INT *nfds = va_arg(vl, INT *);
    fd_set FAR **readfds = va_arg(vl, fd_set FAR **);
    fd_set FAR **writefds = va_arg(vl, fd_set FAR **);
    fd_set FAR **exceptfds = va_arg(vl, fd_set FAR **);
    struct timeval FAR **timeout = va_arg(vl, struct timeval FAR **);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPSelect() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPSend | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2638 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    LPWSABUF *lpBuffers = va_arg(vl, LPWSABUF *);
    DWORD *dwBufferCount = va_arg(vl, DWORD *);
    LPDWORD *lpNumberOfBytesSent = va_arg(vl, LPDWORD *);
    DWORD *dwFlags = va_arg(vl, DWORD *);
    LPWSAOVERLAPPED *lpOverlapped = va_arg(vl, LPWSAOVERLAPPED *);
    LPWSAOVERLAPPED_COMPLETION_ROUTINE *lpCompletionRoutine =
      va_arg(vl, LPWSAOVERLAPPED_COMPLETION_ROUTINE *);
    LPWSATHREADID *lpThreadId = va_arg(vl, LPWSATHREADID *);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPSend() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPSendDisconnect | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2668 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    LPWSABUF *lpOutboundDisconnectData = va_arg(vl, LPWSABUF *);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPSendDisconnect() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPSendTo | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2691 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    LPWSABUF *lpBuffers = va_arg(vl, LPWSABUF *);
    DWORD *dbBufferCount = va_arg(vl, DWORD *);
    LPDWORD *lpNumberOfBytesSent = va_arg(vl, LPDWORD *);
    DWORD *dwFlags = va_arg(vl, DWORD *);
    struct sockaddr FAR **lpTo = va_arg(vl, struct sockaddr FAR **);
    INT *iTolen = va_arg(vl, INT *);
    LPWSAOVERLAPPED *lpOverlapped = va_arg(vl, LPWSAOVERLAPPED *);
    LPWSAOVERLAPPED_COMPLETION_ROUTINE *lpCompletionRoutine =
      va_arg(vl, LPWSAOVERLAPPED_COMPLETION_ROUTINE *);
    LPWSATHREADID *lpThreadId = va_arg(vl, LPWSATHREADID *);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPSendTo() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPSetSockOpt | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2723 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    INT *level = va_arg(vl, INT *);
    INT *optname = va_arg(vl, INT *);
    char FAR **optval = va_arg(vl, char FAR **);
    INT *optlen = va_arg(vl, INT *);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPSetSockOpt() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPShutdown | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2749 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    SOCKET *s = va_arg(vl, SOCKET *);
    INT *how = va_arg(vl, INT *);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPShutdown() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPSocket | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2772 of file Handlers.Cpp.

{
    INT *RetVal = (INT *)ReturnValue;
    int *af = va_arg(vl, int *);
    int *type = va_arg(vl, int *);
    int *protocol = va_arg(vl, int *);
    LPWSAPROTOCOL_INFO *lpProtocolInfo = va_arg(vl, LPWSAPROTOCOL_INFO *);
    GROUP *g = va_arg(vl, GROUP *);
    DWORD *dwFlags = va_arg(vl, DWORD *);
    INT FAR **lpErrno = va_arg(vl, INT FAR **);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPSocket() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL CALLBACK DTHandler_WSPStartup | ( | IN va_list | vl,
 |  | IN OUT LPVOID | ReturnValue,
 |  | IN LPSTR | LibraryName,
 |  | OUT char * | Buffer,
 |  | IN int | Index,
 |  | IN int | BufLen,
 |  | IN BOOL | PreOrPost
 | ) |  |

Definition at line 2799 of file Handlers.Cpp.

{
    int *RetVal = (int *)ReturnValue;
    WORD *wVersionRequested = va_arg(vl, WORD *);
    LPWSPDATA *lpWSPData = va_arg(vl, LPWSPDATA *);
    LPWSAPROTOCOL_INFOA *lpProtocolInfo = va_arg(vl, LPWSAPROTOCOL_INFOA *);
    WSPUPCALLTABLE *UpcallTable = va_arg(vl, WSPUPCALLTABLE *);
    LPWSPPROC_TABLE *lpProcTable = va_arg(vl, LPWSPPROC_TABLE *);

    _snprintf(Buffer + Index, BufLen - Index - 1,
            "WSPStartup() %s.\r\n",
             PreOrPost ? "called" : "returned");
    DTTextOut( LogFileHandle, Buffer, OutputStyle);
    return(FALSE);
}

BOOL DTHandlerInit | ( | OUT LPLPFNDTHANDLER | HandlerFuncTable,
 |  | int | NumEntries
 | ) |  |

Definition at line 43 of file Handlers.Cpp.

                      :

      Fills in the given HandlerFuncTable with pointers to all the
      appropriate handler functions, based on notification code.

  Arguments:

      HandlerFuncTable -- an uninitialized array of pointers of type
      LPFNDTHANDLER, which point to handler functions (see handlers.h)

      NumEntries -- the number of entries in the array.  Currently
      only used to zero out the array.

  Return Value:

      Always returns TRUE.

--*/
{
    memset((char *)HandlerFuncTable, 0, NumEntries * sizeof(LPFNDTHANDLER));

    HandlerFuncTable[DTCODE_accept] = DTHandler_accept;
    HandlerFuncTable[DTCODE_bind] = DTHandler_bind;
    HandlerFuncTable[DTCODE_closesocket] = DTHandler_closesocket;
    HandlerFuncTable[DTCODE_connect] = DTHandler_connect;
    HandlerFuncTable[DTCODE_getpeername] = DTHandler_getpeername;
    HandlerFuncTable[DTCODE_getsockname] = DTHandler_getsockname;
    HandlerFuncTable[DTCODE_getsockopt] = DTHandler_getsockopt;
    HandlerFuncTable[DTCODE_htonl] = DTHandler_htonl;
    HandlerFuncTable[DTCODE_htons] = DTHandler_htons;
    HandlerFuncTable[DTCODE_ioctlsocket] = DTHandler_ioctlsocket;
    HandlerFuncTable[DTCODE_listen] = DTHandler_listen;
    HandlerFuncTable[DTCODE_ntohl] = DTHandler_ntohl;
    HandlerFuncTable[DTCODE_ntohs] = DTHandler_ntohs;
    HandlerFuncTable[DTCODE_recv] = DTHandler_recv;
    HandlerFuncTable[DTCODE_recvfrom] = DTHandler_recvfrom;
    HandlerFuncTable[DTCODE_select] = DTHandler_select;
    HandlerFuncTable[DTCODE_send] = DTHandler_send;
    HandlerFuncTable[DTCODE_sendto] = DTHandler_sendto;
    HandlerFuncTable[DTCODE_setsockopt] = DTHandler_setsockopt;
    HandlerFuncTable[DTCODE_shutdown] = DTHandler_shutdown;
    HandlerFuncTable[DTCODE_socket] = DTHandler_socket;
    HandlerFuncTable[DTCODE_WSAAccept] = DTHandler_WSAAccept;
    HandlerFuncTable[DTCODE_WSAAsyncSelect] = DTHandler_WSAAsyncSelect;
    HandlerFuncTable[DTCODE_WSACancelBlockingCall] =
      DTHandler_WSACancelBlockingCall;
    HandlerFuncTable[DTCODE_WSACleanup] = DTHandler_WSACleanup;
    HandlerFuncTable[DTCODE_WSACloseEvent] = DTHandler_WSACloseEvent;
    HandlerFuncTable[DTCODE_WSAConnect] = DTHandler_WSAConnect;
    HandlerFuncTable[DTCODE_WSACreateEvent] = DTHandler_WSACreateEvent;
    HandlerFuncTable[DTCODE_WSADuplicateSocketA] =
      DTHandler_WSADuplicateSocketA;
    HandlerFuncTable[DTCODE_WSADuplicateSocketW] =
      DTHandler_WSADuplicateSocketW;
    HandlerFuncTable[DTCODE_WSAEnumNetworkEvents] =
      DTHandler_WSAEnumNetworkEvents;
    HandlerFuncTable[DTCODE_WSAEnumProtocolsA] = DTHandler_WSAEnumProtocolsA;
    HandlerFuncTable[DTCODE_WSAEnumProtocolsW] = DTHandler_WSAEnumProtocolsW;
    HandlerFuncTable[DTCODE_WSAEventSelect] = DTHandler_WSAEventSelect;
    HandlerFuncTable[DTCODE_WSAGetLastError] = DTHandler_WSAGetLastError;
    HandlerFuncTable[DTCODE_WSAGetOverlappedResult] =
      DTHandler_WSAGetOverlappedResult;
    HandlerFuncTable[DTCODE_WSAGetQOSByName] = DTHandler_WSAGetQOSByName;
    HandlerFuncTable[DTCODE_WSAHtonl] = DTHandler_WSAHtonl;
    HandlerFuncTable[DTCODE_WSAHtons] = DTHandler_WSAHtons;
    HandlerFuncTable[DTCODE_WSAIoctl] = DTHandler_WSAIoctl;
    HandlerFuncTable[DTCODE_WSAIsBlocking] = DTHandler_WSAIsBlocking;
    HandlerFuncTable[DTCODE_WSAJoinLeaf] = DTHandler_WSAJoinLeaf;
    HandlerFuncTable[DTCODE_WSANtohl] = DTHandler_WSANtohl;
    HandlerFuncTable[DTCODE_WSANtohs] = DTHandler_WSANtohs;
    HandlerFuncTable[DTCODE_WSARecv] = DTHandler_WSARecv;
    HandlerFuncTable[DTCODE_WSARecvDisconnect] =
      DTHandler_WSARecvDisconnect;
    HandlerFuncTable[DTCODE_WSARecvFrom] = DTHandler_WSARecvFrom;
    HandlerFuncTable[DTCODE_WSAResetEvent] = DTHandler_WSAResetEvent;
    HandlerFuncTable[DTCODE_WSASend] = DTHandler_WSASend;
    HandlerFuncTable[DTCODE_WSASendDisconnect] =
      DTHandler_WSASendDisconnect;
    HandlerFuncTable[DTCODE_WSASendTo] = DTHandler_WSASendTo;
    HandlerFuncTable[DTCODE_WSASetBlockingHook] =
      DTHandler_WSASetBlockingHook;
    HandlerFuncTable[DTCODE_WSASetEvent] = DTHandler_WSASetEvent;
    HandlerFuncTable[DTCODE_WSASetLastError] = DTHandler_WSASetLastError;
    HandlerFuncTable[DTCODE_WSASocketA] = DTHandler_WSASocketA;
    HandlerFuncTable[DTCODE_WSASocketW] = DTHandler_WSASocketW;
    HandlerFuncTable[DTCODE_WSAStartup] = DTHandler_WSAStartup;
    HandlerFuncTable[DTCODE_WSAUnhookBlockingHook] =
      DTHandler_WSAUnhookBlockingHook;
    HandlerFuncTable[DTCODE_WSAWaitForMultipleEvents] =
      DTHandler_WSAWaitForMultipleEvents;
    HandlerFuncTable[DTCODE_gethostbyaddr] = DTHandler_gethostbyaddr;
    HandlerFuncTable[DTCODE_gethostbyname] = DTHandler_gethostbyname;
    HandlerFuncTable[DTCODE_gethostname] = DTHandler_gethostname;
    HandlerFuncTable[DTCODE_getprotobyname] = DTHandler_getprotobyname;
    HandlerFuncTable[DTCODE_getprotobynumber] = DTHandler_getprotobynumber;
    HandlerFuncTable[DTCODE_getservbyname] = DTHandler_getservbyname;
    HandlerFuncTable[DTCODE_getservbyport] = DTHandler_getservbyport;
    HandlerFuncTable[DTCODE_inet_addr] = DTHandler_inet_addr;
    HandlerFuncTable[DTCODE_inet_ntoa] = DTHandler_inet_ntoa;
    HandlerFuncTable[DTCODE_WSAAsyncGetHostByAddr] =
      DTHandler_WSAAsyncGetHostByAddr;
    HandlerFuncTable[DTCODE_WSAAsyncGetHostByName] =
      DTHandler_WSAAsyncGetHostByName;
    HandlerFuncTable[DTCODE_WSAAsyncGetProtoByName] =
      DTHandler_WSAAsyncGetProtoByName;
    HandlerFuncTable[DTCODE_WSAAsyncGetProtoByNumber] =
      DTHandler_WSAAsyncGetProtoByNumber;
    HandlerFuncTable[DTCODE_WSAAsyncGetServByName] =
      DTHandler_WSAAsyncGetServByName;
    HandlerFuncTable[DTCODE_WSAAsyncGetServByPort] =
      DTHandler_WSAAsyncGetServByPort;
    HandlerFuncTable[DTCODE_WSACancelAsyncRequest] =
      DTHandler_WSACancelAsyncRequest;
    HandlerFuncTable[DTCODE_WSPAccept] = DTHandler_WSPAccept;
    HandlerFuncTable[DTCODE_WSPAsyncSelect] = DTHandler_WSPAsyncSelect;
    HandlerFuncTable[DTCODE_WSPBind] = DTHandler_WSPBind;
    HandlerFuncTable[DTCODE_WSPCancelBlockingCall] =
      DTHandler_WSPCancelBlockingCall;
    HandlerFuncTable[DTCODE_WSPCleanup] = DTHandler_WSPCleanup;
    HandlerFuncTable[DTCODE_WSPCloseSocket] = DTHandler_WSPCloseSocket;
    HandlerFuncTable[DTCODE_WSPConnect] = DTHandler_WSPConnect;
    HandlerFuncTable[DTCODE_WSPDuplicateSocket] =
      DTHandler_WSPDuplicateSocket;
    HandlerFuncTable[DTCODE_WSPEnumNetworkEvents] =
      DTHandler_WSPEnumNetworkEvents;
    HandlerFuncTable[DTCODE_WSPEventSelect] = DTHandler_WSPEventSelect;
    HandlerFuncTable[DTCODE_WSPGetOverlappedResult] =
      DTHandler_WSPGetOverlappedResult;
    HandlerFuncTable[DTCODE_WSPGetPeerName] = DTHandler_WSPGetPeerName;
    HandlerFuncTable[DTCODE_WSPGetSockName] = DTHandler_WSPGetSockName;
    HandlerFuncTable[DTCODE_WSPGetSockOpt] = DTHandler_WSPGetSockOpt;
    HandlerFuncTable[DTCODE_WSPGetQOSByName] = DTHandler_WSPGetQOSByName;
    HandlerFuncTable[DTCODE_WSPIoctl] = DTHandler_WSPIoctl;
    HandlerFuncTable[DTCODE_WSPJoinLeaf] = DTHandler_WSPJoinLeaf;
    HandlerFuncTable[DTCODE_WSPListen] = DTHandler_WSPListen;
    HandlerFuncTable[DTCODE_WSPRecv] = DTHandler_WSPRecv;
    HandlerFuncTable[DTCODE_WSPRecvDisconnect] =
      DTHandler_WSPRecvDisconnect;
    HandlerFuncTable[DTCODE_WSPRecvFrom] = DTHandler_WSPRecvFrom;
    HandlerFuncTable[DTCODE_WSPSelect] = DTHandler_WSPSelect;
    HandlerFuncTable[DTCODE_WSPSend] = DTHandler_WSPSend;
    HandlerFuncTable[DTCODE_WSPSendDisconnect] =
      DTHandler_WSPSendDisconnect;
    HandlerFuncTable[DTCODE_WSPSendTo] = DTHandler_WSPSendTo;
    HandlerFuncTable[DTCODE_WSPSetSockOpt] = DTHandler_WSPSetSockOpt;
    HandlerFuncTable[DTCODE_WSPShutdown] = DTHandler_WSPShutdown;
    HandlerFuncTable[DTCODE_WSPSocket] = DTHandler_WSPSocket;
    HandlerFuncTable[DTCODE_WSPStartup] = DTHandler_WSPStartup;
    HandlerFuncTable[DTCODE_WPUCloseEvent] = DTHandler_WPUCloseEvent;
    HandlerFuncTable[DTCODE_WPUCloseSocketHandle] =
      DTHandler_WPUCloseSocketHandle;
    HandlerFuncTable[DTCODE_WPUCreateEvent] = DTHandler_WPUCreateEvent;
    HandlerFuncTable[DTCODE_WPUCreateSocketHandle] =
      DTHandler_WPUCreateSocketHandle;
    HandlerFuncTable[DTCODE_WSCDeinstallProvider] =
      DTHandler_WSCDeinstallProvider;
    HandlerFuncTable[DTCODE_WSCInstallProvider] =
      DTHandler_WSCInstallProvider;
    HandlerFuncTable[DTCODE_WPUModifyIFSHandle] =
      DTHandler_WPUModifyIFSHandle;
    HandlerFuncTable[DTCODE_WPUQueryBlockingCallback] =
      DTHandler_WPUQueryBlockingCallback;
    HandlerFuncTable[DTCODE_WPUQuerySocketHandleContext] =
      DTHandler_WPUQuerySocketHandleContext;
    HandlerFuncTable[DTCODE_WPUQueueApc] = DTHandler_WPUQueueApc;
    HandlerFuncTable[DTCODE_WPUResetEvent] = DTHandler_WPUResetEvent;
    HandlerFuncTable[DTCODE_WPUSetEvent] = DTHandler_WPUSetEvent;
    HandlerFuncTable[DTCODE_WSCEnumProtocols] = DTHandler_WSCEnumProtocols;
    HandlerFuncTable[DTCODE_WPUGetProviderPath] = DTHandler_WPUGetProviderPath;
    HandlerFuncTable[DTCODE_WPUPostMessage] = DTHandler_WPUPostMessage;
    HandlerFuncTable[DTCODE_WPUFDIsSet] = DTHandler_WPUFDIsSet;
    HandlerFuncTable[DTCODE___WSAFDIsSet] = DTHandler___WSAFDIsSet;
    HandlerFuncTable[DTCODE_WSAAddressToStringA] =
        DTHandler_WSAAddressToStringA;
    HandlerFuncTable[DTCODE_WSAAddressToStringW] =
        DTHandler_WSAAddressToStringW;
    HandlerFuncTable[DTCODE_WSAStringToAddressA] =
        DTHandler_WSAStringToAddressA;
    HandlerFuncTable[DTCODE_WSAStringToAddressW] =
        DTHandler_WSAStringToAddressW;
    HandlerFuncTable[DTCODE_WSALookupServiceBeginA] =
        DTHandler_WSALookupServiceBeginA;
    HandlerFuncTable[DTCODE_WSALookupServiceBeginW] =
        DTHandler_WSALookupServiceBeginW;
    HandlerFuncTable[DTCODE_WSALookupServiceNextA] =
        DTHandler_WSALookupServiceNextA;
    HandlerFuncTable[DTCODE_WSALookupServiceNextW] =
        DTHandler_WSALookupServiceNextW;
    HandlerFuncTable[DTCODE_WSALookupServiceEnd] =
        DTHandler_WSALookupServiceEnd;
    HandlerFuncTable[DTCODE_WSAInstallServiceClassA] =
        DTHandler_WSAInstallServiceClassA;
    HandlerFuncTable[DTCODE_WSAInstallServiceClassW] =
        DTHandler_WSAInstallServiceClassW;
    HandlerFuncTable[DTCODE_WSASetServiceA] =
        DTHandler_WSASetServiceA;
    HandlerFuncTable[DTCODE_WSASetServiceW] =
        DTHandler_WSASetServiceW;
    HandlerFuncTable[DTCODE_WSARemoveServiceClass] =
        DTHandler_WSARemoveServiceClass;
    HandlerFuncTable[DTCODE_WSAGetServiceClassInfoA] =
        DTHandler_WSAGetServiceClassInfoA;
    HandlerFuncTable[DTCODE_WSAGetServiceClassInfoW] =
        DTHandler_WSAGetServiceClassInfoW;
    HandlerFuncTable[DTCODE_WSAEnumNameSpaceProvidersA] =
        DTHandler_WSAEnumNameSpaceProvidersA;
    HandlerFuncTable[DTCODE_WSAEnumNameSpaceProvidersW] =
        DTHandler_WSAEnumNameSpaceProvidersW;
    HandlerFuncTable[DTCODE_WSAGetServiceClassNameByClassIdA] =
        DTHandler_WSAGetServiceClassNameByClassIdA;
    HandlerFuncTable[DTCODE_WSAGetServiceClassNameByClassIdW] =
        DTHandler_WSAGetServiceClassNameByClassIdW;
    HandlerFuncTable[DTCODE_NSPLookupServiceBegin] =
        DTHandler_NSPLookupServiceBegin;
    HandlerFuncTable[DTCODE_NSPLookupServiceNext] =
        DTHandler_NSPLookupServiceNext;
    HandlerFuncTable[DTCODE_NSPLookupServiceEnd] =
        DTHandler_NSPLookupServiceEnd;
    HandlerFuncTable[DTCODE_NSPInstallServiceClass] =
        DTHandler_NSPInstallServiceClass;
    HandlerFuncTable[DTCODE_NSPSetService] =
        DTHandler_NSPSetService;
    HandlerFuncTable[DTCODE_NSPRemoveServiceClass] =
        DTHandler_NSPRemoveServiceClass;
    HandlerFuncTable[DTCODE_NSPGetServiceClassInfo] =
        DTHandler_NSPGetServiceClassInfo;

    return(TRUE);
}

Generated on Wed Nov 13 2024 16:54:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/Dt_Dll/HuError.Cpp File Reference

  • NetDS
  • WinSock
  • Dt_Dll
Functions

HuError.Cpp File Reference

#include "nowarn.h"
#include <stdio.h>
#include "huerror.h"

Go to the source code of this file.

Functions

ErrorCode_e HUGetLastError ()
void | HUPrintError (char *func, ErrorCode_e ErrorCode)
void | HUSetLastError (ErrorCode_e ErrorCode)

Function Documentation

ErrorCode_e HUGetLastError ( )

Definition at line 26 of file HuError.Cpp.

{
  return HULastError;
}

void HUPrintError | ( | char * | func,
 |  | ErrorCode_e | ErrorCode
 | ) |  |

Definition at line 31 of file HuError.Cpp.

{
  if(func == NULL){
    printf("Error: - - ");
  }else{
    printf("Error: %s - - ",func);
  }
  switch(ErrorCode){
    case ENONE:
  printf("No error\n");
  break;
    case ALLOCERROR:
  printf("Allocation error\n");
  break;
    case INVALIDARG:
  printf("Invalid arguement passed in\n");
  break;
    case OBJNOTINIT:
  printf("Object not initialized\n");
  break;
    case OBJEFFERROR:
  printf("Object becoming ineffecient. Trying making it large\n");
  break;
    case ALREADYCONN:
  printf("Already connected\n");
  break;
    default:
      printf("ErrorCode not defined\n");
  }
}

void HUSetLastError ( ErrorCode_e ErrorCode )

Definition at line 21 of file HuError.Cpp.

{
  HULastError = ErrorCode;
}

Generated on Wed Nov 13 2024 16:54:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/Dt_Dll/HuError.h File Reference

  • NetDS
  • WinSock
  • Dt_Dll
Enumerations | Functions | Variables

HuError.h File Reference

#include <stdarg.h>

Go to the source code of this file.

Enumerations

enum ErrorCode_e {
ENONE = ERRORSTART, OTHERERROR, ALLOCERROR, INVALIDARG,
OBJNOTINIT, OBJEFFERROR, ALREADYCONN, ALREADYLIST
}

Functions

ErrorCode_e HUGetLastError ()
void | HUPrintError (char *func, ErrorCode_e ErrorCode=ENONE)
void | HUSetLastError (ErrorCode_e ErrorCode)

Variables

const int | ERRORSTART = 0x100

Enumeration Type Documentation

enum ErrorCode_e
Enumerator:
ENONE
OTHERERROR
ALLOCERROR
INVALIDARG
OBJNOTINIT
OBJEFFERROR
ALREADYCONN
ALREADYLIST

Definition at line 22 of file HuError.h.

             {  ENONE     = ERRORSTART,
                OTHERERROR,
                ALLOCERROR,
                INVALIDARG,
                OBJNOTINIT,
    OBJEFFERROR,  // Object effeciency error.
    ALREADYCONN,
    ALREADYLIST
             } ErrorCode_e;

Function Documentation

ErrorCode_e HUGetLastError ( )

Definition at line 26 of file HuError.Cpp.

{
  return HULastError;
}

void HUPrintError | ( | char * | func,
 |  | ErrorCode_e | ErrorCode = ENONE
 | ) |  |

Definition at line 31 of file HuError.Cpp.

{
  if(func == NULL){
    printf("Error: - - ");
  }else{
    printf("Error: %s - - ",func);
  }
  switch(ErrorCode){
    case ENONE:
  printf("No error\n");
  break;
    case ALLOCERROR:
  printf("Allocation error\n");
  break;
    case INVALIDARG:
  printf("Invalid arguement passed in\n");
  break;
    case OBJNOTINIT:
  printf("Object not initialized\n");
  break;
    case OBJEFFERROR:
  printf("Object becoming ineffecient. Trying making it large\n");
  break;
    case ALREADYCONN:
  printf("Already connected\n");
  break;
    default:
      printf("ErrorCode not defined\n");
  }
}

void HUSetLastError ( ErrorCode_e ErrorCode )

Definition at line 21 of file HuError.Cpp.

{
  HULastError = ErrorCode;
}

Variable Documentation

const int ERRORSTART = 0x100

Definition at line 20 of file HuError.h.

Generated on Wed Nov 13 2024 16:54:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/Dt_Dll/Nideque.h File Reference

  • NetDS
  • WinSock
  • Dt_Dll
Classes | Defines

Nideque.h File Reference

#include "nowarn.h"
#include <windows.h>
#include "huerror.h"

Go to the source code of this file.

Classes

class | NIDeque_c< T >
class | NIDequeIter_c< T >
class | NILNode_c< T >

Defines

#define | _WINSOCKAPI_

Define Documentation

#define _WINSOCKAPI_

Definition at line 26 of file Nideque.h.

Generated on Wed Nov 13 2024 16:54:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/Dt_Dll/NoWarn.h File Reference

  • NetDS
  • WinSock
  • Dt_Dll

NoWarn.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/Dt_Dll/Stack.h File Reference

  • NetDS
  • WinSock
  • Dt_Dll
Classes | Defines

Stack.h File Reference

#include "nowarn.h"
#include <windows.h>
#include "nideque.h"

Go to the source code of this file.

Classes

class | Stack_c< T >

Defines

#define | _WINSOCKAPI_

Define Documentation

#define _WINSOCKAPI_

Definition at line 20 of file Stack.h.

Generated on Wed Nov 13 2024 16:54:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/Dt_Dll2/ApiHook.Hpp File Reference

  • NetDS
  • WinSock
  • Dt_Dll2
Classes

ApiHook.Hpp File Reference

Go to the source code of this file.

Classes

class APIHook< T >
Generated on Wed Nov 13 2024 16:54:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/Dt_Dll2/Dt_Dll.Cpp File Reference

  • NetDS
  • WinSock
  • Dt_Dll2
Functions | Variables

Dt_Dll.Cpp File Reference

#include "SocketMon.hpp"

Go to the source code of this file.

Functions

BOOL WINAPI | DllMain (HINSTANCE, DWORD reason, LPVOID)
BOOL WINAPIV | WSAPostApiNotify (IN INT NotificationCode, OUT LPVOID ReturnCode, IN LPSTR LibraryName,...)
BOOL WINAPIV | WSAPreApiNotify (IN INT NotificationCode, OUT LPVOID ReturnCode, IN LPSTR LibraryName,...)

Variables

SocketMonitor gSocketMonitor

Function Documentation

BOOL WINAPI DllMain | ( | HINSTANCE | ,
 |  | DWORD | reason,
 |  | LPVOID |
 | ) |  |

Definition at line 22 of file Dt_Dll.Cpp.

                                         {

    switch (reason) {

        case DLL_PROCESS_ATTACH :
            break;

        case DLL_THREAD_ATTACH :
            break;

        case DLL_PROCESS_DETACH :
            break;

        case DLL_THREAD_DETACH :
            break;

        default :
            return (FALSE);

    } // switch (reason)

    return (TRUE);

} // DllMain

BOOL WINAPIV WSAPostApiNotify | ( | IN INT | NotificationCode,
 |  | OUT LPVOID | ReturnCode,
 |  | IN LPSTR | LibraryName,
 |  |  | ...
 | ) |  |

Definition at line 105 of file Dt_Dll.Cpp.

                                                                                {

  va_list vl;

  // Protect against system calls within the hook; save the previous error.
  const int lastError = GetLastError();

  va_start(vl, LibraryName);
  BOOL rVal = gSocketMonitor.dispatch(NotificationCode, ReturnCode, LibraryName, false, vl);
  va_end(vl);

  // Restore the previous error.
  SetLastError(lastError);

  return (rVal);

} // WSAPostApiNotify

BOOL WINAPIV WSAPreApiNotify | ( | IN INT | NotificationCode,
 |  | OUT LPVOID | ReturnCode,
 |  | IN LPSTR | LibraryName,
 |  |  | ...
 | ) |  |

Definition at line 71 of file Dt_Dll.Cpp.

                                                                                {

    va_list vl;

    // Protect against system calls within the hook; save the previous error.
    const int lastError = GetLastError();

    va_start(vl, LibraryName);
    BOOL rVal = gSocketMonitor.dispatch(NotificationCode, ReturnCode, LibraryName, true, vl);
    va_end(vl);

    // Restore the previous error.
    SetLastError(lastError);

    return (rVal);

} // WSAPreApiNotify

Variable Documentation

SocketMonitor gSocketMonitor

Definition at line 18 of file Dt_Dll.Cpp.

Generated on Wed Nov 13 2024 16:54:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/Dt_Dll2/Dt_Dll.Hpp File Reference

  • NetDS
  • WinSock
  • Dt_Dll2
Defines

Dt_Dll.Hpp File Reference

Go to the source code of this file.

Defines

#define | DTCODE___WSAFDIsSet 122
#define | DTCODE_accept 1
#define | DTCODE_bind 2
#define | DTCODE_closesocket 3
#define | DTCODE_connect 4
#define | DTCODE_freeaddrinfo 172
#define | DTCODE_getaddrinfo 170
#define | DTCODE_gethostbyaddr 57
#define | DTCODE_gethostbyname 58
#define | DTCODE_gethostname 59
#define | DTCODE_getnameinfo 171
#define | DTCODE_getpeername 5
#define | DTCODE_getprotobyname 60
#define | DTCODE_getprotobynumber 61
#define | DTCODE_getservbyname 62
#define | DTCODE_getservbyport 63
#define | DTCODE_getsockname 6
#define | DTCODE_getsockopt 7
#define | DTCODE_htonl 8
#define | DTCODE_htons 9
#define | DTCODE_inet_addr 64
#define | DTCODE_inet_ntoa 65
#define | DTCODE_ioctlsocket 10
#define | DTCODE_listen 11
#define | DTCODE_NSPAddressToString 145
#define | DTCODE_NSPGetAddressByName 150
#define | DTCODE_NSPGetServiceClassInfo 154
#define | DTCODE_NSPGetServiceClassNameByClassId 156
#define | DTCODE_NSPInstallServiceClass 151
#define | DTCODE_NSPIoctl 164
#define | DTCODE_NSPLookupServiceBegin 147
#define | DTCODE_NSPLookupServiceEnd 149
#define | DTCODE_NSPLookupServiceNext 148
#define | DTCODE_NSPRemoveServiceClass 153
#define | DTCODE_NSPSetService 152
#define | DTCODE_NSPStartup 173
#define | DTCODE_NSPStringToAddress 146
#define | DTCODE_ntohl 12
#define | DTCODE_ntohs 13
#define | DTCODE_recv 14
#define | DTCODE_recvfrom 15
#define | DTCODE_select 16
#define | DTCODE_send 17
#define | DTCODE_sendto 18
#define | DTCODE_setsockopt 19
#define | DTCODE_shutdown 20
#define | DTCODE_socket 21
#define | DTCODE_WPUCloseEvent 103
#define | DTCODE_WPUCloseSocketHandle 104
#define | DTCODE_WPUCloseThread 175
#define | DTCODE_WPUCompleteOverlappedRequest 165
#define | DTCODE_WPUCreateEvent 105
#define | DTCODE_WPUCreateSocketHandle 106
#define | DTCODE_WPUFDIsSet 118
#define | DTCODE_WPUGetProviderPath 116
#define | DTCODE_WPUModifyIFSHandle 109
#define | DTCODE_WPUOpenCurrentThread 174
#define | DTCODE_WPUPostMessage 117
#define | DTCODE_WPUQueryBlockingCallback 110
#define | DTCODE_WPUQuerySocketHandleContext 111
#define | DTCODE_WPUQueueApc 112
#define | DTCODE_WPUResetEvent 113
#define | DTCODE_WPUSetEvent 114
#define | DTCODE_WSAAccept 22
#define | DTCODE_WSAAddressToStringA 123
#define | DTCODE_WSAAddressToStringW 124
#define | DTCODE_WSAAsyncGetHostByAddr 66
#define | DTCODE_WSAAsyncGetHostByName 67
#define | DTCODE_WSAAsyncGetProtoByName 68
#define | DTCODE_WSAAsyncGetProtoByNumber 69
#define | DTCODE_WSAAsyncGetServByName 70
#define | DTCODE_WSAAsyncGetServByPort 71
#define | DTCODE_WSAAsyncSelect 23
#define | DTCODE_WSACancelAsyncRequest 72
#define | DTCODE_WSACancelBlockingCall 24
#define | DTCODE_WSACleanup 25
#define | DTCODE_WSACloseEvent 26
#define | DTCODE_WSAConnect 27
#define | DTCODE_WSACreateEvent 28
#define | DTCODE_WSADuplicateSocketA 29
#define | DTCODE_WSADuplicateSocketW 119
#define | DTCODE_WSAEnumNameSpaceProvidersA 141
#define | DTCODE_WSAEnumNameSpaceProvidersW 142
#define | DTCODE_WSAEnumNetworkEvents 30
#define | DTCODE_WSAEnumProtocolsA 31
#define | DTCODE_WSAEnumProtocolsW 120
#define | DTCODE_WSAEventSelect 32
#define | DTCODE_WSAGetLastError 33
#define | DTCODE_WSAGetOverlappedResult 34
#define | DTCODE_WSAGetQOSByName 35
#define | DTCODE_WSAGetServiceClassInfoA 139
#define | DTCODE_WSAGetServiceClassInfoW 140
#define | DTCODE_WSAGetServiceClassNameByClassIdA 143
#define | DTCODE_WSAGetServiceClassNameByClassIdW 144
#define | DTCODE_WSAHtonl 36
#define | DTCODE_WSAHtons 37
#define | DTCODE_WSAInstallServiceClassA 134
#define | DTCODE_WSAInstallServiceClassW 135
#define | DTCODE_WSAIoctl 38
#define | DTCODE_WSAIsBlocking 39
#define | DTCODE_WSAJoinLeaf 40
#define | DTCODE_WSALookupServiceBeginA 127
#define | DTCODE_WSALookupServiceBeginW 128
#define | DTCODE_WSALookupServiceEnd 131
#define | DTCODE_WSALookupServiceNextA 129
#define | DTCODE_WSALookupServiceNextW 130
#define | DTCODE_WSANSPIoctl 163
#define | DTCODE_WSANtohl 41
#define | DTCODE_WSANtohs 42
#define | DTCODE_WSAProviderConfigChange 166
#define | DTCODE_WSARecv 43
#define | DTCODE_WSARecvDisconnect 44
#define | DTCODE_WSARecvFrom 45
#define | DTCODE_WSARemoveServiceClass 138
#define | DTCODE_WSAResetEvent 46
#define | DTCODE_WSASend 47
#define | DTCODE_WSASendDisconnect 48
#define | DTCODE_WSASendTo 49
#define | DTCODE_WSASetBlockingHook 50
#define | DTCODE_WSASetEvent 51
#define | DTCODE_WSASetLastError 52
#define | DTCODE_WSASetServiceA 136
#define | DTCODE_WSASetServiceW 137
#define | DTCODE_WSASocketA 53
#define | DTCODE_WSASocketW 121
#define | DTCODE_WSAStartup 54
#define | DTCODE_WSAStringToAddressA 125
#define | DTCODE_WSAStringToAddressW 126
#define | DTCODE_WSAUnhookBlockingHook 55
#define | DTCODE_WSAWaitForMultipleEvents 56
#define | DTCODE_WSCDeinstallProvider 107
#define | DTCODE_WSCEnableNSProvider 160
#define | DTCODE_WSCEnumProtocols 115
#define | DTCODE_WSCGetProviderPath 157
#define | DTCODE_WSCInstallNameSpace 158
#define | DTCODE_WSCInstallProvider 108
#define | DTCODE_WSCUnInstallNameSpace 159
#define | DTCODE_WSCUpdateProvider 169
#define | DTCODE_WSCWriteNameSpaceOrder 168
#define | DTCODE_WSCWriteProviderOrder 167
#define | DTCODE_WSPAccept 73
#define | DTCODE_WSPAddressToString 161
#define | DTCODE_WSPAsyncSelect 74
#define | DTCODE_WSPBind 75
#define | DTCODE_WSPCancelBlockingCall 76
#define | DTCODE_WSPCleanup 77
#define | DTCODE_WSPCloseSocket 78
#define | DTCODE_WSPConnect 79
#define | DTCODE_WSPDuplicateSocket 80
#define | DTCODE_WSPEnumNetworkEvents 81
#define | DTCODE_WSPEventSelect 82
#define | DTCODE_WSPGetOverlappedResult 83
#define | DTCODE_WSPGetPeerName 84
#define | DTCODE_WSPGetQOSByName 88
#define | DTCODE_WSPGetSockName 86
#define | DTCODE_WSPGetSockOpt 87
#define | DTCODE_WSPIoctl 89
#define | DTCODE_WSPJoinLeaf 90
#define | DTCODE_WSPListen 91
#define | DTCODE_WSPRecv 92
#define | DTCODE_WSPRecvDisconnect 93
#define | DTCODE_WSPRecvFrom 94
#define | DTCODE_WSPSelect 95
#define | DTCODE_WSPSend 96
#define | DTCODE_WSPSendDisconnect 97
#define | DTCODE_WSPSendTo 98
#define | DTCODE_WSPSetSockOpt 99
#define | DTCODE_WSPShutdown 100
#define | DTCODE_WSPSocket 101
#define | DTCODE_WSPStartup 102
#define | DTCODE_WSPStringToAddress 162
#define | MAX_DTCODE DTCODE_WPUCloseThread

Define Documentation

#define DTCODE___WSAFDIsSet 122

Definition at line 135 of file Dt_Dll.Hpp.

#define DTCODE_accept 1

Definition at line 14 of file Dt_Dll.Hpp.

#define DTCODE_bind 2

Definition at line 15 of file Dt_Dll.Hpp.

#define DTCODE_closesocket 3

Definition at line 16 of file Dt_Dll.Hpp.

#define DTCODE_connect 4

Definition at line 17 of file Dt_Dll.Hpp.

#define DTCODE_freeaddrinfo 172

Definition at line 185 of file Dt_Dll.Hpp.

#define DTCODE_getaddrinfo 170

Definition at line 183 of file Dt_Dll.Hpp.

#define DTCODE_gethostbyaddr 57

Definition at line 70 of file Dt_Dll.Hpp.

#define DTCODE_gethostbyname 58

Definition at line 71 of file Dt_Dll.Hpp.

#define DTCODE_gethostname 59

Definition at line 72 of file Dt_Dll.Hpp.

#define DTCODE_getnameinfo 171

Definition at line 184 of file Dt_Dll.Hpp.

#define DTCODE_getpeername 5

Definition at line 18 of file Dt_Dll.Hpp.

#define DTCODE_getprotobyname 60

Definition at line 73 of file Dt_Dll.Hpp.

#define DTCODE_getprotobynumber 61

Definition at line 74 of file Dt_Dll.Hpp.

#define DTCODE_getservbyname 62

Definition at line 75 of file Dt_Dll.Hpp.

#define DTCODE_getservbyport 63

Definition at line 76 of file Dt_Dll.Hpp.

#define DTCODE_getsockname 6

Definition at line 19 of file Dt_Dll.Hpp.

#define DTCODE_getsockopt 7

Definition at line 20 of file Dt_Dll.Hpp.

#define DTCODE_htonl 8

Definition at line 21 of file Dt_Dll.Hpp.

#define DTCODE_htons 9

Definition at line 22 of file Dt_Dll.Hpp.

#define DTCODE_inet_addr 64

Definition at line 77 of file Dt_Dll.Hpp.

#define DTCODE_inet_ntoa 65

Definition at line 78 of file Dt_Dll.Hpp.

#define DTCODE_ioctlsocket 10

Definition at line 23 of file Dt_Dll.Hpp.

#define DTCODE_listen 11

Definition at line 24 of file Dt_Dll.Hpp.

#define DTCODE_NSPAddressToString 145

Definition at line 158 of file Dt_Dll.Hpp.

#define DTCODE_NSPGetAddressByName 150

Definition at line 163 of file Dt_Dll.Hpp.

#define DTCODE_NSPGetServiceClassInfo 154

Definition at line 167 of file Dt_Dll.Hpp.

#define DTCODE_NSPGetServiceClassNameByClassId 156

Definition at line 169 of file Dt_Dll.Hpp.

#define DTCODE_NSPInstallServiceClass 151

Definition at line 164 of file Dt_Dll.Hpp.

#define DTCODE_NSPIoctl 164

Definition at line 177 of file Dt_Dll.Hpp.

#define DTCODE_NSPLookupServiceBegin 147

Definition at line 160 of file Dt_Dll.Hpp.

#define DTCODE_NSPLookupServiceEnd 149

Definition at line 162 of file Dt_Dll.Hpp.

#define DTCODE_NSPLookupServiceNext 148

Definition at line 161 of file Dt_Dll.Hpp.

#define DTCODE_NSPRemoveServiceClass 153

Definition at line 166 of file Dt_Dll.Hpp.

#define DTCODE_NSPSetService 152

Definition at line 165 of file Dt_Dll.Hpp.

#define DTCODE_NSPStartup 173

Definition at line 186 of file Dt_Dll.Hpp.

#define DTCODE_NSPStringToAddress 146

Definition at line 159 of file Dt_Dll.Hpp.

#define DTCODE_ntohl 12

Definition at line 25 of file Dt_Dll.Hpp.

#define DTCODE_ntohs 13

Definition at line 26 of file Dt_Dll.Hpp.

#define DTCODE_recv 14

Definition at line 27 of file Dt_Dll.Hpp.

#define DTCODE_recvfrom 15

Definition at line 28 of file Dt_Dll.Hpp.

#define DTCODE_select 16

Definition at line 29 of file Dt_Dll.Hpp.

#define DTCODE_send 17

Definition at line 30 of file Dt_Dll.Hpp.

#define DTCODE_sendto 18

Definition at line 31 of file Dt_Dll.Hpp.

#define DTCODE_setsockopt 19

Definition at line 32 of file Dt_Dll.Hpp.

#define DTCODE_shutdown 20

Definition at line 33 of file Dt_Dll.Hpp.

#define DTCODE_socket 21

Definition at line 34 of file Dt_Dll.Hpp.

#define DTCODE_WPUCloseEvent 103

Definition at line 116 of file Dt_Dll.Hpp.

#define DTCODE_WPUCloseSocketHandle 104

Definition at line 117 of file Dt_Dll.Hpp.

#define DTCODE_WPUCloseThread 175

Definition at line 188 of file Dt_Dll.Hpp.

#define DTCODE_WPUCompleteOverlappedRequest 165

Definition at line 178 of file Dt_Dll.Hpp.

#define DTCODE_WPUCreateEvent 105

Definition at line 118 of file Dt_Dll.Hpp.

#define DTCODE_WPUCreateSocketHandle 106

Definition at line 119 of file Dt_Dll.Hpp.

#define DTCODE_WPUFDIsSet 118

Definition at line 131 of file Dt_Dll.Hpp.

#define DTCODE_WPUGetProviderPath 116

Definition at line 129 of file Dt_Dll.Hpp.

#define DTCODE_WPUModifyIFSHandle 109

Definition at line 122 of file Dt_Dll.Hpp.

#define DTCODE_WPUOpenCurrentThread 174

Definition at line 187 of file Dt_Dll.Hpp.

#define DTCODE_WPUPostMessage 117

Definition at line 130 of file Dt_Dll.Hpp.

#define DTCODE_WPUQueryBlockingCallback 110

Definition at line 123 of file Dt_Dll.Hpp.

#define DTCODE_WPUQuerySocketHandleContext 111

Definition at line 124 of file Dt_Dll.Hpp.

#define DTCODE_WPUQueueApc 112

Definition at line 125 of file Dt_Dll.Hpp.

#define DTCODE_WPUResetEvent 113

Definition at line 126 of file Dt_Dll.Hpp.

#define DTCODE_WPUSetEvent 114

Definition at line 127 of file Dt_Dll.Hpp.

#define DTCODE_WSAAccept 22

Definition at line 35 of file Dt_Dll.Hpp.

#define DTCODE_WSAAddressToStringA 123

Definition at line 136 of file Dt_Dll.Hpp.

#define DTCODE_WSAAddressToStringW 124

Definition at line 137 of file Dt_Dll.Hpp.

#define DTCODE_WSAAsyncGetHostByAddr 66

Definition at line 79 of file Dt_Dll.Hpp.

#define DTCODE_WSAAsyncGetHostByName 67

Definition at line 80 of file Dt_Dll.Hpp.

#define DTCODE_WSAAsyncGetProtoByName 68

Definition at line 81 of file Dt_Dll.Hpp.

#define DTCODE_WSAAsyncGetProtoByNumber 69

Definition at line 82 of file Dt_Dll.Hpp.

#define DTCODE_WSAAsyncGetServByName 70

Definition at line 83 of file Dt_Dll.Hpp.

#define DTCODE_WSAAsyncGetServByPort 71

Definition at line 84 of file Dt_Dll.Hpp.

#define DTCODE_WSAAsyncSelect 23

Definition at line 36 of file Dt_Dll.Hpp.

#define DTCODE_WSACancelAsyncRequest 72

Definition at line 85 of file Dt_Dll.Hpp.

#define DTCODE_WSACancelBlockingCall 24

Definition at line 37 of file Dt_Dll.Hpp.

#define DTCODE_WSACleanup 25

Definition at line 38 of file Dt_Dll.Hpp.

#define DTCODE_WSACloseEvent 26

Definition at line 39 of file Dt_Dll.Hpp.

#define DTCODE_WSAConnect 27

Definition at line 40 of file Dt_Dll.Hpp.

#define DTCODE_WSACreateEvent 28

Definition at line 41 of file Dt_Dll.Hpp.

#define DTCODE_WSADuplicateSocketA 29

Definition at line 42 of file Dt_Dll.Hpp.

#define DTCODE_WSADuplicateSocketW 119

Definition at line 132 of file Dt_Dll.Hpp.

#define DTCODE_WSAEnumNameSpaceProvidersA 141

Definition at line 154 of file Dt_Dll.Hpp.

#define DTCODE_WSAEnumNameSpaceProvidersW 142

Definition at line 155 of file Dt_Dll.Hpp.

#define DTCODE_WSAEnumNetworkEvents 30

Definition at line 43 of file Dt_Dll.Hpp.

#define DTCODE_WSAEnumProtocolsA 31

Definition at line 44 of file Dt_Dll.Hpp.

#define DTCODE_WSAEnumProtocolsW 120

Definition at line 133 of file Dt_Dll.Hpp.

#define DTCODE_WSAEventSelect 32

Definition at line 45 of file Dt_Dll.Hpp.

#define DTCODE_WSAGetLastError 33

Definition at line 46 of file Dt_Dll.Hpp.

#define DTCODE_WSAGetOverlappedResult 34

Definition at line 47 of file Dt_Dll.Hpp.

#define DTCODE_WSAGetQOSByName 35

Definition at line 48 of file Dt_Dll.Hpp.

#define DTCODE_WSAGetServiceClassInfoA 139

Definition at line 152 of file Dt_Dll.Hpp.

#define DTCODE_WSAGetServiceClassInfoW 140

Definition at line 153 of file Dt_Dll.Hpp.

#define DTCODE_WSAGetServiceClassNameByClassIdA 143

Definition at line 156 of file Dt_Dll.Hpp.

#define DTCODE_WSAGetServiceClassNameByClassIdW 144

Definition at line 157 of file Dt_Dll.Hpp.

#define DTCODE_WSAHtonl 36

Definition at line 49 of file Dt_Dll.Hpp.

#define DTCODE_WSAHtons 37

Definition at line 50 of file Dt_Dll.Hpp.

#define DTCODE_WSAInstallServiceClassA 134

Definition at line 147 of file Dt_Dll.Hpp.

#define DTCODE_WSAInstallServiceClassW 135

Definition at line 148 of file Dt_Dll.Hpp.

#define DTCODE_WSAIoctl 38

Definition at line 51 of file Dt_Dll.Hpp.

#define DTCODE_WSAIsBlocking 39

Definition at line 52 of file Dt_Dll.Hpp.

#define DTCODE_WSAJoinLeaf 40

Definition at line 53 of file Dt_Dll.Hpp.

#define DTCODE_WSALookupServiceBeginA 127

Definition at line 140 of file Dt_Dll.Hpp.

#define DTCODE_WSALookupServiceBeginW 128

Definition at line 141 of file Dt_Dll.Hpp.

#define DTCODE_WSALookupServiceEnd 131

Definition at line 144 of file Dt_Dll.Hpp.

#define DTCODE_WSALookupServiceNextA 129

Definition at line 142 of file Dt_Dll.Hpp.

#define DTCODE_WSALookupServiceNextW 130

Definition at line 143 of file Dt_Dll.Hpp.

#define DTCODE_WSANSPIoctl 163

Definition at line 176 of file Dt_Dll.Hpp.

#define DTCODE_WSANtohl 41

Definition at line 54 of file Dt_Dll.Hpp.

#define DTCODE_WSANtohs 42

Definition at line 55 of file Dt_Dll.Hpp.

#define DTCODE_WSAProviderConfigChange 166

Definition at line 179 of file Dt_Dll.Hpp.

#define DTCODE_WSARecv 43

Definition at line 56 of file Dt_Dll.Hpp.

#define DTCODE_WSARecvDisconnect 44

Definition at line 57 of file Dt_Dll.Hpp.

#define DTCODE_WSARecvFrom 45

Definition at line 58 of file Dt_Dll.Hpp.

#define DTCODE_WSARemoveServiceClass 138

Definition at line 151 of file Dt_Dll.Hpp.

#define DTCODE_WSAResetEvent 46

Definition at line 59 of file Dt_Dll.Hpp.

#define DTCODE_WSASend 47

Definition at line 60 of file Dt_Dll.Hpp.

#define DTCODE_WSASendDisconnect 48

Definition at line 61 of file Dt_Dll.Hpp.

#define DTCODE_WSASendTo 49

Definition at line 62 of file Dt_Dll.Hpp.

#define DTCODE_WSASetBlockingHook 50

Definition at line 63 of file Dt_Dll.Hpp.

#define DTCODE_WSASetEvent 51

Definition at line 64 of file Dt_Dll.Hpp.

#define DTCODE_WSASetLastError 52

Definition at line 65 of file Dt_Dll.Hpp.

#define DTCODE_WSASetServiceA 136

Definition at line 149 of file Dt_Dll.Hpp.

#define DTCODE_WSASetServiceW 137

Definition at line 150 of file Dt_Dll.Hpp.

#define DTCODE_WSASocketA 53

Definition at line 66 of file Dt_Dll.Hpp.

#define DTCODE_WSASocketW 121

Definition at line 134 of file Dt_Dll.Hpp.

#define DTCODE_WSAStartup 54

Definition at line 67 of file Dt_Dll.Hpp.

#define DTCODE_WSAStringToAddressA 125

Definition at line 138 of file Dt_Dll.Hpp.

#define DTCODE_WSAStringToAddressW 126

Definition at line 139 of file Dt_Dll.Hpp.

#define DTCODE_WSAUnhookBlockingHook 55

Definition at line 68 of file Dt_Dll.Hpp.

#define DTCODE_WSAWaitForMultipleEvents 56

Definition at line 69 of file Dt_Dll.Hpp.

#define DTCODE_WSCDeinstallProvider 107

Definition at line 120 of file Dt_Dll.Hpp.

#define DTCODE_WSCEnableNSProvider 160

Definition at line 173 of file Dt_Dll.Hpp.

#define DTCODE_WSCEnumProtocols 115

Definition at line 128 of file Dt_Dll.Hpp.

#define DTCODE_WSCGetProviderPath 157

Definition at line 170 of file Dt_Dll.Hpp.

#define DTCODE_WSCInstallNameSpace 158

Definition at line 171 of file Dt_Dll.Hpp.

#define DTCODE_WSCInstallProvider 108

Definition at line 121 of file Dt_Dll.Hpp.

#define DTCODE_WSCUnInstallNameSpace 159

Definition at line 172 of file Dt_Dll.Hpp.

#define DTCODE_WSCUpdateProvider 169

Definition at line 182 of file Dt_Dll.Hpp.

#define DTCODE_WSCWriteNameSpaceOrder 168

Definition at line 181 of file Dt_Dll.Hpp.

#define DTCODE_WSCWriteProviderOrder 167

Definition at line 180 of file Dt_Dll.Hpp.

#define DTCODE_WSPAccept 73

Definition at line 86 of file Dt_Dll.Hpp.

#define DTCODE_WSPAddressToString 161

Definition at line 174 of file Dt_Dll.Hpp.

#define DTCODE_WSPAsyncSelect 74

Definition at line 87 of file Dt_Dll.Hpp.

#define DTCODE_WSPBind 75

Definition at line 88 of file Dt_Dll.Hpp.

#define DTCODE_WSPCancelBlockingCall 76

Definition at line 89 of file Dt_Dll.Hpp.

#define DTCODE_WSPCleanup 77

Definition at line 90 of file Dt_Dll.Hpp.

#define DTCODE_WSPCloseSocket 78

Definition at line 91 of file Dt_Dll.Hpp.

#define DTCODE_WSPConnect 79

Definition at line 92 of file Dt_Dll.Hpp.

#define DTCODE_WSPDuplicateSocket 80

Definition at line 93 of file Dt_Dll.Hpp.

#define DTCODE_WSPEnumNetworkEvents 81

Definition at line 94 of file Dt_Dll.Hpp.

#define DTCODE_WSPEventSelect 82

Definition at line 95 of file Dt_Dll.Hpp.

#define DTCODE_WSPGetOverlappedResult 83

Definition at line 96 of file Dt_Dll.Hpp.

#define DTCODE_WSPGetPeerName 84

Definition at line 97 of file Dt_Dll.Hpp.

#define DTCODE_WSPGetQOSByName 88

Definition at line 101 of file Dt_Dll.Hpp.

#define DTCODE_WSPGetSockName 86

Definition at line 99 of file Dt_Dll.Hpp.

#define DTCODE_WSPGetSockOpt 87

Definition at line 100 of file Dt_Dll.Hpp.

#define DTCODE_WSPIoctl 89

Definition at line 102 of file Dt_Dll.Hpp.

#define DTCODE_WSPJoinLeaf 90

Definition at line 103 of file Dt_Dll.Hpp.

#define DTCODE_WSPListen 91

Definition at line 104 of file Dt_Dll.Hpp.

#define DTCODE_WSPRecv 92

Definition at line 105 of file Dt_Dll.Hpp.

#define DTCODE_WSPRecvDisconnect 93

Definition at line 106 of file Dt_Dll.Hpp.

#define DTCODE_WSPRecvFrom 94

Definition at line 107 of file Dt_Dll.Hpp.

#define DTCODE_WSPSelect 95

Definition at line 108 of file Dt_Dll.Hpp.

#define DTCODE_WSPSend 96

Definition at line 109 of file Dt_Dll.Hpp.

#define DTCODE_WSPSendDisconnect 97

Definition at line 110 of file Dt_Dll.Hpp.

#define DTCODE_WSPSendTo 98

Definition at line 111 of file Dt_Dll.Hpp.

#define DTCODE_WSPSetSockOpt 99

Definition at line 112 of file Dt_Dll.Hpp.

#define DTCODE_WSPShutdown 100

Definition at line 113 of file Dt_Dll.Hpp.

#define DTCODE_WSPSocket 101

Definition at line 114 of file Dt_Dll.Hpp.

#define DTCODE_WSPStartup 102

Definition at line 115 of file Dt_Dll.Hpp.

#define DTCODE_WSPStringToAddress 162

Definition at line 175 of file Dt_Dll.Hpp.

#define MAX_DTCODE DTCODE_WPUCloseThread

Definition at line 192 of file Dt_Dll.Hpp.

Generated on Wed Nov 13 2024 16:54:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/Dt_Dll2/DtHandler.Cpp File Reference

  • NetDS
  • WinSock
  • Dt_Dll2

DtHandler.Cpp File Reference

#include "DTHandler.hpp"
#include "dt_dll.hpp"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/Dt_Dll2/DtHandler.Hpp File Reference

  • NetDS
  • WinSock
  • Dt_Dll2
Classes | Defines

DtHandler.Hpp File Reference

#include <ws2spi.h>
#include <ws2tcpip.h>
#include "APIHook.hpp"
#include "dt_dll.hpp"

Go to the source code of this file.

Classes

class | DTHandler

Defines

#define | _WINSOCKAPI_

Define Documentation

#define _WINSOCKAPI_

Definition at line 26 of file DtHandler.Hpp.

Generated on Wed Nov 13 2024 16:54:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/Dt_Dll2/Socketmon.Cpp File Reference

  • NetDS
  • WinSock
  • Dt_Dll2

Socketmon.Cpp File Reference

#include <stdio.h>
#include "SocketMon.hpp"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/Dt_Dll2/Socketmon.Hpp File Reference

  • NetDS
  • WinSock
  • Dt_Dll2
Classes

Socketmon.Hpp File Reference

#include "DTHandler.hpp"

Go to the source code of this file.

Classes

class SocketMonitor
Generated on Wed Nov 13 2024 16:54:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/iocp/IocpClient.Cpp File Reference

  • NetDS
  • WinSock
  • iocp
Classes | Defines | Typedefs | Functions

IocpClient.Cpp File Reference

#include <stdlib.h>
#include <stdio.h>
#include <winsock2.h>
#include <ws2tcpip.h>

Go to the source code of this file.

Classes

struct | _OPTIONS
struct | THREADINFO

Defines

#define | MAXTHREADS 64
#define | xfree(p) HeapFree(GetProcessHeap(),0,(p))
#define | xmalloc(s) HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,(s))

Typedefs

typedef struct _OPTIONS | OPTIONS
typedef struct THREADINFO | THREADINFO

Functions

int __cdecl | main (int argc, char *argv[])

Define Documentation

#define MAXTHREADS 64

Definition at line 51 of file IocpClient.Cpp.

#define xfree ( p ) HeapFree(GetProcessHeap(),0,(p))

Definition at line 54 of file IocpClient.Cpp.

#define xmalloc ( s ) HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,(s))

Definition at line 53 of file IocpClient.Cpp.

Typedef Documentation

typedef struct _OPTIONS OPTIONS
typedef struct THREADINFO THREADINFO

Function Documentation

int __cdecl main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 84 of file IocpClient.Cpp.

                                         {

  OSVERSIONINFO verInfo = {0};
  WSADATA WSAData;
  DWORD dwThreadId = 0;
  DWORD dwRet = 0;
  BOOL bInitError = FALSE;
  int nThreadNum[MAXTHREADS];
  int i = 0;
  int nRet = 0;

  verInfo.dwOSVersionInfoSize = sizeof(verInfo);
  GetVersionEx(&verInfo);
  if( verInfo.dwPlatformId  == VER_PLATFORM_WIN32_WINDOWS ) {

    //
    // Since this application can heavily stress system resources
    // we decided to limit running it on NT.
    //
    myprintf("Please run %s only on NT, thank you\n", argv[0]);
    return(0);
  }

  for( i = 0; i < MAXTHREADS; i++ ) {
    g_ThreadInfo.sd[i] = INVALID_SOCKET;
    g_ThreadInfo.hThread[i] = INVALID_HANDLE_VALUE;
    nThreadNum[i] = 0;
  }

  g_hCleanupEvent[0] = WSA_INVALID_EVENT;

  if( !ValidOptions(argv, argc) )
    return(1);

  if( (nRet = WSAStartup(MAKEWORD(2,2), &WSAData)) != 0 ) {
    myprintf("WSAStartup() failed: %d", nRet);
    return(1);
  }

  g_hCleanupEvent[0] = WSACreateEvent();
  if( g_hCleanupEvent[0] == WSA_INVALID_EVENT ) {
    myprintf("WSACreateEvent() failed: %d\n", WSAGetLastError());
    WSACleanup();
    return(1);
  }

  //
  // be able to gracefully handle CTRL-C and close handles
  //
  if( !SetConsoleCtrlHandler (CtrlHandler, TRUE) ) {
    myprintf("SetConsoleCtrlHandler() failed: %d\n", GetLastError());
    if( g_hCleanupEvent[0] != WSA_INVALID_EVENT ) {
      WSACloseEvent(g_hCleanupEvent[0]);
      g_hCleanupEvent[0] = WSA_INVALID_EVENT;
    }
    WSACleanup();
    return(1);
  }

  //
  // spawn the threads
  //
  for( i = 0; i < g_Options.nTotalThreads && !bInitError; i++ ) {

    //
    // if CTRL-C is pressed before all the sockets have connected, closure of
    // the program could take a little while, especially if the server is
    // down and we have to wait for connect to fail.  Checking for this
    // global flag allows us to shortcircuit that.
    //
    if( g_bEndClient )
      break;
    else if( CreateConnectedSocket(i) ) {

      //
      // a unique memory location needs to be passed into each thread,
      // otherwise the value would change by the time all the threads
      // get a chance to run.
      //
      nThreadNum[i] = i;
      g_ThreadInfo.hThread[i] = CreateThread(NULL, 0, EchoThread, (LPVOID)&nThreadNum[i], 0, &dwThreadId);
      if( g_ThreadInfo.hThread[i] == NULL ) {
        myprintf("CreateThread(%d) failed: %d\n", i, GetLastError());
        bInitError = TRUE;
        break;
      }
    }
  }

    if( !bInitError ) {

    //
    // wait for the threads to exit
    //
    dwRet = WaitForMultipleObjects(g_Options.nTotalThreads, g_ThreadInfo.hThread, TRUE, INFINITE);
    if( dwRet == WAIT_FAILED )
      myprintf("WaitForMultipleObject(): %d\n", GetLastError());
  }

    if( !GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0) ) {
    myprintf("GenerateConsoleCtrlEvent() failed: %d\n", GetLastError());
  };

    if( WSAWaitForMultipleEvents(1, g_hCleanupEvent, TRUE, WSA_INFINITE, FALSE) == WSA_WAIT_FAILED ) {
    myprintf("WSAWaitForMultipleEvents() failed: %d\n", WSAGetLastError());
  };

    if( g_hCleanupEvent[0] != WSA_INVALID_EVENT ) {
    WSACloseEvent(g_hCleanupEvent[0]);
    g_hCleanupEvent[0] = WSA_INVALID_EVENT;
  }

  WSACleanup();

  //
  // Restores default processing of CTRL signals.
  //
  SetConsoleCtrlHandler(CtrlHandler, FALSE);
  SetConsoleCtrlHandler(NULL, FALSE);

  return(0);
}

Generated on Wed Nov 13 2024 16:54:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/iocp/IocpServer.Cpp File Reference

  • NetDS
  • WinSock
  • iocp
Defines | Functions | Variables

IocpServer.Cpp File Reference

#include <winsock2.h>
#include <Ws2tcpip.h>
#include <stdio.h>
#include <stdlib.h>
#include "iocpserver.h"

Go to the source code of this file.

Defines

#define | WIN32_LEAN_AND_MEAN
#define | xfree(p) HeapFree(GetProcessHeap(),0,(p))
#define | xmalloc(s) HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,(s))

Functions

VOID | CloseClient (PPER_SOCKET_CONTEXT lpPerSocketContext, BOOL bGraceful)
BOOL | CreateListenSocket (void)
BOOL WINAPI | CtrlHandler (DWORD dwEvent)
PPER_SOCKET_CONTEXT | CtxtAllocate (SOCKET sd, IO_OPERATION ClientIO)
VOID | CtxtListAddTo (PPER_SOCKET_CONTEXT lpPerSocketContext)
VOID | CtxtListDeleteFrom (PPER_SOCKET_CONTEXT lpPerSocketContext)
VOID | CtxtListFree ()
void __cdecl | main (int argc, char *argv[])
int | myprintf (const char *lpFormat,...)
PPER_SOCKET_CONTEXT | UpdateCompletionPort (SOCKET sd, IO_OPERATION ClientIo, BOOL bAddToList)
BOOL | ValidOptions (int argc, char *argv[])
DWORD WINAPI | WorkerThread (LPVOID WorkThreadContext)

Variables

BOOL | g_bEndServer = FALSE
BOOL | g_bRestart = TRUE
BOOL | g_bVerbose = FALSE
CRITICAL_SECTION | g_CriticalSection
DWORD | g_dwThreadCount = 0
HANDLE | g_hIOCP = INVALID_HANDLE_VALUE
PPER_SOCKET_CONTEXT | g_pCtxtList = NULL
char * | g_Port = DEFAULT_PORT
SOCKET | g_sdListen = INVALID_SOCKET
HANDLE | g_ThreadHandles [MAX_WORKER_THREAD]

Define Documentation

#define WIN32_LEAN_AND_MEAN

Definition at line 79 of file IocpServer.Cpp.

#define xfree ( p ) HeapFree(GetProcessHeap(),0,(p))

Definition at line 83 of file IocpServer.Cpp.

#define xmalloc ( s ) HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,(s))

Definition at line 82 of file IocpServer.Cpp.

Function Documentation

VOID CloseClient | ( | PPER_SOCKET_CONTEXT | lpPerSocketContext,
 |  | BOOL | bGraceful
 | ) |  |

Definition at line 643 of file IocpServer.Cpp.

                          {

  EnterCriticalSection(&g_CriticalSection);

  if( lpPerSocketContext ) {
    if( g_bVerbose )
      myprintf("CloseClient: Socket(%d) connection closing (graceful=%s)\n",
           lpPerSocketContext->Socket, (bGraceful?"TRUE":"FALSE"));
    if( !bGraceful ) {

      //
      // force the subsequent closesocket to be abortative.
      //
      LINGER  lingerStruct;

      lingerStruct.l_onoff = 1;
      lingerStruct.l_linger = 0;
      setsockopt(lpPerSocketContext->Socket, SOL_SOCKET, SO_LINGER,
             (char *)&lingerStruct, sizeof(lingerStruct) );
    }
    closesocket(lpPerSocketContext->Socket);
    lpPerSocketContext->Socket = INVALID_SOCKET;
    CtxtListDeleteFrom(lpPerSocketContext);
    lpPerSocketContext = NULL;
  } else {
    myprintf("CloseClient: lpPerSocketContext is NULL\n");
  }

  LeaveCriticalSection(&g_CriticalSection);
  return;
}

BOOL CreateListenSocket ( void )

Definition at line 362 of file IocpServer.Cpp.

                              {

  int nRet = 0;
  int nZero = 0;
  struct addrinfo hints;
  struct addrinfo *addrlocal = NULL;

  //
  // Resolve the interface
  //
  memset(&hints, 0, sizeof(hints));
  hints.ai_flags  = AI_PASSIVE;
  hints.ai_family = AF_INET;
  hints.ai_socktype = SOCK_STREAM;
  hints.ai_protocol = IPPROTO_IP;

  if( getaddrinfo(NULL, g_Port, &hints, &addrlocal) != 0 ) {
    myprintf("getaddrinfo() failed with error %d\n", WSAGetLastError());
        return(FALSE);
  }

  if( addrlocal == NULL ) {
    myprintf("getaddrinfo() failed to resolve/convert the interface\n");
        return(FALSE);
  }

  g_sdListen = WSASocket(addrlocal->ai_family, addrlocal->ai_socktype, addrlocal->ai_protocol,
               NULL, 0, WSA_FLAG_OVERLAPPED);
  if( g_sdListen == INVALID_SOCKET ) {
    myprintf("WSASocket(g_sdListen) failed: %d\n", WSAGetLastError());
    return(FALSE);
  }

  nRet = bind(g_sdListen, addrlocal->ai_addr, addrlocal->ai_addrlen);
  if( nRet == SOCKET_ERROR ) {
    myprintf("bind() failed: %d\n", WSAGetLastError());
    return(FALSE);
  }

  nRet = listen(g_sdListen, 5);
  if( nRet == SOCKET_ERROR ) {
    myprintf("listen() failed: %d\n", WSAGetLastError());
    return(FALSE);
  }

    //
  // Disable send buffering on the socket.  Setting SO_SNDBUF
  // to 0 causes winsock to stop buffering sends and perform
  // sends directly from our buffers, thereby reducing CPU usage.
    //
    // However, this does prevent the socket from ever filling the
    // send pipeline. This can lead to packets being sent that are
    // not full (i.e. the overhead of the IP and TCP headers is
    // great compared to the amount of data being carried).
    //
    // Disabling the send buffer has less serious repercussions
    // than disabling the receive buffer.
  //
  nZero = 0;
  nRet = setsockopt(g_sdListen, SOL_SOCKET, SO_SNDBUF, (char *)&nZero, sizeof(nZero));
  if( nRet == SOCKET_ERROR ) {
    myprintf("setsockopt(SNDBUF) failed: %d\n", WSAGetLastError());
    return(FALSE);
  }

    //
    // Don't disable receive buffering. This will cause poor network
    // performance since if no receive is posted and no receive buffers,
    // the TCP stack will set the window size to zero and the peer will
    // no longer be allowed to send data.
    //

    //
    // Do not set a linger value...especially don't set it to an abortive
    // close. If you set abortive close and there happens to be a bit of
    // data remaining to be transfered (or data that has not been
    // acknowledged by the peer), the connection will be forcefully reset
    // and will lead to a loss of data (i.e. the peer won't get the last
    // bit of data). This is BAD. If you are worried about malicious
    // clients connecting and then not sending or receiving, the server
    // should maintain a timer on each connection. If after some point,
    // the server deems a connection is "stale" it can then set linger
    // to be abortive and close the connection.
    //

    /*
  LINGER lingerStruct;

  lingerStruct.l_onoff = 1;
  lingerStruct.l_linger = 0;

  nRet = setsockopt(g_sdListen, SOL_SOCKET, SO_LINGER,
            (char *)&lingerStruct, sizeof(lingerStruct) );
  if( nRet == SOCKET_ERROR ) {
    myprintf("setsockopt(SO_LINGER) failed: %d\n", WSAGetLastError());
    return(FALSE);
  }
    */

  freeaddrinfo(addrlocal);

  return(TRUE);
}

BOOL WINAPI CtrlHandler ( DWORD dwEvent )

Definition at line 323 of file IocpServer.Cpp.

                                        {

  SOCKET sockTemp = INVALID_SOCKET;

  switch( dwEvent ) {
  case CTRL_BREAK_EVENT:
    g_bRestart = TRUE;
  case CTRL_C_EVENT:
  case CTRL_LOGOFF_EVENT:
  case CTRL_SHUTDOWN_EVENT:
  case CTRL_CLOSE_EVENT:
    if( g_bVerbose )
      myprintf("CtrlHandler: closing listening socket\n");

    //
    // cause the accept in the main thread loop to fail
    //

        //
    //We want to make closesocket the last call in the handler because it will
    //cause the WSAAccept to return in the main thread
    //
    sockTemp = g_sdListen;
    g_sdListen = INVALID_SOCKET;
    g_bEndServer = TRUE;
    closesocket(sockTemp);
    sockTemp = INVALID_SOCKET;
    break;

  default:
    // unknown type--better pass it on.
    return(FALSE);
  }
  return(TRUE);
}

PPER_SOCKET_CONTEXT CtxtAllocate | ( | SOCKET | sd,
 |  | IO_OPERATION | ClientIO
 | ) |  |

Definition at line 679 of file IocpServer.Cpp.

                                                                   {

  PPER_SOCKET_CONTEXT lpPerSocketContext;

  EnterCriticalSection(&g_CriticalSection);

  lpPerSocketContext = (PPER_SOCKET_CONTEXT)xmalloc(sizeof(PER_SOCKET_CONTEXT));
  if( lpPerSocketContext ) {
    lpPerSocketContext->pIOContext = (PPER_IO_CONTEXT)xmalloc(sizeof(PER_IO_CONTEXT));
    if( lpPerSocketContext->pIOContext ) {
      lpPerSocketContext->Socket = sd;
      lpPerSocketContext->pCtxtBack = NULL;
      lpPerSocketContext->pCtxtForward = NULL;

      lpPerSocketContext->pIOContext->Overlapped.Internal = 0;
      lpPerSocketContext->pIOContext->Overlapped.InternalHigh = 0;
      lpPerSocketContext->pIOContext->Overlapped.Offset = 0;
      lpPerSocketContext->pIOContext->Overlapped.OffsetHigh = 0;
      lpPerSocketContext->pIOContext->Overlapped.hEvent = NULL;
      lpPerSocketContext->pIOContext->IOOperation = ClientIO;
      lpPerSocketContext->pIOContext->pIOContextForward = NULL;
      lpPerSocketContext->pIOContext->nTotalBytes = 0;
      lpPerSocketContext->pIOContext->nSentBytes  = 0;
      lpPerSocketContext->pIOContext->wsabuf.buf  = lpPerSocketContext->pIOContext->Buffer;
      lpPerSocketContext->pIOContext->wsabuf.len  = sizeof(lpPerSocketContext->pIOContext->Buffer);

      ZeroMemory(lpPerSocketContext->pIOContext->wsabuf.buf, lpPerSocketContext->pIOContext->wsabuf.len);
    } else {
      xfree(lpPerSocketContext);
      myprintf("HeapAlloc() PER_IO_CONTEXT failed: %d\n", GetLastError());
    }

  } else {
    myprintf("HeapAlloc() PER_SOCKET_CONTEXT failed: %d\n", GetLastError());
  }

  LeaveCriticalSection(&g_CriticalSection);

  return(lpPerSocketContext);
}

VOID CtxtListAddTo ( PPER_SOCKET_CONTEXT lpPerSocketContext )

Definition at line 723 of file IocpServer.Cpp.

                                                            {

  PPER_SOCKET_CONTEXT     pTemp;

  EnterCriticalSection(&g_CriticalSection);

  if( g_pCtxtList == NULL ) {

    //
    // add the first node to the linked list
    //
    lpPerSocketContext->pCtxtBack    = NULL;
    lpPerSocketContext->pCtxtForward = NULL;
    g_pCtxtList = lpPerSocketContext;
  } else {

    //
    // add node to head of list
    //
    pTemp = g_pCtxtList;

    g_pCtxtList = lpPerSocketContext;
    lpPerSocketContext->pCtxtBack    = pTemp;
    lpPerSocketContext->pCtxtForward = NULL;

    pTemp->pCtxtForward = lpPerSocketContext;
  }

  LeaveCriticalSection(&g_CriticalSection);
  return;
}

VOID CtxtListDeleteFrom ( PPER_SOCKET_CONTEXT lpPerSocketContext )

Definition at line 758 of file IocpServer.Cpp.

                                                                {

  PPER_SOCKET_CONTEXT pBack;
  PPER_SOCKET_CONTEXT pForward;
  PPER_IO_CONTEXT     pNextIO     = NULL;
  PPER_IO_CONTEXT     pTempIO     = NULL;

  EnterCriticalSection(&g_CriticalSection);

  if( lpPerSocketContext ) {
    pBack       = lpPerSocketContext->pCtxtBack;
    pForward    = lpPerSocketContext->pCtxtForward;

    if( ( pBack == NULL ) && ( pForward == NULL ) ) {

      //
      // This is the only node in the list to delete
      //
      g_pCtxtList = NULL;
    } else if ( ( pBack == NULL ) && ( pForward != NULL ) ) {

      //
      // This is the start node in the list to delete
      //
      pForward->pCtxtBack = NULL;
      g_pCtxtList = pForward;
    } else if ( ( pBack != NULL ) && ( pForward == NULL ) ) {

      //
      // This is the end node in the list to delete
      //
      pBack->pCtxtForward = NULL;
    } else if( pBack && pForward ) {

      //
      // Neither start node nor end node in the list
      //
      pBack->pCtxtForward = pForward;
      pForward->pCtxtBack = pBack;
    }

    //
    // Free all i/o context structures per socket
    //
    pTempIO = (PPER_IO_CONTEXT)(lpPerSocketContext->pIOContext);
    do {
      pNextIO = (PPER_IO_CONTEXT)(pTempIO->pIOContextForward);
      if( pTempIO ) {

        //
        //The overlapped structure is safe to free when only the posted i/o has
        //completed. Here we only need to test those posted but not yet received
        //by PQCS in the shutdown process.
        //
        if( g_bEndServer )
          while( !HasOverlappedIoCompleted((LPOVERLAPPED)pTempIO) ) Sleep(0);
        xfree(pTempIO);
        pTempIO = NULL;
      }
      pTempIO = pNextIO;
    } while( pNextIO );

    xfree(lpPerSocketContext);
    lpPerSocketContext = NULL;

  } else {
    myprintf("CtxtListDeleteFrom: lpPerSocketContext is NULL\n");
  }

  LeaveCriticalSection(&g_CriticalSection);
  return;
}

VOID CtxtListFree ( )

Definition at line 835 of file IocpServer.Cpp.

                    {

  PPER_SOCKET_CONTEXT     pTemp1, pTemp2;

  EnterCriticalSection(&g_CriticalSection);

  pTemp1 = g_pCtxtList;
  while( pTemp1 ) {
    pTemp2 = pTemp1->pCtxtBack;
    CloseClient(pTemp1, FALSE);
    pTemp1 = pTemp2;
  }

  LeaveCriticalSection(&g_CriticalSection);
  return;
}

void __cdecl main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 109 of file IocpServer.Cpp.

                                           {

  SYSTEM_INFO systemInfo;
  WSADATA wsaData;
  SOCKET sdAccept = INVALID_SOCKET;
  PPER_SOCKET_CONTEXT lpPerSocketContext = NULL;
  DWORD dwRecvNumBytes = 0;
  DWORD dwFlags = 0;
  int nRet = 0;

  for( int i = 0; i < MAX_WORKER_THREAD; i++ ) {
    g_ThreadHandles[i] = INVALID_HANDLE_VALUE;
  }

  if( !ValidOptions(argc, argv) )
    return;

  if( !SetConsoleCtrlHandler(CtrlHandler, TRUE) ) {
    myprintf("SetConsoleCtrlHandler() failed to install console handler: %d\n",
         GetLastError());
    return;
  }

  GetSystemInfo(&systemInfo);
  g_dwThreadCount = systemInfo.dwNumberOfProcessors * 2;

  if( (nRet = WSAStartup(MAKEWORD(2,2), &wsaData)) != 0 ) {
    myprintf("WSAStartup() failed: %d\n",nRet);
    SetConsoleCtrlHandler(CtrlHandler, FALSE);
    return;
  }

  InitializeCriticalSection(&g_CriticalSection);

  while( g_bRestart ) {
    g_bRestart = FALSE;
    g_bEndServer = FALSE;

    __try {
      g_hIOCP = CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, 0, 0);
      if( g_hIOCP == NULL ) {
        myprintf("CreateIoCompletionPort() failed to create I/O completion port: %d\n",
            GetLastError());
        __leave;
      }

      for( DWORD dwCPU = 0; dwCPU < g_dwThreadCount; dwCPU++ ) {

        //
        // Create worker threads to service the overlapped I/O requests.  The decision
        // to create 2 worker threads per CPU in the system is a heuristic.  Also,
        // note that thread handles are closed right away, because we will not need them
        // and the worker threads will continue to execute.
        //
        HANDLE hThread = INVALID_HANDLE_VALUE;
        DWORD dwThreadId = 0;

        hThread = CreateThread(NULL, 0, WorkerThread, g_hIOCP, 0, &dwThreadId);
        if( hThread == NULL ) {
          myprintf("CreateThread() failed to create worker thread: %d\n",
              GetLastError());
          __leave;
        }
        g_ThreadHandles[dwCPU] = hThread;
        hThread = INVALID_HANDLE_VALUE;
      }

      if( !CreateListenSocket() )
        __leave;

      while( TRUE ) {

        //
        // Loop forever accepting connections from clients until console shuts down.
        //
        sdAccept = WSAAccept(g_sdListen, NULL, NULL, NULL, 0);
        if( sdAccept == SOCKET_ERROR ) {

          //
          // If user hits Ctrl+C or Ctrl+Brk or console window is closed, the control
          // handler will close the g_sdListen socket. The above WSAAccept call will
          // fail and we thus break out the loop,
          //
          myprintf("WSAAccept() failed: %d\n", WSAGetLastError());
          __leave;
        }

                //
        // we add the just returned socket descriptor to the IOCP along with its
        // associated key data.  Also the global list of context structures
        // (the key data) gets added to a global list.
        //
        lpPerSocketContext = UpdateCompletionPort(sdAccept, ClientIoRead, TRUE);
        if( lpPerSocketContext == NULL )
          __leave;

        //
        // if a CTRL-C was pressed "after" WSAAccept returns, the CTRL-C handler
        // will have set this flag and we can break out of the loop here before
        // we go ahead and post another read (but after we have added it to the
        // list of sockets to close).
        //
        if( g_bEndServer )
          break;

                //
        // post initial receive on this socket
        //
        nRet = WSARecv(sdAccept, &(lpPerSocketContext->pIOContext->wsabuf),
                 1, &dwRecvNumBytes, &dwFlags,
                 &(lpPerSocketContext->pIOContext->Overlapped), NULL);
        if( nRet == SOCKET_ERROR && (ERROR_IO_PENDING != WSAGetLastError()) ) {
          myprintf("WSARecv() Failed: %d\n", WSAGetLastError());
          CloseClient(lpPerSocketContext, FALSE);
        }
      } //while
    }

    __finally   {

      g_bEndServer = TRUE;

            //
      // Cause worker threads to exit
      //
      if( g_hIOCP ) {
        for( DWORD i = 0; i < g_dwThreadCount; i++ )
          PostQueuedCompletionStatus(g_hIOCP, 0, 0, NULL);
      }

      //
      //Make sure worker threads exits.
            //
      if( WAIT_OBJECT_0 != WaitForMultipleObjects( g_dwThreadCount,  g_ThreadHandles, TRUE, 1000) )
        myprintf("WaitForMultipleObjects() failed: %d\n", GetLastError());
      else
        for( DWORD i = 0; i < g_dwThreadCount; i++ ) {
          if( g_ThreadHandles[i] != INVALID_HANDLE_VALUE ) CloseHandle(g_ThreadHandles[i]);
          g_ThreadHandles[i] = INVALID_HANDLE_VALUE;
        }

      CtxtListFree();

      if( g_hIOCP ) {
        CloseHandle(g_hIOCP);
        g_hIOCP = NULL;
      }

      if( g_sdListen != INVALID_SOCKET ) {
        closesocket(g_sdListen);
        g_sdListen = INVALID_SOCKET;
      }

      if( sdAccept != INVALID_SOCKET ) {
        closesocket(sdAccept);
        sdAccept = INVALID_SOCKET;
      }

    } //finally

    if( g_bRestart ) {
      myprintf("\niocpserver is restarting...\n");
    } else
      myprintf("\niocpserver is exiting...\n");

  } //while (g_bRestart)

  DeleteCriticalSection(&g_CriticalSection);
  WSACleanup();
  SetConsoleCtrlHandler(CtrlHandler, FALSE);
} //main

int myprintf | ( | const char * | lpFormat,
 |  |  | ...
 | ) |  |

Definition at line 856 of file IocpServer.Cpp.

                                          {

  int nLen = 0;
  int nRet = 0;
  char cBuffer[512] ;
  va_list arglist ;
  HANDLE hOut = NULL;

  ZeroMemory(cBuffer, sizeof(cBuffer));

  va_start(arglist, lpFormat);

  nLen = lstrlen( lpFormat ) ;
  nRet = wvsprintf( cBuffer, lpFormat, arglist );

  if( nRet >= nLen || GetLastError() == 0 ) {
    hOut = GetStdHandle(STD_OUTPUT_HANDLE) ;
    if( hOut != INVALID_HANDLE_VALUE )
      WriteConsole( hOut, cBuffer, lstrlen(cBuffer), (LPDWORD)&nLen, NULL ) ;
  }

  return nLen ;
}

PPER_SOCKET_CONTEXT UpdateCompletionPort | ( | SOCKET | sd,
 |  | IO_OPERATION | ClientIo,
 |  | BOOL | bAddToList
 | ) |  |

Definition at line 608 of file IocpServer.Cpp.

                                      {

  PPER_SOCKET_CONTEXT lpPerSocketContext;

  lpPerSocketContext = CtxtAllocate(sd, ClientIo);
  if( lpPerSocketContext == NULL )
    return(NULL);

  g_hIOCP = CreateIoCompletionPort((HANDLE)sd, g_hIOCP, (DWORD_PTR)lpPerSocketContext, 0);
  if( g_hIOCP == NULL ) {
    myprintf("CreateIoCompletionPort() failed: %d\n", GetLastError());
    if( lpPerSocketContext->pIOContext )
      xfree(lpPerSocketContext->pIOContext);
    xfree(lpPerSocketContext);
    return(NULL);
  }

    //
  //The listening socket context (bAddToList is FALSE) is not added to the list.
  //All other socket contexts are added to the list.
  //
  if( bAddToList ) CtxtListAddTo(lpPerSocketContext);

  if( g_bVerbose )
    myprintf("UpdateCompletionPort: Socket(%d) added to IOCP\n", lpPerSocketContext->Socket);

  return(lpPerSocketContext);
}

BOOL ValidOptions | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 284 of file IocpServer.Cpp.

                                          {

  BOOL bRet = TRUE;

  for( int i = 1; i < argc; i++ ) {
    if( (argv[i][0] =='-') || (argv[i][0] == '/') ) {
      switch( tolower(argv[i][1]) ) {
      case 'e':
        if( strlen(argv[i]) > 3 )
          g_Port = &argv[i][3];
        break;

      case 'v':
        g_bVerbose = TRUE;
        break;

      case '?':
        myprintf("Usage:\n  iocpserver [-p:port] [-v] [-?]\n");
        myprintf("  -e:port\tSpecify echoing port number\n");
        myprintf("  -v\t\tVerbose\n");
        myprintf("  -?\t\tDisplay this help\n");
        bRet = FALSE;
        break;

      default:
        myprintf("Unknown options flag %s\n", argv[i]);
        bRet = FALSE;
        break;
      }
    }
  }

  return(bRet);
}

DWORD WINAPI WorkerThread ( LPVOID WorkThreadContext )

Definition at line 469 of file IocpServer.Cpp.

                                                     {

  HANDLE hIOCP = (HANDLE)WorkThreadContext;
  BOOL bSuccess = FALSE;
  int nRet = 0;
  LPWSAOVERLAPPED lpOverlapped = NULL;
  PPER_SOCKET_CONTEXT lpPerSocketContext = NULL;
  PPER_IO_CONTEXT lpIOContext = NULL;
  WSABUF buffRecv;
  WSABUF buffSend;
  DWORD dwRecvNumBytes = 0;
  DWORD dwSendNumBytes = 0;
  DWORD dwFlags = 0;
  DWORD dwIoSize = 0;

  while( TRUE ) {

        //
    // continually loop to service io completion packets
    //
    bSuccess = GetQueuedCompletionStatus(hIOCP, &dwIoSize,
                       (PDWORD_PTR)&lpPerSocketContext,
                       (LPOVERLAPPED *)&lpOverlapped,
                       INFINITE);
    if( !bSuccess )
      myprintf("GetQueuedCompletionStatus() failed: %d\n", GetLastError());

    if( lpPerSocketContext == NULL ) {

      //
      // CTRL-C handler used PostQueuedCompletionStatus to post an I/O packet with
      // a NULL CompletionKey (or if we get one for any reason).  It is time to exit.
      //
      return(0);
    }

    if( g_bEndServer ) {

      //
      // main thread will do all cleanup needed - see finally block
      //
      return(0);
    }

    if( !bSuccess || (bSuccess && (dwIoSize == 0)) ) {

      //
      // client connection dropped, continue to service remaining (and possibly
      // new) client connections
      //
      CloseClient(lpPerSocketContext, FALSE);
      continue;
    }

        //
    // determine what type of IO packet has completed by checking the PER_IO_CONTEXT
    // associated with this socket.  This will determine what action to take.
    //
    lpIOContext = (PPER_IO_CONTEXT)lpOverlapped;
    switch( lpIOContext->IOOperation ) {
    case ClientIoRead:

      //
      // a read operation has completed, post a write operation to echo the
      // data back to the client using the same data buffer.
      //
      lpIOContext->IOOperation = ClientIoWrite;
      lpIOContext->nTotalBytes = dwIoSize;
      lpIOContext->nSentBytes  = 0;
      lpIOContext->wsabuf.len  = dwIoSize;
      dwFlags = 0;
      nRet = WSASend(lpPerSocketContext->Socket, &lpIOContext->wsabuf, 1,
               &dwSendNumBytes, dwFlags, &(lpIOContext->Overlapped), NULL);
      if( nRet == SOCKET_ERROR && (ERROR_IO_PENDING != WSAGetLastError()) ) {
        myprintf("WSASend() failed: %d\n", WSAGetLastError());
        CloseClient(lpPerSocketContext, FALSE);
      } else if( g_bVerbose ) {
        myprintf("WorkerThread %d: Socket(%d) Recv completed (%d bytes), Send posted\n",
             GetCurrentThreadId(), lpPerSocketContext->Socket, dwIoSize);
      }
      break;

    case ClientIoWrite:

      //
      // a write operation has completed, determine if all the data intended to be
      // sent actually was sent.
      //
      lpIOContext->IOOperation = ClientIoWrite;
      lpIOContext->nSentBytes  += dwIoSize;
      dwFlags = 0;
      if( lpIOContext->nSentBytes < lpIOContext->nTotalBytes ) {

        //
        // the previous write operation didn't send all the data,
        // post another send to complete the operation
        //
        buffSend.buf = lpIOContext->Buffer + lpIOContext->nSentBytes;
        buffSend.len = lpIOContext->nTotalBytes - lpIOContext->nSentBytes;
        nRet = WSASend (lpPerSocketContext->Socket, &buffSend, 1,
                &dwSendNumBytes, dwFlags, &(lpIOContext->Overlapped), NULL);
        if( nRet == SOCKET_ERROR && (ERROR_IO_PENDING != WSAGetLastError()) ) {
          myprintf("WSASend() failed: %d\n", WSAGetLastError());
          CloseClient(lpPerSocketContext, FALSE);
        } else if( g_bVerbose ) {
          myprintf("WorkerThread %d: Socket(%d) Send partially completed (%d bytes), Recv posted\n",
               GetCurrentThreadId(), lpPerSocketContext->Socket, dwIoSize);
        }
      } else {

        //
        // previous write operation completed for this socket, post another recv
        //
        lpIOContext->IOOperation = ClientIoRead;
        dwRecvNumBytes = 0;
        dwFlags = 0;
        buffRecv.buf = lpIOContext->Buffer,
        buffRecv.len = MAX_BUFF_SIZE;
        nRet = WSARecv(lpPerSocketContext->Socket, &buffRecv, 1,
                 &dwRecvNumBytes, &dwFlags, &lpIOContext->Overlapped, NULL);
        if( nRet == SOCKET_ERROR && (ERROR_IO_PENDING != WSAGetLastError()) ) {
          myprintf("WSARecv() failed: %d\n", WSAGetLastError());
          CloseClient(lpPerSocketContext, FALSE);
        } else if( g_bVerbose ) {
          myprintf("WorkerThread %d: Socket(%d) Send completed (%d bytes), Recv posted\n",
               GetCurrentThreadId(), lpPerSocketContext->Socket, dwIoSize);
        }
      }
      break;

    } //switch
  } //while
  return(0);
}

Variable Documentation

BOOL g_bEndServer = FALSE

Definition at line 93 of file IocpServer.Cpp.

BOOL g_bRestart = TRUE

Definition at line 94 of file IocpServer.Cpp.

BOOL g_bVerbose = FALSE

Definition at line 95 of file IocpServer.Cpp.

CRITICAL_SECTION g_CriticalSection

Definition at line 105 of file IocpServer.Cpp.

DWORD g_dwThreadCount = 0

Definition at line 96 of file IocpServer.Cpp.

HANDLE g_hIOCP = INVALID_HANDLE_VALUE

Definition at line 97 of file IocpServer.Cpp.

PPER_SOCKET_CONTEXT g_pCtxtList = NULL

Definition at line 100 of file IocpServer.Cpp.

char* g_Port = DEFAULT_PORT

Definition at line 92 of file IocpServer.Cpp.

SOCKET g_sdListen = INVALID_SOCKET

Definition at line 98 of file IocpServer.Cpp.

HANDLE g_ThreadHandles[MAX_WORKER_THREAD]

Definition at line 99 of file IocpServer.Cpp.

Generated on Wed Nov 13 2024 16:54:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/iocp/IocpServer.h File Reference

  • NetDS
  • WinSock
  • iocp
Classes | Defines | Typedefs | Enumerations | Functions

IocpServer.h File Reference

#include <mswsock.h>

Go to the source code of this file.

Classes

struct | _PER_IO_CONTEXT
struct | _PER_SOCKET_CONTEXT

Defines

#define | DEFAULT_PORT "5001"
#define | MAX_BUFF_SIZE 8192
#define | MAX_WORKER_THREAD 16

Typedefs

typedef enum _IO_OPERATION | IO_OPERATION
typedef struct _PER_IO_CONTEXT | PER_IO_CONTEXT
typedef struct _PER_SOCKET_CONTEXT | PER_SOCKET_CONTEXT
typedef enum _IO_OPERATION * | PIO_OPERATION
typedef struct _PER_IO_CONTEXT * | PPER_IO_CONTEXT
typedef struct
_PER_SOCKET_CONTEXT * 		PPER_SOCKET_CONTEXT

Enumerations

enum | _IO_OPERATION { ClientIoAccept, ClientIoRead, ClientIoWrite }

Functions

VOID | CloseClient (PPER_SOCKET_CONTEXT lpPerSocketContext, BOOL bGraceful)
BOOL | CreateAcceptSocket (BOOL fUpdateIOCP)
BOOL | CreateListenSocket (void)
BOOL WINAPI | CtrlHandler (DWORD dwEvent)
PPER_SOCKET_CONTEXT | CtxtAllocate (SOCKET s, IO_OPERATION ClientIO)
VOID | CtxtListAddTo (PPER_SOCKET_CONTEXT lpPerSocketContext)
VOID | CtxtListDeleteFrom (PPER_SOCKET_CONTEXT lpPerSocketContext)
VOID | CtxtListFree ()
PPER_SOCKET_CONTEXT | UpdateCompletionPort (SOCKET s, IO_OPERATION ClientIo, BOOL bAddToList)
BOOL | ValidOptions (int argc, char *argv[])
DWORD WINAPI | WorkerThread (LPVOID WorkContext)

Define Documentation

#define DEFAULT_PORT "5001"

Definition at line 17 of file IocpServer.h.

#define MAX_BUFF_SIZE 8192

Definition at line 18 of file IocpServer.h.

#define MAX_WORKER_THREAD 16

Definition at line 19 of file IocpServer.h.

Typedef Documentation

typedef enum _IO_OPERATION IO_OPERATION
typedef struct _PER_IO_CONTEXT PER_IO_CONTEXT
typedef struct _PER_SOCKET_CONTEXT PER_SOCKET_CONTEXT
typedef enum _IO_OPERATION * PIO_OPERATION
typedef struct _PER_IO_CONTEXT * PPER_IO_CONTEXT
typedef struct _PER_SOCKET_CONTEXT * PPER_SOCKET_CONTEXT

Enumeration Type Documentation

enum _IO_OPERATION
Enumerator:
ClientIoAccept
ClientIoRead
ClientIoWrite

Definition at line 21 of file IocpServer.h.

                           {
    ClientIoAccept,
    ClientIoRead,
    ClientIoWrite
} IO_OPERATION, *PIO_OPERATION;

Function Documentation

VOID CloseClient | ( | PPER_SOCKET_CONTEXT | lpPerSocketContext,
 |  | BOOL | bGraceful
 | ) |  |

Definition at line 643 of file IocpServer.Cpp.

                          {

  EnterCriticalSection(&g_CriticalSection);

  if( lpPerSocketContext ) {
    if( g_bVerbose )
      myprintf("CloseClient: Socket(%d) connection closing (graceful=%s)\n",
           lpPerSocketContext->Socket, (bGraceful?"TRUE":"FALSE"));
    if( !bGraceful ) {

      //
      // force the subsequent closesocket to be abortative.
      //
      LINGER  lingerStruct;

      lingerStruct.l_onoff = 1;
      lingerStruct.l_linger = 0;
      setsockopt(lpPerSocketContext->Socket, SOL_SOCKET, SO_LINGER,
             (char *)&lingerStruct, sizeof(lingerStruct) );
    }
    closesocket(lpPerSocketContext->Socket);
    lpPerSocketContext->Socket = INVALID_SOCKET;
    CtxtListDeleteFrom(lpPerSocketContext);
    lpPerSocketContext = NULL;
  } else {
    myprintf("CloseClient: lpPerSocketContext is NULL\n");
  }

  LeaveCriticalSection(&g_CriticalSection);
  return;
}

BOOL CreateAcceptSocket ( BOOL fUpdateIOCP )

Definition at line 462 of file IocpServerex.Cpp.

                                          {

  int nRet = 0;
  DWORD dwRecvNumBytes = 0;
  DWORD bytes = 0;

  //
  // GUID to Microsoft specific extensions
  //
  GUID acceptex_guid = WSAID_ACCEPTEX;

    //
  //The context for listening socket uses the SockAccept member to store the
  //socket for client connection.
  //
  if( fUpdateIOCP ) {
    g_pCtxtListenSocket = UpdateCompletionPort(g_sdListen, ClientIoAccept, FALSE);
    if( g_pCtxtListenSocket == NULL ) {
      myprintf("failed to update listen socket to IOCP\n");
      return(FALSE);
    }

        // Load the AcceptEx extension function from the provider for this socket
        nRet = WSAIoctl(
            g_sdListen,
            SIO_GET_EXTENSION_FUNCTION_POINTER,
           &acceptex_guid,
            sizeof(acceptex_guid),
           &g_pCtxtListenSocket->fnAcceptEx,
            sizeof(g_pCtxtListenSocket->fnAcceptEx),
           &bytes,
            NULL,
            NULL
            );
        if (nRet == SOCKET_ERROR)
        {
            myprintf("failed to load AcceptEx: %d\n", WSAGetLastError());
            return (FALSE);
        }
  }

  g_pCtxtListenSocket->pIOContext->SocketAccept = CreateSocket();
  if( g_pCtxtListenSocket->pIOContext->SocketAccept == INVALID_SOCKET) {
    myprintf("failed to create new accept socket\n");
    return(FALSE);
  }

  //
  // pay close attention to these parameters and buffer lengths
  //
  nRet = g_pCtxtListenSocket->fnAcceptEx(g_sdListen, g_pCtxtListenSocket->pIOContext->SocketAccept,
                    (LPVOID)(g_pCtxtListenSocket->pIOContext->Buffer),
                    MAX_BUFF_SIZE - (2 * (sizeof(SOCKADDR_STORAGE) + 16)),
                    sizeof(SOCKADDR_STORAGE) + 16, sizeof(SOCKADDR_STORAGE) + 16,
                    &dwRecvNumBytes,
          (LPOVERLAPPED) &(g_pCtxtListenSocket->pIOContext->Overlapped));
  if( nRet == SOCKET_ERROR && (ERROR_IO_PENDING != WSAGetLastError()) ) {
    myprintf("AcceptEx() failed: %d\n", WSAGetLastError());
    return(FALSE);
  }

  return(TRUE);
}

BOOL CreateListenSocket ( void )

Definition at line 362 of file IocpServer.Cpp.

                              {

  int nRet = 0;
  int nZero = 0;
  struct addrinfo hints;
  struct addrinfo *addrlocal = NULL;

  //
  // Resolve the interface
  //
  memset(&hints, 0, sizeof(hints));
  hints.ai_flags  = AI_PASSIVE;
  hints.ai_family = AF_INET;
  hints.ai_socktype = SOCK_STREAM;
  hints.ai_protocol = IPPROTO_IP;

  if( getaddrinfo(NULL, g_Port, &hints, &addrlocal) != 0 ) {
    myprintf("getaddrinfo() failed with error %d\n", WSAGetLastError());
        return(FALSE);
  }

  if( addrlocal == NULL ) {
    myprintf("getaddrinfo() failed to resolve/convert the interface\n");
        return(FALSE);
  }

  g_sdListen = WSASocket(addrlocal->ai_family, addrlocal->ai_socktype, addrlocal->ai_protocol,
               NULL, 0, WSA_FLAG_OVERLAPPED);
  if( g_sdListen == INVALID_SOCKET ) {
    myprintf("WSASocket(g_sdListen) failed: %d\n", WSAGetLastError());
    return(FALSE);
  }

  nRet = bind(g_sdListen, addrlocal->ai_addr, addrlocal->ai_addrlen);
  if( nRet == SOCKET_ERROR ) {
    myprintf("bind() failed: %d\n", WSAGetLastError());
    return(FALSE);
  }

  nRet = listen(g_sdListen, 5);
  if( nRet == SOCKET_ERROR ) {
    myprintf("listen() failed: %d\n", WSAGetLastError());
    return(FALSE);
  }

    //
  // Disable send buffering on the socket.  Setting SO_SNDBUF
  // to 0 causes winsock to stop buffering sends and perform
  // sends directly from our buffers, thereby reducing CPU usage.
    //
    // However, this does prevent the socket from ever filling the
    // send pipeline. This can lead to packets being sent that are
    // not full (i.e. the overhead of the IP and TCP headers is
    // great compared to the amount of data being carried).
    //
    // Disabling the send buffer has less serious repercussions
    // than disabling the receive buffer.
  //
  nZero = 0;
  nRet = setsockopt(g_sdListen, SOL_SOCKET, SO_SNDBUF, (char *)&nZero, sizeof(nZero));
  if( nRet == SOCKET_ERROR ) {
    myprintf("setsockopt(SNDBUF) failed: %d\n", WSAGetLastError());
    return(FALSE);
  }

    //
    // Don't disable receive buffering. This will cause poor network
    // performance since if no receive is posted and no receive buffers,
    // the TCP stack will set the window size to zero and the peer will
    // no longer be allowed to send data.
    //

    //
    // Do not set a linger value...especially don't set it to an abortive
    // close. If you set abortive close and there happens to be a bit of
    // data remaining to be transfered (or data that has not been
    // acknowledged by the peer), the connection will be forcefully reset
    // and will lead to a loss of data (i.e. the peer won't get the last
    // bit of data). This is BAD. If you are worried about malicious
    // clients connecting and then not sending or receiving, the server
    // should maintain a timer on each connection. If after some point,
    // the server deems a connection is "stale" it can then set linger
    // to be abortive and close the connection.
    //

    /*
  LINGER lingerStruct;

  lingerStruct.l_onoff = 1;
  lingerStruct.l_linger = 0;

  nRet = setsockopt(g_sdListen, SOL_SOCKET, SO_LINGER,
            (char *)&lingerStruct, sizeof(lingerStruct) );
  if( nRet == SOCKET_ERROR ) {
    myprintf("setsockopt(SO_LINGER) failed: %d\n", WSAGetLastError());
    return(FALSE);
  }
    */

  freeaddrinfo(addrlocal);

  return(TRUE);
}

BOOL WINAPI CtrlHandler ( DWORD dwEvent )

Definition at line 129 of file dhcpnotify.cpp.

{
  printf("\n\nStop Event Received... Aborting... \n\n");

  switch (dwCtrlType)
    {
    case CTRL_C_EVENT:
    case CTRL_BREAK_EVENT:
    case CTRL_SHUTDOWN_EVENT:
    case CTRL_LOGOFF_EVENT:
    case CTRL_CLOSE_EVENT:
      SetEvent(g_hExitEvent);
      break;
    default:
      return FALSE;
    }

  return TRUE;
}

PPER_SOCKET_CONTEXT CtxtAllocate | ( | SOCKET | s,
 |  | IO_OPERATION | ClientIO
 | ) |  |

Definition at line 679 of file IocpServer.Cpp.

                                                                   {

  PPER_SOCKET_CONTEXT lpPerSocketContext;

  EnterCriticalSection(&g_CriticalSection);

  lpPerSocketContext = (PPER_SOCKET_CONTEXT)xmalloc(sizeof(PER_SOCKET_CONTEXT));
  if( lpPerSocketContext ) {
    lpPerSocketContext->pIOContext = (PPER_IO_CONTEXT)xmalloc(sizeof(PER_IO_CONTEXT));
    if( lpPerSocketContext->pIOContext ) {
      lpPerSocketContext->Socket = sd;
      lpPerSocketContext->pCtxtBack = NULL;
      lpPerSocketContext->pCtxtForward = NULL;

      lpPerSocketContext->pIOContext->Overlapped.Internal = 0;
      lpPerSocketContext->pIOContext->Overlapped.InternalHigh = 0;
      lpPerSocketContext->pIOContext->Overlapped.Offset = 0;
      lpPerSocketContext->pIOContext->Overlapped.OffsetHigh = 0;
      lpPerSocketContext->pIOContext->Overlapped.hEvent = NULL;
      lpPerSocketContext->pIOContext->IOOperation = ClientIO;
      lpPerSocketContext->pIOContext->pIOContextForward = NULL;
      lpPerSocketContext->pIOContext->nTotalBytes = 0;
      lpPerSocketContext->pIOContext->nSentBytes  = 0;
      lpPerSocketContext->pIOContext->wsabuf.buf  = lpPerSocketContext->pIOContext->Buffer;
      lpPerSocketContext->pIOContext->wsabuf.len  = sizeof(lpPerSocketContext->pIOContext->Buffer);

      ZeroMemory(lpPerSocketContext->pIOContext->wsabuf.buf, lpPerSocketContext->pIOContext->wsabuf.len);
    } else {
      xfree(lpPerSocketContext);
      myprintf("HeapAlloc() PER_IO_CONTEXT failed: %d\n", GetLastError());
    }

  } else {
    myprintf("HeapAlloc() PER_SOCKET_CONTEXT failed: %d\n", GetLastError());
  }

  LeaveCriticalSection(&g_CriticalSection);

  return(lpPerSocketContext);
}

VOID CtxtListAddTo ( PPER_SOCKET_CONTEXT lpPerSocketContext )

Definition at line 723 of file IocpServer.Cpp.

                                                            {

  PPER_SOCKET_CONTEXT     pTemp;

  EnterCriticalSection(&g_CriticalSection);

  if( g_pCtxtList == NULL ) {

    //
    // add the first node to the linked list
    //
    lpPerSocketContext->pCtxtBack    = NULL;
    lpPerSocketContext->pCtxtForward = NULL;
    g_pCtxtList = lpPerSocketContext;
  } else {

    //
    // add node to head of list
    //
    pTemp = g_pCtxtList;

    g_pCtxtList = lpPerSocketContext;
    lpPerSocketContext->pCtxtBack    = pTemp;
    lpPerSocketContext->pCtxtForward = NULL;

    pTemp->pCtxtForward = lpPerSocketContext;
  }

  LeaveCriticalSection(&g_CriticalSection);
  return;
}

VOID CtxtListDeleteFrom ( PPER_SOCKET_CONTEXT lpPerSocketContext )

Definition at line 758 of file IocpServer.Cpp.

                                                                {

  PPER_SOCKET_CONTEXT pBack;
  PPER_SOCKET_CONTEXT pForward;
  PPER_IO_CONTEXT     pNextIO     = NULL;
  PPER_IO_CONTEXT     pTempIO     = NULL;

  EnterCriticalSection(&g_CriticalSection);

  if( lpPerSocketContext ) {
    pBack       = lpPerSocketContext->pCtxtBack;
    pForward    = lpPerSocketContext->pCtxtForward;

    if( ( pBack == NULL ) && ( pForward == NULL ) ) {

      //
      // This is the only node in the list to delete
      //
      g_pCtxtList = NULL;
    } else if ( ( pBack == NULL ) && ( pForward != NULL ) ) {

      //
      // This is the start node in the list to delete
      //
      pForward->pCtxtBack = NULL;
      g_pCtxtList = pForward;
    } else if ( ( pBack != NULL ) && ( pForward == NULL ) ) {

      //
      // This is the end node in the list to delete
      //
      pBack->pCtxtForward = NULL;
    } else if( pBack && pForward ) {

      //
      // Neither start node nor end node in the list
      //
      pBack->pCtxtForward = pForward;
      pForward->pCtxtBack = pBack;
    }

    //
    // Free all i/o context structures per socket
    //
    pTempIO = (PPER_IO_CONTEXT)(lpPerSocketContext->pIOContext);
    do {
      pNextIO = (PPER_IO_CONTEXT)(pTempIO->pIOContextForward);
      if( pTempIO ) {

        //
        //The overlapped structure is safe to free when only the posted i/o has
        //completed. Here we only need to test those posted but not yet received
        //by PQCS in the shutdown process.
        //
        if( g_bEndServer )
          while( !HasOverlappedIoCompleted((LPOVERLAPPED)pTempIO) ) Sleep(0);
        xfree(pTempIO);
        pTempIO = NULL;
      }
      pTempIO = pNextIO;
    } while( pNextIO );

    xfree(lpPerSocketContext);
    lpPerSocketContext = NULL;

  } else {
    myprintf("CtxtListDeleteFrom: lpPerSocketContext is NULL\n");
  }

  LeaveCriticalSection(&g_CriticalSection);
  return;
}

VOID CtxtListFree ( )

Definition at line 835 of file IocpServer.Cpp.

                    {

  PPER_SOCKET_CONTEXT     pTemp1, pTemp2;

  EnterCriticalSection(&g_CriticalSection);

  pTemp1 = g_pCtxtList;
  while( pTemp1 ) {
    pTemp2 = pTemp1->pCtxtBack;
    CloseClient(pTemp1, FALSE);
    pTemp1 = pTemp2;
  }

  LeaveCriticalSection(&g_CriticalSection);
  return;
}

PPER_SOCKET_CONTEXT UpdateCompletionPort | ( | SOCKET | s,
 |  | IO_OPERATION | ClientIo,
 |  | BOOL | bAddToList
 | ) |  |

Definition at line 608 of file IocpServer.Cpp.

                                      {

  PPER_SOCKET_CONTEXT lpPerSocketContext;

  lpPerSocketContext = CtxtAllocate(sd, ClientIo);
  if( lpPerSocketContext == NULL )
    return(NULL);

  g_hIOCP = CreateIoCompletionPort((HANDLE)sd, g_hIOCP, (DWORD_PTR)lpPerSocketContext, 0);
  if( g_hIOCP == NULL ) {
    myprintf("CreateIoCompletionPort() failed: %d\n", GetLastError());
    if( lpPerSocketContext->pIOContext )
      xfree(lpPerSocketContext->pIOContext);
    xfree(lpPerSocketContext);
    return(NULL);
  }

    //
  //The listening socket context (bAddToList is FALSE) is not added to the list.
  //All other socket contexts are added to the list.
  //
  if( bAddToList ) CtxtListAddTo(lpPerSocketContext);

  if( g_bVerbose )
    myprintf("UpdateCompletionPort: Socket(%d) added to IOCP\n", lpPerSocketContext->Socket);

  return(lpPerSocketContext);
}

BOOL ValidOptions | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 284 of file IocpServer.Cpp.

                                          {

  BOOL bRet = TRUE;

  for( int i = 1; i < argc; i++ ) {
    if( (argv[i][0] =='-') || (argv[i][0] == '/') ) {
      switch( tolower(argv[i][1]) ) {
      case 'e':
        if( strlen(argv[i]) > 3 )
          g_Port = &argv[i][3];
        break;

      case 'v':
        g_bVerbose = TRUE;
        break;

      case '?':
        myprintf("Usage:\n  iocpserver [-p:port] [-v] [-?]\n");
        myprintf("  -e:port\tSpecify echoing port number\n");
        myprintf("  -v\t\tVerbose\n");
        myprintf("  -?\t\tDisplay this help\n");
        bRet = FALSE;
        break;

      default:
        myprintf("Unknown options flag %s\n", argv[i]);
        bRet = FALSE;
        break;
      }
    }
  }

  return(bRet);
}

DWORD WINAPI WorkerThread ( LPVOID WorkContext )

Definition at line 2541 of file Handler.Cpp.

{
MSG msg;
HRESULT hr;
HRESULT hrCoInitialize;
WorkerThreadArgs *pThreadArgs = (WorkerThreadArgs *) lpArg;
HWND hwndWorker;

   pThreadArgs->hr = NOERROR;

   hrCoInitialize = CoInitialize(NULL);

   // need to do a PeekMessage and then set an event to make sure
   // a message loop is created before the first PostMessage is sent.

   PeekMessage(&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE);

   // initialize the dialog box before returning to main thread.
   if (FAILED(hrCoInitialize) )
   {
    pThreadArgs->hr = E_OUTOFMEMORY;
   }
   else
   {

    hwndWorker = CreateWindowEx(0,
              SZ_SAMPLESYNCMGRWORKERWNDCLASS,
              TEXT(""),
              // must use WS_POPUP so the window does not get
              // assigned a hot key by user.
              (WS_DISABLED | WS_POPUP),
              CW_USEDEFAULT,
              CW_USEDEFAULT,
              CW_USEDEFAULT,
              CW_USEDEFAULT,
              NULL,
              NULL,
              g_hmodThisDll,
              pThreadArgs->pThis);

        pThreadArgs->hwnd = hwndWorker;
    pThreadArgs->hr =  hwndWorker ? NOERROR : E_UNEXPECTED;
    }

   hr = pThreadArgs->hr;

   // let the caller know the thread is done initializing.
   if (pThreadArgs->hEvent)
     SetEvent(pThreadArgs->hEvent);

   if (NOERROR == hr)
   {
       // sit in loop receiving messages.
       while (GetMessage(&msg, NULL, 0, 0))
       {
         TranslateMessage(&msg);
         DispatchMessage(&msg);
    }
   }

   if (SUCCEEDED(hrCoInitialize))
       CoUninitialize();

   return 0;
}

Generated on Wed Nov 13 2024 16:54:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/iocp/IocpServerex.Cpp File Reference

  • NetDS
  • WinSock
  • iocp
Defines | Functions | Variables

IocpServerex.Cpp File Reference

#include <winsock2.h>
#include <mswsock.h>
#include <Ws2tcpip.h>
#include <stdio.h>
#include <stdlib.h>
#include "iocpserver.h"

Go to the source code of this file.

Defines

#define | WIN32_LEAN_AND_MEAN
#define | xfree(p) HeapFree(GetProcessHeap(),0,(p))
#define | xmalloc(s) HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,(s))

Functions

VOID | CloseClient (PPER_SOCKET_CONTEXT lpPerSocketContext, BOOL bGraceful)
BOOL | CreateAcceptSocket (BOOL fUpdateIOCP)
BOOL | CreateListenSocket (void)
SOCKET | CreateSocket (void)
BOOL WINAPI | CtrlHandler (DWORD dwEvent)
PPER_SOCKET_CONTEXT | CtxtAllocate (SOCKET sd, IO_OPERATION ClientIO)
VOID | CtxtListAddTo (PPER_SOCKET_CONTEXT lpPerSocketContext)
VOID | CtxtListDeleteFrom (PPER_SOCKET_CONTEXT lpPerSocketContext)
VOID | CtxtListFree ()
void __cdecl | main (int argc, char *argv[])
int | myprintf (const char *lpFormat,...)
PPER_SOCKET_CONTEXT | UpdateCompletionPort (SOCKET sd, IO_OPERATION ClientIo, BOOL bAddToList)
BOOL | ValidOptions (int argc, char *argv[])
DWORD WINAPI | WorkerThread (LPVOID WorkThreadContext)

Variables

BOOL | g_bEndServer = FALSE
BOOL | g_bRestart = TRUE
BOOL | g_bVerbose = FALSE
CRITICAL_SECTION | g_CriticalSection
WSAEVENT | g_hCleanupEvent [1]
HANDLE | g_hIOCP = INVALID_HANDLE_VALUE
PPER_SOCKET_CONTEXT | g_pCtxtList = NULL
PPER_SOCKET_CONTEXT | g_pCtxtListenSocket = NULL
char * | g_Port = DEFAULT_PORT
SOCKET | g_sdListen = INVALID_SOCKET
HANDLE | g_ThreadHandles [MAX_WORKER_THREAD]

Define Documentation

#define WIN32_LEAN_AND_MEAN

Definition at line 41 of file IocpServerex.Cpp.

#define xfree ( p ) HeapFree(GetProcessHeap(),0,(p))

Definition at line 45 of file IocpServerex.Cpp.

#define xmalloc ( s ) HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,(s))

Definition at line 44 of file IocpServerex.Cpp.

Function Documentation

VOID CloseClient | ( | PPER_SOCKET_CONTEXT | lpPerSocketContext,
 |  | BOOL | bGraceful
 | ) |  |

Definition at line 822 of file IocpServerex.Cpp.

                                                                          {

  EnterCriticalSection(&g_CriticalSection);

  if( lpPerSocketContext ) {
    if( g_bVerbose )
      myprintf("CloseClient: Socket(%d) connection closing (graceful=%s)\n",
           lpPerSocketContext->Socket, (bGraceful?"TRUE":"FALSE"));
    if( !bGraceful ) {

      //
      // force the subsequent closesocket to be abortative.
      //
      LINGER  lingerStruct;

      lingerStruct.l_onoff = 1;
      lingerStruct.l_linger = 0;
      setsockopt(lpPerSocketContext->Socket, SOL_SOCKET, SO_LINGER,
             (char *)&lingerStruct, sizeof(lingerStruct) );
    }
    if( lpPerSocketContext->pIOContext->SocketAccept != INVALID_SOCKET ) {
      closesocket(lpPerSocketContext->pIOContext->SocketAccept);
      lpPerSocketContext->pIOContext->SocketAccept = INVALID_SOCKET;
    };

    closesocket(lpPerSocketContext->Socket);
    lpPerSocketContext->Socket = INVALID_SOCKET;
    CtxtListDeleteFrom(lpPerSocketContext);
    lpPerSocketContext = NULL;
  } else {
    myprintf("CloseClient: lpPerSocketContext is NULL\n");
  }

  LeaveCriticalSection(&g_CriticalSection);

  return;
}

BOOL CreateAcceptSocket ( BOOL fUpdateIOCP )

Definition at line 462 of file IocpServerex.Cpp.

                                          {

  int nRet = 0;
  DWORD dwRecvNumBytes = 0;
  DWORD bytes = 0;

  //
  // GUID to Microsoft specific extensions
  //
  GUID acceptex_guid = WSAID_ACCEPTEX;

    //
  //The context for listening socket uses the SockAccept member to store the
  //socket for client connection.
  //
  if( fUpdateIOCP ) {
    g_pCtxtListenSocket = UpdateCompletionPort(g_sdListen, ClientIoAccept, FALSE);
    if( g_pCtxtListenSocket == NULL ) {
      myprintf("failed to update listen socket to IOCP\n");
      return(FALSE);
    }

        // Load the AcceptEx extension function from the provider for this socket
        nRet = WSAIoctl(
            g_sdListen,
            SIO_GET_EXTENSION_FUNCTION_POINTER,
           &acceptex_guid,
            sizeof(acceptex_guid),
           &g_pCtxtListenSocket->fnAcceptEx,
            sizeof(g_pCtxtListenSocket->fnAcceptEx),
           &bytes,
            NULL,
            NULL
            );
        if (nRet == SOCKET_ERROR)
        {
            myprintf("failed to load AcceptEx: %d\n", WSAGetLastError());
            return (FALSE);
        }
  }

  g_pCtxtListenSocket->pIOContext->SocketAccept = CreateSocket();
  if( g_pCtxtListenSocket->pIOContext->SocketAccept == INVALID_SOCKET) {
    myprintf("failed to create new accept socket\n");
    return(FALSE);
  }

  //
  // pay close attention to these parameters and buffer lengths
  //
  nRet = g_pCtxtListenSocket->fnAcceptEx(g_sdListen, g_pCtxtListenSocket->pIOContext->SocketAccept,
                    (LPVOID)(g_pCtxtListenSocket->pIOContext->Buffer),
                    MAX_BUFF_SIZE - (2 * (sizeof(SOCKADDR_STORAGE) + 16)),
                    sizeof(SOCKADDR_STORAGE) + 16, sizeof(SOCKADDR_STORAGE) + 16,
                    &dwRecvNumBytes,
          (LPOVERLAPPED) &(g_pCtxtListenSocket->pIOContext->Overlapped));
  if( nRet == SOCKET_ERROR && (ERROR_IO_PENDING != WSAGetLastError()) ) {
    myprintf("AcceptEx() failed: %d\n", WSAGetLastError());
    return(FALSE);
  }

  return(TRUE);
}

BOOL CreateListenSocket ( void )

Definition at line 378 of file IocpServerex.Cpp.

                              {

  int nRet = 0;
  LINGER lingerStruct;
  struct addrinfo hints;
  struct addrinfo *addrlocal = NULL;

  lingerStruct.l_onoff = 1;
  lingerStruct.l_linger = 0;

  //
  // Resolve the interface
  //
  memset(&hints, 0, sizeof(hints));
  hints.ai_flags  = AI_PASSIVE;
  hints.ai_family = AF_INET;
  hints.ai_socktype = SOCK_STREAM;
  hints.ai_protocol = IPPROTO_IP;

  if( getaddrinfo(NULL, g_Port, &hints, &addrlocal) != 0 ) {
    myprintf("getaddrinfo() failed with error %d\n", WSAGetLastError());
        return(FALSE);
  }

  if( addrlocal == NULL ) {
    myprintf("getaddrinfo() failed to resolve/convert the interface\n");
        return(FALSE);
  }

  g_sdListen = CreateSocket();
  if( g_sdListen == INVALID_SOCKET) {
    freeaddrinfo(addrlocal);
    return(FALSE);
  }

    nRet = bind(g_sdListen, addrlocal->ai_addr, addrlocal->ai_addrlen);
  if( nRet == SOCKET_ERROR) {
    myprintf("bind() failed: %d\n", WSAGetLastError());
    freeaddrinfo(addrlocal);
    return(FALSE);
  }

  nRet = listen(g_sdListen, 5);
  if( nRet == SOCKET_ERROR ) {
    myprintf("listen() failed: %d\n", WSAGetLastError());
    freeaddrinfo(addrlocal);
    return(FALSE);
  }

  freeaddrinfo(addrlocal);

  return(TRUE);
}

SOCKET CreateSocket ( void )

Definition at line 308 of file IocpServerex.Cpp.

                          {
  int nRet = 0;
  int nZero = 0;
  SOCKET sdSocket = INVALID_SOCKET;

  sdSocket = WSASocket(AF_INET, SOCK_STREAM, IPPROTO_IP, NULL, 0, WSA_FLAG_OVERLAPPED);
  if( sdSocket == INVALID_SOCKET ) {
    myprintf("WSASocket(sdSocket) failed: %d\n", WSAGetLastError());
    return(sdSocket);
  }

    //
  // Disable send buffering on the socket.  Setting SO_SNDBUF
  // to 0 causes winsock to stop buffering sends and perform
  // sends directly from our buffers, thereby save one memory copy.
  //
    // However, this does prevent the socket from ever filling the
    // send pipeline. This can lead to packets being sent that are
    // not full (i.e. the overhead of the IP and TCP headers is
    // great compared to the amount of data being carried).
    //
    // Disabling the send buffer has less serious repercussions
    // than disabling the receive buffer.
  //
  nZero = 0;
  nRet = setsockopt(sdSocket, SOL_SOCKET, SO_SNDBUF, (char *)&nZero, sizeof(nZero));
  if( nRet == SOCKET_ERROR) {
    myprintf("setsockopt(SNDBUF) failed: %d\n", WSAGetLastError());
    return(sdSocket);
  }

    //
    // Don't disable receive buffering. This will cause poor network
    // performance since if no receive is posted and no receive buffers,
    // the TCP stack will set the window size to zero and the peer will
    // no longer be allowed to send data.
    //

    //
    // Do not set a linger value...especially don't set it to an abortive
    // close. If you set abortive close and there happens to be a bit of
    // data remaining to be transfered (or data that has not been
    // acknowledged by the peer), the connection will be forcefully reset
    // and will lead to a loss of data (i.e. the peer won't get the last
    // bit of data). This is BAD. If you are worried about malicious
    // clients connecting and then not sending or receiving, the server
    // should maintain a timer on each connection. If after some point,
    // the server deems a connection is "stale" it can then set linger
    // to be abortive and close the connection.
    //

    /*
  LINGER lingerStruct;

  lingerStruct.l_onoff = 1;
  lingerStruct.l_linger = 0;
  nRet = setsockopt(sdSocket, SOL_SOCKET, SO_LINGER,
            (char *)&lingerStruct, sizeof(lingerStruct));
  if( nRet == SOCKET_ERROR ) {
    myprintf("setsockopt(SO_LINGER) failed: %d\n", WSAGetLastError());
    return(sdSocket);
  }
    */

  return(sdSocket);
}

BOOL WINAPI CtrlHandler ( DWORD dwEvent )

Definition at line 277 of file IocpServerex.Cpp.

                                        {

  switch( dwEvent ) {
  case CTRL_BREAK_EVENT:
    g_bRestart = TRUE;
  case CTRL_C_EVENT:
  case CTRL_LOGOFF_EVENT:
  case CTRL_SHUTDOWN_EVENT:
  case CTRL_CLOSE_EVENT:
    if( g_bVerbose )
      myprintf("CtrlHandler: closing listening socket\n");

    g_bEndServer = TRUE;

    WSASetEvent(g_hCleanupEvent[0]);
    break;

  default:
    //
    // unknown type--better pass it on.
    //

    return(FALSE);
  }
  return(TRUE);
}

PPER_SOCKET_CONTEXT CtxtAllocate | ( | SOCKET | sd,
 |  | IO_OPERATION | ClientIO
 | ) |  |

Definition at line 863 of file IocpServerex.Cpp.

                                                                    {

  PPER_SOCKET_CONTEXT lpPerSocketContext;

  EnterCriticalSection(&g_CriticalSection);

  lpPerSocketContext = (PPER_SOCKET_CONTEXT)xmalloc(sizeof(PER_SOCKET_CONTEXT));
  if( lpPerSocketContext ) {
    lpPerSocketContext->pIOContext = (PPER_IO_CONTEXT)xmalloc(sizeof(PER_IO_CONTEXT));
    if( lpPerSocketContext->pIOContext ) {
      lpPerSocketContext->Socket = sd;
      lpPerSocketContext->pCtxtBack = NULL;
      lpPerSocketContext->pCtxtForward = NULL;

      lpPerSocketContext->pIOContext->Overlapped.Internal = 0;
      lpPerSocketContext->pIOContext->Overlapped.InternalHigh = 0;
      lpPerSocketContext->pIOContext->Overlapped.Offset = 0;
      lpPerSocketContext->pIOContext->Overlapped.OffsetHigh = 0;
      lpPerSocketContext->pIOContext->Overlapped.hEvent = NULL;
      lpPerSocketContext->pIOContext->IOOperation = ClientIO;
      lpPerSocketContext->pIOContext->pIOContextForward = NULL;
      lpPerSocketContext->pIOContext->nTotalBytes = 0;
      lpPerSocketContext->pIOContext->nSentBytes  = 0;
      lpPerSocketContext->pIOContext->wsabuf.buf  = lpPerSocketContext->pIOContext->Buffer;
      lpPerSocketContext->pIOContext->wsabuf.len  = sizeof(lpPerSocketContext->pIOContext->Buffer);
      lpPerSocketContext->pIOContext->SocketAccept = INVALID_SOCKET;

      ZeroMemory(lpPerSocketContext->pIOContext->wsabuf.buf, lpPerSocketContext->pIOContext->wsabuf.len);
    } else {
      xfree(lpPerSocketContext);
      myprintf("HeapAlloc() PER_IO_CONTEXT failed: %d\n", GetLastError());
    }

  } else {
    myprintf("HeapAlloc() PER_SOCKET_CONTEXT failed: %d\n", GetLastError());
    return(NULL);
  }

  LeaveCriticalSection(&g_CriticalSection);

  return(lpPerSocketContext);
}

VOID CtxtListAddTo ( PPER_SOCKET_CONTEXT lpPerSocketContext )

Definition at line 909 of file IocpServerex.Cpp.

                                                            {

  PPER_SOCKET_CONTEXT pTemp;

  EnterCriticalSection(&g_CriticalSection);

  if( g_pCtxtList == NULL ) {

    //
    // add the first node to the linked list
    //
    lpPerSocketContext->pCtxtBack    = NULL;
    lpPerSocketContext->pCtxtForward = NULL;
    g_pCtxtList = lpPerSocketContext;
  } else {

    //
    // add node to head of list
    //
    pTemp = g_pCtxtList;

    g_pCtxtList = lpPerSocketContext;
    lpPerSocketContext->pCtxtBack    = pTemp;
    lpPerSocketContext->pCtxtForward = NULL;

    pTemp->pCtxtForward = lpPerSocketContext;
  }

  LeaveCriticalSection(&g_CriticalSection);

  return;
}

VOID CtxtListDeleteFrom ( PPER_SOCKET_CONTEXT lpPerSocketContext )

Definition at line 945 of file IocpServerex.Cpp.

                                                                {

  PPER_SOCKET_CONTEXT pBack;
  PPER_SOCKET_CONTEXT pForward;
  PPER_IO_CONTEXT     pNextIO     = NULL;
  PPER_IO_CONTEXT     pTempIO     = NULL;

  EnterCriticalSection(&g_CriticalSection);

  if( lpPerSocketContext ) {
    pBack       = lpPerSocketContext->pCtxtBack;
    pForward    = lpPerSocketContext->pCtxtForward;

    if( pBack == NULL && pForward == NULL ) {

      //
      // This is the only node in the list to delete
      //
      g_pCtxtList = NULL;
    } else if( pBack == NULL && pForward != NULL ) {

      //
      // This is the start node in the list to delete
      //
      pForward->pCtxtBack = NULL;
      g_pCtxtList = pForward;
    } else if( pBack != NULL && pForward == NULL ) {

      //
      // This is the end node in the list to delete
      //
      pBack->pCtxtForward = NULL;
    } else if( pBack && pForward ) {

      //
      // Neither start node nor end node in the list
      //
      pBack->pCtxtForward = pForward;
      pForward->pCtxtBack = pBack;
    }

        //
    // Free all i/o context structures per socket
    //
    pTempIO = (PPER_IO_CONTEXT)(lpPerSocketContext->pIOContext);
    do {
      pNextIO = (PPER_IO_CONTEXT)(pTempIO->pIOContextForward);
      if( pTempIO ) {

        //
        //The overlapped structure is safe to free when only the posted i/o has
        //completed. Here we only need to test those posted but not yet received
        //by PQCS in the shutdown process.
        //
        if( g_bEndServer )
          while( !HasOverlappedIoCompleted((LPOVERLAPPED)pTempIO) ) Sleep(0);
        xfree(pTempIO);
        pTempIO = NULL;
      }
      pTempIO = pNextIO;
    } while( pNextIO );

    xfree(lpPerSocketContext);
    lpPerSocketContext = NULL;
  } else {
    myprintf("CtxtListDeleteFrom: lpPerSocketContext is NULL\n");
  }

  LeaveCriticalSection(&g_CriticalSection);

  return;
}

VOID CtxtListFree ( )

Definition at line 1021 of file IocpServerex.Cpp.

                    {
  PPER_SOCKET_CONTEXT pTemp1, pTemp2;

  EnterCriticalSection(&g_CriticalSection);

  pTemp1 = g_pCtxtList;
  while( pTemp1 ) {
    pTemp2 = pTemp1->pCtxtBack;
    CloseClient(pTemp1, FALSE);
    pTemp1 = pTemp2;
  }

  LeaveCriticalSection(&g_CriticalSection);

  return;
}

void __cdecl main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 73 of file IocpServerex.Cpp.

                                            {

    SYSTEM_INFO systemInfo;
  WSADATA wsaData;
  DWORD dwThreadCount = 0;
  int nRet = 0;

    g_ThreadHandles[0] = (HANDLE)WSA_INVALID_EVENT;

  for( int i = 0; i < MAX_WORKER_THREAD; i++ ) {
    g_ThreadHandles[i] = INVALID_HANDLE_VALUE;
  }

  if( !ValidOptions(argc, argv) )
    return;

  if( !SetConsoleCtrlHandler(CtrlHandler, TRUE) ) {
    myprintf("SetConsoleCtrlHandler() failed to install console handler: %d\n",
        GetLastError());
    return;
  }

  GetSystemInfo(&systemInfo);
  dwThreadCount = systemInfo.dwNumberOfProcessors * 2;

  g_hCleanupEvent[0] = WSACreateEvent();
  if( g_hCleanupEvent[0] == WSA_INVALID_EVENT ) {
    myprintf("WSACreateEvent() failed: %d\n", WSAGetLastError());
    return;
  }

  if( (nRet = WSAStartup(0x202, &wsaData)) != 0 ) {
    myprintf("WSAStartup() failed: %d\n",nRet);
    SetConsoleCtrlHandler(CtrlHandler, FALSE);
    if(g_hCleanupEvent[0] != WSA_INVALID_EVENT) {
      WSACloseEvent(g_hCleanupEvent[0]);
      g_hCleanupEvent[0] = WSA_INVALID_EVENT;
    }
    return;
  }

  InitializeCriticalSection(&g_CriticalSection);

  while( g_bRestart ) {
    g_bRestart = FALSE;
    g_bEndServer = FALSE;
    WSAResetEvent(g_hCleanupEvent[0]);

    __try {

            //
      // notice that we will create more worker threads (dwThreadCount) than
      // the thread concurrency limit on the IOCP.
      //
      g_hIOCP = CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, 0, 0);
            if( g_hIOCP == NULL ) {
        myprintf("CreateIoCompletionPort() failed to create I/O completion port: %d\n",
            GetLastError());
        __leave;
      }

      for( DWORD dwCPU=0; dwCPU<dwThreadCount; dwCPU++ ) {

        //
        // Create worker threads to service the overlapped I/O requests.  The decision
        // to create 2 worker threads per CPU in the system is a heuristic.  Also,
        // note that thread handles are closed right away, because we will not need them
        // and the worker threads will continue to execute.
        //
        HANDLE  hThread;
        DWORD   dwThreadId;

        hThread = CreateThread(NULL, 0, WorkerThread, g_hIOCP, 0, &dwThreadId);
        if( hThread == NULL ) {
          myprintf("CreateThread() failed to create worker thread: %d\n",
               GetLastError());
          __leave;
        }
        g_ThreadHandles[dwCPU] = hThread;
        hThread = INVALID_HANDLE_VALUE;
      }

      if( !CreateListenSocket() )
        __leave;

      if( !CreateAcceptSocket(TRUE) )
        __leave;

      WSAWaitForMultipleEvents(1, g_hCleanupEvent, TRUE, WSA_INFINITE, FALSE);
    }

    __finally {

      g_bEndServer = TRUE;

      //
      // Cause worker threads to exit
      //
      if( g_hIOCP ) {
        for( DWORD i = 0; i < dwThreadCount; i++ )
          PostQueuedCompletionStatus(g_hIOCP, 0, 0, NULL);
      }

            //
      // Make sure worker threads exits.
      //
      if( WAIT_OBJECT_0 != WaitForMultipleObjects(dwThreadCount,  g_ThreadHandles, TRUE, 1000) )
        myprintf("WaitForMultipleObjects() failed: %d\n", GetLastError());
      else
        for( DWORD i=0; i<dwThreadCount; i++ ) {
          if( g_ThreadHandles[i] != INVALID_HANDLE_VALUE )
            CloseHandle(g_ThreadHandles[i]);
          g_ThreadHandles[i] = INVALID_HANDLE_VALUE;
        }

      if( g_sdListen != INVALID_SOCKET ) {
        closesocket(g_sdListen);
        g_sdListen = INVALID_SOCKET;
      }

      if( g_pCtxtListenSocket ) {
        while( !HasOverlappedIoCompleted((LPOVERLAPPED)&g_pCtxtListenSocket->pIOContext->Overlapped) )
          Sleep(0);

        if( g_pCtxtListenSocket->pIOContext->SocketAccept != INVALID_SOCKET )
          closesocket(g_pCtxtListenSocket->pIOContext->SocketAccept);
        g_pCtxtListenSocket->pIOContext->SocketAccept = INVALID_SOCKET;

                //
        // We know there is only one overlapped I/O on the listening socket
        //
        if( g_pCtxtListenSocket->pIOContext )
          xfree(g_pCtxtListenSocket->pIOContext);

        if( g_pCtxtListenSocket )
          xfree(g_pCtxtListenSocket);
        g_pCtxtListenSocket = NULL;
      }

      CtxtListFree();

      if( g_hIOCP ) {
        CloseHandle(g_hIOCP);
        g_hIOCP = NULL;
      }
    } //finally

    if( g_bRestart ) {
      myprintf("\niocpserverex is restarting...\n");
    } else
      myprintf("\niocpserverex is exiting...\n");

  } //while (g_bRestart)

  DeleteCriticalSection(&g_CriticalSection);
  if(g_hCleanupEvent[0] != WSA_INVALID_EVENT) {
    WSACloseEvent(g_hCleanupEvent[0]);
    g_hCleanupEvent[0] = WSA_INVALID_EVENT;
  }
  WSACleanup();
  SetConsoleCtrlHandler(CtrlHandler, FALSE);
} //main

int myprintf | ( | const char * | lpFormat,
 |  |  | ...
 | ) |  |

Definition at line 1038 of file IocpServerex.Cpp.

                                          {

  int nLen = 0;
  int nRet = 0;
  char cBuffer[512] ;
  va_list arglist ;
  HANDLE hOut = NULL;

  ZeroMemory(cBuffer, sizeof(cBuffer));

  va_start(arglist, lpFormat);

  nLen = lstrlen( lpFormat ) ;
  nRet = wvsprintf( cBuffer, lpFormat, arglist );

  if( nRet >= nLen || GetLastError() == 0 ) {
    hOut = GetStdHandle(STD_OUTPUT_HANDLE) ;
    if( hOut != INVALID_HANDLE_VALUE )
      WriteConsole( hOut, cBuffer, lstrlen(cBuffer), (LPDWORD)&nLen, NULL ) ;
  }

  return nLen ;
}

PPER_SOCKET_CONTEXT UpdateCompletionPort | ( | SOCKET | sd,
 |  | IO_OPERATION | ClientIo,
 |  | BOOL | bAddToList
 | ) |  |

Definition at line 787 of file IocpServerex.Cpp.

                                                          {

  PPER_SOCKET_CONTEXT lpPerSocketContext;

  lpPerSocketContext = CtxtAllocate(sd, ClientIo);
  if( lpPerSocketContext == NULL )
    return(NULL);

  g_hIOCP = CreateIoCompletionPort((HANDLE)sd, g_hIOCP, (DWORD_PTR)lpPerSocketContext, 0);
  if(g_hIOCP == NULL) {
    myprintf("CreateIoCompletionPort() failed: %d\n", GetLastError());
    if( lpPerSocketContext->pIOContext )
      xfree(lpPerSocketContext->pIOContext);
    xfree(lpPerSocketContext);
    return(NULL);
  }

    //
  //The listening socket context (bAddToList is FALSE) is not added to the list.
  //All other socket contexts are added to the list.
  //
  if( bAddToList ) CtxtListAddTo(lpPerSocketContext);

  if( g_bVerbose )
    myprintf("UpdateCompletionPort: Socket(%d) added to IOCP\n", lpPerSocketContext->Socket);

  return(lpPerSocketContext);
}

BOOL ValidOptions | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 239 of file IocpServerex.Cpp.

                                          {
  BOOL bRet = TRUE;

  for( int i=1; i<argc; i++ ) {
    if( (argv[i][0] =='-') || (argv[i][0] == '/') ) {
      switch( tolower(argv[i][1]) ) {
      case 'e':
        if( strlen(argv[i]) > 3 )
          g_Port = &argv[i][3];
        break;

      case 'v':
        g_bVerbose = TRUE;
        break;

      case '?':
        myprintf("Usage:\n  iocpserver [-p:port] [-v] [-?]\n");
        myprintf("  -e:port\tSpecify echoing port number\n");
        myprintf("  -v\t\tVerbose\n");
        myprintf("  -?\t\tDisplay this help\n");
        bRet = FALSE;
        break;

      default:
        myprintf("Unknown options flag %s\n", argv[i]);
        bRet = FALSE;
        break;
      }
    }
  }

  return(bRet);
}

DWORD WINAPI WorkerThread ( LPVOID WorkThreadContext )

Definition at line 529 of file IocpServerex.Cpp.

                                                      {

  HANDLE hIOCP = (HANDLE)WorkThreadContext;
  BOOL bSuccess = FALSE;
  int nRet = 0;
  LPWSAOVERLAPPED lpOverlapped = NULL;
  PPER_SOCKET_CONTEXT lpPerSocketContext = NULL;
  PPER_SOCKET_CONTEXT lpAcceptSocketContext = NULL;
  PPER_IO_CONTEXT lpIOContext = NULL;
  WSABUF buffRecv;
  WSABUF buffSend;
  DWORD dwRecvNumBytes = 0;
  DWORD dwSendNumBytes = 0;
  DWORD dwFlags = 0;
  DWORD dwIoSize = 0;

  while( TRUE ) {

        //
    // continually loop to service io completion packets
    //
    bSuccess = GetQueuedCompletionStatus(
                      hIOCP,
                      &dwIoSize,
                      (PDWORD_PTR)&lpPerSocketContext,
                      (LPOVERLAPPED *)&lpOverlapped,
                      INFINITE
                      );
    if( !bSuccess )
      myprintf("GetQueuedCompletionStatus() failed: %d\n", GetLastError());

    if( lpPerSocketContext == NULL ) {

      //
      // CTRL-C handler used PostQueuedCompletionStatus to post an I/O packet with
      // a NULL CompletionKey (or if we get one for any reason).  It is time to exit.
      //
      return(0);
    }

    if( g_bEndServer ) {

      //
      // main thread will do all cleanup needed - see finally block
      //
      return(0);
    }

    lpIOContext = (PPER_IO_CONTEXT)lpOverlapped;

        //
    //We should never skip the loop and not post another AcceptEx if the current
    //completion packet is for previous AcceptEx
    //
    if( lpIOContext->IOOperation != ClientIoAccept ) {
      if( !bSuccess || (bSuccess && (0 == dwIoSize)) ) {

        //
        // client connection dropped, continue to service remaining (and possibly
        // new) client connections
        //
        CloseClient(lpPerSocketContext, FALSE);
        continue;
      }
    }

        //
    // determine what type of IO packet has completed by checking the PER_IO_CONTEXT
    // associated with this socket.  This will determine what action to take.
    //
    switch( lpIOContext->IOOperation ) {
    case ClientIoAccept:

      //
      // When the AcceptEx function returns, the socket sAcceptSocket is
      // in the default state for a connected socket. The socket sAcceptSocket
      // does not inherit the properties of the socket associated with
      // sListenSocket parameter until SO_UPDATE_ACCEPT_CONTEXT is set on
      // the socket. Use the setsockopt function to set the SO_UPDATE_ACCEPT_CONTEXT
      // option, specifying sAcceptSocket as the socket handle and sListenSocket
      // as the option value.
      //
      nRet = setsockopt(
               lpPerSocketContext->pIOContext->SocketAccept,
               SOL_SOCKET,
               SO_UPDATE_ACCEPT_CONTEXT,
               (char *)&g_sdListen,
               sizeof(g_sdListen)
               );

      if( nRet == SOCKET_ERROR ) {

        //
        //just warn user here.
        //
        myprintf("setsockopt(SO_UPDATE_ACCEPT_CONTEXT) failed to update accept socket\n");
        WSASetEvent(g_hCleanupEvent[0]);
        return(0);
      }

      lpAcceptSocketContext = UpdateCompletionPort(
                            lpPerSocketContext->pIOContext->SocketAccept,
                            ClientIoAccept, TRUE);

      if( lpAcceptSocketContext == NULL ) {

        //
        //just warn user here.
        //
        myprintf("failed to update accept socket to IOCP\n");
        WSASetEvent(g_hCleanupEvent[0]);
        return(0);
      }

      if( dwIoSize ) {
        lpAcceptSocketContext->pIOContext->IOOperation = ClientIoWrite;
        lpAcceptSocketContext->pIOContext->nTotalBytes  = dwIoSize;
        lpAcceptSocketContext->pIOContext->nSentBytes   = 0;
        lpAcceptSocketContext->pIOContext->wsabuf.len   = dwIoSize;
        CopyMemory(lpAcceptSocketContext->pIOContext->Buffer, lpPerSocketContext->pIOContext->Buffer, sizeof(lpPerSocketContext->pIOContext->Buffer));
        lpAcceptSocketContext->pIOContext->wsabuf.buf = lpAcceptSocketContext->pIOContext->Buffer;

        nRet = WSASend(
                lpPerSocketContext->pIOContext->SocketAccept,
                &lpAcceptSocketContext->pIOContext->wsabuf, 1,
                &dwSendNumBytes,
                0,
                &(lpAcceptSocketContext->pIOContext->Overlapped), NULL);

        if( nRet == SOCKET_ERROR && (ERROR_IO_PENDING != WSAGetLastError()) ) {
          myprintf ("WSASend() failed: %d\n", WSAGetLastError());
          CloseClient(lpAcceptSocketContext, FALSE);
        } else if( g_bVerbose ) {
          myprintf("WorkerThread %d: Socket(%d) AcceptEx completed (%d bytes), Send posted\n",
               GetCurrentThreadId(), lpPerSocketContext->Socket, dwIoSize);
        }
      } else {

        //
        // AcceptEx completes but doesn't read any data so we need to post
        // an outstanding overlapped read.
        //
        lpAcceptSocketContext->pIOContext->IOOperation = ClientIoRead;
        dwRecvNumBytes = 0;
        dwFlags = 0;
        buffRecv.buf = lpAcceptSocketContext->pIOContext->Buffer,
        buffRecv.len = MAX_BUFF_SIZE;
        nRet = WSARecv(
                lpAcceptSocketContext->Socket,
                &buffRecv, 1,
                &dwRecvNumBytes,
                &dwFlags,
                &lpAcceptSocketContext->pIOContext->Overlapped, NULL);
        if( nRet == SOCKET_ERROR && (ERROR_IO_PENDING != WSAGetLastError()) ) {
          myprintf ("WSARecv() failed: %d\n", WSAGetLastError());
          CloseClient(lpAcceptSocketContext, FALSE);
        }
      }

            //
      //Time to post another outstanding AcceptEx
      //
      if( !CreateAcceptSocket(FALSE) ) {
        myprintf("Please shut down and reboot the server.\n");
        WSASetEvent(g_hCleanupEvent[0]);
        return(0);
      }
      break;

    case ClientIoRead:

            //
      // a read operation has completed, post a write operation to echo the
      // data back to the client using the same data buffer.
      //
      lpIOContext->IOOperation = ClientIoWrite;
      lpIOContext->nTotalBytes = dwIoSize;
      lpIOContext->nSentBytes  = 0;
      lpIOContext->wsabuf.len  = dwIoSize;
      dwFlags = 0;
      nRet = WSASend(
              lpPerSocketContext->Socket,
              &lpIOContext->wsabuf, 1, &dwSendNumBytes,
              dwFlags,
              &(lpIOContext->Overlapped), NULL);
      if( nRet == SOCKET_ERROR && (ERROR_IO_PENDING != WSAGetLastError()) ) {
        myprintf("WSASend() failed: %d\n", WSAGetLastError());
        CloseClient(lpPerSocketContext, FALSE);
      } else if( g_bVerbose ) {
        myprintf("WorkerThread %d: Socket(%d) Recv completed (%d bytes), Send posted\n",
             GetCurrentThreadId(), lpPerSocketContext->Socket, dwIoSize);
      }
      break;

    case ClientIoWrite:

      //
      // a write operation has completed, determine if all the data intended to be
      // sent actually was sent.
      //
      lpIOContext->IOOperation = ClientIoWrite;
      lpIOContext->nSentBytes  += dwIoSize;
      dwFlags = 0;
      if( lpIOContext->nSentBytes < lpIOContext->nTotalBytes ) {

        //
        // the previous write operation didn't send all the data,
        // post another send to complete the operation
        //
        buffSend.buf = lpIOContext->Buffer + lpIOContext->nSentBytes;
        buffSend.len = lpIOContext->nTotalBytes - lpIOContext->nSentBytes;
        nRet = WSASend (
                 lpPerSocketContext->Socket,
                 &buffSend, 1, &dwSendNumBytes,
                 dwFlags,
                 &(lpIOContext->Overlapped), NULL);
        if( nRet == SOCKET_ERROR && (ERROR_IO_PENDING != WSAGetLastError()) ) {
          myprintf ("WSASend() failed: %d\n", WSAGetLastError());
          CloseClient(lpPerSocketContext, FALSE);
        } else if( g_bVerbose ) {
          myprintf("WorkerThread %d: Socket(%d) Send partially completed (%d bytes), Recv posted\n",
               GetCurrentThreadId(), lpPerSocketContext->Socket, dwIoSize);
        }
      } else {

        //
        // previous write operation completed for this socket, post another recv
        //
        lpIOContext->IOOperation = ClientIoRead;
        dwRecvNumBytes = 0;
        dwFlags = 0;
        buffRecv.buf = lpIOContext->Buffer,
        buffRecv.len = MAX_BUFF_SIZE;
        nRet = WSARecv(
                lpPerSocketContext->Socket,
                &buffRecv, 1, &dwRecvNumBytes,
                &dwFlags,
                &lpIOContext->Overlapped, NULL);
        if( nRet == SOCKET_ERROR && (ERROR_IO_PENDING != WSAGetLastError()) ) {
          myprintf ("WSARecv() failed: %d\n", WSAGetLastError());
          CloseClient(lpPerSocketContext, FALSE);
        } else if( g_bVerbose ) {
          myprintf("WorkerThread %d: Socket(%d) Send completed (%d bytes), Recv posted\n",
               GetCurrentThreadId(), lpPerSocketContext->Socket, dwIoSize);
        }
      }
      break;

    } //switch
  } //while
  return(0);
}

Variable Documentation

BOOL g_bEndServer = FALSE

Definition at line 56 of file IocpServerex.Cpp.

BOOL g_bRestart = TRUE

Definition at line 57 of file IocpServerex.Cpp.

BOOL g_bVerbose = FALSE

Definition at line 58 of file IocpServerex.Cpp.

CRITICAL_SECTION g_CriticalSection

Definition at line 69 of file IocpServerex.Cpp.

WSAEVENT g_hCleanupEvent[1]

Definition at line 62 of file IocpServerex.Cpp.

HANDLE g_hIOCP = INVALID_HANDLE_VALUE

Definition at line 59 of file IocpServerex.Cpp.

PPER_SOCKET_CONTEXT g_pCtxtList = NULL

Definition at line 64 of file IocpServerex.Cpp.

PPER_SOCKET_CONTEXT g_pCtxtListenSocket = NULL

Definition at line 63 of file IocpServerex.Cpp.

char* g_Port = DEFAULT_PORT

Definition at line 55 of file IocpServerex.Cpp.

SOCKET g_sdListen = INVALID_SOCKET

Definition at line 60 of file IocpServerex.Cpp.

HANDLE g_ThreadHandles[MAX_WORKER_THREAD]

Definition at line 61 of file IocpServerex.Cpp.

Generated on Wed Nov 13 2024 16:54:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/iphdrinc/iphdr.h File Reference

  • NetDS
  • WinSock
  • iphdrinc
Classes | Typedefs

iphdr.h File Reference

#include <pshpack1.h>
#include <poppack.h>

Go to the source code of this file.

Classes

struct | ip_hdr
struct | ipv6_fragment_hdr
struct | ipv6_hdr
struct | udp_hdr

Typedefs

typedef struct ip_hdr | IPV4_HDR
typedef struct ipv6_fragment_hdr | IPV6_FRAGMENT_HDR
typedef struct ipv6_hdr | IPV6_HDR
typedef struct ip_hdr * | LPIPV4_HDR
typedef struct ipv6_fragment_hdr * | LPIPV6_FRAGMENT_HDR
typedef struct ipv6_hdr * | LPIPV6_HDR
typedef struct ip_hdr * | PIPV4_HDR
typedef struct ipv6_fragment_hdr * | PIPV6_FRAGMENT_HDR
typedef struct ipv6_hdr * | PIPV6_HDR
typedef struct udp_hdr * | PUDP_HDR
typedef struct udp_hdr | UDP_HDR

Typedef Documentation

typedef struct ip_hdr IPV4_HDR
typedef struct ipv6_fragment_hdr IPV6_FRAGMENT_HDR
typedef struct ipv6_hdr IPV6_HDR
typedef struct ip_hdr* LPIPV4_HDR
typedef struct ipv6_fragment_hdr* LPIPV6_FRAGMENT_HDR
typedef struct ipv6_hdr* LPIPV6_HDR
typedef struct ip_hdr * PIPV4_HDR
typedef struct ipv6_fragment_hdr * PIPV6_FRAGMENT_HDR
typedef struct ipv6_hdr * PIPV6_HDR
typedef struct udp_hdr * PUDP_HDR
typedef struct udp_hdr UDP_HDR
Generated on Wed Nov 13 2024 16:54:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/iphdrinc/rawudp.c File Reference

  • NetDS
  • WinSock
  • iphdrinc
Defines | Functions | Variables

rawudp.c File Reference

#include <winsock2.h>
#include <ws2tcpip.h>
#include <stdio.h>
#include <stdlib.h>
#include "resolve.h"
#include "iphdr.h"

Go to the source code of this file.

Defines

#define | DEFAULT_COUNT 5
#define | DEFAULT_MESSAGE "This is a test"
#define | DEFAULT_MTU 1496
#define | DEFAULT_PORT 5150
#define | DEFAULT_SEND_COUNT 10
#define | DEFAULT_TTL 8
#define | FRAGMENT_HEADER_PROTOCOL 44
#define | MAX_PACKET (0xFFFF + sizeof(IPV6_HDR))
#define | MAX_PACKET_FRAGMENTS 100

Functions

USHORT | checksum (USHORT *buffer, int size)
void | ComputeUdpPseudoHeaderChecksumV4 (char *pseudobuf, void *iphdr, UDP_HDR *udphdr, char *payload, int payloadlen)
void | ComputeUdpPseudoHeaderChecksumV6 (char *pseudobuf, void *iphdr, UDP_HDR *udphdr, char *payload, int payloadlen)
int | InitIpv4Header (char *buf, SOCKADDR *src, SOCKADDR *dest, int ttl, int proto, int payloadlen)
int | InitIpv6FragmentHeader (char *buf, unsigned long offset, int nextproto, int id, int lastfragment)
int | InitIpv6Header (char *buf, SOCKADDR *src, SOCKADDR *dest, int ttl, int proto, int payloadlen)
int | InitUdpHeader (char *buf, SOCKADDR *src, SOCKADDR *dest, int payloadlen)
int _cdecl | main (int argc, char **argv)
void | memfill (char *dest, int destlen, char *data, int datalen)
int | PacketizeIpv4 (WSABUF *Packets, int *PacketCount, char *PseudoBuffer, struct addrinfo *src, struct addrinfo *dest, char *payload, int payloadlen)
int | PacketizeIpv6 (WSABUF *Packets, int *PacketCount, char *PseudoBuffer, struct addrinfo *src, struct addrinfo *dest, char *payload, int payloadlen)
void | usage (char *progname)
void | ValidateArgs (int argc, char **argv)

Variables

int | gAddressFamily = AF_UNSPEC
char * | gDestAddress = NULL
char * | gDestPort = NULL
char * | gMessage = NULL
int | gMtuSize = DEFAULT_MTU
int | gProtocol = IPPROTO_UDP
BOOL | gReadRaw = TRUE
DWORD | gSendCount = DEFAULT_SEND_COUNT
BOOL | gSender = TRUE
int | gSendSize = 0
int | gSocketType = SOCK_DGRAM
char * | gSrcAddress = NULL
char * | gSrcPort = NULL

Define Documentation

#define DEFAULT_COUNT 5

Definition at line 60 of file rawudp.c.

#define DEFAULT_MESSAGE "This is a test"

Definition at line 61 of file rawudp.c.

#define DEFAULT_MTU 1496

Definition at line 53 of file rawudp.c.

#define DEFAULT_PORT 5150

Definition at line 59 of file rawudp.c.

#define DEFAULT_SEND_COUNT 10

Definition at line 63 of file rawudp.c.

#define DEFAULT_TTL 8

Definition at line 54 of file rawudp.c.

#define FRAGMENT_HEADER_PROTOCOL 44

Definition at line 65 of file rawudp.c.

#define MAX_PACKET (0xFFFF + sizeof(IPV6_HDR))

Definition at line 56 of file rawudp.c.

#define MAX_PACKET_FRAGMENTS 100

Definition at line 57 of file rawudp.c.

Function Documentation

USHORT checksum | ( | USHORT * | buffer,
 |  | int | size
 | ) |  |

Definition at line 247 of file rawudp.c.

{
    unsigned long cksum=0;

    while (size > 1)
    {
        cksum += *buffer++;
        size  -= sizeof(USHORT);
    }
    // If the buffer was not a multiple of 16-bits, add the last byte
    if (size)
    {
        cksum += *(UCHAR*)buffer;
    }
    // Add the low order 16-bits to the high order 16-bits
    cksum = (cksum >> 16) + (cksum & 0xffff);
    cksum += (cksum >>16);

    // Take the 1's complement
    return (USHORT)(~cksum);
}

void ComputeUdpPseudoHeaderChecksumV4 | ( | char * | pseudobuf,
 |  | void * | iphdr,
 |  | UDP_HDR * | udphdr,
 |  | char * | payload,
 |  | int | payloadlen
 | ) |  |

Definition at line 430 of file rawudp.c.

{
    IPV4_HDR     *v4hdr=NULL;
    unsigned long zero=0;
    char         *ptr=NULL;
    int           chksumlen=0,
                  i;

    ptr = pseudobuf;

    v4hdr = (IPV4_HDR *)iphdr;

    // Include the source and destination IP addresses
    memcpy(ptr, &v4hdr->ip_srcaddr,  sizeof(v4hdr->ip_srcaddr));
    ptr += sizeof(v4hdr->ip_srcaddr);
    chksumlen += sizeof(v4hdr->ip_srcaddr);

    memcpy(ptr, &v4hdr->ip_destaddr, sizeof(v4hdr->ip_destaddr));
    ptr += sizeof(v4hdr->ip_destaddr);
    chksumlen += sizeof(v4hdr->ip_destaddr);

    // Include the 8 bit zero field
    memcpy(ptr, &zero, 1);
    ptr++;
    chksumlen += 1;

    // Protocol
    memcpy(ptr, &v4hdr->ip_protocol, sizeof(v4hdr->ip_protocol));
    ptr += sizeof(v4hdr->ip_protocol);
    chksumlen += sizeof(v4hdr->ip_protocol);

    // UDP length
    memcpy(ptr, &udphdr->udp_length, sizeof(udphdr->udp_length));
    ptr += sizeof(udphdr->udp_length);
    chksumlen += sizeof(udphdr->udp_length);

    // UDP source port
    memcpy(ptr, &udphdr->src_portno, sizeof(udphdr->src_portno));
    ptr += sizeof(udphdr->src_portno);
    chksumlen += sizeof(udphdr->src_portno);

    // UDP destination port
    memcpy(ptr, &udphdr->dst_portno, sizeof(udphdr->dst_portno));
    ptr += sizeof(udphdr->dst_portno);
    chksumlen += sizeof(udphdr->dst_portno);

    // UDP length again
    memcpy(ptr, &udphdr->udp_length, sizeof(udphdr->udp_length));
    ptr += sizeof(udphdr->udp_length);
    chksumlen += sizeof(udphdr->udp_length);

    // 16-bit UDP checksum, zero
    memcpy(ptr, &zero, sizeof(unsigned short));
    ptr += sizeof(unsigned short);
    chksumlen += sizeof(unsigned short);

    // payload
    memcpy(ptr, payload, payloadlen);
    ptr += payloadlen;
    chksumlen += payloadlen;

    // pad to next 16-bit boundary
    for(i=0 ; i < payloadlen%2 ; i++, ptr++)
    {
        printf("pad one byte\n");
        *ptr = 0;
        ptr++;
        chksumlen++;
    }

    // Compute the checksum and put it in the UDP header
    udphdr->udp_checksum = checksum((USHORT *)pseudobuf, chksumlen);

    return;
}

void ComputeUdpPseudoHeaderChecksumV6 | ( | char * | pseudobuf,
 |  | void * | iphdr,
 |  | UDP_HDR * | udphdr,
 |  | char * | payload,
 |  | int | payloadlen
 | ) |  |

Definition at line 533 of file rawudp.c.

{
    IPV6_HDR     *v6hdr=NULL;
    unsigned long length=0;
    char          proto,
                 *ptr=NULL;
    int           chksumlen=0,
                  i;

    ptr = pseudobuf;

    v6hdr = (IPV6_HDR *)iphdr;

    // 128-bit source address
    memcpy(ptr, &v6hdr->ipv6_srcaddr,  sizeof(v6hdr->ipv6_srcaddr));
    ptr += sizeof(v6hdr->ipv6_srcaddr);
    chksumlen += sizeof(v6hdr->ipv6_srcaddr);

    // 128-bit destination address
    memcpy(ptr, &v6hdr->ipv6_destaddr,  sizeof(v6hdr->ipv6_destaddr));
    ptr += sizeof(v6hdr->ipv6_destaddr);
    chksumlen += sizeof(v6hdr->ipv6_destaddr);

    // Compute payload length in IPv6 header
    length = htonl(payloadlen + sizeof(UDP_HDR));

    // 4 byte length
    memcpy(ptr, &length, sizeof(length));
    ptr += sizeof(length);
    chksumlen += sizeof(length);

    // 3 bytes of zero
    memset(ptr, 0, 3);
    ptr += 3;
    chksumlen +=3;

    proto = IPPROTO_UDP;

    // 1 byte protocol value
    memcpy(ptr, &proto, sizeof(proto));
    ptr += sizeof(proto);
    chksumlen += sizeof(proto);

    // UDP source port
    memcpy(ptr, &udphdr->src_portno, sizeof(udphdr->src_portno));
    ptr += sizeof(udphdr->src_portno);
    chksumlen += sizeof(udphdr->src_portno);

    // UDP destination port
    memcpy(ptr, &udphdr->dst_portno, sizeof(udphdr->dst_portno));
    ptr += sizeof(udphdr->dst_portno);
    chksumlen += sizeof(udphdr->dst_portno);

    // UDP length again
    memcpy(ptr, &udphdr->udp_length, sizeof(udphdr->udp_length));
    ptr += sizeof(udphdr->udp_length);
    chksumlen += sizeof(udphdr->udp_length);

    // 16-bit UDP checksum, zero
    memset(ptr, 0, sizeof(unsigned short));
    ptr += sizeof(unsigned short);
    chksumlen += sizeof(unsigned short);

    // payload
    memcpy(ptr, payload, payloadlen);
    ptr += payloadlen;
    chksumlen += payloadlen;

    // pad to next 16-bit boundary
    for(i=0 ; i < payloadlen%2 ; i++, ptr++)
    {
        printf("pad one byte\n");
        *ptr = 0;
        ptr++;
        chksumlen++;
    }

    // Compute the checksum and put it in the UDP header
    udphdr->udp_checksum = checksum((USHORT *)pseudobuf, chksumlen);

    return;
}

int InitIpv4Header | ( | char * | buf,
 |  | SOCKADDR * | src,
 |  | SOCKADDR * | dest,
 |  | int | ttl,
 |  | int | proto,
 |  | int | payloadlen
 | ) |  |

Definition at line 277 of file rawudp.c.

{
    IPV4_HDR    *v4hdr=NULL;

    v4hdr = (IPV4_HDR *)buf;

    v4hdr->ip_verlen      = (4 << 4) | (sizeof(IPV4_HDR) / sizeof(unsigned long));
    v4hdr->ip_tos         = 0;
    v4hdr->ip_totallength = htons(sizeof(IPV4_HDR) + (USHORT) payloadlen);
    v4hdr->ip_id          = 0;
    v4hdr->ip_offset      = 0;
    v4hdr->ip_ttl         = (unsigned char)ttl;
    v4hdr->ip_protocol    = (unsigned char)proto;
    v4hdr->ip_checksum    = 0;
    v4hdr->ip_srcaddr     = ((SOCKADDR_IN *)src)->sin_addr.s_addr;
    v4hdr->ip_destaddr    = ((SOCKADDR_IN *)dest)->sin_addr.s_addr;

    v4hdr->ip_checksum    = checksum((unsigned short *)v4hdr, sizeof(IPV4_HDR));

    return sizeof(IPV4_HDR);
}

int InitIpv6FragmentHeader | ( | char * | buf,
 |  | unsigned long | offset,
 |  | int | nextproto,
 |  | int | id,
 |  | int | lastfragment
 | ) |  |

Definition at line 350 of file rawudp.c.

{
    IPV6_FRAGMENT_HDR *frag=NULL;

    frag = (IPV6_FRAGMENT_HDR *)buf;

    // Swap the value of this field
    lastfragment = (lastfragment ? 0 : 1);

    // Account for the size of the UDP header
    if (offset != 0)
        offset += sizeof(UDP_HDR);

    frag->ipv6_frag_nexthdr = (unsigned char)nextproto;
    frag->ipv6_frag_offset  = htons( (unsigned short)(((offset/8) << 3) | lastfragment));
    frag->ipv6_frag_id      = htonl(id);

    return sizeof(IPV6_FRAGMENT_HDR);
}

int InitIpv6Header | ( | char * | buf,
 |  | SOCKADDR * | src,
 |  | SOCKADDR * | dest,
 |  | int | ttl,
 |  | int | proto,
 |  | int | payloadlen
 | ) |  |

Definition at line 313 of file rawudp.c.

{
    IPV6_HDR    *v6hdr=NULL;

  v6hdr = (IPV6_HDR *)buf;

    // We don't explicitly set the traffic class or flow label fields
    v6hdr->ipv6_vertcflow    = htonl(6 << 28);
    v6hdr->ipv6_payloadlen   = htons((unsigned short)payloadlen);
    v6hdr->ipv6_nexthdr      = (unsigned char)proto;
    v6hdr->ipv6_hoplimit     = (unsigned char)ttl;
    v6hdr->ipv6_srcaddr      = ((SOCKADDR_IN6 *)src)->sin6_addr;
    v6hdr->ipv6_destaddr     = ((SOCKADDR_IN6 *)dest)->sin6_addr;

    return sizeof(IPV6_HDR);
}

int InitUdpHeader | ( | char * | buf,
 |  | SOCKADDR * | src,
 |  | SOCKADDR * | dest,
 |  | int | payloadlen
 | ) |  |

Definition at line 383 of file rawudp.c.

{
    UDP_HDR *udphdr=NULL;

    udphdr = (UDP_HDR *)buf;

    // Port numbers are already in network byte order
    if (src->sa_family == AF_INET)
    {
        udphdr->src_portno = ((SOCKADDR_IN *)src)->sin_port;
        udphdr->dst_portno = ((SOCKADDR_IN *)dest)->sin_port;
    }
    else if (src->sa_family == AF_INET6)
    {
        udphdr->src_portno = ((SOCKADDR_IN6 *)src)->sin6_port;
        udphdr->dst_portno = ((SOCKADDR_IN6 *)dest)->sin6_port;
    }
    udphdr->udp_length = htons(sizeof(UDP_HDR) + (USHORT)payloadlen);

    return sizeof(UDP_HDR);
}

int _cdecl main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 910 of file rawudp.c.

{
    WSADATA            wsd;
    SOCKET             s=INVALID_SOCKET;
    DWORD              bytes;
    WSABUF            *fragments=NULL;
    int                fragmentcount=0;
    char              *buffer=NULL,     // Used as receive buffer or
                                        // to compute pseudo header
                      *payload=NULL;    // Buffer containing payload
    struct addrinfo   *ressrc=NULL,
                      *resdest=NULL;
    int                rc,
                       i, j;

    // Parse command line arguments and print them out
    ValidateArgs(argc, argv);

    srand(GetTickCount());

    if ((rc = WSAStartup(MAKEWORD(2,2), &wsd)) != 0)
    {
        printf("WSAStartup() failed: %d\n", rc);
        return -1;
    }

    // Convert the source and destination addresses/ports
    ressrc = ResolveAddress(gSrcAddress, gSrcPort, gAddressFamily, gSocketType, gProtocol);
    if (ressrc == NULL)
    {
        fprintf(stderr, "Unable to resolve address '%s' and port '%s'\n",
                gSrcAddress, gSrcPort);
        goto cleanup;
    }

    printf("Source Address     : ");
    PrintAddress(ressrc->ai_addr, (int)ressrc->ai_addrlen);
    printf("\n");

    // Resolve the destination address if necessary and print some parameters
    if (gSender)
    {
        resdest = ResolveAddress(gDestAddress, gDestPort, ressrc->ai_family, ressrc->ai_socktype, ressrc->ai_protocol);
        if (resdest == NULL)
        {
            fprintf(stderr, "Unable to resolve address '%s' and port '%s'\n",
                    gDestAddress, gDestPort);
            goto cleanup;
        }

        printf("Destination Address: ");
        PrintAddress(resdest->ai_addr, (int) resdest->ai_addrlen);
        printf("\n");

        printf("Message Size       : %d\n", gSendSize);
        printf("Message Count      : %lu\n", gSendCount);
        printf("MTU Size           : %d\n", gMtuSize);
    }
    else
    {
        printf("Socket Type        : %s\n", (gReadRaw ? "SOCK_RAW" : "SOCK_DGRAM"));
    }

    //  Creating a raw socket

    //  BUG - For IPv6 if we create the raw socket with IPPROTO_UDP then the Ipv6
    //  stack will thow away our IPv6 and UDP headers and put "valid" ones in their
    //  place. As a workaround, create the socket with a protocol value of an
    //  unhandled protocol. Of course the IPv6 header should still indicate that
    //  the encapsulated protocol is UDP.

    if (gSender)
        s = socket(ressrc->ai_family, SOCK_RAW, ((ressrc->ai_family == AF_INET6) ? 3 : ressrc->ai_protocol));
    else if (!gSender && gReadRaw)
        s = socket(ressrc->ai_family, SOCK_RAW, ressrc->ai_protocol);
    else
        s = socket(ressrc->ai_family, SOCK_DGRAM, ressrc->ai_protocol);
    if (s == INVALID_SOCKET)
    {
        fprintf(stderr, "socket failed: %d\n", WSAGetLastError());
        goto cleanup;
    }

    // Allocate a buffer for computing the pseudo header checksum
    buffer = (char *)HeapAlloc(GetProcessHeap(), 0, MAX_PACKET);
    if (buffer == NULL)
    {
        fprintf(stderr, "HeapAlloc failed: %d\n", GetLastError());
        goto cleanup;
    }

    if (gSender)
    {
        int     optlevel,
                option,
                optval;

        // Allocate the payload
        payload = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, gSendSize);
        if (payload == NULL)
        {
            fprintf(stderr, "HeapAlloc failed: %d\n", GetLastError());
            goto cleanup;
        }
        memfill(payload, gSendSize, gMessage, (int)strlen(gMessage));

        // Allocate storage for the fragments
        fragmentcount = MAX_PACKET_FRAGMENTS;
        fragments = (WSABUF *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, fragmentcount * sizeof(WSABUF));
        if (fragments == NULL)
        {
            fprintf(stderr, "HeapAlloc failed: %d\n", GetLastError());
            goto cleanup;
        }

        // Enable the IP header include option
        optval = 1;
        if (ressrc->ai_family == AF_INET)
        {
            optlevel = IPPROTO_IP;
            option   = IP_HDRINCL;
        }
        else if (ressrc->ai_family == AF_INET6)
        {
            optlevel = IPPROTO_IPV6;
            option   = IPV6_HDRINCL;
        }
        else
        {
            fprintf(stderr, "Address family returned is unsupported: %d\n",
                    ressrc->ai_family);
            goto cleanup;
        }

        rc = setsockopt(s, optlevel, option, (char *)&optval, sizeof(optval));
        if (rc == SOCKET_ERROR)
        {
            fprintf(stderr, "setsockopt: IP_HDRINCL failed: %d\n", WSAGetLastError());
            goto cleanup;
        }

        // Packetize and/or perform necessary fragmentation on data
        if (ressrc->ai_family == AF_INET)
        {
            rc = PacketizeIpv4(
                fragments,
               &fragmentcount,
                buffer,
                ressrc,
                resdest,
                payload,
                gSendSize
                );
        }
        else if (ressrc->ai_family == AF_INET6)
        {
            rc = PacketizeIpv6(
                fragments,
               &fragmentcount,
                buffer,
                ressrc,
                resdest,
                payload,
                gSendSize
                );
        }

        // Verify packetization succeeded
        if (rc == SOCKET_ERROR)
        {
            fprintf(stderr, "Packetizing failed\n");
            goto cleanup;
        }

        printf("%d fragments required\n", fragmentcount);

        // Apparently, this SOCKADDR_IN structure makes no difference.
        // Whatever we put as the destination IP addr in the IP
        // header is what goes. Specifying a different dest in remote
        // will be ignored.
        for(i=0; i < (int)gSendCount ;i++)
        {
            for(j=0; j < fragmentcount ;j++)
            {
                rc = sendto(
                        s,
                        fragments[j].buf,
                        fragments[j].len,
                        0,
                        resdest->ai_addr,
                        (int) resdest->ai_addrlen
                        );
                bytes = rc;
                if (rc == SOCKET_ERROR)
                {
                    printf("sendto() failed: %d\n", WSAGetLastError());
                    break;
                }
                else
                {
                    printf("sent %d bytes\n", rc);
                }
            }
        }

    }
    else
    {
        SOCKADDR_STORAGE    safrom;
        WSAEVENT            hEvent;
        int                 fromlen;

        // Bind the socket to the receiving address
        rc = bind(
                s,
                ressrc->ai_addr,
                (int) ressrc->ai_addrlen
                );
        if (rc == SOCKET_ERROR)
        {
            fprintf(stderr, "bind failed: %d\n", WSAGetLastError());
            goto cleanup;
        }

        printf("binding to: ");
        PrintAddress(ressrc->ai_addr, (int)ressrc->ai_addrlen);
        printf("\n");

        // The IPv6 stack currently doesn't allow receiving raw UDP packets so
        //    print a warning.
        if (gReadRaw && (ressrc->ai_family == AF_INET6))
            printf("\nNOTE: The IPv6 stack currently does not allow reading raw UDP packets\n\n");

        hEvent = WSACreateEvent();
        if (hEvent == NULL)
        {
            fprintf(stderr, "WSACreateEvent failed: %d\n", WSAGetLastError());
            goto cleanup;
        }

#ifdef WSAEVENTSELECT
        rc = WSAEventSelect(s, hEvent, FD_READ);
        if (rc == SOCKET_ERROR)
        {
            fprintf(stderr, "WSAEventSelect failed: %d\n", WSAGetLastError());
            goto cleanup;
        }
#endif

        // Receive the data
        while (1)
        {
#ifdef WSAEVENTSELECT
            rc = WaitForSingleObject(hEvent, INFINITE);
            if ( (rc == WAIT_FAILED) || (rc == WAIT_TIMEOUT) )
            {
                fprintf(stderr, "WaitForSingleObject failed: %d\n", GetLastError());
                goto cleanup;
            }
#endif

            fromlen = sizeof(safrom);
            rc = recvfrom(
                    s,
                    buffer,
                    MAX_PACKET,
                    0,
                    (SOCKADDR *)&safrom,
                   &fromlen
                   );
            if (rc == SOCKET_ERROR)
            {
                fprintf(stderr, "recvfrom failed: %d\n", WSAGetLastError());
                break;
            }
            printf("Read %d bytes from ", rc);
            PrintAddress((SOCKADDR *)&safrom, fromlen);
            printf("\n");

            WSAResetEvent(hEvent);
        }
    }

cleanup:

    //
    // Cleanup allocations and sockets
    //

    if (ressrc)
        freeaddrinfo(ressrc);

    if (resdest)
        freeaddrinfo(resdest);

    if (buffer)
        HeapFree(GetProcessHeap(), 0, buffer);

    if (payload)
        HeapFree(GetProcessHeap(), 0, payload);

    // Free the packet buffers
    if (fragments)
    {
        for(i=0; i < fragmentcount ;i++)
        {
            if (fragments[i].buf != NULL)
            {
                HeapFree(GetProcessHeap(), 0, fragments[i].buf);
                fragments[i].buf = NULL;
            }
        }
        HeapFree(GetProcessHeap(), 0, fragments);
    }

    if (s != INVALID_SOCKET)
        closesocket(s);

    WSACleanup();

    return 0;
}

void memfill | ( | char * | dest,
 |  | int | destlen,
 |  | char * | data,
 |  | int | datalen
 | ) |  |

Definition at line 628 of file rawudp.c.

{
    char *ptr=NULL;
    int   copylen;

    ptr = dest;
    while (destlen > 0)
    {
        copylen = ((destlen > datalen) ? datalen : destlen);
        memcpy(ptr, data, copylen);

        destlen -= copylen;
        ptr += copylen;
    }
    return;
}

int PacketizeIpv4 | ( | WSABUF * | Packets,
 |  | int * | PacketCount,
 |  | char * | PseudoBuffer,
 |  | struct addrinfo * | src,
 |  | struct addrinfo * | dest,
 |  | char * | payload,
 |  | int | payloadlen
 | ) |  |

Definition at line 660 of file rawudp.c.

{
    int           iphdrlen,
                  udphdrlen;

    // Check the parameters
    if ((Packets == NULL) || (PacketCount == NULL) || (src == NULL) ||
        (dest == NULL) || (payload == NULL) || (*PacketCount < 1))
    {
        WSASetLastError(WSAEINVAL);
        return SOCKET_ERROR;
    }

    // Allocate memory for the packet
    Packets[0].buf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IPV4_HDR) + sizeof(UDP_HDR) + payloadlen);
    if (Packets[0].buf == NULL)
    {
        fprintf(stderr, "PacetizeV4: HeapAlloc failed: %d\n", GetLastError());
        WSASetLastError(WSAENOBUFS);
        return NO_ERROR;
    }
    Packets[0].len = sizeof(IPV4_HDR) + sizeof(UDP_HDR) + payloadlen;

    // Initialize the v4 header
    iphdrlen = InitIpv4Header(
            Packets[0].buf,
            src->ai_addr,
            dest->ai_addr,
            DEFAULT_TTL,
            gProtocol,
            sizeof(UDP_HDR) + payloadlen
            );

    // Initialize the UDP header
    udphdrlen = InitUdpHeader(
           &Packets[0].buf[iphdrlen],
            src->ai_addr,
            dest->ai_addr,
            payloadlen
            );

    // Compute the UDP checksum
    ComputeUdpPseudoHeaderChecksumV4(
            PseudoBuffer,
            Packets[0].buf,
            (UDP_HDR *)&Packets[0].buf[iphdrlen],
            payload,
            payloadlen
            );

    // Copy the payload to the end of the header
    memcpy(&Packets[0].buf[iphdrlen + udphdrlen], payload, payloadlen);

    *PacketCount = 1;

    return NO_ERROR;
}

int PacketizeIpv6 | ( | WSABUF * | Packets,
 |  | int * | PacketCount,
 |  | char * | PseudoBuffer,
 |  | struct addrinfo * | src,
 |  | struct addrinfo * | dest,
 |  | char * | payload,
 |  | int | payloadlen
 | ) |  |

Definition at line 737 of file rawudp.c.

{
    static ULONG  fragid=1;
    int           offset=0,        // offset into payload
                  datalen,         // length of the payload
                  hdrlen,          // length of the header(s)
                  fragment,        // is this a fragment?
                  lastfragment,    // is this the last fragment?
                  iphdrlen,        // length of ip header
                  udphdrlen,       // length of the udp header
                  plushdrs,        // IPv6 length field includes encapsulated headers
                  numpackets=0,    // number of fragments
                  originalpayload;

    // Check the parameters
    if ((Packets == NULL) || (PacketCount == NULL) || (src == NULL) ||
        (dest == NULL) || (payload == NULL))
        return SOCKET_ERROR;

    originalpayload = payloadlen;
    do
    {
        if (numpackets >= *PacketCount)
        {
            fprintf(stderr, "PacketizeIpv6: Fragment count exceeded limit of %d\n",
                    *PacketCount);
            WSASetLastError(WSAEFAULT);
            return SOCKET_ERROR;
        }

        // Compute the size of this fragment
        lastfragment = 0;
        fragment = 0;
        if ((payloadlen > gMtuSize) && (numpackets == 0))
        {
            // Data needs to be fragmented, this is the first packet
            hdrlen  = sizeof(IPV6_HDR) + sizeof(UDP_HDR) + sizeof(IPV6_FRAGMENT_HDR);
            datalen = gMtuSize - hdrlen;
            plushdrs = sizeof(UDP_HDR) + sizeof(IPV6_FRAGMENT_HDR);
            fragment = 1;

            printf("Require fragmentation: FIRST packet\n");
        }
        else if ((payloadlen > gMtuSize) && (numpackets > 0))
        {
            // Data needs to be fragmented, this is packet number > 0
            hdrlen = sizeof(IPV6_HDR) + sizeof(IPV6_FRAGMENT_HDR);
            datalen = gMtuSize - hdrlen;
            fragment = 1;
            plushdrs = sizeof(IPV6_FRAGMENT_HDR);

            printf("Require fragmentation: packet number > 0\n");
        }
        else if (numpackets == 0)
        {
            // Data doesn't need to be fragmented
            hdrlen = sizeof(IPV6_HDR) + sizeof(UDP_HDR);
            datalen = payloadlen;
            fragment = 0;
            plushdrs = sizeof(UDP_HDR);

            printf("No fragmentation required\n");
        }
        else
        {
            // This is the last fragment
            hdrlen = sizeof(IPV6_HDR) + sizeof(IPV6_FRAGMENT_HDR);
            datalen = payloadlen;
            fragment = 1;
            plushdrs = sizeof(IPV6_FRAGMENT_HDR);
            lastfragment = 1;

            printf("Require fragmentation: Last packet\n");
        }

        // Build packet

        // Allocate buffer for this fragment
        printf("numpackets = %d; hdrlen = %d; datlen = %d\n", numpackets, hdrlen, datalen);
        Packets[numpackets].buf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, hdrlen + datalen);
        if (Packets[numpackets].buf == NULL)
        {
            fprintf(stderr, "PacketizeV6: HeapAlloc failed: %d\n", GetLastError());
            WSASetLastError(WSAENOBUFS);
            return SOCKET_ERROR;
        }
        Packets[numpackets].len = hdrlen + datalen;

        printf("[%02d] .buf = 0x%p .len = %d\n", numpackets, Packets[numpackets].buf, Packets[numpackets].len);

        // Initialize the V6 header, if we have to fragment the next header field of
        //    the v6 header is that of the fragmentation header. Also the payload
        //    length includes the headers (UDP + fragmentation) and the payload itself.
        iphdrlen = InitIpv6Header(
                Packets[numpackets].buf,
                src->ai_addr,
                dest->ai_addr,
                DEFAULT_TTL,
                (fragment ? FRAGMENT_HEADER_PROTOCOL : gProtocol),
                datalen + plushdrs
                );

        // Build the fragmentation header if necessary
        if (fragment)
        {
            iphdrlen += InitIpv6FragmentHeader(
                   &Packets[numpackets].buf[iphdrlen],
                    offset,         // offset from start of packet
                    gProtocol,
                    fragid,
                    lastfragment
                    );
        }

        // The first fragment includes the UDP header, subsequent fragments don't
        if (numpackets == 0)
        {
            udphdrlen = InitUdpHeader(
                   &Packets[numpackets].buf[iphdrlen],
                    src->ai_addr,
                    dest->ai_addr,
                    originalpayload //payloadlen
                    );

            // Compute the checksum
            ComputeUdpPseudoHeaderChecksumV6(
                    PseudoBuffer,
                    Packets[numpackets].buf,
                    (UDP_HDR *)&Packets[numpackets].buf[iphdrlen],
                    payload,
                    payloadlen);
        }
        else
        {
            udphdrlen = 0;
        }

        // Copy the payload into this fragment
        memcpy(&Packets[numpackets].buf[iphdrlen + udphdrlen], &payload[offset], datalen);

        // Adjust our counters
        payloadlen = payloadlen - datalen;
        offset += datalen;
        numpackets++;

    } while (payloadlen > 0);

    fragid++;

    // Update the count to indicate how many fragments were generated
    *PacketCount = numpackets;

    return NO_ERROR;
}

void usage ( char * progname )

Definition at line 90 of file rawudp.c.

{
    printf("usage: %s [-sp int] [-sa str] [-dp int] [-da str] [-n int] [-m str] ...\n"
           "    -a  4|6    Address family\n"
           "    -sa addr   From (sender) port number\n"
           "    -sp int    From (sender) IP address\n"
           "    -da addr   To (recipient) port number\n"
           "    -dp int    To (recipient) IP address\n"
           "    -n  int    Number of times to read message\n"
           "    -m  str    String message to fill packet data with\n"
           "    -p  proto  Protocol value\n"
           "    -r  port   Receive raw (SOCK_RAW) datagrams on the given port\n"
           "    -rd port   Receive datagram (SOCK_DGRAM) on the given port\n"
           "    -t  mtu    MTU size (required for fragmentation)\n"
           "    -z  int    Size of message to send\n",
           progname
           );
    ExitProcess(1);
}

int ValidateArgs | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 117 of file rawudp.c.

{
    int                i;

    gMessage = DEFAULT_MESSAGE;
    for(i=1; i < argc ;i++)
    {
        if ((argv[i][0] == '-') || (argv[i][0] == '/'))
        {
            switch (tolower(argv[i][1]))
            {
                case 'a':                   // Address family
                    if (i+1 > argc)
                        usage(argv[0]);
                    if (argv[i+1][0] == '4')
                        gAddressFamily = AF_INET;
                    else if (argv[i+1][0] == '6')
                        gAddressFamily = AF_INET6;
                    else
                        usage(argv[0]);
                    i++;
                    break;
                case 's':                   // source address
                    if (i+1 > argc)
                        usage(argv[0]);
                    if (tolower(argv[i][2]) == 'a')
                    {
                        gSrcAddress = argv[++i];
                    }
                    else if (tolower(argv[i][2]) == 'p')
                    {
                        gSrcPort = argv[++i];
                    }
                    else
                    {
                        usage(argv[0]);
                        break;
                    }
                    break;
                case 'd':                   // destination address
                    if (i+1 > argc)
                        usage(argv[0]);
                    if (tolower(argv[i][2]) == 'a')
                    {
                        gDestAddress = argv[++i];
                    }
                    else if (tolower(argv[i][2]) == 'p')
                    {
                        gDestPort = argv[++i];
                    }
                    else
                    {
                        usage(argv[0]);
                        break;
                    }
                    break;
                case 'n':                   // number of times to send message
                    if (i+1 >= argc)
                        usage(argv[0]);
                    gSendCount = atol(argv[++i]);
                    break;
                case 'm':                   // String message to copy into payload
                    if (i+1 >= argc)
                        usage(argv[0]);
                    gMessage = argv[++i];
                    break;
                case 'p':                   // Protocol value
                    if (i+1 >= argc)
                        usage(argv[0]);
                    gProtocol = atoi(argv[++i]);
                    break;
                case 'r':                   // Port to receive data on
                    if (i+1 >= argc)
                        usage(argv[0]);
                    if (strlen(argv[i]) == 3)
                        gReadRaw = FALSE;
                    gSrcPort = argv[++i];
                    gSender = FALSE;
                    break;
                case 't':                   // MTU size
                    if (i+1 >= argc)
                        usage(argv[0]);
                    gMtuSize = atoi(argv[++i]);
                    break;
                case 'z':                   // Send size
                    if (i+1 >= argc)
                        usage(argv[0]);
                    gSendSize = atoi(argv[++i]);
                    break;
                default:
                    usage(argv[0]);
                    break;
            }
        }
    }

    // If no data size was given, initialize it to the message supplied
    if (gSendSize == 0)
    {
        gSendSize = (int) strlen(gMessage);
    }

    // Do some simple validation of input
    if (gSender)
    {
        if ((gSrcAddress == NULL) || (gDestAddress == NULL))
        {
            fprintf(stderr, "\nSource and destination addresses must be specified!\n\n");
            usage(argv[0]);
        }
    }
    else
    {
        if (gSrcAddress == NULL)
        {
            fprintf(stderr, "\nSource address must be specified!\n\n");
            usage(argv[0]);
        }
    }

    return;
}

Variable Documentation

int gAddressFamily = AF_UNSPEC

Definition at line 75 of file rawudp.c.

char * gDestAddress = NULL

Definition at line 71 of file rawudp.c.

char * gDestPort = NULL

Definition at line 73 of file rawudp.c.

char * gMessage = NULL

Definition at line 74 of file rawudp.c.

int gMtuSize = DEFAULT_MTU

Definition at line 79 of file rawudp.c.

int gProtocol = IPPROTO_UDP

Definition at line 77 of file rawudp.c.

BOOL gReadRaw = TRUE

Definition at line 82 of file rawudp.c.

DWORD gSendCount = DEFAULT_SEND_COUNT

Definition at line 80 of file rawudp.c.

BOOL gSender = TRUE

Definition at line 81 of file rawudp.c.

int gSendSize = 0

Definition at line 78 of file rawudp.c.

int gSocketType = SOCK_DGRAM

Definition at line 76 of file rawudp.c.

char* gSrcAddress = NULL

Definition at line 70 of file rawudp.c.

char * gSrcPort = NULL

Definition at line 72 of file rawudp.c.

Generated on Wed Nov 13 2024 16:54:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/iphdrinc/resolve.c File Reference

  • NetDS
  • WinSock
  • iphdrinc
Functions

resolve.c File Reference

#include <winsock2.h>
#include <ws2tcpip.h>
#include <wspiapi.h>
#include <stdio.h>
#include <stdlib.h>
#include "resolve.h"

Go to the source code of this file.

Functions

int | FormatAddress (SOCKADDR *sa, int salen, char *addrbuf, int addrbuflen)
int | PrintAddress (SOCKADDR *sa, int salen)
struct addrinfo * | ResolveAddress (char *addr, char *port, int af, int type, int proto)
int | ReverseLookup (SOCKADDR *sa, int salen, char *buf, int buflen)

Function Documentation

int FormatAddress | ( | SOCKADDR * | sa,
 |  | int | salen,
 |  | char * | addrbuf,
 |  | int | addrbuflen
 | ) |  |

Definition at line 87 of file resolve.c.

{
    char    host[NI_MAXHOST],
            serv[NI_MAXSERV];
    int     hostlen = NI_MAXHOST,
            servlen = NI_MAXSERV,
            rc;

    // Validate input
    if ((sa == NULL) || (addrbuf == NULL))
        return WSAEFAULT;

    // Format the name
    rc = getnameinfo(
            sa,
            salen,
            host,
            hostlen,
            serv,
            servlen,
            NI_NUMERICHOST | NI_NUMERICSERV     // Convert to numeric representation
            );
    if (rc != 0)
    {
        fprintf(stderr, "%s: getnameinfo failed: %d\n", __FILE__, rc);
        return rc;
    }
    if ( (strlen(host) + strlen(serv) + 1) > (unsigned)addrbuflen)
        return WSAEFAULT;
    if (strncmp(serv, "0", 1) != 0)
    {
        if (sa->sa_family == AF_INET)
            _snprintf(addrbuf, addrbuflen-1, "%s:%s", host, serv);
        else if (sa->sa_family == AF_INET6)
            _snprintf(addrbuf, addrbuflen-1, "[%s]:%s", host, serv);
        else
            addrbuf[0] = '\0';
    }
    else
    {
        _snprintf(addrbuf, addrbuflen-1, "%s", host);
    }

    return NO_ERROR;
}

int PrintAddress | ( | SOCKADDR * | sa,
 |  | int | salen
 | ) |  |

Definition at line 38 of file resolve.c.

{
    char    host[NI_MAXHOST],
            serv[NI_MAXSERV];
    int     hostlen = NI_MAXHOST,
            servlen = NI_MAXSERV,
            rc;

    // Validate argument
    if (sa == NULL)
        return WSAEFAULT;

    rc = getnameinfo(
            sa,
            salen,
            host,
            hostlen,
            serv,
            servlen,
            NI_NUMERICHOST | NI_NUMERICSERV
            );
    if (rc != 0)
    {
        fprintf(stderr, "%s: getnameinfo failed: %d\n", __FILE__, rc);
        return rc;
    }

    // If the port is zero then don't print it
    if (strncmp(serv, "0", 1) != 0)
    {
        if (sa->sa_family == AF_INET6)
            printf("[%s]:%s", host, serv);
        else
            printf("%s:%s", host, serv);
    }
    else
        printf("%s", host);

    return NO_ERROR;
}

struct addrinfo* ResolveAddress | ( | char * | addr,
 |  | char * | port,
 |  | int | af,
 |  | int | type,
 |  | int | proto |
 | ) |  |  | [read]

Definition at line 142 of file resolve.c.

{
    struct addrinfo hints,
    *res = NULL;
    int             rc;

    memset(&hints, 0, sizeof(hints));
    hints.ai_flags  = ((addr) ? 0 : AI_PASSIVE);
    hints.ai_family = af; //((addr) ? AF_UNSPEC : af);
    hints.ai_socktype = type;
    hints.ai_protocol = proto;

    rc = getaddrinfo(
            addr,
            port,
           &hints,
           &res
            );
    if (rc != 0)
    {
        printf("Invalid address %s, getaddrinfo failed: %d\n", addr, rc);
        return NULL;
    }
    return res;
}

int ReverseLookup | ( | SOCKADDR * | sa,
 |  | int | salen,
 |  | char * | buf,
 |  | int | buflen
 | ) |  |

Definition at line 175 of file resolve.c.

{
    char    host[NI_MAXHOST];
    int     hostlen=NI_MAXHOST,
            rc;

    // Validate parameters
    if ((sa == NULL) || (buf == NULL))
        return WSAEFAULT;

    rc = getnameinfo(
            sa,
            salen,
            host,
            hostlen,
            NULL,
            0,
            0
            );
    if (rc != 0)
    {
        fprintf(stderr, "getnameinfo failed: %d\n", rc);
        return rc;
    }

    strncpy(buf, host, buflen-1);

    return NO_ERROR;
}

Generated on Wed Nov 13 2024 16:54:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/iphdrinc/resolve.h File Reference

  • NetDS
  • WinSock
  • iphdrinc
Functions

resolve.h File Reference

Go to the source code of this file.

Functions

int | FormatAddress (SOCKADDR *sa, int salen, char *addrbuf, int addrbuflen)
int | PrintAddress (SOCKADDR *sa, int salen)
struct addrinfo * | ResolveAddress (char *addr, char *port, int af, int type, int proto)
int | ReverseLookup (SOCKADDR *sa, int salen, char *namebuf, int namebuflen)

Function Documentation

int FormatAddress | ( | SOCKADDR * | sa,
 |  | int | salen,
 |  | char * | addrbuf,
 |  | int | addrbuflen
 | ) |  |

Definition at line 87 of file resolve.c.

{
    char    host[NI_MAXHOST],
            serv[NI_MAXSERV];
    int     hostlen = NI_MAXHOST,
            servlen = NI_MAXSERV,
            rc;

    // Validate input
    if ((sa == NULL) || (addrbuf == NULL))
        return WSAEFAULT;

    // Format the name
    rc = getnameinfo(
            sa,
            salen,
            host,
            hostlen,
            serv,
            servlen,
            NI_NUMERICHOST | NI_NUMERICSERV     // Convert to numeric representation
            );
    if (rc != 0)
    {
        fprintf(stderr, "%s: getnameinfo failed: %d\n", __FILE__, rc);
        return rc;
    }
    if ( (strlen(host) + strlen(serv) + 1) > (unsigned)addrbuflen)
        return WSAEFAULT;
    if (strncmp(serv, "0", 1) != 0)
    {
        if (sa->sa_family == AF_INET)
            _snprintf(addrbuf, addrbuflen-1, "%s:%s", host, serv);
        else if (sa->sa_family == AF_INET6)
            _snprintf(addrbuf, addrbuflen-1, "[%s]:%s", host, serv);
        else
            addrbuf[0] = '\0';
    }
    else
    {
        _snprintf(addrbuf, addrbuflen-1, "%s", host);
    }

    return NO_ERROR;
}

int PrintAddress | ( | SOCKADDR * | sa,
 |  | int | salen
 | ) |  |

Definition at line 38 of file resolve.c.

{
    char    host[NI_MAXHOST],
            serv[NI_MAXSERV];
    int     hostlen = NI_MAXHOST,
            servlen = NI_MAXSERV,
            rc;

    // Validate argument
    if (sa == NULL)
        return WSAEFAULT;

    rc = getnameinfo(
            sa,
            salen,
            host,
            hostlen,
            serv,
            servlen,
            NI_NUMERICHOST | NI_NUMERICSERV
            );
    if (rc != 0)
    {
        fprintf(stderr, "%s: getnameinfo failed: %d\n", __FILE__, rc);
        return rc;
    }

    // If the port is zero then don't print it
    if (strncmp(serv, "0", 1) != 0)
    {
        if (sa->sa_family == AF_INET6)
            printf("[%s]:%s", host, serv);
        else
            printf("%s:%s", host, serv);
    }
    else
        printf("%s", host);

    return NO_ERROR;
}

struct addrinfo* ResolveAddress | ( | char * | addr,
 |  | char * | port,
 |  | int | af,
 |  | int | type,
 |  | int | proto |
 | ) |  |  | [read]

Definition at line 142 of file resolve.c.

{
    struct addrinfo hints,
    *res = NULL;
    int             rc;

    memset(&hints, 0, sizeof(hints));
    hints.ai_flags  = ((addr) ? 0 : AI_PASSIVE);
    hints.ai_family = af; //((addr) ? AF_UNSPEC : af);
    hints.ai_socktype = type;
    hints.ai_protocol = proto;

    rc = getaddrinfo(
            addr,
            port,
           &hints,
           &res
            );
    if (rc != 0)
    {
        printf("Invalid address %s, getaddrinfo failed: %d\n", addr, rc);
        return NULL;
    }
    return res;
}

int ReverseLookup | ( | SOCKADDR * | sa,
 |  | int | salen,
 |  | char * | namebuf,
 |  | int | namebuflen
 | ) |  |

Definition at line 175 of file resolve.c.

{
    char    host[NI_MAXHOST];
    int     hostlen=NI_MAXHOST,
            rc;

    // Validate parameters
    if ((sa == NULL) || (buf == NULL))
        return WSAEFAULT;

    rc = getnameinfo(
            sa,
            salen,
            host,
            hostlen,
            NULL,
            0,
            0
            );
    if (rc != 0)
    {
        fprintf(stderr, "getnameinfo failed: %d\n", rc);
        return rc;
    }

    strncpy(buf, host, buflen-1);

    return NO_ERROR;
}

Generated on Wed Nov 13 2024 16:54:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/IpxChat/About.c File Reference

  • NetDS
  • WinSock
  • IpxChat
Defines | Functions | Variables

About.c File Reference

#include "globals.h"
#include <windows.h>
#include <windowsx.h>

Go to the source code of this file.

Defines

#define | POINTSIZE 8

Functions

LRESULT CALLBACK | About (HWND, UINT, WPARAM, LPARAM)
LRESULT | CmdAbout (HWND hwnd, WORD wCommand, WORD wNotify, HWND hwndCtrl)
LRESULT | CmdAboutDone (HWND, WORD, WORD, HWND)
LRESULT | MsgAboutCommand (HWND, UINT, WPARAM, LPARAM)
LRESULT | MsgAboutInit (HWND, UINT, WPARAM, LPARAM)

Variables

CMDI cmdiAbout
HFONT | hFontCopyright
MSDI msdiAbout
CMD rgcmdAbout []
MSD rgmsdAbout []

Define Documentation

#define POINTSIZE 8

Function Documentation

LRESULT CALLBACK About | ( | HWND | hdlg,
 |  | UINT | uMessage,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 117 of file About.c.

{
    return DispMessage(&msdiAbout, hdlg, uMessage, wparam, lparam);
}

LRESULT CmdAbout | ( | HWND | hwnd,
 |  | WORD | wCommand,
 |  | WORD | wNotify,
 |  | HWND | hwndCtrl
 | ) |  |

Definition at line 87 of file About.c.

{
    DialogBox(hInst, "AboutBox", hwnd, (DLGPROC)About);
    return 0;
}

LRESULT CmdAboutDone | ( | HWND | hdlg,
 |  | WORD | wCommand,
 |  | WORD | wNotify,
 |  | HWND | hwndCtrl
 | ) |  |

Definition at line 264 of file About.c.

{
    if (hFontCopyright)
       DeleteObject(hFontCopyright);

    EndDialog(hdlg, TRUE);          // Exit the dialog
    return TRUE;
}

LRESULT MsgAboutCommand | ( | HWND | hwnd,
 |  | UINT | uMessage,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 238 of file About.c.

{
    return DispCommand(&cmdiAbout, hwnd, wparam, lparam);
}

LRESULT MsgAboutInit | ( | HWND | hdlg,
 |  | UINT | uMessage,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 142 of file About.c.

{
    #define POINTSIZE 8

    char  szFullPath[256];
    DWORD dwVerHnd;
    DWORD dwVerInfoSize;
    HDC   hDC;
    int   iLogPixelsY, iPointSize;

    // Center the dialog over the application window
    CenterWindow(hdlg, GetWindow(hdlg, GW_OWNER));

    // Set the copyright font to something smaller than default
    hDC = GetDC(hdlg);
    iLogPixelsY = GetDeviceCaps(hDC, LOGPIXELSY);
    ReleaseDC(hdlg, hDC);
    iPointSize = MulDiv(iLogPixelsY, POINTSIZE, 72);
    iPointSize *= -1;

    hFontCopyright = CreateFont(iPointSize,
                                0, 0, 0,
                                FW_DONTCARE,
                                0, 0, 0, 0,
                                0, 0, 0, 0,
                                "System");

    SendDlgItemMessage(hdlg,
                       IDD_VERLAST,
                       WM_SETFONT,
                       (WPARAM)hFontCopyright,
                       0L);

    // Get version information from the application
    GetModuleFileName(hInst, szFullPath, sizeof(szFullPath));
    dwVerInfoSize = GetFileVersionInfoSize(szFullPath, &dwVerHnd);
    if (dwVerInfoSize)
    {
        // If we were able to get the information, process it:
        HANDLE  hMem;
        LPVOID  lpvMem;
        char    szGetName[256];
        int     cchRoot;
        int     i;

        hMem = GlobalAlloc(GMEM_MOVEABLE, dwVerInfoSize);
        lpvMem = GlobalLock(hMem);
        GetFileVersionInfo(szFullPath, dwVerHnd, dwVerInfoSize, lpvMem);
        StringCchCopy(szGetName,256,"\\StringFileInfo\\040904E4\\");
        cchRoot = lstrlen(szGetName);

        // Walk through the dialog items that we want to replace:
        for (i = IDD_VERFIRST; i <= IDD_VERLAST; i++)
        {
            BOOL  fRet;
            UINT  cchVer = 0;
            LPSTR lszVer = NULL;
            char  szResult[256];

            GetDlgItemText(hdlg, i, szResult, sizeof(szResult));
            StringCchCopy(&szGetName[cchRoot],256,szResult);
            fRet = VerQueryValue(lpvMem, szGetName, &lszVer, &cchVer);

            if (fRet && cchVer && lszVer)
            {
                // Replace dialog item text with version info
                StringCchCopy(szResult,256,lszVer);
                SetDlgItemText(hdlg, i, szResult);
            }
        }
        GlobalUnlock(hMem);
        GlobalFree(hMem);
    }
    return TRUE;
}

Variable Documentation

CMDI cmdiAbout
Initial value:
{
    sizeof(rgcmdAbout) / sizeof(CMD),
    rgcmdAbout,
    edwpNone
}

Definition at line 56 of file About.c.

HFONT hFontCopyright

Definition at line 66 of file About.c.

MSDI msdiAbout
Initial value:
{
    sizeof(rgmsdAbout) / sizeof(MSD),
    rgmsdAbout,
    edwpNone
}

Definition at line 42 of file About.c.

CMD rgcmdAbout[]
Initial value:
{
    {IDOK,     CmdAboutDone},
    {IDCANCEL, CmdAboutDone}
}

Definition at line 50 of file About.c.

MSD rgmsdAbout[]
Initial value:
{
    {WM_COMMAND,    MsgAboutCommand},
    {WM_INITDIALOG, MsgAboutInit}
}

Definition at line 36 of file About.c.

Generated on Wed Nov 13 2024 16:54:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/IpxChat/Connect.c File Reference

  • NetDS
  • WinSock
  • IpxChat
Functions | Variables

Connect.c File Reference

#include "globals.h"
#include <windows.h>
#include <windowsx.h>
#include <stdlib.h>
#include <stdio.h>

Go to the source code of this file.

Functions

LRESULT | CmdConnect (HWND hwnd, WORD wCommand, WORD wNotify, HWND hwndCtrl)
LRESULT | CmdConnectDone (HWND, WORD, WORD, HWND)
LRESULT | CmdConnectNow (HWND, WORD, WORD, HWND)
LRESULT CALLBACK | Connect (HWND, UINT, WPARAM, LPARAM)
LRESULT | MsgConnectCommand (HWND, UINT, WPARAM, LPARAM)
LRESULT | MsgConnectInit (HWND, UINT, WPARAM, LPARAM)

Variables

CMDI cmdiConnect
HFONT | hfontDlg
MSDI msdiConnect
CMD rgcmdConnect []
MSD rgmsdConnect []

Function Documentation

LRESULT CmdConnect | ( | HWND | hwnd,
 |  | WORD | wCommand,
 |  | WORD | wNotify,
 |  | HWND | hwndCtrl
 | ) |  |

Definition at line 92 of file Connect.c.

{
    HMENU hmenu = NULL;

    if(FALSE == SetWindowText(hwnd, "IPX Chat Client"))    // Change Window Title
        return 1;

    // Start dialog box
    if(DialogBox(hInst, "ConnectBox", hwnd, (DLGPROC)Connect))
    {

        // We have a connection!  Set up message notification if
        // data ready to be read or if connection is closed on us
        if (WSAAsyncSelect(sock,
                           hwnd,
                           MW_DATAREADY,
                           FD_READ | FD_CLOSE) == SOCKET_ERROR)
        {
            MessageBox(hwnd, "WSAAsyncSelect Failed!", NULL, MB_OK);
            CleanUp();
            return 0;
        }

        // Connect has succeeded!  Fix menus
        if(NULL == (hmenu = GetMenu(hwnd)))
            return 1;
        if(FALSE == EnableMenuItem(hmenu, IDM_CONNECT, MF_GRAYED))
            return 1;
        if(FALSE == EnableMenuItem(hmenu, IDM_LISTEN, MF_GRAYED))
            return 1;
        if(FALSE == EnableMenuItem(hmenu, IDM_DISCONNECT, MF_ENABLED))
            return 1;

        return 0;
    }

    // Connection failed - reset window title
    if(FALSE == SetWindowText(hwnd, szTitle))
        return 1;

    return 0;
}

LRESULT CmdConnectDone | ( | HWND | hdlg,
 |  | WORD | wCommand,
 |  | WORD | wNotify,
 |  | HWND | hwndCtrl
 | ) |  |

Definition at line 259 of file Connect.c.

{

    CleanUp();               // Free any aborted socket resources
    EndDialog(hdlg, FALSE);  // Exit Dialog -- rtrn false since no connection
    return TRUE;
}

LRESULT CmdConnectNow | ( | HWND | hdlg,
 |  | WORD | wCommand,
 |  | WORD | wNotify,
 |  | HWND | hwndCtrl
 | ) |  |

Definition at line 285 of file Connect.c.

{
    char outtext[128];
    WORD wVersionRequested;
    WSADATA wsaData;

    GetDlgItemText(hdlg, CD_NETWORK, szConnectNetwork, 9);        // Get Network Number
    AtoH(szConnectNetwork, (char *)&RemAddr.sa_netnum, 4);        // Network order

    GetDlgItemText(hdlg, CD_NODE, szConnectNode, 13);             // Get Node Number
    AtoH((char *)szConnectNode, (char *)&RemAddr.sa_nodenum, 6);  // Network order

    GetDlgItemText(hdlg, CD_SOCKET, szConnectSocket, 5);          // Get Socket Number
    AtoH((char *)szConnectSocket, (char *)&RemAddr.sa_socket, 2); // Network order

    RemAddr.sa_family = AF_IPX;                                   // IPX Family
    wVersionRequested = MAKEWORD(1, 1);

    SetDlgItemText(hdlg, CD_STATUS, "Calling WSAStartup");

    // Initialize winsock dll
    if(WSAStartup(wVersionRequested, &wsaData) != 0)
    {
        SetDlgItemText(hdlg, CD_STATUS, "WSAStartup failed");
        return TRUE;
    }

    SetDlgItemText(hdlg, CD_STATUS, "WSAStartup Succeeded");

    SetDlgItemText(hdlg, CD_STATUS, "Calling socket()");

    // get socket handle
    sock = socket(AF_IPX,            // IPX family
                  SOCK_SEQPACKET,    // Message mode data xfers
                  NSPROTO_SPX);      // SPX = Connection Oriented

    if(sock == INVALID_SOCKET) {
        SetDlgItemText(hdlg, CD_STATUS, "ERROR on socket()");
        WSACleanup();
        return TRUE;
    }

    SetDlgItemText(hdlg, CD_STATUS, "socket() Succeeded");

    SetDlgItemText(hdlg, CD_STATUS, "Calling connect()");

    // Call specified address (we block here since I don't have anything better
    // to do).
    if(connect(sock, (struct sockaddr *)&RemAddr, sizeof(RemAddr)) == SOCKET_ERROR)
    {
        // Failed!  Post status and cleanup
        StringCchPrintf(outtext,128,"connect() failed, error %u", WSAGetLastError());
        SetDlgItemText(hdlg, CD_STATUS, outtext);
        closesocket(sock);
        WSACleanup();
        return TRUE;
    }

    // We've got a connection!  Kill the dialog
    SetDlgItemText(hdlg, CD_STATUS, "connect() succeeded!");

    EndDialog(hdlg, TRUE);          // Exit the dialog
    DeleteObject (hfontDlg);
    return (TRUE);
}

LRESULT CALLBACK Connect | ( | HWND | hdlg,
 |  | UINT | uMessage,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 159 of file Connect.c.

{
    return DispMessage(&msdiConnect, hdlg, uMessage, wparam, lparam);
}

LRESULT MsgConnectCommand | ( | HWND | hwnd,
 |  | UINT | uMessage,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 233 of file Connect.c.

{
    return DispCommand(&cmdiConnect, hwnd, wparam, lparam);
}

LRESULT MsgConnectInit | ( | HWND | hdlg,
 |  | UINT | uMessage,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 186 of file Connect.c.

{

    // Create a font to use
    if(NULL == (hfontDlg = CreateFont(14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                          VARIABLE_PITCH | FF_SWISS, "")))
        return FALSE;

    // Center the dialog over the application window
    CenterWindow (hdlg, GetWindow (hdlg, GW_OWNER));

    // Limit size of edit controls
    SendDlgItemMessage(hdlg, CD_NETWORK, EM_LIMITTEXT, 8, 0);
    SendDlgItemMessage(hdlg, CD_NODE, EM_LIMITTEXT, 12, 0);
    SendDlgItemMessage(hdlg, CD_SOCKET, EM_LIMITTEXT, 4, 0);

    // Initialize Edit Controls
    if(FALSE == SetDlgItemText(hdlg, CD_NETWORK, szConnectNetwork))
        return FALSE;
    if(FALSE == SetDlgItemText(hdlg, CD_NODE, szConnectNode))
        return FALSE;
    if(FALSE == SetDlgItemText(hdlg, CD_SOCKET, szConnectSocket))
        return FALSE;

    return TRUE;
}

Variable Documentation

CMDI cmdiConnect
Initial value:
{
    sizeof(rgcmdConnect) / sizeof(CMD),
    rgcmdConnect,
    edwpNone
}

Definition at line 61 of file Connect.c.

HFONT hfontDlg

Definition at line 71 of file Connect.c.

MSDI msdiConnect
Initial value:
{
    sizeof(rgmsdConnect) / sizeof(MSD),
    rgmsdConnect,
    edwpNone
}

Definition at line 47 of file Connect.c.

CMD rgcmdConnect[]
Initial value:
{
    {IDOK,     CmdConnectNow},
    {IDCANCEL, CmdConnectDone}
}

Definition at line 55 of file Connect.c.

MSD rgmsdConnect[]
Initial value:
{
    {WM_COMMAND,    MsgConnectCommand},
    {WM_INITDIALOG, MsgConnectInit}
}

Definition at line 41 of file Connect.c.

Generated on Wed Nov 13 2024 16:54:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/IpxChat/Dispatch.c File Reference

  • NetDS
  • WinSock
  • IpxChat
Functions

Dispatch.c File Reference

#include "globals.h"
#include <windows.h>
#include <windowsx.h>

Go to the source code of this file.

Functions

LRESULT | DispCommand (LPCMDI lpcmdi, HWND hwnd, WPARAM wparam, LPARAM lparam)
LRESULT | DispDefault (EDWP, HWND, UINT, WPARAM, LPARAM)
LRESULT | DispMessage (LPMSDI lpmsdi, HWND hwnd, UINT uMessage, WPARAM wparam, LPARAM lparam)

Function Documentation

LRESULT DispCommand | ( | LPCMDI | lpcmdi,
 |  | HWND | hwnd,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 99 of file Dispatch.c.

{
    LRESULT lRet = 0;
    WORD    wCommand = GET_WM_COMMAND_ID(wparam, lparam);
    int     icmd = 0;

    CMD    *rgcmd = lpcmdi->rgcmd;
    int     ccmd  = lpcmdi->ccmd;

    // Message packing of wparam and lparam have changed for Win32,
    // so use the GET_WM_COMMAND macro to unpack the commnad

    for (icmd = 0; icmd < ccmd; icmd++)
    {
        if (rgcmd[icmd].wCommand == wCommand)
        {
            return rgcmd[icmd].pfncmd(hwnd,
                                      wCommand,
                                      GET_WM_COMMAND_CMD(wparam, lparam),
                                      GET_WM_COMMAND_HWND(wparam, lparam));
        }
    }

    return DispDefault(lpcmdi->edwp, hwnd, WM_COMMAND, wparam, lparam);
}

LRESULT DispDefault | ( | EDWP | edwp,
 |  | HWND | hwnd,
 |  | UINT | uMessage,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 150 of file Dispatch.c.

{
    switch (edwp)
    {
        case edwpNone:
            return 0;
        case edwpWindow:
            return DefWindowProc(hwnd, uMessage, wparam, lparam);
        case edwpDialog:
            return DefDlgProc(hwnd, uMessage, wparam, lparam);
        case edwpMDIFrame:
            return DefFrameProc(hwnd, hwndMDIIPXChat, uMessage, wparam, lparam);
        case edwpMDIChild:
            return DefMDIChildProc(hwnd, uMessage, wparam, lparam);
    }
    return 0;
}

LRESULT DispMessage | ( | LPMSDI | lpmsdi,
 |  | HWND | hwnd,
 |  | UINT | uMessage,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 53 of file Dispatch.c.

{
    int  imsd = 0;

    MSD *rgmsd = lpmsdi->rgmsd;
    int  cmsd  = lpmsdi->cmsd;

    for (imsd = 0; imsd < cmsd; imsd++)
    {
        if (rgmsd[imsd].uMessage == uMessage)
            return rgmsd[imsd].pfnmsg(hwnd, uMessage, wparam, lparam);
    }

    return DispDefault(lpmsdi->edwp, hwnd, uMessage, wparam, lparam);
}

Generated on Wed Nov 13 2024 16:54:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/IpxChat/Globals.h File Reference

  • NetDS
  • WinSock
  • IpxChat
Classes | Defines | Typedefs | Enumerations | Functions | Variables

Globals.h File Reference

#include <winsock2.h>
#include <wsipx.h>
#include <strsafe.h>

Go to the source code of this file.

Classes

struct | _CMD
struct | _CMDI
struct | _MSD
struct | _MSDI

Defines

#define | CD_NETWORK 201
#define | CD_NODE 202
#define | CD_SOCKET 203
#define | CD_STATUS 200
#define | hwndMDIIPXChat NULL
#define | ID_INBOX 602
#define | ID_OUTBOX 601
#define | IDD_VERFIRST 100
#define | IDD_VERLAST 104
#define | IDM_ABOUT 1100
#define | IDM_CONNECT 1000
#define | IDM_DISCONNECT 1002
#define | IDM_EXIT 1003
#define | IDM_LISTEN 1001
#define | IDS_APPNAME 1
#define | IDS_DESCRIPTION 2
#define | LD_SOCKET 300
#define | LD_STATUS 301
#define | LDM_CONNECTED 504
#define | MW_DATAREADY 501
#define | MW_DISCONNECTED 503
#define | MW_DISPLAYREFRESH 502
#define | STRSAFE_LIB
#define | SZRAPPNAME "InternalName"
#define | SZRCOMPANYNAME "CompanyName"
#define | SZRCOPYRIGHT "LegalCopyright"
#define | SZRDESCRIPTION "FileDescription"
#define | SZRPRODNAME "ProductName"
#define | SZRPRODVER "ProuctVersion"
#define | SZRTRADEMARK "LegalTrademarks"
#define | SZRVERSION "FileVersion"

Typedefs

typedef struct _CMD | CMD
typedef struct _CMDI | CMDI
typedef struct _CMDI * | LPCMDI
typedef struct _MSDI * | LPMSDI
typedef struct _MSD | MSD
typedef struct _MSDI | MSDI
typedef LRESULT(* | PFNCMD )(HWND, WORD, WORD, HWND)
typedef LRESULT(* | PFNMSG )(HWND, UINT, WPARAM, LPARAM)

Enumerations

enum EDWP {
edwpNone, edwpWindow, edwpDialog, edwpMDIChild,
edwpMDIFrame, edwpNone, edwpWindow, edwpDialog,
edwpMDIChild, edwpMDIFrame
}

Functions

void | AtoH (char *, char *, int)
unsigned char | BtoH (char)
BOOL | CenterWindow (HWND, HWND)
void | CleanUp (void)
LRESULT | CmdAbout (HWND, WORD, WORD, HWND)
LRESULT | CmdConnect (HWND, WORD, WORD, HWND)
LRESULT | CmdDisconnect (HWND, WORD, WORD, HWND)
LRESULT | CmdExit (HWND, WORD, WORD, HWND)
LRESULT | CmdListen (HWND, WORD, WORD, HWND)
LRESULT | CmdOutbox (HWND, WORD, WORD, HWND)
LRESULT | DispCommand (LPCMDI, HWND, WPARAM, LPARAM)
LRESULT | DispMessage (LPMSDI, HWND, UINT, WPARAM, LPARAM)
void | GetAddrString (PSOCKADDR_IPX, char *)
LPTSTR | GetStringRes (int id)
void | HtoA (char *, char *, int)
char | HtoB (UCHAR)
BOOL | InitApplication (HINSTANCE, int)
LRESULT | MsgCommand (HWND, UINT, WPARAM, LPARAM)
LRESULT | MsgCreate (HWND, UINT, WPARAM, LPARAM)
LRESULT | MsgDataready (HWND, UINT, WPARAM, LPARAM)
LRESULT | MsgDestroy (HWND, UINT, WPARAM, LPARAM)
LRESULT | MsgDisconnected (HWND, UINT, WPARAM, LPARAM)
LRESULT | MsgRefreshdisplay (HWND, UINT, WPARAM, LPARAM)
LRESULT | MsgSetfocus (HWND, UINT, WPARAM, LPARAM)
LRESULT | MsgSize (HWND, UINT, WPARAM, LPARAM)
BOOL | ReceiveInBox (HWND, WPARAM, LPARAM, char *, int)
void | SendOutBox (char *, int)
LRESULT CALLBACK | WndProc (HWND, UINT, WPARAM, LPARAM)

Variables

struct sockaddr | addr
int | addrlen
CMDI cmdiMain
HINSTANCE | hInst
HWND | hInWnd
HWND | hOutWnd
BOOL i_should_sleep
MSDI msdiMain
PSOCKADDR_IPX | pRemAddr
PSOCKADDR_IPX | pSockAddr
SOCKADDR_IPX | RemAddr
SOCKET | sock
SOCKET | SrvSock
char | szAppName []
char | szConnectNetwork []
char | szConnectNode []
char | szConnectSocket []
char | szListenSocket []
char | szRcvBuf [0x8000]
char | szSndBuf [0x8000]
char | szTitle []

Define Documentation

#define CD_NETWORK 201

Definition at line 125 of file Globals.h.

#define CD_NODE 202

Definition at line 126 of file Globals.h.

#define CD_SOCKET 203

Definition at line 127 of file Globals.h.

#define CD_STATUS 200

Definition at line 124 of file Globals.h.

#define hwndMDIIPXChat NULL

Definition at line 159 of file Globals.h.

#define ID_INBOX 602

Definition at line 113 of file Globals.h.

#define ID_OUTBOX 601

Definition at line 112 of file Globals.h.

#define IDD_VERFIRST 100

Definition at line 118 of file Globals.h.

#define IDD_VERLAST 104

Definition at line 119 of file Globals.h.

#define IDM_ABOUT 1100

Definition at line 92 of file Globals.h.

#define IDM_CONNECT 1000

Definition at line 86 of file Globals.h.

#define IDM_DISCONNECT 1002

Definition at line 88 of file Globals.h.

#define IDM_EXIT 1003

Definition at line 89 of file Globals.h.

#define IDM_LISTEN 1001

Definition at line 87 of file Globals.h.

#define IDS_APPNAME 1

Definition at line 106 of file Globals.h.

#define IDS_DESCRIPTION 2

Definition at line 107 of file Globals.h.

#define LD_SOCKET 300

Definition at line 132 of file Globals.h.

#define LD_STATUS 301

Definition at line 133 of file Globals.h.

#define LDM_CONNECTED 504

Definition at line 101 of file Globals.h.

#define MW_DATAREADY 501

Definition at line 98 of file Globals.h.

#define MW_DISCONNECTED 503

Definition at line 100 of file Globals.h.

#define MW_DISPLAYREFRESH 502

Definition at line 99 of file Globals.h.

#define STRSAFE_LIB

Definition at line 23 of file Globals.h.

#define SZRAPPNAME "InternalName"

Definition at line 240 of file Globals.h.

#define SZRCOMPANYNAME "CompanyName"

Definition at line 237 of file Globals.h.

#define SZRCOPYRIGHT "LegalCopyright"

Definition at line 241 of file Globals.h.

#define SZRDESCRIPTION "FileDescription"

Definition at line 238 of file Globals.h.

#define SZRPRODNAME "ProductName"

Definition at line 243 of file Globals.h.

#define SZRPRODVER "ProuctVersion"

Definition at line 244 of file Globals.h.

#define SZRTRADEMARK "LegalTrademarks"

Definition at line 242 of file Globals.h.

#define SZRVERSION "FileVersion"

Definition at line 239 of file Globals.h.

Typedef Documentation

typedef struct _CMD CMD
typedef struct _CMDI CMDI
typedef struct _CMDI* LPCMDI
typedef struct _MSDI* LPMSDI
typedef struct _MSD MSD
typedef struct _MSDI MSDI
typedef LRESULT(* PFNCMD)(HWND, WORD, WORD, HWND)

Definition at line 172 of file Globals.h.

typedef LRESULT(* PFNMSG)(HWND, UINT, WPARAM, LPARAM)

Definition at line 169 of file Globals.h.

Enumeration Type Documentation

enum EDWP
Enumerator:
edwpNone
edwpWindow
edwpDialog
edwpMDIChild
edwpMDIFrame
edwpNone
edwpWindow
edwpDialog
edwpMDIChild
edwpMDIFrame

Definition at line 177 of file Globals.h.

{
   edwpNone,            // Do not call any default procedure.
   edwpWindow,          // Call DefWindowProc.
   edwpDialog,          // Call DefDlgProc (This should be used only for
                        // custom dialogs - standard dialog use edwpNone).
   edwpMDIChild,        // Call DefMDIChildProc.
   edwpMDIFrame         // Call DefFrameProc.
} EDWP;                // Enumeration for Default Window Procedures

Function Documentation

void AtoH | ( | char * | ,
 |  | char * | ,
 |  | int |
 | ) |  |

Definition at line 207 of file Misc.c.

{
    char * srcptr;

    srcptr = src;

    while(destlen--)
    {
        *dest = BtoH(*srcptr++) << 4;    // Put 1st ascii byte in upper nibble.
        *dest++ += BtoH(*srcptr++);      // Add 2nd ascii byte to above.
    }
}

unsigned char BtoH ( char )

Definition at line 237 of file Misc.c.

{
    if (ch >= '0' && ch <= '9') return (ch - '0');        // Handle numerals
    if (ch >= 'A' && ch <= 'F') return (ch - 'A' + 0xA);  // Handle capitol hex digits
    if (ch >= 'a' && ch <= 'f') return (ch - 'a' + 0xA);  // Handle small hex digits
    return(255);
}

BOOL CenterWindow | ( | HWND | ,
 |  | HWND |
 | ) |  |

Definition at line 676 of file Generic.C.

{
   RECT    rChild, rParent, rWorkArea;
   int     wChild, hChild, wParent, hParent;
   int     xNew, yNew;
   BOOL  bResult;

   // Get the Height and Width of the child window
   GetWindowRect (hwndChild, &rChild);
   wChild = rChild.right - rChild.left;
   hChild = rChild.bottom - rChild.top;

   // Get the Height and Width of the parent window
   GetWindowRect (hwndParent, &rParent);
   wParent = rParent.right - rParent.left;
   hParent = rParent.bottom - rParent.top;

   // Get the limits of the 'workarea'
   bResult = SystemParametersInfo(
      SPI_GETWORKAREA,  // system parameter to query or set
      sizeof(RECT),
      &rWorkArea,
      0);
   if (!bResult) {
      rWorkArea.left = rWorkArea.top = 0;
      rWorkArea.right = GetSystemMetrics(SM_CXSCREEN);
      rWorkArea.bottom = GetSystemMetrics(SM_CYSCREEN);
   }

   // Calculate new X position, then adjust for workarea
   xNew = rParent.left + ((wParent - wChild) /2);
   if (xNew < rWorkArea.left) {
      xNew = rWorkArea.left;
   } else if ((xNew+wChild) > rWorkArea.right) {
      xNew = rWorkArea.right - wChild;
   }

   // Calculate new Y position, then adjust for workarea
   yNew = rParent.top  + ((hParent - hChild) /2);
   if (yNew < rWorkArea.top) {
      yNew = rWorkArea.top;
   } else if ((yNew+hChild) > rWorkArea.bottom) {
      yNew = rWorkArea.bottom - hChild;
   }

   // Set it, and return
   return SetWindowPos (hwndChild, NULL, xNew, yNew, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
}

void CleanUp ( void )

Definition at line 256 of file Misc.c.

{
    if(INVALID_SOCKET != SrvSock)
    {
        closesocket(SrvSock);  // Close our server side socket
        SrvSock = INVALID_SOCKET;
    }
    if (INVALID_SOCKET != sock)
    {
        closesocket(sock);     // Close our connection specific socket
        sock = INVALID_SOCKET;
    }
    WSACleanup();          // Nix the DLL
}

LRESULT CmdAbout | ( | HWND | ,
 |  | WORD | ,
 |  | WORD | ,
 |  | HWND |
 | ) |  |

Definition at line 85 of file ABOUT.c.

{
    DialogBox(hInst, "AboutBox", hwnd, (DLGPROC)About);
    return 0;
}

LRESULT CmdConnect | ( | HWND | ,
 |  | WORD | ,
 |  | WORD | ,
 |  | HWND |
 | ) |  |

Definition at line 92 of file Connect.c.

{
    HMENU hmenu = NULL;

    if(FALSE == SetWindowText(hwnd, "IPX Chat Client"))    // Change Window Title
        return 1;

    // Start dialog box
    if(DialogBox(hInst, "ConnectBox", hwnd, (DLGPROC)Connect))
    {

        // We have a connection!  Set up message notification if
        // data ready to be read or if connection is closed on us
        if (WSAAsyncSelect(sock,
                           hwnd,
                           MW_DATAREADY,
                           FD_READ | FD_CLOSE) == SOCKET_ERROR)
        {
            MessageBox(hwnd, "WSAAsyncSelect Failed!", NULL, MB_OK);
            CleanUp();
            return 0;
        }

        // Connect has succeeded!  Fix menus
        if(NULL == (hmenu = GetMenu(hwnd)))
            return 1;
        if(FALSE == EnableMenuItem(hmenu, IDM_CONNECT, MF_GRAYED))
            return 1;
        if(FALSE == EnableMenuItem(hmenu, IDM_LISTEN, MF_GRAYED))
            return 1;
        if(FALSE == EnableMenuItem(hmenu, IDM_DISCONNECT, MF_ENABLED))
            return 1;

        return 0;
    }

    // Connection failed - reset window title
    if(FALSE == SetWindowText(hwnd, szTitle))
        return 1;

    return 0;
}

LRESULT CmdDisconnect | ( | HWND | ,
 |  | WORD | ,
 |  | WORD | ,
 |  | HWND |
 | ) |  |

Definition at line 452 of file IpxChat.c.

{
    HMENU hmenu;

    // Protocol Specific cleanup
    CleanUp();

    // Fix menus
    if(NULL == (hmenu = GetMenu(hwnd)))
        return 1;
    if(FALSE == EnableMenuItem(hmenu, IDM_CONNECT, MF_ENABLED))
        return 1;
    if(FALSE == EnableMenuItem(hmenu, IDM_LISTEN, MF_ENABLED))
        return 1;
    if(FALSE == EnableMenuItem(hmenu, IDM_DISCONNECT, MF_GRAYED))
        return 1;
    if(FALSE == SetWindowText(hwnd, szTitle))
        return 1;

    return 0;
}

LRESULT CmdExit | ( | HWND | ,
 |  | WORD | ,
 |  | WORD | ,
 |  | HWND |
 | ) |  |

Definition at line 389 of file TapiComm.c.

{
    char szBuffer[50];
    int  cbWritten = 0;

    ShutdownTAPI();

    cbWritten = LoadString(hInst, wCommand, szBuffer, sizeof(szBuffer));
    if(cbWritten == 0)
        strncpy(szBuffer, "Unknown Command", 49);
  szBuffer[49] = '\0';

    UpdateStatusBar(szBuffer, 0, 0);

    DestroyWindow(hwnd);
    return 0;
}

LRESULT CmdListen | ( | HWND | ,
 |  | WORD | ,
 |  | WORD | ,
 |  | HWND |
 | ) |  |

Definition at line 91 of file Listen.c.

{
    HMENU hmenu;

    SetWindowText(hwnd, "IPX Chat Server");     // Change title bar text

    // Start Dialog
    if(DialogBox(hInst, "ListenBox", hwnd, (DLGPROC)Listen))
    {

        // Dialog got a connection!  Set Message to indicate
        // when we have data to read, or if the connection is
        // closed on us.
        if (WSAAsyncSelect(sock,
                           hwnd,
                           MW_DATAREADY,
                           FD_READ | FD_CLOSE) == SOCKET_ERROR)
        {
            MessageBox(hwnd, "WSAAsyncSelect Failed!", NULL, MB_OK);
            CleanUp();
            return 0;
        }

        // Fix menus
        hmenu = GetMenu(hwnd);
        EnableMenuItem(hmenu, IDM_CONNECT, MF_GRAYED);
        EnableMenuItem(hmenu, IDM_LISTEN, MF_GRAYED);
        EnableMenuItem(hmenu, IDM_DISCONNECT, MF_ENABLED);
        return 0;
    }

    // Listen Failed
    SetWindowText(hwnd, szTitle);
    return 0;
}

LRESULT CmdOutbox | ( | HWND | ,
 |  | WORD | ,
 |  | WORD | ,
 |  | HWND |
 | ) |  |

Definition at line 415 of file IpxChat.c.

{
    int cSendLen;

    if (wNotify != EN_CHANGE)  // We only care if text has changed
    {
        return 0;
    }
    // Text has changed!  Put OutBox's text in szSndBuf
    cSendLen = GetDlgItemText(hwnd,
                              ID_OUTBOX,
                              szSndBuf,
                              sizeof(szSndBuf));

    // Do protocol specific send
    SendOutBox(szSndBuf, cSendLen);
    return 0;
}

LRESULT DispCommand | ( | LPCMDI | ,
 |  | HWND | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 97 of file DISPATCH.c.

{
    LRESULT lRet = 0;
    WORD    wCommand = GET_WM_COMMAND_ID(wparam, lparam);
    int     icmd;

    CMD    *rgcmd = lpcmdi->rgcmd;
    int     ccmd  = lpcmdi->ccmd;

    // Message packing of wparam and lparam have changed for Win32,
    // so use the GET_WM_COMMAND macro to unpack the commnad

    for (icmd = 0; icmd < ccmd; icmd++)
    {
        if (rgcmd[icmd].wCommand == wCommand)
        {
            return rgcmd[icmd].pfncmd(hwnd,
                                      wCommand,
                                      GET_WM_COMMAND_CMD(wparam, lparam),
                                      GET_WM_COMMAND_HWND(wparam, lparam));
        }
    }

    return DispDefault(lpcmdi->edwp, hwnd, WM_COMMAND, wparam, lparam);
}

LRESULT DispMessage | ( | LPMSDI | ,
 |  | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 51 of file DISPATCH.c.

{
    int  imsd = 0;

    MSD *rgmsd = lpmsdi->rgmsd;
    int  cmsd  = lpmsdi->cmsd;

    for (imsd = 0; imsd < cmsd; imsd++)
    {
        if (rgmsd[imsd].uMessage == uMessage)
            return rgmsd[imsd].pfnmsg(hwnd, uMessage, wparam, lparam);
    }

    return DispDefault(lpmsdi->edwp, hwnd, uMessage, wparam, lparam);
}

void GetAddrString | ( | PSOCKADDR_IPX | ,
 |  | char * |
 | ) |  |

Definition at line 288 of file Misc.c.

{
    char abuf[15];                                // temp buffer
    char * currptr;                               // temp destination pointer
    int saddrlen = sizeof(struct sockaddr_ipx);   // sizeof address struc

    currptr = dest; // initialize destination pointer

    HtoA((char *)&pSAddr->sa_netnum, abuf, 4);    // convert network number
    StringCchCopy(currptr,15,abuf);
    currptr += 8;
    StringCchCat(currptr,18,".");                   // don't forget seperator
    currptr++;

    HtoA((char *)&pSAddr->sa_nodenum, abuf, 6);   // convert node number
    StringCchCat(currptr,18,abuf);
    currptr += 12;
    StringCchCat(currptr,18,".");                          // seperator
    currptr++;

    HtoA((char *)&pSAddr->sa_socket, abuf, 2);    // convert socket number
    StringCchCat(currptr,18,abuf);

}

LPTSTR GetStringRes ( int id )

Definition at line 736 of file Generic.C.

{
  static TCHAR buffer[MAX_PATH];

  buffer[0]=0;
  LoadString (GetModuleHandle (NULL), id, buffer, MAX_PATH);
  return buffer;
}

void HtoA | ( | char * | ,
 |  | char * | ,
 |  | int |
 | ) |  |

Definition at line 329 of file Misc.c.

{
    char * destptr; // temp pointers
    UCHAR * srcptr;

    srcptr = (UCHAR *)src;
    destptr = dest;

    while(srclen--)
    {
    *destptr++ = HtoB((UCHAR)(*srcptr >> 4));      // Convert high order nibble
    *destptr++ = HtoB((UCHAR)(*srcptr++ & 0x0F));  // Convert low order nibble
    }
    *destptr = 0;  // Null terminator
}

char HtoB ( UCHAR )

Definition at line 362 of file Misc.c.

{
    if (ch <= 9) return ('0' + ch);             // handle decimal values
    if (ch <= 0xf) return ('A' + ch - 10);      // handle hexidecimal specific values
    return('X');                                // Someone screwed up
}

BOOL InitApplication | ( | HINSTANCE | ,
 |  | int |
 | ) |  |

Definition at line 54 of file INIT.c.

{
    WNDCLASS  wc;
    HWND      hwnd; // Main window handle.

    // Load the application name and description strings.

    LoadString(hInstance, IDS_APPNAME, szAppName, sizeof(szAppName));
    LoadString(hInstance, IDS_DESCRIPTION, szTitle, sizeof(szTitle));

    // Save the instance handle in static variable, which will be used in
    // many subsequence calls from this application to Windows.

    hInst = hInstance; // Store instance handle in our global variable

    // Fill in window class structure with parameters that describe the
    // main window.

    wc.style         = CS_HREDRAW | CS_VREDRAW; // Class style(s).
    wc.lpfnWndProc   = (WNDPROC)WndProc;        // Window Procedure
    wc.cbClsExtra    = 0;                       // No per-class extra data.
    wc.cbWndExtra    = 0;                       // No per-window extra data.
    wc.hInstance     = hInstance;               // Owner of this class
    wc.hIcon         = LoadIcon (hInstance, szAppName); // Icon name from .RC
    wc.hCursor       = LoadCursor(NULL, IDC_ARROW); // Cursor
    wc.hbrBackground = CreateSolidBrush(GetSysColor(COLOR_3DFACE));
    wc.lpszMenuName  = szAppName;               // Menu name from .RC
    wc.lpszClassName = szAppName;               // Name to register as

    // Register the window class and return FALSE if unsuccesful.

    if (!RegisterClass(&wc))
    {
        return FALSE;
    }

    // Create a main window for this application instance.
    hwnd = CreateWindow(szAppName,           // See RegisterClass() call
                        szTitle,             // Text for window title bar
                        WS_OVERLAPPEDWINDOW, // Window style
                        CW_USEDEFAULT, 0,    // Use default positioning
                        CW_USEDEFAULT, 0,    // Use default size
                        NULL,                // Overlapped has no parent
                        NULL,                // Use the window class menu
                        hInstance,           // This instance owns this window
                        NULL                 // Don't need data in WM_CREATE
    );

    // If window could not be created, return "failure"
    if (!hwnd)
        return FALSE;

    // Make the window visible; update its client area; and return "success"
    ShowWindow(hwnd, nCmdShow);  // Show the window
    UpdateWindow(hwnd);          // Sends WM_PAINT message

    return TRUE;                 // We succeeded...
}

LRESULT MsgCommand | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 156 of file TapiComm.c.

{
    return DispCommand(&cmdiMain, hwnd, wparam, lparam);
}

LRESULT MsgCreate | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 184 of file TapiComm.c.

{
    InitCommonControls() ; // Initialize the common control library.

    if (InitEditCtls(hwnd) == FALSE)
        return -1;

    InitializeTAPI(hwnd);

    if(!(CreateTBar(hwnd) && CreateSBar(hwnd)))
        return -1;   // Tool and status bars were not created, so return -1.

    UpdateStatusBar("Ready to make a call.",1,0);

    EnableMakeCall(hwnd, TRUE);
    EnableHangupCall(hwnd, FALSE);
    return 0;
}

LRESULT MsgDataready | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 246 of file IpxChat.c.

{
    // Call protocol specific program to Read data and put in szRcvBuf
    if(ReceiveInBox(hwnd, wparam, lparam, szRcvBuf, sizeof(szRcvBuf)))
    {
        PostMessage(hwnd, MW_DISPLAYREFRESH, 0, 0);
    }
    return TRUE;
}

LRESULT MsgDestroy | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 296 of file TapiComm.c.

{
    PostQuitMessage(0);
    return 0;
}

LRESULT MsgDisconnected | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 317 of file IpxChat.c.

{
    HMENU hmenu;

    // Let the user know
    MessageBox(hwnd,
               "Connection Disconnected",
               "Chat Dialog Stopped",
               MB_OK);
    // Protocol Specific Cleanup
    CleanUp();
    // Fix menus
    if(NULL == (hmenu = GetMenu(hwnd)))
        return FALSE;
    if(FALSE == EnableMenuItem(hmenu, IDM_CONNECT, MF_ENABLED))
        return FALSE;
    if(FALSE == EnableMenuItem(hmenu, IDM_LISTEN, MF_ENABLED))
        return FALSE;
    if(FALSE == EnableMenuItem(hmenu, IDM_DISCONNECT, MF_GRAYED))
        return FALSE;
    if(FALSE == SetWindowText(hwnd, szTitle))
        return FALSE;

    return TRUE;
}

LRESULT MsgRefreshdisplay | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 275 of file IpxChat.c.

{
    MSG peekmsg;

    // Don't bother displaying if there is already another update queued
    if(PeekMessage(&peekmsg, hwnd, MW_DATAREADY, MW_DISPLAYREFRESH, PM_NOREMOVE))
    {
       return TRUE;
    }
    // Put data in szRcvBuf in InBox
    SendDlgItemMessage(hwnd,
                       ID_INBOX,
                       EM_SETSEL,
                       0,-1);
    SendDlgItemMessage(hwnd,
                       ID_INBOX,
                       EM_REPLACESEL,
                       0,
                       (LPARAM)szRcvBuf);
    return TRUE;
}

LRESULT MsgSetfocus | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 218 of file IpxChat.c.

{
    if(NULL == SetFocus(hOutWnd))  // Don't let main window have focus
        return FALSE;

    return TRUE;
}

LRESULT MsgSize | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 231 of file TapiComm.c.

{
    SendMessage(hWndStatusbar,  uMessage, wparam, lparam);
    SendMessage(hWndToolbar, uMessage, wparam, lparam);

    // Re-position the panes in the status bar
    InitializeStatusBar(hwnd);

    SizeEditCtls();

    return 0 ;
}

BOOL ReceiveInBox | ( | HWND | ,
 |  | WPARAM | ,
 |  | LPARAM | ,
 |  | char * | ,
 |  | int |
 | ) |  |

Definition at line 134 of file Misc.c.

{
    char * pRBuf;     // temp buf pointer
    int cBytesRead;   // count of bytes actually read

    if (LOWORD(lParam) == FD_CLOSE)                   // Is this a FD_CLOSE event?
    {
        SendMessage(hWnd, MW_DISCONNECTED, 0, 0);     // Yes, post message
        return(FALSE);
    }

    pRBuf = szRBuf;   // Set temp pointer
    cRBufLen--;       // Save room for null terminator

    // read socket
    if((cBytesRead = recv(sock, pRBuf, cRBufLen, 0)) != SOCKET_ERROR)
        pRBuf += cBytesRead;    // Move temp pointer to end of buffer

    *pRBuf = 0;   // Null terminate - if recv() failed, then prBuf will
                  // point to first byte of the buffer

    return (TRUE);   // We've got a buffer to display
}

void SendOutBox | ( | char * | ,
 |  | int |
 | ) |  |

Definition at line 173 of file Misc.c.

{
    char * pSBuf;
    int cBytesSent;

    pSBuf = szSBuf; // Set temp pointer

    while((cBytesSent = send(sock,
                             pSBuf,
                             cSBufLen,
                             0)) != SOCKET_ERROR)
    {
        pSBuf += cBytesSent;
        cSBufLen -= cBytesSent;
        if(!cSBufLen) return;
    }
}

LRESULT CALLBACK WndProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 290 of file Generic.C.

{
   int wmId, wmEvent;
   PAINTSTRUCT ps;
   HDC hdc;
      POINT pnt;
   HMENU hMenu;
      BOOL bGotHelp;

   switch (message) {

      case WM_COMMAND:
         wmId    = LOWORD(wParam); // Remember, these are...
         wmEvent = HIWORD(wParam); // ...different for Win32!

         //Parse the menu selections:
         switch (wmId) {

            case IDM_ABOUT:
               DialogBox(hInst, "AboutBox", hWnd, (DLGPROC)About);
               break;

            case IDM_EXIT:
               DestroyWindow (hWnd);
               break;

            case IDM_HELPTOPICS: // Only called in Windows 95
               bGotHelp = WinHelp (hWnd, APPNAME".HLP", HELP_FINDER,(DWORD)0);
               if (!bGotHelp)
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            case IDM_HELPCONTENTS: // Not called in Windows 95
               bGotHelp = WinHelp (hWnd, APPNAME".HLP", HELP_CONTENTS,(DWORD)0);
               if (!bGotHelp)
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            case IDM_HELPSEARCH: // Not called in Windows 95
               if (!WinHelp(hWnd, APPNAME".HLP", HELP_PARTIALKEY,
                           (ULONG_PTR)(LPSTR)""))
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            case IDM_HELPHELP: // Not called in Windows 95
               if(!WinHelp(hWnd, (LPSTR)NULL, HELP_HELPONHELP, 0))
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            // Here are all the other possible menu options,
            // all of these are currently disabled:
            case IDM_NEW:
            case IDM_OPEN:
            case IDM_SAVE:
            case IDM_SAVEAS:
            case IDM_UNDO:
            case IDM_CUT:
            case IDM_COPY:
            case IDM_PASTE:
            case IDM_LINK:
            case IDM_LINKS:

            default:
               return (DefWindowProc(hWnd, message, wParam, lParam));
         }
         break;

      case WM_NCRBUTTONUP: // RightClick on windows non-client area...
         if (IS_WIN95 && SendMessage(hWnd, WM_NCHITTEST, 0, lParam) == HTSYSMENU)
         {
            // The user has clicked the right button on the applications
            // 'System Menu'. Here is where you would alter the default
            // system menu to reflect your application. Notice how the
            // explorer deals with this. For this app, we aren't doing
            // anything
            return (DefWindowProc(hWnd, message, wParam, lParam));
         } else {
            // Nothing we are interested in, allow default handling...
            return (DefWindowProc(hWnd, message, wParam, lParam));
         }
            break;

        case WM_RBUTTONDOWN: // RightClick in windows client area...
            pnt.x = LOWORD(lParam);
            pnt.y = HIWORD(lParam);
            ClientToScreen(hWnd, (LPPOINT) &pnt);
      // This is where you would determine the appropriate 'context'
      // menu to bring up. Since this app has no real functionality,
      // we will just bring up the 'Help' menu:
            hMenu = GetSubMenu (GetMenu (hWnd), 2);
            if (hMenu) {
                TrackPopupMenu (hMenu, 0, pnt.x, pnt.y, 0, hWnd, NULL);
            } else {
            // Couldn't find the menu...
                MessageBeep(0);
            }
            break;

      case WM_DISPLAYCHANGE: // Only comes through on plug'n'play systems
      {
         SIZE  szScreen;
         DWORD dwBitsPerPixel = (DWORD)wParam;

         szScreen.cx = LOWORD(lParam);
         szScreen.cy = HIWORD(lParam);

         MessageBox (GetFocus(), GetStringRes(IDS_DISPLAYCHANGED),
                     szAppName, 0);
      }
      break;

      case WM_PAINT:
         hdc = BeginPaint (hWnd, &ps);
         // Add any drawing code here...
         EndPaint (hWnd, &ps);
         break;

      case WM_DESTROY:
         // Tell WinHelp we don't need it any more...
               WinHelp (hWnd, APPNAME".HLP", HELP_QUIT,(DWORD)0);
         PostQuitMessage(0);
         break;

      default:
         return (DefWindowProc(hWnd, message, wParam, lParam));
   }
   return (0);
}

Variable Documentation

struct sockaddr addr

Definition at line 144 of file Globals.h.

int addrlen

Definition at line 145 of file Globals.h.

CMDI cmdiMain

Definition at line 95 of file TapiComm.c.

HINSTANCE hInst

Definition at line 37 of file Demo.c.

HWND hInWnd

Definition at line 146 of file Globals.h.

HWND hOutWnd

Definition at line 146 of file Globals.h.

BOOL i_should_sleep

Definition at line 32 of file Init.c.

MSDI msdiMain

Definition at line 71 of file TapiComm.c.

PSOCKADDR_IPX pRemAddr

Definition at line 143 of file Globals.h.

PSOCKADDR_IPX pSockAddr

Definition at line 143 of file Globals.h.

SOCKADDR_IPX RemAddr

Definition at line 142 of file Globals.h.

SOCKET sock

Definition at line 141 of file Globals.h.

SOCKET SrvSock

Definition at line 141 of file Globals.h.

char szAppName[]

Definition at line 56 of file Generic.C.

char szConnectNetwork[]

Definition at line 27 of file Init.c.

char szConnectNode[]

Definition at line 28 of file Init.c.

char szConnectSocket[]

Definition at line 29 of file Init.c.

char szListenSocket[]

Definition at line 30 of file Init.c.

char szRcvBuf[0x8000]

Definition at line 147 of file Globals.h.

char szSndBuf[0x8000]

Definition at line 148 of file Globals.h.

char szTitle[]

Definition at line 57 of file Generic.C.

Generated on Wed Nov 13 2024 16:54:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/IpxChat/Init.c File Reference

  • NetDS
  • WinSock
  • IpxChat
Functions | Variables

Init.c File Reference

#include "globals.h"
#include <windows.h>

Go to the source code of this file.

Functions

BOOL | InitApplication (HINSTANCE hInstance, int nCmdShow)

Variables

HINSTANCE | hInst = NULL
BOOL | i_should_sleep = TRUE
char | szAppName [9] = {'\0'}
char | szConnectNetwork [] = "00000000"
char | szConnectNode [] = "000000000000"
char | szConnectSocket [] = "2FFF"
char | szListenSocket [] = "2FFF"
char | szTitle [40] = {'\0'}

Function Documentation

BOOL InitApplication | ( | HINSTANCE | hInstance,
 |  | int | nCmdShow
 | ) |  |

Definition at line 61 of file Init.c.

{
    WNDCLASS  wc = {0};
    HWND      hwnd = NULL; // Main window handle.

    // Load the application name and description strings.

    LoadString(hInstance, IDS_APPNAME, szAppName, sizeof(szAppName));
    LoadString(hInstance, IDS_DESCRIPTION, szTitle, sizeof(szTitle));

    // Save the instance handle in static variable, which will be used in
    // many subsequence calls from this application to Windows.

    hInst = hInstance; // Store instance handle in our global variable

    // Fill in window class structure with parameters that describe the
    // main window.

    wc.style         = CS_HREDRAW | CS_VREDRAW; // Class style(s).
    wc.lpfnWndProc   = (WNDPROC)WndProc;        // Window Procedure
    wc.cbClsExtra    = 0;                       // No per-class extra data.
    wc.cbWndExtra    = 0;                       // No per-window extra data.
    wc.hInstance     = hInstance;               // Owner of this class
    wc.hIcon         = LoadIcon (hInstance, szAppName); // Icon name from .RC
    wc.hCursor       = LoadCursor(NULL, IDC_ARROW); // Cursor
    wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); // Default color
    wc.lpszMenuName  = szAppName;               // Menu name from .RC
    wc.lpszClassName = szAppName;               // Name to register as

    // Register the window class and return FALSE if unsuccesful.

    if (!RegisterClass(&wc))
    {
        return FALSE;
    }

    // Create a main window for this application instance.
    hwnd = CreateWindow(szAppName,           // See RegisterClass() call
                        szTitle,             // Text for window title bar
                        WS_OVERLAPPEDWINDOW, // Window style
                        CW_USEDEFAULT, 0,    // Use default positioning
                        CW_USEDEFAULT, 0,    // Use default size
                        NULL,                // Overlapped has no parent
                        NULL,                // Use the window class menu
                        hInstance,           // This instance owns this window
                        NULL                 // Don't need data in WM_CREATE
    );

    // If window could not be created, return "failure"
    if (!hwnd)
        return FALSE;

    // Make the window visible; update its client area; and return "success"
    ShowWindow(hwnd, nCmdShow);  // Show the window
    UpdateWindow(hwnd);          // Sends WM_PAINT message

    return TRUE;                 // We succeeded...
}

Variable Documentation

HINSTANCE hInst = NULL

Definition at line 22 of file Init.c.

BOOL i_should_sleep = TRUE

Definition at line 32 of file Init.c.

char szAppName[9] = {'\0'}

Definition at line 24 of file Init.c.

char szConnectNetwork[] = "00000000"

Definition at line 27 of file Init.c.

char szConnectNode[] = "000000000000"

Definition at line 28 of file Init.c.

char szConnectSocket[] = "2FFF"

Definition at line 29 of file Init.c.

char szListenSocket[] = "2FFF"

Definition at line 30 of file Init.c.

char szTitle[40] = {'\0'}

Definition at line 25 of file Init.c.

Generated on Wed Nov 13 2024 16:53:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/IpxChat/IpxChat.c File Reference

  • NetDS
  • WinSock
  • IpxChat
Functions | Variables

IpxChat.c File Reference

#include "globals.h"
#include <windows.h>
#include <windowsx.h>

Go to the source code of this file.

Functions

LRESULT | CmdDisconnect (HWND hwnd, WORD wCommand, WORD wNotify, HWND hwndCtrl)
LRESULT | CmdExit (HWND hwnd, WORD wCommand, WORD wNotify, HWND hwndCtrl)
LRESULT | CmdOutbox (HWND hwnd, WORD wCommand, WORD wNotify, HWND hwndCtrl)
LRESULT | MsgCommand (HWND hwnd, UINT uMessage, WPARAM wparam, LPARAM lparam)
LRESULT | MsgCreate (HWND hwnd, UINT uMessage, WPARAM wparam, LPARAM lparam)
LRESULT | MsgDataready (HWND hwnd, UINT uMessage, WPARAM wparam, LPARAM lparam)
LRESULT | MsgDestroy (HWND hwnd, UINT uMessage, WPARAM wparam, LPARAM lparam)
LRESULT | MsgDisconnected (HWND hwnd, UINT uMessage, WPARAM wparam, LPARAM lparam)
LRESULT | MsgRefreshdisplay (HWND hwnd, UINT uMessage, WPARAM wparam, LPARAM lparam)
LRESULT | MsgSetfocus (HWND hwnd, UINT uMessage, WPARAM wparam, LPARAM lparam)
LRESULT | MsgSize (HWND hwnd, UINT uMessage, WPARAM wparam, LPARAM lparam)
LRESULT CALLBACK | WndProc (HWND hwnd, UINT uMessage, WPARAM wparam, LPARAM lparam)

Variables

CMDI cmdiMain
MSDI msdiMain
CMD rgcmd []
MSD rgmsd []

Function Documentation

LRESULT CmdDisconnect | ( | HWND | hwnd,
 |  | WORD | wCommand,
 |  | WORD | wNotify,
 |  | HWND | hwndCtrl
 | ) |  |

Definition at line 452 of file IpxChat.c.

{
    HMENU hmenu;

    // Protocol Specific cleanup
    CleanUp();

    // Fix menus
    if(NULL == (hmenu = GetMenu(hwnd)))
        return 1;
    if(FALSE == EnableMenuItem(hmenu, IDM_CONNECT, MF_ENABLED))
        return 1;
    if(FALSE == EnableMenuItem(hmenu, IDM_LISTEN, MF_ENABLED))
        return 1;
    if(FALSE == EnableMenuItem(hmenu, IDM_DISCONNECT, MF_GRAYED))
        return 1;
    if(FALSE == SetWindowText(hwnd, szTitle))
        return 1;

    return 0;
}

LRESULT CmdExit | ( | HWND | hwnd,
 |  | WORD | wCommand,
 |  | WORD | wNotify,
 |  | HWND | hwndCtrl
 | ) |  |

Definition at line 492 of file IpxChat.c.

{
    if(FALSE == DestroyWindow(hwnd))
        return 1;

    return 0;
}

LRESULT CmdOutbox | ( | HWND | hwnd,
 |  | WORD | wCommand,
 |  | WORD | wNotify,
 |  | HWND | hwndCtrl
 | ) |  |

Definition at line 415 of file IpxChat.c.

{
    int cSendLen;

    if (wNotify != EN_CHANGE)  // We only care if text has changed
    {
        return 0;
    }
    // Text has changed!  Put OutBox's text in szSndBuf
    cSendLen = GetDlgItemText(hwnd,
                              ID_OUTBOX,
                              szSndBuf,
                              sizeof(szSndBuf));

    // Do protocol specific send
    SendOutBox(szSndBuf, cSendLen);
    return 0;
}

LRESULT MsgCommand | ( | HWND | hwnd,
 |  | UINT | uMessage,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 365 of file IpxChat.c.

{
    return DispCommand(&cmdiMain, hwnd, wparam, lparam);
}

LRESULT MsgCreate | ( | HWND | hwnd,
 |  | UINT | uMessage,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 129 of file IpxChat.c.

{
    // Create Edit control for typing to be sent to server
    if (NULL == (hOutWnd = CreateWindow("EDIT",
                           NULL,
                           WS_BORDER | WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_LEFT |
                           ES_MULTILINE | ES_AUTOVSCROLL,
                           0,0,0,0,
                           hwnd,
                           (HMENU) ID_OUTBOX,
                           (HINSTANCE) GetWindowLongPtr(hwnd, GWLP_HINSTANCE),
                           0)))
        return FALSE;
    // Create Edit control for typing to be received from server
    if (NULL == (hInWnd = CreateWindow("EDIT",
                          NULL,
                          WS_BORDER | WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_LEFT |
                          ES_MULTILINE | ES_AUTOVSCROLL,
                          0,0,0,0,
                          hwnd,
                          (HMENU) ID_INBOX,
                          (HINSTANCE) GetWindowLongPtr(hwnd, GWLP_HINSTANCE),
                          0)))
        return FALSE;

    return TRUE;
}

LRESULT MsgDataready | ( | HWND | hwnd,
 |  | UINT | uMessage,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 246 of file IpxChat.c.

{
    // Call protocol specific program to Read data and put in szRcvBuf
    if(ReceiveInBox(hwnd, wparam, lparam, szRcvBuf, sizeof(szRcvBuf)))
    {
        PostMessage(hwnd, MW_DISPLAYREFRESH, 0, 0);
    }
    return TRUE;
}

LRESULT MsgDestroy | ( | HWND | hwnd,
 |  | UINT | uMessage,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 391 of file IpxChat.c.

{
    PostQuitMessage(0);
    return 0;
}

LRESULT MsgDisconnected | ( | HWND | hwnd,
 |  | UINT | uMessage,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 317 of file IpxChat.c.

{
    HMENU hmenu;

    // Let the user know
    MessageBox(hwnd,
               "Connection Disconnected",
               "Chat Dialog Stopped",
               MB_OK);
    // Protocol Specific Cleanup
    CleanUp();
    // Fix menus
    if(NULL == (hmenu = GetMenu(hwnd)))
        return FALSE;
    if(FALSE == EnableMenuItem(hmenu, IDM_CONNECT, MF_ENABLED))
        return FALSE;
    if(FALSE == EnableMenuItem(hmenu, IDM_LISTEN, MF_ENABLED))
        return FALSE;
    if(FALSE == EnableMenuItem(hmenu, IDM_DISCONNECT, MF_GRAYED))
        return FALSE;
    if(FALSE == SetWindowText(hwnd, szTitle))
        return FALSE;

    return TRUE;
}

LRESULT MsgRefreshdisplay | ( | HWND | hwnd,
 |  | UINT | uMessage,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 275 of file IpxChat.c.

{
    MSG peekmsg;

    // Don't bother displaying if there is already another update queued
    if(PeekMessage(&peekmsg, hwnd, MW_DATAREADY, MW_DISPLAYREFRESH, PM_NOREMOVE))
    {
       return TRUE;
    }
    // Put data in szRcvBuf in InBox
    SendDlgItemMessage(hwnd,
                       ID_INBOX,
                       EM_SETSEL,
                       0,-1);
    SendDlgItemMessage(hwnd,
                       ID_INBOX,
                       EM_REPLACESEL,
                       0,
                       (LPARAM)szRcvBuf);
    return TRUE;
}

LRESULT MsgSetfocus | ( | HWND | hwnd,
 |  | UINT | uMessage,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 218 of file IpxChat.c.

{
    if(NULL == SetFocus(hOutWnd))  // Don't let main window have focus
        return FALSE;

    return TRUE;
}

LRESULT MsgSize | ( | HWND | hwnd,
 |  | UINT | uMessage,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 177 of file IpxChat.c.

{
    // Size OutBox Edit Control
    if (FALSE == MoveWindow(hOutWnd,
               1,1,                    // Upper Left Corner
               LOWORD(lparam) - 2,         // Width of Parent Window
               (HIWORD(lparam) / 2) - 2 ,     // Half the height of Parent
               TRUE))                  // repaint
        return FALSE;

    // Size Inbox Edit Control
    if(FALSE == MoveWindow(hInWnd,
               1, (HIWORD(lparam) / 2) + 1,  // Half Way down right side
               LOWORD(lparam) - 2,         // Width of Parent Window
               (HIWORD(lparam) / 2) - 2,      // Half the height of Parent
               TRUE))                  // repaint
        return FALSE;

    return TRUE;
}

LRESULT CALLBACK WndProc | ( | HWND | hwnd,
 |  | UINT | uMessage,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 101 of file IpxChat.c.

{
    return DispMessage(&msdiMain, hwnd, uMessage, wparam, lparam);
}

Variable Documentation

CMDI cmdiMain
Initial value:
{
    sizeof(rgcmd) / sizeof(CMD),
    rgcmd,
    edwpWindow
}

Definition at line 71 of file IpxChat.c.

MSDI msdiMain
Initial value:
{
    sizeof(rgmsd) / sizeof(MSD),
    rgmsd,
    edwpWindow
}

Definition at line 52 of file IpxChat.c.

CMD rgcmd[]
Initial value:
{
    {IDM_CONNECT,    CmdConnect},
    {IDM_LISTEN,     CmdListen},
    {IDM_EXIT,       CmdExit},
    {IDM_ABOUT,      CmdAbout},
    {ID_OUTBOX,      CmdOutbox},
    {IDM_DISCONNECT, CmdDisconnect}
}

Definition at line 61 of file IpxChat.c.

MSD rgmsd[]
Initial value:
{
    {WM_CREATE,         MsgCreate},
    {WM_SIZE,           MsgSize},
    {WM_SETFOCUS,       MsgSetfocus},
    {WM_COMMAND,        MsgCommand},
    {WM_DESTROY,        MsgDestroy},
    {MW_DATAREADY,      MsgDataready},
    {MW_DISCONNECTED,   MsgDisconnected},
    {MW_DISPLAYREFRESH, MsgRefreshdisplay}
}

Definition at line 40 of file IpxChat.c.

Generated on Wed Nov 13 2024 16:54:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/IpxChat/Listen.c File Reference

  • NetDS
  • WinSock
  • IpxChat
Functions | Variables

Listen.c File Reference

#include "globals.h"
#include <windows.h>
#include <windowsx.h>
#include <stdlib.h>
#include <stdio.h>

Go to the source code of this file.

Functions

LRESULT | CmdListen (HWND hwnd, WORD wCommand, WORD wNotify, HWND hwndCtrl)
LRESULT | CmdListenDone (HWND, WORD, WORD, HWND)
LRESULT | CmdListenNow (HWND, WORD, WORD, HWND)
LRESULT CALLBACK | Listen (HWND, UINT, WPARAM, LPARAM)
LRESULT | MsgListenCommand (HWND, UINT, WPARAM, LPARAM)
LRESULT | MsgListenConnected (HWND, UINT, WPARAM, LPARAM)
LRESULT | MsgListenInit (HWND, UINT, WPARAM, LPARAM)

Variables

CMDI cmdiListen
HFONT | hfontDlg
MSDI msdiListen
CMD rgcmdListen []
MSD rgmsdListen []

Function Documentation

LRESULT CmdListen | ( | HWND | hwnd,
 |  | WORD | wCommand,
 |  | WORD | wNotify,
 |  | HWND | hwndCtrl
 | ) |  |

Definition at line 91 of file Listen.c.

{
    HMENU hmenu;

    SetWindowText(hwnd, "IPX Chat Server");     // Change title bar text

    // Start Dialog
    if(DialogBox(hInst, "ListenBox", hwnd, (DLGPROC)Listen))
    {

        // Dialog got a connection!  Set Message to indicate
        // when we have data to read, or if the connection is
        // closed on us.
        if (WSAAsyncSelect(sock,
                           hwnd,
                           MW_DATAREADY,
                           FD_READ | FD_CLOSE) == SOCKET_ERROR)
        {
            MessageBox(hwnd, "WSAAsyncSelect Failed!", NULL, MB_OK);
            CleanUp();
            return 0;
        }

        // Fix menus
        hmenu = GetMenu(hwnd);
        EnableMenuItem(hmenu, IDM_CONNECT, MF_GRAYED);
        EnableMenuItem(hmenu, IDM_LISTEN, MF_GRAYED);
        EnableMenuItem(hmenu, IDM_DISCONNECT, MF_ENABLED);
        return 0;
    }

    // Listen Failed
    SetWindowText(hwnd, szTitle);
    return 0;
}

LRESULT CmdListenDone | ( | HWND | hdlg,
 |  | WORD | wCommand,
 |  | WORD | wNotify,
 |  | HWND | hwndCtrl
 | ) |  |

Definition at line 305 of file Listen.c.

{

    if (INVALID_SOCKET != SrvSock)
    {
        closesocket(SrvSock);    // Free any aborted socket resources
        SrvSock = INVALID_SOCKET;
    }
    WSACleanup();
    DeleteObject (hfontDlg); // Drop the font
    EndDialog(hdlg, FALSE);  // Exit Dialog -- rtrn false since no connection
    return TRUE;
}

LRESULT CmdListenNow | ( | HWND | hdlg,
 |  | WORD | wCommand,
 |  | WORD | wNotify,
 |  | HWND | hwndCtrl
 | ) |  |

Definition at line 337 of file Listen.c.

{
    char szXferBuffer[5];
    WORD wVersionRequested;
    WSADATA wsaData;
    char outtext[80];

    // Get Socket Address
    GetDlgItemText(hdlg,
         LD_SOCKET,
         szXferBuffer,
         13);
    wVersionRequested = MAKEWORD(1, 1);

    SetDlgItemText(hdlg,
                  LD_STATUS,
                  "Calling WSAStartup");

    // Initializes winsock dll
    if(WSAStartup(wVersionRequested, &wsaData) != 0)
    {

        SetDlgItemText(hdlg,
                       LD_STATUS,
                       "WSAStartup failed");
        return TRUE;
    }

    SetDlgItemText(hdlg,
          LD_STATUS,
          "WSAStartup Succeeded");

    SetDlgItemText(hdlg,
          LD_STATUS,
          "Calling socket()");

    // Allocate socket handle
    SrvSock = socket(AF_IPX,         // IPX Family
                     SOCK_SEQPACKET, // Gives message mode transfers
                     NSPROTO_SPX);   // SPX is connection oriented transport

    if(SrvSock == INVALID_SOCKET) {
        SetDlgItemText(hdlg,
                       LD_STATUS,
                       "ERROR on socket()");
        WSACleanup();
        return TRUE;
    }

    SetDlgItemText(hdlg,
                   LD_STATUS,
                   "socket() Succeeded");

    // Set up socket address to bind to
    memset(&addr, 0, sizeof(addr));    // Clear address
    pSockAddr = (PSOCKADDR_IPX)&addr;  // Set pointer
    pSockAddr->sa_family = AF_IPX;     // IPX Family
    // Make sure socket number is in network order
    AtoH(szXferBuffer, (char *)&pSockAddr->sa_socket, 2);

    SetDlgItemText(hdlg,
                   LD_STATUS,
                   "Calling bind()");

    // Bind to socket address
    if(bind(SrvSock,
            (PSOCKADDR) pSockAddr,
            sizeof(SOCKADDR_IPX)) == SOCKET_ERROR)
    {
        SetDlgItemText(hdlg,
                       LD_STATUS,
                       "Error on bind()");
        if (INVALID_SOCKET != SrvSock)
        {
            closesocket(SrvSock);
            SrvSock = INVALID_SOCKET;
        }
        WSACleanup();
        return TRUE;
    }

    SetDlgItemText(hdlg,
                   LD_STATUS,
                   "bind() Succeeded");

    SetDlgItemText(hdlg,
                   LD_STATUS,
                   "Calling listen()");

    // Set up listen queue - this app only supports one connection so
    // queue length is set to 1.
    if (listen(SrvSock, 1) == SOCKET_ERROR)
    {
        StringCchPrintf(outtext,80,"FAILURE: listen() returned %u", WSAGetLastError());
        SetDlgItemText(hdlg,
                       LD_STATUS,
                       outtext);
        if (INVALID_SOCKET != SrvSock)
        {
            closesocket(SrvSock);
            SrvSock = INVALID_SOCKET;
        }
        WSACleanup();
        return TRUE;
    }

    SetDlgItemText(hdlg,
                   LD_STATUS,
                   "listen() succeeded");

    SetDlgItemText(hdlg,
                   LD_STATUS,
                   "Calling WSAAsyncSelect()");

    // Specify message to be posted when client connects
    if(WSAAsyncSelect(SrvSock,
                      hdlg,
                      LDM_CONNECTED,
                      FD_ACCEPT) == SOCKET_ERROR)
    {
        SetDlgItemText(hdlg,
                       LD_STATUS,
                       "WSAAsyncSelect() failed");
        if (INVALID_SOCKET != SrvSock)
        {
            closesocket(SrvSock);
            SrvSock = INVALID_SOCKET;
        }
        WSACleanup();
        return TRUE;
    }

    SetDlgItemText(hdlg,
                   LD_STATUS,
                   "WSAAsyncSelect() succeeded");

    addrlen = sizeof(addr);

    // Get full network.number.socket address
    if(getsockname(SrvSock,&addr,&addrlen) == SOCKET_ERROR)
    {
        StringCchCopy(outtext,80,"ERROR getsocketname()");
    }
    else
    {
        StringCchCopy(outtext,80,"Listening on ");
        GetAddrString((PSOCKADDR_IPX)&addr, outtext + lstrlen(outtext));
    }

    SetDlgItemText(hdlg,
                   LD_STATUS,
                   outtext);

    SetFocus(GetDlgItem(hdlg, IDCANCEL));             // Give Cancel Button focus
    EnableWindow(GetDlgItem(hdlg, IDOK), FALSE);      // Grey OK button
    EnableWindow(GetDlgItem(hdlg, LD_SOCKET), FALSE); // Grey Socket Edit control
    return (TRUE);
}

LRESULT CALLBACK Listen | ( | HWND | hdlg,
 |  | UINT | uMessage,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 151 of file Listen.c.

{
    return DispMessage(&msdiListen, hdlg, uMessage, wparam, lparam);
}

LRESULT MsgListenCommand | ( | HWND | hwnd,
 |  | UINT | uMessage,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 279 of file Listen.c.

{
    return DispCommand(&cmdiListen, hwnd, wparam, lparam);
}

LRESULT MsgListenConnected | ( | HWND | hdlg,
 |  | UINT | uMessage,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 214 of file Listen.c.

{
    char outtext[128];

    SetDlgItemText(hdlg,
                   LD_STATUS,
                   "Client Connected!");

    SetDlgItemText(hdlg,
                   LD_STATUS,
                   "Calling accept()");

    pRemAddr = (PSOCKADDR_IPX)&addr;
    addrlen = sizeof(addr);

    // Accept connection
    if ((sock = accept(SrvSock, (struct sockaddr *)pRemAddr, &addrlen)) == INVALID_SOCKET)
    {
        // accept() failed -- show status and clean up dialog
        //sprintf(outtext, "Accept() failed, error %u",WSAGetLastError());
        StringCchPrintf(outtext,128,"Accept() failed, error %u",WSAGetLastError());
        SetDlgItemText(hdlg,
                       LD_STATUS,
                       outtext);
        closesocket(SrvSock);
        WSACleanup();
        EnableWindow(GetDlgItem(hdlg, IDOK), TRUE);
        EnableWindow(GetDlgItem(hdlg, LD_SOCKET), TRUE);
        SetFocus(GetDlgItem(hdlg, LD_SOCKET));
        return(TRUE);
    }

    // We're connected!
    GetAddrString(pRemAddr, outtext);
    StringCchCat(outtext,128," connected!");

    SetDlgItemText(hdlg,
                   LD_STATUS,
                   outtext);

    EndDialog(hdlg, TRUE);          // Exit the dialog
    DeleteObject (hfontDlg);        // Drop font
    return (TRUE);
}

LRESULT MsgListenInit | ( | HWND | hdlg,
 |  | UINT | uMessage,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 176 of file Listen.c.

{

    // Create a font to use
    if(NULL == (hfontDlg = CreateFont(14, 0, 0, 0, 0, 0, 0, 0,0, 0, 0, 0,
                          VARIABLE_PITCH | FF_SWISS, "")))
        return FALSE;

    // Center the dialog over the application window
    CenterWindow (hdlg, GetWindow (hdlg, GW_OWNER));

    // Initialize Socket Addresses
    SetDlgItemText(hdlg, LD_SOCKET, szListenSocket);

    // Limit input to proper size strings
    SendDlgItemMessage(hdlg, LD_SOCKET, EM_LIMITTEXT, 4, 0);

    return (TRUE);
}

Variable Documentation

CMDI cmdiListen
Initial value:
{
    sizeof(rgcmdListen) / sizeof(CMD),
    rgcmdListen,
    edwpNone
}

Definition at line 60 of file Listen.c.

HFONT hfontDlg

Definition at line 70 of file Listen.c.

MSDI msdiListen
Initial value:
{
    sizeof(rgmsdListen) / sizeof(MSD),
    rgmsdListen,
    edwpNone
}

Definition at line 46 of file Listen.c.

CMD rgcmdListen[]
Initial value:
{
    {IDOK,     CmdListenNow},
    {IDCANCEL, CmdListenDone}
}

Definition at line 54 of file Listen.c.

MSD rgmsdListen[]
Initial value:
{
    {WM_COMMAND,    MsgListenCommand},
    {WM_INITDIALOG, MsgListenInit},
    {LDM_CONNECTED, MsgListenConnected}
}

Definition at line 39 of file Listen.c.

Generated on Wed Nov 13 2024 16:54:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/IpxChat/Misc.c File Reference

  • NetDS
  • WinSock
  • IpxChat
Functions

Misc.c File Reference

#include "globals.h"
#include <windows.h>
#include <windowsx.h>

Go to the source code of this file.

Functions

void | AtoH (char *src, char *dest, int destlen)
unsigned char | BtoH (char ch)
BOOL | CenterWindow (HWND hwndChild, HWND hwndParent)
void | CleanUp (void)
void | GetAddrString (PSOCKADDR_IPX pSAddr, char *dest)
LPTSTR | GetStringRes (int id)
void | HtoA (char *src, char *dest, int srclen)
char | HtoB (UCHAR ch)
BOOL | ReceiveInBox (HWND hWnd, WPARAM uParam, LPARAM lParam, char *szRBuf, int cRBufLen)
void | SendOutBox (char *szSBuf, int cSBufLen)

Function Documentation

void AtoH | ( | char * | src,
 |  | char * | dest,
 |  | int | destlen
 | ) |  |

Definition at line 207 of file Misc.c.

{
    char * srcptr;

    srcptr = src;

    while(destlen--)
    {
        *dest = BtoH(*srcptr++) << 4;    // Put 1st ascii byte in upper nibble.
        *dest++ += BtoH(*srcptr++);      // Add 2nd ascii byte to above.
    }
}

unsigned char BtoH ( char ch )

Definition at line 237 of file Misc.c.

{
    if (ch >= '0' && ch <= '9') return (ch - '0');        // Handle numerals
    if (ch >= 'A' && ch <= 'F') return (ch - 'A' + 0xA);  // Handle capitol hex digits
    if (ch >= 'a' && ch <= 'f') return (ch - 'a' + 0xA);  // Handle small hex digits
    return(255);
}

BOOL CenterWindow | ( | HWND | hwndChild,
 |  | HWND | hwndParent
 | ) |  |

Definition at line 53 of file Misc.c.

{
    RECT    rcChild, rcParent;
    int     cxChild, cyChild, cxParent, cyParent;
    int     cxScreen, cyScreen, xNew, yNew;
    HDC     hdc;

    // Get the Height and Width of the child window
    if(!GetWindowRect(hwndChild, &rcChild))
        return FALSE;
    cxChild = rcChild.right - rcChild.left;
    cyChild = rcChild.bottom - rcChild.top;

    // Get the Height and Width of the parent window
    if(!GetWindowRect(hwndParent, &rcParent))
        return FALSE;
    cxParent = rcParent.right - rcParent.left;
    cyParent = rcParent.bottom - rcParent.top;

    // Get the display limits
    if(NULL == (hdc = GetDC(hwndChild)))
        return FALSE;
    cxScreen = GetDeviceCaps(hdc, HORZRES);
    cyScreen = GetDeviceCaps(hdc, VERTRES);
    if(0 == ReleaseDC(hwndChild, hdc))
        return FALSE;

    // Calculate new X position, then adjust for screen
    xNew = rcParent.left + ((cxParent - cxChild) / 2);
    if (xNew < 0)
    {
        xNew = 0;
    }
    else if ((xNew + cxChild) > cxScreen)
    {
        xNew = cxScreen - cxChild;
    }

    // Calculate new Y position, then adjust for screen
    yNew = rcParent.top  + ((cyParent - cyChild) / 2);
    if (yNew < 0)
    {
        yNew = 0;
    }
    else if ((yNew + cyChild) > cyScreen)
    {
        yNew = cyScreen - cyChild;
    }

    // Set it, and return
    return SetWindowPos(hwndChild,
                        NULL,
                        xNew, yNew,
                        0, 0,
                        SWP_NOSIZE | SWP_NOZORDER);
}

void CleanUp ( void )

Definition at line 256 of file Misc.c.

{
    if(INVALID_SOCKET != SrvSock)
    {
        closesocket(SrvSock);  // Close our server side socket
        SrvSock = INVALID_SOCKET;
    }
    if (INVALID_SOCKET != sock)
    {
        closesocket(sock);     // Close our connection specific socket
        sock = INVALID_SOCKET;
    }
    WSACleanup();          // Nix the DLL
}

void GetAddrString | ( | PSOCKADDR_IPX | pSAddr,
 |  | char * | dest
 | ) |  |

Definition at line 288 of file Misc.c.

{
    char abuf[15];                                // temp buffer
    char * currptr;                               // temp destination pointer
    int saddrlen = sizeof(struct sockaddr_ipx);   // sizeof address struc

    currptr = dest; // initialize destination pointer

    HtoA((char *)&pSAddr->sa_netnum, abuf, 4);    // convert network number
    StringCchCopy(currptr,15,abuf);
    currptr += 8;
    StringCchCat(currptr,18,".");                   // don't forget seperator
    currptr++;

    HtoA((char *)&pSAddr->sa_nodenum, abuf, 6);   // convert node number
    StringCchCat(currptr,18,abuf);
    currptr += 12;
    StringCchCat(currptr,18,".");                          // seperator
    currptr++;

    HtoA((char *)&pSAddr->sa_socket, abuf, 2);    // convert socket number
    StringCchCat(currptr,18,abuf);

}

LPTSTR GetStringRes ( int id )

Definition at line 380 of file Misc.c.

{
  static TCHAR buffer[MAX_PATH];

  buffer[0]=0;
  LoadString (GetModuleHandle (NULL), id, buffer, MAX_PATH);
  return buffer;
}

void HtoA | ( | char * | src,
 |  | char * | dest,
 |  | int | srclen
 | ) |  |

Definition at line 329 of file Misc.c.

{
    char * destptr; // temp pointers
    UCHAR * srcptr;

    srcptr = (UCHAR *)src;
    destptr = dest;

    while(srclen--)
    {
    *destptr++ = HtoB((UCHAR)(*srcptr >> 4));      // Convert high order nibble
    *destptr++ = HtoB((UCHAR)(*srcptr++ & 0x0F));  // Convert low order nibble
    }
    *destptr = 0;  // Null terminator
}

char HtoB ( UCHAR ch )

Definition at line 362 of file Misc.c.

{
    if (ch <= 9) return ('0' + ch);             // handle decimal values
    if (ch <= 0xf) return ('A' + ch - 10);      // handle hexidecimal specific values
    return('X');                                // Someone screwed up
}

BOOL ReceiveInBox | ( | HWND | hWnd,
 |  | WPARAM | uParam,
 |  | LPARAM | lParam,
 |  | char * | szRBuf,
 |  | int | cRBufLen
 | ) |  |

Definition at line 134 of file Misc.c.

{
    char * pRBuf;     // temp buf pointer
    int cBytesRead;   // count of bytes actually read

    if (LOWORD(lParam) == FD_CLOSE)                   // Is this a FD_CLOSE event?
    {
        SendMessage(hWnd, MW_DISCONNECTED, 0, 0);     // Yes, post message
        return(FALSE);
    }

    pRBuf = szRBuf;   // Set temp pointer
    cRBufLen--;       // Save room for null terminator

    // read socket
    if((cBytesRead = recv(sock, pRBuf, cRBufLen, 0)) != SOCKET_ERROR)
        pRBuf += cBytesRead;    // Move temp pointer to end of buffer

    *pRBuf = 0;   // Null terminate - if recv() failed, then prBuf will
                  // point to first byte of the buffer

    return (TRUE);   // We've got a buffer to display
}

void SendOutBox | ( | char * | szSBuf,
 |  | int | cSBufLen
 | ) |  |

Definition at line 173 of file Misc.c.

{
    char * pSBuf;
    int cBytesSent;

    pSBuf = szSBuf; // Set temp pointer

    while((cBytesSent = send(sock,
                             pSBuf,
                             cSBufLen,
                             0)) != SOCKET_ERROR)
    {
        pSBuf += cBytesSent;
        cSBufLen -= cBytesSent;
        if(!cSBufLen) return;
    }
}

Generated on Wed Nov 13 2024 16:54:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/IpxChat/WinMain.c File Reference

  • NetDS
  • WinSock
  • IpxChat
Functions

WinMain.c File Reference

#include "globals.h"
#include <windows.h>

Go to the source code of this file.

Functions

int APIENTRY WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

Function Documentation

int APIENTRY WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 65 of file WinMain.c.

{
    MSG msg;
    HANDLE hAccelTable;

    // Initialize application by setting up the main window.
    if (!InitApplication(hInstance, nCmdShow))
    {
        return FALSE;           // Exits if unable to initialize
    }

    if(NULL == (hAccelTable = LoadAccelerators(hInstance, szAppName)))
        return FALSE;

    // Acquire and dispatch messages until a WM_QUIT message is received.
    while (GetMessage(&msg, NULL, 0, 0))
    {
        if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
        {
            TranslateMessage(&msg);  // Translates virtual key codes
            DispatchMessage(&msg);   // Dispatches message to window
        }
    }
    return (int)msg.wParam;  // Returns the value from PostQuitMessage
}

Generated on Wed Nov 13 2024 16:54:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/LSP/asyncselect.cpp File Reference

  • NetDS
  • WinSock
  • LSP
Defines | Functions | Variables

asyncselect.cpp File Reference

#include "provider.h"
#include <windows.h>

Go to the source code of this file.

Defines

#define | ASYNC_TIMEOUT 500
#define | MAX_ASYNC_RETRIES 7
#define | PROVIDER_CLASS TEXT("Layered WS2 Provider")

Functions

HWND | GetWorkerWindow ()
int | StopAsyncWindowManager ()

Variables

HANDLE gAddContextEvent
CRITICAL_SECTION | gCriticalSection
HINSTANCE | hDllInstance

Define Documentation

#define ASYNC_TIMEOUT 500

Definition at line 30 of file asyncselect.cpp.

#define MAX_ASYNC_RETRIES 7

Definition at line 29 of file asyncselect.cpp.

#define PROVIDER_CLASS TEXT("Layered WS2 Provider")

Definition at line 27 of file asyncselect.cpp.

Function Documentation

HWND GetWorkerWindow ( )

Definition at line 84 of file asyncselect.cpp.

{
  DWORD ThreadId;

    EnterCriticalSection(&gCriticalSection);
  if (WorkerThreadHandle == NULL)
  {
    WorkerThreadHandle = CreateThread(NULL, 0, AsyncMsgHandler, NULL, 0, &ThreadId);
        if (WorkerThreadHandle)
        {
            // Wait for the window to become initialized
            while (AsyncWindow == NULL)
                SleepEx(0, TRUE);
        }
        else
        {
            dbgprint("GetWorkerWindow: CreateThread failed");
            AsyncWindow = NULL;
        }
  }
    LeaveCriticalSection(&gCriticalSection);

  return AsyncWindow;
}

int StopAsyncWindowManager ( )

Definition at line 64 of file asyncselect.cpp.

{
    if (AsyncWindow)
    {
        DestroyWindow(AsyncWindow);
        AsyncWindow = NULL;

        CloseHandle(WorkerThreadHandle);
    }
    return 0;
}

Variable Documentation

HANDLE gAddContextEvent

Definition at line 43 of file spi.cpp.

CRITICAL_SECTION gCriticalSection

Definition at line 33 of file spi.cpp.

HINSTANCE hDllInstance

Definition at line 37 of file spi.cpp.

Generated on Wed Nov 13 2024 16:54:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/LSP/extension.cpp File Reference

  • NetDS
  • WinSock
  • LSP
Functions

extension.cpp File Reference

#include "provider.h"

Go to the source code of this file.

Functions

BOOL PASCAL FAR | ExtAcceptEx (IN SOCKET sListenSocket, IN SOCKET sAcceptSocket, IN PVOID lpOutputBuffer, IN DWORD dwReceiveDataLength, IN DWORD dwLocalAddressLength, IN DWORD dwRemoteAddressLength, OUT LPDWORD lpdwBytesReceived, IN LPOVERLAPPED lpOverlapped)
BOOL PASCAL FAR | ExtConnectEx (IN SOCKET s, IN const struct sockaddr FAR *name, IN int namelen, IN PVOID lpSendBuffer OPTIONAL, IN DWORD dwSendDataLength, OUT LPDWORD lpdwBytesSent, IN LPOVERLAPPED lpOverlapped)
BOOL PASCAL FAR | ExtDisconnectEx (IN SOCKET s, IN LPOVERLAPPED lpOverlapped, IN DWORD dwFlags, IN DWORD dwReserved)
BOOL PASCAL FAR | ExtTransmitFile (IN SOCKET hSocket, IN HANDLE hFile, IN DWORD nNumberOfBytesToWrite, IN DWORD nNumberOfBytesPerSend, IN LPOVERLAPPED lpOverlapped, IN LPTRANSMIT_FILE_BUFFERS lpTransmitBuffers, IN DWORD dwFlags)
BOOL PASCAL FAR | ExtTransmitPackets (SOCKET hSocket, LPTRANSMIT_PACKETS_ELEMENT lpPacketArray, DWORD nElementCount, DWORD nSendSize, LPOVERLAPPED lpOverlapped, DWORD dwFlags)
INT PASCAL FAR | ExtWSARecvMsg (IN SOCKET s, IN OUT LPWSAMSG lpMsg, OUT LPDWORD lpdwNumberOfBytesRecvd, IN LPWSAOVERLAPPED lpOverlapped, IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
BOOL | LoadExtensionFunction (FARPROC **func, GUID ExtensionGuid, LPWSPIOCTL fnIoctl, SOCKET s)

Function Documentation

BOOL PASCAL FAR ExtAcceptEx | ( | IN SOCKET | sListenSocket,
 |  | IN SOCKET | sAcceptSocket,
 |  | IN PVOID | lpOutputBuffer,
 |  | IN DWORD | dwReceiveDataLength,
 |  | IN DWORD | dwLocalAddressLength,
 |  | IN DWORD | dwRemoteAddressLength,
 |  | OUT LPDWORD | lpdwBytesReceived,
 |  | IN LPOVERLAPPED | lpOverlapped
 | ) |  |

Definition at line 224 of file extension.cpp.

{
  LPWSAOVERLAPPEDPLUS ProviderOverlapped;
  SOCK_INFO          *ListenSocketContext=NULL,
                     *AcceptSocketContext=NULL;
  int                 Errno,
                        ret;

    //
    // Query the socket context for the listening socket
    //
    ListenSocketContext = FindAndLockSocketContext(sListenSocket, &Errno);
    if (ListenSocketContext == NULL)
    {
        dbgprint("AcceptExExt: WPUQuerySocketHandleContext "
                  "on listen socket failed: %d", Errno);
        Errno = WSAENOTSOCK;
        WSASetLastError(Errno);
    return FALSE;
    }
    //
    // Also need to query the socket context for the accept socket
    //
    AcceptSocketContext = FindAndLockSocketContext(sAcceptSocket, &Errno);
    if (AcceptSocketContext == NULL)
    {
        UnlockSocketContext(ListenSocketContext, &Errno);

        dbgprint("AcceptExExt: WPUQuerySocketHandleContext "
                  "on accept socket failed: %d", Errno);
        Errno = WSAENOTSOCK;
        WSASetLastError(Errno);
    return FALSE;
    }

    if (!ListenSocketContext->Provider->NextProcTableExt.lpfnAcceptEx)
    {
        GUID    guidAcceptEx = WSAID_ACCEPTEX;

        if (LoadExtensionFunction(
                (FARPROC **)&ListenSocketContext->Provider->NextProcTableExt.lpfnAcceptEx,
                guidAcceptEx,
                ListenSocketContext->Provider->NextProcTable.lpWSPIoctl,
                ListenSocketContext->ProviderSocket
                ) == FALSE)
        {
            UnlockSocketContext(ListenSocketContext, &Errno);
            UnlockSocketContext(AcceptSocketContext, &Errno);

            dbgprint("Lower provider AcceptEx == NULL!");
            WSASetLastError(WSAEFAULT);
            return FALSE;
        }
    }

  // Check for overlapped I/O

  if (lpOverlapped)
  {
    ProviderOverlapped = GetOverlappedStructure(ListenSocketContext);
        if (!ProviderOverlapped)
        {
            UnlockSocketContext(ListenSocketContext, &Errno);
            UnlockSocketContext(AcceptSocketContext, &Errno);

            dbgprint("ExtAcceptEx: GetOverlappedStructre() returne NULL!");
            WSASetLastError(WSAENOBUFS);
            return FALSE;
        }

        // Verify the event is valid
        __try {
            if ( lpOverlapped->hEvent != NULL )
            {
                ret = ResetEvent((HANDLE)((ULONG_PTR)lpOverlapped->hEvent & ~EventMask));
                if (ret == 0)
                {
                    // Return to original state and indicate error
                    (ListenSocketContext->dwOutstandingAsync)--;

                    UnlockSocketContext(ListenSocketContext, &Errno);
                    UnlockSocketContext(AcceptSocketContext, &Errno);

                    PutbackOverlappedStructure(ProviderOverlapped);
                    WSASetLastError(ERROR_INVALID_HANDLE);
                    return FALSE;
                }
            }
            CopyOffset(&ProviderOverlapped->ProviderOverlapped, lpOverlapped);
            ProviderOverlapped->AcceptExArgs.dwBytesReceived = (lpdwBytesReceived ? *lpdwBytesReceived : 0);
        }
        __except(EXCEPTION_EXECUTE_HANDLER)
        {
            // Return to original state and indicate error
            (ListenSocketContext->dwOutstandingAsync)--;

            UnlockSocketContext(ListenSocketContext, &Errno);
            UnlockSocketContext(AcceptSocketContext, &Errno);

            PutbackOverlappedStructure(ProviderOverlapped);
            WSASetLastError(WSAEFAULT);
            return FALSE;
        }
        //
        // Save off the paramters and initalize the overlapped structure
        //
        ProviderOverlapped->lpCallerOverlapped = lpOverlapped;
        ProviderOverlapped->SockInfo           = ListenSocketContext;
        ProviderOverlapped->CallerSocket       = sListenSocket;
        ProviderOverlapped->ProviderSocket     = ListenSocketContext->ProviderSocket;
        ProviderOverlapped->Error              = NO_ERROR;
        ProviderOverlapped->Operation          = LSP_OP_ACCEPTEX;
        ProviderOverlapped->lpCallerCompletionRoutine          = NULL;
        ProviderOverlapped->AcceptExArgs.sAcceptSocket         = sAcceptSocket;
        ProviderOverlapped->AcceptExArgs.sProviderAcceptSocket = AcceptSocketContext->ProviderSocket;
        ProviderOverlapped->AcceptExArgs.lpOutputBuffer        = lpOutputBuffer;
        ProviderOverlapped->AcceptExArgs.dwReceiveDataLength   = dwReceiveDataLength;
        ProviderOverlapped->AcceptExArgs.dwLocalAddressLength  = dwLocalAddressLength;
        ProviderOverlapped->AcceptExArgs.dwRemoteAddressLength = dwRemoteAddressLength;
        ProviderOverlapped->Provider = AcceptSocketContext->Provider;

        ret = QueueOverlappedOperation(ProviderOverlapped, ListenSocketContext);

        if (ret != NO_ERROR)
        {
            WSASetLastError(ret);
            ret = FALSE;
        }
        else
        {
            ret = TRUE;
        }
  }
  else
  {
    ret = ListenSocketContext->Provider->NextProcTableExt.lpfnAcceptEx(
      ListenSocketContext->ProviderSocket,
      AcceptSocketContext->ProviderSocket,
      lpOutputBuffer,
      dwReceiveDataLength,
      dwLocalAddressLength,
      dwRemoteAddressLength,
      lpdwBytesReceived,
      NULL);
  }

    UnlockSocketContext(ListenSocketContext, &Errno);
    UnlockSocketContext(AcceptSocketContext, &Errno);

    return ret;
}

BOOL PASCAL FAR ExtConnectEx | ( | IN SOCKET | s,
 |  | IN const struct sockaddr FAR * | name,
 |  | IN int | namelen,
 |  | IN PVOID lpSendBuffer | OPTIONAL,
 |  | IN DWORD | dwSendDataLength,
 |  | OUT LPDWORD | lpdwBytesSent,
 |  | IN LPOVERLAPPED | lpOverlapped
 | ) |  |

Definition at line 393 of file extension.cpp.

{
    SOCK_INFO           *SocketContext=NULL;
    LPWSAOVERLAPPEDPLUS  ProviderOverlapped=NULL;
    int                  Errno,
                         ret;

    // Get the context
    SocketContext = FindAndLockSocketContext(s, &Errno);
    if (SocketContext == NULL)
    {
        dbgprint("ExtConnectEx: WPUQuerySocketHandleContext() failed: %d", Errno);
        return FALSE;
    }

    // Verify the function pointer is correct
    if (!SocketContext->Provider->NextProcTableExt.lpfnConnectEx)
    {
        GUID    guidConnectEx = WSAID_CONNECTEX;

        if (LoadExtensionFunction(
                (FARPROC **)&SocketContext->Provider->NextProcTableExt.lpfnConnectEx,
                guidConnectEx,
                SocketContext->Provider->NextProcTable.lpWSPIoctl,
                SocketContext->ProviderSocket
                ) == FALSE)
        {
            UnlockSocketContext(SocketContext, &Errno);

            dbgprint("Next proc table ConnectEx == NULL!");
            WSASetLastError(WSAEFAULT);
            return FALSE;
        }
    }

    // Check for overlapped I/O

    if (lpOverlapped)
    {
        ProviderOverlapped = GetOverlappedStructure(SocketContext);
        if (!ProviderOverlapped)
        {
            UnlockSocketContext(SocketContext, &Errno);

            dbgprint("ExtConnectEx: GetOverlappedStructure() returned NULL");
            WSASetLastError(WSAENOBUFS);
            return FALSE;
        }
        //
        // Save off the arguments and setup the overlapped structure
        //
        // Also reset the event handle if present
        //
        __try {
            if ( lpOverlapped->hEvent != NULL )
            {
                ret = ResetEvent((HANDLE)((ULONG_PTR)lpOverlapped->hEvent & ~EventMask));
                if (ret == 0)
                {
                    // Return to original state and indicate error
                    (SocketContext->dwOutstandingAsync)--;
                    UnlockSocketContext(SocketContext, &Errno);
                    PutbackOverlappedStructure(ProviderOverlapped);
                    WSASetLastError(ERROR_INVALID_HANDLE);
                    return FALSE;
                }
            }
            CopyOffset(&ProviderOverlapped->ProviderOverlapped, lpOverlapped);
            if (namelen <= sizeof(ProviderOverlapped->ConnectExArgs.name))
                CopyMemory(&ProviderOverlapped->ConnectExArgs.name, name, namelen);
            ProviderOverlapped->ConnectExArgs.dwBytesSent = (lpdwBytesSent ? *lpdwBytesSent : 0);
        }
        __except(EXCEPTION_EXECUTE_HANDLER)
        {
            (SocketContext->dwOutstandingAsync)--;
            UnlockSocketContext(SocketContext, &Errno);
            PutbackOverlappedStructure(ProviderOverlapped);
            WSASetLastError(WSAEFAULT);
            return FALSE;
        }

        ProviderOverlapped->lpCallerOverlapped = lpOverlapped;
        ProviderOverlapped->SockInfo           = SocketContext;
        ProviderOverlapped->CallerSocket       = s;
        ProviderOverlapped->ProviderSocket     = SocketContext->ProviderSocket;
        ProviderOverlapped->Error              = NO_ERROR;
        ProviderOverlapped->Operation          = LSP_OP_CONNECTEX;
        ProviderOverlapped->lpCallerCompletionRoutine      = NULL;
        ProviderOverlapped->ConnectExArgs.s                = s;
        ProviderOverlapped->ConnectExArgs.namelen          = namelen;
        ProviderOverlapped->ConnectExArgs.lpSendBuffer     = lpSendBuffer;
        ProviderOverlapped->ConnectExArgs.dwSendDataLength = dwSendDataLength;
        ProviderOverlapped->Provider           = SocketContext->Provider;

        ret = QueueOverlappedOperation(ProviderOverlapped, SocketContext);

        if (ret != NO_ERROR)
        {
            WSASetLastError(ret);
            ret = FALSE;
        }
        else
        {
            ret = TRUE;
        }
    }
    else
    {
        ret = SocketContext->Provider->NextProcTableExt.lpfnConnectEx(
            SocketContext->ProviderSocket,
            name,
            namelen,
            lpSendBuffer,
            dwSendDataLength,
            lpdwBytesSent,
            NULL);
    }
    UnlockSocketContext(SocketContext, &Errno);

    return ret;
}

BOOL PASCAL FAR ExtDisconnectEx | ( | IN SOCKET | s,
 |  | IN LPOVERLAPPED | lpOverlapped,
 |  | IN DWORD | dwFlags,
 |  | IN DWORD | dwReserved
 | ) |  |

Definition at line 663 of file extension.cpp.

{
    SOCK_INFO           *SocketContext=NULL;
    LPWSAOVERLAPPEDPLUS  ProviderOverlapped=NULL;
    int                  Errno,
                         ret;

    // Get the context
    SocketContext = FindAndLockSocketContext(s, &Errno);
    if (SocketContext == NULL)
    {
        dbgprint("ExtDisconnectEx: WPUQuerySocketHandleContext() failed: %d", Errno);
        WSASetLastError(Errno);
        return FALSE;
    }

    // Make sure we already have the extension function
    if (!SocketContext->Provider->NextProcTableExt.lpfnDisconnectEx)
    {
        GUID    guidDisconnectEx = WSAID_DISCONNECTEX;

        if (LoadExtensionFunction(
                 (FARPROC **)&SocketContext->Provider->NextProcTableExt.lpfnDisconnectEx,
                 guidDisconnectEx,
                 SocketContext->Provider->NextProcTable.lpWSPIoctl,
                 SocketContext->ProviderSocket
                 ) == NULL)
        {
            UnlockSocketContext(SocketContext, &Errno);
            dbgprint("Next proc table DisconnectEx == NULL!");
            WSASetLastError(WSAEFAULT);
            return FALSE;
        }
    }

    // Check for overlapped I/O

    if (lpOverlapped)
    {
        ProviderOverlapped = GetOverlappedStructure(SocketContext);
        if (!ProviderOverlapped)
        {
            UnlockSocketContext(SocketContext, &Errno);
            dbgprint("ExtDisconnectEx: GetOverlappedStructure() returned NULL");
            WSASetLastError(WSAENOBUFS);
            return FALSE;
        }
        //
        // Save off the arguments and setup the overlapped structure
        //
        // Verify the event is valid
        //
        __try {
            if ( lpOverlapped->hEvent != NULL )
            {
                ret = ResetEvent((HANDLE)((ULONG_PTR)lpOverlapped->hEvent & ~EventMask));
                if (ret == 0)
                {
                    (SocketContext->dwOutstandingAsync)--;
                    PutbackOverlappedStructure(ProviderOverlapped);
                    UnlockSocketContext(SocketContext, &Errno);
                    WSASetLastError(ERROR_INVALID_HANDLE);
                    return FALSE;
                }
            }
            CopyOffset(&ProviderOverlapped->ProviderOverlapped, lpOverlapped);
        }
        __except(EXCEPTION_EXECUTE_HANDLER)
        {
            (SocketContext->dwOutstandingAsync)--;
            PutbackOverlappedStructure(ProviderOverlapped);
            UnlockSocketContext(SocketContext, &Errno);
            WSASetLastError(WSAEFAULT);
            return FALSE;
        }

        ProviderOverlapped->lpCallerOverlapped = lpOverlapped;
        ProviderOverlapped->SockInfo           = SocketContext;
        ProviderOverlapped->CallerSocket       = s;
        ProviderOverlapped->ProviderSocket     = SocketContext->ProviderSocket;
        ProviderOverlapped->Error              = NO_ERROR;
        ProviderOverlapped->Operation          = LSP_OP_DISCONNECTEX;
        ProviderOverlapped->lpCallerCompletionRoutine           = NULL;
        ProviderOverlapped->DisconnectExArgs.s                  = s;
        ProviderOverlapped->DisconnectExArgs.dwFlags            = dwFlags;
        ProviderOverlapped->DisconnectExArgs.dwReserved         = dwReserved;
        ProviderOverlapped->Provider           = SocketContext->Provider;

        ret = QueueOverlappedOperation(ProviderOverlapped, SocketContext);

        if (ret != NO_ERROR)
        {
            WSASetLastError(ret);
            ret = FALSE;
        }
        else
        {
            ret = TRUE;
        }
    }
    else
    {
        ret = SocketContext->Provider->NextProcTableExt.lpfnDisconnectEx(
            SocketContext->ProviderSocket,
            lpOverlapped,
            dwFlags,
            dwReserved);
    }
    UnlockSocketContext(SocketContext, &Errno);

    return ret;
}

BOOL PASCAL FAR ExtTransmitFile | ( | IN SOCKET | hSocket,
 |  | IN HANDLE | hFile,
 |  | IN DWORD | nNumberOfBytesToWrite,
 |  | IN DWORD | nNumberOfBytesPerSend,
 |  | IN LPOVERLAPPED | lpOverlapped,
 |  | IN LPTRANSMIT_FILE_BUFFERS | lpTransmitBuffers,
 |  | IN DWORD | dwFlags
 | ) |  |

Definition at line 90 of file extension.cpp.

{
  SOCK_INFO          *SocketContext;
  LPWSAOVERLAPPEDPLUS ProviderOverlapped;
  int                 Errno,
                        ret;

    // Get the context
    SocketContext = FindAndLockSocketContext(hSocket, &Errno);
    if (SocketContext == NULL)
    {
        dbgprint("ExtTransmitFile: WPUQuerySocketHandleContext() failed: %d", Errno);
        WSASetLastError(Errno);
    return FALSE;
    }

    // Make sure we already have the extension function
    if (!SocketContext->Provider->NextProcTableExt.lpfnTransmitFile)
    {
        GUID    guidTransmitFile = WSAID_TRANSMITFILE;

        if (LoadExtensionFunction(
                (FARPROC **)&SocketContext->Provider->NextProcTableExt.lpfnTransmitFile,
                guidTransmitFile,
                SocketContext->Provider->NextProcTable.lpWSPIoctl,
                SocketContext->ProviderSocket
                ) == FALSE)
        {
            UnlockSocketContext(SocketContext, &Errno);
            dbgprint("Next proc table TransmitFile == NULL!");
            WSASetLastError(WSAEFAULT);
            return FALSE;
        }
    }

  // Check for overlapped I/O

  if (lpOverlapped)
  {
    ProviderOverlapped = GetOverlappedStructure(SocketContext);
        if (!ProviderOverlapped)
        {
            UnlockSocketContext(SocketContext, &Errno);
            dbgprint("ExtTransmitFile: GetOverlappedStructure() returned NULL!");
            WSASetLastError(WSAENOBUFS);
            return FALSE;
        }
        // Verify the event is valid
        __try {
            if ( lpOverlapped->hEvent != NULL )
            {
                ret = ResetEvent((HANDLE)((ULONG_PTR)lpOverlapped->hEvent & ~EventMask));
                if (ret == 0)
                {
                    // Return to original state and indicate error
                    (SocketContext->dwOutstandingAsync)--;
                    UnlockSocketContext(SocketContext, &Errno);
                    PutbackOverlappedStructure(ProviderOverlapped);
                    WSASetLastError(ERROR_INVALID_HANDLE);
                    return FALSE;
                }
            }
            CopyOffset(&ProviderOverlapped->ProviderOverlapped, lpOverlapped);
        }
        __except(EXCEPTION_EXECUTE_HANDLER)
        {
            // Return to original state and indicate error
            (SocketContext->dwOutstandingAsync)--;
            UnlockSocketContext(SocketContext, &Errno);
            PutbackOverlappedStructure(ProviderOverlapped);
            WSASetLastError(WSAEFAULT);
            return FALSE;
        }
        //
        // Save off the arguments and setup the overlapped structure
        //
        ProviderOverlapped->lpCallerOverlapped = lpOverlapped;
        ProviderOverlapped->SockInfo           = SocketContext;
        ProviderOverlapped->CallerSocket       = hSocket;
        ProviderOverlapped->ProviderSocket     = SocketContext->ProviderSocket;
        ProviderOverlapped->Error              = NO_ERROR;
        ProviderOverlapped->Operation          = LSP_OP_TRANSMITFILE;
        ProviderOverlapped->lpCallerCompletionRoutine              = NULL;
        ProviderOverlapped->TransmitFileArgs.hFile                 = hFile;
        ProviderOverlapped->TransmitFileArgs.nNumberOfBytesToWrite = nNumberOfBytesToWrite;
        ProviderOverlapped->TransmitFileArgs.nNumberOfBytesPerSend = nNumberOfBytesPerSend;
        ProviderOverlapped->TransmitFileArgs.lpTransmitBuffers     = lpTransmitBuffers;
        ProviderOverlapped->TransmitFileArgs.dwFlags               = dwFlags;
        ProviderOverlapped->Provider = SocketContext->Provider;

        ret = QueueOverlappedOperation(ProviderOverlapped, SocketContext);

        if (ret != NO_ERROR)
        {
            WSASetLastError(ret);
            ret = FALSE;
        }
        else
        {
            ret = TRUE;
        }
  }
  else
  {
    ret = SocketContext->Provider->NextProcTableExt.lpfnTransmitFile(
      SocketContext->ProviderSocket,
      hFile,
      nNumberOfBytesToWrite,
      nNumberOfBytesPerSend,
      NULL,
      lpTransmitBuffers,
      dwFlags);
  }

    UnlockSocketContext(SocketContext, &Errno);

    return ret;
}

BOOL PASCAL FAR ExtTransmitPackets | ( | SOCKET | hSocket,
 |  | LPTRANSMIT_PACKETS_ELEMENT | lpPacketArray,
 |  | DWORD | nElementCount,
 |  | DWORD | nSendSize,
 |  | LPOVERLAPPED | lpOverlapped,
 |  | DWORD | dwFlags
 | ) |  |

Definition at line 530 of file extension.cpp.

{
    SOCK_INFO           *SocketContext=NULL;
    LPWSAOVERLAPPEDPLUS  ProviderOverlapped=NULL;
    int                  Errno,
                         ret;

    // Get the context
    SocketContext = FindAndLockSocketContext(hSocket, &Errno);
    if (SocketContext == NULL)
    {
        dbgprint("ExtTransmitPackets: WPUQuerySocketHandleContext() failed: %d", Errno);
        WSASetLastError(Errno);
        return FALSE;
    }

    // Make sure we already have the extension function
    if (!SocketContext->Provider->NextProcTableExt.lpfnTransmitPackets)
    {
        GUID    guidTransmitPackets = WSAID_TRANSMITPACKETS;

        if (LoadExtensionFunction(
                (FARPROC **)&SocketContext->Provider->NextProcTableExt.lpfnTransmitPackets,
                guidTransmitPackets,
                SocketContext->Provider->NextProcTable.lpWSPIoctl,
                SocketContext->ProviderSocket
                ) == FALSE)
        {
            UnlockSocketContext(SocketContext, &Errno);
            dbgprint("Next proc table TransmitPackets == NULL!");
            WSASetLastError(WSAEFAULT);
            return FALSE;
        }
    }
    //
    // Check for overlapped I/O
    //
    if (lpOverlapped)
    {
        ProviderOverlapped = GetOverlappedStructure(SocketContext);
        if (!ProviderOverlapped)
        {
            UnlockSocketContext(SocketContext, &Errno);
            dbgprint("ExtTransmitPackets: GetOverlappedStructure() returned NULL");
            WSASetLastError(WSAENOBUFS);
            return FALSE;
        }
        //
        // Save off the arguments and setup the overlapped structure
        //
        // Verify the event is valid
        //
        __try {
            if ( lpOverlapped->hEvent != NULL )
            {
                ret = ResetEvent((HANDLE)((ULONG_PTR)lpOverlapped->hEvent & ~EventMask));
                if (ret == 0)
                {
                    // Return to original state and indicate error
                    (SocketContext->dwOutstandingAsync)--;
                    UnlockSocketContext(SocketContext, &Errno);
                    PutbackOverlappedStructure(ProviderOverlapped);
                    WSASetLastError(ERROR_INVALID_HANDLE);
                    return FALSE;
                }
            }
            CopyOffset(&ProviderOverlapped->ProviderOverlapped, lpOverlapped);
        }
        __except(EXCEPTION_EXECUTE_HANDLER)
        {
            // Return to original state and indicate error
            (SocketContext->dwOutstandingAsync)--;
            UnlockSocketContext(SocketContext, &Errno);
            PutbackOverlappedStructure(ProviderOverlapped);
            WSASetLastError(WSAEFAULT);
            return FALSE;
        }
        ProviderOverlapped->lpCallerOverlapped = lpOverlapped;
        ProviderOverlapped->SockInfo           = SocketContext;
        ProviderOverlapped->CallerSocket       = hSocket;
        ProviderOverlapped->ProviderSocket     = SocketContext->ProviderSocket;
        ProviderOverlapped->Error              = NO_ERROR;
        ProviderOverlapped->Operation          = LSP_OP_TRANSMITPACKETS;
        ProviderOverlapped->lpCallerCompletionRoutine           = NULL;
        ProviderOverlapped->TransmitPacketsArgs.s               = hSocket;
        ProviderOverlapped->TransmitPacketsArgs.lpPacketArray   = lpPacketArray;
        ProviderOverlapped->TransmitPacketsArgs.nElementCount   = nElementCount;
        ProviderOverlapped->TransmitPacketsArgs.nSendSize       = nSendSize;
        ProviderOverlapped->TransmitPacketsArgs.dwFlags         = dwFlags;
        ProviderOverlapped->Provider           = SocketContext->Provider;

        ret = QueueOverlappedOperation(ProviderOverlapped, SocketContext);

        if (ret != NO_ERROR)
        {
            WSASetLastError(ret);
            ret = FALSE;
        }
        else
        {
            ret = TRUE;
        }

    }
    else
    {
        ret = SocketContext->Provider->NextProcTableExt.lpfnTransmitPackets(
            SocketContext->ProviderSocket,
            lpPacketArray,
            nElementCount,
            nSendSize,
            NULL,
            dwFlags);
    }
    UnlockSocketContext(SocketContext, &Errno);

    return ret;
}

INT PASCAL FAR ExtWSARecvMsg | ( | IN SOCKET | s,
 |  | IN OUT LPWSAMSG | lpMsg,
 |  | OUT LPDWORD | lpdwNumberOfBytesRecvd,
 |  | IN LPWSAOVERLAPPED | lpOverlapped,
 |  | IN LPWSAOVERLAPPED_COMPLETION_ROUTINE | lpCompletionRoutine
 | ) |  |

Definition at line 789 of file extension.cpp.

{
    SOCK_INFO           *SocketContext=NULL;
    LPWSAOVERLAPPEDPLUS  ProviderOverlapped=NULL;
    int                  Errno,
                         ret = NO_ERROR;

    // Get the context
    SocketContext = FindAndLockSocketContext(s, &Errno);
    if (SocketContext == NULL)
    {
        dbgprint("ExtWSARecvmsg: WPUQuerySocketHandleContext() failed: %d", Errno);
        WSASetLastError(Errno);
        return SOCKET_ERROR;
    }

    // Make sure we already have the extension function
    if (!SocketContext->Provider->NextProcTableExt.lpfnWSARecvMsg)
    {
        GUID    guidWSARecvMsg = WSAID_WSARECVMSG;

        if (LoadExtensionFunction(
                (FARPROC **)&SocketContext->Provider->NextProcTableExt.lpfnWSARecvMsg,
                guidWSARecvMsg,
                SocketContext->Provider->NextProcTable.lpWSPIoctl,
                SocketContext->ProviderSocket
                ) == FALSE)
        {
            UnlockSocketContext(SocketContext, &Errno);
            dbgprint("Next proc table WSARecvMsg == NULL!");
            WSASetLastError(WSAEFAULT);
            return SOCKET_ERROR;
        }
    }
    //
    // Check for overlapped I/O
    //
    if (lpOverlapped)
    {
        ProviderOverlapped = GetOverlappedStructure(SocketContext);
        if (!ProviderOverlapped)
        {
            UnlockSocketContext(SocketContext, &Errno);
            dbgprint("ExtWSARecvMsg: GetOverlappedStructure() returned NULL");
            WSASetLastError(WSAENOBUFS);
            return SOCKET_ERROR;
        }
        //
        // Save off the arguments and setup the overlapped structure
        //
        __try {
            if (( lpCompletionRoutine == NULL ) && ( lpOverlapped->hEvent != NULL ))
            {
                // Verify the event is valid
                ret = ResetEvent((HANDLE)((ULONG_PTR)lpOverlapped->hEvent & ~EventMask));
                if (ret == 0)
                {
                    // Return to original state and indicate error
                    (SocketContext->dwOutstandingAsync)--;
                    UnlockSocketContext(SocketContext, &Errno);
                    PutbackOverlappedStructure(ProviderOverlapped);
                    WSASetLastError(ERROR_INVALID_HANDLE);
                    return SOCKET_ERROR;
                }
            }
            CopyOffset(&ProviderOverlapped->ProviderOverlapped, lpOverlapped);
            ProviderOverlapped->WSARecvMsgArgs.dwNumberOfBytesRecvd = (lpdwNumberOfBytesRecvd ? *lpdwNumberOfBytesRecvd : 0);
        }
        __except(EXCEPTION_EXECUTE_HANDLER)
        {
            // Return to original state and indicate error
            (SocketContext->dwOutstandingAsync)--;
            UnlockSocketContext(SocketContext, &Errno);
            PutbackOverlappedStructure(ProviderOverlapped);
            WSASetLastError(WSAEFAULT);
            return SOCKET_ERROR;
        }
        ProviderOverlapped->lpCallerOverlapped = lpOverlapped;
        ProviderOverlapped->SockInfo           = SocketContext;
        ProviderOverlapped->CallerSocket       = s;
        ProviderOverlapped->ProviderSocket     = SocketContext->ProviderSocket;
        ProviderOverlapped->Error              = NO_ERROR;
        ProviderOverlapped->Operation          = LSP_OP_WSARECVMSG;
        ProviderOverlapped->lpCallerCompletionRoutine           = lpCompletionRoutine;
        ProviderOverlapped->WSARecvMsgArgs.s                    = s;
        ProviderOverlapped->WSARecvMsgArgs.lpMsg                = lpMsg;
        ProviderOverlapped->Provider           = SocketContext->Provider;

        ret = QueueOverlappedOperation(ProviderOverlapped, SocketContext);

        if (ret != NO_ERROR)
        {
            WSASetLastError(ret);
            ret = SOCKET_ERROR;
        }
        else
        {
            ret = NO_ERROR;
        }
    }
    else
    {
        ret = SocketContext->Provider->NextProcTableExt.lpfnWSARecvMsg(
            SocketContext->ProviderSocket,
            lpMsg,
            lpdwNumberOfBytesRecvd,
            NULL,
            NULL);
    }

    UnlockSocketContext(SocketContext, &Errno);

    return ret;
}

BOOL LoadExtensionFunction | ( | FARPROC ** | func,
 |  | GUID | ExtensionGuid,
 |  | LPWSPIOCTL | fnIoctl,
 |  | SOCKET | s
 | ) |  |

Definition at line 44 of file extension.cpp.

{
    DWORD   dwBytes;
    int     rc,
            error;

    // Use the lower provider's WSPIoctl to load the extension function
    rc = fnIoctl(
            s,
            SIO_GET_EXTENSION_FUNCTION_POINTER,
           &ExtensionGuid,
            sizeof(GUID),
            func,
            sizeof(FARPROC),
           &dwBytes,
            NULL,
            NULL,
            NULL,
           &error
            );
    if (rc == SOCKET_ERROR)
    {
        dbgprint("LoadExtensionFunction: WSAIoctl (SIO_GET_EXTENSION_FUNCTION) failed: %d",
            error);

        return FALSE;
    }
    else
    {
        return TRUE;
    }
}

Generated on Wed Nov 13 2024 16:54:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/LSP/install.h File Reference

  • NetDS
  • WinSock
  • LSP
Enumerations | Functions | Variables

install.h File Reference

#include <ws2spi.h>

Go to the source code of this file.

Enumerations

enum | WINSOCK_CATALOG { LspCatalogBoth = 0, LspCatalog32Only, LspCatalog64Only }

Functions

LPWSAPROTOCOL_INFOW | EnumerateProviders (WINSOCK_CATALOG Catalog, LPINT TotalProtocols)
void | FreeProviders (LPWSAPROTOCOL_INFOW ProtocolInfo)
void | PrintProtocolInfo (WSAPROTOCOL_INFOW *ProtocolInfo)

Variables

GUID | ProviderGuid
WCHAR * | ProviderPath

Enumeration Type Documentation

enum WINSOCK_CATALOG
Enumerator:
LspCatalogBoth
LspCatalog32Only
LspCatalog64Only

Definition at line 36 of file install.h.

{
    LspCatalogBoth = 0,
    LspCatalog32Only,
    LspCatalog64Only
} WINSOCK_CATALOG;

Function Documentation

LPWSAPROTOCOL_INFOW EnumerateProviders | ( | WINSOCK_CATALOG | Catalog,
 |  | LPINT | TotalProtocols
 | ) |  |

Definition at line 38 of file provider.cpp.

{
  LPWSAPROTOCOL_INFOW ProtocolInfo = NULL;
  DWORD               ProtocolInfoSize = 0;
  INT                 ErrorCode,
                        rc;

    if (TotalProtocols == NULL)
        return NULL;

  *TotalProtocols = 0;

#ifdef _WIN64
  // Find out how many entries we need to enumerate
    if (Catalog == LspCatalog64Only)
    {
        // Find the size of the buffer
        rc = WSCEnumProtocols(NULL, ProtocolInfo, &ProtocolInfoSize, &ErrorCode);
        if (rc == SOCKET_ERROR)
        {
            if (ErrorCode != WSAENOBUFS)
                return NULL;
        }

        // Allocate the buffer
        ProtocolInfo = (LPWSAPROTOCOL_INFOW) HeapAlloc(GetProcessHeap(), 0, ProtocolInfoSize);
        if (ProtocolInfo == NULL)
        {
            return NULL;
        }

        // Enumerate the catalog for real
        rc = WSCEnumProtocols(NULL, ProtocolInfo, &ProtocolInfoSize, &ErrorCode);
        if (rc == SOCKET_ERROR)
        {
            HeapFree(GetProcessHeap(), 0, ProtocolInfo);
            return NULL;
        }

        // Update the count
        *TotalProtocols = rc;
    }
    else if (Catalog == LspCatalog32Only)
    {
        HMODULE            hModule;
        LPWSCENUMPROTOCOLS fnWscEnumProtocols32=NULL;

        // Load ws2_32.dll
        hModule = LoadLibrary(TEXT("ws2_32.dll"));
        if (hModule == NULL)
            return NULL;

        // Find the 32-bit catalog enumerator
        fnWscEnumProtocols32 = (LPWSCENUMPROTOCOLS)GetProcAddress(hModule, "WSCEnumProtocols32");
        if (fnWscEnumProtocols32 == NULL)
            return NULL;

        // Find the required buffer size
        rc = fnWscEnumProtocols32(NULL, ProtocolInfo, &ProtocolInfoSize, &ErrorCode);
        if (rc == SOCKET_ERROR)
        {
            if (ErrorCode != WSAENOBUFS)
                return NULL;
        }

        // Allocate the buffer
        ProtocolInfo = (LPWSAPROTOCOL_INFOW)HeapAlloc(GetProcessHeap(), 0, ProtocolInfoSize);
        if (ProtocolInfo == NULL)
        {
            return NULL;
        }

        // Enumrate the catalog for real this time
        rc = fnWscEnumProtocols32(NULL, ProtocolInfo, &ProtocolInfoSize, &ErrorCode);
        if (rc == SOCKET_ERROR)
        {
            HeapFree(GetProcessHeap(), 0, ProtocolInfo);
            return NULL;
        }

        // Update the count
        *TotalProtocols = rc;

        FreeLibrary(hModule);
    }
#else
    if (Catalog == LspCatalog32Only)
    {
        // Find the size of the buffer
        rc = WSCEnumProtocols(NULL, ProtocolInfo, &ProtocolInfoSize, &ErrorCode);
        if (rc == SOCKET_ERROR)
        {
            if (ErrorCode != WSAENOBUFS)
                return NULL;
        }

        // Allocate the buffer
        ProtocolInfo = (LPWSAPROTOCOL_INFOW) HeapAlloc(GetProcessHeap(), 0, ProtocolInfoSize);
        if (ProtocolInfo == NULL)
        {
            return NULL;
        }

        // Enumerate the catalog for real
        rc = WSCEnumProtocols(NULL, ProtocolInfo, &ProtocolInfoSize, &ErrorCode);
        if (rc == SOCKET_ERROR)
        {
            HeapFree(GetProcessHeap(), 0, ProtocolInfo);
            return NULL;
        }

        // Update the count
        *TotalProtocols = rc;
    }
    else if (Catalog == LspCatalog64Only)
    {
        fprintf(stderr, "Unable to enumerate 64-bit Winsock catalog from 32-bit process!\n");
    }
#endif
    else
    {
        // Find the size of the buffer
        rc = WSCEnumProtocols(NULL, ProtocolInfo, &ProtocolInfoSize, &ErrorCode);
        if (rc == SOCKET_ERROR)
        {
            if (ErrorCode != WSAENOBUFS)
                return NULL;
        }

        // Allocate the buffer
        ProtocolInfo = (LPWSAPROTOCOL_INFOW) HeapAlloc(GetProcessHeap(), 0, ProtocolInfoSize);
        if (ProtocolInfo == NULL)
        {
            return NULL;
        }

        // Enumerate the catalog for real
        rc = WSCEnumProtocols(NULL, ProtocolInfo, &ProtocolInfoSize, &ErrorCode);
        if (rc == SOCKET_ERROR)
        {
            HeapFree(GetProcessHeap(), 0, ProtocolInfo);
            return NULL;
        }

        // Update the count
        *TotalProtocols = rc;
    }

  return ProtocolInfo;
}

void FreeProviders ( LPWSAPROTOCOL_INFOW ProtocolInfo )

Definition at line 195 of file provider.cpp.

{
  HeapFree(GetProcessHeap(), 0, ProtocolInfo);
}

void PrintProtocolInfo ( WSAPROTOCOL_INFOW * ProtocolInfo )

Definition at line 39 of file prnpinfo.cpp.

{
    WCHAR       szGuidString[MAX_PATH];
    int   i;

    printf("\nProtocol: %S\n", wsapi->szProtocol);
    printf("           Address Family: ");
    switch (wsapi->iAddressFamily)
    {
        case AF_INET:
        case AF_INET6:
            printf("%s\n", (wsapi->iAddressFamily == AF_INET ? \
"AF_INET" : "AF_INET6"));
            printf("                 Protocol: ");
            switch (wsapi->iProtocol)
            {
                case IPPROTO_IP:
                    printf("IPROTO_IP\n");
                    break;
                case IPPROTO_ICMP:
                    printf("IPROTO_ICMP\n");
                    break;
                case IPPROTO_IGMP:
                    printf("IPROTO_IGMP\n");
                    break;
                case IPPROTO_GGP:
                    printf("IPROTO_GGP\n");
                    break;
                case IPPROTO_TCP:
                    printf("IPROTO_TCP\n");
                    break;
                case IPPROTO_PUP:
                    printf("IPROTO_PUP\n");
                    break;
                case IPPROTO_UDP:
                    printf("IPROTO_UDP\n");
                    break;
                case IPPROTO_IDP:
                    printf("IPROTO_IDP\n");
                    break;
                case IPPROTO_ND:
                    printf("IPROTO_ND\n");
                    break;
                case IPPROTO_RM:
                    printf("IPPROTO_RM\n");
                    break;
                case IPPROTO_RAW:
                    printf("IPROTO_RAW\n");
                    break;
            }
            break;
        case AF_UNSPEC:
            printf("AF_UNSPEC\n");
            printf("                 Protocol: UNKNOWN: %d",
                wsapi->iProtocol);
            break;
        case AF_UNIX:
            printf("AF_UNIX\n");
            printf("                 Protocol: UNKNOWN: %d",
                wsapi->iProtocol);
            break;
        case AF_IMPLINK:
            printf("AF_IMPLINK\n");
            printf("                 Protocol: UNKNOWN: %d",
                wsapi->iProtocol);
            break;
        case AF_PUP:
            printf("AF_PUP\n");
            printf("                 Protocol: UNKNOWN: %d",
                wsapi->iProtocol);
            break;
        case AF_CHAOS:
            printf("AF_CHAOS\n");
            printf("                 Protocol: UNKNOWN: %d",
                wsapi->iProtocol);
            break;
        case AF_NS:
            printf("AF_NS or AF_IPX\n");
            printf("                 Protocol: ");
            switch (wsapi->iProtocol)
            {
                case NSPROTO_IPX:
                    printf("NSPROTO_IPX\n");
                    break;
                case NSPROTO_SPX:
                    printf("NSPROTO_SPX\n");
                    break;
                case NSPROTO_SPXII:
                    printf("NSPROTO_SPXII\n");
                    break;
            }
            break;
        case AF_ISO:
            printf("AF_ISO or AF_OSI\n");
            printf("                 Protocol: UNKNOWN: %d",
                wsapi->iProtocol);
            break;
        case AF_ECMA:
            printf("AF_ECMA\n");
            printf("                 Protocol: UNKNOWN: %d",
                wsapi->iProtocol);
            break;
        case AF_DATAKIT:
            printf("AF_DATAKIT\n");
            printf("                 Protocol: UNKNOWN: %d",
                wsapi->iProtocol);
            break;
        case AF_CCITT:
            printf("AF_CCITT\n");
            printf("                 Protocol: UNKNOWN: %d",
                wsapi->iProtocol);
            break;
        case AF_SNA:
            printf("AF_SNA\n");
            printf("                 Protocol: UNKNOWN: %d",
                wsapi->iProtocol);
            break;
        case AF_DECnet:
            printf("AF_DECnet\n");
            printf("                 Protocol: UNKNOWN: %d",
                wsapi->iProtocol);
            break;
        case AF_DLI:
            printf("AF_DLI\n");
            printf("                 Protocol: UNKNOWN: %d",
                wsapi->iProtocol);
            break;
        case AF_LAT:
            printf("AF_LAT\n");
            printf("                 Protocol: UNKNOWN: %d",
                wsapi->iProtocol);
            break;
        case AF_HYLINK:
            printf("AF_HYLINK\n");
            printf("                 Protocol: UNKNOWN: %d",
                wsapi->iProtocol);
            break;
        case AF_APPLETALK:
            printf("AF_APPLETALK\n");
            printf("                 Protocol: ");
            switch (wsapi->iProtocol)
            {
                case DDPPROTO_RTMP:
                    printf("DDPPROTO_RTMP\n");
                    break;
                case DDPPROTO_NBP:
                    printf("DDPPROTO_NBP\n");
                    break;
                case DDPPROTO_ATP:
                    printf("DDPROTO_ATP\n");
                    break;
                case DDPPROTO_AEP:
                    printf("DDPPROTO_AEP\n");
                    break;
                case DDPPROTO_RTMPRQ:
                    printf("DDPPROTO_RTMPRQ\n");
                    break;
                case DDPPROTO_ZIP:
                    printf("DDPPROTO_ZIP\n");
                    break;
                case DDPPROTO_ADSP:
                    printf("DDPPROTO_ADSP\n");
                    break;
                case ATPROTO_ADSP:
                    printf("ATPROTO_ADSP\n");
                    break;
                case ATPROTO_ATP:
                    printf("ATPROTO_ATP\n");
                    break;
                case ATPROTO_ASP:
                    printf("ATPROTO_ASP\n");
                    break;
                case ATPROTO_PAP:
                    printf("ATPROTO_PAP\n");
                    break;
            }
            break;
        case AF_NETBIOS:
            printf("AF_NETBIOS\n");
            printf("                 Protocol: ");
      printf("NetBIOS LANA %d\n", ((wsapi->iProtocol == 0x80000000) ? 0: abs(wsapi->iProtocol)));
            break;
        case AF_VOICEVIEW:
            printf("AF_VOICEVIEW\n");
            printf("                 Protocol: UNKNOWN: %d",
                wsapi->iProtocol);
            break;
        case AF_FIREFOX:
            printf("AF_FIREFOX\n");
            printf("                 Protocol: UNKNOWN: %d",
                wsapi->iProtocol);
            break;
        case AF_UNKNOWN1:
            printf("AF_UNKNOWN1\n");
            printf("                 Protocol: UNKNOWN: %d",
                wsapi->iProtocol);
            break;
        case AF_BAN:
            printf("AF_BAN\n");
            printf("                 Protocol: UNKNOWN: %d",
                wsapi->iProtocol);
            break;
        case AF_ATM:
            printf("AF_ATM\n");
            printf("                 Protocol: ");
            switch (wsapi->iProtocol)
            {
                case ATMPROTO_AALUSER:
                    printf("ATMPROTO_AALUSER\n");
                    break;
                case ATMPROTO_AAL1:
                    printf("ATMPROTO_AAL1\n");
                    break;
                case ATMPROTO_AAL2:
                    printf("ATMPROTO_AAL2\n");
                    break;
                case ATMPROTO_AAL34:
                    printf("ATMPROTO_AAL34\n");
                    break;
                case ATMPROTO_AAL5:
                    printf("ATMPROTO_AAL5\n");
                    break;
            }
            break;
        case AF_CLUSTER:
            printf("AF_CLUSTER\n");
            printf("                 Protocol: UNKNOWN: %d",
                wsapi->iProtocol);
            break;
        case AF_12844:
            printf("AF_12844\n");
            printf("                 Protocol: UNKNOWN: %d",
                wsapi->iProtocol);
            break;
        case AF_IRDA:
            printf("AF_IRDA\n");
            printf("                 Protocol: ");
            switch (wsapi->iProtocol)
            {
                case IRDA_PROTO_SOCK_STREAM:
                    printf("IRDA_PROTO_SOCK_STREAM\n");
                    break;
            }
            break;
        default:
            printf("Unknown: %d\n", wsapi->iAddressFamily);
    }
    printf("              Socket Type: ");
    switch (wsapi->iSocketType)
    {
        case SOCK_STREAM:
            printf("SOCK_STREAM\n");
            break;
        case SOCK_DGRAM:
            printf("SOCK_DGRAM\n");
            break;
        case SOCK_RAW:
            printf("SOCK_RAW\n");
            break;
        case SOCK_RDM:
            printf("SOCK_RDM\n");
            break;
        case SOCK_SEQPACKET:
            printf("SOCK_SEQPACKET\n");
            break;
    }
    printf("           Connectionless: ");
    if (wsapi->dwServiceFlags1 & XP1_CONNECTIONLESS)
        printf("YES\n");
    else
        printf("NO\n");
    printf("      Guaranteed Delivery: ");
    if (wsapi->dwServiceFlags1 & XP1_GUARANTEED_DELIVERY)
        printf("YES\n");
    else
        printf("NO\n");
    printf("         Guaranteed Order: ");
    if (wsapi->dwServiceFlags1 & XP1_GUARANTEED_ORDER)
        printf("YES\n");
    else
        printf("NO\n");
    printf("         Message Oriented: ");
    if (wsapi->dwServiceFlags1 & XP1_MESSAGE_ORIENTED)
        printf("YES\n");
    else
        printf("NO\n");
    printf("            Pseudo Stream: ");
    if (wsapi->dwServiceFlags1 & XP1_PSEUDO_STREAM)
        printf("YES\n");
    else
        printf("NO\n");
    printf("           Graceful Close: ");
    if (wsapi->dwServiceFlags1 & XP1_GRACEFUL_CLOSE)
        printf("YES\n");
    else
        printf("NO\n");
    printf("           Expedited Data: ");
    if (wsapi->dwServiceFlags1 & XP1_EXPEDITED_DATA)
        printf("YES\n");
    else
        printf("NO\n");
    printf("             Connect Data: ");
    if (wsapi->dwServiceFlags1 & XP1_CONNECT_DATA)
        printf("YES\n");
    else
        printf("NO\n");
    printf("          Disconnect Data: ");
    if (wsapi->dwServiceFlags1 & XP1_DISCONNECT_DATA)
        printf("YES\n");
    else
        printf("NO\n");
    printf("       Supports Broadcast: ");
    if (wsapi->dwServiceFlags1 & XP1_SUPPORT_BROADCAST)
        printf("YES\n");
    else
        printf("NO\n");
    printf("      Supports Multipoint: ");
    if (wsapi->dwServiceFlags1 & XP1_SUPPORT_MULTIPOINT)
        printf("YES\n");
    else
        printf("NO\n");
    printf(" Multipoint Control Plane: ");
    if (wsapi->dwServiceFlags1 & XP1_MULTIPOINT_CONTROL_PLANE)
        printf("ROOTED\n");
    else
        printf("NON-ROOTED\n");
    printf("    Multipoint Data Plane: ");
    if (wsapi->dwServiceFlags1 & XP1_MULTIPOINT_DATA_PLANE)
        printf("ROOTED\n");
    else
        printf("NON-ROOTED\n");
    printf("            QoS Supported: ");
    if (wsapi->dwServiceFlags1 & XP1_QOS_SUPPORTED)
        printf("YES\n");
    else
        printf("NO\n");
    printf("     Unidirectional Sends: ");
    if (wsapi->dwServiceFlags1 & XP1_UNI_SEND)
        printf("YES\n");
    else
        printf("NO\n");
    printf("    Unidirection Receives: ");
    if (wsapi->dwServiceFlags1 & XP1_UNI_RECV)
        printf("YES\n");
    else
        printf("NO\n");
    printf("              IFS Handles: ");
    if (wsapi->dwServiceFlags1 & XP1_IFS_HANDLES)
        printf("YES\n");
    else
        printf("NO\n");
    printf("         Partial Messages: ");
    if (wsapi->dwServiceFlags1 & XP1_PARTIAL_MESSAGE)
        printf("YES\n");
    else
        printf("NO\n");
    printf("           Provider Flags: ");
    if (wsapi->dwProviderFlags & PFL_MULTIPLE_PROTO_ENTRIES)
    {
        printf("PFL_MULTIPLE_PROTO_ENTRIES ");
    }
    if (wsapi->dwProviderFlags & PFL_RECOMMENDED_PROTO_ENTRY)
    {
        printf("PFL_RECOMMENDED_PROT_ENTRY ");
    }
    if (wsapi->dwProviderFlags & PFL_HIDDEN)
    {
        printf("PFL_HIDDEN ");
    }
    if (wsapi->dwProviderFlags & PFL_MATCHES_PROTOCOL_ZERO)
    {
        printf("PFL_MATCHES_PROTOCOL_ZERO ");
    }
    if (wsapi->dwProviderFlags == 0)
    {
        printf("NONE");
    }
    printf("\n");

    StringFromGUID2(wsapi->ProviderId, szGuidString, MAX_PATH-1);
    printf("              Provider Id: %S\n", szGuidString);
    printf("         Catalog Entry Id: %ld\n", wsapi->dwCatalogEntryId);
    printf("  Number of Chain Entries: %d   {",
        wsapi->ProtocolChain.ChainLen);
    for(i=0; i < wsapi->ProtocolChain.ChainLen ;i++)
        printf("%ld ", wsapi->ProtocolChain.ChainEntries[i]);
    printf("}\n");
    printf("                  Version: %d\n", wsapi->iVersion);
    printf("Max Socket Address Length: %d\n", wsapi->iMaxSockAddr);
    printf("Min Socket Address Length: %d\n", wsapi->iMinSockAddr);
    printf("      Protocol Max Offset: %d\n", wsapi->iProtocolMaxOffset);
    printf("       Network Byte Order: ");
    if (wsapi->iNetworkByteOrder == 0)
        printf("BIG-ENDIAN\n");
    else
        printf("LITLE-ENDIAN\n");
    printf("          Security Scheme: ");
    if (wsapi->iSecurityScheme == SECURITY_PROTOCOL_NONE)
        printf("NONE\n");
    else
        printf("%d\n", wsapi->iSecurityScheme);
    printf("             Message Size: ");
    if (wsapi->dwMessageSize == 0)
        printf("N/A (Stream Oriented)\n");
    else if (wsapi->dwMessageSize == 1)
        printf("Depended on underlying MTU\n");
    else if (wsapi->dwMessageSize == 0xFFFFFFFF)
        printf("No limit\n");
    else
        printf("%ld\n", wsapi->dwMessageSize);
}

Variable Documentation

GUID ProviderGuid

Definition at line 34 of file lspguid.cpp.

WCHAR* ProviderPath

Definition at line 29 of file lspguid.cpp.

Generated on Wed Nov 13 2024 16:54:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/LSP/instlsp.cpp File Reference

  • NetDS
  • WinSock
  • LSP
Classes | Defines | Typedefs | Functions | Variables

instlsp.cpp File Reference

#include <winsock2.h>
#include <ws2spi.h>
#include <objbase.h>
#include <rpc.h>
#include <rpcdce.h>
#include <sporder.h>
#include <winnt.h>
#include <windows.h>
#include "install.h"
#include <stdio.h>
#include <stdlib.h>

Go to the source code of this file.

Classes

struct | _LSP_ENTRY

Defines

#define | DEFAULT_LSP_NAME "Test LSP"
#define | DEFAULT_PATH_LEN 128
#define | MAX(a, b) ( (a) > (b) ? (a) : (b) )
#define | MAX_PROVIDERS 256
#define | MIN(a, b) ( (a) < (b) ? (a) : (b) )

Typedefs

typedef struct _LSP_ENTRY | LSP_ENTRY

Functions

LSP_ENTRY * | BuildLspMap (WSAPROTOCOL_INFOW *pProviders, int iProviderCount, int *pLspCount)
WSAPROTOCOL_INFOW * | CreateDummyEntry (WINSOCK_CATALOG Catalog, INT CatalogId, WCHAR *lpwszLspName)
WSAPROTOCOL_INFOW * | CreateLayeredEntries (WINSOCK_CATALOG Catalog, WCHAR *lpwszLspName, GUID *Guid, DWORD *pdwIdArray, INT iIdArrayCount, DWORD *LayeredId)
int | DeinstallProvider (WINSOCK_CATALOG Catalog, GUID *Guid)
void | FreeLspMap (LSP_ENTRY *pLspMap, int iLspCount)
WSAPROTOCOL_INFOW * | GetLayeredEntriesByGuid (WSAPROTOCOL_INFOW *pEntries, int iEntryCount, GUID *MatchGuid, int *iLayeredCount)
int | GetProviderCount (WSAPROTOCOL_INFOW *pProviders, int iProviderCount, int ProviderType)
int | InstallProvider (WINSOCK_CATALOG Catalog, GUID *Guid, WCHAR *lpwszLspPath, WSAPROTOCOL_INFOW *pProvider, INT iProviderCount)
BOOL | IsEqualProtocolEntries (WSAPROTOCOL_INFOW *pInfo1, WSAPROTOCOL_INFOW *pInfo2)
BOOL | IsIdInChain (WSAPROTOCOL_INFOW *pinfo, DWORD Id)
int _cdecl | main (int argc, char *argv[])
void | MapNewEntriesToOld (LSP_ENTRY *pEntry, WSAPROTOCOL_INFOW *pProvider, int iProviderCount)
void | PrintLspMap (LSP_ENTRY *pLspMap, int iLspCount)
void | PrintProviders (WINSOCK_CATALOG Catalog, BOOL bLayeredOnly, BOOL bVerbose)
void | PruneLspMap (LSP_ENTRY *pLspMap, int iLspCount, DWORD *pdwRemovedProviders, int iRemoveCount)
int | RemoveAllLayeredEntries (WINSOCK_CATALOG Catalog)
int | RemoveIdFromChain (WSAPROTOCOL_INFOW *pinfo, DWORD CatalogId)
int | RemoveProvider (WINSOCK_CATALOG Catalog, DWORD ProviderId)
DWORD * | ReorderACatalog (WINSOCK_CATALOG Catalog, DWORD dwLayerId, INT *dwEntryCount)
int | ReorderCatalog (WINSOCK_CATALOG Catalog, DWORD dwLayeredId)
void | UpdateLspMap (LSP_ENTRY *pLspMap, int iLspCount, DWORD dwOldValue, DWORD dwNewValue, DWORD *pdwCatalogOrder, int iProviderCount)
void | usage (char *progname)

Variables

LPWSCUPDATEPROVIDER | fnWscUpdateProvider = NULL
HMODULE | hModule = NULL

Define Documentation

#define DEFAULT_LSP_NAME "Test LSP"

Definition at line 105 of file instlsp.cpp.

#define DEFAULT_PATH_LEN 128

Definition at line 102 of file instlsp.cpp.

#define MAX | ( | a,
 |  | b |
 | ) |  | ( (a) > (b) ? (a) : (b) )

Definition at line 107 of file instlsp.cpp.

#define MAX_PROVIDERS 256

Definition at line 103 of file instlsp.cpp.

#define MIN | ( | a,
 |  | b |
 | ) |  | ( (a) < (b) ? (a) : (b) )

Definition at line 108 of file instlsp.cpp.

Typedef Documentation

typedef struct _LSP_ENTRY LSP_ENTRY

Function Documentation

LSP_ENTRY * BuildLspMap | ( | WSAPROTOCOL_INFOW * | pProviders,
 |  | int | iProviderCount,
 |  | int * | pLspCount
 | ) |  |

Definition at line 1856 of file instlsp.cpp.

{
    LSP_ENTRY *pLsps=NULL,
               lsptmp;
    DWORD     *pBaseList=NULL;
    BOOL       bFound;
    int        iLspCount=0,
               iBaseCount=0,
               iProviderPathLen,
               ErrorCode,
               LspOrder,
               start,
               end,
               idx,
               rc,
               i, j, k;

    iLspCount = GetProviderCount(pProviders, iProviderCount, LAYERED_PROTOCOL);

    if ( iLspCount == 0 )
    {
        // No LSPs installed, nothing to do
        goto cleanup;
    }

    // Allocate space for our structure which represents the LSPs installed
    pLsps = (LSP_ENTRY *) HeapAlloc(
            GetProcessHeap(),
            HEAP_ZERO_MEMORY,
            sizeof(LSP_ENTRY) * iLspCount
            );
    if (pLsps == NULL)
    {
        fprintf(stderr, "BuildLspMap: HeapAlloc failed: %d\n", GetLastError());
        goto cleanup;
    }

    idx = 0;
    for(i=0; i < iProviderCount ;i++)
    {
        if ( pProviders[i].ProtocolChain.ChainLen == LAYERED_PROTOCOL )
        {
            // Copy the dummy entry
            memcpy( &pLsps[idx].DummyEntry, &pProviders[i], sizeof(WSAPROTOCOL_INFOW) );

            // Get the DLL path
            iProviderPathLen = MAX_PATH-1;
            rc = WSCGetProviderPath(
                    &pLsps[idx].DummyEntry.ProviderId,
                     pLsps[idx].wszLspDll,
                    &iProviderPathLen,
                    &ErrorCode
                    );
            if (rc == SOCKET_ERROR)
            {
                fprintf(stderr, "BuildLspMap: WSCGetProviderPath failed: %d\n", ErrorCode);
                goto cleanup;
            }

            //
            // Now go find all the layered entries associated with the dummy provider
            //

            // First get the count
            for(j=0; j < iProviderCount ;j++)
            {
                if ( IsIdInChain( &pProviders[j], pLsps[idx].DummyEntry.dwCatalogEntryId ) )
                {
                    pLsps[idx].Count++;
                }
            }

            // Allocate space
            pLsps[idx].LayeredEntries = (WSAPROTOCOL_INFOW *)HeapAlloc(
                    GetProcessHeap(),
                    HEAP_ZERO_MEMORY,
                    sizeof(WSAPROTOCOL_INFOW) * pLsps[idx].Count
                    );
            if (pLsps[idx].LayeredEntries == NULL)
            {
                fprintf(stderr, "BuildLspMap: HeapAlloc failed: %d\n", GetLastError());
                goto cleanup;
            }

            // Now go find the entries
            pLsps[idx].Count = 0;
            for(j=0; j < iProviderCount ;j++)
            {
                if ( IsIdInChain( &pProviders[j], pLsps[idx].DummyEntry.dwCatalogEntryId ) )
                {
                    memcpy( &pLsps[idx].LayeredEntries[pLsps[idx].Count],
                            &pProviders[j],
                            sizeof(WSAPROTOCOL_INFOW)
                            );

                    pLsps[idx].MaxChainLength = MAX(
                            pLsps[idx].MaxChainLength,
                            pLsps[idx].LayeredEntries[pLsps[idx].Count].ProtocolChain.ChainLen
                            );

                    // Keep track of how many GUIDs are used to install the layered entries
                    if (pLsps[idx].Count == 0)
                    {
                        pLsps[idx].LayeredGuids = (GUID *)HeapAlloc(
                                GetProcessHeap(),
                                HEAP_ZERO_MEMORY,
                                sizeof(GUID)
                                );
                        if (pLsps[idx].LayeredGuids == NULL)
                        {
                            fprintf(stderr, "BuildLspMap: HeapAlloc failed: %d\n", GetLastError());
                            goto cleanup;
                        }

                        memcpy( &pLsps[idx].LayeredGuids[0], &pProviders[j].ProviderId, sizeof(GUID) );
                        pLsps[idx].LayeredGuidCount++;
                    }
                    else
                    {
                        // See if we've already seen this guid
                        bFound = FALSE;
                        for(k=0; k < pLsps[idx].LayeredGuidCount ;k++)
                        {
                            if ( memcmp( &pLsps[idx].LayeredGuids[k],
                                         &pProviders[j].ProviderId,
                                         sizeof(GUID) ) == 0 )
                             {
                                bFound = TRUE;
                                break;
                             }
                        }
                        if (bFound == FALSE)
                        {
                            GUID    *tmpguid=NULL;

                            // New GUID -- we need to add it to the array
                            tmpguid = (GUID *)HeapAlloc(
                                    GetProcessHeap(),
                                    HEAP_ZERO_MEMORY,
                                    sizeof(GUID) * (pLsps[idx].LayeredGuidCount + 1)
                                    );
                            if (tmpguid == NULL)
                            {
                                fprintf(stderr, "BuildLspMap: HeapAlloc failed: %d\n", GetLastError());
                                goto cleanup;
                            }

                            memcpy( tmpguid, pLsps[idx].LayeredGuids, sizeof(GUID) * pLsps[idx].LayeredGuidCount );
                            memcpy( &tmpguid[pLsps[idx].LayeredGuidCount], &pProviders[j].ProviderId, sizeof(GUID) );

                            HeapFree(GetProcessHeap(), 0, pLsps[idx].LayeredGuids);

                            pLsps[idx].LayeredGuids = tmpguid;
                            pLsps[idx].LayeredGuidCount++;
                        }
                    }

                    pLsps[idx].Count++;

                }
            }

            pLsps[idx].LspOrder = MAX_PROTOCOL_CHAIN;

            idx++;
        }
    }

    //
    // We now have an array of "LSPs" -- now order them
    //

    // First get a list of base provider IDs
    iBaseCount = GetProviderCount(pProviders, iProviderCount, BASE_PROTOCOL);
    if (iBaseCount == 0)
    {
        fprintf(stderr, "BuildLspMap: GetProviderCount(BASE_PROTOCOL) returned zero!\n");
        goto cleanup;
    }

    // Allocate space for the array of base provider ID's
    pBaseList = (DWORD *) HeapAlloc(
            GetProcessHeap(),
            HEAP_ZERO_MEMORY,
            sizeof(DWORD) * iBaseCount
            );
    if (pBaseList == NULL)
    {
        fprintf(stderr, "BuildLspMap: HeapAlloc failed: %d\n", GetLastError());
        goto cleanup;
    }

    // Copy the base provider ID's to our array
    idx = 0;
    for(i=0; i < iProviderCount ;i++)
    {
        if ( pProviders[i].ProtocolChain.ChainLen == BASE_PROTOCOL )
        {
            pBaseList[idx++] = pProviders[i].dwCatalogEntryId;
        }
    }

    for(LspOrder = 1; LspOrder < MAX_PROTOCOL_CHAIN ;LspOrder++)
    {
        for(i=0; i < iLspCount ;i++)
        {
            for(j=0; j < pLsps[i].Count ;j++)
            {
                for(k=0; k < iBaseCount ;k++)
                {
                    if ( pLsps[i].LayeredEntries[j].ProtocolChain.ChainEntries[LspOrder] ==
                         pBaseList[k] )
                    {
                        pLsps[i].LspOrder = MIN( pLsps[i].LspOrder, LspOrder );
                        break;
                    }
                }
            }
        }
    }

    // Sort the entries according to the LspOrder field
    for(i=0; i < iLspCount ;i++)
    {
        for(j=i; j < iLspCount ;j++)
        {
            if ( pLsps[i].LspOrder > pLsps[j].LspOrder )
            {
                // Exchange positions
                memcpy( &lsptmp,   &pLsps[i], sizeof(LSP_ENTRY) );
                memcpy( &pLsps[i], &pLsps[j], sizeof(LSP_ENTRY) );
                memcpy( &pLsps[j], &lsptmp,   sizeof(LSP_ENTRY) );
            }
        }
    }

    // Now need to sort by MaxChainLength withing the LspOrder groupings

    for(LspOrder=1; LspOrder < MAX_PROTOCOL_CHAIN ;LspOrder++)
    {
        // Find the start and end positions within the array for the given
        // LspOrder value
        start = -1;
        end   = -1;
        for(i=0; i < iLspCount ;i++)
        {
            if ( pLsps[i].LspOrder == LspOrder)
            {
                start = i;
                break;
            }
        }
        if (start != -1)
        {
            for(j=start; j < iLspCount ;j++)
            {
                if ( pLsps[j].LspOrder != LspOrder)
                {
                    end = j-1;
                    break;
                }
            }
        }

        if ( (start != -1) && (end != -1) )
        {
            for(i=start; i < end ;i++)
            {
                for(j=i; j < end ;j++)
                {
                    if ( pLsps[i].MaxChainLength > pLsps[j].MaxChainLength )
                    {
                        memcpy( &lsptmp,   &pLsps[i], sizeof(LSP_ENTRY) );
                        memcpy( &pLsps[i], &pLsps[j], sizeof(LSP_ENTRY) );
                        memcpy( &pLsps[j], &lsptmp,   sizeof(LSP_ENTRY) );
                    }
                }
            }
        }
    }

cleanup:

    if (pLspCount)
        *pLspCount = iLspCount;

    if (pBaseList)
        HeapFree(GetProcessHeap(), 0, pBaseList);

    return pLsps;
}

WSAPROTOCOL_INFOW * CreateDummyEntry | ( | WINSOCK_CATALOG | Catalog,
 |  | INT | CatalogId,
 |  | WCHAR * | lpwszLspName
 | ) |  |

Definition at line 794 of file instlsp.cpp.

{
    WSAPROTOCOL_INFOW *pProtocolInfo=NULL,
                      *pDummyEntry=NULL;
    INT                iProtocolCount=0;
    int                i;

    // Enumerate the catalog
    pProtocolInfo = EnumerateProviders(Catalog, &iProtocolCount);
    if (pProtocolInfo == NULL)
    {
        fprintf(stderr, "CreateDummyEntry: EnumerateProviders failed!\n");
        return NULL;
    }

    // Find one of the providers we are layering over
    for(i=0; i < iProtocolCount ;i++)
    {
        if (pProtocolInfo[i].dwCatalogEntryId == CatalogId)
        {
            // Allocate space and copy the provider structure
            pDummyEntry = (WSAPROTOCOL_INFOW *)HeapAlloc(GetProcessHeap(), 0, sizeof(WSAPROTOCOL_INFOW));
            if (pDummyEntry == NULL)
            {
                return NULL;
            }

            // Copy the entry as a basis for the dummy entry
            memcpy(pDummyEntry, &pProtocolInfo[i], sizeof(WSAPROTOCOL_INFOW));

            break;
        }
    }

    // Verify we found a provider
    if (pDummyEntry == NULL)
    {
        fprintf(stderr, "\n\nError! Unable to find provider with ID of %d\n\n",
                CatalogId);
        return NULL;
    }

    // Remove the flag indicating IFS support (as our LSP does not provide IFS handles)
    pDummyEntry->dwServiceFlags1 &= (~XP1_IFS_HANDLES);
    // Set the flags indicating this is a hidden ("dummy") entry
    pDummyEntry->dwProviderFlags |= PFL_HIDDEN;
    pDummyEntry->ProtocolChain.ChainLen = LAYERED_PROTOCOL;

    // Copy the LSP name
    wcsncpy(pDummyEntry->szProtocol, lpwszLspName, WSAPROTOCOL_LEN);

    FreeProviders(pProtocolInfo);

    return pDummyEntry;
}

WSAPROTOCOL_INFOW * CreateLayeredEntries | ( | WINSOCK_CATALOG | Catalog,
 |  | WCHAR * | lpwszLspName,
 |  | GUID * | Guid,
 |  | DWORD * | pdwIdArray,
 |  | INT | iIdArrayCount,
 |  | DWORD * | LayeredId
 | ) |  |

Definition at line 864 of file instlsp.cpp.

{
    WSAPROTOCOL_INFOW   *pProvider=NULL,
                        *pLayeredEntries=NULL;
    DWORD                LayeredCatalogId=0;
    INT                  iProviderCount=0,
                         idx,
                         i, j, k;

    if (LayeredId == NULL)
        return NULL;

    // Enumerate the catalog
    pProvider = EnumerateProviders(Catalog, &iProviderCount);
    if (pProvider == NULL)
    {
        return NULL;
    }

    // Find the dummy entry so we can extract its catalog ID
    for(i=0; i < iProviderCount ;i++)
    {
        if (memcmp(&pProvider[i].ProviderId, Guid, sizeof(GUID)) == 0)
        {
            LayeredCatalogId = pProvider[i].dwCatalogEntryId;
            break;
        }
    }

    // Make sure we found the dummy provider
    if (LayeredCatalogId == 0)
    {
        fprintf(stderr, "CreateLayeredEntries: Unable to find dummy provider in catalog!\n");
        FreeProviders(pProvider);
        return NULL;
    }

    // Allocate space for our layered entries
    pLayeredEntries = (WSAPROTOCOL_INFOW *)HeapAlloc(GetProcessHeap(), 0, sizeof(WSAPROTOCOL_INFOW) * iIdArrayCount);
    if (pLayeredEntries == NULL)
    {
        fprintf(stderr, "CreateLayeredEntries: HeapAlloc failed: %d\n", GetLastError());
        FreeProviders(pProvider);
        return NULL;
    }

    // Go through the catalog and build the layered entries
    idx = 0;
    for(i=0; i < iProviderCount ;i++)
    {
        for(j=0; j < iIdArrayCount ;j++)
        {
            if (pProvider[i].dwCatalogEntryId == pdwIdArray[j])
            {
                memcpy(&pLayeredEntries[idx], &pProvider[i], sizeof(WSAPROTOCOL_INFOW));

                // Put our LSP name in the protocol field
                _snwprintf(pLayeredEntries[idx].szProtocol, WSAPROTOCOL_LEN,
                        L"%s over [%s]",
                        lpwszLspName,
                        pProvider[i].szProtocol
                        );

                // Move all the protocol chain entries down by 1 position
                for(k = pProvider[i].ProtocolChain.ChainLen; k > 0 ;k--)
                {
                    pLayeredEntries[idx].ProtocolChain.ChainEntries[k] = pProvider[i].ProtocolChain.ChainEntries[k-1];
                }

                // The second entry is always the ID of the current pProvider[i]
                //     In case of multiple LSPs then if we didn't do this the [1] index
                //     would contain the ID of that LSP's dummy entry and not the entry
                //     itself.
                pLayeredEntries[idx].ProtocolChain.ChainEntries[1] = pProvider[i].dwCatalogEntryId;

                // Insert our LSP in the chain and increment the count
                pLayeredEntries[idx].ProtocolChain.ChainEntries[0] = LayeredCatalogId;
                pLayeredEntries[idx].ProtocolChain.ChainLen++;

                // Again, this LSP doesn't provide true IFS handles so remove the flag
                pLayeredEntries[idx].dwServiceFlags1 &= (~XP1_IFS_HANDLES);

                idx++;
            }
        }
    }

    FreeProviders(pProvider);

    // Return the ID of the LSP's dummy entry
    *LayeredId = LayeredCatalogId;

    return pLayeredEntries;
}

int DeinstallProvider | ( | WINSOCK_CATALOG | Catalog,
 |  | GUID * | Guid
 | ) |  |

Definition at line 1050 of file instlsp.cpp.

{
    INT     ErrorCode,
            rc;

#ifdef _WIN64
    if (Catalog == LspCatalogBoth)
    {
        // Remove from 64-bit catalog
        rc = WSCDeinstallProvider(Guid, &ErrorCode);
        if (rc == SOCKET_ERROR)
        {
            if (ErrorCode != WSAEFAULT)
                fprintf(stderr, "DeinstallProvider: WSCDeinstallProvider failed: %d\n", ErrorCode);
        }

        // Remove from the 32-bit catalog
        rc = WSCDeinstallProvider32(Guid, &ErrorCode);
        if (rc == SOCKET_ERROR)
        {
            if (ErrorCode != WSAEFAULT)
                fprintf(stderr, "DeinstallProvider: WSCDeinstallProvider32 failed: %d\n", ErrorCode);
        }
    }
    else if (Catalog == LspCatalog64Only)
    {
        // Remove from 64-bit catalog
        rc = WSCDeinstallProvider(Guid, &ErrorCode);
        if (rc == SOCKET_ERROR)
        {
            if (ErrorCode != WSAEFAULT)
                fprintf(stderr, "DeinstallProvider: WSCDeinstallProvider failed: %d\n", ErrorCode);
        }
    }
    else
    {
        // Remove from the 32-bit catalog
        rc = WSCDeinstallProvider32(Guid, &ErrorCode);
        if (rc == SOCKET_ERROR)
        {
            if (ErrorCode != WSAEFAULT)
                fprintf(stderr, "DeinstallProvider: WSCDeinstallProvider32 failed: %d\n", ErrorCode);
        }
    }
#else
    if (Catalog == LspCatalog32Only)
    {
        // Remove from the 32-bit catalog
        rc = WSCDeinstallProvider(Guid, &ErrorCode);
        if (rc == SOCKET_ERROR)
        {
            if (ErrorCode != WSAEFAULT)
                fprintf(stderr, "DeinstallProvider: WSCDeinstallProvider failed: %d\n", ErrorCode);
        }
    }
    else
    {
        fprintf(stderr, "Unable to remove providers in 64-bit catalog from 32-bit process!\n");
        return SOCKET_ERROR;
    }
#endif

    return NO_ERROR;
}

void FreeLspMap | ( | LSP_ENTRY * | pLspMap,
 |  | int | iLspCount
 | ) |  |

Definition at line 2238 of file instlsp.cpp.

{
    int     i;

    for(i=0; i < iLspCount ;i++)
    {
        // Free the layered providers first
        if ( pLspMap[i].LayeredEntries != NULL )
            HeapFree(GetProcessHeap(), 0, pLspMap[i].LayeredEntries);
        if ( pLspMap[i].LayeredGuids != NULL )
            HeapFree(GetProcessHeap(), 0, pLspMap[i].LayeredGuids);
    }
    HeapFree(GetProcessHeap(), 0, pLspMap);
}

WSAPROTOCOL_INFOW * GetLayeredEntriesByGuid | ( | WSAPROTOCOL_INFOW * | pEntries,
 |  | int | iEntryCount,
 |  | GUID * | MatchGuid,
 |  | int * | iLayeredCount
 | ) |  |

Definition at line 2357 of file instlsp.cpp.

{
    WSAPROTOCOL_INFOW *MatchedEntries=NULL;
    int                count,
                       i;

    // First count how many entries belong to this GUID
    count = 0;
    for(i=0; i < iEntryCount ;i++)
    {
        if ( memcmp( MatchGuid, &pEntries[i].ProviderId, sizeof(GUID)) == 0 )
        {
            count++;
        }
    }

    // Allocate space for the number of matching provider entries
    MatchedEntries = (WSAPROTOCOL_INFOW *)HeapAlloc(
            GetProcessHeap(),
            HEAP_ZERO_MEMORY,
            sizeof(WSAPROTOCOL_INFOW) * count
            );
    if (MatchedEntries == NULL)
    {
        fprintf(stderr, "GetLayeredEntriesByGuid: HeapAlloc failed: %d\n", GetLastError());
        return NULL;
    }

    // Go back and copy the matching providers into our array
    count = 0;
    for(i=0; i < iEntryCount ;i++)
    {
        if ( memcmp( MatchGuid, &pEntries[i].ProviderId, sizeof(GUID)) == 0 )
        {
            memcpy( &MatchedEntries[count++], &pEntries[i], sizeof(WSAPROTOCOL_INFOW) );
        }
    }

    // Update the return count
    if (iLayeredCount)
        *iLayeredCount = count;

    return MatchedEntries;
}

int GetProviderCount | ( | WSAPROTOCOL_INFOW * | pProviders,
 |  | int | iProviderCount,
 |  | int | ProviderType
 | ) |  |

Definition at line 2163 of file instlsp.cpp.

{
    int Count, i;

    Count = 0;
    for(i=0; i < iProviderCount ;i++)
    {
        if ( pProviders[i].ProtocolChain.ChainLen == ProviderType )
            Count++;
    }
    return Count;
}

int InstallProvider | ( | WINSOCK_CATALOG | Catalog,
 |  | GUID * | Guid,
 |  | WCHAR * | lpwszLspPath,
 |  | WSAPROTOCOL_INFOW * | pProvider,
 |  | INT | iProviderCount
 | ) |  |

Definition at line 975 of file instlsp.cpp.

{
    WSAPROTOCOL_INFOW *pEnumProviders=NULL;
    INT                iEnumProviderCount,
                       ErrorCode,
                       rc, i;

#ifdef _WIN64
    if (Catalog == LspCatalog32Only)
    {
        // Can't install only in 32-bit catalog from 64-bit
        fprintf(stderr, "\n\nError! It is not possible to install only in 32-bit catalog from 64-bit process!\n\n");
        return SOCKET_ERROR;
    }
    else if (Catalog == LspCatalog64Only)
    {
        // Just need to call WSCInstallProvider
        rc = WSCInstallProvider(Guid, lpwszLspPath, pProvider, iProviderCount, &ErrorCode);
    }
    else
    {
        // To install in both we must call WSCInstallProviderPath64_32
        rc = WSCInstallProvider64_32(Guid, lpwszLspPath, pProvider, iProviderCount, &ErrorCode);
    }
#else
    if (Catalog == LspCatalog32Only)
    {
        // From a 32-bit process we can only install into 32-bit catalog
        rc = WSCInstallProvider(Guid, lpwszLspPath, pProvider, iProviderCount, &ErrorCode);
    }
    else
    {
        // From a 32-bit process, we can't touch the 64-bit catalog at all
        fprintf(stderr, "\n\nError! It is not possible to install into the 64-bit catalog from a 32-bit process!\n\n");
        return SOCKET_ERROR;
    }
#endif
    if (rc == SOCKET_ERROR)
    {
        fprintf(stderr, "InstallProvider: WSCInstallProvider* failed: %d\n", ErrorCode);
    }

    // Go back and enumerate what we just installed
    pEnumProviders = EnumerateProviders(Catalog, &iEnumProviderCount);
    if (pEnumProviders != NULL)
    {
        for(i=0; i < iEnumProviderCount ;i++)
        {
            if (memcmp(&pEnumProviders[i].ProviderId, Guid, sizeof(GUID)) == 0)
            {
                printf("Installed: [%4d] %S\n", pEnumProviders[i].dwCatalogEntryId,
                    pEnumProviders[i].szProtocol);
            }
        }
        FreeProviders(pEnumProviders);
    }

    return rc;
}

BOOL IsEqualProtocolEntries | ( | WSAPROTOCOL_INFOW * | pInfo1,
 |  | WSAPROTOCOL_INFOW * | pInfo2
 | ) |  |

Definition at line 2458 of file instlsp.cpp.

{
    if ( (memcmp(&pInfo1->ProviderId, &pInfo2->ProviderId, sizeof(GUID)) == 0) &&
         (pInfo1->dwServiceFlags1 == pInfo2->dwServiceFlags1) &&
         (pInfo1->dwServiceFlags2 == pInfo2->dwServiceFlags2) &&
         (pInfo1->dwServiceFlags3 == pInfo2->dwServiceFlags3) &&
         (pInfo1->dwServiceFlags4 == pInfo2->dwServiceFlags4) &&
         (pInfo1->ProtocolChain.ChainLen == pInfo2->ProtocolChain.ChainLen) &&
         (pInfo1->iVersion == pInfo2->iVersion) &&
         (pInfo1->iAddressFamily == pInfo2->iAddressFamily) &&
         (pInfo1->iMaxSockAddr == pInfo2->iMaxSockAddr) &&
         (pInfo1->iMinSockAddr == pInfo2->iMinSockAddr) &&
         (pInfo1->iSocketType == pInfo2->iSocketType) &&
         (pInfo1->iProtocol == pInfo2->iProtocol) &&
         (pInfo1->iProtocolMaxOffset == pInfo2->iProtocolMaxOffset) &&
         (pInfo1->iNetworkByteOrder == pInfo2->iNetworkByteOrder) &&
         (pInfo1->iSecurityScheme == pInfo2->iSecurityScheme) &&
         (pInfo1->dwMessageSize == pInfo2->dwMessageSize)
       )
    {
        return TRUE;
    }
    else
    {
        return FALSE;
    }
}

BOOL IsIdInChain | ( | WSAPROTOCOL_INFOW * | pinfo,
 |  | DWORD | Id
 | ) |  |

Definition at line 1308 of file instlsp.cpp.

{
    for(int i=0; i < pinfo->ProtocolChain.ChainLen ;i++)
    {
        if (pinfo->ProtocolChain.ChainEntries[i] == Id)
            return TRUE;
    }
    return FALSE;
}

int _cdecl main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 311 of file instlsp.cpp.

{
    WSADATA             wsd;
    LPWSAPROTOCOL_INFOW pProtocolInfo   = NULL,
                        pDummyEntry     = NULL,
                        pLayeredEntries = NULL;
    WINSOCK_CATALOG     eCatalog        = LspCatalog32Only;
    INT                 iTotalProtocols = 0;
    DWORD               pdwCatalogIdArray[MAX_PROVIDERS],
                        dwCatalogIdArrayCount = 0,       // How many to install over
                        dwRemoveCatalogId;
    BOOL                bInstall                   = TRUE,
                        bInstallOverAll            = FALSE,
                        bRemoveAllLayeredEntries   = FALSE,
                        bPrintProviders            = FALSE,
                        bDisplayOnlyLayeredEntries = FALSE,
                        bVerbose                   = FALSE,
                        bMapLsp                    = FALSE;
    WCHAR               wszLspName[WSAPROTOCOL_LEN];
    char               *lpszLspName=NULL;
    int                 rc, i;
    LSP_ENTRY          *pLspMap=NULL;
    int                 iLspCount=0;

    // Load Winsock
    if (WSAStartup(MAKEWORD(2,2), &wsd) != 0)
    {
        fprintf(stderr, "Unable to load Winsock: %d\n", GetLastError());
        return -1;
    }

    // Parse the command line
    for(i=1; i < argc ;i++)
    {
        if ( (strlen(argv[i]) != 2) && (argv[i][0] != '-') && (argv[i][0] != '/') )
        {
            usage(argv[0]);
        }
        switch (tolower(argv[i][1]))
        {
            case 'a':               // Install LSP over all currently installed providers
                bInstallOverAll = TRUE;
                break;
            case 'c':               // For 64-bit: which catalog to operate on?
                if (i+1 >= argc)
                    usage(argv[0]);
                switch (tolower(argv[i+1][0]))
                {
                    case 'b':       // Both Winsock catalogs
                        eCatalog = LspCatalogBoth;
                        break;
                    case '6':       // 64-bit Winsock catalog only
                        eCatalog = LspCatalog64Only;
                        break;
                    case '3':       // 32-bit Winsock catalog only
                        eCatalog = LspCatalog32Only;
                        break;
                    default:
                        usage(argv[0]);
                        break;
                }
                i++;
                break;
            case 'f':               // Uninstall all layered providers
                bRemoveAllLayeredEntries = TRUE;
                bInstall = FALSE;
                break;
            case 'i':               // install
                bInstall = TRUE;
                break;
            case 'l':               // print the layered providers only
                bPrintProviders = TRUE;
                bDisplayOnlyLayeredEntries = TRUE;
                break;
            case 'm':               // Map and print the LSP structure
                bMapLsp = TRUE;
                bInstall = FALSE;
                break;
            case 'n':               // name of the LSP to install (not the DLL name)
                if (i+1 >= argc)
                    usage(argv[0]);
                lpszLspName = argv[++i];
                break;
            case 'o':               // catalog id (to install over)
                if (i+1 >= argc)
                    usage(argv[0]);
                if (dwCatalogIdArrayCount < MAX_PROVIDERS)
                    pdwCatalogIdArray[dwCatalogIdArrayCount++] = atoi(argv[++i]);
                else
                    printf("Maximum providers exceeded! Ignoring provider %d\n",
                        atoi(argv[++i]));
                break;
            case 'p':               // print the catalog
                bPrintProviders = TRUE;
                bDisplayOnlyLayeredEntries = FALSE;
                break;
            case 'r':               // remove
                bInstall = FALSE;
                if (i+1 >= argc)
                    usage(argv[0]);
                dwRemoveCatalogId = atol(argv[++i]);
                break;
            case 'v':               // verbose mode (when printing with -p option)
                bVerbose = TRUE;
                break;
            default:
                usage(argv[0]);
                break;
        }
    }

#ifndef _WIN64
    if (eCatalog == LspCatalog64Only)
    {
        fprintf(stderr, "\n\nUnable to manipulate 64-bit Winsock catalog from 32-bit process!\n\n");
        return -1;
    }
#endif

    if (bPrintProviders)
    {
        // Print the 32-bit catalog
        if ((eCatalog == LspCatalogBoth) || (eCatalog == LspCatalog32Only))
        {
            printf("\n\nWinsock 32-bit Catalog:\n");
            printf("=======================\n");
            PrintProviders(LspCatalog32Only, bDisplayOnlyLayeredEntries, bVerbose);
        }
        // Print the 64-bit catalog
        if ((eCatalog == LspCatalogBoth) || (eCatalog == LspCatalog64Only))
        {
            printf("\n\nWinsock 64-bit Catalog:\n");
            printf("=======================\n");
            PrintProviders(LspCatalog64Only, bDisplayOnlyLayeredEntries, bVerbose);
        }
    }
    else if (bInstall)
    {
        GUID    ProviderChainGuid;
        DWORD   dwLayeredId;

        //
        // Install the LSP over the given entries. If selected to install over all
        // entries, then enumerate the catalog to obtain all the available providers.
        //

        if (lpszLspName == NULL)
        {
            lpszLspName = DEFAULT_LSP_NAME;
        }

        // Convert the LSP name to UNICODE since the Winsock catalog is all UNICODE
        rc = MultiByteToWideChar(
                CP_ACP,
                0,
                lpszLspName,
                strlen(lpszLspName)+1,
                wszLspName,
                WSAPROTOCOL_LEN
                );
        if (rc == 0)
        {
            fprintf(stderr, "MultiByteToWideChar failed to convert '%s'; Error = %d\n",
                lpszLspName, GetLastError());
            goto cleanup;
        }

        if (bInstallOverAll)
        {
            // Make sure user didn't specify '-a' and '-o' flags
            if (dwCatalogIdArrayCount != 0)
            {
                fprintf(stderr, "\n\nError! Cannot specify both '-a' and '-o' flags!\n\n");
                goto cleanup;
            }

            // Enumerate the appropriate catalog we will be working on
            pProtocolInfo = EnumerateProviders(eCatalog, &iTotalProtocols);
            if (pProtocolInfo == NULL)
            {
                fprintf(stderr, "EnumerateProviders: Unable to enumerate Winsock catalog\n");
                goto cleanup;
            }

            // Get the catalog IDs for all existing providers
            for(i=0; i < iTotalProtocols ;i++)
            {
                if (pProtocolInfo[i].ProtocolChain.ChainLen != LAYERED_PROTOCOL)
                {
                    if (dwCatalogIdArrayCount < MAX_PROVIDERS)
                        pdwCatalogIdArray[dwCatalogIdArrayCount++] = pProtocolInfo[i].dwCatalogEntryId;
                    else
                        printf("Maximum providers exceeded! Ignoring provider %d\n",
                                pProtocolInfo[i].dwCatalogEntryId);
                }
            }

            FreeProviders(pProtocolInfo);
            pProtocolInfo = NULL;
        }

        // Make sure we have at least one provider to install over
        if (dwCatalogIdArrayCount == 0)
        {
            fprintf(stderr, "\n\nError! Must specify at least one provider to layer over!\n\n");
            goto cleanup;
        }

        printf("LSP name is '%S'\n", wszLspName);

        // Create the 'dummy' protocol entry
        pDummyEntry = CreateDummyEntry(eCatalog, pdwCatalogIdArray[0], wszLspName);
        if (pDummyEntry == NULL)
        {
            fprintf(stderr, "CreateDummyEntry failed!\n");
            goto cleanup;
        }

        // 'ProviderGuid' is the GUID for the dummy entry defined in lspguid.cpp

        //
        // NOTE: If you want to create multiple LSPs to install over each other
        //       you have to modify 2 files: lspguid.cpp and lsp.def. In lspguid.cpp
        //       you need to change to GUID to something unique and change the LSP
        //       name (e.g. lsp2.dll) and rebuild. The lsp.def file only needs the
        //       DLL name updated. Also note that the new instlsp.exe
        //       generated will only install lsp2.dll so keep it seperate from the
        //       original lsp.dll and instlsp.exe normally generated.
        //

        // Install the 'dummy' protocol entry for the LSP
        rc = InstallProvider(eCatalog, &ProviderGuid, ProviderPath, pDummyEntry, 1);
        if (rc != NO_ERROR)
        {
            fprintf(stderr, "Unable to install the dummy LSP entry!\n");
            goto cleanup;
        }

        // Don't need this struture any more
        HeapFree(GetProcessHeap(), 0, pDummyEntry);
        pDummyEntry = NULL;

        // Create the layered chain entries
        pLayeredEntries = CreateLayeredEntries(eCatalog, wszLspName, &ProviderGuid, pdwCatalogIdArray, dwCatalogIdArrayCount, &dwLayeredId);
        if (pLayeredEntries == NULL)
        {
            fprintf(stderr, "Unable to create layered provider entries!\n");
            goto cleanup;
        }

        // Create a GUID for the protocol chain entries
        if (UuidCreate(&ProviderChainGuid) != RPC_S_OK)
        {
            fprintf(stderr, "UuidCreate failed: %d\n", GetLastError());
            goto cleanup;
        }

        // Install the layered chain providers
        rc = InstallProvider(eCatalog, &ProviderChainGuid, ProviderPath, pLayeredEntries, dwCatalogIdArrayCount);
        if (rc != NO_ERROR)
        {
            fprintf(stderr, "Unable to install layered chain entries!\n");
            goto cleanup;
        }

        // Reorder the winsock catalog so the layered chain entries appear first
        rc = ReorderCatalog(eCatalog, dwLayeredId);
        if (rc != NO_ERROR)
        {
            fprintf(stderr, "Unable to reorder Winsock catalog!\n");
            goto cleanup;
        }

        HeapFree(GetProcessHeap(), 0, pLayeredEntries);
        pLayeredEntries = NULL;
    }
    else if (bMapLsp)
    {
        // Display the 32-bit LSP catalog map
        if ((eCatalog == LspCatalogBoth) || (eCatalog == LspCatalog32Only))
        {
            printf("\n32-bit Winsock LSP Map:\n\n");

            pProtocolInfo = EnumerateProviders(LspCatalog32Only, &iTotalProtocols);
            if (pProtocolInfo == NULL)
            {
                fprintf(stderr, "EnumerateProviders: Unable to enumerate Winsock catalog\n");
                goto cleanup;
            }

            pLspMap = BuildLspMap(pProtocolInfo, iTotalProtocols, &iLspCount);
            if (pLspMap != NULL)
            {
                PrintLspMap(pLspMap, iLspCount);

                FreeLspMap(pLspMap, iLspCount);
                pLspMap = NULL;
            }
            else
            {
                printf("\nNo LSPs installed\n\n");
            }
            FreeProviders(pProtocolInfo);
            pProtocolInfo = NULL;
        }
        // Display the 64-bit LSP catalog map
        if ((eCatalog == LspCatalogBoth) || (eCatalog == LspCatalog64Only))
        {
            printf("\n64-bit Winsock LSP Map:\n\n");

            pProtocolInfo = EnumerateProviders(LspCatalog64Only, &iTotalProtocols);
            if (pProtocolInfo == NULL)
            {
                fprintf(stderr, "main: EnumerateProviders: Unable to enumerate Winsock catalog\n");
                goto cleanup;
            }

            pLspMap = BuildLspMap(pProtocolInfo, iTotalProtocols, &iLspCount);
            if (pLspMap != NULL)
            {
                PrintLspMap(pLspMap, iLspCount);

                FreeLspMap(pLspMap, iLspCount);
                pLspMap = NULL;
            }
            else
            {
                printf("\nNo LSPs installed\n\n");
            }
            FreeProviders(pProtocolInfo);
            pProtocolInfo = NULL;
        }
    }
    else
    {
        if (bRemoveAllLayeredEntries == TRUE)
        {
            if ((eCatalog == LspCatalogBoth) || (eCatalog == LspCatalog32Only))
                RemoveAllLayeredEntries(LspCatalog32Only);

            if ((eCatalog == LspCatalogBoth) || (eCatalog == LspCatalog64Only))
                RemoveAllLayeredEntries(LspCatalog64Only);
        }
        else
        {
            //
            // See if we're on a platform that supports WSCUpdateProvider. If so then
            // uninstalling an LSP is easy; otherwise, it is very painful if you're
            // removing an LSP that has other LSPs on top if it.
            //
            hModule = LoadLibraryA("ws2_32.dll");
            if (hModule == NULL)
            {
                fprintf(stderr, "main: Unable to load ws2_32.dll: %d\n", GetLastError());
                goto cleanup;
            }
            else
            {
                fnWscUpdateProvider = (LPWSCUPDATEPROVIDER)GetProcAddress(hModule, "WSCUpdateProvider");

                if ((eCatalog == LspCatalogBoth) || (eCatalog == LspCatalog32Only))
                    RemoveProvider(LspCatalog32Only, dwRemoveCatalogId);

                if ((eCatalog == LspCatalogBoth) || (eCatalog == LspCatalog64Only))
                    RemoveProvider(LspCatalog64Only, dwRemoveCatalogId);

                FreeLibrary(hModule);
                hModule = NULL;
            }

        }
    }

cleanup:

    //
    // Free any dynamic allocations and/or handles
    //

    if (pLayeredEntries)
        HeapFree(GetProcessHeap(), 0, pLayeredEntries);

    if (pDummyEntry)
        HeapFree(GetProcessHeap(), 0, pDummyEntry);

    if (pProtocolInfo)
        FreeProviders(pProtocolInfo);

    if (hModule != NULL)
        FreeLibrary(hModule);

    if (pLspMap)
        FreeLspMap(pLspMap, iLspCount);

    WSACleanup();
    return 0;
}

void MapNewEntriesToOld | ( | LSP_ENTRY * | pEntry,
 |  | WSAPROTOCOL_INFOW * | pProvider,
 |  | int | iProviderCount
 | ) |  |

Definition at line 2424 of file instlsp.cpp.

{
    int     i, j;

    for(i=0; i < pEntry->Count ;i++)
    {
        for(j=0; j < iProviderCount ;j++)
        {
            if ( IsEqualProtocolEntries( &pEntry->LayeredEntries[i], &pProvider[j] ) )
            {
                pEntry->LayeredEntries[i].dwProviderReserved = pProvider[j].dwCatalogEntryId;
                break;
            }
        }
    }
}

void PrintLspMap | ( | LSP_ENTRY * | pLspMap,
 |  | int | iLspCount
 | ) |  |

Definition at line 2188 of file instlsp.cpp.

{
    WCHAR   szGuidString[MAX_PATH];
    int     i, j, k;

    if (pLspMap == NULL)
    {
        printf("\tNo LSPs currently installed\n\n");
    }
    else
    {
        for(i=0; i < iLspCount ;i++)
        {
            // Display the LSP name and its DLL (and path)
            printf("%3d LSP: %ws   DLL '%ws'\n", i, pLspMap[i].DummyEntry.szProtocol,
                pLspMap[i].wszLspDll);

            // Display the GUIDs under which the layered entries of this LSP are installed
            printf("\t LSP Installed under %d GUIDs\n", pLspMap[i].LayeredGuidCount);
            for(k=0; k < pLspMap[i].LayeredGuidCount ;k++)
            {
                StringFromGUID2(pLspMap[i].LayeredGuids[k], szGuidString, MAX_PATH-1);
                printf("\t\t%ws\n", szGuidString);
            }

            // Display the layered entries and the protocol chains
            for(j=0; j < pLspMap[i].Count ;j++)
            {
                printf("\t Layer %ws Chain %d [ ", pLspMap[i].LayeredEntries[j].szProtocol,
                    pLspMap[i].LayeredEntries[j].ProtocolChain.ChainLen);

                for(k=0; k < pLspMap[i].LayeredEntries[j].ProtocolChain.ChainLen ;k++)
                {
                    printf("%d ", pLspMap[i].LayeredEntries[j].ProtocolChain.ChainEntries[k]);
                }
                printf("]\n");
            }
        }
    }
}

void PrintProviders | ( | WINSOCK_CATALOG | Catalog,
 |  | BOOL | bLayeredOnly,
 |  | BOOL | bVerbose
 | ) |  |

Definition at line 749 of file instlsp.cpp.

{
    WSAPROTOCOL_INFOW  *pProtocolInfo=NULL;
    INT                 iProtocolCount=0,
                        i;

  pProtocolInfo = EnumerateProviders(Catalog, &iProtocolCount);
    if (pProtocolInfo == NULL)
    {
        return;
    }
    for(i=0; i < iProtocolCount ;i++)
    {
        if (!bLayeredOnly)
        {
            if (bVerbose)
                PrintProtocolInfo(&pProtocolInfo[i]);
            else
                printf("%04d - %S\n", pProtocolInfo[i].dwCatalogEntryId,
                      pProtocolInfo[i].szProtocol);
        }
        else if (pProtocolInfo[i].ProtocolChain.ChainLen == LAYERED_PROTOCOL)
        {
            if (bVerbose)
                PrintProtocolInfo(&pProtocolInfo[i]);
            else
                printf("%04d - %S\n", pProtocolInfo[i].dwCatalogEntryId,
                      pProtocolInfo[i].szProtocol);
        }
    }
    FreeProviders(pProtocolInfo);

    return;
}

void PruneLspMap | ( | LSP_ENTRY * | pLspMap,
 |  | int | iLspCount,
 |  | DWORD * | pdwRemovedProviders,
 |  | int | iRemoveCount
 | ) |  |

Definition at line 2268 of file instlsp.cpp.

{
    int i, j, k;

    // Go through all LSPs
    for(i=0; i < iLspCount ;i++)
    {
        // Go through all providers belonging to this LSP
        for(j=0; j < pLspMap[i].Count ;j++)
        {
            // Search for a removed provider
            for(k=0; k < iRemoveCount ;k++)
            {
                RemoveIdFromChain(&pLspMap[i].LayeredEntries[j], pdwRemovedProviders[k]);
            }
        }
    }
}

int RemoveAllLayeredEntries ( WINSOCK_CATALOG Catalog )

Definition at line 1727 of file instlsp.cpp.

{
    WSAPROTOCOL_INFOW   *pProviders=NULL,
                        *pAssociated=NULL;
    WCHAR                szGuidString[MAX_PATH];
    LSP_ENTRY           *pLspMap=NULL;
    INT                  iProviderCount,
                         iAssociatedCount,
                         iLspCount,
                         Status,
                         rc,
                         i, j, k;

    Status = NO_ERROR;

    // First enumerate the catalog
    pProviders = EnumerateProviders(Catalog, &iProviderCount);
    if (pProviders == NULL)
    {
        fprintf(stderr, "RemoveAllLayeredEntries: Unable to enumerate catalog!\n");
        Status = SOCKET_ERROR;
        goto cleanup;
    }

    // Build a mapping of the LSPs installed on the system
    pLspMap = BuildLspMap(pProviders, iProviderCount, &iLspCount);
    if (pLspMap == NULL)
    {
        printf("\nNo LSPs to remove!\n");
    }
    else
    {
        printf("\n%d LSPs installed:\n", iLspCount);
        for(i=0; i < iLspCount ;i++)
        {
            printf("   %d: %ws with %d layered entries\n",
                pLspMap[i].DummyEntry.dwCatalogEntryId, pLspMap[i].DummyEntry.szProtocol,
                pLspMap[i].Count);
        }

        printf("\nRemoving LSPs...\n\n");

        for(i=0; i < iLspCount ;i++)
        {
            // First remove the dummy entry
            printf("Removing dummy entry for: %ws\n", pLspMap[i].DummyEntry.szProtocol);
            rc = DeinstallProvider(Catalog, &pLspMap[i].DummyEntry.ProviderId);

            printf("Removing the associated layered entries with GUIDs:\n");
            for(j=0; j < pLspMap[i].LayeredGuidCount ;j++)
            {
                StringFromGUID2(pLspMap[i].LayeredGuids[j], szGuidString, MAX_PATH-1);
                printf("\tGUID: %ws\n", szGuidString);

                // Get a list of all providers under this GUID so we can print it out
                pAssociated = GetLayeredEntriesByGuid(
                        pLspMap[i].LayeredEntries,
                        pLspMap[i].Count,
                       &pLspMap[i].LayeredGuids[j],
                       &iAssociatedCount
                        );
                if (pAssociated == NULL)
                {
                    fprintf(stderr, "RemoveAllLayeredProviders: GetLayeredEntriesByGuid failed!\n");
                    goto cleanup;
                }

                for(k=0; k < iAssociatedCount ;k++)
                {
                    printf("\t  %d: %ws\n", pAssociated[k].dwCatalogEntryId,
                            pAssociated[k].szProtocol);
                }

                HeapFree(GetProcessHeap(), 0, pAssociated);
                pAssociated = NULL;

                rc = DeinstallProvider(Catalog, &pLspMap[i].LayeredGuids[j]);
                if (rc == SOCKET_ERROR)
                {
                    fprintf(stderr, "RemoveAllLayeredProviders: DeinstallProvider failed!\n");
                }
                else
                {
                    printf("\tUninstalled providers for %ws\n", szGuidString);
                }
            }
        }

        FreeLspMap(pLspMap, iLspCount);
        pLspMap = NULL;
    }

cleanup:

    if (pProviders)
        FreeProviders(pProviders);

    if (pLspMap)
        FreeLspMap(pLspMap, iLspCount);

    if (pAssociated)
        HeapFree(GetProcessHeap(), 0, pAssociated);

    return Status;
}

int RemoveIdFromChain | ( | WSAPROTOCOL_INFOW * | pinfo,
 |  | DWORD | CatalogId
 | ) |  |

Definition at line 1282 of file instlsp.cpp.

{
    int     i, j;

    for(i=0; i < pinfo->ProtocolChain.ChainLen ;i++)
    {
        if (pinfo->ProtocolChain.ChainEntries[i] == CatalogId)
        {
            for(j=i; j < pinfo->ProtocolChain.ChainLen-1 ; j++)
            {
                pinfo->ProtocolChain.ChainEntries[j] = pinfo->ProtocolChain.ChainEntries[j+1];
            }
            pinfo->ProtocolChain.ChainLen--;
            return 0;
        }
    }
    return 1;
}

int RemoveProvider | ( | WINSOCK_CATALOG | Catalog,
 |  | DWORD | ProviderId
 | ) |  |

Definition at line 1326 of file instlsp.cpp.

{
    WSAPROTOCOL_INFOW   *pProvider=NULL,
                        *pLayeredEntries=NULL;
    LSP_ENTRY           *pLspMap=NULL;
    DWORD               *pdwRemovedProviders=NULL,
                        *pdwCatalogOrder=NULL;
    INT                  iOriginalProviderCount=0,
                         iProviderCount=0,
                         iRemoveCount=0,
                         iLayerCount=0,
                         iLspCount=0,
                         ErrorCode,
                         Status,
                         rc,
                         i, j;
    WCHAR                wszProviderPath[DEFAULT_PATH_LEN];
    INT                  iProviderPathLen=DEFAULT_PATH_LEN-1;

    Status = NO_ERROR;

    // Enumerate the catalog
    pProvider = EnumerateProviders(Catalog, &iProviderCount);
    if (pProvider == NULL)
    {
        fprintf(stderr, "RemoveProvider: Unable to enumerate catalog!\n");
        Status = SOCKET_ERROR;
        goto cleanup;
    }

    // Make sure this is a layered provider ID
    for(i=0; i < iProviderCount ;i++)
    {
        if ((pProvider[i].dwCatalogEntryId == dwProviderId) &&
            (pProvider[i].ProtocolChain.ChainLen == BASE_PROTOCOL))
        {
            fprintf(stderr, "\n\nError! Attempting to remove base provider: %S\n\n",
                pProvider[i].szProtocol);
            Status = SOCKET_ERROR;
            goto cleanup;
        }
    }

    // First count how many entries directly belong to this provider
    iRemoveCount = 0;
    for(i=0; i < iProviderCount ;i++)
    {
        if (((pProvider[i].ProtocolChain.ChainLen > 0) &&
             (pProvider[i].ProtocolChain.ChainEntries[0] == dwProviderId) ) ||
             (pProvider[i].dwCatalogEntryId == dwProviderId))
        {
            iRemoveCount++;
        }
    }

    // Save off the catalog entry IDs of the removed providers
    pdwRemovedProviders = (DWORD *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, iRemoveCount * sizeof(DWORD));
    if (pdwRemovedProviders == NULL)
    {
        fprintf(stderr, "\n\nError! HeapAlloc failed: %d\n", GetLastError());
        Status = SOCKET_ERROR;
        goto cleanup;
    }

    iRemoveCount = 0;

    // Uninstall the LSP dummy and chain entries
    for(i=0; i < iProviderCount ;i++)
    {
        if (((pProvider[i].ProtocolChain.ChainLen > 0) &&
             (pProvider[i].ProtocolChain.ChainEntries[0] == dwProviderId) ) ||
            (pProvider[i].dwCatalogEntryId == dwProviderId))
        {
            // Save removed catalog entry ID
            pdwRemovedProviders[iRemoveCount++] = pProvider[i].dwCatalogEntryId;

            // Display message and actually remove the provider
            printf("Removing: [%4d] %S\n", pProvider[i].dwCatalogEntryId,
                pProvider[i].szProtocol);
            DeinstallProvider(Catalog, &pProvider[i].ProviderId);
        }
    }

    // Enumerate the catalog again -- we may need to do more cleanup
    FreeProviders(pProvider);

    pProvider = EnumerateProviders(Catalog, &iProviderCount);
    if (pProvider == NULL)
    {
        fprintf(stderr, "RemoveProvider: Unable to enumerate Winsock catalog!\n");
        Status = SOCKET_ERROR;
        goto cleanup;
    }

    // If we're on Windows XP then life is easy
    if (fnWscUpdateProvider != NULL)
    {
        for(i=0; i < iProviderCount ;i++)
        {
            for(j=0; j < iRemoveCount ;j++)
            {
                if (IsIdInChain(&pProvider[i], pdwRemovedProviders[j]) == TRUE)
                {
                    // Remove the defunct LSP provider id
                    RemoveIdFromChain(&pProvider[i], pdwRemovedProviders[j]);

                    // Get the path to this provider
                    rc = WSCGetProviderPath(
                            &pProvider[i].ProviderId,
                            wszProviderPath,
                            &iProviderPathLen,
                            &ErrorCode
                            );
                    if (rc == SOCKET_ERROR)
                    {
                        fprintf(stderr, "RemoveProvider: WSCGetProviderPath failed: %d\n",
                                ErrorCode);
                        continue;
                    }

                    // Update it's provider entry
                    rc = fnWscUpdateProvider(
                            &pProvider[i].ProviderId,
                            wszProviderPath,
                            &pProvider[i],
                            1,
                            &ErrorCode
                            );
                    if (rc == SOCKET_ERROR)
                    {
                        fprintf(stderr, "RemoveProvider: WSCUpdateProvider failed: %d\n",
                                ErrorCode);
                    }
                    break;
                }
            }
        }

    }
    else
    {
        BOOL bDependent;

        // First check to see if any other LSPs were layered over ours
        bDependent = FALSE;
        for(i=0; (i < iProviderCount) && (!bDependent) ;i++)
        {
            for(j=0; j < iRemoveCount ;j++)
            {
                if ( IsIdInChain(&pProvider[i], pdwRemovedProviders[j]) )
                {
                    bDependent = TRUE;
                    break;
                }
            }
        }

        if (bDependent == TRUE)
        {
            // Yuck - need to fix up all the dependent providers layered
            // above our LSP. This is a lot more complicated without the
            // WSCUpdateProvider function. The problem is that to change
            // the protocol chains of the providers layered over the
            // removed LSP, you have to uninstall it, modify the chain,
            // and reinstall it. This itself isn't too bad but if there
            // are other LSPs layered over the one just re-installed, it
            // needs to be fixed now (since by re-isntalling the LSP, it
            // gets assigned a different provider ID).

            // In this case we're taking the "easy" way out. We will uninstall
            // ALL LSPs and reinstall them regardless of whether or not
            // they are dependent. Otherwise, the logic for determing which
            // other LSPs are affected by changes gets complicated and would
            // be prone to (more) errors.

            // First save off the catalog order

            // NOTE: iProviderCount is assumed to be an invariant throughout this
            //       process. If someone else is installing LSPs while we're doing
            //       this we'd be in trouble anyway.

            iOriginalProviderCount = iProviderCount;

            pdwCatalogOrder = (DWORD *)HeapAlloc(
                    GetProcessHeap(),
                    HEAP_ZERO_MEMORY,
                    sizeof(DWORD) * iOriginalProviderCount
                    );
            if (pdwCatalogOrder == NULL)
            {
                fprintf(stderr, "RemoveProvider: HeapAlloc failed: %d\n", GetLastError());
                goto cleanup;
            }

            for(i=0; i < iProviderCount ;i++)
            {
                pdwCatalogOrder[i] = pProvider[i].dwCatalogEntryId;
            }

            // Obtain the mapping of the LSP install order
            pLspMap = BuildLspMap(pProvider, iProviderCount, &iLspCount);
            if (pLspMap == NULL)
            {
                fprintf(stderr, "RemoveProvider: BuildLspMap returned NULL!\n");
                goto cleanup;
            }

            // Remove all instances of the removed LSP from the LSP map chains
            PruneLspMap(pLspMap, iLspCount, pdwRemovedProviders, iRemoveCount);

            // First uninstall all the LSPs
            for(i=0; i < iLspCount ;i++)
            {
                // Uninstall the dummy entry
                DeinstallProvider(Catalog, &pLspMap[i].DummyEntry.ProviderId);

                // Uninstall all the associated layered entries
                for(j=0; j < pLspMap[i].LayeredGuidCount ;j++)
                {
                    DeinstallProvider(Catalog, &pLspMap[i].LayeredGuids[j]);
                }
            }

            // No go back and re-install them
            for(i=0; i < iLspCount ;i++)
            {
                rc = InstallProvider(
                        Catalog,
                       &pLspMap[i].DummyEntry.ProviderId,
                        pLspMap[i].wszLspDll,
                       &pLspMap[i].DummyEntry,
                        1
                        );
                if (rc != NO_ERROR)
                {
                    fprintf(stderr, "RemoveProvider: Unable to install dummy provider for %ws; error %d\n",
                        pLspMap[i].DummyEntry.szProtocol,
                        rc
                        );
                    goto cleanup;
                }

                // Enumerate the catalog
                FreeProviders(pProvider);

                pProvider = EnumerateProviders(Catalog, &iProviderCount);
                if (pProvider == NULL)
                {
                    fprintf(stderr, "RemoveProvider: Unable to enumerate Winsock catalog!\n");
                    Status = SOCKET_ERROR;
                    goto cleanup;
                }

                // Find the new ID for the dummy entry
                for(j=0; j < iProviderCount ;j++)
                {
                    if ( memcmp( &pProvider[j].ProviderId, &pLspMap[i].DummyEntry.ProviderId, sizeof(GUID) ) == 0 )
                    {
                        // Save the new ID
                        pLspMap[i].DummyEntry.dwProviderReserved = pProvider[j].dwCatalogEntryId;
                        break;
                    }
                }

                // Go update all occurences of the old ID with the new ID
                UpdateLspMap(
                    pLspMap,
                    iLspCount,
                    pLspMap[i].DummyEntry.dwCatalogEntryId,
                    pLspMap[i].DummyEntry.dwProviderReserved,
                    pdwCatalogOrder,
                    iOriginalProviderCount
                    );

                // Install the layered entries associated with this LSP
                for(j=0; j < pLspMap[i].LayeredGuidCount ;j++)
                {
                    pLayeredEntries = GetLayeredEntriesByGuid(
                            pLspMap[i].LayeredEntries,
                            pLspMap[i].Count,
                           &pLspMap[i].LayeredGuids[j],
                           &iLayerCount
                            );
                    if (pLayeredEntries == NULL)
                    {
                        fprintf(stderr, "GetLayeredEntriesByGuid: Failed!\n");
                        continue;
                    }

                    // Reinstalled the layered entries
                    rc = InstallProvider(
                            Catalog,
                           &pLspMap[i].LayeredGuids[j],
                            pLspMap[i].wszLspDll,
                            pLayeredEntries,
                            iLayerCount
                            );
                    if (rc != NO_ERROR)
                    {
                        fprintf(stderr, "RemoveProvider: Unable to install layered provider(s) for %ws; error %d\n",
                            pLspMap[i].DummyEntry.szProtocol,
                            rc
                            );
                        goto cleanup;
                    }

                    HeapFree(GetProcessHeap(), 0, pLayeredEntries);
                    pLayeredEntries = NULL;
                }

                // Enumerate the catalog
                FreeProviders(pProvider);

                pProvider = EnumerateProviders(Catalog, &iProviderCount);
                if (pProvider == NULL)
                {
                    fprintf(stderr, "RemoveProvider: Unable to enumerate Winsock catalog!\n");
                    Status = SOCKET_ERROR;
                    goto cleanup;
                }

                // Now go through and find the updated catalog entry IDs
                MapNewEntriesToOld(&pLspMap[i], pProvider, iProviderCount);

                // Now update the LSP map to reference these new IDs instead of the old
                for(j=0; j < pLspMap[i].Count ;j++)
                {
                    UpdateLspMap(
                        pLspMap,
                        iLspCount,
                        pLspMap[i].LayeredEntries[j].dwCatalogEntryId,
                        pLspMap[i].LayeredEntries[j].dwProviderReserved,
                        pdwCatalogOrder,
                        iOriginalProviderCount
                        );
                }
            }

            // Now all the LSPs are back in place -- we need to reorder the catalog
            // back to the way it was
            #ifdef _WIN64
            if (Catalog == LspCatalog32Only)
            {
                rc = WSCWriteProviderOrder32(pdwCatalogOrder, iProviderCount);
            }
            else
            {
                rc = WSCWriteProviderOrder(pdwCatalogOrder, iProviderCount);
            }
            #else
                rc = WSCWriteProviderOrder(pdwCatalogOrder, iProviderCount);
            #endif
            if (rc == SOCKET_ERROR)
            {
                fprintf(stderr, "RemoveProvider: WSCWriteProviderOrder failed: %d\n", WSAGetLastError());
            }

            printf("Catalog Order: ");
            for(i=0; i < iProviderCount ;i++)
            {
                printf("%d ", pdwCatalogOrder[i]);
            }
            printf("\n");

            // Free the catalog order info
            HeapFree(GetProcessHeap(), 0, pdwCatalogOrder);
            pdwCatalogOrder = NULL;
        }
    }

cleanup:

    //
    // Cleanup allocations
    //

    if (pLayeredEntries)
        HeapFree(GetProcessHeap(), 0, pLayeredEntries);

    if (pProvider)
        FreeProviders(pProvider);

    if (pdwRemovedProviders)
        HeapFree(GetProcessHeap(), 0, pdwRemovedProviders);

    if (pLspMap)
        FreeLspMap(pLspMap, iLspCount);

    if (pdwCatalogOrder)
        HeapFree(GetProcessHeap(), 0, pdwCatalogOrder);

    return Status;
}

DWORD * ReorderACatalog | ( | WINSOCK_CATALOG | Catalog,
 |  | DWORD | dwLayerId,
 |  | INT * | dwEntryCount
 | ) |  |

Definition at line 1128 of file instlsp.cpp.

{
    WSAPROTOCOL_INFOW   *pProvider=NULL;
    DWORD               *pdwProtocolOrder=NULL;
    INT                  iProviderCount,
                         idx,
                         i;

    // Validate parameters
    if ((dwEntryCount == NULL) || (Catalog == LspCatalogBoth))
        return NULL;

    // Enumerate the catalog
    pProvider = EnumerateProviders(Catalog, &iProviderCount);
    if (pProvider == NULL)
    {
        fprintf(stderr, "ReorderACatalog: Unable to enumerate Winsock catalog!\n");
        goto cleanup;
    }

    // Allocate space for the array of catalog IDs (the catalog order)
    pdwProtocolOrder = (DWORD *)HeapAlloc(GetProcessHeap(), 0, sizeof(DWORD) * iProviderCount);
    if (pdwProtocolOrder == NULL)
    {
        fprintf(stderr, "ReorderACatalog: HeapAlloc failed: %d\n", GetLastError());
        goto cleanup;
    }

    idx = 0;

    // First put all the layered entries at the head of the catalog
    for(i=0; i < iProviderCount ;i++)
    {
        if (IsIdInChain(&pProvider[i], dwLayerId) == TRUE)
        {
            pdwProtocolOrder[idx++] = pProvider[i].dwCatalogEntryId;
        }
    }

    // Put the remaining entries after the layered chain entries
    for(i=0; i < iProviderCount ;i++)
    {
        if (IsIdInChain(&pProvider[i], dwLayerId) == FALSE)
        {
            pdwProtocolOrder[idx++] = pProvider[i].dwCatalogEntryId;
        }
    }

cleanup:

    if (pProvider)
        FreeProviders(pProvider);

    // Update the count
    *dwEntryCount = iProviderCount;

    return pdwProtocolOrder;
}

int ReorderCatalog | ( | WINSOCK_CATALOG | Catalog,
 |  | DWORD | dwLayeredId
 | ) |  |

Definition at line 1201 of file instlsp.cpp.

{
    DWORD     *pdwProtocolOrder;
    INT        iProviderCount,
               rc;

    rc = NO_ERROR;
#ifdef _WIN64
    if ((Catalog == LspCatalog32Only) || (Catalog == LspCatalogBoth))
    {
        printf("Reordering 32-bit Winsock catalog...\n");
        pdwProtocolOrder = ReorderACatalog(LspCatalog32Only, dwLayeredId, &iProviderCount);
        if (pdwProtocolOrder == NULL)
        {
            fprintf(stderr, "ReorderCatalog: ReorderACatalog failed!\n");
        }
        else
        {
            rc = WSCWriteProviderOrder32(pdwProtocolOrder, iProviderCount);
            if (rc == SOCKET_ERROR)
            {
                fprintf(stderr, "ReorderCatalog: WSCWriteProviderOrder32 failed: %d\n", rc);
            }

            HeapFree(GetProcessHeap(), 0, pdwProtocolOrder);
            pdwProtocolOrder = NULL;
        }
    }
    if ((Catalog == LspCatalog64Only) || (Catalog == LspCatalogBoth))
    {
        printf("Reordering 64-bit Winsock catalog...\n");
        pdwProtocolOrder = ReorderACatalog(LspCatalog64Only, dwLayeredId, &iProviderCount);
        if (pdwProtocolOrder == NULL)
        {
            fprintf(stderr, "ReorderCatalog: ReorderACatalog failed!\n");
        }
        else
        {
            rc = WSCWriteProviderOrder(pdwProtocolOrder, iProviderCount);
            if (rc == SOCKET_ERROR)
            {
                fprintf(stderr, "ReorderCatalog: WSCWriteProviderOrder failed: %d\n", rc);
            }

            HeapFree(GetProcessHeap(), 0, pdwProtocolOrder);
            pdwProtocolOrder = NULL;
        }
    }
#else
    if ((Catalog == LspCatalog32Only) || (Catalog == LspCatalogBoth))
    {
        printf("Reordering 32-bit Winsock catalog...\n");
        pdwProtocolOrder = ReorderACatalog(LspCatalog32Only, dwLayeredId, &iProviderCount);
        if (pdwProtocolOrder == NULL)
        {
            fprintf(stderr, "ReorderCatalog: ReorderACatalog failed!\n");
        }
        else
        {
            rc = WSCWriteProviderOrder(pdwProtocolOrder, iProviderCount);
            if (rc == SOCKET_ERROR)
            {
                fprintf(stderr, "ReorderCatalog: WSCWriteProviderOrder failed: %d\n", rc);
            }

            HeapFree(GetProcessHeap(), 0, pdwProtocolOrder);
            pdwProtocolOrder = NULL;
        }
    }
#endif

    return rc;
}

void UpdateLspMap | ( | LSP_ENTRY * | pLspMap,
 |  | int | iLspCount,
 |  | DWORD | dwOldValue,
 |  | DWORD | dwNewValue,
 |  | DWORD * | pdwCatalogOrder,
 |  | int | iProviderCount
 | ) |  |

Definition at line 2306 of file instlsp.cpp.

{
    int i, j, k;

    // Update the LSP_ENTRY mappings with the new value
    for(i=0; i < iLspCount ;i++)
    {
        // Go through all providers beloging to this LSP
        for(j=0; j < pLspMap[i].Count ;j++)
        {
            // Go through the protocol chain and update references if they match
            for(k=0; k < pLspMap[i].LayeredEntries[j].ProtocolChain.ChainLen ;k++)
            {
                if (pLspMap[i].LayeredEntries[j].ProtocolChain.ChainEntries[k] == dwOldValue)
                {
                    pLspMap[i].LayeredEntries[j].ProtocolChain.ChainEntries[k] = dwNewValue;
                }
            }
        }
    }

    // Update the provider order mapping
    for(i=0; i < iProviderCount ;i++)
    {
        if (pdwCatalogOrder[i] == dwOldValue)
            pdwCatalogOrder[i] =  dwNewValue;
    }
}

void usage ( char * progname )

Definition at line 715 of file instlsp.cpp.

{
    printf("usage: %s -i -r [CatId] -o [CatId] -p\n", progname);
    printf(
           "       -a           Install over all providers (base or layered)\n"
           "                       Cannot be combined with '-o' option\n"
           "       -c Catalog   Indicates which catalog to operate on\n"
           "          b            Both 64-bit and 32-bit Winsock catalogs\n"
           "          6            64-bit Winsock catalog only\n"
           "          3            32-bit Winsock catalog only\n"
           "       -i           Install LSP\n"
           "       -f           Remove all layered entries\n"
           "       -l           Print layered providers only\n"
           "       -m           Display a map of the LSPs and the order they are\n"
           "                       installed in\n"
           "       -n Str       Name of LSP\n"
           "       -o CatId     Install over specified LSP\n"
           "                       This option may be specified multiple times\n"
           "                       Cannot be combined with '-a' option\n"
           "       -p           Print all layers and their catalog IDs\n"
           "       -r CatId     Remove LSP\n"
           "       -v           Print verbose catalog information (used with -p)\n"
           );
    ExitProcess(-1);
}

Variable Documentation

LPWSCUPDATEPROVIDER fnWscUpdateProvider = NULL

Definition at line 138 of file instlsp.cpp.

HMODULE hModule = NULL

Definition at line 139 of file instlsp.cpp.

Generated on Wed Nov 13 2024 16:54:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/LSP/lspguid.cpp File Reference

  • NetDS
  • WinSock
  • LSP
Variables

lspguid.cpp File Reference

#include "provider.h"
#include <windows.h>

Go to the source code of this file.

Variables

GUID | ProviderGuid
WCHAR * | ProviderPath = "%SYSTEMROOT%\\system32\\lsp.dll"

Variable Documentation

GUID ProviderGuid
Initial value:
 {
    0xc5fabbd0,
    0x9736,
    0x11d1,
    {0x93, 0x7f, 0x00, 0xc0, 0x4f, 0xad, 0x86, 0x0d}
}

Definition at line 34 of file lspguid.cpp.

WCHAR* ProviderPath = "%SYSTEMROOT%\\system32\\lsp.dll"

Definition at line 29 of file lspguid.cpp.

Generated on Wed Nov 13 2024 16:54:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/LSP/overlap.cpp File Reference

  • NetDS
  • WinSock
  • LSP
Defines | Functions | Variables

overlap.cpp File Reference

#include "provider.h"
#include <stdio.h>
#include <stdlib.h>

Go to the source code of this file.

Defines

#define | DEFAULT_POOL_COUNT 100
#define | MAX_PROC_COUNT 32

Functions

int | AllocateFreePool ()
VOID CALLBACK | CallUserApcProc (ULONG_PTR Context)
void | CheckForContextCleanup (WSAOVERLAPPEDPLUS *ol)
WSAOVERLAPPEDPLUS * DequeueOverlappedOperation ()
int | EnqueueOverlappedOperation (WSAOVERLAPPEDPLUS *op)
int | ExecuteOverlappedOperation (WSAOVERLAPPEDPLUS *lpOverlapped, BOOL bSynchronous)
LPWSAOVERLAPPEDPLUS | GetOverlappedStructure (SOCK_INFO *SocketContext)
int | InitOverlappedManager ()
void CALLBACK | IntermediateCompletionRoutine (DWORD dwError, DWORD cbTransferred, LPWSAOVERLAPPED lpOverlapped, DWORD dwFlags)
DWORD WINAPI | OverlappedManagerThread (LPVOID lpParam)
void | PutbackOverlappedStructure (WSAOVERLAPPEDPLUS *olp)
int | QueueOverlappedOperation (WSAOVERLAPPEDPLUS *ol, SOCK_INFO *SocketContext)
void | SetOverlappedInProgress (OVERLAPPED *ol)
void | StartOverlappedManager ()
int | StopOverlappedManager ()

Variables

LPWSAOVERLAPPEDPLUS | FreePool = NULL
DWORD | gdwThreadCount = -1
HANDLE | ghIocp = NULL
HANDLE | ghWakeupSemaphore = NULL
CRITICAL_SECTION | gOverlappedCS
HANDLE | gWorkerThread [MAX_PROC_COUNT]
HANDLE hLspHeap
LPWSAOVERLAPPEDPLUS | OverlappedPool = NULL
LPWSAOVERLAPPEDPLUS | PendingEnd = NULL
LPWSAOVERLAPPEDPLUS | PendingStart = NULL

Define Documentation

#define DEFAULT_POOL_COUNT 100

Definition at line 24 of file overlap.cpp.

#define MAX_PROC_COUNT 32

Definition at line 25 of file overlap.cpp.

Function Documentation

int AllocateFreePool ( )

Definition at line 76 of file overlap.cpp.

{
    DWORD     i;

    //
    // Allocate our overlapped structures as well as zeroes it out
    //
    OverlappedPool = (LPWSAOVERLAPPEDPLUS)HeapAlloc(
                        hLspHeap,
                        HEAP_ZERO_MEMORY,
                        sizeof(WSAOVERLAPPEDPLUS) * DEFAULT_POOL_COUNT);

    if (!OverlappedPool)
    {
        dbgprint("out of memory!");
        return WSAENOBUFS;
    }
    // Initialize our overlapped structures
    //
    for(i=0; i < DEFAULT_POOL_COUNT-1 ;i++)
    {
        OverlappedPool[i].next = &OverlappedPool[i+1];
    }
    FreePool  = &OverlappedPool[0];

    return NO_ERROR;
}

VOID CALLBACK CallUserApcProc ( ULONG_PTR Context )

Definition at line 1059 of file overlap.cpp.

{
    LPOVERLAPPED                        lpOverlapped;
    LPWSAOVERLAPPED_COMPLETION_ROUTINE  UserCompletionRoutine;

    lpOverlapped = (LPOVERLAPPED) Context;
    UserCompletionRoutine = (LPWSAOVERLAPPED_COMPLETION_ROUTINE)lpOverlapped->Internal;
    lpOverlapped->Internal = lpOverlapped->Offset; // To make sure it
                                                   // in no longer is
                                                   // WSS_OPERATION_IN_PROGRESS

    UserCompletionRoutine (
        (DWORD)lpOverlapped->Offset,
        (DWORD)lpOverlapped->InternalHigh,
        lpOverlapped,
        (DWORD)lpOverlapped->OffsetHigh
        );
    return;
}

void CheckForContextCleanup ( WSAOVERLAPPEDPLUS * ol )

Definition at line 1088 of file overlap.cpp.

{
    SOCK_INFO *SocketContext=NULL;
    int        Error;

    SocketContext = FindAndLockSocketContext(ol->CallerSocket, &Error);
    if (SocketContext == NULL)
    {
        return;
    }
    AcquireSocketLock(ol->SockInfo);

    (ol->SockInfo->dwOutstandingAsync)--;

    if ((ol->SockInfo->bClosing) &&
        (ol->SockInfo->dwOutstandingAsync == 0) &&
        (ol->SockInfo->RefCount == 1))
    {
        //
        // If the calling app closed the socket while there were still outstanding
        //  async operations then all the outstanding operations have completed so
        //  we can close the apps socket handle.
        //
        if (MainUpCallTable.lpWPUCloseSocketHandle(ol->CallerSocket, &ol->Error) == SOCKET_ERROR)
        {
            dbgprint("CheckForContextClenaup: WPUCloseSocketHandle() failed: %d", ol->Error);
        }

        ol->SockInfo->LayeredSocket = INVALID_SOCKET;

        RemoveSocketInfo(ol->SockInfo->Provider, ol->SockInfo);

        #ifdef DEBUG
        dbgprint("CFCL: Closing socket %d Bytes Sent [%lu] Bytes Recv [%lu]",
                ol->CallerSocket, ol->SockInfo->BytesSent, ol->SockInfo->BytesRecv);
        #endif

        ReleaseSocketLock(ol->SockInfo);

        ol->SockInfo = NULL;

        DeleteCriticalSection(&SocketContext->SockCritSec);

        #ifdef DEBUG
        dbgprint("Freeing a SOCK_INFO (SocketContext) structure");
        #endif

        FreeSockInfo(SocketContext);

        return;
    }
    ReleaseSocketLock(SocketContext);

    UnlockSocketContext(SocketContext, &Error);

    return;
}

WSAOVERLAPPEDPLUS* DequeueOverlappedOperation ( )

Definition at line 383 of file overlap.cpp.

{
    WSAOVERLAPPEDPLUS *op=NULL;

    EnterCriticalSection(&gOverlappedCS);

    op = PendingStart;
    if (PendingStart)
    {
        PendingStart = op->next;
    }
    if (op == PendingEnd)
    {
        PendingStart = PendingEnd = NULL;
    }

    LeaveCriticalSection(&gOverlappedCS);

    return op;
}

int EnqueueOverlappedOperation ( WSAOVERLAPPEDPLUS * op )

Definition at line 343 of file overlap.cpp.

{
    EnterCriticalSection(&gOverlappedCS);

    if (op == NULL)
    {
        dbgprint("EnqueueOverlappedOperation: op == NULL!");
        LeaveCriticalSection(&gOverlappedCS);
        return WSAEFAULT;
    }

    op->next = NULL;
    if (!PendingEnd)
    {
        PendingStart = op;
        PendingEnd   = op;
    }
    else
    {
        PendingEnd->next = op;
        PendingEnd       = op;
    }
    // Increment the semaphore count. This lets the worker thread
    // know that there are pending overlapped operations to execute.
    //
    ReleaseSemaphore(ghWakeupSemaphore, 1, NULL);

    LeaveCriticalSection(&gOverlappedCS);

    return WSA_IO_PENDING;
}

int ExecuteOverlappedOperation | ( | WSAOVERLAPPEDPLUS * | lpOverlapped,
 |  | BOOL | bSynchronous
 | ) |  |

Definition at line 414 of file overlap.cpp.

{
    LPWSAOVERLAPPED_COMPLETION_ROUTINE   routine = NULL;
    PROVIDER                            *Provider;
    OVERLAPPED                          *col = NULL;
    DWORD                               *lpdwFlags = NULL,
                                        *lpdwBytes = NULL;
    int                                  ret=SOCKET_ERROR, err=0;

    if (!ghIocp)
        routine = IntermediateCompletionRoutine;

    Provider = ol->Provider;
    //
    // Reset the event handle if present. The handle is masked with 0xFFFFFFFE in
    //  order to zero out the last bit. If the last bit is one and the socket is
    //  associated with a compeltion port then when an overlapped operation is
    //  called, the operation is not posted to the IO completion port.
    //
    if (ol->lpCallerOverlapped->hEvent != NULL)
    {
        ULONG_PTR   ptr=1;

        ResetEvent((HANDLE)((ULONG_PTR)ol->lpCallerOverlapped->hEvent & ~ptr));
    }

    switch (ol->Operation)
    {
        case LSP_OP_IOCTL:
            lpdwFlags = NULL;
            lpdwBytes = &ol->IoctlArgs.cbBytesReturned;
            ret = Provider->NextProcTable.lpWSPIoctl(
                    ol->ProviderSocket,
                    ol->IoctlArgs.dwIoControlCode,
                    ol->IoctlArgs.lpvInBuffer,
                    ol->IoctlArgs.cbInBuffer,
                    ol->IoctlArgs.lpvOutBuffer,
                    ol->IoctlArgs.cbOutBuffer,
                   &ol->IoctlArgs.cbBytesReturned,
                   &ol->ProviderOverlapped,
                    routine,
                   &ol->CallerThreadId,
                   &err
                   );
            break;
        case LSP_OP_RECV:
            lpdwFlags = &ol->RecvArgs.dwFlags;
            lpdwBytes = &ol->RecvArgs.dwNumberOfBytesRecvd;
            ret = Provider->NextProcTable.lpWSPRecv(
                    ol->ProviderSocket,
                    ol->RecvArgs.lpBuffers,
                    ol->RecvArgs.dwBufferCount,
                   &ol->RecvArgs.dwNumberOfBytesRecvd,
                   &ol->RecvArgs.dwFlags,
                   &ol->ProviderOverlapped,
                    routine,
                   &ol->CallerThreadId,
                   &err
                    );
            break;
        case LSP_OP_RECVFROM:
            lpdwFlags = &ol->RecvFromArgs.dwFlags;
            lpdwBytes = &ol->RecvFromArgs.dwNumberOfBytesRecvd;
            ret = Provider->NextProcTable.lpWSPRecvFrom(
                    ol->ProviderSocket,
                    ol->RecvFromArgs.lpBuffers,
                    ol->RecvFromArgs.dwBufferCount,
                   &ol->RecvFromArgs.dwNumberOfBytesRecvd,
                   &ol->RecvFromArgs.dwFlags,
                    ol->RecvFromArgs.lpFrom,
                    ol->RecvFromArgs.lpFromLen,
                   &ol->ProviderOverlapped,
                    routine,
                   &ol->CallerThreadId,
                   &err
                    );
            break;
        case LSP_OP_SEND:
            lpdwFlags = &ol->SendArgs.dwFlags;
            lpdwBytes = &ol->SendArgs.dwNumberOfBytesSent;
            ret = Provider->NextProcTable.lpWSPSend(
                    ol->ProviderSocket,
                    ol->SendArgs.lpBuffers,
                    ol->SendArgs.dwBufferCount,
                   &ol->SendArgs.dwNumberOfBytesSent,
                    ol->SendArgs.dwFlags,
                   &ol->ProviderOverlapped,
                    routine,
                   &ol->CallerThreadId,
                   &err
                   );
             break;
        case LSP_OP_SENDTO:
            lpdwFlags = &ol->SendToArgs.dwFlags;
            lpdwBytes = &ol->SendToArgs.dwNumberOfBytesSent;
            ret = Provider->NextProcTable.lpWSPSendTo(
                    ol->ProviderSocket,
                    ol->SendToArgs.lpBuffers,
                    ol->SendToArgs.dwBufferCount,
                   &ol->SendToArgs.dwNumberOfBytesSent,
                    ol->SendToArgs.dwFlags,
                    (SOCKADDR *)&ol->SendToArgs.To,
                    ol->SendToArgs.iToLen,
                   &ol->ProviderOverlapped,
                    routine,
                   &ol->CallerThreadId,
                   &err
                    );
            break;
        case LSP_OP_TRANSMITFILE:
            lpdwFlags = &ol->TransmitFileArgs.dwFlags;
            lpdwBytes = NULL;
            ret = Provider->NextProcTableExt.lpfnTransmitFile(
                    ol->ProviderSocket,
                    ol->TransmitFileArgs.hFile,
                    ol->TransmitFileArgs.nNumberOfBytesToWrite,
                    ol->TransmitFileArgs.nNumberOfBytesPerSend,
                   &ol->ProviderOverlapped,
                    ol->TransmitFileArgs.lpTransmitBuffers,
                    ol->TransmitFileArgs.dwFlags
                    );
            if (ret == FALSE)
            {
                ret = SOCKET_ERROR;
                err = WSAGetLastError();
                WSASetLastError(err);
            }
            else
                ret = NO_ERROR;
            break;
        case LSP_OP_ACCEPTEX:
            lpdwFlags = NULL;
            lpdwBytes = &ol->AcceptExArgs.dwBytesReceived;
            ret = Provider->NextProcTableExt.lpfnAcceptEx(
                    ol->ProviderSocket,
                    ol->AcceptExArgs.sProviderAcceptSocket,
                    ol->AcceptExArgs.lpOutputBuffer,
                    ol->AcceptExArgs.dwReceiveDataLength,
                    ol->AcceptExArgs.dwLocalAddressLength,
                    ol->AcceptExArgs.dwRemoteAddressLength,
                   &ol->AcceptExArgs.dwBytesReceived,
                   &ol->ProviderOverlapped
                    );
            if (ret == FALSE)
            {
                ret = SOCKET_ERROR;
                err = WSAGetLastError();
                WSASetLastError(err);
            }
            else
                ret = NO_ERROR;
            break;
        case LSP_OP_CONNECTEX:
            lpdwFlags = NULL;
            lpdwBytes = &ol->ConnectExArgs.dwBytesSent;
            ret = Provider->NextProcTableExt.lpfnConnectEx(
                    ol->ProviderSocket,
                    (SOCKADDR *)&ol->ConnectExArgs.name,
                    ol->ConnectExArgs.namelen,
                    ol->ConnectExArgs.lpSendBuffer,
                    ol->ConnectExArgs.dwSendDataLength,
                   &ol->ConnectExArgs.dwBytesSent,
                   &ol->ProviderOverlapped
                    );
            if (ret == FALSE)
            {
                ret = SOCKET_ERROR;
                err = WSAGetLastError();
                WSASetLastError(err);
            }
            else
                ret = NO_ERROR;
            break;
        case LSP_OP_DISCONNECTEX:
            lpdwFlags = &ol->DisconnectExArgs.dwFlags;
            lpdwBytes = NULL;
            ret = Provider->NextProcTableExt.lpfnDisconnectEx(
                    ol->ProviderSocket,
                   &ol->ProviderOverlapped,
                    ol->DisconnectExArgs.dwFlags,
                    ol->DisconnectExArgs.dwReserved
                    );
            if (ret == FALSE)
            {
                ret = SOCKET_ERROR;
                err = WSAGetLastError();
                WSASetLastError(err);
            }
            else
                ret = NO_ERROR;
            break;
        case LSP_OP_TRANSMITPACKETS:
            lpdwFlags = &ol->TransmitPacketsArgs.dwFlags;
            lpdwBytes = NULL;
            ret = Provider->NextProcTableExt.lpfnTransmitPackets(
                    ol->ProviderSocket,
                    ol->TransmitPacketsArgs.lpPacketArray,
                    ol->TransmitPacketsArgs.nElementCount,
                    ol->TransmitPacketsArgs.nSendSize,
                   &ol->ProviderOverlapped,
                    ol->TransmitPacketsArgs.dwFlags
                    );
            if (ret == FALSE)
            {
                ret = SOCKET_ERROR;
                err = WSAGetLastError();
                WSASetLastError(err);
            }
            else
                ret = NO_ERROR;
            break;
        case LSP_OP_WSARECVMSG:
            lpdwFlags = NULL;
            lpdwBytes = &ol->WSARecvMsgArgs.dwNumberOfBytesRecvd;
            ret = Provider->NextProcTableExt.lpfnWSARecvMsg(
                    ol->ProviderSocket,
                    ol->WSARecvMsgArgs.lpMsg,
                   &ol->WSARecvMsgArgs.dwNumberOfBytesRecvd,
                   &ol->ProviderOverlapped,
                    ol->lpCallerCompletionRoutine
                    );
            if (ret == FALSE)
            {
                ret = SOCKET_ERROR;
                err = WSAGetLastError();
                WSASetLastError(err);
            }
            else
                ret = NO_ERROR;
            break;
        default:
            dbgprint("ExecuteOverlappedOperation: Unknown operation!");
            ret = SOCKET_ERROR;
            break;
    }

    if ((ret != NO_ERROR) && (err != WSA_IO_PENDING))
    {
        //
        // If the call immediately fails, update the OVERLAPPED info and return
        //
        ol->lpCallerOverlapped->Offset       = err;
        ol->lpCallerOverlapped->OffsetHigh   = (lpdwFlags ? *lpdwFlags : 0);
        ol->lpCallerOverlapped->InternalHigh = (lpdwBytes ? *lpdwBytes : 0);
        ol->lpCallerOverlapped->Internal     = 0;

        #ifdef DEBUG
        dbgprint("Overlap op failed immediately: %d", ol->Error);
        #endif

        CheckForContextCleanup(ol);

        PutbackOverlappedStructure(ol);
    }
    else if ((ret == NO_ERROR) && (bSynchronous == FALSE))
    {
        //
        // Ideally we'd like to complete immediately here but we should wait
        // until the completion port has processed the completion packet
        // associated with this operation.
        //
        err = WSA_IO_PENDING;
        ret = SOCKET_ERROR;

        #ifdef DEBUG
        dbgprint("Succeeded without error");
        #endif
    }
    else if ((ret == NO_ERROR) && (bSynchronous == TRUE))
    {
        // The winsock call actually blocked and there will be no completion
        // notification on the IOCP.
        //
        #ifdef DEBUG
        dbgprint("Succeeded without error - synchronous socket though");
        #endif
    }
    #ifdef DEBUG
    else
    {
        dbgprint("WSA_IO_PENDING");
    }
    #endif

    return ((ret == NO_ERROR) ? ret : err);
}

LPWSAOVERLAPPEDPLUS GetOverlappedStructure ( SOCK_INFO * SocketContext )

Definition at line 804 of file overlap.cpp.

{
    LPWSAOVERLAPPEDPLUS lpWorkerOverlappedPlus = NULL;

    if (!SocketContext)
    {
        dbgprint("GetOverlappedStructure: SocketContext == NULL");
        return NULL;
    }

    AcquireSocketLock(SocketContext);

    EnterCriticalSection(&gOverlappedCS);
    //
    // We have to keep track of the number of outstanding overlapped requests
    // an application has. Otherwise, if the app were to close a socket that
    // had oustanding overlapped ops remaining, we'd start leaking structures
    // in OverlappedPool. The idea here is to force the CallerSocket to remain
    // open until the lower provider has processed all the overlapped requests.
    // If we closed both the lower socket and the caller socket, we would no
    // longer be able to correlate completed requests to any apps sockets.
    //
    (SocketContext->dwOutstandingAsync)++;

    if (FreePool)
    {
        lpWorkerOverlappedPlus = FreePool;
        FreePool = FreePool->next;
        lpWorkerOverlappedPlus->next = NULL;
    }
    else // Empty pool
    {
        if (AllocateFreePool() != WSAENOBUFS)
        {
            lpWorkerOverlappedPlus = FreePool;
            FreePool = FreePool->next;
            lpWorkerOverlappedPlus->next = NULL;
        }
    }
    if (lpWorkerOverlappedPlus)
        memset(lpWorkerOverlappedPlus, 0, sizeof(WSAOVERLAPPEDPLUS));

    LeaveCriticalSection(&gOverlappedCS);

    ReleaseSocketLock(SocketContext);

    return  lpWorkerOverlappedPlus;
}

int InitOverlappedManager ( )

Definition at line 116 of file overlap.cpp.

{
    DWORD   dwId,
            i;

    EnterCriticalSection(&gOverlappedCS);

    // Make sure we're not already initialized -- we'll always have at least
    // one worker thread running
    if (gWorkerThread[0] != NULL)
    {
        LeaveCriticalSection(&gOverlappedCS);
        return 0;
    }

    // Allocate a block of our overlapped structures
    if (AllocateFreePool() == WSAENOBUFS)
    {
        LeaveCriticalSection(&gOverlappedCS);
        return WSAENOBUFS;
    }

    //
    // See if we're on NT by trying to create the completion port. If it
    //  fails then we're on Win9x.
    //
    ghIocp = CreateIoCompletionPort(INVALID_HANDLE_VALUE,
                                    NULL,
                                    (ULONG_PTR)0,
                                    0);
    if (ghIocp)
    {
        SYSTEM_INFO     sinfo;

        // We're on NT so figure out how many processors we have
        //
        GetSystemInfo(&sinfo);
        gdwThreadCount = sinfo.dwNumberOfProcessors;

        #ifdef DEBUG
        dbgprint("Created IOCP: %d", ghIocp);
        #endif
    }
    else
    {
        //
        // We're on Win9x so create a semaphore instead. This is used to
        //  wake up the worker thread to service overlapped IO calls.
        //
        ghWakeupSemaphore = CreateSemaphore(NULL,
                                            0,
                                            MAXLONG,
                                            NULL);
        if (!ghWakeupSemaphore)
        {
            dbgprint("InitOverlappedManager: CreateSemaphore() failed: %d", GetLastError());
            LeaveCriticalSection(&gOverlappedCS);
            return WSAEPROVIDERFAILEDINIT;
        }
        // This is Win9x, no multiproc support
        //
        gdwThreadCount = 1;
    }

    #ifdef DEBUG
    dbgprint("Creating %d threads", gdwThreadCount);
    #endif
    //
    // Create our worker threads
    //
    for(i=0; i < gdwThreadCount ;i++)
    {
        gWorkerThread[i] = CreateThread(NULL, 0, OverlappedManagerThread, (LPVOID)ghIocp, 0, &dwId);
        if (!gWorkerThread[i])
        {
            dbgprint("InitOverlappedManager: CreateThread() failed: %d", GetLastError());
            LeaveCriticalSection(&gOverlappedCS);
            return WSAEPROVIDERFAILEDINIT;
        }
    }
    LeaveCriticalSection(&gOverlappedCS);
    return 0;
}

void CALLBACK IntermediateCompletionRoutine | ( | DWORD | dwError,
 |  | DWORD | cbTransferred,
 |  | LPWSAOVERLAPPED | lpOverlapped,
 |  | DWORD | dwFlags
 | ) |  |

Definition at line 897 of file overlap.cpp.

{
    LPWSAOVERLAPPEDPLUS olp = (LPWSAOVERLAPPEDPLUS) lpOverlapped;
    SOCK_INFO          *SocketContext,
                       *AcceptSocketContext;
    int                 Error,
                        ret;

    if (lpOverlapped == NULL)
    {
        dbgprint("IntermediateCompletionRoutine: lpOverlapped == NULL!");
        return;
    }
    //
    // We actually already have the socket context for this operation (its in
    //    the WSAOVERLAPPEDPLUS structure but do this anyway to make sure the
    //    socket hasn't been closed as well as to increment the ref count while
    //    we're accessing the SOCK_INFO structure.
    //
    SocketContext = FindAndLockSocketContext(olp->CallerSocket, &Error);
    if (SocketContext == NULL)
    {
        dbgprint("IntermediateCompletionRoutine: WPUQuerySocketHandleContext failed: %d", Error);
        PutbackOverlappedStructure(olp);
        return;
    }

    if (dwError == WSA_IO_PENDING)
    {
        //
        // Get the results of the operation
        //
        dwError = NO_ERROR;
        ret = olp->Provider->NextProcTable.lpWSPGetOverlappedResult(olp->ProviderSocket,
                                                     lpOverlapped,
                                                    &cbTransferred,
                                                     FALSE,
                                                    &dwFlags,
                                                    (int *)&dwError);
        if (ret == FALSE)
        {
            dbgprint("IntermediateCompletionRoutine: WSPGetOverlappedResult failed: %d", dwError);
        }

        #ifdef DEBUG
        dbgprint("Bytes transferred on socket %d: %d [op=%d; err=%d]",
                olp->CallerSocket, cbTransferred, olp->Operation, dwError);
        #endif
    }

    olp->lpCallerOverlapped->Offset       = dwError;
    olp->lpCallerOverlapped->OffsetHigh   = dwFlags;
    olp->lpCallerOverlapped->InternalHigh = cbTransferred;

    if (dwError == 0)
    {
        AcquireSocketLock(SocketContext);
        switch (olp->Operation)
        {
            case LSP_OP_RECV:
                SocketContext->BytesRecv += cbTransferred;
                FreeBuffer(olp->RecvArgs.lpBuffers);
                break;
            case LSP_OP_RECVFROM:
                SocketContext->BytesRecv += cbTransferred;
                FreeBuffer(olp->RecvFromArgs.lpBuffers);
                break;
            case LSP_OP_SEND:
                SocketContext->BytesSent += cbTransferred;
                FreeBuffer(olp->SendArgs.lpBuffers);
                break;
            case LSP_OP_SENDTO:
                SocketContext->BytesSent += cbTransferred;
                FreeBuffer(olp->SendToArgs.lpBuffers);
                break;
            case LSP_OP_TRANSMITFILE:
                SocketContext->BytesSent += cbTransferred;
                break;
            case LSP_OP_TRANSMITPACKETS:
                break;
            case LSP_OP_ACCEPTEX:
                AcceptSocketContext = FindAndLockSocketContext(
                        olp->AcceptExArgs.sAcceptSocket,
                       &Error
                       );
                if (AcceptSocketContext == NULL)
                {
                    dbgprint("IntermediateCompletionRoutine: WPUQuerySocketHandleContext failed (accept socket)");
                }
                AcceptSocketContext->BytesRecv += cbTransferred;
                UnlockSocketContext(AcceptSocketContext, &Error);
                break;
            case LSP_OP_CONNECTEX:
                break;
            case LSP_OP_WSARECVMSG:
                break;
            default:
                break;
        }
        ReleaseSocketLock(SocketContext);
    }

    UnlockSocketContext(SocketContext, &Error);

    //
    // If the app supplied a completion routine, queue it up for completion
    //
    if (olp->lpCallerCompletionRoutine)
    {

        olp->lpCallerOverlapped->Internal = (ULONG_PTR)olp->lpCallerCompletionRoutine;

        if (MainUpCallTable.lpWPUQueueApc(&olp->CallerThreadId,
                                           CallUserApcProc,
                                           (DWORD_PTR) olp->lpCallerOverlapped,
                                          &Error) == SOCKET_ERROR)
        {
            dbgprint("IntermediateCompletionRoutine: WPUQueueApc() failed: %d", Error);
        }
    }
    else
    {
        // Otherwise we signal that the op has completed
        //
        if (WPUCompleteOverlappedRequest(olp->CallerSocket,
                                     olp->lpCallerOverlapped,
                                     dwError,
                                     cbTransferred,
                                    &Error) == SOCKET_ERROR)
        {
            dbgprint("WPUCompleteOverlappedRequest failed: %d", Error);
        }
        #ifdef DEBUG
        else
        {
            dbgprint("Completing request on socket: %d", olp->CallerSocket);
        }
        #endif
    }

    //
    // Cleanup the accounting on the socket
    //

    //(SocketContext->dwOutstandingAsync)--;

    CheckForContextCleanup(olp);

    PutbackOverlappedStructure(olp);

    return;
}

DWORD WINAPI OverlappedManagerThread ( LPVOID lpParam )

Definition at line 709 of file overlap.cpp.

{
    WSAOVERLAPPEDPLUS *lpPid = NULL;
    HANDLE             hIocp = (HANDLE)lpParam;
    ULONG_PTR          key;
    DWORD              dwBytesXfered;
    int                ret;

    while (1)
    {
        if (hIocp)
        {
            ret = GetQueuedCompletionStatus(hIocp,
                    &dwBytesXfered,
                    &key,
                    (LPOVERLAPPED *)&lpPid,
                    INFINITE);
            if ((ret == 0) || (ret == WAIT_TIMEOUT))
            {
                // Socket failures could be reported here so we still
                // call IntermediateCompletionRoutine
                dbgprint("GetQueuedCompletionStatus() failed: %d", GetLastError());
            }
            if (dwBytesXfered == -1)
            {
                // StopOverlappedManager will send a completion packet with -1
                //    bytes transfered to indicate the completion routine
                //    should exit
                dbgprint("OverlappedManagerThread: Received exit message");
                ExitThread(0);
            }

            // Handle the IO that completed
            IntermediateCompletionRoutine(WSA_IO_PENDING,
                    dwBytesXfered,
                    (OVERLAPPED *)lpPid,
                    0);
        }
        else
        {
            ret = WaitForSingleObjectEx(ghWakeupSemaphore,
                    INFINITE,
                    TRUE);
            if ((ret == WAIT_FAILED) || (ret == WAIT_TIMEOUT))
            {
                dbgprint("OverlappedManagerThread: WaitForSingleObjectEx() failed: %d",
                        GetLastError());
            }
            else
            {
                lpPid = DequeueOverlappedOperation();

                if (!lpPid)
                    continue;

                ExecuteOverlappedOperation(lpPid, FALSE);
            }
        }
    }
    ExitThread(0);
    return 0;
}

void PutbackOverlappedStructure ( WSAOVERLAPPEDPLUS * olp )

Definition at line 860 of file overlap.cpp.

{
    EnterCriticalSection(&gOverlappedCS);

    memset(olp, 0, sizeof(WSAOVERLAPPEDPLUS));

    //HeapFree(hLspHeap, 0, olp);

    olp->CallerThreadId.ThreadHandle = (HANDLE)0xbadbeef;

    olp->next = FreePool;
    FreePool = olp;

    LeaveCriticalSection(&gOverlappedCS);
}

int QueueOverlappedOperation | ( | WSAOVERLAPPEDPLUS * | ol,
 |  | SOCK_INFO * | SocketContext
 | ) |  |

Definition at line 273 of file overlap.cpp.

{
    BOOL    bSynchronous=FALSE;
    int     err;

    // Set the fields of the overlapped to indicate IO is not complete yet
    //
    SetOverlappedInProgress(ol->lpCallerOverlapped);
    if (ghIocp)
    {
        // If we haven't already added the provider socket to the IOCP then
        //  do it now.
        //
        AcquireSocketLock(SocketContext);
        if (!SocketContext->hIocp)
        {
            SocketContext->hIocp = CreateIoCompletionPort((HANDLE)ol->ProviderSocket,
                                                          ghIocp,
                                                          ol->CallerSocket,
                                                          0);
            if (SocketContext->hIocp == NULL)
            {
                if ((err = GetLastError()) == ERROR_INVALID_PARAMETER)
                {
                    // Hack-o-rama. If the socket option SO_SYNCHRONOUS_(NON)ALERT
                    // is set then no overlapped operation can be performed on that
                    // socket and tryiing to associate it with a completion port
                    // will fail. The other bad news is that an LSP cannot trap this
                    // setsockopt call. In reality we don't have to do anything. If
                    // an app sets this option and then makes overlapped calls anyway,
                    // then they shouldn't be expecting any overlapped notifications!
                    // This statement is put here in case you want to mark the socket
                    // info structure as synchronous.
                    //
                    bSynchronous = TRUE;
                }
                else
                {
                    dbgprint("QueueOverlappedOperation: CreateIoCompletionPort() "
                              "failed: %d (Prov %d Iocp %d Caller %d 0)",
                            err, ol->ProviderSocket,
                            ghIocp, ol->CallerSocket);
                }
            }

            #ifdef DEBUG
            dbgprint("Adding provider handle %X to IOCP", ol->ProviderSocket);
            #endif
        }
        ReleaseSocketLock(SocketContext);
        //
        // Simply execute the operation
        //
        return ExecuteOverlappedOperation(ol, bSynchronous);
    }
    else
    {
        // Queue up the operation for the worker thread to initiate
        //
        return EnqueueOverlappedOperation(ol);
    }
}

void SetOverlappedInProgress ( OVERLAPPED * ol )

Definition at line 883 of file overlap.cpp.

{
    ol->Internal = WSS_OPERATION_IN_PROGRESS;
    ol->InternalHigh = 0;
}

void StartOverlappedManager ( )

Definition at line 779 of file overlap.cpp.

{
    //
    // Make sure things are already initalized
    //
    if (!gWorkerThread[0])
    {
        InitOverlappedManager();

        if (!gWorkerThread[0])
        {
            dbgprint("GetOverlappedStructure: Still not properly inititalized!");
            return;
        }
    }
}

int StopOverlappedManager ( )

Definition at line 208 of file overlap.cpp.

{
    DWORD     i;
    int       ret;

    EnterCriticalSection(&gOverlappedCS);
    //
    // Post a completion packet to the IOCP (one for each thread)
    //
    if (ghIocp)
    {
        for(i=0; i < gdwThreadCount ;i++)
        {
            ret = PostQueuedCompletionStatus(ghIocp,
                                        -1,
                                         0,
                                         NULL);
            if (ret == 0)
            {
                dbgprint("PostQueuedCompletionStatus() failed: %d", GetLastError());
            }
        }
        // Wait a while for the threads to get the signal and exit - if it fails or
        // times out then oh well, we need to clean up anyway
        ret = WaitForMultipleObjectsEx(gdwThreadCount, gWorkerThread, TRUE, 4000, TRUE);
    }

    for(i=0; i < gdwThreadCount ;i++)
    {
        CloseHandle(gWorkerThread[i]);
        gWorkerThread[i] = NULL;

        dbgprint("Closing thread");
    }

    // Cleanup remaining handles...

    if (ghIocp != NULL)
    {
        CloseHandle(ghIocp);
        ghIocp = NULL;
        dbgprint("Closing iocp");
    }
    if (ghWakeupSemaphore != NULL)
    {
        CloseHandle(ghWakeupSemaphore);
        ghWakeupSemaphore = NULL;
    }

    LeaveCriticalSection(&gOverlappedCS);

    return 0;
}

Variable Documentation

LPWSAOVERLAPPEDPLUS FreePool = NULL

Definition at line 36 of file overlap.cpp.

DWORD gdwThreadCount = -1

Definition at line 49 of file overlap.cpp.

HANDLE ghIocp = NULL

Definition at line 48 of file overlap.cpp.

HANDLE ghWakeupSemaphore = NULL

Definition at line 47 of file overlap.cpp.

CRITICAL_SECTION gOverlappedCS

Definition at line 33 of file spi.cpp.

HANDLE gWorkerThread[MAX_PROC_COUNT]
Initial value:
 {NULL, NULL, NULL, NULL, NULL, NULL,
                                                     NULL, NULL, NULL, NULL, NULL, NULL,
                                                     NULL, NULL, NULL, NULL, NULL, NULL,
                                                     NULL, NULL, NULL, NULL, NULL, NULL,
                                                     NULL, NULL, NULL, NULL, NULL, NULL,
                                                     NULL, NULL}

Definition at line 41 of file overlap.cpp.

HANDLE hLspHeap

Definition at line 42 of file spi.cpp.

LPWSAOVERLAPPEDPLUS OverlappedPool = NULL

Definition at line 39 of file overlap.cpp.

LPWSAOVERLAPPEDPLUS PendingEnd = NULL

Definition at line 38 of file overlap.cpp.

LPWSAOVERLAPPEDPLUS PendingStart = NULL

Definition at line 37 of file overlap.cpp.

Generated on Wed Nov 13 2024 16:54:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/LSP/prnpinfo.cpp File Reference

  • NetDS
  • WinSock
  • LSP
Functions

prnpinfo.cpp File Reference

#include <winsock2.h>
#include <windows.h>
#include <objbase.h>
#include <stdio.h>
#include <stdlib.h>
#include <af_irda.h>
#include <wsrm.h>
#include <ws2atm.h>
#include <wsipx.h>
#include <atalkwsh.h>

Go to the source code of this file.

Functions

void PrintProtocolInfo (WSAPROTOCOL_INFOW *wsapi)

Function Documentation

void PrintProtocolInfo ( WSAPROTOCOL_INFOW * wsapi )

Definition at line 39 of file prnpinfo.cpp.

{
    WCHAR       szGuidString[MAX_PATH];
    int   i;

    printf("\nProtocol: %S\n", wsapi->szProtocol);
    printf("           Address Family: ");
    switch (wsapi->iAddressFamily)
    {
        case AF_INET:
        case AF_INET6:
            printf("%s\n", (wsapi->iAddressFamily == AF_INET ? \
"AF_INET" : "AF_INET6"));
            printf("                 Protocol: ");
            switch (wsapi->iProtocol)
            {
                case IPPROTO_IP:
                    printf("IPROTO_IP\n");
                    break;
                case IPPROTO_ICMP:
                    printf("IPROTO_ICMP\n");
                    break;
                case IPPROTO_IGMP:
                    printf("IPROTO_IGMP\n");
                    break;
                case IPPROTO_GGP:
                    printf("IPROTO_GGP\n");
                    break;
                case IPPROTO_TCP:
                    printf("IPROTO_TCP\n");
                    break;
                case IPPROTO_PUP:
                    printf("IPROTO_PUP\n");
                    break;
                case IPPROTO_UDP:
                    printf("IPROTO_UDP\n");
                    break;
                case IPPROTO_IDP:
                    printf("IPROTO_IDP\n");
                    break;
                case IPPROTO_ND:
                    printf("IPROTO_ND\n");
                    break;
                case IPPROTO_RM:
                    printf("IPPROTO_RM\n");
                    break;
                case IPPROTO_RAW:
                    printf("IPROTO_RAW\n");
                    break;
            }
            break;
        case AF_UNSPEC:
            printf("AF_UNSPEC\n");
            printf("                 Protocol: UNKNOWN: %d",
                wsapi->iProtocol);
            break;
        case AF_UNIX:
            printf("AF_UNIX\n");
            printf("                 Protocol: UNKNOWN: %d",
                wsapi->iProtocol);
            break;
        case AF_IMPLINK:
            printf("AF_IMPLINK\n");
            printf("                 Protocol: UNKNOWN: %d",
                wsapi->iProtocol);
            break;
        case AF_PUP:
            printf("AF_PUP\n");
            printf("                 Protocol: UNKNOWN: %d",
                wsapi->iProtocol);
            break;
        case AF_CHAOS:
            printf("AF_CHAOS\n");
            printf("                 Protocol: UNKNOWN: %d",
                wsapi->iProtocol);
            break;
        case AF_NS:
            printf("AF_NS or AF_IPX\n");
            printf("                 Protocol: ");
            switch (wsapi->iProtocol)
            {
                case NSPROTO_IPX:
                    printf("NSPROTO_IPX\n");
                    break;
                case NSPROTO_SPX:
                    printf("NSPROTO_SPX\n");
                    break;
                case NSPROTO_SPXII:
                    printf("NSPROTO_SPXII\n");
                    break;
            }
            break;
        case AF_ISO:
            printf("AF_ISO or AF_OSI\n");
            printf("                 Protocol: UNKNOWN: %d",
                wsapi->iProtocol);
            break;
        case AF_ECMA:
            printf("AF_ECMA\n");
            printf("                 Protocol: UNKNOWN: %d",
                wsapi->iProtocol);
            break;
        case AF_DATAKIT:
            printf("AF_DATAKIT\n");
            printf("                 Protocol: UNKNOWN: %d",
                wsapi->iProtocol);
            break;
        case AF_CCITT:
            printf("AF_CCITT\n");
            printf("                 Protocol: UNKNOWN: %d",
                wsapi->iProtocol);
            break;
        case AF_SNA:
            printf("AF_SNA\n");
            printf("                 Protocol: UNKNOWN: %d",
                wsapi->iProtocol);
            break;
        case AF_DECnet:
            printf("AF_DECnet\n");
            printf("                 Protocol: UNKNOWN: %d",
                wsapi->iProtocol);
            break;
        case AF_DLI:
            printf("AF_DLI\n");
            printf("                 Protocol: UNKNOWN: %d",
                wsapi->iProtocol);
            break;
        case AF_LAT:
            printf("AF_LAT\n");
            printf("                 Protocol: UNKNOWN: %d",
                wsapi->iProtocol);
            break;
        case AF_HYLINK:
            printf("AF_HYLINK\n");
            printf("                 Protocol: UNKNOWN: %d",
                wsapi->iProtocol);
            break;
        case AF_APPLETALK:
            printf("AF_APPLETALK\n");
            printf("                 Protocol: ");
            switch (wsapi->iProtocol)
            {
                case DDPPROTO_RTMP:
                    printf("DDPPROTO_RTMP\n");
                    break;
                case DDPPROTO_NBP:
                    printf("DDPPROTO_NBP\n");
                    break;
                case DDPPROTO_ATP:
                    printf("DDPROTO_ATP\n");
                    break;
                case DDPPROTO_AEP:
                    printf("DDPPROTO_AEP\n");
                    break;
                case DDPPROTO_RTMPRQ:
                    printf("DDPPROTO_RTMPRQ\n");
                    break;
                case DDPPROTO_ZIP:
                    printf("DDPPROTO_ZIP\n");
                    break;
                case DDPPROTO_ADSP:
                    printf("DDPPROTO_ADSP\n");
                    break;
                case ATPROTO_ADSP:
                    printf("ATPROTO_ADSP\n");
                    break;
                case ATPROTO_ATP:
                    printf("ATPROTO_ATP\n");
                    break;
                case ATPROTO_ASP:
                    printf("ATPROTO_ASP\n");
                    break;
                case ATPROTO_PAP:
                    printf("ATPROTO_PAP\n");
                    break;
            }
            break;
        case AF_NETBIOS:
            printf("AF_NETBIOS\n");
            printf("                 Protocol: ");
      printf("NetBIOS LANA %d\n", ((wsapi->iProtocol == 0x80000000) ? 0: abs(wsapi->iProtocol)));
            break;
        case AF_VOICEVIEW:
            printf("AF_VOICEVIEW\n");
            printf("                 Protocol: UNKNOWN: %d",
                wsapi->iProtocol);
            break;
        case AF_FIREFOX:
            printf("AF_FIREFOX\n");
            printf("                 Protocol: UNKNOWN: %d",
                wsapi->iProtocol);
            break;
        case AF_UNKNOWN1:
            printf("AF_UNKNOWN1\n");
            printf("                 Protocol: UNKNOWN: %d",
                wsapi->iProtocol);
            break;
        case AF_BAN:
            printf("AF_BAN\n");
            printf("                 Protocol: UNKNOWN: %d",
                wsapi->iProtocol);
            break;
        case AF_ATM:
            printf("AF_ATM\n");
            printf("                 Protocol: ");
            switch (wsapi->iProtocol)
            {
                case ATMPROTO_AALUSER:
                    printf("ATMPROTO_AALUSER\n");
                    break;
                case ATMPROTO_AAL1:
                    printf("ATMPROTO_AAL1\n");
                    break;
                case ATMPROTO_AAL2:
                    printf("ATMPROTO_AAL2\n");
                    break;
                case ATMPROTO_AAL34:
                    printf("ATMPROTO_AAL34\n");
                    break;
                case ATMPROTO_AAL5:
                    printf("ATMPROTO_AAL5\n");
                    break;
            }
            break;
        case AF_CLUSTER:
            printf("AF_CLUSTER\n");
            printf("                 Protocol: UNKNOWN: %d",
                wsapi->iProtocol);
            break;
        case AF_12844:
            printf("AF_12844\n");
            printf("                 Protocol: UNKNOWN: %d",
                wsapi->iProtocol);
            break;
        case AF_IRDA:
            printf("AF_IRDA\n");
            printf("                 Protocol: ");
            switch (wsapi->iProtocol)
            {
                case IRDA_PROTO_SOCK_STREAM:
                    printf("IRDA_PROTO_SOCK_STREAM\n");
                    break;
            }
            break;
        default:
            printf("Unknown: %d\n", wsapi->iAddressFamily);
    }
    printf("              Socket Type: ");
    switch (wsapi->iSocketType)
    {
        case SOCK_STREAM:
            printf("SOCK_STREAM\n");
            break;
        case SOCK_DGRAM:
            printf("SOCK_DGRAM\n");
            break;
        case SOCK_RAW:
            printf("SOCK_RAW\n");
            break;
        case SOCK_RDM:
            printf("SOCK_RDM\n");
            break;
        case SOCK_SEQPACKET:
            printf("SOCK_SEQPACKET\n");
            break;
    }
    printf("           Connectionless: ");
    if (wsapi->dwServiceFlags1 & XP1_CONNECTIONLESS)
        printf("YES\n");
    else
        printf("NO\n");
    printf("      Guaranteed Delivery: ");
    if (wsapi->dwServiceFlags1 & XP1_GUARANTEED_DELIVERY)
        printf("YES\n");
    else
        printf("NO\n");
    printf("         Guaranteed Order: ");
    if (wsapi->dwServiceFlags1 & XP1_GUARANTEED_ORDER)
        printf("YES\n");
    else
        printf("NO\n");
    printf("         Message Oriented: ");
    if (wsapi->dwServiceFlags1 & XP1_MESSAGE_ORIENTED)
        printf("YES\n");
    else
        printf("NO\n");
    printf("            Pseudo Stream: ");
    if (wsapi->dwServiceFlags1 & XP1_PSEUDO_STREAM)
        printf("YES\n");
    else
        printf("NO\n");
    printf("           Graceful Close: ");
    if (wsapi->dwServiceFlags1 & XP1_GRACEFUL_CLOSE)
        printf("YES\n");
    else
        printf("NO\n");
    printf("           Expedited Data: ");
    if (wsapi->dwServiceFlags1 & XP1_EXPEDITED_DATA)
        printf("YES\n");
    else
        printf("NO\n");
    printf("             Connect Data: ");
    if (wsapi->dwServiceFlags1 & XP1_CONNECT_DATA)
        printf("YES\n");
    else
        printf("NO\n");
    printf("          Disconnect Data: ");
    if (wsapi->dwServiceFlags1 & XP1_DISCONNECT_DATA)
        printf("YES\n");
    else
        printf("NO\n");
    printf("       Supports Broadcast: ");
    if (wsapi->dwServiceFlags1 & XP1_SUPPORT_BROADCAST)
        printf("YES\n");
    else
        printf("NO\n");
    printf("      Supports Multipoint: ");
    if (wsapi->dwServiceFlags1 & XP1_SUPPORT_MULTIPOINT)
        printf("YES\n");
    else
        printf("NO\n");
    printf(" Multipoint Control Plane: ");
    if (wsapi->dwServiceFlags1 & XP1_MULTIPOINT_CONTROL_PLANE)
        printf("ROOTED\n");
    else
        printf("NON-ROOTED\n");
    printf("    Multipoint Data Plane: ");
    if (wsapi->dwServiceFlags1 & XP1_MULTIPOINT_DATA_PLANE)
        printf("ROOTED\n");
    else
        printf("NON-ROOTED\n");
    printf("            QoS Supported: ");
    if (wsapi->dwServiceFlags1 & XP1_QOS_SUPPORTED)
        printf("YES\n");
    else
        printf("NO\n");
    printf("     Unidirectional Sends: ");
    if (wsapi->dwServiceFlags1 & XP1_UNI_SEND)
        printf("YES\n");
    else
        printf("NO\n");
    printf("    Unidirection Receives: ");
    if (wsapi->dwServiceFlags1 & XP1_UNI_RECV)
        printf("YES\n");
    else
        printf("NO\n");
    printf("              IFS Handles: ");
    if (wsapi->dwServiceFlags1 & XP1_IFS_HANDLES)
        printf("YES\n");
    else
        printf("NO\n");
    printf("         Partial Messages: ");
    if (wsapi->dwServiceFlags1 & XP1_PARTIAL_MESSAGE)
        printf("YES\n");
    else
        printf("NO\n");
    printf("           Provider Flags: ");
    if (wsapi->dwProviderFlags & PFL_MULTIPLE_PROTO_ENTRIES)
    {
        printf("PFL_MULTIPLE_PROTO_ENTRIES ");
    }
    if (wsapi->dwProviderFlags & PFL_RECOMMENDED_PROTO_ENTRY)
    {
        printf("PFL_RECOMMENDED_PROT_ENTRY ");
    }
    if (wsapi->dwProviderFlags & PFL_HIDDEN)
    {
        printf("PFL_HIDDEN ");
    }
    if (wsapi->dwProviderFlags & PFL_MATCHES_PROTOCOL_ZERO)
    {
        printf("PFL_MATCHES_PROTOCOL_ZERO ");
    }
    if (wsapi->dwProviderFlags == 0)
    {
        printf("NONE");
    }
    printf("\n");

    StringFromGUID2(wsapi->ProviderId, szGuidString, MAX_PATH-1);
    printf("              Provider Id: %S\n", szGuidString);
    printf("         Catalog Entry Id: %ld\n", wsapi->dwCatalogEntryId);
    printf("  Number of Chain Entries: %d   {",
        wsapi->ProtocolChain.ChainLen);
    for(i=0; i < wsapi->ProtocolChain.ChainLen ;i++)
        printf("%ld ", wsapi->ProtocolChain.ChainEntries[i]);
    printf("}\n");
    printf("                  Version: %d\n", wsapi->iVersion);
    printf("Max Socket Address Length: %d\n", wsapi->iMaxSockAddr);
    printf("Min Socket Address Length: %d\n", wsapi->iMinSockAddr);
    printf("      Protocol Max Offset: %d\n", wsapi->iProtocolMaxOffset);
    printf("       Network Byte Order: ");
    if (wsapi->iNetworkByteOrder == 0)
        printf("BIG-ENDIAN\n");
    else
        printf("LITLE-ENDIAN\n");
    printf("          Security Scheme: ");
    if (wsapi->iSecurityScheme == SECURITY_PROTOCOL_NONE)
        printf("NONE\n");
    else
        printf("%d\n", wsapi->iSecurityScheme);
    printf("             Message Size: ");
    if (wsapi->dwMessageSize == 0)
        printf("N/A (Stream Oriented)\n");
    else if (wsapi->dwMessageSize == 1)
        printf("Depended on underlying MTU\n");
    else if (wsapi->dwMessageSize == 0xFFFFFFFF)
        printf("No limit\n");
    else
        printf("%ld\n", wsapi->dwMessageSize);
}

Generated on Wed Nov 13 2024 16:54:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/LSP/provider.cpp File Reference

  • NetDS
  • WinSock
  • LSP
Functions

provider.cpp File Reference

#include <ws2spi.h>
#include <sporder.h>
#include "install.h"
#include <stdio.h>
#include <stdlib.h>

Go to the source code of this file.

Functions

LPWSAPROTOCOL_INFOW | EnumerateProviders (WINSOCK_CATALOG Catalog, LPINT TotalProtocols)
void | FreeProviders (LPWSAPROTOCOL_INFOW ProtocolInfo)

Function Documentation

LPWSAPROTOCOL_INFOW EnumerateProviders | ( | WINSOCK_CATALOG | Catalog,
 |  | LPINT | TotalProtocols
 | ) |  |

Definition at line 38 of file provider.cpp.

{
  LPWSAPROTOCOL_INFOW ProtocolInfo = NULL;
  DWORD               ProtocolInfoSize = 0;
  INT                 ErrorCode,
                        rc;

    if (TotalProtocols == NULL)
        return NULL;

  *TotalProtocols = 0;

#ifdef _WIN64
  // Find out how many entries we need to enumerate
    if (Catalog == LspCatalog64Only)
    {
        // Find the size of the buffer
        rc = WSCEnumProtocols(NULL, ProtocolInfo, &ProtocolInfoSize, &ErrorCode);
        if (rc == SOCKET_ERROR)
        {
            if (ErrorCode != WSAENOBUFS)
                return NULL;
        }

        // Allocate the buffer
        ProtocolInfo = (LPWSAPROTOCOL_INFOW) HeapAlloc(GetProcessHeap(), 0, ProtocolInfoSize);
        if (ProtocolInfo == NULL)
        {
            return NULL;
        }

        // Enumerate the catalog for real
        rc = WSCEnumProtocols(NULL, ProtocolInfo, &ProtocolInfoSize, &ErrorCode);
        if (rc == SOCKET_ERROR)
        {
            HeapFree(GetProcessHeap(), 0, ProtocolInfo);
            return NULL;
        }

        // Update the count
        *TotalProtocols = rc;
    }
    else if (Catalog == LspCatalog32Only)
    {
        HMODULE            hModule;
        LPWSCENUMPROTOCOLS fnWscEnumProtocols32=NULL;

        // Load ws2_32.dll
        hModule = LoadLibrary(TEXT("ws2_32.dll"));
        if (hModule == NULL)
            return NULL;

        // Find the 32-bit catalog enumerator
        fnWscEnumProtocols32 = (LPWSCENUMPROTOCOLS)GetProcAddress(hModule, "WSCEnumProtocols32");
        if (fnWscEnumProtocols32 == NULL)
            return NULL;

        // Find the required buffer size
        rc = fnWscEnumProtocols32(NULL, ProtocolInfo, &ProtocolInfoSize, &ErrorCode);
        if (rc == SOCKET_ERROR)
        {
            if (ErrorCode != WSAENOBUFS)
                return NULL;
        }

        // Allocate the buffer
        ProtocolInfo = (LPWSAPROTOCOL_INFOW)HeapAlloc(GetProcessHeap(), 0, ProtocolInfoSize);
        if (ProtocolInfo == NULL)
        {
            return NULL;
        }

        // Enumrate the catalog for real this time
        rc = fnWscEnumProtocols32(NULL, ProtocolInfo, &ProtocolInfoSize, &ErrorCode);
        if (rc == SOCKET_ERROR)
        {
            HeapFree(GetProcessHeap(), 0, ProtocolInfo);
            return NULL;
        }

        // Update the count
        *TotalProtocols = rc;

        FreeLibrary(hModule);
    }
#else
    if (Catalog == LspCatalog32Only)
    {
        // Find the size of the buffer
        rc = WSCEnumProtocols(NULL, ProtocolInfo, &ProtocolInfoSize, &ErrorCode);
        if (rc == SOCKET_ERROR)
        {
            if (ErrorCode != WSAENOBUFS)
                return NULL;
        }

        // Allocate the buffer
        ProtocolInfo = (LPWSAPROTOCOL_INFOW) HeapAlloc(GetProcessHeap(), 0, ProtocolInfoSize);
        if (ProtocolInfo == NULL)
        {
            return NULL;
        }

        // Enumerate the catalog for real
        rc = WSCEnumProtocols(NULL, ProtocolInfo, &ProtocolInfoSize, &ErrorCode);
        if (rc == SOCKET_ERROR)
        {
            HeapFree(GetProcessHeap(), 0, ProtocolInfo);
            return NULL;
        }

        // Update the count
        *TotalProtocols = rc;
    }
    else if (Catalog == LspCatalog64Only)
    {
        fprintf(stderr, "Unable to enumerate 64-bit Winsock catalog from 32-bit process!\n");
    }
#endif
    else
    {
        // Find the size of the buffer
        rc = WSCEnumProtocols(NULL, ProtocolInfo, &ProtocolInfoSize, &ErrorCode);
        if (rc == SOCKET_ERROR)
        {
            if (ErrorCode != WSAENOBUFS)
                return NULL;
        }

        // Allocate the buffer
        ProtocolInfo = (LPWSAPROTOCOL_INFOW) HeapAlloc(GetProcessHeap(), 0, ProtocolInfoSize);
        if (ProtocolInfo == NULL)
        {
            return NULL;
        }

        // Enumerate the catalog for real
        rc = WSCEnumProtocols(NULL, ProtocolInfo, &ProtocolInfoSize, &ErrorCode);
        if (rc == SOCKET_ERROR)
        {
            HeapFree(GetProcessHeap(), 0, ProtocolInfo);
            return NULL;
        }

        // Update the count
        *TotalProtocols = rc;
    }

  return ProtocolInfo;
}

void FreeProviders ( LPWSAPROTOCOL_INFOW ProtocolInfo )

Definition at line 195 of file provider.cpp.

{
  HeapFree(GetProcessHeap(), 0, ProtocolInfo);
}

Generated on Wed Nov 13 2024 16:54:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/LSP/provider.h File Reference

  • NetDS
  • WinSock
  • LSP
Classes | Defines | Typedefs | Functions | Variables

provider.h File Reference

#include <ws2spi.h>
#include <mswsock.h>

Go to the source code of this file.

Classes

struct | _ACCEPTEXARGS
struct | _CONNECTEXARGS
struct | _DISCONNECTEXARGS
struct | _EXT_WSPPROC_TABLE
struct | _IOCTLARGS
struct | _PROVIDER
struct | _RECVARGS
struct | _RECVFROMARGS
struct | _SENDARGS
struct | _SENDTOARGS
struct | _SOCK_INFO
struct | _TRANSMITFILEARGS
struct | _TRANSMITPACKETSARGS
struct | _WSAOVERLAPPEDPLUS
struct | _WSARECVMSGARGS

Defines

#define | LSP_OP_ACCEPTEX 7
#define | LSP_OP_CONNECTEX 8
#define | LSP_OP_DISCONNECTEX 9
#define | LSP_OP_IOCTL 1
#define | LSP_OP_RECV 2
#define | LSP_OP_RECVFROM 3
#define | LSP_OP_SEND 4
#define | LSP_OP_SENDTO 5
#define | LSP_OP_TRANSMITFILE 6
#define | LSP_OP_TRANSMITPACKETS 10
#define | LSP_OP_WSARECVMSG 11
#define | WM_SOCKET (WM_USER + 1)

Typedefs

typedef struct _ACCEPTEXARGS | ACCEPTEXARGS
typedef struct _CONNECTEXARGS | CONNECTEXARGS
typedef struct _DISCONNECTEXARGS | DISCONNECTEXARGS
typedef struct _EXT_WSPPROC_TABLE | EXT_WSPPROC_TABLE
typedef struct _IOCTLARGS | IOCTLARGS
typedef struct _PROVIDER * | LPPROVIDER
typedef struct _WSAOVERLAPPEDPLUS * | LPWSAOVERLAPPEDPLUS
typedef struct _PROVIDER | PROVIDER
typedef struct _RECVARGS | RECVARGS
typedef struct _RECVFROMARGS | RECVFROMARGS
typedef struct _SENDARGS | SENDARGS
typedef struct _SENDTOARGS | SENDTOARGS
typedef struct _SOCK_INFO | SOCK_INFO
typedef struct _TRANSMITFILEARGS | TRANSMITFILEARGS
typedef struct _TRANSMITPACKETSARGS | TRANSMITPACKETSARGS
typedef struct _WSAOVERLAPPEDPLUS | WSAOVERLAPPEDPLUS
typedef struct _WSARECVMSGARGS | WSARECVMSGARGS

Functions

void | AcquireSocketLock (SOCK_INFO *SockInfo)
void | CloseAndFreeSocketInfo (PROVIDER *provider)
WSABUF * | CopyBuffer (WSABUF *BufferArray, DWORD BufferCount)
void | CopyOffset (WSAOVERLAPPED *ProviderOverlapped, WSAOVERLAPPED *UserOverlapped)
SOCK_INFO * | CreateSockInfo (PROVIDER *Provider, SOCKET ProviderSocket, SOCK_INFO *Inherit, BOOL Insert=TRUE)
void | dbgprint (char *format,...)
BOOL PASCAL FAR | ExtAcceptEx (IN SOCKET sListenSocket, IN SOCKET sAcceptSocket, IN PVOID lpOutputBuffer, IN DWORD dwReceiveDataLength, IN DWORD dwLocalAddressLength, IN DWORD dwRemoteAddressLength, OUT LPDWORD lpdwBytesReceived, IN LPOVERLAPPED lpOverlapped)
BOOL PASCAL FAR | ExtConnectEx (IN SOCKET s, IN const struct sockaddr FAR *name, IN int namelen, IN PVOID lpSendBuffer OPTIONAL, IN DWORD dwSendDataLength, OUT LPDWORD lpdwBytesSent, IN LPOVERLAPPED lpOverlapped)
BOOL PASCAL FAR | ExtDisconnectEx (IN SOCKET s, IN LPOVERLAPPED lpOverlapped, IN DWORD dwFlags, IN DWORD dwReserved)
BOOL PASCAL FAR | ExtTransmitFile (IN SOCKET hSocket, IN HANDLE hFile, IN DWORD nNumberOfBytesToWrite, IN DWORD nNumberOfBytesPerSend, IN LPOVERLAPPED lpOverlapped, IN LPTRANSMIT_FILE_BUFFERS lpTransmitBuffers, IN DWORD dwReserved)
BOOL PASCAL FAR | ExtTransmitPackets (SOCKET hSocket, LPTRANSMIT_PACKETS_ELEMENT lpPacketArray, DWORD nElementCount, DWORD nSendSize, LPOVERLAPPED lpOverlapped, DWORD dwFlags)
INT PASCAL FAR | ExtWSARecvMsg (IN SOCKET s, IN OUT LPWSAMSG lpMsg, OUT LPDWORD lpdwNumberOfBytesRecvd, IN LPWSAOVERLAPPED lpOverlapped, IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
SOCK_INFO * | FindAndLockSocketContext (SOCKET s, int *err)
void | FreeBuffer (WSABUF *BufferArray)
void | FreeSockInfo (SOCK_INFO *info)
SOCK_INFO * | GetCallerSocket (PROVIDER *provider, SOCKET ProviderSocket)
LPWSAOVERLAPPEDPLUS | GetOverlappedStructure (SOCK_INFO *SocketContext)
HWND | GetWorkerWindow ()
void | InitOverlappedCS (void)
int | InitOverlappedManager ()
void | InsertSocketInfo (PROVIDER *provider, SOCK_INFO *sock)
void CALLBACK | IntermediateCompletionRoutine (DWORD dwError, DWORD cbTransferred, LPWSAOVERLAPPED lpOverlapped, DWORD dwFlags)
void | PutbackOverlappedStructure (WSAOVERLAPPEDPLUS *olp)
int | QueueOverlappedOperation (WSAOVERLAPPEDPLUS *lpOverlapped, SOCK_INFO *Context)
void | ReleaseSocketLock (SOCK_INFO *SockInfo)
void | RemoveSocketInfo (PROVIDER *provider, SOCK_INFO *sock)
int | StopAsyncWindowManager ()
int | StopOverlappedManager ()
void | UnlockSocketContext (SOCK_INFO *context, int *err)

Variables

WSPUPCALLTABLE | MainUpCallTable

Define Documentation

#define LSP_OP_ACCEPTEX 7

Definition at line 263 of file provider.h.

#define LSP_OP_CONNECTEX 8

Definition at line 264 of file provider.h.

#define LSP_OP_DISCONNECTEX 9

Definition at line 265 of file provider.h.

#define LSP_OP_IOCTL 1

Definition at line 257 of file provider.h.

#define LSP_OP_RECV 2

Definition at line 258 of file provider.h.

#define LSP_OP_RECVFROM 3

Definition at line 259 of file provider.h.

#define LSP_OP_SEND 4

Definition at line 260 of file provider.h.

#define LSP_OP_SENDTO 5

Definition at line 261 of file provider.h.

#define LSP_OP_TRANSMITFILE 6

Definition at line 262 of file provider.h.

#define LSP_OP_TRANSMITPACKETS 10

Definition at line 266 of file provider.h.

#define LSP_OP_WSARECVMSG 11

Definition at line 267 of file provider.h.

#define WM_SOCKET (WM_USER + 1)

Definition at line 26 of file provider.h.

Typedef Documentation

typedef struct _ACCEPTEXARGS ACCEPTEXARGS
typedef struct _CONNECTEXARGS CONNECTEXARGS
typedef struct _DISCONNECTEXARGS DISCONNECTEXARGS
typedef struct _EXT_WSPPROC_TABLE EXT_WSPPROC_TABLE
typedef struct _IOCTLARGS IOCTLARGS
typedef struct _PROVIDER * LPPROVIDER
typedef struct _WSAOVERLAPPEDPLUS * LPWSAOVERLAPPEDPLUS
typedef struct _PROVIDER PROVIDER
typedef struct _RECVARGS RECVARGS
typedef struct _RECVFROMARGS RECVFROMARGS
typedef struct _SENDARGS SENDARGS
typedef struct _SENDTOARGS SENDTOARGS
typedef struct _SOCK_INFO SOCK_INFO
typedef struct _TRANSMITFILEARGS TRANSMITFILEARGS
typedef struct _TRANSMITPACKETSARGS TRANSMITPACKETSARGS
typedef struct _WSAOVERLAPPEDPLUS WSAOVERLAPPEDPLUS
typedef struct _WSARECVMSGARGS WSARECVMSGARGS

Function Documentation

void AcquireSocketLock ( SOCK_INFO * SockInfo )

Definition at line 123 of file sockinfo.cpp.

{
    EnterCriticalSection(&SockInfo->SockCritSec);
}

void CloseAndFreeSocketInfo ( PROVIDER * provider )

Definition at line 267 of file sockinfo.cpp.

{
    SOCK_INFO    *si=NULL,
                 *siprev=NULL;
    struct linger linger;
    int           Error, ret;

    linger.l_onoff = 1;
    linger.l_linger = 0;

    // Walk the list of sockets
    si = provider->SocketList;
    while (si)
    {
        // Set the abortive linger
        ret = provider->NextProcTable.lpWSPSetSockOpt(
            si->ProviderSocket,
            SOL_SOCKET,
            SO_LINGER,
            (char *)&linger,
            sizeof(linger),
            &Error);
        if (ret != SOCKET_ERROR)
        {
            // Close the lower provider socket
            ret = provider->NextProcTable.lpWSPCloseSocket(
                si->ProviderSocket,
                &Error);
            if (ret == SOCKET_ERROR)
            {
                dbgprint("WSPCloseSocket() on handle %d failed: %d", si->ProviderSocket, Error);
            }
            #ifdef DEBUG
            else
            {
                dbgprint("Successfully closed socket %d", si->ProviderSocket);
            }
            #endif
        }
        #ifdef DEBUG
        else
        {
            dbgprint("WSPSetSockOpt(SO_LINGER) failed: %d", Error);
        }
        #endif

        // Close the layered handle
        MainUpCallTable.lpWPUCloseSocketHandle(
            si->LayeredSocket,
            &Error);

        siprev = si;
        si = si->next;

        // Free the context structure
        FreeSockInfo(siprev);
    }
    return;
}

WSABUF* CopyBuffer | ( | WSABUF * | BufferArray,
 |  | DWORD | BufferCount
 | ) |  |

Definition at line 3375 of file spi.cpp.

{
    WSABUF      *buffercopy=NULL;
    DWORD        i;

    if (ghIocp == NULL)
    {
        // We're on Win9x -- we need to save off the WSABUF structures
        // because on Win9x, the overlapped operation does not execute
        // immediately and the Winsock spec says apps are free to use
        // stack based WSABUF arrays.

        buffercopy = (WSABUF *)HeapAlloc(hLspHeap, HEAP_ZERO_MEMORY, sizeof(WSABUF) * BufferCount);
        if (buffercopy == NULL)
        {
            wsprintf(Msg, TEXT("CopyBuffer: HeapAlloc failed: %d\r\n"), GetLastError());
            return NULL;
        }
        for(i=0; i < BufferCount ;i++)
        {
            buffercopy[i].buf = BufferArray[i].buf;
            buffercopy[i].len = BufferArray[i].len;
        }
        return buffercopy;
    }
    else
    {
        // With completion ports, we post the overlapped operation
        // immediately to the lower provider which should capture
        // the WSABUF array members itself. If your LSP needs to
        // look at the buffers after the operation is initiated,
        // you'd better always copy the WSABUF array.

        return BufferArray;
    }
}

void CopyOffset | ( | WSAOVERLAPPED * | ProviderOverlapped,
 |  | WSAOVERLAPPED * | UserOverlapped
 | ) |  |

Definition at line 3356 of file spi.cpp.

{
    ProviderOverlapped->Offset     = UserOverlapped->Offset;
    ProviderOverlapped->OffsetHigh = UserOverlapped->OffsetHigh;
}

SOCK_INFO* CreateSockInfo | ( | PROVIDER * | Provider,
 |  | SOCKET | ProviderSocket,
 |  | SOCK_INFO * | Inherit,
 |  | BOOL | Insert = TRUE
 | ) |  |

Definition at line 155 of file sockinfo.cpp.

{
    SOCK_INFO   *NewInfo=NULL;

    NewInfo = (SOCK_INFO *)HeapAlloc(hLspHeap,
                                     HEAP_ZERO_MEMORY,
                                     sizeof(SOCK_INFO));
    if (NewInfo == NULL)
    {
        dbgprint("HeapAlloc() failed: %d", GetLastError());
        return NULL;
    }
    NewInfo->ProviderSocket     = ProviderSocket;
    NewInfo->bClosing           = FALSE;
    NewInfo->dwOutstandingAsync = 0;
    NewInfo->BytesRecv          = 0;
    NewInfo->BytesSent          = 0;
    NewInfo->Provider           = Provider;
    NewInfo->hWnd               = (Inherit ? Inherit->hWnd : 0);
    NewInfo->uMsg               = (Inherit ? Inherit->uMsg : 0);

    InitializeCriticalSection(&NewInfo->SockCritSec);

    if (Insert == TRUE)
    {
        InsertSocketInfo(Provider, NewInfo);
    }

    return NewInfo;
}

void dbgprint | ( | char * | format,
 |  |  | ...
 | ) |  |

Definition at line 78 of file spi.cpp.

{
    static  DWORD pid=0;
    va_list vl;
    char    dbgbuf1[2048],
            dbgbuf2[2048];

    // Prepend the process ID to the message
    if (pid == 0)
    {
        pid = GetCurrentProcessId();
    }

    EnterCriticalSection(&gDebugCritSec);
    va_start(vl, format);
    wvsprintf(dbgbuf1, format, vl);
    wsprintf(dbgbuf2, "%lu: %s\r\n", pid, dbgbuf1);
    va_end(vl);

    OutputDebugString(dbgbuf2);
    LeaveCriticalSection(&gDebugCritSec);
}

BOOL PASCAL FAR ExtAcceptEx | ( | IN SOCKET | sListenSocket,
 |  | IN SOCKET | sAcceptSocket,
 |  | IN PVOID | lpOutputBuffer,
 |  | IN DWORD | dwReceiveDataLength,
 |  | IN DWORD | dwLocalAddressLength,
 |  | IN DWORD | dwRemoteAddressLength,
 |  | OUT LPDWORD | lpdwBytesReceived,
 |  | IN LPOVERLAPPED | lpOverlapped
 | ) |  |

Definition at line 224 of file extension.cpp.

{
  LPWSAOVERLAPPEDPLUS ProviderOverlapped;
  SOCK_INFO          *ListenSocketContext=NULL,
                     *AcceptSocketContext=NULL;
  int                 Errno,
                        ret;

    //
    // Query the socket context for the listening socket
    //
    ListenSocketContext = FindAndLockSocketContext(sListenSocket, &Errno);
    if (ListenSocketContext == NULL)
    {
        dbgprint("AcceptExExt: WPUQuerySocketHandleContext "
                  "on listen socket failed: %d", Errno);
        Errno = WSAENOTSOCK;
        WSASetLastError(Errno);
    return FALSE;
    }
    //
    // Also need to query the socket context for the accept socket
    //
    AcceptSocketContext = FindAndLockSocketContext(sAcceptSocket, &Errno);
    if (AcceptSocketContext == NULL)
    {
        UnlockSocketContext(ListenSocketContext, &Errno);

        dbgprint("AcceptExExt: WPUQuerySocketHandleContext "
                  "on accept socket failed: %d", Errno);
        Errno = WSAENOTSOCK;
        WSASetLastError(Errno);
    return FALSE;
    }

    if (!ListenSocketContext->Provider->NextProcTableExt.lpfnAcceptEx)
    {
        GUID    guidAcceptEx = WSAID_ACCEPTEX;

        if (LoadExtensionFunction(
                (FARPROC **)&ListenSocketContext->Provider->NextProcTableExt.lpfnAcceptEx,
                guidAcceptEx,
                ListenSocketContext->Provider->NextProcTable.lpWSPIoctl,
                ListenSocketContext->ProviderSocket
                ) == FALSE)
        {
            UnlockSocketContext(ListenSocketContext, &Errno);
            UnlockSocketContext(AcceptSocketContext, &Errno);

            dbgprint("Lower provider AcceptEx == NULL!");
            WSASetLastError(WSAEFAULT);
            return FALSE;
        }
    }

  // Check for overlapped I/O

  if (lpOverlapped)
  {
    ProviderOverlapped = GetOverlappedStructure(ListenSocketContext);
        if (!ProviderOverlapped)
        {
            UnlockSocketContext(ListenSocketContext, &Errno);
            UnlockSocketContext(AcceptSocketContext, &Errno);

            dbgprint("ExtAcceptEx: GetOverlappedStructre() returne NULL!");
            WSASetLastError(WSAENOBUFS);
            return FALSE;
        }

        // Verify the event is valid
        __try {
            if ( lpOverlapped->hEvent != NULL )
            {
                ret = ResetEvent((HANDLE)((ULONG_PTR)lpOverlapped->hEvent & ~EventMask));
                if (ret == 0)
                {
                    // Return to original state and indicate error
                    (ListenSocketContext->dwOutstandingAsync)--;

                    UnlockSocketContext(ListenSocketContext, &Errno);
                    UnlockSocketContext(AcceptSocketContext, &Errno);

                    PutbackOverlappedStructure(ProviderOverlapped);
                    WSASetLastError(ERROR_INVALID_HANDLE);
                    return FALSE;
                }
            }
            CopyOffset(&ProviderOverlapped->ProviderOverlapped, lpOverlapped);
            ProviderOverlapped->AcceptExArgs.dwBytesReceived = (lpdwBytesReceived ? *lpdwBytesReceived : 0);
        }
        __except(EXCEPTION_EXECUTE_HANDLER)
        {
            // Return to original state and indicate error
            (ListenSocketContext->dwOutstandingAsync)--;

            UnlockSocketContext(ListenSocketContext, &Errno);
            UnlockSocketContext(AcceptSocketContext, &Errno);

            PutbackOverlappedStructure(ProviderOverlapped);
            WSASetLastError(WSAEFAULT);
            return FALSE;
        }
        //
        // Save off the paramters and initalize the overlapped structure
        //
        ProviderOverlapped->lpCallerOverlapped = lpOverlapped;
        ProviderOverlapped->SockInfo           = ListenSocketContext;
        ProviderOverlapped->CallerSocket       = sListenSocket;
        ProviderOverlapped->ProviderSocket     = ListenSocketContext->ProviderSocket;
        ProviderOverlapped->Error              = NO_ERROR;
        ProviderOverlapped->Operation          = LSP_OP_ACCEPTEX;
        ProviderOverlapped->lpCallerCompletionRoutine          = NULL;
        ProviderOverlapped->AcceptExArgs.sAcceptSocket         = sAcceptSocket;
        ProviderOverlapped->AcceptExArgs.sProviderAcceptSocket = AcceptSocketContext->ProviderSocket;
        ProviderOverlapped->AcceptExArgs.lpOutputBuffer        = lpOutputBuffer;
        ProviderOverlapped->AcceptExArgs.dwReceiveDataLength   = dwReceiveDataLength;
        ProviderOverlapped->AcceptExArgs.dwLocalAddressLength  = dwLocalAddressLength;
        ProviderOverlapped->AcceptExArgs.dwRemoteAddressLength = dwRemoteAddressLength;
        ProviderOverlapped->Provider = AcceptSocketContext->Provider;

        ret = QueueOverlappedOperation(ProviderOverlapped, ListenSocketContext);

        if (ret != NO_ERROR)
        {
            WSASetLastError(ret);
            ret = FALSE;
        }
        else
        {
            ret = TRUE;
        }
  }
  else
  {
    ret = ListenSocketContext->Provider->NextProcTableExt.lpfnAcceptEx(
      ListenSocketContext->ProviderSocket,
      AcceptSocketContext->ProviderSocket,
      lpOutputBuffer,
      dwReceiveDataLength,
      dwLocalAddressLength,
      dwRemoteAddressLength,
      lpdwBytesReceived,
      NULL);
  }

    UnlockSocketContext(ListenSocketContext, &Errno);
    UnlockSocketContext(AcceptSocketContext, &Errno);

    return ret;
}

BOOL PASCAL FAR ExtConnectEx | ( | IN SOCKET | s,
 |  | IN const struct sockaddr FAR * | name,
 |  | IN int | namelen,
 |  | IN PVOID lpSendBuffer | OPTIONAL,
 |  | IN DWORD | dwSendDataLength,
 |  | OUT LPDWORD | lpdwBytesSent,
 |  | IN LPOVERLAPPED | lpOverlapped
 | ) |  |

Definition at line 393 of file extension.cpp.

{
    SOCK_INFO           *SocketContext=NULL;
    LPWSAOVERLAPPEDPLUS  ProviderOverlapped=NULL;
    int                  Errno,
                         ret;

    // Get the context
    SocketContext = FindAndLockSocketContext(s, &Errno);
    if (SocketContext == NULL)
    {
        dbgprint("ExtConnectEx: WPUQuerySocketHandleContext() failed: %d", Errno);
        return FALSE;
    }

    // Verify the function pointer is correct
    if (!SocketContext->Provider->NextProcTableExt.lpfnConnectEx)
    {
        GUID    guidConnectEx = WSAID_CONNECTEX;

        if (LoadExtensionFunction(
                (FARPROC **)&SocketContext->Provider->NextProcTableExt.lpfnConnectEx,
                guidConnectEx,
                SocketContext->Provider->NextProcTable.lpWSPIoctl,
                SocketContext->ProviderSocket
                ) == FALSE)
        {
            UnlockSocketContext(SocketContext, &Errno);

            dbgprint("Next proc table ConnectEx == NULL!");
            WSASetLastError(WSAEFAULT);
            return FALSE;
        }
    }

    // Check for overlapped I/O

    if (lpOverlapped)
    {
        ProviderOverlapped = GetOverlappedStructure(SocketContext);
        if (!ProviderOverlapped)
        {
            UnlockSocketContext(SocketContext, &Errno);

            dbgprint("ExtConnectEx: GetOverlappedStructure() returned NULL");
            WSASetLastError(WSAENOBUFS);
            return FALSE;
        }
        //
        // Save off the arguments and setup the overlapped structure
        //
        // Also reset the event handle if present
        //
        __try {
            if ( lpOverlapped->hEvent != NULL )
            {
                ret = ResetEvent((HANDLE)((ULONG_PTR)lpOverlapped->hEvent & ~EventMask));
                if (ret == 0)
                {
                    // Return to original state and indicate error
                    (SocketContext->dwOutstandingAsync)--;
                    UnlockSocketContext(SocketContext, &Errno);
                    PutbackOverlappedStructure(ProviderOverlapped);
                    WSASetLastError(ERROR_INVALID_HANDLE);
                    return FALSE;
                }
            }
            CopyOffset(&ProviderOverlapped->ProviderOverlapped, lpOverlapped);
            if (namelen <= sizeof(ProviderOverlapped->ConnectExArgs.name))
                CopyMemory(&ProviderOverlapped->ConnectExArgs.name, name, namelen);
            ProviderOverlapped->ConnectExArgs.dwBytesSent = (lpdwBytesSent ? *lpdwBytesSent : 0);
        }
        __except(EXCEPTION_EXECUTE_HANDLER)
        {
            (SocketContext->dwOutstandingAsync)--;
            UnlockSocketContext(SocketContext, &Errno);
            PutbackOverlappedStructure(ProviderOverlapped);
            WSASetLastError(WSAEFAULT);
            return FALSE;
        }

        ProviderOverlapped->lpCallerOverlapped = lpOverlapped;
        ProviderOverlapped->SockInfo           = SocketContext;
        ProviderOverlapped->CallerSocket       = s;
        ProviderOverlapped->ProviderSocket     = SocketContext->ProviderSocket;
        ProviderOverlapped->Error              = NO_ERROR;
        ProviderOverlapped->Operation          = LSP_OP_CONNECTEX;
        ProviderOverlapped->lpCallerCompletionRoutine      = NULL;
        ProviderOverlapped->ConnectExArgs.s                = s;
        ProviderOverlapped->ConnectExArgs.namelen          = namelen;
        ProviderOverlapped->ConnectExArgs.lpSendBuffer     = lpSendBuffer;
        ProviderOverlapped->ConnectExArgs.dwSendDataLength = dwSendDataLength;
        ProviderOverlapped->Provider           = SocketContext->Provider;

        ret = QueueOverlappedOperation(ProviderOverlapped, SocketContext);

        if (ret != NO_ERROR)
        {
            WSASetLastError(ret);
            ret = FALSE;
        }
        else
        {
            ret = TRUE;
        }
    }
    else
    {
        ret = SocketContext->Provider->NextProcTableExt.lpfnConnectEx(
            SocketContext->ProviderSocket,
            name,
            namelen,
            lpSendBuffer,
            dwSendDataLength,
            lpdwBytesSent,
            NULL);
    }
    UnlockSocketContext(SocketContext, &Errno);

    return ret;
}

BOOL PASCAL FAR ExtDisconnectEx | ( | IN SOCKET | s,
 |  | IN LPOVERLAPPED | lpOverlapped,
 |  | IN DWORD | dwFlags,
 |  | IN DWORD | dwReserved
 | ) |  |

Definition at line 663 of file extension.cpp.

{
    SOCK_INFO           *SocketContext=NULL;
    LPWSAOVERLAPPEDPLUS  ProviderOverlapped=NULL;
    int                  Errno,
                         ret;

    // Get the context
    SocketContext = FindAndLockSocketContext(s, &Errno);
    if (SocketContext == NULL)
    {
        dbgprint("ExtDisconnectEx: WPUQuerySocketHandleContext() failed: %d", Errno);
        WSASetLastError(Errno);
        return FALSE;
    }

    // Make sure we already have the extension function
    if (!SocketContext->Provider->NextProcTableExt.lpfnDisconnectEx)
    {
        GUID    guidDisconnectEx = WSAID_DISCONNECTEX;

        if (LoadExtensionFunction(
                 (FARPROC **)&SocketContext->Provider->NextProcTableExt.lpfnDisconnectEx,
                 guidDisconnectEx,
                 SocketContext->Provider->NextProcTable.lpWSPIoctl,
                 SocketContext->ProviderSocket
                 ) == NULL)
        {
            UnlockSocketContext(SocketContext, &Errno);
            dbgprint("Next proc table DisconnectEx == NULL!");
            WSASetLastError(WSAEFAULT);
            return FALSE;
        }
    }

    // Check for overlapped I/O

    if (lpOverlapped)
    {
        ProviderOverlapped = GetOverlappedStructure(SocketContext);
        if (!ProviderOverlapped)
        {
            UnlockSocketContext(SocketContext, &Errno);
            dbgprint("ExtDisconnectEx: GetOverlappedStructure() returned NULL");
            WSASetLastError(WSAENOBUFS);
            return FALSE;
        }
        //
        // Save off the arguments and setup the overlapped structure
        //
        // Verify the event is valid
        //
        __try {
            if ( lpOverlapped->hEvent != NULL )
            {
                ret = ResetEvent((HANDLE)((ULONG_PTR)lpOverlapped->hEvent & ~EventMask));
                if (ret == 0)
                {
                    (SocketContext->dwOutstandingAsync)--;
                    PutbackOverlappedStructure(ProviderOverlapped);
                    UnlockSocketContext(SocketContext, &Errno);
                    WSASetLastError(ERROR_INVALID_HANDLE);
                    return FALSE;
                }
            }
            CopyOffset(&ProviderOverlapped->ProviderOverlapped, lpOverlapped);
        }
        __except(EXCEPTION_EXECUTE_HANDLER)
        {
            (SocketContext->dwOutstandingAsync)--;
            PutbackOverlappedStructure(ProviderOverlapped);
            UnlockSocketContext(SocketContext, &Errno);
            WSASetLastError(WSAEFAULT);
            return FALSE;
        }

        ProviderOverlapped->lpCallerOverlapped = lpOverlapped;
        ProviderOverlapped->SockInfo           = SocketContext;
        ProviderOverlapped->CallerSocket       = s;
        ProviderOverlapped->ProviderSocket     = SocketContext->ProviderSocket;
        ProviderOverlapped->Error              = NO_ERROR;
        ProviderOverlapped->Operation          = LSP_OP_DISCONNECTEX;
        ProviderOverlapped->lpCallerCompletionRoutine           = NULL;
        ProviderOverlapped->DisconnectExArgs.s                  = s;
        ProviderOverlapped->DisconnectExArgs.dwFlags            = dwFlags;
        ProviderOverlapped->DisconnectExArgs.dwReserved         = dwReserved;
        ProviderOverlapped->Provider           = SocketContext->Provider;

        ret = QueueOverlappedOperation(ProviderOverlapped, SocketContext);

        if (ret != NO_ERROR)
        {
            WSASetLastError(ret);
            ret = FALSE;
        }
        else
        {
            ret = TRUE;
        }
    }
    else
    {
        ret = SocketContext->Provider->NextProcTableExt.lpfnDisconnectEx(
            SocketContext->ProviderSocket,
            lpOverlapped,
            dwFlags,
            dwReserved);
    }
    UnlockSocketContext(SocketContext, &Errno);

    return ret;
}

BOOL PASCAL FAR ExtTransmitFile | ( | IN SOCKET | hSocket,
 |  | IN HANDLE | hFile,
 |  | IN DWORD | nNumberOfBytesToWrite,
 |  | IN DWORD | nNumberOfBytesPerSend,
 |  | IN LPOVERLAPPED | lpOverlapped,
 |  | IN LPTRANSMIT_FILE_BUFFERS | lpTransmitBuffers,
 |  | IN DWORD | dwReserved
 | ) |  |

Definition at line 90 of file extension.cpp.

{
  SOCK_INFO          *SocketContext;
  LPWSAOVERLAPPEDPLUS ProviderOverlapped;
  int                 Errno,
                        ret;

    // Get the context
    SocketContext = FindAndLockSocketContext(hSocket, &Errno);
    if (SocketContext == NULL)
    {
        dbgprint("ExtTransmitFile: WPUQuerySocketHandleContext() failed: %d", Errno);
        WSASetLastError(Errno);
    return FALSE;
    }

    // Make sure we already have the extension function
    if (!SocketContext->Provider->NextProcTableExt.lpfnTransmitFile)
    {
        GUID    guidTransmitFile = WSAID_TRANSMITFILE;

        if (LoadExtensionFunction(
                (FARPROC **)&SocketContext->Provider->NextProcTableExt.lpfnTransmitFile,
                guidTransmitFile,
                SocketContext->Provider->NextProcTable.lpWSPIoctl,
                SocketContext->ProviderSocket
                ) == FALSE)
        {
            UnlockSocketContext(SocketContext, &Errno);
            dbgprint("Next proc table TransmitFile == NULL!");
            WSASetLastError(WSAEFAULT);
            return FALSE;
        }
    }

  // Check for overlapped I/O

  if (lpOverlapped)
  {
    ProviderOverlapped = GetOverlappedStructure(SocketContext);
        if (!ProviderOverlapped)
        {
            UnlockSocketContext(SocketContext, &Errno);
            dbgprint("ExtTransmitFile: GetOverlappedStructure() returned NULL!");
            WSASetLastError(WSAENOBUFS);
            return FALSE;
        }
        // Verify the event is valid
        __try {
            if ( lpOverlapped->hEvent != NULL )
            {
                ret = ResetEvent((HANDLE)((ULONG_PTR)lpOverlapped->hEvent & ~EventMask));
                if (ret == 0)
                {
                    // Return to original state and indicate error
                    (SocketContext->dwOutstandingAsync)--;
                    UnlockSocketContext(SocketContext, &Errno);
                    PutbackOverlappedStructure(ProviderOverlapped);
                    WSASetLastError(ERROR_INVALID_HANDLE);
                    return FALSE;
                }
            }
            CopyOffset(&ProviderOverlapped->ProviderOverlapped, lpOverlapped);
        }
        __except(EXCEPTION_EXECUTE_HANDLER)
        {
            // Return to original state and indicate error
            (SocketContext->dwOutstandingAsync)--;
            UnlockSocketContext(SocketContext, &Errno);
            PutbackOverlappedStructure(ProviderOverlapped);
            WSASetLastError(WSAEFAULT);
            return FALSE;
        }
        //
        // Save off the arguments and setup the overlapped structure
        //
        ProviderOverlapped->lpCallerOverlapped = lpOverlapped;
        ProviderOverlapped->SockInfo           = SocketContext;
        ProviderOverlapped->CallerSocket       = hSocket;
        ProviderOverlapped->ProviderSocket     = SocketContext->ProviderSocket;
        ProviderOverlapped->Error              = NO_ERROR;
        ProviderOverlapped->Operation          = LSP_OP_TRANSMITFILE;
        ProviderOverlapped->lpCallerCompletionRoutine              = NULL;
        ProviderOverlapped->TransmitFileArgs.hFile                 = hFile;
        ProviderOverlapped->TransmitFileArgs.nNumberOfBytesToWrite = nNumberOfBytesToWrite;
        ProviderOverlapped->TransmitFileArgs.nNumberOfBytesPerSend = nNumberOfBytesPerSend;
        ProviderOverlapped->TransmitFileArgs.lpTransmitBuffers     = lpTransmitBuffers;
        ProviderOverlapped->TransmitFileArgs.dwFlags               = dwFlags;
        ProviderOverlapped->Provider = SocketContext->Provider;

        ret = QueueOverlappedOperation(ProviderOverlapped, SocketContext);

        if (ret != NO_ERROR)
        {
            WSASetLastError(ret);
            ret = FALSE;
        }
        else
        {
            ret = TRUE;
        }
  }
  else
  {
    ret = SocketContext->Provider->NextProcTableExt.lpfnTransmitFile(
      SocketContext->ProviderSocket,
      hFile,
      nNumberOfBytesToWrite,
      nNumberOfBytesPerSend,
      NULL,
      lpTransmitBuffers,
      dwFlags);
  }

    UnlockSocketContext(SocketContext, &Errno);

    return ret;
}

BOOL PASCAL FAR ExtTransmitPackets | ( | SOCKET | hSocket,
 |  | LPTRANSMIT_PACKETS_ELEMENT | lpPacketArray,
 |  | DWORD | nElementCount,
 |  | DWORD | nSendSize,
 |  | LPOVERLAPPED | lpOverlapped,
 |  | DWORD | dwFlags
 | ) |  |

Definition at line 530 of file extension.cpp.

{
    SOCK_INFO           *SocketContext=NULL;
    LPWSAOVERLAPPEDPLUS  ProviderOverlapped=NULL;
    int                  Errno,
                         ret;

    // Get the context
    SocketContext = FindAndLockSocketContext(hSocket, &Errno);
    if (SocketContext == NULL)
    {
        dbgprint("ExtTransmitPackets: WPUQuerySocketHandleContext() failed: %d", Errno);
        WSASetLastError(Errno);
        return FALSE;
    }

    // Make sure we already have the extension function
    if (!SocketContext->Provider->NextProcTableExt.lpfnTransmitPackets)
    {
        GUID    guidTransmitPackets = WSAID_TRANSMITPACKETS;

        if (LoadExtensionFunction(
                (FARPROC **)&SocketContext->Provider->NextProcTableExt.lpfnTransmitPackets,
                guidTransmitPackets,
                SocketContext->Provider->NextProcTable.lpWSPIoctl,
                SocketContext->ProviderSocket
                ) == FALSE)
        {
            UnlockSocketContext(SocketContext, &Errno);
            dbgprint("Next proc table TransmitPackets == NULL!");
            WSASetLastError(WSAEFAULT);
            return FALSE;
        }
    }
    //
    // Check for overlapped I/O
    //
    if (lpOverlapped)
    {
        ProviderOverlapped = GetOverlappedStructure(SocketContext);
        if (!ProviderOverlapped)
        {
            UnlockSocketContext(SocketContext, &Errno);
            dbgprint("ExtTransmitPackets: GetOverlappedStructure() returned NULL");
            WSASetLastError(WSAENOBUFS);
            return FALSE;
        }
        //
        // Save off the arguments and setup the overlapped structure
        //
        // Verify the event is valid
        //
        __try {
            if ( lpOverlapped->hEvent != NULL )
            {
                ret = ResetEvent((HANDLE)((ULONG_PTR)lpOverlapped->hEvent & ~EventMask));
                if (ret == 0)
                {
                    // Return to original state and indicate error
                    (SocketContext->dwOutstandingAsync)--;
                    UnlockSocketContext(SocketContext, &Errno);
                    PutbackOverlappedStructure(ProviderOverlapped);
                    WSASetLastError(ERROR_INVALID_HANDLE);
                    return FALSE;
                }
            }
            CopyOffset(&ProviderOverlapped->ProviderOverlapped, lpOverlapped);
        }
        __except(EXCEPTION_EXECUTE_HANDLER)
        {
            // Return to original state and indicate error
            (SocketContext->dwOutstandingAsync)--;
            UnlockSocketContext(SocketContext, &Errno);
            PutbackOverlappedStructure(ProviderOverlapped);
            WSASetLastError(WSAEFAULT);
            return FALSE;
        }
        ProviderOverlapped->lpCallerOverlapped = lpOverlapped;
        ProviderOverlapped->SockInfo           = SocketContext;
        ProviderOverlapped->CallerSocket       = hSocket;
        ProviderOverlapped->ProviderSocket     = SocketContext->ProviderSocket;
        ProviderOverlapped->Error              = NO_ERROR;
        ProviderOverlapped->Operation          = LSP_OP_TRANSMITPACKETS;
        ProviderOverlapped->lpCallerCompletionRoutine           = NULL;
        ProviderOverlapped->TransmitPacketsArgs.s               = hSocket;
        ProviderOverlapped->TransmitPacketsArgs.lpPacketArray   = lpPacketArray;
        ProviderOverlapped->TransmitPacketsArgs.nElementCount   = nElementCount;
        ProviderOverlapped->TransmitPacketsArgs.nSendSize       = nSendSize;
        ProviderOverlapped->TransmitPacketsArgs.dwFlags         = dwFlags;
        ProviderOverlapped->Provider           = SocketContext->Provider;

        ret = QueueOverlappedOperation(ProviderOverlapped, SocketContext);

        if (ret != NO_ERROR)
        {
            WSASetLastError(ret);
            ret = FALSE;
        }
        else
        {
            ret = TRUE;
        }

    }
    else
    {
        ret = SocketContext->Provider->NextProcTableExt.lpfnTransmitPackets(
            SocketContext->ProviderSocket,
            lpPacketArray,
            nElementCount,
            nSendSize,
            NULL,
            dwFlags);
    }
    UnlockSocketContext(SocketContext, &Errno);

    return ret;
}

INT PASCAL FAR ExtWSARecvMsg | ( | IN SOCKET | s,
 |  | IN OUT LPWSAMSG | lpMsg,
 |  | OUT LPDWORD | lpdwNumberOfBytesRecvd,
 |  | IN LPWSAOVERLAPPED | lpOverlapped,
 |  | IN LPWSAOVERLAPPED_COMPLETION_ROUTINE | lpCompletionRoutine
 | ) |  |

Definition at line 789 of file extension.cpp.

{
    SOCK_INFO           *SocketContext=NULL;
    LPWSAOVERLAPPEDPLUS  ProviderOverlapped=NULL;
    int                  Errno,
                         ret = NO_ERROR;

    // Get the context
    SocketContext = FindAndLockSocketContext(s, &Errno);
    if (SocketContext == NULL)
    {
        dbgprint("ExtWSARecvmsg: WPUQuerySocketHandleContext() failed: %d", Errno);
        WSASetLastError(Errno);
        return SOCKET_ERROR;
    }

    // Make sure we already have the extension function
    if (!SocketContext->Provider->NextProcTableExt.lpfnWSARecvMsg)
    {
        GUID    guidWSARecvMsg = WSAID_WSARECVMSG;

        if (LoadExtensionFunction(
                (FARPROC **)&SocketContext->Provider->NextProcTableExt.lpfnWSARecvMsg,
                guidWSARecvMsg,
                SocketContext->Provider->NextProcTable.lpWSPIoctl,
                SocketContext->ProviderSocket
                ) == FALSE)
        {
            UnlockSocketContext(SocketContext, &Errno);
            dbgprint("Next proc table WSARecvMsg == NULL!");
            WSASetLastError(WSAEFAULT);
            return SOCKET_ERROR;
        }
    }
    //
    // Check for overlapped I/O
    //
    if (lpOverlapped)
    {
        ProviderOverlapped = GetOverlappedStructure(SocketContext);
        if (!ProviderOverlapped)
        {
            UnlockSocketContext(SocketContext, &Errno);
            dbgprint("ExtWSARecvMsg: GetOverlappedStructure() returned NULL");
            WSASetLastError(WSAENOBUFS);
            return SOCKET_ERROR;
        }
        //
        // Save off the arguments and setup the overlapped structure
        //
        __try {
            if (( lpCompletionRoutine == NULL ) && ( lpOverlapped->hEvent != NULL ))
            {
                // Verify the event is valid
                ret = ResetEvent((HANDLE)((ULONG_PTR)lpOverlapped->hEvent & ~EventMask));
                if (ret == 0)
                {
                    // Return to original state and indicate error
                    (SocketContext->dwOutstandingAsync)--;
                    UnlockSocketContext(SocketContext, &Errno);
                    PutbackOverlappedStructure(ProviderOverlapped);
                    WSASetLastError(ERROR_INVALID_HANDLE);
                    return SOCKET_ERROR;
                }
            }
            CopyOffset(&ProviderOverlapped->ProviderOverlapped, lpOverlapped);
            ProviderOverlapped->WSARecvMsgArgs.dwNumberOfBytesRecvd = (lpdwNumberOfBytesRecvd ? *lpdwNumberOfBytesRecvd : 0);
        }
        __except(EXCEPTION_EXECUTE_HANDLER)
        {
            // Return to original state and indicate error
            (SocketContext->dwOutstandingAsync)--;
            UnlockSocketContext(SocketContext, &Errno);
            PutbackOverlappedStructure(ProviderOverlapped);
            WSASetLastError(WSAEFAULT);
            return SOCKET_ERROR;
        }
        ProviderOverlapped->lpCallerOverlapped = lpOverlapped;
        ProviderOverlapped->SockInfo           = SocketContext;
        ProviderOverlapped->CallerSocket       = s;
        ProviderOverlapped->ProviderSocket     = SocketContext->ProviderSocket;
        ProviderOverlapped->Error              = NO_ERROR;
        ProviderOverlapped->Operation          = LSP_OP_WSARECVMSG;
        ProviderOverlapped->lpCallerCompletionRoutine           = lpCompletionRoutine;
        ProviderOverlapped->WSARecvMsgArgs.s                    = s;
        ProviderOverlapped->WSARecvMsgArgs.lpMsg                = lpMsg;
        ProviderOverlapped->Provider           = SocketContext->Provider;

        ret = QueueOverlappedOperation(ProviderOverlapped, SocketContext);

        if (ret != NO_ERROR)
        {
            WSASetLastError(ret);
            ret = SOCKET_ERROR;
        }
        else
        {
            ret = NO_ERROR;
        }
    }
    else
    {
        ret = SocketContext->Provider->NextProcTableExt.lpfnWSARecvMsg(
            SocketContext->ProviderSocket,
            lpMsg,
            lpdwNumberOfBytesRecvd,
            NULL,
            NULL);
    }

    UnlockSocketContext(SocketContext, &Errno);

    return ret;
}

SOCK_INFO* FindAndLockSocketContext | ( | SOCKET | s,
 |  | int * | err
 | ) |  |

Definition at line 41 of file sockinfo.cpp.

{
    SOCK_INFO *SocketContext=NULL;
    int        ret;

    EnterCriticalSection(&gCriticalSection);

    ret = MainUpCallTable.lpWPUQuerySocketHandleContext(
            s,
            (PDWORD_PTR) &SocketContext,
            lpErrno
            );
    if (ret == SOCKET_ERROR)
    {
        dbgprint("FindAndLockSocketContext: WPUQuerySocketHandleContext failed: %d", *lpErrno);
    }
    else
    {
        InterlockedIncrement(&SocketContext->RefCount);
    }
    LeaveCriticalSection(&gCriticalSection);

    return SocketContext;
}

void FreeBuffer ( WSABUF * BufferArray )

Definition at line 3422 of file spi.cpp.

{
    if (ghIocp == NULL)
    {
        // If we're on Win9x, the WSABUF array was copied so free it up now

        HeapFree(hLspHeap, 0, BufferArray);
    }
}

void FreeSockInfo ( SOCK_INFO * info )

Definition at line 192 of file sockinfo.cpp.

{
    DeleteCriticalSection(&info->SockCritSec);
    HeapFree(hLspHeap, 0, info);

    return;
}

SOCK_INFO* GetCallerSocket | ( | PROVIDER * | provider,
 |  | SOCKET | ProviderSocket
 | ) |  |

Definition at line 338 of file sockinfo.cpp.

{
    SOCK_INFO *si;

    EnterCriticalSection(&gCriticalSection);

    if (provider)
    {
        // If we know the provider just search its list of sockets
        si = provider->SocketList;
        while(si)
        {
            if (si->ProviderSocket == ProviderSock)
            {
                LeaveCriticalSection(&gCriticalSection);
                return si;
            }
            si = si->next;
        }
    }
    else
    {
        // Don't know the provider so we must search all of them
        for(INT i=0; i < gLayerCount ;i++)
        {
            si = gBaseInfo[i].SocketList;
            while (si)
            {
                if (si->ProviderSocket == ProviderSock)
                {
                    LeaveCriticalSection(&gCriticalSection);
                    return si;
                }
                si = si->next;
            }
        }
    }

    LeaveCriticalSection(&gCriticalSection);
    return NULL;
}

LPWSAOVERLAPPEDPLUS GetOverlappedStructure ( SOCK_INFO * SocketContext )

Definition at line 804 of file overlap.cpp.

{
    LPWSAOVERLAPPEDPLUS lpWorkerOverlappedPlus = NULL;

    if (!SocketContext)
    {
        dbgprint("GetOverlappedStructure: SocketContext == NULL");
        return NULL;
    }

    AcquireSocketLock(SocketContext);

    EnterCriticalSection(&gOverlappedCS);
    //
    // We have to keep track of the number of outstanding overlapped requests
    // an application has. Otherwise, if the app were to close a socket that
    // had oustanding overlapped ops remaining, we'd start leaking structures
    // in OverlappedPool. The idea here is to force the CallerSocket to remain
    // open until the lower provider has processed all the overlapped requests.
    // If we closed both the lower socket and the caller socket, we would no
    // longer be able to correlate completed requests to any apps sockets.
    //
    (SocketContext->dwOutstandingAsync)++;

    if (FreePool)
    {
        lpWorkerOverlappedPlus = FreePool;
        FreePool = FreePool->next;
        lpWorkerOverlappedPlus->next = NULL;
    }
    else // Empty pool
    {
        if (AllocateFreePool() != WSAENOBUFS)
        {
            lpWorkerOverlappedPlus = FreePool;
            FreePool = FreePool->next;
            lpWorkerOverlappedPlus->next = NULL;
        }
    }
    if (lpWorkerOverlappedPlus)
        memset(lpWorkerOverlappedPlus, 0, sizeof(WSAOVERLAPPEDPLUS));

    LeaveCriticalSection(&gOverlappedCS);

    ReleaseSocketLock(SocketContext);

    return  lpWorkerOverlappedPlus;
}

HWND GetWorkerWindow ( )

Definition at line 84 of file asyncselect.cpp.

{
  DWORD ThreadId;

    EnterCriticalSection(&gCriticalSection);
  if (WorkerThreadHandle == NULL)
  {
    WorkerThreadHandle = CreateThread(NULL, 0, AsyncMsgHandler, NULL, 0, &ThreadId);
        if (WorkerThreadHandle)
        {
            // Wait for the window to become initialized
            while (AsyncWindow == NULL)
                SleepEx(0, TRUE);
        }
        else
        {
            dbgprint("GetWorkerWindow: CreateThread failed");
            AsyncWindow = NULL;
        }
  }
    LeaveCriticalSection(&gCriticalSection);

  return AsyncWindow;
}

void InitOverlappedCS ( void )
int InitOverlappedManager ( )

Definition at line 116 of file overlap.cpp.

{
    DWORD   dwId,
            i;

    EnterCriticalSection(&gOverlappedCS);

    // Make sure we're not already initialized -- we'll always have at least
    // one worker thread running
    if (gWorkerThread[0] != NULL)
    {
        LeaveCriticalSection(&gOverlappedCS);
        return 0;
    }

    // Allocate a block of our overlapped structures
    if (AllocateFreePool() == WSAENOBUFS)
    {
        LeaveCriticalSection(&gOverlappedCS);
        return WSAENOBUFS;
    }

    //
    // See if we're on NT by trying to create the completion port. If it
    //  fails then we're on Win9x.
    //
    ghIocp = CreateIoCompletionPort(INVALID_HANDLE_VALUE,
                                    NULL,
                                    (ULONG_PTR)0,
                                    0);
    if (ghIocp)
    {
        SYSTEM_INFO     sinfo;

        // We're on NT so figure out how many processors we have
        //
        GetSystemInfo(&sinfo);
        gdwThreadCount = sinfo.dwNumberOfProcessors;

        #ifdef DEBUG
        dbgprint("Created IOCP: %d", ghIocp);
        #endif
    }
    else
    {
        //
        // We're on Win9x so create a semaphore instead. This is used to
        //  wake up the worker thread to service overlapped IO calls.
        //
        ghWakeupSemaphore = CreateSemaphore(NULL,
                                            0,
                                            MAXLONG,
                                            NULL);
        if (!ghWakeupSemaphore)
        {
            dbgprint("InitOverlappedManager: CreateSemaphore() failed: %d", GetLastError());
            LeaveCriticalSection(&gOverlappedCS);
            return WSAEPROVIDERFAILEDINIT;
        }
        // This is Win9x, no multiproc support
        //
        gdwThreadCount = 1;
    }

    #ifdef DEBUG
    dbgprint("Creating %d threads", gdwThreadCount);
    #endif
    //
    // Create our worker threads
    //
    for(i=0; i < gdwThreadCount ;i++)
    {
        gWorkerThread[i] = CreateThread(NULL, 0, OverlappedManagerThread, (LPVOID)ghIocp, 0, &dwId);
        if (!gWorkerThread[i])
        {
            dbgprint("InitOverlappedManager: CreateThread() failed: %d", GetLastError());
            LeaveCriticalSection(&gOverlappedCS);
            return WSAEPROVIDERFAILEDINIT;
        }
    }
    LeaveCriticalSection(&gOverlappedCS);
    return 0;
}

void InsertSocketInfo | ( | PROVIDER * | provider,
 |  | SOCK_INFO * | sock
 | ) |  |

Definition at line 208 of file sockinfo.cpp.

{
    if (!provider || !sock)
    {
        dbgprint("InsertSocketInfo: PROVIDER or SOCK_INFO == NULL!");
        return;
    }

    EnterCriticalSection(&provider->ProviderCritSec);

    sock->next = sock->prev = NULL;

    sock->next = provider->SocketList;
    if (provider->SocketList)
    {
        provider->SocketList->prev = sock;
    }
    provider->SocketList = sock;

    LeaveCriticalSection(&provider->ProviderCritSec);

    SetEvent(gAddContextEvent);
}

void CALLBACK IntermediateCompletionRoutine | ( | DWORD | dwError,
 |  | DWORD | cbTransferred,
 |  | LPWSAOVERLAPPED | lpOverlapped,
 |  | DWORD | dwFlags
 | ) |  |

Definition at line 897 of file overlap.cpp.

{
    LPWSAOVERLAPPEDPLUS olp = (LPWSAOVERLAPPEDPLUS) lpOverlapped;
    SOCK_INFO          *SocketContext,
                       *AcceptSocketContext;
    int                 Error,
                        ret;

    if (lpOverlapped == NULL)
    {
        dbgprint("IntermediateCompletionRoutine: lpOverlapped == NULL!");
        return;
    }
    //
    // We actually already have the socket context for this operation (its in
    //    the WSAOVERLAPPEDPLUS structure but do this anyway to make sure the
    //    socket hasn't been closed as well as to increment the ref count while
    //    we're accessing the SOCK_INFO structure.
    //
    SocketContext = FindAndLockSocketContext(olp->CallerSocket, &Error);
    if (SocketContext == NULL)
    {
        dbgprint("IntermediateCompletionRoutine: WPUQuerySocketHandleContext failed: %d", Error);
        PutbackOverlappedStructure(olp);
        return;
    }

    if (dwError == WSA_IO_PENDING)
    {
        //
        // Get the results of the operation
        //
        dwError = NO_ERROR;
        ret = olp->Provider->NextProcTable.lpWSPGetOverlappedResult(olp->ProviderSocket,
                                                     lpOverlapped,
                                                    &cbTransferred,
                                                     FALSE,
                                                    &dwFlags,
                                                    (int *)&dwError);
        if (ret == FALSE)
        {
            dbgprint("IntermediateCompletionRoutine: WSPGetOverlappedResult failed: %d", dwError);
        }

        #ifdef DEBUG
        dbgprint("Bytes transferred on socket %d: %d [op=%d; err=%d]",
                olp->CallerSocket, cbTransferred, olp->Operation, dwError);
        #endif
    }

    olp->lpCallerOverlapped->Offset       = dwError;
    olp->lpCallerOverlapped->OffsetHigh   = dwFlags;
    olp->lpCallerOverlapped->InternalHigh = cbTransferred;

    if (dwError == 0)
    {
        AcquireSocketLock(SocketContext);
        switch (olp->Operation)
        {
            case LSP_OP_RECV:
                SocketContext->BytesRecv += cbTransferred;
                FreeBuffer(olp->RecvArgs.lpBuffers);
                break;
            case LSP_OP_RECVFROM:
                SocketContext->BytesRecv += cbTransferred;
                FreeBuffer(olp->RecvFromArgs.lpBuffers);
                break;
            case LSP_OP_SEND:
                SocketContext->BytesSent += cbTransferred;
                FreeBuffer(olp->SendArgs.lpBuffers);
                break;
            case LSP_OP_SENDTO:
                SocketContext->BytesSent += cbTransferred;
                FreeBuffer(olp->SendToArgs.lpBuffers);
                break;
            case LSP_OP_TRANSMITFILE:
                SocketContext->BytesSent += cbTransferred;
                break;
            case LSP_OP_TRANSMITPACKETS:
                break;
            case LSP_OP_ACCEPTEX:
                AcceptSocketContext = FindAndLockSocketContext(
                        olp->AcceptExArgs.sAcceptSocket,
                       &Error
                       );
                if (AcceptSocketContext == NULL)
                {
                    dbgprint("IntermediateCompletionRoutine: WPUQuerySocketHandleContext failed (accept socket)");
                }
                AcceptSocketContext->BytesRecv += cbTransferred;
                UnlockSocketContext(AcceptSocketContext, &Error);
                break;
            case LSP_OP_CONNECTEX:
                break;
            case LSP_OP_WSARECVMSG:
                break;
            default:
                break;
        }
        ReleaseSocketLock(SocketContext);
    }

    UnlockSocketContext(SocketContext, &Error);

    //
    // If the app supplied a completion routine, queue it up for completion
    //
    if (olp->lpCallerCompletionRoutine)
    {

        olp->lpCallerOverlapped->Internal = (ULONG_PTR)olp->lpCallerCompletionRoutine;

        if (MainUpCallTable.lpWPUQueueApc(&olp->CallerThreadId,
                                           CallUserApcProc,
                                           (DWORD_PTR) olp->lpCallerOverlapped,
                                          &Error) == SOCKET_ERROR)
        {
            dbgprint("IntermediateCompletionRoutine: WPUQueueApc() failed: %d", Error);
        }
    }
    else
    {
        // Otherwise we signal that the op has completed
        //
        if (WPUCompleteOverlappedRequest(olp->CallerSocket,
                                     olp->lpCallerOverlapped,
                                     dwError,
                                     cbTransferred,
                                    &Error) == SOCKET_ERROR)
        {
            dbgprint("WPUCompleteOverlappedRequest failed: %d", Error);
        }
        #ifdef DEBUG
        else
        {
            dbgprint("Completing request on socket: %d", olp->CallerSocket);
        }
        #endif
    }

    //
    // Cleanup the accounting on the socket
    //

    //(SocketContext->dwOutstandingAsync)--;

    CheckForContextCleanup(olp);

    PutbackOverlappedStructure(olp);

    return;
}

void PutbackOverlappedStructure ( WSAOVERLAPPEDPLUS * olp )

Definition at line 860 of file overlap.cpp.

{
    EnterCriticalSection(&gOverlappedCS);

    memset(olp, 0, sizeof(WSAOVERLAPPEDPLUS));

    //HeapFree(hLspHeap, 0, olp);

    olp->CallerThreadId.ThreadHandle = (HANDLE)0xbadbeef;

    olp->next = FreePool;
    FreePool = olp;

    LeaveCriticalSection(&gOverlappedCS);
}

int QueueOverlappedOperation | ( | WSAOVERLAPPEDPLUS * | lpOverlapped,
 |  | SOCK_INFO * | Context
 | ) |  |

Definition at line 273 of file overlap.cpp.

{
    BOOL    bSynchronous=FALSE;
    int     err;

    // Set the fields of the overlapped to indicate IO is not complete yet
    //
    SetOverlappedInProgress(ol->lpCallerOverlapped);
    if (ghIocp)
    {
        // If we haven't already added the provider socket to the IOCP then
        //  do it now.
        //
        AcquireSocketLock(SocketContext);
        if (!SocketContext->hIocp)
        {
            SocketContext->hIocp = CreateIoCompletionPort((HANDLE)ol->ProviderSocket,
                                                          ghIocp,
                                                          ol->CallerSocket,
                                                          0);
            if (SocketContext->hIocp == NULL)
            {
                if ((err = GetLastError()) == ERROR_INVALID_PARAMETER)
                {
                    // Hack-o-rama. If the socket option SO_SYNCHRONOUS_(NON)ALERT
                    // is set then no overlapped operation can be performed on that
                    // socket and tryiing to associate it with a completion port
                    // will fail. The other bad news is that an LSP cannot trap this
                    // setsockopt call. In reality we don't have to do anything. If
                    // an app sets this option and then makes overlapped calls anyway,
                    // then they shouldn't be expecting any overlapped notifications!
                    // This statement is put here in case you want to mark the socket
                    // info structure as synchronous.
                    //
                    bSynchronous = TRUE;
                }
                else
                {
                    dbgprint("QueueOverlappedOperation: CreateIoCompletionPort() "
                              "failed: %d (Prov %d Iocp %d Caller %d 0)",
                            err, ol->ProviderSocket,
                            ghIocp, ol->CallerSocket);
                }
            }

            #ifdef DEBUG
            dbgprint("Adding provider handle %X to IOCP", ol->ProviderSocket);
            #endif
        }
        ReleaseSocketLock(SocketContext);
        //
        // Simply execute the operation
        //
        return ExecuteOverlappedOperation(ol, bSynchronous);
    }
    else
    {
        // Queue up the operation for the worker thread to initiate
        //
        return EnqueueOverlappedOperation(ol);
    }
}

void ReleaseSocketLock ( SOCK_INFO * SockInfo )

Definition at line 134 of file sockinfo.cpp.

{
    LeaveCriticalSection(&SockInfo->SockCritSec);
}

void RemoveSocketInfo | ( | PROVIDER * | provider,
 |  | SOCK_INFO * | sock
 | ) |  |

Definition at line 240 of file sockinfo.cpp.

{
    EnterCriticalSection(&provider->ProviderCritSec);
    if (si->prev == NULL)
    {
        provider->SocketList = si->next;
        if (provider->SocketList)
            provider->SocketList->prev = NULL;
    }
    else
    {
        si->prev->next = si->next;
        if (si->next)
            si->next->prev = si->prev;
    }

    LeaveCriticalSection(&provider->ProviderCritSec);
}

int StopAsyncWindowManager ( )

Definition at line 64 of file asyncselect.cpp.

{
    if (AsyncWindow)
    {
        DestroyWindow(AsyncWindow);
        AsyncWindow = NULL;

        CloseHandle(WorkerThreadHandle);
    }
    return 0;
}

int StopOverlappedManager ( )

Definition at line 208 of file overlap.cpp.

{
    DWORD     i;
    int       ret;

    EnterCriticalSection(&gOverlappedCS);
    //
    // Post a completion packet to the IOCP (one for each thread)
    //
    if (ghIocp)
    {
        for(i=0; i < gdwThreadCount ;i++)
        {
            ret = PostQueuedCompletionStatus(ghIocp,
                                        -1,
                                         0,
                                         NULL);
            if (ret == 0)
            {
                dbgprint("PostQueuedCompletionStatus() failed: %d", GetLastError());
            }
        }
        // Wait a while for the threads to get the signal and exit - if it fails or
        // times out then oh well, we need to clean up anyway
        ret = WaitForMultipleObjectsEx(gdwThreadCount, gWorkerThread, TRUE, 4000, TRUE);
    }

    for(i=0; i < gdwThreadCount ;i++)
    {
        CloseHandle(gWorkerThread[i]);
        gWorkerThread[i] = NULL;

        dbgprint("Closing thread");
    }

    // Cleanup remaining handles...

    if (ghIocp != NULL)
    {
        CloseHandle(ghIocp);
        ghIocp = NULL;
        dbgprint("Closing iocp");
    }
    if (ghWakeupSemaphore != NULL)
    {
        CloseHandle(ghWakeupSemaphore);
        ghWakeupSemaphore = NULL;
    }

    LeaveCriticalSection(&gOverlappedCS);

    return 0;
}

void UnlockSocketContext | ( | SOCK_INFO * | context,
 |  | int * | err
 | ) |  |

Definition at line 76 of file sockinfo.cpp.

{
    LONG    newval;

    EnterCriticalSection(&gCriticalSection);

    // Decrement the ref count and see if someone closed this socket (from another thread)
    newval = InterlockedDecrement(&context->RefCount);
    if ((newval == 0) && (context->dwOutstandingAsync == 0) && (context->bClosing))
    {
        // Socket has been closed so close the handle and free associated resources
        if (MainUpCallTable.lpWPUCloseSocketHandle(context->LayeredSocket, lpErrno) == SOCKET_ERROR)
        {
            dbgprint("UnlockSocketContext: WPUCloseSocketHandle() failed: %d", *lpErrno);
        }

        context->LayeredSocket = INVALID_SOCKET;

        RemoveSocketInfo(context->Provider, context);

        #ifdef DEBUG
        dbgprint("Closing socket %d Bytes Sent [%lu] Bytes Recv [%lu]",
                context->LayeredSocket, context->BytesSent, context->BytesRecv);
        #endif

        ReleaseSocketLock(context);

        #ifdef DEBUG
        dbgprint("Freeing a SOCK_INFO (SocketContext) structure");
        #endif

        FreeSockInfo(context);
        context = NULL;
    }

    LeaveCriticalSection(&gCriticalSection);
}

Variable Documentation

WSPUPCALLTABLE MainUpCallTable

Definition at line 36 of file spi.cpp.

Generated on Wed Nov 13 2024 16:54:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/LSP/sockinfo.cpp File Reference

  • NetDS
  • WinSock
  • LSP
Functions | Variables

sockinfo.cpp File Reference

#include "provider.h"

Go to the source code of this file.

Functions

void | AcquireSocketLock (SOCK_INFO *SockInfo)
void | CloseAndFreeSocketInfo (PROVIDER *provider)
SOCK_INFO * | CreateSockInfo (PROVIDER *Provider, SOCKET ProviderSocket, SOCK_INFO *Inherit, BOOL Insert)
SOCK_INFO * | FindAndLockSocketContext (SOCKET s, int *lpErrno)
void | FreeSockInfo (SOCK_INFO *info)
SOCK_INFO * | GetCallerSocket (PROVIDER *provider, SOCKET ProviderSock)
void | InsertSocketInfo (PROVIDER *provider, SOCK_INFO *sock)
void | ReleaseSocketLock (SOCK_INFO *SockInfo)
void | RemoveSocketInfo (PROVIDER *provider, SOCK_INFO *si)
void | UnlockSocketContext (SOCK_INFO *context, int *lpErrno)

Variables

HANDLE gAddContextEvent
PROVIDER * gBaseInfo
CRITICAL_SECTION | gCriticalSection
INT | gLayerCount
HANDLE hLspHeap

Function Documentation

void AcquireSocketLock ( SOCK_INFO * SockInfo )

Definition at line 123 of file sockinfo.cpp.

{
    EnterCriticalSection(&SockInfo->SockCritSec);
}

void CloseAndFreeSocketInfo ( PROVIDER * provider )

Definition at line 267 of file sockinfo.cpp.

{
    SOCK_INFO    *si=NULL,
                 *siprev=NULL;
    struct linger linger;
    int           Error, ret;

    linger.l_onoff = 1;
    linger.l_linger = 0;

    // Walk the list of sockets
    si = provider->SocketList;
    while (si)
    {
        // Set the abortive linger
        ret = provider->NextProcTable.lpWSPSetSockOpt(
            si->ProviderSocket,
            SOL_SOCKET,
            SO_LINGER,
            (char *)&linger,
            sizeof(linger),
            &Error);
        if (ret != SOCKET_ERROR)
        {
            // Close the lower provider socket
            ret = provider->NextProcTable.lpWSPCloseSocket(
                si->ProviderSocket,
                &Error);
            if (ret == SOCKET_ERROR)
            {
                dbgprint("WSPCloseSocket() on handle %d failed: %d", si->ProviderSocket, Error);
            }
            #ifdef DEBUG
            else
            {
                dbgprint("Successfully closed socket %d", si->ProviderSocket);
            }
            #endif
        }
        #ifdef DEBUG
        else
        {
            dbgprint("WSPSetSockOpt(SO_LINGER) failed: %d", Error);
        }
        #endif

        // Close the layered handle
        MainUpCallTable.lpWPUCloseSocketHandle(
            si->LayeredSocket,
            &Error);

        siprev = si;
        si = si->next;

        // Free the context structure
        FreeSockInfo(siprev);
    }
    return;
}

SOCK_INFO* CreateSockInfo | ( | PROVIDER * | Provider,
 |  | SOCKET | ProviderSocket,
 |  | SOCK_INFO * | Inherit,
 |  | BOOL | Insert
 | ) |  |

Definition at line 155 of file sockinfo.cpp.

{
    SOCK_INFO   *NewInfo=NULL;

    NewInfo = (SOCK_INFO *)HeapAlloc(hLspHeap,
                                     HEAP_ZERO_MEMORY,
                                     sizeof(SOCK_INFO));
    if (NewInfo == NULL)
    {
        dbgprint("HeapAlloc() failed: %d", GetLastError());
        return NULL;
    }
    NewInfo->ProviderSocket     = ProviderSocket;
    NewInfo->bClosing           = FALSE;
    NewInfo->dwOutstandingAsync = 0;
    NewInfo->BytesRecv          = 0;
    NewInfo->BytesSent          = 0;
    NewInfo->Provider           = Provider;
    NewInfo->hWnd               = (Inherit ? Inherit->hWnd : 0);
    NewInfo->uMsg               = (Inherit ? Inherit->uMsg : 0);

    InitializeCriticalSection(&NewInfo->SockCritSec);

    if (Insert == TRUE)
    {
        InsertSocketInfo(Provider, NewInfo);
    }

    return NewInfo;
}

SOCK_INFO* FindAndLockSocketContext | ( | SOCKET | s,
 |  | int * | lpErrno
 | ) |  |

Definition at line 41 of file sockinfo.cpp.

{
    SOCK_INFO *SocketContext=NULL;
    int        ret;

    EnterCriticalSection(&gCriticalSection);

    ret = MainUpCallTable.lpWPUQuerySocketHandleContext(
            s,
            (PDWORD_PTR) &SocketContext,
            lpErrno
            );
    if (ret == SOCKET_ERROR)
    {
        dbgprint("FindAndLockSocketContext: WPUQuerySocketHandleContext failed: %d", *lpErrno);
    }
    else
    {
        InterlockedIncrement(&SocketContext->RefCount);
    }
    LeaveCriticalSection(&gCriticalSection);

    return SocketContext;
}

void FreeSockInfo ( SOCK_INFO * info )

Definition at line 192 of file sockinfo.cpp.

{
    DeleteCriticalSection(&info->SockCritSec);
    HeapFree(hLspHeap, 0, info);

    return;
}

SOCK_INFO* GetCallerSocket | ( | PROVIDER * | provider,
 |  | SOCKET | ProviderSock
 | ) |  |

Definition at line 338 of file sockinfo.cpp.

{
    SOCK_INFO *si;

    EnterCriticalSection(&gCriticalSection);

    if (provider)
    {
        // If we know the provider just search its list of sockets
        si = provider->SocketList;
        while(si)
        {
            if (si->ProviderSocket == ProviderSock)
            {
                LeaveCriticalSection(&gCriticalSection);
                return si;
            }
            si = si->next;
        }
    }
    else
    {
        // Don't know the provider so we must search all of them
        for(INT i=0; i < gLayerCount ;i++)
        {
            si = gBaseInfo[i].SocketList;
            while (si)
            {
                if (si->ProviderSocket == ProviderSock)
                {
                    LeaveCriticalSection(&gCriticalSection);
                    return si;
                }
                si = si->next;
            }
        }
    }

    LeaveCriticalSection(&gCriticalSection);
    return NULL;
}

void InsertSocketInfo | ( | PROVIDER * | provider,
 |  | SOCK_INFO * | sock
 | ) |  |

Definition at line 208 of file sockinfo.cpp.

{
    if (!provider || !sock)
    {
        dbgprint("InsertSocketInfo: PROVIDER or SOCK_INFO == NULL!");
        return;
    }

    EnterCriticalSection(&provider->ProviderCritSec);

    sock->next = sock->prev = NULL;

    sock->next = provider->SocketList;
    if (provider->SocketList)
    {
        provider->SocketList->prev = sock;
    }
    provider->SocketList = sock;

    LeaveCriticalSection(&provider->ProviderCritSec);

    SetEvent(gAddContextEvent);
}

void ReleaseSocketLock ( SOCK_INFO * SockInfo )

Definition at line 134 of file sockinfo.cpp.

{
    LeaveCriticalSection(&SockInfo->SockCritSec);
}

void RemoveSocketInfo | ( | PROVIDER * | provider,
 |  | SOCK_INFO * | si
 | ) |  |

Definition at line 240 of file sockinfo.cpp.

{
    EnterCriticalSection(&provider->ProviderCritSec);
    if (si->prev == NULL)
    {
        provider->SocketList = si->next;
        if (provider->SocketList)
            provider->SocketList->prev = NULL;
    }
    else
    {
        si->prev->next = si->next;
        if (si->next)
            si->next->prev = si->prev;
    }

    LeaveCriticalSection(&provider->ProviderCritSec);
}

void UnlockSocketContext | ( | SOCK_INFO * | context,
 |  | int * | lpErrno
 | ) |  |

Definition at line 76 of file sockinfo.cpp.

{
    LONG    newval;

    EnterCriticalSection(&gCriticalSection);

    // Decrement the ref count and see if someone closed this socket (from another thread)
    newval = InterlockedDecrement(&context->RefCount);
    if ((newval == 0) && (context->dwOutstandingAsync == 0) && (context->bClosing))
    {
        // Socket has been closed so close the handle and free associated resources
        if (MainUpCallTable.lpWPUCloseSocketHandle(context->LayeredSocket, lpErrno) == SOCKET_ERROR)
        {
            dbgprint("UnlockSocketContext: WPUCloseSocketHandle() failed: %d", *lpErrno);
        }

        context->LayeredSocket = INVALID_SOCKET;

        RemoveSocketInfo(context->Provider, context);

        #ifdef DEBUG
        dbgprint("Closing socket %d Bytes Sent [%lu] Bytes Recv [%lu]",
                context->LayeredSocket, context->BytesSent, context->BytesRecv);
        #endif

        ReleaseSocketLock(context);

        #ifdef DEBUG
        dbgprint("Freeing a SOCK_INFO (SocketContext) structure");
        #endif

        FreeSockInfo(context);
        context = NULL;
    }

    LeaveCriticalSection(&gCriticalSection);
}

Variable Documentation

HANDLE gAddContextEvent

Definition at line 43 of file spi.cpp.

PROVIDER* gBaseInfo

Definition at line 39 of file spi.cpp.

CRITICAL_SECTION gCriticalSection

Definition at line 33 of file spi.cpp.

INT gLayerCount

Definition at line 40 of file spi.cpp.

HANDLE hLspHeap

Definition at line 42 of file spi.cpp.

Generated on Wed Nov 13 2024 16:54:15 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/LSP/spi.cpp File Reference

  • NetDS
  • WinSock
  • LSP
Defines | Functions | Variables

spi.cpp File Reference

#include "provider.h"
#include "install.h"
#include <stdio.h>
#include <stdlib.h>

Go to the source code of this file.

Defines

#define | SetBlockingProvider(Provider)

Functions

WSABUF * | CopyBuffer (WSABUF *BufferArray, DWORD BufferCount)
void | CopyOffset (WSAOVERLAPPED *ProviderOverlapped, WSAOVERLAPPED *UserOverlapped)
void | dbgprint (char *format,...)
BOOL WINAPI | DllMain (IN HINSTANCE hinstDll, IN DWORD dwReason, LPVOID lpvReserved)
void | FreeBuffer (WSABUF *BufferArray)
void | FreeSocketsAndMemory (int *lpErrno)
void | PrintProcTable (LPWSPPROC_TABLE lpProcTable)
int | VerifyProcTable (LPWSPPROC_TABLE lpProcTable)
SOCKET WSPAPI | WSPAccept (SOCKET s, struct sockaddr FAR *addr, LPINT addrlen, LPCONDITIONPROC lpfnCondition, DWORD_PTR dwCallbackData, LPINT lpErrno)
int WSPAPI | WSPAddressToString (LPSOCKADDR lpsaAddress, DWORD dwAddressLength, LPWSAPROTOCOL_INFOW lpProtocolInfo, LPWSTR lpszAddressString, LPDWORD lpdwAddressStringLength, LPINT lpErrno)
int WSPAPI | WSPAsyncSelect (SOCKET s, HWND hWnd, unsigned int wMsg, long lEvent, LPINT lpErrno)
int WSPAPI | WSPBind (SOCKET s, const struct sockaddr FAR *name, int namelen, LPINT lpErrno)
int WSPAPI | WSPCancelBlockingCall (LPINT lpErrno)
int WSPAPI | WSPCleanup (LPINT lpErrno)
int WSPAPI | WSPCloseSocket (SOCKET s, LPINT lpErrno)
int WSPAPI | WSPConnect (SOCKET s, const struct sockaddr FAR *name, int namelen, LPWSABUF lpCallerData, LPWSABUF lpCalleeData, LPQOS lpSQOS, LPQOS lpGQOS, LPINT lpErrno)
int WSPAPI | WSPDuplicateSocket (SOCKET s, DWORD dwProcessId, LPWSAPROTOCOL_INFOW lpProtocolInfo, LPINT lpErrno)
int WSPAPI | WSPEnumNetworkEvents (SOCKET s, WSAEVENT hEventObject, LPWSANETWORKEVENTS lpNetworkEvents, LPINT lpErrno)
int WSPAPI | WSPEventSelect (SOCKET s, WSAEVENT hEventObject, long lNetworkEvents, LPINT lpErrno)
BOOL WSPAPI | WSPGetOverlappedResult (SOCKET s, LPWSAOVERLAPPED lpOverlapped, LPDWORD lpcbTransfer, BOOL fWait, LPDWORD lpdwFlags, LPINT lpErrno)
int WSPAPI | WSPGetPeerName (SOCKET s, struct sockaddr FAR *name, LPINT namelen, LPINT lpErrno)
BOOL WSPAPI | WSPGetQOSByName (SOCKET s, LPWSABUF lpQOSName, LPQOS lpQOS, LPINT lpErrno)
int WSPAPI | WSPGetSockName (SOCKET s, struct sockaddr FAR *name, LPINT namelen, LPINT lpErrno)
int WSPAPI | WSPGetSockOpt (SOCKET s, int level, int optname, char FAR *optval, LPINT optlen, LPINT lpErrno)
int WSPAPI | WSPIoctl (SOCKET s, DWORD dwIoControlCode, LPVOID lpvInBuffer, DWORD cbInBuffer, LPVOID lpvOutBuffer, DWORD cbOutBuffer, LPDWORD lpcbBytesReturned, LPWSAOVERLAPPED lpOverlapped, LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine, LPWSATHREADID lpThreadId, LPINT lpErrno)
SOCKET WSPAPI | WSPJoinLeaf (SOCKET s, const struct sockaddr FAR *name, int namelen, LPWSABUF lpCallerData, LPWSABUF lpCalleeData, LPQOS lpSQOS, LPQOS lpGQOS, DWORD dwFlags, LPINT lpErrno)
int WSPAPI | WSPListen (SOCKET s, int backlog, LPINT lpErrno)
int WSPAPI | WSPRecv (SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount, LPDWORD lpNumberOfBytesRecvd, LPDWORD lpFlags, LPWSAOVERLAPPED lpOverlapped, LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine, LPWSATHREADID lpThreadId, LPINT lpErrno)
int WSPAPI | WSPRecvDisconnect (SOCKET s, LPWSABUF lpInboundDisconnectData, LPINT lpErrno)
int WSPAPI | WSPRecvFrom (SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount, LPDWORD lpNumberOfBytesRecvd, LPDWORD lpFlags, struct sockaddr FAR *lpFrom, LPINT lpFromLen, LPWSAOVERLAPPED lpOverlapped, LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine, LPWSATHREADID lpThreadId, LPINT lpErrno)
int WSPAPI | WSPSelect (int nfds, fd_set FAR *readfds, fd_set FAR *writefds, fd_set FAR *exceptfds, const struct timeval FAR *timeout, LPINT lpErrno)
int WSPAPI | WSPSend (SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount, LPDWORD lpNumberOfBytesSent, DWORD dwFlags, LPWSAOVERLAPPED lpOverlapped, LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine, LPWSATHREADID lpThreadId, LPINT lpErrno)
int WSPAPI | WSPSendDisconnect (SOCKET s, LPWSABUF lpOutboundDisconnectData, LPINT lpErrno)
int WSPAPI | WSPSendTo (SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount, LPDWORD lpNumberOfBytesSent, DWORD dwFlags, const struct sockaddr FAR *lpTo, int iToLen, LPWSAOVERLAPPED lpOverlapped, LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine, LPWSATHREADID lpThreadId, LPINT lpErrno)
int WSPAPI | WSPSetSockOpt (SOCKET s, int level, int optname, const char FAR *optval, int optlen, LPINT lpErrno)
int WSPAPI | WSPShutdown (SOCKET s, int how, LPINT lpErrno)
SOCKET WSPAPI | WSPSocket (int af, int type, int protocol, LPWSAPROTOCOL_INFOW lpProtocolInfo, GROUP g, DWORD dwFlags, LPINT lpErrno)
int WSPAPI | WSPStartup (WORD wVersion, LPWSPDATA lpWSPData, LPWSAPROTOCOL_INFOW lpProtocolInfo, WSPUPCALLTABLE UpCallTable, LPWSPPROC_TABLE lpProcTable)
int WSPAPI | WSPStringToAddress (LPWSTR AddressString, INT AddressFamily, LPWSAPROTOCOL_INFOW lpProtocolInfo, LPSOCKADDR lpAddress, LPINT lpAddressLength, LPINT lpErrno)

Variables

HANDLE | gAddContextEvent = NULL
LPPROVIDER | gBaseInfo = NULL
CRITICAL_SECTION | gCriticalSection
CRITICAL_SECTION | gDebugCritSec
HANDLE ghIocp
INT | gLayerCount = 0
CRITICAL_SECTION | gOverlappedCS
HINSTANCE | hDllInstance = NULL
HANDLE | hLspHeap = NULL
WSPUPCALLTABLE | MainUpCallTable

Define Documentation

#define SetBlockingProvider ( Provider )
Value:
(TlsIndex!=0xFFFFFFFF)                  \
        ? TlsSetValue (TlsIndex, Provider)  \
        : NULL

Definition at line 54 of file spi.cpp.

Function Documentation

WSABUF* CopyBuffer | ( | WSABUF * | BufferArray,
 |  | DWORD | BufferCount
 | ) |  |

Definition at line 3375 of file spi.cpp.

{
    WSABUF      *buffercopy=NULL;
    DWORD        i;

    if (ghIocp == NULL)
    {
        // We're on Win9x -- we need to save off the WSABUF structures
        // because on Win9x, the overlapped operation does not execute
        // immediately and the Winsock spec says apps are free to use
        // stack based WSABUF arrays.

        buffercopy = (WSABUF *)HeapAlloc(hLspHeap, HEAP_ZERO_MEMORY, sizeof(WSABUF) * BufferCount);
        if (buffercopy == NULL)
        {
            wsprintf(Msg, TEXT("CopyBuffer: HeapAlloc failed: %d\r\n"), GetLastError());
            return NULL;
        }
        for(i=0; i < BufferCount ;i++)
        {
            buffercopy[i].buf = BufferArray[i].buf;
            buffercopy[i].len = BufferArray[i].len;
        }
        return buffercopy;
    }
    else
    {
        // With completion ports, we post the overlapped operation
        // immediately to the lower provider which should capture
        // the WSABUF array members itself. If your LSP needs to
        // look at the buffers after the operation is initiated,
        // you'd better always copy the WSABUF array.

        return BufferArray;
    }
}

void CopyOffset | ( | WSAOVERLAPPED * | ProviderOverlapped,
 |  | WSAOVERLAPPED * | UserOverlapped
 | ) |  |

Definition at line 3356 of file spi.cpp.

{
    ProviderOverlapped->Offset     = UserOverlapped->Offset;
    ProviderOverlapped->OffsetHigh = UserOverlapped->OffsetHigh;
}

void dbgprint | ( | char * | format,
 |  |  | ...
 | ) |  |

Definition at line 78 of file spi.cpp.

{
    static  DWORD pid=0;
    va_list vl;
    char    dbgbuf1[2048],
            dbgbuf2[2048];

    // Prepend the process ID to the message
    if (pid == 0)
    {
        pid = GetCurrentProcessId();
    }

    EnterCriticalSection(&gDebugCritSec);
    va_start(vl, format);
    wvsprintf(dbgbuf1, format, vl);
    wsprintf(dbgbuf2, "%lu: %s\r\n", pid, dbgbuf1);
    va_end(vl);

    OutputDebugString(dbgbuf2);
    LeaveCriticalSection(&gDebugCritSec);
}

BOOL WINAPI DllMain | ( | IN HINSTANCE | hinstDll,
 |  | IN DWORD | dwReason,
 |  | LPVOID | lpvReserved
 | ) |  |

Definition at line 196 of file spi.cpp.

{
    switch (dwReason)
    {

        case DLL_PROCESS_ATTACH:
            hDllInstance = hinstDll;
            //
            // Initialize some critical section objects
            //
            InitializeCriticalSection(&gCriticalSection);
            InitializeCriticalSection(&gOverlappedCS);
            InitializeCriticalSection(&gDebugCritSec);

            TlsIndex = TlsAlloc();
            break;

        case DLL_THREAD_ATTACH:
            break;

        case DLL_THREAD_DETACH:
            break;

        case DLL_PROCESS_DETACH:
            bDetached = TRUE;

            EnterCriticalSection(&gCriticalSection);
            if (gBaseInfo)
            {
                int Error;

                FreeSocketsAndMemory(&Error);
            }
            LeaveCriticalSection(&gCriticalSection);

            DeleteCriticalSection(&gCriticalSection);
            DeleteCriticalSection(&gOverlappedCS);
            DeleteCriticalSection(&gDebugCritSec);

            if (lpvReserved == NULL)
            {
                if (TlsIndex != 0xFFFFFFFF)
                {
                    TlsFree(TlsIndex);
                    TlsIndex = 0xFFFFFFFF;
                }
            }
            break;
    }

    return TRUE;
}

void FreeBuffer ( WSABUF * BufferArray )

Definition at line 3422 of file spi.cpp.

{
    if (ghIocp == NULL)
    {
        // If we're on Win9x, the WSABUF array was copied so free it up now

        HeapFree(hLspHeap, 0, BufferArray);
    }
}

void FreeSocketsAndMemory ( int * lpErrno )

Definition at line 3439 of file spi.cpp.

{
    int     ret,
            i;

    for(i=0; i < gLayerCount ;i++)
    {
        if (gBaseInfo[i].hProvider != NULL)
        {
            CloseAndFreeSocketInfo(&gBaseInfo[i]);
            gBaseInfo[i].SocketList = NULL;

            //
            // Call the WSPCleanup of the provider's were layered over.
            //
            ret = gBaseInfo[i].NextProcTable.lpWSPCleanup(lpErrno);

            DeleteCriticalSection(&gBaseInfo[i].ProviderCritSec);

            FreeLibrary(gBaseInfo[i].hProvider);
            gBaseInfo[i].hProvider = NULL;
        }
    }
    if (gBaseInfo != NULL)
    {
        HeapFree(hLspHeap, 0, gBaseInfo);
        gBaseInfo = NULL;
    }

    if (gAddContextEvent != NULL)
    {
        CloseHandle(gAddContextEvent);
        gAddContextEvent = NULL;
    }

    if (hLspHeap != NULL)
    {
        HeapDestroy(hLspHeap);
        hLspHeap = NULL;
    }
}

void PrintProcTable ( LPWSPPROC_TABLE lpProcTable )

Definition at line 108 of file spi.cpp.

{
    #ifdef DBG_PRINTPROCTABLE
    dbgprint("WSPAccept              = 0x%X", lpProcTable->lpWSPAccept);
    dbgprint("WSPAddressToString     = 0x%X", lpProcTable->lpWSPAddressToString);
    dbgprint("WSPAsyncSelect         = 0x%X", lpProcTable->lpWSPAsyncSelect);
    dbgprint("WSPBind                = 0x%X", lpProcTable->lpWSPBind);
    dbgprint("WSPCancelBlockingCall  = 0x%X", lpProcTable->lpWSPCancelBlockingCall);
    dbgprint("WSPCleanup             = 0x%X", lpProcTable->lpWSPCleanup);
    dbgprint("WSPCloseSocket         = 0x%X", lpProcTable->lpWSPCloseSocket);
    dbgprint("WSPConnect             = 0x%X", lpProcTable->lpWSPConnect);
    dbgprint("WSPDuplicateSocket     = 0x%X", lpProcTable->lpWSPDuplicateSocket);
    dbgprint("WSPEnumNetworkEvents   = 0x%X", lpProcTable->lpWSPEnumNetworkEvents);
    dbgprint("WSPEventSelect         = 0x%X", lpProcTable->lpWSPEventSelect);
    dbgprint("WSPGetOverlappedResult = 0x%X", lpProcTable->lpWSPGetOverlappedResult);
    dbgprint("WSPGetPeerName         = 0x%X", lpProcTable->lpWSPGetPeerName);
    dbgprint("WSPGetSockOpt          = 0x%X", lpProcTable->lpWSPGetSockOpt);
    dbgprint("WSPGetSockName         = 0x%X", lpProcTable->lpWSPGetSockName);
    dbgprint("WSPGetQOSByName        = 0x%X", lpProcTable->lpWSPGetQOSByName);
    dbgprint("WSPIoctl               = 0x%X", lpProcTable->lpWSPIoctl);
    dbgprint("WSPJoinLeaf            = 0x%X", lpProcTable->lpWSPJoinLeaf);
    dbgprint("WSPListen              = 0x%X", lpProcTable->lpWSPListen);
    dbgprint("WSPRecv                = 0x%X", lpProcTable->lpWSPRecv);
    dbgprint("WSPRecvDisconnect      = 0x%X", lpProcTable->lpWSPRecvDisconnect);
    dbgprint("WSPRecvFrom            = 0x%X", lpProcTable->lpWSPRecvFrom);
    dbgprint("WSPSelect              = 0x%X", lpProcTable->lpWSPSelect);
    dbgprint("WSPSend                = 0x%X", lpProcTable->lpWSPSend);
    dbgprint("WSPSendDisconnect      = 0x%X", lpProcTable->lpWSPSendDisconnect);
    dbgprint("WSPSendTo              = 0x%X", lpProcTable->lpWSPSendTo);
    dbgprint("WSPSetSockOpt          = 0x%X", lpProcTable->lpWSPSetSockOpt);
    dbgprint("WSPShutdown            = 0x%X", lpProcTable->lpWSPShutdown);
    dbgprint("WSPSocket              = 0x%X", lpProcTable->lpWSPSocket);
    dbgprint("WSPStringToAddress     = 0x%X", lpProcTable->lpWSPStringToAddress);
    #endif
}

int VerifyProcTable ( LPWSPPROC_TABLE lpProcTable )

Definition at line 151 of file spi.cpp.

{
   if ( lpProcTable->lpWSPAccept &&
        lpProcTable->lpWSPAddressToString &&
        lpProcTable->lpWSPAsyncSelect &&
        lpProcTable->lpWSPBind &&
        lpProcTable->lpWSPCancelBlockingCall &&
        lpProcTable->lpWSPCleanup &&
        lpProcTable->lpWSPCloseSocket &&
        lpProcTable->lpWSPConnect &&
        lpProcTable->lpWSPDuplicateSocket &&
        lpProcTable->lpWSPEnumNetworkEvents &&
        lpProcTable->lpWSPEventSelect &&
        lpProcTable->lpWSPGetOverlappedResult &&
        lpProcTable->lpWSPGetPeerName &&
        lpProcTable->lpWSPGetSockOpt &&
        lpProcTable->lpWSPGetSockName &&
        lpProcTable->lpWSPGetQOSByName &&
        lpProcTable->lpWSPIoctl &&
        lpProcTable->lpWSPJoinLeaf &&
        lpProcTable->lpWSPListen &&
        lpProcTable->lpWSPRecv &&
        lpProcTable->lpWSPRecvDisconnect &&
        lpProcTable->lpWSPRecvFrom &&
        lpProcTable->lpWSPSelect &&
        lpProcTable->lpWSPSend &&
        lpProcTable->lpWSPSendDisconnect &&
        lpProcTable->lpWSPSendTo &&
        lpProcTable->lpWSPSetSockOpt &&
        lpProcTable->lpWSPShutdown &&
        lpProcTable->lpWSPSocket &&
        lpProcTable->lpWSPStringToAddress)
    {
        return NO_ERROR;
    }
    return SOCKET_ERROR;
}

SOCKET WSPAPI WSPAccept | ( | SOCKET | s,
 |  | struct sockaddr FAR * | addr,
 |  | LPINT | addrlen,
 |  | LPCONDITIONPROC | lpfnCondition,
 |  | DWORD_PTR | dwCallbackData,
 |  | LPINT | lpErrno
 | ) |  |

Definition at line 258 of file spi.cpp.

{
    SOCKET     NewProviderSocket;
    SOCKET     NewSocket = INVALID_SOCKET;
    SOCK_INFO *NewSocketContext;
    SOCK_INFO *SocketContext;

    // Query for our per socket info
    //
    SocketContext = FindAndLockSocketContext(s, lpErrno);
    if (SocketContext == NULL)
    {
        *lpErrno = WSAENOTSOCK;
        return INVALID_SOCKET;
    }

    //
    // Note: You can subsitute your own conditional accept callback function
    //       in order to intercept this callback. You would have to keep track
    //       of the user's callback function so that you can call that when
    //       your intermediate function executes.
    //
    SetBlockingProvider(SocketContext->Provider);
    NewProviderSocket = SocketContext->Provider->NextProcTable.lpWSPAccept(
                            SocketContext->ProviderSocket,
                            addr,
                            addrlen,
                            lpfnCondition,
                            dwCallbackData,
                            lpErrno);
    SetBlockingProvider(NULL);
    if (NewProviderSocket != INVALID_SOCKET)
    {
        // The underlying provider received a new connection so lets create our own
        //  socket to pass back up to the application.
        //
        NewSocketContext = CreateSockInfo(
                SocketContext->Provider,
                NewProviderSocket,
                SocketContext,
                FALSE);
        if  (NewSocketContext == NULL)
        {
            *lpErrno = WSAENOBUFS;
        }
        else
        {
            NewSocket = NewSocketContext->LayeredSocket = MainUpCallTable.lpWPUCreateSocketHandle(
                    SocketContext->Provider->LayeredProvider.ProtocolChain.ChainEntries[0],
                    (DWORD_PTR) NewSocketContext,
                    lpErrno);
            if (NewSocket == INVALID_SOCKET)
            {
                dbgprint("WSPAccept(): WPUCreateSocketHandle() failed: %d", *lpErrno);

                // Close the lower provider's socket
                SocketContext->Provider->NextProcTable.lpWSPCloseSocket(
                    NewProviderSocket,
                    lpErrno
                    );

                // Context is not in the list yet so we can just free it
                FreeSockInfo(NewSocketContext);
            }
            else
            {
                InsertSocketInfo(SocketContext->Provider, NewSocketContext);
            }
        }
    }
    UnlockSocketContext(SocketContext, lpErrno);

    return NewSocket;
}

int WSPAPI WSPAddressToString | ( | LPSOCKADDR | lpsaAddress,
 |  | DWORD | dwAddressLength,
 |  | LPWSAPROTOCOL_INFOW | lpProtocolInfo,
 |  | LPWSTR | lpszAddressString,
 |  | LPDWORD | lpdwAddressStringLength,
 |  | LPINT | lpErrno
 | ) |  |

Definition at line 345 of file spi.cpp.

{
    WSAPROTOCOL_INFOW *pInfo=NULL;
    PROVIDER          *Provider=NULL;
    INT                i, ret;

    // First find the appropriate provider
    //
    for(i=0; i < gLayerCount ;i++)
    {
        if ((gBaseInfo[i].NextProvider.iAddressFamily == lpProtocolInfo->iAddressFamily) &&
            (gBaseInfo[i].NextProvider.iSocketType == lpProtocolInfo->iSocketType) &&
            (gBaseInfo[i].NextProvider.iProtocol   == lpProtocolInfo->iProtocol))
        {
            if (lpProtocolInfo)
            {
                // In case of multiple providers check the provider flags
                if ( (gBaseInfo[i].NextProvider.dwServiceFlags1 & ~XP1_IFS_HANDLES) !=
                     (lpProtocolInfo->dwServiceFlags1 & ~XP1_IFS_HANDLES) )
                {
                    continue;
                }
            }
            Provider = &gBaseInfo[i];
            pInfo = &gBaseInfo[i].NextProvider;
            break;
        }
    }
    if (Provider == NULL)
    {
        *lpErrno = WSAEINVAL;
        return SOCKET_ERROR;
    }
    // Of course if the next layer isn't a base just pass down lpProtocolInfo.
    //
    if (pInfo->ProtocolChain.ChainLen != BASE_PROTOCOL)
    {
        pInfo = lpProtocolInfo;
    }

    SetBlockingProvider(Provider);
    ret = Provider->NextProcTable.lpWSPAddressToString(lpsaAddress,
                                                       dwAddressLength,
                                                       pInfo,
                                                       lpszAddressString,
                                                       lpdwAddressStringLength,
                                                       lpErrno);
    SetBlockingProvider(NULL);

    return ret;
}

int WSPAPI WSPAsyncSelect | ( | SOCKET | s,
 |  | HWND | hWnd,
 |  | unsigned int | wMsg,
 |  | long | lEvent,
 |  | LPINT | lpErrno
 | ) |  |

Definition at line 410 of file spi.cpp.

{
    SOCK_INFO *SocketContext;
    HWND       hWorkerWindow;
    INT        ret;

    // Make sure the window handle is valid
    //
    ret = SOCKET_ERROR;
    if (IsWindow(hWnd))
    {
        // Verify only valid events have been set
        //
        if ( (lEvent & ~FD_ALL_EVENTS) == 0)
        {
            // Find our provider socket corresonding to this one
            //
            SocketContext = FindAndLockSocketContext(s, lpErrno);
            if (SocketContext != NULL)
            {
                SocketContext->hWnd = hWnd;
                SocketContext->uMsg = wMsg;

                // Get the handle to our hidden window
                //
                if ((hWorkerWindow = GetWorkerWindow()) != NULL)
                {
                    SetBlockingProvider(SocketContext->Provider);
                    ret = SocketContext->Provider->NextProcTable.lpWSPAsyncSelect(
                               SocketContext->ProviderSocket,
                               hWorkerWindow,
                               WM_SOCKET,
                               lEvent,
                               lpErrno);
                    SetBlockingProvider(NULL);
                }
                else
                {
                    *lpErrno = WSAEINVAL;
                }
                UnlockSocketContext(SocketContext, lpErrno);
            }
            else
            {
                dbgprint("WSPAsyncSelect: WPUQuerySocketHandleContext() failed: %d", *lpErrno);
                *lpErrno = WSAENOTSOCK;
            }
        }
        else
        {
            *lpErrno = WSAEINVAL;
        }
    }
    else
    {
        *lpErrno = WSAEINVAL;
    }

    return ret;
}

int WSPAPI WSPBind | ( | SOCKET | s,
 |  | const struct sockaddr FAR * | name,
 |  | int | namelen,
 |  | LPINT | lpErrno
 | ) |  |

Definition at line 483 of file spi.cpp.

{
    SOCK_INFO *SocketContext;
    INT        ret;

    SocketContext = FindAndLockSocketContext(s, lpErrno);
    if (SocketContext == NULL)
    {
        dbgprint("WSPBind: WPUQuerySocketHandleContext() failed: %d", *lpErrno);
        *lpErrno = WSAENOTSOCK;
        return SOCKET_ERROR;
    }

    SetBlockingProvider(SocketContext->Provider);
    ret = SocketContext->Provider->NextProcTable.lpWSPBind(
        SocketContext->ProviderSocket,
        name,
        namelen,
        lpErrno);
    SetBlockingProvider(NULL);

    UnlockSocketContext(SocketContext, lpErrno);

    return ret;
}

int WSPAPI WSPCancelBlockingCall ( LPINT lpErrno )

Definition at line 523 of file spi.cpp.

{
    PROVIDER *Provider=NULL;
    INT       ret = NO_ERROR;

    Provider = (PROVIDER *)TlsGetValue(TlsIndex);
    if (Provider != NULL)
    {
        ret = Provider->NextProcTable.lpWSPCancelBlockingCall(lpErrno);
    }
    return ret;
}

int WSPAPI WSPCleanup ( LPINT lpErrno )

Definition at line 544 of file spi.cpp.

{
    int        ret=NO_ERROR;

    if (bDetached)
        return NO_ERROR;

    EnterCriticalSection(&gCriticalSection);

    if (!gEntryCount)
    {
        *lpErrno = WSANOTINITIALISED;

        dbgprint("WSPCleanup returning WSAENOTINITIALISED");

        LeaveCriticalSection(&gCriticalSection);
        return SOCKET_ERROR;
    }
    // Decrement the entry count
    //
    gEntryCount--;

    #ifdef DEBUG
    dbgprint("WSPCleanup: %d", gEntryCount);
    #endif

    if (gEntryCount == 0)
    {
        dbgprint("WSPCleanup: gEntryCount == 0; cleaning up");

        StopAsyncWindowManager();
        StopOverlappedManager();

        Sleep(200);

        FreeSocketsAndMemory(lpErrno);
    /*
        DecrementLspUsage(hDllInstance, 1);
    */
    }
    LeaveCriticalSection(&gCriticalSection);

    return ret;
}

int WSPAPI WSPCloseSocket | ( | SOCKET | s,
 |  | LPINT | lpErrno
 | ) |  |

Definition at line 601 of file spi.cpp.

{
    SOCK_INFO *SocketContext;

    SocketContext = FindAndLockSocketContext(s, lpErrno);
    if (SocketContext == NULL)
    {
        dbgprint("WSPCloseSocket: WPUQuerySocketHandle() failed: %d", *lpErrno);

        *lpErrno = WSAENOTSOCK;
        return SOCKET_ERROR;
    }
    AcquireSocketLock(SocketContext);

    #ifdef DEBUG
    dbgprint("WSPCloseSocket: Closing layered socket 0x%p (provider 0x%p)",
        s, SocketContext->ProviderSocket);
    #endif

    //
    // If we there are outstanding async calls on this handle don't close the app
    //  socket handle...only close the provider's handle.  Therefore any errors
    //  incurred can be propogated back to the app socket.
    //
    #ifdef DEBUG
    dbgprint("dwOutstanding = %d; RefCount = %d", SocketContext->dwOutstandingAsync,
        SocketContext->RefCount);
    #endif

    if ((SocketContext->dwOutstandingAsync != 0) || (SocketContext->RefCount != 1))
    {
        SocketContext->bClosing = TRUE;

        if (SocketContext->Provider->NextProcTable.lpWSPCloseSocket(
                SocketContext->ProviderSocket,
                lpErrno) == SOCKET_ERROR)
        {
            *lpErrno = WSAENOTSOCK;
            ReleaseSocketLock(SocketContext);
            UnlockSocketContext(SocketContext, lpErrno);
            dbgprint("WSPCloseSocket: Invalid socket handle");
            return SOCKET_ERROR;
        }
        #ifdef DEBUG
        else
        {
            dbgprint("Closed lower provider socket: 0x%p", SocketContext->ProviderSocket);
        }
        #endif

        SocketContext->ProviderSocket = INVALID_SOCKET;

        ReleaseSocketLock(SocketContext);

        UnlockSocketContext(SocketContext, lpErrno);
        return NO_ERROR;
    }
    //
    // Close the provider socket
    //
    SetBlockingProvider(SocketContext->Provider);
    if (SocketContext->Provider->NextProcTable.lpWSPCloseSocket(
            SocketContext->ProviderSocket,
            lpErrno) == SOCKET_ERROR)
    {
        SetBlockingProvider(NULL);

        ReleaseSocketLock(SocketContext);
        UnlockSocketContext(SocketContext, lpErrno);

        dbgprint("WSPCloseSocket: Provider close failed");
        return SOCKET_ERROR;
    }
    SetBlockingProvider(NULL);

    SocketContext->ProviderSocket = INVALID_SOCKET;

    //
    // Remove the socket info
    //
    RemoveSocketInfo(SocketContext->Provider, SocketContext);

    //
    // Close the app socket
    //
    if (MainUpCallTable.lpWPUCloseSocketHandle(s, lpErrno) == SOCKET_ERROR)
    {
        dbgprint("WPUCloseSocketHandle failed: %d", *lpErrno);

        ReleaseSocketLock(SocketContext);
        UnlockSocketContext(SocketContext, lpErrno);
        return SOCKET_ERROR;
    }

    #ifdef DEBUG
    dbgprint("Closing socket %d Bytes Sent [%lu] Bytes Recv [%lu]",
        s, SocketContext->BytesSent, SocketContext->BytesRecv);
    #endif

    ReleaseSocketLock(SocketContext);

    // Don't need to 'UnlockSocketContext' as we're deleting the object now

    FreeSockInfo(SocketContext);

    return NO_ERROR;
}

int WSPAPI WSPConnect | ( | SOCKET | s,
 |  | const struct sockaddr FAR * | name,
 |  | int | namelen,
 |  | LPWSABUF | lpCallerData,
 |  | LPWSABUF | lpCalleeData,
 |  | LPQOS | lpSQOS,
 |  | LPQOS | lpGQOS,
 |  | LPINT | lpErrno
 | ) |  |

Definition at line 719 of file spi.cpp.

{
    SOCK_INFO *SocketContext;
    INT        ret;

    SocketContext = FindAndLockSocketContext(s, lpErrno);
    if (SocketContext == NULL)
    {
        dbgprint("WSPConnect: WPUQuerySocketHandleContext() failed: %d", *lpErrno);
        *lpErrno = WSAENOTSOCK;
        return SOCKET_ERROR;
    }

    SetBlockingProvider(SocketContext->Provider);
    ret = SocketContext->Provider->NextProcTable.lpWSPConnect(
                SocketContext->ProviderSocket,
                name,
                namelen,
                lpCallerData,
                lpCalleeData,
                lpSQOS,
                lpGQOS,
                lpErrno);
    SetBlockingProvider(NULL);

    UnlockSocketContext(SocketContext, lpErrno);

    return ret;
}

int WSPAPI WSPDuplicateSocket | ( | SOCKET | s,
 |  | DWORD | dwProcessId,
 |  | LPWSAPROTOCOL_INFOW | lpProtocolInfo,
 |  | LPINT | lpErrno
 | ) |  |

Definition at line 768 of file spi.cpp.

{
    PROVIDER          *Provider=NULL;
    SOCK_INFO         *SocketContext=NULL;
    DWORD              dwReserved;
    int                ret;

    SocketContext = FindAndLockSocketContext(s, lpErrno);
    if (SocketContext == NULL)
    {
        dbgprint("WSPDuplicateSocket: WPUQuerySocketHandle() failed: %d", *lpErrno);
        *lpErrno = WSAENOTSOCK;
        return SOCKET_ERROR;
    }
    //
    // Find the underlying provider
    //
    Provider = SocketContext->Provider;

    SetBlockingProvider(Provider);
    ret = Provider->NextProcTable.lpWSPDuplicateSocket(
                SocketContext->ProviderSocket,
                dwProcessId,
                lpProtocolInfo,
                lpErrno);
    SetBlockingProvider(NULL);

    UnlockSocketContext(SocketContext, lpErrno);

    if (ret == NO_ERROR)
    {
        // We want to return the WSAPROTOCOL_INFOW structure of the underlying
        // provider but we need to preserve the reserved info returned by the
        // WSPDuplicateSocket call.
        //
        dwReserved = lpProtocolInfo->dwProviderReserved;
        memcpy(lpProtocolInfo, &Provider->LayeredProvider, sizeof(WSAPROTOCOL_INFOW));
        lpProtocolInfo->dwProviderReserved = dwReserved;
    }
    return ret;
}

int WSPAPI WSPEnumNetworkEvents | ( | SOCKET | s,
 |  | WSAEVENT | hEventObject,
 |  | LPWSANETWORKEVENTS | lpNetworkEvents,
 |  | LPINT | lpErrno
 | ) |  |

Definition at line 821 of file spi.cpp.

{
    SOCK_INFO *SocketContext;
    INT        ret;

    SocketContext = FindAndLockSocketContext(s, lpErrno);
    if (SocketContext == NULL)
    {
        dbgprint("WSPEnumNetworkEvents: WPUQuerySocketHandleContext() failed: %d",
            *lpErrno);
        *lpErrno = WSAENOTSOCK;
        return SOCKET_ERROR;
    }

    SetBlockingProvider(SocketContext->Provider);
    ret = SocketContext->Provider->NextProcTable.lpWSPEnumNetworkEvents(
                SocketContext->ProviderSocket,
                hEventObject,
                lpNetworkEvents,
                lpErrno);
    SetBlockingProvider(NULL);

    UnlockSocketContext(SocketContext, lpErrno);

    return ret;
}

int WSPAPI WSPEventSelect | ( | SOCKET | s,
 |  | WSAEVENT | hEventObject,
 |  | long | lNetworkEvents,
 |  | LPINT | lpErrno
 | ) |  |

Definition at line 859 of file spi.cpp.

{
    SOCK_INFO *SocketContext;
    INT        ret;

    SocketContext = FindAndLockSocketContext(s, lpErrno);
    if (SocketContext == NULL)
    {
        dbgprint("WSPEventSelect: WPUQuerySocketHandleContext() failed: %d", *lpErrno);
        *lpErrno = WSAENOTSOCK;
        return SOCKET_ERROR;
    }

    SetBlockingProvider(SocketContext->Provider);
    ret = SocketContext->Provider->NextProcTable.lpWSPEventSelect(
                SocketContext->ProviderSocket,
                hEventObject,
                lNetworkEvents,
                lpErrno);
    SetBlockingProvider(NULL);

    UnlockSocketContext(SocketContext, lpErrno);

    return ret;
}

BOOL WSPAPI WSPGetOverlappedResult | ( | SOCKET | s,
 |  | LPWSAOVERLAPPED | lpOverlapped,
 |  | LPDWORD | lpcbTransfer,
 |  | BOOL | fWait,
 |  | LPDWORD | lpdwFlags,
 |  | LPINT | lpErrno
 | ) |  |

Definition at line 898 of file spi.cpp.

{
    DWORD ret;

    s;
    if (lpOverlapped->Internal != WSS_OPERATION_IN_PROGRESS)
    {
        // Operation has completed, update the parameters and return
        //
        *lpcbTransfer = (DWORD)lpOverlapped->InternalHigh;
        *lpdwFlags = (DWORD)lpOverlapped->OffsetHigh;
        *lpErrno = (INT)lpOverlapped->Offset;

        return (lpOverlapped->Offset == 0 ? TRUE : FALSE);
    }
    else
    {
        // Operation is still in progress
        //
        if (fWait)
        {
            // Wait on the app supplied event handle. Once the operation
            //  is completed the IOCP or completion routine will fire.
            //  Once that is handled, WPUCompleteOverlappedRequest will
            //  be called which will signal the app event.
            //
            ret = WaitForSingleObject(lpOverlapped->hEvent, INFINITE);
            if ( (ret == WAIT_OBJECT_0) &&
                 (lpOverlapped->Internal != WSS_OPERATION_IN_PROGRESS) )
            {
                *lpcbTransfer = (DWORD)lpOverlapped->InternalHigh;
                *lpdwFlags = (DWORD)lpOverlapped->OffsetHigh;
                *lpErrno = (INT)lpOverlapped->Offset;

                return(lpOverlapped->Offset == 0 ? TRUE : FALSE);
            }
            else if (lpOverlapped->Internal == WSS_OPERATION_IN_PROGRESS)
                *lpErrno = WSA_IO_PENDING;
            else
                *lpErrno = WSASYSCALLFAILURE;
        }
        else
            *lpErrno = WSA_IO_INCOMPLETE;
    }
    return FALSE;
}

int WSPAPI WSPGetPeerName | ( | SOCKET | s,
 |  | struct sockaddr FAR * | name,
 |  | LPINT | namelen,
 |  | LPINT | lpErrno
 | ) |  |

Definition at line 958 of file spi.cpp.

{
    SOCK_INFO *SocketContext;
    INT        ret;

    SocketContext = FindAndLockSocketContext(s, lpErrno);
    if (SocketContext == NULL)
    {
        dbgprint("WSPGetPeerName: WPUQuerySocketHandleContext() failed: %d", *lpErrno);
        *lpErrno = WSAENOTSOCK;
        return SOCKET_ERROR;
    }

    SetBlockingProvider(SocketContext->Provider);
    ret = SocketContext->Provider->NextProcTable.lpWSPGetPeerName(
                SocketContext->ProviderSocket,
                name,
                namelen,
                lpErrno);
    SetBlockingProvider(NULL);

    UnlockSocketContext(SocketContext, lpErrno);

    return ret;
}

BOOL WSPAPI WSPGetQOSByName | ( | SOCKET | s,
 |  | LPWSABUF | lpQOSName,
 |  | LPQOS | lpQOS,
 |  | LPINT | lpErrno
 | ) |  |

Definition at line 1113 of file spi.cpp.

{
    SOCK_INFO *SocketContext;
    INT        ret;

    SocketContext = FindAndLockSocketContext(s, lpErrno);
    if (SocketContext == NULL)
    {
        dbgprint("WSPGetQOSByName: WPUQuerySocketHandleContext() failed: %d", *lpErrno);
        *lpErrno = WSAENOTSOCK;
        return FALSE;
    }

    SetBlockingProvider(SocketContext->Provider);
    ret = SocketContext->Provider->NextProcTable.lpWSPGetQOSByName(
                SocketContext->ProviderSocket,
                lpQOSName,
                lpQOS,
                lpErrno);
    SetBlockingProvider(NULL);

    UnlockSocketContext(SocketContext, lpErrno);

    return ret;
}

int WSPAPI WSPGetSockName | ( | SOCKET | s,
 |  | struct sockaddr FAR * | name,
 |  | LPINT | namelen,
 |  | LPINT | lpErrno
 | ) |  |

Definition at line 995 of file spi.cpp.

{
    SOCK_INFO *SocketContext;
    INT        ret;

    SocketContext = FindAndLockSocketContext(s, lpErrno);
    if (SocketContext == NULL)
    {
        dbgprint("WSPGetSockName: WPUQuerySocketHandleContext() failed: %d", *lpErrno);
        *lpErrno = WSAENOTSOCK;
        return SOCKET_ERROR;
    }

    SetBlockingProvider(SocketContext->Provider);
    ret = SocketContext->Provider->NextProcTable.lpWSPGetSockName(
                SocketContext->ProviderSocket,
                name,
                namelen,
                lpErrno);
    SetBlockingProvider(NULL);

    UnlockSocketContext(SocketContext, lpErrno);

    return ret;
}

int WSPAPI WSPGetSockOpt | ( | SOCKET | s,
 |  | int | level,
 |  | int | optname,
 |  | char FAR * | optval,
 |  | LPINT | optlen,
 |  | LPINT | lpErrno
 | ) |  |

Definition at line 1032 of file spi.cpp.

{
    SOCK_INFO *SocketContext;
    INT        ret=NO_ERROR;

    SocketContext = FindAndLockSocketContext(s, lpErrno);
    if (SocketContext == NULL)
    {
        dbgprint("WSPGetSockOpt: WPUQuerySocketHandleContext() failed: %d", *lpErrno);
        *lpErrno = WSAENOTSOCK;
        return SOCKET_ERROR;
    }
    //
    // We need to capture this and return our own WSAPROTOCOL_INFO structure.
    // Otherwise, if we translate the handle and pass it to the lower provider
    // we'll return the lower provider's protocol info!
    //
    if ((level == SOL_SOCKET) && ((optname == SO_PROTOCOL_INFO) ||
                                  (optname == SO_PROTOCOL_INFOA) ||
                                  (optname == SO_PROTOCOL_INFOW) ))
    {
        if ((optname == SO_PROTOCOL_INFOW) && (*optlen >= sizeof(WSAPROTOCOL_INFOW)))
        {
            // No conversion necessary, just copy the data
            memcpy(optval,
                   &SocketContext->Provider->LayeredProvider,
                   sizeof(WSAPROTOCOL_INFOW));
        }
        else if ((optname == SO_PROTOCOL_INFOA) && (*optval >= sizeof(WSAPROTOCOL_INFOA)))
        {
            // Copy everything but the string
            memcpy(optval,
                   &SocketContext->Provider->LayeredProvider,
                   sizeof(WSAPROTOCOL_INFOW)-WSAPROTOCOL_LEN+1);
            // Convert our saved UNICODE string to ASCII
            WideCharToMultiByte(CP_ACP,
                                0,
                                SocketContext->Provider->LayeredProvider.szProtocol,
                                -1,
                                ((WSAPROTOCOL_INFOA *)optval)->szProtocol,
                                WSAPROTOCOL_LEN+1,
                                NULL,
                                NULL);
        }
        else
        {
            *lpErrno = WSAEFAULT;
            ret = SOCKET_ERROR;
        }
    }
    else
    {
        SetBlockingProvider(SocketContext->Provider);
        ret = SocketContext->Provider->NextProcTable.lpWSPGetSockOpt(
                    SocketContext->ProviderSocket,
                    level,
                    optname,
                    optval,
                    optlen,
                    lpErrno);
        SetBlockingProvider(NULL);
    }

    UnlockSocketContext(SocketContext, lpErrno);

    return ret;
}

int WSPAPI WSPIoctl | ( | SOCKET | s,
 |  | DWORD | dwIoControlCode,
 |  | LPVOID | lpvInBuffer,
 |  | DWORD | cbInBuffer,
 |  | LPVOID | lpvOutBuffer,
 |  | DWORD | cbOutBuffer,
 |  | LPDWORD | lpcbBytesReturned,
 |  | LPWSAOVERLAPPED | lpOverlapped,
 |  | LPWSAOVERLAPPED_COMPLETION_ROUTINE | lpCompletionRoutine,
 |  | LPWSATHREADID | lpThreadId,
 |  | LPINT | lpErrno
 | ) |  |

Definition at line 1155 of file spi.cpp.

{
    LPWSAOVERLAPPEDPLUS ProviderOverlapped=NULL;
    SOCK_INFO          *SocketContext;
    GUID                AcceptExGuid = WSAID_ACCEPTEX;
    GUID                TransmitFileGuid = WSAID_TRANSMITFILE;
    GUID                GetAcceptExSockAddrsGuid = WSAID_GETACCEPTEXSOCKADDRS;
    GUID                ConnectExGuid = WSAID_CONNECTEX;
    GUID                DisconnectExGuid = WSAID_DISCONNECTEX;
    GUID                TransmitPacketsGuid = WSAID_TRANSMITPACKETS;
    GUID                WSARecvMsgGuid = WSAID_WSARECVMSG;
    int                 ret=NO_ERROR;

    SocketContext = FindAndLockSocketContext(s, lpErrno);
    if (SocketContext == NULL)
    {
        dbgprint("WSPIoctl: WPUQuerySocketHandleContext() failed: %d", *lpErrno);
        *lpErrno = WSAENOTSOCK;
        return SOCKET_ERROR;
    }

    if (dwIoControlCode == SIO_GET_EXTENSION_FUNCTION_POINTER)
    {
        // Check to see which extension function is being requested.
        //
        if (memcmp (lpvInBuffer, &TransmitFileGuid, sizeof (GUID)) == 0)
        {
            // Return a pointer to our intermediate extesion function
            //
            *((LPFN_TRANSMITFILE *)lpvOutBuffer) = ExtTransmitFile;
            //
            // Attempt to load the lower provider's extension function
            //
            if (!SocketContext->Provider->NextProcTableExt.lpfnTransmitFile)
            {
                SetBlockingProvider(SocketContext->Provider);
                ret = SocketContext->Provider->NextProcTable.lpWSPIoctl(
                        SocketContext->ProviderSocket,
                        SIO_GET_EXTENSION_FUNCTION_POINTER,
                        &TransmitFileGuid,
                        sizeof(GUID),
                        (LPVOID) &SocketContext->Provider->NextProcTableExt.lpfnTransmitFile,
                        sizeof(LPFN_TRANSMITFILE),
                        lpcbBytesReturned,
                        NULL,
                        NULL,
                        NULL,
                        lpErrno);
                SetBlockingProvider(NULL);
            }

            UnlockSocketContext(SocketContext, lpErrno);

            return ret;
        }
        else if (memcmp(lpvInBuffer, &AcceptExGuid, sizeof(GUID)) == 0)
        {
            // Return a pointer to our intermediate extension function
            //
            *((LPFN_ACCEPTEX *)lpvOutBuffer) = ExtAcceptEx;
            //
            // Attempt to load the lower provider's extension function
            //
            if (!SocketContext->Provider->NextProcTableExt.lpfnAcceptEx)
            {
                SetBlockingProvider(SocketContext->Provider);
                ret = SocketContext->Provider->NextProcTable.lpWSPIoctl(
                        SocketContext->ProviderSocket,
                        SIO_GET_EXTENSION_FUNCTION_POINTER,
                        &AcceptExGuid,
                        sizeof(GUID),
                        (LPVOID) &SocketContext->Provider->NextProcTableExt.lpfnAcceptEx,
                        sizeof(LPFN_ACCEPTEX),
                        lpcbBytesReturned,
                        NULL,
                        NULL,
                        NULL,
                        lpErrno);
                SetBlockingProvider(NULL);
            }

            UnlockSocketContext(SocketContext, lpErrno);

            return ret;
        }
        else if (memcmp (lpvInBuffer, &ConnectExGuid, sizeof(GUID)) == 0)
        {
            // Return a pointer to our intermediate extension function
            //
            *((LPFN_CONNECTEX *)lpvOutBuffer) = ExtConnectEx;
            //
            // Attempt to load the lower provider's extension function
            //
            if (!SocketContext->Provider->NextProcTableExt.lpfnConnectEx)
            {
                SetBlockingProvider(SocketContext->Provider);
                ret = SocketContext->Provider->NextProcTable.lpWSPIoctl(
                        SocketContext->ProviderSocket,
                        SIO_GET_EXTENSION_FUNCTION_POINTER,
                        &ConnectExGuid,
                        sizeof(GUID),
                        (LPVOID) &SocketContext->Provider->NextProcTableExt.lpfnConnectEx,
                        sizeof(LPFN_CONNECTEX),
                        lpcbBytesReturned,
                        NULL,
                        NULL,
                        NULL,
                        lpErrno);
                SetBlockingProvider(NULL);
            }

            UnlockSocketContext(SocketContext, lpErrno);

            return ret;
        }
        else if (memcmp (lpvInBuffer, &DisconnectExGuid, sizeof(GUID)) == 0)
        {
            // Return a pointer to our intermediate extension function
            //
            *((LPFN_DISCONNECTEX *)lpvOutBuffer) = ExtDisconnectEx;
            //
            // Attempt to load the lower provider's extension function
            //
            if (!SocketContext->Provider->NextProcTableExt.lpfnDisconnectEx)
            {
                SetBlockingProvider(SocketContext->Provider);
                ret = SocketContext->Provider->NextProcTable.lpWSPIoctl(
                        SocketContext->ProviderSocket,
                        SIO_GET_EXTENSION_FUNCTION_POINTER,
                        &DisconnectExGuid,
                        sizeof(GUID),
                        (LPVOID) &SocketContext->Provider->NextProcTableExt.lpfnDisconnectEx,
                        sizeof(LPFN_DISCONNECTEX),
                        lpcbBytesReturned,
                        NULL,
                        NULL,
                        NULL,
                        lpErrno);
                SetBlockingProvider(NULL);
            }

            UnlockSocketContext(SocketContext, lpErrno);

            return ret;
        }
        else if (memcmp (lpvInBuffer, &TransmitPacketsGuid, sizeof(GUID)) == 0)
        {
            // Return a pointer to our intermediate extension function
            //
            *((LPFN_TRANSMITPACKETS *)lpvOutBuffer) = ExtTransmitPackets;
            //
            // Attempt to load the lower provider's extension function
            //
            if (!SocketContext->Provider->NextProcTableExt.lpfnTransmitPackets)
            {
                SetBlockingProvider(SocketContext->Provider);
                ret = SocketContext->Provider->NextProcTable.lpWSPIoctl(
                        SocketContext->ProviderSocket,
                        SIO_GET_EXTENSION_FUNCTION_POINTER,
                        &TransmitPacketsGuid,
                        sizeof(GUID),
                        (LPVOID) &SocketContext->Provider->NextProcTableExt.lpfnTransmitPackets,
                        sizeof(LPFN_TRANSMITPACKETS),
                        lpcbBytesReturned,
                        NULL,
                        NULL,
                        NULL,
                        lpErrno);
                SetBlockingProvider(NULL);
            }

            UnlockSocketContext(SocketContext, lpErrno);

            return ret;
        }
        else if (memcmp (lpvInBuffer, &WSARecvMsgGuid, sizeof(GUID)) == 0)
        {
            // Return a pointer to our intermediate extension function
            //
            *((LPFN_WSARECVMSG *)lpvOutBuffer) = ExtWSARecvMsg;
            //
            // Attempt to load the lower provider's extension function
            //
            if (!SocketContext->Provider->NextProcTableExt.lpfnWSARecvMsg)
            {
                SetBlockingProvider(SocketContext->Provider);
                ret = SocketContext->Provider->NextProcTable.lpWSPIoctl(
                        SocketContext->ProviderSocket,
                        SIO_GET_EXTENSION_FUNCTION_POINTER,
                        &WSARecvMsgGuid,
                        sizeof(GUID),
                        (LPVOID) &SocketContext->Provider->NextProcTableExt.lpfnWSARecvMsg,
                        sizeof(LPFN_WSARECVMSG),
                        lpcbBytesReturned,
                        NULL,
                        NULL,
                        NULL,
                        lpErrno);
                SetBlockingProvider(NULL);
            }

            UnlockSocketContext(SocketContext, lpErrno);

            return ret;
        }
        else if (memcmp (lpvInBuffer, &GetAcceptExSockAddrsGuid, sizeof (GUID)) == 0)
        {
            // No socket handle translation needed, let the call pass through below
            // (i.e. we really don't have any need to intercept this call)
        }
        else
        {
            UnlockSocketContext(SocketContext, lpErrno);

            *lpErrno = WSAEINVAL;
            return SOCKET_ERROR;
        }
    }
    else if (dwIoControlCode == SIO_QUERY_TARGET_PNP_HANDLE)
    {
        DWORD       BytesReturned = 0;

        dbgprint("SIO_QUERY_PNP_HANDLE requested");

        *((SOCKET *)lpvOutBuffer) = SocketContext->ProviderSocket;
        *lpcbBytesReturned = sizeof(SocketContext->ProviderSocket);

        if (lpOverlapped)
        {
            ProviderOverlapped = GetOverlappedStructure(SocketContext);
            if (ProviderOverlapped == NULL)
            {
                UnlockSocketContext(SocketContext, lpErrno);

                *lpErrno = WSAENOBUFS;
                return SOCKET_ERROR;
            }

            __try {
                if  (( lpCompletionRoutine == NULL ) && (lpOverlapped->hEvent != NULL ))
                {
                    ret = ResetEvent(lpOverlapped->hEvent);
                    if (ret == 0)
                    {
                        // Return to original state and indicate error
                        (SocketContext->dwOutstandingAsync)--;
                        UnlockSocketContext(SocketContext, lpErrno);
                        PutbackOverlappedStructure(ProviderOverlapped);
                        *lpErrno = ERROR_INVALID_HANDLE;
                        return SOCKET_ERROR;
                    }
                }
                CopyOffset(&ProviderOverlapped->ProviderOverlapped, lpOverlapped);
                ProviderOverlapped->CallerThreadId = *lpThreadId;
                lpOverlapped->InternalHigh         = BytesReturned = *lpcbBytesReturned;
                lpOverlapped->Internal             = (DWORD_PTR)lpCompletionRoutine;

            }
            __except(EXCEPTION_EXECUTE_HANDLER)
            {
                // Return to original state and indicate error
                (SocketContext->dwOutstandingAsync)--;
                UnlockSocketContext(SocketContext, lpErrno);
                PutbackOverlappedStructure(ProviderOverlapped);
                *lpErrno = WSAEFAULT;
                return SOCKET_ERROR;
            }

            ProviderOverlapped->lpCallerOverlapped = lpOverlapped;
            ProviderOverlapped->SockInfo           = SocketContext;
            ProviderOverlapped->CallerSocket       = s;
            ProviderOverlapped->ProviderSocket     = SocketContext->ProviderSocket;
            ProviderOverlapped->Error              = NO_ERROR;
            ProviderOverlapped->Operation          = LSP_OP_IOCTL;
            ProviderOverlapped->lpCallerCompletionRoutine   = lpCompletionRoutine;
            ProviderOverlapped->Provider = SocketContext->Provider;

            //
            // Call the completion routine immediately since there is nothing
            //  else to do. For this ioctl all we do is return the provider
            //  socket. If it was called overlapped just complete the operation.
            //

            dbgprint("SIO_QUERY_PNP_HANDLE overlapped");

            IntermediateCompletionRoutine(0,
                                          BytesReturned,
                                         (WSAOVERLAPPED *)ProviderOverlapped,
                                          0);
        }
        UnlockSocketContext(SocketContext, lpErrno);

        return NO_ERROR;
    }

    //
    // Check for overlapped I/O
    //
    if (lpOverlapped)
    {
        ProviderOverlapped = GetOverlappedStructure(SocketContext);
        if (!ProviderOverlapped)
        {
            UnlockSocketContext(SocketContext, lpErrno);

            *lpErrno = WSAENOBUFS;
            return SOCKET_ERROR;
        }

        __try {
            if (( lpCompletionRoutine == NULL ) && ( lpOverlapped->hEvent != NULL ))
            {
                ret = ResetEvent(lpOverlapped->hEvent);
                if (ret == 0)
                {
                    // Return to original state and indicate error
                    (SocketContext->dwOutstandingAsync)--;
                    UnlockSocketContext(SocketContext, lpErrno);
                    PutbackOverlappedStructure(ProviderOverlapped);
                    *lpErrno = ERROR_INVALID_HANDLE;
                    return SOCKET_ERROR;
                }
            }
            CopyOffset(&ProviderOverlapped->ProviderOverlapped, lpOverlapped);
            ProviderOverlapped->CallerThreadId            = *lpThreadId;
            ProviderOverlapped->IoctlArgs.cbBytesReturned = (lpcbBytesReturned ? *lpcbBytesReturned : 0);
        }
        __except(EXCEPTION_EXECUTE_HANDLER)
        {
            // Return to original state and indicate error
            (SocketContext->dwOutstandingAsync)--;
            UnlockSocketContext(SocketContext, lpErrno);
            PutbackOverlappedStructure(ProviderOverlapped);
            *lpErrno = WSAEFAULT;
            return SOCKET_ERROR;
        }

        ProviderOverlapped->lpCallerOverlapped = lpOverlapped;
        ProviderOverlapped->SockInfo           = SocketContext;
        ProviderOverlapped->CallerSocket       = s;
        ProviderOverlapped->ProviderSocket     = SocketContext->ProviderSocket;
        ProviderOverlapped->Error              = NO_ERROR;
        ProviderOverlapped->Operation          = LSP_OP_IOCTL;
        ProviderOverlapped->lpCallerCompletionRoutine   = lpCompletionRoutine;
        ProviderOverlapped->IoctlArgs.dwIoControlCode   = dwIoControlCode;
        ProviderOverlapped->IoctlArgs.lpvInBuffer       = lpvInBuffer;
        ProviderOverlapped->IoctlArgs.cbInBuffer        = cbInBuffer;
        ProviderOverlapped->IoctlArgs.lpvOutBuffer      = lpvOutBuffer;
        ProviderOverlapped->IoctlArgs.cbOutBuffer       = cbOutBuffer;
        ProviderOverlapped->Provider = SocketContext->Provider;

        ret = QueueOverlappedOperation(ProviderOverlapped, SocketContext);

        if (ret != NO_ERROR)
        {
            *lpErrno = ret;
            ret = SOCKET_ERROR;
        }
    }
    else
    {
        SetBlockingProvider(SocketContext->Provider);
        ret = SocketContext->Provider->NextProcTable.lpWSPIoctl(
                SocketContext->ProviderSocket,
                dwIoControlCode,
                lpvInBuffer,
                cbInBuffer,
                lpvOutBuffer,
                cbOutBuffer,
                lpcbBytesReturned,
                lpOverlapped,
                lpCompletionRoutine,
                lpThreadId,
                lpErrno);
        SetBlockingProvider(NULL);
    }

    UnlockSocketContext(SocketContext, lpErrno);

    return ret;
}

SOCKET WSPAPI WSPJoinLeaf | ( | SOCKET | s,
 |  | const struct sockaddr FAR * | name,
 |  | int | namelen,
 |  | LPWSABUF | lpCallerData,
 |  | LPWSABUF | lpCalleeData,
 |  | LPQOS | lpSQOS,
 |  | LPQOS | lpGQOS,
 |  | DWORD | dwFlags,
 |  | LPINT | lpErrno
 | ) |  |

Definition at line 1561 of file spi.cpp.

{
    SOCK_INFO *SocketContext;
    SOCKET     NextProviderSocket = INVALID_SOCKET,
               NewSocket = INVALID_SOCKET;

    SocketContext = FindAndLockSocketContext(s, lpErrno);
    if (SocketContext == NULL)
    {
        dbgprint("WSPJoinLeaf: WPUQuerySocketHandleContext() failed: %d", *lpErrno);
        *lpErrno = WSAENOTSOCK;
        return INVALID_SOCKET;
    }

    SetBlockingProvider(SocketContext->Provider);
    NextProviderSocket = SocketContext->Provider->NextProcTable.lpWSPJoinLeaf(
            SocketContext->ProviderSocket,
            name,
            namelen,
            lpCallerData,
            lpCalleeData,
            lpSQOS,
            lpGQOS,
            dwFlags,
            lpErrno);
    SetBlockingProvider(NULL);
    //
    // If the socket returned from the lower provider is the same as the socket
    //  passed into it then there really isn't a new socket - just return.
    //  Otherwise, a new socket has been created and we need to create the socket
    //  context and create a user socket to pass back.
    //
    if (NextProviderSocket == INVALID_SOCKET)
    {
        NewSocket = INVALID_SOCKET;
    }
    else if (NextProviderSocket != SocketContext->ProviderSocket)
    {
        SOCK_INFO   *NewSocketContext;

        //
        // Create socket context for new socket
        //
        NewSocketContext = CreateSockInfo(
                SocketContext->Provider,
                NextProviderSocket,
                SocketContext,
                FALSE
                );
        if  (NewSocketContext == NULL)
        {
            *lpErrno = WSAENOBUFS;
        }
        else
        {
            //
            // Create a socket handle to pass to the app
            //
            NewSocket = NewSocketContext->LayeredSocket = MainUpCallTable.lpWPUCreateSocketHandle(
                    SocketContext->Provider->LayeredProvider.ProtocolChain.ChainEntries[0],
                    (DWORD_PTR) NewSocketContext,
                    lpErrno
                    );
            if (NewSocketContext->LayeredSocket == INVALID_SOCKET)
            {
                // Close the lower provider's socket
                SocketContext->Provider->NextProcTable.lpWSPCloseSocket(
                    NextProviderSocket,
                    lpErrno
                    );

                // Context is not in the list yet so we can just free it
                FreeSockInfo(NewSocketContext);
            }
            else
            {
                // Need to insert the context
                InsertSocketInfo(SocketContext->Provider, NewSocketContext);
            }
        }
    }
    else
    {
        NewSocket = s;
    }

    UnlockSocketContext(SocketContext, lpErrno);

    return NewSocket;
}

int WSPAPI WSPListen | ( | SOCKET | s,
 |  | int | backlog,
 |  | LPINT | lpErrno
 | ) |  |

Definition at line 1668 of file spi.cpp.

{
    SOCK_INFO *SocketContext;
    INT        ret;

    SocketContext = FindAndLockSocketContext(s, lpErrno);
    if (SocketContext == NULL)
    {
        dbgprint("WSPListen: WPUQuerySocketHandleContext() failed: %d", *lpErrno);
        *lpErrno = WSAENOTSOCK;
        return SOCKET_ERROR;
    }

    SetBlockingProvider(SocketContext->Provider);
    ret = SocketContext->Provider->NextProcTable.lpWSPListen(
                SocketContext->ProviderSocket,
                backlog,
                lpErrno);
    SetBlockingProvider(NULL);

    UnlockSocketContext(SocketContext, lpErrno);

    return ret;
}

int WSPAPI WSPRecv | ( | SOCKET | s,
 |  | LPWSABUF | lpBuffers,
 |  | DWORD | dwBufferCount,
 |  | LPDWORD | lpNumberOfBytesRecvd,
 |  | LPDWORD | lpFlags,
 |  | LPWSAOVERLAPPED | lpOverlapped,
 |  | LPWSAOVERLAPPED_COMPLETION_ROUTINE | lpCompletionRoutine,
 |  | LPWSATHREADID | lpThreadId,
 |  | LPINT | lpErrno
 | ) |  |

Definition at line 1705 of file spi.cpp.

{
    LPWSAOVERLAPPEDPLUS ProviderOverlapped;
    SOCK_INFO          *SocketContext;
    int                 ret;

    SocketContext = FindAndLockSocketContext(s, lpErrno);
    if (SocketContext == NULL)
    {
        dbgprint("WSPRecv: WPUQuerySocketHandleContext() failed: %d", *lpErrno);
        *lpErrno = WSAENOTSOCK;
        return SOCKET_ERROR;
    }
    //
    // Check for overlapped I/O
    //
    if (lpOverlapped)
    {
        ProviderOverlapped = GetOverlappedStructure(SocketContext);
        if (!ProviderOverlapped)
        {
            UnlockSocketContext(SocketContext, lpErrno);
            dbgprint("WSPRecv: GetOverlappedStructure() returned NULL");
            *lpErrno = WSAENOBUFS;
            return SOCKET_ERROR;
        }

        __try {
            if (( lpCompletionRoutine == NULL ) && ( lpOverlapped->hEvent != NULL ))
            {
                ret = ResetEvent(lpOverlapped->hEvent);
                if (ret == 0)
                {
                    // Return to original state and indicate error
                    (SocketContext->dwOutstandingAsync)--;
                    UnlockSocketContext(SocketContext, lpErrno);
                    PutbackOverlappedStructure(ProviderOverlapped);
                    *lpErrno = ERROR_INVALID_HANDLE;
                    return SOCKET_ERROR;
                }
            }
            CopyOffset(&ProviderOverlapped->ProviderOverlapped, lpOverlapped);
            ProviderOverlapped->CallerThreadId                = *lpThreadId;
            ProviderOverlapped->RecvArgs.dwNumberOfBytesRecvd = (lpNumberOfBytesRecvd ? *lpNumberOfBytesRecvd : 0);
            ProviderOverlapped->RecvArgs.dwFlags              = (lpFlags ? *lpFlags : 0);
            ProviderOverlapped->RecvArgs.lpBuffers            = CopyBuffer(lpBuffers, dwBufferCount);
        }
        __except(EXCEPTION_EXECUTE_HANDLER)
        {
            // Return to original state and indicate error
            (SocketContext->dwOutstandingAsync)--;
            UnlockSocketContext(SocketContext, lpErrno);
            PutbackOverlappedStructure(ProviderOverlapped);
            *lpErrno = WSAEFAULT;
            return SOCKET_ERROR;
        }

        ProviderOverlapped->lpCallerOverlapped = lpOverlapped;
        ProviderOverlapped->SockInfo           = SocketContext;
        ProviderOverlapped->CallerSocket       = s;
        ProviderOverlapped->ProviderSocket     = SocketContext->ProviderSocket;
        ProviderOverlapped->Error              = NO_ERROR;
        ProviderOverlapped->Operation          = LSP_OP_RECV;
        ProviderOverlapped->lpCallerCompletionRoutine = lpCompletionRoutine;
        ProviderOverlapped->RecvArgs.dwBufferCount    = dwBufferCount;
        ProviderOverlapped->Provider = SocketContext->Provider;

        ret = QueueOverlappedOperation(ProviderOverlapped, SocketContext);

        if (ret != NO_ERROR)
        {
            *lpErrno = ret;
            ret = SOCKET_ERROR;
        }
    }
    else
    {
        SetBlockingProvider(SocketContext->Provider);
        ret = SocketContext->Provider->NextProcTable.lpWSPRecv(
                SocketContext->ProviderSocket,
                lpBuffers,
                dwBufferCount,
                lpNumberOfBytesRecvd,
                lpFlags,
                lpOverlapped,
                lpCompletionRoutine,
                lpThreadId,
                lpErrno);
        SetBlockingProvider(NULL);
        if (ret != SOCKET_ERROR)
        {
            SocketContext->BytesRecv += *lpNumberOfBytesRecvd;
        }
    }

    UnlockSocketContext(SocketContext, lpErrno);

    return ret;
}

int WSPAPI WSPRecvDisconnect | ( | SOCKET | s,
 |  | LPWSABUF | lpInboundDisconnectData,
 |  | LPINT | lpErrno
 | ) |  |

Definition at line 1821 of file spi.cpp.

{
    SOCK_INFO *SocketContext;
    INT        ret;

    SocketContext = FindAndLockSocketContext(s, lpErrno);
    if (SocketContext == NULL)
    {
        dbgprint("WSPRecvDisconnect: WPUQuerySocketHandleContext() failed: %d", *lpErrno);
        *lpErrno = WSAENOTSOCK;
        return SOCKET_ERROR;
    }

    SetBlockingProvider(SocketContext->Provider);
    ret = SocketContext->Provider->NextProcTable.lpWSPRecvDisconnect(
                SocketContext->ProviderSocket,
                lpInboundDisconnectData,
                lpErrno);
    SetBlockingProvider(NULL);

    UnlockSocketContext(SocketContext, lpErrno);

    return ret;
}

int WSPAPI WSPRecvFrom | ( | SOCKET | s,
 |  | LPWSABUF | lpBuffers,
 |  | DWORD | dwBufferCount,
 |  | LPDWORD | lpNumberOfBytesRecvd,
 |  | LPDWORD | lpFlags,
 |  | struct sockaddr FAR * | lpFrom,
 |  | LPINT | lpFromLen,
 |  | LPWSAOVERLAPPED | lpOverlapped,
 |  | LPWSAOVERLAPPED_COMPLETION_ROUTINE | lpCompletionRoutine,
 |  | LPWSATHREADID | lpThreadId,
 |  | LPINT | lpErrno
 | ) |  |

Definition at line 1858 of file spi.cpp.

{
    LPWSAOVERLAPPEDPLUS ProviderOverlapped;
    SOCK_INFO          *SocketContext;
    int                 ret;

    SocketContext = FindAndLockSocketContext(s, lpErrno);
    if (SocketContext == NULL)
    {
        dbgprint("WSPRecvFrom: WPUQuerySocketHandleContext() failed: %d", *lpErrno);
        *lpErrno = WSAENOTSOCK;
        return SOCKET_ERROR;
    }
    //
    // Check for overlapped I/O
    //
    if (lpOverlapped)
    {
        ProviderOverlapped = GetOverlappedStructure(SocketContext);
        if (!ProviderOverlapped)
        {
            UnlockSocketContext(SocketContext, lpErrno);
            dbgprint("WSPRecvFrom: GetOverlappedStructure() returned NULL");

            *lpErrno = WSAENOBUFS;
            return SOCKET_ERROR;
        }

        __try {
            if (( lpCompletionRoutine == NULL ) && ( lpOverlapped->hEvent != NULL ))
            {
                ret = ResetEvent(lpOverlapped->hEvent);
                if (ret == 0)
                {
                    // Return to original state and indicate error
                    (SocketContext->dwOutstandingAsync)--;
                    UnlockSocketContext(SocketContext, lpErrno);
                    PutbackOverlappedStructure(ProviderOverlapped);
                    *lpErrno = ERROR_INVALID_HANDLE;
                    return SOCKET_ERROR;
                }
            }
            CopyOffset(&ProviderOverlapped->ProviderOverlapped, lpOverlapped);
            ProviderOverlapped->CallerThreadId                    = *lpThreadId;
            ProviderOverlapped->RecvFromArgs.dwNumberOfBytesRecvd = (lpNumberOfBytesRecvd ? *lpNumberOfBytesRecvd : 0);
            ProviderOverlapped->RecvFromArgs.dwFlags              = (lpFlags ? *lpFlags : 0);
            ProviderOverlapped->RecvFromArgs.lpBuffers            = CopyBuffer(lpBuffers, dwBufferCount);
        }
        __except(EXCEPTION_EXECUTE_HANDLER)
        {
            // Return to original state and indicate error
            (SocketContext->dwOutstandingAsync)--;
            UnlockSocketContext(SocketContext, lpErrno);
            PutbackOverlappedStructure(ProviderOverlapped);
            *lpErrno = WSAEFAULT;
            return SOCKET_ERROR;
        }

        ProviderOverlapped->lpCallerOverlapped = lpOverlapped;
        ProviderOverlapped->SockInfo           = SocketContext;
        ProviderOverlapped->CallerSocket       = s;
        ProviderOverlapped->ProviderSocket     = SocketContext->ProviderSocket;
        ProviderOverlapped->Error              = NO_ERROR;
        ProviderOverlapped->Operation          = LSP_OP_RECVFROM;
        ProviderOverlapped->lpCallerCompletionRoutine           = lpCompletionRoutine;
        ProviderOverlapped->RecvFromArgs.dwBufferCount          = dwBufferCount;
        ProviderOverlapped->RecvFromArgs.lpFrom                 = lpFrom;
        ProviderOverlapped->RecvFromArgs.lpFromLen              = lpFromLen;
        ProviderOverlapped->Provider = SocketContext->Provider;

        ret = QueueOverlappedOperation(ProviderOverlapped, SocketContext);

        if (ret != NO_ERROR)
        {
            *lpErrno = ret;
            ret = SOCKET_ERROR;
        }
    }
    else
    {
        // Make a blocking WSPRecvFrom call
        //
        SetBlockingProvider(SocketContext->Provider);
        ret = SocketContext->Provider->NextProcTable.lpWSPRecvFrom(
                SocketContext->ProviderSocket,
                lpBuffers,
                dwBufferCount,
                lpNumberOfBytesRecvd,
                lpFlags,
                lpFrom,
                lpFromLen,
                lpOverlapped,
                lpCompletionRoutine,
                lpThreadId,
                lpErrno);
        SetBlockingProvider(NULL);
        if (ret != SOCKET_ERROR)
        {
            SocketContext->BytesRecv += *lpNumberOfBytesRecvd;
        }
    }

    UnlockSocketContext(SocketContext, lpErrno);

    return ret;
}

int WSPAPI WSPSelect | ( | int | nfds,
 |  | fd_set FAR * | readfds,
 |  | fd_set FAR * | writefds,
 |  | fd_set FAR * | exceptfds,
 |  | const struct timeval FAR * | timeout,
 |  | LPINT | lpErrno
 | ) |  |

Definition at line 1993 of file spi.cpp.

{
    SOCK_INFO *SocketContext=NULL;
    u_int      count,
               i;
    int        HandleCount,
               ret;

    struct
    {
        SOCKET     ClientSocket;
        SOCKET     ProvSocket;
        SOCK_INFO *Context;
    } Read[FD_SETSIZE], Write[FD_SETSIZE], Except[FD_SETSIZE];

    fd_set ReadFds, WriteFds, ExceptFds;

    if ( !readfds && !writefds && !exceptfds )
    {
        *lpErrno = WSAEINVAL;
        return SOCKET_ERROR;
    }
    //
    // Translate all handles contained in the fd_set structures.
    //  For each fd_set go through and build another fd_set which contains
    //  their lower provider socket handles.
    //
    if (readfds)
    {
        FD_ZERO(&ReadFds);

        if (readfds->fd_count > FD_SETSIZE)
        {
            *lpErrno = WSAENOBUFS;
            return SOCKET_ERROR;
        }
        for (i = 0; i < readfds->fd_count; i++)
        {
            Read[i].Context = FindAndLockSocketContext(
                    (Read[i].ClientSocket = readfds->fd_array[i]),
                    lpErrno
                    );
            if (Read[i].Context == NULL)
            {
                // This socket isn't ours -- just pass down in hopes the lower provider
                // knows about it
                Read[i].ProvSocket = readfds->fd_array[i];
                FD_SET(Read[i].ProvSocket, &ReadFds);
            }
            else
            {
                Read[i].ProvSocket = Read[i].Context->ProviderSocket;
                FD_SET(Read[i].ProvSocket, &ReadFds);

                // Save the first valid socket context structure
                if (SocketContext == NULL)
                    SocketContext = Read[i].Context;
            }
        }
    }

    if (writefds)
    {
        FD_ZERO(&WriteFds);

        if (writefds->fd_count > FD_SETSIZE)
        {
            *lpErrno = WSAENOBUFS;
            return SOCKET_ERROR;
        }
        for (i = 0; i < writefds->fd_count; i++)
        {
            Write[i].Context = FindAndLockSocketContext(
                    (Write[i].ClientSocket = writefds->fd_array[i]),
                    lpErrno
                    );
            if (Write[i].Context == NULL)
            {
                // This socket isn't ours -- just pass down in hopes the lower provider
                // knows about it
                Write[i].ProvSocket = writefds->fd_array[i];
                FD_SET(Write[i].ProvSocket, &WriteFds);
            }
            else
            {
                Write[i].ProvSocket = Write[i].Context->ProviderSocket;
                FD_SET(Write[i].ProvSocket, &WriteFds);

                // Save the first valid socket context structure
                if (SocketContext == NULL)
                    SocketContext = Write[i].Context;
            }
        }
    }

    if (exceptfds)
    {
        FD_ZERO(&ExceptFds);

        if (exceptfds->fd_count > FD_SETSIZE)
        {
            *lpErrno = WSAENOBUFS;
            return SOCKET_ERROR;
        }
        for (i = 0; i < exceptfds->fd_count; i++)
        {
            Except[i].Context = FindAndLockSocketContext(
                    (Except[i].ClientSocket = exceptfds->fd_array[i]),
                    lpErrno
                    );
            if (Except[i].Context == NULL)
            {
                // This socket isn't ours -- just pass down in hopes the lower provider
                // knows about it
                Except[i].ProvSocket = exceptfds->fd_array[i];
                FD_SET(Except[i].ProvSocket, &ExceptFds);
            }
            else
            {
                Except[i].ProvSocket = Except[i].Context->ProviderSocket;
                FD_SET(Except[i].ProvSocket, &ExceptFds);

                // Save the first valid socket context structure
                if (SocketContext == NULL)
                    SocketContext = Write[i].Context;
            }
        }
    }

    //
    // Now call the lower provider's WSPSelect with the fd_set structures we built
    //  containing the lower provider's socket handles.
    //
    if (SocketContext == NULL)
    {
        *lpErrno = WSAEINVAL;
        return SOCKET_ERROR;
    }
    SetBlockingProvider(SocketContext->Provider);
    ret = SocketContext->Provider->NextProcTable.lpWSPSelect(
            nfds,
            (readfds ? &ReadFds : NULL),
            (writefds ? &WriteFds : NULL),
            (exceptfds ? &ExceptFds : NULL),
            timeout,
            lpErrno);
    SetBlockingProvider(NULL);
    if (ret != SOCKET_ERROR)
    {
        // Once we complete we now have to go through the fd_sets we passed and
        //  map them BACK to the application socket handles. Fun!
        //
        HandleCount = ret;

        if (readfds)
        {
            count = readfds->fd_count;
            FD_ZERO(readfds);

            for(i = 0; (i < count) && HandleCount; i++)
            {
                if (MainUpCallTable.lpWPUFDIsSet(Read[i].ProvSocket, &ReadFds))
                {
                    FD_SET(Read[i].ClientSocket, readfds);
                    HandleCount--;
                }
            }
            // Release the socket context
            for(i=0; i < readfds->fd_count ;i++)
            {
                if (Read[i].Context != NULL)
                    UnlockSocketContext(Read[i].Context, lpErrno);
            }
        }

        if (writefds)
        {
            count = writefds->fd_count;
            FD_ZERO(writefds);

            for(i = 0; (i < count) && HandleCount; i++)
            {
                if (MainUpCallTable.lpWPUFDIsSet(Write[i].ProvSocket, &WriteFds))
                {
                    FD_SET(Write[i].ClientSocket, writefds);
                    HandleCount--;
                }
            }
            // Release the socket context
            for(i=0; i < writefds->fd_count ;i++)
            {
                if (Write[i].Context != NULL)
                    UnlockSocketContext(Write[i].Context, lpErrno);
            }
        }

        if (exceptfds)
        {
            count = exceptfds->fd_count;
            FD_ZERO(exceptfds);

            for(i = 0; (i < count) && HandleCount; i++)
            {
                if (MainUpCallTable.lpWPUFDIsSet(Except[i].ProvSocket, &ExceptFds))
                {
                    FD_SET(Except[i].ClientSocket, exceptfds);
                    HandleCount--;
                }
            }
            // Release the socket context
            for(i=0; i < exceptfds->fd_count ;i++)
            {
                if (Except[i].Context != NULL)
                    UnlockSocketContext(Except[i].Context, lpErrno);
            }
        }
    }
    return ret;
}

int WSPAPI WSPSend | ( | SOCKET | s,
 |  | LPWSABUF | lpBuffers,
 |  | DWORD | dwBufferCount,
 |  | LPDWORD | lpNumberOfBytesSent,
 |  | DWORD | dwFlags,
 |  | LPWSAOVERLAPPED | lpOverlapped,
 |  | LPWSAOVERLAPPED_COMPLETION_ROUTINE | lpCompletionRoutine,
 |  | LPWSATHREADID | lpThreadId,
 |  | LPINT | lpErrno
 | ) |  |

Definition at line 2228 of file spi.cpp.

{
    INT                 ret;
    SOCK_INFO          *SocketContext;
    LPWSAOVERLAPPEDPLUS ProviderOverlapped;

    SocketContext = FindAndLockSocketContext(s, lpErrno);
    if (SocketContext == NULL)
    {
        dbgprint("WSPSend: WPUQuerySocketHandleContext() failed: %d", *lpErrno);
        *lpErrno = WSAENOTSOCK;
        return SOCKET_ERROR;
    }
    //
    // Check for overlapped I/O
    //
    if (lpOverlapped)
    {
        ProviderOverlapped = GetOverlappedStructure(SocketContext);
        if (!ProviderOverlapped)
        {
            UnlockSocketContext(SocketContext, lpErrno);

            dbgprint("WSPSend: GetOverlappedStructure() returned NULL");
            *lpErrno = WSAENOBUFS;
            return SOCKET_ERROR;
        }

        __try {
            if (( lpCompletionRoutine == NULL ) && ( lpOverlapped->hEvent != NULL ))
            {
                ret = ResetEvent(lpOverlapped->hEvent);
                if (ret == 0)
                {
                    // Return to original state and indicate error
                    (SocketContext->dwOutstandingAsync)--;
                    UnlockSocketContext(SocketContext, lpErrno);
                    PutbackOverlappedStructure(ProviderOverlapped);
                    *lpErrno = ERROR_INVALID_HANDLE;
                    return SOCKET_ERROR;
                }
            }
            CopyOffset(&ProviderOverlapped->ProviderOverlapped, lpOverlapped);
            ProviderOverlapped->CallerThreadId               = *lpThreadId;
            ProviderOverlapped->SendArgs.lpBuffers           = CopyBuffer(lpBuffers, dwBufferCount);
            ProviderOverlapped->SendArgs.dwNumberOfBytesSent = (lpNumberOfBytesSent ? *lpNumberOfBytesSent : 0);
        }
        __except(EXCEPTION_EXECUTE_HANDLER)
        {
            // Return to original state and indicate error
            (SocketContext->dwOutstandingAsync)--;
            UnlockSocketContext(SocketContext, lpErrno);
            PutbackOverlappedStructure(ProviderOverlapped);
            *lpErrno = WSAEFAULT;
            return SOCKET_ERROR;
        }

        ProviderOverlapped->lpCallerOverlapped = lpOverlapped;
        ProviderOverlapped->SockInfo           = SocketContext;
        ProviderOverlapped->CallerSocket       = s;
        ProviderOverlapped->ProviderSocket     = SocketContext->ProviderSocket;
        ProviderOverlapped->Error              = NO_ERROR;
        ProviderOverlapped->Operation          = LSP_OP_SEND;
        ProviderOverlapped->lpCallerCompletionRoutine = lpCompletionRoutine;
        ProviderOverlapped->SendArgs.dwBufferCount    = dwBufferCount;
        ProviderOverlapped->SendArgs.dwFlags          = dwFlags;
        ProviderOverlapped->Provider = SocketContext->Provider;

        ret = QueueOverlappedOperation(ProviderOverlapped, SocketContext);

        if (ret != NO_ERROR)
        {
            *lpErrno = ret;
            ret = SOCKET_ERROR;
        }
    }
    else
    {
        // Make a blocking send call
        //
        SetBlockingProvider(SocketContext->Provider);
        ret = SocketContext->Provider->NextProcTable.lpWSPSend(
                SocketContext->ProviderSocket,
                lpBuffers,
                dwBufferCount,
                lpNumberOfBytesSent,
                dwFlags,
                lpOverlapped,
                lpCompletionRoutine,
                lpThreadId,
                lpErrno);
        SetBlockingProvider(NULL);
        if (ret != SOCKET_ERROR)
        {
            SocketContext->BytesSent += *lpNumberOfBytesSent;
        }
    }

    UnlockSocketContext(SocketContext, lpErrno);

    return ret;
}

int WSPAPI WSPSendDisconnect | ( | SOCKET | s,
 |  | LPWSABUF | lpOutboundDisconnectData,
 |  | LPINT | lpErrno
 | ) |  |

Definition at line 2348 of file spi.cpp.

{
    SOCK_INFO *SocketContext;
    INT        ret;

    SocketContext = FindAndLockSocketContext(s, lpErrno);
    if (SocketContext == NULL)
    {
        dbgprint("WSPSendDisconnect: WPUQuerySocketHandleContext() failed: %d", *lpErrno);

        *lpErrno = WSAENOTSOCK;
        return SOCKET_ERROR;
    }

    SetBlockingProvider(SocketContext->Provider);
    ret = SocketContext->Provider->NextProcTable.lpWSPSendDisconnect(
            SocketContext->ProviderSocket,
            lpOutboundDisconnectData,
            lpErrno);
    SetBlockingProvider(NULL);

    UnlockSocketContext(SocketContext, lpErrno);

    return ret;
}

int WSPAPI WSPSendTo | ( | SOCKET | s,
 |  | LPWSABUF | lpBuffers,
 |  | DWORD | dwBufferCount,
 |  | LPDWORD | lpNumberOfBytesSent,
 |  | DWORD | dwFlags,
 |  | const struct sockaddr FAR * | lpTo,
 |  | int | iToLen,
 |  | LPWSAOVERLAPPED | lpOverlapped,
 |  | LPWSAOVERLAPPED_COMPLETION_ROUTINE | lpCompletionRoutine,
 |  | LPWSATHREADID | lpThreadId,
 |  | LPINT | lpErrno
 | ) |  |

Definition at line 2386 of file spi.cpp.

{
    int                 ret;
    SOCK_INFO          *SocketContext;
    LPWSAOVERLAPPEDPLUS ProviderOverlapped;

    // Check for overlapped I/O
    //
    SocketContext = FindAndLockSocketContext(s, lpErrno);
    if (SocketContext == NULL)
    {
        dbgprint("WSPSendTo: WPUQuerySocketHandleContext() failed: %d", *lpErrno);

        *lpErrno = WSAENOTSOCK;
        return SOCKET_ERROR;
    }
    //
    // Check for overlapped
    //
    if (lpOverlapped)
    {
        ProviderOverlapped = GetOverlappedStructure(SocketContext);
        if (!ProviderOverlapped)
        {
            UnlockSocketContext(SocketContext, lpErrno);
            dbgprint("WSPSendto: GetOverlappedStructure() returned NULL");

            *lpErrno = WSAENOBUFS;
            return SOCKET_ERROR;
        }

        __try {
            if (( lpCompletionRoutine == NULL ) && ( lpOverlapped->hEvent != NULL ))
            {
                ret = ResetEvent(lpOverlapped->hEvent);
                if (ret == 0)
                {
                    // Return to original state and indicate error
                    (SocketContext->dwOutstandingAsync)--;
                    UnlockSocketContext(SocketContext, lpErrno);
                    PutbackOverlappedStructure(ProviderOverlapped);
                    *lpErrno = ERROR_INVALID_HANDLE;
                    return SOCKET_ERROR;
                }
            }
            CopyOffset(&ProviderOverlapped->ProviderOverlapped, lpOverlapped);
            ProviderOverlapped->CallerThreadId                 = *lpThreadId;
            ProviderOverlapped->SendToArgs.lpBuffers           = CopyBuffer(lpBuffers, dwBufferCount);
            ProviderOverlapped->SendToArgs.dwNumberOfBytesSent = (lpNumberOfBytesSent ? *lpNumberOfBytesSent : 0);
            if (iToLen <= sizeof(ProviderOverlapped->SendToArgs.To))
                CopyMemory(&ProviderOverlapped->SendToArgs.To, lpTo, iToLen);
        }
        __except(EXCEPTION_EXECUTE_HANDLER)
        {
            // Return to original state and indicate error
            (SocketContext->dwOutstandingAsync)--;
            UnlockSocketContext(SocketContext, lpErrno);
            PutbackOverlappedStructure(ProviderOverlapped);
            *lpErrno = WSAEFAULT;
            return SOCKET_ERROR;
        }

        ProviderOverlapped->lpCallerOverlapped = lpOverlapped;
        ProviderOverlapped->SockInfo           = SocketContext;
        ProviderOverlapped->CallerSocket       = s;
        ProviderOverlapped->ProviderSocket     = SocketContext->ProviderSocket;
        ProviderOverlapped->Error              = NO_ERROR;
        ProviderOverlapped->Operation          = LSP_OP_SENDTO;
        ProviderOverlapped->lpCallerCompletionRoutine        = lpCompletionRoutine;
        ProviderOverlapped->SendToArgs.dwBufferCount         = dwBufferCount;
        ProviderOverlapped->SendToArgs.dwFlags               = dwFlags;
        ProviderOverlapped->SendToArgs.iToLen                = iToLen;
        ProviderOverlapped->Provider = SocketContext->Provider;

        ret = QueueOverlappedOperation(ProviderOverlapped, SocketContext);

        if (ret != NO_ERROR)
        {
            *lpErrno = ret;
            ret = SOCKET_ERROR;
        }
    }
    else
    {
        SetBlockingProvider(SocketContext->Provider);
        ret = SocketContext->Provider->NextProcTable.lpWSPSendTo(
                SocketContext->ProviderSocket,
                lpBuffers,
                dwBufferCount,
                lpNumberOfBytesSent,
                dwFlags,
                lpTo,
                iToLen,
                lpOverlapped,
                lpCompletionRoutine,
                lpThreadId,
                lpErrno);
        SetBlockingProvider(NULL);
        if (ret != SOCKET_ERROR)
        {
            SocketContext->BytesSent += *lpNumberOfBytesSent;
        }
    }

    UnlockSocketContext(SocketContext, lpErrno);

    return ret;
}

int WSPAPI WSPSetSockOpt | ( | SOCKET | s,
 |  | int | level,
 |  | int | optname,
 |  | const char FAR * | optval,
 |  | int | optlen,
 |  | LPINT | lpErrno
 | ) |  |

Definition at line 2515 of file spi.cpp.

{
    SOCK_INFO *SocketContext,
              *AcceptContext;
    INT        ret;

    SocketContext = FindAndLockSocketContext(s, lpErrno);
    if (SocketContext == NULL)
    {
        *lpErrno = WSAENOTSOCK;
        return SOCKET_ERROR;
    }

    if (optname == SO_UPDATE_ACCEPT_CONTEXT)
    {
        // We need to intercept this (and any other options) that pass
        //  a socket handle as an argument so we can replace it with the
        //  correct underlying provider's socket handle.
        //
        AcceptContext = FindAndLockSocketContext( *((SOCKET *)optval), lpErrno);
        if (AcceptContext == NULL)
        {
            dbgprint("WSPSetSockOpt: WPUQuerySocketHandleContext() failed: %d", *lpErrno);
            *lpErrno = WSAENOTSOCK;
            UnlockSocketContext(SocketContext, lpErrno);
            return SOCKET_ERROR;
        }

        SetBlockingProvider(SocketContext->Provider);
        ret = SocketContext->Provider->NextProcTable.lpWSPSetSockOpt(
                    SocketContext->ProviderSocket,
                    level,
                    optname,
                    (char *)&AcceptContext->ProviderSocket,
                    optlen,
                    lpErrno);
        SetBlockingProvider(NULL);

        UnlockSocketContext(AcceptContext, lpErrno);

    }
    else
    {
        SetBlockingProvider(SocketContext->Provider);
        ret = SocketContext->Provider->NextProcTable.lpWSPSetSockOpt(
                    SocketContext->ProviderSocket,
                    level,
                    optname,
                    optval,
                    optlen,
                    lpErrno);
        SetBlockingProvider(NULL);
    }

    UnlockSocketContext(SocketContext, lpErrno);

    return ret;
}

int WSPAPI WSPShutdown | ( | SOCKET | s,
 |  | int | how,
 |  | LPINT | lpErrno
 | ) |  |

Definition at line 2587 of file spi.cpp.

{
    SOCK_INFO *SocketContext;
    INT        ret;

    SocketContext = FindAndLockSocketContext(s, lpErrno);
    if (SocketContext == NULL)
    {
        dbgprint("WSPShutdown: WPUQuerySocketHandleContext() failed: %d", *lpErrno);
        *lpErrno = WSAENOTSOCK;
        return SOCKET_ERROR;
    }

    SetBlockingProvider(SocketContext->Provider);
    ret = SocketContext->Provider->NextProcTable.lpWSPShutdown(
                SocketContext->ProviderSocket,
                how,
                lpErrno);
    SetBlockingProvider(NULL);

    UnlockSocketContext(SocketContext, lpErrno);

    return ret;
}

SOCKET WSPAPI WSPSocket | ( | int | af,
 |  | int | type,
 |  | int | protocol,
 |  | LPWSAPROTOCOL_INFOW | lpProtocolInfo,
 |  | GROUP | g,
 |  | DWORD | dwFlags,
 |  | LPINT | lpErrno
 | ) |  |

Definition at line 2693 of file spi.cpp.

{
    SOCKET              NextProviderSocket = INVALID_SOCKET;
    SOCKET              NewSocket = INVALID_SOCKET;
    SOCK_INFO          *SocketContext;
    WSAPROTOCOL_INFOW  *pInfo=NULL, InfoCopy;
    PROVIDER           *Provider=NULL;
    BOOL                bAddressFamilyOkay=FALSE,
                        bSockTypeOkay=FALSE,
                        bProtocolOkay=FALSE;
    INT                 iAddressFamily,
                        iSockType,
                        iProtocol,
                        i;
    static int entrycount=0;

    entrycount++;

    *lpErrno = NO_ERROR;
    //
    // If a WSAPROTOCOL_INFO structure was passed in, use those socket/protocol
    //  values. Then find the underlying provider's WSAPROTOCOL_INFO structure.
    //
    iAddressFamily = (lpProtocolInfo ? lpProtocolInfo->iAddressFamily : af);
    iProtocol      = (lpProtocolInfo ? lpProtocolInfo->iProtocol   : protocol);
    iSockType      = (lpProtocolInfo ? lpProtocolInfo->iSocketType : type);

    #ifdef DEBUG
    if (lpProtocolInfo)
        dbgprint("WSPSocket: [entry %d] Provider: '%S'", entrycount, lpProtocolInfo->szProtocol);
    else
        dbgprint("WSPSocket: [entry %d] Provider: NULL", entrycount);
    #endif

    for(i=0; i < gLayerCount ;i++)
    {
        if ((iAddressFamily == AF_UNSPEC) ||
            (iAddressFamily == gBaseInfo[i].NextProvider.iAddressFamily))
        {
            bAddressFamilyOkay = TRUE;
        }
        if (iSockType == gBaseInfo[i].NextProvider.iSocketType)
        {
            bSockTypeOkay = TRUE;
        }
        if ((iProtocol == 0) || (iProtocol == gBaseInfo[i].NextProvider.iProtocol) ||
            (iProtocol == IPPROTO_RAW) || (iSockType == SOCK_RAW))
        {
            bProtocolOkay = TRUE;
        }
    }
    if (!bAddressFamilyOkay)
    {
        *lpErrno = WSAEAFNOSUPPORT;
        return INVALID_SOCKET;
    }
    if (!bSockTypeOkay)
    {
        *lpErrno = WSAESOCKTNOSUPPORT;
        return INVALID_SOCKET;
    }
    if (!bProtocolOkay)
    {
        *lpErrno = WSAEPROTONOSUPPORT;
        return INVALID_SOCKET;
    }
    // If AF_UNSPEC was passed in we need to go by the socket type and protocol
    //  if possible.
    //
    if ((iAddressFamily == AF_UNSPEC) && (iProtocol == 0))
    {
        for(i=0; i < gLayerCount ;i++)
        {
            if (gBaseInfo[i].NextProvider.iSocketType == iSockType)
            {
                if (lpProtocolInfo)
                {
                    // In case of multiple providers check the provider flags
                    if ( (gBaseInfo[i].NextProvider.dwServiceFlags1 & ~XP1_IFS_HANDLES) !=
                         (lpProtocolInfo->dwServiceFlags1 & ~XP1_IFS_HANDLES) )
                    {
                        continue;
                    }
                }
                Provider = &gBaseInfo[i];
                pInfo = &gBaseInfo[i].NextProvider;
                if (lpProtocolInfo)
                    pInfo->dwProviderReserved = lpProtocolInfo->dwProviderReserved;
                break;
            }
        }
    }
    else if ((iAddressFamily == AF_UNSPEC) && (iProtocol != 0))
    {
        for(i=0; i < gLayerCount ;i++)
        {
            if ((gBaseInfo[i].NextProvider.iProtocol == iProtocol) &&
                (gBaseInfo[i].NextProvider.iSocketType == iSockType) )
            {
                if (lpProtocolInfo)
                {
                    // In case of multiple providers check the provider flags
                    if ( (gBaseInfo[i].NextProvider.dwServiceFlags1 & ~XP1_IFS_HANDLES) !=
                         (lpProtocolInfo->dwServiceFlags1 & ~XP1_IFS_HANDLES) )
                    {
                        continue;
                    }
                }
                Provider = &gBaseInfo[i];
                pInfo = &gBaseInfo[i].NextProvider;
                if (lpProtocolInfo)
                    pInfo->dwProviderReserved = lpProtocolInfo->dwProviderReserved;
                break;
            }
        }
        if (pInfo == NULL)
        {
            *lpErrno = WSAEPROTOTYPE;
            return INVALID_SOCKET;
        }
    }
    else if ((iProtocol != 0) && (iProtocol != IPPROTO_RAW) && (iSockType != SOCK_RAW))
    {
        for(i=0; i < gLayerCount ;i++)
        {
            if ((gBaseInfo[i].NextProvider.iAddressFamily == iAddressFamily) &&
                (gBaseInfo[i].NextProvider.iSocketType == iSockType) &&
                (gBaseInfo[i].NextProvider.iProtocol == iProtocol))
            {
                if (lpProtocolInfo)
                {
                    // In case of multiple providers check the provider flags
                    if ( (gBaseInfo[i].NextProvider.dwServiceFlags1 & ~XP1_IFS_HANDLES) !=
                         (lpProtocolInfo->dwServiceFlags1 & ~XP1_IFS_HANDLES) )
                    {
                        continue;
                    }
                }
                Provider = &gBaseInfo[i];
                pInfo = &gBaseInfo[i].NextProvider;
                if (lpProtocolInfo)
                    pInfo->dwProviderReserved = lpProtocolInfo->dwProviderReserved;
                break;
            }
        }
    }
    else
    {
        for(i=0; i < gLayerCount ;i++)
        {
            if ((gBaseInfo[i].NextProvider.iAddressFamily == iAddressFamily) &&
                (gBaseInfo[i].NextProvider.iSocketType == iSockType) )
            {
                if (lpProtocolInfo)
                {
                    // In case of multiple providers check the provider flags
                    if ( (gBaseInfo[i].NextProvider.dwServiceFlags1 & ~XP1_IFS_HANDLES) !=
                         (lpProtocolInfo->dwServiceFlags1 & ~XP1_IFS_HANDLES) )
                    {
                        continue;
                    }
                }
                Provider = &gBaseInfo[i];
                pInfo = &gBaseInfo[i].NextProvider;
                if (lpProtocolInfo)
                    pInfo->dwProviderReserved = lpProtocolInfo->dwProviderReserved;
                break;
            }
        }
    }
    if (!Provider)
    {
        *lpErrno = WSAEAFNOSUPPORT;
        return INVALID_SOCKET;
    }

    if (pInfo->ProtocolChain.ChainLen != BASE_PROTOCOL)
    {
        pInfo = lpProtocolInfo;
    }

    memcpy(&InfoCopy, pInfo, sizeof(InfoCopy));

    if (lpProtocolInfo)
        InfoCopy.dwProviderReserved = lpProtocolInfo->dwProviderReserved;

    //
    // Create the underlying provider's socket.
    //

    #ifdef DEBUGSPEW
    dbgprint("Calling the lower provider WSPSocket: '%S'", Provider->NextProvider.szProtocol);
    #endif

    SetBlockingProvider(Provider);
    NextProviderSocket = Provider->NextProcTable.lpWSPSocket(
                            af,
                            type,
                            protocol,
                            &InfoCopy, //pInfo,
                            g,
                            dwFlags,
                            lpErrno);
    SetBlockingProvider(NULL);

    if (NextProviderSocket != INVALID_SOCKET)
    {
        // Create the context information to be associated with this socket
        //
        if ((SocketContext = CreateSockInfo(Provider,
                                            NextProviderSocket,
                                            NULL)) == NULL)
        {
            *lpErrno = WSAENOBUFS;
        }
        else
        {
            // Create a socket handle to pass back to app
            //
            NewSocket = MainUpCallTable.lpWPUCreateSocketHandle(
                        Provider->LayeredProvider.ProtocolChain.ChainEntries[0],
                        (DWORD_PTR) SocketContext,
                        lpErrno);
            if (NewSocket == INVALID_SOCKET)
            {
                dbgprint("WSPSocket: WPUCreateSocketHandle() failed: %d", *lpErrno);

                Provider->NextProcTable.lpWSPCloseSocket(NextProviderSocket, lpErrno);

                // Need to remove socket from list as it was already inserted above
                RemoveSocketInfo(Provider, SocketContext);
                FreeSockInfo(SocketContext);

                return INVALID_SOCKET;
            }

            #ifdef DEBUG
            dbgprint("Lower provider socket = 0x%x  LSP Socket = 0x%x\n", NextProviderSocket, NewSocket);
            #endif

            SocketContext->LayeredSocket = NewSocket;

            pInfo->dwProviderReserved = 0;
        }

        return NewSocket;
    }
    else
    {
        dbgprint("WSPSocket: NextProcTable.WSPSocket() failed: %d", *lpErrno);
    }

    return INVALID_SOCKET;
}

int WSPAPI WSPStartup | ( | WORD | wVersion,
 |  | LPWSPDATA | lpWSPData,
 |  | LPWSAPROTOCOL_INFOW | lpProtocolInfo,
 |  | WSPUPCALLTABLE | UpCallTable,
 |  | LPWSPPROC_TABLE | lpProcTable
 | ) |  |

Definition at line 2982 of file spi.cpp.

{
    LPWSAPROTOCOL_INFOW ProtocolInfo,
                        pInfo;
    UINT                iBaseId;
    INT                 ret = NO_ERROR,
                        TotalProtocols,
                        Error,
                        idx,
                        i, x, z;

    EnterCriticalSection(&gCriticalSection);

    MainUpCallTable = UpCallTable;

    ret = NO_ERROR;

    ProtocolInfo = pInfo = NULL;

    //
    // Load Next Provider in chain if this is the first time called
    //
    if (gEntryCount == 0)
    {

        // Create an event which is signaled when a socket context is added
        gAddContextEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
        if (gAddContextEvent == NULL)
        {
            dbgprint("WSPStartup: CreateEvent failed: %d", GetLastError());
            ret = WSAENOBUFS;
            goto cleanup;
        }

        //
        // Remap service provider functions here
        //
        gProcTable.lpWSPAccept = WSPAccept;
        gProcTable.lpWSPAddressToString = WSPAddressToString;
        gProcTable.lpWSPAsyncSelect = WSPAsyncSelect;
        gProcTable.lpWSPBind = WSPBind;
        gProcTable.lpWSPCancelBlockingCall = WSPCancelBlockingCall;
        gProcTable.lpWSPCleanup = WSPCleanup;
        gProcTable.lpWSPCloseSocket = WSPCloseSocket;
        gProcTable.lpWSPConnect = WSPConnect;
        gProcTable.lpWSPDuplicateSocket = WSPDuplicateSocket;
        gProcTable.lpWSPEnumNetworkEvents = WSPEnumNetworkEvents;
        gProcTable.lpWSPEventSelect = WSPEventSelect;
        gProcTable.lpWSPGetOverlappedResult = WSPGetOverlappedResult;
        gProcTable.lpWSPGetPeerName = WSPGetPeerName;
        gProcTable.lpWSPGetSockOpt = WSPGetSockOpt;
        gProcTable.lpWSPGetSockName = WSPGetSockName;
        gProcTable.lpWSPGetQOSByName = WSPGetQOSByName;
        gProcTable.lpWSPIoctl = WSPIoctl;
        gProcTable.lpWSPJoinLeaf = WSPJoinLeaf;
        gProcTable.lpWSPListen = WSPListen;
        gProcTable.lpWSPRecv = WSPRecv;
        gProcTable.lpWSPRecvDisconnect = WSPRecvDisconnect;
        gProcTable.lpWSPRecvFrom = WSPRecvFrom;
        gProcTable.lpWSPSelect = WSPSelect;
        gProcTable.lpWSPSend = WSPSend;
        gProcTable.lpWSPSendDisconnect = WSPSendDisconnect;
        gProcTable.lpWSPSendTo = WSPSendTo;
        gProcTable.lpWSPSetSockOpt = WSPSetSockOpt;
        gProcTable.lpWSPShutdown = WSPShutdown;
        gProcTable.lpWSPSocket = WSPSocket;
        gProcTable.lpWSPStringToAddress = WSPStringToAddress;
        //
        // Save off the WSP data structures for use later
        //
        memset(&gWSPData, 0, sizeof(WSPDATA));
        gWSPData.wVersion = 0x202;
        gWSPData.wHighVersion = 0x202;

        //
        // Create our private heap
        //
        hLspHeap = HeapCreate(0, 128000, 0);
        if (hLspHeap == NULL)
        {
            dbgprint("WSPStartup: HeapCreate() failed: %d", GetLastError());
            ret = WSAEPROVIDERFAILEDINIT;
            goto cleanup;
        }

        //
        //  Get all protocol information in database
        //
        if ((ProtocolInfo = EnumerateProviders(LspCatalogBoth, &TotalProtocols)) == NULL)
        {
            dbgprint("GetProviders failed");
            ret = WSAEPROVIDERFAILEDINIT;
            goto cleanup;
        }
        // Find out what our layered protocol catalog ID entry is
        //
        for (i = 0; i < TotalProtocols; i++)
        {
            if (memcmp (&ProtocolInfo[i].ProviderId, &ProviderGuid, sizeof (GUID))==0)
            {
                gLayerCatId = ProtocolInfo[i].dwCatalogEntryId;
                break;
            }
        }
        //
        // Find out how many protocol entries we're layered over
        //
        gLayerCount=0;
        for(x=0; x < TotalProtocols ;x++)
        {
            if ((ProtocolInfo[x].ProtocolChain.ChainLen > 1) &&
                (gLayerCatId == ProtocolInfo[x].ProtocolChain.ChainEntries[0]))
            {
                gLayerCount++;
            }
        }

        #ifdef DEBUG
        dbgprint("Layered over %d protocols", gLayerCount);
        #endif

        //
        // Allocate some space to save off the WSAPROTOCOL_INFO structures of the
        //  underlying providers. We'll need these throughout execution.
        //
        gBaseInfo = (LPPROVIDER)HeapAlloc(hLspHeap,
                                          HEAP_ZERO_MEMORY,
                                          sizeof(PROVIDER)*gLayerCount);
        if (!gBaseInfo)
        {
            dbgprint("WSPStartup: HeapAlloc() failed on gBaseInfo: %d", GetLastError());
            ret = WSAENOBUFS;
            goto cleanup;
        }
        for(i=0; i < gLayerCount ;i++)
        {
            InitializeCriticalSection(&gBaseInfo[i].ProviderCritSec);
        }
        //
        // Now copy the WSAPROTOCOL_INFO structures into our storage space
        //
        idx=0;
        for(x=0; x < TotalProtocols ;x++)
        {
            if ( (ProtocolInfo[x].ProtocolChain.ChainLen > 1) &&
                 (gLayerCatId == ProtocolInfo[x].ProtocolChain.ChainEntries[0]))
            {
                memcpy(&gBaseInfo[idx].LayeredProvider,
                       &ProtocolInfo[x],
                       sizeof(WSAPROTOCOL_INFOW));

                #ifdef DEBUG
                dbgprint("Layer is %S", gBaseInfo[idx].LayeredProvider.szProtocol);
                #endif

                //
                // Our LSP exists in this entries chain so grab the entry
                //  after ours (i.e. the next provider in the chain)
                //
                iBaseId = ProtocolInfo[x].ProtocolChain.ChainEntries[1];
                for(z=0; z < TotalProtocols ;z++)
                {
                    if (ProtocolInfo[z].dwCatalogEntryId == iBaseId)
                    {

                        if (ProtocolInfo[z].ProtocolChain.ChainLen == LAYERED_PROTOCOL)
                        {
                            BOOL bFound = FALSE;

                            // Slight problem, the chain indicates an LSP's dummy
                            // entry and not a layered entry belonging to that LSP.
                            // See if we can find an appropriate provider entry
                            for(i=0; i < TotalProtocols ;i++)
                            {
                                if ((ProtocolInfo[i].ProtocolChain.ChainEntries[0] == iBaseId) &&
                                    (ProtocolInfo[i].iAddressFamily == ProtocolInfo[x].iAddressFamily) &&
                                    (ProtocolInfo[i].iSocketType == ProtocolInfo[x].iSocketType) &&
                                    (ProtocolInfo[i].iProtocol == ProtocolInfo[x].iProtocol)
                                    )
                                {
                                    bFound = TRUE;
                                    memcpy(&gBaseInfo[idx++].NextProvider,
                                           &ProtocolInfo[i],
                                            sizeof(WSAPROTOCOL_INFOW));
                                }
                            }

                            if (bFound == FALSE)
                            {
                                // Didn't find it so just use the dummy and hope for
                                // the best...
                                memcpy(&gBaseInfo[idx++].NextProvider,
                                       &ProtocolInfo[z],
                                        sizeof(WSAPROTOCOL_INFOW));
                            }
                        }
                        else
                        {
                            memcpy(&gBaseInfo[idx++].NextProvider,
                                   &ProtocolInfo[z],
                                    sizeof(WSAPROTOCOL_INFOW));
                        }
                        break;
                    }
                }
            }
        }
        for(x=0; x < gLayerCount ;x++)
        {
            gBaseInfo[x].ProviderPathLen = MAX_PATH-1;
            if (WSCGetProviderPath(&gBaseInfo[x].NextProvider.ProviderId,
                                    gBaseInfo[x].ProviderPathW,
                                   &gBaseInfo[x].ProviderPathLen,
                                   &Error) == SOCKET_ERROR)
            {
                dbgprint("WSPStartup: WSCGetProviderPath failed: %d", Error);
                ret = WSAEPROVIDERFAILEDINIT;
                goto cleanup;
            }

            if (ExpandEnvironmentStringsW(gBaseInfo[x].ProviderPathW,
                                          gBaseInfo[x].LibraryPathW,
                                          MAX_PATH-1))
            {
                if ((gBaseInfo[x].hProvider = LoadLibraryW(gBaseInfo[x].LibraryPathW)) == NULL)
                {
                    dbgprint("WSPStartup: LoadLibraryW failed: %d", GetLastError());
                    ret = WSAEPROVIDERFAILEDINIT;
                    goto cleanup;
                }

                #ifdef DEBUG
                dbgprint("LoadLibrary on: %S", gBaseInfo[x].LibraryPathW);
                #endif
            }
            else
            {
                // We must be on Win9x
                //
                if (WideCharToMultiByte(
                    CP_ACP,
                    0,
                    gBaseInfo[x].ProviderPathW,
                    gBaseInfo[x].ProviderPathLen,
                    gBaseInfo[x].ProviderPathA,
                    gBaseInfo[x].ProviderPathLen,
                    NULL,
                    NULL) != 0)
                {
                    // Expand any environment variables within the ANSI string if needed
                    if (ExpandEnvironmentStringsA(gBaseInfo[x].ProviderPathA,
                                                   gBaseInfo[x].LibraryPathA,
                                                   MAX_PATH-1))
                    {
                        if ((gBaseInfo[x].hProvider = LoadLibraryA(gBaseInfo[x].ProviderPathA)) == NULL)
                        {
                            dbgprint("LoadLibrary failed: %d", GetLastError());
                            ret = WSAEPROVIDERFAILEDINIT;
                            goto cleanup;
                        }
                    }
                    else
                    {
                        dbgprint("ExpandEnvironmentStrings failed: %d", GetLastError());
                        ret = WSAEPROVIDERFAILEDINIT;
                        goto cleanup;
                    }
                }
                else
                {
                    dbgprint("WideCharToMultiByte failed: %d", GetLastError());
                    ret = WSAEPROVIDERFAILEDINIT;
                    goto cleanup;
                }
            }
            //
            // Call the WSPStartup function on the lower provider's DLL
            //
            if ((gBaseInfo[x].lpWSPStartup = (LPWSPSTARTUP)
                GetProcAddress(gBaseInfo[x].hProvider, "WSPStartup")) == NULL)
            {
                dbgprint("GetProcAddress failed!");
                ret = WSAEPROVIDERFAILEDINIT;
                goto cleanup;
            }
            pInfo = lpProtocolInfo;
            if (gBaseInfo[x].NextProvider.ProtocolChain.ChainLen == BASE_PROTOCOL)
            {
                pInfo = &gBaseInfo[x].NextProvider;
            }

            ret = gBaseInfo[x].lpWSPStartup(wVersion,
                                            lpWSPData,
                                            pInfo,
                                            UpCallTable,
                                            &gBaseInfo[x].NextProcTable);
            if (ret != 0)
            {
                dbgprint("%s->WSPStartup() failed: %d", gBaseInfo[x].NextProvider.szProtocol, ret);
                ret =  WSAEPROVIDERFAILEDINIT;
                goto cleanup;
            }
            else
            {
                ret = NO_ERROR;
            }
            #ifdef DEBUG
            dbgprint("NextProcTable.WSPStartup = 0x%X [%S]", gBaseInfo[x].lpWSPStartup, gBaseInfo[x].NextProvider.szProtocol);
            #endif

            if (VerifyProcTable(&gBaseInfo[x].NextProcTable) == SOCKET_ERROR)
            {
                dbgprint("Provider '%S' returned bad proc table!", &gBaseInfo[x].NextProvider.szProtocol);
                ret = WSAEPROVIDERFAILEDINIT;
                goto cleanup;
            }
        }
        InitOverlappedManager();

        FreeProviders(ProtocolInfo);
        ProtocolInfo = NULL;

        //
        // Keep track of how many times we've been loaded
        //
        gEntryCount++;
    }
    else
    {
        //
        // Keep track of how many times we've been loaded
        //
        gEntryCount++;
    }
    //
    // Copy the LSP's proc table to the caller's data structures
    //
    memcpy(lpWSPData, &gWSPData, sizeof(WSPDATA));
    memcpy(lpProcTable, &gProcTable, sizeof(WSPPROC_TABLE));

    #ifdef DEBUG
    dbgprint("WSPStartup: %d", gEntryCount);
    #endif

cleanup:

    if (ProtocolInfo)
        FreeProviders(ProtocolInfo);

    if (ret != NO_ERROR)
    {
        // Had errors during initialization and gEntryCount is still zero so
        // cleanup the internal structures
        FreeSocketsAndMemory(&Error);
    }

    LeaveCriticalSection(&gCriticalSection);

    return ret;
}

int WSPAPI WSPStringToAddress | ( | LPWSTR | AddressString,
 |  | INT | AddressFamily,
 |  | LPWSAPROTOCOL_INFOW | lpProtocolInfo,
 |  | LPSOCKADDR | lpAddress,
 |  | LPINT | lpAddressLength,
 |  | LPINT | lpErrno
 | ) |  |

Definition at line 2623 of file spi.cpp.

{
    WSAPROTOCOL_INFOW   *pInfo=NULL;
    PROVIDER            *Provider=NULL;
    INT                  i, ret;

    for(i=0; i < gLayerCount ;i++)
    {
        if ((gBaseInfo[i].NextProvider.iAddressFamily == lpProtocolInfo->iAddressFamily) &&
            (gBaseInfo[i].NextProvider.iSocketType == lpProtocolInfo->iSocketType) &&
            (gBaseInfo[i].NextProvider.iProtocol   == lpProtocolInfo->iProtocol))
        {
            if (lpProtocolInfo)
            {
                // In case of multiple providers check the provider flags
                if ( (gBaseInfo[i].NextProvider.dwServiceFlags1 & ~XP1_IFS_HANDLES) !=
                     (lpProtocolInfo->dwServiceFlags1 & ~XP1_IFS_HANDLES) )
                {
                    continue;
                }
            }
            Provider = &gBaseInfo[i];
            pInfo = &gBaseInfo[i].NextProvider;
            break;
        }
    }
    if (Provider == NULL)
    {
        *lpErrno = WSAEINVAL;
        return SOCKET_ERROR;
    }
    // If we're not immediately above the base then pass the lpProtocolInfo passed
    // into us.
    //
    if (pInfo->ProtocolChain.ChainLen != BASE_PROTOCOL)
    {
        pInfo = lpProtocolInfo;
    }

    SetBlockingProvider(Provider);
    ret = Provider->NextProcTable.lpWSPStringToAddress(
                AddressString,
                AddressFamily,
                pInfo,
                lpAddress,
                lpAddressLength,
                lpErrno);
    SetBlockingProvider(NULL);

    return ret;
}

Variable Documentation

HANDLE gAddContextEvent = NULL

Definition at line 43 of file spi.cpp.

LPPROVIDER gBaseInfo = NULL

Definition at line 39 of file spi.cpp.

CRITICAL_SECTION gCriticalSection

Definition at line 33 of file spi.cpp.

CRITICAL_SECTION gDebugCritSec

Definition at line 33 of file spi.cpp.

HANDLE ghIocp

Definition at line 48 of file overlap.cpp.

INT gLayerCount = 0

Definition at line 40 of file spi.cpp.

CRITICAL_SECTION gOverlappedCS

Definition at line 33 of file spi.cpp.

HINSTANCE hDllInstance = NULL

Definition at line 37 of file spi.cpp.

HANDLE hLspHeap = NULL

Definition at line 42 of file spi.cpp.

WSPUPCALLTABLE MainUpCallTable

Definition at line 36 of file spi.cpp.

Generated on Wed Nov 13 2024 16:54:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/McastIP/Mcastws1.c File Reference

  • NetDS
  • WinSock
  • McastIP
Defines | Functions | Variables

Mcastws1.c File Reference

#include <winsock2.h>
#include <ws2tcpip.h>
#include <stdio.h>
#include <stdlib.h>
#include <wspiapi.h>
#include "resolve.h"

Go to the source code of this file.

Defines

#define | BUFSIZE 1024
#define | DEFAULT_COUNT 500
#define | DEFAULT_TTL 8
#define | MCASTADDRV4 "234.5.6.7"
#define | MCASTADDRV6 "ff12::1"
#define | MCASTPORT "25000"

Functions

int | JoinMulticastGroup (SOCKET s, struct addrinfo *group, struct addrinfo *iface)
int __cdecl | main (int argc, char **argv)
int | SetMulticastLoopBack (SOCKET s, int af, int loopval)
int | SetMulticastTtl (SOCKET s, int af, int ttl)
int | SetSendInterface (SOCKET s, struct addrinfo *iface)
void | usage (char *progname)
void | ValidateArgs (int argc, char **argv)

Variables

BOOL | bConnect = FALSE
BOOL | bDontJoin = FALSE
BOOL | bLoopBack = FALSE
BOOL | bReuseAddr = FALSE
BOOL | bSender = FALSE
char * | gBindAddr = NULL
int | gBufferSize = BUFSIZE
int | gCount = DEFAULT_COUNT
char * | gInterface = NULL
int | gLoopBack = 0
char * | gMulticast = MCASTADDRV4
char * | gPort = MCASTPORT
int | gProtocol = IPPROTO_UDP
int | gSocketType = SOCK_DGRAM
int | gTtl = DEFAULT_TTL

Define Documentation

#define BUFSIZE 1024

Definition at line 63 of file Mcastws1.c.

#define DEFAULT_COUNT 500

Definition at line 64 of file Mcastws1.c.

#define DEFAULT_TTL 8

Definition at line 65 of file Mcastws1.c.

#define MCASTADDRV4 "234.5.6.7"

Definition at line 60 of file Mcastws1.c.

#define MCASTADDRV6 "ff12::1"

Definition at line 61 of file Mcastws1.c.

#define MCASTPORT "25000"

Definition at line 62 of file Mcastws1.c.

Function Documentation

int JoinMulticastGroup | ( | SOCKET | s,
 |  | struct addrinfo * | group,
 |  | struct addrinfo * | iface
 | ) |  |

Definition at line 203 of file Mcastws1.c.

{
    struct ip_mreq   mreqv4;
    struct ipv6_mreq mreqv6;
    char            *optval=NULL;
    int              optlevel,
                     option,
                     optlen,
                     rc;

    rc = NO_ERROR;
    if (group->ai_family == AF_INET)
    {
        // Setup the v4 option values and ip_mreq structure
        optlevel = IPPROTO_IP;
        option   = IP_ADD_MEMBERSHIP;
        optval   = (char *)& mreqv4;
        optlen   = sizeof(mreqv4);

        mreqv4.imr_multiaddr.s_addr = ((SOCKADDR_IN *)group->ai_addr)->sin_addr.s_addr;
        mreqv4.imr_interface.s_addr = ((SOCKADDR_IN *)iface->ai_addr)->sin_addr.s_addr;

    }
    else if (group->ai_family == AF_INET6)
    {
        // Setup the v6 option values and ipv6_mreq structure
        optlevel = IPPROTO_IPV6;
        option   = IPV6_ADD_MEMBERSHIP;
        optval   = (char *) &mreqv6;
        optlen   = sizeof(mreqv6);

        mreqv6.ipv6mr_multiaddr = ((SOCKADDR_IN6 *)group->ai_addr)->sin6_addr;
        mreqv6.ipv6mr_interface = ((SOCKADDR_IN6 *)iface->ai_addr)->sin6_scope_id;
    }
    else
    {
        fprintf(stderr, "Attemtping to join multicast group for invalid address family!\n");
        rc = SOCKET_ERROR;
    }
    if (rc != SOCKET_ERROR)
    {
        // Join the group
        rc = setsockopt(
                s,
                optlevel,
                option,
                optval,
                optlen
                );
        if (rc == SOCKET_ERROR)
        {
            fprintf(stderr, "JoinMulticastGroup: setsockopt failed: %d\n", WSAGetLastError());
        }
        else
        {
            printf("Joined group: ");
            PrintAddress(group->ai_addr, group->ai_addrlen);
            printf("\n");
        }
    }
    return rc;
}

int __cdecl main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 460 of file Mcastws1.c.

{
    WSADATA             wsd;
    SOCKET              s=INVALID_SOCKET;
    struct addrinfo    *resmulti=NULL,
                       *resbind=NULL,
                       *resif=NULL;
    char               *buf=NULL;
    int                 rc,
                        i=0;

    // Parse the command line
    ValidateArgs(argc, argv);

    // Load Winsock
    if ((rc = WSAStartup(MAKEWORD(1, 1), &wsd)) != 0)
    {
        fprintf(stderr, "WSAStartup failed: %d\n", rc);
        return -1;
    }

    // Resolve the multicast address
    resmulti = ResolveAddress(gMulticast, gPort, AF_UNSPEC, SOCK_DGRAM, gProtocol);
    if (resmulti == NULL)
    {
        fprintf(stderr, "Unable to convert multicast address '%s': %d\n",
                gMulticast, WSAGetLastError());
        goto cleanup;
    }

    // Resolve the binding address
    resbind = ResolveAddress(gBindAddr, (bSender ? "0" : gPort), resmulti->ai_family, resmulti->ai_socktype, resmulti->ai_protocol);
    if (resbind == NULL)
    {
        fprintf(stderr, "Unable to convert bind address '%s': %d\n",
                gBindAddr, WSAGetLastError());
        goto cleanup;
    }

    // Resolve the multicast interface
    resif   = ResolveAddress(gInterface, "0", resmulti->ai_family, resmulti->ai_socktype, resmulti->ai_protocol);
    if (resif == NULL)
    {
        fprintf(stderr, "Unable to convert interface address '%s': %d\n",
                gInterface, WSAGetLastError());
        goto cleanup;
    }
    //
    // Create the socket. In Winsock 1 you don't need any special
    // flags to indicate multicasting.
    //
    s = socket(resmulti->ai_family, resmulti->ai_socktype, resmulti->ai_protocol);
    if (s == INVALID_SOCKET)
    {
        fprintf(stderr, "socket failed with: %d\n", WSAGetLastError());
        goto cleanup;
    }

    if (bReuseAddr)
    {
        int     optval;

        optval = 1;
        rc = setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&optval, sizeof(optval));
        if (rc == SOCKET_ERROR)
        {
            fprintf(stderr, "setsockopt(SO_REUSEADDR) failed: %d\n", WSAGetLastError());
            goto cleanup;
        }
    }

    //
    // Bind the socket to the local interface. This is done so we
    // can receive data
    //
    rc = bind(s, resbind->ai_addr, resbind->ai_addrlen);
    if (rc == SOCKET_ERROR)
    {
        fprintf(stderr, "bind failed: %d\n", WSAGetLastError());
        goto cleanup;
    }
    printf("Binding to ");
    PrintAddress(resbind->ai_addr, resbind->ai_addrlen);
    printf("\n");

    // Join the multicast group if specified
    if (bDontJoin == FALSE)
    {
        rc = JoinMulticastGroup(s, resmulti, resif);
        if (rc == SOCKET_ERROR)
        {
            fprintf(stderr, "Unable to join multicast group!\n");
            goto cleanup;
        }
    }

    // Set the send (outgoing) interface
    rc = SetSendInterface(s, resif);
    if (rc == SOCKET_ERROR)
    {
        fprintf(stderr, "Unable to set multicast send interface\n");
        goto cleanup;
    }

    // Set the TTL to something else. The default TTL is one.
    rc = SetMulticastTtl(s, resmulti->ai_family, gTtl);
    if (rc == SOCKET_ERROR)
    {
        fprintf(stderr, "Unable to set multicast TTL\n");
        goto cleanup;
    }

    // Disable the loopback if selected. Note that on NT4 and Win95
    // you cannot disable it.
    if (bLoopBack)
    {
        rc = SetMulticastLoopBack(s, resmulti->ai_family, gLoopBack);
        if (rc == SOCKET_ERROR)
        {
            fprintf(stderr, "Unable to set multicast loopback flag\n");
            goto cleanup;
        }
    }

    //
    // When using sendto on an IPv6 multicast socket, the scope id needs
    // to be zero.
    //
    if ((bSender) && (resmulti->ai_family == AF_INET6))
        ((SOCKADDR_IN6 *)resmulti->ai_addr)->sin6_scope_id = 0;

    if (bConnect)
    {
        rc = connect(s, resmulti->ai_addr, resmulti->ai_addrlen);
        if (rc == SOCKET_ERROR)
        {
            fprintf(stderr, "connect failed: %d\n", WSAGetLastError());
            goto cleanup;
        }
    }

    buf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, gBufferSize);
    if (buf == NULL)
    {
        fprintf(stderr, "HeapAlloc failed: %d\n", GetLastError());
        goto cleanup;
    }

    if (!bSender)           // receiver
    {
        SOCKADDR_STORAGE safrom;
        int              fromlen;

        // Receive the specified number of messages
        for(i=0; i < gCount ;i++)
        {
            fromlen = sizeof(safrom);
            rc = recvfrom(
                    s,
                    buf,
                    gBufferSize,
                    0,
                   (SOCKADDR *)&safrom,
                   &fromlen
                   );
            if (rc == SOCKET_ERROR)
            {
                fprintf(stderr, "recvfrom failed with: %d\n", WSAGetLastError());
                break;
            }

            printf("read %d bytes from <", rc);
            PrintAddress((SOCKADDR *)&safrom, fromlen);
            printf(">\n");
        }
    }
    else                    // sender
    {
        memset(buf, '^', gBufferSize);

        // Send some data
        for(i=0; i < gCount ; i++)
        {
            rc = sendto(
                    s,
                    buf,
                    gBufferSize,
                    0,
                    resmulti->ai_addr,
                    resmulti->ai_addrlen
                    );
            if (rc == SOCKET_ERROR)
            {
                fprintf(stderr, "sendto failed with: %d\n", WSAGetLastError());
                break;
            }

            printf("SENT %d bytes to ", rc);
            PrintAddress(resmulti->ai_addr, resmulti->ai_addrlen);
            printf("\n");

            Sleep(500);
        }
    }

cleanup:
    //
    // Clean up allocations and sockets
    //
    if (buf)
        HeapFree(GetProcessHeap(), 0, buf);

    if (resmulti)
        freeaddrinfo(resmulti);
    if (resbind)
        freeaddrinfo(resbind);
    if (resif)
        freeaddrinfo(resif);

    if (s != INVALID_SOCKET)
        closesocket(s);

    WSACleanup();
    return 0;
}

int SetMulticastLoopBack | ( | SOCKET | s,
 |  | int | af,
 |  | int | loopval
 | ) |  |

Definition at line 398 of file Mcastws1.c.

{
    char *optval=NULL;
    int   optlevel,
          option,
          optlen,
          rc;

    rc = NO_ERROR;
    if (af == AF_INET)
    {
        // Set the v4 options
        optlevel = IPPROTO_IP;
        option   = IP_MULTICAST_LOOP;
        optval   = (char *) &loopval;
        optlen   = sizeof(loopval);
    }
    else if (af == AF_INET6)
    {
        // Set the v6 options
        optlevel = IPPROTO_IPV6;
        option   = IPV6_MULTICAST_LOOP;
        optval   = (char *) &loopval;
        optlen   = sizeof(loopval);
    }
    else
    {
        fprintf(stderr, "Attemtping to set multicast loopback for invalid address family!\n");
        rc = SOCKET_ERROR;
    }
    if (rc != SOCKET_ERROR)
    {
        // Set the multpoint loopback
        rc = setsockopt(
                s,
                optlevel,
                option,
                optval,
                optlen
                );
        if (rc == SOCKET_ERROR)
        {
            fprintf(stderr, "SetMulticastLoopBack: setsockopt failed: %d\n", WSAGetLastError());
        }
        else
        {
            printf("Setting multicast loopback to: %d\n", loopval);
        }
    }
    return rc;
}

int SetMulticastTtl | ( | SOCKET | s,
 |  | int | af,
 |  | int | ttl
 | ) |  |

Definition at line 336 of file Mcastws1.c.

{
    char *optval=NULL;
    int   optlevel,
          option,
          optlen,
          rc;

    rc = NO_ERROR;
    if (af == AF_INET)
    {
        // Set the options for V4
        optlevel = IPPROTO_IP;
        option   = IP_MULTICAST_TTL;
        optval   = (char *) &ttl;
        optlen   = sizeof(ttl);
    }
    else if (af == AF_INET6)
    {
        // Set the options for V6
        optlevel = IPPROTO_IPV6;
        option   = IPV6_MULTICAST_HOPS;
        optval   = (char *) &ttl;
        optlen   = sizeof(ttl);
    }
    else
    {
        fprintf(stderr, "Attemtping to set TTL for invalid address family!\n");
        rc = SOCKET_ERROR;
    }
    if (rc != SOCKET_ERROR)
    {
        // Set the TTL value
        rc = setsockopt(
                s,
                optlevel,
                option,
                optval,
                optlen
                );
        if (rc == SOCKET_ERROR)
        {
            fprintf(stderr, "SetMulticastTtl: setsockopt failed: %d\n", WSAGetLastError());
        }
        else
        {
            printf("Set multicast ttl to: %d\n", ttl);
        }
    }
    return rc;
}

int SetSendInterface | ( | SOCKET | s,
 |  | struct addrinfo * | iface
 | ) |  |

Definition at line 274 of file Mcastws1.c.

{
    char *optval=NULL;
    int   optlevel,
          option,
          optlen,
          rc;

    rc = NO_ERROR;
    if (iface->ai_family == AF_INET)
    {
        // Setup the v4 option values
        optlevel = IPPROTO_IP;
        option   = IP_MULTICAST_IF;
        optval   = (char *) &((SOCKADDR_IN *)iface->ai_addr)->sin_addr.s_addr;
        optlen   = sizeof(((SOCKADDR_IN *)iface->ai_addr)->sin_addr.s_addr);
    }
    else if (iface->ai_family == AF_INET6)
    {
        // Setup the v6 option values
        optlevel = IPPROTO_IPV6;
        option   = IPV6_MULTICAST_IF;
        optval   = (char *) &((SOCKADDR_IN6 *)iface->ai_addr)->sin6_scope_id;
        optlen   = sizeof(((SOCKADDR_IN6 *)iface->ai_addr)->sin6_scope_id);
    }
    else
    {
        fprintf(stderr, "Attemtping to set sent interface for invalid address family!\n");
        rc = SOCKET_ERROR;
    }

    // Set send IF
    if (rc != SOCKET_ERROR)
    {
        // Set the send interface
        rc = setsockopt(
                s,
                optlevel,
                option,
                optval,
                optlen
                       );
        if (rc == SOCKET_ERROR)
        {
            fprintf(stderr, "setsockopt failed: %d\n", WSAGetLastError());
        }
        else
        {
            printf("Set sending interface to: ");
            PrintAddress(iface->ai_addr, iface->ai_addrlen);
            printf("\n");
        }
    }
    return rc;
}

void usage ( char * progname )

Definition at line 89 of file Mcastws1.c.

{
    printf("usage: %s -s -m str -p int -i str -l -n int\n",
        progname);
    printf(" -b str String address to bind to\n");
    printf(" -c     Connect before sending?\n");
    printf(" -i str Local interface to join groups\n");
    printf(" -j     Don't join the multicast group\n");
    printf(" -l 0/1 Turn on/off loopback\n");
    printf(" -m str Multicast address string to join\n");
    printf(" -n int Number of messages to send/receive\n");
    printf(" -p int Port number to use\n");
    printf("          The default port is: %s\n", MCASTPORT);
    printf(" -r     Use raw sockets\n");
    printf(" -s     Act as server (send data); otherwise\n");
    printf("          receive data.\n");
    printf(" -t int Set multicast TTL\n");
    printf(" -u     Set SO_REUSEADDR\n");
    printf(" -z int Size of the send/recv buffer\n");
    ExitProcess(-1);
}

void ValidateArgs | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 118 of file Mcastws1.c.

{
    int      i;

    for(i=1; i < argc ;i++)
    {
        if ((argv[i][0] == '-') || (argv[i][0] == '/'))
        {
            switch (tolower(argv[i][1]))
            {
                case 'b':        // Address to bind to
                    if (i+1 >= argc)
                        usage(argv[0]);
                    gBindAddr = argv[++i];
                    break;
                case 'c':        // Connect socket
                    bConnect = TRUE;
                    break;
                case 'i':        // local interface to use
                    if (i+1 >= argc)
                        usage(argv[0]);
                    gInterface = argv[++i];
                    break;
                case 'j':       // Don't join multicast group
                    bDontJoin = TRUE;
                    break;
                case 'l':        // Disable loopback?
                    if (i+1 >= argc)
                        usage(argv[0]);
                    bLoopBack = TRUE;
                    gLoopBack = atoi(argv[++i]);
                    break;
                case 'm':        // multicast group to join
                    if (i+1 >= argc)
                        usage(argv[0]);
                    gMulticast = argv[++i];
                    break;
                case 'n':        // Number of messages to send/recv
                    if (i+1 >= argc)
                        usage(argv[0]);
                    gCount = atoi(argv[++i]);
                    break;
                case 'p':        // Port number to use
                    if (i+1 >= argc)
                        usage(argv[0]);
                    gPort = argv[++i];
                    break;
                case 'r':        // use raw sockets
                    gSocketType = SOCK_RAW;
                    break;
                case 's':        // sender
                    bSender = TRUE;
                    break;
                case 't':        // Multicast ttl
                    if (i+1 >= argc)
                        usage(argv[0]);
                    gTtl = atoi(argv[++i]);
                    break;
                case 'u':
                    bReuseAddr = TRUE;
                    break;
                case 'z':        // Buffer size for send/recv
                    if (i+1 >= argc)
                        usage(argv[0]);
                    gBufferSize = atol(argv[++i]);
                    break;
                default:
                    usage(argv[0]);
                    break;
            }
        }
    }
    return;
}

Variable Documentation

BOOL bConnect = FALSE

Definition at line 68 of file Mcastws1.c.

BOOL bDontJoin = FALSE

Definition at line 70 of file Mcastws1.c.

BOOL bLoopBack = FALSE

Definition at line 69 of file Mcastws1.c.

BOOL bReuseAddr = FALSE

Definition at line 71 of file Mcastws1.c.

BOOL bSender = FALSE

Definition at line 67 of file Mcastws1.c.

char* gBindAddr = NULL

Definition at line 78 of file Mcastws1.c.

int gBufferSize = BUFSIZE

Definition at line 77 of file Mcastws1.c.

int gCount = DEFAULT_COUNT

Definition at line 75 of file Mcastws1.c.

char * gInterface = NULL

Definition at line 79 of file Mcastws1.c.

int gLoopBack = 0

Definition at line 74 of file Mcastws1.c.

char * gMulticast = MCASTADDRV4

Definition at line 80 of file Mcastws1.c.

char * gPort = MCASTPORT

Definition at line 81 of file Mcastws1.c.

int gProtocol = IPPROTO_UDP

Definition at line 73 of file Mcastws1.c.

int gSocketType = SOCK_DGRAM

Definition at line 72 of file Mcastws1.c.

int gTtl = DEFAULT_TTL

Definition at line 76 of file Mcastws1.c.

Generated on Wed Nov 13 2024 16:54:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/McastIP/Mcastws2.c File Reference

  • NetDS
  • WinSock
  • McastIP
Defines | Functions | Variables

Mcastws2.c File Reference

#include <winsock2.h>
#include <ws2tcpip.h>
#include <stdio.h>
#include <stdlib.h>
#include <wspiapi.h>
#include "resolve.h"

Go to the source code of this file.

Defines

#define | BUFSIZE 1024
#define | DEFAULT_COUNT 500
#define | DEFAULT_TTL 8
#define | MCASTADDRV4 "234.5.6.7"
#define | MCASTADDRV6 "ff12::1"
#define | MCASTPORT "25000"

Functions

int __cdecl | main (int argc, char **argv)
int | SetMulticastLoopBack (SOCKET s, int af, int loopval)
int | SetMulticastTtl (SOCKET s, int af, int ttl)
int | SetSendInterface (SOCKET s, struct addrinfo *iface)
void | usage (char *progname)
void | ValidateArgs (int argc, char **argv)

Variables

BOOL | bDontJoin = FALSE
BOOL | bLoopBack = FALSE
BOOL | bSender = FALSE
int | gBufferSize = BUFSIZE
int | gCount = DEFAULT_COUNT
char * | gInterface = NULL
int | gLoopBack = 0
char * | gMulticast = NULL
char * | gPort = MCASTPORT
int | gProtocol = IPPROTO_UDP
int | gSocketType = SOCK_DGRAM
int | gTtl = DEFAULT_TTL

Define Documentation

#define BUFSIZE 1024

Definition at line 52 of file Mcastws2.c.

#define DEFAULT_COUNT 500

Definition at line 53 of file Mcastws2.c.

#define DEFAULT_TTL 8

Definition at line 54 of file Mcastws2.c.

#define MCASTADDRV4 "234.5.6.7"

Definition at line 49 of file Mcastws2.c.

#define MCASTADDRV6 "ff12::1"

Definition at line 50 of file Mcastws2.c.

#define MCASTPORT "25000"

Definition at line 51 of file Mcastws2.c.

Function Documentation

int __cdecl main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 352 of file Mcastws2.c.

{
    WSADATA             wsd;
    struct addrinfo    *reslocal = NULL,
                       *resmulti = NULL;
    SOCKET              s = INVALID_SOCKET,
                        rs= INVALID_SOCKET;
    char               *buf=NULL;
    int                 rc,
                        i;

    ValidateArgs(argc, argv);

    if ((rc = WSAStartup(MAKEWORD(2,2), &wsd)) != 0)
    {
        fprintf(stderr, "WSAStartup failed: %d\n", rc);
        return -1;
    }

    //
    // resolve the local interface first
    //
    reslocal = ResolveAddress(gInterface, (bSender ? "0": gPort), AF_UNSPEC, SOCK_DGRAM, IPPROTO_UDP);
    if (reslocal == NULL)
    {
        fprintf(stderr, "Unable to resolve local interface: %s\n", gInterface);
        goto cleanup;
    }

    if (gMulticast == NULL)
    {
        if (reslocal->ai_family == AF_INET)
            gMulticast = MCASTADDRV4;
        else if (reslocal->ai_family == AF_INET6)
            gMulticast = MCASTADDRV6;
    }

    // Create the socket - remember to specify the multicast flags
    s = WSASocket(
            reslocal->ai_family,
            reslocal->ai_socktype,
            reslocal->ai_protocol,
            NULL,
            0,
            WSA_FLAG_OVERLAPPED | WSA_FLAG_MULTIPOINT_C_LEAF | WSA_FLAG_MULTIPOINT_D_LEAF
            );
    if (s == INVALID_SOCKET)
    {
        fprintf(stderr, "socket(af = %d) failed: %d\n", reslocal->ai_family, WSAGetLastError());
        goto cleanup;
    }

    rc = bind(s, reslocal->ai_addr, reslocal->ai_addrlen);
    if (rc == SOCKET_ERROR)
    {
        fprintf(stderr, "bind failed: %d\n", WSAGetLastError());
        goto cleanup;
    }

    printf("bound to: ");
    PrintAddress(reslocal->ai_addr, reslocal->ai_addrlen);
    printf("\n");

    // Resolve the multicast address
    resmulti = ResolveAddress(gMulticast, gPort, reslocal->ai_family, reslocal->ai_socktype, reslocal->ai_protocol);
    if (resmulti == NULL)
    {
        fprintf(stderr, "Unable to resolve multicast address: %s\n", gMulticast);
        goto cleanup;
    }

    // Set the multicast TTL
    rc = SetMulticastTtl(s, resmulti->ai_family, gTtl);
    if (rc == SOCKET_ERROR)
    {
        fprintf(stderr, "Unable to set multicast TTL\n");
        goto cleanup;
    }

    // Set the loopback value if indicated
    if (bLoopBack)
    {
        rc = SetMulticastLoopBack(s, resmulti->ai_family, gLoopBack);
        if (rc == SOCKET_ERROR)
        {
            fprintf(stderr, "Unable to set multicast loopback flag\n");
            goto cleanup;
        }
    }

    // If the don't join option is set then just connect the socket
    if (bDontJoin == FALSE)
    {
        rs = WSAJoinLeaf(
                s,
                resmulti->ai_addr,
                resmulti->ai_addrlen,
                NULL,
                NULL,
                NULL,
                NULL,
                (bSender ? JL_SENDER_ONLY : JL_RECEIVER_ONLY)
                        );
        if (rs == INVALID_SOCKET)
        {
            fprintf(stderr, "WSAJoinLeaf failed: %d\n", WSAGetLastError());
            goto cleanup;
        }
    }
    else
    {
        rc = SetSendInterface(s, reslocal);
        if (rc == SOCKET_ERROR)
        {
            fprintf(stderr, "Unable to set outgoing multicast interface\n");
            goto cleanup;
        }

        rc = connect(
                s,
                resmulti->ai_addr,
                resmulti->ai_addrlen
                );
        if (rc == SOCKET_ERROR)
        {
            fprintf(stderr, "conect failed: %d\n", WSAGetLastError());
            goto cleanup;
        }
    }

    printf("joining group: ");
    PrintAddress(resmulti->ai_addr, resmulti->ai_addrlen);
    printf("\n");

    // Don't need these anymore
    freeaddrinfo(reslocal);
    reslocal = NULL;

    freeaddrinfo(resmulti);
    resmulti = NULL;

    // Allocate the send/recv buffer
    buf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, gBufferSize);
    if (buf == NULL)
    {
        fprintf(stderr, "HeapAlloc failed: %d\n", GetLastError());
        goto cleanup;
    }
    memset(buf, '%', gBufferSize);

    if (bSender)
    {
        for(i=0; i < gCount ;i++)
        {
            rc = send(s, buf, gBufferSize, 0);
            if (rc == SOCKET_ERROR)
            {
                fprintf(stderr, "send failed: %d\n", WSAGetLastError());
                break;
            }
            else
            {
                printf("wrote %d bytes\n", rc);
            }
        }
    }
    else
    {
        for(i=0; i < gCount ;i++)
        {
            rc = recv(s, buf, gBufferSize, 0);
            if (rc == SOCKET_ERROR)
            {
                fprintf(stderr, "recv failed: %d\n", rc);
                break;
            }
            else
            {
                printf("read %d bytes\n", rc);
            }
        }
    }

cleanup:

    //
    // Cleanup allocations and sockets as necessary
    //

    if (buf)
        HeapFree(GetProcessHeap(), 0, buf);

    if (s != INVALID_SOCKET)
        closesocket(s);

    if (reslocal)
        freeaddrinfo(reslocal);

    if (resmulti)
        freeaddrinfo(resmulti);

    WSACleanup();
    return 0;
}

int SetMulticastLoopBack | ( | SOCKET | s,
 |  | int | af,
 |  | int | loopval
 | ) |  |

Definition at line 226 of file Mcastws2.c.

{
    char *optval=NULL;
    int   optlevel,
          option,
          optlen,
          rc;

    rc = NO_ERROR;
    if (af == AF_INET)
    {
        // Set the v4 options
        optlevel = IPPROTO_IP;
        option   = IP_MULTICAST_LOOP;
        optval   = (char *) &loopval;
        optlen   = sizeof(loopval);
    }
    else if (af == AF_INET6)
    {
        // Set the v6 options
        optlevel = IPPROTO_IPV6;
        option   = IPV6_MULTICAST_LOOP;
        optval   = (char *) &loopval;
        optlen   = sizeof(loopval);
    }
    else
    {
        fprintf(stderr, "Attemtping to set multicast loopback for invalid address family!\n");
        rc = SOCKET_ERROR;
    }
    if (rc != SOCKET_ERROR)
    {
        // Set the multpoint loopback
        rc = setsockopt(
                s,
                optlevel,
                option,
                optval,
                optlen
                );
        if (rc == SOCKET_ERROR)
        {
            fprintf(stderr, "SetMulticastLoopBack: setsockopt failed: %d\n", WSAGetLastError());
        }
        else
        {
            printf("Setting multicast loopback to: %d\n", loopval);
        }
    }
    return rc;
}

int SetMulticastTtl | ( | SOCKET | s,
 |  | int | af,
 |  | int | ttl
 | ) |  |

Definition at line 164 of file Mcastws2.c.

{
    char *optval=NULL;
    int   optlevel,
          option,
          optlen,
          rc;

    rc = NO_ERROR;
    if (af == AF_INET)
    {
        // Set the options for V4
        optlevel = IPPROTO_IP;
        option   = IP_MULTICAST_TTL;
        optval   = (char *) &ttl;
        optlen   = sizeof(ttl);
    }
    else if (af == AF_INET6)
    {
        // Set the options for V6
        optlevel = IPPROTO_IPV6;
        option   = IPV6_MULTICAST_HOPS;
        optval   = (char *) &ttl;
        optlen   = sizeof(ttl);
    }
    else
    {
        fprintf(stderr, "Attemtping to set TTL for invalid address family!\n");
        rc = SOCKET_ERROR;
    }
    if (rc != SOCKET_ERROR)
    {
        // Set the TTL value
        rc = setsockopt(
                s,
                optlevel,
                option,
                optval,
                optlen
                );
        if (rc == SOCKET_ERROR)
        {
            fprintf(stderr, "SetMulticastTtl: setsockopt failed: %d\n", WSAGetLastError());
        }
        else
        {
            printf("Set multicast ttl to: %d\n", ttl);
        }
    }
    return rc;
}

int SetSendInterface | ( | SOCKET | s,
 |  | struct addrinfo * | iface
 | ) |  |

Definition at line 286 of file Mcastws2.c.

{
    char *optval=NULL;
    int   optlevel,
    option,
    optlen,
    rc;

    rc = NO_ERROR;
    if (iface->ai_family == AF_INET)
    {
        // Setup the v4 option values
        optlevel = IPPROTO_IP;
        option   = IP_MULTICAST_IF;
        optval   = (char *) &((SOCKADDR_IN *)iface->ai_addr)->sin_addr.s_addr;
        optlen   = sizeof(((SOCKADDR_IN *)iface->ai_addr)->sin_addr.s_addr);
    }
    else if (iface->ai_family == AF_INET6)
    {
        // Setup the v6 option values
        optlevel = IPPROTO_IPV6;
        option   = IPV6_MULTICAST_IF;
        optval   = (char *) &((SOCKADDR_IN6 *)iface->ai_addr)->sin6_scope_id;
        optlen   = sizeof(((SOCKADDR_IN6 *)iface->ai_addr)->sin6_scope_id);
    }
    else
    {
        fprintf(stderr, "Attemtping to set sent interface for invalid address family!\n");
        rc = SOCKET_ERROR;
    }
    // Set send IF
    if (rc != SOCKET_ERROR)
    {
        // Set the send interface
        rc = setsockopt(
                s,
                optlevel,
                option,
                optval,
                optlen
                );
        if (rc == SOCKET_ERROR)
        {
            fprintf(stderr, "setsockopt failed: %d\n", WSAGetLastError());
        }
        else
        {
            printf("Set sending interface to: ");
            PrintAddress(iface->ai_addr, iface->ai_addrlen);
            printf("\n");
        }
    }
    return rc;
}

void usage ( char * progname )

Definition at line 75 of file Mcastws2.c.

{
    fprintf(stderr, "usage: %s [-s] [-i local-addr] [-m remote-addr] [-p port-num] [-n count]\n", progname);
    fprintf(stderr,
                    "  -i addr Local address to bind to\n"
                    "  -j      Don't join the multicast grou\n"
                    "  -l 0/1  Disable/enable loopback\n"
                    "  -m addr Multicast address to join\n"
                    "  -n int  Send/recv count\n"
                    "  -p int  Port number\n"
                    "  -s      Act as sender; default is receiver\n"
                    "  -t int  Set multicast TTL\n"
                    "  -z int  Buffer size (in bytes)\n"
                    );
    ExitProcess(-1);
}

void ValidateArgs | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 99 of file Mcastws2.c.

{
    int     i;

    for(i=1; i < argc ;i++)
    {
        if (((argv[i][0] != '/') && (argv[i][0] != '-')) || (strlen(argv[i]) < 2))
            usage(argv[0]);
        switch(tolower(argv[i][1]))
        {
            case 'i':               // local address to bind to
                if (i+1 >= argc)
                    usage(argv[0]);
                gInterface = argv[++i];
                break;
            case 'j':               // Don't join the multicast group
                bDontJoin = TRUE;
                break;
            case 'l':               // enable/disable loopback
                if (i+1 >= argc)
                    usage(argv[0]);
                bLoopBack = TRUE;
                gLoopBack = atoi(argv[++i]);
                break;
            case 'm':               // remote (multicast) address to connect/join to
                if (i+1 >= argc)
                    usage(argv[0]);
                gMulticast = argv[++i];
                break;
            case 'n':               // number of sends/recvs
                if (i+1 >= argc)
                    usage(argv[0]);
                gCount = atoi(argv[++i]);
                break;
            case 'p':               // port number
                if (i+1 >= argc)
                    usage(argv[0]);
                gPort = argv[++i];
                break;
            case 's':               // sender or receiver
                bSender = TRUE;
                break;
            case 't':               // multicast ttl
                if (i+1 >= argc)
                    usage(argv[0]);
                gTtl = atoi(argv[++i]);
                break;
            case 'z':               // buffer size
                if (i+1 >= argc)
                    usage(argv[0]);
                gBufferSize = atoi(argv[++i]);
                break;
            default:
                usage(argv[0]);
                break;
        }
    }
}

Variable Documentation

BOOL bDontJoin = FALSE

Definition at line 58 of file Mcastws2.c.

BOOL bLoopBack = FALSE

Definition at line 57 of file Mcastws2.c.

BOOL bSender = FALSE

Definition at line 56 of file Mcastws2.c.

int gBufferSize = BUFSIZE

Definition at line 62 of file Mcastws2.c.

int gCount = DEFAULT_COUNT

Definition at line 61 of file Mcastws2.c.

char* gInterface = NULL

Definition at line 65 of file Mcastws2.c.

int gLoopBack = 0

Definition at line 63 of file Mcastws2.c.

char * gMulticast = NULL

Definition at line 66 of file Mcastws2.c.

char * gPort = MCASTPORT

Definition at line 67 of file Mcastws2.c.

int gProtocol = IPPROTO_UDP

Definition at line 60 of file Mcastws2.c.

int gSocketType = SOCK_DGRAM

Definition at line 59 of file Mcastws2.c.

int gTtl = DEFAULT_TTL

Definition at line 64 of file Mcastws2.c.

Generated on Wed Nov 13 2024 16:54:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/McastIP/resolve.c File Reference

  • NetDS
  • WinSock
  • McastIP
Functions

resolve.c File Reference

#include <winsock2.h>
#include <ws2tcpip.h>
#include <wspiapi.h>
#include <stdio.h>
#include <stdlib.h>
#include "resolve.h"

Go to the source code of this file.

Functions

int | FormatAddress (SOCKADDR *sa, int salen, char *addrbuf, int addrbuflen)
int | PrintAddress (SOCKADDR *sa, int salen)
struct addrinfo * | ResolveAddress (char *addr, char *port, int af, int type, int proto)
int | ReverseLookup (SOCKADDR *sa, int salen, char *buf, int buflen)

Function Documentation

int FormatAddress | ( | SOCKADDR * | sa,
 |  | int | salen,
 |  | char * | addrbuf,
 |  | int | addrbuflen
 | ) |  |

Definition at line 87 of file resolve.c.

{
    char    host[NI_MAXHOST],
            serv[NI_MAXSERV];
    int     hostlen = NI_MAXHOST,
            servlen = NI_MAXSERV,
            rc;

    // Validate input
    if ((sa == NULL) || (addrbuf == NULL))
        return WSAEFAULT;

    // Format the name
    rc = getnameinfo(
            sa,
            salen,
            host,
            hostlen,
            serv,
            servlen,
            NI_NUMERICHOST | NI_NUMERICSERV     // Convert to numeric representation
            );
    if (rc != 0)
    {
        fprintf(stderr, "%s: getnameinfo failed: %d\n", __FILE__, rc);
        return rc;
    }
    if ( (strlen(host) + strlen(serv) + 1) > (unsigned)addrbuflen)
        return WSAEFAULT;
    if (strncmp(serv, "0", 1) != 0)
    {
        if (sa->sa_family == AF_INET)
            _snprintf(addrbuf, addrbuflen-1, "%s:%s", host, serv);
        else if (sa->sa_family == AF_INET6)
            _snprintf(addrbuf, addrbuflen-1, "[%s]:%s", host, serv);
        else
            addrbuf[0] = '\0';
    }
    else
    {
        _snprintf(addrbuf, addrbuflen-1, "%s", host);
    }

    return NO_ERROR;
}

int PrintAddress | ( | SOCKADDR * | sa,
 |  | int | salen
 | ) |  |

Definition at line 38 of file resolve.c.

{
    char    host[NI_MAXHOST],
            serv[NI_MAXSERV];
    int     hostlen = NI_MAXHOST,
            servlen = NI_MAXSERV,
            rc;

    // Validate argument
    if (sa == NULL)
        return WSAEFAULT;

    rc = getnameinfo(
            sa,
            salen,
            host,
            hostlen,
            serv,
            servlen,
            NI_NUMERICHOST | NI_NUMERICSERV
            );
    if (rc != 0)
    {
        fprintf(stderr, "%s: getnameinfo failed: %d\n", __FILE__, rc);
        return rc;
    }

    // If the port is zero then don't print it
    if (strncmp(serv, "0", 1) != 0)
    {
        if (sa->sa_family == AF_INET6)
            printf("[%s]:%s", host, serv);
        else
            printf("%s:%s", host, serv);
    }
    else
        printf("%s", host);

    return NO_ERROR;
}

struct addrinfo* ResolveAddress | ( | char * | addr,
 |  | char * | port,
 |  | int | af,
 |  | int | type,
 |  | int | proto |
 | ) |  |  | [read]

Definition at line 142 of file resolve.c.

{
    struct addrinfo hints,
    *res = NULL;
    int             rc;

    memset(&hints, 0, sizeof(hints));
    hints.ai_flags  = ((addr) ? 0 : AI_PASSIVE);
    hints.ai_family = af; //((addr) ? AF_UNSPEC : af);
    hints.ai_socktype = type;
    hints.ai_protocol = proto;

    rc = getaddrinfo(
            addr,
            port,
           &hints,
           &res
            );
    if (rc != 0)
    {
        fprintf(stderr, "Invalid address %s, getaddrinfo failed: %d\n", addr, rc);
        return NULL;
    }
    return res;
}

int ReverseLookup | ( | SOCKADDR * | sa,
 |  | int | salen,
 |  | char * | buf,
 |  | int | buflen
 | ) |  |

Definition at line 175 of file resolve.c.

{
    char    host[NI_MAXHOST];
    int     hostlen=NI_MAXHOST,
            rc;

    // Validate parameters
    if ((sa == NULL) || (buf == NULL))
        return WSAEFAULT;

    rc = getnameinfo(
            sa,
            salen,
            host,
            hostlen,
            NULL,
            0,
            0
            );
    if (rc != 0)
    {
        fprintf(stderr, "getnameinfo failed: %d\n", rc);
        return rc;
    }

    strncpy(buf, host, buflen-1);

    return NO_ERROR;
}

Generated on Wed Nov 13 2024 16:54:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/McastIP/resolve.h File Reference

  • NetDS
  • WinSock
  • McastIP
Functions

resolve.h File Reference

Go to the source code of this file.

Functions

int | FormatAddress (SOCKADDR *sa, int salen, char *addrbuf, int addrbuflen)
int | PrintAddress (SOCKADDR *sa, int salen)
struct addrinfo * | ResolveAddress (char *addr, char *port, int af, int type, int proto)
int | ReverseLookup (SOCKADDR *sa, int salen, char *namebuf, int namebuflen)

Function Documentation

int FormatAddress | ( | SOCKADDR * | sa,
 |  | int | salen,
 |  | char * | addrbuf,
 |  | int | addrbuflen
 | ) |  |

Definition at line 87 of file resolve.c.

{
    char    host[NI_MAXHOST],
            serv[NI_MAXSERV];
    int     hostlen = NI_MAXHOST,
            servlen = NI_MAXSERV,
            rc;

    // Validate input
    if ((sa == NULL) || (addrbuf == NULL))
        return WSAEFAULT;

    // Format the name
    rc = getnameinfo(
            sa,
            salen,
            host,
            hostlen,
            serv,
            servlen,
            NI_NUMERICHOST | NI_NUMERICSERV     // Convert to numeric representation
            );
    if (rc != 0)
    {
        fprintf(stderr, "%s: getnameinfo failed: %d\n", __FILE__, rc);
        return rc;
    }
    if ( (strlen(host) + strlen(serv) + 1) > (unsigned)addrbuflen)
        return WSAEFAULT;
    if (strncmp(serv, "0", 1) != 0)
    {
        if (sa->sa_family == AF_INET)
            _snprintf(addrbuf, addrbuflen-1, "%s:%s", host, serv);
        else if (sa->sa_family == AF_INET6)
            _snprintf(addrbuf, addrbuflen-1, "[%s]:%s", host, serv);
        else
            addrbuf[0] = '\0';
    }
    else
    {
        _snprintf(addrbuf, addrbuflen-1, "%s", host);
    }

    return NO_ERROR;
}

int PrintAddress | ( | SOCKADDR * | sa,
 |  | int | salen
 | ) |  |

Definition at line 38 of file resolve.c.

{
    char    host[NI_MAXHOST],
            serv[NI_MAXSERV];
    int     hostlen = NI_MAXHOST,
            servlen = NI_MAXSERV,
            rc;

    // Validate argument
    if (sa == NULL)
        return WSAEFAULT;

    rc = getnameinfo(
            sa,
            salen,
            host,
            hostlen,
            serv,
            servlen,
            NI_NUMERICHOST | NI_NUMERICSERV
            );
    if (rc != 0)
    {
        fprintf(stderr, "%s: getnameinfo failed: %d\n", __FILE__, rc);
        return rc;
    }

    // If the port is zero then don't print it
    if (strncmp(serv, "0", 1) != 0)
    {
        if (sa->sa_family == AF_INET6)
            printf("[%s]:%s", host, serv);
        else
            printf("%s:%s", host, serv);
    }
    else
        printf("%s", host);

    return NO_ERROR;
}

struct addrinfo* ResolveAddress | ( | char * | addr,
 |  | char * | port,
 |  | int | af,
 |  | int | type,
 |  | int | proto |
 | ) |  |  | [read]

Definition at line 142 of file resolve.c.

{
    struct addrinfo hints,
    *res = NULL;
    int             rc;

    memset(&hints, 0, sizeof(hints));
    hints.ai_flags  = ((addr) ? 0 : AI_PASSIVE);
    hints.ai_family = af; //((addr) ? AF_UNSPEC : af);
    hints.ai_socktype = type;
    hints.ai_protocol = proto;

    rc = getaddrinfo(
            addr,
            port,
           &hints,
           &res
            );
    if (rc != 0)
    {
        printf("Invalid address %s, getaddrinfo failed: %d\n", addr, rc);
        return NULL;
    }
    return res;
}

int ReverseLookup | ( | SOCKADDR * | sa,
 |  | int | salen,
 |  | char * | namebuf,
 |  | int | namebuflen
 | ) |  |

Definition at line 175 of file resolve.c.

{
    char    host[NI_MAXHOST];
    int     hostlen=NI_MAXHOST,
            rc;

    // Validate parameters
    if ((sa == NULL) || (buf == NULL))
        return WSAEFAULT;

    rc = getnameinfo(
            sa,
            salen,
            host,
            hostlen,
            NULL,
            0,
            0
            );
    if (rc != 0)
    {
        fprintf(stderr, "getnameinfo failed: %d\n", rc);
        return rc;
    }

    strncpy(buf, host, buflen-1);

    return NO_ERROR;
}

Generated on Wed Nov 13 2024 16:54:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/Overlap/Overlap.c File Reference

  • NetDS
  • WinSock
  • Overlap
Classes | Defines | Typedefs | Functions | Variables

Overlap.c File Reference

#include <winsock2.h>
#include <ws2tcpip.h>
#include <mswsock.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <strsafe.h>

Go to the source code of this file.

Classes

struct | _socklist

Defines

#define | CLOSEEVENT(h) if(WSA_INVALID_EVENT != h) {WSACloseEvent(h); h = WSA_INVALID_EVENT;}
#define | CLOSESOCK(s) if(INVALID_SOCKET != s) {closesocket(s); s = INVALID_SOCKET;}
#define | DEFAULT_BACKLOG 5
#define | DEFAULT_PORT "5001"
#define | ERR(e) fprintf(stderr,"\n%s failed with error: %d\n",e,WSAGetLastError())
#define | MAX_IO_PEND 10
#define | OP_READ 0x10
#define | OP_WRITE 0x20
#define | WS_VER 0x0202
#define | XFREE(x) if(x != NULL) {HeapFree(GetProcessHeap(),0,x); x = NULL;}
#define | XMALLOC(x) HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,x)

Typedefs

typedef struct _socklist | Socklist

Functions

int | DoWait (WSAEVENT *, Socklist *)
void | HandleEvent (int, WSAEVENT *, Socklist *)
int __cdecl | main (int argc, char **argv)
void | Usage (char *progname)

Variables

int | curr_size = 0

Define Documentation

#define CLOSEEVENT ( h ) if(WSA_INVALID_EVENT != h) {WSACloseEvent(h); h = WSA_INVALID_EVENT;}

Definition at line 44 of file Overlap.c.

#define CLOSESOCK ( s ) if(INVALID_SOCKET != s) {closesocket(s); s = INVALID_SOCKET;}

Definition at line 43 of file Overlap.c.

#define DEFAULT_BACKLOG 5

Definition at line 33 of file Overlap.c.

#define DEFAULT_PORT "5001"

Definition at line 32 of file Overlap.c.

#define ERR ( e ) fprintf(stderr,"\n%s failed with error: %d\n",e,WSAGetLastError())

Definition at line 42 of file Overlap.c.

#define MAX_IO_PEND 10

Definition at line 34 of file Overlap.c.

#define OP_READ 0x10

Definition at line 36 of file Overlap.c.

#define OP_WRITE 0x20

Definition at line 37 of file Overlap.c.

#define WS_VER 0x0202

Definition at line 31 of file Overlap.c.

#define XFREE ( x ) if(x != NULL) {HeapFree(GetProcessHeap(),0,x); x = NULL;}

Definition at line 40 of file Overlap.c.

#define XMALLOC ( x ) HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,x)

Definition at line 39 of file Overlap.c.

Typedef Documentation

typedef struct _socklist Socklist

Function Documentation

int DoWait | ( | WSAEVENT * | Handles,
 |  | Socklist * | socklist
 | ) |  |

Definition at line 669 of file Overlap.c.

{

    DWORD wait_rc = 0;
    WSAEVENT hTemp = WSA_INVALID_EVENT;
    Socklist socklTemp;

    int i = 0;

    //
    // Rotate the array, beginning at index 1, by one element.
    // This ensures that all handles get a fair chance to be serviced.
    //
    // There is no way to detect how many handles were signalled when
    // WSAWaitForMultipleObjects() returns. We simply pick the first one and
    // come back to this function later
    // Without the rotation below, this has the potential for starving
    // connections accepted later.
    //
    // Index 0 is avoided, since it is our listening socket.
    //
    for ( i = 1; i < curr_size-1; i++ )
    {
        hTemp = Handles[i+1];
        Handles[i+1] = Handles[i];
        Handles[i] = hTemp;

        socklTemp = socklist[i+1];
        socklist[i+1] = socklist[i];
        socklist[i] = socklTemp;
    }

    if(WSA_WAIT_FAILED == (wait_rc = WSAWaitForMultipleEvents(curr_size,
                                                              Handles,
                                                              FALSE,
                                                              WSA_INFINITE,
                                                              FALSE
                                                              )))
    {
        ERR("WSAWaitForMultipleEvents()");
        return -1;
    }

    return(wait_rc - WSA_WAIT_EVENT_0);
}

void HandleEvent | ( | int | index,
 |  | WSAEVENT * | Handles,
 |  | Socklist * | socklist
 | ) |  |

Definition at line 424 of file Overlap.c.

{

    WSAOVERLAPPED *Overlap;
    SOCKET newsock = INVALID_SOCKET;
    DWORD bytes = 0;
    DWORD    flags    =    0;
    DWORD lasterr = 0;
    int i = 0;

    Overlap = socklist[index].overlap;

    if (!WSAResetEvent(Handles[index]))
    {
        ERR("WSAResetEvent()");
    }

    //
    // Check the specified handle
    //
    // If a socket is closed by the other side, the error returned is
    // WSAECONNRESET
    //
    if ( !WSAGetOverlappedResult(socklist[index].sock,
                                 Overlap,
                                 &bytes,
                                 FALSE,
                                 &flags))
    {
        ERR("WSAGetOverlappedResult()");
    }

    newsock = Overlap->Offset;

    //
    // If the other side closed the connection, close our socket and
    // move the next element of the Handles[] array into our
    // index.
    //
    // The array compaction is done so that we only pass valid handles
    // in the first "curr_size" elements of the array to
    // WSAWaitForMultipleEvents(). The function will fail otherwise.
    //

    //
    // We should NEVER get this for our listening socket
    //
    if ( (index != 0) && (bytes == 0 ) )
    {
        CLOSESOCK(newsock);
        XFREE(Overlap);
        CLOSEEVENT(Handles[index]);
        for ( i = index; i < curr_size; i++ )
        {
            Handles[i] = Handles[i+1];
            socklist[i] = socklist[i+1];
        }
        curr_size--;
        return;
    }

    if ( (index == 0) )
    {    // listening socket
        if ( curr_size >= MAX_IO_PEND )
        {
            shutdown(newsock, SD_BOTH);
            CLOSESOCK(newsock);
            fprintf(stderr,"Too many pending requests\n");
            return;
        }

        //
        // Get the event handle used to queue the AcceptEx(),
        // and re-use it to queue a WSARecv() on the socket.
        //
        Handles[curr_size] = Overlap->hEvent;

        //
        // Fill in the details of our accepted socket
        //
        socklist[curr_size].sock = newsock;
        SecureZeroMemory(socklist[curr_size].Buffer,
                         sizeof(socklist[curr_size].Buffer)/sizeof(socklist[curr_size].Buffer[0]
                         ));

        socklist[curr_size].overlap = Overlap;
        socklist[curr_size].DataBuf.len = sizeof(socklist[curr_size].Buffer);
        socklist[curr_size].DataBuf.buf = socklist[curr_size].Buffer;

        //
        // The OffsetHigh field is used to keep track of what we are doing.
        // This enables us to alternate WSARecv() and WSASend() on a
        // connection
        //
        Overlap->OffsetHigh = OP_READ;

        flags = 0;
        if ( SOCKET_ERROR == WSARecv(socklist[curr_size].sock,
                                     &(socklist[curr_size].DataBuf),
                                     1,
                                     &bytes,
                                     &flags,
                                     socklist[curr_size].overlap,
                                     NULL
                                     ))
        {

            lasterr = WSAGetLastError();

            if ( WSA_IO_PENDING != lasterr)
            {
                ERR("WSARecv()");
                if ( WSAECONNRESET == lasterr)
                {

                    //
                    // Handle WSAECONNRESET specially
                    // Other errors are not good
                    //
                    shutdown(newsock, SD_BOTH);
                    CLOSESOCK(newsock);
                    XFREE(Overlap);
                    CLOSEEVENT(Handles[index]);
                    for ( i = index; i < curr_size; i++ )
                    {
                        Handles[i] = Handles[i+1];
                        socklist[i] = socklist[i+1];
                    }
                    curr_size--;
                }
                return;
            }
        }

        //
        // Increment the last valid handle location in the Handles
        // array.
        //
        curr_size++;
        return;
    }

    //
    //  If the previous operation was an OP_READ, queue WSASend() on the
    //  socket
    //
    if ( Overlap->OffsetHigh == OP_READ )
    { // WSARecv() was queued

        printf("Read buffer [%s]\n", socklist[index].Buffer);
        printf("Echoing back to client\n");

        if ( SOCKET_ERROR == WSASend(socklist[index].sock,
                                     &(socklist[index].DataBuf),
                                     1,
                                     &bytes,
                                     0,
                                     socklist[index].overlap,
                                     NULL))
        {

            lasterr = WSAGetLastError();
            if(WSA_IO_PENDING != lasterr)
            {
                ERR("WSASend()");
                if ( WSAECONNRESET == lasterr)
                {
                    shutdown(newsock, SD_BOTH);
                    CLOSESOCK(newsock);
                    XFREE(Overlap);
                    CLOSEEVENT(Handles[index]);
                    for ( i = index; i < curr_size; i++ )
                    {
                        Handles[i] = Handles[i+1];
                        socklist[i] = socklist[i+1];
                    }
                    curr_size--;
                }
                return;
            }
        }

        Overlap->OffsetHigh = OP_WRITE;
        return;
    }

    //
    // If we had a WSASend() queued, now do a WSARecv()
    //
    else if ( Overlap->OffsetHigh == OP_WRITE )
    { // WSASend() was queued

        printf("Wrote %d bytes\n",bytes);
        printf("Queueing read\n");

        flags = 0;
        if ( SOCKET_ERROR == WSARecv(socklist[index].sock,
                                     &(socklist[index].DataBuf),
                                     1,
                                     &bytes,
                                     &flags,
                                     socklist[index].overlap,
                                     NULL
                                     ))
        {

            lasterr = WSAGetLastError();
            if(WSA_IO_PENDING != lasterr)
            {
                ERR("WSARecv()");
                if ( WSAECONNRESET == lasterr)
                {
                    shutdown(newsock, SD_BOTH);
                    CLOSESOCK(newsock);
                    XFREE(Overlap);
                    CLOSEEVENT(Handles[index]);
                    for ( i = index; i < curr_size; i++ )
                    {
                        Handles[i] = Handles[i+1];
                        socklist[i] = socklist[i+1];
                    }
                    curr_size--;
                }
                return;
            }
        }

        Overlap->OffsetHigh = OP_READ;
        return;
    }
    else
    {
        fprintf(stderr,"Unknown operation queued\n");
    }

}

int __cdecl main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 74 of file Overlap.c.

{

    char *interface = NULL;
    char *Buffer = NULL;
    char *port = DEFAULT_PORT;
    char host[NI_MAXHOST];
    char serv[NI_MAXSERV];
    int hostlen = NI_MAXHOST;
    int servlen = NI_MAXSERV;
    int ai_family = AF_UNSPEC;
    int i = 0;
    int nStartup = 0;
    struct addrinfo hints = {0};
    struct addrinfo *local = NULL;
    WSADATA wsaData;
    SOCKET listen_socket = INVALID_SOCKET;
    SOCKET accept_socket = INVALID_SOCKET;
    WSAOVERLAPPED *Overlap = NULL;
    DWORD bytes = 0;
    DWORD bytes_read = 0;
    DWORD lasterror = 0;

    //
    // Handles is the array that stores the Event Handles
    //
    WSAEVENT Handles[MAX_IO_PEND] ;

    //
    // socklist is a parallel array that keeps state information for
    // each Handle.
    //
    Socklist socklist[MAX_IO_PEND];

    //
    // Pointers to Microsoft specific extensions
    //
    LPFN_ACCEPTEX pfnAcceptEx;
    GUID acceptex_guid = WSAID_ACCEPTEX;

    __try
    {

        if (NULL == (Buffer = (char*)XMALLOC(((2*sizeof(SOCKADDR_STORAGE))+32)*sizeof(char))))
        {
            ERR("HeapAlloc()");
            __leave;

        }

        //
        // Parse arguments
        //
        if ( argc > 1 )
        {
            for ( i = 1;i < argc; i++ )
            {
                if ( (argv[i][0] == '-') || (argv[i][0] == '/') )
                {
                    switch ( tolower(argv[i][1]) )
                    {

                    case 'i':
                        if ( i+1 < argc )
                            interface = argv[++i];
                        break;
                    case 'e':
                        if ( i+1 < argc )
                            port = argv[++i];
                        break;
                    default:
                        {
                            Usage(argv[0]);
                            __leave;
                        }
                        break;
                    }
                }
                else
                {
                    Usage(argv[0]);
                    __leave;
                }
            }
        }

        //
        // Since port 0 would be any available port.
        // Resetting port back to DEFAULT_PORT to avoid confusion.
        //
        if ( 0 == strncmp(port, "0", 1) )
        {
            port = DEFAULT_PORT;
        }

        if ( 0 != (nStartup = WSAStartup(WS_VER, &wsaData)) )
        {
            WSASetLastError(nStartup); //WSAStartup does not set last error on failure
            ERR("WSAStartup()");
            __leave;

        }
        else
            nStartup++;

        //
        // Resolve the interface
        //
        SecureZeroMemory(&hints,sizeof(hints));
        hints.ai_flags  = ((interface) ? 0 : AI_PASSIVE);
        hints.ai_family = ai_family;
        hints.ai_socktype = SOCK_STREAM;
        hints.ai_protocol = IPPROTO_TCP;

        if ( 0 != getaddrinfo(interface, port, &hints, &local))
        {
            ERR("getaddrinfo()");
            __leave;
        }

        ai_family = local->ai_family;

        if (NULL == local)
        {
            fprintf(stderr, "getaddrinfo() failed to resolve/convert the interface\n");
            __leave;
        }

        if (INVALID_SOCKET == (listen_socket = WSASocket(local->ai_family,
                                                         local->ai_socktype,
                                                         local->ai_protocol,
                                                         NULL,
                                                         0,
                                                         WSA_FLAG_OVERLAPPED
                                                        )))
        {
            ERR("WSASocket()");
            __leave;
        }

        if ( SOCKET_ERROR == bind(listen_socket,
                                  local->ai_addr,
                                  (int)local->ai_addrlen
                                 ))
        {
            ERR("bind()");
            __leave;
        }

        if ( SOCKET_ERROR == listen(listen_socket, DEFAULT_BACKLOG))
        {
            ERR("listen()");
            __leave;
        }

        //
        // Resolve numeric host name
        //
        if ( 0 != getnameinfo(local->ai_addr,
                              (int)local->ai_addrlen,
                              host,
                              hostlen,
                              serv,
                              servlen,
                              NI_NUMERICHOST | NI_NUMERICSERV
                             ))
        {
            ERR("getnameinfo()");
            __leave;
        }

        // Don't need the local interface anymore
        if (NULL != local)
            freeaddrinfo(local);

        printf("Listening on %s:%s\n", host, serv);

        //
        // Add the listening socket to our state information for the handle.
        //
        socklist[0].sock = listen_socket;

        curr_size =1;

        for ( i = 0;i < MAX_IO_PEND;i++ )
            Handles[i] = WSA_INVALID_EVENT;

        //
        // Load the extension functions
        //

        if ( SOCKET_ERROR == WSAIoctl(listen_socket,
                                      SIO_GET_EXTENSION_FUNCTION_POINTER,
                                      &acceptex_guid,
                                      sizeof(acceptex_guid),
                                      &pfnAcceptEx,
                                      sizeof(pfnAcceptEx),
                                      &bytes,
                                      NULL,
                                      NULL
                                     ))
        {
            fprintf(stderr,"Failed to obtain AcceptEx() pointer: ");
            ERR("WSAIoctl()");
            __leave;
        }

        //
        // The structure of the following loop is very similar to a situation
        // where select() might be used.
        // We use WSAGetOverlappedResult() to multiplex between incoming/outgoing
        // data on existing connections.
        //
        // We don't queue an AcceptEx() until someone actually connects to
        // the previous socket. This is to keep the code simple, not a limitation
        // of the API itself.
        //
        for ( ;; )
        {

            // create a socket for AcceptEx()

            if (INVALID_SOCKET == (accept_socket = WSASocket(ai_family,
                                                             SOCK_STREAM,
                                                             0,
                                                             NULL,
                                                             0,
                                                             WSA_FLAG_OVERLAPPED
                                                            )))
            {
                ERR("WSASocket()");
                __leave;
            }

            //
            // Allocate an overlapped structure.
            // We use the Offset field to keep track of the socket handle
            // we have accepted a connection on, since there is no other
            // way to pass information to GetOverlappedResult()
            //
            Overlap = (WSAOVERLAPPED*)XMALLOC(sizeof(WSAOVERLAPPED));

            //
            // Did the HeapAllocation FAIL??
            //
            if ( Overlap == NULL )
            {
                ERR("HeapAlloc()");
                __leave;
            }

            SecureZeroMemory(Overlap, sizeof(WSAOVERLAPPED));

            Overlap->Offset = (DWORD) accept_socket;

            if ( WSA_INVALID_EVENT == (Overlap->hEvent = WSACreateEvent() ))
            {
                ERR("WSACreateEvent()");
                __leave;
            }

            //
            // Set the appropriate array members
            //
            Handles[0] = Overlap->hEvent;
            socklist[0].overlap = Overlap;

            //
            // AcceptEx()
            //
            if ( !pfnAcceptEx(listen_socket,
                              accept_socket,
                              Buffer,
                              0, // read nothing from the socket
                              sizeof(SOCKADDR_STORAGE)+16,
                              sizeof(SOCKADDR_STORAGE)+16,
                              &bytes_read,
                              Overlap
                             ))
            {

                lasterror = WSAGetLastError();
                if ( WSA_IO_PENDING != lasterror)
                {
                    ERR("AcceptEx()");
                    for ( i = 0; i < curr_size; i++ )
                    {
                        shutdown(socklist[i].sock, SD_BOTH);
                        CLOSESOCK(socklist[i].sock);
                        XFREE(socklist[i].overlap);
                        CLOSEEVENT(Handles[i]);
                    }
                    __leave;
                }
            }

            //
            // This loop simple checks the handles to see which one is
            // signalled.
            // If error, exit.
            // If there is a new incoming connection, we break to the outer loop
            // queue another AcceptEx()
            //
            for ( ;; )
            {
                i = DoWait(Handles, socklist);
                if ( i < 0 )
                    break;
                HandleEvent(i, Handles, socklist);
                if ( i == 0 )
                    break;
            };
            if ( i < 0 )
            {
                for ( i = 0; i < curr_size; i++ )
                {
                    shutdown(socklist[i].sock, SD_BOTH);
                    CLOSESOCK(socklist[i].sock);
                    XFREE(socklist[i].overlap);
                    CLOSEEVENT(Handles[i]);
                }
                __leave;
            }
        }
    }
    __finally
    {
        XFREE(Buffer);
        if (NULL != local) freeaddrinfo(local);
        CLOSESOCK(listen_socket);
        CLOSESOCK(accept_socket);
        CLOSEEVENT(Overlap->hEvent);
        XFREE(Overlap);

    }
}

void Usage ( char * progname )

Definition at line 62 of file Overlap.c.

{
    fprintf(stderr,"Usage\n%s -e [endpoint] -i [interface]\n",
            progname);
    fprintf(stderr,"Where:\n");
    fprintf(stderr,"\tendpoint is the port to listen on\n");
    fprintf(stderr,"\tinterface is the ipaddr (in dotted decimal notation for IPv4 or hex quad notation for IPv6)");
    fprintf(stderr," to bind to\n");
    fprintf(stderr,"Defaults are 5001 and INADDR_ANY|IN6ADDR_ANY\n");

}

Variable Documentation

int curr_size = 0

Definition at line 57 of file Overlap.c.

Generated on Wed Nov 13 2024 16:54:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/Ping/iphdr.h File Reference

  • NetDS
  • WinSock
  • Ping
Classes | Defines | Typedefs

iphdr.h File Reference

#include <pshpack1.h>
#include <poppack.h>

Go to the source code of this file.

Classes

struct | icmp_hdr
struct | icmpv6_echo_request
struct | icmpv6_hdr
struct | ip_hdr
struct | ipv4_option_hdr
struct | ipv6_fragment_hdr
struct | ipv6_hdr
struct | udp_hdr

Defines

#define | ICMPV4_ECHO_REPLY_CODE 0
#define | ICMPV4_ECHO_REPLY_TYPE 0
#define | ICMPV4_ECHO_REQUEST_CODE 0
#define | ICMPV4_ECHO_REQUEST_TYPE 8
#define | ICMPV4_MINIMUM_HEADER 8
#define | ICMPV6_ECHO_REPLY_CODE 0
#define | ICMPV6_ECHO_REPLY_TYPE 129
#define | ICMPV6_ECHO_REQUEST_CODE 0
#define | ICMPV6_ECHO_REQUEST_TYPE 128
#define | IP_RECORD_ROUTE 0x7
#define | IPPROTO_ICMP6 58

Typedefs

typedef struct icmp_hdr | ICMP_HDR
typedef struct icmpv6_echo_request | ICMPV6_ECHO_REQUEST
typedef struct icmpv6_hdr | ICMPV6_HDR
typedef struct ip_hdr | IPV4_HDR
typedef struct ipv4_option_hdr | IPV4_OPTION_HDR
typedef struct ipv6_fragment_hdr | IPV6_FRAGMENT_HDR
typedef struct ipv6_hdr | IPV6_HDR
typedef struct icmp_hdr * | LPICMP_HDR
typedef struct ip_hdr * | LPIPV4_HDR
typedef struct ipv4_option_hdr * | LPIPV4_OPTION_HDR
typedef struct ipv6_fragment_hdr * | LPIPV6_FRAGMENT_HDR
typedef struct ipv6_hdr * | LPIPV6_HDR
typedef struct icmp_hdr * | PICMP_HDR
typedef struct ip_hdr * | PIPV4_HDR
typedef struct ipv4_option_hdr * | PIPV4_OPTION_HDR
typedef struct ipv6_fragment_hdr * | PIPV6_FRAGMENT_HDR
typedef struct ipv6_hdr * | PIPV6_HDR
typedef struct udp_hdr * | PUDP_HDR
typedef struct udp_hdr | UDP_HDR

Define Documentation

#define ICMPV4_ECHO_REPLY_CODE 0

Definition at line 116 of file iphdr.h.

#define ICMPV4_ECHO_REPLY_TYPE 0

Definition at line 115 of file iphdr.h.

#define ICMPV4_ECHO_REQUEST_CODE 0

Definition at line 114 of file iphdr.h.

#define ICMPV4_ECHO_REQUEST_TYPE 8

Definition at line 113 of file iphdr.h.

#define ICMPV4_MINIMUM_HEADER 8

Definition at line 117 of file iphdr.h.

#define ICMPV6_ECHO_REPLY_CODE 0

Definition at line 123 of file iphdr.h.

#define ICMPV6_ECHO_REPLY_TYPE 129

Definition at line 122 of file iphdr.h.

#define ICMPV6_ECHO_REQUEST_CODE 0

Definition at line 121 of file iphdr.h.

#define ICMPV6_ECHO_REQUEST_TYPE 128

Definition at line 120 of file iphdr.h.

#define IP_RECORD_ROUTE 0x7

Definition at line 107 of file iphdr.h.

#define IPPROTO_ICMP6 58

Definition at line 110 of file iphdr.h.

Typedef Documentation

typedef struct icmp_hdr ICMP_HDR
typedef struct icmpv6_echo_request ICMPV6_ECHO_REQUEST
typedef struct icmpv6_hdr ICMPV6_HDR
typedef struct ip_hdr IPV4_HDR
typedef struct ipv4_option_hdr IPV4_OPTION_HDR
typedef struct ipv6_fragment_hdr IPV6_FRAGMENT_HDR
typedef struct ipv6_hdr IPV6_HDR
typedef struct icmp_hdr* LPICMP_HDR
typedef struct ip_hdr* LPIPV4_HDR
typedef struct ipv4_option_hdr* LPIPV4_OPTION_HDR
typedef struct ipv6_fragment_hdr* LPIPV6_FRAGMENT_HDR
typedef struct ipv6_hdr* LPIPV6_HDR
typedef struct icmp_hdr * PICMP_HDR
typedef struct ip_hdr * PIPV4_HDR
typedef struct ipv4_option_hdr * PIPV4_OPTION_HDR
typedef struct ipv6_fragment_hdr * PIPV6_FRAGMENT_HDR
typedef struct ipv6_hdr * PIPV6_HDR
typedef struct udp_hdr * PUDP_HDR
typedef struct udp_hdr UDP_HDR
Generated on Wed Nov 13 2024 16:54:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/Ping/Ping.cpp File Reference

  • NetDS
  • WinSock
  • Ping
Defines | Functions | Variables

Ping.cpp File Reference

#include <winsock2.h>
#include <ws2tcpip.h>
#include <stdio.h>
#include <stdlib.h>
#include "resolve.h"
#include "iphdr.h"

Go to the source code of this file.

Defines

#define | DEFAULT_DATA_SIZE 32
#define | DEFAULT_RECV_TIMEOUT 6000
#define | DEFAULT_SEND_COUNT 4
#define | DEFAULT_TTL 128
#define | MAX_RECV_BUF_LEN 0xFFFF

Functions

USHORT | checksum (USHORT *buffer, int size)
USHORT | ComputeIcmp6PseudoHeaderChecksum (SOCKET s, char *icmppacket, int icmplen, struct addrinfo *dest)
void | ComputeIcmpChecksum (SOCKET s, char *buf, int packetlen, struct addrinfo *dest)
int | InitIcmp6Header (char *buf, int datasize)
void | InitIcmpHeader (char *buf, int datasize)
int __cdecl | main (int argc, char **argv)
int | PostRecvfrom (SOCKET s, char *buf, int buflen, SOCKADDR *from, int *fromlen, WSAOVERLAPPED *ol)
void | PrintPayload (char *buf, int bytes)
void | SetIcmpSequence (char *buf)
int | SetTtl (SOCKET s, int ttl)
void | usage (char *progname)
BOOL | ValidateArgs (int argc, char **argv)

Variables

BOOL | bRecordRoute = FALSE
int | gAddressFamily = AF_UNSPEC
int | gDataSize = DEFAULT_DATA_SIZE
char * | gDestination = NULL
int | gProtocol = IPPROTO_ICMP
int | gTtl = DEFAULT_TTL
char | recvbuf [MAX_RECV_BUF_LEN]
int | recvbuflen = MAX_RECV_BUF_LEN

Define Documentation

#define DEFAULT_DATA_SIZE 32

Definition at line 56 of file Ping.cpp.

#define DEFAULT_RECV_TIMEOUT 6000

Definition at line 60 of file Ping.cpp.

#define DEFAULT_SEND_COUNT 4

Definition at line 58 of file Ping.cpp.

#define DEFAULT_TTL 128

Definition at line 62 of file Ping.cpp.

#define MAX_RECV_BUF_LEN 0xFFFF

Definition at line 64 of file Ping.cpp.

Function Documentation

USHORT checksum | ( | USHORT * | buffer,
 |  | int | size
 | ) |  |

Definition at line 157 of file Ping.cpp.

{
    unsigned long cksum=0;

    while (size > 1)
    {
        cksum += *buffer++;
        size -= sizeof(USHORT);
    }
    if (size)
    {
        cksum += *(UCHAR*)buffer;
    }
    cksum = (cksum >> 16) + (cksum & 0xffff);
    cksum += (cksum >>16);
    return (USHORT)(~cksum);
}

USHORT ComputeIcmp6PseudoHeaderChecksum | ( | SOCKET | s,
 |  | char * | icmppacket,
 |  | int | icmplen,
 |  | struct addrinfo * | dest
 | ) |  |

Definition at line 290 of file Ping.cpp.

{
    SOCKADDR_STORAGE localif;
    DWORD            bytes;
    char             tmp[MAX_RECV_BUF_LEN] = {'\0'},
                    *ptr=NULL,
                     proto=0;
    int              rc, total, length, i;

    // Find out which local interface for the destination
    rc = WSAIoctl(
            s,
            SIO_ROUTING_INTERFACE_QUERY,
            dest->ai_addr,
            (DWORD) dest->ai_addrlen,
            (SOCKADDR *) &localif,
            (DWORD) sizeof(localif),
           &bytes,
            NULL,
            NULL
            );
    if (rc == SOCKET_ERROR)
    {
        fprintf(stderr, "WSAIoctl failed: %d\n", WSAGetLastError());
        return 0xFFFF;
    }

    // We use a temporary buffer to calculate the pseudo header.
    ptr = tmp;
    total = 0;

    // Copy source address
    memcpy(ptr, &((SOCKADDR_IN6 *)&localif)->sin6_addr, sizeof(struct in6_addr));
    ptr   += sizeof(struct in6_addr);
    total += sizeof(struct in6_addr);

    // Copy destination address
    memcpy(ptr, &((SOCKADDR_IN6 *)dest->ai_addr)->sin6_addr, sizeof(struct in6_addr));
    ptr   += sizeof(struct in6_addr);
    total += sizeof(struct in6_addr);

    // Copy ICMP packet length
    length = htonl(icmplen);

    memcpy(ptr, &length, sizeof(length));
    ptr   += sizeof(length);
    total += sizeof(length);

    // Zero the 3 bytes
    memset(ptr, 0, 3);
    ptr   += 3;
    total += 3;

    // Copy next hop header
    proto = IPPROTO_ICMP6;

    memcpy(ptr, &proto, sizeof(proto));
    ptr   += sizeof(proto);
    total += sizeof(proto);

    // Copy the ICMP header and payload
    memcpy(ptr, icmppacket, icmplen);
    ptr   += icmplen;
    total += icmplen;

    for(i=0; i < icmplen%2 ;i++)
    {
        *ptr = 0;
        ptr++;
        total++;
    }

    return checksum((USHORT *)tmp, total);
}

void ComputeIcmpChecksum | ( | SOCKET | s,
 |  | char * | buf,
 |  | int | packetlen,
 |  | struct addrinfo * | dest
 | ) |  |

Definition at line 377 of file Ping.cpp.

{
    if (gAddressFamily == AF_INET)
    {
        ICMP_HDR    *icmpv4=NULL;

        icmpv4 = (ICMP_HDR *)buf;
        icmpv4->icmp_checksum = 0;
        icmpv4->icmp_checksum = checksum((USHORT *)buf, packetlen);
    }
    else if (gAddressFamily == AF_INET6)
    {
        ICMPV6_HDR  *icmpv6=NULL;

        icmpv6 = (ICMPV6_HDR *)buf;
        icmpv6->icmp6_checksum = 0;
        icmpv6->icmp6_checksum = ComputeIcmp6PseudoHeaderChecksum(
                s,
                buf,
                packetlen,
                dest
                );
    }
}

int InitIcmp6Header | ( | char * | buf,
 |  | int | datasize
 | ) |  |

Definition at line 126 of file Ping.cpp.

{
    ICMPV6_HDR          *icmp6_hdr=NULL;
    ICMPV6_ECHO_REQUEST *icmp6_req=NULL;
    char                *datapart=NULL;

    // Initialize the ICMP6 headerf ields
    icmp6_hdr = (ICMPV6_HDR *)buf;
    icmp6_hdr->icmp6_type     = ICMPV6_ECHO_REQUEST_TYPE;
    icmp6_hdr->icmp6_code     = ICMPV6_ECHO_REQUEST_CODE;
    icmp6_hdr->icmp6_checksum = 0;

    // Initialize the echo request fields
    icmp6_req = (ICMPV6_ECHO_REQUEST *)(buf + sizeof(ICMPV6_HDR));
    icmp6_req->icmp6_echo_id       = (USHORT)GetCurrentProcessId();
    icmp6_req->icmp6_echo_sequence = 0;

    datapart = (char *)buf + sizeof(ICMPV6_HDR) + sizeof(ICMPV6_ECHO_REQUEST);

    memset(datapart, '#', datasize);

    return (sizeof(ICMPV6_HDR) + sizeof(ICMPV6_ECHO_REQUEST));
}

void InitIcmpHeader | ( | char * | buf,
 |  | int | datasize
 | ) |  |

Definition at line 101 of file Ping.cpp.

{
    ICMP_HDR   *icmp_hdr=NULL;
    char       *datapart=NULL;

    icmp_hdr = (ICMP_HDR *)buf;
    icmp_hdr->icmp_type     = ICMPV4_ECHO_REQUEST_TYPE;        // request an ICMP echo
    icmp_hdr->icmp_code     = ICMPV4_ECHO_REQUEST_CODE;
    icmp_hdr->icmp_id       = (USHORT)GetCurrentProcessId();
    icmp_hdr->icmp_checksum = 0;
    icmp_hdr->icmp_sequence = 0;

    datapart = buf + sizeof(ICMP_HDR);
    //
    // Place some data in the buffer.
    //
    memset(datapart, 'E', datasize);
}

int __cdecl main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 553 of file Ping.cpp.

{

    WSADATA            wsd;
    WSAOVERLAPPED      recvol;
    SOCKET             s=INVALID_SOCKET;
    char              *icmpbuf=NULL;
    struct addrinfo   *dest=NULL,
                      *local=NULL;
    IPV4_OPTION_HDR    ipopt;
    SOCKADDR_STORAGE   from;
    DWORD              bytes,
                       flags;
    int                packetlen=0,
                       fromlen,
                       time=0,
                       rc,
                       i,
                       status = 0;

    recvol.hEvent = WSA_INVALID_EVENT;

    // Parse the command line
    if (ValidateArgs(argc, argv) == FALSE)
    {
        // invalid arguments supplied.
        status = -1;
        goto EXIT;
    }

    // Load Winsock
    if ((rc = WSAStartup(MAKEWORD(2,2), &wsd)) != 0)
    {
        printf("WSAStartup() failed: %d\n", rc);
        status = -1;
        goto EXIT;
    }

    // Resolve the destination address
    dest = ResolveAddress(
            gDestination,
            "0",
            gAddressFamily,
            0,
            0
            );
    if (dest == NULL)
    {
        printf("bad name %s\n", gDestination);
        status = -1;
        goto CLEANUP;
    }
    gAddressFamily = dest->ai_family;

    if (gAddressFamily == AF_INET)
        gProtocol = IPPROTO_ICMP;
    else if (gAddressFamily == AF_INET6)
        gProtocol = IPPROTO_ICMP6;

    // Get the bind address
    local = ResolveAddress(
            NULL,
            "0",
            gAddressFamily,
            0,
            0
            );
    if (local == NULL)
    {
        printf("Unable to obtain the bind address!\n");
        status = -1;
        goto CLEANUP;
    }

    // Create the raw socket
    s = socket(gAddressFamily, SOCK_RAW, gProtocol);
    if (s == INVALID_SOCKET)
    {
        printf("socket failed: %d\n", WSAGetLastError());
        status = -1;
        goto CLEANUP;
    }

    SetTtl(s, gTtl);

    // Figure out the size of the ICMP header and payload
    if (gAddressFamily == AF_INET)
        packetlen += sizeof(ICMP_HDR);
    else if (gAddressFamily == AF_INET6)
        packetlen += sizeof(ICMPV6_HDR) + sizeof(ICMPV6_ECHO_REQUEST);

    // Add in the data size
    packetlen += gDataSize;

    // Allocate the buffer that will contain the ICMP request
    icmpbuf = (char *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, packetlen);
    if (icmpbuf == NULL)
    {
        fprintf(stderr, "HeapAlloc failed: %d\n", GetLastError());
        status = -1;
        goto CLEANUP;
    }

    // Initialize the ICMP headers
    if (gAddressFamily == AF_INET)
    {
        if (bRecordRoute)
        {
            // Setup the IP option header to go out on every ICMP packet
            ZeroMemory(&ipopt, sizeof(ipopt));
            ipopt.opt_code = IP_RECORD_ROUTE; // record route option
            ipopt.opt_ptr  = 4;               // point to the first addr offset
            ipopt.opt_len  = 39;              // length of option header

            rc = setsockopt(s, IPPROTO_IP, IP_OPTIONS,
                    (char *)&ipopt, sizeof(ipopt));
            if (rc == SOCKET_ERROR)
            {
                fprintf(stderr, "setsockopt(IP_OPTIONS) failed: %d\n", WSAGetLastError());
                status = -1;
                goto CLEANUP;
            }
        }

        InitIcmpHeader(icmpbuf, gDataSize);
    }
    else if (gAddressFamily == AF_INET6)
    {
        InitIcmp6Header(icmpbuf, gDataSize);
    }

    // Bind the socket -- need to do this since we post a receive first
    rc = bind(s, local->ai_addr, (int)local->ai_addrlen);
    if (rc == SOCKET_ERROR)
    {
        fprintf(stderr, "bind failed: %d\n", WSAGetLastError());
        status = -1;
        goto CLEANUP;
    }

    // Setup the receive operation
    memset(&recvol, 0, sizeof(recvol));
    recvol.hEvent = WSACreateEvent();
    if (recvol.hEvent == WSA_INVALID_EVENT)
    {
        fprintf(stderr, "WSACreateEvent failed: %d\n", WSAGetLastError());
        status = -1;
        goto CLEANUP;
    }

    // Post the first overlapped receive
    fromlen = sizeof(from);
    PostRecvfrom(s, recvbuf, recvbuflen, (SOCKADDR *)&from, &fromlen, &recvol);

    printf("\nPinging ");
    PrintAddress(dest->ai_addr, (int)dest->ai_addrlen);
    printf(" with %d bytes of data\n\n", gDataSize);

    // Start sending the ICMP requests
    for(i=0; i < DEFAULT_SEND_COUNT ;i++)
    {
        // Set the sequence number and compute the checksum
        SetIcmpSequence(icmpbuf);
        ComputeIcmpChecksum(s, icmpbuf, packetlen, dest);

        time = GetTickCount();
        rc = sendto(
                s,
                icmpbuf,
                packetlen,
                0,
                dest->ai_addr,
                (int)dest->ai_addrlen
                );
        if (rc == SOCKET_ERROR)
        {
            fprintf(stderr, "sendto failed: %d\n", WSAGetLastError());
            status = -1;
            goto CLEANUP;
        }

        // Waite for a response
        rc = WaitForSingleObject((HANDLE)recvol.hEvent, DEFAULT_RECV_TIMEOUT);
        if (rc == WAIT_FAILED)
        {
            fprintf(stderr, "WaitForSingleObject failed: %d\n", GetLastError());
            status = -1;
            goto CLEANUP;
        }
        else if (rc == WAIT_TIMEOUT)
        {
            printf("Request timed out.\n");
        }
        else
        {
            rc = WSAGetOverlappedResult(
                   s,
                   &recvol,
                   &bytes,
                    FALSE,
                   &flags
                    );
            if (rc == FALSE)
            {
                fprintf(stderr, "WSAGetOverlappedResult failed: %d\n", WSAGetLastError());
            }
            time = GetTickCount() - time;

            WSAResetEvent(recvol.hEvent);

            printf("Reply from ");
            PrintAddress((SOCKADDR *)&from, fromlen);
            if (time == 0)
                printf(": bytes=%d time<1ms TTL=%d\n", gDataSize, gTtl);
            else
                printf(": bytes=%d time=%dms TTL=%d\n", gDataSize, time, gTtl);

            PrintPayload(recvbuf, bytes);

            if (i < DEFAULT_SEND_COUNT - 1)
            {
                fromlen = sizeof(from);
                PostRecvfrom(s, recvbuf, recvbuflen, (SOCKADDR *)&from, &fromlen, &recvol);
            }
        }
        Sleep(1000);
    }

CLEANUP:

    //
    // Cleanup
    //
    if (dest)
         freeaddrinfo(dest);
    if (local)
         freeaddrinfo(local);
    if (s != INVALID_SOCKET)
        closesocket(s);
    if (recvol.hEvent != WSA_INVALID_EVENT)
        WSACloseEvent(recvol.hEvent);
    if (icmpbuf)
        HeapFree(GetProcessHeap(), 0, icmpbuf);

    WSACleanup();

EXIT:
    return status;
}

int PostRecvfrom | ( | SOCKET | s,
 |  | char * | buf,
 |  | int | buflen,
 |  | SOCKADDR * | from,
 |  | int * | fromlen,
 |  | WSAOVERLAPPED * | ol
 | ) |  |

Definition at line 408 of file Ping.cpp.

{
    WSABUF  wbuf;
    DWORD   flags,
            bytes;
    int     rc;

    wbuf.buf = buf;
    wbuf.len = buflen;

    flags = 0;

    rc = WSARecvFrom(
            s,
           &wbuf,
            1,
           &bytes,
           &flags,
            from,
            fromlen,
            ol,
            NULL
            );
    if (rc == SOCKET_ERROR)
    {
        if (WSAGetLastError() != WSA_IO_PENDING)
        {
            fprintf(stderr, "WSARecvFrom failed: %d\n", WSAGetLastError());
            return SOCKET_ERROR;
        }
    }
    return NO_ERROR;
}

void PrintPayload | ( | char * | buf,
 |  | int | bytes
 | ) |  |

Definition at line 450 of file Ping.cpp.

{
    int     hdrlen=0,
            routes=0,
            i;

    UNREFERENCED_PARAMETER(bytes);

    if (gAddressFamily == AF_INET)
    {
        SOCKADDR_IN      hop;
        IPV4_OPTION_HDR *v4opt=NULL;
        IPV4_HDR        *v4hdr=NULL;

        hop.sin_family = (USHORT)gAddressFamily;
        hop.sin_port   = 0;

        v4hdr = (IPV4_HDR *)buf;
        hdrlen = (v4hdr->ip_verlen & 0x0F) * 4;

        // If the header length is greater than the size of the basic IPv4
        //    header then there are options present. Find them and print them.
        if (hdrlen > sizeof(IPV4_HDR))
        {
            v4opt = (IPV4_OPTION_HDR *)(buf + sizeof(IPV4_HDR));
            routes = (v4opt->opt_ptr / sizeof(ULONG)) - 1;
            for(i=0; i < routes ;i++)
            {
                hop.sin_addr.s_addr = v4opt->opt_addr[i];

                // Print the route
                if (i == 0)
                    printf("    Route: ");
                else
                    printf("           ");
                PrintAddress((SOCKADDR *)&hop, sizeof(hop));

                if (i < routes-1)
                    printf(" ->\n");
                else
                    printf("\n");
            }
        }
    }
    return;
}

void SetIcmpSequence ( char * buf )

Definition at line 254 of file Ping.cpp.

{
    ULONG    sequence=0;

    sequence = GetTickCount();
    if (gAddressFamily == AF_INET)
    {
        ICMP_HDR    *icmpv4=NULL;

        icmpv4 = (ICMP_HDR *)buf;

        icmpv4->icmp_sequence = (USHORT)sequence;
    }
    else if (gAddressFamily == AF_INET6)
    {
        ICMPV6_HDR          *icmpv6=NULL;
        ICMPV6_ECHO_REQUEST *req6=NULL;

        icmpv6 = (ICMPV6_HDR *)buf;
        req6   = (ICMPV6_ECHO_REQUEST *)(buf + sizeof(ICMPV6_HDR));

        req6->icmp6_echo_sequence = (USHORT)sequence;
    }
}

int SetTtl | ( | SOCKET | s,
 |  | int | ttl
 | ) |  |

Definition at line 503 of file Ping.cpp.

{
    int     optlevel = 0,
            option = 0,
            rc;

    rc = NO_ERROR;
    if (gAddressFamily == AF_INET)
    {
        optlevel = IPPROTO_IP;
        option   = IP_TTL;
    }
    else if (gAddressFamily == AF_INET6)
    {
        optlevel = IPPROTO_IPV6;
        option   = IPV6_UNICAST_HOPS;
    }
    else
    {
        rc = SOCKET_ERROR;
    }
    if (rc == NO_ERROR)
    {
        rc = setsockopt(
                s,
                optlevel,
                option,
                (char *)&ttl,
                sizeof(ttl)
                );
    }
    if (rc == SOCKET_ERROR)
    {
        fprintf(stderr, "SetTtl: setsockopt failed: %d\n", WSAGetLastError());
    }
    return rc;
}

void usage ( char * progname )

Definition at line 82 of file Ping.cpp.

{
    printf("usage: %s [options] <host> \n", progname);
    printf("        host        Remote machine to ping\n");
    printf("        options: \n");
    printf("            -a 4|6       Address family (default: AF_UNSPEC)\n");
    printf("            -i ttl       Time to live (default: 128) \n");
    printf("            -l bytes     Amount of data to send (default: 32) \n");
    printf("            -r           Record route (IPv4 only)\n");

    return;
}

BOOL ValidateArgs | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 181 of file Ping.cpp.

{
    int                i;
    BOOL               isValid = FALSE;

    for(i=1; i < argc ;i++)
    {
        if ((argv[i][0] == '-') || (argv[i][0] == '/'))
        {
            switch (tolower(argv[i][1]))
            {
                case 'a':        // address family
                    if (i+1 >= argc)
                    {
                        usage(argv[0]);
                        goto CLEANUP;
                    }
                    if (argv[i+1][0] == '4')
                        gAddressFamily = AF_INET;
                    else if (argv[i+1][0] == '6')
                        gAddressFamily = AF_INET6;
                    else
                    {
                        usage(argv[0]);
                        goto CLEANUP;
                    }

                    i++;
                    break;
                case 'i':        // Set TTL value
                    if (i+1 >= argc)
                    {
                        usage(argv[0]);
                        goto CLEANUP;
                    }

                    gTtl = atoi(argv[++i]);
                    break;
                case 'l':        // buffer size tos end
                    if (i+1 >= argc)
                    {
                        usage(argv[0]);
                        goto CLEANUP;
                    }

                    gDataSize = atoi(argv[++i]);
                    break;
                case 'r':        // record route option
                    bRecordRoute = TRUE;
                    break;
                default:
                    usage(argv[0]);
                    goto CLEANUP;
            }
        }
        else
        {
            gDestination = argv[i];
        }
    }

    isValid = TRUE;

CLEANUP:
    return isValid;
}

Variable Documentation

BOOL bRecordRoute = FALSE

Definition at line 70 of file Ping.cpp.

int gAddressFamily = AF_UNSPEC

Definition at line 66 of file Ping.cpp.

int gDataSize = DEFAULT_DATA_SIZE

Definition at line 69 of file Ping.cpp.

char* gDestination = NULL

Definition at line 71 of file Ping.cpp.

int gProtocol = IPPROTO_ICMP

Definition at line 67 of file Ping.cpp.

int gTtl = DEFAULT_TTL

Definition at line 68 of file Ping.cpp.

char recvbuf[MAX_RECV_BUF_LEN]

Definition at line 71 of file Ping.cpp.

int recvbuflen = MAX_RECV_BUF_LEN

Definition at line 73 of file Ping.cpp.

Generated on Wed Nov 13 2024 16:54:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/Ping/resolve.cpp File Reference

  • NetDS
  • WinSock
  • Ping
Functions

resolve.cpp File Reference

#include <winsock2.h>
#include <ws2tcpip.h>
#include <strsafe.h>
#include <stdio.h>
#include <stdlib.h>
#include "resolve.h"

Go to the source code of this file.

Functions

int | FormatAddress (SOCKADDR *sa, int salen, char *addrbuf, int addrbuflen)
int | PrintAddress (SOCKADDR *sa, int salen)
struct addrinfo * | ResolveAddress (char *addr, char *port, int af, int type, int proto)
int | ReverseLookup (SOCKADDR *sa, int salen, char *buf, int buflen)

Function Documentation

int FormatAddress | ( | SOCKADDR * | sa,
 |  | int | salen,
 |  | char * | addrbuf,
 |  | int | addrbuflen
 | ) |  |

Definition at line 84 of file resolve.cpp.

{
    char    host[NI_MAXHOST],
            serv[NI_MAXSERV];
    int     hostlen = NI_MAXHOST,
            servlen = NI_MAXSERV,
            rc;
    HRESULT hRet;

    rc = getnameinfo(
            sa,
            salen,
            host,
            hostlen,
            serv,
            servlen,
            NI_NUMERICHOST | NI_NUMERICSERV
            );
    if (rc != 0)
    {
        fprintf(stderr, "%s: getnameinfo failed: %d\n", __FILE__, rc);
        return rc;
    }

    if ( (strlen(host) + strlen(serv) + 1) > (unsigned)addrbuflen)
        return WSAEFAULT;

    addrbuf[0] = '\0';

    if (sa->sa_family == AF_INET)
    {
        if(FAILED(hRet = StringCchPrintf(addrbuf, addrbuflen, "%s:%s", host, serv)))
        {
            fprintf(stderr,"%s StringCchPrintf failed: 0x%x\n",__FILE__,hRet);
            return (int)hRet;
        }
    }
    else if (sa->sa_family == AF_INET6)
    {
        if(FAILED(hRet = StringCchPrintf(addrbuf, addrbuflen, "[%s]:%s", host, serv)))
        {
            fprintf(stderr,"%s StringCchPrintf failed: 0x%x\n",__FILE__,hRet);
            return (int)hRet;
        }
    }

    return NO_ERROR;
}

int PrintAddress | ( | SOCKADDR * | sa,
 |  | int | salen
 | ) |  |

Definition at line 39 of file resolve.cpp.

{
    char    host[NI_MAXHOST],
            serv[NI_MAXSERV];
    int     hostlen = NI_MAXHOST,
            servlen = NI_MAXSERV,
            rc;

    rc = getnameinfo(
            sa,
            salen,
            host,
            hostlen,
            serv,
            servlen,
            NI_NUMERICHOST | NI_NUMERICSERV
            );
    if (rc != 0)
    {
        fprintf(stderr, "%s: getnameinfo failed: %d\n", __FILE__, rc);
        return rc;
    }

    // If the port is zero then don't print it
    if (strcmp(serv, "0") != 0)
    {
        if (sa->sa_family == AF_INET)
            printf("[%s]:%s", host, serv);
        else
            printf("%s:%s", host, serv);
    }
    else
        printf("%s", host);

    return NO_ERROR;
}

struct addrinfo* ResolveAddress | ( | char * | addr,
 |  | char * | port,
 |  | int | af,
 |  | int | type,
 |  | int | proto |
 | ) |  |  | [read]

Definition at line 144 of file resolve.cpp.

{
    struct addrinfo hints,
    *res = NULL;
    int             rc;

    memset(&hints, 0, sizeof(hints));
    hints.ai_flags  = ((addr) ? 0 : AI_PASSIVE);
    hints.ai_family = af;
    hints.ai_socktype = type;
    hints.ai_protocol = proto;

    rc = getaddrinfo(
            addr,
            port,
           &hints,
           &res
            );
    if (rc != 0)
    {
        fprintf(stderr, "Invalid address %s, getaddrinfo failed: %d\n", addr, rc);
        return NULL;
    }
    return res;
}

int ReverseLookup | ( | SOCKADDR * | sa,
 |  | int | salen,
 |  | char * | buf,
 |  | int | buflen
 | ) |  |

Definition at line 177 of file resolve.cpp.

{
    char    host[NI_MAXHOST];
    int     hostlen=NI_MAXHOST,
            rc;
    HRESULT hRet;

    rc = getnameinfo(
            sa,
            salen,
            host,
            hostlen,
            NULL,
            0,
            0
            );
    if (rc != 0)
    {
        fprintf(stderr, "getnameinfo failed: %d\n", rc);
        return rc;
    }

    buf[0] = '\0';
    if(FAILED(hRet = StringCchCopy(buf, buflen, host)))
    {
        fprintf(stderr,"StringCchCopy failed: 0x%x\n",hRet);
        return (int)hRet;
    }

    return NO_ERROR;
}

Generated on Wed Nov 13 2024 16:54:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/Ping/resolve.h File Reference

  • NetDS
  • WinSock
  • Ping
Functions

resolve.h File Reference

Go to the source code of this file.

Functions

int | FormatAddress (SOCKADDR *sa, int salen, char *addrbuf, int addrbuflen)
int | PrintAddress (SOCKADDR *sa, int salen)
struct addrinfo * | ResolveAddress (char *addr, char *port, int af, int type, int proto)
int | ReverseLookup (SOCKADDR *sa, int salen, char *namebuf, int namebuflen)

Function Documentation

int FormatAddress | ( | SOCKADDR * | sa,
 |  | int | salen,
 |  | char * | addrbuf,
 |  | int | addrbuflen
 | ) |  |

Definition at line 87 of file resolve.c.

{
    char    host[NI_MAXHOST],
            serv[NI_MAXSERV];
    int     hostlen = NI_MAXHOST,
            servlen = NI_MAXSERV,
            rc;

    // Validate input
    if ((sa == NULL) || (addrbuf == NULL))
        return WSAEFAULT;

    // Format the name
    rc = getnameinfo(
            sa,
            salen,
            host,
            hostlen,
            serv,
            servlen,
            NI_NUMERICHOST | NI_NUMERICSERV     // Convert to numeric representation
            );
    if (rc != 0)
    {
        fprintf(stderr, "%s: getnameinfo failed: %d\n", __FILE__, rc);
        return rc;
    }
    if ( (strlen(host) + strlen(serv) + 1) > (unsigned)addrbuflen)
        return WSAEFAULT;
    if (strncmp(serv, "0", 1) != 0)
    {
        if (sa->sa_family == AF_INET)
            _snprintf(addrbuf, addrbuflen-1, "%s:%s", host, serv);
        else if (sa->sa_family == AF_INET6)
            _snprintf(addrbuf, addrbuflen-1, "[%s]:%s", host, serv);
        else
            addrbuf[0] = '\0';
    }
    else
    {
        _snprintf(addrbuf, addrbuflen-1, "%s", host);
    }

    return NO_ERROR;
}

int PrintAddress | ( | SOCKADDR * | sa,
 |  | int | salen
 | ) |  |

Definition at line 38 of file resolve.c.

{
    char    host[NI_MAXHOST],
            serv[NI_MAXSERV];
    int     hostlen = NI_MAXHOST,
            servlen = NI_MAXSERV,
            rc;

    // Validate argument
    if (sa == NULL)
        return WSAEFAULT;

    rc = getnameinfo(
            sa,
            salen,
            host,
            hostlen,
            serv,
            servlen,
            NI_NUMERICHOST | NI_NUMERICSERV
            );
    if (rc != 0)
    {
        fprintf(stderr, "%s: getnameinfo failed: %d\n", __FILE__, rc);
        return rc;
    }

    // If the port is zero then don't print it
    if (strncmp(serv, "0", 1) != 0)
    {
        if (sa->sa_family == AF_INET6)
            printf("[%s]:%s", host, serv);
        else
            printf("%s:%s", host, serv);
    }
    else
        printf("%s", host);

    return NO_ERROR;
}

struct addrinfo* ResolveAddress | ( | char * | addr,
 |  | char * | port,
 |  | int | af,
 |  | int | type,
 |  | int | proto |
 | ) |  |  | [read]

Definition at line 142 of file resolve.c.

{
    struct addrinfo hints,
    *res = NULL;
    int             rc;

    memset(&hints, 0, sizeof(hints));
    hints.ai_flags  = ((addr) ? 0 : AI_PASSIVE);
    hints.ai_family = af; //((addr) ? AF_UNSPEC : af);
    hints.ai_socktype = type;
    hints.ai_protocol = proto;

    rc = getaddrinfo(
            addr,
            port,
           &hints,
           &res
            );
    if (rc != 0)
    {
        printf("Invalid address %s, getaddrinfo failed: %d\n", addr, rc);
        return NULL;
    }
    return res;
}

int ReverseLookup | ( | SOCKADDR * | sa,
 |  | int | salen,
 |  | char * | namebuf,
 |  | int | namebuflen
 | ) |  |

Definition at line 175 of file resolve.c.

{
    char    host[NI_MAXHOST];
    int     hostlen=NI_MAXHOST,
            rc;

    // Validate parameters
    if ((sa == NULL) || (buf == NULL))
        return WSAEFAULT;

    rc = getnameinfo(
            sa,
            salen,
            host,
            hostlen,
            NULL,
            0,
            0
            );
    if (rc != 0)
    {
        fprintf(stderr, "getnameinfo failed: %d\n", rc);
        return rc;
    }

    strncpy(buf, host, buflen-1);

    return NO_ERROR;
}

Generated on Wed Nov 13 2024 16:54:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/rcvall/iphdr.h File Reference

  • NetDS
  • WinSock
  • rcvall
Classes | Typedefs

iphdr.h File Reference

#include <pshpack1.h>
#include <poppack.h>

Go to the source code of this file.

Classes

struct | igmp_group_record_v3
struct | igmp_hdr
struct | igmp_hdr_query_v3
struct | igmp_hdr_report_v3
struct | ip_hdr
struct | ipv6_fragment_hdr
struct | ipv6_hdr
struct | port_hdr
struct | tpc_hdr
struct | udp_hdr

Typedefs

typedef struct igmp_group_record_v3 | IGMP_GROUP_RECORD_V3
typedef struct igmp_hdr | IGMP_HDR
typedef struct igmp_hdr_query_v3 | IGMP_HDR_QUERY_V3
typedef struct igmp_hdr_report_v3 | IGMP_HDR_REPORT_V3
typedef struct ip_hdr | IPV4_HDR
typedef struct ipv6_fragment_hdr | IPV6_FRAGMENT_HDR
typedef struct ipv6_hdr | IPV6_HDR
typedef struct ip_hdr * | LPIPV4_HDR
typedef struct ipv6_fragment_hdr * | LPIPV6_FRAGMENT_HDR
typedef struct ipv6_hdr * | LPIPV6_HDR
typedef struct
igmp_group_record_v3 * 		PIGMP_GROUP_RECORD_V3
typedef struct igmp_hdr * | PIGMP_HDR
typedef struct igmp_hdr_query_v3 * | PIGMP_HDR_QUERY_V3
typedef struct igmp_hdr_report_v3 * | PIGMP_HDR_REPORT_V3
typedef struct ip_hdr * | PIPV4_HDR
typedef struct ipv6_fragment_hdr * | PIPV6_FRAGMENT_HDR
typedef struct ipv6_hdr * | PIPV6_HDR
typedef struct port_hdr | PORT_HDR
typedef struct port_hdr * | PPORT_HDR
typedef struct tpc_hdr * | PTCP_HDR
typedef struct udp_hdr * | PUDP_HDR
typedef struct tpc_hdr | TCP_HDR
typedef struct udp_hdr | UDP_HDR

Typedef Documentation

typedef struct igmp_group_record_v3 IGMP_GROUP_RECORD_V3
typedef struct igmp_hdr IGMP_HDR
typedef struct igmp_hdr_query_v3 IGMP_HDR_QUERY_V3
typedef struct igmp_hdr_report_v3 IGMP_HDR_REPORT_V3
typedef struct ip_hdr IPV4_HDR
typedef struct ipv6_fragment_hdr IPV6_FRAGMENT_HDR
typedef struct ipv6_hdr IPV6_HDR
typedef struct ip_hdr* LPIPV4_HDR
typedef struct ipv6_fragment_hdr* LPIPV6_FRAGMENT_HDR
typedef struct ipv6_hdr* LPIPV6_HDR
typedef struct igmp_group_record_v3 * PIGMP_GROUP_RECORD_V3
typedef struct igmp_hdr * PIGMP_HDR
typedef struct igmp_hdr_query_v3 * PIGMP_HDR_QUERY_V3
typedef struct igmp_hdr_report_v3 * PIGMP_HDR_REPORT_V3
typedef struct ip_hdr * PIPV4_HDR
typedef struct ipv6_fragment_hdr * PIPV6_FRAGMENT_HDR
typedef struct ipv6_hdr * PIPV6_HDR
typedef struct port_hdr PORT_HDR
typedef struct port_hdr * PPORT_HDR
typedef struct tpc_hdr * PTCP_HDR
typedef struct udp_hdr * PUDP_HDR
typedef struct tpc_hdr TCP_HDR
typedef struct udp_hdr UDP_HDR
Generated on Wed Nov 13 2024 16:54:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/rcvall/parser.c File Reference

  • NetDS
  • WinSock
  • rcvall
Functions | Variables

parser.c File Reference

#include <winsock2.h>
#include <ws2tcpip.h>
#include <stdio.h>
#include <stdlib.h>
#include "parser.h"
#include "resolve.h"
#include "iphdr.h"

Go to the source code of this file.

Functions

int | CheckForMatchIPv4 (unsigned int filtermask, SOCKADDR *srcfilter, SOCKADDR *destfilter, IPV4_HDR *hdr, char *nexthdr)
int | DecodeIPHeader (char *buf, int buflen, unsigned long filtermask, SOCKADDR *srcfilter, SOCKADDR *destfilter)
void | PrintIgmpHeader (IGMP_HDR *igmphdr, int len)
void | PrintIpv4Header (IPV4_HDR *v4hdr, int len)
void | PrintTcpHeader (TCP_HDR *tcphdr, int len)
void | PrintUdpHeader (UDP_HDR *udphdr, int len)

Variables

char * | szIgmpMode []
char * | szIgmpType []
char * | szProto []

Function Documentation

int CheckForMatchIPv4 | ( | unsigned int | filtermask,
 |  | SOCKADDR * | srcfilter,
 |  | SOCKADDR * | destfilter,
 |  | IPV4_HDR * | hdr,
 |  | char * | nexthdr
 | ) |  |

Definition at line 484 of file parser.c.

{
    PORT_HDR *ports=NULL;
    int      match = 0;

    match = 1;
    ports = (PORT_HDR *)nexthdr;

    // Try to match source address if specified
    if ((match) && (filtermask & FILTER_MASK_SOURCE_ADDRESS))
    {
        match = !memcmp(
               &((SOCKADDR_IN *)srcfilter)->sin_addr.s_addr,
               &hdr->ip_srcaddr,
                sizeof(unsigned long)
                );
    }
    // Try to match the destination address if specified
    if ((match) && (filtermask & FILTER_MASK_DESTINATION_ADDRESS))
    {
        match = !memcmp(
               &((SOCKADDR_IN *)destfilter)->sin_addr.s_addr,
               &hdr->ip_destaddr,
                sizeof(unsigned long)
                );
    }
    // Try to match source port if specified and ports is not NULL (i.e. its TCP or UDP)
    if ((match) && (ports) && (filtermask & FILTER_MASK_SOURCE_PORT))
    {
        match = ( ((SOCKADDR_IN *)srcfilter)->sin_port == ports->src_portno );
    }
    else if ((ports == NULL) && (filtermask & FILTER_MASK_SOURCE_PORT))
    {
        match = 0;
    }

    // Try to match destination port if specified and ports is not NULL (i.e. its TCP or UDP)
    if ((match) && (ports) && (filtermask & FILTER_MASK_DESTINATION_PORT))
    {
        match = ( ((SOCKADDR_IN *)destfilter)->sin_port == ports->dest_portno );
    }
    else if ((ports == NULL) && (filtermask & FILTER_MASK_DESTINATION_PORT))
    {
        match = 0;
    }

    return match;
}

int DecodeIPHeader | ( | char * | buf,
 |  | int | buflen,
 |  | unsigned long | filtermask,
 |  | SOCKADDR * | srcfilter,
 |  | SOCKADDR * | destfilter
 | ) |  |

Definition at line 547 of file parser.c.

{
    IPV4_HDR    *ipv4hdr=NULL;
    UDP_HDR     *udphdr=NULL;
    TCP_HDR     *tcphdr=NULL;
    IGMP_HDR    *igmphdr=NULL;
    BOOL         bFilterMatch = FALSE;
    int          ip_version = 0,
                 ipv4_header_len = 0;
    char        *ptr=NULL;

    printf("buflen = %d\n", buflen);

    // Make sure we can at least extract the IP version
    if (buflen < sizeof(char))
    {
        return SOCKET_ERROR;
    }

    // Check the IP version
    ip_version = HI_BYTE(*buf);

    if (ip_version == 4)
    {
        // Verify the buffer is large enough
        if (buflen < sizeof(IPV4_HDR))
        {
            fprintf(stderr, "Received buffer too small!\n");
            return SOCKET_ERROR;
        }

        // Get length of IPv4 header to determine where next protocol header begins
        ipv4_header_len = LO_BYTE(*buf) * 4;

        ipv4hdr = (IPV4_HDR *)buf;

        bFilterMatch = TRUE;

        // Test for match (if filter specified) and get pointer to next protocol header
        switch (ipv4hdr->ip_protocol)
        {
            case IPPROTO_UDP:

                udphdr = (UDP_HDR *) &buf[ipv4_header_len];
                if (filtermask)
                    bFilterMatch = CheckForMatchIPv4(filtermask, srcfilter, destfilter, ipv4hdr, (char *)udphdr);
                break;

            case IPPROTO_TCP:

                tcphdr = (TCP_HDR *) &buf[ipv4_header_len];
                if (filtermask)
                    bFilterMatch = CheckForMatchIPv4(filtermask, srcfilter, destfilter, ipv4hdr, (char *)tcphdr);
                break;

            case IPPROTO_IGMP:

                igmphdr = (IGMP_HDR *) &buf[ipv4_header_len];
                if (filtermask)
                    bFilterMatch = CheckForMatchIPv4(filtermask, srcfilter, destfilter, ipv4hdr, NULL);
                break;

            default:

                // Don't know about this protocol so if we're filtering, don't print it
                if (filtermask)
                    bFilterMatch = FALSE;

                break;
        }

        // If this packet matches, then print it
        if (bFilterMatch)
        {
            PrintIpv4Header(ipv4hdr, buflen);

            switch (ipv4hdr->ip_protocol)
            {
                case IPPROTO_UDP:

                    PrintUdpHeader(udphdr, buflen - ipv4_header_len);
                    break;

                case IPPROTO_TCP:

                    PrintTcpHeader(tcphdr, buflen - ipv4_header_len);
                    break;

                case IPPROTO_IGMP:

                    PrintIgmpHeader(igmphdr, buflen - ipv4_header_len);
                    break;

                default:

                    printf("   No decoder for protocol: %d\n", ipv4hdr->ip_protocol);
                    break;

            }
            printf("\n");
        }

    }
    else if (ip_version == 6)
    {
        fprintf(stderr, "Currently don't support decoding IPv6 headers\n");
        return SOCKET_ERROR;
    }

    return NO_ERROR;
}

void PrintIgmpHeader | ( | IGMP_HDR * | igmphdr,
 |  | int | len
 | ) |  |

Definition at line 283 of file parser.c.

{
    SOCKADDR_IN sa4 = {0};
    char        addrbuf[INET_ADDRSTRLEN] = {'\0'};
    int         i = 0;

    if (
#ifdef INEFFICIENT
        // In case you need to modify the code, the following conditional will
        //    distinguish between individual messages and versions...

        // IGMP membership query v1
        ( (igmphdr->version_type == 0x11) && (igmphdr->max_resp_time == 0) && (len == sizeof(IGMP_HDR)) ) ||

        // IGMP membership report v1
        ( (igmphdr->version_type == 0x12) && (igmphdr->max_resp_time == 0) && (len == sizeof(IGMP_HDR)) ) ||

        // IGMP membership query v2
        ( (igmphdr->version_type == 0x11) && (igmphdr->max_resp_time != 0) && (len == sizeof(IGMP_HDR)) ) ||

        // IGMP membership report v2
        ( (igmphdr->version_type == 0x16) && (igmphdr->max_resp_time != 0) && (len == sizeof(IGMP_HDR)) ) ||

        // IGMP leave group (v2)
        ( igmphdr->version_type == 0x17 )
#else
        ( len == sizeof(IGMP_HDR) )
#endif
       )
    {
        if ( (LO_BYTE(igmphdr->version_type) >= 0) &&
             (LO_BYTE(igmphdr->version_type)  < (sizeof(szIgmpType) / sizeof(char *)))
             )
            printf("IGMP: Version         %2d : Type %16s : Maximum Response Time %d\n",
                    HI_BYTE(igmphdr->version_type), szIgmpType[LO_BYTE(igmphdr->version_type)],
                    igmphdr->max_resp_time);
        else
            printf("IGMP: Version         %2d : Type %16d : Maximum Response Time %d\n",
                    HI_BYTE(igmphdr->version_type), LO_BYTE(igmphdr->version_type),
                    igmphdr->max_resp_time);

        // Print the group address
        sa4.sin_family = AF_INET;
        sa4.sin_addr.s_addr = igmphdr->group_addr;
        FormatAddress((SOCKADDR *)&sa4, sizeof(sa4), addrbuf, INET_ADDRSTRLEN);
        printf("IGMP: Checksum    0x%04x : Group      %s\n",
                igmphdr->checksum, addrbuf);
    }
    else if ( (igmphdr->version_type == 0x11) && (len > sizeof(IGMP_HDR)) )
    {
        IGMP_HDR_QUERY_V3 *query=NULL;

        //
        // IGMP membership query v3
        //

        query = (IGMP_HDR_QUERY_V3 *)igmphdr;

        // Verify data is big enough to contain the entire packet
        if ( (len < sizeof(IGMP_HDR_QUERY_V3)) ||
             (len < (int) (sizeof(IGMP_HDR_QUERY_V3) + (sizeof(ULONG) * (query->num_sources-1))) )
           )
        {
            printf("IGMP: Invalid packet\n");
            return;
        }

        printf("IGMP: Version           3 : Type Membership Query : Maximum Response Time %d\n",
                query->max_resp_time);

        // Print the group address
        sa4.sin_family = AF_INET;
        sa4.sin_addr.s_addr = query->group_addr;
        FormatAddress((SOCKADDR *)&sa4, sizeof(sa4), addrbuf, INET_ADDRSTRLEN);
        printf("IGMP: Checksum    0x%04x : Group      %s\n",
                query->checksum, addrbuf);

        printf("IGMP: Resv 0x%1x : S 0x%1x : QRV 0x%1x : QQIC 0x%02x\n",
                (query->resv_suppr_robust >> 4),
                ((query->resv_suppr_robust >> 3) & 0x1),
                (query->resv_suppr_robust && 0x7),
                query->qqi
                );
        printf("IGMP: Source Count: %lu\n",
                ntohl(query->num_sources));

        // Print out the array of source addresses
        for(i=0; i < (int)ntohl(query->num_sources) ;i++)
        {
            sa4.sin_addr.s_addr = query->sources[i];
            FormatAddress((SOCKADDR *)&sa4, sizeof(sa4), addrbuf, INET_ADDRSTRLEN);
            printf("IGMP: Source [%02d] %s\n", i, addrbuf);
        }

    }
    else if ( (igmphdr->version_type == 0x22) && (len > sizeof(IGMP_HDR)) )
    {
        IGMP_HDR_REPORT_V3   *report=NULL;
        IGMP_GROUP_RECORD_V3 *group=NULL;
        ULONG                 totalrecordslen = 0,
                              recordlen = 0,
                              offset = 0;
        char                 *ptr=NULL;
        int                   j = 0;

        //
        // IGMP membership report v3
        //

        report = (IGMP_HDR_REPORT_V3 *)igmphdr;

        // Safe to touch these fields as we already know the packet is at least
        //    8 bytes in length.
        printf("IGMP: Membership Report : Reserved          0x%02x : Checksum 0x%04x\n",
                report->reserved1, report->checksum);
        printf("IGMP: Resereved  0x%04x : Number of Records %d\n",
                report->reserved2, ntohs(report->num_records));

        // Get a pointer to start of records;
        ptr = (char *)report + sizeof(IGMP_HDR_REPORT_V3);
        offset = 0;
        i = 0;

        totalrecordslen = len - sizeof(IGMP_HDR_REPORT_V3);

        // Go through each of the IGMP group records
        while (offset < totalrecordslen)
        {
            // Get a pointer to the group record
            group = (IGMP_GROUP_RECORD_V3 *) &ptr[offset];

            // Make sure we have enough for group record header (note: we subtract
            //    off the size of the one source which may or may not be present).
            //    The goal is to make sure we can safely read the num_sources field.
            if ((offset + sizeof(IGMP_GROUP_RECORD_V3) - sizeof(ULONG)) > totalrecordslen)
            {
                printf("IGMP: Invalid packet\n");
                break;
            }

            // Compute size of this record
            recordlen =  sizeof(IGMP_GROUP_RECORD_V3) +
                        (sizeof(ULONG) * (ntohs(group->num_sources) - 1)) +
                         group->aux_data_len;
            offset += recordlen;

            // Make sure we have enough for the whole record
            if (offset > totalrecordslen)
            {
                printf("IGMP: Invalid packet\n");
                break;
            }

            // Make sure 'type' is in the array of strings if not just print the
            //    integer value
            if ((group->type >= 0) && (group->type < (sizeof(szIgmpMode) / sizeof(char *))) )
                printf("IGMP RECORD [%02d]: Type %16s : Aux Data Len  %d\n",
                        i, szIgmpMode[group->type], group->aux_data_len);
            else
                printf("IGMP RECORD [%02d]: Type %16d : Aux Data Len  %d\n",
                        i, group->type, group->aux_data_len);

            // Print the group address
            sa4.sin_family = AF_INET;
            sa4.sin_addr.s_addr = group->group_addr;
            FormatAddress((SOCKADDR *)&sa4, sizeof(sa4), addrbuf, INET_ADDRSTRLEN);
            printf("IGMP RECORD [%02d]: Number of Sources %9d : Group Address %s\n",
                    i, ntohs(group->num_sources), addrbuf);

            // Print the list of sources
            for(j=0; j < ntohs(group->num_sources) ;j++)
            {
                sa4.sin_addr.s_addr = group->source_addr[j];
                FormatAddress((SOCKADDR *)&sa4, sizeof(sa4), addrbuf, INET_ADDRSTRLEN);
                printf("IGMP_RECORD [%02d]: Source [%02d] %s\n",
                        i, j, addrbuf);
            }

            i++;
        }
    }
    else
    {
        printf("IGMP: Invalid packet\n");
    }
}

void PrintIpv4Header | ( | IPV4_HDR * | v4hdr,
 |  | int | len
 | ) |  |

Definition at line 180 of file parser.c.

{
    SOCKADDR_IN sa4 = {0};
    char        srcaddr[INET_ADDRSTRLEN] = {'\0'},
                destaddr[INET_ADDRSTRLEN] = {'\0'};

    printf("IPv4: Version         %2d : Length     %2d : Type of Service 0x%02x\n",
            HI_BYTE(v4hdr->ip_verlen), LO_BYTE(v4hdr->ip_verlen) * 4, v4hdr->ip_tos);
    printf("IPv4: Total Length %5d : ID     0x%04x : Time to Live    %d\n",
            ntohs(v4hdr->ip_totallength), ntohs(v4hdr->ip_offset), v4hdr->ip_ttl);
    // Make sure protocol value is in the array of szProto
    if ((v4hdr->ip_protocol >= 0) && (v4hdr->ip_protocol < (sizeof(szProto) / sizeof(char *))))
        printf("IPv4: Protocol %9s : Checksum 0x%04x\n",
                szProto[v4hdr->ip_protocol], v4hdr->ip_checksum);
    else
        printf("IPv4: Protocol %9d : Checksum 0x%04x\n",
                v4hdr->ip_protocol, v4hdr->ip_checksum);

    sa4.sin_family = AF_INET;
    sa4.sin_port   = 0;
    sa4.sin_addr.s_addr = v4hdr->ip_srcaddr;
    FormatAddress((SOCKADDR *)&sa4, sizeof(sa4), srcaddr, INET_ADDRSTRLEN);

    sa4.sin_addr.s_addr = v4hdr->ip_destaddr;
    FormatAddress((SOCKADDR *)&sa4, sizeof(sa4), destaddr, INET_ADDRSTRLEN);

    printf("IPv4: Source Address       %s\nIPv4: Destination Address  %s\n",
            srcaddr, destaddr);

}

void PrintTcpHeader | ( | TCP_HDR * | tcphdr,
 |  | int | len
 | ) |  |

Definition at line 239 of file parser.c.

{
    USHORT flags = 0;

    printf("TCP: Source Port      %6d : Destination Port %6d\n",
            ntohs(tcphdr->src_portno), ntohs(tcphdr->dest_portno));
    printf("TCP: Sequence Num %10lu : ACK %10lu\n",
            ntohl(tcphdr->seq_num), ntohl(tcphdr->ack_num));
    printf("TCP: Length           %6d : Flags ",
            ((ntohs(tcphdr->lenflags) >> 12) * 4));

    flags = (ntohs(tcphdr->lenflags) & 0x3F);
    if (flags & 0x20)
        printf("URG ");
    if (flags & 0x10)
        printf("ACK ");
    if (flags & 0x08)
        printf("PSH ");
    if (flags & 0x04)
        printf("RST ");
    if (flags & 0x02)
        printf("SYN ");
    if (flags & 0x01)
        printf("FIN ");
    printf("\n");
    printf("TCP: Window Size  %10d : Checksum 0x%04x : Urgent Pointer 0x%04x\n",
            ntohs(tcphdr->window_size), ntohs(tcphdr->tcp_checksum),
            ntohs(tcphdr->tcp_urgentptr));
}

void PrintUdpHeader | ( | UDP_HDR * | udphdr,
 |  | int | len
 | ) |  |

Definition at line 221 of file parser.c.

{
    printf("UDP: Source Port  %6d : Destination Port %6d\n",
            ntohs(udphdr->src_portno), ntohs(udphdr->dest_portno));
    printf("UDP: Length     %8d : Checksum        0x4%x\n",
            ntohs(udphdr->udp_length), udphdr->udp_checksum);
}

Variable Documentation

char* szIgmpMode[]
Initial value:
 {"Invalid-Mode-0",
                      "MODE_IS_INCLUDE",
                      "MODE_IS_EXCLUDE",
                      "CHANGE_TO_INCLUDE_MODE",
                      "CHANGE_TO_EXCLUDE_MODE",
                      "ALLOW_NEW_SOURCES",
                      "BLOCK_OLD_SOURCES"
                      "Invalid-Mode-7",
                      "Invalid-Mode-8"
                     }

Definition at line 162 of file parser.c.

char* szIgmpType[]
Initial value:
 {"Invalid - 0",
                      "Host Membership Query",
                      "Host Membership Report",
                      "Invalid - 3",
                      "Invalid - 4",
                      "Invalid - 5",
                      "Version 2 Membership Report",
                      "Leave Group"
                     }

Definition at line 149 of file parser.c.

char* szProto[]

Definition at line 43 of file parser.c.

Generated on Wed Nov 13 2024 16:54:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/rcvall/parser.h File Reference

  • NetDS
  • WinSock
  • rcvall
Defines | Functions

parser.h File Reference

Go to the source code of this file.

Defines

#define | FILTER_MASK_DESTINATION_ADDRESS 0x04
#define | FILTER_MASK_DESTINATION_PORT 0x08
#define | FILTER_MASK_SOURCE_ADDRESS 0x01
#define | FILTER_MASK_SOURCE_PORT 0x02
#define | HI_BYTE(byte) (((byte) >> 4) & 0x0F)
#define | LO_BYTE(byte) ((byte) & 0x0F)
#define | MAX_IP_SIZE 65535
#define | MIN_IP_HDR_SIZE 20

Functions

int | DecodeIGMPHeader (char *buf, DWORD iphdrlen)
int | DecodeIPHeader (char *buf, int buflen, unsigned long filtermask, SOCKADDR *srcfilter, SOCKADDR *destfilter)
int | DecodeTCPHeader (char *buf, DWORD iphdrlen)
int | DecodeUDPHeader (char *buf, DWORD iphdrlen)
void | PrintRawBytes (BYTE *ptr, DWORD len)

Define Documentation

#define FILTER_MASK_DESTINATION_ADDRESS 0x04

Definition at line 21 of file parser.h.

#define FILTER_MASK_DESTINATION_PORT 0x08

Definition at line 22 of file parser.h.

#define FILTER_MASK_SOURCE_ADDRESS 0x01

Definition at line 19 of file parser.h.

#define FILTER_MASK_SOURCE_PORT 0x02

Definition at line 20 of file parser.h.

#define HI_BYTE ( byte ) (((byte) >> 4) & 0x0F)

Definition at line 13 of file parser.h.

#define LO_BYTE ( byte ) ((byte) & 0x0F)

Definition at line 14 of file parser.h.

#define MAX_IP_SIZE 65535

Definition at line 7 of file parser.h.

#define MIN_IP_HDR_SIZE 20

Definition at line 8 of file parser.h.

Function Documentation

int DecodeIGMPHeader | ( | char * | buf,
 |  | DWORD | iphdrlen
 | ) |  |
int DecodeIPHeader | ( | char * | buf,
 |  | int | buflen,
 |  | unsigned long | filtermask,
 |  | SOCKADDR * | srcfilter,
 |  | SOCKADDR * | destfilter
 | ) |  |

Definition at line 547 of file parser.c.

{
    IPV4_HDR    *ipv4hdr=NULL;
    UDP_HDR     *udphdr=NULL;
    TCP_HDR     *tcphdr=NULL;
    IGMP_HDR    *igmphdr=NULL;
    BOOL         bFilterMatch = FALSE;
    int          ip_version = 0,
                 ipv4_header_len = 0;
    char        *ptr=NULL;

    printf("buflen = %d\n", buflen);

    // Make sure we can at least extract the IP version
    if (buflen < sizeof(char))
    {
        return SOCKET_ERROR;
    }

    // Check the IP version
    ip_version = HI_BYTE(*buf);

    if (ip_version == 4)
    {
        // Verify the buffer is large enough
        if (buflen < sizeof(IPV4_HDR))
        {
            fprintf(stderr, "Received buffer too small!\n");
            return SOCKET_ERROR;
        }

        // Get length of IPv4 header to determine where next protocol header begins
        ipv4_header_len = LO_BYTE(*buf) * 4;

        ipv4hdr = (IPV4_HDR *)buf;

        bFilterMatch = TRUE;

        // Test for match (if filter specified) and get pointer to next protocol header
        switch (ipv4hdr->ip_protocol)
        {
            case IPPROTO_UDP:

                udphdr = (UDP_HDR *) &buf[ipv4_header_len];
                if (filtermask)
                    bFilterMatch = CheckForMatchIPv4(filtermask, srcfilter, destfilter, ipv4hdr, (char *)udphdr);
                break;

            case IPPROTO_TCP:

                tcphdr = (TCP_HDR *) &buf[ipv4_header_len];
                if (filtermask)
                    bFilterMatch = CheckForMatchIPv4(filtermask, srcfilter, destfilter, ipv4hdr, (char *)tcphdr);
                break;

            case IPPROTO_IGMP:

                igmphdr = (IGMP_HDR *) &buf[ipv4_header_len];
                if (filtermask)
                    bFilterMatch = CheckForMatchIPv4(filtermask, srcfilter, destfilter, ipv4hdr, NULL);
                break;

            default:

                // Don't know about this protocol so if we're filtering, don't print it
                if (filtermask)
                    bFilterMatch = FALSE;

                break;
        }

        // If this packet matches, then print it
        if (bFilterMatch)
        {
            PrintIpv4Header(ipv4hdr, buflen);

            switch (ipv4hdr->ip_protocol)
            {
                case IPPROTO_UDP:

                    PrintUdpHeader(udphdr, buflen - ipv4_header_len);
                    break;

                case IPPROTO_TCP:

                    PrintTcpHeader(tcphdr, buflen - ipv4_header_len);
                    break;

                case IPPROTO_IGMP:

                    PrintIgmpHeader(igmphdr, buflen - ipv4_header_len);
                    break;

                default:

                    printf("   No decoder for protocol: %d\n", ipv4hdr->ip_protocol);
                    break;

            }
            printf("\n");
        }

    }
    else if (ip_version == 6)
    {
        fprintf(stderr, "Currently don't support decoding IPv6 headers\n");
        return SOCKET_ERROR;
    }

    return NO_ERROR;
}

int DecodeTCPHeader | ( | char * | buf,
 |  | DWORD | iphdrlen
 | ) |  |
int DecodeUDPHeader | ( | char * | buf,
 |  | DWORD | iphdrlen
 | ) |  |
void PrintRawBytes | ( | BYTE * | ptr,
 |  | DWORD | len
 | ) |  |
Generated on Wed Nov 13 2024 16:54:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/rcvall/rcvall.c File Reference

  • NetDS
  • WinSock
  • rcvall
Functions | Variables

rcvall.c File Reference

#include <winsock2.h>
#include <mstcpip.h>
#include <ws2tcpip.h>
#include "parser.h"
#include "resolve.h"
#include <stdio.h>
#include <stdlib.h>

Go to the source code of this file.

Functions

int __cdecl | main (int argc, char **argv)
void | PrintInterfaceList ()
void | usage (char *progname)
int | ValidateArgs (int argc, char **argv)

Variables

DWORD | g_dwIoControlCode = SIO_RCVALL
DWORD | g_dwProtocol = IPPROTO_IP
int | g_iAddressFamily = AF_UNSPEC
int | g_iFamilyMap [] = {AF_INET, AF_INET6}
SOCKADDR_STORAGE | g_saDestinationAddress = {0}
SOCKADDR_STORAGE | g_saLocalInterface = {0}
SOCKADDR_STORAGE | g_saSourceAddress = {0}
unsigned long | g_ulFilterMask = 0

Function Documentation

int __cdecl main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 386 of file rcvall.c.

{
    SOCKET        s = INVALID_SOCKET;
    WSADATA       wsd;
    WSABUF        wbuf = {0};
    DWORD         dwBytesRet = 0, dwFlags = 0;
    unsigned int  optval = 0;
    char         *rcvbuf=NULL;
    int           rc = 0, err;

    //
    // Load Winsock
    //
    if ((rc = WSAStartup(MAKEWORD(2,2), &wsd)) != 0)
    {
        printf("WSAStartup() failed: %d\n", rc);
        return -1;
    }

    //
    // Parse the command line
    //
    if (ValidateArgs(argc, argv) == SOCKET_ERROR)
    {
        usage(argv[0]);
    }

    if ( g_ulFilterMask & (FILTER_MASK_SOURCE_ADDRESS | FILTER_MASK_SOURCE_PORT) )
    {
        printf("Source address filter     : ");
        PrintAddress((SOCKADDR *)&g_saSourceAddress, sizeof(g_saSourceAddress));
        printf("\n");
    }
    if ( g_ulFilterMask & (FILTER_MASK_DESTINATION_ADDRESS | FILTER_MASK_DESTINATION_PORT) )
    {
        printf("Destination address filter: ");
        PrintAddress((SOCKADDR *)&g_saDestinationAddress, sizeof(g_saDestinationAddress));
        printf("\n");
    }

    //
    // Create a raw socket for receiving IP datagrams
    //
    s = WSASocket(g_saLocalInterface.ss_family, SOCK_RAW, g_dwProtocol, NULL, 0, WSA_FLAG_OVERLAPPED);
    if (s == INVALID_SOCKET)
    {
        printf("WSASocket() failed: %d\n", WSAGetLastError());
        return -1;
    }

    //
    // This socket MUST be bound before calling the ioctl
    //
    rc = bind(s, (SOCKADDR *)&g_saLocalInterface, sizeof(g_saLocalInterface));
    if (rc == SOCKET_ERROR)
    {
        printf("bind() failed: %d\n", WSAGetLastError());
        if (INVALID_SOCKET != s)
        {
            closesocket(s);
            s = INVALID_SOCKET;
        }
        WSACleanup();
        return -1;
    }
    printf("Binding to: ");
    PrintAddress((SOCKADDR *)&g_saLocalInterface, sizeof(g_saLocalInterface));
    printf("\n");

    //
    // Set the SIO_RCVALLxxx ioctl
    //
    optval = 1;
    rc = WSAIoctl(s, g_dwIoControlCode, &optval, sizeof(optval),
                  NULL, 0, &dwBytesRet, NULL, NULL);
    if (rc == SOCKET_ERROR)
    {
        printf("WSAIotcl(0x%x) failed: %d\n", g_dwIoControlCode,
               (err = WSAGetLastError()));
        if (err == WSAEINVAL)
        {
            printf("NOTE: IPv6 does not currently support the SIO_RCVALL* ioctls\n");
        }

        if (INVALID_SOCKET != s)
        {
            closesocket(s);
            s = INVALID_SOCKET;
        }
        WSACleanup();
        return -1;
    }

    //
    // Allocate a buffer for receiving data
    //
    rcvbuf = (char *)HeapAlloc(GetProcessHeap(), 0, MAX_IP_SIZE);
    if (rcvbuf == NULL)
    {
        fprintf(stderr, "HeapAlloc failed: %d\n", GetLastError());
        if (INVALID_SOCKET != s)
        {
            closesocket(s);
            s = INVALID_SOCKET;
        }
        WSACleanup();
        return -1;
    }

    //
    // Start receiving IP datagrams until interrupted
    //
    while (1)
    {
        wbuf.len = MAX_IP_SIZE;
        wbuf.buf = rcvbuf;
        dwFlags  = 0;

        rc = WSARecv(s, &wbuf, 1, &dwBytesRet, &dwFlags, NULL, NULL);
        if (rc == SOCKET_ERROR)
        {
            printf("WSARecv() failed: %d\n", WSAGetLastError());
            break;
        }
        // Decode the IP header
        //
        rc = DecodeIPHeader(
                           rcvbuf,
                           dwBytesRet,
                           g_ulFilterMask,
                           (SOCKADDR *)&g_saSourceAddress,
                           (SOCKADDR *)&g_saDestinationAddress
                           );
        if (rc != NO_ERROR)
        {
            printf("Error decoding IP header!\n");
            break;
        }
    }
    //
    // Cleanup
    //

    if (rcvbuf) HeapFree(GetProcessHeap(), 0, rcvbuf);

    if (INVALID_SOCKET != s)
    {
        closesocket(s);
        s = INVALID_SOCKET;
    }
    WSACleanup();

    return 0;
}

void PrintInterfaceList ( )

Definition at line 276 of file rcvall.c.

{
    SOCKET_ADDRESS_LIST *slist=NULL;
    SOCKET               s = INVALID_SOCKET;
    char                *buf=NULL;
    DWORD                dwBytesRet = 0;
    int                  rc = 0,
    i  = 0, j = 0, k = 0;

    k = 0;
    for (i=0; i < sizeof(g_iFamilyMap)/sizeof(int) ;i++)
    {
        s = socket(g_iFamilyMap[i], SOCK_STREAM, 0);
        if (s != INVALID_SOCKET)
        {
            rc = WSAIoctl(
                         s,
                         SIO_ADDRESS_LIST_QUERY,
                         NULL,
                         0,
                         NULL,
                         0,
                         &dwBytesRet,
                         NULL,
                         NULL
                         );
            if ((rc == SOCKET_ERROR) && (GetLastError() == WSAEFAULT))
            {
                char addrbuf[INET6_ADDRSTRLEN] = {'\0'};

                // Allocate the necessary size
                buf = (char *)HeapAlloc(GetProcessHeap(), 0, dwBytesRet);
                if (buf == NULL)
                {
                    if(INVALID_SOCKET != s)
                    {
                        closesocket(s);
                        s = INVALID_SOCKET;
                    }

                    return;
                }

                rc = WSAIoctl(
                             s,
                             SIO_ADDRESS_LIST_QUERY,
                             NULL,
                             0,
                             buf,
                             dwBytesRet,
                             &dwBytesRet,
                             NULL,
                             NULL
                             );
                if (rc == SOCKET_ERROR)
                {
                    if (buf) HeapFree(GetProcessHeap(), 0, buf);
                    if (INVALID_SOCKET != s)
                    {
                        closesocket(s);
                        s = INVALID_SOCKET;
                    }
                    return;
                }

                // Display the addresses
                slist = (SOCKET_ADDRESS_LIST *)buf;
                for (j=0; j < slist->iAddressCount ;j++)
                {
                    FormatAddress(
                                 slist->Address[j].lpSockaddr,
                                 slist->Address[j].iSockaddrLength,
                                 addrbuf,
                                 INET6_ADDRSTRLEN
                                 );
                    printf("               %-2d ........ %s\n",
                           ++k, addrbuf);
                }

                if(buf) HeapFree(GetProcessHeap(), 0, buf);

            } else
            {
                // Unexpected failure
                fprintf(stderr, "WSAIoctl: SIO_ADDRESS_LIST_QUERY failed with unexpected error: %d\n",
                        WSAGetLastError());
            }
            if (INVALID_SOCKET != s)
            {
                closesocket(s);
                s = INVALID_SOCKET;
            }
        } else
        {
            fprintf(stderr, "socket failed: %d\n", WSAGetLastError());
            return;
        }
    }
    return;
}

void usage ( char * progname )

Definition at line 85 of file rcvall.c.

{
    printf("usage: %s -t traffic-type -i address ...\n\n", progname);
    printf("       -t string           Filter traffic type\n");
    printf("             Available traffic types:\n");
    printf("               ip          Capture all IP packets\n");
    printf("               igmp        Capture all IGMP packets only\n");
    printf("               multicast   Capture all multicast IP packets\n");
    printf("       -i address          Capture on this interface\n");
    printf("             Available interfaces:\n");
    PrintInterfaceList();
    printf("       -sa address         Filter on source address\n");
    printf("       -sp Port            Filter on source port\n");
    printf("       -da address         Filter on dest address\n");
    printf("       -dp Port            Filter on dest port\n");

    WSACleanup();
    ExitProcess((UINT)-1);
}

int ValidateArgs | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 112 of file rcvall.c.

{
    struct addrinfo *resif=NULL,
    *ressrc=NULL,
    *resdest=NULL;
    char  *lpInterface=NULL,
    *lpSourceAddress=NULL,
    *lpDestinationAddress=NULL,
    *lpSourcePort=NULL,
    *lpDestinationPort=NULL;
    int    rc = 0, i = 0;

    rc = NO_ERROR;
    memset(&g_saLocalInterface, 0, sizeof(g_saLocalInterface));
    memset(&g_saSourceAddress,  0, sizeof(g_saSourceAddress));
    memset(&g_saDestinationAddress, 0, sizeof(g_saDestinationAddress));

    //
    // Parse the command line
    //
    for (i=1; i < argc ;i++)
    {
        if ((strlen(argv[i]) >= 2) && ((argv[i][0] == '-') || (argv[i][0] == '/')))
        {
            switch (tolower(argv[i][1]))
            {
            case 't':        // traffic type
                if (i+1 >= argc)
                    return SOCKET_ERROR;

                if ( _strnicmp(argv[i+1], "ip", 2) == 0 )
                {
                    g_dwIoControlCode = SIO_RCVALL;
                } else if ( _strnicmp(argv[i+1], "igmp", 4) == 0 )
                {
                    g_dwIoControlCode = SIO_RCVALL_IGMPMCAST;
                    g_dwProtocol = IPPROTO_IGMP;
                } else if ( _strnicmp(argv[i+1], "multicast", 9) == 0 )
                {
                    g_dwIoControlCode = SIO_RCVALL_MCAST;
                } else
                {
                    return SOCKET_ERROR;
                }
                i++;
                break;
            case 'i':        // interface number
                lpInterface = argv[++i];
                break;
            case 's':        // Filter on source ip or port
                if ((i+1 >= argc) || (strlen(argv[i]) != 3))
                    return SOCKET_ERROR;

                if ( tolower(argv[i][2]) == 'a' )
                {
                    lpSourceAddress = argv[++i];
                    g_ulFilterMask |= FILTER_MASK_SOURCE_ADDRESS;
                } else if ( tolower(argv[i][2]) == 'p' )
                {
                    lpSourcePort = argv[++i];
                    g_ulFilterMask |= FILTER_MASK_SOURCE_PORT;
                } else
                {
                    return SOCKET_ERROR;
                }
                break;
            case 'd':        // Filter on dest ip or port
                if ((i+1 >= argc) || (strlen(argv[i]) != 3))
                    return SOCKET_ERROR;

                if ( tolower(argv[i][2]) == 'a' )
                {
                    lpDestinationAddress = argv[++i];
                    g_ulFilterMask |= FILTER_MASK_DESTINATION_ADDRESS;
                } else if ( tolower(argv[i][2]) == 'p' )
                {
                    lpDestinationPort = argv[++i];
                    g_ulFilterMask |= FILTER_MASK_DESTINATION_PORT;
                } else
                {
                    return SOCKET_ERROR;
                }
                break;
            default:
                return SOCKET_ERROR;
            }
        }
    }

    // Validate required arguments
    if (lpInterface == NULL)
    {
        fprintf(stderr, "\nA local interface must be specified!\n\n");
        return SOCKET_ERROR;
    }

    // Attempt to resolve the local interface
    resif = ResolveAddress(lpInterface, "0", g_iAddressFamily, 0, 0);
    if (resif == NULL)
    {
        fprintf(stderr, "\nUnable to resolve address %s, error = %d\n\n",
                lpInterface, WSAGetLastError());
        return SOCKET_ERROR;
    }

    // For SIO_RCVALL we may need to adjust the protocol value
    if ((g_dwIoControlCode == SIO_RCVALL) || (g_dwIoControlCode == SIO_RCVALL_MCAST))
    {
        if (resif->ai_family == AF_INET)
            g_dwProtocol = IPPROTO_IP;
        else if (resif->ai_family == AF_INET6)
            g_dwProtocol = IPPROTO_IPV6;
    }

    // Copy the interface address
    memcpy(&g_saLocalInterface, resif->ai_addr, resif->ai_addrlen);

    // Resolve the source address to filter on, if supplied
    if ((lpSourceAddress) || (lpSourcePort))
    {
        ressrc = ResolveAddress(lpSourceAddress, lpSourcePort, resif->ai_family, 0, 0);
        if (ressrc == NULL)
        {
            fprintf(stderr, "\nUnable to resolve source filter: %d\n\n",
                    WSAGetLastError());
            rc = SOCKET_ERROR;
        } else
        {
            // Copy the source address filter
            memcpy(&g_saSourceAddress, ressrc->ai_addr, ressrc->ai_addrlen);

            freeaddrinfo(ressrc);
        }
    }

    // Resolve the destination address to filter on, if supplied
    if ((lpDestinationAddress) || (lpDestinationPort))
    {
        resdest = ResolveAddress(lpDestinationAddress, lpDestinationPort, resif->ai_family, 0, 0);
        if (resdest == NULL)
        {
            fprintf(stderr, "\nUnable to resolve destination filter: %d\n\n",
                    WSAGetLastError());
            rc = SOCKET_ERROR;
        } else
        {
            // Copy the destination address filter
            memcpy(&g_saDestinationAddress, resdest->ai_addr, resdest->ai_addrlen);

            freeaddrinfo(resdest);
        }
    }

    freeaddrinfo(resif);

    return rc;
}

Variable Documentation

DWORD g_dwIoControlCode = SIO_RCVALL

Definition at line 57 of file rcvall.c.

DWORD g_dwProtocol = IPPROTO_IP

Definition at line 58 of file rcvall.c.

int g_iAddressFamily = AF_UNSPEC

Definition at line 59 of file rcvall.c.

int g_iFamilyMap[] = {AF_INET, AF_INET6}

Definition at line 61 of file rcvall.c.

SOCKADDR_STORAGE g_saDestinationAddress = {0}

Definition at line 68 of file rcvall.c.

SOCKADDR_STORAGE g_saLocalInterface = {0}

Definition at line 56 of file rcvall.c.

SOCKADDR_STORAGE g_saSourceAddress = {0}

Definition at line 67 of file rcvall.c.

unsigned long g_ulFilterMask = 0

Definition at line 69 of file rcvall.c.

Generated on Wed Nov 13 2024 16:54:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/rcvall/resolve.c File Reference

  • NetDS
  • WinSock
  • rcvall
Functions

resolve.c File Reference

#include <winsock2.h>
#include <ws2tcpip.h>
#include <wspiapi.h>
#include <stdio.h>
#include <stdlib.h>
#include "resolve.h"

Go to the source code of this file.

Functions

int | FormatAddress (SOCKADDR *sa, int salen, char *addrbuf, int addrbuflen)
int | PrintAddress (SOCKADDR *sa, int salen)
struct addrinfo * | ResolveAddress (char *addr, char *port, int af, int type, int proto)
int | ReverseLookup (SOCKADDR *sa, int salen, char *buf, int buflen)

Function Documentation

int FormatAddress | ( | SOCKADDR * | sa,
 |  | int | salen,
 |  | char * | addrbuf,
 |  | int | addrbuflen
 | ) |  |

Definition at line 82 of file resolve.c.

{
    char    host[NI_MAXHOST],
            serv[NI_MAXSERV];
    int     hostlen = NI_MAXHOST,
            servlen = NI_MAXSERV,
            rc = 0;

    // Validate input
    if ((sa == NULL) || (addrbuf == NULL))
        return WSAEFAULT;

    // Format the name
    rc = getnameinfo(
            sa,
            salen,
            host,
            hostlen,
            serv,
            servlen,
            NI_NUMERICHOST | NI_NUMERICSERV     // Convert to numeric representation
            );
    if (rc != 0)
    {
        fprintf(stderr, "%s: getnameinfo failed: %d\n", __FILE__, rc);
        return rc;
    }
    if ( (strlen(host) + strlen(serv) + 1) > (unsigned)addrbuflen)
        return WSAEFAULT;
    if (strncmp(serv, "0", 1) != 0)
    {
        if (sa->sa_family == AF_INET)
            _snprintf(addrbuf, addrbuflen-1, "%s:%s", host, serv);
        else if (sa->sa_family == AF_INET6)
            _snprintf(addrbuf, addrbuflen-1, "[%s]:%s", host, serv);
        else
            addrbuf[0] = '\0';
    }
    else
    {
        _snprintf(addrbuf, addrbuflen-1, "%s", host);
    }

    return NO_ERROR;
}

int PrintAddress | ( | SOCKADDR * | sa,
 |  | int | salen
 | ) |  |

Definition at line 33 of file resolve.c.

{
    char    host[NI_MAXHOST],
            serv[NI_MAXSERV];
    int     hostlen = NI_MAXHOST,
            servlen = NI_MAXSERV,
            rc = 0;

    // Validate argument
    if (sa == NULL)
        return WSAEFAULT;

    rc = getnameinfo(
            sa,
            salen,
            host,
            hostlen,
            serv,
            servlen,
            NI_NUMERICHOST | NI_NUMERICSERV
            );
    if (rc != 0)
    {
        fprintf(stderr, "%s: getnameinfo failed: %d\n", __FILE__, rc);
        return rc;
    }

    // If the port is zero then don't print it
    if (strncmp(serv, "0", 1) != 0)
    {
        if (sa->sa_family == AF_INET6)
            printf("[%s]:%s", host, serv);
        else
            printf("%s:%s", host, serv);
    }
    else
        printf("%s", host);

    return NO_ERROR;
}

struct addrinfo* ResolveAddress | ( | char * | addr,
 |  | char * | port,
 |  | int | af,
 |  | int | type,
 |  | int | proto |
 | ) |  |  | [read]

Definition at line 137 of file resolve.c.

{
    struct addrinfo hints,
    *res = NULL;
    int             rc = 0;

    memset(&hints, 0, sizeof(hints));
    hints.ai_flags  = ((addr) ? 0 : AI_PASSIVE);
    hints.ai_family = af; //((addr) ? AF_UNSPEC : af);
    hints.ai_socktype = type;
    hints.ai_protocol = proto;

    rc = getaddrinfo(
            addr,
            port,
           &hints,
           &res
            );
    if (rc != 0)
    {
        printf("Invalid address %s, getaddrinfo failed: %d\n", addr, rc);
        return NULL;
    }
    return res;
}

int ReverseLookup | ( | SOCKADDR * | sa,
 |  | int | salen,
 |  | char * | buf,
 |  | int | buflen
 | ) |  |

Definition at line 170 of file resolve.c.

{
    char    host[NI_MAXHOST] = {'\0'};
    int     hostlen=NI_MAXHOST,
            rc = 0;

    // Validate parameters
    if ((sa == NULL) || (buf == NULL))
        return WSAEFAULT;

    rc = getnameinfo(
            sa,
            salen,
            host,
            hostlen,
            NULL,
            0,
            0
            );
    if (rc != 0)
    {
        fprintf(stderr, "getnameinfo failed: %d\n", rc);
        return rc;
    }

    strncpy(buf, host, buflen-1);

    return NO_ERROR;
}

Generated on Wed Nov 13 2024 16:54:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/rcvall/resolve.h File Reference

  • NetDS
  • WinSock
  • rcvall
Functions

resolve.h File Reference

Go to the source code of this file.

Functions

int | FormatAddress (SOCKADDR *sa, int salen, char *addrbuf, int addrbuflen)
int | PrintAddress (SOCKADDR *sa, int salen)
struct addrinfo * | ResolveAddress (char *addr, char *port, int af, int type, int proto)
int | ReverseLookup (SOCKADDR *sa, int salen, char *namebuf, int namebuflen)

Function Documentation

int FormatAddress | ( | SOCKADDR * | sa,
 |  | int | salen,
 |  | char * | addrbuf,
 |  | int | addrbuflen
 | ) |  |

Definition at line 87 of file resolve.c.

{
    char    host[NI_MAXHOST],
            serv[NI_MAXSERV];
    int     hostlen = NI_MAXHOST,
            servlen = NI_MAXSERV,
            rc;

    // Validate input
    if ((sa == NULL) || (addrbuf == NULL))
        return WSAEFAULT;

    // Format the name
    rc = getnameinfo(
            sa,
            salen,
            host,
            hostlen,
            serv,
            servlen,
            NI_NUMERICHOST | NI_NUMERICSERV     // Convert to numeric representation
            );
    if (rc != 0)
    {
        fprintf(stderr, "%s: getnameinfo failed: %d\n", __FILE__, rc);
        return rc;
    }
    if ( (strlen(host) + strlen(serv) + 1) > (unsigned)addrbuflen)
        return WSAEFAULT;
    if (strncmp(serv, "0", 1) != 0)
    {
        if (sa->sa_family == AF_INET)
            _snprintf(addrbuf, addrbuflen-1, "%s:%s", host, serv);
        else if (sa->sa_family == AF_INET6)
            _snprintf(addrbuf, addrbuflen-1, "[%s]:%s", host, serv);
        else
            addrbuf[0] = '\0';
    }
    else
    {
        _snprintf(addrbuf, addrbuflen-1, "%s", host);
    }

    return NO_ERROR;
}

int PrintAddress | ( | SOCKADDR * | sa,
 |  | int | salen
 | ) |  |

Definition at line 38 of file resolve.c.

{
    char    host[NI_MAXHOST],
            serv[NI_MAXSERV];
    int     hostlen = NI_MAXHOST,
            servlen = NI_MAXSERV,
            rc;

    // Validate argument
    if (sa == NULL)
        return WSAEFAULT;

    rc = getnameinfo(
            sa,
            salen,
            host,
            hostlen,
            serv,
            servlen,
            NI_NUMERICHOST | NI_NUMERICSERV
            );
    if (rc != 0)
    {
        fprintf(stderr, "%s: getnameinfo failed: %d\n", __FILE__, rc);
        return rc;
    }

    // If the port is zero then don't print it
    if (strncmp(serv, "0", 1) != 0)
    {
        if (sa->sa_family == AF_INET6)
            printf("[%s]:%s", host, serv);
        else
            printf("%s:%s", host, serv);
    }
    else
        printf("%s", host);

    return NO_ERROR;
}

struct addrinfo* ResolveAddress | ( | char * | addr,
 |  | char * | port,
 |  | int | af,
 |  | int | type,
 |  | int | proto |
 | ) |  |  | [read]

Definition at line 142 of file resolve.c.

{
    struct addrinfo hints,
    *res = NULL;
    int             rc;

    memset(&hints, 0, sizeof(hints));
    hints.ai_flags  = ((addr) ? 0 : AI_PASSIVE);
    hints.ai_family = af; //((addr) ? AF_UNSPEC : af);
    hints.ai_socktype = type;
    hints.ai_protocol = proto;

    rc = getaddrinfo(
            addr,
            port,
           &hints,
           &res
            );
    if (rc != 0)
    {
        printf("Invalid address %s, getaddrinfo failed: %d\n", addr, rc);
        return NULL;
    }
    return res;
}

int ReverseLookup | ( | SOCKADDR * | sa,
 |  | int | salen,
 |  | char * | namebuf,
 |  | int | namebuflen
 | ) |  |

Definition at line 175 of file resolve.c.

{
    char    host[NI_MAXHOST];
    int     hostlen=NI_MAXHOST,
            rc;

    // Validate parameters
    if ((sa == NULL) || (buf == NULL))
        return WSAEFAULT;

    rc = getnameinfo(
            sa,
            salen,
            host,
            hostlen,
            NULL,
            0,
            0
            );
    if (rc != 0)
    {
        fprintf(stderr, "getnameinfo failed: %d\n", rc);
        return rc;
    }

    strncpy(buf, host, buflen-1);

    return NO_ERROR;
}

Generated on Wed Nov 13 2024 16:54:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/Rnr2/rnrcs.cpp File Reference

  • NetDS
  • WinSock
  • Rnr2
Defines | Functions | Variables

rnrcs.cpp File Reference

#include <winsock2.h>
#include <ws2tcpip.h>
#include <wspiapi.h>
#include <svcguid.h>
#include <wsipx.h>
#include <wsnwlink.h>
#include <nspapi.h>
#include <stdio.h>
#include <stdlib.h>
#include <strsafe.h>

Go to the source code of this file.

Defines

#define | DEFAULT_STRING_LEN 256
#define | OFFSET 1024

Functions

BOOL | Advertise (char *pszServerName)
BOOL | CheckAvailableNameSpaceProviders (BOOL &fNsSap, BOOL &fNsNtds)
void | ClientSend (CSADDR_INFO *lpcsaBuffer)
BOOL WINAPI | CtrlHandler (DWORD dwEvent)
void | DoRnrClient (int nServiceType, char *pszServerName, DWORD dwNameSpace)
BOOL | DoRnrServer (char *pszServerName, int nServerType)
void | DumpServiceClassInfo (LPWSASERVICECLASSINFO lpSci)
BOOL | GetBoundIpxAddr (SOCKET soc, SOCKADDR_IPX *pSaIpx, int nAdapter)
void | GetSockAddrString (SOCKADDR_STORAGE *pSAddr, int addrlen, char *dest, int destlen)
BOOL | InstallClass (int nServerType)
void __cdecl | main (int argc, char *argv[])
void | PrintError (char *errfunc)
BOOL ServerRecv ()
void | SetIpPort (SOCKADDR_STORAGE *dest, SOCKADDR_STORAGE *src)
void | Usage (char *pszProgramName)

Variables

BOOL | fEndProgram = FALSE
CSADDR_INFO | g_aCSAddr [g_nMaxNumOfCSAddr] = {{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0}}
SOCKET | g_aSock [g_nMaxNumOfSocks] = {INVALID_SOCKET, INVALID_SOCKET, INVALID_SOCKET}
SOCKADDR_STORAGE | g_aSockAddr [g_nMaxNumOfCSAddr] = {{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0}}
DWORD | g_dwNumNs = 0
BOOL | g_fNtds = FALSE
BOOL | g_fSap = FALSE
GUID | g_MyGuid
const int | g_nMaxNumOfCSAddr = 20
const int | g_nMaxNumOfSocks = 3
int | g_nNumOfUsedSocks = 0
WSAQUERYSET | g_QS = {0}
SOCKADDR_IPX | sa_ipx = {0}
SOCKADDR_STORAGE | ss_in = {0}

Define Documentation

#define DEFAULT_STRING_LEN 256

Definition at line 122 of file rnrcs.cpp.

#define OFFSET 1024

Definition at line 165 of file rnrcs.cpp.

Function Documentation

BOOL Advertise ( char * pszServerName )

Definition at line 492 of file rnrcs.cpp.

{
    int nRet = 0;
    int i=0;              // number of socket created
    int nNumOfCSAddr = 0; // number of bound socket addresses

    // Advertizing

    // Set up the WSAQuery data
    SecureZeroMemory(&g_QS,sizeof(WSAQUERYSET));
    g_QS.dwSize = sizeof(WSAQUERYSET);
    g_QS.lpszServiceInstanceName = (LPSTR)pszServerName; // service instance name
    g_QS.lpServiceClassId = &g_MyGuid; // associated service class id
    g_QS.dwNameSpace = NS_ALL;         // advertise to all name spaces
    g_QS.lpNSProviderId = NULL;
    g_QS.lpcsaBuffer = g_aCSAddr;      // our bound socket addresses
    g_QS.lpBlob = NULL;

    // Set up the g_aCSAddr data
    if (g_fNtds)
    {
        SOCKET_ADDRESS_LIST *slist=NULL;
        struct addrinfo *res=NULL,
        *resptr=NULL,
        hints;
        char            *addrbuf=NULL;
        DWORD            dwBytes=0;

        SecureZeroMemory(&hints,sizeof(hints));

        hints.ai_flags = AI_PASSIVE;
        hints.ai_socktype = SOCK_DGRAM;
        hints.ai_protocol = IPPROTO_UDP;

        nRet = getaddrinfo(NULL, "0", &hints, &res);
        if ((nRet != 0) || (res == NULL))
        {
            return FALSE;
        }

        resptr = res;
        while (resptr)
        {
            g_aSock[i] = socket(resptr->ai_family, resptr->ai_socktype, resptr->ai_protocol);
            if (g_aSock[i] == INVALID_SOCKET)
            {
                printf("socket error %d\n", WSAGetLastError());
                freeaddrinfo(res);
                return FALSE;
            }

            // bind to local host ip addresses and let system to assign a port number
            nRet = bind ( g_aSock[i], resptr->ai_addr, (int)resptr->ai_addrlen);
            if ( SOCKET_ERROR == nRet )
            {
                printf("bind error %d\n", WSAGetLastError());
                freeaddrinfo(res);
                return FALSE;
            }
            int cb = sizeof(ss_in);
            if (getsockname(g_aSock[i], (SOCKADDR *) &ss_in, &cb) == SOCKET_ERROR)
            {
                printf("getsockname error %d\n", WSAGetLastError());
                freeaddrinfo(res);
                return FALSE;
            }

            nRet = WSAIoctl(g_aSock[i], SIO_ADDRESS_LIST_QUERY, NULL, 0, NULL, 0, &dwBytes, NULL, NULL);
            if (nRet == SOCKET_ERROR)
            {
                addrbuf = (char *)HeapAlloc(GetProcessHeap(), 0, dwBytes);
                if (addrbuf == NULL)
                {
                    freeaddrinfo(res);
                    return FALSE;
                }
                nRet = WSAIoctl(g_aSock[i], SIO_ADDRESS_LIST_QUERY, NULL, 0, addrbuf, dwBytes, &dwBytes, NULL, NULL);
                if (nRet == SOCKET_ERROR)
                {
                    printf("WSAIoctl failed: %d\n", WSAGetLastError());
                    HeapFree(GetProcessHeap(), 0, addrbuf);
                    freeaddrinfo(res);
                    return FALSE;
                }
            }
            else
            {
                printf("WSAIoctl should have failed!\n");
                freeaddrinfo(res);
                return FALSE;
            }

            slist = (SOCKET_ADDRESS_LIST *)addrbuf;

            if (resptr->ai_family == AF_INET)
                printf("IPv4 addresses bound...\n");
            else if (resptr->ai_family == AF_INET6)
                printf("IPv6 addresses bound...\n");
            else
                printf("Unknown address family addresses bound...\n");

            for (int j = 0; j < slist->iAddressCount ; j++)
            {
                if (j >= g_nMaxNumOfCSAddr)
                {
                    printf("Max. number of socket address (%d) reached. We will not advertise extra ones\n", g_nMaxNumOfCSAddr);
                    break;
                }

                // Copy the address over
                memcpy(&g_aSockAddr[j], slist->Address[j].lpSockaddr, slist->Address[j].iSockaddrLength);

                // Set the port number our socket is actually bound to
                SetIpPort(&g_aSockAddr[j],&ss_in);

                char temp[128] = {'\0'};
                GetSockAddrString (&g_aSockAddr[j], slist->Address[j].iSockaddrLength, temp, 128);
                printf("Address %40s\n", temp);

                g_aCSAddr[j].iSocketType = SOCK_DGRAM;
                g_aCSAddr[j].iProtocol = IPPROTO_UDP;
                g_aCSAddr[j].LocalAddr.lpSockaddr = (struct sockaddr *)&g_aSockAddr[j];
                g_aCSAddr[j].LocalAddr.iSockaddrLength = slist->Address[j].iSockaddrLength;
                g_aCSAddr[j].RemoteAddr.lpSockaddr = (struct sockaddr *)&g_aSockAddr[j];
                g_aCSAddr[j].RemoteAddr.iSockaddrLength = slist->Address[j].iSockaddrLength;

                nNumOfCSAddr++; // increase the number SOCKADDR buffer used
            }
            i++; // increase the number of socket created

            // Go to the next address
            resptr = resptr->ai_next;

            // Free the address buffer
            HeapFree(GetProcessHeap(), 0, addrbuf);
            addrbuf = NULL;
        }
        freeaddrinfo(res);
    }

    if (g_fSap && (nNumOfCSAddr < g_nMaxNumOfCSAddr))
    {
        // advertise into the NS_SAP name space if we still have enough
        // socket address buffer
        SecureZeroMemory(sa_ipx.sa_netnum,sizeof(sa_ipx.sa_netnum));
        SecureZeroMemory(sa_ipx.sa_nodenum,sizeof(sa_ipx.sa_nodenum));
        sa_ipx.sa_family = AF_IPX;
        sa_ipx.sa_socket = 0;

        g_aSock[i] = socket ( AF_IPX, SOCK_DGRAM, NSPROTO_IPX );
        if ( INVALID_SOCKET == g_aSock[i] )
        {
            printf("socket error %d\n", WSAGetLastError());
            return FALSE;
        }

        nRet = bind ( g_aSock[i], (SOCKADDR *) &sa_ipx, sizeof (sa_ipx) );
        if ( SOCKET_ERROR == nRet )
        {
            printf("bind error %d\n", WSAGetLastError());
            return FALSE;
        }

        //--------------Find out our bound ipx addresses------------
        int cb = 0;        // size variable
        int nAdapters = 0; // number of adapters bound with IPX

        // get the number of adapters
        cb = sizeof(nAdapters);
        nRet = getsockopt(g_aSock[i], NSPROTO_IPX, IPX_MAX_ADAPTER_NUM, (char *) &nAdapters, &cb);
        if (nRet == SOCKET_ERROR)
        {
            printf("getsockopt error %d\n", WSAGetLastError());
            return FALSE;
        }

        SOCKADDR_IPX* pSaIpx = NULL;           // a pointer to our current SOCKADDR buffer
        printf("IPX addresses bound...\n");

        for (int nIdx = 0; nIdx < nAdapters; nIdx++)
        {
            if (nNumOfCSAddr >= g_nMaxNumOfCSAddr)
            {
                printf("Max. number of socket address (%d) reached. We will not advertise extra ones\n", g_nMaxNumOfCSAddr);
                break;
            }
            // get the buffer for this SOCKADDR
            pSaIpx = (SOCKADDR_IPX *) &g_aSockAddr[nNumOfCSAddr];

            if (GetBoundIpxAddr(g_aSock[i],  pSaIpx, nIdx) == FALSE)
            {
                printf("No valid bound IPX address at adapter index %d\n", nIdx);
                // since this link is not available, nNumOfCSAddr will reuse the current SOCKADDR buffer
                continue;
            }

            char temp[DEFAULT_STRING_LEN] = {'\0'};
            GetSockAddrString (&g_aSockAddr[nNumOfCSAddr], sizeof(SOCKADDR_IPX), temp, DEFAULT_STRING_LEN);
            printf("%40s\n", temp);

            g_aCSAddr[nNumOfCSAddr].iSocketType = SOCK_DGRAM;
            g_aCSAddr[nNumOfCSAddr].iProtocol = NSPROTO_IPX;
            g_aCSAddr[nNumOfCSAddr].LocalAddr.lpSockaddr = (struct sockaddr *)&g_aSockAddr[nNumOfCSAddr];
            g_aCSAddr[nNumOfCSAddr].LocalAddr.iSockaddrLength = sizeof(sa_ipx);
            g_aCSAddr[nNumOfCSAddr].RemoteAddr.lpSockaddr = (struct sockaddr *)&g_aSockAddr[nNumOfCSAddr];
            g_aCSAddr[nNumOfCSAddr].RemoteAddr.iSockaddrLength = sizeof(sa_ipx);

            nNumOfCSAddr++;
        }
        i++; // increase the number of socket created

        // Note: If g_fNtds is TRUE, this ipx address will be
        //       available from the NTDS name space too.

    }

    // update counters
    g_QS.dwNumberOfCsAddrs = nNumOfCSAddr;
    g_nNumOfUsedSocks = i;

    // Call WSASetService
    printf("Advertise server of instance name: %s ...\n", pszServerName);
    nRet = WSASetService(&g_QS, RNRSERVICE_REGISTER, 0L);
    if (nRet == SOCKET_ERROR)
    {
        printf("WSASetService error %d\n", WSAGetLastError());
        return FALSE;
    }
    printf("Wait for client talking to me, hit Ctrl-C to terminate...\n");
    return TRUE;

}

BOOL CheckAvailableNameSpaceProviders | ( | BOOL & | fNsSap,
 |  | BOOL & | fNsNtds
 | ) |  |

Definition at line 788 of file rnrcs.cpp.

{
    LPWSANAMESPACE_INFO pInfo = NULL;
    DWORD dwBufLen = 0;
    PBYTE pBuf = NULL;
    int nCount = 0;
    int nRet = 0;

    dwBufLen = 0;

    fNsSap = fNsNtds = FALSE;

    nRet = WSAEnumNameSpaceProviders(&dwBufLen, NULL);
    if (nRet == SOCKET_ERROR)
    {
        if (WSAGetLastError() != WSAEFAULT)
        {
            printf("Error %d\n", WSAGetLastError());
            return FALSE;
        }
    }

    // dwBufLen contains the needed buffer size
    pBuf = (PBYTE) HeapAlloc(GetProcessHeap(), 0, dwBufLen);
    if (pBuf == NULL)
    {
        printf("\nCould not allocate buffer\n");
        return FALSE;
    }

    nRet = WSAEnumNameSpaceProviders(&dwBufLen, (LPWSANAMESPACE_INFO)pBuf);
    if (nRet == SOCKET_ERROR)
    {
        printf("Error: %d\n", WSAGetLastError());
        HeapFree(GetProcessHeap(), 0, pBuf);
        return FALSE;
    }

    //Loop thru the returned info
    pInfo = (LPWSANAMESPACE_INFO)pBuf;
    for (nCount = 0; nCount < nRet; nCount++)
    {
        switch (pInfo->dwNameSpace)
        {
        case NS_SAP:
            fNsSap = TRUE;
            break;
        case NS_NTDS:
            fNsNtds = TRUE;
            break;
        default:
            break;
        }
        pInfo++;
    }
    HeapFree(GetProcessHeap(), 0, pBuf);
    return TRUE;
}

void ClientSend ( CSADDR_INFO * lpcsaBuffer )

Definition at line 1131 of file rnrcs.cpp.

{

    SOCKADDR_STORAGE *mypt = (SOCKADDR_STORAGE *) lpcsaBuffer->RemoteAddr.lpSockaddr;

    SOCKET s = INVALID_SOCKET;
    static char szMessage[DEFAULT_STRING_LEN] = "A message from the client: ";
    static BOOL fHostname = FALSE;
    char szName[DEFAULT_STRING_LEN] = {'\0'};
    unsigned long ulSize = sizeof(szName);
    HRESULT hRet;

    if (fHostname == FALSE)
    {
        GetComputerName(szName, &ulSize);

        if (FAILED(hRet = StringCchCat(szMessage,
                                       sizeof(szMessage)/sizeof(szMessage[0]),
                                       szName
                                       )))
        {
            printf("StringCchCat failed: 0x%x\n",hRet);
            return;
        }

        fHostname = TRUE;
    }

    // The client doesn't need to know the detail of the addressing
    // information, it can just do the common sequence of
    // socket, connect, send/recv and closesocket by using the
    // discovered RemoteAddr.
    s = socket(lpcsaBuffer->RemoteAddr.lpSockaddr->sa_family,
               lpcsaBuffer->iSocketType,
               lpcsaBuffer->iProtocol);

    if (s != INVALID_SOCKET)
    {
        if (connect(s, (SOCKADDR*)mypt, lpcsaBuffer->RemoteAddr.iSockaddrLength) != SOCKET_ERROR)
        {
            // NOTE on send on 64bit.  strlen returns a 64bit INT and send takes a 32bit int.
            // verify that your data is NOT larger that your data is not larger than SO_MAX_MSG_SIZE
            // returned by getsockopt

            if (send(s, szMessage, (INT)strlen(szMessage)+1, 0) != SOCKET_ERROR )
            {
                printf("send a message to the peer...\n");
            }
            else
            {
                printf("send failed %d\n", WSAGetLastError());
            }
        }
        else
        {
            printf("connect failed %d\n", WSAGetLastError());
        }

        if (INVALID_SOCKET != s)
        {
            closesocket(s);
            s = INVALID_SOCKET;
        }
    }
    else
        printf("Failed socket call %d\n", WSAGetLastError());
}

BOOL WINAPI CtrlHandler ( DWORD dwEvent )

Definition at line 899 of file rnrcs.cpp.

{
    int nRet = 0;
    int i = 0;
    WCHAR szGuid[MAX_PATH] = {'\0'};
    HRESULT hRet;

    switch (dwEvent)
    {
    case CTRL_C_EVENT:
    case CTRL_BREAK_EVENT:
    case CTRL_LOGOFF_EVENT:
    case CTRL_SHUTDOWN_EVENT:
    case CTRL_CLOSE_EVENT:
        fEndProgram = TRUE;
        printf("CtrlHandler: cleaning up...\n");

        printf("delete service instance...\n");
        nRet = WSASetService(&g_QS, RNRSERVICE_DELETE, 0L);
        if (nRet == SOCKET_ERROR)
        {
            printf("WSASetService DELETE error %d\n", WSAGetLastError());
        } else
            printf(" Deleted.\n");

        printf("Removing Service class ");

        if (SUCCEEDED(hRet = StringCchPrintfW(szGuid,
                                              sizeof(szGuid)/sizeof(szGuid[0]),
                                              L"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
                                              g_MyGuid.Data1,
                                              g_MyGuid.Data2,
                                              g_MyGuid.Data3,
                                              g_MyGuid.Data4[0],
                                              g_MyGuid.Data4[1],
                                              g_MyGuid.Data4[2],
                                              g_MyGuid.Data4[3],
                                              g_MyGuid.Data4[4],
                                              g_MyGuid.Data4[5],
                                              g_MyGuid.Data4[6],
                                              g_MyGuid.Data4[7]
                                             )))
        {
            wprintf(L"%s",szGuid);

        }

        printf("... \n");

        nRet = WSARemoveServiceClass(&g_MyGuid);
        if (nRet == SOCKET_ERROR)
        {
            printf("WSARemoveServiceClass error %d\n", WSAGetLastError());
        } else
            printf(" Removed.\n");

        for (i = 0; i < g_nMaxNumOfSocks; i++)
        {
            if ( g_aSock[i] != INVALID_SOCKET )
            {
                closesocket ( g_aSock[i] );
                g_aSock[i] = INVALID_SOCKET;
            }
        }
        break;

    default:
        // unknown type--better pass it on.
        return FALSE;
    }
    return TRUE;
}

void DoRnrClient | ( | int | nServiceType,
 |  | char * | pszServerName,
 |  | DWORD | dwNameSpace
 | ) |  |

Definition at line 988 of file rnrcs.cpp.

{
    static GUID guid = SVCID_NETWARE ( nServiceType );  //use this as the class id
    WSAQUERYSET qs = {0};
    AFPROTOCOLS afp[g_nMaxNumOfSocks] = {{AF_IPX,  NSPROTO_IPX}, {AF_INET, IPPROTO_UDP}, {AF_INET6, IPPROTO_UDP}};
    HANDLE hLookup = NULL;
    DWORD dwResult = 0;
    static char szName[100] = {'\0'};
    BOOL fKnownSapId = FALSE;
    DWORD dwLength = 0;
    BYTE abyBuf[sizeof(WSAQUERYSET) + OFFSET] = {0}; // provide a sufficient large
    // buffer for returned query set
    WSAQUERYSET * pQS = (WSAQUERYSETA*) abyBuf;
    HRESULT hRet;

    if(FAILED(hRet = StringCchCopy(szName,
                                   sizeof(szName)/sizeof(szName[0]),
                                   pszServerName
                                   )))
    {
        printf("StringCchCopy failed: 0x%x\n",hRet);
        return;
    }

    SecureZeroMemory (&qs, sizeof (WSAQUERYSET));
    qs.dwSize = sizeof (WSAQUERYSET);
    qs.lpszServiceInstanceName = szName;
    qs.lpServiceClassId = &guid;
    qs.dwNameSpace = dwNameSpace;
    qs.dwNumberOfProtocols = g_nMaxNumOfSocks;
    qs.lpafpProtocols = afp;

    SecureZeroMemory (abyBuf, sizeof (WSAQUERYSET) + OFFSET);
    dwLength = sizeof(WSAQUERYSET) + OFFSET;

    // some well known SAP name space services
    if (nServiceType == 3 || nServiceType == 4 || nServiceType == 5 ||
        nServiceType == 7 || nServiceType == 9 || nServiceType == 36 || nServiceType == 71)
        fKnownSapId = TRUE;

    if (WSALookupServiceBegin ( &qs,
                                LUP_RETURN_ADDR | LUP_RETURN_NAME,
                                &hLookup) == SOCKET_ERROR)
    {
        PrintError("WSALookupServiceBegin");
        return;
    }

    printf ("Performing Query for service (type, name) = (%d, %s) . . .\n\n", nServiceType, pszServerName);

    if (strcmp(pszServerName, "*") == 0)
    {   // enumerate all service instances
        for (;;)
        {
            dwResult = WSALookupServiceNext(hLookup,
                                            0,
                                            &dwLength,
                                            pQS);
            if (dwResult == SOCKET_ERROR)
            {
                if (WSAGetLastError() == WSAEFAULT)
                {
                    printf("WSALookupServiceNext Error: Oops, we need a larger buffer size of : %d Bytes\n", dwLength);
                }
                else
                {
                    PrintError("WSALookupServiceNext");
                }
                WSALookupServiceEnd (hLookup);
                return;
            }

            if (!dwResult)
            {
                for (DWORD i = 0; i < pQS->dwNumberOfCsAddrs; i++)
                {
                    SOCKADDR_STORAGE *mypt = (SOCKADDR_STORAGE *) pQS->lpcsaBuffer[i].RemoteAddr.lpSockaddr;
                    if (mypt)
                    {
                        // we have valid remote sockaddr
                        char temp[DEFAULT_STRING_LEN] = {'\0'};

                        printf ("Name[%d]: %30s", i, pQS->lpszServiceInstanceName);
                        GetSockAddrString (mypt, pQS->lpcsaBuffer[i].RemoteAddr.iSockaddrLength, temp, DEFAULT_STRING_LEN);
                        printf("%40s\n", temp);

                        if (! fKnownSapId)
                            ClientSend(&(pQS->lpcsaBuffer[i]));
                    }
                }

            }
        }
    }
    else
    {
        dwResult = WSALookupServiceNext(hLookup,
                                        0,
                                        &dwLength,
                                        pQS);

        if (dwResult == SOCKET_ERROR)
        {
            if (WSAGetLastError() == WSAEFAULT)
            {
                printf("WSALookupServiceNext Error: Oops, we need a larger buffer size of : %d Bytes\n", dwLength);
            }
            else
            {
                PrintError("WSALookupServiceNext");
            }
            WSALookupServiceEnd (hLookup);
            return;
        }

        if (!dwResult)
        {
            for (DWORD i = 0; i < pQS->dwNumberOfCsAddrs; i++)
            {
                SOCKADDR_STORAGE *mypt = (SOCKADDR_STORAGE *) pQS->lpcsaBuffer[i].RemoteAddr.lpSockaddr;
                if (mypt)
                {
                    // we have valid remote sockaddr
                    char temp[DEFAULT_STRING_LEN] = {'\0'};
                    printf ("Name[%d]: %30s", i, pQS->lpszServiceInstanceName);
                    GetSockAddrString (mypt, pQS->lpcsaBuffer[i].RemoteAddr.iSockaddrLength, temp, DEFAULT_STRING_LEN);
                    printf("%40s\n", temp);

                    if (! fKnownSapId)
                        ClientSend(&(pQS->lpcsaBuffer[i]));
                }
            }
        }
        WSALookupServiceEnd (hLookup);
    }
}

BOOL DoRnrServer | ( | char * | pszServerName,
 |  | int | nServerType
 | ) |  |

Definition at line 306 of file rnrcs.cpp.

{
    // I am using SVCID_NETWARE macro to form a common class id for the
    // client and server program such that the client program can also query
    // some known SAP services on the network without running this program
    // as a server.
    // You can also generate your own class id by uuidgen.exe or guidgen.exe and
    // distribute the class id to client program.
    //
    // Please check svcguid.h for details about the macro.
    GUID guidNW = SVCID_NETWARE(nServerType);

    memcpy(&g_MyGuid, &guidNW, sizeof(GUID));

    if (!SetConsoleCtrlHandler(CtrlHandler, TRUE))
    {
        printf ("SetConsoleCtrlHandler failed to install console handler: %d\n",
                GetLastError());
        return FALSE;
    }
    // Install the server class
    if (!InstallClass(nServerType))
    {
        return FALSE;
    }
    // advertise the server instance
    if (!Advertise(pszServerName))
    {
        return FALSE;
    }

    // Make our bound sockets non-blocking such that
    // we can loop and test for data sent by client
    // without blocking.
    u_long arg = 1L;
    for (int i = 0; i < g_nNumOfUsedSocks; i++)
    {
        // make the socket as non-blocking socket
        if (ioctlsocket(g_aSock[i], FIONBIO, &arg) == SOCKET_ERROR)
        {
            printf("ioctlsocket[%d] error %d\n", i, WSAGetLastError());
            return FALSE;
        }
    }

    // receive data from client who find our address thru Winsock 2 RnR
    for (;;)
    {
        if (ServerRecv() == FALSE)
        {
            return FALSE;
        }
        if (fEndProgram)
            return TRUE;
        Sleep(100);
    }
}

void DumpServiceClassInfo ( LPWSASERVICECLASSINFO lpSci )

Definition at line 1316 of file rnrcs.cpp.

{
    WCHAR szGuid[MAX_PATH] = {'\0'};
    GUID TempGuid = {0};
    DWORD i = 0;
    HRESULT hRet;

    if (NULL == lpSci)
        return;

    CopyMemory(&TempGuid,lpSci->lpServiceClassId,sizeof(GUID));

    if (FAILED(hRet = StringCchPrintfW(szGuid,
                                       sizeof(szGuid)/sizeof(szGuid[0]),
                                       L"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
                                       TempGuid.Data1,
                                       TempGuid.Data2,
                                       TempGuid.Data3,
                                       TempGuid.Data4[0],
                                       TempGuid.Data4[1],
                                       TempGuid.Data4[2],
                                       TempGuid.Data4[3],
                                       TempGuid.Data4[4],
                                       TempGuid.Data4[5],
                                       TempGuid.Data4[6],
                                       TempGuid.Data4[7]
                                      )))
    {
        printf("StringCchPrintfW failed: 0x%x\n",hRet);
        return;

    }

    printf("\nWSASERVICECLASSINFO %p:\n",lpSci);
    wprintf(L"lpServiceClassId:\t%s\n",szGuid);
    printf("lpszServiceClassName:\t%s\n",lpSci->lpszServiceClassName);
    printf("dwCount:\t\t%d\n",lpSci->dwCount);

    for (i = 0; i < lpSci->dwCount; i++)
    {
        printf("lpClassInfos (WSANSCLASSINFOW %p):\n",&lpSci->lpClassInfos[i]);
        printf("\t\tdwNameSpace:\t%d\n",lpSci->lpClassInfos[i].dwNameSpace);
        printf("\t\tdwValueSize:\t%d\n",lpSci->lpClassInfos[i].dwValueSize);
        printf("\t\tdwValueType:\t%d\n",lpSci->lpClassInfos[i].dwValueType);
        printf("\t\tlpszName:\t%s\n",lpSci->lpClassInfos[i].lpszName);
        printf("\t\tlpValue:\t%p\n",lpSci->lpClassInfos[i].lpValue);

    }
    printf("\n");

    return;

}

BOOL GetBoundIpxAddr | ( | SOCKET | soc,
 |  | SOCKADDR_IPX * | pSaIpx,
 |  | int | nAdapter
 | ) |  |

Definition at line 737 of file rnrcs.cpp.

{
    IPX_ADDRESS_DATA ipx_data = {0}; // see wsnwlink.h for details
    int cb = 0; // size variable
    int nRet = 0;

    cb = sizeof ( IPX_ADDRESS_DATA );
    SecureZeroMemory(&ipx_data,sizeof(IPX_ADDRESS_DATA));
    ipx_data.adapternum = nAdapter;

    nRet = getsockopt ( soc, NSPROTO_IPX, IPX_ADDRESS, (char *) &ipx_data, &cb );
    if ( SOCKET_ERROR == nRet)
    {
        printf("getsockopt error %d\n", WSAGetLastError());
        return FALSE;
    }

    cb = sizeof(SOCKADDR_IPX);
    if (getsockname(soc, (SOCKADDR *) pSaIpx, &cb) == SOCKET_ERROR)
    {
        printf("getsockname error %d\n", WSAGetLastError());
        return FALSE;
    }
    else
    {
        if (ipx_data.status == TRUE)
        {
            // this link is UP
            memcpy(pSaIpx->sa_netnum, ipx_data.netnum, sizeof(pSaIpx->sa_netnum));
            memcpy(pSaIpx->sa_nodenum, ipx_data.nodenum, sizeof(pSaIpx->sa_nodenum));
            return TRUE;
        }
        else
            return FALSE; // this link is DOWN
    }
}

void GetSockAddrString | ( | SOCKADDR_STORAGE * | pSAddr,
 |  | int | addrlen,
 |  | char * | dest,
 |  | int | destlen
 | ) |  |

Definition at line 1233 of file rnrcs.cpp.

{
    HRESULT hRet;

    if (pSAddr == NULL || dest == NULL)
        return;

    switch (pSAddr->ss_family)
    {
    case AF_INET:
    case AF_INET6:
        {
            char host[NI_MAXHOST],
            serv[NI_MAXSERV];
            int  hostlen = NI_MAXHOST,
            servlen = NI_MAXSERV,
            rc;

            rc = getnameinfo((SOCKADDR*)pSAddr, addrlen, host, hostlen, serv, servlen,
                             NI_NUMERICHOST | NI_NUMERICSERV);
            if (rc != 0)
            {
                if (FAILED(hRet = StringCchPrintf(dest,destlen-1,"getnameinfo failed: %d",rc)))
                {
                    printf("StringCchPrintf failed: 0x%x\n",hRet);
                    return;
                }

                return;
            }

            if (FAILED(hRet = StringCchPrintf(dest,destlen-1,"%s:%s",host,serv)))
            {
                printf("StringCchPrintf failed: 0x%x\n",hRet);
                return;
            }

        }
        break;
    case AF_IPX:
        {
            PSOCKADDR_IPX pIpxAddr = (PSOCKADDR_IPX) pSAddr;

            if (FAILED(hRet = StringCchPrintf(dest, destlen-1,
                                              "%02X%02X%02X%02X.%02X%02X%02X%02X%02X%02X:%04X",
                                              (unsigned char)pIpxAddr->sa_netnum[0],
                                              (unsigned char)pIpxAddr->sa_netnum[1],
                                              (unsigned char)pIpxAddr->sa_netnum[2],
                                              (unsigned char)pIpxAddr->sa_netnum[3],
                                              (unsigned char)pIpxAddr->sa_nodenum[0],
                                              (unsigned char)pIpxAddr->sa_nodenum[1],
                                              (unsigned char)pIpxAddr->sa_nodenum[2],
                                              (unsigned char)pIpxAddr->sa_nodenum[3],
                                              (unsigned char)pIpxAddr->sa_nodenum[4],
                                              (unsigned char)pIpxAddr->sa_nodenum[5],
                                              ntohs(pIpxAddr->sa_socket)
                                              )))
            {
                printf("StringCchPrintf failed: 0x%x\n",hRet);
                return;
            }
        }
        break;
    default:
        if(FAILED(hRet = StringCchCopy(dest,destlen-1,"Unknown socket address family")))
        {
            printf("StringCchCopy failed: 0x%x\n",hRet);
        }
        break;
    }
}

BOOL InstallClass ( int nServerType )

Definition at line 378 of file rnrcs.cpp.

{
    WSASERVICECLASSINFO sci;
    WSANSCLASSINFO  aNameSpaceClassInfo[4] = {{0},{0},{0},{0}};
    DWORD           dwSapId = nServerType;
    DWORD           dwZero = 0;
    TCHAR           szServiceClassName[DEFAULT_STRING_LEN] = {'\0'};
    int             nRet = 0;
    DWORD           dwUdpPort = 0; // we use dynamic generated port number
    HRESULT hRet;

    if (FAILED(hRet = StringCchPrintf(szServiceClassName,
                                      sizeof(szServiceClassName)/sizeof(szServiceClassName[0]),
                                      "TypeId %d",
                                      nServerType
                                     )))
    {
        printf("StringCchPrintf failed: 0x%x\n",hRet);
        return FALSE;
    }

    printf("Installing ServiceClassName: %s\n", szServiceClassName);

    BOOL fSap  = FALSE;
    BOOL fNtds = FALSE;

    // see what name space providers are available
    if (!CheckAvailableNameSpaceProviders(fSap, fNtds))
        return FALSE;

    // save a copy
    g_fSap = fSap;
    g_fNtds = fNtds;

    // our total number of interested name space providers
    if (fSap)
        g_dwNumNs++;
    if (fNtds)
        g_dwNumNs++;

    // setup Service Class info
    SecureZeroMemory(&sci,sizeof(sci));

    sci.lpServiceClassId = (LPGUID) &g_MyGuid;
    sci.lpszServiceClassName = (LPSTR) szServiceClassName;
    sci.dwCount = g_dwNumNs * 2; // each name space has 2 NameSpaceClassInfo
    sci.lpClassInfos = aNameSpaceClassInfo;

    SecureZeroMemory(aNameSpaceClassInfo,sizeof(WSANSCLASSINFO)*4);

    DWORD i =0; // index to array of WSANSCLASSINFO

    // common service class registration in NTDS and SAP name spaces
    if (fNtds)
    {
        // NTDS setup
        printf("NTDS name space class installation\n");

        aNameSpaceClassInfo[i].lpszName = SERVICE_TYPE_VALUE_CONN;
        aNameSpaceClassInfo[i].dwNameSpace = NS_NTDS;
        aNameSpaceClassInfo[i].dwValueType = REG_DWORD;
        aNameSpaceClassInfo[i].dwValueSize = sizeof(DWORD);
        aNameSpaceClassInfo[i].lpValue = &dwZero;
        i++; // increment of the index

        aNameSpaceClassInfo[i].lpszName = SERVICE_TYPE_VALUE_UDPPORT;
        aNameSpaceClassInfo[i].dwNameSpace = NS_NTDS;
        aNameSpaceClassInfo[i].dwValueType = REG_DWORD;
        aNameSpaceClassInfo[i].dwValueSize = sizeof(DWORD);
        aNameSpaceClassInfo[i].lpValue = &dwUdpPort;
        i++; // increment of the index
    }

    if (fSap)
    {
        // SAP setup
        printf("SAP name space class installation\n");

        aNameSpaceClassInfo[i].lpszName = SERVICE_TYPE_VALUE_CONN;
        aNameSpaceClassInfo[i].dwNameSpace = NS_SAP;
        aNameSpaceClassInfo[i].dwValueType = REG_DWORD;
        aNameSpaceClassInfo[i].dwValueSize = sizeof(DWORD);
        aNameSpaceClassInfo[i].lpValue = &dwZero;
        i++; // increment of the index

        aNameSpaceClassInfo[i].lpszName = SERVICE_TYPE_VALUE_SAPID;
        aNameSpaceClassInfo[i].dwNameSpace = NS_SAP;
        aNameSpaceClassInfo[i].dwValueType = REG_DWORD;
        aNameSpaceClassInfo[i].dwValueSize = sizeof(DWORD);
        aNameSpaceClassInfo[i].lpValue = &dwSapId;
    }

    // Install the service class information
    DumpServiceClassInfo(&sci);
    nRet = WSAInstallServiceClass(&sci);
    if (nRet == SOCKET_ERROR)
    {
        printf("WSAInstallServiceClass error %d\n", WSAGetLastError());
        return FALSE;
    }
    return TRUE;
}

void __cdecl main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 188 of file rnrcs.cpp.

{
    char * pszServerName = "MyServer";   // default server instance name
    int    nServerType = 200;            // default server type id
    char * pszNSProvider = "NS_ALL";
    DWORD  dwNameSpace = NS_ALL;
    int i = 0;
    BOOL fServer = TRUE;                 // by default, running this program as the server

    // allow the user to override settings with command line switches
    for (i = 1; i < argc; i++)
    {
        if ((*argv[i] == '-') || (*argv[i] == '/'))
        {
            switch (tolower(*(argv[i]+1)))
            {
            case 'n':  // server instance name
                pszServerName = argv[++i];
                break;
            case 't':  // server_type, this will be used as the base for the Server class id
                nServerType = atoi(argv[++i]);
                break;
            case 'c':
                fServer = FALSE;
                break;
            case 's':
                fServer = TRUE;
                break;
            case 'p':
                pszNSProvider = argv[++i];
                if (_strnicmp("NS_NTDS", pszNSProvider, strlen("NS_NTDS")) == 0)
                    dwNameSpace = NS_NTDS;
                else if (_strnicmp("NS_SAP", pszNSProvider, strlen("NS_SAP")) == 0)
                    dwNameSpace = NS_SAP;
                // default is NS_ALL
                break;
            case 'h':
            case '?':
            default:
                Usage(argv[0]);
                return;
            }
        }
        else
        {
            Usage(argv[0]);
            return;
        }

    }

    if (fServer)
    {
        // check user input
        if (strcmp(pszServerName, "*") == 0)
        {
            printf("You can't supply wildcard (*) server instance name to run this server\n");
            Usage(argv[0]);
            return;
        }
    }

    __try
    {
        // init winsock
        WSADATA wd;
        int nRet;
        if ( (nRet = WSAStartup (MAKEWORD (2, 2), &wd)) != 0)
        {
            printf ("Unable to start Winsock 2.  Error: %d\n", nRet);
            __leave;
        }

        if (fServer)
        {
            // running as a server program
            DoRnrServer(pszServerName, nServerType);
        }
        else
        {
            // running as a client program
            DoRnrClient(nServerType, pszServerName, dwNameSpace);
        }

    }
    __finally
    {
        if (fServer)
        {
            SetConsoleCtrlHandler(CtrlHandler, FALSE);
        }

        WSACleanup();

    }
}

void PrintError ( char * errfunc )

Definition at line 1203 of file rnrcs.cpp.

{
    fflush (stdout);
    if (WSASERVICE_NOT_FOUND == WSAGetLastError())
        fprintf (stderr, "No matches found.\n");
    else
        if (WSA_E_NO_MORE == WSAGetLastError() || WSAENOMORE == WSAGetLastError())
        fprintf (stderr, "No more matches. \n");
    else
        fprintf (stderr, "Function %s failed with error %d\n", errfunc, WSAGetLastError());
}

BOOL ServerRecv ( )

Definition at line 856 of file rnrcs.cpp.

{

    int      nBytesReceived = 0;
    char     szBuf[1024] = {'\0'};
    SOCKADDR_STORAGE sa_peer = {0};
    int      nPeerAddrLen = 0;

    for (int i = 0; i < g_nNumOfUsedSocks; i++)
    {
        nPeerAddrLen = sizeof(SOCKADDR_STORAGE);
        // You can use "nBytesReceived = recv(g_aSock[i], szBuf, sizeof(szBuf), 0 );", if
        // you don't want your peer's address information.
        nBytesReceived = recvfrom(g_aSock[i], szBuf, sizeof(szBuf), 0, (SOCKADDR*)&sa_peer, &nPeerAddrLen);

        if (nBytesReceived == SOCKET_ERROR)
        {
            int nRet = WSAGetLastError();
            if (nRet == WSAEWOULDBLOCK || nRet == WSAEMSGSIZE)
                continue;
            else
            {
                printf("recv error: %d\n", nRet);
                return FALSE;
            }
        }
        else
        {
            printf("received: [%s ", szBuf);

            char temp[DEFAULT_STRING_LEN] = {'\0'};
            GetSockAddrString (&sa_peer, nPeerAddrLen, temp, DEFAULT_STRING_LEN);
            printf(": %s]\n", temp);
        }
    }
    return TRUE;
}

void SetIpPort | ( | SOCKADDR_STORAGE * | dest,
 |  | SOCKADDR_STORAGE * | src
 | ) |  |

Definition at line 1308 of file rnrcs.cpp.

{
    if (dest->ss_family == AF_INET)
        ((SOCKADDR_IN *)dest)->sin_port = ((SOCKADDR_IN *)src)->sin_port;
    else if (dest->ss_family == AF_INET6)
        ((SOCKADDR_IN6 *)dest)->sin6_port = ((SOCKADDR_IN6 *)src)->sin6_port;
}

void Usage ( char * pszProgramName )

Definition at line 168 of file rnrcs.cpp.

{
    fprintf(stderr, "Usage:  %s\n", pszProgramName);
    fprintf(stderr, " -c (running this program as a client)\n");
    fprintf(stderr, " -s (running this program as a server)\n");
    fprintf(stderr, " -t server_type_id (default is: 200)\n");
    fprintf(stderr, " -n server_instance_name (default is: MyServer) \n");
    fprintf(stderr, " -p provider name (default is: NS_ALL) \n");
    fprintf(stderr, "                  (e.g. NS_NTDS, NS_SAP, NS_ALL)\n");
    fprintf(stderr, "Examples:\n");
    fprintf(stderr, "RnrCs -s -n MyServer   ...Run as server /w server_type_id of 200, service\n");
    fprintf(stderr, "                             instance name of MyServer\n");
    fprintf(stderr, "RnrCs -c -n * ............Run as client and find all servers /w server_type_id\n");
    fprintf(stderr, "                             of 200 from all available name spaces\n");
    fprintf(stderr, "RnrCs -c -n * -p NS_SAP ..Run as client and find all servers /w server_type_id\n");
    fprintf(stderr, "                             of 200 from the SAP name space\n");
    fprintf(stderr, "RnrCs -c -t 4 -n * .......Run as client and find all SAP file servers\n");
    fprintf(stderr, "Hit Ctrl-C to quit the server program\n");
}

Variable Documentation

BOOL fEndProgram = FALSE

Definition at line 149 of file rnrcs.cpp.

CSADDR_INFO g_aCSAddr[g_nMaxNumOfCSAddr] = {{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0}}

Definition at line 137 of file rnrcs.cpp.

SOCKET g_aSock[g_nMaxNumOfSocks] = {INVALID_SOCKET, INVALID_SOCKET, INVALID_SOCKET}

Definition at line 136 of file rnrcs.cpp.

SOCKADDR_STORAGE g_aSockAddr[g_nMaxNumOfCSAddr] = {{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0}}

Definition at line 138 of file rnrcs.cpp.

DWORD g_dwNumNs = 0

Definition at line 147 of file rnrcs.cpp.

BOOL g_fNtds = FALSE

Definition at line 146 of file rnrcs.cpp.

BOOL g_fSap = FALSE

Definition at line 145 of file rnrcs.cpp.

GUID g_MyGuid

Definition at line 139 of file rnrcs.cpp.

const int g_nMaxNumOfCSAddr = 20

Definition at line 132 of file rnrcs.cpp.

const int g_nMaxNumOfSocks = 3

Definition at line 133 of file rnrcs.cpp.

int g_nNumOfUsedSocks = 0

Definition at line 134 of file rnrcs.cpp.

WSAQUERYSET g_QS = {0}

Definition at line 140 of file rnrcs.cpp.

SOCKADDR_IPX sa_ipx = {0}

Definition at line 143 of file rnrcs.cpp.

SOCKADDR_STORAGE ss_in = {0}

Definition at line 142 of file rnrcs.cpp.

Generated on Wed Nov 13 2024 16:54:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/simple/Ioctl.c File Reference

  • NetDS
  • WinSock
  • simple
Defines | Functions

Ioctl.c File Reference

#include <winsock2.h>
#include <ws2tcpip.h>
#include <wspiapi.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

Go to the source code of this file.

Defines

#define | DEFAULT_BUFFER_LEN 4096
#define | DEFAULT_PORT "5001"
#define | WIN32_LEAN_AND_MEAN

Functions

void | FreeSocket (SOCKET s, int rc)
int __cdecl | main (int argc, char **argv)
void | Usage (char *progname)

Define Documentation

#define DEFAULT_BUFFER_LEN 4096

Definition at line 28 of file Ioctl.c.

#define DEFAULT_PORT "5001"

Definition at line 27 of file Ioctl.c.

#define WIN32_LEAN_AND_MEAN

Definition at line 17 of file Ioctl.c.

Function Documentation

void FreeSocket | ( | SOCKET | s,
 |  | int | rc
 | ) |  |

Definition at line 542 of file Ioctl.c.

{
    int     retval;

    // client connection was closed
    if (rc == NO_ERROR)
    {
        retval = shutdown(s, SD_SEND);
        if (retval == SOCKET_ERROR)
        {
            fprintf(stderr, "FreeSocket: shutdown failed: %d\n", WSAGetLastError());
        }
    }

    // Release the handle
    retval = closesocket(s);
    if (retval == SOCKET_ERROR)
    {
        fprintf(stderr, "FreeSocket: closesocket failed: %d\n", WSAGetLastError());
    }
}

int __cdecl main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 72 of file Ioctl.c.

{
    struct addrinfo hints,
                   *results = NULL,
                   *addrptr = NULL;
    SOCKADDR_STORAGE client;

    WSADATA       wsaData;
    SOCKET       *server_sockets = NULL,
                  client_socket = INVALID_SOCKET;
    DWORD         optval = 1;
    char          buffer[DEFAULT_BUFFER_LEN],
                  hoststr[NI_MAXHOST],
                  servstr[NI_MAXSERV],
                 *pbuffer = NULL,
                 *interface = NULL,
                 *port = DEFAULT_PORT;
    int           address_family = AF_UNSPEC,
                  socket_count=0,
                  clientlen,
                  bytesread=0,
                  retval,
                  err,
                  i;
    struct fd_set readfds,
                  writefds;

    // Parse the command line
    for(i=1;i <argc;i++)
    {
        if ( (strlen(argv[i]) == 2) && ( (argv[i][0] == '-') || (argv[i][0] == '/') ) )
        {
            switch(tolower(argv[i][1]))
            {
                case '4':           // Force IPv4
                    address_family = AF_INET;
                    break;

                case '6':           // Force IPv6
                    address_family = AF_INET6;
                    break;

                case 'i':           // Local interface to bind to
                    interface = argv[++i];
                    break;

                case 'e':           // Local port to bind to
                    port = argv[++i];
                    break;

                default:
                    Usage(argv[0]);
                    break;
            }
        }
        else
            Usage(argv[0]);
    }

    // Load Winsock
    if ((retval = WSAStartup(MAKEWORD(2,2), &wsaData)) != 0)
    {
        fprintf(stderr, "WSAStartup failed with error %d\n", retval);
        WSACleanup();
        return -1;
    }

    // Make sure the wildcard port wasn't specified
    if ( _strnicmp(port, "0", 1) == 0 )
        Usage(argv[0]);

    // setup the hints structure for name resolution
    memset(&hints, 0, sizeof(hints));
    hints.ai_family = address_family;
    hints.ai_protocol = IPPROTO_TCP;
    hints.ai_socktype = SOCK_STREAM;
    hints.ai_flags = ((interface == NULL) ? AI_PASSIVE : 0);

    // Resolve the address to bind to. If AF_UNSPEC was specified, interface is NULL,
    //    and IPv6 is installed, this call will return two addresses: 0.0.0.0 and ::
    retval = getaddrinfo(
            interface,
            port,
           &hints,
           &results
            );
    if (retval != 0)
    {
        fprintf(stderr, "getaddrinfo failed: %d\n", retval);
        goto cleanup;
    }

    // Make sure the list is non-NULL
    if (results == NULL)
    {
        fprintf(stderr, "Unable to resolve interface %s\n", interface);
        goto cleanup;
    }

    // Count how many address were returned
    socket_count = 0;
    addrptr = results;
    while (addrptr)
    {
        socket_count++;
        addrptr = addrptr->ai_next;
    }

    // Allocate the server sockets
    server_sockets = (SOCKET *)HeapAlloc(
            GetProcessHeap(),
            HEAP_ZERO_MEMORY,
            sizeof(SOCKET) * socket_count
            );
    if (server_sockets == NULL)
    {
        fprintf(stderr, "HeapAlloc failed: %d\n", GetLastError());
        return -1;
    }

    // Initialize the socket array
    for(i=0; i < socket_count ;i++)
        server_sockets[i] = INVALID_SOCKET;

    // Setup the server sockets
    socket_count = 0;
    addrptr = results;
    while (addrptr)
    {
        // Create the server socket
        server_sockets[socket_count] = socket(addrptr->ai_family, addrptr->ai_socktype, addrptr->ai_protocol);
        if (server_sockets[socket_count] == INVALID_SOCKET)
        {
            fprintf(stderr, "socket failed: %d\n", WSAGetLastError());
            goto cleanup;
        }

        // Bind the socket
        retval = bind(server_sockets[socket_count], addrptr->ai_addr, (int)addrptr->ai_addrlen);
        if (retval == SOCKET_ERROR)
        {
            fprintf(stderr, "bind failed: %d\n", WSAGetLastError());
            goto cleanup;
        }

        // For TCP make the socket listening
        retval = listen(server_sockets[socket_count], 7);
        if (retval == SOCKET_ERROR)
        {
            fprintf(stderr, "listen failed: %d\n", WSAGetLastError());
            goto cleanup;
        }

        // Make the socket non-blocking
        retval = ioctlsocket(server_sockets[socket_count], FIONBIO, &optval);
        if (retval == SOCKET_ERROR)
        {
            fprintf(stderr, "ioctlsocket failed: %d\n", WSAGetLastError());
            goto cleanup;
        }

        // Display the address we bound to
        retval = getnameinfo(
                addrptr->ai_addr,
                (socklen_t)addrptr->ai_addrlen,
                hoststr,
                NI_MAXHOST,
                servstr,
                NI_MAXSERV,
                NI_NUMERICHOST | NI_NUMERICSERV
                            );
        if (retval != 0)
        {
            fprintf(stderr, "getnameinfo failed: %d\n", retval);
            goto cleanup;
        }

        printf("Server socket 0x%x listening on %s and port %s\n",
                server_sockets[socket_count], hoststr, servstr);

        // Increment counters and pointers
        socket_count++;

        addrptr = addrptr->ai_next;
    }
    //
    // The fd sets should be zeroed out before using them to prevent errors.
    FD_ZERO(&readfds);
    FD_ZERO(&writefds);

    // Set the server sockets
    for(i=0; i < socket_count ;i++)
    {
#pragma warning (push)
#pragma warning (disable: 4127)
        FD_SET(server_sockets[i], &readfds);
#pragma warning (pop)
    }

    //
    // The structure of the loop below is very simple. We only accept one
    // connection at a time. As soon as another client connects, we
    // disconnect the first one, and start talking to the new client.
    // All this server does is to echo the data received on the socket
    // back to the client.
    //
    // This is not a very realistic server, but it does serve to show that
    // select() does not scale very well on win32. If we were dealing
    // with more than one client, we would have to have a list of sockets
    // that are in each fdset to be able to check them when select()
    // returns.
    //
    for(;;)
    {
        //
        // A socket in the listen() state becomes ready to read when a
        // client connects to it. An accept() will complete without
        // blocking.
        //

        retval = select(0, &readfds, &writefds, NULL, NULL);
        if (i == SOCKET_ERROR)
        {
            fprintf(stderr, "select failed %d\n", WSAGetLastError());
            goto cleanup;
        }

        // Check for data on the client socket if connected
        if ((client_socket != INVALID_SOCKET) && (FD_ISSET(client_socket, &readfds)))
        {
            retval = recv(client_socket, buffer, DEFAULT_BUFFER_LEN, 0);
            if (retval == 0)
            {
                // A successful recv of zero indicates graceful socket closure

                // Close the socket
                FreeSocket(client_socket, retval);
                client_socket = INVALID_SOCKET;

                // Add the listening sockets back to the read set
                FD_ZERO(&readfds);
                FD_ZERO(&writefds);

                for(i=0; i < socket_count ;i++)
#pragma warning (push)
#pragma warning (disable: 4127)
                    FD_SET(server_sockets[i], &readfds);
#pragma warning (pop)
            }
            else if (retval == SOCKET_ERROR)
            {
                // For WSAEWOULDBLOCK we simply go back to the top of the loop
                //    and select again. Note that client_socket is already in
                //    the readfds so we don't need to set it again.
                //
                if ((err = WSAGetLastError()) != WSAEWOULDBLOCK)
                {
                    // Some other fatal error occurred so close the socket and
                    //    prepare to select on the listening sockets again.

                    // Close the socket
                    FreeSocket(client_socket, retval);
                    client_socket = INVALID_SOCKET;

                    // Add the listening sockets back to the read set
                    FD_ZERO(&readfds);
                    FD_ZERO(&writefds);

                    for(i=0; i < socket_count ;i++)
#pragma warning (push)
#pragma warning (disable:4127)
                        FD_SET(server_sockets[i], &readfds);
#pragma warning (pop)
                }
            }
            else
            {
                // Data was successfully received into 'buffer' so now put the
                //    client_socket into the writefds so we can write it back

                bytesread = retval;

                printf("read %d bytes\n", bytesread);

                pbuffer = buffer;

                // Now wait for writeability to echo the data back
                FD_ZERO(&readfds);
                FD_ZERO(&writefds);
#pragma warning (push)
#pragma warning (disable:4127)
                FD_SET(client_socket, &writefds);
#pragma warning (pop)
            }
        }
        // Check for writeability on the client socket
        else if ((client_socket != INVALID_SOCKET) && (FD_ISSET(client_socket, &writefds)))
        {
            retval = send(client_socket, pbuffer, bytesread, 0);
            if (retval == 0)
            {
                // Connection was gracefully closed so clean things up and put the
                //    listening sockets back into the readfds

                // Close the socket
                FreeSocket(client_socket, retval);
                client_socket = INVALID_SOCKET;

                // Connection was closed so put the server sockets back in the readfds set
                FD_ZERO(&readfds);
                FD_ZERO(&writefds);
                for(i=0; i < socket_count ;i++)
#pragma warning (push)
#pragma warning (disable:4127)
                    FD_SET(server_sockets[i], &readfds);
#pragma warning (pop)
            }
            else if (retval == SOCKET_ERROR)
            {
                // If we got a WSAEWOULDBLOCK we need to try to send again. Note that
                //    client_socket is already in the writefds.

                if ((err = WSAGetLastError()) != WSAEWOULDBLOCK)
                {
                    // A fatal error occured so close the socket and put the listening
                    //    sockets back into the readfds

                    fprintf(stderr, "send failed: %d\n", err);

                    // Close the socket
                    FreeSocket(client_socket, retval);
                    client_socket = INVALID_SOCKET;

                    // Connection was closed so put the server sockets back in the readfds set
                    FD_ZERO(&readfds);
                    FD_ZERO(&writefds);
                    for(i=0; i < socket_count ;i++)
#pragma warning (push)
#pragma warning (disable:4127)
                        FD_SET(server_sockets[i], &readfds);
#pragma warning (pop)
                }
            }
            else
            {
                // Successfully sent some data
                printf("sent %d bytes\n", retval);

                if (bytesread != retval)
                {
                    // We didn't send all the data that was read (e.g. 10 bytes were
                    //    read but this send call send less then 10 bytes). We need
                    //    to try to send again so increment the buffer pointer to the
                    //    data remaining and adjust the byte count. The client_socket
                    //    is already in writefds so just continue;
                    //
                    pbuffer = &buffer[bytesread-retval];
                    bytesread -= retval;

                    // Write isn't complete so leave the socket in the writefds
                    //    set and continue
                }
                else
                {
                    pbuffer = buffer;

                    // Write complete: set the socket for reading now
                    FD_ZERO(&readfds);
                    FD_ZERO(&writefds);
#pragma warning (push)
#pragma warning (disable:4127)
                    FD_SET(client_socket, &readfds);
#pragma warning (pop)
                }
            }
        }
        // Check for accepted client connection
        else
        {
            // See which listening socket has a connection
            for(i=0; i < socket_count ;i++)
            {
                if (FD_ISSET(server_sockets[i], &readfds))
                {
                    // Accept the connection
                    clientlen = sizeof(client);
                    client_socket = accept(server_sockets[i], (SOCKADDR *)&client, &clientlen);
                    if (client_socket == INVALID_SOCKET)
                    {
                        fprintf(stderr, "accept failed: %d\n", WSAGetLastError());
                        goto cleanup;
                    }

                    // Print the client's address out
                    retval = getnameinfo(
                            (SOCKADDR *)&client,
                            clientlen,
                            hoststr,
                            NI_MAXHOST,
                            servstr,
                            NI_MAXSERV,
                            NI_NUMERICHOST | NI_NUMERICSERV
                            );
                    if (retval != 0)
                    {
                        fprintf(stderr, "getnameinfo failed: %d\n", retval);
                        goto cleanup;
                    }

                    printf("Accepted client connection from %s and port %s\n",
                            hoststr, servstr);

                    FD_ZERO(&readfds);
#pragma warning (push)
#pragma warning (disable:4127)
                    FD_SET(client_socket, &readfds);
#pragma warning (pop)

                    // Since we handle only one conneciton at a time, break out
                    //    and start servicing the client connection
                    break;
                }
            }
        }
    }

cleanup:

    //
    // Clean up any allocations and handles, etc.
    //

    if (results)
    {
        freeaddrinfo(results);
        results = NULL;
    }

    if (client_socket != INVALID_SOCKET)
    {
        FreeSocket(client_socket, NO_ERROR);
        client_socket = INVALID_SOCKET;
    }

    if (server_sockets)
    {
        for(i=0; i < socket_count ;i++)
        {
            if (server_sockets[i] != INVALID_SOCKET)
            {
                closesocket(server_sockets[i]);
                server_sockets[i] = INVALID_SOCKET;
            }
        }

        HeapFree(GetProcessHeap(), 0, server_sockets);
        server_sockets = NULL;
    }

    WSACleanup();
    return 0;
}

void Usage ( char * progname )

Definition at line 41 of file Ioctl.c.

{
  fprintf(stderr, "Usage\n%s -e [endpoint] -i [interface] [-4] [-6]\n"
                  "Where:\n"
                    "\t-e endpoint   - is the port to listen on\n"
                  "\t-i interface  - is the local string address to bind to\n"
                    "\t-4            - force IPv4\n"
                    "\t-6            - force IPv6\n"
                    "\n"
                  "Defaults are 5001 and INADDR_ANY and IN6ADDR_ANY (if IPv6 present)\n",
                    progname
                    );
  WSACleanup();
  exit(1);
}

Generated on Wed Nov 13 2024 16:54:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/simple/Simplec.c File Reference

  • NetDS
  • WinSock
  • simple
Defines | Functions

Simplec.c File Reference

#include <winsock2.h>
#include <ws2tcpip.h>
#include <wspiapi.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

Go to the source code of this file.

Defines

#define | DEFAULT_BUFFER_LEN 4096
#define | DEFAULT_PORT "5001"
#define | DEFAULT_PROTO SOCK_STREAM
#define | WIN32_LEAN_AND_MEAN

Functions

int __cdecl | main (int argc, char **argv)
void | Usage (char *progname)

Define Documentation

#define DEFAULT_BUFFER_LEN 4096

Definition at line 29 of file Simplec.c.

#define DEFAULT_PORT "5001"

Definition at line 27 of file Simplec.c.

#define DEFAULT_PROTO SOCK_STREAM

Definition at line 28 of file Simplec.c.

#define WIN32_LEAN_AND_MEAN

Definition at line 17 of file Simplec.c.

Function Documentation

int __cdecl main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 70 of file Simplec.c.

{
    WSADATA          wsaData;
    SOCKET           conn_socket = INVALID_SOCKET;
    struct addrinfo *results = NULL,
    *addrptr = NULL,
    hints;
    char            *server_name = "localhost",
    *port = DEFAULT_PORT,
    Buffer[DEFAULT_BUFFER_LEN],
    hoststr[NI_MAXHOST],
    servstr[NI_MAXSERV];
    int              address_family = AF_UNSPEC,
    socket_type = DEFAULT_PROTO;
    int              retval,
    loopflag = 0,
    loopcount,
    maxloop = -1,
    i;

    // Parse the command line
    if (argc >1)
    {
        for (i=1; i < argc; i++)
        {
            if ( (strlen(argv[i]) == 2) && ((argv[i][0] == '-') || (argv[i][0] == '/') ) )
            {
                switch (tolower(argv[i][1]))
                {
                case '4':           // Force IPv4
                    address_family = AF_INET;
                    break;

                case '6':           // Force IPv6
                    address_family = AF_INET6;
                    break;

                case 'p':           // Protocol (UDP or TCP)
                    if (!_strnicmp(argv[i+1], "TCP", 3) )
                        socket_type = SOCK_STREAM;
                    else if (!_strnicmp(argv[i+1], "UDP", 3) )
                        socket_type = SOCK_DGRAM;
                    else
                        Usage(argv[0]);
                    i++;
                    break;

                case 'n':           // Server name to connect to
                    server_name = argv[++i];
                    break;

                case 'e':           // Port number to connect to
                    port = argv[++i];
                    break;

                case 'l':           // Number of iterations
                    loopflag = 1;
                    if (i+1 >= argc)
                        Usage(argv[0]);
                    if (argv[i+1][0] != '-')
                        maxloop = atoi(argv[i+1]);
                    else
                        maxloop = -1;
                    i++;
                    break;

                default:
                    Usage(argv[0]);
                    break;
                }
            }
            else
                Usage(argv[0]);
        }
    }

    // Load Winsock
    if ((retval = WSAStartup(MAKEWORD(2,2), &wsaData)) != 0)
    {
        fprintf(stderr,"WSAStartup failed with error %d\n",retval);
        WSACleanup();
        return -1;
    }

    // Make sure the wildcard port wasn't specified
    if (_strnicmp(port, "0", 1) == 0)
        Usage(argv[0]);

    //
    // Resolve the server name
    //
    memset(&hints, 0, sizeof(hints));
    hints.ai_family = address_family;
    hints.ai_socktype = socket_type;
    hints.ai_protocol = ((socket_type == SOCK_STREAM) ? IPPROTO_TCP : IPPROTO_UDP);

    retval = getaddrinfo(
                        server_name,
                        port,
                        &hints,
                        &results
                        );
    if (retval != 0)
    {
        fprintf(stderr, "getaddrinfo failed: %d\n", retval);
        goto cleanup;
    }

    // Make sure we got at least one address
    if (results == NULL)
    {
        fprintf(stderr, "Server (%s) name could not be resolved!\n", server_name);
        goto cleanup;
    }

    //
    // Walk through the list of addresses returned and connect to each one.
    //    Take the first successful connection.
    //
    addrptr = results;
    while (addrptr)
    {
        conn_socket = socket(addrptr->ai_family, addrptr->ai_socktype, addrptr->ai_protocol);
        if (conn_socket == INVALID_SOCKET)
        {
            fprintf(stderr, "socket failed: %d\n", WSAGetLastError());
            goto cleanup;
        }

        //
        // Notice that nothing in this code is specific to whether we
        // are using UDP or TCP.
        // We achieve this by using a simple trick.
        //    When connect() is called on a datagram socket, it does not
        //    actually establish the connection as a stream (TCP) socket
        //    would. Instead, TCP/IP establishes the remote half of the
        //    ( LocalIPAddress, LocalPort, RemoteIP, RemotePort) mapping.
        //    This enables us to use send() and recv() on datagram sockets,
        //    instead of recvfrom() and sendto()

        retval = getnameinfo(
                            addrptr->ai_addr,
                            (socklen_t)addrptr->ai_addrlen,
                            hoststr,
                            NI_MAXHOST,
                            servstr,
                            NI_MAXSERV,
                            NI_NUMERICHOST | NI_NUMERICSERV
                            );
        if (retval != 0)
        {
            fprintf(stderr, "getnameinfo failed: %d\n", retval);
            goto cleanup;
        }

        printf("Client attempting connection to: %s port: %s\n", hoststr, servstr);

        retval = connect(conn_socket, addrptr->ai_addr, (int)addrptr->ai_addrlen);
        if (retval == SOCKET_ERROR)
        {
            closesocket(conn_socket);
            conn_socket = INVALID_SOCKET;

            addrptr = addrptr->ai_next;
        }
        else
        {
            break;
        }
    }

    freeaddrinfo(results);
    results = NULL;

    // Make sure we got a connection established
    if (conn_socket == INVALID_SOCKET)
    {
        printf("Unable to establish connection...\n");
        goto cleanup;
    }
    else
    {
        printf("Connection established...\n");
    }

    //
    // cook up a string to send
    //
    loopcount = 0;
    for (;;)
    {
        _snprintf(Buffer, DEFAULT_BUFFER_LEN-1,
                  "This is a small test message [number %d]",
                  loopcount++
                 );

        // Send the data
        retval = send(conn_socket, Buffer, lstrlen(Buffer)+1, 0);
        if (retval == SOCKET_ERROR)
        {
            fprintf(stderr,"send failed: error %d\n", WSAGetLastError());
            goto cleanup;
        }

        printf("wrote %d bytes\n", retval);

        // Receive the data back
        retval = recv(conn_socket, Buffer, DEFAULT_BUFFER_LEN, 0);
        if (retval == SOCKET_ERROR)
        {
            fprintf(stderr, "recv failed: error %d\n", WSAGetLastError());
            goto cleanup;
        }
        //
        // We are not likely to see this with UDP, since there is no
        // 'connection' established.
        //
        if (retval == 0)
        {
            printf("Server closed connection\n");

            break;
        }

        printf("read %d bytes, data [%s] from server\n", retval, Buffer);

        // See if we need to break out of the loop
        if (loopflag)
        {
            if ( (loopcount >= maxloop) && (maxloop > 0) )
                break;
        }
        else
        {
            break;
        }
    }

    cleanup:

    //
    // clean up the client connection
    //

    if (conn_socket != INVALID_SOCKET)
    {
        // Indicate no more data to send
        retval = shutdown(conn_socket, SD_SEND);
        if (retval == SOCKET_ERROR)
        {
            fprintf(stderr, "shutdown failed: %d\n", WSAGetLastError());
        }

        // Close the socket
        retval = closesocket(conn_socket);
        if (retval == SOCKET_ERROR)
        {
            fprintf(stderr, "closesocket failed: %d\n", WSAGetLastError());
        }

        conn_socket = INVALID_SOCKET;
    }

    if (results != NULL)
    {
        freeaddrinfo(results);
        results = NULL;
    }

    WSACleanup();

    return 0;
}

void Usage ( char * progname )

Definition at line 37 of file Simplec.c.

{
    fprintf(stderr, "Usage\n%s -p [protocol] -n [server] -e [endpoint] -l [iterations] [-4] [-6]\n"
            "Where:\n"
            "\t-p protocol   - is one of TCP or UDP\n"
            "\t-n server     - is the string address or name of server\n"
            "\t-e endpoint   - is the port to listen on\n"
            "\t-l iterations - is the number of loops to execute\n"
            "\t   -l by itself makes client run in an infinite loop,"
            "\t   Hit Ctrl-C to terminate it)\n"
            "\t-4            - force IPv4\n"
            "\t-6            - force IPv6\n"
            "\n"
            "Defaults are TCP, localhost and 5001\n",
            progname
           );
    WSACleanup();
    exit(1);
}

Generated on Wed Nov 13 2024 16:54:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/simple/Simples.c File Reference

  • NetDS
  • WinSock
  • simple
Defines | Functions

Simples.c File Reference

#include <winsock2.h>
#include <ws2tcpip.h>
#include <wspiapi.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

Go to the source code of this file.

Defines

#define | DEFAULT_BUFFER_LEN 4096
#define | DEFAULT_PORT "5001"
#define | DEFAULT_PROTO SOCK_STREAM
#define | WIN32_LEAN_AND_MEAN

Functions

int __cdecl | main (int argc, char **argv)
DWORD WINAPI | ServerThread (LPVOID lpParam)
void | Usage (char *progname)

Define Documentation

#define DEFAULT_BUFFER_LEN 4096

Definition at line 28 of file Simples.c.

#define DEFAULT_PORT "5001"

Definition at line 26 of file Simples.c.

#define DEFAULT_PROTO SOCK_STREAM

Definition at line 27 of file Simples.c.

#define WIN32_LEAN_AND_MEAN

Definition at line 16 of file Simples.c.

Function Documentation

int __cdecl main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 70 of file Simples.c.

{
    struct addrinfo  hints,
    *results = NULL,
    *addrptr = NULL;
    WSADATA     wsaData;
    SOCKET     *server_sockets = NULL;
    HANDLE     *server_threads = NULL;
    char        hoststr[NI_MAXHOST],
    servstr[NI_MAXSERV];
    char       *interface = NULL,
    *port = DEFAULT_PORT;
    int         socket_type = DEFAULT_PROTO,
    address_family = AF_UNSPEC,     // Default to any (IPv4 or IPv6)
    socket_count = 0,
    retval,
    i;

    /* Parse arguments */
    if (argc >1)
    {
        for (i=1;i <argc;i++)
        {
            if ( (strlen(argv[i]) == 2) && ( (argv[i][0] == '-') || (argv[i][0] == '/') ) )
            {
                switch (tolower(argv[i][1]))
                {
                case '4':       // IPv4
                    address_family = AF_INET;
                    break;

                case '6':       // IPv6
                    address_family = AF_INET6;
                    break;

                case 'p':
                    if (!_strnicmp(argv[i+1], "TCP", 3) )
                        socket_type = SOCK_STREAM;
                    else if (!_strnicmp(argv[i+1], "UDP", 3) )
                        socket_type = SOCK_DGRAM;
                    else
                        Usage(argv[0]);
                    i++;
                    break;

                case 'i':       // Local interface to listen/recv on
                    interface = argv[++i];
                    break;

                case 'e':       // Port number to listen/recv on
                    port = argv[++i];
                    break;

                default:
                    Usage(argv[0]);
                    break;
                }
            }
            else
                Usage(argv[0]);
        }
    }

    // Load Winsock
    if ((retval = WSAStartup(0x202,&wsaData)) != 0)
    {
        fprintf(stderr,"WSAStartup failed with error %d\n",retval);
        WSACleanup();
        return -1;
    }

    // Make sure the supplied port isn't wildcard
    if ( _strnicmp(port, "0", 1) == 0)
    {
        Usage(argv[0]);
    }

    memset(&hints, 0, sizeof(hints));
    hints.ai_family   = address_family;
    hints.ai_socktype = socket_type;
    hints.ai_protocol = ((socket_type == SOCK_DGRAM) ? IPPROTO_UDP : IPPROTO_TCP);
    // If interface is NULL then request the passive "bind" address
    hints.ai_flags    = ((interface == NULL) ? AI_PASSIVE : 0);

    retval = getaddrinfo(interface, port, &hints, &results);
    if (retval != 0)
    {
        fprintf(stderr, "getaddrinfo failed: %d\n", retval);
        goto cleanup;
    }

    // Make sure we got at least one address back
    if (results == NULL)
    {
        fprintf(stderr, "Unable to resolve interface %s\n", interface);
        goto cleanup;
    }

    // Count how many addresses were returned
    addrptr = results;
    while (addrptr)
    {
        socket_count++;
        addrptr = addrptr->ai_next;
    }

    // Allocate space for the server sockets
    server_sockets = (SOCKET *)HeapAlloc(
                                        GetProcessHeap(),
                                        HEAP_ZERO_MEMORY,
                                        sizeof(SOCKET) * socket_count
                                        );
    if (server_sockets == NULL)
    {
        fprintf(stderr, "HeapAlloc failed: %d\n", GetLastError());
        goto cleanup;
    }

    // Initialize the socket array first
    for (i=0; i < socket_count ;i++)
        server_sockets[i] = INVALID_SOCKET;

    // Create the server sockets - one for each address returned
    socket_count = 0;
    addrptr = results;
    while (addrptr)
    {
        // Create the socket according to the parameters returned
        server_sockets[socket_count] = socket(
                                             addrptr->ai_family,
                                             addrptr->ai_socktype,
                                             addrptr->ai_protocol
                                             );
        if (server_sockets[socket_count] == INVALID_SOCKET)
        {
            fprintf(stderr, "socket failed: %d\n", WSAGetLastError());
            goto cleanup;
        }

        // Bind the socket to the address returned
        retval = bind(server_sockets[socket_count],
                      addrptr->ai_addr,
                      (int)addrptr->ai_addrlen
                     );
        if (retval == SOCKET_ERROR)
        {
            fprintf(stderr, "bind failed: %d\n", WSAGetLastError());
            goto cleanup;
        }

        // If a TCP socket, call listen on it
        if (addrptr->ai_socktype == SOCK_STREAM)
        {
            retval = listen(
                           server_sockets[socket_count],
                           7
                           );
            if (retval == SOCKET_ERROR)
            {
                fprintf(stderr, "listen failed: %d\n", WSAGetLastError());
                goto cleanup;
            }
        }

        // Print the address this socket is bound to
        retval = getnameinfo(
                            addrptr->ai_addr,
                            (socklen_t)addrptr->ai_addrlen,
                            hoststr,
                            NI_MAXHOST,
                            servstr,
                            NI_MAXSERV,
                            NI_NUMERICHOST | NI_NUMERICSERV
                            );
        if (retval != 0)
        {
            fprintf(stderr, "getnameinfo failed: %d\n", retval);
            goto cleanup;
        }

        fprintf(stdout, "socket 0x%x bound to address %s and port %s\n",
                server_sockets[socket_count], hoststr, servstr);

        // Increment the socket count again
        socket_count++;

        // Increment the address pointer
        addrptr = addrptr->ai_next;
    }

    // We need a server thread per socket so allocate space for the thread handle
    server_threads = (HANDLE *)HeapAlloc(
                                        GetProcessHeap(),
                                        HEAP_ZERO_MEMORY,
                                        sizeof(HANDLE) * socket_count
                                        );
    if (server_threads == NULL)
    {
        fprintf(stderr, "HeapAlloc failed: %d\n", GetLastError());
        goto cleanup;
    }

    // Create a thread for each address family which will handle that socket
    for (i=0; i < socket_count ;i++)
    {
        server_threads[i] = CreateThread(
                                        NULL,
                                        0,
                                        ServerThread,
                                        (LPVOID)server_sockets[i],
                                        0,
                                        NULL
                                        );
        if (server_threads[i] == NULL)
        {
            fprintf(stderr, "CreateThread failed: %d\n", GetLastError());
            goto cleanup;
        }
    }

    // Wait until the threads exit, then cleanup
    retval = WaitForMultipleObjects(
                                   socket_count,
                                   server_threads,
                                   TRUE,
                                   INFINITE
                                   );
    if ((retval == WAIT_FAILED) || (retval == WAIT_TIMEOUT))
    {
        fprintf(stderr, "WaitForMultipleObjects failed: %d\n", GetLastError());
        goto cleanup;
    }

    cleanup:

    if (results != NULL)
    {
        freeaddrinfo(results);
        results = NULL;
    }

    // Release socket resources
    if (server_sockets != NULL)
    {
        for (i=0; i < socket_count ;i++)
        {
            if (server_sockets[i] != INVALID_SOCKET)
                closesocket(server_sockets[i]);
            server_sockets[i] = INVALID_SOCKET;
        }

        // Free the array
        HeapFree(GetProcessHeap(), 0, server_sockets);
        server_sockets = NULL;
    }

    // Release thread resources
    if (server_threads != NULL)
    {
        for (i=0; i < socket_count ;i++)
        {
            if (server_threads[i] != NULL)
                CloseHandle(server_threads[i]);
            server_threads[i] = NULL;
        }

        // Free the array
        HeapFree(GetProcessHeap(), 0, server_threads);
        server_threads = NULL;
    }

    return 0;
}

DWORD WINAPI ServerThread ( LPVOID lpParam )

Definition at line 354 of file Simples.c.

{
    SOCKET           s,                     // Server socket
    sc = INVALID_SOCKET;   // Client socket (TCP)
    SOCKADDR_STORAGE from;
    char             Buffer[DEFAULT_BUFFER_LEN],
    servstr[NI_MAXSERV],
    hoststr[NI_MAXHOST];
    int              socket_type,
    retval,
    fromlen,
    bytecount;

    // Retrieve the socket handle
    s = (SOCKET) lpParam;

    // Get the socket type back
    fromlen = sizeof(socket_type);
    retval = getsockopt(s, SOL_SOCKET, SO_TYPE, (char *)&socket_type, &fromlen);
    if (retval == INVALID_SOCKET)
    {
        fprintf(stderr, "getsockopt(SO_TYPE) failed: %d\n", WSAGetLastError());
        goto cleanup;
    }

    for (;;)
    {
        fromlen = sizeof(from);

        if (socket_type == SOCK_STREAM)
        {
            if (sc != INVALID_SOCKET)
            {
                //
                // If we have a client connection recv and send until done
                //
                bytecount = recv(sc, Buffer, DEFAULT_BUFFER_LEN, 0);
                if (bytecount == SOCKET_ERROR)
                {
                    fprintf(stderr, "recv failed: %d\n", WSAGetLastError());
                    goto cleanup;
                }
                else if (bytecount == 0)
                {
                    // Client connection was closed
                    retval = shutdown(sc, SD_SEND);
                    if (retval == SOCKET_ERROR)
                    {
                        fprintf(stderr, "shutdown failed: %d\n", WSAGetLastError());
                        goto cleanup;
                    }

                    closesocket(sc);
                    sc = INVALID_SOCKET;
                }
                else
                {
                    printf("read %d bytes\n", bytecount);

                    //
                    // Now echo the data back
                    //

                    bytecount =  send(sc, Buffer, bytecount, 0);
                    if (bytecount == SOCKET_ERROR)
                    {
                        fprintf(stderr, "send failed: %d\n", WSAGetLastError());
                        goto cleanup;
                    }

                    printf("wrote %d bytes\n", bytecount);
                }
            }
            else
            {
                //
                // No client connection so wait for one
                //
                sc = accept(s, (SOCKADDR *)&from, &fromlen);
                if (sc == INVALID_SOCKET)
                {
                    fprintf(stderr, "accept failed: %d\n", WSAGetLastError());
                    goto cleanup;
                }

                // Display the client's address
                retval = getnameinfo(
                                    (SOCKADDR *)&from,
                                    fromlen,
                                    hoststr,
                                    NI_MAXHOST,
                                    servstr,
                                    NI_MAXSERV,
                                    NI_NUMERICHOST | NI_NUMERICSERV
                                    );
                if (retval != 0)
                {
                    fprintf(stderr, "getnameinfo failed: %d\n", retval);
                    goto cleanup;
                }

                printf("Accepted connection from host %s and port %s\n",
                       hoststr, servstr);
            }
        }
        else
        {
            //
            // Receive and send data
            //
            bytecount = recvfrom(s, Buffer, DEFAULT_BUFFER_LEN, 0, (SOCKADDR *)&from, &fromlen);
            if (bytecount == SOCKET_ERROR)
            {
                //
                // We may get WSAECONNRESET errors in response to ICMP port unreachable
                //    messages so we'll just ignore those
                //
                if (WSAGetLastError() != WSAECONNRESET)
                {
                    fprintf(stderr, "recvfrom failed; %d\n", WSAGetLastError());
                    goto cleanup;
                }
                else
                {
                    continue;
                }
            }

            //
            // Display the source of the datagram
            //
            retval = getnameinfo(
                                (SOCKADDR *)&from,
                                fromlen,
                                hoststr,
                                NI_MAXHOST,
                                servstr,
                                NI_MAXSERV,
                                NI_NUMERICHOST | NI_NUMERICSERV
                                );
            if (retval != 0)
            {
                fprintf(stderr, "getnameinfo failed: %d\n", retval);
                goto cleanup;
            }

            printf("read %d bytes from host %s and port %s\n",
                   bytecount, hoststr, servstr);

            //
            // Echo the datagram back
            //
            bytecount = sendto(s, Buffer, bytecount, 0, (SOCKADDR *)&from, fromlen);
            if (bytecount == SOCKET_ERROR)
            {
                fprintf(stderr, "sendto failed: %d\n", WSAGetLastError());
                goto cleanup;
            }

            printf("sent %d bytes to host %s and port %s\n",
                   bytecount, hoststr, servstr);
        }

    }

    cleanup:

    // Close the client connection if present
    if (sc != INVALID_SOCKET)
    {
        closesocket(sc);
        sc = INVALID_SOCKET;
    }

    return 0;
}

void Usage ( char * progname )

Definition at line 39 of file Simples.c.

{
    fprintf(stderr,"Usage\n%s -p [protocol] -e [endpoint] -i [interface] [-4] [-6]\n"
            "Where:\n"
            "\t-p protocol   - is one of \"TCP\" or \"UDP\"\n"
            "\t-e endpoint   - is the port to listen on\n"
            "\t-i interface  - is the string local address to bind to\n"
            "\t-4            - force IPv4\n"
            "\t-6            - force IPv6\n"
            "\n"
            "Defaults are TCP,5001 and INADDR_ANY and IN6ADDR_ANY (if IPv6 present)\n",
            progname
           );
    WSACleanup();
    exit(1);
}

Generated on Wed Nov 13 2024 16:54:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/Sockdup/Sockdupc.c File Reference

  • NetDS
  • WinSock
  • Sockdup
Functions | Variables

Sockdupc.c File Reference

#include <winsock2.h>
#include <ws2tcpip.h>
#include <wspiapi.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

Go to the source code of this file.

Functions

BOOL | ConsoleCtrlHandler (DWORD dwEvent)
BOOL | DoGracefulShutdown (SOCKET sock)
int __cdecl | main (int argc, char **argv)
void | Usage (char *szProgramName)

Variables

const int | DEFAULT_ITERATIONS = 10
char * | DEFAULT_PORT = "8765"
SOCKET | gsConnect = INVALID_SOCKET
const int | LOOP_FOREVER = -1

Function Documentation

BOOL ConsoleCtrlHandler ( DWORD dwEvent )

Definition at line 221 of file Sockdupc.c.

{
   // Do a best effort cleanup
   if (gsConnect != INVALID_SOCKET)
   {
       closesocket(gsConnect);
       gsConnect = INVALID_SOCKET;
   }
   WSACleanup();
   printf("Client terminated. Bye!\n");

   return FALSE;
}

BOOL DoGracefulShutdown ( SOCKET sock )

Definition at line 238 of file Sockdupc.c.

{
    BOOL bRetVal = FALSE;
    WSAEVENT hEvent = WSA_INVALID_EVENT;
    long lNetworkEvents = 0;
    int status = 0;

    hEvent = WSACreateEvent();
    if (hEvent == WSA_INVALID_EVENT)
    {
        fprintf(stderr, "DoGracefulShutdown: WSACreateEvent failed: %d\n",
                WSAGetLastError());
        goto CLEANUP;
    }

    lNetworkEvents = FD_CLOSE;
    if (WSAEventSelect(sock, hEvent, lNetworkEvents) != 0)
    {
        fprintf(stderr, "DoGracefulShutdown: WSAEventSelect failed: %d\n",
                WSAGetLastError());
        goto CLEANUP;
    }

    if (shutdown(sock, SD_SEND) != 0)
    {
        fprintf(stderr, "DoGracefulShutdown: shutdown failed: %d\n",
                WSAGetLastError());
        goto CLEANUP;
    }

    if (WaitForSingleObject(hEvent, INFINITE) != WAIT_OBJECT_0)
    {
        fprintf(stderr, "DoGracefulShutdown: WaitForSingleObject failed: %d\n",
                WSAGetLastError());
        goto CLEANUP;
    }

    do
    {
        char buf[128];

        status = recv(sock, buf, sizeof(buf), 0);
    } while (!(status == 0 || status == SOCKET_ERROR));

    if (closesocket(sock) != 0)
    {
        fprintf(stderr, "DoGracefulShutdown: closesocket failed: %d\n",
                WSAGetLastError());
        goto CLEANUP;
    }

    printf("Socket %d has been closed gracefully\n", sock);
    sock = INVALID_SOCKET;
    bRetVal = TRUE;

CLEANUP:

    if (hEvent != WSA_INVALID_EVENT)
    {
        WSACloseEvent(hEvent);
        hEvent = WSA_INVALID_EVENT;
    }

    if (sock != INVALID_SOCKET)
    {
        fprintf(stderr, "DoGracefulShutdown: Can't close socket gracefully. "
                        "So, closing it anyway ... \n");
        closesocket(sock);
        sock = INVALID_SOCKET;
    }

    return bRetVal;
}

int __cdecl main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 43 of file Sockdupc.c.

{
   char szBuf[MAX_PATH+1];
   char *pszServerName = "localhost";
   char *pszPort = DEFAULT_PORT;
   int i, nStatus, nLoopCount;
   int nIterations = DEFAULT_ITERATIONS;
   struct addrinfo hints;
   struct addrinfo *res = NULL;
   WSADATA wsaData;
   WSABUF wsaBuf;
   DWORD dwSent = 0;
   DWORD dwFlags = 0;

   if (argc > 1)
   {
      for(i = 1; i < argc; i++)
      {
         if ((argv[i][0] == '-') || (argv[i][0] == '/'))
         {
            switch(tolower(argv[i][1]))
            {
               case 'n':
                  if (i + 1 < argc)
                      pszServerName = argv[++i];
                  break;

               case 'e':
                  if (i + 1 < argc)
                       pszPort = argv[++i];
                  break;

               case 'l':
                  if (i + 1 < argc && argv[i+1])
                  {
                     if (argv[i+1][0] != '-')  // "-l 6"
                     {
                        nIterations = atoi(argv[i+1]);
                        i++;
                     }
                     else if (isdigit(argv[i+1][1])) // "-l -6"
                     {
                        nIterations = 0;
                        i++;
                     }
                     else // "-l -e 2000"
                        nIterations = LOOP_FOREVER;
                  }
                  else // "-e 2000 -l"
                     nIterations = LOOP_FOREVER;

                  break;

               default:
                  Usage(argv[0]);
                  exit(-1);
            }
         }
         else
         {
            Usage(argv[0]);
            exit(-1);
         }
      }
   }

   if (nIterations == 0)
        exit(-1);

   // Install the CTRL+BREAK and CTRL+C Handler
   if (SetConsoleCtrlHandler((PHANDLER_ROUTINE)ConsoleCtrlHandler,
                             TRUE)
                            == FALSE)
      fprintf(stderr, "SetConsoleCtrlHandler failed: %d", GetLastError());

   if ((nStatus = WSAStartup(0x202,&wsaData)) != 0)
   {
      fprintf(stderr, "\nWinsock 2 DLL initialization failed: %d\n", nStatus);
      exit(-1);
   }

    memset(&hints, 0, sizeof(hints));
    hints.ai_family   = AF_UNSPEC;
    hints.ai_socktype = SOCK_STREAM;
    hints.ai_protocol = IPPROTO_TCP;

    //  getaddrinfo: declared in winsock2.h import library is ws2_32.lib
    if (getaddrinfo(pszServerName, pszPort, &hints, &res) != 0)
    {
        fprintf(stderr, "getaddrinfo failed for gListenSocket: %d\n", WSAGetLastError());
        goto CLEANUP;
    }

    if (res == NULL)
    {
        fprintf(stderr, "No matching addresses found. "
                        "getaddrinfo returned res = NULL\n");
        goto CLEANUP;
    }

    gsConnect = WSASocket(
                res->ai_family,
                res->ai_socktype,
                res->ai_protocol,
                NULL,
                0,
                0);

   if (gsConnect == INVALID_SOCKET)
   {
      fprintf(stderr, "\nWSASocket() failed: %d\n", WSAGetLastError());
      goto CLEANUP;
   }

   printf("Connecting to: %s ...\n", pszServerName);

   if (connect(gsConnect, (struct sockaddr*)res->ai_addr, res->ai_addrlen)
               == SOCKET_ERROR)
   {
      fprintf(stderr, "\nconnect() failed: %d\n", WSAGetLastError());
      goto CLEANUP;
   }

   nLoopCount = 0;

   while (TRUE)
   {
      szBuf[0] = '\0';
      wsprintf(szBuf, "Test message %d\n", nLoopCount++);
      wsaBuf.len = lstrlen(szBuf);
      wsaBuf.buf = (char *)szBuf;

      printf("Sending --> %s", szBuf);

      nStatus = WSASend(gsConnect,
                        &wsaBuf,
                        1,
                        &dwSent,
                        dwFlags,
                        (LPWSAOVERLAPPED) NULL,
                        0);

      if (nStatus == SOCKET_ERROR)
      {
         fprintf(stderr, "WSASend() failed: %d\n", WSAGetLastError());
         break;
      }
      else if (dwSent == 0)
      {
         printf("Server closed connection\n");
         break;
      }

      if (((nIterations != LOOP_FOREVER)) && (nLoopCount >= nIterations))
         break;
   }

CLEANUP:

   if (gsConnect != INVALID_SOCKET)
   {
       DoGracefulShutdown(gsConnect);
       gsConnect = INVALID_SOCKET;
   }

   if (res != NULL)
   {
        // return the addrinfo structure allocated for us by getaddrinfo.
        freeaddrinfo(res);
        res = NULL;
   }

   WSACleanup();
   return 0;
}

void Usage ( char * szProgramName )

Definition at line 35 of file Sockdupc.c.

{
   fprintf(stderr, "Usage: %s [-n Server] [-e Endpoint] [-l Iterations]\n\n", szProgramName);
   fprintf(stderr, "   Server:     server name or IP address (default localhost)\n");
   fprintf(stderr, "   Endpoint:   port to connect to (default %s)\n", DEFAULT_PORT);
   fprintf(stderr, "   Iterations: number of messages to send (default %d)\n", DEFAULT_ITERATIONS);
}

Variable Documentation

const int DEFAULT_ITERATIONS = 10

Definition at line 28 of file Sockdupc.c.

char* DEFAULT_PORT = "8765"

Definition at line 27 of file Sockdupc.c.

SOCKET gsConnect = INVALID_SOCKET

Definition at line 30 of file Sockdupc.c.

const int LOOP_FOREVER = -1

Definition at line 29 of file Sockdupc.c.

Generated on Wed Nov 13 2024 16:54:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: NetDS/WinSock/Sockdup/Sockdups.c File Reference

  • NetDS
  • WinSock
  • Sockdup
Functions | Variables

Sockdups.c File Reference

#include <winsock2.h>
#include <ws2tcpip.h>
#include <wspiapi.h>
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>

Go to the source code of this file.

Functions

BOOL | ConsoleCtrlHandler (DWORD dwEvent)
BOOL | DispatchChild (SOCKET ClientSock, char *ChildProcName)
void | DoChild (char *pszChildFileMappingObj)
void | DoCleanup (void)
BOOL | DoGracefulShutdown (SOCKET sock)
void | DoParent (char *pszIPAdress, char *szPort, char *pszChildProcName)
SOCKET | GetSocket (char *szFileMappingObj)
int __cdecl | main (int argc, char **argv)
void | PrintAddressString (LPSOCKADDR pSockAddr, DWORD dwSockAddrLen)
void | Usage (char *szProgramName)

Variables

const char | CHILD [] = "child"
char * | DEFAULT_PORT = "8765"
const char | FILE_MAPPING_BASE_NAME [] = "/MAPPED_FILE/WSADuplicateSocket"
HANDLE | ghChildFileMappingEvent = NULL
HANDLE | ghMMFileMap = NULL
HANDLE | ghParentFileMappingEvent = NULL
SOCKET | gsAccept = INVALID_SOCKET
SOCKET | gsListen = INVALID_SOCKET
const char | PARENT [] = "parent"

Function Documentation

BOOL ConsoleCtrlHandler ( DWORD dwEvent )

Definition at line 640 of file Sockdups.c.

{
   DoCleanup();
   printf("Server terminated. Bye!\n");

   return FALSE;
}

BOOL DispatchChild | ( | SOCKET | ClientSock,
 |  | char * | ChildProcName
 | ) |  |

Definition at line 389 of file Sockdups.c.

{
   char szChildComandLineBuf[MAX_PATH];
   char szFileMappingObj[MAX_PATH];
   BOOL bResult = TRUE;
   STARTUPINFO siParent;
   PROCESS_INFORMATION piChild;
   char szParentEventName[MAX_PATH];
   char szChildEventName[MAX_PATH];

   ZeroMemory(&siParent, sizeof(siParent));
   siParent.cb = sizeof(siParent);
   siParent.dwFlags = STARTF_USECOUNTCHARS;
   siParent.dwXCountChars = 10 * MAX_PATH;
   siParent.dwYCountChars = MAX_PATH;

   // Compose a name for the memory mappled file.
   sprintf(szFileMappingObj,
           "%s%i",
           FILE_MAPPING_BASE_NAME,
           nChildProcCount++);

   sprintf(szParentEventName, "%s%s", szFileMappingObj, PARENT);
   sprintf(szChildEventName, "%s%s", szFileMappingObj, CHILD);

   // Create an event to signal the child
   // that the protocol info is set
   if ((ghParentFileMappingEvent = CreateEvent(NULL, TRUE, FALSE, szParentEventName)) == NULL)
   {
      fprintf(stderr, "\nCreateEvent() failed: %d\n", GetLastError());
      return FALSE;
   }

   // Create an event to for the child to signal the
   // parent that the protocol info can be released
   if ((ghChildFileMappingEvent = CreateEvent(NULL, TRUE, FALSE, szChildEventName)) == NULL)
   {
      fprintf(stderr, "\nCreateEvent() failed: %d\n", GetLastError());
      CloseHandle(ghParentFileMappingEvent);
      ghParentFileMappingEvent = NULL;
      return FALSE;
   }

   // Set up the child process command line options.
   // The memory mapped file name is passed in as
   // one of the options.
   sprintf(szChildComandLineBuf,
           "%s /c %s",
           pszChildProcName,
           szFileMappingObj);

   if (CreateProcess(NULL,
                     szChildComandLineBuf,
                     NULL,
                     NULL,
                     FALSE,
                     CREATE_NEW_CONSOLE,
                     NULL,
                     NULL,
                     &siParent,
                     &piChild))
   {
      WSAPROTOCOL_INFO ProtocolInfo;
      int nError;
      int nWaitCount = 0;
      LPVOID lpView;
      int nStructLen = sizeof(WSAPROTOCOL_INFO);

      // Get the protocol information
      // to be used to duplicate the socket
      if (WSADuplicateSocket(ClientSock,
                         piChild.dwProcessId,
                         &ProtocolInfo) == SOCKET_ERROR)
      {
            fprintf(stderr, "WSADuplicateSocket(): failed. Error = %d\n", WSAGetLastError());
            DoCleanup();
            exit(1);
      }

      // Set the protocol information in a
      // memory mapped file for the child to use
      ghMMFileMap = CreateFileMapping(INVALID_HANDLE_VALUE,
                                      NULL,
                                      PAGE_READWRITE,
                                      0,
                                      nStructLen,
                                      szFileMappingObj);

      if (ghMMFileMap != NULL)
      {
         if ((nError = GetLastError()) == ERROR_ALREADY_EXISTS)
            fprintf(stderr, "CreateFileMapping(): mappping file already exists\n");
         else
         {
            lpView = MapViewOfFile(ghMMFileMap,
                                   FILE_MAP_READ | FILE_MAP_WRITE,
                                   0, 0, 0);

            if (lpView != NULL)
            {
               memcpy(lpView, &ProtocolInfo, nStructLen);
               UnmapViewOfFile(lpView);

               // Signal the child the protocol infomation is set
               SetEvent(ghParentFileMappingEvent);
               // Wait the child to signal that the protocol
               // infomation can be released now
               if (WaitForSingleObject(ghChildFileMappingEvent, 2000) == WAIT_OBJECT_0)
               {
                  fprintf(stderr, "WaitForSingleObject() failed: %d\n", GetLastError());
                  DoCleanup();
                  exit(1);
               }
            }
            else
            {
               fprintf(stderr, "MapViewOfFile() failed: %d\n", GetLastError());
               bResult = FALSE;
            }
         }

         CloseHandle(ghMMFileMap);
         ghMMFileMap = NULL;
      }
      else
      {
         fprintf(stderr, "CreateFileMapping() failed: %d\n", GetLastError());
         bResult = FALSE;
      }

      CloseHandle(piChild.hThread);
      CloseHandle(piChild.hProcess);
   }
   else
   {
      printf("\nCreate child process failed!!!\n");
      bResult = FALSE;
   }

   if (ghParentFileMappingEvent != NULL)
   {
      CloseHandle(ghParentFileMappingEvent);
      ghParentFileMappingEvent = NULL;
   }

   if (ghChildFileMappingEvent != NULL)
   {
      CloseHandle(ghChildFileMappingEvent);
      ghChildFileMappingEvent = NULL;
   }

   return bResult;
}

void DoChild ( char * pszChildFileMappingObj )

Definition at line 317 of file Sockdups.c.

{
   SOCKET sockDuplicated = INVALID_SOCKET;
   DWORD dwProcID;
   char szBuf[MAX_PATH+1];
   WSABUF wsaBuf;
   DWORD dwReceived = 0;
   DWORD dwFlags = 0;
   int nStatus;

   dwProcID = GetCurrentProcessId();

   printf("Child process %lu started ...\n", dwProcID);

   if ((sockDuplicated = GetSocket(pszChildFileMappingObj))
         != INVALID_SOCKET)
   {
      while(TRUE)
      {
         szBuf[0] = '\0';
         wsaBuf.len = MAX_PATH;
         wsaBuf.buf = (char *)szBuf;

         // Receive the data sent by the other side.
         nStatus = WSARecv(sockDuplicated,
                           &wsaBuf,
                           1,
                           &dwReceived,
                           &dwFlags,
                           (LPWSAOVERLAPPED) NULL,
                           0);

         if (nStatus == 0) // success
         {
            if (dwReceived == 0) // Client closed connection
            {
               fprintf(stderr, "Client closed connection\n");
               break;
            }
            else
            {
               // Print whatever is received
               szBuf[dwReceived] = '\0';
               printf("%s", szBuf);
            }
         }
         else // SOCKET_ERROR
         {
            fprintf(stderr, "WSARecv() failed: %d\n", WSAGetLastError());
            break;
         }
      }

      DoGracefulShutdown(sockDuplicated);
      sockDuplicated = INVALID_SOCKET;
   }
   else
      fprintf(stderr, "\nChild socket cannot be obtained: %d\n",
              WSAGetLastError());

   printf("\nChild process %lu has finished!!!\n", dwProcID);

   printf("Press any key to continue ...");
   getchar();
}

void DoCleanup ( void )

Definition at line 649 of file Sockdups.c.

{
   // Do a best effort cleanup
   if (ghParentFileMappingEvent != NULL)
   {
      CloseHandle(ghParentFileMappingEvent);
      ghParentFileMappingEvent = NULL;
   }
   if (ghChildFileMappingEvent != NULL)
   {
      CloseHandle(ghChildFileMappingEvent);
      ghChildFileMappingEvent = NULL;
   }
   if (ghMMFileMap != NULL)
   {
      CloseHandle(ghMMFileMap);
      ghMMFileMap = NULL;
   }
   if (gsListen != INVALID_SOCKET)
   {
      closesocket(gsListen);
      gsListen = INVALID_SOCKET;
   }
   if (gsAccept != INVALID_SOCKET)
   {
      closesocket(gsAccept);
      gsAccept = INVALID_SOCKET;
   }

   WSACleanup();
}

BOOL DoGracefulShutdown ( SOCKET sock )

Definition at line 682 of file Sockdups.c.

{
    BOOL bRetVal = FALSE;
    WSAEVENT hEvent = WSA_INVALID_EVENT;
    long lNetworkEvents = 0;
    int status = 0;

    hEvent = WSACreateEvent();
    if (hEvent == WSA_INVALID_EVENT)
    {
        fprintf(stderr, "DoGracefulShutdown: WSACreateEvent failed: %d\n",
                WSAGetLastError());
        goto CLEANUP;
    }

    lNetworkEvents = FD_CLOSE;
    if (WSAEventSelect(sock, hEvent, lNetworkEvents) != 0)
    {
        fprintf(stderr, "DoGracefulShutdown: WSAEventSelect failed: %d\n",
                WSAGetLastError());
        goto CLEANUP;
    }

    if (shutdown(sock, SD_SEND) != 0)
    {
        fprintf(stderr, "DoGracefulShutdown: shutdown failed: %d\n",
                WSAGetLastError());
        goto CLEANUP;
    }

    if (WaitForSingleObject(hEvent, INFINITE) != WAIT_OBJECT_0)
    {
        fprintf(stderr, "DoGracefulShutdown: WaitForSingleObject failed: %d\n",
                WSAGetLastError());
        goto CLEANUP;
    }

    do
    {
        char buf[128];

        status = recv(sock, buf, sizeof(buf), 0);
    } while (!(status == 0 || status == SOCKET_ERROR));

    if (closesocket(sock) != 0)
    {
        fprintf(stderr, "DoGracefulShutdown: closesocket failed: %d\n",
                WSAGetLastError());
        goto CLEANUP;
    }

    printf("Socket %d has been closed gracefully\n", sock);
    sock = INVALID_SOCKET;
    bRetVal = TRUE;

CLEANUP:

    if (hEvent != WSA_INVALID_EVENT)
    {
        WSACloseEvent(hEvent);
        hEvent = WSA_INVALID_EVENT;
    }

    if (sock != INVALID_SOCKET)
    {
        fprintf(stderr, "DoGracefulShutdown: Can't close socket gracefully. "
                        "So, closing it anyway ... \n");
        closesocket(sock);
        sock = INVALID_SOCKET;
    }

    return bRetVal;
}

void DoParent | ( | char * | pszIPAdress,
 |  | char * | szPort,
 |  | char * | pszChildProcName
 | ) |  |

Definition at line 160 of file Sockdups.c.

{
   int nFromLen;
   SOCKADDR_STORAGE saFrom;
   DWORD dwProcID;
   struct addrinfo hints;
   struct addrinfo *res;
   struct addrinfo *pAddr;
   int i;

   // Install the CTRL+BREAK and CTRL+C Handler
   if (SetConsoleCtrlHandler((PHANDLER_ROUTINE)ConsoleCtrlHandler,
                             TRUE)
                            == FALSE)
        fprintf(stderr,"SetConsoleCtrlHandler failed: %d", GetLastError());

   dwProcID = GetCurrentProcessId();

   printf("Parent process %lu started ...\n", dwProcID);

   // prepare the hints for the type of socket we are interested in.
   memset(&hints, 0, sizeof(hints));
   hints.ai_family = AF_UNSPEC;
   hints.ai_protocol = IPPROTO_TCP;
   hints.ai_socktype = SOCK_STREAM;
   hints.ai_flags = AI_PASSIVE; // since we're going to bind on this socket.

   // getaddrinfo is the protocol independent version of GetHostByName.
   // the res contains the result.
   if (getaddrinfo(pszIPAddress,
                   pszPort,
                   &hints,
                   &res) != NO_ERROR)
   {
       fprintf(stderr,"getaddrinfo failed. Error = %d\n", WSAGetLastError());
       goto CLEANUP;
   }

   printf("getaddrinfo successful.Enumerating the returned addresses ...\n\n");

   // for each returned interface, create a listening socket.
   gsListen = INVALID_SOCKET;
   for (pAddr = res, i = 1; pAddr != NULL; pAddr = pAddr->ai_next, i++)
   {
       printf("Trying Address : %d from getaddrinfo\n", i);
       PrintAddressString(pAddr->ai_addr, pAddr->ai_addrlen);
       // create a suitable socket for this interface.
       gsListen = WSASocket(pAddr->ai_family,
                            pAddr->ai_socktype,
                            pAddr->ai_protocol,
                            NULL,
                            0,
                            0);
       if (gsListen != INVALID_SOCKET)
            break;

       fprintf(stderr,"WSASocket failed. Error = %d\n", WSAGetLastError());
       fprintf(stderr,"Ignoring this address and continuing with the next. \n\n");
   }

   if (pAddr == NULL)
   {
        fprintf(stderr, "Couldn't find any suitable socket\n");
        goto CLEANUP;
   }

   gsListen = WSASocket(pAddr->ai_family,
                        pAddr->ai_socktype,
                        pAddr->ai_protocol,
                        (LPWSAPROTOCOL_INFO) NULL,
                        0,
                        WSA_FLAG_OVERLAPPED);

   if (gsListen == INVALID_SOCKET)
   {
      fprintf(stderr, "\nWSASocket() failed to obtain the listen socket: %d\n",
              WSAGetLastError());
      goto CLEANUP;
   }

   // bind() associates a local address and port
   // combination with the socket just created.
   if (bind(gsListen, (struct sockaddr*)pAddr->ai_addr, pAddr->ai_addrlen)
            == SOCKET_ERROR)
   {
      fprintf(stderr, "\nbind() failed: %d\n",
              WSAGetLastError());
      closesocket(gsListen);
      gsListen = INVALID_SOCKET;
      goto CLEANUP;
   }

   // start listening on the socket for incoming connections
   if (listen(gsListen,5) == SOCKET_ERROR)
   {
      fprintf(stderr, "\nlisten() failed: %d\n",
              WSAGetLastError());
      closesocket(gsListen);
      gsListen = INVALID_SOCKET;
      goto CLEANUP;
   }

   nFromLen = sizeof(saFrom);

   printf("Listening on %s:%s\n", pszIPAddress? pszIPAddress : "localhost", pszPort);

   while(TRUE)
   {
      printf("Waiting for new connection (Type CTRL+C to exit) ...\n\n");

      gsAccept = WSAAccept(gsListen,
                           (struct sockaddr*)&saFrom,
                           &nFromLen,
                           (LPCONDITIONPROC)NULL,
                           0);

      if(gsAccept == INVALID_SOCKET)
      {
         fprintf(stderr, "\nWSAAccept() failed: %d\n",
                 WSAGetLastError());
         break;
      }

      // Spawn a child process to handle the I/O.
      DispatchChild(gsAccept, pszChildProcName);

      // Doing a hard shutdown here is a no-no because it
      // will also reset the duplicated child socket.
      /*
      LINGER lingerStruct;

      lingerStruct.l_onoff = 1;
      lingerStruct.l_linger = 0;
      setsockopt(gsAccept, SOL_SOCKET, SO_LINGER,
                 (char *)&lingerStruct, sizeof(lingerStruct));
      */

      closesocket(gsAccept);
      gsAccept = INVALID_SOCKET;
   }

CLEANUP:

   if (gsListen != INVALID_SOCKET)
   {
       closesocket(gsListen);
       gsListen = INVALID_SOCKET;
   }

   if (res != NULL)
   {
        freeaddrinfo(res);
        res = NULL;
   }
}

SOCKET GetSocket ( char * szFileMappingObj )

Definition at line 547 of file Sockdups.c.

{
   WSAPROTOCOL_INFO ProtocolInfo;
   SOCKET sockDuplicated = INVALID_SOCKET;
   char szParentEventName[MAX_PATH];
   char szChildEventName[MAX_PATH];

   sprintf(szParentEventName, "%s%s", szFileMappingObj, PARENT);
   sprintf(szChildEventName, "%s%s", szFileMappingObj, CHILD);

   // Open the events
   if ((ghParentFileMappingEvent = OpenEvent(SYNCHRONIZE, FALSE, szParentEventName)) == 0)
   {
      fprintf(stderr, "OpenEvent() failed: %d\n", GetLastError());
      return INVALID_SOCKET;
   }

   if ((ghChildFileMappingEvent = OpenEvent(SYNCHRONIZE, FALSE, szChildEventName)) == 0)
   {
      fprintf(stderr, "OpenEvent() failed: %d\n", GetLastError());
      CloseHandle(ghParentFileMappingEvent);
      ghParentFileMappingEvent = NULL;
      return INVALID_SOCKET;
   }

   // Wait for the parent to signal that the protocol info
   // is ready to be accessed
   if (WaitForSingleObject(ghParentFileMappingEvent, 2000) == WAIT_FAILED)
   {
      fprintf(stderr, "WaitForSingleObject() failed: %d\n", GetLastError());
      DoCleanup();
      exit(1);
   }

   ghMMFileMap = OpenFileMapping(FILE_MAP_READ | FILE_MAP_WRITE,
                                 FALSE,
                                 szFileMappingObj);

   if (ghMMFileMap != NULL)
   {
      LPVOID lpView = MapViewOfFile(ghMMFileMap,
                                    FILE_MAP_READ | FILE_MAP_WRITE,
                                    0, 0, 0);

      if ((BYTE*) lpView != NULL)
      {
         int nStructLen = sizeof(WSAPROTOCOL_INFO);

         memcpy(&ProtocolInfo, lpView, nStructLen);
         UnmapViewOfFile(lpView);

         // Duplicate the socket based on the protocol
         // information stored in the memory mapped file.
         sockDuplicated = WSASocket(FROM_PROTOCOL_INFO,
                                    FROM_PROTOCOL_INFO,
                                    FROM_PROTOCOL_INFO,
                                    &ProtocolInfo,
                                    0,
                                    0);

         // Signal the parent the we are done
         // with the mapped file
         SetEvent(ghChildFileMappingEvent);
      }
      else
         fprintf(stderr, "MapViewOfFile() failed: %d\n", GetLastError());
   }
   else
      fprintf(stderr, "CreateFileMapping() failed: %d\n", GetLastError());

   if (ghParentFileMappingEvent != NULL)
   {
      CloseHandle(ghParentFileMappingEvent);
      ghParentFileMappingEvent = NULL;
   }

   if (ghChildFileMappingEvent != NULL)
   {
      CloseHandle(ghChildFileMappingEvent);
      ghChildFileMappingEvent = NULL;
   }

   if (ghMMFileMap != NULL)
   {
      CloseHandle(ghMMFileMap);
      ghMMFileMap = NULL;
   }

   return sockDuplicated;
}

int __cdecl main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 97 of file Sockdups.c.

{
   char *pszIPAdress = NULL;
   char *pszPort = DEFAULT_PORT;
   char *pszChildFileMappingObj = NULL;
   WSADATA wsaData;
   BOOL bParent = TRUE;
   int nStatus;

   if (argc > 1)
   {
      int i;

      for(i = 1; i < argc; i++)
      {
         if ((argv[i][0] == '-') || (argv[i][0] == '/'))
         {
            switch(tolower(argv[i][1]))
            {
               case 'c':
                  bParent = FALSE;
                  if (i + 1 < argc)
                    pszChildFileMappingObj = argv[++i];
                  break;
               case 'i':
                  if (i + 1 < argc)
                    pszIPAdress = argv[++i];
                  break;
               case 'e':
                  if (i + 1 < argc)
                    pszPort = argv[++i];
                  break;
               default:
                  Usage(argv[0]);
                  exit(1);
            }
         }
         else
         {
            Usage(argv[0]);
            exit(1);
         }
      }
   }

   if ((nStatus = WSAStartup(0x202,&wsaData)) != 0)
   {
      fprintf(stderr, "\nWinsock 2 DLL initialization failed: %d\n", nStatus);
      WSACleanup();
      exit(-1);
   }

   if (bParent) // Run as parent
      DoParent(pszIPAdress, pszPort, argv[0]);
   else    // Run as child
      DoChild(pszChildFileMappingObj);

   WSACleanup();

   return 0;
}

void PrintAddressString | ( | LPSOCKADDR | pSockAddr,
 |  | DWORD | dwSockAddrLen
 | ) |  |

Definition at line 62 of file Sockdups.c.

{
    // INET6_ADDRSTRLEN is the maximum size of a valid IPv6 address
    // including port,colons,NULL,etc.
    char buf[INET6_ADDRSTRLEN];
    DWORD dwBufSize = 0;

    memset(buf,0,sizeof(buf));
    dwBufSize = sizeof(buf);

    // This function converts the pSockAddr to a printable format into buf.
    if (WSAAddressToString(pSockAddr,
                           dwSockAddrLen,
                           NULL,
                           buf,
                           &dwBufSize) == SOCKET_ERROR)
    {
        printf("ERROR: WSAAddressToString failed %d \n", WSAGetLastError());
        goto CLEANUP;
    }

    printf("%s\n", buf);

CLEANUP:
    return;
}

void Usage ( char * szProgramName )

Definition at line 52 of file Sockdups.c.

{
   fprintf(stderr, "Usage: %s [-e Endpoint] [-i IPAddress]\n\n", szProgramName);
   fprintf(stderr, "   Endpoint:  port to listen on (default %s)\n", DEFAULT_PORT);
   fprintf(stderr, "   IPAddress: IP address to bind to (default INADDR_ANY)\n");
}

Variable Documentation

const char CHILD[] = "child"

Definition at line 44 of file Sockdups.c.

char* DEFAULT_PORT = "8765"

Definition at line 41 of file Sockdups.c.

const char FILE_MAPPING_BASE_NAME[] = "/MAPPED_FILE/WSADuplicateSocket"

Definition at line 42 of file Sockdups.c.

HANDLE ghChildFileMappingEvent = NULL

Definition at line 49 of file Sockdups.c.

HANDLE ghMMFileMap = NULL

Definition at line 50 of file Sockdups.c.

HANDLE ghParentFileMappingEvent = NULL

Definition at line 48 of file Sockdups.c.

SOCKET gsAccept = INVALID_SOCKET

Definition at line 47 of file Sockdups.c.

SOCKET gsListen = INVALID_SOCKET

Definition at line 46 of file Sockdups.c.

const char PARENT[] = "parent"

Definition at line 43 of file Sockdups.c.

Generated on Wed Nov 13 2024 16:54:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/Authentication/KerbSubAuth/SubAuth.c File Reference

  • Security
  • Authentication
  • KerbSubAuth
Defines | Functions

SubAuth.c File Reference

#include <windef.h>
#include <windows.h>
#include <lmcons.h>
#include <lmaccess.h>
#include <lmapibuf.h>
#include <subauth.h>
#include <stdio.h>

Go to the source code of this file.

Defines

#define | _UNICODE
#define | LOGFILE L"C:\\lastlog.txt"
#define | UNICODE

Functions

NTSTATUS NTAPI | Msv1_0SubAuthenticationFilter (IN NETLOGON_LOGON_INFO_CLASS LogonLevel, IN PVOID LogonInformation, IN ULONG Flags, IN PUSER_ALL_INFORMATION UserAll, OUT PULONG WhichFields, OUT PULONG UserFlags, OUT PBOOLEAN Authoritative, OUT PLARGE_INTEGER LogoffTime, OUT PLARGE_INTEGER KickoffTime)

Define Documentation

#define _UNICODE

Definition at line 22 of file SubAuth.c.

#define LOGFILE L"C:\\lastlog.txt"

Definition at line 199 of file SubAuth.c.

#define UNICODE

Definition at line 23 of file SubAuth.c.

Function Documentation

NTSTATUS NTAPI Msv1_0SubAuthenticationFilter | ( | IN NETLOGON_LOGON_INFO_CLASS | LogonLevel,
 |  | IN PVOID | LogonInformation,
 |  | IN ULONG | Flags,
 |  | IN PUSER_ALL_INFORMATION | UserAll,
 |  | OUT PULONG | WhichFields,
 |  | OUT PULONG | UserFlags,
 |  | OUT PBOOLEAN | Authoritative,
 |  | OUT PLARGE_INTEGER | LogoffTime,
 |  | OUT PLARGE_INTEGER | KickoffTime
 | ) |  |

Definition at line 36 of file SubAuth.c.

                   :

    The subauthentication routine does client/server specific authentication
    of a user. The credentials of the user are passed in addition to all the
    information from SAM defining the user. This routine decides whether to
    let the user log on.

Arguments:

    LogonLevel -- Specifies the level of information given in
        LogonInformation.

    LogonInformation -- Specifies the description for the user
        logging on.  The LogonDomainName field should be ignored.

    Flags - Flags describing the circumstances of the logon.

        MSV1_0_PASSTHRU -- This is a PassThru authenication.  (i.e., the
            user isn't connecting to this machine.)
        MSV1_0_GUEST_LOGON -- This is a retry of the logon using the GUEST
            user account.

    UserAll -- The description of the user as returned from SAM.

    WhichFields -- Returns which fields from UserAllInfo are to be written
        back to SAM.  The fields will only be written if MSV returns success
        to it's caller.  Only the following bits are valid.

        USER_ALL_PARAMETERS - Write UserAllInfo->Parameters back to SAM.  If
            the size of the buffer is changed, the old buffer must be deleted
            using MIDL_user_free() and reallocate the
            buffer using MIDL_user_allocate().

    UserFlags -- Returns UserFlags to be returned from LsaLogonUser in the
        LogonProfile.  The following bits are currently defined:

            LOGON_GUEST -- This was a guest logon
            LOGON_NOENCRYPTION -- The caller didn't specify encrypted credentials

        SubAuthentication packages should restrict themselves to returning
        bits in the high order byte of UserFlags.  However, this convention
        isn't enforced giving the SubAuthentication package more flexibility.

    Authoritative -- Returns whether the status returned is an
        authoritative status which should be returned to the original
        caller.  If not, this logon request may be tried again on another
        domain controller.  This parameter is returned regardless of the
        status code.

    LogoffTime - Receives the time at which the user should log off the
        system.  This time is specified as a GMT relative NT system time.

    KickoffTime - Receives the time at which the user should be kicked
        off the system. This time is specified as a GMT relative system
        time.  Specify, a full scale positive number if the user isn't to
        be kicked off.

Return Value:

    STATUS_SUCCESS: if there was no error.

    STATUS_NO_SUCH_USER: The specified user has no account.
    STATUS_WRONG_PASSWORD: The password was invalid.

    STATUS_INVALID_INFO_CLASS: LogonLevel is invalid.
    STATUS_ACCOUNT_LOCKED_OUT: The account is locked out
    STATUS_ACCOUNT_DISABLED: The account is disabled
    STATUS_ACCOUNT_EXPIRED: The account has expired.
    STATUS_PASSWORD_MUST_CHANGE: Account is marked as Password must change
        on next logon.
    STATUS_PASSWORD_EXPIRED: The Password is expired.
    STATUS_INVALID_LOGON_HOURS - The user is not authorized to log on at
        this time.
    STATUS_INVALID_WORKSTATION - The user is not authorized to log on to
        the specified workstation.

--*/
{
    NTSTATUS Status;
    SYSTEMTIME CurrentTime;
    WCHAR buf[256];
    PNETLOGON_LOGON_IDENTITY_INFO Identity =
  (PNETLOGON_LOGON_IDENTITY_INFO)LogonInformation;

    Status = STATUS_SUCCESS;

    *Authoritative = TRUE;
    *UserFlags = 0;
    *WhichFields = 0;

    GetLocalTime( &CurrentTime );

    if (!Identity) {
  WriteLogFile(TEXT("No identity\r\n"));
  return Status;
    }

    swprintf(buf,
       L"%02d/%02d/%d %02d:%02d:%02d: Logon (level=%d) %wZ\\%wZ (%wZ) from %wZ\r\n",
       CurrentTime.wMonth, CurrentTime.wDay, CurrentTime.wYear,
       CurrentTime.wHour, CurrentTime.wMinute, CurrentTime.wSecond,
       LogonLevel,
       &Identity->LogonDomainName, &Identity->UserName,
       &UserAll->FullName, &Identity->Workstation);
    WriteLogFile(buf);

#if 0
    swprintf(buf, L"   LogonDomainName - %x (%d,%d)\r\n",
       Identity->LogonDomainName.Buffer, (int)Identity->LogonDomainName.Length, (int)Identity->LogonDomainName.MaximumLength);
    WriteLogFile(buf);
    swprintf(buf, L"   UserName - %x (%d,%d)\r\n",
       Identity->UserName.Buffer, (int)Identity->UserName.Length, (int)Identity->UserName.MaximumLength);
    WriteLogFile(buf);
    swprintf(buf, L"   Workstation - %x (%d,%d)\r\n",
       Identity->Workstation.Buffer, (int)Identity->Workstation.Length, (int)Identity->Workstation.MaximumLength);
    WriteLogFile(buf);
#endif

    switch ( LogonLevel ) {
    case NetlogonInteractiveInformation:
    case NetlogonServiceInformation:
    case NetlogonNetworkInformation:

  //
  // If you care you can determine what to do here
  //
        *Authoritative = FALSE;

  if (LogoffTime) {
      LogoffTime->HighPart = 0x7FFFFFFF;
      LogoffTime->LowPart = 0xFFFFFFFF;
  }

  if (KickoffTime) {
      KickoffTime->HighPart = 0x7FFFFFFF;
      KickoffTime->LowPart = 0xFFFFFFFF;
  }
        break;

    default:
        return STATUS_INVALID_INFO_CLASS;
    }

    return Status;
}

Generated on Wed Nov 13 2024 16:54:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/Authentication/MSVSubAuth/SubAuth.c File Reference

  • Security
  • Authentication
  • MSVSubAuth
Defines | Functions

SubAuth.c File Reference

#include <windef.h>
#include <windows.h>
#include <lmcons.h>
#include <lmaccess.h>
#include <lmapibuf.h>
#include <subauth.h>

Go to the source code of this file.

Defines

#define | MILLISECONDS_PER_WEEK 7 * 24 * 60 * 60 * 1000

Functions

NTSTATUS | AccountRestrictions (IN ULONG UserRid, IN PUNICODE_STRING LogonWorkStation, IN PUNICODE_STRING WorkStations, IN PLOGON_HOURS LogonHours, OUT PLARGE_INTEGER LogoffTime, OUT PLARGE_INTEGER KickoffTime)
VOID | CopyUnicodeString (OUT PUNICODE_STRING DestinationString, IN PUNICODE_STRING SourceString OPTIONAL)
BOOLEAN | EqualComputerName (IN PUNICODE_STRING String1, IN PUNICODE_STRING String2)
BOOL | GetPasswordExpired (IN LARGE_INTEGER PasswordLastSet, IN LARGE_INTEGER MaxPasswordAge)
VOID | InitUnicodeString (OUT PUNICODE_STRING DestinationString, IN PCWSTR SourceString OPTIONAL)
NTSTATUS NTAPI | Msv1_0SubAuthenticationFilter (IN NETLOGON_LOGON_INFO_CLASS LogonLevel, IN PVOID LogonInformation, IN ULONG Flags, IN PUSER_ALL_INFORMATION UserAll, OUT PULONG WhichFields, OUT PULONG UserFlags, OUT PBOOLEAN Authoritative, OUT PLARGE_INTEGER LogoffTime, OUT PLARGE_INTEGER KickoffTime)
NTSTATUS NTAPI | Msv1_0SubAuthenticationRoutine (IN NETLOGON_LOGON_INFO_CLASS LogonLevel, IN PVOID LogonInformation, IN ULONG Flags, IN PUSER_ALL_INFORMATION UserAll, OUT PULONG WhichFields, OUT PULONG UserFlags, OUT PBOOLEAN Authoritative, OUT PLARGE_INTEGER LogoffTime, OUT PLARGE_INTEGER KickoffTime)
LARGE_INTEGER | NetpSecondsToDeltaTime (IN ULONG Seconds)
NTSTATUS | QuerySystemTime (OUT PLARGE_INTEGER SystemTime)
NTSTATUS | SampMatchworkstation (IN PUNICODE_STRING LogonWorkStation, IN PUNICODE_STRING WorkStations)

Define Documentation

#define MILLISECONDS_PER_WEEK 7 * 24 * 60 * 60 * 1000

Function Documentation

NTSTATUS AccountRestrictions | ( | IN ULONG | UserRid,
 |  | IN PUNICODE_STRING | LogonWorkStation,
 |  | IN PUNICODE_STRING | WorkStations,
 |  | IN PLOGON_HOURS | LogonHours,
 |  | OUT PLARGE_INTEGER | LogoffTime,
 |  | OUT PLARGE_INTEGER | KickoffTime
 | ) |  |

Definition at line 729 of file SubAuth.c.

                   :

    Validate a user's ability to log on at this time and at the workstation
    being logged onto.

Arguments:

    UserRid - The user id of the user to operate on.

    LogonWorkStation - The name of the workstation the logon is being
        attempted at.

    WorkStations - The list of workstations the user may log on to.  This
        information comes from the user's account information.  It must
        be in API list format.

    LogonHours - The times the user may logon.  This information comes
        from the user's account information.

    LogoffTime - Receives the time at which the user should log off the
        system.

    KickoffTime - Receives the time at which the user should be kicked
        off the system.

Return Value:

    STATUS_SUCCESS - Logon is permitted.

    STATUS_INVALID_LOGON_HOURS - The user is not authorized to log on at
        this time.

    STATUS_INVALID_WORKSTATION - The user is not authorized to log on to
        the specified workstation.

--*/
{

    static BOOLEAN GetForceLogoff = TRUE;
    static LARGE_INTEGER ForceLogoff = { 0x7fffffff, 0xFFFFFFF};

#define MILLISECONDS_PER_WEEK 7 * 24 * 60 * 60 * 1000

    SYSTEMTIME              CurrentTimeFields;
    LARGE_INTEGER           CurrentTime, CurrentUTCTime;
    LARGE_INTEGER           MillisecondsIntoWeekXUnitsPerWeek;
    LARGE_INTEGER           LargeUnitsIntoWeek;
    LARGE_INTEGER           Delta100Ns;
    NTSTATUS                NtStatus = STATUS_SUCCESS;
    ULONG                   CurrentMsIntoWeek;
    ULONG                   LogoffMsIntoWeek;
    ULONG                   DeltaMs;
    ULONG                   MillisecondsPerUnit;
    ULONG                   CurrentUnitsIntoWeek;
    ULONG                   LogoffUnitsIntoWeek;
    USHORT                  i;
    TIME_ZONE_INFORMATION   TimeZoneInformation;
    DWORD TimeZoneId;
    LARGE_INTEGER           BiasIn100NsUnits;
    LONG                    BiasInMinutes;

    //
    // Only check for users other than the builtin ADMIN
    //

    if ( UserRid != DOMAIN_USER_RID_ADMIN) {

        //
        // Scan to make sure the workstation being logged into is in the
        // list of valid workstations - or if the list of valid workstations
        // is null, which means that all are valid.
        //

        NtStatus = SampMatchworkstation( LogonWorkStation, WorkStations );

        if ( NT_SUCCESS( NtStatus ) ) {

            //
            // Check to make sure that the current time is a valid time to log
            // on in the LogonHours.
            //
            // We need to validate the time taking into account whether we are
            // in daylight savings time or standard time.  Thus, if the logon
            // hours specify that we are able to log on between 9am and 5pm,
            // this means 9am to 5pm standard time during the standard time
            // period, and 9am to 5pm daylight savings time when in the
            // daylight savings time.  Since the logon hours stored by SAM are
            // independent of daylight savings time, we need to add in the
            // difference between standard time and daylight savings time to
            // the current time before checking whether this time is a valid
            // time to log on.  Since this difference (or bias as it is called)
            // is actually held in the form
            //
            // Standard time = Daylight savings time + Bias
            //
            // the Bias is a negative number.  Thus we actually subtract the
            // signed Bias from the Current Time.

            //
            // First, get the Time Zone Information.
            //

            TimeZoneId = GetTimeZoneInformation(
                             (LPTIME_ZONE_INFORMATION) &TimeZoneInformation
                             );

            //
            // Next, get the appropriate bias (signed integer in minutes) to subtract from
            // the Universal Time Convention (UTC) time returned by NtQuerySystemTime
            // to get the local time.  The bias to be used depends whether we're
            // in Daylight Savings time or Standard Time as indicated by the
            // TimeZoneId parameter.
            //
            // local time  = UTC time - bias in 100Ns units
            //

            switch (TimeZoneId) {

            case TIME_ZONE_ID_UNKNOWN:

                //
                // There is no differentiation between standard and
                // daylight savings time.  Proceed as for Standard Time
                //

                BiasInMinutes = TimeZoneInformation.StandardBias;
                break;

            case TIME_ZONE_ID_STANDARD:

                BiasInMinutes = TimeZoneInformation.StandardBias;
                break;

            case TIME_ZONE_ID_DAYLIGHT:

                BiasInMinutes = TimeZoneInformation.DaylightBias;
                break;

            default:

                //
                // Something is wrong with the time zone information.  Fail
                // the logon request.
                //

                NtStatus = STATUS_INVALID_LOGON_HOURS;
                break;
            }

            if (NT_SUCCESS(NtStatus)) {

                //
                // Convert the Bias from minutes to 100ns units
                //

                BiasIn100NsUnits.QuadPart = ((LONGLONG)BiasInMinutes)
                                            * 60 * 10000000;

                //
                // Get the UTC time in 100Ns units used by Windows Nt.  This
                // time is GMT.
                //

                NtStatus = QuerySystemTime( &CurrentUTCTime );
            }

            if ( NT_SUCCESS( NtStatus ) ) {

                CurrentTime.QuadPart = CurrentUTCTime.QuadPart -
                              BiasIn100NsUnits.QuadPart;

                FileTimeToSystemTime( (PFILETIME)&CurrentTime, &CurrentTimeFields );

                CurrentMsIntoWeek = (((( CurrentTimeFields.wDayOfWeek * 24 ) +
                                       CurrentTimeFields.wHour ) * 60 +
                                       CurrentTimeFields.wMinute ) * 60 +
                                       CurrentTimeFields.wSecond ) * 1000 +
                                       CurrentTimeFields.wMilliseconds;

                MillisecondsIntoWeekXUnitsPerWeek.QuadPart =
                    ((LONGLONG)CurrentMsIntoWeek) *
                    ((LONGLONG)LogonHours->UnitsPerWeek);

                LargeUnitsIntoWeek.QuadPart =
                    MillisecondsIntoWeekXUnitsPerWeek.QuadPart / ((ULONG) MILLISECONDS_PER_WEEK);

                CurrentUnitsIntoWeek = LargeUnitsIntoWeek.LowPart;

                if ( !( LogonHours->LogonHours[ CurrentUnitsIntoWeek / 8] &
                    ( 0x01 << ( CurrentUnitsIntoWeek % 8 ) ) ) ) {

                    NtStatus = STATUS_INVALID_LOGON_HOURS;

                } else {

                    //
                    // Determine the next time that the user is NOT supposed to be logged
                    // in, and return that as LogoffTime.
                    //

                    i = 0;
                    LogoffUnitsIntoWeek = CurrentUnitsIntoWeek;

                    do {

                        i++;

                        LogoffUnitsIntoWeek = ( LogoffUnitsIntoWeek + 1 ) % LogonHours->UnitsPerWeek;

                    } while ( ( i <= LogonHours->UnitsPerWeek ) &&
                        ( LogonHours->LogonHours[ LogoffUnitsIntoWeek / 8 ] &
                        ( 0x01 << ( LogoffUnitsIntoWeek % 8 ) ) ) );

                    if ( i > LogonHours->UnitsPerWeek ) {

                        //
                        // All times are allowed, so there's no logoff
                        // time.  Return forever for both LogoffTime and
                        // KickoffTime.
                        //

                        LogoffTime->HighPart = 0x7FFFFFFF;
                        LogoffTime->LowPart = 0xFFFFFFFF;

                        KickoffTime->HighPart = 0x7FFFFFFF;
                        KickoffTime->LowPart = 0xFFFFFFFF;

                    } else {

                        //
                        // LogoffUnitsIntoWeek points at which time unit the
                        // user is to log off.  Calculate actual time from
                        // the unit, and return it.
                        //
                        // CurrentTimeFields already holds the current
                        // time for some time during this week; just adjust
                        // to the logoff time during this week and convert
                        // to time format.
                        //

                        MillisecondsPerUnit = MILLISECONDS_PER_WEEK / LogonHours->UnitsPerWeek;

                        LogoffMsIntoWeek = MillisecondsPerUnit * LogoffUnitsIntoWeek;

                        if ( LogoffMsIntoWeek < CurrentMsIntoWeek ) {

                            DeltaMs = MILLISECONDS_PER_WEEK - ( CurrentMsIntoWeek - LogoffMsIntoWeek );

                        } else {

                            DeltaMs = LogoffMsIntoWeek - CurrentMsIntoWeek;
                        }

                        Delta100Ns.QuadPart = (LONGLONG) DeltaMs * 10000;

                        LogoffTime->QuadPart = CurrentUTCTime.QuadPart +
                                      Delta100Ns.QuadPart;

                        //
                        // Grab the domain's ForceLogoff time.
                        //

                        if ( GetForceLogoff ) {
                            NET_API_STATUS NetStatus;
                            LPUSER_MODALS_INFO_0 UserModals0;

                            NetStatus = NetUserModalsGet( NULL,
                                                          0,
                                                          (LPBYTE *)&UserModals0 );

                            if ( NetStatus == 0 ) {
                                GetForceLogoff = FALSE;

                                ForceLogoff = NetpSecondsToDeltaTime( UserModals0->usrmod0_force_logoff );

                                NetApiBufferFree( UserModals0 );
                            }
                        }
                        //
                        // Subtract Domain->ForceLogoff from LogoffTime, and return
                        // that as KickoffTime.  Note that Domain->ForceLogoff is a
                        // negative delta.  If its magnitude is sufficiently large
                        // (in fact, larger than the difference between LogoffTime
                        // and the largest positive large integer), we'll get overflow
                        // resulting in a KickOffTime that is negative.  In this
                        // case, reset the KickOffTime to this largest positive
                        // large integer (i.e. "never") value.
                        //

                        KickoffTime->QuadPart = LogoffTime->QuadPart - ForceLogoff.QuadPart;

                        if (KickoffTime->QuadPart < 0) {

                            KickoffTime->HighPart = 0x7FFFFFFF;
                            KickoffTime->LowPart = 0xFFFFFFFF;
                        }
                    }
                }
            }
        }

    } else {

        //
        // Never kick administrators off
        //

        LogoffTime->HighPart  = 0x7FFFFFFF;
        LogoffTime->LowPart   = 0xFFFFFFFF;
        KickoffTime->HighPart = 0x7FFFFFFF;
        KickoffTime->LowPart  = 0xFFFFFFFF;
    }

    return( NtStatus );
}

VOID CopyUnicodeString | ( | OUT PUNICODE_STRING | DestinationString,
 |  | IN PUNICODE_STRING SourceString | OPTIONAL
 | ) |  |

Definition at line 1260 of file SubAuth.c.

                   :

    The CopyString function copies the SourceString to the
    DestinationString.  If SourceString is not specified, then
    the Length field of DestinationString is set to zero.  The
    MaximumLength and Buffer fields of DestinationString are not
    modified by this function.

    The number of bytes copied from the SourceString is either the
    Length of SourceString or the MaximumLength of DestinationString,
    whichever is smaller.

Arguments:

    DestinationString - Pointer to the destination string.

    SourceString - Optional pointer to the source string.

Return Value:

    None.

--*/

{
    UNALIGNED WCHAR *src, *dst;
    ULONG n;

    if (SourceString != NULL) {
        dst = DestinationString->Buffer;
        src = SourceString->Buffer;
        n = SourceString->Length;
        if ((USHORT)n > DestinationString->MaximumLength) {
            n = DestinationString->MaximumLength;
        }

        DestinationString->Length = (USHORT)n;
        CopyMemory(dst, src, n);
        if (DestinationString->Length < DestinationString->MaximumLength) {
            dst[n / sizeof(WCHAR)] = UNICODE_NULL;
        }

    } else {
        DestinationString->Length = 0;
    }

    return;
}

BOOLEAN EqualComputerName | ( | IN PUNICODE_STRING | String1,
 |  | IN PUNICODE_STRING | String2
 | ) |  |

Definition at line 1127 of file SubAuth.c.

                   :

    Compare two computer names for equality.

Arguments:

    String1 - Name of first computer.
    String2 - Name of second computer.

Return Value:

    TRUE if the names, converted to OEM, compare case-insensitively,
    FALSE if they don't compare or can't be converted to OEM.

--*/
{
    WCHAR Computer1[CNLEN+1];
    WCHAR Computer2[CNLEN+1];
    CHAR OemComputer1[CNLEN+1];
    CHAR OemComputer2[CNLEN+1];

    //
    // Make sure the names are not too long
    //

    if ((String1->Length > CNLEN*sizeof(WCHAR)) ||
        (String2->Length > CNLEN*sizeof(WCHAR))) {
        return(FALSE);

    }

    //
    // Copy them to null terminated strings
    //

    CopyMemory(
        Computer1,
        String1->Buffer,
        String1->Length
        );
    Computer1[String1->Length/sizeof(WCHAR)] = L'\0';

    CopyMemory(
        Computer2,
        String2->Buffer,
        String2->Length
        );
    Computer2[String2->Length/sizeof(WCHAR)] = L'\0';

    //
    // Convert the computer names to OEM
    //

    if (!CharToOemW(
            Computer1,
            OemComputer1
            )) {
        return(FALSE);
    }

    if (!CharToOemW(
            Computer2,
            OemComputer2
            )) {
        return(FALSE);
    }

    //
    // Do a case insensitive comparison of the oem computer names.
    //

    if (lstrcmpiA(OemComputer1, OemComputer2) == 0)
    {
        return(TRUE);
    }
    else
    {
        return(FALSE);
    }
}

BOOL GetPasswordExpired | ( | IN LARGE_INTEGER | PasswordLastSet,
 |  | IN LARGE_INTEGER | MaxPasswordAge
 | ) |  |

Definition at line 502 of file SubAuth.c.

                   :

    This routine returns true if the password is expired, false otherwise.

Arguments:

    PasswordLastSet - Time when the password was last set for this user.

    MaxPasswordAge - Maximum password age for any password in the domain.

Return Value:

    Returns true if password is expired.  False if not expired.

--*/
{
    LARGE_INTEGER PasswordMustChange;
    NTSTATUS Status;
    BOOLEAN rc;
    LARGE_INTEGER TimeNow;

    //
    // Compute the expiration time as the time the password was
    // last set plus the maximum age.
    //

    if ( PasswordLastSet.QuadPart < 0 || MaxPasswordAge.QuadPart > 0 ) {

        rc = TRUE;      // default for invalid times is that it is expired.

    } else {

        __try {

            PasswordMustChange.QuadPart =
                PasswordLastSet.QuadPart - MaxPasswordAge.QuadPart;
            //
            // Limit the resultant time to the maximum valid absolute time
            //

            if ( PasswordMustChange.QuadPart < 0 ) {

                rc = FALSE;

            } else {

                Status = QuerySystemTime( &TimeNow );
                if (NT_SUCCESS(Status)) {

                    if ( TimeNow.QuadPart >= PasswordMustChange.QuadPart ) {
                        rc = TRUE;

                    } else {

                        rc = FALSE;
                    }
                } else {
                    rc = FALSE;     // won't fail if QuerySystemTime failed.
                }
            }

        } __except(EXCEPTION_EXECUTE_HANDLER) {

            rc = TRUE;
        }
    }

    return rc;

}  // GetPasswordExpired

VOID InitUnicodeString | ( | OUT PUNICODE_STRING | DestinationString,
 |  | IN PCWSTR SourceString | OPTIONAL
 | ) |  |

Definition at line 1215 of file SubAuth.c.

                   :

    The InitUnicodeString function initializes an NT counted
    unicode string.  The DestinationString is initialized to point to
    the SourceString and the Length and MaximumLength fields of
    DestinationString are initialized to the length of the SourceString,
    which is zero if SourceString is not specified.

Arguments:

    DestinationString - Pointer to the counted string to initialize

    SourceString - Optional pointer to a null terminated unicode string that
        the counted string is to point to.

Return Value:

    None.

--*/

{
    ULONG Length;

    DestinationString->Buffer = (PWSTR)SourceString;
    if (SourceString != NULL) {
        Length = (ULONG)(wcslen( SourceString ) * sizeof( WCHAR ));
        DestinationString->Length = (USHORT)Length;
        DestinationString->MaximumLength = (USHORT)(Length + sizeof(UNICODE_NULL));
        }
    else {
        DestinationString->MaximumLength = 0;
        DestinationString->Length = 0;
        }
}

NTSTATUS NTAPI Msv1_0SubAuthenticationFilter | ( | IN NETLOGON_LOGON_INFO_CLASS | LogonLevel,
 |  | IN PVOID | LogonInformation,
 |  | IN ULONG | Flags,
 |  | IN PUSER_ALL_INFORMATION | UserAll,
 |  | OUT PULONG | WhichFields,
 |  | OUT PULONG | UserFlags,
 |  | OUT PBOOLEAN | Authoritative,
 |  | OUT PLARGE_INTEGER | LogoffTime,
 |  | OUT PLARGE_INTEGER | KickoffTime
 | ) |  |

Definition at line 1319 of file SubAuth.c.

{
    return( Msv1_0SubAuthenticationRoutine(
                LogonLevel,
                LogonInformation,
                Flags,
                UserAll,
                WhichFields,
                UserFlags,
                Authoritative,
                LogoffTime,
                KickoffTime
                ) );
}

NTSTATUS NTAPI Msv1_0SubAuthenticationRoutine | ( | IN NETLOGON_LOGON_INFO_CLASS | LogonLevel,
 |  | IN PVOID | LogonInformation,
 |  | IN ULONG | Flags,
 |  | IN PUSER_ALL_INFORMATION | UserAll,
 |  | OUT PULONG | WhichFields,
 |  | OUT PULONG | UserFlags,
 |  | OUT PBOOLEAN | Authoritative,
 |  | OUT PLARGE_INTEGER | LogoffTime,
 |  | OUT PLARGE_INTEGER | KickoffTime
 | ) |  |

Definition at line 85 of file SubAuth.c.

                   :

    The subauthentication routine does client/server specific authentication
    of a user. The credentials of the user are passed in addition to all the
    information from SAM defining the user. This routine decides whether to
    let the user log on.

Arguments:

    LogonLevel -- Specifies the level of information given in
        LogonInformation.

    LogonInformation -- Specifies the description for the user
        logging on.  The LogonDomainName field should be ignored.

    Flags - Flags describing the circumstances of the logon.

        MSV1_0_PASSTHRU -- This is a PassThru authenication.  (i.e., the
            user isn't connecting to this machine.)
        MSV1_0_GUEST_LOGON -- This is a retry of the logon using the GUEST
            user account.

    UserAll -- The description of the user as returned from SAM.

    WhichFields -- Returns which fields from UserAllInfo are to be written
        back to SAM.  The fields will only be written if MSV returns success
        to it's caller.  Only the following bits are valid.

        USER_ALL_PARAMETERS - Write UserAllInfo->Parameters back to SAM.  If
            the size of the buffer is changed, Msv1_0SubAuthenticationRoutine
            must delete the old buffer using MIDL_user_free() and reallocate the
            buffer using MIDL_user_allocate().

    UserFlags -- Returns UserFlags to be returned from LsaLogonUser in the
        LogonProfile.  The following bits are currently defined:

            LOGON_GUEST -- This was a guest logon
            LOGON_NOENCRYPTION -- The caller didn't specify encrypted credentials

        SubAuthentication packages should restrict themselves to returning
        bits in the high order byte of UserFlags.  However, this convention
        isn't enforced giving the SubAuthentication package more flexibility.

    Authoritative -- Returns whether the status returned is an
        authoritative status which should be returned to the original
        caller.  If not, this logon request may be tried again on another
        domain controller.  This parameter is returned regardless of the
        status code.

    LogoffTime - Receives the time at which the user should log off the
        system.  This time is specified as a GMT relative NT system time.

    KickoffTime - Receives the time at which the user should be kicked
        off the system. This time is specified as a GMT relative system
        time.  Specify, a full scale positive number if the user isn't to
        be kicked off.

Return Value:

    STATUS_SUCCESS: if there was no error.

    STATUS_NO_SUCH_USER: The specified user has no account.
    STATUS_WRONG_PASSWORD: The password was invalid.

    STATUS_INVALID_INFO_CLASS: LogonLevel is invalid.
    STATUS_ACCOUNT_LOCKED_OUT: The account is locked out
    STATUS_ACCOUNT_DISABLED: The account is disabled
    STATUS_ACCOUNT_EXPIRED: The account has expired.
    STATUS_PASSWORD_MUST_CHANGE: Account is marked as Password must change
        on next logon.
    STATUS_PASSWORD_EXPIRED: The Password is expired.
    STATUS_INVALID_LOGON_HOURS - The user is not authorized to log on at
        this time.
    STATUS_INVALID_WORKSTATION - The user is not authorized to log on to
        the specified workstation.

--*/
{
    NTSTATUS Status;
    ULONG UserAccountControl;
    LARGE_INTEGER LogonTime;
    UNICODE_STRING LocalWorkstation;

    PNETLOGON_NETWORK_INFO LogonNetworkInfo;

    //
    // Check whether the SubAuthentication package supports this type
    //  of logon.
    //

    *Authoritative = TRUE;
    *UserFlags = 0;
    *WhichFields = 0;

    (VOID) QuerySystemTime( &LogonTime );

    switch ( LogonLevel ) {
    case NetlogonInteractiveInformation:
    case NetlogonServiceInformation:

        //
        // This SubAuthentication package only supports network logons.
        //

        return STATUS_INVALID_INFO_CLASS;

    case NetlogonNetworkInformation:

        //
        // This SubAuthentication package doesn't support access via machine
        // accounts.
        //

        UserAccountControl = USER_NORMAL_ACCOUNT;

        //
        // Local user (Temp Duplicate) accounts are only used on the machine
        // being directly logged onto.
        // (Nor are interactive or service logons allowed to them.)
        //

        if ( (Flags & MSV1_0_PASSTHRU) == 0 ) {
            UserAccountControl |= USER_TEMP_DUPLICATE_ACCOUNT;
        }

        LogonNetworkInfo = (PNETLOGON_NETWORK_INFO) LogonInformation;

        break;

    default:
        *Authoritative = TRUE;
        return STATUS_INVALID_INFO_CLASS;
    }

    //
    // If the account type isn't allowed,
    //  Treat this as though the User Account doesn't exist.
    //

    if ( (UserAccountControl & UserAll->UserAccountControl) == 0 ) {
        *Authoritative = FALSE;
        Status = STATUS_NO_SUCH_USER;
        goto Cleanup;
    }

    //
    // This SubAuthentication package doesn't allow guest logons.
    //
    if ( Flags & MSV1_0_GUEST_LOGON ) {
        *Authoritative = FALSE;
        Status = STATUS_NO_SUCH_USER;
        goto Cleanup;
    }

    //
    // Ensure the account isn't locked out.
    //

    if ( UserAll->UserId != DOMAIN_USER_RID_ADMIN &&
         (UserAll->UserAccountControl & USER_ACCOUNT_AUTO_LOCKED) ) {

        //
        // Since the UI strongly encourages admins to disable user
        // accounts rather than delete them.  Treat disabled acccount as
        // non-authoritative allowing the search to continue for other
        // accounts by the same name.
        //
        if ( UserAll->UserAccountControl & USER_ACCOUNT_DISABLED ) {
            *Authoritative = FALSE;
        } else {
            *Authoritative = TRUE;
        }
        Status = STATUS_ACCOUNT_LOCKED_OUT;
        goto Cleanup;
    }

    //
    // Check the password.
    //

    if ( FALSE /* VALIDATE THE USER'S PASSWORD HERE */ ) {

        Status = STATUS_WRONG_PASSWORD;

        //
        // Since the UI strongly encourages admins to disable user
        // accounts rather than delete them.  Treat disabled acccount as
        // non-authoritative allowing the search to continue for other
        // accounts by the same name.
        //
        if ( UserAll->UserAccountControl & USER_ACCOUNT_DISABLED ) {
            *Authoritative = FALSE;
        } else {
            *Authoritative = TRUE;
        }

        goto Cleanup;
    }

    //
    // Prevent some things from effecting the Administrator user
    //

    if (UserAll->UserId == DOMAIN_USER_RID_ADMIN) {

        //
        //  The administrator account doesn't have a forced logoff time.
        //

        LogoffTime->HighPart = 0x7FFFFFFF;
        LogoffTime->LowPart = 0xFFFFFFFF;

        KickoffTime->HighPart = 0x7FFFFFFF;
        KickoffTime->LowPart = 0xFFFFFFFF;

    } else {

        //
        // Check if the account is disabled.
        //

        if ( UserAll->UserAccountControl & USER_ACCOUNT_DISABLED ) {
            //
            // Since the UI strongly encourages admins to disable user
            // accounts rather than delete them.  Treat disabled acccount as
            // non-authoritative allowing the search to continue for other
            // accounts by the same name.
            //
            *Authoritative = FALSE;
            Status = STATUS_ACCOUNT_DISABLED;
            goto Cleanup;
        }

        //
        // Check if the account has expired.
        //

        if ( UserAll->AccountExpires.QuadPart != 0 &&
             LogonTime.QuadPart >= UserAll->AccountExpires.QuadPart ) {
            *Authoritative = TRUE;
            Status = STATUS_ACCOUNT_EXPIRED;
            goto Cleanup;
        }

#if 1

    //
    //  If your using SAM's password expiration date, use this code, otherwise
    //  use the code below and supply your own password set date...
    //

        //
        // The password is valid, check to see if the password is expired.
        //  (SAM will have appropriately set PasswordMustChange to reflect
        //  USER_DONT_EXPIRE_PASSWORD)
        //
        // If the password checked above is not the SAM password, you may
        // want to consider not checking the SAM password expiration times here.
        //

        if ( LogonTime.QuadPart >= UserAll->PasswordMustChange.QuadPart ) {

            if ( UserAll->PasswordLastSet.QuadPart == 0 ) {
                Status = STATUS_PASSWORD_MUST_CHANGE;
            } else {
                Status = STATUS_PASSWORD_EXPIRED;
            }
            *Authoritative = TRUE;
            goto Cleanup;
        }

#else

        //
        // Response is correct. So, check if the password has expired or not
        //

        if (! (UserAll->UserAccountControl & USER_DONT_EXPIRE_PASSWORD)) {
            LARGE_INTEGER MaxPasswordAge;
            MaxPasswordAge.HighPart = 0x7FFFFFFF;
            MaxPasswordAge.LowPart = 0xFFFFFFFF;

            //
            // PasswordDateSet should be modified to hold the last date the
            // user's password was set.
            //

            PasswordDateSet.LowPart = 0;
            PasswordDateSet.HighPart = 0;

            if ( GetPasswordExpired( PasswordDateSet,
                        MaxPasswordAge )) {

                Status = STATUS_PASSWORD_EXPIRED;
                goto Cleanup;
            }
        }

#endif

#if 1

    //
    // Validate the workstation the user logged on from.
    //
    // Ditch leading \\ on workstation name before passing it to SAM.
    //

    LocalWorkstation = LogonNetworkInfo->Identity.Workstation;
    if ( LocalWorkstation.Length > 0 &&
         LocalWorkstation.Buffer[0] == L'\\' &&
         LocalWorkstation.Buffer[1] == L'\\' ) {
        LocalWorkstation.Buffer += 2;
        LocalWorkstation.Length -= 2*sizeof(WCHAR);
        LocalWorkstation.MaximumLength -= 2*sizeof(WCHAR);
    }

    //
    //  To validate the user's logon hours as SAM does it, use this code,
    //  otherwise, supply your own checks below this code.
    //

    Status = AccountRestrictions( UserAll->UserId,
                                  &LocalWorkstation,
                                  (PUNICODE_STRING) &UserAll->WorkStations,
                                  &UserAll->LogonHours,
                                  LogoffTime,
                                  KickoffTime );

    if ( !NT_SUCCESS( Status )) {
        goto Cleanup;
    }

#else

        //
        // Validate the user's logon hours.
        //

        if ( TRUE /* VALIDATE THE LOGON HOURS */ ) {

            //
            // All times are allowed, so there's no logoff
            // time.  Return forever for both logofftime and
            // kickofftime.
            //

            LogoffTime->HighPart = 0x7FFFFFFF;
            LogoffTime->LowPart = 0xFFFFFFFF;

            KickoffTime->HighPart = 0x7FFFFFFF;
            KickoffTime->LowPart = 0xFFFFFFFF;
        } else {
            Status = STATUS_INVALID_LOGON_HOURS;
            *Authoritative = TRUE;
            goto Cleanup;
        }
#endif

        //
        // Validate if the user can log on from this workstation.
        //  (Supply subauthentication package specific code here.)

        if ( LogonNetworkInfo->Identity.Workstation.Buffer == NULL ) {
            Status = STATUS_INVALID_WORKSTATION;
            *Authoritative = TRUE;
            goto Cleanup;
        }
    }

    //
    // The user is valid.
    //

    *Authoritative = TRUE;
    Status = STATUS_SUCCESS;

    //
    // Cleanup up before returning.
    //

Cleanup:

    return Status;

}  // Msv1_0SubAuthenticationRoutine

LARGE_INTEGER NetpSecondsToDeltaTime ( IN ULONG Seconds )

Definition at line 1065 of file SubAuth.c.

                   :

    Convert a number of seconds to an NT delta time specification

Arguments:

    Seconds - a positive number of seconds

Return Value:

    Returns the NT Delta time.  NT delta time is a negative number
        of 100ns units.

--*/

{
    LARGE_INTEGER DeltaTime;
    LARGE_INTEGER LargeSeconds;
    LARGE_INTEGER Answer;

    //
    // Special case TIMEQ_FOREVER (return a full scale negative)
    //

    if ( Seconds == TIMEQ_FOREVER ) {
        DeltaTime.LowPart = 0;
        DeltaTime.HighPart = (LONG) 0x80000000;

    //
    // Convert seconds to 100ns units simply by multiplying by 10000000.
    //
    // Convert to delta time by negating.
    //

    } else {

        LargeSeconds.LowPart = Seconds;
        LargeSeconds.HighPart = 0;

        Answer.QuadPart = LargeSeconds.QuadPart * 10000000;

          if ( Answer.QuadPart < 0 ) {
            DeltaTime.LowPart = 0;
            DeltaTime.HighPart = (LONG) 0x80000000;
        } else {
            DeltaTime.QuadPart = -Answer.QuadPart;
        }

    }

    return DeltaTime;

} // NetpSecondsToDeltaTime

NTSTATUS QuerySystemTime ( OUT PLARGE_INTEGER SystemTime )

Definition at line 582 of file SubAuth.c.

                   :

    This function returns the absolute system time. The time is in units of
    100nsec ticks since the base time which is midnight January 1, 1601.

Arguments:

    SystemTime - Supplies the address of a variable that will receive the
        current system time.

Return Value:

    STATUS_SUCCESS is returned if the service is successfully executed.

    STATUS_ACCESS_VIOLATION is returned if the output parameter for the
        system time cannot be written.

--*/

{
    SYSTEMTIME CurrentTime;

    GetSystemTime( &CurrentTime );

    if ( !SystemTimeToFileTime( &CurrentTime, (LPFILETIME) SystemTime ) ) {
        return STATUS_ACCESS_VIOLATION;
    }

    return STATUS_SUCCESS;
}

NTSTATUS SampMatchworkstation | ( | IN PUNICODE_STRING | LogonWorkStation,
 |  | IN PUNICODE_STRING | WorkStations
 | ) |  |

Definition at line 620 of file SubAuth.c.

                   :

    Check if the given workstation is a member of the list of workstations
    given.

Arguments:

    LogonWorkStations - UNICODE name of the workstation that the user is
        trying to log into.

    WorkStations - API list of workstations that the user is allowed to
        log into.

Return Value:

    STATUS_SUCCESS - The user is allowed to log into the workstation.

--*/
{
    PWCHAR          WorkStationName;
    UNICODE_STRING  Unicode;
    NTSTATUS        NtStatus;
    WCHAR           Buffer[256];
    USHORT          LocalBufferLength = 256;
    UNICODE_STRING  WorkStationsListCopy;
    BOOLEAN         BufferAllocated = FALSE;
    PWCHAR          TmpBuffer;

    //
    // Local workstation is always allowed
    // If WorkStations field is 0 everybody is allowed
    //

    if ( ( LogonWorkStation == NULL ) ||
        ( LogonWorkStation->Length == 0 ) ||
        ( WorkStations->Length == 0 ) ) {

        return( STATUS_SUCCESS );
    }

    //
    // Assume failure; change status only if we find the string.
    //

    NtStatus = STATUS_INVALID_WORKSTATION;

    //
    // WorkStationApiList points to our current location in the list of
    // WorkStations.
    //

    if ( WorkStations->Length > LocalBufferLength ) {

        WorkStationsListCopy.Buffer = LocalAlloc( 0, WorkStations->Length );
        BufferAllocated = TRUE;

        if ( WorkStationsListCopy.Buffer == NULL ) {
            NtStatus = STATUS_INSUFFICIENT_RESOURCES;
            return( NtStatus );
        }

        WorkStationsListCopy.MaximumLength = WorkStations->Length;

    } else {

        WorkStationsListCopy.Buffer = Buffer;
        WorkStationsListCopy.MaximumLength = LocalBufferLength;
    }

    CopyUnicodeString( &WorkStationsListCopy, WorkStations );

    //
    // wcstok requires a string the first time it's called, and NULL
    // for all subsequent calls.  Use a temporary variable so we
    // can do this.
    //

    TmpBuffer = WorkStationsListCopy.Buffer;

    while( WorkStationName = wcstok(TmpBuffer, L",") ) {

        TmpBuffer = NULL;
        InitUnicodeString( &Unicode, WorkStationName );
        if (EqualComputerName( &Unicode, LogonWorkStation )) {
            NtStatus = STATUS_SUCCESS;
            break;
        }
    }

    if ( BufferAllocated ) {
        LocalFree( WorkStationsListCopy.Buffer );
    }

    return( NtStatus );
}

Generated on Wed Nov 13 2024 16:54:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/Authentication/SampSSP/Init.c File Reference

  • Security
  • Authentication
  • SampSSP
Functions | Variables

Init.c File Reference

#include "sampssp.h"

Go to the source code of this file.

Functions

BOOLEAN | DllInit (IN PVOID DllHandle, IN ULONG Reason, IN PCONTEXT Context OPTIONAL)

Variables

CRITICAL_SECTION | DllCritSect

Function Documentation

BOOLEAN DllInit | ( | IN PVOID | DllHandle,
 |  | IN ULONG | Reason,
 |  | IN PCONTEXT Context | OPTIONAL
 | ) |  |

Definition at line 30 of file Init.c.

                   :

    This is the Dll initialization routine for ntlmssp.dll

Arguments:

    Standard.

Return Status:

    TRUE: if initialization succeeded

--*/

{

    //
    // On process attach,
    //      initialize the critical section,
    //      defer any additional initialization.
    //

    switch (Reason) {
    case DLL_PROCESS_ATTACH:
#if defined (DEBUG)
            DebugBreak();
#endif
        InitializeCriticalSection( &DllCritSect );
        break;

    //
    // Handle process detach.
    //

    case DLL_PROCESS_DETACH:

        //
        // Shutdown the common routines.
        //

        EnterCriticalSection( &DllCritSect );
        LeaveCriticalSection( &DllCritSect );

        //
        // Finally, Delete the critical section
        //

        DeleteCriticalSection( &DllCritSect );

        break;

    }

    return TRUE;
    UNREFERENCED_PARAMETER( Context );
    UNREFERENCED_PARAMETER( DllHandle );

}

Variable Documentation

CRITICAL_SECTION DllCritSect

Definition at line 26 of file Init.c.

Generated on Wed Nov 13 2024 16:53:38 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/Authentication/SampSSP/SampSSP.H File Reference

  • Security
  • Authentication
  • SampSSP
Classes | Defines | Typedefs | Enumerations | Variables

SampSSP.H File Reference

#include <windows.h>
#include <sspi.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>

Go to the source code of this file.

Classes

struct | _CREDENTIAL
struct | _MESSAGE
struct | _SEC_CONTEXT
struct | _SIGNATURE

Defines

#define | MESSAGE_SIZE 10
#define | PACKAGE_CAPABILITIES
#define | PACKAGE_COMMENT L"Sample package for testing Security Providers"
#define | PACKAGE_MAXTOKEN sizeof(MESSAGE)
#define | PACKAGE_NAME L"SAMPSSP"
#define | PACKAGE_RPCID 123
#define | PACKAGE_SIGNATURE_SIZE sizeof(SIGNATURE)
#define | PACKAGE_SIGNATURE_TAG 0xbaadf00d
#define | PACKAGE_VERSION 1
#define | SECURITY_WIN32

Typedefs

typedef struct _CREDENTIAL | CREDENTIAL
typedef struct _MESSAGE | MESSAGE
typedef struct _CREDENTIAL * | PCREDENTIAL
typedef struct _MESSAGE * | PMESSAGE
typedef struct _SEC_CONTEXT * | PSEC_CONTEXT
typedef struct _SIGNATURE * | PSIGNATURE
typedef struct _SEC_CONTEXT | SEC_CONTEXT
typedef struct _SIGNATURE | SIGNATURE

Enumerations

enum | MESSAGE_TYPE { Negotiate, Challenge, ChallengeResponse, ReAuthenticate }

Variables

CRITICAL_SECTION | DllCritSect

Define Documentation

#define MESSAGE_SIZE 10

Definition at line 53 of file SampSSP.H.

#define PACKAGE_CAPABILITIES
Value:
(SECPKG_FLAG_TOKEN_ONLY | \
                                 SECPKG_FLAG_MULTI_REQUIRED | \
                                 SECPKG_FLAG_CONNECTION | \
                                 SECPKG_FLAG_INTEGRITY | \
                                 SECPKG_FLAG_PRIVACY)

Definition at line 69 of file SampSSP.H.

#define PACKAGE_COMMENT L"Sample package for testing Security Providers"

Definition at line 68 of file SampSSP.H.

#define PACKAGE_MAXTOKEN sizeof(MESSAGE)

Definition at line 81 of file SampSSP.H.

#define PACKAGE_NAME L"SAMPSSP"

Definition at line 67 of file SampSSP.H.

#define PACKAGE_RPCID 123

Definition at line 80 of file SampSSP.H.

#define PACKAGE_SIGNATURE_SIZE sizeof(SIGNATURE)

Definition at line 82 of file SampSSP.H.

#define PACKAGE_SIGNATURE_TAG 0xbaadf00d

Definition at line 83 of file SampSSP.H.

#define PACKAGE_VERSION 1

Definition at line 74 of file SampSSP.H.

#define SECURITY_WIN32

Definition at line 15 of file SampSSP.H.

Typedef Documentation

typedef struct _CREDENTIAL CREDENTIAL
typedef struct _MESSAGE MESSAGE
typedef struct _CREDENTIAL * PCREDENTIAL
typedef struct _MESSAGE * PMESSAGE
typedef struct _SEC_CONTEXT * PSEC_CONTEXT
typedef struct _SIGNATURE * PSIGNATURE
typedef struct _SEC_CONTEXT SEC_CONTEXT
typedef struct _SIGNATURE SIGNATURE

Enumeration Type Documentation

enum MESSAGE_TYPE
Enumerator:
Negotiate
Challenge
ChallengeResponse
ReAuthenticate

Definition at line 46 of file SampSSP.H.

             {
    Negotiate,
    Challenge,
    ChallengeResponse,
    ReAuthenticate
} MESSAGE_TYPE;

Variable Documentation

CRITICAL_SECTION DllCritSect

Definition at line 26 of file Init.c.

Generated on Wed Nov 13 2024 16:54:25 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/Authentication/SampSSP/Stubs.c File Reference

  • Security
  • Authentication
  • SampSSP
Functions | Variables

Stubs.c File Reference

#include "sampssp.h"

Go to the source code of this file.

Functions

SECURITY_STATUS SEC_ENTRY | AcceptSecurityContext (PCredHandle phCredential, PCtxtHandle phContext, PSecBufferDesc pInput, unsigned long fContextReq, unsigned long TargetDataRep, PCtxtHandle phNewContext, PSecBufferDesc pOutput, unsigned long SEC_FAR *pfContextAttr, PTimeStamp ptsExpiry)
SECURITY_STATUS SEC_ENTRY | AcquireCredentialsHandleW (LPWSTR pszPrincipal, LPWSTR pszPackageName, unsigned long fCredentialUse, void SEC_FAR *pvLogonId, void SEC_FAR *pAuthData, SEC_GET_KEY_FN pGetKeyFn, void SEC_FAR *pvGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry)
VOID | AddContext (PSEC_CONTEXT Context)
VOID | AddCredential (PCREDENTIAL Credential)
SECURITY_STATUS SEC_ENTRY | ApplyControlToken (PCtxtHandle phContext, PSecBufferDesc pInput)
SECURITY_STATUS SEC_ENTRY | CompleteAuthToken (PCtxtHandle phContext, PSecBufferDesc pToken)
BOOLEAN | DeleteContext (ULONG ContextId)
BOOLEAN | DeleteCredential (ULONG CredentialId)
SECURITY_STATUS SEC_ENTRY | DeleteSecurityContext (PCtxtHandle phContext)
SECURITY_STATUS SEC_ENTRY | EnumerateSecurityPackagesW (unsigned long SEC_FAR *pcPackages, PSecPkgInfoW SEC_FAR *ppPackageInfo)
SECURITY_STATUS SEC_ENTRY | FreeContextBuffer (void SEC_FAR *pvContextBuffer)
SECURITY_STATUS SEC_ENTRY | FreeCredentialsHandle (PCredHandle phCredential)
ULONG GetNewId ()
SECURITY_STATUS SEC_ENTRY | ImpersonateSecurityContext (PCtxtHandle phContext)
SECURITY_STATUS SEC_ENTRY | InitializeSecurityContextW (PCredHandle phCredential, PCtxtHandle phContext, LPWSTR pszTargetName, unsigned long fContextReq, unsigned long Reserved1, unsigned long TargetDataRep, PSecBufferDesc pInput, unsigned long Reserved2, PCtxtHandle phNewContext, PSecBufferDesc pOutput, unsigned long SEC_FAR *pfContextAttr, PTimeStamp ptsExpiry)
PSecurityFunctionTableW SEC_ENTRY | InitSecurityInterfaceW (VOID)
PSecBuffer | LocateBuffer (PSecBufferDesc Buffer, ULONG MinimumSize)
PSEC_CONTEXT | LocateContext (ULONG ContextId)
PCREDENTIAL | LocateCredential (ULONG CredentialId)
PSecBuffer | LocateSecBuffer (PSecBufferDesc Buffer)
PSecBuffer | LocateSigBuffer (PSecBufferDesc Buffer)
SECURITY_STATUS SEC_ENTRY | MakeSignature (PCtxtHandle phContext, ULONG fQOP, PSecBufferDesc pMessage, ULONG MessageSeqNo)
SECURITY_STATUS SEC_ENTRY | QueryContextAttributesW (PCtxtHandle phContext, unsigned long ulAttribute, void SEC_FAR *pBuffer)
SECURITY_STATUS SEC_ENTRY | QuerySecurityPackageInfoW (LPWSTR pszPackageName, PSecPkgInfoW SEC_FAR *ppPackageInfo)
SECURITY_STATUS SEC_ENTRY | RevertSecurityContext (PCtxtHandle phContext)
SECURITY_STATUS SEC_ENTRY | VerifySignature (PCtxtHandle phContext, PSecBufferDesc pMessage, ULONG MessageSeqNo, ULONG *pfQOP)

Variables

PSEC_CONTEXT ContextList
PCREDENTIAL CredentialList
TimeStamp | Forever = {0x7fffffff,0xfffffff}
TimeStamp | Never = {0,0}
ULONG NextId
SecurityFunctionTableW | SecTableW

Function Documentation

SECURITY_STATUS SEC_ENTRY AcceptSecurityContext | ( | PCredHandle | phCredential,
 |  | PCtxtHandle | phContext,
 |  | PSecBufferDesc | pInput,
 |  | unsigned long | fContextReq,
 |  | unsigned long | TargetDataRep,
 |  | PCtxtHandle | phNewContext,
 |  | PSecBufferDesc | pOutput,
 |  | unsigned long SEC_FAR * | pfContextAttr,
 |  | PTimeStamp | ptsExpiry
 | ) |  |

Definition at line 683 of file Stubs.c.

{
    PCREDENTIAL Credential = NULL;
    PSEC_CONTEXT Context = NULL;
    PMESSAGE Message = NULL;
    PSecBuffer OutputBuffer;
    PSecBuffer InputBuffer;
    MESSAGE SampleMessage;

    if (fContextReq & ISC_REQ_ALLOCATE_MEMORY)
    {
        return(SEC_E_INSUFFICIENT_MEMORY);
    }

    InputBuffer = LocateSecBuffer(pInput);
    if (InputBuffer == NULL)
    {
        return(SEC_E_INVALID_TOKEN);
    }

    if (phContext == NULL)
    {

        Credential = LocateCredential(phCredential->dwUpper);
        if (Credential == NULL)
        {
            return(SEC_E_UNKNOWN_CREDENTIALS);
        }

        if ((Credential->Use & SECPKG_CRED_INBOUND) == 0)
        {
            return(SEC_E_UNKNOWN_CREDENTIALS);
        }

    }

    //
    // If the context is NULL, create a new one.
    //

    if (phContext == NULL)
    {
        //
        // Make sure the output buffer exists.
        //

        OutputBuffer = LocateSecBuffer(pOutput);
        if (OutputBuffer == NULL)
        {
            return(SEC_E_INVALID_TOKEN);
        }

        //
        // Check that the input message is what we expected.
        //

        Message = (PMESSAGE) InputBuffer->pvBuffer;
        SampleMessage.MessageType = Negotiate;
        memset(SampleMessage.Buffer, 'x', MESSAGE_SIZE);

        if (memcmp(&SampleMessage,Message,MESSAGE_SIZE) != 0)
        {
            return(SEC_E_INVALID_TOKEN);
        }

        //
        // Build a new context.
        //

        Context = (PSEC_CONTEXT) LocalAlloc(0,sizeof(SEC_CONTEXT));
        if (Context == NULL)
        {
            return(SEC_E_INSUFFICIENT_MEMORY);
        }
        Context->ContextId = GetNewId();
        phNewContext->dwUpper = Context->ContextId;
        Context->CredentialId = phCredential->dwUpper;
        Context->State = FirstAccept;
        Context->Nonce = 0;
        Context->ContextFlags = fContextReq;
        *pfContextAttr = fContextReq;
        *ptsExpiry = Forever;

        //
        // Build an output token.
        //

        Message = (PMESSAGE) OutputBuffer->pvBuffer;
        Message->MessageType = Challenge;
        memset(Message->Buffer,'y',MESSAGE_SIZE);
        OutputBuffer->cbBuffer = sizeof(MESSAGE);

        AddContext(Context);

        return(SEC_I_CONTINUE_NEEDED);

    } else {
        //
        // This is the second call. Lookup the old context.
        //

        Context = LocateContext(phContext->dwUpper);
        if (Context == NULL)
        {
            return(SEC_E_INVALID_HANDLE);
        }
        if ((Context->State != FirstAccept) &&
            (Context->State != SecondAccept))
        {
            return(SEC_E_INVALID_HANDLE);
        }

        Message = (PMESSAGE) InputBuffer->pvBuffer;

        //
        // Check that the input message is what we expected.
        //

        if (Context->State == FirstAccept)
        {
            SampleMessage.MessageType = ChallengeResponse;
            memset(SampleMessage.Buffer, 'z', MESSAGE_SIZE);
        }
        else
        {
            SampleMessage.MessageType = ReAuthenticate;
            memset(SampleMessage.Buffer, 'q', MESSAGE_SIZE);
        }

        if (memcmp(&SampleMessage,Message,MESSAGE_SIZE) != 0)
        {
            return(SEC_E_INVALID_TOKEN);
        }

        Context->State = SecondAccept;
        return(SEC_E_OK);
    }
}

SECURITY_STATUS SEC_ENTRY AcquireCredentialsHandleW | ( | LPWSTR | pszPrincipal,
 |  | LPWSTR | pszPackageName,
 |  | unsigned long | fCredentialUse,
 |  | void SEC_FAR * | pvLogonId,
 |  | void SEC_FAR * | pAuthData,
 |  | SEC_GET_KEY_FN | pGetKeyFn,
 |  | void SEC_FAR * | pvGetKeyArgument,
 |  | PCredHandle | phCredential,
 |  | PTimeStamp | ptsExpiry
 | ) |  |

Definition at line 361 of file Stubs.c.

{
    PCREDENTIAL NewCredential = NULL;

    if ((fCredentialUse & (SECPKG_CRED_BOTH)) == 0)
    {
        return(SEC_E_UNKNOWN_CREDENTIALS);
    }
    NewCredential = (PCREDENTIAL) LocalAlloc(0,sizeof(CREDENTIAL));
    if (NewCredential == NULL)
    {
        return(SEC_E_INSUFFICIENT_MEMORY);
    }
    NewCredential->CredentialId = GetNewId();
    NewCredential->Use = fCredentialUse;
    NewCredential->AuthData = (ULONG *)pAuthData;
    phCredential->dwUpper = NewCredential->CredentialId;
    *ptsExpiry = Forever;
    AddCredential(NewCredential);
    return(SEC_E_OK);

}

VOID AddContext ( PSEC_CONTEXT Context )

Definition at line 161 of file Stubs.c.

{
    EnterCriticalSection(&DllCritSect);
    Context->Next = ContextList;
    ContextList = Context;
    LeaveCriticalSection(&DllCritSect);
}

VOID AddCredential ( PCREDENTIAL Credential )

Definition at line 247 of file Stubs.c.

{
    EnterCriticalSection(&DllCritSect);
    Credential->Next = CredentialList;
    CredentialList = Credential;
    LeaveCriticalSection(&DllCritSect);
}

SECURITY_STATUS SEC_ENTRY ApplyControlToken | ( | PCtxtHandle | phContext,
 |  | PSecBufferDesc | pInput
 | ) |  |

Definition at line 898 of file Stubs.c.

{
    return(SEC_E_UNSUPPORTED_FUNCTION);

}

SECURITY_STATUS SEC_ENTRY CompleteAuthToken | ( | PCtxtHandle | phContext,
 |  | PSecBufferDesc | pToken
 | ) |  |

Definition at line 1076 of file Stubs.c.

{

    return(SEC_E_OK);

}

BOOLEAN DeleteContext ( ULONG ContextId )

Definition at line 106 of file Stubs.c.

{
    PSEC_CONTEXT TestContext, LastContext;

    EnterCriticalSection(&DllCritSect);
    TestContext = ContextList;
    LastContext = NULL;

    while (TestContext != NULL)
    {
        if (TestContext->ContextId == ContextId)
        {
            break;
        }
        LastContext = TestContext;
        TestContext = TestContext->Next;
    }
    if (TestContext != NULL)
    {
        if (LastContext != NULL)
        {
            LastContext->Next = TestContext->Next;
        }
        else
        {
            assert(ContextList == TestContext);
            ContextList = TestContext->Next;
        }
        LocalFree(TestContext);
    }
    LeaveCriticalSection(&DllCritSect);
    return( TestContext == NULL ? FALSE : TRUE );
}

BOOLEAN DeleteCredential ( ULONG CredentialId )

Definition at line 212 of file Stubs.c.

{
    PCREDENTIAL TestCredential, LastCredential;

    EnterCriticalSection(&DllCritSect);
    TestCredential = CredentialList;
    LastCredential = NULL;

    while (TestCredential != NULL)
    {
        if (TestCredential->CredentialId == CredentialId)
        {
            break;
        }
        LastCredential = TestCredential;
        TestCredential = TestCredential->Next;
    }
    if (TestCredential != NULL)
    {
        if (LastCredential != NULL)
        {
            LastCredential->Next = TestCredential->Next;
        }
        else
        {
            assert(CredentialList == TestCredential);
            CredentialList = TestCredential->Next;
        }
        LocalFree(TestCredential);
    }
    LeaveCriticalSection(&DllCritSect);
    return( TestCredential == NULL ? FALSE : TRUE );
}

SECURITY_STATUS SEC_ENTRY DeleteSecurityContext ( PCtxtHandle phContext )

Definition at line 861 of file Stubs.c.

{
    if (DeleteContext(phContext->dwUpper))
    {
        return(SEC_E_OK);
    }
    else
    {
        return(SEC_E_INVALID_HANDLE);
    }
}

SECURITY_STATUS SEC_ENTRY EnumerateSecurityPackagesW | ( | unsigned long SEC_FAR * | pcPackages,
 |  | PSecPkgInfoW SEC_FAR * | ppPackageInfo
 | ) |  |

Definition at line 932 of file Stubs.c.

{
    SECURITY_STATUS SecStatus;

    SecStatus = QuerySecurityPackageInfoW(
                    PACKAGE_NAME,
                    ppPackageInfo
                    );
    if (SecStatus == SEC_E_OK)
    {
        *pcPackages = 1;

    }

    return(SecStatus);

}

SECURITY_STATUS SEC_ENTRY FreeContextBuffer ( void SEC_FAR * pvContextBuffer )

Definition at line 1044 of file Stubs.c.

{
    LocalFree(pvContextBuffer);
    return(SEC_E_OK);
}

SECURITY_STATUS SEC_ENTRY FreeCredentialsHandle ( PCredHandle phCredential )

Definition at line 417 of file Stubs.c.

{
    if (DeleteCredential(phCredential->dwUpper))
    {
        return(SEC_E_OK);
    }
    else
    {
        return(SEC_E_UNKNOWN_CREDENTIALS);
    }
}

ULONG GetNewId ( )

Definition at line 256 of file Stubs.c.

{
    ULONG NewId;

    EnterCriticalSection(&DllCritSect);
    NewId = NextId;
    NextId ++;
    LeaveCriticalSection(&DllCritSect);
    return(NewId);

}

SECURITY_STATUS SEC_ENTRY ImpersonateSecurityContext ( PCtxtHandle phContext )

Definition at line 1109 of file Stubs.c.

{
    return(SEC_E_OK);
}

SECURITY_STATUS SEC_ENTRY InitializeSecurityContextW | ( | PCredHandle | phCredential,
 |  | PCtxtHandle | phContext,
 |  | LPWSTR | pszTargetName,
 |  | unsigned long | fContextReq,
 |  | unsigned long | Reserved1,
 |  | unsigned long | TargetDataRep,
 |  | PSecBufferDesc | pInput,
 |  | unsigned long | Reserved2,
 |  | PCtxtHandle | phNewContext,
 |  | PSecBufferDesc | pOutput,
 |  | unsigned long SEC_FAR * | pfContextAttr,
 |  | PTimeStamp | ptsExpiry
 | ) |  |

Definition at line 453 of file Stubs.c.

{
    PCREDENTIAL Credential = NULL;
    PSEC_CONTEXT Context = NULL;
    PMESSAGE Message = NULL;
    PSecBuffer OutputBuffer;
    PSecBuffer InputBuffer;
    MESSAGE SampleMessage;

    if (fContextReq & ISC_REQ_ALLOCATE_MEMORY)
    {
        return(SEC_E_INSUFFICIENT_MEMORY);
    }

    OutputBuffer = LocateSecBuffer(pOutput);
    if (OutputBuffer == NULL)
    {
        return(SEC_E_INVALID_TOKEN);
    }

    if (phContext == NULL)
    {

        Credential = LocateCredential(phCredential->dwUpper);
        if (Credential == NULL)
        {
            return(SEC_E_UNKNOWN_CREDENTIALS);
        }

        if ((Credential->Use & SECPKG_CRED_OUTBOUND) == 0)
        {
            return(SEC_E_UNKNOWN_CREDENTIALS);
        }

    }

    //
    // If the context is NULL, create a new one.
    //

    if (phContext == NULL)
    {
        Context = (PSEC_CONTEXT) LocalAlloc(0,sizeof(SEC_CONTEXT));
        if (Context == NULL)
        {
            return(SEC_E_INSUFFICIENT_MEMORY);
        }
        Context->ContextId = GetNewId();
        phNewContext->dwUpper = Context->ContextId;
        Context->CredentialId = phCredential->dwUpper;
        Context->State = FirstInit;
        Context->Nonce = 0;
        Context->ContextFlags = fContextReq;
        *pfContextAttr = fContextReq;
        *ptsExpiry = Forever;

        //
        // Build an output token.
        //

        Message = (PMESSAGE) OutputBuffer->pvBuffer;
        Message->MessageType = Negotiate;
        memset(Message->Buffer,'x',MESSAGE_SIZE);
        OutputBuffer->cbBuffer = sizeof(MESSAGE);

        AddContext(Context);

        return(SEC_I_CONTINUE_NEEDED);

    } else {
        //
        // This is the second call. Lookup the old context.
        //

        Context = LocateContext(phContext->dwUpper);
        if (Context == NULL)
        {
            return(SEC_E_INVALID_HANDLE);
        }

        if ((Context->State != FirstInit) &&
            (Context->State != SecondInit))
        {
            return(SEC_E_INVALID_HANDLE);
        }

        //
        // Build the new output message
        //

        if (Context->State == FirstInit)
        {

            //
            // Check that the input message is what we expected.
            //

            InputBuffer = LocateSecBuffer(pInput);
            if (InputBuffer == NULL)
            {
                return(SEC_E_INVALID_TOKEN);
            }
            Message = (PMESSAGE) InputBuffer->pvBuffer;

            SampleMessage.MessageType = Challenge;
            memset(SampleMessage.Buffer, 'y', MESSAGE_SIZE);

            if (memcmp(&SampleMessage,Message,MESSAGE_SIZE) != 0)
            {
                return(SEC_E_INVALID_TOKEN);
            }

            Message = (PMESSAGE) OutputBuffer->pvBuffer;
            Message->MessageType = ChallengeResponse;
            memset(Message->Buffer,'z',MESSAGE_SIZE);
        }
        else
        {
            Message = (PMESSAGE) OutputBuffer->pvBuffer;
            Message->MessageType = ReAuthenticate;
            memset(Message->Buffer,'q',MESSAGE_SIZE);
        }

        OutputBuffer->cbBuffer = sizeof(MESSAGE);
        Context->State = SecondInit;
        return(SEC_E_OK);
    }
}

PSecurityFunctionTableW SEC_ENTRY InitSecurityInterfaceW ( VOID )

Definition at line 332 of file Stubs.c.

{
    InitializeCriticalSection( &DllCritSect );
    return(&SecTableW);
}

PSecBuffer LocateBuffer | ( | PSecBufferDesc | Buffer,
 |  | ULONG | MinimumSize
 | ) |  |

Definition at line 269 of file Stubs.c.

{
    ULONG Index;
    if (Buffer == NULL)
    {
        return(NULL);
    }

    for (Index = 0; Index < Buffer->cBuffers  ; Index++)
    {
        if (((Buffer->pBuffers[Index].BufferType) & ~SECBUFFER_ATTRMASK)
            == SECBUFFER_TOKEN)
        {

            //
            // Do size checking
            //

            if (Buffer->pBuffers[Index].cbBuffer < MinimumSize)
            {
                return(NULL);
            }
            return(&Buffer->pBuffers[Index]);
        }
    }
    return(NULL);
}

PSEC_CONTEXT LocateContext ( ULONG ContextId )

Definition at line 66 of file Stubs.c.

{
    PSEC_CONTEXT TestContext;
    EnterCriticalSection(&DllCritSect);

    TestContext = ContextList;
    while (TestContext != NULL)
    {
        if (TestContext->ContextId == ContextId)
        {
            break;
        }
        TestContext = TestContext->Next;
    }
    LeaveCriticalSection(&DllCritSect);
    return(TestContext);

}

PCREDENTIAL LocateCredential ( ULONG CredentialId )

Definition at line 192 of file Stubs.c.

{
    PCREDENTIAL TestCredential;
    EnterCriticalSection(&DllCritSect);

    TestCredential = CredentialList;
    while (TestCredential != NULL)
    {
        if (TestCredential->CredentialId == CredentialId)
        {
            break;
        }
        TestCredential = TestCredential->Next;
    }
    LeaveCriticalSection(&DllCritSect);
    return(TestCredential);

}

PSecBuffer LocateSecBuffer ( PSecBufferDesc Buffer )

Definition at line 300 of file Stubs.c.

{
    return(LocateBuffer(Buffer, sizeof(MESSAGE)));
}

PSecBuffer LocateSigBuffer ( PSecBufferDesc Buffer )

Definition at line 307 of file Stubs.c.

{
    return(LocateBuffer(Buffer, sizeof(SIGNATURE)));
}

SECURITY_STATUS SEC_ENTRY MakeSignature | ( | PCtxtHandle | phContext,
 |  | ULONG | fQOP,
 |  | PSecBufferDesc | pMessage,
 |  | ULONG | MessageSeqNo
 | ) |  |

Definition at line 1295 of file Stubs.c.

{
    PSEC_CONTEXT Context;
    PSecBuffer SignatureBuffer;
    PSIGNATURE Signature;

    Context = LocateContext(phContext->dwUpper);
    if (Context == NULL)
    {
        return(SEC_E_INVALID_HANDLE);
    }

    SignatureBuffer = LocateSigBuffer(pMessage);
    if (SignatureBuffer == NULL)
    {
        return(SEC_E_INVALID_TOKEN);
    }
    Signature = (PSIGNATURE) SignatureBuffer->pvBuffer;
    Signature->MessageId = Context->Nonce++;
    Signature->Tag = PACKAGE_SIGNATURE_TAG;
    SignatureBuffer->cbBuffer = sizeof(SIGNATURE);
    return(SEC_E_OK);
}

SECURITY_STATUS SEC_ENTRY QueryContextAttributesW | ( | PCtxtHandle | phContext,
 |  | unsigned long | ulAttribute,
 |  | void SEC_FAR * | pBuffer
 | ) |  |

Definition at line 1169 of file Stubs.c.

{
    PSEC_CONTEXT Context;
    PSecPkgContext_Sizes ContextSizes;
    PSecPkgContext_NamesW ContextNames;
    PSecPkgContext_Lifespan ContextLifespan;
    PSecPkgContext_DceInfo  ContextDceInfo;

    Context = LocateContext(phContext->dwUpper);

    if (Context == NULL)
    {
        return(SEC_E_INVALID_HANDLE);
    }

    switch(ulAttribute) {
    case SECPKG_ATTR_SIZES:
        ContextSizes = (PSecPkgContext_Sizes) pBuffer;
        ContextSizes->cbMaxSignature = PACKAGE_SIGNATURE_SIZE;
        if ((Context->ContextFlags & ISC_REQ_CONFIDENTIALITY) != 0)
        {
            ContextSizes->cbSecurityTrailer = PACKAGE_SIGNATURE_SIZE;
            ContextSizes->cbBlockSize = 1;
        }
        else
        {
            ContextSizes->cbSecurityTrailer = 0;
            ContextSizes->cbBlockSize = 0;
        }
        ContextSizes->cbMaxToken = PACKAGE_MAXTOKEN;
        break;
    case SECPKG_ATTR_NAMES:
        ContextNames = (PSecPkgContext_Names) pBuffer;
        ContextNames->sUserName = (LPWSTR) LocalAlloc(0,sizeof(L"dummy user"));
        if (ContextNames->sUserName == NULL)
        {
            return(SEC_E_INSUFFICIENT_MEMORY);
        }
        wcscpy(ContextNames->sUserName, L"dummy user");
        break;
    case SECPKG_ATTR_LIFESPAN:
        ContextLifespan = (PSecPkgContext_Lifespan) pBuffer;
        ContextLifespan->tsStart = Never;
        ContextLifespan->tsExpiry = Forever;
        break;
    case SECPKG_ATTR_DCE_INFO:
        ContextDceInfo = (PSecPkgContext_DceInfo) pBuffer;
        ContextDceInfo->AuthzSvc = 0;
        ContextDceInfo->pPac = (PVOID) LocalAlloc(0,sizeof(L"dummy user"));
        if (ContextDceInfo->pPac == NULL)
        {
            return(SEC_E_INSUFFICIENT_MEMORY);
        }
        wcscpy((LPWSTR) ContextDceInfo->pPac, L"dummy user");

        break;
    default:
        return(SEC_E_INVALID_TOKEN);
    }

    return(SEC_E_OK);
}

SECURITY_STATUS SEC_ENTRY QuerySecurityPackageInfoW | ( | LPWSTR | pszPackageName,
 |  | PSecPkgInfoW SEC_FAR * | ppPackageInfo
 | ) |  |

Definition at line 976 of file Stubs.c.

{
    PSecPkgInfoW PackageInfo;
    ULONG PackageInfoSize;
    PUCHAR Where;

    if (_wcsicmp(pszPackageName, PACKAGE_NAME))
    {
        return(SEC_E_SECPKG_NOT_FOUND);
    }

    PackageInfoSize = sizeof(SecPkgInfoW) +
                        (wcslen(PACKAGE_NAME) + 1 +
                         wcslen(PACKAGE_COMMENT) + 1) * sizeof(WCHAR);

    PackageInfo = (PSecPkgInfoW) LocalAlloc(0,PackageInfoSize);
    if (PackageInfo == NULL)
    {
        return(SEC_E_INSUFFICIENT_MEMORY);
    }
    PackageInfo->fCapabilities = PACKAGE_CAPABILITIES;
    PackageInfo->wVersion = PACKAGE_VERSION;
    PackageInfo->wRPCID = PACKAGE_RPCID;
    PackageInfo->cbMaxToken = PACKAGE_MAXTOKEN;

    Where = (PUCHAR) (PackageInfo + 1);
    PackageInfo->Name = (LPWSTR) Where;
    Where += (wcslen(PACKAGE_NAME) + 1) * sizeof(WCHAR);
    wcscpy(PackageInfo->Name, PACKAGE_NAME);

    PackageInfo->Comment = (LPWSTR) Where;
    Where += (wcslen(PACKAGE_COMMENT) + 1) * sizeof(WCHAR);
    wcscpy(PackageInfo->Comment, PACKAGE_COMMENT);

    assert(Where - (PBYTE) PackageInfo == (LONG) PackageInfoSize);

    *ppPackageInfo = PackageInfo;
    return(SEC_E_OK);
}

SECURITY_STATUS SEC_ENTRY RevertSecurityContext ( PCtxtHandle phContext )

Definition at line 1139 of file Stubs.c.

{
    return(SEC_E_OK);
}

SECURITY_STATUS SEC_ENTRY VerifySignature | ( | PCtxtHandle | phContext,
 |  | PSecBufferDesc | pMessage,
 |  | ULONG | MessageSeqNo,
 |  | ULONG * | pfQOP
 | ) |  |

Definition at line 1345 of file Stubs.c.

{
    PSEC_CONTEXT Context;
    PSecBuffer SignatureBuffer;
    PSIGNATURE Signature;

    Context = LocateContext(phContext->dwUpper);
    if (Context == NULL)
    {
        return(SEC_E_INVALID_HANDLE);
    }

    SignatureBuffer = LocateSigBuffer(pMessage);
    if (SignatureBuffer == NULL)
    {
        return(SEC_E_INVALID_TOKEN);
    }
    Signature = (PSIGNATURE) SignatureBuffer->pvBuffer;

    if (Signature->Tag != PACKAGE_SIGNATURE_TAG)
    {
        return(SEC_E_MESSAGE_ALTERED);
    }

    if (Signature->MessageId != Context->Nonce++)
    {
        Context->State = Idle;
        return(SEC_E_OUT_OF_SEQUENCE);
    }

    return(SEC_E_OK);
}

Variable Documentation

PSEC_CONTEXT ContextList

Definition at line 39 of file Stubs.c.

PCREDENTIAL CredentialList

Definition at line 40 of file Stubs.c.

TimeStamp Forever = {0x7fffffff,0xfffffff}

Definition at line 42 of file Stubs.c.

TimeStamp Never = {0,0}

Definition at line 43 of file Stubs.c.

ULONG NextId

Definition at line 41 of file Stubs.c.

SecurityFunctionTableW SecTableW
Initial value:
 {SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION,
                                    EnumerateSecurityPackagesW,
                                    NULL,
                                    AcquireCredentialsHandleW,
                                    FreeCredentialsHandle,
                                    NULL,
                                    InitializeSecurityContextW,
                                    AcceptSecurityContext,
                                    CompleteAuthToken,
                                    DeleteSecurityContext,
                                    ApplyControlToken,
                                    QueryContextAttributesW,
                                    ImpersonateSecurityContext,
                                    RevertSecurityContext,
                                    MakeSignature,
                                    VerifySignature,
                                    FreeContextBuffer,
                                    QuerySecurityPackageInfoW
                                   }

Definition at line 18 of file Stubs.c.

Generated on Wed Nov 13 2024 16:54:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/Authorization/AclApi/AclApi.c File Reference

  • Security
  • Authorization
  • AclApi
Defines | Functions

AclApi.c File Reference

#include <windows.h>
#include <aclapi.h>
#include <lmerr.h>
#include <stdio.h>

Go to the source code of this file.

Defines

#define | RTN_ERROR 13
#define | RTN_OK 0
#define | RTN_USAGE 1

Functions

void | DisplayLastError (LPSTR szAPI)
int __cdecl | main (int argc, char *argv[])

Define Documentation

#define RTN_ERROR 13

Definition at line 62 of file AclApi.c.

#define RTN_OK 0

Definition at line 60 of file AclApi.c.

#define RTN_USAGE 1

Definition at line 61 of file AclApi.c.

Function Documentation

void DisplayLastError ( LPSTR szAPI )

Definition at line 208 of file AclApi.c.

{
    HMODULE hModule = NULL; // default to system source
    DWORD dwLastError = GetLastError();
    LPSTR MessageBuffer;
    DWORD dwBufferLength;

    DWORD dwFormatFlags = FORMAT_MESSAGE_ALLOCATE_BUFFER |
        FORMAT_MESSAGE_IGNORE_INSERTS |
        FORMAT_MESSAGE_FROM_SYSTEM ;

    //
    // if dwLastError is in the network range, load the message source
    //

    if(dwLastError >= NERR_BASE && dwLastError <= MAX_NERR) {
        hModule = LoadLibraryEx(
            TEXT("netmsg.dll"),
            NULL,
            LOAD_LIBRARY_AS_DATAFILE
            );

        if(hModule != NULL)
            dwFormatFlags |= FORMAT_MESSAGE_FROM_HMODULE;
    }

    printf("%s error! (rc=%lu)\n", szAPI, dwLastError);

    //
    // call FormatMessage() to allow for message text to be acquired
    // from the system or the supplied module handle
    //

    if(dwBufferLength = FormatMessageA(
        dwFormatFlags,
        hModule, // module to get message from (NULL == system)
        dwLastError,
        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // default language
        (LPSTR) &MessageBuffer,
        0,
        NULL
        ))
    {
        DWORD dwBytesWritten;

        //
        // Output message string on stderr
        //
        WriteFile(
            GetStdHandle(STD_ERROR_HANDLE),
            MessageBuffer,
            dwBufferLength,
            &dwBytesWritten,
            NULL
            );

        //
        // free the buffer allocated by the system
        //
        LocalFree(MessageBuffer);
    }

    //
    // if we loaded a message source, unload it
    //
    if(hModule != NULL)
        FreeLibrary(hModule);
}

int __cdecl main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 71 of file AclApi.c.

{
    LPTSTR FileName;
    LPTSTR TrusteeName;

    DWORD AccessMask = GENERIC_ALL;
    DWORD InheritFlag = NO_INHERITANCE;
    ACCESS_MODE option;
    EXPLICIT_ACCESS explicitaccess;

    PACL ExistingDacl;
    PACL NewAcl = NULL;
    PSECURITY_DESCRIPTOR psd = NULL;

    DWORD dwError;
    BOOL bSuccess = FALSE; // assume failure

    if(argc < 4) {
        printf("Usage: %s <filename> {/Deny | /Grant | /Revoke | /Set} [<trustee>] [<permissions>] [<InheritFlag>]\n", argv[0]);
        return RTN_USAGE;
    }

    FileName = argv[1];
    TrusteeName = argv[3];

    if ( (0 == stricmp(argv[2], "/Deny") ) ||
        (0 == stricmp(argv[2], "/D") ) )
    {
      option = DENY_ACCESS;
    } else if ( ( (0 == stricmp(argv[2], "/Revoke") ) ||
                 (0 == stricmp(argv[2], "/R") ) ) )
    {
      option = REVOKE_ACCESS;
    } else if ( (0 == stricmp(argv[2], "/Set") ) ||
               (0 == stricmp(argv[2], "/S") ) )
    {
      option = SET_ACCESS;
    } else if ( (0 == stricmp(argv[2], "/Grant") ) ||
               (0 == stricmp(argv[2], "/G") ) )
    {
      option = GRANT_ACCESS;
    } else {
        printf("Invalid action specified\n");
        return RTN_ERROR;
    }

    if (argc > 4)
    {
        AccessMask = atol( argv[4] );
    }

    if (argc > 5)
    {
       InheritFlag = atol( argv[5] );
    }

    //
    // get current Dacl on specified file
    //

    dwError = GetNamedSecurityInfo(
                        FileName,
                        SE_FILE_OBJECT,
                        DACL_SECURITY_INFORMATION,
                        NULL,
                        NULL,
                        &ExistingDacl,
                        NULL,
                        &psd
                        );

    if(dwError != ERROR_SUCCESS) {
        DisplayLastError("GetNamedSecurityInfo");
        return RTN_ERROR;
    }

    BuildExplicitAccessWithName(
            &explicitaccess,
            TrusteeName,
            AccessMask,
            option,
            InheritFlag
            );

    //
    // add specified access to the object
    //

    dwError = SetEntriesInAcl(
            1,
            &explicitaccess,
            ExistingDacl,
            &NewAcl
            );

    if(dwError != ERROR_SUCCESS) {
        DisplayLastError("SetEntriesInAcl");
        goto cleanup;
    }

    //
    // apply new security to file
    //

    dwError = SetNamedSecurityInfo(
                    FileName,
                    SE_FILE_OBJECT, // object type
                    DACL_SECURITY_INFORMATION,
                    NULL,
                    NULL,
                    NewAcl,
                    NULL
                    );

    if(dwError != ERROR_SUCCESS) {
        DisplayLastError("SetNamedSecurityInfo");
        goto cleanup;
    }

    bSuccess = TRUE; // indicate success

cleanup:

    if( NewAcl != NULL ) AccFree( NewAcl );
    if( psd != NULL) AccFree( psd );

    if(!bSuccess)
        return RTN_ERROR;

    return RTN_OK;
}

Generated on Wed Nov 13 2024 16:54:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/Authorization/Audit/Audit.c File Reference

  • Security
  • Authorization
  • Audit
Defines | Functions

Audit.c File Reference

#include <windows.h>
#include <stdio.h>
#include "ntsecapi.h"

Go to the source code of this file.

Defines

#define | RTN_ERROR 13
#define | RTN_OK 0
#define | RTN_USAGE 1
#define | STATUS_INVALID_PARAMETER ((NTSTATUS)0xC000000DL)
#define | STATUS_SUCCESS ((NTSTATUS)0x00000000L)

Functions

NTSTATUS | DisplayAudit (LSA_HANDLE PolicyHandle)
void | DisplayAuditEventOption (DWORD EventTypeIndex, POLICY_AUDIT_EVENT_OPTIONS EventOption)
void | DisplayNtStatus (LPSTR szAPI, NTSTATUS Status)
void | DisplayWinError (LPSTR szAPI, DWORD dwError)
void | InitLsaString (PLSA_UNICODE_STRING LsaString, LPWSTR String)
NTSTATUS | OpenPolicy (LPWSTR ServerName, DWORD DesiredAccess, PLSA_HANDLE PolicyHandle)
NTSTATUS | SetAuditEvent (LSA_HANDLE PolicyHandle, POLICY_AUDIT_EVENT_TYPE EventType, POLICY_AUDIT_EVENT_OPTIONS EventOption)
NTSTATUS | SetAuditMode (LSA_HANDLE PolicyHandle, BOOL bEnable)
int __cdecl | wmain (int argc, wchar_t *argv[])

Define Documentation

#define RTN_ERROR 13

Definition at line 44 of file Audit.c.

#define RTN_OK 0

Definition at line 42 of file Audit.c.

#define RTN_USAGE 1

Definition at line 43 of file Audit.c.

#define STATUS_INVALID_PARAMETER ((NTSTATUS)0xC000000DL)

Definition at line 51 of file Audit.c.

#define STATUS_SUCCESS ((NTSTATUS)0x00000000L)

Definition at line 50 of file Audit.c.

Function Documentation

NTSTATUS DisplayAudit ( LSA_HANDLE PolicyHandle )

Definition at line 201 of file Audit.c.

{
    PPOLICY_AUDIT_EVENTS_INFO AuditEvents;
    NTSTATUS Status;
    DWORD i; // index into EventAuditingOptions

    //
    // obtain AuditEvents
    //
    Status = LsaQueryInformationPolicy(
                PolicyHandle,
                PolicyAuditEventsInformation,
                &AuditEvents
                );

    if(Status != STATUS_SUCCESS) return Status;

    //
    // successfully obtained AuditEventsInformation.  Now display.
    //
    if(AuditEvents->AuditingMode) {
        printf("Auditing Enabled\n");
    } else {
        printf("Auditing Disabled\n");
    }

    for(i = 0 ; i < AuditEvents->MaximumAuditEventCount ; i++) {
        DisplayAuditEventOption(i, AuditEvents->EventAuditingOptions[i]);
    }

    //
    // free allocated memory
    //
    LsaFreeMemory(AuditEvents);

    return Status;
}

void DisplayAuditEventOption | ( | DWORD | EventTypeIndex,
 |  | POLICY_AUDIT_EVENT_OPTIONS | EventOption
 | ) |  |

Definition at line 242 of file Audit.c.

{
    printf("AuditCategory");

    switch (EventTypeIndex) {
        case AuditCategorySystem:
        printf("System");
        break;

        case AuditCategoryLogon:
        printf("Logon");
        break;

        case AuditCategoryObjectAccess:
        printf("ObjectAccess");
        break;

        case AuditCategoryPrivilegeUse:
        printf("PrivilegeUse");
        break;

        case AuditCategoryDetailedTracking:
        printf("DetailedTracking");
        break;

        case AuditCategoryPolicyChange:
        printf("PolicyChange");
        break;

        case AuditCategoryAccountManagement:
        printf("AccountManagement");
        break;

        default:
        printf("Unknown");
    }

    if(EventOption & POLICY_AUDIT_EVENT_SUCCESS)
        printf(" AUDIT_EVENT_SUCCESS");

    if(EventOption & POLICY_AUDIT_EVENT_FAILURE)
        printf(" AUDIT_EVENT_FAILURE");

    printf("\n");
}

void DisplayNtStatus | ( | LPSTR | szAPI,
 |  | NTSTATUS | Status
 | ) |  |

Definition at line 459 of file Audit.c.

{
    //
    // convert the NTSTATUS to Winerror and DisplayWinError()
    //
    DisplayWinError(szAPI, LsaNtStatusToWinError(Status) );
}

void DisplayWinError | ( | LPSTR | szAPI,
 |  | DWORD | dwError
 | ) |  |

Definition at line 471 of file Audit.c.

{
    LPSTR MessageBuffer;
    DWORD dwBufferLength;

    //
    // TODO get this fprintf out of here!
    //
    fprintf(stderr,"%s error!\n", szAPI);

    if(dwBufferLength=FormatMessageA(
            FORMAT_MESSAGE_ALLOCATE_BUFFER |
            FORMAT_MESSAGE_FROM_SYSTEM,
            NULL,
            dwError,
            MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
            (LPSTR) &MessageBuffer,
            0,
            NULL
            ))
    {
        DWORD dwBytesWritten; // unused

        //
        // Output message string on stderr
        //
        WriteFile(
                GetStdHandle(STD_ERROR_HANDLE),
                MessageBuffer,
                dwBufferLength,
                &dwBytesWritten,
                NULL
                );

        //
        // free the buffer allocated by the system
        //
        LocalFree(MessageBuffer);
    }
}

void InitLsaString | ( | PLSA_UNICODE_STRING | LsaString,
 |  | LPWSTR | String
 | ) |  |

Definition at line 399 of file Audit.c.

{
    DWORD StringLength;

    if(String == NULL) {
        LsaString->Buffer = NULL;
        LsaString->Length = 0;
        LsaString->MaximumLength = 0;

        return;
    }

    StringLength = lstrlenW(String);
    LsaString->Buffer = String;
    LsaString->Length = (USHORT) StringLength * sizeof(WCHAR);
    LsaString->MaximumLength = (USHORT) (StringLength + 1) *
        sizeof(WCHAR);
}

NTSTATUS OpenPolicy | ( | LPWSTR | ServerName,
 |  | DWORD | DesiredAccess,
 |  | PLSA_HANDLE | PolicyHandle
 | ) |  |

Definition at line 422 of file Audit.c.

{
    PLSA_UNICODE_STRING Server;
    LSA_OBJECT_ATTRIBUTES ObjectAttributes;
    LSA_UNICODE_STRING ServerString;

    //
    // Always initialize the object attributes to all zeroes
    //
    ZeroMemory(&ObjectAttributes, sizeof(ObjectAttributes));

    if(ServerName != NULL) {
        //
        // Make a LSA_UNICODE_STRING out of the LPWSTR passed in
        //
        InitLsaString(&ServerString, ServerName);
        Server = &ServerString;
    } else {
        Server = NULL; // default to local machine
    }

    //
    // Attempt to open the policy and return NTSTATUS
    //
    return LsaOpenPolicy(
                Server,
                &ObjectAttributes,
                DesiredAccess,
                PolicyHandle
                );
}

NTSTATUS SetAuditEvent | ( | LSA_HANDLE | PolicyHandle,
 |  | POLICY_AUDIT_EVENT_TYPE | EventType,
 |  | POLICY_AUDIT_EVENT_OPTIONS | EventOption
 | ) |  |

Definition at line 292 of file Audit.c.

{
    PPOLICY_AUDIT_EVENTS_INFO pae;
    NTSTATUS Status;
    DWORD i; // index into EventAuditingOptions

    //
    // obtain AuditEvents
    //
    Status = LsaQueryInformationPolicy(
                PolicyHandle,
                PolicyAuditEventsInformation,
                &pae
                );

    if(Status != STATUS_SUCCESS) return Status;

    //
    // insure we were passed a valid EventType and EventOption
    //
    if((ULONG)EventType > pae->MaximumAuditEventCount ||
      (!EventOption & POLICY_AUDIT_EVENT_MASK) ) {
        LsaFreeMemory(pae);
        return STATUS_INVALID_PARAMETER;
    }

    //
    // set all auditevents to the unchanged status...
    //
    for(i = 0 ; i < pae->MaximumAuditEventCount ; i++) {
        pae->EventAuditingOptions[i] = POLICY_AUDIT_EVENT_UNCHANGED;
    }

    //
    // ...and update only the specified EventType
    //
    pae->EventAuditingOptions[EventType] = EventOption;

    //
    // set the new AuditEvents
    //
    Status = LsaSetInformationPolicy(
                PolicyHandle,
                PolicyAuditEventsInformation,
                pae
                );

    //
    // free allocated memory
    //
    LsaFreeMemory(pae);

    return Status;
}

NTSTATUS SetAuditMode | ( | LSA_HANDLE | PolicyHandle,
 |  | BOOL | bEnable
 | ) |  |

Definition at line 352 of file Audit.c.

{
    PPOLICY_AUDIT_EVENTS_INFO AuditEvents;
    NTSTATUS Status;
    DWORD i;

    //
    // obtain current AuditEvents
    //
    Status = LsaQueryInformationPolicy(
                PolicyHandle,
                PolicyAuditEventsInformation,
                &AuditEvents
                );

    if(Status != STATUS_SUCCESS) return Status;

    //
    // update the relevant member
    //
    AuditEvents->AuditingMode = bEnable;

    //
    // set all auditevents to the unchanged status...
    //
    for(i = 0 ; i < AuditEvents->MaximumAuditEventCount ; i++) {
        AuditEvents->EventAuditingOptions[i] = POLICY_AUDIT_EVENT_UNCHANGED;
    }

    //
    // set the new auditing mode (enabled or disabled)
    //
    Status = LsaSetInformationPolicy(
                PolicyHandle,
                PolicyAuditEventsInformation,
                AuditEvents
                );

    LsaFreeMemory(AuditEvents);

    return Status;
}

int __cdecl wmain | ( | int | argc,
 |  | wchar_t * | argv[]
 | ) |  |

Definition at line 113 of file Audit.c.

{
    LPWSTR wComputerName;
    LSA_HANDLE PolicyHandle;
    NTSTATUS Status;

    //
    // pickup machine name if appropriate
    //
    if(argc == 2)
        wComputerName = argv[1];
    else
        wComputerName = NULL; // local machine

    //
    // display current audit state
    //

    Status = OpenPolicy(
                wComputerName,
                POLICY_VIEW_AUDIT_INFORMATION,
                &PolicyHandle
                );

    if(Status == STATUS_SUCCESS) {
        //
        // display current auditing status
        //
        Status = DisplayAudit(PolicyHandle);

        LsaClose(PolicyHandle);

        if(Status != STATUS_SUCCESS) {
            DisplayNtStatus("DisplayAudit", Status);
            return RTN_ERROR;
        }
    } else {
        DisplayNtStatus("OpenPolicy", Status);
        return RTN_ERROR;
    }

    //
    // enable success and failure audits of logon/logoff events
    //

    Status = OpenPolicy(
                wComputerName,
                POLICY_VIEW_AUDIT_INFORMATION |
                POLICY_SET_AUDIT_REQUIREMENTS,
                &PolicyHandle
                );

    if(Status == STATUS_SUCCESS) {

        //
        // enable success and failure auditing of logon/logoff
        //
        Status = SetAuditEvent(
            PolicyHandle,
            AuditCategoryLogon,
            POLICY_AUDIT_EVENT_SUCCESS | POLICY_AUDIT_EVENT_FAILURE
            );

        //
        // enable audits
        //
        if( Status == STATUS_SUCCESS )
            Status = SetAuditMode(PolicyHandle, TRUE);

        LsaClose(PolicyHandle);

        if(Status != STATUS_SUCCESS) {
            DisplayNtStatus("SetAuditMode", Status);
            return RTN_ERROR;
        }
    } else {
        DisplayNtStatus("OpenPolicy", Status);
        return RTN_ERROR;
    }

    return RTN_OK;
}

Generated on Wed Nov 13 2024 16:54:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/Authorization/authz/AuthzCli.c File Reference

  • Security
  • Authorization
  • authz
Functions

AuthzCli.c File Reference

#include <windows.h>
#include <stdio.h>
#include <tchar.h>
#include "common.h"

Go to the source code of this file.

Functions

void | main (int argc, char *argv[])
void | Usage (LPTSTR AppName)

Function Documentation

void main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 37 of file AuthzCli.c.

{
   HANDLE   hPipe;
   TCHAR    szPipeName[256];
   TCHAR    szServerName[128] = "\\\\.";
   EX_BUF   exBuf = {0};
   DWORD    dwResponce = ERROR_ACCESS_DENIED;

   if (argc < 4)
      Usage(argv[0]);

   //
   // Verify expnese input
   //

   if (!lstrcmpi(argv[2],TEXT("Personal"))) {
      exBuf.dwType = ACCESS_FUND_PERSONAL;
   }
   else if (!lstrcmpi(argv[2],TEXT("Corporate"))) {
      exBuf.dwType = ACCESS_FUND_CORPORATE;
   }
   else if (!lstrcmpi(argv[2],TEXT("Transfer"))) {
      exBuf.dwType = ACCESS_FUND_TRANSFER;
   }
   else
      Usage(argv[0]);

   if (!(exBuf.dwAmmount = atoi(argv[3])))
       Usage(argv[0]);

   printf("expense: %s Ammount: %u\n",ExNames[exBuf.dwType],exBuf.dwAmmount);

   wsprintf(szPipeName,"%s\\pipe\\AuthzSamplePipe",szServerName);

   // Wait for an instance of the pipe
   if (!WaitNamedPipe(szPipeName,NMPWAIT_WAIT_FOREVER) )
      HandleError(GetLastError(),TEXT("WaitNamedPipe"),TRUE,TRUE);

   // Connect to pipe
   hPipe = CreateFile(  szPipeName, GENERIC_READ|GENERIC_WRITE, 0,
                        NULL, OPEN_EXISTING, 0, NULL);
   if (hPipe == INVALID_HANDLE_VALUE)
      HandleError(GetLastError(),TEXT("CreateFile"),TRUE,TRUE);

   // Send off request
   WriteToPipe(hPipe, (PBYTE)&exBuf, sizeof(EX_BUF));

   // wait till server responds with one DWORD
   if (!ReadFromPipe(hPipe,(PBYTE)&dwResponce,sizeof(dwResponce))) {
      printf("Error reading form Svr\n");
      return;
   }

   switch(dwResponce)
   {
   case EXPENSE_APPROVED:
      printf("Expense Approved.\n");
      break;

   case ERROR_ACCESS_DENIED:
      printf("Expense denied: Access denied.\n");
      break;

   case ERROR_INSUFFICIENT_FUNDS:
      printf("Expense denied: Insufficeint funds.\n");
      break;

   default:
      printf("Expense failed: unexpected error.\n");
   }

   CloseHandle(hPipe);
}

void Usage ( LPTSTR AppName )

Definition at line 27 of file AuthzCli.c.

{
   printf(
      "Usage: %s <\\\\server> <Personal|Corporate|Transfer> <Ammount (cents)>\n"
       ,AppName);
   ExitProcess(0);
}

Generated on Wed Nov 13 2024 16:54:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/Authorization/authz/AuthzSvr.c File Reference

  • Security
  • Authorization
  • authz
Classes | Defines | Typedefs | Functions | Variables

AuthzSvr.c File Reference

#include <windows.h>
#include <security.h>
#include <lmcons.h>
#include <authz.h>
#include <stdio.h>
#include "common.h"

Go to the source code of this file.

Classes

struct | _FundsRM

Defines

#define | FirstAce(Acl) ((PVOID)((PUCHAR)(Acl) + sizeof(ACL)))
#define | READ_BUFFER_SIZE 512
#define | SECURITY_WIN32

Typedefs

typedef struct _FundsRM | FUNDSRM
typedef struct _FundsRM * | PFUNDSRM

Functions

BOOL | AuthorizeAndExecuteExpense (PFUNDSRM pFundsRM, HANDLE hToken, EX_BUF exBuf, PDWORD pdwResult)
BOOL WINAPI | AuthzAccessCheckCallback (IN AUTHZ_CLIENT_CONTEXT_HANDLE hAuthzClientContext, IN PACE_HEADER pAce, IN PVOID pArgs OPTIONAL, IN OUT PBOOL pbAceApplicable)
BOOL WINAPI | AuthzComputeGroupsCallback (IN AUTHZ_CLIENT_CONTEXT_HANDLE hAuthzClientContext, IN PVOID Args, OUT PSID_AND_ATTRIBUTES *pSidAttrArray, OUT PDWORD pSidCount, OUT PSID_AND_ATTRIBUTES *pRestrictedSidAttrArray, OUT PDWORD pRestrictedSidCount)
VOID WINAPI | AuthzFreeGroupsCallback (IN PSID_AND_ATTRIBUTES pSidAttrArray)
BOOL | InitializeFundsRM (PFUNDSRM pFundsRM, DWORD dwFundsAvailable)
void | main (int argc, char *argv[])

Variables

PSID EmployeeSid = (PSID)EmployeeSidBuf
DWORD | EmployeeSidBuf [] = {0x00000501, 0x05000000, 0x00000015, 0x17b85159, 0x255d7266, 0x0b3b6364, 0x00010003}
PSID ManagerSid = (PSID)ManagerSidBuf
DWORD | ManagerSidBuf [] = {0x00000501, 0x05000000, 0x00000015, 0x17b85159, 0x255d7266, 0x0b3b6364, 0x00010002}
DWORD MaxSpendingEmployee
DWORD MaxSpendingManager
DWORD MaxSpendingVP
PSID VPSid = (PSID)VPSidBuf
DWORD | VPSidBuf [] = {0x00000501, 0x05000000, 0x00000015, 0x17b85159, 0x255d7266, 0x0b3b6364, 0x00010001}

Define Documentation

#define FirstAce ( Acl ) ((PVOID)((PUCHAR)(Acl) + sizeof(ACL)))

Definition at line 32 of file AuthzSvr.c.

#define READ_BUFFER_SIZE 512

Definition at line 30 of file AuthzSvr.c.

#define SECURITY_WIN32

Definition at line 21 of file AuthzSvr.c.

Typedef Documentation

typedef struct _FundsRM FUNDSRM
typedef struct _FundsRM* PFUNDSRM

Function Documentation

BOOL AuthorizeAndExecuteExpense | ( | PFUNDSRM | pFundsRM,
 |  | HANDLE | hToken,
 |  | EX_BUF | exBuf,
 |  | PDWORD | pdwResult
 | ) |  |

Definition at line 521 of file AuthzSvr.c.

{
   AUTHZ_CLIENT_CONTEXT_HANDLE AuthzClient;
   LUID     luid = {0x0,0x0};
   AUTHZ_ACCESS_REQUEST AccessRequest = {0};
   AUTHZ_ACCESS_REPLY AccessReply = {0};
   BYTE     Buffer[1024];
   BOOL bRes = FALSE;  // Assume error

   __try
   {

      //
      // first we need an Authz context
      //

      if (!AuthzInitializeContextFromToken(
        0,
        hToken,
        pFundsRM->_hRM,
        NULL,
        luid,
        NULL,
        &AuthzClient )){
         HandleError(GetLastError(),TEXT("AuthzInitializeContextFromToken"),TRUE,FALSE);
         __leave;

      }

      // Do AccessCheck
      AccessRequest.DesiredAccess = exBuf.dwType;
      AccessRequest.PrincipalSelfSid = NULL;
      AccessRequest.ObjectTypeList = NULL;
      AccessRequest.ObjectTypeListLength = 0;
      AccessRequest.OptionalArguments = &(exBuf.dwAmmount);

      //
      // The ResultListLength is set to the number of ObjectType GUIDs in the Request, indicating
      // that the caller would like detailed information about granted access to each node in the
      // tree.
      //
      RtlZeroMemory(Buffer, sizeof(Buffer));
      AccessReply.ResultListLength = 1;
      AccessReply.GrantedAccessMask = (PACCESS_MASK) (Buffer);
      AccessReply.Error = (PDWORD) (Buffer + sizeof(ACCESS_MASK));

      if (!AuthzAccessCheck( 0,
                             AuthzClient,
                             &AccessRequest,
                             NULL,
                             &(pFundsRM->_SD),
                             NULL,
                             0,
                             &AccessReply,
                             NULL) ) {
         HandleError(GetLastError(),TEXT("AuthzAccessCheck"),TRUE,FALSE);
         __leave;
      }

      if (( *(AccessReply.GrantedAccessMask) & exBuf.dwType) != exBuf.dwType) {
         // Access is denied get error from reply if there else Getlasterror.
         *pdwResult = *(AccessReply.Error);
         printf("Access denied\n\n");

      }
      else {

         // Access is granted, is there enough funds, this could have been done
         // within the AuthzAccessCheckCallback but since this is more of an
         // execution problem than access checking we'll do it here.
         if (pFundsRM->_dwFundsAvailable < exBuf.dwAmmount) {

            // not enough in fund
            *pdwResult = ERROR_INSUFFICIENT_FUNDS;
            printf("Failed : NSF\n\n");

         }
         else {
            pFundsRM->_dwFundsAvailable -= exBuf.dwAmmount;
            *pdwResult = EXPENSE_APPROVED;
            printf("Expense Approved. Remaining funds:%u cents.\n\n",
                                                 pFundsRM->_dwFundsAvailable);
         }
      }

      bRes = TRUE;
   }

   __finally{
      AuthzFreeContext(AuthzClient);
   }

   return bRes;

}

BOOL WINAPI AuthzAccessCheckCallback | ( | IN AUTHZ_CLIENT_CONTEXT_HANDLE | hAuthzClientContext,
 |  | IN PACE_HEADER | pAce,
 |  | IN PVOID pArgs | OPTIONAL,
 |  | IN OUT PBOOL | pbAceApplicable
 | ) |  |

Definition at line 80 of file AuthzSvr.c.

                                            :
      ACCESS_ALLOWED_CALLBACK_ACE_TYPE
      ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE
      ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE

      This function determines if the given callback ACE applies to the
      client context (which has already had dynamic groups computed) and
      the optional arguments, in this case the request amount.

      The list of groups which apply to the user is traversed. If a group
      is found which allows the user the requested access, pbAceApplicable
      is set to true and the function returns. If the end of the group list
      is reached, pbAceApplicable is set to false and the function returns.

    Arguments

        hAuthzClientContext - handle to the AuthzClientContext.

        pAce - pointer to the Ace header.

        pArgs - optional arguments, in this case DWORD*, DWORD is  the spending
         request amount in cents

        pbAceApplicable - returns true iff the ACE allows the client's request

    Return value

        Bool, true on success, false on error

    Error checking

      Sample code, no error checking

--*/
{

   DWORD dwTokenGroupsSize = 0;
   PVOID pvTokenGroupsBuf = NULL;
   DWORD i;
   PDWORD pAccessMask = NULL;
   DWORD dwRequestedSpending = ((PDWORD)pArgs)[0];

   //
   // By default, the ACE does not apply to the request
   //

   *pbAceApplicable = FALSE;

   //
   // The object's access mask (right after the ACE_HEADER)
   // The access mask determines types of expenditures allowed
   // from this fund
   //

   pAccessMask = (PDWORD) (pAce + sizeof(ACE_HEADER));

   //
   // Get the TOKEN_GROUPS array
   //

   while (!AuthzGetInformationFromContext(
                        hAuthzClientContext,
                        AuthzContextInfoGroupsSids,
                        dwTokenGroupsSize,
                        &dwTokenGroupsSize,
                        pvTokenGroupsBuf
                        ))
   {
      if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
      {
         HandleError(GetLastError(),TEXT("AuthzGetInformationFromContext"),TRUE,TRUE);
         break;
      }

      // free incase we got size and size grew before our next call.
      if (pvTokenGroupsBuf) free( pvTokenGroupsBuf);
      pvTokenGroupsBuf = malloc(dwTokenGroupsSize);
   }

   if (!pvTokenGroupsBuf) return FALSE; // error actually handled in loop

   //
   // Go through the groups until end is reached or a group applying to the
   // request is found
   //

   for( i = 0;
       i < ((PTOKEN_GROUPS)pvTokenGroupsBuf)->GroupCount
       && *pbAceApplicable != TRUE;
       i++ )
   {
      //
      // This is the business logic.
      // Each level of employee can approve different amounts.
      //

      //
      // VP
      //

      if(EqualSid(VPSid, ((PTOKEN_GROUPS)pvTokenGroupsBuf)->Groups[i].Sid) && (dwRequestedSpending <= MaxSpendingVP) )
      {
            *pbAceApplicable = TRUE;
      }

      //
      // Manager
      //

      if(EqualSid(ManagerSid, ((PTOKEN_GROUPS)pvTokenGroupsBuf)->Groups[i].Sid) && (dwRequestedSpending <= MaxSpendingManager) )
      {
            *pbAceApplicable = TRUE;
      }

      //
      // Employee
      //

      if(EqualSid(EmployeeSid, ((PTOKEN_GROUPS)pvTokenGroupsBuf)->Groups[i].Sid) && (dwRequestedSpending <= MaxSpendingEmployee) )
      {
            *pbAceApplicable = TRUE;
      }
   }

   // return TRUE when access check completed (when a callback ace applies not)
   // If we had a runtime error, such as mem alloc errors we would return false
   return TRUE;
}

BOOL WINAPI AuthzComputeGroupsCallback | ( | IN AUTHZ_CLIENT_CONTEXT_HANDLE | hAuthzClientContext,
 |  | IN PVOID | Args,
 |  | OUT PSID_AND_ATTRIBUTES * | pSidAttrArray,
 |  | OUT PDWORD | pSidCount,
 |  | OUT PSID_AND_ATTRIBUTES * | pRestrictedSidAttrArray,
 |  | OUT PDWORD | pRestrictedSidCount
 | ) |  |

Definition at line 231 of file AuthzSvr.c.

{
   //
   // First, look up the user's SID from the context
   //

   DWORD dwSidSize = 0;
   PVOID pvSidBuf = NULL;
   PSID  psSidPtr = NULL;
   TCHAR UserName[256];
   DWORD cbName = 256;
   TCHAR Domain[256];
   DWORD cbDomain = 256;
   SID_NAME_USE eUse;

   //
   // Get the SID (inside a TOKEN_USER structure)
   //

   while (!AuthzGetInformationFromContext(
                        hAuthzClientContext,
                        AuthzContextInfoUserSid,
                        dwSidSize,
                        &dwSidSize,
                        pvSidBuf
                        )){

      if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
         HandleError(GetLastError(),TEXT("AuthzGetInformationFromContext"),TRUE,FALSE);
         break;
      }

      if (pvSidBuf) free (pvSidBuf);
      pvSidBuf = malloc(dwSidSize);
   }

   if (!pvSidBuf) return FALSE;

   psSidPtr = ((PTOKEN_USER)pvSidBuf)->User.Sid;

   //
   // Allocate the memory for the returns, which will be deallocated by FreeDynamicGroups
   // Only a single group will be returned, determining the employee type
   //

   *pSidCount = 1;
   *pSidAttrArray = (PSID_AND_ATTRIBUTES)malloc( sizeof(SID_AND_ATTRIBUTES) );

   //
   // No restricted group sids
   //

   pRestrictedSidCount = 0;
   *pRestrictedSidAttrArray = NULL;

   (*pSidAttrArray)[0].Attributes = SE_GROUP_ENABLED;

   //
   //       The hardcoded Sample logic:
   //
   // Lookup the sid to get the username and grant dynamic sid based on username
   //
   //    Bob is a VP
   //    Martha is a Manager
   //    Joe is an Employee
   //

   if (!LookupAccountSid(NULL,psSidPtr,UserName,&cbName,Domain,&cbDomain,&eUse)) {
      HandleError(GetLastError(),TEXT("LookupAccountSid"),TRUE,TRUE);
   }

   if( !lstrcmpi(UserName, TEXT("BOB")) )
   {
      (*pSidAttrArray)[0].Sid = VPSid;
   }
   else if( !lstrcmpi(UserName, TEXT("Martha")) )
   {
      (*pSidAttrArray)[0].Sid = ManagerSid;
   }
   else if( !lstrcmpi(UserName, TEXT("Joe")) )
   {
      (*pSidAttrArray)[0].Sid = EmployeeSid;
   }
   else
   {
      *pSidCount = 0;
      free(*pSidAttrArray);
      *pSidAttrArray = NULL;
   }

   if (pvSidBuf) free(pvSidBuf);

   return TRUE;
}

VOID WINAPI AuthzFreeGroupsCallback ( IN PSID_AND_ATTRIBUTES pSidAttrArray )

Definition at line 369 of file AuthzSvr.c.

{

    if (pSidAttrArray != NULL)
    {
      free(pSidAttrArray);
    }

}

BOOL InitializeFundsRM | ( | PFUNDSRM | pFundsRM,
 |  | DWORD | dwFundsAvailable
 | ) |  |

Definition at line 398 of file AuthzSvr.c.

{
   PSID psidEveryone = NULL;
   SID_IDENTIFIER_AUTHORITY siaWorld = SECURITY_WORLD_SID_AUTHORITY;
   PACL pDaclFund = NULL;

   MaxSpendingVP = 100000000;
   MaxSpendingManager = 1000000;
   MaxSpendingEmployee = 50000;

   //
   // The amount of money in the fund
   //

   pFundsRM->_dwFundsAvailable = dwFundsAvailable;

   //
   // Initialize the fund's resource manager
   //

   if (!AuthzInitializeResourceManager(
        0,    // no flags
        AuthzAccessCheckCallback,
        AuthzComputeGroupsCallback,
        AuthzFreeGroupsCallback,
        L"SampRM", // no auditing
        &(pFundsRM->_hRM)
        ))
      HandleError(GetLastError(),TEXT("AuthzInitializeResourceManager"),TRUE,TRUE);

   else
       printf("Funds Resource Manager initialized - waiting for client\n\n");

   //
   // Create the fund's security descriptor
   //

    if (!InitializeSecurityDescriptor(&(pFundsRM->_SD),SECURITY_DESCRIPTOR_REVISION))
       HandleError(GetLastError(),TEXT("InitializeSecurityDescriptor"),TRUE,TRUE);

    if (!SetSecurityDescriptorGroup(&(pFundsRM->_SD), NULL, FALSE))
       HandleError(GetLastError(),TEXT("SetSecurityDescriptorGroup"),TRUE,TRUE);

    if (!SetSecurityDescriptorSacl(&(pFundsRM->_SD), FALSE, NULL, FALSE))
       HandleError(GetLastError(),TEXT("SetSecurityDescriptorSacl"),TRUE,TRUE);

   // an owner must be specified.  Since VPs are the highest privileged group
   // this sample we'll make them the owner.
    if (!SetSecurityDescriptorOwner(&(pFundsRM->_SD), VPSid, FALSE))
      HandleError(GetLastError(),TEXT("SetSecurityDescriptorOwner"),TRUE,TRUE);

   //
   // Initialize the DACL for the fund
   //

   pDaclFund = (PACL)malloc(1024);
   InitializeAcl(pDaclFund, 1024, ACL_REVISION_DS);

   //
   // Add an access-allowed ACE for Everyone
   // Only company spending and transfers are allowed for this fund
   //

   // build EVERYONE SID
   if (!AllocateAndInitializeSid(
      &siaWorld, 1, SECURITY_WORLD_RID,
      0,0,0,0,0,0,0,
      &psidEveryone
      ))
      HandleError(GetLastError(),TEXT("AllocateAndInitializeSid"),TRUE,TRUE);

   if (!AddAccessAllowedAce(pDaclFund,
                  ACL_REVISION_DS,
                  ACCESS_FUND_CORPORATE | ACCESS_FUND_TRANSFER,
                  psidEveryone))
      HandleError(GetLastError(),TEXT("AddAccessAllowedAce"),TRUE,TRUE);

   FreeSid(psidEveryone);

   //
   // Now set that ACE to a callback ACE
   //

   ((PACE_HEADER)FirstAce(pDaclFund))->AceType =
                           ACCESS_ALLOWED_CALLBACK_ACE_TYPE;

   //
   // Add that ACL as the security descriptor's DACL
   //

   if (!SetSecurityDescriptorDacl(&(pFundsRM->_SD), TRUE, pDaclFund, FALSE))
      HandleError(GetLastError(),TEXT("SetSecurityDescriptorDacl"),TRUE,TRUE);

   return TRUE;
}

void main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 645 of file AuthzSvr.c.

{
   HANDLE   hPipe;
   DWORD    cbClientName = UNLEN + CNLEN + 2;
   TCHAR    ClientName[UNLEN + CNLEN + 2];
   DWORD    dwBytesRead;
   FUNDSRM  FundsRM;
   HANDLE   hToken = INVALID_HANDLE_VALUE;
   EX_BUF   exBuf = {0};
   DWORD    dwResult = ERROR_ACCESS_DENIED;

   InitializeFundsRM(&FundsRM,200000000);

   SetupNamedPipe(&hPipe,"\\\\.\\pipe\\AuthzSamplePipe");

   while(TRUE)
   {
      //
      //  Wait for a clinet...
      //

      if (!ConnectNamedPipe(hPipe, NULL))
         HandleError(GetLastError(),TEXT("ConnectNamedPipe"),TRUE,TRUE);

      dwBytesRead = ReadFromPipe(hPipe,(PBYTE)&exBuf,sizeof(exBuf));
      if ( !dwBytesRead ) {
         printf("Error reading from client\n");
      }

      //
      // Get Token
      //

      if (!ImpersonateNamedPipeClient(hPipe))
         HandleError(GetLastError(),TEXT("ImpersonateNamedPipeClient"),TRUE,TRUE);

      if(!GetUserName(ClientName,&cbClientName))
         HandleError(GetLastError(),TEXT("GetUserName"),TRUE,TRUE);

      if (!OpenThreadToken(GetCurrentThread(),
                          TOKEN_QUERY|TOKEN_IMPERSONATE,FALSE,&hToken))
         HandleError(GetLastError(),TEXT("OpenThreadToken"),TRUE,TRUE);

      RevertToSelf();

      printf("%s requests %s expense of %u cents\n",ClientName, ExNames[exBuf.dwType], exBuf.dwAmmount);

      //
      // use token to and context to vaidate - note that this sample uses the token
      // if we just had a user's sid we could build an authz context with that.
      //

      if (!AuthorizeAndExecuteExpense( &FundsRM,
                                       hToken,
                                       exBuf,
                                       &dwResult
                                       )) {
         printf("unknown error executing expense\n");
      }

      WriteToPipe(hPipe, (PBYTE)&dwResult, sizeof(DWORD));

      DisconnectNamedPipe(hPipe);
      ZeroMemory(ClientName,cbClientName);
      CloseHandle(hToken);
      hToken = INVALID_HANDLE_VALUE;
      cbClientName = UNLEN + CNLEN + 2;
   }

   return;
}

Variable Documentation

PSID EmployeeSid = (PSID)EmployeeSidBuf

Definition at line 40 of file AuthzSvr.c.

DWORD EmployeeSidBuf[] = {0x00000501, 0x05000000, 0x00000015, 0x17b85159, 0x255d7266, 0x0b3b6364, 0x00010003}

Definition at line 36 of file AuthzSvr.c.

PSID ManagerSid = (PSID)ManagerSidBuf

Definition at line 39 of file AuthzSvr.c.

DWORD ManagerSidBuf[] = {0x00000501, 0x05000000, 0x00000015, 0x17b85159, 0x255d7266, 0x0b3b6364, 0x00010002}

Definition at line 35 of file AuthzSvr.c.

DWORD MaxSpendingEmployee

Definition at line 44 of file AuthzSvr.c.

DWORD MaxSpendingManager

Definition at line 43 of file AuthzSvr.c.

DWORD MaxSpendingVP

Definition at line 42 of file AuthzSvr.c.

PSID VPSid = (PSID)VPSidBuf

Definition at line 38 of file AuthzSvr.c.

DWORD VPSidBuf[] = {0x00000501, 0x05000000, 0x00000015, 0x17b85159, 0x255d7266, 0x0b3b6364, 0x00010001}

Definition at line 34 of file AuthzSvr.c.

Generated on Wed Nov 13 2024 16:54:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/Authorization/authz/common.c File Reference

  • Security
  • Authorization
  • authz
Functions

common.c File Reference

#include <windows.h>
#include <stdio.h>
#include <tchar.h>

Go to the source code of this file.

Functions

BOOL | BuildGenericAccessAcl (PACL *ppAcl, PDWORD cbAclSize)
DWORD | DisplayAPIError (TCHAR *pszAPI, BOOL bConsole, BOOL bMsgBox, BOOL bExit)
void | HandleError (DWORD dwErr, TCHAR *pszAPI, BOOL fAPI, BOOL fExit)
DWORD | ReadFromPipe (HANDLE hPipe, BYTE *pBuffer, DWORD cbBuffer)
BOOL | SetupNamedPipe (PHANDLE phPipe, LPTSTR szPipeName)
BOOL | WriteToPipe (HANDLE hPipe, BYTE *pData, DWORD cbData)

Function Documentation

BOOL BuildGenericAccessAcl | ( | PACL * | ppAcl,
 |  | PDWORD | cbAclSize
 | ) |  |

Definition at line 86 of file common.c.

{
    DWORD dwAclSize;

    SID_IDENTIFIER_AUTHORITY siaWorld = SECURITY_WORLD_SID_AUTHORITY;
    SID_IDENTIFIER_AUTHORITY siaCreator = SECURITY_CREATOR_SID_AUTHORITY;

    PSID pEveryoneSid = NULL;
    PSID pOwnerSid = NULL;
    BOOL bSuccess = FALSE;

    __try {

      //
      // compute size of acl
      //
      dwAclSize = sizeof(ACL) +
        2 * ( sizeof(ACCESS_ALLOWED_ACE) - sizeof(DWORD) ) +
        GetSidLengthRequired( 1 ) + // well-known Everyone Sid
        GetSidLengthRequired( 1 ) ; // well-known Creator Owner Sid

      (*ppAcl) = LocalAlloc(0,dwAclSize);
      if(*ppAcl == NULL) {
         HandleError(GetLastError(), TEXT("LocalAlloc"), TRUE, TRUE);
         __leave;
      }

      *cbAclSize = dwAclSize;

      InitializeAcl(*ppAcl,dwAclSize,ACL_REVISION);

      //
      // build well known sids
      //

      // build EVERYONE SID
      AllocateAndInitializeSid( &siaWorld, 1, SECURITY_WORLD_RID,
                                0,0,0,0,0,0,0,
                                &pEveryoneSid
                                );

      // build Creator/Owner SID
      AllocateAndInitializeSid( &siaCreator, 1, SECURITY_CREATOR_OWNER_RID,
                                0,0,0,0,0,0,0,
                                &pOwnerSid
                                );

      if (!AddAccessAllowedAce( *ppAcl,
                                ACL_REVISION,
                                GENERIC_READ | GENERIC_WRITE | GENERIC_EXECUTE,
                                pEveryoneSid
                                )) {
         HandleError(GetLastError(),TEXT("AddAccessAllowedAce"),TRUE,TRUE);
         __leave;
      }

      if (!AddAccessAllowedAce( *ppAcl,
                                ACL_REVISION,
                                GENERIC_ALL,
                                pOwnerSid
                                )) {
         HandleError(GetLastError(),TEXT("AddAccessAllowedAce (2)"),TRUE,TRUE);
         __leave;
      }

      bSuccess = TRUE;
   }
   __finally {
      if (pEveryoneSid) FreeSid(pEveryoneSid);
      if (pOwnerSid) FreeSid(pOwnerSid);
   }

    return bSuccess;
}

DWORD DisplayAPIError | ( | TCHAR * | pszAPI,
 |  | BOOL | bConsole,
 |  | BOOL | bMsgBox,
 |  | BOOL | bExit
 | ) |  |

Definition at line 26 of file common.c.

{
   LPVOID   lpvMessageBuffer;
   TCHAR    szErrMsgBuffer[500];
   DWORD    nWrote;
   DWORD    dwError;

   dwError = GetLastError();

   FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
                  NULL, dwError,
                  MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
                  (LPTSTR)&lpvMessageBuffer, 0, NULL);

    //... now display this string
    wsprintf(  szErrMsgBuffer,
               TEXT("ERROR: API = %s.\n"
                    "ERROR CODE = %d.\n"
                    "           = %x.\n"
                    "MESSAGE = %s.\n"),
               pszAPI, dwError,dwError,(char*)lpvMessageBuffer);

    if (bConsole)
       WriteConsole( GetStdHandle(STD_OUTPUT_HANDLE),szErrMsgBuffer,
                     lstrlen(szErrMsgBuffer),&nWrote,NULL);
    if (bMsgBox)
       MessageBox(GetDesktopWindow(),szErrMsgBuffer,TEXT("Execution Error"), MB_OK);

    OutputDebugString(szErrMsgBuffer);

    // Free the buffer allocated by the system
    LocalFree(lpvMessageBuffer);

    if (bExit)
      ExitProcess(dwError);

    return dwError;
}

void HandleError | ( | DWORD | dwErr,
 |  | TCHAR * | pszAPI,
 |  | BOOL | fAPI,
 |  | BOOL | fExit
 | ) |  |

Definition at line 67 of file common.c.

{
   if (fAPI) {
      DisplayAPIError(pszAPI,TRUE, TRUE, fExit);
   }
   else
   {
      _tprintf(TEXT("%s"),pszAPI);
      if (dwErr)
         _tprintf(TEXT("%u\n"),dwErr);

      if (fExit)
         ExitProcess(0);
   }

   return;
}

DWORD ReadFromPipe | ( | HANDLE | hPipe,
 |  | BYTE * | pBuffer,
 |  | DWORD | cbBuffer
 | ) |  |

Definition at line 265 of file common.c.

{
   DWORD       dwErr;
   BOOL        bRet   = TRUE;
   INT         nBytesRead = 0;

  bRet = ReadFile(hPipe, pBuffer, cbBuffer, &nBytesRead, NULL);
   if (!bRet)
   {
      dwErr = GetLastError();
      // if ERROR_BROKEN_PIPE or ERROR_NO_DATA then pipe naturally ended
      if ( !( dwErr == ERROR_BROKEN_PIPE || dwErr == ERROR_NO_DATA))
         HandleError(dwErr,TEXT("ReadFile"),TRUE,TRUE);
   }

   return nBytesRead;
}

BOOL SetupNamedPipe | ( | PHANDLE | phPipe,
 |  | LPTSTR | szPipeName
 | ) |  |

Definition at line 194 of file common.c.

{
   PACL     pDacl = NULL;
   DWORD    cbDacl;
   SECURITY_ATTRIBUTES sa = {0};
   SECURITY_DESCRIPTOR sd = {0};
   BOOL bSuccess = FALSE;

   __try
   {
      *phPipe = INVALID_HANDLE_VALUE;

      if (!InitializeSecurityDescriptor(&sd,SECURITY_DESCRIPTOR_REVISION))  {
         HandleError(GetLastError(),TEXT("InitializeSecurityDescriptor"),TRUE,TRUE);
         __leave;
      }

      if (!BuildGenericAccessAcl(&pDacl,&cbDacl)) {
         HandleError(0,TEXT("Error setting up pipe dacl"),FALSE,TRUE);
         __leave;
      }

      if (!SetSecurityDescriptorDacl(&sd,TRUE,pDacl,FALSE)) {
         HandleError(GetLastError(),TEXT("SetSecurityDescriptorDacl"),TRUE,TRUE);
         __leave;
      }

      sa.nLength = sizeof(SECURITY_ATTRIBUTES);
      sa.bInheritHandle = FALSE;
      sa.lpSecurityDescriptor = &sd;

      // setup pipe and wait for a connection
      *phPipe = CreateNamedPipe( szPipeName,
                     FILE_FLAG_OVERLAPPED|PIPE_ACCESS_DUPLEX,
                     PIPE_TYPE_MESSAGE |PIPE_READMODE_MESSAGE|PIPE_WAIT,1,0,0,
                     NMPWAIT_USE_DEFAULT_WAIT,&sa);
      if (*phPipe == INVALID_HANDLE_VALUE) {
         HandleError(GetLastError(),TEXT("CreateNamedPipe"),TRUE,TRUE);
         __leave;
      }

      bSuccess = TRUE;
   }
   __finally {
      // free mem BuildGenericAccessAcl allocated
      if (pDacl) { LocalFree(pDacl);}
   }

   return bSuccess;
}

BOOL WriteToPipe | ( | HANDLE | hPipe,
 |  | BYTE * | pData,
 |  | DWORD | cbData
 | ) |  |

Definition at line 247 of file common.c.

{
   DWORD       dwErr;
   BOOL        bRet        = TRUE;
   INT         nBytesWrote = 0;

   bRet = WriteFile(hPipe,pData,cbData,&nBytesWrote,NULL);
   if (!bRet)
   {
      dwErr = GetLastError();
      // if ERROR_BROKEN_PIPE or ERROR_NO_DATA then pipe naturally ended
      if ( !( dwErr == ERROR_BROKEN_PIPE || dwErr == ERROR_NO_DATA))
         HandleError(dwErr,TEXT("WriteFile"),TRUE,TRUE);
   }

   return bRet;
}

Generated on Wed Nov 13 2024 16:54:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/Authorization/authz/common.h File Reference

  • Security
  • Authorization
  • authz
Classes | Defines | Typedefs | Functions | Variables

common.h File Reference

Go to the source code of this file.

Classes

struct | _ExpenseBuf

Defines

#define | ACCESS_FUND_CORPORATE 0x00000002
#define | ACCESS_FUND_PERSONAL 0x00000001
#define | ACCESS_FUND_TRANSFER 0x00000004
#define | ERROR_INSUFFICIENT_FUNDS 0x20000002
#define | EXPENSE_APPROVED 0
#define | EXPENSE_UNKNOWN_ERROR 0x20000003
#define | PRIVATE_ERROR_BIT 0x20000000

Typedefs

typedef struct _ExpenseBuf | EX_BUF
typedef struct _ExpenseBuf * | PEX_BUF

Functions

DWORD | DisplayAPIError (TCHAR *pszAPI, BOOL bConsole, BOOL bMsgBox, BOOL bExit)
void | HandleError (DWORD dwErr, TCHAR *pszAPI, BOOL fAPI, BOOL fExit)
DWORD | ReadFromPipe (HANDLE hPipe, BYTE *pBuffer, DWORD cbBuffer)
BOOL | SetupNamedPipe (PHANDLE phPipe, LPTSTR szPipeName)
BOOL | WriteToPipe (HANDLE hPipe, BYTE *pData, DWORD cbData)

Variables

LPTSTR | ExNames [5] = { "\0", TEXT("PERSONAL"),TEXT("CORPORATE"),"\0",TEXT("TRANSFER") }

Define Documentation

#define ACCESS_FUND_CORPORATE 0x00000002

Definition at line 30 of file common.h.

#define ACCESS_FUND_PERSONAL 0x00000001

Definition at line 24 of file common.h.

#define ACCESS_FUND_TRANSFER 0x00000004

Definition at line 36 of file common.h.

#define ERROR_INSUFFICIENT_FUNDS 0x20000002

Definition at line 64 of file common.h.

#define EXPENSE_APPROVED 0

Definition at line 48 of file common.h.

#define EXPENSE_UNKNOWN_ERROR 0x20000003

Definition at line 70 of file common.h.

#define PRIVATE_ERROR_BIT 0x20000000

Definition at line 58 of file common.h.

Typedef Documentation

typedef struct _ExpenseBuf EX_BUF
typedef struct _ExpenseBuf* PEX_BUF

Function Documentation

DWORD DisplayAPIError | ( | TCHAR * | pszAPI,
 |  | BOOL | bConsole,
 |  | BOOL | bMsgBox,
 |  | BOOL | bExit
 | ) |  |

Definition at line 26 of file common.c.

{
   LPVOID   lpvMessageBuffer;
   TCHAR    szErrMsgBuffer[500];
   DWORD    nWrote;
   DWORD    dwError;

   dwError = GetLastError();

   FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
                  NULL, dwError,
                  MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
                  (LPTSTR)&lpvMessageBuffer, 0, NULL);

    //... now display this string
    wsprintf(  szErrMsgBuffer,
               TEXT("ERROR: API = %s.\n"
                    "ERROR CODE = %d.\n"
                    "           = %x.\n"
                    "MESSAGE = %s.\n"),
               pszAPI, dwError,dwError,(char*)lpvMessageBuffer);

    if (bConsole)
       WriteConsole( GetStdHandle(STD_OUTPUT_HANDLE),szErrMsgBuffer,
                     lstrlen(szErrMsgBuffer),&nWrote,NULL);
    if (bMsgBox)
       MessageBox(GetDesktopWindow(),szErrMsgBuffer,TEXT("Execution Error"), MB_OK);

    OutputDebugString(szErrMsgBuffer);

    // Free the buffer allocated by the system
    LocalFree(lpvMessageBuffer);

    if (bExit)
      ExitProcess(dwError);

    return dwError;
}

void HandleError | ( | DWORD | dwErr,
 |  | TCHAR * | pszAPI,
 |  | BOOL | fAPI,
 |  | BOOL | fExit
 | ) |  |

Definition at line 67 of file common.c.

{
   if (fAPI) {
      DisplayAPIError(pszAPI,TRUE, TRUE, fExit);
   }
   else
   {
      _tprintf(TEXT("%s"),pszAPI);
      if (dwErr)
         _tprintf(TEXT("%u\n"),dwErr);

      if (fExit)
         ExitProcess(0);
   }

   return;
}

DWORD ReadFromPipe | ( | HANDLE | hPipe,
 |  | BYTE * | pBuffer,
 |  | DWORD | cbBuffer
 | ) |  |

Definition at line 265 of file common.c.

{
   DWORD       dwErr;
   BOOL        bRet   = TRUE;
   INT         nBytesRead = 0;

  bRet = ReadFile(hPipe, pBuffer, cbBuffer, &nBytesRead, NULL);
   if (!bRet)
   {
      dwErr = GetLastError();
      // if ERROR_BROKEN_PIPE or ERROR_NO_DATA then pipe naturally ended
      if ( !( dwErr == ERROR_BROKEN_PIPE || dwErr == ERROR_NO_DATA))
         HandleError(dwErr,TEXT("ReadFile"),TRUE,TRUE);
   }

   return nBytesRead;
}

BOOL SetupNamedPipe | ( | PHANDLE | phPipe,
 |  | LPTSTR | szPipeName
 | ) |  |

Definition at line 194 of file common.c.

{
   PACL     pDacl = NULL;
   DWORD    cbDacl;
   SECURITY_ATTRIBUTES sa = {0};
   SECURITY_DESCRIPTOR sd = {0};
   BOOL bSuccess = FALSE;

   __try
   {
      *phPipe = INVALID_HANDLE_VALUE;

      if (!InitializeSecurityDescriptor(&sd,SECURITY_DESCRIPTOR_REVISION))  {
         HandleError(GetLastError(),TEXT("InitializeSecurityDescriptor"),TRUE,TRUE);
         __leave;
      }

      if (!BuildGenericAccessAcl(&pDacl,&cbDacl)) {
         HandleError(0,TEXT("Error setting up pipe dacl"),FALSE,TRUE);
         __leave;
      }

      if (!SetSecurityDescriptorDacl(&sd,TRUE,pDacl,FALSE)) {
         HandleError(GetLastError(),TEXT("SetSecurityDescriptorDacl"),TRUE,TRUE);
         __leave;
      }

      sa.nLength = sizeof(SECURITY_ATTRIBUTES);
      sa.bInheritHandle = FALSE;
      sa.lpSecurityDescriptor = &sd;

      // setup pipe and wait for a connection
      *phPipe = CreateNamedPipe( szPipeName,
                     FILE_FLAG_OVERLAPPED|PIPE_ACCESS_DUPLEX,
                     PIPE_TYPE_MESSAGE |PIPE_READMODE_MESSAGE|PIPE_WAIT,1,0,0,
                     NMPWAIT_USE_DEFAULT_WAIT,&sa);
      if (*phPipe == INVALID_HANDLE_VALUE) {
         HandleError(GetLastError(),TEXT("CreateNamedPipe"),TRUE,TRUE);
         __leave;
      }

      bSuccess = TRUE;
   }
   __finally {
      // free mem BuildGenericAccessAcl allocated
      if (pDacl) { LocalFree(pDacl);}
   }

   return bSuccess;
}

BOOL WriteToPipe | ( | HANDLE | hPipe,
 |  | BYTE * | pData,
 |  | DWORD | cbData
 | ) |  |

Definition at line 247 of file common.c.

{
   DWORD       dwErr;
   BOOL        bRet        = TRUE;
   INT         nBytesWrote = 0;

   bRet = WriteFile(hPipe,pData,cbData,&nBytesWrote,NULL);
   if (!bRet)
   {
      dwErr = GetLastError();
      // if ERROR_BROKEN_PIPE or ERROR_NO_DATA then pipe naturally ended
      if ( !( dwErr == ERROR_BROKEN_PIPE || dwErr == ERROR_NO_DATA))
         HandleError(dwErr,TEXT("WriteFile"),TRUE,TRUE);
   }

   return bRet;
}

Variable Documentation

LPTSTR ExNames[5] = { "\0", TEXT("PERSONAL"),TEXT("CORPORATE"),"\0",TEXT("TRANSFER") }

Definition at line 84 of file common.h.

Generated on Wed Nov 13 2024 16:53:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/Authorization/Check_SD/Check_SD.c File Reference

  • Security
  • Authorization
  • Check_SD
Functions

Check_SD.c File Reference

#include "check_sd.h"
#include <tchar.h>
#include <stdio.h>

Go to the source code of this file.

Functions

void | _tmain (int argc, TCHAR *argv[])
void | DisplayUsage (void)

Function Documentation

void _tmain | ( | int | argc,
 |  | TCHAR * | argv[]
 | ) |  |

Definition at line 47 of file Check_SD.c.

{
     int u = 0;

     //
     // display usage
     //
     if (argc != 3){
          DisplayUsage();
          return;
     }

   //
   // Do validation on the user input to help avoid buffer overruns.
   //

   _try{
      //
    // argv[1] should be a null terminated string
      // of exactly two characters in length (not including the NULL).
    //
    if ((_T('-') != argv[1][0]) || (_T('\0') == argv[1][1]) || (_T('\0') != argv[1][2])){
       DisplayUsage();
       return;
    }

    //
    // argv[2] should have at least one non-NULL character before a NULL character.
    //
    if (_T('\0') == argv[2][0]){
           DisplayUsage();
       return;
      }

    //
    // argv[2] should not be a string of more than MAX_PATH characters.
    //
    u = 0;
    while (_T('\0') != argv[2][u]){
       if (MAX_PATH == u){
            DisplayUsage();
            return;
       }
       u++;
    }

   }
   _except(EXCEPTION_EXECUTE_HANDLER){
          DisplayUsage();
          return;
   }

     _tprintf(TEXT(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"));
     _tprintf(TEXT(">>                 SECURITY INFORMATION                >>\n"));
     _tprintf(TEXT(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n\n"));
     _tprintf(TEXT("object name ........ %s\n"), argv[2]);
     _tprintf(TEXT("object type ........ "));

     switch (argv[1][1])
     {
          case 'a':
               _tprintf(TEXT("mailslot\n"));
               DumpKernelObject(argv[2], argv[1][1]);
               break;
          case 'e':
               _tprintf(TEXT("event\n"));
               DumpKernelObject(argv[2], argv[1][1]);
               break;
          case 'f':
               _tprintf(TEXT("file\n"));
               DumpFile(argv[2], argv[1][1]);
               break;
          case 'd':
               _tprintf(TEXT("directory\n"));
               DumpFile(argv[2], argv[1][1]);
               break;
          case 'm':
               _tprintf(TEXT("mutex\n"));
               DumpKernelObject(argv[2], argv[1][1]);
               break;
          case 'r':
               _tprintf(TEXT("registry\n"));
               DumpRegistryKey(argv[2]);
               break;
          case 's':
               _tprintf(TEXT("semaphore\n"));
               DumpKernelObject(argv[2], argv[1][1]);
               break;
          case 'p':
               _tprintf(TEXT("process\n"));
               DumpKernelObject(argv[2], argv[1][1]);
               break;
          case 'i':
               _tprintf(TEXT("memory mapped file\n"));
               DumpKernelObject(argv[2], argv[1][1]);
               break;
          case 'v':
               _tprintf(TEXT("service\n"));
               DumpService(NULL, argv[2]);
               break;
          case 'w':
               _tprintf(TEXT("window station\n"));
               DumpUserObject(argv[2], argv[1][1]);
               break;
          case 'k':
               _tprintf(TEXT("desktop\n"));
               DumpUserObject(argv[2], argv[1][1]);
               break;
          case 'n':
               _tprintf(TEXT("named pipe\n"));
               DumpKernelObject(argv[2], argv[1][1]);
               break;
          case 'o':
               _tprintf(TEXT("process access token\n"));
               DumpKernelObject(argv[2], argv[1][1]);
               break;
          case 'l':
               _tprintf(TEXT("printer\n"));
               DumpPrinter(argv[2]);
               break;
          case 't':
               _tprintf(TEXT("network share\n"));
               DumpNetShare(argv[2]);
               break;
          default:
               DisplayUsage();
     }
}

void DisplayUsage ( void )

Definition at line 25 of file Check_SD.c.

{
     _tprintf(TEXT("\nUsage: check_sd [object] [name]\n"));
         _tprintf(TEXT(" -a : mailslot, use \\\\[server]\\mailslot\\[mailslotname]\n"));
     _tprintf(TEXT(" -d : directory or driver letter, use \\\\.\\[driveletter]\n"));
     _tprintf(TEXT(" -e : event\n"));
     _tprintf(TEXT(" -f : file\n"));
     _tprintf(TEXT(" -i : memory mapped file\n"));
     _tprintf(TEXT(" -k : desktop, use [window station\\desktop]\n"));
     _tprintf(TEXT(" -l : printer, use \\\\[server]\\[printername]\n"));
     _tprintf(TEXT(" -m : mutex\n"));
     _tprintf(TEXT(" -n : named pipe, use \\\\[server or .]\\pipe\\[pipename]\n"));
     _tprintf(TEXT(" -o : process access token, use pid instead of name\n"));
     _tprintf(TEXT(" -p : process, use pid instead of name\n"));
     _tprintf(TEXT(" -r : registry key\n"));
     _tprintf(TEXT(" -s : sempahore\n"));
     _tprintf(TEXT(" -t : network share, use [server\\sharename]\n"));
     _tprintf(TEXT(" -v : service\n"));
     _tprintf(TEXT(" -w : window station\n"));
     return;
}

Generated on Wed Nov 13 2024 16:54:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/Authorization/Check_SD/Check_SD.h File Reference

  • Security
  • Authorization
  • Check_SD
Defines | Functions

Check_SD.h File Reference

#include <windows.h>

Go to the source code of this file.

Defines

#define | CHANGE 0x000000A9
#define | READ 0x000001BF
#define | STRICT
#define | UNKNOWNSIDS 4
#define | WRITE 0x00000040

Functions

BOOL | ConvertSid (PSID pSid, LPTSTR pszSidText, LPDWORD dwBufferLen)
void | DisplayError (DWORD dwError, LPTSTR pszAPI)
DWORD | DumpAclInfo (PACL pacl, BOOL bDacl)
void | DumpControl (PSECURITY_DESCRIPTOR psd)
void | DumpDacl (PSECURITY_DESCRIPTOR psd, TCHAR c, BOOL bDacl)
void | DumpFile (LPTSTR pszFile, TCHAR c)
void | DumpKernelObject (LPTSTR pszObject, TCHAR c)
void | DumpNetShare (LPTSTR pszShare)
void | DumpOwnerGroup (PSECURITY_DESCRIPTOR psd, BOOL bOwner)
void | DumpPrinter (LPTSTR pszPrinter)
void | DumpRegistryKey (LPTSTR pszKey)
void | DumpSD (PSECURITY_DESCRIPTOR psd, TCHAR c)
void | DumpSDInfo (PSECURITY_DESCRIPTOR psd)
void | DumpService (LPTSTR pszServer, LPTSTR pszService)
void | DumpUserObject (LPTSTR pszObject, TCHAR c)
void | LookupAccountOtherSid (PSID psidCheck, LPTSTR pszName, LPDWORD pcbName, LPTSTR pszDomain, LPDWORD pcbDomain, PSID_NAME_USE psnu)
BOOL | Privilege (LPTSTR pszPrivilege, BOOL bEnable)

Define Documentation

#define CHANGE 0x000000A9

Definition at line 38 of file Check_SD.h.

#define READ 0x000001BF

Definition at line 37 of file Check_SD.h.

#define STRICT

Definition at line 23 of file Check_SD.h.

#define UNKNOWNSIDS 4

Definition at line 44 of file Check_SD.h.

#define WRITE 0x00000040

Definition at line 39 of file Check_SD.h.

Function Documentation

BOOL ConvertSid | ( | PSID | pSid,
 |  | LPTSTR | pszSidText,
 |  | LPDWORD | dwBufferLen
 | ) |  |

Definition at line 50 of file Helper.c.

{
     DWORD                     dwSubAuthorities;
     DWORD                     dwSidRev = SID_REVISION;
     DWORD                     dwCounter;
     DWORD                     dwSidSize;
     PSID_IDENTIFIER_AUTHORITY psia;

     //
     // test if Sid passed in is valid
     //
     if(!IsValidSid(pSid))
          return FALSE;

     //
     // obtain SidIdentifierAuthority
     //
     psia = GetSidIdentifierAuthority(pSid);

     //
     // obtain sidsubauthority count
     //
     dwSubAuthorities =* GetSidSubAuthorityCount(pSid);

     //
     // compute buffer length
     // S-SID_REVISION- + identifierauthority- + subauthorities- + NULL
     //
     dwSidSize = (15 + 12 + (12 * dwSubAuthorities) + 1) * sizeof(TCHAR);

     //
     // check provided buffer length.
     // If not large enough, indicate proper size and setlasterror
     //
     if (*dwBufferLen < dwSidSize){
          *dwBufferLen = dwSidSize;
          SetLastError(ERROR_INSUFFICIENT_BUFFER);
          return FALSE;
         }

     //
     // prepare S-SID_REVISION-
     //
     dwSidSize=wsprintf(pszSidText, TEXT("S-%lu-"), dwSidRev );

     //
     // prepare SidIdentifierAuthority
     //
     if ( (psia->Value[0] != 0) || (psia->Value[1] != 0) ){
          dwSidSize += wsprintf(pszSidText + lstrlen(pszSidText),
          TEXT("0x%02hx%02hx%02hx%02hx%02hx%02hx"),
          (USHORT)psia->Value[0],
          (USHORT)psia->Value[1],
          (USHORT)psia->Value[2],
          (USHORT)psia->Value[3],
          (USHORT)psia->Value[4],
          (USHORT)psia->Value[5]);
         }
     else{
          dwSidSize += wsprintf(pszSidText + lstrlen(pszSidText),
                               TEXT("%lu"),
                               (ULONG)(psia->Value[5]      )   +
                               (ULONG)(psia->Value[4] <<  8)   +
                               (ULONG)(psia->Value[3] << 16)   +
                               (ULONG)(psia->Value[2] << 24)   );
         }

     //
     // loop through SidSubAuthorities
     //
     for (dwCounter=0 ; dwCounter < dwSubAuthorities ; dwCounter++){
          dwSidSize+=wsprintf(pszSidText + dwSidSize, TEXT("-%lu"),
               *GetSidSubAuthority(pSid, dwCounter));
         }

     return TRUE;
}

void DisplayError | ( | DWORD | dwError,
 |  | LPTSTR | pszAPI
 | ) |  |

Definition at line 128 of file Helper.c.

{
     LPVOID lpvMessageBuffer;

     if (!FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
                   NULL, dwError,
                   MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), //The user default language
                   (LPTSTR)&lpvMessageBuffer, 0, NULL))
   {
        printf ("FormatMessage failed: 0x%x\n", GetLastError());
      return;
   }

     //
     //... now display this string
     //
     _tprintf(TEXT("ERROR: API        = %s.\n"), pszAPI);
     _tprintf(TEXT("       error code = %d.\n"), dwError);
     _tprintf(TEXT("       message    = %s\n"), (LPTSTR)lpvMessageBuffer);

     //
     // Free the buffer allocated by the system
     //
     if (LocalFree(lpvMessageBuffer))
     printf ("LocalFree failed: 0x%x\n", GetLastError());

     ExitProcess(0);
}

DWORD DumpAclInfo | ( | PACL | pacl,
 |  | BOOL | bDacl
 | ) |  |

Definition at line 43 of file SD.c.

{
     ACL_INFORMATION_CLASS    aic;
     BYTE                     pByte[2][12];

     //
     // is the acl valid
     //
     _tprintf(TEXT("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"));
     if (bDacl)
          _tprintf(TEXT(">>                 DACL INFORMATION                    >>\n"));
     else
          _tprintf(TEXT(">>                 SACL INFORMATION                    >>\n"));

     _tprintf(TEXT(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n\n"));
     _tprintf(TEXT("valid .............. "));

     if (!IsValidAcl(pacl)){
          _tprintf(TEXT("no\n"));
          return 0;
     }
     else
          _tprintf(TEXT("yes\n"));

     for (aic=1; aic<3; aic++){
          if (!GetAclInformation(pacl, (LPVOID)pByte[aic-1], sizeof(ACL_SIZE_INFORMATION), aic))
               DisplayError(GetLastError(), TEXT("GetAclInformation"));
     }

     _tprintf(TEXT("revision ........... %u\n\n"), *((PACL_REVISION_INFORMATION)pByte[0]));
     _tprintf(TEXT("ace count .......... %u\n"), ((PACL_SIZE_INFORMATION)pByte[1])->AceCount);
     _tprintf(TEXT("acl bytes in use ... %u byte(s)\n"), ((PACL_SIZE_INFORMATION)pByte[1])->AclBytesInUse);
     _tprintf(TEXT("acl bytes free ..... %u byte(s)\n"), ((PACL_SIZE_INFORMATION)pByte[1])->AclBytesFree);

     return ((PACL_SIZE_INFORMATION)pByte[1])->AceCount;
}

void DumpControl ( PSECURITY_DESCRIPTOR psd )

Definition at line 80 of file SD.c.

{
     DWORD                       dwRevision;
     SECURITY_DESCRIPTOR_CONTROL sdc;

     if (!GetSecurityDescriptorControl(psd, &sdc, &dwRevision))
          DisplayError(GetLastError(), TEXT("GetSecurityDescriptorControl"));

     _tprintf(TEXT("revision ........... %u\n"), dwRevision);
     _tprintf(TEXT("control bits ....... 0x%X\n"), sdc);

     if ((sdc & SE_DACL_DEFAULTED) == SE_DACL_DEFAULTED)
          _tprintf(TEXT(".................... SE_DACL_DEFAULTED\n"));
     if ((sdc & SE_DACL_PRESENT) == SE_DACL_PRESENT)
          _tprintf(TEXT(".................... SE_DACL_PRESENT\n"));
     if ((sdc & SE_GROUP_DEFAULTED) == SE_GROUP_DEFAULTED)
          _tprintf(TEXT(".................... SE_GROUP_DEFAULTED\n"));
     if ((sdc & SE_OWNER_DEFAULTED) == SE_OWNER_DEFAULTED)
          _tprintf(TEXT(".................... SE_OWNER_DEFAULTED\n"));
     if ((sdc & SE_SACL_DEFAULTED) == SE_SACL_DEFAULTED)
          _tprintf(TEXT(".................... SE_SACL_DEFAULTED\n"));
     if ((sdc & SE_SACL_PRESENT) == SE_SACL_PRESENT)
          _tprintf(TEXT(".................... SE_SACL_PRESENT\n"));
     if ((sdc & SE_SELF_RELATIVE) == SE_SELF_RELATIVE)
          _tprintf(TEXT(".................... SE_SELF_RELATIVE\n"));
     if ((sdc & SE_DACL_AUTO_INHERITED) == SE_DACL_AUTO_INHERITED) // NT5.0
          _tprintf(TEXT(".................... SE_DACL_AUTO_INHERITED\n"));
     if ((sdc & SE_SACL_AUTO_INHERITED) == SE_SACL_AUTO_INHERITED) // NT5.0
          _tprintf(TEXT(".................... SE_SACL_AUTO_INHERITED\n"));
     if ((sdc & SE_SACL_PROTECTED) == SE_SACL_PROTECTED) // NT5.0
          _tprintf(TEXT(".................... SE_SACL_PROTECTED\n"));
     if ((sdc & SE_DACL_PROTECTED) == SE_DACL_PROTECTED) // NT5.0
          _tprintf(TEXT(".................... SE_DACL_PROTECTED\n"));
}

void DumpDacl | ( | PSECURITY_DESCRIPTOR | psd,
 |  | TCHAR | c,
 |  | BOOL | bDacl
 | ) |  |

Definition at line 115 of file SD.c.

{
     ACCESS_ALLOWED_ACE *pace;
     BOOL                bDaclPresent;
     BOOL                bDaclDefaulted;
     DWORD               dwAceCount;
     DWORD               cbName;
     DWORD               cbReferencedDomainName;
     DWORD               dwSize;
     int                 i;
     PACL                pacl;
     PSID                psid = NULL;
     SID_NAME_USE        snu;
     TCHAR               szName[UNLEN];
     TCHAR               szReferencedDomainName[DNLEN];
     TCHAR               szSidText[256];
     TCHAR               szSidType[][17] = {TEXT("User"), TEXT("Group"), TEXT("Domain"), TEXT("Alias"), TEXT("Well Known Group"), TEXT("Deleted Account"), TEXT("Invalid"), TEXT("Unknown")};

     if (bDacl){
          if (!GetSecurityDescriptorDacl(psd, &bDaclPresent, &pacl, &bDaclDefaulted))
               DisplayError(GetLastError(), TEXT("GetSecurityDescriptorDacTEXT("));
     }
     else{
          if (!GetSecurityDescriptorSacl(psd, &bDaclPresent, &pacl, &bDaclDefaulted))
               DisplayError(GetLastError(), TEXT("GetSecurityDescriptorSacTEXT("));
     }

     if (bDaclPresent){
          //
          // dump the dacl
          //
          if (pacl == NULL){
               if (bDacl)
                    _tprintf(TEXT("\ndacl ............... NULL\n"));
               else
                    _tprintf(TEXT("\nsacl ............... NULL\n"));
          }
          else{
               dwAceCount = DumpAclInfo(pacl, bDacl);

               for (i = 0; i < (int)dwAceCount; i++){
                    if (!GetAce(pacl, i, (LPVOID)&pace))
                         DisplayError(GetLastError(), TEXT("GetAce"));

                    _tprintf(TEXT("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"));
                    _tprintf(TEXT(">>                  ACE #%u                             >>\n"), i+1);
                    _tprintf(TEXT(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n\n"));
                    _tprintf(TEXT("type ............... "));

                    switch(pace->Header.AceType){
                         case ACCESS_ALLOWED_ACE_TYPE:
                              _tprintf(TEXT("ACCESS_ALLOWED_ACE\n"));
                              break;
                         case ACCESS_DENIED_ACE_TYPE:
                              _tprintf(TEXT("ACCESS_DENIED_ACE\n"));
                              break;
                         case SYSTEM_AUDIT_ACE_TYPE:
                              _tprintf(TEXT("SYSTEM_AUDIT_ACE\n"));
                              break;
                         case ACCESS_ALLOWED_OBJECT_ACE_TYPE: // NT5.0
                              _tprintf(TEXT("ACCESS_ALLOWED_OBJECT_ACE_TYPE\n"));
                              break;
                         case ACCESS_DENIED_OBJECT_ACE_TYPE: // NT5.0
                              _tprintf(TEXT("ACCESS_DENIED_OBJECT_ACE_TYPE\n"));
                              break;
                         case SYSTEM_AUDIT_OBJECT_ACE_TYPE: // NT5.0
                              _tprintf(TEXT("SYSTEM_AUDIT_OBJECT_ACE_TYPE\n"));
                              break;
                    }

                    _tprintf(TEXT("flags .............. 0x%X\n"), pace->Header.AceFlags);

                    if ((pace->Header.AceFlags & CONTAINER_INHERIT_ACE) == CONTAINER_INHERIT_ACE)
                         _tprintf(TEXT(".................... CONTAINER_INHERIT_ACE\n"));

                    if ((pace->Header.AceFlags & INHERIT_ONLY_ACE) == INHERIT_ONLY_ACE)
                         _tprintf(TEXT(".................... INHERIT_ONLY_ACE\n"));

                    if ((pace->Header.AceFlags & NO_PROPAGATE_INHERIT_ACE) == NO_PROPAGATE_INHERIT_ACE)
                         _tprintf(TEXT(".................... NO_PROPAGATE_INHERIT_ACE\n"));

                    if ((pace->Header.AceFlags & OBJECT_INHERIT_ACE) == OBJECT_INHERIT_ACE)
                         _tprintf(TEXT(".................... OBJECT_INHERIT_ACE\n"));

                    if ((pace->Header.AceFlags & FAILED_ACCESS_ACE_FLAG) == FAILED_ACCESS_ACE_FLAG)
                         _tprintf(TEXT(".................... FAILED_ACCESS_ACE_FLAG\n"));

                    if ((pace->Header.AceFlags & SUCCESSFUL_ACCESS_ACE_FLAG) == SUCCESSFUL_ACCESS_ACE_FLAG)
                         _tprintf(TEXT(".................... SUCCESSFUL_ACCESS_ACE_FLAG\n"));

                    if ((pace->Header.AceFlags & INHERITED_ACE) == INHERITED_ACE) // NT5.0
                         _tprintf(TEXT(".................... INHERITED_ACE\n"));

                    _tprintf(TEXT("size ............... %u byte(s)\n"), pace->Header.AceSize);
                    _tprintf(TEXT("mask ............... 0x%X\n"), pace->Mask);

                    switch (c){
                         case 'r':
                              //
                              // registry SPECIFIC access rights
                              //
                              if ((pace->Mask & KEY_CREATE_LINK) == KEY_CREATE_LINK)
                                   _tprintf(TEXT(".................... KEY_CREATE_LINK\n"));
                              if ((pace->Mask & KEY_CREATE_SUB_KEY) == KEY_CREATE_SUB_KEY)
                                   _tprintf(TEXT(".................... KEY_CREATE_SUB_KEY\n"));
                              if ((pace->Mask & KEY_ENUMERATE_SUB_KEYS) == KEY_ENUMERATE_SUB_KEYS)
                                   _tprintf(TEXT(".................... KEY_ENUMERATE_SUB_KEYS\n"));
                              if ((pace->Mask & KEY_EXECUTE) == KEY_EXECUTE)
                                   _tprintf(TEXT(".................... KEY_EXECUTE\n"));
                              if ((pace->Mask & KEY_NOTIFY) == KEY_NOTIFY)
                                   _tprintf(TEXT(".................... KEY_NOTIFY\n"));
                              if ((pace->Mask & KEY_QUERY_VALUE) == KEY_QUERY_VALUE)
                                   _tprintf(TEXT(".................... KEY_QUERY_VALUE\n"));
                              if ((pace->Mask & KEY_READ) == KEY_READ)
                                   _tprintf(TEXT(".................... KEY_READ\n"));
                              if ((pace->Mask & KEY_SET_VALUE) == KEY_SET_VALUE)
                                   _tprintf(TEXT(".................... KEY_SET_VALUE\n"));
                              if ((pace->Mask & KEY_WRITE) == KEY_WRITE)
                                   _tprintf(TEXT(".................... KEY_WRITE\n"));
                              break;
                         case 'f':
                              if ((pace->Mask & FILE_READ_DATA) == FILE_READ_DATA)
                                   _tprintf(TEXT(".................... FILE_READ_DATA\n"));
                              if ((pace->Mask & FILE_WRITE_DATA) == FILE_WRITE_DATA)
                                   _tprintf(TEXT(".................... FILE_WRITE_DATA\n"));
                              if ((pace->Mask & FILE_APPEND_DATA) == FILE_APPEND_DATA)
                                   _tprintf(TEXT(".................... FILE_APPEND_DATA\n"));
                              if ((pace->Mask & FILE_READ_EA) == FILE_READ_EA)
                                   _tprintf(TEXT(".................... FILE_READ_EA\n"));
                              if ((pace->Mask & FILE_WRITE_EA) == FILE_WRITE_EA)
                                   _tprintf(TEXT(".................... FILE_WRITE_EA\n"));
                              if ((pace->Mask & FILE_EXECUTE) == FILE_EXECUTE)
                                   _tprintf(TEXT(".................... FILE_EXECUTE\n"));
                              if ((pace->Mask & FILE_READ_ATTRIBUTES) == FILE_READ_ATTRIBUTES)
                                   _tprintf(TEXT(".................... FILE_READ_ATTRIBUTES\n"));
                              if ((pace->Mask & FILE_WRITE_ATTRIBUTES) == FILE_WRITE_ATTRIBUTES)
                                   _tprintf(TEXT(".................... FILE_WRITE_ATTRIBUTES\n"));
                              break;
                         case 'd':
                              if ((pace->Mask & FILE_LIST_DIRECTORY) == FILE_LIST_DIRECTORY)
                                   _tprintf(TEXT(".................... FILE_LIST_DIRECTORY\n"));
                              if ((pace->Mask & FILE_ADD_FILE) == FILE_ADD_FILE)
                                   _tprintf(TEXT(".................... FILE_ADD_FILE\n"));
                              if ((pace->Mask & FILE_ADD_SUBDIRECTORY) == FILE_ADD_SUBDIRECTORY)
                                   _tprintf(TEXT(".................... FILE_ADD_SUBDIRECTORY\n"));
                              if ((pace->Mask & FILE_READ_EA) == FILE_READ_EA)
                                   _tprintf(TEXT(".................... FILE_READ_EA\n"));
                              if ((pace->Mask & FILE_WRITE_EA) == FILE_WRITE_EA)
                                   _tprintf(TEXT(".................... FILE_WRITE_EA\n"));
                              if ((pace->Mask & FILE_TRAVERSE) == FILE_TRAVERSE)
                                   _tprintf(TEXT(".................... FILE_TRAVERSE\n"));
                              if ((pace->Mask & FILE_DELETE_CHILD) == FILE_DELETE_CHILD)
                                   _tprintf(TEXT(".................... FILE_DELETE_CHILD\n"));
                              if ((pace->Mask & FILE_READ_ATTRIBUTES) == FILE_READ_ATTRIBUTES)
                                   _tprintf(TEXT(".................... FILE_READ_ATTRIBUTES\n"));
                              if ((pace->Mask & FILE_WRITE_ATTRIBUTES) == FILE_WRITE_ATTRIBUTES)
                                   _tprintf(TEXT(".................... FILE_WRITE_ATTRIBUTES\n"));
                              break;
                         case 'e':
                              if ((pace->Mask & EVENT_MODIFY_STATE) == EVENT_MODIFY_STATE)
                                   _tprintf(TEXT(".................... EVENT_MODIFY_STATE\n"));
                              break;
                         case 'm':
                              if ((pace->Mask & MUTANT_QUERY_STATE) == MUTANT_QUERY_STATE)
                                   _tprintf(TEXT(".................... MUTANT_QUERY_STATE\n"));
                              break;
                         case 's':
                              if ((pace->Mask & SEMAPHORE_MODIFY_STATE) == SEMAPHORE_MODIFY_STATE)
                                   _tprintf(TEXT(".................... SEMAPHORE_MODIFY_STATE\n"));
                              break;
                         case 'p':
                              if ((pace->Mask & PROCESS_TERMINATE) == PROCESS_TERMINATE)
                                   _tprintf(TEXT(".................... PROCESS_TERMINATE\n"));
                              if ((pace->Mask & PROCESS_CREATE_THREAD) == PROCESS_CREATE_THREAD)
                                   _tprintf(TEXT(".................... PROCESS_CREATE_THREAD\n"));
                              if ((pace->Mask & PROCESS_VM_OPERATION) == PROCESS_VM_OPERATION)
                                   _tprintf(TEXT(".................... PROCESS_VM_OPERATION\n"));
                              if ((pace->Mask & PROCESS_VM_READ) == PROCESS_VM_READ)
                                   _tprintf(TEXT(".................... PROCESS_VM_READ\n"));
                              if ((pace->Mask & PROCESS_VM_WRITE) == PROCESS_VM_WRITE)
                                   _tprintf(TEXT(".................... PROCESS_VM_WRITE\n"));
                              if ((pace->Mask & PROCESS_DUP_HANDLE) == PROCESS_DUP_HANDLE)
                                   _tprintf(TEXT(".................... PROCESS_DUP_HANDLE\n"));
                              if ((pace->Mask & PROCESS_CREATE_PROCESS) == PROCESS_CREATE_PROCESS)
                                   _tprintf(TEXT(".................... PROCESS_CREATE_PROCESS\n"));
                              if ((pace->Mask & PROCESS_SET_QUOTA) == PROCESS_SET_QUOTA)
                                   _tprintf(TEXT(".................... PROCESS_SET_QUOTA\n"));
                              if ((pace->Mask & PROCESS_SET_INFORMATION) == PROCESS_SET_INFORMATION)
                                   _tprintf(TEXT(".................... PROCESS_SET_INFORMATION\n"));
                              if ((pace->Mask & PROCESS_QUERY_INFORMATION) == PROCESS_QUERY_INFORMATION)
                                   _tprintf(TEXT(".................... PROCESS_QUERY_INFORMATION\n"));
                              break;
                         case 'i':
                              if ((pace->Mask & SECTION_QUERY) == SECTION_QUERY)
                                   _tprintf(TEXT(".................... SECTION_QUERY\n"));
                              if ((pace->Mask & SECTION_MAP_WRITE) == SECTION_MAP_WRITE)
                                   _tprintf(TEXT(".................... SECTION_MAP_WRITE\n"));
                              if ((pace->Mask & SECTION_MAP_READ) == SECTION_MAP_READ)
                                   _tprintf(TEXT(".................... SECTION_MAP_READ\n"));
                              if ((pace->Mask & SECTION_MAP_EXECUTE) == SECTION_MAP_EXECUTE)
                                   _tprintf(TEXT(".................... SECTION_MAP_EXECUTE\n"));
                              if ((pace->Mask & SECTION_EXTEND_SIZE) == SECTION_EXTEND_SIZE)
                                   _tprintf(TEXT(".................... SECTION_EXTEND_SIZE\n"));
                              break;
                         case 'v':
                              if ((pace->Mask & SERVICE_CHANGE_CONFIG) == SERVICE_CHANGE_CONFIG)
                                   _tprintf(TEXT(".................... SERVICE_CHANGE_CONFIG\n"));
                              if ((pace->Mask & SERVICE_ENUMERATE_DEPENDENTS) == SERVICE_ENUMERATE_DEPENDENTS)
                                   _tprintf(TEXT(".................... SERVICE_ENUMERATE_DEPENDENTS\n"));
                              if ((pace->Mask & SERVICE_INTERROGATE) == SERVICE_INTERROGATE)
                                   _tprintf(TEXT(".................... SERVICE_INTERROGATE\n"));
                              if ((pace->Mask & SERVICE_PAUSE_CONTINUE) == SERVICE_PAUSE_CONTINUE)
                                   _tprintf(TEXT(".................... SERVICE_PAUSE_CONTINUE\n"));
                              if ((pace->Mask & SERVICE_QUERY_CONFIG) == SERVICE_QUERY_CONFIG)
                                   _tprintf(TEXT(".................... SERVICE_QUERY_CONFIG\n"));
                              if ((pace->Mask & SERVICE_QUERY_STATUS) == SERVICE_QUERY_STATUS)
                                   _tprintf(TEXT(".................... SERVICE_QUERY_STATUS\n"));
                              if ((pace->Mask & SERVICE_START) == SERVICE_START)
                                   _tprintf(TEXT(".................... SERVICE_START\n"));
                              if ((pace->Mask & SERVICE_STOP) == SERVICE_STOP)
                                   _tprintf(TEXT(".................... SERVICE_STOP\n"));
                              if ((pace->Mask & SERVICE_USER_DEFINED_CONTROL) == SERVICE_USER_DEFINED_CONTROL)
                                   _tprintf(TEXT(".................... SERVICE_USER_DEFINED_CONTROL\n"));
                              break;
                         case 'w':
                              if ((pace->Mask & WINSTA_ACCESSCLIPBOARD) == WINSTA_ACCESSCLIPBOARD)
                                   _tprintf(TEXT(".................... WINSTA_ACCESSCLIPBOARD\n"));
                              if ((pace->Mask & WINSTA_ACCESSGLOBALATOMS) == WINSTA_ACCESSGLOBALATOMS)
                                   _tprintf(TEXT(".................... WINSTA_ACCESSGLOBALATOMS\n"));
                              if ((pace->Mask & WINSTA_CREATEDESKTOP) == WINSTA_CREATEDESKTOP)
                                   _tprintf(TEXT(".................... WINSTA_CREATEDESKTOP\n"));
                              if ((pace->Mask & WINSTA_ENUMDESKTOPS) == WINSTA_ENUMDESKTOPS)
                                   _tprintf(TEXT(".................... WINSTA_ENUMDESKTOPS\n"));
                              if ((pace->Mask & WINSTA_ENUMERATE) == WINSTA_ENUMERATE)
                                   _tprintf(TEXT(".................... WINSTA_ENUMERATE\n"));
                              if ((pace->Mask & WINSTA_EXITWINDOWS) == WINSTA_EXITWINDOWS)
                                   _tprintf(TEXT(".................... WINSTA_EXITWINDOWS\n"));
                              if ((pace->Mask & WINSTA_READATTRIBUTES) == WINSTA_READATTRIBUTES)
                                   _tprintf(TEXT(".................... WINSTA_READATTRIBUTES\n"));
                              if ((pace->Mask & WINSTA_READSCREEN) == WINSTA_READSCREEN)
                                   _tprintf(TEXT(".................... WINSTA_READSCREEN\n"));
                              if ((pace->Mask & WINSTA_WRITEATTRIBUTES) == WINSTA_WRITEATTRIBUTES)
                                   _tprintf(TEXT(".................... WINSTA_WRITEATTRIBUTES\n"));
                              break;
                         case 'k':
                              if ((pace->Mask & DESKTOP_CREATEMENU) == DESKTOP_CREATEMENU)
                                   _tprintf(TEXT(".................... DESKTOP_CREATEMENU\n"));
                              if ((pace->Mask & DESKTOP_CREATEWINDOW) == DESKTOP_CREATEWINDOW)
                                   _tprintf(TEXT(".................... DESKTOP_CREATEWINDOW\n"));
                              if ((pace->Mask & DESKTOP_ENUMERATE) == DESKTOP_ENUMERATE)
                                  _tprintf(TEXT(".................... DESKTOP_ENUMERATE\n"));
                              if ((pace->Mask & DESKTOP_HOOKCONTROL) == DESKTOP_HOOKCONTROL)
                                   _tprintf(TEXT(".................... DESKTOP_HOOKCONTROL\n"));
                              if ((pace->Mask & DESKTOP_JOURNALPLAYBACK) == DESKTOP_JOURNALPLAYBACK)
                                   _tprintf(TEXT(".................... DESKTOP_JOURNALPLAYBACK\n"));
                              if ((pace->Mask & DESKTOP_JOURNALRECORD) == DESKTOP_JOURNALRECORD)
                                   _tprintf(TEXT(".................... DESKTOP_JOURNALRECORD\n"));
                              if ((pace->Mask & DESKTOP_READOBJECTS) == DESKTOP_READOBJECTS)
                                   _tprintf(TEXT(".................... DESKTOP_READOBJECTS\n"));
                              if ((pace->Mask & DESKTOP_SWITCHDESKTOP) == DESKTOP_SWITCHDESKTOP)
                                   _tprintf(TEXT(".................... DESKTOP_SWITCHDESKTOP\n"));
                              if ((pace->Mask & DESKTOP_WRITEOBJECTS) == DESKTOP_WRITEOBJECTS)
                                   _tprintf(TEXT(".................... DESKTOP_WRITEOBJECTS\n"));
                              break;
                         case 'l':
                              if ((pace->Mask & SERVER_ACCESS_ADMINISTER) == SERVER_ACCESS_ADMINISTER)
                                   _tprintf(TEXT(".................... SERVER_ACCESS_ADMINISTER\n"));
                              if ((pace->Mask & SERVER_ACCESS_ENUMERATE) == SERVER_ACCESS_ENUMERATE)
                                   _tprintf(TEXT(".................... SERVER_ACCESS_ENUMERATE\n"));
                              if ((pace->Mask & PRINTER_ACCESS_ADMINISTER) == PRINTER_ACCESS_ADMINISTER)
                                   _tprintf(TEXT(".................... PRINTER_ACCESS_ADMINISTER\n"));
                              if ((pace->Mask & PRINTER_ACCESS_USE) == PRINTER_ACCESS_USE)
                                    _tprintf(TEXT(".................... PRINTER_ACCESS_USE\n"));
                              if ((pace->Mask & JOB_ACCESS_ADMINISTER) == JOB_ACCESS_ADMINISTER)
                                   _tprintf(TEXT(".................... JOB_ACCESS_ADMINISTER\n"));
                              break;
                         case 't':
                              if ((pace->Mask & READ) == READ)
                                   _tprintf(TEXT(".................... READ\n"));
                              if ((pace->Mask & CHANGE) == CHANGE)
                                   _tprintf(TEXT(".................... CHANGE\n"));
                              if ((pace->Mask & WRITE) == WRITE)
                                   _tprintf(TEXT(".................... WRITE\n"));
                              break;
                         case 'o':
                              if ((pace->Mask & TOKEN_ADJUST_DEFAULT) == TOKEN_ADJUST_DEFAULT)
                                   _tprintf(TEXT(".................... TOKEN_ADJUST_DEFAULT\n"));
                              if ((pace->Mask & TOKEN_ADJUST_GROUPS) == TOKEN_ADJUST_GROUPS)
                                   _tprintf(TEXT(".................... TOKEN_ADJUST_GROUPSE\n"));
                              if ((pace->Mask & TOKEN_ADJUST_PRIVILEGES) == TOKEN_ADJUST_PRIVILEGES)
                                  _tprintf(TEXT(".................... TOKEN_ADJUST_PRIVILEGES\n"));
                              if ((pace->Mask & TOKEN_ALL_ACCESS) == TOKEN_ALL_ACCESS)
                                  _tprintf(TEXT(".................... TOKEN_ALL_ACCESS\n"));
                              if ((pace->Mask & TOKEN_ASSIGN_PRIMARY) == TOKEN_ASSIGN_PRIMARY)
                                  _tprintf(TEXT(".................... TOKEN_ASSIGN_PRIMARY\n"));
                              if ((pace->Mask & TOKEN_DUPLICATE) == TOKEN_DUPLICATE)
                                  _tprintf(TEXT(".................... TOKEN_DUPLICATE\n"));
                              if ((pace->Mask & TOKEN_EXECUTE) == TOKEN_EXECUTE)
                                  _tprintf(TEXT(".................... TOKEN_EXECUTE\n"));
                              if ((pace->Mask & TOKEN_IMPERSONATE) == TOKEN_IMPERSONATE)
                                  _tprintf(TEXT(".................... TOKEN_IMPERSONATE\n"));
                              if ((pace->Mask & TOKEN_QUERY) == TOKEN_QUERY)
                                  _tprintf(TEXT(".................... TOKEN_QUERY\n"));
                              if ((pace->Mask & TOKEN_QUERY_SOURCE) == TOKEN_QUERY_SOURCE)
                                  _tprintf(TEXT(".................... TOKEN_QUERY_SOURCE\n"));
                              if ((pace->Mask & TOKEN_READ) == TOKEN_READ)
                                  _tprintf(TEXT(".................... TOKEN_READ\n"));
                              if ((pace->Mask & TOKEN_WRITE) == TOKEN_WRITE)
                                  _tprintf(TEXT(".................... TOKEN_WRITE\n"));
                              break;
                         case 'n':
                         case 'a':
                              break;
                         default:
                              break;
                    }

               //
               // object rights
               //
               if ((pace->Mask & READ_CONTROL) == READ_CONTROL)
                    _tprintf(TEXT(".................... READ_CONTROL\n"));
               if ((pace->Mask & WRITE_OWNER) == WRITE_OWNER)
                    _tprintf(TEXT(".................... WRITE_OWNER\n"));
               if ((pace->Mask & WRITE_DAC) == WRITE_DAC)
                    _tprintf(TEXT(".................... WRITE_DAC\n"));
               if ((pace->Mask & DELETE) == DELETE)
                    _tprintf(TEXT(".................... DELETE\n"));
               if ((pace->Mask & SYNCHRONIZE) == SYNCHRONIZE)
                    _tprintf(TEXT(".................... SYNCHRONIZE\n"));
               if ((pace->Mask & ACCESS_SYSTEM_SECURITY) == ACCESS_SYSTEM_SECURITY)
                    _tprintf(TEXT(".................... ACCESS_SYSTEM_SECURITY\n"));

               //
               // GENERIC access rights
               //
               if ((pace->Mask & GENERIC_ALL) == GENERIC_ALL)
                    _tprintf(TEXT(".................... GENERIC_ALL\n"));
               if ((pace->Mask & GENERIC_EXECUTE) == GENERIC_EXECUTE)
                    _tprintf(TEXT(".................... GENERIC_EXECUTE\n"));
               if ((pace->Mask & GENERIC_READ) == GENERIC_READ)
                    _tprintf(TEXT(".................... GENERIC_READ\n"));
               if ((pace->Mask & GENERIC_WRITE) == GENERIC_WRITE)
                    _tprintf(TEXT(".................... GENERIC_WRITE\n"));

               //
               // display sid
               //
               cbName = sizeof(szName);
               cbReferencedDomainName = sizeof(szReferencedDomainName);
               ZeroMemory(szName, cbName);
               ZeroMemory(szReferencedDomainName, cbReferencedDomainName);

               if (!LookupAccountSid(NULL, &(pace->SidStart), szName, &cbName, szReferencedDomainName, &cbReferencedDomainName, &snu)){
                    if (GetLastError() == ERROR_NONE_MAPPED)
                         LookupAccountOtherSid(&(pace->SidStart), szName, &cbName, szReferencedDomainName, &cbReferencedDomainName, &snu);
                    else
                         DisplayError(GetLastError(), TEXT("LookupAccountSid"));
               }

               _tprintf(TEXT("\nuser ............... %s\\%s\n"), szReferencedDomainName, szName);
               dwSize = sizeof(szSidText);
               ZeroMemory(szSidText, dwSize);
               ConvertSid(&(pace->SidStart), szSidText, &dwSize);
               _tprintf(TEXT("sid ................ %s\n"), szSidText);
               _tprintf(TEXT("sid type ........... %s\n"), szSidType[snu-1]);
               _tprintf(TEXT("sid size ........... %u bytes\n"), GetLengthSid(&(pace->SidStart)));
         }
          }
         }
     else{
          _tprintf(TEXT("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"));
          if (bDacl)
               _tprintf(TEXT(">>                 NO DACL PRESENT                     >>\n"));
          else
               _tprintf(TEXT(">>                 NO SACL PRESENT                     >>\n"));

          _tprintf(TEXT(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n\n"));
     }
}

void DumpFile | ( | LPTSTR | pszFile,
 |  | TCHAR | c
 | ) |  |

Definition at line 34 of file SecObjects.c.

{
     DWORD                dwSize = 0;
     PSECURITY_DESCRIPTOR psd = NULL;
     SECURITY_INFORMATION si  = OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION | SACL_SECURITY_INFORMATION;

     //
     // enable the privilege
     //
     Privilege(SE_SECURITY_NAME, TRUE);

     //
     // get the size
     //
     if (!GetFileSecurity(pszFile, si, psd, dwSize, &dwSize)){
          if (GetLastError() == ERROR_INSUFFICIENT_BUFFER){
               psd = (PSECURITY_DESCRIPTOR)LocalAlloc(LPTR, dwSize);
               if (psd == NULL)
                    DisplayError(GetLastError(), TEXT("LocalAlloc"));

          if (!GetFileSecurity(pszFile, si, psd, dwSize, &dwSize))
               DisplayError(GetLastError(), TEXT("GetFileSecurity"));
          }
          else
               DisplayError(GetLastError(), TEXT("GetFileSecurity"));
     }
   else{
          printf("GetFileSecurity succeeded when it was expected to fail.\n");
      ExitProcess(0);
   }

     //
     // enable the privilege
     //
     Privilege(SE_SECURITY_NAME, FALSE);

     //
     // dump security descriptor
     //
     DumpSD(psd, c);

     //
     // free the buffer
     //
   if (NULL != psd)
   {
          if (LocalFree((HLOCAL)psd))
               DisplayError(GetLastError(), TEXT("LocalFree"));
   }
}

void DumpKernelObject | ( | LPTSTR | pszObject,
 |  | TCHAR | c
 | ) |  |

Definition at line 85 of file SecObjects.c.

{
     DWORD                dwPid;
     DWORD                dwSize = 0;
     HANDLE               hObject;
     HANDLE               hProcess;
     PSECURITY_DESCRIPTOR psd = NULL;
     SECURITY_INFORMATION si  = OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION | SACL_SECURITY_INFORMATION;

     //
     // enable the privilege
     //
     Privilege(SE_SECURITY_NAME, TRUE);

     //
     // obtain a handle
     //
     switch (c){
          case 'e':
               hObject = OpenEvent(READ_CONTROL | ACCESS_SYSTEM_SECURITY, FALSE, pszObject);
               if (hObject == NULL)
                    DisplayError(GetLastError(), TEXT("OpenEvent"));
               break;
          case 'm':
               hObject = OpenMutex(READ_CONTROL | ACCESS_SYSTEM_SECURITY, FALSE, pszObject);
               if (hObject == NULL)
                    DisplayError(GetLastError(), TEXT("OpenMutex"));
               break;
          case 's':
               hObject = OpenSemaphore(READ_CONTROL | ACCESS_SYSTEM_SECURITY, FALSE, pszObject);
               if (hObject == NULL)
                    DisplayError(GetLastError(), TEXT("OpenSemaphore"));
               break;
          case 'p':
               //
               // convert name to a pid
               //
               dwPid = _ttol(pszObject);

               hObject = OpenProcess(READ_CONTROL | ACCESS_SYSTEM_SECURITY, FALSE, dwPid);
               if (hObject == NULL)
                    DisplayError(GetLastError(), TEXT("OpenProcess"));
               break;

          case 'o':
               dwPid = _ttol(pszObject);

               //
               // SD in access token does not support SACLS
               //
               si  = OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION;

               hProcess= OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, dwPid);
               if (hProcess == NULL)
                    DisplayError(GetLastError(), TEXT("OpenProcess"));

               if (!OpenProcessToken(hProcess, READ_CONTROL, &hObject))
                    DisplayError(GetLastError(), TEXT("OpenProcessToken"));

               if (!CloseHandle(hProcess))
                    DisplayError(GetLastError(), TEXT("CloseHandle"));
               break;
          case 'i':
               hObject = OpenFileMapping(READ_CONTROL | ACCESS_SYSTEM_SECURITY, FALSE, pszObject);
               if (hObject == NULL)
                    DisplayError(GetLastError(), TEXT("OpenFileMapping"));
               break;
          case 'a':
          case 'n':
               hObject = CreateFile(pszObject, READ_CONTROL | ACCESS_SYSTEM_SECURITY, 0, NULL, OPEN_EXISTING, 0, NULL);
               if (hObject == INVALID_HANDLE_VALUE)
                    DisplayError(GetLastError(), TEXT("CreateFile"));
          default:
               break;
     }

     //
     // disable the privilege
     //
     Privilege(SE_SECURITY_NAME, FALSE);

     //
     // obtain the size
     //
     if (!GetKernelObjectSecurity(hObject, si, psd, dwSize, &dwSize)){
          if (GetLastError() == ERROR_INSUFFICIENT_BUFFER){
               psd = (PSECURITY_DESCRIPTOR)LocalAlloc(LPTR, dwSize);
               if (psd == NULL)
                    DisplayError(GetLastError(), TEXT("LocalAlloc"));

               if (!GetKernelObjectSecurity(hObject, si, psd, dwSize, &dwSize))
                    DisplayError(GetLastError(), TEXT("GetKernelObjectSecurity"));
          }
          else
                DisplayError(GetLastError(), TEXT("GetKernelObjectSecurity"));
     }
   else{
        printf("GetFileSecurity succeeded when it was expected to fail.\n");
      ExitProcess(0);
   }

     //
     // dump security descriptor
     //
     DumpSD(psd, c);

     //
     // free the buffer
     //
   if (NULL != psd)
          if (LocalFree((HLOCAL)psd))
               DisplayError(GetLastError(), TEXT("LocalFree"));

     if (!CloseHandle(hObject))
          DisplayError(GetLastError(), TEXT("CloseHandle"));
}

void DumpNetShare ( LPTSTR pszShare )

Definition at line 202 of file SecObjects.c.

{
     DWORD                dwSize = 0;
     LPTSTR               pszShareAdjusted;
     LPTSTR               pszShareName;
     NET_API_STATUS       nas;
     PSECURITY_DESCRIPTOR psd   = NULL;
     PSHARE_INFO_502      psi502;
     TCHAR                szServer[CNLEN] = TEXT("");

#ifndef UNICODE
     WCHAR                szWServer[CNLEN] = L"";
     WCHAR                szWShare[NNLEN]  = L"";
#endif

     //
     // remove \\ if exists
     //
     pszShareAdjusted = _tcsstr(pszShare, TEXT("\\\\"));
     if (pszShareAdjusted != NULL)
          pszShareAdjusted = pszShareAdjusted + 2;
     else
          pszShareAdjusted = pszShare;

     //
     // find the subkey
     //
     pszShareName = _tcschr(pszShareAdjusted, '\\');
     if (pszShareName == NULL)
          return;
     else
          pszShareName++;

     //
     // find the main key
     //
     if (!_tcsncpy(szServer, pszShareAdjusted, (UINT)(pszShareName - pszShareAdjusted - 1)))
          DisplayError(GetLastError(), TEXT("_tcsncpy"));

#ifndef UNICODE

     //
     // handle ANSI situation
     //
     if (!MultiByteToWideChar(CP_ACP, 0, (LPCTSTR)szServer, -1, szWServer, sizeof(szWServer)))
          DisplayError(GetLastError(), TEXT("MultiByteToWideChar"));

     if(!MultiByteToWideChar(CP_ACP, 0, (LPCTSTR)pszShareName, -1, szWShare, sizeof(szWShare)))
          DisplayError(GetLastError(), TEXT("MultiByteToWideChar"));

     nas = NetShareGetInfo(szWServer, szWShare, 502, (LPBYTE *)&psi502);

#else

     nas = NetShareGetInfo(szServer, pszShareName, 502, (LPBYTE *)&psi502);

#endif

     if (nas != NERR_Success)
          DisplayError(nas, TEXT("NetShareGetInfo"));

     //
     // obtain the SD
     //
     psd = psi502->shi502_security_descriptor;

     //
     // dump security descriptor
     //
     DumpSD(psd, 't');

     //
     // free the buffer
     //
     nas = NetApiBufferFree((LPVOID)psi502);
     if (nas != NERR_Success)
          DisplayError(nas, TEXT("NetApiBufferFree"));

}

void DumpOwnerGroup | ( | PSECURITY_DESCRIPTOR | psd,
 |  | BOOL | bOwner
 | ) |  |

Definition at line 497 of file SD.c.

{
     BOOL         bOwnerDefaulted;
     TCHAR        szSidType[][17] = {TEXT("User"), TEXT("Group"), TEXT("Domain"), TEXT("Alias"), TEXT("Well Known Group"), TEXT("Deleted Account"), TEXT("Invalid"), TEXT("Unknown")};
     PSID         psid = NULL;
     SID_NAME_USE snu;
     TCHAR        szName[UNLEN];
     TCHAR        szReferencedDomainName[DNLEN];
     DWORD        cbName = sizeof(szName);
     DWORD        cbReferencedDomainName = sizeof(szReferencedDomainName);
     TCHAR        szSidText[256] = TEXT("");
     DWORD        dwSize = sizeof(szSidText);
     TCHAR        szType[6]      = TEXT("");

     if (bOwner){
          if (!GetSecurityDescriptorOwner(psd, &psid, &bOwnerDefaulted))
               DisplayError(GetLastError(), TEXT("GetSecurityDescriptorOwner"));
               if (!lstrcpy(szType, TEXT("owner")))
                    DisplayError(GetLastError(), TEXT("lstrcpy"));
         }
     else{
          if (!GetSecurityDescriptorGroup(psd, &psid, &bOwnerDefaulted))
               DisplayError(GetLastError(), TEXT("GetSecurityDescriptorGroup"));
               if(!lstrcpy(szType, TEXT("group")))
                    DisplayError(GetLastError(), TEXT("lstrcpy"));
         }

     if (psid == NULL)
          _tprintf(TEXT("%s .............. none\n"), szType);
     else{
          ZeroMemory(szName, cbName);
          ZeroMemory(szReferencedDomainName, cbReferencedDomainName);

          //
          // get the owner of the sid
          //
          if (!LookupAccountSid(NULL, psid, szName, &cbName, szReferencedDomainName, &cbReferencedDomainName, &snu)){
               if (GetLastError() != ERROR_NONE_MAPPED)
                    DisplayError(GetLastError(), TEXT("LookupAccountSid"));
          }

          _tprintf(TEXT("\n%s .............. %s\\%s\n"), szType, szReferencedDomainName, szName);
          ConvertSid(psid, szSidText, &dwSize);
          _tprintf(TEXT("sid ................ %s\n"), szSidText);
          _tprintf(TEXT("sid type ........... %s\n"), szSidType[snu-1]);
     }
}

void DumpPrinter ( LPTSTR pszPrinter )

Definition at line 283 of file SecObjects.c.

{
     DWORD                dwSize = 0;
     HANDLE               hPrinter;
     PRINTER_DEFAULTS     pd;
     PRINTER_INFO_3       *ppi3 = NULL;
     PSECURITY_DESCRIPTOR psd   = NULL;

     ZeroMemory(&pd, sizeof(PRINTER_DEFAULTS));
     pd.DesiredAccess = READ_CONTROL;

     //
     // obtain a handle to the printer
     //
     if (!OpenPrinter(pszPrinter, &hPrinter, &pd))
          DisplayError(GetLastError(), TEXT("OpenPrinter"));

     //
     // get the size
     //
     if (!GetPrinter(hPrinter, 3, (LPBYTE)ppi3, dwSize, &dwSize)){
          if (GetLastError() == ERROR_INSUFFICIENT_BUFFER){
               ppi3 = (PPRINTER_INFO_3)LocalAlloc(LPTR, dwSize);
               if (ppi3 == NULL)
                    DisplayError(GetLastError(), TEXT("LocalAlloc"));

               if (!GetPrinter(hPrinter, 3, (LPBYTE)ppi3, dwSize, &dwSize))
                    DisplayError(GetLastError(), TEXT("GetPrinter"));
          }
     }
   else{
        printf("GetPrinter succeeded when it was expected to fail.\n");
      ExitProcess(0);
   }

     //
     // cast buffer
     //
     psd = ppi3->pSecurityDescriptor;

     //
     // dump security descriptor information
     //
     DumpSDInfo(psd);

     //
     // dump the control bits
     //
     DumpControl(psd);

     //
     // get the owner
     //
     DumpOwnerGroup(psd, TRUE);

     //
     // get the group
     //
     DumpOwnerGroup(psd, FALSE);

     //
     // get the dacl
     //
     DumpDacl(psd, 'l', TRUE);

     //
     // printer object does not have a SACL
     //

     //
     // free the buffer
     //
     if (!ppi3)
      if (LocalFree((HLOCAL)ppi3))
               DisplayError(GetLastError(), TEXT("LocalFree"));

     if (!ClosePrinter(hPrinter))
          DisplayError(GetLastError(), TEXT("ClosePrinter"));
}

void DumpRegistryKey ( LPTSTR pszKey )

Definition at line 364 of file SecObjects.c.

{
     DWORD                dwAccess = READ_CONTROL;
     DWORD                dwSize = 0;
     HKEY                 hKey;
     HKEY                 hMainKey;
     LONG                 lErrorCode;
     LPTSTR               pszSubKey = NULL;
     PSECURITY_DESCRIPTOR psd = NULL;
     SECURITY_INFORMATION si;
     TCHAR                szMainKey[256] = TEXT("");

     //
     // find the subkey
     //
     pszSubKey = _tcschr(pszKey, '\\');
     if (pszSubKey == NULL){
          if (!lstrcpy(szMainKey, pszKey))
           DisplayError(GetLastError(), TEXT("lstrcpy"));

          si = OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION;
     }
     else{
          pszSubKey++;

          //
          // find the main key
          //
          if(!_tcsncpy(szMainKey, pszKey, (UINT)(pszSubKey - pszKey - 1)))
               DisplayError(GetLastError(), TEXT("_tcsncpy"));

          si = OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION | SACL_SECURITY_INFORMATION;
     }

     //
     // parse the main key
     //
     if (!lstrcmp(szMainKey, TEXT("HKEY_LOCAL_MACHINE"))){
          hMainKey = HKEY_LOCAL_MACHINE;
     }
     else if (!lstrcmp(szMainKey, TEXT("HKEY_CLASSES_ROOT"))){
          hMainKey = HKEY_CLASSES_ROOT;
     }
     else if (!lstrcmp(szMainKey, TEXT("HKEY_USERS"))){
          hMainKey = HKEY_USERS;
     }
     else if (!lstrcmp(szMainKey, TEXT("HKEY_CURRENT_USER"))){
          hMainKey = HKEY_CURRENT_USER;
     }
     else if (!lstrcmp(szMainKey, TEXT("HKEY_CLASSES_ROOT"))){
          hMainKey = HKEY_CLASSES_ROOT;
     }
     else
          hMainKey = 0;

     //
     // enable the privilege
     //
     if (pszSubKey != NULL){
          Privilege(SE_SECURITY_NAME, TRUE);
          dwAccess |= ACCESS_SYSTEM_SECURITY;
     }

     //
     // open the key
     //
     lErrorCode = RegOpenKeyEx(hMainKey, pszSubKey, 0, dwAccess, &hKey);
     if (lErrorCode != ERROR_SUCCESS)
          DisplayError(lErrorCode, TEXT("RegOpenKeyEx"));

     //
     // disable the privilege
     //
     if (pszSubKey != NULL)
          Privilege(SE_SECURITY_NAME, FALSE);

     //
     // get key security information
     //
     lErrorCode = RegGetKeySecurity(hKey, si, psd, &dwSize);
     if (lErrorCode == ERROR_INSUFFICIENT_BUFFER){
          //
          // allocate memory for psd
          //
          psd = (PSECURITY_DESCRIPTOR)LocalAlloc(LPTR, dwSize);
          if (psd == NULL)
               DisplayError(GetLastError(), TEXT("LocalAlloc"));

          //
          // call the api again
          //
          lErrorCode = RegGetKeySecurity(hKey, si, psd, &dwSize);
          if (lErrorCode != ERROR_SUCCESS)
               DisplayError(lErrorCode, TEXT("RegGetKeySecurity"));
     }
     else
          DisplayError(lErrorCode, TEXT("RegGetKeySecurity"));

     //
     // dump security descriptor
     //
     DumpSD(psd, 'r');

     //
     // free the buffer
     //
     if (LocalFree((HLOCAL)psd))
          DisplayError(GetLastError(), TEXT("LocalFree"));

     //
     // close the key
     //
     lErrorCode = RegCloseKey(hKey);
     if (lErrorCode != ERROR_SUCCESS)
          DisplayError(lErrorCode, TEXT("RegCloseKey"));
}

void DumpSD | ( | PSECURITY_DESCRIPTOR | psd,
 |  | TCHAR | c
 | ) |  |

Definition at line 545 of file SD.c.

{
     //
     // dump security descriptor information
     //
     DumpSDInfo(psd);

     //
     // dump the control bits
     //
     DumpControl(psd);

     //
     // get the owner
     //
     DumpOwnerGroup(psd, TRUE);

     //
     // get the group
     //
     DumpOwnerGroup(psd, FALSE);

     //
     // get the dacl
     //
     DumpDacl(psd, c, TRUE);

     //
     // get the sacl
     //
     DumpDacl(psd, c, FALSE);
}

void DumpSDInfo ( PSECURITY_DESCRIPTOR psd )

Definition at line 578 of file SD.c.

{
     DWORD dwSDLength;

     //
     // is the security descriptor valid
     //
     _tprintf(TEXT("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"));
     _tprintf(TEXT(">>          SECURITY DESCRIPTOR INFORMATION            >>\n"));
     _tprintf(TEXT(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n\nvalid .............. "));

     if (!IsValidSecurityDescriptor(psd)){
          _tprintf(TEXT("no\n"));
          return;
     }
     else
          _tprintf(TEXT("yes\n"));

     //
     // security descriptor size???
     //
     dwSDLength = GetSecurityDescriptorLength(psd);

     _tprintf(TEXT("length ............. %u byte(s)\n"), dwSDLength);
}

void DumpService | ( | LPTSTR | pszServer,
 |  | LPTSTR | pszService
 | ) |  |

Definition at line 481 of file SecObjects.c.

{
     DWORD                dwSize = 0;
     PSECURITY_DESCRIPTOR psd = (PSECURITY_DESCRIPTOR)1;  // if initialized to NULL, QueryServiceObjectSecurity() returns error code 87
     SC_HANDLE            schService;
     SC_HANDLE            schManager;
     SECURITY_INFORMATION si  = OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION | SACL_SECURITY_INFORMATION;

     schManager = OpenSCManager(pszServer, NULL, SC_MANAGER_CONNECT);
     if (schManager == NULL)
          DisplayError(GetLastError(), TEXT("OpenSCManager"));

     //
     // enable the privilege
     //
     Privilege(SE_SECURITY_NAME, TRUE);

     schService = OpenService(schManager, pszService, READ_CONTROL | ACCESS_SYSTEM_SECURITY);
     if (schService == NULL)
          DisplayError(GetLastError(), TEXT("OpenService"));

     //
     // disable the privilege
     //
     Privilege(SE_SECURITY_NAME, FALSE);

     //
     // obtain the size
     //
     if (!QueryServiceObjectSecurity(schService, si, psd, dwSize, &dwSize)){
          if (GetLastError() == ERROR_INSUFFICIENT_BUFFER){
               psd = (PSECURITY_DESCRIPTOR)LocalAlloc(LPTR, dwSize);
               if (psd == NULL)
                    DisplayError(GetLastError(), TEXT("LocalAlloc"));

          if (!QueryServiceObjectSecurity(schService, si, psd, dwSize, &dwSize))
               DisplayError(GetLastError(), TEXT("QueryServicelObjectSecurity"));
          }
          else
               DisplayError(GetLastError(), TEXT("QueryServiceObjectSecurity"));
     }
   else{
        printf("QueryServiceObjectSecurity succeeded when it was expected to fail.\n");
      ExitProcess(0);
   }

     //
     // dump security descriptor
     //
     DumpSD(psd, 'v');

     //
     // free the buffer
     //
     if(LocalFree((HLOCAL)psd))
        DisplayError(GetLastError(), TEXT("LocalFree"));

     if (!CloseServiceHandle(schService))
          DisplayError(GetLastError(), TEXT("CloseServiceHandle"));

     if (!CloseServiceHandle(schManager))
          DisplayError(GetLastError(), TEXT("CloseServiceHandle"));
}

void DumpUserObject | ( | LPTSTR | pszObject,
 |  | TCHAR | c
 | ) |  |

Definition at line 547 of file SecObjects.c.

{
     DWORD                dwSize = 0;
     HANDLE               hObject;
     HWINSTA              hwinsta;
     HWINSTA              hwinstaCurrent;
     LPTSTR               pszDesktop;
     PSECURITY_DESCRIPTOR psd = NULL;
     SECURITY_INFORMATION si  = OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION | SACL_SECURITY_INFORMATION;
     TCHAR                szWinsta[256] = TEXT("");

     //
     // enable the privilege
     //
     Privilege(SE_SECURITY_NAME, TRUE);

     //
     // obtain a handle
     //
     switch (c){
          case 'w':
               hObject = OpenWindowStation(pszObject, FALSE, READ_CONTROL | ACCESS_SYSTEM_SECURITY);
               if (hObject == NULL)
                    DisplayError(GetLastError(), TEXT("OpenWindowStation"));
               break;

          case 'k':
               //
               // find the desktop
               //
               pszDesktop = _tcschr(pszObject, '\\');
               if (pszDesktop == NULL)
                    return;
               else
                    pszDesktop++;

               //
               // find the main key
               //
               if (!_tcsncpy(szWinsta, pszObject, (UINT)(pszDesktop - pszObject - 1)))
                    DisplayError(GetLastError(), TEXT("_tcsncpy"));

               //
               // obtain a handle to the window station
               //
               hwinsta = OpenWindowStation(szWinsta, FALSE, WINSTA_ENUMDESKTOPS);
               if (hwinsta == NULL)
                    DisplayError(GetLastError(), TEXT("OpenWindowStation"));

               hwinstaCurrent = GetProcessWindowStation();
               if (hwinstaCurrent == NULL)
                    DisplayError(GetLastError(), TEXT("GetProcessWindowStation"));

               if (!SetProcessWindowStation(hwinsta))
                    DisplayError(GetLastError(), TEXT("SetProcessWindowStation"));

               hObject = OpenDesktop(pszDesktop, 0, FALSE, READ_CONTROL | ACCESS_SYSTEM_SECURITY);
               if (hObject == NULL)
                    DisplayError(GetLastError(), TEXT("OpenDesktop"));

               if (!SetProcessWindowStation(hwinstaCurrent))
                    DisplayError(GetLastError(), TEXT("SetProcessWindowStation"));

               if (!CloseWindowStation(hwinsta))
                    DisplayError(GetLastError(), TEXT("CloseWindowStation"));
               break;
          default:
               break;
     }

     //
     // disable the privilege
     //
     Privilege(SE_SECURITY_NAME, FALSE);

     //
     // obtain the size
     //
     if (!GetUserObjectSecurity(hObject, &si, psd, dwSize, &dwSize)){
          if (GetLastError() == ERROR_INSUFFICIENT_BUFFER){
               psd = (PSECURITY_DESCRIPTOR)LocalAlloc(LPTR, dwSize);
               if (psd == NULL)
                    DisplayError(GetLastError(), TEXT("LocalAlloc"));

               if (!GetUserObjectSecurity(hObject, &si, psd, dwSize, &dwSize))
                    DisplayError(GetLastError(), TEXT("GetUserObjectSecurity"));
           }
           else
                DisplayError(GetLastError(), TEXT("GetUserObjectSecurity"));
     }
   else{
        printf("GetUserObjectSecurity succeeded when it was expected to fail.\n");
      ExitProcess(0);
   }

     //
     // dump security descriptor
     //
     DumpSD(psd, c);

     //
     // free the buffer
     //
     if (LocalFree((HLOCAL)psd))
        DisplayError(GetLastError(), TEXT("LocalFree"));

     if (!CloseHandle(hObject))
          DisplayError(GetLastError(), TEXT("CloseHandle"));
}

void LookupAccountOtherSid | ( | PSID | psidCheck,
 |  | LPTSTR | pszName,
 |  | LPDWORD | pcbName,
 |  | LPTSTR | pszDomain,
 |  | LPDWORD | pcbDomain,
 |  | PSID_NAME_USE | psnu
 | ) |  |

Definition at line 199 of file Helper.c.

{
     int                      i;
     PSID                     psid[UNKNOWNSIDS];
     PSID                     psidLogonSid;
     SID_IDENTIFIER_AUTHORITY sia = SECURITY_NT_AUTHORITY;
     TCHAR                    szName[UNKNOWNSIDS][18] = {TEXT("ACCOUNT OPERATORS"), TEXT("SERVER OPERATORS"), TEXT("PRINTER OPERATORS"), TEXT("BACKUP OPERATORS")};

     //
     // name should be bigger than 18, builtin should be greater than 8
     //

     //
     // create account operators
     //
     if (!AllocateAndInitializeSid(&sia, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ACCOUNT_OPS, 0, 0, 0, 0, 0, 0, &psid[0]))
          DisplayError(GetLastError(), TEXT("AllocateAndInitializeSid"));

     //
     // create system operators
     //
     if (!AllocateAndInitializeSid(&sia, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_SYSTEM_OPS, 0, 0, 0, 0, 0, 0, &psid[1]))
          DisplayError(GetLastError(), TEXT("AllocateAndInitializeSid"));

     //
     // create printer operators
     //
     if (!AllocateAndInitializeSid(&sia, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_PRINT_OPS, 0, 0, 0, 0, 0, 0, &psid[2]))
          DisplayError(GetLastError(), TEXT("AllocateAndInitializeSid"));

     //
     // create backup operators
     //
     if (!AllocateAndInitializeSid(&sia, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_BACKUP_OPS, 0, 0, 0, 0, 0, 0, &psid[3]))
          DisplayError(GetLastError(), TEXT("AllocateAndInitializeSid"));

     //
     // create a logon SID
     //
     if (!AllocateAndInitializeSid(&sia, 2, 0x00000005, 0, 0, 0, 0, 0, 0, 0, &psidLogonSid))
          DisplayError(GetLastError(), TEXT("AllocateAndInitializeSid"));

     *psnu =  SidTypeAlias;

     for (i = 0; i < 4; i++){
          if (EqualSid(psidCheck, psid[i])){
         if (!lstrcpy(pszName, szName[i]))
              DisplayError(GetLastError(), TEXT("lstrcpy"));

               if (!lstrcpy(pszDomain, TEXT("BUILTIN")))
              DisplayError(GetLastError(), TEXT("lstrcpy"));
               break;
          }
     }

     if (EqualPrefixSid(psidCheck, psidLogonSid)){
     if (!lstrcpy(pszName, TEXT("LOGON SID")))
            DisplayError(GetLastError(), TEXT("_tcsncpy"));
     }

     //
     // free the sids
     //
     for (i=0;i<4;i++){
          FreeSid(psid[i]);
     }

     FreeSid(psidLogonSid);
}

BOOL Privilege | ( | LPTSTR | pszPrivilege,
 |  | BOOL | bEnable
 | ) |  |

Definition at line 157 of file Helper.c.

{
     HANDLE           hToken;
     TOKEN_PRIVILEGES tp;

     //
     // obtain the token, first check the thread and then the process
     //
     if (!OpenThreadToken(GetCurrentThread(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, TRUE, &hToken)){
          if (GetLastError() == ERROR_NO_TOKEN){
               if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))
                    return FALSE;
          }
          else
               return FALSE;
   }

     //
     // get the luid for the privilege
     //
     if (!LookupPrivilegeValue(NULL, pszPrivilege, &tp.Privileges[0].Luid))
          return FALSE;

     tp.PrivilegeCount = 1;

     if (bEnable)
          tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
     else
          tp.Privileges[0].Attributes = 0;

     //
     // enable or disable the privilege
     //
     if (!AdjustTokenPrivileges(hToken, FALSE, &tp, 0, (PTOKEN_PRIVILEGES)NULL, 0))
          return FALSE;

     if (!CloseHandle(hToken))
          return FALSE;

     return TRUE;
}

Generated on Wed Nov 13 2024 16:54:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/Authorization/Check_SD/Helper.c File Reference

  • Security
  • Authorization
  • Check_SD
Functions

Helper.c File Reference

#include "check_sd.h"
#include <tchar.h>
#include <stdio.h>

Go to the source code of this file.

Functions

BOOL | ConvertSid (PSID pSid, LPTSTR pszSidText, LPDWORD dwBufferLen)
void | DisplayError (DWORD dwError, LPTSTR pszAPI)
void | LookupAccountOtherSid (PSID psidCheck, LPTSTR pszName, LPDWORD pcbName, LPTSTR pszDomain, LPDWORD pcbDomain, PSID_NAME_USE psnu)
BOOL | Privilege (LPTSTR pszPrivilege, BOOL bEnable)

Function Documentation

BOOL ConvertSid | ( | PSID | pSid,
 |  | LPTSTR | pszSidText,
 |  | LPDWORD | dwBufferLen
 | ) |  |

Definition at line 50 of file Helper.c.

{
     DWORD                     dwSubAuthorities;
     DWORD                     dwSidRev = SID_REVISION;
     DWORD                     dwCounter;
     DWORD                     dwSidSize;
     PSID_IDENTIFIER_AUTHORITY psia;

     //
     // test if Sid passed in is valid
     //
     if(!IsValidSid(pSid))
          return FALSE;

     //
     // obtain SidIdentifierAuthority
     //
     psia = GetSidIdentifierAuthority(pSid);

     //
     // obtain sidsubauthority count
     //
     dwSubAuthorities =* GetSidSubAuthorityCount(pSid);

     //
     // compute buffer length
     // S-SID_REVISION- + identifierauthority- + subauthorities- + NULL
     //
     dwSidSize = (15 + 12 + (12 * dwSubAuthorities) + 1) * sizeof(TCHAR);

     //
     // check provided buffer length.
     // If not large enough, indicate proper size and setlasterror
     //
     if (*dwBufferLen < dwSidSize){
          *dwBufferLen = dwSidSize;
          SetLastError(ERROR_INSUFFICIENT_BUFFER);
          return FALSE;
         }

     //
     // prepare S-SID_REVISION-
     //
     dwSidSize=wsprintf(pszSidText, TEXT("S-%lu-"), dwSidRev );

     //
     // prepare SidIdentifierAuthority
     //
     if ( (psia->Value[0] != 0) || (psia->Value[1] != 0) ){
          dwSidSize += wsprintf(pszSidText + lstrlen(pszSidText),
          TEXT("0x%02hx%02hx%02hx%02hx%02hx%02hx"),
          (USHORT)psia->Value[0],
          (USHORT)psia->Value[1],
          (USHORT)psia->Value[2],
          (USHORT)psia->Value[3],
          (USHORT)psia->Value[4],
          (USHORT)psia->Value[5]);
         }
     else{
          dwSidSize += wsprintf(pszSidText + lstrlen(pszSidText),
                               TEXT("%lu"),
                               (ULONG)(psia->Value[5]      )   +
                               (ULONG)(psia->Value[4] <<  8)   +
                               (ULONG)(psia->Value[3] << 16)   +
                               (ULONG)(psia->Value[2] << 24)   );
         }

     //
     // loop through SidSubAuthorities
     //
     for (dwCounter=0 ; dwCounter < dwSubAuthorities ; dwCounter++){
          dwSidSize+=wsprintf(pszSidText + dwSidSize, TEXT("-%lu"),
               *GetSidSubAuthority(pSid, dwCounter));
         }

     return TRUE;
}

void DisplayError | ( | DWORD | dwError,
 |  | LPTSTR | pszAPI
 | ) |  |

Definition at line 128 of file Helper.c.

{
     LPVOID lpvMessageBuffer;

     if (!FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
                   NULL, dwError,
                   MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), //The user default language
                   (LPTSTR)&lpvMessageBuffer, 0, NULL))
   {
        printf ("FormatMessage failed: 0x%x\n", GetLastError());
      return;
   }

     //
     //... now display this string
     //
     _tprintf(TEXT("ERROR: API        = %s.\n"), pszAPI);
     _tprintf(TEXT("       error code = %d.\n"), dwError);
     _tprintf(TEXT("       message    = %s\n"), (LPTSTR)lpvMessageBuffer);

     //
     // Free the buffer allocated by the system
     //
     if (LocalFree(lpvMessageBuffer))
     printf ("LocalFree failed: 0x%x\n", GetLastError());

     ExitProcess(0);
}

void LookupAccountOtherSid | ( | PSID | psidCheck,
 |  | LPTSTR | pszName,
 |  | LPDWORD | pcbName,
 |  | LPTSTR | pszDomain,
 |  | LPDWORD | pcbDomain,
 |  | PSID_NAME_USE | psnu
 | ) |  |

Definition at line 199 of file Helper.c.

{
     int                      i;
     PSID                     psid[UNKNOWNSIDS];
     PSID                     psidLogonSid;
     SID_IDENTIFIER_AUTHORITY sia = SECURITY_NT_AUTHORITY;
     TCHAR                    szName[UNKNOWNSIDS][18] = {TEXT("ACCOUNT OPERATORS"), TEXT("SERVER OPERATORS"), TEXT("PRINTER OPERATORS"), TEXT("BACKUP OPERATORS")};

     //
     // name should be bigger than 18, builtin should be greater than 8
     //

     //
     // create account operators
     //
     if (!AllocateAndInitializeSid(&sia, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ACCOUNT_OPS, 0, 0, 0, 0, 0, 0, &psid[0]))
          DisplayError(GetLastError(), TEXT("AllocateAndInitializeSid"));

     //
     // create system operators
     //
     if (!AllocateAndInitializeSid(&sia, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_SYSTEM_OPS, 0, 0, 0, 0, 0, 0, &psid[1]))
          DisplayError(GetLastError(), TEXT("AllocateAndInitializeSid"));

     //
     // create printer operators
     //
     if (!AllocateAndInitializeSid(&sia, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_PRINT_OPS, 0, 0, 0, 0, 0, 0, &psid[2]))
          DisplayError(GetLastError(), TEXT("AllocateAndInitializeSid"));

     //
     // create backup operators
     //
     if (!AllocateAndInitializeSid(&sia, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_BACKUP_OPS, 0, 0, 0, 0, 0, 0, &psid[3]))
          DisplayError(GetLastError(), TEXT("AllocateAndInitializeSid"));

     //
     // create a logon SID
     //
     if (!AllocateAndInitializeSid(&sia, 2, 0x00000005, 0, 0, 0, 0, 0, 0, 0, &psidLogonSid))
          DisplayError(GetLastError(), TEXT("AllocateAndInitializeSid"));

     *psnu =  SidTypeAlias;

     for (i = 0; i < 4; i++){
          if (EqualSid(psidCheck, psid[i])){
         if (!lstrcpy(pszName, szName[i]))
              DisplayError(GetLastError(), TEXT("lstrcpy"));

               if (!lstrcpy(pszDomain, TEXT("BUILTIN")))
              DisplayError(GetLastError(), TEXT("lstrcpy"));
               break;
          }
     }

     if (EqualPrefixSid(psidCheck, psidLogonSid)){
     if (!lstrcpy(pszName, TEXT("LOGON SID")))
            DisplayError(GetLastError(), TEXT("_tcsncpy"));
     }

     //
     // free the sids
     //
     for (i=0;i<4;i++){
          FreeSid(psid[i]);
     }

     FreeSid(psidLogonSid);
}

BOOL Privilege | ( | LPTSTR | pszPrivilege,
 |  | BOOL | bEnable
 | ) |  |

Definition at line 157 of file Helper.c.

{
     HANDLE           hToken;
     TOKEN_PRIVILEGES tp;

     //
     // obtain the token, first check the thread and then the process
     //
     if (!OpenThreadToken(GetCurrentThread(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, TRUE, &hToken)){
          if (GetLastError() == ERROR_NO_TOKEN){
               if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))
                    return FALSE;
          }
          else
               return FALSE;
   }

     //
     // get the luid for the privilege
     //
     if (!LookupPrivilegeValue(NULL, pszPrivilege, &tp.Privileges[0].Luid))
          return FALSE;

     tp.PrivilegeCount = 1;

     if (bEnable)
          tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
     else
          tp.Privileges[0].Attributes = 0;

     //
     // enable or disable the privilege
     //
     if (!AdjustTokenPrivileges(hToken, FALSE, &tp, 0, (PTOKEN_PRIVILEGES)NULL, 0))
          return FALSE;

     if (!CloseHandle(hToken))
          return FALSE;

     return TRUE;
}

Generated on Wed Nov 13 2024 16:54:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/Authorization/Check_SD/SD.c File Reference

  • Security
  • Authorization
  • Check_SD
Functions

SD.c File Reference

#include "check_sd.h"
#include <tchar.h>
#include <stdio.h>
#include <lmcons.h>

Go to the source code of this file.

Functions

DWORD | DumpAclInfo (PACL pacl, BOOL bDacl)
void | DumpControl (PSECURITY_DESCRIPTOR psd)
void | DumpDacl (PSECURITY_DESCRIPTOR psd, TCHAR c, BOOL bDacl)
void | DumpOwnerGroup (PSECURITY_DESCRIPTOR psd, BOOL bOwner)
void | DumpSD (PSECURITY_DESCRIPTOR psd, TCHAR c)
void | DumpSDInfo (PSECURITY_DESCRIPTOR psd)

Function Documentation

DWORD DumpAclInfo | ( | PACL | pacl,
 |  | BOOL | bDacl
 | ) |  |

Definition at line 43 of file SD.c.

{
     ACL_INFORMATION_CLASS    aic;
     BYTE                     pByte[2][12];

     //
     // is the acl valid
     //
     _tprintf(TEXT("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"));
     if (bDacl)
          _tprintf(TEXT(">>                 DACL INFORMATION                    >>\n"));
     else
          _tprintf(TEXT(">>                 SACL INFORMATION                    >>\n"));

     _tprintf(TEXT(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n\n"));
     _tprintf(TEXT("valid .............. "));

     if (!IsValidAcl(pacl)){
          _tprintf(TEXT("no\n"));
          return 0;
     }
     else
          _tprintf(TEXT("yes\n"));

     for (aic=1; aic<3; aic++){
          if (!GetAclInformation(pacl, (LPVOID)pByte[aic-1], sizeof(ACL_SIZE_INFORMATION), aic))
               DisplayError(GetLastError(), TEXT("GetAclInformation"));
     }

     _tprintf(TEXT("revision ........... %u\n\n"), *((PACL_REVISION_INFORMATION)pByte[0]));
     _tprintf(TEXT("ace count .......... %u\n"), ((PACL_SIZE_INFORMATION)pByte[1])->AceCount);
     _tprintf(TEXT("acl bytes in use ... %u byte(s)\n"), ((PACL_SIZE_INFORMATION)pByte[1])->AclBytesInUse);
     _tprintf(TEXT("acl bytes free ..... %u byte(s)\n"), ((PACL_SIZE_INFORMATION)pByte[1])->AclBytesFree);

     return ((PACL_SIZE_INFORMATION)pByte[1])->AceCount;
}

void DumpControl ( PSECURITY_DESCRIPTOR psd )

Definition at line 80 of file SD.c.

{
     DWORD                       dwRevision;
     SECURITY_DESCRIPTOR_CONTROL sdc;

     if (!GetSecurityDescriptorControl(psd, &sdc, &dwRevision))
          DisplayError(GetLastError(), TEXT("GetSecurityDescriptorControl"));

     _tprintf(TEXT("revision ........... %u\n"), dwRevision);
     _tprintf(TEXT("control bits ....... 0x%X\n"), sdc);

     if ((sdc & SE_DACL_DEFAULTED) == SE_DACL_DEFAULTED)
          _tprintf(TEXT(".................... SE_DACL_DEFAULTED\n"));
     if ((sdc & SE_DACL_PRESENT) == SE_DACL_PRESENT)
          _tprintf(TEXT(".................... SE_DACL_PRESENT\n"));
     if ((sdc & SE_GROUP_DEFAULTED) == SE_GROUP_DEFAULTED)
          _tprintf(TEXT(".................... SE_GROUP_DEFAULTED\n"));
     if ((sdc & SE_OWNER_DEFAULTED) == SE_OWNER_DEFAULTED)
          _tprintf(TEXT(".................... SE_OWNER_DEFAULTED\n"));
     if ((sdc & SE_SACL_DEFAULTED) == SE_SACL_DEFAULTED)
          _tprintf(TEXT(".................... SE_SACL_DEFAULTED\n"));
     if ((sdc & SE_SACL_PRESENT) == SE_SACL_PRESENT)
          _tprintf(TEXT(".................... SE_SACL_PRESENT\n"));
     if ((sdc & SE_SELF_RELATIVE) == SE_SELF_RELATIVE)
          _tprintf(TEXT(".................... SE_SELF_RELATIVE\n"));
     if ((sdc & SE_DACL_AUTO_INHERITED) == SE_DACL_AUTO_INHERITED) // NT5.0
          _tprintf(TEXT(".................... SE_DACL_AUTO_INHERITED\n"));
     if ((sdc & SE_SACL_AUTO_INHERITED) == SE_SACL_AUTO_INHERITED) // NT5.0
          _tprintf(TEXT(".................... SE_SACL_AUTO_INHERITED\n"));
     if ((sdc & SE_SACL_PROTECTED) == SE_SACL_PROTECTED) // NT5.0
          _tprintf(TEXT(".................... SE_SACL_PROTECTED\n"));
     if ((sdc & SE_DACL_PROTECTED) == SE_DACL_PROTECTED) // NT5.0
          _tprintf(TEXT(".................... SE_DACL_PROTECTED\n"));
}

void DumpDacl | ( | PSECURITY_DESCRIPTOR | psd,
 |  | TCHAR | c,
 |  | BOOL | bDacl
 | ) |  |

Definition at line 115 of file SD.c.

{
     ACCESS_ALLOWED_ACE *pace;
     BOOL                bDaclPresent;
     BOOL                bDaclDefaulted;
     DWORD               dwAceCount;
     DWORD               cbName;
     DWORD               cbReferencedDomainName;
     DWORD               dwSize;
     int                 i;
     PACL                pacl;
     PSID                psid = NULL;
     SID_NAME_USE        snu;
     TCHAR               szName[UNLEN];
     TCHAR               szReferencedDomainName[DNLEN];
     TCHAR               szSidText[256];
     TCHAR               szSidType[][17] = {TEXT("User"), TEXT("Group"), TEXT("Domain"), TEXT("Alias"), TEXT("Well Known Group"), TEXT("Deleted Account"), TEXT("Invalid"), TEXT("Unknown")};

     if (bDacl){
          if (!GetSecurityDescriptorDacl(psd, &bDaclPresent, &pacl, &bDaclDefaulted))
               DisplayError(GetLastError(), TEXT("GetSecurityDescriptorDacTEXT("));
     }
     else{
          if (!GetSecurityDescriptorSacl(psd, &bDaclPresent, &pacl, &bDaclDefaulted))
               DisplayError(GetLastError(), TEXT("GetSecurityDescriptorSacTEXT("));
     }

     if (bDaclPresent){
          //
          // dump the dacl
          //
          if (pacl == NULL){
               if (bDacl)
                    _tprintf(TEXT("\ndacl ............... NULL\n"));
               else
                    _tprintf(TEXT("\nsacl ............... NULL\n"));
          }
          else{
               dwAceCount = DumpAclInfo(pacl, bDacl);

               for (i = 0; i < (int)dwAceCount; i++){
                    if (!GetAce(pacl, i, (LPVOID)&pace))
                         DisplayError(GetLastError(), TEXT("GetAce"));

                    _tprintf(TEXT("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"));
                    _tprintf(TEXT(">>                  ACE #%u                             >>\n"), i+1);
                    _tprintf(TEXT(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n\n"));
                    _tprintf(TEXT("type ............... "));

                    switch(pace->Header.AceType){
                         case ACCESS_ALLOWED_ACE_TYPE:
                              _tprintf(TEXT("ACCESS_ALLOWED_ACE\n"));
                              break;
                         case ACCESS_DENIED_ACE_TYPE:
                              _tprintf(TEXT("ACCESS_DENIED_ACE\n"));
                              break;
                         case SYSTEM_AUDIT_ACE_TYPE:
                              _tprintf(TEXT("SYSTEM_AUDIT_ACE\n"));
                              break;
                         case ACCESS_ALLOWED_OBJECT_ACE_TYPE: // NT5.0
                              _tprintf(TEXT("ACCESS_ALLOWED_OBJECT_ACE_TYPE\n"));
                              break;
                         case ACCESS_DENIED_OBJECT_ACE_TYPE: // NT5.0
                              _tprintf(TEXT("ACCESS_DENIED_OBJECT_ACE_TYPE\n"));
                              break;
                         case SYSTEM_AUDIT_OBJECT_ACE_TYPE: // NT5.0
                              _tprintf(TEXT("SYSTEM_AUDIT_OBJECT_ACE_TYPE\n"));
                              break;
                    }

                    _tprintf(TEXT("flags .............. 0x%X\n"), pace->Header.AceFlags);

                    if ((pace->Header.AceFlags & CONTAINER_INHERIT_ACE) == CONTAINER_INHERIT_ACE)
                         _tprintf(TEXT(".................... CONTAINER_INHERIT_ACE\n"));

                    if ((pace->Header.AceFlags & INHERIT_ONLY_ACE) == INHERIT_ONLY_ACE)
                         _tprintf(TEXT(".................... INHERIT_ONLY_ACE\n"));

                    if ((pace->Header.AceFlags & NO_PROPAGATE_INHERIT_ACE) == NO_PROPAGATE_INHERIT_ACE)
                         _tprintf(TEXT(".................... NO_PROPAGATE_INHERIT_ACE\n"));

                    if ((pace->Header.AceFlags & OBJECT_INHERIT_ACE) == OBJECT_INHERIT_ACE)
                         _tprintf(TEXT(".................... OBJECT_INHERIT_ACE\n"));

                    if ((pace->Header.AceFlags & FAILED_ACCESS_ACE_FLAG) == FAILED_ACCESS_ACE_FLAG)
                         _tprintf(TEXT(".................... FAILED_ACCESS_ACE_FLAG\n"));

                    if ((pace->Header.AceFlags & SUCCESSFUL_ACCESS_ACE_FLAG) == SUCCESSFUL_ACCESS_ACE_FLAG)
                         _tprintf(TEXT(".................... SUCCESSFUL_ACCESS_ACE_FLAG\n"));

                    if ((pace->Header.AceFlags & INHERITED_ACE) == INHERITED_ACE) // NT5.0
                         _tprintf(TEXT(".................... INHERITED_ACE\n"));

                    _tprintf(TEXT("size ............... %u byte(s)\n"), pace->Header.AceSize);
                    _tprintf(TEXT("mask ............... 0x%X\n"), pace->Mask);

                    switch (c){
                         case 'r':
                              //
                              // registry SPECIFIC access rights
                              //
                              if ((pace->Mask & KEY_CREATE_LINK) == KEY_CREATE_LINK)
                                   _tprintf(TEXT(".................... KEY_CREATE_LINK\n"));
                              if ((pace->Mask & KEY_CREATE_SUB_KEY) == KEY_CREATE_SUB_KEY)
                                   _tprintf(TEXT(".................... KEY_CREATE_SUB_KEY\n"));
                              if ((pace->Mask & KEY_ENUMERATE_SUB_KEYS) == KEY_ENUMERATE_SUB_KEYS)
                                   _tprintf(TEXT(".................... KEY_ENUMERATE_SUB_KEYS\n"));
                              if ((pace->Mask & KEY_EXECUTE) == KEY_EXECUTE)
                                   _tprintf(TEXT(".................... KEY_EXECUTE\n"));
                              if ((pace->Mask & KEY_NOTIFY) == KEY_NOTIFY)
                                   _tprintf(TEXT(".................... KEY_NOTIFY\n"));
                              if ((pace->Mask & KEY_QUERY_VALUE) == KEY_QUERY_VALUE)
                                   _tprintf(TEXT(".................... KEY_QUERY_VALUE\n"));
                              if ((pace->Mask & KEY_READ) == KEY_READ)
                                   _tprintf(TEXT(".................... KEY_READ\n"));
                              if ((pace->Mask & KEY_SET_VALUE) == KEY_SET_VALUE)
                                   _tprintf(TEXT(".................... KEY_SET_VALUE\n"));
                              if ((pace->Mask & KEY_WRITE) == KEY_WRITE)
                                   _tprintf(TEXT(".................... KEY_WRITE\n"));
                              break;
                         case 'f':
                              if ((pace->Mask & FILE_READ_DATA) == FILE_READ_DATA)
                                   _tprintf(TEXT(".................... FILE_READ_DATA\n"));
                              if ((pace->Mask & FILE_WRITE_DATA) == FILE_WRITE_DATA)
                                   _tprintf(TEXT(".................... FILE_WRITE_DATA\n"));
                              if ((pace->Mask & FILE_APPEND_DATA) == FILE_APPEND_DATA)
                                   _tprintf(TEXT(".................... FILE_APPEND_DATA\n"));
                              if ((pace->Mask & FILE_READ_EA) == FILE_READ_EA)
                                   _tprintf(TEXT(".................... FILE_READ_EA\n"));
                              if ((pace->Mask & FILE_WRITE_EA) == FILE_WRITE_EA)
                                   _tprintf(TEXT(".................... FILE_WRITE_EA\n"));
                              if ((pace->Mask & FILE_EXECUTE) == FILE_EXECUTE)
                                   _tprintf(TEXT(".................... FILE_EXECUTE\n"));
                              if ((pace->Mask & FILE_READ_ATTRIBUTES) == FILE_READ_ATTRIBUTES)
                                   _tprintf(TEXT(".................... FILE_READ_ATTRIBUTES\n"));
                              if ((pace->Mask & FILE_WRITE_ATTRIBUTES) == FILE_WRITE_ATTRIBUTES)
                                   _tprintf(TEXT(".................... FILE_WRITE_ATTRIBUTES\n"));
                              break;
                         case 'd':
                              if ((pace->Mask & FILE_LIST_DIRECTORY) == FILE_LIST_DIRECTORY)
                                   _tprintf(TEXT(".................... FILE_LIST_DIRECTORY\n"));
                              if ((pace->Mask & FILE_ADD_FILE) == FILE_ADD_FILE)
                                   _tprintf(TEXT(".................... FILE_ADD_FILE\n"));
                              if ((pace->Mask & FILE_ADD_SUBDIRECTORY) == FILE_ADD_SUBDIRECTORY)
                                   _tprintf(TEXT(".................... FILE_ADD_SUBDIRECTORY\n"));
                              if ((pace->Mask & FILE_READ_EA) == FILE_READ_EA)
                                   _tprintf(TEXT(".................... FILE_READ_EA\n"));
                              if ((pace->Mask & FILE_WRITE_EA) == FILE_WRITE_EA)
                                   _tprintf(TEXT(".................... FILE_WRITE_EA\n"));
                              if ((pace->Mask & FILE_TRAVERSE) == FILE_TRAVERSE)
                                   _tprintf(TEXT(".................... FILE_TRAVERSE\n"));
                              if ((pace->Mask & FILE_DELETE_CHILD) == FILE_DELETE_CHILD)
                                   _tprintf(TEXT(".................... FILE_DELETE_CHILD\n"));
                              if ((pace->Mask & FILE_READ_ATTRIBUTES) == FILE_READ_ATTRIBUTES)
                                   _tprintf(TEXT(".................... FILE_READ_ATTRIBUTES\n"));
                              if ((pace->Mask & FILE_WRITE_ATTRIBUTES) == FILE_WRITE_ATTRIBUTES)
                                   _tprintf(TEXT(".................... FILE_WRITE_ATTRIBUTES\n"));
                              break;
                         case 'e':
                              if ((pace->Mask & EVENT_MODIFY_STATE) == EVENT_MODIFY_STATE)
                                   _tprintf(TEXT(".................... EVENT_MODIFY_STATE\n"));
                              break;
                         case 'm':
                              if ((pace->Mask & MUTANT_QUERY_STATE) == MUTANT_QUERY_STATE)
                                   _tprintf(TEXT(".................... MUTANT_QUERY_STATE\n"));
                              break;
                         case 's':
                              if ((pace->Mask & SEMAPHORE_MODIFY_STATE) == SEMAPHORE_MODIFY_STATE)
                                   _tprintf(TEXT(".................... SEMAPHORE_MODIFY_STATE\n"));
                              break;
                         case 'p':
                              if ((pace->Mask & PROCESS_TERMINATE) == PROCESS_TERMINATE)
                                   _tprintf(TEXT(".................... PROCESS_TERMINATE\n"));
                              if ((pace->Mask & PROCESS_CREATE_THREAD) == PROCESS_CREATE_THREAD)
                                   _tprintf(TEXT(".................... PROCESS_CREATE_THREAD\n"));
                              if ((pace->Mask & PROCESS_VM_OPERATION) == PROCESS_VM_OPERATION)
                                   _tprintf(TEXT(".................... PROCESS_VM_OPERATION\n"));
                              if ((pace->Mask & PROCESS_VM_READ) == PROCESS_VM_READ)
                                   _tprintf(TEXT(".................... PROCESS_VM_READ\n"));
                              if ((pace->Mask & PROCESS_VM_WRITE) == PROCESS_VM_WRITE)
                                   _tprintf(TEXT(".................... PROCESS_VM_WRITE\n"));
                              if ((pace->Mask & PROCESS_DUP_HANDLE) == PROCESS_DUP_HANDLE)
                                   _tprintf(TEXT(".................... PROCESS_DUP_HANDLE\n"));
                              if ((pace->Mask & PROCESS_CREATE_PROCESS) == PROCESS_CREATE_PROCESS)
                                   _tprintf(TEXT(".................... PROCESS_CREATE_PROCESS\n"));
                              if ((pace->Mask & PROCESS_SET_QUOTA) == PROCESS_SET_QUOTA)
                                   _tprintf(TEXT(".................... PROCESS_SET_QUOTA\n"));
                              if ((pace->Mask & PROCESS_SET_INFORMATION) == PROCESS_SET_INFORMATION)
                                   _tprintf(TEXT(".................... PROCESS_SET_INFORMATION\n"));
                              if ((pace->Mask & PROCESS_QUERY_INFORMATION) == PROCESS_QUERY_INFORMATION)
                                   _tprintf(TEXT(".................... PROCESS_QUERY_INFORMATION\n"));
                              break;
                         case 'i':
                              if ((pace->Mask & SECTION_QUERY) == SECTION_QUERY)
                                   _tprintf(TEXT(".................... SECTION_QUERY\n"));
                              if ((pace->Mask & SECTION_MAP_WRITE) == SECTION_MAP_WRITE)
                                   _tprintf(TEXT(".................... SECTION_MAP_WRITE\n"));
                              if ((pace->Mask & SECTION_MAP_READ) == SECTION_MAP_READ)
                                   _tprintf(TEXT(".................... SECTION_MAP_READ\n"));
                              if ((pace->Mask & SECTION_MAP_EXECUTE) == SECTION_MAP_EXECUTE)
                                   _tprintf(TEXT(".................... SECTION_MAP_EXECUTE\n"));
                              if ((pace->Mask & SECTION_EXTEND_SIZE) == SECTION_EXTEND_SIZE)
                                   _tprintf(TEXT(".................... SECTION_EXTEND_SIZE\n"));
                              break;
                         case 'v':
                              if ((pace->Mask & SERVICE_CHANGE_CONFIG) == SERVICE_CHANGE_CONFIG)
                                   _tprintf(TEXT(".................... SERVICE_CHANGE_CONFIG\n"));
                              if ((pace->Mask & SERVICE_ENUMERATE_DEPENDENTS) == SERVICE_ENUMERATE_DEPENDENTS)
                                   _tprintf(TEXT(".................... SERVICE_ENUMERATE_DEPENDENTS\n"));
                              if ((pace->Mask & SERVICE_INTERROGATE) == SERVICE_INTERROGATE)
                                   _tprintf(TEXT(".................... SERVICE_INTERROGATE\n"));
                              if ((pace->Mask & SERVICE_PAUSE_CONTINUE) == SERVICE_PAUSE_CONTINUE)
                                   _tprintf(TEXT(".................... SERVICE_PAUSE_CONTINUE\n"));
                              if ((pace->Mask & SERVICE_QUERY_CONFIG) == SERVICE_QUERY_CONFIG)
                                   _tprintf(TEXT(".................... SERVICE_QUERY_CONFIG\n"));
                              if ((pace->Mask & SERVICE_QUERY_STATUS) == SERVICE_QUERY_STATUS)
                                   _tprintf(TEXT(".................... SERVICE_QUERY_STATUS\n"));
                              if ((pace->Mask & SERVICE_START) == SERVICE_START)
                                   _tprintf(TEXT(".................... SERVICE_START\n"));
                              if ((pace->Mask & SERVICE_STOP) == SERVICE_STOP)
                                   _tprintf(TEXT(".................... SERVICE_STOP\n"));
                              if ((pace->Mask & SERVICE_USER_DEFINED_CONTROL) == SERVICE_USER_DEFINED_CONTROL)
                                   _tprintf(TEXT(".................... SERVICE_USER_DEFINED_CONTROL\n"));
                              break;
                         case 'w':
                              if ((pace->Mask & WINSTA_ACCESSCLIPBOARD) == WINSTA_ACCESSCLIPBOARD)
                                   _tprintf(TEXT(".................... WINSTA_ACCESSCLIPBOARD\n"));
                              if ((pace->Mask & WINSTA_ACCESSGLOBALATOMS) == WINSTA_ACCESSGLOBALATOMS)
                                   _tprintf(TEXT(".................... WINSTA_ACCESSGLOBALATOMS\n"));
                              if ((pace->Mask & WINSTA_CREATEDESKTOP) == WINSTA_CREATEDESKTOP)
                                   _tprintf(TEXT(".................... WINSTA_CREATEDESKTOP\n"));
                              if ((pace->Mask & WINSTA_ENUMDESKTOPS) == WINSTA_ENUMDESKTOPS)
                                   _tprintf(TEXT(".................... WINSTA_ENUMDESKTOPS\n"));
                              if ((pace->Mask & WINSTA_ENUMERATE) == WINSTA_ENUMERATE)
                                   _tprintf(TEXT(".................... WINSTA_ENUMERATE\n"));
                              if ((pace->Mask & WINSTA_EXITWINDOWS) == WINSTA_EXITWINDOWS)
                                   _tprintf(TEXT(".................... WINSTA_EXITWINDOWS\n"));
                              if ((pace->Mask & WINSTA_READATTRIBUTES) == WINSTA_READATTRIBUTES)
                                   _tprintf(TEXT(".................... WINSTA_READATTRIBUTES\n"));
                              if ((pace->Mask & WINSTA_READSCREEN) == WINSTA_READSCREEN)
                                   _tprintf(TEXT(".................... WINSTA_READSCREEN\n"));
                              if ((pace->Mask & WINSTA_WRITEATTRIBUTES) == WINSTA_WRITEATTRIBUTES)
                                   _tprintf(TEXT(".................... WINSTA_WRITEATTRIBUTES\n"));
                              break;
                         case 'k':
                              if ((pace->Mask & DESKTOP_CREATEMENU) == DESKTOP_CREATEMENU)
                                   _tprintf(TEXT(".................... DESKTOP_CREATEMENU\n"));
                              if ((pace->Mask & DESKTOP_CREATEWINDOW) == DESKTOP_CREATEWINDOW)
                                   _tprintf(TEXT(".................... DESKTOP_CREATEWINDOW\n"));
                              if ((pace->Mask & DESKTOP_ENUMERATE) == DESKTOP_ENUMERATE)
                                  _tprintf(TEXT(".................... DESKTOP_ENUMERATE\n"));
                              if ((pace->Mask & DESKTOP_HOOKCONTROL) == DESKTOP_HOOKCONTROL)
                                   _tprintf(TEXT(".................... DESKTOP_HOOKCONTROL\n"));
                              if ((pace->Mask & DESKTOP_JOURNALPLAYBACK) == DESKTOP_JOURNALPLAYBACK)
                                   _tprintf(TEXT(".................... DESKTOP_JOURNALPLAYBACK\n"));
                              if ((pace->Mask & DESKTOP_JOURNALRECORD) == DESKTOP_JOURNALRECORD)
                                   _tprintf(TEXT(".................... DESKTOP_JOURNALRECORD\n"));
                              if ((pace->Mask & DESKTOP_READOBJECTS) == DESKTOP_READOBJECTS)
                                   _tprintf(TEXT(".................... DESKTOP_READOBJECTS\n"));
                              if ((pace->Mask & DESKTOP_SWITCHDESKTOP) == DESKTOP_SWITCHDESKTOP)
                                   _tprintf(TEXT(".................... DESKTOP_SWITCHDESKTOP\n"));
                              if ((pace->Mask & DESKTOP_WRITEOBJECTS) == DESKTOP_WRITEOBJECTS)
                                   _tprintf(TEXT(".................... DESKTOP_WRITEOBJECTS\n"));
                              break;
                         case 'l':
                              if ((pace->Mask & SERVER_ACCESS_ADMINISTER) == SERVER_ACCESS_ADMINISTER)
                                   _tprintf(TEXT(".................... SERVER_ACCESS_ADMINISTER\n"));
                              if ((pace->Mask & SERVER_ACCESS_ENUMERATE) == SERVER_ACCESS_ENUMERATE)
                                   _tprintf(TEXT(".................... SERVER_ACCESS_ENUMERATE\n"));
                              if ((pace->Mask & PRINTER_ACCESS_ADMINISTER) == PRINTER_ACCESS_ADMINISTER)
                                   _tprintf(TEXT(".................... PRINTER_ACCESS_ADMINISTER\n"));
                              if ((pace->Mask & PRINTER_ACCESS_USE) == PRINTER_ACCESS_USE)
                                    _tprintf(TEXT(".................... PRINTER_ACCESS_USE\n"));
                              if ((pace->Mask & JOB_ACCESS_ADMINISTER) == JOB_ACCESS_ADMINISTER)
                                   _tprintf(TEXT(".................... JOB_ACCESS_ADMINISTER\n"));
                              break;
                         case 't':
                              if ((pace->Mask & READ) == READ)
                                   _tprintf(TEXT(".................... READ\n"));
                              if ((pace->Mask & CHANGE) == CHANGE)
                                   _tprintf(TEXT(".................... CHANGE\n"));
                              if ((pace->Mask & WRITE) == WRITE)
                                   _tprintf(TEXT(".................... WRITE\n"));
                              break;
                         case 'o':
                              if ((pace->Mask & TOKEN_ADJUST_DEFAULT) == TOKEN_ADJUST_DEFAULT)
                                   _tprintf(TEXT(".................... TOKEN_ADJUST_DEFAULT\n"));
                              if ((pace->Mask & TOKEN_ADJUST_GROUPS) == TOKEN_ADJUST_GROUPS)
                                   _tprintf(TEXT(".................... TOKEN_ADJUST_GROUPSE\n"));
                              if ((pace->Mask & TOKEN_ADJUST_PRIVILEGES) == TOKEN_ADJUST_PRIVILEGES)
                                  _tprintf(TEXT(".................... TOKEN_ADJUST_PRIVILEGES\n"));
                              if ((pace->Mask & TOKEN_ALL_ACCESS) == TOKEN_ALL_ACCESS)
                                  _tprintf(TEXT(".................... TOKEN_ALL_ACCESS\n"));
                              if ((pace->Mask & TOKEN_ASSIGN_PRIMARY) == TOKEN_ASSIGN_PRIMARY)
                                  _tprintf(TEXT(".................... TOKEN_ASSIGN_PRIMARY\n"));
                              if ((pace->Mask & TOKEN_DUPLICATE) == TOKEN_DUPLICATE)
                                  _tprintf(TEXT(".................... TOKEN_DUPLICATE\n"));
                              if ((pace->Mask & TOKEN_EXECUTE) == TOKEN_EXECUTE)
                                  _tprintf(TEXT(".................... TOKEN_EXECUTE\n"));
                              if ((pace->Mask & TOKEN_IMPERSONATE) == TOKEN_IMPERSONATE)
                                  _tprintf(TEXT(".................... TOKEN_IMPERSONATE\n"));
                              if ((pace->Mask & TOKEN_QUERY) == TOKEN_QUERY)
                                  _tprintf(TEXT(".................... TOKEN_QUERY\n"));
                              if ((pace->Mask & TOKEN_QUERY_SOURCE) == TOKEN_QUERY_SOURCE)
                                  _tprintf(TEXT(".................... TOKEN_QUERY_SOURCE\n"));
                              if ((pace->Mask & TOKEN_READ) == TOKEN_READ)
                                  _tprintf(TEXT(".................... TOKEN_READ\n"));
                              if ((pace->Mask & TOKEN_WRITE) == TOKEN_WRITE)
                                  _tprintf(TEXT(".................... TOKEN_WRITE\n"));
                              break;
                         case 'n':
                         case 'a':
                              break;
                         default:
                              break;
                    }

               //
               // object rights
               //
               if ((pace->Mask & READ_CONTROL) == READ_CONTROL)
                    _tprintf(TEXT(".................... READ_CONTROL\n"));
               if ((pace->Mask & WRITE_OWNER) == WRITE_OWNER)
                    _tprintf(TEXT(".................... WRITE_OWNER\n"));
               if ((pace->Mask & WRITE_DAC) == WRITE_DAC)
                    _tprintf(TEXT(".................... WRITE_DAC\n"));
               if ((pace->Mask & DELETE) == DELETE)
                    _tprintf(TEXT(".................... DELETE\n"));
               if ((pace->Mask & SYNCHRONIZE) == SYNCHRONIZE)
                    _tprintf(TEXT(".................... SYNCHRONIZE\n"));
               if ((pace->Mask & ACCESS_SYSTEM_SECURITY) == ACCESS_SYSTEM_SECURITY)
                    _tprintf(TEXT(".................... ACCESS_SYSTEM_SECURITY\n"));

               //
               // GENERIC access rights
               //
               if ((pace->Mask & GENERIC_ALL) == GENERIC_ALL)
                    _tprintf(TEXT(".................... GENERIC_ALL\n"));
               if ((pace->Mask & GENERIC_EXECUTE) == GENERIC_EXECUTE)
                    _tprintf(TEXT(".................... GENERIC_EXECUTE\n"));
               if ((pace->Mask & GENERIC_READ) == GENERIC_READ)
                    _tprintf(TEXT(".................... GENERIC_READ\n"));
               if ((pace->Mask & GENERIC_WRITE) == GENERIC_WRITE)
                    _tprintf(TEXT(".................... GENERIC_WRITE\n"));

               //
               // display sid
               //
               cbName = sizeof(szName);
               cbReferencedDomainName = sizeof(szReferencedDomainName);
               ZeroMemory(szName, cbName);
               ZeroMemory(szReferencedDomainName, cbReferencedDomainName);

               if (!LookupAccountSid(NULL, &(pace->SidStart), szName, &cbName, szReferencedDomainName, &cbReferencedDomainName, &snu)){
                    if (GetLastError() == ERROR_NONE_MAPPED)
                         LookupAccountOtherSid(&(pace->SidStart), szName, &cbName, szReferencedDomainName, &cbReferencedDomainName, &snu);
                    else
                         DisplayError(GetLastError(), TEXT("LookupAccountSid"));
               }

               _tprintf(TEXT("\nuser ............... %s\\%s\n"), szReferencedDomainName, szName);
               dwSize = sizeof(szSidText);
               ZeroMemory(szSidText, dwSize);
               ConvertSid(&(pace->SidStart), szSidText, &dwSize);
               _tprintf(TEXT("sid ................ %s\n"), szSidText);
               _tprintf(TEXT("sid type ........... %s\n"), szSidType[snu-1]);
               _tprintf(TEXT("sid size ........... %u bytes\n"), GetLengthSid(&(pace->SidStart)));
         }
          }
         }
     else{
          _tprintf(TEXT("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"));
          if (bDacl)
               _tprintf(TEXT(">>                 NO DACL PRESENT                     >>\n"));
          else
               _tprintf(TEXT(">>                 NO SACL PRESENT                     >>\n"));

          _tprintf(TEXT(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n\n"));
     }
}

void DumpOwnerGroup | ( | PSECURITY_DESCRIPTOR | psd,
 |  | BOOL | bOwner
 | ) |  |

Definition at line 497 of file SD.c.

{
     BOOL         bOwnerDefaulted;
     TCHAR        szSidType[][17] = {TEXT("User"), TEXT("Group"), TEXT("Domain"), TEXT("Alias"), TEXT("Well Known Group"), TEXT("Deleted Account"), TEXT("Invalid"), TEXT("Unknown")};
     PSID         psid = NULL;
     SID_NAME_USE snu;
     TCHAR        szName[UNLEN];
     TCHAR        szReferencedDomainName[DNLEN];
     DWORD        cbName = sizeof(szName);
     DWORD        cbReferencedDomainName = sizeof(szReferencedDomainName);
     TCHAR        szSidText[256] = TEXT("");
     DWORD        dwSize = sizeof(szSidText);
     TCHAR        szType[6]      = TEXT("");

     if (bOwner){
          if (!GetSecurityDescriptorOwner(psd, &psid, &bOwnerDefaulted))
               DisplayError(GetLastError(), TEXT("GetSecurityDescriptorOwner"));
               if (!lstrcpy(szType, TEXT("owner")))
                    DisplayError(GetLastError(), TEXT("lstrcpy"));
         }
     else{
          if (!GetSecurityDescriptorGroup(psd, &psid, &bOwnerDefaulted))
               DisplayError(GetLastError(), TEXT("GetSecurityDescriptorGroup"));
               if(!lstrcpy(szType, TEXT("group")))
                    DisplayError(GetLastError(), TEXT("lstrcpy"));
         }

     if (psid == NULL)
          _tprintf(TEXT("%s .............. none\n"), szType);
     else{
          ZeroMemory(szName, cbName);
          ZeroMemory(szReferencedDomainName, cbReferencedDomainName);

          //
          // get the owner of the sid
          //
          if (!LookupAccountSid(NULL, psid, szName, &cbName, szReferencedDomainName, &cbReferencedDomainName, &snu)){
               if (GetLastError() != ERROR_NONE_MAPPED)
                    DisplayError(GetLastError(), TEXT("LookupAccountSid"));
          }

          _tprintf(TEXT("\n%s .............. %s\\%s\n"), szType, szReferencedDomainName, szName);
          ConvertSid(psid, szSidText, &dwSize);
          _tprintf(TEXT("sid ................ %s\n"), szSidText);
          _tprintf(TEXT("sid type ........... %s\n"), szSidType[snu-1]);
     }
}

void DumpSD | ( | PSECURITY_DESCRIPTOR | psd,
 |  | TCHAR | c
 | ) |  |

Definition at line 545 of file SD.c.

{
     //
     // dump security descriptor information
     //
     DumpSDInfo(psd);

     //
     // dump the control bits
     //
     DumpControl(psd);

     //
     // get the owner
     //
     DumpOwnerGroup(psd, TRUE);

     //
     // get the group
     //
     DumpOwnerGroup(psd, FALSE);

     //
     // get the dacl
     //
     DumpDacl(psd, c, TRUE);

     //
     // get the sacl
     //
     DumpDacl(psd, c, FALSE);
}

void DumpSDInfo ( PSECURITY_DESCRIPTOR psd )

Definition at line 578 of file SD.c.

{
     DWORD dwSDLength;

     //
     // is the security descriptor valid
     //
     _tprintf(TEXT("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"));
     _tprintf(TEXT(">>          SECURITY DESCRIPTOR INFORMATION            >>\n"));
     _tprintf(TEXT(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n\nvalid .............. "));

     if (!IsValidSecurityDescriptor(psd)){
          _tprintf(TEXT("no\n"));
          return;
     }
     else
          _tprintf(TEXT("yes\n"));

     //
     // security descriptor size???
     //
     dwSDLength = GetSecurityDescriptorLength(psd);

     _tprintf(TEXT("length ............. %u byte(s)\n"), dwSDLength);
}

Generated on Wed Nov 13 2024 16:54:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/Authorization/Check_SD/SecObjects.c File Reference

  • Security
  • Authorization
  • Check_SD
Functions

SecObjects.c File Reference

#include "check_sd.h"
#include <lm.h>
#include <tchar.h>
#include <stdio.h>

Go to the source code of this file.

Functions

void | DumpFile (LPTSTR pszFile, TCHAR c)
void | DumpKernelObject (LPTSTR pszObject, TCHAR c)
void | DumpNetShare (LPTSTR pszShare)
void | DumpPrinter (LPTSTR pszPrinter)
void | DumpRegistryKey (LPTSTR pszKey)
void | DumpService (LPTSTR pszServer, LPTSTR pszService)
void | DumpUserObject (LPTSTR pszObject, TCHAR c)

Function Documentation

void DumpFile | ( | LPTSTR | pszFile,
 |  | TCHAR | c
 | ) |  |

Definition at line 34 of file SecObjects.c.

{
     DWORD                dwSize = 0;
     PSECURITY_DESCRIPTOR psd = NULL;
     SECURITY_INFORMATION si  = OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION | SACL_SECURITY_INFORMATION;

     //
     // enable the privilege
     //
     Privilege(SE_SECURITY_NAME, TRUE);

     //
     // get the size
     //
     if (!GetFileSecurity(pszFile, si, psd, dwSize, &dwSize)){
          if (GetLastError() == ERROR_INSUFFICIENT_BUFFER){
               psd = (PSECURITY_DESCRIPTOR)LocalAlloc(LPTR, dwSize);
               if (psd == NULL)
                    DisplayError(GetLastError(), TEXT("LocalAlloc"));

          if (!GetFileSecurity(pszFile, si, psd, dwSize, &dwSize))
               DisplayError(GetLastError(), TEXT("GetFileSecurity"));
          }
          else
               DisplayError(GetLastError(), TEXT("GetFileSecurity"));
     }
   else{
          printf("GetFileSecurity succeeded when it was expected to fail.\n");
      ExitProcess(0);
   }

     //
     // enable the privilege
     //
     Privilege(SE_SECURITY_NAME, FALSE);

     //
     // dump security descriptor
     //
     DumpSD(psd, c);

     //
     // free the buffer
     //
   if (NULL != psd)
   {
          if (LocalFree((HLOCAL)psd))
               DisplayError(GetLastError(), TEXT("LocalFree"));
   }
}

void DumpKernelObject | ( | LPTSTR | pszObject,
 |  | TCHAR | c
 | ) |  |

Definition at line 85 of file SecObjects.c.

{
     DWORD                dwPid;
     DWORD                dwSize = 0;
     HANDLE               hObject;
     HANDLE               hProcess;
     PSECURITY_DESCRIPTOR psd = NULL;
     SECURITY_INFORMATION si  = OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION | SACL_SECURITY_INFORMATION;

     //
     // enable the privilege
     //
     Privilege(SE_SECURITY_NAME, TRUE);

     //
     // obtain a handle
     //
     switch (c){
          case 'e':
               hObject = OpenEvent(READ_CONTROL | ACCESS_SYSTEM_SECURITY, FALSE, pszObject);
               if (hObject == NULL)
                    DisplayError(GetLastError(), TEXT("OpenEvent"));
               break;
          case 'm':
               hObject = OpenMutex(READ_CONTROL | ACCESS_SYSTEM_SECURITY, FALSE, pszObject);
               if (hObject == NULL)
                    DisplayError(GetLastError(), TEXT("OpenMutex"));
               break;
          case 's':
               hObject = OpenSemaphore(READ_CONTROL | ACCESS_SYSTEM_SECURITY, FALSE, pszObject);
               if (hObject == NULL)
                    DisplayError(GetLastError(), TEXT("OpenSemaphore"));
               break;
          case 'p':
               //
               // convert name to a pid
               //
               dwPid = _ttol(pszObject);

               hObject = OpenProcess(READ_CONTROL | ACCESS_SYSTEM_SECURITY, FALSE, dwPid);
               if (hObject == NULL)
                    DisplayError(GetLastError(), TEXT("OpenProcess"));
               break;

          case 'o':
               dwPid = _ttol(pszObject);

               //
               // SD in access token does not support SACLS
               //
               si  = OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION;

               hProcess= OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, dwPid);
               if (hProcess == NULL)
                    DisplayError(GetLastError(), TEXT("OpenProcess"));

               if (!OpenProcessToken(hProcess, READ_CONTROL, &hObject))
                    DisplayError(GetLastError(), TEXT("OpenProcessToken"));

               if (!CloseHandle(hProcess))
                    DisplayError(GetLastError(), TEXT("CloseHandle"));
               break;
          case 'i':
               hObject = OpenFileMapping(READ_CONTROL | ACCESS_SYSTEM_SECURITY, FALSE, pszObject);
               if (hObject == NULL)
                    DisplayError(GetLastError(), TEXT("OpenFileMapping"));
               break;
          case 'a':
          case 'n':
               hObject = CreateFile(pszObject, READ_CONTROL | ACCESS_SYSTEM_SECURITY, 0, NULL, OPEN_EXISTING, 0, NULL);
               if (hObject == INVALID_HANDLE_VALUE)
                    DisplayError(GetLastError(), TEXT("CreateFile"));
          default:
               break;
     }

     //
     // disable the privilege
     //
     Privilege(SE_SECURITY_NAME, FALSE);

     //
     // obtain the size
     //
     if (!GetKernelObjectSecurity(hObject, si, psd, dwSize, &dwSize)){
          if (GetLastError() == ERROR_INSUFFICIENT_BUFFER){
               psd = (PSECURITY_DESCRIPTOR)LocalAlloc(LPTR, dwSize);
               if (psd == NULL)
                    DisplayError(GetLastError(), TEXT("LocalAlloc"));

               if (!GetKernelObjectSecurity(hObject, si, psd, dwSize, &dwSize))
                    DisplayError(GetLastError(), TEXT("GetKernelObjectSecurity"));
          }
          else
                DisplayError(GetLastError(), TEXT("GetKernelObjectSecurity"));
     }
   else{
        printf("GetFileSecurity succeeded when it was expected to fail.\n");
      ExitProcess(0);
   }

     //
     // dump security descriptor
     //
     DumpSD(psd, c);

     //
     // free the buffer
     //
   if (NULL != psd)
          if (LocalFree((HLOCAL)psd))
               DisplayError(GetLastError(), TEXT("LocalFree"));

     if (!CloseHandle(hObject))
          DisplayError(GetLastError(), TEXT("CloseHandle"));
}

void DumpNetShare ( LPTSTR pszShare )

Definition at line 202 of file SecObjects.c.

{
     DWORD                dwSize = 0;
     LPTSTR               pszShareAdjusted;
     LPTSTR               pszShareName;
     NET_API_STATUS       nas;
     PSECURITY_DESCRIPTOR psd   = NULL;
     PSHARE_INFO_502      psi502;
     TCHAR                szServer[CNLEN] = TEXT("");

#ifndef UNICODE
     WCHAR                szWServer[CNLEN] = L"";
     WCHAR                szWShare[NNLEN]  = L"";
#endif

     //
     // remove \\ if exists
     //
     pszShareAdjusted = _tcsstr(pszShare, TEXT("\\\\"));
     if (pszShareAdjusted != NULL)
          pszShareAdjusted = pszShareAdjusted + 2;
     else
          pszShareAdjusted = pszShare;

     //
     // find the subkey
     //
     pszShareName = _tcschr(pszShareAdjusted, '\\');
     if (pszShareName == NULL)
          return;
     else
          pszShareName++;

     //
     // find the main key
     //
     if (!_tcsncpy(szServer, pszShareAdjusted, (UINT)(pszShareName - pszShareAdjusted - 1)))
          DisplayError(GetLastError(), TEXT("_tcsncpy"));

#ifndef UNICODE

     //
     // handle ANSI situation
     //
     if (!MultiByteToWideChar(CP_ACP, 0, (LPCTSTR)szServer, -1, szWServer, sizeof(szWServer)))
          DisplayError(GetLastError(), TEXT("MultiByteToWideChar"));

     if(!MultiByteToWideChar(CP_ACP, 0, (LPCTSTR)pszShareName, -1, szWShare, sizeof(szWShare)))
          DisplayError(GetLastError(), TEXT("MultiByteToWideChar"));

     nas = NetShareGetInfo(szWServer, szWShare, 502, (LPBYTE *)&psi502);

#else

     nas = NetShareGetInfo(szServer, pszShareName, 502, (LPBYTE *)&psi502);

#endif

     if (nas != NERR_Success)
          DisplayError(nas, TEXT("NetShareGetInfo"));

     //
     // obtain the SD
     //
     psd = psi502->shi502_security_descriptor;

     //
     // dump security descriptor
     //
     DumpSD(psd, 't');

     //
     // free the buffer
     //
     nas = NetApiBufferFree((LPVOID)psi502);
     if (nas != NERR_Success)
          DisplayError(nas, TEXT("NetApiBufferFree"));

}

void DumpPrinter ( LPTSTR pszPrinter )

Definition at line 283 of file SecObjects.c.

{
     DWORD                dwSize = 0;
     HANDLE               hPrinter;
     PRINTER_DEFAULTS     pd;
     PRINTER_INFO_3       *ppi3 = NULL;
     PSECURITY_DESCRIPTOR psd   = NULL;

     ZeroMemory(&pd, sizeof(PRINTER_DEFAULTS));
     pd.DesiredAccess = READ_CONTROL;

     //
     // obtain a handle to the printer
     //
     if (!OpenPrinter(pszPrinter, &hPrinter, &pd))
          DisplayError(GetLastError(), TEXT("OpenPrinter"));

     //
     // get the size
     //
     if (!GetPrinter(hPrinter, 3, (LPBYTE)ppi3, dwSize, &dwSize)){
          if (GetLastError() == ERROR_INSUFFICIENT_BUFFER){
               ppi3 = (PPRINTER_INFO_3)LocalAlloc(LPTR, dwSize);
               if (ppi3 == NULL)
                    DisplayError(GetLastError(), TEXT("LocalAlloc"));

               if (!GetPrinter(hPrinter, 3, (LPBYTE)ppi3, dwSize, &dwSize))
                    DisplayError(GetLastError(), TEXT("GetPrinter"));
          }
     }
   else{
        printf("GetPrinter succeeded when it was expected to fail.\n");
      ExitProcess(0);
   }

     //
     // cast buffer
     //
     psd = ppi3->pSecurityDescriptor;

     //
     // dump security descriptor information
     //
     DumpSDInfo(psd);

     //
     // dump the control bits
     //
     DumpControl(psd);

     //
     // get the owner
     //
     DumpOwnerGroup(psd, TRUE);

     //
     // get the group
     //
     DumpOwnerGroup(psd, FALSE);

     //
     // get the dacl
     //
     DumpDacl(psd, 'l', TRUE);

     //
     // printer object does not have a SACL
     //

     //
     // free the buffer
     //
     if (!ppi3)
      if (LocalFree((HLOCAL)ppi3))
               DisplayError(GetLastError(), TEXT("LocalFree"));

     if (!ClosePrinter(hPrinter))
          DisplayError(GetLastError(), TEXT("ClosePrinter"));
}

void DumpRegistryKey ( LPTSTR pszKey )

Definition at line 364 of file SecObjects.c.

{
     DWORD                dwAccess = READ_CONTROL;
     DWORD                dwSize = 0;
     HKEY                 hKey;
     HKEY                 hMainKey;
     LONG                 lErrorCode;
     LPTSTR               pszSubKey = NULL;
     PSECURITY_DESCRIPTOR psd = NULL;
     SECURITY_INFORMATION si;
     TCHAR                szMainKey[256] = TEXT("");

     //
     // find the subkey
     //
     pszSubKey = _tcschr(pszKey, '\\');
     if (pszSubKey == NULL){
          if (!lstrcpy(szMainKey, pszKey))
           DisplayError(GetLastError(), TEXT("lstrcpy"));

          si = OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION;
     }
     else{
          pszSubKey++;

          //
          // find the main key
          //
          if(!_tcsncpy(szMainKey, pszKey, (UINT)(pszSubKey - pszKey - 1)))
               DisplayError(GetLastError(), TEXT("_tcsncpy"));

          si = OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION | SACL_SECURITY_INFORMATION;
     }

     //
     // parse the main key
     //
     if (!lstrcmp(szMainKey, TEXT("HKEY_LOCAL_MACHINE"))){
          hMainKey = HKEY_LOCAL_MACHINE;
     }
     else if (!lstrcmp(szMainKey, TEXT("HKEY_CLASSES_ROOT"))){
          hMainKey = HKEY_CLASSES_ROOT;
     }
     else if (!lstrcmp(szMainKey, TEXT("HKEY_USERS"))){
          hMainKey = HKEY_USERS;
     }
     else if (!lstrcmp(szMainKey, TEXT("HKEY_CURRENT_USER"))){
          hMainKey = HKEY_CURRENT_USER;
     }
     else if (!lstrcmp(szMainKey, TEXT("HKEY_CLASSES_ROOT"))){
          hMainKey = HKEY_CLASSES_ROOT;
     }
     else
          hMainKey = 0;

     //
     // enable the privilege
     //
     if (pszSubKey != NULL){
          Privilege(SE_SECURITY_NAME, TRUE);
          dwAccess |= ACCESS_SYSTEM_SECURITY;
     }

     //
     // open the key
     //
     lErrorCode = RegOpenKeyEx(hMainKey, pszSubKey, 0, dwAccess, &hKey);
     if (lErrorCode != ERROR_SUCCESS)
          DisplayError(lErrorCode, TEXT("RegOpenKeyEx"));

     //
     // disable the privilege
     //
     if (pszSubKey != NULL)
          Privilege(SE_SECURITY_NAME, FALSE);

     //
     // get key security information
     //
     lErrorCode = RegGetKeySecurity(hKey, si, psd, &dwSize);
     if (lErrorCode == ERROR_INSUFFICIENT_BUFFER){
          //
          // allocate memory for psd
          //
          psd = (PSECURITY_DESCRIPTOR)LocalAlloc(LPTR, dwSize);
          if (psd == NULL)
               DisplayError(GetLastError(), TEXT("LocalAlloc"));

          //
          // call the api again
          //
          lErrorCode = RegGetKeySecurity(hKey, si, psd, &dwSize);
          if (lErrorCode != ERROR_SUCCESS)
               DisplayError(lErrorCode, TEXT("RegGetKeySecurity"));
     }
     else
          DisplayError(lErrorCode, TEXT("RegGetKeySecurity"));

     //
     // dump security descriptor
     //
     DumpSD(psd, 'r');

     //
     // free the buffer
     //
     if (LocalFree((HLOCAL)psd))
          DisplayError(GetLastError(), TEXT("LocalFree"));

     //
     // close the key
     //
     lErrorCode = RegCloseKey(hKey);
     if (lErrorCode != ERROR_SUCCESS)
          DisplayError(lErrorCode, TEXT("RegCloseKey"));
}

void DumpService | ( | LPTSTR | pszServer,
 |  | LPTSTR | pszService
 | ) |  |

Definition at line 481 of file SecObjects.c.

{
     DWORD                dwSize = 0;
     PSECURITY_DESCRIPTOR psd = (PSECURITY_DESCRIPTOR)1;  // if initialized to NULL, QueryServiceObjectSecurity() returns error code 87
     SC_HANDLE            schService;
     SC_HANDLE            schManager;
     SECURITY_INFORMATION si  = OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION | SACL_SECURITY_INFORMATION;

     schManager = OpenSCManager(pszServer, NULL, SC_MANAGER_CONNECT);
     if (schManager == NULL)
          DisplayError(GetLastError(), TEXT("OpenSCManager"));

     //
     // enable the privilege
     //
     Privilege(SE_SECURITY_NAME, TRUE);

     schService = OpenService(schManager, pszService, READ_CONTROL | ACCESS_SYSTEM_SECURITY);
     if (schService == NULL)
          DisplayError(GetLastError(), TEXT("OpenService"));

     //
     // disable the privilege
     //
     Privilege(SE_SECURITY_NAME, FALSE);

     //
     // obtain the size
     //
     if (!QueryServiceObjectSecurity(schService, si, psd, dwSize, &dwSize)){
          if (GetLastError() == ERROR_INSUFFICIENT_BUFFER){
               psd = (PSECURITY_DESCRIPTOR)LocalAlloc(LPTR, dwSize);
               if (psd == NULL)
                    DisplayError(GetLastError(), TEXT("LocalAlloc"));

          if (!QueryServiceObjectSecurity(schService, si, psd, dwSize, &dwSize))
               DisplayError(GetLastError(), TEXT("QueryServicelObjectSecurity"));
          }
          else
               DisplayError(GetLastError(), TEXT("QueryServiceObjectSecurity"));
     }
   else{
        printf("QueryServiceObjectSecurity succeeded when it was expected to fail.\n");
      ExitProcess(0);
   }

     //
     // dump security descriptor
     //
     DumpSD(psd, 'v');

     //
     // free the buffer
     //
     if(LocalFree((HLOCAL)psd))
        DisplayError(GetLastError(), TEXT("LocalFree"));

     if (!CloseServiceHandle(schService))
          DisplayError(GetLastError(), TEXT("CloseServiceHandle"));

     if (!CloseServiceHandle(schManager))
          DisplayError(GetLastError(), TEXT("CloseServiceHandle"));
}

void DumpUserObject | ( | LPTSTR | pszObject,
 |  | TCHAR | c
 | ) |  |

Definition at line 547 of file SecObjects.c.

{
     DWORD                dwSize = 0;
     HANDLE               hObject;
     HWINSTA              hwinsta;
     HWINSTA              hwinstaCurrent;
     LPTSTR               pszDesktop;
     PSECURITY_DESCRIPTOR psd = NULL;
     SECURITY_INFORMATION si  = OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION | SACL_SECURITY_INFORMATION;
     TCHAR                szWinsta[256] = TEXT("");

     //
     // enable the privilege
     //
     Privilege(SE_SECURITY_NAME, TRUE);

     //
     // obtain a handle
     //
     switch (c){
          case 'w':
               hObject = OpenWindowStation(pszObject, FALSE, READ_CONTROL | ACCESS_SYSTEM_SECURITY);
               if (hObject == NULL)
                    DisplayError(GetLastError(), TEXT("OpenWindowStation"));
               break;

          case 'k':
               //
               // find the desktop
               //
               pszDesktop = _tcschr(pszObject, '\\');
               if (pszDesktop == NULL)
                    return;
               else
                    pszDesktop++;

               //
               // find the main key
               //
               if (!_tcsncpy(szWinsta, pszObject, (UINT)(pszDesktop - pszObject - 1)))
                    DisplayError(GetLastError(), TEXT("_tcsncpy"));

               //
               // obtain a handle to the window station
               //
               hwinsta = OpenWindowStation(szWinsta, FALSE, WINSTA_ENUMDESKTOPS);
               if (hwinsta == NULL)
                    DisplayError(GetLastError(), TEXT("OpenWindowStation"));

               hwinstaCurrent = GetProcessWindowStation();
               if (hwinstaCurrent == NULL)
                    DisplayError(GetLastError(), TEXT("GetProcessWindowStation"));

               if (!SetProcessWindowStation(hwinsta))
                    DisplayError(GetLastError(), TEXT("SetProcessWindowStation"));

               hObject = OpenDesktop(pszDesktop, 0, FALSE, READ_CONTROL | ACCESS_SYSTEM_SECURITY);
               if (hObject == NULL)
                    DisplayError(GetLastError(), TEXT("OpenDesktop"));

               if (!SetProcessWindowStation(hwinstaCurrent))
                    DisplayError(GetLastError(), TEXT("SetProcessWindowStation"));

               if (!CloseWindowStation(hwinsta))
                    DisplayError(GetLastError(), TEXT("CloseWindowStation"));
               break;
          default:
               break;
     }

     //
     // disable the privilege
     //
     Privilege(SE_SECURITY_NAME, FALSE);

     //
     // obtain the size
     //
     if (!GetUserObjectSecurity(hObject, &si, psd, dwSize, &dwSize)){
          if (GetLastError() == ERROR_INSUFFICIENT_BUFFER){
               psd = (PSECURITY_DESCRIPTOR)LocalAlloc(LPTR, dwSize);
               if (psd == NULL)
                    DisplayError(GetLastError(), TEXT("LocalAlloc"));

               if (!GetUserObjectSecurity(hObject, &si, psd, dwSize, &dwSize))
                    DisplayError(GetLastError(), TEXT("GetUserObjectSecurity"));
           }
           else
                DisplayError(GetLastError(), TEXT("GetUserObjectSecurity"));
     }
   else{
        printf("GetUserObjectSecurity succeeded when it was expected to fail.\n");
      ExitProcess(0);
   }

     //
     // dump security descriptor
     //
     DumpSD(psd, c);

     //
     // free the buffer
     //
     if (LocalFree((HLOCAL)psd))
        DisplayError(GetLastError(), TEXT("LocalFree"));

     if (!CloseHandle(hObject))
          DisplayError(GetLastError(), TEXT("CloseHandle"));
}

Generated on Wed Nov 13 2024 16:54:26 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/Authorization/klist/KList.c File Reference

  • Security
  • Authorization
  • klist
Defines | Functions

KList.c File Reference

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <ntsecapi.h>
#include <security.h>

Go to the source code of this file.

Defines

#define | _UNICODE
#define | AddEtype(n) { n, TEXT(#n) }
#define | INTERACTIVE_PURGE 1
#define | MAX_MSG_SIZE 256
#define | SEC_SUCCESS(Status) ((Status) >= 0)
#define | SECURITY_WIN32
#define | UNICODE

Functions

DWORD | GetEncodedTicket (HANDLE LogonHandle, ULONG PackageId, wchar_t *Server)
VOID | InitUnicodeString (PUNICODE_STRING DestinationString, PCWSTR SourceString OPTIONAL)
BOOL | PackageConnectLookup (HANDLE *pLogonHandle, ULONG *pPackageId)
VOID | PrintEType (int etype)
VOID | PrintKerbName (PKERB_EXTERNAL_NAME Name)
VOID | PrintTime (LPSTR Comment, TimeStamp ConvertTime)
VOID | PrintTktFlags (ULONG flags)
BOOL | PurgeTicket (HANDLE LogonHandle, ULONG PackageId, LPWSTR Server, DWORD cbServer, LPWSTR Realm, DWORD cbRealm)
VOID | ShowLastError (LPSTR szAPI, DWORD dwError)
VOID | ShowNTError (LPSTR szAPI, NTSTATUS Status)
BOOL | ShowTgt (HANDLE LogonHandle, ULONG PackageId)
BOOL | ShowTickets (HANDLE LogonHandle, ULONG PackageId, DWORD dwMode)
int __cdecl | wmain (int argc, wchar_t *argv[])

Define Documentation

#define _UNICODE

Definition at line 34 of file KList.c.

#define AddEtype ( n ) { n, TEXT(#n) }
#define INTERACTIVE_PURGE 1

Definition at line 44 of file KList.c.

#define MAX_MSG_SIZE 256
#define SEC_SUCCESS ( Status ) ((Status) >= 0)

Definition at line 46 of file KList.c.

#define SECURITY_WIN32

Definition at line 41 of file KList.c.

#define UNICODE

Definition at line 33 of file KList.c.

Function Documentation

DWORD GetEncodedTicket | ( | HANDLE | LogonHandle,
 |  | ULONG | PackageId,
 |  | wchar_t * | Server
 | ) |  |

Definition at line 585 of file KList.c.

{
    NTSTATUS Status;
    PKERB_RETRIEVE_TKT_REQUEST CacheRequest = NULL;
    PKERB_RETRIEVE_TKT_RESPONSE CacheResponse = NULL;
    PKERB_EXTERNAL_TICKET Ticket;
    ULONG ResponseSize;
    NTSTATUS SubStatus;
    BOOLEAN Trusted = TRUE;
    BOOLEAN Success = FALSE;
    UNICODE_STRING Target = {0};
    UNICODE_STRING Target2 = {0};

    InitUnicodeString( &Target2, Server);

    CacheRequest = (PKERB_RETRIEVE_TKT_REQUEST)
            LocalAlloc(LMEM_ZEROINIT, Target2.Length + sizeof(KERB_RETRIEVE_TKT_REQUEST));

    CacheRequest->MessageType = KerbRetrieveEncodedTicketMessage ;
    CacheRequest->LogonId.LowPart = 0;
    CacheRequest->LogonId.HighPart = 0;

    Target.Buffer = (LPWSTR) (CacheRequest + 1);
    Target.Length = Target2.Length;
    Target.MaximumLength = Target2.MaximumLength;

    CopyMemory(
        Target.Buffer,
        Target2.Buffer,
        Target2.Length
        );

    CacheRequest->TargetName = Target;

    Status = LsaCallAuthenticationPackage(
                LogonHandle,
                PackageId,
                CacheRequest,
                Target2.Length + sizeof(KERB_RETRIEVE_TKT_REQUEST),
                (PVOID *) &CacheResponse,
                &ResponseSize,
                &SubStatus
                );

    if (!SEC_SUCCESS(Status) || !SEC_SUCCESS(SubStatus))
    {
        ShowNTError("LsaCallAuthenticationPackage", Status);
        printf("Substatus: 0x%x\n",SubStatus);
        ShowNTError("Substatus:", SubStatus);

    }
    else
    {
        Ticket = &(CacheResponse->Ticket);

        printf("\nEncoded Ticket:\n\n");

        printf("ServiceName: "); PrintKerbName(Ticket->ServiceName);

        printf("TargetName: "); PrintKerbName(Ticket->TargetName);

        printf("ClientName: "); PrintKerbName(Ticket->ClientName);

        printf("DomainName: %.*S\n",
            Ticket->DomainName.Length/sizeof(WCHAR),Ticket->DomainName.Buffer);

        printf("TargetDomainName: %.*S\n",
            Ticket->TargetDomainName.Length/sizeof(WCHAR),Ticket->TargetDomainName.Buffer);

        printf("AltTargetDomainName: %.*S\n",
            Ticket->AltTargetDomainName.Length/sizeof(WCHAR),Ticket->AltTargetDomainName.Buffer);

        printf("TicketFlags: (0x%x) ",Ticket->TicketFlags);
        PrintTktFlags(Ticket->TicketFlags);
        PrintTime("KeyExpirationTime: ",Ticket->KeyExpirationTime);
        PrintTime("StartTime: ",Ticket->StartTime);
        PrintTime("EndTime: ",Ticket->EndTime);
        PrintTime("RenewUntil: ",Ticket->RenewUntil);
        PrintTime("TimeSkew: ",Ticket->TimeSkew);
        PrintEType(Ticket->SessionKey.KeyType);

        Success = TRUE;

    }

    if (CacheResponse)
    {
        LsaFreeReturnBuffer(CacheResponse);
    }
    if (CacheRequest)
    {
        LocalFree(CacheRequest);
    }

    return Success;
}

VOID InitUnicodeString | ( | PUNICODE_STRING | DestinationString,
 |  | PCWSTR SourceString | OPTIONAL
 | ) |  |

Definition at line 688 of file KList.c.

{
    ULONG Length;

    DestinationString->Buffer = (PWSTR)SourceString;
    if (SourceString != NULL) {
        Length = wcslen( SourceString ) * sizeof( WCHAR );
        DestinationString->Length = (USHORT)Length;
        DestinationString->MaximumLength = (USHORT)(Length + sizeof(UNICODE_NULL));
        }
    else {
        DestinationString->MaximumLength = 0;
        DestinationString->Length = 0;
        }
}

BOOL PackageConnectLookup | ( | HANDLE * | pLogonHandle,
 |  | ULONG * | pPackageId
 | ) |  |

Definition at line 313 of file KList.c.

{
    LSA_STRING Name;
    NTSTATUS Status;

    Status = LsaConnectUntrusted(
                pLogonHandle
                );

    if (!SEC_SUCCESS(Status))
    {
        ShowNTError("LsaConnectUntrusted", Status);
        return FALSE;
    }

    Name.Buffer = MICROSOFT_KERBEROS_NAME_A;
    Name.Length = strlen(Name.Buffer);
    Name.MaximumLength = Name.Length + 1;

    Status = LsaLookupAuthenticationPackage(
                *pLogonHandle,
                &Name,
                pPackageId
                );

    if (!SEC_SUCCESS(Status))
    {
        ShowNTError("LsaLookupAuthenticationPackage", Status);
        return FALSE;
    }

    return TRUE;

}

VOID PrintEType ( int etype )

Definition at line 216 of file KList.c.

{

#define AddEtype(n) { n, TEXT(#n) }

    struct _etype {
        int etype;
        LPTSTR ename;
    } enames[] = {
        AddEtype(KERB_ETYPE_NULL),
        AddEtype(KERB_ETYPE_DES_CBC_CRC),
        AddEtype(KERB_ETYPE_DES_CBC_MD4),
        AddEtype(KERB_ETYPE_DES_CBC_MD5),
        AddEtype(KERB_ETYPE_DES_PLAIN),
        AddEtype(KERB_ETYPE_RC4_MD4),
        AddEtype(KERB_ETYPE_RC4_PLAIN2),
        AddEtype(KERB_ETYPE_RC4_LM),
        AddEtype(KERB_ETYPE_RC4_SHA),
        AddEtype(KERB_ETYPE_DES_PLAIN),
        AddEtype(KERB_ETYPE_RC4_HMAC_OLD),
        AddEtype(KERB_ETYPE_RC4_PLAIN_OLD),
        AddEtype(KERB_ETYPE_RC4_HMAC_OLD_EXP),
        AddEtype(KERB_ETYPE_RC4_PLAIN_OLD_EXP),
        AddEtype(KERB_ETYPE_RC4_PLAIN),
        AddEtype(KERB_ETYPE_RC4_PLAIN_EXP),
        AddEtype(KERB_ETYPE_DSA_SIGN),
        AddEtype(KERB_ETYPE_RSA_PRIV),
        AddEtype(KERB_ETYPE_RSA_PUB),
        AddEtype(KERB_ETYPE_RSA_PUB_MD5),
        AddEtype(KERB_ETYPE_RSA_PUB_SHA1),
        AddEtype(KERB_ETYPE_PKCS7_PUB),
        AddEtype(KERB_ETYPE_DES_CBC_MD5_NT),
        AddEtype(KERB_ETYPE_RC4_HMAC_NT),
        AddEtype(KERB_ETYPE_RC4_HMAC_NT_EXP),
        {-1, 0}
    };
    int i;

    for (i = 0; enames[i].ename != 0; i++) {
    if (etype == enames[i].etype) {
        printf("KerbTicket Encryption Type: (%d) %S\n",
           etype,
           enames[i].ename);
        return;
    }
    }
    printf("KerbTicket Encryption Type: %d\n", etype);
}

VOID PrintKerbName ( PKERB_EXTERNAL_NAME Name )

Definition at line 151 of file KList.c.

{
    ULONG Index;
    for (Index = 0; Index < Name->NameCount ; Index++ )
    {
        printf("%wZ",&Name->Names[Index]);
    if ((Index+1) < Name->NameCount)
      printf("/");
    }
    printf("\n");
}

VOID PrintTime | ( | LPSTR | Comment,
 |  | TimeStamp | ConvertTime
 | ) |  |

Definition at line 166 of file KList.c.

{

    printf( "%s", Comment );

    //
    // If the time is infinite,
    //  just say so.
    //
    if ( ConvertTime.HighPart == 0x7FFFFFFF && ConvertTime.LowPart == 0xFFFFFFFF ) {
        printf( "Infinite\n" );

    //
    // Otherwise print it more clearly
    //
    } else {

        SYSTEMTIME SystemTime;
        FILETIME LocalFileTime;

        if( FileTimeToLocalFileTime(
                (PFILETIME) &ConvertTime,
                &LocalFileTime
                ) &&
            FileTimeToSystemTime(
                &LocalFileTime,
                &SystemTime
                ) )
        {

            printf( "%ld/%ld/%ld %ld:%2.2ld:%2.2ld\n",
                    SystemTime.wMonth,
                    SystemTime.wDay,
                    SystemTime.wYear,
                    SystemTime.wHour,
                    SystemTime.wMinute,
                    SystemTime.wSecond );
        }
          else
      {
          printf( "%ld\n", (long)(ConvertTime.QuadPart/(10*1000*1000)));
      }
    }

}

VOID PrintTktFlags ( ULONG flags )

Definition at line 269 of file KList.c.

{
    if (flags & KERB_TICKET_FLAGS_forwardable) {
        printf("forwardable ");
    }
    if (flags & KERB_TICKET_FLAGS_forwarded) {
        printf("forwarded ");
    }
    if (flags & KERB_TICKET_FLAGS_proxiable) {
        printf("proxiable ");
    }
    if (flags & KERB_TICKET_FLAGS_proxy) {
        printf("proxy ");
    }
    if (flags & KERB_TICKET_FLAGS_may_postdate) {
        printf("may_postdate ");
    }
    if (flags & KERB_TICKET_FLAGS_postdated) {
        printf("postdated ");
    }
    if (flags & KERB_TICKET_FLAGS_invalid) {
        printf("invalid ");
    }
    if (flags & KERB_TICKET_FLAGS_renewable) {
        printf("renewable ");
    }
    if (flags & KERB_TICKET_FLAGS_initial) {
        printf("initial ");
    }
    if (flags & KERB_TICKET_FLAGS_hw_authent) {
        printf("hw_auth ");
    }
    if (flags & KERB_TICKET_FLAGS_pre_authent) {
        printf("preauth ");
    }
    if (flags & KERB_TICKET_FLAGS_ok_as_delegate) {
        printf("delegate ");
    }
    printf("\n");
}

BOOL PurgeTicket | ( | HANDLE | LogonHandle,
 |  | ULONG | PackageId,
 |  | LPWSTR | Server,
 |  | DWORD | cbServer,
 |  | LPWSTR | Realm,
 |  | DWORD | cbRealm
 | ) |  |

Definition at line 352 of file KList.c.

{
    NTSTATUS Status;
    PVOID Response;
    ULONG ResponseSize;
    NTSTATUS SubStatus=0;

    PKERB_PURGE_TKT_CACHE_REQUEST pCacheRequest = NULL;

    pCacheRequest = (PKERB_PURGE_TKT_CACHE_REQUEST)
        LocalAlloc(LMEM_ZEROINIT,
        cbServer + cbRealm + sizeof(KERB_PURGE_TKT_CACHE_REQUEST));

    pCacheRequest->MessageType = KerbPurgeTicketCacheMessage;
    pCacheRequest->LogonId.LowPart = 0;
    pCacheRequest->LogonId.HighPart = 0;

    CopyMemory((LPBYTE)pCacheRequest+sizeof(KERB_PURGE_TKT_CACHE_REQUEST),
        Server,cbServer);
    CopyMemory((LPBYTE)pCacheRequest+sizeof(KERB_PURGE_TKT_CACHE_REQUEST)+cbServer,
        Realm,cbRealm);

    pCacheRequest->ServerName.Buffer =
        (LPWSTR)((LPBYTE)pCacheRequest+sizeof(KERB_PURGE_TKT_CACHE_REQUEST));

    pCacheRequest->ServerName.Length =
        (unsigned short)cbServer;

    pCacheRequest->ServerName.MaximumLength =
        (unsigned short)cbServer;

    pCacheRequest->RealmName.Buffer =
        (LPWSTR)((LPBYTE)pCacheRequest+sizeof(KERB_PURGE_TKT_CACHE_REQUEST)+cbServer);

    pCacheRequest->RealmName.Length =
        (unsigned short)cbRealm;

    pCacheRequest->RealmName.MaximumLength =
        (unsigned short)cbRealm;

    printf("\tDeleting ticket: \n");
    printf("\t   ServerName = %wZ (cb=%lu)\n",&pCacheRequest->ServerName,cbServer);
    printf("\t   RealmName  = %wZ (cb=%lu)\n",&pCacheRequest->RealmName,cbRealm);

    Status = LsaCallAuthenticationPackage(
                LogonHandle,
                PackageId,
                pCacheRequest,
                sizeof(KERB_PURGE_TKT_CACHE_REQUEST)+cbServer+cbRealm,
                &Response,
                &ResponseSize,
                &SubStatus
                );

    if (!SEC_SUCCESS(Status) || !SEC_SUCCESS(Status))
    {
        ShowNTError("LsaCallAuthenticationPackage(purge)", Status);
        printf("Substatus: 0x%x\n",SubStatus);
        ShowNTError("LsaCallAuthenticationPackage(purge SubStatus)", SubStatus);
        return FALSE;
    }
    else
    {
        printf("\tTicket purged!\n");
        return TRUE;
    }

}

VOID ShowLastError | ( | LPSTR | szAPI,
 |  | DWORD | dwError
 | ) |  |

Definition at line 708 of file KList.c.

{
   #define MAX_MSG_SIZE 256

   static WCHAR szMsgBuf[MAX_MSG_SIZE];
   DWORD dwRes;

   printf("Error calling function %s: %lu\n", szAPI, dwError);

   dwRes = FormatMessage (
      FORMAT_MESSAGE_FROM_SYSTEM,
      NULL,
      dwError,
      MAKELANGID (LANG_ENGLISH, SUBLANG_ENGLISH_US),
      szMsgBuf,
      MAX_MSG_SIZE,
      NULL);
   if (0 == dwRes) {
      printf("FormatMessage failed with %d\n", GetLastError());
      ExitProcess(EXIT_FAILURE);
   }

   printf("%S",szMsgBuf);
}

VOID ShowNTError | ( | LPSTR | szAPI,
 |  | NTSTATUS | Status
 | ) |  |

Definition at line 737 of file KList.c.

{
    //
    // Convert the NTSTATUS to Winerror. Then call ShowLastError().
    //
    ShowLastError(szAPI, LsaNtStatusToWinError(Status));
}

BOOL ShowTgt | ( | HANDLE | LogonHandle,
 |  | ULONG | PackageId
 | ) |  |

Definition at line 513 of file KList.c.

{
    NTSTATUS Status;
    KERB_QUERY_TKT_CACHE_REQUEST CacheRequest;
  PKERB_RETRIEVE_TKT_RESPONSE TicketEntry = NULL;
    PKERB_EXTERNAL_TICKET Ticket;
    ULONG ResponseSize;
    NTSTATUS SubStatus;
    BOOLEAN Trusted = TRUE;

    CacheRequest.MessageType = KerbRetrieveTicketMessage;
    CacheRequest.LogonId.LowPart = 0;
    CacheRequest.LogonId.HighPart = 0;

    Status = LsaCallAuthenticationPackage(
                LogonHandle,
                PackageId,
                &CacheRequest,
                sizeof(CacheRequest),
                (PVOID *) &TicketEntry,
                &ResponseSize,
                &SubStatus
                );

    if (!SEC_SUCCESS(Status) || !SEC_SUCCESS(SubStatus))
    {
        ShowNTError("LsaCallAuthenticationPackage", Status);
        printf("Substatus: 0x%x\n",SubStatus);
        return FALSE;
    }

    Ticket = &(TicketEntry->Ticket);

    printf("\nCached TGT:\n\n");

    printf("ServiceName: "); PrintKerbName(Ticket->ServiceName);

    printf("TargetName: "); PrintKerbName(Ticket->TargetName);

    printf("FullServiceName: "); PrintKerbName(Ticket->ClientName);

    printf("DomainName: %.*S\n",
        Ticket->DomainName.Length/sizeof(WCHAR),Ticket->DomainName.Buffer);

    printf("TargetDomainName: %.*S\n",
        Ticket->TargetDomainName.Length/sizeof(WCHAR),Ticket->TargetDomainName.Buffer);

    printf("AltTargetDomainName: %.*S\n",
        Ticket->AltTargetDomainName.Length/sizeof(WCHAR),Ticket->AltTargetDomainName.Buffer);

    printf("TicketFlags: (0x%x) ",Ticket->TicketFlags);
    PrintTktFlags(Ticket->TicketFlags);
    PrintTime("KeyExpirationTime: ",Ticket->KeyExpirationTime);
    PrintTime("StartTime: ",Ticket->StartTime);
    PrintTime("EndTime: ",Ticket->EndTime);
    PrintTime("RenewUntil: ",Ticket->RenewUntil);
    PrintTime("TimeSkew: ",Ticket->TimeSkew);
    PrintEType(Ticket->SessionKey.KeyType);

    if (TicketEntry != NULL)
    {
        LsaFreeReturnBuffer(TicketEntry);
    }

    return TRUE;
}

BOOL ShowTickets | ( | HANDLE | LogonHandle,
 |  | ULONG | PackageId,
 |  | DWORD | dwMode
 | ) |  |

Definition at line 430 of file KList.c.

{
    NTSTATUS Status;
    KERB_QUERY_TKT_CACHE_REQUEST CacheRequest;
    PKERB_QUERY_TKT_CACHE_RESPONSE CacheResponse = NULL;
    ULONG ResponseSize;
    NTSTATUS SubStatus;
    ULONG Index;
    int ch;

    CacheRequest.MessageType = KerbQueryTicketCacheMessage;
    CacheRequest.LogonId.LowPart = 0;
    CacheRequest.LogonId.HighPart = 0;

    Status = LsaCallAuthenticationPackage(
                LogonHandle,
                PackageId,
                &CacheRequest,
                sizeof(CacheRequest),
                (PVOID *) &CacheResponse,
                &ResponseSize,
                &SubStatus
                );
    if (!SEC_SUCCESS(Status) || !SEC_SUCCESS(SubStatus))
    {
        ShowNTError("LsaCallAuthenticationPackage", Status);
        printf("Substatus: 0x%x\n",SubStatus);
        return FALSE;
    }

    printf("\nCached Tickets: (%lu)\n", CacheResponse->CountOfTickets);
    for (Index = 0; Index < CacheResponse->CountOfTickets ; Index++ )
    {
        printf("\n   Server: %wZ@%wZ\n",
            &CacheResponse->Tickets[Index].ServerName,
            &CacheResponse->Tickets[Index].RealmName);
        printf("      ");
        PrintEType(CacheResponse->Tickets[Index].EncryptionType);
        PrintTime("      End Time: ",CacheResponse->Tickets[Index].EndTime);
        PrintTime("      Renew Time: ",CacheResponse->Tickets[Index].RenewTime);
        printf("      TicketFlags: (0x%x) ", CacheResponse->Tickets[Index].TicketFlags);
        PrintTktFlags(CacheResponse->Tickets[Index].TicketFlags);
        printf("\n");

        if(dwMode == INTERACTIVE_PURGE)
        {
            printf("Purge? (y/n/q) : ");
            ch = _getche();
            if(ch == 'y' || ch == 'Y')
            {
                printf("\n");
                PurgeTicket(
                    LogonHandle,
                    PackageId,
                    CacheResponse->Tickets[Index].ServerName.Buffer,
                    CacheResponse->Tickets[Index].ServerName.Length,
                    CacheResponse->Tickets[Index].RealmName.Buffer,
                    CacheResponse->Tickets[Index].RealmName.Length
                    );
            }
            else if(ch == 'q' || ch == 'Q')
                goto cleanup;
            else
                printf("\n\n");

        }
    }

cleanup:

    if (CacheResponse != NULL)
    {
        LsaFreeReturnBuffer(CacheResponse);
    }

    return TRUE;
}

int __cdecl wmain | ( | int | argc,
 |  | wchar_t * | argv[]
 | ) |  |

Definition at line 93 of file KList.c.

{

    HANDLE LogonHandle = NULL;
    ULONG PackageId;

    if (argc < 2)
    {
        printf("Usage: %S <tickets | tgt | purge | get> [service principal name(for get)]\n",argv[0]);
        return FALSE;
    }

    //
    // Get the logon handle and package ID from the
    // Kerberos package
    //
    if(!PackageConnectLookup(&LogonHandle, &PackageId))
        return FALSE;

    if(!_wcsicmp(argv[1],L"tickets"))
    {
        ShowTickets(LogonHandle, PackageId, 0);
    }
    else if(!_wcsicmp(argv[1],L"tgt"))
    {
        ShowTgt(LogonHandle, PackageId);
    }
    else if(!_wcsicmp(argv[1],L"purge"))
    {
        ShowTickets(LogonHandle, PackageId, INTERACTIVE_PURGE);
    }
    else if(!_wcsicmp(argv[1],L"get"))
    {
        if(argc < 3)
        {
            printf("Provide service principal name (SPN) of encoded ticket to retrieve\n");
        }
        else
            GetEncodedTicket(LogonHandle, PackageId, argv[2]);
    }
    else
    {
        printf("Usage: %S <tickets | tgt | purge | get> [service principal name(for get)]\n",argv[0]);
    }

    if (LogonHandle != NULL)
    {
        LsaDeregisterLogonProcess(LogonHandle);
    }

    return TRUE;

}

Generated on Wed Nov 13 2024 16:54:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/Authorization/MyToken/MyToken.cpp File Reference

  • Security
  • Authorization
  • MyToken
Defines | Functions

MyToken.cpp File Reference

#include <windows.h>
#include <tchar.h>
#include <stdio.h>
#include <strsafe.h>

Go to the source code of this file.

Defines

#define | _UNICODE
#define | CheckAndLocalFree(ptr)
#define | UNICODE

Functions

void | _tmain (int argc, TCHAR **argv)
LPTSTR | ConvertBinarySidToName (PSID pSid)
LPTSTR | ConvertLUIDToName (PLUID pLuid)
BOOL DisplayCallerAccessTokenInformation ()
BOOL | DisplayGroupsInfo (HANDLE hToken)
BOOL | DisplayOwnerInfo (HANDLE hToken)
BOOL | DisplayPrimaryGroupInfo (HANDLE hToken)
BOOL | DisplayPrivileges (HANDLE hToken)
BOOL | DisplaySource (HANDLE hToken)
BOOL | DisplayStatistics (HANDLE hToken)
BOOL | DisplayTokenInformation (HANDLE hToken)
BOOL | DisplayUserInfo (HANDLE hToken)
void __cdecl | MyPrintf (LPCTSTR lpszFormat,...)
LPVOID | RetrieveTokenInformationClass (HANDLE hToken, TOKEN_INFORMATION_CLASS InfoClass, LPDWORD dwSize)

Define Documentation

#define _UNICODE

Definition at line 49 of file MyToken.cpp.

#define CheckAndLocalFree ( ptr )
Value:
if (ptr != NULL) \
            { \
               LocalFree(ptr); \
               ptr = NULL; \
            }

Definition at line 71 of file MyToken.cpp.

#define UNICODE

Definition at line 48 of file MyToken.cpp.

Function Documentation

void _tmain | ( | int | argc,
 |  | TCHAR ** | argv
 | ) |  |

Definition at line 622 of file MyToken.cpp.

{
   DisplayCallerAccessTokenInformation();
}

LPTSTR ConvertBinarySidToName ( PSID pSid )

Definition at line 159 of file MyToken.cpp.

{
   LPTSTR pAccountName = NULL;
   LPTSTR pDomainName = NULL;
   LPTSTR pDomainAndUserName = NULL;
   DWORD dwAccountNameSize = 0;
   DWORD dwDomainNameSize = 0;
   DWORD dwSize = 0;
   SID_NAME_USE sidType;
   BOOL fSuccess = FALSE;
   HRESULT hr = S_OK;

   __try
   {
      LookupAccountSid(
            NULL,                      // lookup on local system
            pSid,
            pAccountName,              // buffer to recieve name
            &dwAccountNameSize,
            pDomainName,
            &dwDomainNameSize,
            &sidType);
      // If the SID cannot be resolved, LookupAccountSid will fail with
      // ERROR_NONE_MAPPED
      if (GetLastError() == ERROR_NONE_MAPPED)
      {
         LPTSTR pNoneMappedString = _T("NONE_MAPPED");

         dwAccountNameSize = sizeof(_T("NONE_MAPPED"))/sizeof(TCHAR);
         pAccountName = (LPTSTR)LocalAlloc(LPTR, dwAccountNameSize * sizeof(TCHAR));
         if (pAccountName == NULL)
         {
            MyPrintf(_T("LocalAlloc failed with %d\n"), GetLastError());
            __leave;
         }
         hr = StringCchCopy(pAccountName, dwAccountNameSize, pNoneMappedString);
         if (FAILED(hr))
         {
            _tprintf(_T("StringCchCopy failed with %X\n"), hr);
            __leave;
         }

         dwDomainNameSize = 0;
         pDomainName = NULL;
      }
      else if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
      {
         pAccountName = (LPTSTR)LocalAlloc(LPTR, dwAccountNameSize * sizeof(TCHAR));
         if (pAccountName == NULL)
         {
            MyPrintf(_T("LocalAlloc failed with %d\n"), GetLastError());
            __leave;
         }

         pDomainName = (LPTSTR)LocalAlloc(LPTR, dwDomainNameSize * sizeof(TCHAR));
         if (pDomainName == NULL)
         {
            MyPrintf(_T("LocalAlloc failed with %d\n"), GetLastError());
            __leave;
         }

         if (!LookupAccountSid(
               NULL,                      // lookup on local system
               pSid,
               pAccountName,              // buffer to recieve name
               &dwAccountNameSize,
               pDomainName,
               &dwDomainNameSize,
               &sidType))
         {
            MyPrintf(_T("LookupAccountSid failed with %d\n"), GetLastError());
            __leave;
         }
      }
      // Any other error code
      else
      {
         MyPrintf(_T("LookupAccountSid failed with %d\n"), GetLastError());
         __leave;
      }

      dwSize = dwDomainNameSize +
                  1 /* For \\ character */ +
                  dwAccountNameSize +
                  1 /* For NULL character */;

      pDomainAndUserName = (LPTSTR)LocalAlloc(LPTR, dwSize * sizeof(TCHAR));
      if (pDomainAndUserName == NULL)
      {
         MyPrintf(_T("LocalAlloc failed with %d\n"), GetLastError());
         __leave;
      }

      pDomainAndUserName[0] = 0;
      if (dwDomainNameSize != 0)
      {
         hr = StringCchCopy(pDomainAndUserName, dwSize, pDomainName);
         if (FAILED(hr))
         {
            _tprintf(_T("StringCchCopy failed with %X\n"), hr);
            __leave;
         }
         hr = StringCchCat(pDomainAndUserName, dwSize, _T("\\"));
         if (FAILED(hr))
         {
            _tprintf(_T("StringCchCat failed with %X\n"), hr);
            __leave;
         }
      }
      if (dwAccountNameSize != 0)
      {
         hr = StringCchCat(pDomainAndUserName, dwSize, pAccountName);
         if (FAILED(hr))
         {
            _tprintf(_T("StringCchCat failed with %X\n"), hr);
            __leave;
         }
      }

      fSuccess = TRUE;
   }
   __finally
   {
      CheckAndLocalFree(pAccountName);
      CheckAndLocalFree(pDomainName);
      // Free pDomainAndUserName only if failed.
      // Otherwise, the caller has to free after use
      if (fSuccess == FALSE)
      {
         CheckAndLocalFree(pDomainAndUserName);
      }
   }

   return pDomainAndUserName;
}

LPTSTR ConvertLUIDToName ( PLUID pLuid )

Definition at line 295 of file MyToken.cpp.

{
   LPTSTR pPrivilegeName = NULL;
   DWORD dwSize = 0;
   BOOL fSuccess = FALSE;

   __try
   {
      LookupPrivilegeName(
            NULL,                      // lookup on local system
            pLuid,
            pPrivilegeName,            // buffer to recieve name
            &dwSize);
      // Check for ERROR_INSUFFICIENT_BUFFER error code
      if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
      {
         MyPrintf(_T("LookupPrivilegeName failed with %d\n"), GetLastError());
         __leave;
      }

      pPrivilegeName = (LPTSTR)LocalAlloc(LPTR, dwSize * sizeof(TCHAR));
      if (pPrivilegeName == NULL)
      {
         MyPrintf(_T("LocalAlloc failed with %d\n"), GetLastError());
         __leave;
      }

      if (!LookupPrivilegeName(
            NULL,                      // lookup on local system
            pLuid,
            pPrivilegeName,            // buffer to recieve name
            &dwSize))
      {
         MyPrintf(_T("LookupPrivilegeName failed with %d\n"), GetLastError());
         __leave;
      }

      fSuccess = TRUE;
   }
   __finally
   {
      // Free pPrivilegeName only if failed.
      // Otherwise, the caller has to free after use
      if (fSuccess == FALSE)
      {
         CheckAndLocalFree(pPrivilegeName);
      }
   }

   return pPrivilegeName;
}

BOOL DisplayCallerAccessTokenInformation ( )

Definition at line 596 of file MyToken.cpp.

{
   HANDLE hToken = NULL;
   BOOL bResult = FALSE;

   // Use OpenThreadToken() API first, to determine
   // if the calling thread is running under impersonation
   bResult = OpenThreadToken(GetCurrentThread(),
      TOKEN_QUERY | TOKEN_QUERY_SOURCE, TRUE, &hToken);
   if (bResult == FALSE && GetLastError() == ERROR_NO_TOKEN)
   {
      // Otherwise, use process access token
      bResult = OpenProcessToken(GetCurrentProcess(),
         TOKEN_QUERY | TOKEN_QUERY_SOURCE, &hToken);
   }
   if (bResult)
   {
      bResult = DisplayTokenInformation(hToken);
      CloseHandle(hToken);
   }
   else
      MyPrintf(_T("OpenThread/ProcessToken failed with %d\n"), GetLastError());

   return bResult;
}

BOOL DisplayGroupsInfo ( HANDLE hToken )

Definition at line 492 of file MyToken.cpp.

{
   TOKEN_GROUPS *pGroupInfo = NULL;
   DWORD dwSize = 0;
   DWORD i;

   //
   //  List all groups in the access token
   //

   pGroupInfo = (PTOKEN_GROUPS)RetrieveTokenInformationClass(hToken, TokenGroups, &dwSize);
   if (pGroupInfo == NULL)
   {
      return FALSE;
   }

   MyPrintf(_T("\nRetrieving Group information from the access token\n"));
   for (i = 0; i < pGroupInfo->GroupCount; i++)
   {
      LPTSTR pName = NULL;

      pName = ConvertBinarySidToName(pGroupInfo->Groups[i].Sid);
      if (pName != NULL)
      {
         MyPrintf(_T("SID %d Group: %s\n"), i, pName);
         CheckAndLocalFree(pName);
      }
   }

   CheckAndLocalFree(pGroupInfo);
   return TRUE;
}

BOOL DisplayOwnerInfo ( HANDLE hToken )

Definition at line 376 of file MyToken.cpp.

{
   TOKEN_OWNER *pOwnerInfo = NULL;
   DWORD dwSize = 0;
   LPTSTR pName = NULL;

   //
   // Get Owner Information
   //

   pOwnerInfo = (TOKEN_OWNER *)RetrieveTokenInformationClass(hToken, TokenOwner, &dwSize);
   if (pOwnerInfo == NULL)
   {
      return FALSE;
   }

   pName = ConvertBinarySidToName(pOwnerInfo->Owner);
   if (pName == NULL)
   {
      return FALSE;
   }

   MyPrintf(_T("Owner : %s\n"), pName);

   CheckAndLocalFree(pOwnerInfo);
   CheckAndLocalFree(pName);
   return TRUE;
}

BOOL DisplayPrimaryGroupInfo ( HANDLE hToken )

Definition at line 405 of file MyToken.cpp.

{
   TOKEN_PRIMARY_GROUP *pPrimaryGroupInfo = NULL;
   DWORD dwSize = 0;
   LPTSTR pName = NULL;

   //
   // Get Primary Group Information
   //

   pPrimaryGroupInfo = (TOKEN_PRIMARY_GROUP *)RetrieveTokenInformationClass(hToken, TokenPrimaryGroup, &dwSize);
   if (pPrimaryGroupInfo == NULL)
   {
      return FALSE;
   }

   pName = ConvertBinarySidToName(pPrimaryGroupInfo->PrimaryGroup);
   if (pName == NULL)
   {
      return FALSE;
   }

   MyPrintf(_T("Primary Group : %s\n"), pName);

   CheckAndLocalFree(pPrimaryGroupInfo);
   CheckAndLocalFree(pName);
   return TRUE;
}

BOOL DisplayPrivileges ( HANDLE hToken )

Definition at line 525 of file MyToken.cpp.

{
   TOKEN_PRIVILEGES *pPrivileges = NULL;
   DWORD dwSize = 0;
   DWORD i;

   //
   // Display privileges associated with this access token
   //

   pPrivileges = (TOKEN_PRIVILEGES *)RetrieveTokenInformationClass(hToken, TokenPrivileges, &dwSize);
   if (pPrivileges == NULL)
   {
      return FALSE;
   }

   MyPrintf(_T("\nPrivileges associated with this token (%lu)\n"), pPrivileges->PrivilegeCount);
   for (i = 0; i < pPrivileges->PrivilegeCount; i++)
   {
      LPTSTR pPrivilegeName = NULL;

      pPrivilegeName = ConvertLUIDToName(&(pPrivileges->Privileges[i].Luid));
      if (pPrivilegeName != NULL)
      {
         MyPrintf(_T("%s - (attributes) %lu\n"), pPrivilegeName, pPrivileges->Privileges[i].Attributes);
         CheckAndLocalFree(pPrivilegeName);
      }
   }

   CheckAndLocalFree(pPrivileges);
   return TRUE;
}

BOOL DisplaySource ( HANDLE hToken )

Definition at line 465 of file MyToken.cpp.

{
   TOKEN_SOURCE *pSource = NULL;
   DWORD dwSize = 0;
   DWORD i = 0;

   //
   // Display source of access token
   //

   pSource = (TOKEN_SOURCE *)RetrieveTokenInformationClass(hToken, TokenSource, &dwSize);
   if (pSource == NULL)
   {
      return FALSE;
   }

   MyPrintf(_T("Token source is <"));
   for (i = 0; i < TOKEN_SOURCE_LENGTH; i++)
   {
      MyPrintf(_T("%c"), pSource->SourceName[i]);
   }
   MyPrintf(_T(">\n"));

   CheckAndLocalFree(pSource);
   return TRUE;
}

BOOL DisplayStatistics ( HANDLE hToken )

Definition at line 434 of file MyToken.cpp.

{
   TOKEN_STATISTICS *pStatistics = NULL;
   DWORD dwSize = 0;

   //
   // Get Token Statistics Information
   //

   pStatistics = (TOKEN_STATISTICS *)RetrieveTokenInformationClass(hToken, TokenStatistics, &dwSize);
   if (pStatistics == NULL)
   {
      return FALSE;
   }

   //
   // Display some of the token statistics information
   //

   MyPrintf(_T("LUID for this instance of token %i64\n"), pStatistics->TokenId);
   MyPrintf(_T("LUID for this logon session     %i64\n"), pStatistics->AuthenticationId);

   if (pStatistics->TokenType == TokenPrimary)
      MyPrintf(_T("Token type is PRIMARY\n"));
   else
      MyPrintf(_T("Token type is IMPERSONATION\n"));

   CheckAndLocalFree(pStatistics);
   return TRUE;
}

BOOL DisplayTokenInformation ( HANDLE hToken )

Definition at line 558 of file MyToken.cpp.

{
   //
   // Display access token information
   //

   if (!DisplayUserInfo(hToken))
   {
      return FALSE;
   }
   if (!DisplayOwnerInfo(hToken))
   {
      return FALSE;
   }
   if (!DisplayPrimaryGroupInfo(hToken))
   {
      return FALSE;
   }
   if (!DisplayStatistics(hToken))
   {
      return FALSE;
   }
   if (!DisplaySource(hToken))
   {
      return FALSE;
   }
   if (!DisplayGroupsInfo(hToken))
   {
      return FALSE;
   }
   if (!DisplayPrivileges(hToken))
   {
      return FALSE;
   }

   return TRUE;
}

BOOL DisplayUserInfo ( HANDLE hToken )

Definition at line 347 of file MyToken.cpp.

{
   TOKEN_USER *pUserInfo = NULL;
   DWORD dwSize = 0;
   LPTSTR pName = NULL;

   //
   // Get User Information
   //

   pUserInfo = (TOKEN_USER *)RetrieveTokenInformationClass(hToken, TokenUser, &dwSize);
   if (pUserInfo == NULL)
   {
      return FALSE;
   }

   pName = ConvertBinarySidToName(pUserInfo->User.Sid);
   if (pName == NULL)
   {
      return FALSE;
   }

   MyPrintf(_T("User : %s\n"), pName);

   CheckAndLocalFree(pUserInfo);
   CheckAndLocalFree(pName);
   return TRUE;
}

void __cdecl MyPrintf | ( | LPCTSTR | lpszFormat,
 |  |  | ...
 | ) |  |

Definition at line 78 of file MyToken.cpp.

{
   TCHAR szOutput[2048];
   va_list v1 = NULL;
   HRESULT hr = S_OK;

   va_start(v1, lpszFormat);
   hr = StringCbVPrintf(szOutput, sizeof(szOutput), lpszFormat, v1);
   if (SUCCEEDED(hr))
   {
      OutputDebugString(szOutput);
      _tprintf(szOutput);
   }
   else
   {
      _tprintf(_T("StringCbVPrintf failed with %X\n"), hr);
   }
}

LPVOID RetrieveTokenInformationClass | ( | HANDLE | hToken,
 |  | TOKEN_INFORMATION_CLASS | InfoClass,
 |  | LPDWORD | dwSize
 | ) |  |

Definition at line 97 of file MyToken.cpp.

{
   LPVOID pInfo = NULL;
   BOOL fSuccess = FALSE;

   __try
   {
      *lpdwSize = 0;

      //
      // Determine size of buffer needed
      //

      GetTokenInformation(
            hToken,
            InfoClass,
            NULL,
            *lpdwSize, lpdwSize);
      if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
      {
         MyPrintf(_T("GetTokenInformation failed with %d\n"), GetLastError());
         __leave;
      }

      //
      // Allocate a buffer for getting token information
      //
      pInfo = LocalAlloc(LPTR, *lpdwSize);
      if (pInfo == NULL)
      {
         MyPrintf(_T("LocalAlloc failed with %d\n"), GetLastError());
         __leave;
      }

      if (!GetTokenInformation(
            hToken,
            InfoClass,
            pInfo,
            *lpdwSize, lpdwSize))
      {
         MyPrintf(_T("GetTokenInformation failed with %d\n"), GetLastError());
         __leave;
      }

      fSuccess = TRUE;
   }
   __finally
   {
      // Free pDomainAndUserName only if failed.
      // Otherwise, the caller has to free after use
      if (fSuccess == FALSE)
      {
         CheckAndLocalFree(pInfo);
      }
   }

   return pInfo;
}

Generated on Wed Nov 13 2024 16:54:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/Authorization/Rcmd/Client.c File Reference

  • Security
  • Authorization
  • Rcmd
Defines | Functions

Client.c File Reference

#include <windows.h>
#include <stdio.h>

Go to the source code of this file.

Defines

#define | BUFFER_SIZE 4096
#define | RTN_ERROR 13
#define | RTN_OK 0
#define | RTN_USAGE 1

Functions

void | DisplayWinError (LPSTR szAPI, DWORD dwError)
int __cdecl | main (int argc, char *argv[])
DWORD WINAPI | ReadFunc (LPVOID lpParam)
DWORD WINAPI | WriteFunc (LPVOID lpParam)

Define Documentation

#define BUFFER_SIZE 4096
#define RTN_ERROR 13

Definition at line 48 of file Client.c.

#define RTN_OK 0

Definition at line 46 of file Client.c.

#define RTN_USAGE 1

Definition at line 47 of file Client.c.

Function Documentation

void DisplayWinError | ( | LPSTR | szAPI,
 |  | DWORD | dwError
 | ) |  |

Definition at line 240 of file Client.c.

{
    LPSTR MessageBuffer;
    DWORD dwBufferLength;

    //
    // TODO get this fprintf out of here!
    //
    fprintf(stderr,"%s error!\n", szAPI);

    if(dwBufferLength=FormatMessageA(
            FORMAT_MESSAGE_ALLOCATE_BUFFER |
            FORMAT_MESSAGE_FROM_SYSTEM,
            NULL,
            dwError,
            MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
            (LPSTR) &MessageBuffer,
            0,
            NULL
            ))
    {
        DWORD dwBytesWritten; // unused

        //
        // Output message string on stderr
        //
        WriteFile(
                GetStdHandle(STD_ERROR_HANDLE),
                MessageBuffer,
                dwBufferLength,
                &dwBytesWritten,
                NULL
                );

        //
        // free the buffer allocated by the system
        //
        LocalFree(MessageBuffer);
    }
}

int __cdecl main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 52 of file Client.c.

{
    HANDLE hFileRead;
    HANDLE hFileWrite;

    HANDLE hThread;
    DWORD dwThreadId;

    CHAR PipeIn[255];
    CHAR PipeOut[255];

    if(argc == 1) {
        printf("Usage: %s <\\\\server\n", argv[0]);
        printf("  %s \\\\WINBASE (remote server is \\\\winbase)\n", argv[0]);
        printf("  %s \\\\. (local server)\n",   argv[0]);
        return RTN_USAGE;
    }

    //
    // build Pipe names
    //
    wsprintf(PipeIn, "%s\\pipe\\rcmd_out", argv[1]);
    wsprintf(PipeOut, "%s\\pipe\\rcmd_in", argv[1]);

    //
    // wait for the outbound (inbound on server-side) pipe to be available
    //
    WaitNamedPipe(PipeOut, NMPWAIT_WAIT_FOREVER);

    hFileWrite = CreateFile(
        PipeOut,
        GENERIC_WRITE,
        0, // exclusive open
        NULL,
        OPEN_EXISTING,
        SECURITY_SQOS_PRESENT | SECURITY_IMPERSONATION, // server can impersonate
        NULL
        );

    if(hFileWrite == INVALID_HANDLE_VALUE) {
        DisplayWinError("CreateFile", GetLastError());
        return RTN_ERROR;
    }

    //
    // wait for the inbound (outbound on server-side) pipe to be available
    // we time-out in 5 seconds because the server should be ready for us
    // right-away
    //
    WaitNamedPipe(PipeIn, 5 * 1000);

    hFileRead = CreateFile(
        PipeIn,
        GENERIC_READ,
        0, // exclusive open
        NULL,
        OPEN_EXISTING,
        0,
        NULL
        );

    if(hFileRead == INVALID_HANDLE_VALUE) {
        DisplayWinError("CreateFile", GetLastError());
        return RTN_ERROR;
    }

    //
    // start a thread to handle stdin redirection to the pipe
    //
    hThread = CreateThread(
        NULL,
        0,
        WriteFunc,
        (LPVOID)hFileWrite, // parm
        0,
        &dwThreadId
        );

    if(hThread == NULL) {
        DisplayWinError("CreateThread", GetLastError());
        return RTN_ERROR;
    }

    //
    // handle stdout redirection
    //
    ReadFunc((LPVOID)hFileRead);

    //
    // if the read returned, kill the write, cleanup, and then exit
    //
    TerminateThread(hThread, 0xFFFFFFFF);
    CloseHandle(hThread);

    CloseHandle(hFileRead);
    CloseHandle(hFileWrite);

    return RTN_OK;
}

DWORD WINAPI ReadFunc ( LPVOID lpParam )

Definition at line 157 of file Client.c.

{
    #define BUFFER_SIZE 4096

    HANDLE hFile = (HANDLE)lpParam;
    BYTE lpBuffer[BUFFER_SIZE];

    DWORD dwBytesRead;
    DWORD dwBytesWritten;

    HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);

    DWORD dwLastError;

    while (1) {
        if(!ReadFile(
            hFile,
            lpBuffer,
            BUFFER_SIZE,
            &dwBytesRead,
            NULL
            )) {
            dwLastError = GetLastError();

            if(dwLastError == ERROR_NO_DATA) continue;
            if(dwLastError != ERROR_MORE_DATA) break;
        }

        if(!WriteFile(
            hStdOut,
            lpBuffer,
            dwBytesRead,
            &dwBytesWritten,
            NULL
            )) break;
    }

    return GetLastError();
}

DWORD WINAPI WriteFunc ( LPVOID lpParam )

Definition at line 201 of file Client.c.

{
    HANDLE hPipe = (HANDLE)lpParam;

    BYTE lpBuffer[ 1 ]; // change this later

    DWORD dwBytesRead;
    DWORD dwBytesWritten;

    HANDLE hStdIn = GetStdHandle(STD_INPUT_HANDLE);

    while (1) {
        //
        // TODO rework this loop to be line-based.
        // this would entail doing the console buffering outselves.
        //
        if(!ReadFile(
            hStdIn,
            lpBuffer,
            1,
            &dwBytesRead,
            NULL
            )) break;

        if(!WriteFile(
            hPipe,
            lpBuffer,
            dwBytesRead,
            &dwBytesWritten,
            NULL
            )) break;
    }

    return GetLastError();
}

Generated on Wed Nov 13 2024 16:53:14 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/Authorization/Rcmd/Server.c File Reference

  • Security
  • Authorization
  • Rcmd
Defines | Functions

Server.c File Reference

#include <windows.h>
#include <stdio.h>

Go to the source code of this file.

Defines

#define | COMMANDLINE TEXT("cmd.exe /Q")
#define | INBOUND_PIPE TEXT("\\\\.\\pipe\\rcmd_in")
#define | OUTBOUND_PIPE TEXT("\\\\.\\pipe\\rcmd_out")
#define | RTN_ERROR 13
#define | RTN_OK 0

Functions

BOOL | BuildNamedPipeAcl (PACL pAcl, PDWORD cbAclSize)
void | DisplayLastError (LPSTR szAPI)
int __cdecl | main (void)
BOOL | SetupNamedPipes (PSECURITY_ATTRIBUTES saInbound, PSECURITY_ATTRIBUTES saOutbound, PHANDLE hFileIn, PHANDLE hFileOut)
BOOL | SetWinstaDesktopSecurity (void)

Define Documentation

#define COMMANDLINE TEXT("cmd.exe /Q")

Definition at line 99 of file Server.c.

#define INBOUND_PIPE TEXT("\\\\.\\pipe\\rcmd_in")

Definition at line 101 of file Server.c.

#define OUTBOUND_PIPE TEXT("\\\\.\\pipe\\rcmd_out")

Definition at line 102 of file Server.c.

#define RTN_ERROR 13

Definition at line 105 of file Server.c.

#define RTN_OK 0

Definition at line 104 of file Server.c.

Function Documentation

BOOL BuildNamedPipeAcl | ( | PACL | pAcl,
 |  | PDWORD | cbAclSize
 | ) |  |

This function builds a Dacl which grants the creator of the objects FILE_ALL_ACCESS and Everyone FILE_GENERIC_READ and FILE_GENERIC_WRITE access to the object.

This Dacl allows for higher security than a NULL Dacl, which is common for named-pipes, as this only grants the creator/owner write access to the security descriptor, and grants Everyone the ability to "use" the named-pipe. This scenario prevents a malevolent user from disrupting service by preventing arbitrary access manipulation.

Definition at line 431 of file Server.c.

{
    DWORD dwAclSize;

    SID_IDENTIFIER_AUTHORITY siaWorld = SECURITY_WORLD_SID_AUTHORITY;
    SID_IDENTIFIER_AUTHORITY siaCreator = SECURITY_CREATOR_SID_AUTHORITY;

    BYTE BufEveryoneSid[32];
    BYTE BufOwnerSid[32];

    PSID pEveryoneSid = (PSID)BufEveryoneSid;
    PSID pOwnerSid = (PSID)BufOwnerSid;

    //
    // compute size of acl
    //
    dwAclSize = sizeof(ACL) +
        2 * ( sizeof(ACCESS_ALLOWED_ACE) - sizeof(DWORD) ) +
        GetSidLengthRequired( 1 ) + // well-known Everyone Sid
        GetSidLengthRequired( 1 ) ; // well-known Creator Owner Sid

    if(*cbAclSize < dwAclSize) {
        *cbAclSize = dwAclSize;
        return FALSE;
    }

    *cbAclSize = dwAclSize;

    //
    // intialize well known sids
    //

    if(!InitializeSid(pEveryoneSid, &siaWorld, 1)) return FALSE;
    *GetSidSubAuthority(pEveryoneSid, 0) = SECURITY_WORLD_RID;

    if(!InitializeSid(pOwnerSid, &siaCreator, 1)) return FALSE;
    *GetSidSubAuthority(pOwnerSid, 0) = SECURITY_CREATOR_OWNER_RID;

    if(!InitializeAcl(pAcl, dwAclSize, ACL_REVISION))
        return FALSE;

    //
    //
    if(!AddAccessAllowedAce(
        pAcl,
        ACL_REVISION,
        FILE_GENERIC_READ | FILE_GENERIC_WRITE,
        pEveryoneSid
        ))
        return FALSE;

    //
    //
    return AddAccessAllowedAce(
        pAcl,
        ACL_REVISION,
        FILE_ALL_ACCESS,
        pOwnerSid
        );
}

void DisplayLastError ( LPSTR szAPI )

Definition at line 537 of file Server.c.

{
    LPSTR MessageBuffer;
    DWORD dwBufferLength;

    //
    // TODO get this fprintf out of here!
    //
    fprintf(stderr,"%s error!\n", szAPI);

    if(dwBufferLength=FormatMessageA(
            FORMAT_MESSAGE_ALLOCATE_BUFFER |
            FORMAT_MESSAGE_FROM_SYSTEM,
            NULL,
            GetLastError(),
            MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
            (LPSTR) &MessageBuffer,
            0,
            NULL
            ))
    {
        DWORD dwBytesWritten; // unused

        //
        // Output message string on stderr
        //
        WriteFile(
                GetStdHandle(STD_ERROR_HANDLE),
                MessageBuffer,
                dwBufferLength,
                &dwBytesWritten,
                NULL
                );

        //
        // free the buffer allocated by the system
        //
        LocalFree(MessageBuffer);
    }
}

int __cdecl main ( void )

Definition at line 109 of file Server.c.

{
    HANDLE hPipeInbound;
    HANDLE hPipeOutbound;

    SECURITY_ATTRIBUTES saInbound;
    SECURITY_DESCRIPTOR sd;

    BYTE AclBuf[ 64 ];
    DWORD cbAclSize = 64;
    PACL pAcl = (PACL)AclBuf;

    SECURITY_ATTRIBUTES saOutbound;

    HANDLE hImpersonationToken;
    HANDLE hPrimaryToken;

    STARTUPINFO si;
    PROCESS_INFORMATION pi;

    //
    // suppress errors regarding startup directory, etc
    //
    SetErrorMode(SEM_FAILCRITICALERRORS);

    //
    // build security attributes for named-pipes
    //
    // the inbound pipe will grant Everyone the ability to connect,
    // and the server process full control over the pipe.  This way,
    // only the server process has the ability to update security
    // on the resource; clients can only connect.
    //
    // the outbound pipe will be built after the server impersonates
    // the client, and will inherit the default security of the client
    // as a result.  This allows only the same user that connected to
    // the inbound pipe to connect to the outbound pipe
    //

    if(!BuildNamedPipeAcl(pAcl, &cbAclSize)) {
        DisplayLastError("BuildNamedPipeAcl");
        return RTN_ERROR;
    }

    if(!InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION)) {
        DisplayLastError("InitializeSecurityDescriptor");
        return RTN_ERROR;
    }

    if(!SetSecurityDescriptorDacl(&sd, TRUE, pAcl, FALSE)) {
        DisplayLastError("SetSecurityDescriptorDacl");
        return RTN_ERROR;
    }

    saInbound.nLength = sizeof(SECURITY_ATTRIBUTES);
    saInbound.lpSecurityDescriptor = &sd;
    saInbound.bInheritHandle = TRUE;

    saOutbound.nLength = sizeof(SECURITY_ATTRIBUTES);
    saOutbound.lpSecurityDescriptor = NULL; // default Dacl of caller
    saOutbound.bInheritHandle = TRUE;

    //
    // modify security on windowstation and desktop to allow for correct
    // process and console initialization by arbitrary clients
    //
    if(!SetWinstaDesktopSecurity()) {
        DisplayLastError("SetWinstaDesktopSecurity");
        return RTN_ERROR;
    }

    while(1) {

    hPipeInbound = INVALID_HANDLE_VALUE;
    hPipeOutbound = INVALID_HANDLE_VALUE;
    hImpersonationToken = INVALID_HANDLE_VALUE;
    hPrimaryToken = INVALID_HANDLE_VALUE;
    pi.hProcess = INVALID_HANDLE_VALUE;
    pi.hThread = INVALID_HANDLE_VALUE;

    if(!SetupNamedPipes(
        &saInbound,
        &saOutbound,
        &hPipeInbound,
        &hPipeOutbound
        )) {

        //
        // just bail out on failure for now
        //
        DisplayLastError("SetupNamedPipes");
        break;
    }

    //
    // obtain the impersonation token from the current thread
    //
    if(!OpenThreadToken(
        GetCurrentThread(),
        TOKEN_DUPLICATE,
        TRUE,
        &hImpersonationToken
        )) {
        DisplayLastError("OpenThreadToken");
        goto cleanup;
    }

    //
    // duplicate the impersonation token to primary
    // since we are impersonating the client, the token will get the
    // default Dacl of the client
    //
    if(!DuplicateTokenEx(
        hImpersonationToken,
        TOKEN_IMPERSONATE | TOKEN_READ |
        TOKEN_ASSIGN_PRIMARY | TOKEN_DUPLICATE,
        NULL,
        SecurityImpersonation,
        TokenPrimary,
        &hPrimaryToken
        )) {
        DisplayLastError("DuplicateTokenEx");
        goto cleanup;
    }

    RevertToSelf();
    CloseHandle(hImpersonationToken);
    hImpersonationToken = INVALID_HANDLE_VALUE;

    //
    // setup STARTUPINFO structure
    //
    si.cb = sizeof(STARTUPINFO);
    si.lpReserved = NULL;
    si.lpDesktop = NULL;
    si.lpTitle = NULL;
    si.cbReserved2 = 0;
    si.lpReserved2 = NULL;
    si.dwFlags = STARTF_USESTDHANDLES;
    si.hStdOutput = hPipeOutbound;
    si.hStdError = hPipeOutbound;
    si.hStdInput = hPipeInbound;

    //
    // create a process running as the user
    //

    if(!CreateProcessAsUser(
        hPrimaryToken,
        NULL,
        COMMANDLINE, // commandline to execute
        NULL,   // process sa
        NULL,   // thread sa
        TRUE,   // inherit handles?
        0,      // process creation flags (inherit existing console)
        NULL,   // environment
        NULL,   // current directory
        &si,    // startupinfo
        &pi     // processinfo
        )) {
        DisplayLastError("CreateProcessAsUser");
        goto cleanup;
    }

cleanup:

    if(hImpersonationToken != INVALID_HANDLE_VALUE) {
        RevertToSelf();
        CloseHandle(hImpersonationToken);
    }

    if(hPrimaryToken != INVALID_HANDLE_VALUE) {
        CloseHandle(hPrimaryToken);
    }

    if(pi.hThread != INVALID_HANDLE_VALUE) {
        CloseHandle(pi.hThread);
    }

    if(pi.hProcess != INVALID_HANDLE_VALUE) {
        WaitForSingleObject(pi.hProcess, INFINITE);
        CloseHandle(pi.hProcess);

        //
        // TODO kill any child by enumerating process tokens in the system
        // by looking at the tokenID
        //
    }

    if(hPipeInbound != INVALID_HANDLE_VALUE) {
        DisconnectNamedPipe(hPipeInbound);
        CloseHandle(hPipeInbound);
    }

    if(hPipeOutbound != INVALID_HANDLE_VALUE) {
        DisconnectNamedPipe(hPipeOutbound);
        CloseHandle(hPipeOutbound);
    }

    } // while

    return RTN_OK;
}

BOOL SetupNamedPipes | ( | PSECURITY_ATTRIBUTES | saInbound,
 |  | PSECURITY_ATTRIBUTES | saOutbound,
 |  | PHANDLE | hFileIn,
 |  | PHANDLE | hFileOut
 | ) |  |

Definition at line 324 of file Server.c.

{
    HANDLE hPipeInbound = INVALID_HANDLE_VALUE;
    HANDLE hPipeOutbound = INVALID_HANDLE_VALUE;

    BOOL bSuccess = FALSE; // assume this function fails

    //
    // create Inbound named-pipe
    //
    hPipeInbound = CreateNamedPipe(
        INBOUND_PIPE,
        PIPE_ACCESS_INBOUND,
        PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT,
        1, // number of instances
        4096,
        4096,
        NMPWAIT_USE_DEFAULT_WAIT,
        saInbound
        );

    if(hPipeInbound == INVALID_HANDLE_VALUE) {
        DisplayLastError("CreateNamedPipe");
        return FALSE;
    }

    printf("Waiting for connection... ");

    //
    // wait for somebody to connect to the Inbound named pipe
    //
    ConnectNamedPipe(hPipeInbound, NULL);

    //
    // impersonate the client
    //
    if(!ImpersonateNamedPipeClient(hPipeInbound)) {
        DisplayLastError("ImpersonateNamedPipeClient");
        goto cleanup;
    }

    //
    // create Outbound named-pipe
    // the security on this named-pipe will be inherited from the default Dacl
    // of the client that just connected, because this pipe instance is
    // created in that users security context.  This prevents other users
    // from connecting to the Outbound pipe.
    //
    hPipeOutbound = CreateNamedPipe(
        OUTBOUND_PIPE,
        PIPE_ACCESS_OUTBOUND,
        PIPE_TYPE_MESSAGE | PIPE_WAIT,
        1, // number of instances
        4096,
        4096,
        NMPWAIT_USE_DEFAULT_WAIT,
        saOutbound
        );

    if(hPipeOutbound == INVALID_HANDLE_VALUE) {
        DisplayLastError("CreateNamedPipe");
        goto cleanup;
    }

    //
    // wait for the client to connect to the Outbound named pipe
    //
    ConnectNamedPipe(hPipeOutbound, NULL);

    printf("Client connected!\n");

    *hFileIn = hPipeInbound;
    *hFileOut = hPipeOutbound;

    bSuccess = TRUE;

cleanup:

    if(!bSuccess) {
        RevertToSelf();

        if(hPipeInbound != INVALID_HANDLE_VALUE)
            CloseHandle(hPipeInbound);
        if(hPipeOutbound != INVALID_HANDLE_VALUE)
            CloseHandle(hPipeOutbound);
    }

    return bSuccess;
}

BOOL SetWinstaDesktopSecurity ( void )

This function adjusts the security on the current windowstation and desktop, to allow arbitrary client to have access to the windowstation and desktop.

This is necessary to allow for correct process and console initialization.

Note that in a secure environment, it would be appropriate to create a specific desktop and launch the process spawned by the client on that desktop, rather than opening up the current desktop to the client.

This function simply applies a NULL Dacl to the current windowstation and desktop in order to reduce the size of this sample. Applying NULL Dacls to objects is generally not a wise idea.

TODO revist this function later to better address security on the windowstation and desktop.

Definition at line 512 of file Server.c.

{
    HWINSTA hWinsta;
    HDESK hDesk;

    SECURITY_INFORMATION si = DACL_SECURITY_INFORMATION;
    SECURITY_DESCRIPTOR sd;

    hWinsta = GetProcessWindowStation();
    if(hWinsta == NULL) return FALSE;

    hDesk = GetThreadDesktop(GetCurrentThreadId());
    if(hDesk == NULL) return FALSE;

    InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION);
    SetSecurityDescriptorDacl(&sd, TRUE, (PACL)NULL, FALSE);

    if(!SetUserObjectSecurity(hWinsta, &si, &sd)) return FALSE;

    return SetUserObjectSecurity(hDesk, &si, &sd);
}

Generated on Wed Nov 13 2024 16:54:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/Authorization/SecFile/c/SecFile.c File Reference

  • Security
  • Authorization
  • SecFile
  • c
Defines | Functions

SecFile.c File Reference

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>

Go to the source code of this file.

Defines

#define | FILENAME "testfile.txt"
#define | MAX_MSG_SIZE 256
#define | PERR(s)
#define | USER_ACCESS GENERIC_ALL
#define | WORLD_ACCESS GENERIC_READ

Functions

PSID | CreateWorldSid (void)
LPSTR | GetLastErrorText (void)
PSID | GetUserSid (void)
void | main ()

Define Documentation

#define FILENAME "testfile.txt"

Definition at line 24 of file SecFile.c.

#define MAX_MSG_SIZE 256
#define PERR ( s )
Value:
fprintf(stderr, "%s(%d) %s : Error %d\n%s\n", \
                    __FILE__, __LINE__, (s), GetLastError(), \
                    GetLastErrorText())

Definition at line 26 of file SecFile.c.

#define USER_ACCESS GENERIC_ALL

Definition at line 22 of file SecFile.c.

#define WORLD_ACCESS GENERIC_READ

Definition at line 23 of file SecFile.c.

Function Documentation

PSID CreateWorldSid ( void )

Definition at line 296 of file SecFile.c.

{
    SID_IDENTIFIER_AUTHORITY authWorld = SECURITY_WORLD_SID_AUTHORITY;
    PSID pSid, psidWorld;
    BOOL bRes;
    DWORD cbSid;

    bRes = AllocateAndInitializeSid(&authWorld,
                    1,
                    SECURITY_WORLD_RID,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    0,
                    &psidWorld);
    if (FALSE == bRes) {
                PERR("AllocateAndInitializeSid");
                ExitProcess(EXIT_FAILURE);
    }

    // Make a copy of the SID using a HeapAlloc'd block for return
    //
    cbSid = GetLengthSid(psidWorld);

    pSid = (PSID) HeapAlloc(GetProcessHeap(), 0, cbSid);
    if (NULL == pSid) {
                fprintf(stderr, "HeapAlloc failed.\n");
                ExitProcess(EXIT_FAILURE);
    }

    bRes = CopySid(cbSid, pSid, psidWorld);
    if (FALSE == bRes) {
                PERR("CopySid");
                ExitProcess(EXIT_FAILURE);
    }

    FreeSid(psidWorld);

    return pSid;
}

LPSTR GetLastErrorText ( void )

Definition at line 356 of file SecFile.c.

{
#define MAX_MSG_SIZE 256

    static char szMsgBuf[MAX_MSG_SIZE];
    DWORD dwError, dwRes;

    dwError = GetLastError ();

    dwRes = FormatMessage (
                                FORMAT_MESSAGE_FROM_SYSTEM,
                NULL,
                dwError,
                MAKELANGID (LANG_ENGLISH, SUBLANG_ENGLISH_US),
                                szMsgBuf,
                                MAX_MSG_SIZE,
                                NULL);
    if (0 == dwRes) {
                fprintf(stderr, "FormatMessage failed with %d\n", GetLastError());
                ExitProcess(EXIT_FAILURE);
    }

    return szMsgBuf;
}

PSID GetUserSid ( void )

Definition at line 196 of file SecFile.c.

{
    HANDLE hToken;
    BOOL bRes;
    DWORD cbBuffer, cbRequired;
    PTOKEN_USER pUserInfo;
    PSID pUserSid;

    // The User's SID can be obtained from the process token
    //
    bRes = OpenProcessToken(GetCurrentProcess(),
                            TOKEN_QUERY,
                            &hToken);
    if (FALSE == bRes) {
                PERR("OpenProcessToken");
                ExitProcess(EXIT_FAILURE);
    }

    // Set buffer size to 0 for first call to determine
    // the size of buffer we need.
    //
    cbBuffer = 0;
    bRes = GetTokenInformation(hToken,
                        TokenUser,
                        NULL,
                        cbBuffer,
                        &cbRequired);

    if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
                PERR("GetTokenInformation");
                ExitProcess(EXIT_FAILURE);
    }

    // Allocate a buffer for our token user data
    //
    cbBuffer = cbRequired;
    pUserInfo = (PTOKEN_USER) HeapAlloc(GetProcessHeap(), 0, cbBuffer);
    if (NULL == pUserInfo) {
                fprintf(stderr, "HeapAlloc failed.\n");
                ExitProcess(EXIT_FAILURE);
    }

    // Make the "real" call
    //
    bRes = GetTokenInformation(hToken,
                        TokenUser,
                        pUserInfo,
                        cbBuffer,
                        &cbRequired);
    if (FALSE == bRes) {
                PERR("GetTokenInformation");
                ExitProcess(EXIT_FAILURE);
    }

    // Make another copy of the SID for the return value
    //
    cbBuffer = GetLengthSid(pUserInfo->User.Sid);

    pUserSid = (PSID) HeapAlloc(GetProcessHeap(), 0, cbBuffer);
    if (NULL == pUserSid) {
                fprintf(stderr, "HeapAlloc failed.\n");
                ExitProcess(EXIT_FAILURE);
    }

    bRes = CopySid(cbBuffer, pUserSid, pUserInfo->User.Sid);
    if (FALSE == bRes) {
                PERR("CopySid");
                ExitProcess(EXIT_FAILURE);
    }

    bRes = HeapFree(GetProcessHeap(), 0, pUserInfo);
    if (FALSE == bRes) {
                fprintf(stderr, "HeapFree failed.\n");
                ExitProcess(EXIT_FAILURE);
    }

    return pUserSid;
}

void main ( void )

Definition at line 51 of file SecFile.c.

{
    PSID psidUser, psidEveryone;
    PACL pAcl;
    SECURITY_DESCRIPTOR sd;
    SECURITY_ATTRIBUTES sa;
    BOOL bRes;
    HANDLE hFile;
    DWORD dwBytesWritten, cbMsg, cbAcl;
    char szMsg[] = "Protected data\n";

    // Get the SIDs we'll need for the DACL
    //
    psidUser = GetUserSid();
    psidEveryone = CreateWorldSid();

    // Allocate space for the ACL
        //      For information about computing the size of the ACL, see
        //      the Win32 SDK reference entry for InitializeAcl()
    //
    cbAcl = GetLengthSid (psidUser) + GetLengthSid (psidEveryone) +
            sizeof(ACL) + (2 * (sizeof(ACCESS_ALLOWED_ACE) - sizeof(DWORD)));

    pAcl = (PACL) HeapAlloc(GetProcessHeap(), 0, cbAcl);
    if (NULL == pAcl) {
                fprintf(stderr, "HeapAlloc failed.\n");
                ExitProcess(EXIT_FAILURE);
    }

    bRes = InitializeAcl(pAcl,
                    cbAcl,
                    ACL_REVISION);
    if (FALSE == bRes) {
                PERR("InitializeAcl");
                ExitProcess(EXIT_FAILURE);
    }

    // Add Aces for User and World
    //
    bRes = AddAccessAllowedAce(pAcl,
                    ACL_REVISION,
                    USER_ACCESS,
                    psidUser);
    if (FALSE == bRes) {
                PERR("AddAccessAllowedAce");
                ExitProcess(EXIT_FAILURE);
    }

    bRes = AddAccessAllowedAce(pAcl,
                    ACL_REVISION,
                    WORLD_ACCESS,
                    psidEveryone);
    if (FALSE == bRes) {
                PERR("AddAccessAllowedAce");
                ExitProcess(EXIT_FAILURE);
    }

    // Put together the security descriptor
    //
    bRes = InitializeSecurityDescriptor(&sd,
                        SECURITY_DESCRIPTOR_REVISION);
    if (FALSE == bRes) {
                PERR("InitializeSecurityDescriptor");
                ExitProcess(EXIT_FAILURE);
    }

    bRes = SetSecurityDescriptorDacl(&sd,
                        TRUE,
                        pAcl,
                        FALSE);
    if (FALSE == bRes) {
                PERR("SetSecurityDescriptorDacl");
                ExitProcess(EXIT_FAILURE);
    }

    // Add the security descriptor to the sa structure
    //
    sa.nLength = sizeof(sa);
    sa.lpSecurityDescriptor = &sd;
    sa.bInheritHandle = FALSE;

    // Generate the file using the security attributes that
    // we've assembled
    //
    hFile = CreateFile(FILENAME,
                       GENERIC_READ |
                       GENERIC_WRITE,
                       0,
                       &sa,
                       CREATE_ALWAYS,
                       FILE_ATTRIBUTE_NORMAL,
                       NULL);
    if (INVALID_HANDLE_VALUE == hFile) {
                PERR("CreateFile");
                ExitProcess(EXIT_FAILURE);
    }

    cbMsg = lstrlen(szMsg);

    bRes = WriteFile(hFile,
                     szMsg,
                     cbMsg,
                     &dwBytesWritten,
                     NULL);
    if (FALSE == bRes) {
                PERR("WriteFile");
                ExitProcess(EXIT_FAILURE);
    }

    if (!CloseHandle(hFile)) {
                PERR("CloseHandle");
                ExitProcess(EXIT_FAILURE);
    }

    // Clean up
    //
    HeapFree(GetProcessHeap(), 0, pAcl);
    HeapFree(GetProcessHeap(), 0, psidUser);
    HeapFree(GetProcessHeap(), 0, psidEveryone);

    printf ("Created %s with special access.\n", FILENAME);

    ExitProcess(EXIT_SUCCESS);
}

Generated on Wed Nov 13 2024 16:54:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/Authorization/SecPrint/SecPrint.c File Reference

  • Security
  • Authorization
  • SecPrint
Defines | Functions

SecPrint.c File Reference

#include <windows.h>
#include <stdio.h>
#include <tchar.h>

Go to the source code of this file.

Defines

#define | _UNICODE
#define | ACCESS_ALLOW 2
#define | ACCESS_DENY 1
#define | UNICODE

Functions

void | _tmain (INT argc, TCHAR *argv[])
BOOL | AddAccessRights (LPTSTR szPrinterName, DWORD dwAccessMask, BYTE bAceFlags, LPTSTR szUserName, BYTE bType)
BOOL | GetPrinterDACL (LPTSTR szPrinterName, PACL *ppACL)
BOOL | SetPrinterDACL (LPTSTR szPrinterName, PACL pDacl)

Define Documentation

#define _UNICODE

Definition at line 40 of file SecPrint.c.

#define ACCESS_ALLOW 2

Definition at line 46 of file SecPrint.c.

#define ACCESS_DENY 1

Definition at line 45 of file SecPrint.c.

#define UNICODE

Definition at line 39 of file SecPrint.c.

Function Documentation

void _tmain | ( | INT | argc,
 |  | TCHAR * | argv[]
 | ) |  |

Definition at line 400 of file SecPrint.c.

{
   BOOL bDeny = FALSE;

   if (argc < 4)
   {
      _tprintf(TEXT("USAGE: %s <printer name> <user name> <P|MD|MP|F> [D]\n"), argv[0]);
      _tprintf(TEXT(" Where P  = Print access\n"));
      _tprintf(TEXT("       MD = Manage documents\n"));
      _tprintf(TEXT("       MP = Manage printers\n"));
      _tprintf(TEXT("       F  = Full control <P + MD + MP>\n"));
      _tprintf(TEXT("\nUse <D> to deny specified access to the specified\n"));
      _tprintf(TEXT("group or user (otherwise specified access is granted.)\n"));
      _tprintf(TEXT("\nNote: On NT4 or earlier denied 'Full Control' is displayed\n"));
      _tprintf(TEXT("as 'No Access' by the Explorer Printer Permissions dialog.\n"));
      _tprintf(TEXT("Denying P, MD, or MP on NT4 or earlier will not be viewable\n"));
      _tprintf(TEXT("using this dialog eventhough the DACL is valid.\n"));

      exit(0);
   }

   if (argc >= 5 && (lstrcmpi(argv[4], TEXT("d")) == 0))
      bDeny = TRUE;

   if (!lstrcmpi(argv[3], TEXT("p")))
   {
      // Add an ACL for "Print" access

      if (!AddAccessRights(argv[1],
                           PRINTER_EXECUTE,
                           CONTAINER_INHERIT_ACE,
                           argv[2],
                           (BYTE)(bDeny ? ACCESS_DENY : ACCESS_ALLOW)))

         _tprintf(TEXT("Error Adding Access Rights\n"));
   }

   else if (!lstrcmpi(argv[3], TEXT("f")))
   {
      // Add ACLs for "Full Control" access

      if (!AddAccessRights(argv[1],
                           GENERIC_ALL,
                           OBJECT_INHERIT_ACE | INHERIT_ONLY_ACE,
                           argv[2],
                           (BYTE)(bDeny ? ACCESS_DENY : ACCESS_ALLOW)))

         _tprintf(TEXT("Error Adding Access Rights\n"));

      if (!AddAccessRights(argv[1],
                           PRINTER_ALL_ACCESS,
                           CONTAINER_INHERIT_ACE,
                           argv[2],
                           (BYTE)(bDeny ? ACCESS_DENY : ACCESS_ALLOW)))

         _tprintf(TEXT("Error Adding Access Rights\n"));
   }

   else if (!lstrcmpi(argv[3], TEXT("md")))
   {
      // Add ACLs for "Manage Documents" access

      if (!AddAccessRights(argv[1],
                           GENERIC_ALL,
                           OBJECT_INHERIT_ACE | INHERIT_ONLY_ACE,
                           argv[2],
                           (BYTE)(bDeny ? ACCESS_DENY : ACCESS_ALLOW)))

         _tprintf(TEXT("Error Adding Access Rights\n"));

      if (!AddAccessRights(argv[1],
                           READ_CONTROL,
                           CONTAINER_INHERIT_ACE,
                           argv[2],
                           (BYTE)(bDeny ? ACCESS_DENY : ACCESS_ALLOW)))

         _tprintf(TEXT("Error Adding Access Rights\n"));
   }
   else if (!lstrcmpi(argv[3], TEXT("mp")))
   {
      // Add ACLs for "Manage Printers" access

      if (!AddAccessRights(argv[1],
                           PRINTER_ACCESS_ADMINISTER|PRINTER_ACCESS_USE,
                           0,
                           argv[2],
                           (BYTE)(bDeny ? ACCESS_DENY : ACCESS_ALLOW)))

         _tprintf(TEXT("Error Adding Access Rights\n"));
   }
   else
      _tprintf(TEXT("Unknown Access type\n"));
}

BOOL AddAccessRights | ( | LPTSTR | szPrinterName,
 |  | DWORD | dwAccessMask,
 |  | BYTE | bAceFlags,
 |  | LPTSTR | szUserName,
 |  | BYTE | bType
 | ) |  |

Definition at line 188 of file SecPrint.c.

{
   // User Name and Sid variables
   PSID           pSid = NULL;
   DWORD          cbSid = 0;
   LPTSTR         szDomainName = NULL;
   DWORD          cbDomainName = 0;
   SID_NAME_USE   SidType;

   // ACL variables
   PACL                 pACL = NULL;
   ACL_SIZE_INFORMATION AclInfo;
   DWORD                dwNewAceCount = 0;

   // New ACL variables
   PACL  pNewACL = NULL;
   DWORD dwNewACLSize;

   // Temporary ACE
   PACCESS_ALLOWED_ACE  pTempAce; // structure is same for access denied ace
   UINT                 CurrentAceIndex;

   __try
   {
      // Call LookupAccountName twice, once to just get buffer sizes

      while (!LookupAccountName(NULL, szUserName, pSid, &cbSid,
                                 szDomainName, &cbDomainName, &SidType))
      {
         if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
         {
            pSid = LocalAlloc(LPTR, cbSid);
            szDomainName = LocalAlloc(LPTR, (cbDomainName * sizeof(TCHAR)));
            if (pSid == NULL || szDomainName == NULL)
            {
               _tprintf(TEXT("LocalAlloc failed\n"));
               __leave;
            }
         }
         else
         {
            _tprintf(TEXT("Error %d - LookupAccountName\n"), GetLastError());
            __leave;
         }
      }

      _tprintf(TEXT("Adding ACE for %s\n"), szUserName);

      // Get security DACL for printer

      if (!GetPrinterDACL(szPrinterName, &pACL))
      {
         _tprintf(TEXT("Error %d getting printer DACL\n"), GetLastError());
         __leave;
      }

      // Compute size needed for the new ACL

      if (pACL)  // Get size of old ACL
      {
         if (!GetAclInformation(pACL, &AclInfo, sizeof(ACL_SIZE_INFORMATION),
            AclSizeInformation))
         {
            _tprintf(TEXT("Error %d: GetAclInformation\n"), GetLastError());
            __leave;
         }
      }

      if (pACL)  // Add room for new ACEs
      {
         dwNewACLSize = AclInfo.AclBytesInUse +
                        sizeof(ACCESS_ALLOWED_ACE) +
                        GetLengthSid(pSid) - sizeof(DWORD);
      }
      else
      {
         dwNewACLSize = sizeof(ACCESS_ALLOWED_ACE) +
                        sizeof(ACL) +
                        GetLengthSid(pSid) - sizeof(DWORD);
      }

      // Allocate and setup ACL.

      pNewACL = (PACL)LocalAlloc(LPTR, dwNewACLSize);
      if (pNewACL == NULL)
      {
         _tprintf(TEXT("LocalAlloc failed.\n"));
         __leave;
      }

      if (!InitializeAcl(pNewACL, dwNewACLSize, ACL_REVISION2))
      {
         _tprintf(TEXT("Error %d: InitializeAcl\n"),GetLastError());
         __leave;
      }

      // If new ACE is Access Denied ACE add it to front of new ACL

      if (bType == ACCESS_DENY)
      {
         // Add the access-denied ACE to the new DACL
         if (!AddAccessDeniedAce(pNewACL, ACL_REVISION2, dwAccessMask, pSid))
         {
            _tprintf(TEXT("Error %d: AddAccessDeniedAce\n"), GetLastError());
            __leave;
         }

         dwNewAceCount++;

         // get pointer to ace we just added, so we can change the AceFlags

         if (!GetAce(pNewACL,
                     0, // we know it is the first ace in the Acl
                     &pTempAce))
         {
            _tprintf(TEXT("Error %d: GetAce\n"), GetLastError());
            __leave;
         }

         pTempAce->Header.AceFlags = bAceFlags;
      }

      // If a DACL was present, copy the resident ACEs to the new DACL

      if (pACL)
      {
         // Copy the file's old ACEs to our new ACL

         if (AclInfo.AceCount)
         {
            for (CurrentAceIndex = 0; CurrentAceIndex < AclInfo.AceCount;
                                                         CurrentAceIndex++)
            {
               // Get an ACE

               if (!GetAce(pACL, CurrentAceIndex, &pTempAce))
               {
                  _tprintf(TEXT("Error %d: GetAce\n"), GetLastError());
                  __leave;
               }

               // Check to see if this ACE is identical to one were adding.
               // If it is identical don't copy it over.
               if (!EqualSid((PSID)&(pTempAce->SidStart),pSid) ||
                   (pTempAce->Mask != dwAccessMask)            ||
                   (pTempAce->Header.AceFlags != bAceFlags))
               {
                  // ACE is distinct, add it to the new ACL

                  if (!AddAce(pNewACL, ACL_REVISION, MAXDWORD, pTempAce,
                     ((PACE_HEADER)pTempAce)->AceSize))
                  {
                     _tprintf(TEXT("Error %d: AddAce\n"), GetLastError());
                     __leave;
                  }

                  dwNewAceCount++;
               }
            }
         }
      }

      // If the new ACE is an Access allowed ACE add it at the end.

      if (bType == ACCESS_ALLOW)
      {
         // Add the access-allowed ACE to the new DACL

         if (!AddAccessAllowedAce(pNewACL, ACL_REVISION2, dwAccessMask, pSid))
         {
            _tprintf(TEXT("Error %d: AddAccessAllowedAce\n"), GetLastError());
            __leave;
         }

         // Get pointer to ACE we just added, so we can change the AceFlags

         if (!GetAce(pNewACL,
                     dwNewAceCount, // Zero based position of the last ace
                     &pTempAce))
         {
            _tprintf(TEXT("Error %d: GetAce\n"), GetLastError());
            __leave;
         }

         pTempAce->Header.AceFlags = bAceFlags;
      }

      // Set the DACL to the object

      if (!SetPrinterDACL(szPrinterName, pNewACL))
      {
         _tprintf(TEXT("Error %d setting printer DACL\n"), GetLastError());
         __leave;
      }
   }

   __finally
   {
      // Free the memory allocated for the old and new ACL and user info
      if (pACL != NULL) LocalFree((HLOCAL)pACL);
      if (pNewACL != NULL) LocalFree((HLOCAL)pNewACL);
      if (pSid != NULL) LocalFree(pSid);
      if (szDomainName != NULL) LocalFree(szDomainName);
   }

   return(TRUE);
}

BOOL GetPrinterDACL | ( | LPTSTR | szPrinterName,
 |  | PACL * | ppACL
 | ) |  |

Definition at line 58 of file SecPrint.c.

{
   HANDLE            hPrinter = NULL;
   PPRINTER_INFO_3   pPrnInfo3 = NULL;
   PRINTER_DEFAULTS  PrnDefs;
   DWORD             cbNeeded = 0;
   DWORD             cbBuf = 0;
   BOOL              bDaclPres;
   BOOL              bDef;
   BOOL              bRes = FALSE;
   ACL_SIZE_INFORMATION AclInfo;
   PACL              pACL = NULL;

   PrnDefs.DesiredAccess = READ_CONTROL;
   PrnDefs.pDatatype = NULL;
   PrnDefs.pDevMode = NULL;

   __try
   {
      if (!OpenPrinter(szPrinterName, &hPrinter, &PrnDefs))
         __leave;

      // Call GetPrinter twice to get size of printer info structure.

      while (!GetPrinter(hPrinter, 3, (LPBYTE)pPrnInfo3, cbBuf, &cbNeeded))
      {
         if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
         {
            cbBuf = cbNeeded;
            pPrnInfo3 = LocalAlloc(LPTR, cbNeeded);
            if (pPrnInfo3 == NULL)
                    __leave;
         }
         else
            __leave;
      }

      if (!GetPrinter(hPrinter, 3, (LPBYTE)pPrnInfo3, cbBuf, &cbNeeded))
         __leave;

      if (!GetSecurityDescriptorDacl(pPrnInfo3->pSecurityDescriptor,
                                       &bDaclPres, &pACL, &bDef))
         __leave;

      if (!GetAclInformation(pACL, &AclInfo,
                            sizeof(ACL_SIZE_INFORMATION), AclSizeInformation))
         __leave;

          // The caller just needs the DACL. So, make a copy of the DACL for the
          // caller and free the printer info structure. The caller must free
          // the allocated memory for this DACL copy.

      *ppACL = LocalAlloc(LPTR, AclInfo.AclBytesInUse);
      if (*ppACL == NULL)
         __leave;

      memcpy(*ppACL, pACL, AclInfo.AclBytesInUse);

      bRes = TRUE;
   }

   __finally
   {
      if (pPrnInfo3 != NULL) LocalFree((HLOCAL)pPrnInfo3);
      if (hPrinter != NULL) ClosePrinter(hPrinter);
   }

   return bRes;
}

BOOL SetPrinterDACL | ( | LPTSTR | szPrinterName,
 |  | PACL | pDacl
 | ) |  |

Definition at line 139 of file SecPrint.c.

{
   HANDLE               hPrinter = NULL;
   PRINTER_INFO_3       pi3;
   PRINTER_DEFAULTS     PrnDefs;
   SECURITY_DESCRIPTOR  NewSD;
   BOOL                 bRes = FALSE;

   PrnDefs.DesiredAccess = READ_CONTROL|WRITE_DAC;
   PrnDefs.pDatatype = NULL;
   PrnDefs.pDevMode = NULL;
   pi3.pSecurityDescriptor = &NewSD;

   __try
   {
      if (!OpenPrinter(szPrinterName, &hPrinter, &PrnDefs))
         __leave;

      if (!InitializeSecurityDescriptor(&NewSD, SECURITY_DESCRIPTOR_REVISION))
         __leave;

      if (!SetSecurityDescriptorDacl(&NewSD, TRUE, pDacl, FALSE))
         __leave;

      if (!SetPrinter(hPrinter, 3, (LPBYTE)&pi3, 0))
         __leave;

      bRes = TRUE;
   }

   __finally
   {
      if (hPrinter != NULL) ClosePrinter(hPrinter);
   }

   return bRes;
}

Generated on Wed Nov 13 2024 16:54:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/Authorization/SecurObj/Main.Cpp File Reference

  • Security
  • Authorization
  • SecurObj
Defines | Functions | Variables

Main.Cpp File Reference

#include "resource.h"
#include "aclui.h"
#include "Main.h"

Go to the source code of this file.

Defines

#define | _UNICODE
#define | UNICODE

Functions

HTREEITEM | AddItemToTree (HWND hwndTV, LPTSTR lpszItem, HTREEITEM hParent, POBJECT pObject)
BOOL | CenterDialog (HWND hdlg)
BOOL CALLBACK | DlgProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
BOOL | InitInstance (HINSTANCE hInstance, int nCmdShow)
int CALLBACK | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

Variables

HINSTANCE | g_hInstance
char | szAppName [] = "Object Security Sample"

Define Documentation

#define _UNICODE

Definition at line 24 of file Main.Cpp.

#define UNICODE

Definition at line 23 of file Main.Cpp.

Function Documentation

HTREEITEM AddItemToTree | ( | HWND | hwndTV,
 |  | LPTSTR | lpszItem,
 |  | HTREEITEM | hParent,
 |  | POBJECT | pObject
 | ) |  |

Definition at line 128 of file Main.Cpp.

{
   TV_INSERTSTRUCT IStruct;
   HTREEITEM hTreeItem;

   IStruct.item.mask = TVIF_TEXT | TVIF_PARAM;

   // Set the text of the item.
   IStruct.item.pszText = lpszItem;
   IStruct.item.cchTextMax = lstrlen(lpszItem);

   // use the item's data area to store pointer to object
   IStruct.item.lParam = (LPARAM) pObject;

   if( pObject->fContainer )
      IStruct.hInsertAfter = TVI_FIRST;
   else
      IStruct.hInsertAfter = TVI_LAST;

   IStruct.hParent = hParent;

   hTreeItem = TreeView_InsertItem( hwndTV, &IStruct );

   pObject->hTreeItem = hTreeItem;

   return hTreeItem;
}

BOOL CenterDialog ( HWND hdlg )

Definition at line 166 of file Main.Cpp.

{
    RECT  rcParent;                         // Parent window client rect
    RECT  rcDlg;                            // Dialog window rect
    int   nLeft, nTop;                      // Top-left coordinates
    int   cWidth, cHeight;                  // Width and height
    HWND  hwnd;

    // Get frame window client rect in screen coordinates
    hwnd = GetParent(hdlg);
    if(hwnd == NULL || hwnd == GetDesktopWindow())
    {
        rcParent.top = rcParent.left = 0;
        rcParent.right = GetSystemMetrics(SM_CXFULLSCREEN);
        rcParent.bottom = GetSystemMetrics(SM_CYFULLSCREEN);
    }
    else
    GetWindowRect(hwnd, &rcParent);

    // Determine the top-left point for the dialog to be centered
    GetWindowRect(hdlg, &rcDlg);
    cWidth  = rcDlg.right  - rcDlg.left;
    cHeight = rcDlg.bottom - rcDlg.top;
    nLeft   = rcParent.left +
                (((rcParent.right  - rcParent.left) - cWidth ) / 2);
    nTop    = rcParent.top  +
                (((rcParent.bottom - rcParent.top ) - cHeight) / 2);
    if (nLeft < 0) nLeft = 0;
    if (nTop  < 0) nTop  = 0;

    // Place the dialog
    return MoveWindow(hdlg, nLeft, nTop, cWidth, cHeight, TRUE);
}

BOOL CALLBACK DlgProc | ( | HWND | hwnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 206 of file Main.Cpp.

{

   LRESULT  lCount;
   HANDLE   hToken;
   POBJECT  pObject=NULL,pNewObject=NULL;
   WORD     wClient;
   DWORD    dwResult;
   HTREEITEM hTreeItem;
   HTREEITEM hNewTreeItem=NULL;
   TV_ITEM   tvItem;
   WCHAR     szUser[256];
   DWORD     dwSIFlags=SI_EDIT_ALL | SI_ADVANCED | SI_NO_ACL_PROTECT; // Used by security editor
   HWND      hControlWnd;

   switch (msg)
   {

      case WM_CLOSE:
         DestroyWindow(hwnd);
         PostQuitMessage(1);
         return TRUE;

      case WM_INITDIALOG:

          CenterDialog(hwnd);
         //
         // Initialize the user list
         //
         DefaultUser();

         GetLogonName(0,szUser);
         SendMessage( GetDlgItem( hwnd,IDC_USERLIST ),
                      CB_ADDSTRING, 0, (LPARAM)szUser);

         SendMessage( GetDlgItem( hwnd,IDC_USERLIST ),
            CB_SETCURSEL, 0, 0L );

          return TRUE ;

      case WM_COMMAND:
            switch (LOWORD(wParam))
            {
               case IDOK:
                  DestroyWindow(hwnd);
                  PostQuitMessage(1);
                  return TRUE;

               case IDC_IMPERSONATE:
                  lCount = SendMessage( GetDlgItem( hwnd,IDC_USERLIST ),
                                        CB_GETCOUNT, 0, 0 );
                  if( NewLogon( g_hInstance, (WORD)lCount ) )
                  {
                     GetLogonName((WORD)lCount,szUser);
                     SendMessage( GetDlgItem( hwnd,IDC_USERLIST ),
                                  CB_ADDSTRING, 0, (LPARAM)szUser);
                  }
                  else
                     MessageBox(NULL, L"New Logon failed!", L"Logon Error", MB_OK);
                  return TRUE;

               case IDC_ACCESSCHECK:

                  hControlWnd = GetDlgItem(hwnd, IDC_OBJECT_TREE);

                  hTreeItem = TreeView_GetSelection(hControlWnd);

                  if( hTreeItem == NULL )
                  {
                     MessageBox( NULL, L"Select Container or Object first", L"Error", MB_OK );
                     break;
                  }

                  tvItem.mask = TVIF_PARAM;
                  tvItem.hItem = hTreeItem;

                  // get the tree view item
                  TreeView_GetItem(hControlWnd,&tvItem);

                  // get the object pointer from the tree view item
                  pObject = (POBJECT)tvItem.lParam;

                  wClient = (WORD)SendMessage( GetDlgItem( hwnd,IDC_USERLIST ),
                                               CB_GETCURSEL, 0, 0 );

                  hToken = GetClientImpToken( wClient );
                  dwResult = CheckAccess( pObject, hToken );

                  SetFocus(hControlWnd);

                  return TRUE;

               case IDC_NEW_TREE:

                  hControlWnd = GetDlgItem( hwnd, IDC_OBJECT_TREE );

                  pObject = NULL;

                  wClient = (WORD)SendMessage( GetDlgItem( hwnd,IDC_USERLIST ),
                                               CB_GETCURSEL, 0, 0 );

                  pNewObject = NewObject( pObject, TRUE, wClient );

                  pNewObject->fContainer = TRUE;

                  AddItemToTree( hControlWnd,
                                 L"Root",
                                 NULL,
                                 pNewObject );

                  SetFocus( hControlWnd );

                  return TRUE;

               case IDC_NEW_CONTAINER:

                  hControlWnd = GetDlgItem( hwnd, IDC_OBJECT_TREE );

                   hTreeItem = TreeView_GetSelection( hControlWnd );

                  if( hTreeItem == NULL )
                  {
                     MessageBox( NULL, L"Select Container first", L"Error", MB_OK );
                     break;
                  }
                  tvItem.mask = TVIF_PARAM;
                  tvItem.hItem = hTreeItem;

                  // Make sure it is a container object
                  TreeView_GetItem( hControlWnd, &tvItem );

                  // get the object pointer from the tree view item
                  pObject = (POBJECT)tvItem.lParam;

                  if( !pObject->fContainer )
                  {
                     MessageBox( NULL, L"Object not a container", L"Error", MB_OK );
                     break;
                  }

                  // If this were a actual secure application, I would want to
                  // make sure that the current client has the proper access
                  // right on this container to create a new container.
                  // ACCESS_CREATE_OBJECT?

                  wClient = (WORD)SendMessage( GetDlgItem( hwnd,IDC_USERLIST ),
                                               CB_GETCURSEL, 0, 0 );

                  pNewObject = NewObject( pObject, TRUE, wClient );

                  pNewObject->fContainer = TRUE;

                  hNewTreeItem = AddItemToTree(
                                     hControlWnd,
                                     L"Container",
                                     hTreeItem,
                                     pNewObject );

                  SetFocus( hControlWnd );

                  TreeView_SelectItem(
                      hControlWnd,
                      hNewTreeItem);

                  return TRUE;

               case IDC_NEW_OBJECT:

                  hControlWnd = GetDlgItem( hwnd, IDC_OBJECT_TREE );

                  hTreeItem = TreeView_GetSelection(
                     GetDlgItem( hwnd, IDC_OBJECT_TREE ) );

                  if( hTreeItem == NULL )
                  {
                     MessageBox( NULL, L"Select Container first", L"Error", MB_OK );
                     break;
                  }

                  tvItem.mask = TVIF_PARAM;
                  tvItem.hItem = hTreeItem;

                  // Make sure it is a container object
                  TreeView_GetItem( hControlWnd, &tvItem );

                  pObject = (POBJECT)tvItem.lParam;

                  if( !pObject->fContainer )
                  {
                     MessageBox( NULL, L"Object not a container", L"Error", MB_OK );
                     break;
                  }

                  // If this were a actual secure application, I would want to
                  // make sure that the current client has the proper access
                  // right on this container to create a new object.
                  // ACCESS_CREATE_OBJECT?

                  wClient = (WORD)SendMessage( GetDlgItem( hwnd,IDC_USERLIST ),
                                               CB_GETCURSEL, 0, 0 );

                  pNewObject = NewObject( pObject, FALSE, wClient );
                  pNewObject->fContainer = FALSE;

                  hNewTreeItem = AddItemToTree(
                                     hControlWnd,
                                     L"Object",
                                     hTreeItem,
                                     pNewObject );

                  SetFocus( hControlWnd );

                  TreeView_Select(
                      hControlWnd,
                      hNewTreeItem,
                      TVGN_FIRSTVISIBLE);

                  return TRUE;

               case IDC_SECURITY:

                  hControlWnd = GetDlgItem( hwnd, IDC_OBJECT_TREE );

                  hTreeItem = TreeView_GetSelection( hControlWnd );

                  if( hTreeItem == NULL )
                  {
                     MessageBox( NULL, L"Select Container or Object first", L"Error", MB_OK );
                     break;
                  }

                  tvItem.mask = TVIF_PARAM;
                  tvItem.hItem = hTreeItem;

                  // get the tree view item
                  TreeView_GetItem( hControlWnd, &tvItem );

                  // get the object pointer from the tree view item
                  pObject = (POBJECT)tvItem.lParam;

                  wClient = (WORD)SendMessage(GetDlgItem( hwnd,IDC_USERLIST ),
                                              CB_GETCURSEL, 0, 0);

                  LPSECURITYINFO psi;

                  if(SUCCEEDED(CreateObjSecurityInfo( dwSIFlags,
                                          &(pObject->pSD), &psi, wClient,
                                          L"", pObject->fContainer)))
                  {
                     EditSecurity(NULL,psi);
                     psi->Release();
                     tvItem.lParam = (LPARAM)pObject;
                     TreeView_SetItem(hControlWnd, &tvItem );
                  }
                  else
                     MessageBox(NULL, L"CreateObjSecurityInfo Failed", L"Error", MB_OK);

                  SetFocus(hControlWnd);

                  return TRUE;

            }
        default:
           break;

   }

   return FALSE;

}

BOOL InitInstance | ( | HINSTANCE | hInstance,
 |  | int | nCmdShow
 | ) |  |

Definition at line 82 of file Main.Cpp.

{
        HWND            hWnd; // Main window handle.

        // Save the instance handle in static variable, which will be used in
        // many subsequence calls from this application to Windows.

        g_hInstance = hInstance; // Store instance handle in our global variable

        InitCommonControls();

        // Create a main window for this application instance.

        hWnd = CreateDialog( hInstance,
                             MAKEINTRESOURCE(IDD_DIALOG_MAIN),
                             NULL,
                             (DLGPROC)DlgProc );

        // If window could not be created, return "failure"
        if (!hWnd) {
                return (FALSE);
        }

        // Make the window visible; update its client area; and return "success"
        ShowWindow(hWnd, nCmdShow); // Show the window
        UpdateWindow(hWnd);         // Sends WM_PAINT message

        return (TRUE);              // We succeeded...

}

int CALLBACK WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 42 of file Main.Cpp.

{

   MSG      msg;
   HACCEL   hAccelTable;

   // Perform initializations that apply to a specific instance

   if( !InitInstance(hInstance, nCmdShow))
      return(FALSE);

   hAccelTable = LoadAccelerators (hInstance, MAKEINTRESOURCE(IDR_PRIVOBJ_ACC));

   // Acquire and dispatch messages until a WM_QUIT message is received.

   while( GetMessage( &msg, // message structure
                      NULL,   // handle of window receiving the message
                      0,      // lowest message to examine
                      0 ))     // highest message to examine
   {
      if( !TranslateAccelerator( msg.hwnd, hAccelTable, &msg ) )
      {
            TranslateMessage(&msg);// Translates virtual key codes
            DispatchMessage(&msg); // Dispatches message to window
      }
   }

   return (int)(msg.wParam); // Returns the value from PostQuitMessage

   lpCmdLine; // This will prevent 'unused formal parameter' warnings
}

Variable Documentation

HINSTANCE g_hInstance

Definition at line 32 of file Main.Cpp.

char szAppName[] = "Object Security Sample"

Definition at line 31 of file Main.Cpp.

Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/Authorization/SecurObj/Main.h File Reference

  • Security
  • Authorization
  • SecurObj
Classes | Defines | Typedefs | Functions

Main.h File Reference

#include <windows.h>
#include <commctrl.h>

Go to the source code of this file.

Classes

struct | tagObject

Defines

#define | ACCESS_ALL ACCESS_READ | ACCESS_MODIFY | ACCESS_DELETE
#define | ACCESS_DELETE 4
#define | ACCESS_MODIFY 2
#define | ACCESS_READ 1

Typedefs

typedef struct tagObject | OBJECT
typedef struct tagObject * | POBJECT

Functions

BOOL | CheckAccess (POBJECT pObject, HANDLE hToken)
HRESULT | CreateObjSecurityInfo (DWORD dwFlags, PSECURITY_DESCRIPTOR *ppSD, LPSECURITYINFO *ppObjSI, WORD wClient, LPCWSTR pszServerName, BOOL fContainer)
BOOL | DefaultUser (void)
BOOL CALLBACK | DlgProc (HWND, UINT, WPARAM, LPARAM)
PSECURITY_DESCRIPTOR | GetClientDescriptor (WORD wIndex)
HANDLE | GetClientImpToken (WORD wIndex)
HANDLE | GetClientToken (WORD wIndex)
PSECURITY_DESCRIPTOR | GetCreatorSD (WORD wIndex)
void | GetLogonName (WORD wIndex, WCHAR szUser[])
BOOL InitApplication (HANDLE)
BOOL | InitInstance (HANDLE, int)
BOOL CALLBACK | LogonDlgProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
BOOL | NewLogon (HINSTANCE, WORD)
POBJECT | NewObject (POBJECT pContainer, BOOL fContainer, WORD wIndex)

Define Documentation

#define ACCESS_ALL ACCESS_READ | ACCESS_MODIFY | ACCESS_DELETE

Definition at line 22 of file Main.h.

#define ACCESS_DELETE 4

Definition at line 19 of file Main.h.

#define ACCESS_MODIFY 2

Definition at line 18 of file Main.h.

#define ACCESS_READ 1

Definition at line 17 of file Main.h.

Typedef Documentation

typedef struct tagObject OBJECT
typedef struct tagObject * POBJECT

Function Documentation

BOOL CheckAccess | ( | POBJECT | pObject,
 |  | HANDLE | hToken
 | ) |  |

Definition at line 66 of file Security.Cpp.

{
   DWORD                dwAccessDesired;
   PRIVILEGE_SET        PrivilegeSet;
   DWORD                dwPrivSetSize;
   DWORD                dwAccessGranted;
   BOOL                 fAccessGranted = FALSE;
   WCHAR                 buffer[2048];

   if( !IsValidSecurityDescriptor( pObject->pSD ) )
   {
      return( FALSE );
   }

   //
   // Using AccessCheck, there are two different things we could
   // do:
   //

   //
   // 1) See if I have some access rights to the object
   //
   dwAccessDesired = ACCESS_READ;

   //
   // This only does something if we specify generic access rights
   // like GENERIC_ALL. We are not.
   //
   MapGenericMask( &dwAccessDesired, &ObjMap );

   dwPrivSetSize = sizeof( PRIVILEGE_SET );

   if( !AccessCheck( pObject->pSD,
                     hToken,
                     dwAccessDesired,
                     &ObjMap,
                     &PrivilegeSet,
                     &dwPrivSetSize,
                     &dwAccessGranted,
                     &fAccessGranted ) )

      wsprintf( buffer, L"Error in AccessCheck : %lu\n", GetLastError() );
   else
   {
      if( fAccessGranted )
         wsprintf( buffer, L"Access Was Granted Using Mask 0x%08lx\n", dwAccessGranted );
      else
         wsprintf( buffer, L"Access was NOT granted!\n" );
   }

   MessageBox( NULL, buffer, L"AccessCheck Results (is access granted)", MB_OK );

   // 2) See what the maximum rights I have are

   dwAccessDesired = MAXIMUM_ALLOWED;

   if( !AccessCheck( pObject->pSD,
                  hToken,
                  dwAccessDesired,
                  &ObjMap,
                  &PrivilegeSet,
                  &dwPrivSetSize,
                  &dwAccessGranted,
                  &fAccessGranted ) )

      wsprintf( buffer, L"Error in AccessCheck : %lu\n", GetLastError() );
   else
   {
      if( fAccessGranted )
         wsprintf( buffer, L"Maximum Access Allowed = 0x%08lx\n", dwAccessGranted );
   }

   MessageBox( NULL, buffer, L"AccessCheck Results (maximum access)", MB_OK );

   return( TRUE );

}

HRESULT CreateObjSecurityInfo | ( | DWORD | dwFlags,
 |  | PSECURITY_DESCRIPTOR * | ppSD,
 |  | LPSECURITYINFO * | ppObjSI,
 |  | WORD | wClient,
 |  | LPCWSTR | pszServerName,
 |  | BOOL | fContainer
 | ) |  |

Definition at line 153 of file Privobji.Cpp.

{
    HRESULT hr;
    CObjSecurity *psi;

    *ppObjSI = NULL;

    psi = new CObjSecurity();
    if (!psi)
        return E_OUTOFMEMORY;

    hr = psi->Initialize(dwFlags, ppSD, wClient, pszServerName, fContainer);

    if (SUCCEEDED(hr))
        *ppObjSI = psi;
    else
        delete psi;

    return hr;
}

BOOL DefaultUser ( void )

Definition at line 347 of file Security.Cpp.

{
   HANDLE hToken;
   HANDLE hImpToken;
   WCHAR InfoBuffer[1000],szAccountName[MAX_NAME], szDomainName[MAX_NAME];
   DWORD dwInfoBufferSize,dwAccountSize = MAX_NAME, dwDomainSize = MAX_NAME;

   PTOKEN_USER pTokenUser = (PTOKEN_USER)InfoBuffer;
   SID_NAME_USE snu;

   // this is our first user
   wLogonId = 0;

   OpenProcessToken( GetCurrentProcess(),
                     TOKEN_ALL_ACCESS,
                     &hToken );

   GetTokenInformation(hToken,TokenUser,InfoBuffer,
      1000, &dwInfoBufferSize);

   LookupAccountSid(NULL, pTokenUser->User.Sid, szAccountName,
      &dwAccountSize,szDomainName, &dwDomainSize, &snu);

   lstrcpy( Logons[wLogonId].szUsername, szAccountName );
   lstrcpy( Logons[wLogonId].szDomain, szDomainName );

   Logons[wLogonId].hLogon = hToken;

   DuplicateToken( hToken, SecurityImpersonation, &hImpToken );

   Logons[wLogonId].hImpToken = hImpToken;

   Logons[wLogonId].psdCreator = GetCreatorSD(wLogonId);

   wLogonId++;

   return( TRUE );

}

BOOL CALLBACK DlgProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 1058 of file PlgBlt.c.

{

  switch (message) {
    /**********************************************************************\
    *  WM_INITDIALOG
    *
    * Fill the entry fields with sensible original values.
    \**********************************************************************/
    case WM_INITDIALOG:
        SetDlgItemText(hwnd, DID_P1X     , "0");
        SetDlgItemText(hwnd, DID_P1Y     , "0");
        SetDlgItemText(hwnd, DID_P2X     , "0");
        SetDlgItemText(hwnd, DID_P2Y     , "0");
        SetDlgItemText(hwnd, DID_P3X     , "0");
        SetDlgItemText(hwnd, DID_P3Y     , "0");
        SetDlgItemText(hwnd, DID_XSRC    , "0");
        SetDlgItemText(hwnd, DID_YSRC    , "0");
        SetDlgItemText(hwnd, DID_WIDTH   , "0");
        SetDlgItemText(hwnd, DID_HEIGHT  , "0");
        SetDlgItemText(hwnd, DID_XMASK   , "0");
        SetDlgItemText(hwnd, DID_YMASK   , "0");
    return TRUE;

    /**********************************************************************\
    *  WM_PUTUPLPOINTS
    *
    * wParam -  HDC with the needed world transform.
    * lParam -  Pointer to the track object.
    *
    * Fill the entry fields for the array of 3 dest parallelogram points.
    *  Conditionally change the first point depending on tracking mode.
    \**********************************************************************/
    case WM_PUTUPLPOINTS: {
        POINT p, origin;
        PTrackObject pto;
        HDC hdc;

        hdc = (HDC) wParam;
        pto = (PTrackObject) lParam;
        GetViewportOrgEx (hdc, &origin);

        if (pto->Mode & TMMOVE) {
          p.x = pto->rect.left;
          p.y = pto->rect.top;
          LPtoDP (pto->hdc, &p, 1);
          p.x -= origin.x; p.y -= origin.y;

          SetDlgItemInt(hwnd, DID_P1X, p.x, TRUE);
          SetDlgItemInt(hwnd, DID_P1Y, p.y, TRUE);

        }

        p.x = pto->rect.right;
        p.y = pto->rect.top;
        LPtoDP (pto->hdc, &p, 1);
        p.x -= origin.x; p.y -= origin.y;

        SetDlgItemInt(hwnd, DID_P2X, p.x, TRUE);
        SetDlgItemInt(hwnd, DID_P2Y, p.y, TRUE);

        p.x = pto->rect.left;
        p.y = pto->rect.bottom;
        LPtoDP (pto->hdc, &p, 1);
        p.x -= origin.x; p.y -= origin.y;
        SetDlgItemInt(hwnd, DID_P3X, p.x, TRUE);
        SetDlgItemInt(hwnd, DID_P3Y, p.y, TRUE);

    } return FALSE;

    /**********************************************************************\
    *  WM_PUTUPSRCRECT
    *
    * wParam -  HDC with the needed world transform.
    * lParam -  Pointer to the track object.
    *
    * Fill the entry fields for the source rectangle points.
    *  Conditionally change <x,y> or <width,height> depending on tracking mode.
    \**********************************************************************/
    case WM_PUTUPSRCRECT: {
        POINT p1,p2, origin;
        PTrackObject pto;
        HDC hdc;

        hdc = (HDC) wParam;
        pto = (PTrackObject) lParam;
        GetViewportOrgEx (hdc, &origin);

        p1.x = pto->rect.left;
        p1.y = pto->rect.top;
        LPtoDP (pto->hdc, &p1, 1);

        p2.x = pto->rect.right;
        p2.y = pto->rect.bottom;
        LPtoDP (pto->hdc, &p2, 1);
        p2.x -= p1.x; p2.y -= p1.y;

        p1.x -= origin.x; p1.y -= origin.y;

        if (!(pto->Mode & TMSIZEXY)) {
          SetDlgItemInt(hwnd, DID_XSRC, p1.x, TRUE);
          SetDlgItemInt(hwnd, DID_YSRC, p1.y, TRUE);
        }

        if (!(pto->Mode & TMMOVE)) {
          SetDlgItemInt(hwnd, DID_WIDTH,  p2.x, TRUE);
          SetDlgItemInt(hwnd, DID_HEIGHT, p2.y, TRUE);
        }
    } return FALSE;

    /**********************************************************************\
    *  WM_PUTUPMASKPT
    *
    * wParam -  HDC with the needed world transform.
    * lParam -  Pointer to the track object.
    *
    * Fill the entry fields for the mask location point.
    \**********************************************************************/
    case WM_PUTUPMASKPT: {
        POINT p1, origin;
        PTrackObject pto;
        HDC hdc;

        hdc = (HDC) wParam;
        pto = (PTrackObject) lParam;
        GetViewportOrgEx (hdc, &origin);

        p1.x = pto->rect.left;
        p1.y = pto->rect.top;
        LPtoDP (pto->hdc, &p1, 1);
        p1.x -= origin.x; p1.y -= origin.y;

        SetDlgItemInt(hwnd, DID_XMASK, p1.x, TRUE);
        SetDlgItemInt(hwnd, DID_YMASK, p1.y, TRUE);

    } return FALSE;

    /**********************************************************************\
    *  WM_COMMAND, DID_DRAW
    *
    * Draw button hit - send main window message to call PlgBlt().
    \**********************************************************************/
    case WM_COMMAND: {
      HBITMAP hbm;

      if (LOWORD(wParam) == DID_DRAW) {
          SendMessage (hwndMain, WM_PLGBLT, 0,0);

    /**********************************************************************\
    *  WM_COMMAND, DID_NEWSRC
    *
    * Try to get a new source bitmap.  Then
    *  invalidate two sub windows so that we force a repaint.
    \**********************************************************************/
      } else if (LOWORD(wParam) == DID_NEWSRC) {
        if ( hbm = GetBitmap (hdcSrc, hInst, FALSE)) {
          DeleteObject (hbmSrc);
          hbmSrc = hbm;
          InvalidateRect (hwndMain, &ptoSrc->rectClip, TRUE);
          InvalidateRect (hwndMain, &ptoDest->rectClip, TRUE);
        }

    /**********************************************************************\
    *  WM_COMMAND, DID_Mask
    *
    * Try to get a new mask bitmap.  Then
    *  invalidate two sub windows so that we force a repaint.
    \**********************************************************************/
      } else if (LOWORD(wParam) == DID_NEWMASK) {
        if ( hbm = GetBitmap (hdcMask,  hInst, TRUE)) {
          DeleteObject (hbmMask);
          hbmMask = hbm;
          InvalidateRect (hwndMain, &ptoMask->rectClip, TRUE);
          InvalidateRect (hwndMain, &ptoDest->rectClip, TRUE);
        }
      }

    } return FALSE; /* end WM_COMMAND */

  } /* end switch */
  return 0;
}

PSECURITY_DESCRIPTOR GetClientDescriptor ( WORD wIndex )

Definition at line 316 of file Security.Cpp.

{
   return( Logons[wIndex].psdCreator );
}

HANDLE GetClientImpToken ( WORD wIndex )

Definition at line 300 of file Security.Cpp.

{
   return( Logons[wIndex].hImpToken );
}

HANDLE GetClientToken ( WORD wIndex )

Definition at line 292 of file Security.Cpp.

{
   return( Logons[wIndex].hLogon );
}

PSECURITY_DESCRIPTOR GetCreatorSD ( WORD wIndex )

Definition at line 147 of file Security.Cpp.

{
   PSID pAdministratorsSid = NULL;
   EXPLICIT_ACCESS   ea;
   PACL              pOldAcl=NULL;
   PACL              pNewAcl=NULL;
   DWORD             dwResult;
   PSECURITY_DESCRIPTOR psdNewSD;
   SID_IDENTIFIER_AUTHORITY sia = SECURITY_NT_AUTHORITY;
   WCHAR             buffer[1024];

   psdNewSD = LocalAlloc(LPTR,SECURITY_DESCRIPTOR_MIN_LENGTH);

   if (NULL == psdNewSD)
   {
       return NULL;
   }

   if(!InitializeSecurityDescriptor(psdNewSD,SECURITY_DESCRIPTOR_REVISION))
   {
      wsprintf(buffer, L"Error %d:InitializeSecurityDescriptor\n", GetLastError());
      OutputDebugString(buffer);
   }

   ea.grfAccessPermissions = ACCESS_ALL;
   ea.grfAccessMode = GRANT_ACCESS;
   ea.grfInheritance = SUB_CONTAINERS_AND_OBJECTS_INHERIT;
   ea.Trustee.pMultipleTrustee = NULL;
   ea.Trustee.MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE;
   ea.Trustee.TrusteeForm = TRUSTEE_IS_NAME;
   ea.Trustee.TrusteeType = TRUSTEE_IS_USER;
   GetLogonName(wIndex,buffer);
   ea.Trustee.ptstrName = buffer;

   dwResult = SetEntriesInAcl( 1,
                               &ea,
                               pOldAcl,
                               &pNewAcl );
   if( dwResult != ERROR_SUCCESS )
   {
      wsprintf( buffer, L"SetEntriesInAcl failed: %lu\n", dwResult );
      OutputDebugString( buffer );
   }

   pOldAcl=pNewAcl;

  if(!AllocateAndInitializeSid(
        &sia,
        2,
        SECURITY_BUILTIN_DOMAIN_RID,
        DOMAIN_ALIAS_RID_ADMINS,
        0, 0, 0, 0, 0, 0,
        &pAdministratorsSid
        )) {
        wsprintf( buffer, L"AllocateAndInitializeSid failed: %lu\n", GetLastError() );
        OutputDebugString( buffer );

   }

   ea.grfAccessPermissions = ACCESS_ALL;
   ea.grfAccessMode = GRANT_ACCESS;
   ea.grfInheritance = SUB_CONTAINERS_AND_OBJECTS_INHERIT;
   ea.Trustee.pMultipleTrustee = NULL;
   ea.Trustee.MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE;
   ea.Trustee.TrusteeForm = TRUSTEE_IS_SID;
   ea.Trustee.TrusteeType = TRUSTEE_IS_USER;
   ea.Trustee.ptstrName = (WCHAR *)pAdministratorsSid;

   dwResult = SetEntriesInAcl( 1,
                               &ea,
                               pOldAcl,
                               &pNewAcl );
   if( dwResult != ERROR_SUCCESS )
   {
      wsprintf( buffer, L"SetEntriesInAcl failed: %lu\n", dwResult );
      OutputDebugString( buffer );
   }

   dwResult = SetSecurityDescriptorDacl( psdNewSD,
                                         TRUE,
                                         pNewAcl,
                                         FALSE );
   if(!dwResult)
   {
      wsprintf( buffer, L"SetSecurityDescriptor failed: %lu\n", GetLastError() );
      OutputDebugString( buffer );
   }

//   LocalFree( pNewAcl ); // Second Acl produced
//   LocalFree( pOldAcl ); // First Acl produced

   return( psdNewSD );

}

void GetLogonName | ( | WORD | wIndex,
 |  | WCHAR | szUser[]
 | ) |  |

Definition at line 308 of file Security.Cpp.

{
   wsprintf(szUser, L"%s\\%s", Logons[wIndex].szDomain,Logons[wIndex].szUsername);
}

BOOL InitApplication ( HANDLE )

Definition at line 123 of file ClipText.c.

{
    WNDCLASS  wc = {0};

    wc.lpfnWndProc = (WNDPROC) MainWndProc;
    wc.hInstance = hInstance;
    wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
    wc.hCursor = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
    wc.lpszMenuName =  TEXT("CliptextMenu");
    wc.lpszClassName = TEXT("CliptextWClass");

    return (RegisterClass(&wc));
}

BOOL InitInstance | ( | HANDLE | ,
 |  | int |
 | ) |  |

Definition at line 126 of file ComDlg32.C.

{
    HWND            hWnd;

  // Save off the handle to the current instance.
    g_hInst = hInstance;

    // Create a main window for this application instance.
    hWnd = CreateWindow(
        "Comdlg32WClass",
        "Common Dialog Sample Application",
        WS_OVERLAPPEDWINDOW,            // Window style.
        CW_USEDEFAULT,                  // Default horizontal position.
        CW_USEDEFAULT,                  // Default vertical position.
        CW_USEDEFAULT,                  // Default width.
        CW_USEDEFAULT,                  // Default height.
        NULL,                           // Overlapped windows have no parent.
        NULL,                           // Use the window class menu.
        g_hInst,                        // This instance owns this window.
        NULL                            // Pointer not needed.
    );

    // If window could not be created, return "failure".
    if (!hWnd)
        return (FALSE);

    // Register the window messages to receive.
    cdmsgShareViolation = RegisterWindowMessage(szmsgSHAREVIOLATION);
    cdmsgFileOK         = RegisterWindowMessage(szmsgFILEOK);
    cdmsgHelp           = RegisterWindowMessage(szCommdlgHelp);

    // Make the window visible; update its client area; and return "success".
    ShowWindow(hWnd, nCmdShow);
    UpdateWindow(hWnd);
    return (TRUE);

}

BOOL CALLBACK LogonDlgProc | ( | HWND | hwnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 393 of file Security.Cpp.

{

   WCHAR szUsername[MAX_NAME];
   WCHAR szDomain[MAX_NAME]=L"";
   WCHAR szPassword[MAX_PASSWORD];
   HANDLE hToken;
   HANDLE hImpToken;
   LPTSTR lpDomain=NULL;
   DWORD dwError;

   switch (msg)
   {

      case WM_INITDIALOG:
         return TRUE ;

      case WM_COMMAND:
         switch (LOWORD(wParam))
         {
            case IDOK:
               GetDlgItemText(hwnd,IDC_USERNAME,szUsername,MAX_NAME);
               GetDlgItemText(hwnd,IDC_PASSWORD,szPassword,MAX_PASSWORD);
               if(GetDlgItemText(hwnd,IDC_DOMAIN,szDomain,MAX_NAME))
                  lpDomain=szDomain;

               if( !LogonUser( szUsername ,
                              lpDomain,
                              szPassword,
                              //LOGON32_LOGON_INTERACTIVE,
                              LOGON32_LOGON_NETWORK, // simulates a clients connection
                              LOGON32_PROVIDER_DEFAULT,
                              &hToken ) )
               {
                  return(dwError=GetLastError());
                  // Error 5 means you need to give yourself "Act as part of OS" privilege
               }
               else
               {
                  lstrcpy(Logons[wLogonId].szUsername,szUsername);
                  lstrcpy(Logons[wLogonId].szDomain,szDomain);
                  Logons[wLogonId].hLogon = hToken;
                  DuplicateToken( hToken, SecurityImpersonation, &hImpToken );
                  Logons[wLogonId].hImpToken = hImpToken;
                  Logons[wLogonId].psdCreator = GetCreatorSD(wLogonId);
                  wLogonId++;
               }
            case IDCANCEL:
               DestroyWindow(hwnd);
               return TRUE;
         }
         break;
      default:
         break;

   }
   return FALSE;

}

BOOL NewLogon | ( | HINSTANCE | ,
 |  | WORD |
 | ) |  |

Definition at line 324 of file Security.Cpp.

{
   INT_PTR wResult;

   wLogonId = wCurrentLogons;

   wResult = DialogBox( hAppInstance,
                        MAKEINTRESOURCE(IDD_LOGON),
                        NULL,
                        (DLGPROC)LogonDlgProc );

   if( wLogonId != wCurrentLogons )
   {
      // we had a successfull logon
      return TRUE;
   }
   else
      return FALSE;
}

POBJECT NewObject | ( | POBJECT | pContainer,
 |  | BOOL | fContainer,
 |  | WORD | wIndex
 | ) |  |

Definition at line 252 of file Security.Cpp.

{

   DWORD dwResult;
   POBJECT pobNew;

   pobNew = (POBJECT)LocalAlloc( LPTR, sizeof( OBJECT ) );

   if (NULL == pobNew)
   {
       return NULL;
   }

   pobNew->fContainer = fContainer;

   //
   // Create a new Private Object Security Descriptor
   //

   dwResult = CreatePrivateObjectSecurity(
      pobParent ? pobParent->pSD : NULL, // if there is a parent object, use it's sd
      pobParent ? NULL : GetClientDescriptor(wIndex), // if there is no parent, use the base sd
      &(pobNew->pSD),
      pobNew->fContainer,
      GetClientToken(wIndex),
      &ObjMap );

   if( !dwResult )
   {
          MessageBox(NULL, L"CreatePrivateObjectSecurity failed!", L"Error",MB_OK);
      return( FALSE );
   }

   return( pobNew );

}

Generated on Wed Nov 13 2024 16:53:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/Authorization/SecurObj/Privobji.Cpp File Reference

  • Security
  • Authorization
  • SecurObj
Classes | Defines | Functions | Variables

Privobji.Cpp File Reference

#include <aclui.h>
#include "resource.h"
#include "Main.h"

Go to the source code of this file.

Classes

class | CObjSecurity

Defines

#define | _UNICODE
#define | g_iObjDefAccess 1
#define | INHERIT_FULL (CONTAINER_INHERIT_ACE | OBJECT_INHERIT_ACE)
#define | UNICODE

Functions

HRESULT | CreateObjSecurityInfo (DWORD dwFlags, PSECURITY_DESCRIPTOR *ppSD, LPSECURITYINFO *ppObjSI, WORD wClient, LPCWSTR pszServerName, BOOL fContainer)
HANDLE | GetClientToken (WORD wIndex)
HRESULT | LocalAllocString (LPWSTR *ppResult, LPCWSTR pString)
void | LocalFreeString (LPWSTR *ppString)

Variables

HINSTANCE | g_hInstance
SI_ACCESS | g_siObjAccesses []
SI_INHERIT_TYPE | g_siObjInheritTypes []
GENERIC_MAPPING | ObjMap

Define Documentation

#define _UNICODE

Definition at line 21 of file Privobji.Cpp.

#define g_iObjDefAccess 1

Definition at line 58 of file Privobji.Cpp.

#define INHERIT_FULL (CONTAINER_INHERIT_ACE | OBJECT_INHERIT_ACE)

Definition at line 39 of file Privobji.Cpp.

#define UNICODE

Definition at line 20 of file Privobji.Cpp.

Function Documentation

HRESULT CreateObjSecurityInfo | ( | DWORD | dwFlags,
 |  | PSECURITY_DESCRIPTOR * | ppSD,
 |  | LPSECURITYINFO * | ppObjSI,
 |  | WORD | wClient,
 |  | LPCWSTR | pszServerName,
 |  | BOOL | fContainer
 | ) |  |

Definition at line 153 of file Privobji.Cpp.

{
    HRESULT hr;
    CObjSecurity *psi;

    *ppObjSI = NULL;

    psi = new CObjSecurity();
    if (!psi)
        return E_OUTOFMEMORY;

    hr = psi->Initialize(dwFlags, ppSD, wClient, pszServerName, fContainer);

    if (SUCCEEDED(hr))
        *ppObjSI = psi;
    else
        delete psi;

    return hr;
}

HANDLE GetClientToken ( WORD wIndex )

Definition at line 292 of file Security.Cpp.

{
   return( Logons[wIndex].hLogon );
}

HRESULT LocalAllocString | ( | LPWSTR * | ppResult,
 |  | LPCWSTR | pString
 | ) |  |

Definition at line 71 of file Privobji.Cpp.

{
    if (!ppResult || !pString)
        return E_INVALIDARG;

    *ppResult = (LPWSTR)LocalAlloc(LPTR, (lstrlen(pString) + 1) * sizeof(WCHAR));

    if (!*ppResult)
        return E_OUTOFMEMORY;

    lstrcpy(*ppResult, pString);
    return S_OK;
}

void LocalFreeString ( LPWSTR * ppString )

Definition at line 86 of file Privobji.Cpp.

{
    if (ppString)
    {
        if (*ppString)
            LocalFree(*ppString);
        *ppString = NULL;
    }
}

Variable Documentation

HINSTANCE g_hInstance

Definition at line 104 of file SServer.Cpp.

SI_ACCESS g_siObjAccesses[]
Initial value:
{
    { &GUID_NULL, ACCESS_READ,      MAKEINTRESOURCE(IDS_PRIV_READ),      SI_ACCESS_GENERAL | SI_ACCESS_SPECIFIC },
    { &GUID_NULL, ACCESS_MODIFY,    MAKEINTRESOURCE(IDS_PRIV_MODIFY),    SI_ACCESS_GENERAL | SI_ACCESS_SPECIFIC },
    { &GUID_NULL, ACCESS_DELETE,    MAKEINTRESOURCE(IDS_PRIV_DELETE),    SI_ACCESS_GENERAL | SI_ACCESS_SPECIFIC },
    { &GUID_NULL, ACCESS_ALL,       MAKEINTRESOURCE(IDS_PRIV_ALL),       SI_ACCESS_GENERAL | SI_ACCESS_SPECIFIC },
}

Definition at line 50 of file Privobji.Cpp.

SI_INHERIT_TYPE g_siObjInheritTypes[]
Initial value:
{
    &GUID_NULL, CONTAINER_INHERIT_ACE | OBJECT_INHERIT_ACE,   MAKEINTRESOURCE(IDS_INH_ALL),
    &GUID_NULL, CONTAINER_INHERIT_ACE,                        MAKEINTRESOURCE(IDS_INH_CONTAINER),
    &GUID_NULL, INHERIT_ONLY_ACE | OBJECT_INHERIT_ACE,        MAKEINTRESOURCE(IDS_INH_OBJECT),
    &GUID_NULL, 0,                                            MAKEINTRESOURCE(IDS_INH_NONE),
}

Definition at line 61 of file Privobji.Cpp.

GENERIC_MAPPING ObjMap

Definition at line 56 of file Security.Cpp.

Generated on Wed Nov 13 2024 16:54:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/Authorization/SecurObj/Resource.h File Reference

  • Security
  • Authorization
  • SecurObj
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | DUMMY 40001
#define | IDC_ACCESSCHECK 1008
#define | IDC_ADDACCESS 1013
#define | IDC_DOMAIN 1012
#define | IDC_IMPERSONATE 1005
#define | IDC_LOOKSD 1014
#define | IDC_NEW_CONTAINER 1001
#define | IDC_NEW_MMF 1002
#define | IDC_NEW_OBJECT 1002
#define | IDC_NEW_PIPE 1001
#define | IDC_NEW_TREE 1015
#define | IDC_OBJECT_TREE 1000
#define | IDC_PASSWORD 1010
#define | IDC_SECURITY 1011
#define | IDC_STATIC -1
#define | IDC_USERLIST 1007
#define | IDC_USERNAME 1009
#define | IDD_DIALOG_MAIN 101
#define | IDD_LOGON 105
#define | IDI_LARGE 102
#define | IDR_PRIVOBJ_ACC 107
#define | IDS_INH_ALL 6
#define | IDS_INH_CONTAINER 7
#define | IDS_INH_NONE 9
#define | IDS_INH_OBJECT 8
#define | IDS_PRIV_ALL 3
#define | IDS_PRIV_DELETE 5
#define | IDS_PRIV_MODIFY 2
#define | IDS_PRIV_READ 1
#define | IDS_PRIV_ROOT 4

Define Documentation

#define DUMMY 40001

Definition at line 41 of file Resource.h.

#define IDC_ACCESSCHECK 1008

Definition at line 33 of file Resource.h.

#define IDC_ADDACCESS 1013

Definition at line 38 of file Resource.h.

#define IDC_DOMAIN 1012

Definition at line 37 of file Resource.h.

#define IDC_IMPERSONATE 1005

Definition at line 31 of file Resource.h.

#define IDC_LOOKSD 1014

Definition at line 39 of file Resource.h.

#define IDC_NEW_CONTAINER 1001

Definition at line 28 of file Resource.h.

#define IDC_NEW_MMF 1002

Definition at line 29 of file Resource.h.

#define IDC_NEW_OBJECT 1002

Definition at line 30 of file Resource.h.

#define IDC_NEW_PIPE 1001

Definition at line 27 of file Resource.h.

#define IDC_NEW_TREE 1015

Definition at line 40 of file Resource.h.

#define IDC_OBJECT_TREE 1000

Definition at line 26 of file Resource.h.

#define IDC_PASSWORD 1010

Definition at line 35 of file Resource.h.

#define IDC_SECURITY 1011

Definition at line 36 of file Resource.h.

#define IDC_STATIC -1

Definition at line 42 of file Resource.h.

#define IDC_USERLIST 1007

Definition at line 32 of file Resource.h.

#define IDC_USERNAME 1009

Definition at line 34 of file Resource.h.

#define IDD_DIALOG_MAIN 101

Definition at line 22 of file Resource.h.

#define IDD_LOGON 105

Definition at line 24 of file Resource.h.

#define IDI_LARGE 102

Definition at line 23 of file Resource.h.

#define IDR_PRIVOBJ_ACC 107

Definition at line 25 of file Resource.h.

#define IDS_INH_ALL 6

Definition at line 18 of file Resource.h.

#define IDS_INH_CONTAINER 7

Definition at line 19 of file Resource.h.

#define IDS_INH_NONE 9

Definition at line 21 of file Resource.h.

#define IDS_INH_OBJECT 8

Definition at line 20 of file Resource.h.

#define IDS_PRIV_ALL 3

Definition at line 15 of file Resource.h.

#define IDS_PRIV_DELETE 5

Definition at line 17 of file Resource.h.

#define IDS_PRIV_MODIFY 2

Definition at line 14 of file Resource.h.

#define IDS_PRIV_READ 1

Definition at line 13 of file Resource.h.

#define IDS_PRIV_ROOT 4

Definition at line 16 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/Authorization/SecurObj/Security.Cpp File Reference

  • Security
  • Authorization
  • SecurObj
Classes | Defines | Typedefs | Functions | Variables

Security.Cpp File Reference

#include <aclapi.h>
#include "aclui.h"
#include "Main.h"
#include "resource.h"

Go to the source code of this file.

Classes

struct | _tagLogon

Defines

#define | _UNICODE
#define | MAX_LOGONS 16
#define | MAX_NAME 64
#define | MAX_PASSWORD 64
#define | SD_SIZE (65536 + SECURITY_DESCRIPTOR_MIN_LENGTH)
#define | UNICODE

Typedefs

typedef struct _tagLogon | LOGON
typedef struct _tagLogon * | PLOGON

Functions

BOOL | CheckAccess (POBJECT pObject, HANDLE hToken)
BOOL DefaultUser ()
PSECURITY_DESCRIPTOR | GetClientDescriptor (WORD wIndex)
HANDLE | GetClientImpToken (WORD wIndex)
HANDLE | GetClientToken (WORD wIndex)
PSECURITY_DESCRIPTOR | GetCreatorSD (WORD wIndex)
void | GetLogonName (WORD wIndex, WCHAR szUser[])
BOOL CALLBACK | LogonDlgProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
BOOL | NewLogon (HINSTANCE hAppInstance, WORD wCurrentLogons)
POBJECT | NewObject (POBJECT pobParent, BOOL fContainer, WORD wIndex)

Variables

LOGON | Logons [MAX_LOGONS]
GENERIC_MAPPING | ObjMap

Define Documentation

#define _UNICODE

Definition at line 25 of file Security.Cpp.

#define MAX_LOGONS 16

Definition at line 36 of file Security.Cpp.

#define MAX_NAME 64

Definition at line 37 of file Security.Cpp.

#define MAX_PASSWORD 64

Definition at line 38 of file Security.Cpp.

#define SD_SIZE (65536 + SECURITY_DESCRIPTOR_MIN_LENGTH)

Definition at line 64 of file Security.Cpp.

#define UNICODE

Definition at line 24 of file Security.Cpp.

Typedef Documentation

typedef struct _tagLogon LOGON
typedef struct _tagLogon* PLOGON

Function Documentation

BOOL CheckAccess | ( | POBJECT | pObject,
 |  | HANDLE | hToken
 | ) |  |

Definition at line 66 of file Security.Cpp.

{
   DWORD                dwAccessDesired;
   PRIVILEGE_SET        PrivilegeSet;
   DWORD                dwPrivSetSize;
   DWORD                dwAccessGranted;
   BOOL                 fAccessGranted = FALSE;
   WCHAR                 buffer[2048];

   if( !IsValidSecurityDescriptor( pObject->pSD ) )
   {
      return( FALSE );
   }

   //
   // Using AccessCheck, there are two different things we could
   // do:
   //

   //
   // 1) See if I have some access rights to the object
   //
   dwAccessDesired = ACCESS_READ;

   //
   // This only does something if we specify generic access rights
   // like GENERIC_ALL. We are not.
   //
   MapGenericMask( &dwAccessDesired, &ObjMap );

   dwPrivSetSize = sizeof( PRIVILEGE_SET );

   if( !AccessCheck( pObject->pSD,
                     hToken,
                     dwAccessDesired,
                     &ObjMap,
                     &PrivilegeSet,
                     &dwPrivSetSize,
                     &dwAccessGranted,
                     &fAccessGranted ) )

      wsprintf( buffer, L"Error in AccessCheck : %lu\n", GetLastError() );
   else
   {
      if( fAccessGranted )
         wsprintf( buffer, L"Access Was Granted Using Mask 0x%08lx\n", dwAccessGranted );
      else
         wsprintf( buffer, L"Access was NOT granted!\n" );
   }

   MessageBox( NULL, buffer, L"AccessCheck Results (is access granted)", MB_OK );

   // 2) See what the maximum rights I have are

   dwAccessDesired = MAXIMUM_ALLOWED;

   if( !AccessCheck( pObject->pSD,
                  hToken,
                  dwAccessDesired,
                  &ObjMap,
                  &PrivilegeSet,
                  &dwPrivSetSize,
                  &dwAccessGranted,
                  &fAccessGranted ) )

      wsprintf( buffer, L"Error in AccessCheck : %lu\n", GetLastError() );
   else
   {
      if( fAccessGranted )
         wsprintf( buffer, L"Maximum Access Allowed = 0x%08lx\n", dwAccessGranted );
   }

   MessageBox( NULL, buffer, L"AccessCheck Results (maximum access)", MB_OK );

   return( TRUE );

}

BOOL DefaultUser ( void )

Definition at line 347 of file Security.Cpp.

{
   HANDLE hToken;
   HANDLE hImpToken;
   WCHAR InfoBuffer[1000],szAccountName[MAX_NAME], szDomainName[MAX_NAME];
   DWORD dwInfoBufferSize,dwAccountSize = MAX_NAME, dwDomainSize = MAX_NAME;

   PTOKEN_USER pTokenUser = (PTOKEN_USER)InfoBuffer;
   SID_NAME_USE snu;

   // this is our first user
   wLogonId = 0;

   OpenProcessToken( GetCurrentProcess(),
                     TOKEN_ALL_ACCESS,
                     &hToken );

   GetTokenInformation(hToken,TokenUser,InfoBuffer,
      1000, &dwInfoBufferSize);

   LookupAccountSid(NULL, pTokenUser->User.Sid, szAccountName,
      &dwAccountSize,szDomainName, &dwDomainSize, &snu);

   lstrcpy( Logons[wLogonId].szUsername, szAccountName );
   lstrcpy( Logons[wLogonId].szDomain, szDomainName );

   Logons[wLogonId].hLogon = hToken;

   DuplicateToken( hToken, SecurityImpersonation, &hImpToken );

   Logons[wLogonId].hImpToken = hImpToken;

   Logons[wLogonId].psdCreator = GetCreatorSD(wLogonId);

   wLogonId++;

   return( TRUE );

}

PSECURITY_DESCRIPTOR GetClientDescriptor ( WORD wIndex )

Definition at line 316 of file Security.Cpp.

{
   return( Logons[wIndex].psdCreator );
}

HANDLE GetClientImpToken ( WORD wIndex )

Definition at line 300 of file Security.Cpp.

{
   return( Logons[wIndex].hImpToken );
}

HANDLE GetClientToken ( WORD wIndex )

Definition at line 292 of file Security.Cpp.

{
   return( Logons[wIndex].hLogon );
}

PSECURITY_DESCRIPTOR GetCreatorSD ( WORD wIndex )

Definition at line 147 of file Security.Cpp.

{
   PSID pAdministratorsSid = NULL;
   EXPLICIT_ACCESS   ea;
   PACL              pOldAcl=NULL;
   PACL              pNewAcl=NULL;
   DWORD             dwResult;
   PSECURITY_DESCRIPTOR psdNewSD;
   SID_IDENTIFIER_AUTHORITY sia = SECURITY_NT_AUTHORITY;
   WCHAR             buffer[1024];

   psdNewSD = LocalAlloc(LPTR,SECURITY_DESCRIPTOR_MIN_LENGTH);

   if (NULL == psdNewSD)
   {
       return NULL;
   }

   if(!InitializeSecurityDescriptor(psdNewSD,SECURITY_DESCRIPTOR_REVISION))
   {
      wsprintf(buffer, L"Error %d:InitializeSecurityDescriptor\n", GetLastError());
      OutputDebugString(buffer);
   }

   ea.grfAccessPermissions = ACCESS_ALL;
   ea.grfAccessMode = GRANT_ACCESS;
   ea.grfInheritance = SUB_CONTAINERS_AND_OBJECTS_INHERIT;
   ea.Trustee.pMultipleTrustee = NULL;
   ea.Trustee.MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE;
   ea.Trustee.TrusteeForm = TRUSTEE_IS_NAME;
   ea.Trustee.TrusteeType = TRUSTEE_IS_USER;
   GetLogonName(wIndex,buffer);
   ea.Trustee.ptstrName = buffer;

   dwResult = SetEntriesInAcl( 1,
                               &ea,
                               pOldAcl,
                               &pNewAcl );
   if( dwResult != ERROR_SUCCESS )
   {
      wsprintf( buffer, L"SetEntriesInAcl failed: %lu\n", dwResult );
      OutputDebugString( buffer );
   }

   pOldAcl=pNewAcl;

  if(!AllocateAndInitializeSid(
        &sia,
        2,
        SECURITY_BUILTIN_DOMAIN_RID,
        DOMAIN_ALIAS_RID_ADMINS,
        0, 0, 0, 0, 0, 0,
        &pAdministratorsSid
        )) {
        wsprintf( buffer, L"AllocateAndInitializeSid failed: %lu\n", GetLastError() );
        OutputDebugString( buffer );

   }

   ea.grfAccessPermissions = ACCESS_ALL;
   ea.grfAccessMode = GRANT_ACCESS;
   ea.grfInheritance = SUB_CONTAINERS_AND_OBJECTS_INHERIT;
   ea.Trustee.pMultipleTrustee = NULL;
   ea.Trustee.MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE;
   ea.Trustee.TrusteeForm = TRUSTEE_IS_SID;
   ea.Trustee.TrusteeType = TRUSTEE_IS_USER;
   ea.Trustee.ptstrName = (WCHAR *)pAdministratorsSid;

   dwResult = SetEntriesInAcl( 1,
                               &ea,
                               pOldAcl,
                               &pNewAcl );
   if( dwResult != ERROR_SUCCESS )
   {
      wsprintf( buffer, L"SetEntriesInAcl failed: %lu\n", dwResult );
      OutputDebugString( buffer );
   }

   dwResult = SetSecurityDescriptorDacl( psdNewSD,
                                         TRUE,
                                         pNewAcl,
                                         FALSE );
   if(!dwResult)
   {
      wsprintf( buffer, L"SetSecurityDescriptor failed: %lu\n", GetLastError() );
      OutputDebugString( buffer );
   }

//   LocalFree( pNewAcl ); // Second Acl produced
//   LocalFree( pOldAcl ); // First Acl produced

   return( psdNewSD );

}

void GetLogonName | ( | WORD | wIndex,
 |  | WCHAR | szUser[]
 | ) |  |

Definition at line 308 of file Security.Cpp.

{
   wsprintf(szUser, L"%s\\%s", Logons[wIndex].szDomain,Logons[wIndex].szUsername);
}

BOOL CALLBACK LogonDlgProc | ( | HWND | hwnd,
 |  | UINT | msg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 393 of file Security.Cpp.

{

   WCHAR szUsername[MAX_NAME];
   WCHAR szDomain[MAX_NAME]=L"";
   WCHAR szPassword[MAX_PASSWORD];
   HANDLE hToken;
   HANDLE hImpToken;
   LPTSTR lpDomain=NULL;
   DWORD dwError;

   switch (msg)
   {

      case WM_INITDIALOG:
         return TRUE ;

      case WM_COMMAND:
         switch (LOWORD(wParam))
         {
            case IDOK:
               GetDlgItemText(hwnd,IDC_USERNAME,szUsername,MAX_NAME);
               GetDlgItemText(hwnd,IDC_PASSWORD,szPassword,MAX_PASSWORD);
               if(GetDlgItemText(hwnd,IDC_DOMAIN,szDomain,MAX_NAME))
                  lpDomain=szDomain;

               if( !LogonUser( szUsername ,
                              lpDomain,
                              szPassword,
                              //LOGON32_LOGON_INTERACTIVE,
                              LOGON32_LOGON_NETWORK, // simulates a clients connection
                              LOGON32_PROVIDER_DEFAULT,
                              &hToken ) )
               {
                  return(dwError=GetLastError());
                  // Error 5 means you need to give yourself "Act as part of OS" privilege
               }
               else
               {
                  lstrcpy(Logons[wLogonId].szUsername,szUsername);
                  lstrcpy(Logons[wLogonId].szDomain,szDomain);
                  Logons[wLogonId].hLogon = hToken;
                  DuplicateToken( hToken, SecurityImpersonation, &hImpToken );
                  Logons[wLogonId].hImpToken = hImpToken;
                  Logons[wLogonId].psdCreator = GetCreatorSD(wLogonId);
                  wLogonId++;
               }
            case IDCANCEL:
               DestroyWindow(hwnd);
               return TRUE;
         }
         break;
      default:
         break;

   }
   return FALSE;

}

BOOL NewLogon | ( | HINSTANCE | hAppInstance,
 |  | WORD | wCurrentLogons
 | ) |  |

Definition at line 324 of file Security.Cpp.

{
   INT_PTR wResult;

   wLogonId = wCurrentLogons;

   wResult = DialogBox( hAppInstance,
                        MAKEINTRESOURCE(IDD_LOGON),
                        NULL,
                        (DLGPROC)LogonDlgProc );

   if( wLogonId != wCurrentLogons )
   {
      // we had a successfull logon
      return TRUE;
   }
   else
      return FALSE;
}

POBJECT NewObject | ( | POBJECT | pobParent,
 |  | BOOL | fContainer,
 |  | WORD | wIndex
 | ) |  |

Definition at line 252 of file Security.Cpp.

{

   DWORD dwResult;
   POBJECT pobNew;

   pobNew = (POBJECT)LocalAlloc( LPTR, sizeof( OBJECT ) );

   if (NULL == pobNew)
   {
       return NULL;
   }

   pobNew->fContainer = fContainer;

   //
   // Create a new Private Object Security Descriptor
   //

   dwResult = CreatePrivateObjectSecurity(
      pobParent ? pobParent->pSD : NULL, // if there is a parent object, use it's sd
      pobParent ? NULL : GetClientDescriptor(wIndex), // if there is no parent, use the base sd
      &(pobNew->pSD),
      pobNew->fContainer,
      GetClientToken(wIndex),
      &ObjMap );

   if( !dwResult )
   {
          MessageBox(NULL, L"CreatePrivateObjectSecurity failed!", L"Error",MB_OK);
      return( FALSE );
   }

   return( pobNew );

}

Variable Documentation

LOGON Logons[MAX_LOGONS]

Definition at line 48 of file Security.Cpp.

GENERIC_MAPPING ObjMap
Initial value:
{
    ACCESS_READ,
    ACCESS_MODIFY,
    0,
    ACCESS_ALL
}

Definition at line 56 of file Security.Cpp.

Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/Authorization/SidCln/SidClean.c File Reference

  • Security
  • Authorization
  • SidCln
Defines | Functions | Variables

SidClean.c File Reference

#include <windows.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

Go to the source code of this file.

Defines

#define | PERR(api)
#define | PMSG(msg)
#define | PrintAppStyleAPIError(ApiTxt, MsgTxt)
#define | STRICT
#define | SZ_ABS_SD_BUF 500
#define | SZ_ACCT_NAME_BUF 1000
#define | SZ_DACL_BUF 500
#define | SZ_DMN_NAME_BUF 1000
#define | SZ_NAME_BUF MAX_PATH
#define | SZ_REL_SD_BUF 1000
#define | SZ_SACL_BUF 500
#define | SZ_SID_OWN_BUF 500
#define | SZ_SID_PG_BUF 500

Functions

BOOL | CrackArgs (UINT argc, char *argv[])
BOOL | DeleteACEsAsAppropriate (PSECURITY_DESCRIPTOR psdFileSD, LPTSTR lpszFullName)
VOID | DisplayHelp (VOID)
BOOL | DoAllDirsInOneDir (char *FilePattern)
BOOL | DoMatchingFilesInOneDir (HANDLE hFound, WIN32_FIND_DATA ffdFoundData)
BOOL | DoOneFileOrDir (LPTSTR lpszFullName)
BOOL | GetFullFileOrDirName (LPTSTR lpszFileName)
BOOL | GetProcessSid (VOID)
UINT | main (UINT argc, char *argv[])
BOOL | TakeOwnershipIfAppropriate (PSECURITY_DESCRIPTOR psdFileSD, LPTSTR lpszFullName)

Variables

BOOL | bEditACLs = FALSE
BOOL | bJustCount = FALSE
BOOL | bRecurse = FALSE
BOOL | bTakeOwnership = FALSE
DWORD | dwACEsDeleted = 0
DWORD | dwFilesChecked = 0
DWORD | dwFilesOwned = 0
PSID psidProcessOwnerSID

Define Documentation

#define PERR ( api )
Value:
printf("%s: Error %d from %s on line %d\n",  \
    __FILE__, GetLastError(), api, __LINE__);

Definition at line 210 of file SidClean.c.

#define PMSG ( msg )
Value:
printf("%s line %d: %s\n",  \
    __FILE__, __LINE__, msg);

Definition at line 212 of file SidClean.c.

#define PrintAppStyleAPIError | ( | ApiTxt,
 |  | MsgTxt
 | ) |
Value:
{                     \
  DWORD dwLastError;                                               \
  dwLastError = GetLastError();                                    \
  switch (dwLastError)                                             \
  { case ERROR_FILE_NOT_FOUND :                                    \
      printf("\nFile not found (%s) line %d",MsgTxt,__LINE__);     \
      break;                                                       \
    case ERROR_INVALID_NAME   :                                    \
      printf("\nInvalid name (%s) line %d",MsgTxt,__LINE__);       \
      break;                                                       \
    case ERROR_PATH_NOT_FOUND :                                    \
      printf("\nError path not found (%s) line %d",MsgTxt,__LINE__); \
      break;                                                       \
    case ERROR_SHARING_VIOLATION :                                 \
      printf("\nSharing violation - shut down net and/or stop other sessions (%s) line %d",MsgTxt,__LINE__); \
      break;                                                       \
    case ERROR_ACCESS_DENIED  :                                    \
      printf("\nAccess denied (%s) line %d",MsgTxt,__LINE__);      \
      break;                                                       \
    default                   :                                    \
      printf("\n" #ApiTxt " - unexpected return code=%d (%s) line %d",dwLastError,MsgTxt,__LINE__); \
      break;                                                       \
  }                                                                \
  }

Definition at line 215 of file SidClean.c.

#define STRICT

Definition at line 204 of file SidClean.c.

#define SZ_ABS_SD_BUF 500
#define SZ_ACCT_NAME_BUF 1000
#define SZ_DACL_BUF 500
#define SZ_DMN_NAME_BUF 1000
#define SZ_NAME_BUF MAX_PATH
#define SZ_REL_SD_BUF 1000
#define SZ_SACL_BUF 500
#define SZ_SID_OWN_BUF 500
#define SZ_SID_PG_BUF 500

Function Documentation

BOOL CrackArgs | ( | UINT | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 1528 of file SidClean.c.

{
   char *p;

   /**************************************************************************\
   *
   * There must be three arguments
   *
   \**************************************************************************/

   if (argc != 4)
   {
      DisplayHelp();
      return (FALSE);
   }

   p=argv[1];

   /**************************************************************************\
   *
   * The switch argument must be 2-5 chars long
   *
   \**************************************************************************/

   if ((strlen(p) < 2) || (strlen(p) > 5))
   {
      DisplayHelp();
      return (FALSE);
   }

   /**************************************************************************\
   *
   * The first char in the switch argument must be /
   *
   \**************************************************************************/

   if ('/' != *p)
   {
      DisplayHelp();
      return (FALSE);
   }

   /**************************************************************************\
   *
   * Chars 2-5 of the switch argument must be O or A or R or C
   *
   \**************************************************************************/

   for (p=p+1; *p; p++)
      switch (*p)
      {
      case 'o':
      case 'O':
         bTakeOwnership = TRUE;
         break;
      case 'a':
      case 'A':
         bEditACLs      = TRUE;
         break;
      case 'r':
      case 'R':
         bRecurse       = TRUE;
         break;
      case 'c':
      case 'C':
         bJustCount     = TRUE;
         break;
      default :
         DisplayHelp();
         return (FALSE);
      }

   /**************************************************************************\
   *
   * Have to say one of O or A
   *
   \**************************************************************************/

   if (!(bTakeOwnership || bEditACLs))
   {
      DisplayHelp();
      return (FALSE);
   }

   return (TRUE);
}

BOOL DeleteACEsAsAppropriate | ( | PSECURITY_DESCRIPTOR | psdFileSD,
 |  | LPTSTR | lpszFullName
 | ) |  |

Definition at line 1060 of file SidClean.c.

{
   PACL                 paclFile;
   BOOL                 bHasACL;
   BOOL                 bOwnerDefaulted;
   DWORD                dwAcl_i;
   DWORD                dwACEsDeletedBeforeNow;

   ACL_SIZE_INFORMATION                      asiAclSize;
   DWORD                dwBufLength = sizeof(asiAclSize);
   ACCESS_ALLOWED_ACE   *paaAllowedAce;

   if (!GetSecurityDescriptorDacl(psdFileSD,
                                  (LPBOOL)&bHasACL,
                                  (PACL *)&paclFile,
                                  (LPBOOL)&bOwnerDefaulted))
   {
      PERR("GetSecurityDescriptorDacl");
      return (FALSE);
   }

   if (!bHasACL)  // No ACL to process, so OK, return
      return (TRUE);

   /**************************************************************************\
   *
   * This validity check is here for demonstration pruposes.  It's not likely a
   *   real app would need to check the validity of this returned ACL.  The
   *   validity check APIs are more intended to check validity after app code
   *   has manipulated the structure and is about to hand it back to the system
   *
   \**************************************************************************/

   if (!IsValidAcl(paclFile))
   {
      PERR("IsValidAcl said bad ACL!");
      return (FALSE);
   }

   if (!GetAclInformation(paclFile,
                          (LPVOID)&asiAclSize,
                          (DWORD)dwBufLength,
                          (ACL_INFORMATION_CLASS)AclSizeInformation))
   {
      PERR("GetAclInformation");
      return (FALSE);
   }

   dwACEsDeletedBeforeNow = dwACEsDeleted;

   /**************************************************************************\
   *
   * We loop through in reverse order, because that's simpler, given that we
   *   potentially delete ACEs as we loop through.  If started at 0 and went
   *   up, if we deleted the 0th ACE, then the 1th ACE would become the 0th,
   *   and we'd have to check the 0th ACE again
   *
   \**************************************************************************/

   for (dwAcl_i = asiAclSize.AceCount-1;  ((int)dwAcl_i) >= 0;  dwAcl_i--)
   {
      /************************************************************************\
      *
      * It doesn't matter for this sample that we don't yet know the ACE type,
      *   because they all start with the header field and that's what we need
      *
      \************************************************************************/

      if (!GetAce(paclFile,
                  dwAcl_i,
                  (LPVOID *)&paaAllowedAce))
      {
         PERR("GetAce");
         return (FALSE);
      }

      /************************************************************************\
      *
      * There are only four Ace Types pre-defined, so this next check is
      *   redundant in a real app, but useful as a sanity check and a
      *   demonstration in a sample
      *
      \************************************************************************/

      if (!( (paaAllowedAce->Header.AceType == ACCESS_ALLOWED_ACE_TYPE)
             ||(paaAllowedAce->Header.AceType == ACCESS_DENIED_ACE_TYPE )
             ||(paaAllowedAce->Header.AceType == SYSTEM_AUDIT_ACE_TYPE  )
             ||(paaAllowedAce->Header.AceType == SYSTEM_ALARM_ACE_TYPE  )))
      {
         PERR("Invalid AceType");
         return (FALSE);
      }

      { // Find SID of ACE, check if acct deleted

         UCHAR        ucNameBuf      [SZ_ACCT_NAME_BUF];
         DWORD        dwNameLength  = SZ_ACCT_NAME_BUF;
         UCHAR        ucDomainNmBuf  [SZ_DMN_NAME_BUF];
         DWORD        dwDNameLength = SZ_DMN_NAME_BUF;
         SID_NAME_USE peAcctNameUse;
         DWORD        dwLastError   = NO_ERROR;

         /**********************************************************************\
         *
         * This validity check is here for demonstration pruposes.  It's not
         *   likely a real app would need to check the validity of the SID
         *   contained in the returned ACL.  The validity check APIs are more
         *   intended to check validity after app code has manipulated the
         *   structure and is about to hand it back to the system
         *
         \**********************************************************************/

         if (!IsValidSid((PSID)&(paaAllowedAce->SidStart)))
         {
            PERR("IsValidSid said bad SID!");
            return (FALSE);
         }

         if (!LookupAccountSid
             ((LPTSTR)"",         // Look on local machine
              (PSID)&(paaAllowedAce->SidStart),
              (LPTSTR)&ucNameBuf,
              (LPDWORD)&dwNameLength,
              (LPTSTR)&ucDomainNmBuf,
              (LPDWORD)&dwDNameLength,
              (PSID_NAME_USE)&peAcctNameUse))
         {
            dwLastError = GetLastError();
            if (ERROR_NONE_MAPPED != dwLastError)
            {
               PERR("LookupAccountSID");
               return (FALSE);
            }
         }

         if (  (ERROR_NONE_MAPPED == dwLastError)
               || (SidTypeDeletedAccount == peAcctNameUse))
         {
            dwACEsDeleted++;

            if (bJustCount)
            {
               printf(" - would have edited ACL");
               return (TRUE);
            }

            if (!DeleteAce(paclFile,dwAcl_i))
            {
               PERR("DeleteAce");
               return (FALSE);
            }
         }
      }
   }

   if (dwACEsDeletedBeforeNow < dwACEsDeleted)
   {
      /************************************************************************\
      *
      * This validity check is something a real app might actually like to do.
      *   We manupulated the ACL, so before we write it back into an SD, a check
      *   is worth considering
      *
      \************************************************************************/

      if (!IsValidAcl(paclFile))
      {
         PERR("IsValidAcl said bad ACL!");
         return (FALSE);
      }

      /************************************************************************\
      *
      * Modify the SD in virtual memory
      *
      \************************************************************************/

      if (!SetSecurityDescriptorDacl
          (psdFileSD,
           TRUE,                 // Yes, set the DACL
           paclFile,
           FALSE))               // New DACL explicitly specified
      {
         PERR("SetSecurityDescriptorDacl");
         return (FALSE);
      }

      /************************************************************************\
      *
      * This validity check is something a real app might actually like to do.
      *   We manupulated the SD, so before we write it back out to the file
      *   system, a check is worth considering
      *
      \************************************************************************/

      if (!IsValidSecurityDescriptor(psdFileSD))
      {
         PERR("IsValidSecurityDescriptor said bad SD");
         return (FALSE);
      }

      /************************************************************************\
      *
      * Modify the SD on the hard disk
      *
      \************************************************************************/

      if (!SetFileSecurity
          (lpszFullName,
           (SECURITY_INFORMATION)DACL_SECURITY_INFORMATION,
           psdFileSD))
      {
         PERR("SetFileSecurity");
         return (FALSE);
      }

      printf(" - edited ACL");
   }

   return (TRUE);

}

VOID DisplayHelp ( VOID )

Definition at line 1622 of file SidClean.c.

{
   printf("\nTo run type SIDCLEAN and 3 parameters.  Syntax:");
   printf("\n  SIDCLEAN /roah dirspec filepattern");
   printf("\n           /r    Recursively process subdirectories");
   printf("\n           /o    For any files matching filepattern: Take ownership if");
   printf("\n                   file currently owned by any deleted SID");
   printf("\n           /a    For any files matching filepattern: Edit ACL, deleting");
   printf("\n                   ACEs associated with any deleted SID");
   printf("\n           /c    Overrides /o and /a, causes counts of /a or /o actions that");
   printf("\n                   would take place if /c not used.  Counts always displayed");
   printf("\n           /h    Override other switch values, just display this message\n");
   printf("\n                 . and .. syntax allowed in dirspec");
   printf("\n                 * and ? wildcards allowed in filepattern");
   printf("\n                 Switch letters can be in any order, upper or lower case");
   printf("\nExamples:");
   printf("\n  SIDCLEAN /o  .  *.*  Take ownership of all files (but not subdirs) in ");
   printf("\n                         current dir that are owned by any deleted SID");
   printf("\n  SIDCLEAN /a  .  *.*  For any file in current dir (but not subdirs), delete");
   printf("\n                         any ACL info that is associated with any deleted SID");
   printf("\n  SIDCLEAN /ro .  *.*  Same as first  example, but also recursively process");
   printf("\n                         subdirectories");
   printf("\n  SIDCLEAN /ar .  *.*  Same as second example, but also recursively process");
   printf("\n                         subdirectories");
   printf("\n  SIDCLEAN /O  \\  *.*  Same as first  example, but process files in root");
   printf("\n                         of current drive");
   printf("\n  SIDCLEAN /oC .. *.*  Same as first  example, but looks at files in dir");
   printf("\n                         containing current dir, processes nothing, just counts");
   printf("\n  SIDCLEAN /A d:\\ *.*  Same as second example, but process files in root");
   printf("\n                         of D: drive");
   printf("\n  SIDCLEAN             Displays this message");
   printf("\n  SIDCLEAN /h          Displays this message (so do ? -? /? -h -H /H)\n");
   printf("\nThis utility must be run while logged on as Administrator\n");

   return;
}

BOOL DoAllDirsInOneDir ( char * FilePattern )

Definition at line 446 of file SidClean.c.

{
   HANDLE          hFound;
   WIN32_FIND_DATA ffdFoundData;
   BOOL            bDoneWithHandle = FALSE;

   /**************************************************************************\
   *
   * If not recursing into dirs, simply return
   *
   \**************************************************************************/

   if (!bRecurse)
      return TRUE;

   /**************************************************************************\
   *
   * Since we are recursing, get a handle that points to entire directory, and
   *   walk the handle picking off only directories to recurse into
   *
   \**************************************************************************/

   hFound = FindFirstFile("*.*",
                          (LPWIN32_FIND_DATA)&ffdFoundData);
   if ((HANDLE)(-1) == hFound)
   {
      PrintAppStyleAPIError(FindFirstFile,"on dir *.* FindFirst");
      return (FALSE);
   }

   while (!bDoneWithHandle)
   {
      /************************************************************************\
      *
      * We only do dirs here, and we only do directories with textual names
      *   (i.e., not "." and not "..")
      *
      \************************************************************************/

      if (   (FILE_ATTRIBUTE_DIRECTORY & ffdFoundData.dwFileAttributes)
             && (0 != strcmp("." ,ffdFoundData.cFileName))
             && (0 != strcmp("..",ffdFoundData.cFileName)))
      {
         HANDLE          hFile2;
         WIN32_FIND_DATA ffdFound2;

         /**********************************************************************\
         *
         * We begin processing the new current directory by processing it itself,
         *   then setting the current dir to be the dir itself
         *
         \**********************************************************************/

         if (!DoOneFileOrDir(ffdFoundData.cFileName))
            return (FALSE);

         if (!SetCurrentDirectory(ffdFoundData.cFileName))
         {
            PrintAppStyleAPIError(SetCurrentDirectory,"recursive set");
            return (FALSE);
         }

         /**********************************************************************\
         *
         * It's OK to get no hits.  The files-checked counter will show how many
         *   files we looked at, and it's OK to look at 0
         *
         \**********************************************************************/

         hFile2 = FindFirstFile(FilePattern,
                                (LPWIN32_FIND_DATA)&ffdFound2);
         if ((HANDLE)(-1) == hFile2)
         {
            if (GetLastError() != ERROR_FILE_NOT_FOUND)
            {
               PrintAppStyleAPIError(FindFirstFile,"during recursion");
               return (FALSE);
            }
         }
         else if (!DoMatchingFilesInOneDir(hFile2,ffdFound2))
            return (FALSE);

         if (!DoAllDirsInOneDir(FilePattern))
            return (FALSE);

         if (!SetCurrentDirectory(".."))
         {
            PrintAppStyleAPIError(SetCurrentDirectory,"un-recursive set");
            return (FALSE);
         }
      }

      /************************************************************************\
      *
      * Get next recursion candidate (file or dir at this point, however at loop
      *   top files are screened out)
      *
      \************************************************************************/

      if (!FindNextFile(hFound,
                        (LPWIN32_FIND_DATA)&ffdFoundData))
         if (GetLastError() == ERROR_NO_MORE_FILES)
            bDoneWithHandle = TRUE;
         else
         {
            PrintAppStyleAPIError(FindNextFile,"on dir *.* FindNext");
            return (FALSE);
         }
   }
   return (TRUE);
}

BOOL DoMatchingFilesInOneDir | ( | HANDLE | hFound,
 |  | WIN32_FIND_DATA | ffdFoundData
 | ) |  |

Definition at line 405 of file SidClean.c.

{
   BOOL bDoneWithHandle = FALSE;

   /**************************************************************************\
   *
   * Process all files referred to by the handle, but not including
   *   directories, because directories are handled with separate calls to
   *   DoOneFileOrDir.  Such separate calls are made as we are setting the
   *   current directory to be the directory to be processed
   *
   \**************************************************************************/

   while (!bDoneWithHandle)
   {
      if (!(FILE_ATTRIBUTE_DIRECTORY & ffdFoundData.dwFileAttributes))
      {
         if (!DoOneFileOrDir(ffdFoundData.cFileName))
            return (FALSE);
      }

      if (!FindNextFile(hFound,
                        (LPWIN32_FIND_DATA)&ffdFoundData))
         if (GetLastError() == ERROR_NO_MORE_FILES)
            bDoneWithHandle = TRUE;
         else
         {
            PrintAppStyleAPIError(FindNextFile,"on FindNext");
            return (FALSE);
         }
   }
   return TRUE;
}

BOOL DoOneFileOrDir ( LPTSTR lpszFullName )

Definition at line 621 of file SidClean.c.

{
  #define                                 SZ_REL_SD_BUF 1000
  #define                                 SZ_ABS_SD_BUF  500
  #define                                 SZ_DACL_BUF    500
  #define                                 SZ_SACL_BUF    500
  #define                                 SZ_SID_OWN_BUF 500
  #define                                 SZ_SID_PG_BUF  500
   UCHAR                ucBuf             [SZ_REL_SD_BUF];
   UCHAR                ucBufAbs          [SZ_ABS_SD_BUF];
   UCHAR                ucBufDacl         [SZ_DACL_BUF];
   UCHAR                ucBufSacl         [SZ_SACL_BUF];
   UCHAR                ucBufCtrl         [sizeof(PSECURITY_DESCRIPTOR_CONTROL)];
   UCHAR                ucBufSidOwn       [SZ_SID_OWN_BUF];
   UCHAR                ucBufSidPG        [SZ_SID_PG_BUF];
   DWORD                dwSDLength       = SZ_REL_SD_BUF;
   DWORD                dwDACLLength     = SZ_DACL_BUF;
   DWORD                dwSACLLength     = SZ_SACL_BUF;
   DWORD                dwSidOwnLength   = SZ_SID_OWN_BUF;
   DWORD                dwSidPGLength    = SZ_SID_PG_BUF;
   DWORD                dwSDLengthNeeded;
   PSECURITY_DESCRIPTOR psdSrelFileSD    = (PSECURITY_DESCRIPTOR)&ucBuf;
   PSECURITY_DESCRIPTOR psdAbsFileSD     = (PSECURITY_DESCRIPTOR)&ucBufAbs;
   PSECURITY_DESCRIPTOR_CONTROL psdcCtrl = (PSECURITY_DESCRIPTOR_CONTROL)&ucBufCtrl;
   PACL                 paclDacl         = (PACL)&ucBufDacl;
   PACL                 paclSacl         = (PACL)&ucBufSacl;
   PSID                 psidSidOwn       = (PSID)&ucBufSidOwn;
   PSID                 psidSidPG        = (PSID)&ucBufSidPG;
   BOOL                 bDaclPresent;
   BOOL                 bDaclDefaulted;
   BOOL                 bSaclPresent;
   BOOL                 bSaclDefaulted;
   BOOL                 bOwnerDefaulted;
   BOOL                 bGroupDefaulted;
   BOOL                 bSDSelfRelative;
   DWORD                dwRevision;

   if (!GetFullFileOrDirName(lpszFullName))
      return (FALSE);

   /**************************************************************************\
   *
   * Now the input argument's name is accurate:  it is expanded and lower-case
   *
   \**************************************************************************/

   printf("\nChecking %s",lpszFullName);

   dwFilesChecked++;

   if (!GetFileSecurity
       (lpszFullName,
        (SECURITY_INFORMATION)( OWNER_SECURITY_INFORMATION
                                | GROUP_SECURITY_INFORMATION
                                | DACL_SECURITY_INFORMATION
                                | SACL_SECURITY_INFORMATION),
        psdSrelFileSD,
        dwSDLength,
        (LPDWORD)&dwSDLengthNeeded))
   {
      PERR("GetFileSecurity");
      return (FALSE);
   }

   /**************************************************************************\
   *
   * This validity check is here for demonstration pruposes.  It's not likely a
   *   real app would need to check the validity of this returned SD.  The
   *   validity check APIs are more intended to check validity after app code
   *   has manipulated the structure and is about to hand it back to the system
   *
   \**************************************************************************/

   if (!IsValidSecurityDescriptor(psdSrelFileSD))
   {
      PERR("IsValidSecurityDescriptor said bad SD");
      return (FALSE);
   }

   /**************************************************************************\
   *
   *  Build File SD in absolute format for potential later modification
   *
   *  First Initialize a new SD, which is by definition in absolute format
   *
   *  Then Set in the fields from the relative format SD we just fetched
   *
   \**************************************************************************/

   if (!InitializeSecurityDescriptor(psdAbsFileSD,
                                     SECURITY_DESCRIPTOR_REVISION))
   {
      PERR("InitializeSecurityDescriptor");
      return FALSE;
   }

   /**************************************************************************\
   *
   * Get Control from relative format File SD
   *
   * This control info isn't much queried in the code that follows, as the
   *   Get/Set calls are more convienent in this case, but it does give us a
   *   change to verify that the SD is in relative format
   *
   \**************************************************************************/

   if (!GetSecurityDescriptorControl(psdSrelFileSD,
                                     psdcCtrl,
                                     &dwRevision))
   {
      PERR("GetSecurityDescriptorControl");
      return FALSE;
   }

   bSDSelfRelative = (SE_SELF_RELATIVE & *psdcCtrl);

   /**************************************************************************\
   *
   * Set DACL into absolute format File SD
   *
   * Note that it is possible that a NULL DACL has been explictly specified.
   *   If so the Get/Set call pair will correctly map that into the absolute
   *   format SD
   *
   * The next if statement isn't necessary, it simply shows the relationship
   *   between SE_DACL_PRESENT and SE_DACL_DEFAULTED, and lets you trace
   *   through with the debugger
   *
   \**************************************************************************/

   if (bDaclPresent = (SE_DACL_PRESENT   & *psdcCtrl))
   {                // SE_DACL_DEFAULTED ignored if SE_DACL_PRESENT not set
      bDaclDefaulted = (SE_DACL_DEFAULTED & *psdcCtrl);
   }
   else
   { // No DACL at all

   }

   if (!GetSecurityDescriptorDacl(psdSrelFileSD,
                                  &bDaclPresent,      // fDaclPresent flag
                                  &paclDacl,
                                  &bDaclDefaulted))   // is/is not a default DACL
   {
      PERR("GetSecurityDescriptorDacl");
      return FALSE;
   }
   if (!SetSecurityDescriptorDacl(psdAbsFileSD,
                                  bDaclPresent,       // fDaclPresent flag
                                  paclDacl,
                                  bDaclDefaulted))    // is/is not a default DACL
   {
      PERR("SetSecurityDescriptorDacl");
      return FALSE;
   }

   /**************************************************************************\
   *
   * Set SACL into absolute format File SD
   *
   * Note that it is possible that a NULL SACL has been explictly specified.
   *   If so the Get/Set call pair will correctly map that into the absolute
   *   format SD
   *
   * The next if statement isn't necessary, it simply shows the relationship
   *   between SE_SACL_PRESENT and SE_SACL_DEFAULTED, and lets you trace
   *   through with the debugger
   *
   \**************************************************************************/

   if (bSaclPresent = (SE_SACL_PRESENT   & *psdcCtrl))
   {                // SE_SACL_DEFAULTED ignored if SE_SACL_PRESENT not set
      bSaclDefaulted = (SE_SACL_DEFAULTED & *psdcCtrl);
   }
   else
   { // No SACL at all

   }

   if (!GetSecurityDescriptorSacl(psdSrelFileSD,
                                  &bSaclPresent,      // fSaclPresent flag
                                  &paclSacl,
                                  &bSaclDefaulted))   // is/is not a default SACL
   {
      PERR("GetSecurityDescriptorSacl");
      return FALSE;
   }
   if (!SetSecurityDescriptorSacl(psdAbsFileSD,
                                  bSaclPresent,       // fSaclPresent flag
                                  paclSacl,
                                  bSaclDefaulted))    // is/is not a default SACL
   {
      PERR("SetSecurityDescriptorSacl");
      return FALSE;
   }

   /**************************************************************************\
   *
   * Set Owner into absolute format File SD
   *
   * The next if statement isn't necessary, it simply let's you trace through
   *   with the debugger
   *
   \**************************************************************************/

   bOwnerDefaulted = (SE_OWNER_DEFAULTED & *psdcCtrl);

   if (!GetSecurityDescriptorOwner(psdSrelFileSD,
                                   &psidSidOwn,
                                   &bOwnerDefaulted))   // is/is not a default Owner
   {
      PERR("GetSecurityDescriptorOwner");
      return FALSE;
   }
   if (!SetSecurityDescriptorOwner(psdAbsFileSD,
                                   psidSidOwn,
                                   bOwnerDefaulted))    // is/is not a default Owner
   {
      PERR("SetSecurityDescriptorOwner");
      return FALSE;
   }

   /**************************************************************************\
   *
   * Set Group into absolute format File SD
   *
   * The next if statement isn't necessary, it simply let's you trace through
   *   with the debugger
   *
   \**************************************************************************/

   bGroupDefaulted = (SE_GROUP_DEFAULTED & *psdcCtrl);

   if (!GetSecurityDescriptorGroup(psdSrelFileSD,
                                   &psidSidOwn,
                                   &bGroupDefaulted))   // is/is not a default Group
   {
      PERR("GetSecurityDescriptorGroup");
      return FALSE;
   }
   if (!SetSecurityDescriptorGroup(psdAbsFileSD,
                                   psidSidOwn,
                                   bGroupDefaulted))    // is/is not a default Group
   {
      PERR("SetSecurityDescriptorGroup");
      return FALSE;
   }

   /**************************************************************************\
   *
   * This validity check is here for demonstration pruposes.  It's not likely a
   *   real app would need to check the validity of the SD after it was just
   *   built into absolute format.  The validity check APIs are more intended
   *   to check validity after app code has manipulated the structure and is
   *   about to hand it back to the system
   *
   * One thing to notice is that IsValidSecurityDescriptor will succeed on both
   *   self-relative and absolute format SDs.  However, some other api's, such
   *   as SetSecurityDescriptorOwner, require the SD to be in a certain format,
   *   and will give a return code of Invalid SD if the SD passed to the api is
   *   valid, but in the wrong format.  In other words, when an api such as
   *   SetSecurityDescriptorOwner gives the retun code Invalid SD, this doesn't
   *   mean the SD passed in was necessarily invalid.  It might have been in
   *   the wrong format
   *
   \**************************************************************************/

   if (!IsValidSecurityDescriptor(psdAbsFileSD))
   {
      PERR("IsValidSecurityDescriptor said bad SD");
      return (FALSE);
   }

   if (bTakeOwnership)
      if (!TakeOwnershipIfAppropriate(psdAbsFileSD,lpszFullName))
         return (FALSE);

   if (bEditACLs)
      if (!DeleteACEsAsAppropriate   (psdAbsFileSD,lpszFullName))
         return (FALSE);

   return (TRUE);
}

BOOL GetFullFileOrDirName ( LPTSTR lpszFileName )

Definition at line 565 of file SidClean.c.

{
   UCHAR   ucPathBuf[SZ_NAME_BUF];
   DWORD   dwSzReturned;
   LPTSTR  lpszLastNamePart;
   LPTSTR  lpszFullName;

   dwSzReturned = GetFullPathName
                  (lpszFileName,
                   (DWORD)SZ_NAME_BUF,
                   (LPTSTR)&ucPathBuf,
                   (LPTSTR *)&lpszLastNamePart);
   if (0 == dwSzReturned)
      switch (GetLastError())
      {
      case ERROR_INVALID_NAME   :
         printf("\nError invalid file full-name (on GetFullPathName)");
         return (FALSE);
      default                   :
         PERR("GetFullPathName - unexpected return code");
         return (FALSE);
      }

   if (dwSzReturned > SZ_NAME_BUF)
   {
      PERR("GetFullPathName - buffer too small");
      return (FALSE);
   }

   lpszFullName = CharLower((LPTSTR)&ucPathBuf);

   if (!lpszFullName)
   {
      PERR("CharLower failure");
      return (FALSE);
   }

   /**************************************************************************\
   *
   * Copy the expanded and upper-case-shifted name to the buffer pointed to by
   *   the input argument
   *
   \**************************************************************************/

   strcpy(lpszFileName,lpszFullName);

   return (TRUE);
}

BOOL GetProcessSid ( VOID )

Definition at line 1291 of file SidClean.c.

{
   HANDLE               hProcess;
   PSECURITY_DESCRIPTOR psdProcessSD;
   PSID                 psidProcessOwnerSIDTemp;

   UCHAR                ucBuf       [SZ_REL_SD_BUF];
   DWORD                dwSDLength = SZ_REL_SD_BUF;
   DWORD                dwSDLengthNeeded;
   BOOL                 bOwnerDefaulted;

   hProcess = GetCurrentProcess();

   if (!hProcess)
   {
      PERR("GetCurrentProcess");
      return (FALSE);
   }

   psdProcessSD = (PSECURITY_DESCRIPTOR)ucBuf;

   if (!GetKernelObjectSecurity
       (hProcess,
        (SECURITY_INFORMATION)(OWNER_SECURITY_INFORMATION),
        psdProcessSD,
        dwSDLength,
        (LPDWORD)&dwSDLengthNeeded))
   {
      PERR("GetKernelObjectSecurity on current process handle");
      return (FALSE);
   }

   /**************************************************************************\
   *
   * This validity check is here for demonstration purposes.  It's not likely a
   *   real app would need to check the validity of this returned SD.  The
   *   validity check APIs are more intended to check validity after app code
   *   has manipulated the structure and is about to hand it back to the system
   *
   \**************************************************************************/

   if (!IsValidSecurityDescriptor(psdProcessSD))
   {
      PERR("IsValidSecurityDescriptor said bad SD");
      return (FALSE);
   }

   if (!GetSecurityDescriptorOwner
       (psdProcessSD,
        (PSID *)&psidProcessOwnerSIDTemp,
        (LPBOOL)&bOwnerDefaulted))
   {
      PERR("GetSecurityDescriptorOwner of current process");
      return (FALSE);
   }

   /**************************************************************************\
   *
   * This validity check is here for demonstration pruposes.  It's not likely a
   *   real app would need to check the validity of this returned SID.  The
   *   validity check APIs are more intended to check validity after app code
   *   has manipulated the structure and is about to hand it back to the system
   *
   \**************************************************************************/

   if (!IsValidSid(psidProcessOwnerSIDTemp))
   {
      PERR("IsValidSid said bad process SID!");
      return (FALSE);
   }

   /**************************************************************************\
   *
   * On the other hand, we are about to call GetLengthSid on the returned SID,
   *   and calling GetLengthSid with an invalid SID is a bad idea, since then
   *   GetLengthSid's result is undefined, and an undefined result is hard to
   *   handle cleanly.  So, even in a real app, the above check on SID validity
   *   is a good idea to ensure the result GetLengthSid returns is valid
   *
   * It should be clear that the reason why the CopySid below is needed is that
   *   in the current routine the SID of the current process is on the stack
   *   (in the SD structure), so we have to copy the SID to static storage
   *   before the current routine returns
   *
   \**************************************************************************/

   { DWORD dwSIDLengthNeeded;

      dwSIDLengthNeeded = GetLengthSid(psidProcessOwnerSIDTemp);

      psidProcessOwnerSID = malloc(dwSIDLengthNeeded);

      if (NULL == psidProcessOwnerSID)
         PERR("GetProcessSid - ran out of heap space");

      if (!CopySid(dwSIDLengthNeeded,
                   psidProcessOwnerSID,
                   psidProcessOwnerSIDTemp))
      {
         PERR("CopySid");
         free(psidProcessOwnerSID);
         return (FALSE);
      }
   }

   /**************************************************************************\
   *
   * This validity check is here for demonstration pruposes only (see above).
   *
   \**************************************************************************/

   if (!IsValidSid(psidProcessOwnerSID))
   {
      PERR("IsValidSid said bad process SID!");
      free(psidProcessOwnerSID);
      return (FALSE);
   }

   /**************************************************************************\
   *
   * Now ensure that two privileges are enabled in the access token of the
   *   current process
   *
   \**************************************************************************/

   { HANDLE           hAccessToken;
      LUID             luidPrivilegeLUID;
      TOKEN_PRIVILEGES tpTokenPrivilege;

      if (!OpenProcessToken(hProcess,
                            TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,
                            &hAccessToken))
      {
         PERR("OpenProcessToken");
         free(psidProcessOwnerSID);
         return (FALSE);
      }

      /************************************************************************\
      *
      * Get LUID of SeTakeOwnershipPrivilege privilege
      *
      \************************************************************************/

      if (!LookupPrivilegeValue(NULL,
                                "SeTakeOwnershipPrivilege",
                                &luidPrivilegeLUID))
      {
         PERR("LookupPrivilegeValue");
         printf("\nThe above error means you need to use User Manager (menu item");
         printf("\n  Policies\\UserRights) to turn on the 'Take ownership of...' ");
         printf("\n  privilege, log off, log back on");
         free(psidProcessOwnerSID);
         return (FALSE);
      }

      /************************************************************************\
      *
      * Enable the SeTakeOwnershipPrivilege privilege using the LUID just
      *   obtained
      *
      \************************************************************************/

      tpTokenPrivilege.PrivilegeCount = 1;
      tpTokenPrivilege.Privileges[0].Luid = luidPrivilegeLUID;
      tpTokenPrivilege.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;

      AdjustTokenPrivileges (hAccessToken,
                             FALSE,  // Do not disable all
                             &tpTokenPrivilege,
                             sizeof(TOKEN_PRIVILEGES),
                             NULL,   // Ignore previous info
                             NULL);  // Ignore previous info

      if ( GetLastError() != NO_ERROR )
      {
         PERR("AdjustTokenPrivileges");
         free(psidProcessOwnerSID);
         return (FALSE);
      }

      /************************************************************************\
      *
      * Get LUID of SeSecurityPrivilege privilege
      *
      \************************************************************************/

      if (!LookupPrivilegeValue(NULL,
                                "SeSecurityPrivilege",
                                &luidPrivilegeLUID))
      {
         PERR("LookupPrivilegeValue");
         printf("\nThe above error means you need to log on as an Administrator");
         free(psidProcessOwnerSID);
         return (FALSE);
      }

      /************************************************************************\
      *
      * Enable the SeSecurityPrivilege privilege using the LUID just
      *   obtained
      *
      \************************************************************************/

      tpTokenPrivilege.PrivilegeCount = 1;
      tpTokenPrivilege.Privileges[0].Luid = luidPrivilegeLUID;
      tpTokenPrivilege.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;

      AdjustTokenPrivileges (hAccessToken,
                             FALSE,  // Do not disable all
                             &tpTokenPrivilege,
                             sizeof(TOKEN_PRIVILEGES),
                             NULL,   // Ignore previous info
                             NULL);  // Ignore previous info

      if ( GetLastError() != NO_ERROR )
      {
         PERR("AdjustTokenPrivileges");
         free(psidProcessOwnerSID);
         return (FALSE);
      }

   }

   return (TRUE);

}

UINT main | ( | UINT | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 280 of file SidClean.c.

{
   WIN32_FIND_DATA ffdFoundData;
   HANDLE          hFound;
  #define                   SZ_NAME_BUF MAX_PATH
   UCHAR           ucPathBuf[SZ_NAME_BUF];
   LPTSTR          lpszFullName = (LPTSTR)&ucPathBuf;

   /**************************************************************************\
   *
   * Store the process's SID in a global variable for later use (in taking
   *   ownership).
   *
   \**************************************************************************/

   if (!GetProcessSid())
   {
      PERR("Can't proceed without process SID - see earlier error messages");
      return (1);
   }

   if (!CrackArgs(argc,argv))
      return (1);

   /**************************************************************************\
   *
   * CrackArgs has set our global processing switches, and proven argv[2] and
   *   argv[3] are our non-blank dir-spec and file-pattern strings.  Now we
   *   must see that the file-spec is acceptable to the Win32 api's.  Argv[2]
   *   is the file-spec to pass to SetCurrentDirectory, and argv[3] is the
   *   file-pattern to pass to FindFirstFile
   *
   * First we have to expand the dir-spec in argv[2], because if we set the
   *   current directory to it before expansion,the expansion will have a
   *   different result if argv[2] is something like ..\..
   *
   \**************************************************************************/

   strncpy(lpszFullName, argv[2], SZ_NAME_BUF);

   if (!GetFullFileOrDirName(lpszFullName))
   {
      PERR("Failed to expand to full name the 2nd argument (directory specification)");
      return (1);
   }

   /**************************************************************************\
   *
   * Now we pass the un-expanded argv[2] to SetCurrentDirectory for validity
   *   checking.  GetFullPathName (called by GetFullFileOrDirName) does not
   *   validity check
   *
   \**************************************************************************/

   if (!SetCurrentDirectory(argv[2]))
   {
      PrintAppStyleAPIError(SetCurrentDirectory,"2nd argument (directory specification)");
      return (1);
   }

   /**************************************************************************\
   *
   * We begin processing with the current directory, using the expanded form we
   *   got before.  We have to use the expanded form, because if we set to
   *   ..\.. and then try to process the string ..\.. as a dir name, instead of
   *   processing the dir two levels up from where we are we'll process the dir
   *   four levels up
   *
   \**************************************************************************/

   if (!DoOneFileOrDir(lpszFullName))
      return (1);

   /**************************************************************************\
   *
   * It's OK to get no hits.  The files-checked counter will show how many
   *   files we looked at, and it's OK to look at 0
   *
   * On the else branch, Argv[3] has been verified, and we have a good handle.
   *   We now pass to DoMatchingFilesInOneDir for processing the handle and
   *   found data we just got from FindFirstFile
   *
   \**************************************************************************/

   hFound = FindFirstFile(argv[3],
                          (LPWIN32_FIND_DATA)&ffdFoundData);
   if ((HANDLE)(-1) == hFound)
   {
      if (GetLastError() != ERROR_FILE_NOT_FOUND)
      {
         PrintAppStyleAPIError(FindFirstFile,"3rd argument");
         return (1);
      }
   }
   else if (!DoMatchingFilesInOneDir(hFound,ffdFoundData))
      return (1);

   /**************************************************************************\
   *
   * Pass the original file pattern for recursive calling to DoAllDirsInOneDir
   *
   \**************************************************************************/

   if (!DoAllDirsInOneDir(argv[3]))
      return (1);

   if (bJustCount)
      printf("\nChecked %d files, would have taken ownership of %d files, would have deleted %d ACEs\n",
             dwFilesChecked,dwFilesOwned,dwACEsDeleted);
   else
      printf("\nChecked %d files, took ownership of %d files, deleted %d ACEs\n",
             dwFilesChecked,dwFilesOwned,dwACEsDeleted);

   free(psidProcessOwnerSID);

   return (0);
}

BOOL TakeOwnershipIfAppropriate | ( | PSECURITY_DESCRIPTOR | psdFileSD,
 |  | LPTSTR | lpszFullName
 | ) |  |

Definition at line 912 of file SidClean.c.

{
   PSID psidFileOwnerSID;
   {
      BOOL  bOwnerDefaulted;

      if (!GetSecurityDescriptorOwner
          (psdFileSD,
           (PSID *)&psidFileOwnerSID,
           (LPBOOL)&bOwnerDefaulted))
      {
         PERR("GetSecurityDescriptorOwner");
         return (FALSE);
      }

      /************************************************************************\
      *
      * This validity check is here for demonstration pruposes.  It's not likely
      *   a real app would need to check the validity of this returned SID.  The
      *   validity check APIs are more intended to check validity after app code
      *   has manipulated the structure and is about to hand it back to the
      *   system
      *
      \************************************************************************/

      if (!IsValidSid(psidFileOwnerSID))
      {
         PERR("IsValidSid said bad SID!");
         return (FALSE);
      }
   }

   {
      DWORD        dwLastError   = NO_ERROR;
    #define                      SZ_ACCT_NAME_BUF 1000
      UCHAR        ucNameBuf      [SZ_ACCT_NAME_BUF];
      DWORD        dwNameLength  = SZ_ACCT_NAME_BUF;
    #define                      SZ_DMN_NAME_BUF  1000
      UCHAR        ucDomainNmBuf  [SZ_DMN_NAME_BUF ];
      DWORD        dwDNameLength = SZ_DMN_NAME_BUF ;
      SID_NAME_USE peAcctNameUse;

      if (!LookupAccountSid
          ((LPTSTR)"",             // Look on local machine
           psidFileOwnerSID,
           (LPTSTR)&ucNameBuf,
           (LPDWORD)&dwNameLength,
           (LPTSTR)&ucDomainNmBuf,
           (LPDWORD)&dwDNameLength,
           (PSID_NAME_USE)&peAcctNameUse))
      {
         dwLastError = GetLastError();
         if (ERROR_NONE_MAPPED != dwLastError)
         {
            PERR("LookupAccountSID");
            return (FALSE);
         }
      }

      /************************************************************************\
      *
      * If deleted account, take ownership.  This routine's caller checked the
      *   global switches that said we are in take ownership mode
      *
      * In some cases, the account lookup will fail with ERROR_NONE_MAPPED,
      *   meaning there is no deleted account mapped to the SID, in which case
      *   we also take ownership
      *
      *   We check that first to avoid referencing peAcctNameUse, which in that
      *     case is not set
      *
      \************************************************************************/

      if (  (ERROR_NONE_MAPPED == dwLastError)
            || (SidTypeDeletedAccount == peAcctNameUse))
      {
         dwFilesOwned++;

         if (bJustCount)
         {
            printf(" - would have taken ownership");
            return (TRUE);
         }
         else
         {
            /********************************************************************\
            *
            * Modify the SD in virtual memory.  No check on the new owning SID
            *   here, because we validity checked it when we fetched it in
            *   GetProcessSid
            *
            \********************************************************************/

            if (!SetSecurityDescriptorOwner
                (psdFileSD,
                 psidProcessOwnerSID,
                 FALSE))               // New owner explicitly specified
            {
               PERR("SetSecurityDescriptorOwner");
               return (FALSE);
            }

            /********************************************************************\
            *
            *  This validity check is something a real app might actually like to
            *    do.  We manupulated the SD, so before we write it back out to the
            *    file system, a check is worth considering.
            *
            \********************************************************************/

            if (!IsValidSecurityDescriptor(psdFileSD))
            {
               PERR("IsValidSecurityDescriptor said bad SD");
               return (FALSE);
            }

            /********************************************************************\
            *
            * Modify the SD on the hard disk
            *
            \********************************************************************/

            if (!SetFileSecurity
                (lpszFullName,
                 (SECURITY_INFORMATION)OWNER_SECURITY_INFORMATION,
                 psdFileSD))
            {
               PERR("SetFileSecurity");
               return (FALSE);
            }

            printf(" - took ownership");
         }
      }
   }

   return (TRUE);

}

Variable Documentation

BOOL bEditACLs = FALSE

Definition at line 245 of file SidClean.c.

BOOL bJustCount = FALSE

Definition at line 247 of file SidClean.c.

BOOL bRecurse = FALSE

Definition at line 246 of file SidClean.c.

BOOL bTakeOwnership = FALSE

Definition at line 244 of file SidClean.c.

DWORD dwACEsDeleted = 0

Definition at line 251 of file SidClean.c.

DWORD dwFilesChecked = 0

Definition at line 249 of file SidClean.c.

DWORD dwFilesOwned = 0

Definition at line 250 of file SidClean.c.

PSID psidProcessOwnerSID

Definition at line 253 of file SidClean.c.

Generated on Wed Nov 13 2024 16:54:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/Authorization/SuperUsr/SuperUsr.cpp File Reference

  • Security
  • Authorization
  • SuperUsr
Defines | Functions

SuperUsr.cpp File Reference

#include <windows.h>
#include <aclapi.h>
#include <stdio.h>
#include <stdlib.h>
#include <tchar.h>
#include <strsafe.h>

Go to the source code of this file.

Defines

#define | _UNICODE
#define | _WIN32_WINNT 0x0400
#define | CheckAndLocalFree(ptr)
#define | MAX_PID_DIGITS 6
#define | UNICODE

Functions

void | _tmain (int argc, TCHAR *argv[])
BOOL | BuildAdministratorsExplicitAccess (EXPLICIT_ACCESS *pExplicitAccess, DWORD dwAccess)
BOOL | EnableDebugPriv (void)
BOOL | ModifySecurity (HANDLE hToken, DWORD dwAccess, PSECURITY_DESCRIPTOR *pOldSD)
void __cdecl | MyPrintf (LPCTSTR lpszFormat,...)
BOOL | ResetSecurity (HANDLE hToken, PSECURITY_DESCRIPTOR pSid)

Define Documentation

#define _UNICODE

Definition at line 15 of file SuperUsr.cpp.

#define _WIN32_WINNT 0x0400

Definition at line 16 of file SuperUsr.cpp.

#define CheckAndLocalFree ( ptr )
Value:
if (ptr != NULL) \
            { \
               LocalFree(ptr); \
               ptr = NULL; \
            }

Definition at line 27 of file SuperUsr.cpp.

#define MAX_PID_DIGITS 6

Definition at line 25 of file SuperUsr.cpp.

#define UNICODE

Definition at line 14 of file SuperUsr.cpp.

Function Documentation

void _tmain | ( | int | argc,
 |  | TCHAR * | argv[]
 | ) |  |

Definition at line 40 of file SuperUsr.cpp.

{
   HANDLE hProc = NULL;
   HANDLE hToken = NULL;
   HANDLE hOldToken = NULL;
   TCHAR szCmdExe[] = { _T("cmd.exe") } ;
   PROCESS_INFORMATION pi = { NULL, NULL, 0, 0 };
   PSECURITY_DESCRIPTOR pOldSD = NULL;
   STARTUPINFO si;
   DWORD SystemPID;
   BOOL fResult;
   CHAR szPID[MAX_PID_DIGITS];
   DWORD dwPID;
   HRESULT hr;
   int n;

   if (argc != 2)
   {
      MyPrintf(_T("Usage: SuperUsr <System PID>\n"));
      return;
   }

   __try
   {
      hr = StringCchLength(argv[1], MAX_PID_DIGITS, (size_t *)&dwPID);
      if (FAILED(hr))
      {
         MyPrintf(_T("StringCbLength failed with %X\n"), hr);
         __leave;
      }

#ifdef UNICODE
      n = WideCharToMultiByte(0, 0, argv[1], -1, szPID, dwPID + 1, NULL, NULL);
      if (n == 0)
      {
         MyPrintf(_T("WideCharToMultiByte failed with %d\n"), GetLastError());
         __leave;
      }
#else
      hr = StringCchCopy(szPID, dwPID + 1, argv[1]);
      if (FAILED(hr))
      {
         MyPrintf(_T("StringCchCopy failed with %X\n"), hr);
         __leave;
      }
#endif

      SystemPID = (DWORD)atoi(szPID);

      fResult = EnableDebugPriv();
      if(!fResult)
      {
         MyPrintf(_T("You probably don't have the SE_DEBUG_NAME privilege.\n"));
         MyPrintf(_T("You are probably not a member of the administrator group.\n"));
         __leave;
      }

      hProc = OpenProcess(PROCESS_ALL_ACCESS,
                          FALSE,
                          SystemPID);
      if (!hProc)
      {
         MyPrintf(_T("OpenProcess failed with %d.\n"), GetLastError());
         __leave;
      }

      //
      // Open the process token with this access
      // so that we can modify the DACL and add
      // TOKEN_DUPLICATE & TOKEN_ASSIGN_PRIMARY
      // rights for this user
      //
      fResult = OpenProcessToken(hProc,
                                 READ_CONTROL|WRITE_DAC,
                                 &hOldToken);
      if (!fResult)
      {
         MyPrintf(_T("OpenProcessToken failed with %d.\n"), GetLastError());
         __leave;
      }

      fResult = ModifySecurity(hOldToken,
                               TOKEN_DUPLICATE|TOKEN_ASSIGN_PRIMARY|TOKEN_QUERY,
                               &pOldSD);
      if (!fResult)
      {
         __leave;
      }

      fResult = OpenProcessToken(hProc,
                                 TOKEN_DUPLICATE|TOKEN_ASSIGN_PRIMARY|TOKEN_QUERY,
                                 &hToken);
      if (!fResult)
      {
         MyPrintf(_T("OpenProcessToken failed with %d.\n"), GetLastError());
         __leave;
      }

      // Reset the security to the old permissions
      // We still retain the modified permissions
      // because we haven't closed the handle
      ResetSecurity(hOldToken, pOldSD);

      //
      // setup STARTUPINFO structure
      //
      ZeroMemory(&si, sizeof(STARTUPINFO));
      si.cb = sizeof(STARTUPINFO);

      //
      // winsta0\default is the interactive user's
      // desktop.  Setting lpDesktop to winsta0\default
      // tells CreateProcessAsUser to launch
      // cmd.exe in the interactive user's desktop.
      //
      si.lpDesktop = _T("winsta0\\default");

      fResult = CreateProcessAsUser(hToken,
                                    NULL,
                                    szCmdExe,
                                    NULL, // default process attributes
                                    NULL, // default thread attributes
                                    FALSE, // don't inherit handles
                                    CREATE_NEW_CONSOLE,
                                    NULL,  // inherit environment
                                    NULL,  // same directory
                                    &si,
                                    &pi );
      if (!fResult)
      {
         MyPrintf(_T("CreateProcessAsUser failed with %d.\n"), GetLastError());
      }
      else
      {
         MyPrintf(_T("\"SuperUsr\" mode console started!\n"));
      }
   }
   __finally
   {
      // Cleanup
      if (pi.hThread != NULL) CloseHandle(pi.hThread);
      if (pi.hProcess != NULL) CloseHandle(pi.hProcess);
      if (hProc != NULL) CloseHandle(hProc);
      if (hToken != NULL) CloseHandle(hToken);
      if (hOldToken != NULL) CloseHandle(hOldToken);
      CheckAndLocalFree(pOldSD);
   }
}

BOOL BuildAdministratorsExplicitAccess | ( | EXPLICIT_ACCESS * | pExplicitAccess,
 |  | DWORD | dwAccess
 | ) |  |

Definition at line 436 of file SuperUsr.cpp.

{
   SID_IDENTIFIER_AUTHORITY SystemSidAuthority = SECURITY_NT_AUTHORITY;
   PSID pSid = NULL;
   BOOL fResult;

   // Create "Administrators" SID
   fResult = AllocateAndInitializeSid(&SystemSidAuthority,
                                       2,
                                       SECURITY_BUILTIN_DOMAIN_RID,
                                       DOMAIN_ALIAS_RID_ADMINS,
                                       0,
                                       0,
                                       0,
                                       0,
                                       0,
                                       0,
                                       &pSid);
   if (!fResult)
   {
      MyPrintf(_T("AllocateAndInitializeSid failed with %d.\n"), GetLastError());
      return FALSE;
   }

   pExplicitAccess->grfAccessMode = GRANT_ACCESS;
   pExplicitAccess->grfAccessPermissions = dwAccess;
   pExplicitAccess->grfInheritance = 0;

   // Build the Trustee with the SID
   BuildTrusteeWithSid(&(pExplicitAccess->Trustee), pSid);

   return TRUE;
}

BOOL EnableDebugPriv ( void )

Definition at line 189 of file SuperUsr.cpp.

{
   TOKEN_PRIVILEGES tp;
   HANDLE hToken = NULL;
   BOOL fReturn = FALSE;
   BOOL fResult;
   LUID luid;

   __try
   {
      fResult = OpenProcessToken(GetCurrentProcess(),
                                 TOKEN_ADJUST_PRIVILEGES,
                                 &hToken);
      if (!fResult)
      {
         MyPrintf(_T("OpenProcessToken failed with %d.\n"), GetLastError());
         __leave;
      }

      // Lookup Debug Privilege Luid
      fResult = LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &luid);
      if (!fResult)
      {
         MyPrintf(_T("LookupPrivilegeValue failed with %d.\n"), GetLastError());
         __leave;
      }

      tp.PrivilegeCount           = 1;
      tp.Privileges[0].Luid       = luid;
      tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;

      // Enable privilege
      fResult = AdjustTokenPrivileges(hToken,
                                      FALSE,
                                      &tp,
                                      sizeof(TOKEN_PRIVILEGES),
                                      NULL,
                                      NULL);
      if (!fResult || GetLastError() != ERROR_SUCCESS)
      {
         MyPrintf(_T("AdjustTokenPrivileges failed with %d.\n"), GetLastError());
         __leave;
      }

      fReturn = TRUE;
   }
   __finally
   {
      // Cleanup
      if (hToken != NULL) CloseHandle(hToken);
   }

   return(fReturn);
}

BOOL ModifySecurity | ( | HANDLE | hToken,
 |  | DWORD | dwAccess,
 |  | PSECURITY_DESCRIPTOR * | pOldSD
 | ) |  |

Definition at line 244 of file SuperUsr.cpp.

{
   PSECURITY_DESCRIPTOR pSD = NULL;
   PSECURITY_DESCRIPTOR pAbsSD = NULL;
   PACL pNewAcl = NULL;
   DWORD dwAclSize = 0, dwSaclSize = 0;
   DWORD dwSidOwnLen = 0, dwSidPrimLen = 0;
   DWORD dwSDLength = 0;
   DWORD dwSDLengthNeeded;
   EXPLICIT_ACCESS explicitaccess;
   DWORD dwResult;
   PACL pAcl;
   PACL pacl;
   BOOL fDaclPresent,fDaclDefaulted;
   BOOL fResult;
   BOOL fReturn = FALSE;

   __try
   {
      explicitaccess.Trustee.ptstrName = NULL;

      // Get size of security descriptor
      fResult = GetKernelObjectSecurity(hToken,
                                        DACL_SECURITY_INFORMATION,
                                        NULL,
                                        0,
                                        &dwSDLengthNeeded);
      if (!fResult)
      {
         if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
         {
            // Allocate memory for security descriptor
            pSD = (PSECURITY_DESCRIPTOR)LocalAlloc(LPTR, dwSDLengthNeeded);
            if (!pSD)
            {
               MyPrintf(_T("Unable to allocate memory for security descriptor.\n"));
               __leave;
            }

            *pOldSD = pSD;

            // Get Security Descriptor from token
            fResult = GetKernelObjectSecurity(hToken,
                                        DACL_SECURITY_INFORMATION,
                                        pSD,
                                        dwSDLengthNeeded,
                                        &dwSDLengthNeeded);
            if (!fResult)
            {
               MyPrintf(_T("GetKernelObjectSecurity failed with %d.\n"), GetLastError());
               __leave;
            }
         }
         else
         {
            MyPrintf(_T("GetKernelObjectSecurity failed with %d.\n"), GetLastError());
            __leave;
         }
      }

      // Get pointer to the DACL
      fResult = GetSecurityDescriptorDacl(pSD,
                                          &fDaclPresent,
                                          &pAcl,
                                          &fDaclDefaulted);
      if (!fResult)
      {
         MyPrintf(_T("GetSecurityDescriptorDacl failed with %d.\n"), GetLastError());
         __leave;
      }

      // Build Administrators EXPLICIT_ACCESS Structure
      fResult = BuildAdministratorsExplicitAccess(&explicitaccess, dwAccess);
      if (!fResult)
      {
         __leave;
      }

      // Add the entry to the ACL
      dwResult = SetEntriesInAcl(1,
                                 &explicitaccess,
                                 pAcl,
                                 &pNewAcl);
      if (dwResult != ERROR_SUCCESS)
      {
         MyPrintf(_T("SetEntriesInAcl failed with %d.\n"), GetLastError());
         __leave;
      }

      // Get Sizes for Absolute Security Descriptor
      // We only need dwSDLength and dwAclSize.
      // The SACL, SID owner, and SID primary group
      // are not present.
      fResult = MakeAbsoluteSD(pSD,
                               NULL,
                               &dwSDLength,
                               NULL,
                               &dwAclSize,
                               NULL,
                               &dwSaclSize,
                               NULL,
                               &dwSidOwnLen,
                               NULL,
                               &dwSidPrimLen);
      if (!fResult)
      {
         if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
         {
            // Allocate memory for absolute Security Descriptor
            pAbsSD = (PSECURITY_DESCRIPTOR)LocalAlloc(LPTR, dwSDLength);
            if (!pAbsSD)
            {
               MyPrintf(_T("Unable to allocate memory for Absolute SID.\n"));
               __leave;
            }

            // Allocate memory for DACL
            pacl = (PACL)LocalAlloc(LPTR, dwAclSize);
            if (!pacl)
            {
               MyPrintf(_T("Unable to allocate memory for DACL.\n"));
               __leave;
            }
         }
         else
         {
            MyPrintf(_T("MakeAbsoluteSD failed with %d.\n"), GetLastError());
            __leave;
         }
      }

      // Create absolute Security Descriptor
      fResult = MakeAbsoluteSD(pSD,
                               pAbsSD,
                               &dwSDLength,
                               pacl,
                               &dwAclSize,
                               NULL,
                               &dwSaclSize,
                               NULL,
                               &dwSidOwnLen,
                               NULL,
                               &dwSidPrimLen);
      if (!fResult)
      {
         MyPrintf(_T("MakeAbsoluteSD failed with %d.\n"), GetLastError());
         __leave;
      }

      // Add the new DACL to the SD
      fResult = SetSecurityDescriptorDacl(pAbsSD,
                                          fDaclPresent,
                                          pNewAcl,
                                          fDaclDefaulted);
      if (!fResult)
      {
         MyPrintf(_T("SetSecurityDescriptorDacl failed with %d.\n"), GetLastError());
         __leave;
      }

      // Add the new SD to the token
      fResult = SetKernelObjectSecurity(hToken,
                                        DACL_SECURITY_INFORMATION,
                                        pAbsSD);
      if (!fResult)
      {
         MyPrintf(_T("SetKernelObjectSecurity failed with %d.\n"), GetLastError());
         __leave;
      }

      fReturn = TRUE;
   }
   __finally
   {
      // Cleanup
      if (explicitaccess.Trustee.ptstrName != NULL)
      {
         FreeSid(explicitaccess.Trustee.ptstrName);
      }
      CheckAndLocalFree(pAbsSD);
      CheckAndLocalFree(pacl);
      CheckAndLocalFree(pNewAcl);
      if (!fReturn)
      {
         CheckAndLocalFree(pSD);
         *pOldSD = NULL;
      }
   }

   return fReturn;
}

void __cdecl MyPrintf | ( | LPCTSTR | lpszFormat,
 |  |  | ...
 | ) |  |

Definition at line 470 of file SuperUsr.cpp.

{
   TCHAR szOutput[2048];
   va_list v1 = NULL;
   HRESULT hr = S_OK;

   va_start(v1, lpszFormat);
   hr = StringCbVPrintf(szOutput, sizeof(szOutput), lpszFormat, v1);
   if (SUCCEEDED(hr))
   {
      OutputDebugString(szOutput);
      _tprintf(szOutput);
   }
   else
   {
      _tprintf(_T("StringCbVPrintf failed with %X\n"), hr);
   }
}

BOOL ResetSecurity | ( | HANDLE | hToken,
 |  | PSECURITY_DESCRIPTOR | pSid
 | ) |  |

Definition at line 489 of file SuperUsr.cpp.

{
   BOOL fResult;

   // Add the new SD to the token
   fResult = SetKernelObjectSecurity(hToken,
                                     DACL_SECURITY_INFORMATION,
                                     pSD);
   if (!fResult)
   {
      MyPrintf(_T("SetKernelObjectSecurity failed with %d.\n"), GetLastError());
      return FALSE;
   }

   return TRUE;
}

Generated on Wed Nov 13 2024 16:54:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/Authorization/TakeOwn/TakeOwn.c File Reference

  • Security
  • Authorization
  • TakeOwn
Functions | Variables

TakeOwn.c File Reference

#include <windows.h>
#include <stdio.h>
#include <malloc.h>

Go to the source code of this file.

Functions

BOOL | AssertTakeOwnership (HANDLE TokenHandle)
BOOL | GetTokenHandle (PHANDLE TokenHandle)
void | main (int argc, char *argv[])
BOOL VariableInitialization ()

Variables

PSID | AliasAdminsSid = NULL
PSID SeWorldSid

Function Documentation

BOOL AssertTakeOwnership ( HANDLE TokenHandle )

Definition at line 285 of file TakeOwn.c.

{
    LUID TakeOwnershipValue;
    BOOL Result;
    TOKEN_PRIVILEGES TokenPrivileges;

    //
    // First, find out the value of TakeOwnershipPrivilege
    //

    Result = LookupPrivilegeValue(
                 NULL,
                 "SeTakeOwnershipPrivilege",
                 &TakeOwnershipValue
                 );

    if ( !Result ) {

        //
        // This should not happen
        //

        printf("Unable to obtain value of TakeOwnership privilege\n");
        printf("Error = %d\n",GetLastError());
        printf("Exiting\n");
        return FALSE;
    }

    //
    // Set up the privilege set we will need
    //

    TokenPrivileges.PrivilegeCount = 1;
    TokenPrivileges.Privileges[0].Luid = TakeOwnershipValue;
    TokenPrivileges.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;

    (VOID) AdjustTokenPrivileges (
                TokenHandle,
                FALSE,
                &TokenPrivileges,
                sizeof( TOKEN_PRIVILEGES ),
                NULL,
                NULL
                );

    if ( GetLastError() != NO_ERROR ) {

        return( FALSE );

    } else {

        return( TRUE );
    }

}

BOOL GetTokenHandle ( PHANDLE TokenHandle )

Definition at line 237 of file TakeOwn.c.

{

    HANDLE ProcessHandle;
    BOOL bResult;

    ProcessHandle = OpenProcess(
                               PROCESS_QUERY_INFORMATION,
                               FALSE,
                               GetCurrentProcessId()
                               );

    if ( ProcessHandle == NULL )
    {

        //
        // This should not happen
        //

        return( FALSE );
    }

    bResult = OpenProcessToken (
                               ProcessHandle,
                               TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,
                               TokenHandle
                               );

    // Close the Handle - Don't leak memory
    CloseHandle(ProcessHandle);

    // OpenProcessToken Returns TRUE or FALSE
    return bResult;

}

void main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 54 of file TakeOwn.c.

{

    BOOL Result;
    LPSTR lpFileName;
    SECURITY_DESCRIPTOR SecurityDescriptor;
    HANDLE TokenHandle;

    //
    // We expect a file...
    //
    if (argc <= 1) {

        printf("Must specify a file name");
        return;
    }

    lpFileName = argv[1];

    Result = VariableInitialization();

    if ( !Result ) {
        printf("Out of memory\n");
        return;
    }

    Result = GetTokenHandle( &TokenHandle );

    if ( !Result ) {

        //
        // This should not happen
        //

        printf("Unable to obtain the handle to our token, exiting\n");
        return;
    }

    //
    // Attempt to put a NULL Dacl on the object
    //

    InitializeSecurityDescriptor( &SecurityDescriptor, SECURITY_DESCRIPTOR_REVISION );

    Result = SetSecurityDescriptorDacl (
                 &SecurityDescriptor,
                 TRUE,
                 NULL,
                 FALSE
                 );

    if ( !Result ) {
        printf("SetSecurityDescriptorDacl failed, error code = %d\n", GetLastError());
        printf("Exiting\n");
        return;
    }

    Result = SetFileSecurity(
                 lpFileName,
                 DACL_SECURITY_INFORMATION,
                 &SecurityDescriptor
                 );

    if ( Result ) {

        printf("Successful, protection removed\n");
        return;
    }

    //
    // That didn't work.
    //

    //
    // Attempt to make Administrator the owner of the file.
    //

    Result = SetSecurityDescriptorOwner (
                 &SecurityDescriptor,
                 AliasAdminsSid,
                 FALSE
                 );

    if ( !Result ) {
        printf("SetSecurityDescriptorOwner failed, lasterror = %d\n", GetLastError());
        return;
    }

    Result = SetFileSecurity(
                 lpFileName,
                 OWNER_SECURITY_INFORMATION,
                 &SecurityDescriptor
                 );

    if ( !Result ) {

        //
        // That didn't work either.
        //

        //
        // Assert TakeOwnership privilege, then try again.  Note that
        // since the privilege is only enabled for the duration of
        // this process, we don't have to worry about turning it off
        // again.
        //

        Result = AssertTakeOwnership( TokenHandle );

        if ( !Result ) {
            printf("Could not enable SeTakeOwnership privilege\n");
            printf("Log on as Administrator and try again\n");
            return;
        }

        Result = SetFileSecurity(
                     lpFileName,
                     OWNER_SECURITY_INFORMATION,
                     &SecurityDescriptor
                     );

        if ( !Result ) {

            printf("Unable to assign Administrator as owner\n");
            printf("Log on as Administrator and try again\n");
            return;

        }
    }

    //
    // Try to put a benign DACL onto the file again
    //

    Result = SetFileSecurity(
                 lpFileName,
                 DACL_SECURITY_INFORMATION,
                 &SecurityDescriptor
                 );

    if ( !Result ) {

        //
        // This should not happen.
        //

        printf("SetFileSecurity unexpectedly failed, error code = %d\n", GetLastError());

    } else {

        printf("Successful, protection removed\n");
        return;
    }
}

BOOL VariableInitialization ( )

Definition at line 357 of file TakeOwn.c.

{

    BOOL Result;

    Result = AllocateAndInitializeSid(
                 &SepNtAuthority,
                 2,
                 SECURITY_BUILTIN_DOMAIN_RID,
                 DOMAIN_ALIAS_RID_ADMINS,
                 0,
                 0,
                 0,
                 0,
                 0,
                 0,
                 &AliasAdminsSid
                 );

    if ( !Result ) {
        return( FALSE );
    }

    Result = AllocateAndInitializeSid(
                 &SepWorldSidAuthority,
                 1,
                 SECURITY_WORLD_RID,
                 0,
                 0,
                 0,
                 0,
                 0,
                 0,
                 0,
                 &SeWorldSid
                 );

    if ( !Result ) {
        return( FALSE );
    }

    return( TRUE );
}

Variable Documentation

PSID AliasAdminsSid = NULL

Definition at line 45 of file TakeOwn.c.

PSID SeWorldSid

Definition at line 46 of file TakeOwn.c.

Generated on Wed Nov 13 2024 16:54:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/Authorization/TextSid/TextSid.c File Reference

  • Security
  • Authorization
  • TextSid
Defines | Functions

TextSid.c File Reference

#include <windows.h>
#include <stdio.h>
#include <tchar.h>
#include <shlwapi.h>

Go to the source code of this file.

Defines

#define | MY_BUFSIZE 256
#define | RTN_ERROR 13
#define | RTN_OK 0

Functions

void | DisplayWinError (LPSTR szAPI, DWORD dwError)
void | DisplayWinError (LPTSTR szAPI, DWORD dwError)
BOOL | GetTextualSid (PSID pSid, LPTSTR TextualSID, LPDWORD cchSidSize)
int __cdecl | main (void)

Define Documentation

#define MY_BUFSIZE 256
#define RTN_ERROR 13

Definition at line 75 of file TextSid.c.

#define RTN_OK 0

Definition at line 74 of file TextSid.c.

Function Documentation

void DisplayWinError | ( | LPSTR | szAPI,
 |  | DWORD | dwError
 | ) |  |

Definition at line 471 of file Audit.c.

{
    LPSTR MessageBuffer;
    DWORD dwBufferLength;

    //
    // TODO get this fprintf out of here!
    //
    fprintf(stderr,"%s error!\n", szAPI);

    if(dwBufferLength=FormatMessageA(
            FORMAT_MESSAGE_ALLOCATE_BUFFER |
            FORMAT_MESSAGE_FROM_SYSTEM,
            NULL,
            dwError,
            MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
            (LPSTR) &MessageBuffer,
            0,
            NULL
            ))
    {
        DWORD dwBytesWritten; // unused

        //
        // Output message string on stderr
        //
        WriteFile(
                GetStdHandle(STD_ERROR_HANDLE),
                MessageBuffer,
                dwBufferLength,
                &dwBytesWritten,
                NULL
                );

        //
        // free the buffer allocated by the system
        //
        LocalFree(MessageBuffer);
    }
}

void DisplayWinError | ( | LPTSTR | szAPI,
 |  | DWORD | dwError
 | ) |  |

Definition at line 261 of file TextSid.c.

{
    LPTSTR MessageBuffer;
    DWORD dwBufferLength;

    if( szAPI )
    {
        _ftprintf( stderr, TEXT("Error in %s\n"), szAPI );
    }

    dwBufferLength = FormatMessage(
            FORMAT_MESSAGE_ALLOCATE_BUFFER |
            FORMAT_MESSAGE_FROM_SYSTEM,
            NULL,
            dwError,
            MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
            (LPTSTR) &MessageBuffer,
            0,
            NULL
            );
    if( dwBufferLength )
    {
        //
        // Output message string on stderr
        //
        _ftprintf( stderr, TEXT("%s"), MessageBuffer );

        //
        // free the buffer allocated by the system
        //
        LocalFree(MessageBuffer);
    }
}

BOOL GetTextualSid | ( | PSID | pSid,
 |  | LPTSTR | TextualSID,
 |  | LPDWORD | cchSidSize
 | ) |  |

Definition at line 166 of file TextSid.c.

{
    PSID_IDENTIFIER_AUTHORITY psia;
    DWORD dwSubAuthorities;
    DWORD dwCounter;
    DWORD cchSidCopy;
    DWORD cchMaxLen;

    //
    // test if parameters passed in are valid, IsValidSid can not take
    // a NULL parameter
    //
    if(!pSid || !IsValidSid(pSid) || !TextualSid || !cchSidSize)
    {
        SetLastError(ERROR_INVALID_PARAMETER);
        return FALSE;
    }

    // obtain SidIdentifierAuthority
    psia = GetSidIdentifierAuthority(pSid);

    // obtain sidsubauthority count
    dwSubAuthorities = *GetSidSubAuthorityCount(pSid);

    //
    // compute approximate buffer length
    // S-SID_REVISION- + identifierauthority + -subauthorities + NULL
    //
    cchMaxLen = 6 + 14 + (11 * dwSubAuthorities) + 1;

    //
    // check provided buffer length.
    // If not large enough, indicate proper size and setlasterror
    //
    if(*cchSidSize < cchMaxLen) {
        *cchSidSize = cchMaxLen;
        SetLastError(ERROR_INSUFFICIENT_BUFFER);
        return FALSE;
    }

    //
    // prepare S-SID_REVISION-
    //
    cchSidCopy = wnsprintf(TextualSid,
                           cchMaxLen,
                           TEXT("S-%lu-"),
                           SID_REVISION );

    //
    // prepare SidIdentifierAuthority
    //
    if ( (psia->Value[0] != 0) || (psia->Value[1] != 0) ) {
        cchSidCopy += wnsprintf(TextualSid + cchSidCopy,
                    cchMaxLen - cchSidCopy,
                    TEXT("0x%02hx%02hx%02hx%02hx%02hx%02hx"),
                    (USHORT)psia->Value[0],
                    (USHORT)psia->Value[1],
                    (USHORT)psia->Value[2],
                    (USHORT)psia->Value[3],
                    (USHORT)psia->Value[4],
                    (USHORT)psia->Value[5]);
    } else {
        cchSidCopy += wnsprintf(TextualSid + cchSidCopy,
                    cchMaxLen - cchSidCopy,
                    TEXT("%lu"),
                    (ULONG)(psia->Value[5]      )   +
                    (ULONG)(psia->Value[4] <<  8)   +
                    (ULONG)(psia->Value[3] << 16)   +
                    (ULONG)(psia->Value[2] << 24)   );
    }

    //
    // loop through SidSubAuthorities
    //
    for(dwCounter = 0 ; dwCounter < dwSubAuthorities ; dwCounter++) {
        cchSidCopy += wnsprintf(TextualSid + cchSidCopy,
                    cchMaxLen - cchSidCopy,
                    TEXT("-%lu"),
                    *GetSidSubAuthority(pSid, dwCounter) );
    }

    //
    // tell the caller how many chars we provided, not including NULL
    //
    *cchSidSize = cchSidCopy;

    return TRUE;
}

int __cdecl main ( void )

Definition at line 99 of file TextSid.c.

{
#define MY_BUFSIZE 256 // all allocations should be dynamic
    HANDLE hToken;
    BYTE buf[MY_BUFSIZE];
    PTOKEN_USER ptgUser = (PTOKEN_USER)buf;
    DWORD cbBuffer=MY_BUFSIZE;

    TCHAR szTextualSid[MY_BUFSIZE];
    DWORD cchSid=MY_BUFSIZE;

    BOOL bSuccess;

    //
    // obtain current process token
    //
    if(!OpenProcessToken(
                GetCurrentProcess(), // target current process
                TOKEN_QUERY,         // TOKEN_QUERY access
                &hToken              // resultant hToken
                ))
    {
        DisplayWinError( TEXT("OpenProcessToken"), GetLastError() );
        return RTN_ERROR;
    }

    //
    // obtain user identified by current process' access token
    //
    bSuccess = GetTokenInformation(
                hToken,    // identifies access token
                TokenUser, // TokenUser info type
                ptgUser,   // retrieved info buffer
                cbBuffer,  // size of buffer passed-in
                &cbBuffer  // required buffer size
                );

    // close token handle.  do this even if error above
    CloseHandle(hToken);

    if(!bSuccess) {
        DisplayWinError( TEXT("GetTokenInformation"), GetLastError() );
        return RTN_ERROR;
    }

    //
    // obtain the textual representaion of the Sid
    //
    if(!GetTextualSid(
                ptgUser->User.Sid, // user binary Sid
                szTextualSid,      // buffer for TextualSid
                &cchSid            // size/required buffer
                )) {
        DisplayWinError( TEXT("GetTextualSid"), GetLastError() );
        return RTN_ERROR;
    }

    // display the TextualSid representation
    _tprintf( TEXT("Process Sid: %s\n"), szTextualSid );

    return RTN_OK;
}

Generated on Wed Nov 13 2024 16:54:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/capicom/c_sharp/chainsh/AssemblyInfo.cs File Reference

  • Security
  • capicom
  • c_sharp
  • chainsh

AssemblyInfo.cs File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/capicom/c_sharp/chainsh/chainsh.cs File Reference

  • Security
  • capicom
  • c_sharp
  • chainsh
Classes | Namespaces

chainsh.cs File Reference

Go to the source code of this file.

Classes

class | Sample::Sample
class | Sample::Win32
struct | Sample::Win32::CERT_CHAIN_FIND_BY_ISSUER_PARA

Namespaces

namespace | Sample
Generated on Wed Nov 13 2024 16:54:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/capicom/c_sharp/storesh/storesh.cs File Reference

  • Security
  • capicom
  • c_sharp
  • storesh
Classes | Namespaces | Functions

storesh.cs File Reference

Go to the source code of this file.

Classes

struct | storesh::CERT_SYSTEM_STORE_INFO
class | storesh::Storesh
class | storesh::Win32

Namespaces

namespace | storesh

Functions

delegate bool | storesh::CertEnumSystemStoreCallback ([In, MarshalAs(UnmanagedType.LPWStr)] String pvSystemStore, uint dwFlags, ref CERT_SYSTEM_STORE_INFO pStoreInfo, uint pvReserved,[In, MarshalAs(UnmanagedType.LPWStr)] String pvArg)
Generated on Wed Nov 13 2024 16:54:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/capicom/c_sharp/xmldsig/AboutBox.cs File Reference

  • Security
  • capicom
  • c_sharp
  • xmldsig
Classes | Namespaces

AboutBox.cs File Reference

Go to the source code of this file.

Classes

class | Sample::UI::AboutBox

Namespaces

namespace | Sample::UI
Generated on Wed Nov 13 2024 16:54:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/capicom/c_sharp/xmldsig/CertGetKey.c File Reference

  • Security
  • capicom
  • c_sharp
  • xmldsig
Classes | Functions

CertGetKey.c File Reference

#include <stdio.h>
#include <windows.h>
#include <wincrypt.h>

Go to the source code of this file.

Classes

struct | KEY_HEADER

Functions

__declspec (dllexport)
void | memrev (LPBYTE pb, DWORD cb)

Function Documentation

__declspec ( dllexport )

Definition at line 146 of file CertGetKey.c.

{
    KEY_HEADER * pKeyInfo = (KEY_HEADER *) pbKeyBlob;
    DWORD cb = (pKeyInfo->rsa.bitlen/8);
    LPBYTE pbX = pbKeyBlob + sizeof(BLOBHEADER) + sizeof(RSAPUBKEY);

    //  Exponent
    *pExponent = pKeyInfo->rsa.pubexp;

    // Modulus
  *pModulusSize = cb;
  *ppbModulus = (LPBYTE) malloc(cb * sizeof(BYTE));
    memcpy(*ppbModulus, pbX, cb);
  // We need to go back to big endian
  memrev(*ppbModulus, cb);
}

void memrev | ( | LPBYTE | pb,
 |  | DWORD | cb
 | ) |  |

Definition at line 10 of file CertGetKey.c.

{
    BYTE    b;
    DWORD   i;
    LPBYTE  pbEnd = pb+cb-1;

    for (i=0; i<cb/2; i++, pb++, pbEnd--) {
        b = *pb;
        *pb = *pbEnd;
        *pbEnd = b;
    }
}

Generated on Wed Nov 13 2024 16:54:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/capicom/c_sharp/xmldsig/MainWindow.cs File Reference

  • Security
  • capicom
  • c_sharp
  • xmldsig
Classes | Namespaces

MainWindow.cs File Reference

Go to the source code of this file.

Classes

class | Sample::UI::MainWindow

Namespaces

namespace | Sample::UI
Generated on Wed Nov 13 2024 16:54:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/capicom/c_sharp/xmldsig/Messages.cs File Reference

  • Security
  • capicom
  • c_sharp
  • xmldsig
Classes | Namespaces

Messages.cs File Reference

Go to the source code of this file.

Classes

class | Sample::Messages

Namespaces

namespace | Sample
Generated on Wed Nov 13 2024 16:54:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/capicom/c_sharp/xmldsig/SignVerify.cs File Reference

  • Security
  • capicom
  • c_sharp
  • xmldsig
Classes | Namespaces

SignVerify.cs File Reference

Go to the source code of this file.

Classes

class | Sample::MySignedXml
class | Sample::SignVerify

Namespaces

namespace | Sample
Generated on Wed Nov 13 2024 16:54:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/capicom/c_sharp/xmldsig/xmldsig.cs File Reference

  • Security
  • capicom
  • c_sharp
  • xmldsig
Classes | Namespaces

xmldsig.cs File Reference

Go to the source code of this file.

Classes

class | Sample::Sample

Namespaces

namespace | Sample
Generated on Wed Nov 13 2024 16:54:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/capicom/cpp/isapiCertPolicy/ErrorTxt.h File Reference

  • Security
  • capicom
  • cpp
  • isapiCertPolicy
Variables

ErrorTxt.h File Reference

Go to the source code of this file.

Variables

const char | g_szHttpError403_16 [] = "</html>\r\n"
const char | g_szHttpError500 [] = "</html>\r\n"

Variable Documentation

const char g_szHttpError403_16[] = "</html>\r\n"

Definition at line 3 of file ErrorTxt.h.

const char g_szHttpError500[] = "</html>\r\n"

Definition at line 92 of file ErrorTxt.h.

Generated on Wed Nov 13 2024 16:54:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/capicom/cpp/isapiCertPolicy/isapiCertPolicy.cpp File Reference

  • Security
  • capicom
  • cpp
  • isapiCertPolicy
Defines | Variables

isapiCertPolicy.cpp File Reference

#include "stdafx.h"
#include "isapiCertPolicy.h"
#include "ErrorTxt.h"

Go to the source code of this file.

Defines

#define | ARRAY_SIZE(a) (sizeof(a)/sizeof(*(a)))

Variables

const LPWSTR | CAPICOM_SMART_CARD_LOGON_OID_W = "1.3.6.1.4.1.311.20.2.2"
const LPWSTR | CORP_HIGH_ASSUR_OID_W = "1.3.6.1.4.1.311.42.2.1"
const char | g_szHttpHeader [] = "\r\n"
const LPWSTR | MS_INTRA_L2_USER_1_THUMBPRINT = "15B1691A542A99D7BC3724ABA68FBA7C01B2DEE1"
const LPWSTR | MS_INTRA_L2_USER_2_THUMBPRINT = "FA744DC332740D6BD34A708453B79026BBD92DC4"
const LPWSTR | MS_INTRA_L2_USER_3_THUMBPRINT = "528567A45B2D41617BC3EC6BA4D275A1B41B05E0"
CWinApp theApp
CIsapiCertPolicyFilter theFilter

Define Documentation

#define ARRAY_SIZE ( a ) (sizeof(a)/sizeof(*(a)))

Definition at line 53 of file isapiCertPolicy.cpp.

Variable Documentation

const LPWSTR CAPICOM_SMART_CARD_LOGON_OID_W = "1.3.6.1.4.1.311.20.2.2"

Definition at line 55 of file isapiCertPolicy.cpp.

const LPWSTR CORP_HIGH_ASSUR_OID_W = "1.3.6.1.4.1.311.42.2.1"

Definition at line 56 of file isapiCertPolicy.cpp.

const char g_szHttpHeader[] = "\r\n"

Definition at line 67 of file isapiCertPolicy.cpp.

const LPWSTR MS_INTRA_L2_USER_1_THUMBPRINT = "15B1691A542A99D7BC3724ABA68FBA7C01B2DEE1"

Definition at line 58 of file isapiCertPolicy.cpp.

const LPWSTR MS_INTRA_L2_USER_2_THUMBPRINT = "FA744DC332740D6BD34A708453B79026BBD92DC4"

Definition at line 61 of file isapiCertPolicy.cpp.

const LPWSTR MS_INTRA_L2_USER_3_THUMBPRINT = "528567A45B2D41617BC3EC6BA4D275A1B41B05E0"

Definition at line 64 of file isapiCertPolicy.cpp.

CWinApp theApp

Definition at line 92 of file isapiCertPolicy.cpp.

CIsapiCertPolicyFilter theFilter

Definition at line 98 of file isapiCertPolicy.cpp.

Generated on Wed Nov 13 2024 16:54:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/capicom/cpp/isapiCertPolicy/isapiCertPolicy.h File Reference

  • Security
  • capicom
  • cpp
  • isapiCertPolicy
Classes

isapiCertPolicy.h File Reference

#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Classes

class CIsapiCertPolicyFilter
Generated on Wed Nov 13 2024 16:54:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/capicom/cpp/isapiCertPolicy/Resource.h File Reference

  • Security
  • capicom
  • cpp
  • isapiCertPolicy
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | _APS_NEXT_COMMAND_VALUE 32768
#define | _APS_NEXT_CONTROL_VALUE 103
#define | _APS_NEXT_RESOURCE_VALUE 103
#define | _APS_NEXT_SYMED_VALUE 103
#define | IDS_FILTER 101

Define Documentation

#define _APS_NEXT_COMMAND_VALUE 32768

Definition at line 11 of file Resource.h.

#define _APS_NEXT_CONTROL_VALUE 103

Definition at line 9 of file Resource.h.

#define _APS_NEXT_RESOURCE_VALUE 103

Definition at line 8 of file Resource.h.

#define _APS_NEXT_SYMED_VALUE 103

Definition at line 10 of file Resource.h.

#define IDS_FILTER 101

Definition at line 6 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/capicom/cpp/isapiCertPolicy/StdAfx.cpp File Reference

  • Security
  • capicom
  • cpp
  • isapiCertPolicy

StdAfx.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/capicom/cpp/isapiCertPolicy/StdAfx.h File Reference

  • Security
  • capicom
  • cpp
  • isapiCertPolicy
Defines

StdAfx.h File Reference

#include <afx.h>
#include <afxwin.h>
#include <afxmt.h>
#include <afxext.h>
#include <afxisapi.h>
#import "capicom.dll"

Go to the source code of this file.

Defines

#define | _WIN32_WINNT 0x0400
#define | WINVER 0x0400

Define Documentation

#define _WIN32_WINNT 0x0400

Definition at line 10 of file StdAfx.h.

#define WINVER 0x0400

Definition at line 9 of file StdAfx.h.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/capicom/cpp/store/Store.cpp File Reference

  • Security
  • capicom
  • cpp
  • store
Functions

Store.cpp File Reference

#include <tchar.h>
#include <stdio.h>
#include <atlbase.h>
#include <windows.h>
#import "capicom.dll"

Go to the source code of this file.

Functions

int __cdecl _tmain (int argc, _TCHAR *argv[])

Function Documentation

int __cdecl _tmain | ( | int | argc,
 |  | _TCHAR * | argv[]
 | ) |  |

Definition at line 47 of file Store.cpp.

{
    HRESULT hr = S_OK;

    //
    // Initialize COM library.
    //
    CoInitialize(0);

    try
    {
        //
        // Open current user My store.
        //
        _bstr_t   bstrName = _T("My");
        IStorePtr pIStore(__uuidof(Store));

        if (FAILED(hr = pIStore->Open(CAPICOM_CURRENT_USER_STORE,
                                      bstrName,
                                      CAPICOM_STORE_OPEN_READ_ONLY)))
        {
            ATLTRACE(_T("Error [%#x]: pIStore->Open() failed at line %d.\n"), hr, __LINE__);
            throw hr;
        }

        //
        // Display all certificate in the store.
        //
        IUnknownPtr     pIUnknown;
        IEnumVARIANTPtr pIEnum;
        _variant_t      pDisp;
        ULONG           ulFetched;

        //
        // Get _NewEnum of Certificates collection.
        //
        if (FAILED(hr = pIStore->Certificates->get__NewEnum(&pIUnknown)))
        {
            ATLTRACE(_T("Error [%#x]: pIStore->Certificates->get__NewEnum() failed at line %d.\n"), hr, __LINE__);
            throw hr;
        }

        //
        // Get IEnumVARIANT interface of _NewEnum.
        //
        if (FAILED(hr = pIUnknown->QueryInterface(IID_IEnumVARIANT, (void **) &pIEnum)))
        {
            ATLTRACE(_T("Error [%#x]: pIUnknown->QueryInterface() failed at line %d.\n"), hr, __LINE__);
            throw hr;
        }

        //
        // Now loop through all items in the collection.
        //
        while (pIEnum->Next(1, &pDisp, &ulFetched) == S_OK)
        {
            //
            // Display the certificate.
            //
            if (FAILED(hr = ((ICertificatePtr) pDisp.pdispVal)->Display()))
            {
                ATLTRACE(_T("Error [%#x]: ((ICertificatePtr) pDisp.pdispVal)->Display() failed at line %d.\n"), hr, __LINE__);
                throw hr;
            }

            pDisp.Clear();
        }
    }

    catch (_com_error e)
    {
        hr = e.Error();
        ATLTRACE(_T("Error [%#x]: %s.\n"), hr, e.ErrorMessage());
    }

    catch (HRESULT hr)
    {
        ATLTRACE(_T("Error [%#x]: CAPICOM error.\n"), hr);
    }

    catch(...)
    {
        hr = CAPICOM_E_UNKNOWN;
        ATLTRACE(_T("Unknown error.\n"));
    }

    CoUninitialize();

    return (int) hr;
}

Generated on Wed Nov 13 2024 16:54:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Encode/ADate.Cpp File Reference

  • Security
  • CertServices
  • Encode

ADate.Cpp File Reference

#include "pch.cpp"
#include <assert.h>
#include "resource.h"
#include "adate.h"
#include "celib.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Encode/ADate.h File Reference

  • Security
  • CertServices
  • Encode
Classes | Defines

ADate.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class | CCertEncodeDateArray

Defines

#define | wszCLASS_CERTENCODEDATEARRAY wszCLASS_CERTENCODE TEXT("DateArray")

Define Documentation

#define wszCLASS_CERTENCODEDATEARRAY wszCLASS_CERTENCODE TEXT("DateArray")

Definition at line 19 of file ADate.h.

Generated on Wed Nov 13 2024 16:54:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Encode/ALong.Cpp File Reference

  • Security
  • CertServices
  • Encode

ALong.Cpp File Reference

#include "pch.cpp"
#include <assert.h>
#include "resource.h"
#include "along.h"
#include "celib.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Encode/ALong.h File Reference

  • Security
  • CertServices
  • Encode
Classes | Defines

ALong.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class | CCertEncodeLongArray

Defines

#define | wszCLASS_CERTENCODELONGARRAY wszCLASS_CERTENCODE TEXT("LongArray")

Define Documentation

#define wszCLASS_CERTENCODELONGARRAY wszCLASS_CERTENCODE TEXT("LongArray")

Definition at line 19 of file ALong.h.

Generated on Wed Nov 13 2024 16:54:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Encode/AltName.Cpp File Reference

  • Security
  • CertServices
  • Encode
Defines

AltName.Cpp File Reference

#include "pch.cpp"
#include <assert.h>
#include "resource.h"
#include "altname.h"
#include "celib.h"

Go to the source code of this file.

Defines

#define EAN_NAMEOBJECTID ( 0x80000000 )

Define Documentation

#define EAN_NAMEOBJECTID ( 0x80000000 )

Definition at line 22 of file AltName.Cpp.

Generated on Wed Nov 13 2024 16:54:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Encode/AltName.h File Reference

  • Security
  • CertServices
  • Encode
Classes | Defines

AltName.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class | CCertEncodeAltName

Defines

#define | wszCLASS_CERTENCODEALTNAME wszCLASS_CERTENCODE TEXT("AltName")

Define Documentation

#define wszCLASS_CERTENCODEALTNAME wszCLASS_CERTENCODE TEXT("AltName")

Definition at line 19 of file AltName.h.

Generated on Wed Nov 13 2024 16:54:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Encode/AString.Cpp File Reference

  • Security
  • CertServices
  • Encode

AString.Cpp File Reference

#include "pch.cpp"
#include <assert.h>
#include "resource.h"
#include "astring.h"
#include "celib.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Encode/AString.h File Reference

  • Security
  • CertServices
  • Encode
Classes | Defines

AString.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class | CCertEncodeStringArray

Defines

#define | wszCLASS_CERTENCODESTRINGARRAY wszCLASS_CERTENCODE TEXT("StringArray")

Define Documentation

#define wszCLASS_CERTENCODESTRINGARRAY wszCLASS_CERTENCODE TEXT("StringArray")

Definition at line 19 of file AString.h.

Generated on Wed Nov 13 2024 16:54:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Encode/Atl.Cpp File Reference

  • Security
  • CertServices
  • Encode

Atl.Cpp File Reference

#include <pch.cpp>
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Encode/BitStr.Cpp File Reference

  • Security
  • CertServices
  • Encode

BitStr.Cpp File Reference

#include "pch.cpp"
#include <assert.h>
#include "resource.h"
#include "bitstr.h"
#include "celib.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Encode/BitStr.h File Reference

  • Security
  • CertServices
  • Encode
Classes | Defines

BitStr.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class | CCertEncodeBitString

Defines

#define | wszCLASS_CERTENCODEBITSTRING wszCLASS_CERTENCODE TEXT("BitString")

Define Documentation

#define wszCLASS_CERTENCODEBITSTRING wszCLASS_CERTENCODE TEXT("BitString")

Definition at line 19 of file BitStr.h.

Generated on Wed Nov 13 2024 16:54:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Encode/CeError.Cpp File Reference

  • Security
  • CertServices
  • Encode
Defines | Functions

CeError.Cpp File Reference

#include <pch.cpp>
#include "celib.h"
#include <assert.h>
#include <ntdsbmsg.h>
#include <delayimp.h>
#include <wininet.h>

Go to the source code of this file.

Defines

#define | CERTLIB_12BITERRORMASK 0x00000fff
#define | CERTLIB_WIN32ERRORMASK 0x0000ffff
#define | DELAYLOAD_FROM_WIN32(hr) VcppException(ERROR_SEVERITY_ERROR, (hr))
#define | E_DELAYLOAD_MOD_NOT_FOUND DELAYLOAD_FROM_WIN32(ERROR_MOD_NOT_FOUND)
#define | E_DELAYLOAD_PROC_NOT_FOUND DELAYLOAD_FROM_WIN32(ERROR_PROC_NOT_FOUND)
#define | HRESULT_FROM_JETERROR(jerr) (ERROR_SEVERITY_ERROR | (FACILITY_NTDSB << 16) | -jerr)
#define | HRESULT_FROM_JETWARNING(jerr) (ERROR_SEVERITY_WARNING | (FACILITY_NTDSB << 16) | jerr)
#define | ISDELAYLOADHRESULT(hr)
#define | ISDELAYLOADHRESULTFACILITY(hr)
#define | ISHTTPERROR(hr) ((HRESULT) HTTP_STATUS_FIRST <= (hr) && (HRESULT) HTTP_STATUS_LAST >= (hr))
#define | ISHTTPHRESULT(hr) (ISWIN32HRESULT(hr) && ISHTTPERROR(WIN32ERROR_FROM_HRESULT(hr)))
#define | ISJETERROR(hr) ((~CERTLIB_WIN32ERRORMASK & (hr)) == (HRESULT) ~CERTLIB_WIN32ERRORMASK)
#define | ISJETHRESULT(hr)
#define | ISOSSERROR(hr) ((~CERTLIB_12BITERRORMASK & (hr)) == CRYPT_E_OSS_ERROR)
#define | ISSETUPHRESULT(hr)
#define | ISWIN32ERROR(hr) ((~CERTLIB_WIN32ERRORMASK & (hr)) == 0)
#define | ISWIN32HRESULT(hr)
#define | JETERROR_FROM_HRESULT(hr) (-(LONG) (CERTLIB_WIN32ERRORMASK & (hr)))
#define | OSSERROR_FROM_HRESULT(hr) (CERTLIB_12BITERRORMASK & (hr))
#define | WIN32ERROR_FROM_DELAYLOAD(hr) (CERTLIB_WIN32ERRORMASK & (hr))
#define | WIN32ERROR_FROM_HRESULT(hr) (CERTLIB_WIN32ERRORMASK & (hr))
#define | wszCOLONSPACE L": "
#define | wszHTTPERRORPREFIX L"HTTP"
#define | wszJETERRORPREFIX L"ESE"
#define | wszOSSERRORPREFIX L"ASN"
#define | wszSETUPERRORPREFIX L"INF"
#define | wszWIN32ERRORPREFIX L"WIN32"

Functions

WCHAR const * | ceGetErrorMessageText (IN HRESULT hr, IN BOOL fHResultString)
WCHAR const * | ceGetErrorMessageText1 (IN HRESULT hr, IN BOOL fHResultString, IN OPTIONAL WCHAR const *pwszInsertionText)
WCHAR const * | ceGetErrorMessageTextEx (IN HRESULT hr, IN BOOL fHResultString, IN OPTIONAL WCHAR const *const *papwszInsertionText)
HRESULT | ceHExceptionCode (IN EXCEPTION_POINTERS const *pep)
WCHAR const * | ceHResultToString (IN OUT WCHAR *awchr, IN HRESULT hr)
WCHAR const * | ceHResultToStringEx (IN OUT WCHAR *awchr, IN HRESULT hr, IN BOOL fRaw)
WCHAR const * | ceHResultToStringRaw (IN OUT WCHAR *awchr, IN HRESULT hr)
VOID | ceInitErrorMessageText (IN HMODULE hMod, IN DWORD idsUnexpected, IN DWORD idsUnknownErrorCode)
BOOL | ceIsDelayLoadHResult (IN HRESULT hr)
HRESULT | ceJetHResult (IN HRESULT hr)
DWORD | errFormatMessage (IN HMODULE hMod, IN HRESULT hr, OUT WCHAR const **ppwszOut, OPTIONAL IN WCHAR const *const *ppwszArgs)

Define Documentation

#define CERTLIB_12BITERRORMASK 0x00000fff

Definition at line 22 of file CeError.Cpp.

#define CERTLIB_WIN32ERRORMASK 0x0000ffff

Definition at line 23 of file CeError.Cpp.

#define DELAYLOAD_FROM_WIN32 ( hr ) VcppException(ERROR_SEVERITY_ERROR, (hr))

Definition at line 90 of file CeError.Cpp.

#define E_DELAYLOAD_MOD_NOT_FOUND DELAYLOAD_FROM_WIN32(ERROR_MOD_NOT_FOUND)

Definition at line 99 of file CeError.Cpp.

#define E_DELAYLOAD_PROC_NOT_FOUND DELAYLOAD_FROM_WIN32(ERROR_PROC_NOT_FOUND)

Definition at line 102 of file CeError.Cpp.

#define HRESULT_FROM_JETERROR ( jerr ) (ERROR_SEVERITY_ERROR | (FACILITY_NTDSB << 16) | -jerr)

Definition at line 32 of file CeError.Cpp.

#define HRESULT_FROM_JETWARNING ( jerr ) (ERROR_SEVERITY_WARNING | (FACILITY_NTDSB << 16) | jerr)

Definition at line 29 of file CeError.Cpp.

#define ISDELAYLOADHRESULT ( hr )
Value:
((HRESULT) E_DELAYLOAD_MOD_NOT_FOUND == (hr) || \
         (HRESULT) E_DELAYLOAD_PROC_NOT_FOUND == (hr) || \
         HRESULT_FROM_WIN32(ERROR_MOD_NOT_FOUND) == (hr) || \
         HRESULT_FROM_WIN32(ERROR_PROC_NOT_FOUND) == (hr))

Definition at line 104 of file CeError.Cpp.

#define ISDELAYLOADHRESULTFACILITY ( hr )
Value:
((~CERTLIB_WIN32ERRORMASK & (hr)) == (HRESULT) (ERROR_SEVERITY_ERROR | \
                                              (FACILITY_VISUALCPP << 16)))

Definition at line 94 of file CeError.Cpp.

#define ISHTTPERROR ( hr ) ((HRESULT) HTTP_STATUS_FIRST <= (hr) && (HRESULT) HTTP_STATUS_LAST >= (hr))

Definition at line 78 of file CeError.Cpp.

#define ISHTTPHRESULT ( hr ) (ISWIN32HRESULT(hr) && ISHTTPERROR(WIN32ERROR_FROM_HRESULT(hr)))

Definition at line 81 of file CeError.Cpp.

#define ISJETERROR ( hr ) ((~CERTLIB_WIN32ERRORMASK & (hr)) == (HRESULT) ~CERTLIB_WIN32ERRORMASK)

Definition at line 38 of file CeError.Cpp.

#define ISJETHRESULT ( hr )
Value:
((~CERTLIB_WIN32ERRORMASK & (hr)) == (HRESULT) (ERROR_SEVERITY_ERROR | \
                (FACILITY_NTDSB << 16)))

Definition at line 41 of file CeError.Cpp.

#define ISOSSERROR ( hr ) ((~CERTLIB_12BITERRORMASK & (hr)) == CRYPT_E_OSS_ERROR)

Definition at line 114 of file CeError.Cpp.

#define ISSETUPHRESULT ( hr )
Value:
((~CERTLIB_WIN32ERRORMASK & (hr)) == (HRESULT) (ERROR_SEVERITY_ERROR | \
                                              APPLICATION_ERROR_MASK | \
                                              (FACILITY_NULL << 16)))

Definition at line 51 of file CeError.Cpp.

#define ISWIN32ERROR ( hr ) ((~CERTLIB_WIN32ERRORMASK & (hr)) == 0)

Definition at line 62 of file CeError.Cpp.

#define ISWIN32HRESULT ( hr )
Value:
((~CERTLIB_WIN32ERRORMASK & (hr)) == (HRESULT) (ERROR_SEVERITY_WARNING | \
                (FACILITY_WIN32 << 16)))

Definition at line 65 of file CeError.Cpp.

#define JETERROR_FROM_HRESULT ( hr ) (-(LONG) (CERTLIB_WIN32ERRORMASK & (hr)))

Definition at line 35 of file CeError.Cpp.

#define OSSERROR_FROM_HRESULT ( hr ) (CERTLIB_12BITERRORMASK & (hr))

Definition at line 117 of file CeError.Cpp.

#define WIN32ERROR_FROM_DELAYLOAD ( hr ) (CERTLIB_WIN32ERRORMASK & (hr))

Definition at line 92 of file CeError.Cpp.

#define WIN32ERROR_FROM_HRESULT ( hr ) (CERTLIB_WIN32ERRORMASK & (hr))

Definition at line 69 of file CeError.Cpp.

#define wszCOLONSPACE L": "

Definition at line 176 of file CeError.Cpp.

#define wszHTTPERRORPREFIX L"HTTP"

Definition at line 84 of file CeError.Cpp.

#define wszJETERRORPREFIX L"ESE"

Definition at line 45 of file CeError.Cpp.

#define wszOSSERRORPREFIX L"ASN"

Definition at line 120 of file CeError.Cpp.

#define wszSETUPERRORPREFIX L"INF"

Definition at line 56 of file CeError.Cpp.

#define wszWIN32ERRORPREFIX L"WIN32"

Definition at line 72 of file CeError.Cpp.

Function Documentation

WCHAR const* ceGetErrorMessageText | ( | IN HRESULT | hr,
 |  | IN BOOL | fHResultString
 | ) |  |

Definition at line 312 of file CeError.Cpp.

{
    return(ceGetErrorMessageTextEx(hr, fHResultString, NULL));
}

WCHAR const* ceGetErrorMessageText1 | ( | IN HRESULT | hr,
 |  | IN BOOL | fHResultString,
 |  | IN OPTIONAL WCHAR const * | pwszInsertionText
 | ) |  |

Definition at line 321 of file CeError.Cpp.

{
    WCHAR const *apwszInsertionText[2];
    WCHAR const * const *papwsz = NULL;

    if (NULL != pwszInsertionText)
    {
  apwszInsertionText[0] = pwszInsertionText;
  apwszInsertionText[1] = NULL;
  papwsz = apwszInsertionText;
    }
    return(ceGetErrorMessageTextEx(hr, fHResultString, papwsz));
}

WCHAR const* ceGetErrorMessageTextEx | ( | IN HRESULT | hr,
 |  | IN BOOL | fHResultString,
 |  | IN OPTIONAL WCHAR const *const * | papwszInsertionText
 | ) |  |

Definition at line 340 of file CeError.Cpp.

{
    WCHAR const *pwszRet = NULL;
    WCHAR const *pwszRetStatic = NULL;
    WCHAR *pwszMsgT;
    WCHAR awchr[cwcHRESULTSTRING];
    DWORD cwc;
    DWORD cwcCopy;
    DWORD cwcUnexpected;
    WCHAR const *pwszUnexpected = NULL;
    WCHAR wszEmpty[] = L"";
    HMODULE hMod1 = NULL;
    HMODULE hMod2 = NULL;

    if (E_UNEXPECTED == hr)
    {
  pwszUnexpected = L"Unexpected method call sequence.";
    }
#if (0 == i386)
    else if (STATUS_DATATYPE_MISALIGNMENT == hr)
    {
  pwszUnexpected = L"Possible data alignment fault.";
    }
#endif
    if (NULL == pwszUnexpected)
    {
  pwszUnexpected = wszEmpty;
    }
    cwcUnexpected = wcslen(pwszUnexpected);

    cwc = errFormatMessage(NULL, hr, &pwszRet, papwszInsertionText);
    if (0 == cwc && ISDELAYLOADHRESULTFACILITY(hr))
    {
  cwc = errFormatMessage(
      NULL,
      WIN32ERROR_FROM_DELAYLOAD(hr),
      &pwszRet,
      papwszInsertionText);
    }
    if (0 == cwc)
    {
        hMod1 = LoadLibrary(L"ntdsbmsg.dll");
        if (NULL != hMod1)
        {
            HRESULT hrEDB = hr;
            HRESULT hrFormat;
            BOOL fFirst = TRUE;

            while (TRUE)
            {
                cwc = errFormatMessage(hMod1, hrEDB, &pwszRet, papwszInsertionText);
                if (0 == cwc && FAILED(hrEDB) && fFirst)
                {
                    hrFormat = ceHLastError();
                    if (HRESULT_FROM_WIN32(ERROR_MR_MID_NOT_FOUND) == hrFormat)
                    {
                        hrEDB = ceJetHResult(hrEDB);
                        if (hrEDB != hr)
                        {
                            fFirst = FALSE;
                            continue;
                        }
                    }
                }
                break;
            }
        }
    }
    if (0 == cwc)
    {
  HMODULE hModT = GetModuleHandle(L"wininet.dll");
        if (NULL != hModT)
        {
            HRESULT hrHttp = hr;
            HRESULT hrFormat;
            BOOL fFirst = TRUE;

            while (TRUE)
            {
    cwc = errFormatMessage(hModT, hrHttp, &pwszRet, papwszInsertionText);
                if (0 == cwc && ISWIN32HRESULT(hrHttp) && fFirst)
                {
                    hrFormat = ceHLastError();
                    if (HRESULT_FROM_WIN32(ERROR_MR_MID_NOT_FOUND) == hrFormat)
                    {
      hrHttp = WIN32ERROR_FROM_HRESULT(hrHttp);
                        if (hrHttp != hr)
                        {
                            fFirst = FALSE;
                            continue;
                        }
                    }
                }
                break;
            }
        }
    }
    if (0 == cwc)
    {
        hMod2 = LoadLibrary(L"cdosys.dll");
        if (NULL != hMod2)
        {
      cwc = errFormatMessage(hMod2, hr, &pwszRet, papwszInsertionText);
        }
    }

    if (0 == cwc) // couldn't find error, use default & error code
    {
  fHResultString = TRUE;
    }
    awchr[0] = L'\0';
    if (fHResultString)
    {
  ceHResultToString(awchr, hr);
    }

    if (0 == cwc)
    {
  pwszRetStatic = L"Error";
  pwszRet = pwszRetStatic;
    }

    // strip trailing \r\n

    cwcCopy = wcslen(pwszRet);
    if (2 <= cwcCopy &&
  L'\r' == pwszRet[cwcCopy - 2] &&
  L'\n' == pwszRet[cwcCopy - 1])
    {
  cwcCopy -= 2;
    }
    cwc = cwcCopy + 1 + cwcUnexpected + 1 + wcslen(awchr) + 1;
    pwszMsgT = (WCHAR *) LocalAlloc(LMEM_FIXED, cwc * sizeof(WCHAR));
    if (NULL == pwszMsgT)
    {
  _JumpError(E_OUTOFMEMORY, error, "LocalAlloc");
    }
    CopyMemory(pwszMsgT, pwszRet, cwcCopy * sizeof(WCHAR));
    pwszMsgT[cwcCopy] = L'\0';

    if (0 != cwcUnexpected)
    {
  wcscat(pwszMsgT, L" ");
  wcscat(pwszMsgT, pwszUnexpected);
    }
    if (fHResultString)
    {
  wcscat(pwszMsgT, L" ");
  wcscat(pwszMsgT, awchr);
    }
    assert(wcslen(pwszMsgT) < cwc);
    if (NULL != pwszRet && pwszRetStatic != pwszRet)
    {
  LocalFree(const_cast<WCHAR *>(pwszRet));
    }
    pwszRet = pwszMsgT;

error:
    if (NULL != hMod1)
    {
        FreeLibrary(hMod1);
    }
    if (NULL != hMod2)
    {
        FreeLibrary(hMod2);
    }
    return(pwszRet);
}

HRESULT ceHExceptionCode ( IN EXCEPTION_POINTERS const * pep )

Definition at line 153 of file CeError.Cpp.

{
    HRESULT hr = pep->ExceptionRecord->ExceptionCode;

#if (0 == i386)
    if ((HRESULT) STATUS_DATATYPE_MISALIGNMENT == hr)
    {
  hr = CERTSRV_E_ALIGNMENT_FAULT;
    }
#endif
    return(ceHError(hr));
}

WCHAR const* ceHResultToString | ( | IN OUT WCHAR * | awchr,
 |  | IN HRESULT | hr
 | ) |  |

Definition at line 239 of file CeError.Cpp.

{
    return(ceHResultToStringEx(awchr, hr, FALSE));
}

WCHAR const* ceHResultToStringEx | ( | IN OUT WCHAR * | awchr,
 |  | IN HRESULT | hr,
 |  | IN BOOL | fRaw
 | ) |  |

Definition at line 179 of file CeError.Cpp.

{
    HRESULT hrd;
    WCHAR const *pwszType;

    hrd = hr;
    pwszType = L"";
    if (ISJETERROR(hr))
    {
        pwszType = wszJETERRORPREFIX wszCOLONSPACE;
    }
    else if (ISJETHRESULT(hr))
    {
        hrd = JETERROR_FROM_HRESULT(hr);
        pwszType = wszJETERRORPREFIX wszCOLONSPACE;
    }
    else if (ISOSSERROR(hr))
    {
        hrd = OSSERROR_FROM_HRESULT(hr);
        pwszType = wszOSSERRORPREFIX wszCOLONSPACE;
    }
    else if (ISHTTPHRESULT(hr) || ISHTTPERROR(hr))
    {
        hrd = WIN32ERROR_FROM_HRESULT(hr);
        pwszType = wszWIN32ERRORPREFIX L"/" wszHTTPERRORPREFIX wszCOLONSPACE;
    }
    else if (ISWIN32HRESULT(hr) || ISWIN32ERROR(hr))
    {
        hrd = WIN32ERROR_FROM_HRESULT(hr);
        pwszType = wszWIN32ERRORPREFIX wszCOLONSPACE;
    }
    else if (ISDELAYLOADHRESULTFACILITY(hr))
    {
        hrd = WIN32ERROR_FROM_DELAYLOAD(hr);
        pwszType = wszWIN32ERRORPREFIX wszCOLONSPACE;
    }
    else if (ISSETUPHRESULT(hr))
    {
        pwszType = wszSETUPERRORPREFIX wszCOLONSPACE;
    }
    if (fRaw)
    {
        pwszType = L"";
    }

    _snwprintf(
        awchr,
        cwcHRESULTSTRING,
        L"0x%x (%ws%d)",
        hr,
        pwszType,
        hrd);
    return(awchr);
}

WCHAR const* ceHResultToStringRaw | ( | IN OUT WCHAR * | awchr,
 |  | IN HRESULT | hr
 | ) |  |

Definition at line 248 of file CeError.Cpp.

{
    return(ceHResultToStringEx(awchr, hr, TRUE));
}

VOID ceInitErrorMessageText | ( | IN HMODULE | hMod,
 |  | IN DWORD | idsUnexpected,
 |  | IN DWORD | idsUnknownErrorCode
 | ) |  |

Definition at line 261 of file CeError.Cpp.

{
    s_hMod = hMod;
    s_idsUnexpected = idsUnexpected;
    s_idsUnknownErrorCode = idsUnknownErrorCode;
}

BOOL ceIsDelayLoadHResult ( IN HRESULT hr )

Definition at line 169 of file CeError.Cpp.

{
    return(ISDELAYLOADHRESULT(hr));
}

HRESULT ceJetHResult ( IN HRESULT hr )

Definition at line 124 of file CeError.Cpp.

{
    if (S_OK != hr)
    {
        if (SUCCEEDED(hr))
        {
#if 0
            hr = HRESULT_FROM_JETWARNING(hr);
#else
            if (S_FALSE != hr)
            {
                _PrintError(hr, "JetHResult: mapping to S_FALSE");
            }
            assert(S_FALSE == hr);
            hr = S_FALSE;
#endif
        }
        else if (ISJETERROR(hr))
        {
            hr = HRESULT_FROM_JETERROR(hr);
        }
    }
    assert(S_OK == hr || S_FALSE == hr || FAILED(hr));
    return(hr);
}

DWORD errFormatMessage | ( | IN HMODULE | hMod,
 |  | IN HRESULT | hr,
 |  | OUT WCHAR const ** | ppwszOut,
 |  | OPTIONAL IN WCHAR const *const * | ppwszArgs
 | ) |  |

Definition at line 273 of file CeError.Cpp.

{
    DWORD dwFlags;

    dwFlags = FORMAT_MESSAGE_ALLOCATE_BUFFER;
    if (NULL == hMod)
    {
  dwFlags |= FORMAT_MESSAGE_FROM_SYSTEM;
    }
    else
    {
  dwFlags |= FORMAT_MESSAGE_FROM_HMODULE;
    }
    if (NULL == ppwszArgs || NULL == ppwszArgs[0])
    {
  dwFlags |= FORMAT_MESSAGE_IGNORE_INSERTS;
    }
    else
    {
  dwFlags |= FORMAT_MESSAGE_ARGUMENT_ARRAY;
    }
    return(FormatMessage(
    dwFlags,
                hMod,
                hr,
                MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
                (WCHAR *) ppwszOut,
                1,
    (va_list *) ppwszArgs));
}

Generated on Wed Nov 13 2024 16:54:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Encode/CeLib.Cpp File Reference

  • Security
  • CertServices
  • Encode
Classes | Defines | Typedefs | Functions | Variables

CeLib.Cpp File Reference

#include "pch.cpp"
#include "celib.h"
#include <assert.h>

Go to the source code of this file.

Classes

struct | _UNITSTABLE

Defines

#define | CUNITSTABLEMAX (sizeof(g_aut)/sizeof(g_aut[0]))

Typedefs

typedef struct _UNITSTABLE | UNITSTABLE

Functions

HRESULT | _IsConfigLocal (IN WCHAR const *pwszConfig, IN WCHAR const *pwszDnsName, IN WCHAR const *pwszOldName, OPTIONAL OUT WCHAR **ppwszMachine, OUT BOOL *pfLocal)
HRESULT | ceBuildPathAndExt (IN WCHAR const *pwszDir, IN WCHAR const *pwszFile, OPTIONAL IN WCHAR const *pwszExt, OUT WCHAR **ppwszPath)
BOOL | ceConvertSzToBstr (OUT BSTR *pbstr, IN CHAR const *pch, IN LONG cch)
BOOL | ceConvertSzToWsz (OUT WCHAR **ppwsz, IN char const *pch, IN LONG cch)
BOOL | ceConvertWszToBstr (OUT BSTR *pbstr, IN WCHAR const *pwc, IN LONG cb)
BOOL | ceConvertWszToSz (OUT CHAR **ppsz, IN WCHAR const *pwc, IN LONG cwc)
HRESULT | ceDateToFileTime (IN DATE const *pDate, OUT FILETIME *pft)
BOOL | ceDecodeObject (IN DWORD dwEncodingType, IN LPCSTR lpszStructType, IN BYTE const *pbEncoded, IN DWORD cbEncoded, IN BOOL fCoTaskMemAlloc, OUT VOID **ppvStructInfo, OUT DWORD *pcbStructInfo)
HRESULT | ceDispatchSetErrorInfo (IN HRESULT hrError, IN WCHAR const *pwszDescription, OPTIONAL IN WCHAR const *pwszProgId, OPTIONAL IN IID const *piid)
HRESULT | ceDispatchSetErrorInfoSub (IN HRESULT hrError, OPTIONAL IN WCHAR const *pwszIDispatchMethod, OPTIONAL IN WCHAR const *pwszDescription, OPTIONAL IN WCHAR const *pwszSource, OPTIONAL IN IID const *piid, OPTIONAL IN WCHAR const *pwszHelpFile, IN DWORD dwHelpFileContext)
WCHAR * | ceDuplicateString (IN WCHAR const *pwsz)
BOOL | ceEncodeObject (IN DWORD dwEncodingType, IN LPCSTR lpszStructType, IN VOID const *pvStructInfo, IN DWORD dwFlags, IN BOOL fCoTaskMemAlloc, OUT BYTE **ppbEncoded, OUT DWORD *pcbEncoded)
VOID | ceErrorPrintLine (IN char const *pszFile, IN DWORD line, IN char const *pszMessage, IN WCHAR const *pwszData, IN HRESULT hr)
HRESULT | ceFileTimeToDate (IN FILETIME const *pft, OUT DATE *pDate)
VOID | ceFreeBstr (IN OUT BSTR *pstr)
HRESULT | ceGetComputerNames (OUT WCHAR **ppwszDnsName, OUT WCHAR **ppwszOldName)
HRESULT | ceGetMachineDnsName (OUT WCHAR **ppwszDnsName)
WCHAR const * | ceGetOIDName (IN WCHAR const *pwszObjId)
WCHAR const * | ceGetOIDNameA (IN char const *pszObjId)
HRESULT | ceHError (IN HRESULT hr)
HRESULT | ceHLastError (VOID)
HRESULT | ceIsConfigLocal (IN WCHAR const *pwszConfig, OPTIONAL OUT WCHAR **ppwszMachine, OUT BOOL *pfLocal)
int | celstrcmpiL (IN WCHAR const *pwsz1, IN WCHAR const *pwsz2)
HRESULT | ceMakeExprDate (IN OUT DATE *pDate, IN LONG lDelta, IN enum ENUM_PERIOD enumPeriod)
VOID | ceMakeExprDateTime (IN OUT FILETIME *pft, IN LONG lDelta, IN enum ENUM_PERIOD enumPeriod)
HRESULT | ceTranslatePeriodUnits (IN WCHAR const *pwszPeriod, IN LONG lCount, OUT enum ENUM_PERIOD *penumPeriod, OUT LONG *plCount)
HRESULT | ceVerifyAltNameString (IN LONG NameChoice, IN BSTR strName)
HRESULT | ceVerifyObjId (IN WCHAR const *pwszObjId)
HRESULT | ceVerifyObjIdA (IN CHAR const *pszObjId)
int | ceWtoI (IN WCHAR const *string, OUT BOOL *pfValid)

Variables

UNITSTABLE g_aut []

Define Documentation

#define CUNITSTABLEMAX (sizeof(g_aut)/sizeof(g_aut[0]))

Definition at line 656 of file CeLib.Cpp.

Typedef Documentation

typedef struct _UNITSTABLE UNITSTABLE

Function Documentation

HRESULT _IsConfigLocal | ( | IN WCHAR const * | pwszConfig,
 |  | IN WCHAR const * | pwszDnsName,
 |  | IN WCHAR const * | pwszOldName,
 |  | OPTIONAL OUT WCHAR ** | ppwszMachine,
 |  | OUT BOOL * | pfLocal
 | ) |  |

Definition at line 1243 of file CeLib.Cpp.

{
    HRESULT hr;
    WCHAR *pwszMachine = NULL;
    WCHAR const *pwsz;
    DWORD cwc;

    *pfLocal = FALSE;
    if (NULL != ppwszMachine)
    {
  *ppwszMachine = NULL;
    }

    while (L'\\' == *pwszConfig)
    {
  pwszConfig++;
    }
    pwsz = wcschr(pwszConfig, L'\\');
    if (NULL != pwsz)
    {
  cwc = SAFE_SUBTRACT_POINTERS(pwsz, pwszConfig);
    }
    else
    {
  cwc = wcslen(pwszConfig);
    }
    pwszMachine = (WCHAR *) LocalAlloc(LMEM_FIXED, (cwc + 1) * sizeof(WCHAR));
    if (NULL == pwszMachine)
    {
  hr = E_OUTOFMEMORY;
  _JumpError(hr, error, "LocalAlloc");
    }
    CopyMemory(pwszMachine, pwszConfig, cwc * sizeof(WCHAR));
    pwszMachine[cwc] = L'\0';

    if (0 == celstrcmpiL(pwszMachine, pwszDnsName) ||
  0 == celstrcmpiL(pwszMachine, pwszOldName))
    {
  *pfLocal = TRUE;
    }
    if (NULL != ppwszMachine)
    {
  *ppwszMachine = pwszMachine;
  pwszMachine = NULL;
    }
    hr = S_OK;

error:
    if (NULL != pwszMachine)
    {
  LocalFree(pwszMachine);
    }
    return(hr);
}

HRESULT ceBuildPathAndExt | ( | IN WCHAR const * | pwszDir,
 |  | IN WCHAR const * | pwszFile,
 |  | OPTIONAL IN WCHAR const * | pwszExt,
 |  | OUT WCHAR ** | ppwszPath
 | ) |  |

Definition at line 1345 of file CeLib.Cpp.

{
    HRESULT hr;
    WCHAR *pwsz;
    DWORD cwc;

    *ppwszPath = NULL;
    cwc = wcslen(pwszDir) + 1 + wcslen(pwszFile) + 1;
    if (NULL != pwszExt)
    {
  cwc += wcslen(pwszExt);
    }

    pwsz = (WCHAR *) LocalAlloc(LMEM_FIXED, cwc * sizeof(WCHAR));
    if (NULL == pwsz)
    {
  hr = E_OUTOFMEMORY;
  _JumpError(hr, error, "LocalAlloc");
    }
    wcscpy(pwsz, pwszDir);
    if (L'\\' != pwsz[wcslen(pwsz) - 1])
    {
  wcscat(pwsz, L"\\");
    }
    wcscat(pwsz, pwszFile);
    if (NULL != pwszExt)
    {
  wcscat(pwsz, pwszExt);
    }
    *ppwszPath = pwsz;
    hr = S_OK;

error:
    return(hr);
}

BOOL ceConvertSzToBstr | ( | OUT BSTR * | pbstr,
 |  | IN CHAR const * | pch,
 |  | IN LONG | cch
 | ) |  |

Definition at line 336 of file CeLib.Cpp.

{
    BOOL fOk = FALSE;
    BSTR bstr = NULL;
    LONG cwc = 0;

    ceFreeBstr(pbstr);
    if (-1 == cch)
    {
  cch = strlen(pch);
    }
    while (TRUE)
    {
  cwc = MultiByteToWideChar(GetACP(), 0, pch, cch, bstr, cwc);
  if (0 >= cwc)
  {
      //hr = ceHLastError();
      //printf("MultiByteToWideChar returned %d (%x)\n", hr, hr);
      break;
  }
  if (NULL != bstr)
  {
      bstr[cwc] = L'\0';
      *pbstr = bstr;
      fOk = TRUE;
      break;
  }
  bstr = SysAllocStringLen(NULL, cwc);
  if (NULL == bstr)
  {
      break;
  }
    }
    return(fOk);
}

BOOL ceConvertSzToWsz | ( | OUT WCHAR ** | ppwsz,
 |  | IN char const * | pch,
 |  | IN LONG | cch
 | ) |  |

Definition at line 295 of file CeLib.Cpp.

{
    BOOL fOk = FALSE;
    LONG cwc = 0;

    *ppwsz = NULL;
    while (TRUE)
    {
  cwc = MultiByteToWideChar(GetACP(), 0, pch, cch, *ppwsz, cwc);
  if (0 >= cwc)
  {
      DWORD err;

      err = GetLastError();
      ceERRORPRINTLINE("MultiByteToWideChar", err);
      if (NULL != *ppwsz)
      {
    LocalFree(*ppwsz);
    *ppwsz = NULL;
      }
      break;
  }
  if (NULL != *ppwsz)
  {
      fOk = TRUE;
      break;
  }
  *ppwsz = (WCHAR *) LocalAlloc(LMEM_FIXED, (cwc + 1) * sizeof(WCHAR));
  if (NULL == *ppwsz)
  {
      break;
  }
    }
    return(fOk);
}

BOOL ceConvertWszToBstr | ( | OUT BSTR * | pbstr,
 |  | IN WCHAR const * | pwc,
 |  | IN LONG | cb
 | ) |  |

Definition at line 263 of file CeLib.Cpp.

{
    BOOL fOk = FALSE;
    BSTR bstr;

    ceFreeBstr(pbstr);
    do
    {
  bstr = NULL;
  if (NULL != pwc)
  {
      if (-1 == cb)
      {
    cb = wcslen(pwc) * sizeof(WCHAR);
      }
      bstr = SysAllocStringByteLen((char const *) pwc, cb);
      if (NULL == bstr)
      {
    break;
      }
  }
  *pbstr = bstr;
  fOk = TRUE;
    } while (FALSE);
    return(fOk);
}

BOOL ceConvertWszToSz | ( | OUT CHAR ** | ppsz,
 |  | IN WCHAR const * | pwc,
 |  | IN LONG | cwc
 | ) |  |

Definition at line 214 of file CeLib.Cpp.

{
    BOOL fOk = FALSE;
    LONG cch = 0;

    *ppsz = NULL;
    while (TRUE)
    {
  cch = WideCharToMultiByte(
      GetACP(),
      0,          // dwFlags
      pwc,
      cwc,        // cchWideChar, -1 => null terminated
      *ppsz,
      cch,
      NULL,
      NULL);
  if (0 >= cch)
  {
      DWORD err;

      err = GetLastError();
      ceERRORPRINTLINE("WideCharToMultiByte", err);
      if (NULL != *ppsz)
      {
    LocalFree(*ppsz);
    *ppsz = NULL;
      }
      break;
  }
  if (NULL != *ppsz)
  {
      fOk = TRUE;
      break;
  }
  *ppsz = (CHAR *) LocalAlloc(LMEM_FIXED, cch + 1);
  if (NULL == *ppsz)
  {
      break;
  }
    }
    return(fOk);
}

HRESULT ceDateToFileTime | ( | IN DATE const * | pDate,
 |  | OUT FILETIME * | pft
 | ) |  |

Definition at line 450 of file CeLib.Cpp.

{
    SYSTEMTIME st;
    HRESULT hr = S_OK;

    if (*pDate == 0.0)
    {
        GetSystemTime(&st);
    }
    else
    {
  if (!VariantTimeToSystemTime(*pDate, &st))
  {
      hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
      _JumpError(hr, error, "VariantTimeToSystemTime");
  }
    }

    if (!SystemTimeToFileTime(&st, pft))
    {
        hr = ceHLastError();
        _JumpError(hr, error, "SystemTimeToFileTime");
    }

error:
    return(hr);
}

BOOL ceDecodeObject | ( | IN DWORD | dwEncodingType,
 |  | IN LPCSTR | lpszStructType,
 |  | IN BYTE const * | pbEncoded,
 |  | IN DWORD | cbEncoded,
 |  | IN BOOL | fCoTaskMemAlloc,
 |  | OUT VOID ** | ppvStructInfo,
 |  | OUT DWORD * | pcbStructInfo
 | ) |  |

Definition at line 27 of file CeLib.Cpp.

{
    BOOL b;

    assert(!fCoTaskMemAlloc);
    *ppvStructInfo = NULL;
    *pcbStructInfo = 0;
    while (TRUE)
    {
  b = CryptDecodeObject(
        dwEncodingType,
        lpszStructType,
        pbEncoded,
        cbEncoded,
        0,                  // dwFlags
        *ppvStructInfo,
        pcbStructInfo);
  if (b && 0 == *pcbStructInfo)
  {
      SetLastError((DWORD) HRESULT_FROM_WIN32(ERROR_INVALID_DATA));
      b = FALSE;
  }
  if (!b)
  {
      if (NULL != *ppvStructInfo)
      {
    HRESULT hr = GetLastError();

    LocalFree(*ppvStructInfo);
    *ppvStructInfo = NULL;
    SetLastError(hr);
      }
      break;
  }
  if (NULL != *ppvStructInfo)
  {
      break;
  }
  *ppvStructInfo = (BYTE *) LocalAlloc(LMEM_FIXED, *pcbStructInfo);
  if (NULL == *ppvStructInfo)
  {
      b = FALSE;
      break;
  }
    }
    return(b);
}

HRESULT ceDispatchSetErrorInfo | ( | IN HRESULT | hrError,
 |  | IN WCHAR const * | pwszDescription,
 |  | OPTIONAL IN WCHAR const * | pwszProgId,
 |  | OPTIONAL IN IID const * | piid
 | ) |  |

Definition at line 997 of file CeLib.Cpp.

{
    HRESULT hr;
    WCHAR const *pwszError = NULL;
    WCHAR *pwszText = NULL;

    if (NULL == pwszDescription)
    {
        hr = E_POINTER;
  _JumpError(hr, error, "NULL pointer");
    }
    assert(FAILED(hrError));
    pwszError = ceGetErrorMessageText(hrError, TRUE);
    if (NULL == pwszError)
    {
  _PrintError(E_OUTOFMEMORY, "myGetErrorMessageText");
    }
    else
    {
  pwszText = (WCHAR *) LocalAlloc(
      LMEM_FIXED,
      (wcslen(pwszDescription) + 1 + wcslen(pwszError) + 1) *
       sizeof(WCHAR));
  if (NULL == pwszText)
  {
      _PrintError(E_OUTOFMEMORY, "LocalAlloc");
  }
  else
  {
      wcscpy(pwszText, pwszDescription);
      wcscat(pwszText, L" ");
      wcscat(pwszText, pwszError);
  }
    }
    hr = ceDispatchSetErrorInfoSub(
      hrError,
      NULL,   // pwszIDispatchMethod
      NULL != pwszText?
          pwszText : const_cast<WCHAR *>(pwszDescription),
      pwszProgId,
      piid,
      NULL,   // pwszHelpFile
      0);   // dwHelpFileContext
    _PrintIfError(hr, "ceDispatchSetErrorInfoSub");

error:
    if (NULL != pwszText)
    {
  LocalFree(pwszText);
    }
    if (NULL != pwszError)
    {
  LocalFree(const_cast<WCHAR *>(pwszError));
    }
    return(hrError);  // return input error!
}

HRESULT ceDispatchSetErrorInfoSub | ( | IN HRESULT | hrError,
 |  | OPTIONAL IN WCHAR const * | pwszIDispatchMethod,
 |  | OPTIONAL IN WCHAR const * | pwszDescription,
 |  | OPTIONAL IN WCHAR const * | pwszSource,
 |  | OPTIONAL IN IID const * | piid,
 |  | OPTIONAL IN WCHAR const * | pwszHelpFile,
 |  | IN DWORD | dwHelpFileContext
 | ) |  |

Definition at line 924 of file CeLib.Cpp.

{
    HRESULT hr;
    WCHAR const *pwszError = NULL;
    ICreateErrorInfo *pCreateErrorInfo = NULL;
    IErrorInfo *pErrorInfo = NULL;

    if (NULL != pwszIDispatchMethod)
    {
  pwszError = ceGetErrorMessageText(hrError, TRUE);
    }

    hr = CreateErrorInfo(&pCreateErrorInfo);
    _JumpIfError(hr, error, "CreateErrorInfo");

    if (NULL != piid)
    {
  hr = pCreateErrorInfo->SetGUID(*piid);
  _PrintIfError(hr, "SetGUID");
    }
    if (NULL != pwszSource)
    {
  hr = pCreateErrorInfo->SetSource(const_cast<WCHAR *>(pwszSource));
  _PrintIfError(hr, "SetSource");
    }
    if (NULL != pwszDescription)
    {
  hr = pCreateErrorInfo->SetDescription(
          const_cast<WCHAR *>(pwszDescription));
  _PrintIfError(hr, "SetDescription");
    }
    if (NULL != pwszHelpFile)
    {
  hr = pCreateErrorInfo->SetHelpFile(const_cast<WCHAR *>(pwszHelpFile));
  _PrintIfError(hr, "SetHelpFile");

  hr = pCreateErrorInfo->SetHelpContext(dwHelpFileContext);
  _PrintIfError(hr, "SetHelpContext");
    }

    hr = pCreateErrorInfo->QueryInterface(
            IID_IErrorInfo,
            (VOID **) &pErrorInfo);
    _JumpIfError(hr, error, "QueryInterface");

    SetErrorInfo(0, pErrorInfo);
    hr = S_OK;

error:
    if (NULL != pwszError)
    {
  LocalFree(const_cast<WCHAR *>(pwszError));
    }
    if (NULL != pErrorInfo)
    {
  pErrorInfo->Release();
    }
    if (NULL != pCreateErrorInfo)
    {
  pCreateErrorInfo->Release();
    }
    return(hr);
}

WCHAR* ceDuplicateString ( IN WCHAR const * pwsz )

Definition at line 197 of file CeLib.Cpp.

{
    WCHAR *pwszOut;

    pwszOut = (WCHAR *) LocalAlloc(
        LMEM_FIXED,
        (wcslen(pwsz) + 1) * sizeof(pwsz[0]));
    if (NULL != pwszOut)
    {
  wcscpy(pwszOut, pwsz);
    }
    return(pwszOut);
}

BOOL ceEncodeObject | ( | IN DWORD | dwEncodingType,
 |  | IN LPCSTR | lpszStructType,
 |  | IN VOID const * | pvStructInfo,
 |  | IN DWORD | dwFlags,
 |  | IN BOOL | fCoTaskMemAlloc,
 |  | OUT BYTE ** | ppbEncoded,
 |  | OUT DWORD * | pcbEncoded
 | ) |  |

Definition at line 87 of file CeLib.Cpp.

{
    BOOL b;

    assert(0 == dwFlags);
    assert(!fCoTaskMemAlloc);
    *ppbEncoded = NULL;
    *pcbEncoded = 0;
    while (TRUE)
    {
  b = CryptEncodeObject(
        dwEncodingType,
        lpszStructType,
        const_cast<VOID *>(pvStructInfo),
        *ppbEncoded,
        pcbEncoded);
  if (b && 0 == *pcbEncoded)
  {
      SetLastError((DWORD) HRESULT_FROM_WIN32(ERROR_INVALID_DATA));
      b = FALSE;
  }
  if (!b)
  {
      if (NULL != *ppbEncoded)
      {
    HRESULT hr = GetLastError();

    LocalFree(*ppbEncoded);
    *ppbEncoded = NULL;
    SetLastError(hr);
      }
      break;
  }
  if (NULL != *ppbEncoded)
  {
      break;
  }
  *ppbEncoded = (BYTE *) LocalAlloc(LMEM_FIXED, *pcbEncoded);
  if (NULL == *ppbEncoded)
  {
      b = FALSE;
      break;
  }
    }
    return(b);
}

VOID ceErrorPrintLine | ( | IN char const * | pszFile,
 |  | IN DWORD | line,
 |  | IN char const * | pszMessage,
 |  | IN WCHAR const * | pwszData,
 |  | IN HRESULT | hr
 | ) |  |

Definition at line 416 of file CeLib.Cpp.

{
    CHAR ach[4096];
    LONG cch;

//#pragma prefast(disable:53, "PREfast bug 650")
    cch = _snprintf(
    ach,
    sizeof(ach),
    "CeLib: Error: %hs(%u): %hs%hs%ws%hs 0x%x (%d)\n",
    pszFile,
    line,
    pszMessage,
    NULL == pwszData? "" : szLPAREN,
    NULL == pwszData? L"" : pwszData,
    NULL == pwszData? "" : szRPAREN,
    hr,
    hr);
//#pragma prefast(enable:53, "re-enable")
    if (0 > cch || sizeof(ach) <= cch)
    {
  strcpy(&ach[sizeof(ach) - 5], "...\n");
    }
    OutputDebugStringA(ach);
    wprintf(L"%hs", ach);
}

HRESULT ceFileTimeToDate | ( | IN FILETIME const * | pft,
 |  | OUT DATE * | pDate
 | ) |  |

Definition at line 482 of file CeLib.Cpp.

{
    SYSTEMTIME st;
    HRESULT hr = S_OK;

    if (!FileTimeToSystemTime(pft, &st))
    {
        hr = ceHLastError();
        _JumpError(hr, error, "FileTimeToSystemTime");
    }
    if (!SystemTimeToVariantTime(&st, pDate))
    {
        hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
        _JumpError(hr, error, "SystemTimeToVariantTime");
    }

error:
    return(hr);
}

VOID ceFreeBstr ( IN OUT BSTR * pstr )

Definition at line 377 of file CeLib.Cpp.

{
    if (NULL != *pstr)
    {
  SysFreeString(*pstr);
  *pstr = NULL;
    }
}

HRESULT ceGetComputerNames | ( | OUT WCHAR ** | ppwszDnsName,
 |  | OUT WCHAR ** | ppwszOldName
 | ) |  |

Definition at line 1203 of file CeLib.Cpp.

{
    HRESULT hr;
    DWORD cwc;
    WCHAR *pwszOldName = NULL;

    *ppwszOldName = NULL;
    *ppwszDnsName = NULL;

    cwc = MAX_COMPUTERNAME_LENGTH + 1;
    pwszOldName = (WCHAR *) LocalAlloc(LMEM_FIXED, cwc * sizeof(WCHAR));
    if (NULL == pwszOldName)
    {
      hr = E_OUTOFMEMORY;
      _JumpError(hr, error, "LocalAlloc");
    }
    if (!GetComputerName(pwszOldName, &cwc))
    {
        hr = ceHLastError();
        _JumpError(hr, error, "GetComputerName");
    }

    hr = ceGetMachineDnsName(ppwszDnsName);
    _JumpIfError(hr, error, "ceGetMachineDnsName");

    *ppwszOldName = pwszOldName;
    pwszOldName = NULL;

error:
    if (NULL != pwszOldName)
    {
  LocalFree(pwszOldName);
    }
    return(hr);
}

HRESULT ceGetMachineDnsName ( OUT WCHAR ** ppwszDnsName )

Definition at line 1147 of file CeLib.Cpp.

{
    HRESULT hr;
    WCHAR *pwszDnsName = NULL;
    DWORD cwc;
    COMPUTER_NAME_FORMAT NameType = ComputerNameDnsFullyQualified;

    *ppwszDnsName = NULL;
    while (TRUE)
    {
  cwc = 0;
  if (!GetComputerNameEx(NameType, NULL, &cwc))
  {
      hr = ceHLastError();
      if (HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) == hr &&
    ComputerNameDnsFullyQualified == NameType)
      {
    _PrintError(hr, "GetComputerNameEx(DnsFullyQualified) -- switching to NetBIOS");
    NameType = ComputerNameNetBIOS;
    continue;
      }
      if (HRESULT_FROM_WIN32(ERROR_MORE_DATA) != hr)
      {
    _JumpError(hr, error, "GetComputerNameEx");
      }
      break;
  }
    }
    pwszDnsName = (WCHAR *) LocalAlloc(LMEM_FIXED, cwc * sizeof(WCHAR));
    if (NULL == pwszDnsName)
    {
  hr = E_OUTOFMEMORY;
  _JumpError(hr, error, "LocalAlloc");
    }

    if (!GetComputerNameEx(NameType, pwszDnsName, &cwc))
    {
  hr = ceHLastError();
  _JumpError(hr, error, "GetComputerNameEx");
    }

    *ppwszDnsName = pwszDnsName;
    pwszDnsName = NULL;
    hr = S_OK;

error:
    if (NULL != pwszDnsName)
    {
  LocalFree(pwszDnsName);
    }
    return(hr);
}

WCHAR const* ceGetOIDName ( IN WCHAR const * pwszObjId )

Definition at line 175 of file CeLib.Cpp.

{
    char *pszObjId = NULL;
    WCHAR const *pwszName = L"";

    if (!ceConvertWszToSz(&pszObjId, pwszObjId, -1))
    {
  _JumpError(E_OUTOFMEMORY, error, "ceConvertWszToSz");
    }
    pwszName = ceGetOIDNameA(pszObjId);

error:
    if (NULL != pszObjId)
    {
  LocalFree(pszObjId);
    }
    return(pwszName);
}

WCHAR const* ceGetOIDNameA ( IN char const * pszObjId )

Definition at line 147 of file CeLib.Cpp.

{
    CRYPT_OID_INFO const *pInfo = NULL;
    WCHAR const *pwszName = L"";

    // First try looking up the ObjectId as an Extension or Attribute, because
    // we get a better Display Name, especially for Subject RDNs: CN, L, etc.
    // If that fails, look it up withoput restricting the group.

    pInfo = CryptFindOIDInfo(
      CRYPT_OID_INFO_OID_KEY,
      (VOID *) pszObjId,
      CRYPT_EXT_OR_ATTR_OID_GROUP_ID);

    if (NULL == pInfo || NULL == pInfo->pwszName || L'\0' == pInfo->pwszName[0])
    {
  pInfo = CryptFindOIDInfo(CRYPT_OID_INFO_OID_KEY, (VOID *) pszObjId, 0);
    }
    if (NULL != pInfo && NULL != pInfo->pwszName && L'\0' != pInfo->pwszName[0])
    {
  pwszName = pInfo->pwszName;
    }
    return(pwszName);
}

HRESULT ceHError ( IN HRESULT hr )

Definition at line 389 of file CeLib.Cpp.

{
    assert(S_FALSE != hr);

    if (S_OK != hr && S_FALSE != hr && !FAILED(hr))
    {
        hr = HRESULT_FROM_WIN32(hr);
  if ((HRESULT) 0 == HRESULT_CODE(hr))
  {
      // A call failed without properly setting an error condition!
      hr = E_UNEXPECTED;
  }
  assert(FAILED(hr));
    }
    return(hr);
}

HRESULT ceHLastError ( VOID )

Definition at line 409 of file CeLib.Cpp.

{
    return(ceHError(GetLastError()));
}

HRESULT ceIsConfigLocal | ( | IN WCHAR const * | pwszConfig,
 |  | OPTIONAL OUT WCHAR ** | ppwszMachine,
 |  | OUT BOOL * | pfLocal
 | ) |  |

Definition at line 1305 of file CeLib.Cpp.

{
    HRESULT hr;
    WCHAR *pwszDnsName = NULL;
    WCHAR *pwszOldName = NULL;

    *pfLocal = FALSE;
    if (NULL != ppwszMachine)
    {
  *ppwszMachine = NULL;
    }

    hr = ceGetComputerNames(&pwszDnsName, &pwszOldName);
    _JumpIfError(hr, error, "ceGetComputerNames");

    hr = _IsConfigLocal(
        pwszConfig,
        pwszDnsName,
        pwszOldName,
        ppwszMachine,
        pfLocal);
    _JumpIfError(hr, error, "_IsConfigLocal");

error:
    if (NULL != pwszDnsName)
    {
  LocalFree(pwszDnsName);
    }
    if (NULL != pwszOldName)
    {
  LocalFree(pwszOldName);
    }
    return(hr);
}

int celstrcmpiL | ( | IN WCHAR const * | pwsz1,
 |  | IN WCHAR const * | pwsz2
 | ) |  |

Definition at line 1389 of file CeLib.Cpp.

{
    // CSTR_LESS_THAN(1) - CSTR_EQUAL(2)    == -1 string 1 less than string 2
    // CSTR_EQUAL(2) - CSTR_EQUAL(2)        == 0 string 1 equal to string 2
    // CSTR_GREATER_THAN(3) - CSTR_EQUAL(2) == 1 string 1 greater than string 2

    return(CompareString(
    LOCALE_INVARIANT,
    NORM_IGNORECASE,
    pwsz1,
    -1,
    pwsz2,
    -1) -
      CSTR_EQUAL);
}

HRESULT ceMakeExprDate | ( | IN OUT DATE * | pDate,
 |  | IN LONG | lDelta,
 |  | IN enum ENUM_PERIOD | enumPeriod
 | ) |  |

Definition at line 618 of file CeLib.Cpp.

{
    HRESULT hr;
    FILETIME ft;

    hr = ceDateToFileTime(pDate, &ft);
    _JumpIfError(hr, error, "ceDateToFileTime");

    ceMakeExprDateTime(&ft, lDelta, enumPeriod);

    hr = ceFileTimeToDate(&ft, pDate);
    _JumpIfError(hr, error, "ceFileTimeToDate");

error:
    return(hr);
}

VOID ceMakeExprDateTime | ( | IN OUT FILETIME * | pft,
 |  | IN LONG | lDelta,
 |  | IN enum ENUM_PERIOD | enumPeriod
 | ) |  |

Definition at line 506 of file CeLib.Cpp.

{
    LLFILETIME llft;
    LONGLONG llDelta;
    BOOL fSysTimeDelta;

    llft.ft = *pft;
    llDelta = lDelta;
    fSysTimeDelta = FALSE;
    switch (enumPeriod)
    {
  case ENUM_PERIOD_WEEKS:   llDelta *= CVT_WEEKS;    break;
  case ENUM_PERIOD_DAYS:    llDelta *= CVT_DAYS;     break;
  case ENUM_PERIOD_HOURS:   llDelta *= CVT_HOURS;    break;
  case ENUM_PERIOD_MINUTES: llDelta *= CVT_MINUTES;  break;
  case ENUM_PERIOD_SECONDS:          break;
  default:
      fSysTimeDelta = TRUE;
      break;
    }
    if (fSysTimeDelta)
    {
  SYSTEMTIME SystemTime;

  FileTimeToSystemTime(&llft.ft, &SystemTime);
  switch (enumPeriod)
  {
      case ENUM_PERIOD_MONTHS:
    if (0 > lDelta)
    {
        DWORD dwDelta = (DWORD) -lDelta;

        SystemTime.wYear -= (WORD) (dwDelta / 12) + 1;
        SystemTime.wMonth += 12 - (WORD) (dwDelta % 12);
    }
    else
    {
        SystemTime.wMonth = (WORD) lDelta + SystemTime.wMonth;
    }
    if (12 < SystemTime.wMonth)
    {
        SystemTime.wYear += (SystemTime.wMonth - 1) / 12;
        SystemTime.wMonth = ((SystemTime.wMonth - 1) % 12) + 1;
    }
    break;

      case ENUM_PERIOD_YEARS:
    SystemTime.wYear = (WORD) lDelta + SystemTime.wYear;
    break;

      default:
    SystemTime.wYear += 1;
    break;
  }

DoConvert:
        if (!SystemTimeToFileTime(&SystemTime, &llft.ft))
        {
            if (GetLastError() != ERROR_INVALID_PARAMETER)
            {
                assert(!"Unable to do time conversion");
                return;
            }

            // In some cases we'll convert to an invalid month-end

            // only one month changes length from year to year
            if (SystemTime.wMonth == 2)
            {
                // > 29? try leap year
                if (SystemTime.wDay > 29)
                {
                    SystemTime.wDay = 29;
                    goto DoConvert;
                }
                // == 29? try non-leap year
                else if (SystemTime.wDay == 29)
                {
                    SystemTime.wDay = 28;
                    goto DoConvert;
                }
            }
            // sept (9), apr(4), jun(6), nov(11) all have 30 days
            else if ((SystemTime.wMonth == 9) ||
                     (SystemTime.wMonth == 4) ||
                     (SystemTime.wMonth == 6) ||
                     (SystemTime.wMonth == 11))
            {
                if (SystemTime.wDay > 30)
                {
                    SystemTime.wDay = 30;
                    goto DoConvert;
                }
            }

            // should never get here
            assert(!"Month/year processing: inaccessible code");
            return;
        }
    }
    else
    {
  llft.ll += llDelta * CVT_BASE;
    }
    *pft = llft.ft;
}

HRESULT ceTranslatePeriodUnits | ( | IN WCHAR const * | pwszPeriod,
 |  | IN LONG | lCount,
 |  | OUT enum ENUM_PERIOD * | penumPeriod,
 |  | OUT LONG * | plCount
 | ) |  |

Definition at line 660 of file CeLib.Cpp.

{
    HRESULT hr;
    UNITSTABLE const *put;

    for (put = g_aut; put < &g_aut[CUNITSTABLEMAX]; put++)
    {
  if (0 == celstrcmpiL(pwszPeriod, put->pwszString))
  {
      *penumPeriod = put->enumPeriod;
      if (0 > lCount)
      {
    lCount = MAXLONG;
      }
      *plCount = lCount;
      hr = S_OK;
      goto error;
  }
    }
    hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);

error:
    return(hr);
}

HRESULT ceVerifyAltNameString | ( | IN LONG | NameChoice,
 |  | IN BSTR | strName
 | ) |  |

Definition at line 832 of file CeLib.Cpp.

{
    HRESULT hr = S_OK;
    CERT_ALT_NAME_INFO AltName;
    CERT_ALT_NAME_ENTRY Entry;
    CERT_OTHER_NAME OtherName;
    char *pszObjectId = NULL;
    DWORD cbEncoded;

    ZeroMemory(&AltName, sizeof(AltName));
    AltName.cAltEntry = 1;
    AltName.rgAltEntry = &Entry;

    ZeroMemory(&Entry, sizeof(Entry));
    Entry.dwAltNameChoice = NameChoice;

    switch (NameChoice)
    {
  case CERT_ALT_NAME_RFC822_NAME:
      Entry.pwszRfc822Name = strName;
      break;

  case CERT_ALT_NAME_DNS_NAME:
      Entry.pwszDNSName = strName;
      break;

  case CERT_ALT_NAME_URL:
      Entry.pwszURL = strName;
      break;

  case CERT_ALT_NAME_REGISTERED_ID:
      if (!ceConvertWszToSz(&pszObjectId, strName, -1))
      {
    hr = E_OUTOFMEMORY;
    ceERRORPRINTLINE("ceConvertWszToSz", hr);
    goto error;
      }
      Entry.pszRegisteredID = pszObjectId;
      break;

  case CERT_ALT_NAME_OTHER_NAME:
      Entry.pOtherName = &OtherName;
      OtherName.pszObjId = szOID_NT_PRINCIPAL_NAME;
      OtherName.Value.cbData = SysStringByteLen(strName);
      OtherName.Value.pbData = (BYTE *) strName;
      break;

  case CERT_ALT_NAME_DIRECTORY_NAME:
      Entry.DirectoryName.cbData = SysStringByteLen(strName);
      Entry.DirectoryName.pbData = (BYTE *) strName;
      break;

  case CERT_ALT_NAME_IP_ADDRESS:
      Entry.IPAddress.cbData = SysStringByteLen(strName);
      Entry.IPAddress.pbData = (BYTE *) strName;
      break;

  //case CERT_ALT_NAME_X400_ADDRESS:
  //case CERT_ALT_NAME_EDI_PARTY_NAME:
  default:
      hr = E_INVALIDARG;
      ceERRORPRINTLINE("NameChoice", hr);
      goto error;

    }

    // Encode CERT_ALT_NAME_INFO:

    if (!CryptEncodeObject(
        X509_ASN_ENCODING,
        X509_ALTERNATE_NAME,
        &AltName,
        NULL,
        &cbEncoded))
    {
  hr = ceHLastError();
  ceERRORPRINTLINE("ceEncodeObject", hr);
  goto error;
    }

error:
    if (NULL != pszObjectId)
    {
  LocalFree(pszObjectId);
    }
    return(hr);
}

HRESULT ceVerifyObjId ( IN WCHAR const * pwszObjId )

Definition at line 808 of file CeLib.Cpp.

{
    HRESULT hr;
    CHAR *pszObjId = NULL;

    if (!ceConvertWszToSz(&pszObjId, pwszObjId, -1))
    {
  hr = E_OUTOFMEMORY;
  _JumpError(hr, error, "ceConvertWszToSz");
    }
    hr = ceVerifyObjIdA(pszObjId);
    _JumpIfErrorStr(hr, error, "ceVerifyObjIdA", pwszObjId);

error:
    if (NULL != pszObjId)
    {
      LocalFree(pszObjId);
    }
    return(hr);
}

HRESULT ceVerifyObjIdA ( IN CHAR const * pszObjId )

Definition at line 703 of file CeLib.Cpp.

{
    HRESULT hr;
    BYTE *pbEncoded = NULL;
    DWORD cbEncoded;
    CRYPT_ATTRIBUTE ainfo;
    CRYPT_ATTRIBUTE *painfo = NULL;
    DWORD cbainfo;
    char const *psz;
    int i;

    ainfo.pszObjId = const_cast<char *>(pszObjId);
    ainfo.cValue = 0;
    ainfo.rgValue = NULL;

    if (!ceEncodeObject(
        X509_ASN_ENCODING,
        PKCS_ATTRIBUTE,
        &ainfo,
        0,
        FALSE,
        &pbEncoded,
        &cbEncoded))
    {
  hr = ceHLastError();
  _JumpError(hr, error, "ceEncodeObject");
    }

    if (!ceDecodeObject(
        X509_ASN_ENCODING,
        PKCS_ATTRIBUTE,
        pbEncoded,
        cbEncoded,
        FALSE,
        (VOID **) &painfo,
        &cbainfo))
    {
  hr = ceHLastError();
  _JumpError(hr, error, "ceDecodeObject");
    }

    hr = E_INVALIDARG;
    if (0 != strcmp(ainfo.pszObjId, painfo->pszObjId))
    {
  _JumpError(hr, error, "bad ObjId: decode mismatch");
    }
    for (psz = painfo->pszObjId; '\0' != *psz; psz++)
    {
  // must be a digit or a dot separator

  if (!isdigit(*psz))
  {
      if ('.' != *psz)
      {
    _JumpError(hr, error, "bad ObjId: bad char");
      }

      // can't have dot at start, double dots or dot at end

      if (psz == painfo->pszObjId || '.' == psz[1] || '\0' == psz[1])
      {
    _JumpError(hr, error, "bad ObjId: dot location");
      }
  }
    }
    psz = strchr(painfo->pszObjId, '.');
    if (NULL == psz)
    {
  _JumpError(hr, error, "bad ObjId: must have at least one dot");
    }
    i = atoi(painfo->pszObjId);
    switch (i)
    {
  case 0:
  case 1:
      i = atoi(++psz);
      if (0 > i || 39 < i)
      {
    _JumpError(hr, error, "bad ObjId: 0. or 1. must be followed by 0..39");
      }
      break;

  case 2:
      break;

  default:
      _JumpError(hr, error, "bad ObjId: must start with 0, 1 or 2");
    }
    hr = S_OK;

error:
    if (NULL != pbEncoded)
    {
      LocalFree(pbEncoded);
    }
    if (NULL != painfo)
    {
      LocalFree(painfo);
    }
    return(hr);
}

int ceWtoI | ( | IN WCHAR const * | string,
 |  | OUT BOOL * | pfValid
 | ) |  |

Definition at line 1060 of file CeLib.Cpp.

{
    HRESULT hr;
    WCHAR szBuf[16];
    WCHAR *szTmp = szBuf;
    int cTmp = ARRAYSIZE(szBuf);
    int i = 0;
    WCHAR const *pwsz;
    BOOL fSawDigit = FALSE;

    if (pfValid == NULL)
    {
        hr = E_POINTER;
        _JumpError(hr, error, "NULLPARAM");
    }
    *pfValid = FALSE;

    assert(NULL != pfValid);
    cTmp = FoldString(
        MAP_FOLDDIGITS,
        string,
        -1,
        szTmp,
        cTmp);
    if (cTmp == 0)
    {
        hr = ceHLastError();
        if (HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) == hr)
        {
            hr = S_OK;
            cTmp = FoldString(
                MAP_FOLDDIGITS,
                string,
                -1,
                NULL,
                0);

            szTmp = (WCHAR*)LocalAlloc(LMEM_FIXED, cTmp*sizeof(WCHAR));
      if (NULL == szTmp)
      {
    hr = E_OUTOFMEMORY;
    _JumpError(hr, error, "LocalAlloc");
      }

            cTmp = FoldString(
                MAP_FOLDDIGITS,
                string,
                -1,
                szTmp,
                cTmp);

            if (cTmp == 0)
                hr = ceHLastError();
        }
        _JumpIfError(hr, error, "FoldString");
    }
    pwsz = szTmp;
    while (iswspace(*pwsz))
    {
  pwsz++;
    }
    while (iswdigit(*pwsz))
    {
  fSawDigit = TRUE;
  pwsz++;
    }
    while (iswspace(*pwsz))
    {
  pwsz++;
    }
    if (L'\0' == *pwsz)
    {
  *pfValid = fSawDigit;
    }
    i = _wtoi(szTmp);

error:
    if (szTmp && (szTmp != szBuf))
       LocalFree(szTmp);

    return i;
}

Variable Documentation

UNITSTABLE g_aut[]
Initial value:
{
    { wszPERIODSECONDS, ENUM_PERIOD_SECONDS },
    { wszPERIODMINUTES, ENUM_PERIOD_MINUTES },
    { wszPERIODHOURS,   ENUM_PERIOD_HOURS },
    { wszPERIODDAYS,    ENUM_PERIOD_DAYS },
    { wszPERIODWEEKS,   ENUM_PERIOD_WEEKS },
    { wszPERIODMONTHS,  ENUM_PERIOD_MONTHS },
    { wszPERIODYEARS,   ENUM_PERIOD_YEARS },
}

Definition at line 646 of file CeLib.Cpp.

Generated on Wed Nov 13 2024 16:54:28 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Encode/CertEnc.Cpp File Reference

  • Security
  • CertServices
  • Encode
Functions | Variables

CertEnc.Cpp File Reference

#include "pch.cpp"
#include "celib.h"
#include "resource.h"
#include "certenc.h"
#include "adate.h"
#include "along.h"
#include "astring.h"
#include "crldist.h"
#include "altname.h"
#include "bitstr.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (VOID)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, VOID *)
STDAPI | DllRegisterServer (VOID)
STDAPI | DllUnregisterServer (VOID)

Variables

CComModule | _Module
HMODULE | g_hModule

Function Documentation

STDAPI DllCanUnloadNow ( VOID )

Definition at line 71 of file CertEnc.Cpp.

{
    HRESULT hr;

    hr = 0 == _Module.GetLockCount()? S_OK : S_FALSE;
    return(hr);
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 84 of file CertEnc.Cpp.

{
    HRESULT hr;

    hr = _Module.GetClassObject(rclsid, riid, ppv);
    return(hr);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | VOID * |
 | ) |  |

Definition at line 44 of file CertEnc.Cpp.

{
    g_hModule = hInstance;
    if (DLL_PROCESS_ATTACH == dwReason)
    {
  ceInitErrorMessageText(
      hInstance,
      IDS_E_UNEXPECTED,
      IDS_UNKNOWN_ERROR_CODE);
  _Module.Init(ObjectMap, hInstance);
  DisableThreadLibraryCalls(hInstance);
    }
    if (DLL_PROCESS_DETACH == dwReason)
    {
  _Module.Term();
    }
    return(TRUE);
}

STDAPI DllRegisterServer ( VOID )

Definition at line 97 of file CertEnc.Cpp.

{
    HRESULT hr;

    // registers object, typelib and all interfaces in typelib

    hr = _Module.RegisterServer(TRUE);
    return(hr);
}

STDAPI DllUnregisterServer ( VOID )

Definition at line 112 of file CertEnc.Cpp.

{
    _Module.UnregisterServer();
    return(S_OK);
}

Variable Documentation

CComModule _Module

Definition at line 26 of file CertEnc.Cpp.

HMODULE g_hModule

Definition at line 27 of file CertEnc.Cpp.

Generated on Wed Nov 13 2024 16:54:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Encode/CrlDist.Cpp File Reference

  • Security
  • CertServices
  • Encode

CrlDist.Cpp File Reference

#include "pch.cpp"
#include <assert.h>
#include "resource.h"
#include "crldist.h"
#include "celib.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Encode/CrlDist.h File Reference

  • Security
  • CertServices
  • Encode
Classes | Defines

CrlDist.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class | CCertEncodeCRLDistInfo

Defines

#define | wszCLASS_CERTENCODECRLDISTINFO wszCLASS_CERTENCODE TEXT("CRLDistInfo")

Define Documentation

#define wszCLASS_CERTENCODECRLDISTINFO wszCLASS_CERTENCODE TEXT("CRLDistInfo")

Definition at line 19 of file CrlDist.h.

Generated on Wed Nov 13 2024 16:54:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Encode/Pch.Cpp File Reference

  • Security
  • CertServices
  • Encode
Variables

Pch.Cpp File Reference

#include <windows.h>
#include <atlbase.h>
#include <atlcom.h>
#include <certsrv.h>

Go to the source code of this file.

Variables

CComModule _Module

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:54:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Encode/Resource.h File Reference

  • Security
  • CertServices
  • Encode
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDS_CERTENCODEALTNAME_DESC 3
#define | IDS_CERTENCODEBITSTRING_DESC 5
#define | IDS_CERTENCODECRLDIST_DESC 6
#define | IDS_CERTENCODEDATEARRAY_DESC 1
#define | IDS_CERTENCODELONGARRAY_DESC 2
#define | IDS_CERTENCODESTRINGARRAY_DESC 4
#define | IDS_E_UNEXPECTED 7
#define | IDS_UNKNOWN_ERROR_CODE 8

Define Documentation

#define IDS_CERTENCODEALTNAME_DESC 3

Definition at line 17 of file Resource.h.

#define IDS_CERTENCODEBITSTRING_DESC 5

Definition at line 19 of file Resource.h.

#define IDS_CERTENCODECRLDIST_DESC 6

Definition at line 20 of file Resource.h.

#define IDS_CERTENCODEDATEARRAY_DESC 1

Definition at line 15 of file Resource.h.

#define IDS_CERTENCODELONGARRAY_DESC 2

Definition at line 16 of file Resource.h.

#define IDS_CERTENCODESTRINGARRAY_DESC 4

Definition at line 18 of file Resource.h.

#define IDS_E_UNEXPECTED 7

Definition at line 21 of file Resource.h.

#define IDS_UNKNOWN_ERROR_CODE 8

Definition at line 22 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Exit/C++/Windows.Net/atl.cpp File Reference

  • Security
  • CertServices
  • Exit
  • C++
  • Windows.Net

atl.cpp File Reference

#include <pch.cpp>
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Exit/C++/Windows.Net/cedebug.cpp File Reference

  • Security
  • CertServices
  • Exit
  • C++
  • Windows.Net
Functions

cedebug.cpp File Reference

#include <pch.cpp>
#include "celib.h"
#include <stdarg.h>

Go to the source code of this file.

Functions

int WINAPIV ceDbgPrintf (IN BOOL fDebug, IN LPCSTR lpFmt,...)

Function Documentation

int WINAPIV ceDbgPrintf | ( | IN BOOL | fDebug,
 |  | IN LPCSTR | lpFmt,
 |  |  | ...
 | ) |  |

Definition at line 31 of file cedebug.cpp.

{
    va_list arglist;
    CHAR ach[4096];
    int cch = 0;
    HANDLE hStdOut;
    DWORD dwErr;

    dwErr = GetLastError();
    if (fDebug)
    {
  __try
  {
      va_start(arglist, lpFmt);
      cch = _vsnprintf(ach, sizeof(ach), lpFmt, arglist);
      ach[ARRAYSIZE(ach)-1] = L'\0';
      va_end(arglist);

      if (0 > cch)
      {
    strcpy(&ach[sizeof(ach) - 5], "...\n");
      }

      if (!IsDebuggerPresent())
      {
    hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
    if (hStdOut != INVALID_HANDLE_VALUE)
    {
        fputs(ach, stdout);
        fflush(stdout);
    }
      }
      OutputDebugStringA(ach);
  }
  __except(EXCEPTION_EXECUTE_HANDLER)
  {
      // return failure
      cch = 0;
  }
    }
    SetLastError(dwErr);
    return(cch);
}

Generated on Wed Nov 13 2024 16:54:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Exit/C++/Windows.Net/ceerror.cpp File Reference

  • Security
  • CertServices
  • Exit
  • C++
  • Windows.Net
Defines | Functions

ceerror.cpp File Reference

#include <pch.cpp>
#include "celib.h"
#include <assert.h>
#include <ntdsbmsg.h>
#include <delayimp.h>
#include <wininet.h>

Go to the source code of this file.

Defines

#define | CERTLIB_12BITERRORMASK 0x00000fff
#define | CERTLIB_WIN32ERRORMASK 0x0000ffff
#define | DELAYLOAD_FROM_WIN32(hr) VcppException(ERROR_SEVERITY_ERROR, (hr))
#define | E_DELAYLOAD_MOD_NOT_FOUND DELAYLOAD_FROM_WIN32(ERROR_MOD_NOT_FOUND)
#define | E_DELAYLOAD_PROC_NOT_FOUND DELAYLOAD_FROM_WIN32(ERROR_PROC_NOT_FOUND)
#define | HRESULT_FROM_JETERROR(jerr) (ERROR_SEVERITY_ERROR | (FACILITY_NTDSB << 16) | -jerr)
#define | HRESULT_FROM_JETWARNING(jerr) (ERROR_SEVERITY_WARNING | (FACILITY_NTDSB << 16) | jerr)
#define | ISDELAYLOADHRESULT(hr)
#define | ISDELAYLOADHRESULTFACILITY(hr)
#define | ISHTTPERROR(hr) ((HRESULT) HTTP_STATUS_FIRST <= (hr) && (HRESULT) HTTP_STATUS_LAST >= (hr))
#define | ISHTTPHRESULT(hr) (ISWIN32HRESULT(hr) && ISHTTPERROR(WIN32ERROR_FROM_HRESULT(hr)))
#define | ISJETERROR(hr) ((~CERTLIB_WIN32ERRORMASK & (hr)) == (HRESULT) ~CERTLIB_WIN32ERRORMASK)
#define | ISJETHRESULT(hr)
#define | ISOSSERROR(hr) ((~CERTLIB_12BITERRORMASK & (hr)) == CRYPT_E_OSS_ERROR)
#define | ISSETUPHRESULT(hr)
#define | ISWIN32ERROR(hr) ((~CERTLIB_WIN32ERRORMASK & (hr)) == 0)
#define | ISWIN32HRESULT(hr)
#define | JETERROR_FROM_HRESULT(hr) (-(LONG) (CERTLIB_WIN32ERRORMASK & (hr)))
#define | OSSERROR_FROM_HRESULT(hr) (CERTLIB_12BITERRORMASK & (hr))
#define | WIN32ERROR_FROM_DELAYLOAD(hr) (CERTLIB_WIN32ERRORMASK & (hr))
#define | WIN32ERROR_FROM_HRESULT(hr) (CERTLIB_WIN32ERRORMASK & (hr))
#define | wszCOLONSPACE L": "
#define | wszHTTPERRORPREFIX L"HTTP"
#define | wszJETERRORPREFIX L"ESE"
#define | wszOSSERRORPREFIX L"ASN"
#define | wszSETUPERRORPREFIX L"INF"
#define | wszWIN32ERRORPREFIX L"WIN32"

Functions

WCHAR const * | ceGetErrorMessageText (IN HRESULT hr, IN BOOL fHResultString)
WCHAR const * | ceGetErrorMessageText1 (IN HRESULT hr, IN BOOL fHResultString, IN OPTIONAL WCHAR const *pwszInsertionText)
WCHAR const * | ceGetErrorMessageTextEx (IN HRESULT hr, IN BOOL fHResultString, IN OPTIONAL WCHAR const *const *papwszInsertionText)
HRESULT | ceHExceptionCode (IN EXCEPTION_POINTERS const *pep)
WCHAR const * | ceHResultToString (IN OUT WCHAR *awchr, IN HRESULT hr)
WCHAR const * | ceHResultToStringEx (IN OUT WCHAR *awchr, IN HRESULT hr, IN BOOL fRaw)
WCHAR const * | ceHResultToStringRaw (IN OUT WCHAR *awchr, IN HRESULT hr)
VOID | ceInitErrorMessageText (IN HMODULE hMod, IN DWORD idsUnexpected, IN DWORD idsUnknownErrorCode)
BOOL | ceIsDelayLoadHResult (IN HRESULT hr)
HRESULT | ceJetHResult (IN HRESULT hr)
DWORD | errFormatMessage (IN HMODULE hMod, IN HRESULT hr, OUT WCHAR const **ppwszOut, OPTIONAL IN WCHAR const *const *ppwszArgs)

Define Documentation

#define CERTLIB_12BITERRORMASK 0x00000fff

Definition at line 22 of file ceerror.cpp.

#define CERTLIB_WIN32ERRORMASK 0x0000ffff

Definition at line 23 of file ceerror.cpp.

#define DELAYLOAD_FROM_WIN32 ( hr ) VcppException(ERROR_SEVERITY_ERROR, (hr))

Definition at line 90 of file ceerror.cpp.

#define E_DELAYLOAD_MOD_NOT_FOUND DELAYLOAD_FROM_WIN32(ERROR_MOD_NOT_FOUND)

Definition at line 99 of file ceerror.cpp.

#define E_DELAYLOAD_PROC_NOT_FOUND DELAYLOAD_FROM_WIN32(ERROR_PROC_NOT_FOUND)

Definition at line 102 of file ceerror.cpp.

#define HRESULT_FROM_JETERROR ( jerr ) (ERROR_SEVERITY_ERROR | (FACILITY_NTDSB << 16) | -jerr)

Definition at line 32 of file ceerror.cpp.

#define HRESULT_FROM_JETWARNING ( jerr ) (ERROR_SEVERITY_WARNING | (FACILITY_NTDSB << 16) | jerr)

Definition at line 29 of file ceerror.cpp.

#define ISDELAYLOADHRESULT ( hr )
Value:
((HRESULT) E_DELAYLOAD_MOD_NOT_FOUND == (hr) || \
         (HRESULT) E_DELAYLOAD_PROC_NOT_FOUND == (hr) || \
         HRESULT_FROM_WIN32(ERROR_MOD_NOT_FOUND) == (hr) || \
         HRESULT_FROM_WIN32(ERROR_PROC_NOT_FOUND) == (hr))

Definition at line 104 of file ceerror.cpp.

#define ISDELAYLOADHRESULTFACILITY ( hr )
Value:
((~CERTLIB_WIN32ERRORMASK & (hr)) == (HRESULT) (ERROR_SEVERITY_ERROR | \
                                              (FACILITY_VISUALCPP << 16)))

Definition at line 94 of file ceerror.cpp.

#define ISHTTPERROR ( hr ) ((HRESULT) HTTP_STATUS_FIRST <= (hr) && (HRESULT) HTTP_STATUS_LAST >= (hr))

Definition at line 78 of file ceerror.cpp.

#define ISHTTPHRESULT ( hr ) (ISWIN32HRESULT(hr) && ISHTTPERROR(WIN32ERROR_FROM_HRESULT(hr)))

Definition at line 81 of file ceerror.cpp.

#define ISJETERROR ( hr ) ((~CERTLIB_WIN32ERRORMASK & (hr)) == (HRESULT) ~CERTLIB_WIN32ERRORMASK)

Definition at line 38 of file ceerror.cpp.

#define ISJETHRESULT ( hr )
Value:
((~CERTLIB_WIN32ERRORMASK & (hr)) == (HRESULT) (ERROR_SEVERITY_ERROR | \
                (FACILITY_NTDSB << 16)))

Definition at line 41 of file ceerror.cpp.

#define ISOSSERROR ( hr ) ((~CERTLIB_12BITERRORMASK & (hr)) == CRYPT_E_OSS_ERROR)

Definition at line 114 of file ceerror.cpp.

#define ISSETUPHRESULT ( hr )
Value:
((~CERTLIB_WIN32ERRORMASK & (hr)) == (HRESULT) (ERROR_SEVERITY_ERROR | \
                                              APPLICATION_ERROR_MASK | \
                                              (FACILITY_NULL << 16)))

Definition at line 51 of file ceerror.cpp.

#define ISWIN32ERROR ( hr ) ((~CERTLIB_WIN32ERRORMASK & (hr)) == 0)

Definition at line 62 of file ceerror.cpp.

#define ISWIN32HRESULT ( hr )
Value:
((~CERTLIB_WIN32ERRORMASK & (hr)) == (HRESULT) (ERROR_SEVERITY_WARNING | \
                (FACILITY_WIN32 << 16)))

Definition at line 65 of file ceerror.cpp.

#define JETERROR_FROM_HRESULT ( hr ) (-(LONG) (CERTLIB_WIN32ERRORMASK & (hr)))

Definition at line 35 of file ceerror.cpp.

#define OSSERROR_FROM_HRESULT ( hr ) (CERTLIB_12BITERRORMASK & (hr))

Definition at line 117 of file ceerror.cpp.

#define WIN32ERROR_FROM_DELAYLOAD ( hr ) (CERTLIB_WIN32ERRORMASK & (hr))

Definition at line 92 of file ceerror.cpp.

#define WIN32ERROR_FROM_HRESULT ( hr ) (CERTLIB_WIN32ERRORMASK & (hr))

Definition at line 69 of file ceerror.cpp.

#define wszCOLONSPACE L": "

Definition at line 176 of file ceerror.cpp.

#define wszHTTPERRORPREFIX L"HTTP"

Definition at line 84 of file ceerror.cpp.

#define wszJETERRORPREFIX L"ESE"

Definition at line 45 of file ceerror.cpp.

#define wszOSSERRORPREFIX L"ASN"

Definition at line 120 of file ceerror.cpp.

#define wszSETUPERRORPREFIX L"INF"

Definition at line 56 of file ceerror.cpp.

#define wszWIN32ERRORPREFIX L"WIN32"

Definition at line 72 of file ceerror.cpp.

Function Documentation

WCHAR const* ceGetErrorMessageText | ( | IN HRESULT | hr,
 |  | IN BOOL | fHResultString
 | ) |  |

Definition at line 312 of file ceerror.cpp.

{
    return(ceGetErrorMessageTextEx(hr, fHResultString, NULL));
}

WCHAR const* ceGetErrorMessageText1 | ( | IN HRESULT | hr,
 |  | IN BOOL | fHResultString,
 |  | IN OPTIONAL WCHAR const * | pwszInsertionText
 | ) |  |

Definition at line 321 of file ceerror.cpp.

{
    WCHAR const *apwszInsertionText[2];
    WCHAR const * const *papwsz = NULL;

    if (NULL != pwszInsertionText)
    {
  apwszInsertionText[0] = pwszInsertionText;
  apwszInsertionText[1] = NULL;
  papwsz = apwszInsertionText;
    }
    return(ceGetErrorMessageTextEx(hr, fHResultString, papwsz));
}

WCHAR const* ceGetErrorMessageTextEx | ( | IN HRESULT | hr,
 |  | IN BOOL | fHResultString,
 |  | IN OPTIONAL WCHAR const *const * | papwszInsertionText
 | ) |  |

Definition at line 340 of file ceerror.cpp.

{
    WCHAR const *pwszRet = NULL;
    WCHAR const *pwszRetStatic = NULL;
    WCHAR *pwszMsgT;
    WCHAR awchr[cwcHRESULTSTRING];
    DWORD cwc;
    DWORD cwcCopy;
    DWORD cwcUnexpected;
    WCHAR const *pwszUnexpected = NULL;
    WCHAR wszEmpty[] = L"";
    HMODULE hMod1 = NULL;
    HMODULE hMod2 = NULL;

    if (E_UNEXPECTED == hr)
    {
  pwszUnexpected = L"Unexpected method call sequence.";
    }
#if (0 == i386)
    else if (STATUS_DATATYPE_MISALIGNMENT == hr)
    {
  pwszUnexpected = L"Possible data alignment fault.";
    }
#endif
    if (NULL == pwszUnexpected)
    {
  pwszUnexpected = wszEmpty;
    }
    cwcUnexpected = wcslen(pwszUnexpected);

    cwc = errFormatMessage(NULL, hr, &pwszRet, papwszInsertionText);
    if (0 == cwc && ISDELAYLOADHRESULTFACILITY(hr))
    {
  cwc = errFormatMessage(
      NULL,
      WIN32ERROR_FROM_DELAYLOAD(hr),
      &pwszRet,
      papwszInsertionText);
    }
    if (0 == cwc)
    {
        hMod1 = LoadLibrary(L"ntdsbmsg.dll");
        if (NULL != hMod1)
        {
            HRESULT hrEDB = hr;
            HRESULT hrFormat;
            BOOL fFirst = TRUE;

            while (TRUE)
            {
                cwc = errFormatMessage(hMod1, hrEDB, &pwszRet, papwszInsertionText);
                if (0 == cwc && FAILED(hrEDB) && fFirst)
                {
                    hrFormat = ceHLastError();
                    if (HRESULT_FROM_WIN32(ERROR_MR_MID_NOT_FOUND) == hrFormat)
                    {
                        hrEDB = ceJetHResult(hrEDB);
                        if (hrEDB != hr)
                        {
                            fFirst = FALSE;
                            continue;
                        }
                    }
                }
                break;
            }
        }
    }
    if (0 == cwc)
    {
  HMODULE hModT = GetModuleHandle(L"wininet.dll");
        if (NULL != hModT)
        {
            HRESULT hrHttp = hr;
            HRESULT hrFormat;
            BOOL fFirst = TRUE;

            while (TRUE)
            {
    cwc = errFormatMessage(hModT, hrHttp, &pwszRet, papwszInsertionText);
                if (0 == cwc && ISWIN32HRESULT(hrHttp) && fFirst)
                {
                    hrFormat = ceHLastError();
                    if (HRESULT_FROM_WIN32(ERROR_MR_MID_NOT_FOUND) == hrFormat)
                    {
      hrHttp = WIN32ERROR_FROM_HRESULT(hrHttp);
                        if (hrHttp != hr)
                        {
                            fFirst = FALSE;
                            continue;
                        }
                    }
                }
                break;
            }
        }
    }
    if (0 == cwc)
    {
        hMod2 = LoadLibrary(L"cdosys.dll");
        if (NULL != hMod2)
        {
      cwc = errFormatMessage(hMod2, hr, &pwszRet, papwszInsertionText);
        }
    }

    if (0 == cwc) // couldn't find error, use default & error code
    {
  fHResultString = TRUE;
    }
    awchr[0] = L'\0';
    if (fHResultString)
    {
  ceHResultToString(awchr, hr);
    }

    if (0 == cwc)
    {
  pwszRetStatic = L"Error";
  pwszRet = pwszRetStatic;
    }

    // strip trailing \r\n

    cwcCopy = wcslen(pwszRet);
    if (2 <= cwcCopy &&
  L'\r' == pwszRet[cwcCopy - 2] &&
  L'\n' == pwszRet[cwcCopy - 1])
    {
  cwcCopy -= 2;
    }
    cwc = cwcCopy + 1 + cwcUnexpected + 1 + wcslen(awchr) + 1;
    pwszMsgT = (WCHAR *) LocalAlloc(LMEM_FIXED, cwc * sizeof(WCHAR));
    if (NULL == pwszMsgT)
    {
  _JumpError(E_OUTOFMEMORY, error, "LocalAlloc");
    }
    CopyMemory(pwszMsgT, pwszRet, cwcCopy * sizeof(WCHAR));
    pwszMsgT[cwcCopy] = L'\0';

    if (0 != cwcUnexpected)
    {
  wcscat(pwszMsgT, L" ");
  wcscat(pwszMsgT, pwszUnexpected);
    }
    if (fHResultString)
    {
  wcscat(pwszMsgT, L" ");
  wcscat(pwszMsgT, awchr);
    }
    assert(wcslen(pwszMsgT) < cwc);
    if (NULL != pwszRet && pwszRetStatic != pwszRet)
    {
  LocalFree(const_cast<WCHAR *>(pwszRet));
    }
    pwszRet = pwszMsgT;

error:
    if (NULL != hMod1)
    {
        FreeLibrary(hMod1);
    }
    if (NULL != hMod2)
    {
        FreeLibrary(hMod2);
    }
    return(pwszRet);
}

HRESULT ceHExceptionCode ( IN EXCEPTION_POINTERS const * pep )

Definition at line 153 of file ceerror.cpp.

{
    HRESULT hr = pep->ExceptionRecord->ExceptionCode;

#if (0 == i386)
    if ((HRESULT) STATUS_DATATYPE_MISALIGNMENT == hr)
    {
  hr = CERTSRV_E_ALIGNMENT_FAULT;
    }
#endif
    return(ceHError(hr));
}

WCHAR const* ceHResultToString | ( | IN OUT WCHAR * | awchr,
 |  | IN HRESULT | hr
 | ) |  |

Definition at line 239 of file ceerror.cpp.

{
    return(ceHResultToStringEx(awchr, hr, FALSE));
}

WCHAR const* ceHResultToStringEx | ( | IN OUT WCHAR * | awchr,
 |  | IN HRESULT | hr,
 |  | IN BOOL | fRaw
 | ) |  |

Definition at line 179 of file ceerror.cpp.

{
    HRESULT hrd;
    WCHAR const *pwszType;

    hrd = hr;
    pwszType = L"";
    if (ISJETERROR(hr))
    {
        pwszType = wszJETERRORPREFIX wszCOLONSPACE;
    }
    else if (ISJETHRESULT(hr))
    {
        hrd = JETERROR_FROM_HRESULT(hr);
        pwszType = wszJETERRORPREFIX wszCOLONSPACE;
    }
    else if (ISOSSERROR(hr))
    {
        hrd = OSSERROR_FROM_HRESULT(hr);
        pwszType = wszOSSERRORPREFIX wszCOLONSPACE;
    }
    else if (ISHTTPHRESULT(hr) || ISHTTPERROR(hr))
    {
        hrd = WIN32ERROR_FROM_HRESULT(hr);
        pwszType = wszWIN32ERRORPREFIX L"/" wszHTTPERRORPREFIX wszCOLONSPACE;
    }
    else if (ISWIN32HRESULT(hr) || ISWIN32ERROR(hr))
    {
        hrd = WIN32ERROR_FROM_HRESULT(hr);
        pwszType = wszWIN32ERRORPREFIX wszCOLONSPACE;
    }
    else if (ISDELAYLOADHRESULTFACILITY(hr))
    {
        hrd = WIN32ERROR_FROM_DELAYLOAD(hr);
        pwszType = wszWIN32ERRORPREFIX wszCOLONSPACE;
    }
    else if (ISSETUPHRESULT(hr))
    {
        pwszType = wszSETUPERRORPREFIX wszCOLONSPACE;
    }
    if (fRaw)
    {
        pwszType = L"";
    }

    _snwprintf(
        awchr,
        cwcHRESULTSTRING,
        L"0x%x (%ws%d)",
        hr,
        pwszType,
        hrd);
    return(awchr);
}

WCHAR const* ceHResultToStringRaw | ( | IN OUT WCHAR * | awchr,
 |  | IN HRESULT | hr
 | ) |  |

Definition at line 248 of file ceerror.cpp.

{
    return(ceHResultToStringEx(awchr, hr, TRUE));
}

VOID ceInitErrorMessageText | ( | IN HMODULE | hMod,
 |  | IN DWORD | idsUnexpected,
 |  | IN DWORD | idsUnknownErrorCode
 | ) |  |

Definition at line 261 of file ceerror.cpp.

{
    s_hMod = hMod;
    s_idsUnexpected = idsUnexpected;
    s_idsUnknownErrorCode = idsUnknownErrorCode;
}

BOOL ceIsDelayLoadHResult ( IN HRESULT hr )

Definition at line 169 of file ceerror.cpp.

{
    return(ISDELAYLOADHRESULT(hr));
}

HRESULT ceJetHResult ( IN HRESULT hr )

Definition at line 124 of file ceerror.cpp.

{
    if (S_OK != hr)
    {
        if (SUCCEEDED(hr))
        {
#if 0
            hr = HRESULT_FROM_JETWARNING(hr);
#else
            if (S_FALSE != hr)
            {
                _PrintError(hr, "JetHResult: mapping to S_FALSE");
            }
            assert(S_FALSE == hr);
            hr = S_FALSE;
#endif
        }
        else if (ISJETERROR(hr))
        {
            hr = HRESULT_FROM_JETERROR(hr);
        }
    }
    assert(S_OK == hr || S_FALSE == hr || FAILED(hr));
    return(hr);
}

DWORD errFormatMessage | ( | IN HMODULE | hMod,
 |  | IN HRESULT | hr,
 |  | OUT WCHAR const ** | ppwszOut,
 |  | OPTIONAL IN WCHAR const *const * | ppwszArgs
 | ) |  |

Definition at line 273 of file ceerror.cpp.

{
    DWORD dwFlags;

    dwFlags = FORMAT_MESSAGE_ALLOCATE_BUFFER;
    if (NULL == hMod)
    {
  dwFlags |= FORMAT_MESSAGE_FROM_SYSTEM;
    }
    else
    {
  dwFlags |= FORMAT_MESSAGE_FROM_HMODULE;
    }
    if (NULL == ppwszArgs || NULL == ppwszArgs[0])
    {
  dwFlags |= FORMAT_MESSAGE_IGNORE_INSERTS;
    }
    else
    {
  dwFlags |= FORMAT_MESSAGE_ARGUMENT_ARRAY;
    }
    return(FormatMessage(
    dwFlags,
                hMod,
                hr,
                MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
                (WCHAR *) ppwszOut,
                1,
    (va_list *) ppwszArgs));
}

Generated on Wed Nov 13 2024 16:54:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Exit/C++/Windows.Net/celib.cpp File Reference

  • Security
  • CertServices
  • Exit
  • C++
  • Windows.Net
Classes | Defines | Typedefs | Functions | Variables

celib.cpp File Reference

#include "pch.cpp"
#include "celib.h"
#include <assert.h>

Go to the source code of this file.

Classes

struct | _UNITSTABLE

Defines

#define | CUNITSTABLEMAX (sizeof(g_aut)/sizeof(g_aut[0]))

Typedefs

typedef struct _UNITSTABLE | UNITSTABLE

Functions

HRESULT | _IsConfigLocal (IN WCHAR const *pwszConfig, IN WCHAR const *pwszDnsName, IN WCHAR const *pwszOldName, OPTIONAL OUT WCHAR **ppwszMachine, OUT BOOL *pfLocal)
HRESULT | ceBuildPathAndExt (IN WCHAR const *pwszDir, IN WCHAR const *pwszFile, OPTIONAL IN WCHAR const *pwszExt, OUT WCHAR **ppwszPath)
BOOL | ceConvertSzToBstr (OUT BSTR *pbstr, IN CHAR const *pch, IN LONG cch)
BOOL | ceConvertSzToWsz (OUT WCHAR **ppwsz, IN char const *pch, IN LONG cch)
BOOL | ceConvertWszToBstr (OUT BSTR *pbstr, IN WCHAR const *pwc, IN LONG cb)
BOOL | ceConvertWszToSz (OUT CHAR **ppsz, IN WCHAR const *pwc, IN LONG cwc)
HRESULT | ceDateToFileTime (IN DATE const *pDate, OUT FILETIME *pft)
BOOL | ceDecodeObject (IN DWORD dwEncodingType, IN LPCSTR lpszStructType, IN BYTE const *pbEncoded, IN DWORD cbEncoded, IN BOOL fCoTaskMemAlloc, OUT VOID **ppvStructInfo, OUT DWORD *pcbStructInfo)
HRESULT | ceDispatchSetErrorInfo (IN HRESULT hrError, IN WCHAR const *pwszDescription, OPTIONAL IN WCHAR const *pwszProgId, OPTIONAL IN IID const *piid)
HRESULT | ceDispatchSetErrorInfoSub (IN HRESULT hrError, OPTIONAL IN WCHAR const *pwszIDispatchMethod, OPTIONAL IN WCHAR const *pwszDescription, OPTIONAL IN WCHAR const *pwszSource, OPTIONAL IN IID const *piid, OPTIONAL IN WCHAR const *pwszHelpFile, IN DWORD dwHelpFileContext)
WCHAR * | ceDuplicateString (IN WCHAR const *pwsz)
BOOL | ceEncodeObject (IN DWORD dwEncodingType, IN LPCSTR lpszStructType, IN VOID const *pvStructInfo, IN DWORD dwFlags, IN BOOL fCoTaskMemAlloc, OUT BYTE **ppbEncoded, OUT DWORD *pcbEncoded)
VOID | ceErrorPrintLine (IN char const *pszFile, IN DWORD line, IN char const *pszMessage, IN WCHAR const *pwszData, IN HRESULT hr)
HRESULT | ceFileTimeToDate (IN FILETIME const *pft, OUT DATE *pDate)
VOID | ceFreeBstr (IN OUT BSTR *pstr)
HRESULT | ceGetComputerNames (OUT WCHAR **ppwszDnsName, OUT WCHAR **ppwszOldName)
HRESULT | ceGetMachineDnsName (OUT WCHAR **ppwszDnsName)
WCHAR const * | ceGetOIDName (IN WCHAR const *pwszObjId)
WCHAR const * | ceGetOIDNameA (IN char const *pszObjId)
HRESULT | ceHError (IN HRESULT hr)
HRESULT | ceHLastError (VOID)
HRESULT | ceIsConfigLocal (IN WCHAR const *pwszConfig, OPTIONAL OUT WCHAR **ppwszMachine, OUT BOOL *pfLocal)
int | celstrcmpiL (IN WCHAR const *pwsz1, IN WCHAR const *pwsz2)
HRESULT | ceMakeExprDate (IN OUT DATE *pDate, IN LONG lDelta, IN enum ENUM_PERIOD enumPeriod)
VOID | ceMakeExprDateTime (IN OUT FILETIME *pft, IN LONG lDelta, IN enum ENUM_PERIOD enumPeriod)
HRESULT | ceTranslatePeriodUnits (IN WCHAR const *pwszPeriod, IN LONG lCount, OUT enum ENUM_PERIOD *penumPeriod, OUT LONG *plCount)
HRESULT | ceVerifyAltNameString (IN LONG NameChoice, IN BSTR strName)
HRESULT | ceVerifyObjId (IN WCHAR const *pwszObjId)
HRESULT | ceVerifyObjIdA (IN CHAR const *pszObjId)
int | ceWtoI (IN WCHAR const *string, OUT BOOL *pfValid)

Variables

UNITSTABLE g_aut []

Define Documentation

#define CUNITSTABLEMAX (sizeof(g_aut)/sizeof(g_aut[0]))

Definition at line 656 of file celib.cpp.

Typedef Documentation

typedef struct _UNITSTABLE UNITSTABLE

Function Documentation

HRESULT _IsConfigLocal | ( | IN WCHAR const * | pwszConfig,
 |  | IN WCHAR const * | pwszDnsName,
 |  | IN WCHAR const * | pwszOldName,
 |  | OPTIONAL OUT WCHAR ** | ppwszMachine,
 |  | OUT BOOL * | pfLocal
 | ) |  |

Definition at line 1243 of file celib.cpp.

{
    HRESULT hr;
    WCHAR *pwszMachine = NULL;
    WCHAR const *pwsz;
    DWORD cwc;

    *pfLocal = FALSE;
    if (NULL != ppwszMachine)
    {
  *ppwszMachine = NULL;
    }

    while (L'\\' == *pwszConfig)
    {
  pwszConfig++;
    }
    pwsz = wcschr(pwszConfig, L'\\');
    if (NULL != pwsz)
    {
  cwc = SAFE_SUBTRACT_POINTERS(pwsz, pwszConfig);
    }
    else
    {
  cwc = wcslen(pwszConfig);
    }
    pwszMachine = (WCHAR *) LocalAlloc(LMEM_FIXED, (cwc + 1) * sizeof(WCHAR));
    if (NULL == pwszMachine)
    {
  hr = E_OUTOFMEMORY;
  _JumpError(hr, error, "LocalAlloc");
    }
    CopyMemory(pwszMachine, pwszConfig, cwc * sizeof(WCHAR));
    pwszMachine[cwc] = L'\0';

    if (0 == celstrcmpiL(pwszMachine, pwszDnsName) ||
  0 == celstrcmpiL(pwszMachine, pwszOldName))
    {
  *pfLocal = TRUE;
    }
    if (NULL != ppwszMachine)
    {
  *ppwszMachine = pwszMachine;
  pwszMachine = NULL;
    }
    hr = S_OK;

error:
    if (NULL != pwszMachine)
    {
  LocalFree(pwszMachine);
    }
    return(hr);
}

HRESULT ceBuildPathAndExt | ( | IN WCHAR const * | pwszDir,
 |  | IN WCHAR const * | pwszFile,
 |  | OPTIONAL IN WCHAR const * | pwszExt,
 |  | OUT WCHAR ** | ppwszPath
 | ) |  |

Definition at line 1345 of file celib.cpp.

{
    HRESULT hr;
    WCHAR *pwsz;
    DWORD cwc;

    *ppwszPath = NULL;
    cwc = wcslen(pwszDir) + 1 + wcslen(pwszFile) + 1;
    if (NULL != pwszExt)
    {
  cwc += wcslen(pwszExt);
    }

    pwsz = (WCHAR *) LocalAlloc(LMEM_FIXED, cwc * sizeof(WCHAR));
    if (NULL == pwsz)
    {
  hr = E_OUTOFMEMORY;
  _JumpError(hr, error, "LocalAlloc");
    }
    wcscpy(pwsz, pwszDir);
    if (L'\\' != pwsz[wcslen(pwsz) - 1])
    {
  wcscat(pwsz, L"\\");
    }
    wcscat(pwsz, pwszFile);
    if (NULL != pwszExt)
    {
  wcscat(pwsz, pwszExt);
    }
    *ppwszPath = pwsz;
    hr = S_OK;

error:
    return(hr);
}

BOOL ceConvertSzToBstr | ( | OUT BSTR * | pbstr,
 |  | IN CHAR const * | pch,
 |  | IN LONG | cch
 | ) |  |

Definition at line 336 of file celib.cpp.

{
    BOOL fOk = FALSE;
    BSTR bstr = NULL;
    LONG cwc = 0;

    ceFreeBstr(pbstr);
    if (-1 == cch)
    {
  cch = strlen(pch);
    }
    while (TRUE)
    {
  cwc = MultiByteToWideChar(GetACP(), 0, pch, cch, bstr, cwc);
  if (0 >= cwc)
  {
      //hr = ceHLastError();
      //printf("MultiByteToWideChar returned %d (%x)\n", hr, hr);
      break;
  }
  if (NULL != bstr)
  {
      bstr[cwc] = L'\0';
      *pbstr = bstr;
      fOk = TRUE;
      break;
  }
  bstr = SysAllocStringLen(NULL, cwc);
  if (NULL == bstr)
  {
      break;
  }
    }
    return(fOk);
}

BOOL ceConvertSzToWsz | ( | OUT WCHAR ** | ppwsz,
 |  | IN char const * | pch,
 |  | IN LONG | cch
 | ) |  |

Definition at line 295 of file celib.cpp.

{
    BOOL fOk = FALSE;
    LONG cwc = 0;

    *ppwsz = NULL;
    while (TRUE)
    {
  cwc = MultiByteToWideChar(GetACP(), 0, pch, cch, *ppwsz, cwc);
  if (0 >= cwc)
  {
      DWORD err;

      err = GetLastError();
      ceERRORPRINTLINE("MultiByteToWideChar", err);
      if (NULL != *ppwsz)
      {
    LocalFree(*ppwsz);
    *ppwsz = NULL;
      }
      break;
  }
  if (NULL != *ppwsz)
  {
      fOk = TRUE;
      break;
  }
  *ppwsz = (WCHAR *) LocalAlloc(LMEM_FIXED, (cwc + 1) * sizeof(WCHAR));
  if (NULL == *ppwsz)
  {
      break;
  }
    }
    return(fOk);
}

BOOL ceConvertWszToBstr | ( | OUT BSTR * | pbstr,
 |  | IN WCHAR const * | pwc,
 |  | IN LONG | cb
 | ) |  |

Definition at line 263 of file celib.cpp.

{
    BOOL fOk = FALSE;
    BSTR bstr;

    ceFreeBstr(pbstr);
    do
    {
  bstr = NULL;
  if (NULL != pwc)
  {
      if (-1 == cb)
      {
    cb = wcslen(pwc) * sizeof(WCHAR);
      }
      bstr = SysAllocStringByteLen((char const *) pwc, cb);
      if (NULL == bstr)
      {
    break;
      }
  }
  *pbstr = bstr;
  fOk = TRUE;
    } while (FALSE);
    return(fOk);
}

BOOL ceConvertWszToSz | ( | OUT CHAR ** | ppsz,
 |  | IN WCHAR const * | pwc,
 |  | IN LONG | cwc
 | ) |  |

Definition at line 214 of file celib.cpp.

{
    BOOL fOk = FALSE;
    LONG cch = 0;

    *ppsz = NULL;
    while (TRUE)
    {
  cch = WideCharToMultiByte(
      GetACP(),
      0,          // dwFlags
      pwc,
      cwc,        // cchWideChar, -1 => null terminated
      *ppsz,
      cch,
      NULL,
      NULL);
  if (0 >= cch)
  {
      DWORD err;

      err = GetLastError();
      ceERRORPRINTLINE("WideCharToMultiByte", err);
      if (NULL != *ppsz)
      {
    LocalFree(*ppsz);
    *ppsz = NULL;
      }
      break;
  }
  if (NULL != *ppsz)
  {
      fOk = TRUE;
      break;
  }
  *ppsz = (CHAR *) LocalAlloc(LMEM_FIXED, cch + 1);
  if (NULL == *ppsz)
  {
      break;
  }
    }
    return(fOk);
}

HRESULT ceDateToFileTime | ( | IN DATE const * | pDate,
 |  | OUT FILETIME * | pft
 | ) |  |

Definition at line 450 of file celib.cpp.

{
    SYSTEMTIME st;
    HRESULT hr = S_OK;

    if (*pDate == 0.0)
    {
        GetSystemTime(&st);
    }
    else
    {
  if (!VariantTimeToSystemTime(*pDate, &st))
  {
      hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
      _JumpError(hr, error, "VariantTimeToSystemTime");
  }
    }

    if (!SystemTimeToFileTime(&st, pft))
    {
        hr = ceHLastError();
        _JumpError(hr, error, "SystemTimeToFileTime");
    }

error:
    return(hr);
}

BOOL ceDecodeObject | ( | IN DWORD | dwEncodingType,
 |  | IN LPCSTR | lpszStructType,
 |  | IN BYTE const * | pbEncoded,
 |  | IN DWORD | cbEncoded,
 |  | IN BOOL | fCoTaskMemAlloc,
 |  | OUT VOID ** | ppvStructInfo,
 |  | OUT DWORD * | pcbStructInfo
 | ) |  |

Definition at line 27 of file celib.cpp.

{
    BOOL b;

    assert(!fCoTaskMemAlloc);
    *ppvStructInfo = NULL;
    *pcbStructInfo = 0;
    while (TRUE)
    {
  b = CryptDecodeObject(
        dwEncodingType,
        lpszStructType,
        pbEncoded,
        cbEncoded,
        0,                  // dwFlags
        *ppvStructInfo,
        pcbStructInfo);
  if (b && 0 == *pcbStructInfo)
  {
      SetLastError((DWORD) HRESULT_FROM_WIN32(ERROR_INVALID_DATA));
      b = FALSE;
  }
  if (!b)
  {
      if (NULL != *ppvStructInfo)
      {
    HRESULT hr = GetLastError();

    LocalFree(*ppvStructInfo);
    *ppvStructInfo = NULL;
    SetLastError(hr);
      }
      break;
  }
  if (NULL != *ppvStructInfo)
  {
      break;
  }
  *ppvStructInfo = (BYTE *) LocalAlloc(LMEM_FIXED, *pcbStructInfo);
  if (NULL == *ppvStructInfo)
  {
      b = FALSE;
      break;
  }
    }
    return(b);
}

HRESULT ceDispatchSetErrorInfo | ( | IN HRESULT | hrError,
 |  | IN WCHAR const * | pwszDescription,
 |  | OPTIONAL IN WCHAR const * | pwszProgId,
 |  | OPTIONAL IN IID const * | piid
 | ) |  |

Definition at line 997 of file celib.cpp.

{
    HRESULT hr;
    WCHAR const *pwszError = NULL;
    WCHAR *pwszText = NULL;

    if (NULL == pwszDescription)
    {
        hr = E_POINTER;
  _JumpError(hr, error, "NULL pointer");
    }
    assert(FAILED(hrError));
    pwszError = ceGetErrorMessageText(hrError, TRUE);
    if (NULL == pwszError)
    {
  _PrintError(E_OUTOFMEMORY, "myGetErrorMessageText");
    }
    else
    {
  pwszText = (WCHAR *) LocalAlloc(
      LMEM_FIXED,
      (wcslen(pwszDescription) + 1 + wcslen(pwszError) + 1) *
       sizeof(WCHAR));
  if (NULL == pwszText)
  {
      _PrintError(E_OUTOFMEMORY, "LocalAlloc");
  }
  else
  {
      wcscpy(pwszText, pwszDescription);
      wcscat(pwszText, L" ");
      wcscat(pwszText, pwszError);
  }
    }
    hr = ceDispatchSetErrorInfoSub(
      hrError,
      NULL,   // pwszIDispatchMethod
      NULL != pwszText?
          pwszText : const_cast<WCHAR *>(pwszDescription),
      pwszProgId,
      piid,
      NULL,   // pwszHelpFile
      0);   // dwHelpFileContext
    _PrintIfError(hr, "ceDispatchSetErrorInfoSub");

error:
    if (NULL != pwszText)
    {
  LocalFree(pwszText);
    }
    if (NULL != pwszError)
    {
  LocalFree(const_cast<WCHAR *>(pwszError));
    }
    return(hrError);  // return input error!
}

HRESULT ceDispatchSetErrorInfoSub | ( | IN HRESULT | hrError,
 |  | OPTIONAL IN WCHAR const * | pwszIDispatchMethod,
 |  | OPTIONAL IN WCHAR const * | pwszDescription,
 |  | OPTIONAL IN WCHAR const * | pwszSource,
 |  | OPTIONAL IN IID const * | piid,
 |  | OPTIONAL IN WCHAR const * | pwszHelpFile,
 |  | IN DWORD | dwHelpFileContext
 | ) |  |

Definition at line 924 of file celib.cpp.

{
    HRESULT hr;
    WCHAR const *pwszError = NULL;
    ICreateErrorInfo *pCreateErrorInfo = NULL;
    IErrorInfo *pErrorInfo = NULL;

    if (NULL != pwszIDispatchMethod)
    {
  pwszError = ceGetErrorMessageText(hrError, TRUE);
    }

    hr = CreateErrorInfo(&pCreateErrorInfo);
    _JumpIfError(hr, error, "CreateErrorInfo");

    if (NULL != piid)
    {
  hr = pCreateErrorInfo->SetGUID(*piid);
  _PrintIfError(hr, "SetGUID");
    }
    if (NULL != pwszSource)
    {
  hr = pCreateErrorInfo->SetSource(const_cast<WCHAR *>(pwszSource));
  _PrintIfError(hr, "SetSource");
    }
    if (NULL != pwszDescription)
    {
  hr = pCreateErrorInfo->SetDescription(
          const_cast<WCHAR *>(pwszDescription));
  _PrintIfError(hr, "SetDescription");
    }
    if (NULL != pwszHelpFile)
    {
  hr = pCreateErrorInfo->SetHelpFile(const_cast<WCHAR *>(pwszHelpFile));
  _PrintIfError(hr, "SetHelpFile");

  hr = pCreateErrorInfo->SetHelpContext(dwHelpFileContext);
  _PrintIfError(hr, "SetHelpContext");
    }

    hr = pCreateErrorInfo->QueryInterface(
            IID_IErrorInfo,
            (VOID **) &pErrorInfo);
    _JumpIfError(hr, error, "QueryInterface");

    SetErrorInfo(0, pErrorInfo);
    hr = S_OK;

error:
    if (NULL != pwszError)
    {
  LocalFree(const_cast<WCHAR *>(pwszError));
    }
    if (NULL != pErrorInfo)
    {
  pErrorInfo->Release();
    }
    if (NULL != pCreateErrorInfo)
    {
  pCreateErrorInfo->Release();
    }
    return(hr);
}

WCHAR* ceDuplicateString ( IN WCHAR const * pwsz )

Definition at line 197 of file celib.cpp.

{
    WCHAR *pwszOut;

    pwszOut = (WCHAR *) LocalAlloc(
        LMEM_FIXED,
        (wcslen(pwsz) + 1) * sizeof(pwsz[0]));
    if (NULL != pwszOut)
    {
  wcscpy(pwszOut, pwsz);
    }
    return(pwszOut);
}

BOOL ceEncodeObject | ( | IN DWORD | dwEncodingType,
 |  | IN LPCSTR | lpszStructType,
 |  | IN VOID const * | pvStructInfo,
 |  | IN DWORD | dwFlags,
 |  | IN BOOL | fCoTaskMemAlloc,
 |  | OUT BYTE ** | ppbEncoded,
 |  | OUT DWORD * | pcbEncoded
 | ) |  |

Definition at line 87 of file celib.cpp.

{
    BOOL b;

    assert(0 == dwFlags);
    assert(!fCoTaskMemAlloc);
    *ppbEncoded = NULL;
    *pcbEncoded = 0;
    while (TRUE)
    {
  b = CryptEncodeObject(
        dwEncodingType,
        lpszStructType,
        const_cast<VOID *>(pvStructInfo),
        *ppbEncoded,
        pcbEncoded);
  if (b && 0 == *pcbEncoded)
  {
      SetLastError((DWORD) HRESULT_FROM_WIN32(ERROR_INVALID_DATA));
      b = FALSE;
  }
  if (!b)
  {
      if (NULL != *ppbEncoded)
      {
    HRESULT hr = GetLastError();

    LocalFree(*ppbEncoded);
    *ppbEncoded = NULL;
    SetLastError(hr);
      }
      break;
  }
  if (NULL != *ppbEncoded)
  {
      break;
  }
  *ppbEncoded = (BYTE *) LocalAlloc(LMEM_FIXED, *pcbEncoded);
  if (NULL == *ppbEncoded)
  {
      b = FALSE;
      break;
  }
    }
    return(b);
}

VOID ceErrorPrintLine | ( | IN char const * | pszFile,
 |  | IN DWORD | line,
 |  | IN char const * | pszMessage,
 |  | IN WCHAR const * | pwszData,
 |  | IN HRESULT | hr
 | ) |  |

Definition at line 416 of file celib.cpp.

{
    CHAR ach[4096];
    LONG cch;

#pragma prefast(disable:53, "PREfast bug 650")
    cch = _snprintf(
    ach,
    sizeof(ach),
    "CeLib: Error: %hs(%u): %hs%hs%ws%hs 0x%x (%d)\n",
    pszFile,
    line,
    pszMessage,
    NULL == pwszData? "" : szLPAREN,
    NULL == pwszData? L"" : pwszData,
    NULL == pwszData? "" : szRPAREN,
    hr,
    hr);
#pragma prefast(enable:53, "re-enable")
    if (0 > cch || sizeof(ach) <= cch)
    {
  strcpy(&ach[sizeof(ach) - 5], "...\n");
    }
    OutputDebugStringA(ach);
    wprintf(L"%hs", ach);
}

HRESULT ceFileTimeToDate | ( | IN FILETIME const * | pft,
 |  | OUT DATE * | pDate
 | ) |  |

Definition at line 482 of file celib.cpp.

{
    SYSTEMTIME st;
    HRESULT hr = S_OK;

    if (!FileTimeToSystemTime(pft, &st))
    {
        hr = ceHLastError();
        _JumpError(hr, error, "FileTimeToSystemTime");
    }
    if (!SystemTimeToVariantTime(&st, pDate))
    {
        hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
        _JumpError(hr, error, "SystemTimeToVariantTime");
    }

error:
    return(hr);
}

VOID ceFreeBstr ( IN OUT BSTR * pstr )

Definition at line 377 of file celib.cpp.

{
    if (NULL != *pstr)
    {
  SysFreeString(*pstr);
  *pstr = NULL;
    }
}

HRESULT ceGetComputerNames | ( | OUT WCHAR ** | ppwszDnsName,
 |  | OUT WCHAR ** | ppwszOldName
 | ) |  |

Definition at line 1203 of file celib.cpp.

{
    HRESULT hr;
    DWORD cwc;
    WCHAR *pwszOldName = NULL;

    *ppwszOldName = NULL;
    *ppwszDnsName = NULL;

    cwc = MAX_COMPUTERNAME_LENGTH + 1;
    pwszOldName = (WCHAR *) LocalAlloc(LMEM_FIXED, cwc * sizeof(WCHAR));
    if (NULL == pwszOldName)
    {
      hr = E_OUTOFMEMORY;
      _JumpError(hr, error, "LocalAlloc");
    }
    if (!GetComputerName(pwszOldName, &cwc))
    {
        hr = ceHLastError();
        _JumpError(hr, error, "GetComputerName");
    }

    hr = ceGetMachineDnsName(ppwszDnsName);
    _JumpIfError(hr, error, "ceGetMachineDnsName");

    *ppwszOldName = pwszOldName;
    pwszOldName = NULL;

error:
    if (NULL != pwszOldName)
    {
  LocalFree(pwszOldName);
    }
    return(hr);
}

HRESULT ceGetMachineDnsName ( OUT WCHAR ** ppwszDnsName )

Definition at line 1147 of file celib.cpp.

{
    HRESULT hr;
    WCHAR *pwszDnsName = NULL;
    DWORD cwc;
    COMPUTER_NAME_FORMAT NameType = ComputerNameDnsFullyQualified;

    *ppwszDnsName = NULL;
    while (TRUE)
    {
  cwc = 0;
  if (!GetComputerNameEx(NameType, NULL, &cwc))
  {
      hr = ceHLastError();
      if (HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) == hr &&
    ComputerNameDnsFullyQualified == NameType)
      {
    _PrintError(hr, "GetComputerNameEx(DnsFullyQualified) -- switching to NetBIOS");
    NameType = ComputerNameNetBIOS;
    continue;
      }
      if (HRESULT_FROM_WIN32(ERROR_MORE_DATA) != hr)
      {
    _JumpError(hr, error, "GetComputerNameEx");
      }
      break;
  }
    }
    pwszDnsName = (WCHAR *) LocalAlloc(LMEM_FIXED, cwc * sizeof(WCHAR));
    if (NULL == pwszDnsName)
    {
  hr = E_OUTOFMEMORY;
  _JumpError(hr, error, "LocalAlloc");
    }

    if (!GetComputerNameEx(NameType, pwszDnsName, &cwc))
    {
  hr = ceHLastError();
  _JumpError(hr, error, "GetComputerNameEx");
    }

    *ppwszDnsName = pwszDnsName;
    pwszDnsName = NULL;
    hr = S_OK;

error:
    if (NULL != pwszDnsName)
    {
  LocalFree(pwszDnsName);
    }
    return(hr);
}

WCHAR const* ceGetOIDName ( IN WCHAR const * pwszObjId )

Definition at line 175 of file celib.cpp.

{
    char *pszObjId = NULL;
    WCHAR const *pwszName = L"";

    if (!ceConvertWszToSz(&pszObjId, pwszObjId, -1))
    {
  _JumpError(E_OUTOFMEMORY, error, "ceConvertWszToSz");
    }
    pwszName = ceGetOIDNameA(pszObjId);

error:
    if (NULL != pszObjId)
    {
  LocalFree(pszObjId);
    }
    return(pwszName);
}

WCHAR const* ceGetOIDNameA ( IN char const * pszObjId )

Definition at line 147 of file celib.cpp.

{
    CRYPT_OID_INFO const *pInfo = NULL;
    WCHAR const *pwszName = L"";

    // First try looking up the ObjectId as an Extension or Attribute, because
    // we get a better Display Name, especially for Subject RDNs: CN, L, etc.
    // If that fails, look it up withoput restricting the group.

    pInfo = CryptFindOIDInfo(
      CRYPT_OID_INFO_OID_KEY,
      (VOID *) pszObjId,
      CRYPT_EXT_OR_ATTR_OID_GROUP_ID);

    if (NULL == pInfo || NULL == pInfo->pwszName || L'\0' == pInfo->pwszName[0])
    {
  pInfo = CryptFindOIDInfo(CRYPT_OID_INFO_OID_KEY, (VOID *) pszObjId, 0);
    }
    if (NULL != pInfo && NULL != pInfo->pwszName && L'\0' != pInfo->pwszName[0])
    {
  pwszName = pInfo->pwszName;
    }
    return(pwszName);
}

HRESULT ceHError ( IN HRESULT hr )

Definition at line 389 of file celib.cpp.

{
    assert(S_FALSE != hr);

    if (S_OK != hr && S_FALSE != hr && !FAILED(hr))
    {
        hr = HRESULT_FROM_WIN32(hr);
  if ((HRESULT) 0 == HRESULT_CODE(hr))
  {
      // A call failed without properly setting an error condition!
      hr = E_UNEXPECTED;
  }
  assert(FAILED(hr));
    }
    return(hr);
}

HRESULT ceHLastError ( VOID )

Definition at line 409 of file celib.cpp.

{
    return(ceHError(GetLastError()));
}

HRESULT ceIsConfigLocal | ( | IN WCHAR const * | pwszConfig,
 |  | OPTIONAL OUT WCHAR ** | ppwszMachine,
 |  | OUT BOOL * | pfLocal
 | ) |  |

Definition at line 1305 of file celib.cpp.

{
    HRESULT hr;
    WCHAR *pwszDnsName = NULL;
    WCHAR *pwszOldName = NULL;

    *pfLocal = FALSE;
    if (NULL != ppwszMachine)
    {
  *ppwszMachine = NULL;
    }

    hr = ceGetComputerNames(&pwszDnsName, &pwszOldName);
    _JumpIfError(hr, error, "ceGetComputerNames");

    hr = _IsConfigLocal(
        pwszConfig,
        pwszDnsName,
        pwszOldName,
        ppwszMachine,
        pfLocal);
    _JumpIfError(hr, error, "_IsConfigLocal");

error:
    if (NULL != pwszDnsName)
    {
  LocalFree(pwszDnsName);
    }
    if (NULL != pwszOldName)
    {
  LocalFree(pwszOldName);
    }
    return(hr);
}

int celstrcmpiL | ( | IN WCHAR const * | pwsz1,
 |  | IN WCHAR const * | pwsz2
 | ) |  |

Definition at line 1389 of file celib.cpp.

{
    // CSTR_LESS_THAN(1) - CSTR_EQUAL(2)    == -1 string 1 less than string 2
    // CSTR_EQUAL(2) - CSTR_EQUAL(2)        == 0 string 1 equal to string 2
    // CSTR_GREATER_THAN(3) - CSTR_EQUAL(2) == 1 string 1 greater than string 2

    return(CompareString(
    LOCALE_INVARIANT,
    NORM_IGNORECASE,
    pwsz1,
    -1,
    pwsz2,
    -1) -
      CSTR_EQUAL);
}

HRESULT ceMakeExprDate | ( | IN OUT DATE * | pDate,
 |  | IN LONG | lDelta,
 |  | IN enum ENUM_PERIOD | enumPeriod
 | ) |  |

Definition at line 618 of file celib.cpp.

{
    HRESULT hr;
    FILETIME ft;

    hr = ceDateToFileTime(pDate, &ft);
    _JumpIfError(hr, error, "ceDateToFileTime");

    ceMakeExprDateTime(&ft, lDelta, enumPeriod);

    hr = ceFileTimeToDate(&ft, pDate);
    _JumpIfError(hr, error, "ceFileTimeToDate");

error:
    return(hr);
}

VOID ceMakeExprDateTime | ( | IN OUT FILETIME * | pft,
 |  | IN LONG | lDelta,
 |  | IN enum ENUM_PERIOD | enumPeriod
 | ) |  |

Definition at line 506 of file celib.cpp.

{
    LLFILETIME llft;
    LONGLONG llDelta;
    BOOL fSysTimeDelta;

    llft.ft = *pft;
    llDelta = lDelta;
    fSysTimeDelta = FALSE;
    switch (enumPeriod)
    {
  case ENUM_PERIOD_WEEKS:   llDelta *= CVT_WEEKS;    break;
  case ENUM_PERIOD_DAYS:    llDelta *= CVT_DAYS;     break;
  case ENUM_PERIOD_HOURS:   llDelta *= CVT_HOURS;    break;
  case ENUM_PERIOD_MINUTES: llDelta *= CVT_MINUTES;  break;
  case ENUM_PERIOD_SECONDS:          break;
  default:
      fSysTimeDelta = TRUE;
      break;
    }
    if (fSysTimeDelta)
    {
  SYSTEMTIME SystemTime;

  FileTimeToSystemTime(&llft.ft, &SystemTime);
  switch (enumPeriod)
  {
      case ENUM_PERIOD_MONTHS:
    if (0 > lDelta)
    {
        DWORD dwDelta = (DWORD) -lDelta;

        SystemTime.wYear -= (WORD) (dwDelta / 12) + 1;
        SystemTime.wMonth += 12 - (WORD) (dwDelta % 12);
    }
    else
    {
        SystemTime.wMonth = (WORD) lDelta + SystemTime.wMonth;
    }
    if (12 < SystemTime.wMonth)
    {
        SystemTime.wYear += (SystemTime.wMonth - 1) / 12;
        SystemTime.wMonth = ((SystemTime.wMonth - 1) % 12) + 1;
    }
    break;

      case ENUM_PERIOD_YEARS:
    SystemTime.wYear = (WORD) lDelta + SystemTime.wYear;
    break;

      default:
    SystemTime.wYear += 1;
    break;
  }

DoConvert:
        if (!SystemTimeToFileTime(&SystemTime, &llft.ft))
        {
            if (GetLastError() != ERROR_INVALID_PARAMETER)
            {
                assert(!"Unable to do time conversion");
                return;
            }

            // In some cases we'll convert to an invalid month-end

            // only one month changes length from year to year
            if (SystemTime.wMonth == 2)
            {
                // > 29? try leap year
                if (SystemTime.wDay > 29)
                {
                    SystemTime.wDay = 29;
                    goto DoConvert;
                }
                // == 29? try non-leap year
                else if (SystemTime.wDay == 29)
                {
                    SystemTime.wDay = 28;
                    goto DoConvert;
                }
            }
            // sept (9), apr(4), jun(6), nov(11) all have 30 days
            else if ((SystemTime.wMonth == 9) ||
                     (SystemTime.wMonth == 4) ||
                     (SystemTime.wMonth == 6) ||
                     (SystemTime.wMonth == 11))
            {
                if (SystemTime.wDay > 30)
                {
                    SystemTime.wDay = 30;
                    goto DoConvert;
                }
            }

            // should never get here
            assert(!"Month/year processing: inaccessible code");
            return;
        }
    }
    else
    {
  llft.ll += llDelta * CVT_BASE;
    }
    *pft = llft.ft;
}

HRESULT ceTranslatePeriodUnits | ( | IN WCHAR const * | pwszPeriod,
 |  | IN LONG | lCount,
 |  | OUT enum ENUM_PERIOD * | penumPeriod,
 |  | OUT LONG * | plCount
 | ) |  |

Definition at line 660 of file celib.cpp.

{
    HRESULT hr;
    UNITSTABLE const *put;

    for (put = g_aut; put < &g_aut[CUNITSTABLEMAX]; put++)
    {
  if (0 == celstrcmpiL(pwszPeriod, put->pwszString))
  {
      *penumPeriod = put->enumPeriod;
      if (0 > lCount)
      {
    lCount = MAXLONG;
      }
      *plCount = lCount;
      hr = S_OK;
      goto error;
  }
    }
    hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);

error:
    return(hr);
}

HRESULT ceVerifyAltNameString | ( | IN LONG | NameChoice,
 |  | IN BSTR | strName
 | ) |  |

Definition at line 832 of file celib.cpp.

{
    HRESULT hr = S_OK;
    CERT_ALT_NAME_INFO AltName;
    CERT_ALT_NAME_ENTRY Entry;
    CERT_OTHER_NAME OtherName;
    char *pszObjectId = NULL;
    DWORD cbEncoded;

    ZeroMemory(&AltName, sizeof(AltName));
    AltName.cAltEntry = 1;
    AltName.rgAltEntry = &Entry;

    ZeroMemory(&Entry, sizeof(Entry));
    Entry.dwAltNameChoice = NameChoice;

    switch (NameChoice)
    {
  case CERT_ALT_NAME_RFC822_NAME:
      Entry.pwszRfc822Name = strName;
      break;

  case CERT_ALT_NAME_DNS_NAME:
      Entry.pwszDNSName = strName;
      break;

  case CERT_ALT_NAME_URL:
      Entry.pwszURL = strName;
      break;

  case CERT_ALT_NAME_REGISTERED_ID:
      if (!ceConvertWszToSz(&pszObjectId, strName, -1))
      {
    hr = E_OUTOFMEMORY;
    ceERRORPRINTLINE("ceConvertWszToSz", hr);
    goto error;
      }
      Entry.pszRegisteredID = pszObjectId;
      break;

  case CERT_ALT_NAME_OTHER_NAME:
      Entry.pOtherName = &OtherName;
      OtherName.pszObjId = szOID_NT_PRINCIPAL_NAME;
      OtherName.Value.cbData = SysStringByteLen(strName);
      OtherName.Value.pbData = (BYTE *) strName;
      break;

  case CERT_ALT_NAME_DIRECTORY_NAME:
      Entry.DirectoryName.cbData = SysStringByteLen(strName);
      Entry.DirectoryName.pbData = (BYTE *) strName;
      break;

  case CERT_ALT_NAME_IP_ADDRESS:
      Entry.IPAddress.cbData = SysStringByteLen(strName);
      Entry.IPAddress.pbData = (BYTE *) strName;
      break;

  //case CERT_ALT_NAME_X400_ADDRESS:
  //case CERT_ALT_NAME_EDI_PARTY_NAME:
  default:
      hr = E_INVALIDARG;
      ceERRORPRINTLINE("NameChoice", hr);
      goto error;

    }

    // Encode CERT_ALT_NAME_INFO:

    if (!CryptEncodeObject(
        X509_ASN_ENCODING,
        X509_ALTERNATE_NAME,
        &AltName,
        NULL,
        &cbEncoded))
    {
  hr = ceHLastError();
  ceERRORPRINTLINE("ceEncodeObject", hr);
  goto error;
    }

error:
    if (NULL != pszObjectId)
    {
  LocalFree(pszObjectId);
    }
    return(hr);
}

HRESULT ceVerifyObjId ( IN WCHAR const * pwszObjId )

Definition at line 808 of file celib.cpp.

{
    HRESULT hr;
    CHAR *pszObjId = NULL;

    if (!ceConvertWszToSz(&pszObjId, pwszObjId, -1))
    {
  hr = E_OUTOFMEMORY;
  _JumpError(hr, error, "ceConvertWszToSz");
    }
    hr = ceVerifyObjIdA(pszObjId);
    _JumpIfErrorStr(hr, error, "ceVerifyObjIdA", pwszObjId);

error:
    if (NULL != pszObjId)
    {
      LocalFree(pszObjId);
    }
    return(hr);
}

HRESULT ceVerifyObjIdA ( IN CHAR const * pszObjId )

Definition at line 703 of file celib.cpp.

{
    HRESULT hr;
    BYTE *pbEncoded = NULL;
    DWORD cbEncoded;
    CRYPT_ATTRIBUTE ainfo;
    CRYPT_ATTRIBUTE *painfo = NULL;
    DWORD cbainfo;
    char const *psz;
    int i;

    ainfo.pszObjId = const_cast<char *>(pszObjId);
    ainfo.cValue = 0;
    ainfo.rgValue = NULL;

    if (!ceEncodeObject(
        X509_ASN_ENCODING,
        PKCS_ATTRIBUTE,
        &ainfo,
        0,
        FALSE,
        &pbEncoded,
        &cbEncoded))
    {
  hr = ceHLastError();
  _JumpError(hr, error, "ceEncodeObject");
    }

    if (!ceDecodeObject(
        X509_ASN_ENCODING,
        PKCS_ATTRIBUTE,
        pbEncoded,
        cbEncoded,
        FALSE,
        (VOID **) &painfo,
        &cbainfo))
    {
  hr = ceHLastError();
  _JumpError(hr, error, "ceDecodeObject");
    }

    hr = E_INVALIDARG;
    if (0 != strcmp(ainfo.pszObjId, painfo->pszObjId))
    {
  _JumpError(hr, error, "bad ObjId: decode mismatch");
    }
    for (psz = painfo->pszObjId; '\0' != *psz; psz++)
    {
  // must be a digit or a dot separator

  if (!isdigit(*psz))
  {
      if ('.' != *psz)
      {
    _JumpError(hr, error, "bad ObjId: bad char");
      }

      // can't have dot at start, double dots or dot at end

      if (psz == painfo->pszObjId || '.' == psz[1] || '\0' == psz[1])
      {
    _JumpError(hr, error, "bad ObjId: dot location");
      }
  }
    }
    psz = strchr(painfo->pszObjId, '.');
    if (NULL == psz)
    {
  _JumpError(hr, error, "bad ObjId: must have at least one dot");
    }
    i = atoi(painfo->pszObjId);
    switch (i)
    {
  case 0:
  case 1:
      i = atoi(++psz);
      if (0 > i || 39 < i)
      {
    _JumpError(hr, error, "bad ObjId: 0. or 1. must be followed by 0..39");
      }
      break;

  case 2:
      break;

  default:
      _JumpError(hr, error, "bad ObjId: must start with 0, 1 or 2");
    }
    hr = S_OK;

error:
    if (NULL != pbEncoded)
    {
      LocalFree(pbEncoded);
    }
    if (NULL != painfo)
    {
      LocalFree(painfo);
    }
    return(hr);
}

int ceWtoI | ( | IN WCHAR const * | string,
 |  | OUT BOOL * | pfValid
 | ) |  |

Definition at line 1060 of file celib.cpp.

{
    HRESULT hr;
    WCHAR szBuf[16];
    WCHAR *szTmp = szBuf;
    int cTmp = ARRAYSIZE(szBuf);
    int i = 0;
    WCHAR const *pwsz;
    BOOL fSawDigit = FALSE;

    if (pfValid == NULL)
    {
        hr = E_POINTER;
        _JumpError(hr, error, "NULLPARAM");
    }
    *pfValid = FALSE;

    assert(NULL != pfValid);
    cTmp = FoldString(
        MAP_FOLDDIGITS,
        string,
        -1,
        szTmp,
        cTmp);
    if (cTmp == 0)
    {
        hr = ceHLastError();
        if (HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) == hr)
        {
            hr = S_OK;
            cTmp = FoldString(
                MAP_FOLDDIGITS,
                string,
                -1,
                NULL,
                0);

            szTmp = (WCHAR*)LocalAlloc(LMEM_FIXED, cTmp*sizeof(WCHAR));
      if (NULL == szTmp)
      {
    hr = E_OUTOFMEMORY;
    _JumpError(hr, error, "LocalAlloc");
      }

            cTmp = FoldString(
                MAP_FOLDDIGITS,
                string,
                -1,
                szTmp,
                cTmp);

            if (cTmp == 0)
                hr = ceHLastError();
        }
        _JumpIfError(hr, error, "FoldString");
    }
    pwsz = szTmp;
    while (iswspace(*pwsz))
    {
  pwsz++;
    }
    while (iswdigit(*pwsz))
    {
  fSawDigit = TRUE;
  pwsz++;
    }
    while (iswspace(*pwsz))
    {
  pwsz++;
    }
    if (L'\0' == *pwsz)
    {
  *pfValid = fSawDigit;
    }
    i = _wtoi(szTmp);

error:
    if (szTmp && (szTmp != szBuf))
       LocalFree(szTmp);

    return i;
}

Variable Documentation

UNITSTABLE g_aut[]
Initial value:
{
    { wszPERIODSECONDS, ENUM_PERIOD_SECONDS },
    { wszPERIODMINUTES, ENUM_PERIOD_MINUTES },
    { wszPERIODHOURS,   ENUM_PERIOD_HOURS },
    { wszPERIODDAYS,    ENUM_PERIOD_DAYS },
    { wszPERIODWEEKS,   ENUM_PERIOD_WEEKS },
    { wszPERIODMONTHS,  ENUM_PERIOD_MONTHS },
    { wszPERIODYEARS,   ENUM_PERIOD_YEARS },
}

Definition at line 646 of file celib.cpp.

Generated on Wed Nov 13 2024 16:54:28 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Exit/C++/Windows.Net/certxsam.cpp File Reference

  • Security
  • CertServices
  • Exit
  • C++
  • Windows.Net
Functions | Variables

certxsam.cpp File Reference

#include "pch.cpp"
#include "celib.h"
#include "exit.h"
#include "module.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 54 of file certxsam.cpp.

{
    return(_Module.GetLockCount() == 0? S_OK : S_FALSE);
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 64 of file certxsam.cpp.

{
    return(_Module.GetClassObject(rclsid, riid, ppv));
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 33 of file certxsam.cpp.

{
    switch (dwReason)
    {
  case DLL_PROCESS_ATTACH:
      _Module.Init(ObjectMap, hInstance);
      DisableThreadLibraryCalls(hInstance);
      break;

        case DLL_PROCESS_DETACH:
      _Module.Term();
            break;
    }
    return(TRUE);    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 74 of file certxsam.cpp.

{
    // registers object, typelib and all interfaces in typelib
    return(_Module.RegisterServer(TRUE));
}

STDAPI DllUnregisterServer ( void )

Definition at line 85 of file certxsam.cpp.

{
    _Module.UnregisterServer();
    return(S_OK);
}

Variable Documentation

CComModule _Module

Definition at line 20 of file certxsam.cpp.

Generated on Wed Nov 13 2024 16:54:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Exit/C++/Windows.Net/certxsam.idl File Reference

  • Security
  • CertServices
  • Exit
  • C++
  • Windows.Net
Classes | Namespaces | Functions

certxsam.idl File Reference

Go to the source code of this file.

Classes

class | CERTEXITSAMPLELib::CCertExitSample
class | CERTEXITSAMPLELib::CCertManageExitModuleSample

Namespaces

namespace | CERTEXITSAMPLELib

Functions

CERTEXITSAMPLELib::importlib ("stdole2.tlb")
Generated on Wed Nov 13 2024 16:54:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Exit/C++/Windows.Net/exit.cpp File Reference

  • Security
  • CertServices
  • Exit
  • C++
  • Windows.Net
Defines | Functions | Variables

exit.cpp File Reference

#include "pch.cpp"
#include <assert.h>
#include "celib.h"
#include "exit.h"
#include "module.h"

Go to the source code of this file.

Defines

#define | ceEXITEVENTS
#define | MAX_CRL_PROP

Functions

HRESULT | exitGetProperty (IN ICertServerExit *pServer, IN BOOL fRequest, IN WCHAR const *pwszPropertyName, IN DWORD PropType, OUT VARIANT *pvarOut)
HRESULT | exitGetRequestAttribute (IN ICertServerExit *pServer, IN WCHAR const *pwszAttributeName, OUT BSTR *pstrOut)
HRESULT | GetServerCallbackInterface (OUT ICertServerExit **ppServer, IN LONG Context)

Variables

BOOL | fDebug = DBG_CERTSRV
HINSTANCE | g_hInstance

Define Documentation

#define ceEXITEVENTS
Value:
(EXITEVENT_CERTISSUED | \
   EXITEVENT_CERTPENDING | \
   EXITEVENT_CERTDENIED | \
   EXITEVENT_CERTREVOKED | \
   EXITEVENT_CERTRETRIEVEPENDING | \
   EXITEVENT_CRLISSUED | \
   EXITEVENT_SHUTDOWN)

Definition at line 26 of file exit.cpp.

#define MAX_CRL_PROP
Value:
( \
            max( max( ARRAYSIZE(wszPROPCRLSTATE), \
                      ARRAYSIZE(wszPROPRAWCRL) ), \
                 ARRAYSIZE(wszPROPRAWDELTACRL) ) + 1 + cwcDWORDSPRINTF)

Function Documentation

HRESULT exitGetProperty | ( | IN ICertServerExit * | pServer,
 |  | IN BOOL | fRequest,
 |  | IN WCHAR const * | pwszPropertyName,
 |  | IN DWORD | PropType,
 |  | OUT VARIANT * | pvarOut
 | ) |  |

Definition at line 774 of file exit.cpp.

{
    HRESULT hr;
    BSTR strName = NULL;

    VariantInit(pvarOut);
    strName = SysAllocString(pwszPropertyName);
    if (NULL == strName)
    {
  hr = E_OUTOFMEMORY;
  _JumpError(hr, error, "Exit:SysAllocString");
    }
    if (fRequest)
    {
  hr = pServer->GetRequestProperty(strName, PropType, pvarOut);
  _JumpIfErrorStr2(
        hr,
        error,
        "Exit:GetRequestProperty",
        pwszPropertyName,
        CERTSRV_E_PROPERTY_EMPTY);
    }
    else
    {
  hr = pServer->GetCertificateProperty(strName, PropType, pvarOut);
  _JumpIfErrorStr2(
        hr,
        error,
        "Exit:GetCertificateProperty",
        pwszPropertyName,
        CERTSRV_E_PROPERTY_EMPTY);
    }

error:
    if (NULL != strName)
    {
  SysFreeString(strName);
    }
    return(hr);
}

HRESULT exitGetRequestAttribute | ( | IN ICertServerExit * | pServer,
 |  | IN WCHAR const * | pwszAttributeName,
 |  | OUT BSTR * | pstrOut
 | ) |  |

Definition at line 308 of file exit.cpp.

{
    HRESULT hr;
    BSTR strName = NULL;

    *pstrOut = NULL;
    strName = SysAllocString(pwszAttributeName);
    if (NULL == strName)
    {
  hr = E_OUTOFMEMORY;
  _JumpError(hr, error, "Exit:SysAllocString");
    }
    hr = pServer->GetRequestAttribute(strName, pstrOut);
    _JumpIfErrorStr2(
    hr,
    error,
    "Exit:GetRequestAttribute",
    pwszAttributeName,
    CERTSRV_E_PROPERTY_EMPTY);

error:
    if (NULL != strName)
    {
  SysFreeString(strName);
    }
    return(hr);
}

HRESULT GetServerCallbackInterface | ( | OUT ICertServerExit ** | ppServer,
 |  | IN LONG | Context
 | ) |  |

Definition at line 39 of file exit.cpp.

{
    HRESULT hr;

    if (NULL == ppServer)
    {
        hr = E_POINTER;
  _JumpError(hr, error, "Exit:NULL pointer");
    }

    hr = CoCreateInstance(
                    CLSID_CCertServerExit,
                    NULL,               // pUnkOuter
                    CLSCTX_INPROC_SERVER,
                    IID_ICertServerExit,
                    (VOID **) ppServer);
    _JumpIfError(hr, error, "Exit:CoCreateInstance");

    if (*ppServer == NULL)
    {
        hr = E_UNEXPECTED;
  _JumpError(hr, error, "Exit:NULL *ppServer");
    }

    // only set context if nonzero
    if (0 != Context)
    {
        hr = (*ppServer)->SetContext(Context);
        _JumpIfError(hr, error, "Exit: SetContext");
    }

error:
    return(hr);
}

Variable Documentation

BOOL fDebug = DBG_CERTSRV

Definition at line 20 of file exit.cpp.

HINSTANCE g_hInstance

Definition at line 104 of file SServer.Cpp.

Generated on Wed Nov 13 2024 16:54:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Exit/C++/Windows.Net/exit.h File Reference

  • Security
  • CertServices
  • Exit
  • C++
  • Windows.Net
Classes | Functions

exit.h File Reference

#include "certxsam.h"
#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Classes

class | CCertExitSample

Functions

HRESULT | exitGetProperty (IN ICertServerExit *pServer, IN BOOL fRequest, IN WCHAR const *pwszPropertyName, IN DWORD PropType, OUT VARIANT *pvarOut)
HRESULT | GetServerCallbackInterface (OUT ICertServerExit **ppServer, IN LONG Context)

Function Documentation

HRESULT exitGetProperty | ( | IN ICertServerExit * | pServer,
 |  | IN BOOL | fRequest,
 |  | IN WCHAR const * | pwszPropertyName,
 |  | IN DWORD | PropType,
 |  | OUT VARIANT * | pvarOut
 | ) |  |

Definition at line 774 of file exit.cpp.

{
    HRESULT hr;
    BSTR strName = NULL;

    VariantInit(pvarOut);
    strName = SysAllocString(pwszPropertyName);
    if (NULL == strName)
    {
  hr = E_OUTOFMEMORY;
  _JumpError(hr, error, "Exit:SysAllocString");
    }
    if (fRequest)
    {
  hr = pServer->GetRequestProperty(strName, PropType, pvarOut);
  _JumpIfErrorStr2(
        hr,
        error,
        "Exit:GetRequestProperty",
        pwszPropertyName,
        CERTSRV_E_PROPERTY_EMPTY);
    }
    else
    {
  hr = pServer->GetCertificateProperty(strName, PropType, pvarOut);
  _JumpIfErrorStr2(
        hr,
        error,
        "Exit:GetCertificateProperty",
        pwszPropertyName,
        CERTSRV_E_PROPERTY_EMPTY);
    }

error:
    if (NULL != strName)
    {
  SysFreeString(strName);
    }
    return(hr);
}

HRESULT GetServerCallbackInterface | ( | OUT ICertServerExit ** | ppServer,
 |  | IN LONG | Context
 | ) |  |

Definition at line 39 of file exit.cpp.

{
    HRESULT hr;

    if (NULL == ppServer)
    {
        hr = E_POINTER;
  _JumpError(hr, error, "Exit:NULL pointer");
    }

    hr = CoCreateInstance(
                    CLSID_CCertServerExit,
                    NULL,               // pUnkOuter
                    CLSCTX_INPROC_SERVER,
                    IID_ICertServerExit,
                    (VOID **) ppServer);
    _JumpIfError(hr, error, "Exit:CoCreateInstance");

    if (*ppServer == NULL)
    {
        hr = E_UNEXPECTED;
  _JumpError(hr, error, "Exit:NULL *ppServer");
    }

    // only set context if nonzero
    if (0 != Context)
    {
        hr = (*ppServer)->SetContext(Context);
        _JumpIfError(hr, error, "Exit: SetContext");
    }

error:
    return(hr);
}

Generated on Wed Nov 13 2024 16:54:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Exit/C++/Windows.Net/module.cpp File Reference

  • Security
  • CertServices
  • Exit
  • C++
  • Windows.Net

module.cpp File Reference

#include "pch.cpp"
#include "celib.h"
#include "module.h"
#include "exit.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Exit/C++/Windows.Net/module.h File Reference

  • Security
  • CertServices
  • Exit
  • C++
  • Windows.Net
Classes

module.h File Reference

#include "certxsam.h"
#include "resource.h"

Go to the source code of this file.

Classes

class CCertManageExitModuleSample
Generated on Wed Nov 13 2024 16:54:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Exit/C++/Windows.Net/pch.cpp File Reference

  • Security
  • CertServices
  • Exit
  • C++
  • Windows.Net
Defines | Variables

pch.cpp File Reference

#include <windows.h>
#include <atlbase.h>
#include <atlcom.h>
#include <certsrv.h>

Go to the source code of this file.

Defines

#define | wsz_SAMPLE_COPYRIGHT L"(c)1999 Microsoft"
#define | wsz_SAMPLE_DESCRIPTION L"Sample Exit Module"
#define | wsz_SAMPLE_FILEVER L"v 1.0"
#define | wsz_SAMPLE_NAME L"Sample/Test Exit Module"
#define | wsz_SAMPLE_PRODUCTVER L"v 5.00"
#define | wszCLASS_CERTEXITSAMPLE wszCLASS_CERTEXITSAMPLEPREFIX wszCERTEXITMODULE_POSTFIX
#define | wszCLASS_CERTEXITSAMPLEPREFIX TEXT("CertAuthority_Sample")
#define | wszCLASS_CERTMANAGEEXITMODULESAMPLE wszCLASS_CERTEXITSAMPLEPREFIX wszCERTMANAGEEXIT_POSTFIX

Variables

CComModule | _Module

Define Documentation

#define wsz_SAMPLE_COPYRIGHT L"(c)1999 Microsoft"

Definition at line 32 of file pch.cpp.

#define wsz_SAMPLE_DESCRIPTION L"Sample Exit Module"

Definition at line 31 of file pch.cpp.

#define wsz_SAMPLE_FILEVER L"v 1.0"

Definition at line 33 of file pch.cpp.

#define wsz_SAMPLE_NAME L"Sample/Test Exit Module"

Definition at line 30 of file pch.cpp.

#define wsz_SAMPLE_PRODUCTVER L"v 5.00"

Definition at line 34 of file pch.cpp.

#define wszCLASS_CERTEXITSAMPLE wszCLASS_CERTEXITSAMPLEPREFIX wszCERTEXITMODULE_POSTFIX

Definition at line 27 of file pch.cpp.

#define wszCLASS_CERTEXITSAMPLEPREFIX TEXT("CertAuthority_Sample")

Definition at line 25 of file pch.cpp.

#define wszCLASS_CERTMANAGEEXITMODULESAMPLE wszCLASS_CERTEXITSAMPLEPREFIX wszCERTMANAGEEXIT_POSTFIX

Definition at line 28 of file pch.cpp.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:54:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Exit/C++/Windows.Net/resource.h File Reference

  • Security
  • CertServices
  • Exit
  • C++
  • Windows.Net
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDS_CERTEXIT_DESC 1
#define | IDS_CERTMANAGEEXITMODULE_DESC 2

Define Documentation

#define IDS_CERTEXIT_DESC 1

Definition at line 15 of file resource.h.

#define IDS_CERTMANAGEEXITMODULE_DESC 2

Definition at line 16 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Exit/C++/Windows2000/Atl.Cpp File Reference

  • Security
  • CertServices
  • Exit
  • C++
  • Windows2000

Atl.Cpp File Reference

#include <pch.cpp>
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Exit/C++/Windows2000/CeDebug.Cpp File Reference

  • Security
  • CertServices
  • Exit
  • C++
  • Windows2000
Functions

CeDebug.Cpp File Reference

#include <pch.cpp>
#include <stdio.h>
#include <stdarg.h>

Go to the source code of this file.

Functions

int WINAPIV ceDbgPrintf (IN BOOL fDebug, IN LPCSTR lpFmt,...)

Function Documentation

int WINAPIV ceDbgPrintf | ( | IN BOOL | fDebug,
 |  | IN LPCSTR | lpFmt,
 |  |  | ...
 | ) |  |

Definition at line 31 of file CeDebug.Cpp.

{
    va_list arglist;
    CHAR ach[4096];
    int cch = 0;
    HANDLE hStdOut;
    DWORD dwErr;

    dwErr = GetLastError();
    if (fDebug)
    {
  _try
  {
      va_start(arglist, lpFmt);
      cch = _vsnprintf(ach, sizeof(ach), lpFmt, arglist);
      va_end(arglist);

      if (0 > cch)
      {
    strcpy(&ach[sizeof(ach) - 5], "...\n");
      }

      if (!IsDebuggerPresent())
      {
    hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
    if (hStdOut != INVALID_HANDLE_VALUE)
    {
        fputs(ach, stdout);
        fflush(stdout);
    }
      }
      OutputDebugStringA(ach);
  }
  _except(EXCEPTION_EXECUTE_HANDLER)
  {
      // return failure
      cch = 0;
  }
    }
    SetLastError(dwErr);
    return(cch);
}

Generated on Wed Nov 13 2024 16:54:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Exit/C++/Windows2000/CeError.Cpp File Reference

  • Security
  • CertServices
  • Exit
  • C++
  • Windows2000
Defines | Functions

CeError.Cpp File Reference

#include <pch.cpp>
#include "celibw2k.h"
#include <assert.h>
#include <stdio.h>
#include <ntdsbmsg.h>

Go to the source code of this file.

Defines

#define | CERTLIB_12BITERRORMASK 0x00000fff
#define | CERTLIB_WIN32ERRORMASK 0x0000ffff
#define | DELAYLOAD_FROM_WIN32(hr)
#define | E_DELAYLOAD_MOD_NOT_FOUND DELAYLOAD_FROM_WIN32(ERROR_MOD_NOT_FOUND)
#define | E_DELAYLOAD_PROC_NOT_FOUND DELAYLOAD_FROM_WIN32(ERROR_PROC_NOT_FOUND)
#define | FACILITY_DELAYLOAD 109
#define | HRESULT_FROM_JETERROR(jerr) ((STATUS_SEVERITY_ERROR << 30) | (FACILITY_NTDSB << 16) | -jerr)
#define | HRESULT_FROM_JETWARNING(jerr) ((STATUS_SEVERITY_WARNING << 30) | (FACILITY_NTDSB << 16) | jerr)
#define | ISDELAYLOADHRESULT(hr)
#define | ISDELAYLOADHRESULTFACILITY(hr)
#define | ISJETERROR(hr) ((~CERTLIB_WIN32ERRORMASK & (hr)) == ~CERTLIB_WIN32ERRORMASK)
#define | ISJETHRESULT(hr)
#define | ISOSSERROR(hr) ((~CERTLIB_12BITERRORMASK & (hr)) == CRYPT_E_OSS_ERROR)
#define | ISWIN32ERROR(hr) ((~CERTLIB_WIN32ERRORMASK & (hr)) == 0)
#define | ISWIN32HRESULT(hr)
#define | JETERROR_FROM_HRESULT(hr) (-(LONG) (CERTLIB_WIN32ERRORMASK & (hr)))
#define | OSSERROR_FROM_HRESULT(hr) (CERTLIB_12BITERRORMASK & (hr))
#define | WIN32ERROR_FROM_DELAYLOAD(hr) (CERTLIB_WIN32ERRORMASK & (hr))
#define | WIN32ERROR_FROM_HRESULT(hr) (CERTLIB_WIN32ERRORMASK & (hr))
#define | wszCOLONSPACE L": "
#define | wszJETERRORPREFIX L"EDB"
#define | wszOSSERRORPREFIX L"ASN"
#define | wszWIN32ERRORPREFIX L"WIN32"

Functions

WCHAR * | ceGetErrorMessageText (IN HRESULT hr, IN BOOL fHResultString)
HRESULT | ceHExceptionCode (IN EXCEPTION_POINTERS const *pep)
WCHAR const * | ceHResultToString (IN OUT WCHAR *awchr, IN HRESULT hr)
WCHAR const * | ceHResultToStringEx (IN OUT WCHAR *awchr, IN HRESULT hr, IN BOOL fRaw)
WCHAR const * | ceHResultToStringRaw (IN OUT WCHAR *awchr, IN HRESULT hr)
VOID | ceInitErrorMessageText (IN DWORD idsUnexpected, IN DWORD idsUnknownErrorCode)
BOOL | ceIsDelayLoadHResult (IN HRESULT hr)
HRESULT | ceJetHResult (IN HRESULT hr)

Define Documentation

#define CERTLIB_12BITERRORMASK 0x00000fff

Definition at line 22 of file CeError.Cpp.

#define CERTLIB_WIN32ERRORMASK 0x0000ffff

Definition at line 23 of file CeError.Cpp.

#define DELAYLOAD_FROM_WIN32 ( hr )
Value:
((HRESULT) ((STATUS_SEVERITY_ERROR << 30) | \
    (FACILITY_DELAYLOAD << 16) | \
    (hr)))

Definition at line 68 of file CeError.Cpp.

#define E_DELAYLOAD_MOD_NOT_FOUND DELAYLOAD_FROM_WIN32(ERROR_MOD_NOT_FOUND)

Definition at line 81 of file CeError.Cpp.

#define E_DELAYLOAD_PROC_NOT_FOUND DELAYLOAD_FROM_WIN32(ERROR_PROC_NOT_FOUND)

Definition at line 84 of file CeError.Cpp.

#define FACILITY_DELAYLOAD 109

Definition at line 67 of file CeError.Cpp.

#define HRESULT_FROM_JETERROR ( jerr ) ((STATUS_SEVERITY_ERROR << 30) | (FACILITY_NTDSB << 16) | -jerr)

Definition at line 32 of file CeError.Cpp.

#define HRESULT_FROM_JETWARNING ( jerr ) ((STATUS_SEVERITY_WARNING << 30) | (FACILITY_NTDSB << 16) | jerr)

Definition at line 29 of file CeError.Cpp.

#define ISDELAYLOADHRESULT ( hr )
Value:
(E_DELAYLOAD_MOD_NOT_FOUND == (hr) || \
     E_DELAYLOAD_PROC_NOT_FOUND == (hr) || \
     HRESULT_FROM_WIN32(ERROR_MOD_NOT_FOUND) == (hr) || \
     HRESULT_FROM_WIN32(ERROR_PROC_NOT_FOUND) == (hr))

Definition at line 86 of file CeError.Cpp.

#define ISDELAYLOADHRESULTFACILITY ( hr )
Value:
((~CERTLIB_WIN32ERRORMASK & (hr)) == ((STATUS_SEVERITY_ERROR << 30) | \
            (FACILITY_DELAYLOAD << 16)))

Definition at line 76 of file CeError.Cpp.

#define ISJETERROR ( hr ) ((~CERTLIB_WIN32ERRORMASK & (hr)) == ~CERTLIB_WIN32ERRORMASK)

Definition at line 38 of file CeError.Cpp.

#define ISJETHRESULT ( hr )
Value:
((~CERTLIB_WIN32ERRORMASK & (hr)) == ((STATUS_SEVERITY_ERROR << 30) | \
            (FACILITY_NTDSB << 16)))

Definition at line 41 of file CeError.Cpp.

#define ISOSSERROR ( hr ) ((~CERTLIB_12BITERRORMASK & (hr)) == CRYPT_E_OSS_ERROR)

Definition at line 96 of file CeError.Cpp.

#define ISWIN32ERROR ( hr ) ((~CERTLIB_WIN32ERRORMASK & (hr)) == 0)

Definition at line 51 of file CeError.Cpp.

#define ISWIN32HRESULT ( hr )
Value:
((~CERTLIB_WIN32ERRORMASK & (hr)) == ((STATUS_SEVERITY_WARNING << 30) | \
            (FACILITY_WIN32 << 16)))

Definition at line 54 of file CeError.Cpp.

#define JETERROR_FROM_HRESULT ( hr ) (-(LONG) (CERTLIB_WIN32ERRORMASK & (hr)))

Definition at line 35 of file CeError.Cpp.

#define OSSERROR_FROM_HRESULT ( hr ) (CERTLIB_12BITERRORMASK & (hr))

Definition at line 99 of file CeError.Cpp.

#define WIN32ERROR_FROM_DELAYLOAD ( hr ) (CERTLIB_WIN32ERRORMASK & (hr))

Definition at line 73 of file CeError.Cpp.

#define WIN32ERROR_FROM_HRESULT ( hr ) (CERTLIB_WIN32ERRORMASK & (hr))

Definition at line 58 of file CeError.Cpp.

#define wszCOLONSPACE L": "

Definition at line 157 of file CeError.Cpp.

#define wszJETERRORPREFIX L"EDB"

Definition at line 45 of file CeError.Cpp.

#define wszOSSERRORPREFIX L"ASN"

Definition at line 102 of file CeError.Cpp.

#define wszWIN32ERRORPREFIX L"WIN32"

Definition at line 61 of file CeError.Cpp.

Function Documentation

WCHAR* ceGetErrorMessageText | ( | IN HRESULT | hr,
 |  | IN BOOL | fHResultString
 | ) |  |

Definition at line 244 of file CeError.Cpp.

{
    static WCHAR s_wszUknownDefault[] = L"Error %ws %ws";
    WCHAR *pwszRet = NULL;
    WCHAR *pwszMsgT;
    WCHAR const *pwszUnknown;
    WCHAR wszUnknown[10 * ARRAYSIZE(s_wszUknownDefault)];
    WCHAR wszUnexpected[512];
    WCHAR awchr[cwcHRESULTSTRING];
    DWORD cwc;
    DWORD cwcUnexpected = 0;
    HMODULE hMod = NULL;

    wszUnexpected[0] = L'\0';
    if (E_UNEXPECTED == hr && 0 != s_idsUnexpected)
    {
  cwcUnexpected = LoadString(
        NULL,
        s_idsUnexpected,  // L"Unexpected method call sequence."
        wszUnknown,
        ARRAYSIZE(wszUnknown));
    }
    cwc = FormatMessage(
                FORMAT_MESSAGE_ALLOCATE_BUFFER |
        FORMAT_MESSAGE_FROM_SYSTEM |
        FORMAT_MESSAGE_IGNORE_INSERTS,
                NULL,
                hr,
                MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
                (WCHAR *) &pwszRet,
                0,
                NULL);
    if (0 == cwc)
    {
  hMod = LoadLibrary(L"ntdsbmsg.dll");
  if (NULL != hMod)
  {
      cwc = FormatMessage(
        FORMAT_MESSAGE_ALLOCATE_BUFFER |
      FORMAT_MESSAGE_FROM_HMODULE |
      FORMAT_MESSAGE_IGNORE_INSERTS,
        hMod,
        hr,
        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
        (WCHAR *) &pwszRet,
        0,
        NULL);
  }
    }
    if (0 == cwc)
    {
  // couldn't find error, _snwprintf it instead

  if (0 != s_idsUnknownErrorCode)
  {
      cwc = LoadString(
      NULL,
      s_idsUnknownErrorCode,  // L"Error %ws %ws"
      wszUnknown,
      ARRAYSIZE(wszUnknown));
  }
  if (0 == cwc)
  {
      pwszUnknown = s_wszUknownDefault;
  }
  else
  {
      pwszUnknown = wszUnknown;
  }
  cwc = (DWORD)(wcslen(pwszUnknown) + cwcUnexpected + ARRAYSIZE(awchr) + 1);
        pwszRet = (WCHAR *) LocalAlloc(LMEM_FIXED, cwc * sizeof(WCHAR));
  if (NULL == pwszRet)
  {
      ceERRORPRINTLINE("LocalAlloc", E_OUTOFMEMORY);
      goto error;
  }
        _snwprintf(
    pwszRet,
    cwc,
    pwszUnknown,
    wszUnexpected,
    ceHResultToString(awchr, hr));
    }
    else
    {
        // strip trailing \r\n

        cwc = (DWORD)wcslen(pwszRet);

        if (2 <= cwc &&
      L'\r' == pwszRet[cwc - 2] &&
      L'\n' == pwszRet[cwc - 1])
  {
            pwszRet[cwc - 2] = L'\0';
  }
  awchr[0] = L'\0';
  if (fHResultString)
  {
      ceHResultToString(awchr, hr);
  }
  if (fHResultString || 0 != cwcUnexpected)
  {
      cwc = (DWORD)(wcslen(pwszRet) + 1 + cwcUnexpected + 1 + wcslen(awchr) + 1);
      pwszMsgT = (WCHAR *) LocalAlloc(LMEM_FIXED, cwc * sizeof(WCHAR));
      if (NULL == pwszMsgT)
      {
    ceERRORPRINTLINE("LocalAlloc", E_OUTOFMEMORY);
    goto error;
      }
      _snwprintf(
        pwszMsgT,
        cwc,
        L"%ws %ws %ws",
        pwszRet,
        wszUnexpected,
        awchr);
      LocalFree(pwszRet);
      pwszRet = pwszMsgT;
  }
    }

error:
    if (NULL != hMod)
    {
  FreeLibrary(hMod);
    }
    return(pwszRet);
}

HRESULT ceHExceptionCode ( IN EXCEPTION_POINTERS const * pep )

Definition at line 140 of file CeError.Cpp.

{
    HRESULT hr = pep->ExceptionRecord->ExceptionCode;

    return(ceHError(hr));
}

WCHAR const* ceHResultToString | ( | IN OUT WCHAR * | awchr,
 |  | IN HRESULT | hr
 | ) |  |

Definition at line 211 of file CeError.Cpp.

{
    return(ceHResultToStringEx(awchr, hr, FALSE));
}

WCHAR const* ceHResultToStringEx | ( | IN OUT WCHAR * | awchr,
 |  | IN HRESULT | hr,
 |  | IN BOOL | fRaw
 | ) |  |

Definition at line 160 of file CeError.Cpp.

{
    HRESULT hrd;
    WCHAR const *pwszType;

    hrd = hr;
    pwszType = L"";
    if (ISJETERROR(hr))
    {
  pwszType = wszJETERRORPREFIX wszCOLONSPACE;
    }
    else if (ISJETHRESULT(hr))
    {
  hrd = JETERROR_FROM_HRESULT(hr);
  pwszType = wszJETERRORPREFIX wszCOLONSPACE;
    }
    else if (ISWIN32HRESULT(hr))
    {
  hrd = WIN32ERROR_FROM_HRESULT(hr);
  pwszType = wszWIN32ERRORPREFIX wszCOLONSPACE;
    }
    else if (ISDELAYLOADHRESULTFACILITY(hr))
    {
  hrd = WIN32ERROR_FROM_DELAYLOAD(hr);
  pwszType = wszWIN32ERRORPREFIX wszCOLONSPACE;
    }
    else if (ISOSSERROR(hr))
    {
  hrd = OSSERROR_FROM_HRESULT(hr);
  pwszType = wszOSSERRORPREFIX wszCOLONSPACE;
    }
    if (fRaw)
    {
  pwszType = L"";
    }

    _snwprintf(
  awchr,
  cwcHRESULTSTRING,
  L"0x%x (%ws%d)",
  hr,
  pwszType,
  hrd);
    return(awchr);
}

WCHAR const* ceHResultToStringRaw | ( | IN OUT WCHAR * | awchr,
 |  | IN HRESULT | hr
 | ) |  |

Definition at line 220 of file CeError.Cpp.

{
    return(ceHResultToStringEx(awchr, hr, TRUE));
}

VOID ceInitErrorMessageText | ( | IN DWORD | idsUnexpected,
 |  | IN DWORD | idsUnknownErrorCode
 | ) |  |

Definition at line 232 of file CeError.Cpp.

{
    s_idsUnexpected = idsUnexpected;
    s_idsUnknownErrorCode = idsUnknownErrorCode;
}

BOOL ceIsDelayLoadHResult ( IN HRESULT hr )

Definition at line 150 of file CeError.Cpp.

{
    return(ISDELAYLOADHRESULT(hr));
}

HRESULT ceJetHResult ( IN HRESULT hr )

Definition at line 108 of file CeError.Cpp.

{
#if DBG_CERTSRV
    HRESULT hrIn = hr;
#endif
    if (S_OK != hr)
    {
        if (SUCCEEDED(hr))
        {
#if 0
      hr = HRESULT_FROM_JETWARNING(hr);
#else
            if (S_FALSE != hr)
      {
    ceERRORPRINTLINE("JetHResult: mapping to S_FALSE", hr);
      }
            assert(S_FALSE == hr);
            hr = S_FALSE;
#endif
        }
        else if (ISJETERROR(hr))
        {
      hr = HRESULT_FROM_JETERROR(hr);
        }
    }
    assert(S_OK == hr || S_FALSE == hr || FAILED(hr));
    return(hr);
}

Generated on Wed Nov 13 2024 16:54:28 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Exit/C++/Windows2000/CeLib.Cpp File Reference

  • Security
  • CertServices
  • Exit
  • C++
  • Windows2000
Classes | Defines | Typedefs | Functions | Variables

CeLib.Cpp File Reference

#include "pch.cpp"
#include <stdio.h>
#include <assert.h>
#include "celibw2k.h"

Go to the source code of this file.

Classes

struct | _UNITSTABLE

Defines

#define | CUNITSTABLEMAX (sizeof(g_aut)/sizeof(g_aut[0]))
#define | wszDURATIONUNITSDAYS wszPERIODDAYS
#define | wszDURATIONUNITSHOURS wszPERIODHOURS
#define | wszDURATIONUNITSMINUTES wszPERIODMINUTES
#define | wszDURATIONUNITSMONTHS wszPERIODMONTHS
#define | wszDURATIONUNITSSECONDS wszPERIODSECONDS
#define | wszDURATIONUNITSWEEKS wszPERIODWEEKS
#define | wszDURATIONUNITSYEARS wszPERIODYEARS

Typedefs

typedef struct _UNITSTABLE | UNITSTABLE

Functions

BOOL | ceConvertSzToBstr (OUT BSTR *pbstr, IN CHAR const *pch, IN LONG cch)
BOOL | ceConvertSzToWsz (OUT WCHAR **ppwsz, IN char const *pch, IN LONG cch)
BOOL | ceConvertWszToBstr (OUT BSTR *pbstr, IN WCHAR const *pwc, IN LONG cb)
BOOL | ceConvertWszToSz (OUT CHAR **ppsz, IN WCHAR const *pwc, IN LONG cwc)
HRESULT | ceDateToFileTime (IN DATE const *pDate, OUT FILETIME *pft)
BOOL | ceDecodeObject (IN DWORD dwEncodingType, IN LPCSTR lpszStructType, IN BYTE const *pbEncoded, IN DWORD cbEncoded, IN BOOL fCoTaskMemAlloc, OUT VOID **ppvStructInfo, OUT DWORD *pcbStructInfo)
HRESULT | ceDispatchSetErrorInfo (IN HRESULT hrError, IN WCHAR const *pwszDescription, OPTIONAL IN WCHAR const *pwszProgId, OPTIONAL IN IID const *piid)
WCHAR * | ceDuplicateString (IN WCHAR const *pwsz)
BOOL | ceEncodeObject (IN DWORD dwEncodingType, IN LPCSTR lpszStructType, IN VOID const *pvStructInfo, IN DWORD dwFlags, IN BOOL fCoTaskMemAlloc, OUT BYTE **ppbEncoded, OUT DWORD *pcbEncoded)
VOID | ceErrorPrintLine (IN char const *pszFile, IN DWORD line, IN char const *pszMessage, IN HRESULT hr)
HRESULT | ceFileTimeToDate (IN FILETIME const *pft, OUT DATE *pDate)
VOID | ceFreeBstr (IN OUT BSTR *pstr)
WCHAR const * | ceGetOIDName (IN WCHAR const *pwszObjId)
WCHAR const * | ceGetOIDNameA (IN char const *pszObjId)
HRESULT | ceHError (IN HRESULT hr)
HRESULT | ceHLastError (VOID)
HRESULT | ceMakeExprDate (IN OUT DATE *pDate, IN LONG lDelta, IN enum ENUM_PERIOD enumPeriod)
VOID | ceMakeExprDateTime (IN OUT FILETIME *pft, IN LONG lDelta, IN enum ENUM_PERIOD enumPeriod)
HRESULT | ceTranslatePeriodUnits (IN WCHAR const *pwszPeriod, IN LONG lCount, OUT enum ENUM_PERIOD *penumPeriod, OUT LONG *plCount)
HRESULT | ceVerifyAltNameString (IN LONG NameChoice, IN WCHAR const *pwszName)
HRESULT | ceVerifyObjId (IN WCHAR const *pwszObjId)
int | ceWtoI (IN WCHAR const *string, OUT BOOL *pfValid)

Variables

UNITSTABLE g_aut []

Define Documentation

#define CUNITSTABLEMAX (sizeof(g_aut)/sizeof(g_aut[0]))

Definition at line 641 of file CeLib.Cpp.

#define wszDURATIONUNITSDAYS wszPERIODDAYS

Definition at line 21 of file CeLib.Cpp.

#define wszDURATIONUNITSHOURS wszPERIODHOURS

Definition at line 22 of file CeLib.Cpp.

#define wszDURATIONUNITSMINUTES wszPERIODMINUTES

Definition at line 23 of file CeLib.Cpp.

#define wszDURATIONUNITSMONTHS wszPERIODMONTHS

Definition at line 24 of file CeLib.Cpp.

#define wszDURATIONUNITSSECONDS wszPERIODSECONDS

Definition at line 25 of file CeLib.Cpp.

#define wszDURATIONUNITSWEEKS wszPERIODWEEKS

Definition at line 26 of file CeLib.Cpp.

#define wszDURATIONUNITSYEARS wszPERIODYEARS

Definition at line 27 of file CeLib.Cpp.

Typedef Documentation

typedef struct _UNITSTABLE UNITSTABLE

Function Documentation

BOOL ceConvertSzToBstr | ( | OUT BSTR * | pbstr,
 |  | IN CHAR const * | pch,
 |  | IN LONG | cch
 | ) |  |

Definition at line 341 of file CeLib.Cpp.

{
    BOOL fOk = FALSE;
    BSTR bstr = NULL;
    LONG cwc = 0;

    ceFreeBstr(pbstr);
    if (-1 == cch)
    {
  cch = (LONG)strlen(pch);
    }
    while (TRUE)
    {
  cwc = MultiByteToWideChar(GetACP(), 0, pch, cch, bstr, cwc);
  if (0 >= cwc)
  {
      //hr = ceHLastError();
      //printf("MultiByteToWideChar returned %d (%x)\n", hr, hr);
      break;
  }
  if (NULL != bstr)
  {
      bstr[cwc] = L'\0';
      *pbstr = bstr;
      fOk = TRUE;
      break;
  }
  bstr = SysAllocStringLen(NULL, cwc);
  if (NULL == bstr)
  {
      break;
  }
    }
    return(fOk);
}

BOOL ceConvertSzToWsz | ( | OUT WCHAR ** | ppwsz,
 |  | IN char const * | pch,
 |  | IN LONG | cch
 | ) |  |

Definition at line 300 of file CeLib.Cpp.

{
    BOOL fOk = FALSE;
    LONG cwc = 0;

    *ppwsz = NULL;
    while (TRUE)
    {
  cwc = MultiByteToWideChar(GetACP(), 0, pch, cch, *ppwsz, cwc);
  if (0 >= cwc)
  {
      DWORD err;

      err = GetLastError();
      ceERRORPRINTLINE("MultiByteToWideChar", err);
      if (NULL != *ppwsz)
      {
    LocalFree(*ppwsz);
    *ppwsz = NULL;
      }
      break;
  }
  if (NULL != *ppwsz)
  {
      fOk = TRUE;
      break;
  }
  *ppwsz = (WCHAR *) LocalAlloc(LMEM_FIXED, (cwc + 1) * sizeof(WCHAR));
  if (NULL == *ppwsz)
  {
      break;
  }
    }
    return(fOk);
}

BOOL ceConvertWszToBstr | ( | OUT BSTR * | pbstr,
 |  | IN WCHAR const * | pwc,
 |  | IN LONG | cb
 | ) |  |

Definition at line 268 of file CeLib.Cpp.

{
    BOOL fOk = FALSE;
    BSTR bstr;

    ceFreeBstr(pbstr);
    do
    {
  bstr = NULL;
  if (NULL != pwc)
  {
      if (-1 == cb)
      {
    cb = (LONG)(wcslen(pwc) * sizeof(WCHAR));
      }
      bstr = SysAllocStringByteLen((char const *) pwc, cb);
      if (NULL == bstr)
      {
    break;
      }
  }
  *pbstr = bstr;
  fOk = TRUE;
    } while (FALSE);
    return(fOk);
}

BOOL ceConvertWszToSz | ( | OUT CHAR ** | ppsz,
 |  | IN WCHAR const * | pwc,
 |  | IN LONG | cwc
 | ) |  |

Definition at line 219 of file CeLib.Cpp.

{
    BOOL fOk = FALSE;
    LONG cch = 0;

    *ppsz = NULL;
    while (TRUE)
    {
  cch = WideCharToMultiByte(
      GetACP(),
      0,          // dwFlags
      pwc,
      cwc,        // cchWideChar, -1 => null terminated
      *ppsz,
      cch,
      NULL,
      NULL);
  if (0 >= cch)
  {
      DWORD err;

      err = GetLastError();
      ceERRORPRINTLINE("WideCharToMultiByte", err);
      if (NULL != *ppsz)
      {
    LocalFree(*ppsz);
    *ppsz = NULL;
      }
      break;
  }
  if (NULL != *ppsz)
  {
      fOk = TRUE;
      break;
  }
  *ppsz = (CHAR *) LocalAlloc(LMEM_FIXED, cch + 1);
  if (NULL == *ppsz)
  {
      break;
  }
    }
    return(fOk);
}

HRESULT ceDateToFileTime | ( | IN DATE const * | pDate,
 |  | OUT FILETIME * | pft
 | ) |  |

Definition at line 438 of file CeLib.Cpp.

{
    SYSTEMTIME st;
    HRESULT hr = S_OK;

    if (*pDate == 0.0)
    {
        GetSystemTime(&st);
    }
    else
    {
  if (!VariantTimeToSystemTime(*pDate, &st))
  {
      hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
      _JumpError(hr, error, "VariantTimeToSystemTime");
  }
    }

    if (!SystemTimeToFileTime(&st, pft))
    {
        hr = ceHLastError();
        _JumpError(hr, error, "SystemTimeToFileTime");
    }

error:
    return(hr);
}

BOOL ceDecodeObject | ( | IN DWORD | dwEncodingType,
 |  | IN LPCSTR | lpszStructType,
 |  | IN BYTE const * | pbEncoded,
 |  | IN DWORD | cbEncoded,
 |  | IN BOOL | fCoTaskMemAlloc,
 |  | OUT VOID ** | ppvStructInfo,
 |  | OUT DWORD * | pcbStructInfo
 | ) |  |

Definition at line 36 of file CeLib.Cpp.

{
    BOOL b;

    assert(!fCoTaskMemAlloc);
    *ppvStructInfo = NULL;
    *pcbStructInfo = 0;
    while (TRUE)
    {
  b = CryptDecodeObject(
        dwEncodingType,
        lpszStructType,
        pbEncoded,
        cbEncoded,
        0,                  // dwFlags
        *ppvStructInfo,
        pcbStructInfo);
  if (b && 0 == *pcbStructInfo)
  {
      SetLastError(HRESULT_FROM_WIN32(ERROR_INVALID_DATA));
      b = FALSE;
  }
  if (!b)
  {
      if (NULL != *ppvStructInfo)
      {
    HRESULT hr = GetLastError();

    LocalFree(*ppvStructInfo);
    *ppvStructInfo = NULL;
    SetLastError(hr);
      }
      break;
  }
  if (NULL != *ppvStructInfo)
  {
      break;
  }
  *ppvStructInfo = (BYTE *) LocalAlloc(LMEM_FIXED, *pcbStructInfo);
  if (NULL == *ppvStructInfo)
  {
      b = FALSE;
      break;
  }
    }
    return(b);
}

HRESULT ceDispatchSetErrorInfo | ( | IN HRESULT | hrError,
 |  | IN WCHAR const * | pwszDescription,
 |  | OPTIONAL IN WCHAR const * | pwszProgId,
 |  | OPTIONAL IN IID const * | piid
 | ) |  |

Definition at line 793 of file CeLib.Cpp.

{
    HRESULT hr;
    ICreateErrorInfo *pCreateErrorInfo = NULL;
    IErrorInfo *pErrorInfo = NULL;
    WCHAR *pwszError = NULL;
    WCHAR *pwszText = NULL;

    if (NULL == pwszDescription)
    {
        hr = E_POINTER;
        ceERRORPRINTLINE("NULL pointer", hr);
        goto error;
    }

    assert(FAILED(hrError));
    pwszError = ceGetErrorMessageText(hrError, TRUE);
    if (NULL == pwszError)
    {
  ceERRORPRINTLINE("ceGetErrorMessageText", E_OUTOFMEMORY);
    }
    else
    {
  pwszText = (WCHAR *) LocalAlloc(
      LMEM_FIXED,
      (wcslen(pwszDescription) + 1 + wcslen(pwszError) + 1) *
       sizeof(WCHAR));
  if (NULL == pwszText)
  {
      ceERRORPRINTLINE("LocalAlloc", E_OUTOFMEMORY);
  }
  else
  {
      wcscpy(pwszText, pwszDescription);
      wcscat(pwszText, L" ");
      wcscpy(pwszText, pwszError);
  }
    }

    hr = CreateErrorInfo(&pCreateErrorInfo);
    if (S_OK != hr)
    {
        ceERRORPRINTLINE("CreateErrorInfo", hr);
        goto error;
    }

    if (NULL != piid)
    {
  hr = pCreateErrorInfo->SetGUID(*piid);
  if (S_OK != hr)
  {
      ceERRORPRINTLINE("SetGUID", hr);
  }
    }

    hr = pCreateErrorInfo->SetDescription(
        NULL != pwszText?
      pwszText : const_cast<WCHAR *>(pwszDescription));
    if (S_OK != hr)
    {
  ceERRORPRINTLINE("SetDescription", hr);
    }

    // Set ProgId:

    if (NULL != pwszProgId)
    {
  hr = pCreateErrorInfo->SetSource(const_cast<WCHAR *>(pwszProgId));
  if (S_OK != hr)
  {
      ceERRORPRINTLINE("SetSource", hr);
  }
    }

    hr = pCreateErrorInfo->QueryInterface(
            IID_IErrorInfo,
            (VOID **) &pErrorInfo);
    if (S_OK != hr)
    {
        ceERRORPRINTLINE("QueryInterface", hr);
        goto error;
    }

    SetErrorInfo(0, pErrorInfo);

error:
    if (NULL != pErrorInfo)
    {
  pErrorInfo->Release();
    }
    if (NULL != pCreateErrorInfo)
    {
  pCreateErrorInfo->Release();
    }
    if (NULL != pwszText)
    {
  LocalFree(pwszText);
    }
    if (NULL != pwszError)
    {
  LocalFree(pwszError);
    }
    return(hrError);  // return input error!
}

WCHAR* ceDuplicateString ( IN WCHAR const * pwsz )

Definition at line 202 of file CeLib.Cpp.

{
    WCHAR *pwszOut;

    pwszOut = (WCHAR *) LocalAlloc(
        LMEM_FIXED,
        (wcslen(pwsz) + 1) * sizeof(pwsz[0]));
    if (NULL != pwszOut)
    {
  wcscpy(pwszOut, pwsz);
    }
    return(pwszOut);
}

BOOL ceEncodeObject | ( | IN DWORD | dwEncodingType,
 |  | IN LPCSTR | lpszStructType,
 |  | IN VOID const * | pvStructInfo,
 |  | IN DWORD | dwFlags,
 |  | IN BOOL | fCoTaskMemAlloc,
 |  | OUT BYTE ** | ppbEncoded,
 |  | OUT DWORD * | pcbEncoded
 | ) |  |

Definition at line 93 of file CeLib.Cpp.

{
    BOOL b;

    assert(0 == dwFlags);
    assert(!fCoTaskMemAlloc);
    *ppbEncoded = NULL;
    *pcbEncoded = 0;
    while (TRUE)
    {
  b = CryptEncodeObject(
        dwEncodingType,
        lpszStructType,
        const_cast<VOID *>(pvStructInfo),
        *ppbEncoded,
        pcbEncoded);
  if (b && 0 == *pcbEncoded)
  {
      SetLastError(HRESULT_FROM_WIN32(ERROR_INVALID_DATA));
      b = FALSE;
  }
  if (!b)
  {
      if (NULL != *ppbEncoded)
      {
    HRESULT hr = GetLastError();

    LocalFree(*ppbEncoded);
    *ppbEncoded = NULL;
    SetLastError(hr);
      }
      break;
  }
  if (NULL != *ppbEncoded)
  {
      break;
  }
  *ppbEncoded = (BYTE *) LocalAlloc(LMEM_FIXED, *pcbEncoded);
  if (NULL == *ppbEncoded)
  {
      b = FALSE;
      break;
  }
    }
    return(b);
}

VOID ceErrorPrintLine | ( | IN char const * | pszFile,
 |  | IN DWORD | line,
 |  | IN char const * | pszMessage,
 |  | IN HRESULT | hr
 | ) |  |

Definition at line 421 of file CeLib.Cpp.

{
    wprintf(
  L"CertEnc.Dll: Error: %hs(%u): %hs 0x%x (%d)\n",
  pszFile,
  line,
  pszMessage,
  hr,
  hr);
}

HRESULT ceFileTimeToDate | ( | IN FILETIME const * | pft,
 |  | OUT DATE * | pDate
 | ) |  |

Definition at line 470 of file CeLib.Cpp.

{
    SYSTEMTIME st;
    HRESULT hr = S_OK;

    if (!FileTimeToSystemTime(pft, &st))
    {
        hr = ceHLastError();
        _JumpError(hr, error, "FileTimeToSystemTime");
    }
    if (!SystemTimeToVariantTime(&st, pDate))
    {
        hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
        _JumpError(hr, error, "SystemTimeToVariantTime");
    }

error:
    return(hr);
}

VOID ceFreeBstr ( IN OUT BSTR * pstr )

Definition at line 382 of file CeLib.Cpp.

{
    if (NULL != *pstr)
    {
  SysFreeString(*pstr);
  *pstr = NULL;
    }
}

WCHAR const* ceGetOIDName ( IN WCHAR const * pwszObjId )

Definition at line 180 of file CeLib.Cpp.

{
    char *pszObjId = NULL;
    WCHAR const *pwszName = L"";

    if (!ceConvertWszToSz(&pszObjId, pwszObjId, -1))
    {
  _JumpError(E_OUTOFMEMORY, error, "ceConvertWszToSz");
    }
    pwszName = ceGetOIDNameA(pszObjId);

error:
    if (NULL != pszObjId)
    {
  LocalFree(pszObjId);
    }
    return(pwszName);
}

WCHAR const* ceGetOIDNameA ( IN char const * pszObjId )

Definition at line 152 of file CeLib.Cpp.

{
    CRYPT_OID_INFO const *pInfo = NULL;
    WCHAR const *pwszName = L"";

    // First try looking up the ObjectId as an Extension or Attribute, because
    // we get a better Display Name, especially for Subject RDNs: CN, L, etc.
    // If that fails, look it up withoput restricting the group.

    pInfo = CryptFindOIDInfo(
      CRYPT_OID_INFO_OID_KEY,
      (VOID *) pszObjId,
      CRYPT_EXT_OR_ATTR_OID_GROUP_ID);

    if (NULL == pInfo || NULL == pInfo->pwszName || L'\0' == pInfo->pwszName[0])
    {
  pInfo = CryptFindOIDInfo(CRYPT_OID_INFO_OID_KEY, (VOID *) pszObjId, 0);
    }
    if (NULL != pInfo && NULL != pInfo->pwszName && L'\0' != pInfo->pwszName[0])
    {
  pwszName = pInfo->pwszName;
    }
    return(pwszName);
}

HRESULT ceHError ( IN HRESULT hr )

Definition at line 394 of file CeLib.Cpp.

{
    assert(S_FALSE != hr);

    if (S_OK != hr && S_FALSE != hr && !FAILED(hr))
    {
        hr = HRESULT_FROM_WIN32(hr);
  if (0 == HRESULT_CODE(hr))
  {
      // A call failed without properly setting an error condition!
      hr = E_UNEXPECTED;
  }
  assert(FAILED(hr));
    }
    return(hr);
}

HRESULT ceHLastError ( VOID )

Definition at line 414 of file CeLib.Cpp.

{
    return(ceHError(GetLastError()));
}

HRESULT ceMakeExprDate | ( | IN OUT DATE * | pDate,
 |  | IN LONG | lDelta,
 |  | IN enum ENUM_PERIOD | enumPeriod
 | ) |  |

Definition at line 603 of file CeLib.Cpp.

{
    HRESULT hr;
    FILETIME ft;

    hr = ceDateToFileTime(pDate, &ft);
    _JumpIfError(hr, error, "ceDateToFileTime");

    ceMakeExprDateTime(&ft, lDelta, enumPeriod);

    hr = ceFileTimeToDate(&ft, pDate);
    _JumpIfError(hr, error, "ceFileTimeToDate");

error:
    return(hr);
}

VOID ceMakeExprDateTime | ( | IN OUT FILETIME * | pft,
 |  | IN LONG | lDelta,
 |  | IN enum ENUM_PERIOD | enumPeriod
 | ) |  |

Definition at line 494 of file CeLib.Cpp.

{
    LONGLONG llDelta;
    BOOL fSysTimeDelta;

    llDelta = lDelta;
    fSysTimeDelta = FALSE;
    switch (enumPeriod)
    {
  case ENUM_PERIOD_WEEKS:   llDelta *= CVT_WEEKS;    break;
  case ENUM_PERIOD_DAYS:    llDelta *= CVT_DAYS;     break;
  case ENUM_PERIOD_HOURS:   llDelta *= CVT_HOURS;    break;
  case ENUM_PERIOD_MINUTES: llDelta *= CVT_MINUTES;  break;
  case ENUM_PERIOD_SECONDS:         break;
  default:
      fSysTimeDelta = TRUE;
      break;
    }
    if (fSysTimeDelta)
    {
      SYSTEMTIME SystemTime;

      FileTimeToSystemTime(pft, &SystemTime);
      switch (enumPeriod)
      {
          case ENUM_PERIOD_MONTHS:
        if (0 > lDelta)
        {
            DWORD dwDelta = (DWORD) -lDelta;

            SystemTime.wYear -= (WORD) (dwDelta / 12) + 1;
            SystemTime.wMonth += 12 - (WORD) (dwDelta % 12);
        }
        else
        {
            SystemTime.wMonth += (WORD) lDelta;
        }
        if (12 < SystemTime.wMonth)
        {
            SystemTime.wYear += (SystemTime.wMonth - 1) / 12;
            SystemTime.wMonth = ((SystemTime.wMonth - 1) % 12) + 1;
        }
        break;

          case ENUM_PERIOD_YEARS:
        SystemTime.wYear += (WORD) lDelta;
        break;

          default:
        SystemTime.wYear += 1;
        break;
      }

DoConvert:
        if (!SystemTimeToFileTime(&SystemTime, pft))
        {
            if (GetLastError() != ERROR_INVALID_PARAMETER)
            {
                assert(!"Unable to do time conversion");
                return;
            }

            // In some cases we'll convert to an invalid month-end

            // only one month changes length from year to year
            if (SystemTime.wMonth == 2)
            {
                // > 29? try leap year
                if (SystemTime.wDay > 29)
                {
                    SystemTime.wDay = 29;
                    goto DoConvert;
                }
                // == 29? try non-leap year
                else if (SystemTime.wDay == 29)
                {
                    SystemTime.wDay = 28;
                    goto DoConvert;
                }
            }
            // sept (9), apr(4), jun(6), nov(11) all have 30 days
            else if ((SystemTime.wMonth == 9) ||
                     (SystemTime.wMonth == 4) ||
                     (SystemTime.wMonth == 6) ||
                     (SystemTime.wMonth == 11))
            {
                if (SystemTime.wDay > 30)
                {
                    SystemTime.wDay = 30;
                    goto DoConvert;
                }
            }

            // should never get here
            assert(!"Month/year processing: inaccessible code");
            return;
        }
    }
    else
    {
      *(LONGLONG *) pft += llDelta * CVT_BASE;
    }
}

HRESULT ceTranslatePeriodUnits | ( | IN WCHAR const * | pwszPeriod,
 |  | IN LONG | lCount,
 |  | OUT enum ENUM_PERIOD * | penumPeriod,
 |  | OUT LONG * | plCount
 | ) |  |

Definition at line 645 of file CeLib.Cpp.

{
    HRESULT hr;
    UNITSTABLE const *put;

    for (put = g_aut; put < &g_aut[CUNITSTABLEMAX]; put++)
    {
  if (0 == lstrcmpi(pwszPeriod, put->pwszString))
  {
      *penumPeriod = put->enumPeriod;
      if (0 > lCount)
      {
    lCount = MAXLONG;
      }
      *plCount = lCount;
      hr = S_OK;
      goto error;
  }
    }
    hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);

error:
    return(hr);
}

HRESULT ceVerifyAltNameString | ( | IN LONG | NameChoice,
 |  | IN WCHAR const * | pwszName
 | ) |  |

Definition at line 716 of file CeLib.Cpp.

{
    HRESULT hr = S_OK;
    CERT_ALT_NAME_INFO AltName;
    CERT_ALT_NAME_ENTRY Entry;
    char *pszObjectId = NULL;
    DWORD cbEncoded;

    ZeroMemory(&AltName, sizeof(AltName));
    AltName.cAltEntry = 1;
    AltName.rgAltEntry = &Entry;

    ZeroMemory(&Entry, sizeof(Entry));
    Entry.dwAltNameChoice = NameChoice;

    switch (NameChoice)
    {
  case CERT_ALT_NAME_RFC822_NAME:
      Entry.pwszRfc822Name = const_cast<WCHAR *>(pwszName);
      break;

  case CERT_ALT_NAME_DNS_NAME:
      Entry.pwszDNSName = const_cast<WCHAR *>(pwszName);
      break;

  case CERT_ALT_NAME_URL:
      Entry.pwszURL = const_cast<WCHAR *>(pwszName);
      break;

  case CERT_ALT_NAME_REGISTERED_ID:
      if (!ceConvertWszToSz(&pszObjectId, pwszName, -1))
      {
    hr = E_OUTOFMEMORY;
    ceERRORPRINTLINE("ceConvertWszToSz", hr);
    goto error;
      }
      Entry.pszRegisteredID = pszObjectId;
      break;

  //case CERT_ALT_NAME_DIRECTORY_NAME:
  //case CERT_ALT_NAME_OTHER_NAME:
  //case CERT_ALT_NAME_X400_ADDRESS:
  //case CERT_ALT_NAME_EDI_PARTY_NAME:
  //case CERT_ALT_NAME_IP_ADDRESS:
  default:
      hr = E_INVALIDARG;
      ceERRORPRINTLINE("NameChoice", hr);
      goto error;

    }

    // Encode CERT_ALT_NAME_INFO:

    if (!CryptEncodeObject(
        X509_ASN_ENCODING,
        X509_ALTERNATE_NAME,
        &AltName,
        NULL,
        &cbEncoded))
    {
  hr = ceHLastError();
  ceERRORPRINTLINE("ceEncodeObject", hr);
  goto error;
    }

error:
    if (NULL != pszObjectId)
    {
  LocalFree(pszObjectId);
    }
    return(hr);
}

HRESULT ceVerifyObjId ( IN WCHAR const * pwszObjId )

Definition at line 676 of file CeLib.Cpp.

{
    HRESULT hr;
    CHAR *pszObjId = NULL;
    DWORD cbEncoded;
    CRYPT_ATTRIBUTE ainfo;

    if (!ceConvertWszToSz(&pszObjId, pwszObjId, -1))
    {
  hr = E_OUTOFMEMORY;
        ceERRORPRINTLINE("ceConvertWszToSz", hr);
        goto error;
    }

    ainfo.pszObjId = pszObjId;
    ainfo.cValue = 0;
    if (!CryptEncodeObject(
         X509_ASN_ENCODING,
         PKCS_ATTRIBUTE,
         &ainfo,
         NULL,
         &cbEncoded))
    {
        hr = E_INVALIDARG;
        ceERRORPRINTLINE("invalid Obj Id", hr);
        goto error;
    }
    hr = S_OK;

error:
    if (NULL != pszObjId)
    {
      LocalFree(pszObjId);
    }
    return(hr);
}

int ceWtoI | ( | IN WCHAR const * | string,
 |  | OUT BOOL * | pfValid
 | ) |  |

Definition at line 904 of file CeLib.Cpp.

{
    HRESULT hr;
    WCHAR szBuf[16];
    WCHAR *szTmp = szBuf;
    int cTmp = ARRAYSIZE(szBuf);
    int i = 0;
    WCHAR const *pwsz;
    BOOL fSawDigit = FALSE;

    assert(NULL != pfValid);
    cTmp = FoldString(
        MAP_FOLDDIGITS,
        string,
        -1,
        szTmp,
        cTmp);
    if (cTmp == 0)
    {
        hr = ceHLastError();
        if (HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) == hr)
        {
            hr = S_OK;
            cTmp = FoldString(
                MAP_FOLDDIGITS,
                string,
                -1,
                NULL,
                0);

            szTmp = (WCHAR*)LocalAlloc(LMEM_FIXED, cTmp*sizeof(WCHAR));
      if (NULL == szTmp)
      {
    hr = E_OUTOFMEMORY;
    _JumpError(hr, error, "LocalAlloc");
      }

            cTmp = FoldString(
                MAP_FOLDDIGITS,
                string,
                -1,
                szTmp,
                cTmp);

            if (cTmp == 0)
                hr = ceHLastError();
        }
        _JumpIfError(hr, error, "FoldString");
    }
    pwsz = szTmp;
    while (iswspace(*pwsz))
    {
  pwsz++;
    }
    while (iswdigit(*pwsz))
    {
  fSawDigit = TRUE;
  pwsz++;
    }
    while (iswspace(*pwsz))
    {
  pwsz++;
    }
    if (L'\0' == *pwsz)
    {
  *pfValid = fSawDigit;
    }
    i = _wtoi(szTmp);

error:
    if (szTmp && (szTmp != szBuf))
       LocalFree(szTmp);

    return i;
}

Variable Documentation

UNITSTABLE g_aut[]
Initial value:
{
    { wszDURATIONUNITSSECONDS, ENUM_PERIOD_SECONDS },
    { wszDURATIONUNITSMINUTES, ENUM_PERIOD_MINUTES },
    { wszDURATIONUNITSHOURS,   ENUM_PERIOD_HOURS },
    { wszDURATIONUNITSDAYS,    ENUM_PERIOD_DAYS },
    { wszDURATIONUNITSWEEKS,   ENUM_PERIOD_WEEKS },
    { wszDURATIONUNITSMONTHS,  ENUM_PERIOD_MONTHS },
    { wszDURATIONUNITSYEARS,   ENUM_PERIOD_YEARS },
}

Definition at line 631 of file CeLib.Cpp.

Generated on Wed Nov 13 2024 16:54:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Exit/C++/Windows2000/CeLibW2k.h File Reference

  • Security
  • CertServices
  • Exit
  • C++
  • Windows2000
Defines | Enumerations | Functions

CeLibW2k.h File Reference

Go to the source code of this file.

Defines

#define | _JumpError(hr, label, pszMessage)
#define | _JumpErrorStr(hr, label, pszMessage, pwsz) _JumpError((hr), label, (pszMessage))
#define | _JumpIfError(hr, label, pszMessage)
#define | _JumpIfError2(hr, label, pszMessage, hr2) _JumpIfError((hr), label, (pszMessage))
#define | _JumpIfErrorStr(hr, label, pszMessage, pwsz) _JumpIfError((hr), label, (pszMessage))
#define | _JumpIfErrorStr2(hr, label, pszMessage, pwsz, hr2) _JumpIfError((hr), label, (pszMessage))
#define | _PrintError(hr, pszMessage) ceERRORPRINTLINE((pszMessage), (hr))
#define | _PrintError2(hr, pszMessage, hr2) _PrintError((hr), (pszMessage))
#define | _PrintErrorStr(hr, pszMessage, pwsz) _PrintError((hr), (pszMessage))
#define | _PrintErrorStr2(hr, pszMessage, pwsz, hr2) _PrintError((hr), (pszMessage))
#define | _PrintIfError(hr, pszMessage)
#define | _PrintIfError2(hr, pszMessage, hr2) _PrintIfError((hr), (pszMessage))
#define | _PrintIfErrorStr(hr, pszMessage, pwsz) _PrintIfError((hr), (pszMessage))
#define | _PrintIfErrorStr2(hr, pszMessage, pwsz, hr2) _PrintIfError((hr), (pszMessage))
#define | ARRAYSIZE(a) (sizeof(a)/sizeof((a)[0]))
#define | BITSTOBYTES(b) ((int)(((b) + 7) / 8))
#define | ceERRORPRINTLINE(pszMessage, hr) ceErrorPrintLine(__FILE__, __LINE__, (pszMessage), (hr))
#define | CENCODEMAX (64 * 1024)
#define | CLEARBIT(pb, i) ((pb)[(i) / 8] &= ~(1 << ((i) % 8)))
#define | CVT_BASE (1000 * 1000 * 10)
#define | CVT_DAYS (24 * CVT_HOURS)
#define | CVT_HOURS (60 * CVT_MINUTES)
#define | CVT_MINUTES (60 * CVT_SECONDS)
#define | CVT_SECONDS (1)
#define | CVT_WEEKS (7 * CVT_DAYS)
#define | cwcFILENAMESUFFIXMAX 20
#define | cwcHRESULTSTRING 40
#define | cwcSUFFIXMAX (1 + 5 + 1)
#define | DBGPRINT(a) ceDbgPrintf a
#define | GETBIT(pb, i) ((pb)[(i) / 8] & (1 << ((i) % 8)))
#define | SAFE_SUBTRACT_POINTERS(p1, p2) (assert(sizeof((*p1)) == sizeof(*(p2))), ((p1) - (p2)))
#define | SETBIT(pb, i) ((pb)[(i) / 8] |= (1 << ((i) % 8)))
#define | wszCERTENROLLSHAREPATH L"CertSrv\\CertEnroll"
#define | wszFCSAPARM_CERTFILENAMESUFFIX L"%4"
#define | wszFCSAPARM_CONFIGDN L"%6"
#define | wszFCSAPARM_CRLDELTAFILENAMESUFFIX L"%9"
#define | wszFCSAPARM_CRLFILENAMESUFFIX L"%8"
#define | wszFCSAPARM_DOMAINDN L"%5"
#define | wszFCSAPARM_DSCACERTATTRIBUTE L"%11"
#define | wszFCSAPARM_DSCRLATTRIBUTE L"%10"
#define | wszFCSAPARM_SANITIZEDCANAME L"%3"
#define | wszFCSAPARM_SANITIZEDCANAMEHASH L"%7"
#define | wszFCSAPARM_SERVERDNSNAME L"%1"
#define | wszFCSAPARM_SERVERSHORTNAME L"%2"

Enumerations

enum ENUM_PERIOD {
ENUM_PERIOD_INVALID = -1, ENUM_PERIOD_SECONDS = 0, ENUM_PERIOD_MINUTES, ENUM_PERIOD_HOURS,
ENUM_PERIOD_DAYS, ENUM_PERIOD_WEEKS, ENUM_PERIOD_MONTHS, ENUM_PERIOD_YEARS,
ENUM_PERIOD_INVALID = -1, ENUM_PERIOD_SECONDS = 0, ENUM_PERIOD_MINUTES, ENUM_PERIOD_HOURS,
ENUM_PERIOD_DAYS, ENUM_PERIOD_WEEKS, ENUM_PERIOD_MONTHS, ENUM_PERIOD_YEARS
}

Functions

BOOL | ceConvertSzToBstr (OUT BSTR *pbstr, IN CHAR const *pch, IN LONG cch)
BOOL | ceConvertSzToWsz (OUT WCHAR **ppwsz, IN char const *pch, IN LONG cch)
BOOL | ceConvertWszToBstr (OUT BSTR *pbstr, IN WCHAR const *pwc, IN LONG cb)
BOOL | ceConvertWszToSz (OUT char **ppsz, IN WCHAR const *pwc, IN LONG cb)
HRESULT | ceDateToFileTime (IN DATE const *pDate, OUT FILETIME *pft)
int WINAPIV | ceDbgPrintf (BOOL fDebug, char const *pszfmt,...)
BOOL | ceDecodeObject (IN DWORD dwEncodingType, IN LPCSTR lpszStructType, IN BYTE const *pbEncoded, IN DWORD cbEncoded, IN BOOL fCoTaskMemAlloc, OUT VOID **ppvStructInfo, OUT DWORD *pcbStructInfo)
HRESULT | ceDispatchSetErrorInfo (IN HRESULT hrError, IN WCHAR const *pwszDescription, OPTIONAL IN WCHAR const *pwszProgId, OPTIONAL IN IID const *piid)
WCHAR * | ceDuplicateString (IN WCHAR const *pwsz)
BOOL | ceEncodeObject (DWORD dwEncodingType, IN LPCSTR lpszStructType, IN VOID const *pvStructInfo, IN DWORD dwFlags, IN BOOL fCoTaskMemAlloc, OUT BYTE **ppbEncoded, OUT DWORD *pcbEncoded)
VOID | ceErrorPrintLine (IN char const *pszFile, IN DWORD line, IN char const *pszMessage, IN HRESULT hr)
HRESULT | ceFileTimeToDate (IN FILETIME const *pft, OUT DATE *pDate)
HRESULT | ceFormatCertsrvStringArray (IN BOOL fURL, IN LPCWSTR pwszServerName_p1_2, IN LPCWSTR pwszSanitizedName_p3_7, IN DWORD iCert_p4, IN LPCWSTR pwszDomainDN_p5, IN LPCWSTR pwszConfigDN_p6, IN DWORD iCRL_p8, IN BOOL fDeltaCRL_p9, IN BOOL fDSAttrib_p10_11, IN DWORD cStrings, IN LPCWSTR *apwszStringsIn, OUT LPWSTR *apwszStringsOut)
VOID | ceFreeBstr (IN OUT BSTR *pstr)
WCHAR * | ceGetErrorMessageText (IN HRESULT hr, IN BOOL fHResultString)
WCHAR const * | ceGetOIDName (IN WCHAR const *pwszObjId)
WCHAR const * | ceGetOIDNameA (IN char const *pszObjId)
HRESULT | ceHError (IN HRESULT hr)
HRESULT | ceHLastError (VOID)
WCHAR const * | ceHResultToString (IN OUT WCHAR *awchr, IN HRESULT hr)
VOID | ceInitErrorMessageText (IN DWORD idsUnexpected, IN DWORD idsUnknownErrorCode)
HRESULT | ceInternetCanonicalizeUrl (IN WCHAR const *pwszIn, OUT WCHAR **ppwszOut)
HRESULT | ceMakeExprDate (IN OUT DATE *pDate, IN LONG lDelta, IN enum ENUM_PERIOD enumPeriod)
HRESULT | ceTranslatePeriodUnits (IN WCHAR const *pwszPeriod, IN LONG lCount, OUT enum ENUM_PERIOD *penumPeriod, OUT LONG *plCount)
HRESULT | ceVerifyAltNameString (IN LONG NameChoice, IN WCHAR const *pwszName)
HRESULT | ceVerifyObjId (IN WCHAR const *pwszObjId)
int | ceWtoI (IN WCHAR const *pwszDigitString, OUT BOOL *pfValid)

Define Documentation

#define _JumpError | ( | hr,
 |  | label,
 |  | pszMessage
 | ) |
Value:
{ \
  ceERRORPRINTLINE((pszMessage), (hr)); \
  goto label; \
    }

Definition at line 70 of file CeLibW2k.h.

#define _JumpErrorStr | ( | hr,
 |  | label,
 |  | pszMessage,
 |  | pwsz |
 | ) |  | _JumpError((hr), label, (pszMessage))

Definition at line 67 of file CeLibW2k.h.

#define _JumpIfError | ( | hr,
 |  | label,
 |  | pszMessage
 | ) |
Value:
{ \
  if (S_OK != (hr)) \
  { \
      ceERRORPRINTLINE((pszMessage), (hr)); \
      goto label; \
  } \
    }

Definition at line 86 of file CeLibW2k.h.

#define _JumpIfError2 | ( | hr,
 |  | label,
 |  | pszMessage,
 |  | hr2 |
 | ) |  | _JumpIfError((hr), label, (pszMessage))

Definition at line 83 of file CeLibW2k.h.

#define _JumpIfErrorStr | ( | hr,
 |  | label,
 |  | pszMessage,
 |  | pwsz |
 | ) |  | _JumpIfError((hr), label, (pszMessage))

Definition at line 77 of file CeLibW2k.h.

#define _JumpIfErrorStr2 | ( | hr,
 |  | label,
 |  | pszMessage,
 |  | pwsz,
 |  | hr2 |
 | ) |  | _JumpIfError((hr), label, (pszMessage))

Definition at line 80 of file CeLibW2k.h.

#define _PrintError | ( | hr,
 |  | pszMessage |
 | ) |  | ceERRORPRINTLINE((pszMessage), (hr))

Definition at line 45 of file CeLibW2k.h.

#define _PrintError2 | ( | hr,
 |  | pszMessage,
 |  | hr2 |
 | ) |  | _PrintError((hr), (pszMessage))

Definition at line 42 of file CeLibW2k.h.

#define _PrintErrorStr | ( | hr,
 |  | pszMessage,
 |  | pwsz |
 | ) |  | _PrintError((hr), (pszMessage))

Definition at line 36 of file CeLibW2k.h.

#define _PrintErrorStr2 | ( | hr,
 |  | pszMessage,
 |  | pwsz,
 |  | hr2 |
 | ) |  | _PrintError((hr), (pszMessage))

Definition at line 39 of file CeLibW2k.h.

#define _PrintIfError | ( | hr,
 |  | pszMessage
 | ) |
Value:
{ \
  if (S_OK != (hr)) \
  { \
      ceERRORPRINTLINE((pszMessage), (hr)); \
  } \
    }

Definition at line 58 of file CeLibW2k.h.

#define _PrintIfError2 | ( | hr,
 |  | pszMessage,
 |  | hr2 |
 | ) |  | _PrintIfError((hr), (pszMessage))

Definition at line 55 of file CeLibW2k.h.

#define _PrintIfErrorStr | ( | hr,
 |  | pszMessage,
 |  | pwsz |
 | ) |  | _PrintIfError((hr), (pszMessage))

Definition at line 49 of file CeLibW2k.h.

#define _PrintIfErrorStr2 | ( | hr,
 |  | pszMessage,
 |  | pwsz,
 |  | hr2 |
 | ) |  | _PrintIfError((hr), (pszMessage))

Definition at line 52 of file CeLibW2k.h.

#define ARRAYSIZE ( a ) (sizeof(a)/sizeof((a)[0]))

Definition at line 27 of file CeLibW2k.h.

#define BITSTOBYTES ( b ) ((int)(((b) + 7) / 8))

Definition at line 24 of file CeLibW2k.h.

#define ceERRORPRINTLINE | ( | pszMessage,
 |  | hr |
 | ) |  | ceErrorPrintLine(__FILE__, __LINE__, (pszMessage), (hr))

Definition at line 96 of file CeLibW2k.h.

#define CENCODEMAX (64 * 1024)

Definition at line 17 of file CeLibW2k.h.

#define CLEARBIT | ( | pb,
 |  | i |
 | ) |  | ((pb)[(i) / 8] &= ~(1 << ((i) % 8)))

Definition at line 22 of file CeLibW2k.h.

#define CVT_BASE (1000 * 1000 * 10)

Definition at line 126 of file CeLibW2k.h.

#define CVT_DAYS (24 * CVT_HOURS)

Definition at line 122 of file CeLibW2k.h.

#define CVT_HOURS (60 * CVT_MINUTES)

Definition at line 123 of file CeLibW2k.h.

#define CVT_MINUTES (60 * CVT_SECONDS)

Definition at line 124 of file CeLibW2k.h.

#define CVT_SECONDS (1)

Definition at line 125 of file CeLibW2k.h.

#define CVT_WEEKS (7 * CVT_DAYS)

Definition at line 121 of file CeLibW2k.h.

#define cwcFILENAMESUFFIXMAX 20

Definition at line 256 of file CeLibW2k.h.

#define cwcHRESULTSTRING 40

Definition at line 31 of file CeLibW2k.h.

#define cwcSUFFIXMAX (1 + 5 + 1)

Definition at line 257 of file CeLibW2k.h.

#define DBGPRINT ( a ) ceDbgPrintf a

Definition at line 99 of file CeLibW2k.h.

#define GETBIT | ( | pb,
 |  | i |
 | ) |  | ((pb)[(i) / 8] & (1 << ((i) % 8)))

Definition at line 20 of file CeLibW2k.h.

#define SAFE_SUBTRACT_POINTERS | ( | p1,
 |  | p2 |
 | ) |  | (assert(sizeof((*p1)) == sizeof(*(p2))), ((p1) - (p2)))

Definition at line 33 of file CeLibW2k.h.

#define SETBIT | ( | pb,
 |  | i |
 | ) |  | ((pb)[(i) / 8] |= (1 << ((i) % 8)))

Definition at line 21 of file CeLibW2k.h.

#define wszCERTENROLLSHAREPATH L"CertSrv\\CertEnroll"

Definition at line 29 of file CeLibW2k.h.

#define wszFCSAPARM_CERTFILENAMESUFFIX L"%4"

Definition at line 262 of file CeLibW2k.h.

#define wszFCSAPARM_CONFIGDN L"%6"

Definition at line 264 of file CeLibW2k.h.

#define wszFCSAPARM_CRLDELTAFILENAMESUFFIX L"%9"

Definition at line 267 of file CeLibW2k.h.

#define wszFCSAPARM_CRLFILENAMESUFFIX L"%8"

Definition at line 266 of file CeLibW2k.h.

#define wszFCSAPARM_DOMAINDN L"%5"

Definition at line 263 of file CeLibW2k.h.

#define wszFCSAPARM_DSCACERTATTRIBUTE L"%11"

Definition at line 269 of file CeLibW2k.h.

#define wszFCSAPARM_DSCRLATTRIBUTE L"%10"

Definition at line 268 of file CeLibW2k.h.

#define wszFCSAPARM_SANITIZEDCANAME L"%3"

Definition at line 261 of file CeLibW2k.h.

#define wszFCSAPARM_SANITIZEDCANAMEHASH L"%7"

Definition at line 265 of file CeLibW2k.h.

#define wszFCSAPARM_SERVERDNSNAME L"%1"

Definition at line 259 of file CeLibW2k.h.

#define wszFCSAPARM_SERVERSHORTNAME L"%2"

Definition at line 260 of file CeLibW2k.h.

Enumeration Type Documentation

enum ENUM_PERIOD
Enumerator:
ENUM_PERIOD_INVALID
ENUM_PERIOD_SECONDS
ENUM_PERIOD_MINUTES
ENUM_PERIOD_HOURS
ENUM_PERIOD_DAYS
ENUM_PERIOD_WEEKS
ENUM_PERIOD_MONTHS
ENUM_PERIOD_YEARS
ENUM_PERIOD_INVALID
ENUM_PERIOD_SECONDS
ENUM_PERIOD_MINUTES
ENUM_PERIOD_HOURS
ENUM_PERIOD_DAYS
ENUM_PERIOD_WEEKS
ENUM_PERIOD_MONTHS
ENUM_PERIOD_YEARS

Definition at line 129 of file CeLibW2k.h.

{
    ENUM_PERIOD_INVALID = -1,
    ENUM_PERIOD_SECONDS = 0,
    ENUM_PERIOD_MINUTES,
    ENUM_PERIOD_HOURS,
    ENUM_PERIOD_DAYS,
    ENUM_PERIOD_WEEKS,
    ENUM_PERIOD_MONTHS,
    ENUM_PERIOD_YEARS
};

Function Documentation

BOOL ceConvertSzToBstr | ( | OUT BSTR * | pbstr,
 |  | IN CHAR const * | pch,
 |  | IN LONG | cch
 | ) |  |

Definition at line 336 of file CeLib.Cpp.

{
    BOOL fOk = FALSE;
    BSTR bstr = NULL;
    LONG cwc = 0;

    ceFreeBstr(pbstr);
    if (-1 == cch)
    {
  cch = strlen(pch);
    }
    while (TRUE)
    {
  cwc = MultiByteToWideChar(GetACP(), 0, pch, cch, bstr, cwc);
  if (0 >= cwc)
  {
      //hr = ceHLastError();
      //printf("MultiByteToWideChar returned %d (%x)\n", hr, hr);
      break;
  }
  if (NULL != bstr)
  {
      bstr[cwc] = L'\0';
      *pbstr = bstr;
      fOk = TRUE;
      break;
  }
  bstr = SysAllocStringLen(NULL, cwc);
  if (NULL == bstr)
  {
      break;
  }
    }
    return(fOk);
}

BOOL ceConvertSzToWsz | ( | OUT WCHAR ** | ppwsz,
 |  | IN char const * | pch,
 |  | IN LONG | cch
 | ) |  |

Definition at line 295 of file CeLib.Cpp.

{
    BOOL fOk = FALSE;
    LONG cwc = 0;

    *ppwsz = NULL;
    while (TRUE)
    {
  cwc = MultiByteToWideChar(GetACP(), 0, pch, cch, *ppwsz, cwc);
  if (0 >= cwc)
  {
      DWORD err;

      err = GetLastError();
      ceERRORPRINTLINE("MultiByteToWideChar", err);
      if (NULL != *ppwsz)
      {
    LocalFree(*ppwsz);
    *ppwsz = NULL;
      }
      break;
  }
  if (NULL != *ppwsz)
  {
      fOk = TRUE;
      break;
  }
  *ppwsz = (WCHAR *) LocalAlloc(LMEM_FIXED, (cwc + 1) * sizeof(WCHAR));
  if (NULL == *ppwsz)
  {
      break;
  }
    }
    return(fOk);
}

BOOL ceConvertWszToBstr | ( | OUT BSTR * | pbstr,
 |  | IN WCHAR const * | pwc,
 |  | IN LONG | cb
 | ) |  |

Definition at line 263 of file CeLib.Cpp.

{
    BOOL fOk = FALSE;
    BSTR bstr;

    ceFreeBstr(pbstr);
    do
    {
  bstr = NULL;
  if (NULL != pwc)
  {
      if (-1 == cb)
      {
    cb = wcslen(pwc) * sizeof(WCHAR);
      }
      bstr = SysAllocStringByteLen((char const *) pwc, cb);
      if (NULL == bstr)
      {
    break;
      }
  }
  *pbstr = bstr;
  fOk = TRUE;
    } while (FALSE);
    return(fOk);
}

BOOL ceConvertWszToSz | ( | OUT char ** | ppsz,
 |  | IN WCHAR const * | pwc,
 |  | IN LONG | cb
 | ) |  |
HRESULT ceDateToFileTime | ( | IN DATE const * | pDate,
 |  | OUT FILETIME * | pft
 | ) |  |

Definition at line 450 of file CeLib.Cpp.

{
    SYSTEMTIME st;
    HRESULT hr = S_OK;

    if (*pDate == 0.0)
    {
        GetSystemTime(&st);
    }
    else
    {
  if (!VariantTimeToSystemTime(*pDate, &st))
  {
      hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
      _JumpError(hr, error, "VariantTimeToSystemTime");
  }
    }

    if (!SystemTimeToFileTime(&st, pft))
    {
        hr = ceHLastError();
        _JumpError(hr, error, "SystemTimeToFileTime");
    }

error:
    return(hr);
}

int WINAPIV ceDbgPrintf | ( | BOOL | fDebug,
 |  | char const * | pszfmt,
 |  |  | ...
 | ) |  |
BOOL ceDecodeObject | ( | IN DWORD | dwEncodingType,
 |  | IN LPCSTR | lpszStructType,
 |  | IN BYTE const * | pbEncoded,
 |  | IN DWORD | cbEncoded,
 |  | IN BOOL | fCoTaskMemAlloc,
 |  | OUT VOID ** | ppvStructInfo,
 |  | OUT DWORD * | pcbStructInfo
 | ) |  |

Definition at line 27 of file CeLib.Cpp.

{
    BOOL b;

    assert(!fCoTaskMemAlloc);
    *ppvStructInfo = NULL;
    *pcbStructInfo = 0;
    while (TRUE)
    {
  b = CryptDecodeObject(
        dwEncodingType,
        lpszStructType,
        pbEncoded,
        cbEncoded,
        0,                  // dwFlags
        *ppvStructInfo,
        pcbStructInfo);
  if (b && 0 == *pcbStructInfo)
  {
      SetLastError((DWORD) HRESULT_FROM_WIN32(ERROR_INVALID_DATA));
      b = FALSE;
  }
  if (!b)
  {
      if (NULL != *ppvStructInfo)
      {
    HRESULT hr = GetLastError();

    LocalFree(*ppvStructInfo);
    *ppvStructInfo = NULL;
    SetLastError(hr);
      }
      break;
  }
  if (NULL != *ppvStructInfo)
  {
      break;
  }
  *ppvStructInfo = (BYTE *) LocalAlloc(LMEM_FIXED, *pcbStructInfo);
  if (NULL == *ppvStructInfo)
  {
      b = FALSE;
      break;
  }
    }
    return(b);
}

HRESULT ceDispatchSetErrorInfo | ( | IN HRESULT | hrError,
 |  | IN WCHAR const * | pwszDescription,
 |  | OPTIONAL IN WCHAR const * | pwszProgId,
 |  | OPTIONAL IN IID const * | piid
 | ) |  |

Definition at line 997 of file CeLib.Cpp.

{
    HRESULT hr;
    WCHAR const *pwszError = NULL;
    WCHAR *pwszText = NULL;

    if (NULL == pwszDescription)
    {
        hr = E_POINTER;
  _JumpError(hr, error, "NULL pointer");
    }
    assert(FAILED(hrError));
    pwszError = ceGetErrorMessageText(hrError, TRUE);
    if (NULL == pwszError)
    {
  _PrintError(E_OUTOFMEMORY, "myGetErrorMessageText");
    }
    else
    {
  pwszText = (WCHAR *) LocalAlloc(
      LMEM_FIXED,
      (wcslen(pwszDescription) + 1 + wcslen(pwszError) + 1) *
       sizeof(WCHAR));
  if (NULL == pwszText)
  {
      _PrintError(E_OUTOFMEMORY, "LocalAlloc");
  }
  else
  {
      wcscpy(pwszText, pwszDescription);
      wcscat(pwszText, L" ");
      wcscat(pwszText, pwszError);
  }
    }
    hr = ceDispatchSetErrorInfoSub(
      hrError,
      NULL,   // pwszIDispatchMethod
      NULL != pwszText?
          pwszText : const_cast<WCHAR *>(pwszDescription),
      pwszProgId,
      piid,
      NULL,   // pwszHelpFile
      0);   // dwHelpFileContext
    _PrintIfError(hr, "ceDispatchSetErrorInfoSub");

error:
    if (NULL != pwszText)
    {
  LocalFree(pwszText);
    }
    if (NULL != pwszError)
    {
  LocalFree(const_cast<WCHAR *>(pwszError));
    }
    return(hrError);  // return input error!
}

WCHAR* ceDuplicateString ( IN WCHAR const * pwsz )

Definition at line 197 of file CeLib.Cpp.

{
    WCHAR *pwszOut;

    pwszOut = (WCHAR *) LocalAlloc(
        LMEM_FIXED,
        (wcslen(pwsz) + 1) * sizeof(pwsz[0]));
    if (NULL != pwszOut)
    {
  wcscpy(pwszOut, pwsz);
    }
    return(pwszOut);
}

BOOL ceEncodeObject | ( | DWORD | dwEncodingType,
 |  | IN LPCSTR | lpszStructType,
 |  | IN VOID const * | pvStructInfo,
 |  | IN DWORD | dwFlags,
 |  | IN BOOL | fCoTaskMemAlloc,
 |  | OUT BYTE ** | ppbEncoded,
 |  | OUT DWORD * | pcbEncoded
 | ) |  |
VOID ceErrorPrintLine | ( | IN char const * | pszFile,
 |  | IN DWORD | line,
 |  | IN char const * | pszMessage,
 |  | IN HRESULT | hr
 | ) |  |

Definition at line 421 of file CeLib.Cpp.

{
    wprintf(
  L"CertEnc.Dll: Error: %hs(%u): %hs 0x%x (%d)\n",
  pszFile,
  line,
  pszMessage,
  hr,
  hr);
}

HRESULT ceFileTimeToDate | ( | IN FILETIME const * | pft,
 |  | OUT DATE * | pDate
 | ) |  |

Definition at line 482 of file CeLib.Cpp.

{
    SYSTEMTIME st;
    HRESULT hr = S_OK;

    if (!FileTimeToSystemTime(pft, &st))
    {
        hr = ceHLastError();
        _JumpError(hr, error, "FileTimeToSystemTime");
    }
    if (!SystemTimeToVariantTime(&st, pDate))
    {
        hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
        _JumpError(hr, error, "SystemTimeToVariantTime");
    }

error:
    return(hr);
}

HRESULT ceFormatCertsrvStringArray | ( | IN BOOL | fURL,
 |  | IN LPCWSTR | pwszServerName_p1_2,
 |  | IN LPCWSTR | pwszSanitizedName_p3_7,
 |  | IN DWORD | iCert_p4,
 |  | IN LPCWSTR | pwszDomainDN_p5,
 |  | IN LPCWSTR | pwszConfigDN_p6,
 |  | IN DWORD | iCRL_p8,
 |  | IN BOOL | fDeltaCRL_p9,
 |  | IN BOOL | fDSAttrib_p10_11,
 |  | IN DWORD | cStrings,
 |  | IN LPCWSTR * | apwszStringsIn,
 |  | OUT LPWSTR * | apwszStringsOut
 | ) |  |

Definition at line 208 of file CeFormat.Cpp.

{
    HRESULT hr = S_OK;
    LPCWSTR apwszInsertionArray[100];  // 100 'cause this is the max number of insertion numbers allowed by FormatMessage
    LPWSTR    pwszCurrent = NULL;
    BSTR      strShortMachineName = NULL;
    DWORD     i;
    WCHAR *pwszSanitizedDSName = NULL;
    WCHAR wszCertSuffix[cwcFILENAMESUFFIXMAX];
    WCHAR wszCRLSuffix[cwcFILENAMESUFFIXMAX];
    WCHAR wszDeltaCRLSuffix[cwcFILENAMESUFFIXMAX];
    WCHAR const *pwszT;

    ZeroMemory(apwszStringsOut, cStrings * sizeof(apwszStringsOut[0]));
    ZeroMemory(apwszInsertionArray, sizeof(apwszInsertionArray));

    // Format the template into a real name

    // Initialize the insertion string array.
    // Machine DNS name (%1)

    assert(L'1' == wszFCSAPARM_SERVERDNSNAME[1]);
    apwszInsertionArray[1 - 1] = pwszServerName_p1_2;

    // Short Machine Name (%2)

    assert(L'2' == wszFCSAPARM_SERVERSHORTNAME[1]);
    strShortMachineName = SysAllocString(pwszServerName_p1_2);
    if (strShortMachineName == NULL)
    {
        hr = E_OUTOFMEMORY;
        _JumpIfError(hr, error, "SysAllocString");
    }

    pwszCurrent = wcschr(strShortMachineName, L'.');
    if(pwszCurrent)
    {
        *pwszCurrent = 0;
    }
    apwszInsertionArray[2 - 1] = strShortMachineName;

    // sanitized name (%3)

    assert(L'3' == wszFCSAPARM_SANITIZEDCANAME[1]);
    apwszInsertionArray[3 - 1] = pwszSanitizedName_p3_7;

    // Cert filename suffix (%4)

    assert(L'4' == wszFCSAPARM_CERTFILENAMESUFFIX[1]);
    wszCertSuffix[0] = L'\0';
    if (0 != iCert_p4)
    {
        wsprintf(wszCertSuffix, L"(%u)", iCert_p4);
    }
    apwszInsertionArray[4 - 1] = wszCertSuffix;

    assert(L'5' == wszFCSAPARM_DOMAINDN[1]);
    apwszInsertionArray[5 - 1] = pwszDomainDN_p5;

    assert(L'6' == wszFCSAPARM_CONFIGDN[1]);
    apwszInsertionArray[6 - 1] = pwszConfigDN_p6;

    // Don't pass pwszSanitizedName_p3_7 to SysAllocStringLen with the extended
    // length to avoid faulting past end of pwszSanitizedName_p3_7.

    assert(L'7' == wszFCSAPARM_SANITIZEDCANAMEHASH[1]);
    hr = ceSanitizedNameToDSName(pwszSanitizedName_p3_7, &pwszSanitizedDSName);
    _JumpIfError(hr, error, "ceSanitizedNameToDSName");

    apwszInsertionArray[7 - 1] = pwszSanitizedDSName;

    // CRL filename suffix (%8)

    assert(L'8' == wszFCSAPARM_CRLFILENAMESUFFIX[1]);
    wszCRLSuffix[0] = L'\0';
    if (0 != iCRL_p8)
    {
        wsprintf(wszCRLSuffix, L"(%u)", iCRL_p8);
    }
    apwszInsertionArray[8 - 1] = wszCRLSuffix;

    assert(L'9' == wszFCSAPARM_CRLDELTAFILENAMESUFFIX[1]);
    wszDeltaCRLSuffix[0] = L'\0';
    if (fDeltaCRL_p9)
    {
        wcscpy(wszDeltaCRLSuffix, L"+");
    }
    apwszInsertionArray[9 - 1] = wszDeltaCRLSuffix;

    assert(L'1' == wszFCSAPARM_DSCRLATTRIBUTE[1]);
    assert(L'0' == wszFCSAPARM_DSCRLATTRIBUTE[2]);
    pwszT = L"";
    if (fDSAttrib_p10_11)
    {
  pwszT = fDeltaCRL_p9?
        wszDSSEARCHDELTACRLATTRIBUTE :
        wszDSSEARCHBASECRLATTRIBUTE;
    }
    apwszInsertionArray[10 - 1] = pwszT;

    assert(L'1' == wszFCSAPARM_DSCACERTATTRIBUTE[1]);
    assert(L'1' == wszFCSAPARM_DSCACERTATTRIBUTE[2]);
    pwszT = L"";
    if (fDSAttrib_p10_11)
    {
  pwszT = wszDSSEARCHCACERTATTRIBUTE;
    }
    apwszInsertionArray[11 - 1] = pwszT;

    for (i = 0; i < cStrings; i++)
    {
        if (0 == FormatMessage(
      FORMAT_MESSAGE_ALLOCATE_BUFFER |
          FORMAT_MESSAGE_FROM_STRING |
          FORMAT_MESSAGE_ARGUMENT_ARRAY,
      (VOID *) apwszStringsIn[i],
      0,              // dwMessageID
      0,              // dwLanguageID
      (LPWSTR) &apwszStringsOut[i],
      (DWORD)wcslen(apwszStringsIn[i]),
      (va_list *) apwszInsertionArray))
        {
            hr = ceHLastError();
      _JumpError(hr, error, "FormatMessage");
        }
  if (fURL)
  {
      WCHAR *pwsz;

      hr = ceInternetCanonicalizeUrl(apwszStringsOut[i], &pwsz);
      _JumpIfError(hr, error, "ceInternetCanonicalizeUrl");

      LocalFree(apwszStringsOut[i]);
      apwszStringsOut[i] = pwsz;
  }
    }

error:
    if (S_OK != hr)
    {
  for (i = 0; i < cStrings; i++)
  {
      if (NULL != apwszStringsOut[i])
      {
    LocalFree(apwszStringsOut[i]);
    apwszStringsOut[i] = NULL;
      }
  }
    }
    if(strShortMachineName)
    {
        SysFreeString(strShortMachineName);
    }
    if (NULL != pwszSanitizedDSName)
    {
        LocalFree(pwszSanitizedDSName);
    }
    return (hr);
}

VOID ceFreeBstr ( IN OUT BSTR * pstr )

Definition at line 377 of file CeLib.Cpp.

{
    if (NULL != *pstr)
    {
  SysFreeString(*pstr);
  *pstr = NULL;
    }
}

WCHAR* ceGetErrorMessageText | ( | IN HRESULT | hr,
 |  | IN BOOL | fHResultString
 | ) |  |

Definition at line 312 of file CeError.Cpp.

{
    return(ceGetErrorMessageTextEx(hr, fHResultString, NULL));
}

WCHAR const* ceGetOIDName ( IN WCHAR const * pwszObjId )

Definition at line 175 of file CeLib.Cpp.

{
    char *pszObjId = NULL;
    WCHAR const *pwszName = L"";

    if (!ceConvertWszToSz(&pszObjId, pwszObjId, -1))
    {
  _JumpError(E_OUTOFMEMORY, error, "ceConvertWszToSz");
    }
    pwszName = ceGetOIDNameA(pszObjId);

error:
    if (NULL != pszObjId)
    {
  LocalFree(pszObjId);
    }
    return(pwszName);
}

WCHAR const* ceGetOIDNameA ( IN char const * pszObjId )

Definition at line 147 of file CeLib.Cpp.

{
    CRYPT_OID_INFO const *pInfo = NULL;
    WCHAR const *pwszName = L"";

    // First try looking up the ObjectId as an Extension or Attribute, because
    // we get a better Display Name, especially for Subject RDNs: CN, L, etc.
    // If that fails, look it up withoput restricting the group.

    pInfo = CryptFindOIDInfo(
      CRYPT_OID_INFO_OID_KEY,
      (VOID *) pszObjId,
      CRYPT_EXT_OR_ATTR_OID_GROUP_ID);

    if (NULL == pInfo || NULL == pInfo->pwszName || L'\0' == pInfo->pwszName[0])
    {
  pInfo = CryptFindOIDInfo(CRYPT_OID_INFO_OID_KEY, (VOID *) pszObjId, 0);
    }
    if (NULL != pInfo && NULL != pInfo->pwszName && L'\0' != pInfo->pwszName[0])
    {
  pwszName = pInfo->pwszName;
    }
    return(pwszName);
}

HRESULT ceHError ( IN HRESULT hr )

Definition at line 389 of file CeLib.Cpp.

{
    assert(S_FALSE != hr);

    if (S_OK != hr && S_FALSE != hr && !FAILED(hr))
    {
        hr = HRESULT_FROM_WIN32(hr);
  if ((HRESULT) 0 == HRESULT_CODE(hr))
  {
      // A call failed without properly setting an error condition!
      hr = E_UNEXPECTED;
  }
  assert(FAILED(hr));
    }
    return(hr);
}

HRESULT ceHLastError ( VOID )

Definition at line 409 of file CeLib.Cpp.

{
    return(ceHError(GetLastError()));
}

WCHAR const* ceHResultToString | ( | IN OUT WCHAR * | awchr,
 |  | IN HRESULT | hr
 | ) |  |

Definition at line 239 of file CeError.Cpp.

{
    return(ceHResultToStringEx(awchr, hr, FALSE));
}

VOID ceInitErrorMessageText | ( | IN DWORD | idsUnexpected,
 |  | IN DWORD | idsUnknownErrorCode
 | ) |  |

Definition at line 232 of file CeError.Cpp.

{
    s_idsUnexpected = idsUnexpected;
    s_idsUnknownErrorCode = idsUnknownErrorCode;
}

HRESULT ceInternetCanonicalizeUrl | ( | IN WCHAR const * | pwszIn,
 |  | OUT WCHAR ** | ppwszOut
 | ) |  |

Definition at line 105 of file ceformat.cpp.

{
    HRESULT hr;
    WCHAR *pwsz = NULL;

    assert(NULL != pwszIn);

    if (0 == _wcsnicmp(L"file:", pwszIn, 5))
    {
  hr = ceDupString(pwszIn, &pwsz);
        _JumpIfError(hr, error, "ceDupString");
    }
    else
    {
  // Calculate required buffer size by passing a very small buffer
  // The call will fail, and tell us how big the buffer should be.

  WCHAR wszPlaceHolder[1];
  DWORD cwc = ARRAYSIZE(wszPlaceHolder);
  BOOL bResult;

  bResult = InternetCanonicalizeUrl(
            pwszIn,   // lpszUrl
            wszPlaceHolder, // lpszBuffer
            &cwc,   // lpdwBufferLength
            0);   // dwFlags
  assert(!bResult); // This will always fail

  hr = ceHLastError();
  if (HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) != hr)
  {
      // unexpected error

      _JumpError(hr, error, "InternetCanonicalizeUrl");
  }

  // NOTE: InternetCanonicalizeUrl counts characters, not bytes as doc'd
  // cwc includes trailing L'0'

  pwsz = (WCHAR *) LocalAlloc(LMEM_FIXED, cwc * sizeof(WCHAR));
  if (NULL == pwsz)
  {
      hr = E_OUTOFMEMORY;
      _JumpError(hr, error, "LocalAlloc");
  }

  // canonicalize
  if (!InternetCanonicalizeUrl(
        pwszIn, // lpszUrl
        pwsz, // lpszBuffer
        &cwc, // lpdwBufferLength
        0))   // dwFlags
  {
      hr = ceHLastError();
      _JumpError(hr, error, "InternetCanonicalizeUrl");
  }
    }
    *ppwszOut = pwsz;
    pwsz = NULL;
    hr = S_OK;

error:
    if (NULL != pwsz)
    {
        LocalFree(pwsz);
    }
    return(hr);
}

HRESULT ceMakeExprDate | ( | IN OUT DATE * | pDate,
 |  | IN LONG | lDelta,
 |  | IN enum ENUM_PERIOD | enumPeriod
 | ) |  |

Definition at line 618 of file CeLib.Cpp.

{
    HRESULT hr;
    FILETIME ft;

    hr = ceDateToFileTime(pDate, &ft);
    _JumpIfError(hr, error, "ceDateToFileTime");

    ceMakeExprDateTime(&ft, lDelta, enumPeriod);

    hr = ceFileTimeToDate(&ft, pDate);
    _JumpIfError(hr, error, "ceFileTimeToDate");

error:
    return(hr);
}

HRESULT ceTranslatePeriodUnits | ( | IN WCHAR const * | pwszPeriod,
 |  | IN LONG | lCount,
 |  | OUT enum ENUM_PERIOD * | penumPeriod,
 |  | OUT LONG * | plCount
 | ) |  |

Definition at line 660 of file CeLib.Cpp.

{
    HRESULT hr;
    UNITSTABLE const *put;

    for (put = g_aut; put < &g_aut[CUNITSTABLEMAX]; put++)
    {
  if (0 == celstrcmpiL(pwszPeriod, put->pwszString))
  {
      *penumPeriod = put->enumPeriod;
      if (0 > lCount)
      {
    lCount = MAXLONG;
      }
      *plCount = lCount;
      hr = S_OK;
      goto error;
  }
    }
    hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);

error:
    return(hr);
}

HRESULT ceVerifyAltNameString | ( | IN LONG | NameChoice,
 |  | IN WCHAR const * | pwszName
 | ) |  |

Definition at line 716 of file CeLib.Cpp.

{
    HRESULT hr = S_OK;
    CERT_ALT_NAME_INFO AltName;
    CERT_ALT_NAME_ENTRY Entry;
    char *pszObjectId = NULL;
    DWORD cbEncoded;

    ZeroMemory(&AltName, sizeof(AltName));
    AltName.cAltEntry = 1;
    AltName.rgAltEntry = &Entry;

    ZeroMemory(&Entry, sizeof(Entry));
    Entry.dwAltNameChoice = NameChoice;

    switch (NameChoice)
    {
  case CERT_ALT_NAME_RFC822_NAME:
      Entry.pwszRfc822Name = const_cast<WCHAR *>(pwszName);
      break;

  case CERT_ALT_NAME_DNS_NAME:
      Entry.pwszDNSName = const_cast<WCHAR *>(pwszName);
      break;

  case CERT_ALT_NAME_URL:
      Entry.pwszURL = const_cast<WCHAR *>(pwszName);
      break;

  case CERT_ALT_NAME_REGISTERED_ID:
      if (!ceConvertWszToSz(&pszObjectId, pwszName, -1))
      {
    hr = E_OUTOFMEMORY;
    ceERRORPRINTLINE("ceConvertWszToSz", hr);
    goto error;
      }
      Entry.pszRegisteredID = pszObjectId;
      break;

  //case CERT_ALT_NAME_DIRECTORY_NAME:
  //case CERT_ALT_NAME_OTHER_NAME:
  //case CERT_ALT_NAME_X400_ADDRESS:
  //case CERT_ALT_NAME_EDI_PARTY_NAME:
  //case CERT_ALT_NAME_IP_ADDRESS:
  default:
      hr = E_INVALIDARG;
      ceERRORPRINTLINE("NameChoice", hr);
      goto error;

    }

    // Encode CERT_ALT_NAME_INFO:

    if (!CryptEncodeObject(
        X509_ASN_ENCODING,
        X509_ALTERNATE_NAME,
        &AltName,
        NULL,
        &cbEncoded))
    {
  hr = ceHLastError();
  ceERRORPRINTLINE("ceEncodeObject", hr);
  goto error;
    }

error:
    if (NULL != pszObjectId)
    {
  LocalFree(pszObjectId);
    }
    return(hr);
}

HRESULT ceVerifyObjId ( IN WCHAR const * pwszObjId )

Definition at line 808 of file CeLib.Cpp.

{
    HRESULT hr;
    CHAR *pszObjId = NULL;

    if (!ceConvertWszToSz(&pszObjId, pwszObjId, -1))
    {
  hr = E_OUTOFMEMORY;
  _JumpError(hr, error, "ceConvertWszToSz");
    }
    hr = ceVerifyObjIdA(pszObjId);
    _JumpIfErrorStr(hr, error, "ceVerifyObjIdA", pwszObjId);

error:
    if (NULL != pszObjId)
    {
      LocalFree(pszObjId);
    }
    return(hr);
}

int ceWtoI | ( | IN WCHAR const * | pwszDigitString,
 |  | OUT BOOL * | pfValid
 | ) |  |

Definition at line 1060 of file CeLib.Cpp.

{
    HRESULT hr;
    WCHAR szBuf[16];
    WCHAR *szTmp = szBuf;
    int cTmp = ARRAYSIZE(szBuf);
    int i = 0;
    WCHAR const *pwsz;
    BOOL fSawDigit = FALSE;

    if (pfValid == NULL)
    {
        hr = E_POINTER;
        _JumpError(hr, error, "NULLPARAM");
    }
    *pfValid = FALSE;

    assert(NULL != pfValid);
    cTmp = FoldString(
        MAP_FOLDDIGITS,
        string,
        -1,
        szTmp,
        cTmp);
    if (cTmp == 0)
    {
        hr = ceHLastError();
        if (HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) == hr)
        {
            hr = S_OK;
            cTmp = FoldString(
                MAP_FOLDDIGITS,
                string,
                -1,
                NULL,
                0);

            szTmp = (WCHAR*)LocalAlloc(LMEM_FIXED, cTmp*sizeof(WCHAR));
      if (NULL == szTmp)
      {
    hr = E_OUTOFMEMORY;
    _JumpError(hr, error, "LocalAlloc");
      }

            cTmp = FoldString(
                MAP_FOLDDIGITS,
                string,
                -1,
                szTmp,
                cTmp);

            if (cTmp == 0)
                hr = ceHLastError();
        }
        _JumpIfError(hr, error, "FoldString");
    }
    pwsz = szTmp;
    while (iswspace(*pwsz))
    {
  pwsz++;
    }
    while (iswdigit(*pwsz))
    {
  fSawDigit = TRUE;
  pwsz++;
    }
    while (iswspace(*pwsz))
    {
  pwsz++;
    }
    if (L'\0' == *pwsz)
    {
  *pfValid = fSawDigit;
    }
    i = _wtoi(szTmp);

error:
    if (szTmp && (szTmp != szBuf))
       LocalFree(szTmp);

    return i;
}

Generated on Wed Nov 13 2024 16:54:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Exit/C++/Windows2000/CertXSam.Cpp File Reference

  • Security
  • CertServices
  • Exit
  • C++
  • Windows2000
Functions | Variables

CertXSam.Cpp File Reference

#include "pch.cpp"
#include "celibw2k.h"
#include "exit.h"
#include "module.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 54 of file CertXSam.Cpp.

{
    return(_Module.GetLockCount() == 0? S_OK : S_FALSE);
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 64 of file CertXSam.Cpp.

{
    return(_Module.GetClassObject(rclsid, riid, ppv));
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 33 of file CertXSam.Cpp.

{
    switch (dwReason)
    {
  case DLL_PROCESS_ATTACH:
      _Module.Init(ObjectMap, hInstance);
      DisableThreadLibraryCalls(hInstance);
      break;

        case DLL_PROCESS_DETACH:
      _Module.Term();
            break;
    }
    return(TRUE);    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 74 of file CertXSam.Cpp.

{
    // registers object, typelib and all interfaces in typelib
    return(_Module.RegisterServer(TRUE));
}

STDAPI DllUnregisterServer ( void )

Definition at line 85 of file CertXSam.Cpp.

{
    _Module.UnregisterServer();
    return(S_OK);
}

Variable Documentation

CComModule _Module

Definition at line 20 of file CertXSam.Cpp.

Generated on Wed Nov 13 2024 16:54:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Exit/C++/Windows2000/CertXSam.Idl File Reference

  • Security
  • CertServices
  • Exit
  • C++
  • Windows2000
Functions | Variables

CertXSam.Idl File Reference

Go to the source code of this file.

Functions

library CERTEXITSAMPLELib | importlib ("stdole2.tlb")

Variables

import wtypes | idl

Function Documentation

library CERTEXITSAMPLELib importlib ( "stdole2.tlb" )

Variable Documentation

import certmod idl

Definition at line 12 of file CertXSam.Idl.

Generated on Wed Nov 13 2024 16:54:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Exit/C++/Windows2000/Exit.Cpp File Reference

  • Security
  • CertServices
  • Exit
  • C++
  • Windows2000
Defines | Functions | Variables

Exit.Cpp File Reference

#include "pch.cpp"
#include <stdio.h>
#include <assert.h>
#include "celibw2k.h"
#include "exit.h"
#include "module.h"

Go to the source code of this file.

Defines

#define | ceEXITEVENTS
#define | CERTTYPE_ATTR_NAME TEXT("CertificateTemplate")
#define | MAX_CRL_PROP (32 + 10)
#define | szOID_CERTTYPE_EXTENSION szOID_ENROLL_CERTTYPE_EXTENSION
#define | wszCertFile TEXT("CertFile")

Functions

HRESULT | GetServerCallbackInterface (OUT ICertServerExit **ppServer, IN LONG Context)

Variables

BOOL | fDebug = DBG_CERTSRV
HINSTANCE | g_hInstance

Define Documentation

#define ceEXITEVENTS
Value:
EXITEVENT_CERTISSUED | \
  EXITEVENT_CERTPENDING | \
  EXITEVENT_CERTDENIED | \
  EXITEVENT_CERTREVOKED | \
  EXITEVENT_CERTRETRIEVEPENDING | \
  EXITEVENT_CRLISSUED | \
  EXITEVENT_SHUTDOWN

Definition at line 31 of file Exit.Cpp.

#define CERTTYPE_ATTR_NAME TEXT("CertificateTemplate")

Definition at line 40 of file Exit.Cpp.

#define MAX_CRL_PROP (32 + 10)

Definition at line 42 of file Exit.Cpp.

#define szOID_CERTTYPE_EXTENSION szOID_ENROLL_CERTTYPE_EXTENSION

Definition at line 22 of file Exit.Cpp.

#define wszCertFile TEXT("CertFile")

Definition at line 41 of file Exit.Cpp.

Function Documentation

HRESULT GetServerCallbackInterface | ( | OUT ICertServerExit ** | ppServer,
 |  | IN LONG | Context
 | ) |  |

Definition at line 49 of file Exit.Cpp.

{
    HRESULT hr;

    if (NULL == ppServer)
    {
        hr = E_POINTER;
  _JumpError(hr, error, "Exit:NULL pointer");
    }

    hr = CoCreateInstance(
                    CLSID_CCertServerExit,
                    NULL,               // pUnkOuter
                    CLSCTX_INPROC_SERVER,
                    IID_ICertServerExit,
                    (VOID **) ppServer);
    _JumpIfError(hr, error, "Exit:CoCreateInstance");

    if (*ppServer == NULL)
    {
        hr = E_UNEXPECTED;
  _JumpError(hr, error, "Exit:NULL *ppServer");
    }

    // only set context if nonzero
    if (0 != Context)
    {
        hr = (*ppServer)->SetContext(Context);
        _JumpIfError(hr, error, "Exit: SetContext");
    }

error:
    return hr;
}

Variable Documentation

BOOL fDebug = DBG_CERTSRV

Definition at line 25 of file Exit.Cpp.

HINSTANCE g_hInstance

Definition at line 104 of file SServer.Cpp.

Generated on Wed Nov 13 2024 16:54:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Exit/C++/Windows2000/Exit.h File Reference

  • Security
  • CertServices
  • Exit
  • C++
  • Windows2000
Classes | Defines | Functions

Exit.h File Reference

#include "certxsam.h"
#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Classes

class | CCertExitSample

Defines

#define | CRL_PUBLISH_RETRY_DEFAULT 10
#define | wsz_SAMPLE_COPYRIGHT L"(c)1999-2000 Microsoft"
#define | wsz_SAMPLE_DESCRIPTION L"Sample Exit Module"
#define | wsz_SAMPLE_FILEVER L"v 1.0"
#define | wsz_SAMPLE_NAME L"CertXSam.dll"
#define | wsz_SAMPLE_PRODUCTVER L"v 5.00"
#define | wszCLASS_CERTEXITSAMPLE wszCLASS_CERTEXITSAMPLEPREFIX wszCERTEXITMODULE_POSTFIX
#define | wszCLASS_CERTEXITSAMPLEPREFIX TEXT("CertAuthority_Sample")
#define | wszCLASS_CERTMANAGESAMPLE wszCLASS_CERTEXITSAMPLEPREFIX wszCERTMANAGEEXIT_POSTFIX

Functions

HRESULT | GetServerCallbackInterface (OUT ICertServerExit **ppServer, IN LONG Context)

Define Documentation

#define CRL_PUBLISH_RETRY_DEFAULT 10

Definition at line 27 of file Exit.h.

#define wsz_SAMPLE_COPYRIGHT L"(c)1999-2000 Microsoft"

Definition at line 22 of file Exit.h.

#define wsz_SAMPLE_DESCRIPTION L"Sample Exit Module"

Definition at line 21 of file Exit.h.

#define wsz_SAMPLE_FILEVER L"v 1.0"

Definition at line 23 of file Exit.h.

#define wsz_SAMPLE_NAME L"CertXSam.dll"

Definition at line 20 of file Exit.h.

#define wsz_SAMPLE_PRODUCTVER L"v 5.00"

Definition at line 24 of file Exit.h.

#define wszCLASS_CERTEXITSAMPLE wszCLASS_CERTEXITSAMPLEPREFIX wszCERTEXITMODULE_POSTFIX

Definition at line 17 of file Exit.h.

#define wszCLASS_CERTEXITSAMPLEPREFIX TEXT("CertAuthority_Sample")

Definition at line 15 of file Exit.h.

#define wszCLASS_CERTMANAGESAMPLE wszCLASS_CERTEXITSAMPLEPREFIX wszCERTMANAGEEXIT_POSTFIX

Definition at line 18 of file Exit.h.

Function Documentation

HRESULT GetServerCallbackInterface | ( | OUT ICertServerExit ** | ppServer,
 |  | IN LONG | Context
 | ) |  |

Definition at line 39 of file exit.cpp.

{
    HRESULT hr;

    if (NULL == ppServer)
    {
        hr = E_POINTER;
  _JumpError(hr, error, "Exit:NULL pointer");
    }

    hr = CoCreateInstance(
                    CLSID_CCertServerExit,
                    NULL,               // pUnkOuter
                    CLSCTX_INPROC_SERVER,
                    IID_ICertServerExit,
                    (VOID **) ppServer);
    _JumpIfError(hr, error, "Exit:CoCreateInstance");

    if (*ppServer == NULL)
    {
        hr = E_UNEXPECTED;
  _JumpError(hr, error, "Exit:NULL *ppServer");
    }

    // only set context if nonzero
    if (0 != Context)
    {
        hr = (*ppServer)->SetContext(Context);
        _JumpIfError(hr, error, "Exit: SetContext");
    }

error:
    return(hr);
}

Generated on Wed Nov 13 2024 16:54:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Exit/C++/Windows2000/Module.Cpp File Reference

  • Security
  • CertServices
  • Exit
  • C++
  • Windows2000

Module.Cpp File Reference

#include "pch.cpp"
#include "celibw2k.h"
#include "module.h"
#include "exit.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Exit/C++/Windows2000/Module.h File Reference

  • Security
  • CertServices
  • Exit
  • C++
  • Windows2000
Classes

Module.h File Reference

#include "certxsam.h"
#include "resource.h"

Go to the source code of this file.

Classes

class CCertManageExitModuleSample
Generated on Wed Nov 13 2024 16:54:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Exit/C++/Windows2000/Pch.Cpp File Reference

  • Security
  • CertServices
  • Exit
  • C++
  • Windows2000
Variables

Pch.Cpp File Reference

#include <windows.h>
#include <atlbase.h>
#include <atlcom.h>
#include <certsrv.h>

Go to the source code of this file.

Variables

CComModule _Module

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:54:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Exit/C++/Windows2000/Resource.h File Reference

  • Security
  • CertServices
  • Exit
  • C++
  • Windows2000
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDS_CERTEXIT_DESC 1
#define | IDS_CERTMANAGEEXITMODULE_DESC 2

Define Documentation

#define IDS_CERTEXIT_DESC 1

Definition at line 15 of file Resource.h.

#define IDS_CERTMANAGEEXITMODULE_DESC 2

Definition at line 16 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Policy/C++/Windows.Net/atl.cpp File Reference

  • Security
  • CertServices
  • Policy
  • C++
  • Windows.Net

atl.cpp File Reference

#include <pch.cpp>
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Policy/C++/Windows.Net/cedebug.cpp File Reference

  • Security
  • CertServices
  • Policy
  • C++
  • Windows.Net
Functions

cedebug.cpp File Reference

#include <pch.cpp>
#include "celib.h"
#include <stdarg.h>

Go to the source code of this file.

Functions

int WINAPIV ceDbgPrintf (IN BOOL fDebug, IN LPCSTR lpFmt,...)

Function Documentation

int WINAPIV ceDbgPrintf | ( | IN BOOL | fDebug,
 |  | IN LPCSTR | lpFmt,
 |  |  | ...
 | ) |  |

Definition at line 31 of file cedebug.cpp.

{
    va_list arglist;
    CHAR ach[4096];
    int cch = 0;
    HANDLE hStdOut;
    DWORD dwErr;

    dwErr = GetLastError();
    if (fDebug)
    {
  __try
  {
      va_start(arglist, lpFmt);
      cch = _vsnprintf(ach, sizeof(ach), lpFmt, arglist);
      ach[ARRAYSIZE(ach)-1] = L'\0';
      va_end(arglist);

      if (0 > cch)
      {
    strcpy(&ach[sizeof(ach) - 5], "...\n");
      }

      if (!IsDebuggerPresent())
      {
    hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
    if (hStdOut != INVALID_HANDLE_VALUE)
    {
        fputs(ach, stdout);
        fflush(stdout);
    }
      }
      OutputDebugStringA(ach);
  }
  __except(EXCEPTION_EXECUTE_HANDLER)
  {
      // return failure
      cch = 0;
  }
    }
    SetLastError(dwErr);
    return(cch);
}

Generated on Wed Nov 13 2024 16:54:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Policy/C++/Windows.Net/ceerror.cpp File Reference

  • Security
  • CertServices
  • Policy
  • C++
  • Windows.Net
Defines | Functions

ceerror.cpp File Reference

#include <pch.cpp>
#include "celib.h"
#include <assert.h>
#include <ntdsbmsg.h>
#include <delayimp.h>
#include <wininet.h>

Go to the source code of this file.

Defines

#define | CERTLIB_12BITERRORMASK 0x00000fff
#define | CERTLIB_WIN32ERRORMASK 0x0000ffff
#define | DELAYLOAD_FROM_WIN32(hr) VcppException(ERROR_SEVERITY_ERROR, (hr))
#define | E_DELAYLOAD_MOD_NOT_FOUND DELAYLOAD_FROM_WIN32(ERROR_MOD_NOT_FOUND)
#define | E_DELAYLOAD_PROC_NOT_FOUND DELAYLOAD_FROM_WIN32(ERROR_PROC_NOT_FOUND)
#define | HRESULT_FROM_JETERROR(jerr) (ERROR_SEVERITY_ERROR | (FACILITY_NTDSB << 16) | -jerr)
#define | HRESULT_FROM_JETWARNING(jerr) (ERROR_SEVERITY_WARNING | (FACILITY_NTDSB << 16) | jerr)
#define | ISDELAYLOADHRESULT(hr)
#define | ISDELAYLOADHRESULTFACILITY(hr)
#define | ISHTTPERROR(hr) ((HRESULT) HTTP_STATUS_FIRST <= (hr) && (HRESULT) HTTP_STATUS_LAST >= (hr))
#define | ISHTTPHRESULT(hr) (ISWIN32HRESULT(hr) && ISHTTPERROR(WIN32ERROR_FROM_HRESULT(hr)))
#define | ISJETERROR(hr) ((~CERTLIB_WIN32ERRORMASK & (hr)) == (HRESULT) ~CERTLIB_WIN32ERRORMASK)
#define | ISJETHRESULT(hr)
#define | ISOSSERROR(hr) ((~CERTLIB_12BITERRORMASK & (hr)) == CRYPT_E_OSS_ERROR)
#define | ISSETUPHRESULT(hr)
#define | ISWIN32ERROR(hr) ((~CERTLIB_WIN32ERRORMASK & (hr)) == 0)
#define | ISWIN32HRESULT(hr)
#define | JETERROR_FROM_HRESULT(hr) (-(LONG) (CERTLIB_WIN32ERRORMASK & (hr)))
#define | OSSERROR_FROM_HRESULT(hr) (CERTLIB_12BITERRORMASK & (hr))
#define | WIN32ERROR_FROM_DELAYLOAD(hr) (CERTLIB_WIN32ERRORMASK & (hr))
#define | WIN32ERROR_FROM_HRESULT(hr) (CERTLIB_WIN32ERRORMASK & (hr))
#define | wszCOLONSPACE L": "
#define | wszHTTPERRORPREFIX L"HTTP"
#define | wszJETERRORPREFIX L"ESE"
#define | wszOSSERRORPREFIX L"ASN"
#define | wszSETUPERRORPREFIX L"INF"
#define | wszWIN32ERRORPREFIX L"WIN32"

Functions

WCHAR const * | ceGetErrorMessageText (IN HRESULT hr, IN BOOL fHResultString)
WCHAR const * | ceGetErrorMessageText1 (IN HRESULT hr, IN BOOL fHResultString, IN OPTIONAL WCHAR const *pwszInsertionText)
WCHAR const * | ceGetErrorMessageTextEx (IN HRESULT hr, IN BOOL fHResultString, IN OPTIONAL WCHAR const *const *papwszInsertionText)
HRESULT | ceHExceptionCode (IN EXCEPTION_POINTERS const *pep)
WCHAR const * | ceHResultToString (IN OUT WCHAR *awchr, IN HRESULT hr)
WCHAR const * | ceHResultToStringEx (IN OUT WCHAR *awchr, IN HRESULT hr, IN BOOL fRaw)
WCHAR const * | ceHResultToStringRaw (IN OUT WCHAR *awchr, IN HRESULT hr)
VOID | ceInitErrorMessageText (IN HMODULE hMod, IN DWORD idsUnexpected, IN DWORD idsUnknownErrorCode)
BOOL | ceIsDelayLoadHResult (IN HRESULT hr)
HRESULT | ceJetHResult (IN HRESULT hr)
DWORD | errFormatMessage (IN HMODULE hMod, IN HRESULT hr, OUT WCHAR const **ppwszOut, OPTIONAL IN WCHAR const *const *ppwszArgs)

Define Documentation

#define CERTLIB_12BITERRORMASK 0x00000fff

Definition at line 22 of file ceerror.cpp.

#define CERTLIB_WIN32ERRORMASK 0x0000ffff

Definition at line 23 of file ceerror.cpp.

#define DELAYLOAD_FROM_WIN32 ( hr ) VcppException(ERROR_SEVERITY_ERROR, (hr))

Definition at line 90 of file ceerror.cpp.

#define E_DELAYLOAD_MOD_NOT_FOUND DELAYLOAD_FROM_WIN32(ERROR_MOD_NOT_FOUND)

Definition at line 99 of file ceerror.cpp.

#define E_DELAYLOAD_PROC_NOT_FOUND DELAYLOAD_FROM_WIN32(ERROR_PROC_NOT_FOUND)

Definition at line 102 of file ceerror.cpp.

#define HRESULT_FROM_JETERROR ( jerr ) (ERROR_SEVERITY_ERROR | (FACILITY_NTDSB << 16) | -jerr)

Definition at line 32 of file ceerror.cpp.

#define HRESULT_FROM_JETWARNING ( jerr ) (ERROR_SEVERITY_WARNING | (FACILITY_NTDSB << 16) | jerr)

Definition at line 29 of file ceerror.cpp.

#define ISDELAYLOADHRESULT ( hr )
Value:
((HRESULT) E_DELAYLOAD_MOD_NOT_FOUND == (hr) || \
         (HRESULT) E_DELAYLOAD_PROC_NOT_FOUND == (hr) || \
         HRESULT_FROM_WIN32(ERROR_MOD_NOT_FOUND) == (hr) || \
         HRESULT_FROM_WIN32(ERROR_PROC_NOT_FOUND) == (hr))

Definition at line 104 of file ceerror.cpp.

#define ISDELAYLOADHRESULTFACILITY ( hr )
Value:
((~CERTLIB_WIN32ERRORMASK & (hr)) == (HRESULT) (ERROR_SEVERITY_ERROR | \
                                              (FACILITY_VISUALCPP << 16)))

Definition at line 94 of file ceerror.cpp.

#define ISHTTPERROR ( hr ) ((HRESULT) HTTP_STATUS_FIRST <= (hr) && (HRESULT) HTTP_STATUS_LAST >= (hr))

Definition at line 78 of file ceerror.cpp.

#define ISHTTPHRESULT ( hr ) (ISWIN32HRESULT(hr) && ISHTTPERROR(WIN32ERROR_FROM_HRESULT(hr)))

Definition at line 81 of file ceerror.cpp.

#define ISJETERROR ( hr ) ((~CERTLIB_WIN32ERRORMASK & (hr)) == (HRESULT) ~CERTLIB_WIN32ERRORMASK)

Definition at line 38 of file ceerror.cpp.

#define ISJETHRESULT ( hr )
Value:
((~CERTLIB_WIN32ERRORMASK & (hr)) == (HRESULT) (ERROR_SEVERITY_ERROR | \
                (FACILITY_NTDSB << 16)))

Definition at line 41 of file ceerror.cpp.

#define ISOSSERROR ( hr ) ((~CERTLIB_12BITERRORMASK & (hr)) == CRYPT_E_OSS_ERROR)

Definition at line 114 of file ceerror.cpp.

#define ISSETUPHRESULT ( hr )
Value:
((~CERTLIB_WIN32ERRORMASK & (hr)) == (HRESULT) (ERROR_SEVERITY_ERROR | \
                                              APPLICATION_ERROR_MASK | \
                                              (FACILITY_NULL << 16)))

Definition at line 51 of file ceerror.cpp.

#define ISWIN32ERROR ( hr ) ((~CERTLIB_WIN32ERRORMASK & (hr)) == 0)

Definition at line 62 of file ceerror.cpp.

#define ISWIN32HRESULT ( hr )
Value:
((~CERTLIB_WIN32ERRORMASK & (hr)) == (HRESULT) (ERROR_SEVERITY_WARNING | \
                (FACILITY_WIN32 << 16)))

Definition at line 65 of file ceerror.cpp.

#define JETERROR_FROM_HRESULT ( hr ) (-(LONG) (CERTLIB_WIN32ERRORMASK & (hr)))

Definition at line 35 of file ceerror.cpp.

#define OSSERROR_FROM_HRESULT ( hr ) (CERTLIB_12BITERRORMASK & (hr))

Definition at line 117 of file ceerror.cpp.

#define WIN32ERROR_FROM_DELAYLOAD ( hr ) (CERTLIB_WIN32ERRORMASK & (hr))

Definition at line 92 of file ceerror.cpp.

#define WIN32ERROR_FROM_HRESULT ( hr ) (CERTLIB_WIN32ERRORMASK & (hr))

Definition at line 69 of file ceerror.cpp.

#define wszCOLONSPACE L": "

Definition at line 176 of file ceerror.cpp.

#define wszHTTPERRORPREFIX L"HTTP"

Definition at line 84 of file ceerror.cpp.

#define wszJETERRORPREFIX L"ESE"

Definition at line 45 of file ceerror.cpp.

#define wszOSSERRORPREFIX L"ASN"

Definition at line 120 of file ceerror.cpp.

#define wszSETUPERRORPREFIX L"INF"

Definition at line 56 of file ceerror.cpp.

#define wszWIN32ERRORPREFIX L"WIN32"

Definition at line 72 of file ceerror.cpp.

Function Documentation

WCHAR const* ceGetErrorMessageText | ( | IN HRESULT | hr,
 |  | IN BOOL | fHResultString
 | ) |  |

Definition at line 312 of file ceerror.cpp.

{
    return(ceGetErrorMessageTextEx(hr, fHResultString, NULL));
}

WCHAR const* ceGetErrorMessageText1 | ( | IN HRESULT | hr,
 |  | IN BOOL | fHResultString,
 |  | IN OPTIONAL WCHAR const * | pwszInsertionText
 | ) |  |

Definition at line 321 of file ceerror.cpp.

{
    WCHAR const *apwszInsertionText[2];
    WCHAR const * const *papwsz = NULL;

    if (NULL != pwszInsertionText)
    {
  apwszInsertionText[0] = pwszInsertionText;
  apwszInsertionText[1] = NULL;
  papwsz = apwszInsertionText;
    }
    return(ceGetErrorMessageTextEx(hr, fHResultString, papwsz));
}

WCHAR const* ceGetErrorMessageTextEx | ( | IN HRESULT | hr,
 |  | IN BOOL | fHResultString,
 |  | IN OPTIONAL WCHAR const *const * | papwszInsertionText
 | ) |  |

Definition at line 340 of file ceerror.cpp.

{
    WCHAR const *pwszRet = NULL;
    WCHAR const *pwszRetStatic = NULL;
    WCHAR *pwszMsgT;
    WCHAR awchr[cwcHRESULTSTRING];
    DWORD cwc;
    DWORD cwcCopy;
    DWORD cwcUnexpected;
    WCHAR const *pwszUnexpected = NULL;
    WCHAR wszEmpty[] = L"";
    HMODULE hMod1 = NULL;
    HMODULE hMod2 = NULL;

    if (E_UNEXPECTED == hr)
    {
  pwszUnexpected = L"Unexpected method call sequence.";
    }
#if (0 == i386)
    else if (STATUS_DATATYPE_MISALIGNMENT == hr)
    {
  pwszUnexpected = L"Possible data alignment fault.";
    }
#endif
    if (NULL == pwszUnexpected)
    {
  pwszUnexpected = wszEmpty;
    }
    cwcUnexpected = wcslen(pwszUnexpected);

    cwc = errFormatMessage(NULL, hr, &pwszRet, papwszInsertionText);
    if (0 == cwc && ISDELAYLOADHRESULTFACILITY(hr))
    {
  cwc = errFormatMessage(
      NULL,
      WIN32ERROR_FROM_DELAYLOAD(hr),
      &pwszRet,
      papwszInsertionText);
    }
    if (0 == cwc)
    {
        hMod1 = LoadLibrary(L"ntdsbmsg.dll");
        if (NULL != hMod1)
        {
            HRESULT hrEDB = hr;
            HRESULT hrFormat;
            BOOL fFirst = TRUE;

            while (TRUE)
            {
                cwc = errFormatMessage(hMod1, hrEDB, &pwszRet, papwszInsertionText);
                if (0 == cwc && FAILED(hrEDB) && fFirst)
                {
                    hrFormat = ceHLastError();
                    if (HRESULT_FROM_WIN32(ERROR_MR_MID_NOT_FOUND) == hrFormat)
                    {
                        hrEDB = ceJetHResult(hrEDB);
                        if (hrEDB != hr)
                        {
                            fFirst = FALSE;
                            continue;
                        }
                    }
                }
                break;
            }
        }
    }
    if (0 == cwc)
    {
  HMODULE hModT = GetModuleHandle(L"wininet.dll");
        if (NULL != hModT)
        {
            HRESULT hrHttp = hr;
            HRESULT hrFormat;
            BOOL fFirst = TRUE;

            while (TRUE)
            {
    cwc = errFormatMessage(hModT, hrHttp, &pwszRet, papwszInsertionText);
                if (0 == cwc && ISWIN32HRESULT(hrHttp) && fFirst)
                {
                    hrFormat = ceHLastError();
                    if (HRESULT_FROM_WIN32(ERROR_MR_MID_NOT_FOUND) == hrFormat)
                    {
      hrHttp = WIN32ERROR_FROM_HRESULT(hrHttp);
                        if (hrHttp != hr)
                        {
                            fFirst = FALSE;
                            continue;
                        }
                    }
                }
                break;
            }
        }
    }
    if (0 == cwc)
    {
        hMod2 = LoadLibrary(L"cdosys.dll");
        if (NULL != hMod2)
        {
      cwc = errFormatMessage(hMod2, hr, &pwszRet, papwszInsertionText);
        }
    }

    if (0 == cwc) // couldn't find error, use default & error code
    {
  fHResultString = TRUE;
    }
    awchr[0] = L'\0';
    if (fHResultString)
    {
  ceHResultToString(awchr, hr);
    }

    if (0 == cwc)
    {
  pwszRetStatic = L"Error";
  pwszRet = pwszRetStatic;
    }

    // strip trailing \r\n

    cwcCopy = wcslen(pwszRet);
    if (2 <= cwcCopy &&
  L'\r' == pwszRet[cwcCopy - 2] &&
  L'\n' == pwszRet[cwcCopy - 1])
    {
  cwcCopy -= 2;
    }
    cwc = cwcCopy + 1 + cwcUnexpected + 1 + wcslen(awchr) + 1;
    pwszMsgT = (WCHAR *) LocalAlloc(LMEM_FIXED, cwc * sizeof(WCHAR));
    if (NULL == pwszMsgT)
    {
  _JumpError(E_OUTOFMEMORY, error, "LocalAlloc");
    }
    CopyMemory(pwszMsgT, pwszRet, cwcCopy * sizeof(WCHAR));
    pwszMsgT[cwcCopy] = L'\0';

    if (0 != cwcUnexpected)
    {
  wcscat(pwszMsgT, L" ");
  wcscat(pwszMsgT, pwszUnexpected);
    }
    if (fHResultString)
    {
  wcscat(pwszMsgT, L" ");
  wcscat(pwszMsgT, awchr);
    }
    assert(wcslen(pwszMsgT) < cwc);
    if (NULL != pwszRet && pwszRetStatic != pwszRet)
    {
  LocalFree(const_cast<WCHAR *>(pwszRet));
    }
    pwszRet = pwszMsgT;

error:
    if (NULL != hMod1)
    {
        FreeLibrary(hMod1);
    }
    if (NULL != hMod2)
    {
        FreeLibrary(hMod2);
    }
    return(pwszRet);
}

HRESULT ceHExceptionCode ( IN EXCEPTION_POINTERS const * pep )

Definition at line 153 of file ceerror.cpp.

{
    HRESULT hr = pep->ExceptionRecord->ExceptionCode;

#if (0 == i386)
    if ((HRESULT) STATUS_DATATYPE_MISALIGNMENT == hr)
    {
  hr = CERTSRV_E_ALIGNMENT_FAULT;
    }
#endif
    return(ceHError(hr));
}

WCHAR const* ceHResultToString | ( | IN OUT WCHAR * | awchr,
 |  | IN HRESULT | hr
 | ) |  |

Definition at line 239 of file ceerror.cpp.

{
    return(ceHResultToStringEx(awchr, hr, FALSE));
}

WCHAR const* ceHResultToStringEx | ( | IN OUT WCHAR * | awchr,
 |  | IN HRESULT | hr,
 |  | IN BOOL | fRaw
 | ) |  |

Definition at line 179 of file ceerror.cpp.

{
    HRESULT hrd;
    WCHAR const *pwszType;

    hrd = hr;
    pwszType = L"";
    if (ISJETERROR(hr))
    {
        pwszType = wszJETERRORPREFIX wszCOLONSPACE;
    }
    else if (ISJETHRESULT(hr))
    {
        hrd = JETERROR_FROM_HRESULT(hr);
        pwszType = wszJETERRORPREFIX wszCOLONSPACE;
    }
    else if (ISOSSERROR(hr))
    {
        hrd = OSSERROR_FROM_HRESULT(hr);
        pwszType = wszOSSERRORPREFIX wszCOLONSPACE;
    }
    else if (ISHTTPHRESULT(hr) || ISHTTPERROR(hr))
    {
        hrd = WIN32ERROR_FROM_HRESULT(hr);
        pwszType = wszWIN32ERRORPREFIX L"/" wszHTTPERRORPREFIX wszCOLONSPACE;
    }
    else if (ISWIN32HRESULT(hr) || ISWIN32ERROR(hr))
    {
        hrd = WIN32ERROR_FROM_HRESULT(hr);
        pwszType = wszWIN32ERRORPREFIX wszCOLONSPACE;
    }
    else if (ISDELAYLOADHRESULTFACILITY(hr))
    {
        hrd = WIN32ERROR_FROM_DELAYLOAD(hr);
        pwszType = wszWIN32ERRORPREFIX wszCOLONSPACE;
    }
    else if (ISSETUPHRESULT(hr))
    {
        pwszType = wszSETUPERRORPREFIX wszCOLONSPACE;
    }
    if (fRaw)
    {
        pwszType = L"";
    }

    _snwprintf(
        awchr,
        cwcHRESULTSTRING,
        L"0x%x (%ws%d)",
        hr,
        pwszType,
        hrd);
    return(awchr);
}

WCHAR const* ceHResultToStringRaw | ( | IN OUT WCHAR * | awchr,
 |  | IN HRESULT | hr
 | ) |  |

Definition at line 248 of file ceerror.cpp.

{
    return(ceHResultToStringEx(awchr, hr, TRUE));
}

VOID ceInitErrorMessageText | ( | IN HMODULE | hMod,
 |  | IN DWORD | idsUnexpected,
 |  | IN DWORD | idsUnknownErrorCode
 | ) |  |

Definition at line 261 of file ceerror.cpp.

{
    s_hMod = hMod;
    s_idsUnexpected = idsUnexpected;
    s_idsUnknownErrorCode = idsUnknownErrorCode;
}

BOOL ceIsDelayLoadHResult ( IN HRESULT hr )

Definition at line 169 of file ceerror.cpp.

{
    return(ISDELAYLOADHRESULT(hr));
}

HRESULT ceJetHResult ( IN HRESULT hr )

Definition at line 124 of file ceerror.cpp.

{
    if (S_OK != hr)
    {
        if (SUCCEEDED(hr))
        {
#if 0
            hr = HRESULT_FROM_JETWARNING(hr);
#else
            if (S_FALSE != hr)
            {
                _PrintError(hr, "JetHResult: mapping to S_FALSE");
            }
            assert(S_FALSE == hr);
            hr = S_FALSE;
#endif
        }
        else if (ISJETERROR(hr))
        {
            hr = HRESULT_FROM_JETERROR(hr);
        }
    }
    assert(S_OK == hr || S_FALSE == hr || FAILED(hr));
    return(hr);
}

DWORD errFormatMessage | ( | IN HMODULE | hMod,
 |  | IN HRESULT | hr,
 |  | OUT WCHAR const ** | ppwszOut,
 |  | OPTIONAL IN WCHAR const *const * | ppwszArgs
 | ) |  |

Definition at line 273 of file ceerror.cpp.

{
    DWORD dwFlags;

    dwFlags = FORMAT_MESSAGE_ALLOCATE_BUFFER;
    if (NULL == hMod)
    {
  dwFlags |= FORMAT_MESSAGE_FROM_SYSTEM;
    }
    else
    {
  dwFlags |= FORMAT_MESSAGE_FROM_HMODULE;
    }
    if (NULL == ppwszArgs || NULL == ppwszArgs[0])
    {
  dwFlags |= FORMAT_MESSAGE_IGNORE_INSERTS;
    }
    else
    {
  dwFlags |= FORMAT_MESSAGE_ARGUMENT_ARRAY;
    }
    return(FormatMessage(
    dwFlags,
                hMod,
                hr,
                MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
                (WCHAR *) ppwszOut,
                1,
    (va_list *) ppwszArgs));
}

Generated on Wed Nov 13 2024 16:54:28 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Policy/C++/Windows.Net/ceformat.cpp File Reference

  • Security
  • CertServices
  • Policy
  • C++
  • Windows.Net
Defines | Functions

ceformat.cpp File Reference

#include "pch.cpp"
#include "celib.h"
#include <assert.h>
#include <wininet.h>

Go to the source code of this file.

Defines

#define | cwcCHOPBASE (cwcCNMAX - (cwcCHOPHASHMAX + cwcSUFFIXMAX))
#define | cwcCHOPHASHMAX (1 + 5)
#define | cwcCNMAX 64
#define | wszDSSEARCHBASECRLATTRIBUTE L"?certificateRevocationList?base?objectclass=cRLDistributionPoint"
#define | wszDSSEARCHCACERTATTRIBUTE L"?cACertificate?base?objectclass=certificationAuthority"
#define | wszDSSEARCHCROSSCERTPAIRATTRIBUTE L"?crossCertificatePair?one?objectClass=certificationAuthority"
#define | wszDSSEARCHDELTACRLATTRIBUTE L"?deltaRevocationList?base?objectclass=cRLDistributionPoint"
#define | wszDSSEARCHKRACERTATTRIBUTE L"?userCertificate?one?objectClass=msPKI-PrivateKeyRecoveryAgent"
#define | wszDSSEARCHUSERCERTATTRIBUTE L"?userCertificate?base?objectClass=*"

Functions

HRESULT | ceDupString (IN WCHAR const *pwszIn, IN WCHAR **ppwszOut)
HRESULT | ceFormatCertsrvStringArray (IN BOOL fURL, IN LPCWSTR pwszServerName_p1_2, IN LPCWSTR pwszSanitizedName_p3_7, IN DWORD iCert_p4, IN DWORD iCertTarget_p4, IN LPCWSTR pwszDomainDN_p5, IN LPCWSTR pwszConfigDN_p6, IN DWORD iCRL_p8, IN BOOL fDeltaCRL_p9, IN BOOL fDSAttrib_p10_11, IN DWORD cStrings, IN LPCWSTR *apwszStringsIn, OUT LPWSTR *apwszStringsOut)
HRESULT | ceInternetCanonicalizeUrl (IN WCHAR const *pwszIn, OUT WCHAR **ppwszOut)
HRESULT | ceSanitizedNameToDSName (IN WCHAR const *pwszSanitizedName, OUT WCHAR **ppwszNameOut)

Define Documentation

#define cwcCHOPBASE (cwcCNMAX - (cwcCHOPHASHMAX + cwcSUFFIXMAX))

Definition at line 47 of file ceformat.cpp.

#define cwcCHOPHASHMAX (1 + 5)

Definition at line 46 of file ceformat.cpp.

#define cwcCNMAX 64

Definition at line 45 of file ceformat.cpp.

#define wszDSSEARCHBASECRLATTRIBUTE L"?certificateRevocationList?base?objectclass=cRLDistributionPoint"

Definition at line 212 of file ceformat.cpp.

#define wszDSSEARCHCACERTATTRIBUTE L"?cACertificate?base?objectclass=certificationAuthority"

Definition at line 220 of file ceformat.cpp.

#define wszDSSEARCHCROSSCERTPAIRATTRIBUTE L"?crossCertificatePair?one?objectClass=certificationAuthority"

Definition at line 232 of file ceformat.cpp.

#define wszDSSEARCHDELTACRLATTRIBUTE L"?deltaRevocationList?base?objectclass=cRLDistributionPoint"

Definition at line 216 of file ceformat.cpp.

#define wszDSSEARCHKRACERTATTRIBUTE L"?userCertificate?one?objectClass=msPKI-PrivateKeyRecoveryAgent"

Definition at line 228 of file ceformat.cpp.

#define wszDSSEARCHUSERCERTATTRIBUTE L"?userCertificate?base?objectClass=*"

Definition at line 224 of file ceformat.cpp.

Function Documentation

HRESULT ceDupString | ( | IN WCHAR const * | pwszIn,
 |  | IN WCHAR ** | ppwszOut
 | ) |  |

Definition at line 23 of file ceformat.cpp.

{
    DWORD cb;
    HRESULT hr;

    cb = (wcslen(pwszIn) + 1) * sizeof(WCHAR);
    *ppwszOut = (WCHAR *) LocalAlloc(LMEM_FIXED, cb);
    if (NULL == *ppwszOut)
    {
  hr = E_OUTOFMEMORY;
  _JumpError(hr, error, "LocalAlloc");
    }
    CopyMemory(*ppwszOut, pwszIn, cb);
    hr = S_OK;

error:
    return(hr);
}

HRESULT ceFormatCertsrvStringArray | ( | IN BOOL | fURL,
 |  | IN LPCWSTR | pwszServerName_p1_2,
 |  | IN LPCWSTR | pwszSanitizedName_p3_7,
 |  | IN DWORD | iCert_p4,
 |  | IN DWORD | iCertTarget_p4,
 |  | IN LPCWSTR | pwszDomainDN_p5,
 |  | IN LPCWSTR | pwszConfigDN_p6,
 |  | IN DWORD | iCRL_p8,
 |  | IN BOOL | fDeltaCRL_p9,
 |  | IN BOOL | fDSAttrib_p10_11,
 |  | IN DWORD | cStrings,
 |  | IN LPCWSTR * | apwszStringsIn,
 |  | OUT LPWSTR * | apwszStringsOut
 | ) |  |

Definition at line 237 of file ceformat.cpp.

{
    HRESULT hr = S_OK;
    LPCWSTR apwszInsertionArray[100];  // 100 'cause this is the max number of insertion numbers allowed by FormatMessage
    LPWSTR    pwszCurrent = NULL;
    BSTR      strShortMachineName = NULL;
    DWORD     i;
    WCHAR *pwszSanitizedDSName = NULL;
    WCHAR wszCertSuffix[2 * cwcFILENAMESUFFIXMAX];
    WCHAR wszCRLSuffix[cwcFILENAMESUFFIXMAX];
    WCHAR wszDeltaCRLSuffix[cwcFILENAMESUFFIXMAX];
    WCHAR const *pwszT;

    ZeroMemory(apwszStringsOut, cStrings * sizeof(apwszStringsOut[0]));
    ZeroMemory(apwszInsertionArray, sizeof(apwszInsertionArray));

    // Format the template into a real name
    // Initialize the insertion string array.

    //+================================================
    // Machine DNS name (%1)

    assert(L'1' == wszFCSAPARM_SERVERDNSNAME[1]);
    apwszInsertionArray[1 - 1] = pwszServerName_p1_2;

    //+================================================
    // Short Machine Name (%2)

    assert(L'2' == wszFCSAPARM_SERVERSHORTNAME[1]);
    strShortMachineName = SysAllocString(pwszServerName_p1_2);
    if (strShortMachineName == NULL)
    {
        hr = E_OUTOFMEMORY;
        _JumpIfError(hr, error, "SysAllocString");
    }

    pwszCurrent = wcschr(strShortMachineName, L'.');
    if (NULL != pwszCurrent)
    {
        *pwszCurrent = 0;
    }
    apwszInsertionArray[2 - 1] = strShortMachineName;

    //+================================================
    // sanitized name (%3)

    assert(L'3' == wszFCSAPARM_SANITIZEDCANAME[1]);
    apwszInsertionArray[3 - 1] = pwszSanitizedName_p3_7;

    //+================================================
    // Cert filename suffix (%4) | (%4-%4)

    assert(L'4' == wszFCSAPARM_CERTFILENAMESUFFIX[1]);
    wszCertSuffix[0] = L'\0';
    if (0 != iCert_p4 || MAXDWORD != iCertTarget_p4)
    {
        wsprintf(
      wszCertSuffix,
      MAXDWORD != iCertTarget_p4? L"(%u-%u)" : L"(%u)",
      iCert_p4,
      iCertTarget_p4);
    }
    apwszInsertionArray[4 - 1] = wszCertSuffix;

    //+================================================
    // Domain DN (%5)

    if (NULL == pwszDomainDN_p5 || L'\0' == *pwszDomainDN_p5)
    {
  pwszDomainDN_p5 = L"DC=UnavailableDomainDN";
    }
    assert(L'5' == wszFCSAPARM_DOMAINDN[1]);
    apwszInsertionArray[5 - 1] = pwszDomainDN_p5;

    //+================================================
    // Config DN (%6)

    if (NULL == pwszConfigDN_p6 || L'\0' == *pwszConfigDN_p6)
    {
  pwszConfigDN_p6 = L"DC=UnavailableConfigDN";
    }
    assert(L'6' == wszFCSAPARM_CONFIGDN[1]);
    apwszInsertionArray[6 - 1] = pwszConfigDN_p6;

    // Don't pass pwszSanitizedName_p3_7 to SysAllocStringLen with the extended
    // length to avoid faulting past end of pwszSanitizedName_p3_7.

    //+================================================
    // Sanitized Short Name (%7)

    assert(L'7' == wszFCSAPARM_SANITIZEDCANAMEHASH[1]);
    hr = ceSanitizedNameToDSName(pwszSanitizedName_p3_7, &pwszSanitizedDSName);
    _JumpIfError(hr, error, "ceSanitizedNameToDSName");

    apwszInsertionArray[7 - 1] = pwszSanitizedDSName;

    //+================================================
    // CRL filename suffix (%8)

    assert(L'8' == wszFCSAPARM_CRLFILENAMESUFFIX[1]);
    wszCRLSuffix[0] = L'\0';
    if (0 != iCRL_p8)
    {
        wsprintf(wszCRLSuffix, L"(%u)", iCRL_p8);
    }
    apwszInsertionArray[8 - 1] = wszCRLSuffix;

    //+================================================
    // Delta CRL filename suffix (%9)

    assert(L'9' == wszFCSAPARM_CRLDELTAFILENAMESUFFIX[1]);
    wszDeltaCRLSuffix[0] = L'\0';
    if (fDeltaCRL_p9)
    {
        wcscpy(wszDeltaCRLSuffix, L"+");
    }
    apwszInsertionArray[9 - 1] = wszDeltaCRLSuffix;

    //+================================================
    // CRL attribute (%10)

    assert(L'1' == wszFCSAPARM_DSCRLATTRIBUTE[1]);
    assert(L'0' == wszFCSAPARM_DSCRLATTRIBUTE[2]);
    pwszT = L"";
    if (fDSAttrib_p10_11)
    {
  pwszT = fDeltaCRL_p9?
        wszDSSEARCHDELTACRLATTRIBUTE :
        wszDSSEARCHBASECRLATTRIBUTE;
    }
    apwszInsertionArray[10 - 1] = pwszT;

    //+================================================
    // CA cert attribute (%11)

    assert(L'1' == wszFCSAPARM_DSCACERTATTRIBUTE[1]);
    assert(L'1' == wszFCSAPARM_DSCACERTATTRIBUTE[2]);
    pwszT = L"";
    if (fDSAttrib_p10_11)
    {
  pwszT = wszDSSEARCHCACERTATTRIBUTE;
    }
    apwszInsertionArray[11 - 1] = pwszT;

    //+================================================
    // User cert attribute (%12)

    assert(L'1' == wszFCSAPARM_DSUSERCERTATTRIBUTE[1]);
    assert(L'2' == wszFCSAPARM_DSUSERCERTATTRIBUTE[2]);
    pwszT = L"";
    if (fDSAttrib_p10_11)
    {
  pwszT = wszDSSEARCHUSERCERTATTRIBUTE;
    }
    apwszInsertionArray[12 - 1] = pwszT;

    //+================================================
    // KRA cert attribute (%13)

    assert(L'1' == wszFCSAPARM_DSKRACERTATTRIBUTE[1]);
    assert(L'3' == wszFCSAPARM_DSKRACERTATTRIBUTE[2]);
    pwszT = L"";
    if (fDSAttrib_p10_11)
    {
  pwszT = wszDSSEARCHKRACERTATTRIBUTE;
    }
    apwszInsertionArray[13 - 1] = pwszT;

    //+================================================
    // Cross cert pair attribute (%14)

    assert(L'1' == wszFCSAPARM_DSCROSSCERTPAIRATTRIBUTE[1]);
    assert(L'4' == wszFCSAPARM_DSCROSSCERTPAIRATTRIBUTE[2]);
    pwszT = L"";
    if (fDSAttrib_p10_11)
    {
  pwszT = wszDSSEARCHCROSSCERTPAIRATTRIBUTE;
    }
    apwszInsertionArray[14 - 1] = pwszT;

    //+================================================
    // Now format the strings...

    for (i = 0; i < cStrings; i++)
    {
        if (0 == FormatMessage(
      FORMAT_MESSAGE_ALLOCATE_BUFFER |
          FORMAT_MESSAGE_FROM_STRING |
          FORMAT_MESSAGE_ARGUMENT_ARRAY,
      (VOID *) apwszStringsIn[i],
      0,              // dwMessageID
      0,              // dwLanguageID
      (LPWSTR) &apwszStringsOut[i],
      wcslen(apwszStringsIn[i]),
      (va_list *) apwszInsertionArray))
        {
            hr = ceHLastError();
      _JumpError(hr, error, "FormatMessage");
        }
  if (fURL)
  {
      WCHAR *pwsz;

      hr = ceInternetCanonicalizeUrl(apwszStringsOut[i], &pwsz);
      _JumpIfError(hr, error, "ceInternetCanonicalizeUrl");

      LocalFree(apwszStringsOut[i]);
      apwszStringsOut[i] = pwsz;
  }
    }

error:
    if (S_OK != hr)
    {
  for (i = 0; i < cStrings; i++)
  {
      if (NULL != apwszStringsOut[i])
      {
    LocalFree(apwszStringsOut[i]);
    apwszStringsOut[i] = NULL;
      }
  }
    }
    if (NULL != strShortMachineName)
    {
        SysFreeString(strShortMachineName);
    }
    if (NULL != pwszSanitizedDSName)
    {
        LocalFree(pwszSanitizedDSName);
    }
    return (hr);
}

HRESULT ceInternetCanonicalizeUrl | ( | IN WCHAR const * | pwszIn,
 |  | OUT WCHAR ** | ppwszOut
 | ) |  |

Definition at line 105 of file ceformat.cpp.

{
    HRESULT hr;
    WCHAR *pwsz = NULL;

    assert(NULL != pwszIn);

    if (0 == _wcsnicmp(L"file:", pwszIn, 5))
    {
  hr = ceDupString(pwszIn, &pwsz);
        _JumpIfError(hr, error, "ceDupString");
    }
    else
    {
  // Calculate required buffer size by passing a very small buffer
  // The call will fail, and tell us how big the buffer should be.

  WCHAR wszPlaceHolder[1];
  DWORD cwc = ARRAYSIZE(wszPlaceHolder);
  BOOL bResult;

  bResult = InternetCanonicalizeUrl(
            pwszIn,   // lpszUrl
            wszPlaceHolder, // lpszBuffer
            &cwc,   // lpdwBufferLength
            0);   // dwFlags
  assert(!bResult); // This will always fail

  hr = ceHLastError();
  if (HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) != hr)
  {
      // unexpected error

      _JumpError(hr, error, "InternetCanonicalizeUrl");
  }

  // NOTE: InternetCanonicalizeUrl counts characters, not bytes as doc'd
  // cwc includes trailing L'0'

  pwsz = (WCHAR *) LocalAlloc(LMEM_FIXED, cwc * sizeof(WCHAR));
  if (NULL == pwsz)
  {
      hr = E_OUTOFMEMORY;
      _JumpError(hr, error, "LocalAlloc");
  }

  // canonicalize
  if (!InternetCanonicalizeUrl(
        pwszIn, // lpszUrl
        pwsz, // lpszBuffer
        &cwc, // lpdwBufferLength
        0))   // dwFlags
  {
      hr = ceHLastError();
      _JumpError(hr, error, "InternetCanonicalizeUrl");
  }
    }
    *ppwszOut = pwsz;
    pwsz = NULL;
    hr = S_OK;

error:
    if (NULL != pwsz)
    {
        LocalFree(pwsz);
    }
    return(hr);
}

HRESULT ceSanitizedNameToDSName | ( | IN WCHAR const * | pwszSanitizedName,
 |  | OUT WCHAR ** | ppwszNameOut
 | ) |  |

Definition at line 50 of file ceformat.cpp.

{
    HRESULT hr;
    DWORD cwc;
    DWORD cwcCopy;
    WCHAR wszDSName[cwcCHOPBASE + cwcCHOPHASHMAX + 1];

    *ppwszNameOut = NULL;

    cwc = wcslen(pwszSanitizedName);
    cwcCopy = cwc;
    if (cwcCHOPBASE < cwcCopy)
    {
  cwcCopy = cwcCHOPBASE;
    }
    CopyMemory(wszDSName, pwszSanitizedName, cwcCopy * sizeof(WCHAR));
    wszDSName[cwcCopy] = L'\0';

    if (cwcCHOPBASE < cwc)
    {
        // Hash the rest of the name into a USHORT
        USHORT usHash = 0;
  DWORD i;
  WCHAR *pwsz;

  // Truncate an incomplete sanitized Unicode character

  pwsz = wcsrchr(wszDSName, L'!');
  if (NULL != pwsz && wcslen(pwsz) < 5)
  {
      cwcCopy -= wcslen(pwsz);
      *pwsz = L'\0';
  }

        for (i = cwcCopy; i < cwc; i++)
        {
            USHORT usLowBit = (0x8000 & usHash)? 1 : 0;

      usHash = ((usHash << 1) | usLowBit) + pwszSanitizedName[i];
        }
  wsprintf(&wszDSName[cwcCopy], L"-%05hu", usHash);
  assert(wcslen(wszDSName) < ARRAYSIZE(wszDSName));
    }

    hr = ceDupString(wszDSName, ppwszNameOut);
    _JumpIfError(hr, error, "ceDupString");

error:
    return(hr);
}

Generated on Wed Nov 13 2024 16:54:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Policy/C++/Windows.Net/celib.cpp File Reference

  • Security
  • CertServices
  • Policy
  • C++
  • Windows.Net
Classes | Defines | Typedefs | Functions | Variables

celib.cpp File Reference

#include "pch.cpp"
#include "celib.h"
#include <assert.h>

Go to the source code of this file.

Classes

struct | _UNITSTABLE

Defines

#define | CUNITSTABLEMAX (sizeof(g_aut)/sizeof(g_aut[0]))

Typedefs

typedef struct _UNITSTABLE | UNITSTABLE

Functions

HRESULT | _IsConfigLocal (IN WCHAR const *pwszConfig, IN WCHAR const *pwszDnsName, IN WCHAR const *pwszOldName, OPTIONAL OUT WCHAR **ppwszMachine, OUT BOOL *pfLocal)
HRESULT | ceBuildPathAndExt (IN WCHAR const *pwszDir, IN WCHAR const *pwszFile, OPTIONAL IN WCHAR const *pwszExt, OUT WCHAR **ppwszPath)
BOOL | ceConvertSzToBstr (OUT BSTR *pbstr, IN CHAR const *pch, IN LONG cch)
BOOL | ceConvertSzToWsz (OUT WCHAR **ppwsz, IN char const *pch, IN LONG cch)
BOOL | ceConvertWszToBstr (OUT BSTR *pbstr, IN WCHAR const *pwc, IN LONG cb)
BOOL | ceConvertWszToSz (OUT CHAR **ppsz, IN WCHAR const *pwc, IN LONG cwc)
HRESULT | ceDateToFileTime (IN DATE const *pDate, OUT FILETIME *pft)
BOOL | ceDecodeObject (IN DWORD dwEncodingType, IN LPCSTR lpszStructType, IN BYTE const *pbEncoded, IN DWORD cbEncoded, IN BOOL fCoTaskMemAlloc, OUT VOID **ppvStructInfo, OUT DWORD *pcbStructInfo)
HRESULT | ceDispatchSetErrorInfo (IN HRESULT hrError, IN WCHAR const *pwszDescription, OPTIONAL IN WCHAR const *pwszProgId, OPTIONAL IN IID const *piid)
HRESULT | ceDispatchSetErrorInfoSub (IN HRESULT hrError, OPTIONAL IN WCHAR const *pwszIDispatchMethod, OPTIONAL IN WCHAR const *pwszDescription, OPTIONAL IN WCHAR const *pwszSource, OPTIONAL IN IID const *piid, OPTIONAL IN WCHAR const *pwszHelpFile, IN DWORD dwHelpFileContext)
WCHAR * | ceDuplicateString (IN WCHAR const *pwsz)
BOOL | ceEncodeObject (IN DWORD dwEncodingType, IN LPCSTR lpszStructType, IN VOID const *pvStructInfo, IN DWORD dwFlags, IN BOOL fCoTaskMemAlloc, OUT BYTE **ppbEncoded, OUT DWORD *pcbEncoded)
VOID | ceErrorPrintLine (IN char const *pszFile, IN DWORD line, IN char const *pszMessage, IN WCHAR const *pwszData, IN HRESULT hr)
HRESULT | ceFileTimeToDate (IN FILETIME const *pft, OUT DATE *pDate)
VOID | ceFreeBstr (IN OUT BSTR *pstr)
HRESULT | ceGetComputerNames (OUT WCHAR **ppwszDnsName, OUT WCHAR **ppwszOldName)
HRESULT | ceGetMachineDnsName (OUT WCHAR **ppwszDnsName)
WCHAR const * | ceGetOIDName (IN WCHAR const *pwszObjId)
WCHAR const * | ceGetOIDNameA (IN char const *pszObjId)
HRESULT | ceHError (IN HRESULT hr)
HRESULT | ceHLastError (VOID)
HRESULT | ceIsConfigLocal (IN WCHAR const *pwszConfig, OPTIONAL OUT WCHAR **ppwszMachine, OUT BOOL *pfLocal)
int | celstrcmpiL (IN WCHAR const *pwsz1, IN WCHAR const *pwsz2)
HRESULT | ceMakeExprDate (IN OUT DATE *pDate, IN LONG lDelta, IN enum ENUM_PERIOD enumPeriod)
VOID | ceMakeExprDateTime (IN OUT FILETIME *pft, IN LONG lDelta, IN enum ENUM_PERIOD enumPeriod)
HRESULT | ceTranslatePeriodUnits (IN WCHAR const *pwszPeriod, IN LONG lCount, OUT enum ENUM_PERIOD *penumPeriod, OUT LONG *plCount)
HRESULT | ceVerifyAltNameString (IN LONG NameChoice, IN BSTR strName)
HRESULT | ceVerifyObjId (IN WCHAR const *pwszObjId)
HRESULT | ceVerifyObjIdA (IN CHAR const *pszObjId)
int | ceWtoI (IN WCHAR const *string, OUT BOOL *pfValid)

Variables

UNITSTABLE g_aut []

Define Documentation

#define CUNITSTABLEMAX (sizeof(g_aut)/sizeof(g_aut[0]))

Definition at line 656 of file celib.cpp.

Typedef Documentation

typedef struct _UNITSTABLE UNITSTABLE

Function Documentation

HRESULT _IsConfigLocal | ( | IN WCHAR const * | pwszConfig,
 |  | IN WCHAR const * | pwszDnsName,
 |  | IN WCHAR const * | pwszOldName,
 |  | OPTIONAL OUT WCHAR ** | ppwszMachine,
 |  | OUT BOOL * | pfLocal
 | ) |  |

Definition at line 1243 of file celib.cpp.

{
    HRESULT hr;
    WCHAR *pwszMachine = NULL;
    WCHAR const *pwsz;
    DWORD cwc;

    *pfLocal = FALSE;
    if (NULL != ppwszMachine)
    {
  *ppwszMachine = NULL;
    }

    while (L'\\' == *pwszConfig)
    {
  pwszConfig++;
    }
    pwsz = wcschr(pwszConfig, L'\\');
    if (NULL != pwsz)
    {
  cwc = SAFE_SUBTRACT_POINTERS(pwsz, pwszConfig);
    }
    else
    {
  cwc = wcslen(pwszConfig);
    }
    pwszMachine = (WCHAR *) LocalAlloc(LMEM_FIXED, (cwc + 1) * sizeof(WCHAR));
    if (NULL == pwszMachine)
    {
  hr = E_OUTOFMEMORY;
  _JumpError(hr, error, "LocalAlloc");
    }
    CopyMemory(pwszMachine, pwszConfig, cwc * sizeof(WCHAR));
    pwszMachine[cwc] = L'\0';

    if (0 == celstrcmpiL(pwszMachine, pwszDnsName) ||
  0 == celstrcmpiL(pwszMachine, pwszOldName))
    {
  *pfLocal = TRUE;
    }
    if (NULL != ppwszMachine)
    {
  *ppwszMachine = pwszMachine;
  pwszMachine = NULL;
    }
    hr = S_OK;

error:
    if (NULL != pwszMachine)
    {
  LocalFree(pwszMachine);
    }
    return(hr);
}

HRESULT ceBuildPathAndExt | ( | IN WCHAR const * | pwszDir,
 |  | IN WCHAR const * | pwszFile,
 |  | OPTIONAL IN WCHAR const * | pwszExt,
 |  | OUT WCHAR ** | ppwszPath
 | ) |  |

Definition at line 1345 of file celib.cpp.

{
    HRESULT hr;
    WCHAR *pwsz;
    DWORD cwc;

    *ppwszPath = NULL;
    cwc = wcslen(pwszDir) + 1 + wcslen(pwszFile) + 1;
    if (NULL != pwszExt)
    {
  cwc += wcslen(pwszExt);
    }

    pwsz = (WCHAR *) LocalAlloc(LMEM_FIXED, cwc * sizeof(WCHAR));
    if (NULL == pwsz)
    {
  hr = E_OUTOFMEMORY;
  _JumpError(hr, error, "LocalAlloc");
    }
    wcscpy(pwsz, pwszDir);
    if (L'\\' != pwsz[wcslen(pwsz) - 1])
    {
  wcscat(pwsz, L"\\");
    }
    wcscat(pwsz, pwszFile);
    if (NULL != pwszExt)
    {
  wcscat(pwsz, pwszExt);
    }
    *ppwszPath = pwsz;
    hr = S_OK;

error:
    return(hr);
}

BOOL ceConvertSzToBstr | ( | OUT BSTR * | pbstr,
 |  | IN CHAR const * | pch,
 |  | IN LONG | cch
 | ) |  |

Definition at line 336 of file celib.cpp.

{
    BOOL fOk = FALSE;
    BSTR bstr = NULL;
    LONG cwc = 0;

    ceFreeBstr(pbstr);
    if (-1 == cch)
    {
  cch = strlen(pch);
    }
    while (TRUE)
    {
  cwc = MultiByteToWideChar(GetACP(), 0, pch, cch, bstr, cwc);
  if (0 >= cwc)
  {
      //hr = ceHLastError();
      //printf("MultiByteToWideChar returned %d (%x)\n", hr, hr);
      break;
  }
  if (NULL != bstr)
  {
      bstr[cwc] = L'\0';
      *pbstr = bstr;
      fOk = TRUE;
      break;
  }
  bstr = SysAllocStringLen(NULL, cwc);
  if (NULL == bstr)
  {
      break;
  }
    }
    return(fOk);
}

BOOL ceConvertSzToWsz | ( | OUT WCHAR ** | ppwsz,
 |  | IN char const * | pch,
 |  | IN LONG | cch
 | ) |  |

Definition at line 295 of file celib.cpp.

{
    BOOL fOk = FALSE;
    LONG cwc = 0;

    *ppwsz = NULL;
    while (TRUE)
    {
  cwc = MultiByteToWideChar(GetACP(), 0, pch, cch, *ppwsz, cwc);
  if (0 >= cwc)
  {
      DWORD err;

      err = GetLastError();
      ceERRORPRINTLINE("MultiByteToWideChar", err);
      if (NULL != *ppwsz)
      {
    LocalFree(*ppwsz);
    *ppwsz = NULL;
      }
      break;
  }
  if (NULL != *ppwsz)
  {
      fOk = TRUE;
      break;
  }
  *ppwsz = (WCHAR *) LocalAlloc(LMEM_FIXED, (cwc + 1) * sizeof(WCHAR));
  if (NULL == *ppwsz)
  {
      break;
  }
    }
    return(fOk);
}

BOOL ceConvertWszToBstr | ( | OUT BSTR * | pbstr,
 |  | IN WCHAR const * | pwc,
 |  | IN LONG | cb
 | ) |  |

Definition at line 263 of file celib.cpp.

{
    BOOL fOk = FALSE;
    BSTR bstr;

    ceFreeBstr(pbstr);
    do
    {
  bstr = NULL;
  if (NULL != pwc)
  {
      if (-1 == cb)
      {
    cb = wcslen(pwc) * sizeof(WCHAR);
      }
      bstr = SysAllocStringByteLen((char const *) pwc, cb);
      if (NULL == bstr)
      {
    break;
      }
  }
  *pbstr = bstr;
  fOk = TRUE;
    } while (FALSE);
    return(fOk);
}

BOOL ceConvertWszToSz | ( | OUT CHAR ** | ppsz,
 |  | IN WCHAR const * | pwc,
 |  | IN LONG | cwc
 | ) |  |

Definition at line 214 of file celib.cpp.

{
    BOOL fOk = FALSE;
    LONG cch = 0;

    *ppsz = NULL;
    while (TRUE)
    {
  cch = WideCharToMultiByte(
      GetACP(),
      0,          // dwFlags
      pwc,
      cwc,        // cchWideChar, -1 => null terminated
      *ppsz,
      cch,
      NULL,
      NULL);
  if (0 >= cch)
  {
      DWORD err;

      err = GetLastError();
      ceERRORPRINTLINE("WideCharToMultiByte", err);
      if (NULL != *ppsz)
      {
    LocalFree(*ppsz);
    *ppsz = NULL;
      }
      break;
  }
  if (NULL != *ppsz)
  {
      fOk = TRUE;
      break;
  }
  *ppsz = (CHAR *) LocalAlloc(LMEM_FIXED, cch + 1);
  if (NULL == *ppsz)
  {
      break;
  }
    }
    return(fOk);
}

HRESULT ceDateToFileTime | ( | IN DATE const * | pDate,
 |  | OUT FILETIME * | pft
 | ) |  |

Definition at line 450 of file celib.cpp.

{
    SYSTEMTIME st;
    HRESULT hr = S_OK;

    if (*pDate == 0.0)
    {
        GetSystemTime(&st);
    }
    else
    {
  if (!VariantTimeToSystemTime(*pDate, &st))
  {
      hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
      _JumpError(hr, error, "VariantTimeToSystemTime");
  }
    }

    if (!SystemTimeToFileTime(&st, pft))
    {
        hr = ceHLastError();
        _JumpError(hr, error, "SystemTimeToFileTime");
    }

error:
    return(hr);
}

BOOL ceDecodeObject | ( | IN DWORD | dwEncodingType,
 |  | IN LPCSTR | lpszStructType,
 |  | IN BYTE const * | pbEncoded,
 |  | IN DWORD | cbEncoded,
 |  | IN BOOL | fCoTaskMemAlloc,
 |  | OUT VOID ** | ppvStructInfo,
 |  | OUT DWORD * | pcbStructInfo
 | ) |  |

Definition at line 27 of file celib.cpp.

{
    BOOL b;

    assert(!fCoTaskMemAlloc);
    *ppvStructInfo = NULL;
    *pcbStructInfo = 0;
    while (TRUE)
    {
  b = CryptDecodeObject(
        dwEncodingType,
        lpszStructType,
        pbEncoded,
        cbEncoded,
        0,                  // dwFlags
        *ppvStructInfo,
        pcbStructInfo);
  if (b && 0 == *pcbStructInfo)
  {
      SetLastError((DWORD) HRESULT_FROM_WIN32(ERROR_INVALID_DATA));
      b = FALSE;
  }
  if (!b)
  {
      if (NULL != *ppvStructInfo)
      {
    HRESULT hr = GetLastError();

    LocalFree(*ppvStructInfo);
    *ppvStructInfo = NULL;
    SetLastError(hr);
      }
      break;
  }
  if (NULL != *ppvStructInfo)
  {
      break;
  }
  *ppvStructInfo = (BYTE *) LocalAlloc(LMEM_FIXED, *pcbStructInfo);
  if (NULL == *ppvStructInfo)
  {
      b = FALSE;
      break;
  }
    }
    return(b);
}

HRESULT ceDispatchSetErrorInfo | ( | IN HRESULT | hrError,
 |  | IN WCHAR const * | pwszDescription,
 |  | OPTIONAL IN WCHAR const * | pwszProgId,
 |  | OPTIONAL IN IID const * | piid
 | ) |  |

Definition at line 997 of file celib.cpp.

{
    HRESULT hr;
    WCHAR const *pwszError = NULL;
    WCHAR *pwszText = NULL;

    if (NULL == pwszDescription)
    {
        hr = E_POINTER;
  _JumpError(hr, error, "NULL pointer");
    }
    assert(FAILED(hrError));
    pwszError = ceGetErrorMessageText(hrError, TRUE);
    if (NULL == pwszError)
    {
  _PrintError(E_OUTOFMEMORY, "myGetErrorMessageText");
    }
    else
    {
  pwszText = (WCHAR *) LocalAlloc(
      LMEM_FIXED,
      (wcslen(pwszDescription) + 1 + wcslen(pwszError) + 1) *
       sizeof(WCHAR));
  if (NULL == pwszText)
  {
      _PrintError(E_OUTOFMEMORY, "LocalAlloc");
  }
  else
  {
      wcscpy(pwszText, pwszDescription);
      wcscat(pwszText, L" ");
      wcscat(pwszText, pwszError);
  }
    }
    hr = ceDispatchSetErrorInfoSub(
      hrError,
      NULL,   // pwszIDispatchMethod
      NULL != pwszText?
          pwszText : const_cast<WCHAR *>(pwszDescription),
      pwszProgId,
      piid,
      NULL,   // pwszHelpFile
      0);   // dwHelpFileContext
    _PrintIfError(hr, "ceDispatchSetErrorInfoSub");

error:
    if (NULL != pwszText)
    {
  LocalFree(pwszText);
    }
    if (NULL != pwszError)
    {
  LocalFree(const_cast<WCHAR *>(pwszError));
    }
    return(hrError);  // return input error!
}

HRESULT ceDispatchSetErrorInfoSub | ( | IN HRESULT | hrError,
 |  | OPTIONAL IN WCHAR const * | pwszIDispatchMethod,
 |  | OPTIONAL IN WCHAR const * | pwszDescription,
 |  | OPTIONAL IN WCHAR const * | pwszSource,
 |  | OPTIONAL IN IID const * | piid,
 |  | OPTIONAL IN WCHAR const * | pwszHelpFile,
 |  | IN DWORD | dwHelpFileContext
 | ) |  |

Definition at line 924 of file celib.cpp.

{
    HRESULT hr;
    WCHAR const *pwszError = NULL;
    ICreateErrorInfo *pCreateErrorInfo = NULL;
    IErrorInfo *pErrorInfo = NULL;

    if (NULL != pwszIDispatchMethod)
    {
  pwszError = ceGetErrorMessageText(hrError, TRUE);
    }

    hr = CreateErrorInfo(&pCreateErrorInfo);
    _JumpIfError(hr, error, "CreateErrorInfo");

    if (NULL != piid)
    {
  hr = pCreateErrorInfo->SetGUID(*piid);
  _PrintIfError(hr, "SetGUID");
    }
    if (NULL != pwszSource)
    {
  hr = pCreateErrorInfo->SetSource(const_cast<WCHAR *>(pwszSource));
  _PrintIfError(hr, "SetSource");
    }
    if (NULL != pwszDescription)
    {
  hr = pCreateErrorInfo->SetDescription(
          const_cast<WCHAR *>(pwszDescription));
  _PrintIfError(hr, "SetDescription");
    }
    if (NULL != pwszHelpFile)
    {
  hr = pCreateErrorInfo->SetHelpFile(const_cast<WCHAR *>(pwszHelpFile));
  _PrintIfError(hr, "SetHelpFile");

  hr = pCreateErrorInfo->SetHelpContext(dwHelpFileContext);
  _PrintIfError(hr, "SetHelpContext");
    }

    hr = pCreateErrorInfo->QueryInterface(
            IID_IErrorInfo,
            (VOID **) &pErrorInfo);
    _JumpIfError(hr, error, "QueryInterface");

    SetErrorInfo(0, pErrorInfo);
    hr = S_OK;

error:
    if (NULL != pwszError)
    {
  LocalFree(const_cast<WCHAR *>(pwszError));
    }
    if (NULL != pErrorInfo)
    {
  pErrorInfo->Release();
    }
    if (NULL != pCreateErrorInfo)
    {
  pCreateErrorInfo->Release();
    }
    return(hr);
}

WCHAR* ceDuplicateString ( IN WCHAR const * pwsz )

Definition at line 197 of file celib.cpp.

{
    WCHAR *pwszOut;

    pwszOut = (WCHAR *) LocalAlloc(
        LMEM_FIXED,
        (wcslen(pwsz) + 1) * sizeof(pwsz[0]));
    if (NULL != pwszOut)
    {
  wcscpy(pwszOut, pwsz);
    }
    return(pwszOut);
}

BOOL ceEncodeObject | ( | IN DWORD | dwEncodingType,
 |  | IN LPCSTR | lpszStructType,
 |  | IN VOID const * | pvStructInfo,
 |  | IN DWORD | dwFlags,
 |  | IN BOOL | fCoTaskMemAlloc,
 |  | OUT BYTE ** | ppbEncoded,
 |  | OUT DWORD * | pcbEncoded
 | ) |  |

Definition at line 87 of file celib.cpp.

{
    BOOL b;

    assert(0 == dwFlags);
    assert(!fCoTaskMemAlloc);
    *ppbEncoded = NULL;
    *pcbEncoded = 0;
    while (TRUE)
    {
  b = CryptEncodeObject(
        dwEncodingType,
        lpszStructType,
        const_cast<VOID *>(pvStructInfo),
        *ppbEncoded,
        pcbEncoded);
  if (b && 0 == *pcbEncoded)
  {
      SetLastError((DWORD) HRESULT_FROM_WIN32(ERROR_INVALID_DATA));
      b = FALSE;
  }
  if (!b)
  {
      if (NULL != *ppbEncoded)
      {
    HRESULT hr = GetLastError();

    LocalFree(*ppbEncoded);
    *ppbEncoded = NULL;
    SetLastError(hr);
      }
      break;
  }
  if (NULL != *ppbEncoded)
  {
      break;
  }
  *ppbEncoded = (BYTE *) LocalAlloc(LMEM_FIXED, *pcbEncoded);
  if (NULL == *ppbEncoded)
  {
      b = FALSE;
      break;
  }
    }
    return(b);
}

VOID ceErrorPrintLine | ( | IN char const * | pszFile,
 |  | IN DWORD | line,
 |  | IN char const * | pszMessage,
 |  | IN WCHAR const * | pwszData,
 |  | IN HRESULT | hr
 | ) |  |

Definition at line 416 of file celib.cpp.

{
    CHAR ach[4096];
    LONG cch;

#pragma prefast(disable:53, "PREfast bug 650")
    cch = _snprintf(
    ach,
    sizeof(ach),
    "CeLib: Error: %hs(%u): %hs%hs%ws%hs 0x%x (%d)\n",
    pszFile,
    line,
    pszMessage,
    NULL == pwszData? "" : szLPAREN,
    NULL == pwszData? L"" : pwszData,
    NULL == pwszData? "" : szRPAREN,
    hr,
    hr);
#pragma prefast(enable:53, "re-enable")
    if (0 > cch || sizeof(ach) <= cch)
    {
  strcpy(&ach[sizeof(ach) - 5], "...\n");
    }
    OutputDebugStringA(ach);
    wprintf(L"%hs", ach);
}

HRESULT ceFileTimeToDate | ( | IN FILETIME const * | pft,
 |  | OUT DATE * | pDate
 | ) |  |

Definition at line 482 of file celib.cpp.

{
    SYSTEMTIME st;
    HRESULT hr = S_OK;

    if (!FileTimeToSystemTime(pft, &st))
    {
        hr = ceHLastError();
        _JumpError(hr, error, "FileTimeToSystemTime");
    }
    if (!SystemTimeToVariantTime(&st, pDate))
    {
        hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
        _JumpError(hr, error, "SystemTimeToVariantTime");
    }

error:
    return(hr);
}

VOID ceFreeBstr ( IN OUT BSTR * pstr )

Definition at line 377 of file celib.cpp.

{
    if (NULL != *pstr)
    {
  SysFreeString(*pstr);
  *pstr = NULL;
    }
}

HRESULT ceGetComputerNames | ( | OUT WCHAR ** | ppwszDnsName,
 |  | OUT WCHAR ** | ppwszOldName
 | ) |  |

Definition at line 1203 of file celib.cpp.

{
    HRESULT hr;
    DWORD cwc;
    WCHAR *pwszOldName = NULL;

    *ppwszOldName = NULL;
    *ppwszDnsName = NULL;

    cwc = MAX_COMPUTERNAME_LENGTH + 1;
    pwszOldName = (WCHAR *) LocalAlloc(LMEM_FIXED, cwc * sizeof(WCHAR));
    if (NULL == pwszOldName)
    {
      hr = E_OUTOFMEMORY;
      _JumpError(hr, error, "LocalAlloc");
    }
    if (!GetComputerName(pwszOldName, &cwc))
    {
        hr = ceHLastError();
        _JumpError(hr, error, "GetComputerName");
    }

    hr = ceGetMachineDnsName(ppwszDnsName);
    _JumpIfError(hr, error, "ceGetMachineDnsName");

    *ppwszOldName = pwszOldName;
    pwszOldName = NULL;

error:
    if (NULL != pwszOldName)
    {
  LocalFree(pwszOldName);
    }
    return(hr);
}

HRESULT ceGetMachineDnsName ( OUT WCHAR ** ppwszDnsName )

Definition at line 1147 of file celib.cpp.

{
    HRESULT hr;
    WCHAR *pwszDnsName = NULL;
    DWORD cwc;
    COMPUTER_NAME_FORMAT NameType = ComputerNameDnsFullyQualified;

    *ppwszDnsName = NULL;
    while (TRUE)
    {
  cwc = 0;
  if (!GetComputerNameEx(NameType, NULL, &cwc))
  {
      hr = ceHLastError();
      if (HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) == hr &&
    ComputerNameDnsFullyQualified == NameType)
      {
    _PrintError(hr, "GetComputerNameEx(DnsFullyQualified) -- switching to NetBIOS");
    NameType = ComputerNameNetBIOS;
    continue;
      }
      if (HRESULT_FROM_WIN32(ERROR_MORE_DATA) != hr)
      {
    _JumpError(hr, error, "GetComputerNameEx");
      }
      break;
  }
    }
    pwszDnsName = (WCHAR *) LocalAlloc(LMEM_FIXED, cwc * sizeof(WCHAR));
    if (NULL == pwszDnsName)
    {
  hr = E_OUTOFMEMORY;
  _JumpError(hr, error, "LocalAlloc");
    }

    if (!GetComputerNameEx(NameType, pwszDnsName, &cwc))
    {
  hr = ceHLastError();
  _JumpError(hr, error, "GetComputerNameEx");
    }

    *ppwszDnsName = pwszDnsName;
    pwszDnsName = NULL;
    hr = S_OK;

error:
    if (NULL != pwszDnsName)
    {
  LocalFree(pwszDnsName);
    }
    return(hr);
}

WCHAR const* ceGetOIDName ( IN WCHAR const * pwszObjId )

Definition at line 175 of file celib.cpp.

{
    char *pszObjId = NULL;
    WCHAR const *pwszName = L"";

    if (!ceConvertWszToSz(&pszObjId, pwszObjId, -1))
    {
  _JumpError(E_OUTOFMEMORY, error, "ceConvertWszToSz");
    }
    pwszName = ceGetOIDNameA(pszObjId);

error:
    if (NULL != pszObjId)
    {
  LocalFree(pszObjId);
    }
    return(pwszName);
}

WCHAR const* ceGetOIDNameA ( IN char const * pszObjId )

Definition at line 147 of file celib.cpp.

{
    CRYPT_OID_INFO const *pInfo = NULL;
    WCHAR const *pwszName = L"";

    // First try looking up the ObjectId as an Extension or Attribute, because
    // we get a better Display Name, especially for Subject RDNs: CN, L, etc.
    // If that fails, look it up withoput restricting the group.

    pInfo = CryptFindOIDInfo(
      CRYPT_OID_INFO_OID_KEY,
      (VOID *) pszObjId,
      CRYPT_EXT_OR_ATTR_OID_GROUP_ID);

    if (NULL == pInfo || NULL == pInfo->pwszName || L'\0' == pInfo->pwszName[0])
    {
  pInfo = CryptFindOIDInfo(CRYPT_OID_INFO_OID_KEY, (VOID *) pszObjId, 0);
    }
    if (NULL != pInfo && NULL != pInfo->pwszName && L'\0' != pInfo->pwszName[0])
    {
  pwszName = pInfo->pwszName;
    }
    return(pwszName);
}

HRESULT ceHError ( IN HRESULT hr )

Definition at line 389 of file celib.cpp.

{
    assert(S_FALSE != hr);

    if (S_OK != hr && S_FALSE != hr && !FAILED(hr))
    {
        hr = HRESULT_FROM_WIN32(hr);
  if ((HRESULT) 0 == HRESULT_CODE(hr))
  {
      // A call failed without properly setting an error condition!
      hr = E_UNEXPECTED;
  }
  assert(FAILED(hr));
    }
    return(hr);
}

HRESULT ceHLastError ( VOID )

Definition at line 409 of file celib.cpp.

{
    return(ceHError(GetLastError()));
}

HRESULT ceIsConfigLocal | ( | IN WCHAR const * | pwszConfig,
 |  | OPTIONAL OUT WCHAR ** | ppwszMachine,
 |  | OUT BOOL * | pfLocal
 | ) |  |

Definition at line 1305 of file celib.cpp.

{
    HRESULT hr;
    WCHAR *pwszDnsName = NULL;
    WCHAR *pwszOldName = NULL;

    *pfLocal = FALSE;
    if (NULL != ppwszMachine)
    {
  *ppwszMachine = NULL;
    }

    hr = ceGetComputerNames(&pwszDnsName, &pwszOldName);
    _JumpIfError(hr, error, "ceGetComputerNames");

    hr = _IsConfigLocal(
        pwszConfig,
        pwszDnsName,
        pwszOldName,
        ppwszMachine,
        pfLocal);
    _JumpIfError(hr, error, "_IsConfigLocal");

error:
    if (NULL != pwszDnsName)
    {
  LocalFree(pwszDnsName);
    }
    if (NULL != pwszOldName)
    {
  LocalFree(pwszOldName);
    }
    return(hr);
}

int celstrcmpiL | ( | IN WCHAR const * | pwsz1,
 |  | IN WCHAR const * | pwsz2
 | ) |  |

Definition at line 1389 of file celib.cpp.

{
    // CSTR_LESS_THAN(1) - CSTR_EQUAL(2)    == -1 string 1 less than string 2
    // CSTR_EQUAL(2) - CSTR_EQUAL(2)        == 0 string 1 equal to string 2
    // CSTR_GREATER_THAN(3) - CSTR_EQUAL(2) == 1 string 1 greater than string 2

    return(CompareString(
    LOCALE_INVARIANT,
    NORM_IGNORECASE,
    pwsz1,
    -1,
    pwsz2,
    -1) -
      CSTR_EQUAL);
}

HRESULT ceMakeExprDate | ( | IN OUT DATE * | pDate,
 |  | IN LONG | lDelta,
 |  | IN enum ENUM_PERIOD | enumPeriod
 | ) |  |

Definition at line 618 of file celib.cpp.

{
    HRESULT hr;
    FILETIME ft;

    hr = ceDateToFileTime(pDate, &ft);
    _JumpIfError(hr, error, "ceDateToFileTime");

    ceMakeExprDateTime(&ft, lDelta, enumPeriod);

    hr = ceFileTimeToDate(&ft, pDate);
    _JumpIfError(hr, error, "ceFileTimeToDate");

error:
    return(hr);
}

VOID ceMakeExprDateTime | ( | IN OUT FILETIME * | pft,
 |  | IN LONG | lDelta,
 |  | IN enum ENUM_PERIOD | enumPeriod
 | ) |  |

Definition at line 506 of file celib.cpp.

{
    LLFILETIME llft;
    LONGLONG llDelta;
    BOOL fSysTimeDelta;

    llft.ft = *pft;
    llDelta = lDelta;
    fSysTimeDelta = FALSE;
    switch (enumPeriod)
    {
  case ENUM_PERIOD_WEEKS:   llDelta *= CVT_WEEKS;    break;
  case ENUM_PERIOD_DAYS:    llDelta *= CVT_DAYS;     break;
  case ENUM_PERIOD_HOURS:   llDelta *= CVT_HOURS;    break;
  case ENUM_PERIOD_MINUTES: llDelta *= CVT_MINUTES;  break;
  case ENUM_PERIOD_SECONDS:          break;
  default:
      fSysTimeDelta = TRUE;
      break;
    }
    if (fSysTimeDelta)
    {
  SYSTEMTIME SystemTime;

  FileTimeToSystemTime(&llft.ft, &SystemTime);
  switch (enumPeriod)
  {
      case ENUM_PERIOD_MONTHS:
    if (0 > lDelta)
    {
        DWORD dwDelta = (DWORD) -lDelta;

        SystemTime.wYear -= (WORD) (dwDelta / 12) + 1;
        SystemTime.wMonth += 12 - (WORD) (dwDelta % 12);
    }
    else
    {
        SystemTime.wMonth = (WORD) lDelta + SystemTime.wMonth;
    }
    if (12 < SystemTime.wMonth)
    {
        SystemTime.wYear += (SystemTime.wMonth - 1) / 12;
        SystemTime.wMonth = ((SystemTime.wMonth - 1) % 12) + 1;
    }
    break;

      case ENUM_PERIOD_YEARS:
    SystemTime.wYear = (WORD) lDelta + SystemTime.wYear;
    break;

      default:
    SystemTime.wYear += 1;
    break;
  }

DoConvert:
        if (!SystemTimeToFileTime(&SystemTime, &llft.ft))
        {
            if (GetLastError() != ERROR_INVALID_PARAMETER)
            {
                assert(!"Unable to do time conversion");
                return;
            }

            // In some cases we'll convert to an invalid month-end

            // only one month changes length from year to year
            if (SystemTime.wMonth == 2)
            {
                // > 29? try leap year
                if (SystemTime.wDay > 29)
                {
                    SystemTime.wDay = 29;
                    goto DoConvert;
                }
                // == 29? try non-leap year
                else if (SystemTime.wDay == 29)
                {
                    SystemTime.wDay = 28;
                    goto DoConvert;
                }
            }
            // sept (9), apr(4), jun(6), nov(11) all have 30 days
            else if ((SystemTime.wMonth == 9) ||
                     (SystemTime.wMonth == 4) ||
                     (SystemTime.wMonth == 6) ||
                     (SystemTime.wMonth == 11))
            {
                if (SystemTime.wDay > 30)
                {
                    SystemTime.wDay = 30;
                    goto DoConvert;
                }
            }

            // should never get here
            assert(!"Month/year processing: inaccessible code");
            return;
        }
    }
    else
    {
  llft.ll += llDelta * CVT_BASE;
    }
    *pft = llft.ft;
}

HRESULT ceTranslatePeriodUnits | ( | IN WCHAR const * | pwszPeriod,
 |  | IN LONG | lCount,
 |  | OUT enum ENUM_PERIOD * | penumPeriod,
 |  | OUT LONG * | plCount
 | ) |  |

Definition at line 660 of file celib.cpp.

{
    HRESULT hr;
    UNITSTABLE const *put;

    for (put = g_aut; put < &g_aut[CUNITSTABLEMAX]; put++)
    {
  if (0 == celstrcmpiL(pwszPeriod, put->pwszString))
  {
      *penumPeriod = put->enumPeriod;
      if (0 > lCount)
      {
    lCount = MAXLONG;
      }
      *plCount = lCount;
      hr = S_OK;
      goto error;
  }
    }
    hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);

error:
    return(hr);
}

HRESULT ceVerifyAltNameString | ( | IN LONG | NameChoice,
 |  | IN BSTR | strName
 | ) |  |

Definition at line 832 of file celib.cpp.

{
    HRESULT hr = S_OK;
    CERT_ALT_NAME_INFO AltName;
    CERT_ALT_NAME_ENTRY Entry;
    CERT_OTHER_NAME OtherName;
    char *pszObjectId = NULL;
    DWORD cbEncoded;

    ZeroMemory(&AltName, sizeof(AltName));
    AltName.cAltEntry = 1;
    AltName.rgAltEntry = &Entry;

    ZeroMemory(&Entry, sizeof(Entry));
    Entry.dwAltNameChoice = NameChoice;

    switch (NameChoice)
    {
  case CERT_ALT_NAME_RFC822_NAME:
      Entry.pwszRfc822Name = strName;
      break;

  case CERT_ALT_NAME_DNS_NAME:
      Entry.pwszDNSName = strName;
      break;

  case CERT_ALT_NAME_URL:
      Entry.pwszURL = strName;
      break;

  case CERT_ALT_NAME_REGISTERED_ID:
      if (!ceConvertWszToSz(&pszObjectId, strName, -1))
      {
    hr = E_OUTOFMEMORY;
    ceERRORPRINTLINE("ceConvertWszToSz", hr);
    goto error;
      }
      Entry.pszRegisteredID = pszObjectId;
      break;

  case CERT_ALT_NAME_OTHER_NAME:
      Entry.pOtherName = &OtherName;
      OtherName.pszObjId = szOID_NT_PRINCIPAL_NAME;
      OtherName.Value.cbData = SysStringByteLen(strName);
      OtherName.Value.pbData = (BYTE *) strName;
      break;

  case CERT_ALT_NAME_DIRECTORY_NAME:
      Entry.DirectoryName.cbData = SysStringByteLen(strName);
      Entry.DirectoryName.pbData = (BYTE *) strName;
      break;

  case CERT_ALT_NAME_IP_ADDRESS:
      Entry.IPAddress.cbData = SysStringByteLen(strName);
      Entry.IPAddress.pbData = (BYTE *) strName;
      break;

  //case CERT_ALT_NAME_X400_ADDRESS:
  //case CERT_ALT_NAME_EDI_PARTY_NAME:
  default:
      hr = E_INVALIDARG;
      ceERRORPRINTLINE("NameChoice", hr);
      goto error;

    }

    // Encode CERT_ALT_NAME_INFO:

    if (!CryptEncodeObject(
        X509_ASN_ENCODING,
        X509_ALTERNATE_NAME,
        &AltName,
        NULL,
        &cbEncoded))
    {
  hr = ceHLastError();
  ceERRORPRINTLINE("ceEncodeObject", hr);
  goto error;
    }

error:
    if (NULL != pszObjectId)
    {
  LocalFree(pszObjectId);
    }
    return(hr);
}

HRESULT ceVerifyObjId ( IN WCHAR const * pwszObjId )

Definition at line 808 of file celib.cpp.

{
    HRESULT hr;
    CHAR *pszObjId = NULL;

    if (!ceConvertWszToSz(&pszObjId, pwszObjId, -1))
    {
  hr = E_OUTOFMEMORY;
  _JumpError(hr, error, "ceConvertWszToSz");
    }
    hr = ceVerifyObjIdA(pszObjId);
    _JumpIfErrorStr(hr, error, "ceVerifyObjIdA", pwszObjId);

error:
    if (NULL != pszObjId)
    {
      LocalFree(pszObjId);
    }
    return(hr);
}

HRESULT ceVerifyObjIdA ( IN CHAR const * pszObjId )

Definition at line 703 of file celib.cpp.

{
    HRESULT hr;
    BYTE *pbEncoded = NULL;
    DWORD cbEncoded;
    CRYPT_ATTRIBUTE ainfo;
    CRYPT_ATTRIBUTE *painfo = NULL;
    DWORD cbainfo;
    char const *psz;
    int i;

    ainfo.pszObjId = const_cast<char *>(pszObjId);
    ainfo.cValue = 0;
    ainfo.rgValue = NULL;

    if (!ceEncodeObject(
        X509_ASN_ENCODING,
        PKCS_ATTRIBUTE,
        &ainfo,
        0,
        FALSE,
        &pbEncoded,
        &cbEncoded))
    {
  hr = ceHLastError();
  _JumpError(hr, error, "ceEncodeObject");
    }

    if (!ceDecodeObject(
        X509_ASN_ENCODING,
        PKCS_ATTRIBUTE,
        pbEncoded,
        cbEncoded,
        FALSE,
        (VOID **) &painfo,
        &cbainfo))
    {
  hr = ceHLastError();
  _JumpError(hr, error, "ceDecodeObject");
    }

    hr = E_INVALIDARG;
    if (0 != strcmp(ainfo.pszObjId, painfo->pszObjId))
    {
  _JumpError(hr, error, "bad ObjId: decode mismatch");
    }
    for (psz = painfo->pszObjId; '\0' != *psz; psz++)
    {
  // must be a digit or a dot separator

  if (!isdigit(*psz))
  {
      if ('.' != *psz)
      {
    _JumpError(hr, error, "bad ObjId: bad char");
      }

      // can't have dot at start, double dots or dot at end

      if (psz == painfo->pszObjId || '.' == psz[1] || '\0' == psz[1])
      {
    _JumpError(hr, error, "bad ObjId: dot location");
      }
  }
    }
    psz = strchr(painfo->pszObjId, '.');
    if (NULL == psz)
    {
  _JumpError(hr, error, "bad ObjId: must have at least one dot");
    }
    i = atoi(painfo->pszObjId);
    switch (i)
    {
  case 0:
  case 1:
      i = atoi(++psz);
      if (0 > i || 39 < i)
      {
    _JumpError(hr, error, "bad ObjId: 0. or 1. must be followed by 0..39");
      }
      break;

  case 2:
      break;

  default:
      _JumpError(hr, error, "bad ObjId: must start with 0, 1 or 2");
    }
    hr = S_OK;

error:
    if (NULL != pbEncoded)
    {
      LocalFree(pbEncoded);
    }
    if (NULL != painfo)
    {
      LocalFree(painfo);
    }
    return(hr);
}

int ceWtoI | ( | IN WCHAR const * | string,
 |  | OUT BOOL * | pfValid
 | ) |  |

Definition at line 1060 of file celib.cpp.

{
    HRESULT hr;
    WCHAR szBuf[16];
    WCHAR *szTmp = szBuf;
    int cTmp = ARRAYSIZE(szBuf);
    int i = 0;
    WCHAR const *pwsz;
    BOOL fSawDigit = FALSE;

    if (pfValid == NULL)
    {
        hr = E_POINTER;
        _JumpError(hr, error, "NULLPARAM");
    }
    *pfValid = FALSE;

    assert(NULL != pfValid);
    cTmp = FoldString(
        MAP_FOLDDIGITS,
        string,
        -1,
        szTmp,
        cTmp);
    if (cTmp == 0)
    {
        hr = ceHLastError();
        if (HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) == hr)
        {
            hr = S_OK;
            cTmp = FoldString(
                MAP_FOLDDIGITS,
                string,
                -1,
                NULL,
                0);

            szTmp = (WCHAR*)LocalAlloc(LMEM_FIXED, cTmp*sizeof(WCHAR));
      if (NULL == szTmp)
      {
    hr = E_OUTOFMEMORY;
    _JumpError(hr, error, "LocalAlloc");
      }

            cTmp = FoldString(
                MAP_FOLDDIGITS,
                string,
                -1,
                szTmp,
                cTmp);

            if (cTmp == 0)
                hr = ceHLastError();
        }
        _JumpIfError(hr, error, "FoldString");
    }
    pwsz = szTmp;
    while (iswspace(*pwsz))
    {
  pwsz++;
    }
    while (iswdigit(*pwsz))
    {
  fSawDigit = TRUE;
  pwsz++;
    }
    while (iswspace(*pwsz))
    {
  pwsz++;
    }
    if (L'\0' == *pwsz)
    {
  *pfValid = fSawDigit;
    }
    i = _wtoi(szTmp);

error:
    if (szTmp && (szTmp != szBuf))
       LocalFree(szTmp);

    return i;
}

Variable Documentation

UNITSTABLE g_aut[]
Initial value:
{
    { wszPERIODSECONDS, ENUM_PERIOD_SECONDS },
    { wszPERIODMINUTES, ENUM_PERIOD_MINUTES },
    { wszPERIODHOURS,   ENUM_PERIOD_HOURS },
    { wszPERIODDAYS,    ENUM_PERIOD_DAYS },
    { wszPERIODWEEKS,   ENUM_PERIOD_WEEKS },
    { wszPERIODMONTHS,  ENUM_PERIOD_MONTHS },
    { wszPERIODYEARS,   ENUM_PERIOD_YEARS },
}

Definition at line 646 of file celib.cpp.

Generated on Wed Nov 13 2024 16:54:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Policy/C++/Windows.Net/certpsam.cpp File Reference

  • Security
  • CertServices
  • Policy
  • C++
  • Windows.Net
Functions | Variables

certpsam.cpp File Reference

#include "pch.cpp"
#include "celib.h"
#include "policy.h"
#include "module.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)
void __RPC_FAR *__RPC_USER | MIDL_user_allocate (size_t cb)
void __RPC_USER | MIDL_user_free (void __RPC_FAR *pb)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 54 of file certpsam.cpp.

{
    return(_Module.GetLockCount() == 0? S_OK : S_FALSE);
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 64 of file certpsam.cpp.

{
    return(_Module.GetClassObject(rclsid, riid, ppv));
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 33 of file certpsam.cpp.

{
    switch (dwReason)
    {
  case DLL_PROCESS_ATTACH:
      _Module.Init(ObjectMap, hInstance);
      DisableThreadLibraryCalls(hInstance);
      break;

        case DLL_PROCESS_DETACH:
      _Module.Term();
            break;
    }
    return(TRUE);    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 74 of file certpsam.cpp.

{
    // registers object, typelib and all interfaces in typelib
    return(_Module.RegisterServer(TRUE));
}

STDAPI DllUnregisterServer ( void )

Definition at line 85 of file certpsam.cpp.

{
    _Module.UnregisterServer();
    return(S_OK);
}

void __RPC_FAR* __RPC_USER MIDL_user_allocate ( size_t cb )

Definition at line 93 of file certpsam.cpp.

{
    return(LocalAlloc(LMEM_FIXED | LMEM_ZEROINIT, cb));
}

void __RPC_USER MIDL_user_free ( void __RPC_FAR * pb )

Definition at line 100 of file certpsam.cpp.

{
    LocalFree(pb);
}

Variable Documentation

CComModule _Module

Definition at line 20 of file certpsam.cpp.

Generated on Wed Nov 13 2024 16:54:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Policy/C++/Windows.Net/certpsam.idl File Reference

  • Security
  • CertServices
  • Policy
  • C++
  • Windows.Net
Classes | Namespaces | Functions

certpsam.idl File Reference

Go to the source code of this file.

Classes

class | CERTPOLICYSAMPLELib::CCertManagePolicyModuleSample
class | CERTPOLICYSAMPLELib::CCertPolicySample

Namespaces

namespace | CERTPOLICYSAMPLELib

Functions

CERTPOLICYSAMPLELib::importlib ("stdole2.tlb")
Generated on Wed Nov 13 2024 16:54:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Policy/C++/Windows.Net/module.cpp File Reference

  • Security
  • CertServices
  • Policy
  • C++
  • Windows.Net

module.cpp File Reference

#include "pch.cpp"
#include "celib.h"
#include "module.h"
#include "policy.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Policy/C++/Windows.Net/module.h File Reference

  • Security
  • CertServices
  • Policy
  • C++
  • Windows.Net
Classes

module.h File Reference

#include "certpsam.h"
#include "resource.h"

Go to the source code of this file.

Classes

class CCertManagePolicyModuleSample
Generated on Wed Nov 13 2024 16:54:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Policy/C++/Windows.Net/pch.cpp File Reference

  • Security
  • CertServices
  • Policy
  • C++
  • Windows.Net
Defines | Variables

pch.cpp File Reference

#include <windows.h>
#include <atlbase.h>
#include <atlcom.h>
#include <certsrv.h>

Go to the source code of this file.

Defines

#define | wsz_SAMPLE_COPYRIGHT L"(c)2000 Microsoft"
#define | wsz_SAMPLE_DESCRIPTION L"Sample Policy Module"
#define | wsz_SAMPLE_FILEVER L"v 1.0"
#define | wsz_SAMPLE_NAME L"Sample/Test Policy Module"
#define | wsz_SAMPLE_PRODUCTVER L"v 5.00"
#define | wszCLASS_CERTMANAGEPOLICYMODULESAMPLE wszCLASS_CERTPOLICYSAMPLEPREFIX wszCERTMANAGEPOLICY_POSTFIX
#define | wszCLASS_CERTPOLICYSAMPLE wszCLASS_CERTPOLICYSAMPLEPREFIX wszCERTPOLICYMODULE_POSTFIX
#define | wszCLASS_CERTPOLICYSAMPLEPREFIX TEXT("CertAuthority_Sample")

Variables

CComModule | _Module

Define Documentation

#define wsz_SAMPLE_COPYRIGHT L"(c)2000 Microsoft"

Definition at line 31 of file pch.cpp.

#define wsz_SAMPLE_DESCRIPTION L"Sample Policy Module"

Definition at line 30 of file pch.cpp.

#define wsz_SAMPLE_FILEVER L"v 1.0"

Definition at line 32 of file pch.cpp.

#define wsz_SAMPLE_NAME L"Sample/Test Policy Module"

Definition at line 29 of file pch.cpp.

#define wsz_SAMPLE_PRODUCTVER L"v 5.00"

Definition at line 33 of file pch.cpp.

#define wszCLASS_CERTMANAGEPOLICYMODULESAMPLE wszCLASS_CERTPOLICYSAMPLEPREFIX wszCERTMANAGEPOLICY_POSTFIX

Definition at line 27 of file pch.cpp.

#define wszCLASS_CERTPOLICYSAMPLE wszCLASS_CERTPOLICYSAMPLEPREFIX wszCERTPOLICYMODULE_POSTFIX

Definition at line 25 of file pch.cpp.

#define wszCLASS_CERTPOLICYSAMPLEPREFIX TEXT("CertAuthority_Sample")

Definition at line 23 of file pch.cpp.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:54:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Policy/C++/Windows.Net/policy.cpp File Reference

  • Security
  • CertServices
  • Policy
  • C++
  • Windows.Net
Defines | Functions | Variables

policy.cpp File Reference

#include "pch.cpp"
#include <assert.h>
#include "celib.h"
#include "policy.h"
#include "module.h"

Go to the source code of this file.

Defines

#define | HIGHBIT(bitno) (1 << (7 - (bitno)))
#define | NSCERTTYPE_CA ((BYTE) (SSLBIT_CASSL | SSLBIT_CASMIME | SSLBIT_CASIGN))
#define | NSCERTTYPE_CLIENT ((BYTE) SSLBIT_CLIENT)
#define | NSCERTTYPE_SERVER ((BYTE) (SSLBIT_SERVER | SSLBIT_CLIENT))
#define | NSCERTTYPE_SMIME ((BYTE) SSLBIT_SMIME)
#define | SSLBIT_CASIGN ((BYTE) HIGHBIT(7))
#define | SSLBIT_CASMIME ((BYTE) HIGHBIT(6))
#define | SSLBIT_CASSL ((BYTE) HIGHBIT(5))
#define | SSLBIT_CLIENT ((BYTE) HIGHBIT(0))
#define | SSLBIT_RESERVED ((BYTE) HIGHBIT(4))
#define | SSLBIT_SERVER ((BYTE) HIGHBIT(1))
#define | SSLBIT_SIGN ((BYTE) HIGHBIT(3))
#define | SSLBIT_SMIME ((BYTE) HIGHBIT(2))
#define | wszFORMATREQUESTID L"RequestId=%u"

Functions

HRESULT | EnumerateAttributes (IN ICertServerPolicy *pServer)
HRESULT | GetRequestId (IN ICertServerPolicy *pServer, OUT LONG *plRequestId)
DWORD | polFindObjIdInList (IN WCHAR const *pwsz, IN DWORD count, IN WCHAR const *const *ppwsz)
HRESULT | polGetCertificateExtension (IN ICertServerPolicy *pServer, IN WCHAR const *pwszExtensionName, IN DWORD dwPropType, IN OUT VARIANT *pvarOut)
HRESULT | polGetCertificateLongProperty (IN ICertServerPolicy *pServer, IN WCHAR const *pwszPropertyName, OUT LONG *plOut)
HRESULT | polGetCertificateStringProperty (IN ICertServerPolicy *pServer, IN WCHAR const *pwszPropertyName, OUT BSTR *pstrOut)
HRESULT | polGetLongProperty (IN ICertServerPolicy *pServer, IN BOOL fRequest, IN WCHAR const *pwszPropertyName, OUT LONG *plOut)
HRESULT | polGetProperty (IN ICertServerPolicy *pServer, IN BOOL fRequest, IN WCHAR const *pwszPropertyName, IN DWORD PropType, OUT VARIANT *pvarOut)
HRESULT | polGetRequestAttribute (IN ICertServerPolicy *pServer, IN WCHAR const *pwszAttributeName, OUT BSTR *pstrOut)
HRESULT | polGetRequestLongProperty (IN ICertServerPolicy *pServer, IN WCHAR const *pwszPropertyName, OUT LONG *plOut)
HRESULT | polGetRequestStringProperty (IN ICertServerPolicy *pServer, IN WCHAR const *pwszPropertyName, OUT BSTR *pstrOut)
HRESULT | polGetServerCallbackInterface (OUT ICertServerPolicy **ppServer, IN LONG Context)
HRESULT | polGetStringProperty (IN ICertServerPolicy *pServer, IN BOOL fRequest, IN WCHAR const *pwszPropertyName, OUT BSTR *pstrOut)
HRESULT | polSetCertificateExtension (IN ICertServerPolicy *pServer, IN WCHAR const *pwszExtensionName, IN DWORD dwPropType, IN DWORD dwExtFlags, IN VARIANT const *pvarIn)

Variables

BOOL | fDebug = DBG_CERTSRV

Define Documentation

#define HIGHBIT ( bitno ) (1 << (7 - (bitno)))

Definition at line 1564 of file policy.cpp.

#define NSCERTTYPE_CA ((BYTE) (SSLBIT_CASSL | SSLBIT_CASMIME | SSLBIT_CASIGN))

Definition at line 1580 of file policy.cpp.

#define NSCERTTYPE_CLIENT ((BYTE) SSLBIT_CLIENT)

Definition at line 1577 of file policy.cpp.

#define NSCERTTYPE_SERVER ((BYTE) (SSLBIT_SERVER | SSLBIT_CLIENT))

Definition at line 1578 of file policy.cpp.

#define NSCERTTYPE_SMIME ((BYTE) SSLBIT_SMIME)

Definition at line 1579 of file policy.cpp.

#define SSLBIT_CASIGN ((BYTE) HIGHBIT(7))

Definition at line 1575 of file policy.cpp.

#define SSLBIT_CASMIME ((BYTE) HIGHBIT(6))

Definition at line 1574 of file policy.cpp.

#define SSLBIT_CASSL ((BYTE) HIGHBIT(5))

Definition at line 1573 of file policy.cpp.

#define SSLBIT_CLIENT ((BYTE) HIGHBIT(0))

Definition at line 1566 of file policy.cpp.

#define SSLBIT_RESERVED ((BYTE) HIGHBIT(4))

Definition at line 1571 of file policy.cpp.

#define SSLBIT_SERVER ((BYTE) HIGHBIT(1))

Definition at line 1567 of file policy.cpp.

#define SSLBIT_SIGN ((BYTE) HIGHBIT(3))

Definition at line 1569 of file policy.cpp.

#define SSLBIT_SMIME ((BYTE) HIGHBIT(2))

Definition at line 1568 of file policy.cpp.

#define wszFORMATREQUESTID L"RequestId=%u"

Function Documentation

HRESULT EnumerateAttributes ( IN ICertServerPolicy * pServer )

Definition at line 1432 of file policy.cpp.

{
    HRESULT hr;
    HRESULT hr2;
    BSTR strName = NULL;
    BOOL fClose = FALSE;
    BSTR strValue = NULL;

    hr = pServer->EnumerateAttributesSetup(0);
    _JumpIfError(hr, error, "Policy:EnumerateAttributesSetup");

    fClose = TRUE;
    while (TRUE)
    {
        hr = pServer->EnumerateAttributes(&strName);
  if (S_FALSE == hr)
  {
      hr = S_OK;
      break;
  }
  _JumpIfError(hr, error, "Policy:EnumerateAttributes");

        hr = pServer->GetRequestAttribute(strName, &strValue);
  _JumpIfError(hr, error, "Policy:GetRequestAttribute");

  DBGPRINT((
    fDebug,
                "Policy:EnumerateAttributes(%ws = %ws)\n",
                strName,
                strValue));
        if (NULL != strName)
        {
            SysFreeString(strName);
            strName = NULL;
        }
        if (NULL != strValue)
        {
            SysFreeString(strValue);
            strValue = NULL;
        }
    }

error:
    if (fClose)
    {
        hr2 = pServer->EnumerateAttributesClose();
        if (S_OK != hr2)
        {
      _PrintError(hr2, "Policy:EnumerateAttributesClose");
            if (S_OK == hr)
            {
                hr = hr2;
            }
        }
    }
    if (NULL != strName)
    {
        SysFreeString(strName);
    }
    if (NULL != strValue)
    {
        SysFreeString(strValue);
    }
    return(hr);
}

HRESULT GetRequestId | ( | IN ICertServerPolicy * | pServer,
 |  | OUT LONG * | plRequestId
 | ) |  |

Definition at line 1501 of file policy.cpp.

{
    HRESULT hr;

    hr = polGetRequestLongProperty(pServer, wszPROPREQUESTREQUESTID, plRequestId);
    _JumpIfError(hr, error, "Policy:polGetRequestLongProperty");

    DBGPRINT((
  fDebug,
  "Policy:GetRequestId(%ws = %u)\n",
  wszPROPREQUESTREQUESTID,
  *plRequestId));

error:
    return(hr);
}

DWORD polFindObjIdInList | ( | IN WCHAR const * | pwsz,
 |  | IN DWORD | count,
 |  | IN WCHAR const *const * | ppwsz
 | ) |  |

Definition at line 1259 of file policy.cpp.

{
    DWORD i;

    for (i = 0; i < count; i++)
    {
  if (NULL == pwsz || NULL == ppwsz[i])
  {
      i = count;
      break;
  }
  if (0 == wcscmp(pwsz, ppwsz[i]))
  {
      break;
  }
    }
    return(i < count? i : MAXDWORD);
}

HRESULT polGetCertificateExtension | ( | IN ICertServerPolicy * | pServer,
 |  | IN WCHAR const * | pwszExtensionName,
 |  | IN DWORD | dwPropType,
 |  | IN OUT VARIANT * | pvarOut
 | ) |  |

Definition at line 287 of file policy.cpp.

{
    HRESULT hr;
    BSTR strName = NULL;

    strName = SysAllocString(pwszExtensionName);
    if (NULL == strName)
    {
  hr = E_OUTOFMEMORY;
  _JumpError(hr, error, "Policy:SysAllocString");
    }
    hr = pServer->GetCertificateExtension(strName, dwPropType, pvarOut);
    _JumpIfErrorStr2(
    hr,
    error,
    "Policy:GetCertificateExtension",
    pwszExtensionName,
    CERTSRV_E_PROPERTY_EMPTY);

error:
    if (NULL != strName)
    {
  SysFreeString(strName);
    }
    return(hr);
}

HRESULT polGetCertificateLongProperty | ( | IN ICertServerPolicy * | pServer,
 |  | IN WCHAR const * | pwszPropertyName,
 |  | OUT LONG * | plOut
 | ) |  |

Definition at line 239 of file policy.cpp.

{
    HRESULT hr;

    hr = polGetLongProperty(pServer, FALSE, pwszPropertyName, plOut);
    _JumpIfError2(hr, error, "polGetLongProperty", CERTSRV_E_PROPERTY_EMPTY);

error:
    return(hr);
}

HRESULT polGetCertificateStringProperty | ( | IN ICertServerPolicy * | pServer,
 |  | IN WCHAR const * | pwszPropertyName,
 |  | OUT BSTR * | pstrOut
 | ) |  |

Definition at line 207 of file policy.cpp.

{
    HRESULT hr;

    hr = polGetStringProperty(pServer, FALSE, pwszPropertyName, pstrOut);
    _JumpIfError2(hr, error, "polGetStringProperty", CERTSRV_E_PROPERTY_EMPTY);

error:
    return(hr);
}

HRESULT polGetLongProperty | ( | IN ICertServerPolicy * | pServer,
 |  | IN BOOL | fRequest,
 |  | IN WCHAR const * | pwszPropertyName,
 |  | OUT LONG * | plOut
 | ) |  |

Definition at line 158 of file policy.cpp.

{
    HRESULT hr;
    VARIANT var;

    VariantInit(&var);
    hr = polGetProperty(
        pServer,
        fRequest,
        pwszPropertyName,
        PROPTYPE_LONG,
        &var);
    _JumpIfError2(hr, error, "Policy:polGetProperty", CERTSRV_E_PROPERTY_EMPTY);

    if (VT_I4 != var.vt)
    {
  hr = CERTSRV_E_PROPERTY_EMPTY;
  _JumpError(hr, error, "Policy:polGetProperty");
    }
    *plOut = var.lVal;
    hr = S_OK;

error:
    VariantClear(&var);
    return(hr);
}

HRESULT polGetProperty | ( | IN ICertServerPolicy * | pServer,
 |  | IN BOOL | fRequest,
 |  | IN WCHAR const * | pwszPropertyName,
 |  | IN DWORD | PropType,
 |  | OUT VARIANT * | pvarOut
 | ) |  |

Definition at line 67 of file policy.cpp.

{
    HRESULT hr;
    BSTR strName = NULL;

    VariantInit(pvarOut);
    strName = SysAllocString(pwszPropertyName);
    if (NULL == strName)
    {
  hr = E_OUTOFMEMORY;
  _JumpError(hr, error, "Policy:SysAllocString");
    }
    if (fRequest)
    {
  hr = pServer->GetRequestProperty(strName, PropType, pvarOut);
  _JumpIfErrorStr2(
        hr,
        error,
        "Policy:GetRequestProperty",
        pwszPropertyName,
        CERTSRV_E_PROPERTY_EMPTY);
    }
    else
    {
  hr = pServer->GetCertificateProperty(strName, PropType, pvarOut);
  _JumpIfErrorStr2(
        hr,
        error,
        "Policy:GetCertificateProperty",
        pwszPropertyName,
        CERTSRV_E_PROPERTY_EMPTY);
    }

error:
    if (NULL != strName)
    {
  SysFreeString(strName);
    }
    return(hr);
}

HRESULT polGetRequestAttribute | ( | IN ICertServerPolicy * | pServer,
 |  | IN WCHAR const * | pwszAttributeName,
 |  | OUT BSTR * | pstrOut
 | ) |  |

Definition at line 255 of file policy.cpp.

{
    HRESULT hr;
    BSTR strName = NULL;

    strName = SysAllocString(pwszAttributeName);
    if (NULL == strName)
    {
  hr = E_OUTOFMEMORY;
  _JumpError(hr, error, "Policy:SysAllocString");
    }
    hr = pServer->GetRequestAttribute(strName, pstrOut);
    _JumpIfErrorStr2(
    hr,
    error,
    "Policy:GetRequestAttribute",
    pwszAttributeName,
    CERTSRV_E_PROPERTY_EMPTY);

error:
    if (NULL != strName)
    {
  SysFreeString(strName);
    }
    return(hr);
}

HRESULT polGetRequestLongProperty | ( | IN ICertServerPolicy * | pServer,
 |  | IN WCHAR const * | pwszPropertyName,
 |  | OUT LONG * | plOut
 | ) |  |

Definition at line 223 of file policy.cpp.

{
    HRESULT hr;

    hr = polGetLongProperty(pServer, TRUE, pwszPropertyName, plOut);
    _JumpIfError2(hr, error, "polGetLongProperty", CERTSRV_E_PROPERTY_EMPTY);

error:
    return(hr);
}

HRESULT polGetRequestStringProperty | ( | IN ICertServerPolicy * | pServer,
 |  | IN WCHAR const * | pwszPropertyName,
 |  | OUT BSTR * | pstrOut
 | ) |  |

Definition at line 191 of file policy.cpp.

{
    HRESULT hr;

    hr = polGetStringProperty(pServer, TRUE, pwszPropertyName, pstrOut);
    _JumpIfError2(hr, error, "polGetStringProperty", CERTSRV_E_PROPERTY_EMPTY);

error:
    return(hr);
}

HRESULT polGetServerCallbackInterface | ( | OUT ICertServerPolicy ** | ppServer,
 |  | IN LONG | Context
 | ) |  |

Definition at line 28 of file policy.cpp.

{
    HRESULT hr;

    if (NULL == ppServer)
    {
        hr = E_POINTER;
  _JumpError(hr, error, "Policy:polGetServerCallbackInterface");
    }

    hr = CoCreateInstance(
                    CLSID_CCertServerPolicy,
                    NULL,               // pUnkOuter
                    CLSCTX_INPROC_SERVER,
                    IID_ICertServerPolicy,
                    (VOID **) ppServer);
    _JumpIfError(hr, error, "Policy:CoCreateInstance");

    if (NULL == *ppServer)
    {
        hr = E_UNEXPECTED;
  _JumpError(hr, error, "Policy:CoCreateInstance");
    }

    // only set context if nonzero
    if (0 != Context)
    {
        hr = (*ppServer)->SetContext(Context);
        _JumpIfError(hr, error, "Policy:SetContext");
    }

error:
    return hr;
}

HRESULT polGetStringProperty | ( | IN ICertServerPolicy * | pServer,
 |  | IN BOOL | fRequest,
 |  | IN WCHAR const * | pwszPropertyName,
 |  | OUT BSTR * | pstrOut
 | ) |  |

Definition at line 115 of file policy.cpp.

{
    HRESULT hr;
    VARIANT var;

    VariantInit(&var);
    if (NULL != *pstrOut)
    {
  SysFreeString(*pstrOut);
  *pstrOut = NULL;
    }
    hr = polGetProperty(
        pServer,
        fRequest,
        pwszPropertyName,
        PROPTYPE_STRING,
        &var);
    _JumpIfError2(
      hr,
      error,
      "Policy:polGetProperty",
      CERTSRV_E_PROPERTY_EMPTY);

    if (VT_BSTR != var.vt || NULL == var.bstrVal || L'\0' == var.bstrVal)
    {
  hr = CERTSRV_E_PROPERTY_EMPTY;
  _JumpError(hr, error, "Policy:polGetProperty");
    }
    *pstrOut = var.bstrVal;
    var.vt = VT_EMPTY;
    hr = S_OK;

error:
    VariantClear(&var);
    return(hr);
}

HRESULT polSetCertificateExtension | ( | IN ICertServerPolicy * | pServer,
 |  | IN WCHAR const * | pwszExtensionName,
 |  | IN DWORD | dwPropType,
 |  | IN DWORD | dwExtFlags,
 |  | IN VARIANT const * | pvarIn
 | ) |  |

Definition at line 320 of file policy.cpp.

{
    HRESULT hr;
    BSTR strName = NULL;

    strName = SysAllocString(pwszExtensionName);
    if (NULL == strName)
    {
  hr = E_OUTOFMEMORY;
  _JumpError(hr, error, "Policy:SysAllocString");
    }
    hr = pServer->SetCertificateExtension(
            strName,
            dwPropType,
            dwExtFlags,
            pvarIn);
    _JumpIfErrorStr(
    hr,
    error,
    "Policy:SetCertificateExtension",
    pwszExtensionName);

error:
    if (NULL != strName)
    {
  SysFreeString(strName);
    }
    return(hr);
}

Variable Documentation

BOOL fDebug = DBG_CERTSRV

Definition at line 20 of file policy.cpp.

Generated on Wed Nov 13 2024 16:54:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Policy/C++/Windows.Net/policy.h File Reference

  • Security
  • CertServices
  • Policy
  • C++
  • Windows.Net
Classes | Defines | Typedefs | Functions | Variables

policy.h File Reference

#include "certpsam.h"
#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Classes

class | CCertPolicySample
class | CRequestInstance

Defines

#define | __BSTRC__DEFINED__
#define | _DumpStringArray(pszType, count, apwsz)
#define | wszATTREMAIL1 TEXT("E")
#define | wszATTREMAIL2 TEXT("EMail")
#define | wszCERTTYPE_CROSS_CA L"CrossCA"
#define | wszCERTTYPE_SUBORDINATE_CA L"SubCA"

Typedefs

typedef OLECHAR const * | BSTRC

Functions

DWORD | polFindObjIdInList (IN WCHAR const *pwsz, IN DWORD count, IN WCHAR const *const *ppwsz)
HRESULT | polGetCertificateExtension (IN ICertServerPolicy *pServer, IN WCHAR const *pwszExtensionName, IN DWORD dwPropType, IN OUT VARIANT *pvarOut)
HRESULT | polGetCertificateLongProperty (IN ICertServerPolicy *pServer, IN WCHAR const *pwszPropertyName, OUT LONG *plOut)
HRESULT | polGetCertificateStringProperty (IN ICertServerPolicy *pServer, IN WCHAR const *pwszPropertyName, OUT BSTR *pstrOut)
HRESULT | polGetRequestAttribute (IN ICertServerPolicy *pServer, IN WCHAR const *pwszAttributeName, OUT BSTR *pstrOut)
HRESULT | polGetRequestLongProperty (IN ICertServerPolicy *pServer, IN WCHAR const *pwszPropertyName, OUT LONG *plOut)
HRESULT | polGetRequestStringProperty (IN ICertServerPolicy *pServer, IN WCHAR const *pwszPropertyName, OUT BSTR *pstrOut)
HRESULT | polGetServerCallbackInterface (OUT ICertServerPolicy **ppServer, IN LONG Context)
HRESULT | polSetCertificateExtension (IN ICertServerPolicy *pServer, IN WCHAR const *pwszExtensionName, IN DWORD dwPropType, IN DWORD dwExtFlags, IN VARIANT const *pvarIn)
VOID | ReqCleanup (VOID)
HRESULT | ReqInitialize (IN ICertServerPolicy *pServer)

Variables

BOOL fDebug

Define Documentation

#define __BSTRC__DEFINED__

Definition at line 40 of file policy.h.

#define _DumpStringArray | ( | pszType,
 |  | count,
 |  | apwsz
 | ) |

Definition at line 228 of file policy.h.

#define wszATTREMAIL1 TEXT("E")

Definition at line 15 of file policy.h.

#define wszATTREMAIL2 TEXT("EMail")

Definition at line 16 of file policy.h.

#define wszCERTTYPE_CROSS_CA L"CrossCA"

Definition at line 24 of file policy.h.

#define wszCERTTYPE_SUBORDINATE_CA L"SubCA"

Definition at line 20 of file policy.h.

Typedef Documentation

typedef OLECHAR const* BSTRC

Definition at line 41 of file policy.h.

Function Documentation

DWORD polFindObjIdInList | ( | IN WCHAR const * | pwsz,
 |  | IN DWORD | count,
 |  | IN WCHAR const *const * | ppwsz
 | ) |  |

Definition at line 1259 of file policy.cpp.

{
    DWORD i;

    for (i = 0; i < count; i++)
    {
  if (NULL == pwsz || NULL == ppwsz[i])
  {
      i = count;
      break;
  }
  if (0 == wcscmp(pwsz, ppwsz[i]))
  {
      break;
  }
    }
    return(i < count? i : MAXDWORD);
}

HRESULT polGetCertificateExtension | ( | IN ICertServerPolicy * | pServer,
 |  | IN WCHAR const * | pwszExtensionName,
 |  | IN DWORD | dwPropType,
 |  | IN OUT VARIANT * | pvarOut
 | ) |  |

Definition at line 287 of file policy.cpp.

{
    HRESULT hr;
    BSTR strName = NULL;

    strName = SysAllocString(pwszExtensionName);
    if (NULL == strName)
    {
  hr = E_OUTOFMEMORY;
  _JumpError(hr, error, "Policy:SysAllocString");
    }
    hr = pServer->GetCertificateExtension(strName, dwPropType, pvarOut);
    _JumpIfErrorStr2(
    hr,
    error,
    "Policy:GetCertificateExtension",
    pwszExtensionName,
    CERTSRV_E_PROPERTY_EMPTY);

error:
    if (NULL != strName)
    {
  SysFreeString(strName);
    }
    return(hr);
}

HRESULT polGetCertificateLongProperty | ( | IN ICertServerPolicy * | pServer,
 |  | IN WCHAR const * | pwszPropertyName,
 |  | OUT LONG * | plOut
 | ) |  |

Definition at line 239 of file policy.cpp.

{
    HRESULT hr;

    hr = polGetLongProperty(pServer, FALSE, pwszPropertyName, plOut);
    _JumpIfError2(hr, error, "polGetLongProperty", CERTSRV_E_PROPERTY_EMPTY);

error:
    return(hr);
}

HRESULT polGetCertificateStringProperty | ( | IN ICertServerPolicy * | pServer,
 |  | IN WCHAR const * | pwszPropertyName,
 |  | OUT BSTR * | pstrOut
 | ) |  |

Definition at line 207 of file policy.cpp.

{
    HRESULT hr;

    hr = polGetStringProperty(pServer, FALSE, pwszPropertyName, pstrOut);
    _JumpIfError2(hr, error, "polGetStringProperty", CERTSRV_E_PROPERTY_EMPTY);

error:
    return(hr);
}

HRESULT polGetRequestAttribute | ( | IN ICertServerPolicy * | pServer,
 |  | IN WCHAR const * | pwszAttributeName,
 |  | OUT BSTR * | pstrOut
 | ) |  |

Definition at line 255 of file policy.cpp.

{
    HRESULT hr;
    BSTR strName = NULL;

    strName = SysAllocString(pwszAttributeName);
    if (NULL == strName)
    {
  hr = E_OUTOFMEMORY;
  _JumpError(hr, error, "Policy:SysAllocString");
    }
    hr = pServer->GetRequestAttribute(strName, pstrOut);
    _JumpIfErrorStr2(
    hr,
    error,
    "Policy:GetRequestAttribute",
    pwszAttributeName,
    CERTSRV_E_PROPERTY_EMPTY);

error:
    if (NULL != strName)
    {
  SysFreeString(strName);
    }
    return(hr);
}

HRESULT polGetRequestLongProperty | ( | IN ICertServerPolicy * | pServer,
 |  | IN WCHAR const * | pwszPropertyName,
 |  | OUT LONG * | plOut
 | ) |  |

Definition at line 223 of file policy.cpp.

{
    HRESULT hr;

    hr = polGetLongProperty(pServer, TRUE, pwszPropertyName, plOut);
    _JumpIfError2(hr, error, "polGetLongProperty", CERTSRV_E_PROPERTY_EMPTY);

error:
    return(hr);
}

HRESULT polGetRequestStringProperty | ( | IN ICertServerPolicy * | pServer,
 |  | IN WCHAR const * | pwszPropertyName,
 |  | OUT BSTR * | pstrOut
 | ) |  |

Definition at line 191 of file policy.cpp.

{
    HRESULT hr;

    hr = polGetStringProperty(pServer, TRUE, pwszPropertyName, pstrOut);
    _JumpIfError2(hr, error, "polGetStringProperty", CERTSRV_E_PROPERTY_EMPTY);

error:
    return(hr);
}

HRESULT polGetServerCallbackInterface | ( | OUT ICertServerPolicy ** | ppServer,
 |  | IN LONG | Context
 | ) |  |

Definition at line 28 of file policy.cpp.

{
    HRESULT hr;

    if (NULL == ppServer)
    {
        hr = E_POINTER;
  _JumpError(hr, error, "Policy:polGetServerCallbackInterface");
    }

    hr = CoCreateInstance(
                    CLSID_CCertServerPolicy,
                    NULL,               // pUnkOuter
                    CLSCTX_INPROC_SERVER,
                    IID_ICertServerPolicy,
                    (VOID **) ppServer);
    _JumpIfError(hr, error, "Policy:CoCreateInstance");

    if (NULL == *ppServer)
    {
        hr = E_UNEXPECTED;
  _JumpError(hr, error, "Policy:CoCreateInstance");
    }

    // only set context if nonzero
    if (0 != Context)
    {
        hr = (*ppServer)->SetContext(Context);
        _JumpIfError(hr, error, "Policy:SetContext");
    }

error:
    return hr;
}

HRESULT polSetCertificateExtension | ( | IN ICertServerPolicy * | pServer,
 |  | IN WCHAR const * | pwszExtensionName,
 |  | IN DWORD | dwPropType,
 |  | IN DWORD | dwExtFlags,
 |  | IN VARIANT const * | pvarIn
 | ) |  |

Definition at line 320 of file policy.cpp.

{
    HRESULT hr;
    BSTR strName = NULL;

    strName = SysAllocString(pwszExtensionName);
    if (NULL == strName)
    {
  hr = E_OUTOFMEMORY;
  _JumpError(hr, error, "Policy:SysAllocString");
    }
    hr = pServer->SetCertificateExtension(
            strName,
            dwPropType,
            dwExtFlags,
            pvarIn);
    _JumpIfErrorStr(
    hr,
    error,
    "Policy:SetCertificateExtension",
    pwszExtensionName);

error:
    if (NULL != strName)
    {
  SysFreeString(strName);
    }
    return(hr);
}

VOID ReqCleanup ( VOID )
HRESULT ReqInitialize ( IN ICertServerPolicy * pServer )

Definition at line 22 of file request.cpp.

{
    HRESULT hr;

    hr = S_OK;

    return(hr);
}

Variable Documentation

BOOL fDebug

Definition at line 20 of file exit.cpp.

Generated on Wed Nov 13 2024 16:54:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Policy/C++/Windows.Net/request.cpp File Reference

  • Security
  • CertServices
  • Policy
  • C++
  • Windows.Net
Functions

request.cpp File Reference

#include "pch.cpp"
#include <assert.h>
#include "celib.h"
#include "policy.h"
#include "module.h"

Go to the source code of this file.

Functions

VOID | ReqCleanup ()
HRESULT | ReqInitialize (IN ICertServerPolicy *pServer)

Function Documentation

VOID ReqCleanup ( )

Definition at line 34 of file request.cpp.

{
}

HRESULT ReqInitialize ( IN ICertServerPolicy * pServer )

Definition at line 22 of file request.cpp.

{
    HRESULT hr;

    hr = S_OK;

    return(hr);
}

Generated on Wed Nov 13 2024 16:54:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Policy/C++/Windows.Net/resource.h File Reference

  • Security
  • CertServices
  • Policy
  • C++
  • Windows.Net
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDS_CERTMANAGEPOLICYMODULE_DESC 2
#define | IDS_CERTPOLICY_DESC 1

Define Documentation

#define IDS_CERTMANAGEPOLICYMODULE_DESC 2

Definition at line 16 of file resource.h.

#define IDS_CERTPOLICY_DESC 1

Definition at line 15 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Policy/C++/Windows2000/Atl.Cpp File Reference

  • Security
  • CertServices
  • Policy
  • C++
  • Windows2000

Atl.Cpp File Reference

#include <pch.cpp>
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:27 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Policy/C++/Windows2000/CeDebug.Cpp File Reference

  • Security
  • CertServices
  • Policy
  • C++
  • Windows2000
Functions

CeDebug.Cpp File Reference

#include <pch.cpp>
#include <stdio.h>
#include <stdarg.h>

Go to the source code of this file.

Functions

int WINAPIV ceDbgPrintf (IN BOOL fDebug, IN LPCSTR lpFmt,...)

Function Documentation

int WINAPIV ceDbgPrintf | ( | IN BOOL | fDebug,
 |  | IN LPCSTR | lpFmt,
 |  |  | ...
 | ) |  |

Definition at line 31 of file CeDebug.Cpp.

{
    va_list arglist;
    CHAR ach[4096];
    int cch = 0;
    HANDLE hStdOut;
    DWORD dwErr;

    dwErr = GetLastError();
    if (fDebug)
    {
  _try
  {
      va_start(arglist, lpFmt);
      cch = _vsnprintf(ach, sizeof(ach), lpFmt, arglist);
      va_end(arglist);

      if (0 > cch)
      {
    strcpy(&ach[sizeof(ach) - 5], "...\n");
      }

      if (!IsDebuggerPresent())
      {
    hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
    if (hStdOut != INVALID_HANDLE_VALUE)
    {
        fputs(ach, stdout);
        fflush(stdout);
    }
      }
      OutputDebugStringA(ach);
  }
  _except(EXCEPTION_EXECUTE_HANDLER)
  {
      // return failure
      cch = 0;
  }
    }
    SetLastError(dwErr);
    return(cch);
}

Generated on Wed Nov 13 2024 16:54:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Policy/C++/Windows2000/CeError.Cpp File Reference

  • Security
  • CertServices
  • Policy
  • C++
  • Windows2000
Defines | Functions

CeError.Cpp File Reference

#include <pch.cpp>
#include "celibw2k.h"
#include <assert.h>
#include <stdio.h>
#include <ntdsbmsg.h>

Go to the source code of this file.

Defines

#define | CERTLIB_12BITERRORMASK 0x00000fff
#define | CERTLIB_WIN32ERRORMASK 0x0000ffff
#define | DELAYLOAD_FROM_WIN32(hr)
#define | E_DELAYLOAD_MOD_NOT_FOUND DELAYLOAD_FROM_WIN32(ERROR_MOD_NOT_FOUND)
#define | E_DELAYLOAD_PROC_NOT_FOUND DELAYLOAD_FROM_WIN32(ERROR_PROC_NOT_FOUND)
#define | FACILITY_DELAYLOAD 109
#define | HRESULT_FROM_JETERROR(jerr) ((STATUS_SEVERITY_ERROR << 30) | (FACILITY_NTDSB << 16) | -jerr)
#define | HRESULT_FROM_JETWARNING(jerr) ((STATUS_SEVERITY_WARNING << 30) | (FACILITY_NTDSB << 16) | jerr)
#define | ISDELAYLOADHRESULT(hr)
#define | ISDELAYLOADHRESULTFACILITY(hr)
#define | ISJETERROR(hr) ((~CERTLIB_WIN32ERRORMASK & (hr)) == ~CERTLIB_WIN32ERRORMASK)
#define | ISJETHRESULT(hr)
#define | ISOSSERROR(hr) ((~CERTLIB_12BITERRORMASK & (hr)) == CRYPT_E_OSS_ERROR)
#define | ISWIN32ERROR(hr) ((~CERTLIB_WIN32ERRORMASK & (hr)) == 0)
#define | ISWIN32HRESULT(hr)
#define | JETERROR_FROM_HRESULT(hr) (-(LONG) (CERTLIB_WIN32ERRORMASK & (hr)))
#define | OSSERROR_FROM_HRESULT(hr) (CERTLIB_12BITERRORMASK & (hr))
#define | WIN32ERROR_FROM_DELAYLOAD(hr) (CERTLIB_WIN32ERRORMASK & (hr))
#define | WIN32ERROR_FROM_HRESULT(hr) (CERTLIB_WIN32ERRORMASK & (hr))
#define | wszCOLONSPACE L": "
#define | wszJETERRORPREFIX L"EDB"
#define | wszOSSERRORPREFIX L"ASN"
#define | wszWIN32ERRORPREFIX L"WIN32"

Functions

WCHAR * | ceGetErrorMessageText (IN HRESULT hr, IN BOOL fHResultString)
HRESULT | ceHExceptionCode (IN EXCEPTION_POINTERS const *pep)
WCHAR const * | ceHResultToString (IN OUT WCHAR *awchr, IN HRESULT hr)
WCHAR const * | ceHResultToStringEx (IN OUT WCHAR *awchr, IN HRESULT hr, IN BOOL fRaw)
WCHAR const * | ceHResultToStringRaw (IN OUT WCHAR *awchr, IN HRESULT hr)
VOID | ceInitErrorMessageText (IN DWORD idsUnexpected, IN DWORD idsUnknownErrorCode)
BOOL | ceIsDelayLoadHResult (IN HRESULT hr)
HRESULT | ceJetHResult (IN HRESULT hr)

Define Documentation

#define CERTLIB_12BITERRORMASK 0x00000fff

Definition at line 22 of file CeError.Cpp.

#define CERTLIB_WIN32ERRORMASK 0x0000ffff

Definition at line 23 of file CeError.Cpp.

#define DELAYLOAD_FROM_WIN32 ( hr )
Value:
((HRESULT) ((STATUS_SEVERITY_ERROR << 30) | \
    (FACILITY_DELAYLOAD << 16) | \
    (hr)))

Definition at line 68 of file CeError.Cpp.

#define E_DELAYLOAD_MOD_NOT_FOUND DELAYLOAD_FROM_WIN32(ERROR_MOD_NOT_FOUND)

Definition at line 81 of file CeError.Cpp.

#define E_DELAYLOAD_PROC_NOT_FOUND DELAYLOAD_FROM_WIN32(ERROR_PROC_NOT_FOUND)

Definition at line 84 of file CeError.Cpp.

#define FACILITY_DELAYLOAD 109

Definition at line 67 of file CeError.Cpp.

#define HRESULT_FROM_JETERROR ( jerr ) ((STATUS_SEVERITY_ERROR << 30) | (FACILITY_NTDSB << 16) | -jerr)

Definition at line 32 of file CeError.Cpp.

#define HRESULT_FROM_JETWARNING ( jerr ) ((STATUS_SEVERITY_WARNING << 30) | (FACILITY_NTDSB << 16) | jerr)

Definition at line 29 of file CeError.Cpp.

#define ISDELAYLOADHRESULT ( hr )
Value:
(E_DELAYLOAD_MOD_NOT_FOUND == (hr) || \
     E_DELAYLOAD_PROC_NOT_FOUND == (hr) || \
     HRESULT_FROM_WIN32(ERROR_MOD_NOT_FOUND) == (hr) || \
     HRESULT_FROM_WIN32(ERROR_PROC_NOT_FOUND) == (hr))

Definition at line 86 of file CeError.Cpp.

#define ISDELAYLOADHRESULTFACILITY ( hr )
Value:
((~CERTLIB_WIN32ERRORMASK & (hr)) == ((STATUS_SEVERITY_ERROR << 30) | \
            (FACILITY_DELAYLOAD << 16)))

Definition at line 76 of file CeError.Cpp.

#define ISJETERROR ( hr ) ((~CERTLIB_WIN32ERRORMASK & (hr)) == ~CERTLIB_WIN32ERRORMASK)

Definition at line 38 of file CeError.Cpp.

#define ISJETHRESULT ( hr )
Value:
((~CERTLIB_WIN32ERRORMASK & (hr)) == ((STATUS_SEVERITY_ERROR << 30) | \
            (FACILITY_NTDSB << 16)))

Definition at line 41 of file CeError.Cpp.

#define ISOSSERROR ( hr ) ((~CERTLIB_12BITERRORMASK & (hr)) == CRYPT_E_OSS_ERROR)

Definition at line 96 of file CeError.Cpp.

#define ISWIN32ERROR ( hr ) ((~CERTLIB_WIN32ERRORMASK & (hr)) == 0)

Definition at line 51 of file CeError.Cpp.

#define ISWIN32HRESULT ( hr )
Value:
((~CERTLIB_WIN32ERRORMASK & (hr)) == ((STATUS_SEVERITY_WARNING << 30) | \
            (FACILITY_WIN32 << 16)))

Definition at line 54 of file CeError.Cpp.

#define JETERROR_FROM_HRESULT ( hr ) (-(LONG) (CERTLIB_WIN32ERRORMASK & (hr)))

Definition at line 35 of file CeError.Cpp.

#define OSSERROR_FROM_HRESULT ( hr ) (CERTLIB_12BITERRORMASK & (hr))

Definition at line 99 of file CeError.Cpp.

#define WIN32ERROR_FROM_DELAYLOAD ( hr ) (CERTLIB_WIN32ERRORMASK & (hr))

Definition at line 73 of file CeError.Cpp.

#define WIN32ERROR_FROM_HRESULT ( hr ) (CERTLIB_WIN32ERRORMASK & (hr))

Definition at line 58 of file CeError.Cpp.

#define wszCOLONSPACE L": "

Definition at line 157 of file CeError.Cpp.

#define wszJETERRORPREFIX L"EDB"

Definition at line 45 of file CeError.Cpp.

#define wszOSSERRORPREFIX L"ASN"

Definition at line 102 of file CeError.Cpp.

#define wszWIN32ERRORPREFIX L"WIN32"

Definition at line 61 of file CeError.Cpp.

Function Documentation

WCHAR* ceGetErrorMessageText | ( | IN HRESULT | hr,
 |  | IN BOOL | fHResultString
 | ) |  |

Definition at line 244 of file CeError.Cpp.

{
    static WCHAR s_wszUknownDefault[] = L"Error %ws %ws";
    WCHAR *pwszRet = NULL;
    WCHAR *pwszMsgT;
    WCHAR const *pwszUnknown;
    WCHAR wszUnknown[10 * ARRAYSIZE(s_wszUknownDefault)];
    WCHAR wszUnexpected[512];
    WCHAR awchr[cwcHRESULTSTRING];
    DWORD cwc;
    DWORD cwcUnexpected = 0;
    HMODULE hMod = NULL;

    wszUnexpected[0] = L'\0';
    if (E_UNEXPECTED == hr && 0 != s_idsUnexpected)
    {
  cwcUnexpected = LoadString(
        NULL,
        s_idsUnexpected,  // L"Unexpected method call sequence."
        wszUnknown,
        ARRAYSIZE(wszUnknown));
    }
    cwc = FormatMessage(
                FORMAT_MESSAGE_ALLOCATE_BUFFER |
        FORMAT_MESSAGE_FROM_SYSTEM |
        FORMAT_MESSAGE_IGNORE_INSERTS,
                NULL,
                hr,
                MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
                (WCHAR *) &pwszRet,
                0,
                NULL);
    if (0 == cwc)
    {
  hMod = LoadLibrary(L"ntdsbmsg.dll");
  if (NULL != hMod)
  {
      cwc = FormatMessage(
        FORMAT_MESSAGE_ALLOCATE_BUFFER |
      FORMAT_MESSAGE_FROM_HMODULE |
      FORMAT_MESSAGE_IGNORE_INSERTS,
        hMod,
        hr,
        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
        (WCHAR *) &pwszRet,
        0,
        NULL);
  }
    }
    if (0 == cwc)
    {
  // couldn't find error, _snwprintf it instead

  if (0 != s_idsUnknownErrorCode)
  {
      cwc = LoadString(
      NULL,
      s_idsUnknownErrorCode,  // L"Error %ws %ws"
      wszUnknown,
      ARRAYSIZE(wszUnknown));
  }
  if (0 == cwc)
  {
      pwszUnknown = s_wszUknownDefault;
  }
  else
  {
      pwszUnknown = wszUnknown;
  }
  cwc = (DWORD)(wcslen(pwszUnknown) + cwcUnexpected + ARRAYSIZE(awchr) + 1);
        pwszRet = (WCHAR *) LocalAlloc(LMEM_FIXED, cwc * sizeof(WCHAR));
  if (NULL == pwszRet)
  {
      ceERRORPRINTLINE("LocalAlloc", E_OUTOFMEMORY);
      goto error;
  }
        _snwprintf(
    pwszRet,
    cwc,
    pwszUnknown,
    wszUnexpected,
    ceHResultToString(awchr, hr));
    }
    else
    {
        // strip trailing \r\n

        cwc = (DWORD)wcslen(pwszRet);

        if (2 <= cwc &&
      L'\r' == pwszRet[cwc - 2] &&
      L'\n' == pwszRet[cwc - 1])
  {
            pwszRet[cwc - 2] = L'\0';
  }
  awchr[0] = L'\0';
  if (fHResultString)
  {
      ceHResultToString(awchr, hr);
  }
  if (fHResultString || 0 != cwcUnexpected)
  {
      cwc = (DWORD)(wcslen(pwszRet) + 1 + cwcUnexpected + 1 + wcslen(awchr) + 1);
      pwszMsgT = (WCHAR *) LocalAlloc(LMEM_FIXED, cwc * sizeof(WCHAR));
      if (NULL == pwszMsgT)
      {
    ceERRORPRINTLINE("LocalAlloc", E_OUTOFMEMORY);
    goto error;
      }
      _snwprintf(
        pwszMsgT,
        cwc,
        L"%ws %ws %ws",
        pwszRet,
        wszUnexpected,
        awchr);
      LocalFree(pwszRet);
      pwszRet = pwszMsgT;
  }
    }

error:
    if (NULL != hMod)
    {
  FreeLibrary(hMod);
    }
    return(pwszRet);
}

HRESULT ceHExceptionCode ( IN EXCEPTION_POINTERS const * pep )

Definition at line 140 of file CeError.Cpp.

{
    HRESULT hr = pep->ExceptionRecord->ExceptionCode;

    return(ceHError(hr));
}

WCHAR const* ceHResultToString | ( | IN OUT WCHAR * | awchr,
 |  | IN HRESULT | hr
 | ) |  |

Definition at line 211 of file CeError.Cpp.

{
    return(ceHResultToStringEx(awchr, hr, FALSE));
}

WCHAR const* ceHResultToStringEx | ( | IN OUT WCHAR * | awchr,
 |  | IN HRESULT | hr,
 |  | IN BOOL | fRaw
 | ) |  |

Definition at line 160 of file CeError.Cpp.

{
    HRESULT hrd;
    WCHAR const *pwszType;

    hrd = hr;
    pwszType = L"";
    if (ISJETERROR(hr))
    {
  pwszType = wszJETERRORPREFIX wszCOLONSPACE;
    }
    else if (ISJETHRESULT(hr))
    {
  hrd = JETERROR_FROM_HRESULT(hr);
  pwszType = wszJETERRORPREFIX wszCOLONSPACE;
    }
    else if (ISWIN32HRESULT(hr))
    {
  hrd = WIN32ERROR_FROM_HRESULT(hr);
  pwszType = wszWIN32ERRORPREFIX wszCOLONSPACE;
    }
    else if (ISDELAYLOADHRESULTFACILITY(hr))
    {
  hrd = WIN32ERROR_FROM_DELAYLOAD(hr);
  pwszType = wszWIN32ERRORPREFIX wszCOLONSPACE;
    }
    else if (ISOSSERROR(hr))
    {
  hrd = OSSERROR_FROM_HRESULT(hr);
  pwszType = wszOSSERRORPREFIX wszCOLONSPACE;
    }
    if (fRaw)
    {
  pwszType = L"";
    }

    _snwprintf(
  awchr,
  cwcHRESULTSTRING,
  L"0x%x (%ws%d)",
  hr,
  pwszType,
  hrd);
    return(awchr);
}

WCHAR const* ceHResultToStringRaw | ( | IN OUT WCHAR * | awchr,
 |  | IN HRESULT | hr
 | ) |  |

Definition at line 220 of file CeError.Cpp.

{
    return(ceHResultToStringEx(awchr, hr, TRUE));
}

VOID ceInitErrorMessageText | ( | IN DWORD | idsUnexpected,
 |  | IN DWORD | idsUnknownErrorCode
 | ) |  |

Definition at line 232 of file CeError.Cpp.

{
    s_idsUnexpected = idsUnexpected;
    s_idsUnknownErrorCode = idsUnknownErrorCode;
}

BOOL ceIsDelayLoadHResult ( IN HRESULT hr )

Definition at line 150 of file CeError.Cpp.

{
    return(ISDELAYLOADHRESULT(hr));
}

HRESULT ceJetHResult ( IN HRESULT hr )

Definition at line 108 of file CeError.Cpp.

{
#if DBG_CERTSRV
    HRESULT hrIn = hr;
#endif
    if (S_OK != hr)
    {
        if (SUCCEEDED(hr))
        {
#if 0
      hr = HRESULT_FROM_JETWARNING(hr);
#else
            if (S_FALSE != hr)
      {
    ceERRORPRINTLINE("JetHResult: mapping to S_FALSE", hr);
      }
            assert(S_FALSE == hr);
            hr = S_FALSE;
#endif
        }
        else if (ISJETERROR(hr))
        {
      hr = HRESULT_FROM_JETERROR(hr);
        }
    }
    assert(S_OK == hr || S_FALSE == hr || FAILED(hr));
    return(hr);
}

Generated on Wed Nov 13 2024 16:54:28 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Policy/C++/Windows2000/CeFormat.Cpp File Reference

  • Security
  • CertServices
  • Policy
  • C++
  • Windows2000
Defines | Functions

CeFormat.Cpp File Reference

#include "pch.cpp"
#include <stdio.h>
#include <assert.h>
#include "celibw2k.h"
#include <wininet.h>

Go to the source code of this file.

Defines

#define | cwcCHOPBASE (cwcCNMAX - (cwcCHOPHASHMAX + cwcSUFFIXMAX))
#define | cwcCHOPHASHMAX (1 + 5)
#define | cwcCNMAX 64
#define | wszDSSEARCHBASECRLATTRIBUTE L"?certificateRevocationList?base?objectclass=cRLDistributionPoint"
#define | wszDSSEARCHCACERTATTRIBUTE L"?cACertificate?base?objectclass=certificationAuthority"
#define | wszDSSEARCHDELTACRLATTRIBUTE L"?deltaRevocationList?base?objectclass=cRLDistributionPoint"

Functions

HRESULT | ceDupString (IN WCHAR const *pwszIn, IN WCHAR **ppwszOut)
HRESULT | ceFormatCertsrvStringArray (IN BOOL fURL, IN LPCWSTR pwszServerName_p1_2, IN LPCWSTR pwszSanitizedName_p3_7, IN DWORD iCert_p4, IN LPCWSTR pwszDomainDN_p5, IN LPCWSTR pwszConfigDN_p6, IN DWORD iCRL_p8, IN BOOL fDeltaCRL_p9, IN BOOL fDSAttrib_p10_11, IN DWORD cStrings, IN LPCWSTR *apwszStringsIn, OUT LPWSTR *apwszStringsOut)
HRESULT | ceInternetCanonicalizeUrl (IN WCHAR const *pwszIn, OUT WCHAR **ppwszOut)
HRESULT | ceSanitizedNameToDSName (IN WCHAR const *pwszSanitizedName, OUT WCHAR **ppwszNameOut)

Define Documentation

#define cwcCHOPBASE (cwcCNMAX - (cwcCHOPHASHMAX + cwcSUFFIXMAX))

Definition at line 48 of file CeFormat.Cpp.

#define cwcCHOPHASHMAX (1 + 5)

Definition at line 47 of file CeFormat.Cpp.

#define cwcCNMAX 64

Definition at line 46 of file CeFormat.Cpp.

#define wszDSSEARCHBASECRLATTRIBUTE L"?certificateRevocationList?base?objectclass=cRLDistributionPoint"

Definition at line 196 of file CeFormat.Cpp.

#define wszDSSEARCHCACERTATTRIBUTE L"?cACertificate?base?objectclass=certificationAuthority"

Definition at line 204 of file CeFormat.Cpp.

#define wszDSSEARCHDELTACRLATTRIBUTE L"?deltaRevocationList?base?objectclass=cRLDistributionPoint"

Definition at line 200 of file CeFormat.Cpp.

Function Documentation

HRESULT ceDupString | ( | IN WCHAR const * | pwszIn,
 |  | IN WCHAR ** | ppwszOut
 | ) |  |

Definition at line 24 of file CeFormat.Cpp.

{
    DWORD cb;
    HRESULT hr;

    cb = (DWORD)((wcslen(pwszIn) + 1) * sizeof(WCHAR));
    *ppwszOut = (WCHAR *) LocalAlloc(LMEM_FIXED, cb);
    if (NULL == *ppwszOut)
    {
  hr = E_OUTOFMEMORY;
  _JumpError(hr, error, "LocalAlloc");
    }
    CopyMemory(*ppwszOut, pwszIn, cb);
    hr = S_OK;

error:
    return(hr);
}

HRESULT ceFormatCertsrvStringArray | ( | IN BOOL | fURL,
 |  | IN LPCWSTR | pwszServerName_p1_2,
 |  | IN LPCWSTR | pwszSanitizedName_p3_7,
 |  | IN DWORD | iCert_p4,
 |  | IN LPCWSTR | pwszDomainDN_p5,
 |  | IN LPCWSTR | pwszConfigDN_p6,
 |  | IN DWORD | iCRL_p8,
 |  | IN BOOL | fDeltaCRL_p9,
 |  | IN BOOL | fDSAttrib_p10_11,
 |  | IN DWORD | cStrings,
 |  | IN LPCWSTR * | apwszStringsIn,
 |  | OUT LPWSTR * | apwszStringsOut
 | ) |  |

Definition at line 208 of file CeFormat.Cpp.

{
    HRESULT hr = S_OK;
    LPCWSTR apwszInsertionArray[100];  // 100 'cause this is the max number of insertion numbers allowed by FormatMessage
    LPWSTR    pwszCurrent = NULL;
    BSTR      strShortMachineName = NULL;
    DWORD     i;
    WCHAR *pwszSanitizedDSName = NULL;
    WCHAR wszCertSuffix[cwcFILENAMESUFFIXMAX];
    WCHAR wszCRLSuffix[cwcFILENAMESUFFIXMAX];
    WCHAR wszDeltaCRLSuffix[cwcFILENAMESUFFIXMAX];
    WCHAR const *pwszT;

    ZeroMemory(apwszStringsOut, cStrings * sizeof(apwszStringsOut[0]));
    ZeroMemory(apwszInsertionArray, sizeof(apwszInsertionArray));

    // Format the template into a real name

    // Initialize the insertion string array.
    // Machine DNS name (%1)

    assert(L'1' == wszFCSAPARM_SERVERDNSNAME[1]);
    apwszInsertionArray[1 - 1] = pwszServerName_p1_2;

    // Short Machine Name (%2)

    assert(L'2' == wszFCSAPARM_SERVERSHORTNAME[1]);
    strShortMachineName = SysAllocString(pwszServerName_p1_2);
    if (strShortMachineName == NULL)
    {
        hr = E_OUTOFMEMORY;
        _JumpIfError(hr, error, "SysAllocString");
    }

    pwszCurrent = wcschr(strShortMachineName, L'.');
    if(pwszCurrent)
    {
        *pwszCurrent = 0;
    }
    apwszInsertionArray[2 - 1] = strShortMachineName;

    // sanitized name (%3)

    assert(L'3' == wszFCSAPARM_SANITIZEDCANAME[1]);
    apwszInsertionArray[3 - 1] = pwszSanitizedName_p3_7;

    // Cert filename suffix (%4)

    assert(L'4' == wszFCSAPARM_CERTFILENAMESUFFIX[1]);
    wszCertSuffix[0] = L'\0';
    if (0 != iCert_p4)
    {
        wsprintf(wszCertSuffix, L"(%u)", iCert_p4);
    }
    apwszInsertionArray[4 - 1] = wszCertSuffix;

    assert(L'5' == wszFCSAPARM_DOMAINDN[1]);
    apwszInsertionArray[5 - 1] = pwszDomainDN_p5;

    assert(L'6' == wszFCSAPARM_CONFIGDN[1]);
    apwszInsertionArray[6 - 1] = pwszConfigDN_p6;

    // Don't pass pwszSanitizedName_p3_7 to SysAllocStringLen with the extended
    // length to avoid faulting past end of pwszSanitizedName_p3_7.

    assert(L'7' == wszFCSAPARM_SANITIZEDCANAMEHASH[1]);
    hr = ceSanitizedNameToDSName(pwszSanitizedName_p3_7, &pwszSanitizedDSName);
    _JumpIfError(hr, error, "ceSanitizedNameToDSName");

    apwszInsertionArray[7 - 1] = pwszSanitizedDSName;

    // CRL filename suffix (%8)

    assert(L'8' == wszFCSAPARM_CRLFILENAMESUFFIX[1]);
    wszCRLSuffix[0] = L'\0';
    if (0 != iCRL_p8)
    {
        wsprintf(wszCRLSuffix, L"(%u)", iCRL_p8);
    }
    apwszInsertionArray[8 - 1] = wszCRLSuffix;

    assert(L'9' == wszFCSAPARM_CRLDELTAFILENAMESUFFIX[1]);
    wszDeltaCRLSuffix[0] = L'\0';
    if (fDeltaCRL_p9)
    {
        wcscpy(wszDeltaCRLSuffix, L"+");
    }
    apwszInsertionArray[9 - 1] = wszDeltaCRLSuffix;

    assert(L'1' == wszFCSAPARM_DSCRLATTRIBUTE[1]);
    assert(L'0' == wszFCSAPARM_DSCRLATTRIBUTE[2]);
    pwszT = L"";
    if (fDSAttrib_p10_11)
    {
  pwszT = fDeltaCRL_p9?
        wszDSSEARCHDELTACRLATTRIBUTE :
        wszDSSEARCHBASECRLATTRIBUTE;
    }
    apwszInsertionArray[10 - 1] = pwszT;

    assert(L'1' == wszFCSAPARM_DSCACERTATTRIBUTE[1]);
    assert(L'1' == wszFCSAPARM_DSCACERTATTRIBUTE[2]);
    pwszT = L"";
    if (fDSAttrib_p10_11)
    {
  pwszT = wszDSSEARCHCACERTATTRIBUTE;
    }
    apwszInsertionArray[11 - 1] = pwszT;

    for (i = 0; i < cStrings; i++)
    {
        if (0 == FormatMessage(
      FORMAT_MESSAGE_ALLOCATE_BUFFER |
          FORMAT_MESSAGE_FROM_STRING |
          FORMAT_MESSAGE_ARGUMENT_ARRAY,
      (VOID *) apwszStringsIn[i],
      0,              // dwMessageID
      0,              // dwLanguageID
      (LPWSTR) &apwszStringsOut[i],
      (DWORD)wcslen(apwszStringsIn[i]),
      (va_list *) apwszInsertionArray))
        {
            hr = ceHLastError();
      _JumpError(hr, error, "FormatMessage");
        }
  if (fURL)
  {
      WCHAR *pwsz;

      hr = ceInternetCanonicalizeUrl(apwszStringsOut[i], &pwsz);
      _JumpIfError(hr, error, "ceInternetCanonicalizeUrl");

      LocalFree(apwszStringsOut[i]);
      apwszStringsOut[i] = pwsz;
  }
    }

error:
    if (S_OK != hr)
    {
  for (i = 0; i < cStrings; i++)
  {
      if (NULL != apwszStringsOut[i])
      {
    LocalFree(apwszStringsOut[i]);
    apwszStringsOut[i] = NULL;
      }
  }
    }
    if(strShortMachineName)
    {
        SysFreeString(strShortMachineName);
    }
    if (NULL != pwszSanitizedDSName)
    {
        LocalFree(pwszSanitizedDSName);
    }
    return (hr);
}

HRESULT ceInternetCanonicalizeUrl | ( | IN WCHAR const * | pwszIn,
 |  | OUT WCHAR ** | ppwszOut
 | ) |  |

Definition at line 106 of file CeFormat.Cpp.

{
    HRESULT hr;
    WCHAR *pwsz = NULL;

    assert(NULL != pwszIn);

    // Calculate required buffer size by passing a very small buffer
    // The call will fail, and tell us how big the buffer should be.

    WCHAR wszPlaceHolder[1];
    DWORD cwc = ARRAYSIZE(wszPlaceHolder);
    BOOL bResult;

    bResult = InternetCanonicalizeUrl(
        pwszIn,   // lpszUrl
        wszPlaceHolder, // lpszBuffer
        &cwc,   // lpdwBufferLength
        0);   // dwFlags
    assert(!bResult); // This will always fail

    hr = ceHLastError();
    if (HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) != hr)
    {
        // unexpected error

        _JumpError(hr, error, "InternetCanonicalizeUrl");
    }

    // NOTE: InternetCanonicalizeUrl counts characters, not bytes as doc'd
    // cwc includes trailing L'0'

    pwsz = (WCHAR *) LocalAlloc(LMEM_FIXED, cwc * sizeof(WCHAR));
    if (NULL == pwsz)
    {
  hr = E_OUTOFMEMORY;
  _JumpError(hr, error, "LocalAlloc");
    }

    // canonicalize
    if (!InternetCanonicalizeUrl(
          pwszIn, // lpszUrl
          pwsz, // lpszBuffer
          &cwc, // lpdwBufferLength
          0))   // dwFlags
    {
        hr = ceHLastError();
        _JumpError(hr, error, "InternetCanonicalizeUrl");
    }
    *ppwszOut = pwsz;
    pwsz = NULL;
    hr = S_OK;

error:
    if (NULL != pwsz)
    {
        LocalFree(pwsz);
    }
    return(hr);
}

HRESULT ceSanitizedNameToDSName | ( | IN WCHAR const * | pwszSanitizedName,
 |  | OUT WCHAR ** | ppwszNameOut
 | ) |  |

Definition at line 51 of file CeFormat.Cpp.

{
    HRESULT hr;
    DWORD cwc;
    DWORD cwcCopy;
    WCHAR wszDSName[cwcCHOPBASE + cwcCHOPHASHMAX + 1];

    *ppwszNameOut = NULL;

    cwc = (DWORD)wcslen(pwszSanitizedName);
    cwcCopy = cwc;
    if (cwcCHOPBASE < cwcCopy)
    {
  cwcCopy = cwcCHOPBASE;
    }
    CopyMemory(wszDSName, pwszSanitizedName, cwcCopy * sizeof(WCHAR));
    wszDSName[cwcCopy] = L'\0';

    if (cwcCHOPBASE < cwc)
    {
        // Hash the rest of the name into a USHORT
        USHORT usHash = 0;
  DWORD i;
  WCHAR *pwsz;

  // Truncate an incomplete sanitized Unicode character

  pwsz = wcsrchr(wszDSName, L'!');
  if (NULL != pwsz && wcslen(pwsz) < 5)
  {
      cwcCopy -= (DWORD)wcslen(pwsz);
      *pwsz = L'\0';
  }

        for (i = cwcCopy; i < cwc; i++)
        {
            USHORT usLowBit = (0x8000 & usHash)? 1 : 0;

      usHash = ((usHash << 1) | usLowBit) + pwszSanitizedName[i];
        }
  wsprintf(&wszDSName[cwcCopy], L"-%05hu", usHash);
  assert(wcslen(wszDSName) < ARRAYSIZE(wszDSName));
    }

    hr = ceDupString(wszDSName, ppwszNameOut);
    _JumpIfError(hr, error, "ceDupString");

error:
    return(hr);
}

Generated on Wed Nov 13 2024 16:54:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Policy/C++/Windows2000/CeLib.Cpp File Reference

  • Security
  • CertServices
  • Policy
  • C++
  • Windows2000
Classes | Defines | Typedefs | Functions | Variables

CeLib.Cpp File Reference

#include "pch.cpp"
#include <stdio.h>
#include <assert.h>
#include "celibw2k.h"

Go to the source code of this file.

Classes

struct | _UNITSTABLE

Defines

#define | CUNITSTABLEMAX (sizeof(g_aut)/sizeof(g_aut[0]))
#define | wszDURATIONUNITSDAYS wszPERIODDAYS
#define | wszDURATIONUNITSHOURS wszPERIODHOURS
#define | wszDURATIONUNITSMINUTES wszPERIODMINUTES
#define | wszDURATIONUNITSMONTHS wszPERIODMONTHS
#define | wszDURATIONUNITSSECONDS wszPERIODSECONDS
#define | wszDURATIONUNITSWEEKS wszPERIODWEEKS
#define | wszDURATIONUNITSYEARS wszPERIODYEARS

Typedefs

typedef struct _UNITSTABLE | UNITSTABLE

Functions

BOOL | ceConvertSzToBstr (OUT BSTR *pbstr, IN CHAR const *pch, IN LONG cch)
BOOL | ceConvertSzToWsz (OUT WCHAR **ppwsz, IN char const *pch, IN LONG cch)
BOOL | ceConvertWszToBstr (OUT BSTR *pbstr, IN WCHAR const *pwc, IN LONG cb)
BOOL | ceConvertWszToSz (OUT CHAR **ppsz, IN WCHAR const *pwc, IN LONG cwc)
HRESULT | ceDateToFileTime (IN DATE const *pDate, OUT FILETIME *pft)
BOOL | ceDecodeObject (IN DWORD dwEncodingType, IN LPCSTR lpszStructType, IN BYTE const *pbEncoded, IN DWORD cbEncoded, IN BOOL fCoTaskMemAlloc, OUT VOID **ppvStructInfo, OUT DWORD *pcbStructInfo)
HRESULT | ceDispatchSetErrorInfo (IN HRESULT hrError, IN WCHAR const *pwszDescription, OPTIONAL IN WCHAR const *pwszProgId, OPTIONAL IN IID const *piid)
WCHAR * | ceDuplicateString (IN WCHAR const *pwsz)
BOOL | ceEncodeObject (IN DWORD dwEncodingType, IN LPCSTR lpszStructType, IN VOID const *pvStructInfo, IN DWORD dwFlags, IN BOOL fCoTaskMemAlloc, OUT BYTE **ppbEncoded, OUT DWORD *pcbEncoded)
VOID | ceErrorPrintLine (IN char const *pszFile, IN DWORD line, IN char const *pszMessage, IN HRESULT hr)
HRESULT | ceFileTimeToDate (IN FILETIME const *pft, OUT DATE *pDate)
VOID | ceFreeBstr (IN OUT BSTR *pstr)
WCHAR const * | ceGetOIDName (IN WCHAR const *pwszObjId)
WCHAR const * | ceGetOIDNameA (IN char const *pszObjId)
HRESULT | ceHError (IN HRESULT hr)
HRESULT | ceHLastError (VOID)
HRESULT | ceMakeExprDate (IN OUT DATE *pDate, IN LONG lDelta, IN enum ENUM_PERIOD enumPeriod)
VOID | ceMakeExprDateTime (IN OUT FILETIME *pft, IN LONG lDelta, IN enum ENUM_PERIOD enumPeriod)
HRESULT | ceTranslatePeriodUnits (IN WCHAR const *pwszPeriod, IN LONG lCount, OUT enum ENUM_PERIOD *penumPeriod, OUT LONG *plCount)
HRESULT | ceVerifyAltNameString (IN LONG NameChoice, IN WCHAR const *pwszName)
HRESULT | ceVerifyObjId (IN WCHAR const *pwszObjId)
int | ceWtoI (IN WCHAR const *string, OUT BOOL *pfValid)

Variables

UNITSTABLE g_aut []

Define Documentation

#define CUNITSTABLEMAX (sizeof(g_aut)/sizeof(g_aut[0]))

Definition at line 641 of file CeLib.Cpp.

#define wszDURATIONUNITSDAYS wszPERIODDAYS

Definition at line 21 of file CeLib.Cpp.

#define wszDURATIONUNITSHOURS wszPERIODHOURS

Definition at line 22 of file CeLib.Cpp.

#define wszDURATIONUNITSMINUTES wszPERIODMINUTES

Definition at line 23 of file CeLib.Cpp.

#define wszDURATIONUNITSMONTHS wszPERIODMONTHS

Definition at line 24 of file CeLib.Cpp.

#define wszDURATIONUNITSSECONDS wszPERIODSECONDS

Definition at line 25 of file CeLib.Cpp.

#define wszDURATIONUNITSWEEKS wszPERIODWEEKS

Definition at line 26 of file CeLib.Cpp.

#define wszDURATIONUNITSYEARS wszPERIODYEARS

Definition at line 27 of file CeLib.Cpp.

Typedef Documentation

typedef struct _UNITSTABLE UNITSTABLE

Function Documentation

BOOL ceConvertSzToBstr | ( | OUT BSTR * | pbstr,
 |  | IN CHAR const * | pch,
 |  | IN LONG | cch
 | ) |  |

Definition at line 341 of file CeLib.Cpp.

{
    BOOL fOk = FALSE;
    BSTR bstr = NULL;
    LONG cwc = 0;

    ceFreeBstr(pbstr);
    if (-1 == cch)
    {
  cch = (LONG)strlen(pch);
    }
    while (TRUE)
    {
  cwc = MultiByteToWideChar(GetACP(), 0, pch, cch, bstr, cwc);
  if (0 >= cwc)
  {
      //hr = ceHLastError();
      //printf("MultiByteToWideChar returned %d (%x)\n", hr, hr);
      break;
  }
  if (NULL != bstr)
  {
      bstr[cwc] = L'\0';
      *pbstr = bstr;
      fOk = TRUE;
      break;
  }
  bstr = SysAllocStringLen(NULL, cwc);
  if (NULL == bstr)
  {
      break;
  }
    }
    return(fOk);
}

BOOL ceConvertSzToWsz | ( | OUT WCHAR ** | ppwsz,
 |  | IN char const * | pch,
 |  | IN LONG | cch
 | ) |  |

Definition at line 300 of file CeLib.Cpp.

{
    BOOL fOk = FALSE;
    LONG cwc = 0;

    *ppwsz = NULL;
    while (TRUE)
    {
  cwc = MultiByteToWideChar(GetACP(), 0, pch, cch, *ppwsz, cwc);
  if (0 >= cwc)
  {
      DWORD err;

      err = GetLastError();
      ceERRORPRINTLINE("MultiByteToWideChar", err);
      if (NULL != *ppwsz)
      {
    LocalFree(*ppwsz);
    *ppwsz = NULL;
      }
      break;
  }
  if (NULL != *ppwsz)
  {
      fOk = TRUE;
      break;
  }
  *ppwsz = (WCHAR *) LocalAlloc(LMEM_FIXED, (cwc + 1) * sizeof(WCHAR));
  if (NULL == *ppwsz)
  {
      break;
  }
    }
    return(fOk);
}

BOOL ceConvertWszToBstr | ( | OUT BSTR * | pbstr,
 |  | IN WCHAR const * | pwc,
 |  | IN LONG | cb
 | ) |  |

Definition at line 268 of file CeLib.Cpp.

{
    BOOL fOk = FALSE;
    BSTR bstr;

    ceFreeBstr(pbstr);
    do
    {
  bstr = NULL;
  if (NULL != pwc)
  {
      if (-1 == cb)
      {
    cb = (LONG)(wcslen(pwc) * sizeof(WCHAR));
      }
      bstr = SysAllocStringByteLen((char const *) pwc, cb);
      if (NULL == bstr)
      {
    break;
      }
  }
  *pbstr = bstr;
  fOk = TRUE;
    } while (FALSE);
    return(fOk);
}

BOOL ceConvertWszToSz | ( | OUT CHAR ** | ppsz,
 |  | IN WCHAR const * | pwc,
 |  | IN LONG | cwc
 | ) |  |

Definition at line 219 of file CeLib.Cpp.

{
    BOOL fOk = FALSE;
    LONG cch = 0;

    *ppsz = NULL;
    while (TRUE)
    {
  cch = WideCharToMultiByte(
      GetACP(),
      0,          // dwFlags
      pwc,
      cwc,        // cchWideChar, -1 => null terminated
      *ppsz,
      cch,
      NULL,
      NULL);
  if (0 >= cch)
  {
      DWORD err;

      err = GetLastError();
      ceERRORPRINTLINE("WideCharToMultiByte", err);
      if (NULL != *ppsz)
      {
    LocalFree(*ppsz);
    *ppsz = NULL;
      }
      break;
  }
  if (NULL != *ppsz)
  {
      fOk = TRUE;
      break;
  }
  *ppsz = (CHAR *) LocalAlloc(LMEM_FIXED, cch + 1);
  if (NULL == *ppsz)
  {
      break;
  }
    }
    return(fOk);
}

HRESULT ceDateToFileTime | ( | IN DATE const * | pDate,
 |  | OUT FILETIME * | pft
 | ) |  |

Definition at line 438 of file CeLib.Cpp.

{
    SYSTEMTIME st;
    HRESULT hr = S_OK;

    if (*pDate == 0.0)
    {
        GetSystemTime(&st);
    }
    else
    {
  if (!VariantTimeToSystemTime(*pDate, &st))
  {
      hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
      _JumpError(hr, error, "VariantTimeToSystemTime");
  }
    }

    if (!SystemTimeToFileTime(&st, pft))
    {
        hr = ceHLastError();
        _JumpError(hr, error, "SystemTimeToFileTime");
    }

error:
    return(hr);
}

BOOL ceDecodeObject | ( | IN DWORD | dwEncodingType,
 |  | IN LPCSTR | lpszStructType,
 |  | IN BYTE const * | pbEncoded,
 |  | IN DWORD | cbEncoded,
 |  | IN BOOL | fCoTaskMemAlloc,
 |  | OUT VOID ** | ppvStructInfo,
 |  | OUT DWORD * | pcbStructInfo
 | ) |  |

Definition at line 36 of file CeLib.Cpp.

{
    BOOL b;

    assert(!fCoTaskMemAlloc);
    *ppvStructInfo = NULL;
    *pcbStructInfo = 0;
    while (TRUE)
    {
  b = CryptDecodeObject(
        dwEncodingType,
        lpszStructType,
        pbEncoded,
        cbEncoded,
        0,                  // dwFlags
        *ppvStructInfo,
        pcbStructInfo);
  if (b && 0 == *pcbStructInfo)
  {
      SetLastError(HRESULT_FROM_WIN32(ERROR_INVALID_DATA));
      b = FALSE;
  }
  if (!b)
  {
      if (NULL != *ppvStructInfo)
      {
    HRESULT hr = GetLastError();

    LocalFree(*ppvStructInfo);
    *ppvStructInfo = NULL;
    SetLastError(hr);
      }
      break;
  }
  if (NULL != *ppvStructInfo)
  {
      break;
  }
  *ppvStructInfo = (BYTE *) LocalAlloc(LMEM_FIXED, *pcbStructInfo);
  if (NULL == *ppvStructInfo)
  {
      b = FALSE;
      break;
  }
    }
    return(b);
}

HRESULT ceDispatchSetErrorInfo | ( | IN HRESULT | hrError,
 |  | IN WCHAR const * | pwszDescription,
 |  | OPTIONAL IN WCHAR const * | pwszProgId,
 |  | OPTIONAL IN IID const * | piid
 | ) |  |

Definition at line 793 of file CeLib.Cpp.

{
    HRESULT hr;
    ICreateErrorInfo *pCreateErrorInfo = NULL;
    IErrorInfo *pErrorInfo = NULL;
    WCHAR *pwszError = NULL;
    WCHAR *pwszText = NULL;

    if (NULL == pwszDescription)
    {
        hr = E_POINTER;
        ceERRORPRINTLINE("NULL pointer", hr);
        goto error;
    }

    assert(FAILED(hrError));
    pwszError = ceGetErrorMessageText(hrError, TRUE);
    if (NULL == pwszError)
    {
  ceERRORPRINTLINE("ceGetErrorMessageText", E_OUTOFMEMORY);
    }
    else
    {
  pwszText = (WCHAR *) LocalAlloc(
      LMEM_FIXED,
      (wcslen(pwszDescription) + 1 + wcslen(pwszError) + 1) *
       sizeof(WCHAR));
  if (NULL == pwszText)
  {
      ceERRORPRINTLINE("LocalAlloc", E_OUTOFMEMORY);
  }
  else
  {
      wcscpy(pwszText, pwszDescription);
      wcscat(pwszText, L" ");
      wcscpy(pwszText, pwszError);
  }
    }

    hr = CreateErrorInfo(&pCreateErrorInfo);
    if (S_OK != hr)
    {
        ceERRORPRINTLINE("CreateErrorInfo", hr);
        goto error;
    }

    if (NULL != piid)
    {
  hr = pCreateErrorInfo->SetGUID(*piid);
  if (S_OK != hr)
  {
      ceERRORPRINTLINE("SetGUID", hr);
  }
    }

    hr = pCreateErrorInfo->SetDescription(
        NULL != pwszText?
      pwszText : const_cast<WCHAR *>(pwszDescription));
    if (S_OK != hr)
    {
  ceERRORPRINTLINE("SetDescription", hr);
    }

    // Set ProgId:

    if (NULL != pwszProgId)
    {
  hr = pCreateErrorInfo->SetSource(const_cast<WCHAR *>(pwszProgId));
  if (S_OK != hr)
  {
      ceERRORPRINTLINE("SetSource", hr);
  }
    }

    hr = pCreateErrorInfo->QueryInterface(
            IID_IErrorInfo,
            (VOID **) &pErrorInfo);
    if (S_OK != hr)
    {
        ceERRORPRINTLINE("QueryInterface", hr);
        goto error;
    }

    SetErrorInfo(0, pErrorInfo);

error:
    if (NULL != pErrorInfo)
    {
  pErrorInfo->Release();
    }
    if (NULL != pCreateErrorInfo)
    {
  pCreateErrorInfo->Release();
    }
    if (NULL != pwszText)
    {
  LocalFree(pwszText);
    }
    if (NULL != pwszError)
    {
  LocalFree(pwszError);
    }
    return(hrError);  // return input error!
}

WCHAR* ceDuplicateString ( IN WCHAR const * pwsz )

Definition at line 202 of file CeLib.Cpp.

{
    WCHAR *pwszOut;

    pwszOut = (WCHAR *) LocalAlloc(
        LMEM_FIXED,
        (wcslen(pwsz) + 1) * sizeof(pwsz[0]));
    if (NULL != pwszOut)
    {
  wcscpy(pwszOut, pwsz);
    }
    return(pwszOut);
}

BOOL ceEncodeObject | ( | IN DWORD | dwEncodingType,
 |  | IN LPCSTR | lpszStructType,
 |  | IN VOID const * | pvStructInfo,
 |  | IN DWORD | dwFlags,
 |  | IN BOOL | fCoTaskMemAlloc,
 |  | OUT BYTE ** | ppbEncoded,
 |  | OUT DWORD * | pcbEncoded
 | ) |  |

Definition at line 93 of file CeLib.Cpp.

{
    BOOL b;

    assert(0 == dwFlags);
    assert(!fCoTaskMemAlloc);
    *ppbEncoded = NULL;
    *pcbEncoded = 0;
    while (TRUE)
    {
  b = CryptEncodeObject(
        dwEncodingType,
        lpszStructType,
        const_cast<VOID *>(pvStructInfo),
        *ppbEncoded,
        pcbEncoded);
  if (b && 0 == *pcbEncoded)
  {
      SetLastError(HRESULT_FROM_WIN32(ERROR_INVALID_DATA));
      b = FALSE;
  }
  if (!b)
  {
      if (NULL != *ppbEncoded)
      {
    HRESULT hr = GetLastError();

    LocalFree(*ppbEncoded);
    *ppbEncoded = NULL;
    SetLastError(hr);
      }
      break;
  }
  if (NULL != *ppbEncoded)
  {
      break;
  }
  *ppbEncoded = (BYTE *) LocalAlloc(LMEM_FIXED, *pcbEncoded);
  if (NULL == *ppbEncoded)
  {
      b = FALSE;
      break;
  }
    }
    return(b);
}

VOID ceErrorPrintLine | ( | IN char const * | pszFile,
 |  | IN DWORD | line,
 |  | IN char const * | pszMessage,
 |  | IN HRESULT | hr
 | ) |  |

Definition at line 421 of file CeLib.Cpp.

{
    wprintf(
  L"CertEnc.Dll: Error: %hs(%u): %hs 0x%x (%d)\n",
  pszFile,
  line,
  pszMessage,
  hr,
  hr);
}

HRESULT ceFileTimeToDate | ( | IN FILETIME const * | pft,
 |  | OUT DATE * | pDate
 | ) |  |

Definition at line 470 of file CeLib.Cpp.

{
    SYSTEMTIME st;
    HRESULT hr = S_OK;

    if (!FileTimeToSystemTime(pft, &st))
    {
        hr = ceHLastError();
        _JumpError(hr, error, "FileTimeToSystemTime");
    }
    if (!SystemTimeToVariantTime(&st, pDate))
    {
        hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
        _JumpError(hr, error, "SystemTimeToVariantTime");
    }

error:
    return(hr);
}

VOID ceFreeBstr ( IN OUT BSTR * pstr )

Definition at line 382 of file CeLib.Cpp.

{
    if (NULL != *pstr)
    {
  SysFreeString(*pstr);
  *pstr = NULL;
    }
}

WCHAR const* ceGetOIDName ( IN WCHAR const * pwszObjId )

Definition at line 180 of file CeLib.Cpp.

{
    char *pszObjId = NULL;
    WCHAR const *pwszName = L"";

    if (!ceConvertWszToSz(&pszObjId, pwszObjId, -1))
    {
  _JumpError(E_OUTOFMEMORY, error, "ceConvertWszToSz");
    }
    pwszName = ceGetOIDNameA(pszObjId);

error:
    if (NULL != pszObjId)
    {
  LocalFree(pszObjId);
    }
    return(pwszName);
}

WCHAR const* ceGetOIDNameA ( IN char const * pszObjId )

Definition at line 152 of file CeLib.Cpp.

{
    CRYPT_OID_INFO const *pInfo = NULL;
    WCHAR const *pwszName = L"";

    // First try looking up the ObjectId as an Extension or Attribute, because
    // we get a better Display Name, especially for Subject RDNs: CN, L, etc.
    // If that fails, look it up withoput restricting the group.

    pInfo = CryptFindOIDInfo(
      CRYPT_OID_INFO_OID_KEY,
      (VOID *) pszObjId,
      CRYPT_EXT_OR_ATTR_OID_GROUP_ID);

    if (NULL == pInfo || NULL == pInfo->pwszName || L'\0' == pInfo->pwszName[0])
    {
  pInfo = CryptFindOIDInfo(CRYPT_OID_INFO_OID_KEY, (VOID *) pszObjId, 0);
    }
    if (NULL != pInfo && NULL != pInfo->pwszName && L'\0' != pInfo->pwszName[0])
    {
  pwszName = pInfo->pwszName;
    }
    return(pwszName);
}

HRESULT ceHError ( IN HRESULT hr )

Definition at line 394 of file CeLib.Cpp.

{
    assert(S_FALSE != hr);

    if (S_OK != hr && S_FALSE != hr && !FAILED(hr))
    {
        hr = HRESULT_FROM_WIN32(hr);
  if (0 == HRESULT_CODE(hr))
  {
      // A call failed without properly setting an error condition!
      hr = E_UNEXPECTED;
  }
  assert(FAILED(hr));
    }
    return(hr);
}

HRESULT ceHLastError ( VOID )

Definition at line 414 of file CeLib.Cpp.

{
    return(ceHError(GetLastError()));
}

HRESULT ceMakeExprDate | ( | IN OUT DATE * | pDate,
 |  | IN LONG | lDelta,
 |  | IN enum ENUM_PERIOD | enumPeriod
 | ) |  |

Definition at line 603 of file CeLib.Cpp.

{
    HRESULT hr;
    FILETIME ft;

    hr = ceDateToFileTime(pDate, &ft);
    _JumpIfError(hr, error, "ceDateToFileTime");

    ceMakeExprDateTime(&ft, lDelta, enumPeriod);

    hr = ceFileTimeToDate(&ft, pDate);
    _JumpIfError(hr, error, "ceFileTimeToDate");

error:
    return(hr);
}

VOID ceMakeExprDateTime | ( | IN OUT FILETIME * | pft,
 |  | IN LONG | lDelta,
 |  | IN enum ENUM_PERIOD | enumPeriod
 | ) |  |

Definition at line 494 of file CeLib.Cpp.

{
    LONGLONG llDelta;
    BOOL fSysTimeDelta;

    llDelta = lDelta;
    fSysTimeDelta = FALSE;
    switch (enumPeriod)
    {
  case ENUM_PERIOD_WEEKS:   llDelta *= CVT_WEEKS;    break;
  case ENUM_PERIOD_DAYS:    llDelta *= CVT_DAYS;     break;
  case ENUM_PERIOD_HOURS:   llDelta *= CVT_HOURS;    break;
  case ENUM_PERIOD_MINUTES: llDelta *= CVT_MINUTES;  break;
  case ENUM_PERIOD_SECONDS:         break;
  default:
      fSysTimeDelta = TRUE;
      break;
    }
    if (fSysTimeDelta)
    {
      SYSTEMTIME SystemTime;

      FileTimeToSystemTime(pft, &SystemTime);
      switch (enumPeriod)
      {
          case ENUM_PERIOD_MONTHS:
        if (0 > lDelta)
        {
            DWORD dwDelta = (DWORD) -lDelta;

            SystemTime.wYear -= (WORD) (dwDelta / 12) + 1;
            SystemTime.wMonth += 12 - (WORD) (dwDelta % 12);
        }
        else
        {
            SystemTime.wMonth += (WORD) lDelta;
        }
        if (12 < SystemTime.wMonth)
        {
            SystemTime.wYear += (SystemTime.wMonth - 1) / 12;
            SystemTime.wMonth = ((SystemTime.wMonth - 1) % 12) + 1;
        }
        break;

          case ENUM_PERIOD_YEARS:
        SystemTime.wYear += (WORD) lDelta;
        break;

          default:
        SystemTime.wYear += 1;
        break;
      }

DoConvert:
        if (!SystemTimeToFileTime(&SystemTime, pft))
        {
            if (GetLastError() != ERROR_INVALID_PARAMETER)
            {
                assert(!"Unable to do time conversion");
                return;
            }

            // In some cases we'll convert to an invalid month-end

            // only one month changes length from year to year
            if (SystemTime.wMonth == 2)
            {
                // > 29? try leap year
                if (SystemTime.wDay > 29)
                {
                    SystemTime.wDay = 29;
                    goto DoConvert;
                }
                // == 29? try non-leap year
                else if (SystemTime.wDay == 29)
                {
                    SystemTime.wDay = 28;
                    goto DoConvert;
                }
            }
            // sept (9), apr(4), jun(6), nov(11) all have 30 days
            else if ((SystemTime.wMonth == 9) ||
                     (SystemTime.wMonth == 4) ||
                     (SystemTime.wMonth == 6) ||
                     (SystemTime.wMonth == 11))
            {
                if (SystemTime.wDay > 30)
                {
                    SystemTime.wDay = 30;
                    goto DoConvert;
                }
            }

            // should never get here
            assert(!"Month/year processing: inaccessible code");
            return;
        }
    }
    else
    {
      *(LONGLONG *) pft += llDelta * CVT_BASE;
    }
}

HRESULT ceTranslatePeriodUnits | ( | IN WCHAR const * | pwszPeriod,
 |  | IN LONG | lCount,
 |  | OUT enum ENUM_PERIOD * | penumPeriod,
 |  | OUT LONG * | plCount
 | ) |  |

Definition at line 645 of file CeLib.Cpp.

{
    HRESULT hr;
    UNITSTABLE const *put;

    for (put = g_aut; put < &g_aut[CUNITSTABLEMAX]; put++)
    {
  if (0 == lstrcmpi(pwszPeriod, put->pwszString))
  {
      *penumPeriod = put->enumPeriod;
      if (0 > lCount)
      {
    lCount = MAXLONG;
      }
      *plCount = lCount;
      hr = S_OK;
      goto error;
  }
    }
    hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);

error:
    return(hr);
}

HRESULT ceVerifyAltNameString | ( | IN LONG | NameChoice,
 |  | IN WCHAR const * | pwszName
 | ) |  |

Definition at line 716 of file CeLib.Cpp.

{
    HRESULT hr = S_OK;
    CERT_ALT_NAME_INFO AltName;
    CERT_ALT_NAME_ENTRY Entry;
    char *pszObjectId = NULL;
    DWORD cbEncoded;

    ZeroMemory(&AltName, sizeof(AltName));
    AltName.cAltEntry = 1;
    AltName.rgAltEntry = &Entry;

    ZeroMemory(&Entry, sizeof(Entry));
    Entry.dwAltNameChoice = NameChoice;

    switch (NameChoice)
    {
  case CERT_ALT_NAME_RFC822_NAME:
      Entry.pwszRfc822Name = const_cast<WCHAR *>(pwszName);
      break;

  case CERT_ALT_NAME_DNS_NAME:
      Entry.pwszDNSName = const_cast<WCHAR *>(pwszName);
      break;

  case CERT_ALT_NAME_URL:
      Entry.pwszURL = const_cast<WCHAR *>(pwszName);
      break;

  case CERT_ALT_NAME_REGISTERED_ID:
      if (!ceConvertWszToSz(&pszObjectId, pwszName, -1))
      {
    hr = E_OUTOFMEMORY;
    ceERRORPRINTLINE("ceConvertWszToSz", hr);
    goto error;
      }
      Entry.pszRegisteredID = pszObjectId;
      break;

  //case CERT_ALT_NAME_DIRECTORY_NAME:
  //case CERT_ALT_NAME_OTHER_NAME:
  //case CERT_ALT_NAME_X400_ADDRESS:
  //case CERT_ALT_NAME_EDI_PARTY_NAME:
  //case CERT_ALT_NAME_IP_ADDRESS:
  default:
      hr = E_INVALIDARG;
      ceERRORPRINTLINE("NameChoice", hr);
      goto error;

    }

    // Encode CERT_ALT_NAME_INFO:

    if (!CryptEncodeObject(
        X509_ASN_ENCODING,
        X509_ALTERNATE_NAME,
        &AltName,
        NULL,
        &cbEncoded))
    {
  hr = ceHLastError();
  ceERRORPRINTLINE("ceEncodeObject", hr);
  goto error;
    }

error:
    if (NULL != pszObjectId)
    {
  LocalFree(pszObjectId);
    }
    return(hr);
}

HRESULT ceVerifyObjId ( IN WCHAR const * pwszObjId )

Definition at line 676 of file CeLib.Cpp.

{
    HRESULT hr;
    CHAR *pszObjId = NULL;
    DWORD cbEncoded;
    CRYPT_ATTRIBUTE ainfo;

    if (!ceConvertWszToSz(&pszObjId, pwszObjId, -1))
    {
  hr = E_OUTOFMEMORY;
        ceERRORPRINTLINE("ceConvertWszToSz", hr);
        goto error;
    }

    ainfo.pszObjId = pszObjId;
    ainfo.cValue = 0;
    if (!CryptEncodeObject(
         X509_ASN_ENCODING,
         PKCS_ATTRIBUTE,
         &ainfo,
         NULL,
         &cbEncoded))
    {
        hr = E_INVALIDARG;
        ceERRORPRINTLINE("invalid Obj Id", hr);
        goto error;
    }
    hr = S_OK;

error:
    if (NULL != pszObjId)
    {
      LocalFree(pszObjId);
    }
    return(hr);
}

int ceWtoI | ( | IN WCHAR const * | string,
 |  | OUT BOOL * | pfValid
 | ) |  |

Definition at line 904 of file CeLib.Cpp.

{
    HRESULT hr;
    WCHAR szBuf[16];
    WCHAR *szTmp = szBuf;
    int cTmp = ARRAYSIZE(szBuf);
    int i = 0;
    WCHAR const *pwsz;
    BOOL fSawDigit = FALSE;

    assert(NULL != pfValid);
    cTmp = FoldString(
        MAP_FOLDDIGITS,
        string,
        -1,
        szTmp,
        cTmp);
    if (cTmp == 0)
    {
        hr = ceHLastError();
        if (HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) == hr)
        {
            hr = S_OK;
            cTmp = FoldString(
                MAP_FOLDDIGITS,
                string,
                -1,
                NULL,
                0);

            szTmp = (WCHAR*)LocalAlloc(LMEM_FIXED, cTmp*sizeof(WCHAR));
      if (NULL == szTmp)
      {
    hr = E_OUTOFMEMORY;
    _JumpError(hr, error, "LocalAlloc");
      }

            cTmp = FoldString(
                MAP_FOLDDIGITS,
                string,
                -1,
                szTmp,
                cTmp);

            if (cTmp == 0)
                hr = ceHLastError();
        }
        _JumpIfError(hr, error, "FoldString");
    }
    pwsz = szTmp;
    while (iswspace(*pwsz))
    {
  pwsz++;
    }
    while (iswdigit(*pwsz))
    {
  fSawDigit = TRUE;
  pwsz++;
    }
    while (iswspace(*pwsz))
    {
  pwsz++;
    }
    if (L'\0' == *pwsz)
    {
  *pfValid = fSawDigit;
    }
    i = _wtoi(szTmp);

error:
    if (szTmp && (szTmp != szBuf))
       LocalFree(szTmp);

    return i;
}

Variable Documentation

UNITSTABLE g_aut[]
Initial value:
{
    { wszDURATIONUNITSSECONDS, ENUM_PERIOD_SECONDS },
    { wszDURATIONUNITSMINUTES, ENUM_PERIOD_MINUTES },
    { wszDURATIONUNITSHOURS,   ENUM_PERIOD_HOURS },
    { wszDURATIONUNITSDAYS,    ENUM_PERIOD_DAYS },
    { wszDURATIONUNITSWEEKS,   ENUM_PERIOD_WEEKS },
    { wszDURATIONUNITSMONTHS,  ENUM_PERIOD_MONTHS },
    { wszDURATIONUNITSYEARS,   ENUM_PERIOD_YEARS },
}

Definition at line 631 of file CeLib.Cpp.

Generated on Wed Nov 13 2024 16:54:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Policy/C++/Windows2000/CeLibW2k.h File Reference

  • Security
  • CertServices
  • Policy
  • C++
  • Windows2000
Defines | Enumerations | Functions

CeLibW2k.h File Reference

Go to the source code of this file.

Defines

#define | _JumpError(hr, label, pszMessage)
#define | _JumpErrorStr(hr, label, pszMessage, pwsz) _JumpError((hr), label, (pszMessage))
#define | _JumpIfError(hr, label, pszMessage)
#define | _JumpIfError2(hr, label, pszMessage, hr2) _JumpIfError((hr), label, (pszMessage))
#define | _JumpIfErrorStr(hr, label, pszMessage, pwsz) _JumpIfError((hr), label, (pszMessage))
#define | _JumpIfErrorStr2(hr, label, pszMessage, pwsz, hr2) _JumpIfError((hr), label, (pszMessage))
#define | _PrintError(hr, pszMessage) ceERRORPRINTLINE((pszMessage), (hr))
#define | _PrintError2(hr, pszMessage, hr2) _PrintError((hr), (pszMessage))
#define | _PrintErrorStr(hr, pszMessage, pwsz) _PrintError((hr), (pszMessage))
#define | _PrintErrorStr2(hr, pszMessage, pwsz, hr2) _PrintError((hr), (pszMessage))
#define | _PrintIfError(hr, pszMessage)
#define | _PrintIfError2(hr, pszMessage, hr2) _PrintIfError((hr), (pszMessage))
#define | _PrintIfErrorStr(hr, pszMessage, pwsz) _PrintIfError((hr), (pszMessage))
#define | _PrintIfErrorStr2(hr, pszMessage, pwsz, hr2) _PrintIfError((hr), (pszMessage))
#define | ARRAYSIZE(a) (sizeof(a)/sizeof((a)[0]))
#define | BITSTOBYTES(b) ((int)(((b) + 7) / 8))
#define | ceERRORPRINTLINE(pszMessage, hr) ceErrorPrintLine(__FILE__, __LINE__, (pszMessage), (hr))
#define | CENCODEMAX (64 * 1024)
#define | CLEARBIT(pb, i) ((pb)[(i) / 8] &= ~(1 << ((i) % 8)))
#define | CVT_BASE (1000 * 1000 * 10)
#define | CVT_DAYS (24 * CVT_HOURS)
#define | CVT_HOURS (60 * CVT_MINUTES)
#define | CVT_MINUTES (60 * CVT_SECONDS)
#define | CVT_SECONDS (1)
#define | CVT_WEEKS (7 * CVT_DAYS)
#define | cwcFILENAMESUFFIXMAX 20
#define | cwcHRESULTSTRING 40
#define | cwcSUFFIXMAX (1 + 5 + 1)
#define | DBGPRINT(a) ceDbgPrintf a
#define | GETBIT(pb, i) ((pb)[(i) / 8] & (1 << ((i) % 8)))
#define | SAFE_SUBTRACT_POINTERS(p1, p2) (assert(sizeof((*p1)) == sizeof(*(p2))), ((p1) - (p2)))
#define | SETBIT(pb, i) ((pb)[(i) / 8] |= (1 << ((i) % 8)))
#define | wszCERTENROLLSHAREPATH L"CertSrv\\CertEnroll"
#define | wszFCSAPARM_CERTFILENAMESUFFIX L"%4"
#define | wszFCSAPARM_CONFIGDN L"%6"
#define | wszFCSAPARM_CRLDELTAFILENAMESUFFIX L"%9"
#define | wszFCSAPARM_CRLFILENAMESUFFIX L"%8"
#define | wszFCSAPARM_DOMAINDN L"%5"
#define | wszFCSAPARM_DSCACERTATTRIBUTE L"%11"
#define | wszFCSAPARM_DSCRLATTRIBUTE L"%10"
#define | wszFCSAPARM_SANITIZEDCANAME L"%3"
#define | wszFCSAPARM_SANITIZEDCANAMEHASH L"%7"
#define | wszFCSAPARM_SERVERDNSNAME L"%1"
#define | wszFCSAPARM_SERVERSHORTNAME L"%2"

Enumerations

enum ENUM_PERIOD {
ENUM_PERIOD_INVALID = -1, ENUM_PERIOD_SECONDS = 0, ENUM_PERIOD_MINUTES, ENUM_PERIOD_HOURS,
ENUM_PERIOD_DAYS, ENUM_PERIOD_WEEKS, ENUM_PERIOD_MONTHS, ENUM_PERIOD_YEARS,
ENUM_PERIOD_INVALID = -1, ENUM_PERIOD_SECONDS = 0, ENUM_PERIOD_MINUTES, ENUM_PERIOD_HOURS,
ENUM_PERIOD_DAYS, ENUM_PERIOD_WEEKS, ENUM_PERIOD_MONTHS, ENUM_PERIOD_YEARS
}

Functions

BOOL | ceConvertSzToBstr (OUT BSTR *pbstr, IN CHAR const *pch, IN LONG cch)
BOOL | ceConvertSzToWsz (OUT WCHAR **ppwsz, IN char const *pch, IN LONG cch)
BOOL | ceConvertWszToBstr (OUT BSTR *pbstr, IN WCHAR const *pwc, IN LONG cb)
BOOL | ceConvertWszToSz (OUT char **ppsz, IN WCHAR const *pwc, IN LONG cb)
HRESULT | ceDateToFileTime (IN DATE const *pDate, OUT FILETIME *pft)
int WINAPIV | ceDbgPrintf (BOOL fDebug, char const *pszfmt,...)
BOOL | ceDecodeObject (IN DWORD dwEncodingType, IN LPCSTR lpszStructType, IN BYTE const *pbEncoded, IN DWORD cbEncoded, IN BOOL fCoTaskMemAlloc, OUT VOID **ppvStructInfo, OUT DWORD *pcbStructInfo)
HRESULT | ceDispatchSetErrorInfo (IN HRESULT hrError, IN WCHAR const *pwszDescription, OPTIONAL IN WCHAR const *pwszProgId, OPTIONAL IN IID const *piid)
WCHAR * | ceDuplicateString (IN WCHAR const *pwsz)
BOOL | ceEncodeObject (DWORD dwEncodingType, IN LPCSTR lpszStructType, IN VOID const *pvStructInfo, IN DWORD dwFlags, IN BOOL fCoTaskMemAlloc, OUT BYTE **ppbEncoded, OUT DWORD *pcbEncoded)
VOID | ceErrorPrintLine (IN char const *pszFile, IN DWORD line, IN char const *pszMessage, IN HRESULT hr)
HRESULT | ceFileTimeToDate (IN FILETIME const *pft, OUT DATE *pDate)
HRESULT | ceFormatCertsrvStringArray (IN BOOL fURL, IN LPCWSTR pwszServerName_p1_2, IN LPCWSTR pwszSanitizedName_p3_7, IN DWORD iCert_p4, IN LPCWSTR pwszDomainDN_p5, IN LPCWSTR pwszConfigDN_p6, IN DWORD iCRL_p8, IN BOOL fDeltaCRL_p9, IN BOOL fDSAttrib_p10_11, IN DWORD cStrings, IN LPCWSTR *apwszStringsIn, OUT LPWSTR *apwszStringsOut)
VOID | ceFreeBstr (IN OUT BSTR *pstr)
WCHAR * | ceGetErrorMessageText (IN HRESULT hr, IN BOOL fHResultString)
WCHAR const * | ceGetOIDName (IN WCHAR const *pwszObjId)
WCHAR const * | ceGetOIDNameA (IN char const *pszObjId)
HRESULT | ceHError (IN HRESULT hr)
HRESULT | ceHLastError (VOID)
WCHAR const * | ceHResultToString (IN OUT WCHAR *awchr, IN HRESULT hr)
VOID | ceInitErrorMessageText (IN DWORD idsUnexpected, IN DWORD idsUnknownErrorCode)
HRESULT | ceInternetCanonicalizeUrl (IN WCHAR const *pwszIn, OUT WCHAR **ppwszOut)
HRESULT | ceMakeExprDate (IN OUT DATE *pDate, IN LONG lDelta, IN enum ENUM_PERIOD enumPeriod)
HRESULT | ceTranslatePeriodUnits (IN WCHAR const *pwszPeriod, IN LONG lCount, OUT enum ENUM_PERIOD *penumPeriod, OUT LONG *plCount)
HRESULT | ceVerifyAltNameString (IN LONG NameChoice, IN WCHAR const *pwszName)
HRESULT | ceVerifyObjId (IN WCHAR const *pwszObjId)
int | ceWtoI (IN WCHAR const *pwszDigitString, OUT BOOL *pfValid)

Define Documentation

#define _JumpError | ( | hr,
 |  | label,
 |  | pszMessage
 | ) |
Value:
{ \
  ceERRORPRINTLINE((pszMessage), (hr)); \
  goto label; \
    }

Definition at line 70 of file CeLibW2k.h.

#define _JumpErrorStr | ( | hr,
 |  | label,
 |  | pszMessage,
 |  | pwsz |
 | ) |  | _JumpError((hr), label, (pszMessage))

Definition at line 67 of file CeLibW2k.h.

#define _JumpIfError | ( | hr,
 |  | label,
 |  | pszMessage
 | ) |
Value:
{ \
  if (S_OK != (hr)) \
  { \
      ceERRORPRINTLINE((pszMessage), (hr)); \
      goto label; \
  } \
    }

Definition at line 86 of file CeLibW2k.h.

#define _JumpIfError2 | ( | hr,
 |  | label,
 |  | pszMessage,
 |  | hr2 |
 | ) |  | _JumpIfError((hr), label, (pszMessage))

Definition at line 83 of file CeLibW2k.h.

#define _JumpIfErrorStr | ( | hr,
 |  | label,
 |  | pszMessage,
 |  | pwsz |
 | ) |  | _JumpIfError((hr), label, (pszMessage))

Definition at line 77 of file CeLibW2k.h.

#define _JumpIfErrorStr2 | ( | hr,
 |  | label,
 |  | pszMessage,
 |  | pwsz,
 |  | hr2 |
 | ) |  | _JumpIfError((hr), label, (pszMessage))

Definition at line 80 of file CeLibW2k.h.

#define _PrintError | ( | hr,
 |  | pszMessage |
 | ) |  | ceERRORPRINTLINE((pszMessage), (hr))

Definition at line 45 of file CeLibW2k.h.

#define _PrintError2 | ( | hr,
 |  | pszMessage,
 |  | hr2 |
 | ) |  | _PrintError((hr), (pszMessage))

Definition at line 42 of file CeLibW2k.h.

#define _PrintErrorStr | ( | hr,
 |  | pszMessage,
 |  | pwsz |
 | ) |  | _PrintError((hr), (pszMessage))

Definition at line 36 of file CeLibW2k.h.

#define _PrintErrorStr2 | ( | hr,
 |  | pszMessage,
 |  | pwsz,
 |  | hr2 |
 | ) |  | _PrintError((hr), (pszMessage))

Definition at line 39 of file CeLibW2k.h.

#define _PrintIfError | ( | hr,
 |  | pszMessage
 | ) |
Value:
{ \
  if (S_OK != (hr)) \
  { \
      ceERRORPRINTLINE((pszMessage), (hr)); \
  } \
    }

Definition at line 58 of file CeLibW2k.h.

#define _PrintIfError2 | ( | hr,
 |  | pszMessage,
 |  | hr2 |
 | ) |  | _PrintIfError((hr), (pszMessage))

Definition at line 55 of file CeLibW2k.h.

#define _PrintIfErrorStr | ( | hr,
 |  | pszMessage,
 |  | pwsz |
 | ) |  | _PrintIfError((hr), (pszMessage))

Definition at line 49 of file CeLibW2k.h.

#define _PrintIfErrorStr2 | ( | hr,
 |  | pszMessage,
 |  | pwsz,
 |  | hr2 |
 | ) |  | _PrintIfError((hr), (pszMessage))

Definition at line 52 of file CeLibW2k.h.

#define ARRAYSIZE ( a ) (sizeof(a)/sizeof((a)[0]))

Definition at line 27 of file CeLibW2k.h.

#define BITSTOBYTES ( b ) ((int)(((b) + 7) / 8))

Definition at line 24 of file CeLibW2k.h.

#define ceERRORPRINTLINE | ( | pszMessage,
 |  | hr |
 | ) |  | ceErrorPrintLine(__FILE__, __LINE__, (pszMessage), (hr))

Definition at line 96 of file CeLibW2k.h.

#define CENCODEMAX (64 * 1024)

Definition at line 17 of file CeLibW2k.h.

#define CLEARBIT | ( | pb,
 |  | i |
 | ) |  | ((pb)[(i) / 8] &= ~(1 << ((i) % 8)))

Definition at line 22 of file CeLibW2k.h.

#define CVT_BASE (1000 * 1000 * 10)

Definition at line 126 of file CeLibW2k.h.

#define CVT_DAYS (24 * CVT_HOURS)

Definition at line 122 of file CeLibW2k.h.

#define CVT_HOURS (60 * CVT_MINUTES)

Definition at line 123 of file CeLibW2k.h.

#define CVT_MINUTES (60 * CVT_SECONDS)

Definition at line 124 of file CeLibW2k.h.

#define CVT_SECONDS (1)

Definition at line 125 of file CeLibW2k.h.

#define CVT_WEEKS (7 * CVT_DAYS)

Definition at line 121 of file CeLibW2k.h.

#define cwcFILENAMESUFFIXMAX 20

Definition at line 256 of file CeLibW2k.h.

#define cwcHRESULTSTRING 40

Definition at line 31 of file CeLibW2k.h.

#define cwcSUFFIXMAX (1 + 5 + 1)

Definition at line 257 of file CeLibW2k.h.

#define DBGPRINT ( a ) ceDbgPrintf a

Definition at line 99 of file CeLibW2k.h.

#define GETBIT | ( | pb,
 |  | i |
 | ) |  | ((pb)[(i) / 8] & (1 << ((i) % 8)))

Definition at line 20 of file CeLibW2k.h.

#define SAFE_SUBTRACT_POINTERS | ( | p1,
 |  | p2 |
 | ) |  | (assert(sizeof((*p1)) == sizeof(*(p2))), ((p1) - (p2)))

Definition at line 33 of file CeLibW2k.h.

#define SETBIT | ( | pb,
 |  | i |
 | ) |  | ((pb)[(i) / 8] |= (1 << ((i) % 8)))

Definition at line 21 of file CeLibW2k.h.

#define wszCERTENROLLSHAREPATH L"CertSrv\\CertEnroll"

Definition at line 29 of file CeLibW2k.h.

#define wszFCSAPARM_CERTFILENAMESUFFIX L"%4"

Definition at line 262 of file CeLibW2k.h.

#define wszFCSAPARM_CONFIGDN L"%6"

Definition at line 264 of file CeLibW2k.h.

#define wszFCSAPARM_CRLDELTAFILENAMESUFFIX L"%9"

Definition at line 267 of file CeLibW2k.h.

#define wszFCSAPARM_CRLFILENAMESUFFIX L"%8"

Definition at line 266 of file CeLibW2k.h.

#define wszFCSAPARM_DOMAINDN L"%5"

Definition at line 263 of file CeLibW2k.h.

#define wszFCSAPARM_DSCACERTATTRIBUTE L"%11"

Definition at line 269 of file CeLibW2k.h.

#define wszFCSAPARM_DSCRLATTRIBUTE L"%10"

Definition at line 268 of file CeLibW2k.h.

#define wszFCSAPARM_SANITIZEDCANAME L"%3"

Definition at line 261 of file CeLibW2k.h.

#define wszFCSAPARM_SANITIZEDCANAMEHASH L"%7"

Definition at line 265 of file CeLibW2k.h.

#define wszFCSAPARM_SERVERDNSNAME L"%1"

Definition at line 259 of file CeLibW2k.h.

#define wszFCSAPARM_SERVERSHORTNAME L"%2"

Definition at line 260 of file CeLibW2k.h.

Enumeration Type Documentation

enum ENUM_PERIOD
Enumerator:
ENUM_PERIOD_INVALID
ENUM_PERIOD_SECONDS
ENUM_PERIOD_MINUTES
ENUM_PERIOD_HOURS
ENUM_PERIOD_DAYS
ENUM_PERIOD_WEEKS
ENUM_PERIOD_MONTHS
ENUM_PERIOD_YEARS
ENUM_PERIOD_INVALID
ENUM_PERIOD_SECONDS
ENUM_PERIOD_MINUTES
ENUM_PERIOD_HOURS
ENUM_PERIOD_DAYS
ENUM_PERIOD_WEEKS
ENUM_PERIOD_MONTHS
ENUM_PERIOD_YEARS

Definition at line 129 of file CeLibW2k.h.

{
    ENUM_PERIOD_INVALID = -1,
    ENUM_PERIOD_SECONDS = 0,
    ENUM_PERIOD_MINUTES,
    ENUM_PERIOD_HOURS,
    ENUM_PERIOD_DAYS,
    ENUM_PERIOD_WEEKS,
    ENUM_PERIOD_MONTHS,
    ENUM_PERIOD_YEARS
};

Function Documentation

BOOL ceConvertSzToBstr | ( | OUT BSTR * | pbstr,
 |  | IN CHAR const * | pch,
 |  | IN LONG | cch
 | ) |  |

Definition at line 336 of file CeLib.Cpp.

{
    BOOL fOk = FALSE;
    BSTR bstr = NULL;
    LONG cwc = 0;

    ceFreeBstr(pbstr);
    if (-1 == cch)
    {
  cch = strlen(pch);
    }
    while (TRUE)
    {
  cwc = MultiByteToWideChar(GetACP(), 0, pch, cch, bstr, cwc);
  if (0 >= cwc)
  {
      //hr = ceHLastError();
      //printf("MultiByteToWideChar returned %d (%x)\n", hr, hr);
      break;
  }
  if (NULL != bstr)
  {
      bstr[cwc] = L'\0';
      *pbstr = bstr;
      fOk = TRUE;
      break;
  }
  bstr = SysAllocStringLen(NULL, cwc);
  if (NULL == bstr)
  {
      break;
  }
    }
    return(fOk);
}

BOOL ceConvertSzToWsz | ( | OUT WCHAR ** | ppwsz,
 |  | IN char const * | pch,
 |  | IN LONG | cch
 | ) |  |

Definition at line 295 of file CeLib.Cpp.

{
    BOOL fOk = FALSE;
    LONG cwc = 0;

    *ppwsz = NULL;
    while (TRUE)
    {
  cwc = MultiByteToWideChar(GetACP(), 0, pch, cch, *ppwsz, cwc);
  if (0 >= cwc)
  {
      DWORD err;

      err = GetLastError();
      ceERRORPRINTLINE("MultiByteToWideChar", err);
      if (NULL != *ppwsz)
      {
    LocalFree(*ppwsz);
    *ppwsz = NULL;
      }
      break;
  }
  if (NULL != *ppwsz)
  {
      fOk = TRUE;
      break;
  }
  *ppwsz = (WCHAR *) LocalAlloc(LMEM_FIXED, (cwc + 1) * sizeof(WCHAR));
  if (NULL == *ppwsz)
  {
      break;
  }
    }
    return(fOk);
}

BOOL ceConvertWszToBstr | ( | OUT BSTR * | pbstr,
 |  | IN WCHAR const * | pwc,
 |  | IN LONG | cb
 | ) |  |

Definition at line 263 of file CeLib.Cpp.

{
    BOOL fOk = FALSE;
    BSTR bstr;

    ceFreeBstr(pbstr);
    do
    {
  bstr = NULL;
  if (NULL != pwc)
  {
      if (-1 == cb)
      {
    cb = wcslen(pwc) * sizeof(WCHAR);
      }
      bstr = SysAllocStringByteLen((char const *) pwc, cb);
      if (NULL == bstr)
      {
    break;
      }
  }
  *pbstr = bstr;
  fOk = TRUE;
    } while (FALSE);
    return(fOk);
}

BOOL ceConvertWszToSz | ( | OUT char ** | ppsz,
 |  | IN WCHAR const * | pwc,
 |  | IN LONG | cb
 | ) |  |
HRESULT ceDateToFileTime | ( | IN DATE const * | pDate,
 |  | OUT FILETIME * | pft
 | ) |  |

Definition at line 450 of file CeLib.Cpp.

{
    SYSTEMTIME st;
    HRESULT hr = S_OK;

    if (*pDate == 0.0)
    {
        GetSystemTime(&st);
    }
    else
    {
  if (!VariantTimeToSystemTime(*pDate, &st))
  {
      hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
      _JumpError(hr, error, "VariantTimeToSystemTime");
  }
    }

    if (!SystemTimeToFileTime(&st, pft))
    {
        hr = ceHLastError();
        _JumpError(hr, error, "SystemTimeToFileTime");
    }

error:
    return(hr);
}

int WINAPIV ceDbgPrintf | ( | BOOL | fDebug,
 |  | char const * | pszfmt,
 |  |  | ...
 | ) |  |
BOOL ceDecodeObject | ( | IN DWORD | dwEncodingType,
 |  | IN LPCSTR | lpszStructType,
 |  | IN BYTE const * | pbEncoded,
 |  | IN DWORD | cbEncoded,
 |  | IN BOOL | fCoTaskMemAlloc,
 |  | OUT VOID ** | ppvStructInfo,
 |  | OUT DWORD * | pcbStructInfo
 | ) |  |

Definition at line 27 of file CeLib.Cpp.

{
    BOOL b;

    assert(!fCoTaskMemAlloc);
    *ppvStructInfo = NULL;
    *pcbStructInfo = 0;
    while (TRUE)
    {
  b = CryptDecodeObject(
        dwEncodingType,
        lpszStructType,
        pbEncoded,
        cbEncoded,
        0,                  // dwFlags
        *ppvStructInfo,
        pcbStructInfo);
  if (b && 0 == *pcbStructInfo)
  {
      SetLastError((DWORD) HRESULT_FROM_WIN32(ERROR_INVALID_DATA));
      b = FALSE;
  }
  if (!b)
  {
      if (NULL != *ppvStructInfo)
      {
    HRESULT hr = GetLastError();

    LocalFree(*ppvStructInfo);
    *ppvStructInfo = NULL;
    SetLastError(hr);
      }
      break;
  }
  if (NULL != *ppvStructInfo)
  {
      break;
  }
  *ppvStructInfo = (BYTE *) LocalAlloc(LMEM_FIXED, *pcbStructInfo);
  if (NULL == *ppvStructInfo)
  {
      b = FALSE;
      break;
  }
    }
    return(b);
}

HRESULT ceDispatchSetErrorInfo | ( | IN HRESULT | hrError,
 |  | IN WCHAR const * | pwszDescription,
 |  | OPTIONAL IN WCHAR const * | pwszProgId,
 |  | OPTIONAL IN IID const * | piid
 | ) |  |

Definition at line 997 of file CeLib.Cpp.

{
    HRESULT hr;
    WCHAR const *pwszError = NULL;
    WCHAR *pwszText = NULL;

    if (NULL == pwszDescription)
    {
        hr = E_POINTER;
  _JumpError(hr, error, "NULL pointer");
    }
    assert(FAILED(hrError));
    pwszError = ceGetErrorMessageText(hrError, TRUE);
    if (NULL == pwszError)
    {
  _PrintError(E_OUTOFMEMORY, "myGetErrorMessageText");
    }
    else
    {
  pwszText = (WCHAR *) LocalAlloc(
      LMEM_FIXED,
      (wcslen(pwszDescription) + 1 + wcslen(pwszError) + 1) *
       sizeof(WCHAR));
  if (NULL == pwszText)
  {
      _PrintError(E_OUTOFMEMORY, "LocalAlloc");
  }
  else
  {
      wcscpy(pwszText, pwszDescription);
      wcscat(pwszText, L" ");
      wcscat(pwszText, pwszError);
  }
    }
    hr = ceDispatchSetErrorInfoSub(
      hrError,
      NULL,   // pwszIDispatchMethod
      NULL != pwszText?
          pwszText : const_cast<WCHAR *>(pwszDescription),
      pwszProgId,
      piid,
      NULL,   // pwszHelpFile
      0);   // dwHelpFileContext
    _PrintIfError(hr, "ceDispatchSetErrorInfoSub");

error:
    if (NULL != pwszText)
    {
  LocalFree(pwszText);
    }
    if (NULL != pwszError)
    {
  LocalFree(const_cast<WCHAR *>(pwszError));
    }
    return(hrError);  // return input error!
}

WCHAR* ceDuplicateString ( IN WCHAR const * pwsz )

Definition at line 197 of file CeLib.Cpp.

{
    WCHAR *pwszOut;

    pwszOut = (WCHAR *) LocalAlloc(
        LMEM_FIXED,
        (wcslen(pwsz) + 1) * sizeof(pwsz[0]));
    if (NULL != pwszOut)
    {
  wcscpy(pwszOut, pwsz);
    }
    return(pwszOut);
}

BOOL ceEncodeObject | ( | DWORD | dwEncodingType,
 |  | IN LPCSTR | lpszStructType,
 |  | IN VOID const * | pvStructInfo,
 |  | IN DWORD | dwFlags,
 |  | IN BOOL | fCoTaskMemAlloc,
 |  | OUT BYTE ** | ppbEncoded,
 |  | OUT DWORD * | pcbEncoded
 | ) |  |
VOID ceErrorPrintLine | ( | IN char const * | pszFile,
 |  | IN DWORD | line,
 |  | IN char const * | pszMessage,
 |  | IN HRESULT | hr
 | ) |  |

Definition at line 421 of file CeLib.Cpp.

{
    wprintf(
  L"CertEnc.Dll: Error: %hs(%u): %hs 0x%x (%d)\n",
  pszFile,
  line,
  pszMessage,
  hr,
  hr);
}

HRESULT ceFileTimeToDate | ( | IN FILETIME const * | pft,
 |  | OUT DATE * | pDate
 | ) |  |

Definition at line 482 of file CeLib.Cpp.

{
    SYSTEMTIME st;
    HRESULT hr = S_OK;

    if (!FileTimeToSystemTime(pft, &st))
    {
        hr = ceHLastError();
        _JumpError(hr, error, "FileTimeToSystemTime");
    }
    if (!SystemTimeToVariantTime(&st, pDate))
    {
        hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
        _JumpError(hr, error, "SystemTimeToVariantTime");
    }

error:
    return(hr);
}

HRESULT ceFormatCertsrvStringArray | ( | IN BOOL | fURL,
 |  | IN LPCWSTR | pwszServerName_p1_2,
 |  | IN LPCWSTR | pwszSanitizedName_p3_7,
 |  | IN DWORD | iCert_p4,
 |  | IN LPCWSTR | pwszDomainDN_p5,
 |  | IN LPCWSTR | pwszConfigDN_p6,
 |  | IN DWORD | iCRL_p8,
 |  | IN BOOL | fDeltaCRL_p9,
 |  | IN BOOL | fDSAttrib_p10_11,
 |  | IN DWORD | cStrings,
 |  | IN LPCWSTR * | apwszStringsIn,
 |  | OUT LPWSTR * | apwszStringsOut
 | ) |  |

Definition at line 208 of file CeFormat.Cpp.

{
    HRESULT hr = S_OK;
    LPCWSTR apwszInsertionArray[100];  // 100 'cause this is the max number of insertion numbers allowed by FormatMessage
    LPWSTR    pwszCurrent = NULL;
    BSTR      strShortMachineName = NULL;
    DWORD     i;
    WCHAR *pwszSanitizedDSName = NULL;
    WCHAR wszCertSuffix[cwcFILENAMESUFFIXMAX];
    WCHAR wszCRLSuffix[cwcFILENAMESUFFIXMAX];
    WCHAR wszDeltaCRLSuffix[cwcFILENAMESUFFIXMAX];
    WCHAR const *pwszT;

    ZeroMemory(apwszStringsOut, cStrings * sizeof(apwszStringsOut[0]));
    ZeroMemory(apwszInsertionArray, sizeof(apwszInsertionArray));

    // Format the template into a real name

    // Initialize the insertion string array.
    // Machine DNS name (%1)

    assert(L'1' == wszFCSAPARM_SERVERDNSNAME[1]);
    apwszInsertionArray[1 - 1] = pwszServerName_p1_2;

    // Short Machine Name (%2)

    assert(L'2' == wszFCSAPARM_SERVERSHORTNAME[1]);
    strShortMachineName = SysAllocString(pwszServerName_p1_2);
    if (strShortMachineName == NULL)
    {
        hr = E_OUTOFMEMORY;
        _JumpIfError(hr, error, "SysAllocString");
    }

    pwszCurrent = wcschr(strShortMachineName, L'.');
    if(pwszCurrent)
    {
        *pwszCurrent = 0;
    }
    apwszInsertionArray[2 - 1] = strShortMachineName;

    // sanitized name (%3)

    assert(L'3' == wszFCSAPARM_SANITIZEDCANAME[1]);
    apwszInsertionArray[3 - 1] = pwszSanitizedName_p3_7;

    // Cert filename suffix (%4)

    assert(L'4' == wszFCSAPARM_CERTFILENAMESUFFIX[1]);
    wszCertSuffix[0] = L'\0';
    if (0 != iCert_p4)
    {
        wsprintf(wszCertSuffix, L"(%u)", iCert_p4);
    }
    apwszInsertionArray[4 - 1] = wszCertSuffix;

    assert(L'5' == wszFCSAPARM_DOMAINDN[1]);
    apwszInsertionArray[5 - 1] = pwszDomainDN_p5;

    assert(L'6' == wszFCSAPARM_CONFIGDN[1]);
    apwszInsertionArray[6 - 1] = pwszConfigDN_p6;

    // Don't pass pwszSanitizedName_p3_7 to SysAllocStringLen with the extended
    // length to avoid faulting past end of pwszSanitizedName_p3_7.

    assert(L'7' == wszFCSAPARM_SANITIZEDCANAMEHASH[1]);
    hr = ceSanitizedNameToDSName(pwszSanitizedName_p3_7, &pwszSanitizedDSName);
    _JumpIfError(hr, error, "ceSanitizedNameToDSName");

    apwszInsertionArray[7 - 1] = pwszSanitizedDSName;

    // CRL filename suffix (%8)

    assert(L'8' == wszFCSAPARM_CRLFILENAMESUFFIX[1]);
    wszCRLSuffix[0] = L'\0';
    if (0 != iCRL_p8)
    {
        wsprintf(wszCRLSuffix, L"(%u)", iCRL_p8);
    }
    apwszInsertionArray[8 - 1] = wszCRLSuffix;

    assert(L'9' == wszFCSAPARM_CRLDELTAFILENAMESUFFIX[1]);
    wszDeltaCRLSuffix[0] = L'\0';
    if (fDeltaCRL_p9)
    {
        wcscpy(wszDeltaCRLSuffix, L"+");
    }
    apwszInsertionArray[9 - 1] = wszDeltaCRLSuffix;

    assert(L'1' == wszFCSAPARM_DSCRLATTRIBUTE[1]);
    assert(L'0' == wszFCSAPARM_DSCRLATTRIBUTE[2]);
    pwszT = L"";
    if (fDSAttrib_p10_11)
    {
  pwszT = fDeltaCRL_p9?
        wszDSSEARCHDELTACRLATTRIBUTE :
        wszDSSEARCHBASECRLATTRIBUTE;
    }
    apwszInsertionArray[10 - 1] = pwszT;

    assert(L'1' == wszFCSAPARM_DSCACERTATTRIBUTE[1]);
    assert(L'1' == wszFCSAPARM_DSCACERTATTRIBUTE[2]);
    pwszT = L"";
    if (fDSAttrib_p10_11)
    {
  pwszT = wszDSSEARCHCACERTATTRIBUTE;
    }
    apwszInsertionArray[11 - 1] = pwszT;

    for (i = 0; i < cStrings; i++)
    {
        if (0 == FormatMessage(
      FORMAT_MESSAGE_ALLOCATE_BUFFER |
          FORMAT_MESSAGE_FROM_STRING |
          FORMAT_MESSAGE_ARGUMENT_ARRAY,
      (VOID *) apwszStringsIn[i],
      0,              // dwMessageID
      0,              // dwLanguageID
      (LPWSTR) &apwszStringsOut[i],
      (DWORD)wcslen(apwszStringsIn[i]),
      (va_list *) apwszInsertionArray))
        {
            hr = ceHLastError();
      _JumpError(hr, error, "FormatMessage");
        }
  if (fURL)
  {
      WCHAR *pwsz;

      hr = ceInternetCanonicalizeUrl(apwszStringsOut[i], &pwsz);
      _JumpIfError(hr, error, "ceInternetCanonicalizeUrl");

      LocalFree(apwszStringsOut[i]);
      apwszStringsOut[i] = pwsz;
  }
    }

error:
    if (S_OK != hr)
    {
  for (i = 0; i < cStrings; i++)
  {
      if (NULL != apwszStringsOut[i])
      {
    LocalFree(apwszStringsOut[i]);
    apwszStringsOut[i] = NULL;
      }
  }
    }
    if(strShortMachineName)
    {
        SysFreeString(strShortMachineName);
    }
    if (NULL != pwszSanitizedDSName)
    {
        LocalFree(pwszSanitizedDSName);
    }
    return (hr);
}

VOID ceFreeBstr ( IN OUT BSTR * pstr )

Definition at line 377 of file CeLib.Cpp.

{
    if (NULL != *pstr)
    {
  SysFreeString(*pstr);
  *pstr = NULL;
    }
}

WCHAR* ceGetErrorMessageText | ( | IN HRESULT | hr,
 |  | IN BOOL | fHResultString
 | ) |  |

Definition at line 312 of file CeError.Cpp.

{
    return(ceGetErrorMessageTextEx(hr, fHResultString, NULL));
}

WCHAR const* ceGetOIDName ( IN WCHAR const * pwszObjId )

Definition at line 175 of file CeLib.Cpp.

{
    char *pszObjId = NULL;
    WCHAR const *pwszName = L"";

    if (!ceConvertWszToSz(&pszObjId, pwszObjId, -1))
    {
  _JumpError(E_OUTOFMEMORY, error, "ceConvertWszToSz");
    }
    pwszName = ceGetOIDNameA(pszObjId);

error:
    if (NULL != pszObjId)
    {
  LocalFree(pszObjId);
    }
    return(pwszName);
}

WCHAR const* ceGetOIDNameA ( IN char const * pszObjId )

Definition at line 147 of file CeLib.Cpp.

{
    CRYPT_OID_INFO const *pInfo = NULL;
    WCHAR const *pwszName = L"";

    // First try looking up the ObjectId as an Extension or Attribute, because
    // we get a better Display Name, especially for Subject RDNs: CN, L, etc.
    // If that fails, look it up withoput restricting the group.

    pInfo = CryptFindOIDInfo(
      CRYPT_OID_INFO_OID_KEY,
      (VOID *) pszObjId,
      CRYPT_EXT_OR_ATTR_OID_GROUP_ID);

    if (NULL == pInfo || NULL == pInfo->pwszName || L'\0' == pInfo->pwszName[0])
    {
  pInfo = CryptFindOIDInfo(CRYPT_OID_INFO_OID_KEY, (VOID *) pszObjId, 0);
    }
    if (NULL != pInfo && NULL != pInfo->pwszName && L'\0' != pInfo->pwszName[0])
    {
  pwszName = pInfo->pwszName;
    }
    return(pwszName);
}

HRESULT ceHError ( IN HRESULT hr )

Definition at line 389 of file CeLib.Cpp.

{
    assert(S_FALSE != hr);

    if (S_OK != hr && S_FALSE != hr && !FAILED(hr))
    {
        hr = HRESULT_FROM_WIN32(hr);
  if ((HRESULT) 0 == HRESULT_CODE(hr))
  {
      // A call failed without properly setting an error condition!
      hr = E_UNEXPECTED;
  }
  assert(FAILED(hr));
    }
    return(hr);
}

HRESULT ceHLastError ( VOID )

Definition at line 409 of file CeLib.Cpp.

{
    return(ceHError(GetLastError()));
}

WCHAR const* ceHResultToString | ( | IN OUT WCHAR * | awchr,
 |  | IN HRESULT | hr
 | ) |  |

Definition at line 239 of file CeError.Cpp.

{
    return(ceHResultToStringEx(awchr, hr, FALSE));
}

VOID ceInitErrorMessageText | ( | IN DWORD | idsUnexpected,
 |  | IN DWORD | idsUnknownErrorCode
 | ) |  |

Definition at line 232 of file CeError.Cpp.

{
    s_idsUnexpected = idsUnexpected;
    s_idsUnknownErrorCode = idsUnknownErrorCode;
}

HRESULT ceInternetCanonicalizeUrl | ( | IN WCHAR const * | pwszIn,
 |  | OUT WCHAR ** | ppwszOut
 | ) |  |

Definition at line 105 of file ceformat.cpp.

{
    HRESULT hr;
    WCHAR *pwsz = NULL;

    assert(NULL != pwszIn);

    if (0 == _wcsnicmp(L"file:", pwszIn, 5))
    {
  hr = ceDupString(pwszIn, &pwsz);
        _JumpIfError(hr, error, "ceDupString");
    }
    else
    {
  // Calculate required buffer size by passing a very small buffer
  // The call will fail, and tell us how big the buffer should be.

  WCHAR wszPlaceHolder[1];
  DWORD cwc = ARRAYSIZE(wszPlaceHolder);
  BOOL bResult;

  bResult = InternetCanonicalizeUrl(
            pwszIn,   // lpszUrl
            wszPlaceHolder, // lpszBuffer
            &cwc,   // lpdwBufferLength
            0);   // dwFlags
  assert(!bResult); // This will always fail

  hr = ceHLastError();
  if (HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) != hr)
  {
      // unexpected error

      _JumpError(hr, error, "InternetCanonicalizeUrl");
  }

  // NOTE: InternetCanonicalizeUrl counts characters, not bytes as doc'd
  // cwc includes trailing L'0'

  pwsz = (WCHAR *) LocalAlloc(LMEM_FIXED, cwc * sizeof(WCHAR));
  if (NULL == pwsz)
  {
      hr = E_OUTOFMEMORY;
      _JumpError(hr, error, "LocalAlloc");
  }

  // canonicalize
  if (!InternetCanonicalizeUrl(
        pwszIn, // lpszUrl
        pwsz, // lpszBuffer
        &cwc, // lpdwBufferLength
        0))   // dwFlags
  {
      hr = ceHLastError();
      _JumpError(hr, error, "InternetCanonicalizeUrl");
  }
    }
    *ppwszOut = pwsz;
    pwsz = NULL;
    hr = S_OK;

error:
    if (NULL != pwsz)
    {
        LocalFree(pwsz);
    }
    return(hr);
}

HRESULT ceMakeExprDate | ( | IN OUT DATE * | pDate,
 |  | IN LONG | lDelta,
 |  | IN enum ENUM_PERIOD | enumPeriod
 | ) |  |

Definition at line 618 of file CeLib.Cpp.

{
    HRESULT hr;
    FILETIME ft;

    hr = ceDateToFileTime(pDate, &ft);
    _JumpIfError(hr, error, "ceDateToFileTime");

    ceMakeExprDateTime(&ft, lDelta, enumPeriod);

    hr = ceFileTimeToDate(&ft, pDate);
    _JumpIfError(hr, error, "ceFileTimeToDate");

error:
    return(hr);
}

HRESULT ceTranslatePeriodUnits | ( | IN WCHAR const * | pwszPeriod,
 |  | IN LONG | lCount,
 |  | OUT enum ENUM_PERIOD * | penumPeriod,
 |  | OUT LONG * | plCount
 | ) |  |

Definition at line 660 of file CeLib.Cpp.

{
    HRESULT hr;
    UNITSTABLE const *put;

    for (put = g_aut; put < &g_aut[CUNITSTABLEMAX]; put++)
    {
  if (0 == celstrcmpiL(pwszPeriod, put->pwszString))
  {
      *penumPeriod = put->enumPeriod;
      if (0 > lCount)
      {
    lCount = MAXLONG;
      }
      *plCount = lCount;
      hr = S_OK;
      goto error;
  }
    }
    hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);

error:
    return(hr);
}

HRESULT ceVerifyAltNameString | ( | IN LONG | NameChoice,
 |  | IN WCHAR const * | pwszName
 | ) |  |

Definition at line 716 of file CeLib.Cpp.

{
    HRESULT hr = S_OK;
    CERT_ALT_NAME_INFO AltName;
    CERT_ALT_NAME_ENTRY Entry;
    char *pszObjectId = NULL;
    DWORD cbEncoded;

    ZeroMemory(&AltName, sizeof(AltName));
    AltName.cAltEntry = 1;
    AltName.rgAltEntry = &Entry;

    ZeroMemory(&Entry, sizeof(Entry));
    Entry.dwAltNameChoice = NameChoice;

    switch (NameChoice)
    {
  case CERT_ALT_NAME_RFC822_NAME:
      Entry.pwszRfc822Name = const_cast<WCHAR *>(pwszName);
      break;

  case CERT_ALT_NAME_DNS_NAME:
      Entry.pwszDNSName = const_cast<WCHAR *>(pwszName);
      break;

  case CERT_ALT_NAME_URL:
      Entry.pwszURL = const_cast<WCHAR *>(pwszName);
      break;

  case CERT_ALT_NAME_REGISTERED_ID:
      if (!ceConvertWszToSz(&pszObjectId, pwszName, -1))
      {
    hr = E_OUTOFMEMORY;
    ceERRORPRINTLINE("ceConvertWszToSz", hr);
    goto error;
      }
      Entry.pszRegisteredID = pszObjectId;
      break;

  //case CERT_ALT_NAME_DIRECTORY_NAME:
  //case CERT_ALT_NAME_OTHER_NAME:
  //case CERT_ALT_NAME_X400_ADDRESS:
  //case CERT_ALT_NAME_EDI_PARTY_NAME:
  //case CERT_ALT_NAME_IP_ADDRESS:
  default:
      hr = E_INVALIDARG;
      ceERRORPRINTLINE("NameChoice", hr);
      goto error;

    }

    // Encode CERT_ALT_NAME_INFO:

    if (!CryptEncodeObject(
        X509_ASN_ENCODING,
        X509_ALTERNATE_NAME,
        &AltName,
        NULL,
        &cbEncoded))
    {
  hr = ceHLastError();
  ceERRORPRINTLINE("ceEncodeObject", hr);
  goto error;
    }

error:
    if (NULL != pszObjectId)
    {
  LocalFree(pszObjectId);
    }
    return(hr);
}

HRESULT ceVerifyObjId ( IN WCHAR const * pwszObjId )

Definition at line 808 of file CeLib.Cpp.

{
    HRESULT hr;
    CHAR *pszObjId = NULL;

    if (!ceConvertWszToSz(&pszObjId, pwszObjId, -1))
    {
  hr = E_OUTOFMEMORY;
  _JumpError(hr, error, "ceConvertWszToSz");
    }
    hr = ceVerifyObjIdA(pszObjId);
    _JumpIfErrorStr(hr, error, "ceVerifyObjIdA", pwszObjId);

error:
    if (NULL != pszObjId)
    {
      LocalFree(pszObjId);
    }
    return(hr);
}

int ceWtoI | ( | IN WCHAR const * | pwszDigitString,
 |  | OUT BOOL * | pfValid
 | ) |  |

Definition at line 1060 of file CeLib.Cpp.

{
    HRESULT hr;
    WCHAR szBuf[16];
    WCHAR *szTmp = szBuf;
    int cTmp = ARRAYSIZE(szBuf);
    int i = 0;
    WCHAR const *pwsz;
    BOOL fSawDigit = FALSE;

    if (pfValid == NULL)
    {
        hr = E_POINTER;
        _JumpError(hr, error, "NULLPARAM");
    }
    *pfValid = FALSE;

    assert(NULL != pfValid);
    cTmp = FoldString(
        MAP_FOLDDIGITS,
        string,
        -1,
        szTmp,
        cTmp);
    if (cTmp == 0)
    {
        hr = ceHLastError();
        if (HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) == hr)
        {
            hr = S_OK;
            cTmp = FoldString(
                MAP_FOLDDIGITS,
                string,
                -1,
                NULL,
                0);

            szTmp = (WCHAR*)LocalAlloc(LMEM_FIXED, cTmp*sizeof(WCHAR));
      if (NULL == szTmp)
      {
    hr = E_OUTOFMEMORY;
    _JumpError(hr, error, "LocalAlloc");
      }

            cTmp = FoldString(
                MAP_FOLDDIGITS,
                string,
                -1,
                szTmp,
                cTmp);

            if (cTmp == 0)
                hr = ceHLastError();
        }
        _JumpIfError(hr, error, "FoldString");
    }
    pwsz = szTmp;
    while (iswspace(*pwsz))
    {
  pwsz++;
    }
    while (iswdigit(*pwsz))
    {
  fSawDigit = TRUE;
  pwsz++;
    }
    while (iswspace(*pwsz))
    {
  pwsz++;
    }
    if (L'\0' == *pwsz)
    {
  *pfValid = fSawDigit;
    }
    i = _wtoi(szTmp);

error:
    if (szTmp && (szTmp != szBuf))
       LocalFree(szTmp);

    return i;
}

Generated on Wed Nov 13 2024 16:54:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Policy/C++/Windows2000/CertPSam.Cpp File Reference

  • Security
  • CertServices
  • Policy
  • C++
  • Windows2000
Functions | Variables

CertPSam.Cpp File Reference

#include "pch.cpp"
#include "celibw2k.h"
#include "policy.h"
#include "module.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)
void __RPC_FAR *__RPC_USER | MIDL_user_allocate (size_t cb)
void __RPC_USER | MIDL_user_free (void __RPC_FAR *pb)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 54 of file CertPSam.Cpp.

{
    return(_Module.GetLockCount() == 0? S_OK : S_FALSE);
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 64 of file CertPSam.Cpp.

{
    return(_Module.GetClassObject(rclsid, riid, ppv));
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 33 of file CertPSam.Cpp.

{
    switch (dwReason)
    {
  case DLL_PROCESS_ATTACH:
      _Module.Init(ObjectMap, hInstance);
      DisableThreadLibraryCalls(hInstance);
      break;

        case DLL_PROCESS_DETACH:
      _Module.Term();
            break;
    }
    return(TRUE);    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 74 of file CertPSam.Cpp.

{
    // registers object, typelib and all interfaces in typelib
    return(_Module.RegisterServer(TRUE));
}

STDAPI DllUnregisterServer ( void )

Definition at line 85 of file CertPSam.Cpp.

{
    _Module.UnregisterServer();
    return(S_OK);
}

void __RPC_FAR* __RPC_USER MIDL_user_allocate ( size_t cb )

Definition at line 93 of file CertPSam.Cpp.

{
    return(LocalAlloc(LMEM_FIXED | LMEM_ZEROINIT, cb));
}

void __RPC_USER MIDL_user_free ( void __RPC_FAR * pb )

Definition at line 100 of file CertPSam.Cpp.

{
    LocalFree(pb);
}

Variable Documentation

CComModule _Module

Definition at line 20 of file CertPSam.Cpp.

Generated on Wed Nov 13 2024 16:54:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Policy/C++/Windows2000/CertPSam.Idl File Reference

  • Security
  • CertServices
  • Policy
  • C++
  • Windows2000
Functions | Variables

CertPSam.Idl File Reference

Go to the source code of this file.

Functions

library CERTPOLICYSAMPLELib | importlib ("stdole2.tlb")

Variables

import wtypes | idl

Function Documentation

library CERTPOLICYSAMPLELib importlib ( "stdole2.tlb" )

Variable Documentation

import certmod idl

Definition at line 13 of file CertPSam.Idl.

Generated on Wed Nov 13 2024 16:54:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Policy/C++/Windows2000/Module.Cpp File Reference

  • Security
  • CertServices
  • Policy
  • C++
  • Windows2000

Module.Cpp File Reference

#include "pch.cpp"
#include "celibw2k.h"
#include "module.h"
#include "policy.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Policy/C++/Windows2000/Module.h File Reference

  • Security
  • CertServices
  • Policy
  • C++
  • Windows2000
Classes

Module.h File Reference

#include "certpsam.h"
#include "resource.h"

Go to the source code of this file.

Classes

class CCertManagePolicyModuleSample
Generated on Wed Nov 13 2024 16:54:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Policy/C++/Windows2000/Pch.Cpp File Reference

  • Security
  • CertServices
  • Policy
  • C++
  • Windows2000
Variables

Pch.Cpp File Reference

#include <windows.h>
#include <atlbase.h>
#include <atlcom.h>
#include <certsrv.h>

Go to the source code of this file.

Variables

CComModule _Module

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:54:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Policy/C++/Windows2000/Policy.Cpp File Reference

  • Security
  • CertServices
  • Policy
  • C++
  • Windows2000
Defines | Functions | Variables

Policy.Cpp File Reference

#include "pch.cpp"
#include <assert.h>
#include "celibw2k.h"
#include "policy.h"
#include "module.h"

Go to the source code of this file.

Defines

#define | HIGHBIT(bitno) (1 << (7 - (bitno)))
#define | ISSCERT_FILEURL ISSCERT_FILEURL_OLD
#define | ISSCERT_FTPURL ISSCERT_FTPURL_OLD
#define | ISSCERT_HTTPURL ISSCERT_HTTPURL_OLD
#define | ISSCERT_LDAPURL ISSCERT_LDAPURL_OLD
#define | NSCERTTYPE_CA ((BYTE) (SSLBIT_CASSL | SSLBIT_CASMIME | SSLBIT_CASIGN))
#define | NSCERTTYPE_CLIENT ((BYTE) SSLBIT_CLIENT)
#define | NSCERTTYPE_SERVER ((BYTE) (SSLBIT_SERVER | SSLBIT_CLIENT))
#define | NSCERTTYPE_SMIME ((BYTE) SSLBIT_SMIME)
#define | REVEXT_CDPFILEURL REVEXT_CDPFILEURL_OLD
#define | REVEXT_CDPFTPURL REVEXT_CDPFTPURL_OLD
#define | REVEXT_CDPHTTPURL REVEXT_CDPHTTPURL_OLD
#define | REVEXT_CDPLDAPURL REVEXT_CDPLDAPURL_OLD
#define | SSLBIT_CASIGN ((BYTE) HIGHBIT(7))
#define | SSLBIT_CASMIME ((BYTE) HIGHBIT(6))
#define | SSLBIT_CASSL ((BYTE) HIGHBIT(5))
#define | SSLBIT_CLIENT ((BYTE) HIGHBIT(0))
#define | SSLBIT_RESERVED ((BYTE) HIGHBIT(4))
#define | SSLBIT_SERVER ((BYTE) HIGHBIT(1))
#define | SSLBIT_SIGN ((BYTE) HIGHBIT(3))
#define | SSLBIT_SMIME ((BYTE) HIGHBIT(2))
#define | szOID_CERTTYPE_EXTENSION szOID_ENROLL_CERTTYPE_EXTENSION
#define | wszCERTTYPE_SUBORDINATE_CA L"SubCA"
#define | wszPROPVALIDITYPERIODCOUNT wszPROPVALIDITYPERIODUNITS
#define | wszPROPVALIDITYPERIODSTRING wszPROPVALIDITYPERIOD
#define | wszREGFILEISSUERCERTURL wszREGFILEISSUERCERTURL_OLD
#define | wszREGFILEREVOCATIONCRLURL wszREGFILEREVOCATIONCRLURL_OLD
#define | wszREGFTPISSUERCERTURL wszREGFTPISSUERCERTURL_OLD
#define | wszREGFTPREVOCATIONCRLURL wszREGFTPREVOCATIONCRLURL_OLD
#define | wszREGISSUERCERTURL wszREGISSUERCERTURL_OLD
#define | wszREGLDAPISSUERCERTURL wszREGLDAPISSUERCERTURL_OLD
#define | wszREGLDAPREVOCATIONCRLURL wszREGLDAPREVOCATIONCRLURL_OLD
#define | wszREGREVOCATIONCRLURL wszREGREVOCATIONCRLURL_OLD

Functions

HRESULT | CheckRequestProperties (IN ICertServerPolicy *pServer)
HRESULT | EnumerateAttributes (IN ICertServerPolicy *pServer)
HRESULT | GetServerCallbackInterface (ICertServerPolicy **ppServer, LONG Context)
BOOL | IsStringInList (IN BSTR const str, IN DWORD count, IN BSTR const *apstr)

Variables

BOOL | fDebug = DBG_CERTSRV
HINSTANCE | g_hInstance

Define Documentation

#define HIGHBIT ( bitno ) (1 << (7 - (bitno)))

Definition at line 1460 of file Policy.Cpp.

#define ISSCERT_FILEURL ISSCERT_FILEURL_OLD

Definition at line 36 of file Policy.Cpp.

#define ISSCERT_FTPURL ISSCERT_FTPURL_OLD

Definition at line 37 of file Policy.Cpp.

#define ISSCERT_HTTPURL ISSCERT_HTTPURL_OLD

Definition at line 38 of file Policy.Cpp.

#define ISSCERT_LDAPURL ISSCERT_LDAPURL_OLD

Definition at line 39 of file Policy.Cpp.

#define NSCERTTYPE_CA ((BYTE) (SSLBIT_CASSL | SSLBIT_CASMIME | SSLBIT_CASIGN))

Definition at line 1476 of file Policy.Cpp.

#define NSCERTTYPE_CLIENT ((BYTE) SSLBIT_CLIENT)

Definition at line 1473 of file Policy.Cpp.

#define NSCERTTYPE_SERVER ((BYTE) (SSLBIT_SERVER | SSLBIT_CLIENT))

Definition at line 1474 of file Policy.Cpp.

#define NSCERTTYPE_SMIME ((BYTE) SSLBIT_SMIME)

Definition at line 1475 of file Policy.Cpp.

#define REVEXT_CDPFILEURL REVEXT_CDPFILEURL_OLD

Definition at line 40 of file Policy.Cpp.

#define REVEXT_CDPFTPURL REVEXT_CDPFTPURL_OLD

Definition at line 41 of file Policy.Cpp.

#define REVEXT_CDPHTTPURL REVEXT_CDPHTTPURL_OLD

Definition at line 42 of file Policy.Cpp.

#define REVEXT_CDPLDAPURL REVEXT_CDPLDAPURL_OLD

Definition at line 43 of file Policy.Cpp.

#define SSLBIT_CASIGN ((BYTE) HIGHBIT(7))

Definition at line 1471 of file Policy.Cpp.

#define SSLBIT_CASMIME ((BYTE) HIGHBIT(6))

Definition at line 1470 of file Policy.Cpp.

#define SSLBIT_CASSL ((BYTE) HIGHBIT(5))

Definition at line 1469 of file Policy.Cpp.

#define SSLBIT_CLIENT ((BYTE) HIGHBIT(0))

Definition at line 1462 of file Policy.Cpp.

#define SSLBIT_RESERVED ((BYTE) HIGHBIT(4))

Definition at line 1467 of file Policy.Cpp.

#define SSLBIT_SERVER ((BYTE) HIGHBIT(1))

Definition at line 1463 of file Policy.Cpp.

#define SSLBIT_SIGN ((BYTE) HIGHBIT(3))

Definition at line 1465 of file Policy.Cpp.

#define SSLBIT_SMIME ((BYTE) HIGHBIT(2))

Definition at line 1464 of file Policy.Cpp.

#define szOID_CERTTYPE_EXTENSION szOID_ENROLL_CERTTYPE_EXTENSION

Definition at line 21 of file Policy.Cpp.

#define wszCERTTYPE_SUBORDINATE_CA L"SubCA"

Definition at line 25 of file Policy.Cpp.

#define wszPROPVALIDITYPERIODCOUNT wszPROPVALIDITYPERIODUNITS

Definition at line 56 of file Policy.Cpp.

#define wszPROPVALIDITYPERIODSTRING wszPROPVALIDITYPERIOD

Definition at line 55 of file Policy.Cpp.

#define wszREGFILEISSUERCERTURL wszREGFILEISSUERCERTURL_OLD

Definition at line 44 of file Policy.Cpp.

#define wszREGFILEREVOCATIONCRLURL wszREGFILEREVOCATIONCRLURL_OLD

Definition at line 45 of file Policy.Cpp.

#define wszREGFTPISSUERCERTURL wszREGFTPISSUERCERTURL_OLD

Definition at line 46 of file Policy.Cpp.

#define wszREGFTPREVOCATIONCRLURL wszREGFTPREVOCATIONCRLURL_OLD

Definition at line 47 of file Policy.Cpp.

#define wszREGISSUERCERTURL wszREGISSUERCERTURL_OLD

Definition at line 48 of file Policy.Cpp.

#define wszREGLDAPISSUERCERTURL wszREGLDAPISSUERCERTURL_OLD

Definition at line 49 of file Policy.Cpp.

#define wszREGLDAPREVOCATIONCRLURL wszREGLDAPREVOCATIONCRLURL_OLD

Definition at line 50 of file Policy.Cpp.

#define wszREGREVOCATIONCRLURL wszREGREVOCATIONCRLURL_OLD

Definition at line 51 of file Policy.Cpp.

Function Documentation

HRESULT CheckRequestProperties ( IN ICertServerPolicy * pServer )

Definition at line 1330 of file Policy.Cpp.

{
    HRESULT hr;
    VARIANT varValue;
    BSTR strName = NULL;

    VariantInit(&varValue);

    strName = SysAllocString(wszPROPREQUESTREQUESTID);
    if (NULL == strName)
    {
        hr = E_OUTOFMEMORY;
  _JumpError(hr, error, "Policy:SysAllocString");
    }

    hr = pServer->GetRequestProperty(strName, PROPTYPE_LONG, &varValue);
    _JumpIfError(hr, error, "Policy:GetRequestProperty");

    DBGPRINT((
  fDebug,
  "Policy:CheckRequestProperties(%ws = %u)\n",
  strName,
  varValue.lVal));

error:
    VariantClear(&varValue);
    if (NULL != strName)
    {
        SysFreeString(strName);
    }
    return(hr);
}

HRESULT EnumerateAttributes ( IN ICertServerPolicy * pServer )

Definition at line 1264 of file Policy.Cpp.

{
    HRESULT hr;
    HRESULT hr2;
    BSTR strName = NULL;
    BOOL fClose = FALSE;
    BSTR strValue = NULL;

    hr = pServer->EnumerateAttributesSetup(0);
    _JumpIfError(hr, error, "Policy:EnumerateAttributesSetup");

    fClose = TRUE;
    while (TRUE)
    {
        hr = pServer->EnumerateAttributes(&strName);
  if (S_FALSE == hr)
  {
      hr = S_OK;
      break;
  }
  _JumpIfError(hr, error, "Policy:EnumerateAttributes");

        hr = pServer->GetRequestAttribute(strName, &strValue);
  _JumpIfError(hr, error, "Policy:GetRequestAttribute");

  DBGPRINT((
    fDebug,
                "Policy:EnumerateAttributes(%ws = %ws)\n",
                strName,
                strValue));
        if (NULL != strValue)
        {
            SysFreeString(strValue);
            strValue = NULL;
        }
    }

error:
    if (fClose)
    {
        hr2 = pServer->EnumerateAttributesClose();
        if (S_OK != hr2)
        {
      _PrintError(hr2, "Policy:EnumerateAttributesClose");
            if (S_OK == hr)
            {
                hr = hr2;
            }
            goto error;
        }
    }

    if (NULL != strName)
    {
        SysFreeString(strName);
    }
    if (NULL != strValue)
    {
        SysFreeString(strValue);
    }
    return(hr);
}

HRESULT GetServerCallbackInterface | ( | ICertServerPolicy ** | ppServer,
 |  | LONG | Context
 | ) |  |

Definition at line 61 of file Policy.Cpp.

{
    HRESULT hr;

    if (NULL == ppServer)
    {
        hr = E_POINTER;
  _JumpError(hr, error, "Policy:GetServerCallbackInterface");
    }

    hr = CoCreateInstance(
                    CLSID_CCertServerPolicy,
                    NULL,               // pUnkOuter
                    CLSCTX_INPROC_SERVER,
                    IID_ICertServerPolicy,
                    (VOID **) ppServer);
    _JumpIfError(hr, error, "Policy:CoCreateInstance");

    if (*ppServer == NULL)
    {
        hr = E_UNEXPECTED;
  _JumpError(hr, error, "Policy:CoCreateInstance");
    }

    // only set context if nonzero
    if (0 != Context)
    {
        hr = (*ppServer)->SetContext(Context);
        _JumpIfError(hr, error, "Policy:SetContext");
    }

error:
    return hr;
}

BOOL IsStringInList | ( | IN BSTR const | str,
 |  | IN DWORD | count,
 |  | IN BSTR const * | apstr
 | ) |  |

Definition at line 1070 of file Policy.Cpp.

{
    DWORD i;
    BOOL fInList = FALSE;

    for (i = 0; i < count; i++)
    {
  if (0 == wcscmp(str, apstr[i]))
  {
      fInList = TRUE;
      break;
  }
    }
    return(fInList);
}

Variable Documentation

BOOL fDebug = DBG_CERTSRV

Definition at line 28 of file Policy.Cpp.

HINSTANCE g_hInstance

Definition at line 104 of file SServer.Cpp.

Generated on Wed Nov 13 2024 16:54:30 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Policy/C++/Windows2000/Policy.h File Reference

  • Security
  • CertServices
  • Policy
  • C++
  • Windows2000
Classes | Defines | Functions

Policy.h File Reference

#include "certpsam.h"
#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Classes

class | CCertPolicySample

Defines

#define | _DumpStringArray(pszType, count, apstr)
#define | wsz_SAMPLE_COPYRIGHT L"(c)1999-2000 Microsoft"
#define | wsz_SAMPLE_DESCRIPTION L"Sample Policy Module"
#define | wsz_SAMPLE_FILEVER L"v 1.0"
#define | wsz_SAMPLE_NAME L"CertXPol.dll"
#define | wsz_SAMPLE_PRODUCTVER L"v 5.00"
#define | wszATTREMAIL1 TEXT("E")
#define | wszATTREMAIL2 TEXT("EMail")
#define | wszCLASS_CERTMANAGESAMPLE wszCLASS_CERTPOLICYSAMPLEPREFIX wszCERTMANAGEPOLICY_POSTFIX
#define | wszCLASS_CERTPOLICYSAMPLE wszCLASS_CERTPOLICYSAMPLEPREFIX wszCERTPOLICYMODULE_POSTFIX
#define | wszCLASS_CERTPOLICYSAMPLEPREFIX TEXT("CertAuthority_Sample")

Functions

HRESULT | GetServerCallbackInterface (ICertServerPolicy **ppServer, LONG Context)

Define Documentation

#define _DumpStringArray | ( | pszType,
 |  | count,
 |  | apstr
 | ) |

Definition at line 163 of file Policy.h.

#define wsz_SAMPLE_COPYRIGHT L"(c)1999-2000 Microsoft"

Definition at line 22 of file Policy.h.

#define wsz_SAMPLE_DESCRIPTION L"Sample Policy Module"

Definition at line 21 of file Policy.h.

#define wsz_SAMPLE_FILEVER L"v 1.0"

Definition at line 23 of file Policy.h.

#define wsz_SAMPLE_NAME L"CertXPol.dll"

Definition at line 20 of file Policy.h.

#define wsz_SAMPLE_PRODUCTVER L"v 5.00"

Definition at line 24 of file Policy.h.

#define wszATTREMAIL1 TEXT("E")

Definition at line 27 of file Policy.h.

#define wszATTREMAIL2 TEXT("EMail")

Definition at line 28 of file Policy.h.

#define wszCLASS_CERTMANAGESAMPLE wszCLASS_CERTPOLICYSAMPLEPREFIX wszCERTMANAGEPOLICY_POSTFIX

Definition at line 18 of file Policy.h.

#define wszCLASS_CERTPOLICYSAMPLE wszCLASS_CERTPOLICYSAMPLEPREFIX wszCERTPOLICYMODULE_POSTFIX

Definition at line 16 of file Policy.h.

#define wszCLASS_CERTPOLICYSAMPLEPREFIX TEXT("CertAuthority_Sample")

Definition at line 14 of file Policy.h.

Function Documentation

HRESULT GetServerCallbackInterface | ( | ICertServerPolicy ** | ppServer,
 |  | LONG | Context
 | ) |  |

Definition at line 61 of file Policy.Cpp.

{
    HRESULT hr;

    if (NULL == ppServer)
    {
        hr = E_POINTER;
  _JumpError(hr, error, "Policy:GetServerCallbackInterface");
    }

    hr = CoCreateInstance(
                    CLSID_CCertServerPolicy,
                    NULL,               // pUnkOuter
                    CLSCTX_INPROC_SERVER,
                    IID_ICertServerPolicy,
                    (VOID **) ppServer);
    _JumpIfError(hr, error, "Policy:CoCreateInstance");

    if (*ppServer == NULL)
    {
        hr = E_UNEXPECTED;
  _JumpError(hr, error, "Policy:CoCreateInstance");
    }

    // only set context if nonzero
    if (0 != Context)
    {
        hr = (*ppServer)->SetContext(Context);
        _JumpIfError(hr, error, "Policy:SetContext");
    }

error:
    return hr;
}

Generated on Wed Nov 13 2024 16:54:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/Policy/C++/Windows2000/Resource.h File Reference

  • Security
  • CertServices
  • Policy
  • C++
  • Windows2000
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDS_CERTMANAGEPOLICYMODULE_DESC 2
#define | IDS_CERTPOLICY_DESC 1

Define Documentation

#define IDS_CERTMANAGEPOLICYMODULE_DESC 2

Definition at line 16 of file Resource.h.

#define IDS_CERTPOLICY_DESC 1

Definition at line 15 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CertServices/RequestCert/RequestCert.Cpp File Reference

  • Security
  • CertServices
  • RequestCert
Defines | Functions | Variables

RequestCert.Cpp File Reference

#include <windows.h>
#include <stdio.h>
#include <tchar.h>
#include <wincrypt.h>
#include <objbase.h>
#include <certsrv.h>
#include <xenroll.h>

Go to the source code of this file.

Defines

#define | BUFFERSIZE 512

Functions

void _cdecl | _tmain (int argc, TCHAR *argv[])
void | PrintUsage (void)

Variables

OLECHAR * | ICEnrollProgID = OLESTR("CEnroll.CEnroll.1")
TCHAR | szCertReq [BUFFERSIZE]
WCHAR | szwTempBuffer [BUFFERSIZE]

Define Documentation

#define BUFFERSIZE 512

Definition at line 29 of file RequestCert.Cpp.

Function Documentation

void _cdecl _tmain | ( | int | argc,
 |  | TCHAR * | argv[]
 | ) |  |

Definition at line 40 of file RequestCert.Cpp.

{
   HRESULT hr;
   ICEnroll4 *CertEnroll = NULL;
   ICertRequest *CertRequest = NULL;
   ICertConfig *CertConfig = NULL;
   CLSID CLSID_CCertEnroll;
   BSTR pPKCS10 = NULL, pConfig = NULL, pPKCS7 = NULL;
   BSTR bstrTemp = NULL;
   BSTR bstrCertReq = NULL;
   LONG Disposition, RequestId;
   int n;

   __try {
      if (argc == 1)
      {
         PrintUsage();
         return;
      }

      // Append Common name to Certificate request string
      lstrcpy(szCertReq, TEXT("CN="));
      lstrcat(szCertReq, argv[1]);

      // Parse command line and append to Certificate Request String
      for (n = 2; n < argc; n++)
      {
         // Append common string identifier
         if (lstrcmp(argv[n], TEXT("/ou")) == 0) lstrcat(szCertReq, TEXT(",OU="));
         else if (lstrcmp(argv[n], TEXT("/o")) == 0) lstrcat(szCertReq, TEXT(",O="));
         else if (lstrcmp(argv[n], TEXT("/l")) == 0) lstrcat(szCertReq, TEXT(",L="));
         else if (lstrcmp(argv[n], TEXT("/s")) == 0) lstrcat(szCertReq, TEXT(",S="));
         else if (lstrcmp(argv[n], TEXT("/c")) == 0) lstrcat(szCertReq, TEXT(",C="));
         else if (lstrcmp(argv[n], TEXT("/e")) == 0) lstrcat(szCertReq, TEXT(",E="));
         else
         {
            PrintUsage();
            return;
         }

         // Append string
         if ((n + 1) < argc) lstrcat(szCertReq, argv[++n]);
         else
         {
            PrintUsage();
            return;
         }
      }

      // Convert Certificate Request String to BSTR
#ifdef UNICODE
      bstrCertReq = SysAllocString(szCertReq);
#else
      n = MultiByteToWideChar(CP_ACP, 0, szCertReq, -1, szwTempBuffer, BUFFERSIZE);
      if (n == 0)
      {
            _tprintf(TEXT("MultiByteToWideChar failed with %d\n"), GetLastError());
            __leave;
      }
      bstrCertReq = SysAllocString(szwTempBuffer);
#endif

      // Initialize COM library
      hr = CoInitialize(NULL);
      if (FAILED(hr))
      {
            _tprintf(TEXT("CoInitialize failed\n"));
            __leave;
      }

      // Get CLSID for ICEnroll
      hr = CLSIDFromProgID(ICEnrollProgID, &CLSID_CCertEnroll);
      if (FAILED(hr))
      {
         _tprintf(TEXT("CLSIDFromProgID failed\n"));
         __leave;
      }

      // get pointer to ICEnroll interface
      hr = CoCreateInstance(
               CLSID_CCertEnroll,
               NULL,
               CLSCTX_INPROC_SERVER,
               IID_ICEnroll4,
               (void **)&CertEnroll);
      if (FAILED(hr))
      {
         _tprintf(TEXT("CoCreateInstance with IID_ICEnroll4 failed\n"));
         __leave;
      }

      // get pointer to ICertRequest interface
      hr = CoCreateInstance(
                CLSID_CCertRequest,
                NULL,
                CLSCTX_INPROC_SERVER,
                IID_ICertRequest,
                (void **)&CertRequest);
      if (FAILED(hr))
      {
            _tprintf(TEXT("CoCreateInstance with IID_ICertRequest failed\n"));
            __leave;
      }

      // get pointer to ICertConfig interface
      hr = CoCreateInstance(
                CLSID_CCertConfig,
                NULL,
                CLSCTX_INPROC_SERVER,
                IID_ICertConfig,
                (void **)&CertConfig);
      if (FAILED(hr))
      {
         _tprintf(TEXT("CoCreateInstance with IID_ICertConfig failed\n"));
         __leave;
      }

      // Set KeySpec to be Exchange key
      // An exchange key makes this certificate a client certificate.
      // The server encrypts something with the certificate's
      // public key. The client can decrypt it with the private key
      // and verify itself
      hr = CertEnroll->put_KeySpec(AT_KEYEXCHANGE);
      if (FAILED(hr))
      {
         _tprintf(TEXT("CertEnroll->putKeySpec failed\n"));
         __leave;
      }

      // Create Certificate Request (PKCS10)
      // Second paramter is the OID that describes the purpose of the certificate.
      // 1.3.6.1.5.5.7.3.2 is the OID for Client Authentication
      // 1.3.6.1.5.5.7.3.3 is the OID for Code Signing
      // 1.3.6.1.5.5.7.3.1 is the OID for Server Authentication
      // 1.3.6.1.5.5.7.3.4 is the OID for email protection
      bstrTemp = SysAllocString(OLESTR("1.3.6.1.5.5.7.3.2"));
      hr = CertEnroll->createPKCS10(
                bstrCertReq,
                bstrTemp,
                &pPKCS10);
      if (FAILED(hr))
      {
         _tprintf(TEXT("CertEnroll->CreatePKCS10 failed\n"));
         __leave;
      }
      SysFreeString(bstrTemp);
      bstrTemp = NULL;

      // Get Default configuration
      hr = CertConfig->GetConfig(0, &pConfig);
      if (FAILED(hr))
      {
         _tprintf(TEXT("CertConfig->GetConfig failed\n"));
         __leave;
      }

      // Submit the Certificate Request
      // Second parameter specifies the attributes for the
      // certificate request. We don't set any attributes
      // in this sample.  Attributes may be a BSTR of type
      // "AttributeName1:AttributeValue1\nAttributeName2:AttributeValue2"
      // where each attribute is a name/value pair separated
      // by new line characters.
      bstrTemp = SysAllocString(OLESTR(""));
      hr = CertRequest->Submit(
                CR_IN_BASE64|CR_IN_PKCS10,
                pPKCS10,
                bstrTemp,
                pConfig,
                &Disposition);
      if (FAILED(hr))
      {
         _tprintf(TEXT("CertRequest->Submit failed\n"));
         __leave;
      }
      SysFreeString(bstrTemp);
      bstrTemp = NULL;

      _tprintf(TEXT("Certificate request submitted\n"));

      // if Certificate Server issued certificate Get Certificate
      if (Disposition == CR_DISP_ISSUED)
      {
         // Get the issued Certificate in a BASE64 PKCS#7 message
         hr = CertRequest->GetCertificate(CR_OUT_BASE64 | CR_OUT_CHAIN, &pPKCS7);
         if (FAILED(hr))
         {
            _tprintf(TEXT("CertRequest->GetCertificate failed\n"));
            __leave;
         }

         // save PKCS#7 message to file in binary format when accepting it
         // This is not necessary, but can be used later to look at the
         // certificate information.
         bstrTemp = SysAllocString(OLESTR("PKCS7BinaryFile"));
         hr = CertEnroll->put_SPCFileName(bstrTemp);
         if (FAILED(hr))
         {
            _tprintf(TEXT("CertEnroll->put_SPCFileName failed\n"));
            __leave;
         }
         SysFreeString(bstrTemp);
         bstrTemp = NULL;

         // accept the encoded certificate and place it in the store
         // The store will automatically be the "MY" store.
         // This behavior can be change by setting the
         // CertEnroll::MyStoreName property.  Use
         // CertEnroll::put_MyStoreName when using C++
         hr = CertEnroll->acceptPKCS7(pPKCS7);
         if (FAILED(hr))
         {
            _tprintf(TEXT("CertEnroll->acceptPKCS7 failed\n"));
            __leave;
         }

         _tprintf(TEXT("Certificate accepted and installed\n"));
      }
      else
      {
         // Certificate Server did not issue certificate
         _tprintf(TEXT("Certificate Server did not issue certificate\n"));
         _tprintf(TEXT("Dispostion returned:\n"));

         // Get Disposition message
         hr = CertRequest->GetDispositionMessage(&bstrTemp);
         if (FAILED(hr))
         {
            _tprintf(TEXT("CertRequest->GetDispositionMessage failed\n"));
            __leave;
         }

         wcscpy(szwTempBuffer, bstrTemp);
         wprintf(szwTempBuffer);
         wprintf(L"\n");
         SysFreeString(bstrTemp);
         bstrTemp = NULL;
      }

      // Get Request Id
      hr = CertRequest->GetRequestId(&RequestId);
      if (FAILED(hr))
      {
         _tprintf(TEXT("CertRequest->GetRequestId failed\n"));
         __leave;
      }

      // Display request Id
      _tprintf(TEXT("Request Id = %d\n"), RequestId);

   }
   __finally {
      // Clean up
      if (CertEnroll != NULL) CertEnroll->Release();
      if (CertRequest != NULL) CertRequest->Release();
      if (CertConfig != NULL) CertConfig->Release();
      if (bstrCertReq != NULL) SysFreeString(bstrCertReq);
      if (pPKCS10 != NULL) SysFreeString(pPKCS10);
      if (pPKCS7 != NULL) SysFreeString(pPKCS7);
      if (pConfig != NULL) SysFreeString(pConfig);
      if (bstrTemp != NULL) SysFreeString(bstrTemp);
      CoUninitialize();
   }
}

void PrintUsage ( void )

Definition at line 308 of file RequestCert.Cpp.

{
   _tprintf(TEXT("Usage : RequestCert <common name> [options]\n"));
   _tprintf(TEXT("options:\n\t/ou <organizational unit>\n"));
   _tprintf(TEXT("\t/o <organization>\n"));
   _tprintf(TEXT("\t/l <locale>\n"));
   _tprintf(TEXT("\t/s <state>\n"));
   _tprintf(TEXT("\t/c <country>\n"));
   _tprintf(TEXT("\t/e <email address>\n"));
}

Variable Documentation

OLECHAR* ICEnrollProgID = OLESTR("CEnroll.CEnroll.1")

Definition at line 37 of file RequestCert.Cpp.

TCHAR szCertReq[BUFFERSIZE]

Definition at line 33 of file RequestCert.Cpp.

WCHAR szwTempBuffer[BUFFERSIZE]

Definition at line 34 of file RequestCert.Cpp.

Generated on Wed Nov 13 2024 16:54:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CryptoApi/CreateCert/CreateCert.c File Reference

  • Security
  • CryptoApi
  • CreateCert
Classes | Defines | Typedefs | Functions | Variables

CreateCert.c File Reference

#include <windows.h>
#include <wincrypt.h>
#include <rpc.h>
#include <stdio.h>
#include "CreateCert.h"

Go to the source code of this file.

Classes

struct | tagEnhKeyUsage

Defines

#define | ENCODING (X509_ASN_ENCODING | PKCS_7_ASN_ENCODING)
#define | KEY_USAGE_SIZE 5

Typedefs

typedef struct tagEnhKeyUsage | ENHKEYUSAGE

Functions

BOOL | CreateCertificate (LPSTR szX509, DWORD dwKeyType, LPSTR szSigAlg, WORD wMonths, DWORD dwUsage, BOOL bCA, BOOL bUseProv, DWORD dwProviderNum, LPSTR szSubjectStore, BOOL bSubjectUser, BOOL bSelfSigned, LPSTR szIssuerName, LPSTR szIssuerStore, BOOL bIssuerUser, BOOL bExport, LPSTR szCertFile, LPSTR szKeyFile, LPSTR szPassword)
PCCERT_CONTEXT | FindCertificate (LPSTR szCertName, LPSTR szStore, DWORD dwFlags, PCRYPT_DATA_BLOB *KeyId, HCRYPTPROV *hProv, LPDWORD dwKeyType)
BOOL | ImportCertificate (LPSTR szCertFile, LPSTR szKeyFile, LPSTR szPassword, LPSTR szStore, BOOL bUser, DWORD dwProviderNum)
int | main (int argc, char *argv[])
BOOL WINAPI | MyCryptEnumProviders (DWORD dwIndex, LPDWORD Res, DWORD dwFlags, LPDWORD pdwProvType, LPTSTR szProvName, LPDWORD pcbProvName)
void | PrintUsage (void)

Variables

ENHKEYUSAGE g_EnhKeyUsage
LPSTR g_szEmpty = ""
LPSTR | g_szMyStore = "MY"
LPSTR g_szSigAlg []

Define Documentation

#define ENCODING (X509_ASN_ENCODING | PKCS_7_ASN_ENCODING)

Definition at line 33 of file CreateCert.c.

#define KEY_USAGE_SIZE 5

Definition at line 31 of file CreateCert.c.

Typedef Documentation

typedef struct tagEnhKeyUsage ENHKEYUSAGE

Function Documentation

BOOL CreateCertificate | ( | LPSTR | szX509,
 |  | DWORD | dwKeyType,
 |  | LPSTR | szSigAlg,
 |  | WORD | wMonths,
 |  | DWORD | dwUsage,
 |  | BOOL | bCA,
 |  | BOOL | bUseProv,
 |  | DWORD | dwProviderNum,
 |  | LPSTR | szSubjectStore,
 |  | BOOL | bSubjectUser,
 |  | BOOL | bSelfSigned,
 |  | LPSTR | szIssuerName,
 |  | LPSTR | szIssuerStore,
 |  | BOOL | bIssuerUser,
 |  | BOOL | bExport,
 |  | LPSTR | szCertFile,
 |  | LPSTR | szKeyFile,
 |  | LPSTR | szPassword
 | ) |  |

Definition at line 679 of file CreateCert.c.

{
   BOOL bReturn = FALSE;
   BOOL bResult;
   LPBYTE pbNameBlob = NULL;
   LPSTR szContainer = NULL;
   RPC_STATUS Status;
   HCRYPTPROV hProv = 0;
   HCRYPTPROV hIssuerProv = 0;
   HCRYPTKEY hPubKey = 0;
   HCRYPTKEY hSessionKey = 0;
   HCRYPTHASH hHash = 0;
   HCERTSTORE hStore = 0;
   HANDLE hCertFile = INVALID_HANDLE_VALUE;
   HANDLE hKeyFile = INVALID_HANDLE_VALUE;
   PCRYPT_DATA_BLOB KeyId = NULL;
   PCERT_PUBLIC_KEY_INFO PublicKeyInfo = NULL;
   PCCERT_CONTEXT pIssuerCert = NULL;
   PCCERT_CONTEXT pCertContext = NULL;
   LPBYTE pbKeyIdentifier = NULL;
   LPBYTE SubjectKeyIdentifier = NULL;
   LPBYTE pbKeyUsage = NULL;
   LPBYTE pbEnhKeyUsage = NULL;
   LPBYTE pbBasicConstraints = NULL;
   LPBYTE pbAuthorityKeyId = NULL;
   LPBYTE bpEncodedCert = NULL;
   LPBYTE pbExportedKey = NULL;
   CERT_ENHKEY_USAGE CertEnhKeyUsage = { 0, NULL };
   BYTE SerialNumber[8];
   CERT_BASIC_CONSTRAINTS2_INFO BasicConstraints;
   CERT_AUTHORITY_KEY_ID_INFO AuthorityKeyId;
   BYTE ByteData;
   CRYPT_BIT_BLOB KeyUsage;
   CERT_EXTENSION CertExtension[5];
   CRYPT_DATA_BLOB CertKeyIdentifier;
   CERT_NAME_BLOB IssuerName;
   HANDLE hHeap = GetProcessHeap();
   CERT_INFO CertInfo;
   DWORD dwSize, m, q;
   DWORD dwAcquireFlags, dwIssuerKeyType;
   DWORD dwIssuerFlags, dwSubjectFlags;
   FILETIME ftTime;
   SYSTEMTIME stTime;
   CHAR szProvider[260] = { MS_DEF_PROV };
   DWORD dwProviderType = PROV_RSA_FULL;
   BOOL bAddAuthorityExtension = FALSE;

   __try
   {
      // Enumerate Provider
      if (bUseProv)
      {
         dwSize = 260;
         bResult = MyCryptEnumProviders(
                           dwProviderNum,
                           NULL,
                           0,
                           &dwProviderType,
                           szProvider,
                           &dwSize);
         if (!bResult)
         {
            printf("Unable to get provider\n");
            __leave;
         }

      }

      if (bSubjectUser)
      {
         // Certificate will be in the User store and
         // key container will be a User container
         dwAcquireFlags = 0;
         dwSubjectFlags = CERT_SYSTEM_STORE_CURRENT_USER;
      }
      else
      {
         // Certificate will be in the Machine store and
         // key container will be a Mahince container
         dwAcquireFlags = CRYPT_MACHINE_KEYSET;
         dwSubjectFlags = CERT_SYSTEM_STORE_LOCAL_MACHINE;
      }

      if (bIssuerUser)
      {
         // Get Issuer Certificate from User store
         dwIssuerFlags = CERT_SYSTEM_STORE_CURRENT_USER;
      }
      else
      {
         // Get Issuer Certificate from Machine store
         dwIssuerFlags = CERT_SYSTEM_STORE_LOCAL_MACHINE;
      }

      // Get X509 Name and convert it to a Name Blob
      bResult = CertStrToName(X509_ASN_ENCODING,
                          szX509,
                          CERT_X500_NAME_STR,
                          NULL,
                          NULL,
                          &dwSize,
                          NULL);
      if (!bResult)
      {
         printf("CertStrToName failed with %x\n", GetLastError());
         __leave;
      }

      // Allocate memory for Name Blob
      pbNameBlob = (LPBYTE)HeapAlloc(hHeap, 0, dwSize);
      if (!pbNameBlob)
      {
         printf("Unable to allocate memory for name blob\n");
         __leave;
      }

      // Convert X509 Name to Name Blob
      bResult = CertStrToName(X509_ASN_ENCODING,
                          szX509,
                          CERT_X500_NAME_STR,
                          NULL,
                          (LPBYTE)pbNameBlob,
                          &dwSize,
                          NULL);
      if (!bResult)
      {
         printf("CertStrToName failed with %x\n", GetLastError());
         __leave;
      }

      IssuerName.cbData = dwSize;
      IssuerName.pbData = pbNameBlob;

      // Convert Enhanced Key usage number to
      // Enhanced Key Usage extension

      // Find Enhanced Key Usage extensions count
      for (m = 0; m < g_EnhKeyUsage.dwCount; m++)
      {
        if ((g_EnhKeyUsage.dwValue[m] & dwUsage) == g_EnhKeyUsage.dwValue[m])
        {
          CertEnhKeyUsage.cUsageIdentifier++;
        }
      }

      // If extensions exist continue
      if (CertEnhKeyUsage.cUsageIdentifier != 0)
      {
         // Allocate memory for Enhanced Key Usage array
         CertEnhKeyUsage.rgpszUsageIdentifier =
             (LPSTR *)HeapAlloc(hHeap, 0, CertEnhKeyUsage.cUsageIdentifier * sizeof(LPSTR));
         if (!CertEnhKeyUsage.rgpszUsageIdentifier)
         {
           printf("Unable to allocate memory for Enhanced Usage array\n");
           __leave;
         }

         // Initialize Enhanced Key Usage array to NULL
         for (m = 0; m < CertEnhKeyUsage.cUsageIdentifier; m++)
         {
           CertEnhKeyUsage.rgpszUsageIdentifier[m] = NULL;
         }

         // Add proper extension OID to array
         q = 0;
         for (m = 0; m < g_EnhKeyUsage.dwCount; m++)
         {
           if ((g_EnhKeyUsage.dwValue[m] & dwUsage) == g_EnhKeyUsage.dwValue[m])
           {
             CertEnhKeyUsage.rgpszUsageIdentifier[q++] = g_EnhKeyUsage.szUsage[m];
           }
         }
      }

      // Create Crypto Context

      {
         UUID Uuid;
         HCRYPTPROV hTemp;

         // Create Temporary Provider
         bResult = CryptAcquireContext(&hTemp,
                                       "Temp000",
                                       MS_DEF_PROV,
                                       PROV_RSA_FULL,
                                       CRYPT_NEWKEYSET);
         if (!bResult)
         {
            // If Temporary Provider exists already,
            // open it
            if (GetLastError() == NTE_EXISTS)
            {
               bResult = CryptAcquireContext(&hTemp,
                                          "Temp000",
                                          MS_DEF_PROV,
                                          PROV_RSA_FULL,
                                          0);
               if (!bResult)
               {
                  printf("Unable to get temporary provider handle\n");
                  __leave;
               }
            }
            else
            {
               printf("Unable to create temporary provider handle\n");
               __leave;
            }
         }

         // Place random data in Uuid
         // Could have used UuidCreate but it is not supported
         // under Win9x.
         bResult = CryptGenRandom(hTemp, sizeof(Uuid), (LPBYTE)&Uuid);
         if (!bResult)
         {
            printf("CryptGenRandom failed with %x\n", GetLastError());
            __leave;
         }

         // Close Provider handle
         CryptReleaseContext(hTemp, 0);

         // Delete Container
         CryptAcquireContext(&hTemp,
                           "Temp000",
                           MS_DEF_PROV,
                           PROV_RSA_FULL,
                           CRYPT_DELETEKEYSET);

         // Create a random uuid
         /*Status = UuidCreate(&Uuid);
         if (Status != RPC_S_OK)
         {
            printf("Unable to create random container\n");
            __leave;
         }*/

         // convert random uuid to a string, we will use it as a container
         Status = UuidToString(&Uuid, &szContainer);
         if (Status != RPC_S_OK)
         {
            printf("Unable to convert uuid to string\n");
            __leave;
         }

         // Create new crypto context
         bResult = CryptAcquireContext(&hProv,
                            szContainer,
                            szProvider,
                            dwProviderType,
                            CRYPT_NEWKEYSET | dwAcquireFlags);
         if (!bResult)
         {
            printf("CryptAcquireContext failed with %x\n", GetLastError());
            __leave;
         }
      }

      // Generate Private/Public key pair
      bResult = CryptGenKey(hProv, dwKeyType, CRYPT_EXPORTABLE, &hPubKey);
      if (!bResult)
      {
         printf("CryptGenKey failed with %x\n", GetLastError());
         __leave;
      }

      // Zero CERT_INFO structure
      ZeroMemory(&CertInfo, sizeof(CertInfo));

      // Set Version of Certificate
      CertInfo.dwVersion = CERT_V3;

      // Create Random Serial Number
      bResult = CryptGenRandom(hProv, 8, SerialNumber);
      if (!bResult)
      {
         printf("CryptGenRandom failed with %x\n", GetLastError());
         __leave;
      }

      // Set Serial Number of Certificate
      CertInfo.SerialNumber.cbData = 8;
      CertInfo.SerialNumber.pbData = SerialNumber;

      // Set Signature Algorithm of Certificate
      CertInfo.SignatureAlgorithm.pszObjId = szSigAlg;

      // set NotBefore date
      GetSystemTime(&stTime);
      SystemTimeToFileTime(&stTime, &ftTime);
      CertInfo.NotBefore = ftTime;

      if (wMonths == 0)
      {
         if (bSelfSigned)
            wMonths = 24;
         else
            wMonths = 6;
      }

      //
      // Set After Date
      //
      stTime.wMonth += wMonths;
      if ((stTime.wMonth / 12) > 0)
      {
         stTime.wYear += (stTime.wMonth / 12);
         stTime.wMonth = (stTime.wMonth % 12);
      }

      SystemTimeToFileTime(&stTime, &ftTime);
      CertInfo.NotAfter = ftTime;

      // Get Public Key Info size
      bResult = CryptExportPublicKeyInfo(hProv, dwKeyType,
                                       X509_ASN_ENCODING, NULL, &dwSize);
      if (!bResult)
      {
         printf("CryptExportPublicKeyInfo failed with %x\n", GetLastError());
         __leave;
      }

      // Allocate memory for Public Key Info
      PublicKeyInfo = (PCERT_PUBLIC_KEY_INFO)HeapAlloc(hHeap, 0, dwSize);
      if (!PublicKeyInfo)
      {
         printf("Unable to allocate memory for public key info\n");
         __leave;
      }

      // Get Public Key Info
      bResult = CryptExportPublicKeyInfo(hProv, dwKeyType,
                                       X509_ASN_ENCODING,
                                       PublicKeyInfo, &dwSize);
      if (!bResult)
      {
         printf("CryptExportPublicKeyInfo failed with %x\n", GetLastError());
         __leave;
      }

      // Set Public Key info of Certificate
      CertInfo.SubjectPublicKeyInfo = *PublicKeyInfo;

      // Create Hash
      bResult = CryptCreateHash(hProv, CALG_SHA1, 0, 0, &hHash);
      if (!bResult)
      {
         printf("CryptCreateHash failed with %x\n", GetLastError());
         __leave;
      }

      // Hash Public Key Info
      bResult = CryptHashData(hHash, (LPBYTE)PublicKeyInfo, dwSize, 0);
      if (!bResult)
      {
         printf("CryptHashData failed with %x\n", GetLastError());
         __leave;
      }

      // Get Size of Hash
      bResult = CryptGetHashParam(hHash, HP_HASHVAL, NULL, &dwSize, 0);
      if (!bResult)
      {
         printf("CryptGetHashParam failed with %x\n", GetLastError());
         __leave;
      }

      // Allocate Memory for Key Identifier (hash of Public Key info)
      pbKeyIdentifier = (LPBYTE)HeapAlloc(hHeap, 0, dwSize);
      if (!pbKeyIdentifier)
      {
         printf("Unable to allocate memory for Hashed Public key Info\n");
         __leave;
      }

      // Get Hash of Public Key Info
      bResult = CryptGetHashParam(hHash, HP_HASHVAL, pbKeyIdentifier, &dwSize, 0);
      if (!bResult)
      {
         printf("CryptGetHashParam failed with %x\n", GetLastError());
         __leave;
      }

      // We will use this to set the Key Identifier extension
      CertKeyIdentifier.cbData = dwSize;
      CertKeyIdentifier.pbData = pbKeyIdentifier;

      // Set Subject of Certificate
      CertInfo.Subject = IssuerName;

      // Set Issuer of Certificate
      if (bSelfSigned)
      {
         CertInfo.Issuer = IssuerName;
      }
      else
      {
         pIssuerCert = FindCertificate(szIssuerName, szIssuerStore,
                                       dwIssuerFlags, &KeyId,
                                       &hIssuerProv, &dwIssuerKeyType);
         if (!pIssuerCert)
         {
            printf("Unable to find Issuer Certificate\n");
            __leave;
         }

         CertInfo.Issuer = pIssuerCert->pCertInfo->Subject;
      }

      // Get Subject Key Identifier Extension size
      bResult = CryptEncodeObject(ENCODING,
                                  szOID_SUBJECT_KEY_IDENTIFIER,
                                  (LPVOID)&CertKeyIdentifier,
                                  NULL, &dwSize);
      if (!bResult)
      {
         printf("CryptEncodeObject failed with %x\n", GetLastError());
         __leave;
      }

      // Allocate Memory for Subject Key Identifier Blob
      SubjectKeyIdentifier = (LPBYTE)HeapAlloc(hHeap, 0, dwSize);
      if (!SubjectKeyIdentifier)
      {
         printf("Unable to allocate memory for Subject Key Identifier\n");
         __leave;
      }

      // Get Subject Key Identifier Extension
      bResult = CryptEncodeObject(ENCODING,
                                  szOID_SUBJECT_KEY_IDENTIFIER,
                                  (LPVOID)&CertKeyIdentifier,
                                  SubjectKeyIdentifier, &dwSize);
      if (!bResult)
      {
         printf("CryptEncodeObject failed with %x\n", GetLastError());
         __leave;
      }

      // Set Subject Key Identifier
      CertExtension[CertInfo.cExtension].pszObjId = szOID_SUBJECT_KEY_IDENTIFIER;
      CertExtension[CertInfo.cExtension].fCritical = FALSE;
      CertExtension[CertInfo.cExtension].Value.cbData = dwSize;
      CertExtension[CertInfo.cExtension].Value.pbData = SubjectKeyIdentifier;

      // Increase extension count
      CertInfo.cExtension++;

      // Set Key Usage according to Public Key Type
      ZeroMemory(&KeyUsage, sizeof(KeyUsage));
      KeyUsage.cbData = 1;
      KeyUsage.pbData = &ByteData;

      if (dwKeyType == AT_SIGNATURE)
      {
         ByteData = CERT_DIGITAL_SIGNATURE_KEY_USAGE|
                    CERT_NON_REPUDIATION_KEY_USAGE|
                    CERT_KEY_CERT_SIGN_KEY_USAGE |
                    CERT_CRL_SIGN_KEY_USAGE;
      }

      if (dwKeyType == AT_KEYEXCHANGE)
      {
         ByteData = CERT_DIGITAL_SIGNATURE_KEY_USAGE |
                    CERT_DATA_ENCIPHERMENT_KEY_USAGE|
                    CERT_KEY_ENCIPHERMENT_KEY_USAGE |
                    CERT_KEY_AGREEMENT_KEY_USAGE;
      }

      // Get Key Usage blob size
      bResult = CryptEncodeObject(ENCODING,
                                  X509_KEY_USAGE,
                                  (LPVOID)&KeyUsage,
                                  NULL, &dwSize);
      if (!bResult)
      {
         printf("CryptEncodeObject failed with %x\n", GetLastError());
         __leave;
      }

      // Allocate Memory for Key Usage Blob
      pbKeyUsage = (LPBYTE)HeapAlloc(hHeap, 0, dwSize);
      if (!pbKeyUsage)
      {
         printf("Unable to allocate memory for Subject Key Identifier\n");
         __leave;
      }

      // Get Key Usage Extension blob
      bResult = CryptEncodeObject(ENCODING,
                                  X509_KEY_USAGE,
                                  (LPVOID)&KeyUsage,
                                  pbKeyUsage, &dwSize);
      if (!bResult)
      {
         printf("CryptEncodeObject failed with %x\n", GetLastError());
         __leave;
      }

      // Set Key Usage extension
      CertExtension[CertInfo.cExtension].pszObjId = szOID_KEY_USAGE;
      CertExtension[CertInfo.cExtension].fCritical = FALSE;
      CertExtension[CertInfo.cExtension].Value.cbData = dwSize;
      CertExtension[CertInfo.cExtension].Value.pbData = pbKeyUsage;

      // Increase extension count
      CertInfo.cExtension++;

      if (CertEnhKeyUsage.cUsageIdentifier != 0)
      {
         // Get Enhanced Key Usage size
         bResult = CryptEncodeObject(ENCODING,
                                     X509_ENHANCED_KEY_USAGE,
                                     (LPVOID)&CertEnhKeyUsage,
                                     NULL, &dwSize);
         if (!bResult)
         {
            printf("CryptEncodeObject failed with %x\n", GetLastError());
            __leave;
         }

         // Allocate Memory for Enhanced Key usage Blob
         pbEnhKeyUsage = (LPBYTE)HeapAlloc(hHeap, 0, dwSize);
         if (!pbEnhKeyUsage)
         {
            printf("Unable to allocate memory for Subject Key Identifier\n");
            __leave;
         }

         // Get Enhanced Key Usage Extension blob
         bResult = CryptEncodeObject(ENCODING,
                                     X509_ENHANCED_KEY_USAGE,
                                     (LPVOID)&CertEnhKeyUsage,
                                     pbEnhKeyUsage, &dwSize);
         if (!bResult)
         {
            printf("CryptEncodeObject failed with %x\n", GetLastError());
            __leave;
         }

         // Set Enhanced Key Usage extension
         CertExtension[CertInfo.cExtension].pszObjId = szOID_ENHANCED_KEY_USAGE;
         CertExtension[CertInfo.cExtension].fCritical = FALSE;
         CertExtension[CertInfo.cExtension].Value.cbData = dwSize;
         CertExtension[CertInfo.cExtension].Value.pbData = pbEnhKeyUsage;

         // Increase extension count
         CertInfo.cExtension++;
      }

      // Zero Basic Constraints structure
      ZeroMemory(&BasicConstraints, sizeof(BasicConstraints));

      // Self-signed is always a CA
      if (bSelfSigned)
      {
         BasicConstraints.fCA = TRUE;
         BasicConstraints.fPathLenConstraint = TRUE;
         BasicConstraints.dwPathLenConstraint = 1;
      }
      else
      {
         BasicConstraints.fCA = bCA;
      }

      // Get Basic Constraints blob size
      bResult = CryptEncodeObject(ENCODING,
                                  X509_BASIC_CONSTRAINTS2,
                                  (LPVOID)&BasicConstraints,
                                  NULL, &dwSize);
      if (!bResult)
      {
         printf("CryptEncodeObject failed with %x\n", GetLastError());
         __leave;
      }

      // Allocate Memory for Basic Constraints Blob
      pbBasicConstraints = (LPBYTE)HeapAlloc(hHeap, 0, dwSize);
      if (!pbBasicConstraints)
      {
         printf("Unable to allocate memory for Subject Key Identifier\n");
         __leave;
      }

      // Get Basic Constraints Extension blob
      bResult = CryptEncodeObject(ENCODING,
                                  X509_BASIC_CONSTRAINTS2,
                                  (LPVOID)&BasicConstraints,
                                  pbBasicConstraints, &dwSize);
      if (!bResult)
      {
         printf("CryptEncodeObject failed with %x\n", GetLastError());
         __leave;
      }

      // Set Basic Constraints extension
      CertExtension[CertInfo.cExtension].pszObjId = szOID_BASIC_CONSTRAINTS2;
      CertExtension[CertInfo.cExtension].fCritical = FALSE;
      CertExtension[CertInfo.cExtension].Value.cbData = dwSize;
      CertExtension[CertInfo.cExtension].Value.pbData = pbBasicConstraints;

      // Increase extension count
      CertInfo.cExtension++;

      if (bSelfSigned)
      {
         AuthorityKeyId.KeyId = CertKeyIdentifier;
         AuthorityKeyId.CertIssuer = CertInfo.Issuer;
         AuthorityKeyId.CertSerialNumber = CertInfo.SerialNumber;
         bAddAuthorityExtension = TRUE;
      }
      else
      {
         if (KeyId)
         {
            AuthorityKeyId.KeyId = *KeyId;
            AuthorityKeyId.CertIssuer = pIssuerCert->pCertInfo->Issuer;
            AuthorityKeyId.CertSerialNumber = pIssuerCert->pCertInfo->SerialNumber;
            bAddAuthorityExtension = TRUE;
         }
      }

      if (bAddAuthorityExtension)
      {
         // Get Authority Key Id blob size
         bResult = CryptEncodeObject(ENCODING,
                                     X509_AUTHORITY_KEY_ID,
                                     (LPVOID)&AuthorityKeyId,
                                     NULL, &dwSize);
         if (!bResult)
         {
            printf("CryptEncodeObject failed with %x\n", GetLastError());
            __leave;
         }

         // Allocate Authority Key Id Blob
         pbAuthorityKeyId = (LPBYTE)HeapAlloc(hHeap, 0, dwSize);
         if (!pbAuthorityKeyId)
         {
            printf("Unable to allocate memory for Subject Key Identifier\n");
            __leave;
         }

         // Get Authority Key Id blob
         bResult = CryptEncodeObject(ENCODING,
                                     X509_AUTHORITY_KEY_ID,
                                     (LPVOID)&AuthorityKeyId,
                                     pbAuthorityKeyId, &dwSize);
         if (!bResult)
         {
            printf("CryptEncodeObject failed with %x\n", GetLastError());
            __leave;
         }

         // Set Authority Key Id extension
         CertExtension[CertInfo.cExtension].pszObjId = szOID_AUTHORITY_KEY_IDENTIFIER;
         CertExtension[CertInfo.cExtension].fCritical = FALSE;
         CertExtension[CertInfo.cExtension].Value.cbData = dwSize;
         CertExtension[CertInfo.cExtension].Value.pbData = pbAuthorityKeyId;

         // Increase extension count
         CertInfo.cExtension++;
      }

      CertInfo.rgExtension = CertExtension;

      if (bSelfSigned)
      {
         // Get Encoded Certificate Size
         bResult = CryptSignAndEncodeCertificate(hProv, dwKeyType,
                                                 X509_ASN_ENCODING, X509_CERT_TO_BE_SIGNED,
                                                 (LPVOID)&CertInfo,
                                                 &(CertInfo.SignatureAlgorithm),
                                                 NULL, NULL, &dwSize);
         if (!bResult)
         {
            printf("CryptSignAndEncodeCertificate failed with %x\n", GetLastError());
            __leave;
         }

         // Allocate memory for encoded certificate
         bpEncodedCert = (LPBYTE)HeapAlloc(hHeap, 0, dwSize);
         if (!bpEncodedCert)
         {
            printf("Unable to allocate memory for encoded certficate\n");
            __leave;
         }

         // Sign and Encode certificate
         bResult = CryptSignAndEncodeCertificate(hProv, dwKeyType,
                                                 X509_ASN_ENCODING, X509_CERT_TO_BE_SIGNED,
                                                 (LPVOID)&CertInfo,
                                                 &(CertInfo.SignatureAlgorithm),
                                                 NULL, bpEncodedCert, &dwSize);
         if (!bResult)
         {
            printf("CryptSignAndEncodeCertificate failed with %x\n", GetLastError());
            __leave;
         }
      }
      else
      {
         // Get Encoded Certificate Size
         bResult = CryptSignAndEncodeCertificate(hIssuerProv, dwIssuerKeyType,
                                                 X509_ASN_ENCODING, X509_CERT_TO_BE_SIGNED,
                                                 (LPVOID)&CertInfo,
                                                 &(pIssuerCert->pCertInfo->SignatureAlgorithm),
                                                 NULL, NULL, &dwSize);
         if (!bResult)
         {
            printf("CryptSignAndEncodeCertificate failed with %x\n", GetLastError());
            __leave;
         }

         // Allocate memory for encoded certificate
         bpEncodedCert = (LPBYTE)HeapAlloc(hHeap, 0, dwSize);
         if (!bpEncodedCert)
         {
            printf("Unable to allocate memory for encoded certficate\n");
            __leave;
         }

         // Sign and Encode certificate
         bResult = CryptSignAndEncodeCertificate(hIssuerProv, dwIssuerKeyType,
                                                 X509_ASN_ENCODING, X509_CERT_TO_BE_SIGNED,
                                                 (LPVOID)&CertInfo,
                                                 &(pIssuerCert->pCertInfo->SignatureAlgorithm),
                                                 NULL, bpEncodedCert, &dwSize);
         if (!bResult)
         {
            printf("CryptSignAndEncodeCertificate failed with %x\n", GetLastError());
            __leave;
         }
      }

      if (bExport)
      {
          DWORD dwWritten;

          // Create Certificate file
          hCertFile = CreateFile(szCertFile, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
                                 FILE_ATTRIBUTE_NORMAL, NULL);
          if (hCertFile == INVALID_HANDLE_VALUE)
          {
              printf("CreateFile failed with %d\n", GetLastError());
              __leave;
          }

          // Write encoded Certificate to file
          bResult = WriteFile(hCertFile, (LPVOID)bpEncodedCert, dwSize, &dwWritten, NULL);
          if (!bResult)
          {
              printf("WriteFile failed with %d\n", GetLastError());
              __leave;
          }

          // Destroy previous hash
          if (hHash) CryptDestroyHash(hHash);
          hHash = 0;

          // Create hash
          bResult = CryptCreateHash(hProv, CALG_SHA1, 0, 0, &hHash);
          if (!bResult)
          {
              printf("CryptCreateHash failed with %x\n", GetLastError());
              __leave;
          }

          // Hash password
          bResult = CryptHashData(hHash, (LPBYTE)szPassword, (DWORD)strlen(szPassword), 0);
          if (!bResult)
          {
              printf("CryptHashData failed with %x\n", GetLastError());
              __leave;
          }

          // Derive Session Key from hash
          bResult = CryptDeriveKey(hProv, CALG_RC4, hHash, CRYPT_EXPORTABLE, &hSessionKey);
          if (!bResult)
          {
              printf("CryptDeriveKey failed with %x\n", GetLastError());
              __leave;
          }

          // Get size of exported key blob
          bResult = CryptExportKey(hPubKey, hSessionKey, PRIVATEKEYBLOB, 0, NULL, &dwSize);
          if (!bResult)
          {
              printf("CryptExportKey failed with %x\n", GetLastError());
              __leave;
          }

          // Allocate memory for exported key blob
          pbExportedKey = (LPBYTE)HeapAlloc(hHeap, 0, dwSize);
          if (!pbExportedKey)
          {
              printf("Unable to allocate memory for exported key\n");
              __leave;
          }

          // Get exported key blob
          bResult = CryptExportKey(hPubKey, hSessionKey, PRIVATEKEYBLOB,
                                   0, pbExportedKey, &dwSize);
          if (!bResult)
          {
              printf("CryptExportKey failed with %x\n", GetLastError());
              __leave;
          }

          // Create Exported Key File
          hKeyFile = CreateFile(szKeyFile, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
                                FILE_ATTRIBUTE_NORMAL, NULL);
          if (hKeyFile == INVALID_HANDLE_VALUE)
          {
              printf("CreateFile failed with %d\n", GetLastError());
              __leave;
          }

          // Write exported key to file
          bResult = WriteFile(hKeyFile, (LPVOID)pbExportedKey, dwSize, &dwWritten, NULL);
          if (!bResult)
          {
              printf("WriteFile failed with %d\n", GetLastError());
              __leave;
          }

          // Create new crypto context
          bResult = CryptAcquireContext(&hProv,
                            szContainer,
                            szProvider,
                            dwProviderType,
                            CRYPT_DELETEKEYSET | dwAcquireFlags);
          if (!bResult)

          {
              printf("CryptAcquireContext failed with %x\n", GetLastError());
              __leave;
          }

                  bReturn = TRUE;

          printf("Certificate and Key information stored to files\n");
      }
      else
      {
          WCHAR szwStore[20];
          WCHAR szwContainer[160];
          WCHAR szwProvider[260];
          CRYPT_KEY_PROV_INFO CryptKeyProvInfo;
          LPSTR szFile;
          int i;
          DWORD dwWritten;

          if (bSelfSigned)
          {
              szFile = "SelfSigned.cer";
          }
          else
          {
              szFile = "Certificate.cer";
          }

          // Create Certificate file
          hCertFile = CreateFile(szFile, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
                                 FILE_ATTRIBUTE_NORMAL, NULL);
          if (hCertFile == INVALID_HANDLE_VALUE)
          {
              printf("CreateFile failed with %d\n", GetLastError());
              __leave;
          }

          // Write encoded Certificate to file
          bResult = WriteFile(hCertFile, (LPVOID)bpEncodedCert, dwSize, &dwWritten, NULL);
          if (!bResult)
          {
              printf("WriteFile failed with %d\n", GetLastError());
              __leave;
          }

                  printf("File called %s has been saved.\n", szFile);

          // Convert Store string to unicode
          i = MultiByteToWideChar(0, 0, szSubjectStore, -1, szwStore, 20);
          if (i == 0)
          {
              printf("MultiByteToWideChar failed with %d\n", GetLastError());
              __leave;
          }

          i = MultiByteToWideChar(0, 0, szProvider, -1, szwProvider, 260);
          if (i == 0)
          {
             printf("MultiByteToWideChar failed with %d\n", GetLastError());
              __leave;
          }

          // Open Certificate store
          hStore = CertOpenStore(CERT_STORE_PROV_SYSTEM,
                                 ENCODING,
                                 0, dwSubjectFlags, (LPVOID)szwStore);
          if (!hStore)
          {
              printf("CertOpenStore failed with %x\n", GetLastError());
              __leave;
          }

          // Place Certificate in store
          bResult = CertAddEncodedCertificateToStore(hStore, X509_ASN_ENCODING,
                                    bpEncodedCert, dwSize,
                                    CERT_STORE_ADD_REPLACE_EXISTING,
                                    &pCertContext);
          if (!bResult)
          {
              printf("CertAddEncodedCertificateToStore failed with %x\n", GetLastError());
              __leave;
          }

          // Convert container to unicode
          i = MultiByteToWideChar(0, 0, szContainer, -1, szwContainer, 160);
          if (i == 0)
          {
              printf("MultiByteToWideChar failed with %d\n", GetLastError());
              __leave;
          }

          // Initialize CRYPT_KEY_PROV_INFO structure
          ZeroMemory(&CryptKeyProvInfo, sizeof(CryptKeyProvInfo));
          CryptKeyProvInfo.pwszContainerName = szwContainer;
          CryptKeyProvInfo.pwszProvName = szwProvider;
          CryptKeyProvInfo.dwProvType = dwProviderType;
          CryptKeyProvInfo.dwKeySpec = dwKeyType;

          // Set Certificate's Key Provider info
          bResult = CertSetCertificateContextProperty(pCertContext,
                                        CERT_KEY_PROV_INFO_PROP_ID,
                                        0, (LPVOID)&CryptKeyProvInfo);
          if (!bResult)
          {
              printf("CertSetCertificateContextProperty failed with %x\n", GetLastError());
              __leave;
          }

                  bReturn = TRUE;

          printf("Certificate created successfully and installed\n");
      }
   }
   _finally
   {
      // Clean up
      if (pbNameBlob) HeapFree(hHeap, 0, pbNameBlob);
      if (CertEnhKeyUsage.rgpszUsageIdentifier)
         HeapFree(hHeap, 0, CertEnhKeyUsage.rgpszUsageIdentifier);
      if (PublicKeyInfo) HeapFree(hHeap, 0, PublicKeyInfo);
      if (pbKeyIdentifier) HeapFree(hHeap, 0, pbKeyIdentifier);
      if (SubjectKeyIdentifier) HeapFree(hHeap, 0, SubjectKeyIdentifier);
      if (pbKeyUsage) HeapFree(hHeap, 0, pbKeyUsage);
      if (pbEnhKeyUsage) HeapFree(hHeap, 0, pbEnhKeyUsage);
      if (pbBasicConstraints) HeapFree(hHeap, 0, pbBasicConstraints);
      if (KeyId) HeapFree(hHeap, 0, KeyId);
      if (pbAuthorityKeyId) HeapFree(hHeap, 0, pbAuthorityKeyId);
      if (bpEncodedCert) HeapFree(hHeap, 0, bpEncodedCert);
      if (pbExportedKey) HeapFree(hHeap, 0, pbExportedKey);
      if (szContainer) RpcStringFree(&szContainer);
      if (hCertFile) CloseHandle(hCertFile);
      if (hKeyFile) CloseHandle(hKeyFile);
      if (hPubKey) CryptDestroyKey(hPubKey);
      if (hSessionKey) CryptDestroyKey(hSessionKey);
      if (hHash) CryptDestroyHash(hHash);
      if (hProv) CryptReleaseContext(hProv, 0);
      if (hIssuerProv) CryptReleaseContext(hIssuerProv, 0);
      if (pIssuerCert) CertFreeCertificateContext(pIssuerCert);
      if (pCertContext) CertFreeCertificateContext(pCertContext);
      if (hStore) CertCloseStore(hStore, 0);
   }

   return bReturn;
}

PCCERT_CONTEXT FindCertificate | ( | LPSTR | szCertName,
 |  | LPSTR | szStore,
 |  | DWORD | dwFlags,
 |  | PCRYPT_DATA_BLOB * | KeyId,
 |  | HCRYPTPROV * | hProv,
 |  | LPDWORD | dwKeyType
 | ) |  |

Definition at line 1670 of file CreateCert.c.

{
   HANDLE hHeap = GetProcessHeap();
   PCRYPT_KEY_PROV_INFO KeyProvInfo;
   PCCERT_CONTEXT pCertContext = NULL;
   PCERT_EXTENSION pExtension = NULL;
   HCERTSTORE hStore = 0;
   WCHAR szwStore[20];
   CHAR szContainer[160];
   CHAR szProvider[160];
   BOOL bResult, bSuccess = FALSE;
   DWORD dwSize, dwAcquireFlags = 0;
   int i;

   __try
   {
      *KeyId = NULL;
      *hProv = 0;

      if (dwFlags == CERT_SYSTEM_STORE_LOCAL_MACHINE)
         dwAcquireFlags = CRYPT_MACHINE_KEYSET;

      // Convert Store string to Unicode
      i = MultiByteToWideChar(0, 0, szStore, -1, szwStore, 20);
      if (i == 0)
      {
         __leave;
      }

      // Open Certificate store
      hStore = CertOpenStore(CERT_STORE_PROV_SYSTEM,
                           ENCODING,
                           0, dwFlags, (LPVOID)szwStore);
      if (!hStore)
      {
         __leave;
      }

      // Find Certificate with Subject name
      pCertContext = CertFindCertificateInStore(hStore,
                              ENCODING,
                              0, CERT_FIND_SUBJECT_STR_A,
                              (LPVOID)szCertName, NULL);
      if (pCertContext)
      {
         // Get Key Provider Info size
         bResult = CertGetCertificateContextProperty(pCertContext,
                                             CERT_KEY_PROV_INFO_PROP_ID,
                                             NULL,
                                             &dwSize);
         if (!bResult)
         {
            __leave;
         }

         // Allocate Key Provider Info
         KeyProvInfo = (PCRYPT_KEY_PROV_INFO)HeapAlloc(hHeap, 0, dwSize);
         if (!KeyProvInfo)
         {
            __leave;
         }

         // Get Key Provider Info
         bResult = CertGetCertificateContextProperty(pCertContext,
                                             CERT_KEY_PROV_INFO_PROP_ID,
                                             (LPVOID)KeyProvInfo,
                                             &dwSize);
         if (!bResult)
         {
            __leave;
         }

         // Convert Container Name to ANSI
         i = WideCharToMultiByte(0, 0, KeyProvInfo->pwszContainerName,
                                 -1, szContainer, 160, NULL, NULL);
         if (i == 0)
         {
            __leave;
         }

         // Convert Provider Name to ANSI
         i = WideCharToMultiByte(0, 0, KeyProvInfo->pwszProvName, -1,
                                 szProvider, 160, NULL, NULL);
         if (i == 0)
         {
            __leave;
         }

         // Get Crypto Context of Certificate
         bResult = CryptAcquireContext(hProv, szContainer, szProvider,
                                       KeyProvInfo->dwProvType, dwAcquireFlags);
         if (!bResult)
         {
            __leave;
         }

         // Return Key Spec
         *dwKeyType = KeyProvInfo->dwKeySpec;

         bSuccess = TRUE;

         // Find Subject Key Identifier Extension
         pExtension = CertFindExtension(szOID_SUBJECT_KEY_IDENTIFIER,
                                        pCertContext->pCertInfo->cExtension,
                                        pCertContext->pCertInfo->rgExtension);

         // If Subject Key Identifier Extension Exists
         if (pExtension)
         {

            // Get Size of Data Blob
            bResult = CryptDecodeObject(ENCODING,
                                        szOID_SUBJECT_KEY_IDENTIFIER,
                                        pExtension->Value.pbData,
                                        pExtension->Value.cbData,
                                        0, NULL, &dwSize);
            if (!bResult)
            {
               __leave;
            }

            // Allocate Data Blob
            *KeyId = (PCRYPT_DATA_BLOB)HeapAlloc(hHeap, 0, dwSize);
            if (!(*KeyId))
            {
               __leave;
            }

            // Get Key Identifier Data Blob
            bResult = CryptDecodeObject(ENCODING,
                                        szOID_SUBJECT_KEY_IDENTIFIER,
                                        pExtension->Value.pbData,
                                        pExtension->Value.cbData,
                                        0, (LPVOID)*KeyId, &dwSize);
            if (!bResult)
            {
               __leave;
            }
         }
      }
      else
      {
         __leave;
      }

      bSuccess = TRUE;
   }
   __finally
   {
      // Clean up
      if (hStore) CertCloseStore(hStore, 0);
      if (KeyProvInfo) HeapFree(hHeap, 0, KeyProvInfo);
      if (!bSuccess)
      {
         if (pCertContext) CertFreeCertificateContext(pCertContext);
         pCertContext = NULL;
         if (*KeyId) HeapFree(hHeap, 0, *KeyId);
         *KeyId = NULL;
      }
   }

   return pCertContext;
}

BOOL ImportCertificate | ( | LPSTR | szCertFile,
 |  | LPSTR | szKeyFile,
 |  | LPSTR | szPassword,
 |  | LPSTR | szStore,
 |  | BOOL | bUser,
 |  | DWORD | dwProviderNum
 | ) |  |

Definition at line 326 of file CreateCert.c.

{
   LPSTR szContainer = NULL;
   HCRYPTPROV hProv = 0;
   HCRYPTHASH hHash = 0;
   HCERTSTORE hStore = NULL;
   HCRYPTKEY hKey = 0;
   HCRYPTKEY hPubKey = 0;
   HANDLE hFile = INVALID_HANDLE_VALUE;
   LPBYTE pbEncodedCert = NULL;
   LPBYTE pbEncodedKey = NULL;
   PCCERT_CONTEXT pCertContext = NULL;
   CRYPT_KEY_PROV_INFO CertKeyInfo;
   BOOL fReturn = FALSE;
   RPC_STATUS Status;
   HANDLE hHeap;
   UUID Uuid;
   BOOL bResult;
   DWORD dwSize, dwRead;
   WCHAR szwStore[20];
   DWORD dwAcquireFlags = 0;
   DWORD dwCertOpenFlags = CERT_SYSTEM_STORE_CURRENT_USER;
   CHAR szProvider[260] = { MS_DEF_PROV };
   DWORD dwProviderType = PROV_RSA_FULL;
   int i;

   __try
   {
     if (!bUser)
     {
        dwAcquireFlags = CRYPT_MACHINE_KEYSET;
        dwCertOpenFlags = CERT_SYSTEM_STORE_LOCAL_MACHINE;
     }

     dwSize = 260;
     bResult = MyCryptEnumProviders(dwProviderNum,
                                    NULL,
                                    0,
                                    &dwProviderType,
                                    szProvider,
                                    &dwSize);
     if (!bResult)
     {
        printf("Unable to get provider\n");
        __leave;
     }

     // Get process heap
     hHeap = GetProcessHeap();

     // Open Key File
     hFile = CreateFile(szKeyFile,
                      GENERIC_READ,
                      0,
                      NULL,
                      OPEN_EXISTING,
                      FILE_ATTRIBUTE_NORMAL,
                      NULL);
     if (hFile == INVALID_HANDLE_VALUE)
     {
         printf("Unable to open key file\n");
         __leave;
     }

     // Get file length
     dwSize = GetFileSize(hFile, NULL);
     if (dwSize == 0xFFFFFFFF)
     {
       printf("Unable to get size of certificate file\n");
       __leave;
     }

     // Allocate memory for encoded key
     pbEncodedKey = (LPBYTE)HeapAlloc(hHeap, 0, dwSize);
     if (!pbEncodedKey)
     {
       printf("Unable to allocate memory for encoded key\n");
       __leave;
     }

     // Read encoded key data
     bResult = ReadFile(hFile,
                    (LPVOID)pbEncodedKey,
                    dwSize,
                    &dwRead,
                    NULL);
     if (!bResult)
     {
       printf("Unable to read encoded key\n");
       __leave;
     }

     // Close file handle
     CloseHandle(hFile);
     hFile = INVALID_HANDLE_VALUE;

     {
        HCRYPTPROV hTemp;

        // Create Temporary Provider
        bResult = CryptAcquireContext(&hTemp,
                                      "Temp000",
                                      MS_DEF_PROV,
                                      PROV_RSA_FULL,
                                      CRYPT_NEWKEYSET);
        if (!bResult)
        {
           // If Temporary Provider exists already,
           // open it
           if (GetLastError() == NTE_EXISTS)
           {
              bResult = CryptAcquireContext(&hTemp,
                                          "Temp000",
                                          MS_DEF_PROV,
                                          PROV_RSA_FULL,
                                          0);
              if (!bResult)
              {
                 printf("Unable to get temporary provider handle\n");
                 __leave;
              }
           }
           else
           {
              printf("Unable to create temporary provider handle\n");
              __leave;
           }
        }

        // Place random data in Uuid
        // Could have used UuidCreate but it is not supported
        // under Win9x.
        bResult = CryptGenRandom(hTemp, sizeof(Uuid), (LPBYTE)&Uuid);
        if (!bResult)
        {
           printf("CryptGenRandom failed with %x\n", GetLastError());
           __leave;
        }

        // Close Provider handle
        CryptReleaseContext(hTemp, 0);

        // Delete Container
        CryptAcquireContext(&hTemp,
                           "Temp000",
                           MS_DEF_PROV,
                           PROV_RSA_FULL,
                           CRYPT_DELETEKEYSET);

        // Create a random uuid
        /*Status = UuidCreate(&Uuid);
        if (Status != RPC_S_OK)
        {
          printf("Unable to create random container\n");
          __leave;
        }*/

        // convert random uuid to a string, we will use it as a container
        Status = UuidToString(&Uuid, &szContainer);
        if (Status != RPC_S_OK)
        {
          printf("Unable to convert uuid to string\n");
          __leave;
        }
     }

     // Create new crypto context
     bResult = CryptAcquireContext(&hProv,
                            szContainer,
                            szProvider,
                            dwProviderType,
                            CRYPT_NEWKEYSET | dwAcquireFlags);
     if (!bResult)
     {
       printf("CryptAcquireContext failed with %x\n", GetLastError());
       __leave;
     }

     // Create Hash to hash password
     bResult = CryptCreateHash(hProv, CALG_SHA1, 0, 0, &hHash);
     if (!bResult)
     {
       printf("CryptCreateHash failed with %x\n", GetLastError());
       __leave;
     }

     // Hash Password
     bResult = CryptHashData(hHash, (LPBYTE)szPassword, (DWORD)strlen(szPassword), 0);
     if (!bResult)
     {
       printf("CryptHashData failed with %x\n", GetLastError());
       __leave;
     }

     // Derive Session Key from password hash
     bResult = CryptDeriveKey(hProv, CALG_RC4, hHash, CRYPT_EXPORTABLE, &hKey);
     if (!bResult)
     {
       printf("CryptDeriveKey failed with %x\n", GetLastError());
       __leave;
     }

     // Import Private/Public Key into Provider
     bResult = CryptImportKey(hProv, pbEncodedKey, dwSize, hKey,
                        CRYPT_EXPORTABLE, &hPubKey);
     if (!bResult)
     {
       printf("CryptImportKey failed with %x\n", GetLastError());
       __leave;
     }

     // Open Certificate file
     hFile = CreateFile(szCertFile,
                   GENERIC_READ,
                   0,
                   NULL,
                   OPEN_EXISTING,
                   FILE_ATTRIBUTE_NORMAL,
                   NULL);
     if (hFile == INVALID_HANDLE_VALUE)
     {
       printf("Unable to open certificate file\n");
       __leave;
     }

     // Get file length
     dwSize = GetFileSize(hFile, NULL);
     if (dwSize == 0xFFFFFFFF)
     {
       printf("Unable to get size of certificate file\n");
       __leave;
     }

     // Allocate memory for encoded certificate
     pbEncodedCert = (LPBYTE)HeapAlloc(hHeap, 0, dwSize);
     if (!pbEncodedCert)
     {
       printf("Unable to allocate memory for encoded certificate\n");
       __leave;
     }

     // Read encoded certificate data
     bResult = ReadFile(hFile,
                    (LPVOID)pbEncodedCert,
                    dwSize,
                    &dwRead,
                    NULL);
     if (!bResult)
     {
       printf("Unable to read encoded certificate\n");
       __leave;
     }

     // Close file handle
     CloseHandle(hFile);
     hFile = INVALID_HANDLE_VALUE;

     // Convert multibyte store name to wide char string
     if (mbstowcs(szwStore, szStore, strlen(szStore)+1) == (size_t)-1)
     {
       printf("Unable to convert store to Unicode string\n");
       __leave;
     }

     // Open Certificate Store
     hStore = CertOpenStore(CERT_STORE_PROV_SYSTEM,
                      ENCODING,
                      0,
                      dwCertOpenFlags,
                      (LPVOID)szwStore);
     if (!hStore)
     {
       printf("CertOpenStore failed with %x\n", GetLastError());
       __leave;
     }

     // Add Certificate to store
     bResult = CertAddEncodedCertificateToStore(hStore,
                                     X509_ASN_ENCODING,
                                     pbEncodedCert,
                                     dwSize,
                                     CERT_STORE_ADD_REPLACE_EXISTING,
                                     &pCertContext);
     if (!bResult)
     {
       printf("CertAddEncodedCertificateToStore failed with %x\n", GetLastError());
       __leave;
     }

     {
        WCHAR szwContainer[160];
        WCHAR szwProvider[260];

        i = (int)mbstowcs(szwContainer, szContainer, (size_t)(sizeof(szContainer)+1));
        if (i == 0)
        {
            printf("MultiByteToWideChar failed with %d\n", GetLastError());
            __leave;
        }

        i = MultiByteToWideChar(0, 0, szProvider, -1, szwProvider, 260);
        if (i == 0)
        {
            printf("MultiByteToWideChar failed with %d\n", GetLastError());
            __leave;
        }

        ZeroMemory(&CertKeyInfo, sizeof(CertKeyInfo));
        CertKeyInfo.pwszContainerName = szwContainer;
        CertKeyInfo.pwszProvName = szwProvider;
        CertKeyInfo.dwProvType = dwProviderType;

        bResult = CryptGetKeyParam(hPubKey, KP_ALGID, (LPBYTE)&CertKeyInfo.dwKeySpec,
                            &dwSize, 0);
        if (!bResult)
        {
          printf("CryptGetKeyParam failed with %x\n", GetLastError());
          __leave;
        }

        // Set Key property for Certificate
        bResult = CertSetCertificateContextProperty(pCertContext,
                                         CERT_KEY_PROV_INFO_PROP_ID,
                                         0,
                                         (LPVOID)&CertKeyInfo);
        if (!bResult)
        {
          printf("CertSetCertificateContextProperty failed with %x\n", GetLastError());
          __leave;
        }
     }

     fReturn = TRUE;
   }
   _finally
   {
     // Clean up
     if (szContainer) RpcStringFree(&szContainer);
     if (hHash) CryptDestroyHash(hHash);
     if (hKey) CryptDestroyKey(hKey);
     if (hPubKey) CryptDestroyKey(hPubKey);
     if (hProv) CryptReleaseContext(hProv, 0);
     if (hFile != INVALID_HANDLE_VALUE) CloseHandle(hFile);
     if (pbEncodedCert) HeapFree(hHeap, 0, pbEncodedCert);
     if (pbEncodedKey) HeapFree(hHeap, 0, pbEncodedKey);
     if (pCertContext) CertFreeCertificateContext(pCertContext);
     if (hStore) CertCloseStore(hStore, 0);
   }

   return fReturn;
}

int main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 76 of file CreateCert.c.

{
   BOOL bResult;
   DWORD dwUsage = 0;
   DWORD dwKeyType = AT_KEYEXCHANGE;
   DWORD dwProvNum = 0;
   LPSTR szSigAlg = g_szSigAlg[1];
   BOOL bExport = FALSE;
   BOOL bSelfSigned = TRUE;
   BOOL bIssuerUser = TRUE;
   BOOL bSubjectUser = TRUE;
   BOOL bUseProv = FALSE;
   LPSTR szX509 = NULL;
   LPSTR szSubjectStore = g_szMyStore;
   LPSTR szIssuerStore = g_szMyStore;
   LPSTR szIssuerName = g_szEmpty;
   LPSTR szCertFile = g_szEmpty;
   LPSTR szKeyFile = g_szEmpty;
   LPSTR szPassword = g_szEmpty;
   WORD wMonths = 0;
   BOOL bCA = FALSE;
   int n;

   // Print Usage
   if (argc < 2)
   {
     PrintUsage();
     return 0;
   }

   // User wants to import a certificate
   if (strcmpi(argv[1], "-i") == 0)
   {
      BOOL bUser;
      DWORD num;

      if (argc != 8)
      {
         PrintUsage();
         return 0;
      }

      if (strcmpi(argv[6], "m") == 0)
         bUser = FALSE;
      else
         bUser = TRUE;

      num = (DWORD)atoi(argv[7]);

      bResult = ImportCertificate(argv[2],
                                argv[3],
                                argv[4],
                                argv[5],
                                bUser,
                                num);
      if (!bResult)
      {
         printf("Unable to Import Certificate\n");
         return 0;
      }
      else
      {
         printf("Certificate Imported successfully\n");
         return 1;
      }
   }

   // Set X509 Name
   szX509 = argv[1];

   // Parse rest of the options
   n = 2;
   while (n < argc)
   {
    // User selected Key Type
    if (strcmpi(argv[n], "-k") == 0)
    {
      if ((n+1) < argc)
      {
         if (strcmpi(argv[++n], "s") == 0)
           dwKeyType = AT_SIGNATURE;
         else
           dwKeyType = AT_KEYEXCHANGE;
      }
      else
      {
         PrintUsage();
         return 0;
      }
    }

    // User set number of months
    if (strcmpi(argv[n], "-m") == 0)
    {
       if ((n+1) < argc)
       {
          wMonths = (WORD)atoi(argv[++n]);
       }
       else
       {
          PrintUsage();
          return 0;
       }
    }

    // User wants this to be a CA.  Indicated in
    // Basic contraints
    if (strcmpi(argv[n], "-ca") == 0)
    {
       bCA = TRUE;
    }

    // User wants to set Enhanced Key usage extension
    if (strcmpi(argv[n], "-u") == 0)
    {
      if ((n+1) < argc)
      {
         dwUsage = (DWORD)atoi(argv[++n]);
      }
      else
      {
         PrintUsage();
         return 0;
      }
    }

    // User wants to set the Crypto Provider
    if (strcmpi(argv[n], "-p") == 0)
    {
       if ((n+1) < argc)
       {
          bUseProv = TRUE;
          dwProvNum = (DWORD)atoi(argv[++n]);
       }
       else
       {
          PrintUsage();
          return 0;
       }
    }

    // User selected signature algorithm
    if (strcmpi(argv[n], "-s") == 0)
    {
       if ((n+1) < argc)
       {
          if (strcmpi(argv[++n], "md5") == 0)
             szSigAlg = g_szSigAlg[0];
          else
             szSigAlg = g_szSigAlg[1];
       }
       else
       {
          PrintUsage();
          return 0;
       }
    }

    // User selected the Subject Location
    if (strcmpi(argv[n], "-sl") == 0)
    {
       if ((n+2) < argc)
       {
          bExport = FALSE;
          szSubjectStore = argv[++n];
          if (strcmpi(argv[++n], "m") == 0)
             bSubjectUser = FALSE;
          else
             bSubjectUser = TRUE;
       }
       else
       {
          PrintUsage();
          return 0;
       }
    }

    // User wants to export the Certificate
    if (strcmpi(argv[n], "-ex") == 0)
    {
       if ((n+3) < argc)
       {
          bExport = TRUE;
          szCertFile = argv[++n];
          szKeyFile = argv[++n];
          szPassword = argv[++n];
       }
       else
       {
          PrintUsage();
          return 0;
       }
    }

    // User has selected an issuer
    if (strcmpi(argv[n], "-is") == 0)
    {
       if ((n+3) < argc)
       {
          bSelfSigned = FALSE;
          szIssuerName = argv[++n];
          szIssuerStore = argv[++n];
          if (strcmpi(argv[++n], "m") == 0)
             bIssuerUser = FALSE;
          else
             bIssuerUser = TRUE;
       }
       else
       {
          PrintUsage();
          return 0;
       }
    }

    n++;
   }

   // Create Certificate
   bResult = CreateCertificate(
                     szX509,        // Certificate Name
                     dwKeyType,     // Key Type
                     szSigAlg,      // Signature Algorithm
                     wMonths,       // Number of Months
                     dwUsage,       // Enhanced Key Usage
                     bCA,           // CA or not
                     bUseProv,      // Use dwProvNum
                     dwProvNum,     // Provider Number
                     szSubjectStore,// Certificate Store
                     bSubjectUser,  // User or Machine flag
                     bSelfSigned,   // Self Signed flag
                     szIssuerName,  // Issuer of Certificate
                     szIssuerStore, // Store of Issuer
                     bIssuerUser,   // User or Machine flag
                     bExport,       // Export flag
                     szCertFile,    // Certificate File
                     szKeyFile,     // Key File
                     szPassword);   // Password for Key File
   if (!bResult)
   {
     printf("Unable to create certificate\n");
   }

   return 1;
}

BOOL WINAPI MyCryptEnumProviders | ( | DWORD | dwIndex,
 |  | LPDWORD | Res,
 |  | DWORD | dwFlags,
 |  | LPDWORD | pdwProvType,
 |  | LPTSTR | szProvName,
 |  | LPDWORD | pcbProvName
 | ) |  |

Definition at line 1839 of file CreateCert.c.

{
    static LPTSTR szKeyPath = TEXT("SOFTWARE\\Microsoft\\Cryptography\\Defaults\\Provider");
    BOOL bResult = TRUE;
    DWORD dwNumKeys;
    HKEY hKey = NULL;
    HKEY hSubKey = NULL;
    LONG lResult;
    FILETIME ft;

    __try
    {
       // Open registry provider registry key
        lResult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, szKeyPath, 0, KEY_READ, &hKey);
        if (lResult != ERROR_SUCCESS)
        {
            bResult = FALSE;
            __leave;
        }

        if (szProvName == NULL)
        {
           // Query for Number of Keys and Size maximum size of
           // provider
           lResult = RegQueryInfoKey(hKey, NULL, NULL, NULL, &dwNumKeys, pcbProvName,
                                     NULL, NULL, NULL, NULL, NULL, NULL);
           if (lResult != ERROR_SUCCESS)
           {
              bResult = FALSE;
              __leave;
           }

           // return Size of Provider Name
           *pcbProvName = (*pcbProvName + 1) * sizeof(TCHAR);

           if (dwIndex >= dwNumKeys) return FALSE;
        }
        else
        {
           DWORD dwSize;
           DWORD dwType;

           // Get Provider by Index
           dwSize = *pcbProvName/sizeof(TCHAR);
           lResult = RegEnumKeyEx(hKey, dwIndex, szProvName, &dwSize, NULL, NULL, NULL, &ft);
           if (lResult != ERROR_SUCCESS)
           {
              bResult = FALSE;
              __leave;
           }

           *pcbProvName = (dwSize + 1) * sizeof(TCHAR);

           // Open the Provider Registry Key
           lResult = RegOpenKeyEx(hKey, szProvName, 0, KEY_READ, &hSubKey);
           if (lResult != ERROR_SUCCESS)
           {
              bResult = FALSE;
              __leave;
           }

           // Get Provider Type
           dwSize = sizeof(DWORD);
           lResult = RegQueryValueEx(hSubKey, TEXT("Type"), NULL, &dwType, (LPBYTE)pdwProvType, &dwSize);
           if (lResult != ERROR_SUCCESS)
           {
              bResult = FALSE;
              __leave;
           }
        }
    }
    __finally
    {
       // Clean up
       if (hKey != NULL) RegCloseKey(hKey);
       if (hSubKey != NULL) RegCloseKey(hSubKey);
    }

    return bResult;
}

void PrintUsage ( void )

Definition at line 1925 of file CreateCert.c.

{
   DWORD nIndex = 0;
   DWORD dwProvType, dwSize;
   CHAR szProvider[160];

   printf("\nUsage: CreateCert [Import option] <X509 Name> [Options]\n");
   printf("\n[Import option] : If this option is present, everything else is ignored\n");
   printf("\t-i <cert file> <public key file> <password> <store> <u>ser|<m>achine <provider num>\n");
   printf("\n<X509 Name> (eg. CN=Certificate)\n");
   printf("\n[Options]\n");
   printf("Type of Certificate:\n");
   printf("\t-p <provider number> - default: MS_DEF_PROV\n");
   printf("\t-k <e>xchange key | <s>ignature key - default:exchange\n");
   printf("\t-s <sha>|<md5> - default:sha\n");
   printf("\t-m <number of months of validity>\n");
   printf("\t-ca - indicates that the certificate is to be a CA. True for selfsigned\n");
   printf("\t-u <enhanced key usage number> - add following numbers\n");
   printf("\t\tServer Authentication : 1\n");
   printf("\t\tClient Authentication : 2\n");
   printf("\t\tCode Signing          : 4\n");
   printf("\t\tEmail Protection      : 8\n");
   printf("\t\tTime Stamping         : 16\n");
   printf("\nLocation of Certificate:\n");
   printf("\t-sl <store> <u>ser|<m>achine - default:my u\n");
   printf("\t\tor\n");
   printf("\t-ex <cert file> <public key file> <password>\n");
   printf("\nSigner of the certificate - defaults to self-signed if -is is not present\n");
   printf("\t-is <CommonName or substring> <store> <u>ser|<m>achine\n");

   printf("\nProviders:\n");
   dwSize = 160;
   while (MyCryptEnumProviders(nIndex, NULL, 0, &dwProvType, szProvider, &dwSize))
   {
      printf("\t%d : %s\n", nIndex, szProvider);
      dwSize = 160;
      nIndex++;
   }

   printf("\nSelf-Signed Certificates create a file called SelfSigned.cer\n");
   printf("Non Self-Signed Certificates create a file called Certificate.cer\n");
}

Variable Documentation

ENHKEYUSAGE g_EnhKeyUsage
Initial value:
{
   KEY_USAGE_SIZE,
   {
      szOID_PKIX_KP_SERVER_AUTH,
      szOID_PKIX_KP_CLIENT_AUTH,
      szOID_PKIX_KP_CODE_SIGNING,
      szOID_PKIX_KP_EMAIL_PROTECTION,
      szOID_PKIX_KP_TIMESTAMP_SIGNING
   },
   { 1, 2, 4, 8, 16}
}

Definition at line 54 of file CreateCert.c.

LPSTR g_szEmpty = ""

Definition at line 74 of file CreateCert.c.

LPSTR g_szMyStore = "MY"

Definition at line 73 of file CreateCert.c.

LPSTR g_szSigAlg[]
Initial value:
 {
   szOID_RSA_MD5RSA,
   szOID_RSA_SHA1RSA
}

Definition at line 67 of file CreateCert.c.

Generated on Wed Nov 13 2024 16:54:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CryptoApi/CreateCert/CreateCert.h File Reference

  • Security
  • CryptoApi
  • CreateCert
Functions

CreateCert.h File Reference

Go to the source code of this file.

Functions

BOOL | CreateCertificate (LPSTR szX509, DWORD dwKeyType, LPSTR szSigAlg, WORD wMonths, DWORD dwCertEnhKeyUsage, BOOL bCA, BOOL bUseProv, DWORD dwProviderNum, LPSTR szSubjectStore, BOOL bSubjectUser, BOOL bSelfSigned, LPSTR szIssuerName, LPSTR szIssuerStore, BOOL bIssuerUser, BOOL bExport, LPSTR szCertFile, LPSTR szKeyFile, LPSTR szPassword)
PCCERT_CONTEXT | FindCertificate (LPSTR szCertName, LPSTR szStore, DWORD dwFlags, PCRYPT_DATA_BLOB *KeyId, HCRYPTPROV *hProv, LPDWORD dwKeyType)
BOOL | ImportCertificate (LPSTR szCertFile, LPSTR szKeyFile, LPSTR szPassword, LPSTR szStore, BOOL bUser, DWORD dwProviderNum)
BOOL WINAPI | MyCryptEnumProviders (DWORD dwIndex, LPDWORD Res, DWORD dwFlags, LPDWORD pdwProvType, LPTSTR szProvName, LPDWORD pcbProvName)
void | PrintUsage (void)

Function Documentation

BOOL CreateCertificate | ( | LPSTR | szX509,
 |  | DWORD | dwKeyType,
 |  | LPSTR | szSigAlg,
 |  | WORD | wMonths,
 |  | DWORD | dwCertEnhKeyUsage,
 |  | BOOL | bCA,
 |  | BOOL | bUseProv,
 |  | DWORD | dwProviderNum,
 |  | LPSTR | szSubjectStore,
 |  | BOOL | bSubjectUser,
 |  | BOOL | bSelfSigned,
 |  | LPSTR | szIssuerName,
 |  | LPSTR | szIssuerStore,
 |  | BOOL | bIssuerUser,
 |  | BOOL | bExport,
 |  | LPSTR | szCertFile,
 |  | LPSTR | szKeyFile,
 |  | LPSTR | szPassword
 | ) |  |

Definition at line 679 of file CreateCert.c.

{
   BOOL bReturn = FALSE;
   BOOL bResult;
   LPBYTE pbNameBlob = NULL;
   LPSTR szContainer = NULL;
   RPC_STATUS Status;
   HCRYPTPROV hProv = 0;
   HCRYPTPROV hIssuerProv = 0;
   HCRYPTKEY hPubKey = 0;
   HCRYPTKEY hSessionKey = 0;
   HCRYPTHASH hHash = 0;
   HCERTSTORE hStore = 0;
   HANDLE hCertFile = INVALID_HANDLE_VALUE;
   HANDLE hKeyFile = INVALID_HANDLE_VALUE;
   PCRYPT_DATA_BLOB KeyId = NULL;
   PCERT_PUBLIC_KEY_INFO PublicKeyInfo = NULL;
   PCCERT_CONTEXT pIssuerCert = NULL;
   PCCERT_CONTEXT pCertContext = NULL;
   LPBYTE pbKeyIdentifier = NULL;
   LPBYTE SubjectKeyIdentifier = NULL;
   LPBYTE pbKeyUsage = NULL;
   LPBYTE pbEnhKeyUsage = NULL;
   LPBYTE pbBasicConstraints = NULL;
   LPBYTE pbAuthorityKeyId = NULL;
   LPBYTE bpEncodedCert = NULL;
   LPBYTE pbExportedKey = NULL;
   CERT_ENHKEY_USAGE CertEnhKeyUsage = { 0, NULL };
   BYTE SerialNumber[8];
   CERT_BASIC_CONSTRAINTS2_INFO BasicConstraints;
   CERT_AUTHORITY_KEY_ID_INFO AuthorityKeyId;
   BYTE ByteData;
   CRYPT_BIT_BLOB KeyUsage;
   CERT_EXTENSION CertExtension[5];
   CRYPT_DATA_BLOB CertKeyIdentifier;
   CERT_NAME_BLOB IssuerName;
   HANDLE hHeap = GetProcessHeap();
   CERT_INFO CertInfo;
   DWORD dwSize, m, q;
   DWORD dwAcquireFlags, dwIssuerKeyType;
   DWORD dwIssuerFlags, dwSubjectFlags;
   FILETIME ftTime;
   SYSTEMTIME stTime;
   CHAR szProvider[260] = { MS_DEF_PROV };
   DWORD dwProviderType = PROV_RSA_FULL;
   BOOL bAddAuthorityExtension = FALSE;

   __try
   {
      // Enumerate Provider
      if (bUseProv)
      {
         dwSize = 260;
         bResult = MyCryptEnumProviders(
                           dwProviderNum,
                           NULL,
                           0,
                           &dwProviderType,
                           szProvider,
                           &dwSize);
         if (!bResult)
         {
            printf("Unable to get provider\n");
            __leave;
         }

      }

      if (bSubjectUser)
      {
         // Certificate will be in the User store and
         // key container will be a User container
         dwAcquireFlags = 0;
         dwSubjectFlags = CERT_SYSTEM_STORE_CURRENT_USER;
      }
      else
      {
         // Certificate will be in the Machine store and
         // key container will be a Mahince container
         dwAcquireFlags = CRYPT_MACHINE_KEYSET;
         dwSubjectFlags = CERT_SYSTEM_STORE_LOCAL_MACHINE;
      }

      if (bIssuerUser)
      {
         // Get Issuer Certificate from User store
         dwIssuerFlags = CERT_SYSTEM_STORE_CURRENT_USER;
      }
      else
      {
         // Get Issuer Certificate from Machine store
         dwIssuerFlags = CERT_SYSTEM_STORE_LOCAL_MACHINE;
      }

      // Get X509 Name and convert it to a Name Blob
      bResult = CertStrToName(X509_ASN_ENCODING,
                          szX509,
                          CERT_X500_NAME_STR,
                          NULL,
                          NULL,
                          &dwSize,
                          NULL);
      if (!bResult)
      {
         printf("CertStrToName failed with %x\n", GetLastError());
         __leave;
      }

      // Allocate memory for Name Blob
      pbNameBlob = (LPBYTE)HeapAlloc(hHeap, 0, dwSize);
      if (!pbNameBlob)
      {
         printf("Unable to allocate memory for name blob\n");
         __leave;
      }

      // Convert X509 Name to Name Blob
      bResult = CertStrToName(X509_ASN_ENCODING,
                          szX509,
                          CERT_X500_NAME_STR,
                          NULL,
                          (LPBYTE)pbNameBlob,
                          &dwSize,
                          NULL);
      if (!bResult)
      {
         printf("CertStrToName failed with %x\n", GetLastError());
         __leave;
      }

      IssuerName.cbData = dwSize;
      IssuerName.pbData = pbNameBlob;

      // Convert Enhanced Key usage number to
      // Enhanced Key Usage extension

      // Find Enhanced Key Usage extensions count
      for (m = 0; m < g_EnhKeyUsage.dwCount; m++)
      {
        if ((g_EnhKeyUsage.dwValue[m] & dwUsage) == g_EnhKeyUsage.dwValue[m])
        {
          CertEnhKeyUsage.cUsageIdentifier++;
        }
      }

      // If extensions exist continue
      if (CertEnhKeyUsage.cUsageIdentifier != 0)
      {
         // Allocate memory for Enhanced Key Usage array
         CertEnhKeyUsage.rgpszUsageIdentifier =
             (LPSTR *)HeapAlloc(hHeap, 0, CertEnhKeyUsage.cUsageIdentifier * sizeof(LPSTR));
         if (!CertEnhKeyUsage.rgpszUsageIdentifier)
         {
           printf("Unable to allocate memory for Enhanced Usage array\n");
           __leave;
         }

         // Initialize Enhanced Key Usage array to NULL
         for (m = 0; m < CertEnhKeyUsage.cUsageIdentifier; m++)
         {
           CertEnhKeyUsage.rgpszUsageIdentifier[m] = NULL;
         }

         // Add proper extension OID to array
         q = 0;
         for (m = 0; m < g_EnhKeyUsage.dwCount; m++)
         {
           if ((g_EnhKeyUsage.dwValue[m] & dwUsage) == g_EnhKeyUsage.dwValue[m])
           {
             CertEnhKeyUsage.rgpszUsageIdentifier[q++] = g_EnhKeyUsage.szUsage[m];
           }
         }
      }

      // Create Crypto Context

      {
         UUID Uuid;
         HCRYPTPROV hTemp;

         // Create Temporary Provider
         bResult = CryptAcquireContext(&hTemp,
                                       "Temp000",
                                       MS_DEF_PROV,
                                       PROV_RSA_FULL,
                                       CRYPT_NEWKEYSET);
         if (!bResult)
         {
            // If Temporary Provider exists already,
            // open it
            if (GetLastError() == NTE_EXISTS)
            {
               bResult = CryptAcquireContext(&hTemp,
                                          "Temp000",
                                          MS_DEF_PROV,
                                          PROV_RSA_FULL,
                                          0);
               if (!bResult)
               {
                  printf("Unable to get temporary provider handle\n");
                  __leave;
               }
            }
            else
            {
               printf("Unable to create temporary provider handle\n");
               __leave;
            }
         }

         // Place random data in Uuid
         // Could have used UuidCreate but it is not supported
         // under Win9x.
         bResult = CryptGenRandom(hTemp, sizeof(Uuid), (LPBYTE)&Uuid);
         if (!bResult)
         {
            printf("CryptGenRandom failed with %x\n", GetLastError());
            __leave;
         }

         // Close Provider handle
         CryptReleaseContext(hTemp, 0);

         // Delete Container
         CryptAcquireContext(&hTemp,
                           "Temp000",
                           MS_DEF_PROV,
                           PROV_RSA_FULL,
                           CRYPT_DELETEKEYSET);

         // Create a random uuid
         /*Status = UuidCreate(&Uuid);
         if (Status != RPC_S_OK)
         {
            printf("Unable to create random container\n");
            __leave;
         }*/

         // convert random uuid to a string, we will use it as a container
         Status = UuidToString(&Uuid, &szContainer);
         if (Status != RPC_S_OK)
         {
            printf("Unable to convert uuid to string\n");
            __leave;
         }

         // Create new crypto context
         bResult = CryptAcquireContext(&hProv,
                            szContainer,
                            szProvider,
                            dwProviderType,
                            CRYPT_NEWKEYSET | dwAcquireFlags);
         if (!bResult)
         {
            printf("CryptAcquireContext failed with %x\n", GetLastError());
            __leave;
         }
      }

      // Generate Private/Public key pair
      bResult = CryptGenKey(hProv, dwKeyType, CRYPT_EXPORTABLE, &hPubKey);
      if (!bResult)
      {
         printf("CryptGenKey failed with %x\n", GetLastError());
         __leave;
      }

      // Zero CERT_INFO structure
      ZeroMemory(&CertInfo, sizeof(CertInfo));

      // Set Version of Certificate
      CertInfo.dwVersion = CERT_V3;

      // Create Random Serial Number
      bResult = CryptGenRandom(hProv, 8, SerialNumber);
      if (!bResult)
      {
         printf("CryptGenRandom failed with %x\n", GetLastError());
         __leave;
      }

      // Set Serial Number of Certificate
      CertInfo.SerialNumber.cbData = 8;
      CertInfo.SerialNumber.pbData = SerialNumber;

      // Set Signature Algorithm of Certificate
      CertInfo.SignatureAlgorithm.pszObjId = szSigAlg;

      // set NotBefore date
      GetSystemTime(&stTime);
      SystemTimeToFileTime(&stTime, &ftTime);
      CertInfo.NotBefore = ftTime;

      if (wMonths == 0)
      {
         if (bSelfSigned)
            wMonths = 24;
         else
            wMonths = 6;
      }

      //
      // Set After Date
      //
      stTime.wMonth += wMonths;
      if ((stTime.wMonth / 12) > 0)
      {
         stTime.wYear += (stTime.wMonth / 12);
         stTime.wMonth = (stTime.wMonth % 12);
      }

      SystemTimeToFileTime(&stTime, &ftTime);
      CertInfo.NotAfter = ftTime;

      // Get Public Key Info size
      bResult = CryptExportPublicKeyInfo(hProv, dwKeyType,
                                       X509_ASN_ENCODING, NULL, &dwSize);
      if (!bResult)
      {
         printf("CryptExportPublicKeyInfo failed with %x\n", GetLastError());
         __leave;
      }

      // Allocate memory for Public Key Info
      PublicKeyInfo = (PCERT_PUBLIC_KEY_INFO)HeapAlloc(hHeap, 0, dwSize);
      if (!PublicKeyInfo)
      {
         printf("Unable to allocate memory for public key info\n");
         __leave;
      }

      // Get Public Key Info
      bResult = CryptExportPublicKeyInfo(hProv, dwKeyType,
                                       X509_ASN_ENCODING,
                                       PublicKeyInfo, &dwSize);
      if (!bResult)
      {
         printf("CryptExportPublicKeyInfo failed with %x\n", GetLastError());
         __leave;
      }

      // Set Public Key info of Certificate
      CertInfo.SubjectPublicKeyInfo = *PublicKeyInfo;

      // Create Hash
      bResult = CryptCreateHash(hProv, CALG_SHA1, 0, 0, &hHash);
      if (!bResult)
      {
         printf("CryptCreateHash failed with %x\n", GetLastError());
         __leave;
      }

      // Hash Public Key Info
      bResult = CryptHashData(hHash, (LPBYTE)PublicKeyInfo, dwSize, 0);
      if (!bResult)
      {
         printf("CryptHashData failed with %x\n", GetLastError());
         __leave;
      }

      // Get Size of Hash
      bResult = CryptGetHashParam(hHash, HP_HASHVAL, NULL, &dwSize, 0);
      if (!bResult)
      {
         printf("CryptGetHashParam failed with %x\n", GetLastError());
         __leave;
      }

      // Allocate Memory for Key Identifier (hash of Public Key info)
      pbKeyIdentifier = (LPBYTE)HeapAlloc(hHeap, 0, dwSize);
      if (!pbKeyIdentifier)
      {
         printf("Unable to allocate memory for Hashed Public key Info\n");
         __leave;
      }

      // Get Hash of Public Key Info
      bResult = CryptGetHashParam(hHash, HP_HASHVAL, pbKeyIdentifier, &dwSize, 0);
      if (!bResult)
      {
         printf("CryptGetHashParam failed with %x\n", GetLastError());
         __leave;
      }

      // We will use this to set the Key Identifier extension
      CertKeyIdentifier.cbData = dwSize;
      CertKeyIdentifier.pbData = pbKeyIdentifier;

      // Set Subject of Certificate
      CertInfo.Subject = IssuerName;

      // Set Issuer of Certificate
      if (bSelfSigned)
      {
         CertInfo.Issuer = IssuerName;
      }
      else
      {
         pIssuerCert = FindCertificate(szIssuerName, szIssuerStore,
                                       dwIssuerFlags, &KeyId,
                                       &hIssuerProv, &dwIssuerKeyType);
         if (!pIssuerCert)
         {
            printf("Unable to find Issuer Certificate\n");
            __leave;
         }

         CertInfo.Issuer = pIssuerCert->pCertInfo->Subject;
      }

      // Get Subject Key Identifier Extension size
      bResult = CryptEncodeObject(ENCODING,
                                  szOID_SUBJECT_KEY_IDENTIFIER,
                                  (LPVOID)&CertKeyIdentifier,
                                  NULL, &dwSize);
      if (!bResult)
      {
         printf("CryptEncodeObject failed with %x\n", GetLastError());
         __leave;
      }

      // Allocate Memory for Subject Key Identifier Blob
      SubjectKeyIdentifier = (LPBYTE)HeapAlloc(hHeap, 0, dwSize);
      if (!SubjectKeyIdentifier)
      {
         printf("Unable to allocate memory for Subject Key Identifier\n");
         __leave;
      }

      // Get Subject Key Identifier Extension
      bResult = CryptEncodeObject(ENCODING,
                                  szOID_SUBJECT_KEY_IDENTIFIER,
                                  (LPVOID)&CertKeyIdentifier,
                                  SubjectKeyIdentifier, &dwSize);
      if (!bResult)
      {
         printf("CryptEncodeObject failed with %x\n", GetLastError());
         __leave;
      }

      // Set Subject Key Identifier
      CertExtension[CertInfo.cExtension].pszObjId = szOID_SUBJECT_KEY_IDENTIFIER;
      CertExtension[CertInfo.cExtension].fCritical = FALSE;
      CertExtension[CertInfo.cExtension].Value.cbData = dwSize;
      CertExtension[CertInfo.cExtension].Value.pbData = SubjectKeyIdentifier;

      // Increase extension count
      CertInfo.cExtension++;

      // Set Key Usage according to Public Key Type
      ZeroMemory(&KeyUsage, sizeof(KeyUsage));
      KeyUsage.cbData = 1;
      KeyUsage.pbData = &ByteData;

      if (dwKeyType == AT_SIGNATURE)
      {
         ByteData = CERT_DIGITAL_SIGNATURE_KEY_USAGE|
                    CERT_NON_REPUDIATION_KEY_USAGE|
                    CERT_KEY_CERT_SIGN_KEY_USAGE |
                    CERT_CRL_SIGN_KEY_USAGE;
      }

      if (dwKeyType == AT_KEYEXCHANGE)
      {
         ByteData = CERT_DIGITAL_SIGNATURE_KEY_USAGE |
                    CERT_DATA_ENCIPHERMENT_KEY_USAGE|
                    CERT_KEY_ENCIPHERMENT_KEY_USAGE |
                    CERT_KEY_AGREEMENT_KEY_USAGE;
      }

      // Get Key Usage blob size
      bResult = CryptEncodeObject(ENCODING,
                                  X509_KEY_USAGE,
                                  (LPVOID)&KeyUsage,
                                  NULL, &dwSize);
      if (!bResult)
      {
         printf("CryptEncodeObject failed with %x\n", GetLastError());
         __leave;
      }

      // Allocate Memory for Key Usage Blob
      pbKeyUsage = (LPBYTE)HeapAlloc(hHeap, 0, dwSize);
      if (!pbKeyUsage)
      {
         printf("Unable to allocate memory for Subject Key Identifier\n");
         __leave;
      }

      // Get Key Usage Extension blob
      bResult = CryptEncodeObject(ENCODING,
                                  X509_KEY_USAGE,
                                  (LPVOID)&KeyUsage,
                                  pbKeyUsage, &dwSize);
      if (!bResult)
      {
         printf("CryptEncodeObject failed with %x\n", GetLastError());
         __leave;
      }

      // Set Key Usage extension
      CertExtension[CertInfo.cExtension].pszObjId = szOID_KEY_USAGE;
      CertExtension[CertInfo.cExtension].fCritical = FALSE;
      CertExtension[CertInfo.cExtension].Value.cbData = dwSize;
      CertExtension[CertInfo.cExtension].Value.pbData = pbKeyUsage;

      // Increase extension count
      CertInfo.cExtension++;

      if (CertEnhKeyUsage.cUsageIdentifier != 0)
      {
         // Get Enhanced Key Usage size
         bResult = CryptEncodeObject(ENCODING,
                                     X509_ENHANCED_KEY_USAGE,
                                     (LPVOID)&CertEnhKeyUsage,
                                     NULL, &dwSize);
         if (!bResult)
         {
            printf("CryptEncodeObject failed with %x\n", GetLastError());
            __leave;
         }

         // Allocate Memory for Enhanced Key usage Blob
         pbEnhKeyUsage = (LPBYTE)HeapAlloc(hHeap, 0, dwSize);
         if (!pbEnhKeyUsage)
         {
            printf("Unable to allocate memory for Subject Key Identifier\n");
            __leave;
         }

         // Get Enhanced Key Usage Extension blob
         bResult = CryptEncodeObject(ENCODING,
                                     X509_ENHANCED_KEY_USAGE,
                                     (LPVOID)&CertEnhKeyUsage,
                                     pbEnhKeyUsage, &dwSize);
         if (!bResult)
         {
            printf("CryptEncodeObject failed with %x\n", GetLastError());
            __leave;
         }

         // Set Enhanced Key Usage extension
         CertExtension[CertInfo.cExtension].pszObjId = szOID_ENHANCED_KEY_USAGE;
         CertExtension[CertInfo.cExtension].fCritical = FALSE;
         CertExtension[CertInfo.cExtension].Value.cbData = dwSize;
         CertExtension[CertInfo.cExtension].Value.pbData = pbEnhKeyUsage;

         // Increase extension count
         CertInfo.cExtension++;
      }

      // Zero Basic Constraints structure
      ZeroMemory(&BasicConstraints, sizeof(BasicConstraints));

      // Self-signed is always a CA
      if (bSelfSigned)
      {
         BasicConstraints.fCA = TRUE;
         BasicConstraints.fPathLenConstraint = TRUE;
         BasicConstraints.dwPathLenConstraint = 1;
      }
      else
      {
         BasicConstraints.fCA = bCA;
      }

      // Get Basic Constraints blob size
      bResult = CryptEncodeObject(ENCODING,
                                  X509_BASIC_CONSTRAINTS2,
                                  (LPVOID)&BasicConstraints,
                                  NULL, &dwSize);
      if (!bResult)
      {
         printf("CryptEncodeObject failed with %x\n", GetLastError());
         __leave;
      }

      // Allocate Memory for Basic Constraints Blob
      pbBasicConstraints = (LPBYTE)HeapAlloc(hHeap, 0, dwSize);
      if (!pbBasicConstraints)
      {
         printf("Unable to allocate memory for Subject Key Identifier\n");
         __leave;
      }

      // Get Basic Constraints Extension blob
      bResult = CryptEncodeObject(ENCODING,
                                  X509_BASIC_CONSTRAINTS2,
                                  (LPVOID)&BasicConstraints,
                                  pbBasicConstraints, &dwSize);
      if (!bResult)
      {
         printf("CryptEncodeObject failed with %x\n", GetLastError());
         __leave;
      }

      // Set Basic Constraints extension
      CertExtension[CertInfo.cExtension].pszObjId = szOID_BASIC_CONSTRAINTS2;
      CertExtension[CertInfo.cExtension].fCritical = FALSE;
      CertExtension[CertInfo.cExtension].Value.cbData = dwSize;
      CertExtension[CertInfo.cExtension].Value.pbData = pbBasicConstraints;

      // Increase extension count
      CertInfo.cExtension++;

      if (bSelfSigned)
      {
         AuthorityKeyId.KeyId = CertKeyIdentifier;
         AuthorityKeyId.CertIssuer = CertInfo.Issuer;
         AuthorityKeyId.CertSerialNumber = CertInfo.SerialNumber;
         bAddAuthorityExtension = TRUE;
      }
      else
      {
         if (KeyId)
         {
            AuthorityKeyId.KeyId = *KeyId;
            AuthorityKeyId.CertIssuer = pIssuerCert->pCertInfo->Issuer;
            AuthorityKeyId.CertSerialNumber = pIssuerCert->pCertInfo->SerialNumber;
            bAddAuthorityExtension = TRUE;
         }
      }

      if (bAddAuthorityExtension)
      {
         // Get Authority Key Id blob size
         bResult = CryptEncodeObject(ENCODING,
                                     X509_AUTHORITY_KEY_ID,
                                     (LPVOID)&AuthorityKeyId,
                                     NULL, &dwSize);
         if (!bResult)
         {
            printf("CryptEncodeObject failed with %x\n", GetLastError());
            __leave;
         }

         // Allocate Authority Key Id Blob
         pbAuthorityKeyId = (LPBYTE)HeapAlloc(hHeap, 0, dwSize);
         if (!pbAuthorityKeyId)
         {
            printf("Unable to allocate memory for Subject Key Identifier\n");
            __leave;
         }

         // Get Authority Key Id blob
         bResult = CryptEncodeObject(ENCODING,
                                     X509_AUTHORITY_KEY_ID,
                                     (LPVOID)&AuthorityKeyId,
                                     pbAuthorityKeyId, &dwSize);
         if (!bResult)
         {
            printf("CryptEncodeObject failed with %x\n", GetLastError());
            __leave;
         }

         // Set Authority Key Id extension
         CertExtension[CertInfo.cExtension].pszObjId = szOID_AUTHORITY_KEY_IDENTIFIER;
         CertExtension[CertInfo.cExtension].fCritical = FALSE;
         CertExtension[CertInfo.cExtension].Value.cbData = dwSize;
         CertExtension[CertInfo.cExtension].Value.pbData = pbAuthorityKeyId;

         // Increase extension count
         CertInfo.cExtension++;
      }

      CertInfo.rgExtension = CertExtension;

      if (bSelfSigned)
      {
         // Get Encoded Certificate Size
         bResult = CryptSignAndEncodeCertificate(hProv, dwKeyType,
                                                 X509_ASN_ENCODING, X509_CERT_TO_BE_SIGNED,
                                                 (LPVOID)&CertInfo,
                                                 &(CertInfo.SignatureAlgorithm),
                                                 NULL, NULL, &dwSize);
         if (!bResult)
         {
            printf("CryptSignAndEncodeCertificate failed with %x\n", GetLastError());
            __leave;
         }

         // Allocate memory for encoded certificate
         bpEncodedCert = (LPBYTE)HeapAlloc(hHeap, 0, dwSize);
         if (!bpEncodedCert)
         {
            printf("Unable to allocate memory for encoded certficate\n");
            __leave;
         }

         // Sign and Encode certificate
         bResult = CryptSignAndEncodeCertificate(hProv, dwKeyType,
                                                 X509_ASN_ENCODING, X509_CERT_TO_BE_SIGNED,
                                                 (LPVOID)&CertInfo,
                                                 &(CertInfo.SignatureAlgorithm),
                                                 NULL, bpEncodedCert, &dwSize);
         if (!bResult)
         {
            printf("CryptSignAndEncodeCertificate failed with %x\n", GetLastError());
            __leave;
         }
      }
      else
      {
         // Get Encoded Certificate Size
         bResult = CryptSignAndEncodeCertificate(hIssuerProv, dwIssuerKeyType,
                                                 X509_ASN_ENCODING, X509_CERT_TO_BE_SIGNED,
                                                 (LPVOID)&CertInfo,
                                                 &(pIssuerCert->pCertInfo->SignatureAlgorithm),
                                                 NULL, NULL, &dwSize);
         if (!bResult)
         {
            printf("CryptSignAndEncodeCertificate failed with %x\n", GetLastError());
            __leave;
         }

         // Allocate memory for encoded certificate
         bpEncodedCert = (LPBYTE)HeapAlloc(hHeap, 0, dwSize);
         if (!bpEncodedCert)
         {
            printf("Unable to allocate memory for encoded certficate\n");
            __leave;
         }

         // Sign and Encode certificate
         bResult = CryptSignAndEncodeCertificate(hIssuerProv, dwIssuerKeyType,
                                                 X509_ASN_ENCODING, X509_CERT_TO_BE_SIGNED,
                                                 (LPVOID)&CertInfo,
                                                 &(pIssuerCert->pCertInfo->SignatureAlgorithm),
                                                 NULL, bpEncodedCert, &dwSize);
         if (!bResult)
         {
            printf("CryptSignAndEncodeCertificate failed with %x\n", GetLastError());
            __leave;
         }
      }

      if (bExport)
      {
          DWORD dwWritten;

          // Create Certificate file
          hCertFile = CreateFile(szCertFile, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
                                 FILE_ATTRIBUTE_NORMAL, NULL);
          if (hCertFile == INVALID_HANDLE_VALUE)
          {
              printf("CreateFile failed with %d\n", GetLastError());
              __leave;
          }

          // Write encoded Certificate to file
          bResult = WriteFile(hCertFile, (LPVOID)bpEncodedCert, dwSize, &dwWritten, NULL);
          if (!bResult)
          {
              printf("WriteFile failed with %d\n", GetLastError());
              __leave;
          }

          // Destroy previous hash
          if (hHash) CryptDestroyHash(hHash);
          hHash = 0;

          // Create hash
          bResult = CryptCreateHash(hProv, CALG_SHA1, 0, 0, &hHash);
          if (!bResult)
          {
              printf("CryptCreateHash failed with %x\n", GetLastError());
              __leave;
          }

          // Hash password
          bResult = CryptHashData(hHash, (LPBYTE)szPassword, (DWORD)strlen(szPassword), 0);
          if (!bResult)
          {
              printf("CryptHashData failed with %x\n", GetLastError());
              __leave;
          }

          // Derive Session Key from hash
          bResult = CryptDeriveKey(hProv, CALG_RC4, hHash, CRYPT_EXPORTABLE, &hSessionKey);
          if (!bResult)
          {
              printf("CryptDeriveKey failed with %x\n", GetLastError());
              __leave;
          }

          // Get size of exported key blob
          bResult = CryptExportKey(hPubKey, hSessionKey, PRIVATEKEYBLOB, 0, NULL, &dwSize);
          if (!bResult)
          {
              printf("CryptExportKey failed with %x\n", GetLastError());
              __leave;
          }

          // Allocate memory for exported key blob
          pbExportedKey = (LPBYTE)HeapAlloc(hHeap, 0, dwSize);
          if (!pbExportedKey)
          {
              printf("Unable to allocate memory for exported key\n");
              __leave;
          }

          // Get exported key blob
          bResult = CryptExportKey(hPubKey, hSessionKey, PRIVATEKEYBLOB,
                                   0, pbExportedKey, &dwSize);
          if (!bResult)
          {
              printf("CryptExportKey failed with %x\n", GetLastError());
              __leave;
          }

          // Create Exported Key File
          hKeyFile = CreateFile(szKeyFile, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
                                FILE_ATTRIBUTE_NORMAL, NULL);
          if (hKeyFile == INVALID_HANDLE_VALUE)
          {
              printf("CreateFile failed with %d\n", GetLastError());
              __leave;
          }

          // Write exported key to file
          bResult = WriteFile(hKeyFile, (LPVOID)pbExportedKey, dwSize, &dwWritten, NULL);
          if (!bResult)
          {
              printf("WriteFile failed with %d\n", GetLastError());
              __leave;
          }

          // Create new crypto context
          bResult = CryptAcquireContext(&hProv,
                            szContainer,
                            szProvider,
                            dwProviderType,
                            CRYPT_DELETEKEYSET | dwAcquireFlags);
          if (!bResult)

          {
              printf("CryptAcquireContext failed with %x\n", GetLastError());
              __leave;
          }

                  bReturn = TRUE;

          printf("Certificate and Key information stored to files\n");
      }
      else
      {
          WCHAR szwStore[20];
          WCHAR szwContainer[160];
          WCHAR szwProvider[260];
          CRYPT_KEY_PROV_INFO CryptKeyProvInfo;
          LPSTR szFile;
          int i;
          DWORD dwWritten;

          if (bSelfSigned)
          {
              szFile = "SelfSigned.cer";
          }
          else
          {
              szFile = "Certificate.cer";
          }

          // Create Certificate file
          hCertFile = CreateFile(szFile, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
                                 FILE_ATTRIBUTE_NORMAL, NULL);
          if (hCertFile == INVALID_HANDLE_VALUE)
          {
              printf("CreateFile failed with %d\n", GetLastError());
              __leave;
          }

          // Write encoded Certificate to file
          bResult = WriteFile(hCertFile, (LPVOID)bpEncodedCert, dwSize, &dwWritten, NULL);
          if (!bResult)
          {
              printf("WriteFile failed with %d\n", GetLastError());
              __leave;
          }

                  printf("File called %s has been saved.\n", szFile);

          // Convert Store string to unicode
          i = MultiByteToWideChar(0, 0, szSubjectStore, -1, szwStore, 20);
          if (i == 0)
          {
              printf("MultiByteToWideChar failed with %d\n", GetLastError());
              __leave;
          }

          i = MultiByteToWideChar(0, 0, szProvider, -1, szwProvider, 260);
          if (i == 0)
          {
             printf("MultiByteToWideChar failed with %d\n", GetLastError());
              __leave;
          }

          // Open Certificate store
          hStore = CertOpenStore(CERT_STORE_PROV_SYSTEM,
                                 ENCODING,
                                 0, dwSubjectFlags, (LPVOID)szwStore);
          if (!hStore)
          {
              printf("CertOpenStore failed with %x\n", GetLastError());
              __leave;
          }

          // Place Certificate in store
          bResult = CertAddEncodedCertificateToStore(hStore, X509_ASN_ENCODING,
                                    bpEncodedCert, dwSize,
                                    CERT_STORE_ADD_REPLACE_EXISTING,
                                    &pCertContext);
          if (!bResult)
          {
              printf("CertAddEncodedCertificateToStore failed with %x\n", GetLastError());
              __leave;
          }

          // Convert container to unicode
          i = MultiByteToWideChar(0, 0, szContainer, -1, szwContainer, 160);
          if (i == 0)
          {
              printf("MultiByteToWideChar failed with %d\n", GetLastError());
              __leave;
          }

          // Initialize CRYPT_KEY_PROV_INFO structure
          ZeroMemory(&CryptKeyProvInfo, sizeof(CryptKeyProvInfo));
          CryptKeyProvInfo.pwszContainerName = szwContainer;
          CryptKeyProvInfo.pwszProvName = szwProvider;
          CryptKeyProvInfo.dwProvType = dwProviderType;
          CryptKeyProvInfo.dwKeySpec = dwKeyType;

          // Set Certificate's Key Provider info
          bResult = CertSetCertificateContextProperty(pCertContext,
                                        CERT_KEY_PROV_INFO_PROP_ID,
                                        0, (LPVOID)&CryptKeyProvInfo);
          if (!bResult)
          {
              printf("CertSetCertificateContextProperty failed with %x\n", GetLastError());
              __leave;
          }

                  bReturn = TRUE;

          printf("Certificate created successfully and installed\n");
      }
   }
   _finally
   {
      // Clean up
      if (pbNameBlob) HeapFree(hHeap, 0, pbNameBlob);
      if (CertEnhKeyUsage.rgpszUsageIdentifier)
         HeapFree(hHeap, 0, CertEnhKeyUsage.rgpszUsageIdentifier);
      if (PublicKeyInfo) HeapFree(hHeap, 0, PublicKeyInfo);
      if (pbKeyIdentifier) HeapFree(hHeap, 0, pbKeyIdentifier);
      if (SubjectKeyIdentifier) HeapFree(hHeap, 0, SubjectKeyIdentifier);
      if (pbKeyUsage) HeapFree(hHeap, 0, pbKeyUsage);
      if (pbEnhKeyUsage) HeapFree(hHeap, 0, pbEnhKeyUsage);
      if (pbBasicConstraints) HeapFree(hHeap, 0, pbBasicConstraints);
      if (KeyId) HeapFree(hHeap, 0, KeyId);
      if (pbAuthorityKeyId) HeapFree(hHeap, 0, pbAuthorityKeyId);
      if (bpEncodedCert) HeapFree(hHeap, 0, bpEncodedCert);
      if (pbExportedKey) HeapFree(hHeap, 0, pbExportedKey);
      if (szContainer) RpcStringFree(&szContainer);
      if (hCertFile) CloseHandle(hCertFile);
      if (hKeyFile) CloseHandle(hKeyFile);
      if (hPubKey) CryptDestroyKey(hPubKey);
      if (hSessionKey) CryptDestroyKey(hSessionKey);
      if (hHash) CryptDestroyHash(hHash);
      if (hProv) CryptReleaseContext(hProv, 0);
      if (hIssuerProv) CryptReleaseContext(hIssuerProv, 0);
      if (pIssuerCert) CertFreeCertificateContext(pIssuerCert);
      if (pCertContext) CertFreeCertificateContext(pCertContext);
      if (hStore) CertCloseStore(hStore, 0);
   }

   return bReturn;
}

PCCERT_CONTEXT FindCertificate | ( | LPSTR | szCertName,
 |  | LPSTR | szStore,
 |  | DWORD | dwFlags,
 |  | PCRYPT_DATA_BLOB * | KeyId,
 |  | HCRYPTPROV * | hProv,
 |  | LPDWORD | dwKeyType
 | ) |  |

Definition at line 1670 of file CreateCert.c.

{
   HANDLE hHeap = GetProcessHeap();
   PCRYPT_KEY_PROV_INFO KeyProvInfo;
   PCCERT_CONTEXT pCertContext = NULL;
   PCERT_EXTENSION pExtension = NULL;
   HCERTSTORE hStore = 0;
   WCHAR szwStore[20];
   CHAR szContainer[160];
   CHAR szProvider[160];
   BOOL bResult, bSuccess = FALSE;
   DWORD dwSize, dwAcquireFlags = 0;
   int i;

   __try
   {
      *KeyId = NULL;
      *hProv = 0;

      if (dwFlags == CERT_SYSTEM_STORE_LOCAL_MACHINE)
         dwAcquireFlags = CRYPT_MACHINE_KEYSET;

      // Convert Store string to Unicode
      i = MultiByteToWideChar(0, 0, szStore, -1, szwStore, 20);
      if (i == 0)
      {
         __leave;
      }

      // Open Certificate store
      hStore = CertOpenStore(CERT_STORE_PROV_SYSTEM,
                           ENCODING,
                           0, dwFlags, (LPVOID)szwStore);
      if (!hStore)
      {
         __leave;
      }

      // Find Certificate with Subject name
      pCertContext = CertFindCertificateInStore(hStore,
                              ENCODING,
                              0, CERT_FIND_SUBJECT_STR_A,
                              (LPVOID)szCertName, NULL);
      if (pCertContext)
      {
         // Get Key Provider Info size
         bResult = CertGetCertificateContextProperty(pCertContext,
                                             CERT_KEY_PROV_INFO_PROP_ID,
                                             NULL,
                                             &dwSize);
         if (!bResult)
         {
            __leave;
         }

         // Allocate Key Provider Info
         KeyProvInfo = (PCRYPT_KEY_PROV_INFO)HeapAlloc(hHeap, 0, dwSize);
         if (!KeyProvInfo)
         {
            __leave;
         }

         // Get Key Provider Info
         bResult = CertGetCertificateContextProperty(pCertContext,
                                             CERT_KEY_PROV_INFO_PROP_ID,
                                             (LPVOID)KeyProvInfo,
                                             &dwSize);
         if (!bResult)
         {
            __leave;
         }

         // Convert Container Name to ANSI
         i = WideCharToMultiByte(0, 0, KeyProvInfo->pwszContainerName,
                                 -1, szContainer, 160, NULL, NULL);
         if (i == 0)
         {
            __leave;
         }

         // Convert Provider Name to ANSI
         i = WideCharToMultiByte(0, 0, KeyProvInfo->pwszProvName, -1,
                                 szProvider, 160, NULL, NULL);
         if (i == 0)
         {
            __leave;
         }

         // Get Crypto Context of Certificate
         bResult = CryptAcquireContext(hProv, szContainer, szProvider,
                                       KeyProvInfo->dwProvType, dwAcquireFlags);
         if (!bResult)
         {
            __leave;
         }

         // Return Key Spec
         *dwKeyType = KeyProvInfo->dwKeySpec;

         bSuccess = TRUE;

         // Find Subject Key Identifier Extension
         pExtension = CertFindExtension(szOID_SUBJECT_KEY_IDENTIFIER,
                                        pCertContext->pCertInfo->cExtension,
                                        pCertContext->pCertInfo->rgExtension);

         // If Subject Key Identifier Extension Exists
         if (pExtension)
         {

            // Get Size of Data Blob
            bResult = CryptDecodeObject(ENCODING,
                                        szOID_SUBJECT_KEY_IDENTIFIER,
                                        pExtension->Value.pbData,
                                        pExtension->Value.cbData,
                                        0, NULL, &dwSize);
            if (!bResult)
            {
               __leave;
            }

            // Allocate Data Blob
            *KeyId = (PCRYPT_DATA_BLOB)HeapAlloc(hHeap, 0, dwSize);
            if (!(*KeyId))
            {
               __leave;
            }

            // Get Key Identifier Data Blob
            bResult = CryptDecodeObject(ENCODING,
                                        szOID_SUBJECT_KEY_IDENTIFIER,
                                        pExtension->Value.pbData,
                                        pExtension->Value.cbData,
                                        0, (LPVOID)*KeyId, &dwSize);
            if (!bResult)
            {
               __leave;
            }
         }
      }
      else
      {
         __leave;
      }

      bSuccess = TRUE;
   }
   __finally
   {
      // Clean up
      if (hStore) CertCloseStore(hStore, 0);
      if (KeyProvInfo) HeapFree(hHeap, 0, KeyProvInfo);
      if (!bSuccess)
      {
         if (pCertContext) CertFreeCertificateContext(pCertContext);
         pCertContext = NULL;
         if (*KeyId) HeapFree(hHeap, 0, *KeyId);
         *KeyId = NULL;
      }
   }

   return pCertContext;
}

BOOL ImportCertificate | ( | LPSTR | szCertFile,
 |  | LPSTR | szKeyFile,
 |  | LPSTR | szPassword,
 |  | LPSTR | szStore,
 |  | BOOL | bUser,
 |  | DWORD | dwProviderNum
 | ) |  |

Definition at line 326 of file CreateCert.c.

{
   LPSTR szContainer = NULL;
   HCRYPTPROV hProv = 0;
   HCRYPTHASH hHash = 0;
   HCERTSTORE hStore = NULL;
   HCRYPTKEY hKey = 0;
   HCRYPTKEY hPubKey = 0;
   HANDLE hFile = INVALID_HANDLE_VALUE;
   LPBYTE pbEncodedCert = NULL;
   LPBYTE pbEncodedKey = NULL;
   PCCERT_CONTEXT pCertContext = NULL;
   CRYPT_KEY_PROV_INFO CertKeyInfo;
   BOOL fReturn = FALSE;
   RPC_STATUS Status;
   HANDLE hHeap;
   UUID Uuid;
   BOOL bResult;
   DWORD dwSize, dwRead;
   WCHAR szwStore[20];
   DWORD dwAcquireFlags = 0;
   DWORD dwCertOpenFlags = CERT_SYSTEM_STORE_CURRENT_USER;
   CHAR szProvider[260] = { MS_DEF_PROV };
   DWORD dwProviderType = PROV_RSA_FULL;
   int i;

   __try
   {
     if (!bUser)
     {
        dwAcquireFlags = CRYPT_MACHINE_KEYSET;
        dwCertOpenFlags = CERT_SYSTEM_STORE_LOCAL_MACHINE;
     }

     dwSize = 260;
     bResult = MyCryptEnumProviders(dwProviderNum,
                                    NULL,
                                    0,
                                    &dwProviderType,
                                    szProvider,
                                    &dwSize);
     if (!bResult)
     {
        printf("Unable to get provider\n");
        __leave;
     }

     // Get process heap
     hHeap = GetProcessHeap();

     // Open Key File
     hFile = CreateFile(szKeyFile,
                      GENERIC_READ,
                      0,
                      NULL,
                      OPEN_EXISTING,
                      FILE_ATTRIBUTE_NORMAL,
                      NULL);
     if (hFile == INVALID_HANDLE_VALUE)
     {
         printf("Unable to open key file\n");
         __leave;
     }

     // Get file length
     dwSize = GetFileSize(hFile, NULL);
     if (dwSize == 0xFFFFFFFF)
     {
       printf("Unable to get size of certificate file\n");
       __leave;
     }

     // Allocate memory for encoded key
     pbEncodedKey = (LPBYTE)HeapAlloc(hHeap, 0, dwSize);
     if (!pbEncodedKey)
     {
       printf("Unable to allocate memory for encoded key\n");
       __leave;
     }

     // Read encoded key data
     bResult = ReadFile(hFile,
                    (LPVOID)pbEncodedKey,
                    dwSize,
                    &dwRead,
                    NULL);
     if (!bResult)
     {
       printf("Unable to read encoded key\n");
       __leave;
     }

     // Close file handle
     CloseHandle(hFile);
     hFile = INVALID_HANDLE_VALUE;

     {
        HCRYPTPROV hTemp;

        // Create Temporary Provider
        bResult = CryptAcquireContext(&hTemp,
                                      "Temp000",
                                      MS_DEF_PROV,
                                      PROV_RSA_FULL,
                                      CRYPT_NEWKEYSET);
        if (!bResult)
        {
           // If Temporary Provider exists already,
           // open it
           if (GetLastError() == NTE_EXISTS)
           {
              bResult = CryptAcquireContext(&hTemp,
                                          "Temp000",
                                          MS_DEF_PROV,
                                          PROV_RSA_FULL,
                                          0);
              if (!bResult)
              {
                 printf("Unable to get temporary provider handle\n");
                 __leave;
              }
           }
           else
           {
              printf("Unable to create temporary provider handle\n");
              __leave;
           }
        }

        // Place random data in Uuid
        // Could have used UuidCreate but it is not supported
        // under Win9x.
        bResult = CryptGenRandom(hTemp, sizeof(Uuid), (LPBYTE)&Uuid);
        if (!bResult)
        {
           printf("CryptGenRandom failed with %x\n", GetLastError());
           __leave;
        }

        // Close Provider handle
        CryptReleaseContext(hTemp, 0);

        // Delete Container
        CryptAcquireContext(&hTemp,
                           "Temp000",
                           MS_DEF_PROV,
                           PROV_RSA_FULL,
                           CRYPT_DELETEKEYSET);

        // Create a random uuid
        /*Status = UuidCreate(&Uuid);
        if (Status != RPC_S_OK)
        {
          printf("Unable to create random container\n");
          __leave;
        }*/

        // convert random uuid to a string, we will use it as a container
        Status = UuidToString(&Uuid, &szContainer);
        if (Status != RPC_S_OK)
        {
          printf("Unable to convert uuid to string\n");
          __leave;
        }
     }

     // Create new crypto context
     bResult = CryptAcquireContext(&hProv,
                            szContainer,
                            szProvider,
                            dwProviderType,
                            CRYPT_NEWKEYSET | dwAcquireFlags);
     if (!bResult)
     {
       printf("CryptAcquireContext failed with %x\n", GetLastError());
       __leave;
     }

     // Create Hash to hash password
     bResult = CryptCreateHash(hProv, CALG_SHA1, 0, 0, &hHash);
     if (!bResult)
     {
       printf("CryptCreateHash failed with %x\n", GetLastError());
       __leave;
     }

     // Hash Password
     bResult = CryptHashData(hHash, (LPBYTE)szPassword, (DWORD)strlen(szPassword), 0);
     if (!bResult)
     {
       printf("CryptHashData failed with %x\n", GetLastError());
       __leave;
     }

     // Derive Session Key from password hash
     bResult = CryptDeriveKey(hProv, CALG_RC4, hHash, CRYPT_EXPORTABLE, &hKey);
     if (!bResult)
     {
       printf("CryptDeriveKey failed with %x\n", GetLastError());
       __leave;
     }

     // Import Private/Public Key into Provider
     bResult = CryptImportKey(hProv, pbEncodedKey, dwSize, hKey,
                        CRYPT_EXPORTABLE, &hPubKey);
     if (!bResult)
     {
       printf("CryptImportKey failed with %x\n", GetLastError());
       __leave;
     }

     // Open Certificate file
     hFile = CreateFile(szCertFile,
                   GENERIC_READ,
                   0,
                   NULL,
                   OPEN_EXISTING,
                   FILE_ATTRIBUTE_NORMAL,
                   NULL);
     if (hFile == INVALID_HANDLE_VALUE)
     {
       printf("Unable to open certificate file\n");
       __leave;
     }

     // Get file length
     dwSize = GetFileSize(hFile, NULL);
     if (dwSize == 0xFFFFFFFF)
     {
       printf("Unable to get size of certificate file\n");
       __leave;
     }

     // Allocate memory for encoded certificate
     pbEncodedCert = (LPBYTE)HeapAlloc(hHeap, 0, dwSize);
     if (!pbEncodedCert)
     {
       printf("Unable to allocate memory for encoded certificate\n");
       __leave;
     }

     // Read encoded certificate data
     bResult = ReadFile(hFile,
                    (LPVOID)pbEncodedCert,
                    dwSize,
                    &dwRead,
                    NULL);
     if (!bResult)
     {
       printf("Unable to read encoded certificate\n");
       __leave;
     }

     // Close file handle
     CloseHandle(hFile);
     hFile = INVALID_HANDLE_VALUE;

     // Convert multibyte store name to wide char string
     if (mbstowcs(szwStore, szStore, strlen(szStore)+1) == (size_t)-1)
     {
       printf("Unable to convert store to Unicode string\n");
       __leave;
     }

     // Open Certificate Store
     hStore = CertOpenStore(CERT_STORE_PROV_SYSTEM,
                      ENCODING,
                      0,
                      dwCertOpenFlags,
                      (LPVOID)szwStore);
     if (!hStore)
     {
       printf("CertOpenStore failed with %x\n", GetLastError());
       __leave;
     }

     // Add Certificate to store
     bResult = CertAddEncodedCertificateToStore(hStore,
                                     X509_ASN_ENCODING,
                                     pbEncodedCert,
                                     dwSize,
                                     CERT_STORE_ADD_REPLACE_EXISTING,
                                     &pCertContext);
     if (!bResult)
     {
       printf("CertAddEncodedCertificateToStore failed with %x\n", GetLastError());
       __leave;
     }

     {
        WCHAR szwContainer[160];
        WCHAR szwProvider[260];

        i = (int)mbstowcs(szwContainer, szContainer, (size_t)(sizeof(szContainer)+1));
        if (i == 0)
        {
            printf("MultiByteToWideChar failed with %d\n", GetLastError());
            __leave;
        }

        i = MultiByteToWideChar(0, 0, szProvider, -1, szwProvider, 260);
        if (i == 0)
        {
            printf("MultiByteToWideChar failed with %d\n", GetLastError());
            __leave;
        }

        ZeroMemory(&CertKeyInfo, sizeof(CertKeyInfo));
        CertKeyInfo.pwszContainerName = szwContainer;
        CertKeyInfo.pwszProvName = szwProvider;
        CertKeyInfo.dwProvType = dwProviderType;

        bResult = CryptGetKeyParam(hPubKey, KP_ALGID, (LPBYTE)&CertKeyInfo.dwKeySpec,
                            &dwSize, 0);
        if (!bResult)
        {
          printf("CryptGetKeyParam failed with %x\n", GetLastError());
          __leave;
        }

        // Set Key property for Certificate
        bResult = CertSetCertificateContextProperty(pCertContext,
                                         CERT_KEY_PROV_INFO_PROP_ID,
                                         0,
                                         (LPVOID)&CertKeyInfo);
        if (!bResult)
        {
          printf("CertSetCertificateContextProperty failed with %x\n", GetLastError());
          __leave;
        }
     }

     fReturn = TRUE;
   }
   _finally
   {
     // Clean up
     if (szContainer) RpcStringFree(&szContainer);
     if (hHash) CryptDestroyHash(hHash);
     if (hKey) CryptDestroyKey(hKey);
     if (hPubKey) CryptDestroyKey(hPubKey);
     if (hProv) CryptReleaseContext(hProv, 0);
     if (hFile != INVALID_HANDLE_VALUE) CloseHandle(hFile);
     if (pbEncodedCert) HeapFree(hHeap, 0, pbEncodedCert);
     if (pbEncodedKey) HeapFree(hHeap, 0, pbEncodedKey);
     if (pCertContext) CertFreeCertificateContext(pCertContext);
     if (hStore) CertCloseStore(hStore, 0);
   }

   return fReturn;
}

BOOL WINAPI MyCryptEnumProviders | ( | DWORD | dwIndex,
 |  | LPDWORD | Res,
 |  | DWORD | dwFlags,
 |  | LPDWORD | pdwProvType,
 |  | LPTSTR | szProvName,
 |  | LPDWORD | pcbProvName
 | ) |  |

Definition at line 1839 of file CreateCert.c.

{
    static LPTSTR szKeyPath = TEXT("SOFTWARE\\Microsoft\\Cryptography\\Defaults\\Provider");
    BOOL bResult = TRUE;
    DWORD dwNumKeys;
    HKEY hKey = NULL;
    HKEY hSubKey = NULL;
    LONG lResult;
    FILETIME ft;

    __try
    {
       // Open registry provider registry key
        lResult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, szKeyPath, 0, KEY_READ, &hKey);
        if (lResult != ERROR_SUCCESS)
        {
            bResult = FALSE;
            __leave;
        }

        if (szProvName == NULL)
        {
           // Query for Number of Keys and Size maximum size of
           // provider
           lResult = RegQueryInfoKey(hKey, NULL, NULL, NULL, &dwNumKeys, pcbProvName,
                                     NULL, NULL, NULL, NULL, NULL, NULL);
           if (lResult != ERROR_SUCCESS)
           {
              bResult = FALSE;
              __leave;
           }

           // return Size of Provider Name
           *pcbProvName = (*pcbProvName + 1) * sizeof(TCHAR);

           if (dwIndex >= dwNumKeys) return FALSE;
        }
        else
        {
           DWORD dwSize;
           DWORD dwType;

           // Get Provider by Index
           dwSize = *pcbProvName/sizeof(TCHAR);
           lResult = RegEnumKeyEx(hKey, dwIndex, szProvName, &dwSize, NULL, NULL, NULL, &ft);
           if (lResult != ERROR_SUCCESS)
           {
              bResult = FALSE;
              __leave;
           }

           *pcbProvName = (dwSize + 1) * sizeof(TCHAR);

           // Open the Provider Registry Key
           lResult = RegOpenKeyEx(hKey, szProvName, 0, KEY_READ, &hSubKey);
           if (lResult != ERROR_SUCCESS)
           {
              bResult = FALSE;
              __leave;
           }

           // Get Provider Type
           dwSize = sizeof(DWORD);
           lResult = RegQueryValueEx(hSubKey, TEXT("Type"), NULL, &dwType, (LPBYTE)pdwProvType, &dwSize);
           if (lResult != ERROR_SUCCESS)
           {
              bResult = FALSE;
              __leave;
           }
        }
    }
    __finally
    {
       // Clean up
       if (hKey != NULL) RegCloseKey(hKey);
       if (hSubKey != NULL) RegCloseKey(hSubKey);
    }

    return bResult;
}

void PrintUsage ( void )

Definition at line 1549 of file Sample1.Cpp.

{
   wprintf(L"sample1.exe\n");
   wprintf(L"Usage:\n");
   wprintf(L"   sample1 <action> [action specific parameters]\n");
   wprintf(L"      where <action> is one of the followings:\n");
   wprintf(L"                download\n");
   wprintf(L"                upload\n");
   wprintf(L"                enum\n");
   wprintf(L"                search\n");
   wprintf(L"                mkdir\n");
   wprintf(L"                copy\n");
   wprintf(L"                move\n");
   wprintf(L"                delete\n");
   wprintf(L"      action specific parameters:\n");
   wprintf(L"         download: u=url [l=local_dest] [n=username p=password]\n");
   wprintf(L"         upload:   u=url l=local_src [n=username p=password]\n");
   wprintf(L"         enum:     u=url [v=yes/no] [n=username p=password]\n");
   wprintf(L"         search:   u=url [q=\"SQL query\"] [v=yes/no] [n=username p=password]\n");
   wprintf(L"                   note that '\"' in the query should be typed as '\\\"'\n");
   wprintf(L"         mkdir:    u=url [n=username p=password]\n");
   wprintf(L"         copy:     us=src ud=dest [ns=username ps=password]\n");
   wprintf(L"                                  [nd=username pd=password]\n");
   wprintf(L"         move:     us=src ud=dest [ns=username ps=password]\n");
   wprintf(L"                                  [nd=username pd=password]\n");
   wprintf(L"         delete:   u=url [n=username p=password]\n");
}

Generated on Wed Nov 13 2024 16:54:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CryptoApi/Encrypt/Decrypt.c File Reference

  • Security
  • CryptoApi
  • Encrypt
Defines | Functions

Decrypt.c File Reference

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <wincrypt.h>

Go to the source code of this file.

Defines

#define | ENCRYPT_ALGORITHM CALG_RC4
#define | ENCRYPT_BLOCK_SIZE 1
#define | KEYLENGTH 0x00800000

Functions

void _cdecl | main (int argc, char *argv[])

Define Documentation

#define ENCRYPT_ALGORITHM CALG_RC4

Definition at line 23 of file Decrypt.c.

#define ENCRYPT_BLOCK_SIZE 1

Definition at line 24 of file Decrypt.c.

#define KEYLENGTH 0x00800000

Definition at line 27 of file Decrypt.c.

Function Documentation

void _cdecl main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 32 of file Decrypt.c.

{
    PCHAR szSource      = NULL;
    PCHAR szDestination = NULL;
    PCHAR szPassword    = NULL;

    // Validate argument count.
    if(argc != 3 && argc != 4) {
        printf("USAGE: decrypt <source file> <dest file> [ <password> ]\n");
        exit(1);
    }

    // Parse arguments.
    szSource       = argv[1];
    szDestination  = argv[2];
    if(argc == 4) {
        szPassword = argv[3];
    }

    if(!CAPIDecryptFile(szSource, szDestination, szPassword)) {
        printf("Error encrypting file!\n");
        exit(1);
    }

    exit(0);
}

Generated on Wed Nov 13 2024 16:54:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CryptoApi/Encrypt/Encrypt.c File Reference

  • Security
  • CryptoApi
  • Encrypt
Defines | Functions

Encrypt.c File Reference

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <wincrypt.h>

Go to the source code of this file.

Defines

#define | ENCRYPT_ALGORITHM CALG_RC4
#define | ENCRYPT_BLOCK_SIZE 1
#define | KEYLENGTH 0x00800000

Functions

void _cdecl | main (int argc, char *argv[])

Define Documentation

#define ENCRYPT_ALGORITHM CALG_RC4

Definition at line 22 of file Encrypt.c.

#define ENCRYPT_BLOCK_SIZE 1

Definition at line 23 of file Encrypt.c.

#define KEYLENGTH 0x00800000

Definition at line 30 of file Encrypt.c.

Function Documentation

void _cdecl main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 35 of file Encrypt.c.

{
    PCHAR szSource      = NULL;
    PCHAR szDestination = NULL;
    PCHAR szPassword    = NULL;

    // Validate argument count.
    if(argc != 3 && argc != 4) {
        printf("USAGE: encrypt <source file> <dest file> [ <password> ]\n");
        exit(1);
    }

    // Parse arguments.
    szSource       = argv[1];
    szDestination  = argv[2];
    if(argc == 4) {
        szPassword = argv[3];
    }

    if(!CAPIEncryptFile(szSource, szDestination, szPassword)) {
        printf("Error encrypting file!\n");
        exit(1);
    }

    exit(0);
}

Generated on Wed Nov 13 2024 16:54:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CryptoApi/EncryptDecrypt/RSACert/RSACert.cpp File Reference

  • Security
  • CryptoApi
  • EncryptDecrypt
  • RSACert
Defines | Functions | Variables

RSACert.cpp File Reference

#include <windows.h>
#include <tchar.h>
#include <stdio.h>
#include <strsafe.h>

Go to the source code of this file.

Defines

#define | CheckAndLocalFree(ptr)
#define | MY_ENCODING (X509_ASN_ENCODING | PKCS_7_ASN_ENCODING)

Functions

void | _tmain (int argc, TCHAR **argv)
BOOL | AcquireAndGetRSAKey (PCCERT_CONTEXT pCertContext, HCRYPTPROV *phProv, HCRYPTKEY *phRSAKey, BOOL fEncrypt, BOOL *pfCallerFreeProv)
BOOL | AcquireAndGetRSAKey (PCCERT_CONTEXT pCertContext, DWORD dwCertStoreOpenFlags, HCRYPTPROV *phProv, HCRYPTKEY *phRSAKey, BOOL fEncrypt, BOOL *fCallerFreeProv)
BOOL | EncryptDecryptFile (LPTSTR lpszCertificateName, LPTSTR lpszCertificateStoreName, DWORD dwCertStoreOpenFlags, LPTSTR lpszInputFileName, LPTSTR lpszOutputFileName, BOOL fEncrypt)
PCCERT_CONTEXT | GetCertificateContextFromName (LPTSTR lpszCertificateName, LPTSTR lpszCertificateStoreName, DWORD dwCertStoreOpenFlags)
void __cdecl | MyPrintf (LPCTSTR lpszFormat,...)
void | PrintUsage ()

Variables

const int | IN_BUFFER_SIZE = 64 * 1024
const int | OUT_BUFFER_SIZE = IN_BUFFER_SIZE + 8

Define Documentation

#define CheckAndLocalFree ( ptr )
Value:
if (ptr != NULL) \
            { \
               LocalFree(ptr); \
               ptr = NULL; \
            }

Definition at line 47 of file RSACert.cpp.

#define MY_ENCODING (X509_ASN_ENCODING | PKCS_7_ASN_ENCODING)

Definition at line 25 of file RSACert.cpp.

Function Documentation

void _tmain | ( | int | argc,
 |  | TCHAR ** | argv
 | ) |  |

Definition at line 82 of file RSACert.cpp.

{
   BOOL fEncrypt = FALSE;
   LPTSTR lpszCertificateName = NULL;
   LPTSTR lpszCertificateStoreName = NULL;
   LPTSTR lpszInputFileName = NULL;
   LPTSTR lpszOutputFileName = NULL;
   DWORD dwCertStoreOpenFlags = CERT_SYSTEM_STORE_CURRENT_USER;

   if (argc != 7)
   {
      PrintUsage();
      return;
   }

   /* Check whether the action to be performed is encrypt or decrypt */
   if (_tcsicmp(argv[1], _T("/e")) == 0)
   {
      fEncrypt = TRUE;
   }
   else if (_tcsicmp(argv[1], _T("/d")) == 0)
   {
      fEncrypt = FALSE;
   }
   else
   {
      PrintUsage();
      return;
   }

   lpszCertificateName = argv[2];
   lpszCertificateStoreName = argv[3];

   /* Check whether the certificate store to be opened is user or machine */
   if (_tcsicmp(argv[4], _T("/u")) == 0)
   {
      dwCertStoreOpenFlags = CERT_SYSTEM_STORE_CURRENT_USER;
   }
   else if (_tcsicmp(argv[4], _T("/m")) == 0)
   {
      dwCertStoreOpenFlags = CERT_SYSTEM_STORE_LOCAL_MACHINE;
   }
   else
   {
      PrintUsage();
      return;
   }

   lpszInputFileName = argv[5];
   lpszOutputFileName = argv[6];

   EncryptDecryptFile(lpszCertificateName,
                        lpszCertificateStoreName,
                        dwCertStoreOpenFlags,
                        lpszInputFileName,
                        lpszOutputFileName,
                        fEncrypt);
}

BOOL AcquireAndGetRSAKey | ( | PCCERT_CONTEXT | pCertContext,
 |  | HCRYPTPROV * | phProv,
 |  | HCRYPTKEY * | phRSAKey,
 |  | BOOL | fEncrypt,
 |  | BOOL * | pfCallerFreeProv
 | ) |  |

Definition at line 194 of file RSACert.cpp.

{
   BOOL fSuccess = FALSE;
   DWORD dwKeySpec = 0;

   __try
   {
      *phProv = NULL;
      *phRSAKey = NULL;
      *pfCallerFreeProv = FALSE;

      if (fEncrypt)
      {
         // Acquire context for RSA key
         fSuccess = CryptAcquireContext(phProv,
                        NULL,
                        MS_DEF_PROV,
                        PROV_RSA_FULL,
                        CRYPT_VERIFYCONTEXT);
         if (!fSuccess)
         {
            MyPrintf(_T("CryptAcquireContext failed with %X\n"), GetLastError());
            __leave;
         }

         // Import the RSA public key from the certificate context
         fSuccess = CryptImportPublicKeyInfo(*phProv,
                        MY_ENCODING,
                        &(pCertContext->pCertInfo->SubjectPublicKeyInfo),
                        phRSAKey);
         if (!fSuccess)
         {
            MyPrintf(_T("CryptImportPublicKeyInfo failed with %X\n"), GetLastError());
            __leave;
         }

         *pfCallerFreeProv = TRUE;
      }
      else
      {
         // Acquire the RSA private key
         fSuccess = CryptAcquireCertificatePrivateKey(pCertContext,
               CRYPT_ACQUIRE_USE_PROV_INFO_FLAG|CRYPT_ACQUIRE_COMPARE_KEY_FLAG,
               NULL, phProv, &dwKeySpec, pfCallerFreeProv);
         if (!fSuccess)
         {
            MyPrintf(_T("CryptAcquireCertificatePrivateKey failed with %X\n"), GetLastError());
            __leave;
         }

         // Get the RSA key handle
         fSuccess = CryptGetUserKey(*phProv, dwKeySpec, phRSAKey);
         if (!fSuccess)
         {
            MyPrintf(_T("CryptGetUserKey failed with %X\n"), GetLastError());
            __leave;
         }
      }
   }
   __finally
   {
      if (fSuccess == FALSE)
      {
         if (phProv && *phProv != NULL)
         {
            CryptReleaseContext(*phProv, 0);
            *phProv = NULL;
         }
         if (phRSAKey && *phRSAKey != NULL)
         {
            CryptDestroyKey(*phRSAKey);
            *phRSAKey = NULL;
         }
      }
   }

   return fSuccess;
}

BOOL AcquireAndGetRSAKey | ( | PCCERT_CONTEXT | pCertContext,
 |  | DWORD | dwCertStoreOpenFlags,
 |  | HCRYPTPROV * | phProv,
 |  | HCRYPTKEY * | phRSAKey,
 |  | BOOL | fEncrypt,
 |  | BOOL * | fCallerFreeProv
 | ) |  |
BOOL EncryptDecryptFile | ( | LPTSTR | lpszCertificateName,
 |  | LPTSTR | lpszCertificateStoreName,
 |  | DWORD | dwCertStoreOpenFlags,
 |  | LPTSTR | lpszInputFileName,
 |  | LPTSTR | lpszOutputFileName,
 |  | BOOL | fEncrypt
 | ) |  |

Definition at line 277 of file RSACert.cpp.

{
   BOOL fResult = FALSE;
   HCRYPTPROV hProv = NULL;
   HCRYPTKEY hRSAKey = NULL;
   HCRYPTKEY hSessionKey = NULL;
   HANDLE hInFile = INVALID_HANDLE_VALUE;
   HANDLE hOutFile = INVALID_HANDLE_VALUE;
   BOOL finished = FALSE;
   BYTE pbBuffer[OUT_BUFFER_SIZE];
   DWORD dwByteCount = 0;
   DWORD dwBytesRead = 0;
   DWORD dwBytesWritten = 0;
   LPBYTE pbSessionKeyBlob = NULL;
   DWORD dwSessionKeyBlob = 0;
   BOOL fCallerFreeProv = FALSE;
   PCCERT_CONTEXT pCertContext = NULL;
   BOOL fSuccess = FALSE;

   __try
   {
      pCertContext = GetCertificateContextFromName(lpszCertificateName,
                        lpszCertificateStoreName,
                        dwCertStoreOpenFlags);
      if (pCertContext == NULL)
      {
         __leave;
      }

      fResult = AcquireAndGetRSAKey(pCertContext,
                        &hProv,
                        &hRSAKey,
                        fEncrypt,
                        &fCallerFreeProv);
      if (fResult == FALSE)
      {
         __leave;
      }

      // Open the input file to be encrypted or decrypted
      hInFile = CreateFile(lpszInputFileName,
                  GENERIC_READ,
                  0,
                  NULL,
                  OPEN_EXISTING,
                  FILE_ATTRIBUTE_NORMAL,
                  NULL);
      if (hInFile == INVALID_HANDLE_VALUE)
      {
         MyPrintf(_T("CreateFile failed with %d\n"), GetLastError());
         __leave;
      }

      // Open the output file to write the encrypted or decrypted data
      hOutFile = CreateFile(lpszOutputFileName,
                  GENERIC_WRITE,
                  0,
                  NULL,
                  CREATE_ALWAYS,
                  FILE_ATTRIBUTE_NORMAL,
                  NULL);
      if (hOutFile == INVALID_HANDLE_VALUE)
      {
         MyPrintf(_T("CreateFile failed with %d\n"), GetLastError());
         __leave;
      }

      if (fEncrypt)
      {
         fResult = CryptGenKey(hProv, CALG_RC4, CRYPT_EXPORTABLE, &hSessionKey);
         if (!fResult)
         {
            MyPrintf(_T("CryptGenKey failed with %X\n"), GetLastError());
            __leave;
         }

         // The first call to ExportKey with NULL gets the key size.
         dwSessionKeyBlob = 0;
         fResult = CryptExportKey(hSessionKey, hRSAKey, SIMPLEBLOB, 0,
                     NULL, &dwSessionKeyBlob);
         if (!fResult)
         {
            MyPrintf(_T("CryptExportKey failed with %X\n"), GetLastError());
            __leave;
         }

         // Allocate memory for Encrypted Session key blob
         pbSessionKeyBlob = (LPBYTE)LocalAlloc(LPTR, dwSessionKeyBlob);
         if (!pbSessionKeyBlob)
         {
            MyPrintf(_T("LocalAlloc failed with %d\n"), GetLastError());
            __leave;
         }

         fResult = CryptExportKey(hSessionKey, hRSAKey, SIMPLEBLOB, 0,
                     pbSessionKeyBlob, &dwSessionKeyBlob);
         if (!fResult)
         {
            MyPrintf(_T("CryptExportKey failed with %X\n"), GetLastError());
            __leave;
         }

         // Write the size of key blob, then the key blob itself, to output file.
         fResult = WriteFile(hOutFile, &dwSessionKeyBlob,
                     sizeof(dwSessionKeyBlob),
                     &dwBytesWritten, NULL);
         if (!fResult)
         {
            MyPrintf(_T("WriteFile failed with %d\n"), GetLastError());
            __leave;
         }
         fResult = WriteFile(hOutFile, pbSessionKeyBlob,
                     dwSessionKeyBlob,
                     &dwBytesWritten, NULL);
         if (!fResult)
         {
            MyPrintf(_T("WriteFile failed with %d\n"), GetLastError());
            __leave;
         }
      }
      else
      {
         // Read in key block size, then key blob itself from input file.
         fResult = ReadFile(hInFile, &dwByteCount, sizeof(dwByteCount),
               &dwBytesRead, NULL);
         if (!fResult)
         {
            MyPrintf(_T("ReadFile failed with %d\n"), GetLastError());
            __leave;
         }

         fResult = ReadFile(hInFile, pbBuffer, dwByteCount, &dwBytesRead, NULL);
         if (!fResult)
         {
            MyPrintf(_T("ReadFile failed with %d\n"), GetLastError());
            __leave;
         }

         // import key blob into "CSP"
         fResult = CryptImportKey(hProv, pbBuffer, dwByteCount, hRSAKey, 0, &hSessionKey);
         if (!fResult)
         {
            MyPrintf(_T("CryptImportKey failed with %X\n"), GetLastError());
            __leave;
         }
      }

      do
      {
         dwByteCount = 0;

         // Now read data from the input file 64K bytes at a time.
         fResult = ReadFile(hInFile, pbBuffer, IN_BUFFER_SIZE, &dwByteCount, NULL);

         // If the file size is exact multiple of 64K, dwByteCount will be zero after
         // all the data has been read from the input file. In this case, simply break
         // from the while loop. The check to do this is below
         if (dwByteCount == 0)
            break;

         if (!fResult)
         {
            MyPrintf(_T("ReadFile failed with %d\n"), GetLastError());
            __leave;
         }

         finished = (dwByteCount < IN_BUFFER_SIZE);

         // Encrypt/Decrypt depending on the required action.
         if (fEncrypt)
         {
            fResult = CryptEncrypt(hSessionKey, 0, finished, 0, pbBuffer, &dwByteCount,
                           OUT_BUFFER_SIZE);
            if (!fResult)
            {
               MyPrintf(_T("CryptEncrypt failed with %X\n"), GetLastError());
               __leave;
            }
         }
         else
         {
            fResult = CryptDecrypt(hSessionKey, 0, finished, 0, pbBuffer, &dwByteCount);
            if (!fResult)
            {
               MyPrintf(_T("CryptDecrypt failed with %X\n"), GetLastError());
               __leave;
            }
         }

         // Write the encrypted/decrypted data to the output file.
         fResult = WriteFile(hOutFile, pbBuffer, dwByteCount,
            &dwBytesWritten, NULL);
         if (!fResult)
         {
            MyPrintf(_T("WriteFile failed with %d\n"), GetLastError());
            __leave;
         }

      } while (!finished);

      if (fEncrypt)
         MyPrintf(_T("File %s is encrypted successfully!\n"), lpszInputFileName);
      else
         MyPrintf(_T("File %s is decrypted successfully!\n"), lpszInputFileName);

      fSuccess = TRUE;
   }
   __finally
   {
      /* Cleanup */
      CheckAndLocalFree(pbSessionKeyBlob);
      if (pCertContext != NULL) CertFreeCertificateContext(pCertContext);
      if (hRSAKey != NULL) CryptDestroyKey(hRSAKey);
      if (hSessionKey != NULL) CryptDestroyKey(hSessionKey);
      if (fCallerFreeProv && hProv != NULL) CryptReleaseContext(hProv, 0);
      if (hInFile != INVALID_HANDLE_VALUE) CloseHandle(hInFile);
      if (hOutFile != INVALID_HANDLE_VALUE) CloseHandle(hOutFile);
   }

   return fSuccess;
}

PCCERT_CONTEXT GetCertificateContextFromName | ( | LPTSTR | lpszCertificateName,
 |  | LPTSTR | lpszCertificateStoreName,
 |  | DWORD | dwCertStoreOpenFlags
 | ) |  |

Definition at line 141 of file RSACert.cpp.

{
   PCCERT_CONTEXT pCertContext = NULL;
   HCERTSTORE hCertStore = NULL;
   LPSTR szStoreProvider;
   DWORD dwFindType;

#ifdef UNICODE
   szStoreProvider = (LPSTR)CERT_STORE_PROV_SYSTEM_W;
#else
   szStoreProvider = (LPSTR)CERT_STORE_PROV_SYSTEM_A;
#endif

   // Open the specified certificate store
   hCertStore = CertOpenStore(szStoreProvider,
                     0,
                     NULL,
                     CERT_STORE_READONLY_FLAG|
                     dwCertStoreOpenFlags,
                     lpszCertificateStoreName);
   if (hCertStore == NULL)
   {
      MyPrintf(_T("CertOpenStore failed with %X\n"), GetLastError());
      return pCertContext;
   }

#ifdef UNICODE
   dwFindType = CERT_FIND_SUBJECT_STR_W;
#else
   dwFindType = CERT_FIND_SUBJECT_STR_A;
#endif

   // Find the certificate by CN.
   pCertContext = CertFindCertificateInStore(
                    hCertStore,
                    MY_ENCODING,
                    0,
                    dwFindType,
                    lpszCertificateName,
                    NULL);
   if (pCertContext == NULL)
   {
      MyPrintf(_T("CertFindCertificateInStore failed with %X\n"), GetLastError());
   }

   CertCloseStore(hCertStore, 0);

   return pCertContext;
}

void __cdecl MyPrintf | ( | LPCTSTR | lpszFormat,
 |  |  | ...
 | ) |  |

Definition at line 63 of file RSACert.cpp.

{
   TCHAR szOutput[2048];
   va_list v1 = NULL;
   HRESULT hr = S_OK;

   va_start(v1, lpszFormat);
   hr = StringCbVPrintf(szOutput, sizeof(szOutput), lpszFormat, v1);
   if (SUCCEEDED(hr))
   {
      OutputDebugString(szOutput);
      _tprintf(szOutput);
   }
   else
   {
      _tprintf(_T("StringCbVPrintf failed with %X\n"), hr);
   }
}

void PrintUsage ( void )

Definition at line 54 of file RSACert.cpp.

{
   MyPrintf(_T("RSACert [</e>|</d>] <CertName> <StoreName> [</u>|</m>] <InputFile> <OutputFile>\n"));
   MyPrintf(_T("/e for Encryption\n"));
   MyPrintf(_T("/d for Decryption\n"));
   MyPrintf(_T("/u for current user certificate store\n"));
   MyPrintf(_T("/m for local machine certificate store\n"));
}

Variable Documentation

const int IN_BUFFER_SIZE = 64 * 1024

Definition at line 19 of file RSACert.cpp.

const int OUT_BUFFER_SIZE = IN_BUFFER_SIZE + 8

Definition at line 23 of file RSACert.cpp.

Generated on Wed Nov 13 2024 16:54:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CryptoApi/EncryptDecrypt/RSAKey/RSAKey.cpp File Reference

  • Security
  • CryptoApi
  • EncryptDecrypt
  • RSAKey
Defines | Functions | Variables

RSAKey.cpp File Reference

#include <windows.h>
#include <tchar.h>
#include <stdio.h>
#include <strsafe.h>

Go to the source code of this file.

Defines

#define | _UNICODE
#define | _WIN32_WINNT 0x0400
#define | CheckAndLocalFree(ptr)
#define | UNICODE

Functions

void | _tmain (int argc, TCHAR **argv)
BOOL | EncryptDecryptFile (LPTSTR lpszContainerName, DWORD dwFlags, LPTSTR lpszInputFileName, LPTSTR lpszOutputFileName, BOOL fEncrypt)
void __cdecl | MyPrintf (LPCTSTR lpszFormat,...)
void | PrintUsage ()

Variables

const int | IN_BUFFER_SIZE = 64 * 1024
const int | OUT_BUFFER_SIZE = IN_BUFFER_SIZE + 8

Define Documentation

#define _UNICODE

Definition at line 11 of file RSAKey.cpp.

#define _WIN32_WINNT 0x0400

Definition at line 12 of file RSAKey.cpp.

#define CheckAndLocalFree ( ptr )
Value:
if (ptr != NULL) \
            { \
               LocalFree(ptr); \
               ptr = NULL; \
            }

Definition at line 33 of file RSAKey.cpp.

#define UNICODE

Definition at line 10 of file RSAKey.cpp.

Function Documentation

void _tmain | ( | int | argc,
 |  | TCHAR ** | argv
 | ) |  |

Definition at line 68 of file RSAKey.cpp.

{
   BOOL fEncrypt = FALSE;
   LPTSTR lpszContainerName = NULL;
   LPTSTR lpszInputFileName = NULL;
   LPTSTR lpszOutputFileName = NULL;
   DWORD dwFlags = 0;

   if (argc != 6)
   {
      PrintUsage();
      return;
   }

   /* Check whether the action to be performed is encrypt or decrypt */
   if (_tcsicmp(argv[1], _T("/e")) == 0)
   {
      fEncrypt = TRUE;
   }
   else if (_tcsicmp(argv[1], _T("/d")) == 0)
   {
      fEncrypt = FALSE;
   }
   else
   {
      PrintUsage();
      return;
   }

   lpszContainerName = argv[2];

   /* Check whether to use current user or local machine key container */
   if (_tcsicmp(argv[3], _T("/u")) == 0)
   {
      dwFlags = 0;
   }
   else if (_tcsicmp(argv[3], _T("/m")) == 0)
   {
      dwFlags = CRYPT_MACHINE_KEYSET;
   }
   else
   {
      PrintUsage();
      return;
   }

   lpszInputFileName = argv[4];
   lpszOutputFileName = argv[5];

   EncryptDecryptFile(lpszContainerName,
                        dwFlags,
                        lpszInputFileName,
                        lpszOutputFileName,
                        fEncrypt);
}

BOOL EncryptDecryptFile | ( | LPTSTR | lpszContainerName,
 |  | DWORD | dwFlags,
 |  | LPTSTR | lpszInputFileName,
 |  | LPTSTR | lpszOutputFileName,
 |  | BOOL | fEncrypt
 | ) |  |

Definition at line 124 of file RSAKey.cpp.

{
   BOOL fResult = FALSE;
   HCRYPTPROV hProv = NULL;
   HCRYPTKEY hRSAKey = NULL;
   HCRYPTKEY hSessionKey = NULL;
   HANDLE hInFile = INVALID_HANDLE_VALUE;
   HANDLE hOutFile = INVALID_HANDLE_VALUE;
   BOOL finished = FALSE;
   BYTE pbBuffer[OUT_BUFFER_SIZE];
   DWORD dwByteCount = 0;
   DWORD dwBytesRead = 0;
   DWORD dwBytesWritten = 0;
   LPBYTE pbSessionKeyBlob = NULL;
   DWORD dwSessionKeyBlob = 0;
   BOOL fSuccess = FALSE;

   __try
   {
      // Open the input file to be encrypted or decrypted
      hInFile = CreateFile(lpszInputFileName,
                  GENERIC_READ,
                  0,
                  NULL,
                  OPEN_EXISTING,
                  FILE_ATTRIBUTE_NORMAL,
                  NULL);
      if (hInFile == INVALID_HANDLE_VALUE)
      {
         MyPrintf(_T("CreateFile failed with %d\n"), GetLastError());
         __leave;
      }

      // Open the output file to write the encrypted or decrypted data
      hOutFile = CreateFile(lpszOutputFileName,
                  GENERIC_WRITE,
                  0,
                  NULL,
                  CREATE_ALWAYS,
                  FILE_ATTRIBUTE_NORMAL,
                  NULL);
      if (hOutFile == INVALID_HANDLE_VALUE)
      {
         MyPrintf(_T("CreateFile failed with %d\n"), GetLastError());
         __leave;
      }

      // Acquire context for RSA key
      fResult = CryptAcquireContext(&hProv,
                     lpszContainerName,
                     MS_DEF_PROV,
                     PROV_RSA_FULL,
                     dwFlags);
      if (!fResult)
      {
         if (GetLastError() == NTE_BAD_KEYSET)
         {
            // Create a key container if one does not exist.
            fResult = CryptAcquireContext(&hProv,
                        lpszContainerName,
                        MS_DEF_PROV,
                        PROV_RSA_FULL,
                        CRYPT_NEWKEYSET | dwFlags);
            if (!fResult)
            {
               MyPrintf(_T("CryptAcquireContext (2) failed with %X\n"), GetLastError());
               __leave;
            }
        }
        else
        {
            MyPrintf(_T("CryptAcquireContext (1) failed with %X\n"), GetLastError());
            __leave;
        }
      }

      // Get the RSA key handle
      fResult = CryptGetUserKey(hProv, AT_KEYEXCHANGE, &hRSAKey);
      if (!fResult)
      {
         if (GetLastError() == NTE_NO_KEY)
         {
            // Create a key if one does not exist.
            fResult = CryptGenKey(hProv,
                        AT_KEYEXCHANGE,
                        CRYPT_EXPORTABLE,
                        &hRSAKey);
            if (!fResult)
            {
               MyPrintf(_T("CryptGenKey failed with %X\n"), GetLastError());
               __leave;
            }
         }
         else
         {
            MyPrintf(_T("CryptGetUserKey failed with %X\n"), GetLastError());
            __leave;
         }
      }

      if (fEncrypt)
      {
         fResult = CryptGenKey(hProv, CALG_RC4, CRYPT_EXPORTABLE, &hSessionKey);
         if (!fResult)
         {
            MyPrintf(_T("CryptGenKey failed with %X\n"), GetLastError());
            __leave;
         }

         // The first call to ExportKey with NULL gets the key size.
         dwSessionKeyBlob = 0;
         fResult = CryptExportKey(hSessionKey, hRSAKey, SIMPLEBLOB, 0,
                     NULL, &dwSessionKeyBlob);
         if (!fResult)
         {
            MyPrintf(_T("CryptExportKey failed with %X\n"), GetLastError());
            __leave;
         }

         // Allocate memory for Encrypted Session key blob
         pbSessionKeyBlob = (LPBYTE)LocalAlloc(LPTR, dwSessionKeyBlob);
         if (!pbSessionKeyBlob)
         {
            MyPrintf(_T("LocalAlloc failed with %d\n"), GetLastError());
            __leave;
         }

         fResult = CryptExportKey(hSessionKey, hRSAKey, SIMPLEBLOB, 0,
                     pbSessionKeyBlob, &dwSessionKeyBlob);
         if (!fResult)
         {
            MyPrintf(_T("CryptExportKey failed with %X\n"), GetLastError());
            __leave;
         }

         // Write the size of key blob, then the key blob itself, to output file.
         fResult = WriteFile(hOutFile, &dwSessionKeyBlob,
                     sizeof(dwSessionKeyBlob),
                     &dwBytesWritten, NULL);
         if (!fResult)
         {
            MyPrintf(_T("WriteFile failed with %d\n"), GetLastError());
            __leave;
         }
         fResult = WriteFile(hOutFile, pbSessionKeyBlob,
                     dwSessionKeyBlob,
                     &dwBytesWritten, NULL);
         if (!fResult)
         {
            MyPrintf(_T("WriteFile failed with %d\n"), GetLastError());
            __leave;
         }
      }
      else
      {
         // Read in key block size, then key blob itself from input file.
         fResult = ReadFile(hInFile, &dwByteCount, sizeof(dwByteCount),
               &dwBytesRead, NULL);
         if (!fResult)
         {
            MyPrintf(_T("ReadFile failed with %d\n"), GetLastError());
            __leave;
         }

         fResult = ReadFile(hInFile, pbBuffer, dwByteCount, &dwBytesRead, NULL);
         if (!fResult)
         {
            MyPrintf(_T("ReadFile failed with %d\n"), GetLastError());
            __leave;
         }

         // import key blob into "CSP"
         fResult = CryptImportKey(hProv, pbBuffer, dwByteCount, hRSAKey, 0, &hSessionKey);
         if (!fResult)
         {
            MyPrintf(_T("CryptImportKey failed with %X\n"), GetLastError());
            __leave;
         }
      }

      do
      {
         dwByteCount = 0;

         // Now read data from the input file 64K bytes at a time.
         fResult = ReadFile(hInFile, pbBuffer, IN_BUFFER_SIZE, &dwByteCount, NULL);

         // If the file size is exact multiple of 64K, dwByteCount will be zero after
         // all the data has been read from the input file. In this case, simply break
         // from the while loop. The check to do this is below
         if (dwByteCount == 0)
            break;

         if (!fResult)
         {
            MyPrintf(_T("ReadFile failed with %d\n"), GetLastError());
            __leave;
         }

         finished = (dwByteCount < IN_BUFFER_SIZE);

         // Encrypt/Decrypt depending on the required action.
         if (fEncrypt)
         {
            fResult = CryptEncrypt(hSessionKey, 0, finished, 0, pbBuffer, &dwByteCount,
                           OUT_BUFFER_SIZE);
            if (!fResult)
            {
               MyPrintf(_T("CryptEncrypt failed with %X\n"), GetLastError());
               __leave;
            }
         }
         else
         {
            fResult = CryptDecrypt(hSessionKey, 0, finished, 0, pbBuffer, &dwByteCount);
            if (!fResult)
            {
               MyPrintf(_T("CryptDecrypt failed with %X\n"), GetLastError());
               __leave;
            }
         }

         // Write the encrypted/decrypted data to the output file.
         fResult = WriteFile(hOutFile, pbBuffer, dwByteCount,
            &dwBytesWritten, NULL);
         if (!fResult)
         {
            MyPrintf(_T("WriteFile failed with %d\n"), GetLastError());
            __leave;
         }

      } while (!finished);

      if (fEncrypt)
         MyPrintf(_T("File %s is encrypted successfully!\n"), lpszInputFileName);
      else
         MyPrintf(_T("File %s is decrypted successfully!\n"), lpszInputFileName);

      fSuccess = TRUE;
   }
   __finally
   {
      /* Cleanup */
      CheckAndLocalFree(pbSessionKeyBlob);
      if (hRSAKey != NULL) CryptDestroyKey(hRSAKey);
      if (hSessionKey != NULL) CryptDestroyKey(hSessionKey);
      if (hProv != NULL) CryptReleaseContext(hProv, 0);
      if (hInFile != INVALID_HANDLE_VALUE) CloseHandle(hInFile);
      if (hOutFile != INVALID_HANDLE_VALUE) CloseHandle(hOutFile);
   }

   return fSuccess;
}

void __cdecl MyPrintf | ( | LPCTSTR | lpszFormat,
 |  |  | ...
 | ) |  |

Definition at line 49 of file RSAKey.cpp.

{
   TCHAR szOutput[2048];
   va_list v1 = NULL;
   HRESULT hr = S_OK;

   va_start(v1, lpszFormat);
   hr = StringCbVPrintf(szOutput, sizeof(szOutput), lpszFormat, v1);
   if (SUCCEEDED(hr))
   {
      OutputDebugString(szOutput);
      _tprintf(szOutput);
   }
   else
   {
      _tprintf(_T("StringCbVPrintf failed with %X\n"), hr);
   }
}

void PrintUsage ( void )

Definition at line 40 of file RSAKey.cpp.

{
   MyPrintf(_T("RSAKey [</e>|</d>] <KeyContainerName> [</u>|</m>] <InputFile> <OutputFile>\n"));
   MyPrintf(_T("/e for Encryption\n"));
   MyPrintf(_T("/d for Decryption\n"));
   MyPrintf(_T("/u for current user key container\n"));
   MyPrintf(_T("/m for local machine key container\n"));
}

Variable Documentation

const int IN_BUFFER_SIZE = 64 * 1024

Definition at line 19 of file RSAKey.cpp.

const int OUT_BUFFER_SIZE = IN_BUFFER_SIZE + 8

Definition at line 23 of file RSAKey.cpp.

Generated on Wed Nov 13 2024 16:54:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CryptoApi/EncryptDecrypt/SessionKey/SessionKey.cpp File Reference

  • Security
  • CryptoApi
  • EncryptDecrypt
  • SessionKey
Defines | Functions | Variables

SessionKey.cpp File Reference

#include <windows.h>
#include <tchar.h>
#include <stdio.h>

Go to the source code of this file.

Defines

#define | _WIN32_WINNT 0x0400

Functions

void | _tmain (int argc, TCHAR *argv[])
void | PrintUsage ()

Variables

const int | IN_BUFFER_SIZE = 64 * 1024
const int | OUT_BUFFER_SIZE = IN_BUFFER_SIZE + 8

Define Documentation

#define _WIN32_WINNT 0x0400

Definition at line 10 of file SessionKey.cpp.

Function Documentation

void _tmain | ( | int | argc,
 |  | TCHAR * | argv[]
 | ) |  |

Definition at line 28 of file SessionKey.cpp.

{
   BOOL fResult = FALSE;
   HCRYPTPROV hProv = NULL;
   HCRYPTHASH hHash = NULL;
   HCRYPTKEY hSessionKey = NULL;
   HANDLE hInFile = INVALID_HANDLE_VALUE;
   HANDLE hOutFile = INVALID_HANDLE_VALUE;
   BOOL fEncrypt = FALSE;
   BOOL finished = FALSE;
   BYTE pbBuffer[OUT_BUFFER_SIZE];
   DWORD dwByteCount = 0;
   DWORD dwBytesWritten = 0;

   if (argc != 5)
   {
      PrintUsage();
      return;
   }

   __try
   {
      /* Check whether the action to be performed is encrypt or decrypt */
      if (_tcsicmp(argv[2], _T("/e")) == 0)
      {
         fEncrypt = TRUE;
      }
      else if (_tcsicmp(argv[2], _T("/d")) == 0)
      {
         fEncrypt = FALSE;
      }
      else
      {
         PrintUsage();
         return;
      }

      // Open the input file to be encrypted or decrypted
      hInFile = CreateFile(argv[3],
                  GENERIC_READ,
                  0,
                  NULL,
                  OPEN_EXISTING,
                  FILE_ATTRIBUTE_NORMAL,
                  NULL);
      if (hInFile == INVALID_HANDLE_VALUE)
      {
         _tprintf(_T("CreateFile failed with %d\n"), GetLastError());
         __leave;
      }

      // Open the output file to write the encrypted or decrypted data
      hOutFile = CreateFile(argv[4],
                  GENERIC_WRITE,
                  0,
                  NULL,
                  CREATE_ALWAYS,
                  FILE_ATTRIBUTE_NORMAL,
                  NULL);
      if (hOutFile == INVALID_HANDLE_VALUE)
      {
         _tprintf(_T("CreateFile failed with %d\n"), GetLastError());
         __leave;
      }

      // Acquire a handle to MS_DEF_PROV using CRYPT_VERIFYCONTEXT for dwFlags
      // parameter as we are going to do only session key encryption or decryption
      fResult = CryptAcquireContext(&hProv,
                                    NULL,
                                    MS_DEF_PROV,
                                    PROV_RSA_FULL,
                                    CRYPT_VERIFYCONTEXT);
      if (!fResult)
      {
         _tprintf(_T("CryptAcquireContext failed with %X\n"), GetLastError());
         __leave;
      }

      fResult = CryptCreateHash(hProv, CALG_SHA1, 0, 0, &hHash);
      if (!fResult)
      {
         _tprintf(_T("CryptCreateHash failed with %X\n"), GetLastError());
         __leave;
      }

      // Hash the supplied secret password
      fResult = CryptHashData(hHash, (LPBYTE)argv[1], (DWORD)_tcslen(argv[1]), 0);
      if (!fResult)
      {
         _tprintf(_T("CryptHashData failed with %X\n"), GetLastError());
         __leave;
      }

      // Derive a symmetric session key from password hash
      fResult = CryptDeriveKey(hProv, CALG_RC4, hHash, 0, &hSessionKey);
      if (!fResult)
      {
         _tprintf(_T("CryptDeriveKey failed with %X\n"), GetLastError());
         __leave;
      }

      do
      {
         dwByteCount = 0;

         // Now read data from the input file 64K bytes at a time.
         fResult = ReadFile(hInFile, pbBuffer, IN_BUFFER_SIZE, &dwByteCount, NULL);

         // If the file size is exact multiple of 64K, dwByteCount will be zero after
         // all the data has been read from the input file. In this case, simply break
         // from the while loop. The check to do this is below
         if (dwByteCount == 0)
            break;

         if (!fResult)
         {
            _tprintf(_T("ReadFile failed with %d\n"), GetLastError());
            __leave;
         }

         finished = (dwByteCount < IN_BUFFER_SIZE);

         // Encrypt/Decrypt depending on the required action.
         if (fEncrypt)
         {
            fResult = CryptEncrypt(hSessionKey, 0, finished, 0, pbBuffer, &dwByteCount,
                           OUT_BUFFER_SIZE);
            if (!fResult)
            {
               _tprintf(_T("CryptEncrypt failed with %X\n"), GetLastError());
               __leave;
            }
         }
         else
         {
            fResult = CryptDecrypt(hSessionKey, 0, finished, 0, pbBuffer, &dwByteCount);
            if (!fResult)
            {
               _tprintf(_T("CryptDecrypt failed with %X\n"), GetLastError());
               __leave;
            }
         }

         // Write the encrypted/decrypted data to the output file.
         fResult = WriteFile(hOutFile, pbBuffer, dwByteCount,
            &dwBytesWritten, NULL);
         if (!fResult)
         {
            _tprintf(_T("WriteFile failed with %d\n"), GetLastError());
            __leave;
         }

      } while (!finished);

      if (fEncrypt)
         _tprintf(_T("File %s is encrypted successfully!\n"), argv[3]);
      else
         _tprintf(_T("File %s is decrypted successfully!\n"), argv[3]);
   }
   __finally
   {
      /* Cleanup */
      if (hInFile != INVALID_HANDLE_VALUE) CloseHandle(hInFile);
      if (hOutFile != INVALID_HANDLE_VALUE) CloseHandle(hOutFile);
      if (hSessionKey != NULL) CryptDestroyKey(hSessionKey);
      if (hHash != NULL) CryptDestroyHash(hHash);
      if (hProv != NULL) CryptReleaseContext(hProv, 0);
   }
}

void PrintUsage ( void )

Definition at line 21 of file SessionKey.cpp.

{
   _tprintf(_T("SessionKey <password> [</e>|</d>] <InputFile> <OutputFile>\n"));
   _tprintf(_T("/e for Encryption\n"));
   _tprintf(_T("/d for Decryption\n"));
}

Variable Documentation

const int IN_BUFFER_SIZE = 64 * 1024

Definition at line 15 of file SessionKey.cpp.

const int OUT_BUFFER_SIZE = IN_BUFFER_SIZE + 8

Definition at line 19 of file SessionKey.cpp.

Generated on Wed Nov 13 2024 16:54:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CryptoApi/EnumAlgs/EnumAlgs.c File Reference

  • Security
  • CryptoApi
  • EnumAlgs
Functions

EnumAlgs.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <windows.h>
#include <wincrypt.h>

Go to the source code of this file.

Functions

void _cdecl main (int argc, char *argv[])

Function Documentation

void _cdecl main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 17 of file EnumAlgs.c.

{
   INT iReturn = 0;
   HCRYPTPROV hProv = 0;
   PROV_ENUMALGS EnumAlgs;
   DWORD dwDataLen;
   DWORD dwFlags;
   CHAR *pszAlgType;

   // Get handle to the default provider.
   if (!CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL, 0))
   {
      printf("Error %x during CryptAcquireContext!\n", GetLastError());
      goto Error;
   }

   // Set the CRYPT_FIRST flag the first time through the loop.
   dwFlags = CRYPT_FIRST;

   // Set size of data expected
   dwDataLen = sizeof(PROV_ENUMALGS);

   // Enumerate the supported algorithms.
   while (TRUE)
   {
      // Retrieve information about an algorithm.
      if (!CryptGetProvParam(hProv, PP_ENUMALGS, (LPBYTE)&EnumAlgs, &dwDataLen, dwFlags))
      {
         if (GetLastError() == ERROR_NO_MORE_ITEMS)
         {
            // Exit the loop.
            break;
         }

         printf("Error %x reading algorithm!\n", GetLastError());
         goto Error;
      }

      // Determine algorithm type.
      switch (GET_ALG_CLASS(EnumAlgs.aiAlgid))
      {
      case ALG_CLASS_DATA_ENCRYPT: pszAlgType = "Encrypt";
         break;
      case ALG_CLASS_HASH:         pszAlgType = "Hash";
         break;
      case ALG_CLASS_KEY_EXCHANGE: pszAlgType = "Exchange";
         break;
      case ALG_CLASS_SIGNATURE:    pszAlgType = "Signature";
         break;
      default:                     pszAlgType = "Unknown";
      }

      // Print information about algorithm.
      printf("Name:%-19s  Type:%-9s  Bits:%-4d  Algid:%8.8xh\n",
         EnumAlgs.szName, pszAlgType, EnumAlgs.dwBitLen, EnumAlgs.aiAlgid);

      // Clear the flags for the remaining interations of the loop.
      dwFlags = 0;
   }

Exit:

   // Release CSP handle (if open)
   if (hProv)
   {
      CryptReleaseContext(hProv, 0);
   }

   exit(iReturn);

Error:

   iReturn = 1;
   goto Exit;
}

Generated on Wed Nov 13 2024 16:54:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CryptoApi/InitUser/InitUser.c File Reference

  • Security
  • CryptoApi
  • InitUser
Functions

InitUser.c File Reference

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <wincrypt.h>

Go to the source code of this file.

Functions

void _cdecl main (void)

Function Documentation

void _cdecl main ( void )

Definition at line 16 of file InitUser.c.

{
    INT iReturn = 0;
    HCRYPTPROV hProv = 0;
    LPSTR pszContainerName = NULL;
    DWORD cbContainerName = 0;
    HCRYPTKEY hKey;

    // Attempt to acquire a handle to the default key container.
    if(!CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL, 0)) {

        if(GetLastError() != NTE_BAD_KEYSET) {
            // Some sort of error occured.
            printf("Error opening default key container!\n");
            goto Error;
        }

        // Create default key container.
        if(!CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL, CRYPT_NEWKEYSET)) {

            printf("Error creating default key container!\n");
            goto Error;
        }

        // Get size of the name of the default key container name.
        if(CryptGetProvParam(hProv, PP_CONTAINER, NULL, &cbContainerName, 0)) {

            // Allocate buffer to receive default key container name.
            pszContainerName = malloc(cbContainerName);

            if(pszContainerName) {
                // Get name of default key container name.
                if(!CryptGetProvParam(hProv, PP_CONTAINER, pszContainerName, &cbContainerName, 0)) {
                    // Error getting default key container name.
                    pszContainerName[0] = 0;
                }
            }
        }

        printf("Create key container '%s'\n", pszContainerName ? pszContainerName : "");

        // Free container name buffer (if created)
        if(pszContainerName) {
            free(pszContainerName);
        }
    }

    // Attempt to get handle to signature key.
    if(!CryptGetUserKey(hProv, AT_SIGNATURE, &hKey)) {

        if(GetLastError() != NTE_NO_KEY) {
            printf("Error %x during CryptGetUserKey!\n", GetLastError());
            goto Error;
        }

        // Create signature key pair.
        printf("Create signature key pair\n");

        if(!CryptGenKey(hProv, AT_SIGNATURE, 0, &hKey)) {
            printf("Error %x during CryptGenKey!\n", GetLastError());
            goto Error;
        }
    }

    // Close key handle
    CryptDestroyKey(hKey);

    // Attempt to get handle to exchange key.
    if(!CryptGetUserKey(hProv, AT_KEYEXCHANGE, &hKey)) {

        if(GetLastError() != NTE_NO_KEY) {
            printf("Error %x during CryptGetUserKey!\n", GetLastError());
            goto Error;
        }

        // Create key exchange key pair.
        printf("Create key exchange key pair\n");

        if(!CryptGenKey(hProv, AT_KEYEXCHANGE, 0, &hKey)) {
            printf("Error %x during CryptGenKey!\n", GetLastError());
            goto Error;
        }
    }

    // Close key handle
    CryptDestroyKey(hKey);

    printf("OK\n");

Exit:

    // Close the context (if open)
    if(hProv) {
        CryptReleaseContext(hProv, 0);
    }

    exit(iReturn);

Error:

    iReturn = 1;
    goto Exit;
}

Generated on Wed Nov 13 2024 16:54:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/CryptoApi/SignHash/SignHash.cpp File Reference

  • Security
  • CryptoApi
  • SignHash
Defines | Functions | Variables

SignHash.cpp File Reference

#include <windows.h>
#include <tchar.h>
#include <stdio.h>
#include <strsafe.h>

Go to the source code of this file.

Defines

#define | _UNICODE
#define | _WIN32_WINNT 0x0400
#define | CheckAndLocalFree(ptr)
#define | ENCODING (X509_ASN_ENCODING | PKCS_7_ASN_ENCODING)
#define | UNICODE

Functions

void | _tmain (int argc, TCHAR *argv[])
PCCERT_CONTEXT | GetCertificateContextFromName (LPTSTR lpszCertificateName, LPTSTR lpszCertificateStoreName, DWORD dwCertStoreOpenFlags)
BOOL | GetRSAKeyFromCert (PCCERT_CONTEXT pCertContext, BOOL fSign, HCRYPTPROV *hProv, HCRYPTKEY *hPubKey, DWORD *dwKeySpec, BOOL *fFreeProv)
BOOL | GetRSAKeyFromContainer (LPTSTR szContainerName, DWORD dwAcquireFlags, DWORD dwKeySpec, HCRYPTPROV *hProv, HCRYPTKEY *hPubKey)
void __cdecl | MyPrintf (LPCTSTR lpszFormat,...)
void | PrintUsage ()
BOOL | SignVerifyFile (HCRYPTPROV hProv, HCRYPTKEY hPubKey, DWORD dwKeySpec, ALG_ID HashAlgId, LPTSTR szFileToSign, LPTSTR szSigFile, BOOL fSign)

Variables

const int | BUFFER_SIZE = 4096

Define Documentation

#define _UNICODE

Definition at line 11 of file SignHash.cpp.

#define _WIN32_WINNT 0x0400

Definition at line 12 of file SignHash.cpp.

#define CheckAndLocalFree ( ptr )
Value:
if (ptr != NULL) \
            { \
               LocalFree(ptr); \
               ptr = NULL; \
            }

Definition at line 23 of file SignHash.cpp.

#define ENCODING (X509_ASN_ENCODING | PKCS_7_ASN_ENCODING)

Definition at line 19 of file SignHash.cpp.

#define UNICODE

Definition at line 10 of file SignHash.cpp.

Function Documentation

void _tmain | ( | int | argc,
 |  | TCHAR * | argv[]
 | ) |  |

Definition at line 55 of file SignHash.cpp.

{
   HCRYPTPROV hProv = NULL;
   HCRYPTKEY hPubKey = NULL;
   PCCERT_CONTEXT pCertContext = NULL;
   LPTSTR szCertificateName = NULL;
   LPTSTR szStoreName = NULL;
   LPTSTR szContainerName = NULL;
   LPTSTR szFileToSign = NULL;
   LPTSTR szSigFile = NULL;
   DWORD dwOpenFlags = CERT_SYSTEM_STORE_CURRENT_USER;
   DWORD dwAcquireFlags = 0;
   DWORD dwKeySpec = AT_SIGNATURE;
   ALG_ID AlgId;
   BOOL fSign = FALSE;
   BOOL fResult = FALSE;
   BOOL fUseCert = FALSE;
   BOOL fFreeProv = FALSE;

   if (argc != 9)
   {
      PrintUsage();
      return;
   }

   __try
   {
      // Determine hash algorithm
      if (lstrcmpi(argv[1], _T("sha1")) == 0)
      {
         AlgId = CALG_SHA1;
      }
      else if (lstrcmpi(argv[1], _T("md5")) == 0)
      {
         AlgId = CALG_MD5;
      }
      else
      {
         PrintUsage();
         return;
      }

      /* Check whether the action to be performed is to sign or verify */
      if (lstrcmpi(argv[2], _T("/s")) == 0)
      {
         fSign = TRUE;
      }
      else if (lstrcmpi(argv[2], _T("/v")) == 0)
      {
         fSign = FALSE;
      }
      else
      {
         PrintUsage();
         return;
      }

      szFileToSign = argv[3];
      szSigFile = argv[4];

      // check to see if user wants to use a certificate
      if (lstrcmpi(argv[5], _T("/cert")) == 0)
      {
         fUseCert = TRUE;

         szCertificateName = argv[6];
         szStoreName = argv[7];

         // Determine if we have to use user or machine store
         if (lstrcmpi(argv[8], _T("u")) == 0)
         {
            dwOpenFlags = CERT_SYSTEM_STORE_CURRENT_USER;
         }
         else if (lstrcmpi(argv[8], _T("m")) == 0)
         {
            dwOpenFlags = CERT_SYSTEM_STORE_LOCAL_MACHINE;
         }
         else
         {
            PrintUsage();
            return;
         }
      }
      else if (lstrcmpi(argv[5], _T("/key")) == 0)
      {
         fUseCert = FALSE;

         szContainerName = argv[6];

         if (lstrcmpi(argv[7], _T("u")) == 0)
         {
            dwAcquireFlags = 0;
         }
         else if (lstrcmpi(argv[7], _T("m")) == 0)
         {
            dwAcquireFlags = CRYPT_MACHINE_KEYSET;
         }
         else
         {
            PrintUsage();
            return;
         }

         // Use exchange key or signature key
         if (lstrcmpi(argv[8], _T("x")) == 0)
         {
            dwKeySpec = AT_KEYEXCHANGE;
         }
         else if (lstrcmpi(argv[8], _T("s")) == 0)
         {
            dwKeySpec = AT_SIGNATURE;
         }
         else
         {
            PrintUsage();
            return;
         }
      }
      else
      {
         PrintUsage();
         return;
      }

      if (fUseCert)
      {
         pCertContext = GetCertificateContextFromName(szCertificateName,
                                                      szStoreName,
                                                      dwOpenFlags);
         if (!pCertContext) __leave;

         fResult = GetRSAKeyFromCert(pCertContext,
                                     fSign,
                                     &hProv,
                                     &hPubKey,
                                     &dwKeySpec,
                                     &fFreeProv);
         if (!fResult) __leave;
      }
      else
      {
         fResult = GetRSAKeyFromContainer(szContainerName,
                                          dwAcquireFlags,
                                          dwKeySpec,
                                          &hProv,
                                          &hPubKey);
         if (!fResult) __leave;

         fFreeProv = TRUE;
      }

      fResult = SignVerifyFile(hProv,
                               hPubKey,
                               dwKeySpec,
                               AlgId,
                               szFileToSign,
                               szSigFile,
                               fSign);
      if (!fResult) __leave;

      if (fSign)
      {
         MyPrintf(_T("File %s hashed and signed successfully!\n"), szFileToSign);
      }
      else
      {
         MyPrintf(_T("File %s verified successfully!\n"), szSigFile);
      }
   }
   __finally
   {
      // Clean up
      if (hPubKey != NULL) CryptDestroyKey(hPubKey);
      if (fFreeProv && (hProv != NULL)) CryptReleaseContext(hProv, 0);
      if (pCertContext != NULL) CertFreeCertificateContext(pCertContext);
   }
}

PCCERT_CONTEXT GetCertificateContextFromName | ( | LPTSTR | lpszCertificateName,
 |  | LPTSTR | lpszCertificateStoreName,
 |  | DWORD | dwCertStoreOpenFlags
 | ) |  |

Definition at line 399 of file SignHash.cpp.

{
   PCCERT_CONTEXT pCertContext = NULL;
   HCERTSTORE hCertStore = NULL;
   LPSTR szStoreProvider;
   DWORD dwFindType;

#ifdef UNICODE
   szStoreProvider = (LPSTR)CERT_STORE_PROV_SYSTEM_W;
#else
   szStoreProvider = (LPSTR)CERT_STORE_PROV_SYSTEM_A;
#endif

      // Open the specified certificate store
   hCertStore = CertOpenStore(szStoreProvider,
                              0,
                              NULL,
                              dwCertStoreOpenFlags|
                              CERT_STORE_READONLY_FLAG,
                              lpszCertificateStoreName);
   if (hCertStore == NULL)
   {
      MyPrintf(_T("CertOpenStore failed with %X\n"), GetLastError());
      return pCertContext;
   }

#ifdef UNICODE
   dwFindType = CERT_FIND_SUBJECT_STR_W;
#else
   dwFindType = CERT_FIND_SUBJECT_STR_A;
#endif

   // Find the certificate by CN.
   pCertContext = CertFindCertificateInStore(hCertStore,
                                             ENCODING,
                                             0,
                                             dwFindType,
                                             lpszCertificateName,
                                             NULL);
   if (pCertContext == NULL)
   {
      MyPrintf(_T("CertFindCertificateInStore failed with %X\n"), GetLastError());
   }

   CertCloseStore(hCertStore, 0);

   return pCertContext;
}

BOOL GetRSAKeyFromCert | ( | PCCERT_CONTEXT | pCertContext,
 |  | BOOL | fSign,
 |  | HCRYPTPROV * | hProv,
 |  | HCRYPTKEY * | hPubKey,
 |  | DWORD * | dwKeySpec,
 |  | BOOL * | fFreeProv
 | ) |  |

Definition at line 451 of file SignHash.cpp.

{
   BOOL fResult;
   BOOL fReturn = FALSE;

   __try
   {
      if (hProv == NULL || hPubKey == NULL ||
          dwKeySpec == NULL || fFreeProv == NULL)
      {
         __leave;
      }

      *hProv = 0;
      *hPubKey = 0;
      *fFreeProv = FALSE;

      if (fSign)
      {
         // Acquire the certificate's private key
         fResult = CryptAcquireCertificatePrivateKey(pCertContext,
                                                     CRYPT_ACQUIRE_USE_PROV_INFO_FLAG|
                                                     CRYPT_ACQUIRE_COMPARE_KEY_FLAG,
                                                     NULL,
                                                     hProv,
                                                     dwKeySpec,
                                                     fFreeProv);
         if (!fResult)
         {
            MyPrintf(_T("CryptAcquireCertificatePrivateKey failed with %x\n"), GetLastError());
            __leave;
         }
      }
      else
      {
         fResult = CryptAcquireContext(hProv,
                                       NULL,
                                       MS_DEF_PROV,
                                       PROV_RSA_FULL,
                                       CRYPT_VERIFYCONTEXT);
         if (!fResult)
         {
            MyPrintf(_T("CryptAcquireContext failed with %x\n"), GetLastError());
            __leave;
         }

         *fFreeProv = TRUE;

         // Import the public key from the certificate so we can verify
         fResult = CryptImportPublicKeyInfo(*hProv,
                                            ENCODING,
                                            &(pCertContext->pCertInfo->SubjectPublicKeyInfo),
                                            hPubKey);
         if (!fResult)
         {
            MyPrintf(_T("CryptImportPublicKeyInfo failed with %x\n"), GetLastError());
            __leave;
         }
      }

      fReturn = TRUE;
   }
   __finally
   {
      if (!fReturn)
      {
         if (*hPubKey != NULL)
         {
            CryptDestroyKey(*hPubKey);
            *hPubKey = NULL;
         }

         if ((*fFreeProv == TRUE) && (*hProv != NULL))
         {
            CryptReleaseContext(*hProv, 0);
            *hProv = NULL;
            *fFreeProv = FALSE;
         }
      }
   }

   return fReturn;
}

BOOL GetRSAKeyFromContainer | ( | LPTSTR | szContainerName,
 |  | DWORD | dwAcquireFlags,
 |  | DWORD | dwKeySpec,
 |  | HCRYPTPROV * | hProv,
 |  | HCRYPTKEY * | hPubKey
 | ) |  |

Definition at line 540 of file SignHash.cpp.

{
   BOOL fResult;
   BOOL fReturn = FALSE;

   __try
   {
      if (hProv == NULL || hPubKey == NULL)
      {
         __leave;
      }

      // acquire crypto context using container name
      fResult = CryptAcquireContext(hProv,
                                    szContainerName,
                                    MS_DEF_PROV,
                                    PROV_RSA_FULL,
                                    dwAcquireFlags);
      if (!fResult)
      {
         MyPrintf(_T("CryptAcquireContext failed with %x\n"), GetLastError());
         __leave;
      }

      // Get the key handle for verification
      fResult = CryptGetUserKey(*hProv, dwKeySpec, hPubKey);
      if (!fResult)
      {
         MyPrintf(_T("CryptGetUserKey failed with %x\n"), GetLastError());
         __leave;
      }

      fReturn = TRUE;
   }
   __finally
   {
      if (!fReturn)
      {
         if (*hPubKey != NULL)
         {
            CryptDestroyKey(*hPubKey);
            *hPubKey = NULL;
         }

         if (*hProv != NULL)
         {
            CryptReleaseContext(*hProv, 0);
            *hProv = NULL;
         }
      }
   }

   return fReturn;
}

void __cdecl MyPrintf | ( | LPCTSTR | lpszFormat,
 |  |  | ...
 | ) |  |

Definition at line 599 of file SignHash.cpp.

{
   TCHAR szOutput[2048];
   va_list v1 = NULL;
   HRESULT hr = S_OK;

   va_start(v1, lpszFormat);
   hr = StringCbVPrintf(szOutput, sizeof(szOutput), lpszFormat, v1);
   if (SUCCEEDED(hr))
   {
      OutputDebugString(szOutput);
      _tprintf(szOutput);
   }
   else
   {
      _tprintf(_T("StringCbVPrintf failed with %X\n"), hr);
   }
}

void PrintUsage ( void )

Definition at line 618 of file SignHash.cpp.

{
   MyPrintf(_T("SignHash [md5|sha1] [</s>|</v>] <DataFile> <SigFile> [</cert>|</key>]\n"));
   MyPrintf(_T("/s to Sign.\n"));
   MyPrintf(_T("/v to Verify.\n"));
   MyPrintf(_T("/cert <CertName> <StoreName> [<u>|<m>] - use a certificate.\n"));
   MyPrintf(_T("/key <ContainerName> [<u>|<m>] [<x>|<s>] use container with exchange or signature key.\n"));
}

BOOL SignVerifyFile | ( | HCRYPTPROV | hProv,
 |  | HCRYPTKEY | hPubKey,
 |  | DWORD | dwKeySpec,
 |  | ALG_ID | HashAlgId,
 |  | LPTSTR | szFileToSign,
 |  | LPTSTR | szSigFile,
 |  | BOOL | fSign
 | ) |  |

Definition at line 233 of file SignHash.cpp.

{
   HCRYPTHASH hHash = NULL;
   HANDLE hDataFile = INVALID_HANDLE_VALUE;
   HANDLE hSigFile = INVALID_HANDLE_VALUE;
   LPBYTE pbSignature = NULL;
   DWORD dwSignature;
   BYTE pbBuffer[BUFFER_SIZE];
   DWORD dwBytesRead, dwBytesWritten;
   BOOL fResult;
   BOOL fFinished = FALSE;
   BOOL fReturn = FALSE;

   __try
   {
      // Open Data file
      hDataFile = CreateFile(szFileToSign,
                             GENERIC_READ,
                             0,
                             NULL,
                             OPEN_EXISTING,
                             FILE_ATTRIBUTE_NORMAL,
                             NULL);
      if (hDataFile == INVALID_HANDLE_VALUE)
      {
         MyPrintf(_T("CreateFile failed with %d\n"), GetLastError());
         __leave;
      }

      // Open/Create signature file
      hSigFile = CreateFile(szSigFile,
                            GENERIC_READ|GENERIC_WRITE,
                            0,
                            NULL,
                            OPEN_ALWAYS,
                            FILE_ATTRIBUTE_NORMAL,
                            NULL);
      if (hSigFile == INVALID_HANDLE_VALUE)
      {
         MyPrintf(_T("CreateFile failed with %d\n"), GetLastError());
         __leave;
      }

      // Create Hash
      fResult = CryptCreateHash(hProv, HashAlgId, 0, 0, &hHash);
      if (!fResult)
      {
         MyPrintf(_T("CryptCreateHash failed with %x\n"), GetLastError());
         __leave;
      }

      // Loop through file and hash file contents
      do
      {
         dwBytesRead = 0;

         fResult = ReadFile(hDataFile, pbBuffer, BUFFER_SIZE, &dwBytesRead, NULL);

         if (dwBytesRead == 0) break;

         if (!fResult)
         {
            MyPrintf(_T("ReadFile failed with %d\n"), GetLastError());
            __leave;
         }

         fFinished = (dwBytesRead < BUFFER_SIZE);

         fResult = CryptHashData(hHash, pbBuffer, dwBytesRead, 0);
         if (!fResult)
         {
            MyPrintf(_T("CryptHashData failed with %x\n"), GetLastError());
            __leave;
         }

      } while (fFinished == FALSE);

      if (fSign)
      {
         // Get Signature size
         fResult = CryptSignHash(hHash, dwKeySpec, NULL, 0, NULL, &dwSignature);
         if (!fResult)
         {
            MyPrintf(_T("CryptSignHash failed with %x\n"), GetLastError());
            __leave;
         }

         // Allocate signature bytes
         pbSignature = (LPBYTE)LocalAlloc(LPTR, dwSignature);
         if (!pbSignature)
         {
            MyPrintf(_T("LocalAlloc failed with %d\n"), GetLastError());
            __leave;
         }

         // Sign and get back signature
         fResult = CryptSignHash(hHash, dwKeySpec, NULL, 0, pbSignature, &dwSignature);
         if (!fResult)
         {
            MyPrintf(_T("CryptSignHash failed with %x\n"), GetLastError());
            __leave;
         }

         // Write signature to file
         fResult = WriteFile(hSigFile, pbSignature, dwSignature, &dwBytesWritten, NULL);
         if (!fResult)
         {
            MyPrintf(_T("WriteFile failed with %d\n"), GetLastError());
            __leave;
         }
      }
      else
      {
         // Get size of signature file
         dwSignature = GetFileSize(hSigFile, NULL);
         if (dwSignature == INVALID_FILE_SIZE)
         {
            MyPrintf(_T("GetFileSize failed with %d\n"), GetLastError());
            __leave;
         }

         // Allocate signature bytes
         pbSignature = (LPBYTE)LocalAlloc(LPTR, dwSignature);
         if (!pbSignature)
         {
            MyPrintf(_T("LocalAlloc failed with %d\n"), GetLastError());
            __leave;
         }

         // Read Signature
         fResult = ReadFile(hSigFile, pbSignature, dwSignature, &dwBytesRead, NULL);
         if (!fResult)
         {
            MyPrintf(_T("ReadFile failed with %d\n"), GetLastError());
            __leave;
         }

         // Verify Signature
         fResult = CryptVerifySignature(hHash, pbSignature, dwSignature, hPubKey, NULL, 0);
         if (!fResult)
         {
            MyPrintf(_T("CryptVerifySignature failed with %x\n"), GetLastError());
            __leave;
         }
      }

      fReturn = TRUE;
   }
   __finally
   {
      // Clean up
      if (hHash != NULL) CryptDestroyHash(hHash);
      if (hDataFile != INVALID_HANDLE_VALUE) CloseHandle(hDataFile);
      if (hSigFile != INVALID_HANDLE_VALUE) CloseHandle(hSigFile);
      CheckAndLocalFree(pbSignature);
   }

   return fReturn;
}

Variable Documentation

const int BUFFER_SIZE = 4096

Definition at line 21 of file SignHash.cpp.

Generated on Wed Nov 13 2024 16:54:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/GINA/GinaHook/GinaDlg.c File Reference

  • Security
  • GINA
  • GinaHook
Defines | Functions

GinaDlg.c File Reference

#include <windows.h>
#include <winwlx.h>
#include <assert.h>
#include <lm.h>
#include "Ginahook.h"

Go to the source code of this file.

Defines

#define | _WIN32_WINNT 0x0400
#define | IDC_WLXLOGGEDOUTSAS_DOMAIN 1455
#define | IDC_WLXLOGGEDOUTSAS_PASSWORD 1454
#define | IDC_WLXLOGGEDOUTSAS_USERNAME 1453
#define | IDC_WLXWKSTALOCKEDSAS_DOMAIN 1856
#define | IDD_CHANGE_PASSWORD_DIALOG 1550
#define | IDD_WLXDIAPLAYSASNOTICE_DIALOG 1400
#define | IDD_WLXLOGGEDONSAS_DIALOG 1650
#define | IDD_WLXLOGGEDOUTSAS_DIALOG 1450
#define | IDD_WLXWKSTALOCKEDSAS_DIALOG 1850

Functions

void | HookWlxDialogBoxParam (PVOID pWinlogonFunctions, DWORD dwWlxVersion)
BOOL CALLBACK | MyChangePasswordDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
int WINAPI | MyWlxDialogBoxParam (HANDLE, HANDLE, LPWSTR, HWND, DLGPROC, LPARAM)
BOOL CALLBACK | MyWlxLoggedOutSASDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
BOOL CALLBACK | MyWlxWkstaLockedSASDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)

Define Documentation

#define _WIN32_WINNT 0x0400

Definition at line 17 of file GinaDlg.c.

#define IDC_WLXLOGGEDOUTSAS_DOMAIN 1455

Definition at line 40 of file GinaDlg.c.

#define IDC_WLXLOGGEDOUTSAS_PASSWORD 1454

Definition at line 39 of file GinaDlg.c.

#define IDC_WLXLOGGEDOUTSAS_USERNAME 1453

Definition at line 38 of file GinaDlg.c.

#define IDC_WLXWKSTALOCKEDSAS_DOMAIN 1856

Definition at line 41 of file GinaDlg.c.

#define IDD_CHANGE_PASSWORD_DIALOG 1550

Definition at line 31 of file GinaDlg.c.

#define IDD_WLXDIAPLAYSASNOTICE_DIALOG 1400

Definition at line 29 of file GinaDlg.c.

#define IDD_WLXLOGGEDONSAS_DIALOG 1650

Definition at line 32 of file GinaDlg.c.

#define IDD_WLXLOGGEDOUTSAS_DIALOG 1450

Definition at line 30 of file GinaDlg.c.

#define IDD_WLXWKSTALOCKEDSAS_DIALOG 1850

Definition at line 33 of file GinaDlg.c.

Function Documentation

void HookWlxDialogBoxParam | ( | PVOID | pWinlogonFunctions,
 |  | DWORD | dwWlxVersion
 | ) |  |

Definition at line 73 of file GinaDlg.c.

{
   //
   // Hook WlxDialogBoxParam(). Note that we chould cheat here by always
   // casting to (PWLX_DISPATCH_VERSION_1_0) since WlxDialogBoxParam()
   // exists in all versions and is always in the same location of the
   // dispatch table. But, we will do it the hard way!
   //
   switch (dwWlxVersion)
   {
      case WLX_VERSION_1_0:
      {
         pfWlxDialogBoxParam =
            ((PWLX_DISPATCH_VERSION_1_0) pWinlogonFunctions)->WlxDialogBoxParam;
         ((PWLX_DISPATCH_VERSION_1_0) pWinlogonFunctions)->WlxDialogBoxParam =
            MyWlxDialogBoxParam;
         break;
      }

      case WLX_VERSION_1_1:
      {
         pfWlxDialogBoxParam =
            ((PWLX_DISPATCH_VERSION_1_1) pWinlogonFunctions)->WlxDialogBoxParam;
         ((PWLX_DISPATCH_VERSION_1_1) pWinlogonFunctions)->WlxDialogBoxParam =
            MyWlxDialogBoxParam;
         break;
      }

      case WLX_VERSION_1_2:
      {
         pfWlxDialogBoxParam =
            ((PWLX_DISPATCH_VERSION_1_2) pWinlogonFunctions)->WlxDialogBoxParam;
         ((PWLX_DISPATCH_VERSION_1_2) pWinlogonFunctions)->WlxDialogBoxParam =
            MyWlxDialogBoxParam;
         break;
      }

      default:
      {
         pfWlxDialogBoxParam =
            ((PWLX_DISPATCH_VERSION_1_3) pWinlogonFunctions)->WlxDialogBoxParam;
         ((PWLX_DISPATCH_VERSION_1_3) pWinlogonFunctions)->WlxDialogBoxParam =
            MyWlxDialogBoxParam;
         break;
      }
   }
}

BOOL CALLBACK MyChangePasswordDlgProc | ( | HWND | hwndDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 258 of file GinaDlg.c.

{
   BOOL bResult;

   //
   // Sanity check.
   //
   assert(pfChangePasswordDlgProc != NULL);

   //
   // Pass on to MSGINA first.
   //
   bResult = pfChangePasswordDlgProc(hwndDlg, uMsg, wParam, lParam);

   //
   // We are only interested in WM_INITDIALOG message.
   //
   if (uMsg == WM_INITDIALOG)
   {
      //
      // Manipulate the dialog box to match your needs here. For example,
      // you can add a static control to the dialog box or display another
      // message to clearly explain the rules for composing a valid password.
      //
   }

   return bResult;
}

int WINAPI MyWlxDialogBoxParam | ( | HANDLE | hWlx,
 |  | HANDLE | hInst,
 |  | LPWSTR | lpszTemplate,
 |  | HWND | hwndOwner,
 |  | DLGPROC | dlgprc,
 |  | LPARAM | dwInitParam
 | ) |  |

Definition at line 297 of file GinaDlg.c.

{
   //
   // Sanity check.
   //
   assert(pfWlxDialogBoxParam != NULL);

   //
   // We only know MSGINA dialogs by identifiers.
   //
   if (!HIWORD(lpszTemplate))
   {
      //
      // Hook appropriate dialog boxes as necessary.
      //
      switch ((DWORD) lpszTemplate)
      {
         case IDD_WLXLOGGEDOUTSAS_DIALOG:
         {
            pfWlxLoggedOutSASDlgProc = dlgprc;
            return pfWlxDialogBoxParam(hWlx, hInst, lpszTemplate, hwndOwner,
                                       MyWlxLoggedOutSASDlgProc, dwInitParam);
         }

         case IDD_WLXWKSTALOCKEDSAS_DIALOG:
         {
            pfWlxWkstaLockedSASDlgProc = dlgprc;
            return pfWlxDialogBoxParam(hWlx, hInst, lpszTemplate, hwndOwner,
                                       MyWlxWkstaLockedSASDlgProc, dwInitParam);
         }

         case IDD_CHANGE_PASSWORD_DIALOG:
         {
            pfChangePasswordDlgProc = dlgprc;
            return pfWlxDialogBoxParam(hWlx, hInst, lpszTemplate, hwndOwner,
                                       MyChangePasswordDlgProc, dwInitParam);
         }
      }
   }

   //
   // The rest will not be redirected.
   //
   return pfWlxDialogBoxParam(hWlx, hInst, lpszTemplate,
                              hwndOwner, dlgprc, dwInitParam);
}

BOOL CALLBACK MyWlxLoggedOutSASDlgProc | ( | HWND | hwndDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 128 of file GinaDlg.c.

{
   BOOL bResult;

   //
   // Sanity check.
   //
   assert(pfWlxLoggedOutSASDlgProc != NULL);

   //
   // Pass on to MSGINA first.
   //
   bResult = pfWlxLoggedOutSASDlgProc(hwndDlg, uMsg, wParam, lParam);

   //
   // We are only interested in WM_INITDIALOG message.
   //
   if (uMsg == WM_INITDIALOG)
   {
      DWORD dwIndex;
      HWND hwndDomain;
      NET_API_STATUS netstatus;
      LPWKSTA_INFO_100 lpWkstaInfo;

      //
      // Get local machine name.
      //
      netstatus = NetWkstaGetInfo(NULL, 100, (LPBYTE *) &lpWkstaInfo);
      if (netstatus != NERR_Success)
      {
         return bResult;
      }

      //
      // Convert to ANSI.
      //
      wcstombs(g_szLocalMachineName, lpWkstaInfo->wki100_computername,
               sizeof(g_szLocalMachineName));

      //
      // and free the buffer.
      //
      NetApiBufferFree((LPVOID) lpWkstaInfo);

      //
      // Manipulate the domain combo box so that only some predetermined
      // trusted domains are included in the list.
      //
      // In our case, we restrict logon to local machine only.
      //
      hwndDomain = GetDlgItem(hwndDlg, IDC_WLXLOGGEDOUTSAS_DOMAIN);
      if (hwndDomain == NULL)
      {
         return bResult;
      }

      dwIndex = (DWORD) SendMessage(hwndDomain, CB_FINDSTRING,
                                    0, (LPARAM) g_szLocalMachineName);
      if (dwIndex != CB_ERR)
      {
         SendMessage(hwndDomain, CB_SETCURSEL, (WPARAM) dwIndex, 0);
         EnableWindow(hwndDomain, FALSE);
      }
   }

   return bResult;
}

BOOL CALLBACK MyWlxWkstaLockedSASDlgProc | ( | HWND | hwndDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 206 of file GinaDlg.c.

{
   BOOL bResult;

   //
   // Sanity check.
   //
   assert(pfWlxWkstaLockedSASDlgProc != NULL);

   //
   // Pass on to MSGINA first.
   //
   bResult = pfWlxWkstaLockedSASDlgProc(hwndDlg, uMsg, wParam, lParam);

   //
   // We are only interested in WM_INITDIALOG message.
   //
   if (uMsg == WM_INITDIALOG)
   {
      DWORD dwIndex;

      //
      // Make sure to cover this hole.
      //
      HWND hwndDomain = GetDlgItem(hwndDlg, IDC_WLXWKSTALOCKEDSAS_DOMAIN);
      if (hwndDomain == NULL)
      {
         return bResult;
      }

      dwIndex = (DWORD) SendMessage(hwndDomain, CB_FINDSTRING,
                                    0, (LPARAM) g_szLocalMachineName);
      if (dwIndex != CB_ERR)
      {
         SendMessage(hwndDomain, CB_SETCURSEL, (WPARAM) dwIndex, 0);
         EnableWindow(hwndDomain, FALSE);
      }
   }

   return bResult;
}

Generated on Wed Nov 13 2024 16:54:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/GINA/GinaHook/GinaDlg.h File Reference

  • Security
  • GINA
  • GinaHook
Functions

GinaDlg.h File Reference

Go to the source code of this file.

Functions

void HookWlxDialogBoxParam (PVOID pWinlogonFunctions, DWORD dwWlxVersion)

Function Documentation

void HookWlxDialogBoxParam | ( | PVOID | pWinlogonFunctions,
 |  | DWORD | dwWlxVersion
 | ) |  |

Definition at line 73 of file GinaDlg.c.

{
   //
   // Hook WlxDialogBoxParam(). Note that we chould cheat here by always
   // casting to (PWLX_DISPATCH_VERSION_1_0) since WlxDialogBoxParam()
   // exists in all versions and is always in the same location of the
   // dispatch table. But, we will do it the hard way!
   //
   switch (dwWlxVersion)
   {
      case WLX_VERSION_1_0:
      {
         pfWlxDialogBoxParam =
            ((PWLX_DISPATCH_VERSION_1_0) pWinlogonFunctions)->WlxDialogBoxParam;
         ((PWLX_DISPATCH_VERSION_1_0) pWinlogonFunctions)->WlxDialogBoxParam =
            MyWlxDialogBoxParam;
         break;
      }

      case WLX_VERSION_1_1:
      {
         pfWlxDialogBoxParam =
            ((PWLX_DISPATCH_VERSION_1_1) pWinlogonFunctions)->WlxDialogBoxParam;
         ((PWLX_DISPATCH_VERSION_1_1) pWinlogonFunctions)->WlxDialogBoxParam =
            MyWlxDialogBoxParam;
         break;
      }

      case WLX_VERSION_1_2:
      {
         pfWlxDialogBoxParam =
            ((PWLX_DISPATCH_VERSION_1_2) pWinlogonFunctions)->WlxDialogBoxParam;
         ((PWLX_DISPATCH_VERSION_1_2) pWinlogonFunctions)->WlxDialogBoxParam =
            MyWlxDialogBoxParam;
         break;
      }

      default:
      {
         pfWlxDialogBoxParam =
            ((PWLX_DISPATCH_VERSION_1_3) pWinlogonFunctions)->WlxDialogBoxParam;
         ((PWLX_DISPATCH_VERSION_1_3) pWinlogonFunctions)->WlxDialogBoxParam =
            MyWlxDialogBoxParam;
         break;
      }
   }
}

Generated on Wed Nov 13 2024 16:54:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/GINA/GinaHook/GinaHook.c File Reference

  • Security
  • GINA
  • GinaHook
Defines | Functions

GinaHook.c File Reference

#include <windows.h>
#include <winwlx.h>
#include "Ginahook.h"
#include "GinaDlg.h"

Go to the source code of this file.

Defines

#define | _WIN32_WINNT 0x0400
#define | GINASTUB_VERSION (WLX_VERSION_1_3)
#define | REALGINA_PATH TEXT("MSGINA.DLL")

Functions

BOOL | MyInitialize (HINSTANCE hDll, DWORD dwWlxVersion)
BOOL WINAPI | WlxActivateUserShell (PVOID pWlxContext, PWSTR pszDesktopName, PWSTR pszMprLogonScript, PVOID pEnvironment)
VOID WINAPI | WlxDisplayLockedNotice (PVOID pWlxContext)
VOID WINAPI | WlxDisplaySASNotice (PVOID pWlxContext)
BOOL WINAPI | WlxDisplayStatusMessage (PVOID pWlxContext, HDESK hDesktop, DWORD dwOptions, PWSTR pTitle, PWSTR pMessage)
BOOL WINAPI | WlxGetStatusMessage (PVOID pWlxContext, DWORD *pdwOptions, PWSTR pMessage, DWORD dwBufferSize)
BOOL WINAPI | WlxInitialize (LPWSTR lpWinsta, HANDLE hWlx, PVOID pvReserved, PVOID pWinlogonFunctions, PVOID *pWlxContext)
BOOL WINAPI | WlxIsLockOk (PVOID pWlxContext)
BOOL WINAPI | WlxIsLogoffOk (PVOID pWlxContext)
int WINAPI | WlxLoggedOnSAS (PVOID pWlxContext, DWORD dwSasType, PVOID pReserved)
int WINAPI | WlxLoggedOutSAS (PVOID pWlxContext, DWORD dwSasType, PLUID pAuthenticationId, PSID pLogonSid, PDWORD pdwOptions, PHANDLE phToken, PWLX_MPR_NOTIFY_INFO pMprNotifyInfo, PVOID *pProfile)
VOID WINAPI | WlxLogoff (PVOID pWlxContext)
BOOL WINAPI | WlxNegotiate (DWORD dwWinlogonVersion, DWORD *pdwDllVersion)
BOOL WINAPI | WlxNetworkProviderLoad (PVOID pWlxContext, PWLX_MPR_NOTIFY_INFO pNprNotifyInfo)
BOOL WINAPI | WlxRemoveStatusMessage (PVOID pWlxContext)
BOOL WINAPI | WlxScreenSaverNotify (PVOID pWlxContext, BOOL *pSecure)
VOID WINAPI | WlxShutdown (PVOID pWlxContext, DWORD ShutdownType)
BOOL WINAPI | WlxStartApplication (PVOID pWlxContext, PWSTR pszDesktopName, PVOID pEnvironment, PWSTR pszCmdLine)
int WINAPI | WlxWkstaLockedSAS (PVOID pWlxContext, DWORD dwSasType)

Define Documentation

#define _WIN32_WINNT 0x0400

Definition at line 17 of file GinaHook.c.

#define GINASTUB_VERSION (WLX_VERSION_1_3)

Definition at line 30 of file GinaHook.c.

#define REALGINA_PATH TEXT("MSGINA.DLL")

Definition at line 29 of file GinaHook.c.

Function Documentation

BOOL MyInitialize | ( | HINSTANCE | hDll,
 |  | DWORD | dwWlxVersion
 | ) |  |

Definition at line 83 of file GinaHook.c.

{
   //
   // Get pointers to all of the WLX functions in the real MSGINA.
   //
   pfWlxInitialize =
      (PFWLXINITIALIZE) GetProcAddress(hDll, "WlxInitialize");
   if (!pfWlxInitialize)
   {
      return FALSE;
   }

   pfWlxDisplaySASNotice =
      (PFWLXDISPLAYSASNOTICE) GetProcAddress(hDll, "WlxDisplaySASNotice");
   if (!pfWlxDisplaySASNotice)
   {
      return FALSE;
   }

   pfWlxLoggedOutSAS =
      (PFWLXLOGGEDOUTSAS) GetProcAddress(hDll, "WlxLoggedOutSAS");
   if (!pfWlxLoggedOutSAS)
   {
      return FALSE;
   }

   pfWlxActivateUserShell =
      (PFWLXACTIVATEUSERSHELL) GetProcAddress(hDll, "WlxActivateUserShell");
   if (!pfWlxActivateUserShell)
   {
      return FALSE;
   }

   pfWlxLoggedOnSAS =
      (PFWLXLOGGEDONSAS) GetProcAddress(hDll, "WlxLoggedOnSAS");
   if (!pfWlxLoggedOnSAS)
   {
      return FALSE;
   }

   pfWlxDisplayLockedNotice =
      (PFWLXDISPLAYLOCKEDNOTICE) GetProcAddress(hDll, "WlxDisplayLockedNotice");
   if (!pfWlxDisplayLockedNotice)
   {
      return FALSE;
   }

   pfWlxIsLockOk =
      (PFWLXISLOCKOK) GetProcAddress(hDll, "WlxIsLockOk");
   if (!pfWlxIsLockOk)
   {
      return FALSE;
   }

   pfWlxWkstaLockedSAS =
       (PFWLXWKSTALOCKEDSAS) GetProcAddress(hDll, "WlxWkstaLockedSAS");
   if (!pfWlxWkstaLockedSAS)
   {
      return FALSE;
   }

   pfWlxIsLogoffOk =
      (PFWLXISLOGOFFOK) GetProcAddress(hDll, "WlxIsLogoffOk");
   if (!pfWlxIsLogoffOk)
   {
      return FALSE;
   }

   pfWlxLogoff =
      (PFWLXLOGOFF) GetProcAddress(hDll, "WlxLogoff");
   if (!pfWlxLogoff)
   {
      return FALSE;
   }

   pfWlxShutdown =
      (PFWLXSHUTDOWN) GetProcAddress(hDll, "WlxShutdown");
   if (!pfWlxShutdown)
   {
      return FALSE;
   }

   //
   // Load functions for version 1.1 as necessary.
   //
   if (dwWlxVersion > WLX_VERSION_1_0)
   {
      pfWlxStartApplication =
         (PFWLXSTARTAPPLICATION) GetProcAddress(hDll, "WlxStartApplication");
      if (!pfWlxStartApplication)
      {
         return FALSE;
      }

      pfWlxScreenSaverNotify =
         (PFWLXSCREENSAVERNOTIFY) GetProcAddress(hDll, "WlxScreenSaverNotify");
      if (!pfWlxScreenSaverNotify)
      {
         return FALSE;
      }
   }

   //
   // Load functions for version 1.3 as necessary.
   //
   if (dwWlxVersion > WLX_VERSION_1_2)
   {
      pfWlxNetworkProviderLoad =
         (PFWLXNETWORKPROVIDERLOAD)
            GetProcAddress(hDll, "WlxNetworkProviderLoad");
      if (!pfWlxNetworkProviderLoad)
      {
         return FALSE;
      }

      pfWlxDisplayStatusMessage =
         (PFWLXDISPLAYSTATUSMESSAGE)
            GetProcAddress(hDll, "WlxDisplayStatusMessage");
      if (!pfWlxDisplayStatusMessage)
      {
         return FALSE;
      }

      pfWlxGetStatusMessage =
         (PFWLXGETSTATUSMESSAGE)
            GetProcAddress(hDll, "WlxGetStatusMessage");
      if (!pfWlxGetStatusMessage)
      {
         return FALSE;
      }

      pfWlxRemoveStatusMessage =
         (PFWLXREMOVESTATUSMESSAGE)
            GetProcAddress(hDll, "WlxRemoveStatusMessage");
      if (!pfWlxRemoveStatusMessage)
      {
         return FALSE;
      }
   }

   //
   // Load functions for newer version here...
   //

   //
   // Everything loaded OK.
   //
   return TRUE;
}

BOOL WINAPI WlxActivateUserShell | ( | PVOID | pWlxContext,
 |  | PWSTR | pszDesktopName,
 |  | PWSTR | pszMprLogonScript,
 |  | PVOID | pEnvironment
 | ) |  |

Definition at line 376 of file GinaHook.c.

{
   return pfWlxActivateUserShell(pWlxContext,
                                 pszDesktopName,
                                 pszMprLogonScript,
                                 pEnvironment);
}

VOID WINAPI WlxDisplayLockedNotice ( PVOID pWlxContext )

Definition at line 402 of file GinaHook.c.

{
   pfWlxDisplayLockedNotice(pWlxContext);
}

VOID WINAPI WlxDisplaySASNotice ( PVOID pWlxContext )

Definition at line 330 of file GinaHook.c.

{
   pfWlxDisplaySASNotice(pWlxContext);
}

BOOL WINAPI WlxDisplayStatusMessage | ( | PVOID | pWlxContext,
 |  | HDESK | hDesktop,
 |  | DWORD | dwOptions,
 |  | PWSTR | pTitle,
 |  | PWSTR | pMessage
 | ) |  |

Definition at line 502 of file GinaHook.c.

{
   return pfWlxDisplayStatusMessage(pWlxContext,
                                    hDesktop,
                                    dwOptions,
                                    pTitle,
                                    pMessage);
}

BOOL WINAPI WlxGetStatusMessage | ( | PVOID | pWlxContext,
 |  | DWORD * | pdwOptions,
 |  | PWSTR | pMessage,
 |  | DWORD | dwBufferSize
 | ) |  |

Definition at line 518 of file GinaHook.c.

{
   return pfWlxGetStatusMessage(pWlxContext,
                                pdwOptions,
                                pMessage,
                                dwBufferSize);
}

BOOL WINAPI WlxInitialize | ( | LPWSTR | lpWinsta,
 |  | HANDLE | hWlx,
 |  | PVOID | pvReserved,
 |  | PVOID | pWinlogonFunctions,
 |  | PVOID * | pWlxContext
 | ) |  |

Definition at line 294 of file GinaHook.c.

{

   //
   // Save pointer to dispatch table.
   //
   // Note that g_pWinlogon will need to be properly casted to the
   // appropriate version when used to call function in the dispatch
   // table.
   //
   // For example, assuming we are at WLX_VERSION_1_3, we would call
   // WlxSasNotify() as follows:
   //
   // ((PWLX_DISPATCH_VERSION_1_3) g_pWinlogon)->WlxSasNotify(hWlx, MY_SAS);
   //
   g_pWinlogon = pWinlogonFunctions;

   //
   // Now hook the WlxDialogBoxParam() dispatch function.
   //
   HookWlxDialogBoxParam(g_pWinlogon, g_dwVersion);

   return pfWlxInitialize(lpWinsta,
                          hWlx,
                          pvReserved,
                          pWinlogonFunctions,
                          pWlxContext);
}

BOOL WINAPI WlxIsLockOk ( PVOID pWlxContext )

Definition at line 410 of file GinaHook.c.

{
   return pfWlxIsLockOk(pWlxContext);
}

BOOL WINAPI WlxIsLogoffOk ( PVOID pWlxContext )

Definition at line 427 of file GinaHook.c.

{
   BOOL bSuccess;

   bSuccess = pfWlxIsLogoffOk(pWlxContext);

   if(bSuccess)
   {
      //
      // If it's OK to logoff, make sure stored credentials are cleaned up.
      //
   }

   return bSuccess;
}

int WINAPI WlxLoggedOnSAS | ( | PVOID | pWlxContext,
 |  | DWORD | dwSasType,
 |  | PVOID | pReserved
 | ) |  |

Definition at line 390 of file GinaHook.c.

{
   return pfWlxLoggedOnSAS(pWlxContext,
                           dwSasType,
                           pReserved);
}

int WINAPI WlxLoggedOutSAS | ( | PVOID | pWlxContext,
 |  | DWORD | dwSasType,
 |  | PLUID | pAuthenticationId,
 |  | PSID | pLogonSid,
 |  | PDWORD | pdwOptions,
 |  | PHANDLE | phToken,
 |  | PWLX_MPR_NOTIFY_INFO | pMprNotifyInfo,
 |  | PVOID * | pProfile
 | ) |  |

Definition at line 338 of file GinaHook.c.

{
   int iRet;

   iRet = pfWlxLoggedOutSAS(pWlxContext,
                            dwSasType,
                            pAuthenticationId,
                            pLogonSid,
                            pdwOptions,
                            phToken,
                            pMprNotifyInfo,
                            pProfile);

   if(iRet == WLX_SAS_ACTION_LOGON)
   {
      //
      // Copy pMprNotifyInfo and pLogonSid for later use.
      //

      // pMprNotifyInfo->pszUserName
      // pMprNotifyInfo->pszDomain
      // pMprNotifyInfo->pszPassword
      // pMprNotifyInfo->pszOldPassword
   }

   return iRet;
}

VOID WINAPI WlxLogoff ( PVOID pWlxContext )

Definition at line 446 of file GinaHook.c.

{
   pfWlxLogoff(pWlxContext);
}

BOOL WINAPI WlxNegotiate | ( | DWORD | dwWinlogonVersion,
 |  | DWORD * | pdwDllVersion
 | ) |  |

Definition at line 236 of file GinaHook.c.

{
   HINSTANCE hDll;
   DWORD dwWlxVersion = GINASTUB_VERSION;

   //
   // Load MSGINA.DLL.
   //
   if (!(hDll = LoadLibrary(REALGINA_PATH)))
   {
      return FALSE;
   }

   //
   // Get pointers to WlxNegotiate function in the real MSGINA.
   //
   pfWlxNegotiate = (PFWLXNEGOTIATE) GetProcAddress(hDll, "WlxNegotiate");
   if (!pfWlxNegotiate)
   {
      return FALSE;
   }

   //
   // Handle older version of Winlogon.
   //
   if (dwWinlogonVersion < dwWlxVersion)
   {
      dwWlxVersion = dwWinlogonVersion;
   }

   //
   // Negotiate with MSGINA for version that we can support.
   //
   if (!pfWlxNegotiate(dwWlxVersion, &dwWlxVersion))
   {
      return FALSE;
   }

   //
   // Load the rest of the WLX functions from the real MSGINA.
   //
   if (!MyInitialize(hDll, dwWlxVersion))
   {
      return FALSE;
   }

   //
   // Inform Winlogon which version to use.
   //
   *pdwDllVersion = g_dwVersion = dwWlxVersion;

   return TRUE;
}

BOOL WINAPI WlxNetworkProviderLoad | ( | PVOID | pWlxContext,
 |  | PWLX_MPR_NOTIFY_INFO | pNprNotifyInfo
 | ) |  |

Definition at line 493 of file GinaHook.c.

{
   return pfWlxNetworkProviderLoad(pWlxContext, pNprNotifyInfo);
}

BOOL WINAPI WlxRemoveStatusMessage ( PVOID pWlxContext )

Definition at line 532 of file GinaHook.c.

{
   return pfWlxRemoveStatusMessage(pWlxContext);
}

BOOL WINAPI WlxScreenSaverNotify | ( | PVOID | pWlxContext,
 |  | BOOL * | pSecure
 | ) |  |

Definition at line 467 of file GinaHook.c.

{
   return pfWlxScreenSaverNotify(pWlxContext, pSecure);
}

VOID WINAPI WlxShutdown | ( | PVOID | pWlxContext,
 |  | DWORD | ShutdownType
 | ) |  |

Definition at line 454 of file GinaHook.c.

{
   pfWlxShutdown(pWlxContext, ShutdownType);
}

BOOL WINAPI WlxStartApplication | ( | PVOID | pWlxContext,
 |  | PWSTR | pszDesktopName,
 |  | PVOID | pEnvironment,
 |  | PWSTR | pszCmdLine
 | ) |  |

Definition at line 475 of file GinaHook.c.

{
   return pfWlxStartApplication(pWlxContext,
                                pszDesktopName,
                                pEnvironment,
                                pszCmdLine);
}

int WINAPI WlxWkstaLockedSAS | ( | PVOID | pWlxContext,
 |  | DWORD | dwSasType
 | ) |  |

Definition at line 418 of file GinaHook.c.

{
   return pfWlxWkstaLockedSAS(pWlxContext, dwSasType);
}

Generated on Wed Nov 13 2024 16:54:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/GINA/GinaHook/GinaHook.h File Reference

  • Security
  • GINA
  • GinaHook
Typedefs | Functions | Variables

GinaHook.h File Reference

Go to the source code of this file.

Typedefs

typedef DWORD *typedef | BOOL (WINAPI *PFWLXINITIALIZE)(LPWSTR
typedef DWORD | DWORD
typedef DWORD *typedef | HANDLE
typedef DWORD *typedef | PVOID
typedef PVOID *typedef | PWSTR
typedef DWORD *typedef PVOID
*typedef 		VOID (WINAPI *PFWLXDISPLAYSASNOTICE)(PVOID)

Functions

typedef | BOOL (WINAPI *PFWLXNEGOTIATE)(DWORD
typedef | int (WINAPI *PFWLXLOGGEDOUTSAS)(PVOID
typedef | VOID (WINAPI *PFWLXDISPLAYLOCKEDNOTICE)(PVOID)

Variables

typedef | HDESK
typedef | PDWORD
typedef | PHANDLE
typedef | PLUID
typedef | PSID
typedef | PWLX_MPR_NOTIFY_INFO

Typedef Documentation

typedef BOOL

Definition at line 22 of file GinaHook.h.

DWORD

Definition at line 49 of file GinaHook.h.

typedef DWORD* typedef HANDLE

Definition at line 22 of file GinaHook.h.

typedef BOOL* typedef PVOID

Definition at line 22 of file GinaHook.h.

typedef DWORD PWSTR

Definition at line 27 of file GinaHook.h.

typedef VOID

Definition at line 23 of file GinaHook.h.

Function Documentation

typedef BOOL ( WINAPI * PFWLXNEGOTIATE )
typedef int ( WINAPI * PFWLXLOGGEDOUTSAS )
typedef VOID ( WINAPI * PFWLXDISPLAYLOCKEDNOTICE )

Variable Documentation

typedef HDESK

Definition at line 48 of file GinaHook.h.

typedef PDWORD

Definition at line 24 of file GinaHook.h.

typedef PHANDLE

Definition at line 24 of file GinaHook.h.

typedef PLUID

Definition at line 24 of file GinaHook.h.

typedef PSID

Definition at line 24 of file GinaHook.h.

typedef PWLX_MPR_NOTIFY_INFO

Definition at line 24 of file GinaHook.h.

Generated on Wed Nov 13 2024 16:54:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/GINA/GinaStub/GinaStub.c File Reference

  • Security
  • GINA
  • GinaStub
Defines | Functions | Variables

GinaStub.c File Reference

#include <windows.h>
#include <winwlx.h>
#include "Ginastub.h"

Go to the source code of this file.

Defines

#define | _WIN32_WINNT 0x0400
#define | GINASTUB_VERSION (WLX_VERSION_1_3)
#define | REALGINA_PATH TEXT("MSGINA.DLL")

Functions

BOOL | MyInitialize (HINSTANCE hDll, DWORD dwWlxVersion)
BOOL WINAPI | WlxActivateUserShell (PVOID pWlxContext, PWSTR pszDesktopName, PWSTR pszMprLogonScript, PVOID pEnvironment)
VOID WINAPI | WlxDisplayLockedNotice (PVOID pWlxContext)
VOID WINAPI | WlxDisplaySASNotice (PVOID pWlxContext)
BOOL WINAPI | WlxDisplayStatusMessage (PVOID pWlxContext, HDESK hDesktop, DWORD dwOptions, PWSTR pTitle, PWSTR pMessage)
BOOL WINAPI | WlxGetStatusMessage (PVOID pWlxContext, DWORD *pdwOptions, PWSTR pMessage, DWORD dwBufferSize)
BOOL WINAPI | WlxInitialize (LPWSTR lpWinsta, HANDLE hWlx, PVOID pvReserved, PVOID pWinlogonFunctions, PVOID *pWlxContext)
BOOL WINAPI | WlxIsLockOk (PVOID pWlxContext)
BOOL WINAPI | WlxIsLogoffOk (PVOID pWlxContext)
int WINAPI | WlxLoggedOnSAS (PVOID pWlxContext, DWORD dwSasType, PVOID pReserved)
int WINAPI | WlxLoggedOutSAS (PVOID pWlxContext, DWORD dwSasType, PLUID pAuthenticationId, PSID pLogonSid, PDWORD pdwOptions, PHANDLE phToken, PWLX_MPR_NOTIFY_INFO pMprNotifyInfo, PVOID *pProfile)
VOID WINAPI | WlxLogoff (PVOID pWlxContext)
BOOL WINAPI | WlxNegotiate (DWORD dwWinlogonVersion, DWORD *pdwDllVersion)
BOOL WINAPI | WlxNetworkProviderLoad (PVOID pWlxContext, PWLX_MPR_NOTIFY_INFO pNprNotifyInfo)
BOOL WINAPI | WlxRemoveStatusMessage (PVOID pWlxContext)
BOOL WINAPI | WlxScreenSaverNotify (PVOID pWlxContext, BOOL *pSecure)
VOID WINAPI | WlxShutdown (PVOID pWlxContext, DWORD ShutdownType)
BOOL WINAPI | WlxStartApplication (PVOID pWlxContext, PWSTR pszDesktopName, PVOID pEnvironment, PWSTR pszCmdLine)
int WINAPI | WlxWkstaLockedSAS (PVOID pWlxContext, DWORD dwSasType)

Variables

PVOID g_pWinlogon
PFWLXACTIVATEUSERSHELL | pfWlxActivateUserShell
PFWLXDISPLAYLOCKEDNOTICE | pfWlxDisplayLockedNotice
PFWLXDISPLAYSASNOTICE | pfWlxDisplaySASNotice
PFWLXDISPLAYSTATUSMESSAGE | pfWlxDisplayStatusMessage = NULL
PFWLXGETSTATUSMESSAGE | pfWlxGetStatusMessage = NULL
PFWLXINITIALIZE | pfWlxInitialize
PFWLXISLOCKOK | pfWlxIsLockOk
PFWLXISLOGOFFOK | pfWlxIsLogoffOk
PFWLXLOGGEDONSAS | pfWlxLoggedOnSAS
PFWLXLOGGEDOUTSAS | pfWlxLoggedOutSAS
PFWLXLOGOFF | pfWlxLogoff
PFWLXNEGOTIATE | pfWlxNegotiate
PFWLXNETWORKPROVIDERLOAD | pfWlxNetworkProviderLoad = NULL
PFWLXREMOVESTATUSMESSAGE | pfWlxRemoveStatusMessage = NULL
PFWLXSCREENSAVERNOTIFY | pfWlxScreenSaverNotify = NULL
PFWLXSHUTDOWN | pfWlxShutdown
PFWLXSTARTAPPLICATION | pfWlxStartApplication = NULL
PFWLXWKSTALOCKEDSAS | pfWlxWkstaLockedSAS

Define Documentation

#define _WIN32_WINNT 0x0400

Definition at line 17 of file GinaStub.c.

#define GINASTUB_VERSION (WLX_VERSION_1_3)

Definition at line 29 of file GinaStub.c.

#define REALGINA_PATH TEXT("MSGINA.DLL")

Definition at line 28 of file GinaStub.c.

Function Documentation

BOOL MyInitialize | ( | HINSTANCE | hDll,
 |  | DWORD | dwWlxVersion
 | ) |  |

Definition at line 81 of file GinaStub.c.

{
   //
   // Get pointers to all of the WLX functions in the real MSGINA.
   //
   pfWlxInitialize =
      (PFWLXINITIALIZE) GetProcAddress(hDll, "WlxInitialize");
   if (!pfWlxInitialize)
   {
      return FALSE;
   }

   pfWlxDisplaySASNotice =
      (PFWLXDISPLAYSASNOTICE) GetProcAddress(hDll, "WlxDisplaySASNotice");
   if (!pfWlxDisplaySASNotice)
   {
      return FALSE;
   }

   pfWlxLoggedOutSAS =
      (PFWLXLOGGEDOUTSAS) GetProcAddress(hDll, "WlxLoggedOutSAS");
   if (!pfWlxLoggedOutSAS)
   {
      return FALSE;
   }

   pfWlxActivateUserShell =
      (PFWLXACTIVATEUSERSHELL) GetProcAddress(hDll, "WlxActivateUserShell");
   if (!pfWlxActivateUserShell)
   {
      return FALSE;
   }

   pfWlxLoggedOnSAS =
      (PFWLXLOGGEDONSAS) GetProcAddress(hDll, "WlxLoggedOnSAS");
   if (!pfWlxLoggedOnSAS)
   {
      return FALSE;
   }

   pfWlxDisplayLockedNotice =
      (PFWLXDISPLAYLOCKEDNOTICE) GetProcAddress(hDll, "WlxDisplayLockedNotice");
   if (!pfWlxDisplayLockedNotice)
   {
      return FALSE;
   }

   pfWlxIsLockOk =
      (PFWLXISLOCKOK) GetProcAddress(hDll, "WlxIsLockOk");
   if (!pfWlxIsLockOk)
   {
      return FALSE;
   }

   pfWlxWkstaLockedSAS =
       (PFWLXWKSTALOCKEDSAS) GetProcAddress(hDll, "WlxWkstaLockedSAS");
   if (!pfWlxWkstaLockedSAS)
   {
      return FALSE;
   }

   pfWlxIsLogoffOk =
      (PFWLXISLOGOFFOK) GetProcAddress(hDll, "WlxIsLogoffOk");
   if (!pfWlxIsLogoffOk)
   {
      return FALSE;
   }

   pfWlxLogoff =
      (PFWLXLOGOFF) GetProcAddress(hDll, "WlxLogoff");
   if (!pfWlxLogoff)
   {
      return FALSE;
   }

   pfWlxShutdown =
      (PFWLXSHUTDOWN) GetProcAddress(hDll, "WlxShutdown");
   if (!pfWlxShutdown)
   {
      return FALSE;
   }

   //
   // Load functions for version 1.1 as necessary.
   //
   if (dwWlxVersion > WLX_VERSION_1_0)
   {
      pfWlxStartApplication =
         (PFWLXSTARTAPPLICATION) GetProcAddress(hDll, "WlxStartApplication");
      if (!pfWlxStartApplication)
      {
         return FALSE;
      }

      pfWlxScreenSaverNotify =
         (PFWLXSCREENSAVERNOTIFY) GetProcAddress(hDll, "WlxScreenSaverNotify");
      if (!pfWlxScreenSaverNotify)
      {
         return FALSE;
      }
   }

   //
   // Load functions for version 1.3 as necessary.
   //
   if (dwWlxVersion > WLX_VERSION_1_2)
   {
      pfWlxNetworkProviderLoad =
         (PFWLXNETWORKPROVIDERLOAD)
            GetProcAddress(hDll, "WlxNetworkProviderLoad");
      if (!pfWlxNetworkProviderLoad)
      {
         return FALSE;
      }

      pfWlxDisplayStatusMessage =
         (PFWLXDISPLAYSTATUSMESSAGE)
            GetProcAddress(hDll, "WlxDisplayStatusMessage");
      if (!pfWlxDisplayStatusMessage)
      {
         return FALSE;
      }

      pfWlxGetStatusMessage =
         (PFWLXGETSTATUSMESSAGE)
            GetProcAddress(hDll, "WlxGetStatusMessage");
      if (!pfWlxGetStatusMessage)
      {
         return FALSE;
      }

      pfWlxRemoveStatusMessage =
         (PFWLXREMOVESTATUSMESSAGE)
            GetProcAddress(hDll, "WlxRemoveStatusMessage");
      if (!pfWlxRemoveStatusMessage)
      {
         return FALSE;
      }
   }

   //
   // Load functions for newer version here...
   //

   //
   // Everything loaded OK.
   //
   return TRUE;
}

BOOL WINAPI WlxActivateUserShell | ( | PVOID | pWlxContext,
 |  | PWSTR | pszDesktopName,
 |  | PWSTR | pszMprLogonScript,
 |  | PVOID | pEnvironment
 | ) |  |

Definition at line 369 of file GinaStub.c.

{
   return pfWlxActivateUserShell(pWlxContext,
                                 pszDesktopName,
                                 pszMprLogonScript,
                                 pEnvironment);
}

VOID WINAPI WlxDisplayLockedNotice ( PVOID pWlxContext )

Definition at line 395 of file GinaStub.c.

{
   pfWlxDisplayLockedNotice(pWlxContext);
}

VOID WINAPI WlxDisplaySASNotice ( PVOID pWlxContext )

Definition at line 323 of file GinaStub.c.

{
   pfWlxDisplaySASNotice(pWlxContext);
}

BOOL WINAPI WlxDisplayStatusMessage | ( | PVOID | pWlxContext,
 |  | HDESK | hDesktop,
 |  | DWORD | dwOptions,
 |  | PWSTR | pTitle,
 |  | PWSTR | pMessage
 | ) |  |

Definition at line 495 of file GinaStub.c.

{
   return pfWlxDisplayStatusMessage(pWlxContext,
                                    hDesktop,
                                    dwOptions,
                                    pTitle,
                                    pMessage);
}

BOOL WINAPI WlxGetStatusMessage | ( | PVOID | pWlxContext,
 |  | DWORD * | pdwOptions,
 |  | PWSTR | pMessage,
 |  | DWORD | dwBufferSize
 | ) |  |

Definition at line 511 of file GinaStub.c.

{
   return pfWlxGetStatusMessage(pWlxContext,
                                pdwOptions,
                                pMessage,
                                dwBufferSize);
}

BOOL WINAPI WlxInitialize | ( | LPWSTR | lpWinsta,
 |  | HANDLE | hWlx,
 |  | PVOID | pvReserved,
 |  | PVOID | pWinlogonFunctions,
 |  | PVOID * | pWlxContext
 | ) |  |

Definition at line 292 of file GinaStub.c.

{

   //
   // Save pointer to dispatch table.
   //
   // Note that g_pWinlogon will need to be properly casted to the
   // appropriate version when used to call function in the dispatch
   // table.
   //
   // For example, assuming we are at WLX_VERSION_1_3, we would call
   // WlxSasNotify() as follows:
   //
   // ((PWLX_DISPATCH_VERSION_1_3) g_pWinlogon)->WlxSasNotify(hWlx, MY_SAS);
   //
   g_pWinlogon = pWinlogonFunctions;

   return pfWlxInitialize(lpWinsta,
                          hWlx,
                          pvReserved,
                          pWinlogonFunctions,
                          pWlxContext);
}

BOOL WINAPI WlxIsLockOk ( PVOID pWlxContext )

Definition at line 403 of file GinaStub.c.

{
   return pfWlxIsLockOk(pWlxContext);
}

BOOL WINAPI WlxIsLogoffOk ( PVOID pWlxContext )

Definition at line 420 of file GinaStub.c.

{
   BOOL bSuccess;

   bSuccess = pfWlxIsLogoffOk(pWlxContext);

   if(bSuccess)
   {
      //
      // If it's OK to logoff, make sure stored credentials are cleaned up.
      //
   }

   return bSuccess;
}

int WINAPI WlxLoggedOnSAS | ( | PVOID | pWlxContext,
 |  | DWORD | dwSasType,
 |  | PVOID | pReserved
 | ) |  |

Definition at line 383 of file GinaStub.c.

{
   return pfWlxLoggedOnSAS(pWlxContext,
                           dwSasType,
                           pReserved);
}

int WINAPI WlxLoggedOutSAS | ( | PVOID | pWlxContext,
 |  | DWORD | dwSasType,
 |  | PLUID | pAuthenticationId,
 |  | PSID | pLogonSid,
 |  | PDWORD | pdwOptions,
 |  | PHANDLE | phToken,
 |  | PWLX_MPR_NOTIFY_INFO | pMprNotifyInfo,
 |  | PVOID * | pProfile
 | ) |  |

Definition at line 331 of file GinaStub.c.

{
   int iRet;

   iRet = pfWlxLoggedOutSAS(pWlxContext,
                            dwSasType,
                            pAuthenticationId,
                            pLogonSid,
                            pdwOptions,
                            phToken,
                            pMprNotifyInfo,
                            pProfile);

   if(iRet == WLX_SAS_ACTION_LOGON)
   {
      //
      // Copy pMprNotifyInfo and pLogonSid for later use.
      //

      // pMprNotifyInfo->pszUserName
      // pMprNotifyInfo->pszDomain
      // pMprNotifyInfo->pszPassword
      // pMprNotifyInfo->pszOldPassword
   }

   return iRet;
}

VOID WINAPI WlxLogoff ( PVOID pWlxContext )

Definition at line 439 of file GinaStub.c.

{
   pfWlxLogoff(pWlxContext);
}

BOOL WINAPI WlxNegotiate | ( | DWORD | dwWinlogonVersion,
 |  | DWORD * | pdwDllVersion
 | ) |  |

Definition at line 234 of file GinaStub.c.

{
   HINSTANCE hDll;
   DWORD dwWlxVersion = GINASTUB_VERSION;

   //
   // Load MSGINA.DLL.
   //
   if (!(hDll = LoadLibrary(REALGINA_PATH)))
   {
      return FALSE;
   }

   //
   // Get pointers to WlxNegotiate function in the real MSGINA.
   //
   pfWlxNegotiate = (PFWLXNEGOTIATE) GetProcAddress(hDll, "WlxNegotiate");
   if (!pfWlxNegotiate)
   {
      return FALSE;
   }

   //
   // Handle older version of Winlogon.
   //
   if (dwWinlogonVersion < dwWlxVersion)
   {
      dwWlxVersion = dwWinlogonVersion;
   }

   //
   // Negotiate with MSGINA for version that we can support.
   //
   if (!pfWlxNegotiate(dwWlxVersion, &dwWlxVersion))
   {
      return FALSE;
   }

   //
   // Load the rest of the WLX functions from the real MSGINA.
   //
   if (!MyInitialize(hDll, dwWlxVersion))
   {
      return FALSE;
   }

   //
   // Inform Winlogon which version to use.
   //
   *pdwDllVersion = dwWlxVersion;

   return TRUE;
}

BOOL WINAPI WlxNetworkProviderLoad | ( | PVOID | pWlxContext,
 |  | PWLX_MPR_NOTIFY_INFO | pNprNotifyInfo
 | ) |  |

Definition at line 486 of file GinaStub.c.

{
   return pfWlxNetworkProviderLoad(pWlxContext, pNprNotifyInfo);
}

BOOL WINAPI WlxRemoveStatusMessage ( PVOID pWlxContext )

Definition at line 525 of file GinaStub.c.

{
   return pfWlxRemoveStatusMessage(pWlxContext);
}

BOOL WINAPI WlxScreenSaverNotify | ( | PVOID | pWlxContext,
 |  | BOOL * | pSecure
 | ) |  |

Definition at line 460 of file GinaStub.c.

{
   return pfWlxScreenSaverNotify(pWlxContext, pSecure);
}

VOID WINAPI WlxShutdown | ( | PVOID | pWlxContext,
 |  | DWORD | ShutdownType
 | ) |  |

Definition at line 447 of file GinaStub.c.

{
   pfWlxShutdown(pWlxContext, ShutdownType);
}

BOOL WINAPI WlxStartApplication | ( | PVOID | pWlxContext,
 |  | PWSTR | pszDesktopName,
 |  | PVOID | pEnvironment,
 |  | PWSTR | pszCmdLine
 | ) |  |

Definition at line 468 of file GinaStub.c.

{
   return pfWlxStartApplication(pWlxContext,
                                pszDesktopName,
                                pEnvironment,
                                pszCmdLine);
}

int WINAPI WlxWkstaLockedSAS | ( | PVOID | pWlxContext,
 |  | DWORD | dwSasType
 | ) |  |

Definition at line 411 of file GinaStub.c.

{
   return pfWlxWkstaLockedSAS(pWlxContext, dwSasType);
}

Variable Documentation

PVOID g_pWinlogon

Definition at line 36 of file GinaStub.c.

PFWLXACTIVATEUSERSHELL pfWlxActivateUserShell

Definition at line 46 of file GinaStub.c.

PFWLXDISPLAYLOCKEDNOTICE pfWlxDisplayLockedNotice

Definition at line 48 of file GinaStub.c.

PFWLXDISPLAYSASNOTICE pfWlxDisplaySASNotice

Definition at line 44 of file GinaStub.c.

PFWLXDISPLAYSTATUSMESSAGE pfWlxDisplayStatusMessage = NULL

Definition at line 72 of file GinaStub.c.

PFWLXGETSTATUSMESSAGE pfWlxGetStatusMessage = NULL

Definition at line 73 of file GinaStub.c.

PFWLXINITIALIZE pfWlxInitialize

Definition at line 43 of file GinaStub.c.

PFWLXISLOCKOK pfWlxIsLockOk

Definition at line 50 of file GinaStub.c.

PFWLXISLOGOFFOK pfWlxIsLogoffOk

Definition at line 51 of file GinaStub.c.

PFWLXLOGGEDONSAS pfWlxLoggedOnSAS

Definition at line 47 of file GinaStub.c.

PFWLXLOGGEDOUTSAS pfWlxLoggedOutSAS

Definition at line 45 of file GinaStub.c.

PFWLXLOGOFF pfWlxLogoff

Definition at line 52 of file GinaStub.c.

PFWLXNEGOTIATE pfWlxNegotiate

Definition at line 42 of file GinaStub.c.

PFWLXNETWORKPROVIDERLOAD pfWlxNetworkProviderLoad = NULL

Definition at line 71 of file GinaStub.c.

PFWLXREMOVESTATUSMESSAGE pfWlxRemoveStatusMessage = NULL

Definition at line 74 of file GinaStub.c.

PFWLXSCREENSAVERNOTIFY pfWlxScreenSaverNotify = NULL

Definition at line 60 of file GinaStub.c.

PFWLXSHUTDOWN pfWlxShutdown

Definition at line 53 of file GinaStub.c.

PFWLXSTARTAPPLICATION pfWlxStartApplication = NULL

Definition at line 59 of file GinaStub.c.

PFWLXWKSTALOCKEDSAS pfWlxWkstaLockedSAS

Definition at line 49 of file GinaStub.c.

Generated on Wed Nov 13 2024 16:54:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/GINA/GinaStub/GinaStub.h File Reference

  • Security
  • GINA
  • GinaStub
Typedefs | Functions | Variables

GinaStub.h File Reference

Go to the source code of this file.

Typedefs

typedef DWORD *typedef | BOOL (WINAPI *PFWLXINITIALIZE)(LPWSTR
typedef DWORD | DWORD
typedef DWORD *typedef | HANDLE
typedef DWORD *typedef | PVOID
typedef PVOID *typedef | PWSTR
typedef DWORD *typedef PVOID
*typedef 		VOID (WINAPI *PFWLXDISPLAYSASNOTICE)(PVOID)

Functions

typedef | BOOL (WINAPI *PFWLXNEGOTIATE)(DWORD
typedef | int (WINAPI *PFWLXLOGGEDOUTSAS)(PVOID
typedef | VOID (WINAPI *PFWLXDISPLAYLOCKEDNOTICE)(PVOID)

Variables

typedef | HDESK
typedef | PDWORD
typedef | PHANDLE
typedef | PLUID
typedef | PSID
typedef | PWLX_MPR_NOTIFY_INFO

Typedef Documentation

typedef BOOL* typedef BOOL(WINAPI *PFWLXSTARTAPPLICATION)(PVOID

Definition at line 22 of file GinaStub.h.

typedef DWORD

Definition at line 49 of file GinaStub.h.

typedef DWORD* typedef HANDLE

Definition at line 22 of file GinaStub.h.

typedef BOOL* typedef PVOID

Definition at line 22 of file GinaStub.h.

typedef DWORD PWSTR

Definition at line 27 of file GinaStub.h.

typedef DWORD* typedef PVOID* typedef VOID(WINAPI *PFWLXDISPLAYSASNOTICE)(PVOID)

Definition at line 23 of file GinaStub.h.

Function Documentation

typedef BOOL ( WINAPI * PFWLXNEGOTIATE )
typedef int ( WINAPI * PFWLXLOGGEDOUTSAS )
typedef VOID ( WINAPI * PFWLXDISPLAYLOCKEDNOTICE )

Variable Documentation

typedef HDESK

Definition at line 48 of file GinaStub.h.

typedef PDWORD

Definition at line 24 of file GinaStub.h.

typedef PHANDLE

Definition at line 24 of file GinaStub.h.

typedef PLUID

Definition at line 24 of file GinaStub.h.

typedef PSID

Definition at line 24 of file GinaStub.h.

typedef PWLX_MPR_NOTIFY_INFO

Definition at line 24 of file GinaStub.h.

Generated on Wed Nov 13 2024 16:54:31 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/LSAPolicy/LsaPrivs/LsaPrivs.c File Reference

  • Security
  • LSAPolicy
  • LsaPrivs
Defines | Functions

LsaPrivs.c File Reference

#include <windows.h>
#include <stdio.h>
#include "ntsecapi.h"

Go to the source code of this file.

Defines

#define | RTN_ERROR 13
#define | RTN_OK 0
#define | RTN_USAGE 1
#define | STATUS_SUCCESS ((NTSTATUS)0x00000000L)

Functions

void | DisplayNtStatus (LPSTR szAPI, NTSTATUS Status)
void | DisplayWinError (LPSTR szAPI, DWORD WinError)
BOOL | GetAccountSid (LPTSTR SystemName, LPTSTR AccountName, PSID *Sid)
void | InitLsaString (PLSA_UNICODE_STRING LsaString, LPWSTR String)
int __cdecl | main (int argc, char *argv[])
NTSTATUS | OpenPolicy (LPWSTR ServerName, DWORD DesiredAccess, PLSA_HANDLE PolicyHandle)
NTSTATUS | SetPrivilegeOnAccount (LSA_HANDLE PolicyHandle, PSID AccountSid, LPWSTR PrivilegeName, BOOL bEnable)

Define Documentation

#define RTN_ERROR 13

Definition at line 79 of file LsaPrivs.c.

#define RTN_OK 0

Definition at line 77 of file LsaPrivs.c.

#define RTN_USAGE 1

Definition at line 78 of file LsaPrivs.c.

#define STATUS_SUCCESS ((NTSTATUS)0x00000000L)

Definition at line 85 of file LsaPrivs.c.

Function Documentation

void DisplayNtStatus | ( | LPSTR | szAPI,
 |  | NTSTATUS | Status
 | ) |  |

Definition at line 389 of file LsaPrivs.c.

{
    //
    // Convert the NTSTATUS to Winerror. Then call DisplayWinError().
    //
    DisplayWinError(szAPI, LsaNtStatusToWinError(Status));
}

void DisplayWinError | ( | LPSTR | szAPI,
 |  | DWORD | WinError
 | ) |  |

Definition at line 401 of file LsaPrivs.c.

{
    LPSTR MessageBuffer;
    DWORD dwBufferLength;

    //
    // TODO: Get this fprintf out of here!
    //
    fprintf(stderr,"%s error!\n", szAPI);

    if(dwBufferLength=FormatMessageA(
                        FORMAT_MESSAGE_ALLOCATE_BUFFER |
                        FORMAT_MESSAGE_FROM_SYSTEM,
                        NULL,
                        WinError,
                        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
                        (LPSTR) &MessageBuffer,
                        0,
                        NULL
                        ))
    {
        DWORD dwBytesWritten; // unused

        //
        // Output message string on stderr.
        //
        WriteFile(
            GetStdHandle(STD_ERROR_HANDLE),
            MessageBuffer,
            dwBufferLength,
            &dwBytesWritten,
            NULL
            );

        //
        // Free the buffer allocated by the system.
        //
        LocalFree(MessageBuffer);
    }
}

BOOL GetAccountSid | ( | LPTSTR | SystemName,
 |  | LPTSTR | AccountName,
 |  | PSID * | Sid
 | ) |  |

Definition at line 201 of file LsaPrivs.c.

{
    LPTSTR ReferencedDomain=NULL;
    DWORD cbSid=128;    // initial allocation attempt
    DWORD cchReferencedDomain=16; // initial allocation size
    SID_NAME_USE peUse;
    BOOL bSuccess=FALSE; // assume this function will fail

    __try {

    //
    // initial memory allocations
    //
    *Sid = (PSID)HeapAlloc(GetProcessHeap(), 0, cbSid);

    if(*Sid == NULL) __leave;

    ReferencedDomain = (LPTSTR)HeapAlloc(
                    GetProcessHeap(),
                    0,
                    cchReferencedDomain * sizeof(TCHAR)
                    );

    if(ReferencedDomain == NULL) __leave;

    //
    // Obtain the SID of the specified account on the specified system.
    //
    while(!LookupAccountName(
                    SystemName,         // machine to lookup account on
                    AccountName,        // account to lookup
                    *Sid,               // SID of interest
                    &cbSid,             // size of SID
                    ReferencedDomain,   // domain account was found on
                    &cchReferencedDomain,
                    &peUse
                    )) {
        if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
            //
            // reallocate memory
            //
            *Sid = (PSID)HeapReAlloc(
                        GetProcessHeap(),
                        0,
                        *Sid,
                        cbSid
                        );

            if(*Sid == NULL) __leave;

            ReferencedDomain = (LPTSTR)HeapReAlloc(
                        GetProcessHeap(),
                        0,
                        ReferencedDomain,
                        cchReferencedDomain * sizeof(TCHAR)
                        );

            if(ReferencedDomain == NULL) __leave;
        }
        else __leave;
    }

    //
    // Indicate success.
    //
    bSuccess=TRUE;

    } // try
    __finally {

    //
    // Cleanup and indicate failure, if appropriate.
    //

    HeapFree(GetProcessHeap(), 0, ReferencedDomain);

    if(!bSuccess) {
        if(*Sid != NULL) {
            HeapFree(GetProcessHeap(), 0, *Sid);
            *Sid = NULL;
        }
    }

    } // finally

    return bSuccess;
}

void InitLsaString | ( | PLSA_UNICODE_STRING | LsaString,
 |  | LPWSTR | String
 | ) |  |

Definition at line 331 of file LsaPrivs.c.

{
    DWORD StringLength;

    if(String == NULL) {
        LsaString->Buffer = NULL;
        LsaString->Length = 0;
        LsaString->MaximumLength = 0;
        return;
    }

    StringLength = lstrlenW(String);
    LsaString->Buffer = String;
    LsaString->Length = (USHORT) StringLength * sizeof(WCHAR);
    LsaString->MaximumLength=(USHORT)(StringLength+1) * sizeof(WCHAR);
}

int __cdecl main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 90 of file LsaPrivs.c.

{
    LSA_HANDLE PolicyHandle;
    WCHAR wComputerName[256]=L"";   // static machine name buffer
    TCHAR AccountName[256];         // static account name buffer
    PSID pSid;
    NTSTATUS Status;
    int iRetVal=RTN_ERROR;          // assume error from main

    if(argc == 1) {
        fprintf(stderr,"Usage: %s <Account> [TargetMachine]\n", argv[0]);
        return RTN_USAGE;
    }

    //
    // Pick up account name on argv[1].
    // Assumes source is ANSI. Resultant string is ANSI or Unicode
    //
    _snwprintf(AccountName, 256, TEXT("%hS"), argv[1]);

    //
    // Pick up machine name on argv[2], if appropriate
    // assumes source is ANSI. Resultant string is Unicode.
    //
    if(argc == 3) _snwprintf(wComputerName, 256, L"%hS", argv[2]);

    //
    // Open the policy on the target machine.
    //
    Status = OpenPolicy(
                wComputerName,      // target machine
                POLICY_CREATE_ACCOUNT | POLICY_LOOKUP_NAMES,
                &PolicyHandle       // resultant policy handle
                );

    if(Status != STATUS_SUCCESS) {
        DisplayNtStatus("OpenPolicy", Status);
        return RTN_ERROR;
    }

    //
    // Obtain the SID of the user/group.
    // Note that we could target a specific machine, but we don't.
    // Specifying NULL for target machine searches for the SID in the
    // following order: well-known, Built-in and local, primary domain,
    // trusted domains.
    //
    if(GetAccountSid(
            NULL,       // default lookup logic
            AccountName,// account to obtain SID
            &pSid       // buffer to allocate to contain resultant SID
            )) {
        //
        // We only grant the privilege if we succeeded in obtaining the
        // SID. We can actually add SIDs which cannot be looked up, but
        // looking up the SID is a good sanity check which is suitable for
        // most cases.

        //
        // Grant the SeServiceLogonRight to users represented by pSid.
        //
        Status = SetPrivilegeOnAccount(
                    PolicyHandle,           // policy handle
                    pSid,                   // SID to grant privilege
                    L"SeServiceLogonRight", // Unicode privilege
                    TRUE                    // enable the privilege
                    );

        if(Status == STATUS_SUCCESS)
            iRetVal=RTN_OK;
        else
            DisplayNtStatus("SetPrivilegeOnAccount", Status);
    }
    else {
        //
        // Error obtaining SID.
        //
        DisplayWinError("GetAccountSid", GetLastError());
    }

    //
    // Close the policy handle.
    //
    LsaClose(PolicyHandle);

    //
    // Free memory allocated for SID.
    //
    if(pSid != NULL) HeapFree(GetProcessHeap(), 0, pSid);

    return iRetVal;
}

NTSTATUS OpenPolicy | ( | LPWSTR | ServerName,
 |  | DWORD | DesiredAccess,
 |  | PLSA_HANDLE | PolicyHandle
 | ) |  |

Definition at line 352 of file LsaPrivs.c.

{
    LSA_OBJECT_ATTRIBUTES ObjectAttributes;
    LSA_UNICODE_STRING ServerString;
    PLSA_UNICODE_STRING Server;

    //
    // Always initialize the object attributes to all zeroes.
    //
    ZeroMemory(&ObjectAttributes, sizeof(ObjectAttributes));

    if (ServerName != NULL) {
        //
        // Make a LSA_UNICODE_STRING out of the LPWSTR passed in
        //
        InitLsaString(&ServerString, ServerName);
        Server = &ServerString;
    } else {
        Server = NULL;
    }

    //
    // Attempt to open the policy.
    //
    return LsaOpenPolicy(
                Server,
                &ObjectAttributes,
                DesiredAccess,
                PolicyHandle
                );
}

NTSTATUS SetPrivilegeOnAccount | ( | LSA_HANDLE | PolicyHandle,
 |  | PSID | AccountSid,
 |  | LPWSTR | PrivilegeName,
 |  | BOOL | bEnable
 | ) |  |

Definition at line 294 of file LsaPrivs.c.

{
    LSA_UNICODE_STRING PrivilegeString;

    //
    // Create a LSA_UNICODE_STRING for the privilege name.
    //
    InitLsaString(&PrivilegeString, PrivilegeName);

    //
    // grant or revoke the privilege, accordingly
    //
    if(bEnable) {
        return LsaAddAccountRights(
                PolicyHandle,       // open policy handle
                AccountSid,         // target SID
                &PrivilegeString,   // privileges
                1                   // privilege count
                );
    }
    else {
        return LsaRemoveAccountRights(
                PolicyHandle,       // open policy handle
                AccountSid,         // target SID
                FALSE,              // do not disable all rights
                &PrivilegeString,   // privileges
                1                   // privilege count
                );
    }
}

Generated on Wed Nov 13 2024 16:54:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/LSAPolicy/MachAcct/MachAcct.c File Reference

  • Security
  • LSAPolicy
  • MachAcct
Defines | Functions

MachAcct.c File Reference

#include <windows.h>
#include <stdio.h>
#include <lm.h>

Go to the source code of this file.

Defines

#define | RTN_ERROR 13
#define | RTN_OK 0
#define | RTN_USAGE 1

Functions

BOOL | AddMachineAccount (LPWSTR wTargetComputer, LPWSTR MachineAccount, DWORD AccountType)
void | DisplayError (LPSTR szAPI, DWORD dwLastError)
BOOL | SetCurrentPrivilege (LPCTSTR Privilege, BOOL bEnablePrivilege, BOOL *bPreviousPrivilege)
int __cdecl | wmain (int argc, wchar_t *argv[])

Define Documentation

#define RTN_ERROR 13

Definition at line 82 of file MachAcct.c.

#define RTN_OK 0

Definition at line 80 of file MachAcct.c.

#define RTN_USAGE 1

Definition at line 81 of file MachAcct.c.

Function Documentation

BOOL AddMachineAccount | ( | LPWSTR | wTargetComputer,
 |  | LPWSTR | MachineAccount,
 |  | DWORD | AccountType
 | ) |  |

Definition at line 175 of file MachAcct.c.

{
    WCHAR wAccount[MAX_COMPUTERNAME_LENGTH + 2];
    LPWSTR wPassword;
    USER_INFO_1 ui;
    DWORD cchAccount;
    DWORD cchLength;
    NET_API_STATUS nas;

    //
    // ensure a valid computer account type was passed
    // TODO SetLastError
    //
    if (AccountType != UF_WORKSTATION_TRUST_ACCOUNT &&
        AccountType != UF_SERVER_TRUST_ACCOUNT &&
        AccountType != UF_INTERDOMAIN_TRUST_ACCOUNT
        ) {
        SetLastError(ERROR_INVALID_PARAMETER);
        return FALSE;
    }

    //
    // obtain number of chars in computer account name
    //
    cchLength = cchAccount = lstrlenW(MachineAccount);

    //
    // ensure computer name doesn't exceed maximum length
    //
    if(cchLength > MAX_COMPUTERNAME_LENGTH) {
        SetLastError(ERROR_INVALID_ACCOUNT_NAME);
        return FALSE;
    }

    //
    // password is the computer account name converted to lowercase
    // convert the passed MachineAccount in place
    //
    wPassword = MachineAccount;

    //
    // copy MachineAccount to the wAccount buffer allocated while
    // converting computer account name to uppercase.
    // convert password (inplace) to lowercase
    //
    while(cchAccount--) {
        wAccount[cchAccount] = towupper( MachineAccount[cchAccount] );
        wPassword[cchAccount] = towlower( wPassword[cchAccount] );
    }

    //
    // computer account names have a trailing Unicode '$'
    //
    wAccount[cchLength] = L'$';
    wAccount[cchLength + 1] = L'\0'; // terminate the string

    //
    // if the password is greater than the max allowed, truncate
    //
    if(cchLength > LM20_PWLEN) wPassword[LM20_PWLEN] = L'\0';

    //
    // initialize USER_INFO_x structure
    //
    ZeroMemory(&ui, sizeof(ui));

    ui.usri1_name = wAccount;
    ui.usri1_password = wPassword;

    ui.usri1_flags = AccountType | UF_SCRIPT;
    ui.usri1_priv = USER_PRIV_USER;

    nas = NetUserAdd(
                wTargetComputer,    // target computer name
                1,                  // info level
                (LPBYTE) &ui,       // buffer
                NULL
                );

    //
    // indicate whether it was successful
    //
    if(nas == NERR_Success) {
        return TRUE;
    }
    else {
        SetLastError(nas);
        return FALSE;
    }
}

void DisplayError | ( | LPSTR | szAPI,
 |  | DWORD | dwLastError
 | ) |  |

Definition at line 346 of file MachAcct.c.

{
    HMODULE hModule = NULL;
    LPSTR MessageBuffer;
    DWORD dwBufferLength;

    fprintf(stderr,"%s error! (rc=%lu)\n", szAPI, dwLastError);

    if(dwLastError >= NERR_BASE && dwLastError <= MAX_NERR) {
        hModule = LoadLibraryEx(
            TEXT("netmsg.dll"),
            NULL,
            LOAD_LIBRARY_AS_DATAFILE
            );
    }

    if(dwBufferLength=FormatMessageA(
        FORMAT_MESSAGE_ALLOCATE_BUFFER |
        FORMAT_MESSAGE_IGNORE_INSERTS |
        FORMAT_MESSAGE_FROM_SYSTEM |
        ((hModule != NULL) ? FORMAT_MESSAGE_FROM_HMODULE : 0),
        hModule, // module to get message from
        dwLastError,
        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // default language
        (LPSTR) &MessageBuffer,
        0,
        NULL
        ))
    {
        DWORD dwBytesWritten;

        //
        // Output message string on stderr
        //
        WriteFile(
            GetStdHandle(STD_ERROR_HANDLE),
            MessageBuffer,
            dwBufferLength,
            &dwBytesWritten,
            NULL
            );

        //
        // free the buffer allocated by the system
        //
        LocalFree(MessageBuffer);
    }

    if(hModule != NULL)
        FreeLibrary(hModule);
}

DWORD SetCurrentPrivilege | ( | LPCTSTR | Privilege,
 |  | BOOL | bEnablePrivilege,
 |  | BOOL * | bPreviousPrivilege
 | ) |  |

Definition at line 271 of file MachAcct.c.

{
    DWORD dwError;
    HANDLE hToken;
    TOKEN_PRIVILEGES tp;
    LUID luid;
    TOKEN_PRIVILEGES tpPrevious;
    DWORD cbPrevious=sizeof(TOKEN_PRIVILEGES);
    BOOL bSuccess=FALSE;

    if(!LookupPrivilegeValue(NULL, Privilege, &luid)) return ERROR_NO_SUCH_PRIVILEGE;

    if(!OpenProcessToken(
            GetCurrentProcess(),
            TOKEN_QUERY | TOKEN_ADJUST_PRIVILEGES,
            &hToken
            )) return GetLastError();

    //
    // first pass.  get current privilege setting
    //
    tp.PrivilegeCount           = 1;
    tp.Privileges[0].Luid       = luid;
    tp.Privileges[0].Attributes = 0;

    AdjustTokenPrivileges(
            hToken,
            FALSE,
            &tp,
            sizeof(TOKEN_PRIVILEGES),
            &tpPrevious,
            &cbPrevious
            );

    if(( dwError = GetLastError()) == ERROR_SUCCESS) {
        //
        // second pass.  set privilege based on previous setting
        //
        tpPrevious.PrivilegeCount     = 1;
        tpPrevious.Privileges[0].Luid = luid;

        if ( bPreviousPrivilege ) {

            *bPreviousPrivilege = (( tpPrevious.Privileges[0].Attributes & SE_PRIVILEGE_ENABLED ) != 0 );
        }

        if(bEnablePrivilege) {
            tpPrevious.Privileges[0].Attributes |= (SE_PRIVILEGE_ENABLED);
        }
        else {
            tpPrevious.Privileges[0].Attributes &= ~(SE_PRIVILEGE_ENABLED);
        }

        AdjustTokenPrivileges(
                hToken,
                FALSE,
                &tpPrevious,
                cbPrevious,
                NULL,
                NULL
                );

        dwError = GetLastError();
    }

    CloseHandle(hToken);

    return dwError;
}

int __cdecl wmain | ( | int | argc,
 |  | wchar_t * | argv[]
 | ) |  |

Definition at line 90 of file MachAcct.c.

{
    LPWSTR wMachineAccount;
    LPWSTR wPrimaryDC;
    LPTSTR MachineAccountPrivilege = SE_MACHINE_ACCOUNT_NAME;
    DWORD dwTrustAccountType = UF_WORKSTATION_TRUST_ACCOUNT;
    NET_API_STATUS nas;
    BOOL bSuccess;

    if(argc < 2) {
        fprintf(stderr, "Usage: %ls <machineaccountname> [domain]\n",
            argv[0]);
        return RTN_USAGE;
    }

    wMachineAccount = argv[1];

    //
    // if a domain name was specified, fetch the computer name of the
    // primary domain controller
    //
    if(argc == 3) {

        nas = NetGetDCName(NULL, argv[2], (LPBYTE *)&wPrimaryDC);

        if(nas != NERR_Success) {
            DisplayError("NetGetDCName", nas);
            return RTN_ERROR;
        }
    } else {
        //
        // default will operate on local machine.  Non-NULL wPrimaryDC will
        // cause buffer to be freed
        //
        wPrimaryDC = NULL;
    }

    bSuccess = AddMachineAccount(
        wPrimaryDC,         // primary DC computer name
        wMachineAccount,    // computer account name
        dwTrustAccountType  // computer account type
        );

    if(!bSuccess && GetLastError() == ERROR_ACCESS_DENIED ) {

        BOOL Previous;

        //
        // try to enable the SeMachineAccountPrivilege
        //
        if(SetCurrentPrivilege( MachineAccountPrivilege, TRUE, &Previous )) {

            //
            // enabled the privilege.  retry the add operation
            //
            bSuccess = AddMachineAccount(
                wPrimaryDC,
                wMachineAccount,
                dwTrustAccountType
                );

            //
            // disable the privilege
            //
            SetCurrentPrivilege( MachineAccountPrivilege, Previous, NULL );
        }
    }

    //
    // free the buffer allocated for the PDC computer name
    //
    if(wPrimaryDC) NetApiBufferFree(wPrimaryDC);

    if(!bSuccess) {
        DisplayError("AddMachineAccount", GetLastError());
        return RTN_ERROR;
    }

    return RTN_OK;
}

Generated on Wed Nov 13 2024 16:54:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/NetProviders/LogonNP/LogonNP.c File Reference

  • Security
  • NetProviders
  • LogonNP
Defines | Functions

LogonNP.c File Reference

#include <windows.h>
#include "npapi.h"
#include "npaux.h"

Go to the source code of this file.

Defines

#define | _UNICODE
#define | MSV1_0_AUTH_TYPE L"MSV1_0:Interactive"
#define | UNICODE

Functions

BOOL WINAPI | DllMain (HANDLE hInst, DWORD dwReason, LPVOID lpReserved)
DWORD WINAPI | NPGetCaps (DWORD nIndex)
DWORD WINAPI | NPLogonNotify (PLUID lpLogonId, LPCWSTR lpAuthentInfoType, LPVOID lpAuthentInfo, LPCWSTR lpPreviousAuthentInfoType, LPVOID lpPreviousAuthentInfo, LPWSTR lpStationName, LPVOID StationHandle, LPWSTR *lpLogonScript)
DWORD WINAPI | NPPasswordChangeNotify (LPCWSTR lpAuthentInfoType, LPVOID lpAuthentInfo, LPCWSTR lpPreviousAuthentInfoType, LPVOID lpPreviousAuthentInfo, LPWSTR lpStationName, LPVOID StationHandle, DWORD dwChangeInfo)

Define Documentation

#define _UNICODE

Definition at line 14 of file LogonNP.c.

#define MSV1_0_AUTH_TYPE L"MSV1_0:Interactive"

Definition at line 27 of file LogonNP.c.

#define UNICODE

Definition at line 13 of file LogonNP.c.

Function Documentation

BOOL WINAPI DllMain | ( | HANDLE | hInst,
 |  | DWORD | dwReason,
 |  | LPVOID | lpReserved
 | ) |  |

Definition at line 36 of file LogonNP.c.

{
   if (dwReason == DLL_PROCESS_ATTACH)
   {
      DisableThreadLibraryCalls(hInst);
   }

   return TRUE;
}

DWORD WINAPI NPGetCaps ( DWORD nIndex )

Definition at line 79 of file LogonNP.c.

{
   DWORD dwRes;

   switch (nIndex)
   {

   case WNNC_NET_TYPE:
      dwRes = WNNC_CRED_MANAGER; // credential manager
      break;

   case WNNC_SPEC_VERSION:
      dwRes = WNNC_SPEC_VERSION51;  // We are using version 5.1 of the spec.
      break;

   case WNNC_DRIVER_VERSION:
      dwRes = 1;  // This driver is version 1.
      break;

   case WNNC_START:
      dwRes = 1;  // We are already "started"
      break;

   default:
      dwRes = 0;  // We don't support anything else
      break;
   }

   return dwRes;

}

DWORD WINAPI NPLogonNotify | ( | PLUID | lpLogonId,
 |  | LPCWSTR | lpAuthentInfoType,
 |  | LPVOID | lpAuthentInfo,
 |  | LPCWSTR | lpPreviousAuthentInfoType,
 |  | LPVOID | lpPreviousAuthentInfo,
 |  | LPWSTR | lpStationName,
 |  | LPVOID | StationHandle,
 |  | LPWSTR * | lpLogonScript
 | ) |  |

Definition at line 124 of file LogonNP.c.

{
   PMSV1_0_INTERACTIVE_LOGON pAuthInfo;

   #ifdef DEBUG
   TCHAR szBuf[1024];

   // For debugging purposes only
   MessageBeep(0xFFFFFFFF);

   //
   // Write out some information about the logon attempt
   //
   wsprintf(szBuf, L"lpAuthentInfoType=%s lpStationName=%s\r\n",
            lpAuthentInfoType, lpStationName);

   WriteLogFile(szBuf);
   #endif

   //
   // If the primary authenticator is not MSV1_0, return success.
   // Why? Because this is the only auth info structure that we
   // understand and we don't want to interact with other types.
   //
   if ( lstrcmpiW (MSV1_0_AUTH_TYPE, lpAuthentInfoType) )
   {

      #ifdef DEBUG
      wsprintf(szBuf, L"Authenticator is not MSV1_0 - Returning.\n");

      WriteLogFile(szBuf);
      #endif

      SetLastError(NO_ERROR);
      return NO_ERROR;
   }

   //
   // Do something with the authentication information
   //
   pAuthInfo = (PMSV1_0_INTERACTIVE_LOGON) lpAuthentInfo;

   #ifdef DEBUG
   wsprintf(szBuf, L"LogonDomain=%s User=%s\r\n",
            pAuthInfo->LogonDomainName.Buffer,
            pAuthInfo->UserName.Buffer);

   WriteLogFile(szBuf);
   #endif

   //
   // Let's utilize the logon script capability to display
   // our logon information
   //

   // The Caller MUST free this memory
   *lpLogonScript = LocalAlloc(LPTR,1024);

   #ifdef DEBUG
   wsprintf(*lpLogonScript,L"notepad %s",LOGFILE);
   #endif

   return NO_ERROR;
}

DWORD WINAPI NPPasswordChangeNotify | ( | LPCWSTR | lpAuthentInfoType,
 |  | LPVOID | lpAuthentInfo,
 |  | LPCWSTR | lpPreviousAuthentInfoType,
 |  | LPVOID | lpPreviousAuthentInfo,
 |  | LPWSTR | lpStationName,
 |  | LPVOID | StationHandle,
 |  | DWORD | dwChangeInfo
 | ) |  |

Definition at line 210 of file LogonNP.c.

{

   return NO_ERROR;
}

Generated on Wed Nov 13 2024 16:54:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/NetProviders/LogonNP/Npaux.h File Reference

  • Security
  • NetProviders
  • LogonNP
Classes | Defines | Typedefs | Enumerations

Npaux.h File Reference

Go to the source code of this file.

Classes

struct | _MSV1_0_INTERACTIVE_LOGON
struct | _UNICODE_STRING

Defines

#define | UNICODE_NULL ((WCHAR)0)

Typedefs

typedef struct
_MSV1_0_INTERACTIVE_LOGON 		MSV1_0_INTERACTIVE_LOGON
typedef enum
_MSV1_0_LOGON_SUBMIT_TYPE 		MSV1_0_LOGON_SUBMIT_TYPE
typedef struct
_MSV1_0_INTERACTIVE_LOGON * 		PMSV1_0_INTERACTIVE_LOGON
typedef enum
_MSV1_0_LOGON_SUBMIT_TYPE * 		PMSV1_0_LOGON_SUBMIT_TYPE
typedef UNICODE_STRING * | PUNICODE_STRING
typedef struct _UNICODE_STRING | UNICODE_STRING

Enumerations

enum | _MSV1_0_LOGON_SUBMIT_TYPE { Dummy }

Define Documentation

#define UNICODE_NULL ((WCHAR)0)

Definition at line 31 of file Npaux.h.

Typedef Documentation

typedef struct _MSV1_0_INTERACTIVE_LOGON MSV1_0_INTERACTIVE_LOGON
typedef enum _MSV1_0_LOGON_SUBMIT_TYPE MSV1_0_LOGON_SUBMIT_TYPE
typedef struct _MSV1_0_INTERACTIVE_LOGON * PMSV1_0_INTERACTIVE_LOGON
typedef enum _MSV1_0_LOGON_SUBMIT_TYPE * PMSV1_0_LOGON_SUBMIT_TYPE
typedef UNICODE_STRING* PUNICODE_STRING

Definition at line 30 of file Npaux.h.

typedef struct _UNICODE_STRING UNICODE_STRING

Enumeration Type Documentation

enum _MSV1_0_LOGON_SUBMIT_TYPE
Enumerator:
Dummy

Definition at line 34 of file Npaux.h.

{
   Dummy
} MSV1_0_LOGON_SUBMIT_TYPE, *PMSV1_0_LOGON_SUBMIT_TYPE;

Generated on Wed Nov 13 2024 16:54:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/PasswordFilters/PassFilt/PwdFilt.c File Reference

  • Security
  • PasswordFilters
  • PassFilt
Defines | Functions

PwdFilt.c File Reference

#include <windows.h>
#include <ntsecapi.h>

Go to the source code of this file.

Defines

#define | STATUS_SUCCESS ((NTSTATUS)0x00000000L)

Functions

BOOL NTAPI | InitializeChangeNotify (void)
NTSTATUS NTAPI | PasswordChangeNotify (PUNICODE_STRING UserName, ULONG RelativeId, PUNICODE_STRING Password)
BOOL NTAPI | PasswordFilter (PUNICODE_STRING UserName, PUNICODE_STRING FullName, PUNICODE_STRING Password, BOOL SetOperation)

Define Documentation

#define STATUS_SUCCESS ((NTSTATUS)0x00000000L)

Definition at line 33 of file PwdFilt.c.

Function Documentation

BOOL NTAPI InitializeChangeNotify ( void )

Definition at line 226 of file PwdFilt.c.

                   :

    This (optional) routine is called when the password change package
    is loaded.

Arguments:

Return Value:

    TRUE if initialization succeeded.

    FALSE if initialization failed. This DLL will be unloaded by the
     system.

--*/
{

   #ifdef DEBUG
   OutputDebugString( TEXT("Initialize Change Notify called!\n") );
   #endif

   //
   // initialize any critical sections associated with password change
   // events, etc.
   //

   return TRUE;
}

NTSTATUS NTAPI PasswordChangeNotify | ( | PUNICODE_STRING | UserName,
 |  | ULONG | RelativeId,
 |  | PUNICODE_STRING | Password
 | ) |  |

Definition at line 38 of file PwdFilt.c.

                   :

    This (optional) routine is notified of a password change.

Arguments:

    UserName - Name of user whose password changed

    RelativeId - RID of the user whose password changed

    NewPassword - Cleartext new password for the user

Return Value:

    STATUS_SUCCESS only - errors from packages are ignored.

--*/
{

#ifdef DEBUG
    LPWSTR String = NULL;
    DWORD cbString = 0;

    cbString = Password->Length + UserName->Length + (256*sizeof(WCHAR));

    String = HeapAlloc(GetProcessHeap(), 0, cbString);

    if( String != NULL )
    {

        //
        // don't display the password in the debugger unless absolutely
        // necessary -- assume everyone has access to a remote debug session.
        //

#if 0
        swprintf(String,
            L"Password for account %.*ls (rid 0x%x) changed to %.*ls\n",
            UserName->Length / sizeof(WCHAR),
            UserName->Buffer,
            RelativeId,
            Password->Length / sizeof(WCHAR),
            Password->Buffer
            );
#else
        swprintf(String,
            L"Password for account %.*ls (rid 0x%x) changed\n",
            UserName->Length / sizeof(WCHAR),
            UserName->Buffer,
            RelativeId
            );
#endif

        OutputDebugStringW( String );

        ZeroMemory(String, cbString);
        HeapFree(GetProcessHeap(), 0, String);
    }
#endif

    return STATUS_SUCCESS;
}

BOOL NTAPI PasswordFilter | ( | PUNICODE_STRING | UserName,
 |  | PUNICODE_STRING | FullName,
 |  | PUNICODE_STRING | Password,
 |  | BOOL | SetOperation
 | ) |  |

Definition at line 110 of file PwdFilt.c.

                   :

    This (optional) routine is notified of a password change.

Arguments:

    UserName - Name of user whose password changed

    FullName - Full name of the user whose password changed

    NewPassword - Cleartext new password for the user

    SetOperation - TRUE if the password was SET rather than CHANGED

Return Value:

    TRUE if the specified Password is suitable (complex, long, etc).
     The system will continue to evaluate the password update request
     through any other installed password change packages.

    FALSE if the specified Password is unsuitable. The password change
     on the specified account will fail.

--*/
{
   BOOL bComplex = FALSE; // assume the password in not complex enough
   DWORD cchPassword;
   PWORD CharType;
   DWORD i;
   DWORD dwNum = 0;
   DWORD dwUpper = 0;
   DWORD dwLower = 0;

   //
   // check if the password is complex enough for our liking by
   // checking that at least two of the four character types are
   // present.
   //

   CharType = HeapAlloc(GetProcessHeap(), 0, Password->Length);
   if (CharType == NULL) return FALSE;

   cchPassword = Password->Length / sizeof(WCHAR);

   if (GetStringTypeW(
                     CT_CTYPE1,
                     Password->Buffer,
                     cchPassword,
                     CharType
                     ))
   {

      for (i = 0 ; i < cchPassword ; i++)
      {

         //
         // keep track of what type of characters we have encountered
         //

         if (CharType[i] & C1_DIGIT)
         {
            dwNum = 1;
            continue;
         }

         if (CharType[i] & C1_UPPER)
         {
            dwUpper = 1;
            continue;
         }

         if (CharType[i] & C1_LOWER)
         {
            dwLower = 1;
            continue;
         }

         if (!(CharType[i] & (C1_ALPHA | C1_DIGIT) ))
         {

            //
            // any other character types make the password complex
            //

            dwNum = 2;

            break;
         }
      } // for

      //
      // Indicate whether we encountered enough password complexity
      //

      if ( (dwNum + dwUpper + dwLower) >= 2 )
         bComplex = TRUE;

      ZeroMemory( CharType, Password->Length );
   } // if

   HeapFree(GetProcessHeap(), 0, CharType);

   return bComplex;
}

Generated on Wed Nov 13 2024 16:54:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/SmartCard/PropCert/PropCert.Cpp File Reference

  • Security
  • SmartCard
  • PropCert
Defines | Functions

PropCert.Cpp File Reference

#include <tchar.h>
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <winscard.h>
#include <wincrypt.h>

Go to the source code of this file.

Defines

#define | _WIN32_WINNT 0x0400
#define | FREE(buffer) (LocalFree((LPBYTE) buffer))
#define | MALLOC(size) ((LPBYTE) LocalAlloc(LPTR, size))

Functions

int __cdecl | _tmain (int argc, _TCHAR *argv[])
LONG | AddCert (IN HCRYPTPROV hCryptProv, IN LPBYTE lpbCert, IN DWORD dwCertLength, IN DWORD dwKeySpec, IN LPCWSTR szCertFriendlyName, IN LPCWSTR zContainerName, IN LPCWSTR szCSPName, IN LPCWSTR szStoreName)
LONG | CryptPropCert (IN HCRYPTPROV hCryptProv, IN LPCTSTR szCSPName, IN LPCTSTR szStoreName)
LONG | GetCert (IN HCRYPTPROV hCryptProv, IN DWORD dwKeySpec, OUT LPBYTE *lplpbCert, OUT DWORD *lpdwCertLength)
LONG | SCardPropCert (IN SCARDCONTEXT hContext, IN LPCTSTR mszReaderNames, IN LPCTSTR szStoreName)

Define Documentation

#define _WIN32_WINNT 0x0400

Definition at line 18 of file PropCert.Cpp.

#define FREE ( buffer ) (LocalFree((LPBYTE) buffer))

Definition at line 39 of file PropCert.Cpp.

#define MALLOC ( size ) ((LPBYTE) LocalAlloc(LPTR, size))

Definition at line 38 of file PropCert.Cpp.

Function Documentation

int __cdecl _tmain | ( | int | argc,
 |  | _TCHAR * | argv[]
 | ) |  |

Definition at line 83 of file PropCert.Cpp.

{
   LONG lResult;
   DWORD dwNumReaders = 0;
   SCARDCONTEXT hContext = NULL;
   LPTSTR mszReaderNames = NULL;

   __try
   {
      //
      // Establish context with the resource manager.
      //
      lResult = SCardEstablishContext(SCARD_SCOPE_USER,
                                      NULL,
                                      NULL,
                                      &hContext);
      if (lResult != SCARD_S_SUCCESS)
      {
         __leave;
      }

      //
      // Get the list of reader(s) associated with the specified group(s).
      // Note: The buffer is automatically allocated and must be freed
      //       by SCardFreeMemory().
      //
      DWORD dwAutoAllocate = SCARD_AUTOALLOCATE;

      lResult = SCardListReaders(hContext,
                                 SCARD_DEFAULT_READERS,
                                 (LPTSTR) &mszReaderNames,
                                 &dwAutoAllocate);
      if (lResult != SCARD_S_SUCCESS)
      {
         __leave;
      }

      //
      // Propagate all digital certificate(s) found in all reader(s) to the
      // local "My" store.
      //
      lResult = SCardPropCert(hContext, mszReaderNames, _T("My"));
   }

   __finally
   {
      LONG lReturn;

      //
      // Don't forget to free resources, if allocated.
      //
      if (mszReaderNames != NULL)
      {
         lReturn = SCardFreeMemory(hContext, (LPVOID) mszReaderNames);

         //
         // If successful so far, then capture the return code
         // from SCFree(); otherwise, don't bother.
         //
         if (lResult == SCARD_S_SUCCESS)
         {
            lResult = lReturn;
         }
      }

      if (hContext != NULL)
      {
         lReturn = SCardReleaseContext(hContext);

         //
         // If successful so far, then capture the SCardReleaseContext()
         // return code; otherwise, don't bother.
         //
         if (lResult == SCARD_S_SUCCESS)
         {
            lResult = lReturn;
         }
      }
   }

   //
   // Inform user if an error had occurred.
   //
   if (lResult != SCARD_S_SUCCESS)
   {
      _tprintf(_T("\nError [0x%x]: Program terminated abnormally.\n"), lResult);
   }

   return lResult;
}

LONG AddCert | ( | IN HCRYPTPROV | hCryptProv,
 |  | IN LPBYTE | lpbCert,
 |  | IN DWORD | dwCertLength,
 |  | IN DWORD | dwKeySpec,
 |  | IN LPCWSTR | szCertFriendlyName,
 |  | IN LPCWSTR | zContainerName,
 |  | IN LPCWSTR | szCSPName,
 |  | IN LPCWSTR | szStoreName
 | ) |  |

Definition at line 833 of file PropCert.Cpp.

{
   LONG lResult = SCARD_S_SUCCESS;
   HCERTSTORE hCertStore = NULL;
   PCCERT_CONTEXT pCertContext = NULL;

   //
   // Make sure pointer parameters are not NULL.
   //
   if (lpbCert == NULL ||
       wszContainerName == NULL ||
       wszCSPName == NULL ||
       wszStoreName == NULL)
   {
      return SCARD_E_INVALID_PARAMETER;
   }

   __try
   {
      //
      // Open the user's specified store for writing.
      //
      hCertStore = CertOpenStore(CERT_STORE_PROV_SYSTEM_W,
                                 0,
                                 hCryptProv,
                                 CERT_STORE_NO_CRYPT_RELEASE_FLAG |
                                 CERT_SYSTEM_STORE_CURRENT_USER,
                                 wszStoreName);
      if (NULL == hCertStore)
      {
         lResult = GetLastError();
         __leave;
      }

      //
      // Build certificate context for this certificate.
      //
      pCertContext = CertCreateCertificateContext(X509_ASN_ENCODING,
                                                  lpbCert,
                                                  dwCertLength);
      if (pCertContext == NULL)
      {
         lResult = GetLastError();
         __leave;
      }

      //
      // Add the friendly name, if provided.
      //
      if (wszCertFriendlyName != NULL)
      {
         CRYPT_DATA_BLOB DataBlob;

         ZeroMemory((PVOID)&DataBlob, sizeof(CRYPT_DATA_BLOB));

         DataBlob.cbData = (wcslen(wszCertFriendlyName) + 1) * sizeof(WCHAR);
         DataBlob.pbData = (LPBYTE) wszCertFriendlyName;

         if (!CertSetCertificateContextProperty(pCertContext,
                                                CERT_FRIENDLY_NAME_PROP_ID,
                                                0,
                                                (const void *) &DataBlob))
         {
            lResult = GetLastError();
            __leave;
         }
      }

      //
      // Add the CSP & key container info. This is used by CAPI to load the
      // CSP and find the keyset when the user indicates this certificate.
      //
      CRYPT_KEY_PROV_INFO KeyProvInfo;

      ZeroMemory((PVOID)&KeyProvInfo, sizeof(CRYPT_KEY_PROV_INFO));

      KeyProvInfo.pwszContainerName = (LPWSTR) wszContainerName;
      KeyProvInfo.pwszProvName      = (LPWSTR) wszCSPName;
      KeyProvInfo.dwProvType        = PROV_RSA_FULL;
      KeyProvInfo.dwFlags           = 0;
      KeyProvInfo.dwKeySpec         = dwKeySpec;

      if (!CertSetCertificateContextProperty(pCertContext,
                                             CERT_KEY_PROV_INFO_PROP_ID,
                                             0,
                                             (const void *) &KeyProvInfo))
      {
         lResult = GetLastError();
         __leave;
      }

      //
      // Put the cert in the store!
      //
      if (!CertAddCertificateContextToStore(hCertStore,
                                            pCertContext,
                                            CERT_STORE_ADD_REPLACE_EXISTING,
                                            // or CERT_STORE_ADD_NEW
                                            NULL))
      {
         lResult = GetLastError();
         __leave;
      }
   }

   __finally
   {
      //
      // Don't forget to free resources, if allocated.
      //
      if (pCertContext != NULL)
      {
         CertFreeCertificateContext(pCertContext);
      }

      if (hCertStore != NULL)
      {
         CertCloseStore(hCertStore, CERT_CLOSE_STORE_FORCE_FLAG);
      }
   }

   return lResult;
}

LONG CryptPropCert | ( | IN HCRYPTPROV | hCryptProv,
 |  | IN LPCTSTR | szCSPName,
 |  | IN LPCTSTR | szStoreName
 | ) |  |

Definition at line 460 of file PropCert.Cpp.

{
   LONG lResult;
   LPCTSTR szContainerName = NULL;

   //
   // Make sure pointer parameters are not NULL.
   //
   if (szCSPName == NULL || szStoreName == NULL)
   {
      return SCARD_E_INVALID_PARAMETER;
   }

   __try
   {
      //
      // Query length of key container name.
      //
      DWORD cbContainerName = 0;

      if (!CryptGetProvParam(hCryptProv,
                             PP_CONTAINER,
                             NULL,  // NULL to query container name length
                             &cbContainerName,
                             0))
      {
         lResult = GetLastError();
         __leave;
      }

      //
      // Allocate memory for key container name.
      //
      szContainerName = (LPCTSTR) MALLOC(cbContainerName);

      //
      // Now get the key container name.
      //
      if (!CryptGetProvParam(hCryptProv,
                             PP_CONTAINER,
                             (PBYTE) szContainerName,
                             &cbContainerName,
                             0))
      {
         lResult = GetLastError();
         __leave;
      }

      //
      // For each key pair found in the smart card, store the corresponding
      // digital certificate to the specified local store.
      //
      const DWORD rgdwKeys[] = {AT_KEYEXCHANGE, AT_SIGNATURE};
      const DWORD cdwKeys = sizeof(rgdwKeys) / sizeof(rgdwKeys[0]);

      for (DWORD i = 0; i < cdwKeys; i++)
      {
         DWORD dwCertLength = 0;
         LPBYTE lpbCert = NULL;

         LPWSTR wszCertFriendlyName = NULL;
         LPWSTR wszContainerName = NULL;
         LPWSTR wszCSPName = NULL;
         LPWSTR wszStoreName = NULL;

         __try
         {
            //
            // Get the certificate data.
            //
            lResult = GetCert(hCryptProv,
                              rgdwKeys[i],
                              &lpbCert,
                              &dwCertLength);
            if (lResult != SCARD_S_SUCCESS)
            {
               if (lResult == NTE_NO_KEY)
               {
                  //
                  // We are OK if there is no key of such type.
                  // It means there is nothing to do.
                  //
                  lResult = SCARD_S_SUCCESS;
               }

               __leave;
            }

            //
            // Allocate memory for UNICODE strings.
            //
            TCHAR szCertFriendlyName[] = "";
            DWORD cchCertFriendlyName = (lstrlen(szCertFriendlyName) + 1)
                                        * sizeof(WCHAR);
            DWORD cchContainerName = (lstrlen(szContainerName) + 1)
                                     * sizeof(WCHAR);
            DWORD cchCSPName = (lstrlen(szCSPName) + 1) * sizeof(WCHAR);
            DWORD cchStoreName = (lstrlen(szStoreName) + 1) * sizeof(WCHAR);

            wszCertFriendlyName = (LPWSTR) MALLOC(cchCertFriendlyName);
            wszContainerName = (LPWSTR) MALLOC(cchContainerName);
            wszCSPName = (LPWSTR) MALLOC(cchCSPName);
            wszStoreName = (LPWSTR) MALLOC(cchStoreName);

            if (wszCertFriendlyName == NULL ||
                wszContainerName == NULL ||
                wszCSPName == NULL ||
                wszStoreName == NULL)
            {
               lResult = SCARD_E_NO_MEMORY;
               __leave;
            }

            //
            // Setup UNICODE strings.
            //
#ifdef _UNICODE
            lstrcpy(wszCertFriendlyName, szCertFriendlyName);
            lstrcpy(wszContainerName, szContainerName);
            lstrcpy(wszCSPName, szCSPName);
            lstrcpy(wszStoreName, szStoreName);
#else
            mbstowcs(wszCertFriendlyName, szCertFriendlyName,
                     cchCertFriendlyName);
            mbstowcs(wszContainerName, szContainerName, cchContainerName);
            mbstowcs(wszCSPName, szCSPName, cchCSPName);
            mbstowcs(wszStoreName, szStoreName, cchStoreName);
#endif
            //
            // Add the certificate to the specified local store.
            //
            lResult = AddCert(hCryptProv,
                              lpbCert,
                              dwCertLength,
                              rgdwKeys[i],
                              wszCertFriendlyName,
                              wszContainerName,
                              wszCSPName,
                              wszStoreName);
            if (lResult != SCARD_S_SUCCESS)
            {
               __leave;
            }
            else
            {
        _tprintf(
          _T("\nPropagated cert from %s to \"%s\" certificate store.\n"),
          szCSPName,
          szStoreName);
      }
         }

         __finally
         {
            //
            // Don't forget to free resources, if allocated.
            //
            if (lpbCert != NULL)
            {
               FREE(lpbCert);
            }

            if (wszCertFriendlyName != NULL)
            {
               FREE(wszCertFriendlyName);
            }

            if (wszContainerName != NULL)
            {
               FREE(wszContainerName);
            }

            if (wszCSPName != NULL)
            {
               FREE(wszCSPName);
            }

            if (wszStoreName != NULL)
            {
               FREE(wszStoreName);
            }

            if (lResult != SCARD_S_SUCCESS)
            {
               __leave;
            }
         }
      }
   }

   __finally
   {
      //
      // Don't forget to free resources, if allocated.
      //
      if (szContainerName != NULL)
      {
         FREE(szContainerName);
      }
   }

   return lResult;
}

LONG GetCert | ( | IN HCRYPTPROV | hCryptProv,
 |  | IN DWORD | dwKeySpec,
 |  | OUT LPBYTE * | lplpbCert,
 |  | OUT DWORD * | lpdwCertLength
 | ) |  |

Definition at line 697 of file PropCert.Cpp.

{
   LONG lResult = SCARD_S_SUCCESS;
   HCRYPTKEY hCryptKey = NULL;
   LPBYTE lpbCert = NULL;
   DWORD dwCertLength = 0;

   //
   // Make sure pointer parameters are not NULL.
   //
   if (lplpbCert == NULL || lpdwCertLength == NULL)
   {
      return SCARD_E_INVALID_PARAMETER;
   }

   __try
   {
      //
      // Get key handle.
      //
      if (!CryptGetUserKey(hCryptProv, dwKeySpec, &hCryptKey))
      {
         lResult = GetLastError();
         __leave;
      }

      //
      // Query certificate data length.
      //
      if (!CryptGetKeyParam(hCryptKey,
                            KP_CERTIFICATE,
                            NULL,  // NULL to query certificate data length
                            &dwCertLength,
                            0))
      {
         //
         // We expect ERROR_MORE_DATA. If that's not the case, then
         // something is not right.
         //
         lResult = GetLastError();
         if (lResult == ERROR_MORE_DATA)
         {
            lResult = SCARD_S_SUCCESS;
         }
         else
         {
            __leave;
         }
      }

      //
      // Allocate memory for certificate data.
      //
      lpbCert = (LPBYTE) MALLOC(dwCertLength);
      if (lpbCert == NULL)
      {
         lResult = SCARD_E_NO_MEMORY;
         __leave;
      }

      //
      // Now read the certificate data.
      //
      if (!CryptGetKeyParam(hCryptKey,
                            KP_CERTIFICATE,
                            lpbCert,
                            &dwCertLength,
                            0))
      {
         lResult = GetLastError();
         __leave;
      }
   }

   __finally
   {
      //
      // Don't forget to free resources, if allocated.
      //
      if (lResult == SCARD_S_SUCCESS)
      {
         *lplpbCert = lpbCert;
         *lpdwCertLength = dwCertLength;
      }
      else if (lpbCert != NULL)
      {
         FREE(lpbCert);
      }

      if (hCryptKey != NULL)
      {
         if (!CryptDestroyKey(hCryptKey))
         {
            if (lResult == SCARD_S_SUCCESS)
            {
               lResult = GetLastError();
            }
         }
      }
   }

   return lResult;
}

LONG SCardPropCert | ( | IN SCARDCONTEXT | hContext,
 |  | IN LPCTSTR | mszReaderNames,
 |  | IN LPCTSTR | szStoreName
 | ) |  |

Definition at line 204 of file PropCert.Cpp.

{
   LONG lResult;
   LPSCARD_READERSTATE lpReaderStates = NULL;

   //
   // Make sure pointer parameters are not NULL.
   //
   if (mszReaderNames == NULL || szStoreName == NULL)
   {
      return SCARD_E_INVALID_PARAMETER;
   }

   __try
   {
      DWORD dwNumReaders;
      LPCTSTR szReaderName;

      //
      // Count number of readers.
      //
      for (dwNumReaders = 0, szReaderName = mszReaderNames;
           *szReaderName != _T('\0');
           dwNumReaders++)
      {
         szReaderName += lstrlen(szReaderName) + 1;
      }

      //
      // Allocate memory for SCARD_READERSTATE array.
      //
      lpReaderStates = (LPSCARD_READERSTATE)
                       MALLOC(dwNumReaders * sizeof(SCARD_READERSTATE));
      if (lpReaderStates == NULL)
      {
         lResult = SCARD_E_NO_MEMORY;
         __leave;
      }

      //
      // Prepare state array.
      //
      ZeroMemory((LPVOID) lpReaderStates,
                 dwNumReaders * sizeof(SCARD_READERSTATE));

      DWORD i;
      for (i = 0, szReaderName = mszReaderNames;
           i < dwNumReaders;
           i++)
      {
         lpReaderStates[i].szReader = (LPCTSTR) szReaderName;
         lpReaderStates[i].dwCurrentState = SCARD_STATE_UNAWARE;

         szReaderName += lstrlen(szReaderName) + 1;
      }

      //
      // Initialize card status.
      //
      lResult = SCardGetStatusChange(hContext,
                                     INFINITE,
                                     lpReaderStates,
                                     dwNumReaders);
      if (lResult != SCARD_S_SUCCESS)
      {
         __leave;
      }

      //
      // For each card found, find the proper CSP and propagate the
      // certificate(s) to the specified local store.
      //
      for (i = 0; i < dwNumReaders && lResult == SCARD_S_SUCCESS; i++)
      {
         DWORD dwAutoAllocate;
         LPTSTR szCardName = NULL;
         LPTSTR szCSPName = NULL;
         LPTSTR szContainerName = NULL;
         HCRYPTPROV hCryptProv = NULL;

         __try
         {
            //
            // Card in this reader?
            //
            if (!(lpReaderStates[i].dwEventState & SCARD_STATE_PRESENT))
            {
               //
               // No card in this reader.
               //
               continue;
            }

            //
            // Get card name.
            //
            dwAutoAllocate = SCARD_AUTOALLOCATE;
            lResult = SCardListCards(hContext,
                                     lpReaderStates[i].rgbAtr,
                                     NULL,
                                     0,
                                     (LPTSTR) &szCardName,
                                     &dwAutoAllocate);
            if (lResult != SCARD_S_SUCCESS)
            {
               __leave;
            }

            //
            // Get card's CSP name.
            //

            //
            // Note: SCardGetCardTypeProviderName is not available
            //       in Smart Card Base Component v1.0. Please see
            //       ReadMe.txt for more information.
            //
            dwAutoAllocate = SCARD_AUTOALLOCATE;
            lResult = SCardGetCardTypeProviderName(hContext,
                                                   szCardName,
                                                   SCARD_PROVIDER_CSP,
                                                   (LPTSTR) &szCSPName,
                                                   &dwAutoAllocate);
            if (lResult != SCARD_S_SUCCESS)
            {
               __leave;
            }

            //
            // Prepare fully qualified container name.
            //
            szContainerName = (LPTSTR) MALLOC((sizeof(_T("\\\\.\\")) +
                              lstrlen(lpReaderStates[i].szReader) +
                              sizeof(_T("\\\0"))) * sizeof(TCHAR));

            if (szContainerName == NULL)
            {
               lResult = SCARD_E_NO_MEMORY;
               __leave;
            }

            wsprintf(szContainerName, _T("\\\\.\\%s\\"),
                     lpReaderStates[i].szReader);

            //
            // Obtain the crypto context.
                        //
                        // CRYPT_SILENT forces the CSP to raise no UI. The fully qualified
                        // container name indicates which reader to connect to, so the
                        // user should not be prompted to insert or select a card.
            //
            if (!CryptAcquireContext(&hCryptProv,
                                     szContainerName,
                                     szCSPName,
                                     PROV_RSA_FULL,
                                     CRYPT_SILENT))
            {
               lResult = GetLastError();
               __leave;
            }

            //
            // Propagate the cert.
            //
            lResult = CryptPropCert(hCryptProv,
                                    szCSPName,
                                    szStoreName);
         }

         __finally
         {
            LONG lReturn;

            //
            // Don't forget to free resources, if allocated.
            //
            if (hCryptProv != NULL)
            {
               if (!CryptReleaseContext(hCryptProv, 0))
               {
                  if (lResult == SCARD_S_SUCCESS)
                  {
                     lResult = GetLastError();
                  }
               }
            }

            if (szContainerName != NULL)
            {
               FREE((LPVOID) szContainerName);
            }

            if (szCSPName != NULL)
            {
               lReturn = SCardFreeMemory(hContext, (LPVOID) szCSPName);
               if (lResult == SCARD_S_SUCCESS)
               {
                  lResult = lReturn;
               }
            }

            if (szCardName != NULL)
            {
               lReturn = SCardFreeMemory(hContext, (LPVOID) szCardName);
               if (lResult == SCARD_S_SUCCESS)
               {
                  lResult = lReturn;
               }
            }
         }
      }
   }

   __finally
   {
      //
      // Don't forget to free resources, if allocated.
      //
      if (lpReaderStates != NULL)
      {
         FREE((LPVOID) lpReaderStates);
      }
   }

   return lResult;
}

Generated on Wed Nov 13 2024 16:54:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/SmartCard/SmartCardAPI/SCIntro/SCIntro.Cpp File Reference

  • Security
  • SmartCard
  • SmartCardAPI
  • SCIntro
Functions

SCIntro.Cpp File Reference

#include <tchar.h>
#include <stdio.h>
#include <windows.h>
#include <winscard.h>

Go to the source code of this file.

Functions

int __cdecl | _tmain (int argc, _TCHAR *argv[])
LONG | AddReadersToGroup (IN SCARDCONTEXT hContext, IN LPCTSTR lpszReaderGroup)
LONG | IntroduceCardType (IN SCARDCONTEXT hContext, IN LPCTSTR lpszCardName)
LONG | IntroduceReaderGroup (IN SCARDCONTEXT hContext, OUT LPTSTR lpszReaderGroup, IN DWORD cchReaderGroup)

Function Documentation

int __cdecl _tmain | ( | int | argc,
 |  | _TCHAR * | argv[]
 | ) |  |

Definition at line 51 of file SCIntro.Cpp.

{
    LONG lResult;
    _TCHAR szReaderGroup[_MAX_PATH];
    SCARDCONTEXT hContext = NULL;

    __try
    {
        //
        // Establish context with the resource manager.
        //
        lResult = SCardEstablishContext(SCARD_SCOPE_USER,
                                        NULL,
                                        NULL,
                                        &hContext);
        if (lResult != SCARD_S_SUCCESS)
        {
            __leave;
        }

        //
        // Introduce reader group to the system.
        //
        lResult = IntroduceReaderGroup(hContext, szReaderGroup, sizeof(szReaderGroup) / sizeof(szReaderGroup[0]));
        if (lResult != SCARD_S_SUCCESS)
        {
            __leave;
        }

        //
        // Prompt user to select reader(s) to be added to the reader group.
        //
        lResult = AddReadersToGroup(hContext, szReaderGroup);
        if (lResult != SCARD_S_SUCCESS)
        {
            __leave;
        }

        //
        // Promt user to select card(s) to be added to the system.
        //
        lResult = IntroduceCardType(hContext, szReaderGroup);
        if (lResult != SCARD_S_SUCCESS)
        {
            __leave;
        }
    }

    __finally
    {
        //
        // Don't forget to release the context handle if established.
        //
        if (hContext != NULL)
        {
            LONG lReturn = SCardReleaseContext(hContext);

            //
            // If successful so far, then capture return code of
            // SCardReleaseContext(); otherwise, don't bother
            //
            if (lResult == SCARD_S_SUCCESS)
            {
                lResult = lReturn;
            }
        }
    }

    //
    // Inform user if an error had occurred.
    //
    if (lResult != SCARD_S_SUCCESS)
    {
        _tprintf(_T("\nError [0x%lx]: Program terminated abnormally.\n"),
                 lResult);
    }

    return((int) lResult);
}

LONG AddReadersToGroup | ( | IN SCARDCONTEXT | hContext,
 |  | IN LPCTSTR | lpszReaderGroup
 | ) |  |

Definition at line 289 of file SCIntro.Cpp.

{
    LONG   lResult           = SCARD_S_SUCCESS;
    LPTSTR lpmszReaderNames  = NULL;
    LPTSTR lpmszGroupReaders = NULL;

    //
    // Parameter check
    //
    if (lpszReaderGroup == NULL || *lpszReaderGroup == NULL)
    {
        return SCARD_E_INVALID_PARAMETER;
    }

    //
    // Print header.
    //
    _tprintf(_T("\n"));
    _tprintf(_T("Add Reader(s) To Group\n"));
    _tprintf(_T("======================\n"));
    _tprintf(_T("\n"));

    __try
    {
        //
        // List all readers known to the system.
        //
        DWORD dwAutoAllocate = SCARD_AUTOALLOCATE;

        lResult = SCardListReaders(hContext,
                                   NULL,
                                   (LPTSTR) &lpmszReaderNames,
                                   &dwAutoAllocate);
        if (lResult != SCARD_S_SUCCESS)
        {
            __leave;
        }

        LPTSTR readers[MAXIMUM_SMARTCARD_READERS];
        DWORD  dwNumReaders   = 0;

        for (LPTSTR lpszReaderName = lpmszReaderNames;
            *lpszReaderName != _T('\0');
            lpszReaderName += lstrlen(lpszReaderName) + 1, dwNumReaders++)
        {
            readers[dwNumReaders] = lpszReaderName;
            _tprintf(_T("%02d: %s\n"), dwNumReaders, lpszReaderName);
        }

        if (dwNumReaders == 0)
        {
            //
            // No registered reader found. However, we should not have gotten so
            // far to here, because no reader situation should have been caught
            // by the above SCardListReaders() call with an erro code of
            // SCARD_E_NO_READERS_AVAILABLE.
            //
            // Note: Introduction of reader to the system is normally handled
            //       by the setup program provided by vendor.
            //
            lResult = SCARD_E_NO_READERS_AVAILABLE;
            __leave;
        }

        //
        // Prompt user to select reader(s) to be added to this reader group.
        // Note: The input format is very primitive. It expects one or more
        //       reader numbers (listed to the left of the reader name) to be
        //       entered and separated by space.
        //
        _tprintf(_T("Select above reader(s) to be added to this reader group: "));

        _TCHAR SelectedReaders[MAXIMUM_SMARTCARD_READERS * 4] = {_T('\0')};;

        _fgetts(SelectedReaders, sizeof(SelectedReaders) / sizeof(SelectedReaders[0]), stdin);

        _tprintf(_T("\n"));

        //
        // For each reader selected, add the reader only if the reader
        // is not already in this reader group.
        //
        dwAutoAllocate = SCARD_AUTOALLOCATE;

        lResult = SCardListReaders(hContext,
                                   lpszReaderGroup,
                                   (LPTSTR) &lpmszGroupReaders,
                                   &dwAutoAllocate);
        if (lResult != SCARD_S_SUCCESS)
        {
            //
            // If no reader in group, treat it as successful.
            //
            if (lResult != SCARD_E_NO_READERS_AVAILABLE)
            {
                __leave;
            }

            lResult = SCARD_S_SUCCESS;
        }

        LPTSTR reader = _tcstok(SelectedReaders, _T(" \n"));

        while (reader != NULL && lResult == SCARD_S_SUCCESS)
        {
            //
            // Make sure selection is valid.
            //
            DWORD nReader = (DWORD) _ttoi(reader);

            if (nReader < dwNumReaders)
            {
                LPTSTR lpszGroupReader = NULL;

                //
                // Make sure reader is not already in this reader group.
                //
                if (lpmszGroupReaders != NULL)
                {
                    for (lpszGroupReader = lpmszGroupReaders;
                        *lpszGroupReader != _T('\0');
                        lpszGroupReader += lstrlen(lpszGroupReader) + 1)
                    {
                        //
                        // All smart card component names are case insensitive.
                        //
                        if (lstrcmpi(lpszGroupReader, readers[nReader]) == 0)
                        {
                            break;
                        }
                    }
                }

                //
                // Only add if reader not already in this reader group.
                //
                if (lpszGroupReader == NULL || *lpszGroupReader == _T('\0'))
                {
                    lResult = SCardAddReaderToGroup(hContext,
                                                    readers[nReader],
                                                    lpszReaderGroup);
                    if (lResult != SCARD_S_SUCCESS)
                    {
                        __leave;
                    }

                    _tprintf(_T("Reader [%s] is successfully added to "
                                _T("this reader group.\n")), readers[nReader]);
                }
                else
                {
                    _tprintf(_T("Reader [%s] already exists in this "
                                _T("reader group.\n")), readers[nReader]);
                }
            }

            //
            // Next reader.
            //
            reader = _tcstok(NULL, _T(" \n"));
        }
    }

    __finally
    {
        LONG lReturn;

        //
        // Don't forget to release memory, if allocated.
        //
        if (lpmszGroupReaders != NULL)
        {
            lReturn = SCardFreeMemory(hContext,
                                      (LPVOID) lpmszGroupReaders);

            //
            // If successful so far, then capture return code of
            // SCardFreeMemory(); otherwise, don't bother.
            //
            if (lResult == SCARD_S_SUCCESS)
            {
                lResult = lReturn;
            }
        }

        if (lpmszReaderNames != NULL)
        {
            lReturn = SCardFreeMemory(hContext, (LPVOID) lpmszReaderNames);

            //
            // If successful so far, then capture return code of
            // SCardFreeMemory(); otherwise, don't bother.
            //
            if (lResult == SCARD_S_SUCCESS)
            {
                lResult = lReturn;
            }
        }
    }

    return lResult;
}

LONG IntroduceCardType | ( | IN SCARDCONTEXT | hContext,
 |  | IN LPCTSTR | lpszCardName
 | ) |  |

Definition at line 521 of file SCIntro.Cpp.

{
    LONG   lResult          = SCARD_S_SUCCESS;
    LPTSTR lpmszReaderNames = NULL;
    LPTSTR lpmszCardNames   = NULL;

    //
    // Print header.
    //
    _tprintf(_T("\n"));
    _tprintf(_T("Introduce Card Type\n"));
    _tprintf(_T("===================\n"));
    _tprintf(_T("\n"));

    //
    // Parameter check
    //
    if (lpszReaderGroup == NULL || *lpszReaderGroup == NULL)
    {
        return SCARD_E_INVALID_PARAMETER;
    }

    __try
    {
        //
        // List all readers in the specified group.
        //
        DWORD dwAutoAllocate = SCARD_AUTOALLOCATE;

        lResult = SCardListReaders(hContext,
                                   lpszReaderGroup,
                                   (LPTSTR) &lpmszReaderNames,
                                   &dwAutoAllocate);
        if (lResult != SCARD_S_SUCCESS)
        {
            __leave;
        }

        //
        // Note that MAXIMUM_SMARTCARD_READERS (10) only refers to maximum # of
        // non-PnP readers. The resource manager is capable of handling any number
        // of PnP readers, in addition to the 10 non-PnP readers (your physical
        // system is the limiting factor).
        //

        LPTSTR readers[MAXIMUM_SMARTCARD_READERS];
        DWORD  dwNumReaders = 0;

        for (LPTSTR lpszReaderName = lpmszReaderNames;
            *lpszReaderName != _T('\0') &&
            dwNumReaders < MAXIMUM_SMARTCARD_READERS;
            lpszReaderName += lstrlen(lpszReaderName) + 1, dwNumReaders++)
        {
            readers[dwNumReaders] = lpszReaderName;
        }

        if (dwNumReaders == 0)
        {
            //
            // No registered reader found. However, we should not have gotten so
            // far to here, because no reader situation should have been caught
            // by the above SCardListReaders() call with an erro code of
            // SCARD_E_NO_READERS_AVAILABLE.
            //
            // Note: Introduction of reader to the system is normally handled
            //       by the setup program provided by vendor.
            //
            lResult = SCARD_E_NO_READERS_AVAILABLE;
            __leave;
        }

        //
        // List all cards known to the system.
        //
        dwAutoAllocate = SCARD_AUTOALLOCATE;

        lResult = SCardListCards(hContext,
                                 NULL,
                                 NULL,
                                 0,
                                 (LPTSTR) &lpmszCardNames,
                                 &dwAutoAllocate);
        if (lResult != SCARD_S_SUCCESS)
        {
            __leave;
        }

        while (TRUE)
        {
            //
            // Prompt user to select reader for which the card to be introduced
            // resides.
            // Note: For simplicity, the input format is very primitive. If the
            //       user should type something longer than the input buffer
            //       length, the program could crash.
            //
            for (DWORD i = 0; i < dwNumReaders; i++)
            {
                _tprintf(_T("%02d: %s\n"), i, readers[i]);
            }

            _TCHAR SelectedReader[80] = {_T('\0')};

            _tprintf(_T("Select reader where the card is [x to exit]: "));

            _fgetts(SelectedReader, sizeof(SelectedReader) / sizeof(SelectedReader[0]), stdin);

            _tprintf(_T("\n"));

            //
            // Make sure selection is valid.
            //
            if (_toupper(SelectedReader[0]) == _T('X'))
            {
                break;
            }

            DWORD nReader = (DWORD) _ttoi(SelectedReader);

            if (nReader < dwNumReaders)
            {
                _TCHAR szCardName[_MAX_PATH] = {_T('\0')};

                //
                // Prompt user for the card friendly name.
                //
                _tprintf(_T("Type in card name: "));

                _fgetts(szCardName, sizeof(szCardName) / sizeof(szCardName[0]), stdin);

                _tprintf(_T("\n"));

                //
                // Make sure card name is valid.
                //
                if (lstrlen(szCardName))
                {
                    //
                    // Make sure card name does not already exist.
                    //
                    for (LPTSTR lpszCardName = lpmszCardNames;
                        *lpszCardName != _T('\0');
                        lpszCardName += lstrlen(lpszCardName) + 1)
                    {
                        //
                        // All smart card component names are case insensitive.
                        //
                        if (lstrcmpi(lpszCardName, szCardName) == 0)
                        {
                            break;
                        }
                    }

                    //
                    // Add card only if it does not already exist.
                    //
                    if (*lpszCardName == _T('\0'))
                    {
                        //
                        // See if a card is in the reader, and find out
                        // its ATR, if present.
                        //
                        SCARD_READERSTATE rsReader;

                        ZeroMemory((LPVOID) &rsReader, sizeof(rsReader));
                        rsReader.szReader = (LPCTSTR) readers[nReader];
                        rsReader.dwCurrentState = SCARD_STATE_UNAWARE;

                        lResult = SCardGetStatusChange(hContext,
                                                       INFINITE,
                                                       &rsReader,
                                                       1);
                        if (lResult != SCARD_S_SUCCESS)
                        {
                            __leave;
                        }

                        //
                        // Is the card in the reader.
                        //
                        if ((rsReader.dwEventState & SCARD_STATE_PRESENT))
                        {
                            //
                            // Add the card!
                            //
                            lResult = SCardIntroduceCardType(hContext,
                                                             szCardName,
                                                             NULL,
                                                             NULL,
                                                             0,
                                                             rsReader.rgbAtr,
                                                             NULL,
                                                             rsReader.cbAtr );
                            if (lResult != SCARD_S_SUCCESS)
                            {
                                __leave;
                            }

                            _tprintf(_T("Card [%s] is successfully introduced.\n\n"),
                                     szCardName);
                        }
                        else
                        {
                            _tprintf(_T("No smart card found in this reader.\n"));
                        }
                    }
                    else
                    {
                        _tprintf(_T("Card [%s] already exists.\n"), szCardName);
                    }
                }
                else
                {
                    _tprintf(_T("Invalid card name.\n"));
                }
            }

            _tprintf(_T("\n"));
        }
    }

    __finally
    {
        LONG lReturn;

        //
        // Don't forget to release memory, if allocated.
        //
        if (lpmszCardNames != NULL)
        {
            lReturn = SCardFreeMemory(hContext,
                                      (LPVOID) lpmszCardNames);

            //
            // If successful so far, then capture return code of
            // SCardFreeMemory(); otherwise, don't bother.
            //
            if (lResult == SCARD_S_SUCCESS)
            {
                lResult = lReturn;
            }
        }

        if (lpmszReaderNames != NULL)
        {
            lReturn = SCardFreeMemory(hContext, (LPVOID) lpmszReaderNames);

            //
            // If successful so far, then capture return code of
            // SCardFreeMemory(); otherwise, don't bother.
            //
            if (lResult == SCARD_S_SUCCESS)
            {
                lResult = lReturn;
            }
        }
    }

    return lResult;
}

LONG IntroduceReaderGroup | ( | IN SCARDCONTEXT | hContext,
 |  | OUT LPTSTR | lpszReaderGroup,
 |  | IN DWORD | cchReaderGroup
 | ) |  |

Definition at line 157 of file SCIntro.Cpp.

{
    LONG   lResult         = SCARD_S_SUCCESS;
    LPTSTR lpmszGroupNames = NULL;

    //
    // Parameter check
    //
    if (lpszReaderGroup == NULL)
    {
        return SCARD_E_INVALID_PARAMETER;
    }

    //
    // Print header.
    //
    _tprintf(_T("\n"));
    _tprintf(_T("Introduce Reader Group\n"));
    _tprintf(_T("======================\n"));
    _tprintf(_T("\n"));

    //
    // Prompt user for a new reader group name.
    //
    _tprintf(_T("Type in a new reader group name: "));

  *lpszReaderGroup = 0;
    _fgetts(lpszReaderGroup, cchReaderGroup, stdin);

    _tprintf(_T("\n"));

    if (lstrlen(lpszReaderGroup) == 0)
    {
        return SCARD_E_INVALID_VALUE;
    }

    __try
    {
        //
        // First make sure the reader group does not exist.
        //
        DWORD dwAutoAllocate = SCARD_AUTOALLOCATE;

        lResult = SCardListReaderGroups(hContext,
                                        (LPTSTR) &lpmszGroupNames,
                                        &dwAutoAllocate);
        if (lResult != SCARD_S_SUCCESS)
        {
            __leave;
        }

        for (LPTSTR lpszGroupName = lpmszGroupNames;
            *lpszGroupName != _T('\0');
            lpszGroupName += lstrlen(lpszGroupName) + 1)
        {
            //
            // All smart card component names are case insensitive.
            //
            if (lstrcmpi(lpszGroupName, lpszReaderGroup) == 0)
            {
                break;
            }
        }

        //
        // Introduce the group, if not already exists
        //
        if (*lpszGroupName == _T('\0'))
        {
            lResult = SCardIntroduceReaderGroup(hContext, lpszReaderGroup);
            if (lResult != SCARD_S_SUCCESS)
            {
                __leave;
            }

            _tprintf(_T("Reader group [%s] successfully added.\n\n"),
                     lpszReaderGroup);
        }
        else
        {
            _tprintf(_T("Reader group [%s] already exists.\n\n"), lpszReaderGroup);
        }
    }

    __finally
    {
        LONG lReturn;

        //
        // Don't forget to release memory, if allocated.
        //
        if (lpmszGroupNames != NULL)
        {
            lReturn = SCardFreeMemory(hContext, (LPVOID) lpmszGroupNames);

            //
            // If successful so far, then capture return code of
            // SCardFreeMemory(); otherwise, don't bother.
            //
            if (lResult == SCARD_S_SUCCESS)
            {
                lResult = lReturn;
            }
        }
    }

    return lResult;
}

Generated on Wed Nov 13 2024 16:54:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/SmartCard/SmartCardAPI/SCQuery/SCCommon.Cpp File Reference

  • Security
  • SmartCard
  • SmartCardAPI
  • SCQuery
Functions

SCCommon.Cpp File Reference

#include <tchar.h>
#include <assert.h>
#include <windows.h>
#include <winscard.h>
#include "sccommon.h"

Go to the source code of this file.

Functions

LONG | SCFree (IN LPVOID lpMemory)
LONG | SCGetAttrib (IN SCARDHANDLE hCard, IN DWORD dwAttrId, OUT LPBYTE *lplpbAttr)
LONG | SCGetResponse (IN SCARDHANDLE hCard, IN DWORD dwLength, OUT LPBYTE *lplpbResponse)
LONG | SCListCards (IN SCARDCONTEXT hContext, IN LPCBYTE lpszATR, OUT LPTSTR *lplpmszCardNames)
LONG | SCListGroups (IN SCARDCONTEXT hContext, OUT LPTSTR *lplpmszGroupNames)
LONG | SCListReaders (IN SCARDCONTEXT hContext, IN LPCTSTR lpmszReaderGroups, OUT LPTSTR *lplpmszReaderNames)
LPVOID | SCMalloc (IN DWORD dwSize)
LONG | SCSelectFile (IN SCARDHANDLE hCard, IN LPBYTE lpbFileName, OUT LPDWORD lpdwExtraBytes)

Function Documentation

LONG SCFree ( IN LPVOID lpMemory )

Definition at line 76 of file SCCommon.Cpp.

{
    LONG lResult;

    //
    // Parameters sanity check.
    //
    assert(lpMemory != NULL);

    if (HeapFree(GetProcessHeap(), 0, lpMemory))
    {
        lResult = SCARD_S_SUCCESS;
    }
    else
    {
        lResult = GetLastError();
    }

    return lResult;
}

LONG SCGetAttrib | ( | IN SCARDHANDLE | hCard,
 |  | IN DWORD | dwAttrId,
 |  | OUT LPBYTE * | lplpbAttr
 | ) |  |

Definition at line 394 of file SCCommon.Cpp.

{
    LONG  lResult;
    DWORD dwAttrLen;

    //
    // Parameters sanity check.
    //
    assert(lplpbAttr != NULL);

    //
    // Initialize returned info.
    //
    * lplpbAttr = NULL;

    //
    // First find the required buffer length.
    //

    lResult = SCardGetAttrib(hCard,
                             dwAttrId,
                             NULL,         // NULL to indicate we want to
                             &dwAttrLen);  // know the length of the buffer
    if (lResult != SCARD_S_SUCCESS)
    {
        return lResult;
    }

    //
    // Allocate memory.
    //
    LPBYTE lpbAttr = (LPBYTE) SCMalloc(dwAttrLen);

    if (lpbAttr == NULL)
    {
        return ERROR_OUTOFMEMORY;
    }

    //
    // Now actually get the attribute.
    //
    lResult = SCardGetAttrib(hCard,
                             dwAttrId,
                             lpbAttr,
                             &dwAttrLen);
    if (lResult == SCARD_S_SUCCESS)
    {
        //
        // Successful, so return pointer to attribute.
        //
        *lplpbAttr = lpbAttr;
    }
    else
    {
        //
        // Error occurred, so free memory.
        //
        SCFree((LPVOID) lpbAttr);
    }

    return lResult;
}

LONG SCGetResponse | ( | IN SCARDHANDLE | hCard,
 |  | IN DWORD | dwLength,
 |  | OUT LPBYTE * | lplpbResponse
 | ) |  |

Definition at line 483 of file SCCommon.Cpp.

{
    LONG lResult;

    //
    // Parameters sanity check.
    //
    assert(lplpbResponse != NULL);

    //
    // APDU response data length cannot be larger than 256
    //
    if (dwLength > 256)
    {
        return SCARD_E_INVALID_PARAMETER;
    }

    //
    // Initialize returned info.
    //
    *lplpbResponse = NULL;

    //
    // Allocate memory.
    //
    LPBYTE lpbResponse = (LPBYTE) SCMalloc(dwLength + 2);

    if (lpbResponse == NULL)
    {
        return ERROR_OUTOFMEMORY;
    }

    //
    // Construct the Get Response APDU.
    // Note that when dwLength is casted to BYTE, 256 would be converted to 0,
    // which will be the correct value to indicate 256 bytes.
    //
    DWORD dwStatusLen = dwLength + 2;
    BYTE apdu[5] = {0xc0, 0xc0, 0x00, 0x00, (BYTE) dwLength};

    //
    // Send APDU to card.
    //
    lResult = SCardTransmit(hCard,
                            SCARD_PCI_T0,
                            apdu,
                            sizeof(apdu),
                            NULL,
                            lpbResponse,
                            &dwStatusLen);
    if (lResult == SCARD_S_SUCCESS)
    {
        //
        // Did we get all the data?
        //
        if (dwStatusLen == dwLength + 2)
        {
            //
            // Is the data good?
            //
            if (lpbResponse[dwLength] == 0x90 && lpbResponse[dwLength + 1] == 0x00)
            {
                //
                // Successful, so return pointer to response data.
                //
                *lplpbResponse = (LPBYTE) lpbResponse;
            }
            else
            {
                //
                // Error occurred, so free memory
                //
                SCFree(lpbResponse);

                //
                // and return SW1 and SW2 as return code
                //
                lResult = MAKELONG(MAKEWORD(lpbResponse[dwLength + 1],
                                            lpbResponse[dwLength]), 0x000);
            }
        }
        else
        {
            //
            // Error occurred, so free memory
            //
            SCFree(lpbResponse);

            //
            // and return SW1 and SW2 as return code
            //
            lResult = MAKELONG(MAKEWORD(lpbResponse[1], lpbResponse[0]), 0x000);
        }
    }
    else
    {
        //
        // Error occurred, so free memory before returning.
        //
        SCFree(lpbResponse);
    }

    return lResult;
}

LONG SCListCards | ( | IN SCARDCONTEXT | hContext,
 |  | IN LPCBYTE | lpszATR,
 |  | OUT LPTSTR * | lplpmszCardNames
 | ) |  |

Definition at line 217 of file SCCommon.Cpp.

{
    LONG  lResult;
    DWORD dwCards;

    //
    // Parameters sanity check.
    //
    assert(lplpmszCardNames != NULL);

    //
    // Initialize returned info.
    //
    * lplpmszCardNames = NULL;

    //
    // First find the required buffer length.
    //
    lResult = SCardListCards(hContext,
                             lpszATR,
                             NULL,
                             0,
                             NULL,       // NULL to indicate we want to
                             &dwCards);  // know the length of the buffer
    if (lResult != SCARD_S_SUCCESS)
    {
        return lResult;
    }

    //
    // Allocate memory.
    //
    LPTSTR lpmszCardNames = (LPTSTR) SCMalloc(dwCards * sizeof(_TCHAR));

    if (lpmszCardNames == NULL)
    {
        return ERROR_OUTOFMEMORY;
    }

    //
    // Now actually get the list of card names.
    //
    lResult = SCardListCards(hContext,
                             lpszATR,
                             NULL,
                             0,
                             lpmszCardNames,
                             &dwCards);
    if (lResult == SCARD_S_SUCCESS)
    {
        //
        // Successful, so return pointer to card names.
        //
        *lplpmszCardNames = lpmszCardNames;
    }
    else
    {
        //
        // Error occurred, so free memory.
        //
        SCFree((LPVOID) lpmszCardNames);
    }

    return lResult;
}

LONG SCListGroups | ( | IN SCARDCONTEXT | hContext,
 |  | OUT LPTSTR * | lplpmszGroupNames
 | ) |  |

Definition at line 307 of file SCCommon.Cpp.

{
    LONG  lResult;
    DWORD dwGroups;

    //
    // Parameters sanity check.
    //
    assert(lplpmszGroupNames != NULL);

    //
    // Initialize returned info.
    //
    * lplpmszGroupNames = NULL;

    //
    // First find the required buffer length.
    //
    lResult = SCardListReaderGroups(hContext,
                                    NULL,        // NULL to indicate we want to
                                    &dwGroups);  // know the length of the buffer
    if (lResult != SCARD_S_SUCCESS)
    {
        return lResult;
    }

    //
    // Allocate memory.
    //
    LPTSTR lpmszGroupNames = (LPTSTR) SCMalloc(dwGroups * sizeof(_TCHAR));

    if (lpmszGroupNames == NULL)
    {
        return ERROR_OUTOFMEMORY;
    }

    //
    // Now actually get the list of group names.
    //
    lResult = SCardListReaderGroups(hContext,
                                    lpmszGroupNames,
                                    &dwGroups);
    if (lResult == SCARD_S_SUCCESS)
    {
        //
        // Successful, so return pointer to group names.
        //
        *lplpmszGroupNames = lpmszGroupNames;
    }
    else
    {
        //
        // Error occurred, so free memory.
        //
        SCFree((LPVOID) lpmszGroupNames);
    }

    return lResult;
}

LONG SCListReaders | ( | IN SCARDCONTEXT | hContext,
 |  | IN LPCTSTR | lpmszReaderGroups,
 |  | OUT LPTSTR * | lplpmszReaderNames
 | ) |  |

Definition at line 125 of file SCCommon.Cpp.

{
    LONG  lResult;
    DWORD dwReaders;

    //
    // Parameters sanity check.
    //
    assert(lplpmszReaderNames != NULL);

    //
    // Initialize returned info.
    //
    * lplpmszReaderNames = NULL;

    //
    // First find the required buffer length.
    //
    lResult = SCardListReaders(hContext,
                               lpmszReaderGroups,
                               NULL,         // NULL to indicate we want to
                               &dwReaders);  // know the length of the buffer
    if (lResult != SCARD_S_SUCCESS)
    {
        return lResult;
    }

    //
    // Allocate memory.
    //
    LPTSTR lpmszReaderNames = (LPTSTR) SCMalloc(dwReaders * sizeof(_TCHAR));

    if (lpmszReaderNames == NULL)
    {
        return ERROR_OUTOFMEMORY;
    }

    //
    // Now actually get the list of reader names.
    //
    lResult = SCardListReaders(hContext,
                               lpmszReaderGroups,
                               lpmszReaderNames,
                               &dwReaders);
    if (lResult == SCARD_S_SUCCESS)
    {
        //
        // Successful, so return pointer to reader names.
        //
        *lplpmszReaderNames = lpmszReaderNames;
    }
    else
    {
        //
        // Error occurred, so free memory.
        //
        SCFree((LPVOID) lpmszReaderNames);
    }

    return lResult;
}

LPVOID SCMalloc ( IN DWORD dwSize )

Definition at line 56 of file SCCommon.Cpp.

{
    return(HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwSize));
}

LONG SCSelectFile | ( | IN SCARDHANDLE | hCard,
 |  | IN LPBYTE | lpbFileName,
 |  | OUT LPDWORD | lpdwExtraBytes
 | ) |  |

Definition at line 619 of file SCCommon.Cpp.

{
    LONG lResult;

    //
    // Parameters sanity check.
    //
    assert(lpbFileName != NULL);
    assert(lpdwExtraBytes != NULL);

    //
    // Start with 0xC0.
    //
    lResult = scSelectFile(hCard, 0xC0, lpbFileName, lpdwExtraBytes);
    if (lResult == 0x6e00)
    {
        //
        // Try 0x00.
        //
        lResult = scSelectFile(hCard, 0x00, lpbFileName, lpdwExtraBytes);
    }

    return lResult;
}

Generated on Wed Nov 13 2024 16:54:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/SmartCard/SmartCardAPI/SCQuery/SCCommon.h File Reference

  • Security
  • SmartCard
  • SmartCardAPI
  • SCQuery
Functions

SCCommon.h File Reference

Go to the source code of this file.

Functions

LONG | SCFree (IN LPVOID lpMemory)
LONG | SCGetAttrib (IN SCARDHANDLE hCard, IN DWORD dwAttrId, OUT LPBYTE *lplpbAttr)
LONG | SCGetResponse (IN SCARDHANDLE hCard, IN DWORD dwLength, OUT LPBYTE *lplpbResponse)
LONG | SCListCards (IN SCARDCONTEXT hContext, IN LPCBYTE lpszATR, OUT LPTSTR *lplpmszCardNames)
LONG | SCListGroups (IN SCARDCONTEXT hContext, OUT LPTSTR *lplpmszGroupNames)
LONG | SCListReaders (IN SCARDCONTEXT hContext, IN LPCTSTR lpmszReaderGroups, OUT LPTSTR *lplpmszReaderNames)
LPVOID | SCMalloc (IN DWORD dwSize)
LONG | SCSelectFile (IN SCARDHANDLE hCard, IN LPBYTE lpbFileName, OUT LPDWORD lpdwExtraBytes)

Function Documentation

LONG SCFree ( IN LPVOID lpMemory )

Definition at line 76 of file SCCommon.Cpp.

{
    LONG lResult;

    //
    // Parameters sanity check.
    //
    assert(lpMemory != NULL);

    if (HeapFree(GetProcessHeap(), 0, lpMemory))
    {
        lResult = SCARD_S_SUCCESS;
    }
    else
    {
        lResult = GetLastError();
    }

    return lResult;
}

LONG SCGetAttrib | ( | IN SCARDHANDLE | hCard,
 |  | IN DWORD | dwAttrId,
 |  | OUT LPBYTE * | lplpbAttr
 | ) |  |

Definition at line 394 of file SCCommon.Cpp.

{
    LONG  lResult;
    DWORD dwAttrLen;

    //
    // Parameters sanity check.
    //
    assert(lplpbAttr != NULL);

    //
    // Initialize returned info.
    //
    * lplpbAttr = NULL;

    //
    // First find the required buffer length.
    //

    lResult = SCardGetAttrib(hCard,
                             dwAttrId,
                             NULL,         // NULL to indicate we want to
                             &dwAttrLen);  // know the length of the buffer
    if (lResult != SCARD_S_SUCCESS)
    {
        return lResult;
    }

    //
    // Allocate memory.
    //
    LPBYTE lpbAttr = (LPBYTE) SCMalloc(dwAttrLen);

    if (lpbAttr == NULL)
    {
        return ERROR_OUTOFMEMORY;
    }

    //
    // Now actually get the attribute.
    //
    lResult = SCardGetAttrib(hCard,
                             dwAttrId,
                             lpbAttr,
                             &dwAttrLen);
    if (lResult == SCARD_S_SUCCESS)
    {
        //
        // Successful, so return pointer to attribute.
        //
        *lplpbAttr = lpbAttr;
    }
    else
    {
        //
        // Error occurred, so free memory.
        //
        SCFree((LPVOID) lpbAttr);
    }

    return lResult;
}

LONG SCGetResponse | ( | IN SCARDHANDLE | hCard,
 |  | IN DWORD | dwLength,
 |  | OUT LPBYTE * | lplpbResponse
 | ) |  |

Definition at line 483 of file SCCommon.Cpp.

{
    LONG lResult;

    //
    // Parameters sanity check.
    //
    assert(lplpbResponse != NULL);

    //
    // APDU response data length cannot be larger than 256
    //
    if (dwLength > 256)
    {
        return SCARD_E_INVALID_PARAMETER;
    }

    //
    // Initialize returned info.
    //
    *lplpbResponse = NULL;

    //
    // Allocate memory.
    //
    LPBYTE lpbResponse = (LPBYTE) SCMalloc(dwLength + 2);

    if (lpbResponse == NULL)
    {
        return ERROR_OUTOFMEMORY;
    }

    //
    // Construct the Get Response APDU.
    // Note that when dwLength is casted to BYTE, 256 would be converted to 0,
    // which will be the correct value to indicate 256 bytes.
    //
    DWORD dwStatusLen = dwLength + 2;
    BYTE apdu[5] = {0xc0, 0xc0, 0x00, 0x00, (BYTE) dwLength};

    //
    // Send APDU to card.
    //
    lResult = SCardTransmit(hCard,
                            SCARD_PCI_T0,
                            apdu,
                            sizeof(apdu),
                            NULL,
                            lpbResponse,
                            &dwStatusLen);
    if (lResult == SCARD_S_SUCCESS)
    {
        //
        // Did we get all the data?
        //
        if (dwStatusLen == dwLength + 2)
        {
            //
            // Is the data good?
            //
            if (lpbResponse[dwLength] == 0x90 && lpbResponse[dwLength + 1] == 0x00)
            {
                //
                // Successful, so return pointer to response data.
                //
                *lplpbResponse = (LPBYTE) lpbResponse;
            }
            else
            {
                //
                // Error occurred, so free memory
                //
                SCFree(lpbResponse);

                //
                // and return SW1 and SW2 as return code
                //
                lResult = MAKELONG(MAKEWORD(lpbResponse[dwLength + 1],
                                            lpbResponse[dwLength]), 0x000);
            }
        }
        else
        {
            //
            // Error occurred, so free memory
            //
            SCFree(lpbResponse);

            //
            // and return SW1 and SW2 as return code
            //
            lResult = MAKELONG(MAKEWORD(lpbResponse[1], lpbResponse[0]), 0x000);
        }
    }
    else
    {
        //
        // Error occurred, so free memory before returning.
        //
        SCFree(lpbResponse);
    }

    return lResult;
}

LONG SCListCards | ( | IN SCARDCONTEXT | hContext,
 |  | IN LPCBYTE | lpszATR,
 |  | OUT LPTSTR * | lplpmszCardNames
 | ) |  |

Definition at line 217 of file SCCommon.Cpp.

{
    LONG  lResult;
    DWORD dwCards;

    //
    // Parameters sanity check.
    //
    assert(lplpmszCardNames != NULL);

    //
    // Initialize returned info.
    //
    * lplpmszCardNames = NULL;

    //
    // First find the required buffer length.
    //
    lResult = SCardListCards(hContext,
                             lpszATR,
                             NULL,
                             0,
                             NULL,       // NULL to indicate we want to
                             &dwCards);  // know the length of the buffer
    if (lResult != SCARD_S_SUCCESS)
    {
        return lResult;
    }

    //
    // Allocate memory.
    //
    LPTSTR lpmszCardNames = (LPTSTR) SCMalloc(dwCards * sizeof(_TCHAR));

    if (lpmszCardNames == NULL)
    {
        return ERROR_OUTOFMEMORY;
    }

    //
    // Now actually get the list of card names.
    //
    lResult = SCardListCards(hContext,
                             lpszATR,
                             NULL,
                             0,
                             lpmszCardNames,
                             &dwCards);
    if (lResult == SCARD_S_SUCCESS)
    {
        //
        // Successful, so return pointer to card names.
        //
        *lplpmszCardNames = lpmszCardNames;
    }
    else
    {
        //
        // Error occurred, so free memory.
        //
        SCFree((LPVOID) lpmszCardNames);
    }

    return lResult;
}

LONG SCListGroups | ( | IN SCARDCONTEXT | hContext,
 |  | OUT LPTSTR * | lplpmszGroupNames
 | ) |  |

Definition at line 307 of file SCCommon.Cpp.

{
    LONG  lResult;
    DWORD dwGroups;

    //
    // Parameters sanity check.
    //
    assert(lplpmszGroupNames != NULL);

    //
    // Initialize returned info.
    //
    * lplpmszGroupNames = NULL;

    //
    // First find the required buffer length.
    //
    lResult = SCardListReaderGroups(hContext,
                                    NULL,        // NULL to indicate we want to
                                    &dwGroups);  // know the length of the buffer
    if (lResult != SCARD_S_SUCCESS)
    {
        return lResult;
    }

    //
    // Allocate memory.
    //
    LPTSTR lpmszGroupNames = (LPTSTR) SCMalloc(dwGroups * sizeof(_TCHAR));

    if (lpmszGroupNames == NULL)
    {
        return ERROR_OUTOFMEMORY;
    }

    //
    // Now actually get the list of group names.
    //
    lResult = SCardListReaderGroups(hContext,
                                    lpmszGroupNames,
                                    &dwGroups);
    if (lResult == SCARD_S_SUCCESS)
    {
        //
        // Successful, so return pointer to group names.
        //
        *lplpmszGroupNames = lpmszGroupNames;
    }
    else
    {
        //
        // Error occurred, so free memory.
        //
        SCFree((LPVOID) lpmszGroupNames);
    }

    return lResult;
}

LONG SCListReaders | ( | IN SCARDCONTEXT | hContext,
 |  | IN LPCTSTR | lpmszReaderGroups,
 |  | OUT LPTSTR * | lplpmszReaderNames
 | ) |  |

Definition at line 125 of file SCCommon.Cpp.

{
    LONG  lResult;
    DWORD dwReaders;

    //
    // Parameters sanity check.
    //
    assert(lplpmszReaderNames != NULL);

    //
    // Initialize returned info.
    //
    * lplpmszReaderNames = NULL;

    //
    // First find the required buffer length.
    //
    lResult = SCardListReaders(hContext,
                               lpmszReaderGroups,
                               NULL,         // NULL to indicate we want to
                               &dwReaders);  // know the length of the buffer
    if (lResult != SCARD_S_SUCCESS)
    {
        return lResult;
    }

    //
    // Allocate memory.
    //
    LPTSTR lpmszReaderNames = (LPTSTR) SCMalloc(dwReaders * sizeof(_TCHAR));

    if (lpmszReaderNames == NULL)
    {
        return ERROR_OUTOFMEMORY;
    }

    //
    // Now actually get the list of reader names.
    //
    lResult = SCardListReaders(hContext,
                               lpmszReaderGroups,
                               lpmszReaderNames,
                               &dwReaders);
    if (lResult == SCARD_S_SUCCESS)
    {
        //
        // Successful, so return pointer to reader names.
        //
        *lplpmszReaderNames = lpmszReaderNames;
    }
    else
    {
        //
        // Error occurred, so free memory.
        //
        SCFree((LPVOID) lpmszReaderNames);
    }

    return lResult;
}

LPVOID SCMalloc ( IN DWORD dwSize )

Definition at line 56 of file SCCommon.Cpp.

{
    return(HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwSize));
}

LONG SCSelectFile | ( | IN SCARDHANDLE | hCard,
 |  | IN LPBYTE | lpbFileName,
 |  | OUT LPDWORD | lpdwExtraBytes
 | ) |  |

Definition at line 619 of file SCCommon.Cpp.

{
    LONG lResult;

    //
    // Parameters sanity check.
    //
    assert(lpbFileName != NULL);
    assert(lpdwExtraBytes != NULL);

    //
    // Start with 0xC0.
    //
    lResult = scSelectFile(hCard, 0xC0, lpbFileName, lpdwExtraBytes);
    if (lResult == 0x6e00)
    {
        //
        // Try 0x00.
        //
        lResult = scSelectFile(hCard, 0x00, lpbFileName, lpdwExtraBytes);
    }

    return lResult;
}

Generated on Wed Nov 13 2024 16:54:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/SmartCard/SmartCardAPI/SCQuery/SCQuery.Cpp File Reference

  • Security
  • SmartCard
  • SmartCardAPI
  • SCQuery
Functions

SCQuery.Cpp File Reference

#include <tchar.h>
#include <stdio.h>
#include <windows.h>
#include <winscard.h>
#include "SCCommon.h"

Go to the source code of this file.

Functions

int __cdecl | _tmain (int argc, _TCHAR *argv[])
LONG | ListCards (IN SCARDCONTEXT hContext, IN LPCBYTE lpszATR)
LONG | ListGroups (IN SCARDCONTEXT hContext)
LONG | ListReaders (IN SCARDCONTEXT hContext, IN LPCTSTR lpmszReaderGroups)
LONG | QueryCards (IN SCARDCONTEXT hContext, IN LPCTSTR lpmszReaderGroups)

Function Documentation

int __cdecl _tmain | ( | int | argc,
 |  | _TCHAR * | argv[]
 | ) |  |

Definition at line 53 of file SCQuery.Cpp.

{
    LONG lResult;
    SCARDCONTEXT hContext = NULL;

    __try
    {
        //
        // Establish context with the resource manager.
        //
        lResult = SCardEstablishContext(SCARD_SCOPE_USER,
                                        NULL,
                                        NULL,
                                        &hContext);
        if (lResult != SCARD_S_SUCCESS)
        {
            __leave;
        }

        //
        // List readers
        //
        lResult = ListReaders(hContext, NULL);
        if (lResult != SCARD_S_SUCCESS)
        {
            __leave;
        }

        //
        // List cards
        //
        lResult = ListCards(hContext, NULL);
        if (lResult != SCARD_S_SUCCESS)
        {
            __leave;
        }

        //
        // List groups
        //
        lResult = ListGroups(hContext);
        if (lResult != SCARD_S_SUCCESS)
        {
            __leave;
        }

        //
        // Query cards
        //
        lResult = QueryCards(hContext, NULL);
    }

    __finally
    {
        //
        // Don't forget to release the context handle if established.
        //
        if (hContext != NULL)
        {
            LONG lReturn = SCardReleaseContext(hContext);

            //
            // If successful so far, then capture the SCardReleaseContext()
            // return code; otherwise, don't bother
            //
            if (lResult == SCARD_S_SUCCESS)
            {
                lResult = lReturn;
            }
        }
    }

    //
    // Inform user if an error had occurred.
    //
    if (lResult != SCARD_S_SUCCESS)
    {
        _tprintf(_T("\nError [0x%lx]: Program terminated abnormally.\n"),
                 lResult);
    }

    return((int) lResult);
}

LONG ListCards | ( | IN SCARDCONTEXT | hContext,
 |  | IN LPCBYTE | lpszATR
 | ) |  |

Definition at line 253 of file SCQuery.Cpp.

{
    LONG lResult;
    LPTSTR lpmszCardNames;

    __try
    {
        //
        // Get the list of registered cards associated with the specified ATR.
        // Note: The buffer is automatically allocated and must be freed
        //       by SCFree().
        //
        lResult = SCListCards(hContext,
                              lpszATR,
                              &lpmszCardNames);
        if (lResult != SCARD_S_SUCCESS)
        {
            __leave;
        }

        DWORD dwNumCards = 0;
        LPTSTR lpszCardName = lpmszCardNames;

        _tprintf(_T("\n"));
        _tprintf(_T("Registered Card(s)\n"));
        _tprintf(_T("==================\n"));

        //
        // Walk through the list of cards and print out some information.
        // Note: The list of cards are in a multi-string structure.
        //
        while (*lpszCardName != _T('\0'))
        {
            _tprintf(_T("%02d: %s\n"), ++dwNumCards, lpszCardName);
            lpszCardName += lstrlen(lpszCardName) + 1;
        }

        //
        // Inform the user if no card was found.
        //
        if (dwNumCards == 0)
        {
            _tprintf(_T("No registered Smart Card was found for the "
                        _T("specified ATR [%s].\n")), lpszATR);
        }
    }

    __finally
    {
        //
        // Don't forget to release memory, if allocated.
        //
        if (lpmszCardNames != NULL)
        {
            LONG lReturn = SCFree((LPVOID) lpmszCardNames);

            //
            // If successful so far, then capture the return code
            // from SCFree(); otherwise, don't bother.
            //
            if (lResult == SCARD_S_SUCCESS)
            {
                lResult = lReturn;
            }
        }
    }

    return lResult;
}

LONG ListGroups ( IN SCARDCONTEXT hContext )

Definition at line 340 of file SCQuery.Cpp.

{
    LONG lResult;
    LPTSTR lpmszGroupNames;

    __try
    {
        //
        // Get the list of registered reader groups.
        // Note: The buffer is automatically allocated and must be freed
        //       by SCFree().
        //
        lResult = SCListGroups(hContext,
                               (LPTSTR *) &lpmszGroupNames);
        if (lResult != SCARD_S_SUCCESS)
        {
            __leave;
        }

        DWORD  dwNumGroups   = 0;
        LPTSTR lpszGroupName = lpmszGroupNames;

        _tprintf(_T("\n"));
        _tprintf(_T("Registered Group(s)\n"));
        _tprintf(_T("===================\n"));

        //
        // Walk through the list of groups and print out some information.
        // Note: The list of cards are in a multi-string structure.
        //
        while (*lpszGroupName != TEXT('\0'))
        {
            _tprintf(_T("%02d: %s\n"), ++dwNumGroups, lpszGroupName);
            lpszGroupName += lstrlen(lpszGroupName) + 1;
        }

        //
        // Inform the user if no group was found.
        //
        if (dwNumGroups == 0)
        {
            _tprintf(_T("No registered reader group was found.\n"));
        }
    }

    __finally
    {
        //
        // Don't forget to release memory, if allocated.
        //
        if (lpmszGroupNames != NULL)
        {
            LONG lReturn = SCFree((LPVOID) lpmszGroupNames);

            //
            // If successful so far, then capture the return code
            // from SCFree(); otherwise, don't bother.
            //
            if (lResult == SCARD_S_SUCCESS)
            {
                lResult = lReturn;
            }
        }
    }

    return lResult;
}

LONG ListReaders | ( | IN SCARDCONTEXT | hContext,
 |  | IN LPCTSTR | lpmszReaderGroups
 | ) |  |

Definition at line 159 of file SCQuery.Cpp.

{
    LONG lResult;
    LPTSTR lpmszReaderNames;

    __try
    {
        //
        // Get the list of registered readers associated with the specified
        // group(s).
        // Note: The buffer is automatically allocated and must be freed
        //       by SCFree().
        //
        lResult = SCListReaders(hContext,
                                lpmszReaderGroups,
                                (LPTSTR *) &lpmszReaderNames);
        if (lResult != SCARD_S_SUCCESS)
        {
            __leave;
        }

        DWORD  dwNumReaders   = 0;
        LPTSTR lpszReaderName = lpmszReaderNames;

        _tprintf(_T("\n"));
        _tprintf(_T("Registered Reader(s)\n"));
        _tprintf(_T("====================\n"));

        //
        // Walk through the list of readers and print out some information.
        // Note: The list of readers are in a multi-string structure.
        //
        while (*lpszReaderName != _T('\0'))
        {
            _tprintf(_T("%02d: %s\n"), ++dwNumReaders, lpszReaderName);
            lpszReaderName += lstrlen(lpszReaderName) + 1;
        }

        //
        // Inform the user if no reader was found.
        //
        if (dwNumReaders == 0)
        {
            _tprintf(_T("No registered reader was found for the specified "
                        _T("reader group(s) [%s].\n")), lpmszReaderGroups);
        }
    }

    __finally
    {
        //
        // Don't forget to release memory, if allocated.
        //
        if (lpmszReaderNames != NULL)
        {
            LONG lReturn = SCFree((LPVOID) lpmszReaderNames);

            //
            // If successful so far, then capture the return code
            // from SCFree(); otherwise, don't bother.
            //
            if (lResult == SCARD_S_SUCCESS)
            {
                lResult = lReturn;
            }
        }
    }

    return lResult;
}

LONG QueryCards | ( | IN SCARDCONTEXT | hContext,
 |  | IN LPCTSTR | lpmszReaderGroups
 | ) |  |

Definition at line 429 of file SCQuery.Cpp.

{
    LONG   lResult          = SCARD_S_SUCCESS;
    LPTSTR lpmszReaderNames = NULL;

    __try
    {
        //
        // Get the list of registered readers associated with the specified
        // group(s).
        // Note: The buffer is automatically allocated and must be freed
        //       by SCFree().
        //
        lResult = SCListReaders(hContext,
                                lpmszReaderGroups,
                                (LPTSTR *) &lpmszReaderNames);
        if (lResult != SCARD_S_SUCCESS)
        {
            __leave;
        }

        _tprintf(_T("\n"));
        _tprintf(_T("Card in reader\n"));
        _tprintf(_T("==============\n"));

        //
        // Note that MAXIMUM_SMARTCARD_READERS (10) only refers to maximum # of
        // non-PnP readers. The resource manager is capable of handling any number
        // of PnP readers, in addition to the 10 non-PnP readers (your physical
        // system is the limiting factor). Make appropriate changes as necessary
        // to accomodate more readers.
        //

        DWORD  dwNumReaders   = 0;
        LPTSTR lpszReaderName = lpmszReaderNames;
        SCARD_READERSTATE rsReaders[MAXIMUM_SMARTCARD_READERS];

        ZeroMemory((LPVOID)rsReaders, sizeof(rsReaders));

        //
        // Prepare state array
        //
        while ((*lpszReaderName != _T('\0')) &&
               (dwNumReaders < MAXIMUM_SMARTCARD_READERS))
        {
            rsReaders[dwNumReaders].szReader = (LPCTSTR)lpszReaderName;
            rsReaders[dwNumReaders].dwCurrentState = SCARD_STATE_UNAWARE;

            dwNumReaders++;
            lpszReaderName += lstrlen(lpszReaderName) + 1;
        }

        if (dwNumReaders == 0)
        {
            _tprintf(_T("No registered reader was found for the specified "
                        _T("reader group(s) [%s].\n")), lpmszReaderGroups);
            __leave;
        }

        //
        // Now check state of each reader
        //
        lResult = SCardGetStatusChange(hContext,
                                       INFINITE,
                                       rsReaders,
                                       dwNumReaders);
        if (lResult != SCARD_S_SUCCESS)
        {
            __leave;
        }

        for (DWORD dwIndex = 0; dwIndex < dwNumReaders; dwIndex++)
        {
            //
            // Print out reader name
            //
            _tprintf(_T("%02d: %s\n"), dwIndex + 1, rsReaders[dwIndex].szReader);

            //
            // If a card is present in this reader, print ATR and
            // any extra data from the Select File command.
            //
            if (!(rsReaders[dwIndex].dwEventState & SCARD_STATE_PRESENT))
            {
                _tprintf(_T("    No Smart Card found in this reader.\n"));
                continue;
            }

            SCARDHANDLE hCard  = NULL;
            LPBYTE lpbResponse = NULL;

            __try
            {
                DWORD dwActiveProtocol;

                //
                // Connect to the card
                //
                lResult = SCardConnect(hContext,
                                       rsReaders[dwIndex].szReader,
                                       SCARD_SHARE_SHARED,
                                       SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1,
                                       &hCard,
                                       &dwActiveProtocol);
                if (lResult != SCARD_S_SUCCESS)
                {
                    __leave;
                }

                DWORD dwReaderLen = 0;
                DWORD dwState;
                DWORD dwProtocol;
                BYTE  atr[MAXIMUM_ATTR_STRING_LENGTH];
                DWORD dwAtrLen;

                //
                // Get status of card
                //
                lResult = SCardStatus(hCard,
                                      NULL,
                                      &dwReaderLen,
                                      &dwState,
                                      &dwProtocol,
                                      atr,
                                      &dwAtrLen);
                if (lResult != SCARD_S_SUCCESS)
                {
                    __leave;
                }

                //
                // Print out ATR bytes of card
                //
                _tprintf(_T("    ATR = "), dwIndex + 1);
                for (DWORD i = 0; i < dwAtrLen; i++)
                {
                    _tprintf(_T("%02x "), (DWORD) atr[i]);
                }

                _tprintf(_T("\n"));

                BYTE filename[2] = {0x3f, 0x00};
                DWORD dwExtraBytes;

                //
                // Select Master File (0x3f00)
                //
                lResult = SCSelectFile(hCard,
                                       filename,
                                       &dwExtraBytes);
                if (lResult != SCARD_S_SUCCESS)
                {
                    __leave;
                }

                //
                // Any extra data?
                //
                if (dwExtraBytes)
                {
                    //
                    // Yes, so retrieve it
                    //
                    lResult = SCGetResponse(hCard, dwExtraBytes, &lpbResponse);

                    if (lResult == SCARD_S_SUCCESS)
                    {
                        //
                        // Print out MF file control information
                        //
                        _tprintf(_T("    FCI = "), dwIndex + 1);
                        for (DWORD i = 0; i < dwExtraBytes; i++)
                        {
                            _tprintf(_T("%02x "), (DWORD) lpbResponse[i]);
                        }

                        _tprintf(_T("\n"));
                    }
                }

                _tprintf(_T("\n"));
            }

            __finally
            {
                LONG lReturn;

                //
                // Don't forget to release the memory block if it had been
                // allocated by SCGetResponse().
                //
                if (lpbResponse != NULL)
                {
                    lReturn = SCFree((LPVOID) lpbResponse);

                    //
                    // If successful so far, then capture the return code
                    // from SCFree(); otherwise, don't bother.
                    //
                    if (lResult == SCARD_S_SUCCESS)
                    {
                        lResult = lReturn;
                    }
                }

                //
                // Don't forget to disconnect the card.
                //
                if (hCard != NULL)
                {
                    lReturn = SCardDisconnect(hCard, SCARD_LEAVE_CARD);

                    //
                    // If successful so far, then capture the SCardDisconnect()
                    // return code; otherwise, don't bother.
                    //
                    if (lResult == SCARD_S_SUCCESS)
                    {
                        lResult = lReturn;
                    }
                }
            }
        }
    }

    __finally
    {
        LONG lReturn;

        //
        // Don't forget to release memory, if allocated.
        //
        if (lpmszReaderNames != NULL)
        {
            lReturn = SCFree((LPVOID) lpmszReaderNames);

            //
            // If successful so far, then capture the return code
            // from SCFree(); otherwise, don't bother.
            //
            if (lResult == SCARD_S_SUCCESS)
            {
                lResult = lReturn;
            }
        }
    }

    return lResult;
}

Generated on Wed Nov 13 2024 16:54:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/SSPI/GSS/Gss-Misc.h File Reference

  • Security
  • SSPI
  • GSS
Classes | Defines | Typedefs | Functions | Variables

Gss-Misc.h File Reference

#include <windows.h>
#include <rpc.h>
#include <stdio.h>
#include <stdlib.h>
#include <io.h>
#include <fcntl.h>
#include <winsock2.h>
#include <security.h>
#include <ntsecapi.h>
#include "gssapi.h"

Go to the source code of this file.

Classes

struct | FLAGMAPPING

Defines

#define | PROTOTYPE(_x_) _x_
#define | SECURITY_WIN32

Typedefs

typedef struct FLAGMAPPING * | PFLAGMAPPING

Functions

int send_token | PROTOTYPE ((int s, PSecBuffer tok))
void print_token | PROTOTYPE ((PSecBuffer tok))
void display_ctx_flags | PROTOTYPE ((ULONG flags))
void display_status | PROTOTYPE ((char *msg, ULONG maj_stat, ULONG min_stat))

Variables

FILE * | display_file

Define Documentation

#define PROTOTYPE ( _x_ ) _x_

Definition at line 41 of file Gss-Misc.h.

#define SECURITY_WIN32

Definition at line 36 of file Gss-Misc.h.

Typedef Documentation

typedef struct FLAGMAPPING * PFLAGMAPPING

Function Documentation

int recv_token PROTOTYPE ( (int s, PSecBuffer tok) )
void print_token PROTOTYPE ( (PSecBuffer tok) )
void display_ctx_flags PROTOTYPE ( (ULONG flags) )
void display_status PROTOTYPE ( (char *msg, ULONG maj_stat, ULONG min_stat) )

Variable Documentation

FILE* display_file

Definition at line 25 of file GssMisc.c.

Generated on Wed Nov 13 2024 16:54:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/SSPI/GSS/GssAPI.h File Reference

  • Security
  • SSPI
  • GSS
Classes | Defines | Typedefs | Functions

GssAPI.h File Reference

#include <stddef.h>
#include <sys/types.h>

Go to the source code of this file.

Classes

struct | gss_buffer_desc_struct
struct | gss_channel_bindings_struct
struct | gss_OID_desc_struct
struct | gss_OID_set_desc_struct

Defines

#define | FAR
#define | GSS_C_ACCEPT 2
#define | GSS_C_AF_APPLETALK 16
#define | GSS_C_AF_BSC 17
#define | GSS_C_AF_CCITT 10
#define | GSS_C_AF_CHAOS 5
#define | GSS_C_AF_DATAKIT 9
#define | GSS_C_AF_DECnet 12
#define | GSS_C_AF_DLI 13
#define | GSS_C_AF_DSS 18
#define | GSS_C_AF_ECMA 8
#define | GSS_C_AF_HYLINK 15
#define | GSS_C_AF_IMPLINK 3
#define | GSS_C_AF_INET 2
#define | GSS_C_AF_LAT 14
#define | GSS_C_AF_LOCAL 1
#define | GSS_C_AF_NBS 7
#define | GSS_C_AF_NS 6
#define | GSS_C_AF_NULLADDR 255
#define | GSS_C_AF_OSI 19
#define | GSS_C_AF_PUP 4
#define | GSS_C_AF_SNA 11
#define | GSS_C_AF_UNSPEC 0
#define | GSS_C_AF_X25 21
#define | GSS_C_ANON_FLAG 64
#define | GSS_C_BOTH 0
#define | GSS_C_CALLING_ERROR_MASK ((OM_uint32) 0377ul)
#define | GSS_C_CALLING_ERROR_OFFSET 24
#define | GSS_C_CONF_FLAG 16
#define | GSS_C_DELEG_FLAG 1
#define | GSS_C_EMPTY_BUFFER {0, NULL}
#define | GSS_C_GSS_CODE 1
#define | GSS_C_INDEFINITE ((OM_uint32) 0xfffffffful)
#define | GSS_C_INITIATE 1
#define | GSS_C_INTEG_FLAG 32
#define | GSS_C_MECH_CODE 2
#define | GSS_C_MUTUAL_FLAG 2
#define | GSS_C_NO_BUFFER ((gss_buffer_t) 0)
#define | GSS_C_NO_CHANNEL_BINDINGS ((gss_channel_bindings_t) 0)
#define | GSS_C_NO_CONTEXT ((gss_ctx_id_t) 0)
#define | GSS_C_NO_CREDENTIAL ((gss_cred_id_t) 0)
#define | GSS_C_NO_OID ((gss_OID) 0)
#define | GSS_C_NO_OID_SET ((gss_OID_set) 0)
#define | GSS_C_NULL_OID GSS_C_NO_OID
#define | GSS_C_NULL_OID_SET GSS_C_NO_OID_SET
#define | GSS_C_QOP_DEFAULT 0
#define | GSS_C_REPLAY_FLAG 4
#define | GSS_C_ROUTINE_ERROR_MASK ((OM_uint32) 0377ul)
#define | GSS_C_ROUTINE_ERROR_OFFSET 16
#define | GSS_C_SEQUENCE_FLAG 8
#define | GSS_C_SUPPLEMENTARY_MASK ((OM_uint32) 0177777ul)
#define | GSS_C_SUPPLEMENTARY_OFFSET 0
#define | GSS_CALLING_ERROR(x) ((x) & (GSS_C_CALLING_ERROR_MASK << GSS_C_CALLING_ERROR_OFFSET))
#define | GSS_CALLING_ERROR_FIELD(x) (((x) >> GSS_C_CALLING_ERROR_OFFSET) & GSS_C_CALLING_ERROR_MASK)
#define | GSS_ERROR(x)
#define | GSS_ROUTINE_ERROR(x) ((x) & (GSS_C_ROUTINE_ERROR_MASK << GSS_C_ROUTINE_ERROR_OFFSET))
#define | GSS_ROUTINE_ERROR_FIELD(x) (((x) >> GSS_C_ROUTINE_ERROR_OFFSET) & GSS_C_ROUTINE_ERROR_MASK)
#define | GSS_S_BAD_BINDINGS (((OM_uint32) 4ul) << GSS_C_ROUTINE_ERROR_OFFSET)
#define | GSS_S_BAD_MECH (((OM_uint32) 1ul) << GSS_C_ROUTINE_ERROR_OFFSET)
#define | GSS_S_BAD_NAME (((OM_uint32) 2ul) << GSS_C_ROUTINE_ERROR_OFFSET)
#define | GSS_S_BAD_NAMETYPE (((OM_uint32) 3ul) << GSS_C_ROUTINE_ERROR_OFFSET)
#define | GSS_S_BAD_QOP (((OM_uint32) 14ul) << GSS_C_ROUTINE_ERROR_OFFSET)
#define | GSS_S_BAD_SIG (((OM_uint32) 6ul) << GSS_C_ROUTINE_ERROR_OFFSET)
#define | GSS_S_BAD_STATUS (((OM_uint32) 5ul) << GSS_C_ROUTINE_ERROR_OFFSET)
#define | GSS_S_CALL_BAD_STRUCTURE (((OM_uint32) 3ul) << GSS_C_CALLING_ERROR_OFFSET)
#define | GSS_S_CALL_INACCESSIBLE_READ (((OM_uint32) 1ul) << GSS_C_CALLING_ERROR_OFFSET)
#define | GSS_S_CALL_INACCESSIBLE_WRITE (((OM_uint32) 2ul) << GSS_C_CALLING_ERROR_OFFSET)
#define | GSS_S_COMPLETE 0
#define | GSS_S_CONTEXT_EXPIRED (((OM_uint32) 12ul) << GSS_C_ROUTINE_ERROR_OFFSET)
#define | GSS_S_CONTINUE_NEEDED (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 0))
#define | GSS_S_CRED_UNAVAIL GSS_S_FAILURE
#define | GSS_S_CREDENTIALS_EXPIRED (((OM_uint32) 11ul) << GSS_C_ROUTINE_ERROR_OFFSET)
#define | GSS_S_DEFECTIVE_CREDENTIAL (((OM_uint32) 10ul) << GSS_C_ROUTINE_ERROR_OFFSET)
#define | GSS_S_DEFECTIVE_TOKEN (((OM_uint32) 9ul) << GSS_C_ROUTINE_ERROR_OFFSET)
#define | GSS_S_DUPLICATE_ELEMENT (((OM_uint32) 17ul) << GSS_C_ROUTINE_ERROR_OFFSET)
#define | GSS_S_DUPLICATE_TOKEN (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 1))
#define | GSS_S_FAILURE (((OM_uint32) 13ul) << GSS_C_ROUTINE_ERROR_OFFSET)
#define | GSS_S_GAP_TOKEN (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 4))
#define | GSS_S_NO_CONTEXT (((OM_uint32) 8ul) << GSS_C_ROUTINE_ERROR_OFFSET)
#define | GSS_S_NO_CRED (((OM_uint32) 7ul) << GSS_C_ROUTINE_ERROR_OFFSET)
#define | GSS_S_OLD_TOKEN (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 2))
#define | GSS_S_UNAUTHORIZED (((OM_uint32) 15ul) << GSS_C_ROUTINE_ERROR_OFFSET)
#define | GSS_S_UNAVAILABLE (((OM_uint32) 16ul) << GSS_C_ROUTINE_ERROR_OFFSET)
#define | GSS_S_UNSEQ_TOKEN (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 3))
#define | GSS_SIZEOF_INT SIZEOF_INT
#define | GSS_SIZEOF_LONG SIZEOF_LONG
#define | GSS_SIZEOF_SHORT SIZEOF_SHORT
#define | GSS_SUPPLEMENTARY_INFO(x) ((x) & (GSS_C_SUPPLEMENTARY_MASK << GSS_C_SUPPLEMENTARY_OFFSET))
#define | GSS_SUPPLEMENTARY_INFO_FIELD(x) (((x) >> GSS_C_SUPPLEMENTARY_OFFSET) & GSS_C_SUPPLEMENTARY_MASK)
#define | INTERFACE
#define | INTERFACE_C
#define | KRB5_CALLCONV
#define | KRB5_CALLCONV_C
#define | KRB5_DLLIMP
#define | NEAR
#define | PROTOTYPE(x) x

Typedefs

typedef struct
gss_buffer_desc_struct 		gss_buffer_desc
typedef struct
gss_buffer_desc_struct * 		gss_buffer_t
typedef struct
gss_channel_bindings_struct * 		gss_channel_bindings_t
typedef void FAR * | gss_cred_id_t
typedef int | gss_cred_usage_t
typedef void FAR * | gss_ctx_id_t
typedef long | gss_int32
typedef void FAR * | gss_name_t
typedef struct
gss_OID_desc_struct * 		gss_OID
typedef struct gss_OID_desc_struct | gss_OID_desc
typedef struct
gss_OID_set_desc_struct * 		gss_OID_set
typedef struct
gss_OID_set_desc_struct 		gss_OID_set_desc
typedef OM_uint32 | gss_qop_t
typedef unsigned long | gss_uint32
typedef gss_uint32 | OM_uint32

Functions

KRB5_DLLIMP OM_uint32
KRB5_CALLCONV gss_acquire_cred 		PROTOTYPE ((OM_uint32 FAR *, gss_name_t, OM_uint32, gss_OID_set, gss_cred_usage_t, gss_cred_id_t FAR *, gss_OID_set FAR *, OM_uint32 FAR *))
KRB5_DLLIMP OM_uint32
KRB5_CALLCONV gss_unseal 		PROTOTYPE ((OM_uint32 FAR *, gss_ctx_id_t, gss_buffer_t, gss_buffer_t, int FAR *, int FAR *))
KRB5_DLLIMP OM_uint32
KRB5_CALLCONV gss_seal 		PROTOTYPE ((OM_uint32 FAR *, gss_ctx_id_t, int, int, gss_buffer_t, int FAR *, gss_buffer_t))
KRB5_DLLIMP OM_uint32
KRB5_CALLCONV gss_verify 		PROTOTYPE ((OM_uint32 FAR *, gss_ctx_id_t, gss_buffer_t, gss_buffer_t, int FAR *))
KRB5_DLLIMP OM_uint32
KRB5_CALLCONV gss_sign 		PROTOTYPE ((OM_uint32 FAR *, gss_ctx_id_t, int, gss_buffer_t, gss_buffer_t))
KRB5_DLLIMP OM_uint32
KRB5_CALLCONV gss_oid_to_str 		PROTOTYPE ((OM_uint32 FAR *, gss_OID, gss_buffer_t))
KRB5_DLLIMP OM_uint32
KRB5_CALLCONV gss_str_to_oid 		PROTOTYPE ((OM_uint32 FAR *, gss_buffer_t, gss_OID FAR *))
KRB5_DLLIMP OM_uint32
KRB5_CALLCONV
gss_test_oid_set_member 		PROTOTYPE ((OM_uint32 FAR *, gss_OID, gss_OID_set, int FAR *))
KRB5_DLLIMP OM_uint32
KRB5_CALLCONV
gss_add_oid_set_member 		PROTOTYPE ((OM_uint32 FAR *, gss_OID, gss_OID_set FAR *))
KRB5_DLLIMP OM_uint32
KRB5_CALLCONV gss_release_oid 		PROTOTYPE ((OM_uint32 FAR *, gss_OID FAR *))
KRB5_DLLIMP OM_uint32
KRB5_CALLCONV
gss_import_sec_context 		PROTOTYPE ((OM_uint32 FAR *, gss_buffer_t, gss_ctx_id_t FAR *))
KRB5_DLLIMP OM_uint32
KRB5_CALLCONV
gss_inquire_cred_by_mech 		PROTOTYPE ((OM_uint32FAR *, gss_cred_id_t, gss_OID, gss_name_t FAR *, OM_uint32 FAR *, OM_uint32 FAR *, gss_cred_usage_t FAR *))
KRB5_DLLIMP OM_uint32
KRB5_CALLCONV gss_add_cred 		PROTOTYPE ((OM_uint32 FAR *, gss_cred_id_t, gss_name_t, gss_OID, gss_cred_usage_t, OM_uint32, OM_uint32, gss_cred_id_t FAR *, gss_OID_set FAR *, OM_uint32 FAR *, OM_uint32 FAR *))
KRB5_DLLIMP OM_uint32
KRB5_CALLCONV
gss_export_name_object 		PROTOTYPE ((OM_uint32 FAR *, gss_name_t, gss_OID, void FAR *FAR *))
KRB5_DLLIMP OM_uint32
KRB5_CALLCONV
gss_import_name_object 		PROTOTYPE ((OM_uint32 FAR *, void FAR *, gss_OID, gss_name_t FAR *))
KRB5_DLLIMP OM_uint32
KRB5_CALLCONV
gss_wrap_size_limit 		PROTOTYPE ((OM_uint32 FAR *, gss_ctx_id_t, int, gss_qop_t, OM_uint32, OM_uint32 *))
KRB5_DLLIMP OM_uint32
KRB5_CALLCONV
gss_inquire_context 		PROTOTYPE ((OM_uint32 FAR *, gss_ctx_id_t, gss_name_t FAR *, gss_name_t FAR *, OM_uint32 FAR *, gss_OID FAR *, OM_uint32 FAR *, int FAR *, int FAR *))
KRB5_DLLIMP OM_uint32
KRB5_CALLCONV gss_inquire_cred 		PROTOTYPE ((OM_uint32 FAR *, gss_cred_id_t, gss_name_t FAR *, OM_uint32 FAR *, gss_cred_usage_t FAR *, gss_OID_set FAR *))
KRB5_DLLIMP OM_uint32
KRB5_CALLCONV
gss_release_buffer 		PROTOTYPE ((OM_uint32 FAR *, gss_buffer_t))
KRB5_DLLIMP OM_uint32
KRB5_CALLCONV gss_release_name 		PROTOTYPE ((OM_uint32 FAR *, gss_name_t FAR *))
KRB5_DLLIMP OM_uint32
KRB5_CALLCONV gss_import_name 		PROTOTYPE ((OM_uint32 FAR *, gss_buffer_t, gss_OID, gss_name_t FAR *))
KRB5_DLLIMP OM_uint32
KRB5_CALLCONV gss_display_name 		PROTOTYPE ((OM_uint32 FAR *, gss_name_t, gss_buffer_t, gss_OID FAR *))
KRB5_DLLIMP OM_uint32
KRB5_CALLCONV gss_compare_name 		PROTOTYPE ((OM_uint32 FAR *, gss_name_t, gss_name_t, int FAR *))
KRB5_DLLIMP OM_uint32
KRB5_CALLCONV
gss_indicate_mechs 		PROTOTYPE ((OM_uint32 FAR *, gss_OID_set FAR *))
KRB5_DLLIMP OM_uint32
KRB5_CALLCONV
gss_display_status 		PROTOTYPE ((OM_uint32 FAR *, OM_uint32, int, gss_OID, OM_uint32 FAR *, gss_buffer_t))
KRB5_DLLIMP OM_uint32
KRB5_CALLCONV gss_unwrap 		PROTOTYPE ((OM_uint32 FAR *, gss_ctx_id_t, gss_buffer_t, gss_buffer_t, int FAR *, gss_qop_t FAR *))
KRB5_DLLIMP OM_uint32
KRB5_CALLCONV gss_wrap 		PROTOTYPE ((OM_uint32 FAR *, gss_ctx_id_t, int, gss_qop_t, gss_buffer_t, int FAR *, gss_buffer_t))
KRB5_DLLIMP OM_uint32
KRB5_CALLCONV gss_verify_mic 		PROTOTYPE ((OM_uint32 FAR *, gss_ctx_id_t, gss_buffer_t, gss_buffer_t, gss_qop_t *))
KRB5_DLLIMP OM_uint32
KRB5_CALLCONV gss_get_mic 		PROTOTYPE ((OM_uint32 FAR *, gss_ctx_id_t, gss_qop_t, gss_buffer_t, gss_buffer_t))
KRB5_DLLIMP OM_uint32
KRB5_CALLCONV gss_context_time 		PROTOTYPE ((OM_uint32 FAR *, gss_ctx_id_t, OM_uint32 FAR *))
KRB5_DLLIMP OM_uint32
KRB5_CALLCONV
gss_delete_sec_context 		PROTOTYPE ((OM_uint32 FAR *, gss_ctx_id_t FAR *, gss_buffer_t))
KRB5_DLLIMP OM_uint32
KRB5_CALLCONV
gss_process_context_token 		PROTOTYPE ((OM_uint32 FAR *, gss_ctx_id_t, gss_buffer_t))
KRB5_DLLIMP OM_uint32
KRB5_CALLCONV
gss_accept_sec_context 		PROTOTYPE ((OM_uint32 FAR *, gss_ctx_id_t FAR *, gss_cred_id_t, gss_buffer_t, gss_channel_bindings_t, gss_name_t FAR *, gss_OID FAR *, gss_buffer_t, OM_uint32 FAR *, OM_uint32 FAR *, gss_cred_id_t FAR *))
KRB5_DLLIMP OM_uint32
KRB5_CALLCONV
gss_init_sec_context 		PROTOTYPE ((OM_uint32 FAR *, gss_cred_id_t, gss_ctx_id_t FAR *, gss_name_t, gss_OID, OM_uint32, OM_uint32, gss_channel_bindings_t, gss_buffer_t, gss_OID FAR *, gss_buffer_t, OM_uint32 FAR *, OM_uint32 FAR *))
KRB5_DLLIMP OM_uint32
KRB5_CALLCONV gss_release_cred 		PROTOTYPE ((OM_uint32 FAR *, gss_cred_id_t FAR *))

Define Documentation

#define FAR

Definition at line 68 of file GssAPI.h.

#define GSS_C_ACCEPT 2

Definition at line 154 of file GssAPI.h.

#define GSS_C_AF_APPLETALK 16

Definition at line 181 of file GssAPI.h.

#define GSS_C_AF_BSC 17

Definition at line 182 of file GssAPI.h.

#define GSS_C_AF_CCITT 10

Definition at line 175 of file GssAPI.h.

#define GSS_C_AF_CHAOS 5

Definition at line 170 of file GssAPI.h.

#define GSS_C_AF_DATAKIT 9

Definition at line 174 of file GssAPI.h.

#define GSS_C_AF_DECnet 12

Definition at line 177 of file GssAPI.h.

#define GSS_C_AF_DLI 13

Definition at line 178 of file GssAPI.h.

#define GSS_C_AF_DSS 18

Definition at line 183 of file GssAPI.h.

#define GSS_C_AF_ECMA 8

Definition at line 173 of file GssAPI.h.

#define GSS_C_AF_HYLINK 15

Definition at line 180 of file GssAPI.h.

#define GSS_C_AF_IMPLINK 3

Definition at line 168 of file GssAPI.h.

#define GSS_C_AF_INET 2

Definition at line 167 of file GssAPI.h.

#define GSS_C_AF_LAT 14

Definition at line 179 of file GssAPI.h.

#define GSS_C_AF_LOCAL 1

Definition at line 166 of file GssAPI.h.

#define GSS_C_AF_NBS 7

Definition at line 172 of file GssAPI.h.

#define GSS_C_AF_NS 6

Definition at line 171 of file GssAPI.h.

#define GSS_C_AF_NULLADDR 255

Definition at line 187 of file GssAPI.h.

#define GSS_C_AF_OSI 19

Definition at line 184 of file GssAPI.h.

#define GSS_C_AF_PUP 4

Definition at line 169 of file GssAPI.h.

#define GSS_C_AF_SNA 11

Definition at line 176 of file GssAPI.h.

#define GSS_C_AF_UNSPEC 0

Definition at line 165 of file GssAPI.h.

#define GSS_C_AF_X25 21

Definition at line 185 of file GssAPI.h.

#define GSS_C_ANON_FLAG 64

Definition at line 147 of file GssAPI.h.

#define GSS_C_BOTH 0

Definition at line 152 of file GssAPI.h.

#define GSS_C_CALLING_ERROR_MASK ((OM_uint32) 0377ul)

Definition at line 234 of file GssAPI.h.

#define GSS_C_CALLING_ERROR_OFFSET 24

Definition at line 231 of file GssAPI.h.

#define GSS_C_CONF_FLAG 16

Definition at line 145 of file GssAPI.h.

#define GSS_C_DELEG_FLAG 1

Definition at line 141 of file GssAPI.h.

#define GSS_C_EMPTY_BUFFER {0, NULL}

Definition at line 198 of file GssAPI.h.

#define GSS_C_GSS_CODE 1

Definition at line 159 of file GssAPI.h.

#define GSS_C_INDEFINITE ((OM_uint32) 0xfffffffful)

Definition at line 221 of file GssAPI.h.

#define GSS_C_INITIATE 1

Definition at line 153 of file GssAPI.h.

#define GSS_C_INTEG_FLAG 32

Definition at line 146 of file GssAPI.h.

#define GSS_C_MECH_CODE 2

Definition at line 160 of file GssAPI.h.

#define GSS_C_MUTUAL_FLAG 2

Definition at line 142 of file GssAPI.h.

#define GSS_C_NO_BUFFER ((gss_buffer_t) 0)

Definition at line 192 of file GssAPI.h.

#define GSS_C_NO_CHANNEL_BINDINGS ((gss_channel_bindings_t) 0)

Definition at line 197 of file GssAPI.h.

#define GSS_C_NO_CONTEXT ((gss_ctx_id_t) 0)

Definition at line 195 of file GssAPI.h.

#define GSS_C_NO_CREDENTIAL ((gss_cred_id_t) 0)

Definition at line 196 of file GssAPI.h.

#define GSS_C_NO_OID ((gss_OID) 0)

Definition at line 193 of file GssAPI.h.

#define GSS_C_NO_OID_SET ((gss_OID_set) 0)

Definition at line 194 of file GssAPI.h.

#define GSS_C_NULL_OID GSS_C_NO_OID

Definition at line 204 of file GssAPI.h.

#define GSS_C_NULL_OID_SET GSS_C_NO_OID_SET

Definition at line 205 of file GssAPI.h.

#define GSS_C_QOP_DEFAULT 0

Definition at line 215 of file GssAPI.h.

#define GSS_C_REPLAY_FLAG 4

Definition at line 143 of file GssAPI.h.

#define GSS_C_ROUTINE_ERROR_MASK ((OM_uint32) 0377ul)

Definition at line 235 of file GssAPI.h.

#define GSS_C_ROUTINE_ERROR_OFFSET 16

Definition at line 232 of file GssAPI.h.

#define GSS_C_SEQUENCE_FLAG 8

Definition at line 144 of file GssAPI.h.

#define GSS_C_SUPPLEMENTARY_MASK ((OM_uint32) 0177777ul)

Definition at line 236 of file GssAPI.h.

#define GSS_C_SUPPLEMENTARY_OFFSET 0

Definition at line 233 of file GssAPI.h.

#define GSS_CALLING_ERROR ( x ) ((x) & (GSS_C_CALLING_ERROR_MASK << GSS_C_CALLING_ERROR_OFFSET))

Definition at line 243 of file GssAPI.h.

#define GSS_CALLING_ERROR_FIELD ( x ) (((x) >> GSS_C_CALLING_ERROR_OFFSET) & GSS_C_CALLING_ERROR_MASK)

Definition at line 645 of file GssAPI.h.

#define GSS_ERROR ( x )
Value:
((x) & ((GSS_C_CALLING_ERROR_MASK << GSS_C_CALLING_ERROR_OFFSET) | \
          (GSS_C_ROUTINE_ERROR_MASK << GSS_C_ROUTINE_ERROR_OFFSET)))

Definition at line 249 of file GssAPI.h.

#define GSS_ROUTINE_ERROR ( x ) ((x) & (GSS_C_ROUTINE_ERROR_MASK << GSS_C_ROUTINE_ERROR_OFFSET))

Definition at line 245 of file GssAPI.h.

#define GSS_ROUTINE_ERROR_FIELD ( x ) (((x) >> GSS_C_ROUTINE_ERROR_OFFSET) & GSS_C_ROUTINE_ERROR_MASK)

Definition at line 647 of file GssAPI.h.

#define GSS_S_BAD_BINDINGS (((OM_uint32) 4ul) << GSS_C_ROUTINE_ERROR_OFFSET)

Definition at line 273 of file GssAPI.h.

#define GSS_S_BAD_MECH (((OM_uint32) 1ul) << GSS_C_ROUTINE_ERROR_OFFSET)

Definition at line 270 of file GssAPI.h.

#define GSS_S_BAD_NAME (((OM_uint32) 2ul) << GSS_C_ROUTINE_ERROR_OFFSET)

Definition at line 271 of file GssAPI.h.

#define GSS_S_BAD_NAMETYPE (((OM_uint32) 3ul) << GSS_C_ROUTINE_ERROR_OFFSET)

Definition at line 272 of file GssAPI.h.

#define GSS_S_BAD_QOP (((OM_uint32) 14ul) << GSS_C_ROUTINE_ERROR_OFFSET)

Definition at line 286 of file GssAPI.h.

#define GSS_S_BAD_SIG (((OM_uint32) 6ul) << GSS_C_ROUTINE_ERROR_OFFSET)

Definition at line 275 of file GssAPI.h.

#define GSS_S_BAD_STATUS (((OM_uint32) 5ul) << GSS_C_ROUTINE_ERROR_OFFSET)

Definition at line 274 of file GssAPI.h.

#define GSS_S_CALL_BAD_STRUCTURE (((OM_uint32) 3ul) << GSS_C_CALLING_ERROR_OFFSET)

Definition at line 264 of file GssAPI.h.

#define GSS_S_CALL_INACCESSIBLE_READ (((OM_uint32) 1ul) << GSS_C_CALLING_ERROR_OFFSET)

Definition at line 260 of file GssAPI.h.

#define GSS_S_CALL_INACCESSIBLE_WRITE (((OM_uint32) 2ul) << GSS_C_CALLING_ERROR_OFFSET)

Definition at line 262 of file GssAPI.h.

#define GSS_S_COMPLETE 0

Definition at line 226 of file GssAPI.h.

#define GSS_S_CONTEXT_EXPIRED (((OM_uint32) 12ul) << GSS_C_ROUTINE_ERROR_OFFSET)

Definition at line 283 of file GssAPI.h.

#define GSS_S_CONTINUE_NEEDED (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 0))

Definition at line 298 of file GssAPI.h.

#define GSS_S_CRED_UNAVAIL GSS_S_FAILURE

Definition at line 653 of file GssAPI.h.

#define GSS_S_CREDENTIALS_EXPIRED (((OM_uint32) 11ul) << GSS_C_ROUTINE_ERROR_OFFSET)

Definition at line 281 of file GssAPI.h.

#define GSS_S_DEFECTIVE_CREDENTIAL (((OM_uint32) 10ul) << GSS_C_ROUTINE_ERROR_OFFSET)

Definition at line 279 of file GssAPI.h.

#define GSS_S_DEFECTIVE_TOKEN (((OM_uint32) 9ul) << GSS_C_ROUTINE_ERROR_OFFSET)

Definition at line 278 of file GssAPI.h.

#define GSS_S_DUPLICATE_ELEMENT (((OM_uint32) 17ul) << GSS_C_ROUTINE_ERROR_OFFSET)

Definition at line 292 of file GssAPI.h.

#define GSS_S_DUPLICATE_TOKEN (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 1))

Definition at line 299 of file GssAPI.h.

#define GSS_S_FAILURE (((OM_uint32) 13ul) << GSS_C_ROUTINE_ERROR_OFFSET)

Definition at line 285 of file GssAPI.h.

#define GSS_S_GAP_TOKEN (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 4))

Definition at line 305 of file GssAPI.h.

#define GSS_S_NO_CONTEXT (((OM_uint32) 8ul) << GSS_C_ROUTINE_ERROR_OFFSET)

Definition at line 277 of file GssAPI.h.

#define GSS_S_NO_CRED (((OM_uint32) 7ul) << GSS_C_ROUTINE_ERROR_OFFSET)

Definition at line 276 of file GssAPI.h.

#define GSS_S_OLD_TOKEN (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 2))

Definition at line 300 of file GssAPI.h.

#define GSS_S_UNAUTHORIZED (((OM_uint32) 15ul) << GSS_C_ROUTINE_ERROR_OFFSET)

Definition at line 287 of file GssAPI.h.

#define GSS_S_UNAVAILABLE (((OM_uint32) 16ul) << GSS_C_ROUTINE_ERROR_OFFSET)

Definition at line 288 of file GssAPI.h.

#define GSS_S_UNSEQ_TOKEN (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 3))

Definition at line 301 of file GssAPI.h.

#define GSS_SIZEOF_INT SIZEOF_INT

Definition at line 72 of file GssAPI.h.

#define GSS_SIZEOF_LONG SIZEOF_LONG

Definition at line 73 of file GssAPI.h.

#define GSS_SIZEOF_SHORT SIZEOF_SHORT

Definition at line 74 of file GssAPI.h.

#define GSS_SUPPLEMENTARY_INFO ( x ) ((x) & (GSS_C_SUPPLEMENTARY_MASK << GSS_C_SUPPLEMENTARY_OFFSET))

Definition at line 247 of file GssAPI.h.

#define GSS_SUPPLEMENTARY_INFO_FIELD ( x ) (((x) >> GSS_C_SUPPLEMENTARY_OFFSET) & GSS_C_SUPPLEMENTARY_MASK)

Definition at line 649 of file GssAPI.h.

#define INTERFACE

Definition at line 66 of file GssAPI.h.

#define INTERFACE_C

Definition at line 67 of file GssAPI.h.

#define KRB5_CALLCONV

Definition at line 63 of file GssAPI.h.

#define KRB5_CALLCONV_C

Definition at line 64 of file GssAPI.h.

#define KRB5_DLLIMP

Definition at line 65 of file GssAPI.h.

#define NEAR

Definition at line 69 of file GssAPI.h.

#define PROTOTYPE ( x ) x

Definition at line 88 of file GssAPI.h.

Typedef Documentation

typedef struct gss_buffer_desc_struct gss_buffer_desc
typedef struct gss_buffer_desc_struct* gss_buffer_t
typedef struct gss_channel_bindings_struct* gss_channel_bindings_t
typedef void FAR* gss_cred_id_t

Definition at line 96 of file GssAPI.h.

typedef int gss_cred_usage_t

Definition at line 136 of file GssAPI.h.

typedef void FAR* gss_ctx_id_t

Definition at line 97 of file GssAPI.h.

typedef long gss_int32

Definition at line 100 of file GssAPI.h.

typedef void FAR* gss_name_t

Definition at line 95 of file GssAPI.h.

typedef struct gss_OID_desc_struct* gss_OID
typedef struct gss_OID_desc_struct gss_OID_desc
typedef struct gss_OID_set_desc_struct* gss_OID_set
typedef struct gss_OID_set_desc_struct gss_OID_set_desc
typedef OM_uint32 gss_qop_t

Definition at line 135 of file GssAPI.h.

typedef unsigned long gss_uint32

Definition at line 99 of file GssAPI.h.

typedef gss_uint32 OM_uint32

Definition at line 102 of file GssAPI.h.

Function Documentation

KRB5_DLLIMP OM_uint32 KRB5_CALLCONV gss_acquire_cred PROTOTYPE ( (OM_uint32 FAR *, gss_name_t, OM_uint32, gss_OID_set, gss_cred_usage_t, gss_cred_id_t FAR *, gss_OID_set FAR *, OM_uint32 FAR *) )
KRB5_DLLIMP OM_uint32 KRB5_CALLCONV gss_unseal PROTOTYPE ( (OM_uint32 FAR *, gss_ctx_id_t, gss_buffer_t, gss_buffer_t, int FAR *, int FAR *) )
KRB5_DLLIMP OM_uint32 KRB5_CALLCONV gss_seal PROTOTYPE ( (OM_uint32 FAR *, gss_ctx_id_t, int, int, gss_buffer_t, int FAR *, gss_buffer_t) )
KRB5_DLLIMP OM_uint32 KRB5_CALLCONV gss_verify PROTOTYPE ( (OM_uint32 FAR *, gss_ctx_id_t, gss_buffer_t, gss_buffer_t, int FAR *) )
KRB5_DLLIMP OM_uint32 KRB5_CALLCONV gss_sign PROTOTYPE ( (OM_uint32 FAR *, gss_ctx_id_t, int, gss_buffer_t, gss_buffer_t) )
KRB5_DLLIMP OM_uint32 KRB5_CALLCONV gss_oid_to_str PROTOTYPE ( (OM_uint32 FAR *, gss_OID, gss_buffer_t) )
KRB5_DLLIMP OM_uint32 KRB5_CALLCONV gss_str_to_oid PROTOTYPE ( (OM_uint32 FAR *, gss_buffer_t, gss_OID FAR *) )
KRB5_DLLIMP OM_uint32 KRB5_CALLCONV gss_test_oid_set_member PROTOTYPE ( (OM_uint32 FAR *, gss_OID, gss_OID_set, int FAR *) )
KRB5_DLLIMP OM_uint32 KRB5_CALLCONV gss_inquire_names_for_mech PROTOTYPE ( (OM_uint32 FAR *, gss_OID, gss_OID_set FAR *) )
KRB5_DLLIMP OM_uint32 KRB5_CALLCONV gss_release_oid PROTOTYPE ( (OM_uint32 FAR *, gss_OID FAR *) )
KRB5_DLLIMP OM_uint32 KRB5_CALLCONV gss_import_sec_context PROTOTYPE ( (OM_uint32 FAR *, gss_buffer_t, gss_ctx_id_t FAR *) )
KRB5_DLLIMP OM_uint32 KRB5_CALLCONV gss_inquire_cred_by_mech PROTOTYPE ( (OM_uint32FAR *, gss_cred_id_t, gss_OID, gss_name_t FAR *, OM_uint32 FAR *, OM_uint32 FAR *, gss_cred_usage_t FAR *) )
KRB5_DLLIMP OM_uint32 KRB5_CALLCONV gss_add_cred PROTOTYPE ( (OM_uint32 FAR *, gss_cred_id_t, gss_name_t, gss_OID, gss_cred_usage_t, OM_uint32, OM_uint32, gss_cred_id_t FAR *, gss_OID_set FAR *, OM_uint32 FAR *, OM_uint32 FAR *) )
KRB5_DLLIMP OM_uint32 KRB5_CALLCONV gss_export_name_object PROTOTYPE ( (OM_uint32 FAR *, gss_name_t, gss_OID, void FAR *FAR *) )
KRB5_DLLIMP OM_uint32 KRB5_CALLCONV gss_import_name_object PROTOTYPE ( (OM_uint32 FAR *, void FAR *, gss_OID, gss_name_t FAR *) )
KRB5_DLLIMP OM_uint32 KRB5_CALLCONV gss_wrap_size_limit PROTOTYPE ( (OM_uint32 FAR *, gss_ctx_id_t, int, gss_qop_t, OM_uint32, OM_uint32 *) )
KRB5_DLLIMP OM_uint32 KRB5_CALLCONV gss_inquire_context PROTOTYPE ( (OM_uint32 FAR *, gss_ctx_id_t, gss_name_t FAR *, gss_name_t FAR *, OM_uint32 FAR *, gss_OID FAR *, OM_uint32 FAR *, int FAR *, int FAR *) )
KRB5_DLLIMP OM_uint32 KRB5_CALLCONV gss_inquire_cred PROTOTYPE ( (OM_uint32 FAR *, gss_cred_id_t, gss_name_t FAR *, OM_uint32 FAR *, gss_cred_usage_t FAR *, gss_OID_set FAR *) )
KRB5_DLLIMP OM_uint32 KRB5_CALLCONV gss_release_buffer PROTOTYPE ( (OM_uint32 FAR *, gss_buffer_t) )
KRB5_DLLIMP OM_uint32 KRB5_CALLCONV gss_release_name PROTOTYPE ( (OM_uint32 FAR *, gss_name_t FAR *) )
KRB5_DLLIMP OM_uint32 KRB5_CALLCONV gss_import_name PROTOTYPE ( (OM_uint32 FAR *, gss_buffer_t, gss_OID, gss_name_t FAR *) )
KRB5_DLLIMP OM_uint32 KRB5_CALLCONV gss_display_name PROTOTYPE ( (OM_uint32 FAR *, gss_name_t, gss_buffer_t, gss_OID FAR *) )
KRB5_DLLIMP OM_uint32 KRB5_CALLCONV gss_compare_name PROTOTYPE ( (OM_uint32 FAR *, gss_name_t, gss_name_t, int FAR *) )
KRB5_DLLIMP OM_uint32 KRB5_CALLCONV gss_create_empty_oid_set PROTOTYPE ( (OM_uint32 FAR *, gss_OID_set FAR *) )
KRB5_DLLIMP OM_uint32 KRB5_CALLCONV gss_display_status PROTOTYPE ( (OM_uint32 FAR *, OM_uint32, int, gss_OID, OM_uint32 FAR *, gss_buffer_t) )
KRB5_DLLIMP OM_uint32 KRB5_CALLCONV gss_unwrap PROTOTYPE ( (OM_uint32 FAR *, gss_ctx_id_t, gss_buffer_t, gss_buffer_t, int FAR *, gss_qop_t FAR *) )
KRB5_DLLIMP OM_uint32 KRB5_CALLCONV gss_wrap PROTOTYPE ( (OM_uint32 FAR *, gss_ctx_id_t, int, gss_qop_t, gss_buffer_t, int FAR *, gss_buffer_t) )
KRB5_DLLIMP OM_uint32 KRB5_CALLCONV gss_verify_mic PROTOTYPE ( (OM_uint32 FAR *, gss_ctx_id_t, gss_buffer_t, gss_buffer_t, gss_qop_t *) )
KRB5_DLLIMP OM_uint32 KRB5_CALLCONV gss_get_mic PROTOTYPE ( (OM_uint32 FAR *, gss_ctx_id_t, gss_qop_t, gss_buffer_t, gss_buffer_t) )
KRB5_DLLIMP OM_uint32 KRB5_CALLCONV gss_context_time PROTOTYPE ( (OM_uint32 FAR *, gss_ctx_id_t, OM_uint32 FAR *) )
KRB5_DLLIMP OM_uint32 KRB5_CALLCONV gss_export_sec_context PROTOTYPE ( (OM_uint32 FAR *, gss_ctx_id_t FAR *, gss_buffer_t) )
KRB5_DLLIMP OM_uint32 KRB5_CALLCONV gss_process_context_token PROTOTYPE ( (OM_uint32 FAR *, gss_ctx_id_t, gss_buffer_t) )
KRB5_DLLIMP OM_uint32 KRB5_CALLCONV gss_accept_sec_context PROTOTYPE ( (OM_uint32 FAR *, gss_ctx_id_t FAR *, gss_cred_id_t, gss_buffer_t, gss_channel_bindings_t, gss_name_t FAR *, gss_OID FAR *, gss_buffer_t, OM_uint32 FAR *, OM_uint32 FAR *, gss_cred_id_t FAR *) )
KRB5_DLLIMP OM_uint32 KRB5_CALLCONV gss_init_sec_context PROTOTYPE ( (OM_uint32 FAR *, gss_cred_id_t, gss_ctx_id_t FAR *, gss_name_t, gss_OID, OM_uint32, OM_uint32, gss_channel_bindings_t, gss_buffer_t, gss_OID FAR *, gss_buffer_t, OM_uint32 FAR *, OM_uint32 FAR *) )
KRB5_DLLIMP OM_uint32 KRB5_CALLCONV gss_release_cred PROTOTYPE ( (OM_uint32 FAR *, gss_cred_id_t FAR *) )
Generated on Wed Nov 13 2024 16:54:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/SSPI/GSS/GssClient.c File Reference

  • Security
  • SSPI
  • GSS
Defines | Functions | Variables

GssClient.c File Reference

#include "gss-misc.h"

Go to the source code of this file.

Defines

#define | DUPE(x) { "-" #x, ISC_REQ_ ## x, "ISC_REQ_"#x }

Functions

int | call_server (char *host, u_short port, char *service_name, OM_uint32 deleg_flag, char *msg, int use_file)
int | client_establish_context (int s, char *service_name, OM_uint32 deleg_flag, CtxtHandle *gss_context, OM_uint32 *ret_flags)
int | connect_to_server (char *host, u_short port)
int _cdecl | main (int argc, char **argv)
void | read_file (char *file_name, PSecBuffer in_buf)
void | usage ()

Variables

int | SignOnly = FALSE

Define Documentation

#define DUPE ( x ) { "-" #x, ISC_REQ_ ## x, "ISC_REQ_"#x }

Function Documentation

int call_server | ( | char * | host,
 |  | u_short | port,
 |  | char * | service_name,
 |  | OM_uint32 | deleg_flag,
 |  | char * | msg,
 |  | int | use_file
 | ) |  |

Definition at line 343 of file GssClient.c.

{
   CtxtHandle context;
   SecBuffer in_buf, out_buf;
   SecBuffer wrap_bufs[3];
   SecBufferDesc in_buf_desc;
   SecPkgContext_Sizes sizes;
   int s;
   OM_uint32 ret_flags;
   OM_uint32 maj_stat;
   gss_qop_t qop_state;

   /* Open connection */
   if ((s = connect_to_server(host, port)) < 0)
      return -1;

   /* Establish context */
   if (client_establish_context(s, service_name, deleg_flag,  &context,
                                &ret_flags) < 0)
   {
      (void) closesocket(s);
      return -1;
   }

   maj_stat = QueryContextAttributes(
                                    &context,
                                    SECPKG_ATTR_SIZES,
                                    &sizes
                                    );
   if (maj_stat != SEC_E_OK)
   {
      display_status("querying context attributes", maj_stat, 0);
      return (-1);
   }

   if (use_file)
   {
      read_file(msg, &in_buf);
   }
   else
   {
      /* Seal the message */
      in_buf.pvBuffer = msg;
      in_buf.cbBuffer = (ULONG)strlen(msg) + 1;
   }

   //
   // Prepare to encrypt the message
   //

   printf("Block Size is %d, inbuffer = %d\n",
          sizes.cbBlockSize, in_buf.cbBuffer);

   in_buf_desc.cBuffers = 3;
   in_buf_desc.pBuffers = wrap_bufs;
   in_buf_desc.ulVersion = SECBUFFER_VERSION;

   wrap_bufs[0].cbBuffer = sizes.cbSecurityTrailer;
   wrap_bufs[0].BufferType = SECBUFFER_TOKEN;
   wrap_bufs[0].pvBuffer = malloc(sizes.cbSecurityTrailer);

   if (wrap_bufs[0].pvBuffer == NULL)
   {
      fprintf(stderr,"Failed to allocate space for security trailer\n");
      return (-1);
   }

   wrap_bufs[1].BufferType = SECBUFFER_DATA;
   wrap_bufs[1].cbBuffer = in_buf.cbBuffer;
   wrap_bufs[1].pvBuffer = malloc(wrap_bufs[1].cbBuffer);

   if (wrap_bufs[1].pvBuffer == NULL)
   {
      fprintf(stderr,"Couldn't allocate space for wrap message\n");
      return (-1);
   }

   memcpy(
         wrap_bufs[1].pvBuffer,
         in_buf.pvBuffer,
         in_buf.cbBuffer
         );

   wrap_bufs[2].BufferType = SECBUFFER_PADDING;
   wrap_bufs[2].cbBuffer = sizes.cbBlockSize;
   wrap_bufs[2].pvBuffer = malloc(wrap_bufs[2].cbBuffer);

   if (wrap_bufs[2].pvBuffer == NULL)
   {
      fprintf(stderr,"Couldn't allocate space for wrap message\n");
      return (-1);
   }

   maj_stat = EncryptMessage(
                            &context,
                            SignOnly ? KERB_WRAP_NO_ENCRYPT : 0,
                            &in_buf_desc,
                            0);

   if (maj_stat != SEC_E_OK)
   {
      display_status("sealing message", maj_stat, 0);
      (void) closesocket(s);
      (void) DeleteSecurityContext(&context);
      return -1;
   }

   //
   // Create the mesage to send to server
   //

   out_buf.cbBuffer = wrap_bufs[0].cbBuffer + wrap_bufs[1].cbBuffer + wrap_bufs[2].cbBuffer;
   out_buf.pvBuffer = malloc(out_buf.cbBuffer);

   if (out_buf.pvBuffer == NULL)
   {
      fprintf(stderr,"Failed to allocate space for wrapepd message\n");
      return (-1);
   }

   memcpy(
         out_buf.pvBuffer,
         wrap_bufs[0].pvBuffer,
         wrap_bufs[0].cbBuffer
         );
   memcpy(
         (PUCHAR) out_buf.pvBuffer + (int) wrap_bufs[0].cbBuffer,
         wrap_bufs[1].pvBuffer,
         wrap_bufs[1].cbBuffer
         );
   memcpy(
         (PUCHAR) out_buf.pvBuffer + wrap_bufs[0].cbBuffer + wrap_bufs[1].cbBuffer,
         wrap_bufs[2].pvBuffer,
         wrap_bufs[2].cbBuffer
         );

   /* Send to server */
   if (send_token(s, &out_buf) < 0)
   {
      (void) closesocket(s);
      (void) DeleteSecurityContext(&context);
      return -1;
   }

   free(out_buf.pvBuffer);
   out_buf.pvBuffer = NULL;
   out_buf.cbBuffer = 0;
   free(wrap_bufs[0].pvBuffer);
   wrap_bufs[0].pvBuffer = NULL;
   free(wrap_bufs[1].pvBuffer);
   wrap_bufs[1].pvBuffer = NULL;

   /* Read signature block into out_buf */
   if (recv_token(s, &out_buf) < 0)
   {
      (void) closesocket(s);
      (void) DeleteSecurityContext( &context);
      return -1;
   }

   /* Verify signature block */

   in_buf_desc.cBuffers = 2;
   wrap_bufs[0] = in_buf;
   wrap_bufs[0].BufferType = SECBUFFER_DATA;
   wrap_bufs[1] = out_buf;
   wrap_bufs[1].BufferType = SECBUFFER_TOKEN;

   maj_stat = VerifySignature(&context, &in_buf_desc, 0, &qop_state);
   if (maj_stat != SEC_E_OK)
   {
      display_status("verifying signature", maj_stat, 0);
      (void) closesocket(s);
      (void) DeleteSecurityContext( &context);
      return -1;
   }
   free(out_buf.pvBuffer);

   if (use_file)
      free(in_buf.pvBuffer);

   printf("Signature verified.\n");

   /* Delete context */
   maj_stat = DeleteSecurityContext(&context);
   if (maj_stat != SEC_E_OK)
   {
      display_status("deleting context", maj_stat, 0);
      (void) closesocket(s);
      return -1;
   }

   (void) closesocket(s);
   return 0;
}

int client_establish_context | ( | int | s,
 |  | char * | service_name,
 |  | OM_uint32 | deleg_flag,
 |  | CtxtHandle * | gss_context,
 |  | OM_uint32 * | ret_flags
 | ) |  |

Definition at line 125 of file GssClient.c.

{
   SecBuffer send_tok, recv_tok;
   SecBufferDesc input_desc, output_desc;
   OM_uint32 maj_stat;
   CredHandle cred_handle;
   TimeStamp expiry;
   PCtxtHandle context_handle = NULL;

   input_desc.cBuffers = 1;
   input_desc.pBuffers = &recv_tok;
   input_desc.ulVersion = SECBUFFER_VERSION;

   recv_tok.BufferType = SECBUFFER_TOKEN;
   recv_tok.cbBuffer = 0;
   recv_tok.pvBuffer = NULL;

   output_desc.cBuffers = 1;
   output_desc.pBuffers = &send_tok;
   output_desc.ulVersion = SECBUFFER_VERSION;

   send_tok.BufferType = SECBUFFER_TOKEN;
   send_tok.cbBuffer = 0;
   send_tok.pvBuffer = NULL;

   cred_handle.dwLower = 0;
   cred_handle.dwUpper = 0;

   maj_stat = AcquireCredentialsHandle(
                                      NULL,                       // no principal name
                                      "Kerberos",                 // package name
                                      SECPKG_CRED_OUTBOUND,
                                      NULL,                       // no logon id
                                      NULL,                       // no auth data
                                      NULL,                       // no get key fn
                                      NULL,                       // noget key arg
                                      &cred_handle,
                                      &expiry
                                      );
   if (maj_stat != SEC_E_OK)
   {
      display_status("acquiring credentials",maj_stat,0);
      return (-1);
   }

   /*
    * Perform the context-establishement loop.
    */

   gss_context->dwLower = 0;
   gss_context->dwUpper = 0;

   do
   {
      maj_stat =
      InitializeSecurityContext(
                               &cred_handle,
                               context_handle,
                               service_name,
                               deleg_flag,
                               0,          // reserved
                               SECURITY_NATIVE_DREP,
                               &input_desc,
                               0,          // reserved
                               gss_context,
                               &output_desc,
                               ret_flags,
                               &expiry
                               );

      if (recv_tok.pvBuffer)
      {
         free(recv_tok.pvBuffer);
         recv_tok.pvBuffer = NULL;
         recv_tok.cbBuffer = 0;

      }

      context_handle = gss_context;

      if (maj_stat!=SEC_E_OK && maj_stat!=SEC_I_CONTINUE_NEEDED)
      {
         display_status("initializing context", maj_stat, 0);
         FreeCredentialsHandle(&cred_handle);
         return -1;
      }

      if (send_tok.cbBuffer != 0)
      {
         printf("Sending init_sec_context token (size=%d)...",
                send_tok.cbBuffer);
         if (send_token(s, &send_tok) < 0)
         {
            FreeContextBuffer(send_tok.pvBuffer);
            FreeCredentialsHandle(&cred_handle);
            return -1;
         }
      }

      FreeContextBuffer(send_tok.pvBuffer);
      send_tok.pvBuffer = NULL;
      send_tok.cbBuffer = 0;

      if (maj_stat == SEC_I_CONTINUE_NEEDED)
      {
         printf("continue needed...");
         if (recv_token(s, &recv_tok) < 0)
         {
            FreeCredentialsHandle(&cred_handle);
            return -1;
         }
      }
      printf("\n");

   } while (maj_stat == SEC_I_CONTINUE_NEEDED);

   FreeCredentialsHandle(&cred_handle);
   return 0;
}

int connect_to_server | ( | char * | host,
 |  | u_short | port
 | ) |  |

Definition at line 53 of file GssClient.c.

{
   struct sockaddr_in saddr;
   struct hostent *hp;
   int s;
   int err;
   WSADATA socket_data;
   USHORT version_required = 0x0101;

   err = WSAStartup(version_required, &socket_data);
   if (err)
   {
      fprintf(stderr,"Failed to initailize WSA: %d\n",err);
      return (-1);
   }

   if ((hp = gethostbyname(host)) == NULL)
   {
      fprintf(stderr, "Unknown host: %s\n", host);
      return -1;
   }

   saddr.sin_family = hp->h_addrtype;
   memcpy((char *)&saddr.sin_addr, hp->h_addr, sizeof(saddr.sin_addr));
   saddr.sin_port = htons(port);

   if ((s = (int)socket(AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET)
   {
      fprintf(stderr, "creating socket - %x", GetLastError());
      return -1;
   }

   if (connect(s, (struct sockaddr *)&saddr, sizeof(saddr)) == SOCKET_ERROR)
   {
      fprintf(stderr, "connecting to server - %x", GetLastError());
      (void) closesocket(s);
      return -1;
   }
   return s;
}

int _cdecl main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 549 of file GssClient.c.

{
   char *service_name, *server_host, *msg;
   char *mechanism = 0;
   u_short port = 4444;
   int use_file = 0;
   int  i;

   OM_uint32 deleg_flag = ( ISC_REQ_MUTUAL_AUTH |
                            ISC_REQ_ALLOCATE_MEMORY |
                            ISC_REQ_CONFIDENTIALITY |
                            ISC_REQ_REPLAY_DETECT);
   FLAGMAPPING FlagMappings[] = {
#define DUPE( x ) { "-" #x, ISC_REQ_ ## x, "ISC_REQ_"#x }

      DUPE( CONFIDENTIALITY ),
      DUPE( DELEGATE ),
      DUPE( INTEGRITY ),
      DUPE( USE_SESSION_KEY ),
      DUPE( REPLAY_DETECT ),
      DUPE( SEQUENCE_DETECT ),
      DUPE( MUTUAL_AUTH )
   };

   display_file = stdout;

   /* Parse arguments. */
   argc--; argv++;
   while (argc)
   {

      if (strcmp(*argv, "-port") == 0)
      {
         argc--; argv++;
         if (!argc) usage();
         port = (u_short)atoi(*argv);
      }
      else if (strcmp(*argv, "-sign") == 0)
      {
         SignOnly = TRUE;
      }
      else if (strcmp(*argv, "-mech") == 0)
      {
         argc--; argv++;
         if (!argc) usage();
         mechanism = *argv;
      }
      else if ( _strcmpi(*argv, "-d") == 0 )
      {
         deleg_flag |= ISC_REQ_DELEGATE;

      }
      else
      {

         /*
          * Search for flags to use along the command line.
          * We do this so that we can determine what, if any,
          * flags are busted.
          */

         BOOL found = FALSE;

         for ( i = 0 ;
             i < ( sizeof( FlagMappings ) /
                   sizeof( FLAGMAPPING ) ) ;
             i ++ )
         {

            if ( _strcmpi( *argv, FlagMappings[ i ].name ) == 0 )
            {

               found = TRUE;
               deleg_flag |= FlagMappings[ i ].value ;
               printf( "adding flag %hs (0x%x).\n",
                       FlagMappings[ i ].name +1,
                       FlagMappings[ i ].value );
               break;

            }
         }

         if ( !found )
         {

            break;

         }
      }
      argc--; argv++;
   }

   if ( argc != 3 ) usage();

   for (i = 0; i < (sizeof(FlagMappings)/sizeof(FLAGMAPPING)); i++)
   {
      if (deleg_flag & FlagMappings[i].value)
         printf("Context flag: %s\n", FlagMappings[i].realname);
   }
   if (SignOnly)
      printf("No encryption - sign only\n");

   server_host = *argv++;
   service_name = *argv++;
   msg = *argv++;

   fprintf( stderr,
            "calling host %hs, name %hs, msg \"%hs\".\n",
            server_host,
            service_name,
            msg );

   if (call_server(server_host, port, service_name,
                   deleg_flag, msg, use_file) < 0)
      exit(1);

   return 0;
}

void read_file | ( | char * | file_name,
 |  | PSecBuffer | in_buf
 | ) |  |

Definition at line 252 of file GssClient.c.

{
   int fd;
   ULONG bytes_in, count;
   UCHAR buf[100];

   //
   // readthrough once to get the size.
   //

   if ((fd = _open(file_name, O_RDONLY, 0)) < 0)
   {
      perror("open");
      fprintf(stderr, "Couldn't open file %s\n", file_name);
      exit(1);
   }

   for (bytes_in = 0; ; bytes_in += count)
   {
      count = _read(fd, buf, sizeof(buf));
      if (count < 0)
      {
         fprintf(stderr, "read - %x", GetLastError());
         exit(1);
      }
      if (count == 0)
         break;
   }
   _close(fd);

   if ((fd = _open(file_name, O_RDONLY, 0)) < 0)
   {
      perror("open");
      fprintf(stderr, "Couldn't open file %s\n", file_name);
      exit(1);
   }

   in_buf->cbBuffer = bytes_in;
   in_buf->pvBuffer = malloc(in_buf->cbBuffer);

   if (in_buf->pvBuffer == 0)
   {
      fprintf(stderr, "Couldn't allocate %d byte buffer for reading file\n",
              in_buf->cbBuffer);
      exit(1);
   }

   memset(in_buf->pvBuffer, 0, in_buf->cbBuffer);

   for (bytes_in = 0; bytes_in < in_buf->cbBuffer; bytes_in += count)
   {
      count = _read(fd, (PUCHAR) in_buf->pvBuffer+bytes_in, in_buf->cbBuffer-bytes_in);
      if (count < 0)
      {
         fprintf(stderr, "read - %x", GetLastError());
         exit(1);
      }
      if (count == 0)
         break;
   }

   if (bytes_in != count)
      fprintf(stderr, "Warning, only read in %d bytes, expected %d\n",
              bytes_in, count);
}

void usage ( )

Definition at line 28 of file GssClient.c.

{
   fprintf(stderr,
    "Usage: gssclient [-port port] [-sign] [-d] host service msg\n");
   exit(1);
}

Variable Documentation

int SignOnly = FALSE

Definition at line 26 of file GssClient.c.

Generated on Wed Nov 13 2024 16:54:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/SSPI/GSS/GssMisc.c File Reference

  • Security
  • SSPI
  • GSS
Functions | Variables

GssMisc.c File Reference

#include "gss-misc.h"

Go to the source code of this file.

Functions

void | display_ctx_flags (ULONG flags)
void | display_status (char *msg, ULONG maj_stat, ULONG min_stat)
void | display_status_1 (char *m, ULONG code, int type)
void | print_token (PSecBuffer tok)
void display_status_1 | PROTOTYPE ((char *m, ULONG code, int type))
int | read_all (int fildes, char *buf, unsigned int nbyte)
int | recv_token (int s, PSecBuffer tok)
int | send_token (int s, PSecBuffer tok)
int | write_all (int fildes, char *buf, unsigned int nbyte)

Variables

FILE * | display_file

Function Documentation

void display_ctx_flags ( ULONG flags )

Definition at line 255 of file GssMisc.c.

{
   if (flags & GSS_C_DELEG_FLAG)
      fprintf(display_file, "context flag: GSS_C_DELEG_FLAG\n");
   if (flags & GSS_C_MUTUAL_FLAG)
      fprintf(display_file, "context flag: GSS_C_MUTUAL_FLAG\n");
   if (flags & GSS_C_REPLAY_FLAG)
      fprintf(display_file, "context flag: GSS_C_REPLAY_FLAG\n");
   if (flags & GSS_C_SEQUENCE_FLAG)
      fprintf(display_file, "context flag: GSS_C_SEQUENCE_FLAG\n");
   if (flags & GSS_C_CONF_FLAG )
      fprintf(display_file, "context flag: GSS_C_CONF_FLAG \n");
   if (flags & GSS_C_INTEG_FLAG )
      fprintf(display_file, "context flag: GSS_C_INTEG_FLAG \n");
}

void display_status | ( | char * | msg,
 |  | ULONG | maj_stat,
 |  | ULONG | min_stat
 | ) |  |

Definition at line 230 of file GssMisc.c.

{
   display_status_1(msg, maj_stat, GSS_C_GSS_CODE);
   display_status_1(msg, min_stat, GSS_C_MECH_CODE);
}

void display_status_1 | ( | char * | m,
 |  | ULONG | code,
 |  | int | type
 | ) |  |

Definition at line 202 of file GssMisc.c.

{

   if (display_file)
      fprintf(display_file, "GSS-API error %s: %x\n", m,
              code);
}

void print_token ( PSecBuffer tok )

Definition at line 272 of file GssMisc.c.

{
   ULONG i;
   unsigned char *p = (PUCHAR) tok->pvBuffer;

   if (!display_file)
      return;
   for (i=0; i < tok->cbBuffer; i++, p++)
   {
      fprintf(display_file, "%02x ", *p);
      if ((i % 16) == 15)
      {
         fprintf(display_file, "\n");
      }
   }
   fprintf(display_file, "\n");
   fflush(display_file);
}

void display_status_1 PROTOTYPE ( (char *m, ULONG code, int type) )
int read_all | ( | int | fildes,
 |  | char * | buf,
 |  | unsigned int | nbyte
 | ) |  |

Definition at line 51 of file GssMisc.c.

{
   int ret;
   char *ptr;

   for (ptr = buf; nbyte; ptr += ret, nbyte -= ret)
   {
      ret = recv(fildes, ptr, nbyte,0);
      if (ret < 0)
      {
         return (ret);
      }
      else if (ret == 0)
      {
         return (int)(ptr-buf);
      }
   }

   return (int)(ptr-buf);
}

int recv_token | ( | int | s,
 |  | PSecBuffer | tok
 | ) |  |

Definition at line 153 of file GssMisc.c.

{
   ULONG ret;

   ret = read_all(s, (char *) &tok->cbBuffer, 4);
   if (ret < 0)
   {
      perror("reading token length");
      return -1;
   }
   else if (ret != 4)
   {
      if (display_file)
         fprintf(display_file,
                 "reading token length: %d of %d bytes read\n",
                 ret, 4);
      return -1;
   }

   tok->cbBuffer = ntohl(tok->cbBuffer);
   tok->pvBuffer = (char *) malloc(tok->cbBuffer);
   if (tok->pvBuffer == NULL)
   {
      if (display_file)
         fprintf(display_file,
                 "Out of memory allocating token data\n");
      return -1;
   }

   ret = read_all(s, (char *) tok->pvBuffer, tok->cbBuffer);
   if (ret < 0)
   {
      perror("reading token data");
      free(tok->pvBuffer);
      return -1;
   }
   else if (ret != tok->cbBuffer)
   {
      fprintf(stderr, "sending token data: %d of %d bytes written\n",
              ret, tok->cbBuffer);
      free(tok->pvBuffer);
      return -1;
   }

   return 0;
}

int send_token | ( | int | s,
 |  | PSecBuffer | tok
 | ) |  |

Definition at line 90 of file GssMisc.c.

{
   ULONG len;
   ULONG ret;

   len = htonl(tok->cbBuffer);

   ret = write_all(s, (char *) &len, 4);
   if (ret < 0)
   {
      perror("sending token length");
      return -1;
   }
   else if (ret != 4)
   {
      if (display_file)
         fprintf(display_file,
                 "sending token length: %d of %d bytes written\n",
                 ret, 4);
      return -1;
   }

   ret = write_all(s, tok->pvBuffer, tok->cbBuffer);
   if (ret < 0)
   {
      perror("sending token data");
      return -1;
   }
   else if (ret != tok->cbBuffer)
   {
      if (display_file)
         fprintf(display_file,
                 "sending token data: %d of %d bytes written\n",
                 ret, tok->cbBuffer);
      return -1;
   }

   return 0;
}

int write_all | ( | int | fildes,
 |  | char * | buf,
 |  | unsigned int | nbyte
 | ) |  |

Definition at line 30 of file GssMisc.c.

{
   int ret;
   char *ptr;

   for (ptr = buf; nbyte; ptr += ret, nbyte -= ret)
   {
      ret = send(fildes, ptr, nbyte,0);
      if (ret < 0)
      {
         return (ret);
      }
      else if (ret == 0)
      {
         return (int)(ptr-buf);
      }
   }

   return (int)(ptr-buf);
}

Variable Documentation

FILE* display_file

Definition at line 25 of file GssMisc.c.

Generated on Wed Nov 13 2024 16:54:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/SSPI/GSS/GssServer.c File Reference

  • Security
  • SSPI
  • GSS
Defines | Functions | Variables

GssServer.c File Reference

#include "gss-misc.h"

Go to the source code of this file.

Defines

#define | DUPE(x) { "-" #x, ASC_REQ_ ## x }

Functions

int | create_socket (u_short port)
int _cdecl | main (int argc, char **argv)
int | server_acquire_creds (char *service_name, char *service_password, char *service_realm, CredHandle *server_creds)
int | server_establish_context (int s, CredHandle *server_creds, CtxtHandle *context, OM_uint32 *ret_flags)
int | sign_server (int s, CredHandle *server_creds)
void | usage ()

Variables

OM_uint32 | global_asc_flags = ASC_REQ_ALLOCATE_MEMORY | ASC_REQ_MUTUAL_AUTH
FILE * | logfile
int | verbose = 0

Define Documentation

#define DUPE ( x ) { "-" #x, ASC_REQ_ ## x }

Function Documentation

int create_socket ( u_short port )

Definition at line 245 of file GssServer.c.

{
   struct sockaddr_in saddr;
   int s;
   int on = 1;

   saddr.sin_family = AF_INET;
   saddr.sin_port = htons(port);
   saddr.sin_addr.s_addr = INADDR_ANY;

   if ((s = (int)socket(AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET)
   {
      fprintf(stderr, "creating socket - %x", GetLastError());
      return -1;
   }

   /* Let the socket be reused right away */
   (void) setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on));

   if (bind(s, (struct sockaddr *) &saddr, sizeof(saddr)) == SOCKET_ERROR)
   {
      fprintf(stderr, "binding socket - %x", GetLastError());
      (void) closesocket(s);
      return -1;
   }

   if (listen(s, 5) == SOCKET_ERROR)
   {
      fprintf(stderr, "listening on socket", GetLastError());
      (void) closesocket(s);
      return -1;
   }
   return s;
}

int _cdecl main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 442 of file GssServer.c.

{
   int stmp,err;
   WSADATA socket_data;
   USHORT version_required = 0x0101;
   char *service_name;
   char *service_password;
   char *service_realm;
   CredHandle server_creds;
   u_short port = 4444;
   int s;
   int once = 0;

   FLAGMAPPING FlagMappings[] = {
#define DUPE( x ) { "-" #x, ASC_REQ_ ## x }

      DUPE( CONFIDENTIALITY ),
      DUPE( DELEGATE ),
      DUPE( INTEGRITY ),
      DUPE( USE_SESSION_KEY ),
      DUPE( REPLAY_DETECT ),
      DUPE( SEQUENCE_DETECT )
   };

   logfile = stdout;
   display_file = stdout;
   argc--; argv++;

   while (argc)
   {
      if (strcmp(*argv, "-port") == 0)
      {
         argc--; argv++;
         if (!argc) usage();
         port = (u_short)atoi(*argv);
      }
      else if (strcmp(*argv, "-verbose") == 0)
      {
         verbose = 1;
      }
      else if (strcmp(*argv, "-once") == 0)
      {
         once = 1;
      }
      else if (strcmp(*argv, "-logfile") == 0)
      {
         argc--; argv++;
         if (!argc) usage();
         logfile = fopen(*argv, "a");
         display_file = logfile;
         if (!logfile)
         {
            perror(*argv);
            exit(1);
         }
      }
      else
      {

         int i;
         BOOL found = FALSE;

         for ( i = 0 ;
             i < ( sizeof( FlagMappings ) /
                   sizeof( FLAGMAPPING ) ) ;
             i ++ )
         {

            if ( _strcmpi( *argv, FlagMappings[ i ].name ) == 0 )
            {

               found = TRUE;
               global_asc_flags |= FlagMappings[ i ].value ;
               break;

            }
         }

         if ( !found )
         {
            break;
         }
      }

      argc--; argv++;
   }
   if (argc != 3)
      usage();

   if ((*argv)[0] == '-')
      usage();

   service_name = *argv;
   argv++;
   service_password = *argv;
   argv++;
   service_realm = *argv;

   if (server_acquire_creds(service_name, service_password, service_realm, &server_creds) < 0)
      return -1;

   err = WSAStartup(version_required, &socket_data);
   if (err)
   {
      fprintf(stderr,"Failed to initailize WSA: %d\n",err);

   }
   else if ((stmp = create_socket(port)))
   {
      do
      {
         /* Accept a TCP connection */
         if ((s = (int)accept(stmp, NULL, 0)) == SOCKET_ERROR)
         {
            fprintf(stderr,"accepting connection: %d\n", GetLastError());
         }
         else
         {
            /* this return value is not checked, because there's
               not really anything to do if it fails */
            sign_server(s, &server_creds);
         }
      } while (!once);

      closesocket(stmp);
   }

   (void) FreeCredentialsHandle( &server_creds);

   /*NOTREACHED*/
   (void) closesocket(s);
   return 0;
}

int server_acquire_creds | ( | char * | service_name,
 |  | char * | service_password,
 |  | char * | service_realm,
 |  | CredHandle * | server_creds
 | ) |  |

Definition at line 57 of file GssServer.c.

{
   OM_uint32 maj_stat;
   TimeStamp expiry;
   wchar_t wide_password[100];
   wchar_t wide_realm[100];
   SEC_WINNT_AUTH_IDENTITY_W auth_identity;
   memset(&auth_identity,0,sizeof(auth_identity));

   mbstowcs(wide_password, service_password, sizeof(wide_password) / sizeof(wchar_t));
   auth_identity.Password = wide_password;
   auth_identity.PasswordLength = (ULONG)wcslen(wide_password);

   mbstowcs(wide_realm, service_realm, sizeof(wide_realm) / sizeof(wchar_t));
   auth_identity.Domain = wide_realm;
   auth_identity.DomainLength = (ULONG)wcslen(wide_realm);
   auth_identity.Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE;

   maj_stat = AcquireCredentialsHandle(
                                      service_name,
                                      "Kerberos",
                                      SECPKG_CRED_INBOUND,
                                      NULL,                       // no logon id
                                      &auth_identity,             // no auth data
                                      NULL,                       // no get key fn
                                      NULL,                       // no get key arg
                                      server_creds,
                                      &expiry
                                      );
   if (maj_stat != SEC_E_OK)
   {
      display_status("acquiring credentials", maj_stat, 0);
      return -1;
   }

   return 0;
}

int server_establish_context | ( | int | s,
 |  | CredHandle * | server_creds,
 |  | CtxtHandle * | context,
 |  | OM_uint32 * | ret_flags
 | ) |  |

Definition at line 126 of file GssServer.c.

{
   SecBufferDesc input_desc;
   SecBufferDesc output_desc;
   SecBuffer send_tok, recv_tok;
   OM_uint32 maj_stat;
   TimeStamp expiry;
   PCtxtHandle context_handle = NULL;

   context->dwUpper = 0;
   context->dwLower = 0;

   input_desc.cBuffers = 1;
   input_desc.ulVersion = SECBUFFER_VERSION;
   input_desc.pBuffers = &recv_tok;

   output_desc.cBuffers = 1;
   output_desc.ulVersion = SECBUFFER_VERSION;
   output_desc.pBuffers = &send_tok;

   do
   {
      if (recv_token(s, &recv_tok) < 0)
         return -1;

      if (verbose && logfile)
      {
         fprintf(logfile, "Received token (size=%d): \n", recv_tok.cbBuffer);
         print_token(&recv_tok);
      }

      recv_tok.BufferType = SECBUFFER_TOKEN;
      send_tok.cbBuffer = 0;
      send_tok.pvBuffer = NULL;
      send_tok.BufferType = SECBUFFER_TOKEN;
      maj_stat = AcceptSecurityContext(
                                      server_creds,
                                      context_handle,
                                      &input_desc,
                                      global_asc_flags,
                                      SECURITY_NATIVE_DREP,
                                      context,
                                      &output_desc,
                                      ret_flags,
                                      &expiry
                                      );

      if (maj_stat!=SEC_E_OK && maj_stat!=SEC_I_CONTINUE_NEEDED)
      {
         display_status("accepting context", maj_stat, 0);
         (void) free(recv_tok.pvBuffer);
         return -1;
      }

      context_handle = context;
      free(recv_tok.pvBuffer);

      if (send_tok.cbBuffer != 0)
      {
         if (verbose && logfile)
         {
            fprintf(logfile,
                    "Sending accept_sec_context token (size=%d):\n",
                    send_tok.cbBuffer);
            print_token(&send_tok);
         }
         if (send_token(s, &send_tok) < 0)
         {
            fprintf(logfile, "failure sending token\n");
            return -1;
         }

         FreeContextBuffer(send_tok.pvBuffer);
         send_tok.pvBuffer = NULL;
      }

      if (verbose && logfile)
      {
         if (maj_stat == SEC_I_CONTINUE_NEEDED)
            fprintf(logfile, "continue needed...\n");
         else
            fprintf(logfile, "\n");
         fflush(logfile);
      }

   } while (maj_stat == SEC_I_CONTINUE_NEEDED);

   /* display the flags */
   display_ctx_flags(*ret_flags);

   if (verbose && logfile)
   {
      fprintf(logfile, "Accepted connection using mechanism Kerberos\n");
   }

   return 0;
}

int sign_server | ( | int | s,
 |  | CredHandle * | server_creds
 | ) |  |

Definition at line 306 of file GssServer.c.

{
   SecBuffer xmit_buf, msg_buf;
   SecBuffer wrap_bufs[2];
   SecBufferDesc wrap_buf_desc;
   CtxtHandle context;
   OM_uint32 maj_stat;
   int ret_flags;
   char *cp;
   SecPkgContext_Names names;
   SecPkgContext_Sizes sizes;
   ULONG qop;

   /* Establish a context with the client */
   if (server_establish_context(s, server_creds, &context,
                                &ret_flags) < 0)
      return (-1);

   maj_stat = QueryContextAttributes(&context, SECPKG_ATTR_NAMES, &names);
   if (maj_stat != SEC_E_OK)
   {
      display_status("Query context attributes",maj_stat, 0 );
      return ( -1 );
   }
   printf("Accepted connection: \"%s\"\n",
          names.sUserName);
   (void) FreeContextBuffer(names.sUserName);

   maj_stat = QueryContextAttributes(&context, SECPKG_ATTR_SIZES, &sizes);
   if (maj_stat != SEC_E_OK)
   {
      display_status("Query context attributes",maj_stat, 0 );
      return ( -1 );
   }

   /* Receive the sealed message token */
   if (recv_token(s, &xmit_buf) < 0)
      return (-1);

   if (verbose && logfile)
   {
      fprintf(logfile, "Sealed message token:\n");
      print_token(&xmit_buf);
   }

   wrap_buf_desc.cBuffers = 2;
   wrap_buf_desc.pBuffers = wrap_bufs;
   wrap_buf_desc.ulVersion = SECBUFFER_VERSION;
   wrap_bufs[0].BufferType = SECBUFFER_STREAM;
   wrap_bufs[0].pvBuffer = xmit_buf.pvBuffer;
   wrap_bufs[0].cbBuffer = xmit_buf.cbBuffer;
   wrap_bufs[1].BufferType = SECBUFFER_DATA;
   wrap_bufs[1].cbBuffer = 0;
   wrap_bufs[1].pvBuffer = NULL;

   maj_stat = DecryptMessage(
                            &context,
                            &wrap_buf_desc,
                            0,                  // no sequence number
                            &qop
                            );
   if (maj_stat != SEC_E_OK)
   {
      display_status("unsealing message", maj_stat, 0);
      return (-1);
   }

   msg_buf = wrap_bufs[1];
   fprintf(logfile, "Received message %s: ", (qop == KERB_WRAP_NO_ENCRYPT ? "signed only" : ""));
   cp = (char *) msg_buf.pvBuffer;
   if (isprint(cp[0]) && isprint(cp[1]))
      fprintf(logfile, "\"%s\"\n", cp);
   else
   {
      printf("\n");
      print_token(&msg_buf);
   }

   /* Produce a signature block for the message */

   wrap_bufs[0] = msg_buf;

   wrap_bufs[1].BufferType = SECBUFFER_TOKEN;
   wrap_bufs[1].cbBuffer = sizes.cbMaxSignature;
   wrap_bufs[1].pvBuffer = malloc(sizes.cbMaxSignature);

   if (wrap_bufs[1].pvBuffer == NULL)
   {
      fprintf(stderr, "Failed to allocate memory for signature\n");
      return (-1);
   }

   maj_stat = MakeSignature(
                           &context,
                           0,
                           &wrap_buf_desc,
                           0
                           );
   if (maj_stat != SEC_E_OK)
   {
      display_status("signing message", maj_stat, 0);
      return (-1);
   }

   free(xmit_buf.pvBuffer);
   xmit_buf.pvBuffer = NULL;
   xmit_buf.cbBuffer = 0;

   xmit_buf = wrap_bufs[1];

   /* Send the signature block to the client */

   if (send_token(s, &xmit_buf) < 0)
      return (-1);

   free(wrap_bufs[1].pvBuffer);
   wrap_bufs[1].pvBuffer = NULL;

   /* Delete context */

   maj_stat = DeleteSecurityContext( &context );
   if (maj_stat != SEC_E_OK)
   {
      display_status("deleting context", maj_stat, 0);
      return (-1);
   }

   fflush(logfile);

   return (0);
}

void usage ( )

Definition at line 27 of file GssServer.c.

{
   fprintf(stderr, "Usage: gssserver [-port port] [-verbose]\n");
   fprintf(stderr, "       [-logfile file] [service_name] [service_password] [service_realm]\n");
   exit(1);
}

Variable Documentation

OM_uint32 global_asc_flags = ASC_REQ_ALLOCATE_MEMORY | ASC_REQ_MUTUAL_AUTH

Definition at line 101 of file GssServer.c.

FILE* logfile

Definition at line 34 of file GssServer.c.

int verbose = 0

Definition at line 36 of file GssServer.c.

Generated on Wed Nov 13 2024 16:54:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/SSPI/HttpAuth/Const.H File Reference

  • Security
  • SSPI
  • HttpAuth
Defines

Const.H File Reference

Go to the source code of this file.

Defines

#define VERBOSE 1

Define Documentation

#define VERBOSE 1

Definition at line 22 of file Const.H.

Generated on Wed Nov 13 2024 16:54:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/SSPI/HttpAuth/Get_Sock.c File Reference

  • Security
  • SSPI
  • HttpAuth
Defines | Functions | Variables

Get_Sock.c File Reference

#include <windows.h>
#include <winsock.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <tchar.h>
#include <io.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "httpauth.h"

Go to the source code of this file.

Defines

#define | HD_AUTHENTICATE "WWW-Authenticate:"
#define | HD_CONNECTION "Connection:"
#define | HD_LENGTH "Content-Length:"

Functions

BOOL | HttpGetSocket (char *Verb, char *Server, char *URL, BOOL DisplayHeaders, DWORD ClientDataSize, PSTR pchUserName, PSTR pchPassword, PSTR pszStore, PSTR pszPref)
void | SkipNonWhite (PSTR *ppS)
void | SkipWhite (PSTR *ppS)

Variables

char | achAuth [256]

Define Documentation

#define HD_AUTHENTICATE "WWW-Authenticate:"

Definition at line 37 of file Get_Sock.c.

#define HD_CONNECTION "Connection:"

Definition at line 39 of file Get_Sock.c.

#define HD_LENGTH "Content-Length:"

Definition at line 38 of file Get_Sock.c.

Function Documentation

BOOL HttpGetSocket | ( | char * | Verb,
 |  | char * | Server,
 |  | char * | URL,
 |  | BOOL | DisplayHeaders,
 |  | DWORD | ClientDataSize,
 |  | PSTR | pchUserName,
 |  | PSTR | pchPassword,
 |  | PSTR | pszStore,
 |  | PSTR | pszPref
 | ) |  |

Definition at line 72 of file Get_Sock.c.

                    :

    Issue a command to a HTTP server using authentication

 Arguments:

    Verb                HTTP command : GET / HEAD / ...
    Server              server name
    URL                 URL to send to the server
    DisplayHeaders      TRUE to display headers as received
    ClientDataSize      number of bytes to send in the request
    pchUserName         user name for authentication
    pchPassword         password for authentication
    pszStore            file name where to dump reply from server

 Return Value:

    Returns TRUE is successful; otherwise FALSE is returned.

--*/
{
    char               ReceiveBuffer[8*1024];
    int                Error;
    BYTE               Request[1024];
    int                RequestSize;
    char *             AcceptTypes[2] = {"*/*", NULL};
    SOCKET             Socket = INVALID_SOCKET;
    WSADATA            WsaData;
    struct sockaddr_in Address;
    struct hostent *   HostEntry;
    char               Headers[] =
                           "HTTP/1.0\r\n"
                           "User-Agent: AuthClient\r\n"
                           "Accept: */*\r\n";
    char               CrLf[] = "\r\n";
    BYTE               ClientData[64*1024];
    BOOL               fKeepAlive = FALSE;
    int                cRec;
    DWORD              cLen;
    BOOL               fInHeader;
    PSTR               pchAuthData;
    BOOL               fServerKeepAlive = FALSE;
    BOOL               fNeedMoreData;
    BOOL               fNeedAuthenticate;
    PSTR               pH;
    PSTR               pN;
    BOOL               fStatusLine;
    int                Status = -1;
    DWORD              cToRead;
    PSTR               paAuth = achAuth;
    BOOL               fSt = FALSE;
    int                hnd = EOF;

    Error = WSAStartup (0x101, &WsaData);

    if (Error == SOCKET_ERROR)
    {
        fprintf(stderr, "Error in WSAStartup = %d\n", GetLastError());
        return FALSE;
    }

    if ( !InitAuthorizationHeader() )
    {
        fprintf(stderr, "Cannot initialize security module\n" );
        return FALSE;
    }

    memset( achAuth, '\0', sizeof(achAuth) );
    pchAuthData = NULL;
    fNeedAuthenticate = FALSE;

    //
    // Connect to the server
    //

    if  ( pszStore != NULL )
        if ( (hnd = _open( pszStore, _O_BINARY | _O_CREAT | _O_TRUNC | _O_RDWR, S_IREAD|S_IWRITE )) == EOF )
        {
            fprintf( stderr, "Can't create file %s\n", pszStore );
            return FALSE;
        }

again:

    if ( Socket == INVALID_SOCKET )
    {
        Socket = socket(AF_INET, SOCK_STREAM, 0);

        if (Socket == INVALID_SOCKET)
        {
            fprintf(stderr, "Error creating socket = %d\n", GetLastError());
            fSt = FALSE;
            goto ex;
        }

        Address.sin_family = AF_INET;
        Address.sin_port = 0;
        Address.sin_addr.s_addr = INADDR_ANY;

        Error =
        bind(
            Socket,
            (struct sockaddr *) &Address,
            sizeof(Address));

        if (Error)
        {
            fprintf(stderr, "Error in bind = %d\n", GetLastError());
            fSt = FALSE;
            goto ex;
        }

        Address.sin_family = AF_INET;
        Address.sin_port = htons(80);
        Address.sin_addr.s_addr = inet_addr(Server);

        if (Address.sin_addr.s_addr == -1)
        {
            //
            // Must be a server name
            //
            HostEntry = gethostbyname(Server);
            if (HostEntry == NULL)
            {
                printf("unable to resolve %s\n", Server);
                fSt = FALSE;
                goto ex;
            } else
            {
                Address.sin_addr.s_addr = *((unsigned long *) HostEntry->h_addr);
            }
        }

        Error =
        connect(
            Socket,
            (struct sockaddr *) &Address,
            sizeof(Address));

        if (Error)
        {
            fprintf(stderr, "Error connecting to %s = %d\n", Server, GetLastError());
            fSt = FALSE;
            goto ex;
        }
    }

    //
    // Send the client request
    //

    strcpy(Request, Verb);
    strcat(Request, " ");
    strcat(Request, URL);
    strcat(Request, " ");
    strcat(Request, Headers);
    if (ClientDataSize)
    {
        sprintf(ClientData, "Content-Length: %d\r\n", ClientDataSize);
        strcat(Request, ClientData);
    }
    if ( fKeepAlive )
    {
        strcat(Request, "Connection: Keep-Alive\r\n" );
    }

    if ( !AddAuthorizationHeader( Request + strlen(Request), achAuth, pchAuthData, pchUserName, pchPassword, &fNeedMoreData ) )
    {
        printf( "Authentication failed\n" );
        fSt = FALSE;
        goto ex;
    }

    strcat(Request, CrLf);

    RequestSize = (int)strlen(Request);

    Error =
    send(
        Socket,
        Request,
        RequestSize,
        0);

    if (Error != RequestSize)
    {
        printf("Error in client send = %d, %d\n", Error, GetLastError());
        fSt = FALSE;
        goto ex;
    }

    if (ClientDataSize)
    {
        memset( ClientData, ' ', ClientDataSize );

        //
        // Send the client data
        //

        Error =
        send(
            Socket,
            ClientData,
            ClientDataSize,
            0);

        if ( (DWORD)Error != ClientDataSize)
        {
            printf("Error in client send = %d, %d\n", Error, GetLastError());
            fSt = FALSE;
            goto ex;
        }
    }

    // parse status & header

    cLen = (DWORD)-1;
    fInHeader = TRUE;
    fServerKeepAlive = FALSE;
    fNeedAuthenticate = FALSE;

    for ( pH = ReceiveBuffer, fStatusLine = TRUE ; fInHeader ; )
    {
        cRec = recv( Socket, pH, (int)(ReceiveBuffer+sizeof(ReceiveBuffer)-pH), 0 );
        if ( cRec <= 0 )
        {
            closesocket( Socket );
            Socket = INVALID_SOCKET;
            break;
        }
        pH[ cRec ] = '\0';

        // Iterate on header fields

        while ( pN = strstr(pH, "\r\n" ) )
        {
            *pN = '\0';

            if ( DisplayHeaders )
            {
                printf( "%s\n", pH );
            }

            if ( fStatusLine )
            {
                // This is the status line, decode status

                SkipNonWhite( &pH );
                SkipWhite( &pH );
                Status = atoi( pH );
                if ( Status == 401 )
                {
                    fNeedAuthenticate = TRUE;
                }
                fStatusLine = FALSE;
            }
            else if ( pN == pH )    // end of header fields
            {
                if ( hnd != EOF )
                    write( hnd, pH+2, (int)(ReceiveBuffer+cRec-pH-2) );

                cLen -= (int)(ReceiveBuffer+cRec-pH-2 );
                fInHeader = FALSE;
                break;
            }
            else if ( !strnicmp( pH, HD_AUTHENTICATE, sizeof(HD_AUTHENTICATE)-1 ) )
            {
                SkipNonWhite( &pH );
                SkipWhite( &pH );

                // check if we are already in the authentication sequence

                if ( !IsInAuthorizationSequence() )
                {
                    // append to list of supported authentication methods

                    strcpy( paAuth, pH );
                    paAuth += strlen( pH ) + 1;
                }
                else
                {
                    // store pointer to authenticate blob

                    SkipNonWhite( &pH );
                    SkipWhite( &pH );
                    pchAuthData = pH;
                }
            }
            else if ( !strnicmp( pH, HD_LENGTH, sizeof(HD_LENGTH)-1 ) )
            {
                // get content length

                SkipNonWhite( &pH );
                SkipWhite( &pH );
                cLen = atoi( pH );
            }
            else if ( !strnicmp( pH, HD_CONNECTION, sizeof(HD_CONNECTION)-1 ) )
            {
                // check for keep-alive flag

                SkipNonWhite( &pH );
                SkipWhite( &pH );
                if ( !strnicmp( pH, "Keep-Alive", sizeof("Keep-Alive")-1 ) )
                    fServerKeepAlive = TRUE;
            }

            pH = pN + 2;
        }
    }

    // add final delimiter to list of supported authentication methods

    if ( !IsInAuthorizationSequence() && fNeedAuthenticate )
    {
        *paAuth = '\0';

        // Insure specified methods are supported localy

        if ( !ValidateAuthenticationMethods( achAuth, pszPref ) )
        {
            // None of the server specified authentication methods
            // are supported localy.

            SetLastError( ERROR_ACCESS_DENIED );

            fprintf( stderr, "No supported authentication method\n" );

            fSt = FALSE;
            goto ex;
        }
    }

    // read message body

    if ( Socket != INVALID_SOCKET )
    {
        for ( ; cLen ; )
        {
            if ( (cToRead = sizeof(ReceiveBuffer)) > cLen )
                cToRead = cLen;
            cRec = recv( Socket, ReceiveBuffer, cToRead, 0 );

            if ( cRec <= 0 )
            {
                closesocket( Socket );
                Socket = INVALID_SOCKET;
                break;
            }
            if ( hnd != EOF )
                write( hnd, ReceiveBuffer, cRec );

            cLen -= cRec;
        }
    }

    if ( !fServerKeepAlive )
    {
        if ( IsInAuthorizationSequence() )
        {
            fprintf( stderr, "Authentication rejected by server\n" );

            fNeedAuthenticate = FALSE;  // authentication failed
        }

        closesocket( Socket );
        Socket = INVALID_SOCKET;
    }

    if ( fNeedAuthenticate )
    {
        fKeepAlive = TRUE;
        goto again;
    }

    if ( Socket != INVALID_SOCKET )
        closesocket(Socket);

    fSt = Status == 200;

ex:
    TerminateAuthorizationHeader();

    if ( hnd != EOF )
        close( hnd );

    return fSt;
}

void SkipNonWhite ( PSTR * ppS )

Definition at line 59 of file Get_Sock.c.

{
    PSTR pS = *ppS;

    while ( *pS && !isspace(*pS) )
        ++pS;

    *ppS = pS;
}

void SkipWhite ( PSTR * ppS )

Definition at line 48 of file Get_Sock.c.

{
    PSTR pS = *ppS;

    while ( *pS && isspace(*pS) )
        ++pS;

    *ppS = pS;
}

Variable Documentation

char achAuth[256]

Definition at line 43 of file Get_Sock.c.

Generated on Wed Nov 13 2024 16:54:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/SSPI/HttpAuth/HttpAuth.c File Reference

  • Security
  • SSPI
  • HttpAuth
Classes | Defines | Typedefs | Functions | Variables

HttpAuth.c File Reference

#include <windows.h>
#include <rpc.h>
#include <winsock.h>
#include <lm.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <tchar.h>
#include <fcntl.h>
#include "sspi.h"
#include "httpauth.h"

Go to the source code of this file.

Classes

struct | _AUTH_SEQ
struct | _BUFFER
struct | _SEC_FUNC

Defines

#define | SEC_SUCCESS(Status) ((Status) >= 0)
#define | SECURITY_WIN32
#define | STATUS_SUCCESS 0
#define | TOKEN_SOURCE_NAME "InetSvcs"

Typedefs

typedef struct _AUTH_SEQ | AUTH_SEQ
typedef struct _BUFFER | BUFFER
typedef struct _SEC_FUNC | SEC_FUNC

Functions

BOOL | AddAuthorizationHeader (PSTR pch, PSTR pchSchemes, PSTR pchAuthData, PSTR pchUserName, PSTR pchPassword, BOOL *pfNeedMoreData)
BOOL | AuthConverse (AUTH_SEQ *pAS, VOID *pBuffIn, DWORD cbBuffIn, BUFFER *pbuffOut, DWORD *pcbBuffOut, BOOL *pfNeedMoreData, CHAR *pszPackage, CHAR *pszUser, CHAR *pszPassword)
BOOL | AuthInit (AUTH_SEQ *pAS)
void | AuthTerminate (AUTH_SEQ *pAS)
BOOL | BufferInit (BUFFER *pB)
PBYTE | BufferQueryPtr (BUFFER *pB)
BOOL | BufferResize (BUFFER *pB, DWORD cNewL)
void | BufferTerminate (BUFFER *pB)
BOOL | CrackUserAndDomain (CHAR *pszDomainAndUser, CHAR **ppszUser, CHAR **ppszDomain)
BOOL InitAuthorizationHeader ()
BOOL IsInAuthorizationSequence ()
void | TerminateAuthorizationHeader ()
BOOL | uudecode (char *bufcoded, BUFFER *pbuffdecoded, DWORD *pcbDecoded)
BOOL | uuencode (BYTE *bufin, DWORD nbytes, BUFFER *pbuffEncoded)
BOOL | ValidateAuthenticationMethods (PSTR pszMet, PSTR pszPreferedMet)

Variables

const int | pr2six [256]
char | six2pr [64]

Define Documentation

#define SEC_SUCCESS ( Status ) ((Status) >= 0)

Definition at line 43 of file HttpAuth.c.

#define SECURITY_WIN32

Definition at line 36 of file HttpAuth.c.

#define STATUS_SUCCESS 0

Definition at line 44 of file HttpAuth.c.

#define TOKEN_SOURCE_NAME "InetSvcs"

Definition at line 49 of file HttpAuth.c.

Typedef Documentation

typedef struct _AUTH_SEQ AUTH_SEQ
typedef struct _BUFFER BUFFER
typedef struct _SEC_FUNC SEC_FUNC

Function Documentation

BOOL AddAuthorizationHeader | ( | PSTR | pch,
 |  | PSTR | pchSchemes,
 |  | PSTR | pchAuthData,
 |  | PSTR | pchUserName,
 |  | PSTR | pchPassword,
 |  | BOOL * | pfNeedMoreData
 | ) |  |

Definition at line 454 of file HttpAuth.c.

                    :

    Generates an authentication header to be sent to the server.
    An authentication sequence will be initiated if none is in
    use and at least one of the authentication scheme specified
    in pchSchemes is recognized.
    Otherwise the current authentication sequence will proceed.

 Arguments:

    pch                 where to append authentication header
    pchSchemes          list of null-delimited authentication methods
    pchAuthData         incoming blob from server
    pchUserName         user name ( possibly prefixed with domain )
    pchPassword         password
    pfNeedMoreData      Out: TRUE if authentication sequence to continue

 Return Value:

    Returns TRUE is successful; otherwise FALSE is returned.

--*/
{
    CHAR   achUserAndPass[256];
    BUFFER buff;
    BOOL fSt = TRUE;
    DWORD cbOut;

    BufferInit( &buff );

    while ( *pchSchemes )
    {
        if ( !stricmp( pchSchemes, "Basic" ))
        {
            // if already in authentication sequence, it failed.

            if ( g_fBasic )
            {
                SetLastError( ERROR_ACCESS_DENIED );
                fSt = FALSE;
                break;
            }

            strcpy( achUserAndPass, pchUserName );
            strcat( achUserAndPass, ":" );
            strcat( achUserAndPass, pchPassword );

            uuencode( (BYTE *) achUserAndPass,
                      (DWORD)strlen( achUserAndPass ),
                      &buff );
            strcat( pch, "Authorization: " );
            strcat( pch, "Basic " );
            strcat( pch, BufferQueryPtr( &buff ));
            strcat( pch, "\r\n");
            g_fBasic = TRUE;
            break;
        }
        else
        {
            // SSPI package ( assuming methods list have been validated )

            if ( !g_fAuth )
            {
                if ( !AuthInit( &g_Auth ) )
                {
                    fSt = FALSE;
                    goto ex;
                }
            }
            else if ( pchAuthData == NULL || *pchAuthData == '\0' )
            {
                // no blob while in authentication sequence : it failed

                SetLastError( ERROR_ACCESS_DENIED );
                fSt = FALSE;
                break;
            }

            if ( !AuthConverse( &g_Auth,
                  (void *) pchAuthData,
                  0,
                  &buff,
                  &cbOut,
                  pfNeedMoreData,
                  pchSchemes,
                  pchUserName,
                  pchPassword ))
            {
                fSt = FALSE;
                goto ex;
            }

            strcat( pch, "Authorization: " );
            strcat( pch, pchSchemes );
            strcat( pch, " " );
            strcat( pch, (CHAR *) BufferQueryPtr( &buff ) );
            strcat( pch, "\r\n" );
            break;
        }

        pchSchemes += strlen(pchSchemes) + 1;
    }
ex:
    BufferTerminate( &buff );

    return fSt;
}

BOOL AuthConverse | ( | AUTH_SEQ * | pAS,
 |  | VOID * | pBuffIn,
 |  | DWORD | cbBuffIn,
 |  | BUFFER * | pbuffOut,
 |  | DWORD * | pcbBuffOut,
 |  | BOOL * | pfNeedMoreData,
 |  | CHAR * | pszPackage,
 |  | CHAR * | pszUser,
 |  | CHAR * | pszPassword
 | ) |  |

Definition at line 636 of file HttpAuth.c.

                   :

    Initiates or continues a previously initiated authentication conversation

    Client calls this first to get the negotiation message which
    it then sends to the server.  The server calls this with the
    client result and sends back the result.  The conversation
    continues until *pfNeedMoreData is FALSE.

    On the first call, pszPackage must point to the zero terminated
    authentication package name to be used and pszUser and pszPassword
    should point to the user name and password to authenticated with
    on the client side (server side will always be NULL).

Arguments:

    pBuffIn - Points to SSP message received from the
        client.  If UUENCODE is used, then this must point to a
        zero terminated uuencoded string (except for the first call).
    cbBuffIn - Number of bytes in pBuffIn or zero if pBuffIn points to a
        zero terminated, uuencoded string.
    pbuffOut - If *pfDone is not set to TRUE, this buffer contains the data
        that should be sent to the other side.  If this is zero, then no
        data needs to be sent.
    pcbBuffOut - Number of bytes in pbuffOut
    pfNeedMoreData - Set to TRUE while this side of the conversation is
        expecting more data from the remote side.
    pszPackage - On the first call points to a zero terminate string indicating
        the security package to use
    pszUser - Specifies user or domain\user the first time the client calls
        this method (client side only)
    pszPassword - Specifies the password for pszUser the first time the
        client calls this method (client side only)

Return Value:

    TRUE if successful, FALSE otherwise (call GetLastError).  Access is
    denied if FALSE is returned and GetLastError is ERROR_ACCESS_DENIED.

--*/
{
    SECURITY_STATUS       ss;
    TimeStamp             Lifetime;
    SecBufferDesc         OutBuffDesc;
    SecBuffer             OutSecBuff;
    SecBufferDesc         InBuffDesc;
    SecBuffer             InSecBuff;
    ULONG                 ContextAttributes;
    BUFFER                buffData;
    BUFFER                buff;
    BOOL                  fSt;
    BOOL                  fReply;

    BufferInit( &buffData );
    BufferInit( &buff );

    //
    //  Decode the data if there's something to decode
    //

    if ( pAS->_fUUEncodeData && pBuffIn )
    {
        if ( !uudecode( (CHAR *) pBuffIn,
                        &buffData,
                        &cbBuffIn ))
        {
            fSt = FALSE;
            goto ex;
        }

        pBuffIn = BufferQueryPtr( &buffData );
    }

    //
    //  If this is a new conversation, then we need to get the credential
    //  handle and find out the maximum token size
    //

    if ( pAS->_fNewConversation )
    {
        SecPkgInfo *              pspkg;
        SEC_WINNT_AUTH_IDENTITY   AuthIdentity;
        SEC_WINNT_AUTH_IDENTITY * pAuthIdentity;
        CHAR *                    pszDomain = NULL;
        CHAR                      szDomainAndUser[DNLEN+UNLEN+2];

        //
        //  fill out the authentication information
        //

        if ( ((pszUser != NULL) ||
              (pszPassword != NULL)) )
        {
            pAuthIdentity = &AuthIdentity;

            //
            //  Break out the domain from the username if one was specified
            //

            if ( pszUser != NULL )
            {
                strcpy( szDomainAndUser, pszUser );
                if ( !CrackUserAndDomain( szDomainAndUser,
                                          &pszUser,
                                          &pszDomain ))
                {
                    return FALSE;
                }
            }

            memset( &AuthIdentity,
                    0,
                    sizeof( AuthIdentity ));

            if ( pszUser != NULL )
            {
                AuthIdentity.User       = (unsigned char *) pszUser;
                AuthIdentity.UserLength = (ULONG)strlen( pszUser );
            }

            if ( pszPassword != NULL )
            {
                AuthIdentity.Password       = (unsigned char *) pszPassword;
                AuthIdentity.PasswordLength = (ULONG)strlen( pszPassword );
            }

            if ( pszDomain != NULL )
            {
                AuthIdentity.Domain       = (unsigned char *) pszDomain;
                AuthIdentity.DomainLength = (ULONG)strlen( pszDomain );
            }

            AuthIdentity.Flags = SEC_WINNT_AUTH_IDENTITY_ANSI;
        }
        else
        {
            pAuthIdentity = NULL;
        }

        ss = sfProcs.pAcquireCredentialsHandle( NULL,    // New principal
                                       pszPackage,       // Package name
                                       SECPKG_CRED_OUTBOUND,
                                       NULL,             // Logon ID
                                       pAuthIdentity,    // Auth Data
                                       NULL,             // Get key func
                                       NULL,             // Get key arg
                                       &pAS->_hcred,
                                       &Lifetime );

        //
        //  Need to determine the max token size for this package
        //

        if ( ss == STATUS_SUCCESS )
        {
            pAS->_fHaveCredHandle = TRUE;
            ss = sfProcs.pQuerySecurityPackageInfo(
                        (char *) pszPackage,
                        &pspkg );
        }

        if ( ss != STATUS_SUCCESS )
        {
            SetLastError( ss );
            return FALSE;
        }

        pAS->_cbMaxToken = pspkg->cbMaxToken;

        sfProcs.pFreeContextBuffer( pspkg );

    }

    //
    //  Prepare our output buffer.  We use a temporary buffer because
    //  the real output buffer will most likely need to be uuencoded
    //

    if ( !BufferResize( &buff, pAS->_cbMaxToken ))
    {
        fSt = FALSE;
        goto ex;
    }

    OutBuffDesc.ulVersion = 0;
    OutBuffDesc.cBuffers  = 1;
    OutBuffDesc.pBuffers  = &OutSecBuff;

    OutSecBuff.cbBuffer   = pAS->_cbMaxToken;
    OutSecBuff.BufferType = SECBUFFER_TOKEN;
    OutSecBuff.pvBuffer   = BufferQueryPtr( &buff );

    //
    //  Prepare our Input buffer - Note the server is expecting the client's
    //  negotiation packet on the first call
    //

    if ( pBuffIn )
    {
        InBuffDesc.ulVersion = 0;
        InBuffDesc.cBuffers  = 1;
        InBuffDesc.pBuffers  = &InSecBuff;

        InSecBuff.cbBuffer   = cbBuffIn;
        InSecBuff.BufferType = SECBUFFER_TOKEN;
        InSecBuff.pvBuffer   = pBuffIn;
    }

    {
        //
        //  will return success when its done but we still
        //  need to send the out buffer if there are bytes to send
        //

        ss = sfProcs.pInitializeSecurityContext(
                                        &pAS->_hcred,
                                        pAS->_fNewConversation ? NULL :
                                                &pAS->_hctxt,
                                        TOKEN_SOURCE_NAME,
                                        0,
                                        0,
                                        SECURITY_NATIVE_DREP,
                                        pAS->_fNewConversation ? NULL :
                                                &InBuffDesc,
                                        0,
                                        &pAS->_hctxt,
                                        &OutBuffDesc,
                                        &ContextAttributes,
                                        &Lifetime );
    }

    if ( !SEC_SUCCESS( ss ) )
    {
        if ( ss == SEC_E_LOGON_DENIED )
            ss = ERROR_LOGON_FAILURE;

        SetLastError( ss );
        fSt = FALSE;
        goto ex;
    }

    pAS->_fHaveCtxtHandle = TRUE;

    //
    //  Now we just need to complete the token (if requested) and prepare
    //  it for shipping to the other side if needed
    //

    fReply = !!OutSecBuff.cbBuffer;

    if ( (ss == SEC_I_COMPLETE_NEEDED) ||
         (ss == SEC_I_COMPLETE_AND_CONTINUE) )
    {
        if ( sfProcs.pCompleteAuthToken != NULL )
        {
            ss = sfProcs.pCompleteAuthToken( &pAS->_hctxt,
                                    &OutBuffDesc );

            if ( !SEC_SUCCESS( ss ))
            {
                fSt = FALSE;
                goto ex;
            }
        }
        else
        {
            // if not supported

            fSt = FALSE;
            goto ex;
        }
    }

    //
    //  Format or copy to the output buffer if we need to reply
    //

    if ( fReply )
    {
        if ( pAS->_fUUEncodeData )
        {
            if ( !uuencode( (BYTE *) OutSecBuff.pvBuffer,
                            OutSecBuff.cbBuffer,
                            pbuffOut ))
            {
                fSt = FALSE;
                goto ex;
            }

            *pcbBuffOut = (ULONG)strlen( (CHAR *) BufferQueryPtr(pbuffOut) );
        }
        else
        {
            if ( !BufferResize( pbuffOut, OutSecBuff.cbBuffer ))
            {
                fSt = FALSE;
                goto ex;
            }

            memcpy( BufferQueryPtr(pbuffOut),
                    OutSecBuff.pvBuffer,
                    OutSecBuff.cbBuffer );

            *pcbBuffOut = OutSecBuff.cbBuffer;
        }
    }

    if ( pAS->_fNewConversation )
        pAS->_fNewConversation = FALSE;

    *pfNeedMoreData = ((ss == SEC_I_CONTINUE_NEEDED) ||
                       (ss == SEC_I_COMPLETE_AND_CONTINUE));

    fSt = TRUE;

ex:
    BufferTerminate( &buffData );
    BufferTerminate( &buff );

    if(ContextAttributes)
        printf("some attributes %lx\n",ContextAttributes);

    if(ContextAttributes & ISC_RET_ALLOCATED_MEMORY)
        printf("allocated memory\n");

    return fSt;
}

BOOL AuthInit ( AUTH_SEQ * pAS )

Definition at line 575 of file HttpAuth.c.

                    :

    Initialize a SSP authentication sequence

 Arguments:

    None

 Return Value:

    Returns TRUE is successful; otherwise FALSE is returned.

--*/
{
    pAS->_fNewConversation = TRUE;
    pAS->_fHaveCredHandle = FALSE;
    pAS->_fHaveCtxtHandle = FALSE;
    pAS->_fUUEncodeData = TRUE;

    g_fAuth = TRUE;

    return TRUE;
}

void AuthTerminate ( AUTH_SEQ * pAS )

Definition at line 605 of file HttpAuth.c.

                    :

    Terminate a SSP authentication sequence

 Arguments:

    None

 Return Value:

    None

--*/
{
    if ( pAS->_fHaveCredHandle )
        sfProcs.pFreeCredentialsHandle( &pAS->_hcred );

    pAS->_fHaveCredHandle = FALSE;

    if ( pAS->_fHaveCtxtHandle )
        sfProcs.pDeleteSecurityContext( &pAS->_hctxt );

    pAS->_fHaveCtxtHandle = FALSE;
}

BOOL BufferInit ( BUFFER * pB )

Definition at line 136 of file HttpAuth.c.

{
    pB->pBuf = NULL;
    pB->cLen = 0;

    return TRUE;
}

PBYTE BufferQueryPtr ( BUFFER * pB )

Definition at line 156 of file HttpAuth.c.

{
    return pB->pBuf;
}

BOOL BufferResize | ( | BUFFER * | pB,
 |  | DWORD | cNewL
 | ) |  |

Definition at line 162 of file HttpAuth.c.

{
    PBYTE pN;
    if ( cNewL > pB->cLen )
    {
        pN = malloc( cNewL );
        if ( pB->pBuf )
        {
            memcpy( pN, pB->pBuf, pB->cLen );
            free( pB->pBuf );
        }
        pB->pBuf = pN;
        pB->cLen = cNewL;
    }

    return TRUE;
}

void BufferTerminate ( BUFFER * pB )

Definition at line 145 of file HttpAuth.c.

{
    if ( pB->pBuf != NULL )
    {
        free( pB->pBuf );
        pB->pBuf = NULL;
        pB->cLen = 0;
    }
}

BOOL CrackUserAndDomain | ( | CHAR * | pszDomainAndUser,
 |  | CHAR ** | ppszUser,
 |  | CHAR ** | ppszDomain
 | ) |  |

Definition at line 979 of file HttpAuth.c.

                   :

    Given a user name potentially in the form domain\user, zero terminates
    the domain name and returns pointers to the domain name and the user name

Arguments:

    pszDomainAndUser - Pointer to user name or domain and user name
    ppszUser - Receives pointer to user portion of name
    ppszDomain - Receives pointer to domain portion of name

Return Value:

    TRUE if successful, FALSE otherwise (call GetLastError)

--*/
{
    static CHAR szDefaultDomain[MAX_COMPUTERNAME_LENGTH+1];
    DWORD cbN;

    //
    //  Crack the name into domain/user components.
    //

    *ppszDomain = pszDomainAndUser;
    *ppszUser   = strpbrk( pszDomainAndUser, "/\\" );

    if( *ppszUser == NULL )
    {
        //
        //  No domain name specified, just the username so we assume the
        //  user is on the local machine
        //

        if ( !*szDefaultDomain )
        {
            cbN = sizeof(szDefaultDomain);
            GetComputerName( szDefaultDomain, &cbN );
        }

        *ppszDomain = szDefaultDomain;
        *ppszUser   = pszDomainAndUser;
    }
    else
    {
        //
        //  Both domain & user specified, skip delimiter.
        //

        **ppszUser = '\0';
        (*ppszUser)++;

        if( ( **ppszUser == '\0' ) ||
            ( **ppszUser == '\\' ) ||
            ( **ppszUser == '/' ) )
        {
            //
            //  Name is of one of the following (invalid) forms:
            //
            //      "domain\"
            //      "domain\\..."
            //      "domain/..."
            //

            SetLastError( ERROR_INVALID_PARAMETER );
            return FALSE;
        }
    }

    return TRUE;
}

BOOL InitAuthorizationHeader ( )

Definition at line 187 of file HttpAuth.c.

                    :

    Initialize the authentication package

 Arguments:

    None

 Return Value:

    Returns TRUE is successful; otherwise FALSE is returned.

--*/
{
    OSVERSIONINFO   VerInfo;
    UCHAR lpszDLL[MAX_PATH];

    //
    //  Find out which security DLL to use, depending on
    //  whether we are on NT or Win95
    //
    VerInfo.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
    if (!GetVersionEx (&VerInfo))   // If this fails, something has gone wrong
    {
        return FALSE;
    }

    if (VerInfo.dwPlatformId == VER_PLATFORM_WIN32_NT)
    {
        strcpy (lpszDLL, "security.dll" );
    }
    else if (VerInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)
    {
        strcpy (lpszDLL, "secur32.dll" );
    }
    else
    {
        return FALSE;
    }

    //
    //  Load Security DLL
    //

    g_hSecLib = LoadLibrary (lpszDLL);
    if (g_hSecLib == NULL)
    {
        return FALSE;
    }

    // Get all entry points we care about

    sfProcs.pFreeCredentialsHandle
            = (FREE_CREDENTIALS_HANDLE_FN) GetProcAddress(
                    g_hSecLib,
                    "FreeCredentialsHandle" );

    sfProcs.pQuerySecurityPackageInfo
            = (QUERY_SECURITY_PACKAGE_INFO_FN) GetProcAddress(
                    g_hSecLib,
                    "QuerySecurityPackageInfoA" );

    sfProcs.pAcquireCredentialsHandle
            = (ACQUIRE_CREDENTIALS_HANDLE_FN) GetProcAddress(
                    g_hSecLib,
                    "AcquireCredentialsHandleA" );

    sfProcs.pFreeContextBuffer
            = (FREE_CONTEXT_BUFFER_FN) GetProcAddress(
                    g_hSecLib,
                    "FreeContextBuffer" );

    sfProcs.pInitializeSecurityContext
            = (INITIALIZE_SECURITY_CONTEXT_FN) GetProcAddress(
                    g_hSecLib,
                    "InitializeSecurityContextA" );

    sfProcs.pCompleteAuthToken
            = (COMPLETE_AUTH_TOKEN_FN) GetProcAddress(
                    g_hSecLib,
                    "CompleteAuthToken" );

    sfProcs.pEnumerateSecurityPackages
            = (ENUMERATE_SECURITY_PACKAGES_FN) GetProcAddress(
                    g_hSecLib,
                    "EnumerateSecurityPackagesA" );

    sfProcs.pDeleteSecurityContext
            = (DELETE_SECURITY_CONTEXT_FN) GetProcAddress(
                    g_hSecLib,
                    "DeleteSecurityContext" );

    if ( sfProcs.pFreeCredentialsHandle == NULL
            || sfProcs.pQuerySecurityPackageInfo == NULL
            || sfProcs.pAcquireCredentialsHandle == NULL
            || sfProcs.pFreeContextBuffer == NULL
            || sfProcs.pInitializeSecurityContext == NULL
            || sfProcs.pEnumerateSecurityPackages == NULL )
    {
        FreeLibrary( g_hSecLib );
        g_hSecLib = NULL;
        return FALSE;
    }

    g_fAuth = g_fBasic = FALSE;

    return TRUE;
}

BOOL IsInAuthorizationSequence ( )

Definition at line 337 of file HttpAuth.c.

                    :

    Indicates if in authentication sequence

 Arguments:

    None

 Return Value:

    Returns TRUE is successful; otherwise FALSE is returned.

--*/
{
    return g_fAuth || g_fBasic;
}

void TerminateAuthorizationHeader ( )

Definition at line 302 of file HttpAuth.c.

                    :

    Terminate the authentication package

 Arguments:

    None

 Return Value:

    None

--*/
{
    if ( g_fAuth )
    {
        AuthTerminate( &g_Auth );
        g_fAuth = FALSE;
    }

    g_fBasic = FALSE;

    if ( g_hSecLib != NULL )
    {
        FreeLibrary( g_hSecLib );
        g_hSecLib = NULL;
    }
}

BOOL uudecode | ( | char * | bufcoded,
 |  | BUFFER * | pbuffdecoded,
 |  | DWORD * | pcbDecoded
 | ) |  |

Definition at line 1094 of file HttpAuth.c.

                    :

    uudecode a string of data

 Arguments:

    bufcoded            pointer to uuencoded data
    pbuffdecoded        pointer to output BUFFER structure
    pcbDecoded          number of decode bytes

 Return Value:

    Returns TRUE is successful; otherwise FALSE is returned.

--*/
{
    int nbytesdecoded;
    char *bufin = bufcoded;
    unsigned char *bufout;
    int nprbytes;

    /* Strip leading whitespace. */

    while(*bufcoded==' ' || *bufcoded == '\t') bufcoded++;

    /* Figure out how many characters are in the input buffer.
     * If this would decode into more bytes than would fit into
     * the output buffer, adjust the number of input bytes downwards.
     */
    bufin = bufcoded;
    while(pr2six[*(bufin++)] <= 63);
    nprbytes = (int)(INT_PTR)(bufin - bufcoded - 1);
    nbytesdecoded = ((nprbytes+3)/4) * 3;

    if ( !BufferResize( pbuffdecoded, nbytesdecoded + 4 ))
        return FALSE;

    if ( pcbDecoded )
        *pcbDecoded = nbytesdecoded;

    bufout = (unsigned char *) BufferQueryPtr(pbuffdecoded);

    bufin = bufcoded;

    while (nprbytes > 0) {
        *(bufout++) =
            (unsigned char) (pr2six[*bufin] << 2 | pr2six[bufin[1]] >> 4);
        *(bufout++) =
            (unsigned char) (pr2six[bufin[1]] << 4 | pr2six[bufin[2]] >> 2);
        *(bufout++) =
            (unsigned char) (pr2six[bufin[2]] << 6 | pr2six[bufin[3]]);
        bufin += 4;
        nprbytes -= 4;
    }

    if(nprbytes & 03) {
        if(pr2six[bufin[-2]] > 63)
            nbytesdecoded -= 2;
        else
            nbytesdecoded -= 1;
    }

    ((CHAR *)BufferQueryPtr(pbuffdecoded))[nbytesdecoded] = '\0';

    return TRUE;
}

BOOL uuencode | ( | BYTE * | bufin,
 |  | DWORD | nbytes,
 |  | BUFFER * | pbuffEncoded
 | ) |  |

Definition at line 1169 of file HttpAuth.c.

                    :

    uuencode a string of data

 Arguments:

    bufin           pointer to data to encode
    nbytes          number of bytes to encode
    pbuffEncoded    pointer to output BUFFER structure

 Return Value:

    Returns TRUE is successful; otherwise FALSE is returned.

--*/
{
   unsigned char *outptr;
   unsigned int i;

   //
   //  Resize the buffer to 133% of the incoming data
   //

   if ( !BufferResize( pbuffEncoded, nbytes + ((nbytes + 3) / 3) + 4))
        return FALSE;

   outptr = (unsigned char *) BufferQueryPtr(pbuffEncoded);

   for (i=0; i<nbytes; i += 3) {
      *(outptr++) = six2pr[*bufin >> 2];            /* c1 */
      *(outptr++) = six2pr[((*bufin << 4) & 060) | ((bufin[1] >> 4) & 017)]; /*c2*/
      *(outptr++) = six2pr[((bufin[1] << 2) & 074) | ((bufin[2] >> 6) & 03)];/*c3*/
      *(outptr++) = six2pr[bufin[2] & 077];         /* c4 */

      bufin += 3;
   }

   /* If nbytes was not a multiple of 3, then we have encoded too
    * many characters.  Adjust appropriately.
    */
   if(i == nbytes+1) {
      /* There were only 2 bytes in that last group */
      outptr[-1] = '=';
   } else if(i == nbytes+2) {
      /* There was only 1 byte in that last group */
      outptr[-1] = '=';
      outptr[-2] = '=';
   }

   *outptr = '\0';

   return TRUE;
}

BOOL ValidateAuthenticationMethods | ( | PSTR | pszMet,
 |  | PSTR | pszPreferedMet
 | ) |  |

Definition at line 360 of file HttpAuth.c.

                    :

    Filter the supplied authentication list for supported
    methods ( Basic and all local security packages )

 Arguments:

    None

 Return Value:

    Returns TRUE if at least one authentication method supported,
    otherwise FALSE is returned.

--*/
{
    PSecPkgInfo pSec=NULL;
    ULONG cSec, iS;
    BOOL fValid;
    PSTR p,t;
    SECURITY_STATUS ss;

    // access local security packages list

    if ( (ss = sfProcs.pEnumerateSecurityPackages( &cSec, &pSec ))
            == STATUS_SUCCESS )
    {
        for ( t = p = pszMet ; *p ; )
        {
            // Valid methods are "Basic" and all security packages

            if ( !_stricmp( p , "Basic" ) )
                fValid = TRUE;
            else for ( iS = 0 ; iS < cSec ; ++iS )
                if ( !_stricmp( pSec[iS].Name, p ) )
                    break;

            if ( fValid )
            {
                if ( t != p )
                    memmove( t, p, strlen(p)+1 );
                p += strlen( p ) + 1;
                t += strlen( t ) + 1;
            }
        }
        *t = '\0';
    }

    // free up the info buffer
    if(pSec)
        sfProcs.pFreeContextBuffer(pSec);

    // check for prefered method

    if ( pszPreferedMet != NULL )
    {
        PSTR pP;

        for ( pP = strtok( pszPreferedMet, "," ) ;
                pP != NULL ;
                pP = strtok( NULL, "," ) )
        {
            // scan list of validated methods for the current
            // prefered method

            for ( p = pszMet ; *p ; )
            {
                if ( !_stricmp( pP, p ) )
                {
                    memmove( pszMet, p, strlen(p) + 1 );
                    return TRUE;
                }
                p += strlen( p ) + 1;
            }
        }

        // no method in the prefered method list is supported

        return FALSE;
    }

    // no prefered method list supplied

    return *pszMet ? TRUE : FALSE;
}

Variable Documentation

const int pr2six[256]
Initial value:
{
    64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,
    64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,62,64,64,64,63,
    52,53,54,55,56,57,58,59,60,61,64,64,64,64,64,64,64,0,1,2,3,4,5,6,7,8,9,
    10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,64,64,64,64,64,64,26,27,
    28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,
    64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,
    64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,
    64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,
    64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,
    64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,
    64,64,64,64,64,64,64,64,64,64,64,64,64
}

Definition at line 1070 of file HttpAuth.c.

char six2pr[64]
Initial value:
 {
    'A','B','C','D','E','F','G','H','I','J','K','L','M',
    'N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
    'a','b','c','d','e','f','g','h','i','j','k','l','m',
    'n','o','p','q','r','s','t','u','v','w','x','y','z',
    '0','1','2','3','4','5','6','7','8','9','+','/'
}

Definition at line 1084 of file HttpAuth.c.

Generated on Wed Nov 13 2024 16:54:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/SSPI/HttpAuth/HttpAuth.h File Reference

  • Security
  • SSPI
  • HttpAuth
Functions

HttpAuth.h File Reference

Go to the source code of this file.

Functions

BOOL | AddAuthorizationHeader (PSTR pch, PSTR pchSchemes, PSTR pchAuthData, PSTR pchUserName, PSTR pchPassword, BOOL *pfNeedMoreData)
BOOL InitAuthorizationHeader ()
BOOL IsInAuthorizationSequence ()
void | TerminateAuthorizationHeader ()
BOOL | ValidateAuthenticationMethods (PSTR pszMet, PSTR pszPref)

Function Documentation

BOOL AddAuthorizationHeader | ( | PSTR | pch,
 |  | PSTR | pchSchemes,
 |  | PSTR | pchAuthData,
 |  | PSTR | pchUserName,
 |  | PSTR | pchPassword,
 |  | BOOL * | pfNeedMoreData
 | ) |  |

Definition at line 454 of file HttpAuth.c.

                    :

    Generates an authentication header to be sent to the server.
    An authentication sequence will be initiated if none is in
    use and at least one of the authentication scheme specified
    in pchSchemes is recognized.
    Otherwise the current authentication sequence will proceed.

 Arguments:

    pch                 where to append authentication header
    pchSchemes          list of null-delimited authentication methods
    pchAuthData         incoming blob from server
    pchUserName         user name ( possibly prefixed with domain )
    pchPassword         password
    pfNeedMoreData      Out: TRUE if authentication sequence to continue

 Return Value:

    Returns TRUE is successful; otherwise FALSE is returned.

--*/
{
    CHAR   achUserAndPass[256];
    BUFFER buff;
    BOOL fSt = TRUE;
    DWORD cbOut;

    BufferInit( &buff );

    while ( *pchSchemes )
    {
        if ( !stricmp( pchSchemes, "Basic" ))
        {
            // if already in authentication sequence, it failed.

            if ( g_fBasic )
            {
                SetLastError( ERROR_ACCESS_DENIED );
                fSt = FALSE;
                break;
            }

            strcpy( achUserAndPass, pchUserName );
            strcat( achUserAndPass, ":" );
            strcat( achUserAndPass, pchPassword );

            uuencode( (BYTE *) achUserAndPass,
                      (DWORD)strlen( achUserAndPass ),
                      &buff );
            strcat( pch, "Authorization: " );
            strcat( pch, "Basic " );
            strcat( pch, BufferQueryPtr( &buff ));
            strcat( pch, "\r\n");
            g_fBasic = TRUE;
            break;
        }
        else
        {
            // SSPI package ( assuming methods list have been validated )

            if ( !g_fAuth )
            {
                if ( !AuthInit( &g_Auth ) )
                {
                    fSt = FALSE;
                    goto ex;
                }
            }
            else if ( pchAuthData == NULL || *pchAuthData == '\0' )
            {
                // no blob while in authentication sequence : it failed

                SetLastError( ERROR_ACCESS_DENIED );
                fSt = FALSE;
                break;
            }

            if ( !AuthConverse( &g_Auth,
                  (void *) pchAuthData,
                  0,
                  &buff,
                  &cbOut,
                  pfNeedMoreData,
                  pchSchemes,
                  pchUserName,
                  pchPassword ))
            {
                fSt = FALSE;
                goto ex;
            }

            strcat( pch, "Authorization: " );
            strcat( pch, pchSchemes );
            strcat( pch, " " );
            strcat( pch, (CHAR *) BufferQueryPtr( &buff ) );
            strcat( pch, "\r\n" );
            break;
        }

        pchSchemes += strlen(pchSchemes) + 1;
    }
ex:
    BufferTerminate( &buff );

    return fSt;
}

BOOL InitAuthorizationHeader ( )

Definition at line 187 of file HttpAuth.c.

                    :

    Initialize the authentication package

 Arguments:

    None

 Return Value:

    Returns TRUE is successful; otherwise FALSE is returned.

--*/
{
    OSVERSIONINFO   VerInfo;
    UCHAR lpszDLL[MAX_PATH];

    //
    //  Find out which security DLL to use, depending on
    //  whether we are on NT or Win95
    //
    VerInfo.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
    if (!GetVersionEx (&VerInfo))   // If this fails, something has gone wrong
    {
        return FALSE;
    }

    if (VerInfo.dwPlatformId == VER_PLATFORM_WIN32_NT)
    {
        strcpy (lpszDLL, "security.dll" );
    }
    else if (VerInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)
    {
        strcpy (lpszDLL, "secur32.dll" );
    }
    else
    {
        return FALSE;
    }

    //
    //  Load Security DLL
    //

    g_hSecLib = LoadLibrary (lpszDLL);
    if (g_hSecLib == NULL)
    {
        return FALSE;
    }

    // Get all entry points we care about

    sfProcs.pFreeCredentialsHandle
            = (FREE_CREDENTIALS_HANDLE_FN) GetProcAddress(
                    g_hSecLib,
                    "FreeCredentialsHandle" );

    sfProcs.pQuerySecurityPackageInfo
            = (QUERY_SECURITY_PACKAGE_INFO_FN) GetProcAddress(
                    g_hSecLib,
                    "QuerySecurityPackageInfoA" );

    sfProcs.pAcquireCredentialsHandle
            = (ACQUIRE_CREDENTIALS_HANDLE_FN) GetProcAddress(
                    g_hSecLib,
                    "AcquireCredentialsHandleA" );

    sfProcs.pFreeContextBuffer
            = (FREE_CONTEXT_BUFFER_FN) GetProcAddress(
                    g_hSecLib,
                    "FreeContextBuffer" );

    sfProcs.pInitializeSecurityContext
            = (INITIALIZE_SECURITY_CONTEXT_FN) GetProcAddress(
                    g_hSecLib,
                    "InitializeSecurityContextA" );

    sfProcs.pCompleteAuthToken
            = (COMPLETE_AUTH_TOKEN_FN) GetProcAddress(
                    g_hSecLib,
                    "CompleteAuthToken" );

    sfProcs.pEnumerateSecurityPackages
            = (ENUMERATE_SECURITY_PACKAGES_FN) GetProcAddress(
                    g_hSecLib,
                    "EnumerateSecurityPackagesA" );

    sfProcs.pDeleteSecurityContext
            = (DELETE_SECURITY_CONTEXT_FN) GetProcAddress(
                    g_hSecLib,
                    "DeleteSecurityContext" );

    if ( sfProcs.pFreeCredentialsHandle == NULL
            || sfProcs.pQuerySecurityPackageInfo == NULL
            || sfProcs.pAcquireCredentialsHandle == NULL
            || sfProcs.pFreeContextBuffer == NULL
            || sfProcs.pInitializeSecurityContext == NULL
            || sfProcs.pEnumerateSecurityPackages == NULL )
    {
        FreeLibrary( g_hSecLib );
        g_hSecLib = NULL;
        return FALSE;
    }

    g_fAuth = g_fBasic = FALSE;

    return TRUE;
}

BOOL IsInAuthorizationSequence ( )

Definition at line 337 of file HttpAuth.c.

                    :

    Indicates if in authentication sequence

 Arguments:

    None

 Return Value:

    Returns TRUE is successful; otherwise FALSE is returned.

--*/
{
    return g_fAuth || g_fBasic;
}

void TerminateAuthorizationHeader ( )

Definition at line 302 of file HttpAuth.c.

                    :

    Terminate the authentication package

 Arguments:

    None

 Return Value:

    None

--*/
{
    if ( g_fAuth )
    {
        AuthTerminate( &g_Auth );
        g_fAuth = FALSE;
    }

    g_fBasic = FALSE;

    if ( g_hSecLib != NULL )
    {
        FreeLibrary( g_hSecLib );
        g_hSecLib = NULL;
    }
}

BOOL ValidateAuthenticationMethods | ( | PSTR | pszMet,
 |  | PSTR | pszPref
 | ) |  |

Definition at line 360 of file HttpAuth.c.

                    :

    Filter the supplied authentication list for supported
    methods ( Basic and all local security packages )

 Arguments:

    None

 Return Value:

    Returns TRUE if at least one authentication method supported,
    otherwise FALSE is returned.

--*/
{
    PSecPkgInfo pSec=NULL;
    ULONG cSec, iS;
    BOOL fValid;
    PSTR p,t;
    SECURITY_STATUS ss;

    // access local security packages list

    if ( (ss = sfProcs.pEnumerateSecurityPackages( &cSec, &pSec ))
            == STATUS_SUCCESS )
    {
        for ( t = p = pszMet ; *p ; )
        {
            // Valid methods are "Basic" and all security packages

            if ( !_stricmp( p , "Basic" ) )
                fValid = TRUE;
            else for ( iS = 0 ; iS < cSec ; ++iS )
                if ( !_stricmp( pSec[iS].Name, p ) )
                    break;

            if ( fValid )
            {
                if ( t != p )
                    memmove( t, p, strlen(p)+1 );
                p += strlen( p ) + 1;
                t += strlen( t ) + 1;
            }
        }
        *t = '\0';
    }

    // free up the info buffer
    if(pSec)
        sfProcs.pFreeContextBuffer(pSec);

    // check for prefered method

    if ( pszPreferedMet != NULL )
    {
        PSTR pP;

        for ( pP = strtok( pszPreferedMet, "," ) ;
                pP != NULL ;
                pP = strtok( NULL, "," ) )
        {
            // scan list of validated methods for the current
            // prefered method

            for ( p = pszMet ; *p ; )
            {
                if ( !_stricmp( pP, p ) )
                {
                    memmove( pszMet, p, strlen(p) + 1 );
                    return TRUE;
                }
                p += strlen( p ) + 1;
            }
        }

        // no method in the prefered method list is supported

        return FALSE;
    }

    // no prefered method list supplied

    return *pszMet ? TRUE : FALSE;
}

Generated on Wed Nov 13 2024 16:54:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/SSPI/HttpAuth/HttpGet.c File Reference

  • Security
  • SSPI
  • HttpAuth
Defines | Functions

HttpGet.c File Reference

#include <windows.h>
#include <stdio.h>
#include <io.h>
#include <fcntl.h>
#include <stdlib.h>
#include <time.h>
#include <malloc.h>
#include "const.h"
#include "proto.h"

Go to the source code of this file.

Defines

#define | SOCKETS_METHOD 1

Functions

void __cdecl | main (int argc, char *argv[])
void | PrintUsage (void)

Define Documentation

#define SOCKETS_METHOD 1

Definition at line 37 of file HttpGet.c.

Function Documentation

void __cdecl main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 41 of file HttpGet.c.

{
    char *        Server;
    char *        URL;
    char *        Verb = "GET";
    char *        Gateway = NULL;
    char *        AcceptTypes[2] = {"*/*", NULL};
    char          Headers[] =
                      "Accept: */*\r\n"
                      "User-Agent: Httpget\r\n"
                      "Referer: Httpget\r\n"
                      "\r\n";
    int           Method = SOCKETS_METHOD;
    BOOL          DisplayHeaders = FALSE;
    DWORD         ClientDataSize = 0;
    PSTR          pszUserName = "";
    PSTR          pszPassword = "";
    PSTR          pszStore = NULL;
    PSTR          pszPref = NULL;

    //
    // Parse the command line
    //

    if (argc < 3)
    {
        PrintUsage();
        return;
    }

    while (argc > 3)
    {
        //
        // parse options
        //

        if (argv[1][0] == '-')
        {
            switch (argv[1][1])
            {
            case 'V' :
            case 'v' :
                //
                // Input verb
                //

                Verb = &argv[1][3];

                break;

            case 'H' :
            case 'h' :
                //
                // Display headers
                //

                DisplayHeaders = TRUE;

                break;

            case 'D' :
            case 'd' :
                //
                // Amount of data to send
                //

                if (sscanf(&argv[1][3], "%u", &ClientDataSize) != 1)
                {
                    PrintUsage();
                    return;
                }
                break;

            case 'G' :
            case 'g' :
                //
                // Gateway
                //

                Gateway = &argv[1][3];

                break;

            case 'M':
            case 'm':
                // User name
                pszPref = &argv[1][3];
                break;

            case 'N':
            case 'n':
                // User name
                pszUserName = &argv[1][3];
                break;

            case 'P':
            case 'p':
                // Password
                pszPassword = &argv[1][3];
                break;

            case 'S':
            case 's':
                pszStore = &argv[1][3];
                break;

            default:
                PrintUsage();
                return;
                break;
            }
        }
        else
        {
            PrintUsage();
            return;
        }

        argc --;
        argv ++;
    }

    Server = argv[1];

    URL = argv[2];

    switch (Method)
    {
    case SOCKETS_METHOD:
        HttpGetSocket(
            Verb,
            Server,
            URL,
            DisplayHeaders,
            ClientDataSize,
            pszUserName,
            pszPassword,
            pszStore,
            pszPref );
        break;
    }

    return;
}

void PrintUsage ( void )

Definition at line 189 of file HttpGet.c.

{
    fprintf(stderr,
        "httpauth  [-h] [-d:<size>] [-m:<methodlist>] [-v:<verb>] [-n:<username>]\n"
                "\t  [-p:<password>] [-g:gateway] [-s:storefile] <server> <path>\n"
        "\t-h           - display result headers\n"
        "\t<size>       - amount of client data to send\n"
        "\t<verb>       - HTTP verb to use (default is GET)\n"
        "\t<username>   - user name for authentication\n"
        "\t<password>   - password for authentication\n"
        "\t<methodlist> - comma separated list of authentication methods in order\n"
        "\t               of preference (Default is to use first supported method\n"
        "\t               returned by the HTTP server (e.g., -m:NTLM,BASIC)\n"
        "\t<storefile>  - file where to store result message body\n"
        "\t<server>     - web server to connect to (without http:)\n"
        "\t<path>       - resource to get (e.g., /default.htm)\n"
    );
}

Generated on Wed Nov 13 2024 16:54:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/SSPI/HttpAuth/Proto.H File Reference

  • Security
  • SSPI
  • HttpAuth
Functions

Proto.H File Reference

Go to the source code of this file.

Functions

BOOL HttpGetSocket (char *Verb, char *Server, char *URL, BOOL DisplayHeaders, DWORD ClientDataSize, PSTR pszUserName, PSTR pszPassword, PSTR pszStore, PSTR pszPref)

Function Documentation

BOOL HttpGetSocket | ( | char * | Verb,
 |  | char * | Server,
 |  | char * | URL,
 |  | BOOL | DisplayHeaders,
 |  | DWORD | ClientDataSize,
 |  | PSTR | pszUserName,
 |  | PSTR | pszPassword,
 |  | PSTR | pszStore,
 |  | PSTR | pszPref
 | ) |  |

Definition at line 72 of file Get_Sock.c.

                    :

    Issue a command to a HTTP server using authentication

 Arguments:

    Verb                HTTP command : GET / HEAD / ...
    Server              server name
    URL                 URL to send to the server
    DisplayHeaders      TRUE to display headers as received
    ClientDataSize      number of bytes to send in the request
    pchUserName         user name for authentication
    pchPassword         password for authentication
    pszStore            file name where to dump reply from server

 Return Value:

    Returns TRUE is successful; otherwise FALSE is returned.

--*/
{
    char               ReceiveBuffer[8*1024];
    int                Error;
    BYTE               Request[1024];
    int                RequestSize;
    char *             AcceptTypes[2] = {"*/*", NULL};
    SOCKET             Socket = INVALID_SOCKET;
    WSADATA            WsaData;
    struct sockaddr_in Address;
    struct hostent *   HostEntry;
    char               Headers[] =
                           "HTTP/1.0\r\n"
                           "User-Agent: AuthClient\r\n"
                           "Accept: */*\r\n";
    char               CrLf[] = "\r\n";
    BYTE               ClientData[64*1024];
    BOOL               fKeepAlive = FALSE;
    int                cRec;
    DWORD              cLen;
    BOOL               fInHeader;
    PSTR               pchAuthData;
    BOOL               fServerKeepAlive = FALSE;
    BOOL               fNeedMoreData;
    BOOL               fNeedAuthenticate;
    PSTR               pH;
    PSTR               pN;
    BOOL               fStatusLine;
    int                Status = -1;
    DWORD              cToRead;
    PSTR               paAuth = achAuth;
    BOOL               fSt = FALSE;
    int                hnd = EOF;

    Error = WSAStartup (0x101, &WsaData);

    if (Error == SOCKET_ERROR)
    {
        fprintf(stderr, "Error in WSAStartup = %d\n", GetLastError());
        return FALSE;
    }

    if ( !InitAuthorizationHeader() )
    {
        fprintf(stderr, "Cannot initialize security module\n" );
        return FALSE;
    }

    memset( achAuth, '\0', sizeof(achAuth) );
    pchAuthData = NULL;
    fNeedAuthenticate = FALSE;

    //
    // Connect to the server
    //

    if  ( pszStore != NULL )
        if ( (hnd = _open( pszStore, _O_BINARY | _O_CREAT | _O_TRUNC | _O_RDWR, S_IREAD|S_IWRITE )) == EOF )
        {
            fprintf( stderr, "Can't create file %s\n", pszStore );
            return FALSE;
        }

again:

    if ( Socket == INVALID_SOCKET )
    {
        Socket = socket(AF_INET, SOCK_STREAM, 0);

        if (Socket == INVALID_SOCKET)
        {
            fprintf(stderr, "Error creating socket = %d\n", GetLastError());
            fSt = FALSE;
            goto ex;
        }

        Address.sin_family = AF_INET;
        Address.sin_port = 0;
        Address.sin_addr.s_addr = INADDR_ANY;

        Error =
        bind(
            Socket,
            (struct sockaddr *) &Address,
            sizeof(Address));

        if (Error)
        {
            fprintf(stderr, "Error in bind = %d\n", GetLastError());
            fSt = FALSE;
            goto ex;
        }

        Address.sin_family = AF_INET;
        Address.sin_port = htons(80);
        Address.sin_addr.s_addr = inet_addr(Server);

        if (Address.sin_addr.s_addr == -1)
        {
            //
            // Must be a server name
            //
            HostEntry = gethostbyname(Server);
            if (HostEntry == NULL)
            {
                printf("unable to resolve %s\n", Server);
                fSt = FALSE;
                goto ex;
            } else
            {
                Address.sin_addr.s_addr = *((unsigned long *) HostEntry->h_addr);
            }
        }

        Error =
        connect(
            Socket,
            (struct sockaddr *) &Address,
            sizeof(Address));

        if (Error)
        {
            fprintf(stderr, "Error connecting to %s = %d\n", Server, GetLastError());
            fSt = FALSE;
            goto ex;
        }
    }

    //
    // Send the client request
    //

    strcpy(Request, Verb);
    strcat(Request, " ");
    strcat(Request, URL);
    strcat(Request, " ");
    strcat(Request, Headers);
    if (ClientDataSize)
    {
        sprintf(ClientData, "Content-Length: %d\r\n", ClientDataSize);
        strcat(Request, ClientData);
    }
    if ( fKeepAlive )
    {
        strcat(Request, "Connection: Keep-Alive\r\n" );
    }

    if ( !AddAuthorizationHeader( Request + strlen(Request), achAuth, pchAuthData, pchUserName, pchPassword, &fNeedMoreData ) )
    {
        printf( "Authentication failed\n" );
        fSt = FALSE;
        goto ex;
    }

    strcat(Request, CrLf);

    RequestSize = (int)strlen(Request);

    Error =
    send(
        Socket,
        Request,
        RequestSize,
        0);

    if (Error != RequestSize)
    {
        printf("Error in client send = %d, %d\n", Error, GetLastError());
        fSt = FALSE;
        goto ex;
    }

    if (ClientDataSize)
    {
        memset( ClientData, ' ', ClientDataSize );

        //
        // Send the client data
        //

        Error =
        send(
            Socket,
            ClientData,
            ClientDataSize,
            0);

        if ( (DWORD)Error != ClientDataSize)
        {
            printf("Error in client send = %d, %d\n", Error, GetLastError());
            fSt = FALSE;
            goto ex;
        }
    }

    // parse status & header

    cLen = (DWORD)-1;
    fInHeader = TRUE;
    fServerKeepAlive = FALSE;
    fNeedAuthenticate = FALSE;

    for ( pH = ReceiveBuffer, fStatusLine = TRUE ; fInHeader ; )
    {
        cRec = recv( Socket, pH, (int)(ReceiveBuffer+sizeof(ReceiveBuffer)-pH), 0 );
        if ( cRec <= 0 )
        {
            closesocket( Socket );
            Socket = INVALID_SOCKET;
            break;
        }
        pH[ cRec ] = '\0';

        // Iterate on header fields

        while ( pN = strstr(pH, "\r\n" ) )
        {
            *pN = '\0';

            if ( DisplayHeaders )
            {
                printf( "%s\n", pH );
            }

            if ( fStatusLine )
            {
                // This is the status line, decode status

                SkipNonWhite( &pH );
                SkipWhite( &pH );
                Status = atoi( pH );
                if ( Status == 401 )
                {
                    fNeedAuthenticate = TRUE;
                }
                fStatusLine = FALSE;
            }
            else if ( pN == pH )    // end of header fields
            {
                if ( hnd != EOF )
                    write( hnd, pH+2, (int)(ReceiveBuffer+cRec-pH-2) );

                cLen -= (int)(ReceiveBuffer+cRec-pH-2 );
                fInHeader = FALSE;
                break;
            }
            else if ( !strnicmp( pH, HD_AUTHENTICATE, sizeof(HD_AUTHENTICATE)-1 ) )
            {
                SkipNonWhite( &pH );
                SkipWhite( &pH );

                // check if we are already in the authentication sequence

                if ( !IsInAuthorizationSequence() )
                {
                    // append to list of supported authentication methods

                    strcpy( paAuth, pH );
                    paAuth += strlen( pH ) + 1;
                }
                else
                {
                    // store pointer to authenticate blob

                    SkipNonWhite( &pH );
                    SkipWhite( &pH );
                    pchAuthData = pH;
                }
            }
            else if ( !strnicmp( pH, HD_LENGTH, sizeof(HD_LENGTH)-1 ) )
            {
                // get content length

                SkipNonWhite( &pH );
                SkipWhite( &pH );
                cLen = atoi( pH );
            }
            else if ( !strnicmp( pH, HD_CONNECTION, sizeof(HD_CONNECTION)-1 ) )
            {
                // check for keep-alive flag

                SkipNonWhite( &pH );
                SkipWhite( &pH );
                if ( !strnicmp( pH, "Keep-Alive", sizeof("Keep-Alive")-1 ) )
                    fServerKeepAlive = TRUE;
            }

            pH = pN + 2;
        }
    }

    // add final delimiter to list of supported authentication methods

    if ( !IsInAuthorizationSequence() && fNeedAuthenticate )
    {
        *paAuth = '\0';

        // Insure specified methods are supported localy

        if ( !ValidateAuthenticationMethods( achAuth, pszPref ) )
        {
            // None of the server specified authentication methods
            // are supported localy.

            SetLastError( ERROR_ACCESS_DENIED );

            fprintf( stderr, "No supported authentication method\n" );

            fSt = FALSE;
            goto ex;
        }
    }

    // read message body

    if ( Socket != INVALID_SOCKET )
    {
        for ( ; cLen ; )
        {
            if ( (cToRead = sizeof(ReceiveBuffer)) > cLen )
                cToRead = cLen;
            cRec = recv( Socket, ReceiveBuffer, cToRead, 0 );

            if ( cRec <= 0 )
            {
                closesocket( Socket );
                Socket = INVALID_SOCKET;
                break;
            }
            if ( hnd != EOF )
                write( hnd, ReceiveBuffer, cRec );

            cLen -= cRec;
        }
    }

    if ( !fServerKeepAlive )
    {
        if ( IsInAuthorizationSequence() )
        {
            fprintf( stderr, "Authentication rejected by server\n" );

            fNeedAuthenticate = FALSE;  // authentication failed
        }

        closesocket( Socket );
        Socket = INVALID_SOCKET;
    }

    if ( fNeedAuthenticate )
    {
        fKeepAlive = TRUE;
        goto again;
    }

    if ( Socket != INVALID_SOCKET )
        closesocket(Socket);

    fSt = Status == 200;

ex:
    TerminateAuthorizationHeader();

    if ( hnd != EOF )
        close( hnd );

    return fSt;
}

Generated on Wed Nov 13 2024 16:54:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/SSPI/SockAuth/Client.cpp File Reference

  • Security
  • SSPI
  • SockAuth
Defines | Functions

Client.cpp File Reference

#include <windows.h>
#include <winsock.h>
#include <stdio.h>
#include <stdlib.h>
#include "security.h"
#include "comm.h"
#include "sspi.h"

Go to the source code of this file.

Defines

#define | BIG_BUFF 2048
#define | SECURITY_WIN32
#define | SMALL_BUFF 256
#define | SOCKET_BUFF_SIZE 65536

Functions

BOOL | CloseAuthSocket (SOCKET s)
BOOL | ConnectAuthSocket (SOCKET *s)
BOOL | DoAuthentication (SOCKET s)
void | main (int argc, char *argv[])
void | Usage (void)

Define Documentation

#define BIG_BUFF 2048

Definition at line 28 of file Client.cpp.

#define SECURITY_WIN32

Definition at line 24 of file Client.cpp.

#define SMALL_BUFF 256

Definition at line 29 of file Client.cpp.

#define SOCKET_BUFF_SIZE 65536

Definition at line 27 of file Client.cpp.

Function Documentation

BOOL CloseAuthSocket ( SOCKET s )

Definition at line 275 of file Client.cpp.

                    :

    Closes a socket and releases security resources associated with
   the socket

 Return Value:

    Returns TRUE is successful; otherwise FALSE is returned.

--*/
{
   TermSession (s);
   shutdown (s, 2);
   closesocket (s);
   return(TRUE);
}

BOOL ConnectAuthSocket ( SOCKET * s )

Definition at line 204 of file Client.cpp.

                    :

    Establishes an authenticated socket connection with a server and
   initializes any needed security package resources.

 Return Value:

    Returns TRUE is successful; otherwise FALSE is returned.

--*/
{
   SOCKET sockServer;
   unsigned long ulAddress;
   struct hostent *pHost;
   SOCKADDR_IN sin;
   DWORD dwRes;

   // lookup the address for the server name
   //
   ulAddress = inet_addr (g_szServer);
   if (INADDR_NONE == ulAddress) {
      pHost = gethostbyname (g_szServer);
      if (NULL == pHost) {
         dwRes = GetLastError ();
         fprintf (stderr, "Unable to resolve host name: %u\n", dwRes);
         return(FALSE);
      }

      memcpy((char FAR *)&ulAddress, pHost->h_addr, pHost->h_length);
   }

   // create the socket
   //
   sockServer = socket (PF_INET, SOCK_STREAM, 0);
   if (INVALID_SOCKET == sockServer) {
      fprintf (stderr, "Unable to create socket: %u\n", GetLastError ());
      return(FALSE);
   }

   sin.sin_family = AF_INET;
   sin.sin_addr.s_addr = ulAddress;
   sin.sin_port = htons (g_usPort);

   // connect to remote endpoint
   //
   if (connect (sockServer, (LPSOCKADDR) &sin, sizeof (sin))) {
      fprintf (stderr, "connect failed: %u\n", GetLastError ());
      closesocket (sockServer);
      return(FALSE);
   }

   // Make this an authenticated connection
   //
   if (!InitSession (sockServer)) {
      closesocket (sockServer);
      return(FALSE);
   }

   if (!DoAuthentication (sockServer)) {
      closesocket (sockServer);
      return(FALSE);
   }

   *s = sockServer;

   return(TRUE);
}

BOOL DoAuthentication ( SOCKET s )

Definition at line 295 of file Client.cpp.

                    :

    Manges the authentication conversation with the server via the
    supplied socket handle.

 Return Value:

    Returns TRUE is successful; otherwise FALSE is returned.

--*/
{
   BOOL done = FALSE;
   DWORD cbOut = 0;
   DWORD cbIn = 0;
   ULONG attrib = 0;
   PBYTE pOutBuf = NULL;

   if (g_fUseConfidentiality)
      attrib |= ISC_REQ_CONFIDENTIALITY;

   if (g_fUseIntegrity)
      attrib |= ISC_REQ_INTEGRITY;

   cbOut = 0;

   if (!GenClientContext (s, NULL, 0, &pOutBuf, &cbOut, &done, &attrib, g_pTarget))
      return(FALSE);

   if (!SendMsg (s, pOutBuf, cbOut))
      return(FALSE);

   // done with package allocated buffer - free it
   if(pOutBuf)
      FreeContextBuffer(pOutBuf);

   while (!done) {

      if (!ReceiveMsg (s, g_pInBuf, SOCKET_BUFF_SIZE, &cbIn))
         return(FALSE);

      cbOut = 0;
      pOutBuf = NULL;

      if (!GenClientContext (s, g_pInBuf, cbIn, &pOutBuf, &cbOut, &done, &attrib, g_pTarget))
         return(FALSE);

      if (!SendMsg (s, pOutBuf, cbOut))
         return(FALSE);

      // done with package allocated buffer - free it
      if(pOutBuf)
         FreeContextBuffer(pOutBuf);

   }

   if(g_fVerbose)
      printf("Context Attributes = 0x%08x\n", attrib);

   // check the context flags and make sure we got what we want
   //
   if (g_fUseConfidentiality && !(attrib & ISC_RET_CONFIDENTIALITY))
   {
      fprintf (stderr, "** confidentiality flags not set on context\n");
      //
      // the application can decide to either terminate the conversation or continue.
      // we are going to let the client make these decisions and continue
      //
      g_fUseConfidentiality = FALSE;
   }

   if (g_fUseIntegrity && !(attrib & ISC_REQ_INTEGRITY))
   {
      fprintf (stderr, " ** integrity flags not set on context\n");
      //
      // the application can decide to either terminate the conversation or continue.
      // we are going to let the client make these decisions and continue
      //
      g_fUseIntegrity = FALSE;
   }

   return(TRUE);
}

void main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 63 of file Client.cpp.

{

   SOCKET s;
   DWORD  cbRead;
   BYTE   Data[BIG_BUFF];
   PCHAR  pMessage;

   int    i;
   int    iOption;
   char   *pszOption;

   if(argc <= 1)
   {
      Usage();
      return;
   }

   // default package is negotiate
   //
   lstrcpy(g_szPackageName, "Negotiate");

   for(i = 1; i < argc; i++)
   {
      if(argv[i][0] == '/') argv[i][0] = '-';

      if(argv[i][0] != '-')
      {
         printf("**** Invalid argument \"%s\"\n", argv[i]);
         Usage();
         return;
      }
      iOption = argv[i][1];
      pszOption = &argv[i][2];

      switch(iOption)
      {
      case 'h':
         Usage();
         return;

      case 's':
       lstrcpyn(g_szServer, pszOption, SMALL_BUFF);
         break;

      case 't':
         lstrcpyn(g_szTarget, pszOption, SMALL_BUFF);
         g_pTarget = g_szTarget;
         break;

      case 'p':
       lstrcpyn(g_szPackageName, pszOption, SMALL_BUFF);
         break;

      case 'c':
         g_fUseConfidentiality = TRUE;
         break;

      case 'i':
         g_fUseIntegrity = TRUE;
         break;

      case 'v':
         g_fVerbose = TRUE;
         break;

      default:
         printf("**** Invalid option \"%S\"\n", argv[i]);
         Usage();
         return;

      }

   }

   if(!lstrcmp(g_szServer,""))
   {
      Usage();
      return;
   }

   // initialize
   //
   if (!InitWinsock ())
      exit (EXIT_FAILURE);

   if (!InitPackage (g_szPackageName, g_fVerbose))
      exit (EXIT_FAILURE);

   g_pInBuf = (PBYTE) malloc (SOCKET_BUFF_SIZE);

   if (NULL == g_pInBuf)
      exit (EXIT_FAILURE);

   // connect to server
   //
   if (!ConnectAuthSocket (&s))
   {
      exit (EXIT_FAILURE);
   }

   if (!ReceiveBytes (s, Data, BIG_BUFF, &cbRead) || (cbRead == 0))
   {
      printf("No response from server, authentication most likely failed\n");
   }
   else
   {
      printf ("Authentication Succeeded!\n");

      // display the results
      //
      if(g_fUseConfidentiality)
      {
         pMessage = (PCHAR) DecryptThis (s, Data, &cbRead);
      }
      else if(g_fUseIntegrity)
      {
         pMessage = (PCHAR) VerifyThis (s, Data, &cbRead);
      }
      else
         pMessage = (PCHAR) Data;

      printf ("Connected to server as user: %.*s", cbRead, pMessage);
   }

   printf ("\n");

   // terminate
   //
   CloseAuthSocket (s);

   TermPackage ();

   TermWinsock ();

   if(g_pInBuf)
      free (g_pInBuf);

   exit (EXIT_SUCCESS);
}

void Usage ( void )

Definition at line 46 of file Client.cpp.

{

   printf ("usage: client -s<server> [ <options> ]\n");
   printf ("\n");
   printf ("    -h              show usage\n");
   printf ("    -s<server>      name of server. (required)\n");
   printf ("    -t<targetname>  SPN or security context of server account (req. for Negotiate/Kerb).\n");
   printf ("    -p<package>     name of security package.\n");
   printf ("    -c              message confidentiality (encryption).\n");
   printf ("    -i              message integrity (signing).\n");
   printf ("    -v              verbose mode.\n");
   printf ("\n");
   printf ("  example: client -swinbase -pnegotiate -c\n");

}

Generated on Wed Nov 13 2024 16:53:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/SSPI/SockAuth/Collect.cpp File Reference

  • Security
  • SSPI
  • SockAuth
Classes | Typedefs | Functions

Collect.cpp File Reference

#include <windows.h>
#include <stdlib.h>
#include "collect.h"

Go to the source code of this file.

Classes

struct | _node_tag

Typedefs

typedef struct _node_tag | NODE
typedef struct _node_tag * | PNODE

Functions

BOOL | AddEntry (DWORD dwKey, PVOID pData)
BOOL | DeleteEntry (DWORD dwKey, PVOID *ppData)
BOOL | GetEntry (DWORD dwKey, PVOID *ppData)

Typedef Documentation

typedef struct _node_tag NODE
typedef struct _node_tag * PNODE

Function Documentation

BOOL AddEntry | ( | DWORD | dwKey,
 |  | PVOID | pData
 | ) |  |

Definition at line 46 of file Collect.cpp.

{
  PNODE pTemp;

  pTemp = (PNODE) malloc (sizeof (NODE));
  if (NULL == pTemp)  {
    return(FALSE);
  }

  pTemp->dwKey = dwKey;
  pTemp->pData = (PVOID *) pData;
  pTemp->pNext = Head.pNext;
  Head.pNext = pTemp;

  return(TRUE);
}

BOOL DeleteEntry | ( | DWORD | dwKey,
 |  | PVOID * | ppData
 | ) |  |

Definition at line 63 of file Collect.cpp.

{
  PNODE pCurrent, pTemp;

  pTemp = &Head;
  pCurrent = Head.pNext;

  while (NULL != pCurrent) {
    if (dwKey == pCurrent->dwKey)  {
      pTemp->pNext = pCurrent->pNext;
      *ppData = pCurrent->pData;
      free (pCurrent);
      return(TRUE);
    }
    else {
      pTemp = pCurrent;
      pCurrent = pCurrent->pNext;
    }
  }

  return(FALSE);
}

BOOL GetEntry | ( | DWORD | dwKey,
 |  | PVOID * | ppData
 | ) |  |

Definition at line 30 of file Collect.cpp.

{
  PNODE pCurrent;

  pCurrent = Head.pNext;
  while (NULL != pCurrent) {
    if (dwKey == pCurrent->dwKey)  {
      *ppData = pCurrent->pData;
      return(TRUE);
    }
    pCurrent = pCurrent->pNext;
  }

  return(FALSE);
}

Generated on Wed Nov 13 2024 16:54:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/SSPI/SockAuth/Collect.h File Reference

  • Security
  • SSPI
  • SockAuth
Functions

Collect.h File Reference

Go to the source code of this file.

Functions

BOOL | AddEntry (DWORD dwKey, PVOID pData)
BOOL | DeleteEntry (DWORD dwKey, PVOID *ppData)
BOOL | GetEntry (DWORD dwKey, PVOID *ppData)

Function Documentation

BOOL AddEntry | ( | DWORD | dwKey,
 |  | PVOID | pData
 | ) |  |

Definition at line 46 of file Collect.cpp.

{
  PNODE pTemp;

  pTemp = (PNODE) malloc (sizeof (NODE));
  if (NULL == pTemp)  {
    return(FALSE);
  }

  pTemp->dwKey = dwKey;
  pTemp->pData = (PVOID *) pData;
  pTemp->pNext = Head.pNext;
  Head.pNext = pTemp;

  return(TRUE);
}

BOOL DeleteEntry | ( | DWORD | dwKey,
 |  | PVOID * | ppData
 | ) |  |

Definition at line 63 of file Collect.cpp.

{
  PNODE pCurrent, pTemp;

  pTemp = &Head;
  pCurrent = Head.pNext;

  while (NULL != pCurrent) {
    if (dwKey == pCurrent->dwKey)  {
      pTemp->pNext = pCurrent->pNext;
      *ppData = pCurrent->pData;
      free (pCurrent);
      return(TRUE);
    }
    else {
      pTemp = pCurrent;
      pCurrent = pCurrent->pNext;
    }
  }

  return(FALSE);
}

BOOL GetEntry | ( | DWORD | dwKey,
 |  | PVOID * | ppData
 | ) |  |

Definition at line 30 of file Collect.cpp.

{
  PNODE pCurrent;

  pCurrent = Head.pNext;
  while (NULL != pCurrent) {
    if (dwKey == pCurrent->dwKey)  {
      *ppData = pCurrent->pData;
      return(TRUE);
    }
    pCurrent = pCurrent->pNext;
  }

  return(FALSE);
}

Generated on Wed Nov 13 2024 16:54:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/SSPI/SockAuth/Comm.cpp File Reference

  • Security
  • SSPI
  • SockAuth
Functions

Comm.cpp File Reference

#include <windows.h>
#include <winsock.h>
#include <stdio.h>
#include <stdlib.h>
#include "comm.h"

Go to the source code of this file.

Functions

BOOL InitWinsock ()
BOOL | ReceiveBytes (SOCKET s, PBYTE pBuf, DWORD cbBuf, DWORD *pcbRead)
BOOL | ReceiveMsg (SOCKET s, PBYTE pBuf, DWORD cbBuf, DWORD *pcbRead)
BOOL | SendBytes (SOCKET s, PBYTE pBuf, DWORD cbBuf)
BOOL | SendMsg (SOCKET s, PBYTE pBuf, DWORD cbBuf)
BOOL TermWinsock ()

Function Documentation

BOOL InitWinsock ( )

Definition at line 23 of file Comm.cpp.

{
  int nRes;
  WSADATA wsaData;
  WORD wVerRequested = 0x0101; // ver 1.1

  // Init the sockets interface
  nRes = WSAStartup (wVerRequested, &wsaData);
  if (nRes)  {
    fprintf (stderr, "Couldn't init winsock: %d\n", nRes);
    return(FALSE);
  }

  return(TRUE);
}

BOOL ReceiveBytes | ( | SOCKET | s,
 |  | PBYTE | pBuf,
 |  | DWORD | cbBuf,
 |  | DWORD * | pcbRead
 | ) |  |

Definition at line 138 of file Comm.cpp.

{
  PBYTE pTemp = pBuf;
  int cbRead, cbRemaining = cbBuf;

  while (cbRemaining) {
    cbRead = recv (s, (char *)pTemp, cbRemaining, 0);
    if (0 == cbRead)
      break;

    if (SOCKET_ERROR == cbRead) {
      fprintf (stderr, "recv failed: %u\n", GetLastError ());
      return FALSE;
    }

    cbRemaining -= cbRead;
    pTemp += cbRead;
  }

  *pcbRead = cbBuf - cbRemaining;

  return TRUE;
}

BOOL ReceiveMsg | ( | SOCKET | s,
 |  | PBYTE | pBuf,
 |  | DWORD | cbBuf,
 |  | DWORD * | pcbRead
 | ) |  |

Definition at line 77 of file Comm.cpp.

                    :

    Receives a message over the socket.  The first DWORD in the message
  will be the message size.  The remainder of the bytes will be the
  actual message.

 Return Value:

    Returns TRUE is successful; otherwise FALSE is returned.

--*/
{
  DWORD cbRead;
  DWORD cbData;

  // find out how much data is in the message
  //
  if (!ReceiveBytes (s, (PBYTE)&cbData, sizeof (cbData), &cbRead))
    return(FALSE);

  if (sizeof (cbData) != cbRead)
    return(FALSE);

  // Read the full message
  //
  if (!ReceiveBytes (s, pBuf, cbData, &cbRead))
    return(FALSE);

  if (cbRead != cbData)
    return(FALSE);

  *pcbRead = cbRead;

  return(TRUE);
}

BOOL SendBytes | ( | SOCKET | s,
 |  | PBYTE | pBuf,
 |  | DWORD | cbBuf
 | ) |  |

Definition at line 116 of file Comm.cpp.

{
  PBYTE pTemp = pBuf;
  int cbSent, cbRemaining = cbBuf;

  if (0 == cbBuf)
    return(TRUE);

  while (cbRemaining) {
    cbSent = send (s, (const char *)pTemp, cbRemaining, 0);
    if (SOCKET_ERROR == cbSent) {
      fprintf (stderr, "send failed: %u\n", GetLastError ());
      return FALSE;
    }

    pTemp += cbSent;
    cbRemaining -= cbSent;
  }

  return TRUE;
}

BOOL SendMsg | ( | SOCKET | s,
 |  | PBYTE | pBuf,
 |  | DWORD | cbBuf
 | ) |  |

Definition at line 47 of file Comm.cpp.

                    :

    Sends a message over the socket by first sending a DWORD that
  represents the size of the message followed by the message itself.

 Return Value:

    Returns TRUE is successful; otherwise FALSE is returned.

--*/
{
  if (0 == cbBuf)
    return(TRUE);

  // send the size of the message
  //
  if (!SendBytes (s, (PBYTE)&cbBuf, sizeof (cbBuf)))
    return(FALSE);

  // send the body of the message
  //
  if (!SendBytes (s, pBuf, cbBuf))
    return(FALSE);

  return(TRUE);
}

BOOL TermWinsock ( )

Definition at line 39 of file Comm.cpp.

{
  if (SOCKET_ERROR == WSACleanup ())
    return(FALSE);
  else
    return(TRUE);
}

Generated on Wed Nov 13 2024 16:54:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/SSPI/SockAuth/Comm.h File Reference

  • Security
  • SSPI
  • SockAuth
Functions

Comm.h File Reference

Go to the source code of this file.

Functions

BOOL InitWinsock ()
BOOL | ReceiveBytes (SOCKET s, PBYTE pBuf, DWORD cbBuf, DWORD *pcbRead)
BOOL | ReceiveMsg (SOCKET s, PBYTE pBuf, DWORD cbBuf, DWORD *pcbRead)
BOOL | SendBytes (SOCKET s, PBYTE pBuf, DWORD cbBuf)
BOOL | SendMsg (SOCKET s, PBYTE pBuf, DWORD cbBuf)
BOOL TermWinsock ()

Function Documentation

BOOL InitWinsock ( )

Definition at line 23 of file Comm.cpp.

{
  int nRes;
  WSADATA wsaData;
  WORD wVerRequested = 0x0101; // ver 1.1

  // Init the sockets interface
  nRes = WSAStartup (wVerRequested, &wsaData);
  if (nRes)  {
    fprintf (stderr, "Couldn't init winsock: %d\n", nRes);
    return(FALSE);
  }

  return(TRUE);
}

BOOL ReceiveBytes | ( | SOCKET | s,
 |  | PBYTE | pBuf,
 |  | DWORD | cbBuf,
 |  | DWORD * | pcbRead
 | ) |  |

Definition at line 138 of file Comm.cpp.

{
  PBYTE pTemp = pBuf;
  int cbRead, cbRemaining = cbBuf;

  while (cbRemaining) {
    cbRead = recv (s, (char *)pTemp, cbRemaining, 0);
    if (0 == cbRead)
      break;

    if (SOCKET_ERROR == cbRead) {
      fprintf (stderr, "recv failed: %u\n", GetLastError ());
      return FALSE;
    }

    cbRemaining -= cbRead;
    pTemp += cbRead;
  }

  *pcbRead = cbBuf - cbRemaining;

  return TRUE;
}

BOOL ReceiveMsg | ( | SOCKET | s,
 |  | PBYTE | pBuf,
 |  | DWORD | cbBuf,
 |  | DWORD * | pcbRead
 | ) |  |

Definition at line 77 of file Comm.cpp.

                    :

    Receives a message over the socket.  The first DWORD in the message
  will be the message size.  The remainder of the bytes will be the
  actual message.

 Return Value:

    Returns TRUE is successful; otherwise FALSE is returned.

--*/
{
  DWORD cbRead;
  DWORD cbData;

  // find out how much data is in the message
  //
  if (!ReceiveBytes (s, (PBYTE)&cbData, sizeof (cbData), &cbRead))
    return(FALSE);

  if (sizeof (cbData) != cbRead)
    return(FALSE);

  // Read the full message
  //
  if (!ReceiveBytes (s, pBuf, cbData, &cbRead))
    return(FALSE);

  if (cbRead != cbData)
    return(FALSE);

  *pcbRead = cbRead;

  return(TRUE);
}

BOOL SendBytes | ( | SOCKET | s,
 |  | PBYTE | pBuf,
 |  | DWORD | cbBuf
 | ) |  |

Definition at line 116 of file Comm.cpp.

{
  PBYTE pTemp = pBuf;
  int cbSent, cbRemaining = cbBuf;

  if (0 == cbBuf)
    return(TRUE);

  while (cbRemaining) {
    cbSent = send (s, (const char *)pTemp, cbRemaining, 0);
    if (SOCKET_ERROR == cbSent) {
      fprintf (stderr, "send failed: %u\n", GetLastError ());
      return FALSE;
    }

    pTemp += cbSent;
    cbRemaining -= cbSent;
  }

  return TRUE;
}

BOOL SendMsg | ( | SOCKET | s,
 |  | PBYTE | pBuf,
 |  | DWORD | cbBuf
 | ) |  |

Definition at line 47 of file Comm.cpp.

                    :

    Sends a message over the socket by first sending a DWORD that
  represents the size of the message followed by the message itself.

 Return Value:

    Returns TRUE is successful; otherwise FALSE is returned.

--*/
{
  if (0 == cbBuf)
    return(TRUE);

  // send the size of the message
  //
  if (!SendBytes (s, (PBYTE)&cbBuf, sizeof (cbBuf)))
    return(FALSE);

  // send the body of the message
  //
  if (!SendBytes (s, pBuf, cbBuf))
    return(FALSE);

  return(TRUE);
}

BOOL TermWinsock ( )

Definition at line 39 of file Comm.cpp.

{
  if (SOCKET_ERROR == WSACleanup ())
    return(FALSE);
  else
    return(TRUE);
}

Generated on Wed Nov 13 2024 16:54:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/SSPI/SockAuth/Security.cpp File Reference

  • Security
  • SSPI
  • SockAuth
Classes | Defines | Typedefs | Functions

Security.cpp File Reference

#include <windows.h>
#include <winsock.h>
#include <stdio.h>
#include <stdlib.h>
#include "sspi.h"
#include "security.h"
#include "collect.h"

Go to the source code of this file.

Classes

struct | _AUTH_SEQ

Defines

#define | NT_DLL_NAME "secur32.dll"
#define | SEC_SUCCESS(Status) ((Status) >= 0)
#define | SECURITY_WIN32
#define | TOKEN_SOURCE_NAME "AuthSamp"

Typedefs

typedef struct _AUTH_SEQ | AUTH_SEQ
typedef struct _AUTH_SEQ * | PAUTH_SEQ

Functions

PBYTE | DecryptThis (DWORD dwKey, PBYTE pBuffer, LPDWORD pcbMessage)
BOOL | EncryptThis (DWORD dwKey, PBYTE pMessage, ULONG cbMessage, BYTE **ppOutput, ULONG *pcbOutput)
BOOL | GenClientContext (DWORD dwKey, BYTE *pIn, DWORD cbIn, BYTE **pOut, DWORD *pcbOut, BOOL *pfDone, ULONG *pAttribs, CHAR *pszTarget)
BOOL | GenServerContext (DWORD dwKey, BYTE *pIn, DWORD cbIn, BYTE **pOut, DWORD *pcbOut, BOOL *pfDone, ULONG *pAttribs)
BOOL | ImpersonateContext (DWORD dwKey)
BOOL | InitPackage (TCHAR *lpPackageName, BOOL fVerbose)
BOOL | InitSession (DWORD dwKey)
void | PrintHexDump (DWORD length, PBYTE buffer)
BOOL | RevertContext (DWORD dwKey)
BOOL | SignThis (DWORD dwKey, PBYTE pMessage, ULONG cbMessage, BYTE **ppOutput, LPDWORD pcbOutput)
BOOL TermPackage ()
BOOL | TermSession (DWORD dwKey)
PBYTE | VerifyThis (DWORD dwKey, PBYTE pBuffer, LPDWORD pcbMessage)

Define Documentation

#define NT_DLL_NAME "secur32.dll"

Definition at line 45 of file Security.cpp.

#define SEC_SUCCESS ( Status ) ((Status) >= 0)

Definition at line 43 of file Security.cpp.

#define SECURITY_WIN32

Definition at line 21 of file Security.cpp.

#define TOKEN_SOURCE_NAME "AuthSamp"

Definition at line 49 of file Security.cpp.

Typedef Documentation

typedef struct _AUTH_SEQ AUTH_SEQ
typedef struct _AUTH_SEQ * PAUTH_SEQ

Function Documentation

PBYTE DecryptThis | ( | DWORD | dwKey,
 |  | PBYTE | pBuffer,
 |  | LPDWORD | pcbMessage
 | ) |  |

Definition at line 652 of file Security.cpp.

                    :

    Decrypts a message

 Return Value:

    Returns TRUE is successful; otherwise FALSE is returned.

--*/
{
   SECURITY_STATUS   ss;
   PAUTH_SEQ         pAS;
   SecBufferDesc     BuffDesc;
   SecBuffer         SecBuff[2];
   ULONG             ulQop = 0;
   PBYTE             pSigBuffer;
   PBYTE             pDataBuffer;
   DWORD             SigBufferSize;

   // Lookup pAS based on Key
   //
   if (!GetEntry (dwKey, (PVOID*) &pAS))
      return(FALSE);

   // When the server encrypted the message it set the size
   // of the trailer block to be just what it needed. We have to
   // tell DecryptMessage how big the trailer block turned out to be,
   // so we sent the size of the trailer as the first dword of the
   // message.
   //
   SigBufferSize = *((DWORD *) pBuffer);

   if(g_fVerbose)
   {
      printf ("data before decryption including trailer (%lu bytes):\n", *pcbMessage);
      PrintHexDump (*pcbMessage, (PBYTE) pBuffer);
   }

   // we know the trailer is at the beginning of the blob
   // but after the trailer size dword
   //
   pSigBuffer = pBuffer + sizeof(DWORD);

   // and that the data is after the trailer
   //
   pDataBuffer = pSigBuffer + SigBufferSize;

   // reset the size of the data to reflect just the encrypted blob
   //
   *pcbMessage = *pcbMessage - SigBufferSize - sizeof(DWORD);

   // prepare buffer
   //
   BuffDesc.ulVersion = 0;
   BuffDesc.cBuffers = 2;
   BuffDesc.pBuffers = SecBuff;

   SecBuff[0].cbBuffer = SigBufferSize;
   SecBuff[0].BufferType = SECBUFFER_TOKEN;
   SecBuff[0].pvBuffer = pSigBuffer;

   SecBuff[1].cbBuffer = *pcbMessage;
   SecBuff[1].BufferType = SECBUFFER_DATA;
   SecBuff[1].pvBuffer = pDataBuffer;

   ss = DecryptMessage(
      &pAS->_hctxt,
      &BuffDesc,
      0,
      &ulQop
      );

   if (!SEC_SUCCESS(ss)) {
      fprintf (stderr, "DecryptMessage failed: 0x%08x\n", ss);
      return(FALSE);
   }

   // only return a pointer to the data which we decrypted -
   // discard the trailer data
   return pDataBuffer;

}

BOOL EncryptThis | ( | DWORD | dwKey,
 |  | PBYTE | pMessage,
 |  | ULONG | cbMessage,
 |  | BYTE ** | ppOutput,
 |  | ULONG * | pcbOutput
 | ) |  |

Definition at line 555 of file Security.cpp.

                    :

    Encrypts a message

 Return Value:

    Returns TRUE is successful; otherwise FALSE is returned.

--*/
{
   SECURITY_STATUS   ss;
   PAUTH_SEQ         pAS;
   SecBufferDesc     BuffDesc;
   SecBuffer         SecBuff[2];
   ULONG             ulQop = 0;
   ULONG             SigBufferSize;

   // Lookup pAS based on Key
   //
   if (!GetEntry (dwKey, (PVOID*) &pAS))
      return(FALSE);

   // the size of the trailer (signature + padding) block is
   // determined from this value
   //
   SigBufferSize = pAS->cbSecurityTrailer;

   if(g_fVerbose)
      printf ("data before encryption: %s\n", pMessage);

   // allocate a buffer big enough to hold the
   // signature + encrypted data + a dword that
   // will tell the other side how big the trailer block is
   //
   * ppOutput = (PBYTE) malloc (SigBufferSize + cbMessage + sizeof(DWORD));

   // prepare buffers
   //
   BuffDesc.ulVersion = 0;
   BuffDesc.cBuffers = 2;
   BuffDesc.pBuffers = SecBuff;

   SecBuff[0].cbBuffer = SigBufferSize;
   SecBuff[0].BufferType = SECBUFFER_TOKEN;
   SecBuff[0].pvBuffer = *ppOutput + sizeof(DWORD);

   SecBuff[1].cbBuffer = cbMessage;
   SecBuff[1].BufferType = SECBUFFER_DATA;
   SecBuff[1].pvBuffer = pMessage;

   ss = EncryptMessage(
      &pAS->_hctxt,
      ulQop,
      &BuffDesc,
      0
      );

   if (!SEC_SUCCESS(ss)) {
      fprintf (stderr, "EncryptMessage failed: 0x%08x\n", ss);
      return(FALSE);
   }

   // indicate in the first DWORD of our output buffer how big
   // the trailer block is
   //
   *((DWORD *) *ppOutput) = SecBuff[0].cbBuffer;

   // Here we append the encrypted data to our trailer block
   // to form a single block. And yes, it's confusing that we put the trailer
   // in the beginning of our data to send to the client, but it worked out
   // better that way.
   //
   memcpy (*ppOutput+SecBuff[0].cbBuffer+sizeof(DWORD), pMessage, cbMessage);

   *pcbOutput = cbMessage + SecBuff[0].cbBuffer + sizeof(DWORD);

   if(g_fVerbose)
   {
      printf ("data after encryption including trailer (%lu bytes):\n", *pcbOutput);
      PrintHexDump (*pcbOutput, *ppOutput);
   }

   return TRUE;

}

BOOL GenClientContext | ( | DWORD | dwKey,
 |  | BYTE * | pIn,
 |  | DWORD | cbIn,
 |  | BYTE ** | pOut,
 |  | DWORD * | pcbOut,
 |  | BOOL * | pfDone,
 |  | ULONG * | pAttribs,
 |  | CHAR * | pszTarget
 | ) |  |

Definition at line 95 of file Security.cpp.

                    :

    Optionally takes an input buffer coming from the server and returns
   a buffer of information to send back to the server.  Also returns
   an indication of whether or not the context is complete.

 Return Value:

    Returns TRUE is successful; otherwise FALSE is returned.

--*/
{
   SECURITY_STATUS   ss;
   TimeStamp         Lifetime;
   SecBufferDesc     OutBuffDesc;
   SecBuffer         OutSecBuff;
   SecBufferDesc     InBuffDesc;
   SecBuffer         InSecBuff;
   ULONG             ContextAttributes;
   PAUTH_SEQ         pAS;
   SecPkgContext_Sizes SecPkgContextSizes;
   SecPkgContext_NegotiationInfo SecPkgNegInfo;
   SecPkgContext_Flags SecPkgFlags;

   // Lookup pAS based on Key
   //
   if (!GetEntry (dwKey, (PVOID*) &pAS))
      return(FALSE);

   if (pAS->_fNewConversation)  {
      ss = AcquireCredentialsHandle (
               NULL, // principal
               g_lpPackageName,
               SECPKG_CRED_OUTBOUND,
               NULL, // LOGON id
               NULL, // auth data
               NULL, // get key fn
               NULL, // get key arg
               &pAS->_hcred,
               &Lifetime
               );
      if (SEC_SUCCESS (ss))
         pAS->_fHaveCredHandle = TRUE;
      else {
         fprintf (stderr, "AcquireCreds failed: 0x%08x\n", ss);
         return(FALSE);
      }
   }

   // prepare output buffer
   //
   OutBuffDesc.ulVersion = 0;
   OutBuffDesc.cBuffers = 1;
   OutBuffDesc.pBuffers = &OutSecBuff;

   OutSecBuff.cbBuffer = 0;
   OutSecBuff.BufferType = SECBUFFER_TOKEN;
   OutSecBuff.pvBuffer = NULL;

   // prepare input buffer
   //
   if (!pAS->_fNewConversation)  {
      InBuffDesc.ulVersion = 0;
      InBuffDesc.cBuffers = 1;
      InBuffDesc.pBuffers = &InSecBuff;

      InSecBuff.cbBuffer = cbIn;
      InSecBuff.BufferType = SECBUFFER_TOKEN;
      InSecBuff.pvBuffer = pIn;

      if(g_fVerbose)
      {
         printf ("token buffer recieved(%lu bytes):\n", InSecBuff.cbBuffer);
         PrintHexDump (InSecBuff.cbBuffer, (PBYTE)InSecBuff.pvBuffer);
      }

   }

   // Always have the package allocate the memory
   *pAttribs |= ISC_REQ_ALLOCATE_MEMORY;

   ss = InitializeSecurityContext (
            &pAS->_hcred,
            pAS->_fNewConversation ? NULL : &pAS->_hctxt,
            pszTarget,
            *pAttribs,
            0, // reserved1
            SECURITY_NATIVE_DREP,
            pAS->_fNewConversation ? NULL : &InBuffDesc,
            0, // reserved2
            &pAS->_hctxt,
            &OutBuffDesc,
            &ContextAttributes,
            &Lifetime
            );

   if (!SEC_SUCCESS (ss))  {
      fprintf (stderr, "InitializeSecurityContext failed: 0x%08x\n", ss);
      return FALSE;
   }

   pAS->_fHaveCtxtHandle = TRUE;

   // Complete token -- if applicable
   //
   if ((SEC_I_COMPLETE_NEEDED == ss) || (SEC_I_COMPLETE_AND_CONTINUE == ss))  {
      ss = CompleteAuthToken (&pAS->_hctxt, &OutBuffDesc);
      if (!SEC_SUCCESS(ss))  {
         fprintf (stderr, "complete failed: 0x%08x\n", ss);
         return FALSE;
      }
   }

   *pcbOut = OutSecBuff.cbBuffer;
   *pOut = (PBYTE)OutSecBuff.pvBuffer;

   if (pAS->_fNewConversation)
      pAS->_fNewConversation = FALSE;

   *pfDone = !((SEC_I_CONTINUE_NEEDED == ss) ||
            (SEC_I_COMPLETE_AND_CONTINUE == ss));

   if(g_fVerbose)
   {
      printf ("token buffer generated (%lu bytes):\n", OutSecBuff.cbBuffer);
      PrintHexDump (OutSecBuff.cbBuffer, (PBYTE)OutSecBuff.pvBuffer);
   }

   if(*pfDone) {

      // find size of signature block
      //
      ss = QueryContextAttributes(
               &pAS->_hctxt,
               SECPKG_ATTR_SIZES,
               &SecPkgContextSizes );

      if (!SEC_SUCCESS(ss))  {
         fprintf (stderr, "QueryContextAttributes failed: 0x%08x\n", ss);
         printf("here");
         return FALSE;
      }

      // these values are used for encryption and signing
      //
      pAS->cbMaxSignature = SecPkgContextSizes.cbMaxSignature;
      pAS->cbSecurityTrailer = SecPkgContextSizes.cbSecurityTrailer;

      // return the attributes we ended up with
      //
      *pAttribs = ContextAttributes;

      // find out what package was negotiated
      //
      ss = QueryContextAttributes(
           &pAS->_hctxt,
           SECPKG_ATTR_NEGOTIATION_INFO,
           &SecPkgNegInfo );

      if (!SEC_SUCCESS(ss))
      {
         fprintf (stderr, "QueryContextAttributes failed: 0x%08x\n", ss);
         return FALSE;
      }
      else
      {
         printf("Package Name: %s\n", SecPkgNegInfo.PackageInfo->Name);
         // free up the allocated buffer
         //
         FreeContextBuffer(SecPkgNegInfo.PackageInfo);

      }

      // find out what flags are really used
      //
      ss = QueryContextAttributes(
           &pAS->_hctxt,
           SECPKG_ATTR_FLAGS,
           &SecPkgFlags );

      if (!SEC_SUCCESS(ss))
      {
         fprintf (stderr, "QueryContextAttributes failed: 0x%08x\n", ss);
         return FALSE;
      }
      else
      {
         printf("FLags: %x\n", SecPkgFlags.Flags);

      }

   }

   if(g_fVerbose)
      printf("InitializeSecurityContext result = 0x%08x\n", ss);

   return TRUE;
}

BOOL GenServerContext | ( | DWORD | dwKey,
 |  | BYTE * | pIn,
 |  | DWORD | cbIn,
 |  | BYTE ** | pOut,
 |  | DWORD * | pcbOut,
 |  | BOOL * | pfDone,
 |  | ULONG * | pAttribs
 | ) |  |

Definition at line 307 of file Security.cpp.

                    :

    Takes an input buffer coming from the client and returns a buffer
   to be sent to the client.  Also returns an indication of whether or
   not the context is complete.

 Return Value:

    Returns TRUE is successful; otherwise FALSE is returned.

--*/
{
   SECURITY_STATUS   ss;
   TimeStamp         Lifetime;
   SecBufferDesc     OutBuffDesc;
   SecBuffer         OutSecBuff;
   SecBufferDesc     InBuffDesc;
   SecBuffer         InSecBuff;
   ULONG             ContextAttributes;
   PAUTH_SEQ         pAS;
   SecPkgContext_Sizes SecPkgContextSizes;
   SecPkgContext_NegotiationInfo SecPkgNegInfo;

   // Lookup pAS based on Key
   //
   if (!GetEntry (dwKey, (PVOID*) &pAS))
      return(FALSE);

   if (pAS->_fNewConversation)  {
      ss = AcquireCredentialsHandle (
               NULL, // principal
               g_lpPackageName,
               SECPKG_CRED_INBOUND,
               NULL, // LOGON id
               NULL, // auth data
               NULL, // get key fn
               NULL, // get key arg
               &pAS->_hcred,
               &Lifetime
               );
      if (SEC_SUCCESS (ss))
         pAS->_fHaveCredHandle = TRUE;
      else {
         fprintf (stderr, "AcquireCreds failed: 0x%08x\n", ss);
         return(FALSE);
      }
   }

   // prepare output buffer
   //
   OutBuffDesc.ulVersion = 0;
   OutBuffDesc.cBuffers = 1;
   OutBuffDesc.pBuffers = &OutSecBuff;

   OutSecBuff.cbBuffer = 0;
   OutSecBuff.BufferType = SECBUFFER_TOKEN;
   OutSecBuff.pvBuffer = NULL;

   // prepare input buffer
   //
   InBuffDesc.ulVersion = 0;
   InBuffDesc.cBuffers = 1;
   InBuffDesc.pBuffers = &InSecBuff;

   InSecBuff.cbBuffer = cbIn;
   InSecBuff.BufferType = SECBUFFER_TOKEN;
   InSecBuff.pvBuffer = pIn;

   if(g_fVerbose)
   {
      printf ("token buffer recieved (%lu bytes):\n", InSecBuff.cbBuffer);
      PrintHexDump (InSecBuff.cbBuffer, (PBYTE)InSecBuff.pvBuffer);
   }

   // Always have the package allocate the memory
   *pAttribs |= ISC_REQ_ALLOCATE_MEMORY;

   ss = AcceptSecurityContext (
            &pAS->_hcred,
            pAS->_fNewConversation ? NULL : &pAS->_hctxt,
            &InBuffDesc,
            *pAttribs, // context requirements
            SECURITY_NATIVE_DREP,
            &pAS->_hctxt,
            &OutBuffDesc,
            &ContextAttributes,
            &Lifetime
            );
   if (!SEC_SUCCESS (ss))  {
      fprintf (stderr, "AcceptSecurityContext failed: 0x%08x\n", ss);
      return FALSE;
   }

   pAS->_fHaveCtxtHandle = TRUE;

   // Complete token -- if applicable
   //
   if ((SEC_I_COMPLETE_NEEDED == ss) || (SEC_I_COMPLETE_AND_CONTINUE == ss))  {
      ss = CompleteAuthToken (&pAS->_hctxt, &OutBuffDesc);
      if (!SEC_SUCCESS(ss))  {
         fprintf (stderr, "complete failed: 0x%08x\n", ss);
         return FALSE;
      }
   }

   *pcbOut = OutSecBuff.cbBuffer;
   *pOut = (PBYTE)OutSecBuff.pvBuffer;

   if (pAS->_fNewConversation)
      pAS->_fNewConversation = FALSE;

   if(g_fVerbose)
   {
      printf ("token buffer generated (%lu bytes):\n", OutSecBuff.cbBuffer);
      PrintHexDump (OutSecBuff.cbBuffer, (PBYTE)OutSecBuff.pvBuffer);
   }

   *pfDone = !((SEC_I_CONTINUE_NEEDED == ss) ||
            (SEC_I_COMPLETE_AND_CONTINUE == ss));

   // find size of token
   //
   if(*pfDone) {

      // find size of signature and trailer blocks
      //
      ss = QueryContextAttributes(
               &pAS->_hctxt,
               SECPKG_ATTR_SIZES,
               &SecPkgContextSizes );

      if (!SEC_SUCCESS(ss))  {
         fprintf (stderr, "QueryContextAttributes failed: 0x%08x\n", ss);
         return FALSE;
      }

      // these values are used for encryption and signing
      //
      pAS->cbMaxSignature = SecPkgContextSizes.cbMaxSignature;
      pAS->cbSecurityTrailer = SecPkgContextSizes.cbSecurityTrailer;

      // return the attributes we ended up with
      //
      *pAttribs = ContextAttributes;

            // find out what package was negotiated
      //
      ss = QueryContextAttributes(
           &pAS->_hctxt,
           SECPKG_ATTR_NEGOTIATION_INFO,
           &SecPkgNegInfo );

      if (!SEC_SUCCESS(ss))
      {
         fprintf (stderr, "QueryContextAttributes failed: 0x%08x\n", ss);
         return FALSE;
      }
      else
      {
         printf("Package Name: %s\n", SecPkgNegInfo.PackageInfo->Name);

         // free up the allocated buffer
         //
         FreeContextBuffer(SecPkgNegInfo.PackageInfo);
      }

   }

   if(g_fVerbose)
      printf("AcceptSecurityContext result = 0x%08x\n", ss);

   return TRUE;
}

BOOL ImpersonateContext ( DWORD dwKey )

Definition at line 494 of file Security.cpp.

                    :

    Impersonates the client whose context is associated with the
   supplied key.

 Return Value:

    Returns TRUE is successful; otherwise FALSE is returned.

--*/
{
   SECURITY_STATUS   ss;
   PAUTH_SEQ         pAS;

   // Lookup pAS based on Key
   //
   if (!GetEntry (dwKey, (PVOID*) &pAS))
      return(FALSE);

   ss = ImpersonateSecurityContext (&pAS->_hctxt);
   if (!SEC_SUCCESS(ss)) {
      fprintf (stderr, "Impersonate failed: 0x%08x\n", ss);
      return(FALSE);
   }

   return(TRUE);
}

BOOL InitPackage | ( | TCHAR * | lpPackageName,
 |  | BOOL | fVerbose
 | ) |  |

Definition at line 52 of file Security.cpp.

                    :

    Finds, loads and initializes the security package

 Return Value:

    Returns TRUE is successful; otherwise FALSE is returned.

--*/
{
   SECURITY_STATUS ss;
   PSecPkgInfo pkgInfo;

   // Query for the package we're interested in
   //
   ss = QuerySecurityPackageInfo (lpPackageName, &pkgInfo);

   if (!SEC_SUCCESS(ss)) {
      fprintf (stderr, "Couldn't query package info for %s, error 0x%08x\n",
               lpPackageName, ss);
      return(FALSE);
   }

   lstrcpy (g_lpPackageName, lpPackageName);

   FreeContextBuffer (pkgInfo);

   g_fVerbose = fVerbose;

   printf ("Using package: %s\n", g_lpPackageName);

   return TRUE;
}

BOOL InitSession ( DWORD dwKey )

Definition at line 916 of file Security.cpp.

                    :

    Initializes the context associated with a key and adds it to the
   collection.

 Return Value:

    Returns TRUE is successful; otherwise FALSE is returned.

--*/
{
   PAUTH_SEQ pAS;

   pAS = (PAUTH_SEQ) malloc (sizeof (AUTH_SEQ));
   if (NULL == pAS)
      return(FALSE);

   pAS->_fNewConversation = TRUE;
   pAS->_fHaveCredHandle = FALSE;
   pAS->_fHaveCtxtHandle = FALSE;

   if (!AddEntry (dwKey, (PVOID)pAS))  {
      free (pAS);
      return(FALSE);
   }

   return(TRUE);
}

static void PrintHexDump | ( | DWORD | length,
 |  | PBYTE | buffer
 | ) |  |

Definition at line 978 of file Security.cpp.

{
   DWORD i,count,index;
   CHAR rgbDigits[]="0123456789abcdef";
   CHAR rgbLine[100];
   char cbLine;

   for(index = 0; length; length -= count, buffer += count, index += count)
   {
      count = (length > 16) ? 16:length;

      sprintf(rgbLine, "%4.4x  ",index);
      cbLine = 6;

      for(i=0;i<count;i++)
      {
         rgbLine[cbLine++] = rgbDigits[buffer[i] >> 4];
         rgbLine[cbLine++] = rgbDigits[buffer[i] & 0x0f];
         if(i == 7)
         {
            rgbLine[cbLine++] = ':';
         }
         else
         {
            rgbLine[cbLine++] = ' ';
         }
      }
      for(; i < 16; i++)
      {
         rgbLine[cbLine++] = ' ';
         rgbLine[cbLine++] = ' ';
         rgbLine[cbLine++] = ' ';
      }

      rgbLine[cbLine++] = ' ';

      for(i = 0; i < count; i++)
      {
         if(buffer[i] < 32 || buffer[i] > 126)
         {
            rgbLine[cbLine++] = '.';
         }
         else
         {
            rgbLine[cbLine++] = buffer[i];
         }
      }

      rgbLine[cbLine++] = 0;
      printf("%s\n", rgbLine);
   }
}

BOOL RevertContext ( DWORD dwKey )

Definition at line 525 of file Security.cpp.

                    :

    Reverts to the original server context.

 Return Value:

    Returns TRUE is successful; otherwise FALSE is returned.

--*/
{
   SECURITY_STATUS   ss;
   PAUTH_SEQ         pAS;

   // Lookup pAS based on Key
   //
   if (!GetEntry (dwKey, (PVOID*) &pAS))
      return(FALSE);

   ss = RevertSecurityContext (&pAS->_hctxt);
   if (!SEC_SUCCESS(ss)) {
      fprintf (stderr, "Revert failed: 0x%08x\n", ss);
      return(FALSE);
   }

   return(TRUE);
}

BOOL SignThis | ( | DWORD | dwKey,
 |  | PBYTE | pMessage,
 |  | ULONG | cbMessage,
 |  | BYTE ** | ppOutput,
 |  | LPDWORD | pcbOutput
 | ) |  |

Definition at line 742 of file Security.cpp.

                    :

    Signs a message

 Return Value:

    Returns TRUE is successful; otherwise FALSE is returned.

--*/
{
   SECURITY_STATUS   ss;
   PAUTH_SEQ         pAS;
   SecBufferDesc     BuffDesc;
   SecBuffer         SecBuff[2];
   ULONG             ulQop = 0;
   PBYTE             pSigBuffer;
   DWORD             SigBufferSize;

   // Lookup pAS based on Key
   //
   if (!GetEntry (dwKey, (PVOID*) &pAS))
      return(FALSE);

   // the size of the signature block is determined from this value
   //
   SigBufferSize = pAS->cbMaxSignature;

   // for reasons apparent later, we are going to allocate
   // a buffer big enough to hold the signature + signed data
   pSigBuffer = (PBYTE) malloc (SigBufferSize + cbMessage);

   // prepare buffers
   //
   BuffDesc.ulVersion = 0;
   BuffDesc.cBuffers = 2;
   BuffDesc.pBuffers = SecBuff;

   SecBuff[0].cbBuffer = SigBufferSize;
   SecBuff[0].BufferType = SECBUFFER_TOKEN;
   SecBuff[0].pvBuffer = pSigBuffer;

   SecBuff[1].cbBuffer = cbMessage;
   SecBuff[1].BufferType = SECBUFFER_DATA;
   SecBuff[1].pvBuffer = pMessage;

   ss = MakeSignature(
      &pAS->_hctxt,
      ulQop,
      &BuffDesc,
      0
      );

   if (!SEC_SUCCESS(ss)) {
      fprintf (stderr, "MakeSignature failed: 0x%08x\n", ss);
      return(FALSE);
   }

   // here we append the signed data to our signature block
   // and also reducing the size of our signature buffer if
   // the package did not use the size that we provided
   //
   memcpy (pSigBuffer+SecBuff[0].cbBuffer, pMessage, cbMessage);

   // point the data buffer to our new blob and reset the size
   //
   *ppOutput = pSigBuffer;

   *pcbOutput = cbMessage + SecBuff[0].cbBuffer;

   if(g_fVerbose)
   {
      printf ("data after signing including signature (%lu bytes):\n", *pcbOutput);
      PrintHexDump (*pcbOutput, *ppOutput);
   }

   return TRUE;

}

BOOL TermPackage ( )

Definition at line 89 of file Security.cpp.

{

   return(TRUE);
}

BOOL TermSession ( DWORD dwKey )

Definition at line 948 of file Security.cpp.

                    :

    Releases the resources associated with a key and removes it from
   the collection.

 Return Value:

    Returns TRUE is successful; otherwise FALSE is returned.

--*/
{
   PAUTH_SEQ pAS;

   if (!DeleteEntry (dwKey, (LPVOID*)&pAS))
      return(FALSE);

   if (pAS->_fHaveCtxtHandle)
      DeleteSecurityContext (&pAS->_hctxt);

   if (pAS->_fHaveCredHandle)
      FreeCredentialHandle (&pAS->_hcred);

   free (pAS);

   return(TRUE);
}

PBYTE VerifyThis | ( | DWORD | dwKey,
 |  | PBYTE | pBuffer,
 |  | LPDWORD | pcbMessage
 | ) |  |

Definition at line 832 of file Security.cpp.

                    :

    Decrypts a message

 Return Value:

    Returns TRUE is successful; otherwise FALSE is returned.

--*/
{
   SECURITY_STATUS   ss;
   PAUTH_SEQ         pAS;
   SecBufferDesc     BuffDesc;
   SecBuffer         SecBuff[2];
   ULONG             ulQop = 0;
   PBYTE             pSigBuffer;
   PBYTE             pDataBuffer;
   DWORD             SigBufferSize;

   // Lookup pAS based on Key
   //
   if (!GetEntry (dwKey, (PVOID*) &pAS))
      return(FALSE);

   // the size of the signature block is determined from this value
   //
   SigBufferSize = pAS->cbMaxSignature;

   if(g_fVerbose)
   {
      printf ("data before verifying (including signature):\n");
      PrintHexDump (*pcbMessage, pBuffer);
   }
   // we know the signature is at the beginning of the blob
   //
   pSigBuffer = pBuffer;

   // and that the data is after the signature
   //
   pDataBuffer = pBuffer + SigBufferSize;

   // reset the size of the data to reflect just the data
   //
   *pcbMessage = *pcbMessage - (SigBufferSize);

   // prepare buffer
   //
   BuffDesc.ulVersion = 0;
   BuffDesc.cBuffers = 2;
   BuffDesc.pBuffers = SecBuff;

   SecBuff[0].cbBuffer = SigBufferSize;
   SecBuff[0].BufferType = SECBUFFER_TOKEN;
   SecBuff[0].pvBuffer = pSigBuffer;

   SecBuff[1].cbBuffer = *pcbMessage;
   SecBuff[1].BufferType = SECBUFFER_DATA;
   SecBuff[1].pvBuffer = pDataBuffer;

   ss = VerifySignature(
      &pAS->_hctxt,
      &BuffDesc,
      0,
      &ulQop
      );

   if (!SEC_SUCCESS(ss)) {
      fprintf (stderr, "VerifyMessage failed: 0x%08x\n", ss);
      return(FALSE);
   }
   else
      printf("Message was properly signed.\n");

   return pDataBuffer;

}

Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/SSPI/SockAuth/Security.h File Reference

  • Security
  • SSPI
  • SockAuth
Functions

Security.h File Reference

Go to the source code of this file.

Functions

PBYTE | DecryptThis (DWORD dwKey, PBYTE achData, LPDWORD pcbMessage)
BOOL | EncryptThis (DWORD dwKey, PBYTE pMessage, ULONG cbMessage, BYTE **ppOutput, LPDWORD pcbOutput)
BOOL | GenClientContext (DWORD dwKey, BYTE *pIn, DWORD cbIn, BYTE **pOut, DWORD *pcbOut, BOOL *pfDone, ULONG *pAttribs, CHAR *pszTarget)
BOOL | GenServerContext (DWORD dwKey, BYTE *pIn, DWORD cbIn, BYTE **pOut, DWORD *pcbOut, BOOL *pfDone, ULONG *pAttribs)
BOOL | ImpersonateContext (DWORD dwKey)
BOOL | InitPackage (TCHAR *lpPackageName, BOOL fVerbose)
BOOL | InitSession (DWORD dwKey)
void | PrintHexDump (DWORD length, PBYTE buffer)
BOOL | RevertContext (DWORD dwKey)
BOOL | SignThis (DWORD dwKey, PBYTE pMessage, ULONG cbMessage, BYTE **ppOutput, LPDWORD pcbOutput)
BOOL TermPackage ()
BOOL | TermSession (DWORD dwKey)
PBYTE | VerifyThis (DWORD dwKey, PBYTE pBuffer, LPDWORD pcbMessage)

Function Documentation

PBYTE DecryptThis | ( | DWORD | dwKey,
 |  | PBYTE | achData,
 |  | LPDWORD | pcbMessage
 | ) |  |

Definition at line 652 of file Security.cpp.

                    :

    Decrypts a message

 Return Value:

    Returns TRUE is successful; otherwise FALSE is returned.

--*/
{
   SECURITY_STATUS   ss;
   PAUTH_SEQ         pAS;
   SecBufferDesc     BuffDesc;
   SecBuffer         SecBuff[2];
   ULONG             ulQop = 0;
   PBYTE             pSigBuffer;
   PBYTE             pDataBuffer;
   DWORD             SigBufferSize;

   // Lookup pAS based on Key
   //
   if (!GetEntry (dwKey, (PVOID*) &pAS))
      return(FALSE);

   // When the server encrypted the message it set the size
   // of the trailer block to be just what it needed. We have to
   // tell DecryptMessage how big the trailer block turned out to be,
   // so we sent the size of the trailer as the first dword of the
   // message.
   //
   SigBufferSize = *((DWORD *) pBuffer);

   if(g_fVerbose)
   {
      printf ("data before decryption including trailer (%lu bytes):\n", *pcbMessage);
      PrintHexDump (*pcbMessage, (PBYTE) pBuffer);
   }

   // we know the trailer is at the beginning of the blob
   // but after the trailer size dword
   //
   pSigBuffer = pBuffer + sizeof(DWORD);

   // and that the data is after the trailer
   //
   pDataBuffer = pSigBuffer + SigBufferSize;

   // reset the size of the data to reflect just the encrypted blob
   //
   *pcbMessage = *pcbMessage - SigBufferSize - sizeof(DWORD);

   // prepare buffer
   //
   BuffDesc.ulVersion = 0;
   BuffDesc.cBuffers = 2;
   BuffDesc.pBuffers = SecBuff;

   SecBuff[0].cbBuffer = SigBufferSize;
   SecBuff[0].BufferType = SECBUFFER_TOKEN;
   SecBuff[0].pvBuffer = pSigBuffer;

   SecBuff[1].cbBuffer = *pcbMessage;
   SecBuff[1].BufferType = SECBUFFER_DATA;
   SecBuff[1].pvBuffer = pDataBuffer;

   ss = DecryptMessage(
      &pAS->_hctxt,
      &BuffDesc,
      0,
      &ulQop
      );

   if (!SEC_SUCCESS(ss)) {
      fprintf (stderr, "DecryptMessage failed: 0x%08x\n", ss);
      return(FALSE);
   }

   // only return a pointer to the data which we decrypted -
   // discard the trailer data
   return pDataBuffer;

}

BOOL EncryptThis | ( | DWORD | dwKey,
 |  | PBYTE | pMessage,
 |  | ULONG | cbMessage,
 |  | BYTE ** | ppOutput,
 |  | LPDWORD | pcbOutput
 | ) |  |
BOOL GenClientContext | ( | DWORD | dwKey,
 |  | BYTE * | pIn,
 |  | DWORD | cbIn,
 |  | BYTE ** | pOut,
 |  | DWORD * | pcbOut,
 |  | BOOL * | pfDone,
 |  | ULONG * | pAttribs,
 |  | CHAR * | pszTarget
 | ) |  |

Definition at line 95 of file Security.cpp.

                    :

    Optionally takes an input buffer coming from the server and returns
   a buffer of information to send back to the server.  Also returns
   an indication of whether or not the context is complete.

 Return Value:

    Returns TRUE is successful; otherwise FALSE is returned.

--*/
{
   SECURITY_STATUS   ss;
   TimeStamp         Lifetime;
   SecBufferDesc     OutBuffDesc;
   SecBuffer         OutSecBuff;
   SecBufferDesc     InBuffDesc;
   SecBuffer         InSecBuff;
   ULONG             ContextAttributes;
   PAUTH_SEQ         pAS;
   SecPkgContext_Sizes SecPkgContextSizes;
   SecPkgContext_NegotiationInfo SecPkgNegInfo;
   SecPkgContext_Flags SecPkgFlags;

   // Lookup pAS based on Key
   //
   if (!GetEntry (dwKey, (PVOID*) &pAS))
      return(FALSE);

   if (pAS->_fNewConversation)  {
      ss = AcquireCredentialsHandle (
               NULL, // principal
               g_lpPackageName,
               SECPKG_CRED_OUTBOUND,
               NULL, // LOGON id
               NULL, // auth data
               NULL, // get key fn
               NULL, // get key arg
               &pAS->_hcred,
               &Lifetime
               );
      if (SEC_SUCCESS (ss))
         pAS->_fHaveCredHandle = TRUE;
      else {
         fprintf (stderr, "AcquireCreds failed: 0x%08x\n", ss);
         return(FALSE);
      }
   }

   // prepare output buffer
   //
   OutBuffDesc.ulVersion = 0;
   OutBuffDesc.cBuffers = 1;
   OutBuffDesc.pBuffers = &OutSecBuff;

   OutSecBuff.cbBuffer = 0;
   OutSecBuff.BufferType = SECBUFFER_TOKEN;
   OutSecBuff.pvBuffer = NULL;

   // prepare input buffer
   //
   if (!pAS->_fNewConversation)  {
      InBuffDesc.ulVersion = 0;
      InBuffDesc.cBuffers = 1;
      InBuffDesc.pBuffers = &InSecBuff;

      InSecBuff.cbBuffer = cbIn;
      InSecBuff.BufferType = SECBUFFER_TOKEN;
      InSecBuff.pvBuffer = pIn;

      if(g_fVerbose)
      {
         printf ("token buffer recieved(%lu bytes):\n", InSecBuff.cbBuffer);
         PrintHexDump (InSecBuff.cbBuffer, (PBYTE)InSecBuff.pvBuffer);
      }

   }

   // Always have the package allocate the memory
   *pAttribs |= ISC_REQ_ALLOCATE_MEMORY;

   ss = InitializeSecurityContext (
            &pAS->_hcred,
            pAS->_fNewConversation ? NULL : &pAS->_hctxt,
            pszTarget,
            *pAttribs,
            0, // reserved1
            SECURITY_NATIVE_DREP,
            pAS->_fNewConversation ? NULL : &InBuffDesc,
            0, // reserved2
            &pAS->_hctxt,
            &OutBuffDesc,
            &ContextAttributes,
            &Lifetime
            );

   if (!SEC_SUCCESS (ss))  {
      fprintf (stderr, "InitializeSecurityContext failed: 0x%08x\n", ss);
      return FALSE;
   }

   pAS->_fHaveCtxtHandle = TRUE;

   // Complete token -- if applicable
   //
   if ((SEC_I_COMPLETE_NEEDED == ss) || (SEC_I_COMPLETE_AND_CONTINUE == ss))  {
      ss = CompleteAuthToken (&pAS->_hctxt, &OutBuffDesc);
      if (!SEC_SUCCESS(ss))  {
         fprintf (stderr, "complete failed: 0x%08x\n", ss);
         return FALSE;
      }
   }

   *pcbOut = OutSecBuff.cbBuffer;
   *pOut = (PBYTE)OutSecBuff.pvBuffer;

   if (pAS->_fNewConversation)
      pAS->_fNewConversation = FALSE;

   *pfDone = !((SEC_I_CONTINUE_NEEDED == ss) ||
            (SEC_I_COMPLETE_AND_CONTINUE == ss));

   if(g_fVerbose)
   {
      printf ("token buffer generated (%lu bytes):\n", OutSecBuff.cbBuffer);
      PrintHexDump (OutSecBuff.cbBuffer, (PBYTE)OutSecBuff.pvBuffer);
   }

   if(*pfDone) {

      // find size of signature block
      //
      ss = QueryContextAttributes(
               &pAS->_hctxt,
               SECPKG_ATTR_SIZES,
               &SecPkgContextSizes );

      if (!SEC_SUCCESS(ss))  {
         fprintf (stderr, "QueryContextAttributes failed: 0x%08x\n", ss);
         printf("here");
         return FALSE;
      }

      // these values are used for encryption and signing
      //
      pAS->cbMaxSignature = SecPkgContextSizes.cbMaxSignature;
      pAS->cbSecurityTrailer = SecPkgContextSizes.cbSecurityTrailer;

      // return the attributes we ended up with
      //
      *pAttribs = ContextAttributes;

      // find out what package was negotiated
      //
      ss = QueryContextAttributes(
           &pAS->_hctxt,
           SECPKG_ATTR_NEGOTIATION_INFO,
           &SecPkgNegInfo );

      if (!SEC_SUCCESS(ss))
      {
         fprintf (stderr, "QueryContextAttributes failed: 0x%08x\n", ss);
         return FALSE;
      }
      else
      {
         printf("Package Name: %s\n", SecPkgNegInfo.PackageInfo->Name);
         // free up the allocated buffer
         //
         FreeContextBuffer(SecPkgNegInfo.PackageInfo);

      }

      // find out what flags are really used
      //
      ss = QueryContextAttributes(
           &pAS->_hctxt,
           SECPKG_ATTR_FLAGS,
           &SecPkgFlags );

      if (!SEC_SUCCESS(ss))
      {
         fprintf (stderr, "QueryContextAttributes failed: 0x%08x\n", ss);
         return FALSE;
      }
      else
      {
         printf("FLags: %x\n", SecPkgFlags.Flags);

      }

   }

   if(g_fVerbose)
      printf("InitializeSecurityContext result = 0x%08x\n", ss);

   return TRUE;
}

BOOL GenServerContext | ( | DWORD | dwKey,
 |  | BYTE * | pIn,
 |  | DWORD | cbIn,
 |  | BYTE ** | pOut,
 |  | DWORD * | pcbOut,
 |  | BOOL * | pfDone,
 |  | ULONG * | pAttribs
 | ) |  |

Definition at line 307 of file Security.cpp.

                    :

    Takes an input buffer coming from the client and returns a buffer
   to be sent to the client.  Also returns an indication of whether or
   not the context is complete.

 Return Value:

    Returns TRUE is successful; otherwise FALSE is returned.

--*/
{
   SECURITY_STATUS   ss;
   TimeStamp         Lifetime;
   SecBufferDesc     OutBuffDesc;
   SecBuffer         OutSecBuff;
   SecBufferDesc     InBuffDesc;
   SecBuffer         InSecBuff;
   ULONG             ContextAttributes;
   PAUTH_SEQ         pAS;
   SecPkgContext_Sizes SecPkgContextSizes;
   SecPkgContext_NegotiationInfo SecPkgNegInfo;

   // Lookup pAS based on Key
   //
   if (!GetEntry (dwKey, (PVOID*) &pAS))
      return(FALSE);

   if (pAS->_fNewConversation)  {
      ss = AcquireCredentialsHandle (
               NULL, // principal
               g_lpPackageName,
               SECPKG_CRED_INBOUND,
               NULL, // LOGON id
               NULL, // auth data
               NULL, // get key fn
               NULL, // get key arg
               &pAS->_hcred,
               &Lifetime
               );
      if (SEC_SUCCESS (ss))
         pAS->_fHaveCredHandle = TRUE;
      else {
         fprintf (stderr, "AcquireCreds failed: 0x%08x\n", ss);
         return(FALSE);
      }
   }

   // prepare output buffer
   //
   OutBuffDesc.ulVersion = 0;
   OutBuffDesc.cBuffers = 1;
   OutBuffDesc.pBuffers = &OutSecBuff;

   OutSecBuff.cbBuffer = 0;
   OutSecBuff.BufferType = SECBUFFER_TOKEN;
   OutSecBuff.pvBuffer = NULL;

   // prepare input buffer
   //
   InBuffDesc.ulVersion = 0;
   InBuffDesc.cBuffers = 1;
   InBuffDesc.pBuffers = &InSecBuff;

   InSecBuff.cbBuffer = cbIn;
   InSecBuff.BufferType = SECBUFFER_TOKEN;
   InSecBuff.pvBuffer = pIn;

   if(g_fVerbose)
   {
      printf ("token buffer recieved (%lu bytes):\n", InSecBuff.cbBuffer);
      PrintHexDump (InSecBuff.cbBuffer, (PBYTE)InSecBuff.pvBuffer);
   }

   // Always have the package allocate the memory
   *pAttribs |= ISC_REQ_ALLOCATE_MEMORY;

   ss = AcceptSecurityContext (
            &pAS->_hcred,
            pAS->_fNewConversation ? NULL : &pAS->_hctxt,
            &InBuffDesc,
            *pAttribs, // context requirements
            SECURITY_NATIVE_DREP,
            &pAS->_hctxt,
            &OutBuffDesc,
            &ContextAttributes,
            &Lifetime
            );
   if (!SEC_SUCCESS (ss))  {
      fprintf (stderr, "AcceptSecurityContext failed: 0x%08x\n", ss);
      return FALSE;
   }

   pAS->_fHaveCtxtHandle = TRUE;

   // Complete token -- if applicable
   //
   if ((SEC_I_COMPLETE_NEEDED == ss) || (SEC_I_COMPLETE_AND_CONTINUE == ss))  {
      ss = CompleteAuthToken (&pAS->_hctxt, &OutBuffDesc);
      if (!SEC_SUCCESS(ss))  {
         fprintf (stderr, "complete failed: 0x%08x\n", ss);
         return FALSE;
      }
   }

   *pcbOut = OutSecBuff.cbBuffer;
   *pOut = (PBYTE)OutSecBuff.pvBuffer;

   if (pAS->_fNewConversation)
      pAS->_fNewConversation = FALSE;

   if(g_fVerbose)
   {
      printf ("token buffer generated (%lu bytes):\n", OutSecBuff.cbBuffer);
      PrintHexDump (OutSecBuff.cbBuffer, (PBYTE)OutSecBuff.pvBuffer);
   }

   *pfDone = !((SEC_I_CONTINUE_NEEDED == ss) ||
            (SEC_I_COMPLETE_AND_CONTINUE == ss));

   // find size of token
   //
   if(*pfDone) {

      // find size of signature and trailer blocks
      //
      ss = QueryContextAttributes(
               &pAS->_hctxt,
               SECPKG_ATTR_SIZES,
               &SecPkgContextSizes );

      if (!SEC_SUCCESS(ss))  {
         fprintf (stderr, "QueryContextAttributes failed: 0x%08x\n", ss);
         return FALSE;
      }

      // these values are used for encryption and signing
      //
      pAS->cbMaxSignature = SecPkgContextSizes.cbMaxSignature;
      pAS->cbSecurityTrailer = SecPkgContextSizes.cbSecurityTrailer;

      // return the attributes we ended up with
      //
      *pAttribs = ContextAttributes;

            // find out what package was negotiated
      //
      ss = QueryContextAttributes(
           &pAS->_hctxt,
           SECPKG_ATTR_NEGOTIATION_INFO,
           &SecPkgNegInfo );

      if (!SEC_SUCCESS(ss))
      {
         fprintf (stderr, "QueryContextAttributes failed: 0x%08x\n", ss);
         return FALSE;
      }
      else
      {
         printf("Package Name: %s\n", SecPkgNegInfo.PackageInfo->Name);

         // free up the allocated buffer
         //
         FreeContextBuffer(SecPkgNegInfo.PackageInfo);
      }

   }

   if(g_fVerbose)
      printf("AcceptSecurityContext result = 0x%08x\n", ss);

   return TRUE;
}

BOOL ImpersonateContext ( DWORD dwKey )

Definition at line 494 of file Security.cpp.

                    :

    Impersonates the client whose context is associated with the
   supplied key.

 Return Value:

    Returns TRUE is successful; otherwise FALSE is returned.

--*/
{
   SECURITY_STATUS   ss;
   PAUTH_SEQ         pAS;

   // Lookup pAS based on Key
   //
   if (!GetEntry (dwKey, (PVOID*) &pAS))
      return(FALSE);

   ss = ImpersonateSecurityContext (&pAS->_hctxt);
   if (!SEC_SUCCESS(ss)) {
      fprintf (stderr, "Impersonate failed: 0x%08x\n", ss);
      return(FALSE);
   }

   return(TRUE);
}

BOOL InitPackage | ( | TCHAR * | lpPackageName,
 |  | BOOL | fVerbose
 | ) |  |

Definition at line 52 of file Security.cpp.

                    :

    Finds, loads and initializes the security package

 Return Value:

    Returns TRUE is successful; otherwise FALSE is returned.

--*/
{
   SECURITY_STATUS ss;
   PSecPkgInfo pkgInfo;

   // Query for the package we're interested in
   //
   ss = QuerySecurityPackageInfo (lpPackageName, &pkgInfo);

   if (!SEC_SUCCESS(ss)) {
      fprintf (stderr, "Couldn't query package info for %s, error 0x%08x\n",
               lpPackageName, ss);
      return(FALSE);
   }

   lstrcpy (g_lpPackageName, lpPackageName);

   FreeContextBuffer (pkgInfo);

   g_fVerbose = fVerbose;

   printf ("Using package: %s\n", g_lpPackageName);

   return TRUE;
}

BOOL InitSession ( DWORD dwKey )

Definition at line 916 of file Security.cpp.

                    :

    Initializes the context associated with a key and adds it to the
   collection.

 Return Value:

    Returns TRUE is successful; otherwise FALSE is returned.

--*/
{
   PAUTH_SEQ pAS;

   pAS = (PAUTH_SEQ) malloc (sizeof (AUTH_SEQ));
   if (NULL == pAS)
      return(FALSE);

   pAS->_fNewConversation = TRUE;
   pAS->_fHaveCredHandle = FALSE;
   pAS->_fHaveCtxtHandle = FALSE;

   if (!AddEntry (dwKey, (PVOID)pAS))  {
      free (pAS);
      return(FALSE);
   }

   return(TRUE);
}

void PrintHexDump | ( | DWORD | length,
 |  | PBYTE | buffer
 | ) |  |

Definition at line 978 of file Security.cpp.

{
   DWORD i,count,index;
   CHAR rgbDigits[]="0123456789abcdef";
   CHAR rgbLine[100];
   char cbLine;

   for(index = 0; length; length -= count, buffer += count, index += count)
   {
      count = (length > 16) ? 16:length;

      sprintf(rgbLine, "%4.4x  ",index);
      cbLine = 6;

      for(i=0;i<count;i++)
      {
         rgbLine[cbLine++] = rgbDigits[buffer[i] >> 4];
         rgbLine[cbLine++] = rgbDigits[buffer[i] & 0x0f];
         if(i == 7)
         {
            rgbLine[cbLine++] = ':';
         }
         else
         {
            rgbLine[cbLine++] = ' ';
         }
      }
      for(; i < 16; i++)
      {
         rgbLine[cbLine++] = ' ';
         rgbLine[cbLine++] = ' ';
         rgbLine[cbLine++] = ' ';
      }

      rgbLine[cbLine++] = ' ';

      for(i = 0; i < count; i++)
      {
         if(buffer[i] < 32 || buffer[i] > 126)
         {
            rgbLine[cbLine++] = '.';
         }
         else
         {
            rgbLine[cbLine++] = buffer[i];
         }
      }

      rgbLine[cbLine++] = 0;
      printf("%s\n", rgbLine);
   }
}

BOOL RevertContext ( DWORD dwKey )

Definition at line 525 of file Security.cpp.

                    :

    Reverts to the original server context.

 Return Value:

    Returns TRUE is successful; otherwise FALSE is returned.

--*/
{
   SECURITY_STATUS   ss;
   PAUTH_SEQ         pAS;

   // Lookup pAS based on Key
   //
   if (!GetEntry (dwKey, (PVOID*) &pAS))
      return(FALSE);

   ss = RevertSecurityContext (&pAS->_hctxt);
   if (!SEC_SUCCESS(ss)) {
      fprintf (stderr, "Revert failed: 0x%08x\n", ss);
      return(FALSE);
   }

   return(TRUE);
}

BOOL SignThis | ( | DWORD | dwKey,
 |  | PBYTE | pMessage,
 |  | ULONG | cbMessage,
 |  | BYTE ** | ppOutput,
 |  | LPDWORD | pcbOutput
 | ) |  |

Definition at line 742 of file Security.cpp.

                    :

    Signs a message

 Return Value:

    Returns TRUE is successful; otherwise FALSE is returned.

--*/
{
   SECURITY_STATUS   ss;
   PAUTH_SEQ         pAS;
   SecBufferDesc     BuffDesc;
   SecBuffer         SecBuff[2];
   ULONG             ulQop = 0;
   PBYTE             pSigBuffer;
   DWORD             SigBufferSize;

   // Lookup pAS based on Key
   //
   if (!GetEntry (dwKey, (PVOID*) &pAS))
      return(FALSE);

   // the size of the signature block is determined from this value
   //
   SigBufferSize = pAS->cbMaxSignature;

   // for reasons apparent later, we are going to allocate
   // a buffer big enough to hold the signature + signed data
   pSigBuffer = (PBYTE) malloc (SigBufferSize + cbMessage);

   // prepare buffers
   //
   BuffDesc.ulVersion = 0;
   BuffDesc.cBuffers = 2;
   BuffDesc.pBuffers = SecBuff;

   SecBuff[0].cbBuffer = SigBufferSize;
   SecBuff[0].BufferType = SECBUFFER_TOKEN;
   SecBuff[0].pvBuffer = pSigBuffer;

   SecBuff[1].cbBuffer = cbMessage;
   SecBuff[1].BufferType = SECBUFFER_DATA;
   SecBuff[1].pvBuffer = pMessage;

   ss = MakeSignature(
      &pAS->_hctxt,
      ulQop,
      &BuffDesc,
      0
      );

   if (!SEC_SUCCESS(ss)) {
      fprintf (stderr, "MakeSignature failed: 0x%08x\n", ss);
      return(FALSE);
   }

   // here we append the signed data to our signature block
   // and also reducing the size of our signature buffer if
   // the package did not use the size that we provided
   //
   memcpy (pSigBuffer+SecBuff[0].cbBuffer, pMessage, cbMessage);

   // point the data buffer to our new blob and reset the size
   //
   *ppOutput = pSigBuffer;

   *pcbOutput = cbMessage + SecBuff[0].cbBuffer;

   if(g_fVerbose)
   {
      printf ("data after signing including signature (%lu bytes):\n", *pcbOutput);
      PrintHexDump (*pcbOutput, *ppOutput);
   }

   return TRUE;

}

BOOL TermPackage ( )

Definition at line 89 of file Security.cpp.

{

   return(TRUE);
}

BOOL TermSession ( DWORD dwKey )

Definition at line 948 of file Security.cpp.

                    :

    Releases the resources associated with a key and removes it from
   the collection.

 Return Value:

    Returns TRUE is successful; otherwise FALSE is returned.

--*/
{
   PAUTH_SEQ pAS;

   if (!DeleteEntry (dwKey, (LPVOID*)&pAS))
      return(FALSE);

   if (pAS->_fHaveCtxtHandle)
      DeleteSecurityContext (&pAS->_hctxt);

   if (pAS->_fHaveCredHandle)
      FreeCredentialHandle (&pAS->_hcred);

   free (pAS);

   return(TRUE);
}

PBYTE VerifyThis | ( | DWORD | dwKey,
 |  | PBYTE | pBuffer,
 |  | LPDWORD | pcbMessage
 | ) |  |

Definition at line 832 of file Security.cpp.

                    :

    Decrypts a message

 Return Value:

    Returns TRUE is successful; otherwise FALSE is returned.

--*/
{
   SECURITY_STATUS   ss;
   PAUTH_SEQ         pAS;
   SecBufferDesc     BuffDesc;
   SecBuffer         SecBuff[2];
   ULONG             ulQop = 0;
   PBYTE             pSigBuffer;
   PBYTE             pDataBuffer;
   DWORD             SigBufferSize;

   // Lookup pAS based on Key
   //
   if (!GetEntry (dwKey, (PVOID*) &pAS))
      return(FALSE);

   // the size of the signature block is determined from this value
   //
   SigBufferSize = pAS->cbMaxSignature;

   if(g_fVerbose)
   {
      printf ("data before verifying (including signature):\n");
      PrintHexDump (*pcbMessage, pBuffer);
   }
   // we know the signature is at the beginning of the blob
   //
   pSigBuffer = pBuffer;

   // and that the data is after the signature
   //
   pDataBuffer = pBuffer + SigBufferSize;

   // reset the size of the data to reflect just the data
   //
   *pcbMessage = *pcbMessage - (SigBufferSize);

   // prepare buffer
   //
   BuffDesc.ulVersion = 0;
   BuffDesc.cBuffers = 2;
   BuffDesc.pBuffers = SecBuff;

   SecBuff[0].cbBuffer = SigBufferSize;
   SecBuff[0].BufferType = SECBUFFER_TOKEN;
   SecBuff[0].pvBuffer = pSigBuffer;

   SecBuff[1].cbBuffer = *pcbMessage;
   SecBuff[1].BufferType = SECBUFFER_DATA;
   SecBuff[1].pvBuffer = pDataBuffer;

   ss = VerifySignature(
      &pAS->_hctxt,
      &BuffDesc,
      0,
      &ulQop
      );

   if (!SEC_SUCCESS(ss)) {
      fprintf (stderr, "VerifyMessage failed: 0x%08x\n", ss);
      return(FALSE);
   }
   else
      printf("Message was properly signed.\n");

   return pDataBuffer;

}

Generated on Wed Nov 13 2024 16:53:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/SSPI/SockAuth/Server.cpp File Reference

  • Security
  • SSPI
  • SockAuth
Defines | Functions

Server.cpp File Reference

#include <windows.h>
#include <winsock.h>
#include <stdio.h>
#include <stdlib.h>
#include "security.h"
#include "comm.h"
#include "sspi.h"

Go to the source code of this file.

Defines

#define | SECURITY_WIN32
#define | SMALL_BUFF 256
#define | SOCKET_BUFF_SIZE 65536

Functions

BOOL | AcceptAuthSocket (SOCKET *s)
BOOL | CloseAuthSocket (SOCKET *s)
BOOL | DoAuthentication (SOCKET s)
void | main (int argc, char *argv[])
void | Usage (void)

Define Documentation

#define SECURITY_WIN32

Definition at line 24 of file Server.cpp.

#define SMALL_BUFF 256

Definition at line 29 of file Server.cpp.

#define SOCKET_BUFF_SIZE 65536

Definition at line 28 of file Server.cpp.

Function Documentation

BOOL AcceptAuthSocket ( SOCKET * s )

Definition at line 265 of file Server.cpp.

                    :

    Establishes an authenticated socket connection with a client and
   initializes any needed security package resources.

 Return Value:

    Returns TRUE is successful; otherwise FALSE is returned.

--*/
{
   SOCKET sockListen;
   SOCKET sockClient;
   SOCKADDR_IN sin;
   int nRes;

   // create listening socket
   //
   sockListen = socket (PF_INET, SOCK_STREAM, 0);
   if (INVALID_SOCKET == sockListen)  {
      fprintf (stderr, "Failed to create socket: %u\n", GetLastError ());
      return(FALSE);
   }

   // bind to local port
   //
   sin.sin_family = AF_INET;
   sin.sin_addr.s_addr = 0;
   sin.sin_port = htons(g_usPort);
   nRes = bind (sockListen, (LPSOCKADDR) &sin, sizeof (sin));
   if (SOCKET_ERROR == nRes)  {
      fprintf (stderr, "bind failed: %u\n", GetLastError ());
      return(FALSE);
   }

   // listen for client
   //
   nRes = listen (sockListen, 1);
   if (SOCKET_ERROR == nRes)  {
      fprintf (stderr, "listen failed: %u\n", GetLastError ());
      return(FALSE);
   }

   // accept client
   //
   sockClient = accept (sockListen, NULL, NULL);
   if (INVALID_SOCKET == sockClient)  {
      fprintf (stderr, "accept failed: %u\n", GetLastError ());
      return(FALSE);
   }

   closesocket (sockListen);

   // return socket even if we fail next steps
   //
   *s = sockClient;

   if (!InitSession (sockClient))
      return(FALSE);

   if (!DoAuthentication (sockClient))
      return(FALSE);

   return(TRUE);
}

BOOL CloseAuthSocket ( SOCKET * s )

Definition at line 334 of file Server.cpp.

                    :

    Closes a socket and releases security resources associated with
   the socket

 Return Value:

    Returns TRUE is successful; otherwise FALSE is returned.

--*/
{
   TermSession (*s);
   shutdown (*s, 2);
   closesocket (*s);
   *s = 0;
   return(TRUE);
}

BOOL DoAuthentication ( SOCKET s )

Definition at line 355 of file Server.cpp.

                    :

    Manages the authentication conversation with the client via the
    supplied socket handle.

 Return Value:

    Returns TRUE is successful; otherwise FALSE is returned.

--*/
{
   DWORD cbIn, cbOut;
   BOOL done = FALSE;
   ULONG attrib = 0;
   PBYTE pOutBuf = NULL;

   if (g_fUseConfidentiality)
      attrib |= ASC_REQ_CONFIDENTIALITY;

   if (g_fUseIntegrity)
      attrib |= ASC_REQ_INTEGRITY;

   do {
      if (!ReceiveMsg (
         s,
         g_pInBuf,
         g_cbMaxMessage,
         &cbIn))

         return(FALSE);

      pOutBuf = NULL;

      if (!GenServerContext (
         s,
         g_pInBuf,
         cbIn,
         &pOutBuf,
         &cbOut,
         &done,
         &attrib))

         return(FALSE);

      if (!SendMsg (s, pOutBuf, cbOut))
         return(FALSE);

      // done with package allocated buffer - free it
      if(pOutBuf)
         FreeContextBuffer(pOutBuf);

   }
   while(!done);

   if(g_fVerbose)
      printf("Context Attributes = 0x%08x\n", attrib);

   // check the context flags and see if we got what we want
   //
   if (g_fUseConfidentiality && !(attrib & ASC_RET_CONFIDENTIALITY))
   {
      fprintf (stderr, "** confidentiality flags not set on context\n");

      // The application can decide to either terminate the conversation
      // or continue. We are going to let the client make these decisions
      // and continue.
      //
      g_fUseConfidentiality = FALSE;
   }

   if (g_fUseIntegrity && !(attrib & ASC_RET_INTEGRITY))
   {
      fprintf (stderr, " ** integrity flags not set on context\n");

      // The application can decide to either terminate the conversation
      // or continue. We are going to let the client make these decisions
      // and continue.
      //
      g_fUseIntegrity = FALSE;
   }

   // or the client could have requested the context flags and the package obliged
   //
   g_fUseConfidentiality = (attrib & ASC_RET_CONFIDENTIALITY);

   g_fUseIntegrity = (attrib & ASC_RET_INTEGRITY);

   return(TRUE);
}

void main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 58 of file Server.cpp.

{
   PCHAR pMessage = NULL;
   DWORD cbMessage = 0;
   PBYTE pDataToClient = NULL;
   DWORD cbDataToClient = 0;
   PCHAR pUserName = NULL;
   DWORD cbUserName = 0;
   SOCKET s = 0;

   int    i;
   int    iOption;
   char   *pszOption = NULL;

   printf("\nUse \"%s /h\" to see the options for this sample application\n\n",
      argv[0]);

   // default package is negotiate
   //
   lstrcpy(g_lpPackageName, "Negotiate");

   for(i = 1; i < argc; i++)
   {
      if(argv[i][0] == '/') argv[i][0] = '-';

      if(argv[i][0] != '-')
      {
         printf("**** Invalid argument \"%s\"\n", argv[i]);
         Usage();
         return;
      }
      iOption = argv[i][1];
      pszOption = &argv[i][2];

      switch(iOption)
      {
      case 'h':
         Usage();
         return;

      case 'p':
         lstrcpyn(g_lpPackageName, pszOption, 1024);
         break;

      case 'c':
         g_fUseConfidentiality = TRUE;
         break;

      case 'i':
         g_fUseIntegrity = TRUE;
         break;

      case 'v':
         g_fVerbose = TRUE;
         break;

      default:
         printf("**** Invalid option \"%s\"\n", argv[i]);
         Usage();
         return;

      }

   }

   // initialize
   //
   if (!InitWinsock ())
      goto cleanup;

   if (!InitPackage (g_lpPackageName, g_fVerbose))
      goto cleanup;

   g_pInBuf = (PBYTE) malloc (SOCKET_BUFF_SIZE);

   if (NULL == g_pInBuf)
      goto cleanup;

   //
   // Start looping for clients
   //
   while(TRUE)
   {

      printf("Waiting for client to connect...\n");

      // Make an authenticated connection with client
      //
      if (!AcceptAuthSocket (&s))
         goto endsession;

      // impersonate the client
      //
      if (!ImpersonateContext (s))
         goto endsession;

      GetUserName (NULL, &cbUserName);
      pUserName = (PCHAR) malloc (cbUserName);

      if (!pUserName)
         goto cleanup;

      if (!GetUserName (pUserName, &cbUserName))
         goto cleanup;

      // display the user name
      //
      printf ("Client connected as user %s\n", pUserName);

      // revert to self
      //
      if (!RevertContext (s))
         goto cleanup;

      //
      // Send back the client's username
      //
      cbMessage = cbUserName;
      pMessage = pUserName;

      // do the appropriate operation as the context attributes indicate
      //
      if(g_fUseConfidentiality)
      {
         EncryptThis (
            s,
            (PBYTE) pMessage,
            cbMessage,
            &pDataToClient,
            &cbDataToClient
            );
      }

      else
      {
         // only sign if we didn't encrypt
         //
         if(g_fUseIntegrity)
         {
            SignThis (
               s,
               (PBYTE) pMessage,
               cbMessage,
               &pDataToClient,
               &cbDataToClient
               );
         }

         // do the default and just send the raw message
         //
         else
         {
            pDataToClient = (PBYTE) malloc(cbMessage);
            memcpy(pDataToClient, pMessage, cbMessage);
            cbDataToClient = cbMessage;
         }

      }

endsession:

      // send data to client
      //
      if (!SendBytes (s, pDataToClient, cbDataToClient))
         goto cleanup;

      if (s)
      {
         CloseAuthSocket (&s);
         s = 0;
      }

      if (pUserName)
      {
         free (pUserName);
         pUserName = NULL;
         cbUserName = 0;
      }

      if(pDataToClient)
      {
         free (pDataToClient);
         pDataToClient = NULL;
         cbDataToClient = 0;
      }

      g_fUseConfidentiality = 0;
      g_fUseIntegrity =0;

      printf("\n");

   }

cleanup:

   if (g_pInBuf)
      free (g_pInBuf);

   TermPackage ();

   TermWinsock ();

}

void Usage ( void )

Definition at line 43 of file Server.cpp.

{

   printf ("usage: server [ <options> ]\n");
   printf ("\n");
   printf ("    -h              show usage\n");
   printf ("    -p<package>     name of security package (default = negotiate).\n");
   printf ("    -c              message confidentiality (encryption).\n");
   printf ("    -i              message integrity (signing).\n");
   printf ("    -v              verbose mode.\n");
   printf ("\n");
   printf ("  example: server -pnegotiate -c\n");

}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/SSPI/SSL/WebClient/WebClient.c File Reference

  • Security
  • SSPI
  • SSL
  • WebClient
Defines | Functions | Variables

WebClient.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <winsock.h>
#include <wincrypt.h>
#include <wintrust.h>
#include <schannel.h>
#include <security.h>
#include <sspi.h>

Go to the source code of this file.

Defines

#define | DLL_NAME TEXT("Secur32.dll")
#define | IO_BUFFER_SIZE 0x10000
#define | NT4_DLL_NAME TEXT("Security.dll")
#define | SECURITY_WIN32

Functions

BOOL | LoadSecurityLibrary (void)
void _cdecl | main (int argc, char *argv[])
void | UnloadSecurityLibrary (void)
void | Usage (void)

Variables

ALG_ID | aiKeyExch = 0
DWORD | dwProtocol = 0
BOOL | fUseProxy = FALSE
BOOL | fVerbose = FALSE
HMODULE | g_hSecurity = NULL
PSecurityFunctionTable | g_pSSPI
HCERTSTORE | hMyCertStore = NULL
INT | iPortNumber = 443
INT | iProxyPort = 80
LPSTR | pszFileName = "default.htm"
LPSTR | pszProxyServer = "proxy"
LPSTR | pszServerName = NULL
LPSTR | pszUserName = NULL
SCHANNEL_CRED | SchannelCred

Define Documentation

#define DLL_NAME TEXT("Secur32.dll")

Definition at line 35 of file WebClient.c.

#define IO_BUFFER_SIZE 0x10000

Definition at line 33 of file WebClient.c.

#define NT4_DLL_NAME TEXT("Security.dll")

Definition at line 36 of file WebClient.c.

#define SECURITY_WIN32

Definition at line 29 of file WebClient.c.

Function Documentation

BOOL LoadSecurityLibrary ( void )

Definition at line 160 of file WebClient.c.

{
    INIT_SECURITY_INTERFACE         pInitSecurityInterface;
    QUERY_CREDENTIALS_ATTRIBUTES_FN pQueryCredentialsAttributes;
    OSVERSIONINFO VerInfo;
    UCHAR lpszDLL[MAX_PATH];

    //
    //  Find out which security DLL to use, depending on
    //  whether we are on Win2K, NT or Win9x
    //

    VerInfo.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
    if (!GetVersionEx (&VerInfo))
    {
        return FALSE;
    }

    if (VerInfo.dwPlatformId == VER_PLATFORM_WIN32_NT
        && VerInfo.dwMajorVersion == 4)
    {
        strcpy (lpszDLL, NT4_DLL_NAME );
    }
    else if (VerInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS ||
          VerInfo.dwPlatformId == VER_PLATFORM_WIN32_NT )
    {
        strcpy (lpszDLL, DLL_NAME );
    }
    else
    {
        return FALSE;
    }

    //
    //  Load Security DLL
    //

    g_hSecurity = LoadLibrary(lpszDLL);
    if(g_hSecurity == NULL)
    {
        printf("Error 0x%x loading %s.\n", GetLastError(), lpszDLL);
        return FALSE;
    }

    pInitSecurityInterface = (INIT_SECURITY_INTERFACE)GetProcAddress(
                                    g_hSecurity,
                                    "InitSecurityInterfaceA");

    if(pInitSecurityInterface == NULL)
    {
        printf("Error 0x%x reading InitSecurityInterface entry point.\n",
               GetLastError());
        return FALSE;
    }

    g_pSSPI = pInitSecurityInterface();

    if(g_pSSPI == NULL)
    {
        printf("Error 0x%x reading security interface.\n",
               GetLastError());
        return FALSE;
    }

    return TRUE;
}

void _cdecl main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 237 of file WebClient.c.

{
    WSADATA WsaData;
    SOCKET  Socket = INVALID_SOCKET;

    CredHandle hClientCreds;
    CtxtHandle hContext;
    BOOL fCredsInitialized = FALSE;
    BOOL fContextInitialized = FALSE;

    SecBuffer  ExtraData;
    SECURITY_STATUS Status;

    PCCERT_CONTEXT pRemoteCertContext = NULL;

    INT i;
    INT iOption;
    PCHAR pszOption;

    //
    // Parse the command line.
    //

    if(argc <= 1)
    {
        Usage();
        return;
    }

    for(i = 1; i < argc; i++)
    {
        if(argv[i][0] == '/') argv[i][0] = '-';

        if(argv[i][0] != '-')
        {
            printf("**** Invalid argument \"%s\"\n", argv[i]);
            Usage();
            return;
        }

        iOption = argv[i][1];
        pszOption = &argv[i][2];

        switch(iOption)
        {
        case 's':
            pszServerName = pszOption;
            break;

        case 'p':
            iPortNumber = atoi(pszOption);
            break;

        case 'f':
            pszFileName = pszOption;
            break;

        case 'v':
            fVerbose = TRUE;
            break;

        case 'x':
            fUseProxy = TRUE;
            break;

        case 'u':
            pszUserName = pszOption;
            break;

        case 'P':
            switch(atoi(pszOption))
            {
                case 1:
                    dwProtocol = SP_PROT_PCT1;
                    break;
                case 2:
                    dwProtocol = SP_PROT_SSL2;
                    break;
                case 3:
                    dwProtocol = SP_PROT_SSL3;
                    break;
                case 4:
                    dwProtocol = SP_PROT_TLS1;
                    break;
                default:
                    dwProtocol = 0;
                    break;
            }
            break;

        case 'E':
            switch(atoi(pszOption))
            {
                case 1:
                    aiKeyExch = CALG_RSA_KEYX;
                    break;
                case 2:
                    aiKeyExch = CALG_DH_EPHEM;
                    break;
                default:
                    aiKeyExch = 0;
                    break;
            }
            break;

        default:
            printf("**** Invalid option \"%s\"\n", argv[i]);
            Usage();
            return;
        }
    }

    if(!LoadSecurityLibrary())
    {
        printf("Error initializing the security library\n");
        goto cleanup;
    }

    //
    // Initialize the WinSock subsystem.
    //

    if(WSAStartup(0x0101, &WsaData) == SOCKET_ERROR)
    {
        printf("Error %d returned by WSAStartup\n", GetLastError());
        goto cleanup;
    }

    //
    // Create credentials.
    //

    if(CreateCredentials(pszUserName, &hClientCreds))
    {
        printf("Error creating credentials\n");
        goto cleanup;
    }
    fCredsInitialized = TRUE;

    //
    // Connect to server.
    //

    if(ConnectToServer(pszServerName, iPortNumber, &Socket))
    {
        printf("Error connecting to server\n");
        goto cleanup;
    }

    //
    // Perform handshake
    //

    if(PerformClientHandshake(Socket,
                              &hClientCreds,
                              pszServerName,
                              &hContext,
                              &ExtraData))
    {
        printf("Error performing handshake\n");
        goto cleanup;
    }
    fContextInitialized = TRUE;

    //
    // Authenticate server's credentials.
    //

    // Get server's certificate.
    Status = g_pSSPI->QueryContextAttributes(&hContext,
                                             SECPKG_ATTR_REMOTE_CERT_CONTEXT,
                                             (PVOID)&pRemoteCertContext);
    if(Status != SEC_E_OK)
    {
        printf("Error 0x%x querying remote certificate\n", Status);
        goto cleanup;
    }

    // Display server certificate chain.
    DisplayCertChain(pRemoteCertContext, FALSE);

    // Attempt to validate server certificate.
    Status = VerifyServerCertificate(pRemoteCertContext,
                                     pszServerName,
                                     0);
    if(Status)
    {
        // The server certificate did not validate correctly. At this
        // point, we cannot tell if we are connecting to the correct
        // server, or if we are connecting to a "man in the middle"
        // attack server.

        // It is therefore best if we abort the connection.

        printf("**** Error 0x%x authenticating server credentials!\n", Status);
//        goto cleanup;
    }

    // Free the server certificate context.
    CertFreeCertificateContext(pRemoteCertContext);
    pRemoteCertContext = NULL;

    //
    // Display connection info.
    //

    DisplayConnectionInfo(&hContext);

    //
    // Read file from server.
    //

    if(HttpsGetFile(Socket,
                    &hClientCreds,
                    &hContext,
                    pszFileName))
    {
        printf("Error fetching file from server\n");
        goto cleanup;
    }

    //
    // Send a close_notify alert to the server and
    // close down the connection.
    //

    if(DisconnectFromServer(Socket, &hClientCreds, &hContext))
    {
        printf("Error disconnecting from server\n");
        goto cleanup;
    }
    fContextInitialized = FALSE;
    Socket = INVALID_SOCKET;

cleanup:

    // Free the server certificate context.
    if(pRemoteCertContext)
    {
        CertFreeCertificateContext(pRemoteCertContext);
        pRemoteCertContext = NULL;
    }

    // Free SSPI context handle.
    if(fContextInitialized)
    {
        g_pSSPI->DeleteSecurityContext(&hContext);
        fContextInitialized = FALSE;
    }

    // Free SSPI credentials handle.
    if(fCredsInitialized)
    {
        g_pSSPI->FreeCredentialsHandle(&hClientCreds);
        fCredsInitialized = FALSE;
    }

    // Close socket.
    if(Socket != INVALID_SOCKET)
    {
        closesocket(Socket);
    }

    // Shutdown WinSock subsystem.
    WSACleanup();

    // Close "MY" certificate store.
    if(hMyCertStore)
    {
        CertCloseStore(hMyCertStore, 0);
    }

    UnloadSecurityLibrary();

    printf("Done\n");
}

void UnloadSecurityLibrary ( void )

Definition at line 229 of file WebClient.c.

{
    FreeLibrary(g_hSecurity);
    g_hSecurity = NULL;
}

void Usage ( void )

Definition at line 135 of file WebClient.c.

{
    printf("\n");
    printf("USAGE: webclient -s<server> [ <options> ]\n");
    printf("\n");
    printf("    -s<server>      DNS name of server.\n");
    printf("    -p<port>        Port that server is listing on (default 443).\n");
    printf("    -f<file>        Name of file to retrieve (default \"%s\")\n", pszFileName);
    printf("    -v              Verbose Mode.\n");
    printf("    -x              Connect via the \"%s\" proxy server.\n", pszProxyServer);
    printf("\n");
    printf("    -P<protocol>    Protocol to use\n");
    printf("                        1 = PCT 1.0         3 = SSL 3.0\n");
    printf("                        2 = SSL 2.0         4 = TLS 1.0\n");
    printf("\n");
    printf("    -E<alg>         Key exchange algorithm to use\n");
    printf("                        1 = RSA             2 = DH\n");
    printf("\n");
    printf("  For client auth\n");
    printf("    -u<user>        Name of user (in existing client certificate)\n");
}

Variable Documentation

ALG_ID aiKeyExch = 0

Definition at line 49 of file WebClient.c.

DWORD dwProtocol = 0

Definition at line 48 of file WebClient.c.

BOOL fUseProxy = FALSE

Definition at line 46 of file WebClient.c.

BOOL fVerbose = FALSE

Definition at line 45 of file WebClient.c.

HMODULE g_hSecurity = NULL

Definition at line 54 of file WebClient.c.

PSecurityFunctionTable g_pSSPI

Definition at line 56 of file WebClient.c.

HCERTSTORE hMyCertStore = NULL

Definition at line 51 of file WebClient.c.

INT iPortNumber = 443

Definition at line 43 of file WebClient.c.

INT iProxyPort = 80

Definition at line 39 of file WebClient.c.

LPSTR pszFileName = "default.htm"

Definition at line 44 of file WebClient.c.

LPSTR pszProxyServer = "proxy"

Definition at line 38 of file WebClient.c.

LPSTR pszServerName = NULL

Definition at line 42 of file WebClient.c.

LPSTR pszUserName = NULL

Definition at line 47 of file WebClient.c.

SCHANNEL_CRED SchannelCred

Definition at line 52 of file WebClient.c.

Generated on Wed Nov 13 2024 16:54:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/SSPI/SSL/WebClient/WI_SSL_Client.Cpp File Reference

  • Security
  • SSPI
  • SSL
  • WebClient
Functions

WI_SSL_Client.Cpp File Reference

#include <windows.h>
#include <wininet.h>
#include <stdio.h>

Go to the source code of this file.

Functions

void main (int argc, char *argv[])

Function Documentation

void main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 37 of file WI_SSL_Client.Cpp.

{

    if(argc<2)
    {
        printf("USAGE: %s [webserver]\n", argv[0]);
        return;
    }

    // Open Internet session.
    HINTERNET hSession = InternetOpen(
                            "Wininet Client App",
                            PRE_CONFIG_INTERNET_ACCESS,
                            NULL,
                            INTERNET_INVALID_PORT_NUMBER,
                            0) ;

    // Connect to server\website.
    // NOTE: There must be a client authentication certificate
    // available that corresponds to the name of the server or
    // website that you are connecting to.
    // For instance, if I am running WebServer on machine davemo1,
    // then I can specify "davemo1" as the webserver. I must have a
    // client authentication certificate available
    HINTERNET hConnect = InternetConnect(
                            hSession,
                            argv[1],
                            INTERNET_DEFAULT_HTTPS_PORT,
                            "",
                            "",
                            INTERNET_SERVICE_HTTP,
                            0,
                            0) ;

    // Request the file default.htm from the server.
    HINTERNET hHttpFile = HttpOpenRequest(
                            hConnect,
                            "GET",
                            "default.htm",
                            HTTP_VERSION,
                            "",
                            NULL,
                            INTERNET_FLAG_SECURE,
                            0) ;

    //
    // Send the request and check for success
    //
    while(!HttpSendRequest(hHttpFile, NULL, 0, 0, 0))
    {

        // If the server requires a client certificate I'll invoke
        // this nifty dialogue to select a certificate and
        // reset the options for the request.

        printf("HttpSendRequest error : (%lu)\n", GetLastError());

        InternetErrorDlg (
            GetDesktopWindow(),
            hHttpFile,
            ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED,
            FLAGS_ERROR_UI_FILTER_FOR_ERRORS |
            FLAGS_ERROR_UI_FLAGS_GENERATE_DATA |
            FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS,
            NULL);

    }

    // Get the length of the file.
    char bufQuery[32] ;

    DWORD dwLengthBufQuery;
    dwLengthBufQuery = sizeof(bufQuery);

    DWORD dwIndex;
    dwIndex=0;

    BOOL bQuery;

    bQuery = HttpQueryInfo(
                hHttpFile,
                HTTP_QUERY_CONTENT_LENGTH,
                bufQuery,
                &dwLengthBufQuery,
                &dwIndex) ;

    if(!bQuery)
        printf("HttpQueryInfo error : <%lu>\n", GetLastError());

    // Convert length from ASCII string to a DWORD.
    DWORD dwFileSize;

    dwFileSize = (DWORD)atol(bufQuery) ;

    // Allocate a buffer for the file.
    char* buffer;

    buffer = new char[dwFileSize+1] ;

    printf("Trying to read %lu bytes from the server\n", dwFileSize);

    // Read the file into the buffer.
    DWORD dwBytesRead ;
    BOOL bRead;

    bRead = InternetReadFile(
                hHttpFile,
                buffer,
                dwFileSize+1,
                &dwBytesRead);

    if(!bRead)
    {
        printf("InternetReadFile error : <%lu>\n", GetLastError());
    }
    else
    {
        // Put a zero on the end of the buffer.
        buffer[dwBytesRead] = 0 ;

        // Print the buffer contents.
        printf("Retrieved %lu data bytes: %s\n", dwBytesRead, buffer) ;
    }

    // Close all of the Internet handles.
    InternetCloseHandle(hHttpFile);
    InternetCloseHandle(hConnect) ;
    InternetCloseHandle(hSession) ;

}

Generated on Wed Nov 13 2024 16:54:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Security/SSPI/SSL/WebServer/WebServer.c File Reference

  • Security
  • SSPI
  • SSL
  • WebServer
Defines | Functions | Variables

WebServer.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <winsock.h>
#include <wincrypt.h>
#include <wintrust.h>
#include <schannel.h>
#include <security.h>
#include <sspi.h>

Go to the source code of this file.

Defines

#define | DLL_NAME TEXT("Secur32.dll")
#define | IO_BUFFER_SIZE 0x10000
#define | NT4_DLL_NAME TEXT("Security.dll")
#define | SECURITY_WIN32

Functions

BOOL | LoadSecurityLibrary (void)
void _cdecl | main (int argc, char *argv[])
void | UnloadSecurityLibrary (void)
void | Usage (void)

Variables

DWORD | cbIoBuffer = 0
DWORD | dwProtocol = 0
BOOL | fClientAuth = FALSE
BOOL | fMachineStore = FALSE
BOOL | fVerbose = FALSE
HMODULE | g_hSecurity = NULL
PSecurityFunctionTable | g_pSSPI
HCERTSTORE | hMyCertStore = NULL
CHAR | IoBuffer [IO_BUFFER_SIZE]
INT | iPortNumber = 443
LPSTR | pszUserName = NULL

Define Documentation

#define DLL_NAME TEXT("Secur32.dll")

Definition at line 33 of file WebServer.c.

#define IO_BUFFER_SIZE 0x10000

Definition at line 32 of file WebServer.c.

#define NT4_DLL_NAME TEXT("Security.dll")

Definition at line 34 of file WebServer.c.

#define SECURITY_WIN32

Definition at line 28 of file WebServer.c.

Function Documentation

BOOL LoadSecurityLibrary ( void )

Definition at line 112 of file WebServer.c.

{
    INIT_SECURITY_INTERFACE         pInitSecurityInterface;
    QUERY_CREDENTIALS_ATTRIBUTES_FN pQueryCredentialsAttributes;
    OSVERSIONINFO VerInfo;
    UCHAR lpszDLL[MAX_PATH];

    //
    //  Find out which security DLL to use, depending on
    //  whether we are on Win2k, NT or Win9x
    //

    VerInfo.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
    if (!GetVersionEx (&VerInfo))
    {
        return FALSE;
    }

    if (VerInfo.dwPlatformId == VER_PLATFORM_WIN32_NT
        && VerInfo.dwMajorVersion == 4)
    {
        strcpy (lpszDLL, NT4_DLL_NAME );
    }
    else if (VerInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS ||
          VerInfo.dwPlatformId == VER_PLATFORM_WIN32_NT )
    {
        strcpy (lpszDLL, DLL_NAME );
    }
    else
    {
        return FALSE;
    }

    //
    //  Load Security DLL
    //

    g_hSecurity = LoadLibrary(lpszDLL);
    if(g_hSecurity == NULL)
    {
        printf("Error 0x%x loading %s.\n", GetLastError(), lpszDLL);
        return FALSE;
    }

    pInitSecurityInterface = (INIT_SECURITY_INTERFACE)GetProcAddress(
                                    g_hSecurity,
                                    "InitSecurityInterfaceA");

    if(pInitSecurityInterface == NULL)
    {
        printf("Error 0x%x reading InitSecurityInterface entry point.\n",
               GetLastError());
        return FALSE;
    }

    g_pSSPI = pInitSecurityInterface();

    if(g_pSSPI == NULL)
    {
        printf("Error 0x%x reading security interface.\n",
               GetLastError());
        return FALSE;
    }

    return TRUE;
}

void _cdecl main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 189 of file WebServer.c.

{
    WSADATA WsaData;
    CredHandle hServerCreds;

    INT i;
    INT iOption;
    PCHAR pszOption;

    //
    // Parse the command line.
    //

    if(argc <= 1)
    {
        Usage();
    }

    for(i = 1; i < argc; i++)
    {
        if(argv[i][0] == '/') argv[i][0] = '-';

        if(argv[i][0] != '-')
        {
            printf("**** Invalid argument \"%s\"\n", argv[i]);
            Usage();
        }

        iOption = argv[i][1];
        pszOption = &argv[i][2];

        switch(iOption)
        {
        case 'p':
            iPortNumber = atoi(pszOption);
            break;

        case 'v':
            fVerbose = TRUE;
            break;

        case 'u':
            pszUserName = pszOption;
            fMachineStore = FALSE;
            break;

        case 'U':
            pszUserName = pszOption;
            fMachineStore = TRUE;
            break;

        case 'a':
            fClientAuth = TRUE;
            break;

        case 'P':
            switch(atoi(pszOption))
            {
                case 2:
                    dwProtocol = SP_PROT_SSL2;
                    break;
                case 3:
                    dwProtocol = SP_PROT_SSL3;
                    break;
                case 4:
                    dwProtocol = SP_PROT_TLS1;
                    break;
                default:
                    dwProtocol = 0;
                    break;
            }
            break;

        default:
            printf("**** Invalid option \"%s\"\n", argv[i]);
            Usage();
        }
    }

    if(!LoadSecurityLibrary())
    {
        printf("Error initializing the security library\n");
        return;
    }

    //
    // Initialize the WinSock subsystem.
    //

    if(WSAStartup(0x0101, &WsaData) == SOCKET_ERROR)
    {
        printf("Error %d returned by WSAStartup\n", GetLastError());
        exit(1);
    }

    //
    // NOTE: In theory, an application could enumerate the security packages
    // until it finds one with attributes it likes. Some applications
    // (such as IIS) enumerate the packages and call AcquireCredentialsHandle
    // on each until it finds one that accepts the SCHANNEL_CRED structure.
    // If an application has its heart set on using SSL, like this sample does,
    // then just hardcoding the UNISP_NAME package name when calling
    // AcquireCredentialsHandle is not a bad thing.
    //

    //
    // Create credentials.
    //

    if(CreateCredentials(pszUserName, &hServerCreds))
    {
        printf("Error creating credentials\n");
        exit(1);
    }

    WebServer(&hServerCreds);

    // Free SSPI credentials handle.
    g_pSSPI->FreeCredentialsHandle(&hServerCreds);

    // Shutdown WinSock subsystem.
    WSACleanup();

    // Close "MY" certificate store.
    if(hMyCertStore)
    {
        CertCloseStore(hMyCertStore, 0);
    }

    exit(0);
}

void UnloadSecurityLibrary ( void )

Definition at line 181 of file WebServer.c.

{
    FreeLibrary(g_hSecurity);
    g_hSecurity = NULL;
}

void Usage ( void )

Definition at line 92 of file WebServer.c.

{
    printf("\n");
    printf("USAGE: webserver -u<user> [ <options> ]\n");
    printf("\n");
    printf("    -u<user>        Name of user (in existing certificate)\n");
    printf("    -U<user>        Name of user (machine store)\n");
    printf("    -p<port>        Port to listen on (default 443).\n");
    printf("    -a              Ask for client authentication.\n");
    printf("    -v              Verbose Mode.\n");
    printf("    -P<protocol>    Protocol to use\n");
    printf("                        2 = SSL 2.0\n");
    printf("                        3 = SSL 3.0\n");
    printf("                        4 = TLS 1.0\n");

    exit(1);
}

Variable Documentation

DWORD cbIoBuffer = 0

Definition at line 47 of file WebServer.c.

DWORD dwProtocol = 0

Definition at line 42 of file WebServer.c.

BOOL fClientAuth = FALSE

Definition at line 40 of file WebServer.c.

BOOL fMachineStore = FALSE

Definition at line 41 of file WebServer.c.

BOOL fVerbose = FALSE

Definition at line 38 of file WebServer.c.

HMODULE g_hSecurity = NULL

Definition at line 49 of file WebServer.c.

PSecurityFunctionTable g_pSSPI

Definition at line 51 of file WebServer.c.

HCERTSTORE hMyCertStore = NULL

Definition at line 44 of file WebServer.c.

CHAR IoBuffer[IO_BUFFER_SIZE]

Definition at line 46 of file WebServer.c.

INT iPortNumber = 443

Definition at line 37 of file WebServer.c.

LPSTR pszUserName = NULL

Definition at line 39 of file WebServer.c.

Generated on Wed Nov 13 2024 16:54:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/About/about.Cpp File Reference

  • SysMgmt
  • MMC
  • About
Functions

about.Cpp File Reference

#include "About.h"
#include "resource.h"
#include "globals.h"
#include <crtdbg.h>

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CSnapinAbout

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 89 of file about.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        // we need to decrement our object count in the DLL
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:54:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/About/about.h File Reference

  • SysMgmt
  • MMC
  • About
Classes

about.h File Reference

#include <tchar.h>
#include <mmc.h>

Go to the source code of this file.

Classes

class CSnapinAbout
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/About/basesnap.Cpp File Reference

  • SysMgmt
  • MMC
  • About
Functions | Variables

basesnap.Cpp File Reference

#include <objbase.h>
#include <olectl.h>
#include <initguid.h>
#include "guids.h"
#include "basesnap.h"
#include "Comp.h"
#include "CompData.h"
#include "About.h"
#include "Registry.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)
BOOL WINAPI | DllMain (HINSTANCE hinstDLL, DWORD fdwReason, void *lpvReserved)
STDAPI | DllRegisterServer ()
STDAPI | DllUnregisterServer ()
STDMETHODIMP_ (ULONG) CClassFactory

Variables

HINSTANCE | g_hinst

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 77 of file basesnap.Cpp.

{
    if (g_uObjects == 0 && g_uSrvLock == 0)
        return S_OK;
    else
        return S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 45 of file basesnap.Cpp.

{
    if ((rclsid != CLSID_CComponentData) && (rclsid != CLSID_CSnapinAbout))
        return CLASS_E_CLASSNOTAVAILABLE;

    if (!ppvObj)
        return E_FAIL;

    *ppvObj = NULL;

    // We can only hand out IUnknown and IClassFactory pointers.  Fail
    // if they ask for anything else.
    if (!IsEqualIID(riid, IID_IUnknown) && !IsEqualIID(riid, IID_IClassFactory))
        return E_NOINTERFACE;

    CClassFactory *pFactory = NULL;

    // make the factory passing in the creation function for the type of object they want
    if (rclsid == CLSID_CComponentData)
        pFactory = new CClassFactory(CClassFactory::COMPONENT);
    else if (rclsid == CLSID_CSnapinAbout)
        pFactory = new CClassFactory(CClassFactory::ABOUT);

    if (NULL == pFactory)
        return E_OUTOFMEMORY;

    HRESULT hr = pFactory->QueryInterface(riid, ppvObj);

    return hr;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hinstDLL,
 |  | DWORD | fdwReason,
 |  | void * | lpvReserved
 | ) |  |

Definition at line 32 of file basesnap.Cpp.

{

    if (fdwReason == DLL_PROCESS_ATTACH) {
        g_hinst = hinstDLL;
    }

    return TRUE;
}

STDAPI DllRegisterServer ( void )

Definition at line 187 of file basesnap.Cpp.

{
    HRESULT hr = SELFREG_E_CLASS;
    _TCHAR szName[256];
    _TCHAR szSnapInName[256];

    LoadString(g_hinst, IDS_NAME, szName, (sizeof szName)/(sizeof szName[0]));
    LoadString(g_hinst, IDS_SNAPINNAME, szSnapInName, (sizeof szSnapInName)/(sizeof szSnapInName[0]));

    _TCHAR szAboutName[256];

    LoadString(g_hinst, IDS_ABOUTNAME, szAboutName, (sizeof szAboutName)/(sizeof szAboutName[0]));

    // register our CoClasses
    hr = RegisterServer(g_hinst,
        CLSID_CComponentData,
        szName);

    if SUCCEEDED(hr)
        hr = RegisterServer(g_hinst,
        CLSID_CSnapinAbout,
        szAboutName);

    // place the registry information for SnapIns
    if SUCCEEDED(hr)
        hr = RegisterSnapin(CLSID_CComponentData, szSnapInName, CLSID_CSnapinAbout, FALSE);

    return hr;
}

STDAPI DllUnregisterServer ( void )

Definition at line 218 of file basesnap.Cpp.

{
    if (UnregisterServer(CLSID_CComponentData) == S_OK)
        return UnregisterSnapin(CLSID_CComponentData);
    else
        return E_FAIL;
}

STDMETHODIMP_ ( ULONG )

Definition at line 124 of file basesnap.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;
}

Variable Documentation

HINSTANCE g_hinst

Definition at line 30 of file basesnap.Cpp.

Generated on Wed Nov 13 2024 16:54:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/About/basesnap.h File Reference

  • SysMgmt
  • MMC
  • About
Classes | Functions | Variables

basesnap.h File Reference

Go to the source code of this file.

Classes

class | CClassFactory

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)

Variables

ULONG | g_uObjects = 0
ULONG | g_uSrvLock = 0

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 53 of file ComSpyAudit.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 61 of file ComSpyAudit.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

Variable Documentation

ULONG g_uObjects = 0

Definition at line 24 of file basesnap.h.

ULONG g_uSrvLock = 0

Definition at line 25 of file basesnap.h.

Generated on Wed Nov 13 2024 16:54:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/About/comp.Cpp File Reference

  • SysMgmt
  • MMC
  • About
Functions

comp.Cpp File Reference

#include "Comp.h"
#include "DataObj.h"
#include <commctrl.h>
#include <crtdbg.h>
#include "globals.h"
#include "resource.h"
#include "DeleBase.h"
#include "CompData.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CComponent

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 65 of file comp.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/About/comp.h File Reference

  • SysMgmt
  • MMC
  • About
Classes

comp.h File Reference

#include <mmc.h>

Go to the source code of this file.

Classes

class CComponent
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/About/compdata.Cpp File Reference

  • SysMgmt
  • MMC
  • About
Functions

compdata.Cpp File Reference

#include "Comp.h"
#include "CompData.h"
#include "DataObj.h"
#include "resource.h"
#include <crtdbg.h>

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CComponentData

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 72 of file compdata.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        // we need to decrement our object count in the DLL
        delete this;
        return 0;
    }

    return m_cref;
}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/About/compdata.h File Reference

  • SysMgmt
  • MMC
  • About
Classes

compdata.h File Reference

#include <mmc.h>
#include "DeleBase.h"
#include "StatNode.h"
#include "Comp.h"
#include "DeleBase.h"
#include "StatNode.h"

Go to the source code of this file.

Classes

class CComponentData
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/About/dataobj.Cpp File Reference

  • SysMgmt
  • MMC
  • About
Defines | Functions

dataobj.Cpp File Reference

#include "DataObj.h"
#include "guids.h"
#include "DeleBase.h"

Go to the source code of this file.

Defines

#define | _T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")
#define | _T_CCF_INTERNAL_SNAPIN _T("{2479DB32-5276-11d2-94F5-00C04FB92EC2}")
#define | _T_CCF_NODETYPE _T("CCF_NODETYPE")
#define | _T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")
#define | _T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")

Functions

CDataObject * | GetOurDataObject (LPDATAOBJECT lpDataObject)
STDMETHODIMP_ (ULONG) CDataObject

Define Documentation

#define _T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")

Definition at line 31 of file dataobj.Cpp.

#define _T_CCF_INTERNAL_SNAPIN _T("{2479DB32-5276-11d2-94F5-00C04FB92EC2}")

Definition at line 36 of file dataobj.Cpp.

#define _T_CCF_NODETYPE _T("CCF_NODETYPE")

Definition at line 32 of file dataobj.Cpp.

#define _T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")

Definition at line 34 of file dataobj.Cpp.

#define _T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")

Definition at line 33 of file dataobj.Cpp.

Function Documentation

CDataObject* GetOurDataObject ( LPDATAOBJECT lpDataObject )

Definition at line 165 of file dataobj.Cpp.

{
    HRESULT       hr      = S_OK;
    CDataObject *pSDO     = NULL;

  // check to see if the data object is a special data object.
  if ( IS_SPECIAL_DATAOBJECT (lpDataObject) )
  {
    //Code for handling a special data object goes here.

    //Note that the MMC SDK samples do not handle
    //special data objects, so we exit if we get one.
    return NULL;
  }

    STGMEDIUM stgmedium = { TYMED_HGLOBAL,  NULL  };
    FORMATETC formatetc = { CDataObject::s_cfInternal, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };

    // Allocate memory for the stream
    stgmedium.hGlobal = GlobalAlloc( GMEM_SHARE, sizeof(CDataObject *));

    if (!stgmedium.hGlobal) {
        hr = E_OUTOFMEMORY;
    }

    if SUCCEEDED(hr)
        // Attempt to get data from the object
        hr = lpDataObject->GetDataHere( &formatetc, &stgmedium );

    // stgmedium now has the data we need
    if (SUCCEEDED(hr))  {
        pSDO = *(CDataObject **)(stgmedium.hGlobal);
    }

    // if we have memory free it
    if (stgmedium.hGlobal)
        GlobalFree(stgmedium.hGlobal);

    return pSDO;

} // end GetOurDataObject()

STDMETHODIMP_ ( ULONG )

Definition at line 87 of file dataobj.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/About/dataobj.h File Reference

  • SysMgmt
  • MMC
  • About
Classes | Functions

dataobj.h File Reference

#include <mmc.h>
#include "DeleBase.h"

Go to the source code of this file.

Classes

class | CDataObject

Functions

HRESULT | ExtractFromDataObject (IDataObject *lpDataObject, UINT cf, ULONG cb, HGLOBAL *phGlobal)
CDataObject * | GetOurDataObject (IDataObject *lpDataObject)
BOOL | IsMMCMultiSelectDataObject (IDataObject *lpDataObject)

Function Documentation

HRESULT ExtractFromDataObject | ( | IDataObject * | lpDataObject,
 |  | UINT | cf,
 |  | ULONG | cb,
 |  | HGLOBAL * | phGlobal
 | ) |  |
CDataObject* GetOurDataObject ( IDataObject * lpDataObject )
BOOL IsMMCMultiSelectDataObject ( IDataObject * lpDataObject )
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/About/delebase.Cpp File Reference

  • SysMgmt
  • MMC
  • About

delebase.Cpp File Reference

#include "DeleBase.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/About/delebase.h File Reference

  • SysMgmt
  • MMC
  • About
Classes

delebase.h File Reference

#include <mmc.h>
#include <crtdbg.h>
#include "globals.h"
#include "resource.h"
#include "LocalRes.h"
#include "LocalRes.h"

Go to the source code of this file.

Classes

class CDelegationBase
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/About/globals.h File Reference

  • SysMgmt
  • MMC
  • About
Classes | Defines | Functions | Variables

globals.h File Reference

#include <tchar.h>

Go to the source code of this file.

Classes

class | TempBuffer

Defines

#define | IDM_BUTTON1 0x100
#define | IDM_BUTTON2 0x101
#define | MAKE_TSTRPTR_FROMWIDE(ptrname, widestr)
#define | MAKE_WIDEPTR_FROMTSTR(ptrname, tstr)
#define | MAKE_WIDEPTR_FROMTSTR_ALLOC(ptrname, tstr)
#define | OBJECT_CREATED InterlockedIncrement((long *)&g_uObjects);
#define | OBJECT_DESTROYED InterlockedDecrement((long *)&g_uObjects);

Functions

void | MMCN_Crack (BOOL bComponentData, IDataObject *pDataObject, IComponentData *pCompData, IComponent *pComp, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)

Variables

HINSTANCE | g_hinst
ULONG g_uObjects

Define Documentation

#define IDM_BUTTON1 0x100

Definition at line 25 of file globals.h.

#define IDM_BUTTON2 0x101

Definition at line 26 of file globals.h.

#define MAKE_TSTRPTR_FROMWIDE | ( | ptrname,
 |  | widestr
 | ) |
Value:
long __l##ptrname = (wcslen(widestr) + 1) * 2 * sizeof(TCHAR); \
    TempBuffer __TempBuffer##ptrname(__l##ptrname); \
    WideCharToMultiByte(CP_ACP, 0, widestr, -1, (LPSTR)__TempBuffer##ptrname.GetBuffer(), __l##ptrname, NULL, NULL); \
    LPTSTR ptrname = (LPTSTR)__TempBuffer##ptrname.GetBuffer()

Definition at line 127 of file globals.h.

#define MAKE_WIDEPTR_FROMTSTR | ( | ptrname,
 |  | tstr
 | ) |
Value:
long __cch##ptrname = (lstrlenA(tstr) + 1);\
    long __l##ptrname = (lstrlenA(tstr) + 1) * sizeof(WCHAR); \
    TempBuffer __TempBuffer##ptrname(__l##ptrname); \
    MultiByteToWideChar(CP_ACP, 0, tstr, -1, (LPWSTR)__TempBuffer##ptrname.GetBuffer(), __cch##ptrname); \
    LPWSTR ptrname = (LPWSTR)__TempBuffer##ptrname.GetBuffer()

Definition at line 93 of file globals.h.

#define MAKE_WIDEPTR_FROMTSTR_ALLOC | ( | ptrname,
 |  | tstr
 | ) |
Value:
long __cch##ptrname = (lstrlenA(tstr) + 1);\
    long __l##ptrname = (lstrlenA(tstr) + 1) * sizeof(WCHAR); \
    LPWSTR ptrname = (LPWSTR)CoTaskMemAlloc(__l##ptrname); \
    MultiByteToWideChar(CP_ACP, 0, tstr, -1, ptrname, __cch##ptrname)

Definition at line 107 of file globals.h.

#define OBJECT_CREATED InterlockedIncrement((long *)&g_uObjects);

Definition at line 31 of file globals.h.

#define OBJECT_DESTROYED InterlockedDecrement((long *)&g_uObjects);

Definition at line 32 of file globals.h.

Function Documentation

void MMCN_Crack | ( | BOOL | bComponentData,
 |  | IDataObject * | pDataObject,
 |  | IComponentData * | pCompData,
 |  | IComponent * | pComp,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param
 | ) |  |

Definition at line 59 of file mmccrack.Cpp.

{
#ifdef MMC_CRACK_MESSAGES
        const size_t cchMessage = 256;
  TCHAR message[cchMessage] = {0};

  if (bComponentData == TRUE)
    OutputDebugString(_T("IComponentData::Notify( "));
  else
    OutputDebugString(_T("IComponent::Notify( "));

  wsprintf(message, _T("DataObject: %08x, CompData: %08x, Comp: %08x ) - "), pDataObject, pCompData, pComp);
  OutputDebugString(message);

    switch (event)  {
    case MMCN_ACTIVATE:
      wsprintf(message, _T("MMCN_ACTIVATE\n\tActivate: %d\n"), arg);
      break;

    case MMCN_ADD_IMAGES:
      wsprintf(message, _T("MMCN_ADD_IMAGES\n\tImage List: %08x\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_BTN_CLICK:
      wsprintf(message, _T("MMCN_BTN_CLICK\n\tVerb: %ws\n"), MMCN_CrackVerb((MMC_CONSOLE_VERB)param));
      break;

    case MMCN_COLUMN_CLICK:
      wsprintf(message, _T("MMCN_COLUMN_CLICK\n\tColumn: %d\n\tSort Option: %d\n"), arg,   param);
      break;

    case MMCN_COLUMNS_CHANGED:
      wsprintf(message, _T("MMCN_COLUMNS_CHANGED\n"));
      break;

    case MMCN_CONTEXTHELP:
      wsprintf(message, _T("MMCN_CONTEXTHELP\n"));
      break;

    case MMCN_CONTEXTMENU:
      wsprintf(message, _T("MMCN_CONTEXTMENU\n"));
      break;

    case MMCN_CUTORMOVE:
      wsprintf(message, _T("MMCN_CUTORMOVE\n"));
      break;

    case MMCN_DBLCLICK:
      wsprintf(message, _T("MMCN_DBLCLICK\n"));
      break;

    case MMCN_DELETE:
      wsprintf(message, _T("MMCN_DELETE\n"));
      break;

    case MMCN_DESELECT_ALL:
      wsprintf(message, _T("MMCN_DESELECT_ALL\n"));
      break;

    case MMCN_EXPAND:
      wsprintf(message, _T("MMCN_EXPAND\n\tExpand: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_EXPANDSYNC:
      wsprintf(message, _T("MMCN_EXPANDSYNC\n"));
      break;

    case MMCN_FILTERBTN_CLICK:
      wsprintf(message, _T("MMCN_FILTERBTN_CLICK\n\tColumn: %d\n"), arg);
      break;

    case MMCN_FILTER_CHANGE:
      wsprintf(message, _T("MMCN_FILTER_CHANGE\n\tColumn: %d\n"), param);
      break;

    case MMCN_HELP:
      wsprintf(message, _T("MMCN_HELP\n"));
      break;

    case MMCN_INITOCX:
      wsprintf(message, _T("MMCN_INITOCX\n\tIUnknown: %08x\n"), param);
      break;

    case MMCN_LISTPAD:
      wsprintf(message, _T("MMCN_LISTPAD\n\tConnect: %d\n"), arg);
      break;

    case MMCN_MENU_BTNCLICK:
      wsprintf(message, _T("MMCN_MENU_BTNCLICK\n"));
      break;

    case MMCN_MINIMIZED:
      wsprintf(message, _T("MMCN_MINIMIZED\n\tMinimized: %d\n"), arg);
      break;

    case MMCN_PASTE:
      wsprintf(message, _T("MMCN_PASTE\n\tCopy: %d\n"), param == NULL);
      break;

    case MMCN_PRELOAD:
      wsprintf(message, _T("MMCN_PRELOAD\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_PRINT:
      wsprintf(message, _T("MMCN_PRINT\n"));
      break;

    case MMCN_PROPERTY_CHANGE:
      wsprintf(message, _T("MMCN_PROPERTY_CHANGE\n\tScope: %d\n\tArg: %08x\n"), arg, param);
      break;

    case MMCN_QUERY_PASTE:
      wsprintf(message, _T("MMCN_QUERY_PASTE\n"));
      break;

    case MMCN_REFRESH:
      wsprintf(message, _T("MMCN_REFRESH\n"));
      break;

    case MMCN_REMOVE_CHILDREN:
      wsprintf(message, _T("MMCN_REMOVE_CHILDREN\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_RENAME:
                        // Destination string may contain a truncation of the ideal result.
                        // (Indicated by return value other than S_OK).
                        // However, it will be null-terminated.
      StringCchPrintf(message, cchMessage, _T("MMCN_RENAME\n\tNew Name: '%ws'\n"), (LPOLESTR)param);
      break;

    case MMCN_RESTORE_VIEW:
      wsprintf(message, _T("MMCN_RESTORE_VIEW\n"));
      break;

    case MMCN_SELECT:
      wsprintf(message, _T("MMCN_SELECT\n\tScope: %d\n\tSelect: %08x\n"), LOWORD(arg), HIWORD(arg));
      break;

    case MMCN_SHOW:
      wsprintf(message, _T("MMCN_SHOW\n\tShow: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_SNAPINHELP:
      wsprintf(message, _T("MMCN_SNAPINHELP\n"));
      break;

    case MMCN_VIEW_CHANGE:
      wsprintf(message, _T("MMCN_VIEW_CHANGE\n\tData: %08x\n\tHint: %08x\n"), arg, param);
      break;
  }

  if (message[0] != 0)
    OutputDebugString(message);
  else
    OutputDebugString(_T("unknown event\n"));

#endif
  return;
}

Variable Documentation

HINSTANCE g_hinst

Definition at line 33 of file SetDisp.h.

ULONG g_uObjects

Definition at line 24 of file basesnap.h.

Generated on Wed Nov 13 2024 16:54:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/About/guids.h File Reference

  • SysMgmt
  • MMC
  • About
Functions

guids.h File Reference

Go to the source code of this file.

Functions

DEFINE_GUID (CLSID_CComponentData, 0x22612902, 0x79b5, 0x11d2, 0x95, 0x8, 0x0, 0xc0, 0x4f, 0xb9, 0x2e, 0xc2)
DEFINE_GUID (CLSID_CSnapinAbout, 0x22612904, 0x79b5, 0x11d2, 0x95, 0x8, 0x0, 0xc0, 0x4f, 0xb9, 0x2e, 0xc2)

Function Documentation

DEFINE_GUID | ( | CLSID_CComponentData | ,
 |  | 0x22612902 | ,
 |  | 0x79b5 | ,
 |  | 0x11d2 | ,
 |  | 0x95 | ,
 |  | 0x8 | ,
 |  | 0x0 | ,
 |  | 0xc0 | ,
 |  | 0x4f | ,
 |  | 0xb9 | ,
 |  | 0x2e | ,
 |  | 0xc2 |
 | ) |  |
DEFINE_GUID | ( | CLSID_CSnapinAbout | ,
 |  | 0x22612904 | ,
 |  | 0x79b5 | ,
 |  | 0x11d2 | ,
 |  | 0x95 | ,
 |  | 0x8 | ,
 |  | 0x0 | ,
 |  | 0xc0 | ,
 |  | 0x4f | ,
 |  | 0xb9 | ,
 |  | 0x2e | ,
 |  | 0xc2 |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/About/localres.h File Reference

  • SysMgmt
  • MMC
  • About
Defines

localres.h File Reference

Go to the source code of this file.

Defines

#define | INDEX_CLOSEDFOLDER 4
#define | INDEX_LANDICON 1
#define | INDEX_NONE -1
#define | INDEX_OPENFOLDER 5
#define | INDEX_PEOPLEICON 3
#define | INDEX_SKYICON 2
#define | INDEX_SPACEICON 0

Define Documentation

#define INDEX_CLOSEDFOLDER 4

Definition at line 27 of file localres.h.

#define INDEX_LANDICON 1

Definition at line 24 of file localres.h.

#define INDEX_NONE -1

Definition at line 22 of file localres.h.

#define INDEX_OPENFOLDER 5

Definition at line 28 of file localres.h.

#define INDEX_PEOPLEICON 3

Definition at line 26 of file localres.h.

#define INDEX_SKYICON 2

Definition at line 25 of file localres.h.

#define INDEX_SPACEICON 0

Definition at line 23 of file localres.h.

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/About/mmccrack.Cpp File Reference

  • SysMgmt
  • MMC
  • About
Defines | Functions

mmccrack.Cpp File Reference

#include <mmc.h>
#include <winuser.h>
#include <tchar.h>
#include "globals.h"
#include <strsafe.h>

Go to the source code of this file.

Defines

#define | STRSAFE_NO_DEPRECATE

Functions

void | MMCN_Crack (BOOL bComponentData, IDataObject *pDataObject, IComponentData *pCompData, IComponent *pComp, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)

Define Documentation

#define STRSAFE_NO_DEPRECATE

Definition at line 25 of file mmccrack.Cpp.

Function Documentation

void MMCN_Crack | ( | BOOL | bComponentData,
 |  | IDataObject * | pDataObject,
 |  | IComponentData * | pCompData,
 |  | IComponent * | pComp,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param
 | ) |  |

Definition at line 59 of file mmccrack.Cpp.

{
#ifdef MMC_CRACK_MESSAGES
        const size_t cchMessage = 256;
  TCHAR message[cchMessage] = {0};

  if (bComponentData == TRUE)
    OutputDebugString(_T("IComponentData::Notify( "));
  else
    OutputDebugString(_T("IComponent::Notify( "));

  wsprintf(message, _T("DataObject: %08x, CompData: %08x, Comp: %08x ) - "), pDataObject, pCompData, pComp);
  OutputDebugString(message);

    switch (event)  {
    case MMCN_ACTIVATE:
      wsprintf(message, _T("MMCN_ACTIVATE\n\tActivate: %d\n"), arg);
      break;

    case MMCN_ADD_IMAGES:
      wsprintf(message, _T("MMCN_ADD_IMAGES\n\tImage List: %08x\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_BTN_CLICK:
      wsprintf(message, _T("MMCN_BTN_CLICK\n\tVerb: %ws\n"), MMCN_CrackVerb((MMC_CONSOLE_VERB)param));
      break;

    case MMCN_COLUMN_CLICK:
      wsprintf(message, _T("MMCN_COLUMN_CLICK\n\tColumn: %d\n\tSort Option: %d\n"), arg,   param);
      break;

    case MMCN_COLUMNS_CHANGED:
      wsprintf(message, _T("MMCN_COLUMNS_CHANGED\n"));
      break;

    case MMCN_CONTEXTHELP:
      wsprintf(message, _T("MMCN_CONTEXTHELP\n"));
      break;

    case MMCN_CONTEXTMENU:
      wsprintf(message, _T("MMCN_CONTEXTMENU\n"));
      break;

    case MMCN_CUTORMOVE:
      wsprintf(message, _T("MMCN_CUTORMOVE\n"));
      break;

    case MMCN_DBLCLICK:
      wsprintf(message, _T("MMCN_DBLCLICK\n"));
      break;

    case MMCN_DELETE:
      wsprintf(message, _T("MMCN_DELETE\n"));
      break;

    case MMCN_DESELECT_ALL:
      wsprintf(message, _T("MMCN_DESELECT_ALL\n"));
      break;

    case MMCN_EXPAND:
      wsprintf(message, _T("MMCN_EXPAND\n\tExpand: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_EXPANDSYNC:
      wsprintf(message, _T("MMCN_EXPANDSYNC\n"));
      break;

    case MMCN_FILTERBTN_CLICK:
      wsprintf(message, _T("MMCN_FILTERBTN_CLICK\n\tColumn: %d\n"), arg);
      break;

    case MMCN_FILTER_CHANGE:
      wsprintf(message, _T("MMCN_FILTER_CHANGE\n\tColumn: %d\n"), param);
      break;

    case MMCN_HELP:
      wsprintf(message, _T("MMCN_HELP\n"));
      break;

    case MMCN_INITOCX:
      wsprintf(message, _T("MMCN_INITOCX\n\tIUnknown: %08x\n"), param);
      break;

    case MMCN_LISTPAD:
      wsprintf(message, _T("MMCN_LISTPAD\n\tConnect: %d\n"), arg);
      break;

    case MMCN_MENU_BTNCLICK:
      wsprintf(message, _T("MMCN_MENU_BTNCLICK\n"));
      break;

    case MMCN_MINIMIZED:
      wsprintf(message, _T("MMCN_MINIMIZED\n\tMinimized: %d\n"), arg);
      break;

    case MMCN_PASTE:
      wsprintf(message, _T("MMCN_PASTE\n\tCopy: %d\n"), param == NULL);
      break;

    case MMCN_PRELOAD:
      wsprintf(message, _T("MMCN_PRELOAD\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_PRINT:
      wsprintf(message, _T("MMCN_PRINT\n"));
      break;

    case MMCN_PROPERTY_CHANGE:
      wsprintf(message, _T("MMCN_PROPERTY_CHANGE\n\tScope: %d\n\tArg: %08x\n"), arg, param);
      break;

    case MMCN_QUERY_PASTE:
      wsprintf(message, _T("MMCN_QUERY_PASTE\n"));
      break;

    case MMCN_REFRESH:
      wsprintf(message, _T("MMCN_REFRESH\n"));
      break;

    case MMCN_REMOVE_CHILDREN:
      wsprintf(message, _T("MMCN_REMOVE_CHILDREN\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_RENAME:
                        // Destination string may contain a truncation of the ideal result.
                        // (Indicated by return value other than S_OK).
                        // However, it will be null-terminated.
      StringCchPrintf(message, cchMessage, _T("MMCN_RENAME\n\tNew Name: '%ws'\n"), (LPOLESTR)param);
      break;

    case MMCN_RESTORE_VIEW:
      wsprintf(message, _T("MMCN_RESTORE_VIEW\n"));
      break;

    case MMCN_SELECT:
      wsprintf(message, _T("MMCN_SELECT\n\tScope: %d\n\tSelect: %08x\n"), LOWORD(arg), HIWORD(arg));
      break;

    case MMCN_SHOW:
      wsprintf(message, _T("MMCN_SHOW\n\tShow: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_SNAPINHELP:
      wsprintf(message, _T("MMCN_SNAPINHELP\n"));
      break;

    case MMCN_VIEW_CHANGE:
      wsprintf(message, _T("MMCN_VIEW_CHANGE\n\tData: %08x\n\tHint: %08x\n"), arg, param);
      break;
  }

  if (message[0] != 0)
    OutputDebugString(message);
  else
    OutputDebugString(_T("unknown event\n"));

#endif
  return;
}

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/About/registry.Cpp File Reference

  • SysMgmt
  • MMC
  • About
Defines | Functions

registry.Cpp File Reference

#include <objbase.h>
#include <assert.h>
#include "Registry.h"
#include "globals.h"

Go to the source code of this file.

Defines

#define | STRINGS_ONLY

Functions

LONG | recursiveDeleteKey (HKEY hKeyParent, const _TCHAR *szKeyChild)
HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const _TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const _TCHAR *szNameString, const CLSID &clsidAbout, const BOOL fSupportExtensions)
BOOL | setKeyAndValue (const _TCHAR *pszPath, const _TCHAR *szSubkey, const _TCHAR *szValue)
BOOL | setSnapInKeyAndValue (const _TCHAR *szKey, const _TCHAR *szSubkey, const _TCHAR *szName, const _TCHAR *szValue)
BOOL | setValue (const _TCHAR *szKey, const _TCHAR *szValueName, const _TCHAR *szValue)
LONG | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Define Documentation

#define STRINGS_ONLY

Definition at line 24 of file registry.Cpp.

Function Documentation

LONG recursiveDeleteKey | ( | HKEY | hKeyParent,
 |  | const _TCHAR * | szKeyChild
 | ) |  |

Definition at line 214 of file registry.Cpp.

{
    // Open the child.
    HKEY hKeyChild ;
    LONG lRes = RegOpenKeyEx(hKeyParent, lpszKeyChild, 0,
        KEY_ALL_ACCESS, &hKeyChild) ;
    if (lRes != ERROR_SUCCESS)
    {
        return lRes ;
    }

    // Enumerate all of the decendents of this child.
    FILETIME time ;
    _TCHAR szBuffer[256] ;
    DWORD dwSize = 256 ;
    while (RegEnumKeyEx(hKeyChild, 0, szBuffer, &dwSize, NULL,
        NULL, NULL, &time) == S_OK)
    {
        // Delete the decendents of this child.
        lRes = recursiveDeleteKey(hKeyChild, szBuffer) ;
        if (lRes != ERROR_SUCCESS)
        {
            // Cleanup before exiting.
            RegCloseKey(hKeyChild) ;
            return lRes;
        }
        dwSize = 256 ;
    }

    // Close the child.
    RegCloseKey(hKeyChild) ;

    // Delete this child.
    return RegDeleteKey(hKeyParent, lpszKeyChild) ;
}

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const _TCHAR * | szFriendlyName
 | ) |  |

Definition at line 67 of file registry.Cpp.

{
    // Get server location.
    _TCHAR szModule[512] ;
    DWORD dwResult =
        ::GetModuleFileName(hModule,
        szModule,
        sizeof(szModule)/sizeof(_TCHAR)) ;

    assert(dwResult != 0) ;

    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    assert(SUCCEEDED(hr)) ;

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;
  _tcscat(szKey, pszCLSID) ;

    // Add the CLSID to the registry.
    setKeyAndValue(szKey, NULL, szFriendlyName) ;

    // Add the server filename subkey under the CLSID key.
    setKeyAndValue(szKey, _T("InprocServer32"), szModule) ;

    // set the threading model
    _tcscat(szKey, _T("\\InprocServer32"));
    setValue(szKey, _T("ThreadingModel"), _T("Apartment"));

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const _TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | fSupportExtensions
 | ) |  |

Definition at line 140 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    LPOLESTR wszAboutCLSID = NULL;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    if (IID_NULL != clsidAbout)
        hr = StringFromCLSID(clsidAbout, &wszAboutCLSID);

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszAboutCLSID, wszAboutCLSID);

    // Add the CLSID to the registry.
    setSnapInKeyAndValue(pszCLSID, NULL, _T("NameString"), szNameString) ;
    setSnapInKeyAndValue(pszCLSID, _T("StandAlone"), NULL, NULL);
    if (IID_NULL != clsidAbout)
        setSnapInKeyAndValue(pszCLSID, NULL, _T("About"), pszAboutCLSID);

    if (fSupportExtensions) {
        // Build the key NodeType
        setSnapInKeyAndValue(pszCLSID, _T("NodeTypes"), NULL, NULL);

        _TCHAR szKey[64] ;
        _tcscpy(szKey, pszCLSID) ;
        _tcscat(szKey, _T("\\NodeTypes")) ;
        setSnapInKeyAndValue(szKey, pszCLSID, NULL, NULL);
    }

    // Free memory.
    CoTaskMemFree(wszCLSID) ;
    if (IID_NULL != clsidAbout)
        CoTaskMemFree(wszAboutCLSID);

    return S_OK ;
}

BOOL setKeyAndValue | ( | const _TCHAR * | pszPath,
 |  | const _TCHAR * | szSubkey,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 256 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Copy keyname into buffer.
    _tcscpy(szKeyBuf, szKey) ;

    // Add subkey name to buffer.
    if (szSubkey != NULL)
    {
        _tcscat(szKeyBuf, _T("\\")) ;
        _tcscat(szKeyBuf, szSubkey ) ;
    }

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, NULL, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

BOOL setSnapInKeyAndValue | ( | const _TCHAR * | szKey,
 |  | const _TCHAR * | szSubkey,
 |  | const _TCHAR * | szName,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 337 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\")) ;
    _tcscat(szKeyBuf, szKey) ;

    // Add subkey name to buffer.
    if (szSubkey != NULL)
    {
        _tcscat(szKeyBuf, _T("\\")) ;
        _tcscat(szKeyBuf, szSubkey ) ;
    }

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, szName, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

BOOL setValue | ( | const _TCHAR * | szKey,
 |  | const _TCHAR * | szValueName,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 299 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Copy keyname into buffer.
    _tcscpy(szKeyBuf, szKey) ;

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, szValueName, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

LONG UnregisterServer ( const CLSID & clsid )

Definition at line 112 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

  MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
  _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 184 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/About/registry.h File Reference

  • SysMgmt
  • MMC
  • About
Functions

registry.h File Reference

#include <tchar.h>

Go to the source code of this file.

Functions

HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const _TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const _TCHAR *szNameString, const CLSID &clsidAbout, const BOOL fSupportExtensions=FALSE)
HRESULT | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Function Documentation

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const _TCHAR * | szFriendlyName
 | ) |  |

Definition at line 67 of file registry.Cpp.

{
    // Get server location.
    _TCHAR szModule[512] ;
    DWORD dwResult =
        ::GetModuleFileName(hModule,
        szModule,
        sizeof(szModule)/sizeof(_TCHAR)) ;

    assert(dwResult != 0) ;

    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    assert(SUCCEEDED(hr)) ;

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;
  _tcscat(szKey, pszCLSID) ;

    // Add the CLSID to the registry.
    setKeyAndValue(szKey, NULL, szFriendlyName) ;

    // Add the server filename subkey under the CLSID key.
    setKeyAndValue(szKey, _T("InprocServer32"), szModule) ;

    // set the threading model
    _tcscat(szKey, _T("\\InprocServer32"));
    setValue(szKey, _T("ThreadingModel"), _T("Apartment"));

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const _TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | fSupportExtensions = FALSE
 | ) |  |

Definition at line 140 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    LPOLESTR wszAboutCLSID = NULL;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    if (IID_NULL != clsidAbout)
        hr = StringFromCLSID(clsidAbout, &wszAboutCLSID);

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszAboutCLSID, wszAboutCLSID);

    // Add the CLSID to the registry.
    setSnapInKeyAndValue(pszCLSID, NULL, _T("NameString"), szNameString) ;
    setSnapInKeyAndValue(pszCLSID, _T("StandAlone"), NULL, NULL);
    if (IID_NULL != clsidAbout)
        setSnapInKeyAndValue(pszCLSID, NULL, _T("About"), pszAboutCLSID);

    if (fSupportExtensions) {
        // Build the key NodeType
        setSnapInKeyAndValue(pszCLSID, _T("NodeTypes"), NULL, NULL);

        _TCHAR szKey[64] ;
        _tcscpy(szKey, pszCLSID) ;
        _tcscat(szKey, _T("\\NodeTypes")) ;
        setSnapInKeyAndValue(szKey, pszCLSID, NULL, NULL);
    }

    // Free memory.
    CoTaskMemFree(wszCLSID) ;
    if (IID_NULL != clsidAbout)
        CoTaskMemFree(wszAboutCLSID);

    return S_OK ;
}

HRESULT UnregisterServer ( const CLSID & clsid )

Definition at line 112 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

  MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
  _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 184 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Generated on Wed Nov 13 2024 16:53:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/About/resource.h File Reference

  • SysMgmt
  • MMC
  • About
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDB_BIKE 40007
#define | IDB_BIKE2 40011
#define | IDB_CAR 40005
#define | IDB_CAR2 40009
#define | IDB_CLOSED 40014
#define | IDB_CLOSED2 40012
#define | IDB_LGBMP 112
#define | IDB_OPEN 40015
#define | IDB_OPEN2 40013
#define | IDB_PLANE 40006
#define | IDB_PLANE2 40010
#define | IDB_ROCKET 40004
#define | IDB_ROCKET2 40008
#define | IDB_SMBMP 113
#define | IDB_SMOPEN 114
#define | IDI_ICON1 108
#define | IDR_LGICONS 121
#define | IDR_SMICONS 120
#define | IDS_ABOUTNAME 9
#define | IDS_HELPFILE 1
#define | IDS_NAME 3
#define | IDS_SNAPINDESC 2
#define | IDS_SNAPINNAME 6

Define Documentation

#define IDB_BIKE 40007

Definition at line 19 of file resource.h.

#define IDB_BIKE2 40011

Definition at line 23 of file resource.h.

#define IDB_CAR 40005

Definition at line 17 of file resource.h.

#define IDB_CAR2 40009

Definition at line 21 of file resource.h.

#define IDB_CLOSED 40014

Definition at line 26 of file resource.h.

#define IDB_CLOSED2 40012

Definition at line 24 of file resource.h.

#define IDB_LGBMP 112

Definition at line 11 of file resource.h.

#define IDB_OPEN 40015

Definition at line 27 of file resource.h.

#define IDB_OPEN2 40013

Definition at line 25 of file resource.h.

#define IDB_PLANE 40006

Definition at line 18 of file resource.h.

#define IDB_PLANE2 40010

Definition at line 22 of file resource.h.

#define IDB_ROCKET 40004

Definition at line 16 of file resource.h.

#define IDB_ROCKET2 40008

Definition at line 20 of file resource.h.

#define IDB_SMBMP 113

Definition at line 12 of file resource.h.

#define IDB_SMOPEN 114

Definition at line 13 of file resource.h.

#define IDI_ICON1 108

Definition at line 10 of file resource.h.

#define IDR_LGICONS 121

Definition at line 15 of file resource.h.

#define IDR_SMICONS 120

Definition at line 14 of file resource.h.

#define IDS_ABOUTNAME 9

Definition at line 9 of file resource.h.

#define IDS_HELPFILE 1

Definition at line 5 of file resource.h.

#define IDS_NAME 3

Definition at line 7 of file resource.h.

#define IDS_SNAPINDESC 2

Definition at line 6 of file resource.h.

#define IDS_SNAPINNAME 6

Definition at line 8 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/About/statnode.Cpp File Reference

  • SysMgmt
  • MMC
  • About

statnode.Cpp File Reference

#include "StatNode.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/About/statnode.h File Reference

  • SysMgmt
  • MMC
  • About
Classes

statnode.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class CStaticNode
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/ActiveX/about.Cpp File Reference

  • SysMgmt
  • MMC
  • ActiveX
Functions

about.Cpp File Reference

#include "About.h"
#include "resource.h"
#include "globals.h"
#include <crtdbg.h>

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CSnapinAbout

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 89 of file about.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        // we need to decrement our object count in the DLL
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:54:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/ActiveX/about.h File Reference

  • SysMgmt
  • MMC
  • ActiveX
Classes

about.h File Reference

#include <tchar.h>
#include <mmc.h>

Go to the source code of this file.

Classes

class CSnapinAbout
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/ActiveX/basesnap.Cpp File Reference

  • SysMgmt
  • MMC
  • ActiveX
Functions | Variables

basesnap.Cpp File Reference

#include <objbase.h>
#include <olectl.h>
#include <initguid.h>
#include "guids.h"
#include "basesnap.h"
#include "Comp.h"
#include "CompData.h"
#include "About.h"
#include "Registry.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)
BOOL WINAPI | DllMain (HINSTANCE hinstDLL, DWORD fdwReason, void *lpvReserved)
STDAPI | DllRegisterServer ()
STDAPI | DllUnregisterServer ()
STDMETHODIMP_ (ULONG) CClassFactory

Variables

HINSTANCE | g_hinst

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 77 of file basesnap.Cpp.

{
    if (g_uObjects == 0 && g_uSrvLock == 0)
        return S_OK;
    else
        return S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 45 of file basesnap.Cpp.

{
    if ((rclsid != CLSID_CComponentData) && (rclsid != CLSID_CSnapinAbout))
        return CLASS_E_CLASSNOTAVAILABLE;

    if (!ppvObj)
        return E_FAIL;

    *ppvObj = NULL;

    // We can only hand out IUnknown and IClassFactory pointers.  Fail
    // if they ask for anything else.
    if (!IsEqualIID(riid, IID_IUnknown) && !IsEqualIID(riid, IID_IClassFactory))
        return E_NOINTERFACE;

    CClassFactory *pFactory = NULL;

    // make the factory passing in the creation function for the type of object they want
    if (rclsid == CLSID_CComponentData)
        pFactory = new CClassFactory(CClassFactory::COMPONENT);
    else if (rclsid == CLSID_CSnapinAbout)
        pFactory = new CClassFactory(CClassFactory::ABOUT);

    if (NULL == pFactory)
        return E_OUTOFMEMORY;

    HRESULT hr = pFactory->QueryInterface(riid, ppvObj);

    return hr;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hinstDLL,
 |  | DWORD | fdwReason,
 |  | void * | lpvReserved
 | ) |  |

Definition at line 32 of file basesnap.Cpp.

{

    if (fdwReason == DLL_PROCESS_ATTACH) {
        g_hinst = hinstDLL;
    }

    return TRUE;
}

STDAPI DllRegisterServer ( void )

Definition at line 187 of file basesnap.Cpp.

{
    HRESULT hr = SELFREG_E_CLASS;
    _TCHAR szName[256];
    _TCHAR szSnapInName[256];

    LoadString(g_hinst, IDS_NAME, szName, (sizeof szName)/(sizeof szName[0]));
    LoadString(g_hinst, IDS_SNAPINNAME, szSnapInName, (sizeof szSnapInName)/(sizeof szSnapInName[0]));

    _TCHAR szAboutName[256];

    LoadString(g_hinst, IDS_ABOUTNAME, szAboutName, (sizeof szAboutName)/(sizeof szAboutName[0]));

    // register our CoClasses
    hr = RegisterServer(g_hinst,
        CLSID_CComponentData,
        szName);

    if SUCCEEDED(hr)
        hr = RegisterServer(g_hinst,
        CLSID_CSnapinAbout,
        szAboutName);

    // place the registry information for SnapIns
    if SUCCEEDED(hr)
        hr = RegisterSnapin(CLSID_CComponentData, szSnapInName, CLSID_CSnapinAbout, FALSE);

    return hr;
}

STDAPI DllUnregisterServer ( void )

Definition at line 218 of file basesnap.Cpp.

{
    if (UnregisterServer(CLSID_CComponentData) == S_OK)
        return UnregisterSnapin(CLSID_CComponentData);
    else
        return E_FAIL;
}

STDMETHODIMP_ ( ULONG )

Definition at line 124 of file basesnap.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;
}

Variable Documentation

HINSTANCE g_hinst

Definition at line 30 of file basesnap.Cpp.

Generated on Wed Nov 13 2024 16:54:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/ActiveX/basesnap.h File Reference

  • SysMgmt
  • MMC
  • ActiveX
Classes | Functions | Variables

basesnap.h File Reference

Go to the source code of this file.

Classes

class | CClassFactory

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)

Variables

ULONG | g_uObjects = 0
ULONG | g_uSrvLock = 0

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 53 of file ComSpyAudit.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 61 of file ComSpyAudit.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

Variable Documentation

ULONG g_uObjects = 0

Definition at line 24 of file basesnap.h.

ULONG g_uSrvLock = 0

Definition at line 25 of file basesnap.h.

Generated on Wed Nov 13 2024 16:54:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/ActiveX/comp.Cpp File Reference

  • SysMgmt
  • MMC
  • ActiveX
Defines | Functions

comp.Cpp File Reference

#include "Comp.h"
#include "DataObj.h"
#include <commctrl.h>
#include <crtdbg.h>
#include "globals.h"
#include "resource.h"
#include "DeleBase.h"
#include "CompData.h"

Go to the source code of this file.

Defines

#define ARRAYLEN(x) (sizeof(x) / sizeof((x)[0]))

Functions

STDMETHODIMP_ (ULONG) CComponent

Define Documentation

#define ARRAYLEN ( x ) (sizeof(x) / sizeof((x)[0]))

Definition at line 28 of file comp.Cpp.

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 70 of file comp.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/ActiveX/comp.h File Reference

  • SysMgmt
  • MMC
  • ActiveX
Classes

comp.h File Reference

#include <mmc.h>

Go to the source code of this file.

Classes

class CComponent
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/ActiveX/compdata.Cpp File Reference

  • SysMgmt
  • MMC
  • ActiveX
Functions

compdata.Cpp File Reference

#include "Comp.h"
#include "CompData.h"
#include "DataObj.h"
#include "resource.h"
#include <crtdbg.h>

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CComponentData

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 83 of file compdata.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        // we need to decrement our object count in the DLL
        delete this;
        return 0;
    }

    return m_cref;
}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/ActiveX/compdata.h File Reference

  • SysMgmt
  • MMC
  • ActiveX
Classes

compdata.h File Reference

#include <mmc.h>
#include "StatNode.h"
#include "Comp.h"
#include "StatNode.h"

Go to the source code of this file.

Classes

class CComponentData
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/ActiveX/dataobj.Cpp File Reference

  • SysMgmt
  • MMC
  • ActiveX
Defines | Functions

dataobj.Cpp File Reference

#include "DataObj.h"
#include "guids.h"
#include "DeleBase.h"

Go to the source code of this file.

Defines

#define | _T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")
#define | _T_CCF_INTERNAL_SNAPIN _T("{2479DB32-5276-11d2-94F5-00C04FB92EC2}")
#define | _T_CCF_NODETYPE _T("CCF_NODETYPE")
#define | _T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")
#define | _T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")

Functions

CDataObject * | GetOurDataObject (LPDATAOBJECT lpDataObject)
STDMETHODIMP_ (ULONG) CDataObject

Define Documentation

#define _T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")

Definition at line 31 of file dataobj.Cpp.

#define _T_CCF_INTERNAL_SNAPIN _T("{2479DB32-5276-11d2-94F5-00C04FB92EC2}")

Definition at line 36 of file dataobj.Cpp.

#define _T_CCF_NODETYPE _T("CCF_NODETYPE")

Definition at line 32 of file dataobj.Cpp.

#define _T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")

Definition at line 34 of file dataobj.Cpp.

#define _T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")

Definition at line 33 of file dataobj.Cpp.

Function Documentation

CDataObject* GetOurDataObject ( LPDATAOBJECT lpDataObject )

Definition at line 165 of file dataobj.Cpp.

{
    HRESULT       hr      = S_OK;
    CDataObject *pSDO     = NULL;

  // check to see if the data object is a special data object.
  if ( IS_SPECIAL_DATAOBJECT (lpDataObject) )
  {
    //Code for handling a special data object goes here.

    //Note that the MMC SDK samples do not handle
    //special data objects, so we exit if we get one.
    return NULL;
  }

    STGMEDIUM stgmedium = { TYMED_HGLOBAL,  NULL  };
    FORMATETC formatetc = { CDataObject::s_cfInternal, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };

    // Allocate memory for the stream
    stgmedium.hGlobal = GlobalAlloc( GMEM_SHARE, sizeof(CDataObject *));

    if (!stgmedium.hGlobal)     {
        hr = E_OUTOFMEMORY;
    }

    if SUCCEEDED(hr)
        // Attempt to get data from the object
        hr = lpDataObject->GetDataHere( &formatetc, &stgmedium );

    // stgmedium now has the data we need
    if (SUCCEEDED(hr))  {
        pSDO = *(CDataObject **)(stgmedium.hGlobal);
    }

    // if we have memory free it
    if (stgmedium.hGlobal)
        GlobalFree(stgmedium.hGlobal);

    return pSDO;

} // end GetOurDataObject()

STDMETHODIMP_ ( ULONG )

Definition at line 87 of file dataobj.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/ActiveX/dataobj.h File Reference

  • SysMgmt
  • MMC
  • ActiveX
Classes | Functions

dataobj.h File Reference

#include <mmc.h>
#include "DeleBase.h"

Go to the source code of this file.

Classes

class | CDataObject

Functions

HRESULT | ExtractFromDataObject (IDataObject *lpDataObject, UINT cf, ULONG cb, HGLOBAL *phGlobal)
CDataObject * | GetOurDataObject (IDataObject *lpDataObject)
BOOL | IsMMCMultiSelectDataObject (IDataObject *lpDataObject)

Function Documentation

HRESULT ExtractFromDataObject | ( | IDataObject * | lpDataObject,
 |  | UINT | cf,
 |  | ULONG | cb,
 |  | HGLOBAL * | phGlobal
 | ) |  |
CDataObject* GetOurDataObject ( IDataObject * lpDataObject )
BOOL IsMMCMultiSelectDataObject ( IDataObject * lpDataObject )
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/ActiveX/delebase.Cpp File Reference

  • SysMgmt
  • MMC
  • ActiveX

delebase.Cpp File Reference

#include "DeleBase.h"
#include "Comp.h"
#include "CompData.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/ActiveX/delebase.h File Reference

  • SysMgmt
  • MMC
  • ActiveX
Classes

delebase.h File Reference

#include <mmc.h>
#include <crtdbg.h>
#include "globals.h"
#include "resource.h"
#include "LocalRes.h"
#include "LocalRes.h"

Go to the source code of this file.

Classes

class CDelegationBase
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/ActiveX/globals.h File Reference

  • SysMgmt
  • MMC
  • ActiveX
Classes | Defines | Functions | Variables

globals.h File Reference

#include <tchar.h>

Go to the source code of this file.

Classes

class | TempBuffer

Defines

#define | IDM_BUTTON1 0x100
#define | IDM_BUTTON2 0x101
#define | MAKE_TSTRPTR_FROMWIDE(ptrname, widestr)
#define | MAKE_WIDEPTR_FROMTSTR(ptrname, tstr)
#define | MAKE_WIDEPTR_FROMTSTR_ALLOC(ptrname, tstr)
#define | OBJECT_CREATED InterlockedIncrement((long *)&g_uObjects);
#define | OBJECT_DESTROYED InterlockedDecrement((long *)&g_uObjects);

Functions

void | MMCN_Crack (BOOL bComponentData, IDataObject *pDataObject, IComponentData *pCompData, IComponent *pComp, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)

Variables

HINSTANCE | g_hinst
ULONG g_uObjects

Define Documentation

#define IDM_BUTTON1 0x100

Definition at line 25 of file globals.h.

#define IDM_BUTTON2 0x101

Definition at line 26 of file globals.h.

#define MAKE_TSTRPTR_FROMWIDE | ( | ptrname,
 |  | widestr
 | ) |
Value:
long __l##ptrname = (wcslen(widestr) + 1) * 2 * sizeof(TCHAR); \
    TempBuffer __TempBuffer##ptrname(__l##ptrname); \
    WideCharToMultiByte(CP_ACP, 0, widestr, -1, (LPSTR)__TempBuffer##ptrname.GetBuffer(), __l##ptrname, NULL, NULL); \
    LPTSTR ptrname = (LPTSTR)__TempBuffer##ptrname.GetBuffer()

Definition at line 127 of file globals.h.

#define MAKE_WIDEPTR_FROMTSTR | ( | ptrname,
 |  | tstr
 | ) |
Value:
long __cch##ptrname = (lstrlenA(tstr) + 1);\
    long __l##ptrname = (lstrlenA(tstr) + 1) * sizeof(WCHAR); \
    TempBuffer __TempBuffer##ptrname(__l##ptrname); \
    MultiByteToWideChar(CP_ACP, 0, tstr, -1, (LPWSTR)__TempBuffer##ptrname.GetBuffer(), __cch##ptrname); \
    LPWSTR ptrname = (LPWSTR)__TempBuffer##ptrname.GetBuffer()

Definition at line 93 of file globals.h.

#define MAKE_WIDEPTR_FROMTSTR_ALLOC | ( | ptrname,
 |  | tstr
 | ) |
Value:
long __cch##ptrname = (lstrlenA(tstr) + 1);\
    long __l##ptrname = (lstrlenA(tstr) + 1) * sizeof(WCHAR); \
    LPWSTR ptrname = (LPWSTR)CoTaskMemAlloc(__l##ptrname); \
    MultiByteToWideChar(CP_ACP, 0, tstr, -1, ptrname, __cch##ptrname)

Definition at line 107 of file globals.h.

#define OBJECT_CREATED InterlockedIncrement((long *)&g_uObjects);

Definition at line 31 of file globals.h.

#define OBJECT_DESTROYED InterlockedDecrement((long *)&g_uObjects);

Definition at line 32 of file globals.h.

Function Documentation

void MMCN_Crack | ( | BOOL | bComponentData,
 |  | IDataObject * | pDataObject,
 |  | IComponentData * | pCompData,
 |  | IComponent * | pComp,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param
 | ) |  |

Definition at line 59 of file mmccrack.Cpp.

{
#ifdef MMC_CRACK_MESSAGES
        const size_t cchMessage = 256;
  TCHAR message[cchMessage] = {0};

  if (bComponentData == TRUE)
    OutputDebugString(_T("IComponentData::Notify( "));
  else
    OutputDebugString(_T("IComponent::Notify( "));

  wsprintf(message, _T("DataObject: %08x, CompData: %08x, Comp: %08x ) - "), pDataObject, pCompData, pComp);
  OutputDebugString(message);

    switch (event)  {
    case MMCN_ACTIVATE:
      wsprintf(message, _T("MMCN_ACTIVATE\n\tActivate: %d\n"), arg);
      break;

    case MMCN_ADD_IMAGES:
      wsprintf(message, _T("MMCN_ADD_IMAGES\n\tImage List: %08x\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_BTN_CLICK:
      wsprintf(message, _T("MMCN_BTN_CLICK\n\tVerb: %ws\n"), MMCN_CrackVerb((MMC_CONSOLE_VERB)param));
      break;

    case MMCN_COLUMN_CLICK:
      wsprintf(message, _T("MMCN_COLUMN_CLICK\n\tColumn: %d\n\tSort Option: %d\n"), arg,   param);
      break;

    case MMCN_COLUMNS_CHANGED:
      wsprintf(message, _T("MMCN_COLUMNS_CHANGED\n"));
      break;

    case MMCN_CONTEXTHELP:
      wsprintf(message, _T("MMCN_CONTEXTHELP\n"));
      break;

    case MMCN_CONTEXTMENU:
      wsprintf(message, _T("MMCN_CONTEXTMENU\n"));
      break;

    case MMCN_CUTORMOVE:
      wsprintf(message, _T("MMCN_CUTORMOVE\n"));
      break;

    case MMCN_DBLCLICK:
      wsprintf(message, _T("MMCN_DBLCLICK\n"));
      break;

    case MMCN_DELETE:
      wsprintf(message, _T("MMCN_DELETE\n"));
      break;

    case MMCN_DESELECT_ALL:
      wsprintf(message, _T("MMCN_DESELECT_ALL\n"));
      break;

    case MMCN_EXPAND:
      wsprintf(message, _T("MMCN_EXPAND\n\tExpand: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_EXPANDSYNC:
      wsprintf(message, _T("MMCN_EXPANDSYNC\n"));
      break;

    case MMCN_FILTERBTN_CLICK:
      wsprintf(message, _T("MMCN_FILTERBTN_CLICK\n\tColumn: %d\n"), arg);
      break;

    case MMCN_FILTER_CHANGE:
      wsprintf(message, _T("MMCN_FILTER_CHANGE\n\tColumn: %d\n"), param);
      break;

    case MMCN_HELP:
      wsprintf(message, _T("MMCN_HELP\n"));
      break;

    case MMCN_INITOCX:
      wsprintf(message, _T("MMCN_INITOCX\n\tIUnknown: %08x\n"), param);
      break;

    case MMCN_LISTPAD:
      wsprintf(message, _T("MMCN_LISTPAD\n\tConnect: %d\n"), arg);
      break;

    case MMCN_MENU_BTNCLICK:
      wsprintf(message, _T("MMCN_MENU_BTNCLICK\n"));
      break;

    case MMCN_MINIMIZED:
      wsprintf(message, _T("MMCN_MINIMIZED\n\tMinimized: %d\n"), arg);
      break;

    case MMCN_PASTE:
      wsprintf(message, _T("MMCN_PASTE\n\tCopy: %d\n"), param == NULL);
      break;

    case MMCN_PRELOAD:
      wsprintf(message, _T("MMCN_PRELOAD\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_PRINT:
      wsprintf(message, _T("MMCN_PRINT\n"));
      break;

    case MMCN_PROPERTY_CHANGE:
      wsprintf(message, _T("MMCN_PROPERTY_CHANGE\n\tScope: %d\n\tArg: %08x\n"), arg, param);
      break;

    case MMCN_QUERY_PASTE:
      wsprintf(message, _T("MMCN_QUERY_PASTE\n"));
      break;

    case MMCN_REFRESH:
      wsprintf(message, _T("MMCN_REFRESH\n"));
      break;

    case MMCN_REMOVE_CHILDREN:
      wsprintf(message, _T("MMCN_REMOVE_CHILDREN\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_RENAME:
                        // Destination string may contain a truncation of the ideal result.
                        // (Indicated by return value other than S_OK).
                        // However, it will be null-terminated.
      StringCchPrintf(message, cchMessage, _T("MMCN_RENAME\n\tNew Name: '%ws'\n"), (LPOLESTR)param);
      break;

    case MMCN_RESTORE_VIEW:
      wsprintf(message, _T("MMCN_RESTORE_VIEW\n"));
      break;

    case MMCN_SELECT:
      wsprintf(message, _T("MMCN_SELECT\n\tScope: %d\n\tSelect: %08x\n"), LOWORD(arg), HIWORD(arg));
      break;

    case MMCN_SHOW:
      wsprintf(message, _T("MMCN_SHOW\n\tShow: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_SNAPINHELP:
      wsprintf(message, _T("MMCN_SNAPINHELP\n"));
      break;

    case MMCN_VIEW_CHANGE:
      wsprintf(message, _T("MMCN_VIEW_CHANGE\n\tData: %08x\n\tHint: %08x\n"), arg, param);
      break;
  }

  if (message[0] != 0)
    OutputDebugString(message);
  else
    OutputDebugString(_T("unknown event\n"));

#endif
  return;
}

Variable Documentation

HINSTANCE g_hinst

Definition at line 33 of file SetDisp.h.

ULONG g_uObjects

Definition at line 24 of file basesnap.h.

Generated on Wed Nov 13 2024 16:54:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/ActiveX/guids.h File Reference

  • SysMgmt
  • MMC
  • ActiveX
Functions

guids.h File Reference

Go to the source code of this file.

Functions

DEFINE_GUID (CLSID_CComponentData, 0xfa7306a6, 0x8b0d, 0x11d2, 0x8a, 0xb, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28)
DEFINE_GUID (CLSID_CSnapinAbout, 0xfa7306a8, 0x8b0d, 0x11d2, 0x8a, 0xb, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28)

Function Documentation

DEFINE_GUID | ( | CLSID_CComponentData | ,
 |  | 0xfa7306a6 | ,
 |  | 0x8b0d | ,
 |  | 0x11d2 | ,
 |  | 0x8a | ,
 |  | 0xb | ,
 |  | 0x0 | ,
 |  | 0x0 | ,
 |  | 0x21 | ,
 |  | 0x47 | ,
 |  | 0x31 | ,
 |  | 0x28 |
 | ) |  |
DEFINE_GUID | ( | CLSID_CSnapinAbout | ,
 |  | 0xfa7306a8 | ,
 |  | 0x8b0d | ,
 |  | 0x11d2 | ,
 |  | 0x8a | ,
 |  | 0xb | ,
 |  | 0x0 | ,
 |  | 0x0 | ,
 |  | 0x21 | ,
 |  | 0x47 | ,
 |  | 0x31 | ,
 |  | 0x28 |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/ActiveX/land.Cpp File Reference

  • SysMgmt
  • MMC
  • ActiveX

land.Cpp File Reference

#include "Land.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/ActiveX/land.h File Reference

  • SysMgmt
  • MMC
  • ActiveX
Classes

land.h File Reference

#include <mmc.h>
#include "DeleBase.h"

Go to the source code of this file.

Classes

class CLandBasedVehicle
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/ActiveX/localres.h File Reference

  • SysMgmt
  • MMC
  • ActiveX
Defines

localres.h File Reference

Go to the source code of this file.

Defines

#define | INDEX_CLOSEDFOLDER 4
#define | INDEX_LANDICON 1
#define | INDEX_NONE -1
#define | INDEX_OPENFOLDER 5
#define | INDEX_PEOPLEICON 3
#define | INDEX_SKYICON 2
#define | INDEX_SPACEICON 0

Define Documentation

#define INDEX_CLOSEDFOLDER 4

Definition at line 27 of file localres.h.

#define INDEX_LANDICON 1

Definition at line 24 of file localres.h.

#define INDEX_NONE -1

Definition at line 22 of file localres.h.

#define INDEX_OPENFOLDER 5

Definition at line 28 of file localres.h.

#define INDEX_PEOPLEICON 3

Definition at line 26 of file localres.h.

#define INDEX_SKYICON 2

Definition at line 25 of file localres.h.

#define INDEX_SPACEICON 0

Definition at line 23 of file localres.h.

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/ActiveX/mmccrack.Cpp File Reference

  • SysMgmt
  • MMC
  • ActiveX
Defines | Functions

mmccrack.Cpp File Reference

#include <mmc.h>
#include <winuser.h>
#include <tchar.h>
#include "globals.h"
#include <strsafe.h>

Go to the source code of this file.

Defines

#define | STRSAFE_NO_DEPRECATE

Functions

void | MMCN_Crack (BOOL bComponentData, IDataObject *pDataObject, IComponentData *pCompData, IComponent *pComp, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)

Define Documentation

#define STRSAFE_NO_DEPRECATE

Definition at line 25 of file mmccrack.Cpp.

Function Documentation

void MMCN_Crack | ( | BOOL | bComponentData,
 |  | IDataObject * | pDataObject,
 |  | IComponentData * | pCompData,
 |  | IComponent * | pComp,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param
 | ) |  |

Definition at line 59 of file mmccrack.Cpp.

{
#ifdef MMC_CRACK_MESSAGES
        const size_t cchMessage = 256;
        TCHAR message[cchMessage] = {0};

        if (bComponentData == TRUE)
                OutputDebugString(_T("IComponentData::Notify( "));
        else
                OutputDebugString(_T("IComponent::Notify( "));

        wsprintf(message, _T("DataObject: %08x, CompData: %08x, Comp: %08x ) - "), pDataObject, pCompData, pComp);
        OutputDebugString(message);

    switch (event)      {
                case MMCN_ACTIVATE:
                        wsprintf(message, _T("MMCN_ACTIVATE\n\tActivate: %d\n"), arg);
                        break;

                case MMCN_ADD_IMAGES:
                        wsprintf(message, _T("MMCN_ADD_IMAGES\n\tImage List: %08x\n\tScope Item: %08x\n"), arg, param);
                        break;

                case MMCN_BTN_CLICK:
                        wsprintf(message, _T("MMCN_BTN_CLICK\n\tVerb: %ws\n"), MMCN_CrackVerb((MMC_CONSOLE_VERB)param));
                        break;

                case MMCN_COLUMN_CLICK:
                        wsprintf(message, _T("MMCN_COLUMN_CLICK\n\tColumn: %d\n\tSort Option: %d\n"), arg,       param);
                        break;

                case MMCN_COLUMNS_CHANGED:
                        wsprintf(message, _T("MMCN_COLUMNS_CHANGED\n"));
                        break;

                case MMCN_CONTEXTHELP:
                        wsprintf(message, _T("MMCN_CONTEXTHELP\n"));
                        break;

                case MMCN_CONTEXTMENU:
                        wsprintf(message, _T("MMCN_CONTEXTMENU\n"));
                        break;

                case MMCN_CUTORMOVE:
                        wsprintf(message, _T("MMCN_CUTORMOVE\n"));
                        break;

                case MMCN_DBLCLICK:
                        wsprintf(message, _T("MMCN_DBLCLICK\n"));
                        break;

                case MMCN_DELETE:
                        wsprintf(message, _T("MMCN_DELETE\n"));
                        break;

                case MMCN_DESELECT_ALL:
                        wsprintf(message, _T("MMCN_DESELECT_ALL\n"));
                        break;

                case MMCN_EXPAND:
                        wsprintf(message, _T("MMCN_EXPAND\n\tExpand: %d\n\tScope Item: %08x\n"), arg, param);
                        break;

                case MMCN_EXPANDSYNC:
                        wsprintf(message, _T("MMCN_EXPANDSYNC\n"));
                        break;

                case MMCN_FILTERBTN_CLICK:
                        wsprintf(message, _T("MMCN_FILTERBTN_CLICK\n\tColumn: %d\n"), arg);
                        break;

                case MMCN_FILTER_CHANGE:
                        wsprintf(message, _T("MMCN_FILTER_CHANGE\n\tColumn: %d\n"), param);
                        break;

                case MMCN_HELP:
                        wsprintf(message, _T("MMCN_HELP\n"));
                        break;

                case MMCN_INITOCX:
                        wsprintf(message, _T("MMCN_INITOCX\n\tIUnknown: %08x\n"), param);
                        break;

                case MMCN_LISTPAD:
                        wsprintf(message, _T("MMCN_LISTPAD\n\tConnect: %d\n"), arg);
                        break;

                case MMCN_MENU_BTNCLICK:
                        wsprintf(message, _T("MMCN_MENU_BTNCLICK\n"));
                        break;

                case MMCN_MINIMIZED:
                        wsprintf(message, _T("MMCN_MINIMIZED\n\tMinimized: %d\n"), arg);
                        break;

                case MMCN_PASTE:
                        wsprintf(message, _T("MMCN_PASTE\n\tCopy: %d\n"), param == NULL);
                        break;

                case MMCN_PRELOAD:
                        wsprintf(message, _T("MMCN_PRELOAD\n\tScope Item: %08x\n"), arg);
                        break;

                case MMCN_PRINT:
                        wsprintf(message, _T("MMCN_PRINT\n"));
                        break;

                case MMCN_PROPERTY_CHANGE:
                        wsprintf(message, _T("MMCN_PROPERTY_CHANGE\n\tScope: %d\n\tArg: %08x\n"), arg, param);
                        break;

                case MMCN_QUERY_PASTE:
                        wsprintf(message, _T("MMCN_QUERY_PASTE\n"));
                        break;

                case MMCN_REFRESH:
                        wsprintf(message, _T("MMCN_REFRESH\n"));
                        break;

                case MMCN_REMOVE_CHILDREN:
                        wsprintf(message, _T("MMCN_REMOVE_CHILDREN\n\tScope Item: %08x\n"), arg);
                        break;

                case MMCN_RENAME:
                        // Destination string may contain a truncation of the ideal result.
                        // (Indicated by return value other than S_OK).
                        // However, it will be null-terminated.
                        StringCchPrintf(message, cchMessage, _T("MMCN_RENAME\n\tNew Name: '%ws'\n"), (LPOLESTR)param);
                        break;

                case MMCN_RESTORE_VIEW:
                        wsprintf(message, _T("MMCN_RESTORE_VIEW\n"));
                        break;

                case MMCN_SELECT:
                        wsprintf(message, _T("MMCN_SELECT\n\tScope: %d\n\tSelect: %08x\n"), LOWORD(arg), HIWORD(arg));
                        break;

                case MMCN_SHOW:
                        wsprintf(message, _T("MMCN_SHOW\n\tShow: %d\n\tScope Item: %08x\n"), arg, param);
                        break;

                case MMCN_SNAPINHELP:
                        wsprintf(message, _T("MMCN_SNAPINHELP\n"));
                        break;

                case MMCN_VIEW_CHANGE:
                        wsprintf(message, _T("MMCN_VIEW_CHANGE\n\tData: %08x\n\tHint: %08x\n"), arg, param);
                        break;
        }

        if (message[0] != 0)
                OutputDebugString(message);
        else
                OutputDebugString(_T("unknown event\n"));

#endif
        return;
}

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/ActiveX/people.Cpp File Reference

  • SysMgmt
  • MMC
  • ActiveX

people.Cpp File Reference

#include <stdio.h>
#include "People.h"
#include <initguid.h>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/ActiveX/people.h File Reference

  • SysMgmt
  • MMC
  • ActiveX
Classes

people.h File Reference

#include <mmc.h>
#include "DeleBase.h"

Go to the source code of this file.

Classes

class | CPeoplePoweredVehicle
class | CPerson
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/ActiveX/registry.Cpp File Reference

  • SysMgmt
  • MMC
  • ActiveX
Defines | Functions

registry.Cpp File Reference

#include <objbase.h>
#include <assert.h>
#include "Registry.h"
#include "globals.h"

Go to the source code of this file.

Defines

#define | STRINGS_ONLY

Functions

LONG | recursiveDeleteKey (HKEY hKeyParent, const _TCHAR *szKeyChild)
HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const _TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const _TCHAR *szNameString, const CLSID &clsidAbout, const BOOL fSupportExtensions)
BOOL | setKeyAndValue (const _TCHAR *pszPath, const _TCHAR *szSubkey, const _TCHAR *szValue)
BOOL | setSnapInKeyAndValue (const _TCHAR *szKey, const _TCHAR *szSubkey, const _TCHAR *szName, const _TCHAR *szValue)
BOOL | setValue (const _TCHAR *szKey, const _TCHAR *szValueName, const _TCHAR *szValue)
LONG | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Define Documentation

#define STRINGS_ONLY

Definition at line 24 of file registry.Cpp.

Function Documentation

LONG recursiveDeleteKey | ( | HKEY | hKeyParent,
 |  | const _TCHAR * | szKeyChild
 | ) |  |

Definition at line 214 of file registry.Cpp.

{
    // Open the child.
    HKEY hKeyChild ;
    LONG lRes = RegOpenKeyEx(hKeyParent, lpszKeyChild, 0,
        KEY_ALL_ACCESS, &hKeyChild) ;
    if (lRes != ERROR_SUCCESS)
    {
        return lRes ;
    }

    // Enumerate all of the decendents of this child.
    FILETIME time ;
    _TCHAR szBuffer[256] ;
    DWORD dwSize = 256 ;
    while (RegEnumKeyEx(hKeyChild, 0, szBuffer, &dwSize, NULL,
        NULL, NULL, &time) == S_OK)
    {
        // Delete the decendents of this child.
        lRes = recursiveDeleteKey(hKeyChild, szBuffer) ;
        if (lRes != ERROR_SUCCESS)
        {
            // Cleanup before exiting.
            RegCloseKey(hKeyChild) ;
            return lRes;
        }
        dwSize = 256 ;
    }

    // Close the child.
    RegCloseKey(hKeyChild) ;

    // Delete this child.
    return RegDeleteKey(hKeyParent, lpszKeyChild) ;
}

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const _TCHAR * | szFriendlyName
 | ) |  |

Definition at line 67 of file registry.Cpp.

{
    // Get server location.
    _TCHAR szModule[512] ;
    DWORD dwResult =
        ::GetModuleFileName(hModule,
        szModule,
        sizeof(szModule)/sizeof(_TCHAR)) ;

    assert(dwResult != 0) ;

    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    assert(SUCCEEDED(hr)) ;

        MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;
        _tcscat(szKey, pszCLSID) ;

    // Add the CLSID to the registry.
    setKeyAndValue(szKey, NULL, szFriendlyName) ;

    // Add the server filename subkey under the CLSID key.
    setKeyAndValue(szKey, _T("InprocServer32"), szModule) ;

    // set the threading model
    _tcscat(szKey, _T("\\InprocServer32"));
    setValue(szKey, _T("ThreadingModel"), _T("Apartment"));

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const _TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | fSupportExtensions
 | ) |  |

Definition at line 140 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    LPOLESTR wszAboutCLSID = NULL;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    if (IID_NULL != clsidAbout)
        hr = StringFromCLSID(clsidAbout, &wszAboutCLSID);

        MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);
        MAKE_TSTRPTR_FROMWIDE(pszAboutCLSID, wszAboutCLSID);

    // Add the CLSID to the registry.
    setSnapInKeyAndValue(pszCLSID, NULL, _T("NameString"), szNameString) ;
    setSnapInKeyAndValue(pszCLSID, _T("StandAlone"), NULL, NULL);
    if (IID_NULL != clsidAbout)
        setSnapInKeyAndValue(pszCLSID, NULL, _T("About"), pszAboutCLSID);

    if (fSupportExtensions) {
        // Build the key NodeType
        setSnapInKeyAndValue(pszCLSID, _T("NodeTypes"), NULL, NULL);

        _TCHAR szKey[64] ;
        _tcscpy(szKey, pszCLSID) ;
        _tcscat(szKey, _T("\\NodeTypes")) ;
        setSnapInKeyAndValue(szKey, pszCLSID, NULL, NULL);
    }

    // Free memory.
    CoTaskMemFree(wszCLSID) ;
    if (IID_NULL != clsidAbout)
        CoTaskMemFree(wszAboutCLSID);

    return S_OK ;
}

BOOL setKeyAndValue | ( | const _TCHAR * | pszPath,
 |  | const _TCHAR * | szSubkey,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 256 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Copy keyname into buffer.
    _tcscpy(szKeyBuf, szKey) ;

    // Add subkey name to buffer.
    if (szSubkey != NULL)
    {
        _tcscat(szKeyBuf, _T("\\")) ;
        _tcscat(szKeyBuf, szSubkey ) ;
    }

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, NULL, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

BOOL setSnapInKeyAndValue | ( | const _TCHAR * | szKey,
 |  | const _TCHAR * | szSubkey,
 |  | const _TCHAR * | szName,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 337 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\")) ;
    _tcscat(szKeyBuf, szKey) ;

    // Add subkey name to buffer.
    if (szSubkey != NULL)
    {
        _tcscat(szKeyBuf, _T("\\")) ;
        _tcscat(szKeyBuf, szSubkey ) ;
    }

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, szName, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

BOOL setValue | ( | const _TCHAR * | szKey,
 |  | const _TCHAR * | szValueName,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 299 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Copy keyname into buffer.
    _tcscpy(szKeyBuf, szKey) ;

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, szValueName, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

LONG UnregisterServer ( const CLSID & clsid )

Definition at line 112 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

        MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
        _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
               (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 184 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
        MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
               (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/ActiveX/registry.h File Reference

  • SysMgmt
  • MMC
  • ActiveX
Functions

registry.h File Reference

#include <tchar.h>

Go to the source code of this file.

Functions

HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const _TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const _TCHAR *szNameString, const CLSID &clsidAbout, const BOOL fSupportExtensions=FALSE)
HRESULT | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Function Documentation

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const _TCHAR * | szFriendlyName
 | ) |  |

Definition at line 67 of file registry.Cpp.

{
    // Get server location.
    _TCHAR szModule[512] ;
    DWORD dwResult =
        ::GetModuleFileName(hModule,
        szModule,
        sizeof(szModule)/sizeof(_TCHAR)) ;

    assert(dwResult != 0) ;

    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    assert(SUCCEEDED(hr)) ;

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;
  _tcscat(szKey, pszCLSID) ;

    // Add the CLSID to the registry.
    setKeyAndValue(szKey, NULL, szFriendlyName) ;

    // Add the server filename subkey under the CLSID key.
    setKeyAndValue(szKey, _T("InprocServer32"), szModule) ;

    // set the threading model
    _tcscat(szKey, _T("\\InprocServer32"));
    setValue(szKey, _T("ThreadingModel"), _T("Apartment"));

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const _TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | fSupportExtensions = FALSE
 | ) |  |

Definition at line 140 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    LPOLESTR wszAboutCLSID = NULL;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    if (IID_NULL != clsidAbout)
        hr = StringFromCLSID(clsidAbout, &wszAboutCLSID);

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszAboutCLSID, wszAboutCLSID);

    // Add the CLSID to the registry.
    setSnapInKeyAndValue(pszCLSID, NULL, _T("NameString"), szNameString) ;
    setSnapInKeyAndValue(pszCLSID, _T("StandAlone"), NULL, NULL);
    if (IID_NULL != clsidAbout)
        setSnapInKeyAndValue(pszCLSID, NULL, _T("About"), pszAboutCLSID);

    if (fSupportExtensions) {
        // Build the key NodeType
        setSnapInKeyAndValue(pszCLSID, _T("NodeTypes"), NULL, NULL);

        _TCHAR szKey[64] ;
        _tcscpy(szKey, pszCLSID) ;
        _tcscat(szKey, _T("\\NodeTypes")) ;
        setSnapInKeyAndValue(szKey, pszCLSID, NULL, NULL);
    }

    // Free memory.
    CoTaskMemFree(wszCLSID) ;
    if (IID_NULL != clsidAbout)
        CoTaskMemFree(wszAboutCLSID);

    return S_OK ;
}

HRESULT UnregisterServer ( const CLSID & clsid )

Definition at line 112 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

  MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
  _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 184 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Generated on Wed Nov 13 2024 16:53:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/ActiveX/resource.h File Reference

  • SysMgmt
  • MMC
  • ActiveX
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | ID_BUTTONPAUSE 40022
#define | ID_BUTTONSTART 40021
#define | ID_BUTTONSTOP 40023
#define | ID_COMMAND_COMMAND1 40016
#define | ID_COMMAND_COMMAND2 40017
#define | ID_COMMAND_COMMAND3 40018
#define | ID_COMMAND_COMMAND4 40020
#define | IDB_BIKE 40007
#define | IDB_BIKE2 40011
#define | IDB_CAR 40005
#define | IDB_CAR2 40009
#define | IDB_CLOSED 40014
#define | IDB_CLOSED2 40012
#define | IDB_LGBMP 118
#define | IDB_OPEN 40015
#define | IDB_OPEN2 40013
#define | IDB_PLANE 40006
#define | IDB_PLANE2 40010
#define | IDB_ROCKET 40004
#define | IDB_ROCKET2 40008
#define | IDB_SMBMP 117
#define | IDB_SMOPEN 116
#define | IDI_ICON1 108
#define | IDR_LGICONS 121
#define | IDR_SMICONS 120
#define | IDS_ABOUTNAME 9
#define | IDS_HELPFILE 1
#define | IDS_NAME 3
#define | IDS_SNAPINDESC 2
#define | IDS_SNAPINNAME 6

Define Documentation

#define ID_BUTTONPAUSE 40022

Definition at line 33 of file resource.h.

#define ID_BUTTONSTART 40021

Definition at line 32 of file resource.h.

#define ID_BUTTONSTOP 40023

Definition at line 34 of file resource.h.

#define ID_COMMAND_COMMAND1 40016

Definition at line 28 of file resource.h.

#define ID_COMMAND_COMMAND2 40017

Definition at line 29 of file resource.h.

#define ID_COMMAND_COMMAND3 40018

Definition at line 30 of file resource.h.

#define ID_COMMAND_COMMAND4 40020

Definition at line 31 of file resource.h.

#define IDB_BIKE 40007

Definition at line 19 of file resource.h.

#define IDB_BIKE2 40011

Definition at line 23 of file resource.h.

#define IDB_CAR 40005

Definition at line 17 of file resource.h.

#define IDB_CAR2 40009

Definition at line 21 of file resource.h.

#define IDB_CLOSED 40014

Definition at line 26 of file resource.h.

#define IDB_CLOSED2 40012

Definition at line 24 of file resource.h.

#define IDB_LGBMP 118

Definition at line 13 of file resource.h.

#define IDB_OPEN 40015

Definition at line 27 of file resource.h.

#define IDB_OPEN2 40013

Definition at line 25 of file resource.h.

#define IDB_PLANE 40006

Definition at line 18 of file resource.h.

#define IDB_PLANE2 40010

Definition at line 22 of file resource.h.

#define IDB_ROCKET 40004

Definition at line 16 of file resource.h.

#define IDB_ROCKET2 40008

Definition at line 20 of file resource.h.

#define IDB_SMBMP 117

Definition at line 12 of file resource.h.

#define IDB_SMOPEN 116

Definition at line 11 of file resource.h.

#define IDI_ICON1 108

Definition at line 10 of file resource.h.

#define IDR_LGICONS 121

Definition at line 15 of file resource.h.

#define IDR_SMICONS 120

Definition at line 14 of file resource.h.

#define IDS_ABOUTNAME 9

Definition at line 9 of file resource.h.

#define IDS_HELPFILE 1

Definition at line 5 of file resource.h.

#define IDS_NAME 3

Definition at line 7 of file resource.h.

#define IDS_SNAPINDESC 2

Definition at line 6 of file resource.h.

#define IDS_SNAPINNAME 6

Definition at line 8 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/ActiveX/sky.Cpp File Reference

  • SysMgmt
  • MMC
  • ActiveX

sky.Cpp File Reference

#include "Sky.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/ActiveX/sky.h File Reference

  • SysMgmt
  • MMC
  • ActiveX
Classes

sky.h File Reference

#include <mmc.h>
#include "DeleBase.h"

Go to the source code of this file.

Classes

class CSkyBasedVehicle
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/ActiveX/space.Cpp File Reference

  • SysMgmt
  • MMC
  • ActiveX
Defines

space.Cpp File Reference

#include <stdio.h>
#include "Space.h"
#include <strsafe.h>

Go to the source code of this file.

Defines

#define STRSAFE_NO_DEPRECATE

Define Documentation

#define STRSAFE_NO_DEPRECATE

Definition at line 21 of file space.Cpp.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/ActiveX/space.h File Reference

  • SysMgmt
  • MMC
  • ActiveX
Classes

space.h File Reference

#include <mmc.h>
#include "DeleBase.h"

Go to the source code of this file.

Classes

class | CRocket
class | CSpaceVehicle
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/ActiveX/statnode.Cpp File Reference

  • SysMgmt
  • MMC
  • ActiveX

statnode.Cpp File Reference

#include "StatNode.h"
#include "Space.h"
#include "Sky.h"
#include "People.h"
#include "Land.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/ActiveX/statnode.h File Reference

  • SysMgmt
  • MMC
  • ActiveX
Classes

statnode.h File Reference

#include "DeleBase.h"
#include "DeleBase.h"

Go to the source code of this file.

Classes

class CStaticNode
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/ActiveX/atl/atlcontrol.Cpp File Reference

  • SysMgmt
  • MMC
  • ActiveX
  • atl
Functions | Variables

atlcontrol.Cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include "ATLControl.h"
#include "ATLControl_i.c"
#include "MMCControl.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 60 of file atlcontrol.Cpp.

{
    return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 68 of file atlcontrol.Cpp.

{
    return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 45 of file atlcontrol.Cpp.

{
    if (dwReason == DLL_PROCESS_ATTACH)
    {
        _Module.Init(ObjectMap, hInstance, &LIBID_ATLCONTROLLib);
        DisableThreadLibraryCalls(hInstance);
    }
    else if (dwReason == DLL_PROCESS_DETACH)
        _Module.Term();
    return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 76 of file atlcontrol.Cpp.

{
    // registers object, typelib and all interfaces in typelib
    return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 85 of file atlcontrol.Cpp.

{
    return _Module.UnregisterServer(TRUE);
}

Variable Documentation

CComModule _Module

Definition at line 35 of file atlcontrol.Cpp.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/ActiveX/atl/atlcontrol.h File Reference

  • SysMgmt
  • MMC
  • ActiveX
  • atl
Classes | Defines | Typedefs | Functions | Variables

atlcontrol.h File Reference

#include "rpc.h"
#include "rpcndr.h"
#include "windows.h"
#include "ole2.h"
#include "oaidl.h"
#include "ocidl.h"

Go to the source code of this file.

Classes

struct | IMMCControlVtbl

Defines

#define | __ATLCONTROLLib_LIBRARY_DEFINED__
#define | __IMMCControl_FWD_DEFINED__
#define | __IMMCControl_INTERFACE_DEFINED__
#define | __MMCControl_FWD_DEFINED__
#define | __REQUIRED_RPCNDR_H_VERSION__ 440

Typedefs

typedef interface IMMCControl | IMMCControl
typedef struct IMMCControlVtbl | IMMCControlVtbl
typedef struct MMCControl | MMCControl

Functions

HRESULT STDMETHODCALLTYPE | IMMCControl_DoHelp_Proxy (IMMCControl __RPC_FAR *This)
void __RPC_STUB | IMMCControl_DoHelp_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IMMCControl_StartAnimation_Proxy (IMMCControl __RPC_FAR *This)
void __RPC_STUB | IMMCControl_StartAnimation_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IMMCControl_StopAnimation_Proxy (IMMCControl __RPC_FAR *This)
void __RPC_STUB | IMMCControl_StopAnimation_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
void __RPC_FAR *__RPC_USER | MIDL_user_allocate (size_t)
void __RPC_USER | MIDL_user_free (void __RPC_FAR *)

Variables

EXTERN_C const CLSID | CLSID_MMCControl
EXTERN_C const IID | IID_IMMCControl
EXTERN_C const IID | LIBID_ATLCONTROLLib
interface IMMCControl
CONST_VTBL struct
IMMCControlVtbl __RPC_FAR * 		lpVtbl

Define Documentation

#define __ATLCONTROLLib_LIBRARY_DEFINED__

Definition at line 234 of file atlcontrol.h.

#define __IMMCControl_FWD_DEFINED__

Definition at line 41 of file atlcontrol.h.

#define __IMMCControl_INTERFACE_DEFINED__

Definition at line 66 of file atlcontrol.h.

#define __MMCControl_FWD_DEFINED__

Definition at line 47 of file atlcontrol.h.

#define __REQUIRED_RPCNDR_H_VERSION__ 440

Definition at line 16 of file atlcontrol.h.

Typedef Documentation

typedef interface IMMCControl IMMCControl

Definition at line 42 of file atlcontrol.h.

typedef struct IMMCControlVtbl IMMCControlVtbl
typedef struct MMCControl MMCControl

Definition at line 52 of file atlcontrol.h.

Function Documentation

HRESULT STDMETHODCALLTYPE IMMCControl_DoHelp_Proxy ( IMMCControl __RPC_FAR * This )
void __RPC_STUB IMMCControl_DoHelp_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IMMCControl_StartAnimation_Proxy ( IMMCControl __RPC_FAR * This )
void __RPC_STUB IMMCControl_StartAnimation_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IMMCControl_StopAnimation_Proxy ( IMMCControl __RPC_FAR * This )
void __RPC_STUB IMMCControl_StopAnimation_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
void __RPC_FAR* __RPC_USER MIDL_user_allocate ( size_t )

Definition at line 364 of file Picklpc.c.

{
    unsigned char * pcAllocated;
    unsigned char * pcUserPtr;

    pcAllocated = (unsigned char *) malloc( s + 15 );
    pcUserPtr =  ALIGN_TO8( pcAllocated );
    if ( pcUserPtr == pcAllocated )
        pcUserPtr = pcAllocated + 8;

    *(pcUserPtr - 1) = (char) (pcUserPtr - pcAllocated);

    return( pcUserPtr );
}

void __RPC_USER MIDL_user_free ( void __RPC_FAR * )

Definition at line 379 of file Picklpc.c.

{
    unsigned char * pcAllocated;
    unsigned char * pcUserPtr;

    pcUserPtr = (unsigned char *) f;
    pcAllocated = pcUserPtr - *(pcUserPtr - 1);

    free( pcAllocated );
}

Variable Documentation

EXTERN_C const CLSID CLSID_MMCControl

Definition at line 242 of file atlcontrol.h.

EXTERN_C const IID IID_IMMCControl

Definition at line 72 of file atlcontrol.h.

EXTERN_C const IID LIBID_ATLCONTROLLib

Definition at line 240 of file atlcontrol.h.

interface IMMCControl CONST_VTBL struct IMMCControlVtbl __RPC_FAR* lpVtbl

Definition at line 148 of file atlcontrol.h.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/ActiveX/atl/atlcontrol.idl File Reference

  • SysMgmt
  • MMC
  • ActiveX
  • atl
Classes | Namespaces | Functions

atlcontrol.idl File Reference

#include "olectl.h"

Go to the source code of this file.

Classes

class | ATLCONTROLLib::MMCControl
interface | IMMCControl

Namespaces

namespace | ATLCONTROLLib

Functions

ATLCONTROLLib::importlib ("stdole32.tlb")
ATLCONTROLLib::importlib ("stdole2.tlb")
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/ActiveX/atl/mmccontrol.Cpp File Reference

  • SysMgmt
  • MMC
  • ActiveX
  • atl

mmccontrol.Cpp File Reference

#include "stdafx.h"
#include "ATLControl.h"
#include "MMCControl.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/ActiveX/atl/mmccontrol.h File Reference

  • SysMgmt
  • MMC
  • ActiveX
  • atl
Classes

mmccontrol.h File Reference

#include "resource.h"
#include <atlctl.h>

Go to the source code of this file.

Classes

class CMMCControl
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/ActiveX/atl/resource.h File Reference

  • SysMgmt
  • MMC
  • ActiveX
  • atl
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDB_MMCCONTROL 101
#define | IDC_ANIMATE 201
#define | IDC_ANIMATIONSTATE 202
#define | IDD_MMCCONTROL 103
#define | IDR_MMCCONTROL 102
#define | IDS_PROJNAME 100

Define Documentation

#define IDB_MMCCONTROL 101

Definition at line 6 of file resource.h.

#define IDC_ANIMATE 201

Definition at line 9 of file resource.h.

#define IDC_ANIMATIONSTATE 202

Definition at line 10 of file resource.h.

#define IDD_MMCCONTROL 103

Definition at line 8 of file resource.h.

#define IDR_MMCCONTROL 102

Definition at line 7 of file resource.h.

#define IDS_PROJNAME 100

Definition at line 5 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/ActiveX/atl/StdAfx.Cpp File Reference

  • SysMgmt
  • MMC
  • ActiveX
  • atl

StdAfx.Cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/ActiveX/atl/StdAfx.h File Reference

  • SysMgmt
  • MMC
  • ActiveX
  • atl
Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>
#include <atlhost.h>
#include <atlctl.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0400
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 34 of file StdAfx.h.

#define _WIN32_WINNT 0x0400

Definition at line 32 of file StdAfx.h.

#define STRICT

Definition at line 30 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/ActiveX/vb/mmcsample.h File Reference

  • SysMgmt
  • MMC
  • ActiveX
  • vb
Classes | Functions

mmcsample.h File Reference

Go to the source code of this file.

Classes

class CWrapVBComponent

Functions

DECLARE_INTERFACE_ (_VBComponent, IDispatch)
DEFINE_GUID (CLSID_VBComponent, 0xCD3A5DAAL, 0x8CA5, 0x11D2, 0x8A, 0x0B, 0x00, 0x00, 0x21, 0x47, 0x31, 0x28)
DEFINE_GUID (IID__VBComponent, 0xC224F73FL, 0x8D72, 0x11D2, 0x8A, 0x0B, 0x00, 0x00, 0x21, 0x47, 0x31, 0x28)

Function Documentation

DECLARE_INTERFACE_ | ( | _VBComponent | ,
 |  | IDispatch |
 | ) |  |

Definition at line 4 of file mmcsample.h.

{
    STDMETHOD(StartAnimation)(THIS) PURE;
    STDMETHOD(StopAnimation)(THIS) PURE;
};

DEFINE_GUID | ( | CLSID_VBComponent | ,
 |  | 0xCD3A5DAAL | ,
 |  | 0x8CA5 | ,
 |  | 0x11D2 | ,
 |  | 0x8A | ,
 |  | 0x0B | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x21 | ,
 |  | 0x47 | ,
 |  | 0x31 | ,
 |  | 0x28 |
 | ) |  |
DEFINE_GUID | ( | IID__VBComponent | ,
 |  | 0xC224F73FL | ,
 |  | 0x8D72 | ,
 |  | 0x11D2 | ,
 |  | 0x8A | ,
 |  | 0x0B | ,
 |  | 0x00 | ,
 |  | 0x00 | ,
 |  | 0x21 | ,
 |  | 0x47 | ,
 |  | 0x31 | ,
 |  | 0x28 |
 | ) |  |
Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CMenu/about.Cpp File Reference

  • SysMgmt
  • MMC
  • CMenu
Functions

about.Cpp File Reference

#include "About.h"
#include "resource.h"
#include "globals.h"
#include <crtdbg.h>

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CSnapinAbout

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 89 of file about.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        // we need to decrement our object count in the DLL
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:54:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CMenu/about.h File Reference

  • SysMgmt
  • MMC
  • CMenu
Classes

about.h File Reference

#include <tchar.h>
#include <mmc.h>

Go to the source code of this file.

Classes

class CSnapinAbout
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CMenu/basesnap.Cpp File Reference

  • SysMgmt
  • MMC
  • CMenu
Functions | Variables

basesnap.Cpp File Reference

#include <objbase.h>
#include <olectl.h>
#include <initguid.h>
#include "guids.h"
#include "basesnap.h"
#include "Comp.h"
#include "CompData.h"
#include "About.h"
#include "Registry.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)
BOOL WINAPI | DllMain (HINSTANCE hinstDLL, DWORD fdwReason, void *lpvReserved)
STDAPI | DllRegisterServer ()
STDAPI | DllUnregisterServer ()
STDMETHODIMP_ (ULONG) CClassFactory

Variables

HINSTANCE | g_hinst

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 77 of file basesnap.Cpp.

{
    if (g_uObjects == 0 && g_uSrvLock == 0)
        return S_OK;
    else
        return S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 45 of file basesnap.Cpp.

{
    if ((rclsid != CLSID_CComponentData) && (rclsid != CLSID_CSnapinAbout))
        return CLASS_E_CLASSNOTAVAILABLE;

    if (!ppvObj)
        return E_FAIL;

    *ppvObj = NULL;

    // We can only hand out IUnknown and IClassFactory pointers.  Fail
    // if they ask for anything else.
    if (!IsEqualIID(riid, IID_IUnknown) && !IsEqualIID(riid, IID_IClassFactory))
        return E_NOINTERFACE;

    CClassFactory *pFactory = NULL;

    // make the factory passing in the creation function for the type of object they want
    if (rclsid == CLSID_CComponentData)
        pFactory = new CClassFactory(CClassFactory::COMPONENT);
    else if (rclsid == CLSID_CSnapinAbout)
        pFactory = new CClassFactory(CClassFactory::ABOUT);

    if (NULL == pFactory)
        return E_OUTOFMEMORY;

    HRESULT hr = pFactory->QueryInterface(riid, ppvObj);

    return hr;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hinstDLL,
 |  | DWORD | fdwReason,
 |  | void * | lpvReserved
 | ) |  |

Definition at line 32 of file basesnap.Cpp.

{

    if (fdwReason == DLL_PROCESS_ATTACH) {
        g_hinst = hinstDLL;
    }

    return TRUE;
}

STDAPI DllRegisterServer ( void )

Definition at line 187 of file basesnap.Cpp.

{
    HRESULT hr = SELFREG_E_CLASS;
    _TCHAR szName[256];
    _TCHAR szSnapInName[256];

    LoadString(g_hinst, IDS_NAME, szName, (sizeof szName)/(sizeof szName[0]));
    LoadString(g_hinst, IDS_SNAPINNAME, szSnapInName, (sizeof szSnapInName)/(sizeof szSnapInName[0]));

    _TCHAR szAboutName[256];

    LoadString(g_hinst, IDS_ABOUTNAME, szAboutName, (sizeof szAboutName)/(sizeof szAboutName[0]));

    // register our CoClasses
    hr = RegisterServer(g_hinst,
        CLSID_CComponentData,
        szName);

    if SUCCEEDED(hr)
        hr = RegisterServer(g_hinst,
        CLSID_CSnapinAbout,
        szAboutName);

    // place the registry information for SnapIns
    if SUCCEEDED(hr)
        hr = RegisterSnapin(CLSID_CComponentData, szSnapInName, CLSID_CSnapinAbout, FALSE);

    return hr;
}

STDAPI DllUnregisterServer ( void )

Definition at line 218 of file basesnap.Cpp.

{
    if (UnregisterServer(CLSID_CComponentData) == S_OK)
        return UnregisterSnapin(CLSID_CComponentData);
    else
        return E_FAIL;
}

STDMETHODIMP_ ( ULONG )

Definition at line 124 of file basesnap.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;
}

Variable Documentation

HINSTANCE g_hinst

Definition at line 30 of file basesnap.Cpp.

Generated on Wed Nov 13 2024 16:54:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CMenu/basesnap.h File Reference

  • SysMgmt
  • MMC
  • CMenu
Classes | Functions | Variables

basesnap.h File Reference

Go to the source code of this file.

Classes

class | CClassFactory

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)

Variables

ULONG | g_uObjects = 0
ULONG | g_uSrvLock = 0

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 53 of file ComSpyAudit.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 61 of file ComSpyAudit.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

Variable Documentation

ULONG g_uObjects = 0

Definition at line 24 of file basesnap.h.

ULONG g_uSrvLock = 0

Definition at line 25 of file basesnap.h.

Generated on Wed Nov 13 2024 16:54:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CMenu/comp.Cpp File Reference

  • SysMgmt
  • MMC
  • CMenu
Functions

comp.Cpp File Reference

#include "Comp.h"
#include "DataObj.h"
#include <commctrl.h>
#include <crtdbg.h>
#include "globals.h"
#include "resource.h"
#include "DeleBase.h"
#include "CompData.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CComponent

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 67 of file comp.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CMenu/comp.h File Reference

  • SysMgmt
  • MMC
  • CMenu
Classes

comp.h File Reference

#include <mmc.h>

Go to the source code of this file.

Classes

class CComponent
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CMenu/compdata.Cpp File Reference

  • SysMgmt
  • MMC
  • CMenu
Functions

compdata.Cpp File Reference

#include "Comp.h"
#include "CompData.h"
#include "DataObj.h"
#include "resource.h"
#include <crtdbg.h>

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CComponentData

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 85 of file compdata.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        // we need to decrement our object count in the DLL
        delete this;
        return 0;
    }

    return m_cref;
}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CMenu/compdata.h File Reference

  • SysMgmt
  • MMC
  • CMenu
Classes

compdata.h File Reference

#include <mmc.h>
#include "DeleBase.h"
#include "StatNode.h"
#include "Comp.h"
#include "DeleBase.h"
#include "StatNode.h"

Go to the source code of this file.

Classes

class CComponentData
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CMenu/dataobj.Cpp File Reference

  • SysMgmt
  • MMC
  • CMenu
Defines | Functions

dataobj.Cpp File Reference

#include "DataObj.h"
#include "guids.h"
#include "DeleBase.h"

Go to the source code of this file.

Defines

#define | _T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")
#define | _T_CCF_INTERNAL_SNAPIN _T("{2479DB32-5276-11d2-94F5-00C04FB92EC2}")
#define | _T_CCF_NODETYPE _T("CCF_NODETYPE")
#define | _T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")
#define | _T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")

Functions

CDataObject * | GetOurDataObject (LPDATAOBJECT lpDataObject)
STDMETHODIMP_ (ULONG) CDataObject

Define Documentation

#define _T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")

Definition at line 31 of file dataobj.Cpp.

#define _T_CCF_INTERNAL_SNAPIN _T("{2479DB32-5276-11d2-94F5-00C04FB92EC2}")

Definition at line 36 of file dataobj.Cpp.

#define _T_CCF_NODETYPE _T("CCF_NODETYPE")

Definition at line 32 of file dataobj.Cpp.

#define _T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")

Definition at line 34 of file dataobj.Cpp.

#define _T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")

Definition at line 33 of file dataobj.Cpp.

Function Documentation

CDataObject* GetOurDataObject ( LPDATAOBJECT lpDataObject )

Definition at line 165 of file dataobj.Cpp.

{
    HRESULT       hr      = S_OK;
    CDataObject *pSDO     = NULL;

  // check to see if the data object is a special data object.
  if ( IS_SPECIAL_DATAOBJECT (lpDataObject) )
  {
    //Code for handling a special data object goes here.

    //Note that the MMC SDK samples do not handle
    //special data objects, so we exit if we get one.
    return NULL;
  }

    STGMEDIUM stgmedium = { TYMED_HGLOBAL,  NULL  };
    FORMATETC formatetc = { CDataObject::s_cfInternal, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };

    // Allocate memory for the stream
    stgmedium.hGlobal = GlobalAlloc( GMEM_SHARE, sizeof(CDataObject *));

    if (!stgmedium.hGlobal)     {
        hr = E_OUTOFMEMORY;
    }

    if SUCCEEDED(hr)
        // Attempt to get data from the object
        hr = lpDataObject->GetDataHere( &formatetc, &stgmedium );

    // stgmedium now has the data we need
    if (SUCCEEDED(hr))  {
        pSDO = *(CDataObject **)(stgmedium.hGlobal);
    }

    // if we have memory free it
    if (stgmedium.hGlobal)
        GlobalFree(stgmedium.hGlobal);

    return pSDO;

} // end GetOurDataObject()

STDMETHODIMP_ ( ULONG )

Definition at line 87 of file dataobj.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CMenu/dataobj.h File Reference

  • SysMgmt
  • MMC
  • CMenu
Classes | Functions

dataobj.h File Reference

#include <mmc.h>
#include "DeleBase.h"

Go to the source code of this file.

Classes

class | CDataObject

Functions

HRESULT | ExtractFromDataObject (IDataObject *lpDataObject, UINT cf, ULONG cb, HGLOBAL *phGlobal)
CDataObject * | GetOurDataObject (IDataObject *lpDataObject)

Function Documentation

HRESULT ExtractFromDataObject | ( | IDataObject * | lpDataObject,
 |  | UINT | cf,
 |  | ULONG | cb,
 |  | HGLOBAL * | phGlobal
 | ) |  |
CDataObject* GetOurDataObject ( IDataObject * lpDataObject )
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CMenu/delebase.Cpp File Reference

  • SysMgmt
  • MMC
  • CMenu

delebase.Cpp File Reference

#include "DeleBase.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CMenu/delebase.h File Reference

  • SysMgmt
  • MMC
  • CMenu
Classes

delebase.h File Reference

#include <mmc.h>
#include <crtdbg.h>
#include "globals.h"
#include "resource.h"
#include "LocalRes.h"
#include "LocalRes.h"

Go to the source code of this file.

Classes

class CDelegationBase
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CMenu/globals.h File Reference

  • SysMgmt
  • MMC
  • CMenu
Classes | Defines | Functions | Variables

globals.h File Reference

#include <tchar.h>

Go to the source code of this file.

Classes

class | TempBuffer

Defines

#define | IDM_BUTTON1 0x100
#define | IDM_BUTTON2 0x101
#define | MAKE_TSTRPTR_FROMWIDE(ptrname, widestr)
#define | MAKE_WIDEPTR_FROMTSTR(ptrname, tstr)
#define | MAKE_WIDEPTR_FROMTSTR_ALLOC(ptrname, tstr)
#define | OBJECT_CREATED InterlockedIncrement((long *)&g_uObjects);
#define | OBJECT_DESTROYED InterlockedDecrement((long *)&g_uObjects);

Functions

void | MMCN_Crack (BOOL bComponentData, IDataObject *pDataObject, IComponentData *pCompData, IComponent *pComp, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)

Variables

HINSTANCE | g_hinst
ULONG g_uObjects

Define Documentation

#define IDM_BUTTON1 0x100

Definition at line 25 of file globals.h.

#define IDM_BUTTON2 0x101

Definition at line 26 of file globals.h.

#define MAKE_TSTRPTR_FROMWIDE | ( | ptrname,
 |  | widestr
 | ) |
Value:
long __l##ptrname = (wcslen(widestr) + 1) * 2 * sizeof(TCHAR); \
    TempBuffer __TempBuffer##ptrname(__l##ptrname); \
    WideCharToMultiByte(CP_ACP, 0, widestr, -1, (LPSTR)__TempBuffer##ptrname.GetBuffer(), __l##ptrname, NULL, NULL); \
    LPTSTR ptrname = (LPTSTR)__TempBuffer##ptrname.GetBuffer()

Definition at line 127 of file globals.h.

#define MAKE_WIDEPTR_FROMTSTR | ( | ptrname,
 |  | tstr
 | ) |
Value:
long __cch##ptrname = (lstrlenA(tstr) + 1);\
    long __l##ptrname = (lstrlenA(tstr) + 1) * sizeof(WCHAR); \
    TempBuffer __TempBuffer##ptrname(__l##ptrname); \
    MultiByteToWideChar(CP_ACP, 0, tstr, -1, (LPWSTR)__TempBuffer##ptrname.GetBuffer(), __cch##ptrname); \
    LPWSTR ptrname = (LPWSTR)__TempBuffer##ptrname.GetBuffer()

Definition at line 93 of file globals.h.

#define MAKE_WIDEPTR_FROMTSTR_ALLOC | ( | ptrname,
 |  | tstr
 | ) |
Value:
long __cch##ptrname = (lstrlenA(tstr) + 1);\
    long __l##ptrname = (lstrlenA(tstr) + 1) * sizeof(WCHAR); \
    LPWSTR ptrname = (LPWSTR)CoTaskMemAlloc(__l##ptrname); \
    MultiByteToWideChar(CP_ACP, 0, tstr, -1, ptrname, __cch##ptrname)

Definition at line 107 of file globals.h.

#define OBJECT_CREATED InterlockedIncrement((long *)&g_uObjects);

Definition at line 31 of file globals.h.

#define OBJECT_DESTROYED InterlockedDecrement((long *)&g_uObjects);

Definition at line 32 of file globals.h.

Function Documentation

void MMCN_Crack | ( | BOOL | bComponentData,
 |  | IDataObject * | pDataObject,
 |  | IComponentData * | pCompData,
 |  | IComponent * | pComp,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param
 | ) |  |

Definition at line 59 of file mmccrack.Cpp.

{
#ifdef MMC_CRACK_MESSAGES
        const size_t cchMessage = 256;
  TCHAR message[cchMessage] = {0};

  if (bComponentData == TRUE)
    OutputDebugString(_T("IComponentData::Notify( "));
  else
    OutputDebugString(_T("IComponent::Notify( "));

  wsprintf(message, _T("DataObject: %08x, CompData: %08x, Comp: %08x ) - "), pDataObject, pCompData, pComp);
  OutputDebugString(message);

    switch (event)  {
    case MMCN_ACTIVATE:
      wsprintf(message, _T("MMCN_ACTIVATE\n\tActivate: %d\n"), arg);
      break;

    case MMCN_ADD_IMAGES:
      wsprintf(message, _T("MMCN_ADD_IMAGES\n\tImage List: %08x\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_BTN_CLICK:
      wsprintf(message, _T("MMCN_BTN_CLICK\n\tVerb: %ws\n"), MMCN_CrackVerb((MMC_CONSOLE_VERB)param));
      break;

    case MMCN_COLUMN_CLICK:
      wsprintf(message, _T("MMCN_COLUMN_CLICK\n\tColumn: %d\n\tSort Option: %d\n"), arg,   param);
      break;

    case MMCN_COLUMNS_CHANGED:
      wsprintf(message, _T("MMCN_COLUMNS_CHANGED\n"));
      break;

    case MMCN_CONTEXTHELP:
      wsprintf(message, _T("MMCN_CONTEXTHELP\n"));
      break;

    case MMCN_CONTEXTMENU:
      wsprintf(message, _T("MMCN_CONTEXTMENU\n"));
      break;

    case MMCN_CUTORMOVE:
      wsprintf(message, _T("MMCN_CUTORMOVE\n"));
      break;

    case MMCN_DBLCLICK:
      wsprintf(message, _T("MMCN_DBLCLICK\n"));
      break;

    case MMCN_DELETE:
      wsprintf(message, _T("MMCN_DELETE\n"));
      break;

    case MMCN_DESELECT_ALL:
      wsprintf(message, _T("MMCN_DESELECT_ALL\n"));
      break;

    case MMCN_EXPAND:
      wsprintf(message, _T("MMCN_EXPAND\n\tExpand: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_EXPANDSYNC:
      wsprintf(message, _T("MMCN_EXPANDSYNC\n"));
      break;

    case MMCN_FILTERBTN_CLICK:
      wsprintf(message, _T("MMCN_FILTERBTN_CLICK\n\tColumn: %d\n"), arg);
      break;

    case MMCN_FILTER_CHANGE:
      wsprintf(message, _T("MMCN_FILTER_CHANGE\n\tColumn: %d\n"), param);
      break;

    case MMCN_HELP:
      wsprintf(message, _T("MMCN_HELP\n"));
      break;

    case MMCN_INITOCX:
      wsprintf(message, _T("MMCN_INITOCX\n\tIUnknown: %08x\n"), param);
      break;

    case MMCN_LISTPAD:
      wsprintf(message, _T("MMCN_LISTPAD\n\tConnect: %d\n"), arg);
      break;

    case MMCN_MENU_BTNCLICK:
      wsprintf(message, _T("MMCN_MENU_BTNCLICK\n"));
      break;

    case MMCN_MINIMIZED:
      wsprintf(message, _T("MMCN_MINIMIZED\n\tMinimized: %d\n"), arg);
      break;

    case MMCN_PASTE:
      wsprintf(message, _T("MMCN_PASTE\n\tCopy: %d\n"), param == NULL);
      break;

    case MMCN_PRELOAD:
      wsprintf(message, _T("MMCN_PRELOAD\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_PRINT:
      wsprintf(message, _T("MMCN_PRINT\n"));
      break;

    case MMCN_PROPERTY_CHANGE:
      wsprintf(message, _T("MMCN_PROPERTY_CHANGE\n\tScope: %d\n\tArg: %08x\n"), arg, param);
      break;

    case MMCN_QUERY_PASTE:
      wsprintf(message, _T("MMCN_QUERY_PASTE\n"));
      break;

    case MMCN_REFRESH:
      wsprintf(message, _T("MMCN_REFRESH\n"));
      break;

    case MMCN_REMOVE_CHILDREN:
      wsprintf(message, _T("MMCN_REMOVE_CHILDREN\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_RENAME:
                        // Destination string may contain a truncation of the ideal result.
                        // (Indicated by return value other than S_OK).
                        // However, it will be null-terminated.
      StringCchPrintf(message, cchMessage, _T("MMCN_RENAME\n\tNew Name: '%ws'\n"), (LPOLESTR)param);
      break;

    case MMCN_RESTORE_VIEW:
      wsprintf(message, _T("MMCN_RESTORE_VIEW\n"));
      break;

    case MMCN_SELECT:
      wsprintf(message, _T("MMCN_SELECT\n\tScope: %d\n\tSelect: %08x\n"), LOWORD(arg), HIWORD(arg));
      break;

    case MMCN_SHOW:
      wsprintf(message, _T("MMCN_SHOW\n\tShow: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_SNAPINHELP:
      wsprintf(message, _T("MMCN_SNAPINHELP\n"));
      break;

    case MMCN_VIEW_CHANGE:
      wsprintf(message, _T("MMCN_VIEW_CHANGE\n\tData: %08x\n\tHint: %08x\n"), arg, param);
      break;
  }

  if (message[0] != 0)
    OutputDebugString(message);
  else
    OutputDebugString(_T("unknown event\n"));

#endif
  return;
}

Variable Documentation

HINSTANCE g_hinst

Definition at line 33 of file SetDisp.h.

ULONG g_uObjects

Definition at line 24 of file basesnap.h.

Generated on Wed Nov 13 2024 16:54:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CMenu/guids.h File Reference

  • SysMgmt
  • MMC
  • CMenu
Functions

guids.h File Reference

Go to the source code of this file.

Functions

DEFINE_GUID (CLSID_CComponentData, 0xb5982ec8, 0x8971, 0x11d2, 0x8a, 0x9, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28)
DEFINE_GUID (CLSID_CSnapinAbout, 0xb5982eca, 0x8971, 0x11d2, 0x8a, 0x9, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28)

Function Documentation

DEFINE_GUID | ( | CLSID_CComponentData | ,
 |  | 0xb5982ec8 | ,
 |  | 0x8971 | ,
 |  | 0x11d2 | ,
 |  | 0x8a | ,
 |  | 0x9 | ,
 |  | 0x0 | ,
 |  | 0x0 | ,
 |  | 0x21 | ,
 |  | 0x47 | ,
 |  | 0x31 | ,
 |  | 0x28 |
 | ) |  |
DEFINE_GUID | ( | CLSID_CSnapinAbout | ,
 |  | 0xb5982eca | ,
 |  | 0x8971 | ,
 |  | 0x11d2 | ,
 |  | 0x8a | ,
 |  | 0x9 | ,
 |  | 0x0 | ,
 |  | 0x0 | ,
 |  | 0x21 | ,
 |  | 0x47 | ,
 |  | 0x31 | ,
 |  | 0x28 |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CMenu/land.Cpp File Reference

  • SysMgmt
  • MMC
  • CMenu

land.Cpp File Reference

#include "Land.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CMenu/land.h File Reference

  • SysMgmt
  • MMC
  • CMenu
Classes

land.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class CLandBasedVehicle
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CMenu/localres.h File Reference

  • SysMgmt
  • MMC
  • CMenu
Defines

localres.h File Reference

Go to the source code of this file.

Defines

#define | INDEX_CLOSEDFOLDER 4
#define | INDEX_LANDICON 1
#define | INDEX_NONE -1
#define | INDEX_OPENFOLDER 5
#define | INDEX_PEOPLEICON 3
#define | INDEX_SKYICON 2
#define | INDEX_SPACEICON 0

Define Documentation

#define INDEX_CLOSEDFOLDER 4

Definition at line 27 of file localres.h.

#define INDEX_LANDICON 1

Definition at line 24 of file localres.h.

#define INDEX_NONE -1

Definition at line 22 of file localres.h.

#define INDEX_OPENFOLDER 5

Definition at line 28 of file localres.h.

#define INDEX_PEOPLEICON 3

Definition at line 26 of file localres.h.

#define INDEX_SKYICON 2

Definition at line 25 of file localres.h.

#define INDEX_SPACEICON 0

Definition at line 23 of file localres.h.

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CMenu/mmccrack.Cpp File Reference

  • SysMgmt
  • MMC
  • CMenu
Defines | Functions

mmccrack.Cpp File Reference

#include <mmc.h>
#include <winuser.h>
#include <tchar.h>
#include "globals.h"
#include <strsafe.h>

Go to the source code of this file.

Defines

#define | STRSAFE_NO_DEPRECATE

Functions

void | MMCN_Crack (BOOL bComponentData, IDataObject *pDataObject, IComponentData *pCompData, IComponent *pComp, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)

Define Documentation

#define STRSAFE_NO_DEPRECATE

Definition at line 25 of file mmccrack.Cpp.

Function Documentation

void MMCN_Crack | ( | BOOL | bComponentData,
 |  | IDataObject * | pDataObject,
 |  | IComponentData * | pCompData,
 |  | IComponent * | pComp,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param
 | ) |  |

Definition at line 59 of file mmccrack.Cpp.

{
#ifdef MMC_CRACK_MESSAGES
        const size_t cchMessage = 256;
  TCHAR message[cchMessage] = {0};

  if (bComponentData == TRUE)
    OutputDebugString(_T("IComponentData::Notify( "));
  else
    OutputDebugString(_T("IComponent::Notify( "));

  wsprintf(message, _T("DataObject: %08x, CompData: %08x, Comp: %08x ) - "), pDataObject, pCompData, pComp);
  OutputDebugString(message);

    switch (event)  {
    case MMCN_ACTIVATE:
      wsprintf(message, _T("MMCN_ACTIVATE\n\tActivate: %d\n"), arg);
      break;

    case MMCN_ADD_IMAGES:
      wsprintf(message, _T("MMCN_ADD_IMAGES\n\tImage List: %08x\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_BTN_CLICK:
      wsprintf(message, _T("MMCN_BTN_CLICK\n\tVerb: %ws\n"), MMCN_CrackVerb((MMC_CONSOLE_VERB)param));
      break;

    case MMCN_COLUMN_CLICK:
      wsprintf(message, _T("MMCN_COLUMN_CLICK\n\tColumn: %d\n\tSort Option: %d\n"), arg,   param);
      break;

    case MMCN_COLUMNS_CHANGED:
      wsprintf(message, _T("MMCN_COLUMNS_CHANGED\n"));
      break;

    case MMCN_CONTEXTHELP:
      wsprintf(message, _T("MMCN_CONTEXTHELP\n"));
      break;

    case MMCN_CONTEXTMENU:
      wsprintf(message, _T("MMCN_CONTEXTMENU\n"));
      break;

    case MMCN_CUTORMOVE:
      wsprintf(message, _T("MMCN_CUTORMOVE\n"));
      break;

    case MMCN_DBLCLICK:
      wsprintf(message, _T("MMCN_DBLCLICK\n"));
      break;

    case MMCN_DELETE:
      wsprintf(message, _T("MMCN_DELETE\n"));
      break;

    case MMCN_DESELECT_ALL:
      wsprintf(message, _T("MMCN_DESELECT_ALL\n"));
      break;

    case MMCN_EXPAND:
      wsprintf(message, _T("MMCN_EXPAND\n\tExpand: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_EXPANDSYNC:
      wsprintf(message, _T("MMCN_EXPANDSYNC\n"));
      break;

    case MMCN_FILTERBTN_CLICK:
      wsprintf(message, _T("MMCN_FILTERBTN_CLICK\n\tColumn: %d\n"), arg);
      break;

    case MMCN_FILTER_CHANGE:
      wsprintf(message, _T("MMCN_FILTER_CHANGE\n\tColumn: %d\n"), param);
      break;

    case MMCN_HELP:
      wsprintf(message, _T("MMCN_HELP\n"));
      break;

    case MMCN_INITOCX:
      wsprintf(message, _T("MMCN_INITOCX\n\tIUnknown: %08x\n"), param);
      break;

    case MMCN_LISTPAD:
      wsprintf(message, _T("MMCN_LISTPAD\n\tConnect: %d\n"), arg);
      break;

    case MMCN_MENU_BTNCLICK:
      wsprintf(message, _T("MMCN_MENU_BTNCLICK\n"));
      break;

    case MMCN_MINIMIZED:
      wsprintf(message, _T("MMCN_MINIMIZED\n\tMinimized: %d\n"), arg);
      break;

    case MMCN_PASTE:
      wsprintf(message, _T("MMCN_PASTE\n\tCopy: %d\n"), param == NULL);
      break;

    case MMCN_PRELOAD:
      wsprintf(message, _T("MMCN_PRELOAD\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_PRINT:
      wsprintf(message, _T("MMCN_PRINT\n"));
      break;

    case MMCN_PROPERTY_CHANGE:
      wsprintf(message, _T("MMCN_PROPERTY_CHANGE\n\tScope: %d\n\tArg: %08x\n"), arg, param);
      break;

    case MMCN_QUERY_PASTE:
      wsprintf(message, _T("MMCN_QUERY_PASTE\n"));
      break;

    case MMCN_REFRESH:
      wsprintf(message, _T("MMCN_REFRESH\n"));
      break;

    case MMCN_REMOVE_CHILDREN:
      wsprintf(message, _T("MMCN_REMOVE_CHILDREN\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_RENAME:
                        // Destination string may contain a truncation of the ideal result.
                        // (Indicated by return value other than S_OK).
                        // However, it will be null-terminated.
      StringCchPrintf(message, cchMessage, _T("MMCN_RENAME\n\tNew Name: '%ws'\n"), (LPOLESTR)param);
      break;

    case MMCN_RESTORE_VIEW:
      wsprintf(message, _T("MMCN_RESTORE_VIEW\n"));
      break;

    case MMCN_SELECT:
      wsprintf(message, _T("MMCN_SELECT\n\tScope: %d\n\tSelect: %08x\n"), LOWORD(arg), HIWORD(arg));
      break;

    case MMCN_SHOW:
      wsprintf(message, _T("MMCN_SHOW\n\tShow: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_SNAPINHELP:
      wsprintf(message, _T("MMCN_SNAPINHELP\n"));
      break;

    case MMCN_VIEW_CHANGE:
      wsprintf(message, _T("MMCN_VIEW_CHANGE\n\tData: %08x\n\tHint: %08x\n"), arg, param);
      break;
  }

  if (message[0] != 0)
    OutputDebugString(message);
  else
    OutputDebugString(_T("unknown event\n"));

#endif
  return;
}

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CMenu/people.Cpp File Reference

  • SysMgmt
  • MMC
  • CMenu

people.Cpp File Reference

#include <stdio.h>
#include "People.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CMenu/people.h File Reference

  • SysMgmt
  • MMC
  • CMenu
Classes

people.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class | CBicycle
class | CBicycleFolder
class | CIceSkate
class | CIceSkateFolder
class | CPeoplePoweredVehicle
class | CSkateboard
class | CSkateboardFolder
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CMenu/registry.Cpp File Reference

  • SysMgmt
  • MMC
  • CMenu
Defines | Functions

registry.Cpp File Reference

#include <objbase.h>
#include <assert.h>
#include "Registry.h"
#include "globals.h"

Go to the source code of this file.

Defines

#define | STRINGS_ONLY

Functions

LONG | recursiveDeleteKey (HKEY hKeyParent, const _TCHAR *szKeyChild)
HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const _TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const _TCHAR *szNameString, const CLSID &clsidAbout, const BOOL fSupportExtensions)
BOOL | setKeyAndValue (const _TCHAR *pszPath, const _TCHAR *szSubkey, const _TCHAR *szValue)
BOOL | setSnapInKeyAndValue (const _TCHAR *szKey, const _TCHAR *szSubkey, const _TCHAR *szName, const _TCHAR *szValue)
BOOL | setValue (const _TCHAR *szKey, const _TCHAR *szValueName, const _TCHAR *szValue)
LONG | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Define Documentation

#define STRINGS_ONLY

Definition at line 24 of file registry.Cpp.

Function Documentation

LONG recursiveDeleteKey | ( | HKEY | hKeyParent,
 |  | const _TCHAR * | szKeyChild
 | ) |  |

Definition at line 214 of file registry.Cpp.

{
    // Open the child.
    HKEY hKeyChild ;
    LONG lRes = RegOpenKeyEx(hKeyParent, lpszKeyChild, 0,
        KEY_ALL_ACCESS, &hKeyChild) ;
    if (lRes != ERROR_SUCCESS)
    {
        return lRes ;
    }

    // Enumerate all of the decendents of this child.
    FILETIME time ;
    _TCHAR szBuffer[256] ;
    DWORD dwSize = 256 ;
    while (RegEnumKeyEx(hKeyChild, 0, szBuffer, &dwSize, NULL,
        NULL, NULL, &time) == S_OK)
    {
        // Delete the decendents of this child.
        lRes = recursiveDeleteKey(hKeyChild, szBuffer) ;
        if (lRes != ERROR_SUCCESS)
        {
            // Cleanup before exiting.
            RegCloseKey(hKeyChild) ;
            return lRes;
        }
        dwSize = 256 ;
    }

    // Close the child.
    RegCloseKey(hKeyChild) ;

    // Delete this child.
    return RegDeleteKey(hKeyParent, lpszKeyChild) ;
}

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const _TCHAR * | szFriendlyName
 | ) |  |

Definition at line 67 of file registry.Cpp.

{
    // Get server location.
    _TCHAR szModule[512] ;
    DWORD dwResult =
        ::GetModuleFileName(hModule,
        szModule,
        sizeof(szModule)/sizeof(_TCHAR)) ;

    assert(dwResult != 0) ;

    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    assert(SUCCEEDED(hr)) ;

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;
  _tcscat(szKey, pszCLSID) ;

    // Add the CLSID to the registry.
    setKeyAndValue(szKey, NULL, szFriendlyName) ;

    // Add the server filename subkey under the CLSID key.
    setKeyAndValue(szKey, _T("InprocServer32"), szModule) ;

    // set the threading model
    _tcscat(szKey, _T("\\InprocServer32"));
    setValue(szKey, _T("ThreadingModel"), _T("Apartment"));

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const _TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | fSupportExtensions
 | ) |  |

Definition at line 140 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    LPOLESTR wszAboutCLSID = NULL;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    if (IID_NULL != clsidAbout)
        hr = StringFromCLSID(clsidAbout, &wszAboutCLSID);

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszAboutCLSID, wszAboutCLSID);

    // Add the CLSID to the registry.
    setSnapInKeyAndValue(pszCLSID, NULL, _T("NameString"), szNameString) ;
    setSnapInKeyAndValue(pszCLSID, _T("StandAlone"), NULL, NULL);
    if (IID_NULL != clsidAbout)
        setSnapInKeyAndValue(pszCLSID, NULL, _T("About"), pszAboutCLSID);

    if (fSupportExtensions) {
        // Build the key NodeType
        setSnapInKeyAndValue(pszCLSID, _T("NodeTypes"), NULL, NULL);

        _TCHAR szKey[64] ;
        _tcscpy(szKey, pszCLSID) ;
        _tcscat(szKey, _T("\\NodeTypes")) ;
        setSnapInKeyAndValue(szKey, pszCLSID, NULL, NULL);
    }

    // Free memory.
    CoTaskMemFree(wszCLSID) ;
    if (IID_NULL != clsidAbout)
        CoTaskMemFree(wszAboutCLSID);

    return S_OK ;
}

BOOL setKeyAndValue | ( | const _TCHAR * | pszPath,
 |  | const _TCHAR * | szSubkey,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 256 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Copy keyname into buffer.
    _tcscpy(szKeyBuf, szKey) ;

    // Add subkey name to buffer.
    if (szSubkey != NULL)
    {
        _tcscat(szKeyBuf, _T("\\")) ;
        _tcscat(szKeyBuf, szSubkey ) ;
    }

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, NULL, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

BOOL setSnapInKeyAndValue | ( | const _TCHAR * | szKey,
 |  | const _TCHAR * | szSubkey,
 |  | const _TCHAR * | szName,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 337 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\")) ;
    _tcscat(szKeyBuf, szKey) ;

    // Add subkey name to buffer.
    if (szSubkey != NULL)
    {
        _tcscat(szKeyBuf, _T("\\")) ;
        _tcscat(szKeyBuf, szSubkey ) ;
    }

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, szName, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

BOOL setValue | ( | const _TCHAR * | szKey,
 |  | const _TCHAR * | szValueName,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 299 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Copy keyname into buffer.
    _tcscpy(szKeyBuf, szKey) ;

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, szValueName, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

LONG UnregisterServer ( const CLSID & clsid )

Definition at line 112 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

  MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
  _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 184 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CMenu/registry.h File Reference

  • SysMgmt
  • MMC
  • CMenu
Functions

registry.h File Reference

#include <tchar.h>

Go to the source code of this file.

Functions

HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const _TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const _TCHAR *szNameString, const CLSID &clsidAbout, const BOOL fSupportExtensions=FALSE)
HRESULT | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Function Documentation

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const _TCHAR * | szFriendlyName
 | ) |  |

Definition at line 67 of file registry.Cpp.

{
    // Get server location.
    _TCHAR szModule[512] ;
    DWORD dwResult =
        ::GetModuleFileName(hModule,
        szModule,
        sizeof(szModule)/sizeof(_TCHAR)) ;

    assert(dwResult != 0) ;

    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    assert(SUCCEEDED(hr)) ;

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;
  _tcscat(szKey, pszCLSID) ;

    // Add the CLSID to the registry.
    setKeyAndValue(szKey, NULL, szFriendlyName) ;

    // Add the server filename subkey under the CLSID key.
    setKeyAndValue(szKey, _T("InprocServer32"), szModule) ;

    // set the threading model
    _tcscat(szKey, _T("\\InprocServer32"));
    setValue(szKey, _T("ThreadingModel"), _T("Apartment"));

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const _TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | fSupportExtensions = FALSE
 | ) |  |

Definition at line 140 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    LPOLESTR wszAboutCLSID = NULL;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    if (IID_NULL != clsidAbout)
        hr = StringFromCLSID(clsidAbout, &wszAboutCLSID);

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszAboutCLSID, wszAboutCLSID);

    // Add the CLSID to the registry.
    setSnapInKeyAndValue(pszCLSID, NULL, _T("NameString"), szNameString) ;
    setSnapInKeyAndValue(pszCLSID, _T("StandAlone"), NULL, NULL);
    if (IID_NULL != clsidAbout)
        setSnapInKeyAndValue(pszCLSID, NULL, _T("About"), pszAboutCLSID);

    if (fSupportExtensions) {
        // Build the key NodeType
        setSnapInKeyAndValue(pszCLSID, _T("NodeTypes"), NULL, NULL);

        _TCHAR szKey[64] ;
        _tcscpy(szKey, pszCLSID) ;
        _tcscat(szKey, _T("\\NodeTypes")) ;
        setSnapInKeyAndValue(szKey, pszCLSID, NULL, NULL);
    }

    // Free memory.
    CoTaskMemFree(wszCLSID) ;
    if (IID_NULL != clsidAbout)
        CoTaskMemFree(wszAboutCLSID);

    return S_OK ;
}

HRESULT UnregisterServer ( const CLSID & clsid )

Definition at line 112 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

  MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
  _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 184 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Generated on Wed Nov 13 2024 16:53:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CMenu/resource.h File Reference

  • SysMgmt
  • MMC
  • CMenu
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | ID_BUTTON40016 40016
#define | ID_BUTTON40017 40017
#define | ID_BUTTON40018 40018
#define | ID_BUTTON40019 40019
#define | ID_BUTTON40020 40020
#define | ID_BUTTON40021 40021
#define | ID_BUTTON40022 40022
#define | ID_BUTTON40023 40023
#define | ID_BUTTON40024 40024
#define | ID_BUTTON40025 40025
#define | ID_BUTTON40026 40026
#define | IDB_BIKE 40007
#define | IDB_BIKE2 40011
#define | IDB_CAR 40005
#define | IDB_CAR2 40009
#define | IDB_CLOSED 40014
#define | IDB_CLOSED2 40012
#define | IDB_LGBMP 126
#define | IDB_OPEN 40015
#define | IDB_OPEN2 40013
#define | IDB_PLANE 40006
#define | IDB_PLANE2 40010
#define | IDB_ROCKET 40004
#define | IDB_ROCKET2 40008
#define | IDB_SMBMP 125
#define | IDB_SMOPEN 124
#define | IDI_ICON1 108
#define | IDR_LGICONS 121
#define | IDR_SMICONS 120
#define | IDS_ABOUTNAME 9
#define | IDS_HELPFILE 1
#define | IDS_NAME 3
#define | IDS_SNAPINDESC 2
#define | IDS_SNAPINNAME 6

Define Documentation

#define ID_BUTTON40016 40016

Definition at line 28 of file resource.h.

#define ID_BUTTON40017 40017

Definition at line 29 of file resource.h.

#define ID_BUTTON40018 40018

Definition at line 30 of file resource.h.

#define ID_BUTTON40019 40019

Definition at line 31 of file resource.h.

#define ID_BUTTON40020 40020

Definition at line 32 of file resource.h.

#define ID_BUTTON40021 40021

Definition at line 33 of file resource.h.

#define ID_BUTTON40022 40022

Definition at line 34 of file resource.h.

#define ID_BUTTON40023 40023

Definition at line 35 of file resource.h.

#define ID_BUTTON40024 40024

Definition at line 36 of file resource.h.

#define ID_BUTTON40025 40025

Definition at line 37 of file resource.h.

#define ID_BUTTON40026 40026

Definition at line 38 of file resource.h.

#define IDB_BIKE 40007

Definition at line 19 of file resource.h.

#define IDB_BIKE2 40011

Definition at line 23 of file resource.h.

#define IDB_CAR 40005

Definition at line 17 of file resource.h.

#define IDB_CAR2 40009

Definition at line 21 of file resource.h.

#define IDB_CLOSED 40014

Definition at line 26 of file resource.h.

#define IDB_CLOSED2 40012

Definition at line 24 of file resource.h.

#define IDB_LGBMP 126

Definition at line 15 of file resource.h.

#define IDB_OPEN 40015

Definition at line 27 of file resource.h.

#define IDB_OPEN2 40013

Definition at line 25 of file resource.h.

#define IDB_PLANE 40006

Definition at line 18 of file resource.h.

#define IDB_PLANE2 40010

Definition at line 22 of file resource.h.

#define IDB_ROCKET 40004

Definition at line 16 of file resource.h.

#define IDB_ROCKET2 40008

Definition at line 20 of file resource.h.

#define IDB_SMBMP 125

Definition at line 14 of file resource.h.

#define IDB_SMOPEN 124

Definition at line 13 of file resource.h.

#define IDI_ICON1 108

Definition at line 10 of file resource.h.

#define IDR_LGICONS 121

Definition at line 12 of file resource.h.

#define IDR_SMICONS 120

Definition at line 11 of file resource.h.

#define IDS_ABOUTNAME 9

Definition at line 9 of file resource.h.

#define IDS_HELPFILE 1

Definition at line 5 of file resource.h.

#define IDS_NAME 3

Definition at line 7 of file resource.h.

#define IDS_SNAPINDESC 2

Definition at line 6 of file resource.h.

#define IDS_SNAPINNAME 6

Definition at line 8 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CMenu/sky.Cpp File Reference

  • SysMgmt
  • MMC
  • CMenu

sky.Cpp File Reference

#include "Sky.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CMenu/sky.h File Reference

  • SysMgmt
  • MMC
  • CMenu
Classes

sky.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class CSkyBasedVehicle
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CMenu/space.Cpp File Reference

  • SysMgmt
  • MMC
  • CMenu
Defines

space.Cpp File Reference

#include "Space.h"
#include "Comp.h"
#include <stdio.h>
#include <strsafe.h>

Go to the source code of this file.

Defines

#define STRSAFE_NO_DEPRECATE

Define Documentation

#define STRSAFE_NO_DEPRECATE

Definition at line 23 of file space.Cpp.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CMenu/space.h File Reference

  • SysMgmt
  • MMC
  • CMenu
Classes

space.h File Reference

#include "DeleBase.h"
#include "CompData.h"

Go to the source code of this file.

Classes

class | CRocket
class | CSpaceVehicle
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CMenu/statnode.Cpp File Reference

  • SysMgmt
  • MMC
  • CMenu

statnode.Cpp File Reference

#include "StatNode.h"
#include "Space.h"
#include "Sky.h"
#include "People.h"
#include "Land.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CMenu/statnode.h File Reference

  • SysMgmt
  • MMC
  • CMenu
Classes

statnode.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class CStaticNode
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CMenuExt/about.Cpp File Reference

  • SysMgmt
  • MMC
  • CMenuExt
Functions

about.Cpp File Reference

#include "About.h"
#include "resource.h"
#include "globals.h"
#include <crtdbg.h>

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CSnapinAbout

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 89 of file about.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        // we need to decrement our object count in the DLL
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:54:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CMenuExt/about.h File Reference

  • SysMgmt
  • MMC
  • CMenuExt
Classes

about.h File Reference

#include <tchar.h>
#include <mmc.h>

Go to the source code of this file.

Classes

class CSnapinAbout
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CMenuExt/basesnap.Cpp File Reference

  • SysMgmt
  • MMC
  • CMenuExt
Functions | Variables

basesnap.Cpp File Reference

#include <objbase.h>
#include <olectl.h>
#include <initguid.h>
#include "globals.h"
#include "resource.h"
#include "guids.h"
#include "basesnap.h"
#include "CMenuExt.h"
#include "About.h"
#include "Registry.h"
#include "Extend.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)
BOOL WINAPI | DllMain (HINSTANCE hinstDLL, DWORD fdwReason, void *lpvReserved)
STDAPI | DllRegisterServer ()
STDAPI | DllUnregisterServer ()
STDMETHODIMP_ (ULONG) CClassFactory

Variables

HINSTANCE | g_hinst

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 80 of file basesnap.Cpp.

{
    if (g_uObjects == 0 && g_uSrvLock == 0)
        return S_OK;
    else
        return S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 48 of file basesnap.Cpp.

{
    if ((rclsid != CLSID_CContextMenuExtension) && (rclsid != CLSID_CSnapinAbout))
        return CLASS_E_CLASSNOTAVAILABLE;

    if (!ppvObj)
        return E_FAIL;

    *ppvObj = NULL;

    // We can only hand out IUnknown and IClassFactory pointers.  Fail
    // if they ask for anything else.
    if (!IsEqualIID(riid, IID_IUnknown) && !IsEqualIID(riid, IID_IClassFactory))
        return E_NOINTERFACE;

    CClassFactory *pFactory = NULL;

    // make the factory passing in the creation function for the type of object they want
    if (rclsid == CLSID_CContextMenuExtension)
        pFactory = new CClassFactory(CClassFactory::CONTEXTEXTENSION);
    else if (rclsid == CLSID_CSnapinAbout)
        pFactory = new CClassFactory(CClassFactory::ABOUT);

    if (NULL == pFactory)
        return E_OUTOFMEMORY;

    HRESULT hr = pFactory->QueryInterface(riid, ppvObj);

    return hr;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hinstDLL,
 |  | DWORD | fdwReason,
 |  | void * | lpvReserved
 | ) |  |

Definition at line 35 of file basesnap.Cpp.

{

    if (fdwReason == DLL_PROCESS_ATTACH) {
        g_hinst = hinstDLL;
    }

    return TRUE;
}

STDAPI DllRegisterServer ( void )

Definition at line 190 of file basesnap.Cpp.

{
    HRESULT hr = SELFREG_E_CLASS;

    _TCHAR szName[256];
    _TCHAR szSnapInName[256];

    LoadString(g_hinst, IDS_NAME, szName, (sizeof szName)/(sizeof szName[0]));
    LoadString(g_hinst, IDS_SNAPINNAME, szSnapInName, (sizeof szSnapInName)/(sizeof szSnapInName[0]));

    _TCHAR szAboutName[256];

    LoadString(g_hinst, IDS_ABOUTNAME, szAboutName, (sizeof szAboutName)/(sizeof szAboutName[0]));

    // register our CoClasses
    hr = RegisterServer(g_hinst,
        CLSID_CContextMenuExtension,
        szName);

    if SUCCEEDED(hr)
        hr = RegisterServer(g_hinst,
        CLSID_CSnapinAbout,
        szAboutName);

    // place the registry information for SnapIns
    if SUCCEEDED(hr)
        hr = RegisterSnapin(CLSID_CContextMenuExtension, szSnapInName, CLSID_CSnapinAbout);

    return hr;
}

STDAPI DllUnregisterServer ( void )

Definition at line 223 of file basesnap.Cpp.

{
    if (UnregisterServer(CLSID_CContextMenuExtension) == S_OK)
        return UnregisterSnapin(CLSID_CContextMenuExtension);
    else
        return E_FAIL;
}

STDMETHODIMP_ ( ULONG )

Definition at line 127 of file basesnap.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;
}

Variable Documentation

HINSTANCE g_hinst

Definition at line 32 of file basesnap.Cpp.

Generated on Wed Nov 13 2024 16:54:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CMenuExt/basesnap.h File Reference

  • SysMgmt
  • MMC
  • CMenuExt
Classes | Functions | Variables

basesnap.h File Reference

Go to the source code of this file.

Classes

class | CClassFactory

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)

Variables

ULONG | g_uObjects = 0
ULONG | g_uSrvLock = 0

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 53 of file ComSpyAudit.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 61 of file ComSpyAudit.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

Variable Documentation

ULONG g_uObjects = 0

Definition at line 24 of file basesnap.h.

ULONG g_uSrvLock = 0

Definition at line 25 of file basesnap.h.

Generated on Wed Nov 13 2024 16:54:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CMenuExt/cMenuext.Cpp File Reference

  • SysMgmt
  • MMC
  • CMenuExt
Defines | Functions

cMenuext.Cpp File Reference

#include "CMenuExt.h"
#include "globals.h"
#include "resource.h"
#include <crtdbg.h>

Go to the source code of this file.

Defines

#define | _T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")
#define | _T_CCF_NODETYPE _T("CCF_NODETYPE")
#define | _T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")

Functions

STDMETHODIMP_ (ULONG) CContextMenuExtension

Define Documentation

#define _T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")

Definition at line 26 of file cMenuext.Cpp.

#define _T_CCF_NODETYPE _T("CCF_NODETYPE")

Definition at line 27 of file cMenuext.Cpp.

#define _T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")

Definition at line 28 of file cMenuext.Cpp.

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 77 of file cMenuext.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        // we need to decrement our object count in the DLL
        delete this;
        return 0;
    }

    return m_cref;
}

Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CMenuExt/cMenuext.h File Reference

  • SysMgmt
  • MMC
  • CMenuExt
Classes

cMenuext.h File Reference

#include <tchar.h>
#include <mmc.h>

Go to the source code of this file.

Classes

class CContextMenuExtension
Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CMenuExt/extend.h File Reference

  • SysMgmt
  • MMC
  • CMenuExt
Classes | Enumerations

extend.h File Reference

Go to the source code of this file.

Classes

struct | EXTENDER_NODE
struct | EXTENSION_NODE

Enumerations

enum EXTENSION_TYPE {
NameSpaceExtension, ContextMenuExtension, ToolBarExtension, PropertySheetExtension,
TaskExtension, DynamicExtension, DummyExtension, NameSpaceExtension,
ContextMenuExtension, ToolBarExtension, PropertySheetExtension, TaskExtension,
DynamicExtension, DummyExtension, NameSpaceExtension, ContextMenuExtension,
ToolBarExtension, PropertySheetExtension, TaskExtension, DynamicExtension,
DummyExtension, NameSpaceExtension, ContextMenuExtension, ToolBarExtension,
PropertySheetExtension, TaskExtension, DynamicExtension, DummyExtension
}

Enumeration Type Documentation

enum EXTENSION_TYPE
Enumerator:
NameSpaceExtension
ContextMenuExtension
ToolBarExtension
PropertySheetExtension
TaskExtension
DynamicExtension
DummyExtension
NameSpaceExtension
ContextMenuExtension
ToolBarExtension
PropertySheetExtension
TaskExtension
DynamicExtension
DummyExtension
NameSpaceExtension
ContextMenuExtension
ToolBarExtension
PropertySheetExtension
TaskExtension
DynamicExtension
DummyExtension
NameSpaceExtension
ContextMenuExtension
ToolBarExtension
PropertySheetExtension
TaskExtension
DynamicExtension
DummyExtension

Definition at line 29 of file extend.h.

{
    NameSpaceExtension,
        ContextMenuExtension,
        ToolBarExtension,
        PropertySheetExtension,
        TaskExtension,
        DynamicExtension,
  DummyExtension
};

Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CMenuExt/globals.h File Reference

  • SysMgmt
  • MMC
  • CMenuExt
Classes | Defines | Variables

globals.h File Reference

#include <tchar.h>

Go to the source code of this file.

Classes

class | TempBuffer

Defines

#define | IDM_BUTTON1 0x100
#define | IDM_BUTTON2 0x101
#define | MAKE_TSTRPTR_FROMWIDE(ptrname, widestr)
#define | MAKE_WIDEPTR_FROMTSTR(ptrname, tstr)
#define | MAKE_WIDEPTR_FROMTSTR_ALLOC(ptrname, tstr)
#define | OBJECT_CREATED InterlockedIncrement((long *)&g_uObjects);
#define | OBJECT_DESTROYED InterlockedDecrement((long *)&g_uObjects);

Variables

HINSTANCE | g_hinst
ULONG g_uObjects

Define Documentation

#define IDM_BUTTON1 0x100

Definition at line 25 of file globals.h.

#define IDM_BUTTON2 0x101

Definition at line 26 of file globals.h.

#define MAKE_TSTRPTR_FROMWIDE | ( | ptrname,
 |  | widestr
 | ) |
Value:
long __l##ptrname = (wcslen(widestr) + 1) * 2 * sizeof(TCHAR); \
    TempBuffer __TempBuffer##ptrname(__l##ptrname); \
    WideCharToMultiByte(CP_ACP, 0, widestr, -1, (LPSTR)__TempBuffer##ptrname.GetBuffer(), __l##ptrname, NULL, NULL); \
    LPTSTR ptrname = (LPTSTR)__TempBuffer##ptrname.GetBuffer()

Definition at line 118 of file globals.h.

#define MAKE_WIDEPTR_FROMTSTR | ( | ptrname,
 |  | tstr
 | ) |
Value:
long __cch##ptrname = (lstrlenA(tstr) + 1);\
    long __l##ptrname = (lstrlenA(tstr) + 1) * sizeof(WCHAR); \
    TempBuffer __TempBuffer##ptrname(__l##ptrname); \
    MultiByteToWideChar(CP_ACP, 0, tstr, -1, (LPWSTR)__TempBuffer##ptrname.GetBuffer(), __cch##ptrname); \
    LPWSTR ptrname = (LPWSTR)__TempBuffer##ptrname.GetBuffer()

Definition at line 84 of file globals.h.

#define MAKE_WIDEPTR_FROMTSTR_ALLOC | ( | ptrname,
 |  | tstr
 | ) |
Value:
long __cch##ptrname = (lstrlenA(tstr) + 1);\
    long __l##ptrname = (lstrlenA(tstr) + 1) * sizeof(WCHAR); \
    LPWSTR ptrname = (LPWSTR)CoTaskMemAlloc(__l##ptrname); \
    MultiByteToWideChar(CP_ACP, 0, tstr, -1, ptrname, __cch##ptrname)

Definition at line 98 of file globals.h.

#define OBJECT_CREATED InterlockedIncrement((long *)&g_uObjects);

Definition at line 31 of file globals.h.

#define OBJECT_DESTROYED InterlockedDecrement((long *)&g_uObjects);

Definition at line 32 of file globals.h.

Variable Documentation

HINSTANCE g_hinst

Definition at line 33 of file SetDisp.h.

ULONG g_uObjects

Definition at line 24 of file basesnap.h.

Generated on Wed Nov 13 2024 16:54:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CMenuExt/guids.h File Reference

  • SysMgmt
  • MMC
  • CMenuExt
Functions

guids.h File Reference

Go to the source code of this file.

Functions

DEFINE_GUID (CLSID_CContextMenuExtension, 0xce0f5bf0, 0xabfb, 0x11d2, 0x99, 0x3a, 0x0, 0x80, 0xc7, 0x68, 0x78, 0xbf)
DEFINE_GUID (CLSID_CSnapinAbout, 0xce0f5bf2, 0xabfb, 0x11d2, 0x99, 0x3a, 0x0, 0x80, 0xc7, 0x68, 0x78, 0xbf)

Function Documentation

DEFINE_GUID | ( | CLSID_CContextMenuExtension | ,
 |  | 0xce0f5bf0 | ,
 |  | 0xabfb | ,
 |  | 0x11d2 | ,
 |  | 0x99 | ,
 |  | 0x3a | ,
 |  | 0x0 | ,
 |  | 0x80 | ,
 |  | 0xc7 | ,
 |  | 0x68 | ,
 |  | 0x78 | ,
 |  | 0xbf |
 | ) |  |
DEFINE_GUID | ( | CLSID_CSnapinAbout | ,
 |  | 0xce0f5bf2 | ,
 |  | 0xabfb | ,
 |  | 0x11d2 | ,
 |  | 0x99 | ,
 |  | 0x3a | ,
 |  | 0x0 | ,
 |  | 0x80 | ,
 |  | 0xc7 | ,
 |  | 0x68 | ,
 |  | 0x78 | ,
 |  | 0xbf |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CMenuExt/localres.h File Reference

  • SysMgmt
  • MMC
  • CMenuExt
Defines

localres.h File Reference

Go to the source code of this file.

Defines

#define | INDEX_CLOSEDFOLDER 4
#define | INDEX_CLOUD 9
#define | INDEX_LANDICON 1
#define | INDEX_NONE -1
#define | INDEX_OPENFOLDER 5
#define | INDEX_PEOPLEICON 3
#define | INDEX_RAIN 8
#define | INDEX_SKYICON 2
#define | INDEX_SNOW 7
#define | INDEX_SPACEICON 0
#define | INDEX_SUN 6
#define | INDEX_THUNDER 11
#define | INDEX_WORLD 10

Define Documentation

#define INDEX_CLOSEDFOLDER 4

Definition at line 27 of file localres.h.

#define INDEX_CLOUD 9

Definition at line 33 of file localres.h.

#define INDEX_LANDICON 1

Definition at line 24 of file localres.h.

#define INDEX_NONE -1

Definition at line 22 of file localres.h.

#define INDEX_OPENFOLDER 5

Definition at line 28 of file localres.h.

#define INDEX_PEOPLEICON 3

Definition at line 26 of file localres.h.

#define INDEX_RAIN 8

Definition at line 32 of file localres.h.

#define INDEX_SKYICON 2

Definition at line 25 of file localres.h.

#define INDEX_SNOW 7

Definition at line 31 of file localres.h.

#define INDEX_SPACEICON 0

Definition at line 23 of file localres.h.

#define INDEX_SUN 6

Definition at line 30 of file localres.h.

#define INDEX_THUNDER 11

Definition at line 35 of file localres.h.

#define INDEX_WORLD 10

Definition at line 34 of file localres.h.

Generated on Wed Nov 13 2024 16:54:37 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CMenuExt/registry.Cpp File Reference

  • SysMgmt
  • MMC
  • CMenuExt
Defines | Functions | Variables

registry.Cpp File Reference

#include <objbase.h>
#include <assert.h>
#include "Registry.h"
#include "Extend.h"
#include "globals.h"

Go to the source code of this file.

Defines

#define | STRINGS_ONLY

Functions

LONG | recursiveDeleteKey (HKEY hKeyParent, const _TCHAR *szKeyChild)
HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const _TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const _TCHAR *szNameString, const CLSID &clsidAbout, const BOOL fSupportExtensions)
BOOL | setKeyAndValue (const _TCHAR *pszPath, const _TCHAR *szSubkey, const _TCHAR *szValue)
BOOL | setSnapInKeyAndValue (const _TCHAR *szKey, const _TCHAR *szSubkey, const _TCHAR *szName, const _TCHAR *szValue)
BOOL | setValue (const _TCHAR *szKey, const _TCHAR *szValueName, const _TCHAR *szValue)
LONG | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Variables

EXTENDER_NODE _NodeExtensions []

Define Documentation

#define STRINGS_ONLY

Definition at line 24 of file registry.Cpp.

Function Documentation

LONG recursiveDeleteKey | ( | HKEY | hKeyParent,
 |  | const _TCHAR * | szKeyChild
 | ) |  |

Definition at line 283 of file registry.Cpp.

{
    // Open the child.
    HKEY hKeyChild ;
    LONG lRes = RegOpenKeyEx(hKeyParent, lpszKeyChild, 0,
        KEY_ALL_ACCESS, &hKeyChild) ;
    if (lRes != ERROR_SUCCESS)
    {
        return lRes ;
    }

    // Enumerate all of the decendents of this child.
    FILETIME time ;
    _TCHAR szBuffer[256] ;
    DWORD dwSize = 256 ;
    while (RegEnumKeyEx(hKeyChild, 0, szBuffer, &dwSize, NULL,
        NULL, NULL, &time) == S_OK)
    {
        // Delete the decendents of this child.
        lRes = recursiveDeleteKey(hKeyChild, szBuffer) ;
        if (lRes != ERROR_SUCCESS)
        {
            // Cleanup before exiting.
            RegCloseKey(hKeyChild) ;
            return lRes;
        }
        dwSize = 256 ;
    }

    // Close the child.
    RegCloseKey(hKeyChild) ;

    // Delete this child.
    return RegDeleteKey(hKeyParent, lpszKeyChild) ;
}

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const _TCHAR * | szFriendlyName
 | ) |  |

Definition at line 82 of file registry.Cpp.

{
    // Get server location.
    _TCHAR szModule[512] ;
    DWORD dwResult =
        ::GetModuleFileName(hModule,
        szModule,
        sizeof(szModule)/sizeof(_TCHAR)) ;

    assert(dwResult != 0) ;

    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    assert(SUCCEEDED(hr)) ;

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;
  _tcscat(szKey, pszCLSID) ;

    // Add the CLSID to the registry.
    setKeyAndValue(szKey, NULL, szFriendlyName) ;

    // Add the server filename subkey under the CLSID key.
    setKeyAndValue(szKey, _T("InprocServer32"), szModule) ;

    // set the threading model
    _tcscat(szKey, _T("\\InprocServer32"));
    setValue(szKey, _T("ThreadingModel"), _T("Apartment"));

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const _TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | fSupportExtensions
 | ) |  |

Definition at line 156 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    LPOLESTR wszAboutCLSID = NULL;
    LPOLESTR wszExtendCLSID = NULL;
    LPOLESTR wszNodeCLSID = NULL;
    EXTENDER_NODE *pNodeExtension;
    _TCHAR szKeyBuf[1024] ;
    HKEY hKey;

    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    if (IID_NULL != clsidAbout)
        hr = StringFromCLSID(clsidAbout, &wszAboutCLSID);

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszAboutCLSID, wszAboutCLSID);

    // Add the CLSID to the registry.
    setSnapInKeyAndValue(pszCLSID, NULL, _T("NameString"), szNameString) ;
    if (IID_NULL != clsidAbout)
        setSnapInKeyAndValue(pszCLSID, NULL, _T("About"), pszAboutCLSID);

    if (fSupportExtensions) {
        // Build the key NodeType
        setSnapInKeyAndValue(pszCLSID, _T("NodeTypes"), NULL, NULL);

        _TCHAR szKey[64] ;
        _tcscpy(szKey, pszCLSID) ;
        _tcscat(szKey, _T("\\NodeTypes")) ;
        setSnapInKeyAndValue(szKey, pszCLSID, NULL, NULL);
    }

    // register each of the node extensions
    for (pNodeExtension = &(_NodeExtensions[0]);*pNodeExtension->szDescription;pNodeExtension++)
    {
        hr = StringFromCLSID(pNodeExtension->guidNode, &wszExtendCLSID);
        MAKE_TSTRPTR_FROMWIDE(pszExtendCLSID, wszExtendCLSID);
        _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\NodeTypes\\"));
        _tcscat(szKeyBuf, pszExtendCLSID);

        switch (pNodeExtension->eType) {
        case ContextMenuExtension:
            _tcscat(szKeyBuf, _T("\\Extensions\\ContextMenu"));
            break;
        default:
            break;
        }

        // Create and open key and subkey.
        long lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE ,
            szKeyBuf,
            0, NULL, REG_OPTION_NON_VOLATILE,
            KEY_ALL_ACCESS, NULL,
            &hKey, NULL) ;

        if (lResult != ERROR_SUCCESS)
        {
            return FALSE ;
        }

        hr = StringFromCLSID(pNodeExtension->guidExtension, &wszNodeCLSID);
        assert(SUCCEEDED(hr));

        MAKE_TSTRPTR_FROMWIDE(pszNodeCLSID, wszNodeCLSID);
        // Set the Value.
        if (pNodeExtension->szDescription != NULL)
        {
            RegSetValueEx(hKey, pszNodeCLSID, 0, REG_SZ,
                (BYTE *)pNodeExtension->szDescription,
                (_tcslen(pNodeExtension->szDescription)+1)*sizeof(_TCHAR)) ;
        }

        RegCloseKey(hKey) ;

        CoTaskMemFree(wszExtendCLSID);
        CoTaskMemFree(wszNodeCLSID);
    }

    // Free memory.
    CoTaskMemFree(wszCLSID) ;
    if (IID_NULL != clsidAbout)
        CoTaskMemFree(wszAboutCLSID);

    return S_OK ;
}

BOOL setKeyAndValue | ( | const _TCHAR * | pszPath,
 |  | const _TCHAR * | szSubkey,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 325 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Copy keyname into buffer.
    _tcscpy(szKeyBuf, szKey) ;

    // Add subkey name to buffer.
    if (szSubkey != NULL)
    {
        _tcscat(szKeyBuf, _T("\\")) ;
        _tcscat(szKeyBuf, szSubkey ) ;
    }

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, NULL, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

BOOL setSnapInKeyAndValue | ( | const _TCHAR * | szKey,
 |  | const _TCHAR * | szSubkey,
 |  | const _TCHAR * | szName,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 406 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\")) ;
    _tcscat(szKeyBuf, szKey) ;

    // Add subkey name to buffer.
    if (szSubkey != NULL)
    {
        _tcscat(szKeyBuf, _T("\\")) ;
        _tcscat(szKeyBuf, szSubkey ) ;
    }

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, szName, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

BOOL setValue | ( | const _TCHAR * | szKey,
 |  | const _TCHAR * | szValueName,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 368 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Copy keyname into buffer.
    _tcscpy(szKeyBuf, szKey) ;

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, szValueName, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

LONG UnregisterServer ( const CLSID & clsid )

Definition at line 127 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

  MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
  _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 253 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Variable Documentation

EXTENDER_NODE _NodeExtensions[]
Initial value:
 {
    {ContextMenuExtension,
    {0x2974380d, 0x4c4b, 0x11d2, { 0x89, 0xd8, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28}},
    {0xce0f5bf0, 0xabfb, 0x11d2, {0x99, 0x3a, 0x0, 0x80, 0xc7, 0x68, 0x78, 0xbf}},
    _T("Extension to the People-powered Node Context Menu")},

    {DummyExtension,
    NULL,
    NULL,
    NULL}
}

Definition at line 29 of file registry.Cpp.

Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CMenuExt/registry.h File Reference

  • SysMgmt
  • MMC
  • CMenuExt
Functions

registry.h File Reference

#include <tchar.h>

Go to the source code of this file.

Functions

HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const _TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const _TCHAR *szNameString, const CLSID &clsidAbout, const BOOL fSupportExtensions=FALSE)
HRESULT | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Function Documentation

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const _TCHAR * | szFriendlyName
 | ) |  |

Definition at line 67 of file registry.Cpp.

{
    // Get server location.
    _TCHAR szModule[512] ;
    DWORD dwResult =
        ::GetModuleFileName(hModule,
        szModule,
        sizeof(szModule)/sizeof(_TCHAR)) ;

    assert(dwResult != 0) ;

    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    assert(SUCCEEDED(hr)) ;

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;
  _tcscat(szKey, pszCLSID) ;

    // Add the CLSID to the registry.
    setKeyAndValue(szKey, NULL, szFriendlyName) ;

    // Add the server filename subkey under the CLSID key.
    setKeyAndValue(szKey, _T("InprocServer32"), szModule) ;

    // set the threading model
    _tcscat(szKey, _T("\\InprocServer32"));
    setValue(szKey, _T("ThreadingModel"), _T("Apartment"));

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const _TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | fSupportExtensions = FALSE
 | ) |  |

Definition at line 140 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    LPOLESTR wszAboutCLSID = NULL;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    if (IID_NULL != clsidAbout)
        hr = StringFromCLSID(clsidAbout, &wszAboutCLSID);

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszAboutCLSID, wszAboutCLSID);

    // Add the CLSID to the registry.
    setSnapInKeyAndValue(pszCLSID, NULL, _T("NameString"), szNameString) ;
    setSnapInKeyAndValue(pszCLSID, _T("StandAlone"), NULL, NULL);
    if (IID_NULL != clsidAbout)
        setSnapInKeyAndValue(pszCLSID, NULL, _T("About"), pszAboutCLSID);

    if (fSupportExtensions) {
        // Build the key NodeType
        setSnapInKeyAndValue(pszCLSID, _T("NodeTypes"), NULL, NULL);

        _TCHAR szKey[64] ;
        _tcscpy(szKey, pszCLSID) ;
        _tcscat(szKey, _T("\\NodeTypes")) ;
        setSnapInKeyAndValue(szKey, pszCLSID, NULL, NULL);
    }

    // Free memory.
    CoTaskMemFree(wszCLSID) ;
    if (IID_NULL != clsidAbout)
        CoTaskMemFree(wszAboutCLSID);

    return S_OK ;
}

HRESULT UnregisterServer ( const CLSID & clsid )

Definition at line 112 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

  MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
  _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 184 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Generated on Wed Nov 13 2024 16:53:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CMenuExt/resource.h File Reference

  • SysMgmt
  • MMC
  • CMenuExt
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | ID_BUTTON40016 40016
#define | ID_BUTTON40017 40017
#define | ID_BUTTON40018 40018
#define | ID_BUTTON40019 40019
#define | ID_BUTTON40020 40020
#define | ID_BUTTON40021 40021
#define | ID_BUTTON40022 40022
#define | ID_BUTTON40023 40023
#define | ID_BUTTON40024 40024
#define | ID_BUTTON40025 40025
#define | ID_BUTTON40026 40026
#define | IDB_BIKE 40007
#define | IDB_BIKE2 40011
#define | IDB_CAR 40005
#define | IDB_CAR2 40009
#define | IDB_CLOSED 40014
#define | IDB_CLOSED2 40012
#define | IDB_LGBMP 126
#define | IDB_OPEN 40015
#define | IDB_OPEN2 40013
#define | IDB_PLANE 40006
#define | IDB_PLANE2 40010
#define | IDB_ROCKET 40004
#define | IDB_ROCKET2 40008
#define | IDB_SMBMP 125
#define | IDB_SMOPEN 124
#define | IDI_ICON1 108
#define | IDR_LGICONS 121
#define | IDR_SMICONS 120
#define | IDS_ABOUTNAME 9
#define | IDS_HELPFILE 1
#define | IDS_NAME 3
#define | IDS_SNAPINDESC 2
#define | IDS_SNAPINNAME 6

Define Documentation

#define ID_BUTTON40016 40016

Definition at line 28 of file resource.h.

#define ID_BUTTON40017 40017

Definition at line 29 of file resource.h.

#define ID_BUTTON40018 40018

Definition at line 30 of file resource.h.

#define ID_BUTTON40019 40019

Definition at line 31 of file resource.h.

#define ID_BUTTON40020 40020

Definition at line 32 of file resource.h.

#define ID_BUTTON40021 40021

Definition at line 33 of file resource.h.

#define ID_BUTTON40022 40022

Definition at line 34 of file resource.h.

#define ID_BUTTON40023 40023

Definition at line 35 of file resource.h.

#define ID_BUTTON40024 40024

Definition at line 36 of file resource.h.

#define ID_BUTTON40025 40025

Definition at line 37 of file resource.h.

#define ID_BUTTON40026 40026

Definition at line 38 of file resource.h.

#define IDB_BIKE 40007

Definition at line 19 of file resource.h.

#define IDB_BIKE2 40011

Definition at line 23 of file resource.h.

#define IDB_CAR 40005

Definition at line 17 of file resource.h.

#define IDB_CAR2 40009

Definition at line 21 of file resource.h.

#define IDB_CLOSED 40014

Definition at line 26 of file resource.h.

#define IDB_CLOSED2 40012

Definition at line 24 of file resource.h.

#define IDB_LGBMP 126

Definition at line 15 of file resource.h.

#define IDB_OPEN 40015

Definition at line 27 of file resource.h.

#define IDB_OPEN2 40013

Definition at line 25 of file resource.h.

#define IDB_PLANE 40006

Definition at line 18 of file resource.h.

#define IDB_PLANE2 40010

Definition at line 22 of file resource.h.

#define IDB_ROCKET 40004

Definition at line 16 of file resource.h.

#define IDB_ROCKET2 40008

Definition at line 20 of file resource.h.

#define IDB_SMBMP 125

Definition at line 14 of file resource.h.

#define IDB_SMOPEN 124

Definition at line 13 of file resource.h.

#define IDI_ICON1 108

Definition at line 10 of file resource.h.

#define IDR_LGICONS 121

Definition at line 12 of file resource.h.

#define IDR_SMICONS 120

Definition at line 11 of file resource.h.

#define IDS_ABOUTNAME 9

Definition at line 9 of file resource.h.

#define IDS_HELPFILE 1

Definition at line 5 of file resource.h.

#define IDS_NAME 3

Definition at line 7 of file resource.h.

#define IDS_SNAPINDESC 2

Definition at line 6 of file resource.h.

#define IDS_SNAPINNAME 6

Definition at line 8 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Complete/about.Cpp File Reference

  • SysMgmt
  • MMC
  • Complete
Functions

about.Cpp File Reference

#include "About.h"
#include "resource.h"
#include "globals.h"
#include <crtdbg.h>

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CSnapinAbout

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 89 of file about.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        // we need to decrement our object count in the DLL
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:54:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Complete/about.h File Reference

  • SysMgmt
  • MMC
  • Complete
Classes

about.h File Reference

#include <tchar.h>
#include <mmc.h>

Go to the source code of this file.

Classes

class CSnapinAbout
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Complete/basesnap.Cpp File Reference

  • SysMgmt
  • MMC
  • Complete
Functions | Variables

basesnap.Cpp File Reference

#include <objbase.h>
#include <olectl.h>
#include <initguid.h>
#include "guids.h"
#include "basesnap.h"
#include "Comp.h"
#include "CompData.h"
#include "About.h"
#include "Registry.h"
#include "Extend.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)
BOOL WINAPI | DllMain (HINSTANCE hinstDLL, DWORD fdwReason, void *lpvReserved)
STDAPI | DllRegisterServer ()
STDAPI | DllUnregisterServer ()
STDMETHODIMP_ (ULONG) CClassFactory

Variables

HINSTANCE | g_hinst
NODESTRUCT g_Nodes []

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 124 of file basesnap.Cpp.

{
    if (g_uObjects == 0 && g_uSrvLock == 0)
        return S_OK;
    else
        return S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 92 of file basesnap.Cpp.

{
    if ((rclsid != CLSID_CComponentData) && (rclsid != CLSID_CSnapinAbout))
        return CLASS_E_CLASSNOTAVAILABLE;

    if (!ppvObj)
        return E_FAIL;

    *ppvObj = NULL;

    // We can only hand out IUnknown and IClassFactory pointers.  Fail
    // if they ask for anything else.
    if (!IsEqualIID(riid, IID_IUnknown) && !IsEqualIID(riid, IID_IClassFactory))
        return E_NOINTERFACE;

    CClassFactory *pFactory = NULL;

    // make the factory passing in the creation function for the type of object they want
    if (rclsid == CLSID_CComponentData)
        pFactory = new CClassFactory(CClassFactory::COMPONENT);
    else if (rclsid == CLSID_CSnapinAbout)
        pFactory = new CClassFactory(CClassFactory::ABOUT);

    if (NULL == pFactory)
        return E_OUTOFMEMORY;

    HRESULT hr = pFactory->QueryInterface(riid, ppvObj);

    return hr;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hinstDLL,
 |  | DWORD | fdwReason,
 |  | void * | lpvReserved
 | ) |  |

Definition at line 79 of file basesnap.Cpp.

{

    if (fdwReason == DLL_PROCESS_ATTACH) {
        g_hinst = hinstDLL;
    }

    return TRUE;
}

STDAPI DllRegisterServer ( void )

Definition at line 234 of file basesnap.Cpp.

{
    HRESULT hr = SELFREG_E_CLASS;
    _TCHAR szName[256];
    _TCHAR szSnapInName[256];

    LoadString(g_hinst, IDS_NAME, szName, (sizeof szName)/(sizeof szName[0]));
    LoadString(g_hinst, IDS_SNAPINNAME, szSnapInName, (sizeof szSnapInName)/(sizeof szSnapInName[0]));

    _TCHAR szAboutName[256];

    LoadString(g_hinst, IDS_ABOUTNAME, szAboutName, (sizeof szAboutName)/(sizeof szAboutName[0]));

    // register our CoClasses
    hr = RegisterServer(g_hinst,
        CLSID_CComponentData,
        szName);

    if SUCCEEDED(hr)
        hr = RegisterServer(g_hinst,
        CLSID_CSnapinAbout,
        szAboutName);

    // place the registry information for SnapIns
    if SUCCEEDED(hr)
        hr = RegisterSnapin(CLSID_CComponentData, szSnapInName, CLSID_CSnapinAbout);

    return hr;
}

STDAPI DllUnregisterServer ( void )

Definition at line 265 of file basesnap.Cpp.

{
    if (UnregisterServer(CLSID_CComponentData) == S_OK)
        return UnregisterSnapin(CLSID_CComponentData);
    else
        return E_FAIL;
}

STDMETHODIMP_ ( ULONG )

Definition at line 171 of file basesnap.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;
}

Variable Documentation

HINSTANCE g_hinst

Definition at line 31 of file basesnap.Cpp.

NODESTRUCT g_Nodes[]

Definition at line 36 of file basesnap.Cpp.

Generated on Wed Nov 13 2024 16:54:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Complete/basesnap.h File Reference

  • SysMgmt
  • MMC
  • Complete
Classes | Functions | Variables

basesnap.h File Reference

Go to the source code of this file.

Classes

class | CClassFactory

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)

Variables

ULONG | g_uObjects = 0
ULONG | g_uSrvLock = 0

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 53 of file ComSpyAudit.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 61 of file ComSpyAudit.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

Variable Documentation

ULONG g_uObjects = 0

Definition at line 24 of file basesnap.h.

ULONG g_uSrvLock = 0

Definition at line 25 of file basesnap.h.

Generated on Wed Nov 13 2024 16:54:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Complete/comp.Cpp File Reference

  • SysMgmt
  • MMC
  • Complete
Defines | Functions

comp.Cpp File Reference

#include "Comp.h"
#include "DataObj.h"
#include <commctrl.h>
#include <crtdbg.h>
#include "resource.h"
#include "DeleBase.h"
#include "CompData.h"
#include "globals.h"

Go to the source code of this file.

Defines

#define ARRAYLEN(x) (sizeof(x) / sizeof((x)[0]))

Functions

STDMETHODIMP_ (ULONG) CComponent

Define Documentation

#define ARRAYLEN ( x ) (sizeof(x) / sizeof((x)[0]))

Definition at line 29 of file comp.Cpp.

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 80 of file comp.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Complete/comp.h File Reference

  • SysMgmt
  • MMC
  • Complete
Classes

comp.h File Reference

#include <mmc.h>

Go to the source code of this file.

Classes

class CComponent
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Complete/compdata.Cpp File Reference

  • SysMgmt
  • MMC
  • Complete
Functions

compdata.Cpp File Reference

#include "Comp.h"
#include "CompData.h"
#include "DataObj.h"
#include "resource.h"
#include <crtdbg.h>

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CComponentData

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 82 of file compdata.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        // we need to decrement our object count in the DLL
        delete this;
        return 0;
    }

    return m_cref;
}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Complete/compdata.h File Reference

  • SysMgmt
  • MMC
  • Complete
Classes

compdata.h File Reference

#include <mmc.h>
#include "DeleBase.h"
#include "StatNode.h"
#include "Comp.h"
#include "DeleBase.h"
#include "StatNode.h"

Go to the source code of this file.

Classes

class CComponentData
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Complete/dataobj.Cpp File Reference

  • SysMgmt
  • MMC
  • Complete
Defines | Functions

dataobj.Cpp File Reference

#include "DataObj.h"
#include "guids.h"
#include "DeleBase.h"

Go to the source code of this file.

Defines

#define | _T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")
#define | _T_CCF_INTERNAL_SNAPIN _T("{2479DB32-5276-11d2-94F5-00C04FB92EC2}")
#define | _T_CCF_NODETYPE _T("CCF_NODETYPE")
#define | _T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")
#define | _T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")

Functions

CDataObject * | GetOurDataObject (LPDATAOBJECT lpDataObject)
STDMETHODIMP_ (ULONG) CDataObject

Define Documentation

#define _T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")

Definition at line 31 of file dataobj.Cpp.

#define _T_CCF_INTERNAL_SNAPIN _T("{2479DB32-5276-11d2-94F5-00C04FB92EC2}")

Definition at line 36 of file dataobj.Cpp.

#define _T_CCF_NODETYPE _T("CCF_NODETYPE")

Definition at line 32 of file dataobj.Cpp.

#define _T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")

Definition at line 34 of file dataobj.Cpp.

#define _T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")

Definition at line 33 of file dataobj.Cpp.

Function Documentation

CDataObject* GetOurDataObject ( LPDATAOBJECT lpDataObject )

Definition at line 165 of file dataobj.Cpp.

{
    HRESULT       hr      = S_OK;
    CDataObject *pSDO     = NULL;

  // check to see if the data object is a special data object.
  if ( IS_SPECIAL_DATAOBJECT (lpDataObject) )
  {
    //Code for handling a special data object goes here.

    //Note that the MMC SDK samples do not handle
    //special data objects, so we exit if we get one.
    return NULL;
  }

    STGMEDIUM stgmedium = { TYMED_HGLOBAL,  NULL  };
    FORMATETC formatetc = { CDataObject::s_cfInternal, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };

    // Allocate memory for the stream
    stgmedium.hGlobal = GlobalAlloc( GMEM_SHARE, sizeof(CDataObject *));

    if (!stgmedium.hGlobal)     {
        hr = E_OUTOFMEMORY;
    }

    if SUCCEEDED(hr)
        // Attempt to get data from the object
        hr = lpDataObject->GetDataHere( &formatetc, &stgmedium );

    // stgmedium now has the data we need
    if (SUCCEEDED(hr))  {
        pSDO = *(CDataObject **)(stgmedium.hGlobal);
    }

    // if we have memory free it
    if (stgmedium.hGlobal)
        GlobalFree(stgmedium.hGlobal);

    return pSDO;

} // end GetOurDataObject()

STDMETHODIMP_ ( ULONG )

Definition at line 87 of file dataobj.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Complete/dataobj.h File Reference

  • SysMgmt
  • MMC
  • Complete
Classes | Functions

dataobj.h File Reference

#include <mmc.h>
#include "DeleBase.h"

Go to the source code of this file.

Classes

class | CDataObject

Functions

HRESULT | ExtractFromDataObject (IDataObject *lpDataObject, UINT cf, ULONG cb, HGLOBAL *phGlobal)
CDataObject * | GetOurDataObject (IDataObject *lpDataObject)
BOOL | IsMMCMultiSelectDataObject (IDataObject *lpDataObject)

Function Documentation

HRESULT ExtractFromDataObject | ( | IDataObject * | lpDataObject,
 |  | UINT | cf,
 |  | ULONG | cb,
 |  | HGLOBAL * | phGlobal
 | ) |  |
CDataObject* GetOurDataObject ( IDataObject * lpDataObject )
BOOL IsMMCMultiSelectDataObject ( IDataObject * lpDataObject )
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Complete/delebase.Cpp File Reference

  • SysMgmt
  • MMC
  • Complete

delebase.Cpp File Reference

#include "DeleBase.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Complete/delebase.h File Reference

  • SysMgmt
  • MMC
  • Complete
Classes

delebase.h File Reference

#include <mmc.h>
#include <crtdbg.h>
#include "globals.h"
#include "resource.h"
#include "LocalRes.h"
#include "LocalRes.h"

Go to the source code of this file.

Classes

class CDelegationBase
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Complete/extend.h File Reference

  • SysMgmt
  • MMC
  • Complete
Classes

extend.h File Reference

#include <tchar.h>

Go to the source code of this file.

Classes

struct NODESTRUCT
Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Complete/globals.h File Reference

  • SysMgmt
  • MMC
  • Complete
Classes | Defines | Enumerations | Functions | Variables

globals.h File Reference

#include <mmc.h>
#include <tchar.h>

Go to the source code of this file.

Classes

class | TempBuffer

Defines

#define | IDM_BUTTON1 0x100
#define | IDM_BUTTON2 0x101
#define | MAKE_TSTRPTR_FROMWIDE(ptrname, widestr)
#define | MAKE_WIDEPTR_FROMTSTR(ptrname, tstr)
#define | MAKE_WIDEPTR_FROMTSTR_ALLOC(ptrname, tstr)
#define | OBJECT_CREATED InterlockedIncrement((long *)&g_uObjects);
#define | OBJECT_DESTROYED InterlockedDecrement((long *)&g_uObjects);

Enumerations

enum ITEM_TYPE {
SCOPE = 10, RESULT, SCOPE = 10, RESULT,
SCOPE = 10, RESULT
}
enum UPDATE_VIEWS_HINT {
UPDATE_SCOPEITEM = 1000, DELETE_SCOPEITEM, UPDATE_RESULTITEM, DELETE_RESULTITEM,
UPDATE_SCOPEITEM = 1000, DELETE_SCOPEITEM, UPDATE_RESULTITEM, DELETE_RESULTITEM,
UPDATE_SCOPEITEM = 1000, DELETE_SCOPEITEM, UPDATE_RESULTITEM, DELETE_RESULTITEM
}

Functions

void | MMCN_Crack (BOOL bComponentData, IDataObject *pDataObject, IComponentData *pCompData, IComponent *pComp, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)

Variables

HINSTANCE | g_hinst
ULONG g_uObjects

Define Documentation

#define IDM_BUTTON1 0x100

Definition at line 31 of file globals.h.

#define IDM_BUTTON2 0x101

Definition at line 32 of file globals.h.

#define MAKE_TSTRPTR_FROMWIDE | ( | ptrname,
 |  | widestr
 | ) |
Value:
long __l##ptrname = (wcslen(widestr) + 1) * 2 * sizeof(TCHAR); \
    TempBuffer __TempBuffer##ptrname(__l##ptrname); \
    WideCharToMultiByte(CP_ACP, 0, widestr, -1, (LPSTR)__TempBuffer##ptrname.GetBuffer(), __l##ptrname, NULL, NULL); \
    LPTSTR ptrname = (LPTSTR)__TempBuffer##ptrname.GetBuffer()

Definition at line 135 of file globals.h.

#define MAKE_WIDEPTR_FROMTSTR | ( | ptrname,
 |  | tstr
 | ) |
Value:
long __cch##ptrname = (lstrlenA(tstr) + 1);\
    long __l##ptrname = (lstrlenA(tstr) + 1) * sizeof(WCHAR); \
    TempBuffer __TempBuffer##ptrname(__l##ptrname); \
    MultiByteToWideChar(CP_ACP, 0, tstr, -1, (LPWSTR)__TempBuffer##ptrname.GetBuffer(), __cch##ptrname); \
    LPWSTR ptrname = (LPWSTR)__TempBuffer##ptrname.GetBuffer()

Definition at line 101 of file globals.h.

#define MAKE_WIDEPTR_FROMTSTR_ALLOC | ( | ptrname,
 |  | tstr
 | ) |
Value:
long __cch##ptrname = (lstrlenA(tstr) + 1);\
    long __l##ptrname = (lstrlenA(tstr) + 1) * sizeof(WCHAR); \
    LPWSTR ptrname = (LPWSTR)CoTaskMemAlloc(__l##ptrname); \
    MultiByteToWideChar(CP_ACP, 0, tstr, -1, ptrname, __cch##ptrname)

Definition at line 115 of file globals.h.

#define OBJECT_CREATED InterlockedIncrement((long *)&g_uObjects);

Definition at line 37 of file globals.h.

#define OBJECT_DESTROYED InterlockedDecrement((long *)&g_uObjects);

Definition at line 38 of file globals.h.

Enumeration Type Documentation

enum ITEM_TYPE
Enumerator:
SCOPE
RESULT
SCOPE
RESULT
SCOPE
RESULT

Definition at line 28 of file globals.h.

{SCOPE = 10, RESULT};

enum UPDATE_VIEWS_HINT
Enumerator:
UPDATE_SCOPEITEM
DELETE_SCOPEITEM
UPDATE_RESULTITEM
DELETE_RESULTITEM
UPDATE_SCOPEITEM
DELETE_SCOPEITEM
UPDATE_RESULTITEM
DELETE_RESULTITEM
UPDATE_SCOPEITEM
DELETE_SCOPEITEM
UPDATE_RESULTITEM
DELETE_RESULTITEM

Definition at line 27 of file globals.h.

{UPDATE_SCOPEITEM = 1000, DELETE_SCOPEITEM, UPDATE_RESULTITEM, DELETE_RESULTITEM};

Function Documentation

void MMCN_Crack | ( | BOOL | bComponentData,
 |  | IDataObject * | pDataObject,
 |  | IComponentData * | pCompData,
 |  | IComponent * | pComp,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param
 | ) |  |

Definition at line 59 of file mmccrack.Cpp.

{
#ifdef MMC_CRACK_MESSAGES
        const size_t cchMessage = 256;
  TCHAR message[cchMessage] = {0};

  if (bComponentData == TRUE)
    OutputDebugString(_T("IComponentData::Notify( "));
  else
    OutputDebugString(_T("IComponent::Notify( "));

  wsprintf(message, _T("DataObject: %08x, CompData: %08x, Comp: %08x ) - "), pDataObject, pCompData, pComp);
  OutputDebugString(message);

    switch (event)  {
    case MMCN_ACTIVATE:
      wsprintf(message, _T("MMCN_ACTIVATE\n\tActivate: %d\n"), arg);
      break;

    case MMCN_ADD_IMAGES:
      wsprintf(message, _T("MMCN_ADD_IMAGES\n\tImage List: %08x\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_BTN_CLICK:
      wsprintf(message, _T("MMCN_BTN_CLICK\n\tVerb: %ws\n"), MMCN_CrackVerb((MMC_CONSOLE_VERB)param));
      break;

    case MMCN_COLUMN_CLICK:
      wsprintf(message, _T("MMCN_COLUMN_CLICK\n\tColumn: %d\n\tSort Option: %d\n"), arg,   param);
      break;

    case MMCN_COLUMNS_CHANGED:
      wsprintf(message, _T("MMCN_COLUMNS_CHANGED\n"));
      break;

    case MMCN_CONTEXTHELP:
      wsprintf(message, _T("MMCN_CONTEXTHELP\n"));
      break;

    case MMCN_CONTEXTMENU:
      wsprintf(message, _T("MMCN_CONTEXTMENU\n"));
      break;

    case MMCN_CUTORMOVE:
      wsprintf(message, _T("MMCN_CUTORMOVE\n"));
      break;

    case MMCN_DBLCLICK:
      wsprintf(message, _T("MMCN_DBLCLICK\n"));
      break;

    case MMCN_DELETE:
      wsprintf(message, _T("MMCN_DELETE\n"));
      break;

    case MMCN_DESELECT_ALL:
      wsprintf(message, _T("MMCN_DESELECT_ALL\n"));
      break;

    case MMCN_EXPAND:
      wsprintf(message, _T("MMCN_EXPAND\n\tExpand: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_EXPANDSYNC:
      wsprintf(message, _T("MMCN_EXPANDSYNC\n"));
      break;

    case MMCN_FILTERBTN_CLICK:
      wsprintf(message, _T("MMCN_FILTERBTN_CLICK\n\tColumn: %d\n"), arg);
      break;

    case MMCN_FILTER_CHANGE:
      wsprintf(message, _T("MMCN_FILTER_CHANGE\n\tColumn: %d\n"), param);
      break;

    case MMCN_HELP:
      wsprintf(message, _T("MMCN_HELP\n"));
      break;

    case MMCN_INITOCX:
      wsprintf(message, _T("MMCN_INITOCX\n\tIUnknown: %08x\n"), param);
      break;

    case MMCN_LISTPAD:
      wsprintf(message, _T("MMCN_LISTPAD\n\tConnect: %d\n"), arg);
      break;

    case MMCN_MENU_BTNCLICK:
      wsprintf(message, _T("MMCN_MENU_BTNCLICK\n"));
      break;

    case MMCN_MINIMIZED:
      wsprintf(message, _T("MMCN_MINIMIZED\n\tMinimized: %d\n"), arg);
      break;

    case MMCN_PASTE:
      wsprintf(message, _T("MMCN_PASTE\n\tCopy: %d\n"), param == NULL);
      break;

    case MMCN_PRELOAD:
      wsprintf(message, _T("MMCN_PRELOAD\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_PRINT:
      wsprintf(message, _T("MMCN_PRINT\n"));
      break;

    case MMCN_PROPERTY_CHANGE:
      wsprintf(message, _T("MMCN_PROPERTY_CHANGE\n\tScope: %d\n\tArg: %08x\n"), arg, param);
      break;

    case MMCN_QUERY_PASTE:
      wsprintf(message, _T("MMCN_QUERY_PASTE\n"));
      break;

    case MMCN_REFRESH:
      wsprintf(message, _T("MMCN_REFRESH\n"));
      break;

    case MMCN_REMOVE_CHILDREN:
      wsprintf(message, _T("MMCN_REMOVE_CHILDREN\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_RENAME:
                        // Destination string may contain a truncation of the ideal result.
                        // (Indicated by return value other than S_OK).
                        // However, it will be null-terminated.
      StringCchPrintf(message, cchMessage, _T("MMCN_RENAME\n\tNew Name: '%ws'\n"), (LPOLESTR)param);
      break;

    case MMCN_RESTORE_VIEW:
      wsprintf(message, _T("MMCN_RESTORE_VIEW\n"));
      break;

    case MMCN_SELECT:
      wsprintf(message, _T("MMCN_SELECT\n\tScope: %d\n\tSelect: %08x\n"), LOWORD(arg), HIWORD(arg));
      break;

    case MMCN_SHOW:
      wsprintf(message, _T("MMCN_SHOW\n\tShow: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_SNAPINHELP:
      wsprintf(message, _T("MMCN_SNAPINHELP\n"));
      break;

    case MMCN_VIEW_CHANGE:
      wsprintf(message, _T("MMCN_VIEW_CHANGE\n\tData: %08x\n\tHint: %08x\n"), arg, param);
      break;
  }

  if (message[0] != 0)
    OutputDebugString(message);
  else
    OutputDebugString(_T("unknown event\n"));

#endif
  return;
}

Variable Documentation

HINSTANCE g_hinst

Definition at line 33 of file SetDisp.h.

ULONG g_uObjects

Definition at line 24 of file basesnap.h.

Generated on Wed Nov 13 2024 16:54:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Complete/guids.h File Reference

  • SysMgmt
  • MMC
  • Complete
Functions

guids.h File Reference

Go to the source code of this file.

Functions

DEFINE_GUID (CLSID_CComponentData, 0xcf03ac2a, 0x6be6, 0x11d3, 0x91, 0x56, 0x0, 0xc0, 0x4f, 0x65, 0xb3, 0xf9)
DEFINE_GUID (CLSID_CSnapinAbout, 0xd740704b, 0x6be6, 0x11d3, 0x91, 0x56, 0x0, 0xc0, 0x4f, 0x65, 0xb3, 0xf9)

Function Documentation

DEFINE_GUID | ( | CLSID_CComponentData | ,
 |  | 0xcf03ac2a | ,
 |  | 0x6be6 | ,
 |  | 0x11d3 | ,
 |  | 0x91 | ,
 |  | 0x56 | ,
 |  | 0x0 | ,
 |  | 0xc0 | ,
 |  | 0x4f | ,
 |  | 0x65 | ,
 |  | 0xb3 | ,
 |  | 0xf9 |
 | ) |  |
DEFINE_GUID | ( | CLSID_CSnapinAbout | ,
 |  | 0xd740704b | ,
 |  | 0x6be6 | ,
 |  | 0x11d3 | ,
 |  | 0x91 | ,
 |  | 0x56 | ,
 |  | 0x0 | ,
 |  | 0xc0 | ,
 |  | 0x4f | ,
 |  | 0x65 | ,
 |  | 0xb3 | ,
 |  | 0xf9 |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Complete/land.Cpp File Reference

  • SysMgmt
  • MMC
  • Complete

land.Cpp File Reference

#include "Land.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Complete/land.h File Reference

  • SysMgmt
  • MMC
  • Complete
Classes

land.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class CLandBasedVehicle
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Complete/localres.h File Reference

  • SysMgmt
  • MMC
  • Complete
Defines

localres.h File Reference

Go to the source code of this file.

Defines

#define | INDEX_CLOSEDFOLDER 4
#define | INDEX_LANDICON 1
#define | INDEX_NONE -1
#define | INDEX_OPENFOLDER 5
#define | INDEX_PEOPLEICON 3
#define | INDEX_SKYICON 2
#define | INDEX_SPACEICON 0

Define Documentation

#define INDEX_CLOSEDFOLDER 4

Definition at line 27 of file localres.h.

#define INDEX_LANDICON 1

Definition at line 24 of file localres.h.

#define INDEX_NONE -1

Definition at line 22 of file localres.h.

#define INDEX_OPENFOLDER 5

Definition at line 28 of file localres.h.

#define INDEX_PEOPLEICON 3

Definition at line 26 of file localres.h.

#define INDEX_SKYICON 2

Definition at line 25 of file localres.h.

#define INDEX_SPACEICON 0

Definition at line 23 of file localres.h.

Generated on Wed Nov 13 2024 16:54:37 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Complete/mmccrack.Cpp File Reference

  • SysMgmt
  • MMC
  • Complete
Defines | Functions

mmccrack.Cpp File Reference

#include <mmc.h>
#include <winuser.h>
#include <tchar.h>
#include "globals.h"
#include <strsafe.h>

Go to the source code of this file.

Defines

#define | STRSAFE_NO_DEPRECATE

Functions

void | MMCN_Crack (BOOL bComponentData, IDataObject *pDataObject, IComponentData *pCompData, IComponent *pComp, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)

Define Documentation

#define STRSAFE_NO_DEPRECATE

Definition at line 25 of file mmccrack.Cpp.

Function Documentation

void MMCN_Crack | ( | BOOL | bComponentData,
 |  | IDataObject * | pDataObject,
 |  | IComponentData * | pCompData,
 |  | IComponent * | pComp,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param
 | ) |  |

Definition at line 59 of file mmccrack.Cpp.

{
#ifdef MMC_CRACK_MESSAGES
        const size_t cchMessage = 256;
        TCHAR message[cchMessage] = {0};

        if (bComponentData == TRUE)
                OutputDebugString(_T("IComponentData::Notify( "));
        else
                OutputDebugString(_T("IComponent::Notify( "));

        wsprintf(message, _T("DataObject: %08x, CompData: %08x, Comp: %08x ) - "), pDataObject, pCompData, pComp);
        OutputDebugString(message);

    switch (event)      {
                case MMCN_ACTIVATE:
                        wsprintf(message, _T("MMCN_ACTIVATE\n\tActivate: %d\n"), arg);
                        break;

                case MMCN_ADD_IMAGES:
                        wsprintf(message, _T("MMCN_ADD_IMAGES\n\tImage List: %08x\n\tScope Item: %08x\n"), arg, param);
                        break;

                case MMCN_BTN_CLICK:
                        wsprintf(message, _T("MMCN_BTN_CLICK\n\tVerb: %ws\n"), MMCN_CrackVerb((MMC_CONSOLE_VERB)param));
                        break;

                case MMCN_COLUMN_CLICK:
                        wsprintf(message, _T("MMCN_COLUMN_CLICK\n\tColumn: %d\n\tSort Option: %d\n"), arg,       param);
                        break;

                case MMCN_COLUMNS_CHANGED:
                        wsprintf(message, _T("MMCN_COLUMNS_CHANGED\n"));
                        break;

                case MMCN_CONTEXTHELP:
                        wsprintf(message, _T("MMCN_CONTEXTHELP\n"));
                        break;

                case MMCN_CONTEXTMENU:
                        wsprintf(message, _T("MMCN_CONTEXTMENU\n"));
                        break;

                case MMCN_CUTORMOVE:
                        wsprintf(message, _T("MMCN_CUTORMOVE\n"));
                        break;

                case MMCN_DBLCLICK:
                        wsprintf(message, _T("MMCN_DBLCLICK\n"));
                        break;

                case MMCN_DELETE:
                        wsprintf(message, _T("MMCN_DELETE\n"));
                        break;

                case MMCN_DESELECT_ALL:
                        wsprintf(message, _T("MMCN_DESELECT_ALL\n"));
                        break;

                case MMCN_EXPAND:
                        wsprintf(message, _T("MMCN_EXPAND\n\tExpand: %d\n\tScope Item: %08x\n"), arg, param);
                        break;

                case MMCN_EXPANDSYNC:
                        wsprintf(message, _T("MMCN_EXPANDSYNC\n"));
                        break;

                case MMCN_FILTERBTN_CLICK:
                        wsprintf(message, _T("MMCN_FILTERBTN_CLICK\n\tColumn: %d\n"), arg);
                        break;

                case MMCN_FILTER_CHANGE:
                        wsprintf(message, _T("MMCN_FILTER_CHANGE\n\tColumn: %d\n"), param);
                        break;

                case MMCN_HELP:
                        wsprintf(message, _T("MMCN_HELP\n"));
                        break;

                case MMCN_INITOCX:
                        wsprintf(message, _T("MMCN_INITOCX\n\tIUnknown: %08x\n"), param);
                        break;

                case MMCN_LISTPAD:
                        wsprintf(message, _T("MMCN_LISTPAD\n\tConnect: %d\n"), arg);
                        break;

                case MMCN_MENU_BTNCLICK:
                        wsprintf(message, _T("MMCN_MENU_BTNCLICK\n"));
                        break;

                case MMCN_MINIMIZED:
                        wsprintf(message, _T("MMCN_MINIMIZED\n\tMinimized: %d\n"), arg);
                        break;

                case MMCN_PASTE:
                        wsprintf(message, _T("MMCN_PASTE\n\tCopy: %d\n"), param == NULL);
                        break;

                case MMCN_PRELOAD:
                        wsprintf(message, _T("MMCN_PRELOAD\n\tScope Item: %08x\n"), arg);
                        break;

                case MMCN_PRINT:
                        wsprintf(message, _T("MMCN_PRINT\n"));
                        break;

                case MMCN_PROPERTY_CHANGE:
                        wsprintf(message, _T("MMCN_PROPERTY_CHANGE\n\tScope: %d\n\tArg: %08x\n"), arg, param);
                        break;

                case MMCN_QUERY_PASTE:
                        wsprintf(message, _T("MMCN_QUERY_PASTE\n"));
                        break;

                case MMCN_REFRESH:
                        wsprintf(message, _T("MMCN_REFRESH\n"));
                        break;

                case MMCN_REMOVE_CHILDREN:
                        wsprintf(message, _T("MMCN_REMOVE_CHILDREN\n\tScope Item: %08x\n"), arg);
                        break;

                case MMCN_RENAME:
                        // Destination string may contain a truncation of the ideal result.
                        // (Indicated by return value other than S_OK).
                        // However, it will be null-terminated.
                        StringCchPrintf(message, cchMessage, _T("MMCN_RENAME\n\tNew Name: '%ws'\n"), (LPOLESTR)param);
                        break;

                case MMCN_RESTORE_VIEW:
                        wsprintf(message, _T("MMCN_RESTORE_VIEW\n"));
                        break;

                case MMCN_SELECT:
                        wsprintf(message, _T("MMCN_SELECT\n\tScope: %d\n\tSelect: %08x\n"), LOWORD(arg), HIWORD(arg));
                        break;

                case MMCN_SHOW:
                        wsprintf(message, _T("MMCN_SHOW\n\tShow: %d\n\tScope Item: %08x\n"), arg, param);
                        break;

                case MMCN_SNAPINHELP:
                        wsprintf(message, _T("MMCN_SNAPINHELP\n"));
                        break;

                case MMCN_VIEW_CHANGE:
                        wsprintf(message, _T("MMCN_VIEW_CHANGE\n\tData: %08x\n\tHint: %08x\n"), arg, param);
                        break;
        }

        if (message[0] != 0)
                OutputDebugString(message);
        else
                OutputDebugString(_T("unknown event\n"));

#endif
        return;
}

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Complete/people.Cpp File Reference

  • SysMgmt
  • MMC
  • Complete

people.Cpp File Reference

#include <stdio.h>
#include "People.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Complete/people.h File Reference

  • SysMgmt
  • MMC
  • Complete
Classes

people.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class | CBicycle
class | CBicycleFolder
class | CIceSkate
class | CIceSkateFolder
class | CPeoplePoweredVehicle
class | CSkateboard
class | CSkateboardFolder
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Complete/registry.Cpp File Reference

  • SysMgmt
  • MMC
  • Complete
Defines | Functions | Variables

registry.Cpp File Reference

#include <objbase.h>
#include <assert.h>
#include "Extend.h"
#include "Registry.h"
#include "globals.h"

Go to the source code of this file.

Defines

#define | STRINGS_ONLY

Functions

LONG | recursiveDeleteKey (HKEY hKeyParent, const _TCHAR *szKeyChild)
HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const _TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const _TCHAR *szNameString, const CLSID &clsidAbout)
BOOL | setKeyAndValue (const _TCHAR *pszPath, const _TCHAR *szSubkey, const _TCHAR *szValue)
BOOL | setSnapInExtensionNode (const _TCHAR *szSnapID, const _TCHAR *szNodeID, const _TCHAR *szDescription)
BOOL | setSnapInKeyAndValue (const _TCHAR *szKey, const _TCHAR *szSubkey, const _TCHAR *szName, const _TCHAR *szValue)
BOOL | setValue (const _TCHAR *szKey, const _TCHAR *szValueName, const _TCHAR *szValue)
LONG | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Variables

NODESTRUCT g_Nodes []

Define Documentation

#define STRINGS_ONLY

Definition at line 24 of file registry.Cpp.

Function Documentation

LONG recursiveDeleteKey | ( | HKEY | hKeyParent,
 |  | const _TCHAR * | szKeyChild
 | ) |  |

Definition at line 248 of file registry.Cpp.

{
    // Open the child.
    HKEY hKeyChild ;
    LONG lRes = RegOpenKeyEx(hKeyParent, lpszKeyChild, 0,
        KEY_ALL_ACCESS, &hKeyChild) ;
    if (lRes != ERROR_SUCCESS)
    {
        return lRes ;
    }

    // Enumerate all of the decendents of this child.
    FILETIME time ;
    _TCHAR szBuffer[256] ;
    DWORD dwSize = 256 ;
    while (RegEnumKeyEx(hKeyChild, 0, szBuffer, &dwSize, NULL,
        NULL, NULL, &time) == S_OK)
    {
        // Delete the decendents of this child.
        lRes = recursiveDeleteKey(hKeyChild, szBuffer) ;
        if (lRes != ERROR_SUCCESS)
        {
            // Cleanup before exiting.
            RegCloseKey(hKeyChild) ;
            return lRes;
        }
        dwSize = 256 ;
    }

    // Close the child.
    RegCloseKey(hKeyChild) ;

    // Delete this child.
    return RegDeleteKey(hKeyParent, lpszKeyChild) ;
}

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const _TCHAR * | szFriendlyName
 | ) |  |

Definition at line 74 of file registry.Cpp.

{
    // Get server location.
    _TCHAR szModule[512] ;
    DWORD dwResult =
        ::GetModuleFileName(hModule,
        szModule,
        sizeof(szModule)/sizeof(_TCHAR)) ;

    assert(dwResult != 0) ;

    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    assert(SUCCEEDED(hr)) ;

    MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;
        _tcscat(szKey, pszCLSID) ;

    // Add the CLSID to the registry.
    setKeyAndValue(szKey, NULL, szFriendlyName) ;

    // Add the server filename subkey under the CLSID key.
    setKeyAndValue(szKey, _T("InprocServer32"), szModule) ;

    // set the threading model
    _tcscat(szKey, _T("\\InprocServer32"));
    setValue(szKey, _T("ThreadingModel"), _T("Apartment"));

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const _TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout
 | ) |  |

Definition at line 147 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    LPOLESTR wszAboutCLSID = NULL;
    LPOLESTR wszExtendCLSID = NULL;
    NODESTRUCT *pNode;

    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    if (IID_NULL != clsidAbout)
        hr = StringFromCLSID(clsidAbout, &wszAboutCLSID);

    MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);
    MAKE_TSTRPTR_FROMWIDE(pszAboutCLSID, wszAboutCLSID);

    // Add the CLSID to the registry.
    setSnapInKeyAndValue(pszCLSID, NULL, _T("NameString"), szNameString) ;
    setSnapInKeyAndValue(pszCLSID, _T("StandAlone"), NULL, NULL);
    if (IID_NULL != clsidAbout)
        setSnapInKeyAndValue(pszCLSID, NULL, _T("About"), pszAboutCLSID);

    // register each of the node types in g_Nodes as an extendable node
    for (pNode = &(g_Nodes[0]);*pNode->szDescription;pNode++)
    {
        hr = StringFromCLSID(pNode->GUID, &wszExtendCLSID);
        MAKE_TSTRPTR_FROMWIDE(pszExtendCLSID, wszExtendCLSID);
        setSnapInExtensionNode(pszCLSID, pszExtendCLSID, pNode->szDescription);
        CoTaskMemFree(wszExtendCLSID);
    }

    // Free memory.
    CoTaskMemFree(wszCLSID) ;
    if (IID_NULL != clsidAbout)
        CoTaskMemFree(wszAboutCLSID);

    return S_OK ;
}

BOOL setKeyAndValue | ( | const _TCHAR * | pszPath,
 |  | const _TCHAR * | szSubkey,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 290 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Copy keyname into buffer.
    _tcscpy(szKeyBuf, szKey) ;

    // Add subkey name to buffer.
    if (szSubkey != NULL)
    {
        _tcscat(szKeyBuf, _T("\\")) ;
        _tcscat(szKeyBuf, szSubkey ) ;
    }

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, NULL, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

BOOL setSnapInExtensionNode | ( | const _TCHAR * | szSnapID,
 |  | const _TCHAR * | szNodeID,
 |  | const _TCHAR * | szDescription
 | ) |  |

Definition at line 416 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szSnapNodeKeyBuf[1024] ;
    _TCHAR szMMCNodeKeyBuf[1024];

    // Load the buffer with the Snap-In Location
    _tcscpy(szSnapNodeKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns\\"));
    // add in the clisid into buffer.
    _tcscat(szSnapNodeKeyBuf, szSnapID) ;
    _tcscat(szSnapNodeKeyBuf, _T("\\NodeTypes\\"));
    _tcscat(szSnapNodeKeyBuf, szNodeID) ;

    // Load the buffer with the NodeTypes Location
    _tcscpy(szMMCNodeKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\NodeTypes\\"));
    _tcscat(szMMCNodeKeyBuf, szNodeID) ;

    // Create and open the Snapin Key.
    long lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE ,
        szSnapNodeKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szDescription != NULL)
    {
        RegSetValueEx(hKey, NULL, 0, REG_SZ,
            (BYTE *)szDescription,
            (_tcslen(szDescription)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;

    // Create and open the NodeTypes Key.
    lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE ,
        szMMCNodeKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szDescription != NULL)
    {
        RegSetValueEx(hKey, NULL, 0, REG_SZ,
            (BYTE *)szDescription,
            (_tcslen(szDescription)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;

    return TRUE ;
}

BOOL setSnapInKeyAndValue | ( | const _TCHAR * | szKey,
 |  | const _TCHAR * | szSubkey,
 |  | const _TCHAR * | szName,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 371 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\")) ;
    _tcscat(szKeyBuf, szKey) ;

    // Add subkey name to buffer.
    if (szSubkey != NULL)
    {
        _tcscat(szKeyBuf, _T("\\")) ;
        _tcscat(szKeyBuf, szSubkey ) ;
    }

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, szName, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

BOOL setValue | ( | const _TCHAR * | szKey,
 |  | const _TCHAR * | szValueName,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 333 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Copy keyname into buffer.
    _tcscpy(szKeyBuf, szKey) ;

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, szValueName, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

LONG UnregisterServer ( const CLSID & clsid )

Definition at line 119 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

        MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
        _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
               (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 193 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
    MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
               (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

  //Uncomment following for loop to unregister all extendable node types
  //Note that if a snap-in's extendable node types are unregistered,
  //any extension snap-ins for these node types will have to be re-registered
  //in order to rebuild their entries under the SOFTWARE\Microsoft\MMC\NodeTypes key

/*
    // Unregister each of the node types in g_Nodes as an extendable node

    NODESTRUCT *pNode;
  LPOLESTR wszExtendCLSID = NULL;

    for (pNode = &(g_Nodes[0]);*pNode->szDescription;pNode++)
    {
        hr = StringFromCLSID(pNode->GUID, &wszExtendCLSID);
        // Load the buffer with the Snap-In Location
        MAKE_TSTRPTR_FROMWIDE(pszExtendCLSID, wszExtendCLSID);
        _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\NodeTypes\\"));
        // Copy keyname into buffer.
        _tcscat(szKeyBuf, pszExtendCLSID);
        recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
        CoTaskMemFree(wszExtendCLSID);
    }
*/

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Variable Documentation

NODESTRUCT g_Nodes[]

Definition at line 36 of file basesnap.Cpp.

Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Complete/registry.h File Reference

  • SysMgmt
  • MMC
  • Complete
Functions

registry.h File Reference

#include <tchar.h>

Go to the source code of this file.

Functions

HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const _TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const _TCHAR *szNameString, const CLSID &clsidAbout)
HRESULT | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Function Documentation

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const _TCHAR * | szFriendlyName
 | ) |  |

Definition at line 67 of file registry.Cpp.

{
    // Get server location.
    _TCHAR szModule[512] ;
    DWORD dwResult =
        ::GetModuleFileName(hModule,
        szModule,
        sizeof(szModule)/sizeof(_TCHAR)) ;

    assert(dwResult != 0) ;

    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    assert(SUCCEEDED(hr)) ;

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;
  _tcscat(szKey, pszCLSID) ;

    // Add the CLSID to the registry.
    setKeyAndValue(szKey, NULL, szFriendlyName) ;

    // Add the server filename subkey under the CLSID key.
    setKeyAndValue(szKey, _T("InprocServer32"), szModule) ;

    // set the threading model
    _tcscat(szKey, _T("\\InprocServer32"));
    setValue(szKey, _T("ThreadingModel"), _T("Apartment"));

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const _TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout
 | ) |  |

Definition at line 147 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    LPOLESTR wszAboutCLSID = NULL;
    LPOLESTR wszExtendCLSID = NULL;
    NODESTRUCT *pNode;

    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    if (IID_NULL != clsidAbout)
        hr = StringFromCLSID(clsidAbout, &wszAboutCLSID);

    MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);
    MAKE_TSTRPTR_FROMWIDE(pszAboutCLSID, wszAboutCLSID);

    // Add the CLSID to the registry.
    setSnapInKeyAndValue(pszCLSID, NULL, _T("NameString"), szNameString) ;
    setSnapInKeyAndValue(pszCLSID, _T("StandAlone"), NULL, NULL);
    if (IID_NULL != clsidAbout)
        setSnapInKeyAndValue(pszCLSID, NULL, _T("About"), pszAboutCLSID);

    // register each of the node types in g_Nodes as an extendable node
    for (pNode = &(g_Nodes[0]);*pNode->szDescription;pNode++)
    {
        hr = StringFromCLSID(pNode->GUID, &wszExtendCLSID);
        MAKE_TSTRPTR_FROMWIDE(pszExtendCLSID, wszExtendCLSID);
        setSnapInExtensionNode(pszCLSID, pszExtendCLSID, pNode->szDescription);
        CoTaskMemFree(wszExtendCLSID);
    }

    // Free memory.
    CoTaskMemFree(wszCLSID) ;
    if (IID_NULL != clsidAbout)
        CoTaskMemFree(wszAboutCLSID);

    return S_OK ;
}

HRESULT UnregisterServer ( const CLSID & clsid )

Definition at line 112 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

  MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
  _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 184 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Generated on Wed Nov 13 2024 16:53:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Complete/resource.h File Reference

  • SysMgmt
  • MMC
  • Complete
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | ID_BUTTONPAUSE 40022
#define | ID_BUTTONSTART 40021
#define | ID_BUTTONSTOP 40023
#define | IDB_BIKE 40007
#define | IDB_BIKE2 40011
#define | IDB_CAR 40005
#define | IDB_CAR2 40009
#define | IDB_CLOSED 40014
#define | IDB_CLOSED2 40012
#define | IDB_LGBMP 113
#define | IDB_OPEN 40015
#define | IDB_OPEN2 40013
#define | IDB_PLANE 40006
#define | IDB_PLANE2 40010
#define | IDB_ROCKET 40004
#define | IDB_ROCKET2 40008
#define | IDB_SMBMP 112
#define | IDB_SMOPEN 111
#define | IDC_ROCKET_HEIGHT 1001
#define | IDC_ROCKET_NAME 1000
#define | IDC_ROCKET_PAYLOAD 1003
#define | IDC_ROCKET_STATUS 1005
#define | IDC_ROCKET_WEIGHT 1002
#define | IDD_PROPPAGE_LARGE 107
#define | IDI_ICON1 108
#define | IDI_PSI_LANDBASED 2
#define | IDI_PSI_ROCKET 114
#define | IDR_LGICONS 121
#define | IDR_SMICONS 120
#define | IDR_TOOLBAR1 122
#define | IDS_ABOUTNAME 9
#define | IDS_HELPFILE 1
#define | IDS_NAME 3
#define | IDS_PST_LANDBASED 11
#define | IDS_PST_ROCKET 10
#define | IDS_SNAPINDESC 2
#define | IDS_SNAPINNAME 6

Define Documentation

#define ID_BUTTONPAUSE 40022

Definition at line 40 of file resource.h.

#define ID_BUTTONSTART 40021

Definition at line 39 of file resource.h.

#define ID_BUTTONSTOP 40023

Definition at line 41 of file resource.h.

#define IDB_BIKE 40007

Definition at line 30 of file resource.h.

#define IDB_BIKE2 40011

Definition at line 34 of file resource.h.

#define IDB_CAR 40005

Definition at line 28 of file resource.h.

#define IDB_CAR2 40009

Definition at line 32 of file resource.h.

#define IDB_CLOSED 40014

Definition at line 37 of file resource.h.

#define IDB_CLOSED2 40012

Definition at line 35 of file resource.h.

#define IDB_LGBMP 113

Definition at line 17 of file resource.h.

#define IDB_OPEN 40015

Definition at line 38 of file resource.h.

#define IDB_OPEN2 40013

Definition at line 36 of file resource.h.

#define IDB_PLANE 40006

Definition at line 29 of file resource.h.

#define IDB_PLANE2 40010

Definition at line 33 of file resource.h.

#define IDB_ROCKET 40004

Definition at line 27 of file resource.h.

#define IDB_ROCKET2 40008

Definition at line 31 of file resource.h.

#define IDB_SMBMP 112

Definition at line 16 of file resource.h.

#define IDB_SMOPEN 111

Definition at line 15 of file resource.h.

#define IDC_ROCKET_HEIGHT 1001

Definition at line 23 of file resource.h.

#define IDC_ROCKET_NAME 1000

Definition at line 22 of file resource.h.

#define IDC_ROCKET_PAYLOAD 1003

Definition at line 25 of file resource.h.

#define IDC_ROCKET_STATUS 1005

Definition at line 26 of file resource.h.

#define IDC_ROCKET_WEIGHT 1002

Definition at line 24 of file resource.h.

#define IDD_PROPPAGE_LARGE 107

Definition at line 13 of file resource.h.

#define IDI_ICON1 108

Definition at line 14 of file resource.h.

#define IDI_PSI_LANDBASED 2

Definition at line 7 of file resource.h.

#define IDI_PSI_ROCKET 114

Definition at line 18 of file resource.h.

#define IDR_LGICONS 121

Definition at line 20 of file resource.h.

#define IDR_SMICONS 120

Definition at line 19 of file resource.h.

#define IDR_TOOLBAR1 122

Definition at line 21 of file resource.h.

#define IDS_ABOUTNAME 9

Definition at line 10 of file resource.h.

#define IDS_HELPFILE 1

Definition at line 5 of file resource.h.

#define IDS_NAME 3

Definition at line 8 of file resource.h.

#define IDS_PST_LANDBASED 11

Definition at line 12 of file resource.h.

#define IDS_PST_ROCKET 10

Definition at line 11 of file resource.h.

#define IDS_SNAPINDESC 2

Definition at line 6 of file resource.h.

#define IDS_SNAPINNAME 6

Definition at line 9 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Complete/sky.Cpp File Reference

  • SysMgmt
  • MMC
  • Complete

sky.Cpp File Reference

#include "Sky.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Complete/sky.h File Reference

  • SysMgmt
  • MMC
  • Complete
Classes

sky.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class CSkyBasedVehicle
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Complete/space.Cpp File Reference

  • SysMgmt
  • MMC
  • Complete
Defines

space.Cpp File Reference

#include <stdio.h>
#include <windows.h>
#include "Space.h"
#include "Comp.h"
#include "CompData.h"
#include "DataObj.h"
#include "globals.h"
#include "resource.h"
#include <strsafe.h>

Go to the source code of this file.

Defines

#define STRSAFE_NO_DEPRECATE

Define Documentation

#define STRSAFE_NO_DEPRECATE

Definition at line 27 of file space.Cpp.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Complete/space.h File Reference

  • SysMgmt
  • MMC
  • Complete
Classes

space.h File Reference

#include "globals.h"
#include "DeleBase.h"

Go to the source code of this file.

Classes

class | CRocket
class | CSpaceVehicle
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Complete/statnode.Cpp File Reference

  • SysMgmt
  • MMC
  • Complete

statnode.Cpp File Reference

#include "StatNode.h"
#include "Space.h"
#include "Sky.h"
#include "People.h"
#include "Land.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Complete/statnode.h File Reference

  • SysMgmt
  • MMC
  • Complete
Classes

statnode.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class CStaticNode
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CutCopy/about.Cpp File Reference

  • SysMgmt
  • MMC
  • CutCopy
Functions

about.Cpp File Reference

#include "About.h"
#include "resource.h"
#include "globals.h"
#include <crtdbg.h>

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CSnapinAbout

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 89 of file about.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        // we need to decrement our object count in the DLL
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:54:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CutCopy/about.h File Reference

  • SysMgmt
  • MMC
  • CutCopy
Classes

about.h File Reference

#include <tchar.h>
#include <mmc.h>

Go to the source code of this file.

Classes

class CSnapinAbout
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CutCopy/backgrnd.Cpp File Reference

  • SysMgmt
  • MMC
  • CutCopy
Defines

backgrnd.Cpp File Reference

#include <stdio.h>
#include "Backgrnd.h"

Go to the source code of this file.

Defines

#define | WM_DISCOVERYCOMPLETE (WM_APP + 1)
#define | WM_NEWOBJECT WM_APP

Define Documentation

#define WM_DISCOVERYCOMPLETE (WM_APP + 1)

Definition at line 26 of file backgrnd.Cpp.

#define WM_NEWOBJECT WM_APP

Definition at line 25 of file backgrnd.Cpp.

Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CutCopy/backgrnd.h File Reference

  • SysMgmt
  • MMC
  • CutCopy
Classes

backgrnd.h File Reference

#include "DeleBase.h"
#include "DeleBase.h"

Go to the source code of this file.

Classes

class | CBackground
class | CBackgroundFolder
Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CutCopy/basesnap.Cpp File Reference

  • SysMgmt
  • MMC
  • CutCopy
Functions | Variables

basesnap.Cpp File Reference

#include <objbase.h>
#include <olectl.h>
#include <initguid.h>
#include "guids.h"
#include "basesnap.h"
#include "Comp.h"
#include "CompData.h"
#include "About.h"
#include "Registry.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)
BOOL WINAPI | DllMain (HINSTANCE hinstDLL, DWORD fdwReason, void *lpvReserved)
STDAPI | DllRegisterServer ()
STDAPI | DllUnregisterServer ()
STDMETHODIMP_ (ULONG) CClassFactory

Variables

HINSTANCE | g_hinst

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 77 of file basesnap.Cpp.

{
    if (g_uObjects == 0 && g_uSrvLock == 0)
        return S_OK;
    else
        return S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 45 of file basesnap.Cpp.

{
    if ((rclsid != CLSID_CComponentData) && (rclsid != CLSID_CSnapinAbout))
        return CLASS_E_CLASSNOTAVAILABLE;

    if (!ppvObj)
        return E_FAIL;

    *ppvObj = NULL;

    // We can only hand out IUnknown and IClassFactory pointers.  Fail
    // if they ask for anything else.
    if (!IsEqualIID(riid, IID_IUnknown) && !IsEqualIID(riid, IID_IClassFactory))
        return E_NOINTERFACE;

    CClassFactory *pFactory = NULL;

    // make the factory passing in the creation function for the type of object they want
    if (rclsid == CLSID_CComponentData)
        pFactory = new CClassFactory(CClassFactory::COMPONENT);
    else if (rclsid == CLSID_CSnapinAbout)
        pFactory = new CClassFactory(CClassFactory::ABOUT);

    if (NULL == pFactory)
        return E_OUTOFMEMORY;

    HRESULT hr = pFactory->QueryInterface(riid, ppvObj);

    return hr;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hinstDLL,
 |  | DWORD | fdwReason,
 |  | void * | lpvReserved
 | ) |  |

Definition at line 32 of file basesnap.Cpp.

{

    if (fdwReason == DLL_PROCESS_ATTACH) {
        g_hinst = hinstDLL;
    }

    return TRUE;
}

STDAPI DllRegisterServer ( void )

Definition at line 187 of file basesnap.Cpp.

{
    HRESULT hr = SELFREG_E_CLASS;
    _TCHAR szName[256];
    _TCHAR szSnapInName[256];

    LoadString(g_hinst, IDS_NAME, szName, (sizeof szName)/(sizeof szName[0]));
    LoadString(g_hinst, IDS_SNAPINNAME, szSnapInName, (sizeof szSnapInName)/(sizeof szSnapInName[0]));

    _TCHAR szAboutName[256];

    LoadString(g_hinst, IDS_ABOUTNAME, szAboutName, (sizeof szAboutName)/(sizeof szAboutName[0]));

    // register our CoClasses
    hr = RegisterServer(g_hinst,
        CLSID_CComponentData,
        szName);

    if SUCCEEDED(hr)
        hr = RegisterServer(g_hinst,
        CLSID_CSnapinAbout,
        szAboutName);

    // place the registry information for SnapIns
    if SUCCEEDED(hr)
        hr = RegisterSnapin(CLSID_CComponentData, szSnapInName, CLSID_CSnapinAbout, FALSE);

    return hr;
}

STDAPI DllUnregisterServer ( void )

Definition at line 218 of file basesnap.Cpp.

{
    if (UnregisterServer(CLSID_CComponentData) == S_OK)
        return UnregisterSnapin(CLSID_CComponentData);
    else
        return E_FAIL;
}

STDMETHODIMP_ ( ULONG )

Definition at line 124 of file basesnap.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;
}

Variable Documentation

HINSTANCE g_hinst

Definition at line 30 of file basesnap.Cpp.

Generated on Wed Nov 13 2024 16:54:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CutCopy/basesnap.h File Reference

  • SysMgmt
  • MMC
  • CutCopy
Classes | Functions | Variables

basesnap.h File Reference

Go to the source code of this file.

Classes

class | CClassFactory

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)

Variables

ULONG | g_uObjects = 0
ULONG | g_uSrvLock = 0

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 53 of file ComSpyAudit.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 61 of file ComSpyAudit.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

Variable Documentation

ULONG g_uObjects = 0

Definition at line 24 of file basesnap.h.

ULONG g_uSrvLock = 0

Definition at line 25 of file basesnap.h.

Generated on Wed Nov 13 2024 16:54:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CutCopy/comp.Cpp File Reference

  • SysMgmt
  • MMC
  • CutCopy
Functions

comp.Cpp File Reference

#include "Comp.h"
#include "CompData.h"
#include "Space.h"
#include "DataObj.h"
#include <commctrl.h>
#include <crtdbg.h>
#include "globals.h"
#include "resource.h"
#include "DeleBase.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CComponent

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 69 of file comp.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CutCopy/comp.h File Reference

  • SysMgmt
  • MMC
  • CutCopy
Classes

comp.h File Reference

#include <mmc.h>

Go to the source code of this file.

Classes

class CComponent
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CutCopy/compdata.Cpp File Reference

  • SysMgmt
  • MMC
  • CutCopy
Functions

compdata.Cpp File Reference

#include "Comp.h"
#include "CompData.h"
#include "DataObj.h"
#include "Space.h"
#include "resource.h"
#include <crtdbg.h>

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CComponentData

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 73 of file compdata.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        // we need to decrement our object count in the DLL
        delete this;
        return 0;
    }

    return m_cref;
}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CutCopy/compdata.h File Reference

  • SysMgmt
  • MMC
  • CutCopy
Classes

compdata.h File Reference

#include <mmc.h>
#include "DeleBase.h"
#include "StatNode.h"
#include "Comp.h"
#include "StatNode.h"

Go to the source code of this file.

Classes

class CComponentData
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CutCopy/dataobj.Cpp File Reference

  • SysMgmt
  • MMC
  • CutCopy
Defines | Functions

dataobj.Cpp File Reference

#include "DataObj.h"
#include "guids.h"
#include "DeleBase.h"

Go to the source code of this file.

Defines

#define | _T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")
#define | _T_CCF_INTERNAL_SNAPIN _T("{2479DB32-5276-11d2-94F5-00C04FB92EC2}")
#define | _T_CCF_NODETYPE _T("CCF_NODETYPE")
#define | _T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")
#define | _T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")

Functions

CDataObject * | GetOurDataObject (LPDATAOBJECT lpDataObject)
STDMETHODIMP_ (ULONG) CDataObject

Define Documentation

#define _T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")

Definition at line 31 of file dataobj.Cpp.

#define _T_CCF_INTERNAL_SNAPIN _T("{2479DB32-5276-11d2-94F5-00C04FB92EC2}")

Definition at line 36 of file dataobj.Cpp.

#define _T_CCF_NODETYPE _T("CCF_NODETYPE")

Definition at line 32 of file dataobj.Cpp.

#define _T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")

Definition at line 34 of file dataobj.Cpp.

#define _T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")

Definition at line 33 of file dataobj.Cpp.

Function Documentation

CDataObject* GetOurDataObject ( LPDATAOBJECT lpDataObject )

Definition at line 165 of file dataobj.Cpp.

{
    HRESULT       hr      = S_OK;
    CDataObject *pSDO     = NULL;

  // check to see if the data object is a special data object.
  if ( IS_SPECIAL_DATAOBJECT (lpDataObject) )
  {
    //Code for handling a special data object goes here.

    //Note that the MMC SDK samples do not handle
    //special data objects, so we exit if we get one.
    return NULL;
  }

    STGMEDIUM stgmedium = { TYMED_HGLOBAL,  NULL  };
    FORMATETC formatetc = { CDataObject::s_cfInternal, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };

    // Allocate memory for the stream
    stgmedium.hGlobal = GlobalAlloc( GMEM_SHARE, sizeof(CDataObject *));

    if (!stgmedium.hGlobal)     {
        hr = E_OUTOFMEMORY;
    }

    if SUCCEEDED(hr)
        // Attempt to get data from the object
        hr = lpDataObject->GetDataHere( &formatetc, &stgmedium );

    // stgmedium now has the data we need
    if (SUCCEEDED(hr))  {
        pSDO = *(CDataObject **)(stgmedium.hGlobal);
    }

    // if we have memory free it
    if (stgmedium.hGlobal)
        GlobalFree(stgmedium.hGlobal);

    return pSDO;

} // end GetOurDataObject()

STDMETHODIMP_ ( ULONG )

Definition at line 87 of file dataobj.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CutCopy/dataobj.h File Reference

  • SysMgmt
  • MMC
  • CutCopy
Classes | Functions

dataobj.h File Reference

#include <mmc.h>
#include "DeleBase.h"

Go to the source code of this file.

Classes

class | CDataObject

Functions

HRESULT | ExtractFromDataObject (IDataObject *lpDataObject, UINT cf, ULONG cb, HGLOBAL *phGlobal)
CDataObject * | GetOurDataObject (IDataObject *lpDataObject)
BOOL | IsMMCMultiSelectDataObject (IDataObject *lpDataObject)

Function Documentation

HRESULT ExtractFromDataObject | ( | IDataObject * | lpDataObject,
 |  | UINT | cf,
 |  | ULONG | cb,
 |  | HGLOBAL * | phGlobal
 | ) |  |
CDataObject* GetOurDataObject ( IDataObject * lpDataObject )
BOOL IsMMCMultiSelectDataObject ( IDataObject * lpDataObject )
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CutCopy/delebase.Cpp File Reference

  • SysMgmt
  • MMC
  • CutCopy

delebase.Cpp File Reference

#include "DeleBase.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CutCopy/delebase.h File Reference

  • SysMgmt
  • MMC
  • CutCopy
Classes

delebase.h File Reference

#include <mmc.h>
#include <crtdbg.h>
#include "globals.h"
#include "resource.h"
#include "LocalRes.h"
#include "LocalRes.h"

Go to the source code of this file.

Classes

class CDelegationBase
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CutCopy/globals.h File Reference

  • SysMgmt
  • MMC
  • CutCopy
Classes | Defines | Enumerations | Functions | Variables

globals.h File Reference

#include <mmc.h>
#include <tchar.h>

Go to the source code of this file.

Classes

class | TempBuffer

Defines

#define | IDM_BUTTON1 0x100
#define | IDM_BUTTON2 0x101
#define | MAKE_TSTRPTR_FROMWIDE(ptrname, widestr)
#define | MAKE_WIDEPTR_FROMTSTR(ptrname, tstr)
#define | MAKE_WIDEPTR_FROMTSTR_ALLOC(ptrname, tstr)
#define | OBJECT_CREATED InterlockedIncrement((long *)&g_uObjects);
#define | OBJECT_DESTROYED InterlockedDecrement((long *)&g_uObjects);

Enumerations

enum ITEM_TYPE {
SCOPE = 10, RESULT, SCOPE = 10, RESULT,
SCOPE = 10, RESULT
}
enum UPDATE_VIEWS_HINT {
UPDATE_SCOPEITEM = 1000, DELETE_SCOPEITEM, UPDATE_RESULTITEM, DELETE_RESULTITEM,
UPDATE_SCOPEITEM = 1000, DELETE_SCOPEITEM, UPDATE_RESULTITEM, DELETE_RESULTITEM,
UPDATE_SCOPEITEM = 1000, DELETE_SCOPEITEM, UPDATE_RESULTITEM, DELETE_RESULTITEM
}

Functions

void | MMCN_Crack (BOOL bComponentData, IDataObject *pDataObject, IComponentData *pCompData, IComponent *pComp, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)

Variables

HINSTANCE | g_hinst
ULONG g_uObjects

Define Documentation

#define IDM_BUTTON1 0x100

Definition at line 30 of file globals.h.

#define IDM_BUTTON2 0x101

Definition at line 31 of file globals.h.

#define MAKE_TSTRPTR_FROMWIDE | ( | ptrname,
 |  | widestr
 | ) |
Value:
long __l##ptrname = (wcslen(widestr) + 1) * 2 * sizeof(TCHAR); \
    TempBuffer __TempBuffer##ptrname(__l##ptrname); \
    WideCharToMultiByte(CP_ACP, 0, widestr, -1, (LPSTR)__TempBuffer##ptrname.GetBuffer(), __l##ptrname, NULL, NULL); \
    LPTSTR ptrname = (LPTSTR)__TempBuffer##ptrname.GetBuffer()

Definition at line 132 of file globals.h.

#define MAKE_WIDEPTR_FROMTSTR | ( | ptrname,
 |  | tstr
 | ) |
Value:
long __cch##ptrname = (lstrlenA(tstr) + 1);\
    long __l##ptrname = (lstrlenA(tstr) + 1) * sizeof(WCHAR); \
    TempBuffer __TempBuffer##ptrname(__l##ptrname); \
    MultiByteToWideChar(CP_ACP, 0, tstr, -1, (LPWSTR)__TempBuffer##ptrname.GetBuffer(), __cch##ptrname); \
    LPWSTR ptrname = (LPWSTR)__TempBuffer##ptrname.GetBuffer()

Definition at line 98 of file globals.h.

#define MAKE_WIDEPTR_FROMTSTR_ALLOC | ( | ptrname,
 |  | tstr
 | ) |
Value:
long __cch##ptrname = (lstrlenA(tstr) + 1);\
    long __l##ptrname = (lstrlenA(tstr) + 1) * sizeof(WCHAR); \
    LPWSTR ptrname = (LPWSTR)CoTaskMemAlloc(__l##ptrname); \
    MultiByteToWideChar(CP_ACP, 0, tstr, -1, ptrname, __cch##ptrname)

Definition at line 112 of file globals.h.

#define OBJECT_CREATED InterlockedIncrement((long *)&g_uObjects);

Definition at line 36 of file globals.h.

#define OBJECT_DESTROYED InterlockedDecrement((long *)&g_uObjects);

Definition at line 37 of file globals.h.

Enumeration Type Documentation

enum ITEM_TYPE
Enumerator:
SCOPE
RESULT
SCOPE
RESULT
SCOPE
RESULT

Definition at line 28 of file globals.h.

{SCOPE = 10, RESULT};

enum UPDATE_VIEWS_HINT
Enumerator:
UPDATE_SCOPEITEM
DELETE_SCOPEITEM
UPDATE_RESULTITEM
DELETE_RESULTITEM
UPDATE_SCOPEITEM
DELETE_SCOPEITEM
UPDATE_RESULTITEM
DELETE_RESULTITEM
UPDATE_SCOPEITEM
DELETE_SCOPEITEM
UPDATE_RESULTITEM
DELETE_RESULTITEM

Definition at line 27 of file globals.h.

{UPDATE_SCOPEITEM = 1000, DELETE_SCOPEITEM, UPDATE_RESULTITEM, DELETE_RESULTITEM};

Function Documentation

void MMCN_Crack | ( | BOOL | bComponentData,
 |  | IDataObject * | pDataObject,
 |  | IComponentData * | pCompData,
 |  | IComponent * | pComp,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param
 | ) |  |

Definition at line 59 of file mmccrack.Cpp.

{
#ifdef MMC_CRACK_MESSAGES
        const size_t cchMessage = 256;
  TCHAR message[cchMessage] = {0};

  if (bComponentData == TRUE)
    OutputDebugString(_T("IComponentData::Notify( "));
  else
    OutputDebugString(_T("IComponent::Notify( "));

  wsprintf(message, _T("DataObject: %08x, CompData: %08x, Comp: %08x ) - "), pDataObject, pCompData, pComp);
  OutputDebugString(message);

    switch (event)  {
    case MMCN_ACTIVATE:
      wsprintf(message, _T("MMCN_ACTIVATE\n\tActivate: %d\n"), arg);
      break;

    case MMCN_ADD_IMAGES:
      wsprintf(message, _T("MMCN_ADD_IMAGES\n\tImage List: %08x\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_BTN_CLICK:
      wsprintf(message, _T("MMCN_BTN_CLICK\n\tVerb: %ws\n"), MMCN_CrackVerb((MMC_CONSOLE_VERB)param));
      break;

    case MMCN_COLUMN_CLICK:
      wsprintf(message, _T("MMCN_COLUMN_CLICK\n\tColumn: %d\n\tSort Option: %d\n"), arg,   param);
      break;

    case MMCN_COLUMNS_CHANGED:
      wsprintf(message, _T("MMCN_COLUMNS_CHANGED\n"));
      break;

    case MMCN_CONTEXTHELP:
      wsprintf(message, _T("MMCN_CONTEXTHELP\n"));
      break;

    case MMCN_CONTEXTMENU:
      wsprintf(message, _T("MMCN_CONTEXTMENU\n"));
      break;

    case MMCN_CUTORMOVE:
      wsprintf(message, _T("MMCN_CUTORMOVE\n"));
      break;

    case MMCN_DBLCLICK:
      wsprintf(message, _T("MMCN_DBLCLICK\n"));
      break;

    case MMCN_DELETE:
      wsprintf(message, _T("MMCN_DELETE\n"));
      break;

    case MMCN_DESELECT_ALL:
      wsprintf(message, _T("MMCN_DESELECT_ALL\n"));
      break;

    case MMCN_EXPAND:
      wsprintf(message, _T("MMCN_EXPAND\n\tExpand: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_EXPANDSYNC:
      wsprintf(message, _T("MMCN_EXPANDSYNC\n"));
      break;

    case MMCN_FILTERBTN_CLICK:
      wsprintf(message, _T("MMCN_FILTERBTN_CLICK\n\tColumn: %d\n"), arg);
      break;

    case MMCN_FILTER_CHANGE:
      wsprintf(message, _T("MMCN_FILTER_CHANGE\n\tColumn: %d\n"), param);
      break;

    case MMCN_HELP:
      wsprintf(message, _T("MMCN_HELP\n"));
      break;

    case MMCN_INITOCX:
      wsprintf(message, _T("MMCN_INITOCX\n\tIUnknown: %08x\n"), param);
      break;

    case MMCN_LISTPAD:
      wsprintf(message, _T("MMCN_LISTPAD\n\tConnect: %d\n"), arg);
      break;

    case MMCN_MENU_BTNCLICK:
      wsprintf(message, _T("MMCN_MENU_BTNCLICK\n"));
      break;

    case MMCN_MINIMIZED:
      wsprintf(message, _T("MMCN_MINIMIZED\n\tMinimized: %d\n"), arg);
      break;

    case MMCN_PASTE:
      wsprintf(message, _T("MMCN_PASTE\n\tCopy: %d\n"), param == NULL);
      break;

    case MMCN_PRELOAD:
      wsprintf(message, _T("MMCN_PRELOAD\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_PRINT:
      wsprintf(message, _T("MMCN_PRINT\n"));
      break;

    case MMCN_PROPERTY_CHANGE:
      wsprintf(message, _T("MMCN_PROPERTY_CHANGE\n\tScope: %d\n\tArg: %08x\n"), arg, param);
      break;

    case MMCN_QUERY_PASTE:
      wsprintf(message, _T("MMCN_QUERY_PASTE\n"));
      break;

    case MMCN_REFRESH:
      wsprintf(message, _T("MMCN_REFRESH\n"));
      break;

    case MMCN_REMOVE_CHILDREN:
      wsprintf(message, _T("MMCN_REMOVE_CHILDREN\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_RENAME:
                        // Destination string may contain a truncation of the ideal result.
                        // (Indicated by return value other than S_OK).
                        // However, it will be null-terminated.
      StringCchPrintf(message, cchMessage, _T("MMCN_RENAME\n\tNew Name: '%ws'\n"), (LPOLESTR)param);
      break;

    case MMCN_RESTORE_VIEW:
      wsprintf(message, _T("MMCN_RESTORE_VIEW\n"));
      break;

    case MMCN_SELECT:
      wsprintf(message, _T("MMCN_SELECT\n\tScope: %d\n\tSelect: %08x\n"), LOWORD(arg), HIWORD(arg));
      break;

    case MMCN_SHOW:
      wsprintf(message, _T("MMCN_SHOW\n\tShow: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_SNAPINHELP:
      wsprintf(message, _T("MMCN_SNAPINHELP\n"));
      break;

    case MMCN_VIEW_CHANGE:
      wsprintf(message, _T("MMCN_VIEW_CHANGE\n\tData: %08x\n\tHint: %08x\n"), arg, param);
      break;
  }

  if (message[0] != 0)
    OutputDebugString(message);
  else
    OutputDebugString(_T("unknown event\n"));

#endif
  return;
}

Variable Documentation

HINSTANCE g_hinst

Definition at line 33 of file SetDisp.h.

ULONG g_uObjects

Definition at line 24 of file basesnap.h.

Generated on Wed Nov 13 2024 16:54:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CutCopy/guids.h File Reference

  • SysMgmt
  • MMC
  • CutCopy
Functions

guids.h File Reference

Go to the source code of this file.

Functions

DEFINE_GUID (CLSID_CComponentData, 0xc30c5b42, 0x1913, 0x11d3, 0x9a, 0x38, 0x0, 0x80, 0xc7, 0x25, 0x80, 0x72)
DEFINE_GUID (CLSID_CSnapinAbout, 0xc99d3d80, 0x1913, 0x11d3, 0x9a, 0x38, 0x0, 0x80, 0xc7, 0x25, 0x80, 0x72)

Function Documentation

DEFINE_GUID | ( | CLSID_CComponentData | ,
 |  | 0xc30c5b42 | ,
 |  | 0x1913 | ,
 |  | 0x11d3 | ,
 |  | 0x9a | ,
 |  | 0x38 | ,
 |  | 0x0 | ,
 |  | 0x80 | ,
 |  | 0xc7 | ,
 |  | 0x25 | ,
 |  | 0x80 | ,
 |  | 0x72 |
 | ) |  |
DEFINE_GUID | ( | CLSID_CSnapinAbout | ,
 |  | 0xc99d3d80 | ,
 |  | 0x1913 | ,
 |  | 0x11d3 | ,
 |  | 0x9a | ,
 |  | 0x38 | ,
 |  | 0x0 | ,
 |  | 0x80 | ,
 |  | 0xc7 | ,
 |  | 0x25 | ,
 |  | 0x80 | ,
 |  | 0x72 |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CutCopy/land.Cpp File Reference

  • SysMgmt
  • MMC
  • CutCopy

land.Cpp File Reference

#include "Land.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CutCopy/land.h File Reference

  • SysMgmt
  • MMC
  • CutCopy
Classes

land.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class CLandBasedVehicle
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CutCopy/localres.h File Reference

  • SysMgmt
  • MMC
  • CutCopy
Defines

localres.h File Reference

Go to the source code of this file.

Defines

#define | INDEX_BACKGROUND 6
#define | INDEX_CLOSEDFOLDER 4
#define | INDEX_LANDICON 1
#define | INDEX_NONE -1
#define | INDEX_OPENFOLDER 5
#define | INDEX_PEOPLEICON 3
#define | INDEX_SKYICON 2
#define | INDEX_SPACEICON 0
#define | INDEX_STATION 7

Define Documentation

#define INDEX_BACKGROUND 6

Definition at line 29 of file localres.h.

#define INDEX_CLOSEDFOLDER 4

Definition at line 27 of file localres.h.

#define INDEX_LANDICON 1

Definition at line 24 of file localres.h.

#define INDEX_NONE -1

Definition at line 22 of file localres.h.

#define INDEX_OPENFOLDER 5

Definition at line 28 of file localres.h.

#define INDEX_PEOPLEICON 3

Definition at line 26 of file localres.h.

#define INDEX_SKYICON 2

Definition at line 25 of file localres.h.

#define INDEX_SPACEICON 0

Definition at line 23 of file localres.h.

#define INDEX_STATION 7

Definition at line 30 of file localres.h.

Generated on Wed Nov 13 2024 16:54:37 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CutCopy/mmccrack.Cpp File Reference

  • SysMgmt
  • MMC
  • CutCopy
Defines | Functions

mmccrack.Cpp File Reference

#include <mmc.h>
#include <winuser.h>
#include <tchar.h>
#include "globals.h"
#include <strsafe.h>

Go to the source code of this file.

Defines

#define | STRSAFE_NO_DEPRECATE

Functions

void | MMCN_Crack (BOOL bComponentData, IDataObject *pDataObject, IComponentData *pCompData, IComponent *pComp, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)

Define Documentation

#define STRSAFE_NO_DEPRECATE

Definition at line 25 of file mmccrack.Cpp.

Function Documentation

void MMCN_Crack | ( | BOOL | bComponentData,
 |  | IDataObject * | pDataObject,
 |  | IComponentData * | pCompData,
 |  | IComponent * | pComp,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param
 | ) |  |

Definition at line 59 of file mmccrack.Cpp.

{
#ifdef MMC_CRACK_MESSAGES
        const size_t cchMessage = 256;
        TCHAR message[cchMessage] = {0};

        if (bComponentData == TRUE)
                OutputDebugString(_T("IComponentData::Notify( "));
        else
                OutputDebugString(_T("IComponent::Notify( "));

        wsprintf(message, _T("DataObject: %08x, CompData: %08x, Comp: %08x ) - "), pDataObject, pCompData, pComp);
        OutputDebugString(message);

    switch (event)      {
                case MMCN_ACTIVATE:
                        wsprintf(message, _T("MMCN_ACTIVATE\n\tActivate: %d\n"), arg);
                        break;

                case MMCN_ADD_IMAGES:
                        wsprintf(message, _T("MMCN_ADD_IMAGES\n\tImage List: %08x\n\tScope Item: %08x\n"), arg, param);
                        break;

                case MMCN_BTN_CLICK:
                        wsprintf(message, _T("MMCN_BTN_CLICK\n\tVerb: %ws\n"), MMCN_CrackVerb((MMC_CONSOLE_VERB)param));
                        break;

                case MMCN_COLUMN_CLICK:
                        wsprintf(message, _T("MMCN_COLUMN_CLICK\n\tColumn: %d\n\tSort Option: %d\n"), arg,       param);
                        break;

                case MMCN_COLUMNS_CHANGED:
                        wsprintf(message, _T("MMCN_COLUMNS_CHANGED\n"));
                        break;

                case MMCN_CONTEXTHELP:
                        wsprintf(message, _T("MMCN_CONTEXTHELP\n"));
                        break;

                case MMCN_CONTEXTMENU:
                        wsprintf(message, _T("MMCN_CONTEXTMENU\n"));
                        break;

                case MMCN_CUTORMOVE:
                        wsprintf(message, _T("MMCN_CUTORMOVE\n"));
                        break;

                case MMCN_DBLCLICK:
                        wsprintf(message, _T("MMCN_DBLCLICK\n"));
                        break;

                case MMCN_DELETE:
                        wsprintf(message, _T("MMCN_DELETE\n"));
                        break;

                case MMCN_DESELECT_ALL:
                        wsprintf(message, _T("MMCN_DESELECT_ALL\n"));
                        break;

                case MMCN_EXPAND:
                        wsprintf(message, _T("MMCN_EXPAND\n\tExpand: %d\n\tScope Item: %08x\n"), arg, param);
                        break;

                case MMCN_EXPANDSYNC:
                        wsprintf(message, _T("MMCN_EXPANDSYNC\n"));
                        break;

                case MMCN_FILTERBTN_CLICK:
                        wsprintf(message, _T("MMCN_FILTERBTN_CLICK\n\tColumn: %d\n"), arg);
                        break;

                case MMCN_FILTER_CHANGE:
                        wsprintf(message, _T("MMCN_FILTER_CHANGE\n\tColumn: %d\n"), param);
                        break;

                case MMCN_HELP:
                        wsprintf(message, _T("MMCN_HELP\n"));
                        break;

                case MMCN_INITOCX:
                        wsprintf(message, _T("MMCN_INITOCX\n\tIUnknown: %08x\n"), param);
                        break;

                case MMCN_LISTPAD:
                        wsprintf(message, _T("MMCN_LISTPAD\n\tConnect: %d\n"), arg);
                        break;

                case MMCN_MENU_BTNCLICK:
                        wsprintf(message, _T("MMCN_MENU_BTNCLICK\n"));
                        break;

                case MMCN_MINIMIZED:
                        wsprintf(message, _T("MMCN_MINIMIZED\n\tMinimized: %d\n"), arg);
                        break;

                case MMCN_PASTE:
                        wsprintf(message, _T("MMCN_PASTE\n\tCopy: %d\n"), param == NULL);
                        break;

                case MMCN_PRELOAD:
                        wsprintf(message, _T("MMCN_PRELOAD\n\tScope Item: %08x\n"), arg);
                        break;

                case MMCN_PRINT:
                        wsprintf(message, _T("MMCN_PRINT\n"));
                        break;

                case MMCN_PROPERTY_CHANGE:
                        wsprintf(message, _T("MMCN_PROPERTY_CHANGE\n\tScope: %d\n\tArg: %08x\n"), arg, param);
                        break;

                case MMCN_QUERY_PASTE:
                        wsprintf(message, _T("MMCN_QUERY_PASTE\n"));
                        break;

                case MMCN_REFRESH:
                        wsprintf(message, _T("MMCN_REFRESH\n"));
                        break;

                case MMCN_REMOVE_CHILDREN:
                        wsprintf(message, _T("MMCN_REMOVE_CHILDREN\n\tScope Item: %08x\n"), arg);
                        break;

                case MMCN_RENAME:
                        // Destination string may contain a truncation of the ideal result.
                        // (Indicated by return value other than S_OK).
                        // However, it will be null-terminated.
                        StringCchPrintf(message, cchMessage, _T("MMCN_RENAME\n\tNew Name: '%ws'\n"), (LPOLESTR)param);
                        break;

                case MMCN_RESTORE_VIEW:
                        wsprintf(message, _T("MMCN_RESTORE_VIEW\n"));
                        break;

                case MMCN_SELECT:
                        wsprintf(message, _T("MMCN_SELECT\n\tScope: %d\n\tSelect: %08x\n"), LOWORD(arg), HIWORD(arg));
                        break;

                case MMCN_SHOW:
                        wsprintf(message, _T("MMCN_SHOW\n\tShow: %d\n\tScope Item: %08x\n"), arg, param);
                        break;

                case MMCN_SNAPINHELP:
                        wsprintf(message, _T("MMCN_SNAPINHELP\n"));
                        break;

                case MMCN_VIEW_CHANGE:
                        wsprintf(message, _T("MMCN_VIEW_CHANGE\n\tData: %08x\n\tHint: %08x\n"), arg, param);
                        break;
        }

        if (message[0] != 0)
                OutputDebugString(message);
        else
                OutputDebugString(_T("unknown event\n"));

#endif
        return;
}

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CutCopy/people.Cpp File Reference

  • SysMgmt
  • MMC
  • CutCopy

people.Cpp File Reference

#include <stdio.h>
#include "People.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CutCopy/people.h File Reference

  • SysMgmt
  • MMC
  • CutCopy
Classes

people.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class | CBicycle
class | CBicycleFolder
class | CIceSkate
class | CIceSkateFolder
class | CPeoplePoweredVehicle
class | CSkateboard
class | CSkateboardFolder
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CutCopy/registry.Cpp File Reference

  • SysMgmt
  • MMC
  • CutCopy
Defines | Functions

registry.Cpp File Reference

#include <objbase.h>
#include <assert.h>
#include "Registry.h"
#include "globals.h"

Go to the source code of this file.

Defines

#define | STRINGS_ONLY

Functions

LONG | recursiveDeleteKey (HKEY hKeyParent, const _TCHAR *szKeyChild)
HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const _TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const _TCHAR *szNameString, const CLSID &clsidAbout, const BOOL fSupportExtensions)
BOOL | setKeyAndValue (const _TCHAR *pszPath, const _TCHAR *szSubkey, const _TCHAR *szValue)
BOOL | setSnapInKeyAndValue (const _TCHAR *szKey, const _TCHAR *szSubkey, const _TCHAR *szName, const _TCHAR *szValue)
BOOL | setValue (const _TCHAR *szKey, const _TCHAR *szValueName, const _TCHAR *szValue)
LONG | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Define Documentation

#define STRINGS_ONLY

Definition at line 24 of file registry.Cpp.

Function Documentation

LONG recursiveDeleteKey | ( | HKEY | hKeyParent,
 |  | const _TCHAR * | szKeyChild
 | ) |  |

Definition at line 214 of file registry.Cpp.

{
    // Open the child.
    HKEY hKeyChild ;
    LONG lRes = RegOpenKeyEx(hKeyParent, lpszKeyChild, 0,
        KEY_ALL_ACCESS, &hKeyChild) ;
    if (lRes != ERROR_SUCCESS)
    {
        return lRes ;
    }

    // Enumerate all of the decendents of this child.
    FILETIME time ;
    _TCHAR szBuffer[256] ;
    DWORD dwSize = 256 ;
    while (RegEnumKeyEx(hKeyChild, 0, szBuffer, &dwSize, NULL,
        NULL, NULL, &time) == S_OK)
    {
        // Delete the decendents of this child.
        lRes = recursiveDeleteKey(hKeyChild, szBuffer) ;
        if (lRes != ERROR_SUCCESS)
        {
            // Cleanup before exiting.
            RegCloseKey(hKeyChild) ;
            return lRes;
        }
        dwSize = 256 ;
    }

    // Close the child.
    RegCloseKey(hKeyChild) ;

    // Delete this child.
    return RegDeleteKey(hKeyParent, lpszKeyChild) ;
}

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const _TCHAR * | szFriendlyName
 | ) |  |

Definition at line 67 of file registry.Cpp.

{
    // Get server location.
    _TCHAR szModule[512] ;
    DWORD dwResult =
        ::GetModuleFileName(hModule,
        szModule,
        sizeof(szModule)/sizeof(_TCHAR)) ;

    assert(dwResult != 0) ;

    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    assert(SUCCEEDED(hr)) ;

        MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;
        _tcscat(szKey, pszCLSID) ;

    // Add the CLSID to the registry.
    setKeyAndValue(szKey, NULL, szFriendlyName) ;

    // Add the server filename subkey under the CLSID key.
    setKeyAndValue(szKey, _T("InprocServer32"), szModule) ;

    // set the threading model
    _tcscat(szKey, _T("\\InprocServer32"));
    setValue(szKey, _T("ThreadingModel"), _T("Apartment"));

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const _TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | fSupportExtensions
 | ) |  |

Definition at line 140 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    LPOLESTR wszAboutCLSID = NULL;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    if (IID_NULL != clsidAbout)
        hr = StringFromCLSID(clsidAbout, &wszAboutCLSID);

        MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);
        MAKE_TSTRPTR_FROMWIDE(pszAboutCLSID, wszAboutCLSID);

    // Add the CLSID to the registry.
    setSnapInKeyAndValue(pszCLSID, NULL, _T("NameString"), szNameString) ;
    setSnapInKeyAndValue(pszCLSID, _T("StandAlone"), NULL, NULL);
    if (IID_NULL != clsidAbout)
        setSnapInKeyAndValue(pszCLSID, NULL, _T("About"), pszAboutCLSID);

    if (fSupportExtensions) {
        // Build the key NodeType
        setSnapInKeyAndValue(pszCLSID, _T("NodeTypes"), NULL, NULL);

        _TCHAR szKey[64] ;
        _tcscpy(szKey, pszCLSID) ;
        _tcscat(szKey, _T("\\NodeTypes")) ;
        setSnapInKeyAndValue(szKey, pszCLSID, NULL, NULL);
    }

    // Free memory.
    CoTaskMemFree(wszCLSID) ;
    if (IID_NULL != clsidAbout)
        CoTaskMemFree(wszAboutCLSID);

    return S_OK ;
}

BOOL setKeyAndValue | ( | const _TCHAR * | pszPath,
 |  | const _TCHAR * | szSubkey,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 256 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Copy keyname into buffer.
    _tcscpy(szKeyBuf, szKey) ;

    // Add subkey name to buffer.
    if (szSubkey != NULL)
    {
        _tcscat(szKeyBuf, _T("\\")) ;
        _tcscat(szKeyBuf, szSubkey ) ;
    }

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, NULL, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

BOOL setSnapInKeyAndValue | ( | const _TCHAR * | szKey,
 |  | const _TCHAR * | szSubkey,
 |  | const _TCHAR * | szName,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 337 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\")) ;
    _tcscat(szKeyBuf, szKey) ;

    // Add subkey name to buffer.
    if (szSubkey != NULL)
    {
        _tcscat(szKeyBuf, _T("\\")) ;
        _tcscat(szKeyBuf, szSubkey ) ;
    }

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, szName, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

BOOL setValue | ( | const _TCHAR * | szKey,
 |  | const _TCHAR * | szValueName,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 299 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Copy keyname into buffer.
    _tcscpy(szKeyBuf, szKey) ;

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, szValueName, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

LONG UnregisterServer ( const CLSID & clsid )

Definition at line 112 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

        MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
        _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
               (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 184 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
        MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
               (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CutCopy/registry.h File Reference

  • SysMgmt
  • MMC
  • CutCopy
Functions

registry.h File Reference

#include <tchar.h>

Go to the source code of this file.

Functions

HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const _TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const _TCHAR *szNameString, const CLSID &clsidAbout, const BOOL fSupportExtensions=FALSE)
HRESULT | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Function Documentation

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const _TCHAR * | szFriendlyName
 | ) |  |

Definition at line 67 of file registry.Cpp.

{
    // Get server location.
    _TCHAR szModule[512] ;
    DWORD dwResult =
        ::GetModuleFileName(hModule,
        szModule,
        sizeof(szModule)/sizeof(_TCHAR)) ;

    assert(dwResult != 0) ;

    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    assert(SUCCEEDED(hr)) ;

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;
  _tcscat(szKey, pszCLSID) ;

    // Add the CLSID to the registry.
    setKeyAndValue(szKey, NULL, szFriendlyName) ;

    // Add the server filename subkey under the CLSID key.
    setKeyAndValue(szKey, _T("InprocServer32"), szModule) ;

    // set the threading model
    _tcscat(szKey, _T("\\InprocServer32"));
    setValue(szKey, _T("ThreadingModel"), _T("Apartment"));

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const _TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | fSupportExtensions = FALSE
 | ) |  |

Definition at line 140 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    LPOLESTR wszAboutCLSID = NULL;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    if (IID_NULL != clsidAbout)
        hr = StringFromCLSID(clsidAbout, &wszAboutCLSID);

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszAboutCLSID, wszAboutCLSID);

    // Add the CLSID to the registry.
    setSnapInKeyAndValue(pszCLSID, NULL, _T("NameString"), szNameString) ;
    setSnapInKeyAndValue(pszCLSID, _T("StandAlone"), NULL, NULL);
    if (IID_NULL != clsidAbout)
        setSnapInKeyAndValue(pszCLSID, NULL, _T("About"), pszAboutCLSID);

    if (fSupportExtensions) {
        // Build the key NodeType
        setSnapInKeyAndValue(pszCLSID, _T("NodeTypes"), NULL, NULL);

        _TCHAR szKey[64] ;
        _tcscpy(szKey, pszCLSID) ;
        _tcscat(szKey, _T("\\NodeTypes")) ;
        setSnapInKeyAndValue(szKey, pszCLSID, NULL, NULL);
    }

    // Free memory.
    CoTaskMemFree(wszCLSID) ;
    if (IID_NULL != clsidAbout)
        CoTaskMemFree(wszAboutCLSID);

    return S_OK ;
}

HRESULT UnregisterServer ( const CLSID & clsid )

Definition at line 112 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

  MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
  _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 184 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Generated on Wed Nov 13 2024 16:53:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CutCopy/resource.h File Reference

  • SysMgmt
  • MMC
  • CutCopy
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDB_BIKE 40007
#define | IDB_BIKE2 40011
#define | IDB_CAR 40005
#define | IDB_CAR2 40009
#define | IDB_CLOSED 40014
#define | IDB_CLOSED2 40012
#define | IDB_LGBMP 113
#define | IDB_OPEN 40015
#define | IDB_OPEN2 40013
#define | IDB_PLANE 40006
#define | IDB_PLANE2 40010
#define | IDB_ROCKET 40004
#define | IDB_ROCKET2 40008
#define | IDB_SMBMP 112
#define | IDB_SMOPEN 111
#define | IDI_ICON1 108
#define | IDR_LGICONS 121
#define | IDR_SMICONS 120
#define | IDS_ABOUTNAME 9
#define | IDS_HELPFILE 1
#define | IDS_NAME 3
#define | IDS_SNAPINDESC 2
#define | IDS_SNAPINNAME 6

Define Documentation

#define IDB_BIKE 40007

Definition at line 19 of file resource.h.

#define IDB_BIKE2 40011

Definition at line 23 of file resource.h.

#define IDB_CAR 40005

Definition at line 17 of file resource.h.

#define IDB_CAR2 40009

Definition at line 21 of file resource.h.

#define IDB_CLOSED 40014

Definition at line 26 of file resource.h.

#define IDB_CLOSED2 40012

Definition at line 24 of file resource.h.

#define IDB_LGBMP 113

Definition at line 13 of file resource.h.

#define IDB_OPEN 40015

Definition at line 27 of file resource.h.

#define IDB_OPEN2 40013

Definition at line 25 of file resource.h.

#define IDB_PLANE 40006

Definition at line 18 of file resource.h.

#define IDB_PLANE2 40010

Definition at line 22 of file resource.h.

#define IDB_ROCKET 40004

Definition at line 16 of file resource.h.

#define IDB_ROCKET2 40008

Definition at line 20 of file resource.h.

#define IDB_SMBMP 112

Definition at line 12 of file resource.h.

#define IDB_SMOPEN 111

Definition at line 11 of file resource.h.

#define IDI_ICON1 108

Definition at line 10 of file resource.h.

#define IDR_LGICONS 121

Definition at line 15 of file resource.h.

#define IDR_SMICONS 120

Definition at line 14 of file resource.h.

#define IDS_ABOUTNAME 9

Definition at line 9 of file resource.h.

#define IDS_HELPFILE 1

Definition at line 5 of file resource.h.

#define IDS_NAME 3

Definition at line 7 of file resource.h.

#define IDS_SNAPINDESC 2

Definition at line 6 of file resource.h.

#define IDS_SNAPINNAME 6

Definition at line 8 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CutCopy/sky.Cpp File Reference

  • SysMgmt
  • MMC
  • CutCopy

sky.Cpp File Reference

#include "Sky.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CutCopy/sky.h File Reference

  • SysMgmt
  • MMC
  • CutCopy
Classes

sky.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class CSkyBasedVehicle
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CutCopy/space.Cpp File Reference

  • SysMgmt
  • MMC
  • CutCopy
Defines

space.Cpp File Reference

#include <stdio.h>
#include "DataObj.h"
#include "Space.h"
#include "Comp.h"
#include <strsafe.h>

Go to the source code of this file.

Defines

#define STRSAFE_NO_DEPRECATE

Define Documentation

#define STRSAFE_NO_DEPRECATE

Definition at line 23 of file space.Cpp.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CutCopy/space.h File Reference

  • SysMgmt
  • MMC
  • CutCopy
Classes

space.h File Reference

#include "DeleBase.h"
#include "CompData.h"

Go to the source code of this file.

Classes

class | CRocket
class | CSpaceFolder
class | CSpaceStation
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CutCopy/statnode.Cpp File Reference

  • SysMgmt
  • MMC
  • CutCopy

statnode.Cpp File Reference

#include "StatNode.h"
#include "Space.h"
#include "Sky.h"
#include "People.h"
#include "Land.h"
#include "Backgrnd.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/CutCopy/statnode.h File Reference

  • SysMgmt
  • MMC
  • CutCopy
Classes

statnode.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class CStaticNode
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Extens/about.Cpp File Reference

  • SysMgmt
  • MMC
  • Extens
Functions

about.Cpp File Reference

#include "About.h"
#include "resource.h"
#include "globals.h"
#include <crtdbg.h>

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CSnapinAbout

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 89 of file about.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        // we need to decrement our object count in the DLL
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:54:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Extens/about.h File Reference

  • SysMgmt
  • MMC
  • Extens
Classes

about.h File Reference

#include <tchar.h>
#include <mmc.h>

Go to the source code of this file.

Classes

class CSnapinAbout
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Extens/basesnap.Cpp File Reference

  • SysMgmt
  • MMC
  • Extens
Functions | Variables

basesnap.Cpp File Reference

#include <objbase.h>
#include <olectl.h>
#include <initguid.h>
#include "guids.h"
#include "basesnap.h"
#include "Comp.h"
#include "CompData.h"
#include "About.h"
#include "Registry.h"
#include "Extend.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)
BOOL WINAPI | DllMain (HINSTANCE hinstDLL, DWORD fdwReason, void *lpvReserved)
STDAPI | DllRegisterServer ()
STDAPI | DllUnregisterServer ()
STDMETHODIMP_ (ULONG) CClassFactory

Variables

HINSTANCE | g_hinst
NODESTRUCT g_Nodes []

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 92 of file basesnap.Cpp.

{
    if (g_uObjects == 0 && g_uSrvLock == 0)
        return S_OK;
    else
        return S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 60 of file basesnap.Cpp.

{
    if ((rclsid != CLSID_CComponentData) && (rclsid != CLSID_CSnapinAbout))
        return CLASS_E_CLASSNOTAVAILABLE;

    if (!ppvObj)
        return E_FAIL;

    *ppvObj = NULL;

    // We can only hand out IUnknown and IClassFactory pointers.  Fail
    // if they ask for anything else.
    if (!IsEqualIID(riid, IID_IUnknown) && !IsEqualIID(riid, IID_IClassFactory))
        return E_NOINTERFACE;

    CClassFactory *pFactory = NULL;

    // make the factory passing in the creation function for the type of object they want
    if (rclsid == CLSID_CComponentData)
        pFactory = new CClassFactory(CClassFactory::COMPONENT);
    else if (rclsid == CLSID_CSnapinAbout)
        pFactory = new CClassFactory(CClassFactory::ABOUT);

    if (NULL == pFactory)
        return E_OUTOFMEMORY;

    HRESULT hr = pFactory->QueryInterface(riid, ppvObj);

    return hr;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hinstDLL,
 |  | DWORD | fdwReason,
 |  | void * | lpvReserved
 | ) |  |

Definition at line 47 of file basesnap.Cpp.

{

    if (fdwReason == DLL_PROCESS_ATTACH) {
        g_hinst = hinstDLL;
    }

    return TRUE;
}

STDAPI DllRegisterServer ( void )

Definition at line 202 of file basesnap.Cpp.

{
    HRESULT hr = SELFREG_E_CLASS;
    _TCHAR szName[256];
    _TCHAR szSnapInName[256];

    LoadString(g_hinst, IDS_NAME, szName, (sizeof szName)/(sizeof szName[0]));
    LoadString(g_hinst, IDS_SNAPINNAME, szSnapInName, (sizeof szSnapInName)/(sizeof szSnapInName[0]));

    _TCHAR szAboutName[256];

    LoadString(g_hinst, IDS_ABOUTNAME, szAboutName, (sizeof szAboutName)/(sizeof szAboutName[0]));

    // register our CoClasses
    hr = RegisterServer(g_hinst,
        CLSID_CComponentData,
        szName);

    if SUCCEEDED(hr)
        hr = RegisterServer(g_hinst,
        CLSID_CSnapinAbout,
        szAboutName);

    // place the registry information for SnapIns
    if SUCCEEDED(hr)
        hr = RegisterSnapin(CLSID_CComponentData, szSnapInName, CLSID_CSnapinAbout);

    return hr;
}

STDAPI DllUnregisterServer ( void )

Definition at line 233 of file basesnap.Cpp.

{
    if (UnregisterServer(CLSID_CComponentData) == S_OK)
        return UnregisterSnapin(CLSID_CComponentData);
    else
        return E_FAIL;
}

STDMETHODIMP_ ( ULONG )

Definition at line 139 of file basesnap.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;
}

Variable Documentation

HINSTANCE g_hinst

Definition at line 31 of file basesnap.Cpp.

NODESTRUCT g_Nodes[]
Initial value:
 {
    { 0x2974380d, 0x4c4b, 0x11d2, { 0x89, 0xd8, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28 },
        _T("People-powered Vehicles Node")},
    { 0x29743811, 0x4c4b, 0x11d2, { 0x89, 0xd8, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28 },
        _T("Rocket Node")},
    { 0x2974380f, 0x4c4b, 0x11d2, { 0x89, 0xd8, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28 },
        _T("Sky-based Vehicle Node")},
    {NULL, NULL}
}

Definition at line 36 of file basesnap.Cpp.

Generated on Wed Nov 13 2024 16:54:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Extens/basesnap.h File Reference

  • SysMgmt
  • MMC
  • Extens
Classes | Functions | Variables

basesnap.h File Reference

Go to the source code of this file.

Classes

class | CClassFactory

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)

Variables

ULONG | g_uObjects = 0
ULONG | g_uSrvLock = 0

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 53 of file ComSpyAudit.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 61 of file ComSpyAudit.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

Variable Documentation

ULONG g_uObjects = 0

Definition at line 24 of file basesnap.h.

ULONG g_uSrvLock = 0

Definition at line 25 of file basesnap.h.

Generated on Wed Nov 13 2024 16:54:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Extens/comp.Cpp File Reference

  • SysMgmt
  • MMC
  • Extens
Functions

comp.Cpp File Reference

#include "Comp.h"
#include "DataObj.h"
#include <commctrl.h>
#include <crtdbg.h>
#include "globals.h"
#include "resource.h"
#include "DeleBase.h"
#include "CompData.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CComponent

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 67 of file comp.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Extens/comp.h File Reference

  • SysMgmt
  • MMC
  • Extens
Classes

comp.h File Reference

#include <mmc.h>

Go to the source code of this file.

Classes

class CComponent
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Extens/compdata.Cpp File Reference

  • SysMgmt
  • MMC
  • Extens
Functions

compdata.Cpp File Reference

#include "Comp.h"
#include "CompData.h"
#include "DataObj.h"
#include "resource.h"
#include <crtdbg.h>

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CComponentData

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 72 of file compdata.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        // we need to decrement our object count in the DLL
        delete this;
        return 0;
    }

    return m_cref;
}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Extens/compdata.h File Reference

  • SysMgmt
  • MMC
  • Extens
Classes

compdata.h File Reference

#include <mmc.h>
#include "DeleBase.h"
#include "StatNode.h"
#include "Comp.h"
#include "DeleBase.h"
#include "StatNode.h"

Go to the source code of this file.

Classes

class CComponentData
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Extens/dataobj.Cpp File Reference

  • SysMgmt
  • MMC
  • Extens
Defines | Functions

dataobj.Cpp File Reference

#include "DataObj.h"
#include "guids.h"
#include "DeleBase.h"

Go to the source code of this file.

Defines

#define | _T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")
#define | _T_CCF_INTERNAL_SNAPIN _T("{2479DB32-5276-11d2-94F5-00C04FB92EC2}")
#define | _T_CCF_NODETYPE _T("CCF_NODETYPE")
#define | _T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")
#define | _T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")

Functions

CDataObject * | GetOurDataObject (LPDATAOBJECT lpDataObject)
STDMETHODIMP_ (ULONG) CDataObject

Define Documentation

#define _T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")

Definition at line 31 of file dataobj.Cpp.

#define _T_CCF_INTERNAL_SNAPIN _T("{2479DB32-5276-11d2-94F5-00C04FB92EC2}")

Definition at line 36 of file dataobj.Cpp.

#define _T_CCF_NODETYPE _T("CCF_NODETYPE")

Definition at line 32 of file dataobj.Cpp.

#define _T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")

Definition at line 34 of file dataobj.Cpp.

#define _T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")

Definition at line 33 of file dataobj.Cpp.

Function Documentation

CDataObject* GetOurDataObject ( LPDATAOBJECT lpDataObject )

Definition at line 165 of file dataobj.Cpp.

{
    HRESULT       hr      = S_OK;
    CDataObject *pSDO     = NULL;

  // check to see if the data object is a special data object.
  if ( IS_SPECIAL_DATAOBJECT (lpDataObject) )
  {
    //Code for handling a special data object goes here.

    //Note that the MMC SDK samples do not handle
    //special data objects, so we exit if we get one.
    return NULL;
  }

    STGMEDIUM stgmedium = { TYMED_HGLOBAL,  NULL  };
    FORMATETC formatetc = { CDataObject::s_cfInternal, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };

    // Allocate memory for the stream
    stgmedium.hGlobal = GlobalAlloc( GMEM_SHARE, sizeof(CDataObject *));

    if (!stgmedium.hGlobal) {
        hr = E_OUTOFMEMORY;
    }

    if SUCCEEDED(hr)
        // Attempt to get data from the object
        hr = lpDataObject->GetDataHere( &formatetc, &stgmedium );

    // stgmedium now has the data we need
    if (SUCCEEDED(hr))  {
        pSDO = *(CDataObject **)(stgmedium.hGlobal);
    }

    // if we have memory free it
    if (stgmedium.hGlobal)
        GlobalFree(stgmedium.hGlobal);

    return pSDO;

} // end GetOurDataObject()

STDMETHODIMP_ ( ULONG )

Definition at line 87 of file dataobj.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Extens/dataobj.h File Reference

  • SysMgmt
  • MMC
  • Extens
Classes | Functions

dataobj.h File Reference

#include <mmc.h>
#include "DeleBase.h"

Go to the source code of this file.

Classes

class | CDataObject

Functions

HRESULT | ExtractFromDataObject (IDataObject *lpDataObject, UINT cf, ULONG cb, HGLOBAL *phGlobal)
CDataObject * | GetOurDataObject (IDataObject *lpDataObject)
BOOL | IsMMCMultiSelectDataObject (IDataObject *lpDataObject)

Function Documentation

HRESULT ExtractFromDataObject | ( | IDataObject * | lpDataObject,
 |  | UINT | cf,
 |  | ULONG | cb,
 |  | HGLOBAL * | phGlobal
 | ) |  |
CDataObject* GetOurDataObject ( IDataObject * lpDataObject )
BOOL IsMMCMultiSelectDataObject ( IDataObject * lpDataObject )
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Extens/delebase.Cpp File Reference

  • SysMgmt
  • MMC
  • Extens

delebase.Cpp File Reference

#include "DeleBase.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Extens/delebase.h File Reference

  • SysMgmt
  • MMC
  • Extens
Classes

delebase.h File Reference

#include <mmc.h>
#include <crtdbg.h>
#include "globals.h"
#include "resource.h"
#include "LocalRes.h"
#include "LocalRes.h"

Go to the source code of this file.

Classes

class CDelegationBase
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Extens/extend.h File Reference

  • SysMgmt
  • MMC
  • Extens
Classes

extend.h File Reference

#include <tchar.h>

Go to the source code of this file.

Classes

struct NODESTRUCT
Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Extens/globals.h File Reference

  • SysMgmt
  • MMC
  • Extens
Classes | Defines | Functions | Variables

globals.h File Reference

#include <tchar.h>

Go to the source code of this file.

Classes

class | TempBuffer

Defines

#define | IDM_BUTTON1 0x100
#define | IDM_BUTTON2 0x101
#define | MAKE_TSTRPTR_FROMWIDE(ptrname, widestr)
#define | MAKE_WIDEPTR_FROMTSTR(ptrname, tstr)
#define | MAKE_WIDEPTR_FROMTSTR_ALLOC(ptrname, tstr)
#define | OBJECT_CREATED InterlockedIncrement((long *)&g_uObjects);
#define | OBJECT_DESTROYED InterlockedDecrement((long *)&g_uObjects);

Functions

void | MMCN_Crack (BOOL bComponentData, IDataObject *pDataObject, IComponentData *pCompData, IComponent *pComp, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)

Variables

HINSTANCE | g_hinst
ULONG g_uObjects

Define Documentation

#define IDM_BUTTON1 0x100

Definition at line 25 of file globals.h.

#define IDM_BUTTON2 0x101

Definition at line 26 of file globals.h.

#define MAKE_TSTRPTR_FROMWIDE | ( | ptrname,
 |  | widestr
 | ) |
Value:
long __l##ptrname = (wcslen(widestr) + 1) * 2 * sizeof(TCHAR); \
    TempBuffer __TempBuffer##ptrname(__l##ptrname); \
    WideCharToMultiByte(CP_ACP, 0, widestr, -1, (LPSTR)__TempBuffer##ptrname.GetBuffer(), __l##ptrname, NULL, NULL); \
    LPTSTR ptrname = (LPTSTR)__TempBuffer##ptrname.GetBuffer()

Definition at line 127 of file globals.h.

#define MAKE_WIDEPTR_FROMTSTR | ( | ptrname,
 |  | tstr
 | ) |
Value:
long __cch##ptrname = (lstrlenA(tstr) + 1);\
    long __l##ptrname = (lstrlenA(tstr) + 1) * sizeof(WCHAR); \
    TempBuffer __TempBuffer##ptrname(__l##ptrname); \
    MultiByteToWideChar(CP_ACP, 0, tstr, -1, (LPWSTR)__TempBuffer##ptrname.GetBuffer(), __cch##ptrname); \
    LPWSTR ptrname = (LPWSTR)__TempBuffer##ptrname.GetBuffer()

Definition at line 93 of file globals.h.

#define MAKE_WIDEPTR_FROMTSTR_ALLOC | ( | ptrname,
 |  | tstr
 | ) |
Value:
long __cch##ptrname = (lstrlenA(tstr) + 1);\
    long __l##ptrname = (lstrlenA(tstr) + 1) * sizeof(WCHAR); \
    LPWSTR ptrname = (LPWSTR)CoTaskMemAlloc(__l##ptrname); \
    MultiByteToWideChar(CP_ACP, 0, tstr, -1, ptrname, __cch##ptrname)

Definition at line 107 of file globals.h.

#define OBJECT_CREATED InterlockedIncrement((long *)&g_uObjects);

Definition at line 31 of file globals.h.

#define OBJECT_DESTROYED InterlockedDecrement((long *)&g_uObjects);

Definition at line 32 of file globals.h.

Function Documentation

void MMCN_Crack | ( | BOOL | bComponentData,
 |  | IDataObject * | pDataObject,
 |  | IComponentData * | pCompData,
 |  | IComponent * | pComp,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param
 | ) |  |

Definition at line 59 of file mmccrack.Cpp.

{
#ifdef MMC_CRACK_MESSAGES
        const size_t cchMessage = 256;
  TCHAR message[cchMessage] = {0};

  if (bComponentData == TRUE)
    OutputDebugString(_T("IComponentData::Notify( "));
  else
    OutputDebugString(_T("IComponent::Notify( "));

  wsprintf(message, _T("DataObject: %08x, CompData: %08x, Comp: %08x ) - "), pDataObject, pCompData, pComp);
  OutputDebugString(message);

    switch (event)  {
    case MMCN_ACTIVATE:
      wsprintf(message, _T("MMCN_ACTIVATE\n\tActivate: %d\n"), arg);
      break;

    case MMCN_ADD_IMAGES:
      wsprintf(message, _T("MMCN_ADD_IMAGES\n\tImage List: %08x\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_BTN_CLICK:
      wsprintf(message, _T("MMCN_BTN_CLICK\n\tVerb: %ws\n"), MMCN_CrackVerb((MMC_CONSOLE_VERB)param));
      break;

    case MMCN_COLUMN_CLICK:
      wsprintf(message, _T("MMCN_COLUMN_CLICK\n\tColumn: %d\n\tSort Option: %d\n"), arg,   param);
      break;

    case MMCN_COLUMNS_CHANGED:
      wsprintf(message, _T("MMCN_COLUMNS_CHANGED\n"));
      break;

    case MMCN_CONTEXTHELP:
      wsprintf(message, _T("MMCN_CONTEXTHELP\n"));
      break;

    case MMCN_CONTEXTMENU:
      wsprintf(message, _T("MMCN_CONTEXTMENU\n"));
      break;

    case MMCN_CUTORMOVE:
      wsprintf(message, _T("MMCN_CUTORMOVE\n"));
      break;

    case MMCN_DBLCLICK:
      wsprintf(message, _T("MMCN_DBLCLICK\n"));
      break;

    case MMCN_DELETE:
      wsprintf(message, _T("MMCN_DELETE\n"));
      break;

    case MMCN_DESELECT_ALL:
      wsprintf(message, _T("MMCN_DESELECT_ALL\n"));
      break;

    case MMCN_EXPAND:
      wsprintf(message, _T("MMCN_EXPAND\n\tExpand: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_EXPANDSYNC:
      wsprintf(message, _T("MMCN_EXPANDSYNC\n"));
      break;

    case MMCN_FILTERBTN_CLICK:
      wsprintf(message, _T("MMCN_FILTERBTN_CLICK\n\tColumn: %d\n"), arg);
      break;

    case MMCN_FILTER_CHANGE:
      wsprintf(message, _T("MMCN_FILTER_CHANGE\n\tColumn: %d\n"), param);
      break;

    case MMCN_HELP:
      wsprintf(message, _T("MMCN_HELP\n"));
      break;

    case MMCN_INITOCX:
      wsprintf(message, _T("MMCN_INITOCX\n\tIUnknown: %08x\n"), param);
      break;

    case MMCN_LISTPAD:
      wsprintf(message, _T("MMCN_LISTPAD\n\tConnect: %d\n"), arg);
      break;

    case MMCN_MENU_BTNCLICK:
      wsprintf(message, _T("MMCN_MENU_BTNCLICK\n"));
      break;

    case MMCN_MINIMIZED:
      wsprintf(message, _T("MMCN_MINIMIZED\n\tMinimized: %d\n"), arg);
      break;

    case MMCN_PASTE:
      wsprintf(message, _T("MMCN_PASTE\n\tCopy: %d\n"), param == NULL);
      break;

    case MMCN_PRELOAD:
      wsprintf(message, _T("MMCN_PRELOAD\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_PRINT:
      wsprintf(message, _T("MMCN_PRINT\n"));
      break;

    case MMCN_PROPERTY_CHANGE:
      wsprintf(message, _T("MMCN_PROPERTY_CHANGE\n\tScope: %d\n\tArg: %08x\n"), arg, param);
      break;

    case MMCN_QUERY_PASTE:
      wsprintf(message, _T("MMCN_QUERY_PASTE\n"));
      break;

    case MMCN_REFRESH:
      wsprintf(message, _T("MMCN_REFRESH\n"));
      break;

    case MMCN_REMOVE_CHILDREN:
      wsprintf(message, _T("MMCN_REMOVE_CHILDREN\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_RENAME:
                        // Destination string may contain a truncation of the ideal result.
                        // (Indicated by return value other than S_OK).
                        // However, it will be null-terminated.
      StringCchPrintf(message, cchMessage, _T("MMCN_RENAME\n\tNew Name: '%ws'\n"), (LPOLESTR)param);
      break;

    case MMCN_RESTORE_VIEW:
      wsprintf(message, _T("MMCN_RESTORE_VIEW\n"));
      break;

    case MMCN_SELECT:
      wsprintf(message, _T("MMCN_SELECT\n\tScope: %d\n\tSelect: %08x\n"), LOWORD(arg), HIWORD(arg));
      break;

    case MMCN_SHOW:
      wsprintf(message, _T("MMCN_SHOW\n\tShow: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_SNAPINHELP:
      wsprintf(message, _T("MMCN_SNAPINHELP\n"));
      break;

    case MMCN_VIEW_CHANGE:
      wsprintf(message, _T("MMCN_VIEW_CHANGE\n\tData: %08x\n\tHint: %08x\n"), arg, param);
      break;
  }

  if (message[0] != 0)
    OutputDebugString(message);
  else
    OutputDebugString(_T("unknown event\n"));

#endif
  return;
}

Variable Documentation

HINSTANCE g_hinst

Definition at line 33 of file SetDisp.h.

ULONG g_uObjects

Definition at line 24 of file basesnap.h.

Generated on Wed Nov 13 2024 16:54:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Extens/guids.h File Reference

  • SysMgmt
  • MMC
  • Extens
Functions

guids.h File Reference

Go to the source code of this file.

Functions

DEFINE_GUID (CLSID_CComponentData, 0xaea15790, 0xa656, 0x11d2, 0x99, 0x2f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
DEFINE_GUID (CLSID_CSnapinAbout, 0xaea15792, 0xa656, 0x11d2, 0x99, 0x2f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)

Function Documentation

DEFINE_GUID | ( | CLSID_CComponentData | ,
 |  | 0xaea15790 | ,
 |  | 0xa656 | ,
 |  | 0x11d2 | ,
 |  | 0x99 | ,
 |  | 0x2f | ,
 |  | 0x0 | ,
 |  | 0x0 | ,
 |  | 0x0 | ,
 |  | 0x0 | ,
 |  | 0x0 | ,
 |  | 0x0 |
 | ) |  |
DEFINE_GUID | ( | CLSID_CSnapinAbout | ,
 |  | 0xaea15792 | ,
 |  | 0xa656 | ,
 |  | 0x11d2 | ,
 |  | 0x99 | ,
 |  | 0x2f | ,
 |  | 0x0 | ,
 |  | 0x0 | ,
 |  | 0x0 | ,
 |  | 0x0 | ,
 |  | 0x0 | ,
 |  | 0x0 |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Extens/land.Cpp File Reference

  • SysMgmt
  • MMC
  • Extens

land.Cpp File Reference

#include "Land.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Extens/land.h File Reference

  • SysMgmt
  • MMC
  • Extens
Classes

land.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class CLandBasedVehicle
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Extens/localres.h File Reference

  • SysMgmt
  • MMC
  • Extens
Defines

localres.h File Reference

Go to the source code of this file.

Defines

#define | INDEX_CLOSEDFOLDER 4
#define | INDEX_LANDICON 1
#define | INDEX_NONE -1
#define | INDEX_OPENFOLDER 5
#define | INDEX_PEOPLEICON 3
#define | INDEX_SKYICON 2
#define | INDEX_SPACEICON 0

Define Documentation

#define INDEX_CLOSEDFOLDER 4

Definition at line 27 of file localres.h.

#define INDEX_LANDICON 1

Definition at line 24 of file localres.h.

#define INDEX_NONE -1

Definition at line 22 of file localres.h.

#define INDEX_OPENFOLDER 5

Definition at line 28 of file localres.h.

#define INDEX_PEOPLEICON 3

Definition at line 26 of file localres.h.

#define INDEX_SKYICON 2

Definition at line 25 of file localres.h.

#define INDEX_SPACEICON 0

Definition at line 23 of file localres.h.

Generated on Wed Nov 13 2024 16:54:37 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Extens/mmccrack.Cpp File Reference

  • SysMgmt
  • MMC
  • Extens
Defines | Functions

mmccrack.Cpp File Reference

#include <mmc.h>
#include <winuser.h>
#include <tchar.h>
#include "globals.h"
#include <strsafe.h>

Go to the source code of this file.

Defines

#define | STRSAFE_NO_DEPRECATE

Functions

void | MMCN_Crack (BOOL bComponentData, IDataObject *pDataObject, IComponentData *pCompData, IComponent *pComp, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)

Define Documentation

#define STRSAFE_NO_DEPRECATE

Definition at line 25 of file mmccrack.Cpp.

Function Documentation

void MMCN_Crack | ( | BOOL | bComponentData,
 |  | IDataObject * | pDataObject,
 |  | IComponentData * | pCompData,
 |  | IComponent * | pComp,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param
 | ) |  |

Definition at line 59 of file mmccrack.Cpp.

{
#ifdef MMC_CRACK_MESSAGES
        const size_t cchMessage = 256;
  TCHAR message[cchMessage] = {0};

  if (bComponentData == TRUE)
    OutputDebugString(_T("IComponentData::Notify( "));
  else
    OutputDebugString(_T("IComponent::Notify( "));

  wsprintf(message, _T("DataObject: %08x, CompData: %08x, Comp: %08x ) - "), pDataObject, pCompData, pComp);
  OutputDebugString(message);

    switch (event)  {
    case MMCN_ACTIVATE:
      wsprintf(message, _T("MMCN_ACTIVATE\n\tActivate: %d\n"), arg);
      break;

    case MMCN_ADD_IMAGES:
      wsprintf(message, _T("MMCN_ADD_IMAGES\n\tImage List: %08x\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_BTN_CLICK:
      wsprintf(message, _T("MMCN_BTN_CLICK\n\tVerb: %ws\n"), MMCN_CrackVerb((MMC_CONSOLE_VERB)param));
      break;

    case MMCN_COLUMN_CLICK:
      wsprintf(message, _T("MMCN_COLUMN_CLICK\n\tColumn: %d\n\tSort Option: %d\n"), arg,   param);
      break;

    case MMCN_COLUMNS_CHANGED:
      wsprintf(message, _T("MMCN_COLUMNS_CHANGED\n"));
      break;

    case MMCN_CONTEXTHELP:
      wsprintf(message, _T("MMCN_CONTEXTHELP\n"));
      break;

    case MMCN_CONTEXTMENU:
      wsprintf(message, _T("MMCN_CONTEXTMENU\n"));
      break;

    case MMCN_CUTORMOVE:
      wsprintf(message, _T("MMCN_CUTORMOVE\n"));
      break;

    case MMCN_DBLCLICK:
      wsprintf(message, _T("MMCN_DBLCLICK\n"));
      break;

    case MMCN_DELETE:
      wsprintf(message, _T("MMCN_DELETE\n"));
      break;

    case MMCN_DESELECT_ALL:
      wsprintf(message, _T("MMCN_DESELECT_ALL\n"));
      break;

    case MMCN_EXPAND:
      wsprintf(message, _T("MMCN_EXPAND\n\tExpand: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_EXPANDSYNC:
      wsprintf(message, _T("MMCN_EXPANDSYNC\n"));
      break;

    case MMCN_FILTERBTN_CLICK:
      wsprintf(message, _T("MMCN_FILTERBTN_CLICK\n\tColumn: %d\n"), arg);
      break;

    case MMCN_FILTER_CHANGE:
      wsprintf(message, _T("MMCN_FILTER_CHANGE\n\tColumn: %d\n"), param);
      break;

    case MMCN_HELP:
      wsprintf(message, _T("MMCN_HELP\n"));
      break;

    case MMCN_INITOCX:
      wsprintf(message, _T("MMCN_INITOCX\n\tIUnknown: %08x\n"), param);
      break;

    case MMCN_LISTPAD:
      wsprintf(message, _T("MMCN_LISTPAD\n\tConnect: %d\n"), arg);
      break;

    case MMCN_MENU_BTNCLICK:
      wsprintf(message, _T("MMCN_MENU_BTNCLICK\n"));
      break;

    case MMCN_MINIMIZED:
      wsprintf(message, _T("MMCN_MINIMIZED\n\tMinimized: %d\n"), arg);
      break;

    case MMCN_PASTE:
      wsprintf(message, _T("MMCN_PASTE\n\tCopy: %d\n"), param == NULL);
      break;

    case MMCN_PRELOAD:
      wsprintf(message, _T("MMCN_PRELOAD\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_PRINT:
      wsprintf(message, _T("MMCN_PRINT\n"));
      break;

    case MMCN_PROPERTY_CHANGE:
      wsprintf(message, _T("MMCN_PROPERTY_CHANGE\n\tScope: %d\n\tArg: %08x\n"), arg, param);
      break;

    case MMCN_QUERY_PASTE:
      wsprintf(message, _T("MMCN_QUERY_PASTE\n"));
      break;

    case MMCN_REFRESH:
      wsprintf(message, _T("MMCN_REFRESH\n"));
      break;

    case MMCN_REMOVE_CHILDREN:
      wsprintf(message, _T("MMCN_REMOVE_CHILDREN\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_RENAME:
                        // Destination string may contain a truncation of the ideal result.
                        // (Indicated by return value other than S_OK).
                        // However, it will be null-terminated.
      StringCchPrintf(message, cchMessage, _T("MMCN_RENAME\n\tNew Name: '%ws'\n"), (LPOLESTR)param);
      break;

    case MMCN_RESTORE_VIEW:
      wsprintf(message, _T("MMCN_RESTORE_VIEW\n"));
      break;

    case MMCN_SELECT:
      wsprintf(message, _T("MMCN_SELECT\n\tScope: %d\n\tSelect: %08x\n"), LOWORD(arg), HIWORD(arg));
      break;

    case MMCN_SHOW:
      wsprintf(message, _T("MMCN_SHOW\n\tShow: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_SNAPINHELP:
      wsprintf(message, _T("MMCN_SNAPINHELP\n"));
      break;

    case MMCN_VIEW_CHANGE:
      wsprintf(message, _T("MMCN_VIEW_CHANGE\n\tData: %08x\n\tHint: %08x\n"), arg, param);
      break;
  }

  if (message[0] != 0)
    OutputDebugString(message);
  else
    OutputDebugString(_T("unknown event\n"));

#endif
  return;
}

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Extens/people.Cpp File Reference

  • SysMgmt
  • MMC
  • Extens

people.Cpp File Reference

#include <stdio.h>
#include "People.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Extens/people.h File Reference

  • SysMgmt
  • MMC
  • Extens
Classes

people.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class | CBicycle
class | CBicycleFolder
class | CIceSkate
class | CIceSkateFolder
class | CPeoplePoweredVehicle
class | CSkateboard
class | CSkateboardFolder
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Extens/registry.Cpp File Reference

  • SysMgmt
  • MMC
  • Extens
Defines | Functions | Variables

registry.Cpp File Reference

#include <objbase.h>
#include <assert.h>
#include "Extend.h"
#include "Registry.h"
#include "globals.h"

Go to the source code of this file.

Defines

#define | STRINGS_ONLY

Functions

LONG | recursiveDeleteKey (HKEY hKeyParent, const _TCHAR *szKeyChild)
HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const _TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const _TCHAR *szNameString, const CLSID &clsidAbout)
BOOL | setKeyAndValue (const _TCHAR *pszPath, const _TCHAR *szSubkey, const _TCHAR *szValue)
BOOL | setSnapInExtensionNode (const _TCHAR *szSnapID, const _TCHAR *szNodeID, const _TCHAR *szDescription)
BOOL | setSnapInKeyAndValue (const _TCHAR *szKey, const _TCHAR *szSubkey, const _TCHAR *szName, const _TCHAR *szValue)
BOOL | setValue (const _TCHAR *szKey, const _TCHAR *szValueName, const _TCHAR *szValue)
LONG | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Variables

NODESTRUCT g_Nodes []

Define Documentation

#define STRINGS_ONLY

Definition at line 24 of file registry.Cpp.

Function Documentation

LONG recursiveDeleteKey | ( | HKEY | hKeyParent,
 |  | const _TCHAR * | szKeyChild
 | ) |  |

Definition at line 248 of file registry.Cpp.

{
    // Open the child.
    HKEY hKeyChild ;
    LONG lRes = RegOpenKeyEx(hKeyParent, lpszKeyChild, 0,
        KEY_ALL_ACCESS, &hKeyChild) ;
    if (lRes != ERROR_SUCCESS)
    {
        return lRes ;
    }

    // Enumerate all of the decendents of this child.
    FILETIME time ;
    _TCHAR szBuffer[256] ;
    DWORD dwSize = 256 ;
    while (RegEnumKeyEx(hKeyChild, 0, szBuffer, &dwSize, NULL,
        NULL, NULL, &time) == S_OK)
    {
        // Delete the decendents of this child.
        lRes = recursiveDeleteKey(hKeyChild, szBuffer) ;
        if (lRes != ERROR_SUCCESS)
        {
            // Cleanup before exiting.
            RegCloseKey(hKeyChild) ;
            return lRes;
        }
        dwSize = 256 ;
    }

    // Close the child.
    RegCloseKey(hKeyChild) ;

    // Delete this child.
    return RegDeleteKey(hKeyParent, lpszKeyChild) ;
}

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const _TCHAR * | szFriendlyName
 | ) |  |

Definition at line 74 of file registry.Cpp.

{
    // Get server location.
    _TCHAR szModule[512] ;
    DWORD dwResult =
        ::GetModuleFileName(hModule,
        szModule,
        sizeof(szModule)/sizeof(_TCHAR)) ;

    assert(dwResult != 0) ;

    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    assert(SUCCEEDED(hr)) ;

    MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;
        _tcscat(szKey, pszCLSID) ;

    // Add the CLSID to the registry.
    setKeyAndValue(szKey, NULL, szFriendlyName) ;

    // Add the server filename subkey under the CLSID key.
    setKeyAndValue(szKey, _T("InprocServer32"), szModule) ;

    // set the threading model
    _tcscat(szKey, _T("\\InprocServer32"));
    setValue(szKey, _T("ThreadingModel"), _T("Apartment"));

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const _TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout
 | ) |  |

Definition at line 147 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    LPOLESTR wszAboutCLSID = NULL;
    LPOLESTR wszExtendCLSID = NULL;
    NODESTRUCT *pNode;

    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    if (IID_NULL != clsidAbout)
        hr = StringFromCLSID(clsidAbout, &wszAboutCLSID);

    MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);
    MAKE_TSTRPTR_FROMWIDE(pszAboutCLSID, wszAboutCLSID);

    // Add the CLSID to the registry.
    setSnapInKeyAndValue(pszCLSID, NULL, _T("NameString"), szNameString) ;
    setSnapInKeyAndValue(pszCLSID, _T("StandAlone"), NULL, NULL);
    if (IID_NULL != clsidAbout)
        setSnapInKeyAndValue(pszCLSID, NULL, _T("About"), pszAboutCLSID);

    // register each of the node types in g_Nodes as an extendable node
    for (pNode = &(g_Nodes[0]);*pNode->szDescription;pNode++)
    {
        hr = StringFromCLSID(pNode->GUID, &wszExtendCLSID);
        MAKE_TSTRPTR_FROMWIDE(pszExtendCLSID, wszExtendCLSID);
        setSnapInExtensionNode(pszCLSID, pszExtendCLSID, pNode->szDescription);
        CoTaskMemFree(wszExtendCLSID);
    }

    // Free memory.
    CoTaskMemFree(wszCLSID) ;
    if (IID_NULL != clsidAbout)
        CoTaskMemFree(wszAboutCLSID);

    return S_OK ;
}

BOOL setKeyAndValue | ( | const _TCHAR * | pszPath,
 |  | const _TCHAR * | szSubkey,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 290 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Copy keyname into buffer.
    _tcscpy(szKeyBuf, szKey) ;

    // Add subkey name to buffer.
    if (szSubkey != NULL)
    {
        _tcscat(szKeyBuf, _T("\\")) ;
        _tcscat(szKeyBuf, szSubkey ) ;
    }

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, NULL, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

BOOL setSnapInExtensionNode | ( | const _TCHAR * | szSnapID,
 |  | const _TCHAR * | szNodeID,
 |  | const _TCHAR * | szDescription
 | ) |  |

Definition at line 416 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szSnapNodeKeyBuf[1024] ;
    _TCHAR szMMCNodeKeyBuf[1024];

    // Load the buffer with the Snap-In Location
    _tcscpy(szSnapNodeKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns\\"));
    // add in the clisid into buffer.
    _tcscat(szSnapNodeKeyBuf, szSnapID) ;
    _tcscat(szSnapNodeKeyBuf, _T("\\NodeTypes\\"));
    _tcscat(szSnapNodeKeyBuf, szNodeID) ;

    // Load the buffer with the NodeTypes Location
    _tcscpy(szMMCNodeKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\NodeTypes\\"));
    _tcscat(szMMCNodeKeyBuf, szNodeID) ;

    // Create and open the Snapin Key.
    long lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE ,
        szSnapNodeKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szDescription != NULL)
    {
        RegSetValueEx(hKey, NULL, 0, REG_SZ,
            (BYTE *)szDescription,
            (_tcslen(szDescription)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;

    // Create and open the NodeTypes Key.
    lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE ,
        szMMCNodeKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szDescription != NULL)
    {
        RegSetValueEx(hKey, NULL, 0, REG_SZ,
            (BYTE *)szDescription,
            (_tcslen(szDescription)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;

    return TRUE ;
}

BOOL setSnapInKeyAndValue | ( | const _TCHAR * | szKey,
 |  | const _TCHAR * | szSubkey,
 |  | const _TCHAR * | szName,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 371 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\")) ;
    _tcscat(szKeyBuf, szKey) ;

    // Add subkey name to buffer.
    if (szSubkey != NULL)
    {
        _tcscat(szKeyBuf, _T("\\")) ;
        _tcscat(szKeyBuf, szSubkey ) ;
    }

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, szName, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

BOOL setValue | ( | const _TCHAR * | szKey,
 |  | const _TCHAR * | szValueName,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 333 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Copy keyname into buffer.
    _tcscpy(szKeyBuf, szKey) ;

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, szValueName, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

LONG UnregisterServer ( const CLSID & clsid )

Definition at line 119 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

        MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
        _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
               (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 193 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
    MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
               (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

  //Uncomment following for loop to unregister all extendable node types
  //Note that if a snap-in's extendable node types are unregistered,
  //any extension snap-ins for these node types will have to be re-registered
  //in order to rebuild their entries under the SOFTWARE\Microsoft\MMC\NodeTypes key

/*
    // Unregister each of the node types in g_Nodes as an extendable node

    NODESTRUCT *pNode;
  LPOLESTR wszExtendCLSID = NULL;

    for (pNode = &(g_Nodes[0]);*pNode->szDescription;pNode++)
    {
        hr = StringFromCLSID(pNode->GUID, &wszExtendCLSID);
        // Load the buffer with the Snap-In Location
        MAKE_TSTRPTR_FROMWIDE(pszExtendCLSID, wszExtendCLSID);
        _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\NodeTypes\\"));
        // Copy keyname into buffer.
        _tcscat(szKeyBuf, pszExtendCLSID);
        recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
        CoTaskMemFree(wszExtendCLSID);
    }

*/

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Variable Documentation

NODESTRUCT g_Nodes[]

Definition at line 36 of file basesnap.Cpp.

Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Extens/registry.h File Reference

  • SysMgmt
  • MMC
  • Extens
Functions

registry.h File Reference

#include <tchar.h>

Go to the source code of this file.

Functions

HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const _TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const _TCHAR *szNameString, const CLSID &clsidAbout)
HRESULT | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Function Documentation

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const _TCHAR * | szFriendlyName
 | ) |  |

Definition at line 67 of file registry.Cpp.

{
    // Get server location.
    _TCHAR szModule[512] ;
    DWORD dwResult =
        ::GetModuleFileName(hModule,
        szModule,
        sizeof(szModule)/sizeof(_TCHAR)) ;

    assert(dwResult != 0) ;

    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    assert(SUCCEEDED(hr)) ;

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;
  _tcscat(szKey, pszCLSID) ;

    // Add the CLSID to the registry.
    setKeyAndValue(szKey, NULL, szFriendlyName) ;

    // Add the server filename subkey under the CLSID key.
    setKeyAndValue(szKey, _T("InprocServer32"), szModule) ;

    // set the threading model
    _tcscat(szKey, _T("\\InprocServer32"));
    setValue(szKey, _T("ThreadingModel"), _T("Apartment"));

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const _TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout
 | ) |  |

Definition at line 147 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    LPOLESTR wszAboutCLSID = NULL;
    LPOLESTR wszExtendCLSID = NULL;
    NODESTRUCT *pNode;

    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    if (IID_NULL != clsidAbout)
        hr = StringFromCLSID(clsidAbout, &wszAboutCLSID);

    MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);
    MAKE_TSTRPTR_FROMWIDE(pszAboutCLSID, wszAboutCLSID);

    // Add the CLSID to the registry.
    setSnapInKeyAndValue(pszCLSID, NULL, _T("NameString"), szNameString) ;
    setSnapInKeyAndValue(pszCLSID, _T("StandAlone"), NULL, NULL);
    if (IID_NULL != clsidAbout)
        setSnapInKeyAndValue(pszCLSID, NULL, _T("About"), pszAboutCLSID);

    // register each of the node types in g_Nodes as an extendable node
    for (pNode = &(g_Nodes[0]);*pNode->szDescription;pNode++)
    {
        hr = StringFromCLSID(pNode->GUID, &wszExtendCLSID);
        MAKE_TSTRPTR_FROMWIDE(pszExtendCLSID, wszExtendCLSID);
        setSnapInExtensionNode(pszCLSID, pszExtendCLSID, pNode->szDescription);
        CoTaskMemFree(wszExtendCLSID);
    }

    // Free memory.
    CoTaskMemFree(wszCLSID) ;
    if (IID_NULL != clsidAbout)
        CoTaskMemFree(wszAboutCLSID);

    return S_OK ;
}

HRESULT UnregisterServer ( const CLSID & clsid )

Definition at line 112 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

  MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
  _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 184 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Generated on Wed Nov 13 2024 16:53:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Extens/resource.h File Reference

  • SysMgmt
  • MMC
  • Extens
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDB_BIKE 40007
#define | IDB_BIKE2 40011
#define | IDB_CAR 40005
#define | IDB_CAR2 40009
#define | IDB_CLOSED 40014
#define | IDB_CLOSED2 40012
#define | IDB_LGBMP 113
#define | IDB_OPEN 40015
#define | IDB_OPEN2 40013
#define | IDB_PLANE 40006
#define | IDB_PLANE2 40010
#define | IDB_ROCKET 40004
#define | IDB_ROCKET2 40008
#define | IDB_SMBMP 112
#define | IDB_SMOPEN 111
#define | IDI_ICON1 108
#define | IDR_LGICONS 121
#define | IDR_SMICONS 120
#define | IDS_ABOUTNAME 9
#define | IDS_HELPFILE 1
#define | IDS_NAME 3
#define | IDS_SNAPINDESC 2
#define | IDS_SNAPINNAME 6

Define Documentation

#define IDB_BIKE 40007

Definition at line 19 of file resource.h.

#define IDB_BIKE2 40011

Definition at line 23 of file resource.h.

#define IDB_CAR 40005

Definition at line 17 of file resource.h.

#define IDB_CAR2 40009

Definition at line 21 of file resource.h.

#define IDB_CLOSED 40014

Definition at line 26 of file resource.h.

#define IDB_CLOSED2 40012

Definition at line 24 of file resource.h.

#define IDB_LGBMP 113

Definition at line 13 of file resource.h.

#define IDB_OPEN 40015

Definition at line 27 of file resource.h.

#define IDB_OPEN2 40013

Definition at line 25 of file resource.h.

#define IDB_PLANE 40006

Definition at line 18 of file resource.h.

#define IDB_PLANE2 40010

Definition at line 22 of file resource.h.

#define IDB_ROCKET 40004

Definition at line 16 of file resource.h.

#define IDB_ROCKET2 40008

Definition at line 20 of file resource.h.

#define IDB_SMBMP 112

Definition at line 12 of file resource.h.

#define IDB_SMOPEN 111

Definition at line 11 of file resource.h.

#define IDI_ICON1 108

Definition at line 10 of file resource.h.

#define IDR_LGICONS 121

Definition at line 15 of file resource.h.

#define IDR_SMICONS 120

Definition at line 14 of file resource.h.

#define IDS_ABOUTNAME 9

Definition at line 9 of file resource.h.

#define IDS_HELPFILE 1

Definition at line 5 of file resource.h.

#define IDS_NAME 3

Definition at line 7 of file resource.h.

#define IDS_SNAPINDESC 2

Definition at line 6 of file resource.h.

#define IDS_SNAPINNAME 6

Definition at line 8 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Extens/sky.Cpp File Reference

  • SysMgmt
  • MMC
  • Extens

sky.Cpp File Reference

#include "Sky.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Extens/sky.h File Reference

  • SysMgmt
  • MMC
  • Extens
Classes

sky.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class CSkyBasedVehicle
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Extens/space.Cpp File Reference

  • SysMgmt
  • MMC
  • Extens
Defines

space.Cpp File Reference

#include <stdio.h>
#include "Space.h"
#include "Comp.h"
#include <strsafe.h>

Go to the source code of this file.

Defines

#define STRSAFE_NO_DEPRECATE

Define Documentation

#define STRSAFE_NO_DEPRECATE

Definition at line 23 of file space.Cpp.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Extens/space.h File Reference

  • SysMgmt
  • MMC
  • Extens
Classes

space.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class | CRocket
class | CSpaceVehicle
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Extens/statnode.Cpp File Reference

  • SysMgmt
  • MMC
  • Extens

statnode.Cpp File Reference

#include "StatNode.h"
#include "Space.h"
#include "Sky.h"
#include "People.h"
#include "Land.h"
#include "Extend.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Extens/statnode.h File Reference

  • SysMgmt
  • MMC
  • Extens
Classes

statnode.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class CStaticNode
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Help/About.Cpp File Reference

  • SysMgmt
  • MMC
  • Help
Functions

About.Cpp File Reference

#include "About.h"
#include "resource.h"
#include "globals.h"
#include <crtdbg.h>

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CSnapinAbout

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 89 of file About.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        // we need to decrement our object count in the DLL
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:54:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Help/About.h File Reference

  • SysMgmt
  • MMC
  • Help
Classes

About.h File Reference

#include <tchar.h>
#include <mmc.h>

Go to the source code of this file.

Classes

class CSnapinAbout
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Help/BaseSnap.Cpp File Reference

  • SysMgmt
  • MMC
  • Help
Functions | Variables

BaseSnap.Cpp File Reference

#include <objbase.h>
#include <olectl.h>
#include <initguid.h>
#include "guids.h"
#include "basesnap.h"
#include "Comp.h"
#include "CompData.h"
#include "About.h"
#include "Registry.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)
BOOL WINAPI | DllMain (HINSTANCE hinstDLL, DWORD fdwReason, void *lpvReserved)
STDAPI | DllRegisterServer ()
STDAPI | DllUnregisterServer ()
STDMETHODIMP_ (ULONG) CClassFactory

Variables

HINSTANCE | g_hinst

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 77 of file BaseSnap.Cpp.

{
    if (g_uObjects == 0 && g_uSrvLock == 0)
        return S_OK;
    else
        return S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 45 of file BaseSnap.Cpp.

{
    if ((rclsid != CLSID_CComponentData) && (rclsid != CLSID_CSnapinAbout))
        return CLASS_E_CLASSNOTAVAILABLE;

    if (!ppvObj)
        return E_FAIL;

    *ppvObj = NULL;

    // We can only hand out IUnknown and IClassFactory pointers.  Fail
    // if they ask for anything else.
    if (!IsEqualIID(riid, IID_IUnknown) && !IsEqualIID(riid, IID_IClassFactory))
        return E_NOINTERFACE;

    CClassFactory *pFactory = NULL;

    // make the factory passing in the creation function for the type of object they want
    if (rclsid == CLSID_CComponentData)
        pFactory = new CClassFactory(CClassFactory::COMPONENT);
    else if (rclsid == CLSID_CSnapinAbout)
        pFactory = new CClassFactory(CClassFactory::ABOUT);

    if (NULL == pFactory)
        return E_OUTOFMEMORY;

    HRESULT hr = pFactory->QueryInterface(riid, ppvObj);

    return hr;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hinstDLL,
 |  | DWORD | fdwReason,
 |  | void * | lpvReserved
 | ) |  |

Definition at line 32 of file BaseSnap.Cpp.

{

    if (fdwReason == DLL_PROCESS_ATTACH) {
        g_hinst = hinstDLL;
    }

    return TRUE;
}

STDAPI DllRegisterServer ( void )

Definition at line 187 of file BaseSnap.Cpp.

{
    HRESULT hr = SELFREG_E_CLASS;
    _TCHAR szName[256];
    _TCHAR szSnapInName[256];

    LoadString(g_hinst, IDS_NAME, szName, (sizeof szName)/(sizeof szName[0]));
    LoadString(g_hinst, IDS_SNAPINNAME, szSnapInName, (sizeof szSnapInName)/(sizeof szSnapInName[0]));

    _TCHAR szAboutName[256];

    LoadString(g_hinst, IDS_ABOUTNAME, szAboutName, (sizeof szAboutName)/(sizeof szAboutName[0]));

    // register our CoClasses
    hr = RegisterServer(g_hinst,
        CLSID_CComponentData,
        szName);

    if SUCCEEDED(hr)
        hr = RegisterServer(g_hinst,
        CLSID_CSnapinAbout,
        szAboutName);

    // place the registry information for SnapIns
    if SUCCEEDED(hr)
        hr = RegisterSnapin(CLSID_CComponentData, szSnapInName, CLSID_CSnapinAbout, FALSE);

    return hr;
}

STDAPI DllUnregisterServer ( void )

Definition at line 218 of file BaseSnap.Cpp.

{
    if (UnregisterServer(CLSID_CComponentData) == S_OK)
        return UnregisterSnapin(CLSID_CComponentData);
    else
        return E_FAIL;
}

STDMETHODIMP_ ( ULONG )

Definition at line 124 of file BaseSnap.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;
}

Variable Documentation

HINSTANCE g_hinst

Definition at line 30 of file BaseSnap.Cpp.

Generated on Wed Nov 13 2024 16:54:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Help/BaseSnap.h File Reference

  • SysMgmt
  • MMC
  • Help
Classes | Functions | Variables

BaseSnap.h File Reference

Go to the source code of this file.

Classes

class | CClassFactory

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)

Variables

ULONG | g_uObjects = 0
ULONG | g_uSrvLock = 0

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 53 of file ComSpyAudit.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 61 of file ComSpyAudit.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

Variable Documentation

ULONG g_uObjects = 0

Definition at line 24 of file BaseSnap.h.

ULONG g_uSrvLock = 0

Definition at line 25 of file BaseSnap.h.

Generated on Wed Nov 13 2024 16:54:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Help/Comp.Cpp File Reference

  • SysMgmt
  • MMC
  • Help
Functions

Comp.Cpp File Reference

#include "Comp.h"
#include "DataObj.h"
#include <commctrl.h>
#include <crtdbg.h>
#include "globals.h"
#include "resource.h"
#include "DeleBase.h"
#include "CompData.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CComponent

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 65 of file Comp.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Help/Comp.h File Reference

  • SysMgmt
  • MMC
  • Help
Classes

Comp.h File Reference

#include <mmc.h>

Go to the source code of this file.

Classes

class CComponent
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Help/CompData.Cpp File Reference

  • SysMgmt
  • MMC
  • Help
Functions

CompData.Cpp File Reference

#include "Comp.h"
#include "CompData.h"
#include "DataObj.h"
#include "resource.h"
#include <crtdbg.h>

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CComponentData

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 83 of file CompData.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        // we need to decrement our object count in the DLL
        delete this;
        return 0;
    }

    return m_cref;
}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Help/CompData.h File Reference

  • SysMgmt
  • MMC
  • Help
Classes

CompData.h File Reference

#include <mmc.h>
#include "DeleBase.h"
#include "StatNode.h"
#include "Comp.h"
#include "DeleBase.h"
#include "StatNode.h"

Go to the source code of this file.

Classes

class CComponentData
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Help/Dataobj.Cpp File Reference

  • SysMgmt
  • MMC
  • Help
Defines | Functions

Dataobj.Cpp File Reference

#include "DataObj.h"
#include "guids.h"
#include "DeleBase.h"

Go to the source code of this file.

Defines

#define | _T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")
#define | _T_CCF_INTERNAL_SNAPIN _T("{2479DB32-5276-11d2-94F5-00C04FB92EC2}")
#define | _T_CCF_NODETYPE _T("CCF_NODETYPE")
#define | _T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")
#define | _T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")

Functions

CDataObject * | GetOurDataObject (LPDATAOBJECT lpDataObject)
STDMETHODIMP_ (ULONG) CDataObject

Define Documentation

#define _T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")

Definition at line 31 of file Dataobj.Cpp.

#define _T_CCF_INTERNAL_SNAPIN _T("{2479DB32-5276-11d2-94F5-00C04FB92EC2}")

Definition at line 36 of file Dataobj.Cpp.

#define _T_CCF_NODETYPE _T("CCF_NODETYPE")

Definition at line 32 of file Dataobj.Cpp.

#define _T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")

Definition at line 34 of file Dataobj.Cpp.

#define _T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")

Definition at line 33 of file Dataobj.Cpp.

Function Documentation

CDataObject* GetOurDataObject ( LPDATAOBJECT lpDataObject )

Definition at line 165 of file Dataobj.Cpp.

{
    HRESULT       hr      = S_OK;
    CDataObject *pSDO     = NULL;

  // check to see if the data object is a special data object.
  if ( IS_SPECIAL_DATAOBJECT (lpDataObject) )
  {
    //Code for handling a special data object goes here.

    //Note that the MMC SDK samples do not handle
    //special data objects, so we exit if we get one.
    return NULL;
  }

    STGMEDIUM stgmedium = { TYMED_HGLOBAL,  NULL  };
    FORMATETC formatetc = { CDataObject::s_cfInternal, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };

    // Allocate memory for the stream
    stgmedium.hGlobal = GlobalAlloc( GMEM_SHARE, sizeof(CDataObject *));

    if (!stgmedium.hGlobal) {
        hr = E_OUTOFMEMORY;
    }

    if SUCCEEDED(hr)
        // Attempt to get data from the object
        hr = lpDataObject->GetDataHere( &formatetc, &stgmedium );

    // stgmedium now has the data we need
    if (SUCCEEDED(hr))  {
        pSDO = *(CDataObject **)(stgmedium.hGlobal);
    }

    // if we have memory free it
    if (stgmedium.hGlobal)
        GlobalFree(stgmedium.hGlobal);

    return pSDO;

} // end GetOurDataObject()

STDMETHODIMP_ ( ULONG )

Definition at line 87 of file Dataobj.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Help/Dataobj.h File Reference

  • SysMgmt
  • MMC
  • Help
Classes | Functions

Dataobj.h File Reference

#include <mmc.h>
#include "DeleBase.h"

Go to the source code of this file.

Classes

class | CDataObject

Functions

HRESULT | ExtractFromDataObject (IDataObject *lpDataObject, UINT cf, ULONG cb, HGLOBAL *phGlobal)
CDataObject * | GetOurDataObject (IDataObject *lpDataObject)
BOOL | IsMMCMultiSelectDataObject (IDataObject *lpDataObject)

Function Documentation

HRESULT ExtractFromDataObject | ( | IDataObject * | lpDataObject,
 |  | UINT | cf,
 |  | ULONG | cb,
 |  | HGLOBAL * | phGlobal
 | ) |  |
CDataObject* GetOurDataObject ( IDataObject * lpDataObject )
BOOL IsMMCMultiSelectDataObject ( IDataObject * lpDataObject )
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Help/deleBase.Cpp File Reference

  • SysMgmt
  • MMC
  • Help

deleBase.Cpp File Reference

#include "DeleBase.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Help/deleBase.h File Reference

  • SysMgmt
  • MMC
  • Help
Classes

deleBase.h File Reference

#include <mmc.h>
#include <crtdbg.h>
#include "globals.h"
#include "resource.h"
#include "LocalRes.h"
#include "LocalRes.h"

Go to the source code of this file.

Classes

class CDelegationBase
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Help/Globals.h File Reference

  • SysMgmt
  • MMC
  • Help
Classes | Defines | Functions | Variables

Globals.h File Reference

#include <tchar.h>

Go to the source code of this file.

Classes

class | TempBuffer

Defines

#define | IDM_BUTTON1 0x100
#define | IDM_BUTTON2 0x101
#define | MAKE_TSTRPTR_FROMWIDE(ptrname, widestr)
#define | MAKE_WIDEPTR_FROMTSTR(ptrname, tstr)
#define | MAKE_WIDEPTR_FROMTSTR_ALLOC(ptrname, tstr)
#define | OBJECT_CREATED InterlockedIncrement((long *)&g_uObjects);
#define | OBJECT_DESTROYED InterlockedDecrement((long *)&g_uObjects);

Functions

void | MMCN_Crack (BOOL bComponentData, IDataObject *pDataObject, IComponentData *pCompData, IComponent *pComp, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)

Variables

HINSTANCE | g_hinst
ULONG g_uObjects

Define Documentation

#define IDM_BUTTON1 0x100

Definition at line 25 of file Globals.h.

#define IDM_BUTTON2 0x101

Definition at line 26 of file Globals.h.

#define MAKE_TSTRPTR_FROMWIDE | ( | ptrname,
 |  | widestr
 | ) |
Value:
long __l##ptrname = (wcslen(widestr) + 1) * 2 * sizeof(TCHAR); \
    TempBuffer __TempBuffer##ptrname(__l##ptrname); \
    WideCharToMultiByte(CP_ACP, 0, widestr, -1, (LPSTR)__TempBuffer##ptrname.GetBuffer(), __l##ptrname, NULL, NULL); \
    LPTSTR ptrname = (LPTSTR)__TempBuffer##ptrname.GetBuffer()

Definition at line 127 of file Globals.h.

#define MAKE_WIDEPTR_FROMTSTR | ( | ptrname,
 |  | tstr
 | ) |
Value:
long __cch##ptrname = (lstrlenA(tstr) + 1);\
    long __l##ptrname = (lstrlenA(tstr) + 1) * sizeof(WCHAR); \
    TempBuffer __TempBuffer##ptrname(__l##ptrname); \
    MultiByteToWideChar(CP_ACP, 0, tstr, -1, (LPWSTR)__TempBuffer##ptrname.GetBuffer(), __cch##ptrname); \
    LPWSTR ptrname = (LPWSTR)__TempBuffer##ptrname.GetBuffer()

Definition at line 93 of file Globals.h.

#define MAKE_WIDEPTR_FROMTSTR_ALLOC | ( | ptrname,
 |  | tstr
 | ) |
Value:
long __cch##ptrname = (lstrlenA(tstr) + 1);\
    long __l##ptrname = (lstrlenA(tstr) + 1) * sizeof(WCHAR); \
    LPWSTR ptrname = (LPWSTR)CoTaskMemAlloc(__l##ptrname); \
    MultiByteToWideChar(CP_ACP, 0, tstr, -1, ptrname, __cch##ptrname)

Definition at line 107 of file Globals.h.

#define OBJECT_CREATED InterlockedIncrement((long *)&g_uObjects);

Definition at line 31 of file Globals.h.

#define OBJECT_DESTROYED InterlockedDecrement((long *)&g_uObjects);

Definition at line 32 of file Globals.h.

Function Documentation

void MMCN_Crack | ( | BOOL | bComponentData,
 |  | IDataObject * | pDataObject,
 |  | IComponentData * | pCompData,
 |  | IComponent * | pComp,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param
 | ) |  |

Definition at line 59 of file mmccrack.Cpp.

{
#ifdef MMC_CRACK_MESSAGES
        const size_t cchMessage = 256;
  TCHAR message[cchMessage] = {0};

  if (bComponentData == TRUE)
    OutputDebugString(_T("IComponentData::Notify( "));
  else
    OutputDebugString(_T("IComponent::Notify( "));

  wsprintf(message, _T("DataObject: %08x, CompData: %08x, Comp: %08x ) - "), pDataObject, pCompData, pComp);
  OutputDebugString(message);

    switch (event)  {
    case MMCN_ACTIVATE:
      wsprintf(message, _T("MMCN_ACTIVATE\n\tActivate: %d\n"), arg);
      break;

    case MMCN_ADD_IMAGES:
      wsprintf(message, _T("MMCN_ADD_IMAGES\n\tImage List: %08x\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_BTN_CLICK:
      wsprintf(message, _T("MMCN_BTN_CLICK\n\tVerb: %ws\n"), MMCN_CrackVerb((MMC_CONSOLE_VERB)param));
      break;

    case MMCN_COLUMN_CLICK:
      wsprintf(message, _T("MMCN_COLUMN_CLICK\n\tColumn: %d\n\tSort Option: %d\n"), arg,   param);
      break;

    case MMCN_COLUMNS_CHANGED:
      wsprintf(message, _T("MMCN_COLUMNS_CHANGED\n"));
      break;

    case MMCN_CONTEXTHELP:
      wsprintf(message, _T("MMCN_CONTEXTHELP\n"));
      break;

    case MMCN_CONTEXTMENU:
      wsprintf(message, _T("MMCN_CONTEXTMENU\n"));
      break;

    case MMCN_CUTORMOVE:
      wsprintf(message, _T("MMCN_CUTORMOVE\n"));
      break;

    case MMCN_DBLCLICK:
      wsprintf(message, _T("MMCN_DBLCLICK\n"));
      break;

    case MMCN_DELETE:
      wsprintf(message, _T("MMCN_DELETE\n"));
      break;

    case MMCN_DESELECT_ALL:
      wsprintf(message, _T("MMCN_DESELECT_ALL\n"));
      break;

    case MMCN_EXPAND:
      wsprintf(message, _T("MMCN_EXPAND\n\tExpand: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_EXPANDSYNC:
      wsprintf(message, _T("MMCN_EXPANDSYNC\n"));
      break;

    case MMCN_FILTERBTN_CLICK:
      wsprintf(message, _T("MMCN_FILTERBTN_CLICK\n\tColumn: %d\n"), arg);
      break;

    case MMCN_FILTER_CHANGE:
      wsprintf(message, _T("MMCN_FILTER_CHANGE\n\tColumn: %d\n"), param);
      break;

    case MMCN_HELP:
      wsprintf(message, _T("MMCN_HELP\n"));
      break;

    case MMCN_INITOCX:
      wsprintf(message, _T("MMCN_INITOCX\n\tIUnknown: %08x\n"), param);
      break;

    case MMCN_LISTPAD:
      wsprintf(message, _T("MMCN_LISTPAD\n\tConnect: %d\n"), arg);
      break;

    case MMCN_MENU_BTNCLICK:
      wsprintf(message, _T("MMCN_MENU_BTNCLICK\n"));
      break;

    case MMCN_MINIMIZED:
      wsprintf(message, _T("MMCN_MINIMIZED\n\tMinimized: %d\n"), arg);
      break;

    case MMCN_PASTE:
      wsprintf(message, _T("MMCN_PASTE\n\tCopy: %d\n"), param == NULL);
      break;

    case MMCN_PRELOAD:
      wsprintf(message, _T("MMCN_PRELOAD\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_PRINT:
      wsprintf(message, _T("MMCN_PRINT\n"));
      break;

    case MMCN_PROPERTY_CHANGE:
      wsprintf(message, _T("MMCN_PROPERTY_CHANGE\n\tScope: %d\n\tArg: %08x\n"), arg, param);
      break;

    case MMCN_QUERY_PASTE:
      wsprintf(message, _T("MMCN_QUERY_PASTE\n"));
      break;

    case MMCN_REFRESH:
      wsprintf(message, _T("MMCN_REFRESH\n"));
      break;

    case MMCN_REMOVE_CHILDREN:
      wsprintf(message, _T("MMCN_REMOVE_CHILDREN\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_RENAME:
                        // Destination string may contain a truncation of the ideal result.
                        // (Indicated by return value other than S_OK).
                        // However, it will be null-terminated.
      StringCchPrintf(message, cchMessage, _T("MMCN_RENAME\n\tNew Name: '%ws'\n"), (LPOLESTR)param);
      break;

    case MMCN_RESTORE_VIEW:
      wsprintf(message, _T("MMCN_RESTORE_VIEW\n"));
      break;

    case MMCN_SELECT:
      wsprintf(message, _T("MMCN_SELECT\n\tScope: %d\n\tSelect: %08x\n"), LOWORD(arg), HIWORD(arg));
      break;

    case MMCN_SHOW:
      wsprintf(message, _T("MMCN_SHOW\n\tShow: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_SNAPINHELP:
      wsprintf(message, _T("MMCN_SNAPINHELP\n"));
      break;

    case MMCN_VIEW_CHANGE:
      wsprintf(message, _T("MMCN_VIEW_CHANGE\n\tData: %08x\n\tHint: %08x\n"), arg, param);
      break;
  }

  if (message[0] != 0)
    OutputDebugString(message);
  else
    OutputDebugString(_T("unknown event\n"));

#endif
  return;
}

Variable Documentation

HINSTANCE g_hinst

Definition at line 33 of file SetDisp.h.

ULONG g_uObjects

Definition at line 24 of file basesnap.h.

Generated on Wed Nov 13 2024 16:54:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Help/Guids.h File Reference

  • SysMgmt
  • MMC
  • Help
Functions

Guids.h File Reference

Go to the source code of this file.

Functions

DEFINE_GUID (CLSID_CComponentData, 0x1390c842, 0x88b8, 0x11d2, 0x8a, 0x8, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28)
DEFINE_GUID (CLSID_CSnapinAbout, 0x1390c844, 0x88b8, 0x11d2, 0x8a, 0x8, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28)

Function Documentation

DEFINE_GUID | ( | CLSID_CComponentData | ,
 |  | 0x1390c842 | ,
 |  | 0x88b8 | ,
 |  | 0x11d2 | ,
 |  | 0x8a | ,
 |  | 0x8 | ,
 |  | 0x0 | ,
 |  | 0x0 | ,
 |  | 0x21 | ,
 |  | 0x47 | ,
 |  | 0x31 | ,
 |  | 0x28 |
 | ) |  |
DEFINE_GUID | ( | CLSID_CSnapinAbout | ,
 |  | 0x1390c844 | ,
 |  | 0x88b8 | ,
 |  | 0x11d2 | ,
 |  | 0x8a | ,
 |  | 0x8 | ,
 |  | 0x0 | ,
 |  | 0x0 | ,
 |  | 0x21 | ,
 |  | 0x47 | ,
 |  | 0x31 | ,
 |  | 0x28 |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Help/localres.h File Reference

  • SysMgmt
  • MMC
  • Help
Defines

localres.h File Reference

Go to the source code of this file.

Defines

#define | INDEX_CLOSEDFOLDER 4
#define | INDEX_LANDICON 1
#define | INDEX_NONE -1
#define | INDEX_OPENFOLDER 5
#define | INDEX_PEOPLEICON 3
#define | INDEX_SKYICON 2
#define | INDEX_SPACEICON 0

Define Documentation

#define INDEX_CLOSEDFOLDER 4

Definition at line 27 of file localres.h.

#define INDEX_LANDICON 1

Definition at line 24 of file localres.h.

#define INDEX_NONE -1

Definition at line 22 of file localres.h.

#define INDEX_OPENFOLDER 5

Definition at line 28 of file localres.h.

#define INDEX_PEOPLEICON 3

Definition at line 26 of file localres.h.

#define INDEX_SKYICON 2

Definition at line 25 of file localres.h.

#define INDEX_SPACEICON 0

Definition at line 23 of file localres.h.

Generated on Wed Nov 13 2024 16:54:37 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Help/mmccrack.Cpp File Reference

  • SysMgmt
  • MMC
  • Help
Defines | Functions

mmccrack.Cpp File Reference

#include <mmc.h>
#include <winuser.h>
#include <tchar.h>
#include "globals.h"
#include <strsafe.h>

Go to the source code of this file.

Defines

#define | STRSAFE_NO_DEPRECATE

Functions

void | MMCN_Crack (BOOL bComponentData, IDataObject *pDataObject, IComponentData *pCompData, IComponent *pComp, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)

Define Documentation

#define STRSAFE_NO_DEPRECATE

Definition at line 25 of file mmccrack.Cpp.

Function Documentation

void MMCN_Crack | ( | BOOL | bComponentData,
 |  | IDataObject * | pDataObject,
 |  | IComponentData * | pCompData,
 |  | IComponent * | pComp,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param
 | ) |  |

Definition at line 59 of file mmccrack.Cpp.

{
#ifdef MMC_CRACK_MESSAGES
        const size_t cchMessage = 256;
  TCHAR message[cchMessage] = {0};

  if (bComponentData == TRUE)
    OutputDebugString(_T("IComponentData::Notify( "));
  else
    OutputDebugString(_T("IComponent::Notify( "));

  wsprintf(message, _T("DataObject: %08x, CompData: %08x, Comp: %08x ) - "), pDataObject, pCompData, pComp);
  OutputDebugString(message);

    switch (event)  {
    case MMCN_ACTIVATE:
      wsprintf(message, _T("MMCN_ACTIVATE\n\tActivate: %d\n"), arg);
      break;

    case MMCN_ADD_IMAGES:
      wsprintf(message, _T("MMCN_ADD_IMAGES\n\tImage List: %08x\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_BTN_CLICK:
      wsprintf(message, _T("MMCN_BTN_CLICK\n\tVerb: %ws\n"), MMCN_CrackVerb((MMC_CONSOLE_VERB)param));
      break;

    case MMCN_COLUMN_CLICK:
      wsprintf(message, _T("MMCN_COLUMN_CLICK\n\tColumn: %d\n\tSort Option: %d\n"), arg,   param);
      break;

    case MMCN_COLUMNS_CHANGED:
      wsprintf(message, _T("MMCN_COLUMNS_CHANGED\n"));
      break;

    case MMCN_CONTEXTHELP:
      wsprintf(message, _T("MMCN_CONTEXTHELP\n"));
      break;

    case MMCN_CONTEXTMENU:
      wsprintf(message, _T("MMCN_CONTEXTMENU\n"));
      break;

    case MMCN_CUTORMOVE:
      wsprintf(message, _T("MMCN_CUTORMOVE\n"));
      break;

    case MMCN_DBLCLICK:
      wsprintf(message, _T("MMCN_DBLCLICK\n"));
      break;

    case MMCN_DELETE:
      wsprintf(message, _T("MMCN_DELETE\n"));
      break;

    case MMCN_DESELECT_ALL:
      wsprintf(message, _T("MMCN_DESELECT_ALL\n"));
      break;

    case MMCN_EXPAND:
      wsprintf(message, _T("MMCN_EXPAND\n\tExpand: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_EXPANDSYNC:
      wsprintf(message, _T("MMCN_EXPANDSYNC\n"));
      break;

    case MMCN_FILTERBTN_CLICK:
      wsprintf(message, _T("MMCN_FILTERBTN_CLICK\n\tColumn: %d\n"), arg);
      break;

    case MMCN_FILTER_CHANGE:
      wsprintf(message, _T("MMCN_FILTER_CHANGE\n\tColumn: %d\n"), param);
      break;

    case MMCN_HELP:
      wsprintf(message, _T("MMCN_HELP\n"));
      break;

    case MMCN_INITOCX:
      wsprintf(message, _T("MMCN_INITOCX\n\tIUnknown: %08x\n"), param);
      break;

    case MMCN_LISTPAD:
      wsprintf(message, _T("MMCN_LISTPAD\n\tConnect: %d\n"), arg);
      break;

    case MMCN_MENU_BTNCLICK:
      wsprintf(message, _T("MMCN_MENU_BTNCLICK\n"));
      break;

    case MMCN_MINIMIZED:
      wsprintf(message, _T("MMCN_MINIMIZED\n\tMinimized: %d\n"), arg);
      break;

    case MMCN_PASTE:
      wsprintf(message, _T("MMCN_PASTE\n\tCopy: %d\n"), param == NULL);
      break;

    case MMCN_PRELOAD:
      wsprintf(message, _T("MMCN_PRELOAD\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_PRINT:
      wsprintf(message, _T("MMCN_PRINT\n"));
      break;

    case MMCN_PROPERTY_CHANGE:
      wsprintf(message, _T("MMCN_PROPERTY_CHANGE\n\tScope: %d\n\tArg: %08x\n"), arg, param);
      break;

    case MMCN_QUERY_PASTE:
      wsprintf(message, _T("MMCN_QUERY_PASTE\n"));
      break;

    case MMCN_REFRESH:
      wsprintf(message, _T("MMCN_REFRESH\n"));
      break;

    case MMCN_REMOVE_CHILDREN:
      wsprintf(message, _T("MMCN_REMOVE_CHILDREN\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_RENAME:
                        // Destination string may contain a truncation of the ideal result.
                        // (Indicated by return value other than S_OK).
                        // However, it will be null-terminated.
      StringCchPrintf(message, cchMessage, _T("MMCN_RENAME\n\tNew Name: '%ws'\n"), (LPOLESTR)param);
      break;

    case MMCN_RESTORE_VIEW:
      wsprintf(message, _T("MMCN_RESTORE_VIEW\n"));
      break;

    case MMCN_SELECT:
      wsprintf(message, _T("MMCN_SELECT\n\tScope: %d\n\tSelect: %08x\n"), LOWORD(arg), HIWORD(arg));
      break;

    case MMCN_SHOW:
      wsprintf(message, _T("MMCN_SHOW\n\tShow: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_SNAPINHELP:
      wsprintf(message, _T("MMCN_SNAPINHELP\n"));
      break;

    case MMCN_VIEW_CHANGE:
      wsprintf(message, _T("MMCN_VIEW_CHANGE\n\tData: %08x\n\tHint: %08x\n"), arg, param);
      break;
  }

  if (message[0] != 0)
    OutputDebugString(message);
  else
    OutputDebugString(_T("unknown event\n"));

#endif
  return;
}

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Help/Registry.Cpp File Reference

  • SysMgmt
  • MMC
  • Help
Defines | Functions

Registry.Cpp File Reference

#include <objbase.h>
#include <assert.h>
#include "Registry.h"
#include "globals.h"

Go to the source code of this file.

Defines

#define | STRINGS_ONLY

Functions

LONG | recursiveDeleteKey (HKEY hKeyParent, const _TCHAR *szKeyChild)
HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const _TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const _TCHAR *szNameString, const CLSID &clsidAbout, const BOOL fSupportExtensions)
BOOL | setKeyAndValue (const _TCHAR *pszPath, const _TCHAR *szSubkey, const _TCHAR *szValue)
BOOL | setSnapInKeyAndValue (const _TCHAR *szKey, const _TCHAR *szSubkey, const _TCHAR *szName, const _TCHAR *szValue)
BOOL | setValue (const _TCHAR *szKey, const _TCHAR *szValueName, const _TCHAR *szValue)
LONG | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Define Documentation

#define STRINGS_ONLY

Definition at line 24 of file Registry.Cpp.

Function Documentation

LONG recursiveDeleteKey | ( | HKEY | hKeyParent,
 |  | const _TCHAR * | szKeyChild
 | ) |  |

Definition at line 214 of file Registry.Cpp.

{
    // Open the child.
    HKEY hKeyChild ;
    LONG lRes = RegOpenKeyEx(hKeyParent, lpszKeyChild, 0,
        KEY_ALL_ACCESS, &hKeyChild) ;
    if (lRes != ERROR_SUCCESS)
    {
        return lRes ;
    }

    // Enumerate all of the decendents of this child.
    FILETIME time ;
    _TCHAR szBuffer[256] ;
    DWORD dwSize = 256 ;
    while (RegEnumKeyEx(hKeyChild, 0, szBuffer, &dwSize, NULL,
        NULL, NULL, &time) == S_OK)
    {
        // Delete the decendents of this child.
        lRes = recursiveDeleteKey(hKeyChild, szBuffer) ;
        if (lRes != ERROR_SUCCESS)
        {
            // Cleanup before exiting.
            RegCloseKey(hKeyChild) ;
            return lRes;
        }
        dwSize = 256 ;
    }

    // Close the child.
    RegCloseKey(hKeyChild) ;

    // Delete this child.
    return RegDeleteKey(hKeyParent, lpszKeyChild) ;
}

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const _TCHAR * | szFriendlyName
 | ) |  |

Definition at line 67 of file Registry.Cpp.

{
    // Get server location.
    _TCHAR szModule[512] ;
    DWORD dwResult =
        ::GetModuleFileName(hModule,
        szModule,
        sizeof(szModule)/sizeof(_TCHAR)) ;

    assert(dwResult != 0) ;

    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    assert(SUCCEEDED(hr)) ;

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;
  _tcscat(szKey, pszCLSID) ;

    // Add the CLSID to the registry.
    setKeyAndValue(szKey, NULL, szFriendlyName) ;

    // Add the server filename subkey under the CLSID key.
    setKeyAndValue(szKey, _T("InprocServer32"), szModule) ;

    // set the threading model
    _tcscat(szKey, _T("\\InprocServer32"));
    setValue(szKey, _T("ThreadingModel"), _T("Apartment"));

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const _TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | fSupportExtensions
 | ) |  |

Definition at line 140 of file Registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    LPOLESTR wszAboutCLSID = NULL;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    if (IID_NULL != clsidAbout)
        hr = StringFromCLSID(clsidAbout, &wszAboutCLSID);

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszAboutCLSID, wszAboutCLSID);

    // Add the CLSID to the registry.
    setSnapInKeyAndValue(pszCLSID, NULL, _T("NameString"), szNameString) ;
    setSnapInKeyAndValue(pszCLSID, _T("StandAlone"), NULL, NULL);
    if (IID_NULL != clsidAbout)
        setSnapInKeyAndValue(pszCLSID, NULL, _T("About"), pszAboutCLSID);

    if (fSupportExtensions) {
        // Build the key NodeType
        setSnapInKeyAndValue(pszCLSID, _T("NodeTypes"), NULL, NULL);

        _TCHAR szKey[64] ;
        _tcscpy(szKey, pszCLSID) ;
        _tcscat(szKey, _T("\\NodeTypes")) ;
        setSnapInKeyAndValue(szKey, pszCLSID, NULL, NULL);
    }

    // Free memory.
    CoTaskMemFree(wszCLSID) ;
    if (IID_NULL != clsidAbout)
        CoTaskMemFree(wszAboutCLSID);

    return S_OK ;
}

BOOL setKeyAndValue | ( | const _TCHAR * | pszPath,
 |  | const _TCHAR * | szSubkey,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 256 of file Registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Copy keyname into buffer.
    _tcscpy(szKeyBuf, szKey) ;

    // Add subkey name to buffer.
    if (szSubkey != NULL)
    {
        _tcscat(szKeyBuf, _T("\\")) ;
        _tcscat(szKeyBuf, szSubkey ) ;
    }

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, NULL, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

BOOL setSnapInKeyAndValue | ( | const _TCHAR * | szKey,
 |  | const _TCHAR * | szSubkey,
 |  | const _TCHAR * | szName,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 337 of file Registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\")) ;
    _tcscat(szKeyBuf, szKey) ;

    // Add subkey name to buffer.
    if (szSubkey != NULL)
    {
        _tcscat(szKeyBuf, _T("\\")) ;
        _tcscat(szKeyBuf, szSubkey ) ;
    }

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, szName, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

BOOL setValue | ( | const _TCHAR * | szKey,
 |  | const _TCHAR * | szValueName,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 299 of file Registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Copy keyname into buffer.
    _tcscpy(szKeyBuf, szKey) ;

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, szValueName, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

LONG UnregisterServer ( const CLSID & clsid )

Definition at line 112 of file Registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

  MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
  _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 184 of file Registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Help/Registry.h File Reference

  • SysMgmt
  • MMC
  • Help
Functions

Registry.h File Reference

#include <tchar.h>

Go to the source code of this file.

Functions

HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const _TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const _TCHAR *szNameString, const CLSID &clsidAbout, const BOOL fSupportExtensions=FALSE)
HRESULT | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Function Documentation

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const _TCHAR * | szFriendlyName
 | ) |  |

Definition at line 67 of file registry.Cpp.

{
    // Get server location.
    _TCHAR szModule[512] ;
    DWORD dwResult =
        ::GetModuleFileName(hModule,
        szModule,
        sizeof(szModule)/sizeof(_TCHAR)) ;

    assert(dwResult != 0) ;

    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    assert(SUCCEEDED(hr)) ;

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;
  _tcscat(szKey, pszCLSID) ;

    // Add the CLSID to the registry.
    setKeyAndValue(szKey, NULL, szFriendlyName) ;

    // Add the server filename subkey under the CLSID key.
    setKeyAndValue(szKey, _T("InprocServer32"), szModule) ;

    // set the threading model
    _tcscat(szKey, _T("\\InprocServer32"));
    setValue(szKey, _T("ThreadingModel"), _T("Apartment"));

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const _TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | fSupportExtensions = FALSE
 | ) |  |

Definition at line 140 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    LPOLESTR wszAboutCLSID = NULL;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    if (IID_NULL != clsidAbout)
        hr = StringFromCLSID(clsidAbout, &wszAboutCLSID);

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszAboutCLSID, wszAboutCLSID);

    // Add the CLSID to the registry.
    setSnapInKeyAndValue(pszCLSID, NULL, _T("NameString"), szNameString) ;
    setSnapInKeyAndValue(pszCLSID, _T("StandAlone"), NULL, NULL);
    if (IID_NULL != clsidAbout)
        setSnapInKeyAndValue(pszCLSID, NULL, _T("About"), pszAboutCLSID);

    if (fSupportExtensions) {
        // Build the key NodeType
        setSnapInKeyAndValue(pszCLSID, _T("NodeTypes"), NULL, NULL);

        _TCHAR szKey[64] ;
        _tcscpy(szKey, pszCLSID) ;
        _tcscat(szKey, _T("\\NodeTypes")) ;
        setSnapInKeyAndValue(szKey, pszCLSID, NULL, NULL);
    }

    // Free memory.
    CoTaskMemFree(wszCLSID) ;
    if (IID_NULL != clsidAbout)
        CoTaskMemFree(wszAboutCLSID);

    return S_OK ;
}

HRESULT UnregisterServer ( const CLSID & clsid )

Definition at line 112 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

  MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
  _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 184 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Generated on Wed Nov 13 2024 16:53:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Help/Resource.h File Reference

  • SysMgmt
  • MMC
  • Help
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDB_BIKE 40007
#define | IDB_BIKE2 40011
#define | IDB_CAR 40005
#define | IDB_CAR2 40009
#define | IDB_CLOSED 40014
#define | IDB_CLOSED2 40012
#define | IDB_LGBMP 113
#define | IDB_OPEN 40015
#define | IDB_OPEN2 40013
#define | IDB_PLANE 40006
#define | IDB_PLANE2 40010
#define | IDB_ROCKET 40004
#define | IDB_ROCKET2 40008
#define | IDB_SMBMP 112
#define | IDB_SMOPEN 111
#define | IDI_ICON1 108
#define | IDR_LGICONS 121
#define | IDR_SMICONS 120
#define | IDS_ABOUTNAME 9
#define | IDS_HELPFILE 1
#define | IDS_NAME 3
#define | IDS_SNAPINDESC 2
#define | IDS_SNAPINNAME 6

Define Documentation

#define IDB_BIKE 40007

Definition at line 19 of file Resource.h.

#define IDB_BIKE2 40011

Definition at line 23 of file Resource.h.

#define IDB_CAR 40005

Definition at line 17 of file Resource.h.

#define IDB_CAR2 40009

Definition at line 21 of file Resource.h.

#define IDB_CLOSED 40014

Definition at line 26 of file Resource.h.

#define IDB_CLOSED2 40012

Definition at line 24 of file Resource.h.

#define IDB_LGBMP 113

Definition at line 13 of file Resource.h.

#define IDB_OPEN 40015

Definition at line 27 of file Resource.h.

#define IDB_OPEN2 40013

Definition at line 25 of file Resource.h.

#define IDB_PLANE 40006

Definition at line 18 of file Resource.h.

#define IDB_PLANE2 40010

Definition at line 22 of file Resource.h.

#define IDB_ROCKET 40004

Definition at line 16 of file Resource.h.

#define IDB_ROCKET2 40008

Definition at line 20 of file Resource.h.

#define IDB_SMBMP 112

Definition at line 12 of file Resource.h.

#define IDB_SMOPEN 111

Definition at line 11 of file Resource.h.

#define IDI_ICON1 108

Definition at line 10 of file Resource.h.

#define IDR_LGICONS 121

Definition at line 15 of file Resource.h.

#define IDR_SMICONS 120

Definition at line 14 of file Resource.h.

#define IDS_ABOUTNAME 9

Definition at line 9 of file Resource.h.

#define IDS_HELPFILE 1

Definition at line 5 of file Resource.h.

#define IDS_NAME 3

Definition at line 7 of file Resource.h.

#define IDS_SNAPINDESC 2

Definition at line 6 of file Resource.h.

#define IDS_SNAPINNAME 6

Definition at line 8 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Help/StatNode.Cpp File Reference

  • SysMgmt
  • MMC
  • Help

StatNode.Cpp File Reference

#include "StatNode.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Help/StatNode.h File Reference

  • SysMgmt
  • MMC
  • Help
Classes

StatNode.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class CStaticNode
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Help/Help source/mmcsample.h File Reference

  • SysMgmt
  • MMC
  • Help
  • Help source
Defines

mmcsample.h File Reference

Go to the source code of this file.

Defines

#define | HELP_DEFAULT 0
#define | HELP_INTRO 1
#define | HELP_STEPFOUR 104
#define | HELP_STEPONE 101
#define | HELP_STEPTHREE 103
#define | HELP_STEPTWO 102

Define Documentation

#define HELP_DEFAULT 0

Definition at line 12 of file mmcsample.h.

#define HELP_INTRO 1

Definition at line 13 of file mmcsample.h.

#define HELP_STEPFOUR 104

Definition at line 10 of file mmcsample.h.

#define HELP_STEPONE 101

Definition at line 7 of file mmcsample.h.

#define HELP_STEPTHREE 103

Definition at line 9 of file mmcsample.h.

#define HELP_STEPTWO 102

Definition at line 8 of file mmcsample.h.

Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Menubtn/about.Cpp File Reference

  • SysMgmt
  • MMC
  • Menubtn
Functions

about.Cpp File Reference

#include "About.h"
#include "resource.h"
#include "globals.h"
#include <crtdbg.h>

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CSnapinAbout

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 89 of file about.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        // we need to decrement our object count in the DLL
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:54:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Menubtn/about.h File Reference

  • SysMgmt
  • MMC
  • Menubtn
Classes

about.h File Reference

#include <tchar.h>
#include <mmc.h>

Go to the source code of this file.

Classes

class CSnapinAbout
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Menubtn/basesnap.Cpp File Reference

  • SysMgmt
  • MMC
  • Menubtn
Functions | Variables

basesnap.Cpp File Reference

#include <objbase.h>
#include <olectl.h>
#include <initguid.h>
#include "guids.h"
#include "basesnap.h"
#include "Comp.h"
#include "CompData.h"
#include "About.h"
#include "Registry.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)
BOOL WINAPI | DllMain (HINSTANCE hinstDLL, DWORD fdwReason, void *lpvReserved)
STDAPI | DllRegisterServer ()
STDAPI | DllUnregisterServer ()
STDMETHODIMP_ (ULONG) CClassFactory

Variables

HINSTANCE | g_hinst

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 77 of file basesnap.Cpp.

{
    if (g_uObjects == 0 && g_uSrvLock == 0)
        return S_OK;
    else
        return S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 45 of file basesnap.Cpp.

{
    if ((rclsid != CLSID_CComponentData) && (rclsid != CLSID_CSnapinAbout))
        return CLASS_E_CLASSNOTAVAILABLE;

    if (!ppvObj)
        return E_FAIL;

    *ppvObj = NULL;

    // We can only hand out IUnknown and IClassFactory pointers.  Fail
    // if they ask for anything else.
    if (!IsEqualIID(riid, IID_IUnknown) && !IsEqualIID(riid, IID_IClassFactory))
        return E_NOINTERFACE;

    CClassFactory *pFactory = NULL;

    // make the factory passing in the creation function for the type of object they want
    if (rclsid == CLSID_CComponentData)
        pFactory = new CClassFactory(CClassFactory::COMPONENT);
    else if (rclsid == CLSID_CSnapinAbout)
        pFactory = new CClassFactory(CClassFactory::ABOUT);

    if (NULL == pFactory)
        return E_OUTOFMEMORY;

    HRESULT hr = pFactory->QueryInterface(riid, ppvObj);

    return hr;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hinstDLL,
 |  | DWORD | fdwReason,
 |  | void * | lpvReserved
 | ) |  |

Definition at line 32 of file basesnap.Cpp.

{

    if (fdwReason == DLL_PROCESS_ATTACH) {
        g_hinst = hinstDLL;
    }

    return TRUE;
}

STDAPI DllRegisterServer ( void )

Definition at line 187 of file basesnap.Cpp.

{
    HRESULT hr = SELFREG_E_CLASS;
    _TCHAR szName[256];
    _TCHAR szSnapInName[256];

    LoadString(g_hinst, IDS_NAME, szName, (sizeof szName)/(sizeof szName[0]));
    LoadString(g_hinst, IDS_SNAPINNAME, szSnapInName, (sizeof szSnapInName)/(sizeof szSnapInName[0]));

    _TCHAR szAboutName[256];

    LoadString(g_hinst, IDS_ABOUTNAME, szAboutName, (sizeof szAboutName)/(sizeof szAboutName[0]));

    // register our CoClasses
    hr = RegisterServer(g_hinst,
        CLSID_CComponentData,
        szName);

    if SUCCEEDED(hr)
        hr = RegisterServer(g_hinst,
        CLSID_CSnapinAbout,
        szAboutName);

    // place the registry information for SnapIns
    if SUCCEEDED(hr)
        hr = RegisterSnapin(CLSID_CComponentData, szSnapInName, CLSID_CSnapinAbout, FALSE);

    return hr;
}

STDAPI DllUnregisterServer ( void )

Definition at line 218 of file basesnap.Cpp.

{
    if (UnregisterServer(CLSID_CComponentData) == S_OK)
        return UnregisterSnapin(CLSID_CComponentData);
    else
        return E_FAIL;
}

STDMETHODIMP_ ( ULONG )

Definition at line 124 of file basesnap.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;
}

Variable Documentation

HINSTANCE g_hinst

Definition at line 30 of file basesnap.Cpp.

Generated on Wed Nov 13 2024 16:54:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Menubtn/basesnap.h File Reference

  • SysMgmt
  • MMC
  • Menubtn
Classes | Functions | Variables

basesnap.h File Reference

Go to the source code of this file.

Classes

class | CClassFactory

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)

Variables

ULONG | g_uObjects = 0
ULONG | g_uSrvLock = 0

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 53 of file ComSpyAudit.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 61 of file ComSpyAudit.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

Variable Documentation

ULONG g_uObjects = 0

Definition at line 24 of file basesnap.h.

ULONG g_uSrvLock = 0

Definition at line 25 of file basesnap.h.

Generated on Wed Nov 13 2024 16:54:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Menubtn/comp.Cpp File Reference

  • SysMgmt
  • MMC
  • Menubtn
Functions

comp.Cpp File Reference

#include "Comp.h"
#include "DataObj.h"
#include <commctrl.h>
#include <crtdbg.h>
#include "globals.h"
#include "resource.h"
#include "DeleBase.h"
#include "CompData.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CComponent

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 71 of file comp.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Menubtn/comp.h File Reference

  • SysMgmt
  • MMC
  • Menubtn
Classes

comp.h File Reference

#include <mmc.h>

Go to the source code of this file.

Classes

class CComponent
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Menubtn/compdata.Cpp File Reference

  • SysMgmt
  • MMC
  • Menubtn
Functions

compdata.Cpp File Reference

#include "Comp.h"
#include "CompData.h"
#include "DataObj.h"
#include "resource.h"
#include <crtdbg.h>

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CComponentData

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 83 of file compdata.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        // we need to decrement our object count in the DLL
        delete this;
        return 0;
    }

    return m_cref;
}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Menubtn/compdata.h File Reference

  • SysMgmt
  • MMC
  • Menubtn
Classes

compdata.h File Reference

#include <mmc.h>
#include "DeleBase.h"
#include "StatNode.h"
#include "Comp.h"
#include "DeleBase.h"
#include "StatNode.h"

Go to the source code of this file.

Classes

class CComponentData
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Menubtn/dataobj.Cpp File Reference

  • SysMgmt
  • MMC
  • Menubtn
Defines | Functions

dataobj.Cpp File Reference

#include "DataObj.h"
#include "guids.h"
#include "DeleBase.h"

Go to the source code of this file.

Defines

#define | _T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")
#define | _T_CCF_INTERNAL_SNAPIN _T("{2479DB32-5276-11d2-94F5-00C04FB92EC2}")
#define | _T_CCF_NODETYPE _T("CCF_NODETYPE")
#define | _T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")
#define | _T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")

Functions

CDataObject * | GetOurDataObject (LPDATAOBJECT lpDataObject)
STDMETHODIMP_ (ULONG) CDataObject

Define Documentation

#define _T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")

Definition at line 31 of file dataobj.Cpp.

#define _T_CCF_INTERNAL_SNAPIN _T("{2479DB32-5276-11d2-94F5-00C04FB92EC2}")

Definition at line 36 of file dataobj.Cpp.

#define _T_CCF_NODETYPE _T("CCF_NODETYPE")

Definition at line 32 of file dataobj.Cpp.

#define _T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")

Definition at line 34 of file dataobj.Cpp.

#define _T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")

Definition at line 33 of file dataobj.Cpp.

Function Documentation

CDataObject* GetOurDataObject ( LPDATAOBJECT lpDataObject )

Definition at line 165 of file dataobj.Cpp.

{
    HRESULT       hr      = S_OK;
    CDataObject *pSDO     = NULL;

  // check to see if the data object is a special data object.
  if ( IS_SPECIAL_DATAOBJECT (lpDataObject) )
  {
    //Code for handling a special data object goes here.

    //Note that the MMC SDK samples do not handle
    //special data objects, so we exit if we get one.
    return NULL;
  }

    STGMEDIUM stgmedium = { TYMED_HGLOBAL,  NULL  };
    FORMATETC formatetc = { CDataObject::s_cfInternal, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };

    // Allocate memory for the stream
    stgmedium.hGlobal = GlobalAlloc( GMEM_SHARE, sizeof(CDataObject *));

    if (!stgmedium.hGlobal)     {
        hr = E_OUTOFMEMORY;
    }

    if SUCCEEDED(hr)
        // Attempt to get data from the object
        hr = lpDataObject->GetDataHere( &formatetc, &stgmedium );

    // stgmedium now has the data we need
    if (SUCCEEDED(hr))  {
        pSDO = *(CDataObject **)(stgmedium.hGlobal);
    }

    // if we have memory free it
    if (stgmedium.hGlobal)
        GlobalFree(stgmedium.hGlobal);

    return pSDO;

} // end GetOurDataObject()

STDMETHODIMP_ ( ULONG )

Definition at line 87 of file dataobj.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Menubtn/dataobj.h File Reference

  • SysMgmt
  • MMC
  • Menubtn
Classes | Functions

dataobj.h File Reference

#include <mmc.h>
#include "DeleBase.h"

Go to the source code of this file.

Classes

class | CDataObject

Functions

HRESULT | ExtractFromDataObject (IDataObject *lpDataObject, UINT cf, ULONG cb, HGLOBAL *phGlobal)
CDataObject * | GetOurDataObject (IDataObject *lpDataObject)
BOOL | IsMMCMultiSelectDataObject (IDataObject *lpDataObject)

Function Documentation

HRESULT ExtractFromDataObject | ( | IDataObject * | lpDataObject,
 |  | UINT | cf,
 |  | ULONG | cb,
 |  | HGLOBAL * | phGlobal
 | ) |  |
CDataObject* GetOurDataObject ( IDataObject * lpDataObject )
BOOL IsMMCMultiSelectDataObject ( IDataObject * lpDataObject )
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Menubtn/delebase.Cpp File Reference

  • SysMgmt
  • MMC
  • Menubtn

delebase.Cpp File Reference

#include "DeleBase.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Menubtn/delebase.h File Reference

  • SysMgmt
  • MMC
  • Menubtn
Classes

delebase.h File Reference

#include <mmc.h>
#include <crtdbg.h>
#include "globals.h"
#include "resource.h"
#include "LocalRes.h"
#include "LocalRes.h"

Go to the source code of this file.

Classes

class CDelegationBase
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Menubtn/globals.h File Reference

  • SysMgmt
  • MMC
  • Menubtn
Classes | Defines | Functions | Variables

globals.h File Reference

#include <tchar.h>

Go to the source code of this file.

Classes

class | TempBuffer

Defines

#define | IDM_BUTTON1 0x100
#define | IDM_BUTTON2 0x101
#define | MAKE_TSTRPTR_FROMWIDE(ptrname, widestr)
#define | MAKE_WIDEPTR_FROMTSTR(ptrname, tstr)
#define | MAKE_WIDEPTR_FROMTSTR_ALLOC(ptrname, tstr)
#define | OBJECT_CREATED InterlockedIncrement((long *)&g_uObjects);
#define | OBJECT_DESTROYED InterlockedDecrement((long *)&g_uObjects);

Functions

void | MMCN_Crack (BOOL bComponentData, IDataObject *pDataObject, IComponentData *pCompData, IComponent *pComp, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)

Variables

HINSTANCE | g_hinst
ULONG g_uObjects

Define Documentation

#define IDM_BUTTON1 0x100

Definition at line 25 of file globals.h.

#define IDM_BUTTON2 0x101

Definition at line 26 of file globals.h.

#define MAKE_TSTRPTR_FROMWIDE | ( | ptrname,
 |  | widestr
 | ) |
Value:
long __l##ptrname = (wcslen(widestr) + 1) * 2 * sizeof(TCHAR); \
    TempBuffer __TempBuffer##ptrname(__l##ptrname); \
    WideCharToMultiByte(CP_ACP, 0, widestr, -1, (LPSTR)__TempBuffer##ptrname.GetBuffer(), __l##ptrname, NULL, NULL); \
    LPTSTR ptrname = (LPTSTR)__TempBuffer##ptrname.GetBuffer()

Definition at line 127 of file globals.h.

#define MAKE_WIDEPTR_FROMTSTR | ( | ptrname,
 |  | tstr
 | ) |
Value:
long __cch##ptrname = (lstrlenA(tstr) + 1);\
    long __l##ptrname = (lstrlenA(tstr) + 1) * sizeof(WCHAR); \
    TempBuffer __TempBuffer##ptrname(__l##ptrname); \
    MultiByteToWideChar(CP_ACP, 0, tstr, -1, (LPWSTR)__TempBuffer##ptrname.GetBuffer(), __cch##ptrname); \
    LPWSTR ptrname = (LPWSTR)__TempBuffer##ptrname.GetBuffer()

Definition at line 93 of file globals.h.

#define MAKE_WIDEPTR_FROMTSTR_ALLOC | ( | ptrname,
 |  | tstr
 | ) |
Value:
long __cch##ptrname = (lstrlenA(tstr) + 1);\
    long __l##ptrname = (lstrlenA(tstr) + 1) * sizeof(WCHAR); \
    LPWSTR ptrname = (LPWSTR)CoTaskMemAlloc(__l##ptrname); \
    MultiByteToWideChar(CP_ACP, 0, tstr, -1, ptrname, __cch##ptrname)

Definition at line 107 of file globals.h.

#define OBJECT_CREATED InterlockedIncrement((long *)&g_uObjects);

Definition at line 31 of file globals.h.

#define OBJECT_DESTROYED InterlockedDecrement((long *)&g_uObjects);

Definition at line 32 of file globals.h.

Function Documentation

void MMCN_Crack | ( | BOOL | bComponentData,
 |  | IDataObject * | pDataObject,
 |  | IComponentData * | pCompData,
 |  | IComponent * | pComp,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param
 | ) |  |

Definition at line 59 of file mmccrack.Cpp.

{
#ifdef MMC_CRACK_MESSAGES
        const size_t cchMessage = 256;
  TCHAR message[cchMessage] = {0};

  if (bComponentData == TRUE)
    OutputDebugString(_T("IComponentData::Notify( "));
  else
    OutputDebugString(_T("IComponent::Notify( "));

  wsprintf(message, _T("DataObject: %08x, CompData: %08x, Comp: %08x ) - "), pDataObject, pCompData, pComp);
  OutputDebugString(message);

    switch (event)  {
    case MMCN_ACTIVATE:
      wsprintf(message, _T("MMCN_ACTIVATE\n\tActivate: %d\n"), arg);
      break;

    case MMCN_ADD_IMAGES:
      wsprintf(message, _T("MMCN_ADD_IMAGES\n\tImage List: %08x\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_BTN_CLICK:
      wsprintf(message, _T("MMCN_BTN_CLICK\n\tVerb: %ws\n"), MMCN_CrackVerb((MMC_CONSOLE_VERB)param));
      break;

    case MMCN_COLUMN_CLICK:
      wsprintf(message, _T("MMCN_COLUMN_CLICK\n\tColumn: %d\n\tSort Option: %d\n"), arg,   param);
      break;

    case MMCN_COLUMNS_CHANGED:
      wsprintf(message, _T("MMCN_COLUMNS_CHANGED\n"));
      break;

    case MMCN_CONTEXTHELP:
      wsprintf(message, _T("MMCN_CONTEXTHELP\n"));
      break;

    case MMCN_CONTEXTMENU:
      wsprintf(message, _T("MMCN_CONTEXTMENU\n"));
      break;

    case MMCN_CUTORMOVE:
      wsprintf(message, _T("MMCN_CUTORMOVE\n"));
      break;

    case MMCN_DBLCLICK:
      wsprintf(message, _T("MMCN_DBLCLICK\n"));
      break;

    case MMCN_DELETE:
      wsprintf(message, _T("MMCN_DELETE\n"));
      break;

    case MMCN_DESELECT_ALL:
      wsprintf(message, _T("MMCN_DESELECT_ALL\n"));
      break;

    case MMCN_EXPAND:
      wsprintf(message, _T("MMCN_EXPAND\n\tExpand: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_EXPANDSYNC:
      wsprintf(message, _T("MMCN_EXPANDSYNC\n"));
      break;

    case MMCN_FILTERBTN_CLICK:
      wsprintf(message, _T("MMCN_FILTERBTN_CLICK\n\tColumn: %d\n"), arg);
      break;

    case MMCN_FILTER_CHANGE:
      wsprintf(message, _T("MMCN_FILTER_CHANGE\n\tColumn: %d\n"), param);
      break;

    case MMCN_HELP:
      wsprintf(message, _T("MMCN_HELP\n"));
      break;

    case MMCN_INITOCX:
      wsprintf(message, _T("MMCN_INITOCX\n\tIUnknown: %08x\n"), param);
      break;

    case MMCN_LISTPAD:
      wsprintf(message, _T("MMCN_LISTPAD\n\tConnect: %d\n"), arg);
      break;

    case MMCN_MENU_BTNCLICK:
      wsprintf(message, _T("MMCN_MENU_BTNCLICK\n"));
      break;

    case MMCN_MINIMIZED:
      wsprintf(message, _T("MMCN_MINIMIZED\n\tMinimized: %d\n"), arg);
      break;

    case MMCN_PASTE:
      wsprintf(message, _T("MMCN_PASTE\n\tCopy: %d\n"), param == NULL);
      break;

    case MMCN_PRELOAD:
      wsprintf(message, _T("MMCN_PRELOAD\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_PRINT:
      wsprintf(message, _T("MMCN_PRINT\n"));
      break;

    case MMCN_PROPERTY_CHANGE:
      wsprintf(message, _T("MMCN_PROPERTY_CHANGE\n\tScope: %d\n\tArg: %08x\n"), arg, param);
      break;

    case MMCN_QUERY_PASTE:
      wsprintf(message, _T("MMCN_QUERY_PASTE\n"));
      break;

    case MMCN_REFRESH:
      wsprintf(message, _T("MMCN_REFRESH\n"));
      break;

    case MMCN_REMOVE_CHILDREN:
      wsprintf(message, _T("MMCN_REMOVE_CHILDREN\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_RENAME:
                        // Destination string may contain a truncation of the ideal result.
                        // (Indicated by return value other than S_OK).
                        // However, it will be null-terminated.
      StringCchPrintf(message, cchMessage, _T("MMCN_RENAME\n\tNew Name: '%ws'\n"), (LPOLESTR)param);
      break;

    case MMCN_RESTORE_VIEW:
      wsprintf(message, _T("MMCN_RESTORE_VIEW\n"));
      break;

    case MMCN_SELECT:
      wsprintf(message, _T("MMCN_SELECT\n\tScope: %d\n\tSelect: %08x\n"), LOWORD(arg), HIWORD(arg));
      break;

    case MMCN_SHOW:
      wsprintf(message, _T("MMCN_SHOW\n\tShow: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_SNAPINHELP:
      wsprintf(message, _T("MMCN_SNAPINHELP\n"));
      break;

    case MMCN_VIEW_CHANGE:
      wsprintf(message, _T("MMCN_VIEW_CHANGE\n\tData: %08x\n\tHint: %08x\n"), arg, param);
      break;
  }

  if (message[0] != 0)
    OutputDebugString(message);
  else
    OutputDebugString(_T("unknown event\n"));

#endif
  return;
}

Variable Documentation

HINSTANCE g_hinst

Definition at line 33 of file SetDisp.h.

ULONG g_uObjects

Definition at line 24 of file basesnap.h.

Generated on Wed Nov 13 2024 16:54:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Menubtn/guids.h File Reference

  • SysMgmt
  • MMC
  • Menubtn
Functions

guids.h File Reference

Go to the source code of this file.

Functions

DEFINE_GUID (CLSID_CComponentData, 0x3684860c, 0x8a36, 0x11d2, 0x8a, 0xa, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28)
DEFINE_GUID (CLSID_CSnapinAbout, 0x3684860f, 0x8a36, 0x11d2, 0x8a, 0xa, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28)

Function Documentation

DEFINE_GUID | ( | CLSID_CComponentData | ,
 |  | 0x3684860c | ,
 |  | 0x8a36 | ,
 |  | 0x11d2 | ,
 |  | 0x8a | ,
 |  | 0xa | ,
 |  | 0x0 | ,
 |  | 0x0 | ,
 |  | 0x21 | ,
 |  | 0x47 | ,
 |  | 0x31 | ,
 |  | 0x28 |
 | ) |  |
DEFINE_GUID | ( | CLSID_CSnapinAbout | ,
 |  | 0x3684860f | ,
 |  | 0x8a36 | ,
 |  | 0x11d2 | ,
 |  | 0x8a | ,
 |  | 0xa | ,
 |  | 0x0 | ,
 |  | 0x0 | ,
 |  | 0x21 | ,
 |  | 0x47 | ,
 |  | 0x31 | ,
 |  | 0x28 |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Menubtn/land.Cpp File Reference

  • SysMgmt
  • MMC
  • Menubtn

land.Cpp File Reference

#include "Land.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Menubtn/land.h File Reference

  • SysMgmt
  • MMC
  • Menubtn
Classes

land.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class CLandBasedVehicle
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Menubtn/localres.h File Reference

  • SysMgmt
  • MMC
  • Menubtn
Defines

localres.h File Reference

Go to the source code of this file.

Defines

#define | INDEX_CLOSEDFOLDER 4
#define | INDEX_LANDICON 1
#define | INDEX_NONE -1
#define | INDEX_OPENFOLDER 5
#define | INDEX_PEOPLEICON 3
#define | INDEX_SKYICON 2
#define | INDEX_SPACEICON 0

Define Documentation

#define INDEX_CLOSEDFOLDER 4

Definition at line 27 of file localres.h.

#define INDEX_LANDICON 1

Definition at line 24 of file localres.h.

#define INDEX_NONE -1

Definition at line 22 of file localres.h.

#define INDEX_OPENFOLDER 5

Definition at line 28 of file localres.h.

#define INDEX_PEOPLEICON 3

Definition at line 26 of file localres.h.

#define INDEX_SKYICON 2

Definition at line 25 of file localres.h.

#define INDEX_SPACEICON 0

Definition at line 23 of file localres.h.

Generated on Wed Nov 13 2024 16:54:37 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Menubtn/mmccrack.Cpp File Reference

  • SysMgmt
  • MMC
  • Menubtn
Defines | Functions

mmccrack.Cpp File Reference

#include <mmc.h>
#include <winuser.h>
#include <tchar.h>
#include "globals.h"
#include <strsafe.h>

Go to the source code of this file.

Defines

#define | STRSAFE_NO_DEPRECATE

Functions

void | MMCN_Crack (BOOL bComponentData, IDataObject *pDataObject, IComponentData *pCompData, IComponent *pComp, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)

Define Documentation

#define STRSAFE_NO_DEPRECATE

Definition at line 25 of file mmccrack.Cpp.

Function Documentation

void MMCN_Crack | ( | BOOL | bComponentData,
 |  | IDataObject * | pDataObject,
 |  | IComponentData * | pCompData,
 |  | IComponent * | pComp,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param
 | ) |  |

Definition at line 59 of file mmccrack.Cpp.

{
#ifdef MMC_CRACK_MESSAGES
        const size_t cchMessage = 256;
        TCHAR message[cchMessage] = {0};

        if (bComponentData == TRUE)
                OutputDebugString(_T("IComponentData::Notify( "));
        else
                OutputDebugString(_T("IComponent::Notify( "));

        wsprintf(message, _T("DataObject: %08x, CompData: %08x, Comp: %08x ) - "), pDataObject, pCompData, pComp);
        OutputDebugString(message);

    switch (event)      {
                case MMCN_ACTIVATE:
                        wsprintf(message, _T("MMCN_ACTIVATE\n\tActivate: %d\n"), arg);
                        break;

                case MMCN_ADD_IMAGES:
                        wsprintf(message, _T("MMCN_ADD_IMAGES\n\tImage List: %08x\n\tScope Item: %08x\n"), arg, param);
                        break;

                case MMCN_BTN_CLICK:
                        wsprintf(message, _T("MMCN_BTN_CLICK\n\tVerb: %ws\n"), MMCN_CrackVerb((MMC_CONSOLE_VERB)param));
                        break;

                case MMCN_COLUMN_CLICK:
                        wsprintf(message, _T("MMCN_COLUMN_CLICK\n\tColumn: %d\n\tSort Option: %d\n"), arg,       param);
                        break;

                case MMCN_COLUMNS_CHANGED:
                        wsprintf(message, _T("MMCN_COLUMNS_CHANGED\n"));
                        break;

                case MMCN_CONTEXTHELP:
                        wsprintf(message, _T("MMCN_CONTEXTHELP\n"));
                        break;

                case MMCN_CONTEXTMENU:
                        wsprintf(message, _T("MMCN_CONTEXTMENU\n"));
                        break;

                case MMCN_CUTORMOVE:
                        wsprintf(message, _T("MMCN_CUTORMOVE\n"));
                        break;

                case MMCN_DBLCLICK:
                        wsprintf(message, _T("MMCN_DBLCLICK\n"));
                        break;

                case MMCN_DELETE:
                        wsprintf(message, _T("MMCN_DELETE\n"));
                        break;

                case MMCN_DESELECT_ALL:
                        wsprintf(message, _T("MMCN_DESELECT_ALL\n"));
                        break;

                case MMCN_EXPAND:
                        wsprintf(message, _T("MMCN_EXPAND\n\tExpand: %d\n\tScope Item: %08x\n"), arg, param);
                        break;

                case MMCN_EXPANDSYNC:
                        wsprintf(message, _T("MMCN_EXPANDSYNC\n"));
                        break;

                case MMCN_FILTERBTN_CLICK:
                        wsprintf(message, _T("MMCN_FILTERBTN_CLICK\n\tColumn: %d\n"), arg);
                        break;

                case MMCN_FILTER_CHANGE:
                        wsprintf(message, _T("MMCN_FILTER_CHANGE\n\tColumn: %d\n"), param);
                        break;

                case MMCN_HELP:
                        wsprintf(message, _T("MMCN_HELP\n"));
                        break;

                case MMCN_INITOCX:
                        wsprintf(message, _T("MMCN_INITOCX\n\tIUnknown: %08x\n"), param);
                        break;

                case MMCN_LISTPAD:
                        wsprintf(message, _T("MMCN_LISTPAD\n\tConnect: %d\n"), arg);
                        break;

                case MMCN_MENU_BTNCLICK:
                        wsprintf(message, _T("MMCN_MENU_BTNCLICK\n"));
                        break;

                case MMCN_MINIMIZED:
                        wsprintf(message, _T("MMCN_MINIMIZED\n\tMinimized: %d\n"), arg);
                        break;

                case MMCN_PASTE:
                        wsprintf(message, _T("MMCN_PASTE\n\tCopy: %d\n"), param == NULL);
                        break;

                case MMCN_PRELOAD:
                        wsprintf(message, _T("MMCN_PRELOAD\n\tScope Item: %08x\n"), arg);
                        break;

                case MMCN_PRINT:
                        wsprintf(message, _T("MMCN_PRINT\n"));
                        break;

                case MMCN_PROPERTY_CHANGE:
                        wsprintf(message, _T("MMCN_PROPERTY_CHANGE\n\tScope: %d\n\tArg: %08x\n"), arg, param);
                        break;

                case MMCN_QUERY_PASTE:
                        wsprintf(message, _T("MMCN_QUERY_PASTE\n"));
                        break;

                case MMCN_REFRESH:
                        wsprintf(message, _T("MMCN_REFRESH\n"));
                        break;

                case MMCN_REMOVE_CHILDREN:
                        wsprintf(message, _T("MMCN_REMOVE_CHILDREN\n\tScope Item: %08x\n"), arg);
                        break;

                case MMCN_RENAME:
                        // Destination string may contain a truncation of the ideal result.
                        // (Indicated by return value other than S_OK).
                        // However, it will be null-terminated.
                        StringCchPrintf(message, cchMessage, _T("MMCN_RENAME\n\tNew Name: '%ws'\n"), (LPOLESTR)param);
                        break;

                case MMCN_RESTORE_VIEW:
                        wsprintf(message, _T("MMCN_RESTORE_VIEW\n"));
                        break;

                case MMCN_SELECT:
                        wsprintf(message, _T("MMCN_SELECT\n\tScope: %d\n\tSelect: %08x\n"), LOWORD(arg), HIWORD(arg));
                        break;

                case MMCN_SHOW:
                        wsprintf(message, _T("MMCN_SHOW\n\tShow: %d\n\tScope Item: %08x\n"), arg, param);
                        break;

                case MMCN_SNAPINHELP:
                        wsprintf(message, _T("MMCN_SNAPINHELP\n"));
                        break;

                case MMCN_VIEW_CHANGE:
                        wsprintf(message, _T("MMCN_VIEW_CHANGE\n\tData: %08x\n\tHint: %08x\n"), arg, param);
                        break;
        }

        if (message[0] != 0)
                OutputDebugString(message);
        else
                OutputDebugString(_T("unknown event\n"));

#endif
        return;
}

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Menubtn/people.Cpp File Reference

  • SysMgmt
  • MMC
  • Menubtn

people.Cpp File Reference

#include <stdio.h>
#include "People.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Menubtn/people.h File Reference

  • SysMgmt
  • MMC
  • Menubtn
Classes

people.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class | CBicycle
class | CBicycleFolder
class | CIceSkate
class | CIceSkateFolder
class | CPeoplePoweredVehicle
class | CSkateboard
class | CSkateboardFolder
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Menubtn/registry.Cpp File Reference

  • SysMgmt
  • MMC
  • Menubtn
Defines | Functions

registry.Cpp File Reference

#include <objbase.h>
#include <assert.h>
#include "Registry.h"
#include "globals.h"

Go to the source code of this file.

Defines

#define | STRINGS_ONLY

Functions

LONG | recursiveDeleteKey (HKEY hKeyParent, const _TCHAR *szKeyChild)
HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const _TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const _TCHAR *szNameString, const CLSID &clsidAbout, const BOOL fSupportExtensions)
BOOL | setKeyAndValue (const _TCHAR *pszPath, const _TCHAR *szSubkey, const _TCHAR *szValue)
BOOL | setSnapInKeyAndValue (const _TCHAR *szKey, const _TCHAR *szSubkey, const _TCHAR *szName, const _TCHAR *szValue)
BOOL | setValue (const _TCHAR *szKey, const _TCHAR *szValueName, const _TCHAR *szValue)
LONG | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Define Documentation

#define STRINGS_ONLY

Definition at line 24 of file registry.Cpp.

Function Documentation

LONG recursiveDeleteKey | ( | HKEY | hKeyParent,
 |  | const _TCHAR * | szKeyChild
 | ) |  |

Definition at line 214 of file registry.Cpp.

{
    // Open the child.
    HKEY hKeyChild ;
    LONG lRes = RegOpenKeyEx(hKeyParent, lpszKeyChild, 0,
        KEY_ALL_ACCESS, &hKeyChild) ;
    if (lRes != ERROR_SUCCESS)
    {
        return lRes ;
    }

    // Enumerate all of the decendents of this child.
    FILETIME time ;
    _TCHAR szBuffer[256] ;
    DWORD dwSize = 256 ;
    while (RegEnumKeyEx(hKeyChild, 0, szBuffer, &dwSize, NULL,
        NULL, NULL, &time) == S_OK)
    {
        // Delete the decendents of this child.
        lRes = recursiveDeleteKey(hKeyChild, szBuffer) ;
        if (lRes != ERROR_SUCCESS)
        {
            // Cleanup before exiting.
            RegCloseKey(hKeyChild) ;
            return lRes;
        }
        dwSize = 256 ;
    }

    // Close the child.
    RegCloseKey(hKeyChild) ;

    // Delete this child.
    return RegDeleteKey(hKeyParent, lpszKeyChild) ;
}

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const _TCHAR * | szFriendlyName
 | ) |  |

Definition at line 67 of file registry.Cpp.

{
    // Get server location.
    _TCHAR szModule[512] ;
    DWORD dwResult =
        ::GetModuleFileName(hModule,
        szModule,
        sizeof(szModule)/sizeof(_TCHAR)) ;

    assert(dwResult != 0) ;

    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    assert(SUCCEEDED(hr)) ;

        MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;
        _tcscat(szKey, pszCLSID) ;

    // Add the CLSID to the registry.
    setKeyAndValue(szKey, NULL, szFriendlyName) ;

    // Add the server filename subkey under the CLSID key.
    setKeyAndValue(szKey, _T("InprocServer32"), szModule) ;

    // set the threading model
    _tcscat(szKey, _T("\\InprocServer32"));
    setValue(szKey, _T("ThreadingModel"), _T("Apartment"));

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const _TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | fSupportExtensions
 | ) |  |

Definition at line 140 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    LPOLESTR wszAboutCLSID = NULL;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    if (IID_NULL != clsidAbout)
        hr = StringFromCLSID(clsidAbout, &wszAboutCLSID);

        MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);
        MAKE_TSTRPTR_FROMWIDE(pszAboutCLSID, wszAboutCLSID);

    // Add the CLSID to the registry.
    setSnapInKeyAndValue(pszCLSID, NULL, _T("NameString"), szNameString) ;
    setSnapInKeyAndValue(pszCLSID, _T("StandAlone"), NULL, NULL);
    if (IID_NULL != clsidAbout)
        setSnapInKeyAndValue(pszCLSID, NULL, _T("About"), pszAboutCLSID);

    if (fSupportExtensions) {
        // Build the key NodeType
        setSnapInKeyAndValue(pszCLSID, _T("NodeTypes"), NULL, NULL);

        _TCHAR szKey[64] ;
        _tcscpy(szKey, pszCLSID) ;
        _tcscat(szKey, _T("\\NodeTypes")) ;
        setSnapInKeyAndValue(szKey, pszCLSID, NULL, NULL);
    }

    // Free memory.
    CoTaskMemFree(wszCLSID) ;
    if (IID_NULL != clsidAbout)
        CoTaskMemFree(wszAboutCLSID);

    return S_OK ;
}

BOOL setKeyAndValue | ( | const _TCHAR * | pszPath,
 |  | const _TCHAR * | szSubkey,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 256 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Copy keyname into buffer.
    _tcscpy(szKeyBuf, szKey) ;

    // Add subkey name to buffer.
    if (szSubkey != NULL)
    {
        _tcscat(szKeyBuf, _T("\\")) ;
        _tcscat(szKeyBuf, szSubkey ) ;
    }

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, NULL, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

BOOL setSnapInKeyAndValue | ( | const _TCHAR * | szKey,
 |  | const _TCHAR * | szSubkey,
 |  | const _TCHAR * | szName,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 337 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\")) ;
    _tcscat(szKeyBuf, szKey) ;

    // Add subkey name to buffer.
    if (szSubkey != NULL)
    {
        _tcscat(szKeyBuf, _T("\\")) ;
        _tcscat(szKeyBuf, szSubkey ) ;
    }

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, szName, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

BOOL setValue | ( | const _TCHAR * | szKey,
 |  | const _TCHAR * | szValueName,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 299 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Copy keyname into buffer.
    _tcscpy(szKeyBuf, szKey) ;

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, szValueName, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

LONG UnregisterServer ( const CLSID & clsid )

Definition at line 112 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

        MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
        _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
               (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 184 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
        MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
               (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Menubtn/registry.h File Reference

  • SysMgmt
  • MMC
  • Menubtn
Functions

registry.h File Reference

#include <tchar.h>

Go to the source code of this file.

Functions

HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const _TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const _TCHAR *szNameString, const CLSID &clsidAbout, const BOOL fSupportExtensions=FALSE)
HRESULT | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Function Documentation

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const _TCHAR * | szFriendlyName
 | ) |  |

Definition at line 67 of file registry.Cpp.

{
    // Get server location.
    _TCHAR szModule[512] ;
    DWORD dwResult =
        ::GetModuleFileName(hModule,
        szModule,
        sizeof(szModule)/sizeof(_TCHAR)) ;

    assert(dwResult != 0) ;

    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    assert(SUCCEEDED(hr)) ;

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;
  _tcscat(szKey, pszCLSID) ;

    // Add the CLSID to the registry.
    setKeyAndValue(szKey, NULL, szFriendlyName) ;

    // Add the server filename subkey under the CLSID key.
    setKeyAndValue(szKey, _T("InprocServer32"), szModule) ;

    // set the threading model
    _tcscat(szKey, _T("\\InprocServer32"));
    setValue(szKey, _T("ThreadingModel"), _T("Apartment"));

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const _TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | fSupportExtensions = FALSE
 | ) |  |

Definition at line 140 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    LPOLESTR wszAboutCLSID = NULL;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    if (IID_NULL != clsidAbout)
        hr = StringFromCLSID(clsidAbout, &wszAboutCLSID);

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszAboutCLSID, wszAboutCLSID);

    // Add the CLSID to the registry.
    setSnapInKeyAndValue(pszCLSID, NULL, _T("NameString"), szNameString) ;
    setSnapInKeyAndValue(pszCLSID, _T("StandAlone"), NULL, NULL);
    if (IID_NULL != clsidAbout)
        setSnapInKeyAndValue(pszCLSID, NULL, _T("About"), pszAboutCLSID);

    if (fSupportExtensions) {
        // Build the key NodeType
        setSnapInKeyAndValue(pszCLSID, _T("NodeTypes"), NULL, NULL);

        _TCHAR szKey[64] ;
        _tcscpy(szKey, pszCLSID) ;
        _tcscat(szKey, _T("\\NodeTypes")) ;
        setSnapInKeyAndValue(szKey, pszCLSID, NULL, NULL);
    }

    // Free memory.
    CoTaskMemFree(wszCLSID) ;
    if (IID_NULL != clsidAbout)
        CoTaskMemFree(wszAboutCLSID);

    return S_OK ;
}

HRESULT UnregisterServer ( const CLSID & clsid )

Definition at line 112 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

  MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
  _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 184 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Generated on Wed Nov 13 2024 16:53:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Menubtn/resource.h File Reference

  • SysMgmt
  • MMC
  • Menubtn
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | ID_COMMAND_PAUSE 40017
#define | ID_COMMAND_START 40016
#define | ID_COMMAND_STOP 40018
#define | IDB_BIKE 40007
#define | IDB_BIKE2 40011
#define | IDB_CAR 40005
#define | IDB_CAR2 40009
#define | IDB_CLOSED 40014
#define | IDB_CLOSED2 40012
#define | IDB_LGBMP 116
#define | IDB_OPEN 40015
#define | IDB_OPEN2 40013
#define | IDB_PLANE 40006
#define | IDB_PLANE2 40010
#define | IDB_ROCKET 40004
#define | IDB_ROCKET2 40008
#define | IDB_SMBMP 115
#define | IDB_SMOPEN 114
#define | IDI_ICON1 108
#define | IDR_LGICONS 121
#define | IDR_MENUBUTTON 111
#define | IDR_SMICONS 120
#define | IDR_STATE_MENU 111
#define | IDS_ABOUTNAME 9
#define | IDS_HELPFILE 1
#define | IDS_NAME 3
#define | IDS_SNAPINDESC 2
#define | IDS_SNAPINNAME 6

Define Documentation

#define ID_COMMAND_PAUSE 40017

Definition at line 31 of file resource.h.

#define ID_COMMAND_START 40016

Definition at line 30 of file resource.h.

#define ID_COMMAND_STOP 40018

Definition at line 32 of file resource.h.

#define IDB_BIKE 40007

Definition at line 21 of file resource.h.

#define IDB_BIKE2 40011

Definition at line 25 of file resource.h.

#define IDB_CAR 40005

Definition at line 19 of file resource.h.

#define IDB_CAR2 40009

Definition at line 23 of file resource.h.

#define IDB_CLOSED 40014

Definition at line 28 of file resource.h.

#define IDB_CLOSED2 40012

Definition at line 26 of file resource.h.

#define IDB_LGBMP 116

Definition at line 15 of file resource.h.

#define IDB_OPEN 40015

Definition at line 29 of file resource.h.

#define IDB_OPEN2 40013

Definition at line 27 of file resource.h.

#define IDB_PLANE 40006

Definition at line 20 of file resource.h.

#define IDB_PLANE2 40010

Definition at line 24 of file resource.h.

#define IDB_ROCKET 40004

Definition at line 18 of file resource.h.

#define IDB_ROCKET2 40008

Definition at line 22 of file resource.h.

#define IDB_SMBMP 115

Definition at line 14 of file resource.h.

#define IDB_SMOPEN 114

Definition at line 13 of file resource.h.

#define IDI_ICON1 108

Definition at line 10 of file resource.h.

#define IDR_LGICONS 121

Definition at line 17 of file resource.h.

#define IDR_MENUBUTTON 111

Definition at line 11 of file resource.h.

#define IDR_SMICONS 120

Definition at line 16 of file resource.h.

#define IDR_STATE_MENU 111

Definition at line 12 of file resource.h.

#define IDS_ABOUTNAME 9

Definition at line 9 of file resource.h.

#define IDS_HELPFILE 1

Definition at line 5 of file resource.h.

#define IDS_NAME 3

Definition at line 7 of file resource.h.

#define IDS_SNAPINDESC 2

Definition at line 6 of file resource.h.

#define IDS_SNAPINNAME 6

Definition at line 8 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Menubtn/sky.Cpp File Reference

  • SysMgmt
  • MMC
  • Menubtn

sky.Cpp File Reference

#include "Sky.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Menubtn/sky.h File Reference

  • SysMgmt
  • MMC
  • Menubtn
Classes

sky.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class CSkyBasedVehicle
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Menubtn/space.Cpp File Reference

  • SysMgmt
  • MMC
  • Menubtn
Defines

space.Cpp File Reference

#include <stdio.h>
#include "Space.h"
#include "Comp.h"
#include <strsafe.h>

Go to the source code of this file.

Defines

#define STRSAFE_NO_DEPRECATE

Define Documentation

#define STRSAFE_NO_DEPRECATE

Definition at line 22 of file space.Cpp.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Menubtn/space.h File Reference

  • SysMgmt
  • MMC
  • Menubtn
Classes

space.h File Reference

#include "DeleBase.h"
#include "CompData.h"

Go to the source code of this file.

Classes

class | CRocket
class | CSpaceVehicle
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Menubtn/statnode.Cpp File Reference

  • SysMgmt
  • MMC
  • Menubtn

statnode.Cpp File Reference

#include "StatNode.h"
#include "People.h"
#include "Sky.h"
#include "Land.h"
#include "Space.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Menubtn/statnode.h File Reference

  • SysMgmt
  • MMC
  • Menubtn
Classes

statnode.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class CStaticNode
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/about/about.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • about
Functions

about.cpp File Reference

#include "Globals.h"
#include "About.h"
#include "Resource.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CSnapinAbout

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 85 of file about.cpp.

{
  if( 0 == InterlockedDecrement((long*)&m_cRef) )
  {
    // we need to decrement our object count in the DLL
    delete this;
    return 0;
  }
  return m_cRef;
}

Generated on Wed Nov 13 2024 16:54:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/about/about.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • about
Classes

about.h File Reference

#include <mmc.h>

Go to the source code of this file.

Classes

class CSnapinAbout
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/about/basenode.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • about
Classes | Defines | Typedefs

basenode.h File Reference

#include "Globals.h"
#include "Resource.h"

Go to the source code of this file.

Classes

class | CBaseNode
struct | tag_BASENODE_PROPERTIES

Defines

#define | DEFAULT_RDI_MASK (RDI_STR | RDI_PARAM | RDI_IMAGE)
#define | DEFAULT_SDI_MASK (SDI_STR | SDI_PARAM | SDI_IMAGE | SDI_OPENIMAGE | SDI_PARENT | SDI_CHILDREN)
#define | MAX_NAME_LEN 64

Typedefs

typedef NODE_PROPERTIES * | LPNODE_PROPERTIES
typedef struct
tag_BASENODE_PROPERTIES 		NODE_PROPERTIES

Define Documentation

#define DEFAULT_RDI_MASK (RDI_STR | RDI_PARAM | RDI_IMAGE)

Definition at line 24 of file basenode.h.

#define DEFAULT_SDI_MASK (SDI_STR | SDI_PARAM | SDI_IMAGE | SDI_OPENIMAGE | SDI_PARENT | SDI_CHILDREN)

Definition at line 23 of file basenode.h.

#define MAX_NAME_LEN 64

Definition at line 26 of file basenode.h.

Typedef Documentation

typedef NODE_PROPERTIES* LPNODE_PROPERTIES

Definition at line 39 of file basenode.h.

typedef struct tag_BASENODE_PROPERTIES NODE_PROPERTIES
Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/about/basesnap.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • about
Defines | Functions

basesnap.cpp File Reference

#include <ObjBase.h>
#include <InitGuid.h>
#include "Globals.h"
#include "Guids.h"
#include "BaseSnap.h"
#include "Comp.h"
#include "CompData.h"
#include "About.h"
#include "Registry.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define | MODULESTRING _T("BaseSnap")

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)
BOOL WINAPI | DllMain (HINSTANCE hInstDLL, DWORD fdwReason, void *lpvReserved)
STDAPI | DllRegisterServer ()
STDAPI | DllUnregisterServer ()
STDMETHODIMP_ (ULONG) CClassFactory

Define Documentation

#define MODULESTRING _T("BaseSnap")

Definition at line 30 of file basesnap.cpp.

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 228 of file basesnap.cpp.

{
  if( 0 == g_uObjectCount && 0 == g_uServerLocks )
    return S_OK;
  else
    return S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 192 of file basesnap.cpp.

{
  // NEW: Must test for CSnapinAbout now
  if( (rclsid != CLSID_CComponentData) && (rclsid != CLSID_CSnapinAbout) )
    return CLASS_E_CLASSNOTAVAILABLE;

  if( !ppvObj )
    return E_FAIL;

  *ppvObj = NULL;

  // We can only hand out IUnknown and IClassFactory pointers.  Fail
  // if caller asks for anything else.
  if( !IsEqualIID(riid, IID_IUnknown) && !IsEqualIID(riid, IID_IClassFactory) )
    return E_NOINTERFACE;

  CClassFactory *pFactory = NULL;

  // NEW:  Create the new class factory.  Pass in the type of object to create
  if( rclsid == CLSID_CComponentData )
    pFactory = new CClassFactory(CClassFactory::COMPONENTDATA);
  else if( rclsid == CLSID_CSnapinAbout )
    pFactory = new CClassFactory(CClassFactory::ABOUT);

  HRESULT hResult = pFactory->QueryInterface( riid, ppvObj );

  return hResult;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstDLL,
 |  | DWORD | fdwReason,
 |  | void * | lpvReserved
 | ) |  |

Definition at line 175 of file basesnap.cpp.

{
  if( DLL_PROCESS_ATTACH == fdwReason )
  {
     g_hInst = hInstDLL;
  }

  return TRUE;
}

STDAPI DllRegisterServer ( void )

Definition at line 238 of file basesnap.cpp.

{
  HRESULT hResult = S_FALSE;

  do
  { // NEW: Support ISnapinAbout
    hResult = RegisterServer( g_hInst, CLSID_CSnapinAbout, gtszABOUT_NAME );
    BREAK_ON_ERROR( hResult );

    hResult = RegisterServer( g_hInst, CLSID_CComponentData, gtszSNAPIN_NAME );
    BREAK_ON_ERROR( hResult );

    hResult = RegisterSnapin( CLSID_CComponentData, gtszSNAPIN_NAME, CLSID_CSnapinAbout, FALSE );
    BREAK_ON_ERROR( hResult );

  }while( 0 );

  return hResult;
}

STDAPI DllUnregisterServer ( void )

Definition at line 260 of file basesnap.cpp.

{
  if( S_OK == UnregisterServer(CLSID_CComponentData) )
    return UnregisterSnapin(CLSID_CComponentData);
  else
    return E_FAIL;
}

STDMETHODIMP_ ( ULONG )

Definition at line 93 of file basesnap.cpp.

{
  if( 0 == InterlockedDecrement( (long*)&m_cRef) )
  {
    delete this;
    return 0;
  }
  return m_cRef;
}

Generated on Wed Nov 13 2024 16:54:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/about/basesnap.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • about
Classes | Functions

basesnap.h File Reference

Go to the source code of this file.

Classes

class | CClassFactory

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 53 of file ComSpyAudit.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 61 of file ComSpyAudit.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

Generated on Wed Nov 13 2024 16:54:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/about/comp.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • about
Defines | Functions

comp.cpp File Reference

#include "Globals.h"
#include "Comp.h"
#include "CompData.h"
#include "DataObj.h"
#include "Resource.h"
#include "StaticNode.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CComponent")

Functions

STDMETHODIMP_ (ULONG) CComponent

Define Documentation

#define MODULESTRING _T("CComponent")

Definition at line 25 of file comp.cpp.

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 88 of file comp.cpp.

{
  if( InterlockedDecrement((LONG*)&m_cRef) == 0 )
  {
    delete this;
    return 0;
  }
  return m_cRef;
}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/about/comp.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • about
Classes

comp.h File Reference

#include "Globals.h"

Go to the source code of this file.

Classes

class CComponent
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/about/compdata.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • about
Defines | Functions

compdata.cpp File Reference

#include "Globals.h"
#include "Comp.h"
#include "CompData.h"
#include "DataObj.h"
#include "Resource.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CComponentData")

Functions

STDMETHODIMP_ (ULONG) CComponentData

Define Documentation

#define MODULESTRING _T("CComponentData")

Definition at line 24 of file compdata.cpp.

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 109 of file compdata.cpp.

{
  if( InterlockedDecrement((LONG*)&m_cRef) == 0 )
  {
    delete this;
    return 0;
  }

  return m_cRef;
}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/about/compdata.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • about
Classes

compdata.h File Reference

#include <ObjIdl.h>
#include "Globals.h"
#include "StaticNode.h"
#include "Comp.h"
#include "StaticNode.h"

Go to the source code of this file.

Classes

class CComponentData
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/about/dataobj.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • about
Functions

dataobj.cpp File Reference

#include "Globals.h"
#include "DataObj.h"
#include "Guids.h"
#include "StaticNode.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CDataObject

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 71 of file dataobj.cpp.

{
    if (InterlockedDecrement((LONG*)&m_cRef) == 0)
    {
        delete this;
        return 0;
    }
    return m_cRef;

}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/about/dataobj.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • about
Classes

dataobj.h File Reference

#include "Globals.h"
#include "StaticNode.h"

Go to the source code of this file.

Classes

class CDataObject
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/about/globals.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • about
Functions | Variables

globals.cpp File Reference

#include "Globals.h"

Go to the source code of this file.

Functions

void | InitClipboardFormats ()
void _fastcall | Unicode2Ansi (CHAR **pszAnsi, WCHAR *szWide)

Variables

UINT | g_cfDisplayName = 0
UINT | g_cfNodeType = 0
UINT | g_cfSnapinClsid = 0
UINT | g_cfszNodeType = 0
HINSTANCE | g_hInst = NULL
ULONG | g_uObjectCount = 0
ULONG | g_uServerLocks = 0

Function Documentation

void InitClipboardFormats ( )

Definition at line 56 of file globals.cpp.

{
  g_cfDisplayName  = RegisterClipboardFormat( T_CCF_DISPLAY_NAME );
  g_cfNodeType     = RegisterClipboardFormat( T_CCF_NODETYPE );
  g_cfszNodeType   = RegisterClipboardFormat( T_CCF_SZNODETYPE );
  g_cfSnapinClsid  = RegisterClipboardFormat( T_CCF_SNAPIN_CLASSID );

}

void _fastcall Unicode2Ansi | ( | CHAR ** | pszAnsi,
 |  | WCHAR * | szWide
 | ) |  |

Definition at line 38 of file globals.cpp.

{
  LONG nLen = wcslen( szWide ) +1;
  *pszAnsi = (char*)CoTaskMemAlloc( nLen );
  char* pCounter = *pszAnsi;

  while( *szWide )
  {
    *pCounter = LOBYTE(*szWide);
    pCounter++;
    szWide++;
  }
  *pCounter = NULL;
}

Variable Documentation

UINT g_cfDisplayName = 0

Definition at line 19 of file globals.cpp.

UINT g_cfNodeType = 0

Definition at line 20 of file globals.cpp.

UINT g_cfSnapinClsid = 0

Definition at line 22 of file globals.cpp.

UINT g_cfszNodeType = 0

Definition at line 21 of file globals.cpp.

HINSTANCE g_hInst = NULL

Definition at line 27 of file globals.cpp.

ULONG g_uObjectCount = 0

Definition at line 28 of file globals.cpp.

ULONG g_uServerLocks = 0

Definition at line 29 of file globals.cpp.

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/about/globals.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • about
Defines | Functions | Variables

globals.h File Reference

#include <Tchar.h>
#include <Mmc.h>
#include <CrtDbg.h>

Go to the source code of this file.

Defines

#define | BREAK_ON_ERROR(hResult) if( S_OK != hResult ) continue
#define | BYTE_SIZE(string) ((_tcslen(string)+1) * sizeof(TCHAR))
#define | MsgBox(wszMsg, wszTitle) ::MessageBox(NULL, wszMsg, wszTitle, MB_OK)
#define | NODETYPE_STATIC 100;
#define | T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")
#define | T_CCF_NODETYPE _T("CCF_NODETYPE")
#define | T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")
#define | T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")
#define | W2T(pszAnsi, szWide) Unicode2Ansi( pszAnsi, szWide )

Functions

void | InitClipboardFormats ()
template<class TYPE >
void | SAFE_FREE_BITMAP (TYPE *&pObj)
template<class TYPE >
void | SAFE_FREE_ICON (TYPE *&pObj)
template<class TYPE >
void | SAFE_RELEASE (TYPE *&pObj)
void _fastcall | Unicode2Ansi (CHAR **pszAnsi, WCHAR *szWide)

Variables

UINT g_cfDisplayName
UINT g_cfNodeType
UINT g_cfSnapinClsid
UINT g_cfszNodeType
HINSTANCE | g_hInst
ULONG g_uObjectCount
ULONG g_uServerLocks

Define Documentation

#define BREAK_ON_ERROR ( hResult ) if( S_OK != hResult ) continue

Definition at line 74 of file globals.h.

#define BYTE_SIZE ( string ) ((_tcslen(string)+1) * sizeof(TCHAR))

Definition at line 72 of file globals.h.

#define MsgBox | ( | wszMsg,
 |  | wszTitle |
 | ) |  | ::MessageBox(NULL, wszMsg, wszTitle, MB_OK)

Definition at line 77 of file globals.h.

#define NODETYPE_STATIC 100;

Definition at line 66 of file globals.h.

#define T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")

Definition at line 57 of file globals.h.

#define T_CCF_NODETYPE _T("CCF_NODETYPE")

Definition at line 58 of file globals.h.

#define T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")

Definition at line 60 of file globals.h.

#define T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")

Definition at line 59 of file globals.h.

#define W2T | ( | pszAnsi,
 |  | szWide |
 | ) |  | Unicode2Ansi( pszAnsi, szWide )

Definition at line 132 of file globals.h.

Function Documentation

void InitClipboardFormats ( )

Definition at line 56 of file globals.cpp.

{
  g_cfDisplayName  = RegisterClipboardFormat( T_CCF_DISPLAY_NAME );
  g_cfNodeType     = RegisterClipboardFormat( T_CCF_NODETYPE );
  g_cfszNodeType   = RegisterClipboardFormat( T_CCF_SZNODETYPE );
  g_cfSnapinClsid  = RegisterClipboardFormat( T_CCF_SNAPIN_CLASSID );

}

template<class TYPE >
void SAFE_FREE_BITMAP ( TYPE *& pObj ) [inline]

Definition at line 97 of file globals.h.

{
  if( NULL != pObj )
  {
    BOOL bStatus = DeleteObject( pObj );
    pObj = NULL;
  }
  else
  {
    OutputDebugString(_T("Attempted to delete NULL Bitmap handle.\n"));
  }
}

template<class TYPE >
void SAFE_FREE_ICON ( TYPE *& pObj ) [inline]

Definition at line 112 of file globals.h.

{
  if( NULL != pObj )
  {
    BOOL bStatus = DestroyIcon( pObj );
    pObj = NULL;
  }
  else
  {
    OutputDebugString(_T("Attempted to delete NULL Icon handle.\n"));
  }
}

template<class TYPE >
void SAFE_RELEASE ( TYPE *& pObj ) [inline]

Definition at line 82 of file globals.h.

{
  if( NULL != pObj )
  {
    pObj->Release();
    pObj = NULL;
  }
  else
  {
    OutputDebugString(_T("Attempted to release NULL Com pointer.\n"));
  }
}

void _fastcall Unicode2Ansi | ( | CHAR ** | pszAnsi,
 |  | WCHAR * | szWide
 | ) |  |

Definition at line 38 of file globals.cpp.

{
  LONG nLen = wcslen( szWide ) +1;
  *pszAnsi = (char*)CoTaskMemAlloc( nLen );
  char* pCounter = *pszAnsi;

  while( *szWide )
  {
    *pCounter = LOBYTE(*szWide);
    pCounter++;
    szWide++;
  }
  *pCounter = NULL;
}

Variable Documentation

UINT g_cfDisplayName

Definition at line 19 of file globals.cpp.

UINT g_cfNodeType

Definition at line 20 of file globals.cpp.

UINT g_cfSnapinClsid

Definition at line 22 of file globals.cpp.

UINT g_cfszNodeType

Definition at line 21 of file globals.cpp.

HINSTANCE g_hInst

Definition at line 62 of file DoServer.Cpp.

ULONG g_uObjectCount

Definition at line 28 of file globals.cpp.

ULONG g_uServerLocks

Definition at line 29 of file globals.cpp.

Generated on Wed Nov 13 2024 16:54:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/about/guids.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • about
Functions

guids.h File Reference

Go to the source code of this file.

Functions

DEFINE_GUID (CLSID_CComponentData, 0xa04e8e71, 0x2d76, 0x4967, 0x90, 0x1f, 0x2c, 0xcf, 0xb5, 0xf9, 0x1e, 0x21)
DEFINE_GUID (CLSID_CSnapinAbout, 0xa04e8e73, 0x2d76, 0x4967, 0x90, 0x1f, 0x2c, 0xcf, 0xb5, 0xf9, 0x1e, 0x21)

Function Documentation

DEFINE_GUID | ( | CLSID_CComponentData | ,
 |  | 0xa04e8e71 | ,
 |  | 0x2d76 | ,
 |  | 0x4967 | ,
 |  | 0x90 | ,
 |  | 0x1f | ,
 |  | 0x2c | ,
 |  | 0xcf | ,
 |  | 0xb5 | ,
 |  | 0xf9 | ,
 |  | 0x1e | ,
 |  | 0x21 |
 | ) |  |
DEFINE_GUID | ( | CLSID_CSnapinAbout | ,
 |  | 0xa04e8e73 | ,
 |  | 0x2d76 | ,
 |  | 0x4967 | ,
 |  | 0x90 | ,
 |  | 0x1f | ,
 |  | 0x2c | ,
 |  | 0xcf | ,
 |  | 0xb5 | ,
 |  | 0xf9 | ,
 |  | 0x1e | ,
 |  | 0x21 |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/about/registry.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • about
Defines | Functions

registry.cpp File Reference

#include <ObjBase.h>
#include "Registry.h"
#include "Globals.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define | MODULESTRING _T("Registry")

Functions

HRESULT | RecursiveDeleteKey (HKEY hKeyParent, const TCHAR *szKeyChild)
HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const TCHAR *szNameString, const CLSID &clsidAbout, const BOOL bSupportExtensions)
HRESULT | SetKeyAndValue (const TCHAR *pszPath, const TCHAR *szSubkey, const TCHAR *szValue)
HRESULT | SetSnapInKeyAndValue (const TCHAR *szKey, const TCHAR *szSubkey, const TCHAR *szName, const TCHAR *szValue)
HRESULT | SetValue (const TCHAR *szKey, const TCHAR *szValueName, const TCHAR *szValue)
LONG | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Define Documentation

#define MODULESTRING _T("Registry")

Definition at line 22 of file registry.cpp.

Function Documentation

HRESULT RecursiveDeleteKey | ( | HKEY | hKeyParent,
 |  | const TCHAR * | szKeyChild
 | ) |  |

Definition at line 262 of file registry.cpp.

{
  // Open the child.
  HKEY hKeyChild = NULL;
  LONG lResult   = ERROR_SUCCESS;

  do                     // We go to all this trouble to prevent any
  {                      // possibility of exiting while leaving a key open

    lResult = RegOpenKeyEx( hKeyParent,
                            lpszKeyChild,
                            0,
                            KEY_ALL_ACCESS,
                            &hKeyChild
                          );
    if( ERROR_SUCCESS != lResult )
      continue;

    // Enumerate all of the decendents of this child.
    FILETIME time;
    _TCHAR szBuffer[256];
    DWORD dwSize = 256;
    while( S_OK == RegEnumKeyEx(hKeyChild,0,szBuffer,&dwSize,NULL,NULL,NULL,&time) )
    {
      // Delete the decendents of this child.
      lResult = RecursiveDeleteKey( hKeyChild, szBuffer );
      if( ERROR_SUCCESS != lResult )
      {
        continue;
      }
      dwSize = 256;
    }
  }while( 0 );

  RegCloseKey( hKeyChild );            // Always try to close the child
                                       // then delete this child.
  return RegDeleteKey( hKeyParent, lpszKeyChild );
}

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const TCHAR * | szFriendlyName
 | ) |  |

Definition at line 51 of file registry.cpp.

{
  // Get server location.
  TCHAR    szModule[512] ;
  TCHAR*   pszCLSID = NULL;
  WCHAR*   wszCLSID = NULL ;
  HRESULT  hResult  = S_FALSE;

  DWORD dwResult = ::GetModuleFileName( hModule,
                                        szModule,
                                        sizeof(szModule)/sizeof(TCHAR)
                                      );
  if( 0 == dwResult ) return HRESULT_FROM_WIN32( dwResult );

  do                         // Fail unless we complete everything
  {
    // Get CLSID string in wide char
    hResult = StringFromCLSID( clsid, &wszCLSID ) ;
    if( S_OK != hResult )
    {
      CoTaskMemFree( wszCLSID );
      BREAK_ON_ERROR( hResult );
    }

    W2T( &pszCLSID, wszCLSID );          // W2T is defined in Globals.h
    CoTaskMemFree( wszCLSID );           // Through with wide version

    TCHAR szKey[64];                     // Build the CLSID key string CLSID\\{...}
    _tcscpy( szKey, _T("CLSID\\") );
    _tcscat( szKey, pszCLSID );

    // Add the CLSID to the registry.
    hResult = SetKeyAndValue( szKey, NULL, szFriendlyName );
    BREAK_ON_ERROR( hResult );

    // Add the server filename subkey under the CLSID key.
    hResult = SetKeyAndValue( szKey, _T("InprocServer32"), szModule );
    BREAK_ON_ERROR( hResult );

    // Set the threading model
    _tcscat( szKey, _T("\\InprocServer32") );
    hResult = SetValue( szKey, _T("ThreadingModel"), _T("Apartment") );
    BREAK_ON_ERROR( hResult );

  }while( 0 );

  CoTaskMemFree( pszCLSID );           // Through with TCHAR version

  return hResult;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | bSupportExtensions
 | ) |  |

Definition at line 149 of file registry.cpp.

{
  HRESULT hResult = S_FALSE;
  TCHAR*  pszSnapCLSID = NULL;         // Needed for TCHAR version of the ClassID

  // If any part of this process fails, jump out of the loop and return
  // the error code
  do
  {
    // Allocate the CLSID string
    LPOLESTR wszSnapCLSID  = NULL ;
    hResult = StringFromCLSID( clsid, &wszSnapCLSID ) ;
    if( S_OK != hResult )
    {
       CoTaskMemFree( wszSnapCLSID );
       continue;
    }

    W2T( &pszSnapCLSID, wszSnapCLSID );  // W2T is defined in Globals.h
    CoTaskMemFree( wszSnapCLSID );       // Through with wide version

    // Add the Snap-in's CLSID to the registry
    hResult = SetSnapInKeyAndValue( pszSnapCLSID, NULL, _T("NameString"), szNameString );
    BREAK_ON_ERROR( hResult );

    hResult = SetSnapInKeyAndValue( pszSnapCLSID, _T("StandAlone"), NULL, NULL );
    BREAK_ON_ERROR( hResult );

    // Add registry information for ISnapinAbout if we support it
    LPOLESTR wszAboutCLSID = NULL;
    TCHAR*   pszAboutCLSID = NULL;
    if( IID_NULL != clsidAbout )
    {
      hResult = StringFromCLSID( clsidAbout, &wszAboutCLSID );
      if( S_OK != hResult )
      {
        CoTaskMemFree( wszAboutCLSID ); // Free this memory before exiting
        continue;
      }

      W2T( &pszAboutCLSID, wszAboutCLSID );
      hResult = SetSnapInKeyAndValue( pszSnapCLSID, NULL, _T("About"), pszAboutCLSID );
      CoTaskMemFree( wszAboutCLSID );
      CoTaskMemFree( pszAboutCLSID );
      BREAK_ON_ERROR( hResult );
    }

    if( TRUE == bSupportExtensions )     // Build the NodeTypesKey
    {
      hResult = SetSnapInKeyAndValue( pszSnapCLSID, _T("NodeTypes"), NULL, NULL );
      BREAK_ON_ERROR( hResult );
      TCHAR szKey[64];
      _tcscpy( szKey, pszSnapCLSID );
      _tcscat(szKey, _T("\\NodeTypes"));
      hResult = SetSnapInKeyAndValue( szKey, pszSnapCLSID, NULL, NULL );
      BREAK_ON_ERROR( hResult );
    }
  }while( 0 );

  CoTaskMemFree( pszSnapCLSID);
  return hResult;
}

HRESULT SetKeyAndValue | ( | const TCHAR * | pszPath,
 |  | const TCHAR * | szSubkey,
 |  | const TCHAR * | szValue
 | ) |  |

Definition at line 310 of file registry.cpp.

{
  HKEY hKey = NULL;
  HRESULT hResult = S_FALSE;
  TCHAR szKeyBuf[1024];

  // Copy keyname into buffer.
  _tcscpy( szKeyBuf, szKey );

  // Add subkey name to buffer.
  if( NULL != szSubkey )
  {
    _tcscat( szKeyBuf, _T("\\") );
    _tcscat( szKeyBuf, szSubkey );
  }

  do                     // We go to all this trouble to prevent any
  {                      // possibility of exiting while leaving a key open

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx( HKEY_CLASSES_ROOT,
                                   szKeyBuf,
                                   0,
                                   NULL,
                                   REG_OPTION_NON_VOLATILE,
                                   KEY_ALL_ACCESS,
                                   NULL,
                                   &hKey,
                                   NULL
                                 );
    if( ERROR_SUCCESS != lResult )
    {
      hResult = HRESULT_FROM_WIN32( lResult );
      continue;
    }

    if( NULL != szValue )    // Now set the value
    {
      hResult = RegSetValueEx( hKey,
                               NULL,
                               0,
                               REG_SZ,
                               (BYTE*)szValue,
                               BYTE_SIZE( szValue )    // BYTE_SIZE is in Globals.h
                             );
      BREAK_ON_ERROR( hResult );
    }
  }while( 0 );

  RegCloseKey( hKey );       // Always try to close the key
  return hResult;
}

HRESULT SetSnapInKeyAndValue | ( | const TCHAR * | szKey,
 |  | const TCHAR * | szSubkey,
 |  | const TCHAR * | szName,
 |  | const TCHAR * | szValue
 | ) |  |

Definition at line 429 of file registry.cpp.

{
  HKEY    hKey = NULL;
  HRESULT hResult = S_FALSE;
  TCHAR   szKeyBuf[1024];

  // Load the buffer with the Snap-In Location
  _tcscpy( szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns") );

  _tcscat( szKeyBuf, _T("\\") );       // Copy keyname into buffer.
  _tcscat( szKeyBuf, szKey );

  if( NULL != szSubkey )               // Add subkey name to buffer.
  {
    _tcscat( szKeyBuf, _T("\\") );
    _tcscat( szKeyBuf, szSubkey );
  }

  do                     // We go to all this trouble to prevent any
  {                      // possibility of exiting while leaving a key open

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx( HKEY_LOCAL_MACHINE,
                                   szKeyBuf,
                                   0,
                                   NULL,
                                   REG_OPTION_NON_VOLATILE,
                                   KEY_ALL_ACCESS,
                                   NULL,
                                   &hKey,
                                   NULL
                                 );
    if( ERROR_SUCCESS != lResult )     // Will return S_FALSE
      continue;

    // Set the Value.
    if( szValue != NULL )
    {
      hResult = RegSetValueEx( hKey,
                               szName,
                               0,
                               REG_SZ,
                               (BYTE*)szValue,
                               BYTE_SIZE(szValue)
                             );
      BREAK_ON_ERROR( hResult );
    }
    else
    {                        // Got this far so everything is OK.
      hResult = S_OK;
    }
  }while( 0 );

  RegCloseKey( hKey );       //Always attempt to close the key
  return hResult;
}

HRESULT SetValue | ( | const TCHAR * | szKey,
 |  | const TCHAR * | szValueName,
 |  | const TCHAR * | szValue
 | ) |  |

Definition at line 372 of file registry.cpp.

{
  HKEY    hKey = NULL;
  HRESULT hResult = S_FALSE;
  TCHAR szKeyBuf[1024];

  // Copy keyname into buffer.
  _tcscpy( szKeyBuf, szKey );

  do                     // We go to all this trouble to prevent any
  {                      // possibility of exiting while leaving a key open

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx( HKEY_CLASSES_ROOT ,
                                   szKeyBuf,
                                   0,
                                   NULL,
                                   REG_OPTION_NON_VOLATILE,
                                   KEY_ALL_ACCESS,
                                   NULL,
                                   &hKey,
                                   NULL
                                 );
    if( ERROR_SUCCESS != lResult )
    {
      hResult = HRESULT_FROM_WIN32( lResult );
      continue;
    }

    if( NULL != szValue )    // Now set the value
    {
      hResult = RegSetValueEx( hKey,
                               szValueName,
                               0,
                               REG_SZ,
                               (BYTE*)szValue,
                               BYTE_SIZE( szValue )
                             );
      BREAK_ON_ERROR( hResult );
    }
  }while( 0 );

  RegCloseKey( hKey );       //Always attempt to close the key
  return hResult;
}

LONG UnregisterServer ( const CLSID & clsid )

Definition at line 111 of file registry.cpp.

{
  HRESULT hResult = S_OK;

  // Allocate the CLSID string
  LPOLESTR wszCLSID = NULL ;
  hResult = StringFromCLSID( clsid, &wszCLSID );
  if( S_OK != hResult )
  {
    CoTaskMemFree( wszCLSID );
    return hResult;
  }

  // Build the key CLSID\\{...}
  TCHAR szKey[64];
  _tcscpy( szKey, _T("CLSID\\") );

  TCHAR* pszCLSID = NULL;
  W2T( &pszCLSID, wszCLSID );          // W2T is defined in Globals.h
  CoTaskMemFree( wszCLSID );           // Through with wide version

  _tcscat( szKey, pszCLSID );
  CoTaskMemFree( pszCLSID );           // Through with TCHAR version

  // Delete the CLSID Key - CLSID\{...}
  LONG lResult = RecursiveDeleteKey( HKEY_CLASSES_ROOT, szKey );
  if( ERROR_SUCCESS != lResult )
    hResult = HRESULT_FROM_WIN32( lResult );

  return hResult;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 222 of file registry.cpp.

{
  HRESULT hResult = S_OK;

  TCHAR    szKeyBuf[1024];
  LPOLESTR wszCLSID = NULL;
  TCHAR*   pszCLSID = NULL;        // Needed for TCHAR version of the ClassID

  // Get CLSID as a wide string
  hResult = StringFromCLSID( clsid, &wszCLSID );
  if( S_OK != hResult )
  {
    CoTaskMemFree( wszCLSID );
    return hResult;
  }

  W2T( &pszCLSID, wszCLSID );          // W2T is defined in Globals.h
  CoTaskMemFree( wszCLSID );           // Through with wide version

  // Load the buffer with the Snap-In Location
  _tcscpy( szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns") );

  _tcscat( szKeyBuf, _T("\\") );       // Copy keyname into buffer.
  _tcscat( szKeyBuf, pszCLSID );

  // Delete the CLSID Key - CLSID\{...}
  LONG lResult = RecursiveDeleteKey( HKEY_LOCAL_MACHINE, szKeyBuf );
  if( ERROR_SUCCESS != lResult )
    hResult = HRESULT_FROM_WIN32( lResult );

  CoTaskMemFree( pszCLSID );
  return hResult;
}

Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/about/registry.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • about
Functions

registry.h File Reference

#include <tchar.h>

Go to the source code of this file.

Functions

HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const TCHAR *szNameString, const CLSID &clsidAbout, const BOOL fSupportExtensions=FALSE)
HRESULT | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Function Documentation

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const TCHAR * | szFriendlyName
 | ) |  |

Definition at line 51 of file registry.cpp.

{
  // Get server location.
  TCHAR    szModule[512] ;
  TCHAR*   pszCLSID = NULL;
  WCHAR*   wszCLSID = NULL ;
  HRESULT  hResult  = S_FALSE;

  DWORD dwResult = ::GetModuleFileName( hModule,
                                        szModule,
                                        sizeof(szModule)/sizeof(TCHAR)
                                      );
  if( 0 == dwResult ) return HRESULT_FROM_WIN32( dwResult );

  do                         // Fail unless we complete everything
  {
    // Get CLSID string in wide char
    hResult = StringFromCLSID( clsid, &wszCLSID ) ;
    if( S_OK != hResult )
    {
      CoTaskMemFree( wszCLSID );
      BREAK_ON_ERROR( hResult );
    }

    W2T( &pszCLSID, wszCLSID );          // W2T is defined in Globals.h
    CoTaskMemFree( wszCLSID );           // Through with wide version

    TCHAR szKey[64];                     // Build the CLSID key string CLSID\\{...}
    _tcscpy( szKey, _T("CLSID\\") );
    _tcscat( szKey, pszCLSID );

    // Add the CLSID to the registry.
    hResult = SetKeyAndValue( szKey, NULL, szFriendlyName );
    BREAK_ON_ERROR( hResult );

    // Add the server filename subkey under the CLSID key.
    hResult = SetKeyAndValue( szKey, _T("InprocServer32"), szModule );
    BREAK_ON_ERROR( hResult );

    // Set the threading model
    _tcscat( szKey, _T("\\InprocServer32") );
    hResult = SetValue( szKey, _T("ThreadingModel"), _T("Apartment") );
    BREAK_ON_ERROR( hResult );

  }while( 0 );

  CoTaskMemFree( pszCLSID );           // Through with TCHAR version

  return hResult;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | fSupportExtensions = FALSE
 | ) |  |

Definition at line 149 of file registry.cpp.

{
  HRESULT hResult = S_FALSE;
  TCHAR*  pszSnapCLSID = NULL;         // Needed for TCHAR version of the ClassID

  // If any part of this process fails, jump out of the loop and return
  // the error code
  do
  {
    // Allocate the CLSID string
    LPOLESTR wszSnapCLSID  = NULL ;
    hResult = StringFromCLSID( clsid, &wszSnapCLSID ) ;
    if( S_OK != hResult )
    {
       CoTaskMemFree( wszSnapCLSID );
       continue;
    }

    W2T( &pszSnapCLSID, wszSnapCLSID );  // W2T is defined in Globals.h
    CoTaskMemFree( wszSnapCLSID );       // Through with wide version

    // Add the Snap-in's CLSID to the registry
    hResult = SetSnapInKeyAndValue( pszSnapCLSID, NULL, _T("NameString"), szNameString );
    BREAK_ON_ERROR( hResult );

    hResult = SetSnapInKeyAndValue( pszSnapCLSID, _T("StandAlone"), NULL, NULL );
    BREAK_ON_ERROR( hResult );

    // Add registry information for ISnapinAbout if we support it
    LPOLESTR wszAboutCLSID = NULL;
    TCHAR*   pszAboutCLSID = NULL;
    if( IID_NULL != clsidAbout )
    {
      hResult = StringFromCLSID( clsidAbout, &wszAboutCLSID );
      if( S_OK != hResult )
      {
        CoTaskMemFree( wszAboutCLSID ); // Free this memory before exiting
        continue;
      }

      W2T( &pszAboutCLSID, wszAboutCLSID );
      hResult = SetSnapInKeyAndValue( pszSnapCLSID, NULL, _T("About"), pszAboutCLSID );
      CoTaskMemFree( wszAboutCLSID );
      CoTaskMemFree( pszAboutCLSID );
      BREAK_ON_ERROR( hResult );
    }

    if( TRUE == bSupportExtensions )     // Build the NodeTypesKey
    {
      hResult = SetSnapInKeyAndValue( pszSnapCLSID, _T("NodeTypes"), NULL, NULL );
      BREAK_ON_ERROR( hResult );
      TCHAR szKey[64];
      _tcscpy( szKey, pszSnapCLSID );
      _tcscat(szKey, _T("\\NodeTypes"));
      hResult = SetSnapInKeyAndValue( szKey, pszSnapCLSID, NULL, NULL );
      BREAK_ON_ERROR( hResult );
    }
  }while( 0 );

  CoTaskMemFree( pszSnapCLSID);
  return hResult;
}

HRESULT UnregisterServer ( const CLSID & clsid )

Definition at line 112 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

  MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
  _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 184 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Generated on Wed Nov 13 2024 16:53:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/about/resource.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • about
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDB_APPIMG_16 113
#define | IDB_APPIMG_32 112
#define | IDB_BIKE 40007
#define | IDB_BIKE2 40011
#define | IDB_CAR 40005
#define | IDB_CAR2 40009
#define | IDB_CLOSED 40014
#define | IDB_CLOSED2 40012
#define | IDB_LGBMP 112
#define | IDB_OPEN 40015
#define | IDB_OPEN2 40013
#define | IDB_PLANE 40006
#define | IDB_PLANE2 40010
#define | IDB_ROCKET 40004
#define | IDB_ROCKET2 40008
#define | IDB_SMBMP 113
#define | IDB_SMOPEN 114
#define | IDI_APP_ICON 108
#define | IDI_ICON1 108
#define | IDR_LGICONS 121
#define | IDR_SMICONS 120
#define | IDS_ABOUTNAME 9
#define | IDS_HELPFILE 1
#define | IDS_NAME 3
#define | IDS_SNAPINDESC 2
#define | IDS_SNAPINNAME 6

Define Documentation

#define IDB_APPIMG_16 113

Definition at line 15 of file resource.h.

#define IDB_APPIMG_32 112

Definition at line 13 of file resource.h.

#define IDB_BIKE 40007

Definition at line 22 of file resource.h.

#define IDB_BIKE2 40011

Definition at line 26 of file resource.h.

#define IDB_CAR 40005

Definition at line 20 of file resource.h.

#define IDB_CAR2 40009

Definition at line 24 of file resource.h.

#define IDB_CLOSED 40014

Definition at line 29 of file resource.h.

#define IDB_CLOSED2 40012

Definition at line 27 of file resource.h.

#define IDB_LGBMP 112

Definition at line 12 of file resource.h.

#define IDB_OPEN 40015

Definition at line 30 of file resource.h.

#define IDB_OPEN2 40013

Definition at line 28 of file resource.h.

#define IDB_PLANE 40006

Definition at line 21 of file resource.h.

#define IDB_PLANE2 40010

Definition at line 25 of file resource.h.

#define IDB_ROCKET 40004

Definition at line 19 of file resource.h.

#define IDB_ROCKET2 40008

Definition at line 23 of file resource.h.

#define IDB_SMBMP 113

Definition at line 14 of file resource.h.

#define IDB_SMOPEN 114

Definition at line 16 of file resource.h.

#define IDI_APP_ICON 108

Definition at line 11 of file resource.h.

#define IDI_ICON1 108

Definition at line 10 of file resource.h.

#define IDR_LGICONS 121

Definition at line 18 of file resource.h.

#define IDR_SMICONS 120

Definition at line 17 of file resource.h.

#define IDS_ABOUTNAME 9

Definition at line 9 of file resource.h.

#define IDS_HELPFILE 1

Definition at line 5 of file resource.h.

#define IDS_NAME 3

Definition at line 7 of file resource.h.

#define IDS_SNAPINDESC 2

Definition at line 6 of file resource.h.

#define IDS_SNAPINNAME 6

Definition at line 8 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/about/staticnode.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • about

staticnode.cpp File Reference

#include "StaticNode.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/about/staticnode.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • about
Classes

staticnode.h File Reference

#include "Globals.h"
#include "BaseNode.h"
#include "BaseNode.h"

Go to the source code of this file.

Classes

class CStaticNode
Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/about/tracemacro.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • about
Functions

tracemacro.cpp File Reference

#include "Globals.h"
#include "TraceMacro.h"
#include <StdIo.h>

Go to the source code of this file.

Functions

VOID | MapEvent (LONG Event, LPTSTR szEventStr)
VOID | Trace_Event (LPCTSTR pszClass, LPCTSTR pszFunction, LONG nEvent)
VOID | Trace_HR (LPCTSTR pszClass, LPCTSTR pszFunction, HRESULT hr)
VOID | Trace_Start (LPCTSTR pszClass, LPCTSTR pszFunction)
VOID | Trace_Value (LPCTSTR pszClass, LPCTSTR pszFunction, LPCTSTR pszValueName, LONG nValue)

Function Documentation

VOID MapEvent | ( | LONG | Event,
 |  | LPTSTR | szEventStr
 | ) |  |

Definition at line 146 of file tracemacro.cpp.

{
#ifdef _DEBUG

  switch( Event )
  {
    case 0x8001:
      _tcscpy( szEventStr, _T("MMCN_ACTIVATE       ") );
      break;

    case 0x8002:
      _tcscpy( szEventStr, _T("MMCN_ADD_IMAGES     ") );
      break;

    case 0x8003:
      _tcscpy( szEventStr, _T("MMCN_BTN_CLICK      ") );
      break;

    case 0x8004:
      _tcscpy( szEventStr, _T("MMCN_CLICK          ") );
      break;

    case 0x8005:
      _tcscpy( szEventStr, _T("MMCN_COLUMN_CLICK   ") );
      break;

    case 0x8006:
      _tcscpy( szEventStr, _T("MMCN_CONTEXTMENU    ") );
      break;

    case 0x8007:
      _tcscpy( szEventStr, _T("MMCN_CUTORMOVE      ") );
      break;

    case 0x8008:
      _tcscpy( szEventStr, _T("MMCN_DBLCLICK       ") );
      break;

    case 0x8009:
      _tcscpy( szEventStr, _T("MMCN_DELETE         ") );
      break;

    case 0x800A:
      _tcscpy( szEventStr, _T("MMCN_DESELECT_ALL   ") );
      break;

    case 0x800B:
      _tcscpy( szEventStr, _T("MMCN_EXPAND         ") );
      break;

    case 0x800C:
      _tcscpy( szEventStr, _T("MMCN_HELP           ") );
      break;

    case 0x800D:
      _tcscpy( szEventStr, _T("MMCN_MENU_BTNCLICK  ") );
      break;

    case 0x800E:
      _tcscpy( szEventStr, _T("MMCN_MINIMIZED      ") );
      break;

    case 0x800F:
      _tcscpy( szEventStr, _T("MMCN_PASTE          ") );
      break;

    case 0x8010:
      _tcscpy( szEventStr, _T("MMCN_PROPERTY_CHANGE") );
      break;

    case 0x8011:
      _tcscpy( szEventStr, _T("MMCN_QUERY_PASTE    ") );
      break;

    case 0x8012:
      _tcscpy( szEventStr, _T("MMCN_REFRESH        ") );
      break;

    case 0x8013:
      _tcscpy( szEventStr, _T("MMCN_REMOVE_CHILDREN") );
      break;

    case 0x8014:
      _tcscpy( szEventStr, _T("MMCN_RENAME         ") );
      break;

    case 0x8015:
      _tcscpy( szEventStr, _T("MMCN_SELECT         ") );
      break;

    case 0x8016:
      _tcscpy( szEventStr, _T("MMCN_SHOW           ") );
      break;

    case 0x8017:
      _tcscpy( szEventStr, _T("MMCN_VIEW_CHANGE    ") );
      break;

    case 0x8018:
      _tcscpy( szEventStr, _T("MMCN_SNAPINHELP     ") );
      break;

    case 0x8019:
      _tcscpy( szEventStr, _T("MMCN_CONTEXTHELP    ") );
      break;

    case 0x801A:
      _tcscpy( szEventStr, _T("MMCN_INITOCX        ") );
      break;

    case 0x8021:
      _tcscpy( szEventStr, _T("MMCN_EXPANDSYNC     ") );
      break;

    default:
      _stprintf( szEventStr, _T("0x%X"), Event );
      break;
  }

#endif
} //end MapEvent()

VOID Trace_Event | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LONG | nEvent
 | ) |  |

Definition at line 86 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szEventStr[22];
  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Event = %s\n");
  INT    nChars     = 0;

  MapEvent( nEvent, szEventStr );

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      szEventStr
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Event()

VOID Trace_HR | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | HRESULT | hr
 | ) |  |

Definition at line 27 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Returned 0x%X\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer, szFormat, pszClass, pszFunction, hr );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_HR()

VOID Trace_Start | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction
 | ) |  |

Definition at line 118 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Started \n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Start()

VOID Trace_Value | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LPCTSTR | pszValueName,
 |  | LONG | nValue
 | ) |  |

Definition at line 53 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> %s = %u\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      pszValueName,
                      nValue
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Value()

Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/about/tracemacro.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • about
Defines | Functions

tracemacro.h File Reference

Go to the source code of this file.

Defines

#define | TRACE_EVENT
#define | TRACE_HRESULT
#define | TRACE_START
#define | TRACE_VAL

Functions

VOID | MapEvent (LONG Event, LPTSTR szEventStr)
VOID | Trace_Event (LPCTSTR pszClass, LPCTSTR pszFunction, LONG nEvent)
VOID | Trace_HR (LPCTSTR pszClass, LPCTSTR pszFunction, HRESULT hr)
VOID | Trace_Start (LPCTSTR pszClass, LPCTSTR pszFunction)
VOID | Trace_Value (LPCTSTR pszClass, LPCTSTR pszFunction, LPCTSTR pszValueName, LONG Value)

Define Documentation

#define TRACE_EVENT

Definition at line 57 of file tracemacro.h.

#define TRACE_HRESULT

Definition at line 51 of file tracemacro.h.

#define TRACE_START

Definition at line 60 of file tracemacro.h.

#define TRACE_VAL

Definition at line 54 of file tracemacro.h.

Function Documentation

VOID MapEvent | ( | LONG | Event,
 |  | LPTSTR | szEventStr
 | ) |  |

Definition at line 146 of file tracemacro.cpp.

{
#ifdef _DEBUG

  switch( Event )
  {
    case 0x8001:
      _tcscpy( szEventStr, _T("MMCN_ACTIVATE       ") );
      break;

    case 0x8002:
      _tcscpy( szEventStr, _T("MMCN_ADD_IMAGES     ") );
      break;

    case 0x8003:
      _tcscpy( szEventStr, _T("MMCN_BTN_CLICK      ") );
      break;

    case 0x8004:
      _tcscpy( szEventStr, _T("MMCN_CLICK          ") );
      break;

    case 0x8005:
      _tcscpy( szEventStr, _T("MMCN_COLUMN_CLICK   ") );
      break;

    case 0x8006:
      _tcscpy( szEventStr, _T("MMCN_CONTEXTMENU    ") );
      break;

    case 0x8007:
      _tcscpy( szEventStr, _T("MMCN_CUTORMOVE      ") );
      break;

    case 0x8008:
      _tcscpy( szEventStr, _T("MMCN_DBLCLICK       ") );
      break;

    case 0x8009:
      _tcscpy( szEventStr, _T("MMCN_DELETE         ") );
      break;

    case 0x800A:
      _tcscpy( szEventStr, _T("MMCN_DESELECT_ALL   ") );
      break;

    case 0x800B:
      _tcscpy( szEventStr, _T("MMCN_EXPAND         ") );
      break;

    case 0x800C:
      _tcscpy( szEventStr, _T("MMCN_HELP           ") );
      break;

    case 0x800D:
      _tcscpy( szEventStr, _T("MMCN_MENU_BTNCLICK  ") );
      break;

    case 0x800E:
      _tcscpy( szEventStr, _T("MMCN_MINIMIZED      ") );
      break;

    case 0x800F:
      _tcscpy( szEventStr, _T("MMCN_PASTE          ") );
      break;

    case 0x8010:
      _tcscpy( szEventStr, _T("MMCN_PROPERTY_CHANGE") );
      break;

    case 0x8011:
      _tcscpy( szEventStr, _T("MMCN_QUERY_PASTE    ") );
      break;

    case 0x8012:
      _tcscpy( szEventStr, _T("MMCN_REFRESH        ") );
      break;

    case 0x8013:
      _tcscpy( szEventStr, _T("MMCN_REMOVE_CHILDREN") );
      break;

    case 0x8014:
      _tcscpy( szEventStr, _T("MMCN_RENAME         ") );
      break;

    case 0x8015:
      _tcscpy( szEventStr, _T("MMCN_SELECT         ") );
      break;

    case 0x8016:
      _tcscpy( szEventStr, _T("MMCN_SHOW           ") );
      break;

    case 0x8017:
      _tcscpy( szEventStr, _T("MMCN_VIEW_CHANGE    ") );
      break;

    case 0x8018:
      _tcscpy( szEventStr, _T("MMCN_SNAPINHELP     ") );
      break;

    case 0x8019:
      _tcscpy( szEventStr, _T("MMCN_CONTEXTHELP    ") );
      break;

    case 0x801A:
      _tcscpy( szEventStr, _T("MMCN_INITOCX        ") );
      break;

    case 0x8021:
      _tcscpy( szEventStr, _T("MMCN_EXPANDSYNC     ") );
      break;

    default:
      _stprintf( szEventStr, _T("0x%X"), Event );
      break;
  }

#endif
} //end MapEvent()

VOID Trace_Event | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LONG | nEvent
 | ) |  |

Definition at line 86 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szEventStr[22];
  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Event = %s\n");
  INT    nChars     = 0;

  MapEvent( nEvent, szEventStr );

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      szEventStr
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Event()

VOID Trace_HR | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | HRESULT | hr
 | ) |  |

Definition at line 27 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Returned 0x%X\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer, szFormat, pszClass, pszFunction, hr );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_HR()

VOID Trace_Start | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction
 | ) |  |

Definition at line 118 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Started \n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Start()

VOID Trace_Value | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LPCTSTR | pszValueName,
 |  | LONG | Value
 | ) |  |

Definition at line 53 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> %s = %u\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      pszValueName,
                      nValue
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Value()

Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/contextmenu/about.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • contextmenu
Functions

about.cpp File Reference

#include "Globals.h"
#include "About.h"
#include "Resource.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CSnapinAbout

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 85 of file about.cpp.

{
  if( 0 == InterlockedDecrement((long*)&m_cRef) )
  {
    // we need to decrement our object count in the DLL
    delete this;
    return 0;
  }
  return m_cRef;
}

Generated on Wed Nov 13 2024 16:54:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/contextmenu/about.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • contextmenu
Classes

about.h File Reference

#include <mmc.h>

Go to the source code of this file.

Classes

class CSnapinAbout
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/contextmenu/adddevicedlg.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • contextmenu

adddevicedlg.cpp File Reference

#include "AddDeviceDlg.h"
#include "Globals.h"
#include "Resource.h"
#include "BaseNode.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/contextmenu/adddevicedlg.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • contextmenu
Classes

adddevicedlg.h File Reference

#include "BaseDialog.h"
#include "BaseDialog.h"

Go to the source code of this file.

Classes

class CAddDeviceDlg
Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/contextmenu/basedialog.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • contextmenu

basedialog.cpp File Reference

#include "BaseDialog.h"
#include "Globals.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/contextmenu/basedialog.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • contextmenu
Classes

basedialog.h File Reference

#include <Windows.h>

Go to the source code of this file.

Classes

class CBaseDialog
Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/contextmenu/basenode.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • contextmenu
Classes | Defines | Typedefs

basenode.h File Reference

#include "Globals.h"
#include "Resource.h"

Go to the source code of this file.

Classes

class | CBaseNode
struct | tag_BASENODE_PROPERTIES

Defines

#define | DEFAULT_RDI_MASK (RDI_STR | RDI_PARAM | RDI_IMAGE)
#define | DEFAULT_SDI_MASK (SDI_STR | SDI_PARAM | SDI_IMAGE | SDI_OPENIMAGE | SDI_PARENT | SDI_CHILDREN)
#define | MAX_NAME_LEN 64

Typedefs

typedef CBaseNode * | LPBASENODE
typedef NODE_PROPERTIES * | LPNODE_PROPERTIES
typedef struct
tag_BASENODE_PROPERTIES 		NODE_PROPERTIES

Define Documentation

#define DEFAULT_RDI_MASK (RDI_STR | RDI_PARAM | RDI_IMAGE)

Definition at line 24 of file basenode.h.

#define DEFAULT_SDI_MASK (SDI_STR | SDI_PARAM | SDI_IMAGE | SDI_OPENIMAGE | SDI_PARENT | SDI_CHILDREN)

Definition at line 23 of file basenode.h.

#define MAX_NAME_LEN 64

Definition at line 26 of file basenode.h.

Typedef Documentation

typedef CBaseNode* LPBASENODE

Definition at line 46 of file basenode.h.

typedef NODE_PROPERTIES* LPNODE_PROPERTIES

Definition at line 45 of file basenode.h.

typedef struct tag_BASENODE_PROPERTIES NODE_PROPERTIES
Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/contextmenu/basesnap.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • contextmenu
Defines | Functions

basesnap.cpp File Reference

#include <ObjBase.h>
#include <InitGuid.h>
#include "Globals.h"
#include "BaseSnap.h"
#include "CompData.h"
#include "About.h"
#include "Registry.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define | MODULESTRING _T("BaseSnap")

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)
BOOL WINAPI | DllMain (HINSTANCE hInstDLL, DWORD fdwReason, void *lpvReserved)
STDAPI | DllRegisterServer ()
STDAPI | DllUnregisterServer ()
STDMETHODIMP_ (ULONG) CClassFactory

Define Documentation

#define MODULESTRING _T("BaseSnap")

Definition at line 28 of file basesnap.cpp.

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 226 of file basesnap.cpp.

{
  if( 0 == g_uObjectCount && 0 == g_uServerLocks )
    return S_OK;
  else
    return S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 190 of file basesnap.cpp.

{
  // Test for CSnapinAbout
  if( (rclsid != CLSID_CComponentData) && (rclsid != CLSID_CSnapinAbout) )
    return CLASS_E_CLASSNOTAVAILABLE;

  if( !ppvObj )
    return E_FAIL;

  *ppvObj = NULL;

  // We can only hand out IUnknown and IClassFactory pointers.  Fail
  // if caller asks for anything else.
  if( !IsEqualIID(riid, IID_IUnknown) && !IsEqualIID(riid, IID_IClassFactory) )
    return E_NOINTERFACE;

  CClassFactory *pFactory = NULL;

  // Create the new class factory.  Pass in the type of object to create
  if( rclsid == CLSID_CComponentData )
    pFactory = new CClassFactory(CClassFactory::COMPONENTDATA);
  else if( rclsid == CLSID_CSnapinAbout )
    pFactory = new CClassFactory(CClassFactory::ABOUT);

  HRESULT hResult = pFactory->QueryInterface( riid, ppvObj );

  return hResult;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstDLL,
 |  | DWORD | fdwReason,
 |  | void * | lpvReserved
 | ) |  |

Definition at line 173 of file basesnap.cpp.

{
  if( DLL_PROCESS_ATTACH == fdwReason )
  {
     g_hInst = hInstDLL;
  }

  return TRUE;
}

STDAPI DllRegisterServer ( void )

Definition at line 236 of file basesnap.cpp.

{
  HRESULT hResult = S_FALSE;

  do
  { // Support ISnapinAbout
    hResult = RegisterServer( g_hInst, CLSID_CSnapinAbout, gtszABOUT_NAME );
    BREAK_ON_ERROR( hResult );

    hResult = RegisterServer( g_hInst, CLSID_CComponentData, gtszSNAPIN_NAME );
    BREAK_ON_ERROR( hResult );

    hResult = RegisterSnapin( CLSID_CComponentData, gtszSNAPIN_NAME, CLSID_CSnapinAbout, TRUE );
    BREAK_ON_ERROR( hResult );

  }while( 0 );

  return hResult;
}

STDAPI DllUnregisterServer ( void )

Definition at line 258 of file basesnap.cpp.

{
  if( S_OK != UnregisterServer( CLSID_CComponentData )  ||
      S_OK != UnregisterServer( CLSID_CSnapinAbout   )  ||
      S_OK != UnregisterSnapin( CLSID_CComponentData )
    )
    return E_UNEXPECTED;
  else
    return S_OK;
}

STDMETHODIMP_ ( ULONG )

Definition at line 91 of file basesnap.cpp.

{
  if( 0 == InterlockedDecrement( (long*)&m_cRef) )
  {
    delete this;
    return 0;
  }
  return m_cRef;
}

Generated on Wed Nov 13 2024 16:54:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/contextmenu/basesnap.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • contextmenu
Classes | Functions

basesnap.h File Reference

Go to the source code of this file.

Classes

class | CClassFactory

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 53 of file ComSpyAudit.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 61 of file ComSpyAudit.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

Generated on Wed Nov 13 2024 16:54:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/contextmenu/comp.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • contextmenu
Defines | Functions

comp.cpp File Reference

#include "Globals.h"
#include "Comp.h"
#include "CompData.h"
#include "DataObj.h"
#include "Resource.h"
#include "StaticNode.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CComponent")

Functions

STDMETHODIMP_ (ULONG) CComponent

Define Documentation

#define MODULESTRING _T("CComponent")

Definition at line 25 of file comp.cpp.

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 94 of file comp.cpp.

{
  if( InterlockedDecrement((LONG*)&m_cRef) == 0 )
  {
    delete this;
    return 0;
  }
  return m_cRef;
}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/contextmenu/comp.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • contextmenu
Classes

comp.h File Reference

#include "Globals.h"

Go to the source code of this file.

Classes

class CComponent
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/contextmenu/compdata.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • contextmenu
Defines | Functions

compdata.cpp File Reference

#include "Globals.h"
#include "Comp.h"
#include "CompData.h"
#include "DataObj.h"
#include "Resource.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CComponentData")

Functions

STDMETHODIMP_ (ULONG) CComponentData

Define Documentation

#define MODULESTRING _T("CComponentData")

Definition at line 23 of file compdata.cpp.

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 120 of file compdata.cpp.

{
  if( InterlockedDecrement((LONG*)&m_cRef) == 0 )
  {
    delete this;
    return 0;
  }

  return m_cRef;
}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/contextmenu/compdata.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • contextmenu
Classes

compdata.h File Reference

#include "Globals.h"
#include "BaseNode.h"

Go to the source code of this file.

Classes

class CComponentData
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/contextmenu/dataobj.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • contextmenu
Defines | Functions

dataobj.cpp File Reference

#include "Globals.h"
#include "DataObj.h"
#include "StaticNode.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CDataObject")

Functions

STDMETHODIMP_ (ULONG) CDataObject

Define Documentation

#define MODULESTRING _T("CDataObject")

Definition at line 22 of file dataobj.cpp.

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 76 of file dataobj.cpp.

{
    if (InterlockedDecrement((LONG*)&m_cRef) == 0)
    {
        delete this;
        return 0;
    }
    return m_cRef;

}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/contextmenu/dataobj.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • contextmenu
Classes

dataobj.h File Reference

#include "Globals.h"
#include "StaticNode.h"
#include "StaticNode.h"

Go to the source code of this file.

Classes

class CDataObject
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/contextmenu/devicenode.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • contextmenu
Defines

devicenode.cpp File Reference

#include "DeviceNode.h"
#include "CompData.h"
#include "Comp.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CDeviceNode")

Define Documentation

#define MODULESTRING _T("CDeviceNode")

Definition at line 23 of file devicenode.cpp.

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/contextmenu/devicenode.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • contextmenu
Classes

devicenode.h File Reference

#include "Globals.h"
#include "FolderNode.h"
#include "LListImpl.h"
#include "FolderNode.h"

Go to the source code of this file.

Classes

class CDeviceNode
Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/contextmenu/foldernode.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • contextmenu
Defines

foldernode.cpp File Reference

#include "FolderNode.h"
#include "CompData.h"
#include "Comp.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CFolderNode")

Define Documentation

#define MODULESTRING _T("CFolderNode")

Definition at line 23 of file foldernode.cpp.

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/contextmenu/foldernode.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • contextmenu
Classes

foldernode.h File Reference

#include "Globals.h"
#include "BaseNode.h"

Go to the source code of this file.

Classes

class CFolderNode
Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/contextmenu/globals.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • contextmenu
Functions | Variables

globals.cpp File Reference

#include "Globals.h"
#include "BaseNode.h"

Go to the source code of this file.

Functions

void _fastcall | CopyT2W (LPWSTR strDest, LPCTSTR strSource, size_t count)
CBaseNode * | ExtractBaseNodePtr (LPDATAOBJECT ipDataObject)
CDataObject * | ExtractDataObjPtr (LPDATAOBJECT ipDataObject)
HRESULT | ExtractFromDataObject (LPDATAOBJECT ipDataObject, UINT cfClipFormat, ULONG nByteCount, HGLOBAL *phGlobal)
void | InitClipboardFormats ()
void _fastcall | Unicode2Ansi (CHAR **pszAnsi, WCHAR *szWide)

Variables

UINT | g_cfBaseNodePtr = 0
UINT | g_cfDataObjPtr = 0
UINT | g_cfDisplayName = 0
UINT | g_cfNodeType = 0
UINT | g_cfSnapinClsid = 0
UINT | g_cfszNodeType = 0
HINSTANCE | g_hInst = NULL
ULONG | g_uObjectCount = 0
ULONG | g_uServerLocks = 0

Function Documentation

void _fastcall CopyT2W | ( | LPWSTR | strDest,
 |  | LPCTSTR | strSource,
 |  | size_t | count
 | ) |  |

Definition at line 64 of file globals.cpp.

{
#ifndef _UNICODE

  MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, strSource, -1, strDest, count );

#else

  wcsncpy( strDest, strSource, count );

#endif

  if ( count > 0 )
    strDest[ count - 1 ] = 0;
}

CBaseNode* ExtractBaseNodePtr ( LPDATAOBJECT ipDataObject )

Definition at line 150 of file globals.cpp.

{
  LPBASENODE  pNode   = NULL;
  HGLOBAL     hGlobal = NULL;
  HRESULT     hResult = S_FALSE;

  hResult = ExtractFromDataObject( ipDataObject,
                                   g_cfBaseNodePtr,
                                   sizeof(LPBASENODE),
                                   &hGlobal
                                 );
  if( SUCCEEDED(hResult) )
  {
    pNode = *(LPBASENODE*)(hGlobal);
    HGLOBAL hRetVal = GlobalFree(hGlobal);
    _ASSERT( NULL == hRetVal );        // Must return NULL
  }

  return pNode;

}

CDataObject* ExtractDataObjPtr ( LPDATAOBJECT ipDataObject )

Definition at line 179 of file globals.cpp.

{
  _ASSERT( 0 != g_cfDataObjPtr );

  HGLOBAL      hGlobal = NULL;
  HRESULT      hResult = S_OK;
  CDataObject* pDO     = NULL;

  hResult = ExtractFromDataObject( ipDataObject,
                                   g_cfDataObjPtr,
                                   sizeof(CDataObject **),
                                   &hGlobal
                                 );

  if( SUCCEEDED(hResult) )
  {
    pDO = *(CDataObject **)(hGlobal);
    _ASSERT( NULL != pDO );

    HGLOBAL hRetVal = GlobalFree(hGlobal);
    _ASSERT( NULL == hRetVal );       // Must return NULL
  }

  return pDO;

}

HRESULT ExtractFromDataObject | ( | LPDATAOBJECT | ipDataObject,
 |  | UINT | cfClipFormat,
 |  | ULONG | nByteCount,
 |  | HGLOBAL * | phGlobal
 | ) |  |

Definition at line 98 of file globals.cpp.

{
  _ASSERT( NULL != ipDataObject );

            *phGlobal = NULL;
  HRESULT   hResult   = S_FALSE;
  STGMEDIUM StgMedium = { TYMED_HGLOBAL,  NULL  };
  FORMATETC FormatEtc = { cfClipFormat, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };

  do
  {
    // Allocate memory for the stream
    StgMedium.hGlobal = ::GlobalAlloc( GMEM_SHARE, nByteCount );

    if( NULL == StgMedium.hGlobal )
    {
      hResult = E_OUTOFMEMORY;
      break;
    }

    // Attempt to get data from the object
    hResult = ipDataObject->GetDataHere( &FormatEtc, &StgMedium );
    if( FAILED(hResult) )
    {
      break;
    }
    // StgMedium now has the data we need
    *phGlobal = StgMedium.hGlobal;
    StgMedium.hGlobal = NULL;

  } while (0);

  if( FAILED(hResult) && StgMedium.hGlobal )
  {
    HGLOBAL hRetVal = ::GlobalFree(StgMedium.hGlobal);
    _ASSERT( NULL == hRetVal );         // Must return NULL
  }
  return hResult;

}

void InitClipboardFormats ( )

Definition at line 82 of file globals.cpp.

{
  g_cfDisplayName  = RegisterClipboardFormat( T_CCF_DISPLAY_NAME );
  g_cfNodeType     = RegisterClipboardFormat( T_CCF_NODETYPE );
  g_cfszNodeType   = RegisterClipboardFormat( T_CCF_SZNODETYPE );
  g_cfSnapinClsid  = RegisterClipboardFormat( T_CCF_SNAPIN_CLASSID );

  g_cfBaseNodePtr  = RegisterClipboardFormat( T_CCF_BASENODE_PTR );
  g_cfDataObjPtr   = RegisterClipboardFormat( T_CCF_DATAOBJ_PTR );

}

void _fastcall Unicode2Ansi | ( | CHAR ** | pszAnsi,
 |  | WCHAR * | szWide
 | ) |  |

Definition at line 45 of file globals.cpp.

{
  LONG nLen = wcslen( szWide ) +1;
  *pszAnsi = (char*)CoTaskMemAlloc( nLen );
  char* pCounter = *pszAnsi;

  while( *szWide )
  {
    *pCounter = LOBYTE(*szWide);
    pCounter++;
    szWide++;
  }
  *pCounter = NULL;
}

Variable Documentation

UINT g_cfBaseNodePtr = 0

Definition at line 28 of file globals.cpp.

UINT g_cfDataObjPtr = 0

Definition at line 29 of file globals.cpp.

UINT g_cfDisplayName = 0

Definition at line 20 of file globals.cpp.

UINT g_cfNodeType = 0

Definition at line 21 of file globals.cpp.

UINT g_cfSnapinClsid = 0

Definition at line 23 of file globals.cpp.

UINT g_cfszNodeType = 0

Definition at line 22 of file globals.cpp.

HINSTANCE g_hInst = NULL

Definition at line 34 of file globals.cpp.

ULONG g_uObjectCount = 0

Definition at line 35 of file globals.cpp.

ULONG g_uServerLocks = 0

Definition at line 36 of file globals.cpp.

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/contextmenu/globals.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • contextmenu
Defines | Functions | Variables

globals.h File Reference

#include <TChar.h>
#include <Mmc.h>
#include <CrtDbg.h>
#include "Guids.h"
#include "Guids.h"

Go to the source code of this file.

Defines

#define | ATTRIBUTE_BACKUP_DEVICE 2048
#define | ATTRIBUTE_DATA_ARCHIVE 2
#define | ATTRIBUTE_DATA_HIDDEN 4
#define | ATTRIBUTE_DATA_LOCKED 8
#define | ATTRIBUTE_DATA_READONLY 16
#define | BREAK_ON_ERROR(hResult) if( S_OK != hResult ) continue
#define | BYTE_SIZE(string) ((_tcslen(string)+1) * sizeof(TCHAR))
#define | IDM_NEW_DEVICE 100
#define | IDM_NEW_FOLDER 200
#define | IDM_TOGGLE_STATUS 300
#define | IMG_CDROM_DEFAULT 6
#define | IMG_DATA_FILE 2
#define | IMG_DEVICE_DEFAULT 0
#define | IMG_DEVICE_OFFLINE 1
#define | IMG_DRIVE_DEFAULT 3
#define | IMG_DRIVE_OFFLINE 4
#define | IMG_FOLDER_DEFAULT 5
#define | IMG_REMOVABLE_MEDIA 7
#define | MsgBox(wszMsg, wszTitle) ::MessageBox(NULL, wszMsg, wszTitle, MB_OK)
#define | NODETYPE_DEVICE 200
#define | NODETYPE_FOLDER 300
#define | NODETYPE_RESULT 400
#define | NODETYPE_STATIC 100
#define | REQUEST_ICONSOLE 1001
#define | REQUEST_ICONSOLENAMESPACE2 1000
#define | REQUEST_ICONSOLEVERB 1002
#define | REQUEST_IHEADERCTRL2 1004
#define | REQUEST_IRESULTDATA 1003
#define | STATUS_OFFLINE 0
#define | STATUS_ONLINE 1
#define | T_CCF_BASENODE_PTR _T("CCF_BASENODE_PTR")
#define | T_CCF_DATAOBJ_PTR _T("CCF_DATAOBJ_PTR")
#define | T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")
#define | T_CCF_NODETYPE _T("CCF_NODETYPE")
#define | T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")
#define | T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")
#define | W2T(szAnsiPtr, szWide) Unicode2Ansi( szAnsiPtr, szWide )
#define | WM_ADD_DEVICENODE (WM_USER + 101)
#define | WM_DEL_DEVICENODES (WM_USER + 100)
#define | WM_DEVICENODE_CLOSED (WM_USER + 102)

Functions

void _fastcall | CopyT2W (LPWSTR strDest, LPCTSTR strSource, size_t count)
CBaseNode * | ExtractBaseNodePtr (LPDATAOBJECT ipDataObject)
CDataObject * | ExtractDataObjPtr (LPDATAOBJECT ipDataObject)
HRESULT | ExtractFromDataObject (LPDATAOBJECT ipDataObject, UINT cf, ULONG cb, HGLOBAL *phGlobal)
void | InitClipboardFormats ()
template<class TYPE >
void | SAFE_FREE_BITMAP (TYPE *&pObj)
template<class TYPE >
void | SAFE_FREE_ICON (TYPE *&pObj)
template<class TYPE >
void | SAFE_RELEASE (TYPE *&pObj)
void _fastcall | Unicode2Ansi (CHAR **pszAnsi, WCHAR *szWide)

Variables

UINT g_cfBaseNodePtr
UINT g_cfDataObjPtr
UINT g_cfDisplayName
UINT g_cfNodeType
UINT g_cfSnapinClsid
UINT g_cfszNodeType
HINSTANCE | g_hInst
ULONG g_uObjectCount
ULONG g_uServerLocks

Define Documentation

#define ATTRIBUTE_BACKUP_DEVICE 2048

Definition at line 95 of file globals.h.

#define ATTRIBUTE_DATA_ARCHIVE 2

Definition at line 91 of file globals.h.

#define ATTRIBUTE_DATA_HIDDEN 4

Definition at line 92 of file globals.h.

#define ATTRIBUTE_DATA_LOCKED 8

Definition at line 93 of file globals.h.

#define ATTRIBUTE_DATA_READONLY 16

Definition at line 94 of file globals.h.

#define BREAK_ON_ERROR ( hResult ) if( S_OK != hResult ) continue

Definition at line 136 of file globals.h.

#define BYTE_SIZE ( string ) ((_tcslen(string)+1) * sizeof(TCHAR))

Definition at line 134 of file globals.h.

#define IDM_NEW_DEVICE 100

Definition at line 107 of file globals.h.

#define IDM_NEW_FOLDER 200

Definition at line 108 of file globals.h.

#define IDM_TOGGLE_STATUS 300

Definition at line 109 of file globals.h.

#define IMG_CDROM_DEFAULT 6

Definition at line 104 of file globals.h.

#define IMG_DATA_FILE 2

Definition at line 100 of file globals.h.

#define IMG_DEVICE_DEFAULT 0

Definition at line 98 of file globals.h.

#define IMG_DEVICE_OFFLINE 1

Definition at line 99 of file globals.h.

#define IMG_DRIVE_DEFAULT 3

Definition at line 101 of file globals.h.

#define IMG_DRIVE_OFFLINE 4

Definition at line 102 of file globals.h.

#define IMG_FOLDER_DEFAULT 5

Definition at line 103 of file globals.h.

#define IMG_REMOVABLE_MEDIA 7

Definition at line 105 of file globals.h.

#define MsgBox | ( | wszMsg,
 |  | wszTitle |
 | ) |  | ::MessageBox(NULL, wszMsg, wszTitle, MB_OK)

Definition at line 139 of file globals.h.

#define NODETYPE_DEVICE 200

Definition at line 86 of file globals.h.

#define NODETYPE_FOLDER 300

Definition at line 87 of file globals.h.

#define NODETYPE_RESULT 400

Definition at line 88 of file globals.h.

#define NODETYPE_STATIC 100

Definition at line 85 of file globals.h.

#define REQUEST_ICONSOLE 1001

Definition at line 125 of file globals.h.

#define REQUEST_ICONSOLENAMESPACE2 1000

Definition at line 124 of file globals.h.

#define REQUEST_ICONSOLEVERB 1002

Definition at line 126 of file globals.h.

#define REQUEST_IHEADERCTRL2 1004

Definition at line 128 of file globals.h.

#define REQUEST_IRESULTDATA 1003

Definition at line 127 of file globals.h.

#define STATUS_OFFLINE 0

Definition at line 112 of file globals.h.

#define STATUS_ONLINE 1

Definition at line 111 of file globals.h.

#define T_CCF_BASENODE_PTR _T("CCF_BASENODE_PTR")

Definition at line 79 of file globals.h.

#define T_CCF_DATAOBJ_PTR _T("CCF_DATAOBJ_PTR")

Definition at line 80 of file globals.h.

#define T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")

Definition at line 74 of file globals.h.

#define T_CCF_NODETYPE _T("CCF_NODETYPE")

Definition at line 75 of file globals.h.

#define T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")

Definition at line 77 of file globals.h.

#define T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")

Definition at line 76 of file globals.h.

#define W2T | ( | szAnsiPtr,
 |  | szWide |
 | ) |  | Unicode2Ansi( szAnsiPtr, szWide )

Definition at line 194 of file globals.h.

#define WM_ADD_DEVICENODE (WM_USER + 101)

Definition at line 118 of file globals.h.

#define WM_DEL_DEVICENODES (WM_USER + 100)

Definition at line 117 of file globals.h.

#define WM_DEVICENODE_CLOSED (WM_USER + 102)

Definition at line 119 of file globals.h.

Function Documentation

void _fastcall CopyT2W | ( | LPWSTR | strDest,
 |  | LPCTSTR | strSource,
 |  | size_t | count
 | ) |  |

Definition at line 64 of file globals.cpp.

{
#ifndef _UNICODE

  MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, strSource, -1, strDest, count );

#else

  wcsncpy( strDest, strSource, count );

#endif

  if ( count > 0 )
    strDest[ count - 1 ] = 0;
}

CBaseNode* ExtractBaseNodePtr ( LPDATAOBJECT ipDataObject )

Definition at line 150 of file globals.cpp.

{
  LPBASENODE  pNode   = NULL;
  HGLOBAL     hGlobal = NULL;
  HRESULT     hResult = S_FALSE;

  hResult = ExtractFromDataObject( ipDataObject,
                                   g_cfBaseNodePtr,
                                   sizeof(LPBASENODE),
                                   &hGlobal
                                 );
  if( SUCCEEDED(hResult) )
  {
    pNode = *(LPBASENODE*)(hGlobal);
    HGLOBAL hRetVal = GlobalFree(hGlobal);
    _ASSERT( NULL == hRetVal );        // Must return NULL
  }

  return pNode;

}

CDataObject* ExtractDataObjPtr ( LPDATAOBJECT ipDataObject )

Definition at line 179 of file globals.cpp.

{
  _ASSERT( 0 != g_cfDataObjPtr );

  HGLOBAL      hGlobal = NULL;
  HRESULT      hResult = S_OK;
  CDataObject* pDO     = NULL;

  hResult = ExtractFromDataObject( ipDataObject,
                                   g_cfDataObjPtr,
                                   sizeof(CDataObject **),
                                   &hGlobal
                                 );

  if( SUCCEEDED(hResult) )
  {
    pDO = *(CDataObject **)(hGlobal);
    _ASSERT( NULL != pDO );

    HGLOBAL hRetVal = GlobalFree(hGlobal);
    _ASSERT( NULL == hRetVal );       // Must return NULL
  }

  return pDO;

}

HRESULT ExtractFromDataObject | ( | LPDATAOBJECT | ipDataObject,
 |  | UINT | cf,
 |  | ULONG | cb,
 |  | HGLOBAL * | phGlobal
 | ) |  |

Definition at line 98 of file globals.cpp.

{
  _ASSERT( NULL != ipDataObject );

            *phGlobal = NULL;
  HRESULT   hResult   = S_FALSE;
  STGMEDIUM StgMedium = { TYMED_HGLOBAL,  NULL  };
  FORMATETC FormatEtc = { cfClipFormat, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };

  do
  {
    // Allocate memory for the stream
    StgMedium.hGlobal = ::GlobalAlloc( GMEM_SHARE, nByteCount );

    if( NULL == StgMedium.hGlobal )
    {
      hResult = E_OUTOFMEMORY;
      break;
    }

    // Attempt to get data from the object
    hResult = ipDataObject->GetDataHere( &FormatEtc, &StgMedium );
    if( FAILED(hResult) )
    {
      break;
    }
    // StgMedium now has the data we need
    *phGlobal = StgMedium.hGlobal;
    StgMedium.hGlobal = NULL;

  } while (0);

  if( FAILED(hResult) && StgMedium.hGlobal )
  {
    HGLOBAL hRetVal = ::GlobalFree(StgMedium.hGlobal);
    _ASSERT( NULL == hRetVal );         // Must return NULL
  }
  return hResult;

}

void InitClipboardFormats ( )

Definition at line 56 of file globals.cpp.

{
  g_cfDisplayName  = RegisterClipboardFormat( T_CCF_DISPLAY_NAME );
  g_cfNodeType     = RegisterClipboardFormat( T_CCF_NODETYPE );
  g_cfszNodeType   = RegisterClipboardFormat( T_CCF_SZNODETYPE );
  g_cfSnapinClsid  = RegisterClipboardFormat( T_CCF_SNAPIN_CLASSID );

}

template<class TYPE >
void SAFE_FREE_BITMAP ( TYPE *& pObj ) [inline]

Definition at line 159 of file globals.h.

{
  if( NULL != pObj )
  {
    BOOL bStatus = DeleteObject( pObj );
    pObj = NULL;
  }
  else
  {
    OutputDebugString(_T("Attempted to delete NULL Bitmap handle.\n"));
  }
}

template<class TYPE >
void SAFE_FREE_ICON ( TYPE *& pObj ) [inline]

Definition at line 174 of file globals.h.

{
  if( NULL != pObj )
  {
    BOOL bStatus = DestroyIcon( pObj );
    pObj = NULL;
  }
  else
  {
    OutputDebugString(_T("Attempted to delete NULL Icon handle.\n"));
  }
}

template<class TYPE >
void SAFE_RELEASE ( TYPE *& pObj ) [inline]

Definition at line 144 of file globals.h.

{
  if( NULL != pObj )
  {
    pObj->Release();
    pObj = NULL;
  }
  else
  {
    OutputDebugString(_T("Attempted to release NULL Com pointer.\n"));
  }
}

void _fastcall Unicode2Ansi | ( | CHAR ** | pszAnsi,
 |  | WCHAR * | szWide
 | ) |  |

Definition at line 38 of file globals.cpp.

{
  LONG nLen = wcslen( szWide ) +1;
  *pszAnsi = (char*)CoTaskMemAlloc( nLen );
  char* pCounter = *pszAnsi;

  while( *szWide )
  {
    *pCounter = LOBYTE(*szWide);
    pCounter++;
    szWide++;
  }
  *pCounter = NULL;
}

Variable Documentation

UINT g_cfBaseNodePtr

Definition at line 28 of file globals.cpp.

UINT g_cfDataObjPtr

Definition at line 29 of file globals.cpp.

UINT g_cfDisplayName

Definition at line 19 of file globals.cpp.

UINT g_cfNodeType

Definition at line 20 of file globals.cpp.

UINT g_cfSnapinClsid

Definition at line 22 of file globals.cpp.

UINT g_cfszNodeType

Definition at line 21 of file globals.cpp.

HINSTANCE g_hInst

Definition at line 62 of file DoServer.Cpp.

ULONG g_uObjectCount

Definition at line 28 of file globals.cpp.

ULONG g_uServerLocks

Definition at line 29 of file globals.cpp.

Generated on Wed Nov 13 2024 16:54:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/contextmenu/guids.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • contextmenu
Functions

guids.h File Reference

Go to the source code of this file.

Functions

DEFINE_GUID (CLSID_CComponentData, 0x6812e2cf, 0x47dd, 0x4294, 0xa1, 0x55, 0x5f, 0xf2, 0xbe, 0xc2, 0xfe, 0xa2)
DEFINE_GUID (CLSID_CFolderNode, 0x520F23fA, 0x775D, 0x4015, 0xb4, 0x37, 0x98, 0xA2, 0x4B, 0x9D, 0x8, 0x5E)
DEFINE_GUID (CLSID_DeviceNode, 0x520F23f9, 0x775D, 0x4015, 0xB4, 0x37, 0x98, 0xA2, 0x4B, 0x9D, 0x8, 0x5E)
DEFINE_GUID (CLSID_CSnapinAbout, 0x9eee41e0, 0xe990, 0x4160, 0x8f, 0xde, 0x27, 0x15, 0x14, 0xeb, 0x22, 0x40)

Function Documentation

DEFINE_GUID | ( | CLSID_CComponentData | ,
 |  | 0x6812e2cf | ,
 |  | 0x47dd | ,
 |  | 0x4294 | ,
 |  | 0xa1 | ,
 |  | 0x55 | ,
 |  | 0x5f | ,
 |  | 0xf2 | ,
 |  | 0xbe | ,
 |  | 0xc2 | ,
 |  | 0xfe | ,
 |  | 0xa2 |
 | ) |  |
DEFINE_GUID | ( | CLSID_CFolderNode | ,
 |  | 0x520F23fA | ,
 |  | 0x775D | ,
 |  | 0x4015 | ,
 |  | 0xb4 | ,
 |  | 0x37 | ,
 |  | 0x98 | ,
 |  | 0xA2 | ,
 |  | 0x4B | ,
 |  | 0x9D | ,
 |  | 0x8 | ,
 |  | 0x5E |
 | ) |  |
DEFINE_GUID | ( | CLSID_DeviceNode | ,
 |  | 0x520F23f9 | ,
 |  | 0x775D | ,
 |  | 0x4015 | ,
 |  | 0xB4 | ,
 |  | 0x37 | ,
 |  | 0x98 | ,
 |  | 0xA2 | ,
 |  | 0x4B | ,
 |  | 0x9D | ,
 |  | 0x8 | ,
 |  | 0x5E |
 | ) |  |
DEFINE_GUID | ( | CLSID_CSnapinAbout | ,
 |  | 0x9eee41e0 | ,
 |  | 0xe990 | ,
 |  | 0x4160 | ,
 |  | 0x8f | ,
 |  | 0xde | ,
 |  | 0x27 | ,
 |  | 0x15 | ,
 |  | 0x14 | ,
 |  | 0xeb | ,
 |  | 0x22 | ,
 |  | 0x40 |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/contextmenu/llistimpl.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • contextmenu
Functions

llistimpl.cpp File Reference

#include "LListImpl.h"

Go to the source code of this file.

Functions

BOOL IsValidAddress (const void *lp, UINT nBytes, BOOL bReadWrite)

Function Documentation

BOOL IsValidAddress | ( | const void * | lp,
 |  | UINT | nBytes,
 |  | BOOL | bReadWrite
 | ) |  |

Definition at line 53 of file llistimpl.cpp.

{
  // Simple version using Win-32 APIs for pointer validation.
  return (lp != NULL && !IsBadReadPtr(lp, nBytes) &&
         (!bReadWrite || !IsBadWritePtr((LPVOID)lp, nBytes)));

} //end IsValidAddress()

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/contextmenu/llistimpl.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • contextmenu
Classes | Typedefs | Functions

llistimpl.h File Reference

#include <CrtDbg.h>
#include <Windows.h>
#include <new.h>

Go to the source code of this file.

Classes

struct | __POSITION
class | CLListImpl< TYPE, ARG_TYPE >
struct | CLListImpl< TYPE, ARG_TYPE >::CNode
struct | CPlex

Typedefs

typedef __POSITION * | POSITION

Functions

BOOL | IsValidAddress (const void *lp, UINT nBytes, BOOL bReadWrite=TRUE)

Typedef Documentation

typedef __POSITION* POSITION

Definition at line 31 of file llistimpl.h.

Function Documentation

BOOL IsValidAddress | ( | const void * | lp,
 |  | UINT | nBytes,
 |  | BOOL | bReadWrite = TRUE
 | ) |  |

Definition at line 53 of file llistimpl.cpp.

{
  // Simple version using Win-32 APIs for pointer validation.
  return (lp != NULL && !IsBadReadPtr(lp, nBytes) &&
         (!bReadWrite || !IsBadWritePtr((LPVOID)lp, nBytes)));

} //end IsValidAddress()

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/contextmenu/registry.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • contextmenu
Defines | Functions

registry.cpp File Reference

#include <ObjBase.h>
#include "Registry.h"
#include "Globals.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define | MODULESTRING _T("Registry")

Functions

HRESULT | RecursiveDeleteKey (HKEY hKeyParent, const TCHAR *szKeyChild)
HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const TCHAR *szNameString, const CLSID &clsidAbout, const BOOL bSupportExtensions)
HRESULT | SetExtensionKey (TCHAR *szNode2Extend, TCHAR *szExtensionNode, TCHAR *szExtensionType, TCHAR *szDescription)
HRESULT | SetKeyAndValue (const TCHAR *pszPath, const TCHAR *szSubkey, const TCHAR *szValue)
HRESULT | SetNodeTypesKey (const TCHAR *szNodeGuid)
HRESULT | SetSnapInKeyAndValue (const TCHAR *szKey, const TCHAR *szSubkey, const TCHAR *szName, const TCHAR *szValue)
HRESULT | SetValue (const TCHAR *szKey, const TCHAR *szValueName, const TCHAR *szValue)
LONG | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Define Documentation

#define MODULESTRING _T("Registry")

Definition at line 22 of file registry.cpp.

Function Documentation

HRESULT RecursiveDeleteKey | ( | HKEY | hKeyParent,
 |  | const TCHAR * | szKeyChild
 | ) |  |

Definition at line 274 of file registry.cpp.

{
  // Open the child.
  HKEY hKeyChild = NULL;
  LONG lResult   = ERROR_SUCCESS;

  do                     // We go to all this trouble to prevent any
  {                      // possibility of exiting while leaving a key open

    lResult = RegOpenKeyEx( hKeyParent,
                            lpszKeyChild,
                            0,
                            KEY_ALL_ACCESS,
                            &hKeyChild
                          );
    if( ERROR_SUCCESS != lResult )
      continue;

    // Enumerate all of the decendents of this child.
    FILETIME time;
    _TCHAR szBuffer[256];
    DWORD dwSize = 256;
    while( S_OK == RegEnumKeyEx(hKeyChild,0,szBuffer,&dwSize,NULL,NULL,NULL,&time) )
    {
      // Delete the decendents of this child.
      lResult = RecursiveDeleteKey( hKeyChild, szBuffer );
      if( ERROR_SUCCESS != lResult )
      {
        continue;
      }
      dwSize = 256;
    }
  }while( 0 );

  RegCloseKey( hKeyChild );            // Always try to close the child
                                       // then delete this child.
  return RegDeleteKey( hKeyParent, lpszKeyChild );
}

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const TCHAR * | szFriendlyName
 | ) |  |

Definition at line 55 of file registry.cpp.

{
  // Get server location.
  TCHAR    szModule[512] ;
  TCHAR*   pszCLSID = NULL;
  LPOLESTR wszCLSID = NULL ;
  HRESULT  hResult  = S_FALSE;

  DWORD dwResult = ::GetModuleFileName( hModule,
                                        szModule,
                                        sizeof(szModule)/sizeof(TCHAR)
                                      );
  if( 0 == dwResult ) return HRESULT_FROM_WIN32( dwResult );

  do                         // Fail unless we complete everything
  {
    // Get CLSID string in wide char
    hResult = StringFromCLSID( clsid, &wszCLSID ) ;
    if( S_OK != hResult )
    {
      CoTaskMemFree( wszCLSID );
      BREAK_ON_ERROR( hResult );
    }

    W2T( &pszCLSID, wszCLSID );          // W2T is defined in Globals.h
    CoTaskMemFree( wszCLSID );           // Through with wide version

    TCHAR szKey[64];                     // Build the CLSID key string CLSID\\{...}
    _tcscpy( szKey, _T("CLSID\\") );
    _tcscat( szKey, pszCLSID );

    // Add the CLSID to the registry.
    hResult = SetKeyAndValue( szKey, NULL, szFriendlyName );
    BREAK_ON_ERROR( hResult );

    // Add the server filename subkey under the CLSID key.
    hResult = SetKeyAndValue( szKey, _T("InprocServer32"), szModule );
    BREAK_ON_ERROR( hResult );

    // Set the threading model
    _tcscat( szKey, _T("\\InprocServer32") );
    hResult = SetValue( szKey, _T("ThreadingModel"), _T("Apartment") );
    BREAK_ON_ERROR( hResult );

  }while( 0 );

  CoTaskMemFree( pszCLSID );           // Through with TCHAR version

  return hResult;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | bSupportExtensions
 | ) |  |

Definition at line 153 of file registry.cpp.

{
  HRESULT hResult = S_FALSE;
  TCHAR*  pszSnapCLSID = NULL;         // Needed for TCHAR version of the ClassID

  // If any part of this process fails, jump out of the loop and return
  // the error code
  do
  {
    // Allocate the CLSID string
    LPOLESTR wszSnapCLSID  = NULL ;
    hResult = StringFromCLSID( clsid, &wszSnapCLSID ) ;
    if( S_OK != hResult )
    {
       CoTaskMemFree( wszSnapCLSID );
       continue;
    }

    W2T( &pszSnapCLSID, wszSnapCLSID );  // W2T is defined in Globals.h
    CoTaskMemFree( wszSnapCLSID );       // Through with wide version

    // Add the Snap-in's CLSID to the registry
    hResult = SetSnapInKeyAndValue( pszSnapCLSID, NULL, _T("NameString"), szNameString );
    BREAK_ON_ERROR( hResult );

    hResult = SetSnapInKeyAndValue( pszSnapCLSID, _T("StandAlone"), NULL, NULL );
    BREAK_ON_ERROR( hResult );

    // Add registry information for ISnapinAbout if we support it
    LPOLESTR wszAboutCLSID = NULL;
    TCHAR*   pszAboutCLSID = NULL;
    if( IID_NULL != clsidAbout )
    {
      hResult = StringFromCLSID( clsidAbout, &wszAboutCLSID );
      if( S_OK != hResult )
      {
        CoTaskMemFree( wszAboutCLSID ); // Free this memory before exiting
        continue;
      }

      W2T( &pszAboutCLSID, wszAboutCLSID );
      hResult = SetSnapInKeyAndValue( pszSnapCLSID, NULL, _T("About"), pszAboutCLSID );
      CoTaskMemFree( wszAboutCLSID );
      CoTaskMemFree( pszAboutCLSID );
      BREAK_ON_ERROR( hResult );
    }

    if( TRUE == bSupportExtensions )     // Build the NodeTypesKey
    {
      hResult = SetSnapInKeyAndValue( pszSnapCLSID, _T("NodeTypes"), NULL, NULL );
      BREAK_ON_ERROR( hResult );
      TCHAR szKey[64];
      _tcscpy( szKey, pszSnapCLSID );
      _tcscat(szKey, _T("\\NodeTypes"));
      hResult = SetSnapInKeyAndValue( szKey, pszSnapCLSID, NULL, NULL );
      BREAK_ON_ERROR( hResult );

      // First set the values for the node which will be extended.
      hResult = SetSnapInKeyAndValue( szKey, gtszCLSID_DEVICENODE, NULL, NULL );
      BREAK_ON_ERROR( hResult );

      // Add the GUID for the node which will be extended under MMC/NodeTypes
      hResult = SetNodeTypesKey( gtszCLSID_DEVICENODE );
      BREAK_ON_ERROR( hResult );
    }
  }while( 0 );

  CoTaskMemFree( pszSnapCLSID);
  return hResult;
}

HRESULT SetExtensionKey | ( | TCHAR * | szNode2Extend,
 |  | TCHAR * | szExtensionNode,
 |  | TCHAR * | szExtensionType,
 |  | TCHAR * | szDescription
 | ) |  |

Definition at line 508 of file registry.cpp.

{
  HKEY    hNodeKey = NULL;
  HRESULT hResult  = S_FALSE;
  TCHAR   szKeyBuf[1024];

  // Load the buffer with the NodeTypes Location
  _tcscpy( szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\NodeTypes") );

  _tcscat( szKeyBuf, _T("\\") );       // Copy NodeType GUID into buffer.
  _tcscat( szKeyBuf, szNode2Extend );

                                       // Copy Subkeys into buffer
  _tcscat( szKeyBuf, _T("\\Extensions\\") );
  _tcscat( szKeyBuf, szExtensionType );

  long lResult = RegCreateKeyEx( HKEY_LOCAL_MACHINE,
                                 szKeyBuf,
                                 0,
                                 NULL,
                                 REG_OPTION_NON_VOLATILE,
                                 KEY_ALL_ACCESS,
                                 NULL,
                                 &hNodeKey,
                                 NULL
                               );

  if( ERROR_SUCCESS != lResult )     // Will return S_FALSE
  {
    RegCloseKey( hNodeKey );
    return S_FALSE;
  }

  hResult = RegSetValueEx( hNodeKey,
                           szExtensionNode,
                           0,
                           REG_SZ,
                           (BYTE*)szDescription,
                           BYTE_SIZE(szDescription)
                         );

  return hResult;
}

HRESULT SetKeyAndValue | ( | const TCHAR * | pszPath,
 |  | const TCHAR * | szSubkey,
 |  | const TCHAR * | szValue
 | ) |  |

Definition at line 322 of file registry.cpp.

{
  HKEY hKey = NULL;
  HRESULT hResult = S_FALSE;
  TCHAR szKeyBuf[1024];

  // Copy keyname into buffer.
  _tcscpy( szKeyBuf, szKey );

  // Add subkey name to buffer.
  if( NULL != szSubkey )
  {
    _tcscat( szKeyBuf, _T("\\") );
    _tcscat( szKeyBuf, szSubkey );
  }

  do                     // We go to all this trouble to prevent any
  {                      // possibility of exiting while leaving a key open

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx( HKEY_CLASSES_ROOT,
                                   szKeyBuf,
                                   0,
                                   NULL,
                                   REG_OPTION_NON_VOLATILE,
                                   KEY_ALL_ACCESS,
                                   NULL,
                                   &hKey,
                                   NULL
                                 );
    if( ERROR_SUCCESS != lResult )
    {
      hResult = HRESULT_FROM_WIN32( lResult );
      continue;
    }

    if( NULL != szValue )    // Now set the value
    {
      hResult = RegSetValueEx( hKey,
                               NULL,
                               0,
                               REG_SZ,
                               (BYTE*)szValue,
                               BYTE_SIZE( szValue )    // BYTE_SIZE is in Globals.h
                             );
      BREAK_ON_ERROR( hResult );
    }
  }while( 0 );

  RegCloseKey( hKey );       // Always try to close the key
  return hResult;
}

HRESULT SetNodeTypesKey ( const TCHAR * szNodeGuid )

Definition at line 562 of file registry.cpp.

{
  HKEY    hKey = NULL;
  TCHAR   szKeyBuf[1024];

  // Load the buffer with the Snap-In Location
  _tcscpy( szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\NodeTypes") );
  _tcscat( szKeyBuf, _T("\\") );       // Copy keyname into buffer.
  _tcscat( szKeyBuf, szNodeGuid );

  // Create and open key.
  long lResult = RegCreateKeyEx( HKEY_LOCAL_MACHINE,
                                 szKeyBuf,
                                 0,
                                 NULL,
                                 REG_OPTION_NON_VOLATILE,
                                 KEY_ALL_ACCESS,
                                 NULL,
                                 &hKey,
                                 NULL
                               );

  RegCloseKey( hKey );       //Always close the key
  return (ERROR_SUCCESS == lResult) ? S_OK : S_FALSE;

}

HRESULT SetSnapInKeyAndValue | ( | const TCHAR * | szKey,
 |  | const TCHAR * | szSubkey,
 |  | const TCHAR * | szName,
 |  | const TCHAR * | szValue
 | ) |  |

Definition at line 441 of file registry.cpp.

{
  HKEY    hKey = NULL;
  HRESULT hResult = S_FALSE;
  TCHAR   szKeyBuf[1024];

  // Load the buffer with the Snap-In Location
  _tcscpy( szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns") );

  _tcscat( szKeyBuf, _T("\\") );       // Copy keyname into buffer.
  _tcscat( szKeyBuf, szKey );

  if( NULL != szSubkey )               // Add subkey name to buffer.
  {
    _tcscat( szKeyBuf, _T("\\") );
    _tcscat( szKeyBuf, szSubkey );
  }

  do                     // We go to all this trouble to prevent any
  {                      // possibility of exiting while leaving a key open

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx( HKEY_LOCAL_MACHINE,
                                   szKeyBuf,
                                   0,
                                   NULL,
                                   REG_OPTION_NON_VOLATILE,
                                   KEY_ALL_ACCESS,
                                   NULL,
                                   &hKey,
                                   NULL
                                 );
    if( ERROR_SUCCESS != lResult )     // Will return S_FALSE
      continue;

    // Set the Value.
    if( szValue != NULL )
    {
      hResult = RegSetValueEx( hKey,
                               szName,
                               0,
                               REG_SZ,
                               (BYTE*)szValue,
                               BYTE_SIZE(szValue)
                             );
      BREAK_ON_ERROR( hResult );
    }
    else
    {                        // Got this far so everything is OK.
      hResult = S_OK;
    }
  }while( 0 );

  RegCloseKey( hKey );       //Always attempt to close the key
  return hResult;
}

HRESULT SetValue | ( | const TCHAR * | szKey,
 |  | const TCHAR * | szValueName,
 |  | const TCHAR * | szValue
 | ) |  |

Definition at line 384 of file registry.cpp.

{
  HKEY    hKey = NULL;
  HRESULT hResult = S_FALSE;
  TCHAR szKeyBuf[1024];

  // Copy keyname into buffer.
  _tcscpy( szKeyBuf, szKey );

  do                     // We go to all this trouble to prevent any
  {                      // possibility of exiting while leaving a key open

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx( HKEY_CLASSES_ROOT ,
                                   szKeyBuf,
                                   0,
                                   NULL,
                                   REG_OPTION_NON_VOLATILE,
                                   KEY_ALL_ACCESS,
                                   NULL,
                                   &hKey,
                                   NULL
                                 );
    if( ERROR_SUCCESS != lResult )
    {
      hResult = HRESULT_FROM_WIN32( lResult );
      continue;
    }

    if( NULL != szValue )    // Now set the value
    {
      hResult = RegSetValueEx( hKey,
                               szValueName,
                               0,
                               REG_SZ,
                               (BYTE*)szValue,
                               BYTE_SIZE( szValue )
                             );
      BREAK_ON_ERROR( hResult );
    }
  }while( 0 );

  RegCloseKey( hKey );       //Always attempt to close the key
  return hResult;
}

LONG UnregisterServer ( const CLSID & clsid )

Definition at line 115 of file registry.cpp.

{
  HRESULT hResult = S_OK;

  // Allocate the CLSID string
  LPOLESTR wszCLSID = NULL ;
  hResult = StringFromCLSID( clsid, &wszCLSID );
  if( S_OK != hResult )
  {
    CoTaskMemFree( wszCLSID );
    return hResult;
  }

  // Build the key CLSID\\{...}
  TCHAR szKey[64];
  _tcscpy( szKey, _T("CLSID\\") );

  TCHAR* pszCLSID = NULL;
  W2T( &pszCLSID, wszCLSID );          // W2T is defined in Globals.h
  CoTaskMemFree( wszCLSID );           // Through with wide version

  _tcscat( szKey, pszCLSID );
  CoTaskMemFree( pszCLSID );           // Through with TCHAR version

  // Delete the CLSID Key - CLSID\{...}
  LONG lResult = RecursiveDeleteKey( HKEY_CLASSES_ROOT, szKey );
  if( ERROR_SUCCESS != lResult )
    hResult = HRESULT_FROM_WIN32( lResult );

  return hResult;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 234 of file registry.cpp.

{
  HRESULT hResult = S_OK;

  TCHAR    szKeyBuf[1024];
  LPOLESTR wszCLSID = NULL;
  TCHAR*   pszCLSID = NULL;        // Needed for TCHAR version of the ClassID

  // Get CLSID as a wide string
  hResult = StringFromCLSID( clsid, &wszCLSID );
  if( S_OK != hResult )
  {
    CoTaskMemFree( wszCLSID );
    return hResult;
  }

  W2T( &pszCLSID, wszCLSID );          // W2T is defined in Globals.h
  CoTaskMemFree( wszCLSID );           // Through with wide version

  // Load the buffer with the Snap-In Location
  _tcscpy( szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns") );

  _tcscat( szKeyBuf, _T("\\") );       // Copy keyname into buffer.
  _tcscat( szKeyBuf, pszCLSID );

  // Delete the CLSID Key - CLSID\{...}
  LONG lResult = RecursiveDeleteKey( HKEY_LOCAL_MACHINE, szKeyBuf );
  if( ERROR_SUCCESS != lResult )
    hResult = HRESULT_FROM_WIN32( lResult );

  CoTaskMemFree( pszCLSID );
  return hResult;
}

Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/contextmenu/registry.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • contextmenu
Functions

registry.h File Reference

#include <tchar.h>

Go to the source code of this file.

Functions

HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const TCHAR *szNameString, const CLSID &clsidAbout, const BOOL fSupportExtensions=FALSE)
HRESULT | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Function Documentation

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const TCHAR * | szFriendlyName
 | ) |  |

Definition at line 51 of file registry.cpp.

{
  // Get server location.
  TCHAR    szModule[512] ;
  TCHAR*   pszCLSID = NULL;
  WCHAR*   wszCLSID = NULL ;
  HRESULT  hResult  = S_FALSE;

  DWORD dwResult = ::GetModuleFileName( hModule,
                                        szModule,
                                        sizeof(szModule)/sizeof(TCHAR)
                                      );
  if( 0 == dwResult ) return HRESULT_FROM_WIN32( dwResult );

  do                         // Fail unless we complete everything
  {
    // Get CLSID string in wide char
    hResult = StringFromCLSID( clsid, &wszCLSID ) ;
    if( S_OK != hResult )
    {
      CoTaskMemFree( wszCLSID );
      BREAK_ON_ERROR( hResult );
    }

    W2T( &pszCLSID, wszCLSID );          // W2T is defined in Globals.h
    CoTaskMemFree( wszCLSID );           // Through with wide version

    TCHAR szKey[64];                     // Build the CLSID key string CLSID\\{...}
    _tcscpy( szKey, _T("CLSID\\") );
    _tcscat( szKey, pszCLSID );

    // Add the CLSID to the registry.
    hResult = SetKeyAndValue( szKey, NULL, szFriendlyName );
    BREAK_ON_ERROR( hResult );

    // Add the server filename subkey under the CLSID key.
    hResult = SetKeyAndValue( szKey, _T("InprocServer32"), szModule );
    BREAK_ON_ERROR( hResult );

    // Set the threading model
    _tcscat( szKey, _T("\\InprocServer32") );
    hResult = SetValue( szKey, _T("ThreadingModel"), _T("Apartment") );
    BREAK_ON_ERROR( hResult );

  }while( 0 );

  CoTaskMemFree( pszCLSID );           // Through with TCHAR version

  return hResult;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | fSupportExtensions = FALSE
 | ) |  |

Definition at line 149 of file registry.cpp.

{
  HRESULT hResult = S_FALSE;
  TCHAR*  pszSnapCLSID = NULL;         // Needed for TCHAR version of the ClassID

  // If any part of this process fails, jump out of the loop and return
  // the error code
  do
  {
    // Allocate the CLSID string
    LPOLESTR wszSnapCLSID  = NULL ;
    hResult = StringFromCLSID( clsid, &wszSnapCLSID ) ;
    if( S_OK != hResult )
    {
       CoTaskMemFree( wszSnapCLSID );
       continue;
    }

    W2T( &pszSnapCLSID, wszSnapCLSID );  // W2T is defined in Globals.h
    CoTaskMemFree( wszSnapCLSID );       // Through with wide version

    // Add the Snap-in's CLSID to the registry
    hResult = SetSnapInKeyAndValue( pszSnapCLSID, NULL, _T("NameString"), szNameString );
    BREAK_ON_ERROR( hResult );

    hResult = SetSnapInKeyAndValue( pszSnapCLSID, _T("StandAlone"), NULL, NULL );
    BREAK_ON_ERROR( hResult );

    // Add registry information for ISnapinAbout if we support it
    LPOLESTR wszAboutCLSID = NULL;
    TCHAR*   pszAboutCLSID = NULL;
    if( IID_NULL != clsidAbout )
    {
      hResult = StringFromCLSID( clsidAbout, &wszAboutCLSID );
      if( S_OK != hResult )
      {
        CoTaskMemFree( wszAboutCLSID ); // Free this memory before exiting
        continue;
      }

      W2T( &pszAboutCLSID, wszAboutCLSID );
      hResult = SetSnapInKeyAndValue( pszSnapCLSID, NULL, _T("About"), pszAboutCLSID );
      CoTaskMemFree( wszAboutCLSID );
      CoTaskMemFree( pszAboutCLSID );
      BREAK_ON_ERROR( hResult );
    }

    if( TRUE == bSupportExtensions )     // Build the NodeTypesKey
    {
      hResult = SetSnapInKeyAndValue( pszSnapCLSID, _T("NodeTypes"), NULL, NULL );
      BREAK_ON_ERROR( hResult );
      TCHAR szKey[64];
      _tcscpy( szKey, pszSnapCLSID );
      _tcscat(szKey, _T("\\NodeTypes"));
      hResult = SetSnapInKeyAndValue( szKey, pszSnapCLSID, NULL, NULL );
      BREAK_ON_ERROR( hResult );
    }
  }while( 0 );

  CoTaskMemFree( pszSnapCLSID);
  return hResult;
}

HRESULT UnregisterServer ( const CLSID & clsid )

Definition at line 112 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

  MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
  _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 184 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Generated on Wed Nov 13 2024 16:53:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/contextmenu/resource.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • contextmenu
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDB_APPIMG_16 104
#define | IDB_APPIMG_32 101
#define | IDB_NODEIMAGES_16 106
#define | IDB_NODEIMAGES_32 107
#define | IDC_ARCHIVE_ATTR 1000
#define | IDC_BACKUP_FLAG 1005
#define | IDC_DEVNAME_EDIT 1004
#define | IDC_HIDDEN_ATTR 1001
#define | IDC_LOCKED_ATTR 1002
#define | IDC_READONLY_ATTR 1003
#define | IDD_ADDDEVICE_DLG 109
#define | IDD_BASE_DIALOG 108
#define | IDI_APP_ICON 105

Define Documentation

#define IDB_APPIMG_16 104

Definition at line 6 of file resource.h.

#define IDB_APPIMG_32 101

Definition at line 5 of file resource.h.

#define IDB_NODEIMAGES_16 106

Definition at line 8 of file resource.h.

#define IDB_NODEIMAGES_32 107

Definition at line 9 of file resource.h.

#define IDC_ARCHIVE_ATTR 1000

Definition at line 12 of file resource.h.

#define IDC_BACKUP_FLAG 1005

Definition at line 17 of file resource.h.

#define IDC_DEVNAME_EDIT 1004

Definition at line 16 of file resource.h.

#define IDC_HIDDEN_ATTR 1001

Definition at line 13 of file resource.h.

#define IDC_LOCKED_ATTR 1002

Definition at line 14 of file resource.h.

#define IDC_READONLY_ATTR 1003

Definition at line 15 of file resource.h.

#define IDD_ADDDEVICE_DLG 109

Definition at line 11 of file resource.h.

#define IDD_BASE_DIALOG 108

Definition at line 10 of file resource.h.

#define IDI_APP_ICON 105

Definition at line 7 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/contextmenu/staticnode.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • contextmenu
Defines

staticnode.cpp File Reference

#include "StaticNode.h"
#include "DeviceNode.h"
#include "CompData.h"
#include "Comp.h"
#include "AddDeviceDlg.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CStaticNode")

Define Documentation

#define MODULESTRING _T("CStaticNode")

Definition at line 25 of file staticnode.cpp.

Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/contextmenu/staticnode.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • contextmenu
Classes

staticnode.h File Reference

#include "Globals.h"
#include "BaseNode.h"
#include "LListImpl.h"
#include "LListImpl.h"

Go to the source code of this file.

Classes

class CStaticNode
Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/contextmenu/tracemacro.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • contextmenu
Functions

tracemacro.cpp File Reference

#include "Globals.h"
#include "TraceMacro.h"
#include <StdIo.h>

Go to the source code of this file.

Functions

VOID | MapEvent (LONG Event, LPTSTR szEventStr)
VOID | Trace_Event (LPCTSTR pszClass, LPCTSTR pszFunction, LONG nEvent)
VOID | Trace_HR (LPCTSTR pszClass, LPCTSTR pszFunction, HRESULT hr)
VOID | Trace_Pointer (LPCTSTR pszClass, LPCTSTR pszFunction, LPCTSTR pszAction, ULONG ulValue)
VOID | Trace_Start (LPCTSTR pszClass, LPCTSTR pszFunction)
VOID | Trace_Value (LPCTSTR pszClass, LPCTSTR pszFunction, LPCTSTR pszValueName, LONG nValue)

Function Documentation

VOID MapEvent | ( | LONG | Event,
 |  | LPTSTR | szEventStr
 | ) |  |

Definition at line 179 of file tracemacro.cpp.

{
#ifdef _DEBUG

  switch( Event )
  {
    case MMCN_ACTIVATE:
      _tcscpy( szEventStr, _T("MMCN_ACTIVATE          ") );
      break;

    case MMCN_ADD_IMAGES:
      _tcscpy( szEventStr, _T("MMCN_ADD_IMAGES        ") );
      break;

    case MMCN_BTN_CLICK:
      _tcscpy( szEventStr, _T("MMCN_BTN_CLICK         ") );
      break;

    case MMCN_CLICK:
      _tcscpy( szEventStr, _T("MMCN_CLICK             ") );
      break;

    case MMCN_COLUMN_CLICK:
      _tcscpy( szEventStr, _T("MMCN_COLUMN_CLICK       ") );
      break;

    case MMCN_CONTEXTMENU:
      _tcscpy( szEventStr, _T("MMCN_CONTEXTMENU        ") );
      break;

    case MMCN_CUTORMOVE:
      _tcscpy( szEventStr, _T("MMCN_CUTORMOVE          ") );
      break;

    case MMCN_DBLCLICK:
      _tcscpy( szEventStr, _T("MMCN_DBLCLICK           ") );
      break;

    case MMCN_DELETE:
      _tcscpy( szEventStr, _T("MMCN_DELETE             ") );
      break;

    case MMCN_DESELECT_ALL:
      _tcscpy( szEventStr, _T("MMCN_DESELECT_ALL       ") );
      break;

    case MMCN_EXPAND:
      _tcscpy( szEventStr, _T("MMCN_EXPAND             ") );
      break;

    case MMCN_HELP:
      _tcscpy( szEventStr, _T("MMCN_HELP               ") );
      break;

    case MMCN_MENU_BTNCLICK:
      _tcscpy( szEventStr, _T("MMCN_MENU_BTNCLICK      ") );
      break;

    case MMCN_MINIMIZED:
      _tcscpy( szEventStr, _T("MMCN_MINIMIZED          ") );
      break;

    case MMCN_PASTE:
      _tcscpy( szEventStr, _T("MMCN_PASTE              ") );
      break;

    case MMCN_PROPERTY_CHANGE:
      _tcscpy( szEventStr, _T("MMCN_PROPERTY_CHANGE    ") );
      break;

    case MMCN_QUERY_PASTE:
      _tcscpy( szEventStr, _T("MMCN_QUERY_PASTE        ") );
      break;

    case MMCN_REFRESH:
      _tcscpy( szEventStr, _T("MMCN_REFRESH            ") );
      break;

    case MMCN_REMOVE_CHILDREN:
      _tcscpy( szEventStr, _T("MMCN_REMOVE_CHILDREN    ") );
      break;

    case MMCN_RENAME:
      _tcscpy( szEventStr, _T("MMCN_RENAME             ") );
      break;

    case MMCN_SELECT:
      _tcscpy( szEventStr, _T("MMCN_SELECT             ") );
      break;

    case MMCN_SHOW:
      _tcscpy( szEventStr, _T("MMCN_SHOW               ") );
      break;

    case MMCN_VIEW_CHANGE:
      _tcscpy( szEventStr, _T("MMCN_VIEW_CHANGE        ") );
      break;

    case MMCN_SNAPINHELP:
      _tcscpy( szEventStr, _T("MMCN_SNAPINHELP         ") );
      break;

    case MMCN_CONTEXTHELP:
      _tcscpy( szEventStr, _T("MMCN_CONTEXTHELP        ") );
      break;

    case MMCN_INITOCX:
      _tcscpy( szEventStr, _T("MMCN_INITOCX            ") );
      break;

    // MMC Version 1.1 notifications
    case MMCN_FILTER_CHANGE:
      _tcscpy( szEventStr, _T("MMCN_FILTER_CHANGE      ") );
      break;

    case MMCN_FILTERBTN_CLICK:
      _tcscpy( szEventStr, _T("MMCN_FILTERBTN_CLICK    ") );
      break;

    case MMCN_RESTORE_VIEW:
      _tcscpy( szEventStr, _T("MMCN_RESTORE_VIEW       ") );
      break;

    case MMCN_PRINT:
      _tcscpy( szEventStr, _T("MMCN_PRINT              ") );
      break;

    case MMCN_PRELOAD:
      _tcscpy( szEventStr, _T("MMCN_PRELOAD            ") );
      break;

    case MMCN_LISTPAD:
      _tcscpy( szEventStr, _T("MMCN_LISTPAD            ") );
      break;

    case MMCN_EXPANDSYNC:
      _tcscpy( szEventStr, _T("MMCN_EXPANDSYNC         ") );
      break;

    // MMC Version 1.2 notifications
    case MMCN_COLUMNS_CHANGED:
      _tcscpy( szEventStr, _T("MMCN_COLUMNS_CHANGED    ") );
      break;

    // MMC Version 2.0 notifications
    case MMCN_CANPASTE_OUTOFPROC:
      _tcscpy( szEventStr, _T("MMCN_CANPASTE_OUTOFPROC ") );
      break;

    default:
      _stprintf( szEventStr, _T("0x%X"), Event );
      break;
  }

#endif
} //end MapEvent()

VOID Trace_Event | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LONG | nEvent
 | ) |  |

Definition at line 119 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szEventStr[64];
  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Event = %s\n");
  INT    nChars     = 0;

  MapEvent( nEvent, szEventStr );

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      szEventStr
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Event()

VOID Trace_HR | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | HRESULT | hr
 | ) |  |

Definition at line 28 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Returned 0x%X\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer, szFormat, pszClass, pszFunction, hr );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_HR()

VOID Trace_Pointer | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LPCTSTR | pszAction,
 |  | ULONG | ulValue
 | ) |  |

Definition at line 86 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> %s = 0x%X\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      pszAction,
                      ulValue
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Pointer()

VOID Trace_Start | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction
 | ) |  |

Definition at line 151 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Started \n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Start()

VOID Trace_Value | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LPCTSTR | pszValueName,
 |  | LONG | nValue
 | ) |  |

Definition at line 54 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> %s = %u\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      pszValueName,
                      nValue
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Value()

Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/contextmenu/tracemacro.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • contextmenu
Defines | Functions

tracemacro.h File Reference

Go to the source code of this file.

Defines

#define | TRACE_EVENT
#define | TRACE_HRESULT
#define | TRACE_PTR
#define | TRACE_START
#define | TRACE_VAL

Functions

VOID | MapEvent (LONG Event, LPTSTR szEventStr)
VOID | Trace_Event (LPCTSTR pszClass, LPCTSTR pszFunction, LONG nEvent)
VOID | Trace_HR (LPCTSTR pszClass, LPCTSTR pszFunction, HRESULT hr)
VOID | Trace_Pointer (LPCTSTR pszClass, LPCTSTR pszFunction, LPCTSTR pszAction, ULONG ulValue)
VOID | Trace_Start (LPCTSTR pszClass, LPCTSTR pszFunction)
VOID | Trace_Value (LPCTSTR pszClass, LPCTSTR pszFunction, LPCTSTR pszValueName, LONG nValue)

Define Documentation

#define TRACE_EVENT

Definition at line 64 of file tracemacro.h.

#define TRACE_HRESULT

Definition at line 55 of file tracemacro.h.

#define TRACE_PTR

Definition at line 61 of file tracemacro.h.

#define TRACE_START

Definition at line 67 of file tracemacro.h.

#define TRACE_VAL

Definition at line 58 of file tracemacro.h.

Function Documentation

VOID MapEvent | ( | LONG | Event,
 |  | LPTSTR | szEventStr
 | ) |  |

Definition at line 146 of file tracemacro.cpp.

{
#ifdef _DEBUG

  switch( Event )
  {
    case 0x8001:
      _tcscpy( szEventStr, _T("MMCN_ACTIVATE       ") );
      break;

    case 0x8002:
      _tcscpy( szEventStr, _T("MMCN_ADD_IMAGES     ") );
      break;

    case 0x8003:
      _tcscpy( szEventStr, _T("MMCN_BTN_CLICK      ") );
      break;

    case 0x8004:
      _tcscpy( szEventStr, _T("MMCN_CLICK          ") );
      break;

    case 0x8005:
      _tcscpy( szEventStr, _T("MMCN_COLUMN_CLICK   ") );
      break;

    case 0x8006:
      _tcscpy( szEventStr, _T("MMCN_CONTEXTMENU    ") );
      break;

    case 0x8007:
      _tcscpy( szEventStr, _T("MMCN_CUTORMOVE      ") );
      break;

    case 0x8008:
      _tcscpy( szEventStr, _T("MMCN_DBLCLICK       ") );
      break;

    case 0x8009:
      _tcscpy( szEventStr, _T("MMCN_DELETE         ") );
      break;

    case 0x800A:
      _tcscpy( szEventStr, _T("MMCN_DESELECT_ALL   ") );
      break;

    case 0x800B:
      _tcscpy( szEventStr, _T("MMCN_EXPAND         ") );
      break;

    case 0x800C:
      _tcscpy( szEventStr, _T("MMCN_HELP           ") );
      break;

    case 0x800D:
      _tcscpy( szEventStr, _T("MMCN_MENU_BTNCLICK  ") );
      break;

    case 0x800E:
      _tcscpy( szEventStr, _T("MMCN_MINIMIZED      ") );
      break;

    case 0x800F:
      _tcscpy( szEventStr, _T("MMCN_PASTE          ") );
      break;

    case 0x8010:
      _tcscpy( szEventStr, _T("MMCN_PROPERTY_CHANGE") );
      break;

    case 0x8011:
      _tcscpy( szEventStr, _T("MMCN_QUERY_PASTE    ") );
      break;

    case 0x8012:
      _tcscpy( szEventStr, _T("MMCN_REFRESH        ") );
      break;

    case 0x8013:
      _tcscpy( szEventStr, _T("MMCN_REMOVE_CHILDREN") );
      break;

    case 0x8014:
      _tcscpy( szEventStr, _T("MMCN_RENAME         ") );
      break;

    case 0x8015:
      _tcscpy( szEventStr, _T("MMCN_SELECT         ") );
      break;

    case 0x8016:
      _tcscpy( szEventStr, _T("MMCN_SHOW           ") );
      break;

    case 0x8017:
      _tcscpy( szEventStr, _T("MMCN_VIEW_CHANGE    ") );
      break;

    case 0x8018:
      _tcscpy( szEventStr, _T("MMCN_SNAPINHELP     ") );
      break;

    case 0x8019:
      _tcscpy( szEventStr, _T("MMCN_CONTEXTHELP    ") );
      break;

    case 0x801A:
      _tcscpy( szEventStr, _T("MMCN_INITOCX        ") );
      break;

    case 0x8021:
      _tcscpy( szEventStr, _T("MMCN_EXPANDSYNC     ") );
      break;

    default:
      _stprintf( szEventStr, _T("0x%X"), Event );
      break;
  }

#endif
} //end MapEvent()

VOID Trace_Event | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LONG | nEvent
 | ) |  |

Definition at line 86 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szEventStr[22];
  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Event = %s\n");
  INT    nChars     = 0;

  MapEvent( nEvent, szEventStr );

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      szEventStr
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Event()

VOID Trace_HR | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | HRESULT | hr
 | ) |  |

Definition at line 27 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Returned 0x%X\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer, szFormat, pszClass, pszFunction, hr );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_HR()

VOID Trace_Pointer | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LPCTSTR | pszAction,
 |  | ULONG | ulValue
 | ) |  |

Definition at line 86 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> %s = 0x%X\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      pszAction,
                      ulValue
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Pointer()

VOID Trace_Start | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction
 | ) |  |

Definition at line 118 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Started \n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Start()

VOID Trace_Value | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LPCTSTR | pszValueName,
 |  | LONG | nValue
 | ) |  |

Definition at line 53 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> %s = %u\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      pszValueName,
                      nValue
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Value()

Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/contextmenuex/basesnap.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • contextmenuex
Defines | Functions

basesnap.cpp File Reference

#include <ObjBase.h>
#include <InitGuid.h>
#include "Globals.h"
#include "BaseSnap.h"
#include "Registry.h"
#include "ContextMenuEx.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define | MODULESTRING _T("BaseSnap")

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)
BOOL WINAPI | DllMain (HINSTANCE hInstDLL, DWORD fdwReason, void *lpvReserved)
STDAPI | DllRegisterServer ()
STDAPI | DllUnregisterServer ()
STDMETHODIMP_ (ULONG) CClassFactory

Define Documentation

#define MODULESTRING _T("BaseSnap")

Definition at line 27 of file basesnap.cpp.

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 219 of file basesnap.cpp.

{
  if( 0 == g_uObjectCount && 0 == g_uServerLocks )
    return S_OK;
  else
    return S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 185 of file basesnap.cpp.

{
  //CONTEXTMENUX: Test for our class
  if( (rclsid != CLSID_CExtendContextMenuEx) )
    return CLASS_E_CLASSNOTAVAILABLE;

  if( !ppvObj )
    return E_FAIL;

  *ppvObj = NULL;

  // We can only hand out IUnknown and IClassFactory pointers.  Fail
  // if caller asks for anything else.
  if( !IsEqualIID(riid, IID_IUnknown) && !IsEqualIID(riid, IID_IClassFactory) )
    return E_NOINTERFACE;

  CClassFactory *pFactory = NULL;

  // CONTEXTMENUX: Create the new class factory.  Pass in the type of object to create
  if( rclsid == CLSID_CExtendContextMenuEx )
    pFactory = new CClassFactory(CClassFactory::CONTEXTMENUX);

  HRESULT hResult = pFactory->QueryInterface( riid, ppvObj );

  return hResult;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstDLL,
 |  | DWORD | fdwReason,
 |  | void * | lpvReserved
 | ) |  |

Definition at line 168 of file basesnap.cpp.

{
  if( DLL_PROCESS_ATTACH == fdwReason )
  {
     g_hInst = hInstDLL;
  }

  return TRUE;
}

STDAPI DllRegisterServer ( void )

Definition at line 231 of file basesnap.cpp.

{
  HRESULT hResult = S_FALSE;

  do
  {
    hResult = RegisterServer( g_hInst, CLSID_CExtendContextMenuEx, gtszSNAPIN_NAME );
    BREAK_ON_ERROR( hResult );

    hResult = RegisterSnapin( CLSID_CExtendContextMenuEx, gtszSNAPIN_NAME, IID_NULL, FALSE );
    BREAK_ON_ERROR( hResult );

  }while( 0 );

  return hResult;
}

STDAPI DllUnregisterServer ( void )

Definition at line 252 of file basesnap.cpp.

{
  if( S_OK == UnregisterServer(CLSID_CExtendContextMenuEx) )
    return UnregisterSnapin(CLSID_CExtendContextMenuEx);
  else
    return E_FAIL;
}

STDMETHODIMP_ ( ULONG )

Definition at line 90 of file basesnap.cpp.

{
  if( 0 == InterlockedDecrement( (long*)&m_cRef) )
  {
    delete this;
    return 0;
  }
  return m_cRef;
}

Generated on Wed Nov 13 2024 16:54:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/contextmenuex/basesnap.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • contextmenuex
Classes | Functions

basesnap.h File Reference

Go to the source code of this file.

Classes

class | CClassFactory

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 53 of file ComSpyAudit.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 61 of file ComSpyAudit.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

Generated on Wed Nov 13 2024 16:54:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/contextmenuex/contextmenuex.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • contextmenuex
Defines | Functions

contextmenuex.cpp File Reference

#include "Globals.h"
#include "ContextMenuEx.h"
#include "Resource.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CExtendContextMenuEx")

Functions

STDMETHODIMP_ (ULONG) CExtendContextMenuEx

Define Documentation

#define MODULESTRING _T("CExtendContextMenuEx")

Definition at line 22 of file contextmenuex.cpp.

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 63 of file contextmenuex.cpp.

{
  if( InterlockedDecrement((LONG*)&m_cRef) == 0 )
  {
    delete this;
    return 0;
  }
  return m_cRef;
}

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/contextmenuex/contextmenuex.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • contextmenuex
Classes

contextmenuex.h File Reference

#include "Globals.h"

Go to the source code of this file.

Classes

class CExtendContextMenuEx
Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/contextmenuex/globals.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • contextmenuex
Functions | Variables

globals.cpp File Reference

#include "Globals.h"

Go to the source code of this file.

Functions

void _fastcall | Unicode2Ansi (CHAR **pszAnsi, WCHAR *szWide)

Variables

HINSTANCE | g_hInst = NULL
ULONG | g_uObjectCount = 0
ULONG | g_uServerLocks = 0

Function Documentation

void _fastcall Unicode2Ansi | ( | CHAR ** | pszAnsi,
 |  | WCHAR * | szWide
 | ) |  |

Definition at line 29 of file globals.cpp.

{
  LONG nLen = wcslen( szWide ) +1;
  *pszAnsi = (char*)CoTaskMemAlloc( nLen );
  char* pCounter = *pszAnsi;

  while( *szWide )
  {
    *pCounter = LOBYTE(*szWide);
    pCounter++;
    szWide++;
  }
  *pCounter = NULL;
}

Variable Documentation

HINSTANCE g_hInst = NULL

Definition at line 18 of file globals.cpp.

ULONG g_uObjectCount = 0

Definition at line 19 of file globals.cpp.

ULONG g_uServerLocks = 0

Definition at line 20 of file globals.cpp.

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/contextmenuex/globals.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • contextmenuex
Defines | Functions | Variables

globals.h File Reference

#include <TChar.h>
#include <Mmc.h>
#include <CrtDbg.h>
#include "Guids.h"
#include "Guids.h"

Go to the source code of this file.

Defines

#define | BREAK_ON_ERROR(hResult) if( S_OK != hResult ) continue
#define | BYTE_SIZE(string) ((_tcslen(string)+1) * sizeof(TCHAR))
#define | IDM_QUERY_ATTRIBS 2000
#define | MAX_OBJECT_PATH 255
#define | MsgBox(wszMsg, wszTitle) ::MessageBox(NULL, wszMsg, wszTitle, MB_OK)
#define | W2T(szAnsiPtr, szWide) Unicode2Ansi( szAnsiPtr, szWide )

Functions

template<class TYPE >
void | SAFE_FREE_BITMAP (TYPE *&pObj)
template<class TYPE >
void | SAFE_FREE_ICON (TYPE *&pObj)
template<class TYPE >
void | SAFE_RELEASE (TYPE *&pObj)
void _fastcall | Unicode2Ansi (CHAR **pszAnsi, WCHAR *szWide)

Variables

HINSTANCE | g_hInst
ULONG g_uObjectCount
ULONG g_uServerLocks

Define Documentation

#define BREAK_ON_ERROR ( hResult ) if( S_OK != hResult ) continue

Definition at line 60 of file globals.h.

#define BYTE_SIZE ( string ) ((_tcslen(string)+1) * sizeof(TCHAR))

Definition at line 58 of file globals.h.

#define IDM_QUERY_ATTRIBS 2000

Definition at line 33 of file globals.h.

#define MAX_OBJECT_PATH 255

Definition at line 31 of file globals.h.

#define MsgBox | ( | wszMsg,
 |  | wszTitle |
 | ) |  | ::MessageBox(NULL, wszMsg, wszTitle, MB_OK)

Definition at line 63 of file globals.h.

#define W2T | ( | szAnsiPtr,
 |  | szWide |
 | ) |  | Unicode2Ansi( szAnsiPtr, szWide )

Definition at line 116 of file globals.h.

Function Documentation

template<class TYPE >
void SAFE_FREE_BITMAP ( TYPE *& pObj ) [inline]

Definition at line 83 of file globals.h.

{
  if( NULL != pObj )
  {
    BOOL bStatus = DeleteObject( pObj );
    pObj = NULL;
  }
  else
  {
    OutputDebugString(_T("Attempted to delete NULL Bitmap handle.\n"));
  }
}

template<class TYPE >
void SAFE_FREE_ICON ( TYPE *& pObj ) [inline]

Definition at line 98 of file globals.h.

{
  if( NULL != pObj )
  {
    BOOL bStatus = DestroyIcon( pObj );
    pObj = NULL;
  }
  else
  {
    OutputDebugString(_T("Attempted to delete NULL Icon handle.\n"));
  }
}

template<class TYPE >
void SAFE_RELEASE ( TYPE *& pObj ) [inline]

Definition at line 68 of file globals.h.

{
  if( NULL != pObj )
  {
    pObj->Release();
    pObj = NULL;
  }
  else
  {
    OutputDebugString(_T("Attempted to release NULL Com pointer.\n"));
  }
}

void _fastcall Unicode2Ansi | ( | CHAR ** | pszAnsi,
 |  | WCHAR * | szWide
 | ) |  |

Definition at line 38 of file globals.cpp.

{
  LONG nLen = wcslen( szWide ) +1;
  *pszAnsi = (char*)CoTaskMemAlloc( nLen );
  char* pCounter = *pszAnsi;

  while( *szWide )
  {
    *pCounter = LOBYTE(*szWide);
    pCounter++;
    szWide++;
  }
  *pCounter = NULL;
}

Variable Documentation

HINSTANCE g_hInst

Definition at line 62 of file DoServer.Cpp.

ULONG g_uObjectCount

Definition at line 28 of file globals.cpp.

ULONG g_uServerLocks

Definition at line 29 of file globals.cpp.

Generated on Wed Nov 13 2024 16:54:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/contextmenuex/guids.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • contextmenuex
Functions

guids.h File Reference

Go to the source code of this file.

Functions

DEFINE_GUID (CLSID_CExtendContextMenuEx, 0x6568a231, 0xd647, 0x4e60, 0xbb, 0x38, 0xb8, 0xb3, 0x87, 0x8b, 0x9d, 0xdf)

Function Documentation

DEFINE_GUID | ( | CLSID_CExtendContextMenuEx | ,
 |  | 0x6568a231 | ,
 |  | 0xd647 | ,
 |  | 0x4e60 | ,
 |  | 0xbb | ,
 |  | 0x38 | ,
 |  | 0xb8 | ,
 |  | 0xb3 | ,
 |  | 0x87 | ,
 |  | 0x8b | ,
 |  | 0x9d | ,
 |  | 0xdf |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/contextmenuex/registry.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • contextmenuex
Defines | Functions

registry.cpp File Reference

#include <ObjBase.h>
#include "Registry.h"
#include "Globals.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define | MODULESTRING _T("Registry")

Functions

HRESULT | RecursiveDeleteKey (HKEY hKeyParent, const TCHAR *szKeyChild)
HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const TCHAR *szNameString, const CLSID &clsidAbout, const BOOL bSupportExtensions)
HRESULT | SetExtensionKey (const TCHAR *szNodeType)
HRESULT | SetKeyAndValue (const TCHAR *pszPath, const TCHAR *szSubkey, const TCHAR *szValue)
HRESULT | SetSnapInKeyAndValue (const TCHAR *szKey, const TCHAR *szSubkey, const TCHAR *szName, const TCHAR *szValue)
HRESULT | SetValue (const TCHAR *szKey, const TCHAR *szValueName, const TCHAR *szValue)
LONG | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Define Documentation

#define MODULESTRING _T("Registry")

Definition at line 22 of file registry.cpp.

Function Documentation

HRESULT RecursiveDeleteKey | ( | HKEY | hKeyParent,
 |  | const TCHAR * | szKeyChild
 | ) |  |

Definition at line 240 of file registry.cpp.

{
  // Open the child.
  HKEY hKeyChild = NULL;
  LONG lResult   = ERROR_SUCCESS;

  do                     // We go to all this trouble to prevent any
  {                      // possibility of exiting while leaving a key open

    lResult = RegOpenKeyEx( hKeyParent,
                            lpszKeyChild,
                            0,
                            KEY_ALL_ACCESS,
                            &hKeyChild
                          );
    if( ERROR_SUCCESS != lResult )
      continue;

    // Enumerate all of the decendents of this child.
    FILETIME time;
    _TCHAR szBuffer[256];
    DWORD dwSize = 256;
    while( S_OK == RegEnumKeyEx(hKeyChild,0,szBuffer,&dwSize,NULL,NULL,NULL,&time) )
    {
      // Delete the decendents of this child.
      lResult = RecursiveDeleteKey( hKeyChild, szBuffer );
      if( ERROR_SUCCESS != lResult )
      {
        continue;
      }
      dwSize = 256;
    }
  }while( 0 );

  RegCloseKey( hKeyChild );            // Always try to close the child
                                       // then delete this child.
  return RegDeleteKey( hKeyParent, lpszKeyChild );
}

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const TCHAR * | szFriendlyName
 | ) |  |

Definition at line 53 of file registry.cpp.

{
  // Get server location.
  TCHAR    szModule[512] ;
  TCHAR*   pszCLSID = NULL;
  LPOLESTR wszCLSID = NULL ;
  HRESULT  hResult  = S_FALSE;

  DWORD dwResult = ::GetModuleFileName( hModule,
                                        szModule,
                                        sizeof(szModule)/sizeof(TCHAR)
                                      );
  if( 0 == dwResult ) return HRESULT_FROM_WIN32( dwResult );

  do                         // Fail unless we complete everything
  {
    // Get CLSID string in wide char
    hResult = StringFromCLSID( clsid, &wszCLSID ) ;
    if( S_OK != hResult )
    {
      CoTaskMemFree( wszCLSID );
      BREAK_ON_ERROR( hResult );
    }

    W2T( &pszCLSID, wszCLSID );          // W2T is defined in Globals.h
    CoTaskMemFree( wszCLSID );           // Through with wide version

    TCHAR szKey[64];                     // Build the CLSID key string CLSID\\{...}
    _tcscpy( szKey, _T("CLSID\\") );
    _tcscat( szKey, pszCLSID );

    // Add the CLSID to the registry.
    hResult = SetKeyAndValue( szKey, NULL, szFriendlyName );
    BREAK_ON_ERROR( hResult );

    // Add the server filename subkey under the CLSID key.
    hResult = SetKeyAndValue( szKey, _T("InprocServer32"), szModule );
    BREAK_ON_ERROR( hResult );

    // Set the threading model
    _tcscat( szKey, _T("\\InprocServer32") );
    hResult = SetValue( szKey, _T("ThreadingModel"), _T("Apartment") );
    BREAK_ON_ERROR( hResult );

  }while( 0 );

  CoTaskMemFree( pszCLSID );           // Through with TCHAR version

  return hResult;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | bSupportExtensions
 | ) |  |

Definition at line 151 of file registry.cpp.

{
  HRESULT hResult = S_FALSE;
  TCHAR*  pszSnapCLSID = NULL;         // Needed for TCHAR version of the ClassID

  // If any part of this process fails, jump out of the loop and return
  // the error code
  do
  {
    // Allocate the CLSID string
    LPOLESTR wszSnapCLSID  = NULL ;
    hResult = StringFromCLSID( clsid, &wszSnapCLSID ) ;
    if( S_OK != hResult )
    {
       CoTaskMemFree( wszSnapCLSID );
       continue;
    }

    W2T( &pszSnapCLSID, wszSnapCLSID );  // W2T is defined in Globals.h
    CoTaskMemFree( wszSnapCLSID );       // Through with wide version

    // Add the Snap-in's CLSID to the registry
    hResult = SetSnapInKeyAndValue( pszSnapCLSID, NULL, _T("NameString"), szNameString );
    BREAK_ON_ERROR( hResult );

    // Extensions don't support ISnapinAbout, so this is not handled
    //
    if( TRUE == bSupportExtensions )     // Build the NodeTypesKey
    {
    }

  }while( 0 );

  hResult = SetExtensionKey( gtszDEVICE_GUID );

  CoTaskMemFree( pszSnapCLSID);
  return hResult;
}

HRESULT SetExtensionKey ( const TCHAR * szNodeType )

Definition at line 474 of file registry.cpp.

{
  HKEY    hNodeKey = NULL;
  HRESULT hResult  = S_FALSE;
  TCHAR   szKeyBuf[1024];

  // Load the buffer with the NodeTypes Location
  _tcscpy( szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\NodeTypes") );

  _tcscat( szKeyBuf, _T("\\") );       // Copy NodeType GUID into buffer.
  _tcscat( szKeyBuf, szNodeType );

  _tcscat( szKeyBuf, _T("\\") );       // Copy Subkeys into buffer
  _tcscat( szKeyBuf, _T("Extensions\\ContextMenu") );

  long lResult = RegCreateKeyEx( HKEY_LOCAL_MACHINE,
                                 szKeyBuf,
                                 0,
                                 NULL,
                                 REG_OPTION_NON_VOLATILE,
                                 KEY_ALL_ACCESS,
                                 NULL,
                                 &hNodeKey,
                                 NULL
                               );

  if( ERROR_SUCCESS != lResult )     // Will return S_FALSE
  {
    RegCloseKey( hNodeKey );
    return S_FALSE;
  }

  hResult = RegSetValueEx( hNodeKey,
                           gtszCTXMENUX_GUID,
                           0,
                           REG_SZ,
                           (BYTE*)gtszOBJECT_NAME,
                           BYTE_SIZE(gtszOBJECT_NAME)
                         );

  return hResult;
}

HRESULT SetKeyAndValue | ( | const TCHAR * | pszPath,
 |  | const TCHAR * | szSubkey,
 |  | const TCHAR * | szValue
 | ) |  |

Definition at line 288 of file registry.cpp.

{
  HKEY hKey = NULL;
  HRESULT hResult = S_FALSE;
  TCHAR szKeyBuf[1024];

  // Copy keyname into buffer.
  _tcscpy( szKeyBuf, szKey );

  // Add subkey name to buffer.
  if( NULL != szSubkey )
  {
    _tcscat( szKeyBuf, _T("\\") );
    _tcscat( szKeyBuf, szSubkey );
  }

  do                     // We go to all this trouble to prevent any
  {                      // possibility of exiting while leaving a key open

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx( HKEY_CLASSES_ROOT,
                                   szKeyBuf,
                                   0,
                                   NULL,
                                   REG_OPTION_NON_VOLATILE,
                                   KEY_ALL_ACCESS,
                                   NULL,
                                   &hKey,
                                   NULL
                                 );
    if( ERROR_SUCCESS != lResult )
    {
      hResult = HRESULT_FROM_WIN32( lResult );
      continue;
    }

    if( NULL != szValue )    // Now set the value
    {
      hResult = RegSetValueEx( hKey,
                               NULL,
                               0,
                               REG_SZ,
                               (BYTE*)szValue,
                               BYTE_SIZE( szValue )    // BYTE_SIZE is in Globals.h
                             );
      BREAK_ON_ERROR( hResult );
    }
  }while( 0 );

  RegCloseKey( hKey );       // Always try to close the key
  return hResult;
}

HRESULT SetSnapInKeyAndValue | ( | const TCHAR * | szKey,
 |  | const TCHAR * | szSubkey,
 |  | const TCHAR * | szName,
 |  | const TCHAR * | szValue
 | ) |  |

Definition at line 407 of file registry.cpp.

{
  HKEY    hKey = NULL;
  HRESULT hResult = S_FALSE;
  TCHAR   szKeyBuf[1024];

  // Load the buffer with the Snap-In Location
  _tcscpy( szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns") );

  _tcscat( szKeyBuf, _T("\\") );       // Copy keyname into buffer.
  _tcscat( szKeyBuf, szKey );

  if( NULL != szSubkey )               // Add subkey name to buffer.
  {
    _tcscat( szKeyBuf, _T("\\") );
    _tcscat( szKeyBuf, szSubkey );
  }

  do                     // We go to all this trouble to prevent any
  {                      // possibility of exiting while leaving a key open

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx( HKEY_LOCAL_MACHINE,
                                   szKeyBuf,
                                   0,
                                   NULL,
                                   REG_OPTION_NON_VOLATILE,
                                   KEY_ALL_ACCESS,
                                   NULL,
                                   &hKey,
                                   NULL
                                 );
    if( ERROR_SUCCESS != lResult )     // Will return S_FALSE
      continue;

    // Set the Value.
    if( szValue != NULL )
    {
      hResult = RegSetValueEx( hKey,
                               szName,
                               0,
                               REG_SZ,
                               (BYTE*)szValue,
                               BYTE_SIZE(szValue)
                             );
      BREAK_ON_ERROR( hResult );
    }
    else
    {                        // Got this far so everything is OK.
      hResult = S_OK;
    }
  }while( 0 );

  RegCloseKey( hKey );       //Always attempt to close the key
  return hResult;
}

HRESULT SetValue | ( | const TCHAR * | szKey,
 |  | const TCHAR * | szValueName,
 |  | const TCHAR * | szValue
 | ) |  |

Definition at line 350 of file registry.cpp.

{
  HKEY    hKey = NULL;
  HRESULT hResult = S_FALSE;
  TCHAR szKeyBuf[1024];

  // Copy keyname into buffer.
  _tcscpy( szKeyBuf, szKey );

  do                     // We go to all this trouble to prevent any
  {                      // possibility of exiting while leaving a key open

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx( HKEY_CLASSES_ROOT ,
                                   szKeyBuf,
                                   0,
                                   NULL,
                                   REG_OPTION_NON_VOLATILE,
                                   KEY_ALL_ACCESS,
                                   NULL,
                                   &hKey,
                                   NULL
                                 );
    if( ERROR_SUCCESS != lResult )
    {
      hResult = HRESULT_FROM_WIN32( lResult );
      continue;
    }

    if( NULL != szValue )    // Now set the value
    {
      hResult = RegSetValueEx( hKey,
                               szValueName,
                               0,
                               REG_SZ,
                               (BYTE*)szValue,
                               BYTE_SIZE( szValue )
                             );
      BREAK_ON_ERROR( hResult );
    }
  }while( 0 );

  RegCloseKey( hKey );       //Always attempt to close the key
  return hResult;
}

LONG UnregisterServer ( const CLSID & clsid )

Definition at line 113 of file registry.cpp.

{
  HRESULT hResult = S_OK;

  // Allocate the CLSID string
  LPOLESTR wszCLSID = NULL ;
  hResult = StringFromCLSID( clsid, &wszCLSID );
  if( S_OK != hResult )
  {
    CoTaskMemFree( wszCLSID );
    return hResult;
  }

  // Build the key CLSID\\{...}
  TCHAR szKey[64];
  _tcscpy( szKey, _T("CLSID\\") );

  TCHAR* pszCLSID = NULL;
  W2T( &pszCLSID, wszCLSID );          // W2T is defined in Globals.h
  CoTaskMemFree( wszCLSID );           // Through with wide version

  _tcscat( szKey, pszCLSID );
  CoTaskMemFree( pszCLSID );           // Through with TCHAR version

  // Delete the CLSID Key - CLSID\{...}
  LONG lResult = RecursiveDeleteKey( HKEY_CLASSES_ROOT, szKey );
  if( ERROR_SUCCESS != lResult )
    hResult = HRESULT_FROM_WIN32( lResult );

  return hResult;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 200 of file registry.cpp.

{
  HRESULT hResult = S_OK;

  TCHAR    szKeyBuf[1024];
  LPOLESTR wszCLSID = NULL;
  TCHAR*   pszCLSID = NULL;        // Needed for TCHAR version of the ClassID

  // Get CLSID as a wide string
  hResult = StringFromCLSID( clsid, &wszCLSID );
  if( S_OK != hResult )
  {
    CoTaskMemFree( wszCLSID );
    return hResult;
  }

  W2T( &pszCLSID, wszCLSID );          // W2T is defined in Globals.h
  CoTaskMemFree( wszCLSID );           // Through with wide version

  // Load the buffer with the Snap-In Location
  _tcscpy( szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns") );

  _tcscat( szKeyBuf, _T("\\") );       // Copy keyname into buffer.
  _tcscat( szKeyBuf, pszCLSID );

  // Delete the CLSID Key - CLSID\{...}
  LONG lResult = RecursiveDeleteKey( HKEY_LOCAL_MACHINE, szKeyBuf );
  if( ERROR_SUCCESS != lResult )
    hResult = HRESULT_FROM_WIN32( lResult );

  CoTaskMemFree( pszCLSID );
  return hResult;
}

Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/contextmenuex/registry.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • contextmenuex
Functions

registry.h File Reference

#include <tchar.h>

Go to the source code of this file.

Functions

HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const TCHAR *szNameString, const CLSID &clsidAbout, const BOOL fSupportExtensions=FALSE)
HRESULT | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Function Documentation

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const TCHAR * | szFriendlyName
 | ) |  |

Definition at line 51 of file registry.cpp.

{
  // Get server location.
  TCHAR    szModule[512] ;
  TCHAR*   pszCLSID = NULL;
  WCHAR*   wszCLSID = NULL ;
  HRESULT  hResult  = S_FALSE;

  DWORD dwResult = ::GetModuleFileName( hModule,
                                        szModule,
                                        sizeof(szModule)/sizeof(TCHAR)
                                      );
  if( 0 == dwResult ) return HRESULT_FROM_WIN32( dwResult );

  do                         // Fail unless we complete everything
  {
    // Get CLSID string in wide char
    hResult = StringFromCLSID( clsid, &wszCLSID ) ;
    if( S_OK != hResult )
    {
      CoTaskMemFree( wszCLSID );
      BREAK_ON_ERROR( hResult );
    }

    W2T( &pszCLSID, wszCLSID );          // W2T is defined in Globals.h
    CoTaskMemFree( wszCLSID );           // Through with wide version

    TCHAR szKey[64];                     // Build the CLSID key string CLSID\\{...}
    _tcscpy( szKey, _T("CLSID\\") );
    _tcscat( szKey, pszCLSID );

    // Add the CLSID to the registry.
    hResult = SetKeyAndValue( szKey, NULL, szFriendlyName );
    BREAK_ON_ERROR( hResult );

    // Add the server filename subkey under the CLSID key.
    hResult = SetKeyAndValue( szKey, _T("InprocServer32"), szModule );
    BREAK_ON_ERROR( hResult );

    // Set the threading model
    _tcscat( szKey, _T("\\InprocServer32") );
    hResult = SetValue( szKey, _T("ThreadingModel"), _T("Apartment") );
    BREAK_ON_ERROR( hResult );

  }while( 0 );

  CoTaskMemFree( pszCLSID );           // Through with TCHAR version

  return hResult;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | fSupportExtensions = FALSE
 | ) |  |

Definition at line 149 of file registry.cpp.

{
  HRESULT hResult = S_FALSE;
  TCHAR*  pszSnapCLSID = NULL;         // Needed for TCHAR version of the ClassID

  // If any part of this process fails, jump out of the loop and return
  // the error code
  do
  {
    // Allocate the CLSID string
    LPOLESTR wszSnapCLSID  = NULL ;
    hResult = StringFromCLSID( clsid, &wszSnapCLSID ) ;
    if( S_OK != hResult )
    {
       CoTaskMemFree( wszSnapCLSID );
       continue;
    }

    W2T( &pszSnapCLSID, wszSnapCLSID );  // W2T is defined in Globals.h
    CoTaskMemFree( wszSnapCLSID );       // Through with wide version

    // Add the Snap-in's CLSID to the registry
    hResult = SetSnapInKeyAndValue( pszSnapCLSID, NULL, _T("NameString"), szNameString );
    BREAK_ON_ERROR( hResult );

    hResult = SetSnapInKeyAndValue( pszSnapCLSID, _T("StandAlone"), NULL, NULL );
    BREAK_ON_ERROR( hResult );

    // Add registry information for ISnapinAbout if we support it
    LPOLESTR wszAboutCLSID = NULL;
    TCHAR*   pszAboutCLSID = NULL;
    if( IID_NULL != clsidAbout )
    {
      hResult = StringFromCLSID( clsidAbout, &wszAboutCLSID );
      if( S_OK != hResult )
      {
        CoTaskMemFree( wszAboutCLSID ); // Free this memory before exiting
        continue;
      }

      W2T( &pszAboutCLSID, wszAboutCLSID );
      hResult = SetSnapInKeyAndValue( pszSnapCLSID, NULL, _T("About"), pszAboutCLSID );
      CoTaskMemFree( wszAboutCLSID );
      CoTaskMemFree( pszAboutCLSID );
      BREAK_ON_ERROR( hResult );
    }

    if( TRUE == bSupportExtensions )     // Build the NodeTypesKey
    {
      hResult = SetSnapInKeyAndValue( pszSnapCLSID, _T("NodeTypes"), NULL, NULL );
      BREAK_ON_ERROR( hResult );
      TCHAR szKey[64];
      _tcscpy( szKey, pszSnapCLSID );
      _tcscat(szKey, _T("\\NodeTypes"));
      hResult = SetSnapInKeyAndValue( szKey, pszSnapCLSID, NULL, NULL );
      BREAK_ON_ERROR( hResult );
    }
  }while( 0 );

  CoTaskMemFree( pszSnapCLSID);
  return hResult;
}

HRESULT UnregisterServer ( const CLSID & clsid )

Definition at line 112 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

  MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
  _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 184 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Generated on Wed Nov 13 2024 16:53:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/contextmenuex/resource.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • contextmenuex
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_ATTR_COMPRESSED 1010
#define | IDC_ATTR_ENCRYPTED 1011
#define | IDD_PPAGE0 111
#define | IDD_VFILE_PPAGE0 111

Define Documentation

#define IDC_ATTR_COMPRESSED 1010

Definition at line 7 of file resource.h.

#define IDC_ATTR_ENCRYPTED 1011

Definition at line 8 of file resource.h.

#define IDD_PPAGE0 111

Definition at line 6 of file resource.h.

#define IDD_VFILE_PPAGE0 111

Definition at line 5 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/contextmenuex/tracemacro.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • contextmenuex
Functions

tracemacro.cpp File Reference

#include "Globals.h"
#include "TraceMacro.h"
#include <StdIo.h>

Go to the source code of this file.

Functions

VOID | MapEvent (LONG Event, LPTSTR szEventStr)
VOID | Trace_Event (LPCTSTR pszClass, LPCTSTR pszFunction, LONG nEvent)
VOID | Trace_HR (LPCTSTR pszClass, LPCTSTR pszFunction, HRESULT hr)
VOID | Trace_Start (LPCTSTR pszClass, LPCTSTR pszFunction)
VOID | Trace_Value (LPCTSTR pszClass, LPCTSTR pszFunction, LPCTSTR pszValueName, LONG nValue)

Function Documentation

VOID MapEvent | ( | LONG | Event,
 |  | LPTSTR | szEventStr
 | ) |  |

Definition at line 147 of file tracemacro.cpp.

{
#ifdef _DEBUG

  switch( Event )
  {
    case 0x8001:
      _tcscpy( szEventStr, _T("MMCN_ACTIVATE       ") );
      break;

    case 0x8002:
      _tcscpy( szEventStr, _T("MMCN_ADD_IMAGES     ") );
      break;

    case 0x8003:
      _tcscpy( szEventStr, _T("MMCN_BTN_CLICK      ") );
      break;

    case 0x8004:
      _tcscpy( szEventStr, _T("MMCN_CLICK          ") );
      break;

    case 0x8005:
      _tcscpy( szEventStr, _T("MMCN_COLUMN_CLICK   ") );
      break;

    case 0x8006:
      _tcscpy( szEventStr, _T("MMCN_CONTEXTMENU    ") );
      break;

    case 0x8007:
      _tcscpy( szEventStr, _T("MMCN_CUTORMOVE      ") );
      break;

    case 0x8008:
      _tcscpy( szEventStr, _T("MMCN_DBLCLICK       ") );
      break;

    case 0x8009:
      _tcscpy( szEventStr, _T("MMCN_DELETE         ") );
      break;

    case 0x800A:
      _tcscpy( szEventStr, _T("MMCN_DESELECT_ALL   ") );
      break;

    case 0x800B:
      _tcscpy( szEventStr, _T("MMCN_EXPAND         ") );
      break;

    case 0x800C:
      _tcscpy( szEventStr, _T("MMCN_HELP           ") );
      break;

    case 0x800D:
      _tcscpy( szEventStr, _T("MMCN_MENU_BTNCLICK  ") );
      break;

    case 0x800E:
      _tcscpy( szEventStr, _T("MMCN_MINIMIZED      ") );
      break;

    case 0x800F:
      _tcscpy( szEventStr, _T("MMCN_PASTE          ") );
      break;

    case 0x8010:
      _tcscpy( szEventStr, _T("MMCN_PROPERTY_CHANGE") );
      break;

    case 0x8011:
      _tcscpy( szEventStr, _T("MMCN_QUERY_PASTE    ") );
      break;

    case 0x8012:
      _tcscpy( szEventStr, _T("MMCN_REFRESH        ") );
      break;

    case 0x8013:
      _tcscpy( szEventStr, _T("MMCN_REMOVE_CHILDREN") );
      break;

    case 0x8014:
      _tcscpy( szEventStr, _T("MMCN_RENAME         ") );
      break;

    case 0x8015:
      _tcscpy( szEventStr, _T("MMCN_SELECT         ") );
      break;

    case 0x8016:
      _tcscpy( szEventStr, _T("MMCN_SHOW           ") );
      break;

    case 0x8017:
      _tcscpy( szEventStr, _T("MMCN_VIEW_CHANGE    ") );
      break;

    case 0x8018:
      _tcscpy( szEventStr, _T("MMCN_SNAPINHELP     ") );
      break;

    case 0x8019:
      _tcscpy( szEventStr, _T("MMCN_CONTEXTHELP    ") );
      break;

    case 0x801A:
      _tcscpy( szEventStr, _T("MMCN_INITOCX        ") );
      break;

    case 0x8021:
      _tcscpy( szEventStr, _T("MMCN_EXPANDSYNC     ") );
      break;

    default:
      _stprintf( szEventStr, _T("0x%X"), Event );
      break;
  }

#endif
} //end MapEvent()

VOID Trace_Event | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LONG | nEvent
 | ) |  |

Definition at line 87 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szEventStr[22];
  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Event = %s\n");
  INT    nChars     = 0;

  MapEvent( nEvent, szEventStr );

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      szEventStr
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Event()

VOID Trace_HR | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | HRESULT | hr
 | ) |  |

Definition at line 28 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Returned 0x%X\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer, szFormat, pszClass, pszFunction, hr );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_HR()

VOID Trace_Start | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction
 | ) |  |

Definition at line 119 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Started \n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Start()

VOID Trace_Value | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LPCTSTR | pszValueName,
 |  | LONG | nValue
 | ) |  |

Definition at line 54 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> %s = %u\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      pszValueName,
                      nValue
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Value()

Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/contextmenuex/tracemacro.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • contextmenuex
Defines | Functions

tracemacro.h File Reference

Go to the source code of this file.

Defines

#define | TRACE_EVENT
#define | TRACE_HRESULT
#define | TRACE_START
#define | TRACE_VAL

Functions

VOID | MapEvent (LONG Event, LPTSTR szEventStr)
VOID | Trace_Event (LPCTSTR pszClass, LPCTSTR pszFunction, LONG nEvent)
VOID | Trace_HR (LPCTSTR pszClass, LPCTSTR pszFunction, HRESULT hr)
VOID | Trace_Start (LPCTSTR pszClass, LPCTSTR pszFunction)
VOID | Trace_Value (LPCTSTR pszClass, LPCTSTR pszFunction, LPCTSTR pszValueName, LONG Value)

Define Documentation

#define TRACE_EVENT

Definition at line 57 of file tracemacro.h.

#define TRACE_HRESULT

Definition at line 51 of file tracemacro.h.

#define TRACE_START

Definition at line 60 of file tracemacro.h.

#define TRACE_VAL

Definition at line 54 of file tracemacro.h.

Function Documentation

VOID MapEvent | ( | LONG | Event,
 |  | LPTSTR | szEventStr
 | ) |  |

Definition at line 146 of file tracemacro.cpp.

{
#ifdef _DEBUG

  switch( Event )
  {
    case 0x8001:
      _tcscpy( szEventStr, _T("MMCN_ACTIVATE       ") );
      break;

    case 0x8002:
      _tcscpy( szEventStr, _T("MMCN_ADD_IMAGES     ") );
      break;

    case 0x8003:
      _tcscpy( szEventStr, _T("MMCN_BTN_CLICK      ") );
      break;

    case 0x8004:
      _tcscpy( szEventStr, _T("MMCN_CLICK          ") );
      break;

    case 0x8005:
      _tcscpy( szEventStr, _T("MMCN_COLUMN_CLICK   ") );
      break;

    case 0x8006:
      _tcscpy( szEventStr, _T("MMCN_CONTEXTMENU    ") );
      break;

    case 0x8007:
      _tcscpy( szEventStr, _T("MMCN_CUTORMOVE      ") );
      break;

    case 0x8008:
      _tcscpy( szEventStr, _T("MMCN_DBLCLICK       ") );
      break;

    case 0x8009:
      _tcscpy( szEventStr, _T("MMCN_DELETE         ") );
      break;

    case 0x800A:
      _tcscpy( szEventStr, _T("MMCN_DESELECT_ALL   ") );
      break;

    case 0x800B:
      _tcscpy( szEventStr, _T("MMCN_EXPAND         ") );
      break;

    case 0x800C:
      _tcscpy( szEventStr, _T("MMCN_HELP           ") );
      break;

    case 0x800D:
      _tcscpy( szEventStr, _T("MMCN_MENU_BTNCLICK  ") );
      break;

    case 0x800E:
      _tcscpy( szEventStr, _T("MMCN_MINIMIZED      ") );
      break;

    case 0x800F:
      _tcscpy( szEventStr, _T("MMCN_PASTE          ") );
      break;

    case 0x8010:
      _tcscpy( szEventStr, _T("MMCN_PROPERTY_CHANGE") );
      break;

    case 0x8011:
      _tcscpy( szEventStr, _T("MMCN_QUERY_PASTE    ") );
      break;

    case 0x8012:
      _tcscpy( szEventStr, _T("MMCN_REFRESH        ") );
      break;

    case 0x8013:
      _tcscpy( szEventStr, _T("MMCN_REMOVE_CHILDREN") );
      break;

    case 0x8014:
      _tcscpy( szEventStr, _T("MMCN_RENAME         ") );
      break;

    case 0x8015:
      _tcscpy( szEventStr, _T("MMCN_SELECT         ") );
      break;

    case 0x8016:
      _tcscpy( szEventStr, _T("MMCN_SHOW           ") );
      break;

    case 0x8017:
      _tcscpy( szEventStr, _T("MMCN_VIEW_CHANGE    ") );
      break;

    case 0x8018:
      _tcscpy( szEventStr, _T("MMCN_SNAPINHELP     ") );
      break;

    case 0x8019:
      _tcscpy( szEventStr, _T("MMCN_CONTEXTHELP    ") );
      break;

    case 0x801A:
      _tcscpy( szEventStr, _T("MMCN_INITOCX        ") );
      break;

    case 0x8021:
      _tcscpy( szEventStr, _T("MMCN_EXPANDSYNC     ") );
      break;

    default:
      _stprintf( szEventStr, _T("0x%X"), Event );
      break;
  }

#endif
} //end MapEvent()

VOID Trace_Event | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LONG | nEvent
 | ) |  |

Definition at line 86 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szEventStr[22];
  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Event = %s\n");
  INT    nChars     = 0;

  MapEvent( nEvent, szEventStr );

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      szEventStr
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Event()

VOID Trace_HR | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | HRESULT | hr
 | ) |  |

Definition at line 27 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Returned 0x%X\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer, szFormat, pszClass, pszFunction, hr );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_HR()

VOID Trace_Start | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction
 | ) |  |

Definition at line 118 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Started \n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Start()

VOID Trace_Value | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LPCTSTR | pszValueName,
 |  | LONG | Value
 | ) |  |

Definition at line 53 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> %s = %u\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      pszValueName,
                      nValue
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Value()

Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/dragdrop/about.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • dragdrop
Functions

about.cpp File Reference

#include "Globals.h"
#include "About.h"
#include "Resource.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CSnapinAbout

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 85 of file about.cpp.

{
  if( 0 == InterlockedDecrement((long*)&m_cRef) )
  {
    // we need to decrement our object count in the DLL
    delete this;
    return 0;
  }
  return m_cRef;
}

Generated on Wed Nov 13 2024 16:54:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/dragdrop/about.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • dragdrop
Classes

about.h File Reference

#include <mmc.h>

Go to the source code of this file.

Classes

class CSnapinAbout
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/dragdrop/adddevicedlg.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • dragdrop

adddevicedlg.cpp File Reference

#include "AddDeviceDlg.h"
#include "Globals.h"
#include "Resource.h"
#include "BaseNode.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/dragdrop/adddevicedlg.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • dragdrop
Classes

adddevicedlg.h File Reference

#include "BaseDialog.h"
#include "BaseDialog.h"

Go to the source code of this file.

Classes

class CAddDeviceDlg
Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/dragdrop/addvfiledlg.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • dragdrop

addvfiledlg.cpp File Reference

#include "AddVFileDlg.h"
#include "Globals.h"
#include "Resource.h"
#include "BaseNode.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/dragdrop/addvfiledlg.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • dragdrop
Classes

addvfiledlg.h File Reference

#include "BaseDialog.h"

Go to the source code of this file.

Classes

class CAddVFileDlg
Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/dragdrop/basedialog.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • dragdrop

basedialog.cpp File Reference

#include "BaseDialog.h"
#include "Globals.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/dragdrop/basedialog.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • dragdrop
Classes

basedialog.h File Reference

#include <Windows.h>

Go to the source code of this file.

Classes

class CBaseDialog
Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/dragdrop/basenode.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • dragdrop
Classes | Defines | Typedefs

basenode.h File Reference

#include "Globals.h"
#include "Resource.h"

Go to the source code of this file.

Classes

class | CBaseNode
struct | CHILD_PROPERTIES
struct | NODE_PROPERTIES

Defines

#define | DEFAULT_RDI_MASK (RDI_STR | RDI_PARAM | RDI_IMAGE)
#define | DEFAULT_SDI_MASK (SDI_STR | SDI_PARAM | SDI_IMAGE | SDI_OPENIMAGE | SDI_PARENT | SDI_CHILDREN)
#define | MAX_NAME_LEN 64

Typedefs

typedef CHILD_PROPERTIES | CHILDPROPS
typedef CBaseNode * | LPBASENODE
typedef CHILD_PROPERTIES * | LPCHILDPROPS
typedef NODE_PROPERTIES * | LPNODEPROPS
typedef NODE_PROPERTIES | NODEPROPS

Define Documentation

#define DEFAULT_RDI_MASK (RDI_STR | RDI_PARAM | RDI_IMAGE)

Definition at line 24 of file basenode.h.

#define DEFAULT_SDI_MASK (SDI_STR | SDI_PARAM | SDI_IMAGE | SDI_OPENIMAGE | SDI_PARENT | SDI_CHILDREN)

Definition at line 23 of file basenode.h.

#define MAX_NAME_LEN 64

Definition at line 26 of file basenode.h.

Typedef Documentation

typedef CHILD_PROPERTIES CHILDPROPS

Definition at line 62 of file basenode.h.

typedef CBaseNode* LPBASENODE

Definition at line 64 of file basenode.h.

typedef CHILD_PROPERTIES* LPCHILDPROPS

Definition at line 63 of file basenode.h.

typedef NODE_PROPERTIES* LPNODEPROPS

Definition at line 61 of file basenode.h.

typedef NODE_PROPERTIES NODEPROPS

Definition at line 60 of file basenode.h.

Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/dragdrop/basesnap.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • dragdrop
Defines | Functions

basesnap.cpp File Reference

#include <ObjBase.h>
#include <InitGuid.h>
#include "Globals.h"
#include "BaseSnap.h"
#include "CompData.h"
#include "About.h"
#include "Registry.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define | MODULESTRING _T("BaseSnap")

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)
BOOL WINAPI | DllMain (HINSTANCE hInstDLL, DWORD fdwReason, void *lpvReserved)
STDAPI | DllRegisterServer ()
STDAPI | DllUnregisterServer ()
STDMETHODIMP_ (ULONG) CClassFactory

Define Documentation

#define MODULESTRING _T("BaseSnap")

Definition at line 28 of file basesnap.cpp.

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 226 of file basesnap.cpp.

{
  if( 0 == g_uObjectCount && 0 == g_uServerLocks )
    return S_OK;
  else
    return S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 190 of file basesnap.cpp.

{
  // Test for CSnapinAbout
  if( (rclsid != CLSID_CComponentData) && (rclsid != CLSID_CSnapinAbout) )
    return CLASS_E_CLASSNOTAVAILABLE;

  if( !ppvObj )
    return E_FAIL;

  *ppvObj = NULL;

  // We can only hand out IUnknown and IClassFactory pointers.  Fail
  // if caller asks for anything else.
  if( !IsEqualIID(riid, IID_IUnknown) && !IsEqualIID(riid, IID_IClassFactory) )
    return E_NOINTERFACE;

  CClassFactory *pFactory = NULL;

  // Create the new class factory.  Pass in the type of object to create
  if( rclsid == CLSID_CComponentData )
    pFactory = new CClassFactory(CClassFactory::COMPONENTDATA);
  else if( rclsid == CLSID_CSnapinAbout )
    pFactory = new CClassFactory(CClassFactory::ABOUT);

  HRESULT hResult = pFactory->QueryInterface( riid, ppvObj );

  return hResult;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstDLL,
 |  | DWORD | fdwReason,
 |  | void * | lpvReserved
 | ) |  |

Definition at line 173 of file basesnap.cpp.

{
  if( DLL_PROCESS_ATTACH == fdwReason )
  {
     g_hInst = hInstDLL;
  }

  return TRUE;
}

STDAPI DllRegisterServer ( void )

Definition at line 236 of file basesnap.cpp.

{
  HRESULT hResult = S_FALSE;

  do
  { // Support ISnapinAbout
    hResult = RegisterServer( g_hInst, CLSID_CSnapinAbout, gtszABOUT_NAME );
    BREAK_ON_ERROR( hResult );

    hResult = RegisterServer( g_hInst, CLSID_CComponentData, gtszSNAPIN_NAME );
    BREAK_ON_ERROR( hResult );

    hResult = RegisterSnapin( CLSID_CComponentData, gtszSNAPIN_NAME, CLSID_CSnapinAbout, FALSE );
    BREAK_ON_ERROR( hResult );

  }while( 0 );

  return hResult;
}

STDAPI DllUnregisterServer ( void )

Definition at line 258 of file basesnap.cpp.

{
  if( S_OK != UnregisterServer( CLSID_CComponentData )  ||
      S_OK != UnregisterServer( CLSID_CSnapinAbout   )  ||
      S_OK != UnregisterSnapin( CLSID_CComponentData )
    )
    return E_UNEXPECTED;
  else
    return S_OK;
}

STDMETHODIMP_ ( ULONG )

Definition at line 91 of file basesnap.cpp.

{
  if( 0 == InterlockedDecrement( (long*)&m_cRef) )
  {
    delete this;
    return 0;
  }
  return m_cRef;
}

Generated on Wed Nov 13 2024 16:54:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/dragdrop/basesnap.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • dragdrop
Classes | Functions

basesnap.h File Reference

Go to the source code of this file.

Classes

class | CClassFactory

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 53 of file ComSpyAudit.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 61 of file ComSpyAudit.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

Generated on Wed Nov 13 2024 16:54:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/dragdrop/comp.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • dragdrop
Defines | Functions

comp.cpp File Reference

#include "Globals.h"
#include "Comp.h"
#include "CompData.h"
#include "DataObj.h"
#include "Resource.h"
#include "StaticNode.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CComponent")

Functions

STDMETHODIMP_ (ULONG) CComponent

Define Documentation

#define MODULESTRING _T("CComponent")

Definition at line 25 of file comp.cpp.

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 92 of file comp.cpp.

{
  if( InterlockedDecrement((LONG*)&m_cRef) == 0 )
  {
    delete this;
    return 0;
  }
  return m_cRef;
}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/dragdrop/comp.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • dragdrop
Classes

comp.h File Reference

#include "Globals.h"

Go to the source code of this file.

Classes

class CComponent
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/dragdrop/compdata.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • dragdrop
Defines | Functions

compdata.cpp File Reference

#include "Globals.h"
#include "Comp.h"
#include "CompData.h"
#include "DataObj.h"
#include "Resource.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CComponentData")

Functions

STDMETHODIMP_ (ULONG) CComponentData

Define Documentation

#define MODULESTRING _T("CComponentData")

Definition at line 23 of file compdata.cpp.

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 115 of file compdata.cpp.

{
  if( InterlockedDecrement((LONG*)&m_cRef) == 0 )
  {
    delete this;
    return 0;
  }

  return m_cRef;
}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/dragdrop/compdata.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • dragdrop
Classes

compdata.h File Reference

#include "Globals.h"
#include "BaseNode.h"

Go to the source code of this file.

Classes

class CComponentData
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/dragdrop/dataobj.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • dragdrop
Defines | Functions

dataobj.cpp File Reference

#include "Globals.h"
#include "DataObj.h"
#include "StaticNode.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CDataObject")

Functions

STDMETHODIMP_ (ULONG) CDataObject

Define Documentation

#define MODULESTRING _T("CDataObject")

Definition at line 21 of file dataobj.cpp.

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 95 of file dataobj.cpp.

{
  if( InterlockedDecrement((LONG*)&m_cRef) == 0 )
  {
    delete this;
    return 0;
  }
  return m_cRef;
}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/dragdrop/dataobj.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • dragdrop
Classes

dataobj.h File Reference

#include "Globals.h"
#include "StaticNode.h"
#include "EnumFormatEtc.h"
#include "StaticNode.h"

Go to the source code of this file.

Classes

class CDataObject
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/dragdrop/devicenode.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • dragdrop
Defines

devicenode.cpp File Reference

#include "DeviceNode.h"
#include "CompData.h"
#include "Comp.h"
#include "DataObj.h"
#include "FolderNode.h"
#include "StaticNode.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CDeviceNode")

Define Documentation

#define MODULESTRING _T("CDeviceNode")

Definition at line 26 of file devicenode.cpp.

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/dragdrop/devicenode.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • dragdrop
Classes

devicenode.h File Reference

#include "Globals.h"
#include "FolderNode.h"
#include "LListImpl.h"
#include "FolderNode.h"

Go to the source code of this file.

Classes

class CDeviceNode
Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/dragdrop/enumformatetc.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • dragdrop
Functions

enumformatetc.cpp File Reference

#include "EnumFormatEtc.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CEnumFormatEtc

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 102 of file enumformatetc.cpp.

    {
    if (0!=--m_cRef)
        return m_cRef;

    delete this;
    return 0;
    }

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/dragdrop/enumformatetc.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • dragdrop
Classes | Typedefs

enumformatetc.h File Reference

#include "Globals.h"

Go to the source code of this file.

Classes

class | CEnumFormatEtc

Typedefs

typedef CEnumFormatEtc * | PCEnumFormatEtc

Typedef Documentation

typedef CEnumFormatEtc* PCEnumFormatEtc

Definition at line 48 of file enumformatetc.h.

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/dragdrop/foldernode.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • dragdrop
Defines

foldernode.cpp File Reference

#include "FolderNode.h"
#include "CompData.h"
#include "Comp.h"
#include "AddVFileDlg.h"
#include "DataObj.h"
#include "DeviceNode.h"
#include "VirtualFIle.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CFolderNode")

Define Documentation

#define MODULESTRING _T("CFolderNode")

Definition at line 27 of file foldernode.cpp.

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/dragdrop/foldernode.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • dragdrop
Classes

foldernode.h File Reference

#include "Globals.h"
#include "BaseNode.h"
#include "VirtualFile.h"
#include "LListImpl.h"
#include "VirtualFile.h"

Go to the source code of this file.

Classes

class CFolderNode
Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/dragdrop/globals.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • dragdrop
Functions | Variables

globals.cpp File Reference

#include "Globals.h"
#include "BaseNode.h"

Go to the source code of this file.

Functions

void _fastcall | CopyT2W (LPWSTR strDest, LPCTSTR strSource, size_t count)
CBaseNode * | ExtractBaseNodePtr (LPDATAOBJECT ipDataObject)
CDataObject * | ExtractDataObjPtr (LPDATAOBJECT ipDataObject)
HRESULT | ExtractFromDataObject (LPDATAOBJECT ipDataObject, UINT cfClipFormat, ULONG nByteCount, HGLOBAL *phGlobal)
ULONG | ExtractNodeTypeFlg (LPDATAOBJECT ipDataObject)
HRESULT | GetConsoleVersion (CONSOLE_VERSION *pVersion)
void | InitClipboardFormats ()
void _fastcall | Unicode2Ansi (CHAR **pszAnsi, WCHAR *szWide)

Variables

UINT | g_cfBaseNodePtr = 0
UINT | g_cfDataObjPtr = 0
UINT | g_cfDisplayName = 0
UINT | g_cfNodePropPtr = 0
UINT | g_cfNodeType = 0
UINT | g_cfNodeTypeFlg = 0
UINT | g_cfSnapinClsid = 0
UINT | g_cfszNodeType = 0
CONSOLE_VERSION g_CV
HINSTANCE | g_hInst = NULL
ULONG | g_uObjectCount = 0
ULONG | g_uServerLocks = 0

Function Documentation

void _fastcall CopyT2W | ( | LPWSTR | strDest,
 |  | LPCTSTR | strSource,
 |  | size_t | count
 | ) |  |

Definition at line 97 of file globals.cpp.

{
#ifndef _UNICODE

  MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, strSource, -1, strDest, count );

#else

  wcsncpy( strDest, strSource, count );

#endif

  if ( count > 0 )
    strDest[ count - 1 ] = 0;
}

CBaseNode* ExtractBaseNodePtr ( LPDATAOBJECT ipDataObject )

Definition at line 186 of file globals.cpp.

{
  LPBASENODE  pNode   = NULL;
  HGLOBAL     hGlobal = NULL;
  HRESULT     hResult = S_FALSE;

  hResult = ExtractFromDataObject( ipDataObject,
                                   g_cfBaseNodePtr,
                                   sizeof(LPBASENODE),
                                   &hGlobal
                                 );
  if( SUCCEEDED(hResult) )
  {
    pNode = *(LPBASENODE*)(hGlobal);
    HGLOBAL hRetVal = GlobalFree(hGlobal);
    _ASSERT( NULL == hRetVal );        // Must return NULL
  }

  return pNode;

}

CDataObject* ExtractDataObjPtr ( LPDATAOBJECT ipDataObject )

Definition at line 251 of file globals.cpp.

{
  _ASSERT( 0 != g_cfDataObjPtr );

  HGLOBAL      hGlobal = NULL;
  HRESULT      hResult = S_OK;
  CDataObject* pDO     = NULL;

  hResult = ExtractFromDataObject( ipDataObject,
                                   g_cfDataObjPtr,
                                   sizeof(CDataObject **),
                                   &hGlobal
                                 );

  if( SUCCEEDED(hResult) )
  {
    pDO = *(CDataObject **)(hGlobal);
    _ASSERT( NULL != pDO );

    HGLOBAL hRetVal = GlobalFree(hGlobal);
    _ASSERT( NULL == hRetVal );       // Must return NULL
  }

  return pDO;

}

HRESULT ExtractFromDataObject | ( | LPDATAOBJECT | ipDataObject,
 |  | UINT | cfClipFormat,
 |  | ULONG | nByteCount,
 |  | HGLOBAL * | phGlobal
 | ) |  |

Definition at line 135 of file globals.cpp.

{
  _ASSERT( NULL != ipDataObject );

            *phGlobal = NULL;
  HRESULT   hResult   = S_FALSE;
  STGMEDIUM StgMedium = { TYMED_HGLOBAL,  NULL  };
  FORMATETC FormatEtc = { cfClipFormat, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };

  do
  {
    // Allocate memory for the stream
    StgMedium.hGlobal = ::GlobalAlloc( GMEM_SHARE, nByteCount );

    if( NULL == StgMedium.hGlobal )
    {
      hResult = E_OUTOFMEMORY;
      break;
    }

    // Attempt to get data from the object
    hResult = ipDataObject->GetDataHere( &FormatEtc, &StgMedium );
    if( FAILED(hResult) )
    {
      break;
    }
    // StgMedium now has the data we need
    *phGlobal = StgMedium.hGlobal;
    StgMedium.hGlobal = NULL;

  } while (0);

  if( FAILED(hResult) && StgMedium.hGlobal )
  {
    HGLOBAL hRetVal = ::GlobalFree(StgMedium.hGlobal);
    _ASSERT( NULL == hRetVal );         // Must return NULL
  }
  return hResult;
}

ULONG ExtractNodeTypeFlg ( LPDATAOBJECT ipDataObject )

Definition at line 217 of file globals.cpp.

{
  _ASSERT( NULL != ipDataObject );

  ULONG    nTypeFlg = 0;
  ULONG*   pTypeFlg = &nTypeFlg;
  HGLOBAL  hRetVal  = NULL;
  BOOL     bStatus  = FALSE;
  HRESULT  hResult  = S_FALSE;

  STGMEDIUM StgMedium = { TYMED_HGLOBAL,  NULL  };
  FORMATETC FormatEtc = { g_cfNodeTypeFlg, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };

  hResult = ipDataObject->GetData( &FormatEtc, &StgMedium );
  if( S_OK == hResult )
  {
    pTypeFlg = (ULONG*)::GlobalLock( StgMedium.hGlobal );
    nTypeFlg = *pTypeFlg;
    bStatus  = ::GlobalUnlock( StgMedium.hGlobal );
    hRetVal  = GlobalFree( StgMedium.hGlobal );
    _ASSERT( NULL == hRetVal );        // Must return NULL
  }
                                       // Return 0 if the call to
  return nTypeFlg;                     // ::GetData() failed
}

HRESULT GetConsoleVersion ( CONSOLE_VERSION * pVersion )

Definition at line 46 of file globals.cpp.

{
  _ASSERT( NULL != pVersion );
  HRESULT hResult = S_FALSE;

  pVersion->nMajor = 0;
  pVersion->nMinor = 0;

  IMMCVersionInfo* ipVersionInfo = NULL;
  hResult = CoCreateInstance( CLSID_MMCVersionInfo,
                              NULL,
                              CLSCTX_INPROC_SERVER,
                              IID_IMMCVersionInfo,
                              (void**)&ipVersionInfo
                            );
  // If the call to CoCreateInstance fails, the return value
  // will be "ClassFactory cannot supply requested class"
  if( S_OK != hResult )
    return S_FALSE;

  hResult = ipVersionInfo->GetMMCVersion( &pVersion->nMajor, &pVersion->nMinor );
  ipVersionInfo->Release();

  return hResult;
}

void InitClipboardFormats ( )

Definition at line 115 of file globals.cpp.

{
  g_cfDisplayName  = RegisterClipboardFormat( T_CCF_DISPLAY_NAME );
  g_cfNodeType     = RegisterClipboardFormat( T_CCF_NODETYPE );
  g_cfszNodeType   = RegisterClipboardFormat( T_CCF_SZNODETYPE );
  g_cfSnapinClsid  = RegisterClipboardFormat( T_CCF_SNAPIN_CLASSID );

  g_cfBaseNodePtr  = RegisterClipboardFormat( T_CCF_BASENODE_PTR );
  g_cfDataObjPtr   = RegisterClipboardFormat( T_CCF_DATAOBJ_PTR );

  //DRAGDROP: Register our new clipboard formats
  g_cfNodePropPtr  = RegisterClipboardFormat( T_CCF_NODEPROP_PTR );
  g_cfNodeTypeFlg  = RegisterClipboardFormat( T_CCF_NODETYPE_FLG );

}

void _fastcall Unicode2Ansi | ( | CHAR ** | pszAnsi,
 |  | WCHAR * | szWide
 | ) |  |

Definition at line 78 of file globals.cpp.

{
  LONG nLen = wcslen( szWide ) +1;
  *pszAnsi = (char*)CoTaskMemAlloc( nLen );
  char* pCounter = *pszAnsi;

  while( *szWide )
  {
    *pCounter = LOBYTE(*szWide);
    pCounter++;
    szWide++;
  }
  *pCounter = NULL;
}

Variable Documentation

UINT g_cfBaseNodePtr = 0

Definition at line 28 of file globals.cpp.

UINT g_cfDataObjPtr = 0

Definition at line 29 of file globals.cpp.

UINT g_cfDisplayName = 0

Definition at line 20 of file globals.cpp.

UINT g_cfNodePropPtr = 0

Definition at line 30 of file globals.cpp.

UINT g_cfNodeType = 0

Definition at line 21 of file globals.cpp.

UINT g_cfNodeTypeFlg = 0

Definition at line 31 of file globals.cpp.

UINT g_cfSnapinClsid = 0

Definition at line 23 of file globals.cpp.

UINT g_cfszNodeType = 0

Definition at line 22 of file globals.cpp.

CONSOLE_VERSION g_CV

Definition at line 40 of file globals.cpp.

HINSTANCE g_hInst = NULL

Definition at line 36 of file globals.cpp.

ULONG g_uObjectCount = 0

Definition at line 37 of file globals.cpp.

ULONG g_uServerLocks = 0

Definition at line 38 of file globals.cpp.

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/dragdrop/globals.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • dragdrop
Classes | Defines | Typedefs | Functions | Variables

globals.h File Reference

#include <TChar.h>
#include <Mmc.h>
#include <CrtDbg.h>
#include "Guids.h"
#include "Guids.h"

Go to the source code of this file.

Classes

struct | _tag_MMC_VERSION_INFO

Defines

#define | ATTRIBUTE_BACKUP_DEVICE 2048
#define | ATTRIBUTE_DATA_ARCHIVE 2
#define | ATTRIBUTE_DATA_HIDDEN 4
#define | ATTRIBUTE_DATA_LOCKED 8
#define | ATTRIBUTE_DATA_READONLY 16
#define | BREAK_ON_ERROR(hResult) if( S_OK != hResult ) continue
#define | BYTE_SIZE(string) ((_tcslen(string)+1) * sizeof(TCHAR))
#define | IDM_NEW_DEVICE 100
#define | IDM_NEW_FOLDER 200
#define | IDM_NEW_VIRTFILE 400
#define | IDM_TOGGLE_STATUS 300
#define | IMG_CDROM_DEFAULT 6
#define | IMG_DATA_FILE 2
#define | IMG_DEVICE_DEFAULT 0
#define | IMG_DEVICE_OFFLINE 1
#define | IMG_DRIVE_DEFAULT 3
#define | IMG_DRIVE_OFFLINE 4
#define | IMG_FOLDER_DEFAULT 5
#define | IMG_REMOVABLE_MEDIA 7
#define | INIT_DEFAULT_NODE -1
#define | MsgBox(wszMsg, wszTitle) ::MessageBox(NULL, wszMsg, wszTitle, MB_OK)
#define | NODETYPE_DEVICE 200
#define | NODETYPE_FOLDER 300
#define | NODETYPE_STATIC 100
#define | NODETYPE_VFILE 400
#define | NP_FORMATETC {g_cfNodePropPtr, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL}
#define | REQUEST_ICONSOLE 1001
#define | REQUEST_ICONSOLENAMESPACE 1000
#define | REQUEST_ICONSOLEVERB 1002
#define | REQUEST_IHEADERCTRL 1004
#define | REQUEST_IRESULTDATA 1003
#define | STATUS_OFFLINE 0
#define | STATUS_ONLINE 1
#define | T_CCF_BASENODE_PTR _T("CCF_BASENODE_PTR")
#define | T_CCF_DATAOBJ_PTR _T("CCF_DATAOBJ_PTR")
#define | T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")
#define | T_CCF_NODEPROP_PTR _T("CCF_NODEPROP_PTR")
#define | T_CCF_NODETYPE _T("CCF_NODETYPE")
#define | T_CCF_NODETYPE_FLG _T("CCF_NODETYPE_FLG")
#define | T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")
#define | T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")
#define | W2T(szAnsiPtr, szWide) Unicode2Ansi( szAnsiPtr, szWide )
#define | WM_ADD_DEVICENODE (WM_USER + 101)
#define | WM_ADD_VIRTUALFILE (WM_USER + 103)
#define | WM_DEL_DEVICENODES (WM_USER + 100)
#define | WM_DEVICENODE_CLOSED (WM_USER + 102)
#define | WM_VIRTUALFILE_CLOSED (WM_USER + 104)

Typedefs

typedef struct
_tag_MMC_VERSION_INFO 		CONSOLE_VERSION

Functions

void _fastcall | CopyT2W (LPWSTR strDest, LPCTSTR strSource, size_t count)
CBaseNode * | ExtractBaseNodePtr (LPDATAOBJECT ipDataObject)
CDataObject * | ExtractDataObjPtr (LPDATAOBJECT ipDataObject)
HRESULT | ExtractFromDataObject (LPDATAOBJECT ipDataObject, UINT cf, ULONG cb, HGLOBAL *phGlobal)
ULONG | ExtractNodeTypeFlg (LPDATAOBJECT ipDataObject)
HRESULT | GetConsoleVersion (CONSOLE_VERSION *pVersion)
void | InitClipboardFormats ()
template<class TYPE >
void | SAFE_FREE_BITMAP (TYPE *&pObj)
template<class TYPE >
void | SAFE_FREE_ICON (TYPE *&pObj)
template<class TYPE >
void | SAFE_RELEASE (TYPE *&pObj)
void _fastcall | Unicode2Ansi (CHAR **pszAnsi, WCHAR *szWide)

Variables

UINT g_cfBaseNodePtr
UINT g_cfDataObjPtr
UINT g_cfDisplayName
UINT g_cfNodePropPtr
UINT g_cfNodeType
UINT g_cfNodeTypeFlg
UINT g_cfSnapinClsid
UINT g_cfszNodeType
CONSOLE_VERSION g_CV
HINSTANCE | g_hInst
ULONG g_uObjectCount
ULONG g_uServerLocks

Define Documentation

#define ATTRIBUTE_BACKUP_DEVICE 2048

Definition at line 118 of file globals.h.

#define ATTRIBUTE_DATA_ARCHIVE 2

Definition at line 114 of file globals.h.

#define ATTRIBUTE_DATA_HIDDEN 4

Definition at line 115 of file globals.h.

#define ATTRIBUTE_DATA_LOCKED 8

Definition at line 116 of file globals.h.

#define ATTRIBUTE_DATA_READONLY 16

Definition at line 117 of file globals.h.

#define BREAK_ON_ERROR ( hResult ) if( S_OK != hResult ) continue

Definition at line 168 of file globals.h.

#define BYTE_SIZE ( string ) ((_tcslen(string)+1) * sizeof(TCHAR))

Definition at line 166 of file globals.h.

#define IDM_NEW_DEVICE 100

Definition at line 130 of file globals.h.

#define IDM_NEW_FOLDER 200

Definition at line 131 of file globals.h.

#define IDM_NEW_VIRTFILE 400

Definition at line 133 of file globals.h.

#define IDM_TOGGLE_STATUS 300

Definition at line 132 of file globals.h.

#define IMG_CDROM_DEFAULT 6

Definition at line 127 of file globals.h.

#define IMG_DATA_FILE 2

Definition at line 123 of file globals.h.

#define IMG_DEVICE_DEFAULT 0

Definition at line 121 of file globals.h.

#define IMG_DEVICE_OFFLINE 1

Definition at line 122 of file globals.h.

#define IMG_DRIVE_DEFAULT 3

Definition at line 124 of file globals.h.

#define IMG_DRIVE_OFFLINE 4

Definition at line 125 of file globals.h.

#define IMG_FOLDER_DEFAULT 5

Definition at line 126 of file globals.h.

#define IMG_REMOVABLE_MEDIA 7

Definition at line 128 of file globals.h.

#define INIT_DEFAULT_NODE -1

Definition at line 106 of file globals.h.

#define MsgBox | ( | wszMsg,
 |  | wszTitle |
 | ) |  | ::MessageBox(NULL, wszMsg, wszTitle, MB_OK)

Definition at line 171 of file globals.h.

#define NODETYPE_DEVICE 200

Definition at line 109 of file globals.h.

#define NODETYPE_FOLDER 300

Definition at line 110 of file globals.h.

#define NODETYPE_STATIC 100

Definition at line 108 of file globals.h.

#define NODETYPE_VFILE 400

Definition at line 111 of file globals.h.

#define NP_FORMATETC {g_cfNodePropPtr, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL}

Definition at line 159 of file globals.h.

#define REQUEST_ICONSOLE 1001

Definition at line 152 of file globals.h.

#define REQUEST_ICONSOLENAMESPACE 1000

Definition at line 151 of file globals.h.

#define REQUEST_ICONSOLEVERB 1002

Definition at line 153 of file globals.h.

#define REQUEST_IHEADERCTRL 1004

Definition at line 155 of file globals.h.

#define REQUEST_IRESULTDATA 1003

Definition at line 154 of file globals.h.

#define STATUS_OFFLINE 0

Definition at line 136 of file globals.h.

#define STATUS_ONLINE 1

Definition at line 135 of file globals.h.

#define T_CCF_BASENODE_PTR _T("CCF_BASENODE_PTR")

Definition at line 98 of file globals.h.

#define T_CCF_DATAOBJ_PTR _T("CCF_DATAOBJ_PTR")

Definition at line 99 of file globals.h.

#define T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")

Definition at line 93 of file globals.h.

#define T_CCF_NODEPROP_PTR _T("CCF_NODEPROP_PTR")

Definition at line 100 of file globals.h.

#define T_CCF_NODETYPE _T("CCF_NODETYPE")

Definition at line 94 of file globals.h.

#define T_CCF_NODETYPE_FLG _T("CCF_NODETYPE_FLG")

Definition at line 101 of file globals.h.

#define T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")

Definition at line 96 of file globals.h.

#define T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")

Definition at line 95 of file globals.h.

#define W2T | ( | szAnsiPtr,
 |  | szWide |
 | ) |  | Unicode2Ansi( szAnsiPtr, szWide )

Definition at line 226 of file globals.h.

#define WM_ADD_DEVICENODE (WM_USER + 101)

Definition at line 142 of file globals.h.

#define WM_ADD_VIRTUALFILE (WM_USER + 103)

Definition at line 144 of file globals.h.

#define WM_DEL_DEVICENODES (WM_USER + 100)

Definition at line 141 of file globals.h.

#define WM_DEVICENODE_CLOSED (WM_USER + 102)

Definition at line 143 of file globals.h.

#define WM_VIRTUALFILE_CLOSED (WM_USER + 104)

Definition at line 145 of file globals.h.

Typedef Documentation

typedef struct _tag_MMC_VERSION_INFO CONSOLE_VERSION

Function Documentation

void _fastcall CopyT2W | ( | LPWSTR | strDest,
 |  | LPCTSTR | strSource,
 |  | size_t | count
 | ) |  |

Definition at line 64 of file globals.cpp.

{
#ifndef _UNICODE

  MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, strSource, -1, strDest, count );

#else

  wcsncpy( strDest, strSource, count );

#endif

  if ( count > 0 )
    strDest[ count - 1 ] = 0;
}

CBaseNode* ExtractBaseNodePtr ( LPDATAOBJECT ipDataObject )

Definition at line 150 of file globals.cpp.

{
  LPBASENODE  pNode   = NULL;
  HGLOBAL     hGlobal = NULL;
  HRESULT     hResult = S_FALSE;

  hResult = ExtractFromDataObject( ipDataObject,
                                   g_cfBaseNodePtr,
                                   sizeof(LPBASENODE),
                                   &hGlobal
                                 );
  if( SUCCEEDED(hResult) )
  {
    pNode = *(LPBASENODE*)(hGlobal);
    HGLOBAL hRetVal = GlobalFree(hGlobal);
    _ASSERT( NULL == hRetVal );        // Must return NULL
  }

  return pNode;

}

CDataObject* ExtractDataObjPtr ( LPDATAOBJECT ipDataObject )

Definition at line 179 of file globals.cpp.

{
  _ASSERT( 0 != g_cfDataObjPtr );

  HGLOBAL      hGlobal = NULL;
  HRESULT      hResult = S_OK;
  CDataObject* pDO     = NULL;

  hResult = ExtractFromDataObject( ipDataObject,
                                   g_cfDataObjPtr,
                                   sizeof(CDataObject **),
                                   &hGlobal
                                 );

  if( SUCCEEDED(hResult) )
  {
    pDO = *(CDataObject **)(hGlobal);
    _ASSERT( NULL != pDO );

    HGLOBAL hRetVal = GlobalFree(hGlobal);
    _ASSERT( NULL == hRetVal );       // Must return NULL
  }

  return pDO;

}

HRESULT ExtractFromDataObject | ( | LPDATAOBJECT | ipDataObject,
 |  | UINT | cf,
 |  | ULONG | cb,
 |  | HGLOBAL * | phGlobal
 | ) |  |

Definition at line 98 of file globals.cpp.

{
  _ASSERT( NULL != ipDataObject );

            *phGlobal = NULL;
  HRESULT   hResult   = S_FALSE;
  STGMEDIUM StgMedium = { TYMED_HGLOBAL,  NULL  };
  FORMATETC FormatEtc = { cfClipFormat, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };

  do
  {
    // Allocate memory for the stream
    StgMedium.hGlobal = ::GlobalAlloc( GMEM_SHARE, nByteCount );

    if( NULL == StgMedium.hGlobal )
    {
      hResult = E_OUTOFMEMORY;
      break;
    }

    // Attempt to get data from the object
    hResult = ipDataObject->GetDataHere( &FormatEtc, &StgMedium );
    if( FAILED(hResult) )
    {
      break;
    }
    // StgMedium now has the data we need
    *phGlobal = StgMedium.hGlobal;
    StgMedium.hGlobal = NULL;

  } while (0);

  if( FAILED(hResult) && StgMedium.hGlobal )
  {
    HGLOBAL hRetVal = ::GlobalFree(StgMedium.hGlobal);
    _ASSERT( NULL == hRetVal );         // Must return NULL
  }
  return hResult;

}

ULONG ExtractNodeTypeFlg ( LPDATAOBJECT ipDataObject )

Definition at line 217 of file globals.cpp.

{
  _ASSERT( NULL != ipDataObject );

  ULONG    nTypeFlg = 0;
  ULONG*   pTypeFlg = &nTypeFlg;
  HGLOBAL  hRetVal  = NULL;
  BOOL     bStatus  = FALSE;
  HRESULT  hResult  = S_FALSE;

  STGMEDIUM StgMedium = { TYMED_HGLOBAL,  NULL  };
  FORMATETC FormatEtc = { g_cfNodeTypeFlg, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };

  hResult = ipDataObject->GetData( &FormatEtc, &StgMedium );
  if( S_OK == hResult )
  {
    pTypeFlg = (ULONG*)::GlobalLock( StgMedium.hGlobal );
    nTypeFlg = *pTypeFlg;
    bStatus  = ::GlobalUnlock( StgMedium.hGlobal );
    hRetVal  = GlobalFree( StgMedium.hGlobal );
    _ASSERT( NULL == hRetVal );        // Must return NULL
  }
                                       // Return 0 if the call to
  return nTypeFlg;                     // ::GetData() failed
}

HRESULT GetConsoleVersion ( CONSOLE_VERSION * pVersion )

Definition at line 46 of file globals.cpp.

{
  _ASSERT( NULL != pVersion );
  HRESULT hResult = S_FALSE;

  pVersion->nMajor = 0;
  pVersion->nMinor = 0;

  IMMCVersionInfo* ipVersionInfo = NULL;
  hResult = CoCreateInstance( CLSID_MMCVersionInfo,
                              NULL,
                              CLSCTX_INPROC_SERVER,
                              IID_IMMCVersionInfo,
                              (void**)&ipVersionInfo
                            );
  // If the call to CoCreateInstance fails, the return value
  // will be "ClassFactory cannot supply requested class"
  if( S_OK != hResult )
    return S_FALSE;

  hResult = ipVersionInfo->GetMMCVersion( &pVersion->nMajor, &pVersion->nMinor );
  ipVersionInfo->Release();

  return hResult;
}

void InitClipboardFormats ( )

Definition at line 56 of file globals.cpp.

{
  g_cfDisplayName  = RegisterClipboardFormat( T_CCF_DISPLAY_NAME );
  g_cfNodeType     = RegisterClipboardFormat( T_CCF_NODETYPE );
  g_cfszNodeType   = RegisterClipboardFormat( T_CCF_SZNODETYPE );
  g_cfSnapinClsid  = RegisterClipboardFormat( T_CCF_SNAPIN_CLASSID );

}

template<class TYPE >
void SAFE_FREE_BITMAP ( TYPE *& pObj ) [inline]

Definition at line 191 of file globals.h.

{
  if( NULL != pObj )
  {
    BOOL bStatus = DeleteObject( pObj );
    pObj = NULL;
  }
  else
  {
    OutputDebugString(_T("Attempted to delete NULL Bitmap handle.\n"));
  }
}

template<class TYPE >
void SAFE_FREE_ICON ( TYPE *& pObj ) [inline]

Definition at line 206 of file globals.h.

{
  if( NULL != pObj )
  {
    BOOL bStatus = DestroyIcon( pObj );
    pObj = NULL;
  }
  else
  {
    OutputDebugString(_T("Attempted to delete NULL Icon handle.\n"));
  }
}

template<class TYPE >
void SAFE_RELEASE ( TYPE *& pObj ) [inline]

Definition at line 176 of file globals.h.

{
  if( NULL != pObj )
  {
    pObj->Release();
    pObj = NULL;
  }
  else
  {
    OutputDebugString(_T("Attempted to release NULL Com pointer.\n"));
  }
}

void _fastcall Unicode2Ansi | ( | CHAR ** | pszAnsi,
 |  | WCHAR * | szWide
 | ) |  |

Definition at line 38 of file globals.cpp.

{
  LONG nLen = wcslen( szWide ) +1;
  *pszAnsi = (char*)CoTaskMemAlloc( nLen );
  char* pCounter = *pszAnsi;

  while( *szWide )
  {
    *pCounter = LOBYTE(*szWide);
    pCounter++;
    szWide++;
  }
  *pCounter = NULL;
}

Variable Documentation

UINT g_cfBaseNodePtr

Definition at line 28 of file globals.cpp.

UINT g_cfDataObjPtr

Definition at line 29 of file globals.cpp.

UINT g_cfDisplayName

Definition at line 19 of file globals.cpp.

UINT g_cfNodePropPtr

Definition at line 30 of file globals.cpp.

UINT g_cfNodeType

Definition at line 20 of file globals.cpp.

UINT g_cfNodeTypeFlg

Definition at line 31 of file globals.cpp.

UINT g_cfSnapinClsid

Definition at line 22 of file globals.cpp.

UINT g_cfszNodeType

Definition at line 21 of file globals.cpp.

CONSOLE_VERSION g_CV

Definition at line 40 of file globals.cpp.

HINSTANCE g_hInst

Definition at line 62 of file DoServer.Cpp.

ULONG g_uObjectCount

Definition at line 28 of file globals.cpp.

ULONG g_uServerLocks

Definition at line 29 of file globals.cpp.

Generated on Wed Nov 13 2024 16:54:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/dragdrop/guids.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • dragdrop
Functions

guids.h File Reference

Go to the source code of this file.

Functions

DEFINE_GUID (CLSID_CComponentData, 0xc6f2200f, 0x7e99, 0x4313, 0x8c, 0x30, 0x69, 0x55, 0x5f, 0xf9, 0x13, 0xde)
DEFINE_GUID (CLSID_CVirtualFile, 0xf0091c49, 0xc869, 0x4941, 0xa8, 0x1c, 0xc7, 0x19, 0xad, 0x81, 0x74, 0xcc)
DEFINE_GUID (CLSID_CFolderNode, 0x520F23fA, 0x775D, 0x4015, 0xb4, 0x37, 0x98, 0xA2, 0x4B, 0x9D, 0x8, 0x5E)
DEFINE_GUID (CLSID_DeviceNode, 0x520F23f9, 0x775D, 0x4015, 0xB4, 0x37, 0x98, 0xA2, 0x4B, 0x9D, 0x8, 0x5E)
DEFINE_GUID (CLSID_CSnapinAbout, 0x8abe0b8c, 0xbf73, 0x4065, 0xbb, 0xd0, 0xaf, 0xb8, 0xa6, 0x17, 0xac, 0x23)

Function Documentation

DEFINE_GUID | ( | CLSID_CComponentData | ,
 |  | 0xc6f2200f | ,
 |  | 0x7e99 | ,
 |  | 0x4313 | ,
 |  | 0x8c | ,
 |  | 0x30 | ,
 |  | 0x69 | ,
 |  | 0x55 | ,
 |  | 0x5f | ,
 |  | 0xf9 | ,
 |  | 0x13 | ,
 |  | 0xde |
 | ) |  |
DEFINE_GUID | ( | CLSID_CVirtualFile | ,
 |  | 0xf0091c49 | ,
 |  | 0xc869 | ,
 |  | 0x4941 | ,
 |  | 0xa8 | ,
 |  | 0x1c | ,
 |  | 0xc7 | ,
 |  | 0x19 | ,
 |  | 0xad | ,
 |  | 0x81 | ,
 |  | 0x74 | ,
 |  | 0xcc |
 | ) |  |
DEFINE_GUID | ( | CLSID_CFolderNode | ,
 |  | 0x520F23fA | ,
 |  | 0x775D | ,
 |  | 0x4015 | ,
 |  | 0xb4 | ,
 |  | 0x37 | ,
 |  | 0x98 | ,
 |  | 0xA2 | ,
 |  | 0x4B | ,
 |  | 0x9D | ,
 |  | 0x8 | ,
 |  | 0x5E |
 | ) |  |
DEFINE_GUID | ( | CLSID_DeviceNode | ,
 |  | 0x520F23f9 | ,
 |  | 0x775D | ,
 |  | 0x4015 | ,
 |  | 0xB4 | ,
 |  | 0x37 | ,
 |  | 0x98 | ,
 |  | 0xA2 | ,
 |  | 0x4B | ,
 |  | 0x9D | ,
 |  | 0x8 | ,
 |  | 0x5E |
 | ) |  |
DEFINE_GUID | ( | CLSID_CSnapinAbout | ,
 |  | 0x8abe0b8c | ,
 |  | 0xbf73 | ,
 |  | 0x4065 | ,
 |  | 0xbb | ,
 |  | 0xd0 | ,
 |  | 0xaf | ,
 |  | 0xb8 | ,
 |  | 0xa6 | ,
 |  | 0x17 | ,
 |  | 0xac | ,
 |  | 0x23 |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/dragdrop/llistimpl.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • dragdrop
Functions

llistimpl.cpp File Reference

#include "LListImpl.h"

Go to the source code of this file.

Functions

BOOL IsValidAddress (const void *lp, UINT nBytes, BOOL bReadWrite)

Function Documentation

BOOL IsValidAddress | ( | const void * | lp,
 |  | UINT | nBytes,
 |  | BOOL | bReadWrite
 | ) |  |

Definition at line 53 of file llistimpl.cpp.

{
  // Simple version using Win-32 APIs for pointer validation.
  return (lp != NULL && !IsBadReadPtr(lp, nBytes) &&
         (!bReadWrite || !IsBadWritePtr((LPVOID)lp, nBytes)));

} //end IsValidAddress()

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/dragdrop/llistimpl.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • dragdrop
Classes | Typedefs | Functions

llistimpl.h File Reference

#include <CrtDbg.h>
#include <Windows.h>
#include <new.h>

Go to the source code of this file.

Classes

struct | __POSITION
class | CLListImpl< TYPE, ARG_TYPE >
struct | CLListImpl< TYPE, ARG_TYPE >::CNode
struct | CPlex

Typedefs

typedef __POSITION * | POSITION

Functions

BOOL | IsValidAddress (const void *lp, UINT nBytes, BOOL bReadWrite=TRUE)

Typedef Documentation

typedef __POSITION* POSITION

Definition at line 31 of file llistimpl.h.

Function Documentation

BOOL IsValidAddress | ( | const void * | lp,
 |  | UINT | nBytes,
 |  | BOOL | bReadWrite = TRUE
 | ) |  |

Definition at line 53 of file llistimpl.cpp.

{
  // Simple version using Win-32 APIs for pointer validation.
  return (lp != NULL && !IsBadReadPtr(lp, nBytes) &&
         (!bReadWrite || !IsBadWritePtr((LPVOID)lp, nBytes)));

} //end IsValidAddress()

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/dragdrop/registry.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • dragdrop
Defines | Functions

registry.cpp File Reference

#include <ObjBase.h>
#include "Registry.h"
#include "Globals.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define | MODULESTRING _T("Registry")

Functions

HRESULT | RecursiveDeleteKey (HKEY hKeyParent, const TCHAR *szKeyChild)
HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const TCHAR *szNameString, const CLSID &clsidAbout, const BOOL bSupportExtensions)
HRESULT | SetKeyAndValue (const TCHAR *pszPath, const TCHAR *szSubkey, const TCHAR *szValue)
HRESULT | SetSnapInKeyAndValue (const TCHAR *szKey, const TCHAR *szSubkey, const TCHAR *szName, const TCHAR *szValue)
HRESULT | SetValue (const TCHAR *szKey, const TCHAR *szValueName, const TCHAR *szValue)
LONG | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Define Documentation

#define MODULESTRING _T("Registry")

Definition at line 22 of file registry.cpp.

Function Documentation

HRESULT RecursiveDeleteKey | ( | HKEY | hKeyParent,
 |  | const TCHAR * | szKeyChild
 | ) |  |

Definition at line 262 of file registry.cpp.

{
  // Open the child.
  HKEY hKeyChild = NULL;
  LONG lResult   = ERROR_SUCCESS;

  do                     // We go to all this trouble to prevent any
  {                      // possibility of exiting while leaving a key open

    lResult = RegOpenKeyEx( hKeyParent,
                            lpszKeyChild,
                            0,
                            KEY_ALL_ACCESS,
                            &hKeyChild
                          );
    if( ERROR_SUCCESS != lResult )
      continue;

    // Enumerate all of the decendents of this child.
    FILETIME time;
    _TCHAR szBuffer[256];
    DWORD dwSize = 256;
    while( S_OK == RegEnumKeyEx(hKeyChild,0,szBuffer,&dwSize,NULL,NULL,NULL,&time) )
    {
      // Delete the decendents of this child.
      lResult = RecursiveDeleteKey( hKeyChild, szBuffer );
      if( ERROR_SUCCESS != lResult )
      {
        continue;
      }
      dwSize = 256;
    }
  }while( 0 );

  RegCloseKey( hKeyChild );            // Always try to close the child
                                       // then delete this child.
  return RegDeleteKey( hKeyParent, lpszKeyChild );
}

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const TCHAR * | szFriendlyName
 | ) |  |

Definition at line 51 of file registry.cpp.

{
  // Get server location.
  TCHAR    szModule[512] ;
  TCHAR*   pszCLSID = NULL;
  LPOLESTR wszCLSID = NULL ;
  HRESULT  hResult  = S_FALSE;

  DWORD dwResult = ::GetModuleFileName( hModule,
                                        szModule,
                                        sizeof(szModule)/sizeof(TCHAR)
                                      );
  if( 0 == dwResult ) return HRESULT_FROM_WIN32( dwResult );

  do                         // Fail unless we complete everything
  {
    // Get CLSID string in wide char
    hResult = StringFromCLSID( clsid, &wszCLSID ) ;
    if( S_OK != hResult )
    {
      CoTaskMemFree( wszCLSID );
      BREAK_ON_ERROR( hResult );
    }

    W2T( &pszCLSID, wszCLSID );          // W2T is defined in Globals.h
    CoTaskMemFree( wszCLSID );           // Through with wide version

    TCHAR szKey[64];                     // Build the CLSID key string CLSID\\{...}
    _tcscpy( szKey, _T("CLSID\\") );
    _tcscat( szKey, pszCLSID );

    // Add the CLSID to the registry.
    hResult = SetKeyAndValue( szKey, NULL, szFriendlyName );
    BREAK_ON_ERROR( hResult );

    // Add the server filename subkey under the CLSID key.
    hResult = SetKeyAndValue( szKey, _T("InprocServer32"), szModule );
    BREAK_ON_ERROR( hResult );

    // Set the threading model
    _tcscat( szKey, _T("\\InprocServer32") );
    hResult = SetValue( szKey, _T("ThreadingModel"), _T("Apartment") );
    BREAK_ON_ERROR( hResult );

  }while( 0 );

  CoTaskMemFree( pszCLSID );           // Through with TCHAR version

  return hResult;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | bSupportExtensions
 | ) |  |

Definition at line 149 of file registry.cpp.

{
  HRESULT hResult = S_FALSE;
  TCHAR*  pszSnapCLSID = NULL;         // Needed for TCHAR version of the ClassID

  // If any part of this process fails, jump out of the loop and return
  // the error code
  do
  {
    // Allocate the CLSID string
    LPOLESTR wszSnapCLSID  = NULL ;
    hResult = StringFromCLSID( clsid, &wszSnapCLSID ) ;
    if( S_OK != hResult )
    {
       CoTaskMemFree( wszSnapCLSID );
       continue;
    }

    W2T( &pszSnapCLSID, wszSnapCLSID );  // W2T is defined in Globals.h
    CoTaskMemFree( wszSnapCLSID );       // Through with wide version

    // Add the Snap-in's CLSID to the registry
    hResult = SetSnapInKeyAndValue( pszSnapCLSID, NULL, _T("NameString"), szNameString );
    BREAK_ON_ERROR( hResult );

    hResult = SetSnapInKeyAndValue( pszSnapCLSID, _T("StandAlone"), NULL, NULL );
    BREAK_ON_ERROR( hResult );

    // Add registry information for ISnapinAbout if we support it
    LPOLESTR wszAboutCLSID = NULL;
    TCHAR*   pszAboutCLSID = NULL;
    if( IID_NULL != clsidAbout )
    {
      hResult = StringFromCLSID( clsidAbout, &wszAboutCLSID );
      if( S_OK != hResult )
      {
        CoTaskMemFree( wszAboutCLSID ); // Free this memory before exiting
        continue;
      }

      W2T( &pszAboutCLSID, wszAboutCLSID );
      hResult = SetSnapInKeyAndValue( pszSnapCLSID, NULL, _T("About"), pszAboutCLSID );
      CoTaskMemFree( wszAboutCLSID );
      CoTaskMemFree( pszAboutCLSID );
      BREAK_ON_ERROR( hResult );
    }

    if( TRUE == bSupportExtensions )     // Build the NodeTypesKey
    {
      hResult = SetSnapInKeyAndValue( pszSnapCLSID, _T("NodeTypes"), NULL, NULL );
      BREAK_ON_ERROR( hResult );
      TCHAR szKey[64];
      _tcscpy( szKey, pszSnapCLSID );
      _tcscat(szKey, _T("\\NodeTypes"));
      hResult = SetSnapInKeyAndValue( szKey, pszSnapCLSID, NULL, NULL );
      BREAK_ON_ERROR( hResult );
    }
  }while( 0 );

  CoTaskMemFree( pszSnapCLSID);
  return hResult;
}

HRESULT SetKeyAndValue | ( | const TCHAR * | pszPath,
 |  | const TCHAR * | szSubkey,
 |  | const TCHAR * | szValue
 | ) |  |

Definition at line 310 of file registry.cpp.

{
  HKEY hKey = NULL;
  HRESULT hResult = S_FALSE;
  TCHAR szKeyBuf[1024];

  // Copy keyname into buffer.
  _tcscpy( szKeyBuf, szKey );

  // Add subkey name to buffer.
  if( NULL != szSubkey )
  {
    _tcscat( szKeyBuf, _T("\\") );
    _tcscat( szKeyBuf, szSubkey );
  }

  do                     // We go to all this trouble to prevent any
  {                      // possibility of exiting while leaving a key open

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx( HKEY_CLASSES_ROOT,
                                   szKeyBuf,
                                   0,
                                   NULL,
                                   REG_OPTION_NON_VOLATILE,
                                   KEY_ALL_ACCESS,
                                   NULL,
                                   &hKey,
                                   NULL
                                 );
    if( ERROR_SUCCESS != lResult )
    {
      hResult = HRESULT_FROM_WIN32( lResult );
      continue;
    }

    if( NULL != szValue )    // Now set the value
    {
      hResult = RegSetValueEx( hKey,
                               NULL,
                               0,
                               REG_SZ,
                               (BYTE*)szValue,
                               BYTE_SIZE( szValue )    // BYTE_SIZE is in Globals.h
                             );
      BREAK_ON_ERROR( hResult );
    }
  }while( 0 );

  RegCloseKey( hKey );       // Always try to close the key
  return hResult;
}

HRESULT SetSnapInKeyAndValue | ( | const TCHAR * | szKey,
 |  | const TCHAR * | szSubkey,
 |  | const TCHAR * | szName,
 |  | const TCHAR * | szValue
 | ) |  |

Definition at line 429 of file registry.cpp.

{
  HKEY    hKey = NULL;
  HRESULT hResult = S_FALSE;
  TCHAR   szKeyBuf[1024];

  // Load the buffer with the Snap-In Location
  _tcscpy( szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns") );

  _tcscat( szKeyBuf, _T("\\") );       // Copy keyname into buffer.
  _tcscat( szKeyBuf, szKey );

  if( NULL != szSubkey )               // Add subkey name to buffer.
  {
    _tcscat( szKeyBuf, _T("\\") );
    _tcscat( szKeyBuf, szSubkey );
  }

  do                     // We go to all this trouble to prevent any
  {                      // possibility of exiting while leaving a key open

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx( HKEY_LOCAL_MACHINE,
                                   szKeyBuf,
                                   0,
                                   NULL,
                                   REG_OPTION_NON_VOLATILE,
                                   KEY_ALL_ACCESS,
                                   NULL,
                                   &hKey,
                                   NULL
                                 );
    if( ERROR_SUCCESS != lResult )     // Will return S_FALSE
      continue;

    // Set the Value.
    if( szValue != NULL )
    {
      hResult = RegSetValueEx( hKey,
                               szName,
                               0,
                               REG_SZ,
                               (BYTE*)szValue,
                               BYTE_SIZE(szValue)
                             );
      BREAK_ON_ERROR( hResult );
    }
    else
    {                        // Got this far so everything is OK.
      hResult = S_OK;
    }
  }while( 0 );

  RegCloseKey( hKey );       //Always attempt to close the key
  return hResult;
}

HRESULT SetValue | ( | const TCHAR * | szKey,
 |  | const TCHAR * | szValueName,
 |  | const TCHAR * | szValue
 | ) |  |

Definition at line 372 of file registry.cpp.

{
  HKEY    hKey = NULL;
  HRESULT hResult = S_FALSE;
  TCHAR szKeyBuf[1024];

  // Copy keyname into buffer.
  _tcscpy( szKeyBuf, szKey );

  do                     // We go to all this trouble to prevent any
  {                      // possibility of exiting while leaving a key open

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx( HKEY_CLASSES_ROOT ,
                                   szKeyBuf,
                                   0,
                                   NULL,
                                   REG_OPTION_NON_VOLATILE,
                                   KEY_ALL_ACCESS,
                                   NULL,
                                   &hKey,
                                   NULL
                                 );
    if( ERROR_SUCCESS != lResult )
    {
      hResult = HRESULT_FROM_WIN32( lResult );
      continue;
    }

    if( NULL != szValue )    // Now set the value
    {
      hResult = RegSetValueEx( hKey,
                               szValueName,
                               0,
                               REG_SZ,
                               (BYTE*)szValue,
                               BYTE_SIZE( szValue )
                             );
      BREAK_ON_ERROR( hResult );
    }
  }while( 0 );

  RegCloseKey( hKey );       //Always attempt to close the key
  return hResult;
}

LONG UnregisterServer ( const CLSID & clsid )

Definition at line 111 of file registry.cpp.

{
  HRESULT hResult = S_OK;

  // Allocate the CLSID string
  LPOLESTR wszCLSID = NULL ;
  hResult = StringFromCLSID( clsid, &wszCLSID );
  if( S_OK != hResult )
  {
    CoTaskMemFree( wszCLSID );
    return hResult;
  }

  // Build the key CLSID\\{...}
  TCHAR szKey[64];
  _tcscpy( szKey, _T("CLSID\\") );

  TCHAR* pszCLSID = NULL;
  W2T( &pszCLSID, wszCLSID );          // W2T is defined in Globals.h
  CoTaskMemFree( wszCLSID );           // Through with wide version

  _tcscat( szKey, pszCLSID );
  CoTaskMemFree( pszCLSID );           // Through with TCHAR version

  // Delete the CLSID Key - CLSID\{...}
  LONG lResult = RecursiveDeleteKey( HKEY_CLASSES_ROOT, szKey );
  if( ERROR_SUCCESS != lResult )
    hResult = HRESULT_FROM_WIN32( lResult );

  return hResult;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 222 of file registry.cpp.

{
  HRESULT hResult = S_OK;

  TCHAR    szKeyBuf[1024];
  LPOLESTR wszCLSID = NULL;
  TCHAR*   pszCLSID = NULL;        // Needed for TCHAR version of the ClassID

  // Get CLSID as a wide string
  hResult = StringFromCLSID( clsid, &wszCLSID );
  if( S_OK != hResult )
  {
    CoTaskMemFree( wszCLSID );
    return hResult;
  }

  W2T( &pszCLSID, wszCLSID );          // W2T is defined in Globals.h
  CoTaskMemFree( wszCLSID );           // Through with wide version

  // Load the buffer with the Snap-In Location
  _tcscpy( szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns") );

  _tcscat( szKeyBuf, _T("\\") );       // Copy keyname into buffer.
  _tcscat( szKeyBuf, pszCLSID );

  // Delete the CLSID Key - CLSID\{...}
  LONG lResult = RecursiveDeleteKey( HKEY_LOCAL_MACHINE, szKeyBuf );
  if( ERROR_SUCCESS != lResult )
    hResult = HRESULT_FROM_WIN32( lResult );

  CoTaskMemFree( pszCLSID );
  return hResult;
}

Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/dragdrop/registry.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • dragdrop
Functions

registry.h File Reference

#include <tchar.h>

Go to the source code of this file.

Functions

HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const TCHAR *szNameString, const CLSID &clsidAbout, const BOOL fSupportExtensions=FALSE)
HRESULT | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Function Documentation

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const TCHAR * | szFriendlyName
 | ) |  |

Definition at line 51 of file registry.cpp.

{
  // Get server location.
  TCHAR    szModule[512] ;
  TCHAR*   pszCLSID = NULL;
  WCHAR*   wszCLSID = NULL ;
  HRESULT  hResult  = S_FALSE;

  DWORD dwResult = ::GetModuleFileName( hModule,
                                        szModule,
                                        sizeof(szModule)/sizeof(TCHAR)
                                      );
  if( 0 == dwResult ) return HRESULT_FROM_WIN32( dwResult );

  do                         // Fail unless we complete everything
  {
    // Get CLSID string in wide char
    hResult = StringFromCLSID( clsid, &wszCLSID ) ;
    if( S_OK != hResult )
    {
      CoTaskMemFree( wszCLSID );
      BREAK_ON_ERROR( hResult );
    }

    W2T( &pszCLSID, wszCLSID );          // W2T is defined in Globals.h
    CoTaskMemFree( wszCLSID );           // Through with wide version

    TCHAR szKey[64];                     // Build the CLSID key string CLSID\\{...}
    _tcscpy( szKey, _T("CLSID\\") );
    _tcscat( szKey, pszCLSID );

    // Add the CLSID to the registry.
    hResult = SetKeyAndValue( szKey, NULL, szFriendlyName );
    BREAK_ON_ERROR( hResult );

    // Add the server filename subkey under the CLSID key.
    hResult = SetKeyAndValue( szKey, _T("InprocServer32"), szModule );
    BREAK_ON_ERROR( hResult );

    // Set the threading model
    _tcscat( szKey, _T("\\InprocServer32") );
    hResult = SetValue( szKey, _T("ThreadingModel"), _T("Apartment") );
    BREAK_ON_ERROR( hResult );

  }while( 0 );

  CoTaskMemFree( pszCLSID );           // Through with TCHAR version

  return hResult;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | fSupportExtensions = FALSE
 | ) |  |

Definition at line 149 of file registry.cpp.

{
  HRESULT hResult = S_FALSE;
  TCHAR*  pszSnapCLSID = NULL;         // Needed for TCHAR version of the ClassID

  // If any part of this process fails, jump out of the loop and return
  // the error code
  do
  {
    // Allocate the CLSID string
    LPOLESTR wszSnapCLSID  = NULL ;
    hResult = StringFromCLSID( clsid, &wszSnapCLSID ) ;
    if( S_OK != hResult )
    {
       CoTaskMemFree( wszSnapCLSID );
       continue;
    }

    W2T( &pszSnapCLSID, wszSnapCLSID );  // W2T is defined in Globals.h
    CoTaskMemFree( wszSnapCLSID );       // Through with wide version

    // Add the Snap-in's CLSID to the registry
    hResult = SetSnapInKeyAndValue( pszSnapCLSID, NULL, _T("NameString"), szNameString );
    BREAK_ON_ERROR( hResult );

    hResult = SetSnapInKeyAndValue( pszSnapCLSID, _T("StandAlone"), NULL, NULL );
    BREAK_ON_ERROR( hResult );

    // Add registry information for ISnapinAbout if we support it
    LPOLESTR wszAboutCLSID = NULL;
    TCHAR*   pszAboutCLSID = NULL;
    if( IID_NULL != clsidAbout )
    {
      hResult = StringFromCLSID( clsidAbout, &wszAboutCLSID );
      if( S_OK != hResult )
      {
        CoTaskMemFree( wszAboutCLSID ); // Free this memory before exiting
        continue;
      }

      W2T( &pszAboutCLSID, wszAboutCLSID );
      hResult = SetSnapInKeyAndValue( pszSnapCLSID, NULL, _T("About"), pszAboutCLSID );
      CoTaskMemFree( wszAboutCLSID );
      CoTaskMemFree( pszAboutCLSID );
      BREAK_ON_ERROR( hResult );
    }

    if( TRUE == bSupportExtensions )     // Build the NodeTypesKey
    {
      hResult = SetSnapInKeyAndValue( pszSnapCLSID, _T("NodeTypes"), NULL, NULL );
      BREAK_ON_ERROR( hResult );
      TCHAR szKey[64];
      _tcscpy( szKey, pszSnapCLSID );
      _tcscat(szKey, _T("\\NodeTypes"));
      hResult = SetSnapInKeyAndValue( szKey, pszSnapCLSID, NULL, NULL );
      BREAK_ON_ERROR( hResult );
    }
  }while( 0 );

  CoTaskMemFree( pszSnapCLSID);
  return hResult;
}

HRESULT UnregisterServer ( const CLSID & clsid )

Definition at line 112 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

  MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
  _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 184 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Generated on Wed Nov 13 2024 16:53:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/dragdrop/resource.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • dragdrop
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDB_APPIMG_16 104
#define | IDB_APPIMG_32 101
#define | IDB_NODEIMAGES_16 106
#define | IDB_NODEIMAGES_32 107
#define | IDC_ARCHIVE_ATTR 1000
#define | IDC_BACKUP_FLAG 1005
#define | IDC_DEVNAME_EDIT 1004
#define | IDC_HIDDEN_ATTR 1001
#define | IDC_LOCKED_ATTR 1002
#define | IDC_READONLY_ATTR 1003
#define | IDD_ADDDEVICE_DLG 109
#define | IDD_ADDVFILE_DLG 110
#define | IDD_BASE_DIALOG 108
#define | IDI_APP_ICON 105

Define Documentation

#define IDB_APPIMG_16 104

Definition at line 6 of file resource.h.

#define IDB_APPIMG_32 101

Definition at line 5 of file resource.h.

#define IDB_NODEIMAGES_16 106

Definition at line 8 of file resource.h.

#define IDB_NODEIMAGES_32 107

Definition at line 9 of file resource.h.

#define IDC_ARCHIVE_ATTR 1000

Definition at line 13 of file resource.h.

#define IDC_BACKUP_FLAG 1005

Definition at line 18 of file resource.h.

#define IDC_DEVNAME_EDIT 1004

Definition at line 17 of file resource.h.

#define IDC_HIDDEN_ATTR 1001

Definition at line 14 of file resource.h.

#define IDC_LOCKED_ATTR 1002

Definition at line 15 of file resource.h.

#define IDC_READONLY_ATTR 1003

Definition at line 16 of file resource.h.

#define IDD_ADDDEVICE_DLG 109

Definition at line 11 of file resource.h.

#define IDD_ADDVFILE_DLG 110

Definition at line 12 of file resource.h.

#define IDD_BASE_DIALOG 108

Definition at line 10 of file resource.h.

#define IDI_APP_ICON 105

Definition at line 7 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/dragdrop/staticnode.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • dragdrop
Defines

staticnode.cpp File Reference

#include "StaticNode.h"
#include "DeviceNode.h"
#include "CompData.h"
#include "Comp.h"
#include "AddDeviceDlg.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CStaticNode")

Define Documentation

#define MODULESTRING _T("CStaticNode")

Definition at line 25 of file staticnode.cpp.

Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/dragdrop/staticnode.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • dragdrop
Classes

staticnode.h File Reference

#include "Globals.h"
#include "BaseNode.h"
#include "LListImpl.h"
#include "LListImpl.h"

Go to the source code of this file.

Classes

class CStaticNode
Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/dragdrop/tracemacro.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • dragdrop
Functions

tracemacro.cpp File Reference

#include "Globals.h"
#include "TraceMacro.h"
#include <StdIo.h>

Go to the source code of this file.

Functions

VOID | MapEvent (LONG Event, LPTSTR szEventStr)
VOID | Trace_Event (LPCTSTR pszClass, LPCTSTR pszFunction, LONG nEvent)
VOID | Trace_HR (LPCTSTR pszClass, LPCTSTR pszFunction, HRESULT hr)
VOID | Trace_Pointer (LPCTSTR pszClass, LPCTSTR pszFunction, LPCTSTR pszAction, ULONG ulValue)
VOID | Trace_Start (LPCTSTR pszClass, LPCTSTR pszFunction)
VOID | Trace_Value (LPCTSTR pszClass, LPCTSTR pszFunction, LPCTSTR pszValueName, LONG nValue)

Function Documentation

VOID MapEvent | ( | LONG | Event,
 |  | LPTSTR | szEventStr
 | ) |  |

Definition at line 179 of file tracemacro.cpp.

{
#ifdef _DEBUG

  switch( Event )
  {
    case MMCN_ACTIVATE:
      _tcscpy( szEventStr, _T("MMCN_ACTIVATE          ") );
      break;

    case MMCN_ADD_IMAGES:
      _tcscpy( szEventStr, _T("MMCN_ADD_IMAGES        ") );
      break;

    case MMCN_BTN_CLICK:
      _tcscpy( szEventStr, _T("MMCN_BTN_CLICK         ") );
      break;

    case MMCN_CLICK:
      _tcscpy( szEventStr, _T("MMCN_CLICK             ") );
      break;

    case MMCN_COLUMN_CLICK:
      _tcscpy( szEventStr, _T("MMCN_COLUMN_CLICK       ") );
      break;

    case MMCN_CONTEXTMENU:
      _tcscpy( szEventStr, _T("MMCN_CONTEXTMENU        ") );
      break;

    case MMCN_CUTORMOVE:
      _tcscpy( szEventStr, _T("MMCN_CUTORMOVE          ") );
      break;

    case MMCN_DBLCLICK:
      _tcscpy( szEventStr, _T("MMCN_DBLCLICK           ") );
      break;

    case MMCN_DELETE:
      _tcscpy( szEventStr, _T("MMCN_DELETE             ") );
      break;

    case MMCN_DESELECT_ALL:
      _tcscpy( szEventStr, _T("MMCN_DESELECT_ALL       ") );
      break;

    case MMCN_EXPAND:
      _tcscpy( szEventStr, _T("MMCN_EXPAND             ") );
      break;

    case MMCN_HELP:
      _tcscpy( szEventStr, _T("MMCN_HELP               ") );
      break;

    case MMCN_MENU_BTNCLICK:
      _tcscpy( szEventStr, _T("MMCN_MENU_BTNCLICK      ") );
      break;

    case MMCN_MINIMIZED:
      _tcscpy( szEventStr, _T("MMCN_MINIMIZED          ") );
      break;

    case MMCN_PASTE:
      _tcscpy( szEventStr, _T("MMCN_PASTE              ") );
      break;

    case MMCN_PROPERTY_CHANGE:
      _tcscpy( szEventStr, _T("MMCN_PROPERTY_CHANGE    ") );
      break;

    case MMCN_QUERY_PASTE:
      _tcscpy( szEventStr, _T("MMCN_QUERY_PASTE        ") );
      break;

    case MMCN_REFRESH:
      _tcscpy( szEventStr, _T("MMCN_REFRESH            ") );
      break;

    case MMCN_REMOVE_CHILDREN:
      _tcscpy( szEventStr, _T("MMCN_REMOVE_CHILDREN    ") );
      break;

    case MMCN_RENAME:
      _tcscpy( szEventStr, _T("MMCN_RENAME             ") );
      break;

    case MMCN_SELECT:
      _tcscpy( szEventStr, _T("MMCN_SELECT             ") );
      break;

    case MMCN_SHOW:
      _tcscpy( szEventStr, _T("MMCN_SHOW               ") );
      break;

    case MMCN_VIEW_CHANGE:
      _tcscpy( szEventStr, _T("MMCN_VIEW_CHANGE        ") );
      break;

    case MMCN_SNAPINHELP:
      _tcscpy( szEventStr, _T("MMCN_SNAPINHELP         ") );
      break;

    case MMCN_CONTEXTHELP:
      _tcscpy( szEventStr, _T("MMCN_CONTEXTHELP        ") );
      break;

    case MMCN_INITOCX:
      _tcscpy( szEventStr, _T("MMCN_INITOCX            ") );
      break;

    // MMC Version 1.1 notifications
    case MMCN_FILTER_CHANGE:
      _tcscpy( szEventStr, _T("MMCN_FILTER_CHANGE      ") );
      break;

    case MMCN_FILTERBTN_CLICK:
      _tcscpy( szEventStr, _T("MMCN_FILTERBTN_CLICK    ") );
      break;

    case MMCN_RESTORE_VIEW:
      _tcscpy( szEventStr, _T("MMCN_RESTORE_VIEW       ") );
      break;

    case MMCN_PRINT:
      _tcscpy( szEventStr, _T("MMCN_PRINT              ") );
      break;

    case MMCN_PRELOAD:
      _tcscpy( szEventStr, _T("MMCN_PRELOAD            ") );
      break;

    case MMCN_LISTPAD:
      _tcscpy( szEventStr, _T("MMCN_LISTPAD            ") );
      break;

    case MMCN_EXPANDSYNC:
      _tcscpy( szEventStr, _T("MMCN_EXPANDSYNC         ") );
      break;

    // MMC Version 1.2 notifications
    case MMCN_COLUMNS_CHANGED:
      _tcscpy( szEventStr, _T("MMCN_COLUMNS_CHANGED    ") );
      break;

    // MMC Version 2.0 notifications
    case MMCN_CANPASTE_OUTOFPROC:
      _tcscpy( szEventStr, _T("MMCN_CANPASTE_OUTOFPROC ") );
      break;

    default:
      _stprintf( szEventStr, _T("0x%X"), Event );
      break;
  }

#endif
} //end MapEvent()

VOID Trace_Event | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LONG | nEvent
 | ) |  |

Definition at line 119 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szEventStr[64];
  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Event = %s\n");
  INT    nChars     = 0;

  MapEvent( nEvent, szEventStr );

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      szEventStr
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Event()

VOID Trace_HR | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | HRESULT | hr
 | ) |  |

Definition at line 28 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Returned 0x%X\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer, szFormat, pszClass, pszFunction, hr );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_HR()

VOID Trace_Pointer | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LPCTSTR | pszAction,
 |  | ULONG | ulValue
 | ) |  |

Definition at line 86 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> %s = 0x%X\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      pszAction,
                      ulValue
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Pointer()

VOID Trace_Start | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction
 | ) |  |

Definition at line 151 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Started \n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Start()

VOID Trace_Value | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LPCTSTR | pszValueName,
 |  | LONG | nValue
 | ) |  |

Definition at line 54 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> %s = %u\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      pszValueName,
                      nValue
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Value()

Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/dragdrop/tracemacro.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • dragdrop
Defines | Functions

tracemacro.h File Reference

Go to the source code of this file.

Defines

#define | TRACE_EVENT
#define | TRACE_HRESULT
#define | TRACE_PTR
#define | TRACE_START
#define | TRACE_VAL

Functions

VOID | MapEvent (LONG Event, LPTSTR szEventStr)
VOID | Trace_Event (LPCTSTR pszClass, LPCTSTR pszFunction, LONG nEvent)
VOID | Trace_HR (LPCTSTR pszClass, LPCTSTR pszFunction, HRESULT hr)
VOID | Trace_Pointer (LPCTSTR pszClass, LPCTSTR pszFunction, LPCTSTR pszAction, ULONG ulValue)
VOID | Trace_Start (LPCTSTR pszClass, LPCTSTR pszFunction)
VOID | Trace_Value (LPCTSTR pszClass, LPCTSTR pszFunction, LPCTSTR pszValueName, LONG nValue)

Define Documentation

#define TRACE_EVENT

Definition at line 64 of file tracemacro.h.

#define TRACE_HRESULT

Definition at line 55 of file tracemacro.h.

#define TRACE_PTR

Definition at line 61 of file tracemacro.h.

#define TRACE_START

Definition at line 67 of file tracemacro.h.

#define TRACE_VAL

Definition at line 58 of file tracemacro.h.

Function Documentation

VOID MapEvent | ( | LONG | Event,
 |  | LPTSTR | szEventStr
 | ) |  |

Definition at line 146 of file tracemacro.cpp.

{
#ifdef _DEBUG

  switch( Event )
  {
    case 0x8001:
      _tcscpy( szEventStr, _T("MMCN_ACTIVATE       ") );
      break;

    case 0x8002:
      _tcscpy( szEventStr, _T("MMCN_ADD_IMAGES     ") );
      break;

    case 0x8003:
      _tcscpy( szEventStr, _T("MMCN_BTN_CLICK      ") );
      break;

    case 0x8004:
      _tcscpy( szEventStr, _T("MMCN_CLICK          ") );
      break;

    case 0x8005:
      _tcscpy( szEventStr, _T("MMCN_COLUMN_CLICK   ") );
      break;

    case 0x8006:
      _tcscpy( szEventStr, _T("MMCN_CONTEXTMENU    ") );
      break;

    case 0x8007:
      _tcscpy( szEventStr, _T("MMCN_CUTORMOVE      ") );
      break;

    case 0x8008:
      _tcscpy( szEventStr, _T("MMCN_DBLCLICK       ") );
      break;

    case 0x8009:
      _tcscpy( szEventStr, _T("MMCN_DELETE         ") );
      break;

    case 0x800A:
      _tcscpy( szEventStr, _T("MMCN_DESELECT_ALL   ") );
      break;

    case 0x800B:
      _tcscpy( szEventStr, _T("MMCN_EXPAND         ") );
      break;

    case 0x800C:
      _tcscpy( szEventStr, _T("MMCN_HELP           ") );
      break;

    case 0x800D:
      _tcscpy( szEventStr, _T("MMCN_MENU_BTNCLICK  ") );
      break;

    case 0x800E:
      _tcscpy( szEventStr, _T("MMCN_MINIMIZED      ") );
      break;

    case 0x800F:
      _tcscpy( szEventStr, _T("MMCN_PASTE          ") );
      break;

    case 0x8010:
      _tcscpy( szEventStr, _T("MMCN_PROPERTY_CHANGE") );
      break;

    case 0x8011:
      _tcscpy( szEventStr, _T("MMCN_QUERY_PASTE    ") );
      break;

    case 0x8012:
      _tcscpy( szEventStr, _T("MMCN_REFRESH        ") );
      break;

    case 0x8013:
      _tcscpy( szEventStr, _T("MMCN_REMOVE_CHILDREN") );
      break;

    case 0x8014:
      _tcscpy( szEventStr, _T("MMCN_RENAME         ") );
      break;

    case 0x8015:
      _tcscpy( szEventStr, _T("MMCN_SELECT         ") );
      break;

    case 0x8016:
      _tcscpy( szEventStr, _T("MMCN_SHOW           ") );
      break;

    case 0x8017:
      _tcscpy( szEventStr, _T("MMCN_VIEW_CHANGE    ") );
      break;

    case 0x8018:
      _tcscpy( szEventStr, _T("MMCN_SNAPINHELP     ") );
      break;

    case 0x8019:
      _tcscpy( szEventStr, _T("MMCN_CONTEXTHELP    ") );
      break;

    case 0x801A:
      _tcscpy( szEventStr, _T("MMCN_INITOCX        ") );
      break;

    case 0x8021:
      _tcscpy( szEventStr, _T("MMCN_EXPANDSYNC     ") );
      break;

    default:
      _stprintf( szEventStr, _T("0x%X"), Event );
      break;
  }

#endif
} //end MapEvent()

VOID Trace_Event | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LONG | nEvent
 | ) |  |

Definition at line 86 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szEventStr[22];
  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Event = %s\n");
  INT    nChars     = 0;

  MapEvent( nEvent, szEventStr );

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      szEventStr
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Event()

VOID Trace_HR | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | HRESULT | hr
 | ) |  |

Definition at line 27 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Returned 0x%X\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer, szFormat, pszClass, pszFunction, hr );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_HR()

VOID Trace_Pointer | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LPCTSTR | pszAction,
 |  | ULONG | ulValue
 | ) |  |

Definition at line 86 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> %s = 0x%X\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      pszAction,
                      ulValue
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Pointer()

VOID Trace_Start | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction
 | ) |  |

Definition at line 118 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Started \n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Start()

VOID Trace_Value | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LPCTSTR | pszValueName,
 |  | LONG | nValue
 | ) |  |

Definition at line 53 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> %s = %u\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      pszValueName,
                      nValue
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Value()

Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/dragdrop/virtualfile.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • dragdrop
Defines

virtualfile.cpp File Reference

#include "VirtualFile.h"
#include "FolderNode.h"
#include "Globals.h"
#include "CompData.h"
#include "Comp.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CVirtualFile")

Define Documentation

#define MODULESTRING _T("CVirtualFile")

Definition at line 25 of file virtualfile.cpp.

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/dragdrop/virtualfile.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • dragdrop
Classes

virtualfile.h File Reference

#include "Globals.h"
#include "BaseNode.h"

Go to the source code of this file.

Classes

class CVirtualFile
Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/help/about.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • help
Functions

about.cpp File Reference

#include "Globals.h"
#include "About.h"
#include "Resource.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CSnapinAbout

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 85 of file about.cpp.

{
  if( 0 == InterlockedDecrement((long*)&m_cRef) )
  {
    // we need to decrement our object count in the DLL
    delete this;
    return 0;
  }
  return m_cRef;
}

Generated on Wed Nov 13 2024 16:54:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/help/about.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • help
Classes

about.h File Reference

#include <mmc.h>

Go to the source code of this file.

Classes

class CSnapinAbout
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/help/adddevicedlg.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • help

adddevicedlg.cpp File Reference

#include "AddDeviceDlg.h"
#include "Globals.h"
#include "Resource.h"
#include "BaseNode.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/help/adddevicedlg.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • help
Classes

adddevicedlg.h File Reference

#include "BaseDialog.h"
#include "BaseDialog.h"

Go to the source code of this file.

Classes

class CAddDeviceDlg
Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/help/addvfiledlg.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • help

addvfiledlg.cpp File Reference

#include "AddVFileDlg.h"
#include "Globals.h"
#include "Resource.h"
#include "BaseNode.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/help/addvfiledlg.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • help
Classes

addvfiledlg.h File Reference

#include "BaseDialog.h"

Go to the source code of this file.

Classes

class CAddVFileDlg
Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/help/basedialog.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • help

basedialog.cpp File Reference

#include "BaseDialog.h"
#include "Globals.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/help/basedialog.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • help
Classes

basedialog.h File Reference

#include <Windows.h>

Go to the source code of this file.

Classes

class CBaseDialog
Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/help/basenode.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • help
Classes | Defines | Typedefs

basenode.h File Reference

#include "Globals.h"
#include "Resource.h"

Go to the source code of this file.

Classes

class | CBaseNode
struct | tag_BASENODE_PROPERTIES

Defines

#define | DEFAULT_RDI_MASK (RDI_STR | RDI_PARAM | RDI_IMAGE)
#define | DEFAULT_SDI_MASK (SDI_STR | SDI_PARAM | SDI_IMAGE | SDI_OPENIMAGE | SDI_PARENT | SDI_CHILDREN)
#define | MAX_NAME_LEN 64

Typedefs

typedef CBaseNode * | LPBASENODE
typedef NODE_PROPERTIES * | LPNODE_PROPERTIES
typedef struct
tag_BASENODE_PROPERTIES 		NODE_PROPERTIES

Define Documentation

#define DEFAULT_RDI_MASK (RDI_STR | RDI_PARAM | RDI_IMAGE)

Definition at line 24 of file basenode.h.

#define DEFAULT_SDI_MASK (SDI_STR | SDI_PARAM | SDI_IMAGE | SDI_OPENIMAGE | SDI_PARENT | SDI_CHILDREN)

Definition at line 23 of file basenode.h.

#define MAX_NAME_LEN 64

Definition at line 26 of file basenode.h.

Typedef Documentation

typedef CBaseNode* LPBASENODE

Definition at line 46 of file basenode.h.

typedef NODE_PROPERTIES* LPNODE_PROPERTIES

Definition at line 45 of file basenode.h.

typedef struct tag_BASENODE_PROPERTIES NODE_PROPERTIES
Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/help/basesnap.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • help
Defines | Functions

basesnap.cpp File Reference

#include <ObjBase.h>
#include <InitGuid.h>
#include "Globals.h"
#include "BaseSnap.h"
#include "CompData.h"
#include "About.h"
#include "Registry.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define | MODULESTRING _T("BaseSnap")

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)
BOOL WINAPI | DllMain (HINSTANCE hInstDLL, DWORD fdwReason, void *lpvReserved)
STDAPI | DllRegisterServer ()
STDAPI | DllUnregisterServer ()
STDMETHODIMP_ (ULONG) CClassFactory

Define Documentation

#define MODULESTRING _T("BaseSnap")

Definition at line 28 of file basesnap.cpp.

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 226 of file basesnap.cpp.

{
  if( 0 == g_uObjectCount && 0 == g_uServerLocks )
    return S_OK;
  else
    return S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 190 of file basesnap.cpp.

{
  // Test for CSnapinAbout
  if( (rclsid != CLSID_CComponentData) && (rclsid != CLSID_CSnapinAbout) )
    return CLASS_E_CLASSNOTAVAILABLE;

  if( !ppvObj )
    return E_FAIL;

  *ppvObj = NULL;

  // We can only hand out IUnknown and IClassFactory pointers.  Fail
  // if caller asks for anything else.
  if( !IsEqualIID(riid, IID_IUnknown) && !IsEqualIID(riid, IID_IClassFactory) )
    return E_NOINTERFACE;

  CClassFactory *pFactory = NULL;

  // Create the new class factory.  Pass in the type of object to create
  if( rclsid == CLSID_CComponentData )
    pFactory = new CClassFactory(CClassFactory::COMPONENTDATA);
  else if( rclsid == CLSID_CSnapinAbout )
    pFactory = new CClassFactory(CClassFactory::ABOUT);

  HRESULT hResult = pFactory->QueryInterface( riid, ppvObj );

  return hResult;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstDLL,
 |  | DWORD | fdwReason,
 |  | void * | lpvReserved
 | ) |  |

Definition at line 173 of file basesnap.cpp.

{
  if( DLL_PROCESS_ATTACH == fdwReason )
  {
     g_hInst = hInstDLL;
  }

  return TRUE;
}

STDAPI DllRegisterServer ( void )

Definition at line 236 of file basesnap.cpp.

{
  HRESULT hResult = S_FALSE;

  do
  { // Support ISnapinAbout
    hResult = RegisterServer( g_hInst, CLSID_CSnapinAbout, gtszABOUT_NAME );
    BREAK_ON_ERROR( hResult );

    hResult = RegisterServer( g_hInst, CLSID_CComponentData, gtszSNAPIN_NAME );
    BREAK_ON_ERROR( hResult );

    hResult = RegisterSnapin( CLSID_CComponentData, gtszSNAPIN_NAME, CLSID_CSnapinAbout, FALSE );
    BREAK_ON_ERROR( hResult );

  }while( 0 );

  return hResult;
}

STDAPI DllUnregisterServer ( void )

Definition at line 258 of file basesnap.cpp.

{
  if( S_OK == UnregisterServer(CLSID_CComponentData) )
    return UnregisterSnapin(CLSID_CComponentData);
  else
    return E_FAIL;
}

STDMETHODIMP_ ( ULONG )

Definition at line 91 of file basesnap.cpp.

{
  if( 0 == InterlockedDecrement( (long*)&m_cRef) )
  {
    delete this;
    return 0;
  }
  return m_cRef;
}

Generated on Wed Nov 13 2024 16:54:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/help/basesnap.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • help
Classes | Functions

basesnap.h File Reference

Go to the source code of this file.

Classes

class | CClassFactory

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 53 of file ComSpyAudit.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 61 of file ComSpyAudit.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

Generated on Wed Nov 13 2024 16:54:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/help/comp.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • help
Defines | Functions

comp.cpp File Reference

#include "Globals.h"
#include "Comp.h"
#include "CompData.h"
#include "DataObj.h"
#include "Resource.h"
#include "StaticNode.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CComponent")

Functions

STDMETHODIMP_ (ULONG) CComponent

Define Documentation

#define MODULESTRING _T("CComponent")

Definition at line 25 of file comp.cpp.

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 99 of file comp.cpp.

{
  if( InterlockedDecrement((LONG*)&m_cRef) == 0 )
  {
    delete this;
    return 0;
  }
  return m_cRef;
}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/help/comp.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • help
Classes

comp.h File Reference

#include "Globals.h"

Go to the source code of this file.

Classes

class CComponent
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/help/compdata.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • help
Defines | Functions

compdata.cpp File Reference

#include "Globals.h"
#include "Comp.h"
#include "CompData.h"
#include "DataObj.h"
#include "Resource.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CComponentData")

Functions

STDMETHODIMP_ (ULONG) CComponentData

Define Documentation

#define MODULESTRING _T("CComponentData")

Definition at line 23 of file compdata.cpp.

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 123 of file compdata.cpp.

{
  if( InterlockedDecrement((LONG*)&m_cRef) == 0 )
  {
    delete this;
    return 0;
  }

  return m_cRef;
}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/help/compdata.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • help
Classes

compdata.h File Reference

#include "Globals.h"
#include "BaseNode.h"

Go to the source code of this file.

Classes

class CComponentData
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/help/dataobj.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • help
Defines | Functions

dataobj.cpp File Reference

#include "Globals.h"
#include "DataObj.h"
#include "StaticNode.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CDataObject")

Functions

STDMETHODIMP_ (ULONG) CDataObject

Define Documentation

#define MODULESTRING _T("CDataObject")

Definition at line 21 of file dataobj.cpp.

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 77 of file dataobj.cpp.

{
  if( InterlockedDecrement((LONG*)&m_cRef) == 0 )
  {
    delete this;
    return 0;
  }
  return m_cRef;
}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/help/dataobj.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • help
Classes

dataobj.h File Reference

#include "Globals.h"
#include "StaticNode.h"
#include "StaticNode.h"

Go to the source code of this file.

Classes

class CDataObject
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/help/devicenode.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • help
Defines

devicenode.cpp File Reference

#include "DeviceNode.h"
#include "CompData.h"
#include "Comp.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CDeviceNode")

Define Documentation

#define MODULESTRING _T("CDeviceNode")

Definition at line 23 of file devicenode.cpp.

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/help/devicenode.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • help
Classes

devicenode.h File Reference

#include "Globals.h"
#include "FolderNode.h"
#include "LListImpl.h"
#include "FolderNode.h"

Go to the source code of this file.

Classes

class CDeviceNode
Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/help/foldernode.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • help
Defines

foldernode.cpp File Reference

#include "FolderNode.h"
#include "CompData.h"
#include "Comp.h"
#include "AddVFileDlg.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CFolderNode")

Define Documentation

#define MODULESTRING _T("CFolderNode")

Definition at line 24 of file foldernode.cpp.

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/help/foldernode.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • help
Classes

foldernode.h File Reference

#include "Globals.h"
#include "BaseNode.h"
#include "VirtualFile.h"
#include "LListImpl.h"
#include "VirtualFile.h"

Go to the source code of this file.

Classes

class CFolderNode
Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/help/globals.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • help
Functions | Variables

globals.cpp File Reference

#include "Globals.h"
#include "BaseNode.h"

Go to the source code of this file.

Functions

void _fastcall | Ansi2Unicode (CHAR *pszAnsi, WCHAR **ppszWide)
void _fastcall | CopyBuffer (WCHAR *szAnsi, WCHAR **ppszWide)
void _fastcall | CopyT2W (LPWSTR strDest, LPCTSTR strSource, size_t count)
CBaseNode * | ExtractBaseNodePtr (LPDATAOBJECT ipDataObject)
CDataObject * | ExtractDataObjPtr (LPDATAOBJECT ipDataObject)
HRESULT | ExtractFromDataObject (LPDATAOBJECT ipDataObject, CLIPFORMAT cfClipFormat, ULONG nByteCount, HGLOBAL *phGlobal)
LPOLESTR GetHelpFilePath ()
void | InitClipboardFormats ()
void _fastcall | Unicode2Ansi (CHAR **pszAnsi, WCHAR *szWide)

Variables

CLIPFORMAT | g_cfBaseNodePtr = 0
CLIPFORMAT | g_cfDataObjPtr = 0
CLIPFORMAT | g_cfDisplayName = 0
CLIPFORMAT | g_cfNodeType = 0
CLIPFORMAT | g_cfSnapinClsid = 0
CLIPFORMAT | g_cfszNodeType = 0
HINSTANCE | g_hInst = NULL
ULONG | g_uObjectCount = 0
ULONG | g_uServerLocks = 0

Function Documentation

void _fastcall Ansi2Unicode | ( | CHAR * | pszAnsi,
 |  | WCHAR ** | ppszWide
 | ) |  |

Definition at line 60 of file globals.cpp.

{
  SIZE_T ulSize = strlen( pszAnsi ) +1;
  *ppszWide = (WCHAR*)CoTaskMemAlloc( ulSize * sizeof(WCHAR) );
  MultiByteToWideChar( CP_ACP, 0, pszAnsi, ulSize, *ppszWide, ulSize );
}

void _fastcall CopyBuffer | ( | WCHAR * | szAnsi,
 |  | WCHAR ** | ppszWide
 | ) |  |

Definition at line 68 of file globals.cpp.

{
  SIZE_T ulSize = wcslen( szAnsi ) +1;
  *ppszWide = (WCHAR*)CoTaskMemAlloc( ulSize * sizeof(WCHAR) );
  wcscpy( *ppszWide, szAnsi );
}

void _fastcall CopyT2W | ( | LPWSTR | strDest,
 |  | LPCTSTR | strSource,
 |  | size_t | count
 | ) |  |

Definition at line 80 of file globals.cpp.

{
#ifndef _UNICODE

  MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, strSource, -1, strDest, count );

#else

  wcsncpy( strDest, strSource, count );

#endif

  if ( count > 0 )
    strDest[ count - 1 ] = 0;
}

CBaseNode* ExtractBaseNodePtr ( LPDATAOBJECT ipDataObject )

Definition at line 166 of file globals.cpp.

{
  LPBASENODE  pNode   = NULL;
  HGLOBAL     hGlobal = NULL;
  HRESULT     hResult = S_FALSE;

  hResult = ExtractFromDataObject( ipDataObject,
                                   g_cfBaseNodePtr,
                                   sizeof(LPBASENODE),
                                   &hGlobal
                                 );
  if( SUCCEEDED(hResult) )
  {
    pNode = *(LPBASENODE*)(hGlobal);
    HGLOBAL hRetVal = GlobalFree(hGlobal);
    _ASSERT( NULL == hRetVal );        // Must return NULL
  }

  return pNode;

}

CDataObject* ExtractDataObjPtr ( LPDATAOBJECT ipDataObject )

Definition at line 195 of file globals.cpp.

{
  _ASSERT( 0 != g_cfDataObjPtr );

  HGLOBAL      hGlobal = NULL;
  HRESULT      hResult = S_OK;
  CDataObject* pDO     = NULL;

  hResult = ExtractFromDataObject( ipDataObject,
                                   g_cfDataObjPtr,
                                   sizeof(CDataObject **),
                                   &hGlobal
                                 );

  if( SUCCEEDED(hResult) )
  {
    pDO = *(CDataObject **)(hGlobal);
    _ASSERT( NULL != pDO );

    HGLOBAL hRetVal = GlobalFree(hGlobal);
    _ASSERT( NULL == hRetVal );       // Must return NULL
  }

  return pDO;

}

HRESULT ExtractFromDataObject | ( | LPDATAOBJECT | ipDataObject,
 |  | CLIPFORMAT | cfClipFormat,
 |  | ULONG | nByteCount,
 |  | HGLOBAL * | phGlobal
 | ) |  |

Definition at line 114 of file globals.cpp.

{
  _ASSERT( NULL != ipDataObject );

            *phGlobal = NULL;
  HRESULT   hResult   = S_FALSE;
  STGMEDIUM StgMedium = { TYMED_HGLOBAL,  NULL  };
  FORMATETC FormatEtc = { cfClipFormat, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };

  do
  {
    // Allocate memory for the stream
    StgMedium.hGlobal = ::GlobalAlloc( GMEM_SHARE, nByteCount );

    if( NULL == StgMedium.hGlobal )
    {
      hResult = E_OUTOFMEMORY;
      break;
    }

    // Attempt to get data from the object
    hResult = ipDataObject->GetDataHere( &FormatEtc, &StgMedium );
    if( FAILED(hResult) )
    {
      break;
    }
    // StgMedium now has the data we need
    *phGlobal = StgMedium.hGlobal;
    StgMedium.hGlobal = NULL;

  } while (0);

  if( FAILED(hResult) && StgMedium.hGlobal )
  {
    HGLOBAL hRetVal = ::GlobalFree(StgMedium.hGlobal);
    _ASSERT( NULL == hRetVal );         // Must return NULL
  }
  return hResult;

}

LPOLESTR GetHelpFilePath ( )

Definition at line 230 of file globals.cpp.

{
  // First we need a temp buffer
  DWORD  dwTempSize = (MAX_PATH) * sizeof(TCHAR);
  LPTSTR pszTempPath = (LPTSTR)CoTaskMemAlloc( dwTempSize );

  // Get the path to the help file in TCHAR
  GetModuleFileName( g_hInst, pszTempPath, dwTempSize );
  PathRemoveFileSpec( pszTempPath );
  _tcscat( pszTempPath, _T("\\Ppage.chm") );

  // Convert to wide string if we're on Win9X, copy to buffer on NT
  LPOLESTR pszHelpPath = NULL;
  T2W( pszTempPath, &pszHelpPath );

  CoTaskMemFree( pszTempPath );

  return pszHelpPath;
}

void InitClipboardFormats ( )

Definition at line 98 of file globals.cpp.

{
  g_cfDisplayName  = (CLIPFORMAT)RegisterClipboardFormat( T_CCF_DISPLAY_NAME );
  g_cfNodeType     = (CLIPFORMAT)RegisterClipboardFormat( T_CCF_NODETYPE );
  g_cfszNodeType   = (CLIPFORMAT)RegisterClipboardFormat( T_CCF_SZNODETYPE );
  g_cfSnapinClsid  = (CLIPFORMAT)RegisterClipboardFormat( T_CCF_SNAPIN_CLASSID );

  g_cfBaseNodePtr  = (CLIPFORMAT)RegisterClipboardFormat( T_CCF_BASENODE_PTR );
  g_cfDataObjPtr   = (CLIPFORMAT)RegisterClipboardFormat( T_CCF_DATAOBJ_PTR );

}

void _fastcall Unicode2Ansi | ( | CHAR ** | pszAnsi,
 |  | WCHAR * | szWide
 | ) |  |

Definition at line 45 of file globals.cpp.

{
  SIZE_T nLen = wcslen( szWide ) +1;
  *pszAnsi = (char*)CoTaskMemAlloc( nLen );
  char* pCounter = *pszAnsi;

  while( *szWide )
  {
    *pCounter = LOBYTE(*szWide);
    pCounter++;
    szWide++;
  }
  *pCounter = NULL;
}

Variable Documentation

CLIPFORMAT g_cfBaseNodePtr = 0

Definition at line 28 of file globals.cpp.

CLIPFORMAT g_cfDataObjPtr = 0

Definition at line 29 of file globals.cpp.

CLIPFORMAT g_cfDisplayName = 0

Definition at line 20 of file globals.cpp.

CLIPFORMAT g_cfNodeType = 0

Definition at line 21 of file globals.cpp.

CLIPFORMAT g_cfSnapinClsid = 0

Definition at line 23 of file globals.cpp.

CLIPFORMAT g_cfszNodeType = 0

Definition at line 22 of file globals.cpp.

HINSTANCE g_hInst = NULL

Definition at line 34 of file globals.cpp.

ULONG g_uObjectCount = 0

Definition at line 35 of file globals.cpp.

ULONG g_uServerLocks = 0

Definition at line 36 of file globals.cpp.

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/help/globals.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • help
Defines | Functions | Variables

globals.h File Reference

#include <TChar.h>
#include <Mmc.h>
#include <CrtDbg.h>
#include <shlwapi.h>
#include "Guids.h"
#include "Guids.h"

Go to the source code of this file.

Defines

#define | ATTRIBUTE_BACKUP_DEVICE 2048
#define | ATTRIBUTE_DATA_ARCHIVE 2
#define | ATTRIBUTE_DATA_HIDDEN 4
#define | ATTRIBUTE_DATA_LOCKED 8
#define | ATTRIBUTE_DATA_READONLY 16
#define | BREAK_ON_ERROR(hResult) if( S_OK != hResult ) continue
#define | BYTE_SIZE(string) ((_tcslen(string)+1) * sizeof(TCHAR))
#define | IDM_NEW_DEVICE 100
#define | IDM_NEW_FOLDER 200
#define | IDM_NEW_VIRTFILE 400
#define | IDM_TOGGLE_STATUS 300
#define | IMG_CDROM_DEFAULT 6
#define | IMG_DATA_FILE 2
#define | IMG_DEVICE_DEFAULT 0
#define | IMG_DEVICE_OFFLINE 1
#define | IMG_DRIVE_DEFAULT 3
#define | IMG_DRIVE_OFFLINE 4
#define | IMG_FOLDER_DEFAULT 5
#define | IMG_REMOVABLE_MEDIA 7
#define | MsgBox(wszMsg, wszTitle) ::MessageBox(NULL, wszMsg, wszTitle, MB_OK)
#define | NODETYPE_DEVICE 200
#define | NODETYPE_FOLDER 300
#define | NODETYPE_STATIC 100
#define | NODETYPE_VFILE 400
#define | REQUEST_ICONSOLE 1001
#define | REQUEST_ICONSOLENAMESPACE2 1000
#define | REQUEST_ICONSOLEVERB 1002
#define | REQUEST_IDISPLAYHELP 1005
#define | REQUEST_IHEADERCTRL2 1004
#define | REQUEST_IRESULTDATA 1003
#define | STATUS_OFFLINE 0
#define | STATUS_ONLINE 1
#define | T2W(szAnsi, szWidePtr) Ansi2Unicode( szAnsi, szWidePtr )
#define | T_CCF_BASENODE_PTR _T("CCF_BASENODE_PTR")
#define | T_CCF_DATAOBJ_PTR _T("CCF_DATAOBJ_PTR")
#define | T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")
#define | T_CCF_NODETYPE _T("CCF_NODETYPE")
#define | T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")
#define | T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")
#define | W2T(szAnsiPtr, szWide) Unicode2Ansi( szAnsiPtr, szWide )
#define | WM_ADD_DEVICENODE (WM_USER + 101)
#define | WM_ADD_VIRTUALFILE (WM_USER + 103)
#define | WM_DEL_DEVICENODES (WM_USER + 100)
#define | WM_DEVICENODE_CLOSED (WM_USER + 102)
#define | WM_VIRTUALFILE_CLOSED (WM_USER + 104)

Functions

void _fastcall | Ansi2Unicode (CHAR *pszAnsi, WCHAR **ppszWide)
void _fastcall | CopyBuffer (WCHAR *pszAnsiPtr, WCHAR **ppszWide)
void _fastcall | CopyT2W (LPWSTR strDest, LPCTSTR strSource, size_t count)
CBaseNode * | ExtractBaseNodePtr (LPDATAOBJECT ipDataObject)
CDataObject * | ExtractDataObjPtr (LPDATAOBJECT ipDataObject)
HRESULT | ExtractFromDataObject (LPDATAOBJECT ipDataObject, CLIPFORMAT cf, ULONG cb, HGLOBAL *phGlobal)
LPOLESTR GetHelpFilePath ()
void | InitClipboardFormats ()
template<class TYPE >
void | SAFE_FREE_BITMAP (TYPE *&pObj)
template<class TYPE >
void | SAFE_FREE_ICON (TYPE *&pObj)
template<class TYPE >
void | SAFE_RELEASE (TYPE *&pObj)
void _fastcall | Unicode2Ansi (CHAR **pszAnsi, WCHAR *szWide)

Variables

CLIPFORMAT | g_cfBaseNodePtr
CLIPFORMAT | g_cfDataObjPtr
CLIPFORMAT | g_cfDisplayName
CLIPFORMAT | g_cfNodeType
CLIPFORMAT | g_cfSnapinClsid
CLIPFORMAT | g_cfszNodeType
HINSTANCE | g_hInst
ULONG g_uObjectCount
ULONG g_uServerLocks

Define Documentation

#define ATTRIBUTE_BACKUP_DEVICE 2048

Definition at line 99 of file globals.h.

#define ATTRIBUTE_DATA_ARCHIVE 2

Definition at line 95 of file globals.h.

#define ATTRIBUTE_DATA_HIDDEN 4

Definition at line 96 of file globals.h.

#define ATTRIBUTE_DATA_LOCKED 8

Definition at line 97 of file globals.h.

#define ATTRIBUTE_DATA_READONLY 16

Definition at line 98 of file globals.h.

#define BREAK_ON_ERROR ( hResult ) if( S_OK != hResult ) continue

Definition at line 144 of file globals.h.

#define BYTE_SIZE ( string ) ((_tcslen(string)+1) * sizeof(TCHAR))

Definition at line 142 of file globals.h.

#define IDM_NEW_DEVICE 100

Definition at line 111 of file globals.h.

#define IDM_NEW_FOLDER 200

Definition at line 112 of file globals.h.

#define IDM_NEW_VIRTFILE 400

Definition at line 114 of file globals.h.

#define IDM_TOGGLE_STATUS 300

Definition at line 113 of file globals.h.

#define IMG_CDROM_DEFAULT 6

Definition at line 108 of file globals.h.

#define IMG_DATA_FILE 2

Definition at line 104 of file globals.h.

#define IMG_DEVICE_DEFAULT 0

Definition at line 102 of file globals.h.

#define IMG_DEVICE_OFFLINE 1

Definition at line 103 of file globals.h.

#define IMG_DRIVE_DEFAULT 3

Definition at line 105 of file globals.h.

#define IMG_DRIVE_OFFLINE 4

Definition at line 106 of file globals.h.

#define IMG_FOLDER_DEFAULT 5

Definition at line 107 of file globals.h.

#define IMG_REMOVABLE_MEDIA 7

Definition at line 109 of file globals.h.

#define MsgBox | ( | wszMsg,
 |  | wszTitle |
 | ) |  | ::MessageBox(NULL, wszMsg, wszTitle, MB_OK)

Definition at line 147 of file globals.h.

#define NODETYPE_DEVICE 200

Definition at line 90 of file globals.h.

#define NODETYPE_FOLDER 300

Definition at line 91 of file globals.h.

#define NODETYPE_STATIC 100

Definition at line 89 of file globals.h.

#define NODETYPE_VFILE 400

Definition at line 92 of file globals.h.

#define REQUEST_ICONSOLE 1001

Definition at line 133 of file globals.h.

#define REQUEST_ICONSOLENAMESPACE2 1000

Definition at line 132 of file globals.h.

#define REQUEST_ICONSOLEVERB 1002

Definition at line 134 of file globals.h.

#define REQUEST_IDISPLAYHELP 1005

Definition at line 137 of file globals.h.

#define REQUEST_IHEADERCTRL2 1004

Definition at line 136 of file globals.h.

#define REQUEST_IRESULTDATA 1003

Definition at line 135 of file globals.h.

#define STATUS_OFFLINE 0

Definition at line 117 of file globals.h.

#define STATUS_ONLINE 1

Definition at line 116 of file globals.h.

#define T2W | ( | szAnsi,
 |  | szWidePtr |
 | ) |  | Ansi2Unicode( szAnsi, szWidePtr )

Definition at line 214 of file globals.h.

#define T_CCF_BASENODE_PTR _T("CCF_BASENODE_PTR")

Definition at line 83 of file globals.h.

#define T_CCF_DATAOBJ_PTR _T("CCF_DATAOBJ_PTR")

Definition at line 84 of file globals.h.

#define T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")

Definition at line 78 of file globals.h.

#define T_CCF_NODETYPE _T("CCF_NODETYPE")

Definition at line 79 of file globals.h.

#define T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")

Definition at line 81 of file globals.h.

#define T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")

Definition at line 80 of file globals.h.

#define W2T | ( | szAnsiPtr,
 |  | szWide |
 | ) |  | Unicode2Ansi( szAnsiPtr, szWide )

Definition at line 202 of file globals.h.

#define WM_ADD_DEVICENODE (WM_USER + 101)

Definition at line 123 of file globals.h.

#define WM_ADD_VIRTUALFILE (WM_USER + 103)

Definition at line 125 of file globals.h.

#define WM_DEL_DEVICENODES (WM_USER + 100)

Definition at line 122 of file globals.h.

#define WM_DEVICENODE_CLOSED (WM_USER + 102)

Definition at line 124 of file globals.h.

#define WM_VIRTUALFILE_CLOSED (WM_USER + 104)

Definition at line 126 of file globals.h.

Function Documentation

void _fastcall Ansi2Unicode | ( | CHAR * | pszAnsi,
 |  | WCHAR ** | ppszWide
 | ) |  |

Definition at line 60 of file globals.cpp.

{
  SIZE_T ulSize = strlen( pszAnsi ) +1;
  *ppszWide = (WCHAR*)CoTaskMemAlloc( ulSize * sizeof(WCHAR) );
  MultiByteToWideChar( CP_ACP, 0, pszAnsi, ulSize, *ppszWide, ulSize );
}

void _fastcall CopyBuffer | ( | WCHAR * | pszAnsiPtr,
 |  | WCHAR ** | ppszWide
 | ) |  |

Definition at line 68 of file globals.cpp.

{
  SIZE_T ulSize = wcslen( szAnsi ) +1;
  *ppszWide = (WCHAR*)CoTaskMemAlloc( ulSize * sizeof(WCHAR) );
  wcscpy( *ppszWide, szAnsi );
}

void _fastcall CopyT2W | ( | LPWSTR | strDest,
 |  | LPCTSTR | strSource,
 |  | size_t | count
 | ) |  |

Definition at line 64 of file globals.cpp.

{
#ifndef _UNICODE

  MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, strSource, -1, strDest, count );

#else

  wcsncpy( strDest, strSource, count );

#endif

  if ( count > 0 )
    strDest[ count - 1 ] = 0;
}

CBaseNode* ExtractBaseNodePtr ( LPDATAOBJECT ipDataObject )

Definition at line 150 of file globals.cpp.

{
  LPBASENODE  pNode   = NULL;
  HGLOBAL     hGlobal = NULL;
  HRESULT     hResult = S_FALSE;

  hResult = ExtractFromDataObject( ipDataObject,
                                   g_cfBaseNodePtr,
                                   sizeof(LPBASENODE),
                                   &hGlobal
                                 );
  if( SUCCEEDED(hResult) )
  {
    pNode = *(LPBASENODE*)(hGlobal);
    HGLOBAL hRetVal = GlobalFree(hGlobal);
    _ASSERT( NULL == hRetVal );        // Must return NULL
  }

  return pNode;

}

CDataObject* ExtractDataObjPtr ( LPDATAOBJECT ipDataObject )

Definition at line 179 of file globals.cpp.

{
  _ASSERT( 0 != g_cfDataObjPtr );

  HGLOBAL      hGlobal = NULL;
  HRESULT      hResult = S_OK;
  CDataObject* pDO     = NULL;

  hResult = ExtractFromDataObject( ipDataObject,
                                   g_cfDataObjPtr,
                                   sizeof(CDataObject **),
                                   &hGlobal
                                 );

  if( SUCCEEDED(hResult) )
  {
    pDO = *(CDataObject **)(hGlobal);
    _ASSERT( NULL != pDO );

    HGLOBAL hRetVal = GlobalFree(hGlobal);
    _ASSERT( NULL == hRetVal );       // Must return NULL
  }

  return pDO;

}

HRESULT ExtractFromDataObject | ( | LPDATAOBJECT | ipDataObject,
 |  | CLIPFORMAT | cf,
 |  | ULONG | cb,
 |  | HGLOBAL * | phGlobal
 | ) |  |

Definition at line 114 of file globals.cpp.

{
  _ASSERT( NULL != ipDataObject );

            *phGlobal = NULL;
  HRESULT   hResult   = S_FALSE;
  STGMEDIUM StgMedium = { TYMED_HGLOBAL,  NULL  };
  FORMATETC FormatEtc = { cfClipFormat, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };

  do
  {
    // Allocate memory for the stream
    StgMedium.hGlobal = ::GlobalAlloc( GMEM_SHARE, nByteCount );

    if( NULL == StgMedium.hGlobal )
    {
      hResult = E_OUTOFMEMORY;
      break;
    }

    // Attempt to get data from the object
    hResult = ipDataObject->GetDataHere( &FormatEtc, &StgMedium );
    if( FAILED(hResult) )
    {
      break;
    }
    // StgMedium now has the data we need
    *phGlobal = StgMedium.hGlobal;
    StgMedium.hGlobal = NULL;

  } while (0);

  if( FAILED(hResult) && StgMedium.hGlobal )
  {
    HGLOBAL hRetVal = ::GlobalFree(StgMedium.hGlobal);
    _ASSERT( NULL == hRetVal );         // Must return NULL
  }
  return hResult;

}

LPOLESTR GetHelpFilePath ( )

Definition at line 230 of file globals.cpp.

{
  // First we need a temp buffer
  DWORD  dwTempSize = (MAX_PATH) * sizeof(TCHAR);
  LPTSTR pszTempPath = (LPTSTR)CoTaskMemAlloc( dwTempSize );

  // Get the path to the help file in TCHAR
  GetModuleFileName( g_hInst, pszTempPath, dwTempSize );
  PathRemoveFileSpec( pszTempPath );
  _tcscat( pszTempPath, _T("\\Ppage.chm") );

  // Convert to wide string if we're on Win9X, copy to buffer on NT
  LPOLESTR pszHelpPath = NULL;
  T2W( pszTempPath, &pszHelpPath );

  CoTaskMemFree( pszTempPath );

  return pszHelpPath;
}

void InitClipboardFormats ( )

Definition at line 56 of file globals.cpp.

{
  g_cfDisplayName  = RegisterClipboardFormat( T_CCF_DISPLAY_NAME );
  g_cfNodeType     = RegisterClipboardFormat( T_CCF_NODETYPE );
  g_cfszNodeType   = RegisterClipboardFormat( T_CCF_SZNODETYPE );
  g_cfSnapinClsid  = RegisterClipboardFormat( T_CCF_SNAPIN_CLASSID );

}

template<class TYPE >
void SAFE_FREE_BITMAP ( TYPE *& pObj ) [inline]

Definition at line 167 of file globals.h.

{
  if( NULL != pObj )
  {
    BOOL bStatus = DeleteObject( pObj );
    pObj = NULL;
  }
  else
  {
    OutputDebugString(_T("Attempted to delete NULL Bitmap handle.\n"));
  }
}

template<class TYPE >
void SAFE_FREE_ICON ( TYPE *& pObj ) [inline]

Definition at line 182 of file globals.h.

{
  if( NULL != pObj )
  {
    BOOL bStatus = DestroyIcon( pObj );
    pObj = NULL;
  }
  else
  {
    OutputDebugString(_T("Attempted to delete NULL Icon handle.\n"));
  }
}

template<class TYPE >
void SAFE_RELEASE ( TYPE *& pObj ) [inline]

Definition at line 152 of file globals.h.

{
  if( NULL != pObj )
  {
    pObj->Release();
    pObj = NULL;
  }
  else
  {
    OutputDebugString(_T("Attempted to release NULL Com pointer.\n"));
  }
}

void _fastcall Unicode2Ansi | ( | CHAR ** | pszAnsi,
 |  | WCHAR * | szWide
 | ) |  |

Definition at line 38 of file globals.cpp.

{
  LONG nLen = wcslen( szWide ) +1;
  *pszAnsi = (char*)CoTaskMemAlloc( nLen );
  char* pCounter = *pszAnsi;

  while( *szWide )
  {
    *pCounter = LOBYTE(*szWide);
    pCounter++;
    szWide++;
  }
  *pCounter = NULL;
}

Variable Documentation

CLIPFORMAT g_cfBaseNodePtr

Definition at line 28 of file globals.cpp.

CLIPFORMAT g_cfDataObjPtr

Definition at line 29 of file globals.cpp.

CLIPFORMAT g_cfDisplayName

Definition at line 19 of file globals.cpp.

CLIPFORMAT g_cfNodeType

Definition at line 20 of file globals.cpp.

CLIPFORMAT g_cfSnapinClsid

Definition at line 22 of file globals.cpp.

CLIPFORMAT g_cfszNodeType

Definition at line 21 of file globals.cpp.

HINSTANCE g_hInst

Definition at line 62 of file DoServer.Cpp.

ULONG g_uObjectCount

Definition at line 28 of file globals.cpp.

ULONG g_uServerLocks

Definition at line 29 of file globals.cpp.

Generated on Wed Nov 13 2024 16:54:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/help/guids.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • help
Functions

guids.h File Reference

Go to the source code of this file.

Functions

DEFINE_GUID (CLSID_CComponentData, 0x0cadd2fc, 0x5463, 0x47bc, 0x91, 0x87, 0xb4, 0x0a, 0xe2, 0xdc, 0x14, 0xf7)
DEFINE_GUID (CLSID_CVirtualFile, 0xf0091c49, 0xc869, 0x4941, 0xa8, 0x1c, 0xc7, 0x19, 0xad, 0x81, 0x74, 0xcc)
DEFINE_GUID (CLSID_CFolderNode, 0x520F23fA, 0x775D, 0x4015, 0xb4, 0x37, 0x98, 0xA2, 0x4B, 0x9D, 0x8, 0x5E)
DEFINE_GUID (CLSID_DeviceNode, 0x520F23f9, 0x775D, 0x4015, 0xB4, 0x37, 0x98, 0xA2, 0x4B, 0x9D, 0x8, 0x5E)
DEFINE_GUID (CLSID_CSnapinAbout, 0xe72383ab, 0xae80, 0x43c5, 0x8f, 0x83, 0xf8, 0x58, 0x64, 0xa4, 0xf6, 0xea)

Function Documentation

DEFINE_GUID | ( | CLSID_CComponentData | ,
 |  | 0x0cadd2fc | ,
 |  | 0x5463 | ,
 |  | 0x47bc | ,
 |  | 0x91 | ,
 |  | 0x87 | ,
 |  | 0xb4 | ,
 |  | 0x0a | ,
 |  | 0xe2 | ,
 |  | 0xdc | ,
 |  | 0x14 | ,
 |  | 0xf7 |
 | ) |  |
DEFINE_GUID | ( | CLSID_CVirtualFile | ,
 |  | 0xf0091c49 | ,
 |  | 0xc869 | ,
 |  | 0x4941 | ,
 |  | 0xa8 | ,
 |  | 0x1c | ,
 |  | 0xc7 | ,
 |  | 0x19 | ,
 |  | 0xad | ,
 |  | 0x81 | ,
 |  | 0x74 | ,
 |  | 0xcc |
 | ) |  |
DEFINE_GUID | ( | CLSID_CFolderNode | ,
 |  | 0x520F23fA | ,
 |  | 0x775D | ,
 |  | 0x4015 | ,
 |  | 0xb4 | ,
 |  | 0x37 | ,
 |  | 0x98 | ,
 |  | 0xA2 | ,
 |  | 0x4B | ,
 |  | 0x9D | ,
 |  | 0x8 | ,
 |  | 0x5E |
 | ) |  |
DEFINE_GUID | ( | CLSID_DeviceNode | ,
 |  | 0x520F23f9 | ,
 |  | 0x775D | ,
 |  | 0x4015 | ,
 |  | 0xB4 | ,
 |  | 0x37 | ,
 |  | 0x98 | ,
 |  | 0xA2 | ,
 |  | 0x4B | ,
 |  | 0x9D | ,
 |  | 0x8 | ,
 |  | 0x5E |
 | ) |  |
DEFINE_GUID | ( | CLSID_CSnapinAbout | ,
 |  | 0xe72383ab | ,
 |  | 0xae80 | ,
 |  | 0x43c5 | ,
 |  | 0x8f | ,
 |  | 0x83 | ,
 |  | 0xf8 | ,
 |  | 0x58 | ,
 |  | 0x64 | ,
 |  | 0xa4 | ,
 |  | 0xf6 | ,
 |  | 0xea |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/help/llistimpl.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • help
Functions

llistimpl.cpp File Reference

#include "LListImpl.h"

Go to the source code of this file.

Functions

BOOL IsValidAddress (const void *lp, UINT nBytes, BOOL bReadWrite)

Function Documentation

BOOL IsValidAddress | ( | const void * | lp,
 |  | UINT | nBytes,
 |  | BOOL | bReadWrite
 | ) |  |

Definition at line 53 of file llistimpl.cpp.

{
  // Simple version using Win-32 APIs for pointer validation.
  return (lp != NULL && !IsBadReadPtr(lp, nBytes) &&
         (!bReadWrite || !IsBadWritePtr((LPVOID)lp, nBytes)));

} //end IsValidAddress()

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/help/llistimpl.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • help
Classes | Typedefs | Functions

llistimpl.h File Reference

#include <CrtDbg.h>
#include <Windows.h>
#include <new.h>

Go to the source code of this file.

Classes

struct | __POSITION
class | CLListImpl< TYPE, ARG_TYPE >
struct | CLListImpl< TYPE, ARG_TYPE >::CNode
struct | CPlex

Typedefs

typedef __POSITION * | POSITION

Functions

BOOL | IsValidAddress (const void *lp, UINT nBytes, BOOL bReadWrite=TRUE)

Typedef Documentation

typedef __POSITION* POSITION

Definition at line 31 of file llistimpl.h.

Function Documentation

BOOL IsValidAddress | ( | const void * | lp,
 |  | UINT | nBytes,
 |  | BOOL | bReadWrite = TRUE
 | ) |  |

Definition at line 53 of file llistimpl.cpp.

{
  // Simple version using Win-32 APIs for pointer validation.
  return (lp != NULL && !IsBadReadPtr(lp, nBytes) &&
         (!bReadWrite || !IsBadWritePtr((LPVOID)lp, nBytes)));

} //end IsValidAddress()

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/help/registry.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • help
Defines | Functions

registry.cpp File Reference

#include <ObjBase.h>
#include "Registry.h"
#include "Globals.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define | MODULESTRING _T("Registry")

Functions

HRESULT | RecursiveDeleteKey (HKEY hKeyParent, const TCHAR *szKeyChild)
HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const TCHAR *szNameString, const CLSID &clsidAbout, const BOOL bSupportExtensions)
HRESULT | SetKeyAndValue (const TCHAR *pszPath, const TCHAR *szSubkey, const TCHAR *szValue)
HRESULT | SetSnapInKeyAndValue (const TCHAR *szKey, const TCHAR *szSubkey, const TCHAR *szName, const TCHAR *szValue)
HRESULT | SetValue (const TCHAR *szKey, const TCHAR *szValueName, const TCHAR *szValue)
LONG | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Define Documentation

#define MODULESTRING _T("Registry")

Definition at line 22 of file registry.cpp.

Function Documentation

HRESULT RecursiveDeleteKey | ( | HKEY | hKeyParent,
 |  | const TCHAR * | szKeyChild
 | ) |  |

Definition at line 262 of file registry.cpp.

{
  // Open the child.
  HKEY hKeyChild = NULL;
  LONG lResult   = ERROR_SUCCESS;

  do                     // We go to all this trouble to prevent any
  {                      // possibility of exiting while leaving a key open

    lResult = RegOpenKeyEx( hKeyParent,
                            lpszKeyChild,
                            0,
                            KEY_ALL_ACCESS,
                            &hKeyChild
                          );
    if( ERROR_SUCCESS != lResult )
      continue;

    // Enumerate all of the decendents of this child.
    FILETIME time;
    _TCHAR szBuffer[256];
    DWORD dwSize = 256;
    while( S_OK == RegEnumKeyEx(hKeyChild,0,szBuffer,&dwSize,NULL,NULL,NULL,&time) )
    {
      // Delete the decendents of this child.
      lResult = RecursiveDeleteKey( hKeyChild, szBuffer );
      if( ERROR_SUCCESS != lResult )
      {
        continue;
      }
      dwSize = 256;
    }
  }while( 0 );

  RegCloseKey( hKeyChild );            // Always try to close the child
                                       // then delete this child.
  return RegDeleteKey( hKeyParent, lpszKeyChild );
}

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const TCHAR * | szFriendlyName
 | ) |  |

Definition at line 51 of file registry.cpp.

{
  // Get server location.
  TCHAR    szModule[512] ;
  TCHAR*   pszCLSID = NULL;
  LPOLESTR wszCLSID = NULL ;
  HRESULT  hResult  = S_FALSE;

  DWORD dwResult = ::GetModuleFileName( hModule,
                                        szModule,
                                        sizeof(szModule)/sizeof(TCHAR)
                                      );
  if( 0 == dwResult ) return HRESULT_FROM_WIN32( dwResult );

  do                         // Fail unless we complete everything
  {
    // Get CLSID string in wide char
    hResult = StringFromCLSID( clsid, &wszCLSID ) ;
    if( S_OK != hResult )
    {
      CoTaskMemFree( wszCLSID );
      BREAK_ON_ERROR( hResult );
    }

    W2T( &pszCLSID, wszCLSID );          // W2T is defined in Globals.h
    CoTaskMemFree( wszCLSID );           // Through with wide version

    TCHAR szKey[64];                     // Build the CLSID key string CLSID\\{...}
    _tcscpy( szKey, _T("CLSID\\") );
    _tcscat( szKey, pszCLSID );

    // Add the CLSID to the registry.
    hResult = SetKeyAndValue( szKey, NULL, szFriendlyName );
    BREAK_ON_ERROR( hResult );

    // Add the server filename subkey under the CLSID key.
    hResult = SetKeyAndValue( szKey, _T("InprocServer32"), szModule );
    BREAK_ON_ERROR( hResult );

    // Set the threading model
    _tcscat( szKey, _T("\\InprocServer32") );
    hResult = SetValue( szKey, _T("ThreadingModel"), _T("Apartment") );
    BREAK_ON_ERROR( hResult );

  }while( 0 );

  CoTaskMemFree( pszCLSID );           // Through with TCHAR version

  return hResult;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | bSupportExtensions
 | ) |  |

Definition at line 149 of file registry.cpp.

{
  HRESULT hResult = S_FALSE;
  TCHAR*  pszSnapCLSID = NULL;         // Needed for TCHAR version of the ClassID

  // If any part of this process fails, jump out of the loop and return
  // the error code
  do
  {
    // Allocate the CLSID string
    LPOLESTR wszSnapCLSID  = NULL ;
    hResult = StringFromCLSID( clsid, &wszSnapCLSID ) ;
    if( S_OK != hResult )
    {
       CoTaskMemFree( wszSnapCLSID );
       continue;
    }

    W2T( &pszSnapCLSID, wszSnapCLSID );  // W2T is defined in Globals.h
    CoTaskMemFree( wszSnapCLSID );       // Through with wide version

    // Add the Snap-in's CLSID to the registry
    hResult = SetSnapInKeyAndValue( pszSnapCLSID, NULL, _T("NameString"), szNameString );
    BREAK_ON_ERROR( hResult );

    hResult = SetSnapInKeyAndValue( pszSnapCLSID, _T("StandAlone"), NULL, NULL );
    BREAK_ON_ERROR( hResult );

    // Add registry information for ISnapinAbout if we support it
    LPOLESTR wszAboutCLSID = NULL;
    TCHAR*   pszAboutCLSID = NULL;
    if( IID_NULL != clsidAbout )
    {
      hResult = StringFromCLSID( clsidAbout, &wszAboutCLSID );
      if( S_OK != hResult )
      {
        CoTaskMemFree( wszAboutCLSID ); // Free this memory before exiting
        continue;
      }

      W2T( &pszAboutCLSID, wszAboutCLSID );
      hResult = SetSnapInKeyAndValue( pszSnapCLSID, NULL, _T("About"), pszAboutCLSID );
      CoTaskMemFree( wszAboutCLSID );
      CoTaskMemFree( pszAboutCLSID );
      BREAK_ON_ERROR( hResult );
    }

    if( TRUE == bSupportExtensions )     // Build the NodeTypesKey
    {
      hResult = SetSnapInKeyAndValue( pszSnapCLSID, _T("NodeTypes"), NULL, NULL );
      BREAK_ON_ERROR( hResult );
      TCHAR szKey[64];
      _tcscpy( szKey, pszSnapCLSID );
      _tcscat(szKey, _T("\\NodeTypes"));
      hResult = SetSnapInKeyAndValue( szKey, pszSnapCLSID, NULL, NULL );
      BREAK_ON_ERROR( hResult );
    }
  }while( 0 );

  CoTaskMemFree( pszSnapCLSID);
  return hResult;
}

HRESULT SetKeyAndValue | ( | const TCHAR * | pszPath,
 |  | const TCHAR * | szSubkey,
 |  | const TCHAR * | szValue
 | ) |  |

Definition at line 310 of file registry.cpp.

{
  HKEY hKey = NULL;
  HRESULT hResult = S_FALSE;
  TCHAR szKeyBuf[1024];

  // Copy keyname into buffer.
  _tcscpy( szKeyBuf, szKey );

  // Add subkey name to buffer.
  if( NULL != szSubkey )
  {
    _tcscat( szKeyBuf, _T("\\") );
    _tcscat( szKeyBuf, szSubkey );
  }

  do                     // We go to all this trouble to prevent any
  {                      // possibility of exiting while leaving a key open

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx( HKEY_CLASSES_ROOT,
                                   szKeyBuf,
                                   0,
                                   NULL,
                                   REG_OPTION_NON_VOLATILE,
                                   KEY_ALL_ACCESS,
                                   NULL,
                                   &hKey,
                                   NULL
                                 );
    if( ERROR_SUCCESS != lResult )
    {
      hResult = HRESULT_FROM_WIN32( lResult );
      continue;
    }

    if( NULL != szValue )    // Now set the value
    {
      hResult = RegSetValueEx( hKey,
                               NULL,
                               0,
                               REG_SZ,
                               (BYTE*)szValue,
                               BYTE_SIZE( szValue )    // BYTE_SIZE is in Globals.h
                             );
      BREAK_ON_ERROR( hResult );
    }
  }while( 0 );

  RegCloseKey( hKey );       // Always try to close the key
  return hResult;
}

HRESULT SetSnapInKeyAndValue | ( | const TCHAR * | szKey,
 |  | const TCHAR * | szSubkey,
 |  | const TCHAR * | szName,
 |  | const TCHAR * | szValue
 | ) |  |

Definition at line 429 of file registry.cpp.

{
  HKEY    hKey = NULL;
  HRESULT hResult = S_FALSE;
  TCHAR   szKeyBuf[1024];

  // Load the buffer with the Snap-In Location
  _tcscpy( szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns") );

  _tcscat( szKeyBuf, _T("\\") );       // Copy keyname into buffer.
  _tcscat( szKeyBuf, szKey );

  if( NULL != szSubkey )               // Add subkey name to buffer.
  {
    _tcscat( szKeyBuf, _T("\\") );
    _tcscat( szKeyBuf, szSubkey );
  }

  do                     // We go to all this trouble to prevent any
  {                      // possibility of exiting while leaving a key open

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx( HKEY_LOCAL_MACHINE,
                                   szKeyBuf,
                                   0,
                                   NULL,
                                   REG_OPTION_NON_VOLATILE,
                                   KEY_ALL_ACCESS,
                                   NULL,
                                   &hKey,
                                   NULL
                                 );
    if( ERROR_SUCCESS != lResult )     // Will return S_FALSE
      continue;

    // Set the Value.
    if( szValue != NULL )
    {
      hResult = RegSetValueEx( hKey,
                               szName,
                               0,
                               REG_SZ,
                               (BYTE*)szValue,
                               BYTE_SIZE(szValue)
                             );
      BREAK_ON_ERROR( hResult );
    }
    else
    {                        // Got this far so everything is OK.
      hResult = S_OK;
    }
  }while( 0 );

  RegCloseKey( hKey );       //Always attempt to close the key
  return hResult;
}

HRESULT SetValue | ( | const TCHAR * | szKey,
 |  | const TCHAR * | szValueName,
 |  | const TCHAR * | szValue
 | ) |  |

Definition at line 372 of file registry.cpp.

{
  HKEY    hKey = NULL;
  HRESULT hResult = S_FALSE;
  TCHAR szKeyBuf[1024];

  // Copy keyname into buffer.
  _tcscpy( szKeyBuf, szKey );

  do                     // We go to all this trouble to prevent any
  {                      // possibility of exiting while leaving a key open

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx( HKEY_CLASSES_ROOT ,
                                   szKeyBuf,
                                   0,
                                   NULL,
                                   REG_OPTION_NON_VOLATILE,
                                   KEY_ALL_ACCESS,
                                   NULL,
                                   &hKey,
                                   NULL
                                 );
    if( ERROR_SUCCESS != lResult )
    {
      hResult = HRESULT_FROM_WIN32( lResult );
      continue;
    }

    if( NULL != szValue )    // Now set the value
    {
      hResult = RegSetValueEx( hKey,
                               szValueName,
                               0,
                               REG_SZ,
                               (BYTE*)szValue,
                               BYTE_SIZE( szValue )
                             );
      BREAK_ON_ERROR( hResult );
    }
  }while( 0 );

  RegCloseKey( hKey );       //Always attempt to close the key
  return hResult;
}

LONG UnregisterServer ( const CLSID & clsid )

Definition at line 111 of file registry.cpp.

{
  HRESULT hResult = S_OK;

  // Allocate the CLSID string
  LPOLESTR wszCLSID = NULL ;
  hResult = StringFromCLSID( clsid, &wszCLSID );
  if( S_OK != hResult )
  {
    CoTaskMemFree( wszCLSID );
    return hResult;
  }

  // Build the key CLSID\\{...}
  TCHAR szKey[64];
  _tcscpy( szKey, _T("CLSID\\") );

  TCHAR* pszCLSID = NULL;
  W2T( &pszCLSID, wszCLSID );          // W2T is defined in Globals.h
  CoTaskMemFree( wszCLSID );           // Through with wide version

  _tcscat( szKey, pszCLSID );
  CoTaskMemFree( pszCLSID );           // Through with TCHAR version

  // Delete the CLSID Key - CLSID\{...}
  LONG lResult = RecursiveDeleteKey( HKEY_CLASSES_ROOT, szKey );
  if( ERROR_SUCCESS != lResult )
    hResult = HRESULT_FROM_WIN32( lResult );

  return hResult;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 222 of file registry.cpp.

{
  HRESULT hResult = S_OK;

  TCHAR    szKeyBuf[1024];
  LPOLESTR wszCLSID = NULL;
  TCHAR*   pszCLSID = NULL;        // Needed for TCHAR version of the ClassID

  // Get CLSID as a wide string
  hResult = StringFromCLSID( clsid, &wszCLSID );
  if( S_OK != hResult )
  {
    CoTaskMemFree( wszCLSID );
    return hResult;
  }

  W2T( &pszCLSID, wszCLSID );          // W2T is defined in Globals.h
  CoTaskMemFree( wszCLSID );           // Through with wide version

  // Load the buffer with the Snap-In Location
  _tcscpy( szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns") );

  _tcscat( szKeyBuf, _T("\\") );       // Copy keyname into buffer.
  _tcscat( szKeyBuf, pszCLSID );

  // Delete the CLSID Key - CLSID\{...}
  LONG lResult = RecursiveDeleteKey( HKEY_LOCAL_MACHINE, szKeyBuf );
  if( ERROR_SUCCESS != lResult )
    hResult = HRESULT_FROM_WIN32( lResult );

  CoTaskMemFree( pszCLSID );
  return hResult;
}

Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/help/registry.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • help
Functions

registry.h File Reference

#include <tchar.h>

Go to the source code of this file.

Functions

HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const TCHAR *szNameString, const CLSID &clsidAbout, const BOOL fSupportExtensions=FALSE)
HRESULT | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Function Documentation

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const TCHAR * | szFriendlyName
 | ) |  |

Definition at line 51 of file registry.cpp.

{
  // Get server location.
  TCHAR    szModule[512] ;
  TCHAR*   pszCLSID = NULL;
  WCHAR*   wszCLSID = NULL ;
  HRESULT  hResult  = S_FALSE;

  DWORD dwResult = ::GetModuleFileName( hModule,
                                        szModule,
                                        sizeof(szModule)/sizeof(TCHAR)
                                      );
  if( 0 == dwResult ) return HRESULT_FROM_WIN32( dwResult );

  do                         // Fail unless we complete everything
  {
    // Get CLSID string in wide char
    hResult = StringFromCLSID( clsid, &wszCLSID ) ;
    if( S_OK != hResult )
    {
      CoTaskMemFree( wszCLSID );
      BREAK_ON_ERROR( hResult );
    }

    W2T( &pszCLSID, wszCLSID );          // W2T is defined in Globals.h
    CoTaskMemFree( wszCLSID );           // Through with wide version

    TCHAR szKey[64];                     // Build the CLSID key string CLSID\\{...}
    _tcscpy( szKey, _T("CLSID\\") );
    _tcscat( szKey, pszCLSID );

    // Add the CLSID to the registry.
    hResult = SetKeyAndValue( szKey, NULL, szFriendlyName );
    BREAK_ON_ERROR( hResult );

    // Add the server filename subkey under the CLSID key.
    hResult = SetKeyAndValue( szKey, _T("InprocServer32"), szModule );
    BREAK_ON_ERROR( hResult );

    // Set the threading model
    _tcscat( szKey, _T("\\InprocServer32") );
    hResult = SetValue( szKey, _T("ThreadingModel"), _T("Apartment") );
    BREAK_ON_ERROR( hResult );

  }while( 0 );

  CoTaskMemFree( pszCLSID );           // Through with TCHAR version

  return hResult;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | fSupportExtensions = FALSE
 | ) |  |

Definition at line 149 of file registry.cpp.

{
  HRESULT hResult = S_FALSE;
  TCHAR*  pszSnapCLSID = NULL;         // Needed for TCHAR version of the ClassID

  // If any part of this process fails, jump out of the loop and return
  // the error code
  do
  {
    // Allocate the CLSID string
    LPOLESTR wszSnapCLSID  = NULL ;
    hResult = StringFromCLSID( clsid, &wszSnapCLSID ) ;
    if( S_OK != hResult )
    {
       CoTaskMemFree( wszSnapCLSID );
       continue;
    }

    W2T( &pszSnapCLSID, wszSnapCLSID );  // W2T is defined in Globals.h
    CoTaskMemFree( wszSnapCLSID );       // Through with wide version

    // Add the Snap-in's CLSID to the registry
    hResult = SetSnapInKeyAndValue( pszSnapCLSID, NULL, _T("NameString"), szNameString );
    BREAK_ON_ERROR( hResult );

    hResult = SetSnapInKeyAndValue( pszSnapCLSID, _T("StandAlone"), NULL, NULL );
    BREAK_ON_ERROR( hResult );

    // Add registry information for ISnapinAbout if we support it
    LPOLESTR wszAboutCLSID = NULL;
    TCHAR*   pszAboutCLSID = NULL;
    if( IID_NULL != clsidAbout )
    {
      hResult = StringFromCLSID( clsidAbout, &wszAboutCLSID );
      if( S_OK != hResult )
      {
        CoTaskMemFree( wszAboutCLSID ); // Free this memory before exiting
        continue;
      }

      W2T( &pszAboutCLSID, wszAboutCLSID );
      hResult = SetSnapInKeyAndValue( pszSnapCLSID, NULL, _T("About"), pszAboutCLSID );
      CoTaskMemFree( wszAboutCLSID );
      CoTaskMemFree( pszAboutCLSID );
      BREAK_ON_ERROR( hResult );
    }

    if( TRUE == bSupportExtensions )     // Build the NodeTypesKey
    {
      hResult = SetSnapInKeyAndValue( pszSnapCLSID, _T("NodeTypes"), NULL, NULL );
      BREAK_ON_ERROR( hResult );
      TCHAR szKey[64];
      _tcscpy( szKey, pszSnapCLSID );
      _tcscat(szKey, _T("\\NodeTypes"));
      hResult = SetSnapInKeyAndValue( szKey, pszSnapCLSID, NULL, NULL );
      BREAK_ON_ERROR( hResult );
    }
  }while( 0 );

  CoTaskMemFree( pszSnapCLSID);
  return hResult;
}

HRESULT UnregisterServer ( const CLSID & clsid )

Definition at line 112 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

  MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
  _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 184 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Generated on Wed Nov 13 2024 16:53:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/help/resource.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • help
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDB_APPIMG_16 104
#define | IDB_APPIMG_32 101
#define | IDB_NODEIMAGES_16 106
#define | IDB_NODEIMAGES_32 107
#define | IDC_ARCHIVE_ATTR 1000
#define | IDC_BACKUP_FLAG 1005
#define | IDC_DEVNAME_EDIT 1004
#define | IDC_HIDDEN_ATTR 1001
#define | IDC_LOCKED_ATTR 1002
#define | IDC_READONLY_ATTR 1003
#define | IDD_ADDDEVICE_DLG 109
#define | IDD_ADDVFILE_DLG 110
#define | IDD_BASE_DIALOG 108
#define | IDD_VFILE_PPAGE0 111
#define | IDI_APP_ICON 105

Define Documentation

#define IDB_APPIMG_16 104

Definition at line 6 of file resource.h.

#define IDB_APPIMG_32 101

Definition at line 5 of file resource.h.

#define IDB_NODEIMAGES_16 106

Definition at line 8 of file resource.h.

#define IDB_NODEIMAGES_32 107

Definition at line 9 of file resource.h.

#define IDC_ARCHIVE_ATTR 1000

Definition at line 14 of file resource.h.

#define IDC_BACKUP_FLAG 1005

Definition at line 19 of file resource.h.

#define IDC_DEVNAME_EDIT 1004

Definition at line 18 of file resource.h.

#define IDC_HIDDEN_ATTR 1001

Definition at line 15 of file resource.h.

#define IDC_LOCKED_ATTR 1002

Definition at line 16 of file resource.h.

#define IDC_READONLY_ATTR 1003

Definition at line 17 of file resource.h.

#define IDD_ADDDEVICE_DLG 109

Definition at line 11 of file resource.h.

#define IDD_ADDVFILE_DLG 110

Definition at line 12 of file resource.h.

#define IDD_BASE_DIALOG 108

Definition at line 10 of file resource.h.

#define IDD_VFILE_PPAGE0 111

Definition at line 13 of file resource.h.

#define IDI_APP_ICON 105

Definition at line 7 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/help/staticnode.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • help
Defines

staticnode.cpp File Reference

#include "StaticNode.h"
#include "DeviceNode.h"
#include "CompData.h"
#include "Comp.h"
#include "AddDeviceDlg.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CStaticNode")

Define Documentation

#define MODULESTRING _T("CStaticNode")

Definition at line 25 of file staticnode.cpp.

Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/help/staticnode.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • help
Classes

staticnode.h File Reference

#include "Globals.h"
#include "BaseNode.h"
#include "LListImpl.h"
#include "LListImpl.h"

Go to the source code of this file.

Classes

class CStaticNode
Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/help/tracemacro.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • help
Functions

tracemacro.cpp File Reference

#include "Globals.h"
#include "TraceMacro.h"
#include <StdIo.h>

Go to the source code of this file.

Functions

VOID | MapEvent (LONG Event, LPTSTR szEventStr)
VOID | Trace_Event (LPCTSTR pszClass, LPCTSTR pszFunction, LONG nEvent)
VOID | Trace_HR (LPCTSTR pszClass, LPCTSTR pszFunction, HRESULT hr)
VOID | Trace_Pointer (LPCTSTR pszClass, LPCTSTR pszFunction, LPCTSTR pszAction, ULONG ulValue)
VOID | Trace_Start (LPCTSTR pszClass, LPCTSTR pszFunction)
VOID | Trace_Value (LPCTSTR pszClass, LPCTSTR pszFunction, LPCTSTR pszValueName, LONG nValue)

Function Documentation

VOID MapEvent | ( | LONG | Event,
 |  | LPTSTR | szEventStr
 | ) |  |

Definition at line 179 of file tracemacro.cpp.

{
#ifdef _DEBUG

  switch( Event )
  {
    case 0x8001:
      _tcscpy( szEventStr, _T("MMCN_ACTIVATE          ") );
      break;

    case 0x8002:
      _tcscpy( szEventStr, _T("MMCN_ADD_IMAGES        ") );
      break;

    case 0x8003:
      _tcscpy( szEventStr, _T("MMCN_BTN_CLICK         ") );
      break;

    case 0x8004:
      _tcscpy( szEventStr, _T("MMCN_CLICK             ") );
      break;

    case 0x8005:
      _tcscpy( szEventStr, _T("MMCN_COLUMN_CLICK       ") );
      break;

    case 0x8006:
      _tcscpy( szEventStr, _T("MMCN_CONTEXTMENU        ") );
      break;

    case 0x8007:
      _tcscpy( szEventStr, _T("MMCN_CUTORMOVE          ") );
      break;

    case 0x8008:
      _tcscpy( szEventStr, _T("MMCN_DBLCLICK           ") );
      break;

    case 0x8009:
      _tcscpy( szEventStr, _T("MMCN_DELETE             ") );
      break;

    case 0x800A:
      _tcscpy( szEventStr, _T("MMCN_DESELECT_ALL       ") );
      break;

    case 0x800B:
      _tcscpy( szEventStr, _T("MMCN_EXPAND             ") );
      break;

    case 0x800C:
      _tcscpy( szEventStr, _T("MMCN_HELP               ") );
      break;

    case 0x800D:
      _tcscpy( szEventStr, _T("MMCN_MENU_BTNCLICK      ") );
      break;

    case 0x800E:
      _tcscpy( szEventStr, _T("MMCN_MINIMIZED          ") );
      break;

    case 0x800F:
      _tcscpy( szEventStr, _T("MMCN_PASTE              ") );
      break;

    case 0x8010:
      _tcscpy( szEventStr, _T("MMCN_PROPERTY_CHANGE    ") );
      break;

    case 0x8011:
      _tcscpy( szEventStr, _T("MMCN_QUERY_PASTE        ") );
      break;

    case 0x8012:
      _tcscpy( szEventStr, _T("MMCN_REFRESH            ") );
      break;

    case 0x8013:
      _tcscpy( szEventStr, _T("MMCN_REMOVE_CHILDREN    ") );
      break;

    case 0x8014:
      _tcscpy( szEventStr, _T("MMCN_RENAME             ") );
      break;

    case 0x8015:
      _tcscpy( szEventStr, _T("MMCN_SELECT             ") );
      break;

    case 0x8016:
      _tcscpy( szEventStr, _T("MMCN_SHOW               ") );
      break;

    case 0x8017:
      _tcscpy( szEventStr, _T("MMCN_VIEW_CHANGE        ") );
      break;

    case 0x8018:
      _tcscpy( szEventStr, _T("MMCN_SNAPINHELP         ") );
      break;

    case 0x8019:
      _tcscpy( szEventStr, _T("MMCN_CONTEXTHELP        ") );
      break;

    case 0x801A:
      _tcscpy( szEventStr, _T("MMCN_INITOCX            ") );
      break;

    // MMC Version 1.1 notifications
    case 0x801B:
      _tcscpy( szEventStr, _T("MMCN_FILTER_CHANGE      ") );
      break;

    case 0x801C:
      _tcscpy( szEventStr, _T("MMCN_FILTERBTN_CLICK    ") );
      break;

    case 0x801D:
      _tcscpy( szEventStr, _T("MMCN_RESTORE_VIEW       ") );
      break;

    case 0x801E:
      _tcscpy( szEventStr, _T("MMCN_PRINT              ") );
      break;

    case 0x801F:
      _tcscpy( szEventStr, _T("MMCN_PRELOAD            ") );
      break;

    case 0x8020:
      _tcscpy( szEventStr, _T("MMCN_LISTPAD            ") );
      break;

    case 0x8021:
      _tcscpy( szEventStr, _T("MMCN_EXPANDSYNC         ") );
      break;

    // MMC Version 1.2 notifications
    case 0x8022:
      _tcscpy( szEventStr, _T("MMCN_COLUMNS_CHANGED    ") );
      break;

    // MMC Version 2.0 notifications
    case 0x8023:
      _tcscpy( szEventStr, _T("MMCN_CANPASTE_OUTOFPROC ") );
      break;

    default:
      _stprintf( szEventStr, _T("0x%X"), Event );
      break;
  }

#endif
} //end MapEvent()

VOID Trace_Event | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LONG | nEvent
 | ) |  |

Definition at line 119 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szEventStr[64];
  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Event = %s\n");
  INT    nChars     = 0;

  MapEvent( nEvent, szEventStr );

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      szEventStr
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Event()

VOID Trace_HR | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | HRESULT | hr
 | ) |  |

Definition at line 28 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Returned 0x%X\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer, szFormat, pszClass, pszFunction, hr );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_HR()

VOID Trace_Pointer | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LPCTSTR | pszAction,
 |  | ULONG | ulValue
 | ) |  |

Definition at line 86 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> %s = 0x%X\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      pszAction,
                      ulValue
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Pointer()

VOID Trace_Start | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction
 | ) |  |

Definition at line 151 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Started \n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Start()

VOID Trace_Value | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LPCTSTR | pszValueName,
 |  | LONG | nValue
 | ) |  |

Definition at line 54 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> %s = %u\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      pszValueName,
                      nValue
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Value()

Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/help/tracemacro.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • help
Defines | Functions

tracemacro.h File Reference

Go to the source code of this file.

Defines

#define | TRACE_EVENT
#define | TRACE_HRESULT
#define | TRACE_PTR
#define | TRACE_START
#define | TRACE_VAL

Functions

VOID | MapEvent (LONG Event, LPTSTR szEventStr)
VOID | Trace_Event (LPCTSTR pszClass, LPCTSTR pszFunction, LONG nEvent)
VOID | Trace_HR (LPCTSTR pszClass, LPCTSTR pszFunction, HRESULT hr)
VOID | Trace_Pointer (LPCTSTR pszClass, LPCTSTR pszFunction, LPCTSTR pszAction, ULONG ulValue)
VOID | Trace_Start (LPCTSTR pszClass, LPCTSTR pszFunction)
VOID | Trace_Value (LPCTSTR pszClass, LPCTSTR pszFunction, LPCTSTR pszValueName, LONG nValue)

Define Documentation

#define TRACE_EVENT

Definition at line 64 of file tracemacro.h.

#define TRACE_HRESULT

Definition at line 55 of file tracemacro.h.

#define TRACE_PTR

Definition at line 61 of file tracemacro.h.

#define TRACE_START

Definition at line 67 of file tracemacro.h.

#define TRACE_VAL

Definition at line 58 of file tracemacro.h.

Function Documentation

VOID MapEvent | ( | LONG | Event,
 |  | LPTSTR | szEventStr
 | ) |  |

Definition at line 146 of file tracemacro.cpp.

{
#ifdef _DEBUG

  switch( Event )
  {
    case 0x8001:
      _tcscpy( szEventStr, _T("MMCN_ACTIVATE       ") );
      break;

    case 0x8002:
      _tcscpy( szEventStr, _T("MMCN_ADD_IMAGES     ") );
      break;

    case 0x8003:
      _tcscpy( szEventStr, _T("MMCN_BTN_CLICK      ") );
      break;

    case 0x8004:
      _tcscpy( szEventStr, _T("MMCN_CLICK          ") );
      break;

    case 0x8005:
      _tcscpy( szEventStr, _T("MMCN_COLUMN_CLICK   ") );
      break;

    case 0x8006:
      _tcscpy( szEventStr, _T("MMCN_CONTEXTMENU    ") );
      break;

    case 0x8007:
      _tcscpy( szEventStr, _T("MMCN_CUTORMOVE      ") );
      break;

    case 0x8008:
      _tcscpy( szEventStr, _T("MMCN_DBLCLICK       ") );
      break;

    case 0x8009:
      _tcscpy( szEventStr, _T("MMCN_DELETE         ") );
      break;

    case 0x800A:
      _tcscpy( szEventStr, _T("MMCN_DESELECT_ALL   ") );
      break;

    case 0x800B:
      _tcscpy( szEventStr, _T("MMCN_EXPAND         ") );
      break;

    case 0x800C:
      _tcscpy( szEventStr, _T("MMCN_HELP           ") );
      break;

    case 0x800D:
      _tcscpy( szEventStr, _T("MMCN_MENU_BTNCLICK  ") );
      break;

    case 0x800E:
      _tcscpy( szEventStr, _T("MMCN_MINIMIZED      ") );
      break;

    case 0x800F:
      _tcscpy( szEventStr, _T("MMCN_PASTE          ") );
      break;

    case 0x8010:
      _tcscpy( szEventStr, _T("MMCN_PROPERTY_CHANGE") );
      break;

    case 0x8011:
      _tcscpy( szEventStr, _T("MMCN_QUERY_PASTE    ") );
      break;

    case 0x8012:
      _tcscpy( szEventStr, _T("MMCN_REFRESH        ") );
      break;

    case 0x8013:
      _tcscpy( szEventStr, _T("MMCN_REMOVE_CHILDREN") );
      break;

    case 0x8014:
      _tcscpy( szEventStr, _T("MMCN_RENAME         ") );
      break;

    case 0x8015:
      _tcscpy( szEventStr, _T("MMCN_SELECT         ") );
      break;

    case 0x8016:
      _tcscpy( szEventStr, _T("MMCN_SHOW           ") );
      break;

    case 0x8017:
      _tcscpy( szEventStr, _T("MMCN_VIEW_CHANGE    ") );
      break;

    case 0x8018:
      _tcscpy( szEventStr, _T("MMCN_SNAPINHELP     ") );
      break;

    case 0x8019:
      _tcscpy( szEventStr, _T("MMCN_CONTEXTHELP    ") );
      break;

    case 0x801A:
      _tcscpy( szEventStr, _T("MMCN_INITOCX        ") );
      break;

    case 0x8021:
      _tcscpy( szEventStr, _T("MMCN_EXPANDSYNC     ") );
      break;

    default:
      _stprintf( szEventStr, _T("0x%X"), Event );
      break;
  }

#endif
} //end MapEvent()

VOID Trace_Event | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LONG | nEvent
 | ) |  |

Definition at line 86 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szEventStr[22];
  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Event = %s\n");
  INT    nChars     = 0;

  MapEvent( nEvent, szEventStr );

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      szEventStr
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Event()

VOID Trace_HR | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | HRESULT | hr
 | ) |  |

Definition at line 27 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Returned 0x%X\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer, szFormat, pszClass, pszFunction, hr );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_HR()

VOID Trace_Pointer | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LPCTSTR | pszAction,
 |  | ULONG | ulValue
 | ) |  |

Definition at line 86 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> %s = 0x%X\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      pszAction,
                      ulValue
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Pointer()

VOID Trace_Start | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction
 | ) |  |

Definition at line 118 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Started \n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Start()

VOID Trace_Value | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LPCTSTR | pszValueName,
 |  | LONG | nValue
 | ) |  |

Definition at line 53 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> %s = %u\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      pszValueName,
                      nValue
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Value()

Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/help/virtualfile.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • help
Defines

virtualfile.cpp File Reference

#include "VirtualFile.h"
#include "Globals.h"
#include "CompData.h"
#include "Comp.h"
#include "FolderNode.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CVirtualFile")

Define Documentation

#define MODULESTRING _T("CVirtualFile")

Definition at line 25 of file virtualfile.cpp.

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/help/virtualfile.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • help
Classes

virtualfile.h File Reference

#include "Globals.h"
#include "BaseNode.h"

Go to the source code of this file.

Classes

class CVirtualFile
Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/multisel/about.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • multisel
Functions

about.cpp File Reference

#include "Globals.h"
#include "About.h"
#include "Resource.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CSnapinAbout

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 85 of file about.cpp.

{
  if( 0 == InterlockedDecrement((long*)&m_cRef) )
  {
    // we need to decrement our object count in the DLL
    delete this;
    return 0;
  }
  return m_cRef;
}

Generated on Wed Nov 13 2024 16:54:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/multisel/about.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • multisel
Classes

about.h File Reference

#include <mmc.h>

Go to the source code of this file.

Classes

class CSnapinAbout
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/multisel/adddevicedlg.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • multisel

adddevicedlg.cpp File Reference

#include "AddDeviceDlg.h"
#include "Globals.h"
#include "Resource.h"
#include "BaseNode.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/multisel/adddevicedlg.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • multisel
Classes

adddevicedlg.h File Reference

#include "BaseDialog.h"
#include "BaseDialog.h"

Go to the source code of this file.

Classes

class CAddDeviceDlg
Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/multisel/ADDFolderdlg.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • multisel

ADDFolderdlg.cpp File Reference

#include "AddFolderDlg.h"
#include "Globals.h"
#include "Resource.h"
#include "BaseNode.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/multisel/addfolderdlg.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • multisel
Classes

addfolderdlg.h File Reference

#include "BaseDialog.h"

Go to the source code of this file.

Classes

class CAddFolderDlg
Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/multisel/addvfiledlg.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • multisel

addvfiledlg.cpp File Reference

#include "AddVFileDlg.h"
#include "Globals.h"
#include "Resource.h"
#include "BaseNode.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/multisel/addvfiledlg.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • multisel
Classes

addvfiledlg.h File Reference

#include "BaseDialog.h"

Go to the source code of this file.

Classes

class CAddVFileDlg
Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/multisel/basedialog.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • multisel

basedialog.cpp File Reference

#include "BaseDialog.h"
#include "Globals.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/multisel/basedialog.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • multisel
Classes

basedialog.h File Reference

#include <Windows.h>

Go to the source code of this file.

Classes

class CBaseDialog
Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/multisel/basenode.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • multisel
Classes | Defines | Typedefs

basenode.h File Reference

#include "Globals.h"
#include "Resource.h"

Go to the source code of this file.

Classes

class | CBaseNode
struct | tag_BASENODE_PROPERTIES

Defines

#define | DEFAULT_RDI_MASK (RDI_STR | RDI_PARAM | RDI_IMAGE)
#define | DEFAULT_SDI_MASK (SDI_STR | SDI_PARAM | SDI_IMAGE | SDI_OPENIMAGE | SDI_PARENT | SDI_CHILDREN)
#define | MAX_NAME_LEN 64

Typedefs

typedef CBaseNode * | LPBASENODE
typedef NODE_PROPERTIES * | LPNODEPROPS
typedef struct
tag_BASENODE_PROPERTIES 		NODE_PROPERTIES

Define Documentation

#define DEFAULT_RDI_MASK (RDI_STR | RDI_PARAM | RDI_IMAGE)

Definition at line 24 of file basenode.h.

#define DEFAULT_SDI_MASK (SDI_STR | SDI_PARAM | SDI_IMAGE | SDI_OPENIMAGE | SDI_PARENT | SDI_CHILDREN)

Definition at line 23 of file basenode.h.

#define MAX_NAME_LEN 64

Definition at line 26 of file basenode.h.

Typedef Documentation

typedef CBaseNode* LPBASENODE

Definition at line 46 of file basenode.h.

typedef NODE_PROPERTIES* LPNODEPROPS

Definition at line 45 of file basenode.h.

typedef struct tag_BASENODE_PROPERTIES NODE_PROPERTIES
Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/multisel/basesnap.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • multisel
Defines | Functions

basesnap.cpp File Reference

#include <ObjBase.h>
#include <InitGuid.h>
#include "Globals.h"
#include "BaseSnap.h"
#include "CompData.h"
#include "About.h"
#include "Registry.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define | MODULESTRING _T("BaseSnap")

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)
BOOL WINAPI | DllMain (HINSTANCE hInstDLL, DWORD fdwReason, void *lpvReserved)
STDAPI | DllRegisterServer ()
STDAPI | DllUnregisterServer ()
STDMETHODIMP_ (ULONG) CClassFactory

Define Documentation

#define MODULESTRING _T("BaseSnap")

Definition at line 28 of file basesnap.cpp.

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 226 of file basesnap.cpp.

{
  if( 0 == g_uObjectCount && 0 == g_uServerLocks )
    return S_OK;
  else
    return S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 190 of file basesnap.cpp.

{
  // Test for CSnapinAbout
  if( (rclsid != CLSID_CComponentData) && (rclsid != CLSID_CSnapinAbout) )
    return CLASS_E_CLASSNOTAVAILABLE;

  if( !ppvObj )
    return E_FAIL;

  *ppvObj = NULL;

  // We can only hand out IUnknown and IClassFactory pointers.  Fail
  // if caller asks for anything else.
  if( !IsEqualIID(riid, IID_IUnknown) && !IsEqualIID(riid, IID_IClassFactory) )
    return E_NOINTERFACE;

  CClassFactory *pFactory = NULL;

  // Create the new class factory.  Pass in the type of object to create
  if( rclsid == CLSID_CComponentData )
    pFactory = new CClassFactory(CClassFactory::COMPONENTDATA);
  else if( rclsid == CLSID_CSnapinAbout )
    pFactory = new CClassFactory(CClassFactory::ABOUT);

  HRESULT hResult = pFactory->QueryInterface( riid, ppvObj );

  return hResult;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstDLL,
 |  | DWORD | fdwReason,
 |  | void * | lpvReserved
 | ) |  |

Definition at line 173 of file basesnap.cpp.

{
  if( DLL_PROCESS_ATTACH == fdwReason )
  {
     g_hInst = hInstDLL;
  }

  return TRUE;
}

STDAPI DllRegisterServer ( void )

Definition at line 236 of file basesnap.cpp.

{
  HRESULT hResult = S_FALSE;

  do
  { // Support ISnapinAbout
    hResult = RegisterServer( g_hInst, CLSID_CSnapinAbout, gtszABOUT_NAME );
    BREAK_ON_ERROR( hResult );

    hResult = RegisterServer( g_hInst, CLSID_CComponentData, gtszSNAPIN_NAME );
    BREAK_ON_ERROR( hResult );

    hResult = RegisterSnapin( CLSID_CComponentData, gtszSNAPIN_NAME, CLSID_CSnapinAbout, FALSE );
    BREAK_ON_ERROR( hResult );

  }while( 0 );

  return hResult;
}

STDAPI DllUnregisterServer ( void )

Definition at line 258 of file basesnap.cpp.

{
  if( S_OK != UnregisterServer( CLSID_CComponentData )  ||
      S_OK != UnregisterServer( CLSID_CSnapinAbout   )  ||
      S_OK != UnregisterSnapin( CLSID_CComponentData )
    )
    return E_UNEXPECTED;
  else
    return S_OK;
}

STDMETHODIMP_ ( ULONG )

Definition at line 91 of file basesnap.cpp.

{
  if( 0 == InterlockedDecrement( (long*)&m_cRef) )
  {
    delete this;
    return 0;
  }
  return m_cRef;
}

Generated on Wed Nov 13 2024 16:54:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/multisel/basesnap.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • multisel
Classes | Functions

basesnap.h File Reference

Go to the source code of this file.

Classes

class | CClassFactory

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 53 of file ComSpyAudit.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 61 of file ComSpyAudit.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

Generated on Wed Nov 13 2024 16:54:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/multisel/comp.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • multisel
Defines | Functions

comp.cpp File Reference

#include "Globals.h"
#include "Comp.h"
#include "CompData.h"
#include "DataObj.h"
#include "Resource.h"
#include "StaticNode.h"
#include "FolderNode.h"
#include "VirtualFile.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CComponent")

Functions

STDMETHODIMP_ (ULONG) CComponent

Define Documentation

#define MODULESTRING _T("CComponent")

Definition at line 27 of file comp.cpp.

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 103 of file comp.cpp.

{
  if( InterlockedDecrement((LONG*)&m_cRef) == 0 )
  {
    delete this;
    return 0;
  }
  return m_cRef;
}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/multisel/comp.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • multisel
Classes

comp.h File Reference

#include "Globals.h"

Go to the source code of this file.

Classes

class CComponent
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/multisel/compdata.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • multisel
Defines | Functions

compdata.cpp File Reference

#include "Globals.h"
#include "Comp.h"
#include "CompData.h"
#include "DataObj.h"
#include "Resource.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CComponentData")

Functions

STDMETHODIMP_ (ULONG) CComponentData

Define Documentation

#define MODULESTRING _T("CComponentData")

Definition at line 23 of file compdata.cpp.

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 118 of file compdata.cpp.

{
  if( InterlockedDecrement((LONG*)&m_cRef) == 0 )
  {
    delete this;
    return 0;
  }

  return m_cRef;
}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/multisel/compdata.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • multisel
Classes

compdata.h File Reference

#include "Globals.h"
#include "BaseNode.h"

Go to the source code of this file.

Classes

class CComponentData
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/multisel/dataobj.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • multisel
Defines | Functions

dataobj.cpp File Reference

#include "Globals.h"
#include "DataObj.h"
#include "StaticNode.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CDataObject")

Functions

STDMETHODIMP_ (ULONG) CDataObject

Define Documentation

#define MODULESTRING _T("CDataObject")

Definition at line 21 of file dataobj.cpp.

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 101 of file dataobj.cpp.

{
  if (InterlockedDecrement((LONG*)&m_cRef) == 0)
  {
    delete this;
    return 0;
  }
  return m_cRef;
}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/multisel/dataobj.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • multisel
Classes | Typedefs

dataobj.h File Reference

#include "Globals.h"
#include "StaticNode.h"
#include "LListImpl.h"
#include "StaticNode.h"

Go to the source code of this file.

Classes

struct | _MultiSelectCookies
class | CDataObject

Typedefs

typedef struct _MultiSelectCookies | MULTISELECT_COOKIES

Typedef Documentation

typedef struct _MultiSelectCookies MULTISELECT_COOKIES
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/multisel/devicenode.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • multisel
Defines

devicenode.cpp File Reference

#include "DeviceNode.h"
#include "FolderNode.h"
#include "AddFolderDlg.h"
#include "CompData.h"
#include "Comp.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CDeviceNode")

Define Documentation

#define MODULESTRING _T("CDeviceNode")

Definition at line 25 of file devicenode.cpp.

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/multisel/devicenode.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • multisel
Classes

devicenode.h File Reference

#include "Globals.h"
#include "FolderNode.h"
#include "LListImpl.h"

Go to the source code of this file.

Classes

class CDeviceNode
Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/multisel/foldernode.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • multisel
Defines

foldernode.cpp File Reference

#include "FolderNode.h"
#include "CompData.h"
#include "Comp.h"
#include "AddVFileDlg.h"
#include "DataObj.h"
#include "DeviceNode.h"
#include "VirtualFIle.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CFolderNode")

Define Documentation

#define MODULESTRING _T("CFolderNode")

Definition at line 27 of file foldernode.cpp.

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/multisel/foldernode.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • multisel
Classes

foldernode.h File Reference

#include "Globals.h"
#include "BaseNode.h"
#include "VirtualFile.h"
#include "LListImpl.h"
#include "VirtualFile.h"

Go to the source code of this file.

Classes

class CFolderNode
Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/multisel/globals.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • multisel
Functions | Variables

globals.cpp File Reference

#include "Globals.h"
#include "BaseNode.h"

Go to the source code of this file.

Functions

void _fastcall | CopyT2W (LPWSTR strDest, LPCTSTR strSource, size_t count)
CBaseNode * | ExtractBaseNodePtr (LPDATAOBJECT ipDataObject)
CDataObject * | ExtractDataObjPtr (LPDATAOBJECT ipDataObject)
HRESULT | ExtractFromDataObject (LPDATAOBJECT ipDataObject, UINT cfClipFormat, ULONG nByteCount, HGLOBAL *phGlobal)
void | InitClipboardFormats ()
DWORD | IsCompositeDataObject (LPDATAOBJECT ipDataObject)
void _fastcall | Unicode2Ansi (CHAR **pszAnsi, WCHAR *szWide)

Variables

UINT | g_cfBaseNodePtr = 0
UINT | g_cfDataObjPtr = 0
UINT | g_cfDisplayName = 0
UINT | g_cfMS_Cookies = 0
UINT | g_cfMS_IsMsObj = 0
UINT | g_cfMS_Objects = 0
UINT | g_cfMS_Snapins = 0
UINT | g_cfNodeType = 0
UINT | g_cfSnapinClsid = 0
UINT | g_cfszNodeType = 0
HINSTANCE | g_hInst = NULL
ULONG | g_uObjectCount = 0
ULONG | g_uServerLocks = 0

Function Documentation

void _fastcall CopyT2W | ( | LPWSTR | strDest,
 |  | LPCTSTR | strSource,
 |  | size_t | count
 | ) |  |

Definition at line 72 of file globals.cpp.

{
#ifndef _UNICODE

  MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, strSource, -1, strDest, count );

#else

  wcsncpy( strDest, strSource, count );

#endif

  if ( count > 0 )
    strDest[ count - 1 ] = 0;
}

CBaseNode* ExtractBaseNodePtr ( LPDATAOBJECT ipDataObject )

Definition at line 187 of file globals.cpp.

{
  LPBASENODE  pNode   = NULL;
  HGLOBAL     hGlobal = NULL;
  HRESULT     hResult = S_FALSE;

  hResult = ExtractFromDataObject( ipDataObject,
                                   g_cfBaseNodePtr,
                                   sizeof(LPBASENODE),
                                   &hGlobal
                                 );
  if( SUCCEEDED(hResult) )
  {
    pNode = *(LPBASENODE*)(hGlobal);
    HGLOBAL hRetVal = GlobalFree(hGlobal);
    _ASSERT( NULL == hRetVal );        // Must return NULL
  }

  return pNode;

}

CDataObject* ExtractDataObjPtr ( LPDATAOBJECT ipDataObject )

Definition at line 216 of file globals.cpp.

{
  _ASSERT( 0 != g_cfDataObjPtr );

  HGLOBAL      hGlobal = NULL;
  HRESULT      hResult = S_OK;
  CDataObject* pDO     = NULL;

  hResult = ExtractFromDataObject( ipDataObject,
                                   g_cfDataObjPtr,
                                   sizeof(CDataObject **),
                                   &hGlobal
                                 );

  if( SUCCEEDED(hResult) )
  {
    pDO = *(CDataObject **)(hGlobal);
    _ASSERT( NULL != pDO );

    HGLOBAL hRetVal = GlobalFree(hGlobal);
    _ASSERT( NULL == hRetVal );       // Must return NULL
  }

  return pDO;

}

HRESULT ExtractFromDataObject | ( | LPDATAOBJECT | ipDataObject,
 |  | UINT | cfClipFormat,
 |  | ULONG | nByteCount,
 |  | HGLOBAL * | phGlobal
 | ) |  |

Definition at line 135 of file globals.cpp.

{
  _ASSERT( NULL != ipDataObject );

            *phGlobal = NULL;
  HRESULT   hResult   = S_FALSE;
  STGMEDIUM StgMedium = { TYMED_HGLOBAL,  NULL  };
  FORMATETC FormatEtc = { cfClipFormat, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };

  do
  {
    // Allocate memory for the stream
    StgMedium.hGlobal = ::GlobalAlloc( GMEM_SHARE, nByteCount );

    if( NULL == StgMedium.hGlobal )
    {
      hResult = E_OUTOFMEMORY;
      break;
    }

    // Attempt to get data from the object
    hResult = ipDataObject->GetDataHere( &FormatEtc, &StgMedium );
    if( FAILED(hResult) )
    {
      break;
    }
    // StgMedium now has the data we need
    *phGlobal = StgMedium.hGlobal;
    StgMedium.hGlobal = NULL;

  } while (0);

  if( FAILED(hResult) && StgMedium.hGlobal )
  {
    HGLOBAL hRetVal = ::GlobalFree(StgMedium.hGlobal);
    _ASSERT( NULL == hRetVal );         // Must return NULL
  }
  return hResult;

}

void InitClipboardFormats ( )

Definition at line 112 of file globals.cpp.

{
  g_cfDisplayName  = RegisterClipboardFormat( T_CCF_DISPLAY_NAME );
  g_cfNodeType     = RegisterClipboardFormat( T_CCF_NODETYPE );
  g_cfszNodeType   = RegisterClipboardFormat( T_CCF_SZNODETYPE );
  g_cfSnapinClsid  = RegisterClipboardFormat( T_CCF_SNAPIN_CLASSID );

  g_cfBaseNodePtr  = RegisterClipboardFormat( T_CCF_BASENODE_PTR );
  g_cfDataObjPtr   = RegisterClipboardFormat( T_CCF_DATAOBJ_PTR );

  // MULTISELECT: Register new clipformats
  g_cfMS_Snapins   = RegisterClipboardFormat( T_CCF_MULTI_SELECT_SNAPINS );
  g_cfMS_Objects   = RegisterClipboardFormat( T_CCF_OBJECT_TYPES_IN_MULTI_SELECT );
  g_cfMS_IsMsObj   = RegisterClipboardFormat( T_CCF_MMC_MULTISELECT_DATAOBJECT );

  g_cfMS_Cookies   = RegisterClipboardFormat( T_CCF_MULTISELECT_COOKIES );

}

DWORD IsCompositeDataObject ( LPDATAOBJECT ipDataObject )

Definition at line 92 of file globals.cpp.

{
  _ASSERT( NULL != ipDataObject );
  DWORD      dwIsMSDO = 0;
  FORMATETC FormatEtc = { g_cfMS_IsMsObj, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL};
  STGMEDIUM StgMedium = { TYMED_HGLOBAL,  NULL };

  HRESULT hResult = ipDataObject->GetData( &FormatEtc, &StgMedium );
  if( S_OK == hResult )
  {
    dwIsMSDO = *(DWORD*)StgMedium.hGlobal;
    GlobalFree( StgMedium.hGlobal );
  }

  return dwIsMSDO;
}

void _fastcall Unicode2Ansi | ( | CHAR ** | pszAnsi,
 |  | WCHAR * | szWide
 | ) |  |

Definition at line 53 of file globals.cpp.

{
  LONG nLen = wcslen( szWide ) +1;
  *pszAnsi = (char*)CoTaskMemAlloc( nLen );
  char* pCounter = *pszAnsi;

  while( *szWide )
  {
    *pCounter = LOBYTE(*szWide);
    pCounter++;
    szWide++;
  }
  *pCounter = NULL;
}

Variable Documentation

UINT g_cfBaseNodePtr = 0

Definition at line 28 of file globals.cpp.

UINT g_cfDataObjPtr = 0

Definition at line 29 of file globals.cpp.

UINT g_cfDisplayName = 0

Definition at line 20 of file globals.cpp.

UINT g_cfMS_Cookies = 0

Definition at line 37 of file globals.cpp.

UINT g_cfMS_IsMsObj = 0

Definition at line 36 of file globals.cpp.

UINT g_cfMS_Objects = 0

Definition at line 35 of file globals.cpp.

UINT g_cfMS_Snapins = 0

Definition at line 34 of file globals.cpp.

UINT g_cfNodeType = 0

Definition at line 21 of file globals.cpp.

UINT g_cfSnapinClsid = 0

Definition at line 23 of file globals.cpp.

UINT g_cfszNodeType = 0

Definition at line 22 of file globals.cpp.

HINSTANCE g_hInst = NULL

Definition at line 42 of file globals.cpp.

ULONG g_uObjectCount = 0

Definition at line 43 of file globals.cpp.

ULONG g_uServerLocks = 0

Definition at line 44 of file globals.cpp.

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/multisel/globals.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • multisel
Defines | Functions | Variables

globals.h File Reference

#include <TChar.h>
#include <Mmc.h>
#include <CrtDbg.h>
#include <CommCtrl.h>
#include "Guids.h"
#include "Guids.h"

Go to the source code of this file.

Defines

#define | ATTRIBUTE_BACKUP_DEVICE 2048
#define | ATTRIBUTE_DATA_ARCHIVE 2
#define | ATTRIBUTE_DATA_HIDDEN 4
#define | ATTRIBUTE_DATA_LOCKED 8
#define | ATTRIBUTE_DATA_READONLY 16
#define | BREAK_ON_ERROR(hResult) if( S_OK != hResult ) continue
#define | BYTE_SIZE(string) ((_tcslen(string)+1) * sizeof(TCHAR))
#define | IDM_CLEAR_ATTRIBS 500
#define | IDM_NEW_DEVICE 100
#define | IDM_NEW_FOLDER 200
#define | IDM_NEW_VIRTFILE 400
#define | IDM_TOGGLE_STATUS 300
#define | IMG_CDROM_DEFAULT 6
#define | IMG_DATA_FILE 2
#define | IMG_DEVICE_DEFAULT 0
#define | IMG_DEVICE_OFFLINE 1
#define | IMG_DRIVE_DEFAULT 3
#define | IMG_DRIVE_OFFLINE 4
#define | IMG_FOLDER_DEFAULT 5
#define | IMG_REMOVABLE_MEDIA 7
#define | MsgBox(wszMsg, wszTitle) ::MessageBox(NULL, wszMsg, wszTitle, MB_OK)
#define | NODETYPE_DEVICE 200
#define | NODETYPE_FOLDER 300
#define | NODETYPE_RESULT 400
#define | NODETYPE_STATIC 100
#define | NODETYPE_VFILE 500
#define | REQUEST_ICONSOLE 1001
#define | REQUEST_ICONSOLENAMESPACE 1000
#define | REQUEST_ICONSOLEVERB 1002
#define | REQUEST_ICONTROLBAR 1005
#define | REQUEST_IDEVICETOOLBAR 1007
#define | REQUEST_IHEADERCTRL 1004
#define | REQUEST_IRESULTDATA 1003
#define | REQUEST_ISTATICTOOLBAR 1006
#define | REQUEST_IVFILETOOLBAR 1008
#define | STATUS_OFFLINE 0
#define | STATUS_ONLINE 1
#define | T_CCF_BASENODE_PTR _T("CCF_BASENODE_PTR")
#define | T_CCF_DATAOBJ_PTR _T("CCF_DATAOBJ_PTR")
#define | T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")
#define | T_CCF_MMC_MULTISELECT_DATAOBJECT _T("CCF_MMC_MULTISELECT_DATAOBJECT")
#define | T_CCF_MULTI_SELECT_SNAPINS _T("CCF_MULTI_SELECT_SNAPINS")
#define | T_CCF_MULTISELECT_COOKIES _T("CCF_MULTISELECT_COOKIES")
#define | T_CCF_NODETYPE _T("CCF_NODETYPE")
#define | T_CCF_OBJECT_TYPES_IN_MULTI_SELECT _T("CCF_OBJECT_TYPES_IN_MULTI_SELECT")
#define | T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")
#define | T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")
#define | W2T(szAnsiPtr, szWide) Unicode2Ansi( szAnsiPtr, szWide )
#define | WM_ADD_VIRTUALFILE (WM_USER + 103)
#define | WM_ADDNEW_NODE (WM_USER + 101)
#define | WM_DELETE_NODE (WM_USER + 100)
#define | WM_DIALOG_CLOSED (WM_USER + 102)
#define | WM_VIRTUALFILE_CLOSED (WM_USER + 104)

Functions

void _fastcall | CopyT2W (LPWSTR strDest, LPCTSTR strSource, size_t count)
CBaseNode * | ExtractBaseNodePtr (LPDATAOBJECT ipDataObject)
CDataObject * | ExtractDataObjPtr (LPDATAOBJECT ipDataObject)
HRESULT | ExtractFromDataObject (LPDATAOBJECT ipDataObject, UINT cf, ULONG cb, HGLOBAL *phGlobal)
void | InitClipboardFormats ()
DWORD | IsCompositeDataObject (LPDATAOBJECT ipDataObject)
template<class TYPE >
void | SAFE_FREE_BITMAP (TYPE *&pObj)
template<class TYPE >
void | SAFE_FREE_ICON (TYPE *&pObj)
template<class TYPE >
void | SAFE_RELEASE (TYPE *&pObj)
void _fastcall | Unicode2Ansi (CHAR **pszAnsi, WCHAR *szWide)

Variables

UINT g_cfBaseNodePtr
UINT g_cfDataObjPtr
UINT g_cfDisplayName
UINT g_cfMS_Cookies
UINT g_cfMS_IsMsObj
UINT g_cfMS_Objects
UINT g_cfMS_Snapins
UINT g_cfNodeType
UINT g_cfSnapinClsid
UINT g_cfszNodeType
HINSTANCE | g_hInst
ULONG g_uObjectCount
ULONG g_uServerLocks

Define Documentation

#define ATTRIBUTE_BACKUP_DEVICE 2048

Definition at line 110 of file globals.h.

#define ATTRIBUTE_DATA_ARCHIVE 2

Definition at line 106 of file globals.h.

#define ATTRIBUTE_DATA_HIDDEN 4

Definition at line 107 of file globals.h.

#define ATTRIBUTE_DATA_LOCKED 8

Definition at line 108 of file globals.h.

#define ATTRIBUTE_DATA_READONLY 16

Definition at line 109 of file globals.h.

#define BREAK_ON_ERROR ( hResult ) if( S_OK != hResult ) continue

Definition at line 181 of file globals.h.

#define BYTE_SIZE ( string ) ((_tcslen(string)+1) * sizeof(TCHAR))

Definition at line 179 of file globals.h.

#define IDM_CLEAR_ATTRIBS 500

Definition at line 126 of file globals.h.

#define IDM_NEW_DEVICE 100

Definition at line 122 of file globals.h.

#define IDM_NEW_FOLDER 200

Definition at line 123 of file globals.h.

#define IDM_NEW_VIRTFILE 400

Definition at line 125 of file globals.h.

#define IDM_TOGGLE_STATUS 300

Definition at line 124 of file globals.h.

#define IMG_CDROM_DEFAULT 6

Definition at line 119 of file globals.h.

#define IMG_DATA_FILE 2

Definition at line 115 of file globals.h.

#define IMG_DEVICE_DEFAULT 0

Definition at line 113 of file globals.h.

#define IMG_DEVICE_OFFLINE 1

Definition at line 114 of file globals.h.

#define IMG_DRIVE_DEFAULT 3

Definition at line 116 of file globals.h.

#define IMG_DRIVE_OFFLINE 4

Definition at line 117 of file globals.h.

#define IMG_FOLDER_DEFAULT 5

Definition at line 118 of file globals.h.

#define IMG_REMOVABLE_MEDIA 7

Definition at line 120 of file globals.h.

#define MsgBox | ( | wszMsg,
 |  | wszTitle |
 | ) |  | ::MessageBox(NULL, wszMsg, wszTitle, MB_OK)

Definition at line 184 of file globals.h.

#define NODETYPE_DEVICE 200

Definition at line 100 of file globals.h.

#define NODETYPE_FOLDER 300

Definition at line 101 of file globals.h.

#define NODETYPE_RESULT 400

Definition at line 102 of file globals.h.

#define NODETYPE_STATIC 100

Definition at line 99 of file globals.h.

#define NODETYPE_VFILE 500

Definition at line 103 of file globals.h.

#define REQUEST_ICONSOLE 1001

Definition at line 144 of file globals.h.

#define REQUEST_ICONSOLENAMESPACE 1000

Definition at line 143 of file globals.h.

#define REQUEST_ICONSOLEVERB 1002

Definition at line 145 of file globals.h.

#define REQUEST_ICONTROLBAR 1005

Definition at line 148 of file globals.h.

#define REQUEST_IDEVICETOOLBAR 1007

Definition at line 150 of file globals.h.

#define REQUEST_IHEADERCTRL 1004

Definition at line 147 of file globals.h.

#define REQUEST_IRESULTDATA 1003

Definition at line 146 of file globals.h.

#define REQUEST_ISTATICTOOLBAR 1006

Definition at line 149 of file globals.h.

#define REQUEST_IVFILETOOLBAR 1008

Definition at line 151 of file globals.h.

#define STATUS_OFFLINE 0

Definition at line 129 of file globals.h.

#define STATUS_ONLINE 1

Definition at line 128 of file globals.h.

#define T_CCF_BASENODE_PTR _T("CCF_BASENODE_PTR")

Definition at line 85 of file globals.h.

#define T_CCF_DATAOBJ_PTR _T("CCF_DATAOBJ_PTR")

Definition at line 86 of file globals.h.

#define T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")

Definition at line 80 of file globals.h.

#define T_CCF_MMC_MULTISELECT_DATAOBJECT _T("CCF_MMC_MULTISELECT_DATAOBJECT")

Definition at line 92 of file globals.h.

#define T_CCF_MULTI_SELECT_SNAPINS _T("CCF_MULTI_SELECT_SNAPINS")

Definition at line 90 of file globals.h.

#define T_CCF_MULTISELECT_COOKIES _T("CCF_MULTISELECT_COOKIES")

Definition at line 94 of file globals.h.

#define T_CCF_NODETYPE _T("CCF_NODETYPE")

Definition at line 81 of file globals.h.

#define T_CCF_OBJECT_TYPES_IN_MULTI_SELECT _T("CCF_OBJECT_TYPES_IN_MULTI_SELECT")

Definition at line 91 of file globals.h.

#define T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")

Definition at line 83 of file globals.h.

#define T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")

Definition at line 82 of file globals.h.

#define W2T | ( | szAnsiPtr,
 |  | szWide |
 | ) |  | Unicode2Ansi( szAnsiPtr, szWide )

Definition at line 239 of file globals.h.

#define WM_ADD_VIRTUALFILE (WM_USER + 103)

Definition at line 137 of file globals.h.

#define WM_ADDNEW_NODE (WM_USER + 101)

Definition at line 135 of file globals.h.

#define WM_DELETE_NODE (WM_USER + 100)

Definition at line 134 of file globals.h.

#define WM_DIALOG_CLOSED (WM_USER + 102)

Definition at line 136 of file globals.h.

#define WM_VIRTUALFILE_CLOSED (WM_USER + 104)

Definition at line 138 of file globals.h.

Function Documentation

void _fastcall CopyT2W | ( | LPWSTR | strDest,
 |  | LPCTSTR | strSource,
 |  | size_t | count
 | ) |  |

Definition at line 64 of file globals.cpp.

{
#ifndef _UNICODE

  MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, strSource, -1, strDest, count );

#else

  wcsncpy( strDest, strSource, count );

#endif

  if ( count > 0 )
    strDest[ count - 1 ] = 0;
}

CBaseNode* ExtractBaseNodePtr ( LPDATAOBJECT ipDataObject )

Definition at line 150 of file globals.cpp.

{
  LPBASENODE  pNode   = NULL;
  HGLOBAL     hGlobal = NULL;
  HRESULT     hResult = S_FALSE;

  hResult = ExtractFromDataObject( ipDataObject,
                                   g_cfBaseNodePtr,
                                   sizeof(LPBASENODE),
                                   &hGlobal
                                 );
  if( SUCCEEDED(hResult) )
  {
    pNode = *(LPBASENODE*)(hGlobal);
    HGLOBAL hRetVal = GlobalFree(hGlobal);
    _ASSERT( NULL == hRetVal );        // Must return NULL
  }

  return pNode;

}

CDataObject* ExtractDataObjPtr ( LPDATAOBJECT ipDataObject )

Definition at line 179 of file globals.cpp.

{
  _ASSERT( 0 != g_cfDataObjPtr );

  HGLOBAL      hGlobal = NULL;
  HRESULT      hResult = S_OK;
  CDataObject* pDO     = NULL;

  hResult = ExtractFromDataObject( ipDataObject,
                                   g_cfDataObjPtr,
                                   sizeof(CDataObject **),
                                   &hGlobal
                                 );

  if( SUCCEEDED(hResult) )
  {
    pDO = *(CDataObject **)(hGlobal);
    _ASSERT( NULL != pDO );

    HGLOBAL hRetVal = GlobalFree(hGlobal);
    _ASSERT( NULL == hRetVal );       // Must return NULL
  }

  return pDO;

}

HRESULT ExtractFromDataObject | ( | LPDATAOBJECT | ipDataObject,
 |  | UINT | cf,
 |  | ULONG | cb,
 |  | HGLOBAL * | phGlobal
 | ) |  |

Definition at line 98 of file globals.cpp.

{
  _ASSERT( NULL != ipDataObject );

            *phGlobal = NULL;
  HRESULT   hResult   = S_FALSE;
  STGMEDIUM StgMedium = { TYMED_HGLOBAL,  NULL  };
  FORMATETC FormatEtc = { cfClipFormat, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };

  do
  {
    // Allocate memory for the stream
    StgMedium.hGlobal = ::GlobalAlloc( GMEM_SHARE, nByteCount );

    if( NULL == StgMedium.hGlobal )
    {
      hResult = E_OUTOFMEMORY;
      break;
    }

    // Attempt to get data from the object
    hResult = ipDataObject->GetDataHere( &FormatEtc, &StgMedium );
    if( FAILED(hResult) )
    {
      break;
    }
    // StgMedium now has the data we need
    *phGlobal = StgMedium.hGlobal;
    StgMedium.hGlobal = NULL;

  } while (0);

  if( FAILED(hResult) && StgMedium.hGlobal )
  {
    HGLOBAL hRetVal = ::GlobalFree(StgMedium.hGlobal);
    _ASSERT( NULL == hRetVal );         // Must return NULL
  }
  return hResult;

}

void InitClipboardFormats ( )

Definition at line 56 of file globals.cpp.

{
  g_cfDisplayName  = RegisterClipboardFormat( T_CCF_DISPLAY_NAME );
  g_cfNodeType     = RegisterClipboardFormat( T_CCF_NODETYPE );
  g_cfszNodeType   = RegisterClipboardFormat( T_CCF_SZNODETYPE );
  g_cfSnapinClsid  = RegisterClipboardFormat( T_CCF_SNAPIN_CLASSID );

}

DWORD IsCompositeDataObject ( LPDATAOBJECT ipDataObject )

Definition at line 92 of file globals.cpp.

{
  _ASSERT( NULL != ipDataObject );
  DWORD      dwIsMSDO = 0;
  FORMATETC FormatEtc = { g_cfMS_IsMsObj, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL};
  STGMEDIUM StgMedium = { TYMED_HGLOBAL,  NULL };

  HRESULT hResult = ipDataObject->GetData( &FormatEtc, &StgMedium );
  if( S_OK == hResult )
  {
    dwIsMSDO = *(DWORD*)StgMedium.hGlobal;
    GlobalFree( StgMedium.hGlobal );
  }

  return dwIsMSDO;
}

template<class TYPE >
void SAFE_FREE_BITMAP ( TYPE *& pObj ) [inline]

Definition at line 204 of file globals.h.

{
  if( NULL != pObj )
  {
    BOOL bStatus = DeleteObject( pObj );
    pObj = NULL;
  }
  else
  {
    OutputDebugString(_T("Attempted to delete NULL Bitmap handle.\n"));
  }
}

template<class TYPE >
void SAFE_FREE_ICON ( TYPE *& pObj ) [inline]

Definition at line 219 of file globals.h.

{
  if( NULL != pObj )
  {
    BOOL bStatus = DestroyIcon( pObj );
    pObj = NULL;
  }
  else
  {
    OutputDebugString(_T("Attempted to delete NULL Icon handle.\n"));
  }
}

template<class TYPE >
void SAFE_RELEASE ( TYPE *& pObj ) [inline]

Definition at line 189 of file globals.h.

{
  if( NULL != pObj )
  {
    pObj->Release();
    pObj = NULL;
  }
  else
  {
    OutputDebugString(_T("Attempted to release NULL Com pointer.\n"));
  }
}

void _fastcall Unicode2Ansi | ( | CHAR ** | pszAnsi,
 |  | WCHAR * | szWide
 | ) |  |

Definition at line 38 of file globals.cpp.

{
  LONG nLen = wcslen( szWide ) +1;
  *pszAnsi = (char*)CoTaskMemAlloc( nLen );
  char* pCounter = *pszAnsi;

  while( *szWide )
  {
    *pCounter = LOBYTE(*szWide);
    pCounter++;
    szWide++;
  }
  *pCounter = NULL;
}

Variable Documentation

UINT g_cfBaseNodePtr

Definition at line 28 of file globals.cpp.

UINT g_cfDataObjPtr

Definition at line 29 of file globals.cpp.

UINT g_cfDisplayName

Definition at line 19 of file globals.cpp.

UINT g_cfMS_Cookies

Definition at line 37 of file globals.cpp.

UINT g_cfMS_IsMsObj

Definition at line 36 of file globals.cpp.

UINT g_cfMS_Objects

Definition at line 35 of file globals.cpp.

UINT g_cfMS_Snapins

Definition at line 34 of file globals.cpp.

UINT g_cfNodeType

Definition at line 20 of file globals.cpp.

UINT g_cfSnapinClsid

Definition at line 22 of file globals.cpp.

UINT g_cfszNodeType

Definition at line 21 of file globals.cpp.

HINSTANCE g_hInst

Definition at line 62 of file DoServer.Cpp.

ULONG g_uObjectCount

Definition at line 28 of file globals.cpp.

ULONG g_uServerLocks

Definition at line 29 of file globals.cpp.

Generated on Wed Nov 13 2024 16:54:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/multisel/guids.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • multisel
Functions

guids.h File Reference

Go to the source code of this file.

Functions

DEFINE_GUID (CLSID_CComponentData, 0x17384dc8, 0xef90, 0x4776, 0x93, 0x07, 0x70, 0x36, 0x9f, 0x21, 0xe9, 0x9b)
DEFINE_GUID (CLSID_CVirtualFile, 0xf0091c49, 0xc869, 0x4941, 0xa8, 0x1c, 0xc7, 0x19, 0xad, 0x81, 0x74, 0xcc)
DEFINE_GUID (CLSID_CFolderNode, 0x520F23fA, 0x775D, 0x4015, 0xb4, 0x37, 0x98, 0xA2, 0x4B, 0x9D, 0x8, 0x5E)
DEFINE_GUID (CLSID_DeviceNode, 0x520F23f9, 0x775D, 0x4015, 0xB4, 0x37, 0x98, 0xA2, 0x4B, 0x9D, 0x8, 0x5E)
DEFINE_GUID (CLSID_CSnapinAbout, 0xf54789ff, 0xad41, 0x42d4, 0x8f, 0x2e, 0xa6, 0x80, 0x89, 0xf6, 0x25, 0xb1)

Function Documentation

DEFINE_GUID | ( | CLSID_CComponentData | ,
 |  | 0x17384dc8 | ,
 |  | 0xef90 | ,
 |  | 0x4776 | ,
 |  | 0x93 | ,
 |  | 0x07 | ,
 |  | 0x70 | ,
 |  | 0x36 | ,
 |  | 0x9f | ,
 |  | 0x21 | ,
 |  | 0xe9 | ,
 |  | 0x9b |
 | ) |  |
DEFINE_GUID | ( | CLSID_CVirtualFile | ,
 |  | 0xf0091c49 | ,
 |  | 0xc869 | ,
 |  | 0x4941 | ,
 |  | 0xa8 | ,
 |  | 0x1c | ,
 |  | 0xc7 | ,
 |  | 0x19 | ,
 |  | 0xad | ,
 |  | 0x81 | ,
 |  | 0x74 | ,
 |  | 0xcc |
 | ) |  |
DEFINE_GUID | ( | CLSID_CFolderNode | ,
 |  | 0x520F23fA | ,
 |  | 0x775D | ,
 |  | 0x4015 | ,
 |  | 0xb4 | ,
 |  | 0x37 | ,
 |  | 0x98 | ,
 |  | 0xA2 | ,
 |  | 0x4B | ,
 |  | 0x9D | ,
 |  | 0x8 | ,
 |  | 0x5E |
 | ) |  |
DEFINE_GUID | ( | CLSID_DeviceNode | ,
 |  | 0x520F23f9 | ,
 |  | 0x775D | ,
 |  | 0x4015 | ,
 |  | 0xB4 | ,
 |  | 0x37 | ,
 |  | 0x98 | ,
 |  | 0xA2 | ,
 |  | 0x4B | ,
 |  | 0x9D | ,
 |  | 0x8 | ,
 |  | 0x5E |
 | ) |  |
DEFINE_GUID | ( | CLSID_CSnapinAbout | ,
 |  | 0xf54789ff | ,
 |  | 0xad41 | ,
 |  | 0x42d4 | ,
 |  | 0x8f | ,
 |  | 0x2e | ,
 |  | 0xa6 | ,
 |  | 0x80 | ,
 |  | 0x89 | ,
 |  | 0xf6 | ,
 |  | 0x25 | ,
 |  | 0xb1 |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/multisel/llistimpl.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • multisel
Functions

llistimpl.cpp File Reference

#include "LListImpl.h"

Go to the source code of this file.

Functions

BOOL IsValidAddress (const void *lp, UINT nBytes, BOOL bReadWrite)

Function Documentation

BOOL IsValidAddress | ( | const void * | lp,
 |  | UINT | nBytes,
 |  | BOOL | bReadWrite
 | ) |  |

Definition at line 52 of file llistimpl.cpp.

{
  // Simple version using Win-32 APIs for pointer validation.
  return (lp != NULL && !IsBadReadPtr(lp, nBytes) &&
         (!bReadWrite || !IsBadWritePtr((LPVOID)lp, nBytes)));

} //end IsValidAddress()

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/multisel/llistimpl.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • multisel
Classes | Typedefs | Functions

llistimpl.h File Reference

#include <CrtDbg.h>
#include <Windows.h>
#include <new.h>

Go to the source code of this file.

Classes

struct | __POSITION
class | CLListImpl< TYPE, ARG_TYPE >
struct | CLListImpl< TYPE, ARG_TYPE >::CNode
struct | CPlex

Typedefs

typedef __POSITION * | POSITION

Functions

BOOL | IsValidAddress (const void *lp, UINT nBytes, BOOL bReadWrite=TRUE)

Typedef Documentation

typedef __POSITION* POSITION

Definition at line 30 of file llistimpl.h.

Function Documentation

BOOL IsValidAddress | ( | const void * | lp,
 |  | UINT | nBytes,
 |  | BOOL | bReadWrite = TRUE
 | ) |  |

Definition at line 53 of file llistimpl.cpp.

{
  // Simple version using Win-32 APIs for pointer validation.
  return (lp != NULL && !IsBadReadPtr(lp, nBytes) &&
         (!bReadWrite || !IsBadWritePtr((LPVOID)lp, nBytes)));

} //end IsValidAddress()

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/multisel/registry.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • multisel
Defines | Functions

registry.cpp File Reference

#include <ObjBase.h>
#include "Registry.h"
#include "Globals.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define | MODULESTRING _T("Registry")

Functions

HRESULT | RecursiveDeleteKey (HKEY hKeyParent, const TCHAR *szKeyChild)
HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const TCHAR *szNameString, const CLSID &clsidAbout, const BOOL bSupportExtensions)
HRESULT | SetKeyAndValue (const TCHAR *pszPath, const TCHAR *szSubkey, const TCHAR *szValue)
HRESULT | SetSnapInKeyAndValue (const TCHAR *szKey, const TCHAR *szSubkey, const TCHAR *szName, const TCHAR *szValue)
HRESULT | SetValue (const TCHAR *szKey, const TCHAR *szValueName, const TCHAR *szValue)
LONG | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Define Documentation

#define MODULESTRING _T("Registry")

Definition at line 22 of file registry.cpp.

Function Documentation

HRESULT RecursiveDeleteKey | ( | HKEY | hKeyParent,
 |  | const TCHAR * | szKeyChild
 | ) |  |

Definition at line 262 of file registry.cpp.

{
  // Open the child.
  HKEY hKeyChild = NULL;
  LONG lResult   = ERROR_SUCCESS;

  do                     // We go to all this trouble to prevent any
  {                      // possibility of exiting while leaving a key open

    lResult = RegOpenKeyEx( hKeyParent,
                            lpszKeyChild,
                            0,
                            KEY_ALL_ACCESS,
                            &hKeyChild
                          );
    if( ERROR_SUCCESS != lResult )
      continue;

    // Enumerate all of the decendents of this child.
    FILETIME time;
    _TCHAR szBuffer[256];
    DWORD dwSize = 256;
    while( S_OK == RegEnumKeyEx(hKeyChild,0,szBuffer,&dwSize,NULL,NULL,NULL,&time) )
    {
      // Delete the decendents of this child.
      lResult = RecursiveDeleteKey( hKeyChild, szBuffer );
      if( ERROR_SUCCESS != lResult )
      {
        continue;
      }
      dwSize = 256;
    }
  }while( 0 );

  RegCloseKey( hKeyChild );            // Always try to close the child
                                       // then delete this child.
  return RegDeleteKey( hKeyParent, lpszKeyChild );
}

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const TCHAR * | szFriendlyName
 | ) |  |

Definition at line 51 of file registry.cpp.

{
  // Get server location.
  TCHAR    szModule[512] ;
  TCHAR*   pszCLSID = NULL;
  LPOLESTR wszCLSID = NULL ;
  HRESULT  hResult  = S_FALSE;

  DWORD dwResult = ::GetModuleFileName( hModule,
                                        szModule,
                                        sizeof(szModule)/sizeof(TCHAR)
                                      );
  if( 0 == dwResult ) return HRESULT_FROM_WIN32( dwResult );

  do                         // Fail unless we complete everything
  {
    // Get CLSID string in wide char
    hResult = StringFromCLSID( clsid, &wszCLSID ) ;
    if( S_OK != hResult )
    {
      CoTaskMemFree( wszCLSID );
      BREAK_ON_ERROR( hResult );
    }

    W2T( &pszCLSID, wszCLSID );          // W2T is defined in Globals.h
    CoTaskMemFree( wszCLSID );           // Through with wide version

    TCHAR szKey[64];                     // Build the CLSID key string CLSID\\{...}
    _tcscpy( szKey, _T("CLSID\\") );
    _tcscat( szKey, pszCLSID );

    // Add the CLSID to the registry.
    hResult = SetKeyAndValue( szKey, NULL, szFriendlyName );
    BREAK_ON_ERROR( hResult );

    // Add the server filename subkey under the CLSID key.
    hResult = SetKeyAndValue( szKey, _T("InprocServer32"), szModule );
    BREAK_ON_ERROR( hResult );

    // Set the threading model
    _tcscat( szKey, _T("\\InprocServer32") );
    hResult = SetValue( szKey, _T("ThreadingModel"), _T("Apartment") );
    BREAK_ON_ERROR( hResult );

  }while( 0 );

  CoTaskMemFree( pszCLSID );           // Through with TCHAR version

  return hResult;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | bSupportExtensions
 | ) |  |

Definition at line 149 of file registry.cpp.

{
  HRESULT hResult = S_FALSE;
  TCHAR*  pszSnapCLSID = NULL;         // Needed for TCHAR version of the ClassID

  // If any part of this process fails, jump out of the loop and return
  // the error code
  do
  {
    // Allocate the CLSID string
    LPOLESTR wszSnapCLSID  = NULL ;
    hResult = StringFromCLSID( clsid, &wszSnapCLSID ) ;
    if( S_OK != hResult )
    {
       CoTaskMemFree( wszSnapCLSID );
       continue;
    }

    W2T( &pszSnapCLSID, wszSnapCLSID );  // W2T is defined in Globals.h
    CoTaskMemFree( wszSnapCLSID );       // Through with wide version

    // Add the Snap-in's CLSID to the registry
    hResult = SetSnapInKeyAndValue( pszSnapCLSID, NULL, _T("NameString"), szNameString );
    BREAK_ON_ERROR( hResult );

    hResult = SetSnapInKeyAndValue( pszSnapCLSID, _T("StandAlone"), NULL, NULL );
    BREAK_ON_ERROR( hResult );

    // Add registry information for ISnapinAbout if we support it
    LPOLESTR wszAboutCLSID = NULL;
    TCHAR*   pszAboutCLSID = NULL;
    if( IID_NULL != clsidAbout )
    {
      hResult = StringFromCLSID( clsidAbout, &wszAboutCLSID );
      if( S_OK != hResult )
      {
        CoTaskMemFree( wszAboutCLSID ); // Free this memory before exiting
        continue;
      }

      W2T( &pszAboutCLSID, wszAboutCLSID );
      hResult = SetSnapInKeyAndValue( pszSnapCLSID, NULL, _T("About"), pszAboutCLSID );
      CoTaskMemFree( wszAboutCLSID );
      CoTaskMemFree( pszAboutCLSID );
      BREAK_ON_ERROR( hResult );
    }

    if( TRUE == bSupportExtensions )     // Build the NodeTypesKey
    {
      hResult = SetSnapInKeyAndValue( pszSnapCLSID, _T("NodeTypes"), NULL, NULL );
      BREAK_ON_ERROR( hResult );
      TCHAR szKey[64];
      _tcscpy( szKey, pszSnapCLSID );
      _tcscat(szKey, _T("\\NodeTypes"));
      hResult = SetSnapInKeyAndValue( szKey, pszSnapCLSID, NULL, NULL );
      BREAK_ON_ERROR( hResult );
    }
  }while( 0 );

  CoTaskMemFree( pszSnapCLSID);
  return hResult;
}

HRESULT SetKeyAndValue | ( | const TCHAR * | pszPath,
 |  | const TCHAR * | szSubkey,
 |  | const TCHAR * | szValue
 | ) |  |

Definition at line 310 of file registry.cpp.

{
  HKEY hKey = NULL;
  HRESULT hResult = S_FALSE;
  TCHAR szKeyBuf[1024];

  // Copy keyname into buffer.
  _tcscpy( szKeyBuf, szKey );

  // Add subkey name to buffer.
  if( NULL != szSubkey )
  {
    _tcscat( szKeyBuf, _T("\\") );
    _tcscat( szKeyBuf, szSubkey );
  }

  do                     // We go to all this trouble to prevent any
  {                      // possibility of exiting while leaving a key open

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx( HKEY_CLASSES_ROOT,
                                   szKeyBuf,
                                   0,
                                   NULL,
                                   REG_OPTION_NON_VOLATILE,
                                   KEY_ALL_ACCESS,
                                   NULL,
                                   &hKey,
                                   NULL
                                 );
    if( ERROR_SUCCESS != lResult )
    {
      hResult = HRESULT_FROM_WIN32( lResult );
      continue;
    }

    if( NULL != szValue )    // Now set the value
    {
      hResult = RegSetValueEx( hKey,
                               NULL,
                               0,
                               REG_SZ,
                               (BYTE*)szValue,
                               BYTE_SIZE( szValue )    // BYTE_SIZE is in Globals.h
                             );
      BREAK_ON_ERROR( hResult );
    }
  }while( 0 );

  RegCloseKey( hKey );       // Always try to close the key
  return hResult;
}

HRESULT SetSnapInKeyAndValue | ( | const TCHAR * | szKey,
 |  | const TCHAR * | szSubkey,
 |  | const TCHAR * | szName,
 |  | const TCHAR * | szValue
 | ) |  |

Definition at line 429 of file registry.cpp.

{
  HKEY    hKey = NULL;
  HRESULT hResult = S_FALSE;
  TCHAR   szKeyBuf[1024];

  // Load the buffer with the Snap-In Location
  _tcscpy( szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns") );

  _tcscat( szKeyBuf, _T("\\") );       // Copy keyname into buffer.
  _tcscat( szKeyBuf, szKey );

  if( NULL != szSubkey )               // Add subkey name to buffer.
  {
    _tcscat( szKeyBuf, _T("\\") );
    _tcscat( szKeyBuf, szSubkey );
  }

  do                     // We go to all this trouble to prevent any
  {                      // possibility of exiting while leaving a key open

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx( HKEY_LOCAL_MACHINE,
                                   szKeyBuf,
                                   0,
                                   NULL,
                                   REG_OPTION_NON_VOLATILE,
                                   KEY_ALL_ACCESS,
                                   NULL,
                                   &hKey,
                                   NULL
                                 );
    if( ERROR_SUCCESS != lResult )     // Will return S_FALSE
      continue;

    // Set the Value.
    if( szValue != NULL )
    {
      hResult = RegSetValueEx( hKey,
                               szName,
                               0,
                               REG_SZ,
                               (BYTE*)szValue,
                               BYTE_SIZE(szValue)
                             );
      BREAK_ON_ERROR( hResult );
    }
    else
    {                        // Got this far so everything is OK.
      hResult = S_OK;
    }
  }while( 0 );

  RegCloseKey( hKey );       //Always attempt to close the key
  return hResult;
}

HRESULT SetValue | ( | const TCHAR * | szKey,
 |  | const TCHAR * | szValueName,
 |  | const TCHAR * | szValue
 | ) |  |

Definition at line 372 of file registry.cpp.

{
  HKEY    hKey = NULL;
  HRESULT hResult = S_FALSE;
  TCHAR szKeyBuf[1024];

  // Copy keyname into buffer.
  _tcscpy( szKeyBuf, szKey );

  do                     // We go to all this trouble to prevent any
  {                      // possibility of exiting while leaving a key open

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx( HKEY_CLASSES_ROOT ,
                                   szKeyBuf,
                                   0,
                                   NULL,
                                   REG_OPTION_NON_VOLATILE,
                                   KEY_ALL_ACCESS,
                                   NULL,
                                   &hKey,
                                   NULL
                                 );
    if( ERROR_SUCCESS != lResult )
    {
      hResult = HRESULT_FROM_WIN32( lResult );
      continue;
    }

    if( NULL != szValue )    // Now set the value
    {
      hResult = RegSetValueEx( hKey,
                               szValueName,
                               0,
                               REG_SZ,
                               (BYTE*)szValue,
                               BYTE_SIZE( szValue )
                             );
      BREAK_ON_ERROR( hResult );
    }
  }while( 0 );

  RegCloseKey( hKey );       //Always attempt to close the key
  return hResult;
}

LONG UnregisterServer ( const CLSID & clsid )

Definition at line 111 of file registry.cpp.

{
  HRESULT hResult = S_OK;

  // Allocate the CLSID string
  LPOLESTR wszCLSID = NULL ;
  hResult = StringFromCLSID( clsid, &wszCLSID );
  if( S_OK != hResult )
  {
    CoTaskMemFree( wszCLSID );
    return hResult;
  }

  // Build the key CLSID\\{...}
  TCHAR szKey[64];
  _tcscpy( szKey, _T("CLSID\\") );

  TCHAR* pszCLSID = NULL;
  W2T( &pszCLSID, wszCLSID );          // W2T is defined in Globals.h
  CoTaskMemFree( wszCLSID );           // Through with wide version

  _tcscat( szKey, pszCLSID );
  CoTaskMemFree( pszCLSID );           // Through with TCHAR version

  // Delete the CLSID Key - CLSID\{...}
  LONG lResult = RecursiveDeleteKey( HKEY_CLASSES_ROOT, szKey );
  if( ERROR_SUCCESS != lResult )
    hResult = HRESULT_FROM_WIN32( lResult );

  return hResult;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 222 of file registry.cpp.

{
  HRESULT hResult = S_OK;

  TCHAR    szKeyBuf[1024];
  LPOLESTR wszCLSID = NULL;
  TCHAR*   pszCLSID = NULL;        // Needed for TCHAR version of the ClassID

  // Get CLSID as a wide string
  hResult = StringFromCLSID( clsid, &wszCLSID );
  if( S_OK != hResult )
  {
    CoTaskMemFree( wszCLSID );
    return hResult;
  }

  W2T( &pszCLSID, wszCLSID );          // W2T is defined in Globals.h
  CoTaskMemFree( wszCLSID );           // Through with wide version

  // Load the buffer with the Snap-In Location
  _tcscpy( szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns") );

  _tcscat( szKeyBuf, _T("\\") );       // Copy keyname into buffer.
  _tcscat( szKeyBuf, pszCLSID );

  // Delete the CLSID Key - CLSID\{...}
  LONG lResult = RecursiveDeleteKey( HKEY_LOCAL_MACHINE, szKeyBuf );
  if( ERROR_SUCCESS != lResult )
    hResult = HRESULT_FROM_WIN32( lResult );

  CoTaskMemFree( pszCLSID );
  return hResult;
}

Generated on Wed Nov 13 2024 16:53:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/multisel/registry.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • multisel
Functions

registry.h File Reference

#include <tchar.h>

Go to the source code of this file.

Functions

HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const TCHAR *szNameString, const CLSID &clsidAbout, const BOOL fSupportExtensions=FALSE)
HRESULT | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Function Documentation

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const TCHAR * | szFriendlyName
 | ) |  |

Definition at line 51 of file registry.cpp.

{
  // Get server location.
  TCHAR    szModule[512] ;
  TCHAR*   pszCLSID = NULL;
  WCHAR*   wszCLSID = NULL ;
  HRESULT  hResult  = S_FALSE;

  DWORD dwResult = ::GetModuleFileName( hModule,
                                        szModule,
                                        sizeof(szModule)/sizeof(TCHAR)
                                      );
  if( 0 == dwResult ) return HRESULT_FROM_WIN32( dwResult );

  do                         // Fail unless we complete everything
  {
    // Get CLSID string in wide char
    hResult = StringFromCLSID( clsid, &wszCLSID ) ;
    if( S_OK != hResult )
    {
      CoTaskMemFree( wszCLSID );
      BREAK_ON_ERROR( hResult );
    }

    W2T( &pszCLSID, wszCLSID );          // W2T is defined in Globals.h
    CoTaskMemFree( wszCLSID );           // Through with wide version

    TCHAR szKey[64];                     // Build the CLSID key string CLSID\\{...}
    _tcscpy( szKey, _T("CLSID\\") );
    _tcscat( szKey, pszCLSID );

    // Add the CLSID to the registry.
    hResult = SetKeyAndValue( szKey, NULL, szFriendlyName );
    BREAK_ON_ERROR( hResult );

    // Add the server filename subkey under the CLSID key.
    hResult = SetKeyAndValue( szKey, _T("InprocServer32"), szModule );
    BREAK_ON_ERROR( hResult );

    // Set the threading model
    _tcscat( szKey, _T("\\InprocServer32") );
    hResult = SetValue( szKey, _T("ThreadingModel"), _T("Apartment") );
    BREAK_ON_ERROR( hResult );

  }while( 0 );

  CoTaskMemFree( pszCLSID );           // Through with TCHAR version

  return hResult;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | fSupportExtensions = FALSE
 | ) |  |

Definition at line 149 of file registry.cpp.

{
  HRESULT hResult = S_FALSE;
  TCHAR*  pszSnapCLSID = NULL;         // Needed for TCHAR version of the ClassID

  // If any part of this process fails, jump out of the loop and return
  // the error code
  do
  {
    // Allocate the CLSID string
    LPOLESTR wszSnapCLSID  = NULL ;
    hResult = StringFromCLSID( clsid, &wszSnapCLSID ) ;
    if( S_OK != hResult )
    {
       CoTaskMemFree( wszSnapCLSID );
       continue;
    }

    W2T( &pszSnapCLSID, wszSnapCLSID );  // W2T is defined in Globals.h
    CoTaskMemFree( wszSnapCLSID );       // Through with wide version

    // Add the Snap-in's CLSID to the registry
    hResult = SetSnapInKeyAndValue( pszSnapCLSID, NULL, _T("NameString"), szNameString );
    BREAK_ON_ERROR( hResult );

    hResult = SetSnapInKeyAndValue( pszSnapCLSID, _T("StandAlone"), NULL, NULL );
    BREAK_ON_ERROR( hResult );

    // Add registry information for ISnapinAbout if we support it
    LPOLESTR wszAboutCLSID = NULL;
    TCHAR*   pszAboutCLSID = NULL;
    if( IID_NULL != clsidAbout )
    {
      hResult = StringFromCLSID( clsidAbout, &wszAboutCLSID );
      if( S_OK != hResult )
      {
        CoTaskMemFree( wszAboutCLSID ); // Free this memory before exiting
        continue;
      }

      W2T( &pszAboutCLSID, wszAboutCLSID );
      hResult = SetSnapInKeyAndValue( pszSnapCLSID, NULL, _T("About"), pszAboutCLSID );
      CoTaskMemFree( wszAboutCLSID );
      CoTaskMemFree( pszAboutCLSID );
      BREAK_ON_ERROR( hResult );
    }

    if( TRUE == bSupportExtensions )     // Build the NodeTypesKey
    {
      hResult = SetSnapInKeyAndValue( pszSnapCLSID, _T("NodeTypes"), NULL, NULL );
      BREAK_ON_ERROR( hResult );
      TCHAR szKey[64];
      _tcscpy( szKey, pszSnapCLSID );
      _tcscat(szKey, _T("\\NodeTypes"));
      hResult = SetSnapInKeyAndValue( szKey, pszSnapCLSID, NULL, NULL );
      BREAK_ON_ERROR( hResult );
    }
  }while( 0 );

  CoTaskMemFree( pszSnapCLSID);
  return hResult;
}

HRESULT UnregisterServer ( const CLSID & clsid )

Definition at line 112 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

  MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
  _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 184 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Generated on Wed Nov 13 2024 16:53:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/multisel/resource.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • multisel
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | ID_BUTTON40001 40001
#define | ID_BUTTON40002 40002
#define | ID_BUTTON40003 40003
#define | ID_BUTTON40004 40004
#define | IDB_APPIMG_16 104
#define | IDB_APPIMG_32 101
#define | IDB_NODEIMAGES_16 106
#define | IDB_NODEIMAGES_32 107
#define | IDC_ARCHIVE_ATTR 1000
#define | IDC_BACKUP_FLAG 1005
#define | IDC_DEVNAME_EDIT 1004
#define | IDC_FLDRNAME_EDIT 1006
#define | IDC_HIDDEN_ATTR 1001
#define | IDC_LOCKED_ATTR 1002
#define | IDC_READONLY_ATTR 1003
#define | IDD_ADDDEVICE_DLG 109
#define | IDD_ADDFOLDER_DLG 114
#define | IDD_ADDVFILE_DLG 115
#define | IDD_BASE_DIALOG 108
#define | IDI_APP_ICON 105
#define | IDR_DEVICE_TOOLBAR 112
#define | IDR_STATIC_TOOLBAR 110
#define | IDR_VFILE_TOOLBAR 115

Define Documentation

#define ID_BUTTON40001 40001

Definition at line 24 of file resource.h.

#define ID_BUTTON40002 40002

Definition at line 25 of file resource.h.

#define ID_BUTTON40003 40003

Definition at line 26 of file resource.h.

#define ID_BUTTON40004 40004

Definition at line 27 of file resource.h.

#define IDB_APPIMG_16 104

Definition at line 6 of file resource.h.

#define IDB_APPIMG_32 101

Definition at line 5 of file resource.h.

#define IDB_NODEIMAGES_16 106

Definition at line 8 of file resource.h.

#define IDB_NODEIMAGES_32 107

Definition at line 9 of file resource.h.

#define IDC_ARCHIVE_ATTR 1000

Definition at line 17 of file resource.h.

#define IDC_BACKUP_FLAG 1005

Definition at line 22 of file resource.h.

#define IDC_DEVNAME_EDIT 1004

Definition at line 21 of file resource.h.

#define IDC_FLDRNAME_EDIT 1006

Definition at line 23 of file resource.h.

#define IDC_HIDDEN_ATTR 1001

Definition at line 18 of file resource.h.

#define IDC_LOCKED_ATTR 1002

Definition at line 19 of file resource.h.

#define IDC_READONLY_ATTR 1003

Definition at line 20 of file resource.h.

#define IDD_ADDDEVICE_DLG 109

Definition at line 11 of file resource.h.

#define IDD_ADDFOLDER_DLG 114

Definition at line 14 of file resource.h.

#define IDD_ADDVFILE_DLG 115

Definition at line 15 of file resource.h.

#define IDD_BASE_DIALOG 108

Definition at line 10 of file resource.h.

#define IDI_APP_ICON 105

Definition at line 7 of file resource.h.

#define IDR_DEVICE_TOOLBAR 112

Definition at line 13 of file resource.h.

#define IDR_STATIC_TOOLBAR 110

Definition at line 12 of file resource.h.

#define IDR_VFILE_TOOLBAR 115

Definition at line 16 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/multisel/staticnode.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • multisel
Defines

staticnode.cpp File Reference

#include "StaticNode.h"
#include "DeviceNode.h"
#include "CompData.h"
#include "Comp.h"
#include "AddDeviceDlg.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CStaticNode")

Define Documentation

#define MODULESTRING _T("CStaticNode")

Definition at line 25 of file staticnode.cpp.

Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/multisel/staticnode.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • multisel
Classes

staticnode.h File Reference

#include "Globals.h"
#include "BaseNode.h"
#include "LListImpl.h"
#include "LListImpl.h"

Go to the source code of this file.

Classes

class CStaticNode
Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/multisel/tracemacro.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • multisel
Functions

tracemacro.cpp File Reference

#include "Globals.h"
#include "TraceMacro.h"
#include <StdIo.h>

Go to the source code of this file.

Functions

VOID | MapEvent (LONG Event, LPTSTR szEventStr)
VOID | Trace_Event (LPCTSTR pszClass, LPCTSTR pszFunction, LONG nEvent)
VOID | Trace_HR (LPCTSTR pszClass, LPCTSTR pszFunction, HRESULT hr)
VOID | Trace_Pointer (LPCTSTR pszClass, LPCTSTR pszFunction, LPCTSTR pszObject, ULONG ulValue)
VOID | Trace_Start (LPCTSTR pszClass, LPCTSTR pszFunction)
VOID | Trace_Value (LPCTSTR pszClass, LPCTSTR pszFunction, LPCTSTR pszValueName, LONG nValue)

Function Documentation

VOID MapEvent | ( | LONG | Event,
 |  | LPTSTR | szEventStr
 | ) |  |

Definition at line 179 of file tracemacro.cpp.

{
#ifdef _DEBUG

  switch( Event )
  {
    case MMCN_ACTIVATE:
      _tcscpy( szEventStr, _T("MMCN_ACTIVATE          ") );
      break;

    case MMCN_ADD_IMAGES:
      _tcscpy( szEventStr, _T("MMCN_ADD_IMAGES        ") );
      break;

    case MMCN_BTN_CLICK:
      _tcscpy( szEventStr, _T("MMCN_BTN_CLICK         ") );
      break;

    case MMCN_CLICK:
      _tcscpy( szEventStr, _T("MMCN_CLICK             ") );
      break;

    case MMCN_COLUMN_CLICK:
      _tcscpy( szEventStr, _T("MMCN_COLUMN_CLICK       ") );
      break;

    case MMCN_CONTEXTMENU:
      _tcscpy( szEventStr, _T("MMCN_CONTEXTMENU        ") );
      break;

    case MMCN_CUTORMOVE:
      _tcscpy( szEventStr, _T("MMCN_CUTORMOVE          ") );
      break;

    case MMCN_DBLCLICK:
      _tcscpy( szEventStr, _T("MMCN_DBLCLICK           ") );
      break;

    case MMCN_DELETE:
      _tcscpy( szEventStr, _T("MMCN_DELETE             ") );
      break;

    case MMCN_DESELECT_ALL:
      _tcscpy( szEventStr, _T("MMCN_DESELECT_ALL       ") );
      break;

    case MMCN_EXPAND:
      _tcscpy( szEventStr, _T("MMCN_EXPAND             ") );
      break;

    case MMCN_HELP:
      _tcscpy( szEventStr, _T("MMCN_HELP               ") );
      break;

    case MMCN_MENU_BTNCLICK:
      _tcscpy( szEventStr, _T("MMCN_MENU_BTNCLICK      ") );
      break;

    case MMCN_MINIMIZED:
      _tcscpy( szEventStr, _T("MMCN_MINIMIZED          ") );
      break;

    case MMCN_PASTE:
      _tcscpy( szEventStr, _T("MMCN_PASTE              ") );
      break;

    case MMCN_PROPERTY_CHANGE:
      _tcscpy( szEventStr, _T("MMCN_PROPERTY_CHANGE    ") );
      break;

    case MMCN_QUERY_PASTE:
      _tcscpy( szEventStr, _T("MMCN_QUERY_PASTE        ") );
      break;

    case MMCN_REFRESH:
      _tcscpy( szEventStr, _T("MMCN_REFRESH            ") );
      break;

    case MMCN_REMOVE_CHILDREN:
      _tcscpy( szEventStr, _T("MMCN_REMOVE_CHILDREN    ") );
      break;

    case MMCN_RENAME:
      _tcscpy( szEventStr, _T("MMCN_RENAME             ") );
      break;

    case MMCN_SELECT:
      _tcscpy( szEventStr, _T("MMCN_SELECT             ") );
      break;

    case MMCN_SHOW:
      _tcscpy( szEventStr, _T("MMCN_SHOW               ") );
      break;

    case MMCN_VIEW_CHANGE:
      _tcscpy( szEventStr, _T("MMCN_VIEW_CHANGE        ") );
      break;

    case MMCN_SNAPINHELP:
      _tcscpy( szEventStr, _T("MMCN_SNAPINHELP         ") );
      break;

    case MMCN_CONTEXTHELP:
      _tcscpy( szEventStr, _T("MMCN_CONTEXTHELP        ") );
      break;

    case MMCN_INITOCX:
      _tcscpy( szEventStr, _T("MMCN_INITOCX            ") );
      break;

    // MMC Version 1.1 notifications
    case MMCN_FILTER_CHANGE:
      _tcscpy( szEventStr, _T("MMCN_FILTER_CHANGE      ") );
      break;

    case MMCN_FILTERBTN_CLICK:
      _tcscpy( szEventStr, _T("MMCN_FILTERBTN_CLICK    ") );
      break;

    case MMCN_RESTORE_VIEW:
      _tcscpy( szEventStr, _T("MMCN_RESTORE_VIEW       ") );
      break;

    case MMCN_PRINT:
      _tcscpy( szEventStr, _T("MMCN_PRINT              ") );
      break;

    case MMCN_PRELOAD:
      _tcscpy( szEventStr, _T("MMCN_PRELOAD            ") );
      break;

    case MMCN_LISTPAD:
      _tcscpy( szEventStr, _T("MMCN_LISTPAD            ") );
      break;

    case MMCN_EXPANDSYNC:
      _tcscpy( szEventStr, _T("MMCN_EXPANDSYNC         ") );
      break;

    // MMC Version 1.2 notifications
    case MMCN_COLUMNS_CHANGED:
      _tcscpy( szEventStr, _T("MMCN_COLUMNS_CHANGED    ") );
      break;

    default:
      _stprintf( szEventStr, _T("0x%X"), Event );
      break;
  }

#endif
} //end MapEvent()

VOID Trace_Event | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LONG | nEvent
 | ) |  |

Definition at line 119 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szEventStr[64];
  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Event = %s\n");
  INT    nChars     = 0;

  MapEvent( nEvent, szEventStr );

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      szEventStr
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Event()

VOID Trace_HR | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | HRESULT | hr
 | ) |  |

Definition at line 28 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Returned 0x%X\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer, szFormat, pszClass, pszFunction, hr );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_HR()

VOID Trace_Pointer | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LPCTSTR | pszObject,
 |  | ULONG | ulValue
 | ) |  |

Definition at line 86 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> %s = 0x%X\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      pszObject,
                      ulValue
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Pointer()

VOID Trace_Start | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction
 | ) |  |

Definition at line 151 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Started \n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Start()

VOID Trace_Value | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LPCTSTR | pszValueName,
 |  | LONG | nValue
 | ) |  |

Definition at line 54 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> %s = %u\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      pszValueName,
                      nValue
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Value()

Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/multisel/tracemacro.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • multisel
Defines | Functions

tracemacro.h File Reference

Go to the source code of this file.

Defines

#define | TRACE_EVENT
#define | TRACE_HRESULT
#define | TRACE_PTR
#define | TRACE_START
#define | TRACE_VAL

Functions

VOID | MapEvent (LONG Event, LPTSTR szEventStr)
VOID | Trace_Event (LPCTSTR pszClass, LPCTSTR pszFunction, LONG nEvent)
VOID | Trace_HR (LPCTSTR pszClass, LPCTSTR pszFunction, HRESULT hr)
VOID | Trace_Pointer (LPCTSTR pszClass, LPCTSTR pszFunction, LPCTSTR pszObject, ULONG ulValue)
VOID | Trace_Start (LPCTSTR pszClass, LPCTSTR pszFunction)
VOID | Trace_Value (LPCTSTR pszClass, LPCTSTR pszFunction, LPCTSTR pszValueName, LONG nValue)

Define Documentation

#define TRACE_EVENT

Definition at line 64 of file tracemacro.h.

#define TRACE_HRESULT

Definition at line 55 of file tracemacro.h.

#define TRACE_PTR

Definition at line 61 of file tracemacro.h.

#define TRACE_START

Definition at line 67 of file tracemacro.h.

#define TRACE_VAL

Definition at line 58 of file tracemacro.h.

Function Documentation

VOID MapEvent | ( | LONG | Event,
 |  | LPTSTR | szEventStr
 | ) |  |

Definition at line 146 of file tracemacro.cpp.

{
#ifdef _DEBUG

  switch( Event )
  {
    case 0x8001:
      _tcscpy( szEventStr, _T("MMCN_ACTIVATE       ") );
      break;

    case 0x8002:
      _tcscpy( szEventStr, _T("MMCN_ADD_IMAGES     ") );
      break;

    case 0x8003:
      _tcscpy( szEventStr, _T("MMCN_BTN_CLICK      ") );
      break;

    case 0x8004:
      _tcscpy( szEventStr, _T("MMCN_CLICK          ") );
      break;

    case 0x8005:
      _tcscpy( szEventStr, _T("MMCN_COLUMN_CLICK   ") );
      break;

    case 0x8006:
      _tcscpy( szEventStr, _T("MMCN_CONTEXTMENU    ") );
      break;

    case 0x8007:
      _tcscpy( szEventStr, _T("MMCN_CUTORMOVE      ") );
      break;

    case 0x8008:
      _tcscpy( szEventStr, _T("MMCN_DBLCLICK       ") );
      break;

    case 0x8009:
      _tcscpy( szEventStr, _T("MMCN_DELETE         ") );
      break;

    case 0x800A:
      _tcscpy( szEventStr, _T("MMCN_DESELECT_ALL   ") );
      break;

    case 0x800B:
      _tcscpy( szEventStr, _T("MMCN_EXPAND         ") );
      break;

    case 0x800C:
      _tcscpy( szEventStr, _T("MMCN_HELP           ") );
      break;

    case 0x800D:
      _tcscpy( szEventStr, _T("MMCN_MENU_BTNCLICK  ") );
      break;

    case 0x800E:
      _tcscpy( szEventStr, _T("MMCN_MINIMIZED      ") );
      break;

    case 0x800F:
      _tcscpy( szEventStr, _T("MMCN_PASTE          ") );
      break;

    case 0x8010:
      _tcscpy( szEventStr, _T("MMCN_PROPERTY_CHANGE") );
      break;

    case 0x8011:
      _tcscpy( szEventStr, _T("MMCN_QUERY_PASTE    ") );
      break;

    case 0x8012:
      _tcscpy( szEventStr, _T("MMCN_REFRESH        ") );
      break;

    case 0x8013:
      _tcscpy( szEventStr, _T("MMCN_REMOVE_CHILDREN") );
      break;

    case 0x8014:
      _tcscpy( szEventStr, _T("MMCN_RENAME         ") );
      break;

    case 0x8015:
      _tcscpy( szEventStr, _T("MMCN_SELECT         ") );
      break;

    case 0x8016:
      _tcscpy( szEventStr, _T("MMCN_SHOW           ") );
      break;

    case 0x8017:
      _tcscpy( szEventStr, _T("MMCN_VIEW_CHANGE    ") );
      break;

    case 0x8018:
      _tcscpy( szEventStr, _T("MMCN_SNAPINHELP     ") );
      break;

    case 0x8019:
      _tcscpy( szEventStr, _T("MMCN_CONTEXTHELP    ") );
      break;

    case 0x801A:
      _tcscpy( szEventStr, _T("MMCN_INITOCX        ") );
      break;

    case 0x8021:
      _tcscpy( szEventStr, _T("MMCN_EXPANDSYNC     ") );
      break;

    default:
      _stprintf( szEventStr, _T("0x%X"), Event );
      break;
  }

#endif
} //end MapEvent()

VOID Trace_Event | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LONG | nEvent
 | ) |  |

Definition at line 86 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szEventStr[22];
  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Event = %s\n");
  INT    nChars     = 0;

  MapEvent( nEvent, szEventStr );

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      szEventStr
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Event()

VOID Trace_HR | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | HRESULT | hr
 | ) |  |

Definition at line 27 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Returned 0x%X\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer, szFormat, pszClass, pszFunction, hr );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_HR()

VOID Trace_Pointer | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LPCTSTR | pszObject,
 |  | ULONG | ulValue
 | ) |  |

Definition at line 86 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> %s = 0x%X\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      pszAction,
                      ulValue
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Pointer()

VOID Trace_Start | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction
 | ) |  |

Definition at line 118 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Started \n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Start()

VOID Trace_Value | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LPCTSTR | pszValueName,
 |  | LONG | nValue
 | ) |  |

Definition at line 53 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> %s = %u\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      pszValueName,
                      nValue
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Value()

Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/multisel/virtualfile.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • multisel
Defines

virtualfile.cpp File Reference

#include "VirtualFile.h"
#include "FolderNode.h"
#include "Globals.h"
#include "CompData.h"
#include "Comp.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CVirtualFile")

Define Documentation

#define MODULESTRING _T("CVirtualFile")

Definition at line 25 of file virtualfile.cpp.

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/multisel/virtualfile.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • multisel
Classes

virtualfile.h File Reference

#include "Globals.h"
#include "BaseNode.h"

Go to the source code of this file.

Classes

class CVirtualFile
Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppage/about.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppage
Functions

about.cpp File Reference

#include "Globals.h"
#include "About.h"
#include "Resource.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CSnapinAbout

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 85 of file about.cpp.

{
  if( 0 == InterlockedDecrement((long*)&m_cRef) )
  {
    // we need to decrement our object count in the DLL
    delete this;
    return 0;
  }
  return m_cRef;
}

Generated on Wed Nov 13 2024 16:54:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppage/about.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppage
Classes

about.h File Reference

#include <mmc.h>

Go to the source code of this file.

Classes

class CSnapinAbout
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppage/adddevicedlg.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppage

adddevicedlg.cpp File Reference

#include "AddDeviceDlg.h"
#include "Globals.h"
#include "Resource.h"
#include "BaseNode.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppage/adddevicedlg.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppage
Classes

adddevicedlg.h File Reference

#include "BaseDialog.h"
#include "BaseDialog.h"

Go to the source code of this file.

Classes

class CAddDeviceDlg
Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppage/addvfiledlg.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppage

addvfiledlg.cpp File Reference

#include "AddVFileDlg.h"
#include "Globals.h"
#include "Resource.h"
#include "BaseNode.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppage/addvfiledlg.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppage
Classes

addvfiledlg.h File Reference

#include "BaseDialog.h"

Go to the source code of this file.

Classes

class CAddVFileDlg
Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppage/basedialog.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppage

basedialog.cpp File Reference

#include "BaseDialog.h"
#include "Globals.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppage/basedialog.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppage
Classes

basedialog.h File Reference

#include <Windows.h>

Go to the source code of this file.

Classes

class CBaseDialog
Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppage/basenode.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppage
Classes | Defines | Typedefs

basenode.h File Reference

#include "Globals.h"
#include "Resource.h"

Go to the source code of this file.

Classes

class | CBaseNode
struct | tag_BASENODE_PROPERTIES

Defines

#define | DEFAULT_RDI_MASK (RDI_STR | RDI_PARAM | RDI_IMAGE)
#define | DEFAULT_SDI_MASK (SDI_STR | SDI_PARAM | SDI_IMAGE | SDI_OPENIMAGE | SDI_PARENT | SDI_CHILDREN)
#define | MAX_NAME_LEN 64

Typedefs

typedef CBaseNode * | LPBASENODE
typedef NODE_PROPERTIES * | LPNODE_PROPERTIES
typedef struct
tag_BASENODE_PROPERTIES 		NODE_PROPERTIES

Define Documentation

#define DEFAULT_RDI_MASK (RDI_STR | RDI_PARAM | RDI_IMAGE)

Definition at line 24 of file basenode.h.

#define DEFAULT_SDI_MASK (SDI_STR | SDI_PARAM | SDI_IMAGE | SDI_OPENIMAGE | SDI_PARENT | SDI_CHILDREN)

Definition at line 23 of file basenode.h.

#define MAX_NAME_LEN 64

Definition at line 26 of file basenode.h.

Typedef Documentation

typedef CBaseNode* LPBASENODE

Definition at line 46 of file basenode.h.

typedef NODE_PROPERTIES* LPNODE_PROPERTIES

Definition at line 45 of file basenode.h.

typedef struct tag_BASENODE_PROPERTIES NODE_PROPERTIES
Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppage/basesnap.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppage
Defines | Functions

basesnap.cpp File Reference

#include <ObjBase.h>
#include <InitGuid.h>
#include "Globals.h"
#include "BaseSnap.h"
#include "CompData.h"
#include "About.h"
#include "Registry.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define | MODULESTRING _T("BaseSnap")

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)
BOOL WINAPI | DllMain (HINSTANCE hInstDLL, DWORD fdwReason, void *lpvReserved)
STDAPI | DllRegisterServer ()
STDAPI | DllUnregisterServer ()
STDMETHODIMP_ (ULONG) CClassFactory

Define Documentation

#define MODULESTRING _T("BaseSnap")

Definition at line 28 of file basesnap.cpp.

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 226 of file basesnap.cpp.

{
  if( 0 == g_uObjectCount && 0 == g_uServerLocks )
    return S_OK;
  else
    return S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 190 of file basesnap.cpp.

{
  // Test for CSnapinAbout
  if( (rclsid != CLSID_CComponentData) && (rclsid != CLSID_CSnapinAbout) )
    return CLASS_E_CLASSNOTAVAILABLE;

  if( !ppvObj )
    return E_FAIL;

  *ppvObj = NULL;

  // We can only hand out IUnknown and IClassFactory pointers.  Fail
  // if caller asks for anything else.
  if( !IsEqualIID(riid, IID_IUnknown) && !IsEqualIID(riid, IID_IClassFactory) )
    return E_NOINTERFACE;

  CClassFactory *pFactory = NULL;

  // Create the new class factory.  Pass in the type of object to create
  if( rclsid == CLSID_CComponentData )
    pFactory = new CClassFactory(CClassFactory::COMPONENTDATA);
  else if( rclsid == CLSID_CSnapinAbout )
    pFactory = new CClassFactory(CClassFactory::ABOUT);

  HRESULT hResult = pFactory->QueryInterface( riid, ppvObj );

  return hResult;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstDLL,
 |  | DWORD | fdwReason,
 |  | void * | lpvReserved
 | ) |  |

Definition at line 173 of file basesnap.cpp.

{
  if( DLL_PROCESS_ATTACH == fdwReason )
  {
     g_hInst = hInstDLL;
  }

  return TRUE;
}

STDAPI DllRegisterServer ( void )

Definition at line 236 of file basesnap.cpp.

{
  HRESULT hResult = S_FALSE;

  do
  { // Support ISnapinAbout
    hResult = RegisterServer( g_hInst, CLSID_CSnapinAbout, gtszABOUT_NAME );
    BREAK_ON_ERROR( hResult );

    hResult = RegisterServer( g_hInst, CLSID_CComponentData, gtszSNAPIN_NAME );
    BREAK_ON_ERROR( hResult );

    //XPROPPAGE:  Now support extending CVirtualFile
    hResult = RegisterSnapin( CLSID_CComponentData, gtszSNAPIN_NAME, CLSID_CSnapinAbout, TRUE );
    BREAK_ON_ERROR( hResult );

  }while( 0 );

  return hResult;
}

STDAPI DllUnregisterServer ( void )

Definition at line 259 of file basesnap.cpp.

{
  if( S_OK == UnregisterServer(CLSID_CComponentData) )
    return UnregisterSnapin(CLSID_CComponentData);
  else
    return E_FAIL;
}

STDMETHODIMP_ ( ULONG )

Definition at line 91 of file basesnap.cpp.

{
  if( 0 == InterlockedDecrement( (long*)&m_cRef) )
  {
    delete this;
    return 0;
  }
  return m_cRef;
}

Generated on Wed Nov 13 2024 16:54:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppage/basesnap.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppage
Classes | Functions

basesnap.h File Reference

Go to the source code of this file.

Classes

class | CClassFactory

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 53 of file ComSpyAudit.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 61 of file ComSpyAudit.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

Generated on Wed Nov 13 2024 16:54:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppage/comp.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppage
Defines | Functions

comp.cpp File Reference

#include "Globals.h"
#include "Comp.h"
#include "CompData.h"
#include "DataObj.h"
#include "Resource.h"
#include "StaticNode.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CComponent")

Functions

STDMETHODIMP_ (ULONG) CComponent

Define Documentation

#define MODULESTRING _T("CComponent")

Definition at line 25 of file comp.cpp.

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 98 of file comp.cpp.

{
  if( InterlockedDecrement((LONG*)&m_cRef) == 0 )
  {
    delete this;
    return 0;
  }
  return m_cRef;
}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppage/comp.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppage
Classes

comp.h File Reference

#include "Globals.h"

Go to the source code of this file.

Classes

class CComponent
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppage/compdata.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppage
Defines | Functions

compdata.cpp File Reference

#include "Globals.h"
#include "Comp.h"
#include "CompData.h"
#include "DataObj.h"
#include "Resource.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CComponentData")

Functions

STDMETHODIMP_ (ULONG) CComponentData

Define Documentation

#define MODULESTRING _T("CComponentData")

Definition at line 23 of file compdata.cpp.

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 117 of file compdata.cpp.

{
  if( InterlockedDecrement((LONG*)&m_cRef) == 0 )
  {
    delete this;
    return 0;
  }

  return m_cRef;
}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppage/compdata.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppage
Classes

compdata.h File Reference

#include "Globals.h"
#include "BaseNode.h"

Go to the source code of this file.

Classes

class CComponentData
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppage/dataobj.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppage
Defines | Functions

dataobj.cpp File Reference

#include "Globals.h"
#include "DataObj.h"
#include "StaticNode.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CDataObject")

Functions

STDMETHODIMP_ (ULONG) CDataObject

Define Documentation

#define MODULESTRING _T("CDataObject")

Definition at line 21 of file dataobj.cpp.

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 77 of file dataobj.cpp.

{
  if( InterlockedDecrement((LONG*)&m_cRef) == 0 )
  {
    delete this;
    return 0;
  }
  return m_cRef;
}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppage/dataobj.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppage
Classes

dataobj.h File Reference

#include "Globals.h"
#include "StaticNode.h"
#include "StaticNode.h"

Go to the source code of this file.

Classes

class CDataObject
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppage/devicenode.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppage
Defines

devicenode.cpp File Reference

#include "DeviceNode.h"
#include "CompData.h"
#include "Comp.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CDeviceNode")

Define Documentation

#define MODULESTRING _T("CDeviceNode")

Definition at line 23 of file devicenode.cpp.

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppage/devicenode.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppage
Classes

devicenode.h File Reference

#include "Globals.h"
#include "FolderNode.h"
#include "LListImpl.h"
#include "FolderNode.h"

Go to the source code of this file.

Classes

class CDeviceNode
Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppage/foldernode.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppage
Defines

foldernode.cpp File Reference

#include "FolderNode.h"
#include "CompData.h"
#include "Comp.h"
#include "AddVFileDlg.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CFolderNode")

Define Documentation

#define MODULESTRING _T("CFolderNode")

Definition at line 24 of file foldernode.cpp.

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppage/foldernode.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppage
Classes

foldernode.h File Reference

#include "Globals.h"
#include "BaseNode.h"
#include "VirtualFile.h"
#include "LListImpl.h"
#include "VirtualFile.h"

Go to the source code of this file.

Classes

class CFolderNode
Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppage/globals.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppage
Functions | Variables

globals.cpp File Reference

#include "Globals.h"
#include "BaseNode.h"

Go to the source code of this file.

Functions

void _fastcall | CopyT2W (LPWSTR strDest, LPCTSTR strSource, size_t count)
CBaseNode * | ExtractBaseNodePtr (LPDATAOBJECT ipDataObject)
CDataObject * | ExtractDataObjPtr (LPDATAOBJECT ipDataObject)
HRESULT | ExtractFromDataObject (LPDATAOBJECT ipDataObject, UINT cfClipFormat, ULONG nByteCount, HGLOBAL *phGlobal)
void | InitClipboardFormats ()
void _fastcall | Unicode2Ansi (CHAR **pszAnsi, WCHAR *szWide)

Variables

UINT | g_cfBaseNodePtr = 0
UINT | g_cfDataObjPtr = 0
UINT | g_cfDisplayName = 0
UINT | g_cfNodeAttrPtr = 0
UINT | g_cfNodeType = 0
UINT | g_cfSnapinClsid = 0
UINT | g_cfszNodeType = 0
HINSTANCE | g_hInst = NULL
ULONG | g_uObjectCount = 0
ULONG | g_uServerLocks = 0

Function Documentation

void _fastcall CopyT2W | ( | LPWSTR | strDest,
 |  | LPCTSTR | strSource,
 |  | size_t | count
 | ) |  |

Definition at line 68 of file globals.cpp.

{
#ifndef _UNICODE

  MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, strSource, -1, strDest, count );

#else

  wcsncpy( strDest, strSource, count );

#endif

  if ( count > 0 )
    strDest[ count - 1 ] = 0;
}

CBaseNode* ExtractBaseNodePtr ( LPDATAOBJECT ipDataObject )

Definition at line 158 of file globals.cpp.

{
  LPBASENODE  pNode   = NULL;
  HGLOBAL     hGlobal = NULL;
  HRESULT     hResult = S_FALSE;

  hResult = ExtractFromDataObject( ipDataObject,
                                   g_cfBaseNodePtr,
                                   sizeof(LPBASENODE),
                                   &hGlobal
                                 );
  if( SUCCEEDED(hResult) )
  {
    pNode = *(LPBASENODE*)(hGlobal);
    HGLOBAL hRetVal = GlobalFree(hGlobal);
    _ASSERT( NULL == hRetVal );        // Must return NULL
  }

  return pNode;

}

CDataObject* ExtractDataObjPtr ( LPDATAOBJECT ipDataObject )

Definition at line 187 of file globals.cpp.

{
  _ASSERT( 0 != g_cfDataObjPtr );

  HGLOBAL      hGlobal = NULL;
  HRESULT      hResult = S_OK;
  CDataObject* pDO     = NULL;

  hResult = ExtractFromDataObject( ipDataObject,
                                   g_cfDataObjPtr,
                                   sizeof(CDataObject **),
                                   &hGlobal
                                 );

  if( SUCCEEDED(hResult) )
  {
    pDO = *(CDataObject **)(hGlobal);
    _ASSERT( NULL != pDO );

    HGLOBAL hRetVal = GlobalFree(hGlobal);
    _ASSERT( NULL == hRetVal );       // Must return NULL
  }

  return pDO;

}

HRESULT ExtractFromDataObject | ( | LPDATAOBJECT | ipDataObject,
 |  | UINT | cfClipFormat,
 |  | ULONG | nByteCount,
 |  | HGLOBAL * | phGlobal
 | ) |  |

Definition at line 106 of file globals.cpp.

{
  _ASSERT( NULL != ipDataObject );

            *phGlobal = NULL;
  HRESULT   hResult   = S_FALSE;
  STGMEDIUM StgMedium = { TYMED_HGLOBAL,  NULL  };
  FORMATETC FormatEtc = { cfClipFormat, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };

  do
  {
    // Allocate memory for the stream
    StgMedium.hGlobal = ::GlobalAlloc( GMEM_SHARE, nByteCount );

    if( NULL == StgMedium.hGlobal )
    {
      hResult = E_OUTOFMEMORY;
      break;
    }

    // Attempt to get data from the object
    hResult = ipDataObject->GetDataHere( &FormatEtc, &StgMedium );
    if( FAILED(hResult) )
    {
      break;
    }
    // StgMedium now has the data we need
    *phGlobal = StgMedium.hGlobal;
    StgMedium.hGlobal = NULL;

  } while (0);

  if( FAILED(hResult) && StgMedium.hGlobal )
  {
    HGLOBAL hRetVal = ::GlobalFree(StgMedium.hGlobal);
    _ASSERT( NULL == hRetVal );         // Must return NULL
  }
  return hResult;

}

void InitClipboardFormats ( )

Definition at line 87 of file globals.cpp.

{
  g_cfDisplayName  = RegisterClipboardFormat( T_CCF_DISPLAY_NAME );
  g_cfNodeType     = RegisterClipboardFormat( T_CCF_NODETYPE );
  g_cfszNodeType   = RegisterClipboardFormat( T_CCF_SZNODETYPE );
  g_cfSnapinClsid  = RegisterClipboardFormat( T_CCF_SNAPIN_CLASSID );

  g_cfBaseNodePtr  = RegisterClipboardFormat( T_CCF_BASENODE_PTR );
  g_cfDataObjPtr   = RegisterClipboardFormat( T_CCF_DATAOBJ_PTR );

  //XPROPPAGE:  Register the clipformat
  g_cfNodeAttrPtr  = RegisterClipboardFormat( T_CCF_ATTRIB_PTR );

}

void _fastcall Unicode2Ansi | ( | CHAR ** | pszAnsi,
 |  | WCHAR * | szWide
 | ) |  |

Definition at line 49 of file globals.cpp.

{
  LONG nLen = wcslen( szWide ) +1;
  *pszAnsi = (char*)CoTaskMemAlloc( nLen );
  char* pCounter = *pszAnsi;

  while( *szWide )
  {
    *pCounter = LOBYTE(*szWide);
    pCounter++;
    szWide++;
  }
  *pCounter = NULL;
}

Variable Documentation

UINT g_cfBaseNodePtr = 0

Definition at line 28 of file globals.cpp.

UINT g_cfDataObjPtr = 0

Definition at line 29 of file globals.cpp.

UINT g_cfDisplayName = 0

Definition at line 20 of file globals.cpp.

UINT g_cfNodeAttrPtr = 0

Definition at line 34 of file globals.cpp.

UINT g_cfNodeType = 0

Definition at line 21 of file globals.cpp.

UINT g_cfSnapinClsid = 0

Definition at line 23 of file globals.cpp.

UINT g_cfszNodeType = 0

Definition at line 22 of file globals.cpp.

HINSTANCE g_hInst = NULL

Definition at line 38 of file globals.cpp.

ULONG g_uObjectCount = 0

Definition at line 39 of file globals.cpp.

ULONG g_uServerLocks = 0

Definition at line 40 of file globals.cpp.

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppage/globals.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppage
Classes | Defines | Typedefs | Functions | Variables

globals.h File Reference

#include <TChar.h>
#include <Mmc.h>
#include <CrtDbg.h>
#include "Guids.h"
#include "Guids.h"

Go to the source code of this file.

Classes

struct | _tag_NODE_ATTRIB_

Defines

#define | ATTRIBUTE_BACKUP_DEVICE 32
#define | ATTRIBUTE_DATA_ARCHIVE 2
#define | ATTRIBUTE_DATA_HIDDEN 4
#define | ATTRIBUTE_DATA_LOCKED 8
#define | ATTRIBUTE_DATA_READONLY 16
#define | BREAK_ON_ERROR(hResult) if( S_OK != hResult ) continue
#define | BYTE_SIZE(string) ((_tcslen(string)+1) * sizeof(TCHAR))
#define | IDM_NEW_DEVICE 100
#define | IDM_NEW_FOLDER 200
#define | IDM_NEW_VIRTFILE 400
#define | IDM_TOGGLE_STATUS 300
#define | IMG_CDROM_DEFAULT 6
#define | IMG_DATA_FILE 2
#define | IMG_DEVICE_DEFAULT 0
#define | IMG_DEVICE_OFFLINE 1
#define | IMG_DRIVE_DEFAULT 3
#define | IMG_DRIVE_OFFLINE 4
#define | IMG_FOLDER_DEFAULT 5
#define | IMG_REMOVABLE_MEDIA 7
#define | MAX_OBJECT_PATH 255
#define | MsgBox(wszMsg, wszTitle) ::MessageBox(NULL, wszMsg, wszTitle, MB_OK)
#define | NODETYPE_DEVICE 200
#define | NODETYPE_FOLDER 300
#define | NODETYPE_STATIC 100
#define | NODETYPE_VFILE 400
#define | REQUEST_ICONSOLE 1001
#define | REQUEST_ICONSOLENAMESPACE2 1000
#define | REQUEST_ICONSOLEVERB 1002
#define | REQUEST_IHEADERCTRL 1004
#define | REQUEST_IRESULTDATA 1003
#define | STATUS_OFFLINE 0
#define | STATUS_ONLINE 1
#define | T_CCF_ATTRIB_PTR _T("CCF_ATTRIB_PTR")
#define | T_CCF_BASENODE_PTR _T("CCF_BASENODE_PTR")
#define | T_CCF_DATAOBJ_PTR _T("CCF_DATAOBJ_PTR")
#define | T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")
#define | T_CCF_NODETYPE _T("CCF_NODETYPE")
#define | T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")
#define | T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")
#define | W2T(szAnsiPtr, szWide) Unicode2Ansi( szAnsiPtr, szWide )
#define | WM_ADD_DEVICENODE (WM_USER + 101)
#define | WM_ADD_VIRTUALFILE (WM_USER + 103)
#define | WM_DEL_DEVICENODES (WM_USER + 100)
#define | WM_DEVICENODE_CLOSED (WM_USER + 102)
#define | WM_VIRTUALFILE_CLOSED (WM_USER + 104)

Typedefs

typedef struct _tag_NODE_ATTRIB_ | NODE_ATTRIBS

Functions

void _fastcall | CopyT2W (LPWSTR strDest, LPCTSTR strSource, size_t count)
CBaseNode * | ExtractBaseNodePtr (LPDATAOBJECT ipDataObject)
CDataObject * | ExtractDataObjPtr (LPDATAOBJECT ipDataObject)
HRESULT | ExtractFromDataObject (LPDATAOBJECT ipDataObject, UINT cf, ULONG cb, HGLOBAL *phGlobal)
void | InitClipboardFormats ()
template<class TYPE >
void | SAFE_FREE_BITMAP (TYPE *&pObj)
template<class TYPE >
void | SAFE_FREE_ICON (TYPE *&pObj)
template<class TYPE >
void | SAFE_RELEASE (TYPE *&pObj)
void _fastcall | Unicode2Ansi (CHAR **pszAnsi, WCHAR *szWide)

Variables

UINT g_cfBaseNodePtr
UINT g_cfDataObjPtr
UINT g_cfDisplayName
UINT g_cfNodeAttrPtr
UINT g_cfNodeType
UINT g_cfSnapinClsid
UINT g_cfszNodeType
HINSTANCE | g_hInst
ULONG g_uObjectCount
ULONG g_uServerLocks

Define Documentation

#define ATTRIBUTE_BACKUP_DEVICE 32

Definition at line 115 of file globals.h.

#define ATTRIBUTE_DATA_ARCHIVE 2

Definition at line 111 of file globals.h.

#define ATTRIBUTE_DATA_HIDDEN 4

Definition at line 112 of file globals.h.

#define ATTRIBUTE_DATA_LOCKED 8

Definition at line 113 of file globals.h.

#define ATTRIBUTE_DATA_READONLY 16

Definition at line 114 of file globals.h.

#define BREAK_ON_ERROR ( hResult ) if( S_OK != hResult ) continue

Definition at line 160 of file globals.h.

#define BYTE_SIZE ( string ) ((_tcslen(string)+1) * sizeof(TCHAR))

Definition at line 158 of file globals.h.

#define IDM_NEW_DEVICE 100

Definition at line 127 of file globals.h.

#define IDM_NEW_FOLDER 200

Definition at line 128 of file globals.h.

#define IDM_NEW_VIRTFILE 400

Definition at line 130 of file globals.h.

#define IDM_TOGGLE_STATUS 300

Definition at line 129 of file globals.h.

#define IMG_CDROM_DEFAULT 6

Definition at line 124 of file globals.h.

#define IMG_DATA_FILE 2

Definition at line 120 of file globals.h.

#define IMG_DEVICE_DEFAULT 0

Definition at line 118 of file globals.h.

#define IMG_DEVICE_OFFLINE 1

Definition at line 119 of file globals.h.

#define IMG_DRIVE_DEFAULT 3

Definition at line 121 of file globals.h.

#define IMG_DRIVE_OFFLINE 4

Definition at line 122 of file globals.h.

#define IMG_FOLDER_DEFAULT 5

Definition at line 123 of file globals.h.

#define IMG_REMOVABLE_MEDIA 7

Definition at line 125 of file globals.h.

#define MAX_OBJECT_PATH 255

Definition at line 92 of file globals.h.

#define MsgBox | ( | wszMsg,
 |  | wszTitle |
 | ) |  | ::MessageBox(NULL, wszMsg, wszTitle, MB_OK)

Definition at line 163 of file globals.h.

#define NODETYPE_DEVICE 200

Definition at line 106 of file globals.h.

#define NODETYPE_FOLDER 300

Definition at line 107 of file globals.h.

#define NODETYPE_STATIC 100

Definition at line 105 of file globals.h.

#define NODETYPE_VFILE 400

Definition at line 108 of file globals.h.

#define REQUEST_ICONSOLE 1001

Definition at line 149 of file globals.h.

#define REQUEST_ICONSOLENAMESPACE2 1000

Definition at line 148 of file globals.h.

#define REQUEST_ICONSOLEVERB 1002

Definition at line 150 of file globals.h.

#define REQUEST_IHEADERCTRL 1004

Definition at line 152 of file globals.h.

#define REQUEST_IRESULTDATA 1003

Definition at line 151 of file globals.h.

#define STATUS_OFFLINE 0

Definition at line 133 of file globals.h.

#define STATUS_ONLINE 1

Definition at line 132 of file globals.h.

#define T_CCF_ATTRIB_PTR _T("CCF_ATTRIB_PTR")

Definition at line 90 of file globals.h.

#define T_CCF_BASENODE_PTR _T("CCF_BASENODE_PTR")

Definition at line 86 of file globals.h.

#define T_CCF_DATAOBJ_PTR _T("CCF_DATAOBJ_PTR")

Definition at line 87 of file globals.h.

#define T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")

Definition at line 81 of file globals.h.

#define T_CCF_NODETYPE _T("CCF_NODETYPE")

Definition at line 82 of file globals.h.

#define T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")

Definition at line 84 of file globals.h.

#define T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")

Definition at line 83 of file globals.h.

#define W2T | ( | szAnsiPtr,
 |  | szWide |
 | ) |  | Unicode2Ansi( szAnsiPtr, szWide )

Definition at line 218 of file globals.h.

#define WM_ADD_DEVICENODE (WM_USER + 101)

Definition at line 139 of file globals.h.

#define WM_ADD_VIRTUALFILE (WM_USER + 103)

Definition at line 141 of file globals.h.

#define WM_DEL_DEVICENODES (WM_USER + 100)

Definition at line 138 of file globals.h.

#define WM_DEVICENODE_CLOSED (WM_USER + 102)

Definition at line 140 of file globals.h.

#define WM_VIRTUALFILE_CLOSED (WM_USER + 104)

Definition at line 142 of file globals.h.

Typedef Documentation

typedef struct _tag_NODE_ATTRIB_ NODE_ATTRIBS

Function Documentation

void _fastcall CopyT2W | ( | LPWSTR | strDest,
 |  | LPCTSTR | strSource,
 |  | size_t | count
 | ) |  |

Definition at line 64 of file globals.cpp.

{
#ifndef _UNICODE

  MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, strSource, -1, strDest, count );

#else

  wcsncpy( strDest, strSource, count );

#endif

  if ( count > 0 )
    strDest[ count - 1 ] = 0;
}

CBaseNode* ExtractBaseNodePtr ( LPDATAOBJECT ipDataObject )

Definition at line 150 of file globals.cpp.

{
  LPBASENODE  pNode   = NULL;
  HGLOBAL     hGlobal = NULL;
  HRESULT     hResult = S_FALSE;

  hResult = ExtractFromDataObject( ipDataObject,
                                   g_cfBaseNodePtr,
                                   sizeof(LPBASENODE),
                                   &hGlobal
                                 );
  if( SUCCEEDED(hResult) )
  {
    pNode = *(LPBASENODE*)(hGlobal);
    HGLOBAL hRetVal = GlobalFree(hGlobal);
    _ASSERT( NULL == hRetVal );        // Must return NULL
  }

  return pNode;

}

CDataObject* ExtractDataObjPtr ( LPDATAOBJECT ipDataObject )

Definition at line 179 of file globals.cpp.

{
  _ASSERT( 0 != g_cfDataObjPtr );

  HGLOBAL      hGlobal = NULL;
  HRESULT      hResult = S_OK;
  CDataObject* pDO     = NULL;

  hResult = ExtractFromDataObject( ipDataObject,
                                   g_cfDataObjPtr,
                                   sizeof(CDataObject **),
                                   &hGlobal
                                 );

  if( SUCCEEDED(hResult) )
  {
    pDO = *(CDataObject **)(hGlobal);
    _ASSERT( NULL != pDO );

    HGLOBAL hRetVal = GlobalFree(hGlobal);
    _ASSERT( NULL == hRetVal );       // Must return NULL
  }

  return pDO;

}

HRESULT ExtractFromDataObject | ( | LPDATAOBJECT | ipDataObject,
 |  | UINT | cf,
 |  | ULONG | cb,
 |  | HGLOBAL * | phGlobal
 | ) |  |

Definition at line 98 of file globals.cpp.

{
  _ASSERT( NULL != ipDataObject );

            *phGlobal = NULL;
  HRESULT   hResult   = S_FALSE;
  STGMEDIUM StgMedium = { TYMED_HGLOBAL,  NULL  };
  FORMATETC FormatEtc = { cfClipFormat, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };

  do
  {
    // Allocate memory for the stream
    StgMedium.hGlobal = ::GlobalAlloc( GMEM_SHARE, nByteCount );

    if( NULL == StgMedium.hGlobal )
    {
      hResult = E_OUTOFMEMORY;
      break;
    }

    // Attempt to get data from the object
    hResult = ipDataObject->GetDataHere( &FormatEtc, &StgMedium );
    if( FAILED(hResult) )
    {
      break;
    }
    // StgMedium now has the data we need
    *phGlobal = StgMedium.hGlobal;
    StgMedium.hGlobal = NULL;

  } while (0);

  if( FAILED(hResult) && StgMedium.hGlobal )
  {
    HGLOBAL hRetVal = ::GlobalFree(StgMedium.hGlobal);
    _ASSERT( NULL == hRetVal );         // Must return NULL
  }
  return hResult;

}

void InitClipboardFormats ( )

Definition at line 56 of file globals.cpp.

{
  g_cfDisplayName  = RegisterClipboardFormat( T_CCF_DISPLAY_NAME );
  g_cfNodeType     = RegisterClipboardFormat( T_CCF_NODETYPE );
  g_cfszNodeType   = RegisterClipboardFormat( T_CCF_SZNODETYPE );
  g_cfSnapinClsid  = RegisterClipboardFormat( T_CCF_SNAPIN_CLASSID );

}

template<class TYPE >
void SAFE_FREE_BITMAP ( TYPE *& pObj ) [inline]

Definition at line 183 of file globals.h.

{
  if( NULL != pObj )
  {
    BOOL bStatus = DeleteObject( pObj );
    pObj = NULL;
  }
  else
  {
    OutputDebugString(_T("Attempted to delete NULL Bitmap handle.\n"));
  }
}

template<class TYPE >
void SAFE_FREE_ICON ( TYPE *& pObj ) [inline]

Definition at line 198 of file globals.h.

{
  if( NULL != pObj )
  {
    BOOL bStatus = DestroyIcon( pObj );
    pObj = NULL;
  }
  else
  {
    OutputDebugString(_T("Attempted to delete NULL Icon handle.\n"));
  }
}

template<class TYPE >
void SAFE_RELEASE ( TYPE *& pObj ) [inline]

Definition at line 168 of file globals.h.

{
  if( NULL != pObj )
  {
    pObj->Release();
    pObj = NULL;
  }
  else
  {
    OutputDebugString(_T("Attempted to release NULL Com pointer.\n"));
  }
}

void _fastcall Unicode2Ansi | ( | CHAR ** | pszAnsi,
 |  | WCHAR * | szWide
 | ) |  |

Definition at line 38 of file globals.cpp.

{
  LONG nLen = wcslen( szWide ) +1;
  *pszAnsi = (char*)CoTaskMemAlloc( nLen );
  char* pCounter = *pszAnsi;

  while( *szWide )
  {
    *pCounter = LOBYTE(*szWide);
    pCounter++;
    szWide++;
  }
  *pCounter = NULL;
}

Variable Documentation

UINT g_cfBaseNodePtr

Definition at line 28 of file globals.cpp.

UINT g_cfDataObjPtr

Definition at line 29 of file globals.cpp.

UINT g_cfDisplayName

Definition at line 19 of file globals.cpp.

UINT g_cfNodeAttrPtr

Definition at line 34 of file globals.cpp.

UINT g_cfNodeType

Definition at line 20 of file globals.cpp.

UINT g_cfSnapinClsid

Definition at line 22 of file globals.cpp.

UINT g_cfszNodeType

Definition at line 21 of file globals.cpp.

HINSTANCE g_hInst

Definition at line 62 of file DoServer.Cpp.

ULONG g_uObjectCount

Definition at line 28 of file globals.cpp.

ULONG g_uServerLocks

Definition at line 29 of file globals.cpp.

Generated on Wed Nov 13 2024 16:54:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppage/guids.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppage
Functions

guids.h File Reference

Go to the source code of this file.

Functions

DEFINE_GUID (CLSID_CComponentData, 0xf321bdf7, 0xb850, 0x427d, 0x80, 0x62, 0x5d, 0xf8, 0x9c, 0x1b, 0xb6, 0x88)
DEFINE_GUID (CLSID_CVirtualFile, 0xf0091c49, 0xc869, 0x4941, 0xa8, 0x1c, 0xc7, 0x19, 0xad, 0x81, 0x74, 0xcc)
DEFINE_GUID (CLSID_CFolderNode, 0x520F23fA, 0x775D, 0x4015, 0xb4, 0x37, 0x98, 0xA2, 0x4B, 0x9D, 0x8, 0x5E)
DEFINE_GUID (CLSID_DeviceNode, 0x520F23f9, 0x775D, 0x4015, 0xB4, 0x37, 0x98, 0xA2, 0x4B, 0x9D, 0x8, 0x5E)
DEFINE_GUID (CLSID_CSnapinAbout, 0x64de9ae8, 0xf74b, 0x48c5, 0x98, 0x74, 0x03, 0x08, 0xc1, 0xad, 0xd5, 0xd7)

Function Documentation

DEFINE_GUID | ( | CLSID_CComponentData | ,
 |  | 0xf321bdf7 | ,
 |  | 0xb850 | ,
 |  | 0x427d | ,
 |  | 0x80 | ,
 |  | 0x62 | ,
 |  | 0x5d | ,
 |  | 0xf8 | ,
 |  | 0x9c | ,
 |  | 0x1b | ,
 |  | 0xb6 | ,
 |  | 0x88 |
 | ) |  |
DEFINE_GUID | ( | CLSID_CVirtualFile | ,
 |  | 0xf0091c49 | ,
 |  | 0xc869 | ,
 |  | 0x4941 | ,
 |  | 0xa8 | ,
 |  | 0x1c | ,
 |  | 0xc7 | ,
 |  | 0x19 | ,
 |  | 0xad | ,
 |  | 0x81 | ,
 |  | 0x74 | ,
 |  | 0xcc |
 | ) |  |
DEFINE_GUID | ( | CLSID_CFolderNode | ,
 |  | 0x520F23fA | ,
 |  | 0x775D | ,
 |  | 0x4015 | ,
 |  | 0xb4 | ,
 |  | 0x37 | ,
 |  | 0x98 | ,
 |  | 0xA2 | ,
 |  | 0x4B | ,
 |  | 0x9D | ,
 |  | 0x8 | ,
 |  | 0x5E |
 | ) |  |
DEFINE_GUID | ( | CLSID_DeviceNode | ,
 |  | 0x520F23f9 | ,
 |  | 0x775D | ,
 |  | 0x4015 | ,
 |  | 0xB4 | ,
 |  | 0x37 | ,
 |  | 0x98 | ,
 |  | 0xA2 | ,
 |  | 0x4B | ,
 |  | 0x9D | ,
 |  | 0x8 | ,
 |  | 0x5E |
 | ) |  |
DEFINE_GUID | ( | CLSID_CSnapinAbout | ,
 |  | 0x64de9ae8 | ,
 |  | 0xf74b | ,
 |  | 0x48c5 | ,
 |  | 0x98 | ,
 |  | 0x74 | ,
 |  | 0x03 | ,
 |  | 0x08 | ,
 |  | 0xc1 | ,
 |  | 0xad | ,
 |  | 0xd5 | ,
 |  | 0xd7 |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppage/llistimpl.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppage
Functions

llistimpl.cpp File Reference

#include "LListImpl.h"

Go to the source code of this file.

Functions

BOOL IsValidAddress (const void *lp, UINT nBytes, BOOL bReadWrite)

Function Documentation

BOOL IsValidAddress | ( | const void * | lp,
 |  | UINT | nBytes,
 |  | BOOL | bReadWrite
 | ) |  |

Definition at line 53 of file llistimpl.cpp.

{
  // Simple version using Win-32 APIs for pointer validation.
  return (lp != NULL && !IsBadReadPtr(lp, nBytes) &&
         (!bReadWrite || !IsBadWritePtr((LPVOID)lp, nBytes)));

} //end IsValidAddress()

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppage/llistimpl.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppage
Classes | Typedefs | Functions

llistimpl.h File Reference

#include <CrtDbg.h>
#include <Windows.h>
#include <new.h>

Go to the source code of this file.

Classes

struct | __POSITION
class | CLListImpl< TYPE, ARG_TYPE >
struct | CLListImpl< TYPE, ARG_TYPE >::CNode
struct | CPlex

Typedefs

typedef __POSITION * | POSITION

Functions

BOOL | IsValidAddress (const void *lp, UINT nBytes, BOOL bReadWrite=TRUE)

Typedef Documentation

typedef __POSITION* POSITION

Definition at line 31 of file llistimpl.h.

Function Documentation

BOOL IsValidAddress | ( | const void * | lp,
 |  | UINT | nBytes,
 |  | BOOL | bReadWrite = TRUE
 | ) |  |

Definition at line 53 of file llistimpl.cpp.

{
  // Simple version using Win-32 APIs for pointer validation.
  return (lp != NULL && !IsBadReadPtr(lp, nBytes) &&
         (!bReadWrite || !IsBadWritePtr((LPVOID)lp, nBytes)));

} //end IsValidAddress()

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppage/registry.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppage
Defines | Functions

registry.cpp File Reference

#include <ObjBase.h>
#include "Registry.h"
#include "Globals.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define | MODULESTRING _T("Registry")

Functions

HRESULT | RecursiveDeleteKey (HKEY hKeyParent, const TCHAR *szKeyChild)
HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const TCHAR *szNameString, const CLSID &clsidAbout, const BOOL bSupportExtensions)
HRESULT | SetKeyAndValue (const TCHAR *pszPath, const TCHAR *szSubkey, const TCHAR *szValue)
HRESULT | SetNodeTypesKey (const TCHAR *szNodeGuid)
HRESULT | SetSnapInKeyAndValue (const TCHAR *szKey, const TCHAR *szSubkey, const TCHAR *szName, const TCHAR *szValue)
HRESULT | SetValue (const TCHAR *szKey, const TCHAR *szValueName, const TCHAR *szValue)
LONG | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Define Documentation

#define MODULESTRING _T("Registry")

Definition at line 22 of file registry.cpp.

Function Documentation

HRESULT RecursiveDeleteKey | ( | HKEY | hKeyParent,
 |  | const TCHAR * | szKeyChild
 | ) |  |

Definition at line 272 of file registry.cpp.

{
  // Open the child.
  HKEY hKeyChild = NULL;
  LONG lResult   = ERROR_SUCCESS;

  do                     // We go to all this trouble to prevent any
  {                      // possibility of exiting while leaving a key open

    lResult = RegOpenKeyEx( hKeyParent,
                            lpszKeyChild,
                            0,
                            KEY_ALL_ACCESS,
                            &hKeyChild
                          );
    if( ERROR_SUCCESS != lResult )
      continue;

    // Enumerate all of the decendents of this child.
    FILETIME time;
    _TCHAR szBuffer[256];
    DWORD dwSize = 256;
    while( S_OK == RegEnumKeyEx(hKeyChild,0,szBuffer,&dwSize,NULL,NULL,NULL,&time) )
    {
      // Delete the decendents of this child.
      lResult = RecursiveDeleteKey( hKeyChild, szBuffer );
      if( ERROR_SUCCESS != lResult )
      {
        continue;
      }
      dwSize = 256;
    }
  }while( 0 );

  RegCloseKey( hKeyChild );            // Always try to close the child
                                       // then delete this child.
  return RegDeleteKey( hKeyParent, lpszKeyChild );
}

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const TCHAR * | szFriendlyName
 | ) |  |

Definition at line 53 of file registry.cpp.

{
  // Get server location.
  TCHAR    szModule[512] ;
  TCHAR*   pszCLSID = NULL;
  LPOLESTR wszCLSID = NULL ;
  HRESULT  hResult  = S_FALSE;

  DWORD dwResult = ::GetModuleFileName( hModule,
                                        szModule,
                                        sizeof(szModule)/sizeof(TCHAR)
                                      );
  if( 0 == dwResult ) return HRESULT_FROM_WIN32( dwResult );

  do                         // Fail unless we complete everything
  {
    // Get CLSID string in wide char
    hResult = StringFromCLSID( clsid, &wszCLSID ) ;
    if( S_OK != hResult )
    {
      CoTaskMemFree( wszCLSID );
      BREAK_ON_ERROR( hResult );
    }

    W2T( &pszCLSID, wszCLSID );          // W2T is defined in Globals.h
    CoTaskMemFree( wszCLSID );           // Through with wide version

    TCHAR szKey[64];                     // Build the CLSID key string CLSID\\{...}
    _tcscpy( szKey, _T("CLSID\\") );
    _tcscat( szKey, pszCLSID );

    // Add the CLSID to the registry.
    hResult = SetKeyAndValue( szKey, NULL, szFriendlyName );
    BREAK_ON_ERROR( hResult );

    // Add the server filename subkey under the CLSID key.
    hResult = SetKeyAndValue( szKey, _T("InprocServer32"), szModule );
    BREAK_ON_ERROR( hResult );

    // Set the threading model
    _tcscat( szKey, _T("\\InprocServer32") );
    hResult = SetValue( szKey, _T("ThreadingModel"), _T("Apartment") );
    BREAK_ON_ERROR( hResult );

  }while( 0 );

  CoTaskMemFree( pszCLSID );           // Through with TCHAR version

  return hResult;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | bSupportExtensions
 | ) |  |

Definition at line 151 of file registry.cpp.

{
  HRESULT hResult = S_FALSE;
  TCHAR*  pszSnapCLSID = NULL;         // Needed for TCHAR version of the ClassID

  // If any part of this process fails, jump out of the loop and return
  // the error code
  do
  {
    // Allocate the CLSID string
    LPOLESTR wszSnapCLSID  = NULL ;
    hResult = StringFromCLSID( clsid, &wszSnapCLSID ) ;
    if( S_OK != hResult )
    {
       CoTaskMemFree( wszSnapCLSID );
       continue;
    }

    W2T( &pszSnapCLSID, wszSnapCLSID );  // W2T is defined in Globals.h
    CoTaskMemFree( wszSnapCLSID );       // Through with wide version

    // Add the Snap-in's CLSID to the registry
    hResult = SetSnapInKeyAndValue( pszSnapCLSID, NULL, _T("NameString"), szNameString );
    BREAK_ON_ERROR( hResult );

    hResult = SetSnapInKeyAndValue( pszSnapCLSID, _T("StandAlone"), NULL, NULL );
    BREAK_ON_ERROR( hResult );

    // Add registry information for ISnapinAbout if we support it
    LPOLESTR wszAboutCLSID = NULL;
    TCHAR*   pszAboutCLSID = NULL;
    if( IID_NULL != clsidAbout )
    {
      hResult = StringFromCLSID( clsidAbout, &wszAboutCLSID );
      if( S_OK != hResult )
      {
        CoTaskMemFree( wszAboutCLSID ); // Free this memory before exiting
        continue;
      }

      W2T( &pszAboutCLSID, wszAboutCLSID );
      hResult = SetSnapInKeyAndValue( pszSnapCLSID, NULL, _T("About"), pszAboutCLSID );
      CoTaskMemFree( wszAboutCLSID );
      CoTaskMemFree( pszAboutCLSID );
      BREAK_ON_ERROR( hResult );
    }

    //XPROPPAGE: Adding support for extending CVirtualFile
    //
    if( TRUE == bSupportExtensions )     // Build the NodeTypesKey
    {
      // First add the NodeTypes key under the Snapin key, along with the
      // the GUID to the node which we will allow to be extended.
      hResult = SetSnapInKeyAndValue( pszSnapCLSID, _T("NodeTypes"), NULL, NULL );
      BREAK_ON_ERROR( hResult );
      TCHAR szKey[64];
      _tcscpy( szKey, pszSnapCLSID );
      _tcscat(szKey, _T("\\NodeTypes"));
      hResult = SetSnapInKeyAndValue( szKey, gtszVFILE_GUID, NULL, NULL );
      BREAK_ON_ERROR( hResult );

      // Add the GUID for the nodes which will allow to be extended under MMC/NodeTypes
      hResult = SetNodeTypesKey( gtszVFILE_GUID );

    }
  }while( 0 );

  CoTaskMemFree( pszSnapCLSID);
  return hResult;
}

HRESULT SetKeyAndValue | ( | const TCHAR * | pszPath,
 |  | const TCHAR * | szSubkey,
 |  | const TCHAR * | szValue
 | ) |  |

Definition at line 320 of file registry.cpp.

{
  HKEY hKey = NULL;
  HRESULT hResult = S_FALSE;
  TCHAR szKeyBuf[1024];

  // Copy keyname into buffer.
  _tcscpy( szKeyBuf, szKey );

  // Add subkey name to buffer.
  if( NULL != szSubkey )
  {
    _tcscat( szKeyBuf, _T("\\") );
    _tcscat( szKeyBuf, szSubkey );
  }

  do                     // We go to all this trouble to prevent any
  {                      // possibility of exiting while leaving a key open

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx( HKEY_CLASSES_ROOT,
                                   szKeyBuf,
                                   0,
                                   NULL,
                                   REG_OPTION_NON_VOLATILE,
                                   KEY_ALL_ACCESS,
                                   NULL,
                                   &hKey,
                                   NULL
                                 );
    if( ERROR_SUCCESS != lResult )
    {
      hResult = HRESULT_FROM_WIN32( lResult );
      continue;
    }

    if( NULL != szValue )    // Now set the value
    {
      hResult = RegSetValueEx( hKey,
                               NULL,
                               0,
                               REG_SZ,
                               (BYTE*)szValue,
                               BYTE_SIZE( szValue )    // BYTE_SIZE is in Globals.h
                             );
      BREAK_ON_ERROR( hResult );
    }
  }while( 0 );

  RegCloseKey( hKey );       // Always try to close the key
  return hResult;
}

HRESULT SetNodeTypesKey ( const TCHAR * szNodeGuid )

Definition at line 507 of file registry.cpp.

{
  HKEY    hKey = NULL;
  TCHAR   szKeyBuf[1024];

  // Load the buffer with the Snap-In Location
  _tcscpy( szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\NodeTypes") );
  _tcscat( szKeyBuf, _T("\\") );       // Copy keyname into buffer.
  _tcscat( szKeyBuf, szNodeGuid );

  // Create and open key.
  long lResult = RegCreateKeyEx( HKEY_LOCAL_MACHINE,
                                 szKeyBuf,
                                 0,
                                 NULL,
                                 REG_OPTION_NON_VOLATILE,
                                 KEY_ALL_ACCESS,
                                 NULL,
                                 &hKey,
                                 NULL
                               );

  RegCloseKey( hKey );       //Always close the key
  return (ERROR_SUCCESS == lResult) ? S_OK : S_FALSE;

}

HRESULT SetSnapInKeyAndValue | ( | const TCHAR * | szKey,
 |  | const TCHAR * | szSubkey,
 |  | const TCHAR * | szName,
 |  | const TCHAR * | szValue
 | ) |  |

Definition at line 439 of file registry.cpp.

{
  HKEY    hKey = NULL;
  HRESULT hResult = S_FALSE;
  TCHAR   szKeyBuf[1024];

  // Load the buffer with the Snap-In Location
  _tcscpy( szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns") );

  _tcscat( szKeyBuf, _T("\\") );       // Copy keyname into buffer.
  _tcscat( szKeyBuf, szKey );

  if( NULL != szSubkey )               // Add subkey name to buffer.
  {
    _tcscat( szKeyBuf, _T("\\") );
    _tcscat( szKeyBuf, szSubkey );
  }

  do                     // We go to all this trouble to prevent any
  {                      // possibility of exiting while leaving a key open

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx( HKEY_LOCAL_MACHINE,
                                   szKeyBuf,
                                   0,
                                   NULL,
                                   REG_OPTION_NON_VOLATILE,
                                   KEY_ALL_ACCESS,
                                   NULL,
                                   &hKey,
                                   NULL
                                 );
    if( ERROR_SUCCESS != lResult )     // Will return S_FALSE
      continue;

    // Set the Value.
    if( szValue != NULL )
    {
      hResult = RegSetValueEx( hKey,
                               szName,
                               0,
                               REG_SZ,
                               (BYTE*)szValue,
                               BYTE_SIZE(szValue)
                             );
      BREAK_ON_ERROR( hResult );
    }
    else
    {                        // Got this far so everything is OK.
      hResult = S_OK;
    }
  }while( 0 );

  RegCloseKey( hKey );       //Always attempt to close the key
  return hResult;
}

HRESULT SetValue | ( | const TCHAR * | szKey,
 |  | const TCHAR * | szValueName,
 |  | const TCHAR * | szValue
 | ) |  |

Definition at line 382 of file registry.cpp.

{
  HKEY    hKey = NULL;
  HRESULT hResult = S_FALSE;
  TCHAR szKeyBuf[1024];

  // Copy keyname into buffer.
  _tcscpy( szKeyBuf, szKey );

  do                     // We go to all this trouble to prevent any
  {                      // possibility of exiting while leaving a key open

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx( HKEY_CLASSES_ROOT ,
                                   szKeyBuf,
                                   0,
                                   NULL,
                                   REG_OPTION_NON_VOLATILE,
                                   KEY_ALL_ACCESS,
                                   NULL,
                                   &hKey,
                                   NULL
                                 );
    if( ERROR_SUCCESS != lResult )
    {
      hResult = HRESULT_FROM_WIN32( lResult );
      continue;
    }

    if( NULL != szValue )    // Now set the value
    {
      hResult = RegSetValueEx( hKey,
                               szValueName,
                               0,
                               REG_SZ,
                               (BYTE*)szValue,
                               BYTE_SIZE( szValue )
                             );
      BREAK_ON_ERROR( hResult );
    }
  }while( 0 );

  RegCloseKey( hKey );       //Always attempt to close the key
  return hResult;
}

LONG UnregisterServer ( const CLSID & clsid )

Definition at line 113 of file registry.cpp.

{
  HRESULT hResult = S_OK;

  // Allocate the CLSID string
  LPOLESTR wszCLSID = NULL ;
  hResult = StringFromCLSID( clsid, &wszCLSID );
  if( S_OK != hResult )
  {
    CoTaskMemFree( wszCLSID );
    return hResult;
  }

  // Build the key CLSID\\{...}
  TCHAR szKey[64];
  _tcscpy( szKey, _T("CLSID\\") );

  TCHAR* pszCLSID = NULL;
  W2T( &pszCLSID, wszCLSID );          // W2T is defined in Globals.h
  CoTaskMemFree( wszCLSID );           // Through with wide version

  _tcscat( szKey, pszCLSID );
  CoTaskMemFree( pszCLSID );           // Through with TCHAR version

  // Delete the CLSID Key - CLSID\{...}
  LONG lResult = RecursiveDeleteKey( HKEY_CLASSES_ROOT, szKey );
  if( ERROR_SUCCESS != lResult )
    hResult = HRESULT_FROM_WIN32( lResult );

  return hResult;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 232 of file registry.cpp.

{
  HRESULT hResult = S_OK;

  TCHAR    szKeyBuf[1024];
  LPOLESTR wszCLSID = NULL;
  TCHAR*   pszCLSID = NULL;        // Needed for TCHAR version of the ClassID

  // Get CLSID as a wide string
  hResult = StringFromCLSID( clsid, &wszCLSID );
  if( S_OK != hResult )
  {
    CoTaskMemFree( wszCLSID );
    return hResult;
  }

  W2T( &pszCLSID, wszCLSID );          // W2T is defined in Globals.h
  CoTaskMemFree( wszCLSID );           // Through with wide version

  // Load the buffer with the Snap-In Location
  _tcscpy( szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns") );

  _tcscat( szKeyBuf, _T("\\") );       // Copy keyname into buffer.
  _tcscat( szKeyBuf, pszCLSID );

  // Delete the CLSID Key - CLSID\{...}
  LONG lResult = RecursiveDeleteKey( HKEY_LOCAL_MACHINE, szKeyBuf );
  if( ERROR_SUCCESS != lResult )
    hResult = HRESULT_FROM_WIN32( lResult );

  CoTaskMemFree( pszCLSID );
  return hResult;
}

Generated on Wed Nov 13 2024 16:53:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppage/registry.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppage
Functions

registry.h File Reference

#include <tchar.h>

Go to the source code of this file.

Functions

HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const TCHAR *szNameString, const CLSID &clsidAbout, const BOOL fSupportExtensions=FALSE)
HRESULT | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Function Documentation

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const TCHAR * | szFriendlyName
 | ) |  |

Definition at line 51 of file registry.cpp.

{
  // Get server location.
  TCHAR    szModule[512] ;
  TCHAR*   pszCLSID = NULL;
  WCHAR*   wszCLSID = NULL ;
  HRESULT  hResult  = S_FALSE;

  DWORD dwResult = ::GetModuleFileName( hModule,
                                        szModule,
                                        sizeof(szModule)/sizeof(TCHAR)
                                      );
  if( 0 == dwResult ) return HRESULT_FROM_WIN32( dwResult );

  do                         // Fail unless we complete everything
  {
    // Get CLSID string in wide char
    hResult = StringFromCLSID( clsid, &wszCLSID ) ;
    if( S_OK != hResult )
    {
      CoTaskMemFree( wszCLSID );
      BREAK_ON_ERROR( hResult );
    }

    W2T( &pszCLSID, wszCLSID );          // W2T is defined in Globals.h
    CoTaskMemFree( wszCLSID );           // Through with wide version

    TCHAR szKey[64];                     // Build the CLSID key string CLSID\\{...}
    _tcscpy( szKey, _T("CLSID\\") );
    _tcscat( szKey, pszCLSID );

    // Add the CLSID to the registry.
    hResult = SetKeyAndValue( szKey, NULL, szFriendlyName );
    BREAK_ON_ERROR( hResult );

    // Add the server filename subkey under the CLSID key.
    hResult = SetKeyAndValue( szKey, _T("InprocServer32"), szModule );
    BREAK_ON_ERROR( hResult );

    // Set the threading model
    _tcscat( szKey, _T("\\InprocServer32") );
    hResult = SetValue( szKey, _T("ThreadingModel"), _T("Apartment") );
    BREAK_ON_ERROR( hResult );

  }while( 0 );

  CoTaskMemFree( pszCLSID );           // Through with TCHAR version

  return hResult;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | fSupportExtensions = FALSE
 | ) |  |

Definition at line 149 of file registry.cpp.

{
  HRESULT hResult = S_FALSE;
  TCHAR*  pszSnapCLSID = NULL;         // Needed for TCHAR version of the ClassID

  // If any part of this process fails, jump out of the loop and return
  // the error code
  do
  {
    // Allocate the CLSID string
    LPOLESTR wszSnapCLSID  = NULL ;
    hResult = StringFromCLSID( clsid, &wszSnapCLSID ) ;
    if( S_OK != hResult )
    {
       CoTaskMemFree( wszSnapCLSID );
       continue;
    }

    W2T( &pszSnapCLSID, wszSnapCLSID );  // W2T is defined in Globals.h
    CoTaskMemFree( wszSnapCLSID );       // Through with wide version

    // Add the Snap-in's CLSID to the registry
    hResult = SetSnapInKeyAndValue( pszSnapCLSID, NULL, _T("NameString"), szNameString );
    BREAK_ON_ERROR( hResult );

    hResult = SetSnapInKeyAndValue( pszSnapCLSID, _T("StandAlone"), NULL, NULL );
    BREAK_ON_ERROR( hResult );

    // Add registry information for ISnapinAbout if we support it
    LPOLESTR wszAboutCLSID = NULL;
    TCHAR*   pszAboutCLSID = NULL;
    if( IID_NULL != clsidAbout )
    {
      hResult = StringFromCLSID( clsidAbout, &wszAboutCLSID );
      if( S_OK != hResult )
      {
        CoTaskMemFree( wszAboutCLSID ); // Free this memory before exiting
        continue;
      }

      W2T( &pszAboutCLSID, wszAboutCLSID );
      hResult = SetSnapInKeyAndValue( pszSnapCLSID, NULL, _T("About"), pszAboutCLSID );
      CoTaskMemFree( wszAboutCLSID );
      CoTaskMemFree( pszAboutCLSID );
      BREAK_ON_ERROR( hResult );
    }

    if( TRUE == bSupportExtensions )     // Build the NodeTypesKey
    {
      hResult = SetSnapInKeyAndValue( pszSnapCLSID, _T("NodeTypes"), NULL, NULL );
      BREAK_ON_ERROR( hResult );
      TCHAR szKey[64];
      _tcscpy( szKey, pszSnapCLSID );
      _tcscat(szKey, _T("\\NodeTypes"));
      hResult = SetSnapInKeyAndValue( szKey, pszSnapCLSID, NULL, NULL );
      BREAK_ON_ERROR( hResult );
    }
  }while( 0 );

  CoTaskMemFree( pszSnapCLSID);
  return hResult;
}

HRESULT UnregisterServer ( const CLSID & clsid )

Definition at line 112 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

  MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
  _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 184 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Generated on Wed Nov 13 2024 16:53:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppage/resource.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppage
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDB_APPIMG_16 104
#define | IDB_APPIMG_32 101
#define | IDB_NODEIMAGES_16 106
#define | IDB_NODEIMAGES_32 107
#define | IDC_ARCHIVE_ATTR 1000
#define | IDC_BACKUP_FLAG 1005
#define | IDC_DEVNAME_EDIT 1004
#define | IDC_HIDDEN_ATTR 1001
#define | IDC_LOCKED_ATTR 1002
#define | IDC_READONLY_ATTR 1003
#define | IDD_ADDDEVICE_DLG 109
#define | IDD_ADDVFILE_DLG 110
#define | IDD_BASE_DIALOG 108
#define | IDD_VFILE_PPAGE0 111
#define | IDI_APP_ICON 105

Define Documentation

#define IDB_APPIMG_16 104

Definition at line 6 of file resource.h.

#define IDB_APPIMG_32 101

Definition at line 5 of file resource.h.

#define IDB_NODEIMAGES_16 106

Definition at line 8 of file resource.h.

#define IDB_NODEIMAGES_32 107

Definition at line 9 of file resource.h.

#define IDC_ARCHIVE_ATTR 1000

Definition at line 14 of file resource.h.

#define IDC_BACKUP_FLAG 1005

Definition at line 19 of file resource.h.

#define IDC_DEVNAME_EDIT 1004

Definition at line 18 of file resource.h.

#define IDC_HIDDEN_ATTR 1001

Definition at line 15 of file resource.h.

#define IDC_LOCKED_ATTR 1002

Definition at line 16 of file resource.h.

#define IDC_READONLY_ATTR 1003

Definition at line 17 of file resource.h.

#define IDD_ADDDEVICE_DLG 109

Definition at line 11 of file resource.h.

#define IDD_ADDVFILE_DLG 110

Definition at line 12 of file resource.h.

#define IDD_BASE_DIALOG 108

Definition at line 10 of file resource.h.

#define IDD_VFILE_PPAGE0 111

Definition at line 13 of file resource.h.

#define IDI_APP_ICON 105

Definition at line 7 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppage/staticnode.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppage
Defines

staticnode.cpp File Reference

#include "StaticNode.h"
#include "DeviceNode.h"
#include "CompData.h"
#include "Comp.h"
#include "AddDeviceDlg.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CStaticNode")

Define Documentation

#define MODULESTRING _T("CStaticNode")

Definition at line 25 of file staticnode.cpp.

Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppage/staticnode.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppage
Classes

staticnode.h File Reference

#include "Globals.h"
#include "BaseNode.h"
#include "LListImpl.h"
#include "LListImpl.h"

Go to the source code of this file.

Classes

class CStaticNode
Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppage/tracemacro.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppage
Functions

tracemacro.cpp File Reference

#include "Globals.h"
#include "TraceMacro.h"
#include <StdIo.h>

Go to the source code of this file.

Functions

VOID | MapEvent (LONG Event, LPTSTR szEventStr)
VOID | Trace_Event (LPCTSTR pszClass, LPCTSTR pszFunction, LONG nEvent)
VOID | Trace_HR (LPCTSTR pszClass, LPCTSTR pszFunction, HRESULT hr)
VOID | Trace_Pointer (LPCTSTR pszClass, LPCTSTR pszFunction, LPCTSTR pszAction, ULONG ulValue)
VOID | Trace_Start (LPCTSTR pszClass, LPCTSTR pszFunction)
VOID | Trace_Value (LPCTSTR pszClass, LPCTSTR pszFunction, LPCTSTR pszValueName, LONG nValue)

Function Documentation

VOID MapEvent | ( | LONG | Event,
 |  | LPTSTR | szEventStr
 | ) |  |

Definition at line 179 of file tracemacro.cpp.

{
#ifdef _DEBUG

  switch( Event )
  {
    case 0x8001:
      _tcscpy( szEventStr, _T("MMCN_ACTIVATE          ") );
      break;

    case 0x8002:
      _tcscpy( szEventStr, _T("MMCN_ADD_IMAGES        ") );
      break;

    case 0x8003:
      _tcscpy( szEventStr, _T("MMCN_BTN_CLICK         ") );
      break;

    case 0x8004:
      _tcscpy( szEventStr, _T("MMCN_CLICK             ") );
      break;

    case 0x8005:
      _tcscpy( szEventStr, _T("MMCN_COLUMN_CLICK       ") );
      break;

    case 0x8006:
      _tcscpy( szEventStr, _T("MMCN_CONTEXTMENU        ") );
      break;

    case 0x8007:
      _tcscpy( szEventStr, _T("MMCN_CUTORMOVE          ") );
      break;

    case 0x8008:
      _tcscpy( szEventStr, _T("MMCN_DBLCLICK           ") );
      break;

    case 0x8009:
      _tcscpy( szEventStr, _T("MMCN_DELETE             ") );
      break;

    case 0x800A:
      _tcscpy( szEventStr, _T("MMCN_DESELECT_ALL       ") );
      break;

    case 0x800B:
      _tcscpy( szEventStr, _T("MMCN_EXPAND             ") );
      break;

    case 0x800C:
      _tcscpy( szEventStr, _T("MMCN_HELP               ") );
      break;

    case 0x800D:
      _tcscpy( szEventStr, _T("MMCN_MENU_BTNCLICK      ") );
      break;

    case 0x800E:
      _tcscpy( szEventStr, _T("MMCN_MINIMIZED          ") );
      break;

    case 0x800F:
      _tcscpy( szEventStr, _T("MMCN_PASTE              ") );
      break;

    case 0x8010:
      _tcscpy( szEventStr, _T("MMCN_PROPERTY_CHANGE    ") );
      break;

    case 0x8011:
      _tcscpy( szEventStr, _T("MMCN_QUERY_PASTE        ") );
      break;

    case 0x8012:
      _tcscpy( szEventStr, _T("MMCN_REFRESH            ") );
      break;

    case 0x8013:
      _tcscpy( szEventStr, _T("MMCN_REMOVE_CHILDREN    ") );
      break;

    case 0x8014:
      _tcscpy( szEventStr, _T("MMCN_RENAME             ") );
      break;

    case 0x8015:
      _tcscpy( szEventStr, _T("MMCN_SELECT             ") );
      break;

    case 0x8016:
      _tcscpy( szEventStr, _T("MMCN_SHOW               ") );
      break;

    case 0x8017:
      _tcscpy( szEventStr, _T("MMCN_VIEW_CHANGE        ") );
      break;

    case 0x8018:
      _tcscpy( szEventStr, _T("MMCN_SNAPINHELP         ") );
      break;

    case 0x8019:
      _tcscpy( szEventStr, _T("MMCN_CONTEXTHELP        ") );
      break;

    case 0x801A:
      _tcscpy( szEventStr, _T("MMCN_INITOCX            ") );
      break;

    // MMC Version 1.1 notifications
    case 0x801B:
      _tcscpy( szEventStr, _T("MMCN_FILTER_CHANGE      ") );
      break;

    case 0x801C:
      _tcscpy( szEventStr, _T("MMCN_FILTERBTN_CLICK    ") );
      break;

    case 0x801D:
      _tcscpy( szEventStr, _T("MMCN_RESTORE_VIEW       ") );
      break;

    case 0x801E:
      _tcscpy( szEventStr, _T("MMCN_PRINT              ") );
      break;

    case 0x801F:
      _tcscpy( szEventStr, _T("MMCN_PRELOAD            ") );
      break;

    case 0x8020:
      _tcscpy( szEventStr, _T("MMCN_LISTPAD            ") );
      break;

    case 0x8021:
      _tcscpy( szEventStr, _T("MMCN_EXPANDSYNC         ") );
      break;

    // MMC Version 1.2 notifications
    case 0x8022:
      _tcscpy( szEventStr, _T("MMCN_COLUMNS_CHANGED    ") );
      break;

    // MMC Version 2.0 notifications
    case 0x8023:
      _tcscpy( szEventStr, _T("MMCN_CANPASTE_OUTOFPROC ") );
      break;

    default:
      _stprintf( szEventStr, _T("0x%X"), Event );
      break;
  }

#endif
} //end MapEvent()

VOID Trace_Event | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LONG | nEvent
 | ) |  |

Definition at line 119 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szEventStr[64];
  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Event = %s\n");
  INT    nChars     = 0;

  MapEvent( nEvent, szEventStr );

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      szEventStr
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Event()

VOID Trace_HR | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | HRESULT | hr
 | ) |  |

Definition at line 28 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Returned 0x%X\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer, szFormat, pszClass, pszFunction, hr );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_HR()

VOID Trace_Pointer | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LPCTSTR | pszAction,
 |  | ULONG | ulValue
 | ) |  |

Definition at line 86 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> %s = 0x%X\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      pszAction,
                      ulValue
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Pointer()

VOID Trace_Start | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction
 | ) |  |

Definition at line 151 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Started \n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Start()

VOID Trace_Value | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LPCTSTR | pszValueName,
 |  | LONG | nValue
 | ) |  |

Definition at line 54 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> %s = %u\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      pszValueName,
                      nValue
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Value()

Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppage/tracemacro.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppage
Defines | Functions

tracemacro.h File Reference

Go to the source code of this file.

Defines

#define | TRACE_EVENT
#define | TRACE_HRESULT
#define | TRACE_PTR
#define | TRACE_START
#define | TRACE_VAL

Functions

VOID | MapEvent (LONG Event, LPTSTR szEventStr)
VOID | Trace_Event (LPCTSTR pszClass, LPCTSTR pszFunction, LONG nEvent)
VOID | Trace_HR (LPCTSTR pszClass, LPCTSTR pszFunction, HRESULT hr)
VOID | Trace_Pointer (LPCTSTR pszClass, LPCTSTR pszFunction, LPCTSTR pszAction, ULONG ulValue)
VOID | Trace_Start (LPCTSTR pszClass, LPCTSTR pszFunction)
VOID | Trace_Value (LPCTSTR pszClass, LPCTSTR pszFunction, LPCTSTR pszValueName, LONG nValue)

Define Documentation

#define TRACE_EVENT

Definition at line 64 of file tracemacro.h.

#define TRACE_HRESULT

Definition at line 55 of file tracemacro.h.

#define TRACE_PTR

Definition at line 61 of file tracemacro.h.

#define TRACE_START

Definition at line 67 of file tracemacro.h.

#define TRACE_VAL

Definition at line 58 of file tracemacro.h.

Function Documentation

VOID MapEvent | ( | LONG | Event,
 |  | LPTSTR | szEventStr
 | ) |  |

Definition at line 146 of file tracemacro.cpp.

{
#ifdef _DEBUG

  switch( Event )
  {
    case 0x8001:
      _tcscpy( szEventStr, _T("MMCN_ACTIVATE       ") );
      break;

    case 0x8002:
      _tcscpy( szEventStr, _T("MMCN_ADD_IMAGES     ") );
      break;

    case 0x8003:
      _tcscpy( szEventStr, _T("MMCN_BTN_CLICK      ") );
      break;

    case 0x8004:
      _tcscpy( szEventStr, _T("MMCN_CLICK          ") );
      break;

    case 0x8005:
      _tcscpy( szEventStr, _T("MMCN_COLUMN_CLICK   ") );
      break;

    case 0x8006:
      _tcscpy( szEventStr, _T("MMCN_CONTEXTMENU    ") );
      break;

    case 0x8007:
      _tcscpy( szEventStr, _T("MMCN_CUTORMOVE      ") );
      break;

    case 0x8008:
      _tcscpy( szEventStr, _T("MMCN_DBLCLICK       ") );
      break;

    case 0x8009:
      _tcscpy( szEventStr, _T("MMCN_DELETE         ") );
      break;

    case 0x800A:
      _tcscpy( szEventStr, _T("MMCN_DESELECT_ALL   ") );
      break;

    case 0x800B:
      _tcscpy( szEventStr, _T("MMCN_EXPAND         ") );
      break;

    case 0x800C:
      _tcscpy( szEventStr, _T("MMCN_HELP           ") );
      break;

    case 0x800D:
      _tcscpy( szEventStr, _T("MMCN_MENU_BTNCLICK  ") );
      break;

    case 0x800E:
      _tcscpy( szEventStr, _T("MMCN_MINIMIZED      ") );
      break;

    case 0x800F:
      _tcscpy( szEventStr, _T("MMCN_PASTE          ") );
      break;

    case 0x8010:
      _tcscpy( szEventStr, _T("MMCN_PROPERTY_CHANGE") );
      break;

    case 0x8011:
      _tcscpy( szEventStr, _T("MMCN_QUERY_PASTE    ") );
      break;

    case 0x8012:
      _tcscpy( szEventStr, _T("MMCN_REFRESH        ") );
      break;

    case 0x8013:
      _tcscpy( szEventStr, _T("MMCN_REMOVE_CHILDREN") );
      break;

    case 0x8014:
      _tcscpy( szEventStr, _T("MMCN_RENAME         ") );
      break;

    case 0x8015:
      _tcscpy( szEventStr, _T("MMCN_SELECT         ") );
      break;

    case 0x8016:
      _tcscpy( szEventStr, _T("MMCN_SHOW           ") );
      break;

    case 0x8017:
      _tcscpy( szEventStr, _T("MMCN_VIEW_CHANGE    ") );
      break;

    case 0x8018:
      _tcscpy( szEventStr, _T("MMCN_SNAPINHELP     ") );
      break;

    case 0x8019:
      _tcscpy( szEventStr, _T("MMCN_CONTEXTHELP    ") );
      break;

    case 0x801A:
      _tcscpy( szEventStr, _T("MMCN_INITOCX        ") );
      break;

    case 0x8021:
      _tcscpy( szEventStr, _T("MMCN_EXPANDSYNC     ") );
      break;

    default:
      _stprintf( szEventStr, _T("0x%X"), Event );
      break;
  }

#endif
} //end MapEvent()

VOID Trace_Event | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LONG | nEvent
 | ) |  |

Definition at line 86 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szEventStr[22];
  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Event = %s\n");
  INT    nChars     = 0;

  MapEvent( nEvent, szEventStr );

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      szEventStr
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Event()

VOID Trace_HR | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | HRESULT | hr
 | ) |  |

Definition at line 27 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Returned 0x%X\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer, szFormat, pszClass, pszFunction, hr );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_HR()

VOID Trace_Pointer | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LPCTSTR | pszAction,
 |  | ULONG | ulValue
 | ) |  |

Definition at line 86 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> %s = 0x%X\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      pszAction,
                      ulValue
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Pointer()

VOID Trace_Start | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction
 | ) |  |

Definition at line 118 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Started \n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Start()

VOID Trace_Value | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LPCTSTR | pszValueName,
 |  | LONG | nValue
 | ) |  |

Definition at line 53 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> %s = %u\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      pszValueName,
                      nValue
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Value()

Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppage/virtualfile.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppage
Defines

virtualfile.cpp File Reference

#include "VirtualFile.h"
#include "Globals.h"
#include "CompData.h"
#include "Comp.h"
#include "FolderNode.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CVirtualFile")

Define Documentation

#define MODULESTRING _T("CVirtualFile")

Definition at line 25 of file virtualfile.cpp.

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppage/virtualfile.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppage
Classes

virtualfile.h File Reference

#include "Globals.h"
#include "BaseNode.h"

Go to the source code of this file.

Classes

class CVirtualFile
Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppagex/basesnap.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppagex
Defines | Functions

basesnap.cpp File Reference

#include <ObjBase.h>
#include <InitGuid.h>
#include "Globals.h"
#include "BaseSnap.h"
#include "Registry.h"
#include "PropPageX.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define | MODULESTRING _T("BaseSnap")

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)
BOOL WINAPI | DllMain (HINSTANCE hInstDLL, DWORD fdwReason, void *lpvReserved)
STDAPI | DllRegisterServer ()
STDAPI | DllUnregisterServer ()
STDMETHODIMP_ (ULONG) CClassFactory

Define Documentation

#define MODULESTRING _T("BaseSnap")

Definition at line 27 of file basesnap.cpp.

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 219 of file basesnap.cpp.

{
  if( 0 == g_uObjectCount && 0 == g_uServerLocks )
    return S_OK;
  else
    return S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 185 of file basesnap.cpp.

{
  // XPROPPAGE: Test for our class
  if( (rclsid != CLSID_CExtendPropertySheet2) )
    return CLASS_E_CLASSNOTAVAILABLE;

  if( !ppvObj )
    return E_FAIL;

  *ppvObj = NULL;

  // We can only hand out IUnknown and IClassFactory pointers.  Fail
  // if caller asks for anything else.
  if( !IsEqualIID(riid, IID_IUnknown) && !IsEqualIID(riid, IID_IClassFactory) )
    return E_NOINTERFACE;

  CClassFactory *pFactory = NULL;

  // XPROPPAGE: Create the new class factory.  Pass in the type of object to create
  if( rclsid == CLSID_CExtendPropertySheet2 )
    pFactory = new CClassFactory(CClassFactory::PROPERTYPAGEX);

  HRESULT hResult = pFactory->QueryInterface( riid, ppvObj );

  return hResult;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstDLL,
 |  | DWORD | fdwReason,
 |  | void * | lpvReserved
 | ) |  |

Definition at line 168 of file basesnap.cpp.

{
  if( DLL_PROCESS_ATTACH == fdwReason )
  {
     g_hInst = hInstDLL;
  }

  return TRUE;
}

STDAPI DllRegisterServer ( void )

Definition at line 231 of file basesnap.cpp.

{
  HRESULT hResult = S_FALSE;

  do
  {
    hResult = RegisterServer( g_hInst, CLSID_CExtendPropertySheet2, gtszSNAPIN_NAME );
    BREAK_ON_ERROR( hResult );

    hResult = RegisterSnapin( CLSID_CExtendPropertySheet2, gtszSNAPIN_NAME, IID_NULL, FALSE );
    BREAK_ON_ERROR( hResult );

  }while( 0 );

  return hResult;
}

STDAPI DllUnregisterServer ( void )

Definition at line 252 of file basesnap.cpp.

{
  if( S_OK == UnregisterServer(CLSID_CExtendPropertySheet2) )
    return UnregisterSnapin(CLSID_CExtendPropertySheet2);
  else
    return E_FAIL;
}

STDMETHODIMP_ ( ULONG )

Definition at line 90 of file basesnap.cpp.

{
  if( 0 == InterlockedDecrement( (long*)&m_cRef) )
  {
    delete this;
    return 0;
  }
  return m_cRef;
}

Generated on Wed Nov 13 2024 16:54:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppagex/basesnap.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppagex
Classes | Functions

basesnap.h File Reference

Go to the source code of this file.

Classes

class | CClassFactory

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 53 of file ComSpyAudit.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 61 of file ComSpyAudit.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

Generated on Wed Nov 13 2024 16:54:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppagex/globals.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppagex
Functions | Variables

globals.cpp File Reference

#include "Globals.h"

Go to the source code of this file.

Functions

void _fastcall | Unicode2Ansi (CHAR **pszAnsi, WCHAR *szWide)

Variables

UINT | g_cfNodeAttrPtr = 0
HINSTANCE | g_hInst = NULL
ULONG | g_uObjectCount = 0
ULONG | g_uServerLocks = 0

Function Documentation

void _fastcall Unicode2Ansi | ( | CHAR ** | pszAnsi,
 |  | WCHAR * | szWide
 | ) |  |

Definition at line 35 of file globals.cpp.

{
  LONG nLen = wcslen( szWide ) +1;
  *pszAnsi = (char*)CoTaskMemAlloc( nLen );
  char* pCounter = *pszAnsi;

  while( *szWide )
  {
    *pCounter = LOBYTE(*szWide);
    pCounter++;
    szWide++;
  }
  *pCounter = NULL;
}

Variable Documentation

UINT g_cfNodeAttrPtr = 0

Definition at line 26 of file globals.cpp.

HINSTANCE g_hInst = NULL

Definition at line 18 of file globals.cpp.

ULONG g_uObjectCount = 0

Definition at line 19 of file globals.cpp.

ULONG g_uServerLocks = 0

Definition at line 20 of file globals.cpp.

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppagex/globals.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppagex
Classes | Defines | Typedefs | Functions | Variables

globals.h File Reference

#include <TChar.h>
#include <Mmc.h>
#include <CrtDbg.h>
#include "Guids.h"
#include "Guids.h"

Go to the source code of this file.

Classes

struct | _tag_NODE_ATTRIB_

Defines

#define | ATTRIBUTE_DATA_COMPRESSED 64
#define | ATTRIBUTE_DATA_ENCRYPTED 128
#define | BREAK_ON_ERROR(hResult) if( S_OK != hResult ) continue
#define | BYTE_SIZE(string) ((_tcslen(string)+1) * sizeof(TCHAR))
#define | MAX_OBJECT_PATH 255
#define | MsgBox(wszMsg, wszTitle) ::MessageBox(NULL, wszMsg, wszTitle, MB_OK)
#define | T_CCF_ATTRIB_PTR _T("CCF_ATTRIB_PTR")
#define | W2T(szAnsiPtr, szWide) Unicode2Ansi( szAnsiPtr, szWide )

Typedefs

typedef struct _tag_NODE_ATTRIB_ | NODE_ATTRIBS

Functions

template<class TYPE >
void | SAFE_FREE_BITMAP (TYPE *&pObj)
template<class TYPE >
void | SAFE_FREE_ICON (TYPE *&pObj)
template<class TYPE >
void | SAFE_RELEASE (TYPE *&pObj)
void _fastcall | Unicode2Ansi (CHAR **pszAnsi, WCHAR *szWide)

Variables

UINT g_cfNodeAttrPtr
HINSTANCE | g_hInst
ULONG g_uObjectCount
ULONG g_uServerLocks

Define Documentation

#define ATTRIBUTE_DATA_COMPRESSED 64

Definition at line 46 of file globals.h.

#define ATTRIBUTE_DATA_ENCRYPTED 128

Definition at line 47 of file globals.h.

#define BREAK_ON_ERROR ( hResult ) if( S_OK != hResult ) continue

Definition at line 71 of file globals.h.

#define BYTE_SIZE ( string ) ((_tcslen(string)+1) * sizeof(TCHAR))

Definition at line 69 of file globals.h.

#define MAX_OBJECT_PATH 255

Definition at line 38 of file globals.h.

#define MsgBox | ( | wszMsg,
 |  | wszTitle |
 | ) |  | ::MessageBox(NULL, wszMsg, wszTitle, MB_OK)

Definition at line 74 of file globals.h.

#define T_CCF_ATTRIB_PTR _T("CCF_ATTRIB_PTR")

Definition at line 34 of file globals.h.

#define W2T | ( | szAnsiPtr,
 |  | szWide |
 | ) |  | Unicode2Ansi( szAnsiPtr, szWide )

Definition at line 127 of file globals.h.

Typedef Documentation

typedef struct _tag_NODE_ATTRIB_ NODE_ATTRIBS

Function Documentation

template<class TYPE >
void SAFE_FREE_BITMAP ( TYPE *& pObj ) [inline]

Definition at line 94 of file globals.h.

{
  if( NULL != pObj )
  {
    BOOL bStatus = DeleteObject( pObj );
    pObj = NULL;
  }
  else
  {
    OutputDebugString(_T("Attempted to delete NULL Bitmap handle.\n"));
  }
}

template<class TYPE >
void SAFE_FREE_ICON ( TYPE *& pObj ) [inline]

Definition at line 109 of file globals.h.

{
  if( NULL != pObj )
  {
    BOOL bStatus = DestroyIcon( pObj );
    pObj = NULL;
  }
  else
  {
    OutputDebugString(_T("Attempted to delete NULL Icon handle.\n"));
  }
}

template<class TYPE >
void SAFE_RELEASE ( TYPE *& pObj ) [inline]

Definition at line 79 of file globals.h.

{
  if( NULL != pObj )
  {
    pObj->Release();
    pObj = NULL;
  }
  else
  {
    OutputDebugString(_T("Attempted to release NULL Com pointer.\n"));
  }
}

void _fastcall Unicode2Ansi | ( | CHAR ** | pszAnsi,
 |  | WCHAR * | szWide
 | ) |  |

Definition at line 38 of file globals.cpp.

{
  LONG nLen = wcslen( szWide ) +1;
  *pszAnsi = (char*)CoTaskMemAlloc( nLen );
  char* pCounter = *pszAnsi;

  while( *szWide )
  {
    *pCounter = LOBYTE(*szWide);
    pCounter++;
    szWide++;
  }
  *pCounter = NULL;
}

Variable Documentation

UINT g_cfNodeAttrPtr

Definition at line 34 of file globals.cpp.

HINSTANCE g_hInst

Definition at line 62 of file DoServer.Cpp.

ULONG g_uObjectCount

Definition at line 28 of file globals.cpp.

ULONG g_uServerLocks

Definition at line 29 of file globals.cpp.

Generated on Wed Nov 13 2024 16:54:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppagex/guids.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppagex
Functions

guids.h File Reference

Go to the source code of this file.

Functions

DEFINE_GUID (CLSID_CExtendPropertySheet2, 0x489f991a, 0x9a75, 0x4553, 0x88, 0x5b, 0x6e, 0xe8, 0x81, 0xc5, 0x0a, 0x26)

Function Documentation

DEFINE_GUID | ( | CLSID_CExtendPropertySheet2 | ,
 |  | 0x489f991a | ,
 |  | 0x9a75 | ,
 |  | 0x4553 | ,
 |  | 0x88 | ,
 |  | 0x5b | ,
 |  | 0x6e | ,
 |  | 0xe8 | ,
 |  | 0x81 | ,
 |  | 0xc5 | ,
 |  | 0x0a | ,
 |  | 0x26 |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppagex/proppagex.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppagex
Defines | Functions

proppagex.cpp File Reference

#include "Globals.h"
#include "PropPageX.h"
#include "Resource.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CExtendPropertySheet2")

Functions

STDMETHODIMP_ (ULONG) CExtendPropertySheet

Define Documentation

#define MODULESTRING _T("CExtendPropertySheet2")

Definition at line 22 of file proppagex.cpp.

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 63 of file proppagex.cpp.

{
  if( InterlockedDecrement((LONG*)&m_cRef) == 0 )
  {
    delete this;
    return 0;
  }
  return m_cRef;
}

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppagex/proppagex.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppagex
Classes

proppagex.h File Reference

#include "Globals.h"

Go to the source code of this file.

Classes

class CExtendPropertySheet
Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppagex/registry.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppagex
Defines | Functions

registry.cpp File Reference

#include <ObjBase.h>
#include "Registry.h"
#include "Globals.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define | MODULESTRING _T("Registry")

Functions

HRESULT | RecursiveDeleteKey (HKEY hKeyParent, const TCHAR *szKeyChild)
HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const TCHAR *szNameString, const CLSID &clsidAbout, const BOOL bSupportExtensions)
HRESULT | SetExtensionKey (const TCHAR *szNodeType)
HRESULT | SetKeyAndValue (const TCHAR *pszPath, const TCHAR *szSubkey, const TCHAR *szValue)
HRESULT | SetSnapInKeyAndValue (const TCHAR *szKey, const TCHAR *szSubkey, const TCHAR *szName, const TCHAR *szValue)
HRESULT | SetValue (const TCHAR *szKey, const TCHAR *szValueName, const TCHAR *szValue)
LONG | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Define Documentation

#define MODULESTRING _T("Registry")

Definition at line 22 of file registry.cpp.

Function Documentation

HRESULT RecursiveDeleteKey | ( | HKEY | hKeyParent,
 |  | const TCHAR * | szKeyChild
 | ) |  |

Definition at line 248 of file registry.cpp.

{
  // Open the child.
  HKEY hKeyChild = NULL;
  LONG lResult   = ERROR_SUCCESS;

  do                     // We go to all this trouble to prevent any
  {                      // possibility of exiting while leaving a key open

    lResult = RegOpenKeyEx( hKeyParent,
                            lpszKeyChild,
                            0,
                            KEY_ALL_ACCESS,
                            &hKeyChild
                          );
    if( ERROR_SUCCESS != lResult )
      continue;

    // Enumerate all of the decendents of this child.
    FILETIME time;
    _TCHAR szBuffer[256];
    DWORD dwSize = 256;
    while( S_OK == RegEnumKeyEx(hKeyChild,0,szBuffer,&dwSize,NULL,NULL,NULL,&time) )
    {
      // Delete the decendents of this child.
      lResult = RecursiveDeleteKey( hKeyChild, szBuffer );
      if( ERROR_SUCCESS != lResult )
      {
        continue;
      }
      dwSize = 256;
    }
  }while( 0 );

  RegCloseKey( hKeyChild );            // Always try to close the child
                                       // then delete this child.
  return RegDeleteKey( hKeyParent, lpszKeyChild );
}

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const TCHAR * | szFriendlyName
 | ) |  |

Definition at line 53 of file registry.cpp.

{
  // Get server location.
  TCHAR    szModule[512] ;
  TCHAR*   pszCLSID = NULL;
  LPOLESTR wszCLSID = NULL ;
  HRESULT  hResult  = S_FALSE;

  DWORD dwResult = ::GetModuleFileName( hModule,
                                        szModule,
                                        sizeof(szModule)/sizeof(TCHAR)
                                      );
  if( 0 == dwResult ) return HRESULT_FROM_WIN32( dwResult );

  do                         // Fail unless we complete everything
  {
    // Get CLSID string in wide char
    hResult = StringFromCLSID( clsid, &wszCLSID ) ;
    if( S_OK != hResult )
    {
      CoTaskMemFree( wszCLSID );
      BREAK_ON_ERROR( hResult );
    }

    W2T( &pszCLSID, wszCLSID );          // W2T is defined in Globals.h
    CoTaskMemFree( wszCLSID );           // Through with wide version

    TCHAR szKey[64];                     // Build the CLSID key string CLSID\\{...}
    _tcscpy( szKey, _T("CLSID\\") );
    _tcscat( szKey, pszCLSID );

    // Add the CLSID to the registry.
    hResult = SetKeyAndValue( szKey, NULL, szFriendlyName );
    BREAK_ON_ERROR( hResult );

    // Add the server filename subkey under the CLSID key.
    hResult = SetKeyAndValue( szKey, _T("InprocServer32"), szModule );
    BREAK_ON_ERROR( hResult );

    // Set the threading model
    _tcscat( szKey, _T("\\InprocServer32") );
    hResult = SetValue( szKey, _T("ThreadingModel"), _T("Apartment") );
    BREAK_ON_ERROR( hResult );

  }while( 0 );

  CoTaskMemFree( pszCLSID );           // Through with TCHAR version

  return hResult;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | bSupportExtensions
 | ) |  |

Definition at line 151 of file registry.cpp.

{
  HRESULT hResult = S_FALSE;
  TCHAR*  pszSnapCLSID = NULL;         // Needed for TCHAR version of the ClassID

  // If any part of this process fails, jump out of the loop and return
  // the error code
  do
  {
    // Allocate the CLSID string
    LPOLESTR wszSnapCLSID  = NULL ;
    hResult = StringFromCLSID( clsid, &wszSnapCLSID ) ;
    if( S_OK != hResult )
    {
       CoTaskMemFree( wszSnapCLSID );
       continue;
    }

    W2T( &pszSnapCLSID, wszSnapCLSID );  // W2T is defined in Globals.h
    CoTaskMemFree( wszSnapCLSID );       // Through with wide version

    // Add the Snap-in's CLSID to the registry
    hResult = SetSnapInKeyAndValue( pszSnapCLSID, NULL, _T("NameString"), szNameString );
    BREAK_ON_ERROR( hResult );

    // Extensions don't support ISnapinAbout, so this is not handled

    if( TRUE == bSupportExtensions )     // Build the NodeTypesKey
    {
      hResult = SetSnapInKeyAndValue( pszSnapCLSID, _T("NodeTypes"), NULL, NULL );
      BREAK_ON_ERROR( hResult );
      TCHAR szKey[64];
      _tcscpy( szKey, pszSnapCLSID );
      _tcscat(szKey, _T("\\NodeTypes"));
      hResult = SetSnapInKeyAndValue( szKey, pszSnapCLSID, NULL, NULL );
      BREAK_ON_ERROR( hResult );
    }
  }while( 0 );

  hResult = SetExtensionKey( gtszVFILE_GUID );

  CoTaskMemFree( pszSnapCLSID);
  return hResult;
}

HRESULT SetExtensionKey ( const TCHAR * szNodeType )

Definition at line 482 of file registry.cpp.

{
  HKEY    hNodeKey = NULL;
  HRESULT hResult  = S_FALSE;
  TCHAR   szKeyBuf[1024];

  // Load the buffer with the NodeTypes Location
  _tcscpy( szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\NodeTypes") );

  _tcscat( szKeyBuf, _T("\\") );       // Copy NodeType GUID into buffer.
  _tcscat( szKeyBuf, szNodeType );

  _tcscat( szKeyBuf, _T("\\") );       // Copy Subkeys into buffer
  _tcscat( szKeyBuf, _T("Extensions\\PropertySheet") );

  long lResult = RegCreateKeyEx( HKEY_LOCAL_MACHINE,
                                 szKeyBuf,
                                 0,
                                 NULL,
                                 REG_OPTION_NON_VOLATILE,
                                 KEY_ALL_ACCESS,
                                 NULL,
                                 &hNodeKey,
                                 NULL
                               );

  if( ERROR_SUCCESS != lResult )     // Will return S_FALSE
  {
    RegCloseKey( hNodeKey );
    return S_FALSE;
  }

  TCHAR* szDescription = _T("VirtFileX");
  hResult = RegSetValueEx( hNodeKey,
                           gtszPROPPAGEX_GUID,
                           0,
                           REG_SZ,
                           (BYTE*)szDescription,
                           BYTE_SIZE(szDescription)
                         );

  return hResult;
}

HRESULT SetKeyAndValue | ( | const TCHAR * | pszPath,
 |  | const TCHAR * | szSubkey,
 |  | const TCHAR * | szValue
 | ) |  |

Definition at line 296 of file registry.cpp.

{
  HKEY hKey = NULL;
  HRESULT hResult = S_FALSE;
  TCHAR szKeyBuf[1024];

  // Copy keyname into buffer.
  _tcscpy( szKeyBuf, szKey );

  // Add subkey name to buffer.
  if( NULL != szSubkey )
  {
    _tcscat( szKeyBuf, _T("\\") );
    _tcscat( szKeyBuf, szSubkey );
  }

  do                     // We go to all this trouble to prevent any
  {                      // possibility of exiting while leaving a key open

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx( HKEY_CLASSES_ROOT,
                                   szKeyBuf,
                                   0,
                                   NULL,
                                   REG_OPTION_NON_VOLATILE,
                                   KEY_ALL_ACCESS,
                                   NULL,
                                   &hKey,
                                   NULL
                                 );
    if( ERROR_SUCCESS != lResult )
    {
      hResult = HRESULT_FROM_WIN32( lResult );
      continue;
    }

    if( NULL != szValue )    // Now set the value
    {
      hResult = RegSetValueEx( hKey,
                               NULL,
                               0,
                               REG_SZ,
                               (BYTE*)szValue,
                               BYTE_SIZE( szValue )    // BYTE_SIZE is in Globals.h
                             );
      BREAK_ON_ERROR( hResult );
    }
  }while( 0 );

  RegCloseKey( hKey );       // Always try to close the key
  return hResult;
}

HRESULT SetSnapInKeyAndValue | ( | const TCHAR * | szKey,
 |  | const TCHAR * | szSubkey,
 |  | const TCHAR * | szName,
 |  | const TCHAR * | szValue
 | ) |  |

Definition at line 415 of file registry.cpp.

{
  HKEY    hKey = NULL;
  HRESULT hResult = S_FALSE;
  TCHAR   szKeyBuf[1024];

  // Load the buffer with the Snap-In Location
  _tcscpy( szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns") );

  _tcscat( szKeyBuf, _T("\\") );       // Copy keyname into buffer.
  _tcscat( szKeyBuf, szKey );

  if( NULL != szSubkey )               // Add subkey name to buffer.
  {
    _tcscat( szKeyBuf, _T("\\") );
    _tcscat( szKeyBuf, szSubkey );
  }

  do                     // We go to all this trouble to prevent any
  {                      // possibility of exiting while leaving a key open

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx( HKEY_LOCAL_MACHINE,
                                   szKeyBuf,
                                   0,
                                   NULL,
                                   REG_OPTION_NON_VOLATILE,
                                   KEY_ALL_ACCESS,
                                   NULL,
                                   &hKey,
                                   NULL
                                 );
    if( ERROR_SUCCESS != lResult )     // Will return S_FALSE
      continue;

    // Set the Value.
    if( szValue != NULL )
    {
      hResult = RegSetValueEx( hKey,
                               szName,
                               0,
                               REG_SZ,
                               (BYTE*)szValue,
                               BYTE_SIZE(szValue)
                             );
      BREAK_ON_ERROR( hResult );
    }
    else
    {                        // Got this far so everything is OK.
      hResult = S_OK;
    }
  }while( 0 );

  RegCloseKey( hKey );       //Always attempt to close the key
  return hResult;
}

HRESULT SetValue | ( | const TCHAR * | szKey,
 |  | const TCHAR * | szValueName,
 |  | const TCHAR * | szValue
 | ) |  |

Definition at line 358 of file registry.cpp.

{
  HKEY    hKey = NULL;
  HRESULT hResult = S_FALSE;
  TCHAR szKeyBuf[1024];

  // Copy keyname into buffer.
  _tcscpy( szKeyBuf, szKey );

  do                     // We go to all this trouble to prevent any
  {                      // possibility of exiting while leaving a key open

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx( HKEY_CLASSES_ROOT ,
                                   szKeyBuf,
                                   0,
                                   NULL,
                                   REG_OPTION_NON_VOLATILE,
                                   KEY_ALL_ACCESS,
                                   NULL,
                                   &hKey,
                                   NULL
                                 );
    if( ERROR_SUCCESS != lResult )
    {
      hResult = HRESULT_FROM_WIN32( lResult );
      continue;
    }

    if( NULL != szValue )    // Now set the value
    {
      hResult = RegSetValueEx( hKey,
                               szValueName,
                               0,
                               REG_SZ,
                               (BYTE*)szValue,
                               BYTE_SIZE( szValue )
                             );
      BREAK_ON_ERROR( hResult );
    }
  }while( 0 );

  RegCloseKey( hKey );       //Always attempt to close the key
  return hResult;
}

LONG UnregisterServer ( const CLSID & clsid )

Definition at line 113 of file registry.cpp.

{
  HRESULT hResult = S_OK;

  // Allocate the CLSID string
  LPOLESTR wszCLSID = NULL ;
  hResult = StringFromCLSID( clsid, &wszCLSID );
  if( S_OK != hResult )
  {
    CoTaskMemFree( wszCLSID );
    return hResult;
  }

  // Build the key CLSID\\{...}
  TCHAR szKey[64];
  _tcscpy( szKey, _T("CLSID\\") );

  TCHAR* pszCLSID = NULL;
  W2T( &pszCLSID, wszCLSID );          // W2T is defined in Globals.h
  CoTaskMemFree( wszCLSID );           // Through with wide version

  _tcscat( szKey, pszCLSID );
  CoTaskMemFree( pszCLSID );           // Through with TCHAR version

  // Delete the CLSID Key - CLSID\{...}
  LONG lResult = RecursiveDeleteKey( HKEY_CLASSES_ROOT, szKey );
  if( ERROR_SUCCESS != lResult )
    hResult = HRESULT_FROM_WIN32( lResult );

  return hResult;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 208 of file registry.cpp.

{
  HRESULT hResult = S_OK;

  TCHAR    szKeyBuf[1024];
  LPOLESTR wszCLSID = NULL;
  TCHAR*   pszCLSID = NULL;        // Needed for TCHAR version of the ClassID

  // Get CLSID as a wide string
  hResult = StringFromCLSID( clsid, &wszCLSID );
  if( S_OK != hResult )
  {
    CoTaskMemFree( wszCLSID );
    return hResult;
  }

  W2T( &pszCLSID, wszCLSID );          // W2T is defined in Globals.h
  CoTaskMemFree( wszCLSID );           // Through with wide version

  // Load the buffer with the Snap-In Location
  _tcscpy( szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns") );

  _tcscat( szKeyBuf, _T("\\") );       // Copy keyname into buffer.
  _tcscat( szKeyBuf, pszCLSID );

  // Delete the CLSID Key - CLSID\{...}
  LONG lResult = RecursiveDeleteKey( HKEY_LOCAL_MACHINE, szKeyBuf );
  if( ERROR_SUCCESS != lResult )
    hResult = HRESULT_FROM_WIN32( lResult );

  CoTaskMemFree( pszCLSID );
  return hResult;
}

Generated on Wed Nov 13 2024 16:53:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppagex/registry.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppagex
Functions

registry.h File Reference

#include <tchar.h>

Go to the source code of this file.

Functions

HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const TCHAR *szNameString, const CLSID &clsidAbout, const BOOL fSupportExtensions=FALSE)
HRESULT | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Function Documentation

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const TCHAR * | szFriendlyName
 | ) |  |

Definition at line 51 of file registry.cpp.

{
  // Get server location.
  TCHAR    szModule[512] ;
  TCHAR*   pszCLSID = NULL;
  WCHAR*   wszCLSID = NULL ;
  HRESULT  hResult  = S_FALSE;

  DWORD dwResult = ::GetModuleFileName( hModule,
                                        szModule,
                                        sizeof(szModule)/sizeof(TCHAR)
                                      );
  if( 0 == dwResult ) return HRESULT_FROM_WIN32( dwResult );

  do                         // Fail unless we complete everything
  {
    // Get CLSID string in wide char
    hResult = StringFromCLSID( clsid, &wszCLSID ) ;
    if( S_OK != hResult )
    {
      CoTaskMemFree( wszCLSID );
      BREAK_ON_ERROR( hResult );
    }

    W2T( &pszCLSID, wszCLSID );          // W2T is defined in Globals.h
    CoTaskMemFree( wszCLSID );           // Through with wide version

    TCHAR szKey[64];                     // Build the CLSID key string CLSID\\{...}
    _tcscpy( szKey, _T("CLSID\\") );
    _tcscat( szKey, pszCLSID );

    // Add the CLSID to the registry.
    hResult = SetKeyAndValue( szKey, NULL, szFriendlyName );
    BREAK_ON_ERROR( hResult );

    // Add the server filename subkey under the CLSID key.
    hResult = SetKeyAndValue( szKey, _T("InprocServer32"), szModule );
    BREAK_ON_ERROR( hResult );

    // Set the threading model
    _tcscat( szKey, _T("\\InprocServer32") );
    hResult = SetValue( szKey, _T("ThreadingModel"), _T("Apartment") );
    BREAK_ON_ERROR( hResult );

  }while( 0 );

  CoTaskMemFree( pszCLSID );           // Through with TCHAR version

  return hResult;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | fSupportExtensions = FALSE
 | ) |  |

Definition at line 149 of file registry.cpp.

{
  HRESULT hResult = S_FALSE;
  TCHAR*  pszSnapCLSID = NULL;         // Needed for TCHAR version of the ClassID

  // If any part of this process fails, jump out of the loop and return
  // the error code
  do
  {
    // Allocate the CLSID string
    LPOLESTR wszSnapCLSID  = NULL ;
    hResult = StringFromCLSID( clsid, &wszSnapCLSID ) ;
    if( S_OK != hResult )
    {
       CoTaskMemFree( wszSnapCLSID );
       continue;
    }

    W2T( &pszSnapCLSID, wszSnapCLSID );  // W2T is defined in Globals.h
    CoTaskMemFree( wszSnapCLSID );       // Through with wide version

    // Add the Snap-in's CLSID to the registry
    hResult = SetSnapInKeyAndValue( pszSnapCLSID, NULL, _T("NameString"), szNameString );
    BREAK_ON_ERROR( hResult );

    hResult = SetSnapInKeyAndValue( pszSnapCLSID, _T("StandAlone"), NULL, NULL );
    BREAK_ON_ERROR( hResult );

    // Add registry information for ISnapinAbout if we support it
    LPOLESTR wszAboutCLSID = NULL;
    TCHAR*   pszAboutCLSID = NULL;
    if( IID_NULL != clsidAbout )
    {
      hResult = StringFromCLSID( clsidAbout, &wszAboutCLSID );
      if( S_OK != hResult )
      {
        CoTaskMemFree( wszAboutCLSID ); // Free this memory before exiting
        continue;
      }

      W2T( &pszAboutCLSID, wszAboutCLSID );
      hResult = SetSnapInKeyAndValue( pszSnapCLSID, NULL, _T("About"), pszAboutCLSID );
      CoTaskMemFree( wszAboutCLSID );
      CoTaskMemFree( pszAboutCLSID );
      BREAK_ON_ERROR( hResult );
    }

    if( TRUE == bSupportExtensions )     // Build the NodeTypesKey
    {
      hResult = SetSnapInKeyAndValue( pszSnapCLSID, _T("NodeTypes"), NULL, NULL );
      BREAK_ON_ERROR( hResult );
      TCHAR szKey[64];
      _tcscpy( szKey, pszSnapCLSID );
      _tcscat(szKey, _T("\\NodeTypes"));
      hResult = SetSnapInKeyAndValue( szKey, pszSnapCLSID, NULL, NULL );
      BREAK_ON_ERROR( hResult );
    }
  }while( 0 );

  CoTaskMemFree( pszSnapCLSID);
  return hResult;
}

HRESULT UnregisterServer ( const CLSID & clsid )

Definition at line 112 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

  MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
  _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 184 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Generated on Wed Nov 13 2024 16:53:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppagex/resource.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppagex
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_ATTR_COMPRESSED 1010
#define | IDC_ATTR_ENCRYPTED 1011
#define | IDD_PPAGE0 111
#define | IDD_VFILE_PPAGE0 111

Define Documentation

#define IDC_ATTR_COMPRESSED 1010

Definition at line 7 of file resource.h.

#define IDC_ATTR_ENCRYPTED 1011

Definition at line 8 of file resource.h.

#define IDD_PPAGE0 111

Definition at line 6 of file resource.h.

#define IDD_VFILE_PPAGE0 111

Definition at line 5 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppagex/tracemacro.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppagex
Functions

tracemacro.cpp File Reference

#include "Globals.h"
#include "TraceMacro.h"
#include <StdIo.h>

Go to the source code of this file.

Functions

VOID | MapEvent (LONG Event, LPTSTR szEventStr)
VOID | Trace_Event (LPCTSTR pszClass, LPCTSTR pszFunction, LONG nEvent)
VOID | Trace_HR (LPCTSTR pszClass, LPCTSTR pszFunction, HRESULT hr)
VOID | Trace_Start (LPCTSTR pszClass, LPCTSTR pszFunction)
VOID | Trace_Value (LPCTSTR pszClass, LPCTSTR pszFunction, LPCTSTR pszValueName, LONG nValue)

Function Documentation

VOID MapEvent | ( | LONG | Event,
 |  | LPTSTR | szEventStr
 | ) |  |

Definition at line 147 of file tracemacro.cpp.

{
#ifdef _DEBUG

  switch( Event )
  {
    case 0x8001:
      _tcscpy( szEventStr, _T("MMCN_ACTIVATE       ") );
      break;

    case 0x8002:
      _tcscpy( szEventStr, _T("MMCN_ADD_IMAGES     ") );
      break;

    case 0x8003:
      _tcscpy( szEventStr, _T("MMCN_BTN_CLICK      ") );
      break;

    case 0x8004:
      _tcscpy( szEventStr, _T("MMCN_CLICK          ") );
      break;

    case 0x8005:
      _tcscpy( szEventStr, _T("MMCN_COLUMN_CLICK   ") );
      break;

    case 0x8006:
      _tcscpy( szEventStr, _T("MMCN_CONTEXTMENU    ") );
      break;

    case 0x8007:
      _tcscpy( szEventStr, _T("MMCN_CUTORMOVE      ") );
      break;

    case 0x8008:
      _tcscpy( szEventStr, _T("MMCN_DBLCLICK       ") );
      break;

    case 0x8009:
      _tcscpy( szEventStr, _T("MMCN_DELETE         ") );
      break;

    case 0x800A:
      _tcscpy( szEventStr, _T("MMCN_DESELECT_ALL   ") );
      break;

    case 0x800B:
      _tcscpy( szEventStr, _T("MMCN_EXPAND         ") );
      break;

    case 0x800C:
      _tcscpy( szEventStr, _T("MMCN_HELP           ") );
      break;

    case 0x800D:
      _tcscpy( szEventStr, _T("MMCN_MENU_BTNCLICK  ") );
      break;

    case 0x800E:
      _tcscpy( szEventStr, _T("MMCN_MINIMIZED      ") );
      break;

    case 0x800F:
      _tcscpy( szEventStr, _T("MMCN_PASTE          ") );
      break;

    case 0x8010:
      _tcscpy( szEventStr, _T("MMCN_PROPERTY_CHANGE") );
      break;

    case 0x8011:
      _tcscpy( szEventStr, _T("MMCN_QUERY_PASTE    ") );
      break;

    case 0x8012:
      _tcscpy( szEventStr, _T("MMCN_REFRESH        ") );
      break;

    case 0x8013:
      _tcscpy( szEventStr, _T("MMCN_REMOVE_CHILDREN") );
      break;

    case 0x8014:
      _tcscpy( szEventStr, _T("MMCN_RENAME         ") );
      break;

    case 0x8015:
      _tcscpy( szEventStr, _T("MMCN_SELECT         ") );
      break;

    case 0x8016:
      _tcscpy( szEventStr, _T("MMCN_SHOW           ") );
      break;

    case 0x8017:
      _tcscpy( szEventStr, _T("MMCN_VIEW_CHANGE    ") );
      break;

    case 0x8018:
      _tcscpy( szEventStr, _T("MMCN_SNAPINHELP     ") );
      break;

    case 0x8019:
      _tcscpy( szEventStr, _T("MMCN_CONTEXTHELP    ") );
      break;

    case 0x801A:
      _tcscpy( szEventStr, _T("MMCN_INITOCX        ") );
      break;

    case 0x8021:
      _tcscpy( szEventStr, _T("MMCN_EXPANDSYNC     ") );
      break;

    default:
      _stprintf( szEventStr, _T("0x%X"), Event );
      break;
  }

#endif
} //end MapEvent()

VOID Trace_Event | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LONG | nEvent
 | ) |  |

Definition at line 87 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szEventStr[22];
  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Event = %s\n");
  INT    nChars     = 0;

  MapEvent( nEvent, szEventStr );

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      szEventStr
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Event()

VOID Trace_HR | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | HRESULT | hr
 | ) |  |

Definition at line 28 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Returned 0x%X\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer, szFormat, pszClass, pszFunction, hr );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_HR()

VOID Trace_Start | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction
 | ) |  |

Definition at line 119 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Started \n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Start()

VOID Trace_Value | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LPCTSTR | pszValueName,
 |  | LONG | nValue
 | ) |  |

Definition at line 54 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> %s = %u\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      pszValueName,
                      nValue
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Value()

Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/proppagex/tracemacro.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • proppagex
Defines | Functions

tracemacro.h File Reference

Go to the source code of this file.

Defines

#define | TRACE_EVENT
#define | TRACE_HRESULT
#define | TRACE_START
#define | TRACE_VAL

Functions

VOID | MapEvent (LONG Event, LPTSTR szEventStr)
VOID | Trace_Event (LPCTSTR pszClass, LPCTSTR pszFunction, LONG nEvent)
VOID | Trace_HR (LPCTSTR pszClass, LPCTSTR pszFunction, HRESULT hr)
VOID | Trace_Start (LPCTSTR pszClass, LPCTSTR pszFunction)
VOID | Trace_Value (LPCTSTR pszClass, LPCTSTR pszFunction, LPCTSTR pszValueName, LONG Value)

Define Documentation

#define TRACE_EVENT

Definition at line 57 of file tracemacro.h.

#define TRACE_HRESULT

Definition at line 51 of file tracemacro.h.

#define TRACE_START

Definition at line 60 of file tracemacro.h.

#define TRACE_VAL

Definition at line 54 of file tracemacro.h.

Function Documentation

VOID MapEvent | ( | LONG | Event,
 |  | LPTSTR | szEventStr
 | ) |  |

Definition at line 146 of file tracemacro.cpp.

{
#ifdef _DEBUG

  switch( Event )
  {
    case 0x8001:
      _tcscpy( szEventStr, _T("MMCN_ACTIVATE       ") );
      break;

    case 0x8002:
      _tcscpy( szEventStr, _T("MMCN_ADD_IMAGES     ") );
      break;

    case 0x8003:
      _tcscpy( szEventStr, _T("MMCN_BTN_CLICK      ") );
      break;

    case 0x8004:
      _tcscpy( szEventStr, _T("MMCN_CLICK          ") );
      break;

    case 0x8005:
      _tcscpy( szEventStr, _T("MMCN_COLUMN_CLICK   ") );
      break;

    case 0x8006:
      _tcscpy( szEventStr, _T("MMCN_CONTEXTMENU    ") );
      break;

    case 0x8007:
      _tcscpy( szEventStr, _T("MMCN_CUTORMOVE      ") );
      break;

    case 0x8008:
      _tcscpy( szEventStr, _T("MMCN_DBLCLICK       ") );
      break;

    case 0x8009:
      _tcscpy( szEventStr, _T("MMCN_DELETE         ") );
      break;

    case 0x800A:
      _tcscpy( szEventStr, _T("MMCN_DESELECT_ALL   ") );
      break;

    case 0x800B:
      _tcscpy( szEventStr, _T("MMCN_EXPAND         ") );
      break;

    case 0x800C:
      _tcscpy( szEventStr, _T("MMCN_HELP           ") );
      break;

    case 0x800D:
      _tcscpy( szEventStr, _T("MMCN_MENU_BTNCLICK  ") );
      break;

    case 0x800E:
      _tcscpy( szEventStr, _T("MMCN_MINIMIZED      ") );
      break;

    case 0x800F:
      _tcscpy( szEventStr, _T("MMCN_PASTE          ") );
      break;

    case 0x8010:
      _tcscpy( szEventStr, _T("MMCN_PROPERTY_CHANGE") );
      break;

    case 0x8011:
      _tcscpy( szEventStr, _T("MMCN_QUERY_PASTE    ") );
      break;

    case 0x8012:
      _tcscpy( szEventStr, _T("MMCN_REFRESH        ") );
      break;

    case 0x8013:
      _tcscpy( szEventStr, _T("MMCN_REMOVE_CHILDREN") );
      break;

    case 0x8014:
      _tcscpy( szEventStr, _T("MMCN_RENAME         ") );
      break;

    case 0x8015:
      _tcscpy( szEventStr, _T("MMCN_SELECT         ") );
      break;

    case 0x8016:
      _tcscpy( szEventStr, _T("MMCN_SHOW           ") );
      break;

    case 0x8017:
      _tcscpy( szEventStr, _T("MMCN_VIEW_CHANGE    ") );
      break;

    case 0x8018:
      _tcscpy( szEventStr, _T("MMCN_SNAPINHELP     ") );
      break;

    case 0x8019:
      _tcscpy( szEventStr, _T("MMCN_CONTEXTHELP    ") );
      break;

    case 0x801A:
      _tcscpy( szEventStr, _T("MMCN_INITOCX        ") );
      break;

    case 0x8021:
      _tcscpy( szEventStr, _T("MMCN_EXPANDSYNC     ") );
      break;

    default:
      _stprintf( szEventStr, _T("0x%X"), Event );
      break;
  }

#endif
} //end MapEvent()

VOID Trace_Event | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LONG | nEvent
 | ) |  |

Definition at line 86 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szEventStr[22];
  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Event = %s\n");
  INT    nChars     = 0;

  MapEvent( nEvent, szEventStr );

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      szEventStr
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Event()

VOID Trace_HR | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | HRESULT | hr
 | ) |  |

Definition at line 27 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Returned 0x%X\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer, szFormat, pszClass, pszFunction, hr );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_HR()

VOID Trace_Start | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction
 | ) |  |

Definition at line 118 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Started \n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Start()

VOID Trace_Value | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LPCTSTR | pszValueName,
 |  | LONG | Value
 | ) |  |

Definition at line 53 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> %s = %u\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      pszValueName,
                      nValue
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Value()

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/simple/basenode.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • simple
Classes | Defines | Typedefs

basenode.h File Reference

#include "Globals.h"
#include "Resource.h"
#include "Globals.h"
#include "Resource.h"

Go to the source code of this file.

Classes

class | CBaseNode
struct | tag_BASENODE_PROPERTIES

Defines

#define | DEFAULT_RDI_MASK (RDI_STR | RDI_PARAM | RDI_IMAGE)
#define | DEFAULT_SDI_MASK (SDI_STR | SDI_PARAM | SDI_IMAGE | SDI_OPENIMAGE | SDI_PARENT | SDI_CHILDREN)
#define | MAX_NAME_LEN 64

Typedefs

typedef NODE_PROPERTIES * | LPNODE_PROPERTIES
typedef struct
tag_BASENODE_PROPERTIES 		NODE_PROPERTIES

Define Documentation

#define DEFAULT_RDI_MASK (RDI_STR | RDI_PARAM | RDI_IMAGE)

Definition at line 24 of file basenode.h.

#define DEFAULT_SDI_MASK (SDI_STR | SDI_PARAM | SDI_IMAGE | SDI_OPENIMAGE | SDI_PARENT | SDI_CHILDREN)

Definition at line 23 of file basenode.h.

#define MAX_NAME_LEN 64

Definition at line 26 of file basenode.h.

Typedef Documentation

typedef NODE_PROPERTIES* LPNODE_PROPERTIES

Definition at line 39 of file basenode.h.

typedef struct tag_BASENODE_PROPERTIES NODE_PROPERTIES
Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/simple/basesnap.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • simple
Functions

basesnap.cpp File Reference

#include <ObjBase.h>
#include <InitGuid.h>
#include "Guids.h"
#include "BaseSnap.h"
#include "Comp.h"
#include "CompData.h"
#include "Registry.h"
#include "Globals.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)
BOOL WINAPI | DllMain (HINSTANCE hInstDLL, DWORD fdwReason, void *lpvReserved)
STDAPI | DllRegisterServer ()
STDAPI | DllUnregisterServer ()
STDMETHODIMP_ (ULONG) CClassFactory

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 198 of file basesnap.cpp.

{
  if( 0 == g_uObjectCount && 0 == g_uServerLocks )
    return S_OK;
  else
    return S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 168 of file basesnap.cpp.

{
  if( rclsid != CLSID_CComponentData )
    return CLASS_E_CLASSNOTAVAILABLE;

  if( !ppvObj )
    return E_FAIL;

  *ppvObj = NULL;

  // We can only hand out IUnknown and IClassFactory pointers.  Fail
  // if they ask for anything else.
  if( !IsEqualIID(riid, IID_IUnknown) && !IsEqualIID(riid, IID_IClassFactory) )
    return E_NOINTERFACE;

  CClassFactory *pFactory = new CClassFactory();
  if( NULL == pFactory )
    return E_OUTOFMEMORY;

  HRESULT hResult = pFactory->QueryInterface( riid, ppvObj );

  return hResult;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstDLL,
 |  | DWORD | fdwReason,
 |  | void * | lpvReserved
 | ) |  |

Definition at line 151 of file basesnap.cpp.

{
  if( DLL_PROCESS_ATTACH == fdwReason )
  {
     g_hInst = hInstDLL;
  }

  return TRUE;
}

STDAPI DllRegisterServer ( void )

Definition at line 208 of file basesnap.cpp.

{
  if( S_OK == RegisterServer( g_hInst, CLSID_CComponentData, gtszSNAPIN_NAME) )
    return RegisterSnapin( CLSID_CComponentData, gtszSNAPIN_NAME, IID_NULL, FALSE );
  else
    return E_FAIL;
}

STDAPI DllUnregisterServer ( void )

Definition at line 218 of file basesnap.cpp.

{
  if( S_OK == UnregisterServer(CLSID_CComponentData) )
    return UnregisterSnapin(CLSID_CComponentData);
  else
    return E_FAIL;
}

STDMETHODIMP_ ( ULONG )

Definition at line 84 of file basesnap.cpp.

{
  if( 0 == InterlockedDecrement( (long*)&m_cRef) )
  {
    delete this;
    return 0;
  }
  return m_cRef;
}

Generated on Wed Nov 13 2024 16:54:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/simple/basesnap.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • simple
Classes | Functions

basesnap.h File Reference

Go to the source code of this file.

Classes

class | CClassFactory

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 53 of file ComSpyAudit.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 61 of file ComSpyAudit.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

Generated on Wed Nov 13 2024 16:54:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/simple/comp.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • simple
Defines | Functions

comp.cpp File Reference

#include "Comp.h"
#include "CompData.h"
#include "DataObj.h"
#include "Resource.h"
#include "StaticNode.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CComponent")

Functions

STDMETHODIMP_ (ULONG) CComponent

Define Documentation

#define MODULESTRING _T("CComponent")

Definition at line 24 of file comp.cpp.

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 88 of file comp.cpp.

{
  if( InterlockedDecrement((LONG*)&m_cRef) == 0 )
  {
    delete this;
    return 0;
  }
  return m_cRef;
}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/simple/comp.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • simple
Classes

comp.h File Reference

#include "Globals.h"

Go to the source code of this file.

Classes

class CComponent
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/simple/compdata.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • simple
Defines | Functions

compdata.cpp File Reference

#include "Comp.h"
#include "CompData.h"
#include "DataObj.h"
#include "Resource.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CComponentData")

Functions

STDMETHODIMP_ (ULONG) CComponentData

Define Documentation

#define MODULESTRING _T("CComponentData")

Definition at line 22 of file compdata.cpp.

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 99 of file compdata.cpp.

{
  if( InterlockedDecrement((LONG*)&m_cRef) == 0 )
  {
    delete this;
    return 0;
  }

  return m_cRef;
}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/simple/compdata.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • simple
Classes

compdata.h File Reference

#include <ObjIdl.h>
#include "Globals.h"
#include "StaticNode.h"
#include "Comp.h"
#include "StaticNode.h"

Go to the source code of this file.

Classes

class CComponentData
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/simple/dataobj.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • simple
Functions

dataobj.cpp File Reference

#include "DataObj.h"
#include "Guids.h"
#include "StaticNode.h"
#include "globals.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CDataObject

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 71 of file dataobj.cpp.

{
    if (InterlockedDecrement((LONG *)&m_cRef) == 0)
    {
        delete this;
        return 0;
    }
    return m_cRef;

}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/simple/dataobj.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • simple
Classes

dataobj.h File Reference

#include "Globals.h"
#include "StaticNode.h"

Go to the source code of this file.

Classes

class CDataObject
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/simple/globals.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • simple
Functions | Variables

globals.cpp File Reference

#include "Globals.h"

Go to the source code of this file.

Functions

void | InitClipboardFormats ()
void _fastcall | Unicode2Ansi (CHAR **pszAnsi, WCHAR *szWide)

Variables

UINT | g_cfDisplayName = 0
UINT | g_cfNodeType = 0
UINT | g_cfSnapinClsid = 0
UINT | g_cfszNodeType = 0
HINSTANCE | g_hInst = NULL
ULONG | g_uObjectCount = 0
ULONG | g_uServerLocks = 0

Function Documentation

void InitClipboardFormats ( )

Definition at line 53 of file globals.cpp.

{
  g_cfDisplayName  = RegisterClipboardFormat( T_CCF_DISPLAY_NAME );
  g_cfNodeType     = RegisterClipboardFormat( T_CCF_NODETYPE );
  g_cfszNodeType   = RegisterClipboardFormat( T_CCF_SZNODETYPE );
  g_cfSnapinClsid  = RegisterClipboardFormat( T_CCF_SNAPIN_CLASSID );

}

void _fastcall Unicode2Ansi | ( | CHAR ** | pszAnsi,
 |  | WCHAR * | szWide
 | ) |  |

Definition at line 35 of file globals.cpp.

{
  SIZE_T nLen = wcslen( szWide ) +1;
  *pszAnsi = (char*)CoTaskMemAlloc( nLen );
  char* pCounter = *pszAnsi;

  while( *szWide )
  {
    *pCounter = LOBYTE(*szWide);
    pCounter++;
    szWide++;
  }
  *pCounter = NULL;
}

Variable Documentation

UINT g_cfDisplayName = 0

Definition at line 19 of file globals.cpp.

UINT g_cfNodeType = 0

Definition at line 20 of file globals.cpp.

UINT g_cfSnapinClsid = 0

Definition at line 22 of file globals.cpp.

UINT g_cfszNodeType = 0

Definition at line 21 of file globals.cpp.

HINSTANCE g_hInst = NULL

Definition at line 24 of file globals.cpp.

ULONG g_uObjectCount = 0

Definition at line 25 of file globals.cpp.

ULONG g_uServerLocks = 0

Definition at line 26 of file globals.cpp.

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/simple/globals.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • simple
Defines | Functions | Variables

globals.h File Reference

#include <Tchar.h>
#include <Mmc.h>
#include <CrtDbg.h>

Go to the source code of this file.

Defines

#define | BREAK_ON_ERROR(hResult) if( S_OK != hResult ) continue
#define | BYTE_SIZE(string) ((_tcslen(string)+1) * sizeof(TCHAR))
#define | NODETYPE_STATIC 100;
#define | T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")
#define | T_CCF_NODETYPE _T("CCF_NODETYPE")
#define | T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")
#define | T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")
#define | W2T(pszAnsi, szWide) Unicode2Ansi( pszAnsi, szWide )

Functions

void | InitClipboardFormats ()
template<class TYPE >
void | SAFE_RELEASE (TYPE *&pObj)
void _fastcall | Unicode2Ansi (CHAR **pszAnsi, WCHAR *szWide)

Variables

UINT g_cfDisplayName
UINT g_cfNodeType
UINT g_cfSnapinClsid
UINT g_cfszNodeType
HINSTANCE | g_hInst
ULONG g_uObjectCount
ULONG g_uServerLocks

Define Documentation

#define BREAK_ON_ERROR ( hResult ) if( S_OK != hResult ) continue

Definition at line 78 of file globals.h.

#define BYTE_SIZE ( string ) ((_tcslen(string)+1) * sizeof(TCHAR))

Definition at line 76 of file globals.h.

#define NODETYPE_STATIC 100;

Definition at line 70 of file globals.h.

#define T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")

Definition at line 59 of file globals.h.

#define T_CCF_NODETYPE _T("CCF_NODETYPE")

Definition at line 60 of file globals.h.

#define T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")

Definition at line 62 of file globals.h.

#define T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")

Definition at line 61 of file globals.h.

#define W2T | ( | pszAnsi,
 |  | szWide |
 | ) |  | Unicode2Ansi( pszAnsi, szWide )

Definition at line 103 of file globals.h.

Function Documentation

void InitClipboardFormats ( )

Definition at line 56 of file globals.cpp.

{
  g_cfDisplayName  = RegisterClipboardFormat( T_CCF_DISPLAY_NAME );
  g_cfNodeType     = RegisterClipboardFormat( T_CCF_NODETYPE );
  g_cfszNodeType   = RegisterClipboardFormat( T_CCF_SZNODETYPE );
  g_cfSnapinClsid  = RegisterClipboardFormat( T_CCF_SNAPIN_CLASSID );

}

template<class TYPE >
void SAFE_RELEASE ( TYPE *& pObj ) [inline]

Definition at line 83 of file globals.h.

{
  if( NULL != pObj )
  {
    pObj->Release();
    pObj = NULL;
  }
  else
  {
    OutputDebugString(_T("Attempted to release NULL Com pointer.\n"));
  }
} // end SAFE_RELEASE()

void _fastcall Unicode2Ansi | ( | CHAR ** | pszAnsi,
 |  | WCHAR * | szWide
 | ) |  |

Definition at line 38 of file globals.cpp.

{
  LONG nLen = wcslen( szWide ) +1;
  *pszAnsi = (char*)CoTaskMemAlloc( nLen );
  char* pCounter = *pszAnsi;

  while( *szWide )
  {
    *pCounter = LOBYTE(*szWide);
    pCounter++;
    szWide++;
  }
  *pCounter = NULL;
}

Variable Documentation

UINT g_cfDisplayName

Definition at line 19 of file globals.cpp.

UINT g_cfNodeType

Definition at line 20 of file globals.cpp.

UINT g_cfSnapinClsid

Definition at line 22 of file globals.cpp.

UINT g_cfszNodeType

Definition at line 21 of file globals.cpp.

HINSTANCE g_hInst

Definition at line 62 of file DoServer.Cpp.

ULONG g_uObjectCount

Definition at line 28 of file globals.cpp.

ULONG g_uServerLocks

Definition at line 29 of file globals.cpp.

Generated on Wed Nov 13 2024 16:54:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/simple/guids.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • simple
Functions

guids.h File Reference

Go to the source code of this file.

Functions

DEFINE_GUID (CLSID_CComponentData, 0xb34986d8, 0x8dca, 0x4b10, 0x97, 0xd5, 0x4b, 0xe6, 0xda, 0x99, 0x78, 0x78)

Function Documentation

DEFINE_GUID | ( | CLSID_CComponentData | ,
 |  | 0xb34986d8 | ,
 |  | 0x8dca | ,
 |  | 0x4b10 | ,
 |  | 0x97 | ,
 |  | 0xd5 | ,
 |  | 0x4b | ,
 |  | 0xe6 | ,
 |  | 0xda | ,
 |  | 0x99 | ,
 |  | 0x78 | ,
 |  | 0x78 |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/simple/registry.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • simple
Functions

registry.cpp File Reference

#include <ObjBase.h>
#include "Registry.h"
#include "Globals.h"

Go to the source code of this file.

Functions

HRESULT | RecursiveDeleteKey (HKEY hKeyParent, const TCHAR *szKeyChild)
HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const TCHAR *szNameString, const CLSID &clsidAbout, const BOOL bSupportExtensions)
HRESULT | SetKeyAndValue (const TCHAR *pszPath, const TCHAR *szSubkey, const TCHAR *szValue)
HRESULT | SetSnapInKeyAndValue (const TCHAR *szKey, const TCHAR *szSubkey, const TCHAR *szName, const TCHAR *szValue)
HRESULT | SetValue (const TCHAR *szKey, const TCHAR *szValueName, const TCHAR *szValue)
LONG | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Function Documentation

HRESULT RecursiveDeleteKey | ( | HKEY | hKeyParent,
 |  | const TCHAR * | szKeyChild
 | ) |  |

Definition at line 246 of file registry.cpp.

{
  // Open the child.
  HKEY hKeyChild = NULL;
  LONG lResult   = ERROR_SUCCESS;

  do                     // We go to all this trouble to prevent any
  {                      // possibility of exiting while leaving a key open

    lResult = RegOpenKeyEx( hKeyParent,
                            lpszKeyChild,
                            0,
                            KEY_ALL_ACCESS,
                            &hKeyChild
                          );
    if( ERROR_SUCCESS != lResult )
      continue;

    // Enumerate all of the decendents of this child.
    FILETIME time;
    _TCHAR szBuffer[256];
    DWORD dwSize = 256;
    while( S_OK == RegEnumKeyEx(hKeyChild,0,szBuffer,&dwSize,NULL,NULL,NULL,&time) )
    {
      // Delete the decendents of this child.
      lResult = RecursiveDeleteKey( hKeyChild, szBuffer );
      if( ERROR_SUCCESS != lResult )
      {
        continue;
      }
      dwSize = 256 ;
    }
  }while( 0 );

  RegCloseKey( hKeyChild );            // Always try to close the child
                                       // then delete this child.
  return RegDeleteKey( hKeyParent, lpszKeyChild );
}

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const TCHAR * | szFriendlyName
 | ) |  |

Definition at line 45 of file registry.cpp.

{
  // Get server location.
  TCHAR szModule[512] ;
  DWORD dwResult = ::GetModuleFileName( hModule,
                                        szModule,
                                        sizeof(szModule)/sizeof(TCHAR)
                                      );
  if( 0 == dwResult ) return HRESULT_FROM_WIN32( dwResult );

  // Get CLSID string in wide char
  LPOLESTR wszCLSID = NULL ;
  HRESULT hResult = StringFromCLSID( clsid, &wszCLSID ) ;
  if( S_OK != hResult )
  {
    CoTaskMemFree( wszCLSID );
    return hResult;
  }

  TCHAR* pszCLSID = NULL;
  W2T( &pszCLSID, wszCLSID );          // W2T is defined in Globals.h
  CoTaskMemFree( wszCLSID );           // Through with wide version

  TCHAR szKey[64];                     // Build the CLSID key string CLSID\\{...}
  _tcscpy( szKey, _T("CLSID\\") );
  _tcscat( szKey, pszCLSID );
  CoTaskMemFree( pszCLSID );           // Through with TCHAR version

  // Add the CLSID to the registry.
  SetKeyAndValue( szKey, NULL, szFriendlyName );

  // Add the server filename subkey under the CLSID key.
  SetKeyAndValue( szKey, _T("InprocServer32"), szModule );

  // Set the threading model
  _tcscat( szKey, _T("\\InprocServer32") );
  SetValue( szKey, _T("ThreadingModel"), _T("Apartment") );

  return S_OK ;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | bSupportExtensions
 | ) |  |

Definition at line 133 of file registry.cpp.

{
  HRESULT hResult = S_FALSE;
  TCHAR*  pszSnapCLSID = NULL;         // Needed for TCHAR version of the ClassID

  // If any part of this process fails, jump out of the loop and return
  // the error code
  do
  {
    // Allocate the CLSID string
    LPOLESTR wszSnapCLSID  = NULL ;
    hResult = StringFromCLSID( clsid, &wszSnapCLSID ) ;
    if( S_OK != hResult )
    {
       CoTaskMemFree( wszSnapCLSID );
       continue;
    }

    W2T( &pszSnapCLSID, wszSnapCLSID );  // W2T is defined in Globals.h
    CoTaskMemFree( wszSnapCLSID );       // Through with wide version

    // Add the Snap-in's CLSID to the registry
    hResult = SetSnapInKeyAndValue( pszSnapCLSID, NULL, _T("NameString"), szNameString );
    BREAK_ON_ERROR( hResult );

    hResult = SetSnapInKeyAndValue( pszSnapCLSID, _T("StandAlone"), NULL, NULL );
    BREAK_ON_ERROR( hResult );

    // Add registry information for ISnapinAbout if we support it
    LPOLESTR wszAboutCLSID = NULL;
    TCHAR*   pszAboutCLSID = NULL;
    if( IID_NULL != clsidAbout )
    {
      hResult = StringFromCLSID( clsidAbout, &wszAboutCLSID );
      if( S_OK != hResult )
      {
        CoTaskMemFree( wszAboutCLSID ); // Free this memory before exiting
        continue;
      }

      W2T( &pszAboutCLSID, wszAboutCLSID );
      hResult = SetSnapInKeyAndValue( pszAboutCLSID, NULL, _T("About"), pszAboutCLSID );
      CoTaskMemFree( wszAboutCLSID );
      CoTaskMemFree( pszAboutCLSID );
      BREAK_ON_ERROR( hResult );
   }

    if( TRUE == bSupportExtensions )     // Build the NodeTypesKey
    {
      hResult = SetSnapInKeyAndValue( pszSnapCLSID, _T("NodeTypes"), NULL, NULL );
      BREAK_ON_ERROR( hResult );
      TCHAR szKey[64];
      _tcscpy( szKey, pszSnapCLSID );
      _tcscat(szKey, _T("\\NodeTypes"));
      hResult = SetSnapInKeyAndValue( szKey, pszSnapCLSID, NULL, NULL );
      BREAK_ON_ERROR( hResult );
    }
  }while( 0 );

  CoTaskMemFree( pszSnapCLSID);
  return hResult;
}

HRESULT SetKeyAndValue | ( | const TCHAR * | pszPath,
 |  | const TCHAR * | szSubkey,
 |  | const TCHAR * | szValue
 | ) |  |

Definition at line 294 of file registry.cpp.

{
  HKEY hKey = NULL;
  HRESULT hResult = S_FALSE;
  TCHAR szKeyBuf[1024];

  // Copy keyname into buffer.
  _tcscpy( szKeyBuf, szKey );

  // Add subkey name to buffer.
  if( NULL != szSubkey )
  {
    _tcscat( szKeyBuf, _T("\\") );
    _tcscat( szKeyBuf, szSubkey );
  }

  do                     // We go to all this trouble to prevent any
  {                      // possibility of exiting while leaving a key open

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx( HKEY_CLASSES_ROOT,
                                   szKeyBuf,
                                   0,
                                   NULL,
                                   REG_OPTION_NON_VOLATILE,
                                   KEY_ALL_ACCESS,
                                   NULL,
                                   &hKey,
                                   NULL
                                 );
    if( ERROR_SUCCESS != lResult )
    {
      hResult = HRESULT_FROM_WIN32( lResult );
      continue;
    }

    if( NULL != szValue )    // Now set the value
    {
      hResult = RegSetValueEx( hKey,
                               NULL,
                               0,
                               REG_SZ,
                               (BYTE*)szValue,
                               BYTE_SIZE( szValue )    // BYTE_SIZE is in Globals.h
                             );
      BREAK_ON_ERROR( hResult );
    }
  }while( 0 );

  RegCloseKey( hKey );       // Always try to close the key
  return hResult;
}

HRESULT SetSnapInKeyAndValue | ( | const TCHAR * | szKey,
 |  | const TCHAR * | szSubkey,
 |  | const TCHAR * | szName,
 |  | const TCHAR * | szValue
 | ) |  |

Definition at line 413 of file registry.cpp.

{
  HKEY    hKey = NULL;
  HRESULT hResult = S_FALSE;
  TCHAR  szKeyBuf[1024];

  // Load the buffer with the Snap-In Location
  _tcscpy( szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns") );

  _tcscat( szKeyBuf, _T("\\") );       // Copy keyname into buffer.
  _tcscat( szKeyBuf, szKey );

  if( NULL != szSubkey )               // Add subkey name to buffer.
  {
    _tcscat( szKeyBuf, _T("\\") );
    _tcscat( szKeyBuf, szSubkey );
  }

  do                     // We go to all this trouble to prevent any
  {                      // possibility of exiting while leaving a key open

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx( HKEY_LOCAL_MACHINE,
                                   szKeyBuf,
                                   0,
                                   NULL,
                                   REG_OPTION_NON_VOLATILE,
                                   KEY_ALL_ACCESS,
                                   NULL,
                                   &hKey,
                                   NULL
                                 );
    if( ERROR_SUCCESS != lResult )     // Will return S_FALSE
      continue;

    // Set the Value.
    if( szValue != NULL )
    {
      hResult = RegSetValueEx( hKey,
                               szName,
                               0,
                               REG_SZ,
                               (BYTE*)szValue,
                               BYTE_SIZE(szValue)
                             );
      BREAK_ON_ERROR( hResult );
    }
    else
    {                        // If we got this far then everthing
      hResult = S_OK;        // must be OK
    }
  }while( 0 );

  RegCloseKey( hKey );       //Always attempt to close the key
  return hResult;
}

HRESULT SetValue | ( | const TCHAR * | szKey,
 |  | const TCHAR * | szValueName,
 |  | const TCHAR * | szValue
 | ) |  |

Definition at line 356 of file registry.cpp.

{
  HKEY    hKey = NULL;
  HRESULT hResult = S_FALSE;
  TCHAR szKeyBuf[1024];

  // Copy keyname into buffer.
  _tcscpy( szKeyBuf, szKey );

  do                     // We go to all this trouble to prevent any
  {                      // possibility of exiting while leaving a key open

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx( HKEY_CLASSES_ROOT ,
                                   szKeyBuf,
                                   0,
                                   NULL,
                                   REG_OPTION_NON_VOLATILE,
                                   KEY_ALL_ACCESS,
                                   NULL,
                                   &hKey,
                                   NULL
                                 );
    if( ERROR_SUCCESS != lResult )
    {
      hResult = HRESULT_FROM_WIN32( lResult );
      continue;
    }

    if( NULL != szValue )    // Now set the value
    {
      hResult = RegSetValueEx( hKey,
                               szValueName,
                               0,
                               REG_SZ,
                               (BYTE*)szValue,
                               BYTE_SIZE( szValue )
                             );
      BREAK_ON_ERROR( hResult );
    }
  }while( 0 );

  RegCloseKey( hKey );       //Always attempt to close the key
  return hResult;
}

LONG UnregisterServer ( const CLSID & clsid )

Definition at line 95 of file registry.cpp.

{
  HRESULT hResult = S_OK;

  // Allocate the CLSID string
  LPOLESTR wszCLSID = NULL ;
  hResult = StringFromCLSID( clsid, &wszCLSID );
  if( S_OK != hResult )
  {
    CoTaskMemFree( wszCLSID );
    return hResult;
  }

  // Build the key CLSID\\{...}
  TCHAR szKey[64];
  _tcscpy( szKey, _T("CLSID\\") );

  TCHAR* pszCLSID = NULL;
  W2T( &pszCLSID, wszCLSID );          // W2T is defined in Globals.h
  CoTaskMemFree( wszCLSID );           // Through with wide version

  _tcscat( szKey, pszCLSID );
  CoTaskMemFree( pszCLSID );           // Through with TCHAR version

  // Delete the CLSID Key - CLSID\{...}
  LONG lResult = RecursiveDeleteKey( HKEY_CLASSES_ROOT, szKey );
  if( ERROR_SUCCESS != lResult )
    hResult = HRESULT_FROM_WIN32( lResult );

  return hResult;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 206 of file registry.cpp.

{
  HRESULT hResult = S_OK;

  TCHAR    szKeyBuf[1024];
  LPOLESTR wszCLSID = NULL;
  TCHAR*   pszCLSID = NULL;        // Needed for TCHAR version of the ClassID

  // Get CLSID as a wide string
  hResult = StringFromCLSID( clsid, &wszCLSID );
  if( S_OK != hResult )
  {
    CoTaskMemFree( wszCLSID );
    return hResult;
  }

  W2T( &pszCLSID, wszCLSID );          // W2T is defined in Globals.h
  CoTaskMemFree( wszCLSID );           // Through with wide version

  // Load the buffer with the Snap-In Location
  _tcscpy( szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns") );

  _tcscat( szKeyBuf, _T("\\") );       // Copy keyname into buffer.
  _tcscat( szKeyBuf, pszCLSID );

  // Delete the CLSID Key - CLSID\{...}
  LONG lResult = RecursiveDeleteKey( HKEY_LOCAL_MACHINE, szKeyBuf );
  if( ERROR_SUCCESS != lResult )
    hResult = HRESULT_FROM_WIN32( lResult );

  CoTaskMemFree( pszCLSID );
  return hResult;
}

Generated on Wed Nov 13 2024 16:53:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/simple/registry.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • simple
Functions

registry.h File Reference

#include <tchar.h>

Go to the source code of this file.

Functions

HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const _TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const _TCHAR *szNameString, const CLSID &clsidAbout, const BOOL fSupportExtensions=FALSE)
HRESULT | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Function Documentation

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const _TCHAR * | szFriendlyName
 | ) |  |

Definition at line 67 of file registry.Cpp.

{
    // Get server location.
    _TCHAR szModule[512] ;
    DWORD dwResult =
        ::GetModuleFileName(hModule,
        szModule,
        sizeof(szModule)/sizeof(_TCHAR)) ;

    assert(dwResult != 0) ;

    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    assert(SUCCEEDED(hr)) ;

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;
  _tcscat(szKey, pszCLSID) ;

    // Add the CLSID to the registry.
    setKeyAndValue(szKey, NULL, szFriendlyName) ;

    // Add the server filename subkey under the CLSID key.
    setKeyAndValue(szKey, _T("InprocServer32"), szModule) ;

    // set the threading model
    _tcscat(szKey, _T("\\InprocServer32"));
    setValue(szKey, _T("ThreadingModel"), _T("Apartment"));

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const _TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | fSupportExtensions = FALSE
 | ) |  |

Definition at line 140 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    LPOLESTR wszAboutCLSID = NULL;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    if (IID_NULL != clsidAbout)
        hr = StringFromCLSID(clsidAbout, &wszAboutCLSID);

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszAboutCLSID, wszAboutCLSID);

    // Add the CLSID to the registry.
    setSnapInKeyAndValue(pszCLSID, NULL, _T("NameString"), szNameString) ;
    setSnapInKeyAndValue(pszCLSID, _T("StandAlone"), NULL, NULL);
    if (IID_NULL != clsidAbout)
        setSnapInKeyAndValue(pszCLSID, NULL, _T("About"), pszAboutCLSID);

    if (fSupportExtensions) {
        // Build the key NodeType
        setSnapInKeyAndValue(pszCLSID, _T("NodeTypes"), NULL, NULL);

        _TCHAR szKey[64] ;
        _tcscpy(szKey, pszCLSID) ;
        _tcscat(szKey, _T("\\NodeTypes")) ;
        setSnapInKeyAndValue(szKey, pszCLSID, NULL, NULL);
    }

    // Free memory.
    CoTaskMemFree(wszCLSID) ;
    if (IID_NULL != clsidAbout)
        CoTaskMemFree(wszAboutCLSID);

    return S_OK ;
}

HRESULT UnregisterServer ( const CLSID & clsid )

Definition at line 112 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

  MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
  _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 184 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Generated on Wed Nov 13 2024 16:53:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/simple/resource.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • simple
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDB_BIKE 40007
#define | IDB_BIKE2 40011
#define | IDB_CAR 40005
#define | IDB_CAR2 40009
#define | IDB_CLOSED 40014
#define | IDB_CLOSED2 40012
#define | IDB_OPEN 40015
#define | IDB_OPEN2 40013
#define | IDB_PLANE 40006
#define | IDB_PLANE2 40010
#define | IDB_ROCKET 40004
#define | IDB_ROCKET2 40008
#define | IDI_ICON1 108
#define | IDR_LGICONS 121
#define | IDR_SMICONS 120
#define | IDS_ABOUTNAME 9
#define | IDS_HELPFILE 1
#define | IDS_NAME 3
#define | IDS_SNAPINDESC 2
#define | IDS_SNAPINNAME 6

Define Documentation

#define IDB_BIKE 40007

Definition at line 16 of file resource.h.

#define IDB_BIKE2 40011

Definition at line 20 of file resource.h.

#define IDB_CAR 40005

Definition at line 14 of file resource.h.

#define IDB_CAR2 40009

Definition at line 18 of file resource.h.

#define IDB_CLOSED 40014

Definition at line 23 of file resource.h.

#define IDB_CLOSED2 40012

Definition at line 21 of file resource.h.

#define IDB_OPEN 40015

Definition at line 24 of file resource.h.

#define IDB_OPEN2 40013

Definition at line 22 of file resource.h.

#define IDB_PLANE 40006

Definition at line 15 of file resource.h.

#define IDB_PLANE2 40010

Definition at line 19 of file resource.h.

#define IDB_ROCKET 40004

Definition at line 13 of file resource.h.

#define IDB_ROCKET2 40008

Definition at line 17 of file resource.h.

#define IDI_ICON1 108

Definition at line 10 of file resource.h.

#define IDR_LGICONS 121

Definition at line 12 of file resource.h.

#define IDR_SMICONS 120

Definition at line 11 of file resource.h.

#define IDS_ABOUTNAME 9

Definition at line 9 of file resource.h.

#define IDS_HELPFILE 1

Definition at line 5 of file resource.h.

#define IDS_NAME 3

Definition at line 7 of file resource.h.

#define IDS_SNAPINDESC 2

Definition at line 6 of file resource.h.

#define IDS_SNAPINNAME 6

Definition at line 8 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/simple/staticnode.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • simple

staticnode.cpp File Reference

#include "StaticNode.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/simple/staticnode.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • simple
Classes

staticnode.h File Reference

#include "Globals.h"
#include "BaseNode.h"
#include "BaseNode.h"

Go to the source code of this file.

Classes

class CStaticNode
Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/simple/tracemacro.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • simple
Functions

tracemacro.cpp File Reference

#include "Globals.h"
#include "TraceMacro.h"
#include <StdIo.h>

Go to the source code of this file.

Functions

VOID | MapEvent (LONG Event, LPTSTR szEventStr)
VOID | Trace_Event (LPCTSTR pszClass, LPCTSTR pszFunction, LONG nEvent)
VOID | Trace_HR (LPCTSTR pszClass, LPCTSTR pszFunction, HRESULT hr)
VOID | Trace_Start (LPCTSTR pszClass, LPCTSTR pszFunction)
VOID | Trace_Value (LPCTSTR pszClass, LPCTSTR pszFunction, LPCTSTR pszValueName, LONG nValue)

Function Documentation

VOID MapEvent | ( | LONG | Event,
 |  | LPTSTR | szEventStr
 | ) |  |

Definition at line 146 of file tracemacro.cpp.

{
#ifdef _DEBUG

  switch( Event )
  {
    case 0x8001:
      _tcscpy( szEventStr, _T("MMCN_ACTIVATE       ") );
      break;

    case 0x8002:
      _tcscpy( szEventStr, _T("MMCN_ADD_IMAGES     ") );
      break;

    case 0x8003:
      _tcscpy( szEventStr, _T("MMCN_BTN_CLICK      ") );
      break;

    case 0x8004:
      _tcscpy( szEventStr, _T("MMCN_CLICK          ") );
      break;

    case 0x8005:
      _tcscpy( szEventStr, _T("MMCN_COLUMN_CLICK   ") );
      break;

    case 0x8006:
      _tcscpy( szEventStr, _T("MMCN_CONTEXTMENU    ") );
      break;

    case 0x8007:
      _tcscpy( szEventStr, _T("MMCN_CUTORMOVE      ") );
      break;

    case 0x8008:
      _tcscpy( szEventStr, _T("MMCN_DBLCLICK       ") );
      break;

    case 0x8009:
      _tcscpy( szEventStr, _T("MMCN_DELETE         ") );
      break;

    case 0x800A:
      _tcscpy( szEventStr, _T("MMCN_DESELECT_ALL   ") );
      break;

    case 0x800B:
      _tcscpy( szEventStr, _T("MMCN_EXPAND         ") );
      break;

    case 0x800C:
      _tcscpy( szEventStr, _T("MMCN_HELP           ") );
      break;

    case 0x800D:
      _tcscpy( szEventStr, _T("MMCN_MENU_BTNCLICK  ") );
      break;

    case 0x800E:
      _tcscpy( szEventStr, _T("MMCN_MINIMIZED      ") );
      break;

    case 0x800F:
      _tcscpy( szEventStr, _T("MMCN_PASTE          ") );
      break;

    case 0x8010:
      _tcscpy( szEventStr, _T("MMCN_PROPERTY_CHANGE") );
      break;

    case 0x8011:
      _tcscpy( szEventStr, _T("MMCN_QUERY_PASTE    ") );
      break;

    case 0x8012:
      _tcscpy( szEventStr, _T("MMCN_REFRESH        ") );
      break;

    case 0x8013:
      _tcscpy( szEventStr, _T("MMCN_REMOVE_CHILDREN") );
      break;

    case 0x8014:
      _tcscpy( szEventStr, _T("MMCN_RENAME         ") );
      break;

    case 0x8015:
      _tcscpy( szEventStr, _T("MMCN_SELECT         ") );
      break;

    case 0x8016:
      _tcscpy( szEventStr, _T("MMCN_SHOW           ") );
      break;

    case 0x8017:
      _tcscpy( szEventStr, _T("MMCN_VIEW_CHANGE    ") );
      break;

    case 0x8018:
      _tcscpy( szEventStr, _T("MMCN_SNAPINHELP     ") );
      break;

    case 0x8019:
      _tcscpy( szEventStr, _T("MMCN_CONTEXTHELP    ") );
      break;

    case 0x801A:
      _tcscpy( szEventStr, _T("MMCN_INITOCX        ") );
      break;

    case 0x8021:
      _tcscpy( szEventStr, _T("MMCN_EXPANDSYNC     ") );
      break;

    default:
      _stprintf( szEventStr, _T("0x%X"), Event );
      break;
  }

#endif
} //end MapEvent()

VOID Trace_Event | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LONG | nEvent
 | ) |  |

Definition at line 86 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szEventStr[22];
  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Event = %s\n");
  INT    nChars     = 0;

  MapEvent( nEvent, szEventStr );

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      szEventStr
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Event()

VOID Trace_HR | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | HRESULT | hr
 | ) |  |

Definition at line 27 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Returned 0x%X\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer, szFormat, pszClass, pszFunction, hr );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_HR()

VOID Trace_Start | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction
 | ) |  |

Definition at line 118 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Started \n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Start()

VOID Trace_Value | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LPCTSTR | pszValueName,
 |  | LONG | nValue
 | ) |  |

Definition at line 53 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> %s = %u\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      pszValueName,
                      nValue
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Value()

Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/simple/tracemacro.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • simple
Defines | Functions

tracemacro.h File Reference

Go to the source code of this file.

Defines

#define | TRACE_EVENT
#define | TRACE_HRESULT
#define | TRACE_START
#define | TRACE_VAL

Functions

VOID | MapEvent (LONG Event, LPTSTR szEventStr)
VOID | Trace_Event (LPCTSTR pszClass, LPCTSTR pszFunction, LONG nEvent)
VOID | Trace_HR (LPCTSTR pszClass, LPCTSTR pszFunction, HRESULT hr)
VOID | Trace_Start (LPCTSTR pszClass, LPCTSTR pszFunction)
VOID | Trace_Value (LPCTSTR pszClass, LPCTSTR pszFunction, LPCTSTR pszValueName, LONG Value)

Define Documentation

#define TRACE_EVENT

Definition at line 62 of file tracemacro.h.

#define TRACE_HRESULT

Definition at line 56 of file tracemacro.h.

#define TRACE_START

Definition at line 65 of file tracemacro.h.

#define TRACE_VAL

Definition at line 59 of file tracemacro.h.

Function Documentation

VOID MapEvent | ( | LONG | Event,
 |  | LPTSTR | szEventStr
 | ) |  |

Definition at line 146 of file tracemacro.cpp.

{
#ifdef _DEBUG

  switch( Event )
  {
    case 0x8001:
      _tcscpy( szEventStr, _T("MMCN_ACTIVATE       ") );
      break;

    case 0x8002:
      _tcscpy( szEventStr, _T("MMCN_ADD_IMAGES     ") );
      break;

    case 0x8003:
      _tcscpy( szEventStr, _T("MMCN_BTN_CLICK      ") );
      break;

    case 0x8004:
      _tcscpy( szEventStr, _T("MMCN_CLICK          ") );
      break;

    case 0x8005:
      _tcscpy( szEventStr, _T("MMCN_COLUMN_CLICK   ") );
      break;

    case 0x8006:
      _tcscpy( szEventStr, _T("MMCN_CONTEXTMENU    ") );
      break;

    case 0x8007:
      _tcscpy( szEventStr, _T("MMCN_CUTORMOVE      ") );
      break;

    case 0x8008:
      _tcscpy( szEventStr, _T("MMCN_DBLCLICK       ") );
      break;

    case 0x8009:
      _tcscpy( szEventStr, _T("MMCN_DELETE         ") );
      break;

    case 0x800A:
      _tcscpy( szEventStr, _T("MMCN_DESELECT_ALL   ") );
      break;

    case 0x800B:
      _tcscpy( szEventStr, _T("MMCN_EXPAND         ") );
      break;

    case 0x800C:
      _tcscpy( szEventStr, _T("MMCN_HELP           ") );
      break;

    case 0x800D:
      _tcscpy( szEventStr, _T("MMCN_MENU_BTNCLICK  ") );
      break;

    case 0x800E:
      _tcscpy( szEventStr, _T("MMCN_MINIMIZED      ") );
      break;

    case 0x800F:
      _tcscpy( szEventStr, _T("MMCN_PASTE          ") );
      break;

    case 0x8010:
      _tcscpy( szEventStr, _T("MMCN_PROPERTY_CHANGE") );
      break;

    case 0x8011:
      _tcscpy( szEventStr, _T("MMCN_QUERY_PASTE    ") );
      break;

    case 0x8012:
      _tcscpy( szEventStr, _T("MMCN_REFRESH        ") );
      break;

    case 0x8013:
      _tcscpy( szEventStr, _T("MMCN_REMOVE_CHILDREN") );
      break;

    case 0x8014:
      _tcscpy( szEventStr, _T("MMCN_RENAME         ") );
      break;

    case 0x8015:
      _tcscpy( szEventStr, _T("MMCN_SELECT         ") );
      break;

    case 0x8016:
      _tcscpy( szEventStr, _T("MMCN_SHOW           ") );
      break;

    case 0x8017:
      _tcscpy( szEventStr, _T("MMCN_VIEW_CHANGE    ") );
      break;

    case 0x8018:
      _tcscpy( szEventStr, _T("MMCN_SNAPINHELP     ") );
      break;

    case 0x8019:
      _tcscpy( szEventStr, _T("MMCN_CONTEXTHELP    ") );
      break;

    case 0x801A:
      _tcscpy( szEventStr, _T("MMCN_INITOCX        ") );
      break;

    case 0x8021:
      _tcscpy( szEventStr, _T("MMCN_EXPANDSYNC     ") );
      break;

    default:
      _stprintf( szEventStr, _T("0x%X"), Event );
      break;
  }

#endif
} //end MapEvent()

VOID Trace_Event | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LONG | nEvent
 | ) |  |

Definition at line 86 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szEventStr[22];
  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Event = %s\n");
  INT    nChars     = 0;

  MapEvent( nEvent, szEventStr );

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      szEventStr
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Event()

VOID Trace_HR | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | HRESULT | hr
 | ) |  |

Definition at line 27 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Returned 0x%X\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer, szFormat, pszClass, pszFunction, hr );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_HR()

VOID Trace_Start | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction
 | ) |  |

Definition at line 118 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Started \n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Start()

VOID Trace_Value | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LPCTSTR | pszValueName,
 |  | LONG | Value
 | ) |  |

Definition at line 53 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> %s = %u\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      pszValueName,
                      nValue
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Value()

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/viewex/about.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • viewex
Functions

about.cpp File Reference

#include "Globals.h"
#include "About.h"
#include "Resource.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CSnapinAbout

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 85 of file about.cpp.

{
  if( 0 == InterlockedDecrement((long*)&m_cRef) )
  {
    // we need to decrement our object count in the DLL
    delete this;
    return 0;
  }
  return m_cRef;
}

Generated on Wed Nov 13 2024 16:54:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/viewex/about.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • viewex
Classes

about.h File Reference

#include <mmc.h>

Go to the source code of this file.

Classes

class CSnapinAbout
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/viewex/adddevicedlg.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • viewex

adddevicedlg.cpp File Reference

#include "AddDeviceDlg.h"
#include "Globals.h"
#include "Resource.h"
#include "BaseNode.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/viewex/adddevicedlg.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • viewex
Classes

adddevicedlg.h File Reference

#include "BaseDialog.h"

Go to the source code of this file.

Classes

class CAddDeviceDlg
Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/viewex/addvfiledlg.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • viewex

addvfiledlg.cpp File Reference

#include "AddVFileDlg.h"
#include "Globals.h"
#include "Resource.h"
#include "BaseNode.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/viewex/addvfiledlg.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • viewex
Classes

addvfiledlg.h File Reference

#include "BaseDialog.h"

Go to the source code of this file.

Classes

class CAddVFileDlg
Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/viewex/basedialog.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • viewex

basedialog.cpp File Reference

#include "BaseDialog.h"
#include "Globals.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/viewex/basedialog.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • viewex
Classes

basedialog.h File Reference

#include <Windows.h>

Go to the source code of this file.

Classes

class CBaseDialog
Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/viewex/basenode.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • viewex
Classes | Defines | Typedefs

basenode.h File Reference

#include "Globals.h"
#include "Resource.h"

Go to the source code of this file.

Classes

class | CBaseNode
struct | tag_BASENODE_PROPERTIES

Defines

#define | DEFAULT_RDI_MASK (RDI_STR | RDI_PARAM | RDI_IMAGE)
#define | DEFAULT_SDI_MASK (SDI_STR | SDI_PARAM | SDI_IMAGE | SDI_OPENIMAGE | SDI_PARENT | SDI_CHILDREN)
#define | MAX_NAME_LEN 64

Typedefs

typedef CBaseNode * | LPBASENODE
typedef NODE_PROPERTIES * | LPNODE_PROPERTIES
typedef struct
tag_BASENODE_PROPERTIES 		NODE_PROPERTIES

Define Documentation

#define DEFAULT_RDI_MASK (RDI_STR | RDI_PARAM | RDI_IMAGE)

Definition at line 24 of file basenode.h.

#define DEFAULT_SDI_MASK (SDI_STR | SDI_PARAM | SDI_IMAGE | SDI_OPENIMAGE | SDI_PARENT | SDI_CHILDREN)

Definition at line 23 of file basenode.h.

#define MAX_NAME_LEN 64

Definition at line 26 of file basenode.h.

Typedef Documentation

typedef CBaseNode* LPBASENODE

Definition at line 46 of file basenode.h.

typedef NODE_PROPERTIES* LPNODE_PROPERTIES

Definition at line 45 of file basenode.h.

typedef struct tag_BASENODE_PROPERTIES NODE_PROPERTIES
Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/viewex/basesnap.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • viewex
Defines | Functions

basesnap.cpp File Reference

#include <ObjBase.h>
#include <InitGuid.h>
#include "Globals.h"
#include "BaseSnap.h"
#include "CompData.h"
#include "About.h"
#include "Registry.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define | MODULESTRING _T("BaseSnap")

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)
BOOL WINAPI | DllMain (HINSTANCE hInstDLL, DWORD fdwReason, void *lpvReserved)
STDAPI | DllRegisterServer ()
STDAPI | DllUnregisterServer ()
STDMETHODIMP_ (ULONG) CClassFactory

Define Documentation

#define MODULESTRING _T("BaseSnap")

Definition at line 28 of file basesnap.cpp.

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 226 of file basesnap.cpp.

{
  if( 0 == g_uObjectCount && 0 == g_uServerLocks )
    return S_OK;
  else
    return S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 190 of file basesnap.cpp.

{
  // Test for CSnapinAbout
  if( (rclsid != CLSID_CComponentData) && (rclsid != CLSID_CSnapinAbout) )
    return CLASS_E_CLASSNOTAVAILABLE;

  if( !ppvObj )
    return E_FAIL;

  *ppvObj = NULL;

  // We can only hand out IUnknown and IClassFactory pointers.  Fail
  // if caller asks for anything else.
  if( !IsEqualIID(riid, IID_IUnknown) && !IsEqualIID(riid, IID_IClassFactory) )
    return E_NOINTERFACE;

  CClassFactory *pFactory = NULL;

  // Create the new class factory.  Pass in the type of object to create
  if( rclsid == CLSID_CComponentData )
    pFactory = new CClassFactory(CClassFactory::COMPONENTDATA);
  else if( rclsid == CLSID_CSnapinAbout )
    pFactory = new CClassFactory(CClassFactory::ABOUT);

  HRESULT hResult = pFactory->QueryInterface( riid, ppvObj );

  return hResult;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstDLL,
 |  | DWORD | fdwReason,
 |  | void * | lpvReserved
 | ) |  |

Definition at line 173 of file basesnap.cpp.

{
  if( DLL_PROCESS_ATTACH == fdwReason )
  {
     g_hInst = hInstDLL;
  }

  return TRUE;
}

STDAPI DllRegisterServer ( void )

Definition at line 236 of file basesnap.cpp.

{
  HRESULT hResult = S_FALSE;

  do
  { // Support ISnapinAbout
    hResult = RegisterServer( g_hInst, CLSID_CSnapinAbout, gtszABOUT_NAME );
    BREAK_ON_ERROR( hResult );

    hResult = RegisterServer( g_hInst, CLSID_CComponentData, gtszSNAPIN_NAME );
    BREAK_ON_ERROR( hResult );

    // VIEWEX: Set last parameter to TRUE so that we can use the View Extension
    hResult = RegisterSnapin( CLSID_CComponentData, gtszSNAPIN_NAME, CLSID_CSnapinAbout, TRUE );
    BREAK_ON_ERROR( hResult );

  }while( 0 );

  return hResult;
}

STDAPI DllUnregisterServer ( void )

Definition at line 259 of file basesnap.cpp.

{
  if( S_OK != UnregisterServer( CLSID_CComponentData )  ||
      S_OK != UnregisterServer( CLSID_CSnapinAbout   )  ||
      S_OK != UnregisterSnapin( CLSID_CComponentData )
    )
    return E_UNEXPECTED;
  else
    return S_OK;

}

STDMETHODIMP_ ( ULONG )

Definition at line 91 of file basesnap.cpp.

{
  if( 0 == InterlockedDecrement( (long*)&m_cRef) )
  {
    delete this;
    return 0;
  }
  return m_cRef;
}

Generated on Wed Nov 13 2024 16:54:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/viewex/basesnap.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • viewex
Classes | Functions

basesnap.h File Reference

Go to the source code of this file.

Classes

class | CClassFactory

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 53 of file ComSpyAudit.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 61 of file ComSpyAudit.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

Generated on Wed Nov 13 2024 16:54:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/viewex/comp.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • viewex
Defines | Functions

comp.cpp File Reference

#include "Globals.h"
#include "Comp.h"
#include "CompData.h"
#include "DataObj.h"
#include "Resource.h"
#include "StaticNode.h"
#include "VirtualFile.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CComponent")

Functions

STDMETHODIMP_ (ULONG) CComponent

Define Documentation

#define MODULESTRING _T("CComponent")

Definition at line 27 of file comp.cpp.

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 96 of file comp.cpp.

{
  if( InterlockedDecrement((LONG*)&m_cRef) == 0 )
  {
    delete this;
    return 0;
  }
  return m_cRef;
}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/viewex/comp.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • viewex
Classes

comp.h File Reference

#include "Globals.h"

Go to the source code of this file.

Classes

class CComponent
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/viewex/compdata.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • viewex
Defines | Functions

compdata.cpp File Reference

#include "Globals.h"
#include "Comp.h"
#include "CompData.h"
#include "DataObj.h"
#include "Resource.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CComponentData")

Functions

STDMETHODIMP_ (ULONG) CComponentData

Define Documentation

#define MODULESTRING _T("CComponentData")

Definition at line 23 of file compdata.cpp.

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 113 of file compdata.cpp.

{
  if( InterlockedDecrement((LONG*)&m_cRef) == 0 )
  {
    delete this;
    return 0;
  }

  return m_cRef;
}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/viewex/compdata.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • viewex
Classes

compdata.h File Reference

#include "Globals.h"
#include "BaseNode.h"

Go to the source code of this file.

Classes

class CComponentData
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/viewex/dataobj.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • viewex
Defines | Functions

dataobj.cpp File Reference

#include "Globals.h"
#include "DataObj.h"
#include "StaticNode.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CDataObject")

Functions

STDMETHODIMP_ (ULONG) CDataObject

Define Documentation

#define MODULESTRING _T("CDataObject")

Definition at line 21 of file dataobj.cpp.

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 77 of file dataobj.cpp.

{
  if( InterlockedDecrement((LONG*)&m_cRef) == 0 )
  {
    delete this;
    return 0;
  }
  return m_cRef;
}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/viewex/dataobj.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • viewex
Classes

dataobj.h File Reference

#include "Globals.h"
#include "StaticNode.h"

Go to the source code of this file.

Classes

class CDataObject
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/viewex/devicenode.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • viewex
Defines

devicenode.cpp File Reference

#include "DeviceNode.h"
#include "CompData.h"
#include "Comp.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CDeviceNode")

Define Documentation

#define MODULESTRING _T("CDeviceNode")

Definition at line 23 of file devicenode.cpp.

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/viewex/devicenode.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • viewex
Classes

devicenode.h File Reference

#include "Globals.h"
#include "FolderNode.h"
#include "LListImpl.h"

Go to the source code of this file.

Classes

class CDeviceNode
Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/viewex/foldernode.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • viewex
Defines

foldernode.cpp File Reference

#include "FolderNode.h"
#include "CompData.h"
#include "Comp.h"
#include "AddVFileDlg.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CFolderNode")

Define Documentation

#define MODULESTRING _T("CFolderNode")

Definition at line 24 of file foldernode.cpp.

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/viewex/foldernode.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • viewex
Classes

foldernode.h File Reference

#include "Globals.h"
#include "BaseNode.h"
#include "VirtualFile.h"
#include "LListImpl.h"

Go to the source code of this file.

Classes

class CFolderNode
Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/viewex/globals.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • viewex
Functions | Variables

globals.cpp File Reference

#include "Globals.h"
#include "BaseNode.h"

Go to the source code of this file.

Functions

void _fastcall | CopyT2W (LPWSTR strDest, LPCTSTR strSource, size_t count)
CBaseNode * | ExtractBaseNodePtr (LPDATAOBJECT ipDataObject)
CDataObject * | ExtractDataObjPtr (LPDATAOBJECT ipDataObject)
HRESULT | ExtractFromDataObject (LPDATAOBJECT ipDataObject, UINT cfClipFormat, ULONG nByteCount, HGLOBAL *phGlobal)
void | InitClipboardFormats ()
void _fastcall | Unicode2Ansi (CHAR **pszAnsi, WCHAR *szWide)

Variables

UINT | g_cfBaseNodePtr = 0
UINT | g_cfDataObjPtr = 0
UINT | g_cfDisplayName = 0
UINT | g_cfNodeType = 0
UINT | g_cfSnapinClsid = 0
UINT | g_cfszNodeType = 0
HINSTANCE | g_hInst = NULL
ULONG | g_uObjectCount = 0
ULONG | g_uServerLocks = 0

Function Documentation

void _fastcall CopyT2W | ( | LPWSTR | strDest,
 |  | LPCTSTR | strSource,
 |  | size_t | count
 | ) |  |

Definition at line 64 of file globals.cpp.

{
#ifndef _UNICODE

  MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, strSource, -1, strDest, count );

#else

  wcsncpy( strDest, strSource, count );

#endif

  if ( count > 0 )
    strDest[ count - 1 ] = 0;
}

CBaseNode* ExtractBaseNodePtr ( LPDATAOBJECT ipDataObject )

Definition at line 150 of file globals.cpp.

{
  LPBASENODE  pNode   = NULL;
  HGLOBAL     hGlobal = NULL;
  HRESULT     hResult = S_FALSE;

  hResult = ExtractFromDataObject( ipDataObject,
                                   g_cfBaseNodePtr,
                                   sizeof(LPBASENODE),
                                   &hGlobal
                                 );
  if( SUCCEEDED(hResult) )
  {
    pNode = *(LPBASENODE*)(hGlobal);
    HGLOBAL hRetVal = GlobalFree(hGlobal);
    _ASSERT( NULL == hRetVal );        // Must return NULL
  }

  return pNode;

}

CDataObject* ExtractDataObjPtr ( LPDATAOBJECT ipDataObject )

Definition at line 179 of file globals.cpp.

{
  _ASSERT( 0 != g_cfDataObjPtr );

  HGLOBAL      hGlobal = NULL;
  HRESULT      hResult = S_OK;
  CDataObject* pDO     = NULL;

  hResult = ExtractFromDataObject( ipDataObject,
                                   g_cfDataObjPtr,
                                   sizeof(CDataObject **),
                                   &hGlobal
                                 );

  if( SUCCEEDED(hResult) )
  {
    pDO = *(CDataObject **)(hGlobal);
    _ASSERT( NULL != pDO );

    HGLOBAL hRetVal = GlobalFree(hGlobal);
    _ASSERT( NULL == hRetVal );       // Must return NULL
  }

  return pDO;

}

HRESULT ExtractFromDataObject | ( | LPDATAOBJECT | ipDataObject,
 |  | UINT | cfClipFormat,
 |  | ULONG | nByteCount,
 |  | HGLOBAL * | phGlobal
 | ) |  |

Definition at line 98 of file globals.cpp.

{
  _ASSERT( NULL != ipDataObject );

            *phGlobal = NULL;
  HRESULT   hResult   = S_FALSE;
  STGMEDIUM StgMedium = { TYMED_HGLOBAL,  NULL  };
  FORMATETC FormatEtc = { cfClipFormat, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };

  do
  {
    // Allocate memory for the stream
    StgMedium.hGlobal = ::GlobalAlloc( GMEM_SHARE, nByteCount );

    if( NULL == StgMedium.hGlobal )
    {
      hResult = E_OUTOFMEMORY;
      break;
    }

    // Attempt to get data from the object
    hResult = ipDataObject->GetDataHere( &FormatEtc, &StgMedium );
    if( FAILED(hResult) )
    {
      break;
    }
    // StgMedium now has the data we need
    *phGlobal = StgMedium.hGlobal;
    StgMedium.hGlobal = NULL;

  } while (0);

  if( FAILED(hResult) && StgMedium.hGlobal )
  {
    HGLOBAL hRetVal = ::GlobalFree(StgMedium.hGlobal);
    _ASSERT( NULL == hRetVal );         // Must return NULL
  }
  return hResult;

}

void InitClipboardFormats ( )

Definition at line 82 of file globals.cpp.

{
  g_cfDisplayName  = RegisterClipboardFormat( T_CCF_DISPLAY_NAME );
  g_cfNodeType     = RegisterClipboardFormat( T_CCF_NODETYPE );
  g_cfszNodeType   = RegisterClipboardFormat( T_CCF_SZNODETYPE );
  g_cfSnapinClsid  = RegisterClipboardFormat( T_CCF_SNAPIN_CLASSID );

  g_cfBaseNodePtr  = RegisterClipboardFormat( T_CCF_BASENODE_PTR );
  g_cfDataObjPtr   = RegisterClipboardFormat( T_CCF_DATAOBJ_PTR );

}

void _fastcall Unicode2Ansi | ( | CHAR ** | pszAnsi,
 |  | WCHAR * | szWide
 | ) |  |

Definition at line 45 of file globals.cpp.

{
  LONG nLen = wcslen( szWide ) +1;
  *pszAnsi = (char*)CoTaskMemAlloc( nLen );
  char* pCounter = *pszAnsi;

  while( *szWide )
  {
    *pCounter = LOBYTE(*szWide);
    pCounter++;
    szWide++;
  }
  *pCounter = NULL;
}

Variable Documentation

UINT g_cfBaseNodePtr = 0

Definition at line 28 of file globals.cpp.

UINT g_cfDataObjPtr = 0

Definition at line 29 of file globals.cpp.

UINT g_cfDisplayName = 0

Definition at line 20 of file globals.cpp.

UINT g_cfNodeType = 0

Definition at line 21 of file globals.cpp.

UINT g_cfSnapinClsid = 0

Definition at line 23 of file globals.cpp.

UINT g_cfszNodeType = 0

Definition at line 22 of file globals.cpp.

HINSTANCE g_hInst = NULL

Definition at line 34 of file globals.cpp.

ULONG g_uObjectCount = 0

Definition at line 35 of file globals.cpp.

ULONG g_uServerLocks = 0

Definition at line 36 of file globals.cpp.

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/viewex/globals.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • viewex
Defines | Functions | Variables

globals.h File Reference

#include <TChar.h>
#include <Mmc.h>
#include <CrtDbg.h>
#include "Guids.h"
#include "Guids.h"

Go to the source code of this file.

Defines

#define | ATTRIBUTE_BACKUP_DEVICE 2048
#define | ATTRIBUTE_DATA_ARCHIVE 2
#define | ATTRIBUTE_DATA_HIDDEN 4
#define | ATTRIBUTE_DATA_LOCKED 8
#define | ATTRIBUTE_DATA_READONLY 16
#define | BREAK_ON_ERROR(hResult) if( S_OK != hResult ) continue
#define | BYTE_SIZE(string) ((_tcslen(string)+1) * sizeof(TCHAR))
#define | HINT_UPDATE_ALL_ITEMS 4
#define | HINT_UPDATE_ITEM 2
#define | IDM_NEW_DEVICE 100
#define | IDM_NEW_FOLDER 200
#define | IDM_NEW_VIRTFILE 400
#define | IDM_TOGGLE_STATUS 300
#define | IMG_CDROM_DEFAULT 6
#define | IMG_DATA_FILE 2
#define | IMG_DEVICE_DEFAULT 0
#define | IMG_DEVICE_OFFLINE 1
#define | IMG_DRIVE_DEFAULT 3
#define | IMG_DRIVE_OFFLINE 4
#define | IMG_FOLDER_DEFAULT 5
#define | IMG_REMOVABLE_MEDIA 7
#define | MsgBox(wszMsg, wszTitle) ::MessageBox(NULL, wszMsg, wszTitle, MB_OK)
#define | NODETYPE_DEVICE 200
#define | NODETYPE_FOLDER 300
#define | NODETYPE_STATIC 100
#define | NODETYPE_VFILE 400
#define | REQUEST_ICONSOLE 1001
#define | REQUEST_ICONSOLENAMESPACE 1000
#define | REQUEST_ICONSOLEVERB 1002
#define | REQUEST_IHEADERCTRL 1004
#define | REQUEST_IRESULTDATA 1003
#define | STATUS_OFFLINE 0
#define | STATUS_ONLINE 1
#define | T_CCF_BASENODE_PTR _T("CCF_BASENODE_PTR")
#define | T_CCF_DATAOBJ_PTR _T("CCF_DATAOBJ_PTR")
#define | T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")
#define | T_CCF_NODETYPE _T("CCF_NODETYPE")
#define | T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")
#define | T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")
#define | W2T(szAnsiPtr, szWide) Unicode2Ansi( szAnsiPtr, szWide )
#define | WM_ADD_DEVICENODE (WM_USER + 101)
#define | WM_ADD_VIRTUALFILE (WM_USER + 103)
#define | WM_DEL_DEVICENODES (WM_USER + 100)
#define | WM_DEVICENODE_CLOSED (WM_USER + 102)
#define | WM_VIRTUALFILE_CLOSED (WM_USER + 104)

Functions

void _fastcall | CopyT2W (LPWSTR strDest, LPCTSTR strSource, size_t count)
CBaseNode * | ExtractBaseNodePtr (LPDATAOBJECT ipDataObject)
CDataObject * | ExtractDataObjPtr (LPDATAOBJECT ipDataObject)
HRESULT | ExtractFromDataObject (LPDATAOBJECT ipDataObject, UINT cf, ULONG cb, HGLOBAL *phGlobal)
void | InitClipboardFormats ()
template<class TYPE >
void | SAFE_FREE_BITMAP (TYPE *&pObj)
template<class TYPE >
void | SAFE_FREE_ICON (TYPE *&pObj)
template<class TYPE >
void | SAFE_RELEASE (TYPE *&pObj)
void _fastcall | Unicode2Ansi (CHAR **pszAnsi, WCHAR *szWide)

Variables

UINT g_cfBaseNodePtr
UINT g_cfDataObjPtr
UINT g_cfDisplayName
UINT g_cfNodeType
UINT g_cfSnapinClsid
UINT g_cfszNodeType
HINSTANCE | g_hInst
ULONG g_uObjectCount
ULONG g_uServerLocks

Define Documentation

#define ATTRIBUTE_BACKUP_DEVICE 2048

Definition at line 96 of file globals.h.

#define ATTRIBUTE_DATA_ARCHIVE 2

Definition at line 92 of file globals.h.

#define ATTRIBUTE_DATA_HIDDEN 4

Definition at line 93 of file globals.h.

#define ATTRIBUTE_DATA_LOCKED 8

Definition at line 94 of file globals.h.

#define ATTRIBUTE_DATA_READONLY 16

Definition at line 95 of file globals.h.

#define BREAK_ON_ERROR ( hResult ) if( S_OK != hResult ) continue

Definition at line 147 of file globals.h.

#define BYTE_SIZE ( string ) ((_tcslen(string)+1) * sizeof(TCHAR))

Definition at line 145 of file globals.h.

#define HINT_UPDATE_ALL_ITEMS 4

Definition at line 139 of file globals.h.

#define HINT_UPDATE_ITEM 2

Definition at line 138 of file globals.h.

#define IDM_NEW_DEVICE 100

Definition at line 108 of file globals.h.

#define IDM_NEW_FOLDER 200

Definition at line 109 of file globals.h.

#define IDM_NEW_VIRTFILE 400

Definition at line 111 of file globals.h.

#define IDM_TOGGLE_STATUS 300

Definition at line 110 of file globals.h.

#define IMG_CDROM_DEFAULT 6

Definition at line 105 of file globals.h.

#define IMG_DATA_FILE 2

Definition at line 101 of file globals.h.

#define IMG_DEVICE_DEFAULT 0

Definition at line 99 of file globals.h.

#define IMG_DEVICE_OFFLINE 1

Definition at line 100 of file globals.h.

#define IMG_DRIVE_DEFAULT 3

Definition at line 102 of file globals.h.

#define IMG_DRIVE_OFFLINE 4

Definition at line 103 of file globals.h.

#define IMG_FOLDER_DEFAULT 5

Definition at line 104 of file globals.h.

#define IMG_REMOVABLE_MEDIA 7

Definition at line 106 of file globals.h.

#define MsgBox | ( | wszMsg,
 |  | wszTitle |
 | ) |  | ::MessageBox(NULL, wszMsg, wszTitle, MB_OK)

Definition at line 150 of file globals.h.

#define NODETYPE_DEVICE 200

Definition at line 87 of file globals.h.

#define NODETYPE_FOLDER 300

Definition at line 88 of file globals.h.

#define NODETYPE_STATIC 100

Definition at line 86 of file globals.h.

#define NODETYPE_VFILE 400

Definition at line 89 of file globals.h.

#define REQUEST_ICONSOLE 1001

Definition at line 130 of file globals.h.

#define REQUEST_ICONSOLENAMESPACE 1000

Definition at line 129 of file globals.h.

#define REQUEST_ICONSOLEVERB 1002

Definition at line 131 of file globals.h.

#define REQUEST_IHEADERCTRL 1004

Definition at line 133 of file globals.h.

#define REQUEST_IRESULTDATA 1003

Definition at line 132 of file globals.h.

#define STATUS_OFFLINE 0

Definition at line 114 of file globals.h.

#define STATUS_ONLINE 1

Definition at line 113 of file globals.h.

#define T_CCF_BASENODE_PTR _T("CCF_BASENODE_PTR")

Definition at line 80 of file globals.h.

#define T_CCF_DATAOBJ_PTR _T("CCF_DATAOBJ_PTR")

Definition at line 81 of file globals.h.

#define T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")

Definition at line 75 of file globals.h.

#define T_CCF_NODETYPE _T("CCF_NODETYPE")

Definition at line 76 of file globals.h.

#define T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")

Definition at line 78 of file globals.h.

#define T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")

Definition at line 77 of file globals.h.

#define W2T | ( | szAnsiPtr,
 |  | szWide |
 | ) |  | Unicode2Ansi( szAnsiPtr, szWide )

Definition at line 205 of file globals.h.

#define WM_ADD_DEVICENODE (WM_USER + 101)

Definition at line 120 of file globals.h.

#define WM_ADD_VIRTUALFILE (WM_USER + 103)

Definition at line 122 of file globals.h.

#define WM_DEL_DEVICENODES (WM_USER + 100)

Definition at line 119 of file globals.h.

#define WM_DEVICENODE_CLOSED (WM_USER + 102)

Definition at line 121 of file globals.h.

#define WM_VIRTUALFILE_CLOSED (WM_USER + 104)

Definition at line 123 of file globals.h.

Function Documentation

void _fastcall CopyT2W | ( | LPWSTR | strDest,
 |  | LPCTSTR | strSource,
 |  | size_t | count
 | ) |  |

Definition at line 64 of file globals.cpp.

{
#ifndef _UNICODE

  MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, strSource, -1, strDest, count );

#else

  wcsncpy( strDest, strSource, count );

#endif

  if ( count > 0 )
    strDest[ count - 1 ] = 0;
}

CBaseNode* ExtractBaseNodePtr ( LPDATAOBJECT ipDataObject )

Definition at line 150 of file globals.cpp.

{
  LPBASENODE  pNode   = NULL;
  HGLOBAL     hGlobal = NULL;
  HRESULT     hResult = S_FALSE;

  hResult = ExtractFromDataObject( ipDataObject,
                                   g_cfBaseNodePtr,
                                   sizeof(LPBASENODE),
                                   &hGlobal
                                 );
  if( SUCCEEDED(hResult) )
  {
    pNode = *(LPBASENODE*)(hGlobal);
    HGLOBAL hRetVal = GlobalFree(hGlobal);
    _ASSERT( NULL == hRetVal );        // Must return NULL
  }

  return pNode;

}

CDataObject* ExtractDataObjPtr ( LPDATAOBJECT ipDataObject )

Definition at line 179 of file globals.cpp.

{
  _ASSERT( 0 != g_cfDataObjPtr );

  HGLOBAL      hGlobal = NULL;
  HRESULT      hResult = S_OK;
  CDataObject* pDO     = NULL;

  hResult = ExtractFromDataObject( ipDataObject,
                                   g_cfDataObjPtr,
                                   sizeof(CDataObject **),
                                   &hGlobal
                                 );

  if( SUCCEEDED(hResult) )
  {
    pDO = *(CDataObject **)(hGlobal);
    _ASSERT( NULL != pDO );

    HGLOBAL hRetVal = GlobalFree(hGlobal);
    _ASSERT( NULL == hRetVal );       // Must return NULL
  }

  return pDO;

}

HRESULT ExtractFromDataObject | ( | LPDATAOBJECT | ipDataObject,
 |  | UINT | cf,
 |  | ULONG | cb,
 |  | HGLOBAL * | phGlobal
 | ) |  |

Definition at line 98 of file globals.cpp.

{
  _ASSERT( NULL != ipDataObject );

            *phGlobal = NULL;
  HRESULT   hResult   = S_FALSE;
  STGMEDIUM StgMedium = { TYMED_HGLOBAL,  NULL  };
  FORMATETC FormatEtc = { cfClipFormat, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };

  do
  {
    // Allocate memory for the stream
    StgMedium.hGlobal = ::GlobalAlloc( GMEM_SHARE, nByteCount );

    if( NULL == StgMedium.hGlobal )
    {
      hResult = E_OUTOFMEMORY;
      break;
    }

    // Attempt to get data from the object
    hResult = ipDataObject->GetDataHere( &FormatEtc, &StgMedium );
    if( FAILED(hResult) )
    {
      break;
    }
    // StgMedium now has the data we need
    *phGlobal = StgMedium.hGlobal;
    StgMedium.hGlobal = NULL;

  } while (0);

  if( FAILED(hResult) && StgMedium.hGlobal )
  {
    HGLOBAL hRetVal = ::GlobalFree(StgMedium.hGlobal);
    _ASSERT( NULL == hRetVal );         // Must return NULL
  }
  return hResult;

}

void InitClipboardFormats ( )

Definition at line 56 of file globals.cpp.

{
  g_cfDisplayName  = RegisterClipboardFormat( T_CCF_DISPLAY_NAME );
  g_cfNodeType     = RegisterClipboardFormat( T_CCF_NODETYPE );
  g_cfszNodeType   = RegisterClipboardFormat( T_CCF_SZNODETYPE );
  g_cfSnapinClsid  = RegisterClipboardFormat( T_CCF_SNAPIN_CLASSID );

}

template<class TYPE >
void SAFE_FREE_BITMAP ( TYPE *& pObj ) [inline]

Definition at line 170 of file globals.h.

{
  if( NULL != pObj )
  {
    BOOL bStatus = DeleteObject( pObj );
    pObj = NULL;
  }
  else
  {
    OutputDebugString(_T("Attempted to delete NULL Bitmap handle.\n"));
  }
}

template<class TYPE >
void SAFE_FREE_ICON ( TYPE *& pObj ) [inline]

Definition at line 185 of file globals.h.

{
  if( NULL != pObj )
  {
    BOOL bStatus = DestroyIcon( pObj );
    pObj = NULL;
  }
  else
  {
    OutputDebugString(_T("Attempted to delete NULL Icon handle.\n"));
  }
}

template<class TYPE >
void SAFE_RELEASE ( TYPE *& pObj ) [inline]

Definition at line 155 of file globals.h.

{
  if( NULL != pObj )
  {
    pObj->Release();
    pObj = NULL;
  }
  else
  {
    OutputDebugString(_T("Attempted to release NULL Com pointer.\n"));
  }
}

void _fastcall Unicode2Ansi | ( | CHAR ** | pszAnsi,
 |  | WCHAR * | szWide
 | ) |  |

Definition at line 38 of file globals.cpp.

{
  LONG nLen = wcslen( szWide ) +1;
  *pszAnsi = (char*)CoTaskMemAlloc( nLen );
  char* pCounter = *pszAnsi;

  while( *szWide )
  {
    *pCounter = LOBYTE(*szWide);
    pCounter++;
    szWide++;
  }
  *pCounter = NULL;
}

Variable Documentation

UINT g_cfBaseNodePtr

Definition at line 28 of file globals.cpp.

UINT g_cfDataObjPtr

Definition at line 29 of file globals.cpp.

UINT g_cfDisplayName

Definition at line 19 of file globals.cpp.

UINT g_cfNodeType

Definition at line 20 of file globals.cpp.

UINT g_cfSnapinClsid

Definition at line 22 of file globals.cpp.

UINT g_cfszNodeType

Definition at line 21 of file globals.cpp.

HINSTANCE g_hInst

Definition at line 62 of file DoServer.Cpp.

ULONG g_uObjectCount

Definition at line 28 of file globals.cpp.

ULONG g_uServerLocks

Definition at line 29 of file globals.cpp.

Generated on Wed Nov 13 2024 16:54:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/viewex/guids.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • viewex
Functions

guids.h File Reference

Go to the source code of this file.

Functions

DEFINE_GUID (CLSID_CComponentData, 0x3bbefb8e, 0x8122, 0x4b0a, 0xb5, 0x4e, 0x05, 0xdd, 0x4d, 0x6a, 0xa0, 0x2c)
DEFINE_GUID (CLSID_CVirtualFile, 0xf0091c49, 0xc869, 0x4941, 0xa8, 0x1c, 0xc7, 0x19, 0xad, 0x81, 0x74, 0xcc)
DEFINE_GUID (CLSID_CFolderNode, 0x520F23fA, 0x775D, 0x4015, 0xb4, 0x37, 0x98, 0xA2, 0x4B, 0x9D, 0x8, 0x5E)
DEFINE_GUID (CLSID_DeviceNode, 0x520F23f9, 0x775D, 0x4015, 0xB4, 0x37, 0x98, 0xA2, 0x4B, 0x9D, 0x8, 0x5E)
DEFINE_GUID (CLSID_CSnapinAbout, 0x96dd4604, 0x48f2, 0x402d, 0x82, 0x55, 0xf7, 0x42, 0x3d, 0xec, 0x19, 0x90)

Function Documentation

DEFINE_GUID | ( | CLSID_CComponentData | ,
 |  | 0x3bbefb8e | ,
 |  | 0x8122 | ,
 |  | 0x4b0a | ,
 |  | 0xb5 | ,
 |  | 0x4e | ,
 |  | 0x05 | ,
 |  | 0xdd | ,
 |  | 0x4d | ,
 |  | 0x6a | ,
 |  | 0xa0 | ,
 |  | 0x2c |
 | ) |  |
DEFINE_GUID | ( | CLSID_CVirtualFile | ,
 |  | 0xf0091c49 | ,
 |  | 0xc869 | ,
 |  | 0x4941 | ,
 |  | 0xa8 | ,
 |  | 0x1c | ,
 |  | 0xc7 | ,
 |  | 0x19 | ,
 |  | 0xad | ,
 |  | 0x81 | ,
 |  | 0x74 | ,
 |  | 0xcc |
 | ) |  |
DEFINE_GUID | ( | CLSID_CFolderNode | ,
 |  | 0x520F23fA | ,
 |  | 0x775D | ,
 |  | 0x4015 | ,
 |  | 0xb4 | ,
 |  | 0x37 | ,
 |  | 0x98 | ,
 |  | 0xA2 | ,
 |  | 0x4B | ,
 |  | 0x9D | ,
 |  | 0x8 | ,
 |  | 0x5E |
 | ) |  |
DEFINE_GUID | ( | CLSID_DeviceNode | ,
 |  | 0x520F23f9 | ,
 |  | 0x775D | ,
 |  | 0x4015 | ,
 |  | 0xB4 | ,
 |  | 0x37 | ,
 |  | 0x98 | ,
 |  | 0xA2 | ,
 |  | 0x4B | ,
 |  | 0x9D | ,
 |  | 0x8 | ,
 |  | 0x5E |
 | ) |  |
DEFINE_GUID | ( | CLSID_CSnapinAbout | ,
 |  | 0x96dd4604 | ,
 |  | 0x48f2 | ,
 |  | 0x402d | ,
 |  | 0x82 | ,
 |  | 0x55 | ,
 |  | 0xf7 | ,
 |  | 0x42 | ,
 |  | 0x3d | ,
 |  | 0xec | ,
 |  | 0x19 | ,
 |  | 0x90 |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/viewex/llistimpl.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • viewex
Functions

llistimpl.cpp File Reference

#include "LListImpl.h"

Go to the source code of this file.

Functions

BOOL IsValidAddress (const void *lp, UINT nBytes, BOOL bReadWrite)

Function Documentation

BOOL IsValidAddress | ( | const void * | lp,
 |  | UINT | nBytes,
 |  | BOOL | bReadWrite
 | ) |  |

Definition at line 53 of file llistimpl.cpp.

{
  // Simple version using Win-32 APIs for pointer validation.
  return (lp != NULL && !IsBadReadPtr(lp, nBytes) &&
         (!bReadWrite || !IsBadWritePtr((LPVOID)lp, nBytes)));

} //end IsValidAddress()

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/viewex/llistimpl.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • viewex
Classes | Typedefs | Functions

llistimpl.h File Reference

#include <CrtDbg.h>
#include <Windows.h>
#include <new.h>

Go to the source code of this file.

Classes

struct | __POSITION
class | CLListImpl< TYPE, ARG_TYPE >
struct | CLListImpl< TYPE, ARG_TYPE >::CNode
struct | CPlex

Typedefs

typedef __POSITION * | POSITION

Functions

BOOL | IsValidAddress (const void *lp, UINT nBytes, BOOL bReadWrite=TRUE)

Typedef Documentation

typedef __POSITION* POSITION

Definition at line 31 of file llistimpl.h.

Function Documentation

BOOL IsValidAddress | ( | const void * | lp,
 |  | UINT | nBytes,
 |  | BOOL | bReadWrite = TRUE
 | ) |  |

Definition at line 53 of file llistimpl.cpp.

{
  // Simple version using Win-32 APIs for pointer validation.
  return (lp != NULL && !IsBadReadPtr(lp, nBytes) &&
         (!bReadWrite || !IsBadWritePtr((LPVOID)lp, nBytes)));

} //end IsValidAddress()

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/viewex/registry.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • viewex
Defines | Functions

registry.cpp File Reference

#include <ObjBase.h>
#include "Registry.h"
#include "Globals.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define | MODULESTRING _T("Registry")

Functions

HRESULT | RecursiveDeleteKey (HKEY hKeyParent, const TCHAR *szKeyChild)
HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const TCHAR *szNameString, const CLSID &clsidAbout, const BOOL bSupportExtensions)
HRESULT | SetExtensionKey (TCHAR *szNode2Extend, TCHAR *szExtensionNode, TCHAR *szExtensionType, TCHAR *szDescription)
HRESULT | SetKeyAndValue (const TCHAR *pszPath, const TCHAR *szSubkey, const TCHAR *szValue)
HRESULT | SetNodeTypesKey (const TCHAR *szNodeGuid)
HRESULT | SetSnapInKeyAndValue (const TCHAR *szKey, const TCHAR *szSubkey, const TCHAR *szName, const TCHAR *szValue)
HRESULT | SetValue (const TCHAR *szKey, const TCHAR *szValueName, const TCHAR *szValue)
LONG | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Define Documentation

#define MODULESTRING _T("Registry")

Definition at line 22 of file registry.cpp.

Function Documentation

HRESULT RecursiveDeleteKey | ( | HKEY | hKeyParent,
 |  | const TCHAR * | szKeyChild
 | ) |  |

Definition at line 284 of file registry.cpp.

{
  // Open the child.
  HKEY hKeyChild = NULL;
  LONG lResult   = ERROR_SUCCESS;

  do                     // We go to all this trouble to prevent any
  {                      // possibility of exiting while leaving a key open

    lResult = RegOpenKeyEx( hKeyParent,
                            lpszKeyChild,
                            0,
                            KEY_ALL_ACCESS,
                            &hKeyChild
                          );
    if( ERROR_SUCCESS != lResult )
      continue;

    // Enumerate all of the decendents of this child.
    FILETIME time;
    _TCHAR szBuffer[256];
    DWORD dwSize = 256;
    while( S_OK == RegEnumKeyEx(hKeyChild,0,szBuffer,&dwSize,NULL,NULL,NULL,&time) )
    {
      // Delete the decendents of this child.
      lResult = RecursiveDeleteKey( hKeyChild, szBuffer );
      if( ERROR_SUCCESS != lResult )
      {
        continue;
      }
      dwSize = 256;
    }
  }while( 0 );

  RegCloseKey( hKeyChild );            // Always try to close the child
                                       // then delete this child.
  return RegDeleteKey( hKeyParent, lpszKeyChild );
}

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const TCHAR * | szFriendlyName
 | ) |  |

Definition at line 57 of file registry.cpp.

{
  // Get server location.
  TCHAR    szModule[512] ;
  TCHAR*   pszCLSID = NULL;
  LPOLESTR wszCLSID = NULL ;
  HRESULT  hResult  = S_FALSE;

  DWORD dwResult = ::GetModuleFileName( hModule,
                                        szModule,
                                        sizeof(szModule)/sizeof(TCHAR)
                                      );
  if( 0 == dwResult ) return HRESULT_FROM_WIN32( dwResult );

  do                         // Fail unless we complete everything
  {
    // Get CLSID string in wide char
    hResult = StringFromCLSID( clsid, &wszCLSID ) ;
    if( S_OK != hResult )
    {
      CoTaskMemFree( wszCLSID );
      BREAK_ON_ERROR( hResult );
    }

    W2T( &pszCLSID, wszCLSID );          // W2T is defined in Globals.h
    CoTaskMemFree( wszCLSID );           // Through with wide version

    TCHAR szKey[64];                     // Build the CLSID key string CLSID\\{...}
    _tcscpy( szKey, _T("CLSID\\") );
    _tcscat( szKey, pszCLSID );

    // Add the CLSID to the registry.
    hResult = SetKeyAndValue( szKey, NULL, szFriendlyName );
    BREAK_ON_ERROR( hResult );

    // Add the server filename subkey under the CLSID key.
    hResult = SetKeyAndValue( szKey, _T("InprocServer32"), szModule );
    BREAK_ON_ERROR( hResult );

    // Set the threading model
    _tcscat( szKey, _T("\\InprocServer32") );
    hResult = SetValue( szKey, _T("ThreadingModel"), _T("Apartment") );
    BREAK_ON_ERROR( hResult );

  }while( 0 );

  CoTaskMemFree( pszCLSID );           // Through with TCHAR version

  return hResult;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | bSupportExtensions
 | ) |  |

Definition at line 155 of file registry.cpp.

{
  HRESULT hResult = S_FALSE;
  TCHAR*  pszSnapCLSID = NULL;         // Needed for TCHAR version of the ClassID

  // If any part of this process fails, jump out of the loop and return
  // the error code
  do
  {
    // Allocate the CLSID string
    LPOLESTR wszSnapCLSID  = NULL ;
    hResult = StringFromCLSID( clsid, &wszSnapCLSID ) ;
    if( S_OK != hResult )
    {
       CoTaskMemFree( wszSnapCLSID );
       continue;
    }

    W2T( &pszSnapCLSID, wszSnapCLSID );  // W2T is defined in Globals.h
    CoTaskMemFree( wszSnapCLSID );       // Through with wide version

    // Add the Snap-in's CLSID to the registry
    hResult = SetSnapInKeyAndValue( pszSnapCLSID, NULL, _T("NameString"), szNameString );
    BREAK_ON_ERROR( hResult );

    hResult = SetSnapInKeyAndValue( pszSnapCLSID, _T("StandAlone"), NULL, NULL );
    BREAK_ON_ERROR( hResult );

    // Add registry information for ISnapinAbout if we support it
    LPOLESTR wszAboutCLSID = NULL;
    TCHAR*   pszAboutCLSID = NULL;
    if( IID_NULL != clsidAbout )
    {
      hResult = StringFromCLSID( clsidAbout, &wszAboutCLSID );
      if( S_OK != hResult )
      {
        CoTaskMemFree( wszAboutCLSID ); // Free this memory before exiting
        continue;
      }

      W2T( &pszAboutCLSID, wszAboutCLSID );
      hResult = SetSnapInKeyAndValue( pszSnapCLSID, NULL, _T("About"), pszAboutCLSID );
      CoTaskMemFree( wszAboutCLSID );
      CoTaskMemFree( pszAboutCLSID );
      BREAK_ON_ERROR( hResult );
    }

    if( TRUE == bSupportExtensions )     // Build the NodeTypesKey
    {
      hResult = SetSnapInKeyAndValue( pszSnapCLSID, _T("NodeTypes"), NULL, NULL );
      BREAK_ON_ERROR( hResult );
      TCHAR szKey[64];
      _tcscpy( szKey, pszSnapCLSID );
      _tcscat(szKey, _T("\\NodeTypes"));
      hResult = SetSnapInKeyAndValue( szKey, pszSnapCLSID, NULL, NULL );
      BREAK_ON_ERROR( hResult );

      // VIEWEX:  First set the values for the node which will be extended.
      hResult = SetSnapInKeyAndValue( szKey, gtszCLSID_FOLDERNODE, NULL, NULL );
      BREAK_ON_ERROR( hResult );

      // Add the GUID for the node which will be extended under MMC/NodeTypes
      hResult = SetNodeTypesKey( gtszCLSID_FOLDERNODE );
      BREAK_ON_ERROR( hResult );

      // VIEWEX:  Set MMC's View Extension to extend us
      hResult = SetExtensionKey( gtszCLSID_FOLDERNODE,
                                 gtszCLSID_MMCVIEWEX,
                                 _T("View"),
                                 _T("MMCViewExt 1.0 Object")
                               );
      BREAK_ON_ERROR( hResult );
    }
  }while( 0 );

  CoTaskMemFree( pszSnapCLSID);
  return hResult;
}

HRESULT SetExtensionKey | ( | TCHAR * | szNode2Extend,
 |  | TCHAR * | szExtensionNode,
 |  | TCHAR * | szExtensionType,
 |  | TCHAR * | szDescription
 | ) |  |

Definition at line 518 of file registry.cpp.

{
  HKEY    hNodeKey = NULL;
  HRESULT hResult  = S_FALSE;
  TCHAR   szKeyBuf[1024];

  // Load the buffer with the NodeTypes Location
  _tcscpy( szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\NodeTypes") );

  _tcscat( szKeyBuf, _T("\\") );       // Copy NodeType GUID into buffer.
  _tcscat( szKeyBuf, szNode2Extend );

                                       // Copy Subkeys into buffer
  _tcscat( szKeyBuf, _T("\\Extensions\\") );
  _tcscat( szKeyBuf, szExtensionType );

  long lResult = RegCreateKeyEx( HKEY_LOCAL_MACHINE,
                                 szKeyBuf,
                                 0,
                                 NULL,
                                 REG_OPTION_NON_VOLATILE,
                                 KEY_ALL_ACCESS,
                                 NULL,
                                 &hNodeKey,
                                 NULL
                               );

  if( ERROR_SUCCESS != lResult )     // Will return S_FALSE
  {
    RegCloseKey( hNodeKey );
    return S_FALSE;
  }

  hResult = RegSetValueEx( hNodeKey,
                           szExtensionNode,
                           0,
                           REG_SZ,
                           (BYTE*)szDescription,
                           BYTE_SIZE(szDescription)
                         );

  return hResult;
}

HRESULT SetKeyAndValue | ( | const TCHAR * | pszPath,
 |  | const TCHAR * | szSubkey,
 |  | const TCHAR * | szValue
 | ) |  |

Definition at line 332 of file registry.cpp.

{
  HKEY hKey = NULL;
  HRESULT hResult = S_FALSE;
  TCHAR szKeyBuf[1024];

  // Copy keyname into buffer.
  _tcscpy( szKeyBuf, szKey );

  // Add subkey name to buffer.
  if( NULL != szSubkey )
  {
    _tcscat( szKeyBuf, _T("\\") );
    _tcscat( szKeyBuf, szSubkey );
  }

  do                     // We go to all this trouble to prevent any
  {                      // possibility of exiting while leaving a key open

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx( HKEY_CLASSES_ROOT,
                                   szKeyBuf,
                                   0,
                                   NULL,
                                   REG_OPTION_NON_VOLATILE,
                                   KEY_ALL_ACCESS,
                                   NULL,
                                   &hKey,
                                   NULL
                                 );
    if( ERROR_SUCCESS != lResult )
    {
      hResult = HRESULT_FROM_WIN32( lResult );
      continue;
    }

    if( NULL != szValue )    // Now set the value
    {
      hResult = RegSetValueEx( hKey,
                               NULL,
                               0,
                               REG_SZ,
                               (BYTE*)szValue,
                               BYTE_SIZE( szValue )    // BYTE_SIZE is in Globals.h
                             );
      BREAK_ON_ERROR( hResult );
    }
  }while( 0 );

  RegCloseKey( hKey );       // Always try to close the key
  return hResult;
}

HRESULT SetNodeTypesKey ( const TCHAR * szNodeGuid )

Definition at line 572 of file registry.cpp.

{
  HKEY    hKey = NULL;
  TCHAR   szKeyBuf[1024];

  // Load the buffer with the Snap-In Location
  _tcscpy( szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\NodeTypes") );
  _tcscat( szKeyBuf, _T("\\") );       // Copy keyname into buffer.
  _tcscat( szKeyBuf, szNodeGuid );

  // Create and open key.
  long lResult = RegCreateKeyEx( HKEY_LOCAL_MACHINE,
                                 szKeyBuf,
                                 0,
                                 NULL,
                                 REG_OPTION_NON_VOLATILE,
                                 KEY_ALL_ACCESS,
                                 NULL,
                                 &hKey,
                                 NULL
                               );

  RegCloseKey( hKey );       //Always close the key
  return (ERROR_SUCCESS == lResult) ? S_OK : S_FALSE;

}

HRESULT SetSnapInKeyAndValue | ( | const TCHAR * | szKey,
 |  | const TCHAR * | szSubkey,
 |  | const TCHAR * | szName,
 |  | const TCHAR * | szValue
 | ) |  |

Definition at line 451 of file registry.cpp.

{
  HKEY    hKey = NULL;
  HRESULT hResult = S_FALSE;
  TCHAR   szKeyBuf[1024];

  // Load the buffer with the Snap-In Location
  _tcscpy( szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns") );

  _tcscat( szKeyBuf, _T("\\") );       // Copy keyname into buffer.
  _tcscat( szKeyBuf, szKey );

  if( NULL != szSubkey )               // Add subkey name to buffer.
  {
    _tcscat( szKeyBuf, _T("\\") );
    _tcscat( szKeyBuf, szSubkey );
  }

  do                     // We go to all this trouble to prevent any
  {                      // possibility of exiting while leaving a key open

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx( HKEY_LOCAL_MACHINE,
                                   szKeyBuf,
                                   0,
                                   NULL,
                                   REG_OPTION_NON_VOLATILE,
                                   KEY_ALL_ACCESS,
                                   NULL,
                                   &hKey,
                                   NULL
                                 );
    if( ERROR_SUCCESS != lResult )     // Will return S_FALSE
      continue;

    // Set the Value.
    if( szValue != NULL )
    {
      hResult = RegSetValueEx( hKey,
                               szName,
                               0,
                               REG_SZ,
                               (BYTE*)szValue,
                               BYTE_SIZE(szValue)
                             );
      BREAK_ON_ERROR( hResult );
    }
    else
    {                        // Got this far so everything is OK.
      hResult = S_OK;
    }
  }while( 0 );

  RegCloseKey( hKey );       //Always attempt to close the key
  return hResult;
}

HRESULT SetValue | ( | const TCHAR * | szKey,
 |  | const TCHAR * | szValueName,
 |  | const TCHAR * | szValue
 | ) |  |

Definition at line 394 of file registry.cpp.

{
  HKEY    hKey = NULL;
  HRESULT hResult = S_FALSE;
  TCHAR szKeyBuf[1024];

  // Copy keyname into buffer.
  _tcscpy( szKeyBuf, szKey );

  do                     // We go to all this trouble to prevent any
  {                      // possibility of exiting while leaving a key open

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx( HKEY_CLASSES_ROOT ,
                                   szKeyBuf,
                                   0,
                                   NULL,
                                   REG_OPTION_NON_VOLATILE,
                                   KEY_ALL_ACCESS,
                                   NULL,
                                   &hKey,
                                   NULL
                                 );
    if( ERROR_SUCCESS != lResult )
    {
      hResult = HRESULT_FROM_WIN32( lResult );
      continue;
    }

    if( NULL != szValue )    // Now set the value
    {
      hResult = RegSetValueEx( hKey,
                               szValueName,
                               0,
                               REG_SZ,
                               (BYTE*)szValue,
                               BYTE_SIZE( szValue )
                             );
      BREAK_ON_ERROR( hResult );
    }
  }while( 0 );

  RegCloseKey( hKey );       //Always attempt to close the key
  return hResult;
}

LONG UnregisterServer ( const CLSID & clsid )

Definition at line 117 of file registry.cpp.

{
  HRESULT hResult = S_OK;

  // Allocate the CLSID string
  LPOLESTR wszCLSID = NULL ;
  hResult = StringFromCLSID( clsid, &wszCLSID );
  if( S_OK != hResult )
  {
    CoTaskMemFree( wszCLSID );
    return hResult;
  }

  // Build the key CLSID\\{...}
  TCHAR szKey[64];
  _tcscpy( szKey, _T("CLSID\\") );

  TCHAR* pszCLSID = NULL;
  W2T( &pszCLSID, wszCLSID );          // W2T is defined in Globals.h
  CoTaskMemFree( wszCLSID );           // Through with wide version

  _tcscat( szKey, pszCLSID );
  CoTaskMemFree( pszCLSID );           // Through with TCHAR version

  // Delete the CLSID Key - CLSID\{...}
  LONG lResult = RecursiveDeleteKey( HKEY_CLASSES_ROOT, szKey );
  if( ERROR_SUCCESS != lResult )
    hResult = HRESULT_FROM_WIN32( lResult );

  return hResult;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 244 of file registry.cpp.

{
  HRESULT hResult = S_OK;

  TCHAR    szKeyBuf[1024];
  LPOLESTR wszCLSID = NULL;
  TCHAR*   pszCLSID = NULL;        // Needed for TCHAR version of the ClassID

  // Get CLSID as a wide string
  hResult = StringFromCLSID( clsid, &wszCLSID );
  if( S_OK != hResult )
  {
    CoTaskMemFree( wszCLSID );
    return hResult;
  }

  W2T( &pszCLSID, wszCLSID );          // W2T is defined in Globals.h
  CoTaskMemFree( wszCLSID );           // Through with wide version

  // Load the buffer with the Snap-In Location
  _tcscpy( szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns") );

  _tcscat( szKeyBuf, _T("\\") );       // Copy keyname into buffer.
  _tcscat( szKeyBuf, pszCLSID );

  // Delete the CLSID Key - CLSID\{...}
  LONG lResult = RecursiveDeleteKey( HKEY_LOCAL_MACHINE, szKeyBuf );
  if( ERROR_SUCCESS != lResult )
    hResult = HRESULT_FROM_WIN32( lResult );

  CoTaskMemFree( pszCLSID );
  return hResult;
}

Generated on Wed Nov 13 2024 16:53:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/viewex/registry.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • viewex
Functions

registry.h File Reference

#include <tchar.h>

Go to the source code of this file.

Functions

HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const TCHAR *szNameString, const CLSID &clsidAbout, const BOOL fSupportExtensions=FALSE)
HRESULT | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Function Documentation

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const TCHAR * | szFriendlyName
 | ) |  |

Definition at line 51 of file registry.cpp.

{
  // Get server location.
  TCHAR    szModule[512] ;
  TCHAR*   pszCLSID = NULL;
  WCHAR*   wszCLSID = NULL ;
  HRESULT  hResult  = S_FALSE;

  DWORD dwResult = ::GetModuleFileName( hModule,
                                        szModule,
                                        sizeof(szModule)/sizeof(TCHAR)
                                      );
  if( 0 == dwResult ) return HRESULT_FROM_WIN32( dwResult );

  do                         // Fail unless we complete everything
  {
    // Get CLSID string in wide char
    hResult = StringFromCLSID( clsid, &wszCLSID ) ;
    if( S_OK != hResult )
    {
      CoTaskMemFree( wszCLSID );
      BREAK_ON_ERROR( hResult );
    }

    W2T( &pszCLSID, wszCLSID );          // W2T is defined in Globals.h
    CoTaskMemFree( wszCLSID );           // Through with wide version

    TCHAR szKey[64];                     // Build the CLSID key string CLSID\\{...}
    _tcscpy( szKey, _T("CLSID\\") );
    _tcscat( szKey, pszCLSID );

    // Add the CLSID to the registry.
    hResult = SetKeyAndValue( szKey, NULL, szFriendlyName );
    BREAK_ON_ERROR( hResult );

    // Add the server filename subkey under the CLSID key.
    hResult = SetKeyAndValue( szKey, _T("InprocServer32"), szModule );
    BREAK_ON_ERROR( hResult );

    // Set the threading model
    _tcscat( szKey, _T("\\InprocServer32") );
    hResult = SetValue( szKey, _T("ThreadingModel"), _T("Apartment") );
    BREAK_ON_ERROR( hResult );

  }while( 0 );

  CoTaskMemFree( pszCLSID );           // Through with TCHAR version

  return hResult;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | fSupportExtensions = FALSE
 | ) |  |

Definition at line 149 of file registry.cpp.

{
  HRESULT hResult = S_FALSE;
  TCHAR*  pszSnapCLSID = NULL;         // Needed for TCHAR version of the ClassID

  // If any part of this process fails, jump out of the loop and return
  // the error code
  do
  {
    // Allocate the CLSID string
    LPOLESTR wszSnapCLSID  = NULL ;
    hResult = StringFromCLSID( clsid, &wszSnapCLSID ) ;
    if( S_OK != hResult )
    {
       CoTaskMemFree( wszSnapCLSID );
       continue;
    }

    W2T( &pszSnapCLSID, wszSnapCLSID );  // W2T is defined in Globals.h
    CoTaskMemFree( wszSnapCLSID );       // Through with wide version

    // Add the Snap-in's CLSID to the registry
    hResult = SetSnapInKeyAndValue( pszSnapCLSID, NULL, _T("NameString"), szNameString );
    BREAK_ON_ERROR( hResult );

    hResult = SetSnapInKeyAndValue( pszSnapCLSID, _T("StandAlone"), NULL, NULL );
    BREAK_ON_ERROR( hResult );

    // Add registry information for ISnapinAbout if we support it
    LPOLESTR wszAboutCLSID = NULL;
    TCHAR*   pszAboutCLSID = NULL;
    if( IID_NULL != clsidAbout )
    {
      hResult = StringFromCLSID( clsidAbout, &wszAboutCLSID );
      if( S_OK != hResult )
      {
        CoTaskMemFree( wszAboutCLSID ); // Free this memory before exiting
        continue;
      }

      W2T( &pszAboutCLSID, wszAboutCLSID );
      hResult = SetSnapInKeyAndValue( pszSnapCLSID, NULL, _T("About"), pszAboutCLSID );
      CoTaskMemFree( wszAboutCLSID );
      CoTaskMemFree( pszAboutCLSID );
      BREAK_ON_ERROR( hResult );
    }

    if( TRUE == bSupportExtensions )     // Build the NodeTypesKey
    {
      hResult = SetSnapInKeyAndValue( pszSnapCLSID, _T("NodeTypes"), NULL, NULL );
      BREAK_ON_ERROR( hResult );
      TCHAR szKey[64];
      _tcscpy( szKey, pszSnapCLSID );
      _tcscat(szKey, _T("\\NodeTypes"));
      hResult = SetSnapInKeyAndValue( szKey, pszSnapCLSID, NULL, NULL );
      BREAK_ON_ERROR( hResult );
    }
  }while( 0 );

  CoTaskMemFree( pszSnapCLSID);
  return hResult;
}

HRESULT UnregisterServer ( const CLSID & clsid )

Definition at line 112 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

  MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
  _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 184 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Generated on Wed Nov 13 2024 16:53:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/viewex/resource.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • viewex
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDB_APPIMG_16 104
#define | IDB_APPIMG_32 101
#define | IDB_NODEIMAGES_16 106
#define | IDB_NODEIMAGES_32 107
#define | IDC_ARCHIVE_ATTR 1000
#define | IDC_BACKUP_FLAG 1005
#define | IDC_DEVNAME_EDIT 1004
#define | IDC_HIDDEN_ATTR 1001
#define | IDC_LOCKED_ATTR 1002
#define | IDC_READONLY_ATTR 1003
#define | IDD_ADDDEVICE_DLG 109
#define | IDD_ADDVFILE_DLG 110
#define | IDD_BASE_DIALOG 108
#define | IDI_APP_ICON 105

Define Documentation

#define IDB_APPIMG_16 104

Definition at line 6 of file resource.h.

#define IDB_APPIMG_32 101

Definition at line 5 of file resource.h.

#define IDB_NODEIMAGES_16 106

Definition at line 8 of file resource.h.

#define IDB_NODEIMAGES_32 107

Definition at line 9 of file resource.h.

#define IDC_ARCHIVE_ATTR 1000

Definition at line 13 of file resource.h.

#define IDC_BACKUP_FLAG 1005

Definition at line 18 of file resource.h.

#define IDC_DEVNAME_EDIT 1004

Definition at line 17 of file resource.h.

#define IDC_HIDDEN_ATTR 1001

Definition at line 14 of file resource.h.

#define IDC_LOCKED_ATTR 1002

Definition at line 15 of file resource.h.

#define IDC_READONLY_ATTR 1003

Definition at line 16 of file resource.h.

#define IDD_ADDDEVICE_DLG 109

Definition at line 11 of file resource.h.

#define IDD_ADDVFILE_DLG 110

Definition at line 12 of file resource.h.

#define IDD_BASE_DIALOG 108

Definition at line 10 of file resource.h.

#define IDI_APP_ICON 105

Definition at line 7 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/viewex/scripts.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • viewex
Variables

scripts.h File Reference

Go to the source code of this file.

Variables

LPWSTR | GSCRP_BEGIN_FORM = "<BODY><FORM>"
LPWSTR | GSCRP_DELETE_BUTTON = "<BR><BR>"
LPWSTR | GSCRP_END_FORM = "</BODY></FORM>"
LPWSTR | GSCRP_LINK_HOMEPAGE = "<BR>"
LPWSTR | GSCRP_RENAME_BUTTON = "<BR><BR>"

Variable Documentation

LPWSTR GSCRP_BEGIN_FORM = "<BODY><FORM>"

Definition at line 27 of file scripts.h.

LPWSTR GSCRP_DELETE_BUTTON = "<BR><BR>"

Definition at line 57 of file scripts.h.

LPWSTR GSCRP_END_FORM = "</BODY></FORM>"

Definition at line 28 of file scripts.h.

LPWSTR GSCRP_LINK_HOMEPAGE = "<BR>"

Definition at line 70 of file scripts.h.

LPWSTR GSCRP_RENAME_BUTTON = "<BR><BR>"

Definition at line 43 of file scripts.h.

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/viewex/staticnode.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • viewex
Defines

staticnode.cpp File Reference

#include "StaticNode.h"
#include "DeviceNode.h"
#include "CompData.h"
#include "Comp.h"
#include "AddDeviceDlg.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CStaticNode")

Define Documentation

#define MODULESTRING _T("CStaticNode")

Definition at line 25 of file staticnode.cpp.

Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/viewex/staticnode.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • viewex
Classes

staticnode.h File Reference

#include "Globals.h"
#include "BaseNode.h"
#include "LListImpl.h"

Go to the source code of this file.

Classes

class CStaticNode
Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/viewex/tracemacro.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • viewex
Functions

tracemacro.cpp File Reference

#include "Globals.h"
#include "TraceMacro.h"
#include <StdIo.h>

Go to the source code of this file.

Functions

VOID | MapEvent (LONG Event, LPTSTR szEventStr)
VOID | Trace_Event (LPCTSTR pszClass, LPCTSTR pszFunction, LONG nEvent)
VOID | Trace_HR (LPCTSTR pszClass, LPCTSTR pszFunction, HRESULT hr)
VOID | Trace_Pointer (LPCTSTR pszClass, LPCTSTR pszFunction, LPCTSTR pszAction, ULONG ulValue)
VOID | Trace_Start (LPCTSTR pszClass, LPCTSTR pszFunction)
VOID | Trace_Value (LPCTSTR pszClass, LPCTSTR pszFunction, LPCTSTR pszValueName, LONG nValue)

Function Documentation

VOID MapEvent | ( | LONG | Event,
 |  | LPTSTR | szEventStr
 | ) |  |

Definition at line 179 of file tracemacro.cpp.

{
#ifdef _DEBUG

  switch( Event )
  {
    case MMCN_ACTIVATE:
      _tcscpy( szEventStr, _T("MMCN_ACTIVATE          ") );
      break;

    case MMCN_ADD_IMAGES:
      _tcscpy( szEventStr, _T("MMCN_ADD_IMAGES        ") );
      break;

    case MMCN_BTN_CLICK:
      _tcscpy( szEventStr, _T("MMCN_BTN_CLICK         ") );
      break;

    case MMCN_CLICK:
      _tcscpy( szEventStr, _T("MMCN_CLICK             ") );
      break;

    case MMCN_COLUMN_CLICK:
      _tcscpy( szEventStr, _T("MMCN_COLUMN_CLICK       ") );
      break;

    case MMCN_CONTEXTMENU:
      _tcscpy( szEventStr, _T("MMCN_CONTEXTMENU        ") );
      break;

    case MMCN_CUTORMOVE:
      _tcscpy( szEventStr, _T("MMCN_CUTORMOVE          ") );
      break;

    case MMCN_DBLCLICK:
      _tcscpy( szEventStr, _T("MMCN_DBLCLICK           ") );
      break;

    case MMCN_DELETE:
      _tcscpy( szEventStr, _T("MMCN_DELETE             ") );
      break;

    case MMCN_DESELECT_ALL:
      _tcscpy( szEventStr, _T("MMCN_DESELECT_ALL       ") );
      break;

    case MMCN_EXPAND:
      _tcscpy( szEventStr, _T("MMCN_EXPAND             ") );
      break;

    case MMCN_HELP:
      _tcscpy( szEventStr, _T("MMCN_HELP               ") );
      break;

    case MMCN_MENU_BTNCLICK:
      _tcscpy( szEventStr, _T("MMCN_MENU_BTNCLICK      ") );
      break;

    case MMCN_MINIMIZED:
      _tcscpy( szEventStr, _T("MMCN_MINIMIZED          ") );
      break;

    case MMCN_PASTE:
      _tcscpy( szEventStr, _T("MMCN_PASTE              ") );
      break;

    case MMCN_PROPERTY_CHANGE:
      _tcscpy( szEventStr, _T("MMCN_PROPERTY_CHANGE    ") );
      break;

    case MMCN_QUERY_PASTE:
      _tcscpy( szEventStr, _T("MMCN_QUERY_PASTE        ") );
      break;

    case MMCN_REFRESH:
      _tcscpy( szEventStr, _T("MMCN_REFRESH            ") );
      break;

    case MMCN_REMOVE_CHILDREN:
      _tcscpy( szEventStr, _T("MMCN_REMOVE_CHILDREN    ") );
      break;

    case MMCN_RENAME:
      _tcscpy( szEventStr, _T("MMCN_RENAME             ") );
      break;

    case MMCN_SELECT:
      _tcscpy( szEventStr, _T("MMCN_SELECT             ") );
      break;

    case MMCN_SHOW:
      _tcscpy( szEventStr, _T("MMCN_SHOW               ") );
      break;

    case MMCN_VIEW_CHANGE:
      _tcscpy( szEventStr, _T("MMCN_VIEW_CHANGE        ") );
      break;

    case MMCN_SNAPINHELP:
      _tcscpy( szEventStr, _T("MMCN_SNAPINHELP         ") );
      break;

    case MMCN_CONTEXTHELP:
      _tcscpy( szEventStr, _T("MMCN_CONTEXTHELP        ") );
      break;

    case MMCN_INITOCX:
      _tcscpy( szEventStr, _T("MMCN_INITOCX            ") );
      break;

    // MMC Version 1.1 notifications
    case MMCN_FILTER_CHANGE:
      _tcscpy( szEventStr, _T("MMCN_FILTER_CHANGE      ") );
      break;

    case MMCN_FILTERBTN_CLICK:
      _tcscpy( szEventStr, _T("MMCN_FILTERBTN_CLICK    ") );
      break;

    case MMCN_RESTORE_VIEW:
      _tcscpy( szEventStr, _T("MMCN_RESTORE_VIEW       ") );
      break;

    case MMCN_PRINT:
      _tcscpy( szEventStr, _T("MMCN_PRINT              ") );
      break;

    case MMCN_PRELOAD:
      _tcscpy( szEventStr, _T("MMCN_PRELOAD            ") );
      break;

    case MMCN_LISTPAD:
      _tcscpy( szEventStr, _T("MMCN_LISTPAD            ") );
      break;

    case MMCN_EXPANDSYNC:
      _tcscpy( szEventStr, _T("MMCN_EXPANDSYNC         ") );
      break;

    // MMC Version 1.2 notifications
    case MMCN_COLUMNS_CHANGED:
      _tcscpy( szEventStr, _T("MMCN_COLUMNS_CHANGED    ") );
      break;

    // MMC Version 2.0 notifications
    case MMCN_CANPASTE_OUTOFPROC:
      _tcscpy( szEventStr, _T("MMCN_CANPASTE_OUTOFPROC ") );
      break;

    default:
      _stprintf( szEventStr, _T("0x%X"), Event );
      break;
  }

#endif
} //end MapEvent()

VOID Trace_Event | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LONG | nEvent
 | ) |  |

Definition at line 119 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szEventStr[64];
  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Event = %s\n");
  INT    nChars     = 0;

  MapEvent( nEvent, szEventStr );

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      szEventStr
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Event()

VOID Trace_HR | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | HRESULT | hr
 | ) |  |

Definition at line 28 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Returned 0x%X\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer, szFormat, pszClass, pszFunction, hr );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_HR()

VOID Trace_Pointer | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LPCTSTR | pszAction,
 |  | ULONG | ulValue
 | ) |  |

Definition at line 86 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> %s = 0x%X\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      pszAction,
                      ulValue
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Pointer()

VOID Trace_Start | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction
 | ) |  |

Definition at line 151 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Started \n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Start()

VOID Trace_Value | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LPCTSTR | pszValueName,
 |  | LONG | nValue
 | ) |  |

Definition at line 54 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> %s = %u\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      pszValueName,
                      nValue
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Value()

Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/viewex/tracemacro.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • viewex
Defines | Functions

tracemacro.h File Reference

Go to the source code of this file.

Defines

#define | TRACE_EVENT
#define | TRACE_HRESULT
#define | TRACE_PTR
#define | TRACE_START
#define | TRACE_VAL

Functions

VOID | MapEvent (LONG Event, LPTSTR szEventStr)
VOID | Trace_Event (LPCTSTR pszClass, LPCTSTR pszFunction, LONG nEvent)
VOID | Trace_HR (LPCTSTR pszClass, LPCTSTR pszFunction, HRESULT hr)
VOID | Trace_Pointer (LPCTSTR pszClass, LPCTSTR pszFunction, LPCTSTR pszAction, ULONG ulValue)
VOID | Trace_Start (LPCTSTR pszClass, LPCTSTR pszFunction)
VOID | Trace_Value (LPCTSTR pszClass, LPCTSTR pszFunction, LPCTSTR pszValueName, LONG nValue)

Define Documentation

#define TRACE_EVENT

Definition at line 64 of file tracemacro.h.

#define TRACE_HRESULT

Definition at line 55 of file tracemacro.h.

#define TRACE_PTR

Definition at line 61 of file tracemacro.h.

#define TRACE_START

Definition at line 67 of file tracemacro.h.

#define TRACE_VAL

Definition at line 58 of file tracemacro.h.

Function Documentation

VOID MapEvent | ( | LONG | Event,
 |  | LPTSTR | szEventStr
 | ) |  |

Definition at line 146 of file tracemacro.cpp.

{
#ifdef _DEBUG

  switch( Event )
  {
    case 0x8001:
      _tcscpy( szEventStr, _T("MMCN_ACTIVATE       ") );
      break;

    case 0x8002:
      _tcscpy( szEventStr, _T("MMCN_ADD_IMAGES     ") );
      break;

    case 0x8003:
      _tcscpy( szEventStr, _T("MMCN_BTN_CLICK      ") );
      break;

    case 0x8004:
      _tcscpy( szEventStr, _T("MMCN_CLICK          ") );
      break;

    case 0x8005:
      _tcscpy( szEventStr, _T("MMCN_COLUMN_CLICK   ") );
      break;

    case 0x8006:
      _tcscpy( szEventStr, _T("MMCN_CONTEXTMENU    ") );
      break;

    case 0x8007:
      _tcscpy( szEventStr, _T("MMCN_CUTORMOVE      ") );
      break;

    case 0x8008:
      _tcscpy( szEventStr, _T("MMCN_DBLCLICK       ") );
      break;

    case 0x8009:
      _tcscpy( szEventStr, _T("MMCN_DELETE         ") );
      break;

    case 0x800A:
      _tcscpy( szEventStr, _T("MMCN_DESELECT_ALL   ") );
      break;

    case 0x800B:
      _tcscpy( szEventStr, _T("MMCN_EXPAND         ") );
      break;

    case 0x800C:
      _tcscpy( szEventStr, _T("MMCN_HELP           ") );
      break;

    case 0x800D:
      _tcscpy( szEventStr, _T("MMCN_MENU_BTNCLICK  ") );
      break;

    case 0x800E:
      _tcscpy( szEventStr, _T("MMCN_MINIMIZED      ") );
      break;

    case 0x800F:
      _tcscpy( szEventStr, _T("MMCN_PASTE          ") );
      break;

    case 0x8010:
      _tcscpy( szEventStr, _T("MMCN_PROPERTY_CHANGE") );
      break;

    case 0x8011:
      _tcscpy( szEventStr, _T("MMCN_QUERY_PASTE    ") );
      break;

    case 0x8012:
      _tcscpy( szEventStr, _T("MMCN_REFRESH        ") );
      break;

    case 0x8013:
      _tcscpy( szEventStr, _T("MMCN_REMOVE_CHILDREN") );
      break;

    case 0x8014:
      _tcscpy( szEventStr, _T("MMCN_RENAME         ") );
      break;

    case 0x8015:
      _tcscpy( szEventStr, _T("MMCN_SELECT         ") );
      break;

    case 0x8016:
      _tcscpy( szEventStr, _T("MMCN_SHOW           ") );
      break;

    case 0x8017:
      _tcscpy( szEventStr, _T("MMCN_VIEW_CHANGE    ") );
      break;

    case 0x8018:
      _tcscpy( szEventStr, _T("MMCN_SNAPINHELP     ") );
      break;

    case 0x8019:
      _tcscpy( szEventStr, _T("MMCN_CONTEXTHELP    ") );
      break;

    case 0x801A:
      _tcscpy( szEventStr, _T("MMCN_INITOCX        ") );
      break;

    case 0x8021:
      _tcscpy( szEventStr, _T("MMCN_EXPANDSYNC     ") );
      break;

    default:
      _stprintf( szEventStr, _T("0x%X"), Event );
      break;
  }

#endif
} //end MapEvent()

VOID Trace_Event | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LONG | nEvent
 | ) |  |

Definition at line 86 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szEventStr[22];
  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Event = %s\n");
  INT    nChars     = 0;

  MapEvent( nEvent, szEventStr );

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      szEventStr
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Event()

VOID Trace_HR | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | HRESULT | hr
 | ) |  |

Definition at line 27 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Returned 0x%X\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer, szFormat, pszClass, pszFunction, hr );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_HR()

VOID Trace_Pointer | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LPCTSTR | pszAction,
 |  | ULONG | ulValue
 | ) |  |

Definition at line 86 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> %s = 0x%X\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      pszAction,
                      ulValue
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Pointer()

VOID Trace_Start | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction
 | ) |  |

Definition at line 118 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> Started \n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Start()

VOID Trace_Value | ( | LPCTSTR | pszClass,
 |  | LPCTSTR | pszFunction,
 |  | LPCTSTR | pszValueName,
 |  | LONG | nValue
 | ) |  |

Definition at line 53 of file tracemacro.cpp.

{
#ifdef _DEBUG

  TCHAR  szBuffer[512];
  TCHAR  szFormat[] = _T("%s::%s-> %s = %u\n");
  INT    nChars     = 0;

  nChars = _stprintf( szBuffer,
                      szFormat,
                      pszClass,
                      pszFunction,
                      pszValueName,
                      nValue
                    );
  _ASSERTE( nChars < sizeof(szBuffer) );

  OutputDebugString( szBuffer );

#endif
} //end Trace_Value()

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/viewex/virtualfile.cpp File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • viewex
Defines

virtualfile.cpp File Reference

#include <stdio.h>
#include "VirtualFile.h"
#include "Globals.h"
#include "CompData.h"
#include "Comp.h"
#include "FolderNode.h"
#include "Scripts.h"
#include "TraceMacro.h"

Go to the source code of this file.

Defines

#define MODULESTRING _T("CVirtualFile")

Define Documentation

#define MODULESTRING _T("CVirtualFile")

Definition at line 28 of file virtualfile.cpp.

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/mmc2.0/viewex/virtualfile.h File Reference

  • SysMgmt
  • MMC
  • mmc2.0
  • viewex
Classes

virtualfile.h File Reference

#include "Globals.h"
#include "BaseNode.h"

Go to the source code of this file.

Classes

class CVirtualFile
Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Multisel/about.Cpp File Reference

  • SysMgmt
  • MMC
  • Multisel
Functions

about.Cpp File Reference

#include "About.h"
#include "resource.h"
#include "globals.h"
#include <crtdbg.h>

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CSnapinAbout

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 89 of file about.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        // we need to decrement our object count in the DLL
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:54:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Multisel/about.h File Reference

  • SysMgmt
  • MMC
  • Multisel
Classes

about.h File Reference

#include <tchar.h>
#include <mmc.h>

Go to the source code of this file.

Classes

class CSnapinAbout
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Multisel/backgrnd.Cpp File Reference

  • SysMgmt
  • MMC
  • Multisel
Defines

backgrnd.Cpp File Reference

#include <stdio.h>
#include "Backgrnd.h"

Go to the source code of this file.

Defines

#define | WM_DISCOVERYCOMPLETE (WM_APP + 1)
#define | WM_NEWOBJECT WM_APP

Define Documentation

#define WM_DISCOVERYCOMPLETE (WM_APP + 1)

Definition at line 26 of file backgrnd.Cpp.

#define WM_NEWOBJECT WM_APP

Definition at line 25 of file backgrnd.Cpp.

Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Multisel/backgrnd.h File Reference

  • SysMgmt
  • MMC
  • Multisel
Classes

backgrnd.h File Reference

#include "DeleBase.h"
#include "DeleBase.h"

Go to the source code of this file.

Classes

class | CBackground
class | CBackgroundFolder
Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Multisel/basesnap.Cpp File Reference

  • SysMgmt
  • MMC
  • Multisel
Functions | Variables

basesnap.Cpp File Reference

#include <objbase.h>
#include <olectl.h>
#include <initguid.h>
#include "guids.h"
#include "basesnap.h"
#include "Comp.h"
#include "CompData.h"
#include "About.h"
#include "Registry.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)
BOOL WINAPI | DllMain (HINSTANCE hinstDLL, DWORD fdwReason, void *lpvReserved)
STDAPI | DllRegisterServer ()
STDAPI | DllUnregisterServer ()
STDMETHODIMP_ (ULONG) CClassFactory

Variables

HINSTANCE | g_hinst

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 77 of file basesnap.Cpp.

{
    if (g_uObjects == 0 && g_uSrvLock == 0)
        return S_OK;
    else
        return S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 45 of file basesnap.Cpp.

{
    if ((rclsid != CLSID_CComponentData) && (rclsid != CLSID_CSnapinAbout))
        return CLASS_E_CLASSNOTAVAILABLE;

    if (!ppvObj)
        return E_FAIL;

    *ppvObj = NULL;

    // We can only hand out IUnknown and IClassFactory pointers.  Fail
    // if they ask for anything else.
    if (!IsEqualIID(riid, IID_IUnknown) && !IsEqualIID(riid, IID_IClassFactory))
        return E_NOINTERFACE;

    CClassFactory *pFactory = NULL;

    // make the factory passing in the creation function for the type of object they want
    if (rclsid == CLSID_CComponentData)
        pFactory = new CClassFactory(CClassFactory::COMPONENT);
    else if (rclsid == CLSID_CSnapinAbout)
        pFactory = new CClassFactory(CClassFactory::ABOUT);

    if (NULL == pFactory)
        return E_OUTOFMEMORY;

    HRESULT hr = pFactory->QueryInterface(riid, ppvObj);

    return hr;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hinstDLL,
 |  | DWORD | fdwReason,
 |  | void * | lpvReserved
 | ) |  |

Definition at line 32 of file basesnap.Cpp.

{

    if (fdwReason == DLL_PROCESS_ATTACH) {
        g_hinst = hinstDLL;
    }

    return TRUE;
}

STDAPI DllRegisterServer ( void )

Definition at line 187 of file basesnap.Cpp.

{
    HRESULT hr = SELFREG_E_CLASS;
    _TCHAR szName[256];
    _TCHAR szSnapInName[256];

    LoadString(g_hinst, IDS_NAME, szName, (sizeof szName)/(sizeof szName[0]));
    LoadString(g_hinst, IDS_SNAPINNAME, szSnapInName, (sizeof szSnapInName)/(sizeof szSnapInName[0]));

    _TCHAR szAboutName[256];

    LoadString(g_hinst, IDS_ABOUTNAME, szAboutName, (sizeof szAboutName)/(sizeof szAboutName[0]));

    // register our CoClasses
    hr = RegisterServer(g_hinst,
        CLSID_CComponentData,
        szName);

    if SUCCEEDED(hr)
        hr = RegisterServer(g_hinst,
        CLSID_CSnapinAbout,
        szAboutName);

    // place the registry information for SnapIns
    if SUCCEEDED(hr)
        hr = RegisterSnapin(CLSID_CComponentData, szSnapInName, CLSID_CSnapinAbout, FALSE);

    return hr;
}

STDAPI DllUnregisterServer ( void )

Definition at line 218 of file basesnap.Cpp.

{
    if (UnregisterServer(CLSID_CComponentData) == S_OK)
        return UnregisterSnapin(CLSID_CComponentData);
    else
        return E_FAIL;
}

STDMETHODIMP_ ( ULONG )

Definition at line 124 of file basesnap.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;
}

Variable Documentation

HINSTANCE g_hinst

Definition at line 30 of file basesnap.Cpp.

Generated on Wed Nov 13 2024 16:54:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Multisel/basesnap.h File Reference

  • SysMgmt
  • MMC
  • Multisel
Classes | Functions | Variables

basesnap.h File Reference

Go to the source code of this file.

Classes

class | CClassFactory

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)

Variables

ULONG | g_uObjects = 0
ULONG | g_uSrvLock = 0

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 53 of file ComSpyAudit.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 61 of file ComSpyAudit.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

Variable Documentation

ULONG g_uObjects = 0

Definition at line 24 of file basesnap.h.

ULONG g_uSrvLock = 0

Definition at line 25 of file basesnap.h.

Generated on Wed Nov 13 2024 16:54:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Multisel/comp.Cpp File Reference

  • SysMgmt
  • MMC
  • Multisel
Functions

comp.Cpp File Reference

#include "Comp.h"
#include "CompData.h"
#include "Space.h"
#include "DataObj.h"
#include <commctrl.h>
#include <crtdbg.h>
#include <stdio.h>
#include "globals.h"
#include "resource.h"
#include "DeleBase.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CComponent

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 70 of file comp.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Multisel/comp.h File Reference

  • SysMgmt
  • MMC
  • Multisel
Classes

comp.h File Reference

#include <mmc.h>
#include "DataObj.h"
#include "DataObj.h"

Go to the source code of this file.

Classes

class CComponent
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Multisel/compdata.Cpp File Reference

  • SysMgmt
  • MMC
  • Multisel
Functions

compdata.Cpp File Reference

#include "Comp.h"
#include "CompData.h"
#include "DataObj.h"
#include "resource.h"
#include <crtdbg.h>

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CComponentData

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 72 of file compdata.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        // we need to decrement our object count in the DLL
        delete this;
        return 0;
    }

    return m_cref;
}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Multisel/compdata.h File Reference

  • SysMgmt
  • MMC
  • Multisel
Classes

compdata.h File Reference

#include <mmc.h>
#include "DeleBase.h"
#include "StatNode.h"
#include "Comp.h"
#include "StatNode.h"

Go to the source code of this file.

Classes

class CComponentData
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Multisel/dataobj.Cpp File Reference

  • SysMgmt
  • MMC
  • Multisel
Defines | Functions

dataobj.Cpp File Reference

#include "DataObj.h"
#include "guids.h"
#include "DeleBase.h"
#include "Space.h"

Go to the source code of this file.

Defines

#define | _T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")
#define | _T_CCF_INTERNAL_SNAPIN _T("{2479DB32-5276-11d2-94F5-00C04FB92EC2}")
#define | _T_CCF_NODETYPE _T("CCF_NODETYPE")
#define | _T_CCF_OBJECT_TYPES_IN_MULTI_SELECT _T("CCF_OBJECT_TYPES_IN_MULTI_SELECT")
#define | _T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")
#define | _T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")

Functions

CDataObject * | GetOurDataObject (LPDATAOBJECT lpDataObject)
STDMETHODIMP_ (ULONG) CDataObject

Define Documentation

#define _T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")

Definition at line 32 of file dataobj.Cpp.

#define _T_CCF_INTERNAL_SNAPIN _T("{2479DB32-5276-11d2-94F5-00C04FB92EC2}")

Definition at line 38 of file dataobj.Cpp.

#define _T_CCF_NODETYPE _T("CCF_NODETYPE")

Definition at line 33 of file dataobj.Cpp.

#define _T_CCF_OBJECT_TYPES_IN_MULTI_SELECT _T("CCF_OBJECT_TYPES_IN_MULTI_SELECT")

Definition at line 36 of file dataobj.Cpp.

#define _T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")

Definition at line 35 of file dataobj.Cpp.

#define _T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")

Definition at line 34 of file dataobj.Cpp.

Function Documentation

CDataObject* GetOurDataObject ( LPDATAOBJECT lpDataObject )

Definition at line 232 of file dataobj.Cpp.

{
    HRESULT       hr      = S_OK;
    CDataObject *pSDO     = NULL;

  // check to see if the data object is a special data object.
  if ( IS_SPECIAL_DATAOBJECT (lpDataObject) )
  {
    //Code for handling a special data object goes here.

    //Note that the MMC SDK samples do not handle
    //special data objects, so we exit if we get one.
    return NULL;
  }

    STGMEDIUM stgmedium = { TYMED_HGLOBAL,  NULL  };
    FORMATETC formatetc = { CDataObject::s_cfInternal, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };

    // Allocate memory for the stream
    stgmedium.hGlobal = GlobalAlloc( GMEM_SHARE, sizeof(CDataObject *));

    if (!stgmedium.hGlobal)     {
        hr = E_OUTOFMEMORY;
    }

    if SUCCEEDED(hr)
        // Attempt to get data from the object
        hr = lpDataObject->GetDataHere( &formatetc, &stgmedium );

    // stgmedium now has the data we need
    if (SUCCEEDED(hr))  {
        pSDO = *(CDataObject **)(stgmedium.hGlobal);
    }

    // if we have memory free it
    if (stgmedium.hGlobal)
        GlobalFree(stgmedium.hGlobal);

    return pSDO;

} // end GetOurDataObject()

STDMETHODIMP_ ( ULONG )

Definition at line 106 of file dataobj.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Multisel/dataobj.h File Reference

  • SysMgmt
  • MMC
  • Multisel
Classes | Functions

dataobj.h File Reference

#include <mmc.h>
#include "DeleBase.h"

Go to the source code of this file.

Classes

class | CDataObject

Functions

HRESULT | ExtractFromDataObject (IDataObject *lpDataObject, UINT cf, ULONG cb, HGLOBAL *phGlobal)
CDataObject * | GetOurDataObject (IDataObject *lpDataObject)
BOOL | IsMMCMultiSelectDataObject (IDataObject *lpDataObject)

Function Documentation

HRESULT ExtractFromDataObject | ( | IDataObject * | lpDataObject,
 |  | UINT | cf,
 |  | ULONG | cb,
 |  | HGLOBAL * | phGlobal
 | ) |  |
CDataObject* GetOurDataObject ( IDataObject * lpDataObject )
BOOL IsMMCMultiSelectDataObject ( IDataObject * lpDataObject )
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Multisel/delebase.Cpp File Reference

  • SysMgmt
  • MMC
  • Multisel

delebase.Cpp File Reference

#include "DeleBase.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Multisel/delebase.h File Reference

  • SysMgmt
  • MMC
  • Multisel
Classes

delebase.h File Reference

#include <mmc.h>
#include <crtdbg.h>
#include "globals.h"
#include "resource.h"
#include "LocalRes.h"
#include "LocalRes.h"

Go to the source code of this file.

Classes

class CDelegationBase
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Multisel/globals.h File Reference

  • SysMgmt
  • MMC
  • Multisel
Classes | Defines | Enumerations | Functions | Variables

globals.h File Reference

#include <mmc.h>
#include <tchar.h>

Go to the source code of this file.

Classes

class | TempBuffer

Defines

#define | IDM_BUTTON1 0x100
#define | IDM_BUTTON2 0x101
#define | MAKE_TSTRPTR_FROMWIDE(ptrname, widestr)
#define | MAKE_WIDEPTR_FROMTSTR(ptrname, tstr)
#define | MAKE_WIDEPTR_FROMTSTR_ALLOC(ptrname, tstr)
#define | OBJECT_CREATED InterlockedIncrement((long *)&g_uObjects);
#define | OBJECT_DESTROYED InterlockedDecrement((long *)&g_uObjects);

Enumerations

enum ITEM_TYPE {
SCOPE = 10, RESULT, SCOPE = 10, RESULT,
SCOPE = 10, RESULT
}
enum UPDATE_VIEWS_HINT {
UPDATE_SCOPEITEM = 1000, DELETE_SCOPEITEM, UPDATE_RESULTITEM, DELETE_RESULTITEM,
UPDATE_SCOPEITEM = 1000, DELETE_SCOPEITEM, UPDATE_RESULTITEM, DELETE_RESULTITEM,
UPDATE_SCOPEITEM = 1000, DELETE_SCOPEITEM, UPDATE_RESULTITEM, DELETE_RESULTITEM
}

Functions

void | MMCN_Crack (BOOL bComponentData, IDataObject *pDataObject, IComponentData *pCompData, IComponent *pComp, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)

Variables

HINSTANCE | g_hinst
ULONG g_uObjects

Define Documentation

#define IDM_BUTTON1 0x100

Definition at line 30 of file globals.h.

#define IDM_BUTTON2 0x101

Definition at line 31 of file globals.h.

#define MAKE_TSTRPTR_FROMWIDE | ( | ptrname,
 |  | widestr
 | ) |
Value:
long __l##ptrname = (wcslen(widestr) + 1) * 2 * sizeof(TCHAR); \
    TempBuffer __TempBuffer##ptrname(__l##ptrname); \
    WideCharToMultiByte(CP_ACP, 0, widestr, -1, (LPSTR)__TempBuffer##ptrname.GetBuffer(), __l##ptrname, NULL, NULL); \
    LPTSTR ptrname = (LPTSTR)__TempBuffer##ptrname.GetBuffer()

Definition at line 132 of file globals.h.

#define MAKE_WIDEPTR_FROMTSTR | ( | ptrname,
 |  | tstr
 | ) |
Value:
long __cch##ptrname = (lstrlenA(tstr) + 1);\
    long __l##ptrname = (lstrlenA(tstr) + 1) * sizeof(WCHAR); \
    TempBuffer __TempBuffer##ptrname(__l##ptrname); \
    MultiByteToWideChar(CP_ACP, 0, tstr, -1, (LPWSTR)__TempBuffer##ptrname.GetBuffer(), __cch##ptrname); \
    LPWSTR ptrname = (LPWSTR)__TempBuffer##ptrname.GetBuffer()

Definition at line 98 of file globals.h.

#define MAKE_WIDEPTR_FROMTSTR_ALLOC | ( | ptrname,
 |  | tstr
 | ) |
Value:
long __cch##ptrname = (lstrlenA(tstr) + 1);\
    long __l##ptrname = (lstrlenA(tstr) + 1) * sizeof(WCHAR); \
    LPWSTR ptrname = (LPWSTR)CoTaskMemAlloc(__l##ptrname); \
    MultiByteToWideChar(CP_ACP, 0, tstr, -1, ptrname, __cch##ptrname)

Definition at line 112 of file globals.h.

#define OBJECT_CREATED InterlockedIncrement((long *)&g_uObjects);

Definition at line 36 of file globals.h.

#define OBJECT_DESTROYED InterlockedDecrement((long *)&g_uObjects);

Definition at line 37 of file globals.h.

Enumeration Type Documentation

enum ITEM_TYPE
Enumerator:
SCOPE
RESULT
SCOPE
RESULT
SCOPE
RESULT

Definition at line 28 of file globals.h.

{SCOPE = 10, RESULT};

enum UPDATE_VIEWS_HINT
Enumerator:
UPDATE_SCOPEITEM
DELETE_SCOPEITEM
UPDATE_RESULTITEM
DELETE_RESULTITEM
UPDATE_SCOPEITEM
DELETE_SCOPEITEM
UPDATE_RESULTITEM
DELETE_RESULTITEM
UPDATE_SCOPEITEM
DELETE_SCOPEITEM
UPDATE_RESULTITEM
DELETE_RESULTITEM

Definition at line 27 of file globals.h.

{UPDATE_SCOPEITEM = 1000, DELETE_SCOPEITEM, UPDATE_RESULTITEM, DELETE_RESULTITEM};

Function Documentation

void MMCN_Crack | ( | BOOL | bComponentData,
 |  | IDataObject * | pDataObject,
 |  | IComponentData * | pCompData,
 |  | IComponent * | pComp,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param
 | ) |  |

Definition at line 59 of file mmccrack.Cpp.

{
#ifdef MMC_CRACK_MESSAGES
        const size_t cchMessage = 256;
  TCHAR message[cchMessage] = {0};

  if (bComponentData == TRUE)
    OutputDebugString(_T("IComponentData::Notify( "));
  else
    OutputDebugString(_T("IComponent::Notify( "));

  wsprintf(message, _T("DataObject: %08x, CompData: %08x, Comp: %08x ) - "), pDataObject, pCompData, pComp);
  OutputDebugString(message);

    switch (event)  {
    case MMCN_ACTIVATE:
      wsprintf(message, _T("MMCN_ACTIVATE\n\tActivate: %d\n"), arg);
      break;

    case MMCN_ADD_IMAGES:
      wsprintf(message, _T("MMCN_ADD_IMAGES\n\tImage List: %08x\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_BTN_CLICK:
      wsprintf(message, _T("MMCN_BTN_CLICK\n\tVerb: %ws\n"), MMCN_CrackVerb((MMC_CONSOLE_VERB)param));
      break;

    case MMCN_COLUMN_CLICK:
      wsprintf(message, _T("MMCN_COLUMN_CLICK\n\tColumn: %d\n\tSort Option: %d\n"), arg,   param);
      break;

    case MMCN_COLUMNS_CHANGED:
      wsprintf(message, _T("MMCN_COLUMNS_CHANGED\n"));
      break;

    case MMCN_CONTEXTHELP:
      wsprintf(message, _T("MMCN_CONTEXTHELP\n"));
      break;

    case MMCN_CONTEXTMENU:
      wsprintf(message, _T("MMCN_CONTEXTMENU\n"));
      break;

    case MMCN_CUTORMOVE:
      wsprintf(message, _T("MMCN_CUTORMOVE\n"));
      break;

    case MMCN_DBLCLICK:
      wsprintf(message, _T("MMCN_DBLCLICK\n"));
      break;

    case MMCN_DELETE:
      wsprintf(message, _T("MMCN_DELETE\n"));
      break;

    case MMCN_DESELECT_ALL:
      wsprintf(message, _T("MMCN_DESELECT_ALL\n"));
      break;

    case MMCN_EXPAND:
      wsprintf(message, _T("MMCN_EXPAND\n\tExpand: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_EXPANDSYNC:
      wsprintf(message, _T("MMCN_EXPANDSYNC\n"));
      break;

    case MMCN_FILTERBTN_CLICK:
      wsprintf(message, _T("MMCN_FILTERBTN_CLICK\n\tColumn: %d\n"), arg);
      break;

    case MMCN_FILTER_CHANGE:
      wsprintf(message, _T("MMCN_FILTER_CHANGE\n\tColumn: %d\n"), param);
      break;

    case MMCN_HELP:
      wsprintf(message, _T("MMCN_HELP\n"));
      break;

    case MMCN_INITOCX:
      wsprintf(message, _T("MMCN_INITOCX\n\tIUnknown: %08x\n"), param);
      break;

    case MMCN_LISTPAD:
      wsprintf(message, _T("MMCN_LISTPAD\n\tConnect: %d\n"), arg);
      break;

    case MMCN_MENU_BTNCLICK:
      wsprintf(message, _T("MMCN_MENU_BTNCLICK\n"));
      break;

    case MMCN_MINIMIZED:
      wsprintf(message, _T("MMCN_MINIMIZED\n\tMinimized: %d\n"), arg);
      break;

    case MMCN_PASTE:
      wsprintf(message, _T("MMCN_PASTE\n\tCopy: %d\n"), param == NULL);
      break;

    case MMCN_PRELOAD:
      wsprintf(message, _T("MMCN_PRELOAD\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_PRINT:
      wsprintf(message, _T("MMCN_PRINT\n"));
      break;

    case MMCN_PROPERTY_CHANGE:
      wsprintf(message, _T("MMCN_PROPERTY_CHANGE\n\tScope: %d\n\tArg: %08x\n"), arg, param);
      break;

    case MMCN_QUERY_PASTE:
      wsprintf(message, _T("MMCN_QUERY_PASTE\n"));
      break;

    case MMCN_REFRESH:
      wsprintf(message, _T("MMCN_REFRESH\n"));
      break;

    case MMCN_REMOVE_CHILDREN:
      wsprintf(message, _T("MMCN_REMOVE_CHILDREN\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_RENAME:
                        // Destination string may contain a truncation of the ideal result.
                        // (Indicated by return value other than S_OK).
                        // However, it will be null-terminated.
      StringCchPrintf(message, cchMessage, _T("MMCN_RENAME\n\tNew Name: '%ws'\n"), (LPOLESTR)param);
      break;

    case MMCN_RESTORE_VIEW:
      wsprintf(message, _T("MMCN_RESTORE_VIEW\n"));
      break;

    case MMCN_SELECT:
      wsprintf(message, _T("MMCN_SELECT\n\tScope: %d\n\tSelect: %08x\n"), LOWORD(arg), HIWORD(arg));
      break;

    case MMCN_SHOW:
      wsprintf(message, _T("MMCN_SHOW\n\tShow: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_SNAPINHELP:
      wsprintf(message, _T("MMCN_SNAPINHELP\n"));
      break;

    case MMCN_VIEW_CHANGE:
      wsprintf(message, _T("MMCN_VIEW_CHANGE\n\tData: %08x\n\tHint: %08x\n"), arg, param);
      break;
  }

  if (message[0] != 0)
    OutputDebugString(message);
  else
    OutputDebugString(_T("unknown event\n"));

#endif
  return;
}

Variable Documentation

HINSTANCE g_hinst

Definition at line 33 of file SetDisp.h.

ULONG g_uObjects

Definition at line 24 of file basesnap.h.

Generated on Wed Nov 13 2024 16:54:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Multisel/guids.h File Reference

  • SysMgmt
  • MMC
  • Multisel
Functions

guids.h File Reference

Go to the source code of this file.

Functions

DEFINE_GUID (CLSID_CComponentData, 0xc3d863ff, 0x5135, 0x4cfc, 0x8c, 0x11, 0xe7, 0x39, 0x6d, 0xa1, 0x5d, 0x3)
DEFINE_GUID (CLSID_CSnapinAbout, 0x7f5aae1a, 0x21, 0x46b7, 0x96, 0xe3, 0xfe, 0x5d, 0x16, 0x30, 0x4b, 0xe9)

Function Documentation

DEFINE_GUID | ( | CLSID_CComponentData | ,
 |  | 0xc3d863ff | ,
 |  | 0x5135 | ,
 |  | 0x4cfc | ,
 |  | 0x8c | ,
 |  | 0x11 | ,
 |  | 0xe7 | ,
 |  | 0x39 | ,
 |  | 0x6d | ,
 |  | 0xa1 | ,
 |  | 0x5d | ,
 |  | 0x3 |
 | ) |  |
DEFINE_GUID | ( | CLSID_CSnapinAbout | ,
 |  | 0x7f5aae1a | ,
 |  | 0x21 | ,
 |  | 0x46b7 | ,
 |  | 0x96 | ,
 |  | 0xe3 | ,
 |  | 0xfe | ,
 |  | 0x5d | ,
 |  | 0x16 | ,
 |  | 0x30 | ,
 |  | 0x4b | ,
 |  | 0xe9 |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Multisel/land.Cpp File Reference

  • SysMgmt
  • MMC
  • Multisel

land.Cpp File Reference

#include "Land.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Multisel/land.h File Reference

  • SysMgmt
  • MMC
  • Multisel
Classes

land.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class CLandBasedVehicle
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Multisel/localres.h File Reference

  • SysMgmt
  • MMC
  • Multisel
Defines

localres.h File Reference

Go to the source code of this file.

Defines

#define | INDEX_BACKGROUND 6
#define | INDEX_CLOSEDFOLDER 4
#define | INDEX_LANDICON 1
#define | INDEX_NONE -1
#define | INDEX_OPENFOLDER 5
#define | INDEX_PEOPLEICON 3
#define | INDEX_SKYICON 2
#define | INDEX_SPACEICON 0
#define | INDEX_STATION 7

Define Documentation

#define INDEX_BACKGROUND 6

Definition at line 29 of file localres.h.

#define INDEX_CLOSEDFOLDER 4

Definition at line 27 of file localres.h.

#define INDEX_LANDICON 1

Definition at line 24 of file localres.h.

#define INDEX_NONE -1

Definition at line 22 of file localres.h.

#define INDEX_OPENFOLDER 5

Definition at line 28 of file localres.h.

#define INDEX_PEOPLEICON 3

Definition at line 26 of file localres.h.

#define INDEX_SKYICON 2

Definition at line 25 of file localres.h.

#define INDEX_SPACEICON 0

Definition at line 23 of file localres.h.

#define INDEX_STATION 7

Definition at line 30 of file localres.h.

Generated on Wed Nov 13 2024 16:54:37 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Multisel/mmccrack.Cpp File Reference

  • SysMgmt
  • MMC
  • Multisel
Defines | Functions

mmccrack.Cpp File Reference

#include <mmc.h>
#include <winuser.h>
#include <tchar.h>
#include "globals.h"
#include <strsafe.h>

Go to the source code of this file.

Defines

#define | STRSAFE_NO_DEPRECATE

Functions

void | MMCN_Crack (BOOL bComponentData, IDataObject *pDataObject, IComponentData *pCompData, IComponent *pComp, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)

Define Documentation

#define STRSAFE_NO_DEPRECATE

Definition at line 25 of file mmccrack.Cpp.

Function Documentation

void MMCN_Crack | ( | BOOL | bComponentData,
 |  | IDataObject * | pDataObject,
 |  | IComponentData * | pCompData,
 |  | IComponent * | pComp,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param
 | ) |  |

Definition at line 59 of file mmccrack.Cpp.

{
#ifdef MMC_CRACK_MESSAGES
        const size_t cchMessage = 256;
        TCHAR message[cchMessage] = {0};

        if (bComponentData == TRUE)
                OutputDebugString(_T("IComponentData::Notify( "));
        else
                OutputDebugString(_T("IComponent::Notify( "));

        wsprintf(message, _T("DataObject: %08x, CompData: %08x, Comp: %08x ) - "), pDataObject, pCompData, pComp);
        OutputDebugString(message);

    switch (event)      {
                case MMCN_ACTIVATE:
                        wsprintf(message, _T("MMCN_ACTIVATE\n\tActivate: %d\n"), arg);
                        break;

                case MMCN_ADD_IMAGES:
                        wsprintf(message, _T("MMCN_ADD_IMAGES\n\tImage List: %08x\n\tScope Item: %08x\n"), arg, param);
                        break;

                case MMCN_BTN_CLICK:
                        wsprintf(message, _T("MMCN_BTN_CLICK\n\tVerb: %ws\n"), MMCN_CrackVerb((MMC_CONSOLE_VERB)param));
                        break;

                case MMCN_COLUMN_CLICK:
                        wsprintf(message, _T("MMCN_COLUMN_CLICK\n\tColumn: %d\n\tSort Option: %d\n"), arg,       param);
                        break;

                case MMCN_COLUMNS_CHANGED:
                        wsprintf(message, _T("MMCN_COLUMNS_CHANGED\n"));
                        break;

                case MMCN_CONTEXTHELP:
                        wsprintf(message, _T("MMCN_CONTEXTHELP\n"));
                        break;

                case MMCN_CONTEXTMENU:
                        wsprintf(message, _T("MMCN_CONTEXTMENU\n"));
                        break;

                case MMCN_CUTORMOVE:
                        wsprintf(message, _T("MMCN_CUTORMOVE\n"));
                        break;

                case MMCN_DBLCLICK:
                        wsprintf(message, _T("MMCN_DBLCLICK\n"));
                        break;

                case MMCN_DELETE:
                        wsprintf(message, _T("MMCN_DELETE\n"));
                        break;

                case MMCN_DESELECT_ALL:
                        wsprintf(message, _T("MMCN_DESELECT_ALL\n"));
                        break;

                case MMCN_EXPAND:
                        wsprintf(message, _T("MMCN_EXPAND\n\tExpand: %d\n\tScope Item: %08x\n"), arg, param);
                        break;

                case MMCN_EXPANDSYNC:
                        wsprintf(message, _T("MMCN_EXPANDSYNC\n"));
                        break;

                case MMCN_FILTERBTN_CLICK:
                        wsprintf(message, _T("MMCN_FILTERBTN_CLICK\n\tColumn: %d\n"), arg);
                        break;

                case MMCN_FILTER_CHANGE:
                        wsprintf(message, _T("MMCN_FILTER_CHANGE\n\tColumn: %d\n"), param);
                        break;

                case MMCN_HELP:
                        wsprintf(message, _T("MMCN_HELP\n"));
                        break;

                case MMCN_INITOCX:
                        wsprintf(message, _T("MMCN_INITOCX\n\tIUnknown: %08x\n"), param);
                        break;

                case MMCN_LISTPAD:
                        wsprintf(message, _T("MMCN_LISTPAD\n\tConnect: %d\n"), arg);
                        break;

                case MMCN_MENU_BTNCLICK:
                        wsprintf(message, _T("MMCN_MENU_BTNCLICK\n"));
                        break;

                case MMCN_MINIMIZED:
                        wsprintf(message, _T("MMCN_MINIMIZED\n\tMinimized: %d\n"), arg);
                        break;

                case MMCN_PASTE:
                        wsprintf(message, _T("MMCN_PASTE\n\tCopy: %d\n"), param == NULL);
                        break;

                case MMCN_PRELOAD:
                        wsprintf(message, _T("MMCN_PRELOAD\n\tScope Item: %08x\n"), arg);
                        break;

                case MMCN_PRINT:
                        wsprintf(message, _T("MMCN_PRINT\n"));
                        break;

                case MMCN_PROPERTY_CHANGE:
                        wsprintf(message, _T("MMCN_PROPERTY_CHANGE\n\tScope: %d\n\tArg: %08x\n"), arg, param);
                        break;

                case MMCN_QUERY_PASTE:
                        wsprintf(message, _T("MMCN_QUERY_PASTE\n"));
                        break;

                case MMCN_REFRESH:
                        wsprintf(message, _T("MMCN_REFRESH\n"));
                        break;

                case MMCN_REMOVE_CHILDREN:
                        wsprintf(message, _T("MMCN_REMOVE_CHILDREN\n\tScope Item: %08x\n"), arg);
                        break;

                case MMCN_RENAME:
                        // Destination string may contain a truncation of the ideal result.
                        // (Indicated by return value other than S_OK).
                        // However, it will be null-terminated.
                        StringCchPrintf(message, cchMessage, _T("MMCN_RENAME\n\tNew Name: '%ws'\n"), (LPOLESTR)param);
                        break;

                case MMCN_RESTORE_VIEW:
                        wsprintf(message, _T("MMCN_RESTORE_VIEW\n"));
                        break;

                case MMCN_SELECT:
                        wsprintf(message, _T("MMCN_SELECT\n\tScope: %d\n\tSelect: %08x\n"), LOWORD(arg), HIWORD(arg));
                        break;

                case MMCN_SHOW:
                        wsprintf(message, _T("MMCN_SHOW\n\tShow: %d\n\tScope Item: %08x\n"), arg, param);
                        break;

                case MMCN_SNAPINHELP:
                        wsprintf(message, _T("MMCN_SNAPINHELP\n"));
                        break;

                case MMCN_VIEW_CHANGE:
                        wsprintf(message, _T("MMCN_VIEW_CHANGE\n\tData: %08x\n\tHint: %08x\n"), arg, param);
                        break;
        }

        if (message[0] != 0)
                OutputDebugString(message);
        else
                OutputDebugString(_T("unknown event\n"));

#endif
        return;
}

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Multisel/people.Cpp File Reference

  • SysMgmt
  • MMC
  • Multisel

people.Cpp File Reference

#include <stdio.h>
#include "People.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Multisel/people.h File Reference

  • SysMgmt
  • MMC
  • Multisel
Classes

people.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class | CBicycle
class | CBicycleFolder
class | CIceSkate
class | CIceSkateFolder
class | CPeoplePoweredVehicle
class | CSkateboard
class | CSkateboardFolder
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Multisel/registry.Cpp File Reference

  • SysMgmt
  • MMC
  • Multisel
Defines | Functions

registry.Cpp File Reference

#include <objbase.h>
#include <assert.h>
#include "Registry.h"
#include "globals.h"

Go to the source code of this file.

Defines

#define | STRINGS_ONLY

Functions

LONG | recursiveDeleteKey (HKEY hKeyParent, const _TCHAR *szKeyChild)
HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const _TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const _TCHAR *szNameString, const CLSID &clsidAbout, const BOOL fSupportExtensions)
BOOL | setKeyAndValue (const _TCHAR *pszPath, const _TCHAR *szSubkey, const _TCHAR *szValue)
BOOL | setSnapInKeyAndValue (const _TCHAR *szKey, const _TCHAR *szSubkey, const _TCHAR *szName, const _TCHAR *szValue)
BOOL | setValue (const _TCHAR *szKey, const _TCHAR *szValueName, const _TCHAR *szValue)
LONG | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Define Documentation

#define STRINGS_ONLY

Definition at line 24 of file registry.Cpp.

Function Documentation

LONG recursiveDeleteKey | ( | HKEY | hKeyParent,
 |  | const _TCHAR * | szKeyChild
 | ) |  |

Definition at line 214 of file registry.Cpp.

{
    // Open the child.
    HKEY hKeyChild ;
    LONG lRes = RegOpenKeyEx(hKeyParent, lpszKeyChild, 0,
        KEY_ALL_ACCESS, &hKeyChild) ;
    if (lRes != ERROR_SUCCESS)
    {
        return lRes ;
    }

    // Enumerate all of the decendents of this child.
    FILETIME time ;
    _TCHAR szBuffer[256] ;
    DWORD dwSize = 256 ;
    while (RegEnumKeyEx(hKeyChild, 0, szBuffer, &dwSize, NULL,
        NULL, NULL, &time) == S_OK)
    {
        // Delete the decendents of this child.
        lRes = recursiveDeleteKey(hKeyChild, szBuffer) ;
        if (lRes != ERROR_SUCCESS)
        {
            // Cleanup before exiting.
            RegCloseKey(hKeyChild) ;
            return lRes;
        }
        dwSize = 256 ;
    }

    // Close the child.
    RegCloseKey(hKeyChild) ;

    // Delete this child.
    return RegDeleteKey(hKeyParent, lpszKeyChild) ;
}

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const _TCHAR * | szFriendlyName
 | ) |  |

Definition at line 67 of file registry.Cpp.

{
    // Get server location.
    _TCHAR szModule[512] ;
    DWORD dwResult =
        ::GetModuleFileName(hModule,
        szModule,
        sizeof(szModule)/sizeof(_TCHAR)) ;

    assert(dwResult != 0) ;

    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    assert(SUCCEEDED(hr)) ;

        MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;
        _tcscat(szKey, pszCLSID) ;

    // Add the CLSID to the registry.
    setKeyAndValue(szKey, NULL, szFriendlyName) ;

    // Add the server filename subkey under the CLSID key.
    setKeyAndValue(szKey, _T("InprocServer32"), szModule) ;

    // set the threading model
    _tcscat(szKey, _T("\\InprocServer32"));
    setValue(szKey, _T("ThreadingModel"), _T("Apartment"));

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const _TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | fSupportExtensions
 | ) |  |

Definition at line 140 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    LPOLESTR wszAboutCLSID = NULL;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    if (IID_NULL != clsidAbout)
        hr = StringFromCLSID(clsidAbout, &wszAboutCLSID);

        MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);
        MAKE_TSTRPTR_FROMWIDE(pszAboutCLSID, wszAboutCLSID);

    // Add the CLSID to the registry.
    setSnapInKeyAndValue(pszCLSID, NULL, _T("NameString"), szNameString) ;
    setSnapInKeyAndValue(pszCLSID, _T("StandAlone"), NULL, NULL);
    if (IID_NULL != clsidAbout)
        setSnapInKeyAndValue(pszCLSID, NULL, _T("About"), pszAboutCLSID);

    if (fSupportExtensions) {
        // Build the key NodeType
        setSnapInKeyAndValue(pszCLSID, _T("NodeTypes"), NULL, NULL);

        _TCHAR szKey[64] ;
        _tcscpy(szKey, pszCLSID) ;
        _tcscat(szKey, _T("\\NodeTypes")) ;
        setSnapInKeyAndValue(szKey, pszCLSID, NULL, NULL);
    }

    // Free memory.
    CoTaskMemFree(wszCLSID) ;
    if (IID_NULL != clsidAbout)
        CoTaskMemFree(wszAboutCLSID);

    return S_OK ;
}

BOOL setKeyAndValue | ( | const _TCHAR * | pszPath,
 |  | const _TCHAR * | szSubkey,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 256 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Copy keyname into buffer.
    _tcscpy(szKeyBuf, szKey) ;

    // Add subkey name to buffer.
    if (szSubkey != NULL)
    {
        _tcscat(szKeyBuf, _T("\\")) ;
        _tcscat(szKeyBuf, szSubkey ) ;
    }

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, NULL, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

BOOL setSnapInKeyAndValue | ( | const _TCHAR * | szKey,
 |  | const _TCHAR * | szSubkey,
 |  | const _TCHAR * | szName,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 337 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\")) ;
    _tcscat(szKeyBuf, szKey) ;

    // Add subkey name to buffer.
    if (szSubkey != NULL)
    {
        _tcscat(szKeyBuf, _T("\\")) ;
        _tcscat(szKeyBuf, szSubkey ) ;
    }

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, szName, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

BOOL setValue | ( | const _TCHAR * | szKey,
 |  | const _TCHAR * | szValueName,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 299 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Copy keyname into buffer.
    _tcscpy(szKeyBuf, szKey) ;

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, szValueName, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

LONG UnregisterServer ( const CLSID & clsid )

Definition at line 112 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

        MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
        _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
               (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 184 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
        MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
               (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Generated on Wed Nov 13 2024 16:53:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Multisel/registry.h File Reference

  • SysMgmt
  • MMC
  • Multisel
Functions

registry.h File Reference

#include <tchar.h>

Go to the source code of this file.

Functions

HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const _TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const _TCHAR *szNameString, const CLSID &clsidAbout, const BOOL fSupportExtensions=FALSE)
HRESULT | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Function Documentation

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const _TCHAR * | szFriendlyName
 | ) |  |

Definition at line 67 of file registry.Cpp.

{
    // Get server location.
    _TCHAR szModule[512] ;
    DWORD dwResult =
        ::GetModuleFileName(hModule,
        szModule,
        sizeof(szModule)/sizeof(_TCHAR)) ;

    assert(dwResult != 0) ;

    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    assert(SUCCEEDED(hr)) ;

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;
  _tcscat(szKey, pszCLSID) ;

    // Add the CLSID to the registry.
    setKeyAndValue(szKey, NULL, szFriendlyName) ;

    // Add the server filename subkey under the CLSID key.
    setKeyAndValue(szKey, _T("InprocServer32"), szModule) ;

    // set the threading model
    _tcscat(szKey, _T("\\InprocServer32"));
    setValue(szKey, _T("ThreadingModel"), _T("Apartment"));

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const _TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | fSupportExtensions = FALSE
 | ) |  |

Definition at line 140 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    LPOLESTR wszAboutCLSID = NULL;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    if (IID_NULL != clsidAbout)
        hr = StringFromCLSID(clsidAbout, &wszAboutCLSID);

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszAboutCLSID, wszAboutCLSID);

    // Add the CLSID to the registry.
    setSnapInKeyAndValue(pszCLSID, NULL, _T("NameString"), szNameString) ;
    setSnapInKeyAndValue(pszCLSID, _T("StandAlone"), NULL, NULL);
    if (IID_NULL != clsidAbout)
        setSnapInKeyAndValue(pszCLSID, NULL, _T("About"), pszAboutCLSID);

    if (fSupportExtensions) {
        // Build the key NodeType
        setSnapInKeyAndValue(pszCLSID, _T("NodeTypes"), NULL, NULL);

        _TCHAR szKey[64] ;
        _tcscpy(szKey, pszCLSID) ;
        _tcscat(szKey, _T("\\NodeTypes")) ;
        setSnapInKeyAndValue(szKey, pszCLSID, NULL, NULL);
    }

    // Free memory.
    CoTaskMemFree(wszCLSID) ;
    if (IID_NULL != clsidAbout)
        CoTaskMemFree(wszAboutCLSID);

    return S_OK ;
}

HRESULT UnregisterServer ( const CLSID & clsid )

Definition at line 112 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

  MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
  _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 184 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Generated on Wed Nov 13 2024 16:53:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Multisel/resource.h File Reference

  • SysMgmt
  • MMC
  • Multisel
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDB_BIKE 40007
#define | IDB_BIKE2 40011
#define | IDB_CAR 40005
#define | IDB_CAR2 40009
#define | IDB_CLOSED 40014
#define | IDB_CLOSED2 40012
#define | IDB_LGBMP 113
#define | IDB_OPEN 40015
#define | IDB_OPEN2 40013
#define | IDB_PLANE 40006
#define | IDB_PLANE2 40010
#define | IDB_ROCKET 40004
#define | IDB_ROCKET2 40008
#define | IDB_SMBMP 112
#define | IDB_SMOPEN 111
#define | IDI_ICON1 108
#define | IDR_LGICONS 121
#define | IDR_SMICONS 120
#define | IDS_ABOUTNAME 9
#define | IDS_HELPFILE 1
#define | IDS_NAME 3
#define | IDS_SNAPINDESC 2
#define | IDS_SNAPINNAME 6

Define Documentation

#define IDB_BIKE 40007

Definition at line 19 of file resource.h.

#define IDB_BIKE2 40011

Definition at line 23 of file resource.h.

#define IDB_CAR 40005

Definition at line 17 of file resource.h.

#define IDB_CAR2 40009

Definition at line 21 of file resource.h.

#define IDB_CLOSED 40014

Definition at line 26 of file resource.h.

#define IDB_CLOSED2 40012

Definition at line 24 of file resource.h.

#define IDB_LGBMP 113

Definition at line 13 of file resource.h.

#define IDB_OPEN 40015

Definition at line 27 of file resource.h.

#define IDB_OPEN2 40013

Definition at line 25 of file resource.h.

#define IDB_PLANE 40006

Definition at line 18 of file resource.h.

#define IDB_PLANE2 40010

Definition at line 22 of file resource.h.

#define IDB_ROCKET 40004

Definition at line 16 of file resource.h.

#define IDB_ROCKET2 40008

Definition at line 20 of file resource.h.

#define IDB_SMBMP 112

Definition at line 12 of file resource.h.

#define IDB_SMOPEN 111

Definition at line 11 of file resource.h.

#define IDI_ICON1 108

Definition at line 10 of file resource.h.

#define IDR_LGICONS 121

Definition at line 15 of file resource.h.

#define IDR_SMICONS 120

Definition at line 14 of file resource.h.

#define IDS_ABOUTNAME 9

Definition at line 9 of file resource.h.

#define IDS_HELPFILE 1

Definition at line 5 of file resource.h.

#define IDS_NAME 3

Definition at line 7 of file resource.h.

#define IDS_SNAPINDESC 2

Definition at line 6 of file resource.h.

#define IDS_SNAPINNAME 6

Definition at line 8 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Multisel/sky.Cpp File Reference

  • SysMgmt
  • MMC
  • Multisel

sky.Cpp File Reference

#include "Sky.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Multisel/sky.h File Reference

  • SysMgmt
  • MMC
  • Multisel
Classes

sky.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class CSkyBasedVehicle
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Multisel/space.Cpp File Reference

  • SysMgmt
  • MMC
  • Multisel
Defines

space.Cpp File Reference

#include <stdio.h>
#include "DataObj.h"
#include "Space.h"
#include "Comp.h"
#include <strsafe.h>

Go to the source code of this file.

Defines

#define STRSAFE_NO_DEPRECATE

Define Documentation

#define STRSAFE_NO_DEPRECATE

Definition at line 23 of file space.Cpp.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Multisel/space.h File Reference

  • SysMgmt
  • MMC
  • Multisel
Classes

space.h File Reference

#include "DeleBase.h"
#include "CompData.h"

Go to the source code of this file.

Classes

class | CRocket
class | CSpaceFolder
class | CSpaceStation
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Multisel/statnode.Cpp File Reference

  • SysMgmt
  • MMC
  • Multisel

statnode.Cpp File Reference

#include "StatNode.h"
#include "Space.h"
#include "Sky.h"
#include "People.h"
#include "Land.h"
#include "Backgrnd.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Multisel/statnode.h File Reference

  • SysMgmt
  • MMC
  • Multisel
Classes

statnode.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class CStaticNode
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nameext/about.Cpp File Reference

  • SysMgmt
  • MMC
  • Nameext
Functions

about.Cpp File Reference

#include "About.h"
#include "resource.h"
#include "globals.h"
#include <crtdbg.h>

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CSnapinAbout

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 89 of file about.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        // we need to decrement our object count in the DLL
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:54:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nameext/about.h File Reference

  • SysMgmt
  • MMC
  • Nameext
Classes

about.h File Reference

#include <tchar.h>
#include <mmc.h>

Go to the source code of this file.

Classes

class CSnapinAbout
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nameext/basesnap.Cpp File Reference

  • SysMgmt
  • MMC
  • Nameext
Functions | Variables

basesnap.Cpp File Reference

#include <objbase.h>
#include <olectl.h>
#include <initguid.h>
#include "globals.h"
#include "resource.h"
#include "guids.h"
#include "basesnap.h"
#include "nameext.h"
#include "About.h"
#include "Registry.h"
#include "Extend.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)
BOOL WINAPI | DllMain (HINSTANCE hinstDLL, DWORD fdwReason, void *lpvReserved)
STDAPI | DllRegisterServer ()
STDAPI | DllUnregisterServer ()
STDMETHODIMP_ (ULONG) CClassFactory

Variables

HINSTANCE | g_hinst

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 80 of file basesnap.Cpp.

{
    if (g_uObjects == 0 && g_uSrvLock == 0)
        return S_OK;
    else
        return S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 48 of file basesnap.Cpp.

{
    if ((rclsid != CLSID_CNamespaceExtension) && (rclsid != CLSID_CSnapinAbout))
        return CLASS_E_CLASSNOTAVAILABLE;

    if (!ppvObj)
        return E_FAIL;

    *ppvObj = NULL;

    // We can only hand out IUnknown and IClassFactory pointers.  Fail
    // if they ask for anything else.
    if (!IsEqualIID(riid, IID_IUnknown) && !IsEqualIID(riid, IID_IClassFactory))
        return E_NOINTERFACE;

    CClassFactory *pFactory = NULL;

    // make the factory passing in the creation function for the type of object they want
    if (rclsid == CLSID_CNamespaceExtension)
        pFactory = new CClassFactory(CClassFactory::NAMESPACEEXTENSION);
    else if (rclsid == CLSID_CSnapinAbout)
        pFactory = new CClassFactory(CClassFactory::ABOUT);

    if (NULL == pFactory)
        return E_OUTOFMEMORY;

    HRESULT hr = pFactory->QueryInterface(riid, ppvObj);

    return hr;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hinstDLL,
 |  | DWORD | fdwReason,
 |  | void * | lpvReserved
 | ) |  |

Definition at line 35 of file basesnap.Cpp.

{

    if (fdwReason == DLL_PROCESS_ATTACH) {
        g_hinst = hinstDLL;
    }

    return TRUE;
}

STDAPI DllRegisterServer ( void )

Definition at line 190 of file basesnap.Cpp.

{
    HRESULT hr = SELFREG_E_CLASS;

    _TCHAR szName[256];
    _TCHAR szSnapInName[256];

    LoadString(g_hinst, IDS_NAME, szName, (sizeof szName)/(sizeof szName[0]));
    LoadString(g_hinst, IDS_SNAPINNAME, szSnapInName, (sizeof szSnapInName)/(sizeof szSnapInName[0]));

    _TCHAR szAboutName[256];

    LoadString(g_hinst, IDS_ABOUTNAME, szAboutName, (sizeof szAboutName)/(sizeof szAboutName[0]));

    // register our CoClasses
    hr = RegisterServer(g_hinst,
        CLSID_CNamespaceExtension,
        szName);

    if SUCCEEDED(hr)
        hr = RegisterServer(g_hinst,
        CLSID_CSnapinAbout,
        szAboutName);

    // place the registry information for SnapIns
    if SUCCEEDED(hr)
        hr = RegisterSnapin(CLSID_CNamespaceExtension, szSnapInName, CLSID_CSnapinAbout);

    return hr;
}

STDAPI DllUnregisterServer ( void )

Definition at line 223 of file basesnap.Cpp.

{
    if (UnregisterServer(CLSID_CNamespaceExtension) == S_OK)
        return UnregisterSnapin(CLSID_CNamespaceExtension);
    else
        return E_FAIL;
}

STDMETHODIMP_ ( ULONG )

Definition at line 127 of file basesnap.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;
}

Variable Documentation

HINSTANCE g_hinst

Definition at line 32 of file basesnap.Cpp.

Generated on Wed Nov 13 2024 16:54:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nameext/basesnap.h File Reference

  • SysMgmt
  • MMC
  • Nameext
Classes | Functions | Variables

basesnap.h File Reference

Go to the source code of this file.

Classes

class | CClassFactory

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)

Variables

ULONG | g_uObjects = 0
ULONG | g_uSrvLock = 0

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 53 of file ComSpyAudit.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 61 of file ComSpyAudit.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

Variable Documentation

ULONG g_uObjects = 0

Definition at line 24 of file basesnap.h.

ULONG g_uSrvLock = 0

Definition at line 25 of file basesnap.h.

Generated on Wed Nov 13 2024 16:54:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nameext/comp.Cpp File Reference

  • SysMgmt
  • MMC
  • Nameext
Functions

comp.Cpp File Reference

#include "Comp.h"
#include "DataObj.h"
#include <crtdbg.h>
#include "globals.h"
#include "resource.h"
#include "DeleBase.h"
#include "NameExt.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CComponent

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 66 of file comp.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nameext/comp.h File Reference

  • SysMgmt
  • MMC
  • Nameext
Classes

comp.h File Reference

#include <mmc.h>

Go to the source code of this file.

Classes

class CComponent
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nameext/dataobj.Cpp File Reference

  • SysMgmt
  • MMC
  • Nameext
Defines | Functions

dataobj.Cpp File Reference

#include "DataObj.h"
#include "guids.h"
#include "DeleBase.h"

Go to the source code of this file.

Defines

#define | _T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")
#define | _T_CCF_INTERNAL_SNAPIN _T("{2479DB32-5276-11d2-94F5-00C04FB92EC2}")
#define | _T_CCF_NODETYPE _T("CCF_NODETYPE")
#define | _T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")
#define | _T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")

Functions

CDataObject * | GetOurDataObject (LPDATAOBJECT lpDataObject)
STDMETHODIMP_ (ULONG) CDataObject

Define Documentation

#define _T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")

Definition at line 31 of file dataobj.Cpp.

#define _T_CCF_INTERNAL_SNAPIN _T("{2479DB32-5276-11d2-94F5-00C04FB92EC2}")

Definition at line 36 of file dataobj.Cpp.

#define _T_CCF_NODETYPE _T("CCF_NODETYPE")

Definition at line 32 of file dataobj.Cpp.

#define _T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")

Definition at line 34 of file dataobj.Cpp.

#define _T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")

Definition at line 33 of file dataobj.Cpp.

Function Documentation

CDataObject* GetOurDataObject ( LPDATAOBJECT lpDataObject )

Definition at line 165 of file dataobj.Cpp.

{
    HRESULT       hr      = S_OK;
    CDataObject *pSDO     = NULL;

  // check to see if the data object is a special data object.
  if ( IS_SPECIAL_DATAOBJECT (lpDataObject) )
  {
    //Code for handling a special data object goes here.

    //Note that the MMC SDK samples do not handle
    //special data objects, so we exit if we get one.
    return NULL;
  }

    STGMEDIUM stgmedium = { TYMED_HGLOBAL,  NULL  };
    FORMATETC formatetc = { CDataObject::s_cfInternal, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };

    // Allocate memory for the stream
    stgmedium.hGlobal = GlobalAlloc( GMEM_SHARE, sizeof(CDataObject *));

    if (!stgmedium.hGlobal)     {
        hr = E_OUTOFMEMORY;
    }

    if SUCCEEDED(hr)
        // Attempt to get data from the object
        hr = lpDataObject->GetDataHere( &formatetc, &stgmedium );

    // stgmedium now has the data we need
    if (SUCCEEDED(hr))  {
        pSDO = *(CDataObject **)(stgmedium.hGlobal);
    }

    // if we have memory free it
    if (stgmedium.hGlobal)
        GlobalFree(stgmedium.hGlobal);

    return pSDO;

} // end GetOurDataObject()

STDMETHODIMP_ ( ULONG )

Definition at line 87 of file dataobj.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nameext/dataobj.h File Reference

  • SysMgmt
  • MMC
  • Nameext
Classes | Functions

dataobj.h File Reference

#include <mmc.h>
#include "DeleBase.h"

Go to the source code of this file.

Classes

class | CDataObject

Functions

HRESULT | ExtractFromDataObject (IDataObject *lpDataObject, UINT cf, ULONG cb, HGLOBAL *phGlobal)
CDataObject * | GetOurDataObject (IDataObject *lpDataObject)

Function Documentation

HRESULT ExtractFromDataObject | ( | IDataObject * | lpDataObject,
 |  | UINT | cf,
 |  | ULONG | cb,
 |  | HGLOBAL * | phGlobal
 | ) |  |
CDataObject* GetOurDataObject ( IDataObject * lpDataObject )
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nameext/delebase.Cpp File Reference

  • SysMgmt
  • MMC
  • Nameext

delebase.Cpp File Reference

#include "DeleBase.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nameext/delebase.h File Reference

  • SysMgmt
  • MMC
  • Nameext
Classes

delebase.h File Reference

#include <mmc.h>
#include <crtdbg.h>
#include "globals.h"
#include "resource.h"
#include "LocalRes.h"
#include "LocalRes.h"

Go to the source code of this file.

Classes

class CDelegationBase
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nameext/extend.h File Reference

  • SysMgmt
  • MMC
  • Nameext
Classes | Enumerations

extend.h File Reference

Go to the source code of this file.

Classes

struct | EXTENDER_NODE
struct | EXTENSION_NODE

Enumerations

enum EXTENSION_TYPE {
NameSpaceExtension, ContextMenuExtension, ToolBarExtension, PropertySheetExtension,
TaskExtension, DynamicExtension, DummyExtension, NameSpaceExtension,
ContextMenuExtension, ToolBarExtension, PropertySheetExtension, TaskExtension,
DynamicExtension, DummyExtension, NameSpaceExtension, ContextMenuExtension,
ToolBarExtension, PropertySheetExtension, TaskExtension, DynamicExtension,
DummyExtension, NameSpaceExtension, ContextMenuExtension, ToolBarExtension,
PropertySheetExtension, TaskExtension, DynamicExtension, DummyExtension
}

Enumeration Type Documentation

enum EXTENSION_TYPE
Enumerator:
NameSpaceExtension
ContextMenuExtension
ToolBarExtension
PropertySheetExtension
TaskExtension
DynamicExtension
DummyExtension
NameSpaceExtension
ContextMenuExtension
ToolBarExtension
PropertySheetExtension
TaskExtension
DynamicExtension
DummyExtension
NameSpaceExtension
ContextMenuExtension
ToolBarExtension
PropertySheetExtension
TaskExtension
DynamicExtension
DummyExtension
NameSpaceExtension
ContextMenuExtension
ToolBarExtension
PropertySheetExtension
TaskExtension
DynamicExtension
DummyExtension

Definition at line 29 of file extend.h.

{
    NameSpaceExtension,
        ContextMenuExtension,
        ToolBarExtension,
        PropertySheetExtension,
        TaskExtension,
        DynamicExtension,
  DummyExtension
};

Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nameext/globals.h File Reference

  • SysMgmt
  • MMC
  • Nameext
Classes | Defines | Functions | Variables

globals.h File Reference

#include <tchar.h>
#include <mmc.h>

Go to the source code of this file.

Classes

class | TempBuffer

Defines

#define | IDM_BUTTON1 0x100
#define | IDM_BUTTON2 0x101
#define | MAKE_TSTRPTR_FROMWIDE(ptrname, widestr)
#define | MAKE_WIDEPTR_FROMTSTR(ptrname, tstr)
#define | MAKE_WIDEPTR_FROMTSTR_ALLOC(ptrname, tstr)
#define | OBJECT_CREATED InterlockedIncrement((long *)&g_uObjects);
#define | OBJECT_DESTROYED InterlockedDecrement((long *)&g_uObjects);

Functions

void | MMCN_Crack (BOOL bComponentData, IDataObject *pDataObject, IComponentData *pCompData, IComponent *pComp, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)

Variables

HINSTANCE | g_hinst
ULONG g_uObjects

Define Documentation

#define IDM_BUTTON1 0x100

Definition at line 26 of file globals.h.

#define IDM_BUTTON2 0x101

Definition at line 27 of file globals.h.

#define MAKE_TSTRPTR_FROMWIDE | ( | ptrname,
 |  | widestr
 | ) |
Value:
long __l##ptrname = (wcslen(widestr) + 1) * 2 * sizeof(TCHAR); \
    TempBuffer __TempBuffer##ptrname(__l##ptrname); \
    WideCharToMultiByte(CP_ACP, 0, widestr, -1, (LPSTR)__TempBuffer##ptrname.GetBuffer(), __l##ptrname, NULL, NULL); \
    LPTSTR ptrname = (LPTSTR)__TempBuffer##ptrname.GetBuffer()

Definition at line 128 of file globals.h.

#define MAKE_WIDEPTR_FROMTSTR | ( | ptrname,
 |  | tstr
 | ) |
Value:
long __cch##ptrname = (lstrlenA(tstr) + 1);\
    long __l##ptrname = (lstrlenA(tstr) + 1) * sizeof(WCHAR); \
    TempBuffer __TempBuffer##ptrname(__l##ptrname); \
    MultiByteToWideChar(CP_ACP, 0, tstr, -1, (LPWSTR)__TempBuffer##ptrname.GetBuffer(), __cch##ptrname); \
    LPWSTR ptrname = (LPWSTR)__TempBuffer##ptrname.GetBuffer()

Definition at line 94 of file globals.h.

#define MAKE_WIDEPTR_FROMTSTR_ALLOC | ( | ptrname,
 |  | tstr
 | ) |
Value:
long __cch##ptrname = (lstrlenA(tstr) + 1);\
    long __l##ptrname = (lstrlenA(tstr) + 1) * sizeof(WCHAR); \
    LPWSTR ptrname = (LPWSTR)CoTaskMemAlloc(__l##ptrname); \
    MultiByteToWideChar(CP_ACP, 0, tstr, -1, ptrname, __cch##ptrname)

Definition at line 108 of file globals.h.

#define OBJECT_CREATED InterlockedIncrement((long *)&g_uObjects);

Definition at line 32 of file globals.h.

#define OBJECT_DESTROYED InterlockedDecrement((long *)&g_uObjects);

Definition at line 33 of file globals.h.

Function Documentation

void MMCN_Crack | ( | BOOL | bComponentData,
 |  | IDataObject * | pDataObject,
 |  | IComponentData * | pCompData,
 |  | IComponent * | pComp,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param
 | ) |  |

Definition at line 59 of file mmccrack.Cpp.

{
#ifdef MMC_CRACK_MESSAGES
        const size_t cchMessage = 256;
  TCHAR message[cchMessage] = {0};

  if (bComponentData == TRUE)
    OutputDebugString(_T("IComponentData::Notify( "));
  else
    OutputDebugString(_T("IComponent::Notify( "));

  wsprintf(message, _T("DataObject: %08x, CompData: %08x, Comp: %08x ) - "), pDataObject, pCompData, pComp);
  OutputDebugString(message);

    switch (event)  {
    case MMCN_ACTIVATE:
      wsprintf(message, _T("MMCN_ACTIVATE\n\tActivate: %d\n"), arg);
      break;

    case MMCN_ADD_IMAGES:
      wsprintf(message, _T("MMCN_ADD_IMAGES\n\tImage List: %08x\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_BTN_CLICK:
      wsprintf(message, _T("MMCN_BTN_CLICK\n\tVerb: %ws\n"), MMCN_CrackVerb((MMC_CONSOLE_VERB)param));
      break;

    case MMCN_COLUMN_CLICK:
      wsprintf(message, _T("MMCN_COLUMN_CLICK\n\tColumn: %d\n\tSort Option: %d\n"), arg,   param);
      break;

    case MMCN_COLUMNS_CHANGED:
      wsprintf(message, _T("MMCN_COLUMNS_CHANGED\n"));
      break;

    case MMCN_CONTEXTHELP:
      wsprintf(message, _T("MMCN_CONTEXTHELP\n"));
      break;

    case MMCN_CONTEXTMENU:
      wsprintf(message, _T("MMCN_CONTEXTMENU\n"));
      break;

    case MMCN_CUTORMOVE:
      wsprintf(message, _T("MMCN_CUTORMOVE\n"));
      break;

    case MMCN_DBLCLICK:
      wsprintf(message, _T("MMCN_DBLCLICK\n"));
      break;

    case MMCN_DELETE:
      wsprintf(message, _T("MMCN_DELETE\n"));
      break;

    case MMCN_DESELECT_ALL:
      wsprintf(message, _T("MMCN_DESELECT_ALL\n"));
      break;

    case MMCN_EXPAND:
      wsprintf(message, _T("MMCN_EXPAND\n\tExpand: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_EXPANDSYNC:
      wsprintf(message, _T("MMCN_EXPANDSYNC\n"));
      break;

    case MMCN_FILTERBTN_CLICK:
      wsprintf(message, _T("MMCN_FILTERBTN_CLICK\n\tColumn: %d\n"), arg);
      break;

    case MMCN_FILTER_CHANGE:
      wsprintf(message, _T("MMCN_FILTER_CHANGE\n\tColumn: %d\n"), param);
      break;

    case MMCN_HELP:
      wsprintf(message, _T("MMCN_HELP\n"));
      break;

    case MMCN_INITOCX:
      wsprintf(message, _T("MMCN_INITOCX\n\tIUnknown: %08x\n"), param);
      break;

    case MMCN_LISTPAD:
      wsprintf(message, _T("MMCN_LISTPAD\n\tConnect: %d\n"), arg);
      break;

    case MMCN_MENU_BTNCLICK:
      wsprintf(message, _T("MMCN_MENU_BTNCLICK\n"));
      break;

    case MMCN_MINIMIZED:
      wsprintf(message, _T("MMCN_MINIMIZED\n\tMinimized: %d\n"), arg);
      break;

    case MMCN_PASTE:
      wsprintf(message, _T("MMCN_PASTE\n\tCopy: %d\n"), param == NULL);
      break;

    case MMCN_PRELOAD:
      wsprintf(message, _T("MMCN_PRELOAD\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_PRINT:
      wsprintf(message, _T("MMCN_PRINT\n"));
      break;

    case MMCN_PROPERTY_CHANGE:
      wsprintf(message, _T("MMCN_PROPERTY_CHANGE\n\tScope: %d\n\tArg: %08x\n"), arg, param);
      break;

    case MMCN_QUERY_PASTE:
      wsprintf(message, _T("MMCN_QUERY_PASTE\n"));
      break;

    case MMCN_REFRESH:
      wsprintf(message, _T("MMCN_REFRESH\n"));
      break;

    case MMCN_REMOVE_CHILDREN:
      wsprintf(message, _T("MMCN_REMOVE_CHILDREN\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_RENAME:
                        // Destination string may contain a truncation of the ideal result.
                        // (Indicated by return value other than S_OK).
                        // However, it will be null-terminated.
      StringCchPrintf(message, cchMessage, _T("MMCN_RENAME\n\tNew Name: '%ws'\n"), (LPOLESTR)param);
      break;

    case MMCN_RESTORE_VIEW:
      wsprintf(message, _T("MMCN_RESTORE_VIEW\n"));
      break;

    case MMCN_SELECT:
      wsprintf(message, _T("MMCN_SELECT\n\tScope: %d\n\tSelect: %08x\n"), LOWORD(arg), HIWORD(arg));
      break;

    case MMCN_SHOW:
      wsprintf(message, _T("MMCN_SHOW\n\tShow: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_SNAPINHELP:
      wsprintf(message, _T("MMCN_SNAPINHELP\n"));
      break;

    case MMCN_VIEW_CHANGE:
      wsprintf(message, _T("MMCN_VIEW_CHANGE\n\tData: %08x\n\tHint: %08x\n"), arg, param);
      break;
  }

  if (message[0] != 0)
    OutputDebugString(message);
  else
    OutputDebugString(_T("unknown event\n"));

#endif
  return;
}

Variable Documentation

HINSTANCE g_hinst

Definition at line 33 of file SetDisp.h.

ULONG g_uObjects

Definition at line 24 of file basesnap.h.

Generated on Wed Nov 13 2024 16:54:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nameext/guids.h File Reference

  • SysMgmt
  • MMC
  • Nameext
Functions

guids.h File Reference

Go to the source code of this file.

Functions

DEFINE_GUID (CLSID_CNamespaceExtension, 0x64026453, 0x6a22, 0x11d3, 0x91, 0x54, 0x0, 0xc0, 0x4f, 0x65, 0xb3, 0xf9)
DEFINE_GUID (CLSID_CSnapinAbout, 0xaf2039d3, 0x6a26, 0x11d3, 0x91, 0x54, 0x0, 0xc0, 0x4f, 0x65, 0xb3, 0xf9)

Function Documentation

DEFINE_GUID | ( | CLSID_CNamespaceExtension | ,
 |  | 0x64026453 | ,
 |  | 0x6a22 | ,
 |  | 0x11d3 | ,
 |  | 0x91 | ,
 |  | 0x54 | ,
 |  | 0x0 | ,
 |  | 0xc0 | ,
 |  | 0x4f | ,
 |  | 0x65 | ,
 |  | 0xb3 | ,
 |  | 0xf9 |
 | ) |  |
DEFINE_GUID | ( | CLSID_CSnapinAbout | ,
 |  | 0xaf2039d3 | ,
 |  | 0x6a26 | ,
 |  | 0x11d3 | ,
 |  | 0x91 | ,
 |  | 0x54 | ,
 |  | 0x0 | ,
 |  | 0xc0 | ,
 |  | 0x4f | ,
 |  | 0x65 | ,
 |  | 0xb3 | ,
 |  | 0xf9 |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nameext/localres.h File Reference

  • SysMgmt
  • MMC
  • Nameext
Defines

localres.h File Reference

Go to the source code of this file.

Defines

#define | INDEX_CLOSEDFOLDER 4
#define | INDEX_CLOUD 9
#define | INDEX_LANDICON 1
#define | INDEX_NONE -1
#define | INDEX_OPENFOLDER 5
#define | INDEX_PEOPLEICON 3
#define | INDEX_RAIN 8
#define | INDEX_SKYICON 2
#define | INDEX_SNOW 7
#define | INDEX_SPACEICON 0
#define | INDEX_SUN 6
#define | INDEX_THUNDER 11
#define | INDEX_WORLD 10

Define Documentation

#define INDEX_CLOSEDFOLDER 4

Definition at line 27 of file localres.h.

#define INDEX_CLOUD 9

Definition at line 33 of file localres.h.

#define INDEX_LANDICON 1

Definition at line 24 of file localres.h.

#define INDEX_NONE -1

Definition at line 22 of file localres.h.

#define INDEX_OPENFOLDER 5

Definition at line 28 of file localres.h.

#define INDEX_PEOPLEICON 3

Definition at line 26 of file localres.h.

#define INDEX_RAIN 8

Definition at line 32 of file localres.h.

#define INDEX_SKYICON 2

Definition at line 25 of file localres.h.

#define INDEX_SNOW 7

Definition at line 31 of file localres.h.

#define INDEX_SPACEICON 0

Definition at line 23 of file localres.h.

#define INDEX_SUN 6

Definition at line 30 of file localres.h.

#define INDEX_THUNDER 11

Definition at line 35 of file localres.h.

#define INDEX_WORLD 10

Definition at line 34 of file localres.h.

Generated on Wed Nov 13 2024 16:54:37 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nameext/mmccrack.Cpp File Reference

  • SysMgmt
  • MMC
  • Nameext
Defines | Functions

mmccrack.Cpp File Reference

#include <mmc.h>
#include <winuser.h>
#include <tchar.h>
#include "globals.h"
#include <strsafe.h>

Go to the source code of this file.

Defines

#define | STRSAFE_NO_DEPRECATE

Functions

void | MMCN_Crack (BOOL bComponentData, IDataObject *pDataObject, IComponentData *pCompData, IComponent *pComp, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)

Define Documentation

#define STRSAFE_NO_DEPRECATE

Definition at line 25 of file mmccrack.Cpp.

Function Documentation

void MMCN_Crack | ( | BOOL | bComponentData,
 |  | IDataObject * | pDataObject,
 |  | IComponentData * | pCompData,
 |  | IComponent * | pComp,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param
 | ) |  |

Definition at line 59 of file mmccrack.Cpp.

{
#ifdef MMC_CRACK_MESSAGES
        const size_t cchMessage = 256;
  TCHAR message[cchMessage] = {0};

  if (bComponentData == TRUE)
    OutputDebugString(_T("IComponentData::Notify( "));
  else
    OutputDebugString(_T("IComponent::Notify( "));

  wsprintf(message, _T("DataObject: %08x, CompData: %08x, Comp: %08x ) - "), pDataObject, pCompData, pComp);
  OutputDebugString(message);

    switch (event)  {
    case MMCN_ACTIVATE:
      wsprintf(message, _T("MMCN_ACTIVATE\n\tActivate: %d\n"), arg);
      break;

    case MMCN_ADD_IMAGES:
      wsprintf(message, _T("MMCN_ADD_IMAGES\n\tImage List: %08x\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_BTN_CLICK:
      wsprintf(message, _T("MMCN_BTN_CLICK\n\tVerb: %ws\n"), MMCN_CrackVerb((MMC_CONSOLE_VERB)param));
      break;

    case MMCN_COLUMN_CLICK:
      wsprintf(message, _T("MMCN_COLUMN_CLICK\n\tColumn: %d\n\tSort Option: %d\n"), arg,   param);
      break;

    case MMCN_COLUMNS_CHANGED:
      wsprintf(message, _T("MMCN_COLUMNS_CHANGED\n"));
      break;

    case MMCN_CONTEXTHELP:
      wsprintf(message, _T("MMCN_CONTEXTHELP\n"));
      break;

    case MMCN_CONTEXTMENU:
      wsprintf(message, _T("MMCN_CONTEXTMENU\n"));
      break;

    case MMCN_CUTORMOVE:
      wsprintf(message, _T("MMCN_CUTORMOVE\n"));
      break;

    case MMCN_DBLCLICK:
      wsprintf(message, _T("MMCN_DBLCLICK\n"));
      break;

    case MMCN_DELETE:
      wsprintf(message, _T("MMCN_DELETE\n"));
      break;

    case MMCN_DESELECT_ALL:
      wsprintf(message, _T("MMCN_DESELECT_ALL\n"));
      break;

    case MMCN_EXPAND:
      wsprintf(message, _T("MMCN_EXPAND\n\tExpand: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_EXPANDSYNC:
      wsprintf(message, _T("MMCN_EXPANDSYNC\n"));
      break;

    case MMCN_FILTERBTN_CLICK:
      wsprintf(message, _T("MMCN_FILTERBTN_CLICK\n\tColumn: %d\n"), arg);
      break;

    case MMCN_FILTER_CHANGE:
      wsprintf(message, _T("MMCN_FILTER_CHANGE\n\tColumn: %d\n"), param);
      break;

    case MMCN_HELP:
      wsprintf(message, _T("MMCN_HELP\n"));
      break;

    case MMCN_INITOCX:
      wsprintf(message, _T("MMCN_INITOCX\n\tIUnknown: %08x\n"), param);
      break;

    case MMCN_LISTPAD:
      wsprintf(message, _T("MMCN_LISTPAD\n\tConnect: %d\n"), arg);
      break;

    case MMCN_MENU_BTNCLICK:
      wsprintf(message, _T("MMCN_MENU_BTNCLICK\n"));
      break;

    case MMCN_MINIMIZED:
      wsprintf(message, _T("MMCN_MINIMIZED\n\tMinimized: %d\n"), arg);
      break;

    case MMCN_PASTE:
      wsprintf(message, _T("MMCN_PASTE\n\tCopy: %d\n"), param == NULL);
      break;

    case MMCN_PRELOAD:
      wsprintf(message, _T("MMCN_PRELOAD\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_PRINT:
      wsprintf(message, _T("MMCN_PRINT\n"));
      break;

    case MMCN_PROPERTY_CHANGE:
      wsprintf(message, _T("MMCN_PROPERTY_CHANGE\n\tScope: %d\n\tArg: %08x\n"), arg, param);
      break;

    case MMCN_QUERY_PASTE:
      wsprintf(message, _T("MMCN_QUERY_PASTE\n"));
      break;

    case MMCN_REFRESH:
      wsprintf(message, _T("MMCN_REFRESH\n"));
      break;

    case MMCN_REMOVE_CHILDREN:
      wsprintf(message, _T("MMCN_REMOVE_CHILDREN\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_RENAME:
                        // Destination string may contain a truncation of the ideal result.
                        // (Indicated by return value other than S_OK).
                        // However, it will be null-terminated.
      StringCchPrintf(message, cchMessage, _T("MMCN_RENAME\n\tNew Name: '%ws'\n"), (LPOLESTR)param);
      break;

    case MMCN_RESTORE_VIEW:
      wsprintf(message, _T("MMCN_RESTORE_VIEW\n"));
      break;

    case MMCN_SELECT:
      wsprintf(message, _T("MMCN_SELECT\n\tScope: %d\n\tSelect: %08x\n"), LOWORD(arg), HIWORD(arg));
      break;

    case MMCN_SHOW:
      wsprintf(message, _T("MMCN_SHOW\n\tShow: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_SNAPINHELP:
      wsprintf(message, _T("MMCN_SNAPINHELP\n"));
      break;

    case MMCN_VIEW_CHANGE:
      wsprintf(message, _T("MMCN_VIEW_CHANGE\n\tData: %08x\n\tHint: %08x\n"), arg, param);
      break;
  }

  if (message[0] != 0)
    OutputDebugString(message);
  else
    OutputDebugString(_T("unknown event\n"));

#endif
  return;
}

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nameext/nameext.Cpp File Reference

  • SysMgmt
  • MMC
  • Nameext
Defines | Functions

nameext.Cpp File Reference

#include "Comp.h"
#include "sky.h"
#include "nameext.h"
#include "DataObj.h"
#include "globals.h"
#include "resource.h"
#include <crtdbg.h>

Go to the source code of this file.

Defines

#define | _T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")
#define | _T_CCF_NODETYPE _T("CCF_NODETYPE")
#define | _T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")

Functions

STDMETHODIMP_ (ULONG) CComponentData

Define Documentation

#define _T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")

Definition at line 30 of file nameext.Cpp.

#define _T_CCF_NODETYPE _T("CCF_NODETYPE")

Definition at line 31 of file nameext.Cpp.

#define _T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")

Definition at line 32 of file nameext.Cpp.

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 94 of file nameext.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        // we need to decrement our object count in the DLL
        delete this;
        return 0;
    }

    return m_cref;
}

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nameext/nameext.h File Reference

  • SysMgmt
  • MMC
  • Nameext
Classes

nameext.h File Reference

#include <tchar.h>
#include <mmc.h>
#include <crtdbg.h>
#include "DeleBase.h"
#include "globals.h"
#include "resource.h"
#include "LocalRes.h"
#include "DeleBase.h"

Go to the source code of this file.

Classes

class CComponentData
Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nameext/registry.Cpp File Reference

  • SysMgmt
  • MMC
  • Nameext
Defines | Functions | Variables

registry.Cpp File Reference

#include <objbase.h>
#include <assert.h>
#include "Registry.h"
#include "Extend.h"
#include "globals.h"

Go to the source code of this file.

Defines

#define | STRINGS_ONLY

Functions

LONG | recursiveDeleteKey (HKEY hKeyParent, const _TCHAR *szKeyChild)
HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const _TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const _TCHAR *szNameString, const CLSID &clsidAbout, const BOOL fSupportExtensions)
BOOL | setKeyAndValue (const _TCHAR *pszPath, const _TCHAR *szSubkey, const _TCHAR *szValue)
BOOL | setSnapInKeyAndValue (const _TCHAR *szKey, const _TCHAR *szSubkey, const _TCHAR *szName, const _TCHAR *szValue)
BOOL | setValue (const _TCHAR *szKey, const _TCHAR *szValueName, const _TCHAR *szValue)
LONG | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Variables

EXTENDER_NODE _NodeExtensions []

Define Documentation

#define STRINGS_ONLY

Definition at line 24 of file registry.Cpp.

Function Documentation

LONG recursiveDeleteKey | ( | HKEY | hKeyParent,
 |  | const _TCHAR * | szKeyChild
 | ) |  |

Definition at line 283 of file registry.Cpp.

{
    // Open the child.
    HKEY hKeyChild ;
    LONG lRes = RegOpenKeyEx(hKeyParent, lpszKeyChild, 0,
        KEY_ALL_ACCESS, &hKeyChild) ;
    if (lRes != ERROR_SUCCESS)
    {
        return lRes ;
    }

    // Enumerate all of the decendents of this child.
    FILETIME time ;
    _TCHAR szBuffer[256] ;
    DWORD dwSize = 256 ;
    while (RegEnumKeyEx(hKeyChild, 0, szBuffer, &dwSize, NULL,
        NULL, NULL, &time) == S_OK)
    {
        // Delete the decendents of this child.
        lRes = recursiveDeleteKey(hKeyChild, szBuffer) ;
        if (lRes != ERROR_SUCCESS)
        {
            // Cleanup before exiting.
            RegCloseKey(hKeyChild) ;
            return lRes;
        }
        dwSize = 256 ;
    }

    // Close the child.
    RegCloseKey(hKeyChild) ;

    // Delete this child.
    return RegDeleteKey(hKeyParent, lpszKeyChild) ;
}

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const _TCHAR * | szFriendlyName
 | ) |  |

Definition at line 82 of file registry.Cpp.

{
    // Get server location.
    _TCHAR szModule[512] ;
    DWORD dwResult =
        ::GetModuleFileName(hModule,
        szModule,
        sizeof(szModule)/sizeof(_TCHAR)) ;

    assert(dwResult != 0) ;

    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    assert(SUCCEEDED(hr)) ;

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;
  _tcscat(szKey, pszCLSID) ;

    // Add the CLSID to the registry.
    setKeyAndValue(szKey, NULL, szFriendlyName) ;

    // Add the server filename subkey under the CLSID key.
    setKeyAndValue(szKey, _T("InprocServer32"), szModule) ;

    // set the threading model
    _tcscat(szKey, _T("\\InprocServer32"));
    setValue(szKey, _T("ThreadingModel"), _T("Apartment"));

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const _TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | fSupportExtensions
 | ) |  |

Definition at line 156 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    LPOLESTR wszAboutCLSID = NULL;
    LPOLESTR wszExtendCLSID = NULL;
    LPOLESTR wszNodeCLSID = NULL;
    EXTENDER_NODE *pNodeExtension;
    _TCHAR szKeyBuf[1024] ;
    HKEY hKey;

    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    if (IID_NULL != clsidAbout)
        hr = StringFromCLSID(clsidAbout, &wszAboutCLSID);

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszAboutCLSID, wszAboutCLSID);

    // Add the CLSID to the registry.
    setSnapInKeyAndValue(pszCLSID, NULL, _T("NameString"), szNameString) ;
    if (IID_NULL != clsidAbout)
        setSnapInKeyAndValue(pszCLSID, NULL, _T("About"), pszAboutCLSID);

    if (fSupportExtensions) {
        // Build the key NodeType
        setSnapInKeyAndValue(pszCLSID, _T("NodeTypes"), NULL, NULL);

        _TCHAR szKey[64] ;
        _tcscpy(szKey, pszCLSID) ;
        _tcscat(szKey, _T("\\NodeTypes")) ;
        setSnapInKeyAndValue(szKey, pszCLSID, NULL, NULL);
    }

    // register each of the node extensions
    for (pNodeExtension = &(_NodeExtensions[0]);*pNodeExtension->szDescription;pNodeExtension++)
    {
        hr = StringFromCLSID(pNodeExtension->guidNode, &wszExtendCLSID);
        MAKE_TSTRPTR_FROMWIDE(pszExtendCLSID, wszExtendCLSID);
        _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\NodeTypes\\"));
        _tcscat(szKeyBuf, pszExtendCLSID);

        switch (pNodeExtension->eType) {
        case NameSpaceExtension:
            _tcscat(szKeyBuf, _T("\\Extensions\\NameSpace"));
            break;
        default:
            break;
        }

        // Create and open key and subkey.
        long lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE ,
            szKeyBuf,
            0, NULL, REG_OPTION_NON_VOLATILE,
            KEY_ALL_ACCESS, NULL,
            &hKey, NULL) ;

        if (lResult != ERROR_SUCCESS)
        {
            return FALSE ;
        }

        hr = StringFromCLSID(pNodeExtension->guidExtension, &wszNodeCLSID);
        assert(SUCCEEDED(hr));

        MAKE_TSTRPTR_FROMWIDE(pszNodeCLSID, wszNodeCLSID);
        // Set the Value.
        if (pNodeExtension->szDescription != NULL)
        {
            RegSetValueEx(hKey, pszNodeCLSID, 0, REG_SZ,
                (BYTE *)pNodeExtension->szDescription,
                (_tcslen(pNodeExtension->szDescription)+1)*sizeof(_TCHAR)) ;
        }

        RegCloseKey(hKey) ;

        CoTaskMemFree(wszExtendCLSID);
        CoTaskMemFree(wszNodeCLSID);
    }

    // Free memory.
    CoTaskMemFree(wszCLSID) ;
    if (IID_NULL != clsidAbout)
        CoTaskMemFree(wszAboutCLSID);

    return S_OK ;
}

BOOL setKeyAndValue | ( | const _TCHAR * | pszPath,
 |  | const _TCHAR * | szSubkey,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 325 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Copy keyname into buffer.
    _tcscpy(szKeyBuf, szKey) ;

    // Add subkey name to buffer.
    if (szSubkey != NULL)
    {
        _tcscat(szKeyBuf, _T("\\")) ;
        _tcscat(szKeyBuf, szSubkey ) ;
    }

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, NULL, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

BOOL setSnapInKeyAndValue | ( | const _TCHAR * | szKey,
 |  | const _TCHAR * | szSubkey,
 |  | const _TCHAR * | szName,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 406 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\")) ;
    _tcscat(szKeyBuf, szKey) ;

    // Add subkey name to buffer.
    if (szSubkey != NULL)
    {
        _tcscat(szKeyBuf, _T("\\")) ;
        _tcscat(szKeyBuf, szSubkey ) ;
    }

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, szName, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

BOOL setValue | ( | const _TCHAR * | szKey,
 |  | const _TCHAR * | szValueName,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 368 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Copy keyname into buffer.
    _tcscpy(szKeyBuf, szKey) ;

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, szValueName, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

LONG UnregisterServer ( const CLSID & clsid )

Definition at line 127 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

  MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
  _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 253 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Variable Documentation

EXTENDER_NODE _NodeExtensions[]
Initial value:
 {
    {NameSpaceExtension,
    {0x2974380f, 0x4c4b, 0x11d2, { 0x89, 0xd8, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28 } },
  {0x64026453, 0x6a22, 0x11d3, {0x91, 0x54, 0x0, 0xc0, 0x4f, 0x65, 0xb3, 0xf9} },
    _T("Namespace Extension to the Sky-based Vehicle node")},

    {DummyExtension,
    NULL,
    NULL,
    NULL}
}

Definition at line 29 of file registry.Cpp.

Generated on Wed Nov 13 2024 16:53:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nameext/registry.h File Reference

  • SysMgmt
  • MMC
  • Nameext
Functions

registry.h File Reference

#include <tchar.h>

Go to the source code of this file.

Functions

HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const _TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const _TCHAR *szNameString, const CLSID &clsidAbout, const BOOL fSupportExtensions=FALSE)
HRESULT | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Function Documentation

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const _TCHAR * | szFriendlyName
 | ) |  |

Definition at line 67 of file registry.Cpp.

{
    // Get server location.
    _TCHAR szModule[512] ;
    DWORD dwResult =
        ::GetModuleFileName(hModule,
        szModule,
        sizeof(szModule)/sizeof(_TCHAR)) ;

    assert(dwResult != 0) ;

    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    assert(SUCCEEDED(hr)) ;

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;
  _tcscat(szKey, pszCLSID) ;

    // Add the CLSID to the registry.
    setKeyAndValue(szKey, NULL, szFriendlyName) ;

    // Add the server filename subkey under the CLSID key.
    setKeyAndValue(szKey, _T("InprocServer32"), szModule) ;

    // set the threading model
    _tcscat(szKey, _T("\\InprocServer32"));
    setValue(szKey, _T("ThreadingModel"), _T("Apartment"));

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const _TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | fSupportExtensions = FALSE
 | ) |  |

Definition at line 140 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    LPOLESTR wszAboutCLSID = NULL;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    if (IID_NULL != clsidAbout)
        hr = StringFromCLSID(clsidAbout, &wszAboutCLSID);

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszAboutCLSID, wszAboutCLSID);

    // Add the CLSID to the registry.
    setSnapInKeyAndValue(pszCLSID, NULL, _T("NameString"), szNameString) ;
    setSnapInKeyAndValue(pszCLSID, _T("StandAlone"), NULL, NULL);
    if (IID_NULL != clsidAbout)
        setSnapInKeyAndValue(pszCLSID, NULL, _T("About"), pszAboutCLSID);

    if (fSupportExtensions) {
        // Build the key NodeType
        setSnapInKeyAndValue(pszCLSID, _T("NodeTypes"), NULL, NULL);

        _TCHAR szKey[64] ;
        _tcscpy(szKey, pszCLSID) ;
        _tcscat(szKey, _T("\\NodeTypes")) ;
        setSnapInKeyAndValue(szKey, pszCLSID, NULL, NULL);
    }

    // Free memory.
    CoTaskMemFree(wszCLSID) ;
    if (IID_NULL != clsidAbout)
        CoTaskMemFree(wszAboutCLSID);

    return S_OK ;
}

HRESULT UnregisterServer ( const CLSID & clsid )

Definition at line 112 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

  MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
  _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 184 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Generated on Wed Nov 13 2024 16:53:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nameext/resource.h File Reference

  • SysMgmt
  • MMC
  • Nameext
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDB_BIKE 40007
#define | IDB_BIKE2 40011
#define | IDB_CAR 40005
#define | IDB_CAR2 40009
#define | IDB_CLOSED 40014
#define | IDB_CLOSED2 40012
#define | IDB_LGBMP 113
#define | IDB_OPEN 40015
#define | IDB_OPEN2 40013
#define | IDB_PLANE 40006
#define | IDB_PLANE2 40010
#define | IDB_ROCKET 40004
#define | IDB_ROCKET2 40008
#define | IDB_SMBMP 112
#define | IDB_SMOPEN 111
#define | IDI_ICON1 108
#define | IDR_LGICONS 121
#define | IDR_SMICONS 120
#define | IDS_ABOUTNAME 9
#define | IDS_HELPFILE 1
#define | IDS_NAME 3
#define | IDS_SNAPINDESC 2
#define | IDS_SNAPINNAME 6

Define Documentation

#define IDB_BIKE 40007

Definition at line 19 of file resource.h.

#define IDB_BIKE2 40011

Definition at line 23 of file resource.h.

#define IDB_CAR 40005

Definition at line 17 of file resource.h.

#define IDB_CAR2 40009

Definition at line 21 of file resource.h.

#define IDB_CLOSED 40014

Definition at line 26 of file resource.h.

#define IDB_CLOSED2 40012

Definition at line 24 of file resource.h.

#define IDB_LGBMP 113

Definition at line 13 of file resource.h.

#define IDB_OPEN 40015

Definition at line 27 of file resource.h.

#define IDB_OPEN2 40013

Definition at line 25 of file resource.h.

#define IDB_PLANE 40006

Definition at line 18 of file resource.h.

#define IDB_PLANE2 40010

Definition at line 22 of file resource.h.

#define IDB_ROCKET 40004

Definition at line 16 of file resource.h.

#define IDB_ROCKET2 40008

Definition at line 20 of file resource.h.

#define IDB_SMBMP 112

Definition at line 12 of file resource.h.

#define IDB_SMOPEN 111

Definition at line 11 of file resource.h.

#define IDI_ICON1 108

Definition at line 10 of file resource.h.

#define IDR_LGICONS 121

Definition at line 15 of file resource.h.

#define IDR_SMICONS 120

Definition at line 14 of file resource.h.

#define IDS_ABOUTNAME 9

Definition at line 9 of file resource.h.

#define IDS_HELPFILE 1

Definition at line 5 of file resource.h.

#define IDS_NAME 3

Definition at line 7 of file resource.h.

#define IDS_SNAPINDESC 2

Definition at line 6 of file resource.h.

#define IDS_SNAPINNAME 6

Definition at line 8 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nameext/sky.Cpp File Reference

  • SysMgmt
  • MMC
  • Nameext

sky.Cpp File Reference

#include <stdio.h>
#include "sky.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nameext/sky.h File Reference

  • SysMgmt
  • MMC
  • Nameext
Classes

sky.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class | CPlane
class | CSkyVehicle
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nodes/about.Cpp File Reference

  • SysMgmt
  • MMC
  • Nodes
Functions

about.Cpp File Reference

#include "About.h"
#include "resource.h"
#include "globals.h"
#include <crtdbg.h>

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CSnapinAbout

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 89 of file about.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        // we need to decrement our object count in the DLL
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:54:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nodes/about.h File Reference

  • SysMgmt
  • MMC
  • Nodes
Classes

about.h File Reference

#include <tchar.h>
#include <mmc.h>

Go to the source code of this file.

Classes

class CSnapinAbout
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nodes/backgrnd.Cpp File Reference

  • SysMgmt
  • MMC
  • Nodes
Defines

backgrnd.Cpp File Reference

#include "Backgrnd.h"

Go to the source code of this file.

Defines

#define | WM_DISCOVERYCOMPLETE (WM_APP + 1)
#define | WM_NEWOBJECT WM_APP

Define Documentation

#define WM_DISCOVERYCOMPLETE (WM_APP + 1)

Definition at line 26 of file backgrnd.Cpp.

#define WM_NEWOBJECT WM_APP

Definition at line 25 of file backgrnd.Cpp.

Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nodes/backgrnd.h File Reference

  • SysMgmt
  • MMC
  • Nodes
Classes

backgrnd.h File Reference

#include "DeleBase.h"
#include "DeleBase.h"

Go to the source code of this file.

Classes

class | CBackground
class | CBackgroundFolder
Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nodes/basesnap.Cpp File Reference

  • SysMgmt
  • MMC
  • Nodes
Functions | Variables

basesnap.Cpp File Reference

#include <objbase.h>
#include <olectl.h>
#include <initguid.h>
#include "guids.h"
#include "basesnap.h"
#include "Comp.h"
#include "CompData.h"
#include "About.h"
#include "Registry.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)
BOOL WINAPI | DllMain (HINSTANCE hinstDLL, DWORD fdwReason, void *lpvReserved)
STDAPI | DllRegisterServer ()
STDAPI | DllUnregisterServer ()
STDMETHODIMP_ (ULONG) CClassFactory

Variables

HINSTANCE | g_hinst

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 77 of file basesnap.Cpp.

{
    if (g_uObjects == 0 && g_uSrvLock == 0)
        return S_OK;
    else
        return S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 45 of file basesnap.Cpp.

{
    if ((rclsid != CLSID_CComponentData) && (rclsid != CLSID_CSnapinAbout))
        return CLASS_E_CLASSNOTAVAILABLE;

    if (!ppvObj)
        return E_FAIL;

    *ppvObj = NULL;

    // We can only hand out IUnknown and IClassFactory pointers.  Fail
    // if they ask for anything else.
    if (!IsEqualIID(riid, IID_IUnknown) && !IsEqualIID(riid, IID_IClassFactory))
        return E_NOINTERFACE;

    CClassFactory *pFactory = NULL;

    // make the factory passing in the creation function for the type of object they want
    if (rclsid == CLSID_CComponentData)
        pFactory = new CClassFactory(CClassFactory::COMPONENT);
    else if (rclsid == CLSID_CSnapinAbout)
        pFactory = new CClassFactory(CClassFactory::ABOUT);

    if (NULL == pFactory)
        return E_OUTOFMEMORY;

    HRESULT hr = pFactory->QueryInterface(riid, ppvObj);

    return hr;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hinstDLL,
 |  | DWORD | fdwReason,
 |  | void * | lpvReserved
 | ) |  |

Definition at line 32 of file basesnap.Cpp.

{

    if (fdwReason == DLL_PROCESS_ATTACH) {
        g_hinst = hinstDLL;
    }

    return TRUE;
}

STDAPI DllRegisterServer ( void )

Definition at line 187 of file basesnap.Cpp.

{
    HRESULT hr = SELFREG_E_CLASS;
    _TCHAR szName[256];
    _TCHAR szSnapInName[256];

    LoadString(g_hinst, IDS_NAME, szName, (sizeof szName)/(sizeof szName[0]));
    LoadString(g_hinst, IDS_SNAPINNAME, szSnapInName, (sizeof szSnapInName)/(sizeof szSnapInName[0]));

    _TCHAR szAboutName[256];

    LoadString(g_hinst, IDS_ABOUTNAME, szAboutName, (sizeof szAboutName)/(sizeof szAboutName[0]));

    // register our CoClasses
    hr = RegisterServer(g_hinst,
        CLSID_CComponentData,
        szName);

    if SUCCEEDED(hr)
        hr = RegisterServer(g_hinst,
        CLSID_CSnapinAbout,
        szAboutName);

    // place the registry information for SnapIns
    if SUCCEEDED(hr)
        hr = RegisterSnapin(CLSID_CComponentData, szSnapInName, CLSID_CSnapinAbout, FALSE);

    return hr;
}

STDAPI DllUnregisterServer ( void )

Definition at line 218 of file basesnap.Cpp.

{
    if (UnregisterServer(CLSID_CComponentData) == S_OK)
        return UnregisterSnapin(CLSID_CComponentData);
    else
        return E_FAIL;
}

STDMETHODIMP_ ( ULONG )

Definition at line 124 of file basesnap.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;
}

Variable Documentation

HINSTANCE g_hinst

Definition at line 30 of file basesnap.Cpp.

Generated on Wed Nov 13 2024 16:54:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nodes/basesnap.h File Reference

  • SysMgmt
  • MMC
  • Nodes
Classes | Functions | Variables

basesnap.h File Reference

Go to the source code of this file.

Classes

class | CClassFactory

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)

Variables

ULONG | g_uObjects = 0
ULONG | g_uSrvLock = 0

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 53 of file ComSpyAudit.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 61 of file ComSpyAudit.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

Variable Documentation

ULONG g_uObjects = 0

Definition at line 24 of file basesnap.h.

ULONG g_uSrvLock = 0

Definition at line 25 of file basesnap.h.

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nodes/comp.Cpp File Reference

  • SysMgmt
  • MMC
  • Nodes
Functions

comp.Cpp File Reference

#include "Comp.h"
#include "DataObj.h"
#include <commctrl.h>
#include <crtdbg.h>
#include "globals.h"
#include "resource.h"
#include "DeleBase.h"
#include "CompData.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CComponent

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 67 of file comp.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nodes/comp.h File Reference

  • SysMgmt
  • MMC
  • Nodes
Classes

comp.h File Reference

#include <mmc.h>

Go to the source code of this file.

Classes

class CComponent
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nodes/compdata.Cpp File Reference

  • SysMgmt
  • MMC
  • Nodes
Functions

compdata.Cpp File Reference

#include "Comp.h"
#include "CompData.h"
#include "DataObj.h"
#include "resource.h"
#include <crtdbg.h>

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CComponentData

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 72 of file compdata.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        // we need to decrement our object count in the DLL
        delete this;
        return 0;
    }

    return m_cref;
}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nodes/compdata.h File Reference

  • SysMgmt
  • MMC
  • Nodes
Classes

compdata.h File Reference

#include <mmc.h>
#include "DeleBase.h"
#include "StatNode.h"
#include "Comp.h"
#include "StatNode.h"

Go to the source code of this file.

Classes

class CComponentData
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nodes/dataobj.Cpp File Reference

  • SysMgmt
  • MMC
  • Nodes
Defines | Functions

dataobj.Cpp File Reference

#include "DataObj.h"
#include "guids.h"
#include "DeleBase.h"

Go to the source code of this file.

Defines

#define | _T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")
#define | _T_CCF_INTERNAL_SNAPIN _T("{2479DB32-5276-11d2-94F5-00C04FB92EC2}")
#define | _T_CCF_NODETYPE _T("CCF_NODETYPE")
#define | _T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")
#define | _T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")

Functions

CDataObject * | GetOurDataObject (LPDATAOBJECT lpDataObject)
STDMETHODIMP_ (ULONG) CDataObject

Define Documentation

#define _T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")

Definition at line 31 of file dataobj.Cpp.

#define _T_CCF_INTERNAL_SNAPIN _T("{2479DB32-5276-11d2-94F5-00C04FB92EC2}")

Definition at line 36 of file dataobj.Cpp.

#define _T_CCF_NODETYPE _T("CCF_NODETYPE")

Definition at line 32 of file dataobj.Cpp.

#define _T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")

Definition at line 34 of file dataobj.Cpp.

#define _T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")

Definition at line 33 of file dataobj.Cpp.

Function Documentation

CDataObject* GetOurDataObject ( LPDATAOBJECT lpDataObject )

Definition at line 165 of file dataobj.Cpp.

{
    HRESULT       hr      = S_OK;
    CDataObject *pSDO     = NULL;

  // check to see if the data object is a special data object.
  if ( IS_SPECIAL_DATAOBJECT (lpDataObject) )
  {
    //Code for handling a special data object goes here.

    //Note that the MMC SDK samples do not handle
    //special data objects, so we exit if we get one.
    return NULL;
  }

    STGMEDIUM stgmedium = { TYMED_HGLOBAL,  NULL  };
    FORMATETC formatetc = { CDataObject::s_cfInternal, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };

    // Allocate memory for the stream
    stgmedium.hGlobal = GlobalAlloc( GMEM_SHARE, sizeof(CDataObject *));

    if (!stgmedium.hGlobal) {
        hr = E_OUTOFMEMORY;
    }

    if SUCCEEDED(hr)
        // Attempt to get data from the object
        hr = lpDataObject->GetDataHere( &formatetc, &stgmedium );

    // stgmedium now has the data we need
    if (SUCCEEDED(hr))  {
        pSDO = *(CDataObject **)(stgmedium.hGlobal);
    }

    // if we have memory free it
    if (stgmedium.hGlobal)
        GlobalFree(stgmedium.hGlobal);

    return pSDO;

} // end GetOurDataObject()

STDMETHODIMP_ ( ULONG )

Definition at line 87 of file dataobj.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nodes/dataobj.h File Reference

  • SysMgmt
  • MMC
  • Nodes
Classes | Functions

dataobj.h File Reference

#include <mmc.h>
#include "DeleBase.h"

Go to the source code of this file.

Classes

class | CDataObject

Functions

HRESULT | ExtractFromDataObject (IDataObject *lpDataObject, UINT cf, ULONG cb, HGLOBAL *phGlobal)
CDataObject * | GetOurDataObject (IDataObject *lpDataObject)
BOOL | IsMMCMultiSelectDataObject (IDataObject *lpDataObject)

Function Documentation

HRESULT ExtractFromDataObject | ( | IDataObject * | lpDataObject,
 |  | UINT | cf,
 |  | ULONG | cb,
 |  | HGLOBAL * | phGlobal
 | ) |  |
CDataObject* GetOurDataObject ( IDataObject * lpDataObject )
BOOL IsMMCMultiSelectDataObject ( IDataObject * lpDataObject )
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nodes/delebase.Cpp File Reference

  • SysMgmt
  • MMC
  • Nodes

delebase.Cpp File Reference

#include "DeleBase.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nodes/delebase.h File Reference

  • SysMgmt
  • MMC
  • Nodes
Classes

delebase.h File Reference

#include <mmc.h>
#include <crtdbg.h>
#include "globals.h"
#include "resource.h"
#include "LocalRes.h"
#include "LocalRes.h"

Go to the source code of this file.

Classes

class CDelegationBase
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nodes/globals.h File Reference

  • SysMgmt
  • MMC
  • Nodes
Classes | Defines | Functions | Variables

globals.h File Reference

#include <tchar.h>

Go to the source code of this file.

Classes

class | TempBuffer

Defines

#define | IDM_BUTTON1 0x100
#define | IDM_BUTTON2 0x101
#define | MAKE_TSTRPTR_FROMWIDE(ptrname, widestr)
#define | MAKE_WIDEPTR_FROMTSTR(ptrname, tstr)
#define | MAKE_WIDEPTR_FROMTSTR_ALLOC(ptrname, tstr)
#define | OBJECT_CREATED InterlockedIncrement((long *)&g_uObjects);
#define | OBJECT_DESTROYED InterlockedDecrement((long *)&g_uObjects);

Functions

void | MMCN_Crack (BOOL bComponentData, IDataObject *pDataObject, IComponentData *pCompData, IComponent *pComp, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)

Variables

HINSTANCE | g_hinst
ULONG g_uObjects

Define Documentation

#define IDM_BUTTON1 0x100

Definition at line 25 of file globals.h.

#define IDM_BUTTON2 0x101

Definition at line 26 of file globals.h.

#define MAKE_TSTRPTR_FROMWIDE | ( | ptrname,
 |  | widestr
 | ) |
Value:
long __l##ptrname = (wcslen(widestr) + 1) * 2 * sizeof(TCHAR); \
    TempBuffer __TempBuffer##ptrname(__l##ptrname); \
    WideCharToMultiByte(CP_ACP, 0, widestr, -1, (LPSTR)__TempBuffer##ptrname.GetBuffer(), __l##ptrname, NULL, NULL); \
    LPTSTR ptrname = (LPTSTR)__TempBuffer##ptrname.GetBuffer()

Definition at line 127 of file globals.h.

#define MAKE_WIDEPTR_FROMTSTR | ( | ptrname,
 |  | tstr
 | ) |
Value:
long __cch##ptrname = (lstrlenA(tstr) + 1);\
    long __l##ptrname = (lstrlenA(tstr) + 1) * sizeof(WCHAR); \
    TempBuffer __TempBuffer##ptrname(__l##ptrname); \
    MultiByteToWideChar(CP_ACP, 0, tstr, -1, (LPWSTR)__TempBuffer##ptrname.GetBuffer(), __cch##ptrname); \
    LPWSTR ptrname = (LPWSTR)__TempBuffer##ptrname.GetBuffer()

Definition at line 93 of file globals.h.

#define MAKE_WIDEPTR_FROMTSTR_ALLOC | ( | ptrname,
 |  | tstr
 | ) |
Value:
long __cch##ptrname = (lstrlenA(tstr) + 1);\
    long __l##ptrname = (lstrlenA(tstr) + 1) * sizeof(WCHAR); \
    LPWSTR ptrname = (LPWSTR)CoTaskMemAlloc(__l##ptrname); \
    MultiByteToWideChar(CP_ACP, 0, tstr, -1, ptrname, __cch##ptrname)

Definition at line 107 of file globals.h.

#define OBJECT_CREATED InterlockedIncrement((long *)&g_uObjects);

Definition at line 31 of file globals.h.

#define OBJECT_DESTROYED InterlockedDecrement((long *)&g_uObjects);

Definition at line 32 of file globals.h.

Function Documentation

void MMCN_Crack | ( | BOOL | bComponentData,
 |  | IDataObject * | pDataObject,
 |  | IComponentData * | pCompData,
 |  | IComponent * | pComp,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param
 | ) |  |

Definition at line 59 of file mmccrack.Cpp.

{
#ifdef MMC_CRACK_MESSAGES
        const size_t cchMessage = 256;
  TCHAR message[cchMessage] = {0};

  if (bComponentData == TRUE)
    OutputDebugString(_T("IComponentData::Notify( "));
  else
    OutputDebugString(_T("IComponent::Notify( "));

  wsprintf(message, _T("DataObject: %08x, CompData: %08x, Comp: %08x ) - "), pDataObject, pCompData, pComp);
  OutputDebugString(message);

    switch (event)  {
    case MMCN_ACTIVATE:
      wsprintf(message, _T("MMCN_ACTIVATE\n\tActivate: %d\n"), arg);
      break;

    case MMCN_ADD_IMAGES:
      wsprintf(message, _T("MMCN_ADD_IMAGES\n\tImage List: %08x\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_BTN_CLICK:
      wsprintf(message, _T("MMCN_BTN_CLICK\n\tVerb: %ws\n"), MMCN_CrackVerb((MMC_CONSOLE_VERB)param));
      break;

    case MMCN_COLUMN_CLICK:
      wsprintf(message, _T("MMCN_COLUMN_CLICK\n\tColumn: %d\n\tSort Option: %d\n"), arg,   param);
      break;

    case MMCN_COLUMNS_CHANGED:
      wsprintf(message, _T("MMCN_COLUMNS_CHANGED\n"));
      break;

    case MMCN_CONTEXTHELP:
      wsprintf(message, _T("MMCN_CONTEXTHELP\n"));
      break;

    case MMCN_CONTEXTMENU:
      wsprintf(message, _T("MMCN_CONTEXTMENU\n"));
      break;

    case MMCN_CUTORMOVE:
      wsprintf(message, _T("MMCN_CUTORMOVE\n"));
      break;

    case MMCN_DBLCLICK:
      wsprintf(message, _T("MMCN_DBLCLICK\n"));
      break;

    case MMCN_DELETE:
      wsprintf(message, _T("MMCN_DELETE\n"));
      break;

    case MMCN_DESELECT_ALL:
      wsprintf(message, _T("MMCN_DESELECT_ALL\n"));
      break;

    case MMCN_EXPAND:
      wsprintf(message, _T("MMCN_EXPAND\n\tExpand: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_EXPANDSYNC:
      wsprintf(message, _T("MMCN_EXPANDSYNC\n"));
      break;

    case MMCN_FILTERBTN_CLICK:
      wsprintf(message, _T("MMCN_FILTERBTN_CLICK\n\tColumn: %d\n"), arg);
      break;

    case MMCN_FILTER_CHANGE:
      wsprintf(message, _T("MMCN_FILTER_CHANGE\n\tColumn: %d\n"), param);
      break;

    case MMCN_HELP:
      wsprintf(message, _T("MMCN_HELP\n"));
      break;

    case MMCN_INITOCX:
      wsprintf(message, _T("MMCN_INITOCX\n\tIUnknown: %08x\n"), param);
      break;

    case MMCN_LISTPAD:
      wsprintf(message, _T("MMCN_LISTPAD\n\tConnect: %d\n"), arg);
      break;

    case MMCN_MENU_BTNCLICK:
      wsprintf(message, _T("MMCN_MENU_BTNCLICK\n"));
      break;

    case MMCN_MINIMIZED:
      wsprintf(message, _T("MMCN_MINIMIZED\n\tMinimized: %d\n"), arg);
      break;

    case MMCN_PASTE:
      wsprintf(message, _T("MMCN_PASTE\n\tCopy: %d\n"), param == NULL);
      break;

    case MMCN_PRELOAD:
      wsprintf(message, _T("MMCN_PRELOAD\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_PRINT:
      wsprintf(message, _T("MMCN_PRINT\n"));
      break;

    case MMCN_PROPERTY_CHANGE:
      wsprintf(message, _T("MMCN_PROPERTY_CHANGE\n\tScope: %d\n\tArg: %08x\n"), arg, param);
      break;

    case MMCN_QUERY_PASTE:
      wsprintf(message, _T("MMCN_QUERY_PASTE\n"));
      break;

    case MMCN_REFRESH:
      wsprintf(message, _T("MMCN_REFRESH\n"));
      break;

    case MMCN_REMOVE_CHILDREN:
      wsprintf(message, _T("MMCN_REMOVE_CHILDREN\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_RENAME:
                        // Destination string may contain a truncation of the ideal result.
                        // (Indicated by return value other than S_OK).
                        // However, it will be null-terminated.
      StringCchPrintf(message, cchMessage, _T("MMCN_RENAME\n\tNew Name: '%ws'\n"), (LPOLESTR)param);
      break;

    case MMCN_RESTORE_VIEW:
      wsprintf(message, _T("MMCN_RESTORE_VIEW\n"));
      break;

    case MMCN_SELECT:
      wsprintf(message, _T("MMCN_SELECT\n\tScope: %d\n\tSelect: %08x\n"), LOWORD(arg), HIWORD(arg));
      break;

    case MMCN_SHOW:
      wsprintf(message, _T("MMCN_SHOW\n\tShow: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_SNAPINHELP:
      wsprintf(message, _T("MMCN_SNAPINHELP\n"));
      break;

    case MMCN_VIEW_CHANGE:
      wsprintf(message, _T("MMCN_VIEW_CHANGE\n\tData: %08x\n\tHint: %08x\n"), arg, param);
      break;
  }

  if (message[0] != 0)
    OutputDebugString(message);
  else
    OutputDebugString(_T("unknown event\n"));

#endif
  return;
}

Variable Documentation

HINSTANCE g_hinst

Definition at line 33 of file SetDisp.h.

ULONG g_uObjects

Definition at line 24 of file basesnap.h.

Generated on Wed Nov 13 2024 16:54:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nodes/guids.h File Reference

  • SysMgmt
  • MMC
  • Nodes
Functions

guids.h File Reference

Go to the source code of this file.

Functions

DEFINE_GUID (CLSID_CComponentData, 0x6bb32802, 0x92e6, 0x11d2, 0x99, 0x67, 0x0, 0x80, 0xc7, 0xdc, 0xb3, 0xdc)
DEFINE_GUID (CLSID_CSnapinAbout, 0x73a37f60, 0x92e6, 0x11d2, 0x99, 0x67, 0x0, 0x80, 0xc7, 0xdc, 0xb3, 0xdc)

Function Documentation

DEFINE_GUID | ( | CLSID_CComponentData | ,
 |  | 0x6bb32802 | ,
 |  | 0x92e6 | ,
 |  | 0x11d2 | ,
 |  | 0x99 | ,
 |  | 0x67 | ,
 |  | 0x0 | ,
 |  | 0x80 | ,
 |  | 0xc7 | ,
 |  | 0xdc | ,
 |  | 0xb3 | ,
 |  | 0xdc |
 | ) |  |
DEFINE_GUID | ( | CLSID_CSnapinAbout | ,
 |  | 0x73a37f60 | ,
 |  | 0x92e6 | ,
 |  | 0x11d2 | ,
 |  | 0x99 | ,
 |  | 0x67 | ,
 |  | 0x0 | ,
 |  | 0x80 | ,
 |  | 0xc7 | ,
 |  | 0xdc | ,
 |  | 0xb3 | ,
 |  | 0xdc |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nodes/land.Cpp File Reference

  • SysMgmt
  • MMC
  • Nodes

land.Cpp File Reference

#include "Land.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nodes/land.h File Reference

  • SysMgmt
  • MMC
  • Nodes
Classes

land.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class CLandBasedVehicle
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nodes/localres.h File Reference

  • SysMgmt
  • MMC
  • Nodes
Defines

localres.h File Reference

Go to the source code of this file.

Defines

#define | INDEX_BACKGROUND 6
#define | INDEX_CLOSEDFOLDER 4
#define | INDEX_LANDICON 1
#define | INDEX_NONE -1
#define | INDEX_OPENFOLDER 5
#define | INDEX_PEOPLEICON 3
#define | INDEX_SKYICON 2
#define | INDEX_SPACEICON 0

Define Documentation

#define INDEX_BACKGROUND 6

Definition at line 29 of file localres.h.

#define INDEX_CLOSEDFOLDER 4

Definition at line 27 of file localres.h.

#define INDEX_LANDICON 1

Definition at line 24 of file localres.h.

#define INDEX_NONE -1

Definition at line 22 of file localres.h.

#define INDEX_OPENFOLDER 5

Definition at line 28 of file localres.h.

#define INDEX_PEOPLEICON 3

Definition at line 26 of file localres.h.

#define INDEX_SKYICON 2

Definition at line 25 of file localres.h.

#define INDEX_SPACEICON 0

Definition at line 23 of file localres.h.

Generated on Wed Nov 13 2024 16:54:37 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nodes/mmccrack.Cpp File Reference

  • SysMgmt
  • MMC
  • Nodes
Defines | Functions

mmccrack.Cpp File Reference

#include <mmc.h>
#include <winuser.h>
#include <tchar.h>
#include "globals.h"
#include <strsafe.h>

Go to the source code of this file.

Defines

#define | STRSAFE_NO_DEPRECATE

Functions

void | MMCN_Crack (BOOL bComponentData, IDataObject *pDataObject, IComponentData *pCompData, IComponent *pComp, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)

Define Documentation

#define STRSAFE_NO_DEPRECATE

Definition at line 25 of file mmccrack.Cpp.

Function Documentation

void MMCN_Crack | ( | BOOL | bComponentData,
 |  | IDataObject * | pDataObject,
 |  | IComponentData * | pCompData,
 |  | IComponent * | pComp,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param
 | ) |  |

Definition at line 59 of file mmccrack.Cpp.

{
#ifdef MMC_CRACK_MESSAGES
        const size_t cchMessage = 256;
  TCHAR message[cchMessage] = {0};

  if (bComponentData == TRUE)
    OutputDebugString(_T("IComponentData::Notify( "));
  else
    OutputDebugString(_T("IComponent::Notify( "));

  wsprintf(message, _T("DataObject: %08x, CompData: %08x, Comp: %08x ) - "), pDataObject, pCompData, pComp);
  OutputDebugString(message);

    switch (event)  {
    case MMCN_ACTIVATE:
      wsprintf(message, _T("MMCN_ACTIVATE\n\tActivate: %d\n"), arg);
      break;

    case MMCN_ADD_IMAGES:
      wsprintf(message, _T("MMCN_ADD_IMAGES\n\tImage List: %08x\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_BTN_CLICK:
      wsprintf(message, _T("MMCN_BTN_CLICK\n\tVerb: %ws\n"), MMCN_CrackVerb((MMC_CONSOLE_VERB)param));
      break;

    case MMCN_COLUMN_CLICK:
      wsprintf(message, _T("MMCN_COLUMN_CLICK\n\tColumn: %d\n\tSort Option: %d\n"), arg,   param);
      break;

    case MMCN_COLUMNS_CHANGED:
      wsprintf(message, _T("MMCN_COLUMNS_CHANGED\n"));
      break;

    case MMCN_CONTEXTHELP:
      wsprintf(message, _T("MMCN_CONTEXTHELP\n"));
      break;

    case MMCN_CONTEXTMENU:
      wsprintf(message, _T("MMCN_CONTEXTMENU\n"));
      break;

    case MMCN_CUTORMOVE:
      wsprintf(message, _T("MMCN_CUTORMOVE\n"));
      break;

    case MMCN_DBLCLICK:
      wsprintf(message, _T("MMCN_DBLCLICK\n"));
      break;

    case MMCN_DELETE:
      wsprintf(message, _T("MMCN_DELETE\n"));
      break;

    case MMCN_DESELECT_ALL:
      wsprintf(message, _T("MMCN_DESELECT_ALL\n"));
      break;

    case MMCN_EXPAND:
      wsprintf(message, _T("MMCN_EXPAND\n\tExpand: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_EXPANDSYNC:
      wsprintf(message, _T("MMCN_EXPANDSYNC\n"));
      break;

    case MMCN_FILTERBTN_CLICK:
      wsprintf(message, _T("MMCN_FILTERBTN_CLICK\n\tColumn: %d\n"), arg);
      break;

    case MMCN_FILTER_CHANGE:
      wsprintf(message, _T("MMCN_FILTER_CHANGE\n\tColumn: %d\n"), param);
      break;

    case MMCN_HELP:
      wsprintf(message, _T("MMCN_HELP\n"));
      break;

    case MMCN_INITOCX:
      wsprintf(message, _T("MMCN_INITOCX\n\tIUnknown: %08x\n"), param);
      break;

    case MMCN_LISTPAD:
      wsprintf(message, _T("MMCN_LISTPAD\n\tConnect: %d\n"), arg);
      break;

    case MMCN_MENU_BTNCLICK:
      wsprintf(message, _T("MMCN_MENU_BTNCLICK\n"));
      break;

    case MMCN_MINIMIZED:
      wsprintf(message, _T("MMCN_MINIMIZED\n\tMinimized: %d\n"), arg);
      break;

    case MMCN_PASTE:
      wsprintf(message, _T("MMCN_PASTE\n\tCopy: %d\n"), param == NULL);
      break;

    case MMCN_PRELOAD:
      wsprintf(message, _T("MMCN_PRELOAD\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_PRINT:
      wsprintf(message, _T("MMCN_PRINT\n"));
      break;

    case MMCN_PROPERTY_CHANGE:
      wsprintf(message, _T("MMCN_PROPERTY_CHANGE\n\tScope: %d\n\tArg: %08x\n"), arg, param);
      break;

    case MMCN_QUERY_PASTE:
      wsprintf(message, _T("MMCN_QUERY_PASTE\n"));
      break;

    case MMCN_REFRESH:
      wsprintf(message, _T("MMCN_REFRESH\n"));
      break;

    case MMCN_REMOVE_CHILDREN:
      wsprintf(message, _T("MMCN_REMOVE_CHILDREN\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_RENAME:
                        // Destination string may contain a truncation of the ideal result.
                        // (Indicated by return value other than S_OK).
                        // However, it will be null-terminated.
      StringCchPrintf(message, cchMessage, _T("MMCN_RENAME\n\tNew Name: '%ws'\n"), (LPOLESTR)param);
      break;

    case MMCN_RESTORE_VIEW:
      wsprintf(message, _T("MMCN_RESTORE_VIEW\n"));
      break;

    case MMCN_SELECT:
      wsprintf(message, _T("MMCN_SELECT\n\tScope: %d\n\tSelect: %08x\n"), LOWORD(arg), HIWORD(arg));
      break;

    case MMCN_SHOW:
      wsprintf(message, _T("MMCN_SHOW\n\tShow: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_SNAPINHELP:
      wsprintf(message, _T("MMCN_SNAPINHELP\n"));
      break;

    case MMCN_VIEW_CHANGE:
      wsprintf(message, _T("MMCN_VIEW_CHANGE\n\tData: %08x\n\tHint: %08x\n"), arg, param);
      break;
  }

  if (message[0] != 0)
    OutputDebugString(message);
  else
    OutputDebugString(_T("unknown event\n"));

#endif
  return;
}

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nodes/people.Cpp File Reference

  • SysMgmt
  • MMC
  • Nodes

people.Cpp File Reference

#include "People.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nodes/people.h File Reference

  • SysMgmt
  • MMC
  • Nodes
Classes

people.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class | CBicycle
class | CBicycleFolder
class | CIceSkate
class | CIceSkateFolder
class | CPeoplePoweredVehicle
class | CSkateboard
class | CSkateboardFolder
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nodes/registry.Cpp File Reference

  • SysMgmt
  • MMC
  • Nodes
Defines | Functions

registry.Cpp File Reference

#include <objbase.h>
#include <assert.h>
#include "Registry.h"
#include "globals.h"

Go to the source code of this file.

Defines

#define | STRINGS_ONLY

Functions

LONG | recursiveDeleteKey (HKEY hKeyParent, const _TCHAR *szKeyChild)
HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const _TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const _TCHAR *szNameString, const CLSID &clsidAbout, const BOOL fSupportExtensions)
BOOL | setKeyAndValue (const _TCHAR *pszPath, const _TCHAR *szSubkey, const _TCHAR *szValue)
BOOL | setSnapInKeyAndValue (const _TCHAR *szKey, const _TCHAR *szSubkey, const _TCHAR *szName, const _TCHAR *szValue)
BOOL | setValue (const _TCHAR *szKey, const _TCHAR *szValueName, const _TCHAR *szValue)
LONG | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Define Documentation

#define STRINGS_ONLY

Definition at line 24 of file registry.Cpp.

Function Documentation

LONG recursiveDeleteKey | ( | HKEY | hKeyParent,
 |  | const _TCHAR * | szKeyChild
 | ) |  |

Definition at line 214 of file registry.Cpp.

{
    // Open the child.
    HKEY hKeyChild ;
    LONG lRes = RegOpenKeyEx(hKeyParent, lpszKeyChild, 0,
        KEY_ALL_ACCESS, &hKeyChild) ;
    if (lRes != ERROR_SUCCESS)
    {
        return lRes ;
    }

    // Enumerate all of the decendents of this child.
    FILETIME time ;
    _TCHAR szBuffer[256] ;
    DWORD dwSize = 256 ;
    while (RegEnumKeyEx(hKeyChild, 0, szBuffer, &dwSize, NULL,
        NULL, NULL, &time) == S_OK)
    {
        // Delete the decendents of this child.
        lRes = recursiveDeleteKey(hKeyChild, szBuffer) ;
        if (lRes != ERROR_SUCCESS)
        {
            // Cleanup before exiting.
            RegCloseKey(hKeyChild) ;
            return lRes;
        }
        dwSize = 256 ;
    }

    // Close the child.
    RegCloseKey(hKeyChild) ;

    // Delete this child.
    return RegDeleteKey(hKeyParent, lpszKeyChild) ;
}

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const _TCHAR * | szFriendlyName
 | ) |  |

Definition at line 67 of file registry.Cpp.

{
    // Get server location.
    _TCHAR szModule[512] ;
    DWORD dwResult =
        ::GetModuleFileName(hModule,
        szModule,
        sizeof(szModule)/sizeof(_TCHAR)) ;

    assert(dwResult != 0) ;

    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    assert(SUCCEEDED(hr)) ;

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;
  _tcscat(szKey, pszCLSID) ;

    // Add the CLSID to the registry.
    setKeyAndValue(szKey, NULL, szFriendlyName) ;

    // Add the server filename subkey under the CLSID key.
    setKeyAndValue(szKey, _T("InprocServer32"), szModule) ;

    // set the threading model
    _tcscat(szKey, _T("\\InprocServer32"));
    setValue(szKey, _T("ThreadingModel"), _T("Apartment"));

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const _TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | fSupportExtensions
 | ) |  |

Definition at line 140 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    LPOLESTR wszAboutCLSID = NULL;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    if (IID_NULL != clsidAbout)
        hr = StringFromCLSID(clsidAbout, &wszAboutCLSID);

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszAboutCLSID, wszAboutCLSID);

    // Add the CLSID to the registry.
    setSnapInKeyAndValue(pszCLSID, NULL, _T("NameString"), szNameString) ;
    setSnapInKeyAndValue(pszCLSID, _T("StandAlone"), NULL, NULL);
    if (IID_NULL != clsidAbout)
        setSnapInKeyAndValue(pszCLSID, NULL, _T("About"), pszAboutCLSID);

    if (fSupportExtensions) {
        // Build the key NodeType
        setSnapInKeyAndValue(pszCLSID, _T("NodeTypes"), NULL, NULL);

        _TCHAR szKey[64] ;
        _tcscpy(szKey, pszCLSID) ;
        _tcscat(szKey, _T("\\NodeTypes")) ;
        setSnapInKeyAndValue(szKey, pszCLSID, NULL, NULL);
    }

    // Free memory.
    CoTaskMemFree(wszCLSID) ;
    if (IID_NULL != clsidAbout)
        CoTaskMemFree(wszAboutCLSID);

    return S_OK ;
}

BOOL setKeyAndValue | ( | const _TCHAR * | pszPath,
 |  | const _TCHAR * | szSubkey,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 256 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Copy keyname into buffer.
    _tcscpy(szKeyBuf, szKey) ;

    // Add subkey name to buffer.
    if (szSubkey != NULL)
    {
        _tcscat(szKeyBuf, _T("\\")) ;
        _tcscat(szKeyBuf, szSubkey ) ;
    }

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, NULL, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

BOOL setSnapInKeyAndValue | ( | const _TCHAR * | szKey,
 |  | const _TCHAR * | szSubkey,
 |  | const _TCHAR * | szName,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 337 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\")) ;
    _tcscat(szKeyBuf, szKey) ;

    // Add subkey name to buffer.
    if (szSubkey != NULL)
    {
        _tcscat(szKeyBuf, _T("\\")) ;
        _tcscat(szKeyBuf, szSubkey ) ;
    }

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, szName, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

BOOL setValue | ( | const _TCHAR * | szKey,
 |  | const _TCHAR * | szValueName,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 299 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Copy keyname into buffer.
    _tcscpy(szKeyBuf, szKey) ;

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, szValueName, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

LONG UnregisterServer ( const CLSID & clsid )

Definition at line 112 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

  MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
  _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 184 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Generated on Wed Nov 13 2024 16:53:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nodes/registry.h File Reference

  • SysMgmt
  • MMC
  • Nodes
Functions

registry.h File Reference

#include <tchar.h>

Go to the source code of this file.

Functions

HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const _TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const _TCHAR *szNameString, const CLSID &clsidAbout, const BOOL fSupportExtensions=FALSE)
HRESULT | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Function Documentation

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const _TCHAR * | szFriendlyName
 | ) |  |

Definition at line 67 of file registry.Cpp.

{
    // Get server location.
    _TCHAR szModule[512] ;
    DWORD dwResult =
        ::GetModuleFileName(hModule,
        szModule,
        sizeof(szModule)/sizeof(_TCHAR)) ;

    assert(dwResult != 0) ;

    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    assert(SUCCEEDED(hr)) ;

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;
  _tcscat(szKey, pszCLSID) ;

    // Add the CLSID to the registry.
    setKeyAndValue(szKey, NULL, szFriendlyName) ;

    // Add the server filename subkey under the CLSID key.
    setKeyAndValue(szKey, _T("InprocServer32"), szModule) ;

    // set the threading model
    _tcscat(szKey, _T("\\InprocServer32"));
    setValue(szKey, _T("ThreadingModel"), _T("Apartment"));

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const _TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | fSupportExtensions = FALSE
 | ) |  |

Definition at line 140 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    LPOLESTR wszAboutCLSID = NULL;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    if (IID_NULL != clsidAbout)
        hr = StringFromCLSID(clsidAbout, &wszAboutCLSID);

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszAboutCLSID, wszAboutCLSID);

    // Add the CLSID to the registry.
    setSnapInKeyAndValue(pszCLSID, NULL, _T("NameString"), szNameString) ;
    setSnapInKeyAndValue(pszCLSID, _T("StandAlone"), NULL, NULL);
    if (IID_NULL != clsidAbout)
        setSnapInKeyAndValue(pszCLSID, NULL, _T("About"), pszAboutCLSID);

    if (fSupportExtensions) {
        // Build the key NodeType
        setSnapInKeyAndValue(pszCLSID, _T("NodeTypes"), NULL, NULL);

        _TCHAR szKey[64] ;
        _tcscpy(szKey, pszCLSID) ;
        _tcscat(szKey, _T("\\NodeTypes")) ;
        setSnapInKeyAndValue(szKey, pszCLSID, NULL, NULL);
    }

    // Free memory.
    CoTaskMemFree(wszCLSID) ;
    if (IID_NULL != clsidAbout)
        CoTaskMemFree(wszAboutCLSID);

    return S_OK ;
}

HRESULT UnregisterServer ( const CLSID & clsid )

Definition at line 112 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

  MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
  _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 184 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Generated on Wed Nov 13 2024 16:53:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nodes/resource.h File Reference

  • SysMgmt
  • MMC
  • Nodes
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDB_BIKE 40007
#define | IDB_BIKE2 40011
#define | IDB_CAR 40005
#define | IDB_CAR2 40009
#define | IDB_CLOSED 40014
#define | IDB_CLOSED2 40012
#define | IDB_LGBMP 113
#define | IDB_OPEN 40015
#define | IDB_OPEN2 40013
#define | IDB_PLANE 40006
#define | IDB_PLANE2 40010
#define | IDB_ROCKET 40004
#define | IDB_ROCKET2 40008
#define | IDB_SMBMP 112
#define | IDB_SMOPEN 111
#define | IDI_ICON1 108
#define | IDR_LGICONS 121
#define | IDR_SMICONS 120
#define | IDS_ABOUTNAME 9
#define | IDS_HELPFILE 1
#define | IDS_NAME 3
#define | IDS_SNAPINDESC 2
#define | IDS_SNAPINNAME 6

Define Documentation

#define IDB_BIKE 40007

Definition at line 19 of file resource.h.

#define IDB_BIKE2 40011

Definition at line 23 of file resource.h.

#define IDB_CAR 40005

Definition at line 17 of file resource.h.

#define IDB_CAR2 40009

Definition at line 21 of file resource.h.

#define IDB_CLOSED 40014

Definition at line 26 of file resource.h.

#define IDB_CLOSED2 40012

Definition at line 24 of file resource.h.

#define IDB_LGBMP 113

Definition at line 13 of file resource.h.

#define IDB_OPEN 40015

Definition at line 27 of file resource.h.

#define IDB_OPEN2 40013

Definition at line 25 of file resource.h.

#define IDB_PLANE 40006

Definition at line 18 of file resource.h.

#define IDB_PLANE2 40010

Definition at line 22 of file resource.h.

#define IDB_ROCKET 40004

Definition at line 16 of file resource.h.

#define IDB_ROCKET2 40008

Definition at line 20 of file resource.h.

#define IDB_SMBMP 112

Definition at line 12 of file resource.h.

#define IDB_SMOPEN 111

Definition at line 11 of file resource.h.

#define IDI_ICON1 108

Definition at line 10 of file resource.h.

#define IDR_LGICONS 121

Definition at line 15 of file resource.h.

#define IDR_SMICONS 120

Definition at line 14 of file resource.h.

#define IDS_ABOUTNAME 9

Definition at line 9 of file resource.h.

#define IDS_HELPFILE 1

Definition at line 5 of file resource.h.

#define IDS_NAME 3

Definition at line 7 of file resource.h.

#define IDS_SNAPINDESC 2

Definition at line 6 of file resource.h.

#define IDS_SNAPINNAME 6

Definition at line 8 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nodes/sky.Cpp File Reference

  • SysMgmt
  • MMC
  • Nodes

sky.Cpp File Reference

#include "Sky.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nodes/sky.h File Reference

  • SysMgmt
  • MMC
  • Nodes
Classes

sky.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class CSkyBasedVehicle
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nodes/space.Cpp File Reference

  • SysMgmt
  • MMC
  • Nodes
Defines

space.Cpp File Reference

#include "Space.h"
#include "Comp.h"
#include <strsafe.h>

Go to the source code of this file.

Defines

#define STRSAFE_NO_DEPRECATE

Define Documentation

#define STRSAFE_NO_DEPRECATE

Definition at line 22 of file space.Cpp.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nodes/space.h File Reference

  • SysMgmt
  • MMC
  • Nodes
Classes

space.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class | CRocket
class | CSpaceVehicle
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nodes/statnode.Cpp File Reference

  • SysMgmt
  • MMC
  • Nodes

statnode.Cpp File Reference

#include "StatNode.h"
#include "Space.h"
#include "Sky.h"
#include "People.h"
#include "Land.h"
#include "Backgrnd.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Nodes/statnode.h File Reference

  • SysMgmt
  • MMC
  • Nodes
Classes

statnode.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class CStaticNode
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Openserv/about.Cpp File Reference

  • SysMgmt
  • MMC
  • Openserv
Functions

about.Cpp File Reference

#include "About.h"
#include "resource.h"
#include "globals.h"
#include <crtdbg.h>

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CSnapinAbout

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 89 of file about.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        // we need to decrement our object count in the DLL
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:54:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Openserv/about.h File Reference

  • SysMgmt
  • MMC
  • Openserv
Classes

about.h File Reference

#include <tchar.h>
#include <mmc.h>

Go to the source code of this file.

Classes

class CSnapinAbout
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Openserv/basesnap.Cpp File Reference

  • SysMgmt
  • MMC
  • Openserv
Functions | Variables

basesnap.Cpp File Reference

#include <objbase.h>
#include <olectl.h>
#include <initguid.h>
#include "guids.h"
#include "basesnap.h"
#include "Comp.h"
#include "CompData.h"
#include "About.h"
#include "Registry.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)
BOOL WINAPI | DllMain (HINSTANCE hinstDLL, DWORD fdwReason, void *lpvReserved)
STDAPI | DllRegisterServer ()
STDAPI | DllUnregisterServer ()
STDMETHODIMP_ (ULONG) CClassFactory

Variables

HINSTANCE | g_hinst

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 77 of file basesnap.Cpp.

{
    if (g_uObjects == 0 && g_uSrvLock == 0)
        return S_OK;
    else
        return S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 45 of file basesnap.Cpp.

{
    if ((rclsid != CLSID_CComponentData) && (rclsid != CLSID_CSnapinAbout))
        return CLASS_E_CLASSNOTAVAILABLE;

    if (!ppvObj)
        return E_FAIL;

    *ppvObj = NULL;

    // We can only hand out IUnknown and IClassFactory pointers.  Fail
    // if they ask for anything else.
    if (!IsEqualIID(riid, IID_IUnknown) && !IsEqualIID(riid, IID_IClassFactory))
        return E_NOINTERFACE;

    CClassFactory *pFactory = NULL;

    // make the factory passing in the creation function for the type of object they want
    if (rclsid == CLSID_CComponentData)
        pFactory = new CClassFactory(CClassFactory::COMPONENT);
    else if (rclsid == CLSID_CSnapinAbout)
        pFactory = new CClassFactory(CClassFactory::ABOUT);

    if (NULL == pFactory)
        return E_OUTOFMEMORY;

    HRESULT hr = pFactory->QueryInterface(riid, ppvObj);

    return hr;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hinstDLL,
 |  | DWORD | fdwReason,
 |  | void * | lpvReserved
 | ) |  |

Definition at line 32 of file basesnap.Cpp.

{

    if (fdwReason == DLL_PROCESS_ATTACH) {
        g_hinst = hinstDLL;
    }

    return TRUE;
}

STDAPI DllRegisterServer ( void )

Definition at line 187 of file basesnap.Cpp.

{
    HRESULT hr = SELFREG_E_CLASS;
    _TCHAR szName[256];
    _TCHAR szSnapInName[256];

    LoadString(g_hinst, IDS_NAME, szName, (sizeof szName)/(sizeof szName[0]));
    LoadString(g_hinst, IDS_SNAPINNAME, szSnapInName, (sizeof szSnapInName)/(sizeof szSnapInName[0]));

    _TCHAR szAboutName[256];

    LoadString(g_hinst, IDS_ABOUTNAME, szAboutName, (sizeof szAboutName)/(sizeof szAboutName[0]));

    // register our CoClasses
    hr = RegisterServer(g_hinst,
        CLSID_CComponentData,
        szName);

    if SUCCEEDED(hr)
        hr = RegisterServer(g_hinst,
        CLSID_CSnapinAbout,
        szAboutName);

    // place the registry information for SnapIns
    if SUCCEEDED(hr)
        hr = RegisterSnapin(CLSID_CComponentData, szSnapInName, CLSID_CSnapinAbout, FALSE);

    return hr;
}

STDAPI DllUnregisterServer ( void )

Definition at line 218 of file basesnap.Cpp.

{
    if (UnregisterServer(CLSID_CComponentData) == S_OK)
        return UnregisterSnapin(CLSID_CComponentData);
    else
        return E_FAIL;
}

STDMETHODIMP_ ( ULONG )

Definition at line 124 of file basesnap.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;
}

Variable Documentation

HINSTANCE g_hinst

Definition at line 30 of file basesnap.Cpp.

Generated on Wed Nov 13 2024 16:54:34 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Openserv/basesnap.h File Reference

  • SysMgmt
  • MMC
  • Openserv
Classes | Functions | Variables

basesnap.h File Reference

Go to the source code of this file.

Classes

class | CClassFactory

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)

Variables

ULONG | g_uObjects = 0
ULONG | g_uSrvLock = 0

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 53 of file ComSpyAudit.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 61 of file ComSpyAudit.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

Variable Documentation

ULONG g_uObjects = 0

Definition at line 24 of file basesnap.h.

ULONG g_uSrvLock = 0

Definition at line 25 of file basesnap.h.

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Openserv/comp.Cpp File Reference

  • SysMgmt
  • MMC
  • Openserv
Functions

comp.Cpp File Reference

#include "Comp.h"
#include "DataObj.h"
#include <commctrl.h>
#include <crtdbg.h>
#include "globals.h"
#include "resource.h"
#include "DeleBase.h"
#include "CompData.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CComponent

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 68 of file comp.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Openserv/comp.h File Reference

  • SysMgmt
  • MMC
  • Openserv
Classes

comp.h File Reference

#include <mmc.h>

Go to the source code of this file.

Classes

class CComponent
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Openserv/compdata.Cpp File Reference

  • SysMgmt
  • MMC
  • Openserv
Functions

compdata.Cpp File Reference

#include "Comp.h"
#include "CompData.h"
#include "DataObj.h"
#include "resource.h"
#include <crtdbg.h>

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CComponentData

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 79 of file compdata.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        // we need to decrement our object count in the DLL
        delete this;
        return 0;
    }

    return m_cref;
}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Openserv/compdata.h File Reference

  • SysMgmt
  • MMC
  • Openserv
Classes

compdata.h File Reference

#include <mmc.h>
#include "DeleBase.h"
#include "StatNode.h"
#include "Comp.h"
#include "DeleBase.h"
#include "StatNode.h"

Go to the source code of this file.

Classes

class CComponentData
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Openserv/dataobj.Cpp File Reference

  • SysMgmt
  • MMC
  • Openserv
Defines | Functions

dataobj.Cpp File Reference

#include "DataObj.h"
#include "guids.h"
#include "DeleBase.h"

Go to the source code of this file.

Defines

#define | _T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")
#define | _T_CCF_INTERNAL_SNAPIN _T("{2479DB32-5276-11d2-94F5-00C04FB92EC2}")
#define | _T_CCF_NODETYPE _T("CCF_NODETYPE")
#define | _T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")
#define | _T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")

Functions

CDataObject * | GetOurDataObject (LPDATAOBJECT lpDataObject)
STDMETHODIMP_ (ULONG) CDataObject

Define Documentation

#define _T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")

Definition at line 31 of file dataobj.Cpp.

#define _T_CCF_INTERNAL_SNAPIN _T("{2479DB32-5276-11d2-94F5-00C04FB92EC2}")

Definition at line 36 of file dataobj.Cpp.

#define _T_CCF_NODETYPE _T("CCF_NODETYPE")

Definition at line 32 of file dataobj.Cpp.

#define _T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")

Definition at line 34 of file dataobj.Cpp.

#define _T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")

Definition at line 33 of file dataobj.Cpp.

Function Documentation

CDataObject* GetOurDataObject ( LPDATAOBJECT lpDataObject )

Definition at line 165 of file dataobj.Cpp.

{
    HRESULT       hr      = S_OK;
    CDataObject *pSDO     = NULL;

  // check to see if the data object is a special data object.
  if ( IS_SPECIAL_DATAOBJECT (lpDataObject) )
  {
    //Code for handling a special data object goes here.

    //Note that the MMC SDK samples do not handle
    //special data objects, so we exit if we get one.
    return NULL;
  }

    STGMEDIUM stgmedium = { TYMED_HGLOBAL,  NULL  };
    FORMATETC formatetc = { CDataObject::s_cfInternal, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };

    // Allocate memory for the stream
    stgmedium.hGlobal = GlobalAlloc( GMEM_SHARE, sizeof(CDataObject *));

    if (!stgmedium.hGlobal)     {
        hr = E_OUTOFMEMORY;
    }

    if SUCCEEDED(hr)
        // Attempt to get data from the object
        hr = lpDataObject->GetDataHere( &formatetc, &stgmedium );

    // stgmedium now has the data we need
    if (SUCCEEDED(hr))  {
        pSDO = *(CDataObject **)(stgmedium.hGlobal);
    }

    // if we have memory free it
    if (stgmedium.hGlobal)
        GlobalFree(stgmedium.hGlobal);

    return pSDO;

} // end GetOurDataObject()

STDMETHODIMP_ ( ULONG )

Definition at line 87 of file dataobj.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Openserv/dataobj.h File Reference

  • SysMgmt
  • MMC
  • Openserv
Classes | Functions

dataobj.h File Reference

#include <mmc.h>
#include "DeleBase.h"

Go to the source code of this file.

Classes

class | CDataObject

Functions

HRESULT | ExtractFromDataObject (IDataObject *lpDataObject, UINT cf, ULONG cb, HGLOBAL *phGlobal)
CDataObject * | GetOurDataObject (IDataObject *lpDataObject)
BOOL | IsMMCMultiSelectDataObject (IDataObject *lpDataObject)

Function Documentation

HRESULT ExtractFromDataObject | ( | IDataObject * | lpDataObject,
 |  | UINT | cf,
 |  | ULONG | cb,
 |  | HGLOBAL * | phGlobal
 | ) |  |
CDataObject* GetOurDataObject ( IDataObject * lpDataObject )
BOOL IsMMCMultiSelectDataObject ( IDataObject * lpDataObject )
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Openserv/delebase.Cpp File Reference

  • SysMgmt
  • MMC
  • Openserv

delebase.Cpp File Reference

#include "DeleBase.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Openserv/delebase.h File Reference

  • SysMgmt
  • MMC
  • Openserv
Classes

delebase.h File Reference

#include <mmc.h>
#include <crtdbg.h>
#include "globals.h"
#include "resource.h"
#include "LocalRes.h"
#include "LocalRes.h"

Go to the source code of this file.

Classes

class CDelegationBase
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Openserv/globals.h File Reference

  • SysMgmt
  • MMC
  • Openserv
Classes | Defines | Functions | Variables

globals.h File Reference

#include <tchar.h>

Go to the source code of this file.

Classes

class | TempBuffer

Defines

#define | IDM_BUTTON1 0x100
#define | IDM_BUTTON2 0x101
#define | MAKE_TSTRPTR_FROMWIDE(ptrname, widestr)
#define | MAKE_WIDEPTR_FROMTSTR(ptrname, tstr)
#define | MAKE_WIDEPTR_FROMTSTR_ALLOC(ptrname, tstr)
#define | OBJECT_CREATED InterlockedIncrement((long *)&g_uObjects);
#define | OBJECT_DESTROYED InterlockedDecrement((long *)&g_uObjects);

Functions

void | MMCN_Crack (BOOL bComponentData, IDataObject *pDataObject, IComponentData *pCompData, IComponent *pComp, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)

Variables

HINSTANCE | g_hinst
ULONG g_uObjects

Define Documentation

#define IDM_BUTTON1 0x100

Definition at line 25 of file globals.h.

#define IDM_BUTTON2 0x101

Definition at line 26 of file globals.h.

#define MAKE_TSTRPTR_FROMWIDE | ( | ptrname,
 |  | widestr
 | ) |
Value:
long __l##ptrname = (wcslen(widestr) + 1) * 2 * sizeof(TCHAR); \
    TempBuffer __TempBuffer##ptrname(__l##ptrname); \
    WideCharToMultiByte(CP_ACP, 0, widestr, -1, (LPSTR)__TempBuffer##ptrname.GetBuffer(), __l##ptrname, NULL, NULL); \
    LPTSTR ptrname = (LPTSTR)__TempBuffer##ptrname.GetBuffer()

Definition at line 127 of file globals.h.

#define MAKE_WIDEPTR_FROMTSTR | ( | ptrname,
 |  | tstr
 | ) |
Value:
long __cch##ptrname = (lstrlenA(tstr) + 1);\
    long __l##ptrname = (lstrlenA(tstr) + 1) * sizeof(WCHAR); \
    TempBuffer __TempBuffer##ptrname(__l##ptrname); \
    MultiByteToWideChar(CP_ACP, 0, tstr, -1, (LPWSTR)__TempBuffer##ptrname.GetBuffer(), __cch##ptrname); \
    LPWSTR ptrname = (LPWSTR)__TempBuffer##ptrname.GetBuffer()

Definition at line 93 of file globals.h.

#define MAKE_WIDEPTR_FROMTSTR_ALLOC | ( | ptrname,
 |  | tstr
 | ) |
Value:
long __cch##ptrname = (lstrlenA(tstr) + 1);\
    long __l##ptrname = (lstrlenA(tstr) + 1) * sizeof(WCHAR); \
    LPWSTR ptrname = (LPWSTR)CoTaskMemAlloc(__l##ptrname); \
    MultiByteToWideChar(CP_ACP, 0, tstr, -1, ptrname, __cch##ptrname)

Definition at line 107 of file globals.h.

#define OBJECT_CREATED InterlockedIncrement((long *)&g_uObjects);

Definition at line 31 of file globals.h.

#define OBJECT_DESTROYED InterlockedDecrement((long *)&g_uObjects);

Definition at line 32 of file globals.h.

Function Documentation

void MMCN_Crack | ( | BOOL | bComponentData,
 |  | IDataObject * | pDataObject,
 |  | IComponentData * | pCompData,
 |  | IComponent * | pComp,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param
 | ) |  |

Definition at line 59 of file mmccrack.Cpp.

{
#ifdef MMC_CRACK_MESSAGES
        const size_t cchMessage = 256;
  TCHAR message[cchMessage] = {0};

  if (bComponentData == TRUE)
    OutputDebugString(_T("IComponentData::Notify( "));
  else
    OutputDebugString(_T("IComponent::Notify( "));

  wsprintf(message, _T("DataObject: %08x, CompData: %08x, Comp: %08x ) - "), pDataObject, pCompData, pComp);
  OutputDebugString(message);

    switch (event)  {
    case MMCN_ACTIVATE:
      wsprintf(message, _T("MMCN_ACTIVATE\n\tActivate: %d\n"), arg);
      break;

    case MMCN_ADD_IMAGES:
      wsprintf(message, _T("MMCN_ADD_IMAGES\n\tImage List: %08x\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_BTN_CLICK:
      wsprintf(message, _T("MMCN_BTN_CLICK\n\tVerb: %ws\n"), MMCN_CrackVerb((MMC_CONSOLE_VERB)param));
      break;

    case MMCN_COLUMN_CLICK:
      wsprintf(message, _T("MMCN_COLUMN_CLICK\n\tColumn: %d\n\tSort Option: %d\n"), arg,   param);
      break;

    case MMCN_COLUMNS_CHANGED:
      wsprintf(message, _T("MMCN_COLUMNS_CHANGED\n"));
      break;

    case MMCN_CONTEXTHELP:
      wsprintf(message, _T("MMCN_CONTEXTHELP\n"));
      break;

    case MMCN_CONTEXTMENU:
      wsprintf(message, _T("MMCN_CONTEXTMENU\n"));
      break;

    case MMCN_CUTORMOVE:
      wsprintf(message, _T("MMCN_CUTORMOVE\n"));
      break;

    case MMCN_DBLCLICK:
      wsprintf(message, _T("MMCN_DBLCLICK\n"));
      break;

    case MMCN_DELETE:
      wsprintf(message, _T("MMCN_DELETE\n"));
      break;

    case MMCN_DESELECT_ALL:
      wsprintf(message, _T("MMCN_DESELECT_ALL\n"));
      break;

    case MMCN_EXPAND:
      wsprintf(message, _T("MMCN_EXPAND\n\tExpand: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_EXPANDSYNC:
      wsprintf(message, _T("MMCN_EXPANDSYNC\n"));
      break;

    case MMCN_FILTERBTN_CLICK:
      wsprintf(message, _T("MMCN_FILTERBTN_CLICK\n\tColumn: %d\n"), arg);
      break;

    case MMCN_FILTER_CHANGE:
      wsprintf(message, _T("MMCN_FILTER_CHANGE\n\tColumn: %d\n"), param);
      break;

    case MMCN_HELP:
      wsprintf(message, _T("MMCN_HELP\n"));
      break;

    case MMCN_INITOCX:
      wsprintf(message, _T("MMCN_INITOCX\n\tIUnknown: %08x\n"), param);
      break;

    case MMCN_LISTPAD:
      wsprintf(message, _T("MMCN_LISTPAD\n\tConnect: %d\n"), arg);
      break;

    case MMCN_MENU_BTNCLICK:
      wsprintf(message, _T("MMCN_MENU_BTNCLICK\n"));
      break;

    case MMCN_MINIMIZED:
      wsprintf(message, _T("MMCN_MINIMIZED\n\tMinimized: %d\n"), arg);
      break;

    case MMCN_PASTE:
      wsprintf(message, _T("MMCN_PASTE\n\tCopy: %d\n"), param == NULL);
      break;

    case MMCN_PRELOAD:
      wsprintf(message, _T("MMCN_PRELOAD\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_PRINT:
      wsprintf(message, _T("MMCN_PRINT\n"));
      break;

    case MMCN_PROPERTY_CHANGE:
      wsprintf(message, _T("MMCN_PROPERTY_CHANGE\n\tScope: %d\n\tArg: %08x\n"), arg, param);
      break;

    case MMCN_QUERY_PASTE:
      wsprintf(message, _T("MMCN_QUERY_PASTE\n"));
      break;

    case MMCN_REFRESH:
      wsprintf(message, _T("MMCN_REFRESH\n"));
      break;

    case MMCN_REMOVE_CHILDREN:
      wsprintf(message, _T("MMCN_REMOVE_CHILDREN\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_RENAME:
                        // Destination string may contain a truncation of the ideal result.
                        // (Indicated by return value other than S_OK).
                        // However, it will be null-terminated.
      StringCchPrintf(message, cchMessage, _T("MMCN_RENAME\n\tNew Name: '%ws'\n"), (LPOLESTR)param);
      break;

    case MMCN_RESTORE_VIEW:
      wsprintf(message, _T("MMCN_RESTORE_VIEW\n"));
      break;

    case MMCN_SELECT:
      wsprintf(message, _T("MMCN_SELECT\n\tScope: %d\n\tSelect: %08x\n"), LOWORD(arg), HIWORD(arg));
      break;

    case MMCN_SHOW:
      wsprintf(message, _T("MMCN_SHOW\n\tShow: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_SNAPINHELP:
      wsprintf(message, _T("MMCN_SNAPINHELP\n"));
      break;

    case MMCN_VIEW_CHANGE:
      wsprintf(message, _T("MMCN_VIEW_CHANGE\n\tData: %08x\n\tHint: %08x\n"), arg, param);
      break;
  }

  if (message[0] != 0)
    OutputDebugString(message);
  else
    OutputDebugString(_T("unknown event\n"));

#endif
  return;
}

Variable Documentation

HINSTANCE g_hinst

Definition at line 33 of file SetDisp.h.

ULONG g_uObjects

Definition at line 24 of file basesnap.h.

Generated on Wed Nov 13 2024 16:54:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Openserv/guids.h File Reference

  • SysMgmt
  • MMC
  • Openserv
Functions

guids.h File Reference

Go to the source code of this file.

Functions

DEFINE_GUID (CLSID_CComponentData, 0xc3f68021, 0x94f3, 0x11d2, 0x99, 0x67, 0x0, 0x80, 0xc7, 0xdc, 0xb3, 0xdc)
DEFINE_GUID (CLSID_CSnapinAbout, 0xcc288c90, 0x94f3, 0x11d2, 0x99, 0x67, 0x0, 0x80, 0xc7, 0xdc, 0xb3, 0xdc)

Function Documentation

DEFINE_GUID | ( | CLSID_CComponentData | ,
 |  | 0xc3f68021 | ,
 |  | 0x94f3 | ,
 |  | 0x11d2 | ,
 |  | 0x99 | ,
 |  | 0x67 | ,
 |  | 0x0 | ,
 |  | 0x80 | ,
 |  | 0xc7 | ,
 |  | 0xdc | ,
 |  | 0xb3 | ,
 |  | 0xdc |
 | ) |  |
DEFINE_GUID | ( | CLSID_CSnapinAbout | ,
 |  | 0xcc288c90 | ,
 |  | 0x94f3 | ,
 |  | 0x11d2 | ,
 |  | 0x99 | ,
 |  | 0x67 | ,
 |  | 0x0 | ,
 |  | 0x80 | ,
 |  | 0xc7 | ,
 |  | 0xdc | ,
 |  | 0xb3 | ,
 |  | 0xdc |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Openserv/land.Cpp File Reference

  • SysMgmt
  • MMC
  • Openserv

land.Cpp File Reference

#include "Land.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Openserv/land.h File Reference

  • SysMgmt
  • MMC
  • Openserv
Classes

land.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class CLandBasedVehicle
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Openserv/localres.h File Reference

  • SysMgmt
  • MMC
  • Openserv
Defines

localres.h File Reference

Go to the source code of this file.

Defines

#define | INDEX_CLOSEDFOLDER 4
#define | INDEX_LANDICON 1
#define | INDEX_NONE -1
#define | INDEX_OPENFOLDER 5
#define | INDEX_PEOPLEICON 3
#define | INDEX_SKYICON 2
#define | INDEX_SPACEICON 0

Define Documentation

#define INDEX_CLOSEDFOLDER 4

Definition at line 27 of file localres.h.

#define INDEX_LANDICON 1

Definition at line 24 of file localres.h.

#define INDEX_NONE -1

Definition at line 22 of file localres.h.

#define INDEX_OPENFOLDER 5

Definition at line 28 of file localres.h.

#define INDEX_PEOPLEICON 3

Definition at line 26 of file localres.h.

#define INDEX_SKYICON 2

Definition at line 25 of file localres.h.

#define INDEX_SPACEICON 0

Definition at line 23 of file localres.h.

Generated on Wed Nov 13 2024 16:54:37 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Openserv/mmccrack.Cpp File Reference

  • SysMgmt
  • MMC
  • Openserv
Defines | Functions

mmccrack.Cpp File Reference

#include <mmc.h>
#include <winuser.h>
#include <tchar.h>
#include "globals.h"
#include <strsafe.h>

Go to the source code of this file.

Defines

#define | STRSAFE_NO_DEPRECATE

Functions

void | MMCN_Crack (BOOL bComponentData, IDataObject *pDataObject, IComponentData *pCompData, IComponent *pComp, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)

Define Documentation

#define STRSAFE_NO_DEPRECATE

Definition at line 25 of file mmccrack.Cpp.

Function Documentation

void MMCN_Crack | ( | BOOL | bComponentData,
 |  | IDataObject * | pDataObject,
 |  | IComponentData * | pCompData,
 |  | IComponent * | pComp,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param
 | ) |  |

Definition at line 59 of file mmccrack.Cpp.

{
#ifdef MMC_CRACK_MESSAGES
        const size_t cchMessage = 256;
        TCHAR message[cchMessage] = {0};

        if (bComponentData == TRUE)
                OutputDebugString(_T("IComponentData::Notify( "));
        else
                OutputDebugString(_T("IComponent::Notify( "));

        wsprintf(message, _T("DataObject: %08x, CompData: %08x, Comp: %08x ) - "), pDataObject, pCompData, pComp);
        OutputDebugString(message);

    switch (event)      {
                case MMCN_ACTIVATE:
                        wsprintf(message, _T("MMCN_ACTIVATE\n\tActivate: %d\n"), arg);
                        break;

                case MMCN_ADD_IMAGES:
                        wsprintf(message, _T("MMCN_ADD_IMAGES\n\tImage List: %08x\n\tScope Item: %08x\n"), arg, param);
                        break;

                case MMCN_BTN_CLICK:
                        wsprintf(message, _T("MMCN_BTN_CLICK\n\tVerb: %ws\n"), MMCN_CrackVerb((MMC_CONSOLE_VERB)param));
                        break;

                case MMCN_COLUMN_CLICK:
                        wsprintf(message, _T("MMCN_COLUMN_CLICK\n\tColumn: %d\n\tSort Option: %d\n"), arg,       param);
                        break;

                case MMCN_COLUMNS_CHANGED:
                        wsprintf(message, _T("MMCN_COLUMNS_CHANGED\n"));
                        break;

                case MMCN_CONTEXTHELP:
                        wsprintf(message, _T("MMCN_CONTEXTHELP\n"));
                        break;

                case MMCN_CONTEXTMENU:
                        wsprintf(message, _T("MMCN_CONTEXTMENU\n"));
                        break;

                case MMCN_CUTORMOVE:
                        wsprintf(message, _T("MMCN_CUTORMOVE\n"));
                        break;

                case MMCN_DBLCLICK:
                        wsprintf(message, _T("MMCN_DBLCLICK\n"));
                        break;

                case MMCN_DELETE:
                        wsprintf(message, _T("MMCN_DELETE\n"));
                        break;

                case MMCN_DESELECT_ALL:
                        wsprintf(message, _T("MMCN_DESELECT_ALL\n"));
                        break;

                case MMCN_EXPAND:
                        wsprintf(message, _T("MMCN_EXPAND\n\tExpand: %d\n\tScope Item: %08x\n"), arg, param);
                        break;

                case MMCN_EXPANDSYNC:
                        wsprintf(message, _T("MMCN_EXPANDSYNC\n"));
                        break;

                case MMCN_FILTERBTN_CLICK:
                        wsprintf(message, _T("MMCN_FILTERBTN_CLICK\n\tColumn: %d\n"), arg);
                        break;

                case MMCN_FILTER_CHANGE:
                        wsprintf(message, _T("MMCN_FILTER_CHANGE\n\tColumn: %d\n"), param);
                        break;

                case MMCN_HELP:
                        wsprintf(message, _T("MMCN_HELP\n"));
                        break;

                case MMCN_INITOCX:
                        wsprintf(message, _T("MMCN_INITOCX\n\tIUnknown: %08x\n"), param);
                        break;

                case MMCN_LISTPAD:
                        wsprintf(message, _T("MMCN_LISTPAD\n\tConnect: %d\n"), arg);
                        break;

                case MMCN_MENU_BTNCLICK:
                        wsprintf(message, _T("MMCN_MENU_BTNCLICK\n"));
                        break;

                case MMCN_MINIMIZED:
                        wsprintf(message, _T("MMCN_MINIMIZED\n\tMinimized: %d\n"), arg);
                        break;

                case MMCN_PASTE:
                        wsprintf(message, _T("MMCN_PASTE\n\tCopy: %d\n"), param == NULL);
                        break;

                case MMCN_PRELOAD:
                        wsprintf(message, _T("MMCN_PRELOAD\n\tScope Item: %08x\n"), arg);
                        break;

                case MMCN_PRINT:
                        wsprintf(message, _T("MMCN_PRINT\n"));
                        break;

                case MMCN_PROPERTY_CHANGE:
                        wsprintf(message, _T("MMCN_PROPERTY_CHANGE\n\tScope: %d\n\tArg: %08x\n"), arg, param);
                        break;

                case MMCN_QUERY_PASTE:
                        wsprintf(message, _T("MMCN_QUERY_PASTE\n"));
                        break;

                case MMCN_REFRESH:
                        wsprintf(message, _T("MMCN_REFRESH\n"));
                        break;

                case MMCN_REMOVE_CHILDREN:
                        wsprintf(message, _T("MMCN_REMOVE_CHILDREN\n\tScope Item: %08x\n"), arg);
                        break;

                case MMCN_RENAME:
                        // Destination string may contain a truncation of the ideal result.
                        // (Indicated by return value other than S_OK).
                        // However, it will be null-terminated.
                        StringCchPrintf(message, cchMessage, _T("MMCN_RENAME\n\tNew Name: '%ws'\n"), (LPOLESTR)param);
                        break;

                case MMCN_RESTORE_VIEW:
                        wsprintf(message, _T("MMCN_RESTORE_VIEW\n"));
                        break;

                case MMCN_SELECT:
                        wsprintf(message, _T("MMCN_SELECT\n\tScope: %d\n\tSelect: %08x\n"), LOWORD(arg), HIWORD(arg));
                        break;

                case MMCN_SHOW:
                        wsprintf(message, _T("MMCN_SHOW\n\tShow: %d\n\tScope Item: %08x\n"), arg, param);
                        break;

                case MMCN_SNAPINHELP:
                        wsprintf(message, _T("MMCN_SNAPINHELP\n"));
                        break;

                case MMCN_VIEW_CHANGE:
                        wsprintf(message, _T("MMCN_VIEW_CHANGE\n\tData: %08x\n\tHint: %08x\n"), arg, param);
                        break;
        }

        if (message[0] != 0)
                OutputDebugString(message);
        else
                OutputDebugString(_T("unknown event\n"));

#endif
        return;
}

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Openserv/people.Cpp File Reference

  • SysMgmt
  • MMC
  • Openserv

people.Cpp File Reference

#include <stdio.h>
#include "People.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Openserv/people.h File Reference

  • SysMgmt
  • MMC
  • Openserv
Classes

people.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class | CBicycle
class | CBicycleFolder
class | CIceSkate
class | CIceSkateFolder
class | CPeoplePoweredVehicle
class | CSkateboard
class | CSkateboardFolder
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Openserv/registry.Cpp File Reference

  • SysMgmt
  • MMC
  • Openserv
Defines | Functions

registry.Cpp File Reference

#include <objbase.h>
#include <assert.h>
#include "Registry.h"
#include "globals.h"

Go to the source code of this file.

Defines

#define | STRINGS_ONLY

Functions

LONG | recursiveDeleteKey (HKEY hKeyParent, const _TCHAR *szKeyChild)
HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const _TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const _TCHAR *szNameString, const CLSID &clsidAbout, const BOOL fSupportExtensions)
BOOL | setKeyAndValue (const _TCHAR *pszPath, const _TCHAR *szSubkey, const _TCHAR *szValue)
BOOL | setSnapInKeyAndValue (const _TCHAR *szKey, const _TCHAR *szSubkey, const _TCHAR *szName, const _TCHAR *szValue)
BOOL | setValue (const _TCHAR *szKey, const _TCHAR *szValueName, const _TCHAR *szValue)
LONG | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Define Documentation

#define STRINGS_ONLY

Definition at line 24 of file registry.Cpp.

Function Documentation

LONG recursiveDeleteKey | ( | HKEY | hKeyParent,
 |  | const _TCHAR * | szKeyChild
 | ) |  |

Definition at line 214 of file registry.Cpp.

{
    // Open the child.
    HKEY hKeyChild ;
    LONG lRes = RegOpenKeyEx(hKeyParent, lpszKeyChild, 0,
        KEY_ALL_ACCESS, &hKeyChild) ;
    if (lRes != ERROR_SUCCESS)
    {
        return lRes ;
    }

    // Enumerate all of the decendents of this child.
    FILETIME time ;
    _TCHAR szBuffer[256] ;
    DWORD dwSize = 256 ;
    while (RegEnumKeyEx(hKeyChild, 0, szBuffer, &dwSize, NULL,
        NULL, NULL, &time) == S_OK)
    {
        // Delete the decendents of this child.
        lRes = recursiveDeleteKey(hKeyChild, szBuffer) ;
        if (lRes != ERROR_SUCCESS)
        {
            // Cleanup before exiting.
            RegCloseKey(hKeyChild) ;
            return lRes;
        }
        dwSize = 256 ;
    }

    // Close the child.
    RegCloseKey(hKeyChild) ;

    // Delete this child.
    return RegDeleteKey(hKeyParent, lpszKeyChild) ;
}

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const _TCHAR * | szFriendlyName
 | ) |  |

Definition at line 67 of file registry.Cpp.

{
    // Get server location.
    _TCHAR szModule[512] ;
    DWORD dwResult =
        ::GetModuleFileName(hModule,
        szModule,
        sizeof(szModule)/sizeof(_TCHAR)) ;

    assert(dwResult != 0) ;

    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    assert(SUCCEEDED(hr)) ;

        MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;
        _tcscat(szKey, pszCLSID) ;

    // Add the CLSID to the registry.
    setKeyAndValue(szKey, NULL, szFriendlyName) ;

    // Add the server filename subkey under the CLSID key.
    setKeyAndValue(szKey, _T("InprocServer32"), szModule) ;

    // set the threading model
    _tcscat(szKey, _T("\\InprocServer32"));
    setValue(szKey, _T("ThreadingModel"), _T("Apartment"));

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const _TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | fSupportExtensions
 | ) |  |

Definition at line 140 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    LPOLESTR wszAboutCLSID = NULL;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    if (IID_NULL != clsidAbout)
        hr = StringFromCLSID(clsidAbout, &wszAboutCLSID);

        MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);
        MAKE_TSTRPTR_FROMWIDE(pszAboutCLSID, wszAboutCLSID);

    // Add the CLSID to the registry.
    setSnapInKeyAndValue(pszCLSID, NULL, _T("NameString"), szNameString) ;
    setSnapInKeyAndValue(pszCLSID, _T("StandAlone"), NULL, NULL);
    if (IID_NULL != clsidAbout)
        setSnapInKeyAndValue(pszCLSID, NULL, _T("About"), pszAboutCLSID);

    if (fSupportExtensions) {
        // Build the key NodeType
        setSnapInKeyAndValue(pszCLSID, _T("NodeTypes"), NULL, NULL);

        _TCHAR szKey[64] ;
        _tcscpy(szKey, pszCLSID) ;
        _tcscat(szKey, _T("\\NodeTypes")) ;
        setSnapInKeyAndValue(szKey, pszCLSID, NULL, NULL);
    }

    // Free memory.
    CoTaskMemFree(wszCLSID) ;
    if (IID_NULL != clsidAbout)
        CoTaskMemFree(wszAboutCLSID);

    return S_OK ;
}

BOOL setKeyAndValue | ( | const _TCHAR * | pszPath,
 |  | const _TCHAR * | szSubkey,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 256 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Copy keyname into buffer.
    _tcscpy(szKeyBuf, szKey) ;

    // Add subkey name to buffer.
    if (szSubkey != NULL)
    {
        _tcscat(szKeyBuf, _T("\\")) ;
        _tcscat(szKeyBuf, szSubkey ) ;
    }

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, NULL, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

BOOL setSnapInKeyAndValue | ( | const _TCHAR * | szKey,
 |  | const _TCHAR * | szSubkey,
 |  | const _TCHAR * | szName,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 337 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\")) ;
    _tcscat(szKeyBuf, szKey) ;

    // Add subkey name to buffer.
    if (szSubkey != NULL)
    {
        _tcscat(szKeyBuf, _T("\\")) ;
        _tcscat(szKeyBuf, szSubkey ) ;
    }

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, szName, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

BOOL setValue | ( | const _TCHAR * | szKey,
 |  | const _TCHAR * | szValueName,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 299 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Copy keyname into buffer.
    _tcscpy(szKeyBuf, szKey) ;

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, szValueName, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

LONG UnregisterServer ( const CLSID & clsid )

Definition at line 112 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

        MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
        _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
               (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 184 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
        MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
               (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Generated on Wed Nov 13 2024 16:53:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Openserv/registry.h File Reference

  • SysMgmt
  • MMC
  • Openserv
Functions

registry.h File Reference

#include <tchar.h>

Go to the source code of this file.

Functions

HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const _TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const _TCHAR *szNameString, const CLSID &clsidAbout, const BOOL fSupportExtensions=FALSE)
HRESULT | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Function Documentation

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const _TCHAR * | szFriendlyName
 | ) |  |

Definition at line 67 of file registry.Cpp.

{
    // Get server location.
    _TCHAR szModule[512] ;
    DWORD dwResult =
        ::GetModuleFileName(hModule,
        szModule,
        sizeof(szModule)/sizeof(_TCHAR)) ;

    assert(dwResult != 0) ;

    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    assert(SUCCEEDED(hr)) ;

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;
  _tcscat(szKey, pszCLSID) ;

    // Add the CLSID to the registry.
    setKeyAndValue(szKey, NULL, szFriendlyName) ;

    // Add the server filename subkey under the CLSID key.
    setKeyAndValue(szKey, _T("InprocServer32"), szModule) ;

    // set the threading model
    _tcscat(szKey, _T("\\InprocServer32"));
    setValue(szKey, _T("ThreadingModel"), _T("Apartment"));

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const _TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | fSupportExtensions = FALSE
 | ) |  |

Definition at line 140 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    LPOLESTR wszAboutCLSID = NULL;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    if (IID_NULL != clsidAbout)
        hr = StringFromCLSID(clsidAbout, &wszAboutCLSID);

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszAboutCLSID, wszAboutCLSID);

    // Add the CLSID to the registry.
    setSnapInKeyAndValue(pszCLSID, NULL, _T("NameString"), szNameString) ;
    setSnapInKeyAndValue(pszCLSID, _T("StandAlone"), NULL, NULL);
    if (IID_NULL != clsidAbout)
        setSnapInKeyAndValue(pszCLSID, NULL, _T("About"), pszAboutCLSID);

    if (fSupportExtensions) {
        // Build the key NodeType
        setSnapInKeyAndValue(pszCLSID, _T("NodeTypes"), NULL, NULL);

        _TCHAR szKey[64] ;
        _tcscpy(szKey, pszCLSID) ;
        _tcscat(szKey, _T("\\NodeTypes")) ;
        setSnapInKeyAndValue(szKey, pszCLSID, NULL, NULL);
    }

    // Free memory.
    CoTaskMemFree(wszCLSID) ;
    if (IID_NULL != clsidAbout)
        CoTaskMemFree(wszAboutCLSID);

    return S_OK ;
}

HRESULT UnregisterServer ( const CLSID & clsid )

Definition at line 112 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

  MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
  _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 184 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Generated on Wed Nov 13 2024 16:53:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Openserv/resource.h File Reference

  • SysMgmt
  • MMC
  • Openserv
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | ID_FILE_DASH 10029
#define | ID_FILE_EXIT 10030
#define | ID_FILE_PROPERTYSHEET 10028
#define | IDB_BIKE 10007
#define | IDB_BIKE2 10011
#define | IDB_CAR 10005
#define | IDB_CAR2 10009
#define | IDB_CLOSED 10014
#define | IDB_CLOSED2 10012
#define | IDB_HEADER 4
#define | IDB_LGBMP 113
#define | IDB_OPEN 10015
#define | IDB_OPEN2 10013
#define | IDB_PLANE 10006
#define | IDB_PLANE2 10010
#define | IDB_ROCKET 10004
#define | IDB_ROCKET2 10008
#define | IDB_SMBMP 112
#define | IDB_SMOPEN 111
#define | IDB_WATERMARK 3
#define | IDC_CHOOSER_BUTTON_BROWSE_MACHINENAMES 10022
#define | IDC_CHOOSER_CHECK_OVERRIDE_MACHINE_NAME 10023
#define | IDC_CHOOSER_EDIT_MACHINE_NAME 10021
#define | IDC_CHOOSER_GROUP_TARGET_MACHINE 10018
#define | IDC_CHOOSER_RADIO_LOCAL_MACHINE 10019
#define | IDC_CHOOSER_RADIO_SPECIFIC_MACHINE 10020
#define | IDC_CHOOSER_STATIC 10017
#define | IDC_ROCKET_HEIGHT 1001
#define | IDC_ROCKET_NAME 1000
#define | IDC_ROCKET_PAYLOAD 1003
#define | IDC_ROCKET_STATUS 1005
#define | IDC_ROCKET_WEIGHT 1002
#define | IDD_CHOOSER_CHOOSE_MACHINE 10016
#define | IDD_PROPPAGE_LARGE 107
#define | IDI_ICON1 108
#define | IDI_PSI_ROCKET 114
#define | IDR_LGICONS 121
#define | IDR_SMICONS 120
#define | IDS_ABOUTNAME 9
#define | IDS_CHOOSER_INVALID_COMPUTERNAME 10024
#define | IDS_COMPUTER_BROWSER_CAPTION 10027
#define | IDS_HELPFILE 1
#define | IDS_NAME 3
#define | IDS_PST_LANDBASED 10028
#define | IDS_PST_ROCKET 10
#define | IDS_SELECT_COMPUTER 10025
#define | IDS_SNAPINDESC 2
#define | IDS_SNAPINNAME 6
#define | IDS_UNABLE_TO_OPEN_COMPUTER_SELECTOR 10026

Define Documentation

#define ID_FILE_DASH 10029

Definition at line 52 of file resource.h.

#define ID_FILE_EXIT 10030

Definition at line 53 of file resource.h.

#define ID_FILE_PROPERTYSHEET 10028

Definition at line 50 of file resource.h.

#define IDB_BIKE 10007

Definition at line 29 of file resource.h.

#define IDB_BIKE2 10011

Definition at line 33 of file resource.h.

#define IDB_CAR 10005

Definition at line 27 of file resource.h.

#define IDB_CAR2 10009

Definition at line 31 of file resource.h.

#define IDB_CLOSED 10014

Definition at line 36 of file resource.h.

#define IDB_CLOSED2 10012

Definition at line 34 of file resource.h.

#define IDB_HEADER 4

Definition at line 9 of file resource.h.

#define IDB_LGBMP 113

Definition at line 17 of file resource.h.

#define IDB_OPEN 10015

Definition at line 37 of file resource.h.

#define IDB_OPEN2 10013

Definition at line 35 of file resource.h.

#define IDB_PLANE 10006

Definition at line 28 of file resource.h.

#define IDB_PLANE2 10010

Definition at line 32 of file resource.h.

#define IDB_ROCKET 10004

Definition at line 26 of file resource.h.

#define IDB_ROCKET2 10008

Definition at line 30 of file resource.h.

#define IDB_SMBMP 112

Definition at line 16 of file resource.h.

#define IDB_SMOPEN 111

Definition at line 15 of file resource.h.

#define IDB_WATERMARK 3

Definition at line 8 of file resource.h.

#define IDC_CHOOSER_BUTTON_BROWSE_MACHINENAMES 10022

Definition at line 44 of file resource.h.

#define IDC_CHOOSER_CHECK_OVERRIDE_MACHINE_NAME 10023

Definition at line 45 of file resource.h.

#define IDC_CHOOSER_EDIT_MACHINE_NAME 10021

Definition at line 43 of file resource.h.

#define IDC_CHOOSER_GROUP_TARGET_MACHINE 10018

Definition at line 40 of file resource.h.

#define IDC_CHOOSER_RADIO_LOCAL_MACHINE 10019

Definition at line 41 of file resource.h.

#define IDC_CHOOSER_RADIO_SPECIFIC_MACHINE 10020

Definition at line 42 of file resource.h.

#define IDC_CHOOSER_STATIC 10017

Definition at line 39 of file resource.h.

#define IDC_ROCKET_HEIGHT 1001

Definition at line 22 of file resource.h.

#define IDC_ROCKET_NAME 1000

Definition at line 21 of file resource.h.

#define IDC_ROCKET_PAYLOAD 1003

Definition at line 24 of file resource.h.

#define IDC_ROCKET_STATUS 1005

Definition at line 25 of file resource.h.

#define IDC_ROCKET_WEIGHT 1002

Definition at line 23 of file resource.h.

#define IDD_CHOOSER_CHOOSE_MACHINE 10016

Definition at line 38 of file resource.h.

#define IDD_PROPPAGE_LARGE 107

Definition at line 13 of file resource.h.

#define IDI_ICON1 108

Definition at line 14 of file resource.h.

#define IDI_PSI_ROCKET 114

Definition at line 18 of file resource.h.

#define IDR_LGICONS 121

Definition at line 20 of file resource.h.

#define IDR_SMICONS 120

Definition at line 19 of file resource.h.

#define IDS_ABOUTNAME 9

Definition at line 11 of file resource.h.

#define IDS_CHOOSER_INVALID_COMPUTERNAME 10024

Definition at line 46 of file resource.h.

#define IDS_COMPUTER_BROWSER_CAPTION 10027

Definition at line 49 of file resource.h.

#define IDS_HELPFILE 1

Definition at line 5 of file resource.h.

#define IDS_NAME 3

Definition at line 7 of file resource.h.

#define IDS_PST_LANDBASED 10028

Definition at line 51 of file resource.h.

#define IDS_PST_ROCKET 10

Definition at line 12 of file resource.h.

#define IDS_SELECT_COMPUTER 10025

Definition at line 47 of file resource.h.

#define IDS_SNAPINDESC 2

Definition at line 6 of file resource.h.

#define IDS_SNAPINNAME 6

Definition at line 10 of file resource.h.

#define IDS_UNABLE_TO_OPEN_COMPUTER_SELECTOR 10026

Definition at line 48 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Openserv/sky.Cpp File Reference

  • SysMgmt
  • MMC
  • Openserv

sky.Cpp File Reference

#include "Sky.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Openserv/sky.h File Reference

  • SysMgmt
  • MMC
  • Openserv
Classes

sky.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class CSkyBasedVehicle
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Openserv/space.Cpp File Reference

  • SysMgmt
  • MMC
  • Openserv
Defines

space.Cpp File Reference

#include <stdio.h>
#include <windows.h>
#include "Space.h"
#include "Comp.h"
#include "resource.h"
#include <strsafe.h>

Go to the source code of this file.

Defines

#define STRSAFE_NO_DEPRECATE

Define Documentation

#define STRSAFE_NO_DEPRECATE

Definition at line 24 of file space.Cpp.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Openserv/space.h File Reference

  • SysMgmt
  • MMC
  • Openserv
Classes

space.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class | CRocket
class | CSpaceVehicle
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Openserv/statnode.Cpp File Reference

  • SysMgmt
  • MMC
  • Openserv

statnode.Cpp File Reference

#include <windows.h>
#include <Shlwapi.h>
#include <Shlobj.H>
#include "StatNode.h"
#include "Space.h"
#include "Sky.h"
#include "People.h"
#include "Land.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Openserv/statnode.h File Reference

  • SysMgmt
  • MMC
  • Openserv
Classes

statnode.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class | CStaticNode
struct | CStaticNode::privateData
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Ppgeext/about.Cpp File Reference

  • SysMgmt
  • MMC
  • Ppgeext
Functions

about.Cpp File Reference

#include "About.h"
#include "resource.h"
#include "globals.h"
#include <crtdbg.h>

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CSnapinAbout

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 89 of file about.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        // we need to decrement our object count in the DLL
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:54:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Ppgeext/about.h File Reference

  • SysMgmt
  • MMC
  • Ppgeext
Classes

about.h File Reference

#include <tchar.h>
#include <mmc.h>

Go to the source code of this file.

Classes

class CSnapinAbout
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Ppgeext/basesnap.Cpp File Reference

  • SysMgmt
  • MMC
  • Ppgeext
Functions | Variables

basesnap.Cpp File Reference

#include <objbase.h>
#include <olectl.h>
#include <initguid.h>
#include "globals.h"
#include "resource.h"
#include "guids.h"
#include "basesnap.h"
#include "PPgeExt.h"
#include "About.h"
#include "Registry.h"
#include "Extend.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)
BOOL WINAPI | DllMain (HINSTANCE hinstDLL, DWORD fdwReason, void *lpvReserved)
STDAPI | DllRegisterServer ()
STDAPI | DllUnregisterServer ()
STDMETHODIMP_ (ULONG) CClassFactory

Variables

HINSTANCE | g_hinst

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 80 of file basesnap.Cpp.

{
    if (g_uObjects == 0 && g_uSrvLock == 0)
        return S_OK;
    else
        return S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 48 of file basesnap.Cpp.

{
    if ((rclsid != CLSID_CPropSheetExtension) && (rclsid != CLSID_CSnapinAbout))
        return CLASS_E_CLASSNOTAVAILABLE;

    if (!ppvObj)
        return E_FAIL;

    *ppvObj = NULL;

    // We can only hand out IUnknown and IClassFactory pointers.  Fail
    // if they ask for anything else.
    if (!IsEqualIID(riid, IID_IUnknown) && !IsEqualIID(riid, IID_IClassFactory))
        return E_NOINTERFACE;

    CClassFactory *pFactory = NULL;

    // make the factory passing in the creation function for the type of object they want
    if (rclsid == CLSID_CPropSheetExtension)
        pFactory = new CClassFactory(CClassFactory::CONTEXTEXTENSION);
    else if (rclsid == CLSID_CSnapinAbout)
        pFactory = new CClassFactory(CClassFactory::ABOUT);

    if (NULL == pFactory)
        return E_OUTOFMEMORY;

    HRESULT hr = pFactory->QueryInterface(riid, ppvObj);

    return hr;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hinstDLL,
 |  | DWORD | fdwReason,
 |  | void * | lpvReserved
 | ) |  |

Definition at line 35 of file basesnap.Cpp.

{

    if (fdwReason == DLL_PROCESS_ATTACH) {
        g_hinst = hinstDLL;
    }

    return TRUE;
}

STDAPI DllRegisterServer ( void )

Definition at line 190 of file basesnap.Cpp.

{
    HRESULT hr = SELFREG_E_CLASS;

    _TCHAR szName[256];
    _TCHAR szSnapInName[256];

    LoadString(g_hinst, IDS_NAME, szName, (sizeof szName)/(sizeof szName[0]));
    LoadString(g_hinst, IDS_SNAPINNAME, szSnapInName, (sizeof szSnapInName)/(sizeof szSnapInName[0]));

    _TCHAR szAboutName[256];

    LoadString(g_hinst, IDS_ABOUTNAME, szAboutName, (sizeof szAboutName)/(sizeof szAboutName[0]));

    // register our CoClasses
    hr = RegisterServer(g_hinst,
        CLSID_CPropSheetExtension,
        szName);

    if SUCCEEDED(hr)
        hr = RegisterServer(g_hinst,
        CLSID_CSnapinAbout,
        szAboutName);

    // place the registry information for SnapIns
    if SUCCEEDED(hr)
        hr = RegisterSnapin(CLSID_CPropSheetExtension, szSnapInName, CLSID_CSnapinAbout);

    return hr;
}

STDAPI DllUnregisterServer ( void )

Definition at line 223 of file basesnap.Cpp.

{
    if (UnregisterServer(CLSID_CPropSheetExtension) == S_OK)
        return UnregisterSnapin(CLSID_CPropSheetExtension);
    else
        return E_FAIL;
}

STDMETHODIMP_ ( ULONG )

Definition at line 127 of file basesnap.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;
}

Variable Documentation

HINSTANCE g_hinst

Definition at line 32 of file basesnap.Cpp.

Generated on Wed Nov 13 2024 16:54:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Ppgeext/basesnap.h File Reference

  • SysMgmt
  • MMC
  • Ppgeext
Classes | Functions | Variables

basesnap.h File Reference

Go to the source code of this file.

Classes

class | CClassFactory

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)

Variables

ULONG | g_uObjects = 0
ULONG | g_uSrvLock = 0

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 53 of file ComSpyAudit.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 61 of file ComSpyAudit.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

Variable Documentation

ULONG g_uObjects = 0

Definition at line 24 of file basesnap.h.

ULONG g_uSrvLock = 0

Definition at line 25 of file basesnap.h.

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Ppgeext/extend.h File Reference

  • SysMgmt
  • MMC
  • Ppgeext
Classes | Enumerations

extend.h File Reference

Go to the source code of this file.

Classes

struct | EXTENDER_NODE
struct | EXTENSION_NODE

Enumerations

enum EXTENSION_TYPE {
NameSpaceExtension, ContextMenuExtension, ToolBarExtension, PropertySheetExtension,
TaskExtension, DynamicExtension, DummyExtension, NameSpaceExtension,
ContextMenuExtension, ToolBarExtension, PropertySheetExtension, TaskExtension,
DynamicExtension, DummyExtension, NameSpaceExtension, ContextMenuExtension,
ToolBarExtension, PropertySheetExtension, TaskExtension, DynamicExtension,
DummyExtension, NameSpaceExtension, ContextMenuExtension, ToolBarExtension,
PropertySheetExtension, TaskExtension, DynamicExtension, DummyExtension
}

Enumeration Type Documentation

enum EXTENSION_TYPE
Enumerator:
NameSpaceExtension
ContextMenuExtension
ToolBarExtension
PropertySheetExtension
TaskExtension
DynamicExtension
DummyExtension
NameSpaceExtension
ContextMenuExtension
ToolBarExtension
PropertySheetExtension
TaskExtension
DynamicExtension
DummyExtension
NameSpaceExtension
ContextMenuExtension
ToolBarExtension
PropertySheetExtension
TaskExtension
DynamicExtension
DummyExtension
NameSpaceExtension
ContextMenuExtension
ToolBarExtension
PropertySheetExtension
TaskExtension
DynamicExtension
DummyExtension

Definition at line 29 of file extend.h.

{
    NameSpaceExtension,
        ContextMenuExtension,
        ToolBarExtension,
        PropertySheetExtension,
        TaskExtension,
        DynamicExtension,
        DummyExtension
};

Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Ppgeext/globals.h File Reference

  • SysMgmt
  • MMC
  • Ppgeext
Classes | Defines | Variables

globals.h File Reference

#include <tchar.h>

Go to the source code of this file.

Classes

class | TempBuffer

Defines

#define | IDM_BUTTON1 0x100
#define | IDM_BUTTON2 0x101
#define | MAKE_TSTRPTR_FROMWIDE(ptrname, widestr)
#define | MAKE_WIDEPTR_FROMTSTR(ptrname, tstr)
#define | MAKE_WIDEPTR_FROMTSTR_ALLOC(ptrname, tstr)
#define | OBJECT_CREATED InterlockedIncrement((long *)&g_uObjects);
#define | OBJECT_DESTROYED InterlockedDecrement((long *)&g_uObjects);

Variables

HINSTANCE | g_hinst
ULONG g_uObjects

Define Documentation

#define IDM_BUTTON1 0x100

Definition at line 25 of file globals.h.

#define IDM_BUTTON2 0x101

Definition at line 26 of file globals.h.

#define MAKE_TSTRPTR_FROMWIDE | ( | ptrname,
 |  | widestr
 | ) |
Value:
long __l##ptrname = (wcslen(widestr) + 1) * 2 * sizeof(TCHAR); \
    TempBuffer __TempBuffer##ptrname(__l##ptrname); \
    WideCharToMultiByte(CP_ACP, 0, widestr, -1, (LPSTR)__TempBuffer##ptrname.GetBuffer(), __l##ptrname, NULL, NULL); \
    LPTSTR ptrname = (LPTSTR)__TempBuffer##ptrname.GetBuffer()

Definition at line 118 of file globals.h.

#define MAKE_WIDEPTR_FROMTSTR | ( | ptrname,
 |  | tstr
 | ) |
Value:
long __cch##ptrname = (lstrlenA(tstr) + 1);\
    long __l##ptrname = (lstrlenA(tstr) + 1) * sizeof(WCHAR); \
    TempBuffer __TempBuffer##ptrname(__l##ptrname); \
    MultiByteToWideChar(CP_ACP, 0, tstr, -1, (LPWSTR)__TempBuffer##ptrname.GetBuffer(), __cch##ptrname); \
    LPWSTR ptrname = (LPWSTR)__TempBuffer##ptrname.GetBuffer()

Definition at line 84 of file globals.h.

#define MAKE_WIDEPTR_FROMTSTR_ALLOC | ( | ptrname,
 |  | tstr
 | ) |
Value:
long __cch##ptrname = (lstrlenA(tstr) + 1);\
    long __l##ptrname = (lstrlenA(tstr) + 1) * sizeof(WCHAR); \
    LPWSTR ptrname = (LPWSTR)CoTaskMemAlloc(__l##ptrname); \
    MultiByteToWideChar(CP_ACP, 0, tstr, -1, ptrname, __cch##ptrname)

Definition at line 98 of file globals.h.

#define OBJECT_CREATED InterlockedIncrement((long *)&g_uObjects);

Definition at line 31 of file globals.h.

#define OBJECT_DESTROYED InterlockedDecrement((long *)&g_uObjects);

Definition at line 32 of file globals.h.

Variable Documentation

HINSTANCE g_hinst

Definition at line 33 of file SetDisp.h.

ULONG g_uObjects

Definition at line 24 of file basesnap.h.

Generated on Wed Nov 13 2024 16:54:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Ppgeext/guids.h File Reference

  • SysMgmt
  • MMC
  • Ppgeext
Functions

guids.h File Reference

Go to the source code of this file.

Functions

DEFINE_GUID (CLSID_CPropSheetExtension, 0xcfcdc9f3, 0xc50e, 0x11d2, 0x95, 0x2b, 0x0, 0xc0, 0x4f, 0xb9, 0x2e, 0xc2)
DEFINE_GUID (CLSID_CSnapinAbout, 0xcfcdc9f7, 0xc50e, 0x11d2, 0x95, 0x2b, 0x0, 0xc0, 0x4f, 0xb9, 0x2e, 0xc2)

Function Documentation

DEFINE_GUID | ( | CLSID_CPropSheetExtension | ,
 |  | 0xcfcdc9f3 | ,
 |  | 0xc50e | ,
 |  | 0x11d2 | ,
 |  | 0x95 | ,
 |  | 0x2b | ,
 |  | 0x0 | ,
 |  | 0xc0 | ,
 |  | 0x4f | ,
 |  | 0xb9 | ,
 |  | 0x2e | ,
 |  | 0xc2 |
 | ) |  |
DEFINE_GUID | ( | CLSID_CSnapinAbout | ,
 |  | 0xcfcdc9f7 | ,
 |  | 0xc50e | ,
 |  | 0x11d2 | ,
 |  | 0x95 | ,
 |  | 0x2b | ,
 |  | 0x0 | ,
 |  | 0xc0 | ,
 |  | 0x4f | ,
 |  | 0xb9 | ,
 |  | 0x2e | ,
 |  | 0xc2 |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Ppgeext/localres.h File Reference

  • SysMgmt
  • MMC
  • Ppgeext
Defines

localres.h File Reference

Go to the source code of this file.

Defines

#define | INDEX_CLOSEDFOLDER 4
#define | INDEX_CLOUD 9
#define | INDEX_LANDICON 1
#define | INDEX_NONE -1
#define | INDEX_OPENFOLDER 5
#define | INDEX_PEOPLEICON 3
#define | INDEX_RAIN 8
#define | INDEX_SKYICON 2
#define | INDEX_SNOW 7
#define | INDEX_SPACEICON 0
#define | INDEX_SUN 6
#define | INDEX_THUNDER 11
#define | INDEX_WORLD 10

Define Documentation

#define INDEX_CLOSEDFOLDER 4

Definition at line 27 of file localres.h.

#define INDEX_CLOUD 9

Definition at line 33 of file localres.h.

#define INDEX_LANDICON 1

Definition at line 24 of file localres.h.

#define INDEX_NONE -1

Definition at line 22 of file localres.h.

#define INDEX_OPENFOLDER 5

Definition at line 28 of file localres.h.

#define INDEX_PEOPLEICON 3

Definition at line 26 of file localres.h.

#define INDEX_RAIN 8

Definition at line 32 of file localres.h.

#define INDEX_SKYICON 2

Definition at line 25 of file localres.h.

#define INDEX_SNOW 7

Definition at line 31 of file localres.h.

#define INDEX_SPACEICON 0

Definition at line 23 of file localres.h.

#define INDEX_SUN 6

Definition at line 30 of file localres.h.

#define INDEX_THUNDER 11

Definition at line 35 of file localres.h.

#define INDEX_WORLD 10

Definition at line 34 of file localres.h.

Generated on Wed Nov 13 2024 16:54:37 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Ppgeext/ppgeext.Cpp File Reference

  • SysMgmt
  • MMC
  • Ppgeext
Defines | Functions

ppgeext.Cpp File Reference

#include "PPgeExt.h"
#include "resource.h"
#include "globals.h"
#include <crtdbg.h>

Go to the source code of this file.

Defines

#define | _T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")
#define | _T_CCF_NODETYPE _T("CCF_NODETYPE")
#define | _T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")

Functions

STDMETHODIMP_ (ULONG) CPropSheetExtension

Define Documentation

#define _T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")

Definition at line 26 of file ppgeext.Cpp.

#define _T_CCF_NODETYPE _T("CCF_NODETYPE")

Definition at line 27 of file ppgeext.Cpp.

#define _T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")

Definition at line 28 of file ppgeext.Cpp.

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 77 of file ppgeext.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        // we need to decrement our object count in the DLL
        delete this;
        return 0;
    }

    return m_cref;
}

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Ppgeext/ppgeext.h File Reference

  • SysMgmt
  • MMC
  • Ppgeext
Classes

ppgeext.h File Reference

#include <tchar.h>
#include <mmc.h>

Go to the source code of this file.

Classes

class CPropSheetExtension
Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Ppgeext/registry.Cpp File Reference

  • SysMgmt
  • MMC
  • Ppgeext
Functions | Variables

registry.Cpp File Reference

#include <objbase.h>
#include <assert.h>
#include "Registry.h"
#include "Extend.h"
#include "GUIDs.h"
#include "globals.h"

Go to the source code of this file.

Functions

LONG | recursiveDeleteKey (HKEY hKeyParent, const _TCHAR *szKeyChild)
HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const _TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const _TCHAR *szNameString, const CLSID &clsidAbout)
BOOL | setKeyAndValue (const _TCHAR *pszPath, const _TCHAR *szSubkey, const _TCHAR *szValue)
BOOL | setSnapInExtensionNode (const _TCHAR *szSnapID, const _TCHAR *szNodeID, const _TCHAR *szDescription)
BOOL | setSnapInKeyAndValue (const _TCHAR *szKey, const _TCHAR *szSubkey, const _TCHAR *szName, const _TCHAR *szValue)
BOOL | setValue (const _TCHAR *szKey, const _TCHAR *szValueName, const _TCHAR *szValue)
LONG | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Variables

EXTENSION_NODE _ExtendableNodes []
EXTENDER_NODE _NodeExtensions []

Function Documentation

LONG recursiveDeleteKey | ( | HKEY | hKeyParent,
 |  | const _TCHAR * | szKeyChild
 | ) |  |

Definition at line 337 of file registry.Cpp.

{
    // Open the child.
    HKEY hKeyChild ;
    LONG lRes = RegOpenKeyEx(hKeyParent, lpszKeyChild, 0,
        KEY_ALL_ACCESS, &hKeyChild) ;
    if (lRes != ERROR_SUCCESS)
    {
        return lRes ;
    }

    // Enumerate all of the decendents of this child.
    FILETIME time ;
    _TCHAR szBuffer[256] ;
    DWORD dwSize = 256 ;
    while (RegEnumKeyEx(hKeyChild, 0, szBuffer, &dwSize, NULL,
        NULL, NULL, &time) == S_OK)
    {
        // Delete the decendents of this child.
        lRes = recursiveDeleteKey(hKeyChild, szBuffer) ;
        if (lRes != ERROR_SUCCESS)
        {
            // Cleanup before exiting.
            RegCloseKey(hKeyChild) ;
            return lRes;
        }
        dwSize = 256 ;
    }

    // Close the child.
    RegCloseKey(hKeyChild) ;

    // Delete this child.
    return RegDeleteKey(hKeyParent, lpszKeyChild) ;
}

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const _TCHAR * | szFriendlyName
 | ) |  |

Definition at line 93 of file registry.Cpp.

{
    // Get server location.
    _TCHAR szModule[512] ;
    DWORD dwResult =
        ::GetModuleFileName(hModule,
        szModule,
        sizeof(szModule)/sizeof(_TCHAR)) ;

    assert(dwResult != 0) ;

    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    assert(SUCCEEDED(hr)) ;

    MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;
        _tcscat(szKey, pszCLSID) ;

    // Add the CLSID to the registry.
    setKeyAndValue(szKey, NULL, szFriendlyName) ;

    // Add the server filename subkey under the CLSID key.
    setKeyAndValue(szKey, _T("InprocServer32"), szModule) ;

    // set the threading model
    _tcscat(szKey, _T("\\InprocServer32"));
    setValue(szKey, _T("ThreadingModel"), _T("Apartment"));

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const _TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout
 | ) |  |

Definition at line 166 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    LPOLESTR wszAboutCLSID = NULL;
    LPOLESTR wszExtendCLSID = NULL;
    LPOLESTR wszNodeCLSID = NULL;
    EXTENSION_NODE *pExtensionNode;
    EXTENDER_NODE *pNodeExtension;
    _TCHAR szKeyBuf[1024] ;
    HKEY hKey;

    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    if (IID_NULL != clsidAbout)
        hr = StringFromCLSID(clsidAbout, &wszAboutCLSID);

    MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);
    MAKE_TSTRPTR_FROMWIDE(pszAboutCLSID, wszAboutCLSID);

    // Add the CLSID to the registry.
    setSnapInKeyAndValue(pszCLSID, NULL, _T("NameString"), szNameString) ;

#ifdef STANDALONE
    setSnapInKeyAndValue(pszCLSID, _T("StandAlone"), NULL, NULL);
#endif

    if (IID_NULL != clsidAbout)
        setSnapInKeyAndValue(pszCLSID, NULL, _T("About"), pszAboutCLSID);

    // register each of the node types in _ExtendableNodes as an extendable node
    for (pExtensionNode = &(_ExtendableNodes[0]);*pExtensionNode->szDescription;pExtensionNode++)
    {
        hr = StringFromCLSID(pExtensionNode->GUID, &wszExtendCLSID);
        MAKE_TSTRPTR_FROMWIDE(pszExtendCLSID, wszExtendCLSID);
        setSnapInExtensionNode(pszCLSID, pszExtendCLSID, pExtensionNode->szDescription);
        CoTaskMemFree(wszExtendCLSID);
    }

    // register each of the node extensions
    for (pNodeExtension = &(_NodeExtensions[0]);*pNodeExtension->szDescription;pNodeExtension++)
    {
        hr = StringFromCLSID(pNodeExtension->guidNode, &wszExtendCLSID);
        MAKE_TSTRPTR_FROMWIDE(pszExtendCLSID, wszExtendCLSID);
        _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\NodeTypes\\"));
        _tcscat(szKeyBuf, pszExtendCLSID);

        switch (pNodeExtension->eType) {
        case NameSpaceExtension:
            _tcscat(szKeyBuf, _T("\\Extensions\\NameSpace"));
            break;
        case ContextMenuExtension:
            _tcscat(szKeyBuf, _T("\\Extensions\\ContextMenu"));
            break;
        case ToolBarExtension:
            _tcscat(szKeyBuf, _T("\\Extensions\\ToolBar"));
            break;
        case PropertySheetExtension:
            _tcscat(szKeyBuf, _T("\\Extensions\\PropertySheet"));
            break;
        case TaskExtension:
            _tcscat(szKeyBuf, _T("\\Extensions\\Task"));
            break;
        case DynamicExtension:
            _tcscat(szKeyBuf, _T("\\Dynamic Extensions"));
        default:
            break;
        }

        // Create and open key and subkey.
        long lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE ,
            szKeyBuf,
            0, NULL, REG_OPTION_NON_VOLATILE,
            KEY_ALL_ACCESS, NULL,
            &hKey, NULL) ;

        if (lResult != ERROR_SUCCESS)
        {
            return FALSE ;
        }

        hr = StringFromCLSID(pNodeExtension->guidExtension, &wszNodeCLSID);
        assert(SUCCEEDED(hr));

        MAKE_TSTRPTR_FROMWIDE(pszNodeCLSID, wszNodeCLSID);
        // Set the Value.
        if (pNodeExtension->szDescription != NULL)
        {
            RegSetValueEx(hKey, pszNodeCLSID, 0, REG_SZ,
                (BYTE *)pNodeExtension->szDescription,
                (_tcslen(pNodeExtension->szDescription)+1)*sizeof(_TCHAR)) ;
        }

        RegCloseKey(hKey) ;

        CoTaskMemFree(wszExtendCLSID);
        CoTaskMemFree(wszNodeCLSID);
    }

    // Free memory.
    CoTaskMemFree(wszCLSID) ;
    if (IID_NULL != clsidAbout)
        CoTaskMemFree(wszAboutCLSID);

    return S_OK ;
}

BOOL setKeyAndValue | ( | const _TCHAR * | pszPath,
 |  | const _TCHAR * | szSubkey,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 379 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Copy keyname into buffer.
    _tcscpy(szKeyBuf, szKey) ;

    // Add subkey name to buffer.
    if (szSubkey != NULL)
    {
        _tcscat(szKeyBuf, _T("\\")) ;
        _tcscat(szKeyBuf, szSubkey ) ;
    }

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, NULL, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

BOOL setSnapInExtensionNode | ( | const _TCHAR * | szSnapID,
 |  | const _TCHAR * | szNodeID,
 |  | const _TCHAR * | szDescription
 | ) |  |

Definition at line 505 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szSnapNodeKeyBuf[1024] ;
    _TCHAR szMMCNodeKeyBuf[1024];

    // Load the buffer with the Snap-In Location
    _tcscpy(szSnapNodeKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns\\"));
    // add in the clisid into buffer.
    _tcscat(szSnapNodeKeyBuf, szSnapID) ;
    _tcscat(szSnapNodeKeyBuf, _T("\\NodeTypes\\"));
    _tcscat(szSnapNodeKeyBuf, szNodeID) ;

    // Load the buffer with the NodeTypes Location
    _tcscpy(szMMCNodeKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\NodeTypes\\"));
    _tcscat(szMMCNodeKeyBuf, szNodeID) ;

    // Create and open the Snapin Key.
    long lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE ,
        szSnapNodeKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szDescription != NULL)
    {
        RegSetValueEx(hKey, NULL, 0, REG_SZ,
            (BYTE *)szDescription,
            (_tcslen(szDescription)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;

    // Create and open the NodeTypes Key.
    lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE ,
        szMMCNodeKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szDescription != NULL)
    {
        RegSetValueEx(hKey, NULL, 0, REG_SZ,
            (BYTE *)szDescription,
            (_tcslen(szDescription)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;

    return TRUE ;
}

BOOL setSnapInKeyAndValue | ( | const _TCHAR * | szKey,
 |  | const _TCHAR * | szSubkey,
 |  | const _TCHAR * | szName,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 460 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\")) ;
    _tcscat(szKeyBuf, szKey) ;

    // Add subkey name to buffer.
    if (szSubkey != NULL)
    {
        _tcscat(szKeyBuf, _T("\\")) ;
        _tcscat(szKeyBuf, szSubkey ) ;
    }

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, szName, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

BOOL setValue | ( | const _TCHAR * | szKey,
 |  | const _TCHAR * | szValueName,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 422 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Copy keyname into buffer.
    _tcscpy(szKeyBuf, szKey) ;

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, szValueName, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

LONG UnregisterServer ( const CLSID & clsid )

Definition at line 138 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

    MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
    _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
               (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 281 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
        MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);
    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
               (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

  //Uncomment following for loop to unregister all extendable node types
  //Note that if a snap-in's extendable node types are unregistered,
  //any extension snap-ins for these node types will have to be re-registered
  //in order to rebuild their entries under the SOFTWARE\Microsoft\MMC\NodeTypes key

/*
    // Unregister each of the node types in _ExtendableNodes as an extendable node
  // Note that this snap-in does not register any extendable node types

    EXTENSION_NODE *pNode;
  LPOLESTR wszExtendCLSID = NULL;

    for (pNode = &(_ExtendableNodes[0]);*pNode->szDescription;pNode++)
    {
        hr = StringFromCLSID(pNode->GUID, &wszExtendCLSID);
        MAKE_TSTRPTR_FROMWIDE(pszExtendCLSID, wszExtendCLSID);

        // Load the buffer with the Snap-In Location
        _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\NodeTypes\\"));
        // Copy keyname into buffer.
        _tcscat(szKeyBuf, pszExtendCLSID);
        recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
        CoTaskMemFree(wszExtendCLSID);
    }

*/

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Variable Documentation

EXTENSION_NODE _ExtendableNodes[]
Initial value:
 {
    {NULL, NULL}
}

Definition at line 32 of file registry.Cpp.

EXTENDER_NODE _NodeExtensions[]
Initial value:
 {
    {PropertySheetExtension,
    {0x29743811, 0x4c4b, 0x11d2, { 0x89, 0xd8, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28}},
    {0xcfcdc9f3, 0xc50e, 0x11d2, {0x95, 0x2b, 0x0, 0xc0, 0x4f, 0xb9, 0x2e, 0xc2}},
    _T("Extension to the Rocket Node")},

    {DummyExtension,
    NULL,
    NULL,
    NULL}
}

Definition at line 37 of file registry.Cpp.

Generated on Wed Nov 13 2024 16:53:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Ppgeext/registry.h File Reference

  • SysMgmt
  • MMC
  • Ppgeext
Functions

registry.h File Reference

#include <tchar.h>

Go to the source code of this file.

Functions

HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const _TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const _TCHAR *szNameString, const CLSID &clsidAbout)
HRESULT | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Function Documentation

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const _TCHAR * | szFriendlyName
 | ) |  |

Definition at line 67 of file registry.Cpp.

{
    // Get server location.
    _TCHAR szModule[512] ;
    DWORD dwResult =
        ::GetModuleFileName(hModule,
        szModule,
        sizeof(szModule)/sizeof(_TCHAR)) ;

    assert(dwResult != 0) ;

    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    assert(SUCCEEDED(hr)) ;

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;
  _tcscat(szKey, pszCLSID) ;

    // Add the CLSID to the registry.
    setKeyAndValue(szKey, NULL, szFriendlyName) ;

    // Add the server filename subkey under the CLSID key.
    setKeyAndValue(szKey, _T("InprocServer32"), szModule) ;

    // set the threading model
    _tcscat(szKey, _T("\\InprocServer32"));
    setValue(szKey, _T("ThreadingModel"), _T("Apartment"));

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const _TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout
 | ) |  |

Definition at line 147 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    LPOLESTR wszAboutCLSID = NULL;
    LPOLESTR wszExtendCLSID = NULL;
    NODESTRUCT *pNode;

    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    if (IID_NULL != clsidAbout)
        hr = StringFromCLSID(clsidAbout, &wszAboutCLSID);

    MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);
    MAKE_TSTRPTR_FROMWIDE(pszAboutCLSID, wszAboutCLSID);

    // Add the CLSID to the registry.
    setSnapInKeyAndValue(pszCLSID, NULL, _T("NameString"), szNameString) ;
    setSnapInKeyAndValue(pszCLSID, _T("StandAlone"), NULL, NULL);
    if (IID_NULL != clsidAbout)
        setSnapInKeyAndValue(pszCLSID, NULL, _T("About"), pszAboutCLSID);

    // register each of the node types in g_Nodes as an extendable node
    for (pNode = &(g_Nodes[0]);*pNode->szDescription;pNode++)
    {
        hr = StringFromCLSID(pNode->GUID, &wszExtendCLSID);
        MAKE_TSTRPTR_FROMWIDE(pszExtendCLSID, wszExtendCLSID);
        setSnapInExtensionNode(pszCLSID, pszExtendCLSID, pNode->szDescription);
        CoTaskMemFree(wszExtendCLSID);
    }

    // Free memory.
    CoTaskMemFree(wszCLSID) ;
    if (IID_NULL != clsidAbout)
        CoTaskMemFree(wszAboutCLSID);

    return S_OK ;
}

HRESULT UnregisterServer ( const CLSID & clsid )

Definition at line 112 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

  MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
  _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 184 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Generated on Wed Nov 13 2024 16:53:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Ppgeext/resource.h File Reference

  • SysMgmt
  • MMC
  • Ppgeext
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | COMBO1 40031
#define | EDIT1 40027
#define | EDIT2 40028
#define | EDIT3 40029
#define | EDIT4 40030
#define | ID_BUTTON40016 40016
#define | ID_BUTTON40017 40017
#define | ID_BUTTON40018 40018
#define | ID_BUTTON40019 40019
#define | ID_BUTTON40020 40020
#define | ID_BUTTON40021 40021
#define | ID_BUTTON40022 40022
#define | ID_BUTTON40023 40023
#define | ID_BUTTON40024 40024
#define | ID_BUTTON40025 40025
#define | ID_BUTTON40026 40026
#define | IDB_BIKE 40007
#define | IDB_BIKE2 40011
#define | IDB_CAR 40005
#define | IDB_CAR2 40009
#define | IDB_CLOSED 40014
#define | IDB_CLOSED2 40012
#define | IDB_LGBMP 126
#define | IDB_OPEN 40015
#define | IDB_OPEN2 40013
#define | IDB_PLANE 40006
#define | IDB_PLANE2 40010
#define | IDB_ROCKET 40004
#define | IDB_ROCKET2 40008
#define | IDB_SMBMP 125
#define | IDB_SMOPEN 124
#define | IDD_PROPPAGE_LARGE 10
#define | IDI_ICON1 108
#define | IDI_PSI_ROCKET 114
#define | IDR_LGICONS 121
#define | IDR_SMICONS 120
#define | IDS_ABOUTNAME 9
#define | IDS_HELPFILE 1
#define | IDS_NAME 3
#define | IDS_PST_ROCKET_EXT 10
#define | IDS_SNAPINDESC 2
#define | IDS_SNAPINNAME 6

Define Documentation

#define COMBO1 40031

Definition at line 46 of file resource.h.

#define EDIT1 40027

Definition at line 42 of file resource.h.

#define EDIT2 40028

Definition at line 43 of file resource.h.

#define EDIT3 40029

Definition at line 44 of file resource.h.

#define EDIT4 40030

Definition at line 45 of file resource.h.

#define ID_BUTTON40016 40016

Definition at line 31 of file resource.h.

#define ID_BUTTON40017 40017

Definition at line 32 of file resource.h.

#define ID_BUTTON40018 40018

Definition at line 33 of file resource.h.

#define ID_BUTTON40019 40019

Definition at line 34 of file resource.h.

#define ID_BUTTON40020 40020

Definition at line 35 of file resource.h.

#define ID_BUTTON40021 40021

Definition at line 36 of file resource.h.

#define ID_BUTTON40022 40022

Definition at line 37 of file resource.h.

#define ID_BUTTON40023 40023

Definition at line 38 of file resource.h.

#define ID_BUTTON40024 40024

Definition at line 39 of file resource.h.

#define ID_BUTTON40025 40025

Definition at line 40 of file resource.h.

#define ID_BUTTON40026 40026

Definition at line 41 of file resource.h.

#define IDB_BIKE 40007

Definition at line 22 of file resource.h.

#define IDB_BIKE2 40011

Definition at line 26 of file resource.h.

#define IDB_CAR 40005

Definition at line 20 of file resource.h.

#define IDB_CAR2 40009

Definition at line 24 of file resource.h.

#define IDB_CLOSED 40014

Definition at line 29 of file resource.h.

#define IDB_CLOSED2 40012

Definition at line 27 of file resource.h.

#define IDB_LGBMP 126

Definition at line 18 of file resource.h.

#define IDB_OPEN 40015

Definition at line 30 of file resource.h.

#define IDB_OPEN2 40013

Definition at line 28 of file resource.h.

#define IDB_PLANE 40006

Definition at line 21 of file resource.h.

#define IDB_PLANE2 40010

Definition at line 25 of file resource.h.

#define IDB_ROCKET 40004

Definition at line 19 of file resource.h.

#define IDB_ROCKET2 40008

Definition at line 23 of file resource.h.

#define IDB_SMBMP 125

Definition at line 17 of file resource.h.

#define IDB_SMOPEN 124

Definition at line 16 of file resource.h.

#define IDD_PROPPAGE_LARGE 10

Definition at line 10 of file resource.h.

#define IDI_ICON1 108

Definition at line 12 of file resource.h.

#define IDI_PSI_ROCKET 114

Definition at line 13 of file resource.h.

#define IDR_LGICONS 121

Definition at line 15 of file resource.h.

#define IDR_SMICONS 120

Definition at line 14 of file resource.h.

#define IDS_ABOUTNAME 9

Definition at line 9 of file resource.h.

#define IDS_HELPFILE 1

Definition at line 5 of file resource.h.

#define IDS_NAME 3

Definition at line 7 of file resource.h.

#define IDS_PST_ROCKET_EXT 10

Definition at line 11 of file resource.h.

#define IDS_SNAPINDESC 2

Definition at line 6 of file resource.h.

#define IDS_SNAPINNAME 6

Definition at line 8 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Proppage/about.Cpp File Reference

  • SysMgmt
  • MMC
  • Proppage
Functions

about.Cpp File Reference

#include "About.h"
#include "resource.h"
#include "globals.h"
#include <crtdbg.h>

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CSnapinAbout

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 89 of file about.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        // we need to decrement our object count in the DLL
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:54:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Proppage/about.h File Reference

  • SysMgmt
  • MMC
  • Proppage
Classes

about.h File Reference

#include <tchar.h>
#include <mmc.h>

Go to the source code of this file.

Classes

class CSnapinAbout
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Proppage/basesnap.Cpp File Reference

  • SysMgmt
  • MMC
  • Proppage
Functions | Variables

basesnap.Cpp File Reference

#include <objbase.h>
#include <olectl.h>
#include <initguid.h>
#include "guids.h"
#include "basesnap.h"
#include "Comp.h"
#include "CompData.h"
#include "About.h"
#include "Registry.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)
BOOL WINAPI | DllMain (HINSTANCE hinstDLL, DWORD fdwReason, void *lpvReserved)
STDAPI | DllRegisterServer ()
STDAPI | DllUnregisterServer ()
STDMETHODIMP_ (ULONG) CClassFactory

Variables

HINSTANCE | g_hinst

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 77 of file basesnap.Cpp.

{
    if (g_uObjects == 0 && g_uSrvLock == 0)
        return S_OK;
    else
        return S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 45 of file basesnap.Cpp.

{
    if ((rclsid != CLSID_CComponentData) && (rclsid != CLSID_CSnapinAbout))
        return CLASS_E_CLASSNOTAVAILABLE;

    if (!ppvObj)
        return E_FAIL;

    *ppvObj = NULL;

    // We can only hand out IUnknown and IClassFactory pointers.  Fail
    // if they ask for anything else.
    if (!IsEqualIID(riid, IID_IUnknown) && !IsEqualIID(riid, IID_IClassFactory))
        return E_NOINTERFACE;

    CClassFactory *pFactory = NULL;

    // make the factory passing in the creation function for the type of object they want
    if (rclsid == CLSID_CComponentData)
        pFactory = new CClassFactory(CClassFactory::COMPONENT);
    else if (rclsid == CLSID_CSnapinAbout)
        pFactory = new CClassFactory(CClassFactory::ABOUT);

    if (NULL == pFactory)
        return E_OUTOFMEMORY;

    HRESULT hr = pFactory->QueryInterface(riid, ppvObj);

    return hr;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hinstDLL,
 |  | DWORD | fdwReason,
 |  | void * | lpvReserved
 | ) |  |

Definition at line 32 of file basesnap.Cpp.

{

    if (fdwReason == DLL_PROCESS_ATTACH) {
        g_hinst = hinstDLL;
    }

    return TRUE;
}

STDAPI DllRegisterServer ( void )

Definition at line 187 of file basesnap.Cpp.

{
    HRESULT hr = SELFREG_E_CLASS;
    _TCHAR szName[256];
    _TCHAR szSnapInName[256];

    LoadString(g_hinst, IDS_NAME, szName, (sizeof szName)/(sizeof szName[0]));
    LoadString(g_hinst, IDS_SNAPINNAME, szSnapInName, (sizeof szSnapInName)/(sizeof szSnapInName[0]));

    _TCHAR szAboutName[256];

    LoadString(g_hinst, IDS_ABOUTNAME, szAboutName, (sizeof szAboutName)/(sizeof szAboutName[0]));

    // register our CoClasses
    hr = RegisterServer(g_hinst,
        CLSID_CComponentData,
        szName);

    if SUCCEEDED(hr)
        hr = RegisterServer(g_hinst,
        CLSID_CSnapinAbout,
        szAboutName);

    // place the registry information for SnapIns
    if SUCCEEDED(hr)
        hr = RegisterSnapin(CLSID_CComponentData, szSnapInName, CLSID_CSnapinAbout, FALSE);

    return hr;
}

STDAPI DllUnregisterServer ( void )

Definition at line 218 of file basesnap.Cpp.

{
    if (UnregisterServer(CLSID_CComponentData) == S_OK)
        return UnregisterSnapin(CLSID_CComponentData);
    else
        return E_FAIL;
}

STDMETHODIMP_ ( ULONG )

Definition at line 124 of file basesnap.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;
}

Variable Documentation

HINSTANCE g_hinst

Definition at line 30 of file basesnap.Cpp.

Generated on Wed Nov 13 2024 16:54:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Proppage/basesnap.h File Reference

  • SysMgmt
  • MMC
  • Proppage
Classes | Functions | Variables

basesnap.h File Reference

Go to the source code of this file.

Classes

class | CClassFactory

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)

Variables

ULONG | g_uObjects = 0
ULONG | g_uSrvLock = 0

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 53 of file ComSpyAudit.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 61 of file ComSpyAudit.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

Variable Documentation

ULONG g_uObjects = 0

Definition at line 24 of file basesnap.h.

ULONG g_uSrvLock = 0

Definition at line 25 of file basesnap.h.

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Proppage/comp.Cpp File Reference

  • SysMgmt
  • MMC
  • Proppage
Functions

comp.Cpp File Reference

#include "Comp.h"
#include "DataObj.h"
#include <commctrl.h>
#include <crtdbg.h>
#include "globals.h"
#include "resource.h"
#include "DeleBase.h"
#include "CompData.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CComponent

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 73 of file comp.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Proppage/comp.h File Reference

  • SysMgmt
  • MMC
  • Proppage
Classes

comp.h File Reference

#include <mmc.h>

Go to the source code of this file.

Classes

class CComponent
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Proppage/compdata.Cpp File Reference

  • SysMgmt
  • MMC
  • Proppage
Functions

compdata.Cpp File Reference

#include "Comp.h"
#include "CompData.h"
#include "DataObj.h"
#include "resource.h"
#include <crtdbg.h>

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CComponentData

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 79 of file compdata.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        // we need to decrement our object count in the DLL
        delete this;
        return 0;
    }

    return m_cref;
}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Proppage/compdata.h File Reference

  • SysMgmt
  • MMC
  • Proppage
Classes

compdata.h File Reference

#include <mmc.h>
#include "DeleBase.h"
#include "StatNode.h"
#include "Comp.h"
#include "DeleBase.h"
#include "StatNode.h"

Go to the source code of this file.

Classes

class CComponentData
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Proppage/dataobj.Cpp File Reference

  • SysMgmt
  • MMC
  • Proppage
Defines | Functions

dataobj.Cpp File Reference

#include "DataObj.h"
#include "guids.h"
#include "DeleBase.h"

Go to the source code of this file.

Defines

#define | _T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")
#define | _T_CCF_INTERNAL_SNAPIN _T("{2479DB32-5276-11d2-94F5-00C04FB92EC2}")
#define | _T_CCF_NODETYPE _T("CCF_NODETYPE")
#define | _T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")
#define | _T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")

Functions

CDataObject * | GetOurDataObject (LPDATAOBJECT lpDataObject)
STDMETHODIMP_ (ULONG) CDataObject

Define Documentation

#define _T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")

Definition at line 31 of file dataobj.Cpp.

#define _T_CCF_INTERNAL_SNAPIN _T("{2479DB32-5276-11d2-94F5-00C04FB92EC2}")

Definition at line 36 of file dataobj.Cpp.

#define _T_CCF_NODETYPE _T("CCF_NODETYPE")

Definition at line 32 of file dataobj.Cpp.

#define _T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")

Definition at line 34 of file dataobj.Cpp.

#define _T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")

Definition at line 33 of file dataobj.Cpp.

Function Documentation

CDataObject* GetOurDataObject ( LPDATAOBJECT lpDataObject )

Definition at line 165 of file dataobj.Cpp.

{
    HRESULT       hr      = S_OK;
    CDataObject *pSDO     = NULL;

  // check to see if the data object is a special data object.
  if ( IS_SPECIAL_DATAOBJECT (lpDataObject) )
  {
    //Code for handling a special data object goes here.

    //Note that the MMC SDK samples do not handle
    //special data objects, so we exit if we get one.
    return NULL;
  }

    STGMEDIUM stgmedium = { TYMED_HGLOBAL,  NULL  };
    FORMATETC formatetc = { CDataObject::s_cfInternal, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };

    // Allocate memory for the stream
    stgmedium.hGlobal = GlobalAlloc( GMEM_SHARE, sizeof(CDataObject *));

    if (!stgmedium.hGlobal)     {
        hr = E_OUTOFMEMORY;
    }

    if SUCCEEDED(hr)
        // Attempt to get data from the object
        hr = lpDataObject->GetDataHere( &formatetc, &stgmedium );

    // stgmedium now has the data we need
    if (SUCCEEDED(hr))  {
        pSDO = *(CDataObject **)(stgmedium.hGlobal);
    }

    // if we have memory free it
    if (stgmedium.hGlobal)
        GlobalFree(stgmedium.hGlobal);

    return pSDO;

} // end GetOurDataObject()

STDMETHODIMP_ ( ULONG )

Definition at line 87 of file dataobj.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Proppage/dataobj.h File Reference

  • SysMgmt
  • MMC
  • Proppage
Classes | Functions

dataobj.h File Reference

#include <mmc.h>
#include "DeleBase.h"

Go to the source code of this file.

Classes

class | CDataObject

Functions

HRESULT | ExtractFromDataObject (IDataObject *lpDataObject, UINT cf, ULONG cb, HGLOBAL *phGlobal)
CDataObject * | GetOurDataObject (IDataObject *lpDataObject)
BOOL | IsMMCMultiSelectDataObject (IDataObject *lpDataObject)

Function Documentation

HRESULT ExtractFromDataObject | ( | IDataObject * | lpDataObject,
 |  | UINT | cf,
 |  | ULONG | cb,
 |  | HGLOBAL * | phGlobal
 | ) |  |
CDataObject* GetOurDataObject ( IDataObject * lpDataObject )
BOOL IsMMCMultiSelectDataObject ( IDataObject * lpDataObject )
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Proppage/delebase.Cpp File Reference

  • SysMgmt
  • MMC
  • Proppage

delebase.Cpp File Reference

#include "DeleBase.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Proppage/delebase.h File Reference

  • SysMgmt
  • MMC
  • Proppage
Classes

delebase.h File Reference

#include <mmc.h>
#include <crtdbg.h>
#include "globals.h"
#include "resource.h"
#include "LocalRes.h"
#include "LocalRes.h"

Go to the source code of this file.

Classes

class CDelegationBase
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Proppage/globals.h File Reference

  • SysMgmt
  • MMC
  • Proppage
Classes | Defines | Functions | Variables

globals.h File Reference

#include <tchar.h>

Go to the source code of this file.

Classes

class | TempBuffer

Defines

#define | IDM_BUTTON1 0x100
#define | IDM_BUTTON2 0x101
#define | MAKE_TSTRPTR_FROMWIDE(ptrname, widestr)
#define | MAKE_WIDEPTR_FROMTSTR(ptrname, tstr)
#define | MAKE_WIDEPTR_FROMTSTR_ALLOC(ptrname, tstr)
#define | OBJECT_CREATED InterlockedIncrement((long *)&g_uObjects);
#define | OBJECT_DESTROYED InterlockedDecrement((long *)&g_uObjects);

Functions

void | MMCN_Crack (BOOL bComponentData, IDataObject *pDataObject, IComponentData *pCompData, IComponent *pComp, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)

Variables

HINSTANCE | g_hinst
ULONG g_uObjects

Define Documentation

#define IDM_BUTTON1 0x100

Definition at line 25 of file globals.h.

#define IDM_BUTTON2 0x101

Definition at line 26 of file globals.h.

#define MAKE_TSTRPTR_FROMWIDE | ( | ptrname,
 |  | widestr
 | ) |
Value:
long __l##ptrname = (wcslen(widestr) + 1) * 2 * sizeof(TCHAR); \
    TempBuffer __TempBuffer##ptrname(__l##ptrname); \
    WideCharToMultiByte(CP_ACP, 0, widestr, -1, (LPSTR)__TempBuffer##ptrname.GetBuffer(), __l##ptrname, NULL, NULL); \
    LPTSTR ptrname = (LPTSTR)__TempBuffer##ptrname.GetBuffer()

Definition at line 127 of file globals.h.

#define MAKE_WIDEPTR_FROMTSTR | ( | ptrname,
 |  | tstr
 | ) |
Value:
long __cch##ptrname = (lstrlenA(tstr) + 1);\
    long __l##ptrname = (lstrlenA(tstr) + 1) * sizeof(WCHAR); \
    TempBuffer __TempBuffer##ptrname(__l##ptrname); \
    MultiByteToWideChar(CP_ACP, 0, tstr, -1, (LPWSTR)__TempBuffer##ptrname.GetBuffer(), __cch##ptrname); \
    LPWSTR ptrname = (LPWSTR)__TempBuffer##ptrname.GetBuffer()

Definition at line 93 of file globals.h.

#define MAKE_WIDEPTR_FROMTSTR_ALLOC | ( | ptrname,
 |  | tstr
 | ) |
Value:
long __cch##ptrname = (lstrlenA(tstr) + 1);\
    long __l##ptrname = (lstrlenA(tstr) + 1) * sizeof(WCHAR); \
    LPWSTR ptrname = (LPWSTR)CoTaskMemAlloc(__l##ptrname); \
    MultiByteToWideChar(CP_ACP, 0, tstr, -1, ptrname, __cch##ptrname)

Definition at line 107 of file globals.h.

#define OBJECT_CREATED InterlockedIncrement((long *)&g_uObjects);

Definition at line 31 of file globals.h.

#define OBJECT_DESTROYED InterlockedDecrement((long *)&g_uObjects);

Definition at line 32 of file globals.h.

Function Documentation

void MMCN_Crack | ( | BOOL | bComponentData,
 |  | IDataObject * | pDataObject,
 |  | IComponentData * | pCompData,
 |  | IComponent * | pComp,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param
 | ) |  |

Definition at line 59 of file mmccrack.Cpp.

{
#ifdef MMC_CRACK_MESSAGES
        const size_t cchMessage = 256;
  TCHAR message[cchMessage] = {0};

  if (bComponentData == TRUE)
    OutputDebugString(_T("IComponentData::Notify( "));
  else
    OutputDebugString(_T("IComponent::Notify( "));

  wsprintf(message, _T("DataObject: %08x, CompData: %08x, Comp: %08x ) - "), pDataObject, pCompData, pComp);
  OutputDebugString(message);

    switch (event)  {
    case MMCN_ACTIVATE:
      wsprintf(message, _T("MMCN_ACTIVATE\n\tActivate: %d\n"), arg);
      break;

    case MMCN_ADD_IMAGES:
      wsprintf(message, _T("MMCN_ADD_IMAGES\n\tImage List: %08x\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_BTN_CLICK:
      wsprintf(message, _T("MMCN_BTN_CLICK\n\tVerb: %ws\n"), MMCN_CrackVerb((MMC_CONSOLE_VERB)param));
      break;

    case MMCN_COLUMN_CLICK:
      wsprintf(message, _T("MMCN_COLUMN_CLICK\n\tColumn: %d\n\tSort Option: %d\n"), arg,   param);
      break;

    case MMCN_COLUMNS_CHANGED:
      wsprintf(message, _T("MMCN_COLUMNS_CHANGED\n"));
      break;

    case MMCN_CONTEXTHELP:
      wsprintf(message, _T("MMCN_CONTEXTHELP\n"));
      break;

    case MMCN_CONTEXTMENU:
      wsprintf(message, _T("MMCN_CONTEXTMENU\n"));
      break;

    case MMCN_CUTORMOVE:
      wsprintf(message, _T("MMCN_CUTORMOVE\n"));
      break;

    case MMCN_DBLCLICK:
      wsprintf(message, _T("MMCN_DBLCLICK\n"));
      break;

    case MMCN_DELETE:
      wsprintf(message, _T("MMCN_DELETE\n"));
      break;

    case MMCN_DESELECT_ALL:
      wsprintf(message, _T("MMCN_DESELECT_ALL\n"));
      break;

    case MMCN_EXPAND:
      wsprintf(message, _T("MMCN_EXPAND\n\tExpand: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_EXPANDSYNC:
      wsprintf(message, _T("MMCN_EXPANDSYNC\n"));
      break;

    case MMCN_FILTERBTN_CLICK:
      wsprintf(message, _T("MMCN_FILTERBTN_CLICK\n\tColumn: %d\n"), arg);
      break;

    case MMCN_FILTER_CHANGE:
      wsprintf(message, _T("MMCN_FILTER_CHANGE\n\tColumn: %d\n"), param);
      break;

    case MMCN_HELP:
      wsprintf(message, _T("MMCN_HELP\n"));
      break;

    case MMCN_INITOCX:
      wsprintf(message, _T("MMCN_INITOCX\n\tIUnknown: %08x\n"), param);
      break;

    case MMCN_LISTPAD:
      wsprintf(message, _T("MMCN_LISTPAD\n\tConnect: %d\n"), arg);
      break;

    case MMCN_MENU_BTNCLICK:
      wsprintf(message, _T("MMCN_MENU_BTNCLICK\n"));
      break;

    case MMCN_MINIMIZED:
      wsprintf(message, _T("MMCN_MINIMIZED\n\tMinimized: %d\n"), arg);
      break;

    case MMCN_PASTE:
      wsprintf(message, _T("MMCN_PASTE\n\tCopy: %d\n"), param == NULL);
      break;

    case MMCN_PRELOAD:
      wsprintf(message, _T("MMCN_PRELOAD\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_PRINT:
      wsprintf(message, _T("MMCN_PRINT\n"));
      break;

    case MMCN_PROPERTY_CHANGE:
      wsprintf(message, _T("MMCN_PROPERTY_CHANGE\n\tScope: %d\n\tArg: %08x\n"), arg, param);
      break;

    case MMCN_QUERY_PASTE:
      wsprintf(message, _T("MMCN_QUERY_PASTE\n"));
      break;

    case MMCN_REFRESH:
      wsprintf(message, _T("MMCN_REFRESH\n"));
      break;

    case MMCN_REMOVE_CHILDREN:
      wsprintf(message, _T("MMCN_REMOVE_CHILDREN\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_RENAME:
                        // Destination string may contain a truncation of the ideal result.
                        // (Indicated by return value other than S_OK).
                        // However, it will be null-terminated.
      StringCchPrintf(message, cchMessage, _T("MMCN_RENAME\n\tNew Name: '%ws'\n"), (LPOLESTR)param);
      break;

    case MMCN_RESTORE_VIEW:
      wsprintf(message, _T("MMCN_RESTORE_VIEW\n"));
      break;

    case MMCN_SELECT:
      wsprintf(message, _T("MMCN_SELECT\n\tScope: %d\n\tSelect: %08x\n"), LOWORD(arg), HIWORD(arg));
      break;

    case MMCN_SHOW:
      wsprintf(message, _T("MMCN_SHOW\n\tShow: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_SNAPINHELP:
      wsprintf(message, _T("MMCN_SNAPINHELP\n"));
      break;

    case MMCN_VIEW_CHANGE:
      wsprintf(message, _T("MMCN_VIEW_CHANGE\n\tData: %08x\n\tHint: %08x\n"), arg, param);
      break;
  }

  if (message[0] != 0)
    OutputDebugString(message);
  else
    OutputDebugString(_T("unknown event\n"));

#endif
  return;
}

Variable Documentation

HINSTANCE g_hinst

Definition at line 33 of file SetDisp.h.

ULONG g_uObjects

Definition at line 24 of file basesnap.h.

Generated on Wed Nov 13 2024 16:54:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Proppage/guids.h File Reference

  • SysMgmt
  • MMC
  • Proppage
Functions

guids.h File Reference

Go to the source code of this file.

Functions

DEFINE_GUID (CLSID_CComponentData, 0x6c26b387, 0xe3f7, 0x4a7c, 0xbd, 0x2a, 0xdd, 0x4d, 0x59, 0x6c, 0xde, 0x86)
DEFINE_GUID (CLSID_CSnapinAbout, 0x9e6d45fd, 0xc65d, 0x4d1e, 0x89, 0xa5, 0x81, 0xe3, 0xa8, 0x42, 0xf3, 0xaa)

Function Documentation

DEFINE_GUID | ( | CLSID_CComponentData | ,
 |  | 0x6c26b387 | ,
 |  | 0xe3f7 | ,
 |  | 0x4a7c | ,
 |  | 0xbd | ,
 |  | 0x2a | ,
 |  | 0xdd | ,
 |  | 0x4d | ,
 |  | 0x59 | ,
 |  | 0x6c | ,
 |  | 0xde | ,
 |  | 0x86 |
 | ) |  |
DEFINE_GUID | ( | CLSID_CSnapinAbout | ,
 |  | 0x9e6d45fd | ,
 |  | 0xc65d | ,
 |  | 0x4d1e | ,
 |  | 0x89 | ,
 |  | 0xa5 | ,
 |  | 0x81 | ,
 |  | 0xe3 | ,
 |  | 0xa8 | ,
 |  | 0x42 | ,
 |  | 0xf3 | ,
 |  | 0xaa |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Proppage/land.Cpp File Reference

  • SysMgmt
  • MMC
  • Proppage

land.Cpp File Reference

#include "Land.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Proppage/land.h File Reference

  • SysMgmt
  • MMC
  • Proppage
Classes

land.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class CLandBasedVehicle
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Proppage/localres.h File Reference

  • SysMgmt
  • MMC
  • Proppage
Defines

localres.h File Reference

Go to the source code of this file.

Defines

#define | INDEX_CLOSEDFOLDER 4
#define | INDEX_LANDICON 1
#define | INDEX_NONE -1
#define | INDEX_OPENFOLDER 5
#define | INDEX_PEOPLEICON 3
#define | INDEX_SKYICON 2
#define | INDEX_SPACEICON 0

Define Documentation

#define INDEX_CLOSEDFOLDER 4

Definition at line 27 of file localres.h.

#define INDEX_LANDICON 1

Definition at line 24 of file localres.h.

#define INDEX_NONE -1

Definition at line 22 of file localres.h.

#define INDEX_OPENFOLDER 5

Definition at line 28 of file localres.h.

#define INDEX_PEOPLEICON 3

Definition at line 26 of file localres.h.

#define INDEX_SKYICON 2

Definition at line 25 of file localres.h.

#define INDEX_SPACEICON 0

Definition at line 23 of file localres.h.

Generated on Wed Nov 13 2024 16:54:37 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Proppage/mmccrack.Cpp File Reference

  • SysMgmt
  • MMC
  • Proppage
Defines | Functions

mmccrack.Cpp File Reference

#include <mmc.h>
#include <winuser.h>
#include <tchar.h>
#include "globals.h"
#include <strsafe.h>

Go to the source code of this file.

Defines

#define | STRSAFE_NO_DEPRECATE

Functions

void | MMCN_Crack (BOOL bComponentData, IDataObject *pDataObject, IComponentData *pCompData, IComponent *pComp, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)

Define Documentation

#define STRSAFE_NO_DEPRECATE

Definition at line 25 of file mmccrack.Cpp.

Function Documentation

void MMCN_Crack | ( | BOOL | bComponentData,
 |  | IDataObject * | pDataObject,
 |  | IComponentData * | pCompData,
 |  | IComponent * | pComp,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param
 | ) |  |

Definition at line 59 of file mmccrack.Cpp.

{
#ifdef MMC_CRACK_MESSAGES
        const size_t cchMessage = 256;
        TCHAR message[cchMessage] = {0};

        if (bComponentData == TRUE)
                OutputDebugString(_T("IComponentData::Notify( "));
        else
                OutputDebugString(_T("IComponent::Notify( "));

        wsprintf(message, _T("DataObject: %08x, CompData: %08x, Comp: %08x ) - "), pDataObject, pCompData, pComp);
        OutputDebugString(message);

    switch (event)      {
                case MMCN_ACTIVATE:
                        wsprintf(message, _T("MMCN_ACTIVATE\n\tActivate: %d\n"), arg);
                        break;

                case MMCN_ADD_IMAGES:
                        wsprintf(message, _T("MMCN_ADD_IMAGES\n\tImage List: %08x\n\tScope Item: %08x\n"), arg, param);
                        break;

                case MMCN_BTN_CLICK:
                        wsprintf(message, _T("MMCN_BTN_CLICK\n\tVerb: %ws\n"), MMCN_CrackVerb((MMC_CONSOLE_VERB)param));
                        break;

                case MMCN_COLUMN_CLICK:
                        wsprintf(message, _T("MMCN_COLUMN_CLICK\n\tColumn: %d\n\tSort Option: %d\n"), arg,       param);
                        break;

                case MMCN_COLUMNS_CHANGED:
                        wsprintf(message, _T("MMCN_COLUMNS_CHANGED\n"));
                        break;

                case MMCN_CONTEXTHELP:
                        wsprintf(message, _T("MMCN_CONTEXTHELP\n"));
                        break;

                case MMCN_CONTEXTMENU:
                        wsprintf(message, _T("MMCN_CONTEXTMENU\n"));
                        break;

                case MMCN_CUTORMOVE:
                        wsprintf(message, _T("MMCN_CUTORMOVE\n"));
                        break;

                case MMCN_DBLCLICK:
                        wsprintf(message, _T("MMCN_DBLCLICK\n"));
                        break;

                case MMCN_DELETE:
                        wsprintf(message, _T("MMCN_DELETE\n"));
                        break;

                case MMCN_DESELECT_ALL:
                        wsprintf(message, _T("MMCN_DESELECT_ALL\n"));
                        break;

                case MMCN_EXPAND:
                        wsprintf(message, _T("MMCN_EXPAND\n\tExpand: %d\n\tScope Item: %08x\n"), arg, param);
                        break;

                case MMCN_EXPANDSYNC:
                        wsprintf(message, _T("MMCN_EXPANDSYNC\n"));
                        break;

                case MMCN_FILTERBTN_CLICK:
                        wsprintf(message, _T("MMCN_FILTERBTN_CLICK\n\tColumn: %d\n"), arg);
                        break;

                case MMCN_FILTER_CHANGE:
                        wsprintf(message, _T("MMCN_FILTER_CHANGE\n\tColumn: %d\n"), param);
                        break;

                case MMCN_HELP:
                        wsprintf(message, _T("MMCN_HELP\n"));
                        break;

                case MMCN_INITOCX:
                        wsprintf(message, _T("MMCN_INITOCX\n\tIUnknown: %08x\n"), param);
                        break;

                case MMCN_LISTPAD:
                        wsprintf(message, _T("MMCN_LISTPAD\n\tConnect: %d\n"), arg);
                        break;

                case MMCN_MENU_BTNCLICK:
                        wsprintf(message, _T("MMCN_MENU_BTNCLICK\n"));
                        break;

                case MMCN_MINIMIZED:
                        wsprintf(message, _T("MMCN_MINIMIZED\n\tMinimized: %d\n"), arg);
                        break;

                case MMCN_PASTE:
                        wsprintf(message, _T("MMCN_PASTE\n\tCopy: %d\n"), param == NULL);
                        break;

                case MMCN_PRELOAD:
                        wsprintf(message, _T("MMCN_PRELOAD\n\tScope Item: %08x\n"), arg);
                        break;

                case MMCN_PRINT:
                        wsprintf(message, _T("MMCN_PRINT\n"));
                        break;

                case MMCN_PROPERTY_CHANGE:
                        wsprintf(message, _T("MMCN_PROPERTY_CHANGE\n\tScope: %d\n\tArg: %08x\n"), arg, param);
                        break;

                case MMCN_QUERY_PASTE:
                        wsprintf(message, _T("MMCN_QUERY_PASTE\n"));
                        break;

                case MMCN_REFRESH:
                        wsprintf(message, _T("MMCN_REFRESH\n"));
                        break;

                case MMCN_REMOVE_CHILDREN:
                        wsprintf(message, _T("MMCN_REMOVE_CHILDREN\n\tScope Item: %08x\n"), arg);
                        break;

                case MMCN_RENAME:
                        // Destination string may contain a truncation of the ideal result.
                        // (Indicated by return value other than S_OK).
                        // However, it will be null-terminated.
                        StringCchPrintf(message, cchMessage, _T("MMCN_RENAME\n\tNew Name: '%ws'\n"), (LPOLESTR)param);
                        break;

                case MMCN_RESTORE_VIEW:
                        wsprintf(message, _T("MMCN_RESTORE_VIEW\n"));
                        break;

                case MMCN_SELECT:
                        wsprintf(message, _T("MMCN_SELECT\n\tScope: %d\n\tSelect: %08x\n"), LOWORD(arg), HIWORD(arg));
                        break;

                case MMCN_SHOW:
                        wsprintf(message, _T("MMCN_SHOW\n\tShow: %d\n\tScope Item: %08x\n"), arg, param);
                        break;

                case MMCN_SNAPINHELP:
                        wsprintf(message, _T("MMCN_SNAPINHELP\n"));
                        break;

                case MMCN_VIEW_CHANGE:
                        wsprintf(message, _T("MMCN_VIEW_CHANGE\n\tData: %08x\n\tHint: %08x\n"), arg, param);
                        break;
        }

        if (message[0] != 0)
                OutputDebugString(message);
        else
                OutputDebugString(_T("unknown event\n"));

#endif
        return;
}

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Proppage/people.Cpp File Reference

  • SysMgmt
  • MMC
  • Proppage

people.Cpp File Reference

#include <stdio.h>
#include "People.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Proppage/people.h File Reference

  • SysMgmt
  • MMC
  • Proppage
Classes

people.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class | CBicycle
class | CBicycleFolder
class | CIceSkate
class | CIceSkateFolder
class | CPeoplePoweredVehicle
class | CSkateboard
class | CSkateboardFolder
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Proppage/registry.Cpp File Reference

  • SysMgmt
  • MMC
  • Proppage
Defines | Functions

registry.Cpp File Reference

#include <objbase.h>
#include <assert.h>
#include "Registry.h"
#include "globals.h"

Go to the source code of this file.

Defines

#define | STRINGS_ONLY

Functions

LONG | recursiveDeleteKey (HKEY hKeyParent, const _TCHAR *szKeyChild)
HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const _TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const _TCHAR *szNameString, const CLSID &clsidAbout, const BOOL fSupportExtensions)
BOOL | setKeyAndValue (const _TCHAR *pszPath, const _TCHAR *szSubkey, const _TCHAR *szValue)
BOOL | setSnapInKeyAndValue (const _TCHAR *szKey, const _TCHAR *szSubkey, const _TCHAR *szName, const _TCHAR *szValue)
BOOL | setValue (const _TCHAR *szKey, const _TCHAR *szValueName, const _TCHAR *szValue)
LONG | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Define Documentation

#define STRINGS_ONLY

Definition at line 24 of file registry.Cpp.

Function Documentation

LONG recursiveDeleteKey | ( | HKEY | hKeyParent,
 |  | const _TCHAR * | szKeyChild
 | ) |  |

Definition at line 214 of file registry.Cpp.

{
    // Open the child.
    HKEY hKeyChild ;
    LONG lRes = RegOpenKeyEx(hKeyParent, lpszKeyChild, 0,
        KEY_ALL_ACCESS, &hKeyChild) ;
    if (lRes != ERROR_SUCCESS)
    {
        return lRes ;
    }

    // Enumerate all of the decendents of this child.
    FILETIME time ;
    _TCHAR szBuffer[256] ;
    DWORD dwSize = 256 ;
    while (RegEnumKeyEx(hKeyChild, 0, szBuffer, &dwSize, NULL,
        NULL, NULL, &time) == S_OK)
    {
        // Delete the decendents of this child.
        lRes = recursiveDeleteKey(hKeyChild, szBuffer) ;
        if (lRes != ERROR_SUCCESS)
        {
            // Cleanup before exiting.
            RegCloseKey(hKeyChild) ;
            return lRes;
        }
        dwSize = 256 ;
    }

    // Close the child.
    RegCloseKey(hKeyChild) ;

    // Delete this child.
    return RegDeleteKey(hKeyParent, lpszKeyChild) ;
}

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const _TCHAR * | szFriendlyName
 | ) |  |

Definition at line 67 of file registry.Cpp.

{
    // Get server location.
    _TCHAR szModule[512] ;
    DWORD dwResult =
        ::GetModuleFileName(hModule,
        szModule,
        sizeof(szModule)/sizeof(_TCHAR)) ;

    assert(dwResult != 0) ;

    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    assert(SUCCEEDED(hr)) ;

        MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;
        _tcscat(szKey, pszCLSID) ;

    // Add the CLSID to the registry.
    setKeyAndValue(szKey, NULL, szFriendlyName) ;

    // Add the server filename subkey under the CLSID key.
    setKeyAndValue(szKey, _T("InprocServer32"), szModule) ;

    // set the threading model
    _tcscat(szKey, _T("\\InprocServer32"));
    setValue(szKey, _T("ThreadingModel"), _T("Apartment"));

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const _TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | fSupportExtensions
 | ) |  |

Definition at line 140 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    LPOLESTR wszAboutCLSID = NULL;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    if (IID_NULL != clsidAbout)
        hr = StringFromCLSID(clsidAbout, &wszAboutCLSID);

        MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);
        MAKE_TSTRPTR_FROMWIDE(pszAboutCLSID, wszAboutCLSID);

    // Add the CLSID to the registry.
    setSnapInKeyAndValue(pszCLSID, NULL, _T("NameString"), szNameString) ;
    setSnapInKeyAndValue(pszCLSID, _T("StandAlone"), NULL, NULL);
    if (IID_NULL != clsidAbout)
        setSnapInKeyAndValue(pszCLSID, NULL, _T("About"), pszAboutCLSID);

    if (fSupportExtensions) {
        // Build the key NodeType
        setSnapInKeyAndValue(pszCLSID, _T("NodeTypes"), NULL, NULL);

        _TCHAR szKey[64] ;
        _tcscpy(szKey, pszCLSID) ;
        _tcscat(szKey, _T("\\NodeTypes")) ;
        setSnapInKeyAndValue(szKey, pszCLSID, NULL, NULL);
    }

    // Free memory.
    CoTaskMemFree(wszCLSID) ;
    if (IID_NULL != clsidAbout)
        CoTaskMemFree(wszAboutCLSID);

    return S_OK ;
}

BOOL setKeyAndValue | ( | const _TCHAR * | pszPath,
 |  | const _TCHAR * | szSubkey,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 256 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Copy keyname into buffer.
    _tcscpy(szKeyBuf, szKey) ;

    // Add subkey name to buffer.
    if (szSubkey != NULL)
    {
        _tcscat(szKeyBuf, _T("\\")) ;
        _tcscat(szKeyBuf, szSubkey ) ;
    }

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, NULL, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

BOOL setSnapInKeyAndValue | ( | const _TCHAR * | szKey,
 |  | const _TCHAR * | szSubkey,
 |  | const _TCHAR * | szName,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 337 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\")) ;
    _tcscat(szKeyBuf, szKey) ;

    // Add subkey name to buffer.
    if (szSubkey != NULL)
    {
        _tcscat(szKeyBuf, _T("\\")) ;
        _tcscat(szKeyBuf, szSubkey ) ;
    }

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, szName, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

BOOL setValue | ( | const _TCHAR * | szKey,
 |  | const _TCHAR * | szValueName,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 299 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Copy keyname into buffer.
    _tcscpy(szKeyBuf, szKey) ;

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, szValueName, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

LONG UnregisterServer ( const CLSID & clsid )

Definition at line 112 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

        MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
        _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
               (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 184 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
        MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
               (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Generated on Wed Nov 13 2024 16:53:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Proppage/registry.h File Reference

  • SysMgmt
  • MMC
  • Proppage
Functions

registry.h File Reference

#include <tchar.h>

Go to the source code of this file.

Functions

HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const _TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const _TCHAR *szNameString, const CLSID &clsidAbout, const BOOL fSupportExtensions=FALSE)
HRESULT | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Function Documentation

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const _TCHAR * | szFriendlyName
 | ) |  |

Definition at line 67 of file registry.Cpp.

{
    // Get server location.
    _TCHAR szModule[512] ;
    DWORD dwResult =
        ::GetModuleFileName(hModule,
        szModule,
        sizeof(szModule)/sizeof(_TCHAR)) ;

    assert(dwResult != 0) ;

    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    assert(SUCCEEDED(hr)) ;

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;
  _tcscat(szKey, pszCLSID) ;

    // Add the CLSID to the registry.
    setKeyAndValue(szKey, NULL, szFriendlyName) ;

    // Add the server filename subkey under the CLSID key.
    setKeyAndValue(szKey, _T("InprocServer32"), szModule) ;

    // set the threading model
    _tcscat(szKey, _T("\\InprocServer32"));
    setValue(szKey, _T("ThreadingModel"), _T("Apartment"));

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const _TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | fSupportExtensions = FALSE
 | ) |  |

Definition at line 140 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    LPOLESTR wszAboutCLSID = NULL;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    if (IID_NULL != clsidAbout)
        hr = StringFromCLSID(clsidAbout, &wszAboutCLSID);

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszAboutCLSID, wszAboutCLSID);

    // Add the CLSID to the registry.
    setSnapInKeyAndValue(pszCLSID, NULL, _T("NameString"), szNameString) ;
    setSnapInKeyAndValue(pszCLSID, _T("StandAlone"), NULL, NULL);
    if (IID_NULL != clsidAbout)
        setSnapInKeyAndValue(pszCLSID, NULL, _T("About"), pszAboutCLSID);

    if (fSupportExtensions) {
        // Build the key NodeType
        setSnapInKeyAndValue(pszCLSID, _T("NodeTypes"), NULL, NULL);

        _TCHAR szKey[64] ;
        _tcscpy(szKey, pszCLSID) ;
        _tcscat(szKey, _T("\\NodeTypes")) ;
        setSnapInKeyAndValue(szKey, pszCLSID, NULL, NULL);
    }

    // Free memory.
    CoTaskMemFree(wszCLSID) ;
    if (IID_NULL != clsidAbout)
        CoTaskMemFree(wszAboutCLSID);

    return S_OK ;
}

HRESULT UnregisterServer ( const CLSID & clsid )

Definition at line 112 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

  MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
  _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 184 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Generated on Wed Nov 13 2024 16:53:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Proppage/resource.h File Reference

  • SysMgmt
  • MMC
  • Proppage
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDB_BIKE 40007
#define | IDB_BIKE2 40011
#define | IDB_CAR 40005
#define | IDB_CAR2 40009
#define | IDB_CLOSED 40014
#define | IDB_CLOSED2 40012
#define | IDB_LGBMP 113
#define | IDB_OPEN 40015
#define | IDB_OPEN2 40013
#define | IDB_PLANE 40006
#define | IDB_PLANE2 40010
#define | IDB_ROCKET 40004
#define | IDB_ROCKET2 40008
#define | IDB_SMBMP 112
#define | IDB_SMOPEN 111
#define | IDC_ROCKET_HEIGHT 1001
#define | IDC_ROCKET_NAME 1000
#define | IDC_ROCKET_PAYLOAD 1003
#define | IDC_ROCKET_STATUS 1005
#define | IDC_ROCKET_WEIGHT 1002
#define | IDD_PROPPAGE_LARGE 107
#define | IDI_ICON1 108
#define | IDI_PSI_LANDBASED 2
#define | IDI_PSI_ROCKET 114
#define | IDR_LGICONS 121
#define | IDR_SMICONS 120
#define | IDS_ABOUTNAME 9
#define | IDS_HELPFILE 1
#define | IDS_NAME 3
#define | IDS_PST_LANDBASED 11
#define | IDS_PST_ROCKET 10
#define | IDS_SNAPINDESC 2
#define | IDS_SNAPINNAME 6

Define Documentation

#define IDB_BIKE 40007

Definition at line 29 of file resource.h.

#define IDB_BIKE2 40011

Definition at line 33 of file resource.h.

#define IDB_CAR 40005

Definition at line 27 of file resource.h.

#define IDB_CAR2 40009

Definition at line 31 of file resource.h.

#define IDB_CLOSED 40014

Definition at line 36 of file resource.h.

#define IDB_CLOSED2 40012

Definition at line 34 of file resource.h.

#define IDB_LGBMP 113

Definition at line 17 of file resource.h.

#define IDB_OPEN 40015

Definition at line 37 of file resource.h.

#define IDB_OPEN2 40013

Definition at line 35 of file resource.h.

#define IDB_PLANE 40006

Definition at line 28 of file resource.h.

#define IDB_PLANE2 40010

Definition at line 32 of file resource.h.

#define IDB_ROCKET 40004

Definition at line 26 of file resource.h.

#define IDB_ROCKET2 40008

Definition at line 30 of file resource.h.

#define IDB_SMBMP 112

Definition at line 16 of file resource.h.

#define IDB_SMOPEN 111

Definition at line 15 of file resource.h.

#define IDC_ROCKET_HEIGHT 1001

Definition at line 22 of file resource.h.

#define IDC_ROCKET_NAME 1000

Definition at line 21 of file resource.h.

#define IDC_ROCKET_PAYLOAD 1003

Definition at line 24 of file resource.h.

#define IDC_ROCKET_STATUS 1005

Definition at line 25 of file resource.h.

#define IDC_ROCKET_WEIGHT 1002

Definition at line 23 of file resource.h.

#define IDD_PROPPAGE_LARGE 107

Definition at line 13 of file resource.h.

#define IDI_ICON1 108

Definition at line 14 of file resource.h.

#define IDI_PSI_LANDBASED 2

Definition at line 7 of file resource.h.

#define IDI_PSI_ROCKET 114

Definition at line 18 of file resource.h.

#define IDR_LGICONS 121

Definition at line 20 of file resource.h.

#define IDR_SMICONS 120

Definition at line 19 of file resource.h.

#define IDS_ABOUTNAME 9

Definition at line 10 of file resource.h.

#define IDS_HELPFILE 1

Definition at line 5 of file resource.h.

#define IDS_NAME 3

Definition at line 8 of file resource.h.

#define IDS_PST_LANDBASED 11

Definition at line 12 of file resource.h.

#define IDS_PST_ROCKET 10

Definition at line 11 of file resource.h.

#define IDS_SNAPINDESC 2

Definition at line 6 of file resource.h.

#define IDS_SNAPINNAME 6

Definition at line 9 of file resource.h.

Generated on Wed Nov 13 2024 16:52:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Proppage/sky.Cpp File Reference

  • SysMgmt
  • MMC
  • Proppage

sky.Cpp File Reference

#include "Sky.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Proppage/sky.h File Reference

  • SysMgmt
  • MMC
  • Proppage
Classes

sky.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class CSkyBasedVehicle
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Proppage/space.Cpp File Reference

  • SysMgmt
  • MMC
  • Proppage
Defines

space.Cpp File Reference

#include <stdio.h>
#include <windows.h>
#include "Space.h"
#include "Comp.h"
#include "resource.h"
#include <strsafe.h>

Go to the source code of this file.

Defines

#define STRSAFE_NO_DEPRECATE

Define Documentation

#define STRSAFE_NO_DEPRECATE

Definition at line 24 of file space.Cpp.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Proppage/space.h File Reference

  • SysMgmt
  • MMC
  • Proppage
Classes

space.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class | CRocket
class | CSpaceVehicle
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Proppage/statnode.Cpp File Reference

  • SysMgmt
  • MMC
  • Proppage

statnode.Cpp File Reference

#include "StatNode.h"
#include "Space.h"
#include "Sky.h"
#include "People.h"
#include "Land.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Proppage/statnode.h File Reference

  • SysMgmt
  • MMC
  • Proppage
Classes

statnode.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class CStaticNode
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Simple/basesnap.Cpp File Reference

  • SysMgmt
  • MMC
  • Simple
Functions | Variables

basesnap.Cpp File Reference

#include <objbase.h>
#include <initguid.h>
#include "guids.h"
#include "basesnap.h"
#include "Comp.h"
#include "CompData.h"
#include "Registry.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)
BOOL WINAPI | DllMain (HINSTANCE hinstDLL, DWORD fdwReason, void *lpvReserved)
STDAPI | DllRegisterServer ()
STDAPI | DllUnregisterServer ()
STDMETHODIMP_ (ULONG) CClassFactory

Variables

HINSTANCE | g_hinst

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 67 of file basesnap.Cpp.

{
    if (g_uObjects == 0 && g_uSrvLock == 0)
        return S_OK;
    else
        return S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 43 of file basesnap.Cpp.

{
    if (rclsid != CLSID_CComponentData)
        return CLASS_E_CLASSNOTAVAILABLE;

    if (!ppvObj)
        return E_FAIL;

    *ppvObj = NULL;

    // We can only hand out IUnknown and IClassFactory pointers.  Fail
    // if they ask for anything else.
    if (!IsEqualIID(riid, IID_IUnknown) && !IsEqualIID(riid, IID_IClassFactory))
        return E_NOINTERFACE;

    CClassFactory *pFactory = new CClassFactory();
    if (NULL == pFactory)
        return E_OUTOFMEMORY;

    HRESULT hr = pFactory->QueryInterface(riid, ppvObj);

    return hr;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hinstDLL,
 |  | DWORD | fdwReason,
 |  | void * | lpvReserved
 | ) |  |

Definition at line 30 of file basesnap.Cpp.

{

    if (fdwReason == DLL_PROCESS_ATTACH) {
        g_hinst = hinstDLL;
    }

    return TRUE;
}

STDAPI DllRegisterServer ( void )

Definition at line 172 of file basesnap.Cpp.

{
    _TCHAR szName[256];
    _TCHAR szSnapInName[256];

    LoadString(g_hinst, IDS_NAME, szName, (sizeof szName)/(sizeof szName[0]));
    LoadString(g_hinst, IDS_SNAPINNAME, szSnapInName, (sizeof szSnapInName)/(sizeof szSnapInName[0]));

    if (RegisterServer(g_hinst,
        CLSID_CComponentData,
        szName) == S_OK)
        return RegisterSnapin(CLSID_CComponentData, szSnapInName, IID_NULL, FALSE);
    else
        return E_FAIL;
}

STDAPI DllUnregisterServer ( void )

Definition at line 189 of file basesnap.Cpp.

{
    if (UnregisterServer(CLSID_CComponentData) == S_OK)
        return UnregisterSnapin(CLSID_CComponentData);
    else
        return E_FAIL;
}

STDMETHODIMP_ ( ULONG )

Definition at line 113 of file basesnap.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;
}

Variable Documentation

HINSTANCE g_hinst

Definition at line 28 of file basesnap.Cpp.

Generated on Wed Nov 13 2024 16:54:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Simple/basesnap.h File Reference

  • SysMgmt
  • MMC
  • Simple
Classes | Functions | Variables

basesnap.h File Reference

Go to the source code of this file.

Classes

class | CClassFactory

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)

Variables

ULONG | g_uObjects = 0
ULONG | g_uSrvLock = 0

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 53 of file ComSpyAudit.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 61 of file ComSpyAudit.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

Variable Documentation

ULONG g_uObjects = 0

Definition at line 24 of file basesnap.h.

ULONG g_uSrvLock = 0

Definition at line 25 of file basesnap.h.

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Simple/comp.Cpp File Reference

  • SysMgmt
  • MMC
  • Simple
Functions

comp.Cpp File Reference

#include "Comp.h"
#include "DataObj.h"
#include <commctrl.h>
#include <crtdbg.h>
#include "globals.h"
#include "resource.h"
#include "DeleBase.h"
#include "CompData.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CComponent

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 65 of file comp.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Simple/comp.h File Reference

  • SysMgmt
  • MMC
  • Simple
Classes

comp.h File Reference

#include <mmc.h>

Go to the source code of this file.

Classes

class CComponent
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Simple/compdata.Cpp File Reference

  • SysMgmt
  • MMC
  • Simple
Functions

compdata.Cpp File Reference

#include "Comp.h"
#include "CompData.h"
#include "DataObj.h"
#include "resource.h"
#include <crtdbg.h>

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CComponentData

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 74 of file compdata.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        // we need to decrement our object count in the DLL
        delete this;
        return 0;
    }

    return m_cref;
}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Simple/compdata.h File Reference

  • SysMgmt
  • MMC
  • Simple
Classes

compdata.h File Reference

#include <mmc.h>
#include <objidl.h>
#include "DeleBase.h"
#include "StatNode.h"
#include "Comp.h"
#include "DeleBase.h"
#include "StatNode.h"

Go to the source code of this file.

Classes

class CComponentData
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Simple/dataobj.Cpp File Reference

  • SysMgmt
  • MMC
  • Simple
Defines | Functions

dataobj.Cpp File Reference

#include "DataObj.h"
#include "guids.h"
#include "DeleBase.h"

Go to the source code of this file.

Defines

#define | _T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")
#define | _T_CCF_INTERNAL_SNAPIN _T("{2479DB32-5276-11d2-94F5-00C04FB92EC2}")
#define | _T_CCF_NODETYPE _T("CCF_NODETYPE")
#define | _T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")
#define | _T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")

Functions

CDataObject * | GetOurDataObject (LPDATAOBJECT lpDataObject)
STDMETHODIMP_ (ULONG) CDataObject

Define Documentation

#define _T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")

Definition at line 31 of file dataobj.Cpp.

#define _T_CCF_INTERNAL_SNAPIN _T("{2479DB32-5276-11d2-94F5-00C04FB92EC2}")

Definition at line 36 of file dataobj.Cpp.

#define _T_CCF_NODETYPE _T("CCF_NODETYPE")

Definition at line 32 of file dataobj.Cpp.

#define _T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")

Definition at line 34 of file dataobj.Cpp.

#define _T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")

Definition at line 33 of file dataobj.Cpp.

Function Documentation

CDataObject* GetOurDataObject ( LPDATAOBJECT lpDataObject )

Definition at line 165 of file dataobj.Cpp.

{
    HRESULT       hr      = S_OK;
    CDataObject *pSDO     = NULL;

  // check to see if the data object is a special data object.
  if ( IS_SPECIAL_DATAOBJECT (lpDataObject) )
  {
    //Code for handling a special data object goes here.

    //Note that the MMC SDK samples do not handle
    //special data objects, so we exit if we get one.
    return NULL;
  }

    STGMEDIUM stgmedium = { TYMED_HGLOBAL,  NULL  };
    FORMATETC formatetc = { CDataObject::s_cfInternal, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };

    // Allocate memory for the stream
    stgmedium.hGlobal = GlobalAlloc( GMEM_SHARE, sizeof(CDataObject *));

    if (!stgmedium.hGlobal) {
        hr = E_OUTOFMEMORY;
    }

    if SUCCEEDED(hr)
        // Attempt to get data from the object
        hr = lpDataObject->GetDataHere( &formatetc, &stgmedium );

    // stgmedium now has the data we need
    if (SUCCEEDED(hr))  {
        pSDO = *(CDataObject **)(stgmedium.hGlobal);
    }

    // if we have memory free it
    if (stgmedium.hGlobal)
        GlobalFree(stgmedium.hGlobal);

    return pSDO;

} // end GetOurDataObject()

STDMETHODIMP_ ( ULONG )

Definition at line 87 of file dataobj.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Simple/dataobj.h File Reference

  • SysMgmt
  • MMC
  • Simple
Classes | Functions

dataobj.h File Reference

#include <mmc.h>
#include "DeleBase.h"

Go to the source code of this file.

Classes

class | CDataObject

Functions

HRESULT | ExtractFromDataObject (IDataObject *lpDataObject, UINT cf, ULONG cb, HGLOBAL *phGlobal)
CDataObject * | GetOurDataObject (IDataObject *lpDataObject)
BOOL | IsMMCMultiSelectDataObject (IDataObject *lpDataObject)

Function Documentation

HRESULT ExtractFromDataObject | ( | IDataObject * | lpDataObject,
 |  | UINT | cf,
 |  | ULONG | cb,
 |  | HGLOBAL * | phGlobal
 | ) |  |
CDataObject* GetOurDataObject ( IDataObject * lpDataObject )
BOOL IsMMCMultiSelectDataObject ( IDataObject * lpDataObject )
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Simple/delebase.Cpp File Reference

  • SysMgmt
  • MMC
  • Simple

delebase.Cpp File Reference

#include "DeleBase.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Simple/delebase.h File Reference

  • SysMgmt
  • MMC
  • Simple
Classes

delebase.h File Reference

#include <mmc.h>
#include <crtdbg.h>
#include "globals.h"
#include "resource.h"
#include "LocalRes.h"
#include "globals.h"
#include "resource.h"
#include "LocalRes.h"

Go to the source code of this file.

Classes

class CDelegationBase
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Simple/globals.h File Reference

  • SysMgmt
  • MMC
  • Simple
Classes | Defines | Functions | Variables

globals.h File Reference

#include <tchar.h>

Go to the source code of this file.

Classes

class | TempBuffer

Defines

#define | IDM_BUTTON1 0x100
#define | IDM_BUTTON2 0x101
#define | MAKE_TSTRPTR_FROMWIDE(ptrname, widestr)
#define | MAKE_WIDEPTR_FROMTSTR(ptrname, tstr)
#define | MAKE_WIDEPTR_FROMTSTR_ALLOC(ptrname, tstr)
#define | OBJECT_CREATED InterlockedIncrement((long *)&g_uObjects);
#define | OBJECT_DESTROYED InterlockedDecrement((long *)&g_uObjects);

Functions

void | MMCN_Crack (BOOL bComponentData, IDataObject *pDataObject, IComponentData *pCompData, IComponent *pComp, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)

Variables

HINSTANCE | g_hinst
ULONG g_uObjects

Define Documentation

#define IDM_BUTTON1 0x100

Definition at line 25 of file globals.h.

#define IDM_BUTTON2 0x101

Definition at line 26 of file globals.h.

#define MAKE_TSTRPTR_FROMWIDE | ( | ptrname,
 |  | widestr
 | ) |
Value:
long __l##ptrname = (wcslen(widestr) + 1) * 2 * sizeof(TCHAR); \
    TempBuffer __TempBuffer##ptrname(__l##ptrname); \
    WideCharToMultiByte(CP_ACP, 0, widestr, -1, (LPSTR)__TempBuffer##ptrname.GetBuffer(), __l##ptrname, NULL, NULL); \
    LPTSTR ptrname = (LPTSTR)__TempBuffer##ptrname.GetBuffer()

Definition at line 127 of file globals.h.

#define MAKE_WIDEPTR_FROMTSTR | ( | ptrname,
 |  | tstr
 | ) |
Value:
long __cch##ptrname = (lstrlenA(tstr) + 1);\
    long __l##ptrname = (lstrlenA(tstr) + 1) * sizeof(WCHAR); \
    TempBuffer __TempBuffer##ptrname(__l##ptrname); \
    MultiByteToWideChar(CP_ACP, 0, tstr, -1, (LPWSTR)__TempBuffer##ptrname.GetBuffer(), __cch##ptrname); \
    LPWSTR ptrname = (LPWSTR)__TempBuffer##ptrname.GetBuffer()

Definition at line 93 of file globals.h.

#define MAKE_WIDEPTR_FROMTSTR_ALLOC | ( | ptrname,
 |  | tstr
 | ) |
Value:
long __cch##ptrname = (lstrlenA(tstr) + 1);\
    long __l##ptrname = (lstrlenA(tstr) + 1) * sizeof(WCHAR); \
    LPWSTR ptrname = (LPWSTR)CoTaskMemAlloc(__l##ptrname); \
    MultiByteToWideChar(CP_ACP, 0, tstr, -1, ptrname, __cch##ptrname)

Definition at line 107 of file globals.h.

#define OBJECT_CREATED InterlockedIncrement((long *)&g_uObjects);

Definition at line 31 of file globals.h.

#define OBJECT_DESTROYED InterlockedDecrement((long *)&g_uObjects);

Definition at line 32 of file globals.h.

Function Documentation

void MMCN_Crack | ( | BOOL | bComponentData,
 |  | IDataObject * | pDataObject,
 |  | IComponentData * | pCompData,
 |  | IComponent * | pComp,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param
 | ) |  |

Definition at line 59 of file mmccrack.Cpp.

{
#ifdef MMC_CRACK_MESSAGES
        const size_t cchMessage = 256;
  TCHAR message[cchMessage] = {0};

  if (bComponentData == TRUE)
    OutputDebugString(_T("IComponentData::Notify( "));
  else
    OutputDebugString(_T("IComponent::Notify( "));

  wsprintf(message, _T("DataObject: %08x, CompData: %08x, Comp: %08x ) - "), pDataObject, pCompData, pComp);
  OutputDebugString(message);

    switch (event)  {
    case MMCN_ACTIVATE:
      wsprintf(message, _T("MMCN_ACTIVATE\n\tActivate: %d\n"), arg);
      break;

    case MMCN_ADD_IMAGES:
      wsprintf(message, _T("MMCN_ADD_IMAGES\n\tImage List: %08x\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_BTN_CLICK:
      wsprintf(message, _T("MMCN_BTN_CLICK\n\tVerb: %ws\n"), MMCN_CrackVerb((MMC_CONSOLE_VERB)param));
      break;

    case MMCN_COLUMN_CLICK:
      wsprintf(message, _T("MMCN_COLUMN_CLICK\n\tColumn: %d\n\tSort Option: %d\n"), arg,   param);
      break;

    case MMCN_COLUMNS_CHANGED:
      wsprintf(message, _T("MMCN_COLUMNS_CHANGED\n"));
      break;

    case MMCN_CONTEXTHELP:
      wsprintf(message, _T("MMCN_CONTEXTHELP\n"));
      break;

    case MMCN_CONTEXTMENU:
      wsprintf(message, _T("MMCN_CONTEXTMENU\n"));
      break;

    case MMCN_CUTORMOVE:
      wsprintf(message, _T("MMCN_CUTORMOVE\n"));
      break;

    case MMCN_DBLCLICK:
      wsprintf(message, _T("MMCN_DBLCLICK\n"));
      break;

    case MMCN_DELETE:
      wsprintf(message, _T("MMCN_DELETE\n"));
      break;

    case MMCN_DESELECT_ALL:
      wsprintf(message, _T("MMCN_DESELECT_ALL\n"));
      break;

    case MMCN_EXPAND:
      wsprintf(message, _T("MMCN_EXPAND\n\tExpand: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_EXPANDSYNC:
      wsprintf(message, _T("MMCN_EXPANDSYNC\n"));
      break;

    case MMCN_FILTERBTN_CLICK:
      wsprintf(message, _T("MMCN_FILTERBTN_CLICK\n\tColumn: %d\n"), arg);
      break;

    case MMCN_FILTER_CHANGE:
      wsprintf(message, _T("MMCN_FILTER_CHANGE\n\tColumn: %d\n"), param);
      break;

    case MMCN_HELP:
      wsprintf(message, _T("MMCN_HELP\n"));
      break;

    case MMCN_INITOCX:
      wsprintf(message, _T("MMCN_INITOCX\n\tIUnknown: %08x\n"), param);
      break;

    case MMCN_LISTPAD:
      wsprintf(message, _T("MMCN_LISTPAD\n\tConnect: %d\n"), arg);
      break;

    case MMCN_MENU_BTNCLICK:
      wsprintf(message, _T("MMCN_MENU_BTNCLICK\n"));
      break;

    case MMCN_MINIMIZED:
      wsprintf(message, _T("MMCN_MINIMIZED\n\tMinimized: %d\n"), arg);
      break;

    case MMCN_PASTE:
      wsprintf(message, _T("MMCN_PASTE\n\tCopy: %d\n"), param == NULL);
      break;

    case MMCN_PRELOAD:
      wsprintf(message, _T("MMCN_PRELOAD\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_PRINT:
      wsprintf(message, _T("MMCN_PRINT\n"));
      break;

    case MMCN_PROPERTY_CHANGE:
      wsprintf(message, _T("MMCN_PROPERTY_CHANGE\n\tScope: %d\n\tArg: %08x\n"), arg, param);
      break;

    case MMCN_QUERY_PASTE:
      wsprintf(message, _T("MMCN_QUERY_PASTE\n"));
      break;

    case MMCN_REFRESH:
      wsprintf(message, _T("MMCN_REFRESH\n"));
      break;

    case MMCN_REMOVE_CHILDREN:
      wsprintf(message, _T("MMCN_REMOVE_CHILDREN\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_RENAME:
                        // Destination string may contain a truncation of the ideal result.
                        // (Indicated by return value other than S_OK).
                        // However, it will be null-terminated.
      StringCchPrintf(message, cchMessage, _T("MMCN_RENAME\n\tNew Name: '%ws'\n"), (LPOLESTR)param);
      break;

    case MMCN_RESTORE_VIEW:
      wsprintf(message, _T("MMCN_RESTORE_VIEW\n"));
      break;

    case MMCN_SELECT:
      wsprintf(message, _T("MMCN_SELECT\n\tScope: %d\n\tSelect: %08x\n"), LOWORD(arg), HIWORD(arg));
      break;

    case MMCN_SHOW:
      wsprintf(message, _T("MMCN_SHOW\n\tShow: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_SNAPINHELP:
      wsprintf(message, _T("MMCN_SNAPINHELP\n"));
      break;

    case MMCN_VIEW_CHANGE:
      wsprintf(message, _T("MMCN_VIEW_CHANGE\n\tData: %08x\n\tHint: %08x\n"), arg, param);
      break;
  }

  if (message[0] != 0)
    OutputDebugString(message);
  else
    OutputDebugString(_T("unknown event\n"));

#endif
  return;
}

Variable Documentation

HINSTANCE g_hinst

Definition at line 33 of file SetDisp.h.

ULONG g_uObjects

Definition at line 24 of file basesnap.h.

Generated on Wed Nov 13 2024 16:54:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Simple/guids.h File Reference

  • SysMgmt
  • MMC
  • Simple
Functions

guids.h File Reference

Go to the source code of this file.

Functions

DEFINE_GUID (CLSID_CComponentData, 0x1ba53c00, 0x232f, 0x11d2, 0x90, 0x7, 0x0, 0xc0, 0x4f, 0x98, 0xbc, 0xb)

Function Documentation

DEFINE_GUID | ( | CLSID_CComponentData | ,
 |  | 0x1ba53c00 | ,
 |  | 0x232f | ,
 |  | 0x11d2 | ,
 |  | 0x90 | ,
 |  | 0x7 | ,
 |  | 0x0 | ,
 |  | 0xc0 | ,
 |  | 0x4f | ,
 |  | 0x98 | ,
 |  | 0xbc | ,
 |  | 0xb |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Simple/localres.h File Reference

  • SysMgmt
  • MMC
  • Simple
Defines

localres.h File Reference

Go to the source code of this file.

Defines

#define | INDEX_CLOSEDFOLDER 4
#define | INDEX_LANDICON 1
#define | INDEX_NONE -1
#define | INDEX_OPENFOLDER 5
#define | INDEX_PEOPLEICON 3
#define | INDEX_SKYICON 2
#define | INDEX_SPACEICON 0

Define Documentation

#define INDEX_CLOSEDFOLDER 4

Definition at line 27 of file localres.h.

#define INDEX_LANDICON 1

Definition at line 24 of file localres.h.

#define INDEX_NONE -1

Definition at line 22 of file localres.h.

#define INDEX_OPENFOLDER 5

Definition at line 28 of file localres.h.

#define INDEX_PEOPLEICON 3

Definition at line 26 of file localres.h.

#define INDEX_SKYICON 2

Definition at line 25 of file localres.h.

#define INDEX_SPACEICON 0

Definition at line 23 of file localres.h.

Generated on Wed Nov 13 2024 16:54:37 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Simple/mmccrack.Cpp File Reference

  • SysMgmt
  • MMC
  • Simple
Defines | Functions

mmccrack.Cpp File Reference

#include <mmc.h>
#include <winuser.h>
#include <tchar.h>
#include "globals.h"
#include <strsafe.h>

Go to the source code of this file.

Defines

#define | STRSAFE_NO_DEPRECATE

Functions

void | MMCN_Crack (BOOL bComponentData, IDataObject *pDataObject, IComponentData *pCompData, IComponent *pComp, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)

Define Documentation

#define STRSAFE_NO_DEPRECATE

Definition at line 25 of file mmccrack.Cpp.

Function Documentation

void MMCN_Crack | ( | BOOL | bComponentData,
 |  | IDataObject * | pDataObject,
 |  | IComponentData * | pCompData,
 |  | IComponent * | pComp,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param
 | ) |  |

Definition at line 59 of file mmccrack.Cpp.

{
#ifdef MMC_CRACK_MESSAGES
        const size_t cchMessage = 256;
  TCHAR message[cchMessage] = {0};

  if (bComponentData == TRUE)
    OutputDebugString(_T("IComponentData::Notify( "));
  else
    OutputDebugString(_T("IComponent::Notify( "));

  wsprintf(message, _T("DataObject: %08x, CompData: %08x, Comp: %08x ) - "), pDataObject, pCompData, pComp);
  OutputDebugString(message);

    switch (event)  {
    case MMCN_ACTIVATE:
      wsprintf(message, _T("MMCN_ACTIVATE\n\tActivate: %d\n"), arg);
      break;

    case MMCN_ADD_IMAGES:
      wsprintf(message, _T("MMCN_ADD_IMAGES\n\tImage List: %08x\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_BTN_CLICK:
      wsprintf(message, _T("MMCN_BTN_CLICK\n\tVerb: %ws\n"), MMCN_CrackVerb((MMC_CONSOLE_VERB)param));
      break;

    case MMCN_COLUMN_CLICK:
      wsprintf(message, _T("MMCN_COLUMN_CLICK\n\tColumn: %d\n\tSort Option: %d\n"), arg,   param);
      break;

    case MMCN_COLUMNS_CHANGED:
      wsprintf(message, _T("MMCN_COLUMNS_CHANGED\n"));
      break;

    case MMCN_CONTEXTHELP:
      wsprintf(message, _T("MMCN_CONTEXTHELP\n"));
      break;

    case MMCN_CONTEXTMENU:
      wsprintf(message, _T("MMCN_CONTEXTMENU\n"));
      break;

    case MMCN_CUTORMOVE:
      wsprintf(message, _T("MMCN_CUTORMOVE\n"));
      break;

    case MMCN_DBLCLICK:
      wsprintf(message, _T("MMCN_DBLCLICK\n"));
      break;

    case MMCN_DELETE:
      wsprintf(message, _T("MMCN_DELETE\n"));
      break;

    case MMCN_DESELECT_ALL:
      wsprintf(message, _T("MMCN_DESELECT_ALL\n"));
      break;

    case MMCN_EXPAND:
      wsprintf(message, _T("MMCN_EXPAND\n\tExpand: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_EXPANDSYNC:
      wsprintf(message, _T("MMCN_EXPANDSYNC\n"));
      break;

    case MMCN_FILTERBTN_CLICK:
      wsprintf(message, _T("MMCN_FILTERBTN_CLICK\n\tColumn: %d\n"), arg);
      break;

    case MMCN_FILTER_CHANGE:
      wsprintf(message, _T("MMCN_FILTER_CHANGE\n\tColumn: %d\n"), param);
      break;

    case MMCN_HELP:
      wsprintf(message, _T("MMCN_HELP\n"));
      break;

    case MMCN_INITOCX:
      wsprintf(message, _T("MMCN_INITOCX\n\tIUnknown: %08x\n"), param);
      break;

    case MMCN_LISTPAD:
      wsprintf(message, _T("MMCN_LISTPAD\n\tConnect: %d\n"), arg);
      break;

    case MMCN_MENU_BTNCLICK:
      wsprintf(message, _T("MMCN_MENU_BTNCLICK\n"));
      break;

    case MMCN_MINIMIZED:
      wsprintf(message, _T("MMCN_MINIMIZED\n\tMinimized: %d\n"), arg);
      break;

    case MMCN_PASTE:
      wsprintf(message, _T("MMCN_PASTE\n\tCopy: %d\n"), param == NULL);
      break;

    case MMCN_PRELOAD:
      wsprintf(message, _T("MMCN_PRELOAD\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_PRINT:
      wsprintf(message, _T("MMCN_PRINT\n"));
      break;

    case MMCN_PROPERTY_CHANGE:
      wsprintf(message, _T("MMCN_PROPERTY_CHANGE\n\tScope: %d\n\tArg: %08x\n"), arg, param);
      break;

    case MMCN_QUERY_PASTE:
      wsprintf(message, _T("MMCN_QUERY_PASTE\n"));
      break;

    case MMCN_REFRESH:
      wsprintf(message, _T("MMCN_REFRESH\n"));
      break;

    case MMCN_REMOVE_CHILDREN:
      wsprintf(message, _T("MMCN_REMOVE_CHILDREN\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_RENAME:
                        // Destination string may contain a truncation of the ideal result.
                        // (Indicated by return value other than S_OK).
                        // However, it will be null-terminated.
      StringCchPrintf(message, cchMessage, _T("MMCN_RENAME\n\tNew Name: '%ws'\n"), (LPOLESTR)param);
      break;

    case MMCN_RESTORE_VIEW:
      wsprintf(message, _T("MMCN_RESTORE_VIEW\n"));
      break;

    case MMCN_SELECT:
      wsprintf(message, _T("MMCN_SELECT\n\tScope: %d\n\tSelect: %08x\n"), LOWORD(arg), HIWORD(arg));
      break;

    case MMCN_SHOW:
      wsprintf(message, _T("MMCN_SHOW\n\tShow: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_SNAPINHELP:
      wsprintf(message, _T("MMCN_SNAPINHELP\n"));
      break;

    case MMCN_VIEW_CHANGE:
      wsprintf(message, _T("MMCN_VIEW_CHANGE\n\tData: %08x\n\tHint: %08x\n"), arg, param);
      break;
  }

  if (message[0] != 0)
    OutputDebugString(message);
  else
    OutputDebugString(_T("unknown event\n"));

#endif
  return;
}

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Simple/registry.Cpp File Reference

  • SysMgmt
  • MMC
  • Simple
Defines | Functions

registry.Cpp File Reference

#include <objbase.h>
#include <assert.h>
#include "Registry.h"
#include "globals.h"

Go to the source code of this file.

Defines

#define | STRINGS_ONLY

Functions

LONG | recursiveDeleteKey (HKEY hKeyParent, const _TCHAR *szKeyChild)
HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const _TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const _TCHAR *szNameString, const CLSID &clsidAbout, const BOOL fSupportExtensions)
BOOL | setKeyAndValue (const _TCHAR *pszPath, const _TCHAR *szSubkey, const _TCHAR *szValue)
BOOL | setSnapInKeyAndValue (const _TCHAR *szKey, const _TCHAR *szSubkey, const _TCHAR *szName, const _TCHAR *szValue)
BOOL | setValue (const _TCHAR *szKey, const _TCHAR *szValueName, const _TCHAR *szValue)
LONG | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Define Documentation

#define STRINGS_ONLY

Definition at line 24 of file registry.Cpp.

Function Documentation

LONG recursiveDeleteKey | ( | HKEY | hKeyParent,
 |  | const _TCHAR * | szKeyChild
 | ) |  |

Definition at line 214 of file registry.Cpp.

{
    // Open the child.
    HKEY hKeyChild ;
    LONG lRes = RegOpenKeyEx(hKeyParent, lpszKeyChild, 0,
        KEY_ALL_ACCESS, &hKeyChild) ;
    if (lRes != ERROR_SUCCESS)
    {
        return lRes ;
    }

    // Enumerate all of the decendents of this child.
    FILETIME time ;
    _TCHAR szBuffer[256] ;
    DWORD dwSize = 256 ;
    while (RegEnumKeyEx(hKeyChild, 0, szBuffer, &dwSize, NULL,
        NULL, NULL, &time) == S_OK)
    {
        // Delete the decendents of this child.
        lRes = recursiveDeleteKey(hKeyChild, szBuffer) ;
        if (lRes != ERROR_SUCCESS)
        {
            // Cleanup before exiting.
            RegCloseKey(hKeyChild) ;
            return lRes;
        }
        dwSize = 256 ;
    }

    // Close the child.
    RegCloseKey(hKeyChild) ;

    // Delete this child.
    return RegDeleteKey(hKeyParent, lpszKeyChild) ;
}

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const _TCHAR * | szFriendlyName
 | ) |  |

Definition at line 67 of file registry.Cpp.

{
    // Get server location.
    _TCHAR szModule[512] ;
    DWORD dwResult =
        ::GetModuleFileName(hModule,
        szModule,
        sizeof(szModule)/sizeof(_TCHAR)) ;

    assert(dwResult != 0) ;

    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    assert(SUCCEEDED(hr)) ;

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;
  _tcscat(szKey, pszCLSID) ;

    // Add the CLSID to the registry.
    setKeyAndValue(szKey, NULL, szFriendlyName) ;

    // Add the server filename subkey under the CLSID key.
    setKeyAndValue(szKey, _T("InprocServer32"), szModule) ;

    // set the threading model
    _tcscat(szKey, _T("\\InprocServer32"));
    setValue(szKey, _T("ThreadingModel"), _T("Apartment"));

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const _TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | fSupportExtensions
 | ) |  |

Definition at line 140 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    LPOLESTR wszAboutCLSID = NULL;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Add the CLSID to the registry.
    setSnapInKeyAndValue(pszCLSID, NULL, _T("NameString"), szNameString) ;
    setSnapInKeyAndValue(pszCLSID, _T("StandAlone"), NULL, NULL);

    if (IID_NULL != clsidAbout) {
        hr = StringFromCLSID(clsidAbout, &wszAboutCLSID);
    MAKE_TSTRPTR_FROMWIDE(pszAboutCLSID, wszAboutCLSID);
        setSnapInKeyAndValue(pszCLSID, NULL, _T("About"), pszAboutCLSID);
  }

    if (fSupportExtensions) {
        // Build the key NodeType
        setSnapInKeyAndValue(pszCLSID, _T("NodeTypes"), NULL, NULL);

        _TCHAR szKey[64] ;
        _tcscpy(szKey, pszCLSID) ;
        _tcscat(szKey, _T("\\NodeTypes")) ;
        setSnapInKeyAndValue(szKey, pszCLSID, NULL, NULL);
    }

    // Free memory.
    CoTaskMemFree(wszCLSID) ;
    if (IID_NULL != clsidAbout)
        CoTaskMemFree(wszAboutCLSID);

    return S_OK ;
}

BOOL setKeyAndValue | ( | const _TCHAR * | pszPath,
 |  | const _TCHAR * | szSubkey,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 256 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Copy keyname into buffer.
    _tcscpy(szKeyBuf, szKey) ;

    // Add subkey name to buffer.
    if (szSubkey != NULL)
    {
        _tcscat(szKeyBuf, _T("\\")) ;
        _tcscat(szKeyBuf, szSubkey ) ;
    }

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, NULL, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

BOOL setSnapInKeyAndValue | ( | const _TCHAR * | szKey,
 |  | const _TCHAR * | szSubkey,
 |  | const _TCHAR * | szName,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 337 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\")) ;
    _tcscat(szKeyBuf, szKey) ;

    // Add subkey name to buffer.
    if (szSubkey != NULL)
    {
        _tcscat(szKeyBuf, _T("\\")) ;
        _tcscat(szKeyBuf, szSubkey ) ;
    }

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, szName, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

BOOL setValue | ( | const _TCHAR * | szKey,
 |  | const _TCHAR * | szValueName,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 299 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Copy keyname into buffer.
    _tcscpy(szKeyBuf, szKey) ;

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, szValueName, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

LONG UnregisterServer ( const CLSID & clsid )

Definition at line 112 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

  MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
  _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 184 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Generated on Wed Nov 13 2024 16:53:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Simple/registry.h File Reference

  • SysMgmt
  • MMC
  • Simple
Functions

registry.h File Reference

#include <tchar.h>

Go to the source code of this file.

Functions

HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const _TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const _TCHAR *szNameString, const CLSID &clsidAbout, const BOOL fSupportExtensions=FALSE)
HRESULT | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Function Documentation

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const _TCHAR * | szFriendlyName
 | ) |  |

Definition at line 67 of file registry.Cpp.

{
    // Get server location.
    _TCHAR szModule[512] ;
    DWORD dwResult =
        ::GetModuleFileName(hModule,
        szModule,
        sizeof(szModule)/sizeof(_TCHAR)) ;

    assert(dwResult != 0) ;

    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    assert(SUCCEEDED(hr)) ;

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;
  _tcscat(szKey, pszCLSID) ;

    // Add the CLSID to the registry.
    setKeyAndValue(szKey, NULL, szFriendlyName) ;

    // Add the server filename subkey under the CLSID key.
    setKeyAndValue(szKey, _T("InprocServer32"), szModule) ;

    // set the threading model
    _tcscat(szKey, _T("\\InprocServer32"));
    setValue(szKey, _T("ThreadingModel"), _T("Apartment"));

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const _TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | fSupportExtensions = FALSE
 | ) |  |

Definition at line 140 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    LPOLESTR wszAboutCLSID = NULL;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    if (IID_NULL != clsidAbout)
        hr = StringFromCLSID(clsidAbout, &wszAboutCLSID);

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszAboutCLSID, wszAboutCLSID);

    // Add the CLSID to the registry.
    setSnapInKeyAndValue(pszCLSID, NULL, _T("NameString"), szNameString) ;
    setSnapInKeyAndValue(pszCLSID, _T("StandAlone"), NULL, NULL);
    if (IID_NULL != clsidAbout)
        setSnapInKeyAndValue(pszCLSID, NULL, _T("About"), pszAboutCLSID);

    if (fSupportExtensions) {
        // Build the key NodeType
        setSnapInKeyAndValue(pszCLSID, _T("NodeTypes"), NULL, NULL);

        _TCHAR szKey[64] ;
        _tcscpy(szKey, pszCLSID) ;
        _tcscat(szKey, _T("\\NodeTypes")) ;
        setSnapInKeyAndValue(szKey, pszCLSID, NULL, NULL);
    }

    // Free memory.
    CoTaskMemFree(wszCLSID) ;
    if (IID_NULL != clsidAbout)
        CoTaskMemFree(wszAboutCLSID);

    return S_OK ;
}

HRESULT UnregisterServer ( const CLSID & clsid )

Definition at line 112 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

  MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
  _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 184 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Generated on Wed Nov 13 2024 16:53:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Simple/resource.h File Reference

  • SysMgmt
  • MMC
  • Simple
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDB_BIKE 40007
#define | IDB_BIKE2 40011
#define | IDB_CAR 40005
#define | IDB_CAR2 40009
#define | IDB_CLOSED 40014
#define | IDB_CLOSED2 40012
#define | IDB_OPEN 40015
#define | IDB_OPEN2 40013
#define | IDB_PLANE 40006
#define | IDB_PLANE2 40010
#define | IDB_ROCKET 40004
#define | IDB_ROCKET2 40008
#define | IDI_ICON1 108
#define | IDR_LGICONS 121
#define | IDR_SMICONS 120
#define | IDS_ABOUTNAME 9
#define | IDS_HELPFILE 1
#define | IDS_NAME 3
#define | IDS_SNAPINDESC 2
#define | IDS_SNAPINNAME 6

Define Documentation

#define IDB_BIKE 40007

Definition at line 16 of file resource.h.

#define IDB_BIKE2 40011

Definition at line 20 of file resource.h.

#define IDB_CAR 40005

Definition at line 14 of file resource.h.

#define IDB_CAR2 40009

Definition at line 18 of file resource.h.

#define IDB_CLOSED 40014

Definition at line 23 of file resource.h.

#define IDB_CLOSED2 40012

Definition at line 21 of file resource.h.

#define IDB_OPEN 40015

Definition at line 24 of file resource.h.

#define IDB_OPEN2 40013

Definition at line 22 of file resource.h.

#define IDB_PLANE 40006

Definition at line 15 of file resource.h.

#define IDB_PLANE2 40010

Definition at line 19 of file resource.h.

#define IDB_ROCKET 40004

Definition at line 13 of file resource.h.

#define IDB_ROCKET2 40008

Definition at line 17 of file resource.h.

#define IDI_ICON1 108

Definition at line 10 of file resource.h.

#define IDR_LGICONS 121

Definition at line 12 of file resource.h.

#define IDR_SMICONS 120

Definition at line 11 of file resource.h.

#define IDS_ABOUTNAME 9

Definition at line 9 of file resource.h.

#define IDS_HELPFILE 1

Definition at line 5 of file resource.h.

#define IDS_NAME 3

Definition at line 7 of file resource.h.

#define IDS_SNAPINDESC 2

Definition at line 6 of file resource.h.

#define IDS_SNAPINNAME 6

Definition at line 8 of file resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Simple/statnode.Cpp File Reference

  • SysMgmt
  • MMC
  • Simple

statnode.Cpp File Reference

#include "StatNode.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Simple/statnode.h File Reference

  • SysMgmt
  • MMC
  • Simple
Classes

statnode.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class | CStaticNode
struct | CStaticNode::privateData
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Taskpads/about.Cpp File Reference

  • SysMgmt
  • MMC
  • Taskpads
Functions

about.Cpp File Reference

#include "About.h"
#include "resource.h"
#include "globals.h"
#include <crtdbg.h>

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CSnapinAbout

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 89 of file about.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        // we need to decrement our object count in the DLL
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:54:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Taskpads/about.h File Reference

  • SysMgmt
  • MMC
  • Taskpads
Classes

about.h File Reference

#include <tchar.h>
#include <mmc.h>

Go to the source code of this file.

Classes

class CSnapinAbout
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Taskpads/basesnap.Cpp File Reference

  • SysMgmt
  • MMC
  • Taskpads
Functions | Variables

basesnap.Cpp File Reference

#include <objbase.h>
#include <olectl.h>
#include <initguid.h>
#include "guids.h"
#include "basesnap.h"
#include "Comp.h"
#include "CompData.h"
#include "About.h"
#include "Registry.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)
BOOL WINAPI | DllMain (HINSTANCE hinstDLL, DWORD fdwReason, void *lpvReserved)
STDAPI | DllRegisterServer ()
STDAPI | DllUnregisterServer ()
STDMETHODIMP_ (ULONG) CClassFactory

Variables

HINSTANCE | g_hinst

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 77 of file basesnap.Cpp.

{
    if (g_uObjects == 0 && g_uSrvLock == 0)
        return S_OK;
    else
        return S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 45 of file basesnap.Cpp.

{
    if ((rclsid != CLSID_CComponentData) && (rclsid != CLSID_CSnapinAbout))
        return CLASS_E_CLASSNOTAVAILABLE;

    if (!ppvObj)
        return E_FAIL;

    *ppvObj = NULL;

    // We can only hand out IUnknown and IClassFactory pointers.  Fail
    // if they ask for anything else.
    if (!IsEqualIID(riid, IID_IUnknown) && !IsEqualIID(riid, IID_IClassFactory))
        return E_NOINTERFACE;

    CClassFactory *pFactory = NULL;

    // make the factory passing in the creation function for the type of object they want
    if (rclsid == CLSID_CComponentData)
        pFactory = new CClassFactory(CClassFactory::COMPONENT);
    else if (rclsid == CLSID_CSnapinAbout)
        pFactory = new CClassFactory(CClassFactory::ABOUT);

    if (NULL == pFactory)
        return E_OUTOFMEMORY;

    HRESULT hr = pFactory->QueryInterface(riid, ppvObj);

    return hr;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hinstDLL,
 |  | DWORD | fdwReason,
 |  | void * | lpvReserved
 | ) |  |

Definition at line 32 of file basesnap.Cpp.

{

    if (fdwReason == DLL_PROCESS_ATTACH) {
        g_hinst = hinstDLL;
    }

    return TRUE;
}

STDAPI DllRegisterServer ( void )

Definition at line 187 of file basesnap.Cpp.

{
    HRESULT hr = SELFREG_E_CLASS;
    _TCHAR szName[256];
    _TCHAR szSnapInName[256];

    LoadString(g_hinst, IDS_NAME, szName, (sizeof szName)/(sizeof szName[0]));
    LoadString(g_hinst, IDS_SNAPINNAME, szSnapInName, (sizeof szSnapInName)/(sizeof szSnapInName[0]));

    _TCHAR szAboutName[256];

    LoadString(g_hinst, IDS_ABOUTNAME, szAboutName, (sizeof szAboutName)/(sizeof szAboutName[0]));

    // register our CoClasses
    hr = RegisterServer(g_hinst,
        CLSID_CComponentData,
        szName);

    if SUCCEEDED(hr)
        hr = RegisterServer(g_hinst,
        CLSID_CSnapinAbout,
        szAboutName);

    // place the registry information for SnapIns
    if SUCCEEDED(hr)
        hr = RegisterSnapin(CLSID_CComponentData, szSnapInName, CLSID_CSnapinAbout, FALSE);

    return hr;
}

STDAPI DllUnregisterServer ( void )

Definition at line 218 of file basesnap.Cpp.

{
    if (UnregisterServer(CLSID_CComponentData) == S_OK)
        return UnregisterSnapin(CLSID_CComponentData);
    else
        return E_FAIL;
}

STDMETHODIMP_ ( ULONG )

Definition at line 124 of file basesnap.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;
}

Variable Documentation

HINSTANCE g_hinst

Definition at line 30 of file basesnap.Cpp.

Generated on Wed Nov 13 2024 16:54:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Taskpads/basesnap.h File Reference

  • SysMgmt
  • MMC
  • Taskpads
Classes | Functions | Variables

basesnap.h File Reference

Go to the source code of this file.

Classes

class | CClassFactory

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)

Variables

ULONG | g_uObjects = 0
ULONG | g_uSrvLock = 0

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 53 of file ComSpyAudit.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 61 of file ComSpyAudit.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

Variable Documentation

ULONG g_uObjects = 0

Definition at line 24 of file basesnap.h.

ULONG g_uSrvLock = 0

Definition at line 25 of file basesnap.h.

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Taskpads/comp.Cpp File Reference

  • SysMgmt
  • MMC
  • Taskpads
Functions

comp.Cpp File Reference

#include "Comp.h"
#include "DataObj.h"
#include <commctrl.h>
#include <crtdbg.h>
#include "globals.h"
#include "resource.h"
#include "DeleBase.h"
#include "CompData.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CComponent

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 68 of file comp.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Taskpads/comp.h File Reference

  • SysMgmt
  • MMC
  • Taskpads
Classes

comp.h File Reference

#include <mmc.h>
#include <tchar.h>
#include "EnumTASK.h"
#include "globals.h"

Go to the source code of this file.

Classes

class CComponent
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Taskpads/compdata.Cpp File Reference

  • SysMgmt
  • MMC
  • Taskpads
Functions

compdata.Cpp File Reference

#include "Comp.h"
#include "CompData.h"
#include "DataObj.h"
#include "resource.h"
#include <crtdbg.h>

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CComponentData

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 72 of file compdata.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        // we need to decrement our object count in the DLL
        delete this;
        return 0;
    }

    return m_cref;
}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Taskpads/compdata.h File Reference

  • SysMgmt
  • MMC
  • Taskpads
Classes

compdata.h File Reference

#include <mmc.h>
#include "DeleBase.h"
#include "StatNode.h"
#include "Comp.h"
#include "DeleBase.h"
#include "StatNode.h"

Go to the source code of this file.

Classes

class CComponentData
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Taskpads/dataobj.Cpp File Reference

  • SysMgmt
  • MMC
  • Taskpads
Defines | Functions

dataobj.Cpp File Reference

#include "DataObj.h"
#include "guids.h"
#include "DeleBase.h"

Go to the source code of this file.

Defines

#define | _T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")
#define | _T_CCF_INTERNAL_SNAPIN _T("{2479DB32-5276-11d2-94F5-00C04FB92EC2}")
#define | _T_CCF_NODETYPE _T("CCF_NODETYPE")
#define | _T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")
#define | _T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")

Functions

CDataObject * | GetOurDataObject (LPDATAOBJECT lpDataObject)
STDMETHODIMP_ (ULONG) CDataObject

Define Documentation

#define _T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")

Definition at line 31 of file dataobj.Cpp.

#define _T_CCF_INTERNAL_SNAPIN _T("{2479DB32-5276-11d2-94F5-00C04FB92EC2}")

Definition at line 36 of file dataobj.Cpp.

#define _T_CCF_NODETYPE _T("CCF_NODETYPE")

Definition at line 32 of file dataobj.Cpp.

#define _T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")

Definition at line 34 of file dataobj.Cpp.

#define _T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")

Definition at line 33 of file dataobj.Cpp.

Function Documentation

CDataObject* GetOurDataObject ( LPDATAOBJECT lpDataObject )

Definition at line 165 of file dataobj.Cpp.

{
    HRESULT       hr      = S_OK;
    CDataObject *pSDO     = NULL;

  // check to see if the data object is a special data object.
  if ( IS_SPECIAL_DATAOBJECT (lpDataObject) )
  {
    //Code for handling a special data object goes here.

    //Note that the MMC SDK samples do not handle
    //special data objects, so we exit if we get one.
    return NULL;
  }

    STGMEDIUM stgmedium = { TYMED_HGLOBAL,  NULL  };
    FORMATETC formatetc = { CDataObject::s_cfInternal, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };

    // Allocate memory for the stream
    stgmedium.hGlobal = GlobalAlloc( GMEM_SHARE, sizeof(CDataObject *));

    if (!stgmedium.hGlobal)     {
        hr = E_OUTOFMEMORY;
    }

    if SUCCEEDED(hr)
        // Attempt to get data from the object
        hr = lpDataObject->GetDataHere( &formatetc, &stgmedium );

    // stgmedium now has the data we need
    if (SUCCEEDED(hr))  {
        pSDO = *(CDataObject **)(stgmedium.hGlobal);
    }

    // if we have memory free it
    if (stgmedium.hGlobal)
        GlobalFree(stgmedium.hGlobal);

    return pSDO;

} // end GetOurDataObject()

STDMETHODIMP_ ( ULONG )

Definition at line 87 of file dataobj.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Taskpads/dataobj.h File Reference

  • SysMgmt
  • MMC
  • Taskpads
Classes | Functions

dataobj.h File Reference

#include <mmc.h>
#include "DeleBase.h"

Go to the source code of this file.

Classes

class | CDataObject

Functions

HRESULT | ExtractFromDataObject (IDataObject *lpDataObject, UINT cf, ULONG cb, HGLOBAL *phGlobal)
CDataObject * | GetOurDataObject (IDataObject *lpDataObject)
BOOL | IsMMCMultiSelectDataObject (IDataObject *lpDataObject)

Function Documentation

HRESULT ExtractFromDataObject | ( | IDataObject * | lpDataObject,
 |  | UINT | cf,
 |  | ULONG | cb,
 |  | HGLOBAL * | phGlobal
 | ) |  |
CDataObject* GetOurDataObject ( IDataObject * lpDataObject )
BOOL IsMMCMultiSelectDataObject ( IDataObject * lpDataObject )
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Taskpads/delebase.Cpp File Reference

  • SysMgmt
  • MMC
  • Taskpads

delebase.Cpp File Reference

#include "DeleBase.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Taskpads/delebase.h File Reference

  • SysMgmt
  • MMC
  • Taskpads
Classes

delebase.h File Reference

#include <mmc.h>
#include <crtdbg.h>
#include "globals.h"
#include "resource.h"
#include "LocalRes.h"
#include "LocalRes.h"

Go to the source code of this file.

Classes

class CDelegationBase
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Taskpads/enumtask.Cpp File Reference

  • SysMgmt
  • MMC
  • Taskpads
Functions

enumtask.Cpp File Reference

#include "EnumTASK.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CEnumTASK

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 67 of file enumtask.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Taskpads/enumtask.h File Reference

  • SysMgmt
  • MMC
  • Taskpads
Classes

enumtask.h File Reference

#include <mmc.h>

Go to the source code of this file.

Classes

class CEnumTASK
Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Taskpads/globals.h File Reference

  • SysMgmt
  • MMC
  • Taskpads
Classes | Defines | Functions | Variables

globals.h File Reference

#include <tchar.h>

Go to the source code of this file.

Classes

class | TempBuffer

Defines

#define | IDM_BUTTON1 0x100
#define | IDM_BUTTON2 0x101
#define | MAKE_TSTRPTR_FROMWIDE(ptrname, widestr)
#define | MAKE_WIDEPTR_FROMTSTR(ptrname, tstr)
#define | MAKE_WIDEPTR_FROMTSTR_ALLOC(ptrname, tstr)
#define | OBJECT_CREATED InterlockedIncrement((long *)&g_uObjects);
#define | OBJECT_DESTROYED InterlockedDecrement((long *)&g_uObjects);

Functions

LPOLESTR | CreateResourcePath (HINSTANCE hInst, LPOLESTR szResource)
void | MMCN_Crack (BOOL bComponentData, IDataObject *pDataObject, IComponentData *pCompData, IComponent *pComp, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)

Variables

HINSTANCE | g_hinst
ULONG g_uObjects

Define Documentation

#define IDM_BUTTON1 0x100

Definition at line 25 of file globals.h.

#define IDM_BUTTON2 0x101

Definition at line 26 of file globals.h.

#define MAKE_TSTRPTR_FROMWIDE | ( | ptrname,
 |  | widestr
 | ) |
Value:
long __l##ptrname = (wcslen(widestr) + 1) * 2 * sizeof(TCHAR); \
    TempBuffer __TempBuffer##ptrname(__l##ptrname); \
    WideCharToMultiByte(CP_ACP, 0, widestr, -1, (LPSTR)__TempBuffer##ptrname.GetBuffer(), __l##ptrname, NULL, NULL); \
    LPTSTR ptrname = (LPTSTR)__TempBuffer##ptrname.GetBuffer()

Definition at line 129 of file globals.h.

#define MAKE_WIDEPTR_FROMTSTR | ( | ptrname,
 |  | tstr
 | ) |
Value:
long __cch##ptrname = (lstrlenA(tstr) + 1);\
    long __l##ptrname = (lstrlenA(tstr) + 1) * sizeof(WCHAR); \
    TempBuffer __TempBuffer##ptrname(__l##ptrname); \
    MultiByteToWideChar(CP_ACP, 0, tstr, -1, (LPWSTR)__TempBuffer##ptrname.GetBuffer(), __cch##ptrname); \
    LPWSTR ptrname = (LPWSTR)__TempBuffer##ptrname.GetBuffer()

Definition at line 95 of file globals.h.

#define MAKE_WIDEPTR_FROMTSTR_ALLOC | ( | ptrname,
 |  | tstr
 | ) |
Value:
long __cch##ptrname = (lstrlenA(tstr) + 1);\
    long __l##ptrname = (lstrlenA(tstr) + 1) * sizeof(WCHAR); \
    LPWSTR ptrname = (LPWSTR)CoTaskMemAlloc(__l##ptrname); \
    MultiByteToWideChar(CP_ACP, 0, tstr, -1, ptrname, __cch##ptrname)

Definition at line 109 of file globals.h.

#define OBJECT_CREATED InterlockedIncrement((long *)&g_uObjects);

Definition at line 31 of file globals.h.

#define OBJECT_DESTROYED InterlockedDecrement((long *)&g_uObjects);

Definition at line 32 of file globals.h.

Function Documentation

LPOLESTR CreateResourcePath | ( | HINSTANCE | hInst,
 |  | LPOLESTR | szResource
 | ) |  |

Definition at line 47 of file people.Cpp.

{
   _TCHAR szBuffer[MAX_PATH];

   ZeroMemory(szBuffer, sizeof(szBuffer));

   _tcscpy(szBuffer, _T("res://"));

   _TCHAR *szTemp = szBuffer + _tcslen(szBuffer);
   GetModuleFileName(hInst, szTemp, sizeof(szBuffer) - _tcslen(szBuffer));

   _tcscat(szBuffer, _T("/"));
   MAKE_TSTRPTR_FROMWIDE(szname, szResource);
   _tcscat(szBuffer, szname);

   MAKE_WIDEPTR_FROMTSTR(wszname, szBuffer);
   LPOLESTR szOutBuffer = static_cast<LPOLESTR>(CoTaskMemAlloc((wcslen(wszname) + 1)  * sizeof(WCHAR)));

   wcscpy(szOutBuffer, wszname);

   return szOutBuffer;

} //end CreateResoucePath()

void MMCN_Crack | ( | BOOL | bComponentData,
 |  | IDataObject * | pDataObject,
 |  | IComponentData * | pCompData,
 |  | IComponent * | pComp,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param
 | ) |  |

Definition at line 59 of file mmccrack.Cpp.

{
#ifdef MMC_CRACK_MESSAGES
        const size_t cchMessage = 256;
  TCHAR message[cchMessage] = {0};

  if (bComponentData == TRUE)
    OutputDebugString(_T("IComponentData::Notify( "));
  else
    OutputDebugString(_T("IComponent::Notify( "));

  wsprintf(message, _T("DataObject: %08x, CompData: %08x, Comp: %08x ) - "), pDataObject, pCompData, pComp);
  OutputDebugString(message);

    switch (event)  {
    case MMCN_ACTIVATE:
      wsprintf(message, _T("MMCN_ACTIVATE\n\tActivate: %d\n"), arg);
      break;

    case MMCN_ADD_IMAGES:
      wsprintf(message, _T("MMCN_ADD_IMAGES\n\tImage List: %08x\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_BTN_CLICK:
      wsprintf(message, _T("MMCN_BTN_CLICK\n\tVerb: %ws\n"), MMCN_CrackVerb((MMC_CONSOLE_VERB)param));
      break;

    case MMCN_COLUMN_CLICK:
      wsprintf(message, _T("MMCN_COLUMN_CLICK\n\tColumn: %d\n\tSort Option: %d\n"), arg,   param);
      break;

    case MMCN_COLUMNS_CHANGED:
      wsprintf(message, _T("MMCN_COLUMNS_CHANGED\n"));
      break;

    case MMCN_CONTEXTHELP:
      wsprintf(message, _T("MMCN_CONTEXTHELP\n"));
      break;

    case MMCN_CONTEXTMENU:
      wsprintf(message, _T("MMCN_CONTEXTMENU\n"));
      break;

    case MMCN_CUTORMOVE:
      wsprintf(message, _T("MMCN_CUTORMOVE\n"));
      break;

    case MMCN_DBLCLICK:
      wsprintf(message, _T("MMCN_DBLCLICK\n"));
      break;

    case MMCN_DELETE:
      wsprintf(message, _T("MMCN_DELETE\n"));
      break;

    case MMCN_DESELECT_ALL:
      wsprintf(message, _T("MMCN_DESELECT_ALL\n"));
      break;

    case MMCN_EXPAND:
      wsprintf(message, _T("MMCN_EXPAND\n\tExpand: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_EXPANDSYNC:
      wsprintf(message, _T("MMCN_EXPANDSYNC\n"));
      break;

    case MMCN_FILTERBTN_CLICK:
      wsprintf(message, _T("MMCN_FILTERBTN_CLICK\n\tColumn: %d\n"), arg);
      break;

    case MMCN_FILTER_CHANGE:
      wsprintf(message, _T("MMCN_FILTER_CHANGE\n\tColumn: %d\n"), param);
      break;

    case MMCN_HELP:
      wsprintf(message, _T("MMCN_HELP\n"));
      break;

    case MMCN_INITOCX:
      wsprintf(message, _T("MMCN_INITOCX\n\tIUnknown: %08x\n"), param);
      break;

    case MMCN_LISTPAD:
      wsprintf(message, _T("MMCN_LISTPAD\n\tConnect: %d\n"), arg);
      break;

    case MMCN_MENU_BTNCLICK:
      wsprintf(message, _T("MMCN_MENU_BTNCLICK\n"));
      break;

    case MMCN_MINIMIZED:
      wsprintf(message, _T("MMCN_MINIMIZED\n\tMinimized: %d\n"), arg);
      break;

    case MMCN_PASTE:
      wsprintf(message, _T("MMCN_PASTE\n\tCopy: %d\n"), param == NULL);
      break;

    case MMCN_PRELOAD:
      wsprintf(message, _T("MMCN_PRELOAD\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_PRINT:
      wsprintf(message, _T("MMCN_PRINT\n"));
      break;

    case MMCN_PROPERTY_CHANGE:
      wsprintf(message, _T("MMCN_PROPERTY_CHANGE\n\tScope: %d\n\tArg: %08x\n"), arg, param);
      break;

    case MMCN_QUERY_PASTE:
      wsprintf(message, _T("MMCN_QUERY_PASTE\n"));
      break;

    case MMCN_REFRESH:
      wsprintf(message, _T("MMCN_REFRESH\n"));
      break;

    case MMCN_REMOVE_CHILDREN:
      wsprintf(message, _T("MMCN_REMOVE_CHILDREN\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_RENAME:
                        // Destination string may contain a truncation of the ideal result.
                        // (Indicated by return value other than S_OK).
                        // However, it will be null-terminated.
      StringCchPrintf(message, cchMessage, _T("MMCN_RENAME\n\tNew Name: '%ws'\n"), (LPOLESTR)param);
      break;

    case MMCN_RESTORE_VIEW:
      wsprintf(message, _T("MMCN_RESTORE_VIEW\n"));
      break;

    case MMCN_SELECT:
      wsprintf(message, _T("MMCN_SELECT\n\tScope: %d\n\tSelect: %08x\n"), LOWORD(arg), HIWORD(arg));
      break;

    case MMCN_SHOW:
      wsprintf(message, _T("MMCN_SHOW\n\tShow: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_SNAPINHELP:
      wsprintf(message, _T("MMCN_SNAPINHELP\n"));
      break;

    case MMCN_VIEW_CHANGE:
      wsprintf(message, _T("MMCN_VIEW_CHANGE\n\tData: %08x\n\tHint: %08x\n"), arg, param);
      break;
  }

  if (message[0] != 0)
    OutputDebugString(message);
  else
    OutputDebugString(_T("unknown event\n"));

#endif
  return;
}

Variable Documentation

HINSTANCE g_hinst

Definition at line 33 of file SetDisp.h.

ULONG g_uObjects

Definition at line 24 of file basesnap.h.

Generated on Wed Nov 13 2024 16:54:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Taskpads/guids.h File Reference

  • SysMgmt
  • MMC
  • Taskpads
Functions

guids.h File Reference

Go to the source code of this file.

Functions

DEFINE_GUID (CLSID_CComponentData, 0xc83216b2, 0xa4e5, 0x11d2, 0x97, 0xb, 0x0, 0x80, 0xc7, 0xdc, 0xb3, 0xdc)
DEFINE_GUID (CLSID_CSnapinAbout, 0xced3c801, 0xa4e5, 0x11d2, 0x97, 0xb, 0x0, 0x80, 0xc7, 0xdc, 0xb3, 0xdc)

Function Documentation

DEFINE_GUID | ( | CLSID_CComponentData | ,
 |  | 0xc83216b2 | ,
 |  | 0xa4e5 | ,
 |  | 0x11d2 | ,
 |  | 0x97 | ,
 |  | 0xb | ,
 |  | 0x0 | ,
 |  | 0x80 | ,
 |  | 0xc7 | ,
 |  | 0xdc | ,
 |  | 0xb3 | ,
 |  | 0xdc |
 | ) |  |
DEFINE_GUID | ( | CLSID_CSnapinAbout | ,
 |  | 0xced3c801 | ,
 |  | 0xa4e5 | ,
 |  | 0x11d2 | ,
 |  | 0x97 | ,
 |  | 0xb | ,
 |  | 0x0 | ,
 |  | 0x80 | ,
 |  | 0xc7 | ,
 |  | 0xdc | ,
 |  | 0xb3 | ,
 |  | 0xdc |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Taskpads/land.Cpp File Reference

  • SysMgmt
  • MMC
  • Taskpads

land.Cpp File Reference

#include "Land.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Taskpads/land.h File Reference

  • SysMgmt
  • MMC
  • Taskpads
Classes

land.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class CLandBasedVehicle
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Taskpads/localres.h File Reference

  • SysMgmt
  • MMC
  • Taskpads
Defines

localres.h File Reference

Go to the source code of this file.

Defines

#define | INDEX_CLOSEDFOLDER 4
#define | INDEX_LANDICON 1
#define | INDEX_NONE -1
#define | INDEX_OPENFOLDER 5
#define | INDEX_PEOPLEICON 3
#define | INDEX_SKYICON 2
#define | INDEX_SPACEICON 0

Define Documentation

#define INDEX_CLOSEDFOLDER 4

Definition at line 27 of file localres.h.

#define INDEX_LANDICON 1

Definition at line 24 of file localres.h.

#define INDEX_NONE -1

Definition at line 22 of file localres.h.

#define INDEX_OPENFOLDER 5

Definition at line 28 of file localres.h.

#define INDEX_PEOPLEICON 3

Definition at line 26 of file localres.h.

#define INDEX_SKYICON 2

Definition at line 25 of file localres.h.

#define INDEX_SPACEICON 0

Definition at line 23 of file localres.h.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Taskpads/mmccrack.Cpp File Reference

  • SysMgmt
  • MMC
  • Taskpads
Defines | Functions

mmccrack.Cpp File Reference

#include <mmc.h>
#include <winuser.h>
#include <tchar.h>
#include "globals.h"
#include <strsafe.h>

Go to the source code of this file.

Defines

#define | STRSAFE_NO_DEPRECATE

Functions

void | MMCN_Crack (BOOL bComponentData, IDataObject *pDataObject, IComponentData *pCompData, IComponent *pComp, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)

Define Documentation

#define STRSAFE_NO_DEPRECATE

Definition at line 25 of file mmccrack.Cpp.

Function Documentation

void MMCN_Crack | ( | BOOL | bComponentData,
 |  | IDataObject * | pDataObject,
 |  | IComponentData * | pCompData,
 |  | IComponent * | pComp,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param
 | ) |  |

Definition at line 59 of file mmccrack.Cpp.

{
#ifdef MMC_CRACK_MESSAGES
        const size_t cchMessage = 256;
        TCHAR message[cchMessage] = {0};

        if (bComponentData == TRUE)
                OutputDebugString(_T("IComponentData::Notify( "));
        else
                OutputDebugString(_T("IComponent::Notify( "));

        wsprintf(message, _T("DataObject: %08x, CompData: %08x, Comp: %08x ) - "), pDataObject, pCompData, pComp);
        OutputDebugString(message);

    switch (event)      {
                case MMCN_ACTIVATE:
                        wsprintf(message, _T("MMCN_ACTIVATE\n\tActivate: %d\n"), arg);
                        break;

                case MMCN_ADD_IMAGES:
                        wsprintf(message, _T("MMCN_ADD_IMAGES\n\tImage List: %08x\n\tScope Item: %08x\n"), arg, param);
                        break;

                case MMCN_BTN_CLICK:
                        wsprintf(message, _T("MMCN_BTN_CLICK\n\tVerb: %ws\n"), MMCN_CrackVerb((MMC_CONSOLE_VERB)param));
                        break;

                case MMCN_COLUMN_CLICK:
                        wsprintf(message, _T("MMCN_COLUMN_CLICK\n\tColumn: %d\n\tSort Option: %d\n"), arg,       param);
                        break;

                case MMCN_COLUMNS_CHANGED:
                        wsprintf(message, _T("MMCN_COLUMNS_CHANGED\n"));
                        break;

                case MMCN_CONTEXTHELP:
                        wsprintf(message, _T("MMCN_CONTEXTHELP\n"));
                        break;

                case MMCN_CONTEXTMENU:
                        wsprintf(message, _T("MMCN_CONTEXTMENU\n"));
                        break;

                case MMCN_CUTORMOVE:
                        wsprintf(message, _T("MMCN_CUTORMOVE\n"));
                        break;

                case MMCN_DBLCLICK:
                        wsprintf(message, _T("MMCN_DBLCLICK\n"));
                        break;

                case MMCN_DELETE:
                        wsprintf(message, _T("MMCN_DELETE\n"));
                        break;

                case MMCN_DESELECT_ALL:
                        wsprintf(message, _T("MMCN_DESELECT_ALL\n"));
                        break;

                case MMCN_EXPAND:
                        wsprintf(message, _T("MMCN_EXPAND\n\tExpand: %d\n\tScope Item: %08x\n"), arg, param);
                        break;

                case MMCN_EXPANDSYNC:
                        wsprintf(message, _T("MMCN_EXPANDSYNC\n"));
                        break;

                case MMCN_FILTERBTN_CLICK:
                        wsprintf(message, _T("MMCN_FILTERBTN_CLICK\n\tColumn: %d\n"), arg);
                        break;

                case MMCN_FILTER_CHANGE:
                        wsprintf(message, _T("MMCN_FILTER_CHANGE\n\tColumn: %d\n"), param);
                        break;

                case MMCN_HELP:
                        wsprintf(message, _T("MMCN_HELP\n"));
                        break;

                case MMCN_INITOCX:
                        wsprintf(message, _T("MMCN_INITOCX\n\tIUnknown: %08x\n"), param);
                        break;

                case MMCN_LISTPAD:
                        wsprintf(message, _T("MMCN_LISTPAD\n\tConnect: %d\n"), arg);
                        break;

                case MMCN_MENU_BTNCLICK:
                        wsprintf(message, _T("MMCN_MENU_BTNCLICK\n"));
                        break;

                case MMCN_MINIMIZED:
                        wsprintf(message, _T("MMCN_MINIMIZED\n\tMinimized: %d\n"), arg);
                        break;

                case MMCN_PASTE:
                        wsprintf(message, _T("MMCN_PASTE\n\tCopy: %d\n"), param == NULL);
                        break;

                case MMCN_PRELOAD:
                        wsprintf(message, _T("MMCN_PRELOAD\n\tScope Item: %08x\n"), arg);
                        break;

                case MMCN_PRINT:
                        wsprintf(message, _T("MMCN_PRINT\n"));
                        break;

                case MMCN_PROPERTY_CHANGE:
                        wsprintf(message, _T("MMCN_PROPERTY_CHANGE\n\tScope: %d\n\tArg: %08x\n"), arg, param);
                        break;

                case MMCN_QUERY_PASTE:
                        wsprintf(message, _T("MMCN_QUERY_PASTE\n"));
                        break;

                case MMCN_REFRESH:
                        wsprintf(message, _T("MMCN_REFRESH\n"));
                        break;

                case MMCN_REMOVE_CHILDREN:
                        wsprintf(message, _T("MMCN_REMOVE_CHILDREN\n\tScope Item: %08x\n"), arg);
                        break;

                case MMCN_RENAME:
                        // Destination string may contain a truncation of the ideal result.
                        // (Indicated by return value other than S_OK).
                        // However, it will be null-terminated.
                        StringCchPrintf(message, cchMessage, _T("MMCN_RENAME\n\tNew Name: '%ws'\n"), (LPOLESTR)param);
                        break;

                case MMCN_RESTORE_VIEW:
                        wsprintf(message, _T("MMCN_RESTORE_VIEW\n"));
                        break;

                case MMCN_SELECT:
                        wsprintf(message, _T("MMCN_SELECT\n\tScope: %d\n\tSelect: %08x\n"), LOWORD(arg), HIWORD(arg));
                        break;

                case MMCN_SHOW:
                        wsprintf(message, _T("MMCN_SHOW\n\tShow: %d\n\tScope Item: %08x\n"), arg, param);
                        break;

                case MMCN_SNAPINHELP:
                        wsprintf(message, _T("MMCN_SNAPINHELP\n"));
                        break;

                case MMCN_VIEW_CHANGE:
                        wsprintf(message, _T("MMCN_VIEW_CHANGE\n\tData: %08x\n\tHint: %08x\n"), arg, param);
                        break;
        }

        if (message[0] != 0)
                OutputDebugString(message);
        else
                OutputDebugString(_T("unknown event\n"));

#endif
        return;
}

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Taskpads/people.Cpp File Reference

  • SysMgmt
  • MMC
  • Taskpads
Functions

people.Cpp File Reference

#include <windows.h>
#include <commctrl.h>
#include <stdio.h>
#include "People.h"

Go to the source code of this file.

Functions

LPOLESTR CreateResourcePath (HINSTANCE hInst, LPOLESTR szResource)

Function Documentation

LPOLESTR CreateResourcePath | ( | HINSTANCE | hInst,
 |  | LPOLESTR | szResource
 | ) |  |

Definition at line 47 of file people.Cpp.

{
   _TCHAR szBuffer[MAX_PATH];

   ZeroMemory(szBuffer, sizeof(szBuffer));

   _tcscpy(szBuffer, _T("res://"));

   _TCHAR *szTemp = szBuffer + _tcslen(szBuffer);
   GetModuleFileName(hInst, szTemp, sizeof(szBuffer) - _tcslen(szBuffer));

   _tcscat(szBuffer, _T("/"));
   MAKE_TSTRPTR_FROMWIDE(szname, szResource);
   _tcscat(szBuffer, szname);

   MAKE_WIDEPTR_FROMTSTR(wszname, szBuffer);
   LPOLESTR szOutBuffer = static_cast<LPOLESTR>(CoTaskMemAlloc((wcslen(wszname) + 1)  * sizeof(WCHAR)));

   wcscpy(szOutBuffer, wszname);

   return szOutBuffer;

} //end CreateResoucePath()

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Taskpads/people.h File Reference

  • SysMgmt
  • MMC
  • Taskpads
Classes

people.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class | CBicycle
class | CBicycleFolder
class | CIceSkate
class | CIceSkateFolder
class | CPeoplePoweredVehicle
class | CSkateboard
class | CSkateboardFolder
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Taskpads/registry.Cpp File Reference

  • SysMgmt
  • MMC
  • Taskpads
Defines | Functions

registry.Cpp File Reference

#include <objbase.h>
#include <assert.h>
#include "Registry.h"
#include "globals.h"

Go to the source code of this file.

Defines

#define | STRINGS_ONLY

Functions

LONG | recursiveDeleteKey (HKEY hKeyParent, const _TCHAR *szKeyChild)
HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const _TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const _TCHAR *szNameString, const CLSID &clsidAbout, const BOOL fSupportExtensions)
BOOL | setKeyAndValue (const _TCHAR *pszPath, const _TCHAR *szSubkey, const _TCHAR *szValue)
BOOL | setSnapInKeyAndValue (const _TCHAR *szKey, const _TCHAR *szSubkey, const _TCHAR *szName, const _TCHAR *szValue)
BOOL | setValue (const _TCHAR *szKey, const _TCHAR *szValueName, const _TCHAR *szValue)
LONG | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Define Documentation

#define STRINGS_ONLY

Definition at line 24 of file registry.Cpp.

Function Documentation

LONG recursiveDeleteKey | ( | HKEY | hKeyParent,
 |  | const _TCHAR * | szKeyChild
 | ) |  |

Definition at line 214 of file registry.Cpp.

{
    // Open the child.
    HKEY hKeyChild ;
    LONG lRes = RegOpenKeyEx(hKeyParent, lpszKeyChild, 0,
        KEY_ALL_ACCESS, &hKeyChild) ;
    if (lRes != ERROR_SUCCESS)
    {
        return lRes ;
    }

    // Enumerate all of the decendents of this child.
    FILETIME time ;
    _TCHAR szBuffer[256] ;
    DWORD dwSize = 256 ;
    while (RegEnumKeyEx(hKeyChild, 0, szBuffer, &dwSize, NULL,
        NULL, NULL, &time) == S_OK)
    {
        // Delete the decendents of this child.
        lRes = recursiveDeleteKey(hKeyChild, szBuffer) ;
        if (lRes != ERROR_SUCCESS)
        {
            // Cleanup before exiting.
            RegCloseKey(hKeyChild) ;
            return lRes;
        }
        dwSize = 256 ;
    }

    // Close the child.
    RegCloseKey(hKeyChild) ;

    // Delete this child.
    return RegDeleteKey(hKeyParent, lpszKeyChild) ;
}

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const _TCHAR * | szFriendlyName
 | ) |  |

Definition at line 67 of file registry.Cpp.

{
    // Get server location.
    _TCHAR szModule[512] ;
    DWORD dwResult =
        ::GetModuleFileName(hModule,
        szModule,
        sizeof(szModule)/sizeof(_TCHAR)) ;

    assert(dwResult != 0) ;

    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    assert(SUCCEEDED(hr)) ;

        MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;
        _tcscat(szKey, pszCLSID) ;

    // Add the CLSID to the registry.
    setKeyAndValue(szKey, NULL, szFriendlyName) ;

    // Add the server filename subkey under the CLSID key.
    setKeyAndValue(szKey, _T("InprocServer32"), szModule) ;

    // set the threading model
    _tcscat(szKey, _T("\\InprocServer32"));
    setValue(szKey, _T("ThreadingModel"), _T("Apartment"));

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const _TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | fSupportExtensions
 | ) |  |

Definition at line 140 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    LPOLESTR wszAboutCLSID = NULL;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    if (IID_NULL != clsidAbout)
        hr = StringFromCLSID(clsidAbout, &wszAboutCLSID);

        MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);
        MAKE_TSTRPTR_FROMWIDE(pszAboutCLSID, wszAboutCLSID);

    // Add the CLSID to the registry.
    setSnapInKeyAndValue(pszCLSID, NULL, _T("NameString"), szNameString) ;
    setSnapInKeyAndValue(pszCLSID, _T("StandAlone"), NULL, NULL);
    if (IID_NULL != clsidAbout)
        setSnapInKeyAndValue(pszCLSID, NULL, _T("About"), pszAboutCLSID);

    if (fSupportExtensions) {
        // Build the key NodeType
        setSnapInKeyAndValue(pszCLSID, _T("NodeTypes"), NULL, NULL);

        _TCHAR szKey[64] ;
        _tcscpy(szKey, pszCLSID) ;
        _tcscat(szKey, _T("\\NodeTypes")) ;
        setSnapInKeyAndValue(szKey, pszCLSID, NULL, NULL);
    }

    // Free memory.
    CoTaskMemFree(wszCLSID) ;
    if (IID_NULL != clsidAbout)
        CoTaskMemFree(wszAboutCLSID);

    return S_OK ;
}

BOOL setKeyAndValue | ( | const _TCHAR * | pszPath,
 |  | const _TCHAR * | szSubkey,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 256 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Copy keyname into buffer.
    _tcscpy(szKeyBuf, szKey) ;

    // Add subkey name to buffer.
    if (szSubkey != NULL)
    {
        _tcscat(szKeyBuf, _T("\\")) ;
        _tcscat(szKeyBuf, szSubkey ) ;
    }

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, NULL, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

BOOL setSnapInKeyAndValue | ( | const _TCHAR * | szKey,
 |  | const _TCHAR * | szSubkey,
 |  | const _TCHAR * | szName,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 337 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\")) ;
    _tcscat(szKeyBuf, szKey) ;

    // Add subkey name to buffer.
    if (szSubkey != NULL)
    {
        _tcscat(szKeyBuf, _T("\\")) ;
        _tcscat(szKeyBuf, szSubkey ) ;
    }

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, szName, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

BOOL setValue | ( | const _TCHAR * | szKey,
 |  | const _TCHAR * | szValueName,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 299 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Copy keyname into buffer.
    _tcscpy(szKeyBuf, szKey) ;

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, szValueName, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

LONG UnregisterServer ( const CLSID & clsid )

Definition at line 112 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

        MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
        _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
               (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 184 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
        MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
               (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Generated on Wed Nov 13 2024 16:53:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Taskpads/registry.h File Reference

  • SysMgmt
  • MMC
  • Taskpads
Functions

registry.h File Reference

#include <tchar.h>

Go to the source code of this file.

Functions

HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const _TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const _TCHAR *szNameString, const CLSID &clsidAbout, const BOOL fSupportExtensions=FALSE)
HRESULT | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Function Documentation

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const _TCHAR * | szFriendlyName
 | ) |  |

Definition at line 67 of file registry.Cpp.

{
    // Get server location.
    _TCHAR szModule[512] ;
    DWORD dwResult =
        ::GetModuleFileName(hModule,
        szModule,
        sizeof(szModule)/sizeof(_TCHAR)) ;

    assert(dwResult != 0) ;

    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    assert(SUCCEEDED(hr)) ;

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;
  _tcscat(szKey, pszCLSID) ;

    // Add the CLSID to the registry.
    setKeyAndValue(szKey, NULL, szFriendlyName) ;

    // Add the server filename subkey under the CLSID key.
    setKeyAndValue(szKey, _T("InprocServer32"), szModule) ;

    // set the threading model
    _tcscat(szKey, _T("\\InprocServer32"));
    setValue(szKey, _T("ThreadingModel"), _T("Apartment"));

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const _TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | fSupportExtensions = FALSE
 | ) |  |

Definition at line 140 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    LPOLESTR wszAboutCLSID = NULL;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    if (IID_NULL != clsidAbout)
        hr = StringFromCLSID(clsidAbout, &wszAboutCLSID);

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszAboutCLSID, wszAboutCLSID);

    // Add the CLSID to the registry.
    setSnapInKeyAndValue(pszCLSID, NULL, _T("NameString"), szNameString) ;
    setSnapInKeyAndValue(pszCLSID, _T("StandAlone"), NULL, NULL);
    if (IID_NULL != clsidAbout)
        setSnapInKeyAndValue(pszCLSID, NULL, _T("About"), pszAboutCLSID);

    if (fSupportExtensions) {
        // Build the key NodeType
        setSnapInKeyAndValue(pszCLSID, _T("NodeTypes"), NULL, NULL);

        _TCHAR szKey[64] ;
        _tcscpy(szKey, pszCLSID) ;
        _tcscat(szKey, _T("\\NodeTypes")) ;
        setSnapInKeyAndValue(szKey, pszCLSID, NULL, NULL);
    }

    // Free memory.
    CoTaskMemFree(wszCLSID) ;
    if (IID_NULL != clsidAbout)
        CoTaskMemFree(wszAboutCLSID);

    return S_OK ;
}

HRESULT UnregisterServer ( const CLSID & clsid )

Definition at line 112 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

  MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
  _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 184 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Generated on Wed Nov 13 2024 16:53:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Taskpads/resource.h File Reference

  • SysMgmt
  • MMC
  • Taskpads
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDB_BIKE 40007
#define | IDB_BIKE2 40011
#define | IDB_BITMAP1 114
#define | IDB_CAR 40005
#define | IDB_CAR2 40009
#define | IDB_CLOSED 40014
#define | IDB_CLOSED2 40012
#define | IDB_LGBMP 113
#define | IDB_OPEN 40015
#define | IDB_OPEN2 40013
#define | IDB_PLANE 40006
#define | IDB_PLANE2 40010
#define | IDB_ROCKET 40004
#define | IDB_ROCKET2 40008
#define | IDB_SMBMP 112
#define | IDB_SMOPEN 111
#define | IDI_ICON1 108
#define | IDR_LGICONS 121
#define | IDR_SMICONS 120
#define | IDS_ABOUTNAME 9
#define | IDS_HELPFILE 1
#define | IDS_NAME 3
#define | IDS_SNAPINDESC 2
#define | IDS_SNAPINNAME 6

Define Documentation

#define IDB_BIKE 40007

Definition at line 20 of file resource.h.

#define IDB_BIKE2 40011

Definition at line 24 of file resource.h.

#define IDB_BITMAP1 114

Definition at line 14 of file resource.h.

#define IDB_CAR 40005

Definition at line 18 of file resource.h.

#define IDB_CAR2 40009

Definition at line 22 of file resource.h.

#define IDB_CLOSED 40014

Definition at line 27 of file resource.h.

#define IDB_CLOSED2 40012

Definition at line 25 of file resource.h.

#define IDB_LGBMP 113

Definition at line 13 of file resource.h.

#define IDB_OPEN 40015

Definition at line 28 of file resource.h.

#define IDB_OPEN2 40013

Definition at line 26 of file resource.h.

#define IDB_PLANE 40006

Definition at line 19 of file resource.h.

#define IDB_PLANE2 40010

Definition at line 23 of file resource.h.

#define IDB_ROCKET 40004

Definition at line 17 of file resource.h.

#define IDB_ROCKET2 40008

Definition at line 21 of file resource.h.

#define IDB_SMBMP 112

Definition at line 12 of file resource.h.

#define IDB_SMOPEN 111

Definition at line 11 of file resource.h.

#define IDI_ICON1 108

Definition at line 10 of file resource.h.

#define IDR_LGICONS 121

Definition at line 16 of file resource.h.

#define IDR_SMICONS 120

Definition at line 15 of file resource.h.

#define IDS_ABOUTNAME 9

Definition at line 9 of file resource.h.

#define IDS_HELPFILE 1

Definition at line 5 of file resource.h.

#define IDS_NAME 3

Definition at line 7 of file resource.h.

#define IDS_SNAPINDESC 2

Definition at line 6 of file resource.h.

#define IDS_SNAPINNAME 6

Definition at line 8 of file resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Taskpads/sky.Cpp File Reference

  • SysMgmt
  • MMC
  • Taskpads

sky.Cpp File Reference

#include "Sky.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Taskpads/sky.h File Reference

  • SysMgmt
  • MMC
  • Taskpads
Classes

sky.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class CSkyBasedVehicle
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Taskpads/space.Cpp File Reference

  • SysMgmt
  • MMC
  • Taskpads
Defines

space.Cpp File Reference

#include <stdio.h>
#include "Space.h"
#include "Comp.h"
#include <strsafe.h>

Go to the source code of this file.

Defines

#define STRSAFE_NO_DEPRECATE

Define Documentation

#define STRSAFE_NO_DEPRECATE

Definition at line 22 of file space.Cpp.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Taskpads/space.h File Reference

  • SysMgmt
  • MMC
  • Taskpads
Classes

space.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class | CRocket
class | CSpaceVehicle
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Taskpads/statnode.Cpp File Reference

  • SysMgmt
  • MMC
  • Taskpads

statnode.Cpp File Reference

#include "StatNode.h"
#include "Space.h"
#include "Sky.h"
#include "People.h"
#include "Land.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Taskpads/statnode.h File Reference

  • SysMgmt
  • MMC
  • Taskpads
Classes

statnode.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class CStaticNode
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Tbarext/about.Cpp File Reference

  • SysMgmt
  • MMC
  • Tbarext
Functions

about.Cpp File Reference

#include "About.h"
#include "resource.h"
#include "globals.h"
#include <crtdbg.h>

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CSnapinAbout

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 90 of file about.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        // we need to decrement our object count in the DLL
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:54:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Tbarext/about.h File Reference

  • SysMgmt
  • MMC
  • Tbarext
Classes

about.h File Reference

#include <tchar.h>
#include <mmc.h>

Go to the source code of this file.

Classes

class CSnapinAbout
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Tbarext/basesnap.Cpp File Reference

  • SysMgmt
  • MMC
  • Tbarext
Functions | Variables

basesnap.Cpp File Reference

#include <objbase.h>
#include <olectl.h>
#include <initguid.h>
#include "globals.h"
#include "resource.h"
#include "guids.h"
#include "basesnap.h"
#include "tbarExt.h"
#include "About.h"
#include "Registry.h"
#include "Extend.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)
BOOL WINAPI | DllMain (HINSTANCE hinstDLL, DWORD fdwReason, void *lpvReserved)
STDAPI | DllRegisterServer ()
STDAPI | DllUnregisterServer ()
STDMETHODIMP_ (ULONG) CClassFactory

Variables

HINSTANCE | g_hinst

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 81 of file basesnap.Cpp.

{
    if (g_uObjects == 0 && g_uSrvLock == 0)
        return S_OK;
    else
        return S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 49 of file basesnap.Cpp.

{
    if ((rclsid != CLSID_CToolBarExtension) && (rclsid != CLSID_CSnapinAbout))
        return CLASS_E_CLASSNOTAVAILABLE;

    if (!ppvObj)
        return E_FAIL;

    *ppvObj = NULL;

    // We can only hand out IUnknown and IClassFactory pointers.  Fail
    // if they ask for anything else.
    if (!IsEqualIID(riid, IID_IUnknown) && !IsEqualIID(riid, IID_IClassFactory))
        return E_NOINTERFACE;

    CClassFactory *pFactory = NULL;

    // make the factory passing in the creation function for the type of object they want
    if (rclsid == CLSID_CToolBarExtension)
        pFactory = new CClassFactory(CClassFactory::TOOLBAREXTENSION);
    else if (rclsid == CLSID_CSnapinAbout)
        pFactory = new CClassFactory(CClassFactory::ABOUT);

    if (NULL == pFactory)
        return E_OUTOFMEMORY;

    HRESULT hr = pFactory->QueryInterface(riid, ppvObj);

    return hr;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hinstDLL,
 |  | DWORD | fdwReason,
 |  | void * | lpvReserved
 | ) |  |

Definition at line 36 of file basesnap.Cpp.

{

    if (fdwReason == DLL_PROCESS_ATTACH) {
        g_hinst = hinstDLL;
    }

    return TRUE;
}

STDAPI DllRegisterServer ( void )

Definition at line 191 of file basesnap.Cpp.

{
    HRESULT hr = SELFREG_E_CLASS;

    _TCHAR szName[256];
    _TCHAR szSnapInName[256];

    LoadString(g_hinst, IDS_NAME, szName, (sizeof szName)/(sizeof szName[0]));
    LoadString(g_hinst, IDS_SNAPINNAME, szSnapInName, (sizeof szSnapInName)/(sizeof szSnapInName[0]));

    _TCHAR szAboutName[256];

    LoadString(g_hinst, IDS_ABOUTNAME, szAboutName, (sizeof szAboutName)/(sizeof szAboutName[0]));

    // register our CoClasses
    hr = RegisterServer(g_hinst,
        CLSID_CToolBarExtension,
        szName);

    if SUCCEEDED(hr)
        hr = RegisterServer(g_hinst,
        CLSID_CSnapinAbout,
        szAboutName);

    // place the registry information for SnapIns
    if SUCCEEDED(hr)
        hr = RegisterSnapin(CLSID_CToolBarExtension, szSnapInName, CLSID_CSnapinAbout);

    return hr;
}

STDAPI DllUnregisterServer ( void )

Definition at line 224 of file basesnap.Cpp.

{
    if (UnregisterServer(CLSID_CToolBarExtension) == S_OK)
        return UnregisterSnapin(CLSID_CToolBarExtension);
    else
        return E_FAIL;
}

STDMETHODIMP_ ( ULONG )

Definition at line 128 of file basesnap.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;
}

Variable Documentation

HINSTANCE g_hinst

Definition at line 33 of file basesnap.Cpp.

Generated on Wed Nov 13 2024 16:54:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Tbarext/basesnap.h File Reference

  • SysMgmt
  • MMC
  • Tbarext
Classes | Functions | Variables

basesnap.h File Reference

Go to the source code of this file.

Classes

class | CClassFactory

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)

Variables

ULONG | g_uObjects = 0
ULONG | g_uSrvLock = 0

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 53 of file ComSpyAudit.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 61 of file ComSpyAudit.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

Variable Documentation

ULONG g_uObjects = 0

Definition at line 25 of file basesnap.h.

ULONG g_uSrvLock = 0

Definition at line 26 of file basesnap.h.

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Tbarext/extend.h File Reference

  • SysMgmt
  • MMC
  • Tbarext
Classes | Enumerations

extend.h File Reference

Go to the source code of this file.

Classes

struct | EXTENDER_NODE
struct | EXTENSION_NODE

Enumerations

enum EXTENSION_TYPE {
NameSpaceExtension, ContextMenuExtension, ToolBarExtension, PropertySheetExtension,
TaskExtension, DynamicExtension, DummyExtension, NameSpaceExtension,
ContextMenuExtension, ToolBarExtension, PropertySheetExtension, TaskExtension,
DynamicExtension, DummyExtension, NameSpaceExtension, ContextMenuExtension,
ToolBarExtension, PropertySheetExtension, TaskExtension, DynamicExtension,
DummyExtension, NameSpaceExtension, ContextMenuExtension, ToolBarExtension,
PropertySheetExtension, TaskExtension, DynamicExtension, DummyExtension
}

Enumeration Type Documentation

enum EXTENSION_TYPE
Enumerator:
NameSpaceExtension
ContextMenuExtension
ToolBarExtension
PropertySheetExtension
TaskExtension
DynamicExtension
DummyExtension
NameSpaceExtension
ContextMenuExtension
ToolBarExtension
PropertySheetExtension
TaskExtension
DynamicExtension
DummyExtension
NameSpaceExtension
ContextMenuExtension
ToolBarExtension
PropertySheetExtension
TaskExtension
DynamicExtension
DummyExtension
NameSpaceExtension
ContextMenuExtension
ToolBarExtension
PropertySheetExtension
TaskExtension
DynamicExtension
DummyExtension

Definition at line 30 of file extend.h.

{
    NameSpaceExtension,
        ContextMenuExtension,
        ToolBarExtension,
        PropertySheetExtension,
        TaskExtension,
        DynamicExtension,
    DummyExtension
};

Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Tbarext/globals.h File Reference

  • SysMgmt
  • MMC
  • Tbarext
Classes | Defines | Variables

globals.h File Reference

#include <tchar.h>

Go to the source code of this file.

Classes

class | TempBuffer

Defines

#define | IDM_BUTTON1 0x100
#define | IDM_BUTTON2 0x101
#define | MAKE_TSTRPTR_FROMWIDE(ptrname, widestr)
#define | MAKE_WIDEPTR_FROMTSTR(ptrname, tstr)
#define | MAKE_WIDEPTR_FROMTSTR_ALLOC(ptrname, tstr)
#define | OBJECT_CREATED InterlockedIncrement((long *)&g_uObjects);
#define | OBJECT_DESTROYED InterlockedDecrement((long *)&g_uObjects);

Variables

HINSTANCE | g_hinst
ULONG g_uObjects

Define Documentation

#define IDM_BUTTON1 0x100

Definition at line 26 of file globals.h.

#define IDM_BUTTON2 0x101

Definition at line 27 of file globals.h.

#define MAKE_TSTRPTR_FROMWIDE | ( | ptrname,
 |  | widestr
 | ) |
Value:
long __l##ptrname = (wcslen(widestr) + 1) * 2 * sizeof(TCHAR); \
    TempBuffer __TempBuffer##ptrname(__l##ptrname); \
    WideCharToMultiByte(CP_ACP, 0, widestr, -1, (LPSTR)__TempBuffer##ptrname.GetBuffer(), __l##ptrname, NULL, NULL); \
    LPTSTR ptrname = (LPTSTR)__TempBuffer##ptrname.GetBuffer()

Definition at line 119 of file globals.h.

#define MAKE_WIDEPTR_FROMTSTR | ( | ptrname,
 |  | tstr
 | ) |
Value:
long __cch##ptrname = (lstrlenA(tstr) + 1);\
    long __l##ptrname = (lstrlenA(tstr) + 1) * sizeof(WCHAR); \
    TempBuffer __TempBuffer##ptrname(__l##ptrname); \
    MultiByteToWideChar(CP_ACP, 0, tstr, -1, (LPWSTR)__TempBuffer##ptrname.GetBuffer(), __cch##ptrname); \
    LPWSTR ptrname = (LPWSTR)__TempBuffer##ptrname.GetBuffer()

Definition at line 85 of file globals.h.

#define MAKE_WIDEPTR_FROMTSTR_ALLOC | ( | ptrname,
 |  | tstr
 | ) |
Value:
long __cch##ptrname = (lstrlenA(tstr) + 1);\
    long __l##ptrname = (lstrlenA(tstr) + 1) * sizeof(WCHAR); \
    LPWSTR ptrname = (LPWSTR)CoTaskMemAlloc(__l##ptrname); \
    MultiByteToWideChar(CP_ACP, 0, tstr, -1, ptrname, __cch##ptrname)

Definition at line 99 of file globals.h.

#define OBJECT_CREATED InterlockedIncrement((long *)&g_uObjects);

Definition at line 32 of file globals.h.

#define OBJECT_DESTROYED InterlockedDecrement((long *)&g_uObjects);

Definition at line 33 of file globals.h.

Variable Documentation

HINSTANCE g_hinst

Definition at line 33 of file SetDisp.h.

ULONG g_uObjects

Definition at line 24 of file basesnap.h.

Generated on Wed Nov 13 2024 16:54:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Tbarext/guids.h File Reference

  • SysMgmt
  • MMC
  • Tbarext
Functions

guids.h File Reference

Go to the source code of this file.

Functions

DEFINE_GUID (CLSID_CToolBarExtension, 0x20e42dd2, 0x5ccf, 0x11d3, 0x91, 0x47, 0x0, 0xc0, 0x4f, 0x65, 0xb3, 0xf9)
DEFINE_GUID (CLSID_CSnapinAbout, 0x3e66fcd0, 0x5ccf, 0x11d3, 0x91, 0x47, 0x0, 0xc0, 0x4f, 0x65, 0xb3, 0xf9)

Function Documentation

DEFINE_GUID | ( | CLSID_CToolBarExtension | ,
 |  | 0x20e42dd2 | ,
 |  | 0x5ccf | ,
 |  | 0x11d3 | ,
 |  | 0x91 | ,
 |  | 0x47 | ,
 |  | 0x0 | ,
 |  | 0xc0 | ,
 |  | 0x4f | ,
 |  | 0x65 | ,
 |  | 0xb3 | ,
 |  | 0xf9 |
 | ) |  |
DEFINE_GUID | ( | CLSID_CSnapinAbout | ,
 |  | 0x3e66fcd0 | ,
 |  | 0x5ccf | ,
 |  | 0x11d3 | ,
 |  | 0x91 | ,
 |  | 0x47 | ,
 |  | 0x0 | ,
 |  | 0xc0 | ,
 |  | 0x4f | ,
 |  | 0x65 | ,
 |  | 0xb3 | ,
 |  | 0xf9 |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Tbarext/localres.h File Reference

  • SysMgmt
  • MMC
  • Tbarext
Defines

localres.h File Reference

Go to the source code of this file.

Defines

#define | INDEX_CLOSEDFOLDER 4
#define | INDEX_CLOUD 9
#define | INDEX_LANDICON 1
#define | INDEX_NONE -1
#define | INDEX_OPENFOLDER 5
#define | INDEX_PEOPLEICON 3
#define | INDEX_RAIN 8
#define | INDEX_SKYICON 2
#define | INDEX_SNOW 7
#define | INDEX_SPACEICON 0
#define | INDEX_SUN 6
#define | INDEX_THUNDER 11
#define | INDEX_WORLD 10

Define Documentation

#define INDEX_CLOSEDFOLDER 4

Definition at line 28 of file localres.h.

#define INDEX_CLOUD 9

Definition at line 34 of file localres.h.

#define INDEX_LANDICON 1

Definition at line 25 of file localres.h.

#define INDEX_NONE -1

Definition at line 23 of file localres.h.

#define INDEX_OPENFOLDER 5

Definition at line 29 of file localres.h.

#define INDEX_PEOPLEICON 3

Definition at line 27 of file localres.h.

#define INDEX_RAIN 8

Definition at line 33 of file localres.h.

#define INDEX_SKYICON 2

Definition at line 26 of file localres.h.

#define INDEX_SNOW 7

Definition at line 32 of file localres.h.

#define INDEX_SPACEICON 0

Definition at line 24 of file localres.h.

#define INDEX_SUN 6

Definition at line 31 of file localres.h.

#define INDEX_THUNDER 11

Definition at line 36 of file localres.h.

#define INDEX_WORLD 10

Definition at line 35 of file localres.h.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Tbarext/registry.Cpp File Reference

  • SysMgmt
  • MMC
  • Tbarext
Defines | Functions | Variables

registry.Cpp File Reference

#include <objbase.h>
#include <assert.h>
#include "Registry.h"
#include "Extend.h"
#include "globals.h"

Go to the source code of this file.

Defines

#define | STRINGS_ONLY

Functions

LONG | recursiveDeleteKey (HKEY hKeyParent, const _TCHAR *szKeyChild)
HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const _TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const _TCHAR *szNameString, const CLSID &clsidAbout, const BOOL fSupportExtensions)
BOOL | setKeyAndValue (const _TCHAR *pszPath, const _TCHAR *szSubkey, const _TCHAR *szValue)
BOOL | setSnapInKeyAndValue (const _TCHAR *szKey, const _TCHAR *szSubkey, const _TCHAR *szName, const _TCHAR *szValue)
BOOL | setValue (const _TCHAR *szKey, const _TCHAR *szValueName, const _TCHAR *szValue)
LONG | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Variables

EXTENDER_NODE _NodeExtensions []

Define Documentation

#define STRINGS_ONLY

Definition at line 24 of file registry.Cpp.

Function Documentation

LONG recursiveDeleteKey | ( | HKEY | hKeyParent,
 |  | const _TCHAR * | szKeyChild
 | ) |  |

Definition at line 283 of file registry.Cpp.

{
    // Open the child.
    HKEY hKeyChild ;
    LONG lRes = RegOpenKeyEx(hKeyParent, lpszKeyChild, 0,
        KEY_ALL_ACCESS, &hKeyChild) ;
    if (lRes != ERROR_SUCCESS)
    {
        return lRes ;
    }

    // Enumerate all of the decendents of this child.
    FILETIME time ;
    _TCHAR szBuffer[256] ;
    DWORD dwSize = 256 ;
    while (RegEnumKeyEx(hKeyChild, 0, szBuffer, &dwSize, NULL,
        NULL, NULL, &time) == S_OK)
    {
        // Delete the decendents of this child.
        lRes = recursiveDeleteKey(hKeyChild, szBuffer) ;
        if (lRes != ERROR_SUCCESS)
        {
            // Cleanup before exiting.
            RegCloseKey(hKeyChild) ;
            return lRes;
        }
        dwSize = 256 ;
    }

    // Close the child.
    RegCloseKey(hKeyChild) ;

    // Delete this child.
    return RegDeleteKey(hKeyParent, lpszKeyChild) ;
}

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const _TCHAR * | szFriendlyName
 | ) |  |

Definition at line 82 of file registry.Cpp.

{
    // Get server location.
    _TCHAR szModule[512] ;
    DWORD dwResult =
        ::GetModuleFileName(hModule,
        szModule,
        sizeof(szModule)/sizeof(_TCHAR)) ;

    assert(dwResult != 0) ;

    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    assert(SUCCEEDED(hr)) ;

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;
  _tcscat(szKey, pszCLSID) ;

    // Add the CLSID to the registry.
    setKeyAndValue(szKey, NULL, szFriendlyName) ;

    // Add the server filename subkey under the CLSID key.
    setKeyAndValue(szKey, _T("InprocServer32"), szModule) ;

    // set the threading model
    _tcscat(szKey, _T("\\InprocServer32"));
    setValue(szKey, _T("ThreadingModel"), _T("Apartment"));

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const _TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | fSupportExtensions
 | ) |  |

Definition at line 156 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    LPOLESTR wszAboutCLSID = NULL;
    LPOLESTR wszExtendCLSID = NULL;
    LPOLESTR wszNodeCLSID = NULL;
    EXTENDER_NODE *pNodeExtension;
    _TCHAR szKeyBuf[1024] ;
    HKEY hKey;

    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    if (IID_NULL != clsidAbout)
        hr = StringFromCLSID(clsidAbout, &wszAboutCLSID);

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszAboutCLSID, wszAboutCLSID);

    // Add the CLSID to the registry.
    setSnapInKeyAndValue(pszCLSID, NULL, _T("NameString"), szNameString) ;
    if (IID_NULL != clsidAbout)
        setSnapInKeyAndValue(pszCLSID, NULL, _T("About"), pszAboutCLSID);

    if (fSupportExtensions) {
        // Build the key NodeType
        setSnapInKeyAndValue(pszCLSID, _T("NodeTypes"), NULL, NULL);

        _TCHAR szKey[64] ;
        _tcscpy(szKey, pszCLSID) ;
        _tcscat(szKey, _T("\\NodeTypes")) ;
        setSnapInKeyAndValue(szKey, pszCLSID, NULL, NULL);
    }

    // register each of the node extensions
    for (pNodeExtension = &(_NodeExtensions[0]);*pNodeExtension->szDescription;pNodeExtension++)
    {
        hr = StringFromCLSID(pNodeExtension->guidNode, &wszExtendCLSID);
        MAKE_TSTRPTR_FROMWIDE(pszExtendCLSID, wszExtendCLSID);
        _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\NodeTypes\\"));
        _tcscat(szKeyBuf, pszExtendCLSID);

        switch (pNodeExtension->eType) {
        case ToolBarExtension:
            _tcscat(szKeyBuf, _T("\\Extensions\\ToolBar"));
            break;
        default:
            break;
        }

        // Create and open key and subkey.
        long lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE ,
            szKeyBuf,
            0, NULL, REG_OPTION_NON_VOLATILE,
            KEY_ALL_ACCESS, NULL,
            &hKey, NULL) ;

        if (lResult != ERROR_SUCCESS)
        {
            return FALSE ;
        }

        hr = StringFromCLSID(pNodeExtension->guidExtension, &wszNodeCLSID);
        assert(SUCCEEDED(hr));

        MAKE_TSTRPTR_FROMWIDE(pszNodeCLSID, wszNodeCLSID);
        // Set the Value.
        if (pNodeExtension->szDescription != NULL)
        {
            RegSetValueEx(hKey, pszNodeCLSID, 0, REG_SZ,
                (BYTE *)pNodeExtension->szDescription,
                (_tcslen(pNodeExtension->szDescription)+1)*sizeof(_TCHAR)) ;
        }

        RegCloseKey(hKey) ;

        CoTaskMemFree(wszExtendCLSID);
        CoTaskMemFree(wszNodeCLSID);
    }

    // Free memory.
    CoTaskMemFree(wszCLSID) ;
    if (IID_NULL != clsidAbout)
        CoTaskMemFree(wszAboutCLSID);

    return S_OK ;
}

BOOL setKeyAndValue | ( | const _TCHAR * | pszPath,
 |  | const _TCHAR * | szSubkey,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 325 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Copy keyname into buffer.
    _tcscpy(szKeyBuf, szKey) ;

    // Add subkey name to buffer.
    if (szSubkey != NULL)
    {
        _tcscat(szKeyBuf, _T("\\")) ;
        _tcscat(szKeyBuf, szSubkey ) ;
    }

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, NULL, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

BOOL setSnapInKeyAndValue | ( | const _TCHAR * | szKey,
 |  | const _TCHAR * | szSubkey,
 |  | const _TCHAR * | szName,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 406 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\")) ;
    _tcscat(szKeyBuf, szKey) ;

    // Add subkey name to buffer.
    if (szSubkey != NULL)
    {
        _tcscat(szKeyBuf, _T("\\")) ;
        _tcscat(szKeyBuf, szSubkey ) ;
    }

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, szName, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

BOOL setValue | ( | const _TCHAR * | szKey,
 |  | const _TCHAR * | szValueName,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 368 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Copy keyname into buffer.
    _tcscpy(szKeyBuf, szKey) ;

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, szValueName, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

LONG UnregisterServer ( const CLSID & clsid )

Definition at line 127 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

  MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
  _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 253 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Variable Documentation

EXTENDER_NODE _NodeExtensions[]
Initial value:
 {
    {ToolBarExtension,
    {0x29743811, 0x4c4b, 0x11d2, { 0x89, 0xd8, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28}},
    {0x20e42dd2, 0x5ccf, 0x11d3, {0x91, 0x47, 0x0, 0xc0, 0x4f, 0x65, 0xb3, 0xf9}},
    _T("Extension to the Vehicle Node Toolbar")},

    {DummyExtension,
    NULL,
    NULL,
    NULL}
}

Definition at line 30 of file registry.Cpp.

Generated on Wed Nov 13 2024 16:53:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Tbarext/registry.h File Reference

  • SysMgmt
  • MMC
  • Tbarext
Functions

registry.h File Reference

#include <tchar.h>

Go to the source code of this file.

Functions

HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const _TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const _TCHAR *szNameString, const CLSID &clsidAbout, const BOOL fSupportExtensions=FALSE)
HRESULT | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Function Documentation

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const _TCHAR * | szFriendlyName
 | ) |  |

Definition at line 67 of file registry.Cpp.

{
    // Get server location.
    _TCHAR szModule[512] ;
    DWORD dwResult =
        ::GetModuleFileName(hModule,
        szModule,
        sizeof(szModule)/sizeof(_TCHAR)) ;

    assert(dwResult != 0) ;

    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    assert(SUCCEEDED(hr)) ;

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;
  _tcscat(szKey, pszCLSID) ;

    // Add the CLSID to the registry.
    setKeyAndValue(szKey, NULL, szFriendlyName) ;

    // Add the server filename subkey under the CLSID key.
    setKeyAndValue(szKey, _T("InprocServer32"), szModule) ;

    // set the threading model
    _tcscat(szKey, _T("\\InprocServer32"));
    setValue(szKey, _T("ThreadingModel"), _T("Apartment"));

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const _TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | fSupportExtensions = FALSE
 | ) |  |

Definition at line 140 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    LPOLESTR wszAboutCLSID = NULL;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    if (IID_NULL != clsidAbout)
        hr = StringFromCLSID(clsidAbout, &wszAboutCLSID);

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszAboutCLSID, wszAboutCLSID);

    // Add the CLSID to the registry.
    setSnapInKeyAndValue(pszCLSID, NULL, _T("NameString"), szNameString) ;
    setSnapInKeyAndValue(pszCLSID, _T("StandAlone"), NULL, NULL);
    if (IID_NULL != clsidAbout)
        setSnapInKeyAndValue(pszCLSID, NULL, _T("About"), pszAboutCLSID);

    if (fSupportExtensions) {
        // Build the key NodeType
        setSnapInKeyAndValue(pszCLSID, _T("NodeTypes"), NULL, NULL);

        _TCHAR szKey[64] ;
        _tcscpy(szKey, pszCLSID) ;
        _tcscat(szKey, _T("\\NodeTypes")) ;
        setSnapInKeyAndValue(szKey, pszCLSID, NULL, NULL);
    }

    // Free memory.
    CoTaskMemFree(wszCLSID) ;
    if (IID_NULL != clsidAbout)
        CoTaskMemFree(wszAboutCLSID);

    return S_OK ;
}

HRESULT UnregisterServer ( const CLSID & clsid )

Definition at line 112 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

  MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
  _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 184 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Tbarext/resource.h File Reference

  • SysMgmt
  • MMC
  • Tbarext
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | ID_BUTTON40016 40016
#define | ID_BUTTON40017 40017
#define | ID_BUTTON40018 40018
#define | ID_BUTTON40019 40019
#define | ID_BUTTON40020 40020
#define | ID_BUTTON40021 40021
#define | ID_BUTTON40022 40022
#define | ID_BUTTON40023 40023
#define | ID_BUTTON40024 40024
#define | ID_BUTTON40025 40025
#define | ID_BUTTON40026 40026
#define | ID_BUTTONPAUSE 40022
#define | ID_BUTTONSTART 40021
#define | ID_BUTTONSTOP 40023
#define | IDB_BIKE 40007
#define | IDB_BIKE2 40011
#define | IDB_CAR 40005
#define | IDB_CAR2 40009
#define | IDB_CLOSED 40014
#define | IDB_CLOSED2 40012
#define | IDB_LGBMP 126
#define | IDB_OPEN 40015
#define | IDB_OPEN2 40013
#define | IDB_PLANE 40006
#define | IDB_PLANE2 40010
#define | IDB_ROCKET 40004
#define | IDB_ROCKET2 40008
#define | IDB_SMBMP 125
#define | IDB_SMOPEN 124
#define | IDI_ICON1 108
#define | IDR_LGICONS 121
#define | IDR_SMICONS 120
#define | IDR_TOOLBAR1 112
#define | IDS_ABOUTNAME 9
#define | IDS_HELPFILE 1
#define | IDS_NAME 3
#define | IDS_SNAPINDESC 2
#define | IDS_SNAPINNAME 6

Define Documentation

#define ID_BUTTON40016 40016

Definition at line 29 of file resource.h.

#define ID_BUTTON40017 40017

Definition at line 30 of file resource.h.

#define ID_BUTTON40018 40018

Definition at line 31 of file resource.h.

#define ID_BUTTON40019 40019

Definition at line 32 of file resource.h.

#define ID_BUTTON40020 40020

Definition at line 33 of file resource.h.

#define ID_BUTTON40021 40021

Definition at line 34 of file resource.h.

#define ID_BUTTON40022 40022

Definition at line 36 of file resource.h.

#define ID_BUTTON40023 40023

Definition at line 38 of file resource.h.

#define ID_BUTTON40024 40024

Definition at line 40 of file resource.h.

#define ID_BUTTON40025 40025

Definition at line 41 of file resource.h.

#define ID_BUTTON40026 40026

Definition at line 42 of file resource.h.

#define ID_BUTTONPAUSE 40022

Definition at line 37 of file resource.h.

#define ID_BUTTONSTART 40021

Definition at line 35 of file resource.h.

#define ID_BUTTONSTOP 40023

Definition at line 39 of file resource.h.

#define IDB_BIKE 40007

Definition at line 20 of file resource.h.

#define IDB_BIKE2 40011

Definition at line 24 of file resource.h.

#define IDB_CAR 40005

Definition at line 18 of file resource.h.

#define IDB_CAR2 40009

Definition at line 22 of file resource.h.

#define IDB_CLOSED 40014

Definition at line 27 of file resource.h.

#define IDB_CLOSED2 40012

Definition at line 25 of file resource.h.

#define IDB_LGBMP 126

Definition at line 16 of file resource.h.

#define IDB_OPEN 40015

Definition at line 28 of file resource.h.

#define IDB_OPEN2 40013

Definition at line 26 of file resource.h.

#define IDB_PLANE 40006

Definition at line 19 of file resource.h.

#define IDB_PLANE2 40010

Definition at line 23 of file resource.h.

#define IDB_ROCKET 40004

Definition at line 17 of file resource.h.

#define IDB_ROCKET2 40008

Definition at line 21 of file resource.h.

#define IDB_SMBMP 125

Definition at line 15 of file resource.h.

#define IDB_SMOPEN 124

Definition at line 14 of file resource.h.

#define IDI_ICON1 108

Definition at line 10 of file resource.h.

#define IDR_LGICONS 121

Definition at line 13 of file resource.h.

#define IDR_SMICONS 120

Definition at line 12 of file resource.h.

#define IDR_TOOLBAR1 112

Definition at line 11 of file resource.h.

#define IDS_ABOUTNAME 9

Definition at line 9 of file resource.h.

#define IDS_HELPFILE 1

Definition at line 5 of file resource.h.

#define IDS_NAME 3

Definition at line 7 of file resource.h.

#define IDS_SNAPINDESC 2

Definition at line 6 of file resource.h.

#define IDS_SNAPINNAME 6

Definition at line 8 of file resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Tbarext/tbarext.Cpp File Reference

  • SysMgmt
  • MMC
  • Tbarext
Defines | Functions

tbarext.Cpp File Reference

#include "tbarExt.h"
#include "globals.h"
#include "resource.h"
#include <commctrl.h>
#include <crtdbg.h>
#include <stdio.h>

Go to the source code of this file.

Defines

#define | _T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")
#define | _T_CCF_NODETYPE _T("CCF_NODETYPE")
#define | _T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")
#define | ARRAYLEN(x) (sizeof(x) / sizeof((x)[0]))

Functions

STDMETHODIMP_ (ULONG) CToolBarExtension

Define Documentation

#define _T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")

Definition at line 33 of file tbarext.Cpp.

#define _T_CCF_NODETYPE _T("CCF_NODETYPE")

Definition at line 34 of file tbarext.Cpp.

#define _T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")

Definition at line 35 of file tbarext.Cpp.

#define ARRAYLEN ( x ) (sizeof(x) / sizeof((x)[0]))

Definition at line 28 of file tbarext.Cpp.

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 86 of file tbarext.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        // we need to decrement our object count in the DLL
        delete this;
        return 0;
    }

    return m_cref;
}

Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Tbarext/tbarext.h File Reference

  • SysMgmt
  • MMC
  • Tbarext
Classes

tbarext.h File Reference

#include <tchar.h>
#include <mmc.h>

Go to the source code of this file.

Classes

class CToolBarExtension
Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Toolbar/about.Cpp File Reference

  • SysMgmt
  • MMC
  • Toolbar
Functions

about.Cpp File Reference

#include "About.h"
#include "resource.h"
#include "globals.h"
#include <crtdbg.h>

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CSnapinAbout

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 89 of file about.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        // we need to decrement our object count in the DLL
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:54:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Toolbar/about.h File Reference

  • SysMgmt
  • MMC
  • Toolbar
Classes

about.h File Reference

#include <tchar.h>
#include <mmc.h>

Go to the source code of this file.

Classes

class CSnapinAbout
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Toolbar/basesnap.Cpp File Reference

  • SysMgmt
  • MMC
  • Toolbar
Functions | Variables

basesnap.Cpp File Reference

#include <objbase.h>
#include <olectl.h>
#include <initguid.h>
#include "guids.h"
#include "basesnap.h"
#include "Comp.h"
#include "CompData.h"
#include "About.h"
#include "Registry.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)
BOOL WINAPI | DllMain (HINSTANCE hinstDLL, DWORD fdwReason, void *lpvReserved)
STDAPI | DllRegisterServer ()
STDAPI | DllUnregisterServer ()
STDMETHODIMP_ (ULONG) CClassFactory

Variables

HINSTANCE | g_hinst

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 77 of file basesnap.Cpp.

{
    if (g_uObjects == 0 && g_uSrvLock == 0)
        return S_OK;
    else
        return S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 45 of file basesnap.Cpp.

{
    if ((rclsid != CLSID_CComponentData) && (rclsid != CLSID_CSnapinAbout))
        return CLASS_E_CLASSNOTAVAILABLE;

    if (!ppvObj)
        return E_FAIL;

    *ppvObj = NULL;

    // We can only hand out IUnknown and IClassFactory pointers.  Fail
    // if they ask for anything else.
    if (!IsEqualIID(riid, IID_IUnknown) && !IsEqualIID(riid, IID_IClassFactory))
        return E_NOINTERFACE;

    CClassFactory *pFactory = NULL;

    // make the factory passing in the creation function for the type of object they want
    if (rclsid == CLSID_CComponentData)
        pFactory = new CClassFactory(CClassFactory::COMPONENT);
    else if (rclsid == CLSID_CSnapinAbout)
        pFactory = new CClassFactory(CClassFactory::ABOUT);

    if (NULL == pFactory)
        return E_OUTOFMEMORY;

    HRESULT hr = pFactory->QueryInterface(riid, ppvObj);

    return hr;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hinstDLL,
 |  | DWORD | fdwReason,
 |  | void * | lpvReserved
 | ) |  |

Definition at line 32 of file basesnap.Cpp.

{

    if (fdwReason == DLL_PROCESS_ATTACH) {
        g_hinst = hinstDLL;
    }

    return TRUE;
}

STDAPI DllRegisterServer ( void )

Definition at line 187 of file basesnap.Cpp.

{
    HRESULT hr = SELFREG_E_CLASS;
    _TCHAR szName[256];
    _TCHAR szSnapInName[256];

    LoadString(g_hinst, IDS_NAME, szName, (sizeof szName)/(sizeof szName[0]));
    LoadString(g_hinst, IDS_SNAPINNAME, szSnapInName, (sizeof szSnapInName)/(sizeof szSnapInName[0]));

    _TCHAR szAboutName[256];

    LoadString(g_hinst, IDS_ABOUTNAME, szAboutName, (sizeof szAboutName)/(sizeof szAboutName[0]));

    // register our CoClasses
    hr = RegisterServer(g_hinst,
        CLSID_CComponentData,
        szName);

    if SUCCEEDED(hr)
        hr = RegisterServer(g_hinst,
        CLSID_CSnapinAbout,
        szAboutName);

    // place the registry information for SnapIns
    if SUCCEEDED(hr)
        hr = RegisterSnapin(CLSID_CComponentData, szSnapInName, CLSID_CSnapinAbout, FALSE);

    return hr;
}

STDAPI DllUnregisterServer ( void )

Definition at line 218 of file basesnap.Cpp.

{
    if (UnregisterServer(CLSID_CComponentData) == S_OK)
        return UnregisterSnapin(CLSID_CComponentData);
    else
        return E_FAIL;
}

STDMETHODIMP_ ( ULONG )

Definition at line 124 of file basesnap.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;
}

Variable Documentation

HINSTANCE g_hinst

Definition at line 30 of file basesnap.Cpp.

Generated on Wed Nov 13 2024 16:54:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Toolbar/basesnap.h File Reference

  • SysMgmt
  • MMC
  • Toolbar
Classes | Functions | Variables

basesnap.h File Reference

Go to the source code of this file.

Classes

class | CClassFactory

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)

Variables

ULONG | g_uObjects = 0
ULONG | g_uSrvLock = 0

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 53 of file ComSpyAudit.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 61 of file ComSpyAudit.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

Variable Documentation

ULONG g_uObjects = 0

Definition at line 24 of file basesnap.h.

ULONG g_uSrvLock = 0

Definition at line 25 of file basesnap.h.

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Toolbar/comp.Cpp File Reference

  • SysMgmt
  • MMC
  • Toolbar
Defines | Functions

comp.Cpp File Reference

#include "Comp.h"
#include "DataObj.h"
#include <commctrl.h>
#include <crtdbg.h>
#include "globals.h"
#include "resource.h"
#include "DeleBase.h"
#include "CompData.h"

Go to the source code of this file.

Defines

#define ARRAYLEN(x) (sizeof(x) / sizeof((x)[0]))

Functions

STDMETHODIMP_ (ULONG) CComponent

Define Documentation

#define ARRAYLEN ( x ) (sizeof(x) / sizeof((x)[0]))

Definition at line 28 of file comp.Cpp.

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 73 of file comp.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Toolbar/comp.h File Reference

  • SysMgmt
  • MMC
  • Toolbar
Classes

comp.h File Reference

#include <mmc.h>

Go to the source code of this file.

Classes

class CComponent
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Toolbar/compdata.Cpp File Reference

  • SysMgmt
  • MMC
  • Toolbar
Functions

compdata.Cpp File Reference

#include "Comp.h"
#include "CompData.h"
#include "DataObj.h"
#include "resource.h"
#include <crtdbg.h>

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CComponentData

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 83 of file compdata.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        // we need to decrement our object count in the DLL
        delete this;
        return 0;
    }

    return m_cref;
}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Toolbar/compdata.h File Reference

  • SysMgmt
  • MMC
  • Toolbar
Classes

compdata.h File Reference

#include <mmc.h>
#include "DeleBase.h"
#include "StatNode.h"
#include "Comp.h"
#include "DeleBase.h"
#include "StatNode.h"

Go to the source code of this file.

Classes

class CComponentData
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Toolbar/dataobj.Cpp File Reference

  • SysMgmt
  • MMC
  • Toolbar
Defines | Functions

dataobj.Cpp File Reference

#include "DataObj.h"
#include "guids.h"
#include "DeleBase.h"

Go to the source code of this file.

Defines

#define | _T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")
#define | _T_CCF_INTERNAL_SNAPIN _T("{2479DB32-5276-11d2-94F5-00C04FB92EC2}")
#define | _T_CCF_NODETYPE _T("CCF_NODETYPE")
#define | _T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")
#define | _T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")

Functions

CDataObject * | GetOurDataObject (LPDATAOBJECT lpDataObject)
STDMETHODIMP_ (ULONG) CDataObject

Define Documentation

#define _T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")

Definition at line 31 of file dataobj.Cpp.

#define _T_CCF_INTERNAL_SNAPIN _T("{2479DB32-5276-11d2-94F5-00C04FB92EC2}")

Definition at line 36 of file dataobj.Cpp.

#define _T_CCF_NODETYPE _T("CCF_NODETYPE")

Definition at line 32 of file dataobj.Cpp.

#define _T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")

Definition at line 34 of file dataobj.Cpp.

#define _T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")

Definition at line 33 of file dataobj.Cpp.

Function Documentation

CDataObject* GetOurDataObject ( LPDATAOBJECT lpDataObject )

Definition at line 165 of file dataobj.Cpp.

{
    HRESULT       hr      = S_OK;
    CDataObject *pSDO     = NULL;

  // check to see if the data object is a special data object.
  if ( IS_SPECIAL_DATAOBJECT (lpDataObject) )
  {
    //Code for handling a special data object goes here.

    //Note that the MMC SDK samples do not handle
    //special data objects, so we exit if we get one.
    return NULL;
  }

    STGMEDIUM stgmedium = { TYMED_HGLOBAL,  NULL  };
    FORMATETC formatetc = { CDataObject::s_cfInternal, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };

    // Allocate memory for the stream
    stgmedium.hGlobal = GlobalAlloc( GMEM_SHARE, sizeof(CDataObject *));

    if (!stgmedium.hGlobal)     {
        hr = E_OUTOFMEMORY;
    }

    if SUCCEEDED(hr)
        // Attempt to get data from the object
        hr = lpDataObject->GetDataHere( &formatetc, &stgmedium );

    // stgmedium now has the data we need
    if (SUCCEEDED(hr))  {
        pSDO = *(CDataObject **)(stgmedium.hGlobal);
    }

    // if we have memory free it
    if (stgmedium.hGlobal)
        GlobalFree(stgmedium.hGlobal);

    return pSDO;

} // end GetOurDataObject()

STDMETHODIMP_ ( ULONG )

Definition at line 87 of file dataobj.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Toolbar/dataobj.h File Reference

  • SysMgmt
  • MMC
  • Toolbar
Classes | Functions

dataobj.h File Reference

#include <mmc.h>
#include "DeleBase.h"

Go to the source code of this file.

Classes

class | CDataObject

Functions

HRESULT | ExtractFromDataObject (IDataObject *lpDataObject, UINT cf, ULONG cb, HGLOBAL *phGlobal)
CDataObject * | GetOurDataObject (IDataObject *lpDataObject)
BOOL | IsMMCMultiSelectDataObject (IDataObject *lpDataObject)

Function Documentation

HRESULT ExtractFromDataObject | ( | IDataObject * | lpDataObject,
 |  | UINT | cf,
 |  | ULONG | cb,
 |  | HGLOBAL * | phGlobal
 | ) |  |
CDataObject* GetOurDataObject ( IDataObject * lpDataObject )
BOOL IsMMCMultiSelectDataObject ( IDataObject * lpDataObject )
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Toolbar/delebase.Cpp File Reference

  • SysMgmt
  • MMC
  • Toolbar

delebase.Cpp File Reference

#include "DeleBase.h"
#include "Comp.h"
#include "CompData.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Toolbar/delebase.h File Reference

  • SysMgmt
  • MMC
  • Toolbar
Classes

delebase.h File Reference

#include <mmc.h>
#include <crtdbg.h>
#include "globals.h"
#include "resource.h"
#include "LocalRes.h"
#include "LocalRes.h"

Go to the source code of this file.

Classes

class CDelegationBase
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Toolbar/globals.h File Reference

  • SysMgmt
  • MMC
  • Toolbar
Classes | Defines | Functions | Variables

globals.h File Reference

#include <tchar.h>

Go to the source code of this file.

Classes

class | TempBuffer

Defines

#define | IDM_BUTTON1 0x100
#define | IDM_BUTTON2 0x101
#define | MAKE_TSTRPTR_FROMWIDE(ptrname, widestr)
#define | MAKE_WIDEPTR_FROMTSTR(ptrname, tstr)
#define | MAKE_WIDEPTR_FROMTSTR_ALLOC(ptrname, tstr)
#define | OBJECT_CREATED InterlockedIncrement((long *)&g_uObjects);
#define | OBJECT_DESTROYED InterlockedDecrement((long *)&g_uObjects);

Functions

void | MMCN_Crack (BOOL bComponentData, IDataObject *pDataObject, IComponentData *pCompData, IComponent *pComp, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)

Variables

HINSTANCE | g_hinst
ULONG g_uObjects

Define Documentation

#define IDM_BUTTON1 0x100

Definition at line 25 of file globals.h.

#define IDM_BUTTON2 0x101

Definition at line 26 of file globals.h.

#define MAKE_TSTRPTR_FROMWIDE | ( | ptrname,
 |  | widestr
 | ) |
Value:
long __l##ptrname = (wcslen(widestr) + 1) * 2 * sizeof(TCHAR); \
    TempBuffer __TempBuffer##ptrname(__l##ptrname); \
    WideCharToMultiByte(CP_ACP, 0, widestr, -1, (LPSTR)__TempBuffer##ptrname.GetBuffer(), __l##ptrname, NULL, NULL); \
    LPTSTR ptrname = (LPTSTR)__TempBuffer##ptrname.GetBuffer()

Definition at line 127 of file globals.h.

#define MAKE_WIDEPTR_FROMTSTR | ( | ptrname,
 |  | tstr
 | ) |
Value:
long __cch##ptrname = (lstrlenA(tstr) + 1);\
    long __l##ptrname = (lstrlenA(tstr) + 1) * sizeof(WCHAR); \
    TempBuffer __TempBuffer##ptrname(__l##ptrname); \
    MultiByteToWideChar(CP_ACP, 0, tstr, -1, (LPWSTR)__TempBuffer##ptrname.GetBuffer(), __cch##ptrname); \
    LPWSTR ptrname = (LPWSTR)__TempBuffer##ptrname.GetBuffer()

Definition at line 93 of file globals.h.

#define MAKE_WIDEPTR_FROMTSTR_ALLOC | ( | ptrname,
 |  | tstr
 | ) |
Value:
long __cch##ptrname = (lstrlenA(tstr) + 1);\
    long __l##ptrname = (lstrlenA(tstr) + 1) * sizeof(WCHAR); \
    LPWSTR ptrname = (LPWSTR)CoTaskMemAlloc(__l##ptrname); \
    MultiByteToWideChar(CP_ACP, 0, tstr, -1, ptrname, __cch##ptrname)

Definition at line 107 of file globals.h.

#define OBJECT_CREATED InterlockedIncrement((long *)&g_uObjects);

Definition at line 31 of file globals.h.

#define OBJECT_DESTROYED InterlockedDecrement((long *)&g_uObjects);

Definition at line 32 of file globals.h.

Function Documentation

void MMCN_Crack | ( | BOOL | bComponentData,
 |  | IDataObject * | pDataObject,
 |  | IComponentData * | pCompData,
 |  | IComponent * | pComp,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param
 | ) |  |

Definition at line 59 of file mmccrack.Cpp.

{
#ifdef MMC_CRACK_MESSAGES
        const size_t cchMessage = 256;
  TCHAR message[cchMessage] = {0};

  if (bComponentData == TRUE)
    OutputDebugString(_T("IComponentData::Notify( "));
  else
    OutputDebugString(_T("IComponent::Notify( "));

  wsprintf(message, _T("DataObject: %08x, CompData: %08x, Comp: %08x ) - "), pDataObject, pCompData, pComp);
  OutputDebugString(message);

    switch (event)  {
    case MMCN_ACTIVATE:
      wsprintf(message, _T("MMCN_ACTIVATE\n\tActivate: %d\n"), arg);
      break;

    case MMCN_ADD_IMAGES:
      wsprintf(message, _T("MMCN_ADD_IMAGES\n\tImage List: %08x\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_BTN_CLICK:
      wsprintf(message, _T("MMCN_BTN_CLICK\n\tVerb: %ws\n"), MMCN_CrackVerb((MMC_CONSOLE_VERB)param));
      break;

    case MMCN_COLUMN_CLICK:
      wsprintf(message, _T("MMCN_COLUMN_CLICK\n\tColumn: %d\n\tSort Option: %d\n"), arg,   param);
      break;

    case MMCN_COLUMNS_CHANGED:
      wsprintf(message, _T("MMCN_COLUMNS_CHANGED\n"));
      break;

    case MMCN_CONTEXTHELP:
      wsprintf(message, _T("MMCN_CONTEXTHELP\n"));
      break;

    case MMCN_CONTEXTMENU:
      wsprintf(message, _T("MMCN_CONTEXTMENU\n"));
      break;

    case MMCN_CUTORMOVE:
      wsprintf(message, _T("MMCN_CUTORMOVE\n"));
      break;

    case MMCN_DBLCLICK:
      wsprintf(message, _T("MMCN_DBLCLICK\n"));
      break;

    case MMCN_DELETE:
      wsprintf(message, _T("MMCN_DELETE\n"));
      break;

    case MMCN_DESELECT_ALL:
      wsprintf(message, _T("MMCN_DESELECT_ALL\n"));
      break;

    case MMCN_EXPAND:
      wsprintf(message, _T("MMCN_EXPAND\n\tExpand: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_EXPANDSYNC:
      wsprintf(message, _T("MMCN_EXPANDSYNC\n"));
      break;

    case MMCN_FILTERBTN_CLICK:
      wsprintf(message, _T("MMCN_FILTERBTN_CLICK\n\tColumn: %d\n"), arg);
      break;

    case MMCN_FILTER_CHANGE:
      wsprintf(message, _T("MMCN_FILTER_CHANGE\n\tColumn: %d\n"), param);
      break;

    case MMCN_HELP:
      wsprintf(message, _T("MMCN_HELP\n"));
      break;

    case MMCN_INITOCX:
      wsprintf(message, _T("MMCN_INITOCX\n\tIUnknown: %08x\n"), param);
      break;

    case MMCN_LISTPAD:
      wsprintf(message, _T("MMCN_LISTPAD\n\tConnect: %d\n"), arg);
      break;

    case MMCN_MENU_BTNCLICK:
      wsprintf(message, _T("MMCN_MENU_BTNCLICK\n"));
      break;

    case MMCN_MINIMIZED:
      wsprintf(message, _T("MMCN_MINIMIZED\n\tMinimized: %d\n"), arg);
      break;

    case MMCN_PASTE:
      wsprintf(message, _T("MMCN_PASTE\n\tCopy: %d\n"), param == NULL);
      break;

    case MMCN_PRELOAD:
      wsprintf(message, _T("MMCN_PRELOAD\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_PRINT:
      wsprintf(message, _T("MMCN_PRINT\n"));
      break;

    case MMCN_PROPERTY_CHANGE:
      wsprintf(message, _T("MMCN_PROPERTY_CHANGE\n\tScope: %d\n\tArg: %08x\n"), arg, param);
      break;

    case MMCN_QUERY_PASTE:
      wsprintf(message, _T("MMCN_QUERY_PASTE\n"));
      break;

    case MMCN_REFRESH:
      wsprintf(message, _T("MMCN_REFRESH\n"));
      break;

    case MMCN_REMOVE_CHILDREN:
      wsprintf(message, _T("MMCN_REMOVE_CHILDREN\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_RENAME:
                        // Destination string may contain a truncation of the ideal result.
                        // (Indicated by return value other than S_OK).
                        // However, it will be null-terminated.
      StringCchPrintf(message, cchMessage, _T("MMCN_RENAME\n\tNew Name: '%ws'\n"), (LPOLESTR)param);
      break;

    case MMCN_RESTORE_VIEW:
      wsprintf(message, _T("MMCN_RESTORE_VIEW\n"));
      break;

    case MMCN_SELECT:
      wsprintf(message, _T("MMCN_SELECT\n\tScope: %d\n\tSelect: %08x\n"), LOWORD(arg), HIWORD(arg));
      break;

    case MMCN_SHOW:
      wsprintf(message, _T("MMCN_SHOW\n\tShow: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_SNAPINHELP:
      wsprintf(message, _T("MMCN_SNAPINHELP\n"));
      break;

    case MMCN_VIEW_CHANGE:
      wsprintf(message, _T("MMCN_VIEW_CHANGE\n\tData: %08x\n\tHint: %08x\n"), arg, param);
      break;
  }

  if (message[0] != 0)
    OutputDebugString(message);
  else
    OutputDebugString(_T("unknown event\n"));

#endif
  return;
}

Variable Documentation

HINSTANCE g_hinst

Definition at line 33 of file SetDisp.h.

ULONG g_uObjects

Definition at line 24 of file basesnap.h.

Generated on Wed Nov 13 2024 16:54:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Toolbar/guids.h File Reference

  • SysMgmt
  • MMC
  • Toolbar
Functions

guids.h File Reference

Go to the source code of this file.

Functions

DEFINE_GUID (CLSID_CComponentData, 0x88249524, 0x8ad1, 0x11d2, 0x8a, 0xb, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28)
DEFINE_GUID (CLSID_CSnapinAbout, 0x88249526, 0x8ad1, 0x11d2, 0x8a, 0xb, 0x0, 0x0, 0x21, 0x47, 0x31, 0x28)

Function Documentation

DEFINE_GUID | ( | CLSID_CComponentData | ,
 |  | 0x88249524 | ,
 |  | 0x8ad1 | ,
 |  | 0x11d2 | ,
 |  | 0x8a | ,
 |  | 0xb | ,
 |  | 0x0 | ,
 |  | 0x0 | ,
 |  | 0x21 | ,
 |  | 0x47 | ,
 |  | 0x31 | ,
 |  | 0x28 |
 | ) |  |
DEFINE_GUID | ( | CLSID_CSnapinAbout | ,
 |  | 0x88249526 | ,
 |  | 0x8ad1 | ,
 |  | 0x11d2 | ,
 |  | 0x8a | ,
 |  | 0xb | ,
 |  | 0x0 | ,
 |  | 0x0 | ,
 |  | 0x21 | ,
 |  | 0x47 | ,
 |  | 0x31 | ,
 |  | 0x28 |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Toolbar/land.Cpp File Reference

  • SysMgmt
  • MMC
  • Toolbar

land.Cpp File Reference

#include "Land.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Toolbar/land.h File Reference

  • SysMgmt
  • MMC
  • Toolbar
Classes

land.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class CLandBasedVehicle
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Toolbar/localres.h File Reference

  • SysMgmt
  • MMC
  • Toolbar
Defines

localres.h File Reference

Go to the source code of this file.

Defines

#define | INDEX_CLOSEDFOLDER 4
#define | INDEX_LANDICON 1
#define | INDEX_NONE -1
#define | INDEX_OPENFOLDER 5
#define | INDEX_PEOPLEICON 3
#define | INDEX_SKYICON 2
#define | INDEX_SPACEICON 0

Define Documentation

#define INDEX_CLOSEDFOLDER 4

Definition at line 27 of file localres.h.

#define INDEX_LANDICON 1

Definition at line 24 of file localres.h.

#define INDEX_NONE -1

Definition at line 22 of file localres.h.

#define INDEX_OPENFOLDER 5

Definition at line 28 of file localres.h.

#define INDEX_PEOPLEICON 3

Definition at line 26 of file localres.h.

#define INDEX_SKYICON 2

Definition at line 25 of file localres.h.

#define INDEX_SPACEICON 0

Definition at line 23 of file localres.h.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Toolbar/mmccrack.Cpp File Reference

  • SysMgmt
  • MMC
  • Toolbar
Defines | Functions

mmccrack.Cpp File Reference

#include <mmc.h>
#include <winuser.h>
#include <tchar.h>
#include "globals.h"
#include <strsafe.h>

Go to the source code of this file.

Defines

#define | STRSAFE_NO_DEPRECATE

Functions

void | MMCN_Crack (BOOL bComponentData, IDataObject *pDataObject, IComponentData *pCompData, IComponent *pComp, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)

Define Documentation

#define STRSAFE_NO_DEPRECATE

Definition at line 25 of file mmccrack.Cpp.

Function Documentation

void MMCN_Crack | ( | BOOL | bComponentData,
 |  | IDataObject * | pDataObject,
 |  | IComponentData * | pCompData,
 |  | IComponent * | pComp,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param
 | ) |  |

Definition at line 59 of file mmccrack.Cpp.

{
#ifdef MMC_CRACK_MESSAGES
        const size_t cchMessage = 256;
        TCHAR message[cchMessage] = {0};

        if (bComponentData == TRUE)
                OutputDebugString(_T("IComponentData::Notify( "));
        else
                OutputDebugString(_T("IComponent::Notify( "));

        wsprintf(message, _T("DataObject: %08x, CompData: %08x, Comp: %08x ) - "), pDataObject, pCompData, pComp);
        OutputDebugString(message);

    switch (event)      {
                case MMCN_ACTIVATE:
                        wsprintf(message, _T("MMCN_ACTIVATE\n\tActivate: %d\n"), arg);
                        break;

                case MMCN_ADD_IMAGES:
                        wsprintf(message, _T("MMCN_ADD_IMAGES\n\tImage List: %08x\n\tScope Item: %08x\n"), arg, param);
                        break;

                case MMCN_BTN_CLICK:
                        wsprintf(message, _T("MMCN_BTN_CLICK\n\tVerb: %ws\n"), MMCN_CrackVerb((MMC_CONSOLE_VERB)param));
                        break;

                case MMCN_COLUMN_CLICK:
                        wsprintf(message, _T("MMCN_COLUMN_CLICK\n\tColumn: %d\n\tSort Option: %d\n"), arg,       param);
                        break;

                case MMCN_COLUMNS_CHANGED:
                        wsprintf(message, _T("MMCN_COLUMNS_CHANGED\n"));
                        break;

                case MMCN_CONTEXTHELP:
                        wsprintf(message, _T("MMCN_CONTEXTHELP\n"));
                        break;

                case MMCN_CONTEXTMENU:
                        wsprintf(message, _T("MMCN_CONTEXTMENU\n"));
                        break;

                case MMCN_CUTORMOVE:
                        wsprintf(message, _T("MMCN_CUTORMOVE\n"));
                        break;

                case MMCN_DBLCLICK:
                        wsprintf(message, _T("MMCN_DBLCLICK\n"));
                        break;

                case MMCN_DELETE:
                        wsprintf(message, _T("MMCN_DELETE\n"));
                        break;

                case MMCN_DESELECT_ALL:
                        wsprintf(message, _T("MMCN_DESELECT_ALL\n"));
                        break;

                case MMCN_EXPAND:
                        wsprintf(message, _T("MMCN_EXPAND\n\tExpand: %d\n\tScope Item: %08x\n"), arg, param);
                        break;

                case MMCN_EXPANDSYNC:
                        wsprintf(message, _T("MMCN_EXPANDSYNC\n"));
                        break;

                case MMCN_FILTERBTN_CLICK:
                        wsprintf(message, _T("MMCN_FILTERBTN_CLICK\n\tColumn: %d\n"), arg);
                        break;

                case MMCN_FILTER_CHANGE:
                        wsprintf(message, _T("MMCN_FILTER_CHANGE\n\tColumn: %d\n"), param);
                        break;

                case MMCN_HELP:
                        wsprintf(message, _T("MMCN_HELP\n"));
                        break;

                case MMCN_INITOCX:
                        wsprintf(message, _T("MMCN_INITOCX\n\tIUnknown: %08x\n"), param);
                        break;

                case MMCN_LISTPAD:
                        wsprintf(message, _T("MMCN_LISTPAD\n\tConnect: %d\n"), arg);
                        break;

                case MMCN_MENU_BTNCLICK:
                        wsprintf(message, _T("MMCN_MENU_BTNCLICK\n"));
                        break;

                case MMCN_MINIMIZED:
                        wsprintf(message, _T("MMCN_MINIMIZED\n\tMinimized: %d\n"), arg);
                        break;

                case MMCN_PASTE:
                        wsprintf(message, _T("MMCN_PASTE\n\tCopy: %d\n"), param == NULL);
                        break;

                case MMCN_PRELOAD:
                        wsprintf(message, _T("MMCN_PRELOAD\n\tScope Item: %08x\n"), arg);
                        break;

                case MMCN_PRINT:
                        wsprintf(message, _T("MMCN_PRINT\n"));
                        break;

                case MMCN_PROPERTY_CHANGE:
                        wsprintf(message, _T("MMCN_PROPERTY_CHANGE\n\tScope: %d\n\tArg: %08x\n"), arg, param);
                        break;

                case MMCN_QUERY_PASTE:
                        wsprintf(message, _T("MMCN_QUERY_PASTE\n"));
                        break;

                case MMCN_REFRESH:
                        wsprintf(message, _T("MMCN_REFRESH\n"));
                        break;

                case MMCN_REMOVE_CHILDREN:
                        wsprintf(message, _T("MMCN_REMOVE_CHILDREN\n\tScope Item: %08x\n"), arg);
                        break;

                case MMCN_RENAME:
                        // Destination string may contain a truncation of the ideal result.
                        // (Indicated by return value other than S_OK).
                        // However, it will be null-terminated.
                        StringCchPrintf(message, cchMessage, _T("MMCN_RENAME\n\tNew Name: '%ws'\n"), (LPOLESTR)param);
                        break;

                case MMCN_RESTORE_VIEW:
                        wsprintf(message, _T("MMCN_RESTORE_VIEW\n"));
                        break;

                case MMCN_SELECT:
                        wsprintf(message, _T("MMCN_SELECT\n\tScope: %d\n\tSelect: %08x\n"), LOWORD(arg), HIWORD(arg));
                        break;

                case MMCN_SHOW:
                        wsprintf(message, _T("MMCN_SHOW\n\tShow: %d\n\tScope Item: %08x\n"), arg, param);
                        break;

                case MMCN_SNAPINHELP:
                        wsprintf(message, _T("MMCN_SNAPINHELP\n"));
                        break;

                case MMCN_VIEW_CHANGE:
                        wsprintf(message, _T("MMCN_VIEW_CHANGE\n\tData: %08x\n\tHint: %08x\n"), arg, param);
                        break;
        }

        if (message[0] != 0)
                OutputDebugString(message);
        else
                OutputDebugString(_T("unknown event\n"));

#endif
        return;
}

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Toolbar/people.Cpp File Reference

  • SysMgmt
  • MMC
  • Toolbar

people.Cpp File Reference

#include <stdio.h>
#include "People.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Toolbar/people.h File Reference

  • SysMgmt
  • MMC
  • Toolbar
Classes

people.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class | CBicycle
class | CBicycleFolder
class | CIceSkate
class | CIceSkateFolder
class | CPeoplePoweredVehicle
class | CSkateboard
class | CSkateboardFolder
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Toolbar/registry.Cpp File Reference

  • SysMgmt
  • MMC
  • Toolbar
Defines | Functions

registry.Cpp File Reference

#include <objbase.h>
#include <assert.h>
#include "Registry.h"
#include "globals.h"

Go to the source code of this file.

Defines

#define | STRINGS_ONLY

Functions

LONG | recursiveDeleteKey (HKEY hKeyParent, const _TCHAR *szKeyChild)
HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const _TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const _TCHAR *szNameString, const CLSID &clsidAbout, const BOOL fSupportExtensions)
BOOL | setKeyAndValue (const _TCHAR *pszPath, const _TCHAR *szSubkey, const _TCHAR *szValue)
BOOL | setSnapInKeyAndValue (const _TCHAR *szKey, const _TCHAR *szSubkey, const _TCHAR *szName, const _TCHAR *szValue)
BOOL | setValue (const _TCHAR *szKey, const _TCHAR *szValueName, const _TCHAR *szValue)
LONG | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Define Documentation

#define STRINGS_ONLY

Definition at line 24 of file registry.Cpp.

Function Documentation

LONG recursiveDeleteKey | ( | HKEY | hKeyParent,
 |  | const _TCHAR * | szKeyChild
 | ) |  |

Definition at line 214 of file registry.Cpp.

{
    // Open the child.
    HKEY hKeyChild ;
    LONG lRes = RegOpenKeyEx(hKeyParent, lpszKeyChild, 0,
        KEY_ALL_ACCESS, &hKeyChild) ;
    if (lRes != ERROR_SUCCESS)
    {
        return lRes ;
    }

    // Enumerate all of the decendents of this child.
    FILETIME time ;
    _TCHAR szBuffer[256] ;
    DWORD dwSize = 256 ;
    while (RegEnumKeyEx(hKeyChild, 0, szBuffer, &dwSize, NULL,
        NULL, NULL, &time) == S_OK)
    {
        // Delete the decendents of this child.
        lRes = recursiveDeleteKey(hKeyChild, szBuffer) ;
        if (lRes != ERROR_SUCCESS)
        {
            // Cleanup before exiting.
            RegCloseKey(hKeyChild) ;
            return lRes;
        }
        dwSize = 256 ;
    }

    // Close the child.
    RegCloseKey(hKeyChild) ;

    // Delete this child.
    return RegDeleteKey(hKeyParent, lpszKeyChild) ;
}

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const _TCHAR * | szFriendlyName
 | ) |  |

Definition at line 67 of file registry.Cpp.

{
    // Get server location.
    _TCHAR szModule[512] ;
    DWORD dwResult =
        ::GetModuleFileName(hModule,
        szModule,
        sizeof(szModule)/sizeof(_TCHAR)) ;

    assert(dwResult != 0) ;

    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    assert(SUCCEEDED(hr)) ;

        MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;
        _tcscat(szKey, pszCLSID) ;

    // Add the CLSID to the registry.
    setKeyAndValue(szKey, NULL, szFriendlyName) ;

    // Add the server filename subkey under the CLSID key.
    setKeyAndValue(szKey, _T("InprocServer32"), szModule) ;

    // set the threading model
    _tcscat(szKey, _T("\\InprocServer32"));
    setValue(szKey, _T("ThreadingModel"), _T("Apartment"));

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const _TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | fSupportExtensions
 | ) |  |

Definition at line 140 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    LPOLESTR wszAboutCLSID = NULL;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    if (IID_NULL != clsidAbout)
        hr = StringFromCLSID(clsidAbout, &wszAboutCLSID);

        MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);
        MAKE_TSTRPTR_FROMWIDE(pszAboutCLSID, wszAboutCLSID);

    // Add the CLSID to the registry.
    setSnapInKeyAndValue(pszCLSID, NULL, _T("NameString"), szNameString) ;
    setSnapInKeyAndValue(pszCLSID, _T("StandAlone"), NULL, NULL);
    if (IID_NULL != clsidAbout)
        setSnapInKeyAndValue(pszCLSID, NULL, _T("About"), pszAboutCLSID);

    if (fSupportExtensions) {
        // Build the key NodeType
        setSnapInKeyAndValue(pszCLSID, _T("NodeTypes"), NULL, NULL);

        _TCHAR szKey[64] ;
        _tcscpy(szKey, pszCLSID) ;
        _tcscat(szKey, _T("\\NodeTypes")) ;
        setSnapInKeyAndValue(szKey, pszCLSID, NULL, NULL);
    }

    // Free memory.
    CoTaskMemFree(wszCLSID) ;
    if (IID_NULL != clsidAbout)
        CoTaskMemFree(wszAboutCLSID);

    return S_OK ;
}

BOOL setKeyAndValue | ( | const _TCHAR * | pszPath,
 |  | const _TCHAR * | szSubkey,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 256 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Copy keyname into buffer.
    _tcscpy(szKeyBuf, szKey) ;

    // Add subkey name to buffer.
    if (szSubkey != NULL)
    {
        _tcscat(szKeyBuf, _T("\\")) ;
        _tcscat(szKeyBuf, szSubkey ) ;
    }

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, NULL, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

BOOL setSnapInKeyAndValue | ( | const _TCHAR * | szKey,
 |  | const _TCHAR * | szSubkey,
 |  | const _TCHAR * | szName,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 337 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\")) ;
    _tcscat(szKeyBuf, szKey) ;

    // Add subkey name to buffer.
    if (szSubkey != NULL)
    {
        _tcscat(szKeyBuf, _T("\\")) ;
        _tcscat(szKeyBuf, szSubkey ) ;
    }

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, szName, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

BOOL setValue | ( | const _TCHAR * | szKey,
 |  | const _TCHAR * | szValueName,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 299 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Copy keyname into buffer.
    _tcscpy(szKeyBuf, szKey) ;

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, szValueName, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

LONG UnregisterServer ( const CLSID & clsid )

Definition at line 112 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

        MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
        _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
               (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 184 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
        MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
               (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Generated on Wed Nov 13 2024 16:53:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Toolbar/registry.h File Reference

  • SysMgmt
  • MMC
  • Toolbar
Functions

registry.h File Reference

#include <tchar.h>

Go to the source code of this file.

Functions

HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const _TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const _TCHAR *szNameString, const CLSID &clsidAbout, const BOOL fSupportExtensions=FALSE)
HRESULT | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Function Documentation

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const _TCHAR * | szFriendlyName
 | ) |  |

Definition at line 67 of file registry.Cpp.

{
    // Get server location.
    _TCHAR szModule[512] ;
    DWORD dwResult =
        ::GetModuleFileName(hModule,
        szModule,
        sizeof(szModule)/sizeof(_TCHAR)) ;

    assert(dwResult != 0) ;

    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    assert(SUCCEEDED(hr)) ;

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;
  _tcscat(szKey, pszCLSID) ;

    // Add the CLSID to the registry.
    setKeyAndValue(szKey, NULL, szFriendlyName) ;

    // Add the server filename subkey under the CLSID key.
    setKeyAndValue(szKey, _T("InprocServer32"), szModule) ;

    // set the threading model
    _tcscat(szKey, _T("\\InprocServer32"));
    setValue(szKey, _T("ThreadingModel"), _T("Apartment"));

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const _TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | fSupportExtensions = FALSE
 | ) |  |

Definition at line 140 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    LPOLESTR wszAboutCLSID = NULL;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    if (IID_NULL != clsidAbout)
        hr = StringFromCLSID(clsidAbout, &wszAboutCLSID);

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszAboutCLSID, wszAboutCLSID);

    // Add the CLSID to the registry.
    setSnapInKeyAndValue(pszCLSID, NULL, _T("NameString"), szNameString) ;
    setSnapInKeyAndValue(pszCLSID, _T("StandAlone"), NULL, NULL);
    if (IID_NULL != clsidAbout)
        setSnapInKeyAndValue(pszCLSID, NULL, _T("About"), pszAboutCLSID);

    if (fSupportExtensions) {
        // Build the key NodeType
        setSnapInKeyAndValue(pszCLSID, _T("NodeTypes"), NULL, NULL);

        _TCHAR szKey[64] ;
        _tcscpy(szKey, pszCLSID) ;
        _tcscat(szKey, _T("\\NodeTypes")) ;
        setSnapInKeyAndValue(szKey, pszCLSID, NULL, NULL);
    }

    // Free memory.
    CoTaskMemFree(wszCLSID) ;
    if (IID_NULL != clsidAbout)
        CoTaskMemFree(wszAboutCLSID);

    return S_OK ;
}

HRESULT UnregisterServer ( const CLSID & clsid )

Definition at line 112 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

  MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
  _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 184 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Toolbar/resource.h File Reference

  • SysMgmt
  • MMC
  • Toolbar
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | ID_BUTTONPAUSE 40022
#define | ID_BUTTONSTART 40021
#define | ID_BUTTONSTOP 40023
#define | ID_COMMAND_COMMAND1 40016
#define | ID_COMMAND_COMMAND2 40017
#define | ID_COMMAND_COMMAND3 40018
#define | ID_COMMAND_COMMAND4 40020
#define | IDB_BIKE 40007
#define | IDB_BIKE2 40011
#define | IDB_CAR 40005
#define | IDB_CAR2 40009
#define | IDB_CLOSED 40014
#define | IDB_CLOSED2 40012
#define | IDB_LGBMP 118
#define | IDB_OPEN 40015
#define | IDB_OPEN2 40013
#define | IDB_PLANE 40006
#define | IDB_PLANE2 40010
#define | IDB_ROCKET 40004
#define | IDB_ROCKET2 40008
#define | IDB_SMBMP 117
#define | IDB_SMOPEN 116
#define | IDI_ICON1 108
#define | IDR_LGICONS 121
#define | IDR_SMICONS 120
#define | IDR_TOOLBAR1 112
#define | IDS_ABOUTNAME 9
#define | IDS_HELPFILE 1
#define | IDS_NAME 3
#define | IDS_SNAPINDESC 2
#define | IDS_SNAPINNAME 6

Define Documentation

#define ID_BUTTONPAUSE 40022

Definition at line 34 of file resource.h.

#define ID_BUTTONSTART 40021

Definition at line 33 of file resource.h.

#define ID_BUTTONSTOP 40023

Definition at line 35 of file resource.h.

#define ID_COMMAND_COMMAND1 40016

Definition at line 29 of file resource.h.

#define ID_COMMAND_COMMAND2 40017

Definition at line 30 of file resource.h.

#define ID_COMMAND_COMMAND3 40018

Definition at line 31 of file resource.h.

#define ID_COMMAND_COMMAND4 40020

Definition at line 32 of file resource.h.

#define IDB_BIKE 40007

Definition at line 20 of file resource.h.

#define IDB_BIKE2 40011

Definition at line 24 of file resource.h.

#define IDB_CAR 40005

Definition at line 18 of file resource.h.

#define IDB_CAR2 40009

Definition at line 22 of file resource.h.

#define IDB_CLOSED 40014

Definition at line 27 of file resource.h.

#define IDB_CLOSED2 40012

Definition at line 25 of file resource.h.

#define IDB_LGBMP 118

Definition at line 14 of file resource.h.

#define IDB_OPEN 40015

Definition at line 28 of file resource.h.

#define IDB_OPEN2 40013

Definition at line 26 of file resource.h.

#define IDB_PLANE 40006

Definition at line 19 of file resource.h.

#define IDB_PLANE2 40010

Definition at line 23 of file resource.h.

#define IDB_ROCKET 40004

Definition at line 17 of file resource.h.

#define IDB_ROCKET2 40008

Definition at line 21 of file resource.h.

#define IDB_SMBMP 117

Definition at line 13 of file resource.h.

#define IDB_SMOPEN 116

Definition at line 12 of file resource.h.

#define IDI_ICON1 108

Definition at line 10 of file resource.h.

#define IDR_LGICONS 121

Definition at line 16 of file resource.h.

#define IDR_SMICONS 120

Definition at line 15 of file resource.h.

#define IDR_TOOLBAR1 112

Definition at line 11 of file resource.h.

#define IDS_ABOUTNAME 9

Definition at line 9 of file resource.h.

#define IDS_HELPFILE 1

Definition at line 5 of file resource.h.

#define IDS_NAME 3

Definition at line 7 of file resource.h.

#define IDS_SNAPINDESC 2

Definition at line 6 of file resource.h.

#define IDS_SNAPINNAME 6

Definition at line 8 of file resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Toolbar/sky.Cpp File Reference

  • SysMgmt
  • MMC
  • Toolbar

sky.Cpp File Reference

#include "Sky.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Toolbar/sky.h File Reference

  • SysMgmt
  • MMC
  • Toolbar
Classes

sky.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class CSkyBasedVehicle
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Toolbar/space.Cpp File Reference

  • SysMgmt
  • MMC
  • Toolbar
Defines

space.Cpp File Reference

#include <stdio.h>
#include "Space.h"
#include "Comp.h"
#include <strsafe.h>

Go to the source code of this file.

Defines

#define STRSAFE_NO_DEPRECATE

Define Documentation

#define STRSAFE_NO_DEPRECATE

Definition at line 22 of file space.Cpp.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Toolbar/space.h File Reference

  • SysMgmt
  • MMC
  • Toolbar
Classes

space.h File Reference

#include "DeleBase.h"
#include "CompData.h"

Go to the source code of this file.

Classes

class | CRocket
class | CSpaceVehicle
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Toolbar/statnode.Cpp File Reference

  • SysMgmt
  • MMC
  • Toolbar

statnode.Cpp File Reference

#include "StatNode.h"
#include "People.h"
#include "Sky.h"
#include "Land.h"
#include "Space.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Toolbar/statnode.h File Reference

  • SysMgmt
  • MMC
  • Toolbar
Classes

statnode.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class CStaticNode
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/Toolbar/Help source/mmcsample.h File Reference

  • SysMgmt
  • MMC
  • Toolbar
  • Help source
Defines

mmcsample.h File Reference

Go to the source code of this file.

Defines

#define | HELP_DEFAULT 0
#define | HELP_INTRO 1
#define | HELP_STEPFOUR 104
#define | HELP_STEPONE 101
#define | HELP_STEPTHREE 103
#define | HELP_STEPTWO 102

Define Documentation

#define HELP_DEFAULT 0

Definition at line 12 of file mmcsample.h.

#define HELP_INTRO 1

Definition at line 13 of file mmcsample.h.

#define HELP_STEPFOUR 104

Definition at line 10 of file mmcsample.h.

#define HELP_STEPONE 101

Definition at line 7 of file mmcsample.h.

#define HELP_STEPTHREE 103

Definition at line 9 of file mmcsample.h.

#define HELP_STEPTWO 102

Definition at line 8 of file mmcsample.h.

Generated on Wed Nov 13 2024 16:54:42 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/WMI/about.Cpp File Reference

  • SysMgmt
  • MMC
  • WMI
Functions

about.Cpp File Reference

#include "About.h"
#include "resource.h"
#include "globals.h"
#include <crtdbg.h>

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CSnapinAbout

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 89 of file about.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        // we need to decrement our object count in the DLL
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:54:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/WMI/about.h File Reference

  • SysMgmt
  • MMC
  • WMI
Classes

about.h File Reference

#include <tchar.h>
#include <mmc.h>

Go to the source code of this file.

Classes

class CSnapinAbout
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/WMI/basesnap.Cpp File Reference

  • SysMgmt
  • MMC
  • WMI
Functions | Variables

basesnap.Cpp File Reference

#include <objbase.h>
#include <olectl.h>
#include <initguid.h>
#include "guids.h"
#include "basesnap.h"
#include "Comp.h"
#include "CompData.h"
#include "About.h"
#include "Registry.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)
BOOL WINAPI | DllMain (HINSTANCE hinstDLL, DWORD fdwReason, void *lpvReserved)
STDAPI | DllRegisterServer ()
STDAPI | DllUnregisterServer ()
STDMETHODIMP_ (ULONG) CClassFactory

Variables

HINSTANCE | g_hinst

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 77 of file basesnap.Cpp.

{
    if (g_uObjects == 0 && g_uSrvLock == 0)
        return S_OK;
    else
        return S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 45 of file basesnap.Cpp.

{
    if ((rclsid != CLSID_CComponentData) && (rclsid != CLSID_CSnapinAbout))
        return CLASS_E_CLASSNOTAVAILABLE;

    if (!ppvObj)
        return E_FAIL;

    *ppvObj = NULL;

    // We can only hand out IUnknown and IClassFactory pointers.  Fail
    // if they ask for anything else.
    if (!IsEqualIID(riid, IID_IUnknown) && !IsEqualIID(riid, IID_IClassFactory))
        return E_NOINTERFACE;

    CClassFactory *pFactory = NULL;

    // make the factory passing in the creation function for the type of object they want
    if (rclsid == CLSID_CComponentData)
        pFactory = new CClassFactory(CClassFactory::COMPONENT);
    else if (rclsid == CLSID_CSnapinAbout)
        pFactory = new CClassFactory(CClassFactory::ABOUT);

    if (NULL == pFactory)
        return E_OUTOFMEMORY;

    HRESULT hr = pFactory->QueryInterface(riid, ppvObj);

    return hr;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hinstDLL,
 |  | DWORD | fdwReason,
 |  | void * | lpvReserved
 | ) |  |

Definition at line 32 of file basesnap.Cpp.

{

    if (fdwReason == DLL_PROCESS_ATTACH) {
        g_hinst = hinstDLL;
    }

    return TRUE;
}

STDAPI DllRegisterServer ( void )

Definition at line 187 of file basesnap.Cpp.

{
    HRESULT hr = SELFREG_E_CLASS;
    _TCHAR szName[256];
    _TCHAR szSnapInName[256];

    LoadString(g_hinst, IDS_NAME, szName, (sizeof szName)/(sizeof szName[0]));
    LoadString(g_hinst, IDS_SNAPINNAME, szSnapInName, (sizeof szSnapInName)/(sizeof szSnapInName[0]));

    _TCHAR szAboutName[256];

    LoadString(g_hinst, IDS_ABOUTNAME, szAboutName, (sizeof szAboutName)/(sizeof szAboutName[0]));

    // register our CoClasses
    hr = RegisterServer(g_hinst,
        CLSID_CComponentData,
        szName);

    if SUCCEEDED(hr)
        hr = RegisterServer(g_hinst,
        CLSID_CSnapinAbout,
        szAboutName);

    // place the registry information for SnapIns
    if SUCCEEDED(hr)
        hr = RegisterSnapin(CLSID_CComponentData, szSnapInName, CLSID_CSnapinAbout, FALSE);

    return hr;
}

STDAPI DllUnregisterServer ( void )

Definition at line 218 of file basesnap.Cpp.

{
    if (UnregisterServer(CLSID_CComponentData) == S_OK)
        return UnregisterSnapin(CLSID_CComponentData);
    else
        return E_FAIL;
}

STDMETHODIMP_ ( ULONG )

Definition at line 124 of file basesnap.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;
}

Variable Documentation

HINSTANCE g_hinst

Definition at line 30 of file basesnap.Cpp.

Generated on Wed Nov 13 2024 16:54:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/WMI/basesnap.h File Reference

  • SysMgmt
  • MMC
  • WMI
Classes | Functions | Variables

basesnap.h File Reference

Go to the source code of this file.

Classes

class | CClassFactory

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)

Variables

ULONG | g_uObjects = 0
ULONG | g_uSrvLock = 0

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 53 of file ComSpyAudit.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppvObj
 | ) |  |

Definition at line 61 of file ComSpyAudit.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

Variable Documentation

ULONG g_uObjects = 0

Definition at line 24 of file basesnap.h.

ULONG g_uSrvLock = 0

Definition at line 25 of file basesnap.h.

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/WMI/comp.Cpp File Reference

  • SysMgmt
  • MMC
  • WMI
Functions

comp.Cpp File Reference

#include "Comp.h"
#include "DataObj.h"
#include <commctrl.h>
#include <crtdbg.h>
#include "globals.h"
#include "resource.h"
#include "DeleBase.h"
#include "CompData.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CComponent

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 73 of file comp.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/WMI/comp.h File Reference

  • SysMgmt
  • MMC
  • WMI
Classes

comp.h File Reference

#include <mmc.h>

Go to the source code of this file.

Classes

class CComponent
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/WMI/compdata.Cpp File Reference

  • SysMgmt
  • MMC
  • WMI
Functions

compdata.Cpp File Reference

#include "Comp.h"
#include "CompData.h"
#include "DataObj.h"
#include "resource.h"
#include <crtdbg.h>

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CComponentData

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 79 of file compdata.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        // we need to decrement our object count in the DLL
        delete this;
        return 0;
    }

    return m_cref;
}

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/WMI/compdata.h File Reference

  • SysMgmt
  • MMC
  • WMI
Classes

compdata.h File Reference

#include <mmc.h>
#include "DeleBase.h"
#include "StatNode.h"
#include "Comp.h"

Go to the source code of this file.

Classes

class CComponentData
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/WMI/dataobj.Cpp File Reference

  • SysMgmt
  • MMC
  • WMI
Defines | Functions

dataobj.Cpp File Reference

#include "DataObj.h"
#include "guids.h"
#include "DeleBase.h"

Go to the source code of this file.

Defines

#define | _T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")
#define | _T_CCF_INTERNAL_SNAPIN _T("{2479DB32-5276-11d2-94F5-00C04FB92EC2}")
#define | _T_CCF_NODETYPE _T("CCF_NODETYPE")
#define | _T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")
#define | _T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")

Functions

CDataObject * | GetOurDataObject (LPDATAOBJECT lpDataObject)
STDMETHODIMP_ (ULONG) CDataObject

Define Documentation

#define _T_CCF_DISPLAY_NAME _T("CCF_DISPLAY_NAME")

Definition at line 31 of file dataobj.Cpp.

#define _T_CCF_INTERNAL_SNAPIN _T("{2479DB32-5276-11d2-94F5-00C04FB92EC2}")

Definition at line 36 of file dataobj.Cpp.

#define _T_CCF_NODETYPE _T("CCF_NODETYPE")

Definition at line 32 of file dataobj.Cpp.

#define _T_CCF_SNAPIN_CLASSID _T("CCF_SNAPIN_CLASSID")

Definition at line 34 of file dataobj.Cpp.

#define _T_CCF_SZNODETYPE _T("CCF_SZNODETYPE")

Definition at line 33 of file dataobj.Cpp.

Function Documentation

CDataObject* GetOurDataObject ( LPDATAOBJECT lpDataObject )

Definition at line 165 of file dataobj.Cpp.

{
    HRESULT       hr      = S_OK;
    CDataObject *pSDO     = NULL;

  // check to see if the data object is a special data object.
  if ( IS_SPECIAL_DATAOBJECT (lpDataObject) )
  {
    //Code for handling a special data object goes here.

    //Note that the MMC SDK samples do not handle
    //special data objects, so we exit if we get one.
    return NULL;
  }

    STGMEDIUM stgmedium = { TYMED_HGLOBAL,  NULL  };
    FORMATETC formatetc = { CDataObject::s_cfInternal, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };

    // Allocate memory for the stream
    stgmedium.hGlobal = GlobalAlloc( GMEM_SHARE, sizeof(CDataObject *));

    if (!stgmedium.hGlobal)     {
        hr = E_OUTOFMEMORY;
    }

    if SUCCEEDED(hr)
        // Attempt to get data from the object
        hr = lpDataObject->GetDataHere( &formatetc, &stgmedium );

    // stgmedium now has the data we need
    if (SUCCEEDED(hr))  {
        pSDO = *(CDataObject **)(stgmedium.hGlobal);
    }

    // if we have memory free it
    if (stgmedium.hGlobal)
        GlobalFree(stgmedium.hGlobal);

    return pSDO;

} // end GetOurDataObject()

STDMETHODIMP_ ( ULONG )

Definition at line 87 of file dataobj.Cpp.

{
    if (InterlockedDecrement((LONG *)&m_cref) == 0)
    {
        delete this;
        return 0;
    }
    return m_cref;

}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/WMI/dataobj.h File Reference

  • SysMgmt
  • MMC
  • WMI
Classes | Functions

dataobj.h File Reference

#include <mmc.h>
#include "DeleBase.h"

Go to the source code of this file.

Classes

class | CDataObject

Functions

HRESULT | ExtractFromDataObject (IDataObject *lpDataObject, UINT cf, ULONG cb, HGLOBAL *phGlobal)
CDataObject * | GetOurDataObject (IDataObject *lpDataObject)
BOOL | IsMMCMultiSelectDataObject (IDataObject *lpDataObject)

Function Documentation

HRESULT ExtractFromDataObject | ( | IDataObject * | lpDataObject,
 |  | UINT | cf,
 |  | ULONG | cb,
 |  | HGLOBAL * | phGlobal
 | ) |  |
CDataObject* GetOurDataObject ( IDataObject * lpDataObject )
BOOL IsMMCMultiSelectDataObject ( IDataObject * lpDataObject )
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/WMI/delebase.Cpp File Reference

  • SysMgmt
  • MMC
  • WMI

delebase.Cpp File Reference

#include "DeleBase.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/WMI/delebase.h File Reference

  • SysMgmt
  • MMC
  • WMI
Classes

delebase.h File Reference

#include <mmc.h>
#include <crtdbg.h>
#include "globals.h"
#include "resource.h"
#include "LocalRes.h"

Go to the source code of this file.

Classes

class CDelegationBase
Generated on Wed Nov 13 2024 16:54:36 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/WMI/globals.h File Reference

  • SysMgmt
  • MMC
  • WMI
Classes | Defines | Functions | Variables

globals.h File Reference

#include <tchar.h>

Go to the source code of this file.

Classes

class | TempBuffer

Defines

#define | IDM_BUTTON1 0x100
#define | IDM_BUTTON2 0x101
#define | MAKE_TSTRPTR_FROMWIDE(ptrname, widestr)
#define | MAKE_WIDEPTR_FROMTSTR(ptrname, tstr)
#define | MAKE_WIDEPTR_FROMTSTR_ALLOC(ptrname, tstr)
#define | OBJECT_CREATED InterlockedIncrement((long *)&g_uObjects);
#define | OBJECT_DESTROYED InterlockedDecrement((long *)&g_uObjects);

Functions

void | MMCN_Crack (BOOL bComponentData, IDataObject *pDataObject, IComponentData *pCompData, IComponent *pComp, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)

Variables

HINSTANCE | g_hinst
ULONG g_uObjects

Define Documentation

#define IDM_BUTTON1 0x100

Definition at line 25 of file globals.h.

#define IDM_BUTTON2 0x101

Definition at line 26 of file globals.h.

#define MAKE_TSTRPTR_FROMWIDE | ( | ptrname,
 |  | widestr
 | ) |
Value:
long __l##ptrname = (wcslen(widestr) + 1) * 2 * sizeof(TCHAR); \
    TempBuffer __TempBuffer##ptrname(__l##ptrname); \
    WideCharToMultiByte(CP_ACP, 0, widestr, -1, (LPSTR)__TempBuffer##ptrname.GetBuffer(), __l##ptrname, NULL, NULL); \
    LPTSTR ptrname = (LPTSTR)__TempBuffer##ptrname.GetBuffer()

Definition at line 127 of file globals.h.

#define MAKE_WIDEPTR_FROMTSTR | ( | ptrname,
 |  | tstr
 | ) |
Value:
long __cch##ptrname = (lstrlenA(tstr) + 1);\
    long __l##ptrname = (lstrlenA(tstr) + 1) * sizeof(WCHAR); \
    TempBuffer __TempBuffer##ptrname(__l##ptrname); \
    MultiByteToWideChar(CP_ACP, 0, tstr, -1, (LPWSTR)__TempBuffer##ptrname.GetBuffer(), __cch##ptrname); \
    LPWSTR ptrname = (LPWSTR)__TempBuffer##ptrname.GetBuffer()

Definition at line 93 of file globals.h.

#define MAKE_WIDEPTR_FROMTSTR_ALLOC | ( | ptrname,
 |  | tstr
 | ) |
Value:
long __cch##ptrname = (lstrlenA(tstr) + 1);\
    long __l##ptrname = (lstrlenA(tstr) + 1) * sizeof(WCHAR); \
    LPWSTR ptrname = (LPWSTR)CoTaskMemAlloc(__l##ptrname); \
    MultiByteToWideChar(CP_ACP, 0, tstr, -1, ptrname, __cch##ptrname)

Definition at line 107 of file globals.h.

#define OBJECT_CREATED InterlockedIncrement((long *)&g_uObjects);

Definition at line 31 of file globals.h.

#define OBJECT_DESTROYED InterlockedDecrement((long *)&g_uObjects);

Definition at line 32 of file globals.h.

Function Documentation

void MMCN_Crack | ( | BOOL | bComponentData,
 |  | IDataObject * | pDataObject,
 |  | IComponentData * | pCompData,
 |  | IComponent * | pComp,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param
 | ) |  |

Definition at line 59 of file mmccrack.Cpp.

{
#ifdef MMC_CRACK_MESSAGES
        const size_t cchMessage = 256;
  TCHAR message[cchMessage] = {0};

  if (bComponentData == TRUE)
    OutputDebugString(_T("IComponentData::Notify( "));
  else
    OutputDebugString(_T("IComponent::Notify( "));

  wsprintf(message, _T("DataObject: %08x, CompData: %08x, Comp: %08x ) - "), pDataObject, pCompData, pComp);
  OutputDebugString(message);

    switch (event)  {
    case MMCN_ACTIVATE:
      wsprintf(message, _T("MMCN_ACTIVATE\n\tActivate: %d\n"), arg);
      break;

    case MMCN_ADD_IMAGES:
      wsprintf(message, _T("MMCN_ADD_IMAGES\n\tImage List: %08x\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_BTN_CLICK:
      wsprintf(message, _T("MMCN_BTN_CLICK\n\tVerb: %ws\n"), MMCN_CrackVerb((MMC_CONSOLE_VERB)param));
      break;

    case MMCN_COLUMN_CLICK:
      wsprintf(message, _T("MMCN_COLUMN_CLICK\n\tColumn: %d\n\tSort Option: %d\n"), arg,   param);
      break;

    case MMCN_COLUMNS_CHANGED:
      wsprintf(message, _T("MMCN_COLUMNS_CHANGED\n"));
      break;

    case MMCN_CONTEXTHELP:
      wsprintf(message, _T("MMCN_CONTEXTHELP\n"));
      break;

    case MMCN_CONTEXTMENU:
      wsprintf(message, _T("MMCN_CONTEXTMENU\n"));
      break;

    case MMCN_CUTORMOVE:
      wsprintf(message, _T("MMCN_CUTORMOVE\n"));
      break;

    case MMCN_DBLCLICK:
      wsprintf(message, _T("MMCN_DBLCLICK\n"));
      break;

    case MMCN_DELETE:
      wsprintf(message, _T("MMCN_DELETE\n"));
      break;

    case MMCN_DESELECT_ALL:
      wsprintf(message, _T("MMCN_DESELECT_ALL\n"));
      break;

    case MMCN_EXPAND:
      wsprintf(message, _T("MMCN_EXPAND\n\tExpand: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_EXPANDSYNC:
      wsprintf(message, _T("MMCN_EXPANDSYNC\n"));
      break;

    case MMCN_FILTERBTN_CLICK:
      wsprintf(message, _T("MMCN_FILTERBTN_CLICK\n\tColumn: %d\n"), arg);
      break;

    case MMCN_FILTER_CHANGE:
      wsprintf(message, _T("MMCN_FILTER_CHANGE\n\tColumn: %d\n"), param);
      break;

    case MMCN_HELP:
      wsprintf(message, _T("MMCN_HELP\n"));
      break;

    case MMCN_INITOCX:
      wsprintf(message, _T("MMCN_INITOCX\n\tIUnknown: %08x\n"), param);
      break;

    case MMCN_LISTPAD:
      wsprintf(message, _T("MMCN_LISTPAD\n\tConnect: %d\n"), arg);
      break;

    case MMCN_MENU_BTNCLICK:
      wsprintf(message, _T("MMCN_MENU_BTNCLICK\n"));
      break;

    case MMCN_MINIMIZED:
      wsprintf(message, _T("MMCN_MINIMIZED\n\tMinimized: %d\n"), arg);
      break;

    case MMCN_PASTE:
      wsprintf(message, _T("MMCN_PASTE\n\tCopy: %d\n"), param == NULL);
      break;

    case MMCN_PRELOAD:
      wsprintf(message, _T("MMCN_PRELOAD\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_PRINT:
      wsprintf(message, _T("MMCN_PRINT\n"));
      break;

    case MMCN_PROPERTY_CHANGE:
      wsprintf(message, _T("MMCN_PROPERTY_CHANGE\n\tScope: %d\n\tArg: %08x\n"), arg, param);
      break;

    case MMCN_QUERY_PASTE:
      wsprintf(message, _T("MMCN_QUERY_PASTE\n"));
      break;

    case MMCN_REFRESH:
      wsprintf(message, _T("MMCN_REFRESH\n"));
      break;

    case MMCN_REMOVE_CHILDREN:
      wsprintf(message, _T("MMCN_REMOVE_CHILDREN\n\tScope Item: %08x\n"), arg);
      break;

    case MMCN_RENAME:
                        // Destination string may contain a truncation of the ideal result.
                        // (Indicated by return value other than S_OK).
                        // However, it will be null-terminated.
      StringCchPrintf(message, cchMessage, _T("MMCN_RENAME\n\tNew Name: '%ws'\n"), (LPOLESTR)param);
      break;

    case MMCN_RESTORE_VIEW:
      wsprintf(message, _T("MMCN_RESTORE_VIEW\n"));
      break;

    case MMCN_SELECT:
      wsprintf(message, _T("MMCN_SELECT\n\tScope: %d\n\tSelect: %08x\n"), LOWORD(arg), HIWORD(arg));
      break;

    case MMCN_SHOW:
      wsprintf(message, _T("MMCN_SHOW\n\tShow: %d\n\tScope Item: %08x\n"), arg, param);
      break;

    case MMCN_SNAPINHELP:
      wsprintf(message, _T("MMCN_SNAPINHELP\n"));
      break;

    case MMCN_VIEW_CHANGE:
      wsprintf(message, _T("MMCN_VIEW_CHANGE\n\tData: %08x\n\tHint: %08x\n"), arg, param);
      break;
  }

  if (message[0] != 0)
    OutputDebugString(message);
  else
    OutputDebugString(_T("unknown event\n"));

#endif
  return;
}

Variable Documentation

HINSTANCE g_hinst

Definition at line 33 of file SetDisp.h.

ULONG g_uObjects

Definition at line 24 of file basesnap.h.

Generated on Wed Nov 13 2024 16:54:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/WMI/guids.h File Reference

  • SysMgmt
  • MMC
  • WMI
Functions

guids.h File Reference

Go to the source code of this file.

Functions

DEFINE_GUID (CLSID_CComponentData, 0x40edbfbe, 0xe4d4, 0x4380, 0x8b, 0xfe, 0xaf, 0x1d, 0x28, 0xa, 0xb6, 0xf4)
DEFINE_GUID (CLSID_CSnapinAbout, 0x356ddda6, 0x310d, 0x4329, 0x82, 0xff, 0x92, 0x2f, 0x91, 0xaf, 0xdc, 0x6a)

Function Documentation

DEFINE_GUID | ( | CLSID_CComponentData | ,
 |  | 0x40edbfbe | ,
 |  | 0xe4d4 | ,
 |  | 0x4380 | ,
 |  | 0x8b | ,
 |  | 0xfe | ,
 |  | 0xaf | ,
 |  | 0x1d | ,
 |  | 0x28 | ,
 |  | 0xa | ,
 |  | 0xb6 | ,
 |  | 0xf4 |
 | ) |  |
DEFINE_GUID | ( | CLSID_CSnapinAbout | ,
 |  | 0x356ddda6 | ,
 |  | 0x310d | ,
 |  | 0x4329 | ,
 |  | 0x82 | ,
 |  | 0xff | ,
 |  | 0x92 | ,
 |  | 0x2f | ,
 |  | 0x91 | ,
 |  | 0xaf | ,
 |  | 0xdc | ,
 |  | 0x6a |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/WMI/land.Cpp File Reference

  • SysMgmt
  • MMC
  • WMI

land.Cpp File Reference

#include "Land.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/WMI/land.h File Reference

  • SysMgmt
  • MMC
  • WMI
Classes

land.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class CLandBasedVehicle
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/WMI/localres.h File Reference

  • SysMgmt
  • MMC
  • WMI
Defines

localres.h File Reference

Go to the source code of this file.

Defines

#define | INDEX_CLOSEDFOLDER 4
#define | INDEX_LANDICON 1
#define | INDEX_NONE -1
#define | INDEX_OPENFOLDER 5
#define | INDEX_PEOPLEICON 3
#define | INDEX_SKYICON 2
#define | INDEX_SPACEICON 0

Define Documentation

#define INDEX_CLOSEDFOLDER 4

Definition at line 27 of file localres.h.

#define INDEX_LANDICON 1

Definition at line 24 of file localres.h.

#define INDEX_NONE -1

Definition at line 22 of file localres.h.

#define INDEX_OPENFOLDER 5

Definition at line 28 of file localres.h.

#define INDEX_PEOPLEICON 3

Definition at line 26 of file localres.h.

#define INDEX_SKYICON 2

Definition at line 25 of file localres.h.

#define INDEX_SPACEICON 0

Definition at line 23 of file localres.h.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/WMI/mmccrack.Cpp File Reference

  • SysMgmt
  • MMC
  • WMI
Defines | Functions

mmccrack.Cpp File Reference

#include <mmc.h>
#include <winuser.h>
#include <tchar.h>
#include "globals.h"
#include <strsafe.h>

Go to the source code of this file.

Defines

#define | STRSAFE_NO_DEPRECATE

Functions

void | MMCN_Crack (BOOL bComponentData, IDataObject *pDataObject, IComponentData *pCompData, IComponent *pComp, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)

Define Documentation

#define STRSAFE_NO_DEPRECATE

Definition at line 25 of file mmccrack.Cpp.

Function Documentation

void MMCN_Crack | ( | BOOL | bComponentData,
 |  | IDataObject * | pDataObject,
 |  | IComponentData * | pCompData,
 |  | IComponent * | pComp,
 |  | MMC_NOTIFY_TYPE | event,
 |  | LPARAM | arg,
 |  | LPARAM | param
 | ) |  |

Definition at line 59 of file mmccrack.Cpp.

{
#ifdef MMC_CRACK_MESSAGES
        const size_t cchMessage = 256;
        TCHAR message[cchMessage] = {0};

        if (bComponentData == TRUE)
                OutputDebugString(_T("IComponentData::Notify( "));
        else
                OutputDebugString(_T("IComponent::Notify( "));

        wsprintf(message, _T("DataObject: %08x, CompData: %08x, Comp: %08x ) - "), pDataObject, pCompData, pComp);
        OutputDebugString(message);

    switch (event)      {
                case MMCN_ACTIVATE:
                        wsprintf(message, _T("MMCN_ACTIVATE\n\tActivate: %d\n"), arg);
                        break;

                case MMCN_ADD_IMAGES:
                        wsprintf(message, _T("MMCN_ADD_IMAGES\n\tImage List: %08x\n\tScope Item: %08x\n"), arg, param);
                        break;

                case MMCN_BTN_CLICK:
                        wsprintf(message, _T("MMCN_BTN_CLICK\n\tVerb: %ws\n"), MMCN_CrackVerb((MMC_CONSOLE_VERB)param));
                        break;

                case MMCN_COLUMN_CLICK:
                        wsprintf(message, _T("MMCN_COLUMN_CLICK\n\tColumn: %d\n\tSort Option: %d\n"), arg,       param);
                        break;

                case MMCN_COLUMNS_CHANGED:
                        wsprintf(message, _T("MMCN_COLUMNS_CHANGED\n"));
                        break;

                case MMCN_CONTEXTHELP:
                        wsprintf(message, _T("MMCN_CONTEXTHELP\n"));
                        break;

                case MMCN_CONTEXTMENU:
                        wsprintf(message, _T("MMCN_CONTEXTMENU\n"));
                        break;

                case MMCN_CUTORMOVE:
                        wsprintf(message, _T("MMCN_CUTORMOVE\n"));
                        break;

                case MMCN_DBLCLICK:
                        wsprintf(message, _T("MMCN_DBLCLICK\n"));
                        break;

                case MMCN_DELETE:
                        wsprintf(message, _T("MMCN_DELETE\n"));
                        break;

                case MMCN_DESELECT_ALL:
                        wsprintf(message, _T("MMCN_DESELECT_ALL\n"));
                        break;

                case MMCN_EXPAND:
                        wsprintf(message, _T("MMCN_EXPAND\n\tExpand: %d\n\tScope Item: %08x\n"), arg, param);
                        break;

                case MMCN_EXPANDSYNC:
                        wsprintf(message, _T("MMCN_EXPANDSYNC\n"));
                        break;

                case MMCN_FILTERBTN_CLICK:
                        wsprintf(message, _T("MMCN_FILTERBTN_CLICK\n\tColumn: %d\n"), arg);
                        break;

                case MMCN_FILTER_CHANGE:
                        wsprintf(message, _T("MMCN_FILTER_CHANGE\n\tColumn: %d\n"), param);
                        break;

                case MMCN_HELP:
                        wsprintf(message, _T("MMCN_HELP\n"));
                        break;

                case MMCN_INITOCX:
                        wsprintf(message, _T("MMCN_INITOCX\n\tIUnknown: %08x\n"), param);
                        break;

                case MMCN_LISTPAD:
                        wsprintf(message, _T("MMCN_LISTPAD\n\tConnect: %d\n"), arg);
                        break;

                case MMCN_MENU_BTNCLICK:
                        wsprintf(message, _T("MMCN_MENU_BTNCLICK\n"));
                        break;

                case MMCN_MINIMIZED:
                        wsprintf(message, _T("MMCN_MINIMIZED\n\tMinimized: %d\n"), arg);
                        break;

                case MMCN_PASTE:
                        wsprintf(message, _T("MMCN_PASTE\n\tCopy: %d\n"), param == NULL);
                        break;

                case MMCN_PRELOAD:
                        wsprintf(message, _T("MMCN_PRELOAD\n\tScope Item: %08x\n"), arg);
                        break;

                case MMCN_PRINT:
                        wsprintf(message, _T("MMCN_PRINT\n"));
                        break;

                case MMCN_PROPERTY_CHANGE:
                        wsprintf(message, _T("MMCN_PROPERTY_CHANGE\n\tScope: %d\n\tArg: %08x\n"), arg, param);
                        break;

                case MMCN_QUERY_PASTE:
                        wsprintf(message, _T("MMCN_QUERY_PASTE\n"));
                        break;

                case MMCN_REFRESH:
                        wsprintf(message, _T("MMCN_REFRESH\n"));
                        break;

                case MMCN_REMOVE_CHILDREN:
                        wsprintf(message, _T("MMCN_REMOVE_CHILDREN\n\tScope Item: %08x\n"), arg);
                        break;

                case MMCN_RENAME:
                        // Destination string may contain a truncation of the ideal result.
                        // (Indicated by return value other than S_OK).
                        // However, it will be null-terminated.
                        StringCchPrintf(message, cchMessage, _T("MMCN_RENAME\n\tNew Name: '%ws'\n"), (LPOLESTR)param);
                        break;

                case MMCN_RESTORE_VIEW:
                        wsprintf(message, _T("MMCN_RESTORE_VIEW\n"));
                        break;

                case MMCN_SELECT:
                        wsprintf(message, _T("MMCN_SELECT\n\tScope: %d\n\tSelect: %08x\n"), LOWORD(arg), HIWORD(arg));
                        break;

                case MMCN_SHOW:
                        wsprintf(message, _T("MMCN_SHOW\n\tShow: %d\n\tScope Item: %08x\n"), arg, param);
                        break;

                case MMCN_SNAPINHELP:
                        wsprintf(message, _T("MMCN_SNAPINHELP\n"));
                        break;

                case MMCN_VIEW_CHANGE:
                        wsprintf(message, _T("MMCN_VIEW_CHANGE\n\tData: %08x\n\tHint: %08x\n"), arg, param);
                        break;
        }

        if (message[0] != 0)
                OutputDebugString(message);
        else
                OutputDebugString(_T("unknown event\n"));

#endif
        return;
}

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/WMI/people.Cpp File Reference

  • SysMgmt
  • MMC
  • WMI
Classes | Defines

people.Cpp File Reference

#include <stdio.h>
#include "People.h"
#include <commctrl.h>
#include <comdef.h>
#include <windowsx.h>

Go to the source code of this file.

Classes

class | CEventSink

Defines

#define | COLOR_COL 2
#define | MATERIAL_COL 3
#define | NAME_COL 0
#define | OWNER_COL 1
#define | TEMP_BUF 255
#define | WM_REFRESH_EVENT WM_APP+1
#define | WM_WMI_CONNECTED WM_APP

Define Documentation

#define COLOR_COL 2

Definition at line 832 of file people.Cpp.

#define MATERIAL_COL 3

Definition at line 833 of file people.Cpp.

#define NAME_COL 0

Definition at line 830 of file people.Cpp.

#define OWNER_COL 1

Definition at line 831 of file people.Cpp.

#define TEMP_BUF 255

Definition at line 110 of file people.Cpp.

#define WM_REFRESH_EVENT WM_APP+1

Definition at line 34 of file people.Cpp.

#define WM_WMI_CONNECTED WM_APP

Definition at line 33 of file people.Cpp.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/WMI/people.h File Reference

  • SysMgmt
  • MMC
  • WMI
Classes | Defines

people.h File Reference

#include "DeleBase.h"
#include <wbemcli.h>
#include "SimpleArray.h"

Go to the source code of this file.

Classes

class | CBicycle
class | CBicycleFolder
class | CIceSkate
class | CIceSkateFolder
class | CPeoplePoweredVehicle
class | CSkateboard
class | CSkateboardFolder

Defines

#define | CT_CONNECT 0
#define | CT_EXIT 2
#define | CT_GET_PTR 1

Define Documentation

#define CT_CONNECT 0

Definition at line 73 of file people.h.

#define CT_EXIT 2

Definition at line 75 of file people.h.

#define CT_GET_PTR 1

Definition at line 74 of file people.h.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/WMI/registry.Cpp File Reference

  • SysMgmt
  • MMC
  • WMI
Defines | Functions

registry.Cpp File Reference

#include <objbase.h>
#include <assert.h>
#include "Registry.h"
#include "globals.h"

Go to the source code of this file.

Defines

#define | STRINGS_ONLY

Functions

LONG | recursiveDeleteKey (HKEY hKeyParent, const _TCHAR *szKeyChild)
HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const _TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const _TCHAR *szNameString, const CLSID &clsidAbout, const BOOL fSupportExtensions)
BOOL | setKeyAndValue (const _TCHAR *pszPath, const _TCHAR *szSubkey, const _TCHAR *szValue)
BOOL | setSnapInKeyAndValue (const _TCHAR *szKey, const _TCHAR *szSubkey, const _TCHAR *szName, const _TCHAR *szValue)
BOOL | setValue (const _TCHAR *szKey, const _TCHAR *szValueName, const _TCHAR *szValue)
LONG | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Define Documentation

#define STRINGS_ONLY

Definition at line 24 of file registry.Cpp.

Function Documentation

LONG recursiveDeleteKey | ( | HKEY | hKeyParent,
 |  | const _TCHAR * | szKeyChild
 | ) |  |

Definition at line 214 of file registry.Cpp.

{
    // Open the child.
    HKEY hKeyChild ;
    LONG lRes = RegOpenKeyEx(hKeyParent, lpszKeyChild, 0,
        KEY_ALL_ACCESS, &hKeyChild) ;
    if (lRes != ERROR_SUCCESS)
    {
        return lRes ;
    }

    // Enumerate all of the decendents of this child.
    FILETIME time ;
    _TCHAR szBuffer[256] ;
    DWORD dwSize = 256 ;
    while (RegEnumKeyEx(hKeyChild, 0, szBuffer, &dwSize, NULL,
        NULL, NULL, &time) == S_OK)
    {
        // Delete the decendents of this child.
        lRes = recursiveDeleteKey(hKeyChild, szBuffer) ;
        if (lRes != ERROR_SUCCESS)
        {
            // Cleanup before exiting.
            RegCloseKey(hKeyChild) ;
            return lRes;
        }
        dwSize = 256 ;
    }

    // Close the child.
    RegCloseKey(hKeyChild) ;

    // Delete this child.
    return RegDeleteKey(hKeyParent, lpszKeyChild) ;
}

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const _TCHAR * | szFriendlyName
 | ) |  |

Definition at line 67 of file registry.Cpp.

{
    // Get server location.
    _TCHAR szModule[512] ;
    DWORD dwResult =
        ::GetModuleFileName(hModule,
        szModule,
        sizeof(szModule)/sizeof(_TCHAR)) ;

    assert(dwResult != 0) ;

    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    assert(SUCCEEDED(hr)) ;

        MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;
        _tcscat(szKey, pszCLSID) ;

    // Add the CLSID to the registry.
    setKeyAndValue(szKey, NULL, szFriendlyName) ;

    // Add the server filename subkey under the CLSID key.
    setKeyAndValue(szKey, _T("InprocServer32"), szModule) ;

    // set the threading model
    _tcscat(szKey, _T("\\InprocServer32"));
    setValue(szKey, _T("ThreadingModel"), _T("Apartment"));

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const _TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | fSupportExtensions
 | ) |  |

Definition at line 140 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    LPOLESTR wszAboutCLSID = NULL;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    if (IID_NULL != clsidAbout)
        hr = StringFromCLSID(clsidAbout, &wszAboutCLSID);

        MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);
        MAKE_TSTRPTR_FROMWIDE(pszAboutCLSID, wszAboutCLSID);

    // Add the CLSID to the registry.
    setSnapInKeyAndValue(pszCLSID, NULL, _T("NameString"), szNameString) ;
    setSnapInKeyAndValue(pszCLSID, _T("StandAlone"), NULL, NULL);
    if (IID_NULL != clsidAbout)
        setSnapInKeyAndValue(pszCLSID, NULL, _T("About"), pszAboutCLSID);

    if (fSupportExtensions) {
        // Build the key NodeType
        setSnapInKeyAndValue(pszCLSID, _T("NodeTypes"), NULL, NULL);

        _TCHAR szKey[64] ;
        _tcscpy(szKey, pszCLSID) ;
        _tcscat(szKey, _T("\\NodeTypes")) ;
        setSnapInKeyAndValue(szKey, pszCLSID, NULL, NULL);
    }

    // Free memory.
    CoTaskMemFree(wszCLSID) ;
    if (IID_NULL != clsidAbout)
        CoTaskMemFree(wszAboutCLSID);

    return S_OK ;
}

BOOL setKeyAndValue | ( | const _TCHAR * | pszPath,
 |  | const _TCHAR * | szSubkey,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 256 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Copy keyname into buffer.
    _tcscpy(szKeyBuf, szKey) ;

    // Add subkey name to buffer.
    if (szSubkey != NULL)
    {
        _tcscat(szKeyBuf, _T("\\")) ;
        _tcscat(szKeyBuf, szSubkey ) ;
    }

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, NULL, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

BOOL setSnapInKeyAndValue | ( | const _TCHAR * | szKey,
 |  | const _TCHAR * | szSubkey,
 |  | const _TCHAR * | szName,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 337 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\")) ;
    _tcscat(szKeyBuf, szKey) ;

    // Add subkey name to buffer.
    if (szSubkey != NULL)
    {
        _tcscat(szKeyBuf, _T("\\")) ;
        _tcscat(szKeyBuf, szSubkey ) ;
    }

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, szName, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

BOOL setValue | ( | const _TCHAR * | szKey,
 |  | const _TCHAR * | szValueName,
 |  | const _TCHAR * | szValue
 | ) |  |

Definition at line 299 of file registry.Cpp.

{
    HKEY hKey;
    _TCHAR szKeyBuf[1024] ;

    // Copy keyname into buffer.
    _tcscpy(szKeyBuf, szKey) ;

    // Create and open key and subkey.
    long lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
        szKeyBuf,
        0, NULL, REG_OPTION_NON_VOLATILE,
        KEY_ALL_ACCESS, NULL,
        &hKey, NULL) ;
    if (lResult != ERROR_SUCCESS)
    {
        return FALSE ;
    }

    // Set the Value.
    if (szValue != NULL)
    {
        RegSetValueEx(hKey, szValueName, 0, REG_SZ,
            (BYTE *)szValue,
            (_tcslen(szValue)+1)*sizeof(_TCHAR)) ;
    }

    RegCloseKey(hKey) ;
    return TRUE ;
}

LONG UnregisterServer ( const CLSID & clsid )

Definition at line 112 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

        MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
        _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
               (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 184 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
        MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
               (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Generated on Wed Nov 13 2024 16:53:08 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/WMI/registry.h File Reference

  • SysMgmt
  • MMC
  • WMI
Functions

registry.h File Reference

#include <tchar.h>

Go to the source code of this file.

Functions

HRESULT | RegisterServer (HMODULE hModule, const CLSID &clsid, const _TCHAR *szFriendlyName)
HRESULT | RegisterSnapin (const CLSID &clsid, const _TCHAR *szNameString, const CLSID &clsidAbout, const BOOL fSupportExtensions=FALSE)
HRESULT | UnregisterServer (const CLSID &clsid)
HRESULT | UnregisterSnapin (const CLSID &clsid)

Function Documentation

HRESULT RegisterServer | ( | HMODULE | hModule,
 |  | const CLSID & | clsid,
 |  | const _TCHAR * | szFriendlyName
 | ) |  |

Definition at line 67 of file registry.Cpp.

{
    // Get server location.
    _TCHAR szModule[512] ;
    DWORD dwResult =
        ::GetModuleFileName(hModule,
        szModule,
        sizeof(szModule)/sizeof(_TCHAR)) ;

    assert(dwResult != 0) ;

    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    assert(SUCCEEDED(hr)) ;

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;
  _tcscat(szKey, pszCLSID) ;

    // Add the CLSID to the registry.
    setKeyAndValue(szKey, NULL, szFriendlyName) ;

    // Add the server filename subkey under the CLSID key.
    setKeyAndValue(szKey, _T("InprocServer32"), szModule) ;

    // set the threading model
    _tcscat(szKey, _T("\\InprocServer32"));
    setValue(szKey, _T("ThreadingModel"), _T("Apartment"));

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT RegisterSnapin | ( | const CLSID & | clsid,
 |  | const _TCHAR * | szNameString,
 |  | const CLSID & | clsidAbout,
 |  | const BOOL | fSupportExtensions = FALSE
 | ) |  |

Definition at line 140 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    LPOLESTR wszAboutCLSID = NULL;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    if (IID_NULL != clsidAbout)
        hr = StringFromCLSID(clsidAbout, &wszAboutCLSID);

  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszAboutCLSID, wszAboutCLSID);

    // Add the CLSID to the registry.
    setSnapInKeyAndValue(pszCLSID, NULL, _T("NameString"), szNameString) ;
    setSnapInKeyAndValue(pszCLSID, _T("StandAlone"), NULL, NULL);
    if (IID_NULL != clsidAbout)
        setSnapInKeyAndValue(pszCLSID, NULL, _T("About"), pszAboutCLSID);

    if (fSupportExtensions) {
        // Build the key NodeType
        setSnapInKeyAndValue(pszCLSID, _T("NodeTypes"), NULL, NULL);

        _TCHAR szKey[64] ;
        _tcscpy(szKey, pszCLSID) ;
        _tcscat(szKey, _T("\\NodeTypes")) ;
        setSnapInKeyAndValue(szKey, pszCLSID, NULL, NULL);
    }

    // Free memory.
    CoTaskMemFree(wszCLSID) ;
    if (IID_NULL != clsidAbout)
        CoTaskMemFree(wszAboutCLSID);

    return S_OK ;
}

HRESULT UnregisterServer ( const CLSID & clsid )

Definition at line 112 of file registry.Cpp.

{
    // Get CLSID
    LPOLESTR wszCLSID = NULL ;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

    // Build the key CLSID\\{...}
    _TCHAR szKey[64] ;
    _tcscpy(szKey, _T("CLSID\\")) ;

  MAKE_TSTRPTR_FROMWIDE(pszT, wszCLSID);
  _tcscat(szKey, pszT) ;

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // Free memory.
    CoTaskMemFree(wszCLSID) ;

    return S_OK ;
}

HRESULT UnregisterSnapin ( const CLSID & clsid )

Definition at line 184 of file registry.Cpp.

{
    _TCHAR szKeyBuf[1024];
    LPOLESTR wszCLSID = NULL;

    // Get CLSID
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID);
  MAKE_TSTRPTR_FROMWIDE(pszCLSID, wszCLSID);

    // Load the buffer with the Snap-In Location
    _tcscpy(szKeyBuf, _T("SOFTWARE\\Microsoft\\MMC\\SnapIns"));

    // Copy keyname into buffer.
    _tcscat(szKeyBuf, _T("\\"));
    _tcscat(szKeyBuf, pszCLSID);

    // Delete the CLSID Key - CLSID\{...}
    LONG lResult = recursiveDeleteKey(HKEY_LOCAL_MACHINE, szKeyBuf);
    assert((lResult == ERROR_SUCCESS) ||
         (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

    // free the memory
    CoTaskMemFree(wszCLSID);

    return S_OK;
}

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/WMI/resource.h File Reference

  • SysMgmt
  • MMC
  • WMI
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDB_BIKE 40007
#define | IDB_BIKE2 40011
#define | IDB_CAR 40005
#define | IDB_CAR2 40009
#define | IDB_CLOSED 40014
#define | IDB_CLOSED2 40012
#define | IDB_LGBMP 113
#define | IDB_OPEN 40015
#define | IDB_OPEN2 40013
#define | IDB_PLANE 40006
#define | IDB_PLANE2 40010
#define | IDB_ROCKET 40004
#define | IDB_ROCKET2 40008
#define | IDB_SMBMP 112
#define | IDB_SMOPEN 111
#define | IDC_GIRLS 1013
#define | IDC_PEOPLE_COLOR 1009
#define | IDC_PEOPLE_GIRLS 1013
#define | IDC_PEOPLE_MATERIAL 1010
#define | IDC_PEOPLE_NAME 1008
#define | IDC_PEOPLE_OWNER 1011
#define | IDC_PEOPLE_SURFACE 1012
#define | IDC_ROCKET_HEIGHT 1001
#define | IDC_ROCKET_NAME 1000
#define | IDC_ROCKET_PAYLOAD 1003
#define | IDC_ROCKET_STATUS 1005
#define | IDC_ROCKET_WEIGHT 1002
#define | IDD_PROPPAGE_LARGE 107
#define | IDD_PROPPAGE_PEOPLE 108
#define | IDI_ICON1 108
#define | IDI_PSI_LANDBASED 2
#define | IDI_PSI_ROCKET 114
#define | IDR_LGICONS 121
#define | IDR_SMICONS 120
#define | IDS_ABOUTNAME 9
#define | IDS_BIKE_TITLE 12
#define | IDS_HELPFILE 1
#define | IDS_NAME 3
#define | IDS_PST_LANDBASED 11
#define | IDS_PST_ROCKET 10
#define | IDS_SNAPINDESC 2
#define | IDS_SNAPINNAME 6

Define Documentation

#define IDB_BIKE 40007

Definition at line 38 of file resource.h.

#define IDB_BIKE2 40011

Definition at line 42 of file resource.h.

#define IDB_CAR 40005

Definition at line 36 of file resource.h.

#define IDB_CAR2 40009

Definition at line 40 of file resource.h.

#define IDB_CLOSED 40014

Definition at line 45 of file resource.h.

#define IDB_CLOSED2 40012

Definition at line 43 of file resource.h.

#define IDB_LGBMP 113

Definition at line 19 of file resource.h.

#define IDB_OPEN 40015

Definition at line 46 of file resource.h.

#define IDB_OPEN2 40013

Definition at line 44 of file resource.h.

#define IDB_PLANE 40006

Definition at line 37 of file resource.h.

#define IDB_PLANE2 40010

Definition at line 41 of file resource.h.

#define IDB_ROCKET 40004

Definition at line 35 of file resource.h.

#define IDB_ROCKET2 40008

Definition at line 39 of file resource.h.

#define IDB_SMBMP 112

Definition at line 18 of file resource.h.

#define IDB_SMOPEN 111

Definition at line 17 of file resource.h.

#define IDC_GIRLS 1013

Definition at line 33 of file resource.h.

#define IDC_PEOPLE_COLOR 1009

Definition at line 29 of file resource.h.

#define IDC_PEOPLE_GIRLS 1013

Definition at line 34 of file resource.h.

#define IDC_PEOPLE_MATERIAL 1010

Definition at line 30 of file resource.h.

#define IDC_PEOPLE_NAME 1008

Definition at line 28 of file resource.h.

#define IDC_PEOPLE_OWNER 1011

Definition at line 31 of file resource.h.

#define IDC_PEOPLE_SURFACE 1012

Definition at line 32 of file resource.h.

#define IDC_ROCKET_HEIGHT 1001

Definition at line 24 of file resource.h.

#define IDC_ROCKET_NAME 1000

Definition at line 23 of file resource.h.

#define IDC_ROCKET_PAYLOAD 1003

Definition at line 26 of file resource.h.

#define IDC_ROCKET_STATUS 1005

Definition at line 27 of file resource.h.

#define IDC_ROCKET_WEIGHT 1002

Definition at line 25 of file resource.h.

#define IDD_PROPPAGE_LARGE 107

Definition at line 14 of file resource.h.

#define IDD_PROPPAGE_PEOPLE 108

Definition at line 16 of file resource.h.

#define IDI_ICON1 108

Definition at line 15 of file resource.h.

#define IDI_PSI_LANDBASED 2

Definition at line 7 of file resource.h.

#define IDI_PSI_ROCKET 114

Definition at line 20 of file resource.h.

#define IDR_LGICONS 121

Definition at line 22 of file resource.h.

#define IDR_SMICONS 120

Definition at line 21 of file resource.h.

#define IDS_ABOUTNAME 9

Definition at line 10 of file resource.h.

#define IDS_BIKE_TITLE 12

Definition at line 13 of file resource.h.

#define IDS_HELPFILE 1

Definition at line 5 of file resource.h.

#define IDS_NAME 3

Definition at line 8 of file resource.h.

#define IDS_PST_LANDBASED 11

Definition at line 12 of file resource.h.

#define IDS_PST_ROCKET 10

Definition at line 11 of file resource.h.

#define IDS_SNAPINDESC 2

Definition at line 6 of file resource.h.

#define IDS_SNAPINNAME 6

Definition at line 9 of file resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/WMI/simplearray.h File Reference

  • SysMgmt
  • MMC
  • WMI
Classes

simplearray.h File Reference

Go to the source code of this file.

Classes

class CSimpleArray< T >
Generated on Wed Nov 13 2024 16:54:43 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/WMI/sky.Cpp File Reference

  • SysMgmt
  • MMC
  • WMI

sky.Cpp File Reference

#include "Sky.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/WMI/sky.h File Reference

  • SysMgmt
  • MMC
  • WMI
Classes

sky.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class CSkyBasedVehicle
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/WMI/space.Cpp File Reference

  • SysMgmt
  • MMC
  • WMI
Defines

space.Cpp File Reference

#include <stdio.h>
#include <windows.h>
#include "Space.h"
#include "Comp.h"
#include "resource.h"
#include <strsafe.h>

Go to the source code of this file.

Defines

#define STRSAFE_NO_DEPRECATE

Define Documentation

#define STRSAFE_NO_DEPRECATE

Definition at line 24 of file space.Cpp.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/WMI/space.h File Reference

  • SysMgmt
  • MMC
  • WMI
Classes

space.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class | CRocket
class | CSpaceVehicle
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/WMI/statnode.Cpp File Reference

  • SysMgmt
  • MMC
  • WMI

statnode.Cpp File Reference

#include "StatNode.h"
#include "Space.h"
#include "Sky.h"
#include "People.h"
#include "Land.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/MMC/WMI/statnode.h File Reference

  • SysMgmt
  • MMC
  • WMI
Classes

statnode.h File Reference

#include "DeleBase.h"

Go to the source code of this file.

Classes

class CStaticNode
Generated on Wed Nov 13 2024 16:54:41 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/Msi/create.dll/Create.Cpp File Reference

  • SysMgmt
  • Msi
  • create.dll
Defines | Functions

Create.Cpp File Reference

#include <windows.h>
#include "msiquery.h"
#include "msidefs.h"
#include <basetsd.h>
#include <stdlib.h>
#include <lm.h>

Go to the source code of this file.

Defines

#define | UNICODE 1
#define | WINDOWS_LEAN_AND_MEAN

Functions

void | ClearSecret (WCHAR *wszSecret, DWORD cbSecret)
UINT __stdcall | CreateUserAccount (MSIHANDLE hInstall)

Define Documentation

#define UNICODE 1

Definition at line 24 of file Create.Cpp.

#define WINDOWS_LEAN_AND_MEAN

Definition at line 13 of file Create.Cpp.

Function Documentation

void ClearSecret | ( | WCHAR * | wszSecret,
 |  | DWORD | cbSecret
 | ) |  |

Definition at line 65 of file Create.Cpp.

{
  if (!wszSecret)
    return; // nothing to do

  volatile char* vpch = (volatile char*)wszSecret;
  while (cbSecret)
  {
    *vpch = 0;
    vpch++;
    cbSecret--;
  }
}

UINT __stdcall CreateUserAccount ( MSIHANDLE hInstall )

Definition at line 90 of file Create.Cpp.

{
  const WCHAR* wszSep = L"\001";
  const int iCreationError = 25001;
  const int iCreationDuplicate = 25002;

  // Grab the CustomActionData property
  WCHAR* wszCAData = 0;
  DWORD cchCAData = 0;

  if (ERROR_MORE_DATA != MsiGetPropertyW(hInstall, IPROPNAME_CUSTOMACTIONDATA, L"", &cchCAData))
    return ERROR_INSTALL_FAILURE;

  wszCAData = new WCHAR[++cchCAData];
  if ( !wszCAData )
    return ERROR_INSTALL_FAILURE; // out of memory

  wszCAData[0] = 0;

  if (ERROR_SUCCESS != MsiGetPropertyW(hInstall, IPROPNAME_CUSTOMACTIONDATA, wszCAData, &cchCAData))
  {
    delete [] wszCAData;
    return ERROR_INSTALL_FAILURE; // error -- should never happen
  }

  USER_INFO_1 ui;
  ZeroMemory(&ui, sizeof(USER_INFO_1));

  DWORD dwLevel = 1; // represents USER_INFO_1 struct
  NET_API_STATUS nStatus = NERR_Success;

  //
  // Parse CustomActionDataProperty
  //
  WCHAR* wszUserName = wcstok(wszCAData, wszSep);
  if ( !wszUserName )
  {
    ClearSecret(wszCAData, cchCAData*sizeof(WCHAR));
    delete [] wszCAData;
    return ERROR_INSTALL_FAILURE;
  }
  WCHAR* wszPassWd   = wcstok(NULL, wszSep);
  if ( !wszPassWd )
  {
    ClearSecret(wszCAData, cchCAData*sizeof(WCHAR));
    delete [] wszCAData;
    return ERROR_INSTALL_FAILURE;
  }
  WCHAR* pwch = wcstok(NULL, wszSep);
  if ( !pwch )
  {
    ClearSecret(wszCAData, cchCAData*sizeof(WCHAR));
    delete [] wszCAData;
    return ERROR_INSTALL_FAILURE; // error -- should never happen
  }

  int iUserFlags = wcstol(pwch, 0, 10);

  //
  // Set up the USER_INFO_1 structure.
  //  USER_PRIV_USER: name identifies a user,
  //    rather than an administrator or a guest.
  //  UF_SCRIPT: required for LAN Manager 2.0 and
  //    Windows NT/Windows 2000.
  //
  ui.usri1_name = wszUserName;
  ui.usri1_password = wszPassWd;
  ui.usri1_priv = USER_PRIV_USER;
  ui.usri1_flags = UF_SCRIPT | iUserFlags;
  ui.usri1_home_dir = NULL;
  ui.usri1_comment = NULL;
  ui.usri1_script_path = NULL;

  // Send ActionData message (template in ActionText table)
  PMSIHANDLE hRec = MsiCreateRecord(1);
  if ( !hRec || ERROR_SUCCESS != MsiRecordSetStringW(hRec, 1, wszUserName))
  {
    ClearSecret(wszCAData, cchCAData*sizeof(WCHAR));
    delete [] wszCAData;
    return ERROR_INSTALL_FAILURE;
  }

  int iRet = MsiProcessMessage(hInstall, INSTALLMESSAGE_ACTIONDATA, hRec);
  if (IDCANCEL == iRet || IDABORT == iRet)
  {
    ClearSecret(wszCAData, cchCAData*sizeof(WCHAR));
    delete [] wszCAData;
    return ERROR_INSTALL_USEREXIT;
  }

  //
  // Call the NetUserAdd function, specifying level 1.
  //
  nStatus = NetUserAdd(NULL /*local machine*/, dwLevel, (LPBYTE)&ui, NULL);

  if (nStatus != NERR_Success)
  {
    PMSIHANDLE hRecErr = MsiCreateRecord(3);
    if ( !hRecErr
      || ERROR_SUCCESS != MsiRecordSetInteger(hRecErr, 1, (nStatus == NERR_UserExists) ? iCreationDuplicate : iCreationError)
      || ERROR_SUCCESS != MsiRecordSetStringW(hRecErr, 2, wszUserName)
      || ERROR_SUCCESS != MsiRecordSetInteger(hRecErr, 3, nStatus))
    {
      ClearSecret(wszCAData, cchCAData*sizeof(WCHAR));
      delete [] wszCAData;
      return ERROR_INSTALL_FAILURE;
    }

    // ignore MsiProcessMessage return below because we are aborting the install
    MsiProcessMessage(hInstall, INSTALLMESSAGE_ERROR, hRecErr);

    ClearSecret(wszCAData, cchCAData*sizeof(WCHAR));
    delete [] wszCAData;
    return ERROR_INSTALL_FAILURE; // error
  }

  ClearSecret(wszCAData, cchCAData*sizeof(WCHAR));
  delete [] wszCAData;
  return ERROR_SUCCESS;
}

Generated on Wed Nov 13 2024 16:53:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/Msi/msiloc/msiloc.cpp File Reference

  • SysMgmt
  • Msi
  • msiloc
Classes | Defines | Enumerations | Functions | Variables

msiloc.cpp File Reference

#include <windows.h>
#include "msiquery.h"
#include "msidefs.h"
#include <stdio.h>
#include <stdlib.h>
#include <tchar.h>
#include <assert.h>
#include "strsafe.h"

Go to the source code of this file.

Classes

class | CDialogStream
class | CGenerateRC
class | CImportRes

Defines

#define | WINDOWS_LEAN_AND_MEAN

Enumerations

enum | bdtBinaryDataType { bdtBitmap, bdtJPEG, bdtIcon, bdtEXE_DLL_SCRIPT }

Functions

int __cdecl | _tmain (int argc, TCHAR *argv[])
BOOL __stdcall | EnumDialogCallback (HINSTANCE hModule, const TCHAR *szType, TCHAR *szDialogName, long lParam)
BOOL __stdcall | EnumLanguageCallback (HINSTANCE hModule, const TCHAR *szType, const TCHAR *szName, WORD wIDLanguage, long lParam)
BOOL __stdcall | EnumStringCallback (HINSTANCE hModule, const TCHAR *szType, TCHAR *szName, long lParam)
void | Error (TCHAR *szMsg)
void | ErrorIf (BOOL fError, TCHAR *szMsg, BOOL fThrow)
BOOL | SkipValue (TCHAR *&rpch)
TCHAR | SkipWhiteSpace (TCHAR *&rpch)
void | Usage ()

Variables

UINT g_uiCodePage
WORD | g_wLangId = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL)
const int | ibcData = 2
const int | ibcName = 1
const int | iccAttrib = 7
const int | iccHt = 6
const int | iccName = 1
const int | iccProperty = 9
const int | iccText = 8
const int | iccType = 2
const int | iccWd = 5
const int | iccX = 3
const int | iccY = 4
const int | iciHeight = 4
const int | iciText = 5
const int | iciWidth = 3
const int | iciX = 1
const int | iciY = 2
const int | iCREATE_NEW_DB = 1 << 5
const int | idcAttrib = 6
const int | idcHt = 5
const int | idcName = 1
const int | idcTitle = 7
const int | idcWd = 4
const int | idcX = 2
const int | idcY = 3
const int | iDIALOGS = 1 << 2
const int | idiHCentering = 1
const int | idiHeight = 4
const int | idiTitle = 5
const int | idiVCentering = 2
const int | idiWidth = 3
const int | iEXPORT_MSI = 1 << 0
const int | iIMPORT_RES = 1 << 1
const int | iMaxResStrLen = 256
const int | irbcHt = 5
const int | irbcOrder = 1
const int | irbcText = 6
const int | irbcWd = 4
const int | irbcX = 2
const int | irbcY = 3
const int | irbiHeight = 2
const int | irbiText = 3
const int | irbiWidth = 1
const int | iSKIP_BINARY = 1 << 4
const int | iSTRINGS = 1 << 3
const int | MAX_DIALOGS = 32
const int | MAX_STRINGS = 32
const TCHAR | resBitmap [] = TEXT("BITMAP")
const TCHAR | resButtonClass [] = TEXT("BUTTON")
const TCHAR | resCheckBox [] = TEXT("CHECKBOX")
const TCHAR | resComboBoxClass [] = TEXT("COMBOBOX")
const TCHAR | resControl [] = TEXT("CONTROL")
const TCHAR | resDialog [] = TEXT("DIALOGEX")
const TCHAR | resEditClass [] = TEXT("EDIT")
const TCHAR | resGroupBox [] = TEXT("GROUPBOX")
const TCHAR | resIcon [] = TEXT("ICON")
const TCHAR | resJPEG [] = TEXT("JPEG")
const TCHAR | resListBoxClass [] = TEXT("LISTBOX")
const TCHAR | resListViewClass [] = TEXT("WC_LISTVIEW")
const TCHAR | resProgBar32Class [] = TEXT("PROGRESS_CLASS")
const TCHAR | resPushButton [] = TEXT("PUSHBUTTON")
const TCHAR | resRadioButton [] = TEXT("RADIOBUTTON")
const TCHAR | resRichEditClass [] = TEXT("STATIC")
const TCHAR | resSelTreeClass [] = TEXT("WC_TREEVIEW")
const TCHAR | resStaticClass [] = TEXT("STATIC")
const TCHAR | resStringTable [] = TEXT("STRINGTABLE")
const TCHAR * | sqlBinary = TEXT("SELECT `Name`,`Data` FROM `Binary`")
const TCHAR * | sqlControl = TEXT("SELECT `Control`,`Type`,`X`,`Y`,`Width`,`Height`,`Attributes`,`Text`,`Property` FROM `Control` WHERE `Dialog_`=?")
const TCHAR * | sqlControlImport = TEXT("SELECT `X`,`Y`,`Width`,`Height`,`Text` FROM `Control` WHERE `Dialog_`=? AND `Control`=?")
const TCHAR | sqlControlInstallerName [] = TEXT("SELECT `Dialog_`,`Control_` FROM `_RESControls` WHERE `RCID`=?")
const TCHAR * | sqlCreateCtrlMark = TEXT("CREATE TABLE `_RESControls` (`Dialog_` CHAR(72) NOT NULL, `Control_` CHAR(72) NOT NULL, `RCID` INT NOT NULL PRIMARY KEY `Dialog_`, `Control_`)")
const TCHAR * | sqlCreateDlgMap = TEXT("CREATE TABLE `_RESDialogs` (`RCStr` CHAR(72) NOT NULL, `Dialog` CHAR(72) PRIMARY KEY `RCStr`)")
const TCHAR | sqlCreateStrMap [] = TEXT("CREATE TABLE `_RESStrings` (`Table` CHAR(72) NOT NULL, `Column` CHAR(72) NOT NULL, `Key` CHAR(0), `RCID` SHORT NOT NULL PRIMARY KEY `Table`, `Column`, `Key`)")
const TCHAR * | sqlCtrlMark = TEXT("SELECT `Dialog_`,`Control_`,`RCID` FROM `_RESControls`")
const TCHAR * | sqlDialog = TEXT("SELECT `Dialog`,`HCentering`,`VCentering`,`Width`,`Height`,`Attributes`,`Title` FROM `Dialog`")
const TCHAR * | sqlDialogImport = TEXT("SELECT `HCentering`,`VCentering`,`Width`,`Height`,`Title` FROM `Dialog` WHERE `Dialog`=?")
const TCHAR | sqlDialogInstallerName [] = TEXT("SELECT `Dialog` FROM `_RESDialogs` WHERE `RCStr`=?")
const TCHAR * | sqlDialogSpecific = TEXT("SELECT `Dialog`,`HCentering`,`VCentering`,`Width`,`Height`,`Attributes`,`Title` FROM `Dialog` WHERE `Dialog`=?")
const TCHAR * | sqlDlgMap = TEXT("SELECT `RCStr`,`Dialog` FROM `_RESDialogs`")
const TCHAR * | sqlFindResId = TEXT("SELECT `RCID` FROM `_RESControls` WHERE `Dialog_`='%s' AND `Control_`='%s'")
const TCHAR * | sqlFindStrResId = TEXT("SELECT `RCID` FROM `_RESStrings` WHERE `Table`='%s' AND `Column`='%s' AND `Key`='%s'")
const TCHAR * | sqlInsertCtrl = TEXT("SELECT `Dialog_`,`Control_`,`RCID` FROM `_RESControls`")
const TCHAR * | sqlInsertStr = TEXT("SELECT `Table`,`Column`,`Key`, `RCID` FROM `_RESStrings`")
const TCHAR * | sqlRadioButton = TEXT("SELECT `Order`, `X`, `Y`, `Width`, `Height`, `Text` FROM `RadioButton` WHERE `Property`=?")
const TCHAR * | sqlRadioButtonImport = TEXT("SELECT `Width`, `Height`, `Text` FROM `RadioButton` WHERE `Property`=? AND `Order`=?")
const TCHAR * | sqlSelMaxRcId = TEXT("SELECT `RCID` FROM `_RESControls` WHERE `Dialog_`='MAX_RESOURCE_ID' AND `Control_`='MAX_RESOURCE_ID'")
const TCHAR * | sqlSelMaxStrRcId = TEXT("SELECT `RCID` FROM `_RESStrings` WHERE `Table`='MAX_RESOURCE_ID' AND `Column`='MAX_RESOURCE_ID'")
const TCHAR * | sqlStrCol = TEXT("SELECT %s, `%s` FROM `%s`")
const TCHAR * | sqlStringImport = TEXT("SELECT `%s` FROM `%s` WHERE ")
const TCHAR | sqlStringInstallerName [] = TEXT("SELECT `Table`,`Column`,`Key` FROM `_RESStrings` WHERE `RCID`=? AND `Table`<>'MAX_RESOURCE_ID'")
const TCHAR * | sqlStrMark = TEXT("SELECT `Table`,`Column`, `Key`, `RCID` FROM `_RESStrings`")
const TCHAR * | sqlStrTemp = TEXT("SELECT * FROM `%s`")
const TCHAR | strOverLimit [] = TEXT("!! STR OVER LIMIT !!")
const TCHAR * | szCodepageExport = TEXT("_ForceCodepage.idt")
const TCHAR * | szCodepageFile = TEXT("codepage.idt")
const TCHAR | szCommaTab [] = TEXT(",\t")
const TCHAR | szCommCtrlHdrFile [] = TEXT("#include <commctrl.h>")
const TCHAR | szCRLF [] = TEXT("\r\n")
const TCHAR | szCurlyBeg [] = TEXT("{")
const TCHAR | szCurlyEnd [] = TEXT("}")
const TCHAR * | szForceCodepage = TEXT("_ForceCodepage")
const TCHAR * | szLineFeed = TEXT("\r\n\r\n")
const TCHAR * | szMsiBillboard = TEXT("Billboard")
const TCHAR * | szMsiBitmap = TEXT("Bitmap")
const TCHAR * | szMsiCheckBox = TEXT("CheckBox")
const TCHAR * | szMsiComboBox = TEXT("ComboBox")
const TCHAR * | szMsiDirCombo = TEXT("DirectoryCombo")
const TCHAR * | szMsiDirList = TEXT("DirectoryList")
const TCHAR * | szMsiEdit = TEXT("Edit")
const TCHAR * | szMsiGroupBox = TEXT("GroupBox")
const TCHAR * | szMsiIcon = TEXT("Icon")
const TCHAR * | szMsiLine = TEXT("Line")
const TCHAR * | szMsiList = TEXT("ListView")
const TCHAR * | szMsiListBox = TEXT("ListBox")
const TCHAR * | szMsiMaskedEdit = TEXT("MaskedEdit")
const TCHAR * | szMsiPathEdit = TEXT("PathEdit")
const TCHAR * | szMsiProgressBar = TEXT("ProgressBar")
const TCHAR * | szMsiPushbutton = TEXT("PushButton")
const TCHAR * | szMsiRadioButton = TEXT("RadioButton")
const TCHAR * | szMsiRadioButtonGroup = TEXT("RadioButtonGroup")
const TCHAR * | szMsiScrollableText = TEXT("ScrollableText")
const TCHAR * | szMsiSelTree = TEXT("SelectionTree")
const TCHAR * | szMsiText = TEXT("Text")
const TCHAR * | szMsiVolSelCombo = TEXT("VolumeSelectCombo")
const TCHAR * | szMsiVolumeCostList = TEXT("VolumeCostList")
const TCHAR | szQuotes [] = TEXT("\"")
const TCHAR | szTab [] = TEXT("\t")
const TCHAR | szTokenSeps [] = TEXT(":")
const TCHAR | szWndwHdrFile [] = TEXT("#include <windows.h>")
const TCHAR | tokCaption [] = TEXT("CAPTION")

Define Documentation

#define WINDOWS_LEAN_AND_MEAN

Definition at line 42 of file msiloc.cpp.

Enumeration Type Documentation

enum bdtBinaryDataType
Enumerator:
bdtBitmap
bdtJPEG
bdtIcon
bdtEXE_DLL_SCRIPT

Definition at line 217 of file msiloc.cpp.

{
  bdtBitmap,        // bitmap
  bdtJPEG,          // JPEG
  bdtIcon,          // Icon
  bdtEXE_DLL_SCRIPT // EXE, DLL, or SCRIPT
};

Function Documentation

int __cdecl _tmain | ( | int | argc,
 |  | TCHAR * | argv[]
 | ) |  |

Definition at line 4230 of file msiloc.cpp.

{
  // WE WANT UNICODE ON NT/Windows2000
  // ?? ANSI on WIN9x

  try
  {
    TCHAR* szCmdLine = GetCommandLine();
    if ( !szCmdLine )
    {
      Usage();
      throw 1;
    }

    TCHAR* pch = szCmdLine;
    // skip module name
    if ( !SkipValue(pch) )
    {
      Usage();
      throw 1;
    }

    TCHAR chCmdNext;

    TCHAR* rgszTables[MAX_STRINGS];
    TCHAR* rgszColumns[MAX_STRINGS];
    TCHAR* rgszDialogs[MAX_DIALOGS];
    TCHAR* szDb = 0;
    TCHAR* szRESDLL = 0;
    TCHAR* szSaveDatabase = 0;
    int cStr = 0;
    int cDlg = 0;
    int iMode = 0;
    while ((chCmdNext = SkipWhiteSpace(pch)) != 0)
    {
      if (chCmdNext == TEXT('/') || chCmdNext == TEXT('-'))
      {
        TCHAR* szCmdOption = pch++;
        TCHAR chOption = (TCHAR)(*pch++ | 0x20);
        chCmdNext = SkipWhiteSpace(pch);
        TCHAR* szCmdData = pch;
        switch (chOption)
        {
        case TEXT('i'):
          iMode |= iIMPORT_RES;
          if (!SkipValue(pch))
            Error(TEXT("Missing Option Data (option = I)\n"));
          szDb = szCmdData;
          szCmdData = pch;
          if (!SkipValue(pch))
            Error(TEXT("Missing Option Data (option = I)\n"));
          szRESDLL = szCmdData;
          break;
        case TEXT('e'):
          iMode |= iEXPORT_MSI;
          if (!SkipValue(pch))
            Error(TEXT("Missing Option Data (option = E)\n"));
          szDb = szCmdData;
          break;
        case TEXT('d'):
          iMode |= iDIALOGS;
          if (!SkipValue(pch))
            Error(TEXT("Missing Option Data (option = D)\n"));
          if (cDlg == MAX_DIALOGS)
            Error(TEXT("Too Many Dialogs On Command Line\n"));
          rgszDialogs[cDlg++] = szCmdData;
          break;
        case TEXT('s'):
          iMode |= iSTRINGS;
          if (!SkipValue(pch))
            Error(TEXT("Missing Option Data (option = S)\n"));
          if (cStr == MAX_STRINGS)
            Error(TEXT("Too Many Table:Column Pairs On Command Line\n"));
          rgszTables[cStr] = szCmdData;
          szCmdData = pch;
          if (!SkipValue(pch))
            Error(TEXT("Missing Option Data (option = S)\n"));
          rgszColumns[cStr++] = szCmdData;
          break;
        case TEXT('x'):
          iMode |= iSKIP_BINARY;
          break;
        case TEXT('c'):
          iMode |= iCREATE_NEW_DB;
          if (!SkipValue(pch))
            Error(TEXT("Missing Option Data (option = C)\n"));
          szSaveDatabase = szCmdData;
          break;
        case TEXT('?'):
          Usage();
          return 0;
        default:
          Usage();
          return 1;
        }
      }
      else
      {
        Usage();
        return 1;
      }
    }

    // must specify either EXPORT or IMPORT, but not both
    if (iMode == 0 || (iMode & (iEXPORT_MSI | iIMPORT_RES)) == (iEXPORT_MSI | iIMPORT_RES) ||
      (iMode & ~(iEXPORT_MSI | iIMPORT_RES)) == 0)
    {
      Usage();
      throw 1;
    }

    if ((iMode & iCREATE_NEW_DB) && !szDb)
    {
      Usage();
      throw 1;
    }

    if ((iMode & iEXPORT_MSI) && szDb)
    {
      // export MSI to RESOURCE file
      CGenerateRC genRC(szDb, (iMode & iCREATE_NEW_DB) ? szSaveDatabase : NULL);
      if (iMode & iDIALOGS)
      {
        // export DIALOGS
        BOOL fBinary = (iMode & iSKIP_BINARY) ? FALSE : TRUE;
        if (1 == cDlg && 0 == _tcscmp(TEXT("*"), rgszDialogs[0]))
        {
          // export all dialogs
          ErrorIf(ERROR_SUCCESS != genRC.OutputDialogs(fBinary), TEXT("Failed to Export Dialogs To Resource File"), true);
        }
        else
        {
          // export specified dialogs only
          // we'll try every dialog listed so we won't through the error
          for (int i = 0; i < cDlg; i++)
            ErrorIf(ERROR_SUCCESS != genRC.OutputDialog(rgszDialogs[i], fBinary), TEXT("Failed to Export Dialog To Resource File"), false);
          ErrorIf(genRC.IsInErrorState(), TEXT("EXPORT failed"), true);
        }
      }
      if (iMode & iSTRINGS)
      {
        // export STRINGS
        if (1 == cStr && 0 == _tcscmp(TEXT("*"), rgszTables[0]) && 0 == _tcscmp(TEXT("*"), rgszColumns[0]))
        {
          // export all strings
          // NOT SUPPORTED
          _tprintf(TEXT("EXPORT ALL STRINGS OPTION is not supported\n"));
          Usage();
          throw 1;
        }
        for (int i = 0; i < cStr; i++)
          ErrorIf(ERROR_SUCCESS != genRC.OutputString(rgszTables[i], rgszColumns[i]), TEXT("Failed to Export Strings"), false);
        ErrorIf(genRC.IsInErrorState(), TEXT("EXPORT STRINGS failed"), true);
      }
    }
    else if ((iMode & iIMPORT_RES) && szDb && szRESDLL)
    {
      // import RESOURCE DLL into MSI
      CImportRes importRes(szDb, (iMode & iCREATE_NEW_DB) ? szSaveDatabase  : NULL, szRESDLL);
      if (iMode & iDIALOGS)
      {
        // import DIALOGS
        if (1 == cDlg && 0 == _tcscmp(TEXT("*"), rgszDialogs[0]))
        {
          // import all dialogs
          ErrorIf(ERROR_SUCCESS != importRes.ImportDialogs(), TEXT("Failed to Import Dialogs Into Database"), true);
        }
        else
        {
          // import specified dialogs only
          // we'll try every dialog listed so we won't through the error
          for (int i = 0; i < cDlg; i++)
            ErrorIf(ERROR_SUCCESS != importRes.ImportDialog(rgszDialogs[i]), TEXT("Failed to Import Dialog Into Database"), false);
          ErrorIf(importRes.IsInErrorState(), TEXT("IMPORT failed"), true);
        }
      }
      if (iMode & iSTRINGS)
      {
        // import STRINGS
        if (1 == cStr && 0 == _tcscmp(TEXT("*"), rgszTables[0]) && 0 == _tcscmp(TEXT("*"), rgszColumns[0]))
        {
          // import all strings
          ErrorIf(importRes.ImportStrings(), TEXT("IMPORT STRINGS failed"), true);
        }
        else
        {
          // import specific strings only
          // UNSUPPORTED option
          _tprintf(TEXT("IMPORT SPECIFIC STRINGS option is not supported\n"));
          Usage();
          throw 1;
        }
      }
    }
    else
    {
      Usage();
      throw 1;
    }
    return 0;
  }
  catch (int i)
  {
    i;
    return 1;
  }
  catch (...)
  {
    _tprintf(TEXT("\n MSILOC: unhandled exception.\n"));
    return 2;
  }

} // end of main

BOOL __stdcall EnumDialogCallback | ( | HINSTANCE | hModule,
 |  | const TCHAR * | szType,
 |  | TCHAR * | szDialogName,
 |  | long | lParam
 | ) |  |

Definition at line 3893 of file msiloc.cpp.

{
  // determine codepage required.  steps, enumerate languages in resource file (better be no more than two)
  // possibilities are NEUTRAL (non-localized) + other lang

  if ( !lParam )
    return FALSE;

  ((CImportRes*)lParam)->SetFoundLang(FALSE); // init to FALSE
  if (!EnumResourceLanguages(hModule, szType, szDialogName, EnumLanguageCallback, lParam))
    return FALSE;

#ifdef DEBUG
  _tprintf(TEXT("LOG>> DIALOG: '%s' FOUND\n"),szDialogName);
#endif

  BOOL fOK = ((CImportRes*)lParam)->LoadDialog(hModule, szType, szDialogName);
  if (!fOK)
  {
    // error occured
    ((CImportRes*)lParam)->SetErrorState(TRUE);
    return FALSE;
  }
  return TRUE;
}

BOOL __stdcall EnumLanguageCallback | ( | HINSTANCE | hModule,
 |  | const TCHAR * | szType,
 |  | const TCHAR * | szName,
 |  | WORD | wIDLanguage,
 |  | long | lParam
 | ) |  |

Definition at line 3946 of file msiloc.cpp.

{
  /*************************************************************************************
  RESTRICTIONS:
  1.) ONLY 1 language per resource
  2.) UP To 2 languages per resource file (but 1 must be LANG_NEUTRAL)
  3.) On Win9x we must be on a system matching the required codepage
  4.) We should only be able to update a language neutral database or
      a database set with the required code page
  5.) Database can only have one code page (Although _SummaryInformation stream
      can have a code page different from database as _SummaryInformation is considered
    to be different
  **************************************************************************************/

  if ( !lParam )
    return FALSE;

  if (((CImportRes*)lParam)->WasLanguagePreviouslyFound())
  {
    // ERROR -- more than 1 language per dialog
    _tprintf(TEXT("!! STRING RESOURCE IS IN MORE THAN ONE LANGUAGE IN RESOURCE FILE\n"));
    ((CImportRes*)lParam)->SetErrorState(TRUE);
    return FALSE;
  }

  // if languages match we are good to go
  if (g_wLangId != wIDLanguage)
  {
    // languages don't match
    // 2 valid scenarios

    // valid SCENARIO 1: g_wLangId is NEUTRAL, wIDLanguage new language
    // valid SCENARIO 2: g_wLangId is language, wIDLanguage is NEUTRAL
    // all other scenarios invalid
    if (g_wLangId == MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL))
    {
      // set codepage, update g_uiCodePage
      if (!((CImportRes*)lParam)->SetCodePage(wIDLanguage))
        return ((CImportRes*)lParam)->SetErrorState(TRUE), FALSE;
      g_wLangId = wIDLanguage;
    }
    else if (wIDLanguage != MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL))
    {
      // invalid, 2 different languages, neither one NEUTRAL
      _tprintf(TEXT("!! Resource file contains more than one language. Not Supported. Lang1 = %d, Lang2 = %d\n"), g_wLangId, wIDLanguage);
      return ((CImportRes*)lParam)->SetErrorState(TRUE), FALSE;
    }
  }

  ((CImportRes*)lParam)->SetFoundLang(TRUE); // language found for resource
  return TRUE;
}

BOOL __stdcall EnumStringCallback | ( | HINSTANCE | hModule,
 |  | const TCHAR * | szType,
 |  | TCHAR * | szName,
 |  | long | lParam
 | ) |  |

Definition at line 3921 of file msiloc.cpp.

{
  if ( !lParam )
    return FALSE;

  ((CImportRes*)lParam)->SetFoundLang(FALSE); // init to FALSE

  // determine codepage required.  steps, enumerate languages in resource file (better be no more than two)
  // possibilities are NEUTRAL (non-localized) + other lang
  if (!EnumResourceLanguages(hModule, szType, szName, EnumLanguageCallback, lParam))
    return FALSE;

  BOOL fOK = ((CImportRes*)lParam)->LoadString(hModule, szType, szName);
  if (!fOK)
  {
    // error occured
    ((CImportRes*)lParam)->SetErrorState(TRUE);
    return FALSE;
  }
  return TRUE;
}

void Error ( TCHAR * szMsg )

Definition at line 4208 of file msiloc.cpp.

{
  if (szMsg)
    _tprintf(TEXT("MSILOC ERROR: %s\n"), szMsg);
  throw 1;
}

void ErrorIf | ( | BOOL | fError,
 |  | TCHAR * | szMsg,
 |  | BOOL | fThrow
 | ) |  |

Definition at line 4217 of file msiloc.cpp.

{
  if (fError)
  {
    if (szMsg)
            _tprintf(TEXT("MSILOC ERROR: %s\n"), szMsg);
    if (fThrow)
      throw 1;
  }
}

bool SkipValue ( TCHAR *& rpch )

Definition at line 4165 of file msiloc.cpp.

{
  if ( !rpch )
    return FALSE;

  TCHAR ch = *rpch;
  if (ch == 0 || ch == TEXT('/') || ch == TEXT('-'))
    return FALSE;   // no value present

  TCHAR *pchSwitchInUnbalancedQuotes = NULL;

  for (; (ch = *rpch) != TEXT(' ') && ch != TEXT('\t') && ch != 0; rpch++)
  {
    if (*rpch == TEXT('"'))
    {
      rpch++; // for '"'

      for (; (ch = *rpch) != TEXT('"') && ch != 0; rpch = CharNext(rpch))
      {
        if ((ch == TEXT('/') || ch == TEXT('-')) && (NULL == pchSwitchInUnbalancedQuotes))
        {
          pchSwitchInUnbalancedQuotes = rpch;
        }
      }
      rpch = CharNext(rpch);
            ch = *rpch;
            break;
    }
  }
  if (ch != 0)
  {
    *rpch++ = 0;
  }
  else
  {
    if (pchSwitchInUnbalancedQuotes)
      rpch=pchSwitchInUnbalancedQuotes;
  }
  return TRUE;
}

TCHAR SkipWhiteSpace ( TCHAR *& rpch )

Definition at line 4152 of file msiloc.cpp.

{
  TCHAR ch = 0;
  if (rpch)
  {
    for (; (ch = *rpch) == TEXT(' ') || ch == TEXT('\t'); rpch++)
      ;
  }
  return ch;
}

void Usage ( void )

Definition at line 4123 of file msiloc.cpp.

{
  _tprintf(
      TEXT("MSILOC.EXE -- Copyright (C) Microsoft Corporation, 2000-2001.  All rights reserved\n")
      TEXT("\t*Generates a resource file from the UI in the installation package\n")
      TEXT("\t*Imports a localized resource DLL into an installation package\n")
      TEXT("\n")
      TEXT("SYNTAX -->EXPORT MSI TO RC (creates a resource file):\n")
      TEXT("  msiloc -e {database} {option 1}{option 2}...\n")
      TEXT("SYNTAX -->IMPORT (RES)DLL TO MSI:\n")
      TEXT("  msiloc -i {database} {resource DLL} {option 1}{option 2}...\n")
      TEXT("OPTIONS:\n")
      TEXT("    -d * all dialogs\n")
      TEXT("    -d {Dialog1} specific dialog\n")
      TEXT("    -s {Table Column} specific column of strings (EXPORT ONLY)\n")
      TEXT("    -s * * all strings (IMPORT ONLY)\n")
      TEXT("    -x option to not export binary data (bitmaps, icons, jpegs) (EXPORT ONLY)\n")
      TEXT("    -c {database} option to save to a new database\n")
      TEXT("\n")
      TEXT("CREATING A .RES FILE:\n")
      TEXT("    rc.exe {resource file}\n")
      TEXT("CREATING A .DLL FILE:\n")
      TEXT("    link.exe /DLL /NOENTRY /NODEFAULTLIB /MACHINE:iX86\n")
      TEXT("         /OUT:{resource DLL} {compiled res file}\n")
      );
}

Variable Documentation

UINT g_uiCodePage

Definition at line 231 of file msiloc.cpp.

WORD g_wLangId = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL)

Definition at line 232 of file msiloc.cpp.

const int ibcData = 2

Definition at line 129 of file msiloc.cpp.

const int ibcName = 1

Definition at line 128 of file msiloc.cpp.

const int iccAttrib = 7

Definition at line 155 of file msiloc.cpp.

const int iccHt = 6

Definition at line 154 of file msiloc.cpp.

const int iccName = 1

Definition at line 149 of file msiloc.cpp.

const int iccProperty = 9

Definition at line 157 of file msiloc.cpp.

const int iccText = 8

Definition at line 156 of file msiloc.cpp.

const int iccType = 2

Definition at line 150 of file msiloc.cpp.

const int iccWd = 5

Definition at line 153 of file msiloc.cpp.

const int iccX = 3

Definition at line 151 of file msiloc.cpp.

const int iccY = 4

Definition at line 152 of file msiloc.cpp.

const int iciHeight = 4

Definition at line 180 of file msiloc.cpp.

const int iciText = 5

Definition at line 181 of file msiloc.cpp.

const int iciWidth = 3

Definition at line 179 of file msiloc.cpp.

const int iciX = 1

Definition at line 177 of file msiloc.cpp.

const int iciY = 2

Definition at line 178 of file msiloc.cpp.

const int iCREATE_NEW_DB = 1 << 5

Definition at line 211 of file msiloc.cpp.

const int idcAttrib = 6

Definition at line 140 of file msiloc.cpp.

const int idcHt = 5

Definition at line 139 of file msiloc.cpp.

const int idcName = 1

Definition at line 135 of file msiloc.cpp.

const int idcTitle = 7

Definition at line 141 of file msiloc.cpp.

const int idcWd = 4

Definition at line 138 of file msiloc.cpp.

const int idcX = 2

Definition at line 136 of file msiloc.cpp.

const int idcY = 3

Definition at line 137 of file msiloc.cpp.

const int iDIALOGS = 1 << 2

Definition at line 207 of file msiloc.cpp.

const int idiHCentering = 1

Definition at line 170 of file msiloc.cpp.

const int idiHeight = 4

Definition at line 173 of file msiloc.cpp.

const int idiTitle = 5

Definition at line 174 of file msiloc.cpp.

const int idiVCentering = 2

Definition at line 171 of file msiloc.cpp.

const int idiWidth = 3

Definition at line 172 of file msiloc.cpp.

const int iEXPORT_MSI = 1 << 0

Definition at line 204 of file msiloc.cpp.

const int iIMPORT_RES = 1 << 1

Definition at line 205 of file msiloc.cpp.

const int iMaxResStrLen = 256

Definition at line 115 of file msiloc.cpp.

const int irbcHt = 5

Definition at line 164 of file msiloc.cpp.

const int irbcOrder = 1

Definition at line 160 of file msiloc.cpp.

const int irbcText = 6

Definition at line 165 of file msiloc.cpp.

const int irbcWd = 4

Definition at line 163 of file msiloc.cpp.

const int irbcX = 2

Definition at line 161 of file msiloc.cpp.

const int irbcY = 3

Definition at line 162 of file msiloc.cpp.

const int irbiHeight = 2

Definition at line 185 of file msiloc.cpp.

const int irbiText = 3

Definition at line 186 of file msiloc.cpp.

const int irbiWidth = 1

Definition at line 184 of file msiloc.cpp.

const int iSKIP_BINARY = 1 << 4

Definition at line 210 of file msiloc.cpp.

const int iSTRINGS = 1 << 3

Definition at line 208 of file msiloc.cpp.

const int MAX_DIALOGS = 32

Definition at line 213 of file msiloc.cpp.

const int MAX_STRINGS = 32

Definition at line 214 of file msiloc.cpp.

const TCHAR resBitmap[] = TEXT("BITMAP")

Definition at line 76 of file msiloc.cpp.

const TCHAR resButtonClass[] = TEXT("BUTTON")

Definition at line 82 of file msiloc.cpp.

const TCHAR resCheckBox[] = TEXT("CHECKBOX")

Definition at line 72 of file msiloc.cpp.

const TCHAR resComboBoxClass[] = TEXT("COMBOBOX")

Definition at line 86 of file msiloc.cpp.

const TCHAR resControl[] = TEXT("CONTROL")

Definition at line 75 of file msiloc.cpp.

const TCHAR resDialog[] = TEXT("DIALOGEX")

Definition at line 70 of file msiloc.cpp.

const TCHAR resEditClass[] = TEXT("EDIT")

Definition at line 87 of file msiloc.cpp.

const TCHAR resGroupBox[] = TEXT("GROUPBOX")

Definition at line 73 of file msiloc.cpp.

const TCHAR resIcon[] = TEXT("ICON")

Definition at line 77 of file msiloc.cpp.

const TCHAR resJPEG[] = TEXT("JPEG")

Definition at line 78 of file msiloc.cpp.

const TCHAR resListBoxClass[] = TEXT("LISTBOX")

Definition at line 88 of file msiloc.cpp.

const TCHAR resListViewClass[] = TEXT("WC_LISTVIEW")

Definition at line 84 of file msiloc.cpp.

const TCHAR resProgBar32Class[] = TEXT("PROGRESS_CLASS")

Definition at line 83 of file msiloc.cpp.

const TCHAR resPushButton[] = TEXT("PUSHBUTTON")

Definition at line 71 of file msiloc.cpp.

const TCHAR resRadioButton[] = TEXT("RADIOBUTTON")

Definition at line 74 of file msiloc.cpp.

const TCHAR resRichEditClass[] = TEXT("STATIC")

Definition at line 89 of file msiloc.cpp.

const TCHAR resSelTreeClass[] = TEXT("WC_TREEVIEW")

Definition at line 81 of file msiloc.cpp.

const TCHAR resStaticClass[] = TEXT("STATIC")

Definition at line 85 of file msiloc.cpp.

const TCHAR resStringTable[] = TEXT("STRINGTABLE")

Definition at line 79 of file msiloc.cpp.

const TCHAR* sqlBinary = TEXT("SELECT `Name`,`Data` FROM `Binary`")

Definition at line 127 of file msiloc.cpp.

const TCHAR* sqlControl = TEXT("SELECT `Control`,`Type`,`X`,`Y`,`Width`,`Height`,`Attributes`,`Text`,`Property` FROM `Control` WHERE `Dialog_`=?")

Definition at line 148 of file msiloc.cpp.

const TCHAR* sqlControlImport = TEXT("SELECT `X`,`Y`,`Width`,`Height`,`Text` FROM `Control` WHERE `Dialog_`=? AND `Control`=?")

Definition at line 176 of file msiloc.cpp.

const TCHAR sqlControlInstallerName[] = TEXT("SELECT `Dialog_`,`Control_` FROM `_RESControls` WHERE `RCID`=?")

Definition at line 192 of file msiloc.cpp.

const TCHAR* sqlCreateCtrlMark = TEXT("CREATE TABLE `_RESControls` (`Dialog_` CHAR(72) NOT NULL, `Control_` CHAR(72) NOT NULL, `RCID` INT NOT NULL PRIMARY KEY `Dialog_`, `Control_`)")

Definition at line 143 of file msiloc.cpp.

const TCHAR* sqlCreateDlgMap = TEXT("CREATE TABLE `_RESDialogs` (`RCStr` CHAR(72) NOT NULL, `Dialog` CHAR(72) PRIMARY KEY `RCStr`)")

Definition at line 131 of file msiloc.cpp.

const TCHAR sqlCreateStrMap[] = TEXT("CREATE TABLE `_RESStrings` (`Table` CHAR(72) NOT NULL, `Column` CHAR(72) NOT NULL, `Key` CHAR(0), `RCID` SHORT NOT NULL PRIMARY KEY `Table`, `Column`, `Key`)")

Definition at line 121 of file msiloc.cpp.

const TCHAR* sqlCtrlMark = TEXT("SELECT `Dialog_`,`Control_`,`RCID` FROM `_RESControls`")

Definition at line 144 of file msiloc.cpp.

const TCHAR* sqlDialog = TEXT("SELECT `Dialog`,`HCentering`,`VCentering`,`Width`,`Height`,`Attributes`,`Title` FROM `Dialog`")

Definition at line 133 of file msiloc.cpp.

const TCHAR* sqlDialogImport = TEXT("SELECT `HCentering`,`VCentering`,`Width`,`Height`,`Title` FROM `Dialog` WHERE `Dialog`=?")

Definition at line 169 of file msiloc.cpp.

const TCHAR sqlDialogInstallerName[] = TEXT("SELECT `Dialog` FROM `_RESDialogs` WHERE `RCStr`=?")

Definition at line 191 of file msiloc.cpp.

const TCHAR* sqlDialogSpecific = TEXT("SELECT `Dialog`,`HCentering`,`VCentering`,`Width`,`Height`,`Attributes`,`Title` FROM `Dialog` WHERE `Dialog`=?")

Definition at line 134 of file msiloc.cpp.

const TCHAR* sqlDlgMap = TEXT("SELECT `RCStr`,`Dialog` FROM `_RESDialogs`")

Definition at line 132 of file msiloc.cpp.

const TCHAR* sqlFindResId = TEXT("SELECT `RCID` FROM `_RESControls` WHERE `Dialog_`='%s' AND `Control_`='%s'")

Definition at line 147 of file msiloc.cpp.

const TCHAR* sqlFindStrResId = TEXT("SELECT `RCID` FROM `_RESStrings` WHERE `Table`='%s' AND `Column`='%s' AND `Key`='%s'")

Definition at line 125 of file msiloc.cpp.

const TCHAR* sqlInsertCtrl = TEXT("SELECT `Dialog_`,`Control_`,`RCID` FROM `_RESControls`")

Definition at line 146 of file msiloc.cpp.

const TCHAR* sqlInsertStr = TEXT("SELECT `Table`,`Column`,`Key`, `RCID` FROM `_RESStrings`")

Definition at line 124 of file msiloc.cpp.

const TCHAR* sqlRadioButton = TEXT("SELECT `Order`, `X`, `Y`, `Width`, `Height`, `Text` FROM `RadioButton` WHERE `Property`=?")

Definition at line 159 of file msiloc.cpp.

const TCHAR* sqlRadioButtonImport = TEXT("SELECT `Width`, `Height`, `Text` FROM `RadioButton` WHERE `Property`=? AND `Order`=?")

Definition at line 183 of file msiloc.cpp.

const TCHAR* sqlSelMaxRcId = TEXT("SELECT `RCID` FROM `_RESControls` WHERE `Dialog_`='MAX_RESOURCE_ID' AND `Control_`='MAX_RESOURCE_ID'")

Definition at line 145 of file msiloc.cpp.

const TCHAR* sqlSelMaxStrRcId = TEXT("SELECT `RCID` FROM `_RESStrings` WHERE `Table`='MAX_RESOURCE_ID' AND `Column`='MAX_RESOURCE_ID'")

Definition at line 122 of file msiloc.cpp.

const TCHAR* sqlStrCol = TEXT("SELECT %s, `%s` FROM `%s`")

Definition at line 120 of file msiloc.cpp.

const TCHAR* sqlStringImport = TEXT("SELECT `%s` FROM `%s` WHERE ")

Definition at line 188 of file msiloc.cpp.

const TCHAR sqlStringInstallerName[] = TEXT("SELECT `Table`,`Column`,`Key` FROM `_RESStrings` WHERE `RCID`=? AND `Table`<>'MAX_RESOURCE_ID'")

Definition at line 193 of file msiloc.cpp.

const TCHAR* sqlStrMark = TEXT("SELECT `Table`,`Column`, `Key`, `RCID` FROM `_RESStrings`")

Definition at line 123 of file msiloc.cpp.

const TCHAR* sqlStrTemp = TEXT("SELECT * FROM `%s`")

Definition at line 189 of file msiloc.cpp.

const TCHAR strOverLimit[] = TEXT("!! STR OVER LIMIT !!")

Definition at line 116 of file msiloc.cpp.

const TCHAR* szCodepageExport = TEXT("_ForceCodepage.idt")

Definition at line 200 of file msiloc.cpp.

const TCHAR* szCodepageFile = TEXT("codepage.idt")

Definition at line 197 of file msiloc.cpp.

const TCHAR szCommaTab[] = TEXT(",\t")

Definition at line 64 of file msiloc.cpp.

const TCHAR szCommCtrlHdrFile[] = TEXT("#include <commctrl.h>")

Definition at line 61 of file msiloc.cpp.

const TCHAR szCRLF[] = TEXT("\r\n")

Definition at line 63 of file msiloc.cpp.

const TCHAR szCurlyBeg[] = TEXT("{")

Definition at line 66 of file msiloc.cpp.

const TCHAR szCurlyEnd[] = TEXT("}")

Definition at line 67 of file msiloc.cpp.

const TCHAR* szForceCodepage = TEXT("_ForceCodepage")

Definition at line 198 of file msiloc.cpp.

const TCHAR* szLineFeed = TEXT("\r\n\r\n")

Definition at line 199 of file msiloc.cpp.

const TCHAR* szMsiBillboard = TEXT("Billboard")

Definition at line 92 of file msiloc.cpp.

const TCHAR* szMsiBitmap = TEXT("Bitmap")

Definition at line 110 of file msiloc.cpp.

const TCHAR* szMsiCheckBox = TEXT("CheckBox")

Definition at line 96 of file msiloc.cpp.

const TCHAR* szMsiComboBox = TEXT("ComboBox")

Definition at line 105 of file msiloc.cpp.

const TCHAR* szMsiDirCombo = TEXT("DirectoryCombo")

Definition at line 106 of file msiloc.cpp.

const TCHAR* szMsiDirList = TEXT("DirectoryList")

Definition at line 103 of file msiloc.cpp.

const TCHAR* szMsiEdit = TEXT("Edit")

Definition at line 100 of file msiloc.cpp.

const TCHAR* szMsiGroupBox = TEXT("GroupBox")

Definition at line 97 of file msiloc.cpp.

const TCHAR* szMsiIcon = TEXT("Icon")

Definition at line 112 of file msiloc.cpp.

const TCHAR* szMsiLine = TEXT("Line")

Definition at line 113 of file msiloc.cpp.

const TCHAR* szMsiList = TEXT("ListView")

Definition at line 104 of file msiloc.cpp.

const TCHAR* szMsiListBox = TEXT("ListBox")

Definition at line 99 of file msiloc.cpp.

const TCHAR* szMsiMaskedEdit = TEXT("MaskedEdit")

Definition at line 95 of file msiloc.cpp.

const TCHAR* szMsiPathEdit = TEXT("PathEdit")

Definition at line 101 of file msiloc.cpp.

const TCHAR* szMsiProgressBar = TEXT("ProgressBar")

Definition at line 102 of file msiloc.cpp.

const TCHAR* szMsiPushbutton = TEXT("PushButton")

Definition at line 91 of file msiloc.cpp.

const TCHAR* szMsiRadioButton = TEXT("RadioButton")

Definition at line 109 of file msiloc.cpp.

const TCHAR* szMsiRadioButtonGroup = TEXT("RadioButtonGroup")

Definition at line 108 of file msiloc.cpp.

const TCHAR* szMsiScrollableText = TEXT("ScrollableText")

Definition at line 94 of file msiloc.cpp.

const TCHAR* szMsiSelTree = TEXT("SelectionTree")

Definition at line 111 of file msiloc.cpp.

const TCHAR* szMsiText = TEXT("Text")

Definition at line 98 of file msiloc.cpp.

const TCHAR* szMsiVolSelCombo = TEXT("VolumeSelectCombo")

Definition at line 107 of file msiloc.cpp.

const TCHAR* szMsiVolumeCostList = TEXT("VolumeCostList")

Definition at line 93 of file msiloc.cpp.

const TCHAR szQuotes[] = TEXT("\"")

Definition at line 68 of file msiloc.cpp.

const TCHAR szTab[] = TEXT("\t")

Definition at line 65 of file msiloc.cpp.

const TCHAR szTokenSeps[] = TEXT(":")

Definition at line 196 of file msiloc.cpp.

const TCHAR szWndwHdrFile[] = TEXT("#include <windows.h>")

Definition at line 60 of file msiloc.cpp.

const TCHAR tokCaption[] = TEXT("CAPTION")

Definition at line 80 of file msiloc.cpp.

Generated on Wed Nov 13 2024 16:54:44 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/Msi/msistuff/msistuff.cpp File Reference

  • SysMgmt
  • Msi
  • msistuff
Functions | Variables

msistuff.cpp File Reference

#include <windows.h>
#include <tchar.h>
#include <stdio.h>
#include <stdlib.h>
#include "..\setup.exe\common.h"
#include "strsafe.h"

Go to the source code of this file.

Functions

int __cdecl | _tmain (int argc, TCHAR *argv[])
void | DisplayHelp ()
bool | DisplayInstallResource (HMODULE hExeModule, LPCTSTR lpszType, LPCTSTR lpszName)
bool | DisplayResources (LPCTSTR lpExecutable)
BOOL CALLBACK | EnumResNamesProc (HMODULE hExeModule, LPCTSTR lpszType, LPTSTR lpszName, LONG_PTR lParam)
bool | ParseCommandLine (LPTSTR lpCommandLine)
bool | RemoveQuotes (LPCTSTR lpOriginal, LPTSTR lpStripped, DWORD cchStripped)
bool | SkipValue (TCHAR *&rpch)
TCHAR | SkipWhiteSpace (TCHAR *&rpch)

Variables

const TCHAR | chMinMsiVer = TEXT('v')
const TCHAR | chOperation = TEXT('o')
const TCHAR | chProperties = TEXT('p')
const int | cStandardProperties = sizeof(rgszResName)/sizeof(TCHAR*)
int | g_cResources = 0
const int | iMinMsiAllowedVer = 150
const DWORD | lcidLOCALE_INVARIANT = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT)
TCHAR | rgchResSwitch [] = {TEXT('u'),TEXT('d'),TEXT('n'),TEXT('v'),TEXT('i'),TEXT('w'),TEXT('p'),TEXT('m'),TEXT('o')}
TCHAR | rgszCommandOptions [] = TEXT("udnviwpmo")
TCHAR * | rgszResName []
const TCHAR | szInstall [] = TEXT("INSTALL")
const TCHAR | szInstallUpd [] = TEXT("INSTALLUPD")
const TCHAR | szMajPatch [] = TEXT("MAJPATCH")
const TCHAR | szMinPatch [] = TEXT("MINPATCH")

Function Documentation

int __cdecl _tmain | ( | int | argc,
 |  | TCHAR * | argv[]
 | ) |  |

Definition at line 77 of file msistuff.cpp.

{
        if (argc <= 2)
        {
                if (1 == argc
                    || 0 == lstrcmp(argv[1], TEXT("/?"))
                    || 0 == lstrcmp(argv[1], TEXT("-?")))
                {
                        //
                        // display help

                        DisplayHelp();
                }
                else
                {
                        //
                        // display setup resources

                        TCHAR szExecutable[MAX_PATH] = {0};
                        if (FAILED(StringCchCopy(szExecutable, sizeof(szExecutable)/sizeof(szExecutable[0]), argv[1])))
                            return -1;
                        if (!DisplayResources(szExecutable))
                                return -1;
                }

        }
        else
        {
                //
                // set resource properties

                TCHAR *szCommandLine = GetCommandLine();
                if (!ParseCommandLine(szCommandLine))
                        return -1;
        }

        return 0;
}

void DisplayHelp ( )

Definition at line 121 of file msistuff.cpp.

{
        TCHAR szHelp[] =
                                        TEXT("Copyright (c) Microsoft Corporation. All rights reserved.\n")
                                        TEXT("\n")
                                        TEXT("MsiStuff will display or update the resources \n")
                                        TEXT(" in the setup.exe boot strap executable\n")
                                        TEXT("\n")
                                        TEXT("[MsiStuff Command Line Syntax]\n")
                                        TEXT(" Display Properties->> msistuff setup.exe \n")
                                        TEXT(" Set Properties    ->> msistuff setup.exe option {data} ... \n")
                                        TEXT("\n")
                                        TEXT("[MsiStuff Options -- Multiple specifications are allowed]\n")
                                        TEXT(" BaseURL                             - /u {value} \n")
                                        TEXT(" Msi                                 - /d {value} \n")
                                        TEXT(" Product Name                        - /n {value} \n")
                                        TEXT(" Minimum Msi Version                 - /v {value} \n")
                                        TEXT(" Update URL Location                 - /i {value} \n")
                                        TEXT(" Windows Installer Update            - /w {value} \n")
                                        TEXT(" Patch                               - /m {value} \n")
                                        TEXT(" Operation                           - /o {value} \n")
                                        TEXT(" Properties (PROPERTY=VALUE strings) - /p {value} \n")
                                        TEXT("\n")
                                        TEXT("If an option is specified multiple times, the last one wins\n")
                                        TEXT("\n")
                                        TEXT("/p must be last on the command line.  The remainder of\n")
                                        TEXT("the command line is considered a part of the {value}\n")
                                        TEXT("This also means that /p cannot be specified multiple times\n");
        _tprintf(TEXT("%s"), szHelp);
}

bool DisplayInstallResource | ( | HMODULE | hExeModule,
 |  | LPCTSTR | lpszType,
 |  | LPCTSTR | lpszName
 | ) |  |

Definition at line 477 of file msistuff.cpp.

{
        HRSRC   hRsrc   = 0;
        HGLOBAL hGlobal = 0;
        WCHAR   *pch    = 0;

        if ((hRsrc = FindResource(hExeModule, lpszName, lpszType)) != 0
                && (hGlobal = LoadResource(hExeModule, hRsrc)) != 0
                && (pch = (WCHAR*)LockResource(hGlobal)) != 0)
        {
                // resource exists
                g_cResources++;

                if (!pch)
                        _tprintf(TEXT("%s = NULL\n"), lpszName);
                else
                {
                #ifdef UNICODE
                        _tprintf(TEXT("%s = %s\n"), lpszName, pch);
                #else // !UNICODE
                        unsigned int cch = WideCharToMultiByte(CP_ACP, 0, pch, -1, NULL, 0, NULL, NULL);
                        char *szValue = new char[cch];
                        if (!szValue)
                        {
                                _tprintf(TEXT("Error -- out of memory\n"));
                                return false;
                        }
                        ZeroMemory(szValue, cch * sizeof(char));

                        if (0 == WideCharToMultiByte(CP_ACP, 0, pch, -1, szValue, cch, NULL, NULL))
                        {
                            // error -- could not convert
                            _tprintf(TEXT("Unable to convert value.  LastError = %d\n"), GetLastError());
                            delete [] szValue;
                            return false;
                        }

                        _tprintf(TEXT("%s = %s\n"), lpszName, szValue);
                        delete [] szValue;
                #endif // UNICODE
                }
        }

        return true;
}

bool DisplayResources ( LPCTSTR lpExecutable )

Definition at line 540 of file msistuff.cpp.

{
        // handle possibility of a relative path
        TCHAR szFullPath[2*MAX_PATH] = {0};
        LPTSTR lpszFilePart = 0;
        int cchFullPath = 0;
        if (0 == (cchFullPath = GetFullPathName(szExecutable, sizeof(szFullPath)/sizeof(TCHAR), szFullPath, &lpszFilePart)))
        {
                // error
                _tprintf(TEXT("Unable to obtain full file path for %s.  LastError = %d\n"), szExecutable, GetLastError());
                return false;
        }
        else if (cchFullPath > sizeof(szFullPath)/sizeof(TCHAR))
        {
            // szFullPath buffer is too small; we could resize, but we'll simply fail here
            _tprintf(TEXT("szFullPath buffer is insufficiently sized for obtaining the full path for %s\n"), szExecutable);
            return false;
        }

        _tprintf(TEXT("\n<%s>\n\n"), szFullPath);

        HMODULE hExeModule = LoadLibraryEx(szFullPath, NULL, LOAD_LIBRARY_AS_DATAFILE);
        if (NULL == hExeModule)
        {
                // error
                _tprintf(TEXT("Unable to load %s.  LastError = %d\n"), szFullPath, GetLastError());
                return false;
        }

        // only enumerate on RT_INSTALL_PROPERTY type
        if (!EnumResourceNames(hExeModule, RT_INSTALL_PROPERTY, EnumResNamesProc, (LPARAM)0))
        {
                DWORD dwLastErr = GetLastError();
                if (ERROR_RESOURCE_TYPE_NOT_FOUND == dwLastErr)
                        _tprintf(TEXT("No RT_INSTALL_PROPERTY resources were found.\n"));
                else if (ERROR_RESOURCE_DATA_NOT_FOUND == dwLastErr)
                        _tprintf(TEXT("This file does not have a resource section.\n"));
                else
                {
                        // error
                        _tprintf(TEXT("Failed to enumerate all resources in %s.  LastError = %d\n"), szFullPath, GetLastError());
                        FreeLibrary(hExeModule);
                        return false;
                }
        }

        if (g_cResources)
        {
                if (1 == g_cResources)
                        _tprintf(TEXT("\n\n 1 RT_INSTALL_PROPERTY resource was found.\n"));
                else
                        _tprintf(TEXT("\n\n %d RT_INSTALL_PROPERTY resources were found.\n"), g_cResources);
        }

        if (!FreeLibrary(hExeModule))
        {
                // error
                _tprintf(TEXT("Failed to unload %s.  LastError = %d\n"), szFullPath, GetLastError());
                return false;
        }

        return true;
}

BOOL CALLBACK EnumResNamesProc | ( | HMODULE | hExeModule,
 |  | LPCTSTR | lpszType,
 |  | LPTSTR | lpszName,
 |  | LONG_PTR | lParam
 | ) |  |

Definition at line 528 of file msistuff.cpp.

{
        if (!DisplayInstallResource(hExeModule, lpszType, lpszName))
                return FALSE;
        return TRUE;
}

bool ParseCommandLine ( LPTSTR lpCommandLine )

Definition at line 159 of file msistuff.cpp.

{
        if (!lpCommandLine)
            return false;

        TCHAR szSetupEXE[MAX_PATH] = {0};
        TCHAR szFullPath[2*MAX_PATH] = {0};

        TCHAR  chNextCommand;
        TCHAR *pchCommandLine = lpCommandLine;

        // skip over module name and subsequent white space
        if (!SkipValue(pchCommandLine))
            return false;
        chNextCommand = SkipWhiteSpace(pchCommandLine);

        TCHAR* pchCommandData = pchCommandLine;
        if (!SkipValue(pchCommandLine))
            return false;
        if (!RemoveQuotes(pchCommandData, szSetupEXE, sizeof(szSetupEXE)/sizeof(szSetupEXE[0])))
            return false;

        // handle possibility of a relative path
        LPTSTR lpszFilePart = 0;
        int cchFullPath = 0;
        if (0 == (cchFullPath = GetFullPathName(szSetupEXE, sizeof(szFullPath)/sizeof(TCHAR), szFullPath, &lpszFilePart)))
        {
                // error
                _tprintf(TEXT("Unable to obtain fullpath for %s\n"), szSetupEXE);
                return false;
        }
        else if (cchFullPath > sizeof(szFullPath)/sizeof(TCHAR))
        {
            // szFullPath buffer is too small; we could resize, but we'll simply fail here
            _tprintf(TEXT("szFullPath buffer is insufficiently sized for obtaining the full path for %s\n"), szSetupEXE);
            return false;
        }

        _tprintf(TEXT("\nModifying setup properties in:\n\t<%s>\n\n"), szFullPath);

        // make sure the EXE is not already loaded,in use, or read-only
        HANDLE hInUse = CreateFile(szFullPath, GENERIC_WRITE, (DWORD)0, (LPSECURITY_ATTRIBUTES)0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, (HANDLE)0);
        if (INVALID_HANDLE_VALUE == hInUse)
        {
                // error
                _tprintf(TEXT("Unable to obtain file handle for %s.  The file probably does not exist, is marked read-only, or is in use.  LastError = %d\n"), szFullPath, GetLastError());
                return false;
        }
        CloseHandle(hInUse);

        // begin update resource
        HANDLE hUpdate = BeginUpdateResource(szFullPath, /* bDeleteExistingResources = */ FALSE);
        if ( !hUpdate )
        {
                // error
                _tprintf(TEXT("Unable to update resources in %s.  LastError = %d\n"), szFullPath, GetLastError());
                return false;
        }

        while ((chNextCommand = SkipWhiteSpace(pchCommandLine)) != 0)
        {
                if (chNextCommand == TEXT('/') || chNextCommand == TEXT('-'))
                {
                        TCHAR *szOption = pchCommandLine++;  // save for error msg
                        TCHAR  chOption = (TCHAR)(*pchCommandLine++ | 0x20); // lower case flag
                        chNextCommand = SkipWhiteSpace(pchCommandLine);
                        pchCommandData = pchCommandLine;

                        for (const TCHAR* pchOptions = rgszCommandOptions; *pchOptions; pchOptions++)
                        {
                                if (*pchOptions == chOption)
                                        break;
                        }

                        if (*pchOptions)
                        {
                                bool fSkipValue   = true; // whether or not to look for next option in command line; (true = look)
                                bool fDeleteValue = false;// whether to delete the value

                                // option is recognized
                                const TCHAR chIndex = (TCHAR)(pchOptions - rgszCommandOptions);
                                if (chIndex >= cStandardProperties)
                                {
                                        // error
                                        _tprintf(TEXT("Invalid index (chIndex = %d, chOption = %c)!!!\n"), chIndex, chOption);
                                        return false;
                                }

                                if (chOption == chProperties)
                                {
                                        fSkipValue = false;
                                        // special for /p -- remainder of command line is part of property
                                        TCHAR chNext = *pchCommandData;
                                        if (chNext == 0 || chNext == TEXT('/') || chNext == TEXT('-'))
                                        {
                                                // no value present
                                                fDeleteValue = true;
                                        }
                                        else
                                        {
                                                // set value to remainder of command line, i.e. all of pchCommandData
                                                // with enclosing quotes stripped -- we do this by telling the command
                                                // line processor to not attempt to look for other options on the
                                                // command line; the remainder is part of this property
                                                fSkipValue = false;
                                        }
                                }

                                if (fSkipValue)
                                        fDeleteValue = (SkipValue(pchCommandLine)) ? false : true;

                                if (fDeleteValue)
                                {
                                        // delete value and reset to ensure resource is properly removed
                                        if (!UpdateResource(hUpdate, RT_INSTALL_PROPERTY, rgszResName[chIndex], MAKELANGID(LANG_NEUTRAL,SUBLANG_NEUTRAL), NULL, 0)
                                                || !EndUpdateResource(hUpdate, /* fDiscard = */ FALSE)
                                                || (!(hUpdate = BeginUpdateResource(szFullPath, /* bDeleteExistingResources = */ FALSE))))
                                        {
                                                // error
                                                _tprintf(TEXT("Unable to delete resource %s in %s.  LastError = %d\n"), rgszResName[chIndex], szFullPath, GetLastError());
                                                return false;
                                        }
                                        _tprintf(TEXT("Removing '%s' . . .\n"), rgszResName[chIndex]);
                                }
                                else
                                {
                                        TCHAR szValueBuf[1024] = {0};
                                        if (!RemoveQuotes(pchCommandData, szValueBuf, sizeof(szValueBuf)/sizeof(szValueBuf[0])))
                                            return false;

                                        if (chOption == chMinMsiVer && (_ttoi(szValueBuf) < iMinMsiAllowedVer))
                                        {
                                                // extra validation: must be >= iMinAllowedVer
                                                _tprintf(TEXT("Skipping option %c with data %s. Data value must be >= %d. . .\n"), chOption, szValueBuf, iMinMsiAllowedVer);
                                                continue;
                                        }

                                        if (chOption == chOperation
                                            && CSTR_EQUAL != CompareString(lcidLOCALE_INVARIANT, NORM_IGNORECASE, szValueBuf, -1, szInstall, -1)
                                            && CSTR_EQUAL != CompareString(lcidLOCALE_INVARIANT, NORM_IGNORECASE, szValueBuf, -1, szInstallUpd, -1)
                                            && CSTR_EQUAL != CompareString(lcidLOCALE_INVARIANT, NORM_IGNORECASE, szValueBuf, -1, szMinPatch, -1)
                                            && CSTR_EQUAL != CompareString(lcidLOCALE_INVARIANT, NORM_IGNORECASE, szValueBuf, -1, szMajPatch, -1))
                                        {
                                            // extra validation: must be one of those values
                                            _tprintf(TEXT("Skipping option %c with data %s. Data value must be INSTALL, INSTALLUPD, MINPATCH, or MAJPATCH...\n"), chOption, szValueBuf);
                                            continue;
                                        }

                                        // update value -- this is our own custom resource, so to make it easier on ourselves, we will pack in the NULL as well
                                #ifdef UNICODE
                                        if (!UpdateResource(hUpdate, RT_INSTALL_PROPERTY, rgszResName[chIndex], MAKELANGID(LANG_NEUTRAL,SUBLANG_NEUTRAL), szValueBuf, (lstrlen(szValueBuf) + 1)*sizeof(TCHAR)))
                                        {
                                                // error
                                                _tprintf(TEXT("Unable to update resource %s in %s with value %s.  LastError = %d\n"), rgszResName[chIndex], szFullPath, szValueBuf, GetLastError());
                                                return false;
                                        }
                                #else // !UNICODE
                                        // must convert value to Unicode
                                        int cchWide = MultiByteToWideChar(CP_ACP, 0, szValueBuf, -1, NULL, 0);
                                        WCHAR* wszValueBuf = new WCHAR[cchWide];
                                        if (!wszValueBuf)
                                            return false; // out of memory
                                        ZeroMemory(wszValueBuf, cchWide*sizeof(WCHAR));
                                        if (0 == MultiByteToWideChar(CP_ACP, 0, szValueBuf, -1, wszValueBuf, cchWide))
                                        {
                                            // error
                                            _tprintf(TEXT("Unable to convert value to Unicode. LastError = %d\n"), GetLastError());
                                            delete [] wszValueBuf;
                                            return false;
                                        }
                                        if (!UpdateResource(hUpdate, RT_INSTALL_PROPERTY, rgszResName[chIndex], MAKELANGID(LANG_NEUTRAL,SUBLANG_NEUTRAL), wszValueBuf, (lstrlenW(wszValueBuf) +1)*sizeof(WCHAR)))
                                        {
                                                // error
                                                _tprintf(TEXT("Unable to update resource %s in %s with value %s.  LastError = %d\n"), rgszResName[chIndex], szFullPath, szValueBuf, GetLastError());
                                                delete [] wszValueBuf;
                                                return false;
                                        }
                                        delete [] wszValueBuf;
                                #endif // UNICODE
                                        _tprintf(TEXT("Setting '%s' to '%s' . . .\n"), rgszResName[chIndex], szValueBuf);
                                        if (!fSkipValue)
                                                break; // done processing
                                }
                        }
                        else
                        {
                                // invalid option
                                _tprintf(TEXT("Skipping invalid option %c . . .\n"), chOption);
                                SkipValue(pchCommandLine);
                                continue;
                        }
                }
                else
                {
                        // error
                        _tprintf(TEXT("Switch is missing\n"));
                        return false;
                }
        }

        // persist changes
        if (!EndUpdateResource(hUpdate, /* fDiscard = */ FALSE))
        {
                // error
                _tprintf(TEXT("Unable to update resources in %s.  LastError = %d\n"), szFullPath, GetLastError());
                return false;
        }

        return true;
}

bool RemoveQuotes | ( | LPCTSTR | lpOriginal,
 |  | LPTSTR | lpStripped,
 |  | DWORD | cchStripped
 | ) |  |

Definition at line 432 of file msistuff.cpp.

{
        if (!lpOriginal)
            return false;

        bool fEnclosedInQuotes = false;

        const TCHAR *pchOrig = lpOriginal;

        // check for "
        if (*pchOrig == TEXT('"'))
        {
                fEnclosedInQuotes = true;
                pchOrig++;
        }

        if (FAILED(StringCchCopy(lpStripped, cchStripped, pchOrig)))
            return false;

        if (!fEnclosedInQuotes)
                return true;

        TCHAR *pch = lpStripped + lstrlen(lpStripped) + 1; // start at NULL

        pch = CharPrev(lpStripped, pch);

        // look for trailing "
        while (pch != lpStripped)
        {
                if (*pch == TEXT('"'))
                {
                        *pch = 0;
                        break; // only care about trailing ", and not quotes in middle
                }
                pch = CharPrev(lpStripped, pch);
        }

        return true;
}

bool SkipValue ( TCHAR *& rpch )

Definition at line 396 of file msistuff.cpp.

{
        if (!rpch)
            return false;

        TCHAR ch = *rpch;
        if (ch == 0 || ch == TEXT('/') || ch == TEXT('-'))
                return false;   // no value present
        for (int i = 0; (ch = *rpch) != TEXT(' ') && ch != TEXT('\t') && ch != 0; rpch = CharNext(rpch), i++)
        {
                if (0 == i && *rpch == TEXT('"'))
                {
                        rpch++; // for '"'
                        for (; (ch = *rpch) != TEXT('"') && ch != 0; rpch++)
                                ;
                        ch = *(++rpch);
                        break;
                }
        }
        if (ch != 0)
        {
                TCHAR* pch = rpch;
                rpch = CharNext(rpch);
                *pch = 0;
        }
        return true;
}

TCHAR SkipWhiteSpace ( TCHAR *& rpch )

Definition at line 377 of file msistuff.cpp.

{
        TCHAR ch = 0;
        if (rpch)
        {
            for (; (ch = *rpch) == TEXT(' ') || ch == TEXT('\t'); rpch++)
                    ;
        }
        return ch;
}

Variable Documentation

const TCHAR chMinMsiVer = TEXT('v')

Definition at line 44 of file msistuff.cpp.

const TCHAR chOperation = TEXT('o')

Definition at line 45 of file msistuff.cpp.

const TCHAR chProperties = TEXT('p')

Definition at line 43 of file msistuff.cpp.

const int cStandardProperties = sizeof(rgszResName)/sizeof(TCHAR*)

Definition at line 34 of file msistuff.cpp.

int g_cResources = 0

Definition at line 70 of file msistuff.cpp.

const int iMinMsiAllowedVer = 150

Definition at line 50 of file msistuff.cpp.

const DWORD lcidLOCALE_INVARIANT = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT)

Definition at line 38 of file msistuff.cpp.

TCHAR rgchResSwitch[] = {TEXT('u'),TEXT('d'),TEXT('n'),TEXT('v'),TEXT('i'),TEXT('w'),TEXT('p'),TEXT('m'),TEXT('o')}

Definition at line 36 of file msistuff.cpp.

TCHAR rgszCommandOptions[] = TEXT("udnviwpmo")

Definition at line 20 of file msistuff.cpp.

TCHAR* rgszResName[]
Initial value:
 {
 ISETUPPROPNAME_BASEURL,
 ISETUPPROPNAME_DATABASE,
 ISETUPPROPNAME_PRODUCTNAME,
 ISETUPPROPNAME_MINIMUM_MSI,
 ISETUPPROPNAME_UPDATELOCATION,
 ISETUPPROPNAME_UPDATE,
 ISETUPPROPNAME_PROPERTIES,
 ISETUPPROPNAME_PATCH,
 ISETUPPROPNAME_OPERATION
}

Definition at line 23 of file msistuff.cpp.

const TCHAR szInstall[] = TEXT("INSTALL")

Definition at line 46 of file msistuff.cpp.

const TCHAR szInstallUpd[] = TEXT("INSTALLUPD")

Definition at line 47 of file msistuff.cpp.

const TCHAR szMajPatch[] = TEXT("MAJPATCH")

Definition at line 49 of file msistuff.cpp.

const TCHAR szMinPatch[] = TEXT("MINPATCH")

Definition at line 48 of file msistuff.cpp.

Generated on Wed Nov 13 2024 16:54:44 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/Msi/process.dll/Process.cpp File Reference

  • SysMgmt
  • Msi
  • process.dll
Defines | Functions

Process.cpp File Reference

#include <windows.h>
#include "msiquery.h"
#include <basetsd.h>
#include <lm.h>
#include "strsafe.h"

Go to the source code of this file.

Defines

#define | UNICODE 1
#define | WINDOWS_LEAN_AND_MEAN

Functions

void | ClearSecret (WCHAR *wszSecret, DWORD cbSecret)
UINT __stdcall | ProcessUserAccounts (MSIHANDLE hInstall)
UINT __stdcall | UninstallUserAccounts (MSIHANDLE hInstall)

Define Documentation

#define UNICODE 1

Definition at line 23 of file Process.cpp.

#define WINDOWS_LEAN_AND_MEAN

Definition at line 13 of file Process.cpp.

Function Documentation

void ClearSecret | ( | WCHAR * | wszSecret,
 |  | DWORD | cbSecret
 | ) |  |

Definition at line 65 of file Process.cpp.

{
  if (!wszSecret)
    return; // nothing to do

  volatile char* vpch = (volatile char*)wszSecret;
  while (cbSecret)
  {
    *vpch = 0;
    vpch++;
    cbSecret--;
  }
}

UINT __stdcall ProcessUserAccounts ( MSIHANDLE hInstall )

Definition at line 86 of file Process.cpp.

{
  PMSIHANDLE hDatabase = MsiGetActiveDatabase(hInstall);
  if ( !hDatabase )
    return ERROR_INSTALL_FAILURE;

  PMSIHANDLE hView = 0;

  //
  // constants -- custom action names, SQL query, separator
  //
  // wszCreateCA = name of deferred CA to create account
  // wszRollbackCA = name of rollback CA to rollback account creation
  //
  const WCHAR wszCreateCA[] = L"CreateAccount";
  const WCHAR wszRollbackCA[] = L"RollbackAccount";
  const WCHAR wszSQL[] = L"SELECT `UserName`, `Password`, `Attributes` FROM `CustomUserAccounts`";
  const WCHAR wchSep = '\001';

  UINT uiStat = ERROR_SUCCESS;
  if (ERROR_SUCCESS != (uiStat = MsiDatabaseOpenViewW(hDatabase, wszSQL, &hView)))
  {
    if (ERROR_BAD_QUERY_SYNTAX == uiStat
      && MSICONDITION_NONE == MsiDatabaseIsTablePersistentW(hDatabase, L"CustomUserAccounts"))
      return ERROR_SUCCESS; // table not present
    else
      return ERROR_INSTALL_FAILURE; // error -- should never happen
  }
  if (ERROR_SUCCESS != (uiStat = MsiViewExecute(hView, 0)))
    return ERROR_INSTALL_FAILURE; // error -- should never happen

  // Fetch all entries from the CustomUserAccounts table
  PMSIHANDLE hRecFetch = 0;
  while (ERROR_SUCCESS == (uiStat = MsiViewFetch(hView, &hRecFetch)))
  {
    // Obtain user name
    WCHAR* wszUser = 0;
    DWORD cchUser = 0;
    if (ERROR_MORE_DATA != MsiRecordGetStringW(hRecFetch, 1, L"", &cchUser))
      return ERROR_INSTALL_FAILURE;

    wszUser = new WCHAR[++cchUser];
    if ( !wszUser )
      return ERROR_INSTALL_FAILURE; // out of memory

    if (ERROR_SUCCESS != MsiRecordGetStringW(hRecFetch, 1, wszUser, &cchUser))
    {
      delete [] wszUser;
      return ERROR_INSTALL_FAILURE; // error -- should never happen
    }

    // Obtain name of property containing password
    WCHAR* wszPassWdProp = 0;
    DWORD cchPassWdProp = 0;
    if (ERROR_MORE_DATA != MsiRecordGetStringW(hRecFetch, 2, L"", &cchPassWdProp))
    {
      delete [] wszUser;
      return ERROR_INSTALL_FAILURE;
    }

    wszPassWdProp = new WCHAR[++cchPassWdProp];
    if ( !wszPassWdProp )
    {
      delete [] wszUser;
      return ERROR_INSTALL_FAILURE; // out of memory
    }

    if (ERROR_SUCCESS != MsiRecordGetStringW(hRecFetch, 2, wszPassWdProp, &cchPassWdProp))
    {
      delete [] wszUser;
      delete [] wszPassWdProp;
      return ERROR_INSTALL_FAILURE; // error -- should never happen
    }

    // Obtain property value containing password
    WCHAR* wszAccountPassWd = 0;
    DWORD cchAccountPassWd = 0;
    if (ERROR_MORE_DATA != MsiGetProperty(hInstall, wszPassWdProp, L"", &cchAccountPassWd))
    {
      delete [] wszUser;
      delete [] wszPassWdProp;
      return ERROR_INSTALL_FAILURE;
    }

    wszAccountPassWd = new WCHAR[++cchAccountPassWd];
    if ( !wszAccountPassWd )
    {
      delete [] wszUser;
      delete [] wszPassWdProp;
      return ERROR_INSTALL_FAILURE;
    }

    ZeroMemory(wszAccountPassWd, cchAccountPassWd*sizeof(WCHAR));

    if (ERROR_SUCCESS != MsiGetProperty(hInstall, wszPassWdProp, wszAccountPassWd, &cchAccountPassWd)
      || *wszAccountPassWd == 0) // do not allow blank password
    {
      delete [] wszUser;
      delete [] wszPassWdProp;
      delete [] wszAccountPassWd;
      return ERROR_INSTALL_FAILURE;
    }

    // Obtain attributes of user account
    WCHAR* wszAttrib  = 0;
    DWORD cchAttrib = 0;
    if (ERROR_MORE_DATA != MsiRecordGetStringW(hRecFetch, 3, L"", &cchAttrib))
    {
      delete [] wszUser;
      delete [] wszPassWdProp;
      ClearSecret(wszAccountPassWd, cchAccountPassWd*sizeof(WCHAR));
      delete [] wszAccountPassWd;
      return ERROR_INSTALL_FAILURE;
    }

    wszAttrib = new WCHAR[++cchAttrib];
    if ( !wszAttrib )
    {
      delete [] wszUser;
      delete [] wszPassWdProp;
      ClearSecret(wszAccountPassWd, cchAccountPassWd*sizeof(WCHAR));
      delete [] wszAccountPassWd;
      return ERROR_INSTALL_FAILURE; // out of memory
    }

    if (ERROR_SUCCESS != MsiRecordGetStringW(hRecFetch, 3, wszAttrib, &cchAttrib))
    {
      delete [] wszUser;
      delete [] wszPassWdProp;
      ClearSecret(wszAccountPassWd, cchAccountPassWd*sizeof(WCHAR));
      delete [] wszAccountPassWd;
      delete [] wszAttrib;
      return ERROR_INSTALL_FAILURE; // error -- should never happen
    }

    // Generate the customized property that the deferred action will read
    DWORD cchBuf = cchUser + cchAccountPassWd + cchAttrib + 4;
    WCHAR* wszBuf = new WCHAR[cchBuf];
    if ( !wszBuf )
    {
      delete [] wszUser;
      delete [] wszPassWdProp;
      ClearSecret(wszAccountPassWd, cchAccountPassWd*sizeof(WCHAR));
      delete [] wszAccountPassWd;
      delete [] wszAttrib;
      return ERROR_INSTALL_FAILURE; // out of memory
    }

    wszBuf[0] = 0;

    if (FAILED(StringCchPrintfW(wszBuf, cchBuf, L"%s%c%s%c%s", wszUser, wchSep, wszAccountPassWd, wchSep, wszAttrib)))
    {
      delete [] wszUser;
      delete [] wszPassWdProp;
      ClearSecret(wszAccountPassWd, cchAccountPassWd*sizeof(WCHAR));
      delete [] wszAccountPassWd;
      delete [] wszAttrib;
      delete [] wszBuf;
      return ERROR_INSTALL_FAILURE;
    }

    // clear wszAccountPassWd
    ClearSecret(wszAccountPassWd, cchAccountPassWd*sizeof(WCHAR));

    // Add action data (template is in ActionText table), but do not display temp passwd
    PMSIHANDLE hRecInfo = MsiCreateRecord(2);
    if ( !hRecInfo
            || ERROR_SUCCESS != MsiRecordSetStringW(hRecInfo, 1, wszUser)
      || ERROR_SUCCESS != MsiRecordSetStringW(hRecInfo, 2, wszAttrib))
    {
      delete [] wszUser;
      delete [] wszPassWdProp;
      delete [] wszAccountPassWd;
      delete [] wszAttrib;
      ClearSecret(wszBuf, cchBuf*sizeof(WCHAR));
      delete [] wszBuf;
      return ERROR_INSTALL_FAILURE;
    }

    int iRet = MsiProcessMessage(hInstall, INSTALLMESSAGE_ACTIONDATA, hRecInfo);
    if (IDCANCEL == iRet || IDABORT == iRet)
    {
      delete [] wszUser;
      delete [] wszPassWdProp;
      delete [] wszAccountPassWd;
      delete [] wszAttrib;
      ClearSecret(wszBuf, cchBuf*sizeof(WCHAR));
      delete [] wszBuf;
      return ERROR_INSTALL_USEREXIT;
    }

    // Rollback custom action goes first
    // Create a rollback custom action (in case install is stopped and rolls back)
    // Rollback custom action can't read tables, so we have to set a property
    if (ERROR_SUCCESS != MsiSetPropertyW(hInstall, wszRollbackCA, wszUser)
      || ERROR_SUCCESS != MsiDoActionW(hInstall, wszRollbackCA)
      || ERROR_SUCCESS != MsiSetPropertyW(hInstall, wszRollbackCA, L""))
    {
      delete [] wszUser;
      delete [] wszPassWdProp;
      delete [] wszAccountPassWd;
      delete [] wszAttrib;
      ClearSecret(wszBuf, cchBuf*sizeof(WCHAR));
      delete [] wszBuf;
      return ERROR_INSTALL_FAILURE;
    }

    // Create a deferred custom action (gives us the right priviledges to create the user account)
    // Deferred custom actions can't read tables, so we have to set a property
    if (ERROR_SUCCESS != MsiSetPropertyW(hInstall, wszCreateCA, wszBuf)
      || ERROR_SUCCESS != MsiDoActionW(hInstall, wszCreateCA)
      || ERROR_SUCCESS != MsiSetPropertyW(hInstall, wszCreateCA, L""))
    {
      delete [] wszUser;
      delete [] wszPassWdProp;
      delete [] wszAccountPassWd;
      delete [] wszAttrib;
      ClearSecret(wszBuf, cchBuf*sizeof(WCHAR));
      delete [] wszBuf;
      return ERROR_INSTALL_FAILURE;
    }

    ClearSecret(wszBuf, cchBuf*sizeof(WCHAR));
    delete [] wszBuf;
    delete [] wszUser;
    delete [] wszPassWdProp;
    delete [] wszAccountPassWd;
    delete [] wszAttrib;
  }
  return (ERROR_NO_MORE_ITEMS != uiStat) ? ERROR_INSTALL_FAILURE : ERROR_SUCCESS;
}

UINT __stdcall UninstallUserAccounts ( MSIHANDLE hInstall )

Definition at line 326 of file Process.cpp.

{
  //
  // constants -- custom action name SQL query
  //
  // wszRemoveCA = name of deferred CA to remove user account
  //
  const WCHAR wszRemoveCA[] = L"RemoveAccount";
  const WCHAR wszSQL[] = L"SELECT `UserName` FROM `CustomUserAccounts`";

  PMSIHANDLE hDatabase = MsiGetActiveDatabase(hInstall);
  if ( !hDatabase )
    return ERROR_INSTALL_FAILURE;

  PMSIHANDLE hView = 0;

  UINT uiStat = ERROR_SUCCESS;
  if (ERROR_SUCCESS != (uiStat = MsiDatabaseOpenViewW(hDatabase, wszSQL, &hView)))
  {
    if (ERROR_BAD_QUERY_SYNTAX == uiStat
      && MSICONDITION_NONE == MsiDatabaseIsTablePersistentW(hDatabase, L"CustomUserAccounts"))
      return ERROR_SUCCESS; // table not present
    else
      return ERROR_INSTALL_FAILURE;
  }

  if (ERROR_SUCCESS != MsiViewExecute(hView, 0))
    return ERROR_INSTALL_FAILURE; // error -- should never happen

  // Fetch all entries from the UserAccounts custom table
  PMSIHANDLE hRecFetch = 0;
  while (ERROR_SUCCESS == (uiStat = MsiViewFetch(hView, &hRecFetch)))
  {
    // Obtain user name
    DWORD cchUser = 0;
    if (ERROR_MORE_DATA == MsiRecordGetStringW(hRecFetch, 1, L"", &cchUser))
    {
      WCHAR* wszUser = new WCHAR[++cchUser]; // add 1 for null-terminator which is not included in return count
      if (wszUser)
      {
        if (ERROR_SUCCESS == MsiRecordGetStringW(hRecFetch, 1, wszUser, &cchUser))
        {
          // Send ActionData message (template is in ActionText table)
          PMSIHANDLE hRecInfo = MsiCreateRecord(1);
          if ( !hRecInfo
            || ERROR_SUCCESS != MsiRecordSetStringW(hRecInfo, 1, wszUser))
          {
            delete [] wszUser;
            return ERROR_INSTALL_FAILURE;
          }

          int iRet = MsiProcessMessage(hInstall, INSTALLMESSAGE_ACTIONDATA, hRecInfo);
          if (IDCANCEL == iRet || IDABORT == iRet)
          {
            delete [] wszUser;
            return ERROR_INSTALL_USEREXIT;
          }

          // We can't do a rollback custom action here (well, we could, but it wouldn't be correct)
          // After a user account has been deleted, it cannot be recreated exactly as it was before
          // because it will have been assigned a new SID.  In the case of uninstall, we won't
          // rollback the deletion.

          // Create a deferred custom action (gives us the right priviledges to create the user account)
          // Deferred custom actions can't read tables, so we have to set a property
          if (ERROR_SUCCESS != MsiSetPropertyW(hInstall, wszRemoveCA, wszUser)
            || ERROR_SUCCESS != MsiDoActionW(hInstall, wszRemoveCA)
            || ERROR_SUCCESS != MsiSetPropertyW(hInstall, wszRemoveCA, L""))
          {
            delete [] wszUser;
            return ERROR_INSTALL_FAILURE;
          }
        }
        delete [] wszUser;
      }
      else
        return ERROR_INSTALL_FAILURE;
    }
    else
      return ERROR_INSTALL_FAILURE;
  }
  if (ERROR_NO_MORE_ITEMS != uiStat)
    return ERROR_INSTALL_FAILURE; // error -- should never happen

  return ERROR_SUCCESS;
}

Generated on Wed Nov 13 2024 16:54:44 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/Msi/remove.dll/Remove.cpp File Reference

  • SysMgmt
  • Msi
  • remove.dll
Defines | Functions

Remove.cpp File Reference

#include <windows.h>
#include "msiquery.h"
#include "msidefs.h"
#include <basetsd.h>
#include <lm.h>

Go to the source code of this file.

Defines

#define | UNICODE 1
#define | WINDOWS_LEAN_AND_MEAN

Functions

UINT __stdcall | RemoveUserAccount (MSIHANDLE hInstall)

Define Documentation

#define UNICODE 1

Definition at line 23 of file Remove.cpp.

#define WINDOWS_LEAN_AND_MEAN

Definition at line 13 of file Remove.cpp.

Function Documentation

UINT __stdcall RemoveUserAccount ( MSIHANDLE hInstall )

Definition at line 69 of file Remove.cpp.

{
  // determine mode in which we are called
  BOOL bRollback = MsiGetMode(hInstall, MSIRUNMODE_ROLLBACK); // true for rollback, else regular deferred version (for uninstall)

  BOOL fSuccess = FALSE;

  // id's for error and warning messages
  const int iRemoveError = 25003;
  const int iRemoveWarning = 25004;

  // Grab the CustomActionData property
  DWORD cchCAData = 0;

  if (ERROR_MORE_DATA == MsiGetPropertyW(hInstall, IPROPNAME_CUSTOMACTIONDATA, L"", &cchCAData))
  {
    WCHAR* wszCAData = new WCHAR[++cchCAData]; // add 1 for null-terminator which is not included in size on return
    if (wszCAData)
    {
      if (ERROR_SUCCESS == MsiGetPropertyW(hInstall, IPROPNAME_CUSTOMACTIONDATA, wszCAData, &cchCAData))
      {
        // send ActionData message (template in ActionText table)
        // send ActionData message (template in ActionText table)
        PMSIHANDLE hRec = MsiCreateRecord(1);
        if (!hRec
          || ERROR_SUCCESS != MsiRecordSetStringW(hRec, 1, wszCAData))
        {
          delete [] wszCAData;
          return ERROR_INSTALL_FAILURE;
        }

        int iRet = MsiProcessMessage(hInstall, INSTALLMESSAGE_ACTIONDATA, hRec);
        if (IDCANCEL == iRet || IDABORT == iRet)
        {
          delete [] wszCAData;
          return ERROR_INSTALL_USEREXIT;
        }

        //
        // Call the NetUserDel function,
        //
        NET_API_STATUS nStatus = NetUserDel(NULL /*local machine*/, wszCAData /*user name*/);

        if (NERR_Success != nStatus)
        {
          PMSIHANDLE hRecErr = MsiCreateRecord(3);
          if ( !hRecErr
            || ERROR_SUCCESS != MsiRecordSetStringW(hRecErr, 2, wszCAData))
          {
            delete [] wszCAData;
            return ERROR_INSTALL_FAILURE;
          }

          // In rollback mode, NERR_UserNotFound means cancel button depressed in middle of deferred CA trying to create this account
          if (bRollback && NERR_UserNotFound == nStatus)
          {
            fSuccess = TRUE;
          }
          else if (NERR_UserNotFound == nStatus)
          {
            // treat this as a warning, but success since we are attempting to delete and it is not present
            if (ERROR_SUCCESS != MsiRecordSetInteger(hRecErr, 1, iRemoveWarning))
            {
              delete [] wszCAData;
              return ERROR_INSTALL_FAILURE;
            }

            // just pop up an OK button
            // OPTIONALLY, could specify multiple buttons and cancel
            // install based on user selection by handling the return value
            // from MsiProcessMessage, but here we are ignoring the MsiProcessMessage return
            MsiProcessMessage(hInstall, INSTALLMESSAGE(INSTALLMESSAGE_WARNING|MB_ICONWARNING|MB_OK), hRecErr);
            fSuccess = TRUE;
          }
          else
          {
            if (ERROR_SUCCESS == MsiRecordSetInteger(hRecErr, 1, iRemoveError)
              && ERROR_SUCCESS == MsiRecordSetInteger(hRecErr, 3, nStatus))
            {
              // returning failure anyway, so ignoring MsiProcessMessage return
              MsiProcessMessage(hInstall, INSTALLMESSAGE_ERROR, hRecErr);
            }
          }
        }
        else // NERR_Success
        {
          fSuccess = TRUE;
        }
      }

      delete [] wszCAData;
    }
  }

  return fSuccess ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
}

Generated on Wed Nov 13 2024 16:54:44 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/Msi/setup.exe/common.h File Reference

  • SysMgmt
  • Msi
  • setup.exe
Defines | Functions

common.h File Reference

#include <windows.h>

Go to the source code of this file.

Defines

#define | ISETUPPROPNAME_BASEURL TEXT("BASEURL")
#define | ISETUPPROPNAME_DATABASE TEXT("DATABASE")
#define | ISETUPPROPNAME_MINIMUM_MSI TEXT("MINIMUM_MSI")
#define | ISETUPPROPNAME_OPERATION TEXT("OPERATION")
#define | ISETUPPROPNAME_PATCH TEXT("PATCH")
#define | ISETUPPROPNAME_PRODUCTNAME TEXT("PRODUCTNAME")
#define | ISETUPPROPNAME_PROPERTIES TEXT("PROPERTIES")
#define | ISETUPPROPNAME_UPDATE TEXT("UPDATE")
#define | ISETUPPROPNAME_UPDATELOCATION TEXT("UPDATELOCATION")
#define | RT_INSTALL_PROPERTY MAKEINTRESOURCE(40)

Functions

UINT | LoadResourceString (HINSTANCE hInst, LPCSTR lpType, LPCSTR lpName, LPSTR lpBuf, DWORD *pdwBufSize)
UINT | SetupLoadResourceString (HINSTANCE hInst, LPCSTR lpName, LPSTR *lppBuf, DWORD dwBufSize)

Define Documentation

#define ISETUPPROPNAME_BASEURL TEXT("BASEURL")

Definition at line 26 of file common.h.

#define ISETUPPROPNAME_DATABASE TEXT("DATABASE")

Definition at line 27 of file common.h.

#define ISETUPPROPNAME_MINIMUM_MSI TEXT("MINIMUM_MSI")

Definition at line 29 of file common.h.

#define ISETUPPROPNAME_OPERATION TEXT("OPERATION")

Definition at line 28 of file common.h.

#define ISETUPPROPNAME_PATCH TEXT("PATCH")

Definition at line 34 of file common.h.

#define ISETUPPROPNAME_PRODUCTNAME TEXT("PRODUCTNAME")

Definition at line 32 of file common.h.

#define ISETUPPROPNAME_PROPERTIES TEXT("PROPERTIES")

Definition at line 33 of file common.h.

#define ISETUPPROPNAME_UPDATE TEXT("UPDATE")

Definition at line 31 of file common.h.

#define ISETUPPROPNAME_UPDATELOCATION TEXT("UPDATELOCATION")

Definition at line 30 of file common.h.

#define RT_INSTALL_PROPERTY MAKEINTRESOURCE(40)

Definition at line 19 of file common.h.

Function Documentation

UINT LoadResourceString | ( | HINSTANCE | hInst,
 |  | LPCSTR | lpType,
 |  | LPCSTR | lpName,
 |  | LPSTR | lpBuf,
 |  | DWORD * | pdwBufSize
 | ) |  |

Definition at line 228 of file utils.cpp.

{
    HRSRC   hRsrc   = 0;
    HGLOBAL hGlobal = 0;
    WCHAR   *pch    = 0;

    if ((hRsrc = WIN::FindResource(hInst, lpName, lpType)) != 0
        && (hGlobal = WIN::LoadResource(hInst, hRsrc)) != 0)
    {
        // resource exists
        if ((pch = (WCHAR*)LockResource(hGlobal)) != 0)
        {
            unsigned int cch = WideCharToMultiByte(CP_ACP, 0, pch, -1, NULL, 0, NULL, NULL);
            if (cch > *pdwBufSize)
            {
                *pdwBufSize = cch;
                return ERROR_MORE_DATA;
            }

            if (0 == WideCharToMultiByte(CP_ACP, 0, pch, -1, lpBuf, *pdwBufSize, NULL, NULL))
                return ERROR_FUNCTION_FAILED;
            *pdwBufSize = cch;

        }
        else
        {
            if (1 > *pdwBufSize)
            {
                *pdwBufSize = 1;
                return ERROR_MORE_DATA;
            }

            *pdwBufSize = 1;
            *lpBuf = 0;
        }

        DebugMsg("[Resource] lpName = %s, lpBuf = %s\n", lpName, lpBuf);

        return ERROR_SUCCESS;
    }

    // resource does not exist
    DebugMsg("[Resource] lpName = %s NOT FOUND\n", lpName);

    return ERROR_RESOURCE_NAME_NOT_FOUND;
}

UINT SetupLoadResourceString | ( | HINSTANCE | hInst,
 |  | LPCSTR | lpName,
 |  | LPSTR * | lppBuf,
 |  | DWORD | dwBufSize
 | ) |  |

Definition at line 279 of file utils.cpp.

{
    UINT uiStat = 0;
    if (!*lppBuf)
    {
        dwBufSize = (dwBufSize > 0) ? dwBufSize : 256;
        *lppBuf = new char[dwBufSize];
        if (!*lppBuf)
            return ERROR_OUTOFMEMORY;
    }

    if (ERROR_SUCCESS != (uiStat = LoadResourceString(hInst, RT_INSTALL_PROPERTY, lpName, *lppBuf, &dwBufSize)))
    {
        if (uiStat != ERROR_MORE_DATA)
            return uiStat;

        // resize and try again
        delete [] *lppBuf;
        *lppBuf = new char[dwBufSize];
        if (!*lppBuf)
            return ERROR_OUTOFMEMORY;

        uiStat = LoadResourceString(hInst, RT_INSTALL_PROPERTY, lpName, *lppBuf, &dwBufSize);
    }

    return uiStat;
}

Generated on Wed Nov 13 2024 16:53:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/Msi/setup.exe/resource.h File Reference

  • SysMgmt
  • Msi
  • setup.exe
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_DOWNLOAD_ACTIONTEXT 105
#define | IDC_DOWNLOAD_BANNER 103
#define | IDC_DOWNLOAD_CANCEL 102
#define | IDC_DOWNLOAD_ICON 101
#define | IDC_DOWNLOAD_PROGRESSBAR 104
#define | IDD_PROGRESS 1101
#define | IDI_INSTALLER 99
#define | IDS_ALLOW_MSI_UPDATE 33
#define | IDS_APP_TITLE 11
#define | IDS_BANNER_TEXT 16
#define | IDS_CANCEL 14
#define | IDS_DEFAULT_PRODUCT 17
#define | IDS_DOWNLOADING_PACKAGE 18
#define | IDS_DOWNLOADING_UPDATE 27
#define | IDS_FAILED_TO_UPGRADE_MSI 29
#define | IDS_INCORRECT_UPDATE 31
#define | IDS_INSTALL_ERROR 32
#define | IDS_INVALID_OPERATION 34
#define | IDS_INVALID_PATH 23
#define | IDS_INVALID_VER_STR 25
#define | IDS_MISSING_RESOURCE 15
#define | IDS_NO_WINTRUST 21
#define | IDS_NOMSI 13
#define | IDS_NOUPDATE 28
#define | IDS_OS_NOT_SUPPORTED 36
#define | IDS_OUTOFMEM 12
#define | IDS_REBOOT_REQUIRED 30
#define | IDS_REQUIRES_ADMIN_PRIV 26
#define | IDS_REQUIRES_NEWER_VERSION 20
#define | IDS_UNTRUSTED 22
#define | IDS_USAGE 35
#define | IDS_USER_CANCELLED 24
#define | IDS_VALIDATING_SIGNATURE 19

Define Documentation

#define IDC_DOWNLOAD_ACTIONTEXT 105

Definition at line 45 of file resource.h.

#define IDC_DOWNLOAD_BANNER 103

Definition at line 43 of file resource.h.

#define IDC_DOWNLOAD_CANCEL 102

Definition at line 42 of file resource.h.

#define IDC_DOWNLOAD_ICON 101

Definition at line 41 of file resource.h.

#define IDC_DOWNLOAD_PROGRESSBAR 104

Definition at line 44 of file resource.h.

#define IDD_PROGRESS 1101

Definition at line 47 of file resource.h.

#define IDI_INSTALLER 99

Definition at line 39 of file resource.h.

#define IDS_ALLOW_MSI_UPDATE 33

Definition at line 34 of file resource.h.

#define IDS_APP_TITLE 11

Definition at line 12 of file resource.h.

#define IDS_BANNER_TEXT 16

Definition at line 17 of file resource.h.

#define IDS_CANCEL 14

Definition at line 15 of file resource.h.

#define IDS_DEFAULT_PRODUCT 17

Definition at line 18 of file resource.h.

#define IDS_DOWNLOADING_PACKAGE 18

Definition at line 19 of file resource.h.

#define IDS_DOWNLOADING_UPDATE 27

Definition at line 28 of file resource.h.

#define IDS_FAILED_TO_UPGRADE_MSI 29

Definition at line 30 of file resource.h.

#define IDS_INCORRECT_UPDATE 31

Definition at line 32 of file resource.h.

#define IDS_INSTALL_ERROR 32

Definition at line 33 of file resource.h.

#define IDS_INVALID_OPERATION 34

Definition at line 35 of file resource.h.

#define IDS_INVALID_PATH 23

Definition at line 24 of file resource.h.

#define IDS_INVALID_VER_STR 25

Definition at line 26 of file resource.h.

#define IDS_MISSING_RESOURCE 15

Definition at line 16 of file resource.h.

#define IDS_NO_WINTRUST 21

Definition at line 22 of file resource.h.

#define IDS_NOMSI 13

Definition at line 14 of file resource.h.

#define IDS_NOUPDATE 28

Definition at line 29 of file resource.h.

#define IDS_OS_NOT_SUPPORTED 36

Definition at line 37 of file resource.h.

#define IDS_OUTOFMEM 12

Definition at line 13 of file resource.h.

#define IDS_REBOOT_REQUIRED 30

Definition at line 31 of file resource.h.

#define IDS_REQUIRES_ADMIN_PRIV 26

Definition at line 27 of file resource.h.

#define IDS_REQUIRES_NEWER_VERSION 20

Definition at line 21 of file resource.h.

#define IDS_UNTRUSTED 22

Definition at line 23 of file resource.h.

#define IDS_USAGE 35

Definition at line 36 of file resource.h.

#define IDS_USER_CANCELLED 24

Definition at line 25 of file resource.h.

#define IDS_VALIDATING_SIGNATURE 19

Definition at line 20 of file resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/Msi/setup.exe/setup.cpp File Reference

  • SysMgmt
  • Msi
  • setup.exe
Defines | Typedefs | Functions | Variables

setup.cpp File Reference

#include <windows.h>
#include <tchar.h>
#include <assert.h>
#include <strsafe.h>
#include "wininet.h"
#include "urlmon.h"
#include "wintrust.h"
#include "softpub.h"
#include "msidefs.h"
#include "msiquery.h"
#include "msi.h"
#include "common.h"
#include "setup.h"
#include "setupui.h"
#include "resource.h"

Go to the source code of this file.

Defines

#define | MSI
#define | MSI_DLL "msi.dll"
#define | MSIAPI_MsiApplyPatch "MsiApplyPatchA"
#define | MSIAPI_MsiCloseHandle "MsiCloseHandle"
#define | MSIAPI_MsiDatabaseOpenView "MsiDatabaseOpenViewA"
#define | MSIAPI_MsiInstallProduct "MsiInstallProductA"
#define | MSIAPI_MsiOpenDatabase "MsiOpenDatabaseA"
#define | MSIAPI_MsiQueryProductState "MsiQueryProductStateA"
#define | MSIAPI_MsiRecordGetString "MsiRecordGetStringA"
#define | MSIAPI_MsiReinstallProduct "MsiReinstallProductA"
#define | MSIAPI_MsiSetInternalUI "MsiSetInternalUI"
#define | MSIAPI_MsiViewExecute "MsiViewExecute"
#define | MSIAPI_MsiViewFetch "MsiViewFetch"
#define | WIN

Typedefs

typedef UINT(WINAPI * | PFnMsiApplyPatch )(LPCSTR szPatchPackage, LPCSTR szInstallPackage, INSTALLTYPE eInstallType, LPCSTR szCommandLine)
typedef UINT(WINAPI * | PFnMsiCloseHandle )(MSIHANDLE h)
typedef UINT(WINAPI * | PFnMsiDatabaseOpenView )(MSIHANDLE hDatabase, LPCSTR szQuery, MSIHANDLE *phView)
typedef UINT(WINAPI * | PFnMsiInstallProduct )(LPCSTR szPackagePath, LPCSTR szCommandLine)
typedef UINT(WINAPI * | PFnMsiOpenDatabase )(LPCSTR szDatabasePath, LPCSTR szPersist, MSIHANDLE *phDatabase)
typedef INSTALLSTATE(WINAPI * | PFnMsiQueryProductState )(LPCSTR szProduct)
typedef UINT(WINAPI * | PFnMsiRecordGetString )(MSIHANDLE hRecord, unsigned int uiField, LPSTR szValue, DWORD *pcchValueBuf)
typedef UINT(WINAPI * | PFnMsiReinstallProduct )(LPCSTR szProduct, DWORD dwReinstallMode)
typedef INSTALLUILEVEL(WINAPI * | PFnMsiSetInternalUI )(INSTALLUILEVEL dwUILevel, HWND *phWnd)
typedef UINT(WINAPI * | PFnMsiViewExecute )(MSIHANDLE hView, MSIHANDLE hRecord)
typedef UINT(WINAPI * | PFnMsiViewFetch )(MSIHANDLE hView, MSIHANDLE *phRecord)

Functions

int __stdcall | WinMain (HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpszCmdLine, int nCmdShow)

Variables

const DWORD | lcidLOCALE_INVARIANT = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT)

Define Documentation

#define MSI

Definition at line 10 of file setup.cpp.

#define MSI_DLL "msi.dll"

Definition at line 40 of file setup.cpp.

#define MSIAPI_MsiApplyPatch "MsiApplyPatchA"

Definition at line 48 of file setup.cpp.

#define MSIAPI_MsiCloseHandle "MsiCloseHandle"

Definition at line 72 of file setup.cpp.

#define MSIAPI_MsiDatabaseOpenView "MsiDatabaseOpenViewA"

Definition at line 60 of file setup.cpp.

#define MSIAPI_MsiInstallProduct "MsiInstallProductA"

Definition at line 45 of file setup.cpp.

#define MSIAPI_MsiOpenDatabase "MsiOpenDatabaseA"

Definition at line 57 of file setup.cpp.

#define MSIAPI_MsiQueryProductState "MsiQueryProductStateA"

Definition at line 54 of file setup.cpp.

#define MSIAPI_MsiRecordGetString "MsiRecordGetStringA"

Definition at line 69 of file setup.cpp.

#define MSIAPI_MsiReinstallProduct "MsiReinstallProductA"

Definition at line 51 of file setup.cpp.

#define MSIAPI_MsiSetInternalUI "MsiSetInternalUI"

Definition at line 42 of file setup.cpp.

#define MSIAPI_MsiViewExecute "MsiViewExecute"

Definition at line 63 of file setup.cpp.

#define MSIAPI_MsiViewFetch "MsiViewFetch"

Definition at line 66 of file setup.cpp.

#define WIN

Definition at line 9 of file setup.cpp.

Typedef Documentation

typedef UINT(WINAPI* PFnMsiApplyPatch)(LPCSTR szPatchPackage, LPCSTR szInstallPackage, INSTALLTYPE eInstallType, LPCSTR szCommandLine)

Definition at line 49 of file setup.cpp.

typedef UINT(WINAPI* PFnMsiCloseHandle)(MSIHANDLE h)

Definition at line 73 of file setup.cpp.

typedef UINT(WINAPI* PFnMsiDatabaseOpenView)(MSIHANDLE hDatabase, LPCSTR szQuery, MSIHANDLE *phView)

Definition at line 61 of file setup.cpp.

typedef UINT(WINAPI* PFnMsiInstallProduct)(LPCSTR szPackagePath, LPCSTR szCommandLine)

Definition at line 46 of file setup.cpp.

typedef UINT(WINAPI* PFnMsiOpenDatabase)(LPCSTR szDatabasePath, LPCSTR szPersist, MSIHANDLE *phDatabase)

Definition at line 58 of file setup.cpp.

typedef INSTALLSTATE(WINAPI* PFnMsiQueryProductState)(LPCSTR szProduct)

Definition at line 55 of file setup.cpp.

typedef UINT(WINAPI* PFnMsiRecordGetString)(MSIHANDLE hRecord, unsigned int uiField, LPSTR szValue, DWORD *pcchValueBuf)

Definition at line 70 of file setup.cpp.

typedef UINT(WINAPI* PFnMsiReinstallProduct)(LPCSTR szProduct, DWORD dwReinstallMode)

Definition at line 52 of file setup.cpp.

typedef INSTALLUILEVEL(WINAPI* PFnMsiSetInternalUI)(INSTALLUILEVEL dwUILevel, HWND *phWnd)

Definition at line 43 of file setup.cpp.

typedef UINT(WINAPI* PFnMsiViewExecute)(MSIHANDLE hView, MSIHANDLE hRecord)

Definition at line 64 of file setup.cpp.

typedef UINT(WINAPI* PFnMsiViewFetch)(MSIHANDLE hView, MSIHANDLE *phRecord)

Definition at line 67 of file setup.cpp.

Function Documentation

int __stdcall WinMain | ( | HINSTANCE | hInst,
 |  | HINSTANCE | hPrevInst,
 |  | LPSTR | lpszCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 81 of file setup.cpp.

{

//-----------------------------------------------------------------------------------------------------------------
//  VARIABLES
//
//-----------------------------------------------------------------------------------------------------------------
    UINT    uiRet = ERROR_SUCCESS;
    HRESULT hr    = S_OK;

    char *szMsiFile          = 0;
    char *szBaseURL          = 0;
    char *szInstallPath      = 0;
    char *szMsiCacheFile     = 0;
    char *szOperation        = 0;
    char *szProductName      = 0;
    char *szMinimumMsi       = 0;
    char *szProperties       = 0;
    char *szInstProperties   = 0;
    char *szTempPath         = 0;
    char *szFilePart         = 0;
    char *szBase             = 0;
    char *szUpdate           = 0;

    char *szRegisteredMsiFolder = 0;
    char *szMsiDllLocation      = 0;

    char szAppTitle[MAX_STR_CAPTION]    = {0};
    char szError[MAX_STR_LENGTH]        = {0};
    char szText[MAX_STR_CAPTION]        = {0};
    char szBanner[MAX_STR_LENGTH]       = {0};
    char szAction[MAX_STR_LENGTH]       = {0};
    char szUserPrompt[MAX_STR_LENGTH]   = {0};
    char szProductCode[MAX_LENGTH_GUID] = {0};

    char szModuleFile[MAX_PATH]         = {0};
    DWORD dwModuleFileSize       = MAX_PATH;

    DWORD dwMsiFileSize          = 0;
    DWORD dwBaseURLSize          = 0;
    DWORD cchInstallPath         = 0;
    DWORD dwMsiCacheFileSize     = 0;
    DWORD dwOperationSize        = 0;
    DWORD dwProductNameSize      = 0;
    DWORD dwMinimumMsiSize       = 0;
    DWORD dwPropertiesSize       = 0;
    DWORD cchInstProperties      = 0;
    DWORD cchTempPath            = 0;
    DWORD dwLastError            = 0;
    DWORD cchReturn              = 0;
    DWORD dwBaseUpdateSize      = 0;
    DWORD dwUpdateSize          = 0;
    DWORD dwResult               = 0;
    DWORD dwType                 = 0;
    DWORD dwProductCodeSize      = MAX_LENGTH_GUID;

    DWORD dwRegisteredMsiFolderSize  = 0;
    DWORD dwMsiDllLocationSize       = 0;

    ULONG ulMsiMinVer        = 0;
    char *szStopScan         = NULL;

    bool        fDelayRebootReq    = false;
    bool        fPatch             = false;
    bool        fQFE               = false;
    bool        fOSSupported       = false;
    emEnum      emExecMode         = emPreset;

    HKEY hInstallerKey = 0;

    HMODULE hMsi = 0;
    PFnMsiSetInternalUI pfnMsiSetInternalUI = 0;
    PFnMsiInstallProduct pfnMsiInstallProduct = 0;
    PFnMsiApplyPatch pfnMsiApplyPatch = 0;
    PFnMsiReinstallProduct pfnMsiReinstallProduct = 0;
    PFnMsiQueryProductState pfnMsiQueryProductState = 0;
    PFnMsiOpenDatabase pfnMsiOpenDatabase = 0;
    PFnMsiDatabaseOpenView pfnMsiDatabaseOpenView = 0;
    PFnMsiViewExecute pfnMsiViewExecute = 0;
    PFnMsiViewFetch pfnMsiViewFetch = 0;
    PFnMsiRecordGetString pfnMsiRecordGetString = 0;
    PFnMsiCloseHandle pfnMsiCloseHandle = 0;

    MSIHANDLE hDatabase = 0;
    MSIHANDLE hView = 0;
    MSIHANDLE hRec = 0;

    INSTALLSTATE isProduct = INSTALLSTATE_UNKNOWN;

    const char * szAdminImagePath = 0;

//-----------------------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------------------
    // create our UI object
    CDownloadUI DownloadUI;

    // Load our AppTitle (caption)
    WIN::LoadString(hInst, IDS_APP_TITLE, szAppTitle, sizeof(szAppTitle)/sizeof(char));

    // Obtain path we are running from
    if (0 == WIN::GetModuleFileName(hInst, szModuleFile, dwModuleFileSize))
    {
        // No UI displayed. Silent failure.
        uiRet = GetLastError();
        goto CleanUp;
    }
    DebugMsg("[Info] we are running from --> %s\n", szModuleFile);

    // Figure out what we want to do
    emExecMode = GetExecutionMode (lpszCmdLine);

    if (emVerify == emExecMode)
    {
        //
        // We don't want any UI to be displayed in this case. The return value
        // from the exe is the result of the verification. Therefore, this
        // should be done before initializing the UI.
        //
        uiRet = VerifyFileSignature (szModuleFile, lpszCmdLine);
        if (ERROR_BAD_ARGUMENTS != uiRet)
            goto CleanUp;
    }

    if (ERROR_BAD_ARGUMENTS == uiRet || emHelp == emExecMode)
    {
        DisplayUsage(hInst, NULL, szAppTitle);
        goto CleanUp;
    }

    //
    // NOTE:
    // Delay handling admin. installs until we have determined if we are
    // patching an existing install or if we are doing a default install.
    //

    // initialize our UI object with desktop as parent
    DownloadUI.Initialize(hInst, /* hwndParent = */ 0, szAppTitle);

    // Check if we are installing on an OS that supports Windows Installer 3.0
    fOSSupported = IsOSSupported();
    if(!fOSSupported)
    {
        PostError(hInst, DownloadUI.GetCurrentWindow(), szAppTitle, IDS_OS_NOT_SUPPORTED);
        uiRet = ERROR_INSTALL_FAILURE;
        goto CleanUp;
    }

    // only run one instance at a time
    if (AlreadyInProgress())
    {
        // silently return - correct return code ?
        return ERROR_INSTALL_ALREADY_RUNNING;
    }

    // determine operation, default (if not present) is INSTALL
    if (ERROR_OUTOFMEMORY == (uiRet = SetupLoadResourceString(hInst, ISETUPPROPNAME_OPERATION, &szOperation, dwOperationSize)))
    {
        ReportErrorOutOfMemory(hInst, DownloadUI.GetCurrentWindow(), szAppTitle);
        goto CleanUp;
    }
    if (ERROR_SUCCESS != uiRet)
    {
        // set operation to default which is install
        if (!szOperation)
        {
            szOperation = new char[lstrlen(szDefaultOperation) + 1];
            if (!szOperation)
            {
                ReportErrorOutOfMemory(hInst, DownloadUI.GetCurrentWindow(), szAppTitle);
                goto CleanUp;
            }
        }
        if (lstrlen(szOperation) <= lstrlen(szDefaultOperation))
        {
            delete [] szOperation;
            szOperation = new char[lstrlen(szDefaultOperation) + 1];
            if (!szOperation)
            {
                ReportErrorOutOfMemory(hInst, DownloadUI.GetCurrentWindow(), szAppTitle);
                goto CleanUp;
            }
        }
        lstrcpy(szOperation, szDefaultOperation);
    }

    // obtain name of product
    if (ERROR_OUTOFMEMORY == (uiRet = SetupLoadResourceString(hInst, ISETUPPROPNAME_PRODUCTNAME, &szProductName, dwProductNameSize)))
    {
        ReportErrorOutOfMemory(hInst, DownloadUI.GetCurrentWindow(), szAppTitle);
        goto CleanUp;
    }
    if (ERROR_SUCCESS != uiRet)
    {
        // use default
        WIN::LoadString(hInst, IDS_DEFAULT_PRODUCT, szProductName, MAX_STR_CAPTION);
    }

    // set banner text
    WIN::LoadString(hInst, IDS_BANNER_TEXT, szText, MAX_STR_CAPTION);
    StringCchPrintf(szBanner, sizeof(szBanner), szText, szProductName);
    if (irmCancel == DownloadUI.SetBannerText(szBanner))
    {
        ReportUserCancelled(hInst, DownloadUI.GetCurrentWindow(), szAppTitle);
        uiRet = ERROR_INSTALL_USEREXIT;
        goto CleanUp;
    }

    // Determine if this is a patch or a normal install.
    if (ERROR_OUTOFMEMORY == (uiRet = SetupLoadResourceString(hInst, ISETUPPROPNAME_DATABASE, &szMsiFile, dwMsiFileSize)))
    {
        ReportErrorOutOfMemory(hInst, DownloadUI.GetCurrentWindow(), szAppTitle);
        goto CleanUp;
    }
    else if (ERROR_SUCCESS != uiRet)
    {
        // look for patch
        if (ERROR_OUTOFMEMORY == (uiRet = SetupLoadResourceString(hInst, ISETUPPROPNAME_PATCH, &szMsiFile, dwMsiFileSize)))
        {
            ReportErrorOutOfMemory(hInst, DownloadUI.GetCurrentWindow(), szAppTitle);
            goto CleanUp;
        }
        else if (ERROR_SUCCESS != uiRet)
        {
            PostResourceNotFoundError(hInst, DownloadUI.GetCurrentWindow(), szAppTitle, ISETUPPROPNAME_DATABASE);
            goto CleanUp;
        }

        fPatch = true;
    }

    //
    // If we are here, this is either an admin. install or a default install.
    // File signature verification, help and other invalid parameters have
    // already been taken care of above.
    //
    if (emAdminInstall == emExecMode)
    {
        uiRet = GetAdminInstallInfo (fPatch, lpszCmdLine, &szAdminImagePath);
        if (ERROR_BAD_ARGUMENTS == uiRet)
        {
            DisplayUsage(hInst, DownloadUI.GetCurrentWindow(), szAppTitle);
            goto CleanUp;
        }
    }

    //
    // At this point, the validation of the commandline arguments is complete
    // and we have all the information we need.
    //

    // obtain minimum required MSI version
    if (ERROR_OUTOFMEMORY == (uiRet = SetupLoadResourceString(hInst, ISETUPPROPNAME_MINIMUM_MSI, &szMinimumMsi, dwMinimumMsiSize)))
    {
        ReportErrorOutOfMemory(hInst, DownloadUI.GetCurrentWindow(), szAppTitle);
        goto CleanUp;
    }
    else if (ERROR_SUCCESS != uiRet)
    {
        PostResourceNotFoundError(hInst, DownloadUI.GetCurrentWindow(), szAppTitle, ISETUPPROPNAME_MINIMUM_MSI);
        goto CleanUp;
    }

    // make sure required Msi version is a valid value -- must be >= 150
    ulMsiMinVer = strtoul(szMinimumMsi, &szStopScan, 10);
    if (!szStopScan || (szStopScan == szMinimumMsi) || (*szStopScan != 0) || ulMsiMinVer < MINIMUM_SUPPORTED_MSI_VERSION)
    {
        // invalid minimum version string
        PostError(hInst, DownloadUI.GetCurrentWindow(), szAppTitle, IDS_INVALID_VER_STR, szMinimumMsi, MINIMUM_SUPPORTED_MSI_VERSION);
        uiRet = ERROR_INVALID_PARAMETER;
        goto CleanUp;
    }

    DebugMsg("[Resource] Minimum Msi Value = %d\n", ulMsiMinVer);

    // compare minimum required MSI version to that which is on the machine
    if (IsMsiUpgradeNecessary(ulMsiMinVer))
    {
        DebugMsg("[Info] Upgrade of Windows Installer is requested\n");

        // make sure this is admin -- must have admin priviledges to upgrade Windows Installer
        if (!IsAdmin())
        {
            PostError(hInst, DownloadUI.GetCurrentWindow(), szAppTitle, IDS_REQUIRES_ADMIN_PRIV);
            uiRet = ERROR_INSTALL_FAILURE;
            goto CleanUp;
        }

        // Ask the user if they want to upgrade the installer
        WIN::LoadString(hInst, IDS_ALLOW_MSI_UPDATE, szUserPrompt, MAX_STR_LENGTH);
        if (IDYES != WIN::MessageBox(DownloadUI.GetCurrentWindow(), szUserPrompt, szAppTitle, MB_YESNO|MB_ICONQUESTION))
        {
            // user decided to cancel
            ReportUserCancelled(hInst, DownloadUI.GetCurrentWindow(), szAppTitle);
            uiRet = ERROR_INSTALL_USEREXIT;
            goto CleanUp;
        }

        if (ERROR_OUTOFMEMORY == (uiRet = SetupLoadResourceString(hInst, ISETUPPROPNAME_UPDATE, &szUpdate, dwUpdateSize)))
        {
            ReportErrorOutOfMemory(hInst, DownloadUI.GetCurrentWindow(), szAppTitle);
            goto CleanUp;
        }
        else if (ERROR_SUCCESS != uiRet)
        {
            PostResourceNotFoundError(hInst, DownloadUI.GetCurrentWindow(), szAppTitle, ISETUPPROPNAME_UPDATE);
            goto CleanUp;
        }

        // determine if we need to download the Windows Installer update package from the web -- based on presence of UPDATELOCATION property
        if (ERROR_OUTOFMEMORY == (uiRet = SetupLoadResourceString(hInst, ISETUPPROPNAME_UPDATELOCATION, &szBase, dwBaseUpdateSize)))
        {
            ReportErrorOutOfMemory(hInst, DownloadUI.GetCurrentWindow(), szAppTitle);
            goto CleanUp;
        }
        else if (ERROR_SUCCESS == uiRet)
        {
            // presence of UPDATELOCATION property indicates assumption of URL source
            if (ERROR_SUCCESS != (uiRet = DownloadAndUpgradeMsi(hInst, &DownloadUI, szAppTitle, szBase, szUpdate, szModuleFile, ulMsiMinVer)))
            {
                if (ERROR_SUCCESS_REBOOT_REQUIRED == uiRet)
                {
                    // successful, but must reboot at end
                    fDelayRebootReq = true;
                }
                else
                    goto CleanUp;
            }
        }
        else
        {
            // lack of UPDATELOCATION property indicates assumption of Media source
            if (ERROR_SUCCESS != (uiRet = UpgradeMsi(hInst, &DownloadUI, szAppTitle, szModuleFile, szUpdate, ulMsiMinVer)))
            {
                if (ERROR_SUCCESS_REBOOT_REQUIRED == uiRet)
                {
                    // successful, but must reboot at end
                    fDelayRebootReq = true;
                }
                else
                    goto CleanUp;
            }
        }
    }

    DebugMsg("[Info] Windows Installer has been upgraded, or was already correct version\n");

    // perform some extra authoring validation
    if (fPatch
        && CSTR_EQUAL != CompareString(lcidLOCALE_INVARIANT, NORM_IGNORECASE, szOperation, -1, szMinPatchOperation, -1)
        && CSTR_EQUAL != CompareString(lcidLOCALE_INVARIANT, NORM_IGNORECASE, szOperation, -1, szMajPatchOperation, -1)
        && CSTR_EQUAL != CompareString(lcidLOCALE_INVARIANT, NORM_IGNORECASE, szOperation, -1, szDefaultOperation, -1))
    {
        // wrong operation
        DebugMsg("[Error] Operation %s is not valid for a patch\n", szOperation);
        PostFormattedError(hInst, DownloadUI.GetCurrentWindow(), szAppTitle, IDS_INVALID_OPERATION, szOperation);
        uiRet = ERROR_INVALID_PARAMETER;
        goto CleanUp;
    }
    else if (!fPatch
        && CSTR_EQUAL != CompareString(lcidLOCALE_INVARIANT, NORM_IGNORECASE, szOperation, -1, szInstallOperation, -1)
        && CSTR_EQUAL != CompareString(lcidLOCALE_INVARIANT, NORM_IGNORECASE, szOperation, -1, szInstallUpdOperation, -1)
        && CSTR_EQUAL != CompareString(lcidLOCALE_INVARIANT, NORM_IGNORECASE, szOperation, -1, szDefaultOperation, -1))
    {
        // wrong operation
        DebugMsg("[Error] Operation %s is not valid for a package\n", szOperation);
        PostFormattedError(hInst, DownloadUI.GetCurrentWindow(), szAppTitle, IDS_INVALID_OPERATION, szOperation);
        uiRet = ERROR_INVALID_PARAMETER;
        goto CleanUp;
    }

    // by now we either have a MSI or a MSP
    if (CSTR_EQUAL == CompareString(lcidLOCALE_INVARIANT, NORM_IGNORECASE, szOperation, -1, szMinPatchOperation, -1)
        || CSTR_EQUAL == CompareString(lcidLOCALE_INVARIANT, NORM_IGNORECASE, szOperation, -1, szInstallUpdOperation, -1)
        || (fPatch && CSTR_EQUAL == CompareString(lcidLOCALE_INVARIANT, NORM_IGNORECASE, szOperation, -1, szDefaultOperation, -1)))
        fQFE = true;

    // obtain base URL
    if (ERROR_OUTOFMEMORY == (uiRet = SetupLoadResourceString(hInst, ISETUPPROPNAME_BASEURL, &szBaseURL, dwBaseURLSize)))
    {
        ReportErrorOutOfMemory(hInst, DownloadUI.GetCurrentWindow(), szAppTitle);
        goto CleanUp;
    }
    else if (ERROR_SUCCESS == uiRet)
    {
        // presence of BASEURL property indicates assumption of URL source . . .

        // generate the path to the installation package == baseURL + msiFile
        //   note: msiFile is a relative path
        cchTempPath = lstrlen(szBaseURL) + lstrlen(szMsiFile) + 2; // 1 for slash, 1 for null
        szTempPath = new char[cchTempPath ];
        if (!szTempPath)
        {
            ReportErrorOutOfMemory(hInst, DownloadUI.GetCurrentWindow(), szAppTitle);
            uiRet = ERROR_OUTOFMEMORY;
            goto CleanUp;
        }
        lstrcpy(szTempPath, szBaseURL);
        // check for trailing slash on szBaseURL
        char *pch = szBaseURL + lstrlen(szBaseURL) + 1; // put at null terminator
        pch = CharPrev(szBaseURL, pch);
        if (*pch != '/')
            lstrcat(szTempPath, szUrlPathSep);
        lstrcat(szTempPath, szMsiFile);

        // canocialize the URL path
        cchInstallPath = cchTempPath*2;
        szInstallPath = new char[cchInstallPath];
        if (!szInstallPath)
        {
            ReportErrorOutOfMemory(hInst, DownloadUI.GetCurrentWindow(), szAppTitle);
            uiRet = ERROR_OUTOFMEMORY;
            goto CleanUp;
        }

        dwLastError = 0; // success
        if (!InternetCanonicalizeUrl(szTempPath, szInstallPath, &cchInstallPath, 0))
        {
            dwLastError = GetLastError();
            if (ERROR_INSUFFICIENT_BUFFER == dwLastError)
            {
                // try again
                delete [] szInstallPath;
                szInstallPath = new char[cchInstallPath];
                if (!szInstallPath)
                {
                    ReportErrorOutOfMemory(hInst, DownloadUI.GetCurrentWindow(), szAppTitle);
                    uiRet = ERROR_OUTOFMEMORY;
                    goto CleanUp;
                }
                dwLastError = 0; // reset to success for 2nd attempt
                if (!InternetCanonicalizeUrl(szTempPath, szInstallPath, &cchInstallPath, 0))
                    dwLastError = GetLastError();
            }
        }
        if (0 != dwLastError)
        {
            // error -- invalid path/Url
            PostFormattedError(hInst, DownloadUI.GetCurrentWindow(), szAppTitle, IDS_INVALID_PATH, szTempPath);
            uiRet = dwLastError;
            goto CleanUp;
        }

        // set action text for download
        WIN::LoadString(hInst, IDS_DOWNLOADING_PACKAGE, szText, MAX_STR_CAPTION);
        StringCchPrintf(szAction, sizeof(szAction), szText, szMsiFile);
        if (irmCancel == DownloadUI.SetActionText(szAction))
        {
            ReportUserCancelled(hInst, DownloadUI.GetCurrentWindow(), szAppTitle);
            uiRet = ERROR_INSTALL_USEREXIT;
            goto CleanUp;
        }

        // download the msi file so we can attempt a trust check -- must be local for WinVerifyTrust
        DebugMsg("[Info] Downloading msi file %s for WinVerifyTrust check\n", szInstallPath);

        szMsiCacheFile = new char[MAX_PATH];
        dwMsiCacheFileSize = MAX_PATH;
        if (!szMsiCacheFile)
        {
            ReportErrorOutOfMemory(hInst, DownloadUI.GetCurrentWindow(), szAppTitle);
            uiRet = ERROR_OUTOFMEMORY;
            goto CleanUp;
        }

        hr = WIN::URLDownloadToCacheFile(NULL, szInstallPath, szMsiCacheFile, dwMsiCacheFileSize, 0, /* IBindStatusCallback = */ &CDownloadBindStatusCallback(&DownloadUI));
        if (DownloadUI.HasUserCanceled())
        {
            ReportUserCancelled(hInst, DownloadUI.GetCurrentWindow(), szAppTitle);
            uiRet = ERROR_INSTALL_USEREXIT;
            goto CleanUp;
        }
        if (FAILED(hr))
        {
            // error during download -- probably because file not found (or lost connection)
            PostFormattedError(hInst, DownloadUI.GetCurrentWindow(), szAppTitle, IDS_NOMSI, szInstallPath);
            uiRet = ERROR_FILE_NOT_FOUND;
            goto CleanUp;
        }

        DebugMsg("[Info] Msi file was cached to %s\n", szMsiCacheFile);

        // set action text for trust verification
        WIN::LoadString(hInst, IDS_VALIDATING_SIGNATURE, szText, MAX_STR_CAPTION);
        StringCchPrintf(szAction, sizeof(szAction), szText, szMsiFile);
        if (irmCancel == DownloadUI.SetActionText(szAction))
        {
            ReportUserCancelled(hInst, DownloadUI.GetCurrentWindow(), szAppTitle);
            uiRet = ERROR_INSTALL_USEREXIT;
            goto CleanUp;
        }

        // perform trust check
        itvEnum itv = IsPackageTrusted(szModuleFile, szMsiCacheFile, DownloadUI.GetCurrentWindow());
        if (itvWintrustNotOnMachine == itv)
        {
            PostError(hInst, DownloadUI.GetCurrentWindow(), szAppTitle, IDS_NO_WINTRUST);
            uiRet = ERROR_CALL_NOT_IMPLEMENTED;
            goto CleanUp;
        }
        else if (itvUnTrusted == itv)
        {
            PostFormattedError(hInst, DownloadUI.GetCurrentWindow(), szAppTitle, IDS_UNTRUSTED, szInstallPath);
            uiRet = HRESULT_CODE(TRUST_E_SUBJECT_NOT_TRUSTED);
            goto CleanUp;
        }
    }
    else
    {
        // lack of BASEURL property indicates assumption of Media source

        // generate the path to the Msi file =  szModuleFile + msiFile
        //   note: msiFile is a relative path
        cchTempPath = lstrlen(szModuleFile) + lstrlen(szMsiFile) + 2; // 1 for null terminator, 1 for back slash
        szTempPath = new char[cchTempPath];
        if (!szTempPath)
        {
            ReportErrorOutOfMemory(hInst, DownloadUI.GetCurrentWindow(), szAppTitle);
            uiRet = ERROR_OUTOFMEMORY;
            goto CleanUp;
        }

        // find 'setup.exe' in the path so we can remove it
        if (0 == GetFullPathName(szModuleFile, cchTempPath, szTempPath, &szFilePart))
        {
            uiRet = GetLastError();
            PostFormattedError(hInst, DownloadUI.GetCurrentWindow(), szAppTitle, IDS_INVALID_PATH, szTempPath);
            goto CleanUp;
        }
        if (szFilePart)
            *szFilePart = '\0';

        lstrcat(szTempPath, szMsiFile);

        cchInstallPath = 2*cchTempPath;
        szInstallPath = new char[cchInstallPath];
        if (!szInstallPath)
        {
            ReportErrorOutOfMemory(hInst, DownloadUI.GetCurrentWindow(), szAppTitle);
            uiRet = ERROR_OUTOFMEMORY;
            goto CleanUp;
        }

        // normalize the path
        cchReturn = GetFullPathName(szTempPath, cchInstallPath, szInstallPath, &szFilePart);
        if (cchReturn > cchInstallPath)
        {
            // try again, with larger buffer
            delete [] szInstallPath;
            cchInstallPath = cchReturn;
            szInstallPath = new char[cchInstallPath];
            if (!szInstallPath)
            {
                ReportErrorOutOfMemory(hInst, DownloadUI.GetCurrentWindow(), szAppTitle);
                uiRet = ERROR_OUTOFMEMORY;
                goto CleanUp;
            }
            cchReturn = GetFullPathName(szTempPath, cchInstallPath, szInstallPath, &szFilePart);
        }
        if (0 == cchReturn)
        {
            // error -- invalid path
            PostFormattedError(hInst, DownloadUI.GetCurrentWindow(), szAppTitle, IDS_INVALID_PATH, szTempPath);
            uiRet = dwLastError;
            goto CleanUp;
        }

        // no download is necessary -- but we can check for the file's existence
        DWORD dwFileAttrib = GetFileAttributes(szInstallPath);
        if (0xFFFFFFFF == dwFileAttrib)
        {
            // package is missing
            PostFormattedError(hInst, DownloadUI.GetCurrentWindow(), szAppTitle, IDS_NOMSI, szInstallPath);
            uiRet = ERROR_FILE_NOT_FOUND;
            goto CleanUp;
        }
    }

    //
    // good to go -- terminate our UI and let the Windows Installer take over
    //

    // retrieve the optional command line PROPERTY = VALUE strings if available
    if (ERROR_OUTOFMEMORY == (uiRet = SetupLoadResourceString(hInst, ISETUPPROPNAME_PROPERTIES, &szProperties, dwPropertiesSize)))
    {
        ReportErrorOutOfMemory(hInst, DownloadUI.GetCurrentWindow(), szAppTitle);
        uiRet = ERROR_OUTOFMEMORY;
        goto CleanUp;
    }
    else if (ERROR_SUCCESS != uiRet)
    {
        // PROPERTY=VALUE pairs not specified
        if (szProperties)
            delete [] szProperties;
        szProperties = NULL;
    }

    DownloadUI.Terminate();

    //
    // perform install
    //

    hMsi = LoadLibrary(MSI_DLL);

    if (hMsi)
    {
        pfnMsiSetInternalUI = (PFnMsiSetInternalUI)GetProcAddress(hMsi, MSIAPI_MsiSetInternalUI);
        pfnMsiInstallProduct = (PFnMsiInstallProduct)GetProcAddress(hMsi, MSIAPI_MsiInstallProduct);
        pfnMsiApplyPatch = (PFnMsiApplyPatch)GetProcAddress(hMsi, MSIAPI_MsiApplyPatch);
        pfnMsiReinstallProduct = (PFnMsiReinstallProduct)GetProcAddress(hMsi, MSIAPI_MsiReinstallProduct);
        pfnMsiQueryProductState = (PFnMsiQueryProductState)GetProcAddress(hMsi, MSIAPI_MsiQueryProductState);
        pfnMsiOpenDatabase = (PFnMsiOpenDatabase)GetProcAddress(hMsi, MSIAPI_MsiOpenDatabase);
        pfnMsiDatabaseOpenView = (PFnMsiDatabaseOpenView)GetProcAddress(hMsi, MSIAPI_MsiDatabaseOpenView);
        pfnMsiViewExecute = (PFnMsiViewExecute)GetProcAddress(hMsi, MSIAPI_MsiViewExecute);
        pfnMsiViewFetch = (PFnMsiViewFetch)GetProcAddress(hMsi, MSIAPI_MsiViewFetch);
        pfnMsiRecordGetString = (PFnMsiRecordGetString)GetProcAddress(hMsi, MSIAPI_MsiRecordGetString);
        pfnMsiCloseHandle = (PFnMsiCloseHandle)GetProcAddress(hMsi, MSIAPI_MsiCloseHandle);
    }
    if (!hMsi || !pfnMsiSetInternalUI || !pfnMsiInstallProduct || !pfnMsiApplyPatch || !pfnMsiReinstallProduct || !pfnMsiQueryProductState
        || !pfnMsiDatabaseOpenView || !pfnMsiViewExecute || !pfnMsiViewFetch || !pfnMsiRecordGetString || !pfnMsiCloseHandle)
    {
        PostError(hInst, DownloadUI.GetCurrentWindow(), szAppTitle, IDS_FAILED_TO_UPGRADE_MSI);
        uiRet = ERROR_INSTALL_FAILURE;
        goto CleanUp;
    }

    DebugMsg("[Info] Setting Internal UI level to FULL...\n");
    pfnMsiSetInternalUI(INSTALLUILEVEL_FULL, 0);

    if (!fPatch)
    {
        // performing install or reinstall/recache
        DebugMsg("[Info] Calling MsiInstallProduct with szInstallPath = %s", szInstallPath);
        DebugMsg(" and szCommandLine = %s\n", szProperties ? szProperties : "{null}");

        // default operation for a package is INSTALL

        if (fQFE)
        {
            // check to see if this product is already installed
            if (ERROR_SUCCESS == pfnMsiOpenDatabase(szMsiCacheFile ? szMsiCacheFile : szInstallPath, MSIDBOPEN_READONLY, &hDatabase)
                && ERROR_SUCCESS == pfnMsiDatabaseOpenView(hDatabase, sqlProductCode, &hView)
                && ERROR_SUCCESS == pfnMsiViewExecute(hView, 0)
                && ERROR_SUCCESS == pfnMsiViewFetch(hView, &hRec)
                && ERROR_SUCCESS == pfnMsiRecordGetString(hRec, 1, szProductCode, &dwProductCodeSize))
            {
                isProduct = pfnMsiQueryProductState(szProductCode);
                DebugMsg("[Info] MsiQueryProductState returned %d\n", isProduct);
                if (INSTALLSTATE_ADVERTISED != isProduct && INSTALLSTATE_DEFAULT != isProduct)
                {
                    // product is unknown, so this will be a first time install
                    DebugMsg("[Info] The product code '%s' is unknown. Will use first time install logic...\n", szProductCode);
                    fQFE = false;
                }
                else
                {
                    // product is known, use QFE syntax
                    DebugMsg("[Info] The product code '%s' is known. Will use QFE recache and reinstall upgrade logic...\n", szProductCode);
                }
            }
            else
            {
                // some failure occurred when processing the product code, so treat as non-QFE
                DebugMsg("[Info] Unable to process product code. Will treat as first time install...\n");
                fQFE = false;
            }
            if (hDatabase)
                pfnMsiCloseHandle(hDatabase);
            if (hView)
                pfnMsiCloseHandle(hView);
            if (hRec)
                pfnMsiCloseHandle(hRec);
        }

        //
        // Set up the properties to be passed into MSIInstallProduct
        //
        if (fQFE && !szProperties)
            cchInstProperties = lstrlen (szDefaultInstallUpdCommandLine);
        else if (szProperties)
            cchInstProperties = lstrlen (szProperties);
        if (emAdminInstall == emExecMode)
            cchInstProperties += lstrlen (szAdminInstallProperty);

        szInstProperties = new char[cchInstProperties + 1];
        if (! szInstProperties)
        {
            ReportErrorOutOfMemory(hInst, DownloadUI.GetCurrentWindow(), szAppTitle);
            uiRet = ERROR_OUTOFMEMORY;
            goto CleanUp;
        }

        if (fQFE && !szProperties)
            lstrcpy (szInstProperties, szDefaultInstallUpdCommandLine);
        else if (szProperties)
            lstrcpy (szInstProperties, szProperties);
        else
            szInstProperties[0] = '\0';
        if (emAdminInstall == emExecMode)
            lstrcat (szInstProperties, szAdminInstallProperty);

        uiRet = pfnMsiInstallProduct(szInstallPath, szInstProperties);
        if (ERROR_SUCCESS != uiRet)
        {
            // attempt to display an error message stored in msi.dll
            PostMsiError(hInst, hMsi, DownloadUI.GetCurrentWindow(), szAppTitle, uiRet);
        }

        DebugMsg("[Info] MsiInstallProduct returned %d\n", uiRet);
    }
    else
    {
        // default Operation for a patch is MINPATCH

        // if szProperties is NULL, use our default value for QFE patches
        if (!szProperties && fQFE)
        {
            DebugMsg("[Info] Patch is a MINPATCH (small or minor update patch) so using default command line '%s'\n", szDefaultMinPatchCommandLine);

            szProperties = new char[lstrlen(szDefaultMinPatchCommandLine) + 1];
            if (!szProperties)
            {
                ReportErrorOutOfMemory(hInst, DownloadUI.GetCurrentWindow(), szAppTitle);
                uiRet = ERROR_OUTOFMEMORY;
                goto CleanUp;
            }
            lstrcpy(szProperties, szDefaultMinPatchCommandLine);
        }

        if (emAdminInstall == emExecMode)
        {
            // performing a patch
            DebugMsg("[Info] Calling MsiApplyPatch with szPatchPackage = %s", szMsiCacheFile);
            DebugMsg(" and szInstallPackage = %s and eInstallType = INSTALLTYPE_NETWORK_IMAGE", szAdminImagePath);
            DebugMsg(" and szCommandLine = %s\n", szProperties ? szProperties : "{null}");

            uiRet = pfnMsiApplyPatch(szMsiCacheFile, szAdminImagePath, INSTALLTYPE_NETWORK_IMAGE, szProperties);
        }
        else
        {
            // performing a patch
            DebugMsg("[Info] Calling MsiApplyPatch with szPatchPackage = %s", szInstallPath);
            DebugMsg(" and szInstallPackage = {null} and eInstallType = INSTALLTYPE_DEFAULT");
            DebugMsg(" and szCommandLine = %s\n", szProperties ? szProperties : "{null}");

            uiRet = pfnMsiApplyPatch(szInstallPath, NULL, INSTALLTYPE_DEFAULT, szProperties);
        }
        if (ERROR_SUCCESS != uiRet)
        {
            // attempt to display an error message stored in msi.dll
            PostMsiError(hInst, hMsi, DownloadUI.GetCurrentWindow(), szAppTitle, uiRet);
        }

        DebugMsg("[Info] MsiApplyPatch returned %d\n", uiRet);
    }

CleanUp:

    if (szMsiFile)
        delete [] szMsiFile;
    if (szBaseURL)
        delete [] szBaseURL;
    if (szInstallPath)
        delete [] szInstallPath;
    if (szMsiCacheFile)
    {
        WIN::DeleteUrlCacheEntry(szMsiCacheFile);
        delete [] szMsiCacheFile;
    }
    if (szProductName)
        delete [] szProductName;
    if (szMinimumMsi)
        delete [] szMinimumMsi;
    if (szProperties)
        delete [] szProperties;
    if (szTempPath)
        delete [] szTempPath;
    if (szBase)
        delete [] szBase;
    if (szUpdate)
        delete [] szUpdate;
    if (szRegisteredMsiFolder)
        delete [] szRegisteredMsiFolder;
    if (szMsiDllLocation)
        delete [] szMsiDllLocation;

    if (hMsi)
        FreeLibrary(hMsi);

    DebugMsg("[Info] Setup exit code is %d\n", uiRet);

    if (fDelayRebootReq)
    {
        // need to reboot machine for updating Windows Installer
        WIN::LoadString(hInst, IDS_REBOOT_REQUIRED, szAction, MAX_STR_LENGTH);
        if (IDYES == MessageBox(NULL, szAction, szAppTitle, MB_YESNO|MB_ICONQUESTION))
        {
            // must first aquire system shutdown privileges on NT/Win2K
            AcquireShutdownPrivilege();
            // initiate system shutdown for reboot
            WIN::ExitWindowsEx(EWX_REBOOT, PCLEANUI | SHTDN_REASON_MAJOR_APPLICATION | SHTDN_REASON_MINOR_INSTALLATION);
        }
    }

    return uiRet;
}

Variable Documentation

const DWORD lcidLOCALE_INVARIANT = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT)

Definition at line 75 of file setup.cpp.

Generated on Wed Nov 13 2024 16:54:44 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/Msi/setup.exe/setup.h File Reference

  • SysMgmt
  • Msi
  • setup.exe
Defines | Enumerations | Functions | Variables

setup.h File Reference

#include "setupui.h"
#include <windows.h>
#include <wincrypt.h>

Go to the source code of this file.

Defines

#define | MAX_LENGTH_GUID 40
#define | MAX_STR_LENGTH 1024
#define | MINIMUM_SUPPORTED_MSI_VERSION 150

Enumerations

enum | emEnum { emPreset = 0, emHelp = 1, emVerify = 2, emAdminInstall = 3 }
enum | itvEnum { itvWintrustNotOnMachine = 0, itvTrusted = 1, itvUnTrusted = 2 }

Functions

bool | AcquireShutdownPrivilege ()
bool | AlreadyInProgress ()
void | DebugMsg (LPCSTR szFormat,...)
void | DisplayUsage (HINSTANCE hInst, HWND hwndOwner, LPCSTR szCaption)
UINT | DownloadAndUpgradeMsi (HINSTANCE hInst, CDownloadUI *piDownloadUI, LPCSTR szAppTitle, LPCSTR szBase, LPCSTR szUpdate, LPCSTR szModuleFile, ULONG ulMinVer)
DWORD | ExecuteUpgradeMsi (LPSTR szUpgradeMsi)
DWORD | ExecuteVerifyUpdate (LPCSTR szModuleFile, LPCSTR szUpdateCachePath)
DWORD | GetAdminInstallInfo (bool fPatch, LPSTR lpszCmdLine, LPCSTR *ppszAdminImagePath)
emEnum | GetExecutionMode (LPCSTR lpszCmdLine)
DWORD | GetFileVersionNumber (LPSTR szFilename, DWORD *pdwMSVer, DWORD *pdwLSVer)
DWORD | GetNextArgument (LPCSTR pszCmdLine, LPCSTR *ppszArgStart, LPCSTR *ppszArgEnd, bool *pfQuoted)
bool | IsAdmin ()
itvEnum | IsFileTrusted (LPCWSTR szwFile, HWND hwndParent, DWORD dwUIChoice, bool *pfIsSigned, PCCERT_CONTEXT *ppcSigner)
bool | IsMsiUpgradeNecessary (ULONG ulReqMsiMinVer)
bool | IsOSSupported ()
itvEnum | IsPackageTrusted (LPCSTR szSetupEXE, LPCSTR szPackage, HWND hwndParent)
bool | IsUpdateRequiredVersion (LPSTR szFilename, ULONG ulMinVer)
void | PostError (HINSTANCE hInst, HWND hwndOwner, LPCSTR szTitle, UINT uiErrorId, LPCSTR szValue, int iValue)
void | PostError (HINSTANCE hInst, HWND hwndOwner, LPCSTR szTitle, UINT uiErrorId, int iValue)
void | PostError (HINSTANCE hInst, HWND hwndOwner, LPCSTR szTitle, UINT uiErrorId)
void | PostError (HINSTANCE hInst, HWND hwndOwner, LPCSTR szTitle, UINT uiErrorId, LPCSTR szValue)
void | PostFormattedError (HINSTANCE hInst, HWND hwndOwner, LPCSTR szTitle, UINT uiErrorId, LPCSTR szValue)
void | PostMsiError (HINSTANCE hInst, HINSTANCE hMsi, HWND hwndOwner, LPCSTR szTitle, UINT uiErrorId)
void | PostResourceNotFoundError (HINSTANCE hInst, HWND hwndOwner, LPCSTR szTitle, LPCSTR szName)
void | ReportErrorOutOfMemory (HINSTANCE hInst, HWND hwndOwner, LPCSTR szCaption)
void | ReportUserCancelled (HINSTANCE hInst, HWND hwndOwner, LPCSTR szTitle)
UINT | UpgradeMsi (HINSTANCE hInst, CDownloadUI *piDownloadUI, LPCSTR szAppTitle, LPCSTR szUpgdLocation, LPCSTR szUpgrade, ULONG ulMinVer)
UINT | ValidateUpdate (HINSTANCE hInst, CDownloadUI *piDownloadUI, LPCSTR szAppTitle, LPSTR szUpdatePath, LPCSTR szModuleFile, ULONG ulMinVer)
DWORD | VerifyFileSignature (LPCSTR lpszModule, LPSTR lpszCmdLine)
DWORD | WaitForProcess (HANDLE handle)

Variables

const char | sqlProductCode [] = "SELECT `Value` FROM `Property` WHERE `Property`='ProductCode'"
const char | szAdminInstallProperty [] = " ACTION=ADMIN"
const char | szDebugEnvVar [] = "_MSI_WEB_BOOTSTRAP_DEBUG"
const char | szDefaultInstallUpdCommandLine [] = "REINSTALL=ALL REINSTALLMODE=vomus"
const char | szDefaultMinPatchCommandLine [] = "REINSTALL=ALL REINSTALLMODE=omus"
const char | szDefaultOperation [] = "DEFAULT"
const char | szDelayReboot [] = " /norestart"
const char | szDelayRebootQuiet [] = " /quiet /norestart"
const char | szInstallOperation [] = "INSTALL"
const char | szInstallUpdOperation [] = "INSTALLUPD"
const char | szMajPatchOperation [] = "MAJPATCH"
const char | szMinPatchOperation [] = "MINPATCH"
const char | szPathSep [] = "\\"
const char | szUrlPathSep [] = "/"

Define Documentation

#define MAX_LENGTH_GUID 40

Definition at line 24 of file setup.h.

#define MAX_STR_LENGTH 1024

Definition at line 22 of file setup.h.

#define MINIMUM_SUPPORTED_MSI_VERSION 150

Definition at line 23 of file setup.h.

Enumeration Type Documentation

enum emEnum
Enumerator:
emPreset
emHelp
emVerify
emAdminInstall

Definition at line 54 of file setup.h.

{
    emPreset = 0,
    emHelp = 1,
    emVerify = 2,
    emAdminInstall = 3
};

enum itvEnum
Enumerator:
itvWintrustNotOnMachine
itvTrusted
itvUnTrusted

Definition at line 46 of file setup.h.

{
    itvWintrustNotOnMachine = 0,
    itvTrusted = 1,
    itvUnTrusted = 2
};

Function Documentation

bool AcquireShutdownPrivilege ( )

Definition at line 673 of file utils.cpp.

{
    HANDLE hToken = 0;
    TOKEN_PRIVILEGES tkp;

    HMODULE hAdvapi32 = LoadLibrary(ADVAPI32_DLL);
    if (!hAdvapi32)
        return false;

    PFnOpenProcessToken pfnOpenProcessToken = (PFnOpenProcessToken)GetProcAddress(hAdvapi32, ADVAPI32API_OpenProcessToken);
    PFnLookupPrivilegeValue pfnLookupPrivilegeValue = (PFnLookupPrivilegeValue)GetProcAddress(hAdvapi32, ADVAPI32API_LookupPrivilegeValue);
    PFnAdjustTokenPrivileges pfnAdjustTokenPrivileges = (PFnAdjustTokenPrivileges)GetProcAddress(hAdvapi32, ADVAPI32API_AdjustTokenPrivileges);
    if (!pfnOpenProcessToken || !pfnLookupPrivilegeValue || !pfnAdjustTokenPrivileges)
    {
        FreeLibrary(hAdvapi32);
        return false;
    }

    // grab this process's token
    if (!pfnOpenProcessToken(WIN::GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))
    {
        FreeLibrary(hAdvapi32);
        return false;
    }

    // get the LUID for the shutdown privilege
    pfnLookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &tkp.Privileges[0].Luid);

    tkp.PrivilegeCount = 1; // one privilege to set
    tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;

    // get the shutdown privilege for this process
    pfnAdjustTokenPrivileges(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES)NULL, 0);

    // cannot test return value of AdjustTokenPrivileges
    if (ERROR_SUCCESS != WIN::GetLastError())
    {
        FreeLibrary(hAdvapi32);
        return false;
    }

    FreeLibrary(hAdvapi32);

    return true;
}

bool AlreadyInProgress ( )

Definition at line 451 of file utils.cpp.

{
    const char *szMutexName = "Global\\_MSISETUP_{2956EBA1-9B5A-4679-8618-357136DA66CA}";
    HANDLE hMutex = 0;

    hMutex = WIN::CreateMutex(NULL /*default security descriptor*/, FALSE, szMutexName);
    if (!hMutex || ERROR_ALREADY_EXISTS == GetLastError())
        return true;

    return false;
}

void DebugMsg | ( | LPCSTR | szFormat,
 |  |  | ...
 | ) |  |

Definition at line 745 of file utils.cpp.

{
    if (-1 == g_dmDiagnosticMode)
    {
        SetDiagnosticMode();
    }

    if (0 == g_dmDiagnosticMode)
        return; // debug output is not enabled

    size_t dwBuf = 512;
    char *szDebug = new char[dwBuf];
    if (!szDebug)
        return ; // out of memory

    // store the result debug string
    va_list listDebugArg;
    va_start(listDebugArg, szFormat);
    while (-1 == _vsnprintf(szDebug, dwBuf, szFormat, listDebugArg))
    {
        dwBuf *= 2;
        delete[] szDebug;
        szDebug = new char[dwBuf];
        if (!szDebug)
        {
            va_end(listDebugArg);
            return; // out of memory
        }
    }
    va_end(listDebugArg);

    OutputDebugString(szDebug);
}

void DisplayUsage | ( | HINSTANCE | hInst,
 |  | HWND | hwndOwner,
 |  | LPCSTR | szCaption
 | ) |  |

Definition at line 466 of file utils.cpp.

{
    char szMessage[MAX_STR_LENGTH];

    WIN::LoadString(hInst, IDS_USAGE, szMessage, sizeof(szMessage)/sizeof(char));
    WIN::MessageBox(hwndOwner, szMessage, szCaption, MB_OK | MB_ICONINFORMATION);
}

UINT DownloadAndUpgradeMsi | ( | HINSTANCE | hInst,
 |  | CDownloadUI * | piDownloadUI,
 |  | LPCSTR | szAppTitle,
 |  | LPCSTR | szBase,
 |  | LPCSTR | szUpdate,
 |  | LPCSTR | szModuleFile,
 |  | ULONG | ulMinVer
 | ) |  |

Definition at line 196 of file upgrdmsi.cpp.

{
    char *szTempPath         = 0;
    char *szUpdatePath       = 0;
    char *szUpdateCacheFile  = 0;
    const char *pch          = 0;

    DWORD cchTempPath         = 0;
    DWORD cchUpdatePath       = 0;
    DWORD cchUpdateCacheFile  = 0;
    DWORD dwLastError         = 0;
    UINT  uiRet               = 0;
    HRESULT hr                = 0;
    DWORD Status              = ERROR_SUCCESS;

    char szDebugOutput[MAX_STR_LENGTH] = {0};
    char szText[MAX_STR_CAPTION]       = {0};

    // generate the path to the update == UPDATELOCATION + szUpdate
    //   note: szUpdate is a relative path
    cchTempPath = lstrlen(szUpdateLocation) + lstrlen(szUpdate) + 2; // 1 for slash, 1 for null
    szTempPath = new char[cchTempPath];
    if (!szTempPath)
    {
        ReportErrorOutOfMemory(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle);
        uiRet = ERROR_OUTOFMEMORY;
        goto CleanUp;
    }
    memset((void*)szTempPath, 0x0, cchTempPath*sizeof(char));
    hr = StringCchCopy(szTempPath, cchTempPath, szUpdateLocation);
    if (FAILED(hr))
    {
        uiRet = HRESULT_CODE(hr);
        PostFormattedError(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle, IDS_INVALID_PATH, szTempPath);
        goto CleanUp;
    }

    // check for trailing slash on szUpdateLocation
    pch = szUpdateLocation + lstrlen(szUpdateLocation) + 1; // put at null terminator
    pch = CharPrev(szUpdateLocation, pch);
    if (*pch != '/')
    {
        hr = StringCchCat(szTempPath, cchTempPath, szUrlPathSep);
        if (FAILED(hr))
        {
            uiRet = HRESULT_CODE(hr);
            PostFormattedError(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle, IDS_INVALID_PATH, szTempPath);
            goto CleanUp;
        }
    }

    hr = StringCchCat(szTempPath, cchTempPath, szUpdate);
    if (FAILED(hr))
    {
        uiRet = HRESULT_CODE(hr);
        PostFormattedError(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle, IDS_INVALID_PATH, szTempPath);
        goto CleanUp;
    }

    // canonicalize the URL path
    cchUpdatePath = cchTempPath*2;
    szUpdatePath = new char[cchUpdatePath];
    if (!szUpdatePath)
    {
        ReportErrorOutOfMemory(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle);
        uiRet = ERROR_OUTOFMEMORY;
        goto CleanUp;
    }

    if (!InternetCanonicalizeUrl(szTempPath, szUpdatePath, &cchUpdatePath, 0))
    {
        dwLastError = GetLastError();
        if (ERROR_INSUFFICIENT_BUFFER == dwLastError)
        {
            // try again
            delete [] szUpdatePath;
            szUpdatePath = new char[cchUpdatePath];
            if (!szUpdatePath)
            {
                ReportErrorOutOfMemory(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle);
                uiRet = ERROR_OUTOFMEMORY;
                goto CleanUp;
            }
            dwLastError = 0; // reset to success for 2nd attempt
            if (!InternetCanonicalizeUrl(szTempPath, szUpdatePath, &cchUpdatePath, 0))
                dwLastError = GetLastError();
        }
    }
    if (0 != dwLastError)
    {
        // error -- invalid path/Url
        PostFormattedError(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle, IDS_INVALID_PATH, szTempPath);
        uiRet = dwLastError;
        goto CleanUp;
    }

    DebugMsg("[Info] Downloading update package from --> %s\n", szUpdatePath);

    // set action text for download
    WIN::LoadString(hInst, IDS_DOWNLOADING_UPDATE, szText, MAX_STR_CAPTION);
    if (irmCancel == piDownloadUI->SetActionText(szText))
    {
        ReportUserCancelled(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle);
        uiRet = ERROR_INSTALL_USEREXIT;
        goto CleanUp;
    }

    // download the Update file so we can run it -- must be local to execute
    szUpdateCacheFile = new char[MAX_PATH];
    cchUpdateCacheFile = MAX_PATH;
    if (!szUpdateCacheFile)
    {
        ReportErrorOutOfMemory(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle);
        uiRet = ERROR_OUTOFMEMORY;
        goto CleanUp;
    }

    hr = WIN::URLDownloadToCacheFile(NULL, szUpdatePath, szUpdateCacheFile, cchUpdateCacheFile, 0, /* IBindStatusCallback = */ &CDownloadBindStatusCallback(piDownloadUI));
    if (piDownloadUI->HasUserCanceled())
    {
        ReportUserCancelled(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle);
        uiRet = ERROR_INSTALL_USEREXIT;
        goto CleanUp;
    }
    if (FAILED(hr))
    {
        // error during download -- probably because file not found (or lost connection)
        PostFormattedError(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle, IDS_NOUPDATE, szUpdatePath);
        uiRet = ERROR_FILE_NOT_FOUND;
        goto CleanUp;
    }

    //
    // Perform trust check on MSI. Note, this must be done in a separate process.
    // This is because MSI 2.0 and higher register sip callbacks for verifying
    // digital signatures on msi files. At this point, it is quite likely that
    // the SIP callbacks have not been registered. So we don't want to load
    // wintrust.dll into this process's image yet, otherwise it will remain unaware
    // of the sip callbacks registered by WindowsInstaller-KB884016-x86.exe and will
    // fail later when it tries to verify the signature on the msi file downloaded
    // from the web.
    //
    Status = ExecuteVerifyUpdate(szModuleFile, szUpdateCacheFile);
    if (TRUST_E_PROVIDER_UNKNOWN == Status)
    {
        PostError(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle, IDS_NO_WINTRUST);
        uiRet = ERROR_CALL_NOT_IMPLEMENTED;
        goto CleanUp;
    }
    else if (ERROR_SUCCESS != Status)
    {
        PostFormattedError(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle, IDS_UNTRUSTED, szUpdateCacheFile);
        uiRet = HRESULT_CODE(TRUST_E_SUBJECT_NOT_TRUSTED);
        goto CleanUp;
    }

    // continue other validations
    uiRet = ValidateUpdate(hInst, piDownloadUI, szAppTitle, szUpdateCacheFile, szModuleFile, ulMinVer);

CleanUp:
    if (szTempPath)
        delete [] szTempPath;
    if (szUpdatePath)
        delete [] szUpdatePath;
    if (szUpdateCacheFile)
    {
        WIN::DeleteUrlCacheEntry(szUpdateCacheFile);
        delete [] szUpdateCacheFile;
    }

    return uiRet;
}

DWORD ExecuteUpgradeMsi ( LPSTR szUpgradeMsi )

Definition at line 450 of file upgrdmsi.cpp.

{
    DebugMsg("[Info] Running update package from --> %s\n", szUpgradeMsi);

    DWORD dwResult = 0;

    // build up CreateProcess structures
    STARTUPINFO          sui;
    PROCESS_INFORMATION  pi;

    memset((void*)&pi, 0x00, sizeof(PROCESS_INFORMATION));
    memset((void*)&sui, 0x00, sizeof(STARTUPINFO));
    sui.cb          = sizeof(STARTUPINFO);
    sui.dwFlags     = STARTF_USESHOWWINDOW;
    sui.wShowWindow = SW_SHOW;

    //
    // build command line and specify delayreboot option to Update
    //  three acounts for terminating null plus quotes for module
    DWORD cchCommandLine = lstrlen(szUpgradeMsi) + lstrlen(szDelayReboot) + 3;
    char *szCommandLine = new char[cchCommandLine];

    if (!szCommandLine)
        return ERROR_OUTOFMEMORY;

    if (FAILED(StringCchCopy(szCommandLine, cchCommandLine, "\""))
        || FAILED(StringCchCat(szCommandLine, cchCommandLine, szUpgradeMsi))
        || FAILED(StringCchCat(szCommandLine, cchCommandLine, "\""))
        || FAILED(StringCchCat(szCommandLine, cchCommandLine, szDelayReboot)))
    {
        delete [] szCommandLine;
        return ERROR_INSTALL_FAILURE;
    }

    //
    // run update process
    if(!WIN::CreateProcess(NULL, szCommandLine, NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE, NULL, NULL, &sui, &pi))
    {
        // failed to launch.
        dwResult = GetLastError();
        delete [] szCommandLine;
        return dwResult;
    }

    dwResult = WaitForProcess(pi.hProcess);
    if(ERROR_SUCCESS != dwResult)
    {
        delete [] szCommandLine;
        return dwResult;
    }

    DWORD dwExitCode = 0;
    WIN::GetExitCodeProcess(pi.hProcess, &dwExitCode);

    WIN::CloseHandle(pi.hProcess);

    delete [] szCommandLine;

    return dwExitCode;
}

DWORD ExecuteVerifyUpdate | ( | LPCSTR | szModuleFile,
 |  | LPCSTR | szUpdateCachePath
 | ) |  |

Definition at line 514 of file upgrdmsi.cpp.

{
    DWORD dwResult = 0;

    // build up CreateProcess structures
    STARTUPINFO          sui;
    PROCESS_INFORMATION  pi;

    memset((void*)&pi, 0x00, sizeof(PROCESS_INFORMATION));
    memset((void*)&sui, 0x00, sizeof(STARTUPINFO));
    sui.cb          = sizeof(STARTUPINFO);
    sui.dwFlags     = STARTF_USESHOWWINDOW;
    sui.wShowWindow = SW_SHOW;

    //
    // Build command line and specify delayreboot option to Update
    // The nine extra characters are required for the following:
    //      2 for the quotes enclosing the module path
    //      2 for /v
    //      2 for the spaces before and after /v
    //      2 for the quotes enclosing the Update path
    //      1 for the terminating null.
    //
    DWORD cchCommandLine = lstrlen(szModuleFile) + lstrlen(szUpdateCachePath) + 9;
    char *szCommandLine = new char[cchCommandLine];

    if (!szCommandLine)
        return ERROR_OUTOFMEMORY;

    if (FAILED(StringCchCopy(szCommandLine, cchCommandLine, "\""))
        || FAILED(StringCchCat(szCommandLine, cchCommandLine, szModuleFile))
        || FAILED(StringCchCat(szCommandLine, cchCommandLine, "\""))
        || FAILED(StringCchCat(szCommandLine, cchCommandLine, " /v \""))
        || FAILED(StringCchCat(szCommandLine, cchCommandLine, szUpdateCachePath))
        || FAILED(StringCchCat(szCommandLine, cchCommandLine, "\"")))
    {
        delete [] szCommandLine;
        return ERROR_INSTALL_FAILURE;
    }

    //
    // Run the verification process. We use a copy of ourselves to do this.
    //
    if(!WIN::CreateProcess(NULL, szCommandLine, NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE, NULL, NULL, &sui, &pi))
    {
        // failed to launch.
        delete [] szCommandLine;
        dwResult = GetLastError();
        return dwResult;
    }

    dwResult = WaitForProcess(pi.hProcess);
    if(ERROR_SUCCESS != dwResult)
    {
        delete [] szCommandLine;
        return dwResult;
    }

    DWORD dwExitCode = 0;
    WIN::GetExitCodeProcess(pi.hProcess, &dwExitCode);

    WIN::CloseHandle(pi.hProcess);

    DebugMsg("[Info] Verification of Update returned %d\n", dwExitCode);

    delete [] szCommandLine;

    return dwExitCode;
}

DWORD GetAdminInstallInfo | ( | bool | fPatch,
 |  | LPSTR | lpszCmdLine,
 |  | LPCSTR * | ppszAdminImagePath
 | ) |  |

Definition at line 177 of file utils.cpp.

{
    LPCSTR  pszFirstArgEnd;
    LPCSTR  pszFileName;
    LPCSTR  pszEnd;
    DWORD   Status;

    //
    // When this function is called, the first argument has already been
    // verified. So skip the first argument.
    //
    GetNextArgument (lpszCmdLine, NULL, &pszFirstArgEnd, NULL);

    // See if there is another argument
    Status = GetNextArgument (CharNextA(pszFirstArgEnd), &pszFileName, &pszEnd, NULL);

    // If it is not a patch, there should not be any more arguments.
    if (!fPatch)
    {
        if (ERROR_NO_MORE_ITEMS != Status)
            return ERROR_BAD_ARGUMENTS;

        // If we are here, then we are done, because we have all the information we need.
        if (ppszAdminImagePath)
            *ppszAdminImagePath = NULL;
        return ERROR_SUCCESS;
    }

    // If we are here, this is a patch. Get the path to the admin. install.
    if (ERROR_NO_MORE_ITEMS == Status)
        return ERROR_BAD_ARGUMENTS;     // No path was supplied.

    // Should not have any more arguments.
    if ('\0' != *(CharNextA(pszEnd)) &&
        ERROR_NO_MORE_ITEMS != GetNextArgument (CharNextA(CharNextA(pszEnd)), NULL, NULL, NULL))
    {
        return ERROR_BAD_ARGUMENTS;
    }

    // We have the right arguments. Null terminate the pathname.
    *(CharNextA(pszEnd)) = '\0';

    if (ppszAdminImagePath)
        *ppszAdminImagePath = pszFileName;

    return ERROR_SUCCESS;
}

emEnum GetExecutionMode ( LPCSTR lpszCmdLine )

Definition at line 72 of file utils.cpp.

{
    LPCSTR  pszStart = NULL;
    LPCSTR  pszEnd = NULL;
    DWORD   dwStatus = ERROR_SUCCESS;
    bool    fQuoted = false;
    //
    // Check the first argument and set the execution mode accordingly.
    // When run without arguments, it is assumed that the default install
    // preset by the package publisher needs to be performed.
    //
    // In case an invalid option is provided, the help dialog describing the
    // usage must be displayed.
    //
    dwStatus = GetNextArgument (lpszCmdLine, &pszStart, &pszEnd, &fQuoted);

    if (ERROR_NO_MORE_ITEMS == dwStatus)
        return emPreset;

    // The only allowed values in the first argument are /a, /v and /?
    if (pszEnd != CharNextA(pszStart) || fQuoted)
        return emHelp;

    if ('/' != (*pszStart) && '-' != (*pszStart))
        return emHelp;

    switch (*pszEnd)
    {
    case 'a':
    case 'A':
        return emAdminInstall;
    case 'v':
    case 'V':
        return emVerify;
    default:
        return emHelp;
    }
}

DWORD GetFileVersionNumber | ( | LPSTR | szFilename,
 |  | DWORD * | pdwMSVer,
 |  | DWORD * | pdwLSVer
 | ) |  |

Definition at line 491 of file utils.cpp.

{
    DWORD             dwResult = NOERROR;
    unsigned          uiSize;
    DWORD             dwVerInfoSize;
    DWORD             dwHandle;
    BYTE              *prgbVersionInfo = NULL;
    VS_FIXEDFILEINFO  *lpVSFixedFileInfo = NULL;

    DWORD dwMSVer = 0xffffffff;
    DWORD dwLSVer = 0xffffffff;

    dwVerInfoSize = GetFileVersionInfoSize(szFilename, &dwHandle);
    if (0 != dwVerInfoSize)
    {
        prgbVersionInfo = (LPBYTE) WIN::GlobalAlloc(GPTR, dwVerInfoSize);
        if (NULL == prgbVersionInfo)
        {
            dwResult = ERROR_NOT_ENOUGH_MEMORY;
            goto Finish;
        }

        // Read version stamping info
        if (GetFileVersionInfo(szFilename, dwHandle, dwVerInfoSize, prgbVersionInfo))
        {
            // get the value for Translation
            if (VerQueryValue(prgbVersionInfo, "\\", (LPVOID*)&lpVSFixedFileInfo, &uiSize) && (uiSize != 0))
            {
                dwMSVer = lpVSFixedFileInfo->dwFileVersionMS;
                dwLSVer = lpVSFixedFileInfo->dwFileVersionLS;
            }
        }
        else
        {
            dwResult = GetLastError();
            goto Finish;
        }
    }
    else
    {
        dwResult = GetLastError();
    }

#ifdef DEBUG
    char szVersion[255];
    StringCchPrintf(szVersion, sizeof(szVersion), "%s is version %d.%d.%d.%d\n", szFilename, HIWORD(dwMSVer), LOWORD(dwMSVer), HIWORD(dwLSVer), LOWORD(dwLSVer));
    DebugMsg("[INFO] %s", szVersion);
#endif // DEBUG

Finish:
    if (NULL != prgbVersionInfo)
        WIN::GlobalFree(prgbVersionInfo);
    if (pdwMSVer)
        *pdwMSVer = dwMSVer;
    if (pdwLSVer)
        *pdwLSVer = dwLSVer;

    return dwResult;
}

DWORD GetNextArgument | ( | LPCSTR | pszCmdLine,
 |  | LPCSTR * | ppszArgStart,
 |  | LPCSTR * | ppszArgEnd,
 |  | bool * | pfQuoted
 | ) |  |

Definition at line 114 of file utils.cpp.

{
    bool    fInQuotes = false;
    bool    fFoundArgEnd = false;
    LPCSTR  pszChar = pszCmdLine;
    LPCSTR  pszFirst = NULL;
    LPCSTR  pszLast = NULL;

    if (NULL == pszChar)
        return ERROR_NO_MORE_ITEMS;

    // Skip leading spaces.
    while (' ' == *pszChar || '\t' == *pszChar)
        pszChar = CharNextA(pszChar);

    // Check if we have run out of arguments.
    if ('\0' == (*pszChar))
        return ERROR_NO_MORE_ITEMS;

    // Check if we this argument has been enclosed in quotes
    if ('\"' == (*pszChar))
    {
        fInQuotes = true;
        pszChar = CharNextA (pszChar);
    }

    pszFirst = pszChar;

    // Now look for the end of the argument
    while (! fFoundArgEnd)
    {
        pszChar = CharNextA(pszChar);

        if ('\0' == (*pszChar))
            fFoundArgEnd = true;

        if (fInQuotes && '\"' == (*pszChar))
            fFoundArgEnd = true;

        if (!fInQuotes && ' ' == (*pszChar))
            fFoundArgEnd = true;

        if (!fInQuotes && '\t' == (*pszChar))
            fFoundArgEnd = true;
    }

    pszLast = CharPrevA (pszFirst, pszChar);

    if (ppszArgStart)
        *ppszArgStart = pszFirst;

    if (ppszArgEnd)
        *ppszArgEnd = pszLast;

    if (pfQuoted)
        *pfQuoted = fInQuotes;

    return ERROR_SUCCESS;
}

bool IsAdmin ( )

Definition at line 635 of file utils.cpp.

{
    // get the administrator sid
    PSID psidAdministrators;
    SID_IDENTIFIER_AUTHORITY siaNtAuthority = SECURITY_NT_AUTHORITY;
    if(!AllocateAndInitializeSid(&siaNtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &psidAdministrators))
        return false;

    // on NT5, use the CheckTokenMembershipAPI to correctly handle cases where
    // the Adiminstrators group might be disabled. bIsAdmin is BOOL for
    BOOL bIsAdmin = FALSE;
    // CheckTokenMembership checks if the SID is enabled in the token. NULL for
    // the token means the token of the current thread. Disabled groups, restricted
    // SIDS, and SE_GROUP_USE_FOR_DENY_ONLY are all considered. If the function
    // returns false, ignore the result.

    HMODULE hAdvapi32 = LoadLibrary(ADVAPI32_DLL);
    if (!hAdvapi32)
        bIsAdmin = FALSE;
    else
    {
        PFnCheckTokenMembership pfnCheckTokenMembership = (PFnCheckTokenMembership)GetProcAddress(hAdvapi32, ADVAPI32API_CheckTokenMembership);
        if (!pfnCheckTokenMembership || !pfnCheckTokenMembership(NULL, psidAdministrators, &bIsAdmin))
            bIsAdmin = FALSE;
    }
    FreeLibrary(hAdvapi32);
    hAdvapi32 = 0;

    WIN::FreeSid(psidAdministrators);
    return bIsAdmin ? true : false;

}

itvEnum IsFileTrusted | ( | LPCWSTR | szwFile,
 |  | HWND | hwndParent,
 |  | DWORD | dwUIChoice,
 |  | bool * | pfIsSigned,
 |  | PCCERT_CONTEXT * | ppcSigner
 | ) |  |

Definition at line 62 of file vertrust.cpp.

{
    char szDebugOutput[MAX_STR_LENGTH] = {0};

    itvEnum itv = itvUnTrusted;

    if (pfIsSigned)
        *pfIsSigned = false;
    if (ppcSigner)
        *ppcSigner  = 0;

    GUID guidAction = WINTRUST_ACTION_GENERIC_VERIFY_V2;

    WINTRUST_FILE_INFO sWintrustFileInfo;
    WINTRUST_DATA      sWintrustData;
    HRESULT            hr;

    memset((void*)&sWintrustFileInfo, 0x00, sizeof(WINTRUST_FILE_INFO)); // zero out
    memset((void*)&sWintrustData, 0x00, sizeof(WINTRUST_DATA)); // zero out

    sWintrustFileInfo.cbStruct = sizeof(WINTRUST_FILE_INFO);
    sWintrustFileInfo.pcwszFilePath = lpwFile;
    sWintrustFileInfo.hFile = NULL;

    sWintrustData.cbStruct            = sizeof(WINTRUST_DATA);
    sWintrustData.dwUIChoice          = dwUIChoice;
    sWintrustData.fdwRevocationChecks = WTD_REVOKE_NONE;
    sWintrustData.dwUnionChoice       = WTD_CHOICE_FILE;
    sWintrustData.pFile               = &sWintrustFileInfo;
    sWintrustData.dwStateAction       = (ppcSigner) ? WTD_STATEACTION_VERIFY : 0;

    HMODULE hWinTrust = LoadLibrary(WINTRUST_DLL);
    if (!hWinTrust)
    {
        // WinTrust is unavailable on the machine
        return itvWintrustNotOnMachine;
    }
    PFnWinVerifyTrust pfnWinVerifyTrust = (PFnWinVerifyTrust)GetProcAddress(hWinTrust, WINTRUSTAPI_WinVerifyTrust);
    PFnWTHelperProvDataFromStateData pfnWTHelperProvDataFromStateData= (PFnWTHelperProvDataFromStateData)GetProcAddress(hWinTrust, WINTRUSTAPI_WTHelperProvDataFromStateData);
    PFnWTHelperGetProvSignerFromChain pfnWTHelperGetProvSignerFromChain = (PFnWTHelperGetProvSignerFromChain)GetProcAddress(hWinTrust, WINTRUSTAPI_WTHelperGetProvSignerFromChain);
    PFnWTHelperGetProvCertFromChain pfnWTHelperGetProvCertFromChain = (PFnWTHelperGetProvCertFromChain)GetProcAddress(hWinTrust, WINTRUSTAPI_WTHelperGetProvCertFromChain);
    if (!pfnWinVerifyTrust || !pfnWTHelperProvDataFromStateData || !pfnWTHelperGetProvSignerFromChain || !pfnWTHelperGetProvCertFromChain)
    {
        // WinTrust is unavailable on the machine
        FreeLibrary(hWinTrust);
        return itvWintrustNotOnMachine;
    }

    hr = pfnWinVerifyTrust(/* UI Window Handle */ (dwUIChoice == WTD_UI_NONE) ? (HWND)INVALID_HANDLE_VALUE : hwndParent, &guidAction, &sWintrustData);
    DebugMsg("[WVT] WVT returned 0x%X\n", hr);

    itv = (TRUST_E_PROVIDER_UNKNOWN == hr) ? itvWintrustNotOnMachine : ((S_OK == hr) ? itvTrusted : itvUnTrusted);

    if (itvWintrustNotOnMachine == itv)
    {
        // release state data
        sWintrustData.dwUIChoice = WTD_UI_NONE;
        sWintrustData.dwStateAction = WTD_STATEACTION_CLOSE;
        pfnWinVerifyTrust((HWND)INVALID_HANDLE_VALUE, &guidAction, &sWintrustData);

        FreeLibrary(hWinTrust);
        return itv; // return immediately
    }

    if (pfIsSigned)
        *pfIsSigned = (TRUST_E_NOSIGNATURE == hr) ? false : true;

    if (TRUST_E_NOSIGNATURE == hr)
    {
        // release state data
        sWintrustData.dwUIChoice = WTD_UI_NONE;
        sWintrustData.dwStateAction = WTD_STATEACTION_CLOSE;
        pfnWinVerifyTrust((HWND)INVALID_HANDLE_VALUE, &guidAction, &sWintrustData);

        FreeLibrary(hWinTrust);
        return itv;
    }

    if (ppcSigner)
    {
        CRYPT_PROVIDER_DATA const *psProvData     = NULL;
        CRYPT_PROVIDER_SGNR       *psProvSigner   = NULL;
        CRYPT_PROVIDER_CERT       *psProvCert     = NULL;

        // grab the provider data
        psProvData = pfnWTHelperProvDataFromStateData(sWintrustData.hWVTStateData);
        if (psProvData)
        {
            // grab the signer data from the CRYPT_PROV_DATA
            psProvSigner = pfnWTHelperGetProvSignerFromChain((PCRYPT_PROVIDER_DATA)psProvData, 0 /*first signer*/, FALSE /* not a counter signer */, 0);
            if (psProvSigner)
            {
                // grab the signer cert from CRYPT_PROV_SGNR (pos 0 = signer cert; pos csCertChain-1 = root cert)
                psProvCert = pfnWTHelperGetProvCertFromChain(psProvSigner, 0);
            }
        }

        if (!psProvCert)
        {
            // some failure in obtaining the signer cert data
            *ppcSigner = 0;
        }
        else
        {
            // duplicate the cert
            HMODULE hCrypt32 = LoadLibrary(CRYPT32_DLL);
            if (hCrypt32)
            {
                PFnCertDuplicateCertificateContext pfnCertDuplicateCertificateContext = (PFnCertDuplicateCertificateContext)GetProcAddress(hCrypt32, CRYPTOAPI_CertDuplicateCertificateContext);
                if (pfnCertDuplicateCertificateContext)
                    *ppcSigner = pfnCertDuplicateCertificateContext(psProvCert->pCert);
                FreeLibrary(hCrypt32);
            }
        }

        // release state data
        sWintrustData.dwUIChoice = WTD_UI_NONE;
        sWintrustData.dwStateAction = WTD_STATEACTION_CLOSE;
        pfnWinVerifyTrust((HWND)INVALID_HANDLE_VALUE, &guidAction, &sWintrustData);
    }

    FreeLibrary(hWinTrust);
    return itv;
}

bool IsMsiUpgradeNecessary ( ULONG ulReqMsiMinVer )

Definition at line 29 of file upgrdmsi.cpp.

{
    // attempt to load msi.dll in the system directory

    char szSysMsiDll[MAX_PATH] = {0};
    char szSystemFolder[MAX_PATH] = {0};

    DWORD dwRet = WIN::GetSystemDirectory(szSystemFolder, MAX_PATH);
    if (0 == dwRet || MAX_PATH < dwRet)
    {
        // failure or buffer too small; assume upgrade is necessary
        DebugMsg("[Info] Can't obtain system directory; assuming upgrade is necessary");
        return true;
    }

    if (FAILED(StringCchCopy(szSysMsiDll, sizeof(szSysMsiDll)/sizeof(szSysMsiDll[0]), szSystemFolder))
        || FAILED(StringCchCat(szSysMsiDll, sizeof(szSysMsiDll)/sizeof(szSysMsiDll[0]), "\\MSI.DLL")))
    {
        // failure to get path to msi.dll; assume upgrade is necessary
        DebugMsg("[Info] Can't obtain msi.dll path; assuming upgrade is necessary");
        return true;
    }

    HINSTANCE hinstMsiSys = LoadLibrary(szSysMsiDll);
    if (0 == hinstMsiSys)
    {
        // can't load msi.dll; assume upgrade is necessary
        DebugMsg("[Info] Can't load msi.dll; assuming upgrade is necessary");

        return true;
    }
    FreeLibrary(hinstMsiSys);

    // get version on msi.dll
    DWORD dwInstalledMSVer;
    dwRet = GetFileVersionNumber(szSysMsiDll, &dwInstalledMSVer, NULL);
    if (ERROR_SUCCESS != dwRet)
    {
        // can't obtain version information; assume upgrade is necessary
        DebugMsg("[Info] Can't obtain version information; assuming upgrade is necessary");

        return true;
    }

    // compare version in system to the required minimum
    ULONG ulInstalledVer = HIWORD(dwInstalledMSVer) * 100 + LOWORD(dwInstalledMSVer);
    if (ulInstalledVer < ulReqMsiMinVer)
    {
        // upgrade is necessary
        DebugMsg("[Info] Windows Installer upgrade is required.  System Version = %d, Minimum Version = %d.\n", ulInstalledVer, ulReqMsiMinVer);

        return true;
    }

    // no upgrade is necessary
    DebugMsg("[Info] No upgrade is necessary.  System version meets minimum requirements\n");
    return false;
}

bool IsOSSupported ( )

Definition at line 587 of file utils.cpp.

{
    OSVERSIONINFO sInfoOS;
    memset((void*)&sInfoOS, 0x00, sizeof(OSVERSIONINFO));

    sInfoOS.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
    WIN::GetVersionEx(&sInfoOS);

    // We do no support any platform prior to Windows 2000
    if (5 > sInfoOS.dwMajorVersion)
        return false;

    // We support:
    if(MimimumWindowsPlatform(5, 2, 0) ||   // Windows 2003 and above
       MimimumWindowsPlatform(5, 1, 0) ||   // Windows XP and above
       MimimumWindowsPlatform(5, 0, 3))     // Windows 2000 SP3 and above
        return true;
    else
        return false;
}

itvEnum IsPackageTrusted | ( | LPCSTR | szSetupEXE,
 |  | LPCSTR | szPackage,
 |  | HWND | hwndParent
 | ) |  |

Definition at line 191 of file vertrust.cpp.

{
    WCHAR *szwSetup   = 0;
    WCHAR *szwPackage = 0;
    int   cchWide     = 0;

    bool    fPackageIsTrusted = false;
    bool    fSetupExeIsSigned = false;
    bool    fPackageIsSigned  = false;
    itvEnum itv               = itvUnTrusted;

    DWORD dwUILevel = 0;

    char szDebugOutput[MAX_STR_LENGTH] = {0};

    PCCERT_CONTEXT pcExeSigner = 0;
    PCCERT_CONTEXT pcMsiSigner = 0;

    HMODULE hCrypt32 = LoadLibrary(CRYPT32_DLL);
    if (!hCrypt32)
    {
        // no crypto on the machine
        return itvWintrustNotOnMachine;
    }
    PFnCertCompareCertificate pfnCertCompareCertificate = (PFnCertCompareCertificate)GetProcAddress(hCrypt32, CRYPTOAPI_CertCompareCertificate);
    PFnCertFreeCertificateContext pfnCertFreeCertificateContext = (PFnCertFreeCertificateContext)GetProcAddress(hCrypt32, CRYPTOAPI_CertFreeCertificateContext);
    if (!pfnCertCompareCertificate || !pfnCertFreeCertificateContext)
    {
        // no crypt on the machine
        FreeLibrary(hCrypt32);
        return itvWintrustNotOnMachine;
    }

    // convert szSetupExe to WIDE
    cchWide = MultiByteToWideChar(CP_ACP, 0, szSetupExe, -1, 0, 0);
    szwSetup = new WCHAR[cchWide];
    if (!szwSetup)
    {
        // out of memory
        FreeLibrary(hCrypt32);
        return itvUnTrusted;
    }
    if (0 == MultiByteToWideChar(CP_ACP, 0, szSetupExe, -1, szwSetup, cchWide))
    {
        // failed to convert string
        FreeLibrary(hCrypt32);
        delete [] szwSetup;
        return itvUnTrusted;
    }

    //
    // step 1: silently call WinVerifyTrust on szSetupExe, ignore return value - except for ivtWintrustNotOnMachine
    //

    DebugMsg("[WVT] step 1: silently call WinVerifyTrust on szSetupExe, ignoring return value\n");

    if (itvWintrustNotOnMachine == (itv = IsFileTrusted(szwSetup, hwndParent, WTD_UI_NONE, &fSetupExeIsSigned, &pcExeSigner)))
    {
        goto CleanUp;
    }

    DebugMsg("[WVT] fSetupExeIsSigned = %s\n", fSetupExeIsSigned ? "TRUE" : "FALSE");

    // convert szPackage to WIDE
    cchWide = MultiByteToWideChar(CP_ACP, 0, szPackage, -1, 0, 0);
    szwPackage = new WCHAR[cchWide];
    if (!szwPackage)
    {
        // out of memory
        FreeLibrary(hCrypt32);
        return itvUnTrusted;
    }
    if (0 == MultiByteToWideChar(CP_ACP, 0, szPackage, -1, szwPackage, cchWide))
    {
        // failed to convert string
        FreeLibrary(hCrypt32);
        return itvUnTrusted;
    }

    //
    // step 2: silently call WinVerifyTrust on szPackage, ignore return value - except for ivtWintrustNotOnMachine
    //

    if (fSetupExeIsSigned)
    {
        DebugMsg("[WVT] step2: silently call WinVerifyTrust on szPackage, ignoring return value\n");
        if (itvWintrustNotOnMachine == (itv = IsFileTrusted(szwPackage, hwndParent, WTD_UI_NONE, &fPackageIsSigned, &pcMsiSigner)))
        {
            goto CleanUp;
        }

        DebugMsg("[WVT] fPackageIsSigned = %s\n", fPackageIsSigned ? "TRUE" : "FALSE");
    }

    //
    // step 3: call WinVerifyTrust on szPackage, return value matters; use proper UI-level
    //

    if ( !fSetupExeIsSigned  // exe is not signed
        || !fPackageIsSigned // package is not signed
        || !pcExeSigner      // exe signer cert is missing
        || !pcMsiSigner      // package signer cert is missing
        || !pfnCertCompareCertificate(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, pcExeSigner->pCertInfo, pcMsiSigner->pCertInfo)) // signed by different certs
    {
        // always show UI
        DebugMsg("[WVT] step3: last call to WinVerifyTrust using full UI\n");
        dwUILevel = WTD_UI_ALL;
    }
    else
    {
        // show UI only if bad
        DebugMsg("[WVT] step3: last call to WinVerifyTrust showing UI only if something is wrong\n");
        dwUILevel = WTD_UI_NOGOOD;
    }

    itv = IsFileTrusted(szwPackage, hwndParent, dwUILevel, NULL, NULL);

    //
    // cleanup
    //

CleanUp:
    if (szwPackage)
        delete [] szwPackage;
    if (szwSetup)
        delete [] szwSetup;

    if (pcExeSigner)
        pfnCertFreeCertificateContext(pcExeSigner);
    if (pcMsiSigner)
        pfnCertFreeCertificateContext(pcMsiSigner);

    FreeLibrary(hCrypt32);

    return itv;
}

bool IsUpdateRequiredVersion | ( | LPSTR | szFilename,
 |  | ULONG | ulMinVer
 | ) |  |

Definition at line 376 of file upgrdmsi.cpp.

{
    // get version of update package
    DWORD dwUpdateMSVer;
    DWORD dwRet = GetFileVersionNumber(szFilename, &dwUpdateMSVer, NULL);
    if (ERROR_SUCCESS != dwRet)
    {
        // can't obtain version information; assume not proper version
        DebugMsg("[Info] Can't obtain version information for update package; assuming it is not the proper version\n");
        return false;
    }

    // compare version at source to required minimum
    ULONG ulSourceVer = HIWORD(dwUpdateMSVer) * 100 + LOWORD(dwUpdateMSVer);
    if (ulSourceVer < ulMinVer)
    {
        // source version won't get us to our minimum version
        char szDebugOutput[MAX_STR_LENGTH] = {0};
        DebugMsg("[Info] The update package is improper version for upgrade. Update package Version = %d, Minimum Version = %d.\n", ulSourceVer, ulMinVer);

        return false;
    }

    return true;
}

void PostError | ( | HINSTANCE | hInst,
 |  | HWND | hwndOwner,
 |  | LPCSTR | szTitle,
 |  | UINT | uiErrorId,
 |  | LPCSTR | szValue,
 |  | int | iValue
 | ) |  |

Definition at line 363 of file utils.cpp.

{
    char szError[MAX_STR_LENGTH]  = {0};
    char szFormat[MAX_STR_LENGTH] = {0};

    WIN::LoadString(hInst, uiErrorId, szFormat, sizeof(szFormat)/sizeof(char));
    StringCchPrintf(szError, sizeof(szError), szFormat, szValue, iValue);
    MessageBox(hwndOwner, szError, szTitle, MB_OK | MB_ICONERROR);
}

void PostError | ( | HINSTANCE | hInst,
 |  | HWND | hwndOwner,
 |  | LPCSTR | szTitle,
 |  | UINT | uiErrorId,
 |  | int | iValue
 | ) |  |

Definition at line 377 of file utils.cpp.

{
    char szError[MAX_STR_LENGTH]  = {0};
    char szFormat[MAX_STR_LENGTH] = {0};

    WIN::LoadString(hInst, uiErrorId, szFormat, sizeof(szFormat)/sizeof(char));
    StringCchPrintf(szError, sizeof(szError), szFormat, iValue);
    MessageBox(hwndOwner, szError, szTitle, MB_OK | MB_ICONERROR);
}

void PostError | ( | HINSTANCE | hInst,
 |  | HWND | hwndOwner,
 |  | LPCSTR | szTitle,
 |  | UINT | uiErrorId
 | ) |  |

Definition at line 337 of file utils.cpp.

{
    char szError[MAX_STR_LENGTH]  = {0};

    WIN::LoadString(hInst, uiErrorId, szError, sizeof(szError)/sizeof(char));
    MessageBox(hwndOwner, szError, szTitle, MB_OK | MB_ICONERROR);
}

void PostError | ( | HINSTANCE | hInst,
 |  | HWND | hwndOwner,
 |  | LPCSTR | szTitle,
 |  | UINT | uiErrorId,
 |  | LPCSTR | szValue
 | ) |  |

Definition at line 349 of file utils.cpp.

{
    char szError[MAX_STR_LENGTH]  = {0};
    char szFormat[MAX_STR_LENGTH] = {0};

    WIN::LoadString(hInst, uiErrorId, szFormat, sizeof(szFormat)/sizeof(char));
    StringCchPrintf(szError, sizeof(szError), szFormat, szValue);
    MessageBox(hwndOwner, szError, szTitle, MB_OK | MB_ICONERROR);
}

void PostFormattedError | ( | HINSTANCE | hInst,
 |  | HWND | hwndOwner,
 |  | LPCSTR | szTitle,
 |  | UINT | uiErrorId,
 |  | LPCSTR | szValue
 | ) |  |

Definition at line 391 of file utils.cpp.

{
    char szFormat[MAX_STR_LENGTH] = {0};
    const char* szArgs[1] = {szValue};
    LPVOID lpMessage = 0;;

    WIN::LoadString(hInst, uiErrorId, szFormat, sizeof(szFormat)/sizeof(char));
    FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY, (LPVOID)szFormat, 0, 0, (LPSTR)&lpMessage, 0, (va_list*)szArgs);
    if (!lpMessage)
    {
        ReportErrorOutOfMemory(hInst, hwndOwner, szTitle);
        return;
    }
    MessageBox(hwndOwner, (LPCSTR)lpMessage, szTitle, MB_OK | MB_ICONERROR);
    LocalFree(lpMessage);
}

void PostMsiError | ( | HINSTANCE | hInst,
 |  | HINSTANCE | hMsi,
 |  | HWND | hwndOwner,
 |  | LPCSTR | szTitle,
 |  | UINT | uiErrorId
 | ) |  |

Definition at line 412 of file utils.cpp.

{
    switch (uiErrorId)
    {
    case ERROR_INSTALL_SUSPEND:
    case ERROR_INSTALL_USEREXIT:
    case ERROR_INSTALL_FAILURE:
    case ERROR_SUCCESS_REBOOT_REQUIRED:
    case ERROR_SUCCESS_REBOOT_INITIATED:
    case ERROR_APPHELP_BLOCK:
        break;
    case ERROR_FILE_NOT_FOUND:
    case ERROR_INVALID_NAME:
    case ERROR_PATH_NOT_FOUND:
        uiErrorId = ERROR_INSTALL_PACKAGE_OPEN_FAILED;
    default:
        {
            char szError[MAX_STR_LENGTH] = {0};
            if (0 == WIN::LoadString(hMsi, uiErrorId, szError, sizeof(szError)/sizeof(char)))
            {
                // error string does not exist, use default
                PostError(hInst, hwndOwner, szTitle, IDS_INSTALL_ERROR, uiErrorId);
            }
            else
            {
                MessageBox(hwndOwner, szError, szTitle, MB_OK | MB_ICONERROR);
            }
            return;
        }
    }
}

void PostResourceNotFoundError | ( | HINSTANCE | hInst,
 |  | HWND | hwndOwner,
 |  | LPCSTR | szTitle,
 |  | LPCSTR | szName
 | ) |  |

Definition at line 311 of file utils.cpp.

{
    char szError[MAX_STR_LENGTH]  = {0};
    char szFormat[MAX_STR_LENGTH] = {0};

    WIN::LoadString(hInst, IDS_MISSING_RESOURCE, szFormat, sizeof(szFormat)/sizeof(char));
    StringCchPrintf(szError, sizeof(szError), szFormat, szName);
    MessageBox(hwndOwner, szError, szTitle, MB_OK | MB_ICONEXCLAMATION);
}

void ReportErrorOutOfMemory | ( | HINSTANCE | hInst,
 |  | HWND | hwndOwner,
 |  | LPCSTR | szCaption
 | ) |  |

Definition at line 478 of file utils.cpp.

{
    char szError[MAX_STR_LENGTH];

    WIN::LoadString(hInst, IDS_OUTOFMEM, szError, sizeof(szError)/sizeof(char));
    WIN::MessageBox(hwndOwner, szError, szCaption, MB_OK | MB_ICONERROR);
}

void ReportUserCancelled | ( | HINSTANCE | hInst,
 |  | HWND | hwndOwner,
 |  | LPCSTR | szTitle
 | ) |  |

Definition at line 325 of file utils.cpp.

{
    char szError[MAX_STR_LENGTH] = {0};

    WIN::LoadString(hInst, IDS_USER_CANCELLED, szError, sizeof(szError)/sizeof(char));
    MessageBox(hwndOwner, szError, szTitle, MB_OK | MB_ICONEXCLAMATION);
}

UINT UpgradeMsi | ( | HINSTANCE | hInst,
 |  | CDownloadUI * | piDownloadUI,
 |  | LPCSTR | szAppTitle,
 |  | LPCSTR | szUpgdLocation,
 |  | LPCSTR | szUpgrade,
 |  | ULONG | ulMinVer
 | ) |  |

Definition at line 92 of file upgrdmsi.cpp.

{
    char *szTempPath    = 0;
    char *szUpdatePath = 0;
    char *szFilePart    = 0;

    DWORD cchTempPath    = 0;
    DWORD cchUpdatePath = 0;
    DWORD cchReturn      = 0;
    DWORD dwLastError    = 0;
    DWORD dwFileAttrib   = 0;
    UINT  uiRet          = 0;

    HRESULT hr           = S_OK;

    // generate the path to the MSI update file =  szBase + szUpdate
    //   note: szUpdate is a relative path

    cchTempPath = lstrlen(szBase) + lstrlen(szUpdate) + 2; // 1 for null terminator, 1 for back slash
    szTempPath = new char[cchTempPath];
    if (!szTempPath)
    {
        ReportErrorOutOfMemory(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle);
        uiRet = ERROR_OUTOFMEMORY;
        goto CleanUp;
    }
    memset((void*)szTempPath, 0x00, cchTempPath*sizeof(char));

    // find 'setup.exe' in the path so we can remove it -- this is an already expanded path, that represents
    //  our current running location.  It includes our executable name -- we want to find that and get rid of it
    if (0 == GetFullPathName(szBase, cchTempPath, szTempPath, &szFilePart))
    {
        uiRet = GetLastError();
        PostFormattedError(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle, IDS_INVALID_PATH, szTempPath);
        goto CleanUp;
    }
    if (szFilePart)
        *szFilePart = '\0';

    hr = StringCchCat(szTempPath, cchTempPath, szUpdate);
    if (FAILED(hr))
    {
        uiRet = HRESULT_CODE(hr);
        PostFormattedError(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle, IDS_INVALID_PATH, szTempPath);
        goto CleanUp;
    }

    cchUpdatePath = 2*cchTempPath;
    szUpdatePath = new char[cchUpdatePath];
    if (!szUpdatePath)
    {
        ReportErrorOutOfMemory(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle);
        uiRet = ERROR_OUTOFMEMORY;
        goto CleanUp;
    }

    // normalize the path
    cchReturn = GetFullPathName(szTempPath, cchUpdatePath, szUpdatePath, &szFilePart);
    if (cchReturn > cchUpdatePath)
    {
        // try again, with larger buffer
        delete [] szUpdatePath;
        cchUpdatePath = cchReturn;
        szUpdatePath = new char[cchUpdatePath];
        if (!szUpdatePath)
        {
            ReportErrorOutOfMemory(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle);
            uiRet = ERROR_OUTOFMEMORY;
            goto CleanUp;
        }
        cchReturn = GetFullPathName(szTempPath, cchUpdatePath, szUpdatePath, &szFilePart);
    }
    if (0 == cchReturn)
    {
        uiRet = GetLastError();
        PostFormattedError(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle, IDS_INVALID_PATH, szTempPath);
        goto CleanUp;
    }

    // no download is necessary -- but we can check for the file's existence
    dwFileAttrib = GetFileAttributes(szUpdatePath);
    if (0xFFFFFFFF == dwFileAttrib)
    {
        // Update executable is missing
        PostFormattedError(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle, IDS_NOUPDATE, szUpdatePath);
        uiRet = ERROR_FILE_NOT_FOUND;
        goto CleanUp;
    }

    uiRet = ValidateUpdate(hInst, piDownloadUI, szAppTitle, szUpdatePath, szUpdatePath, ulMinVer);

CleanUp:
    if (szTempPath)
        delete [] szTempPath;
    if (szUpdatePath)
        delete [] szUpdatePath;

    return uiRet;
}

UINT ValidateUpdate | ( | HINSTANCE | hInst,
 |  | CDownloadUI * | piDownloadUI,
 |  | LPCSTR | szAppTitle,
 |  | LPSTR | szUpdatePath,
 |  | LPCSTR | szModuleFile,
 |  | ULONG | ulMinVer
 | ) |  |

Definition at line 406 of file upgrdmsi.cpp.

{
    UINT uiRet = ERROR_SUCCESS;

    char szShortPath[MAX_PATH]          = {0};

    // ensure Update is right version for Windows Installer upgrade
    if (!IsUpdateRequiredVersion(szUpdatePath, ulMinVer))
    {
        // Update won't get us the right upgrade
        PostFormattedError(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle, IDS_INCORRECT_UPDATE, szUpdatePath);
        return ERROR_INVALID_PARAMETER;
    }

    // upgrade msi
    uiRet = ExecuteUpgradeMsi(szUpdatePath);
    switch (uiRet)
    {
    case ERROR_SUCCESS:
    case ERROR_SUCCESS_REBOOT_REQUIRED:
        {
            // nothing required at this time
            break;
        }
    case ERROR_FILE_NOT_FOUND:
        {
            // Update executable not found
            PostFormattedError(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle, IDS_NOUPDATE, szUpdatePath);
            break;
        }
    default: // failure
        {
            // report error
            PostError(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle, IDS_FAILED_TO_UPGRADE_MSI);
            break;
        }
    }
    return uiRet;
}

DWORD VerifyFileSignature | ( | LPCSTR | lpszModule,
 |  | LPSTR | lpszCmdLine
 | ) |  |

Definition at line 27 of file utils.cpp.

{
    LPCSTR  pszFirstArgEnd;
    LPCSTR  pszFileName;
    LPCSTR  pszEnd;
    DWORD   Status;

    //
    // When this function is called, the first argument has already
    // been verified. So skip the first argument.
    //
    GetNextArgument (lpszCmdLine, NULL, &pszFirstArgEnd, NULL);

    // Now get the name of the file whose signature needs to be verified.
    Status = GetNextArgument (CharNextA(pszFirstArgEnd), &pszFileName, &pszEnd, NULL);

    // Must supply a filename
    if (ERROR_NO_MORE_ITEMS == Status)
        return ERROR_BAD_ARGUMENTS;

    // Should not have any more arguments
    if ('\0' != *(CharNextA(pszEnd)) &&
        ERROR_NO_MORE_ITEMS != GetNextArgument (CharNextA(CharNextA(pszEnd)), NULL, NULL, NULL))
    {
        return ERROR_BAD_ARGUMENTS;
    }

    // We have the right arguments. Null terminate the filename.
    *(CharNextA(pszEnd)) = '\0';

    switch (IsPackageTrusted(lpszModule, pszFileName, NULL))
    {
    case itvWintrustNotOnMachine:
        return TRUST_E_PROVIDER_UNKNOWN;
    case itvTrusted:
        return ERROR_SUCCESS;
    case itvUnTrusted:
    default:
        return TRUST_E_SUBJECT_NOT_TRUSTED;
    }
}

DWORD WaitForProcess ( HANDLE handle )

Definition at line 588 of file upgrdmsi.cpp.

{
    DWORD dwResult = NOERROR;

    MSG msg;
    memset((void*)&msg, 0x00, sizeof(MSG));

    //loop forever to wait
    while (true)
    {
        //wait for object
        switch (WIN::MsgWaitForMultipleObjects(1, &handle, false, INFINITE, QS_ALLINPUT))
        {
        //success!
        case WAIT_OBJECT_0:
            goto Finish;

        //not the process that we're waiting for
        case (WAIT_OBJECT_0 + 1):
            {
                if (WIN::PeekMessage(&msg, NULL, NULL, NULL, PM_REMOVE))
                {
                    WIN::TranslateMessage(&msg);
                    WIN::DispatchMessage(&msg);
                }

                break;
            }
        //did not return an OK; return error status
        default:
            {
                dwResult = WIN::GetLastError();
                goto Finish;
            }
        }
    }

Finish:
    return dwResult;
}

Variable Documentation

const char sqlProductCode[] = "SELECT `Value` FROM `Property` WHERE `Property`='ProductCode'"

Definition at line 39 of file setup.h.

const char szAdminInstallProperty[] = " ACTION=ADMIN"

Definition at line 37 of file setup.h.

const char szDebugEnvVar[] = "_MSI_WEB_BOOTSTRAP_DEBUG"

Definition at line 132 of file setup.h.

const char szDefaultInstallUpdCommandLine[] = "REINSTALL=ALL REINSTALLMODE=vomus"

Definition at line 36 of file setup.h.

const char szDefaultMinPatchCommandLine[] = "REINSTALL=ALL REINSTALLMODE=omus"

Definition at line 35 of file setup.h.

const char szDefaultOperation[] = "DEFAULT"

Definition at line 29 of file setup.h.

const char szDelayReboot[] = " /norestart"

Definition at line 122 of file setup.h.

const char szDelayRebootQuiet[] = " /quiet /norestart"

Definition at line 123 of file setup.h.

const char szInstallOperation[] = "INSTALL"

Definition at line 30 of file setup.h.

const char szInstallUpdOperation[] = "INSTALLUPD"

Definition at line 33 of file setup.h.

const char szMajPatchOperation[] = "MAJPATCH"

Definition at line 32 of file setup.h.

const char szMinPatchOperation[] = "MINPATCH"

Definition at line 31 of file setup.h.

const char szPathSep[] = "\\"

Definition at line 27 of file setup.h.

const char szUrlPathSep[] = "/"

Definition at line 26 of file setup.h.

Generated on Wed Nov 13 2024 16:54:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/Msi/setup.exe/setupui.cpp File Reference

  • SysMgmt
  • Msi
  • setup.exe
Defines | Functions | Variables

setupui.cpp File Reference

#include "resource.h"
#include "setupui.h"
#include <commctrl.h>

Go to the source code of this file.

Defines

#define | COMCTL32
#define | WIN

Functions

bool | GetScreenCenterCoord (HWND hDlg, int &iDialogLeft, int &iDialogTop, int &iDialogWidth, int &iDialogHeight)
BOOL CALLBACK | ProgressProc (HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)

Variables

const GUID | IID_IDownloadBindStatusCallback = {0xB506A5D1L,0x9716,0x4F35,{0x8E,0xD5,0x9E,0xCB,0x0E,0x9A,0x55,0xF8}}
const GUID | IID_IUnknown = {0x00000000L,0x9716,0x4F35,{0x8E,0xD5,0x9E,0xCB,0x0E,0x9A,0x55,0xF8}}

Define Documentation

#define COMCTL32

Definition at line 11 of file setupui.cpp.

#define WIN

Definition at line 10 of file setupui.cpp.

Function Documentation

bool GetScreenCenterCoord | ( | HWND | hDlg,
 |  | int & | iDialogLeft,
 |  | int & | iDialogTop,
 |  | int & | iDialogWidth,
 |  | int & | iDialogHeight
 | ) |  |

Definition at line 78 of file setupui.cpp.

{
    RECT rcDialog;
    if (!WIN::GetWindowRect(hDlg, &rcDialog))
        return false;

    RECT rcScreen;
    if (!WIN::SystemParametersInfo(SPI_GETWORKAREA, 0, &rcScreen, 0))
    {
        rcScreen.left = 0;
        rcScreen.top = 0;
        rcScreen.right = WIN::GetSystemMetrics(SM_CXSCREEN);
        rcScreen.bottom = WIN::GetSystemMetrics(SM_CYSCREEN);
    }
    iDialogWidth = rcDialog.right - rcDialog.left;
    iDialogHeight = rcDialog.bottom - rcDialog.top;
    iDialogLeft = rcScreen.left + (rcScreen.right - rcScreen.left - iDialogWidth)/2;
    iDialogTop = rcScreen.top + (rcScreen.bottom - rcScreen.top - iDialogHeight)/2;

    return true;
}

BOOL CALLBACK ProgressProc | ( | HWND | hDlg,
 |  | UINT | uiMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 46 of file setupui.cpp.

{
    if (uiMsg == WM_INITDIALOG)
    {
        return TRUE;
    }
    else if (uiMsg == WM_COMMAND && wParam == IDCANCEL)
    {
        ((CDownloadUI*)lParam)->SetUserCancel();
        return TRUE;
    }
    else if (uiMsg == WM_SETCURSOR)
    {
        // always display WAIT cursor if mouse not over Cancel button
        if ( (HWND)wParam != WIN::GetDlgItem(hDlg, IDC_DOWNLOAD_CANCEL))
        {
            WIN::SetCursor(WIN::LoadCursor(0, MAKEINTRESOURCE(IDC_WAIT)));
            return TRUE;
        }
    }
    else if (uiMsg == WM_CLOSE)
    {

    }

    return FALSE;
}

Variable Documentation

const GUID IID_IDownloadBindStatusCallback = {0xB506A5D1L,0x9716,0x4F35,{0x8E,0xD5,0x9E,0xCB,0x0E,0x9A,0x55,0xF8}}

Definition at line 18 of file setupui.cpp.

const GUID IID_IUnknown = {0x00000000L,0x9716,0x4F35,{0x8E,0xD5,0x9E,0xCB,0x0E,0x9A,0x55,0xF8}}

Definition at line 20 of file setupui.cpp.

Generated on Wed Nov 13 2024 16:54:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/Msi/setup.exe/setupui.h File Reference

  • SysMgmt
  • Msi
  • setup.exe
Classes | Defines | Enumerations

setupui.h File Reference

#include <windows.h>
#include <urlmon.h>

Go to the source code of this file.

Classes

class | CDownloadBindStatusCallback
class | CDownloadUI

Defines

#define | MAX_STR_CAPTION 256

Enumerations

enum | irmProgress { irmNotInitialized = -1, irmOK = 0, irmCancel = 1 }

Define Documentation

#define MAX_STR_CAPTION 256

Definition at line 20 of file setupui.h.

Enumeration Type Documentation

enum irmProgress
Enumerator:
irmNotInitialized
irmOK
irmCancel

Definition at line 27 of file setupui.h.

{
    irmNotInitialized = -1, // dialog was not initialized
    irmOK             =  0, // ok
    irmCancel         =  1, // user depressed cancel button
};

Generated on Wed Nov 13 2024 16:54:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/Msi/setup.exe/upgrdmsi.cpp File Reference

  • SysMgmt
  • Msi
  • setup.exe
Defines | Typedefs | Functions

upgrdmsi.cpp File Reference

#include "setup.h"
#include "resource.h"
#include "wininet.h"
#include "urlmon.h"
#include "wintrust.h"
#include <assert.h>
#include <stdlib.h>
#include "strsafe.h"

Go to the source code of this file.

Defines

#define | MSISIPAPI_DllRegisterServer "DllRegisterServer"
#define | WIN

Typedefs

typedef HRESULT(WINAPI * | PFnMsiSIPDllRegisterServer )()

Functions

UINT | DownloadAndUpgradeMsi (HINSTANCE hInst, CDownloadUI *piDownloadUI, LPCSTR szAppTitle, LPCSTR szUpdateLocation, LPCSTR szUpdate, LPCSTR szModuleFile, ULONG ulMinVer)
DWORD | ExecuteUpgradeMsi (LPSTR szUpgradeMsi)
DWORD | ExecuteVerifyUpdate (LPCSTR szModuleFile, LPCSTR szUpdateCachePath)
bool | IsMsiUpgradeNecessary (ULONG ulReqMsiMinVer)
bool | IsUpdateRequiredVersion (LPSTR szFilename, ULONG ulMinVer)
UINT | UpgradeMsi (HINSTANCE hInst, CDownloadUI *piDownloadUI, LPCSTR szAppTitle, LPCSTR szBase, LPCSTR szUpdate, ULONG ulMinVer)
UINT | ValidateUpdate (HINSTANCE hInst, CDownloadUI *piDownloadUI, LPCSTR szAppTitle, LPSTR szUpdatePath, LPCSTR szModuleFile, ULONG ulMinVer)
DWORD | WaitForProcess (HANDLE handle)

Define Documentation

#define MSISIPAPI_DllRegisterServer "DllRegisterServer"

Definition at line 23 of file upgrdmsi.cpp.

#define WIN

Definition at line 21 of file upgrdmsi.cpp.

Typedef Documentation

typedef HRESULT(WINAPI* PFnMsiSIPDllRegisterServer)()

Definition at line 24 of file upgrdmsi.cpp.

Function Documentation

UINT DownloadAndUpgradeMsi | ( | HINSTANCE | hInst,
 |  | CDownloadUI * | piDownloadUI,
 |  | LPCSTR | szAppTitle,
 |  | LPCSTR | szUpdateLocation,
 |  | LPCSTR | szUpdate,
 |  | LPCSTR | szModuleFile,
 |  | ULONG | ulMinVer
 | ) |  |

Definition at line 196 of file upgrdmsi.cpp.

{
    char *szTempPath         = 0;
    char *szUpdatePath       = 0;
    char *szUpdateCacheFile  = 0;
    const char *pch          = 0;

    DWORD cchTempPath         = 0;
    DWORD cchUpdatePath       = 0;
    DWORD cchUpdateCacheFile  = 0;
    DWORD dwLastError         = 0;
    UINT  uiRet               = 0;
    HRESULT hr                = 0;
    DWORD Status              = ERROR_SUCCESS;

    char szDebugOutput[MAX_STR_LENGTH] = {0};
    char szText[MAX_STR_CAPTION]       = {0};

    // generate the path to the update == UPDATELOCATION + szUpdate
    //   note: szUpdate is a relative path
    cchTempPath = lstrlen(szUpdateLocation) + lstrlen(szUpdate) + 2; // 1 for slash, 1 for null
    szTempPath = new char[cchTempPath];
    if (!szTempPath)
    {
        ReportErrorOutOfMemory(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle);
        uiRet = ERROR_OUTOFMEMORY;
        goto CleanUp;
    }
    memset((void*)szTempPath, 0x0, cchTempPath*sizeof(char));
    hr = StringCchCopy(szTempPath, cchTempPath, szUpdateLocation);
    if (FAILED(hr))
    {
        uiRet = HRESULT_CODE(hr);
        PostFormattedError(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle, IDS_INVALID_PATH, szTempPath);
        goto CleanUp;
    }

    // check for trailing slash on szUpdateLocation
    pch = szUpdateLocation + lstrlen(szUpdateLocation) + 1; // put at null terminator
    pch = CharPrev(szUpdateLocation, pch);
    if (*pch != '/')
    {
        hr = StringCchCat(szTempPath, cchTempPath, szUrlPathSep);
        if (FAILED(hr))
        {
            uiRet = HRESULT_CODE(hr);
            PostFormattedError(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle, IDS_INVALID_PATH, szTempPath);
            goto CleanUp;
        }
    }

    hr = StringCchCat(szTempPath, cchTempPath, szUpdate);
    if (FAILED(hr))
    {
        uiRet = HRESULT_CODE(hr);
        PostFormattedError(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle, IDS_INVALID_PATH, szTempPath);
        goto CleanUp;
    }

    // canonicalize the URL path
    cchUpdatePath = cchTempPath*2;
    szUpdatePath = new char[cchUpdatePath];
    if (!szUpdatePath)
    {
        ReportErrorOutOfMemory(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle);
        uiRet = ERROR_OUTOFMEMORY;
        goto CleanUp;
    }

    if (!InternetCanonicalizeUrl(szTempPath, szUpdatePath, &cchUpdatePath, 0))
    {
        dwLastError = GetLastError();
        if (ERROR_INSUFFICIENT_BUFFER == dwLastError)
        {
            // try again
            delete [] szUpdatePath;
            szUpdatePath = new char[cchUpdatePath];
            if (!szUpdatePath)
            {
                ReportErrorOutOfMemory(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle);
                uiRet = ERROR_OUTOFMEMORY;
                goto CleanUp;
            }
            dwLastError = 0; // reset to success for 2nd attempt
            if (!InternetCanonicalizeUrl(szTempPath, szUpdatePath, &cchUpdatePath, 0))
                dwLastError = GetLastError();
        }
    }
    if (0 != dwLastError)
    {
        // error -- invalid path/Url
        PostFormattedError(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle, IDS_INVALID_PATH, szTempPath);
        uiRet = dwLastError;
        goto CleanUp;
    }

    DebugMsg("[Info] Downloading update package from --> %s\n", szUpdatePath);

    // set action text for download
    WIN::LoadString(hInst, IDS_DOWNLOADING_UPDATE, szText, MAX_STR_CAPTION);
    if (irmCancel == piDownloadUI->SetActionText(szText))
    {
        ReportUserCancelled(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle);
        uiRet = ERROR_INSTALL_USEREXIT;
        goto CleanUp;
    }

    // download the Update file so we can run it -- must be local to execute
    szUpdateCacheFile = new char[MAX_PATH];
    cchUpdateCacheFile = MAX_PATH;
    if (!szUpdateCacheFile)
    {
        ReportErrorOutOfMemory(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle);
        uiRet = ERROR_OUTOFMEMORY;
        goto CleanUp;
    }

    hr = WIN::URLDownloadToCacheFile(NULL, szUpdatePath, szUpdateCacheFile, cchUpdateCacheFile, 0, /* IBindStatusCallback = */ &CDownloadBindStatusCallback(piDownloadUI));
    if (piDownloadUI->HasUserCanceled())
    {
        ReportUserCancelled(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle);
        uiRet = ERROR_INSTALL_USEREXIT;
        goto CleanUp;
    }
    if (FAILED(hr))
    {
        // error during download -- probably because file not found (or lost connection)
        PostFormattedError(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle, IDS_NOUPDATE, szUpdatePath);
        uiRet = ERROR_FILE_NOT_FOUND;
        goto CleanUp;
    }

    //
    // Perform trust check on MSI. Note, this must be done in a separate process.
    // This is because MSI 2.0 and higher register sip callbacks for verifying
    // digital signatures on msi files. At this point, it is quite likely that
    // the SIP callbacks have not been registered. So we don't want to load
    // wintrust.dll into this process's image yet, otherwise it will remain unaware
    // of the sip callbacks registered by WindowsInstaller-KB884016-x86.exe and will
    // fail later when it tries to verify the signature on the msi file downloaded
    // from the web.
    //
    Status = ExecuteVerifyUpdate(szModuleFile, szUpdateCacheFile);
    if (TRUST_E_PROVIDER_UNKNOWN == Status)
    {
        PostError(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle, IDS_NO_WINTRUST);
        uiRet = ERROR_CALL_NOT_IMPLEMENTED;
        goto CleanUp;
    }
    else if (ERROR_SUCCESS != Status)
    {
        PostFormattedError(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle, IDS_UNTRUSTED, szUpdateCacheFile);
        uiRet = HRESULT_CODE(TRUST_E_SUBJECT_NOT_TRUSTED);
        goto CleanUp;
    }

    // continue other validations
    uiRet = ValidateUpdate(hInst, piDownloadUI, szAppTitle, szUpdateCacheFile, szModuleFile, ulMinVer);

CleanUp:
    if (szTempPath)
        delete [] szTempPath;
    if (szUpdatePath)
        delete [] szUpdatePath;
    if (szUpdateCacheFile)
    {
        WIN::DeleteUrlCacheEntry(szUpdateCacheFile);
        delete [] szUpdateCacheFile;
    }

    return uiRet;
}

DWORD ExecuteUpgradeMsi ( LPSTR szUpgradeMsi )

Definition at line 450 of file upgrdmsi.cpp.

{
    DebugMsg("[Info] Running update package from --> %s\n", szUpgradeMsi);

    DWORD dwResult = 0;

    // build up CreateProcess structures
    STARTUPINFO          sui;
    PROCESS_INFORMATION  pi;

    memset((void*)&pi, 0x00, sizeof(PROCESS_INFORMATION));
    memset((void*)&sui, 0x00, sizeof(STARTUPINFO));
    sui.cb          = sizeof(STARTUPINFO);
    sui.dwFlags     = STARTF_USESHOWWINDOW;
    sui.wShowWindow = SW_SHOW;

    //
    // build command line and specify delayreboot option to Update
    //  three acounts for terminating null plus quotes for module
    DWORD cchCommandLine = lstrlen(szUpgradeMsi) + lstrlen(szDelayReboot) + 3;
    char *szCommandLine = new char[cchCommandLine];

    if (!szCommandLine)
        return ERROR_OUTOFMEMORY;

    if (FAILED(StringCchCopy(szCommandLine, cchCommandLine, "\""))
        || FAILED(StringCchCat(szCommandLine, cchCommandLine, szUpgradeMsi))
        || FAILED(StringCchCat(szCommandLine, cchCommandLine, "\""))
        || FAILED(StringCchCat(szCommandLine, cchCommandLine, szDelayReboot)))
    {
        delete [] szCommandLine;
        return ERROR_INSTALL_FAILURE;
    }

    //
    // run update process
    if(!WIN::CreateProcess(NULL, szCommandLine, NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE, NULL, NULL, &sui, &pi))
    {
        // failed to launch.
        dwResult = GetLastError();
        delete [] szCommandLine;
        return dwResult;
    }

    dwResult = WaitForProcess(pi.hProcess);
    if(ERROR_SUCCESS != dwResult)
    {
        delete [] szCommandLine;
        return dwResult;
    }

    DWORD dwExitCode = 0;
    WIN::GetExitCodeProcess(pi.hProcess, &dwExitCode);

    WIN::CloseHandle(pi.hProcess);

    delete [] szCommandLine;

    return dwExitCode;
}

DWORD ExecuteVerifyUpdate | ( | LPCSTR | szModuleFile,
 |  | LPCSTR | szUpdateCachePath
 | ) |  |

Definition at line 514 of file upgrdmsi.cpp.

{
    DWORD dwResult = 0;

    // build up CreateProcess structures
    STARTUPINFO          sui;
    PROCESS_INFORMATION  pi;

    memset((void*)&pi, 0x00, sizeof(PROCESS_INFORMATION));
    memset((void*)&sui, 0x00, sizeof(STARTUPINFO));
    sui.cb          = sizeof(STARTUPINFO);
    sui.dwFlags     = STARTF_USESHOWWINDOW;
    sui.wShowWindow = SW_SHOW;

    //
    // Build command line and specify delayreboot option to Update
    // The nine extra characters are required for the following:
    //      2 for the quotes enclosing the module path
    //      2 for /v
    //      2 for the spaces before and after /v
    //      2 for the quotes enclosing the Update path
    //      1 for the terminating null.
    //
    DWORD cchCommandLine = lstrlen(szModuleFile) + lstrlen(szUpdateCachePath) + 9;
    char *szCommandLine = new char[cchCommandLine];

    if (!szCommandLine)
        return ERROR_OUTOFMEMORY;

    if (FAILED(StringCchCopy(szCommandLine, cchCommandLine, "\""))
        || FAILED(StringCchCat(szCommandLine, cchCommandLine, szModuleFile))
        || FAILED(StringCchCat(szCommandLine, cchCommandLine, "\""))
        || FAILED(StringCchCat(szCommandLine, cchCommandLine, " /v \""))
        || FAILED(StringCchCat(szCommandLine, cchCommandLine, szUpdateCachePath))
        || FAILED(StringCchCat(szCommandLine, cchCommandLine, "\"")))
    {
        delete [] szCommandLine;
        return ERROR_INSTALL_FAILURE;
    }

    //
    // Run the verification process. We use a copy of ourselves to do this.
    //
    if(!WIN::CreateProcess(NULL, szCommandLine, NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE, NULL, NULL, &sui, &pi))
    {
        // failed to launch.
        delete [] szCommandLine;
        dwResult = GetLastError();
        return dwResult;
    }

    dwResult = WaitForProcess(pi.hProcess);
    if(ERROR_SUCCESS != dwResult)
    {
        delete [] szCommandLine;
        return dwResult;
    }

    DWORD dwExitCode = 0;
    WIN::GetExitCodeProcess(pi.hProcess, &dwExitCode);

    WIN::CloseHandle(pi.hProcess);

    DebugMsg("[Info] Verification of Update returned %d\n", dwExitCode);

    delete [] szCommandLine;

    return dwExitCode;
}

bool IsMsiUpgradeNecessary ( ULONG ulReqMsiMinVer )

Definition at line 29 of file upgrdmsi.cpp.

{
    // attempt to load msi.dll in the system directory

    char szSysMsiDll[MAX_PATH] = {0};
    char szSystemFolder[MAX_PATH] = {0};

    DWORD dwRet = WIN::GetSystemDirectory(szSystemFolder, MAX_PATH);
    if (0 == dwRet || MAX_PATH < dwRet)
    {
        // failure or buffer too small; assume upgrade is necessary
        DebugMsg("[Info] Can't obtain system directory; assuming upgrade is necessary");
        return true;
    }

    if (FAILED(StringCchCopy(szSysMsiDll, sizeof(szSysMsiDll)/sizeof(szSysMsiDll[0]), szSystemFolder))
        || FAILED(StringCchCat(szSysMsiDll, sizeof(szSysMsiDll)/sizeof(szSysMsiDll[0]), "\\MSI.DLL")))
    {
        // failure to get path to msi.dll; assume upgrade is necessary
        DebugMsg("[Info] Can't obtain msi.dll path; assuming upgrade is necessary");
        return true;
    }

    HINSTANCE hinstMsiSys = LoadLibrary(szSysMsiDll);
    if (0 == hinstMsiSys)
    {
        // can't load msi.dll; assume upgrade is necessary
        DebugMsg("[Info] Can't load msi.dll; assuming upgrade is necessary");

        return true;
    }
    FreeLibrary(hinstMsiSys);

    // get version on msi.dll
    DWORD dwInstalledMSVer;
    dwRet = GetFileVersionNumber(szSysMsiDll, &dwInstalledMSVer, NULL);
    if (ERROR_SUCCESS != dwRet)
    {
        // can't obtain version information; assume upgrade is necessary
        DebugMsg("[Info] Can't obtain version information; assuming upgrade is necessary");

        return true;
    }

    // compare version in system to the required minimum
    ULONG ulInstalledVer = HIWORD(dwInstalledMSVer) * 100 + LOWORD(dwInstalledMSVer);
    if (ulInstalledVer < ulReqMsiMinVer)
    {
        // upgrade is necessary
        DebugMsg("[Info] Windows Installer upgrade is required.  System Version = %d, Minimum Version = %d.\n", ulInstalledVer, ulReqMsiMinVer);

        return true;
    }

    // no upgrade is necessary
    DebugMsg("[Info] No upgrade is necessary.  System version meets minimum requirements\n");
    return false;
}

bool IsUpdateRequiredVersion | ( | LPSTR | szFilename,
 |  | ULONG | ulMinVer
 | ) |  |

Definition at line 376 of file upgrdmsi.cpp.

{
    // get version of update package
    DWORD dwUpdateMSVer;
    DWORD dwRet = GetFileVersionNumber(szFilename, &dwUpdateMSVer, NULL);
    if (ERROR_SUCCESS != dwRet)
    {
        // can't obtain version information; assume not proper version
        DebugMsg("[Info] Can't obtain version information for update package; assuming it is not the proper version\n");
        return false;
    }

    // compare version at source to required minimum
    ULONG ulSourceVer = HIWORD(dwUpdateMSVer) * 100 + LOWORD(dwUpdateMSVer);
    if (ulSourceVer < ulMinVer)
    {
        // source version won't get us to our minimum version
        char szDebugOutput[MAX_STR_LENGTH] = {0};
        DebugMsg("[Info] The update package is improper version for upgrade. Update package Version = %d, Minimum Version = %d.\n", ulSourceVer, ulMinVer);

        return false;
    }

    return true;
}

UINT UpgradeMsi | ( | HINSTANCE | hInst,
 |  | CDownloadUI * | piDownloadUI,
 |  | LPCSTR | szAppTitle,
 |  | LPCSTR | szBase,
 |  | LPCSTR | szUpdate,
 |  | ULONG | ulMinVer
 | ) |  |

Definition at line 92 of file upgrdmsi.cpp.

{
    char *szTempPath    = 0;
    char *szUpdatePath = 0;
    char *szFilePart    = 0;

    DWORD cchTempPath    = 0;
    DWORD cchUpdatePath = 0;
    DWORD cchReturn      = 0;
    DWORD dwLastError    = 0;
    DWORD dwFileAttrib   = 0;
    UINT  uiRet          = 0;

    HRESULT hr           = S_OK;

    // generate the path to the MSI update file =  szBase + szUpdate
    //   note: szUpdate is a relative path

    cchTempPath = lstrlen(szBase) + lstrlen(szUpdate) + 2; // 1 for null terminator, 1 for back slash
    szTempPath = new char[cchTempPath];
    if (!szTempPath)
    {
        ReportErrorOutOfMemory(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle);
        uiRet = ERROR_OUTOFMEMORY;
        goto CleanUp;
    }
    memset((void*)szTempPath, 0x00, cchTempPath*sizeof(char));

    // find 'setup.exe' in the path so we can remove it -- this is an already expanded path, that represents
    //  our current running location.  It includes our executable name -- we want to find that and get rid of it
    if (0 == GetFullPathName(szBase, cchTempPath, szTempPath, &szFilePart))
    {
        uiRet = GetLastError();
        PostFormattedError(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle, IDS_INVALID_PATH, szTempPath);
        goto CleanUp;
    }
    if (szFilePart)
        *szFilePart = '\0';

    hr = StringCchCat(szTempPath, cchTempPath, szUpdate);
    if (FAILED(hr))
    {
        uiRet = HRESULT_CODE(hr);
        PostFormattedError(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle, IDS_INVALID_PATH, szTempPath);
        goto CleanUp;
    }

    cchUpdatePath = 2*cchTempPath;
    szUpdatePath = new char[cchUpdatePath];
    if (!szUpdatePath)
    {
        ReportErrorOutOfMemory(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle);
        uiRet = ERROR_OUTOFMEMORY;
        goto CleanUp;
    }

    // normalize the path
    cchReturn = GetFullPathName(szTempPath, cchUpdatePath, szUpdatePath, &szFilePart);
    if (cchReturn > cchUpdatePath)
    {
        // try again, with larger buffer
        delete [] szUpdatePath;
        cchUpdatePath = cchReturn;
        szUpdatePath = new char[cchUpdatePath];
        if (!szUpdatePath)
        {
            ReportErrorOutOfMemory(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle);
            uiRet = ERROR_OUTOFMEMORY;
            goto CleanUp;
        }
        cchReturn = GetFullPathName(szTempPath, cchUpdatePath, szUpdatePath, &szFilePart);
    }
    if (0 == cchReturn)
    {
        uiRet = GetLastError();
        PostFormattedError(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle, IDS_INVALID_PATH, szTempPath);
        goto CleanUp;
    }

    // no download is necessary -- but we can check for the file's existence
    dwFileAttrib = GetFileAttributes(szUpdatePath);
    if (0xFFFFFFFF == dwFileAttrib)
    {
        // Update executable is missing
        PostFormattedError(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle, IDS_NOUPDATE, szUpdatePath);
        uiRet = ERROR_FILE_NOT_FOUND;
        goto CleanUp;
    }

    uiRet = ValidateUpdate(hInst, piDownloadUI, szAppTitle, szUpdatePath, szUpdatePath, ulMinVer);

CleanUp:
    if (szTempPath)
        delete [] szTempPath;
    if (szUpdatePath)
        delete [] szUpdatePath;

    return uiRet;
}

UINT ValidateUpdate | ( | HINSTANCE | hInst,
 |  | CDownloadUI * | piDownloadUI,
 |  | LPCSTR | szAppTitle,
 |  | LPSTR | szUpdatePath,
 |  | LPCSTR | szModuleFile,
 |  | ULONG | ulMinVer
 | ) |  |

Definition at line 406 of file upgrdmsi.cpp.

{
    UINT uiRet = ERROR_SUCCESS;

    char szShortPath[MAX_PATH]          = {0};

    // ensure Update is right version for Windows Installer upgrade
    if (!IsUpdateRequiredVersion(szUpdatePath, ulMinVer))
    {
        // Update won't get us the right upgrade
        PostFormattedError(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle, IDS_INCORRECT_UPDATE, szUpdatePath);
        return ERROR_INVALID_PARAMETER;
    }

    // upgrade msi
    uiRet = ExecuteUpgradeMsi(szUpdatePath);
    switch (uiRet)
    {
    case ERROR_SUCCESS:
    case ERROR_SUCCESS_REBOOT_REQUIRED:
        {
            // nothing required at this time
            break;
        }
    case ERROR_FILE_NOT_FOUND:
        {
            // Update executable not found
            PostFormattedError(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle, IDS_NOUPDATE, szUpdatePath);
            break;
        }
    default: // failure
        {
            // report error
            PostError(hInst, piDownloadUI->GetCurrentWindow(), szAppTitle, IDS_FAILED_TO_UPGRADE_MSI);
            break;
        }
    }
    return uiRet;
}

DWORD WaitForProcess ( HANDLE handle )

Definition at line 588 of file upgrdmsi.cpp.

{
    DWORD dwResult = NOERROR;

    MSG msg;
    memset((void*)&msg, 0x00, sizeof(MSG));

    //loop forever to wait
    while (true)
    {
        //wait for object
        switch (WIN::MsgWaitForMultipleObjects(1, &handle, false, INFINITE, QS_ALLINPUT))
        {
        //success!
        case WAIT_OBJECT_0:
            goto Finish;

        //not the process that we're waiting for
        case (WAIT_OBJECT_0 + 1):
            {
                if (WIN::PeekMessage(&msg, NULL, NULL, NULL, PM_REMOVE))
                {
                    WIN::TranslateMessage(&msg);
                    WIN::DispatchMessage(&msg);
                }

                break;
            }
        //did not return an OK; return error status
        default:
            {
                dwResult = WIN::GetLastError();
                goto Finish;
            }
        }
    }

Finish:
    return dwResult;
}

Generated on Wed Nov 13 2024 16:54:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/Msi/setup.exe/utils.cpp File Reference

  • SysMgmt
  • Msi
  • setup.exe
Defines | Typedefs | Functions | Variables

utils.cpp File Reference

#include "setup.h"
#include "resource.h"
#include "common.h"
#include "msi.h"
#include <assert.h>
#include <tchar.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <strsafe.h>

Go to the source code of this file.

Defines

#define | ADVAPI32_DLL "advapi32.dll"
#define | ADVAPI32API_AdjustTokenPrivileges "AdjustTokenPrivileges"
#define | ADVAPI32API_CheckTokenMembership "CheckTokenMembership"
#define | ADVAPI32API_LookupPrivilegeValue "LookupPrivilegeValueA"
#define | ADVAPI32API_OpenProcessToken "OpenProcessToken"
#define | WIN

Typedefs

typedef BOOL(WINAPI * | PFnAdjustTokenPrivileges )(HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength)
typedef BOOL(WINAPI * | PFnCheckTokenMembership )(HANDLE TokenHandle, PSID SidToCheck, PBOOL IsMember)
typedef BOOL(WINAPI * | PFnLookupPrivilegeValue )(LPCSTR lpSystemName, LPCSTR lpName, PLUID lpLuid)
typedef BOOL(WINAPI * | PFnOpenProcessToken )(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)

Functions

bool | AcquireShutdownPrivilege ()
bool | AlreadyInProgress ()
void | DebugMsg (LPCSTR szFormat,...)
void | DisplayUsage (HINSTANCE hInst, HWND hwndOwner, LPCSTR szCaption)
DWORD | GetAdminInstallInfo (bool fPatch, LPSTR lpszCmdLine, LPCSTR *ppszAdminImagePath)
emEnum | GetExecutionMode (LPCSTR lpszCmdLine)
DWORD | GetFileVersionNumber (LPSTR szFilename, DWORD *pdwMSVer, DWORD *pdwLSVer)
DWORD | GetNextArgument (LPCSTR pszCmdLine, LPCSTR *ppszArgStart, LPCSTR *ppszArgEnd, bool *pfQuoted)
bool | IsAdmin ()
bool | IsOSSupported ()
UINT | LoadResourceString (HINSTANCE hInst, LPCSTR lpType, LPCSTR lpName, LPSTR lpBuf, DWORD *pdwBufSize)
bool | MimimumWindowsPlatform (DWORD dwMajorVersion, DWORD dwMinorVersion, WORD wServicePackMajor)
void | PostError (HINSTANCE hInst, HWND hwndOwner, LPCSTR szTitle, UINT uiErrorId)
void | PostError (HINSTANCE hInst, HWND hwndOwner, LPCSTR szTitle, UINT uiErrorId, LPCSTR szValue)
void | PostError (HINSTANCE hInst, HWND hwndOwner, LPCSTR szTitle, UINT uiErrorId, LPCSTR szValue, int iValue)
void | PostError (HINSTANCE hInst, HWND hwndOwner, LPCSTR szTitle, UINT uiErrorId, int iValue)
void | PostFormattedError (HINSTANCE hInst, HWND hwndOwner, LPCSTR szTitle, UINT uiErrorId, LPCSTR szValue)
void | PostMsiError (HINSTANCE hInst, HINSTANCE hMsi, HWND hwndOwner, LPCSTR szTitle, UINT uiErrorId)
void | PostResourceNotFoundError (HINSTANCE hInst, HWND hwndOwner, LPCSTR szTitle, LPCSTR szName)
void | ReportErrorOutOfMemory (HINSTANCE hInst, HWND hwndOwner, LPCSTR szCaption)
void | ReportUserCancelled (HINSTANCE hInst, HWND hwndOwner, LPCSTR szTitle)
void | SetDiagnosticMode ()
UINT | SetupLoadResourceString (HINSTANCE hInst, LPCSTR lpName, LPSTR *lppBuf, DWORD dwBufSize)
DWORD | VerifyFileSignature (LPCSTR lpszModule, LPSTR lpszCmdLine)

Variables

int | g_dmDiagnosticMode = -1

Define Documentation

#define ADVAPI32_DLL "advapi32.dll"

Definition at line 612 of file utils.cpp.

#define ADVAPI32API_AdjustTokenPrivileges "AdjustTokenPrivileges"

Definition at line 617 of file utils.cpp.

#define ADVAPI32API_CheckTokenMembership "CheckTokenMembership"

Definition at line 614 of file utils.cpp.

#define ADVAPI32API_LookupPrivilegeValue "LookupPrivilegeValueA"

Definition at line 623 of file utils.cpp.

#define ADVAPI32API_OpenProcessToken "OpenProcessToken"

Definition at line 620 of file utils.cpp.

#define WIN

Definition at line 22 of file utils.cpp.

Typedef Documentation

typedef BOOL(WINAPI* PFnAdjustTokenPrivileges)(HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength)

Definition at line 618 of file utils.cpp.

typedef BOOL(WINAPI* PFnCheckTokenMembership)(HANDLE TokenHandle, PSID SidToCheck, PBOOL IsMember)

Definition at line 615 of file utils.cpp.

typedef BOOL(WINAPI* PFnLookupPrivilegeValue)(LPCSTR lpSystemName, LPCSTR lpName, PLUID lpLuid)

Definition at line 624 of file utils.cpp.

typedef BOOL(WINAPI* PFnOpenProcessToken)(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)

Definition at line 621 of file utils.cpp.

Function Documentation

bool AcquireShutdownPrivilege ( )

Definition at line 673 of file utils.cpp.

{
    HANDLE hToken = 0;
    TOKEN_PRIVILEGES tkp;

    HMODULE hAdvapi32 = LoadLibrary(ADVAPI32_DLL);
    if (!hAdvapi32)
        return false;

    PFnOpenProcessToken pfnOpenProcessToken = (PFnOpenProcessToken)GetProcAddress(hAdvapi32, ADVAPI32API_OpenProcessToken);
    PFnLookupPrivilegeValue pfnLookupPrivilegeValue = (PFnLookupPrivilegeValue)GetProcAddress(hAdvapi32, ADVAPI32API_LookupPrivilegeValue);
    PFnAdjustTokenPrivileges pfnAdjustTokenPrivileges = (PFnAdjustTokenPrivileges)GetProcAddress(hAdvapi32, ADVAPI32API_AdjustTokenPrivileges);
    if (!pfnOpenProcessToken || !pfnLookupPrivilegeValue || !pfnAdjustTokenPrivileges)
    {
        FreeLibrary(hAdvapi32);
        return false;
    }

    // grab this process's token
    if (!pfnOpenProcessToken(WIN::GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))
    {
        FreeLibrary(hAdvapi32);
        return false;
    }

    // get the LUID for the shutdown privilege
    pfnLookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &tkp.Privileges[0].Luid);

    tkp.PrivilegeCount = 1; // one privilege to set
    tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;

    // get the shutdown privilege for this process
    pfnAdjustTokenPrivileges(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES)NULL, 0);

    // cannot test return value of AdjustTokenPrivileges
    if (ERROR_SUCCESS != WIN::GetLastError())
    {
        FreeLibrary(hAdvapi32);
        return false;
    }

    FreeLibrary(hAdvapi32);

    return true;
}

bool AlreadyInProgress ( )

Definition at line 451 of file utils.cpp.

{
    const char *szMutexName = "Global\\_MSISETUP_{2956EBA1-9B5A-4679-8618-357136DA66CA}";
    HANDLE hMutex = 0;

    hMutex = WIN::CreateMutex(NULL /*default security descriptor*/, FALSE, szMutexName);
    if (!hMutex || ERROR_ALREADY_EXISTS == GetLastError())
        return true;

    return false;
}

void DebugMsg | ( | LPCSTR | szFormat,
 |  |  | ...
 | ) |  |

Definition at line 745 of file utils.cpp.

{
    if (-1 == g_dmDiagnosticMode)
    {
        SetDiagnosticMode();
    }

    if (0 == g_dmDiagnosticMode)
        return; // debug output is not enabled

    size_t dwBuf = 512;
    char *szDebug = new char[dwBuf];
    if (!szDebug)
        return ; // out of memory

    // store the result debug string
    va_list listDebugArg;
    va_start(listDebugArg, szFormat);
    while (-1 == _vsnprintf(szDebug, dwBuf, szFormat, listDebugArg))
    {
        dwBuf *= 2;
        delete[] szDebug;
        szDebug = new char[dwBuf];
        if (!szDebug)
        {
            va_end(listDebugArg);
            return; // out of memory
        }
    }
    va_end(listDebugArg);

    OutputDebugString(szDebug);
}

void DisplayUsage | ( | HINSTANCE | hInst,
 |  | HWND | hwndOwner,
 |  | LPCSTR | szCaption
 | ) |  |

Definition at line 466 of file utils.cpp.

{
    char szMessage[MAX_STR_LENGTH];

    WIN::LoadString(hInst, IDS_USAGE, szMessage, sizeof(szMessage)/sizeof(char));
    WIN::MessageBox(hwndOwner, szMessage, szCaption, MB_OK | MB_ICONINFORMATION);
}

DWORD GetAdminInstallInfo | ( | bool | fPatch,
 |  | LPSTR | lpszCmdLine,
 |  | LPCSTR * | ppszAdminImagePath
 | ) |  |

Definition at line 177 of file utils.cpp.

{
    LPCSTR  pszFirstArgEnd;
    LPCSTR  pszFileName;
    LPCSTR  pszEnd;
    DWORD   Status;

    //
    // When this function is called, the first argument has already been
    // verified. So skip the first argument.
    //
    GetNextArgument (lpszCmdLine, NULL, &pszFirstArgEnd, NULL);

    // See if there is another argument
    Status = GetNextArgument (CharNextA(pszFirstArgEnd), &pszFileName, &pszEnd, NULL);

    // If it is not a patch, there should not be any more arguments.
    if (!fPatch)
    {
        if (ERROR_NO_MORE_ITEMS != Status)
            return ERROR_BAD_ARGUMENTS;

        // If we are here, then we are done, because we have all the information we need.
        if (ppszAdminImagePath)
            *ppszAdminImagePath = NULL;
        return ERROR_SUCCESS;
    }

    // If we are here, this is a patch. Get the path to the admin. install.
    if (ERROR_NO_MORE_ITEMS == Status)
        return ERROR_BAD_ARGUMENTS;     // No path was supplied.

    // Should not have any more arguments.
    if ('\0' != *(CharNextA(pszEnd)) &&
        ERROR_NO_MORE_ITEMS != GetNextArgument (CharNextA(CharNextA(pszEnd)), NULL, NULL, NULL))
    {
        return ERROR_BAD_ARGUMENTS;
    }

    // We have the right arguments. Null terminate the pathname.
    *(CharNextA(pszEnd)) = '\0';

    if (ppszAdminImagePath)
        *ppszAdminImagePath = pszFileName;

    return ERROR_SUCCESS;
}

emEnum GetExecutionMode ( LPCSTR lpszCmdLine )

Definition at line 72 of file utils.cpp.

{
    LPCSTR  pszStart = NULL;
    LPCSTR  pszEnd = NULL;
    DWORD   dwStatus = ERROR_SUCCESS;
    bool    fQuoted = false;
    //
    // Check the first argument and set the execution mode accordingly.
    // When run without arguments, it is assumed that the default install
    // preset by the package publisher needs to be performed.
    //
    // In case an invalid option is provided, the help dialog describing the
    // usage must be displayed.
    //
    dwStatus = GetNextArgument (lpszCmdLine, &pszStart, &pszEnd, &fQuoted);

    if (ERROR_NO_MORE_ITEMS == dwStatus)
        return emPreset;

    // The only allowed values in the first argument are /a, /v and /?
    if (pszEnd != CharNextA(pszStart) || fQuoted)
        return emHelp;

    if ('/' != (*pszStart) && '-' != (*pszStart))
        return emHelp;

    switch (*pszEnd)
    {
    case 'a':
    case 'A':
        return emAdminInstall;
    case 'v':
    case 'V':
        return emVerify;
    default:
        return emHelp;
    }
}

DWORD GetFileVersionNumber | ( | LPSTR | szFilename,
 |  | DWORD * | pdwMSVer,
 |  | DWORD * | pdwLSVer
 | ) |  |

Definition at line 491 of file utils.cpp.

{
    DWORD             dwResult = NOERROR;
    unsigned          uiSize;
    DWORD             dwVerInfoSize;
    DWORD             dwHandle;
    BYTE              *prgbVersionInfo = NULL;
    VS_FIXEDFILEINFO  *lpVSFixedFileInfo = NULL;

    DWORD dwMSVer = 0xffffffff;
    DWORD dwLSVer = 0xffffffff;

    dwVerInfoSize = GetFileVersionInfoSize(szFilename, &dwHandle);
    if (0 != dwVerInfoSize)
    {
        prgbVersionInfo = (LPBYTE) WIN::GlobalAlloc(GPTR, dwVerInfoSize);
        if (NULL == prgbVersionInfo)
        {
            dwResult = ERROR_NOT_ENOUGH_MEMORY;
            goto Finish;
        }

        // Read version stamping info
        if (GetFileVersionInfo(szFilename, dwHandle, dwVerInfoSize, prgbVersionInfo))
        {
            // get the value for Translation
            if (VerQueryValue(prgbVersionInfo, "\\", (LPVOID*)&lpVSFixedFileInfo, &uiSize) && (uiSize != 0))
            {
                dwMSVer = lpVSFixedFileInfo->dwFileVersionMS;
                dwLSVer = lpVSFixedFileInfo->dwFileVersionLS;
            }
        }
        else
        {
            dwResult = GetLastError();
            goto Finish;
        }
    }
    else
    {
        dwResult = GetLastError();
    }

#ifdef DEBUG
    char szVersion[255];
    StringCchPrintf(szVersion, sizeof(szVersion), "%s is version %d.%d.%d.%d\n", szFilename, HIWORD(dwMSVer), LOWORD(dwMSVer), HIWORD(dwLSVer), LOWORD(dwLSVer));
    DebugMsg("[INFO] %s", szVersion);
#endif // DEBUG

Finish:
    if (NULL != prgbVersionInfo)
        WIN::GlobalFree(prgbVersionInfo);
    if (pdwMSVer)
        *pdwMSVer = dwMSVer;
    if (pdwLSVer)
        *pdwLSVer = dwLSVer;

    return dwResult;
}

DWORD GetNextArgument | ( | LPCSTR | pszCmdLine,
 |  | LPCSTR * | ppszArgStart,
 |  | LPCSTR * | ppszArgEnd,
 |  | bool * | pfQuoted
 | ) |  |

Definition at line 114 of file utils.cpp.

{
    bool    fInQuotes = false;
    bool    fFoundArgEnd = false;
    LPCSTR  pszChar = pszCmdLine;
    LPCSTR  pszFirst = NULL;
    LPCSTR  pszLast = NULL;

    if (NULL == pszChar)
        return ERROR_NO_MORE_ITEMS;

    // Skip leading spaces.
    while (' ' == *pszChar || '\t' == *pszChar)
        pszChar = CharNextA(pszChar);

    // Check if we have run out of arguments.
    if ('\0' == (*pszChar))
        return ERROR_NO_MORE_ITEMS;

    // Check if we this argument has been enclosed in quotes
    if ('\"' == (*pszChar))
    {
        fInQuotes = true;
        pszChar = CharNextA (pszChar);
    }

    pszFirst = pszChar;

    // Now look for the end of the argument
    while (! fFoundArgEnd)
    {
        pszChar = CharNextA(pszChar);

        if ('\0' == (*pszChar))
            fFoundArgEnd = true;

        if (fInQuotes && '\"' == (*pszChar))
            fFoundArgEnd = true;

        if (!fInQuotes && ' ' == (*pszChar))
            fFoundArgEnd = true;

        if (!fInQuotes && '\t' == (*pszChar))
            fFoundArgEnd = true;
    }

    pszLast = CharPrevA (pszFirst, pszChar);

    if (ppszArgStart)
        *ppszArgStart = pszFirst;

    if (ppszArgEnd)
        *ppszArgEnd = pszLast;

    if (pfQuoted)
        *pfQuoted = fInQuotes;

    return ERROR_SUCCESS;
}

bool IsAdmin ( )

Definition at line 635 of file utils.cpp.

{
    // get the administrator sid
    PSID psidAdministrators;
    SID_IDENTIFIER_AUTHORITY siaNtAuthority = SECURITY_NT_AUTHORITY;
    if(!AllocateAndInitializeSid(&siaNtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &psidAdministrators))
        return false;

    // on NT5, use the CheckTokenMembershipAPI to correctly handle cases where
    // the Adiminstrators group might be disabled. bIsAdmin is BOOL for
    BOOL bIsAdmin = FALSE;
    // CheckTokenMembership checks if the SID is enabled in the token. NULL for
    // the token means the token of the current thread. Disabled groups, restricted
    // SIDS, and SE_GROUP_USE_FOR_DENY_ONLY are all considered. If the function
    // returns false, ignore the result.

    HMODULE hAdvapi32 = LoadLibrary(ADVAPI32_DLL);
    if (!hAdvapi32)
        bIsAdmin = FALSE;
    else
    {
        PFnCheckTokenMembership pfnCheckTokenMembership = (PFnCheckTokenMembership)GetProcAddress(hAdvapi32, ADVAPI32API_CheckTokenMembership);
        if (!pfnCheckTokenMembership || !pfnCheckTokenMembership(NULL, psidAdministrators, &bIsAdmin))
            bIsAdmin = FALSE;
    }
    FreeLibrary(hAdvapi32);
    hAdvapi32 = 0;

    WIN::FreeSid(psidAdministrators);
    return bIsAdmin ? true : false;

}

bool IsOSSupported ( )

Definition at line 587 of file utils.cpp.

{
    OSVERSIONINFO sInfoOS;
    memset((void*)&sInfoOS, 0x00, sizeof(OSVERSIONINFO));

    sInfoOS.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
    WIN::GetVersionEx(&sInfoOS);

    // We do no support any platform prior to Windows 2000
    if (5 > sInfoOS.dwMajorVersion)
        return false;

    // We support:
    if(MimimumWindowsPlatform(5, 2, 0) ||   // Windows 2003 and above
       MimimumWindowsPlatform(5, 1, 0) ||   // Windows XP and above
       MimimumWindowsPlatform(5, 0, 3))     // Windows 2000 SP3 and above
        return true;
    else
        return false;
}

UINT LoadResourceString | ( | HINSTANCE | hInst,
 |  | LPCSTR | lpType,
 |  | LPCSTR | lpName,
 |  | LPSTR | lpBuf,
 |  | DWORD * | pdwBufSize
 | ) |  |

Definition at line 228 of file utils.cpp.

{
    HRSRC   hRsrc   = 0;
    HGLOBAL hGlobal = 0;
    WCHAR   *pch    = 0;

    if ((hRsrc = WIN::FindResource(hInst, lpName, lpType)) != 0
        && (hGlobal = WIN::LoadResource(hInst, hRsrc)) != 0)
    {
        // resource exists
        if ((pch = (WCHAR*)LockResource(hGlobal)) != 0)
        {
            unsigned int cch = WideCharToMultiByte(CP_ACP, 0, pch, -1, NULL, 0, NULL, NULL);
            if (cch > *pdwBufSize)
            {
                *pdwBufSize = cch;
                return ERROR_MORE_DATA;
            }

            if (0 == WideCharToMultiByte(CP_ACP, 0, pch, -1, lpBuf, *pdwBufSize, NULL, NULL))
                return ERROR_FUNCTION_FAILED;
            *pdwBufSize = cch;

        }
        else
        {
            if (1 > *pdwBufSize)
            {
                *pdwBufSize = 1;
                return ERROR_MORE_DATA;
            }

            *pdwBufSize = 1;
            *lpBuf = 0;
        }

        DebugMsg("[Resource] lpName = %s, lpBuf = %s\n", lpName, lpBuf);

        return ERROR_SUCCESS;
    }

    // resource does not exist
    DebugMsg("[Resource] lpName = %s NOT FOUND\n", lpName);

    return ERROR_RESOURCE_NAME_NOT_FOUND;
}

bool MimimumWindowsPlatform | ( | DWORD | dwMajorVersion,
 |  | DWORD | dwMinorVersion,
 |  | WORD | wServicePackMajor
 | ) |  |

Definition at line 558 of file utils.cpp.

{
   OSVERSIONINFOEX osvi;
   DWORDLONG dwlConditionMask = 0;

   // Initialize the OSVERSIONINFOEX structure.
   ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
   osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
   osvi.dwMajorVersion = dwMajorVersion;
   osvi.dwMinorVersion = dwMinorVersion;
   osvi.wServicePackMajor = wServicePackMajor;

   // Initialize the condition mask.
   VER_SET_CONDITION(dwlConditionMask, VER_MAJORVERSION, VER_GREATER_EQUAL);
   VER_SET_CONDITION(dwlConditionMask, VER_MINORVERSION, VER_GREATER_EQUAL);
   VER_SET_CONDITION(dwlConditionMask, VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL);

   // Perform the test.
   return VerifyVersionInfo(&osvi,
                            VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR,
                            dwlConditionMask) ? true : false;
}

void PostError | ( | HINSTANCE | hInst,
 |  | HWND | hwndOwner,
 |  | LPCSTR | szTitle,
 |  | UINT | uiErrorId
 | ) |  |

Definition at line 337 of file utils.cpp.

{
    char szError[MAX_STR_LENGTH]  = {0};

    WIN::LoadString(hInst, uiErrorId, szError, sizeof(szError)/sizeof(char));
    MessageBox(hwndOwner, szError, szTitle, MB_OK | MB_ICONERROR);
}

void PostError | ( | HINSTANCE | hInst,
 |  | HWND | hwndOwner,
 |  | LPCSTR | szTitle,
 |  | UINT | uiErrorId,
 |  | LPCSTR | szValue
 | ) |  |

Definition at line 349 of file utils.cpp.

{
    char szError[MAX_STR_LENGTH]  = {0};
    char szFormat[MAX_STR_LENGTH] = {0};

    WIN::LoadString(hInst, uiErrorId, szFormat, sizeof(szFormat)/sizeof(char));
    StringCchPrintf(szError, sizeof(szError), szFormat, szValue);
    MessageBox(hwndOwner, szError, szTitle, MB_OK | MB_ICONERROR);
}

void PostError | ( | HINSTANCE | hInst,
 |  | HWND | hwndOwner,
 |  | LPCSTR | szTitle,
 |  | UINT | uiErrorId,
 |  | LPCSTR | szValue,
 |  | int | iValue
 | ) |  |

Definition at line 363 of file utils.cpp.

{
    char szError[MAX_STR_LENGTH]  = {0};
    char szFormat[MAX_STR_LENGTH] = {0};

    WIN::LoadString(hInst, uiErrorId, szFormat, sizeof(szFormat)/sizeof(char));
    StringCchPrintf(szError, sizeof(szError), szFormat, szValue, iValue);
    MessageBox(hwndOwner, szError, szTitle, MB_OK | MB_ICONERROR);
}

void PostError | ( | HINSTANCE | hInst,
 |  | HWND | hwndOwner,
 |  | LPCSTR | szTitle,
 |  | UINT | uiErrorId,
 |  | int | iValue
 | ) |  |

Definition at line 377 of file utils.cpp.

{
    char szError[MAX_STR_LENGTH]  = {0};
    char szFormat[MAX_STR_LENGTH] = {0};

    WIN::LoadString(hInst, uiErrorId, szFormat, sizeof(szFormat)/sizeof(char));
    StringCchPrintf(szError, sizeof(szError), szFormat, iValue);
    MessageBox(hwndOwner, szError, szTitle, MB_OK | MB_ICONERROR);
}

void PostFormattedError | ( | HINSTANCE | hInst,
 |  | HWND | hwndOwner,
 |  | LPCSTR | szTitle,
 |  | UINT | uiErrorId,
 |  | LPCSTR | szValue
 | ) |  |

Definition at line 391 of file utils.cpp.

{
    char szFormat[MAX_STR_LENGTH] = {0};
    const char* szArgs[1] = {szValue};
    LPVOID lpMessage = 0;;

    WIN::LoadString(hInst, uiErrorId, szFormat, sizeof(szFormat)/sizeof(char));
    FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY, (LPVOID)szFormat, 0, 0, (LPSTR)&lpMessage, 0, (va_list*)szArgs);
    if (!lpMessage)
    {
        ReportErrorOutOfMemory(hInst, hwndOwner, szTitle);
        return;
    }
    MessageBox(hwndOwner, (LPCSTR)lpMessage, szTitle, MB_OK | MB_ICONERROR);
    LocalFree(lpMessage);
}

void PostMsiError | ( | HINSTANCE | hInst,
 |  | HINSTANCE | hMsi,
 |  | HWND | hwndOwner,
 |  | LPCSTR | szTitle,
 |  | UINT | uiErrorId
 | ) |  |

Definition at line 412 of file utils.cpp.

{
    switch (uiErrorId)
    {
    case ERROR_INSTALL_SUSPEND:
    case ERROR_INSTALL_USEREXIT:
    case ERROR_INSTALL_FAILURE:
    case ERROR_SUCCESS_REBOOT_REQUIRED:
    case ERROR_SUCCESS_REBOOT_INITIATED:
    case ERROR_APPHELP_BLOCK:
        break;
    case ERROR_FILE_NOT_FOUND:
    case ERROR_INVALID_NAME:
    case ERROR_PATH_NOT_FOUND:
        uiErrorId = ERROR_INSTALL_PACKAGE_OPEN_FAILED;
    default:
        {
            char szError[MAX_STR_LENGTH] = {0};
            if (0 == WIN::LoadString(hMsi, uiErrorId, szError, sizeof(szError)/sizeof(char)))
            {
                // error string does not exist, use default
                PostError(hInst, hwndOwner, szTitle, IDS_INSTALL_ERROR, uiErrorId);
            }
            else
            {
                MessageBox(hwndOwner, szError, szTitle, MB_OK | MB_ICONERROR);
            }
            return;
        }
    }
}

void PostResourceNotFoundError | ( | HINSTANCE | hInst,
 |  | HWND | hwndOwner,
 |  | LPCSTR | szTitle,
 |  | LPCSTR | szName
 | ) |  |

Definition at line 311 of file utils.cpp.

{
    char szError[MAX_STR_LENGTH]  = {0};
    char szFormat[MAX_STR_LENGTH] = {0};

    WIN::LoadString(hInst, IDS_MISSING_RESOURCE, szFormat, sizeof(szFormat)/sizeof(char));
    StringCchPrintf(szError, sizeof(szError), szFormat, szName);
    MessageBox(hwndOwner, szError, szTitle, MB_OK | MB_ICONEXCLAMATION);
}

void ReportErrorOutOfMemory | ( | HINSTANCE | hInst,
 |  | HWND | hwndOwner,
 |  | LPCSTR | szCaption
 | ) |  |

Definition at line 478 of file utils.cpp.

{
    char szError[MAX_STR_LENGTH];

    WIN::LoadString(hInst, IDS_OUTOFMEM, szError, sizeof(szError)/sizeof(char));
    WIN::MessageBox(hwndOwner, szError, szCaption, MB_OK | MB_ICONERROR);
}

void ReportUserCancelled | ( | HINSTANCE | hInst,
 |  | HWND | hwndOwner,
 |  | LPCSTR | szTitle
 | ) |  |

Definition at line 325 of file utils.cpp.

{
    char szError[MAX_STR_LENGTH] = {0};

    WIN::LoadString(hInst, IDS_USER_CANCELLED, szError, sizeof(szError)/sizeof(char));
    MessageBox(hwndOwner, szError, szTitle, MB_OK | MB_ICONEXCLAMATION);
}

void SetDiagnosticMode ( )

Definition at line 727 of file utils.cpp.

{
    g_dmDiagnosticMode = 0; // disable DebugMsg to start

    char rgchBuf[64] = {0};
    if (0 != WIN::GetEnvironmentVariable(szDebugEnvVar, rgchBuf, sizeof(rgchBuf)/sizeof(char))
        && rgchBuf[0] == '1')
    {
        g_dmDiagnosticMode = 1; // enable DebugMsg output
    }
}

UINT SetupLoadResourceString | ( | HINSTANCE | hInst,
 |  | LPCSTR | lpName,
 |  | LPSTR * | lppBuf,
 |  | DWORD | dwBufSize
 | ) |  |

Definition at line 279 of file utils.cpp.

{
    UINT uiStat = 0;
    if (!*lppBuf)
    {
        dwBufSize = (dwBufSize > 0) ? dwBufSize : 256;
        *lppBuf = new char[dwBufSize];
        if (!*lppBuf)
            return ERROR_OUTOFMEMORY;
    }

    if (ERROR_SUCCESS != (uiStat = LoadResourceString(hInst, RT_INSTALL_PROPERTY, lpName, *lppBuf, &dwBufSize)))
    {
        if (uiStat != ERROR_MORE_DATA)
            return uiStat;

        // resize and try again
        delete [] *lppBuf;
        *lppBuf = new char[dwBufSize];
        if (!*lppBuf)
            return ERROR_OUTOFMEMORY;

        uiStat = LoadResourceString(hInst, RT_INSTALL_PROPERTY, lpName, *lppBuf, &dwBufSize);
    }

    return uiStat;
}

DWORD VerifyFileSignature | ( | LPCSTR | lpszModule,
 |  | LPSTR | lpszCmdLine
 | ) |  |

Definition at line 27 of file utils.cpp.

{
    LPCSTR  pszFirstArgEnd;
    LPCSTR  pszFileName;
    LPCSTR  pszEnd;
    DWORD   Status;

    //
    // When this function is called, the first argument has already
    // been verified. So skip the first argument.
    //
    GetNextArgument (lpszCmdLine, NULL, &pszFirstArgEnd, NULL);

    // Now get the name of the file whose signature needs to be verified.
    Status = GetNextArgument (CharNextA(pszFirstArgEnd), &pszFileName, &pszEnd, NULL);

    // Must supply a filename
    if (ERROR_NO_MORE_ITEMS == Status)
        return ERROR_BAD_ARGUMENTS;

    // Should not have any more arguments
    if ('\0' != *(CharNextA(pszEnd)) &&
        ERROR_NO_MORE_ITEMS != GetNextArgument (CharNextA(CharNextA(pszEnd)), NULL, NULL, NULL))
    {
        return ERROR_BAD_ARGUMENTS;
    }

    // We have the right arguments. Null terminate the filename.
    *(CharNextA(pszEnd)) = '\0';

    switch (IsPackageTrusted(lpszModule, pszFileName, NULL))
    {
    case itvWintrustNotOnMachine:
        return TRUST_E_PROVIDER_UNKNOWN;
    case itvTrusted:
        return ERROR_SUCCESS;
    case itvUnTrusted:
    default:
        return TRUST_E_SUBJECT_NOT_TRUSTED;
    }
}

Variable Documentation

int g_dmDiagnosticMode = -1

Definition at line 725 of file utils.cpp.

Generated on Wed Nov 13 2024 16:53:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/Msi/setup.exe/vertrust.cpp File Reference

  • SysMgmt
  • Msi
  • setup.exe
Defines | Typedefs | Functions

vertrust.cpp File Reference

#include <windows.h>
#include <tchar.h>
#include "setup.h"
#include "common.h"
#include "wintrust.h"
#include "softpub.h"

Go to the source code of this file.

Defines

#define | CRYPT32_DLL "crypt32.dll"
#define | CRYPTOAPI_CertCompareCertificate "CertCompareCertificate"
#define | CRYPTOAPI_CertDuplicateCertificateContext "CertDuplicateCertificateContext"
#define | CRYPTOAPI_CertFreeCertificateContext "CertFreeCertificateContext"
#define | MSI
#define | WIN
#define | WINTRUST_DLL "wintrust.dll"
#define | WINTRUSTAPI_WinVerifyTrust "WinVerifyTrust"
#define | WINTRUSTAPI_WTHelperGetProvCertFromChain "WTHelperGetProvCertFromChain"
#define | WINTRUSTAPI_WTHelperGetProvSignerFromChain "WTHelperGetProvSignerFromChain"
#define | WINTRUSTAPI_WTHelperProvDataFromStateData "WTHelperProvDataFromStateData"

Typedefs

typedef BOOL(WINAPI * | PFnCertCompareCertificate )(DWORD dwCertEncodingType, PCERT_INFO pCertId1, PCERT_INFO pCertId2)
typedef PCCERT_CONTEXT(WINAPI * | PFnCertDuplicateCertificateContext )(PCCERT_CONTEXT pCertContext)
typedef BOOL(WINAPI * | PFnCertFreeCertificateContext )(PCCERT_CONTEXT pCertContext)
typedef HRESULT(WINAPI * | PFnWinVerifyTrust )(HWND hwnd, GUID *pgActionID, WINTRUST_DATA *pWinTrustData)
typedef PCRYPT_PROVIDER_CERT(WINAPI * | PFnWTHelperGetProvCertFromChain )(PCRYPT_PROVIDER_SGNR pSgnr, DWORD idxCert)
typedef PCRYPT_PROVIDER_SGNR(WINAPI * | PFnWTHelperGetProvSignerFromChain )(PCRYPT_PROVIDER_DATA pProvData, DWORD idxSigner, BOOL fCounterSigner, DWORD idxCounterSigner)
typedef PCRYPT_PROVIDER_DATA(WINAPI * | PFnWTHelperProvDataFromStateData )(HANDLE hStateData)

Functions

itvEnum | IsFileTrusted (LPCWSTR lpwFile, HWND hwndParent, DWORD dwUIChoice, bool *pfIsSigned, PCCERT_CONTEXT *ppcSigner)
itvEnum | IsPackageTrusted (LPCSTR szSetupExe, LPCSTR szPackage, HWND hwndParent)

Define Documentation

#define CRYPT32_DLL "crypt32.dll"

Definition at line 26 of file vertrust.cpp.

#define CRYPTOAPI_CertCompareCertificate "CertCompareCertificate"

Definition at line 31 of file vertrust.cpp.

#define CRYPTOAPI_CertDuplicateCertificateContext "CertDuplicateCertificateContext"

Definition at line 28 of file vertrust.cpp.

#define CRYPTOAPI_CertFreeCertificateContext "CertFreeCertificateContext"

Definition at line 34 of file vertrust.cpp.

#define MSI

Definition at line 10 of file vertrust.cpp.

#define WIN

Definition at line 9 of file vertrust.cpp.

#define WINTRUST_DLL "wintrust.dll"

Definition at line 41 of file vertrust.cpp.

#define WINTRUSTAPI_WinVerifyTrust "WinVerifyTrust"

Definition at line 43 of file vertrust.cpp.

#define WINTRUSTAPI_WTHelperGetProvCertFromChain "WTHelperGetProvCertFromChain"

Definition at line 52 of file vertrust.cpp.

#define WINTRUSTAPI_WTHelperGetProvSignerFromChain "WTHelperGetProvSignerFromChain"

Definition at line 49 of file vertrust.cpp.

#define WINTRUSTAPI_WTHelperProvDataFromStateData "WTHelperProvDataFromStateData"

Definition at line 46 of file vertrust.cpp.

Typedef Documentation

typedef BOOL(WINAPI* PFnCertCompareCertificate)(DWORD dwCertEncodingType, PCERT_INFO pCertId1, PCERT_INFO pCertId2)

Definition at line 32 of file vertrust.cpp.

typedef PCCERT_CONTEXT(WINAPI* PFnCertDuplicateCertificateContext)(PCCERT_CONTEXT pCertContext)

Definition at line 29 of file vertrust.cpp.

typedef BOOL(WINAPI* PFnCertFreeCertificateContext)(PCCERT_CONTEXT pCertContext)

Definition at line 35 of file vertrust.cpp.

typedef HRESULT(WINAPI * PFnWinVerifyTrust)(HWND hwnd, GUID *pgActionID, WINTRUST_DATA *pWinTrustData)

Definition at line 44 of file vertrust.cpp.

typedef PCRYPT_PROVIDER_CERT(WINAPI* PFnWTHelperGetProvCertFromChain)(PCRYPT_PROVIDER_SGNR pSgnr, DWORD idxCert)

Definition at line 53 of file vertrust.cpp.

typedef PCRYPT_PROVIDER_SGNR(WINAPI * PFnWTHelperGetProvSignerFromChain)(PCRYPT_PROVIDER_DATA pProvData, DWORD idxSigner, BOOL fCounterSigner, DWORD idxCounterSigner)

Definition at line 50 of file vertrust.cpp.

typedef PCRYPT_PROVIDER_DATA(WINAPI * PFnWTHelperProvDataFromStateData)(HANDLE hStateData)

Definition at line 47 of file vertrust.cpp.

Function Documentation

itvEnum IsFileTrusted | ( | LPCWSTR | lpwFile,
 |  | HWND | hwndParent,
 |  | DWORD | dwUIChoice,
 |  | bool * | pfIsSigned,
 |  | PCCERT_CONTEXT * | ppcSigner
 | ) |  |

Definition at line 62 of file vertrust.cpp.

{
    char szDebugOutput[MAX_STR_LENGTH] = {0};

    itvEnum itv = itvUnTrusted;

    if (pfIsSigned)
        *pfIsSigned = false;
    if (ppcSigner)
        *ppcSigner  = 0;

    GUID guidAction = WINTRUST_ACTION_GENERIC_VERIFY_V2;

    WINTRUST_FILE_INFO sWintrustFileInfo;
    WINTRUST_DATA      sWintrustData;
    HRESULT            hr;

    memset((void*)&sWintrustFileInfo, 0x00, sizeof(WINTRUST_FILE_INFO)); // zero out
    memset((void*)&sWintrustData, 0x00, sizeof(WINTRUST_DATA)); // zero out

    sWintrustFileInfo.cbStruct = sizeof(WINTRUST_FILE_INFO);
    sWintrustFileInfo.pcwszFilePath = lpwFile;
    sWintrustFileInfo.hFile = NULL;

    sWintrustData.cbStruct            = sizeof(WINTRUST_DATA);
    sWintrustData.dwUIChoice          = dwUIChoice;
    sWintrustData.fdwRevocationChecks = WTD_REVOKE_NONE;
    sWintrustData.dwUnionChoice       = WTD_CHOICE_FILE;
    sWintrustData.pFile               = &sWintrustFileInfo;
    sWintrustData.dwStateAction       = (ppcSigner) ? WTD_STATEACTION_VERIFY : 0;

    HMODULE hWinTrust = LoadLibrary(WINTRUST_DLL);
    if (!hWinTrust)
    {
        // WinTrust is unavailable on the machine
        return itvWintrustNotOnMachine;
    }
    PFnWinVerifyTrust pfnWinVerifyTrust = (PFnWinVerifyTrust)GetProcAddress(hWinTrust, WINTRUSTAPI_WinVerifyTrust);
    PFnWTHelperProvDataFromStateData pfnWTHelperProvDataFromStateData= (PFnWTHelperProvDataFromStateData)GetProcAddress(hWinTrust, WINTRUSTAPI_WTHelperProvDataFromStateData);
    PFnWTHelperGetProvSignerFromChain pfnWTHelperGetProvSignerFromChain = (PFnWTHelperGetProvSignerFromChain)GetProcAddress(hWinTrust, WINTRUSTAPI_WTHelperGetProvSignerFromChain);
    PFnWTHelperGetProvCertFromChain pfnWTHelperGetProvCertFromChain = (PFnWTHelperGetProvCertFromChain)GetProcAddress(hWinTrust, WINTRUSTAPI_WTHelperGetProvCertFromChain);
    if (!pfnWinVerifyTrust || !pfnWTHelperProvDataFromStateData || !pfnWTHelperGetProvSignerFromChain || !pfnWTHelperGetProvCertFromChain)
    {
        // WinTrust is unavailable on the machine
        FreeLibrary(hWinTrust);
        return itvWintrustNotOnMachine;
    }

    hr = pfnWinVerifyTrust(/* UI Window Handle */ (dwUIChoice == WTD_UI_NONE) ? (HWND)INVALID_HANDLE_VALUE : hwndParent, &guidAction, &sWintrustData);
    DebugMsg("[WVT] WVT returned 0x%X\n", hr);

    itv = (TRUST_E_PROVIDER_UNKNOWN == hr) ? itvWintrustNotOnMachine : ((S_OK == hr) ? itvTrusted : itvUnTrusted);

    if (itvWintrustNotOnMachine == itv)
    {
        // release state data
        sWintrustData.dwUIChoice = WTD_UI_NONE;
        sWintrustData.dwStateAction = WTD_STATEACTION_CLOSE;
        pfnWinVerifyTrust((HWND)INVALID_HANDLE_VALUE, &guidAction, &sWintrustData);

        FreeLibrary(hWinTrust);
        return itv; // return immediately
    }

    if (pfIsSigned)
        *pfIsSigned = (TRUST_E_NOSIGNATURE == hr) ? false : true;

    if (TRUST_E_NOSIGNATURE == hr)
    {
        // release state data
        sWintrustData.dwUIChoice = WTD_UI_NONE;
        sWintrustData.dwStateAction = WTD_STATEACTION_CLOSE;
        pfnWinVerifyTrust((HWND)INVALID_HANDLE_VALUE, &guidAction, &sWintrustData);

        FreeLibrary(hWinTrust);
        return itv;
    }

    if (ppcSigner)
    {
        CRYPT_PROVIDER_DATA const *psProvData     = NULL;
        CRYPT_PROVIDER_SGNR       *psProvSigner   = NULL;
        CRYPT_PROVIDER_CERT       *psProvCert     = NULL;

        // grab the provider data
        psProvData = pfnWTHelperProvDataFromStateData(sWintrustData.hWVTStateData);
        if (psProvData)
        {
            // grab the signer data from the CRYPT_PROV_DATA
            psProvSigner = pfnWTHelperGetProvSignerFromChain((PCRYPT_PROVIDER_DATA)psProvData, 0 /*first signer*/, FALSE /* not a counter signer */, 0);
            if (psProvSigner)
            {
                // grab the signer cert from CRYPT_PROV_SGNR (pos 0 = signer cert; pos csCertChain-1 = root cert)
                psProvCert = pfnWTHelperGetProvCertFromChain(psProvSigner, 0);
            }
        }

        if (!psProvCert)
        {
            // some failure in obtaining the signer cert data
            *ppcSigner = 0;
        }
        else
        {
            // duplicate the cert
            HMODULE hCrypt32 = LoadLibrary(CRYPT32_DLL);
            if (hCrypt32)
            {
                PFnCertDuplicateCertificateContext pfnCertDuplicateCertificateContext = (PFnCertDuplicateCertificateContext)GetProcAddress(hCrypt32, CRYPTOAPI_CertDuplicateCertificateContext);
                if (pfnCertDuplicateCertificateContext)
                    *ppcSigner = pfnCertDuplicateCertificateContext(psProvCert->pCert);
                FreeLibrary(hCrypt32);
            }
        }

        // release state data
        sWintrustData.dwUIChoice = WTD_UI_NONE;
        sWintrustData.dwStateAction = WTD_STATEACTION_CLOSE;
        pfnWinVerifyTrust((HWND)INVALID_HANDLE_VALUE, &guidAction, &sWintrustData);
    }

    FreeLibrary(hWinTrust);
    return itv;
}

itvEnum IsPackageTrusted | ( | LPCSTR | szSetupExe,
 |  | LPCSTR | szPackage,
 |  | HWND | hwndParent
 | ) |  |

Definition at line 191 of file vertrust.cpp.

{
    WCHAR *szwSetup   = 0;
    WCHAR *szwPackage = 0;
    int   cchWide     = 0;

    bool    fPackageIsTrusted = false;
    bool    fSetupExeIsSigned = false;
    bool    fPackageIsSigned  = false;
    itvEnum itv               = itvUnTrusted;

    DWORD dwUILevel = 0;

    char szDebugOutput[MAX_STR_LENGTH] = {0};

    PCCERT_CONTEXT pcExeSigner = 0;
    PCCERT_CONTEXT pcMsiSigner = 0;

    HMODULE hCrypt32 = LoadLibrary(CRYPT32_DLL);
    if (!hCrypt32)
    {
        // no crypto on the machine
        return itvWintrustNotOnMachine;
    }
    PFnCertCompareCertificate pfnCertCompareCertificate = (PFnCertCompareCertificate)GetProcAddress(hCrypt32, CRYPTOAPI_CertCompareCertificate);
    PFnCertFreeCertificateContext pfnCertFreeCertificateContext = (PFnCertFreeCertificateContext)GetProcAddress(hCrypt32, CRYPTOAPI_CertFreeCertificateContext);
    if (!pfnCertCompareCertificate || !pfnCertFreeCertificateContext)
    {
        // no crypt on the machine
        FreeLibrary(hCrypt32);
        return itvWintrustNotOnMachine;
    }

    // convert szSetupExe to WIDE
    cchWide = MultiByteToWideChar(CP_ACP, 0, szSetupExe, -1, 0, 0);
    szwSetup = new WCHAR[cchWide];
    if (!szwSetup)
    {
        // out of memory
        FreeLibrary(hCrypt32);
        return itvUnTrusted;
    }
    if (0 == MultiByteToWideChar(CP_ACP, 0, szSetupExe, -1, szwSetup, cchWide))
    {
        // failed to convert string
        FreeLibrary(hCrypt32);
        delete [] szwSetup;
        return itvUnTrusted;
    }

    //
    // step 1: silently call WinVerifyTrust on szSetupExe, ignore return value - except for ivtWintrustNotOnMachine
    //

    DebugMsg("[WVT] step 1: silently call WinVerifyTrust on szSetupExe, ignoring return value\n");

    if (itvWintrustNotOnMachine == (itv = IsFileTrusted(szwSetup, hwndParent, WTD_UI_NONE, &fSetupExeIsSigned, &pcExeSigner)))
    {
        goto CleanUp;
    }

    DebugMsg("[WVT] fSetupExeIsSigned = %s\n", fSetupExeIsSigned ? "TRUE" : "FALSE");

    // convert szPackage to WIDE
    cchWide = MultiByteToWideChar(CP_ACP, 0, szPackage, -1, 0, 0);
    szwPackage = new WCHAR[cchWide];
    if (!szwPackage)
    {
        // out of memory
        FreeLibrary(hCrypt32);
        return itvUnTrusted;
    }
    if (0 == MultiByteToWideChar(CP_ACP, 0, szPackage, -1, szwPackage, cchWide))
    {
        // failed to convert string
        FreeLibrary(hCrypt32);
        return itvUnTrusted;
    }

    //
    // step 2: silently call WinVerifyTrust on szPackage, ignore return value - except for ivtWintrustNotOnMachine
    //

    if (fSetupExeIsSigned)
    {
        DebugMsg("[WVT] step2: silently call WinVerifyTrust on szPackage, ignoring return value\n");
        if (itvWintrustNotOnMachine == (itv = IsFileTrusted(szwPackage, hwndParent, WTD_UI_NONE, &fPackageIsSigned, &pcMsiSigner)))
        {
            goto CleanUp;
        }

        DebugMsg("[WVT] fPackageIsSigned = %s\n", fPackageIsSigned ? "TRUE" : "FALSE");
    }

    //
    // step 3: call WinVerifyTrust on szPackage, return value matters; use proper UI-level
    //

    if ( !fSetupExeIsSigned  // exe is not signed
        || !fPackageIsSigned // package is not signed
        || !pcExeSigner      // exe signer cert is missing
        || !pcMsiSigner      // package signer cert is missing
        || !pfnCertCompareCertificate(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, pcExeSigner->pCertInfo, pcMsiSigner->pCertInfo)) // signed by different certs
    {
        // always show UI
        DebugMsg("[WVT] step3: last call to WinVerifyTrust using full UI\n");
        dwUILevel = WTD_UI_ALL;
    }
    else
    {
        // show UI only if bad
        DebugMsg("[WVT] step3: last call to WinVerifyTrust showing UI only if something is wrong\n");
        dwUILevel = WTD_UI_NOGOOD;
    }

    itv = IsFileTrusted(szwPackage, hwndParent, dwUILevel, NULL, NULL);

    //
    // cleanup
    //

CleanUp:
    if (szwPackage)
        delete [] szwPackage;
    if (szwSetup)
        delete [] szwSetup;

    if (pcExeSigner)
        pfnCertFreeCertificateContext(pcExeSigner);
    if (pcMsiSigner)
        pfnCertFreeCertificateContext(pcMsiSigner);

    FreeLibrary(hCrypt32);

    return itv;
}

Generated on Wed Nov 13 2024 16:54:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/Msi/tutorial.dll/Tutorial.cpp File Reference

  • SysMgmt
  • Msi
  • tutorial.dll
Defines | Functions

Tutorial.cpp File Reference

#include <windows.h>
#include <tchar.h>
#include <shellapi.h>
#include "msiquery.h"
#include "strsafe.h"

Go to the source code of this file.

Defines

#define | WINDOWS_LEAN_AND_MEAN

Functions

UINT __stdcall | LaunchTutorial (MSIHANDLE hInstall)

Define Documentation

#define WINDOWS_LEAN_AND_MEAN

Definition at line 12 of file Tutorial.cpp.

Function Documentation

UINT __stdcall LaunchTutorial ( MSIHANDLE hInstall )

Definition at line 60 of file Tutorial.cpp.

{
  BOOL fSuccess = FALSE;

  // szTutorialFileKey is the primary key of the file in the
  // File table that identifies the file we wish to launch
  const TCHAR szTutorialFileKey[] = TEXT("[#Tutorial]");

  PMSIHANDLE hRecTutorial = MsiCreateRecord(1);

  if ( !hRecTutorial
    || ERROR_SUCCESS != MsiRecordSetString(hRecTutorial, 0, szTutorialFileKey))
    return ERROR_INSTALL_FAILURE;

  // determine buffer size
  DWORD cchPath = 0;
  if (ERROR_MORE_DATA == MsiFormatRecord(hInstall, hRecTutorial, TEXT(""), &cchPath))
  {
    // add 1 to cchPath since return count from MsiFormatRecord does not include terminating null
    TCHAR* szPath = new TCHAR[++cchPath];
    if (szPath)
    {
      if (ERROR_SUCCESS == MsiFormatRecord(hInstall, hRecTutorial, szPath, &cchPath))
      {
        // ensure quoted path to ShellExecute
        DWORD cchQuotedPath = lstrlen(szPath) + 1 + 2; // szPath + null terminator + enclosing quotes
        TCHAR* szQuotedPath = new TCHAR[cchQuotedPath];
        if (szQuotedPath
          && SUCCEEDED(StringCchCopy(szQuotedPath, cchQuotedPath, TEXT("\"")))
          && SUCCEEDED(StringCchCat(szQuotedPath, cchQuotedPath, szPath))
          && SUCCEEDED(StringCchCat(szQuotedPath, cchQuotedPath, TEXT("\""))))
        {
          // set up ShellExecute structure
          // file is the full path to the installed file
          SHELLEXECUTEINFO sei;
          ZeroMemory(&sei, sizeof(SHELLEXECUTEINFO));
          sei.fMask = SEE_MASK_FLAG_NO_UI; // don't show error UI, we'll just silently fail
          sei.hwnd = 0;
          sei.lpVerb = NULL; // use default verb, typically open
          sei.lpFile = szQuotedPath;
          sei.lpParameters = NULL;
          sei.lpDirectory = NULL;
          sei.nShow = SW_SHOWNORMAL;
          sei.cbSize = sizeof(sei);

          // spawn the browser to display HTML tutorial
          fSuccess = ShellExecuteEx(&sei);

          delete [] szQuotedPath;
        }
      }
      delete [] szPath;
    }
  }

  return (fSuccess) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
}

Generated on Wed Nov 13 2024 16:54:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/TaskSched/sa.Cpp File Reference

  • SysMgmt
  • TaskSched
Functions | Variables

sa.Cpp File Reference

#include <stdio.h>
#include <wchar.h>
#include <windows.h>
#include <mbctype.h>
#include <initguid.h>
#include <mstask.h>
#include <msterr.h>

Go to the source code of this file.

Functions

HRESULT | AddJob (LPWSTR, LPSYSTEMTIME, LPWSTR, LPWSTR, LPWSTR)
void | Cleanup (void)
HRESULT | ConvertToSystemTime (LPWSTR, LPSYSTEMTIME)
HRESULT | DeleteJob (LPWSTR)
void | DisplayHelp (LPWSTR)
HRESULT | EnumerateJobs (void)
HRESULT | Init (void)
LONG _CRTAPI1 | main (int argc, char **argv)

Variables

ITaskScheduler * | g_pITaskScheduler = NULL
const int | MAX_ACCOUNT_LENGTH = 127
const int | MAX_COMMAND_LENGTH = 255
const int | MAX_PASSWORD_LENGTH = 127
const int | MAX_TIME_LENGTH = 6

Function Documentation

HRESULT AddJob | ( | LPWSTR | lpwszJobName,
 |  | LPSYSTEMTIME | lptTime,
 |  | LPWSTR | lpwszCommand,
 |  | LPWSTR | lpwszUserName,
 |  | LPWSTR | lpwszPassword
 | ) |  |

Definition at line 674 of file sa.Cpp.

{
    HRESULT hr = S_OK;
    IUnknown *pIU;
    IScheduledWorkItem *pISWI;
    IPersistFile *pIPF;
    ITask *pITask;
    ITaskTrigger *pITaskTrig;
    DWORD dwTaskFlags, dwTrigFlags;
    WORD wTrigNumber;
    TASK_TRIGGER TaskTrig;
    WCHAR lpwszAppName[MAX_COMMAND_LENGTH];
    int i;

    //
    // Initialize the pointers to NULL, so that the fail-out routine works
    // All pointer cleanup will be done at the end of the routine.
    //

    pITask = NULL;
    pITaskTrig = NULL;
    pISWI = NULL;
    pIU = NULL;
    pIPF = NULL;

    // Add the task.  Most likely failure is that work item already exists.
    // Uses ITaskScheduler::NewWorkItem

    hr = g_pITaskScheduler->NewWorkItem(lpwszJobName,
                                        CLSID_CTask,
                                        IID_ITask,
                                        &pIU);
    if (FAILED(hr))
    {
        wprintf(L"Error:  Create New Task failed with 0x%x\n", hr);
        goto finish;
    }

    // We now have an IUnknown pointer.  This is queried for an ITask
    // pointer on the work item we just added.

    hr = pIU->QueryInterface(IID_ITask, (void **) &pITask);
    if (FAILED(hr))
    {
        wprintf(L"Error:  IUnknown failed to yield ITask with 0x%x\n", hr);
        goto finish;
    }

    //
    // In order for security to work and be set, later we need to
    // attach the task object to a file on disk.  Therefore,
    // we must use IPersistFile to save the task object.  This
    // also will confirm that the object on disk doesn't already
    // exist - which could be a potential source of later errors.
    //
    // The task scheduler does not normally commit jobs to disk
    // immediately upon creation because disk access is slow compared
    // to the in-memory operation of creating a task.  Therefore,
    // you can rapidly create lots of task objects (for instance,
    // in response to incoming net events) and commit when things
    // slow down.
    //
    // Here, we don't care about speed.
    //

    hr = pITask->QueryInterface(IID_IPersistFile, (void **) &pIPF);
    if (FAILED(hr))
    {
        wprintf(L"Error:  QI for IPersistFile failed with 0x%x\n", hr);
        goto finish;
    }

    hr = pIPF->Save(NULL, FALSE);
    if (FAILED(hr))
    {
        wprintf(L"Error:  Save object failed with 0x%x\n", hr);
        goto finish;
    }

    // Extract parameters from the application name
    // Note that there might not be any parameters at all.
    // We butcher a path like C:\Program Files\foo.exe, because
    // we break on space, but this is ok, because user could say
    // C:\progra~1\foo.exe instead.

    i = 0;
    while ((*lpwszCommand != L' ') && (*lpwszCommand != '\0'))
    {
        lpwszAppName[i] = *lpwszCommand;
        i++;

        // we've already verified the length of lpwszCommand (including NULL terminator) is <= MAX_COMMAND_LENGTH,
        // but it doesn't hurt to be extra paranoid regarding buffer overflows in case the code changes elsewhere

        if (i > MAX_COMMAND_LENGTH - 1)
        {
            wprintf(L"Error:  Attempted to exceed buffer size while copying application name\n");
            hr = E_FAIL;
            goto finish;
        }

        lpwszCommand++;
    }
    lpwszAppName[i] = L'\0';
    if (*lpwszCommand == L' ')
    {
        lpwszCommand++;
    }

    // Set command name with ITask::SetApplicationName

    hr = pITask->SetApplicationName(lpwszAppName);
    if (FAILED(hr))
    {
        wprintf(L"Error:  Failed to set command name (with parms) with 0x%x\n", hr);
        goto finish;
    }

    // Set task parameters with ITask::SetParameters

    hr = pITask->SetParameters(lpwszCommand);
    if (FAILED(hr))
    {
        wprintf(L"Error:  Failed to set parameters with 0x%x\n", hr);
        goto finish;
    }

    // Set the comment, so we know how this job got there
    // Uses ITask::SetComment

    hr = pITask->SetComment(L"This scheduled task created by command line SDK sample tool");
    if (FAILED(hr))
    {
        wprintf(L"Error:  Failed to set task comment with 0x%x\n", hr);
        goto finish;
    }

    // Set the flags on the task object
    // Use the base class member to do this - IScheduledWorkItem::SetFlags()

    hr = pITask->QueryInterface(IID_IScheduledWorkItem, (void **) &pISWI);
    if (FAILED(hr))
    {
        wprintf(L"Error:  Failed to get base class interface to set flags with 0x%x\n", hr);
        goto finish;
    }

    dwTaskFlags = TASK_FLAG_DELETE_WHEN_DONE;
    hr = pISWI->SetFlags(dwTaskFlags);

    // Release pISWI, since we no longer need it.

    pISWI->Release();
    pISWI = NULL;

    // Check for failure to set flags.  This really does not need
    // to be fatal.

    if (FAILED(hr))
    {
        wprintf(L"Error:  Failed to set task flags with 0x%x\n", hr);
        goto finish;
    }

    // Now, create a trigger to run the task at our specified time.
    // Uses ITask::CreateTrigger()

    hr = pITask->CreateTrigger(&wTrigNumber, &pITaskTrig);
    if (FAILED(hr))
    {
        wprintf(L"Error:  Failed to create a new trigger with 0x%x\n", hr);
        goto finish;
    }

    // Now, fill in the trigger as necessary.

    dwTrigFlags = 0;

    ZeroMemory((void*) &TaskTrig, sizeof(TASK_TRIGGER));

    TaskTrig.cbTriggerSize = sizeof(TASK_TRIGGER);
    TaskTrig.wBeginYear = lptTime->wYear;
    TaskTrig.wBeginMonth = lptTime->wMonth;
    TaskTrig.wBeginDay = lptTime->wDay;
    TaskTrig.wStartHour = lptTime->wHour;
    TaskTrig.wStartMinute = lptTime->wMinute;
    TaskTrig.rgFlags = dwTrigFlags;
    TaskTrig.TriggerType = TASK_TIME_TRIGGER_ONCE;

    // Add this trigger to the task using ITaskTrigger::SetTrigger

    hr = pITaskTrig->SetTrigger(&TaskTrig);
    if (FAILED(hr))
    {
        wprintf(L"Error:  Failed to set trigger to desired values with 0x%x\n", hr);
        goto finish;
    }

    //
    // We need to see if we support security, and we
    // do this by calling ITask::SetAccountInformation
    // and checking if the failure code is SCHED_E_NO_SECURITY_SERVICES
    // We could also use GetVersionEx() to find out if we
    // were running on Windows NT or not, but this is even easier.
    //

    hr = pITask->SetAccountInformation(lpwszUserName, lpwszPassword);
    if (hr != SCHED_E_NO_SECURITY_SERVICES)
    {

        // Check to see if username is null

        if (*lpwszPassword == L'\0')
        {
            // String conversion initialization

            UINT uCodePage = _getmbcp();

            // If password was null, chance username is, too.

            if (*lpwszUserName == L'\0')
            {
                wprintf(L"Enter username to run job %s as: ",lpwszJobName);

                // never use scanf() or wscanf(), as it is all too easy for a user to overflow the buffer
                // fgets() and fgetws() allow us to specify a maximum number of characters to read

                char lpszUserName[MAX_ACCOUNT_LENGTH];
                if (!fgets(lpszUserName, MAX_ACCOUNT_LENGTH, stdin))
                {
                    wprintf(L"Error:  User name input failed\n");
                    goto finish;
                }

                // eliminate the new line character if it was read
                // this will always be the case if the input is less than MAX_ACCOUNT_LENGTH - 1

                if (char* pNewLine = strchr(lpszUserName, '\n'))
                {
                    *pNewLine = '\0';
                }

                // Convert the string; be sure to check return value

                if (!MultiByteToWideChar(uCodePage, 0, lpszUserName, -1, lpwszUserName, MAX_ACCOUNT_LENGTH))
                {
                    hr = HRESULT_FROM_WIN32(GetLastError());
                    wprintf(L"Error:  Multibyte to wide character conversion failed with 0x%x\n", hr);
                    goto finish;
                }

                wprintf(L"\n");
            }

            wprintf(L"Enter password to user %s: ",lpwszUserName);

            // never use scanf() or wscanf(), as it is all too easy for a user to overflow the buffer
            // fgets() and fgetws() allow us to specify a maximum number of characters to read

            char lpszPassword[MAX_PASSWORD_LENGTH];
            if (!fgets(lpszPassword, MAX_PASSWORD_LENGTH, stdin))
            {
                wprintf(L"Error:  Password input failed\n");
                goto finish;
            }

            // eliminate the new line character if it was read
            // this will always be the case if the input is less than MAX_ACCOUNT_LENGTH - 1

            if (char* pNewLine = strchr(lpszPassword, '\n'))
            {
                *pNewLine = '\0';
            }

            // Convert the string; be sure to check return value

            if (!MultiByteToWideChar(uCodePage, 0, lpszPassword, -1, lpwszPassword, MAX_PASSWORD_LENGTH))
            {
                hr = HRESULT_FROM_WIN32(GetLastError());
                wprintf(L"Error:  Multibyte to wide character conversion failed with 0x%x\n", hr);
                goto finish;
            }

            wprintf(L"\n");
        }
    }

    // Set the account information using ITask::SetAccountInformation
    // This fails for Win9x, but we ignore the failure.
    //
    // Note that setting security is the LAST THING WE DO BEFORE SAVING
    // THE TASK.
    //

    hr = pITask->SetAccountInformation(lpwszUserName, lpwszPassword);
    if ((FAILED(hr)) && (hr != SCHED_E_NO_SECURITY_SERVICES))
    {
        wprintf(L"Error:  Failed to set credentials on task object with 0x%x\n",hr);
        goto finish;
    }

    // Make the changes permanent
    // Requires using IPersistFile::Save()

    if (! pIPF)
    {
        // Should not be in here if you got this far.

        wprintf(L"You failed to get an IPersistFile interface, cannot save\n");
        hr = E_FAIL;
        goto finish;
    }

    hr = pIPF->Save(NULL, FALSE);
    if (FAILED(hr))
    {
        wprintf(L"Error:  Failed to save object with 0x%x\n", hr);
        goto finish;
    }

finish:

    // We no longer need ITask

    if (pITask)
    {
        pITask->Release();
        pITask = NULL;
    }

    // Done with ITaskTrigger pointer

    if (pITaskTrig)
    {
        pITaskTrig->Release();
        pITaskTrig = NULL;
    }

    // Done with IPersistFile

    if (pIPF)
    {
        pIPF->Release();
        pIPF = NULL;
    }

    // If we have an IUnknown

    if (pIU)
    {
       pIU->Release();
       pIU = NULL;
    }

    // And if we have a IScheduledWorkItem

    if (pISWI)
    {
       pISWI->Release();
       pISWI = NULL;
    }

    return hr;
}

void Cleanup ( void )

Definition at line 437 of file sa.Cpp.

{
    if (g_pITaskScheduler)
    {
        g_pITaskScheduler->Release();
        g_pITaskScheduler = NULL;
    }

    // Unload the library, now that our pointer is freed.

    CoUninitialize();
    return;
}

HRESULT ConvertToSystemTime | ( | LPWSTR | lpwszTime,
 |  | LPSYSTEMTIME | lptTime
 | ) |  |

Definition at line 1059 of file sa.Cpp.

{
    WORD wMin = 0, wHr = 0, wMaxFeb = 28;
    WCHAR szTemp[3], *szEnd1, *szEnd2;
    SYSTEMTIME tNow;
    int i, j;

    // Extract minutes and hour from string
    // Note that both h:mm and hh:mm are valid, but nothing else
    // It is safe to call wcslen() on lpwszTime because we already know it is NULL terminated

    if ((wcslen(lpwszTime) > MAX_TIME_LENGTH - 1) || (wcslen(lpwszTime) < MAX_TIME_LENGTH - 2))
    {
        wprintf(L"Error:  Invalid time string given\n");
        return E_FAIL;
    }

    // Hours first.

    i = 0;
    while (*lpwszTime != ':')
    {
        szTemp[i] = *lpwszTime;
        i++;
        if (i > 2)
        {
            // User gave a bad time string
            wprintf(L"Error:  Bad hours in time string (need 0 - 23)\n");
            return E_FAIL;
        }
        lpwszTime++;
    }
    szTemp[i] = L'\0';
    lpwszTime++;

    // Convert to value

    wHr = (WORD) wcstoul(szTemp, &szEnd1, 10);

    // Now do minutes
    // It is safe to call wcslen() on lpwszTime because we already know it is NULL terminated

    i = wcslen(lpwszTime);
    if (i != 2)
    {
        // User gave a bad time string
        wprintf(L"Error:  Bad minutes in time string (need 00 - 59)\n");
        return E_FAIL;
    }

    j = 0;
    while (i)
    {
        szTemp[j] = *lpwszTime;
        j++;
        i--;
        lpwszTime++;
    }
    szTemp[j] = L'\0';

    wMin = (WORD) wcstoul(szTemp, &szEnd2, 10);

    // Now figure out if we are running today or tomorrow

    GetLocalTime(&tNow);
    if ((wHr < tNow.wHour) ||
       ((wHr == tNow.wHour) && (wMin < tNow.wMinute)))
    {
        // Job is tomorrow - we must figure out what tomorrow is

        switch(tNow.wMonth)
        {
            case 4:
            case 6:
            case 9:
            case 11:
                // Thirty day months

                if ((tNow.wDay + 1) > 30)
                {
                    tNow.wDay = 1;
                    tNow.wMonth++;
                }
                else
                {
                    tNow.wDay++;
                }
                break;

            case 2:
                // February
                // Leap Year?

                if ((tNow.wYear % 4) == 0)
                {
                    wMaxFeb = 29;
                }
                if (((tNow.wYear % 100) == 0) &&
                    ((tNow.wYear % 400) != 0))
                {
                    wMaxFeb = 28;
                }

                if ((tNow.wDay + 1) > wMaxFeb)
                {
                    tNow.wDay = 1;
                    tNow.wMonth++;
                }
                else
                {
                    tNow.wDay++;
                }
                break;

            default:
                // 31 day months.  Handle Dec. later

                if ((tNow.wDay + 1) > 31)
                {
                    tNow.wDay = 1;
                    tNow.wMonth++;
                }
                else
                {
                    tNow.wDay++;
                }

                if (tNow.wMonth > 12)
                {
                    tNow.wMonth = 1;
                    tNow.wYear++;
                }
        }
    }

    if ((wMin < 0) || (wMin > 59))
    {
        wprintf(L"Error:  Invalid minutes (need 00 - 59)\n");
        return E_FAIL;
    }
    else
    {
        tNow.wMinute = wMin;
    }
    if ((wHr < 0) || (wHr > 23))
    {
        wprintf(L"Error:  Invalid hours (need 0 - 23)\n");
        return E_FAIL;
    }
    else
    {
        tNow.wHour = wHr;
    }

    lptTime->wHour = tNow.wHour;
    lptTime->wMinute = tNow.wMinute;
    lptTime->wYear = tNow.wYear;
    lptTime->wMonth = tNow.wMonth;
    lptTime->wDay = tNow.wDay;
    lptTime->wDayOfWeek = 0;
    lptTime->wSecond = 0;
    lptTime->wMilliseconds = 0;
    return S_OK;
}

HRESULT DeleteJob ( LPWSTR lpwszJobName )

Definition at line 642 of file sa.Cpp.

{
    HRESULT hr = S_OK;

    hr = g_pITaskScheduler->Delete(lpwszJobName);

    return hr;
}

void DisplayHelp ( LPWSTR lpwszProgName )

Definition at line 464 of file sa.Cpp.

{
    //  Note that it is usually not safe to have a user-supplied value output via a %s format in a printf statement;
    //  however, we have already verified the length of lpwszProgName, so we can be confident that these calls will not overflow.

    wprintf(L"%s -- a small program to replicate some\n", lpwszProgName);
    wprintf(L"\tfunctionality of the AT command, using the\n");
    wprintf(L"\tnew Task Scheduler interfaces.\n\n");

    wprintf(L"Usage:\n");
    wprintf(L"\t%s /?\n\t\t\t\t\t\t- Display this help\n",lpwszProgName);
    wprintf(L"\t%s\n\t\t\t\t\t\t- Show all work items\n",lpwszProgName);
    wprintf(L"\t%s TaskName.job /DELETE \n\t\t\t\t\t\t- delete work item\n",lpwszProgName);
    wprintf(L"\t%s TaskName.job Time Command [UserName [Password]]\n\t\t\t\t\t\t- submit a new work item\n\n",lpwszProgName);

    wprintf(L"TaskName.job is the name of the work item object on disk.\n");
    wprintf(L"The work item will appear in the Scheduled Tasks folder as TaskName\n");
    wprintf(L"but must be given the extension \".job\" for the service \n");
    wprintf(L"to recognize and run it.\n\n");

    wprintf(L"Task Time is in 24 hour format (such as 15:30) and is the\n");
    wprintf(L"next instance of this time within 24 hours.\n\n");

    wprintf(L"The Command should contain the name of the executable to run.\n");
    wprintf(L"Note that the pathname may NOT contain spaces.  If the\n");
    wprintf(L"program requires command line parameters, enclose the entire\n");
    wprintf(L"command string in quotation marks.\n\n");

    wprintf(L"Username and password are required to run the specified work item under Windows NT.\n");
    wprintf(L"Under Windows NT, if not specified, you will be prompted.\n");
    wprintf(L"Under Windows 95, both fields are ignored.  If not specified\n");
    wprintf(L"on the command line, you will not be prompted.\n\n");

    return;
}

HRESULT EnumerateJobs ( void )

Definition at line 514 of file sa.Cpp.

{
    HRESULT hr = S_OK, hrLoop = S_OK;
    IEnumWorkItems *pIEnumWorkItems;
    IUnknown *pIU;
    ITask *pITask;
    ULONG ulTasksToGet = 1, ulActualTasksRetrieved = 0;
    LPWSTR *rgpwszNames, pwszTrigger;
    WORD wTrigCount = 0;
    WORD wTemp;

    //
    // Get an enumeration pointer, using ITaskScheduler::Enum
    //

    hr = g_pITaskScheduler->Enum(&pIEnumWorkItems);
    if (FAILED(hr))
    {
        wprintf(L"Failed to get enumerator with 0x%x\n", hr);
        return hr;
    }

    do
    {
        // Get a single work item, using IEnumWorkItems::Next

        hrLoop = pIEnumWorkItems->Next(ulTasksToGet, &rgpwszNames, &ulActualTasksRetrieved);
        if (hrLoop == S_FALSE)
        {
            // There are no more waiting tasks to look at
            break;
        }

        // Attach to the work item, using ITaskScheduler::Activate

        hr = g_pITaskScheduler->Activate(rgpwszNames[0], IID_ITask, &pIU);
        if (FAILED(hr))
        {
            wprintf(L"Error:  Activate failed with 0x%x\n", hr);
            break;
        }

        // QI pIU for pITask

        hr = pIU->QueryInterface(IID_ITask, (void **) &pITask);
        pIU->Release();
        pIU = NULL;
        if (FAILED(hr))
        {
            wprintf(L"Error:  QI for ITask failed in Activate with 0x%x\n", hr);
            break;
        }

        // Display task name

        // rgpwszNames[0] is the value returned by the Task Scheduler API
        // and should be appropriately bounded and therefore safe to pass into %s

        wprintf(L"Task: %s\n",rgpwszNames[0]);

        // Use ITask::GetTriggerCount to get count of triggers

        hr = pITask->GetTriggerCount(&wTrigCount);
        if (FAILED(hr))
        {
            wprintf(L"Error:  Failed to count triggers with 0x%x\n", hr);
            pITask->Release();
            break;
        }

        for (wTemp = 0; wTemp < wTrigCount; wTemp++)
        {
            // Dump Triggers using ITask::GetTriggerString

            hr = pITask->GetTriggerString(wTemp, &pwszTrigger);
            if (FAILED(hr))
            {
                wprintf(L"Error:  Failed to get trigger string with 0x%x\n", hr);
                pITask->Release();
                break;
            }

            // pwszTrigger is the value returned by the Task Scheduler API
            // and should be appropriately bounded and therefore safe to pass into %s

            wprintf(L"\tTrigger: %s\n",pwszTrigger);

            // Clean up the memory we were allocated for trig string

            CoTaskMemFree(pwszTrigger);
        }

        // Clean up each element in the array of job names, then
        // clean up the final array.

        CoTaskMemFree(rgpwszNames[0]);
        CoTaskMemFree(rgpwszNames);

        // Free the ITask pointer

        pITask->Release();

    } while(1);

    // Release the enumeration pointer

    pITask = NULL;

    pIEnumWorkItems->Release();
    pIEnumWorkItems = NULL;

    return hr;
}

HRESULT Init ( void )

Definition at line 388 of file sa.Cpp.

{
    HRESULT hr = S_OK;

    // Bring in the library

    hr = CoInitialize(NULL);
    if (FAILED(hr))
    {
        wprintf(L"Error:  Failed to initialize COM with 0x%x\n", hr);
        return hr;
    }

    // Create the pointer to Task Scheduler object
    // CLSID from the header file mstask.h

    hr = CoCreateInstance(
        CLSID_CTaskScheduler,
        NULL,
        CLSCTX_INPROC_SERVER,
        IID_ITaskScheduler,
        (void **) &g_pITaskScheduler);

    // Should we fail, unload the library

    if (FAILED(hr))
    {
        wprintf(L"Error:  Failed CoCreateInstance with 0x%x\n", hr);
        CoUninitialize();
    }

    return hr;
}

LONG _CRTAPI1 main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 126 of file sa.Cpp.

{
    HRESULT hr = S_OK;
    UINT uCodePage;
    char *lpcszDeleteFlag = "/DELETE";
    WCHAR lpwszProgName[MAX_COMMAND_LENGTH];
    WCHAR lpwszJobName[MAX_COMMAND_LENGTH];
    WCHAR lpwszCommand[MAX_COMMAND_LENGTH];
    WCHAR lpwszUserName[MAX_ACCOUNT_LENGTH];
    WCHAR lpwszPassword[MAX_PASSWORD_LENGTH];
    WCHAR lpwszTime[MAX_TIME_LENGTH];
    SYSTEMTIME tTime;

    // For protection

    g_pITaskScheduler = NULL;

    // It is good practice to check lengths on all input params prior to using as a safety precaution against attack
    // strlen() is OK to use for this as the command line arguments will be NULL terminated

    if (strlen(argv[0]) > MAX_COMMAND_LENGTH -1)
    {
        wprintf(L"Error:  Program name too long\n");
        return E_FAIL;
    }

    // String conversion initialization

    uCodePage = _getmbcp();

    // Convert the string; be sure to check return value

    if (!MultiByteToWideChar(uCodePage, 0, argv[0], -1, lpwszProgName, MAX_COMMAND_LENGTH))
    {
        hr = HRESULT_FROM_WIN32(GetLastError());
        wprintf(L"Error:  Multibyte to wide character conversion failed with 0x%x\n", hr);
        return hr;
    }

    // Check number of command line arguments.
    //      1 argument      =   enumerate work items
    //      2 args          =   display help (don't init OLE)
    //      3 args          =   delete work item
    //      4, 5 or 6 args  =   add a work item
    //      all others      =   error, display help

    if ((argc == 2) || (argc > 6))
    {
        DisplayHelp(lpwszProgName);
        return hr;
    }

    // Attempt to initialize OLE and fill in the global g_pITaskScheduler

    hr = Init();
    if (FAILED(hr))
    {
        wprintf(L"Error:  OLE initialization and instantiation failed with 0x%x\n", hr);
        return hr;
    }

    switch(argc)
    {
        case 1:
            // User would like to enumerate work items

            hr = EnumerateJobs();
            if (FAILED(hr))
            {
                wprintf(L"Error:  Job enumeration failed with 0x%x\n", hr);
            }
            break;

        case 3:
            if (! lstrcmpiA(argv[2], lpcszDeleteFlag))
            {
                // User would like to delete work item in argv[1]

                // It is good practice to check lengths on all input params prior to using as a safety precaution against attack
                // strlen() is OK to use for this as the command line arguments will be NULL terminated

                if (strlen(argv[1]) > MAX_COMMAND_LENGTH -1)
                {
                    wprintf(L"Error:  Job name too long\n");
                    hr = E_FAIL;
                    break;
                }

                // Convert the string; be sure to check return value

                if (!MultiByteToWideChar(uCodePage, 0, argv[1], -1, lpwszJobName, MAX_COMMAND_LENGTH))
                {
                    hr = HRESULT_FROM_WIN32(GetLastError());
                    wprintf(L"Error:  Multibyte to wide character conversion failed with 0x%x\n", hr);
                    break;
                }

                hr = DeleteJob(lpwszJobName);
                if (FAILED(hr))
                {
                    wprintf(L"Error:  Job deletion failed with 0x%x\n", hr);
                }
            }
            else
            {
                // User has made an error in command line args

                //  Note that it is usually not safe to have a user-supplied value output via a %s format in a printf statement;
                //  however, we have already verified the length of lpwszProgName, so we can be confident that these calls are safe.

                wprintf(L"Error:  Must be %s taskname.job /DELETE\n\n", lpwszProgName);
                wprintf(L"%s /?  for more help.\n", lpwszProgName);
                hr = E_FAIL;
            }
            break;

        case 4:
        case 5:
        case 6:
            // User would like to add a work item.  The following
            // argument cases apply:
            //      4 - User has specified work item name, but not given
            //          username or password.  Will prompt later.
            //      5 - User has specified work item name and username,
            //          but no password.  Will prompt later.
            //      6 - User has specified all information.

            // It is good practice to check lengths on all input params prior to using as a safety precaution against attack
            // strlen() is OK to use for this as the command line arguments will be NULL terminated

            if (strlen(argv[1]) > MAX_COMMAND_LENGTH -1)
            {
                wprintf(L"Error:  Job name too long\n");
                hr = E_FAIL;
                break;
            }

            if (strlen(argv[2]) > MAX_TIME_LENGTH -1)
            {
                wprintf(L"Error:  Time too long\n");
                hr = E_FAIL;
                break;
            }

            if (strlen(argv[3]) > MAX_COMMAND_LENGTH -1)
            {
                wprintf(L"Error:  Command too long\n");
                hr = E_FAIL;
                break;
            }

            // Convert the strings; be sure to check return values

            if (!MultiByteToWideChar(uCodePage, 0, argv[1], -1, lpwszJobName, MAX_COMMAND_LENGTH))
            {
                hr = HRESULT_FROM_WIN32(GetLastError());
                wprintf(L"Error:  Multibyte to wide character conversion failed with 0x%x\n", hr);
                break;
            }

            if (!MultiByteToWideChar(uCodePage, 0, argv[2], -1, lpwszTime, MAX_TIME_LENGTH))
            {
                hr = HRESULT_FROM_WIN32(GetLastError());
                wprintf(L"Error:  Multibyte to wide character conversion failed with 0x%x\n", hr);
                break;
            }

            hr = ConvertToSystemTime(lpwszTime, &tTime);
            if (FAILED(hr))
            {
                wprintf(L"Error:  Conversion of command line time to system time failed with 0x%x\n", hr);
                break;
            }

            if (!MultiByteToWideChar(uCodePage, 0, argv[3], -1, lpwszCommand, MAX_COMMAND_LENGTH))
            {
                hr = HRESULT_FROM_WIN32(GetLastError());
                wprintf(L"Error:  Multibyte to wide character conversion failed with 0x%x\n", hr);
                break;
            }

            *lpwszUserName = L'\0';
            *lpwszPassword = L'\0';

            if (argc > 4)
            {
                // It is good practice to check lengths on all input params prior to using as a safety precaution against attack
                // strlen() is OK to use for this as the command line arguments will be NULL terminated

                if (strlen(argv[4]) > MAX_ACCOUNT_LENGTH -1)
                {
                    wprintf(L"Error:  User name too long\n");
                    hr = E_FAIL;
                    break;
                }

                // Convert the string; be sure to check return value

                if (!MultiByteToWideChar(uCodePage, 0, argv[4], -1, lpwszUserName, MAX_ACCOUNT_LENGTH))
                {
                    hr = HRESULT_FROM_WIN32(GetLastError());
                    wprintf(L"Error:  Multibyte to wide character conversion failed with 0x%x\n", hr);
                    break;
                }
            }

            if (argc == 6)
            {
                // It is good practice to check lengths on all input params prior to using as a safety precaution against attack
                // strlen() is OK to use for this as the command line arguments will be NULL terminated

                if (strlen(argv[5]) > MAX_PASSWORD_LENGTH -1)
                {
                    wprintf(L"Error:  User name too long\n");
                    hr = E_FAIL;
                    break;
                }

                // Convert the string; be sure to check return value

                if (!MultiByteToWideChar(uCodePage, 0, argv[5], -1, lpwszPassword, MAX_PASSWORD_LENGTH))
                {
                    hr = HRESULT_FROM_WIN32(GetLastError());
                    wprintf(L"Error:  Multibyte to wide character conversion failed with 0x%x\n", hr);
                    break;
                }
            }

            hr = AddJob(lpwszJobName, &tTime, lpwszCommand, lpwszUserName, lpwszPassword);
            if (FAILED(hr))
            {
                wprintf(L"Error:  Job creation failed with 0x%x\n", hr);
            }

            break;

        default:
            hr = E_FAIL;
            DisplayHelp(lpwszProgName);
    }

    Cleanup();
    return hr;
}

Variable Documentation

ITaskScheduler* g_pITaskScheduler = NULL

Definition at line 89 of file sa.Cpp.

const int MAX_ACCOUNT_LENGTH = 127

Definition at line 108 of file sa.Cpp.

const int MAX_COMMAND_LENGTH = 255

Definition at line 107 of file sa.Cpp.

const int MAX_PASSWORD_LENGTH = 127

Definition at line 109 of file sa.Cpp.

const int MAX_TIME_LENGTH = 6

Definition at line 110 of file sa.Cpp.

Generated on Wed Nov 13 2024 16:54:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/AdvClient/AdvClient.cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • AdvClient
Variables

AdvClient.cpp File Reference

#include "stdafx.h"
#include <objbase.h>
#include "AdvClient.h"
#include "AdvClientDlg.h"
#include <strsafe.h>

Go to the source code of this file.

Variables

CHMMSampleApp theApp

Variable Documentation

CHMMSampleApp theApp

Definition at line 51 of file AdvClient.cpp.

Generated on Wed Nov 13 2024 16:54:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/AdvClient/AdvClient.h File Reference

  • SysMgmt
  • WMI
  • VC
  • AdvClient
Classes

AdvClient.h File Reference

#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Classes

class CHMMSampleApp
Generated on Wed Nov 13 2024 16:54:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/AdvClient/AdvClientdlg.cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • AdvClient
Classes | Defines | Functions

AdvClientdlg.cpp File Reference

#include "stdafx.h"
#include "AdvClient.h"
#include "AdvClientDlg.h"
#include "OnAsync.h"
#include <strsafe.h>

Go to the source code of this file.

Classes

class | CAboutDlg

Defines

#define | BLOCKSIZE (32 * sizeof(WCHAR))
#define | CVTBUFSIZE (309+40)

Functions

LPCTSTR | ErrorString (HRESULT hRes)
LPWSTR | ValueToString (VARIANT *pValue, WCHAR **pbuf)

Define Documentation

#define BLOCKSIZE (32 * sizeof(WCHAR))

Definition at line 459 of file AdvClientdlg.cpp.

#define CVTBUFSIZE (309+40)

Definition at line 460 of file AdvClientdlg.cpp.

Function Documentation

LPCTSTR ErrorString ( HRESULT hRes )

Definition at line 271 of file AdvClientdlg.cpp.

{
    TCHAR szBuffer2[19];
  static TCHAR szBuffer[24];
  LPCTSTR psz;

   switch(hRes)
   {
   case WBEM_NO_ERROR:
    psz = _T("WBEM_NO_ERROR");
    break;
   case WBEM_S_FALSE:
    psz = _T("WBEM_S_FALSE");
    break;
   case WBEM_S_NO_MORE_DATA:
    psz = _T("WBEM_S_NO_MORE_DATA");
    break;
  case WBEM_E_FAILED:
    psz = _T("WBEM_E_FAILED");
    break;
  case WBEM_E_NOT_FOUND:
    psz = _T("WBEM_E_NOT_FOUND");
    break;
  case WBEM_E_ACCESS_DENIED:
    psz = _T("WBEM_E_ACCESS_DENIED");
    break;
  case WBEM_E_PROVIDER_FAILURE:
    psz = _T("WBEM_E_PROVIDER_FAILURE");
    break;
  case WBEM_E_TYPE_MISMATCH:
    psz = _T("WBEM_E_TYPE_MISMATCH");
    break;
  case WBEM_E_OUT_OF_MEMORY:
    psz = _T("WBEM_E_OUT_OF_MEMORY");
    break;
  case WBEM_E_INVALID_CONTEXT:
    psz = _T("WBEM_E_INVALID_CONTEXT");
    break;
  case WBEM_E_INVALID_PARAMETER:
    psz = _T("WBEM_E_INVALID_PARAMETER");
    break;
  case WBEM_E_NOT_AVAILABLE:
    psz = _T("WBEM_E_NOT_AVAILABLE");
    break;
  case WBEM_E_CRITICAL_ERROR:
    psz = _T("WBEM_E_CRITICAL_ERROR");
    break;
  case WBEM_E_INVALID_STREAM:
    psz = _T("WBEM_E_INVALID_STREAM");
    break;
  case WBEM_E_NOT_SUPPORTED:
    psz = _T("WBEM_E_NOT_SUPPORTED");
    break;
  case WBEM_E_INVALID_SUPERCLASS:
    psz = _T("WBEM_E_INVALID_SUPERCLASS");
    break;
  case WBEM_E_INVALID_NAMESPACE:
    psz = _T("WBEM_E_INVALID_NAMESPACE");
    break;
  case WBEM_E_INVALID_OBJECT:
    psz = _T("WBEM_E_INVALID_OBJECT");
    break;
  case WBEM_E_INVALID_CLASS:
    psz = _T("WBEM_E_INVALID_CLASS");
    break;
  case WBEM_E_PROVIDER_NOT_FOUND:
    psz = _T("WBEM_E_PROVIDER_NOT_FOUND");
    break;
  case WBEM_E_INVALID_PROVIDER_REGISTRATION:
    psz = _T("WBEM_E_INVALID_PROVIDER_REGISTRATION");
    break;
  case WBEM_E_PROVIDER_LOAD_FAILURE:
    psz = _T("WBEM_E_PROVIDER_LOAD_FAILURE");
    break;
  case WBEM_E_INITIALIZATION_FAILURE:
    psz = _T("WBEM_E_INITIALIZATION_FAILURE");
    break;
  case WBEM_E_TRANSPORT_FAILURE:
    psz = _T("WBEM_E_TRANSPORT_FAILURE");
    break;
  case WBEM_E_INVALID_OPERATION:
    psz = _T("WBEM_E_INVALID_OPERATION");
    break;
  case WBEM_E_INVALID_QUERY:
    psz = _T("WBEM_E_INVALID_QUERY");
    break;
  case WBEM_E_INVALID_QUERY_TYPE:
    psz = _T("WBEM_E_INVALID_QUERY_TYPE");
    break;
  case WBEM_E_ALREADY_EXISTS:
    psz = _T("WBEM_E_ALREADY_EXISTS");
    break;
   case WBEM_S_ALREADY_EXISTS:
      psz = _T("WBEM_S_ALREADY_EXISTS");
      break;
   case WBEM_S_RESET_TO_DEFAULT:
      psz = _T("WBEM_S_RESET_TO_DEFAULT");
      break;
   case WBEM_S_DIFFERENT:
      psz = _T("WBEM_S_DIFFERENT");
      break;
   case WBEM_E_OVERRIDE_NOT_ALLOWED:
      psz = _T("WBEM_E_OVERRIDE_NOT_ALLOWED");
      break;
   case WBEM_E_PROPAGATED_QUALIFIER:
      psz = _T("WBEM_E_PROPAGATED_QUALIFIER");
      break;
   case WBEM_E_PROPAGATED_PROPERTY:
      psz = _T("WBEM_E_PROPAGATED_PROPERTY");
      break;
   case WBEM_E_UNEXPECTED:
      psz = _T("WBEM_E_UNEXPECTED");
      break;
   case WBEM_E_ILLEGAL_OPERATION:
      psz = _T("WBEM_E_ILLEGAL_OPERATION");
      break;
   case WBEM_E_CANNOT_BE_KEY:
      psz = _T("WBEM_E_CANNOT_BE_KEY");
      break;
   case WBEM_E_INCOMPLETE_CLASS:
      psz = _T("WBEM_E_INCOMPLETE_CLASS");
      break;
   case WBEM_E_INVALID_SYNTAX:
      psz = _T("WBEM_E_INVALID_SYNTAX");
      break;
   case WBEM_E_NONDECORATED_OBJECT:
      psz = _T("WBEM_E_NONDECORATED_OBJECT");
      break;
   case WBEM_E_READ_ONLY:
      psz = _T("WBEM_E_READ_ONLY");
      break;
   case WBEM_E_PROVIDER_NOT_CAPABLE:
      psz = _T("WBEM_E_PROVIDER_NOT_CAPABLE");
      break;
   case WBEM_E_CLASS_HAS_CHILDREN:
      psz = _T("WBEM_E_CLASS_HAS_CHILDREN");
      break;
   case WBEM_E_CLASS_HAS_INSTANCES:
      psz = _T("WBEM_E_CLASS_HAS_INSTANCES");
      break;
   case WBEM_E_QUERY_NOT_IMPLEMENTED:
      psz = _T("WBEM_E_QUERY_NOT_IMPLEMENTED");
      break;
   case WBEM_E_ILLEGAL_NULL:
      psz = _T("WBEM_E_ILLEGAL_NULL");
      break;
   case WBEM_E_INVALID_QUALIFIER_TYPE:
      psz = _T("WBEM_E_INVALID_QUALIFIER_TYPE");
      break;
   case WBEM_E_INVALID_PROPERTY_TYPE:
      psz = _T("WBEM_E_INVALID_PROPERTY_TYPE");
      break;
   case WBEM_E_VALUE_OUT_OF_RANGE:
      psz = _T("WBEM_E_VALUE_OUT_OF_RANGE");
      break;
   case WBEM_E_CANNOT_BE_SINGLETON:
      psz = _T("WBEM_E_CANNOT_BE_SINGLETON");
      break;
  default:
      _itot(hRes, szBuffer2, 16);
    StringCbCopy(szBuffer, sizeof(szBuffer),_T("0x"));
      StringCbCat(szBuffer, sizeof(szBuffer), szBuffer2);
    psz = szBuffer;
  }
  return psz;
}

LPWSTR ValueToString | ( | VARIANT * | pValue,
 |  | WCHAR ** | pbuf
 | ) |  |

Definition at line 462 of file AdvClientdlg.cpp.

{
   DWORD iNeed = 0;
   DWORD iVSize = 0;
   DWORD iCurBufSize = 0;

   WCHAR *vbuf = NULL;
   WCHAR *buf = NULL;

   switch (pValue->vt)
   {
   case VT_NULL:
         buf = (WCHAR *)malloc(BLOCKSIZE);
     if (buf)
      StringCbCopyW(buf, BLOCKSIZE, L"<null>");
         break;

   case VT_BOOL: {
         VARIANT_BOOL b = pValue->boolVal;
         buf = (WCHAR *)malloc(BLOCKSIZE);
     if (buf)
     {
      if (!b) {
        StringCbCopyW(buf, BLOCKSIZE, L"FALSE");

      } else {
        StringCbCopyW(buf, BLOCKSIZE, L"TRUE");
      }
    }
         break;
      }

   case VT_UI1: {
      unsigned char b = pValue->bVal;
        buf = (WCHAR *)malloc(BLOCKSIZE);
        if (buf)
        {
            if (b >= 32)
            {
                StringCbPrintfW(buf, BLOCKSIZE, L"'%c' (%hu, 0x%hX)", b, (unsigned char)b, b);
            }
            else
            {
                StringCbPrintfW(buf, BLOCKSIZE, L"%hu (0x%hX)", (unsigned char)b, b);
            }
        }
        break;
  }
   case VT_I2:  {
        USHORT i = pValue->uiVal;
        buf = (WCHAR *)malloc(BLOCKSIZE);
        if (buf)
        {
            StringCbPrintfW(buf, BLOCKSIZE, L"%hu (0x%hX)", i, i);
        }
        break;
    }

   case VT_I4: {
         LONG l = pValue->lVal;
        buf = (WCHAR *)malloc(BLOCKSIZE);
        if (buf)
        {
            StringCbPrintfW(buf, BLOCKSIZE, L"%d (0x%X)", l, l);
        }
        break;
      }

   case VT_R4: {
        float f = pValue->fltVal;
        buf = (WCHAR *)malloc(CVTBUFSIZE * sizeof(WCHAR));
        if (buf)
        {
            StringCbPrintfW(buf, BLOCKSIZE,  L"%10.4f", f);
        }
        break;
      }

   case VT_R8: {
    double d = pValue->dblVal;
        buf = (WCHAR *)malloc(CVTBUFSIZE * sizeof(WCHAR));
        if (buf)
        {
            StringCbPrintfW(buf, BLOCKSIZE, L"%10.4f", d);
        }
        break;
    }

   case VT_BSTR: {
     LPWSTR pWStr = pValue->bstrVal;
     int bufSize = (wcslen(pWStr) * sizeof(WCHAR)) + sizeof(WCHAR) + (2 * sizeof(WCHAR));
     buf = (WCHAR *)malloc(bufSize);
     if (buf)
      StringCbPrintfW(buf, bufSize, L"\"%wS\"", pWStr);
     break;
    }

  // the sample GUI is too simple to make it necessary to display
  // these 'complicated' types--so ignore them.
   case VT_DISPATCH:  // Currently only used for embedded objects
   case VT_BOOL|VT_ARRAY:
   case VT_UI1|VT_ARRAY:
   case VT_I2|VT_ARRAY:
   case VT_I4|VT_ARRAY:
   case VT_R4|VT_ARRAY:
   case VT_R8|VT_ARRAY:
   case VT_BSTR|VT_ARRAY:
   case VT_DISPATCH | VT_ARRAY:
         break;

   default:
         buf = (WCHAR *)malloc(BLOCKSIZE);
     if (buf)
      StringCbCopyW(buf, BLOCKSIZE, L"<conversion error>");
   }

   *pbuf = buf;
   return buf;
}

Generated on Wed Nov 13 2024 16:54:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/AdvClient/AdvClientdlg.h File Reference

  • SysMgmt
  • WMI
  • VC
  • AdvClient
Classes | Functions

AdvClientdlg.h File Reference

#include <wbemcli.h>
#include "resource.h"

Go to the source code of this file.

Classes

class | CAdvClientDlg

Functions

LPCTSTR | ErrorString (SCODE sc)
LPWSTR | ValueToString (VARIANT *pValue, WCHAR **pbuf)

Function Documentation

LPCTSTR ErrorString ( SCODE sc )
LPWSTR ValueToString | ( | VARIANT * | pValue,
 |  | WCHAR ** | pbuf
 | ) |  |

Definition at line 462 of file AdvClientdlg.cpp.

{
   DWORD iNeed = 0;
   DWORD iVSize = 0;
   DWORD iCurBufSize = 0;

   WCHAR *vbuf = NULL;
   WCHAR *buf = NULL;

   switch (pValue->vt)
   {
   case VT_NULL:
         buf = (WCHAR *)malloc(BLOCKSIZE);
     if (buf)
      StringCbCopyW(buf, BLOCKSIZE, L"<null>");
         break;

   case VT_BOOL: {
         VARIANT_BOOL b = pValue->boolVal;
         buf = (WCHAR *)malloc(BLOCKSIZE);
     if (buf)
     {
      if (!b) {
        StringCbCopyW(buf, BLOCKSIZE, L"FALSE");

      } else {
        StringCbCopyW(buf, BLOCKSIZE, L"TRUE");
      }
    }
         break;
      }

   case VT_UI1: {
      unsigned char b = pValue->bVal;
        buf = (WCHAR *)malloc(BLOCKSIZE);
        if (buf)
        {
            if (b >= 32)
            {
                StringCbPrintfW(buf, BLOCKSIZE, L"'%c' (%hu, 0x%hX)", b, (unsigned char)b, b);
            }
            else
            {
                StringCbPrintfW(buf, BLOCKSIZE, L"%hu (0x%hX)", (unsigned char)b, b);
            }
        }
        break;
  }
   case VT_I2:  {
        USHORT i = pValue->uiVal;
        buf = (WCHAR *)malloc(BLOCKSIZE);
        if (buf)
        {
            StringCbPrintfW(buf, BLOCKSIZE, L"%hu (0x%hX)", i, i);
        }
        break;
    }

   case VT_I4: {
         LONG l = pValue->lVal;
        buf = (WCHAR *)malloc(BLOCKSIZE);
        if (buf)
        {
            StringCbPrintfW(buf, BLOCKSIZE, L"%d (0x%X)", l, l);
        }
        break;
      }

   case VT_R4: {
        float f = pValue->fltVal;
        buf = (WCHAR *)malloc(CVTBUFSIZE * sizeof(WCHAR));
        if (buf)
        {
            StringCbPrintfW(buf, BLOCKSIZE,  L"%10.4f", f);
        }
        break;
      }

   case VT_R8: {
    double d = pValue->dblVal;
        buf = (WCHAR *)malloc(CVTBUFSIZE * sizeof(WCHAR));
        if (buf)
        {
            StringCbPrintfW(buf, BLOCKSIZE, L"%10.4f", d);
        }
        break;
    }

   case VT_BSTR: {
     LPWSTR pWStr = pValue->bstrVal;
     int bufSize = (wcslen(pWStr) * sizeof(WCHAR)) + sizeof(WCHAR) + (2 * sizeof(WCHAR));
     buf = (WCHAR *)malloc(bufSize);
     if (buf)
      StringCbPrintfW(buf, bufSize, L"\"%wS\"", pWStr);
     break;
    }

  // the sample GUI is too simple to make it necessary to display
  // these 'complicated' types--so ignore them.
   case VT_DISPATCH:  // Currently only used for embedded objects
   case VT_BOOL|VT_ARRAY:
   case VT_UI1|VT_ARRAY:
   case VT_I2|VT_ARRAY:
   case VT_I4|VT_ARRAY:
   case VT_R4|VT_ARRAY:
   case VT_R8|VT_ARRAY:
   case VT_BSTR|VT_ARRAY:
   case VT_DISPATCH | VT_ARRAY:
         break;

   default:
         buf = (WCHAR *)malloc(BLOCKSIZE);
     if (buf)
      StringCbCopyW(buf, BLOCKSIZE, L"<conversion error>");
   }

   *pbuf = buf;
   return buf;
}

Generated on Wed Nov 13 2024 16:54:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/AdvClient/officedlg.cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • AdvClient

officedlg.cpp File Reference

#include "stdafx.h"
#include "AdvClient.h"
#include "OfficeDlg.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/AdvClient/officedlg.h File Reference

  • SysMgmt
  • WMI
  • VC
  • AdvClient
Classes

officedlg.h File Reference

Go to the source code of this file.

Classes

class COfficeDlg
Generated on Wed Nov 13 2024 16:54:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/AdvClient/onaddequipment.cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • AdvClient
Defines

onaddequipment.cpp File Reference

#include "stdafx.h"
#include "AdvClientDlg.h"
#include "OfficeDlg.h"

Go to the source code of this file.

Defines

#define TIMEOUT -1

Define Documentation

#define TIMEOUT -1

Definition at line 19 of file onaddequipment.cpp.

Generated on Wed Nov 13 2024 16:54:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/AdvClient/onasync.cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • AdvClient

onasync.cpp File Reference

#include "stdafx.h"
#include "AdvClientDlg.h"
#include "OnAsync.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/AdvClient/OnAsync.h File Reference

  • SysMgmt
  • WMI
  • VC
  • AdvClient
Classes

OnAsync.h File Reference

Go to the source code of this file.

Classes

class CAsyncQuerySink
Generated on Wed Nov 13 2024 16:54:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/AdvClient/onconnect.cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • AdvClient

onconnect.cpp File Reference

#include "stdafx.h"
#include "AdvClientDlg.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/AdvClient/ondiskdetails.cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • AdvClient

ondiskdetails.cpp File Reference

#include "stdafx.h"
#include "AdvClientDlg.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/AdvClient/OnDiskPropsDescriptions.cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • AdvClient

OnDiskPropsDescriptions.cpp File Reference

#include "stdafx.h"
#include "AdvClientDlg.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/AdvClient/onenumdisks.cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • AdvClient
Defines

onenumdisks.cpp File Reference

#include "stdafx.h"
#include "AdvClientDlg.h"

Go to the source code of this file.

Defines

#define TIMEOUT -1

Define Documentation

#define TIMEOUT -1

Definition at line 18 of file onenumdisks.cpp.

Generated on Wed Nov 13 2024 16:54:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/AdvClient/onenumsvcs.cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • AdvClient
Defines

onenumsvcs.cpp File Reference

#include "stdafx.h"
#include "AdvClientDlg.h"

Go to the source code of this file.

Defines

#define TIMEOUT -1

Define Documentation

#define TIMEOUT -1

Definition at line 18 of file onenumsvcs.cpp.

Generated on Wed Nov 13 2024 16:54:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/AdvClient/onperm.cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • AdvClient

onperm.cpp File Reference

#include "stdafx.h"
#include "AdvClientDlg.h"
#include <tchar.h>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/AdvClient/onregister.cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • AdvClient

onregister.cpp File Reference

#include "stdafx.h"
#include "AdvClientDlg.h"
#include <objbase.h>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/AdvClient/ontemp.cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • AdvClient

ontemp.cpp File Reference

#include "stdafx.h"
#include "AdvClientDlg.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/AdvClient/resource.h File Reference

  • SysMgmt
  • WMI
  • VC
  • AdvClient
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_ACCTNAME 1010
#define | IDC_ADDEQUIPMENT 1001
#define | IDC_ADDUSER 1003
#define | IDC_CONNECT 1004
#define | IDC_DISK_PROPS_DESCRIPTIONS 1013
#define | IDC_DISKDETAILS 1008
#define | IDC_DOMAIN 1011
#define | IDC_ENUMDISKS 1000
#define | IDC_ENUMSERVICES 1002
#define | IDC_ENUMSERVICESASYNC 1007
#define | IDC_EVENTLIST 1011
#define | IDC_ITEM 1009
#define | IDC_NAMESPACE 1005
#define | IDC_OUTPUTLIST 1006
#define | IDC_REGPERM 1010
#define | IDC_REGTEMP 1009
#define | IDC_SKU 1012
#define | IDD_ABOUTBOX 100
#define | IDD_OFFICEEQUIP 129
#define | IDD_SAMPLE_DIALOG 102
#define | IDD_USERINFO 130
#define | IDD_WBEMSAMP_DIALOG 102
#define | IDD_WBEMSAMPLE_DIALOG 102
#define | IDM_ABOUTBOX 0x0010
#define | IDR_MAINFRAME 128
#define | IDS_ABOUTBOX 101

Define Documentation

#define IDC_ACCTNAME 1010

Definition at line 25 of file resource.h.

#define IDC_ADDEQUIPMENT 1001

Definition at line 15 of file resource.h.

#define IDC_ADDUSER 1003

Definition at line 17 of file resource.h.

#define IDC_CONNECT 1004

Definition at line 18 of file resource.h.

#define IDC_DISK_PROPS_DESCRIPTIONS 1013

Definition at line 30 of file resource.h.

#define IDC_DISKDETAILS 1008

Definition at line 22 of file resource.h.

#define IDC_DOMAIN 1011

Definition at line 27 of file resource.h.

#define IDC_ENUMDISKS 1000

Definition at line 14 of file resource.h.

#define IDC_ENUMSERVICES 1002

Definition at line 16 of file resource.h.

#define IDC_ENUMSERVICESASYNC 1007

Definition at line 21 of file resource.h.

#define IDC_EVENTLIST 1011

Definition at line 28 of file resource.h.

#define IDC_ITEM 1009

Definition at line 23 of file resource.h.

#define IDC_NAMESPACE 1005

Definition at line 19 of file resource.h.

#define IDC_OUTPUTLIST 1006

Definition at line 20 of file resource.h.

#define IDC_REGPERM 1010

Definition at line 26 of file resource.h.

#define IDC_REGTEMP 1009

Definition at line 24 of file resource.h.

#define IDC_SKU 1012

Definition at line 29 of file resource.h.

#define IDD_ABOUTBOX 100

Definition at line 6 of file resource.h.

#define IDD_OFFICEEQUIP 129

Definition at line 12 of file resource.h.

#define IDD_SAMPLE_DIALOG 102

Definition at line 10 of file resource.h.

#define IDD_USERINFO 130

Definition at line 13 of file resource.h.

#define IDD_WBEMSAMP_DIALOG 102

Definition at line 8 of file resource.h.

#define IDD_WBEMSAMPLE_DIALOG 102

Definition at line 9 of file resource.h.

#define IDM_ABOUTBOX 0x0010

Definition at line 5 of file resource.h.

#define IDR_MAINFRAME 128

Definition at line 11 of file resource.h.

#define IDS_ABOUTBOX 101

Definition at line 7 of file resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/AdvClient/stdafx.cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • AdvClient

stdafx.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/AdvClient/StdAfx.h File Reference

  • SysMgmt
  • WMI
  • VC
  • AdvClient
Defines

StdAfx.h File Reference

#include <afxwin.h>
#include <afxext.h>
#include <afxcmn.h>

Go to the source code of this file.

Defines

#define VC_EXTRALEAN

Define Documentation

#define VC_EXTRALEAN

Definition at line 14 of file StdAfx.h.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/ClassProv/ClassFac.Cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • ClassProv
Functions

ClassFac.Cpp File Reference

#include <objbase.h>
#include "sample.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CProvFactory

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 79 of file ClassFac.Cpp.

{
    ULONG nNewCount = InterlockedDecrement((long *)&m_cRef);
    if (0L == nNewCount)
        delete this;

    return nNewCount;
}

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/ClassProv/ClassProv.Cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • ClassProv
Defines | Functions | Variables

ClassProv.Cpp File Reference

#include <objbase.h>
#include "sample.h"
#include <process.h>
#include <strsafe.h>

Go to the source code of this file.

Defines

#define | SAMPLE_CLASS_NAME L"ClassProvSamp"

Functions

STDMETHODIMP_ (ULONG) CClassPro

Variables

long | glNumInst = sizeof(MyDefs)/sizeof(InstDef)
InstDef | MyDefs [] = {{L"a", 1}, {L"b", 2}, {L"c", 3}}

Define Documentation

#define SAMPLE_CLASS_NAME L"ClassProvSamp"

Definition at line 33 of file ClassProv.Cpp.

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 96 of file ClassProv.Cpp.

{
    ULONG nNewCount = InterlockedDecrement((long *)&m_cRef);
    if (0L == nNewCount)
        delete this;

    return nNewCount;
}

Variable Documentation

long glNumInst = sizeof(MyDefs)/sizeof(InstDef)

Definition at line 31 of file ClassProv.Cpp.

InstDef MyDefs[] = {{L"a", 1}, {L"b", 2}, {L"c", 3}}

Definition at line 29 of file ClassProv.Cpp.

Generated on Wed Nov 13 2024 16:54:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/ClassProv/MainDll.Cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • ClassProv
Functions | Variables

MainDll.Cpp File Reference

#include <objbase.h>
#include <initguid.h>
#include "sample.h"
#include <tchar.h>
#include <strsafe.h>

Go to the source code of this file.

Functions

DEFINE_GUID (CLSID_classprovider, 0x22cb8799, 0x914a, 0x11cf, 0xb7, 0x5, 0x0, 0xaa, 0x0, 0x62, 0xcb, 0xb7)
STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, PPVOID ppv)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)
BOOL WINAPI | LibMain32 (HINSTANCE hInstance, ULONG ulReason, LPVOID pvReserved)

Variables

long | g_cLock = 0
long | g_cObj = 0
HMODULE | ghModule

Function Documentation

DEFINE_GUID | ( | CLSID_classprovider | ,
 |  | 0x22cb8799 | ,
 |  | 0x914a | ,
 |  | 0x11cf | ,
 |  | 0xb7 | ,
 |  | 0x5 | ,
 |  | 0x0 | ,
 |  | 0xaa | ,
 |  | 0x0 | ,
 |  | 0x62 | ,
 |  | 0xcb | ,
 |  | 0xb7 |
 | ) |  |
STDAPI DllCanUnloadNow ( void )

Definition at line 110 of file MainDll.Cpp.

{
    SCODE   sc;

    //It is OK to unload if there are no objects or locks on the
    // class factory.

    sc=(0L==g_cObj && 0L==g_cLock) ? S_OK : S_FALSE;
    return sc;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | PPVOID | ppv
 | ) |  |

Definition at line 77 of file MainDll.Cpp.

{
    HRESULT hr;
    CProvFactory *pObj;

    if (CLSID_classprovider!=rclsid)
        return E_FAIL;

    pObj=new CProvFactory();

    if (NULL==pObj)
        return E_OUTOFMEMORY;

    hr=pObj->QueryInterface(riid, ppv);

    if (FAILED(hr))
        delete pObj;

    return hr;
}

STDAPI DllRegisterServer ( void )

Definition at line 130 of file MainDll.Cpp.

{
    char       szID[128];
  WCHAR   wcID[128];
    char       szCLSID[128];
    TCHAR       szModule[MAX_PATH + 1];
    const char * pName = "WINMGMT Sample Class Provider";
    const char * pModel = "Both";
    HKEY hKey1, hKey2;

    // Create the path.

  memset(wcID, NULL, sizeof(wcID));
  memset(szID, NULL, sizeof(szID));
    StringFromGUID2(CLSID_classprovider, wcID, sizeof(wcID)/sizeof(WCHAR));
  wcstombs(szID, wcID, sizeof(szID));
  StringCbCopy(szCLSID, sizeof(szCLSID), "Software\\classes\\CLSID\\");
  StringCbCat(szCLSID, sizeof(szCLSID), (LPCTSTR)szID);

    // Create entries under CLSID

  LONG lRet = RegCreateKeyEx( HKEY_LOCAL_MACHINE, szCLSID, 0, NULL,
                    REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL,
                    &hKey1, NULL );
  if (lRet != ERROR_SUCCESS)
  {
    return E_FAIL;
  }

    lRet = RegSetValueEx(hKey1, NULL, 0, REG_SZ, (BYTE *)pName, strlen(pName)+1);
  if (lRet != ERROR_SUCCESS)
  {
    RegCloseKey(hKey1);
    return E_FAIL;
  }

  lRet = RegCreateKeyEx( hKey1, "InprocServer32", 0, NULL,
                    REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL,
                    &hKey2, NULL );
  if (lRet != ERROR_SUCCESS)
  {
    RegCloseKey(hKey1);
    return E_FAIL;
  }

  memset(&szModule, NULL, sizeof(szModule));
  GetModuleFileName(ghModule, szModule, sizeof(szModule)/sizeof(TCHAR) - 1);

    lRet = RegSetValueEx(hKey2, NULL, 0, REG_SZ, (BYTE *)szModule,
                                        strlen(szModule)+1);
  if (lRet != ERROR_SUCCESS)
  {
      RegCloseKey(hKey2);
    RegCloseKey(hKey1);
    return E_FAIL;
  }

  lRet = RegSetValueEx(hKey2, "ThreadingModel", 0, REG_SZ,
                                        (BYTE *)pModel, strlen(pModel)+1);
  if (lRet != ERROR_SUCCESS)
  {
      RegCloseKey(hKey2);
    RegCloseKey(hKey1);
    return E_FAIL;
  }
    RegCloseKey(hKey1);
    RegCloseKey(hKey2);
    return NOERROR;
}

STDAPI DllUnregisterServer ( void )

Definition at line 210 of file MainDll.Cpp.

{
    TCHAR szID[128];
  WCHAR wcID[128];
    TCHAR szCLSID[128];
    HKEY  hKey;

    // Create the path using the CLSID

  memset(wcID, NULL, sizeof(wcID));
  memset(szID, NULL, sizeof(szID));
    StringFromGUID2(CLSID_classprovider, wcID, sizeof(wcID)/sizeof(WCHAR));
  wcstombs(szID, wcID, sizeof(szID));
  StringCbCopy(szCLSID, sizeof(szCLSID), "Software\\classes\\CLSID\\");
  StringCbCat(szCLSID, sizeof(szCLSID), (LPCTSTR)szID);

    // First delete the InProcServer subkey.

    DWORD dwRet = RegOpenKeyEx(HKEY_LOCAL_MACHINE, szCLSID, 0, KEY_WRITE, &hKey);
    if(dwRet == NO_ERROR)
    {
        RegDeleteKey(hKey, "InProcServer32");
        RegCloseKey(hKey);
    }

    dwRet = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\classes\\CLSID", 0, KEY_WRITE, &hKey);
    if(dwRet == NO_ERROR)
    {
        RegDeleteKey(hKey,szID);
        RegCloseKey(hKey);
    }

    return NOERROR;
}

BOOL WINAPI LibMain32 | ( | HINSTANCE | hInstance,
 |  | ULONG | ulReason,
 |  | LPVOID | pvReserved
 | ) |  |

Definition at line 59 of file MainDll.Cpp.

{
    if (DLL_PROCESS_ATTACH==ulReason)
        ghModule = hInstance;
    return TRUE;
}

Variable Documentation

long g_cLock = 0

Definition at line 45 of file MainDll.Cpp.

long g_cObj = 0

Definition at line 44 of file MainDll.Cpp.

HMODULE ghModule

Definition at line 33 of file MainDll.Cpp.

Generated on Wed Nov 13 2024 16:54:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/ClassProv/Sample.h File Reference

  • SysMgmt
  • WMI
  • VC
  • ClassProv
Classes | Typedefs | Functions | Variables

Sample.h File Reference

#include <wbemprov.h>

Go to the source code of this file.

Classes

class | CClassPro
class | CProvFactory
struct | InstDef

Typedefs

typedef CClassPro * | PCClassPro
typedef CProvFactory * | PCProvFactory
typedef LPVOID * | PPVOID

Functions

SCODE | CreateClass (IWbemServices *pNamespace, IWbemClassObject **pNewInst, WCHAR *pwcClassName, IWbemContext *pCtx)
SCODE | CreateInst (IWbemServices *pNamespace, LPWSTR pKey, long lVal, IWbemClassObject **pNewInst, WCHAR *pwcClassName, IWbemContext *pCtx)

Variables

long | g_cLock
long | g_cObj
long | glNumInst
InstDef MyDefs []

Typedef Documentation

typedef CClassPro* PCClassPro

Definition at line 196 of file Sample.h.

typedef CProvFactory* PCProvFactory

Definition at line 220 of file Sample.h.

typedef LPVOID* PPVOID

Definition at line 26 of file Sample.h.

Function Documentation

SCODE CreateClass | ( | IWbemServices * | pNamespace,
 |  | IWbemClassObject ** | pNewInst,
 |  | WCHAR * | pwcClassName,
 |  | IWbemContext * | pCtx
 | ) |  |

Definition at line 71 of file Utils.Cpp.

{

    SCODE sc;
    sc = pNamespace->GetObject(NULL, 0, pCtx, pNewClass, NULL);
    if(sc != S_OK)
        return sc;

    VARIANT v;

    // Set the class name.

    v.vt = VT_BSTR;
    v.bstrVal = SysAllocString(pwcClassName);
  if (!v.bstrVal)
    return WBEM_E_OUT_OF_MEMORY;
    sc = (*pNewClass)->Put(L"__class", 0, &v, 0);
    VariantClear(&v);

    // Set the key property value.

    v.vt = VT_NULL;
    sc = (*pNewClass)->Put(L"MyKey", 0, &v, CIM_STRING);

    // Set the number property value.

    sc = (*pNewClass)->Put(L"MyValue", 0, &v, CIM_SINT32);

  // Set the key qualifier

  IWbemQualifierSet* pQualSet = NULL;

  sc = (*pNewClass)->GetPropertyQualifierSet(L"MyKey", &pQualSet);
  if(pQualSet)
  {
      v.vt = VT_BOOL;
    v.boolVal = VARIANT_TRUE;
    sc = pQualSet->Put(L"Key", &v, 0);
    pQualSet->Release();
  }

  // Set the dynamic qualifier

  sc = (*pNewClass)->GetQualifierSet(&pQualSet);
  if(pQualSet)
  {
      v.vt = VT_BOOL;
    v.boolVal = VARIANT_TRUE;
    sc = pQualSet->Put(L"Dynamic", &v, 0);

      v.vt = VT_BSTR;
    v.bstrVal = SysAllocString(L"ClassProvSamp");
    if (v.bstrVal)
      sc = pQualSet->Put(L"Provider", &v, 0);
    else
      sc = WBEM_E_OUT_OF_MEMORY;
    VariantClear(&v);

    pQualSet->Release();
  }

    return sc;

}

SCODE CreateInst | ( | IWbemServices * | pNamespace,
 |  | LPWSTR | pKey,
 |  | long | lVal,
 |  | IWbemClassObject ** | pNewInst,
 |  | WCHAR * | pwcClassName,
 |  | IWbemContext * | pCtx
 | ) |  |

Definition at line 36 of file Utils.Cpp.

{
    SCODE sc;
    IWbemClassObject * pClass = NULL;
    sc = pNamespace->GetObject(pwcClassName, 0, pCtx, &pClass, NULL);
    if(sc != S_OK)
        return WBEM_E_FAILED;
    sc = pClass->SpawnInstance(0, pNewInst);
    pClass->Release();
    if(FAILED(sc))
        return sc;
    VARIANT v;

    // Set the key property value.

    v.vt = VT_BSTR;
    v.bstrVal = SysAllocString(pKey);
  if (v.bstrVal == NULL)
    return WBEM_E_OUT_OF_MEMORY;
    sc = (*pNewInst)->Put(L"MyKey", 0, &v, 0);
    VariantClear(&v);
  if(FAILED(sc))
        return sc;

    // Set the number property value.

    v.vt = VT_I4;
    v.lVal = lVal;
    sc = (*pNewInst)->Put(L"MyValue", 0, &v, 0);
    return sc;
}

Variable Documentation

long g_cLock

Definition at line 27 of file myclassfactory.cpp.

long g_cObj

Definition at line 26 of file myclassfactory.cpp.

long glNumInst

Definition at line 31 of file ClassProv.Cpp.

InstDef MyDefs[]

Definition at line 29 of file ClassProv.Cpp.

Generated on Wed Nov 13 2024 16:53:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/ClassProv/Utils.Cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • ClassProv
Functions

Utils.Cpp File Reference

#include <objbase.h>
#include "sample.h"

Go to the source code of this file.

Functions

SCODE | CreateClass (IWbemServices *pNamespace, IWbemClassObject **pNewClass, WCHAR *pwcClassName, IWbemContext *pCtx)
SCODE | CreateInst (IWbemServices *pNamespace, LPWSTR pKey, long lVal, IWbemClassObject **pNewInst, WCHAR *pwcClassName, IWbemContext *pCtx)

Function Documentation

SCODE CreateClass | ( | IWbemServices * | pNamespace,
 |  | IWbemClassObject ** | pNewClass,
 |  | WCHAR * | pwcClassName,
 |  | IWbemContext * | pCtx
 | ) |  |

Definition at line 71 of file Utils.Cpp.

{

    SCODE sc;
    sc = pNamespace->GetObject(NULL, 0, pCtx, pNewClass, NULL);
    if(sc != S_OK)
        return sc;

    VARIANT v;

    // Set the class name.

    v.vt = VT_BSTR;
    v.bstrVal = SysAllocString(pwcClassName);
  if (!v.bstrVal)
    return WBEM_E_OUT_OF_MEMORY;
    sc = (*pNewClass)->Put(L"__class", 0, &v, 0);
    VariantClear(&v);

    // Set the key property value.

    v.vt = VT_NULL;
    sc = (*pNewClass)->Put(L"MyKey", 0, &v, CIM_STRING);

    // Set the number property value.

    sc = (*pNewClass)->Put(L"MyValue", 0, &v, CIM_SINT32);

  // Set the key qualifier

  IWbemQualifierSet* pQualSet = NULL;

  sc = (*pNewClass)->GetPropertyQualifierSet(L"MyKey", &pQualSet);
  if(pQualSet)
  {
      v.vt = VT_BOOL;
    v.boolVal = VARIANT_TRUE;
    sc = pQualSet->Put(L"Key", &v, 0);
    pQualSet->Release();
  }

  // Set the dynamic qualifier

  sc = (*pNewClass)->GetQualifierSet(&pQualSet);
  if(pQualSet)
  {
      v.vt = VT_BOOL;
    v.boolVal = VARIANT_TRUE;
    sc = pQualSet->Put(L"Dynamic", &v, 0);

      v.vt = VT_BSTR;
    v.bstrVal = SysAllocString(L"ClassProvSamp");
    if (v.bstrVal)
      sc = pQualSet->Put(L"Provider", &v, 0);
    else
      sc = WBEM_E_OUT_OF_MEMORY;
    VariantClear(&v);

    pQualSet->Release();
  }

    return sc;

}

SCODE CreateInst | ( | IWbemServices * | pNamespace,
 |  | LPWSTR | pKey,
 |  | long | lVal,
 |  | IWbemClassObject ** | pNewInst,
 |  | WCHAR * | pwcClassName,
 |  | IWbemContext * | pCtx
 | ) |  |

Definition at line 36 of file Utils.Cpp.

{
    SCODE sc;
    IWbemClassObject * pClass = NULL;
    sc = pNamespace->GetObject(pwcClassName, 0, pCtx, &pClass, NULL);
    if(sc != S_OK)
        return WBEM_E_FAILED;
    sc = pClass->SpawnInstance(0, pNewInst);
    pClass->Release();
    if(FAILED(sc))
        return sc;
    VARIANT v;

    // Set the key property value.

    v.vt = VT_BSTR;
    v.bstrVal = SysAllocString(pKey);
  if (v.bstrVal == NULL)
    return WBEM_E_OUT_OF_MEMORY;
    sc = (*pNewInst)->Put(L"MyKey", 0, &v, 0);
    VariantClear(&v);
  if(FAILED(sc))
        return sc;

    // Set the number property value.

    v.vt = VT_I4;
    v.lVal = lVal;
    sc = (*pNewInst)->Put(L"MyValue", 0, &v, 0);
    return sc;
}

Generated on Wed Nov 13 2024 16:53:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/CmdLineConsumer/CmdLineConsumer.Cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • CmdLineConsumer
Defines | Variables

CmdLineConsumer.Cpp File Reference

#include "stdafx.h"
#include "CmdLineConsumer.h"
#include "CmdLineConsumerDlg.h"
#include <objbase.h>
#include <strsafe.h>

Go to the source code of this file.

Defines

#define TCHAR_LEN_IN_BYTES(str) (unsigned long)(_tcslen(str)*sizeof(TCHAR)+sizeof(TCHAR))

Variables

CCmdLineConsumerApp theApp

Define Documentation

#define TCHAR_LEN_IN_BYTES ( str ) (unsigned long)(_tcslen(str)*sizeof(TCHAR)+sizeof(TCHAR))

Definition at line 186 of file CmdLineConsumer.Cpp.

Variable Documentation

CCmdLineConsumerApp theApp

Definition at line 51 of file CmdLineConsumer.Cpp.

Generated on Wed Nov 13 2024 16:54:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/CmdLineConsumer/CmdLineConsumer.h File Reference

  • SysMgmt
  • WMI
  • VC
  • CmdLineConsumer
Classes

CmdLineConsumer.h File Reference

#include "resource.h"
#include "factory.h"
#include "resource.h"
#include "factory.h"

Go to the source code of this file.

Classes

class CCmdLineConsumerApp
Generated on Wed Nov 13 2024 16:54:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/CmdLineConsumer/CmdLineConsumerDlg.Cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • CmdLineConsumer
Classes

CmdLineConsumerDlg.Cpp File Reference

#include "stdafx.h"
#include "CmdLineConsumer.h"
#include "CmdLineConsumerDlg.h"

Go to the source code of this file.

Classes

class CAboutDlg
Generated on Wed Nov 13 2024 16:54:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/CmdLineConsumer/CmdLineConsumerDlg.h File Reference

  • SysMgmt
  • WMI
  • VC
  • CmdLineConsumer
Classes

CmdLineConsumerDlg.h File Reference

Go to the source code of this file.

Classes

class CCmdLineConsumerDlg
Generated on Wed Nov 13 2024 16:54:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/CmdLineConsumer/Consumer.Cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • CmdLineConsumer
Functions

Consumer.Cpp File Reference

#include "stdafx.h"
#include "Consumer.h"
#include <objbase.h>
#include <strsafe.h>

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CConsumer

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 50 of file Consumer.Cpp.

{
    if (--m_cRef != 0L)
        return m_cRef;

    delete this;
    return 0L;
}

Generated on Wed Nov 13 2024 16:54:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/CmdLineConsumer/Consumer.h File Reference

  • SysMgmt
  • WMI
  • VC
  • CmdLineConsumer
Classes

Consumer.h File Reference

#include <wbemcli.h>
#include <wbemprov.h>

Go to the source code of this file.

Classes

class CConsumer
Generated on Wed Nov 13 2024 16:54:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/CmdLineConsumer/Factory.Cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • CmdLineConsumer
Functions

Factory.Cpp File Reference

#include "stdafx.h"
#include "factory.h"
#include "Provider.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CProviderFactory

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 55 of file Factory.Cpp.

{
    int lNewRef = InterlockedDecrement(&m_cRef);
    if(lNewRef == 0)
    {
        delete this;
    }

    return lNewRef;
}

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/CmdLineConsumer/Factory.h File Reference

  • SysMgmt
  • WMI
  • VC
  • CmdLineConsumer
Classes

Factory.h File Reference

#include <wbemcli.h>

Go to the source code of this file.

Classes

class CProviderFactory
Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/CmdLineConsumer/Provider.Cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • CmdLineConsumer
Functions

Provider.Cpp File Reference

#include "stdafx.h"
#include "Provider.h"
#include "Consumer.h"
#include <objbase.h>

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CProvider

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 50 of file Provider.Cpp.

{
    if (--m_cRef != 0L)
        return m_cRef;

    delete this;
    return 0L;
}

Generated on Wed Nov 13 2024 16:54:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/CmdLineConsumer/Provider.h File Reference

  • SysMgmt
  • WMI
  • VC
  • CmdLineConsumer
Classes

Provider.h File Reference

#include <wbemcli.h>
#include <wbemprov.h>

Go to the source code of this file.

Classes

class CProvider
Generated on Wed Nov 13 2024 16:54:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/CmdLineConsumer/Resource.h File Reference

  • SysMgmt
  • WMI
  • VC
  • CmdLineConsumer
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_CUSTOM1 1001
#define | IDC_LIST 1000
#define | IDD_ABOUTBOX 100
#define | IDD_CMDLINECONSUMER_DIALOG 102
#define | IDM_ABOUTBOX 0x0010
#define | IDR_MAINFRAME 128
#define | IDS_ABOUTBOX 101

Define Documentation

#define IDC_CUSTOM1 1001

Definition at line 12 of file Resource.h.

#define IDC_LIST 1000

Definition at line 11 of file Resource.h.

#define IDD_ABOUTBOX 100

Definition at line 7 of file Resource.h.

#define IDD_CMDLINECONSUMER_DIALOG 102

Definition at line 9 of file Resource.h.

#define IDM_ABOUTBOX 0x0010

Definition at line 6 of file Resource.h.

#define IDR_MAINFRAME 128

Definition at line 10 of file Resource.h.

#define IDS_ABOUTBOX 101

Definition at line 8 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/CmdLineConsumer/StdAfx.Cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • CmdLineConsumer

StdAfx.Cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/CmdLineConsumer/StdAfx.h File Reference

  • SysMgmt
  • WMI
  • VC
  • CmdLineConsumer
Defines

StdAfx.h File Reference

#include <afxwin.h>
#include <afxext.h>
#include <afxcmn.h>

Go to the source code of this file.

Defines

#define VC_EXTRALEAN

Define Documentation

#define VC_EXTRALEAN

Definition at line 14 of file StdAfx.h.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/decoupled/Event_Consumer/Events.cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • decoupled
  • Event_Consumer
Functions

Events.cpp File Reference

#include "precomp.h"
#include <wbemcli.h>
#include <wbemprov.h>
#include "Globals.h"
#include "Events.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CProvider_IWbemEventConsumerProvider

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 419 of file Events.cpp.

{
  LONG t_Reference ;
  if ( ( t_Reference = InterlockedDecrement ( & m_ReferenceCount ) ) == 0 )
  {
/*
 *  No more outstanding references, delete the object.
 */

    delete this ;
  }

  return t_Reference ;
}

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/decoupled/Event_Consumer/Globals.cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • decoupled
  • Event_Consumer
Defines

Globals.cpp File Reference

#include "PreComp.h"
#include <wbemprov.h>
#include <initguid.h>
#include "Globals.h"

Go to the source code of this file.

Defines

#define INITGUID

Define Documentation

#define INITGUID

Definition at line 21 of file Globals.cpp.

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/decoupled/Event_Consumer/Main.cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • decoupled
  • Event_Consumer
Defines | Functions

Main.cpp File Reference

#include "precomp.h"
#include <objbase.h>
#include <stdio.h>
#include <tchar.h>
#include <wbemcli.h>
#include <wbemprov.h>
#include "Globals.h"
#include "Events.h"

Go to the source code of this file.

Defines

#define | EOAC_DYNAMIC_CLOAKING 0x40

Functions

HRESULT | InitComServer (DWORD a_AuthenticationLevel, DWORD a_ImpersonationLevel)
HRESULT | Process ()
HRESULT | Process_DecoupledEventConsumer ()
HRESULT | RegisterDecoupledEventConsumer (IWbemDecoupledRegistrar *&a_Registrar)
HRESULT | UninitComServer ()
void | WindowsDispatch ()
HWND | WindowsInit (HINSTANCE a_HInstance)
LRESULT CALLBACK | WindowsMainProc (HWND a_hWnd, UINT a_message, WPARAM a_wParam, LPARAM a_lParam)
HWND | WindowsStart (HINSTANCE a_Handle)
void | WindowsStop (HWND a_HWnd)
int WINAPI | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)

Define Documentation

#define EOAC_DYNAMIC_CLOAKING 0x40

Function Documentation

HRESULT InitComServer | ( | DWORD | a_AuthenticationLevel,
 |  | DWORD | a_ImpersonationLevel
 | ) |  |

Definition at line 198 of file Main.cpp.

{
  HRESULT t_Result = S_OK ;

    t_Result = CoInitializeEx (

    0,
    COINIT_MULTITHREADED
  );

#ifndef EOAC_DYNAMIC_CLOAKING
#define EOAC_DYNAMIC_CLOAKING 0x40
#endif

  if ( SUCCEEDED ( t_Result ) )
  {

    DWORD dwCapabilities;
    if (a_AuthenticationLevel == RPC_C_AUTHN_LEVEL_NONE)
      dwCapabilities = EOAC_NONE;
    else
      dwCapabilities = EOAC_SECURE_REFS;

    t_Result = CoInitializeSecurity (

      NULL,
      -1,
      NULL,
      NULL,
      a_AuthenticationLevel,
      a_ImpersonationLevel,
      NULL,
      EOAC_DYNAMIC_CLOAKING | dwCapabilities,
      0
    );

    if ( FAILED ( t_Result ) )
    {
      CoUninitialize () ;
      return t_Result ;
    }
  }

  if ( FAILED ( t_Result ) )
  {
    CoUninitialize () ;
  }

  return t_Result  ;
}

HRESULT Process ( )

Definition at line 380 of file Main.cpp.

{
  DWORD t_ImpersonationLevel = RPC_C_IMP_LEVEL_IDENTIFY ;
  DWORD t_AuthenticationLevel = RPC_C_AUTHN_LEVEL_PKT_PRIVACY;

  HRESULT t_Result = InitComServer ( t_AuthenticationLevel , t_ImpersonationLevel ) ;
  if ( SUCCEEDED ( t_Result ) )
  {
    try
    {
      t_Result = Process_DecoupledEventConsumer () ;
    }
    catch ( ... )
    {
    }

    UninitComServer () ;
  }

  return t_Result ;
}

HRESULT Process_DecoupledEventConsumer ( )

Definition at line 348 of file Main.cpp.

{
  IWbemDecoupledRegistrar *t_EventConsumerRegistrar = NULL ;

  HRESULT t_Result = RegisterDecoupledEventConsumer ( t_EventConsumerRegistrar ) ;
  if ( SUCCEEDED ( t_Result ) )
  {
    WindowsDispatch () ;
  }

  if ( t_EventConsumerRegistrar )
  {
    t_EventConsumerRegistrar->UnRegister () ;
    t_EventConsumerRegistrar->Release () ;
  }

  return t_Result ;
}

HRESULT RegisterDecoupledEventConsumer ( IWbemDecoupledRegistrar *& a_Registrar )

Definition at line 263 of file Main.cpp.

{
/*
 *  Cleanup out arguments
 */

  a_Registrar = NULL ;

/*
 *  Create the event registrar, so that we can register with WMI.
 */

  HRESULT t_Result = Provider_Globals :: CreateInstance (

    CLSID_WbemDecoupledRegistrar ,
    NULL ,
    CLSCTX_INPROC_SERVER ,
    IID_IWbemDecoupledRegistrar ,
    ( void ** ) & a_Registrar
  ) ;

  if ( SUCCEEDED ( t_Result ) )
  {
/*
 *  Create our implementation instance of the event consumer
 */

    CProvider_IWbemEventConsumerProvider *t_Consumer = new CProvider_IWbemEventConsumerProvider ;
    if ( t_Consumer )
    {
      t_Consumer->AddRef () ;

      IUnknown *t_Unknown = NULL ;
      t_Result = t_Consumer->QueryInterface ( IID_IUnknown , ( void ** ) & t_Unknown ) ;
      if ( SUCCEEDED ( t_Result ) )
      {
/*
 *  Register the provider inteface with WMI, specifying the namespace and provider instance of __Win32provider
 */

        t_Result = a_Registrar->Register (

          0 ,
          NULL ,
          NULL ,
          NULL ,
          L"root\\cimv2" ,
          L"DecoupledEventConsumer" ,
          t_Unknown
        ) ;

        t_Unknown->Release () ;
      }

      t_Consumer->Release () ;
    }
  }

  if ( FAILED ( t_Result ) )
  {
    if ( a_Registrar )
    {
      a_Registrar->Release () ;
      a_Registrar = NULL ;
    }
  }

  return t_Result ;
}

HRESULT UninitComServer ( )

Definition at line 180 of file Main.cpp.

{
  CoUninitialize () ;

  return S_OK ;
}

void WindowsDispatch ( )

Definition at line 157 of file Main.cpp.

{
  BOOL t_GetMessage ;
  MSG t_lpMsg ;

  while ( ( t_GetMessage = GetMessage ( & t_lpMsg , NULL , 0 , 0 ) ) == TRUE )
  {
    TranslateMessage ( & t_lpMsg ) ;
    DispatchMessage ( & t_lpMsg ) ;
  }
}

HWND WindowsInit ( HINSTANCE a_HInstance )

Definition at line 69 of file Main.cpp.

{
  static wchar_t *t_TemplateCode = L"TemplateCode" ;

  WNDCLASS  t_wc ;

  t_wc.style            = CS_HREDRAW | CS_VREDRAW ;
  t_wc.lpfnWndProc      = WindowsMainProc ;
  t_wc.cbClsExtra       = 0 ;
  t_wc.cbWndExtra       = 0 ;
  t_wc.hInstance        = a_HInstance ;
  t_wc.hIcon            = LoadIcon(NULL, IDI_HAND) ;
  t_wc.hCursor          = LoadCursor(NULL, IDC_ARROW) ;
  t_wc.hbrBackground    = (HBRUSH) (COLOR_WINDOW + 1) ;
  t_wc.lpszMenuName     = NULL ;
  t_wc.lpszClassName    = t_TemplateCode ;

  ATOM t_winClass = RegisterClass ( &t_wc ) ;

  HWND t_HWnd = CreateWindow (

    t_TemplateCode ,              // see RegisterClass() call
    t_TemplateCode ,                      // text for window title bar
    WS_OVERLAPPEDWINDOW | WS_MINIMIZE ,               // window style
    CW_USEDEFAULT ,                     // default horizontal position
    CW_USEDEFAULT ,                     // default vertical position
    CW_USEDEFAULT ,                     // default width
    CW_USEDEFAULT ,                     // default height
    NULL ,                              // overlapped windows have no parent
    NULL ,                              // use the window class menu
    a_HInstance ,
    NULL                                // pointer not needed
  ) ;

  ShowWindow ( t_HWnd, SW_SHOW ) ;
  //ShowWindow ( t_HWnd, SW_HIDE ) ;

  return t_HWnd ;
}

LRESULT CALLBACK WindowsMainProc | ( | HWND | a_hWnd,
 |  | UINT | a_message,
 |  | WPARAM | a_wParam,
 |  | LPARAM | a_lParam
 | ) |  |

Definition at line 36 of file Main.cpp.

{
  LRESULT t_rc = 0 ;

  switch ( a_message )
  {
    case WM_DESTROY:
    {
      PostMessage ( a_hWnd , WM_QUIT , 0 , 0 ) ;
    }
    break ;

    default:
    {
      t_rc = DefWindowProc ( a_hWnd , a_message , a_wParam , a_lParam ) ;
    }
    break ;
  }

  return ( t_rc ) ;
}

HWND WindowsStart ( HINSTANCE a_Handle )

Definition at line 136 of file Main.cpp.

{
  HWND t_HWnd = NULL ;
  if ( ! ( t_HWnd = WindowsInit ( a_Handle ) ) )
  {
    }

  return t_HWnd ;
}

void WindowsStop ( HWND a_HWnd )

Definition at line 120 of file Main.cpp.

{
  DestroyWindow ( a_HWnd ) ;
}

int WINAPI WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nShowCmd
 | ) |  |

Definition at line 414 of file Main.cpp.

{
  HRESULT t_Result = Provider_Globals :: Global_Startup () ;
  if ( SUCCEEDED ( t_Result ) )
  {
    HWND t_Window = WindowsStart ( hInstance ) ;
    if ( t_Window )
    {
      t_Result = Process () ;

      WindowsStop ( t_Window ) ;
    }

    t_Result = Provider_Globals :: Global_Shutdown () ;
  }

  return 0 ;
}

Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/decoupled/Event_Consumer/PreComp.h File Reference

  • SysMgmt
  • WMI
  • VC
  • decoupled
  • Event_Consumer
Defines

PreComp.h File Reference

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <tchar.h>

Go to the source code of this file.

Defines

#define _WIN32_WINNT 0x0400

Define Documentation

#define _WIN32_WINNT 0x0400

Definition at line 16 of file PreComp.h.

Generated on Wed Nov 13 2024 16:53:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/decoupled/Event_Consumer/Include/Events.h File Reference

  • SysMgmt
  • WMI
  • VC
  • decoupled
  • Event_Consumer
  • Include
Classes

Events.h File Reference

Go to the source code of this file.

Classes

class | CProvider_IWbemEventConsumerProvider
class | CProvider_IWbemUnboundObjectSink
Generated on Wed Nov 13 2024 16:54:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/decoupled/Event_Consumer/Include/Globals.h File Reference

  • SysMgmt
  • WMI
  • VC
  • decoupled
  • Event_Consumer
  • Include
Classes

Globals.h File Reference

Go to the source code of this file.

Classes

class Provider_Globals
Generated on Wed Nov 13 2024 16:54:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/decoupled/Event_Consumer/Include/Resource.h File Reference

  • SysMgmt
  • WMI
  • VC
  • decoupled
  • Event_Consumer
  • Include

Resource.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/decoupled/Event_Provider/Events.cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • decoupled
  • Event_Provider
Functions

Events.cpp File Reference

#include "precomp.h"
#include <wbemcli.h>
#include <wbemprov.h>
#include "Globals.h"
#include "Events.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CProvider_IWbemEventProvider

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 176 of file Events.cpp.

{
  LONG t_Reference ;
  if ( ( t_Reference = InterlockedDecrement ( & m_InternalReferenceCount ) ) == 0 )
  {
    delete this ;
  }

  return t_Reference ;
}

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/decoupled/Event_Provider/Globals.cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • decoupled
  • Event_Provider

Globals.cpp File Reference

#include <PreComp.h>
#include <wbemprov.h>
#include <initguid.h>
#include "Globals.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/decoupled/Event_Provider/Main.cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • decoupled
  • Event_Provider
Classes | Defines | Functions | Variables

Main.cpp File Reference

#include <precomp.h>
#include <objbase.h>
#include <stdio.h>
#include <tchar.h>
#include <wbemcli.h>
#include <wbemprov.h>
#include "Globals.h"

Go to the source code of this file.

Classes

struct | ThreadArg_Struct

Defines

#define | EOAC_DYNAMIC_CLOAKING 0x40

Functions

HRESULT | InitComServer (DWORD a_AuthenticationLevel, DWORD a_ImpersonationLevel)
HRESULT | Process ()
HRESULT | Process_DecoupledEvent ()
HRESULT | Process_DecoupledRestrictedEvent ()
HRESULT | RegisterDecoupledEvent (IWbemDecoupledBasicEventProvider *&a_Registrar, HANDLE &a_ThreadHandle)
HRESULT | RegisterDecoupledRestrictedEvent (IWbemDecoupledBasicEventProvider *&a_Registrar, HANDLE &a_ThreadHandle)
DWORD | RestrictedThreadExecutionFunction (void *a_Context)
DWORD | ThreadExecutionFunction (void *a_Context)
HRESULT | UninitComServer ()
void | WindowsDispatch ()
HWND | WindowsInit (HINSTANCE a_HInstance)
LRESULT CALLBACK | WindowsMainProc (HWND a_hWnd, UINT a_message, WPARAM a_wParam, LPARAM a_lParam)
HWND | WindowsStart (HINSTANCE a_Handle)
void | WindowsStop (HWND a_HWnd)
int WINAPI | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)

Variables

HANDLE | g_ThreadTerminate = NULL

Define Documentation

#define EOAC_DYNAMIC_CLOAKING 0x40

Function Documentation

HRESULT InitComServer | ( | DWORD | a_AuthenticationLevel,
 |  | DWORD | a_ImpersonationLevel
 | ) |  |

Definition at line 210 of file Main.cpp.

{
  HRESULT t_Result = S_OK ;

    t_Result = CoInitializeEx (

    0,
    COINIT_MULTITHREADED
  );

#ifndef EOAC_DYNAMIC_CLOAKING
#define EOAC_DYNAMIC_CLOAKING 0x40
#endif

  if ( SUCCEEDED ( t_Result ) )
  {

    DWORD dwCapabilities;
    if (a_AuthenticationLevel == RPC_C_AUTHN_LEVEL_NONE)
      dwCapabilities = EOAC_NONE;
    else
      dwCapabilities = EOAC_SECURE_REFS;

    t_Result = CoInitializeSecurity (

      NULL,
      -1,
      NULL,
      NULL,
      a_AuthenticationLevel,
      a_ImpersonationLevel,
      NULL,
      EOAC_DYNAMIC_CLOAKING | dwCapabilities,
      0
    );

    if ( FAILED ( t_Result ) )
    {
      CoUninitialize () ;
      return t_Result ;
    }
  }

  if ( FAILED ( t_Result ) )
  {
    CoUninitialize () ;
  }

  return t_Result  ;
}

HRESULT Process ( )

Definition at line 1050 of file Main.cpp.

{
  DWORD t_ImpersonationLevel = RPC_C_IMP_LEVEL_IDENTIFY ;
  DWORD t_AuthenticationLevel = RPC_C_AUTHN_LEVEL_PKT_PRIVACY;

  HRESULT t_Result = InitComServer ( t_AuthenticationLevel , t_ImpersonationLevel ) ;
  if ( SUCCEEDED ( t_Result ) )
  {
    try
    {
#if 0

/*
 *  Create a restricted sink event provider
 */
      t_Result = Process_DecoupledRestrictedEvent () ;

#else

/*
 *  Create a regular sink event provider
 */

      t_Result = Process_DecoupledEvent () ;
#endif
    }
    catch ( ... )
    {
    }

    UninitComServer () ;
  }

  return t_Result ;
}

HRESULT Process_DecoupledEvent ( )

Definition at line 967 of file Main.cpp.

{
  HANDLE t_ThreadHandle = NULL ;

  IWbemDecoupledBasicEventProvider *t_EventRegistrar = NULL ;

  HRESULT t_Result = RegisterDecoupledEvent ( t_EventRegistrar , t_ThreadHandle ) ;

  if ( SUCCEEDED ( t_Result ) )
  {
    WindowsDispatch () ;

/*
 *  Wait for provider thread to terminate before completing.
 */

    SetEvent ( g_ThreadTerminate ) ;
    WaitForSingleObject ( t_ThreadHandle , INFINITE ) ;
    CloseHandle ( t_ThreadHandle ) ;
  }

  if ( t_EventRegistrar )
  {
    t_EventRegistrar->UnRegister () ;
    t_EventRegistrar->Release () ;
  }

  return t_Result ;
}

HRESULT Process_DecoupledRestrictedEvent ( )

Definition at line 1009 of file Main.cpp.

{
  HANDLE t_ThreadHandle = NULL ;

  IWbemDecoupledBasicEventProvider *t_EventRegistrar = NULL ;

  HRESULT t_Result = RegisterDecoupledRestrictedEvent ( t_EventRegistrar , t_ThreadHandle ) ;
  if ( SUCCEEDED ( t_Result ) )
  {
    WindowsDispatch () ;

/*
 *  Wait for provider thread to terminate before completing.
 */

    SetEvent ( g_ThreadTerminate ) ;
    WaitForSingleObject ( t_ThreadHandle , INFINITE ) ;
    CloseHandle ( t_ThreadHandle ) ;
  }

  if ( t_EventRegistrar )
  {
    t_EventRegistrar->UnRegister () ;
    t_EventRegistrar->Release () ;
  }

  return t_Result ;
}

HRESULT RegisterDecoupledEvent | ( | IWbemDecoupledBasicEventProvider *& | a_Registrar,
 |  | HANDLE & | a_ThreadHandle
 | ) |  |

Definition at line 643 of file Main.cpp.

{
/*
 *  Cleanup out arguments
 */

  a_ThreadHandle = NULL ;
  a_Registrar = NULL ;

  HRESULT t_Result = S_OK ;

/*
 *  Create an event to inform worker thread to terminate.
 */

  g_ThreadTerminate = CreateEvent ( NULL , FALSE , FALSE , NULL ) ;
  if ( g_ThreadTerminate )
  {
/*
 *  Create the event registrar, so that we can register with WMI.
 */

    t_Result = Provider_Globals :: CreateInstance (

      CLSID_WbemDecoupledBasicEventProvider ,
      NULL ,
      CLSCTX_INPROC_SERVER ,
      IID_IWbemDecoupledBasicEventProvider ,
      ( void ** ) & a_Registrar
    ) ;

    if ( SUCCEEDED ( t_Result ) )
    {
      t_Result = a_Registrar->Register (

        0 ,
        NULL ,
        NULL ,
        NULL ,
        L"root\\cimv2" ,
        L"DecoupledEventProvider" ,
        NULL
      ) ;

      if ( SUCCEEDED ( t_Result ) )
      {
/*
 *  Grab the IWbemServices pointer associated with the provider instance, use it later to
 *  query for class specific information when generating events.
 */

        IWbemServices *t_Service = NULL ;
        t_Result = a_Registrar->GetService ( 0 , NULL , & t_Service ) ;
        if ( SUCCEEDED ( t_Result ) )
        {

/*
 *  Grab the event sink associated with the event provider instance, use it later to send events to WMI.
 */

          IWbemObjectSink *t_Sink = NULL ;
          t_Result = a_Registrar->GetSink ( 0 , NULL , & t_Sink ) ;
          if ( SUCCEEDED ( t_Result ) )
          {
/*
 *  Pass information taken from WMI and package it so that worker thread can
 *  proceed.
 */

            struct ThreadArg_Struct *t_ThreadStruct = new ThreadArg_Struct ;
            if ( t_ThreadStruct )
            {
              t_ThreadStruct->m_Service = t_Service ;
              t_ThreadStruct->m_Sink = t_Sink ;
              t_ThreadStruct->m_Registrar = a_Registrar ;

              t_ThreadStruct->m_Service->AddRef () ;
              t_ThreadStruct->m_Sink->AddRef () ;
              t_ThreadStruct->m_Registrar->AddRef () ;

/*
 *  Create worker thread.
 */

              DWORD t_ThreadId = 0 ;
              a_ThreadHandle = CreateThread (

                NULL ,
                0 ,
                ( LPTHREAD_START_ROUTINE ) ThreadExecutionFunction ,
                t_ThreadStruct ,
                0 ,
                & t_ThreadId
              ) ;

              if ( a_ThreadHandle == NULL )
              {
/*
 *  Everything failed to release resources.
 */

                t_ThreadStruct->m_Service->Release () ;
                t_ThreadStruct->m_Sink->Release () ;
                t_ThreadStruct->m_Registrar->Release () ;

                delete t_ThreadStruct ;

                t_Result = WBEM_E_FAILED ;
              }
            }
            else
            {
              t_Result = WBEM_E_OUT_OF_MEMORY ;
            }

            t_Sink->Release () ;
          }

          t_Service->Release () ;
        }
      }
    }

    if ( FAILED ( t_Result ) )
    {
      if ( a_Registrar )
      {
        a_Registrar->Release () ;
        a_Registrar = NULL ;
      }
    }
  }
  else
  {
    t_Result = WBEM_E_OUT_OF_MEMORY ;
  }

  return t_Result ;
}

HRESULT RegisterDecoupledRestrictedEvent | ( | IWbemDecoupledBasicEventProvider *& | a_Registrar,
 |  | HANDLE & | a_ThreadHandle
 | ) |  |

Definition at line 801 of file Main.cpp.

{
/*
 *  Cleanup out arguments
 */

  a_ThreadHandle = NULL ;
  a_Registrar = NULL ;

  HRESULT t_Result = S_OK ;

/*
 *  Create an event to inform worker thread to terminate.
 */

  g_ThreadTerminate = CreateEvent ( NULL , FALSE , FALSE , NULL ) ;
  if ( g_ThreadTerminate )
  {
/*
 *  Create the event registrar, so that we can register with WMI.
 */

    t_Result = Provider_Globals :: CreateInstance (

      CLSID_WbemDecoupledBasicEventProvider ,
      NULL ,
      CLSCTX_INPROC_SERVER ,
      IID_IWbemDecoupledBasicEventProvider ,
      ( void ** ) & a_Registrar
    ) ;

    if ( SUCCEEDED ( t_Result ) )
    {
/*
 *  Register the provider inteface with WMI, specifying the namespace and provider instance of __Win32provider
 */

      t_Result = a_Registrar->Register (

        0 ,
        NULL ,
        NULL ,
        NULL ,
        L"root\\cimv2" ,
        L"DecoupledEventProvider" ,
        NULL
      ) ;

      if ( SUCCEEDED ( t_Result ) )
      {
/*
 *  Grab the IWbemServices pointer associated with the provider instance, use it later to
 *  query for class specific information when generating events.
 */

        IWbemServices *t_Service = NULL ;
        t_Result = a_Registrar->GetService ( 0 , NULL , & t_Service ) ;
        if ( SUCCEEDED ( t_Result ) )
        {
/*
 *  Grab the event sink associated with the event provider instance, use it later to send events to WMI.
 */
          IWbemObjectSink *t_Sink = NULL ;
          t_Result = a_Registrar->GetSink ( 0 , NULL , & t_Sink ) ;
          if ( SUCCEEDED ( t_Result ) )
          {
            IWbemEventSink *t_EventSink = NULL ;
            t_Result = t_Sink->QueryInterface ( IID_IWbemEventSink , ( void **) & t_EventSink ) ;
            if ( SUCCEEDED ( t_Result ) )
            {
/*
 *  Pass information taken from WMI and package it so that worker thread can
 *  proceed.
 */
              struct ThreadArg_Struct *t_ThreadStruct = new ThreadArg_Struct ;
              if ( t_ThreadStruct )
              {
                t_ThreadStruct->m_Service = t_Service ;
                t_ThreadStruct->m_Sink = t_Sink ;
                t_ThreadStruct->m_EventSink = t_EventSink ;
                t_ThreadStruct->m_Registrar = a_Registrar ;

                t_ThreadStruct->m_Service->AddRef () ;
                t_ThreadStruct->m_Sink->AddRef () ;
                t_ThreadStruct->m_EventSink->AddRef () ;
                t_ThreadStruct->m_Registrar->AddRef () ;

/*
 *  Create worker thread.
 */
                DWORD t_ThreadId = 0 ;
                a_ThreadHandle = CreateThread (

                  NULL ,
                  0 ,
                  ( LPTHREAD_START_ROUTINE ) RestrictedThreadExecutionFunction ,
                  t_ThreadStruct ,
                  0 ,
                  & t_ThreadId
                ) ;

                if ( a_ThreadHandle == NULL )
                {
/*
 *  Everything failed to release resources.
 */

                  t_ThreadStruct->m_Service->Release () ;
                  t_ThreadStruct->m_Sink->Release () ;
                  t_ThreadStruct->m_EventSink->Release () ;
                  t_ThreadStruct->m_Registrar->Release () ;

                  delete t_ThreadStruct ;

                  t_Result = WBEM_E_FAILED ;
                }

                t_EventSink->Release () ;
              }
              else
              {
                t_Result = WBEM_E_OUT_OF_MEMORY ;
              }
            }

            t_Sink->Release () ;
          }

          t_Service->Release () ;
        }
      }
    }

    if ( FAILED ( t_Result ) )
    {
      if ( a_Registrar )
      {
        a_Registrar->Release () ;
        a_Registrar = NULL ;
      }
    }
  }
  else
  {
    t_Result = WBEM_E_OUT_OF_MEMORY ;
  }

  return t_Result ;
}

DWORD RestrictedThreadExecutionFunction ( void * a_Context )

Definition at line 450 of file Main.cpp.

{
  HRESULT t_Result = S_OK ;

/*
 *  Initialize com on thread.
 */

  t_Result = CoInitializeEx (

    0,
    COINIT_MULTITHREADED
  ) ;

  if ( SUCCEEDED ( t_Result ) )
  {
/*
 *  Cast thread context to expected type.
 */

    struct ThreadArg_Struct *t_ThreadStruct = ( struct ThreadArg_Struct * ) a_Context ;
    if ( t_ThreadStruct )
    {
      IWbemClassObject *t_Object = NULL ;
      BSTR t_String = SysAllocString ( L"SampleEvent" ) ;
      if ( t_String )
      {
/*
 *  Obtain a sink that will tell us when a user has asked for an event based on the specific
 *  query.
 */

        wchar_t *t_Query = L"Select * from SampleEvent" ;

        IWbemEventSink *t_RestrictedSink = NULL ;

        t_Result = t_ThreadStruct->m_EventSink->GetRestrictedSink (

          1 ,
          & t_Query ,
          NULL ,
          & t_RestrictedSink
        ) ;

        if ( SUCCEEDED ( t_Result ) )
        {
/*
 *  Set event batching parameters to boost performance.
 */
          t_Result = t_RestrictedSink->SetBatchingParameters (

            WBEM_FLAG_MUST_BATCH ,
            10000000 ,
            1000
          );

/*
 *  Get the event class from WMI.
 */

          t_Result = t_ThreadStruct->m_Service->GetObject (

            t_String ,
            0 ,
            NULL ,
            & t_Object ,
            NULL
          ) ;

          if ( SUCCEEDED ( t_Result ) )
          {
/*
 *  Sit in a loop until termination event has been signalled.
 */

            BOOL t_Continue = TRUE ;
            while ( t_Continue )
            {

              DWORD t_Status = WaitForSingleObject ( g_ThreadTerminate , 10000 ) ;
              switch ( t_Status )
              {
                case WAIT_TIMEOUT:
                {
/*
 *  See if anyone is listening for event
 */
                  if ( t_RestrictedSink->IsActive () == S_OK )
                  {
/*
 *  Create an event instance.
 */
                    IWbemClassObject *t_Instance = NULL ;
                    t_Result = t_Object->SpawnInstance ( 0 , & t_Instance ) ;
                    if ( SUCCEEDED ( t_Result ) )
                    {
                      VARIANT t_Variant ;
                      VariantInit ( & t_Variant ) ;

                      t_Variant.vt = VT_BSTR ;
                      t_Variant.bstrVal = SysAllocString ( L"Steve" ) ;

                      if (t_Variant.bstrVal)
                      {
                        t_Result = t_Instance->Put (

                                  L"Name" ,
                                  0 ,
                                  & t_Variant ,
                                  CIM_EMPTY
                                ) ;
                        /*
                        * Send the event on its way.
                        */
                        t_RestrictedSink->Indicate ( 1 , & t_Instance ) ;

                      }
                      else
                      {
                        t_Result = WBEM_E_OUT_OF_MEMORY;
                      }

                      t_Instance->Release () ;
                    }
                  }
                }
                break ;

                case WAIT_OBJECT_0:
                {
/*
 *  Event is signalled so break out of loop.
 */
                  t_Continue = FALSE ;
                }
                break ;

                default:
                {
/*
 *  Unknown condition, just break out of loop.
 */

                  t_Continue = FALSE ;
                }
                break ;
              }
            }

            t_Object->Release () ;
          }

          t_RestrictedSink->Release () ;
        }

        SysFreeString ( t_String ) ;
      }
      else
      {
        t_Result = WBEM_E_OUT_OF_MEMORY ;
      }

      t_ThreadStruct->m_Service->Release () ;
      t_ThreadStruct->m_Sink->Release () ;
      t_ThreadStruct->m_Registrar->Release () ;

      delete t_ThreadStruct ;
    }
    else
    {
      t_Result = WBEM_E_INVALID_PARAMETER ;
    }

    CoUninitialize () ;
  }

  return t_Result ;
}

DWORD ThreadExecutionFunction ( void * a_Context )

Definition at line 292 of file Main.cpp.

{
  HRESULT t_Result = S_OK ;

/*
 *  Initialize com on thread.
 */

  t_Result = CoInitializeEx (

    0,
    COINIT_MULTITHREADED
  ) ;

  if ( SUCCEEDED ( t_Result ) )
  {

/*
 *  Cast thread context to expected type.
 */

    struct ThreadArg_Struct *t_ThreadStruct = ( struct ThreadArg_Struct * ) a_Context ;
    if ( t_ThreadStruct )
    {
      IWbemClassObject *t_Object = NULL ;
      BSTR t_String = SysAllocString ( L"SampleEvent" ) ;
      if ( t_String )
      {
/*
 *  Get the event class from WMI.
 */

        t_Result = t_ThreadStruct->m_Service->GetObject (

          t_String ,
          0 ,
          NULL ,
          & t_Object ,
          NULL
        ) ;

        if ( SUCCEEDED ( t_Result ) )
        {
/*
 *  Create an event instance.
 */

          IWbemClassObject *t_Instance = NULL ;
          t_Result = t_Object->SpawnInstance ( 0 , & t_Instance ) ;
          if ( SUCCEEDED ( t_Result ) )
          {
            VARIANT t_Variant ;
            VariantInit ( & t_Variant ) ;

            t_Variant.vt = VT_BSTR ;
            t_Variant.bstrVal = SysAllocString ( L"Steve" ) ;
            if (t_Variant.bstrVal)
            {
              t_Result = t_Instance->Put (

                  L"Name" ,
                  0 ,
                  & t_Variant ,
                  CIM_EMPTY
                ) ;
            }
            else
            {
              t_Result = WBEM_E_OUT_OF_MEMORY;
            }

            if ( SUCCEEDED ( t_Result ) )
            {
              VariantClear ( & t_Variant ) ;

/*
 *  Sit in a loop until termination event has been signalled.
 */

              BOOL t_Continue = TRUE ;
              while ( t_Continue )
              {
                DWORD t_Status = WaitForSingleObject ( g_ThreadTerminate , 1000 ) ;
                switch ( t_Status )
                {
                  case WAIT_TIMEOUT:
                  {
/*
 *  Send the event on its way.
 */
                    t_ThreadStruct->m_Sink->Indicate ( 1 , & t_Instance ) ;
                  }
                  break ;

                  case WAIT_OBJECT_0:
                  {
/*
 *  Event is signalled so break out of loop.
 */
                    t_Continue = FALSE ;
                  }
                  break ;

                  default:
                  {
/*
 *  Unknown condition, just break out of loop.
 */
                    t_Continue = FALSE ;
                  }
                  break ;
                }
              }
            }

            t_Instance->Release () ;
          }

          t_Object->Release () ;
        }

        SysFreeString ( t_String ) ;
      }
      else
      {
        t_Result = WBEM_E_OUT_OF_MEMORY ;
      }

      t_ThreadStruct->m_Service->Release () ;
      t_ThreadStruct->m_Sink->Release () ;
      t_ThreadStruct->m_Registrar->Release () ;

      delete t_ThreadStruct ;
    }
    else
    {
      t_Result = WBEM_E_INVALID_PARAMETER ;
    }

    CoUninitialize () ;
  }

  return t_Result ;
}

HRESULT UninitComServer ( )

Definition at line 192 of file Main.cpp.

{
  CoUninitialize () ;

  return S_OK ;
}

void WindowsDispatch ( )

Definition at line 169 of file Main.cpp.

{
  BOOL t_GetMessage ;
  MSG t_lpMsg ;

  while ( ( t_GetMessage = GetMessage ( & t_lpMsg , NULL , 0 , 0 ) ) == TRUE )
  {
    TranslateMessage ( & t_lpMsg ) ;
    DispatchMessage ( & t_lpMsg ) ;
  }
}

HWND WindowsInit ( HINSTANCE a_HInstance )

Definition at line 81 of file Main.cpp.

{
  static wchar_t *t_TemplateCode = L"TemplateCode" ;

  WNDCLASS  t_wc ;

  t_wc.style            = CS_HREDRAW | CS_VREDRAW ;
  t_wc.lpfnWndProc      = WindowsMainProc ;
  t_wc.cbClsExtra       = 0 ;
  t_wc.cbWndExtra       = 0 ;
  t_wc.hInstance        = a_HInstance ;
  t_wc.hIcon            = LoadIcon(NULL, IDI_HAND) ;
  t_wc.hCursor          = LoadCursor(NULL, IDC_ARROW) ;
  t_wc.hbrBackground    = (HBRUSH) (COLOR_WINDOW + 1) ;
  t_wc.lpszMenuName     = NULL ;
  t_wc.lpszClassName    = t_TemplateCode ;

  ATOM t_winClass = RegisterClass ( &t_wc ) ;

  HWND t_HWnd = CreateWindow (

    t_TemplateCode ,              // see RegisterClass() call
    t_TemplateCode ,                      // text for window title bar
    WS_OVERLAPPEDWINDOW | WS_MINIMIZE ,               // window style
    CW_USEDEFAULT ,                     // default horizontal position
    CW_USEDEFAULT ,                     // default vertical position
    CW_USEDEFAULT ,                     // default width
    CW_USEDEFAULT ,                     // default height
    NULL ,                              // overlapped windows have no parent
    NULL ,                              // use the window class menu
    a_HInstance ,
    NULL                                // pointer not needed
  ) ;

  ShowWindow ( t_HWnd, SW_SHOW ) ;
  //ShowWindow ( t_HWnd, SW_HIDE ) ;

  return t_HWnd ;
}

LRESULT CALLBACK WindowsMainProc | ( | HWND | a_hWnd,
 |  | UINT | a_message,
 |  | WPARAM | a_wParam,
 |  | LPARAM | a_lParam
 | ) |  |

Definition at line 48 of file Main.cpp.

{
  LRESULT t_rc = 0 ;

  switch ( a_message )
  {
    case WM_DESTROY:
    {
      PostMessage ( a_hWnd , WM_QUIT , 0 , 0 ) ;
    }
    break ;

    default:
    {
      t_rc = DefWindowProc ( a_hWnd , a_message , a_wParam , a_lParam ) ;
    }
    break ;
  }

  return ( t_rc ) ;
}

HWND WindowsStart ( HINSTANCE a_Handle )

Definition at line 148 of file Main.cpp.

{
  HWND t_HWnd = NULL ;
  if ( ! ( t_HWnd = WindowsInit ( a_Handle ) ) )
  {
    }

  return t_HWnd ;
}

void WindowsStop ( HWND a_HWnd )

Definition at line 132 of file Main.cpp.

{
  DestroyWindow ( a_HWnd ) ;
}

int WINAPI WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nShowCmd
 | ) |  |

Definition at line 1098 of file Main.cpp.

{
  HRESULT t_Result = Provider_Globals :: Global_Startup () ;
  if ( SUCCEEDED ( t_Result ) )
  {
    HWND t_Window = WindowsStart ( hInstance ) ;
    if ( t_Window )
    {
      t_Result = Process () ;

      WindowsStop ( t_Window ) ;
    }

    t_Result = Provider_Globals :: Global_Shutdown () ;
  }

  return 0 ;
}

Variable Documentation

HANDLE g_ThreadTerminate = NULL

Definition at line 35 of file Main.cpp.

Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/decoupled/Event_Provider/PreComp.h File Reference

  • SysMgmt
  • WMI
  • VC
  • decoupled
  • Event_Provider
Defines

PreComp.h File Reference

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <tchar.h>

Go to the source code of this file.

Defines

#define _WIN32_WINNT 0x0400

Define Documentation

#define _WIN32_WINNT 0x0400

Definition at line 16 of file PreComp.h.

Generated on Wed Nov 13 2024 16:53:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/decoupled/Event_Provider/Include/Events.h File Reference

  • SysMgmt
  • WMI
  • VC
  • decoupled
  • Event_Provider
  • Include
Classes

Events.h File Reference

Go to the source code of this file.

Classes

class CProvider_IWbemEventProvider
Generated on Wed Nov 13 2024 16:54:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/decoupled/Event_Provider/Include/Globals.h File Reference

  • SysMgmt
  • WMI
  • VC
  • decoupled
  • Event_Provider
  • Include
Classes

Globals.h File Reference

Go to the source code of this file.

Classes

class Provider_Globals
Generated on Wed Nov 13 2024 16:54:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/decoupled/Event_Provider/Include/Resource.h File Reference

  • SysMgmt
  • WMI
  • VC
  • decoupled
  • Event_Provider
  • Include

Resource.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/decoupled/Instance_Provider/Globals.cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • decoupled
  • Instance_Provider

Globals.cpp File Reference

#include <PreComp.h>
#include <wbemprov.h>
#include <initguid.h>
#include "Globals.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/decoupled/Instance_Provider/Main.cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • decoupled
  • Instance_Provider
Defines | Functions

Main.cpp File Reference

#include <precomp.h>
#include <objbase.h>
#include <stdio.h>
#include <tchar.h>
#include <wbemcli.h>
#include <wbemprov.h>
#include "Globals.h"
#include "Service.h"

Go to the source code of this file.

Defines

#define | EOAC_DYNAMIC_CLOAKING 0x40

Functions

HRESULT | InitComServer (DWORD a_AuthenticationLevel, DWORD a_ImpersonationLevel)
HRESULT | Process ()
HRESULT | Process_DecoupledInstance ()
HRESULT | RegisterDecoupledInstance (IWbemDecoupledRegistrar *&a_Registrar)
HRESULT | UninitComServer ()
void | WindowsDispatch ()
HWND | WindowsInit (HINSTANCE a_HInstance)
LRESULT CALLBACK | WindowsMainProc (HWND a_hWnd, UINT a_message, WPARAM a_wParam, LPARAM a_lParam)
HWND | WindowsStart (HINSTANCE a_Handle)
void | WindowsStop (HWND a_HWnd)
int WINAPI | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)

Define Documentation

#define EOAC_DYNAMIC_CLOAKING 0x40

Function Documentation

HRESULT InitComServer | ( | DWORD | a_AuthenticationLevel,
 |  | DWORD | a_ImpersonationLevel
 | ) |  |

Definition at line 198 of file Main.cpp.

{
  HRESULT t_Result = S_OK ;

    t_Result = CoInitializeEx (

    0,
    COINIT_MULTITHREADED
  );

#ifndef EOAC_DYNAMIC_CLOAKING
#define EOAC_DYNAMIC_CLOAKING 0x40
#endif

  if ( SUCCEEDED ( t_Result ) )
  {
    t_Result = CoInitializeSecurity (

      NULL,
      -1,
      NULL,
      NULL,
      a_AuthenticationLevel,
      a_ImpersonationLevel,
      NULL,
      EOAC_DYNAMIC_CLOAKING,
      0
    );

    if ( FAILED ( t_Result ) )
    {
      CoUninitialize () ;
      return t_Result ;
    }
  }

  if ( FAILED ( t_Result ) )
  {
    CoUninitialize () ;
  }

  return t_Result  ;
}

HRESULT Process ( )

Definition at line 371 of file Main.cpp.

{
  DWORD t_ImpersonationLevel = RPC_C_IMP_LEVEL_IDENTIFY ;
  DWORD t_AuthenticationLevel = RPC_C_AUTHN_LEVEL_CONNECT ;

  HRESULT t_Result = InitComServer ( t_AuthenticationLevel , t_ImpersonationLevel ) ;
  if ( SUCCEEDED ( t_Result ) )
  {
    try
    {
      t_Result = Process_DecoupledInstance () ;
    }
    catch ( ... )
    {
    }

    UninitComServer () ;
  }

  return t_Result ;
}

HRESULT Process_DecoupledInstance ( )

Definition at line 340 of file Main.cpp.

{
  IWbemDecoupledRegistrar *t_InstanceRegistrar = NULL ;

  HRESULT t_Result = RegisterDecoupledInstance ( t_InstanceRegistrar ) ;
  if ( SUCCEEDED ( t_Result ) )
  {
    WindowsDispatch () ;
  }

  if ( t_InstanceRegistrar )
  {
    t_InstanceRegistrar->UnRegister () ;
    t_InstanceRegistrar->Release () ;
  }

  return t_Result ;
}

HRESULT RegisterDecoupledInstance ( IWbemDecoupledRegistrar *& a_Registrar )

Definition at line 255 of file Main.cpp.

{
/*
 *  Cleanup out arguments
 */

  a_Registrar = NULL ;

/*
 *  Create the registrar for the instance provider, so that we can register with WMI.
 */

  HRESULT t_Result = Provider_Globals :: CreateInstance (

    CLSID_WbemDecoupledRegistrar ,
    NULL ,
    CLSCTX_INPROC_SERVER ,
    IID_IWbemDecoupledRegistrar ,
    ( void ** ) & a_Registrar
  ) ;

  if ( SUCCEEDED ( t_Result ) )
  {
/*
 *  Create our implementation instance of the instance provider
 */

    CProvider_IWbemServices *t_Service = new CProvider_IWbemServices () ;
    if ( t_Service )
    {
      t_Service->AddRef () ;

      IUnknown *t_Unknown = NULL ;
      t_Result = t_Service->QueryInterface ( IID_IUnknown , ( void ** ) & t_Unknown ) ;
      if ( SUCCEEDED ( t_Result ) )
      {
/*
 *  Register the provider inteface with WMI, specifying the namespace and provider instance of __Win32provider
 */

        t_Result = a_Registrar->Register (

          0 ,
          NULL ,
          NULL ,
          NULL ,
          L"root\\cimv2" ,
          L"DecoupledInstanceProvider" ,
          t_Unknown
        ) ;

        t_Unknown->Release () ;
      }

      t_Service->Release () ;
    }
  }

  if ( FAILED ( t_Result ) )
  {
    if ( a_Registrar )
    {
      a_Registrar->Release () ;
      a_Registrar = NULL ;
    }
  }

  return t_Result ;
}

HRESULT UninitComServer ( )

Definition at line 180 of file Main.cpp.

{
  CoUninitialize () ;

  return S_OK ;
}

void WindowsDispatch ( )

Definition at line 157 of file Main.cpp.

{
  BOOL t_GetMessage ;
  MSG t_lpMsg ;

  while ( ( t_GetMessage = GetMessage ( & t_lpMsg , NULL , 0 , 0 ) ) == TRUE )
  {
    TranslateMessage ( & t_lpMsg ) ;
    DispatchMessage ( & t_lpMsg ) ;
  }
}

HWND WindowsInit ( HINSTANCE a_HInstance )

Definition at line 69 of file Main.cpp.

{
  static wchar_t *t_TemplateCode = L"TemplateCode" ;

  WNDCLASS  t_wc ;

  t_wc.style            = CS_HREDRAW | CS_VREDRAW ;
  t_wc.lpfnWndProc      = WindowsMainProc ;
  t_wc.cbClsExtra       = 0 ;
  t_wc.cbWndExtra       = 0 ;
  t_wc.hInstance        = a_HInstance ;
  t_wc.hIcon            = LoadIcon(NULL, IDI_HAND) ;
  t_wc.hCursor          = LoadCursor(NULL, IDC_ARROW) ;
  t_wc.hbrBackground    = (HBRUSH) (COLOR_WINDOW + 1) ;
  t_wc.lpszMenuName     = NULL ;
  t_wc.lpszClassName    = t_TemplateCode ;

  ATOM t_winClass = RegisterClass ( &t_wc ) ;

  HWND t_HWnd = CreateWindow (

    t_TemplateCode ,              // see RegisterClass() call
    t_TemplateCode ,                      // text for window title bar
    WS_OVERLAPPEDWINDOW | WS_MINIMIZE ,               // window style
    CW_USEDEFAULT ,                     // default horizontal position
    CW_USEDEFAULT ,                     // default vertical position
    CW_USEDEFAULT ,                     // default width
    CW_USEDEFAULT ,                     // default height
    NULL ,                              // overlapped windows have no parent
    NULL ,                              // use the window class menu
    a_HInstance ,
    NULL                                // pointer not needed
  ) ;

  ShowWindow ( t_HWnd, SW_SHOW ) ;
  //ShowWindow ( t_HWnd, SW_HIDE ) ;

  return t_HWnd ;
}

LRESULT CALLBACK WindowsMainProc | ( | HWND | a_hWnd,
 |  | UINT | a_message,
 |  | WPARAM | a_wParam,
 |  | LPARAM | a_lParam
 | ) |  |

Definition at line 36 of file Main.cpp.

{
  LRESULT t_rc = 0 ;

  switch ( a_message )
  {
    case WM_DESTROY:
    {
      PostMessage ( a_hWnd , WM_QUIT , 0 , 0 ) ;
    }
    break ;

    default:
    {
      t_rc = DefWindowProc ( a_hWnd , a_message , a_wParam , a_lParam ) ;
    }
    break ;
  }

  return ( t_rc ) ;
}

HWND WindowsStart ( HINSTANCE a_Handle )

Definition at line 136 of file Main.cpp.

{
  HWND t_HWnd = NULL ;
  if ( ! ( t_HWnd = WindowsInit ( a_Handle ) ) )
  {
    }

  return t_HWnd ;
}

void WindowsStop ( HWND a_HWnd )

Definition at line 120 of file Main.cpp.

{
  DestroyWindow ( a_HWnd ) ;
}

int WINAPI WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nShowCmd
 | ) |  |

Definition at line 405 of file Main.cpp.

{
  HRESULT t_Result = Provider_Globals :: Global_Startup () ;
  if ( SUCCEEDED ( t_Result ) )
  {
    HWND t_Window = WindowsStart ( hInstance ) ;
    if ( t_Window )
    {
      t_Result = Process () ;

      WindowsStop ( t_Window ) ;
    }

    t_Result = Provider_Globals :: Global_Shutdown () ;
  }

  return 0 ;
}

Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/decoupled/Instance_Provider/PreComp.h File Reference

  • SysMgmt
  • WMI
  • VC
  • decoupled
  • Instance_Provider
Defines

PreComp.h File Reference

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <tchar.h>

Go to the source code of this file.

Defines

#define _WIN32_WINNT 0x0500

Define Documentation

#define _WIN32_WINNT 0x0500

Definition at line 16 of file PreComp.h.

Generated on Wed Nov 13 2024 16:53:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/decoupled/Instance_Provider/Service.cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • decoupled
  • Instance_Provider
Defines | Functions | Variables

Service.cpp File Reference

#include <precomp.h>
#include <objbase.h>
#include <sddl.h>
#include <strsafe.h>
#include "Globals.h"
#include "Service.h"

Go to the source code of this file.

Defines

#define | MASK_CLIENT_ACCESS_BIND 1

Functions

HRESULT | CheckAccess (SECURITY_DESCRIPTOR *a_SecurityDescriptor, DWORD a_Access, GENERIC_MAPPING *a_Mapping)
DWORD GetCurrentImpersonationLevel ()
HRESULT | Set_String (IWbemClassObject *a_Instance, wchar_t *a_Name, wchar_t *a_String)
HRESULT | Set_Uint32 (IWbemClassObject *a_Instance, wchar_t *a_Name, const DWORD &a_Uint32)
HRESULT | Set_Uint64 (IWbemClassObject *a_Instance, wchar_t *a_Name, const UINT64 &a_Uint64)
HRESULT | SetProperty (IWbemClassObject *a_Instance, Object_Property &a_Property)
STDMETHODIMP_ (ULONG) CProvider_IWbemServices

Variables

Object_Property g_Contact_Properties []
Object_Property g_Process_Properties []

Define Documentation

#define MASK_CLIENT_ACCESS_BIND 1

Definition at line 25 of file Service.cpp.

Function Documentation

HRESULT CheckAccess | ( | SECURITY_DESCRIPTOR * | a_SecurityDescriptor,
 |  | DWORD | a_Access,
 |  | GENERIC_MAPPING * | a_Mapping
 | ) |  |

Definition at line 347 of file Service.cpp.

{
  HRESULT t_Result = S_OK ;

  HANDLE t_Token = NULL ;

  BOOL t_Status = OpenThreadToken (

    GetCurrentThread () ,
    TOKEN_QUERY ,
    TRUE ,
    & t_Token
  ) ;

  DWORD t_LastError = GetLastError () ;
  if ( ! t_Status)
  {
    //the thread token should always be available

    switch ( t_LastError )
    {
      case E_ACCESSDENIED:
      {
        return  WBEM_E_ACCESS_DENIED ;
      }
      break ;

      default:
      {
        return WBEM_E_FAILED ;
      }
      break ;
    }
  }

  DWORD t_Access = 0 ;
  BOOL t_AccessStatus = FALSE ;
  PRIVILEGE_SET *t_PrivilegeSet = NULL ;
  DWORD t_PrivilegeSetSize = 0 ;

  MapGenericMask (

    & a_Access ,
    a_Mapping
  ) ;

  t_Status = AccessCheck (

    a_SecurityDescriptor ,
    t_Token,
    a_Access ,
    a_Mapping ,
    NULL ,
    & t_PrivilegeSetSize ,
    & t_Access ,
    & t_AccessStatus
  ) ;

  if (!t_Status || !t_AccessStatus )
  {
    DWORD t_LastError = GetLastError () ;
    if ( t_LastError == ERROR_INSUFFICIENT_BUFFER )
    {
      t_PrivilegeSet = ( PRIVILEGE_SET * ) new BYTE [ t_PrivilegeSetSize ] ;
      if ( t_PrivilegeSet )
      {
        t_Status = AccessCheck (
          a_SecurityDescriptor ,
          t_Token,
          a_Access ,
          a_Mapping ,
          t_PrivilegeSet ,
          & t_PrivilegeSetSize ,
          & t_Access ,
          & t_AccessStatus
        ) ;

        if ( !t_Status || !t_AccessStatus )
        {
          t_Result = WBEM_E_ACCESS_DENIED ;
        }

        delete [] ( BYTE * ) t_PrivilegeSet ;
      }
      else
      {
        t_Result = WBEM_E_OUT_OF_MEMORY ;
      }
    }
    else
    {
      t_Result = WBEM_E_ACCESS_DENIED;
    }

  }

  CloseHandle ( t_Token ) ;

  return t_Result ;
}

DWORD GetCurrentImpersonationLevel ( )

Definition at line 465 of file Service.cpp.

{
  DWORD t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;

    HANDLE t_ThreadToken = NULL ;

    BOOL t_Status = OpenThreadToken (

    GetCurrentThread() ,
    TOKEN_QUERY,
    TRUE,
    &t_ThreadToken
  ) ;

    if ( t_Status )
    {
    SECURITY_IMPERSONATION_LEVEL t_Level = SecurityAnonymous ;
    DWORD t_Returned = 0 ;

    t_Status = GetTokenInformation (

      t_ThreadToken ,
      TokenImpersonationLevel ,
      & t_Level ,
      sizeof ( SECURITY_IMPERSONATION_LEVEL ) ,
      & t_Returned
    ) ;

    CloseHandle ( t_ThreadToken ) ;

    if ( t_Status == FALSE )
    {
      t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;
    }
    else
    {
      switch ( t_Level )
      {
        case SecurityAnonymous:
        {
          t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;
        }
        break ;

        case SecurityIdentification:
        {
          t_ImpersonationLevel = RPC_C_IMP_LEVEL_IDENTIFY ;
        }
        break ;

        case SecurityImpersonation:
        {
          t_ImpersonationLevel = RPC_C_IMP_LEVEL_IMPERSONATE ;
        }
        break ;

        case SecurityDelegation:
        {
          t_ImpersonationLevel = RPC_C_IMP_LEVEL_DELEGATE ;
        }
        break ;

        default:
        {
          t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;
        }
        break ;
      }
    }
  }
  else
  {
        ULONG t_LastError = GetLastError () ;

        if ( t_LastError == ERROR_NO_IMPERSONATION_TOKEN || t_LastError == ERROR_NO_TOKEN )
        {
            t_ImpersonationLevel = RPC_C_IMP_LEVEL_DELEGATE ;
        }
        else
    {
      if ( t_LastError == ERROR_CANT_OPEN_ANONYMOUS )
      {
        t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;
      }
      else
      {
        t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;
      }
    }
    }

  return t_ImpersonationLevel ;
}

HRESULT Set_String | ( | IWbemClassObject * | a_Instance,
 |  | wchar_t * | a_Name,
 |  | wchar_t * | a_String
 | ) |  |

Definition at line 236 of file Service.cpp.

{
  VARIANT t_Variant ;
  VariantInit ( & t_Variant ) ;
  t_Variant.vt = VT_BSTR ;
  t_Variant.bstrVal = SysAllocString ( a_String ) ;
  if ( t_Variant.bstrVal )
  {
    HRESULT t_Result = a_Instance->Put ( a_Name , 0 , & t_Variant , 0 ) ;

    VariantClear ( & t_Variant ) ;

    return t_Result ;
  }
  else
  {
    return WBEM_E_OUT_OF_MEMORY ;
  }
}

HRESULT Set_Uint32 | ( | IWbemClassObject * | a_Instance,
 |  | wchar_t * | a_Name,
 |  | const DWORD & | a_Uint32
 | ) |  |

Definition at line 210 of file Service.cpp.

{
  VARIANT t_Variant ;
  VariantInit ( & t_Variant ) ;
  t_Variant.vt = VT_I4 ;
  t_Variant.lVal = a_Uint32 ;

  return a_Instance->Put ( a_Name , 0 , & t_Variant , 0 ) ;
}

HRESULT Set_Uint64 | ( | IWbemClassObject * | a_Instance,
 |  | wchar_t * | a_Name,
 |  | const UINT64 & | a_Uint64
 | ) |  |

Definition at line 171 of file Service.cpp.

{
  wchar_t t_String [ 64 ] ;
  StringCbPrintf(t_String, sizeof(t_String), L"%I64u" , a_Uint64 ) ;

  VARIANT t_Variant ;
  VariantInit ( & t_Variant ) ;
  t_Variant.vt = VT_BSTR ;
  t_Variant.bstrVal = SysAllocString ( t_String ) ;
  if ( t_Variant.bstrVal )
  {
    HRESULT t_Result = a_Instance->Put ( a_Name , 0 , & t_Variant , 0 ) ;

    VariantClear ( & t_Variant ) ;

    return t_Result ;
  }
  else
  {
    return WBEM_E_OUT_OF_MEMORY ;
  }
}

HRESULT SetProperty | ( | IWbemClassObject * | a_Instance,
 |  | Object_Property & | a_Property
 | ) |  |

Definition at line 273 of file Service.cpp.

{
  HRESULT t_Result = S_OK ;

  switch ( a_Property.m_Type )
  {
    case CIM_STRING:
    {
      t_Result = Set_String (

        a_Instance ,
        a_Property.m_Name ,
        a_Property.m_Value
      ) ;
    }
    break ;

    case CIM_UINT32:
    {
      ULONG t_Integer ;
      swscanf ( a_Property.m_Value ,  L"%lu" , & t_Integer ) ;

      t_Result = Set_Uint32 (

        a_Instance ,
        a_Property.m_Name ,
        t_Integer
      ) ;
    }
    break ;

    case CIM_UINT64:
    {
      UINT64 t_Integer ;
      swscanf ( a_Property.m_Value , L"%I64u" , & t_Integer ) ;

      t_Result = Set_Uint64 (

        a_Instance ,
        a_Property.m_Name ,
        t_Integer
      ) ;
    }
    break ;

    default:
    {
      WBEM_E_INVALID_PARAMETER ;
    }
    break ;
  }

  return t_Result ;
}

STDMETHODIMP_ ( ULONG )

Definition at line 675 of file Service.cpp.

{
  LONG t_Reference ;
  if ( ( t_Reference = InterlockedDecrement ( & m_ReferenceCount ) ) == 0 )
  {
/*
 *  No more outstanding references, delete the object.
 */
    delete this ;
  }

  return t_Reference ;
}

Variable Documentation

Object_Property g_Contact_Properties[]
Initial value:
 {

    0 , 21 , L"ID" , L"0000000000001" ,
    0 , 8 , L"LastName" ,  L"Mandelshtam" ,
    0 , 8 , L"FirstName" , L"Osip" ,
    0 , 8 , L"HomePhone" , L"2069424877" ,
    0 , 8 , L"WorkPhone" , L"4258649459" ,
    1 , 0 , L"NA" , L"NA" ,
    0 , 21 , L"ID" , L"0000000000002" ,
    0 , 8 , L"LastName" ,  L"Pasternak" ,
    0 , 8 , L"FirstName" , L"Boris" ,
    0 , 8 , L"HomePhone" , L"4259434877" ,
    0 , 8 , L"WorkPhone" , L"4258964949" ,
    1 , 0 , L"NA" , L"NA" ,
    0 , 21 , L"ID" , L"0000000000003" ,
    0 , 8 , L"LastName" ,  L"Akhmatova" ,
    0 , 8 , L"FirstName" , L"Anna" ,
    0 , 8 , L"HomePhone" , L"7186724877" ,
    0 , 8 , L"WorkPhone" , L"2128640059" ,
    1 , 0 , L"NA" , L"NA" ,
    2 , 0 , L"NA" , L"NA"

}

Definition at line 44 of file Service.cpp.

Object_Property g_Process_Properties[]

Definition at line 79 of file Service.cpp.

Generated on Wed Nov 13 2024 16:54:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/decoupled/Instance_Provider/Include/Globals.h File Reference

  • SysMgmt
  • WMI
  • VC
  • decoupled
  • Instance_Provider
  • Include
Classes

Globals.h File Reference

Go to the source code of this file.

Classes

class Provider_Globals
Generated on Wed Nov 13 2024 16:54:10 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/decoupled/Instance_Provider/Include/Resource.h File Reference

  • SysMgmt
  • WMI
  • VC
  • decoupled
  • Instance_Provider
  • Include

Resource.h File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/decoupled/Instance_Provider/Include/Service.h File Reference

  • SysMgmt
  • WMI
  • VC
  • decoupled
  • Instance_Provider
  • Include
Classes

Service.h File Reference

#include <wbemcli.h>
#include <wbemprov.h>

Go to the source code of this file.

Classes

class | CProvider_IWbemServices
struct | Object_Property
Generated on Wed Nov 13 2024 16:54:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/EventConsumer/Consumer.Cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • EventConsumer
Defines | Functions

Consumer.Cpp File Reference

#include "stdafx.h"
#include "Consumer.h"
#include <objbase.h>
#include <strsafe.h>

Go to the source code of this file.

Defines

#define | BLOCKSIZE (32 * sizeof(WCHAR))
#define | CVTBUFSIZE (309+40)

Functions

STDMETHODIMP_ (ULONG) CConsumer

Define Documentation

#define BLOCKSIZE (32 * sizeof(WCHAR))

Definition at line 379 of file Consumer.Cpp.

#define CVTBUFSIZE (309+40)

Definition at line 380 of file Consumer.Cpp.

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 50 of file Consumer.Cpp.

{
    if (--m_cRef != 0L)
        return m_cRef;

    delete this;
    return 0L;
}

Generated on Wed Nov 13 2024 16:54:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/EventConsumer/Consumer.h File Reference

  • SysMgmt
  • WMI
  • VC
  • EventConsumer
Classes

Consumer.h File Reference

#include <wbemcli.h>
#include <wbemprov.h>

Go to the source code of this file.

Classes

class CConsumer
Generated on Wed Nov 13 2024 16:54:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/EventConsumer/Factory.Cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • EventConsumer
Functions

Factory.Cpp File Reference

#include "stdafx.h"
#include "factory.h"
#include "Provider.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CProviderFactory

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 57 of file Factory.Cpp.

{
    int lNewRef = InterlockedDecrement(&m_cRef);
    if(lNewRef == 0)
    {
        delete this;
    }

    return lNewRef;
}

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/EventConsumer/Factory.h File Reference

  • SysMgmt
  • WMI
  • VC
  • EventConsumer
Classes

Factory.h File Reference

#include <wbemcli.h>

Go to the source code of this file.

Classes

class CProviderFactory
Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/EventConsumer/PermEvents.Cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • EventConsumer
Defines | Variables

PermEvents.Cpp File Reference

#include "stdafx.h"
#include "PermEvents.h"
#include "PermEventsDlg.h"
#include <objbase.h>
#include <strsafe.h>

Go to the source code of this file.

Defines

#define TCHAR_LEN_IN_BYTES(str) (unsigned long)(_tcslen(str)*sizeof(TCHAR)+sizeof(TCHAR))

Variables

CPermEventsApp theApp

Define Documentation

#define TCHAR_LEN_IN_BYTES ( str ) (unsigned long)(_tcslen(str)*sizeof(TCHAR)+sizeof(TCHAR))

Definition at line 181 of file PermEvents.Cpp.

Variable Documentation

CPermEventsApp theApp

Definition at line 51 of file PermEvents.Cpp.

Generated on Wed Nov 13 2024 16:54:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/EventConsumer/PermEvents.h File Reference

  • SysMgmt
  • WMI
  • VC
  • EventConsumer
Classes

PermEvents.h File Reference

#include "resource.h"
#include "factory.h"
#include "resource.h"

Go to the source code of this file.

Classes

class CPermEventsApp
Generated on Wed Nov 13 2024 16:54:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/EventConsumer/PermEventsdlg.Cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • EventConsumer
Classes

PermEventsdlg.Cpp File Reference

#include "stdafx.h"
#include "PermEvents.h"
#include "PermEventsDlg.h"

Go to the source code of this file.

Classes

class CAboutDlg
Generated on Wed Nov 13 2024 16:54:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/EventConsumer/PermEventsdlg.h File Reference

  • SysMgmt
  • WMI
  • VC
  • EventConsumer
Classes

PermEventsdlg.h File Reference

Go to the source code of this file.

Classes

class CPermEventsDlg
Generated on Wed Nov 13 2024 16:54:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/EventConsumer/Provider.Cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • EventConsumer
Functions

Provider.Cpp File Reference

#include "stdafx.h"
#include "Provider.h"
#include "Consumer.h"
#include <objbase.h>

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CProvider

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 50 of file Provider.Cpp.

{
    if (--m_cRef != 0L)
        return m_cRef;

    delete this;
    return 0L;
}

Generated on Wed Nov 13 2024 16:54:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/EventConsumer/Provider.h File Reference

  • SysMgmt
  • WMI
  • VC
  • EventConsumer
Classes

Provider.h File Reference

#include <wbemcli.h>
#include <wbemprov.h>

Go to the source code of this file.

Classes

class CProvider
Generated on Wed Nov 13 2024 16:54:24 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/EventConsumer/Resource.h File Reference

  • SysMgmt
  • WMI
  • VC
  • EventConsumer
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_OUTPUTLIST 1000
#define | IDD_ABOUTBOX 100
#define | IDD_PERMEVENTS_DIALOG 102
#define | IDD_WBEMPERMEVENTS_DIALOG 102
#define | IDM_ABOUTBOX 0x0010
#define | IDR_MAINFRAME 128
#define | IDS_ABOUTBOX 101

Define Documentation

#define IDC_OUTPUTLIST 1000

Definition at line 11 of file Resource.h.

#define IDD_ABOUTBOX 100

Definition at line 6 of file Resource.h.

#define IDD_PERMEVENTS_DIALOG 102

Definition at line 9 of file Resource.h.

#define IDD_WBEMPERMEVENTS_DIALOG 102

Definition at line 8 of file Resource.h.

#define IDM_ABOUTBOX 0x0010

Definition at line 5 of file Resource.h.

#define IDR_MAINFRAME 128

Definition at line 10 of file Resource.h.

#define IDS_ABOUTBOX 101

Definition at line 7 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/EventConsumer/StdAfx.Cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • EventConsumer

StdAfx.Cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/EventConsumer/StdAfx.h File Reference

  • SysMgmt
  • WMI
  • VC
  • EventConsumer
Defines

StdAfx.h File Reference

#include <afxwin.h>
#include <afxext.h>
#include <afxcmn.h>

Go to the source code of this file.

Defines

#define VC_EXTRALEAN

Define Documentation

#define VC_EXTRALEAN

Definition at line 14 of file StdAfx.h.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/EventProvider/EvProv.Cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • EventProvider
Defines

EvProv.Cpp File Reference

#include <windows.h>
#include <stdio.h>
#include <objbase.h>
#include <wbemidl.h>
#include "oahelp.inl"
#include "evprov.h"
#include <strsafe.h>
#include <sddl.h>

Go to the source code of this file.

Defines

#define | _WIN32_WINNT 0x0500
#define | MASK_CLIENT_ACCESS_BIND 1

Define Documentation

#define _WIN32_WINNT 0x0500

Definition at line 14 of file EvProv.Cpp.

#define MASK_CLIENT_ACCESS_BIND 1

Definition at line 32 of file EvProv.Cpp.

Generated on Wed Nov 13 2024 16:54:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/EventProvider/EvProv.h File Reference

  • SysMgmt
  • WMI
  • VC
  • EventProvider
Classes | Defines | Functions

EvProv.h File Reference

#include <NTSECAPI.H>

Go to the source code of this file.

Classes

class | CMyEventProvider

Defines

#define | EVENTCLASS L"MyEvent"

Functions

DEFINE_GUID (CLSID_MyEventProvider, 0x3cd5248e, 0x14f9, 0x11d1, 0xae, 0x9c, 0x0, 0xc0, 0x4f, 0xb6, 0x88, 0x20)

Define Documentation

#define EVENTCLASS L"MyEvent"

Definition at line 23 of file EvProv.h.

Function Documentation

DEFINE_GUID | ( | CLSID_MyEventProvider | ,
 |  | 0x3cd5248e | ,
 |  | 0x14f9 | ,
 |  | 0x11d1 | ,
 |  | 0xae | ,
 |  | 0x9c | ,
 |  | 0x0 | ,
 |  | 0xc0 | ,
 |  | 0x4f | ,
 |  | 0xb6 | ,
 |  | 0x88 | ,
 |  | 0x20 |
 | ) |  |
Generated on Wed Nov 13 2024 16:54:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/EventProvider/OaHelp.Inl File Reference

  • SysMgmt
  • WMI
  • VC
  • EventProvider
Classes

OaHelp.Inl File Reference

Go to the source code of this file.

Classes

class | CBSTR
class | CSAFEARRAY
class | CVARIANT
Generated on Wed Nov 13 2024 16:54:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/EventProvider/OleSrvr.Cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • EventProvider
Classes | Functions

OleSrvr.Cpp File Reference

#include <windows.h>
#include <stdio.h>
#include <time.h>
#include <locale.h>
#include <wbemidl.h>
#include <initguid.h>
#include "evprov.h"
#include <strsafe.h>

Go to the source code of this file.

Classes

class | CFactory

Functions

HRESULT APIENTRY | DllCanUnloadNow (void)
HRESULT APIENTRY | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpReserved)
HRESULT APIENTRY | DllRegisterServer (void)
HRESULT APIENTRY | DllUnregisterServer (void)
void | ObjectCreated (DWORD dwType)
void | ObjectDestroyed (DWORD dwType)

Function Documentation

HRESULT APIENTRY DllCanUnloadNow ( void )

Definition at line 154 of file OleSrvr.Cpp.

{
    SCODE sc = TRUE;

    if (g_cObj || g_cLock)
        sc = S_FALSE;

    return sc;
}

HRESULT APIENTRY DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 106 of file OleSrvr.Cpp.

{
    HRESULT         hr;

    CFactory *pFactory;

    //
    //  Verify the caller is asking for our type of object.
    //
    if (CLSID_MyEventProvider != rclsid)
            return E_FAIL;

    //
    // Check that we can provide the interface.
    //
    if (IID_IUnknown != riid && IID_IClassFactory != riid)
        return E_NOINTERFACE;

    //
    // Get a new class factory.
    //
    pFactory = new CFactory(rclsid);

    if (!pFactory)
        return E_OUTOFMEMORY;

    //
    // Verify we can get an instance.
    //
    hr = pFactory->QueryInterface(riid, ppv);

    if (FAILED(hr))
        delete pFactory;

    return hr;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hinstDLL,
 |  | DWORD | dwReason,
 |  | LPVOID | lpReserved
 | ) |  |

Definition at line 36 of file OleSrvr.Cpp.

{
    if (dwReason == DLL_PROCESS_ATTACH)
    {
        g_hInstance = hinstDLL;
        setlocale(LC_ALL, "");
    }
    else if (dwReason == DLL_PROCESS_DETACH)
    {
    }

    return TRUE;
}

HRESULT APIENTRY DllRegisterServer ( void )

Definition at line 319 of file OleSrvr.Cpp.

{
    wchar_t Path[MAX_PATH + 1];
    wchar_t *pGuidStr = 0;
    wchar_t KeyPath[1024];

    // Where are we?
    // =============
  memset (Path, NULL, sizeof(Path));
    GetModuleFileNameW(g_hInstance, Path, sizeof(Path)/sizeof(wchar_t) - 1);

    // Convert CLSID to string.
    // ========================

    StringFromCLSID(CLSID_MyEventProvider, &pGuidStr);
  StringCbPrintfW(KeyPath, sizeof(KeyPath), L"CLSID\\\\%s", pGuidStr);

    HKEY hKey;
  LONG lRes = RegCreateKeyExW( HKEY_CLASSES_ROOT, KeyPath, 0, NULL,
                    REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL,
                    &hKey, NULL );
    if (lRes)
        return E_FAIL;

    wchar_t *pName = L"WMI Sample Event Provider";
    RegSetValueExW(hKey, 0, 0, REG_SZ, (const BYTE *) pName,
    (DWORD)(wcslen(pName) * sizeof(wchar_t) + sizeof(wchar_t)));

    HKEY hSubkey;
  lRes = RegCreateKeyExW( hKey, L"InprocServer32", 0, NULL,
                    REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL,
                    &hSubkey, NULL );
  if (lRes)
        return E_FAIL;

    RegSetValueExW(hSubkey, 0, 0, REG_SZ, (const BYTE *) Path,
    (DWORD)(wcslen(Path) * sizeof(wchar_t) + sizeof(wchar_t)));
    RegSetValueExW(hSubkey, L"ThreadingModel", 0, REG_SZ, (const BYTE *) L"Both",
    (DWORD)(wcslen(L"Both") * sizeof(wchar_t) + sizeof(wchar_t)));

    RegCloseKey(hSubkey);
    RegCloseKey(hKey);

    CoTaskMemFree(pGuidStr);

    return S_OK;
}

HRESULT APIENTRY DllUnregisterServer ( void )

Definition at line 383 of file OleSrvr.Cpp.

{
    wchar_t *pGuidStr = 0;
    HKEY hKey;
    wchar_t KeyPath[256];

    StringFromCLSID(CLSID_MyEventProvider, &pGuidStr);
  StringCbPrintfW(KeyPath, sizeof(KeyPath), L"CLSID\\%s", pGuidStr);

    // Delete InProcServer32 subkey.
    // =============================
    LONG lRes = RegOpenKeyExW(HKEY_CLASSES_ROOT, KeyPath, 0, KEY_WRITE, &hKey);
    if (lRes)
        return E_FAIL;

    RegDeleteKeyW(hKey, L"InprocServer32");
    RegCloseKey(hKey);

    // Delete CLSID GUID key.
    // ======================

    lRes = RegOpenKeyExW(HKEY_CLASSES_ROOT, L"CLSID", 0, KEY_WRITE, &hKey);
    if (lRes)
        return E_FAIL;

    RegDeleteKeyW(hKey, pGuidStr);
    RegCloseKey(hKey);

    CoTaskMemFree(pGuidStr);

    return S_OK;
}

void ObjectCreated ( DWORD dwType )

Definition at line 168 of file OleSrvr.Cpp.

{
    InterlockedIncrement((LONG *) &g_cObj);
}

void ObjectDestroyed ( DWORD dwType )

Definition at line 173 of file OleSrvr.Cpp.

{
    InterlockedDecrement((LONG *) &g_cObj);
}

Generated on Wed Nov 13 2024 16:54:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/FrameworkProv/FrameworkProv.Cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • FrameworkProv
Defines | Variables

FrameworkProv.Cpp File Reference

#include <fwcommon.h>
#include "FrameworkProv.h"

Go to the source code of this file.

Defines

#define | BIT_ALL_PROPERTIES 0xffffffff
#define | BIT_REDNOSE 0x00000001
#define | BIT_WEIGHT 0x00000002

Variables

CReindeer | MyReindeerProvSet (PROVIDER_NAME_REINDEERPROV, L"root\\default")
Deers | ohDeers [Deers::NDeers]

Define Documentation

#define BIT_ALL_PROPERTIES 0xffffffff

Definition at line 24 of file FrameworkProv.Cpp.

#define BIT_REDNOSE 0x00000001

Definition at line 22 of file FrameworkProv.Cpp.

#define BIT_WEIGHT 0x00000002

Definition at line 23 of file FrameworkProv.Cpp.

Variable Documentation

CReindeer MyReindeerProvSet(PROVIDER_NAME_REINDEERPROV, L"root\\default")
Deers ohDeers[Deers::NDeers]
Initial value:
{

    {L"Dasher",  200,    false,      false},
    {L"Dancer",  150,    false,      false},
    {L"Prancer", 162,    false,      false},
    {L"Vixen",   125,    false,      false},
    {L"Comet",   212,    false,      false},
    {L"Cupid",   196,    false,      false},
    {L"Donder",  255,    false,      false},
    {L"Blitzen", 145,    false,      false},
    {L"Rudolf",  123,    true,       false}
}

Definition at line 44 of file FrameworkProv.Cpp.

Generated on Wed Nov 13 2024 16:54:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/FrameworkProv/FrameworkProv.h File Reference

  • SysMgmt
  • WMI
  • VC
  • FrameworkProv
Classes | Defines | Variables

FrameworkProv.h File Reference

Go to the source code of this file.

Classes

class | CReindeer
struct | Deers

Defines

#define | PROVIDER_NAME_REINDEERPROV L"Reindeer"

Variables

const WCHAR * | pName
const WCHAR * | pRedNose
const WCHAR * | pWeight

Define Documentation

#define PROVIDER_NAME_REINDEERPROV L"Reindeer"

Definition at line 16 of file FrameworkProv.h.

Variable Documentation

const WCHAR* pName
const WCHAR* pRedNose
const WCHAR* pWeight
Generated on Wed Nov 13 2024 16:54:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/FrameworkProv/MainDll.Cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • FrameworkProv
Functions | Variables

MainDll.Cpp File Reference

#include <FWcommon.h>
#include <objbase.h>
#include <initguid.h>
#include <strsafe.h>

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, PPVOID ppv)
BOOL APIENTRY | DllMain (HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpReserved)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)
BOOL | Is4OrMore (void)

Variables

CLSID CLSID_CIM_REINDEER
long | g_cLock = 0
HMODULE | ghModule
WCHAR * | GUIDSTRING = "{9a5dd473-d410-11d1-b829-00c04f94c7c3}"

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 84 of file MainDll.Cpp.

{
    SCODE   sc;

    // It is OK to unload if there are no objects or locks on the
    // class factory and the framework is done with you.

    if ((0L==g_cLock) && CWbemProviderGlue::FrameworkLogoffDLL(L"ReindeerProv"))
    {
        sc = S_OK;
    }
    else
    {
        sc = S_FALSE;
    }
    return sc;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | PPVOID | ppv
 | ) |  |

Definition at line 50 of file MainDll.Cpp.

{
    HRESULT hr;
    CWbemGlueFactory *pObj;

    CLSIDFromString(GUIDSTRING, &CLSID_CIM_REINDEER);
    if (CLSID_CIM_REINDEER!=rclsid)
        return E_FAIL;

    pObj=new CWbemGlueFactory();

    if (NULL==pObj)
        return E_OUTOFMEMORY;

    hr=pObj->QueryInterface(riid, ppv);

    if (FAILED(hr))
        delete pObj;

    return hr;
}

BOOL APIENTRY DllMain | ( | HINSTANCE | hInstDLL,
 |  | DWORD | fdwReason,
 |  | LPVOID | lpReserved
 | ) |  |

Definition at line 270 of file MainDll.Cpp.

{
    BOOL bRet = TRUE;

    // Perform actions based on the reason for calling.
    switch( fdwReason )
    {
        case DLL_PROCESS_ATTACH:
    // TO DO: Consider adding DisableThreadLibraryCalls().
            DisableThreadLibraryCalls(hInstDLL);

         // Initialize once for each new process.
         // Return FALSE to fail DLL load.
            ghModule = hInstDLL;
            bRet = CWbemProviderGlue::FrameworkLoginDLL(L"ReindeerProv");
            break;

        case DLL_THREAD_ATTACH:
         // Do thread-specific initialization.
            break;

        case DLL_THREAD_DETACH:
         // Do thread-specific cleanup.
            break;

        case DLL_PROCESS_DETACH:
         // Perform any necessary cleanup.
            break;
    }

    return bRet;  // Sstatus of DLL_PROCESS_ATTACH.
}

STDAPI DllRegisterServer ( void )

Definition at line 130 of file MainDll.Cpp.

{
    char       szID[128];
    WCHAR      wcID[128];
    char       szCLSID[128];
    TCHAR       szModule[MAX_PATH + 1];
    const char * pName = "Sample provider using the Provider Framework";
    const char * pModel;
    HKEY hKey1, hKey2;

    // TO DO: Using 'Both' is preferable.  The framework is designed and written to support
    // free threaded code.  If you will be writing free-threaded code, uncomment these
    // three lines.

    // Since Reindeer is free threaded, these lines have been uncommented

    if(Is4OrMore())
        pModel = "Both";
    else
        pModel = "Apartment";

    // Create the path.

  memset(wcID, NULL, sizeof(wcID));
  memset(szID, NULL, sizeof(szID));

    CLSIDFromString(GUIDSTRING, &CLSID_CIM_REINDEER);
    StringFromGUID2(CLSID_CIM_REINDEER, wcID, sizeof(wcID)/sizeof(WCHAR) - 1);
    wcstombs(szID, wcID,  sizeof(szID));
  StringCbCopy(szCLSID, sizeof(szCLSID), "Software\\classes\\CLSID\\");
  StringCbCat(szCLSID, sizeof(szCLSID), (LPCTSTR)szID);

    // Create entries under CLSID

  LONG lRet = RegCreateKeyEx( HKEY_LOCAL_MACHINE, szCLSID, 0, NULL,
                    REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL,
                    &hKey1, NULL );
  if (lRet != ERROR_SUCCESS)
  {
    return E_FAIL;
  }

    lRet = RegSetValueEx(hKey1, NULL, 0, REG_SZ, (BYTE *)pName, strlen(pName)+1);
  if (lRet != ERROR_SUCCESS)
  {
    RegCloseKey(hKey1);
    return E_FAIL;
  }

  lRet = RegCreateKeyEx( hKey1, "InprocServer32", 0, NULL,
                    REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL,
                    &hKey2, NULL );
  if (lRet != ERROR_SUCCESS)
  {
    RegCloseKey(hKey1);
    return E_FAIL;
  }

  memset(&szModule, NULL, sizeof(szModule));
    GetModuleFileName(ghModule, szModule,  sizeof(szModule)/sizeof(TCHAR) - 1);
    lRet = RegSetValueEx(hKey2, NULL, 0, REG_SZ, (BYTE *)szModule,
                                        strlen(szModule)+1);
  if (lRet != ERROR_SUCCESS)
  {
      RegCloseKey(hKey2);
    RegCloseKey(hKey1);
    return E_FAIL;
  }
    lRet = RegSetValueEx(hKey2, "ThreadingModel", 0, REG_SZ,
                                        (BYTE *)pModel, strlen(pModel)+1);
  if (lRet != ERROR_SUCCESS)
  {
      RegCloseKey(hKey2);
    RegCloseKey(hKey1);
    return E_FAIL;
  }
    RegCloseKey(hKey1);
    RegCloseKey(hKey2);

    return NOERROR;
}

STDAPI DllUnregisterServer ( void )

Definition at line 222 of file MainDll.Cpp.

{
    char       szID[128];
    WCHAR      wcID[128];
    char  szCLSID[128];
    HKEY hKey;

    // Create the path using the CLSID
  memset(wcID, NULL, sizeof(wcID));
  memset(szID, NULL, sizeof(szID));
    CLSIDFromString(GUIDSTRING, &CLSID_CIM_REINDEER);
    StringFromGUID2(CLSID_CIM_REINDEER, wcID, sizeof(wcID)/sizeof(WCHAR));

    wcstombs(szID, wcID, sizeof(szID));

  StringCbCopy(szCLSID, sizeof(szCLSID), "Software\\classes\\CLSID\\");
  StringCbCat(szCLSID, sizeof(szCLSID), (LPCTSTR)szID);

     // First delete the InProcServer subkey.

    DWORD dwRet = RegOpenKeyEx(HKEY_LOCAL_MACHINE, szCLSID, 0, KEY_WRITE, &hKey);
    if(dwRet == NO_ERROR)
    {
        RegDeleteKey(hKey, "InProcServer32");
        RegCloseKey(hKey);
    }

    dwRet = RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\CLASSES\\CLSID\\"), 0, KEY_WRITE, &hKey);
    if(dwRet == NO_ERROR)
    {
        RegDeleteKey(hKey,szID);
        RegCloseKey(hKey);
    }

    return NOERROR;
}

BOOL Is4OrMore ( void )

Definition at line 110 of file MainDll.Cpp.

{
    OSVERSIONINFO os;

    os.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
    if(!GetVersionEx(&os))
        return FALSE;           // should never happen

    return os.dwMajorVersion >= 4;
}

Variable Documentation

CLSID CLSID_CIM_REINDEER

Definition at line 36 of file MainDll.Cpp.

long g_cLock = 0

Definition at line 39 of file MainDll.Cpp.

HMODULE ghModule

Definition at line 32 of file MainDll.Cpp.

WCHAR* GUIDSTRING = "{9a5dd473-d410-11d1-b829-00c04f94c7c3}"

Definition at line 35 of file MainDll.Cpp.

Generated on Wed Nov 13 2024 16:54:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/HiPerfClient/RefClint.Cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • HiPerfClient
Classes | Enumerations | Variables

RefClint.Cpp File Reference

#include <windows.h>
#include <stdio.h>
#include <strsafe.h>
#include "RefClint.h"

Go to the source code of this file.

Classes

struct | CCounterData

Enumerations

enum {
Ctr1, Ctr2, Ctr3, Ctr4,
Ctr5, NumCtrs
}

Variables

struct CCounterData | g_aCounters []

Enumeration Type Documentation

anonymous enum
Enumerator:
Ctr1
Ctr2
Ctr3
Ctr4
Ctr5
NumCtrs

Definition at line 29 of file RefClint.Cpp.

{
  Ctr1,
  Ctr2,
  Ctr3,
  Ctr4,
  Ctr5,
  NumCtrs
};

Variable Documentation

struct CCounterData g_aCounters[]
Generated on Wed Nov 13 2024 16:54:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/HiPerfClient/RefClint.h File Reference

  • SysMgmt
  • WMI
  • VC
  • HiPerfClient
Classes | Variables

RefClint.h File Reference

#include <wbemcli.h>

Go to the source code of this file.

Classes

class | CRefClient
class | CRefresherMember< T >

Variables

const DWORD | cdwNumReps = 100
const long | clNumInstances = 5
const WCHAR | cwcsObjectPath [] = "Win32_BasicHiPerf"

Variable Documentation

const DWORD cdwNumReps = 100

Definition at line 24 of file RefClint.h.

const long clNumInstances = 5

Definition at line 23 of file RefClint.h.

const WCHAR cwcsObjectPath[] = "Win32_BasicHiPerf"

Definition at line 22 of file RefClint.h.

Generated on Wed Nov 13 2024 16:54:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/HiPerfClient/SamplCli.Cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • HiPerfClient
Defines | Functions | Variables

SamplCli.Cpp File Reference

#include <windows.h>
#include <stdio.h>
#include <wbemcli.h>
#include <strsafe.h>
#include "RefClint.h"

Go to the source code of this file.

Defines

#define | _WIN32_WINNT 0x0400
#define | UNICODE

Functions

int | main (int argc, char *argv[])
void | RefreshLoop ()

Variables

IWbemServices * | g_pNameSpace = NULL

Define Documentation

#define _WIN32_WINNT 0x0400

Definition at line 28 of file SamplCli.Cpp.

#define UNICODE

Definition at line 30 of file SamplCli.Cpp.

Function Documentation

int main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 55 of file SamplCli.Cpp.

{
  HRESULT hRes = WBEM_NO_ERROR;

  IWbemLocator* pWbemLocator = NULL;

  BSTR  bstrNameSpace = NULL;

  WCHAR wcsSvrName[MAX_PATH + 1];
  StringCbCopyW(wcsSvrName, sizeof(wcsSvrName), L"." );

  // Initialize COM
  // ==============

  hRes = CoInitializeEx( NULL, COINIT_MULTITHREADED );
  if ( FAILED( hRes ) )
    return 0;

  // Setup default security parameters
  // =================================
  //  NOTE:
  //  When using asynchronous WMI API's remotely in an environment where the "Local System" account
  //  has no network identity (such as non-Kerberos domains), the authentication level of
  //  RPC_C_AUTHN_LEVEL_NONE is needed. However, lowering the authentication level to
  //  RPC_C_AUTHN_LEVEL_NONE makes your application less secure. It is wise to
  //  use semi-synchronous API's for accessing WMI data and events instead of the asynchronous ones.

  hRes = CoInitializeSecurity( NULL, -1, NULL, NULL,
                      RPC_C_AUTHN_LEVEL_PKT_PRIVACY,
                      RPC_C_IMP_LEVEL_IMPERSONATE,
                      NULL,
                      EOAC_SECURE_REFS, //change to EOAC_NONE if you change dwAuthnLevel to RPC_C_AUTHN_LEVEL_NONE
                      NULL );
  if ( FAILED( hRes ) )
    goto cleanup;

// Initialize the environment based on the command line arguments
// ==============================================================

  if ( argc >= 2 )
  {
    // The remote server name
    // ======================
    memset(wcsSvrName, NULL, sizeof(wcsSvrName));

    MultiByteToWideChar( CP_ACP, 0L, argv[1], -1, wcsSvrName, sizeof(wcsSvrName)/sizeof (WCHAR) - 1);
  }

// Attach to WinMgmt
// =================

  // Get the local locator object
  // ============================

  hRes = CoCreateInstance( CLSID_WbemLocator, NULL, CLSCTX_INPROC_SERVER, IID_IWbemLocator, (void**) &pWbemLocator );
  if (FAILED(hRes))
    goto cleanup;

  // Connect to the desired namespace
  // ================================

  WCHAR wszNameSpace[MAX_PATH + 20];
  StringCbPrintfW(wszNameSpace, sizeof(wszNameSpace), L"\\\\%s\\root\\cimv2", wcsSvrName );

  bstrNameSpace = SysAllocString( wszNameSpace );
  if (bstrNameSpace == NULL)
    goto cleanup;

  hRes = pWbemLocator->ConnectServer( bstrNameSpace,  // NameSpace Name
                    NULL,     // UserName
                    NULL,     // Password
                    NULL,     // Locale
                    0L,       // Security Flags
                    NULL,     // Authority
                    NULL,     // Wbem Context
                    &g_pNameSpace // Namespace
                    );

  if ( FAILED( hRes ) )
    goto cleanup;

  // Start the refresh loop
  // ======================

  RefreshLoop();

// Cleanup
// =======
cleanup:
  SysFreeString( bstrNameSpace );

  if ( NULL != g_pNameSpace )
    g_pNameSpace->Release();

  if ( NULL != pWbemLocator )
    pWbemLocator->Release();

  CoUninitialize();

  return 0;
}

void RefreshLoop ( )

Definition at line 165 of file SamplCli.Cpp.

{
  HRESULT   hRes    = WBEM_NO_ERROR;
  long    lLoopCount  = 0;    // Refresh loop counter
  CRefClient  aRefClient;

// Initialize our container class
// ==============================

  hRes = aRefClient.Initialize(g_pNameSpace);
  if (FAILED(hRes))
    goto cleanup;

// Add items to the refresher
// ==========================

  // Add an enumerator
  // =================

  hRes = aRefClient.AddEnum();
  if ( FAILED( hRes ) )
    goto cleanup;

  // Add objects
  // ===========

  hRes = aRefClient.AddObjects();
  if ( FAILED( hRes ) )
    goto cleanup;

// Begin the refreshing loop
// =========================

  for ( lLoopCount = 0; lLoopCount < cdwNumReps; lLoopCount++ )
  {
    // Refresh!!
    // =========

    hRes = aRefClient.Refresh();
    if ( FAILED ( hRes ) )
    {
      printf("Refresh failed: 0x%X\n", hRes);
      goto cleanup;
    }

    printf( "Refresh number: %d\n", lLoopCount );

    aRefClient.ShowObjectData();
    aRefClient.ShowEnumeratorData();

    printf( "\n" );

  } // FOR Refresh

// Cleanup
// =======
cleanup:

  aRefClient.RemoveEnum();
  aRefClient.RemoveObjects();

  return;
}

Variable Documentation

IWbemServices* g_pNameSpace = NULL

Definition at line 47 of file SamplCli.Cpp.

Generated on Wed Nov 13 2024 16:54:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/HiPerfProvider/BasicHiPerf.Cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • HiPerfProvider
Classes | Defines | Functions | Variables

BasicHiPerf.Cpp File Reference

#include <windows.h>
#include <stdio.h>
#include <process.h>
#include <strsafe.h>
#include <objbase.h>
#include "BasicHiPerf.h"

Go to the source code of this file.

Classes

struct | tagProperties

Defines

#define | _UNICODE
#define | _WIN32_WINNT 0x0500
#define | STRSAFE_NO_DEPRECATE
#define | UNICODE

Functions

HRESULT | CloneAccess (IWbemObjectAccess *pOriginal, IWbemObjectAccess **ppClone)
DWORD GetCurrentImpersonationLevel ()
STDMETHODIMP_ (ULONG) CHiPerfProvider

Variables

struct tagProperties | g_aCounterProps []
long | g_hID
long | g_lObjects

Define Documentation

#define _UNICODE

Definition at line 28 of file BasicHiPerf.Cpp.

#define _WIN32_WINNT 0x0500

Definition at line 33 of file BasicHiPerf.Cpp.

#define STRSAFE_NO_DEPRECATE

Definition at line 31 of file BasicHiPerf.Cpp.

#define UNICODE

Definition at line 29 of file BasicHiPerf.Cpp.

Function Documentation

HRESULT CloneAccess | ( | IWbemObjectAccess * | pOriginal,
 |  | IWbemObjectAccess ** | ppClone
 | ) |  |

Definition at line 101 of file BasicHiPerf.Cpp.

              :
//    pOriginal - the original object
//    ppClone   - the cloned object
//
//////////////////////////////////////////////////////////////
//ok
{
  HRESULT hRes = WBEM_NO_ERROR;

  IWbemClassObject* pOurClassObj = NULL;
  IWbemClassObject* pClonedClassObj = NULL;
  IWbemObjectAccess*  pClonedAccessObj = NULL;

  // Get the IWbemClassObject interface for the object
  // =================================================

  hRes = pOriginal->QueryInterface(IID_IWbemClassObject, (PVOID*)&pOurClassObj);
  if (FAILED(hRes))
    return hRes;

  // Clone the object
  // ================

  hRes = pOurClassObj->Clone(&pClonedClassObj);
  pOurClassObj->Release();
  if (FAILED(hRes))
    return hRes;

  // Get the IWbemObjectAccess interface for the cloned object
  // =========================================================

  hRes = pClonedClassObj->QueryInterface(IID_IWbemObjectAccess, (PVOID*)&pClonedAccessObj);
  pClonedClassObj->Release();
  if (FAILED(hRes))
    return hRes;

  // Copy the cloned object into the returned parameter (refcount == 1)
  // ==================================================================

  *ppClone = pClonedAccessObj;

  return WBEM_NO_ERROR;
}

DWORD GetCurrentImpersonationLevel ( )

Definition at line 165 of file BasicHiPerf.Cpp.

{
  DWORD t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;

    HANDLE t_ThreadToken = NULL ;

    BOOL t_Status = OpenThreadToken (

    GetCurrentThread() ,
    TOKEN_QUERY,
    TRUE,
    &t_ThreadToken
  ) ;

    if ( t_Status )
    {
    SECURITY_IMPERSONATION_LEVEL t_Level = SecurityAnonymous ;
    DWORD t_Returned = 0 ;

    t_Status = GetTokenInformation (

      t_ThreadToken ,
      TokenImpersonationLevel ,
      & t_Level ,
      sizeof ( SECURITY_IMPERSONATION_LEVEL ) ,
      & t_Returned
    ) ;

    CloseHandle ( t_ThreadToken ) ;

    if ( t_Status == FALSE )
    {
      t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;
    }
    else
    {
      switch ( t_Level )
      {
        case SecurityAnonymous:
        {
          t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;
        }
        break ;

        case SecurityIdentification:
        {
          t_ImpersonationLevel = RPC_C_IMP_LEVEL_IDENTIFY ;
        }
        break ;

        case SecurityImpersonation:
        {
          t_ImpersonationLevel = RPC_C_IMP_LEVEL_IMPERSONATE ;
        }
        break ;

        case SecurityDelegation:
        {
          t_ImpersonationLevel = RPC_C_IMP_LEVEL_DELEGATE ;
        }
        break ;

        default:
        {
          t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;
        }
        break ;
      }
    }
  }
  else
  {
        ULONG t_LastError = GetLastError () ;

        if ( t_LastError == ERROR_NO_IMPERSONATION_TOKEN || t_LastError == ERROR_NO_TOKEN )
        {
            t_ImpersonationLevel = RPC_C_IMP_LEVEL_DELEGATE ;
        }
        else
    {
      if ( t_LastError == ERROR_CANT_OPEN_ANONYMOUS )
      {
        t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;
      }
      else
      {
        t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;
      }
    }
    }

  return t_ImpersonationLevel ;
}

STDMETHODIMP_ ( ULONG )

Definition at line 1368 of file BasicHiPerf.Cpp.

{
    long lRef = InterlockedDecrement(&m_lRef);
    if(lRef == 0)
        delete this;

    return lRef;
}

Variable Documentation

struct tagProperties g_aCounterProps[]
long g_hID

Definition at line 74 of file BasicHiPerf.Cpp.

long g_lObjects

Definition at line 73 of file Server.Cpp.

Generated on Wed Nov 13 2024 16:54:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/HiPerfProvider/BasicHiPerf.h File Reference

  • SysMgmt
  • WMI
  • VC
  • HiPerfProvider
Classes | Defines | Enumerations

BasicHiPerf.h File Reference

#include <tchar.h>
#include <wbemprov.h>

Go to the source code of this file.

Classes

class | CCacheMapEl
class | CHiPerfProvider
class | CRefresher
class | CSampleDataSource
class | CSampleInstance

Defines

#define | _UNICODE
#define | MAX_ENUMERATORS 10
#define | MAX_INSTANCES 128
#define | NUM_INSTANCES 5
#define | NUM_OBJECTS 1
#define | PROP_DWORD 0x0001L
#define | PROP_QWORD 0x0002L
#define | PROP_VALUE 0x0004L
#define | SAMPLE_CLASS _T("Win32_BasicHiPerf")
#define | UNICODE

Enumerations

enum CounterHandles {
ctr1 = 0, ctr2, ctr3, ctr4,
ctr5, NumCtrs
}

Define Documentation

#define _UNICODE

Definition at line 79 of file BasicHiPerf.h.

#define MAX_ENUMERATORS 10

Definition at line 98 of file BasicHiPerf.h.

#define MAX_INSTANCES 128

Definition at line 97 of file BasicHiPerf.h.

#define NUM_INSTANCES 5

Definition at line 96 of file BasicHiPerf.h.

#define NUM_OBJECTS 1

Definition at line 95 of file BasicHiPerf.h.

#define PROP_DWORD 0x0001L

Definition at line 102 of file BasicHiPerf.h.

#define PROP_QWORD 0x0002L

Definition at line 103 of file BasicHiPerf.h.

#define PROP_VALUE 0x0004L

Definition at line 104 of file BasicHiPerf.h.

#define SAMPLE_CLASS _T("Win32_BasicHiPerf")

Definition at line 100 of file BasicHiPerf.h.

#define UNICODE

Definition at line 78 of file BasicHiPerf.h.

Enumeration Type Documentation

enum CounterHandles
Enumerator:
ctr1
ctr2
ctr3
ctr4
ctr5
NumCtrs

Definition at line 110 of file BasicHiPerf.h.

{
  ctr1 = 0,
  ctr2,
  ctr3,
  ctr4,
  ctr5,
  NumCtrs
};

Generated on Wed Nov 13 2024 16:54:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/HiPerfProvider/Factory.Cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • HiPerfProvider
Defines | Functions | Variables

Factory.Cpp File Reference

#include <windows.h>
#include "BasicHiPerf.h"
#include "Factory.h"

Go to the source code of this file.

Defines

#define | _UNICODE
#define | UNICODE

Functions

STDMETHODIMP_ (ULONG) CClassFactory

Variables

long | g_lLocks
long | g_lObjects

Define Documentation

#define _UNICODE

Definition at line 27 of file Factory.Cpp.

#define UNICODE

Definition at line 28 of file Factory.Cpp.

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 72 of file Factory.Cpp.

{
    long lRef = InterlockedDecrement(&m_lRef);
    if(lRef == 0)
        delete this;

    return lRef;
}

Variable Documentation

long g_lLocks

Definition at line 72 of file Server.Cpp.

long g_lObjects

Definition at line 73 of file Server.Cpp.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/HiPerfProvider/Factory.h File Reference

  • SysMgmt
  • WMI
  • VC
  • HiPerfProvider
Classes

Factory.h File Reference

Go to the source code of this file.

Classes

class CClassFactory
Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/HiPerfProvider/Server.Cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • HiPerfProvider
Defines | Functions | Variables

Server.Cpp File Reference

#include <windows.h>
#include <stdio.h>
#include <time.h>
#include <locale.h>
#include <initguid.h>
#include <strsafe.h>
#include "Factory.h"
#include "wbemprov.h"
#include "BasicHiPerf.h"

Go to the source code of this file.

Defines

#define | CPP_CLASS_NAME CHiPerfProvider
#define | IMPLEMENTED_CLSID CLSID_BasicHiPerf_v1
#define | INTERFACE_CAST (IWbemHiPerfProvider*)
#define | SERVER_REGISTRY_COMMENT L"WMI Basic HiPerf Provider"
#define | STRSAFE_NO_DEPRECATE

Functions

DEFINE_GUID (CLSID_BasicHiPerf_v1, 0xb56b1d80, 0xaa4f, 0x11d2, 0xb3, 0x48, 0x0, 0x10, 0x5a, 0x14, 0x69, 0xb7)
STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpReserved)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

HINSTANCE | g_hInstance
long | g_lLocks = 0
long | g_lObjects = 0

Define Documentation

#define CPP_CLASS_NAME CHiPerfProvider

Definition at line 62 of file Server.Cpp.

#define IMPLEMENTED_CLSID CLSID_BasicHiPerf_v1

Definition at line 60 of file Server.Cpp.

#define INTERFACE_CAST (IWbemHiPerfProvider*)

Definition at line 63 of file Server.Cpp.

#define SERVER_REGISTRY_COMMENT L"WMI Basic HiPerf Provider"

Definition at line 61 of file Server.Cpp.

#define STRSAFE_NO_DEPRECATE

Definition at line 37 of file Server.Cpp.

Function Documentation

DEFINE_GUID | ( | CLSID_BasicHiPerf_v1 | ,
 |  | 0xb56b1d80 | ,
 |  | 0xaa4f | ,
 |  | 0x11d2 | ,
 |  | 0xb3 | ,
 |  | 0x48 | ,
 |  | 0x0 | ,
 |  | 0x10 | ,
 |  | 0x5a | ,
 |  | 0x14 | ,
 |  | 0x69 | ,
 |  | 0xb7 |
 | ) |  |
STDAPI DllCanUnloadNow ( void )

Definition at line 181 of file Server.Cpp.

{
    HRESULT hRes = S_FALSE;

    if (0 == g_lLocks && 0 == g_lObjects)
        hRes = S_OK;

    return hRes;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 131 of file Server.Cpp.

{
    CClassFactory *pClassFactory = NULL;
  HRESULT hRes;

    //  Verify the caller is asking for our type of object
  // ===================================================

    if (IMPLEMENTED_CLSID == rclsid)
  {
    // Create the class factory
    // ========================

    pClassFactory = new CClassFactory;

    if (!pClassFactory)
      return E_OUTOFMEMORY;

    hRes = pClassFactory->QueryInterface(riid, ppv);
    if (FAILED(hRes))
    {
      delete pClassFactory;
      return hRes;
    }
    hRes = S_OK;
  }
  else
    hRes = CLASS_E_CLASSNOTAVAILABLE;

    return hRes;
}

BOOL WINAPI DllMain | ( | HINSTANCE | hinstDLL,
 |  | DWORD | dwReason,
 |  | LPVOID | lpReserved
 | ) |  |

Definition at line 95 of file Server.Cpp.

{
    if (dwReason == DLL_PROCESS_ATTACH)
    {
        setlocale(LC_ALL, "");      // Set to the 'current' locale
        g_hInstance = hinstDLL;
    }

    return TRUE;
}

STDAPI DllRegisterServer ( void )

Definition at line 204 of file Server.Cpp.

{
    wchar_t Path[MAX_PATH + 1];
    wchar_t pGuidStr[128];
    wchar_t KeyPath[1024];

    // Get the dll's filename
    // ======================

  memset (Path, NULL, sizeof(Path));
    GetModuleFileNameW(g_hInstance, Path, sizeof(Path)/sizeof(wchar_t) - 1);

    // Convert CLSID to string.
    // ========================

    StringFromGUID2(IMPLEMENTED_CLSID, pGuidStr, sizeof(pGuidStr));
  StringCbPrintfW(KeyPath, sizeof(KeyPath), L"Software\\Classes\\CLSID\\\\%s", pGuidStr);

    // Place it in registry.
    // CLSID\\CLSID_Nt5PerProvider_v1 : <no_name> : "name"
    //      \\CLSID_Nt5PerProvider_v1\\InProcServer32 : <no_name> : "path to DLL"
    //                                    : ThreadingModel : "both"
    // ==============================================================

    HKEY hKey;
    LONG lRes = RegCreateKeyExW( HKEY_LOCAL_MACHINE, KeyPath, 0, NULL,
                    REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL,
                    &hKey, NULL );
    if (lRes)
        return E_FAIL;

    wchar_t *pName = SERVER_REGISTRY_COMMENT;
    RegSetValueExW(hKey, 0, 0, REG_SZ, (const BYTE *) pName,
    (DWORD)(wcslen(pName) * sizeof(wchar_t) + sizeof(wchar_t)));

    HKEY hSubkey;
    lRes = RegCreateKeyEx(hKey, "InprocServer32", 0, NULL,
                    REG_OPTION_NON_VOLATILE, KEY_WRITE,
          NULL, &hSubkey, NULL);

    RegSetValueExW(hSubkey, 0, 0, REG_SZ, (const BYTE *) Path,
    (DWORD)(wcslen(Path) * sizeof(wchar_t) + sizeof(wchar_t)));
    RegSetValueExW(hSubkey, L"ThreadingModel", 0, REG_SZ, (const BYTE *) L"Both",
    (DWORD)(wcslen(L"Both") * sizeof(wchar_t) + sizeof(wchar_t)));

    RegCloseKey(hSubkey);
    RegCloseKey(hKey);

    return S_OK;
}

STDAPI DllUnregisterServer ( void )

Definition at line 269 of file Server.Cpp.

{
    wchar_t pGuidStr[128];
    HKEY hKey;
    wchar_t KeyPath[256];

    StringFromGUID2(IMPLEMENTED_CLSID, pGuidStr, sizeof(pGuidStr));
  StringCbPrintfW(KeyPath, sizeof(KeyPath), L"Software\\Classes\\CLSID\\\\%s", pGuidStr);

    // Delete InProcServer32 subkey.
    // =============================
    LONG lRes = RegOpenKeyExW(HKEY_LOCAL_MACHINE, KeyPath, 0, KEY_WRITE, &hKey);
    if (lRes)
        return E_FAIL;

    RegDeleteKeyW(hKey, L"InprocServer32");
    RegCloseKey(hKey);

    // Delete CLSID GUID key.
    // ======================

    lRes = RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\Classes\\CLSID", 0, KEY_WRITE, &hKey);
    if (lRes)
        return E_FAIL;

    RegDeleteKeyW(hKey, pGuidStr);
    RegCloseKey(hKey);

    return S_OK;
}

Variable Documentation

HINSTANCE g_hInstance

Definition at line 71 of file Server.Cpp.

long g_lLocks = 0

Definition at line 72 of file Server.Cpp.

long g_lObjects = 0

Definition at line 73 of file Server.Cpp.

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/InstProv/ClassFac.Cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • InstProv
Functions

ClassFac.Cpp File Reference

#include <objbase.h>
#include "sample.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CProvFactory

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 79 of file ClassFac.Cpp.

{
    ULONG nNewCount = InterlockedDecrement((long *)&m_cRef);
    if (0L == nNewCount)
        delete this;

    return nNewCount;
}

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/InstProv/InstProv.Cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • InstProv
Defines | Functions | Variables

InstProv.Cpp File Reference

#include <objbase.h>
#include "sample.h"
#include <process.h>
#include <strsafe.h>
#include <sddl.h>

Go to the source code of this file.

Defines

#define | _WIN32_WINNT 0x0500

Functions

STDMETHODIMP_ (ULONG) CInstPro

Variables

long | glNumInst = sizeof(MyDefs)/sizeof(InstDef)
InstDef | MyDefs [] = {{L"a", 1}, {L"b", 2}, {L"c", 3}}

Define Documentation

#define _WIN32_WINNT 0x0500

Definition at line 22 of file InstProv.Cpp.

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 96 of file InstProv.Cpp.

{
    ULONG nNewCount = InterlockedDecrement((long *)&m_cRef);
    if (0L == nNewCount)
        delete this;

    return nNewCount;
}

Variable Documentation

long glNumInst = sizeof(MyDefs)/sizeof(InstDef)

Definition at line 33 of file InstProv.Cpp.

InstDef MyDefs[] = {{L"a", 1}, {L"b", 2}, {L"c", 3}}

Definition at line 31 of file InstProv.Cpp.

Generated on Wed Nov 13 2024 16:54:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/InstProv/MainDll.Cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • InstProv
Functions | Variables

MainDll.Cpp File Reference

#include <objbase.h>
#include <initguid.h>
#include <strsafe.h>
#include "sample.h"

Go to the source code of this file.

Functions

DEFINE_GUID (CLSID_instprovider, 0x22cb8761, 0x914a, 0x11cf, 0xb7, 0x5, 0x0, 0xaa, 0x0, 0x62, 0xcb, 0xb7)
STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, PPVOID ppv)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)
BOOL WINAPI | LibMain32 (HINSTANCE hInstance, ULONG ulReason, LPVOID pvReserved)

Variables

long | g_cLock = 0
long | g_cObj = 0
HMODULE | ghModule

Function Documentation

DEFINE_GUID | ( | CLSID_instprovider | ,
 |  | 0x22cb8761 | ,
 |  | 0x914a | ,
 |  | 0x11cf | ,
 |  | 0xb7 | ,
 |  | 0x5 | ,
 |  | 0x0 | ,
 |  | 0xaa | ,
 |  | 0x0 | ,
 |  | 0x62 | ,
 |  | 0xcb | ,
 |  | 0xb7 |
 | ) |  |
STDAPI DllCanUnloadNow ( void )

Definition at line 109 of file MainDll.Cpp.

{
    SCODE   sc;

    //It is OK to unload if there are no objects or locks on the
    // class factory.

    sc=(0L==g_cObj && 0L==g_cLock) ? S_OK : S_FALSE;
    return sc;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | PPVOID | ppv
 | ) |  |

Definition at line 76 of file MainDll.Cpp.

{
    HRESULT hr;
    CProvFactory *pObj;

    if (CLSID_instprovider!=rclsid)
        return E_FAIL;

    pObj=new CProvFactory();

    if (NULL==pObj)
        return E_OUTOFMEMORY;

    hr=pObj->QueryInterface(riid, ppv);

    if (FAILED(hr))
        delete pObj;

    return hr;
}

STDAPI DllRegisterServer ( void )

Definition at line 129 of file MainDll.Cpp.

{
    char       szID[128];
  WCHAR   wcID[128];
    char       szCLSID[128];
    TCHAR       szModule[MAX_PATH + 1];
    const char * pName = "WMI Sample Instance Provider";
    const char * pModel = "Both";
    HKEY hKey1, hKey2;

    // Create the path.

  memset(wcID, NULL, sizeof(wcID));
  memset(szID, NULL, sizeof(szID));
    StringFromGUID2(CLSID_instprovider, wcID, sizeof(wcID)/sizeof(WCHAR));
  wcstombs(szID, wcID, sizeof(szID));
  StringCbCopy(szCLSID, sizeof(szCLSID), "Software\\classes\\CLSID\\");
  StringCbCat(szCLSID, sizeof(szCLSID), (LPCTSTR)szID);

    // Create entries under CLSID

  LONG lRet = RegCreateKeyEx( HKEY_LOCAL_MACHINE, szCLSID, 0, NULL,
                    REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL,
                    &hKey1, NULL );
  if (lRet != ERROR_SUCCESS)
  {
    return E_FAIL;
  }

    lRet = RegSetValueEx(hKey1, NULL, 0, REG_SZ, (BYTE *)pName, strlen(pName)+1);
  if (lRet != ERROR_SUCCESS)
  {
    RegCloseKey(hKey1);
    return E_FAIL;
  }

  lRet = RegCreateKeyEx( hKey1, "InprocServer32", 0, NULL,
                    REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL,
                    &hKey2, NULL );
  if (lRet != ERROR_SUCCESS)
  {
    RegCloseKey(hKey1);
    return E_FAIL;
  }

  memset(&szModule, NULL, sizeof(szModule));
  GetModuleFileName(ghModule, szModule, sizeof(szModule)/sizeof(TCHAR) - 1);

    lRet = RegSetValueEx(hKey2, NULL, 0, REG_SZ, (BYTE *)szModule,
                                        strlen(szModule)+1);
  if (lRet != ERROR_SUCCESS)
  {
      RegCloseKey(hKey2);
    RegCloseKey(hKey1);
    return E_FAIL;
  }

  lRet = RegSetValueEx(hKey2, "ThreadingModel", 0, REG_SZ,
                                        (BYTE *)pModel, strlen(pModel)+1);
  if (lRet != ERROR_SUCCESS)
  {
      RegCloseKey(hKey2);
    RegCloseKey(hKey1);
    return E_FAIL;
  }
    RegCloseKey(hKey1);
    RegCloseKey(hKey2);
    return NOERROR;
}

STDAPI DllUnregisterServer ( void )

Definition at line 210 of file MainDll.Cpp.

{
    TCHAR szID[128];
  WCHAR wcID[128];
    TCHAR szCLSID[128];
    HKEY  hKey;

    // Create the path using the CLSID

  memset(wcID, NULL, sizeof(wcID));
  memset(szID, NULL, sizeof(szID));
    StringFromGUID2(CLSID_instprovider, wcID, sizeof(wcID)/sizeof(WCHAR));
  wcstombs(szID, wcID, sizeof(szID));
  StringCbCopy(szCLSID, sizeof(szCLSID), "Software\\classes\\CLSID\\");
  StringCbCat(szCLSID, sizeof(szCLSID), (LPCTSTR)szID);

    // First delete the InProcServer subkey.

    DWORD dwRet = RegOpenKeyEx(HKEY_LOCAL_MACHINE, szCLSID, 0, KEY_WRITE, &hKey);
    if(dwRet == NO_ERROR)
    {
        RegDeleteKey(hKey, "InProcServer32");
        RegCloseKey(hKey);
    }

    dwRet = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\classes\\CLSID", 0, KEY_WRITE, &hKey);
    if(dwRet == NO_ERROR)
    {
        RegDeleteKey(hKey,szID);
        RegCloseKey(hKey);
    }

    return NOERROR;
}

BOOL WINAPI LibMain32 | ( | HINSTANCE | hInstance,
 |  | ULONG | ulReason,
 |  | LPVOID | pvReserved
 | ) |  |

Definition at line 58 of file MainDll.Cpp.

{
    if (DLL_PROCESS_ATTACH==ulReason)
        ghModule = hInstance;
    return TRUE;
}

Variable Documentation

long g_cLock = 0

Definition at line 45 of file MainDll.Cpp.

long g_cObj = 0

Definition at line 44 of file MainDll.Cpp.

HMODULE ghModule

Definition at line 33 of file MainDll.Cpp.

Generated on Wed Nov 13 2024 16:54:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/InstProv/Sample.h File Reference

  • SysMgmt
  • WMI
  • VC
  • InstProv
Classes | Typedefs | Functions | Variables

Sample.h File Reference

#include <wbemprov.h>

Go to the source code of this file.

Classes

class | CInstPro
class | CProvFactory
struct | InstDef

Typedefs

typedef CInstPro * | PCInstPro
typedef CProvFactory * | PCProvFactory
typedef LPVOID * | PPVOID

Functions

SCODE | CreateInst (IWbemServices *pNamespace, LPWSTR pKey, long lVal, IWbemClassObject **pNewInst, WCHAR *pwcClassName, IWbemContext *pCtx)
DWORD GetCurrentImpersonationLevel ()

Variables

long | g_cLock
long | g_cObj
long | glNumInst
InstDef MyDefs []

Typedef Documentation

typedef CInstPro* PCInstPro

Definition at line 196 of file Sample.h.

typedef CProvFactory* PCProvFactory

Definition at line 220 of file Sample.h.

typedef LPVOID* PPVOID

Definition at line 26 of file Sample.h.

Function Documentation

SCODE CreateInst | ( | IWbemServices * | pNamespace,
 |  | LPWSTR | pKey,
 |  | long | lVal,
 |  | IWbemClassObject ** | pNewInst,
 |  | WCHAR * | pwcClassName,
 |  | IWbemContext * | pCtx
 | ) |  |

Definition at line 36 of file Utils.Cpp.

{
    SCODE sc;
    IWbemClassObject * pClass = NULL;
    sc = pNamespace->GetObject(pwcClassName, 0, pCtx, &pClass, NULL);
    if(sc != S_OK)
        return WBEM_E_FAILED;
    sc = pClass->SpawnInstance(0, pNewInst);
    pClass->Release();
    if(FAILED(sc))
        return sc;
    VARIANT v;

    // Set the key property value.

    v.vt = VT_BSTR;
    v.bstrVal = SysAllocString(pKey);
  if (v.bstrVal == NULL)
    return WBEM_E_OUT_OF_MEMORY;
    sc = (*pNewInst)->Put(L"MyKey", 0, &v, 0);
    VariantClear(&v);
  if(FAILED(sc))
        return sc;

    // Set the number property value.

    v.vt = VT_I4;
    v.lVal = lVal;
    sc = (*pNewInst)->Put(L"MyValue", 0, &v, 0);
    return sc;
}

DWORD GetCurrentImpersonationLevel ( )

Definition at line 465 of file Service.cpp.

{
  DWORD t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;

    HANDLE t_ThreadToken = NULL ;

    BOOL t_Status = OpenThreadToken (

    GetCurrentThread() ,
    TOKEN_QUERY,
    TRUE,
    &t_ThreadToken
  ) ;

    if ( t_Status )
    {
    SECURITY_IMPERSONATION_LEVEL t_Level = SecurityAnonymous ;
    DWORD t_Returned = 0 ;

    t_Status = GetTokenInformation (

      t_ThreadToken ,
      TokenImpersonationLevel ,
      & t_Level ,
      sizeof ( SECURITY_IMPERSONATION_LEVEL ) ,
      & t_Returned
    ) ;

    CloseHandle ( t_ThreadToken ) ;

    if ( t_Status == FALSE )
    {
      t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;
    }
    else
    {
      switch ( t_Level )
      {
        case SecurityAnonymous:
        {
          t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;
        }
        break ;

        case SecurityIdentification:
        {
          t_ImpersonationLevel = RPC_C_IMP_LEVEL_IDENTIFY ;
        }
        break ;

        case SecurityImpersonation:
        {
          t_ImpersonationLevel = RPC_C_IMP_LEVEL_IMPERSONATE ;
        }
        break ;

        case SecurityDelegation:
        {
          t_ImpersonationLevel = RPC_C_IMP_LEVEL_DELEGATE ;
        }
        break ;

        default:
        {
          t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;
        }
        break ;
      }
    }
  }
  else
  {
        ULONG t_LastError = GetLastError () ;

        if ( t_LastError == ERROR_NO_IMPERSONATION_TOKEN || t_LastError == ERROR_NO_TOKEN )
        {
            t_ImpersonationLevel = RPC_C_IMP_LEVEL_DELEGATE ;
        }
        else
    {
      if ( t_LastError == ERROR_CANT_OPEN_ANONYMOUS )
      {
        t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;
      }
      else
      {
        t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;
      }
    }
    }

  return t_ImpersonationLevel ;
}

Variable Documentation

long g_cLock

Definition at line 27 of file myclassfactory.cpp.

long g_cObj

Definition at line 26 of file myclassfactory.cpp.

long glNumInst

Definition at line 31 of file ClassProv.Cpp.

InstDef MyDefs[]

Definition at line 29 of file ClassProv.Cpp.

Generated on Wed Nov 13 2024 16:53:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/InstProv/Utils.Cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • InstProv
Functions

Utils.Cpp File Reference

#include <objbase.h>
#include "sample.h"

Go to the source code of this file.

Functions

SCODE CreateInst (IWbemServices *pNamespace, LPWSTR pKey, long lVal, IWbemClassObject **pNewInst, WCHAR *pwcClassName, IWbemContext *pCtx)
DWORD GetCurrentImpersonationLevel ()

Function Documentation

SCODE CreateInst | ( | IWbemServices * | pNamespace,
 |  | LPWSTR | pKey,
 |  | long | lVal,
 |  | IWbemClassObject ** | pNewInst,
 |  | WCHAR * | pwcClassName,
 |  | IWbemContext * | pCtx
 | ) |  |

Definition at line 38 of file Utils.Cpp.

{
    SCODE sc;
    IWbemClassObject * pClass = NULL;
    sc = pNamespace->GetObject(pwcClassName, 0, pCtx, &pClass, NULL);
    if(sc != S_OK)
        return WBEM_E_FAILED;
    sc = pClass->SpawnInstance(0, pNewInst);
    pClass->Release();
    if(FAILED(sc))
        return sc;
    VARIANT v;

    // Set the key property value.

    v.vt = VT_BSTR;
    v.bstrVal = SysAllocString(pKey);
  if (!v.bstrVal)
    return WBEM_E_OUT_OF_MEMORY;

    sc = (*pNewInst)->Put(L"MyKey", 0, &v, 0);
    VariantClear(&v);
  if(FAILED(sc))
        return sc;

    // Set the number property value.

    v.vt = VT_I4;
    v.lVal = lVal;
    sc = (*pNewInst)->Put(L"MyValue", 0, &v, 0);
    return sc;
}

DWORD GetCurrentImpersonationLevel ( )

Definition at line 86 of file Utils.Cpp.

{
  DWORD t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;

    HANDLE t_ThreadToken = NULL ;

    BOOL t_Status = OpenThreadToken (

    GetCurrentThread() ,
    TOKEN_QUERY,
    TRUE,
    &t_ThreadToken
  ) ;

    if ( t_Status )
    {
    SECURITY_IMPERSONATION_LEVEL t_Level = SecurityAnonymous ;
    DWORD t_Returned = 0 ;

    t_Status = GetTokenInformation (

      t_ThreadToken ,
      TokenImpersonationLevel ,
      & t_Level ,
      sizeof ( SECURITY_IMPERSONATION_LEVEL ) ,
      & t_Returned
    ) ;

    CloseHandle ( t_ThreadToken ) ;

    if ( t_Status == FALSE )
    {
      t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;
    }
    else
    {
      switch ( t_Level )
      {
        case SecurityAnonymous:
        {
          t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;
        }
        break ;

        case SecurityIdentification:
        {
          t_ImpersonationLevel = RPC_C_IMP_LEVEL_IDENTIFY ;
        }
        break ;

        case SecurityImpersonation:
        {
          t_ImpersonationLevel = RPC_C_IMP_LEVEL_IMPERSONATE ;
        }
        break ;

        case SecurityDelegation:
        {
          t_ImpersonationLevel = RPC_C_IMP_LEVEL_DELEGATE ;
        }
        break ;

        default:
        {
          t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;
        }
        break ;
      }
    }
  }
  else
  {
        ULONG t_LastError = GetLastError () ;

        if ( t_LastError == ERROR_NO_IMPERSONATION_TOKEN || t_LastError == ERROR_NO_TOKEN )
        {
            t_ImpersonationLevel = RPC_C_IMP_LEVEL_DELEGATE ;
        }
        else
    {
      if ( t_LastError == ERROR_CANT_OPEN_ANONYMOUS )
      {
        t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;
      }
      else
      {
        t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;
      }
    }
    }

  return t_ImpersonationLevel ;
}

Generated on Wed Nov 13 2024 16:53:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/MethCli/MethCli.Cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • MethCli
Functions | Variables

MethCli.Cpp File Reference

#include <objbase.h>
#include <windows.h>
#include <stdio.h>
#include <wbemidl.h>

Go to the source code of this file.

Functions

int | main (int iArgCnt, char **argv)

Variables

BOOL | g_bInProc = FALSE

Function Documentation

int main | ( | int | iArgCnt,
 |  | char ** | argv
 | ) |  |

Definition at line 32 of file MethCli.Cpp.

{
    IWbemLocator *pLocator = NULL;
    IWbemServices *pNamespace = 0;
    IWbemClassObject * pClass = NULL;
    IWbemClassObject * pOutInst = NULL;
    IWbemClassObject * pInClass = NULL;
    IWbemClassObject * pInInst = NULL;
  BSTR Text = NULL;
  HRESULT hr = S_OK;

    BSTR path = SysAllocString(L"root\\default");
    BSTR ClassPath = SysAllocString(L"MethProvSamp");
    BSTR MethodName = SysAllocString(L"Echo");
    BSTR ArgName = SysAllocString(L"sInArg");

  if (!path || ! ClassPath || !MethodName || ! ArgName)
  {
    printf("SysAllocString failed. Out of memory.\n");
    goto cleanup;
  }

    // Initialize COM and connect up to CIMOM

    hr = CoInitialize(0);
  if (FAILED(hr))
  {
      printf("CoInitialize returned 0x%x:", hr);
    goto cleanup;
  }

  //  NOTE:
  //  When using asynchronous WMI API's remotely in an environment where the "Local System" account
  //  has no network identity (such as non-Kerberos domains), the authentication level of
  //  RPC_C_AUTHN_LEVEL_NONE is needed. However, lowering the authentication level to
  //  RPC_C_AUTHN_LEVEL_NONE makes your application less secure. It is wise to
  //  use semi-synchronous API's for accessing WMI data and events instead of the asynchronous ones.

    hr = CoInitializeSecurity ( NULL, -1, NULL, NULL,
          RPC_C_AUTHN_LEVEL_PKT_PRIVACY,
          RPC_C_IMP_LEVEL_IMPERSONATE,
          NULL,
          EOAC_SECURE_REFS, //change to EOAC_NONE if you change dwAuthnLevel to RPC_C_AUTHN_LEVEL_NONE
          NULL );
  if (FAILED(hr))
  {
      printf("CoInitializeSecurity returned 0x%x:", hr);
    goto cleanup;
  }

    hr = CoCreateInstance(CLSID_WbemLocator, 0, CLSCTX_INPROC_SERVER,
            IID_IWbemLocator, (LPVOID *) &pLocator);
  if (FAILED(hr))
  {
      printf("CoCreateInstance returned 0x%x:", hr);
    goto cleanup;
  }
    hr = pLocator->ConnectServer(path, NULL, NULL, NULL, 0, NULL, NULL, &pNamespace);
    printf("\n\nConnectServer returned 0x%x:", hr);
    if(hr != WBEM_S_NO_ERROR)
    goto cleanup;

    // Get the class object

    hr = pNamespace->GetObject(ClassPath, 0, NULL, &pClass, NULL);
    printf("\nGetObject returned 0x%x:", hr);
    if(hr != WBEM_S_NO_ERROR)
    goto cleanup;

    // Get the input argument and set the property

    hr = pClass->GetMethod(MethodName, 0, &pInClass, NULL);
    printf("\nGetMethod returned 0x%x:", hr);
    if(hr != WBEM_S_NO_ERROR)
    goto cleanup;

    hr = pInClass->SpawnInstance(0, &pInInst);
    printf("\nSpawnInstance returned 0x%x:", hr);
    if(hr != WBEM_S_NO_ERROR)
    goto cleanup;

    VARIANT var;
    var.vt = VT_BSTR;
    var.bstrVal= SysAllocString(L"hello");
    if (var.bstrVal == NULL)
    goto cleanup;
    hr = pInInst->Put(ArgName, 0, &var, 0);
    VariantClear(&var);

    // Call the method

    hr = pNamespace->ExecMethod(ClassPath, MethodName, 0, NULL, pInInst, &pOutInst, NULL);
    printf("\nExecMethod returned 0x%x:", hr);
    if(hr != WBEM_S_NO_ERROR)
    goto cleanup;

    // Display the results.

    hr = pOutInst->GetObjectText(0, &Text);
  if(hr != WBEM_S_NO_ERROR)
    goto cleanup;
    printf("\n\nThe object text of the output object is:\n%S", Text);

  printf("Terminating normally\n");

  // Free up resources
cleanup:

    SysFreeString(path);
    SysFreeString(ClassPath);
    SysFreeString(MethodName);
    SysFreeString(ArgName);
    SysFreeString(Text);

  if (pClass)
    pClass->Release();
  if (pInInst)
    pInInst->Release();
  if (pInClass)
    pInClass->Release();
  if (pOutInst)
    pOutInst->Release();
  if (pLocator)
    pLocator->Release();
  if (pNamespace)
    pNamespace->Release();
    CoUninitialize();
    return 0;
}

Variable Documentation

BOOL g_bInProc = FALSE

Definition at line 30 of file MethCli.Cpp.

Generated on Wed Nov 13 2024 16:54:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/MethProv/ClassFac.Cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • MethProv
Functions

ClassFac.Cpp File Reference

#include <objbase.h>
#include "methprov.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CProvFactory

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 79 of file ClassFac.Cpp.

{
    ULONG nNewCount = InterlockedDecrement((long *)&m_cRef);
    if (0L == nNewCount)
        delete this;

    return nNewCount;
}

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/MethProv/MainDll.Cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • MethProv
Functions | Variables

MainDll.Cpp File Reference

#include <objbase.h>
#include <initguid.h>
#include <strsafe.h>
#include "methprov.h"

Go to the source code of this file.

Functions

DEFINE_GUID (CLSID_methodprovider, 0xe30ec6a0, 0x23cf, 0x11d1, 0x8f, 0xde, 0x0, 0x0, 0xf8, 0x4, 0xaa, 0x5c)
STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, PPVOID ppv)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)
BOOL | Is4OrMore (void)
BOOL WINAPI | LibMain32 (HINSTANCE hInstance, ULONG ulReason, LPVOID pvReserved)

Variables

long | g_cLock = 0
long | g_cObj = 0
HMODULE | ghModule

Function Documentation

DEFINE_GUID | ( | CLSID_methodprovider | ,
 |  | 0xe30ec6a0 | ,
 |  | 0x23cf | ,
 |  | 0x11d1 | ,
 |  | 0x8f | ,
 |  | 0xde | ,
 |  | 0x0 | ,
 |  | 0x0 | ,
 |  | 0xf8 | ,
 |  | 0x4 | ,
 |  | 0xaa | ,
 |  | 0x5c |
 | ) |  |
STDAPI DllCanUnloadNow ( void )

Definition at line 118 of file MainDll.Cpp.

{
    SCODE   sc;

    //It is OK to unload if there are no objects or locks on the
    // class factory.

    sc=(0L==g_cObj && 0L==g_cLock) ? S_OK : S_FALSE;
    return sc;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | PPVOID | ppv
 | ) |  |

Definition at line 85 of file MainDll.Cpp.

{
    HRESULT hr;
    CProvFactory *pObj;

    if (CLSID_methodprovider!=rclsid)
        return E_FAIL;

    pObj=new CProvFactory();

    if (NULL==pObj)
        return E_OUTOFMEMORY;

    hr=pObj->QueryInterface(riid, ppv);

    if (FAILED(hr))
        delete pObj;

    return hr;
}

STDAPI DllRegisterServer ( void )

Definition at line 155 of file MainDll.Cpp.

{
    char       szID[128];
    WCHAR      wcID[128];
    char       szCLSID[128];
    TCHAR      szModule[MAX_PATH + 1];
    char * pName = "WMI Method Provider Test";
    char * pModel;
    HKEY hKey1, hKey2;

    // Normally we want to use "Both" as the threading model since
    // the DLL is free threaded, but NT 3.51 Ole doesnt work unless
    // the model is "Aparment"

    if(Is4OrMore())
        pModel = "Both";
    else
        pModel = "Apartment";

  // Create the path.

  memset(wcID, NULL, sizeof(wcID));
  memset(szID, NULL, sizeof(szID));

    StringFromGUID2(CLSID_methodprovider, wcID, sizeof(wcID)/sizeof(WCHAR) - 1);
    wcstombs(szID, wcID,  sizeof(szID));
  StringCbCopy(szCLSID, sizeof(szCLSID), "Software\\classes\\CLSID\\");
  StringCbCat(szCLSID, sizeof(szCLSID), (LPCTSTR)szID);

    // Create entries under CLSID

  LONG lRet = RegCreateKeyEx( HKEY_LOCAL_MACHINE, szCLSID, 0, NULL,
                    REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL,
                    &hKey1, NULL );
  if (lRet != ERROR_SUCCESS)
  {
    return E_FAIL;
  }

    lRet = RegSetValueEx(hKey1, NULL, 0, REG_SZ, (BYTE *)pName, strlen(pName)+1);
  if (lRet != ERROR_SUCCESS)
  {
    RegCloseKey(hKey1);
    return E_FAIL;
  }

  lRet = RegCreateKeyEx( hKey1, "InprocServer32", 0, NULL,
                    REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL,
                    &hKey2, NULL );
  if (lRet != ERROR_SUCCESS)
  {
    RegCloseKey(hKey1);
    return E_FAIL;
  }

  memset(&szModule, NULL, sizeof(szModule));
    GetModuleFileName(ghModule, szModule,  sizeof(szModule)/sizeof(TCHAR) - 1);
    lRet = RegSetValueEx(hKey2, NULL, 0, REG_SZ, (BYTE *)szModule,
                                        strlen(szModule)+1);
  if (lRet != ERROR_SUCCESS)
  {
      RegCloseKey(hKey2);
    RegCloseKey(hKey1);
    return E_FAIL;
  }
    lRet = RegSetValueEx(hKey2, "ThreadingModel", 0, REG_SZ,
                                        (BYTE *)pModel, strlen(pModel)+1);
  if (lRet != ERROR_SUCCESS)
  {
      RegCloseKey(hKey2);
    RegCloseKey(hKey1);
    return E_FAIL;
  }
    RegCloseKey(hKey1);
    RegCloseKey(hKey2);

    return NOERROR;

}

STDAPI DllUnregisterServer ( void )

Definition at line 245 of file MainDll.Cpp.

{
  char       szID[128];
    WCHAR      wcID[128];
    char  szCLSID[128];
    HKEY hKey;

    // Create the path using the CLSID
  memset(wcID, NULL, sizeof(wcID));
  memset(szID, NULL, sizeof(szID));
    StringFromGUID2(CLSID_methodprovider, wcID, sizeof(wcID)/sizeof(WCHAR));

    wcstombs(szID, wcID, sizeof(szID));

  StringCbCopy(szCLSID, sizeof(szCLSID), "Software\\classes\\CLSID\\");
  StringCbCat(szCLSID, sizeof(szCLSID), (LPCTSTR)szID);

     // First delete the InProcServer subkey.

    DWORD dwRet = RegOpenKeyEx(HKEY_LOCAL_MACHINE, szCLSID, 0, KEY_WRITE, &hKey);
    if(dwRet == NO_ERROR)
    {
        RegDeleteKey(hKey, "InProcServer32");
        RegCloseKey(hKey);
    }

    dwRet = RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\CLASSES\\CLSID\\"), 0, KEY_WRITE, &hKey);
    if(dwRet == NO_ERROR)
    {
        RegDeleteKey(hKey,szID);
        RegCloseKey(hKey);
    }

    return NOERROR;

}

BOOL Is4OrMore ( void )

Definition at line 137 of file MainDll.Cpp.

{
    OSVERSIONINFO os;
    os.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
    if(!GetVersionEx(&os))
        return FALSE;           // should never happen
    return os.dwMajorVersion >= 4;
}

BOOL WINAPI LibMain32 | ( | HINSTANCE | hInstance,
 |  | ULONG | ulReason,
 |  | LPVOID | pvReserved
 | ) |  |

Definition at line 58 of file MainDll.Cpp.

{
    if (DLL_PROCESS_DETACH==ulReason)
    {
        return TRUE;
    }
    else
    {
        if (DLL_PROCESS_ATTACH!=ulReason)
            return TRUE;
    }

    ghModule = hInstance;
    return TRUE;
}

Variable Documentation

long g_cLock = 0

Definition at line 45 of file MainDll.Cpp.

long g_cObj = 0

Definition at line 44 of file MainDll.Cpp.

HMODULE ghModule

Definition at line 33 of file MainDll.Cpp.

Generated on Wed Nov 13 2024 16:54:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/MethProv/MethProv.Cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • MethProv
Defines | Functions

MethProv.Cpp File Reference

#include <objbase.h>
#include "methprov.h"
#include <process.h>
#include <wbemidl.h>
#include <stdio.h>

Go to the source code of this file.

Defines

#define _WIN32_DCOM

Functions

DWORD GetCurrentImpersonationLevel ()
STDMETHODIMP_ (ULONG) CMethodPro

Define Documentation

#define _WIN32_DCOM

Definition at line 23 of file MethProv.Cpp.

Function Documentation

DWORD GetCurrentImpersonationLevel ( )

Definition at line 289 of file MethProv.Cpp.

{
  DWORD t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;

    HANDLE t_ThreadToken = NULL ;

    BOOL t_Status = OpenThreadToken (

    GetCurrentThread() ,
    TOKEN_QUERY,
    TRUE,
    &t_ThreadToken
  ) ;

    if ( t_Status )
    {
    SECURITY_IMPERSONATION_LEVEL t_Level = SecurityAnonymous ;
    DWORD t_Returned = 0 ;

    t_Status = GetTokenInformation (

      t_ThreadToken ,
      TokenImpersonationLevel ,
      & t_Level ,
      sizeof ( SECURITY_IMPERSONATION_LEVEL ) ,
      & t_Returned
    ) ;

    CloseHandle ( t_ThreadToken ) ;

    if ( t_Status == FALSE )
    {
      t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;
    }
    else
    {
      switch ( t_Level )
      {
        case SecurityAnonymous:
        {
          t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;
        }
        break ;

        case SecurityIdentification:
        {
          t_ImpersonationLevel = RPC_C_IMP_LEVEL_IDENTIFY ;
        }
        break ;

        case SecurityImpersonation:
        {
          t_ImpersonationLevel = RPC_C_IMP_LEVEL_IMPERSONATE ;
        }
        break ;

        case SecurityDelegation:
        {
          t_ImpersonationLevel = RPC_C_IMP_LEVEL_DELEGATE ;
        }
        break ;

        default:
        {
          t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;
        }
        break ;
      }
    }
  }
  else
  {
        ULONG t_LastError = GetLastError () ;

        if ( t_LastError == ERROR_NO_IMPERSONATION_TOKEN || t_LastError == ERROR_NO_TOKEN )
        {
            t_ImpersonationLevel = RPC_C_IMP_LEVEL_DELEGATE ;
        }
        else
    {
      if ( t_LastError == ERROR_CANT_OPEN_ANONYMOUS )
      {
        t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;
      }
      else
      {
        t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;
      }
    }
    }

  return t_ImpersonationLevel ;
}

STDMETHODIMP_ ( ULONG )

Definition at line 90 of file MethProv.Cpp.

{
    ULONG nNewCount = InterlockedDecrement((long *)&m_cRef);
    if (0L == nNewCount)
        delete this;

    return nNewCount;
}

Generated on Wed Nov 13 2024 16:54:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/MethProv/MethProv.h File Reference

  • SysMgmt
  • WMI
  • VC
  • MethProv
Classes | Typedefs | Functions | Variables

MethProv.h File Reference

#include "wbemidl.h"

Go to the source code of this file.

Classes

class | CMethodPro
class | CProvFactory

Typedefs

typedef CMethodPro * | PCMethodPro
typedef CProvFactory * | PCProvFactory
typedef LPVOID * | PPVOID

Functions

DWORD GetCurrentImpersonationLevel ()

Variables

long | g_cLock
long | g_cObj

Typedef Documentation

typedef CMethodPro* PCMethodPro

Definition at line 231 of file MethProv.h.

typedef CProvFactory* PCProvFactory

Definition at line 255 of file MethProv.h.

typedef LPVOID* PPVOID

Definition at line 26 of file MethProv.h.

Function Documentation

DWORD GetCurrentImpersonationLevel ( )

Definition at line 465 of file Service.cpp.

{
  DWORD t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;

    HANDLE t_ThreadToken = NULL ;

    BOOL t_Status = OpenThreadToken (

    GetCurrentThread() ,
    TOKEN_QUERY,
    TRUE,
    &t_ThreadToken
  ) ;

    if ( t_Status )
    {
    SECURITY_IMPERSONATION_LEVEL t_Level = SecurityAnonymous ;
    DWORD t_Returned = 0 ;

    t_Status = GetTokenInformation (

      t_ThreadToken ,
      TokenImpersonationLevel ,
      & t_Level ,
      sizeof ( SECURITY_IMPERSONATION_LEVEL ) ,
      & t_Returned
    ) ;

    CloseHandle ( t_ThreadToken ) ;

    if ( t_Status == FALSE )
    {
      t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;
    }
    else
    {
      switch ( t_Level )
      {
        case SecurityAnonymous:
        {
          t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;
        }
        break ;

        case SecurityIdentification:
        {
          t_ImpersonationLevel = RPC_C_IMP_LEVEL_IDENTIFY ;
        }
        break ;

        case SecurityImpersonation:
        {
          t_ImpersonationLevel = RPC_C_IMP_LEVEL_IMPERSONATE ;
        }
        break ;

        case SecurityDelegation:
        {
          t_ImpersonationLevel = RPC_C_IMP_LEVEL_DELEGATE ;
        }
        break ;

        default:
        {
          t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;
        }
        break ;
      }
    }
  }
  else
  {
        ULONG t_LastError = GetLastError () ;

        if ( t_LastError == ERROR_NO_IMPERSONATION_TOKEN || t_LastError == ERROR_NO_TOKEN )
        {
            t_ImpersonationLevel = RPC_C_IMP_LEVEL_DELEGATE ;
        }
        else
    {
      if ( t_LastError == ERROR_CANT_OPEN_ANONYMOUS )
      {
        t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;
      }
      else
      {
        t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;
      }
    }
    }

  return t_ImpersonationLevel ;
}

Variable Documentation

long g_cLock

Definition at line 27 of file myclassfactory.cpp.

long g_cObj

Definition at line 26 of file myclassfactory.cpp.

Generated on Wed Nov 13 2024 16:54:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/pathparser/PathParser.cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • pathparser
Functions

PathParser.cpp File Reference

#include <objbase.h>
#include <windows.h>
#include <stdio.h>
#include <wbemidl.h>
#include <wmiutils.h>

Go to the source code of this file.

Functions

void | DumpClassName (IWbemPath *pParser)
void | DumpKeyList (IWbemPath *pParser)
void | DumpNamespaces (IWbemPath *pParser)
void | DumpServerName (IWbemPath *pParser)
int | main (int iArgCnt, char **argv)
void | ParseAndDump (IWbemPath *pParser, WCHAR *pwcPath)

Function Documentation

void DumpClassName ( IWbemPath * pParser )

Definition at line 116 of file PathParser.cpp.

{
    HRESULT hr;

    // One could safely assume a maximum class name, but for the sake of example,
    // the code will call GetClassName in order to determine how long of name is needed, then
    // do the allocation, then get the name and finally dump it.

    DWORD dwSize = 0;
    hr = pParser->GetClassName(&dwSize, NULL);
    if(FAILED(hr) || dwSize == 0)
        return;                                 // nothing here, just return

    WCHAR * pClassName = new WCHAR[dwSize];
    if(pClassName)
    {
        hr = pParser->GetClassName(&dwSize,  pClassName);
        if(FAILED(hr))
            printf("\nUnexpected failure, hr = 0x%x", hr);
        else
            printf("\nThe class name is <%S>", pClassName);
        delete [] pClassName;
    }
}

void DumpKeyList ( IWbemPath * pParser )

Definition at line 149 of file PathParser.cpp.

{

    HRESULT hr;
    IWbemPathKeyList * pKeyList = NULL;
    hr = pParser->GetKeyList(&pKeyList);
    if(FAILED(hr) || pKeyList == NULL)
    {
        printf("\nNULL KEY LIST *****************");
        return;
    }

    unsigned long uNumKey;
    hr = pKeyList->GetCount(&uNumKey);
    if(FAILED(hr))
    {
        printf("\nGetCount failed, hr = 0x%x", hr);
        return;
    }
    printf("\nThe key count is %d", uNumKey);

    // check for the special case of a singleton.  In this case, the path does not have a named key and the
    // value is "@"

    if(uNumKey == 0)
    {
        ULONGLONG uResponse;
        hr = pKeyList->GetInfo(0, &uResponse);
        if(SUCCEEDED(hr) && (uResponse & WBEMPATH_INFO_CONTAINS_SINGLETON))
        {
            printf("\nPath is a singleton");
            return;
        }
    }

    // for the sake of clarity, this example assumes a maximum name size of 256.  Normally, an application would
    // take one of two approaches;  First, it could just allocate a buffer the size of the text used in the SetText
    // call and assume that is sufficient for the largest piece.  Second, it can call GetKey2 will a NULL pointer
    // to the name buffer and find out how large it needs to be, as is done in the DumpClassName and
    // DumpServer routines.

     WCHAR wName[256];
     for(DWORD uKeyIx = 0; uKeyIx < uNumKey ; uKeyIx++)
     {
        ULONG uKeyType;
        DWORD dwSize = 256;

        VARIANT var, var2;
        VariantInit(&var);
        VariantInit(&var2);
        hr = pKeyList->GetKey2(uKeyIx, 0, &dwSize, wName, &var, &uKeyType);
        if(FAILED(hr))
        {
            printf("\nGetKey2 failed, index = %d, hr = 0x%x", uKeyIx, hr);
        }
        else
        {
            // here we use Variant change type as a convenient string conversion routine.

            hr = VariantChangeType(&var2, &var, 0, VT_BSTR);
            if(SUCCEEDED(hr))
            {
                printf("\nKey %d, has name <%S>, type %d, value <%S>", uKeyIx, wName, uKeyType, var2.bstrVal);
                VariantClear(&var2);
            }
            else
                printf("\nVariantChangeType failed, hr = 0x%x", hr);
        VariantClear(&var);
        }
     }
}

void DumpNamespaces ( IWbemPath * pParser )

Definition at line 64 of file PathParser.cpp.

{
    HRESULT hr;

    // first get the number of namespaces

    ULONG lCnt;
    hr  = pParser->GetNamespaceCount(&lCnt);
    if(FAILED(hr))
    {
        printf("\nGetNamespaceCount failed, hr = 0x%x", hr);
        return;
    }

    for(ULONG dwCnt = 0; dwCnt < lCnt; dwCnt++)
    {
        if(dwCnt == 0)
            printf("\nNamespaces=");
        else
            printf(",");

        // first determine the necessary buffer size

        DWORD dwSize = 0;
        hr = pParser->GetNamespaceAt(dwCnt, &dwSize, NULL);
        if(FAILED(hr) || dwSize == 0)
        {
            printf("\nGetNamespaceAt failed, hr = 0x%x", hr);
            return;
        }

        WCHAR * pNamespace = new WCHAR[dwSize];
        if(pNamespace)
        {
            hr = pParser->GetNamespaceAt(dwCnt, &dwSize,  pNamespace);
            if(FAILED(hr))
                printf("\nGetNamespaceAt failed for index %d, sc = 0x%x", dwCnt, hr);
            else
                printf("%S", pNamespace);
            delete [] pNamespace;
        }
    }
}

void DumpServerName ( IWbemPath * pParser )

Definition at line 31 of file PathParser.cpp.

{
    HRESULT hr;

    // One could safely assume a maximum server name, but for the sake of example,
    // the code will call GetServer in order to determine how long of name is needed, then
    // do the allocation, then get the name and finally dump it.

    DWORD dwSize = 0;
    hr = pParser->GetServer(&dwSize, NULL);
    if(FAILED(hr) || dwSize == 0)
        return;                                 // nothing here, just return

    WCHAR * pServer = new WCHAR[dwSize];
    if(pServer)
    {
        hr = pParser->GetServer(&dwSize,  pServer);
        if(FAILED(hr))
            printf("\nUnexpected failure, hr = 0x%x", hr);
        else
            printf("\nThe server name is <%S>", pServer);
        delete [] pServer;
    }
}

int main | ( | int | iArgCnt,
 |  | char ** | argv
 | ) |  |

Definition at line 254 of file PathParser.cpp.

{

    // First argument is the is the path.  If not present, dump out a usage message.

    if(iArgCnt < 2)
    {
        printf("\nUsage:  PathParser <PathToBeParsed>"
                 "\nExample:  PathParser \\\\MyServer\\root\\default:stdregprov=@"
                 "\nor        PathParser \\\\MyServer\\root\\default:stdregprov.key=\\\"hello\\\""
                 "\nor        PathParser \\\\MyServer\\root\\default:stdregprov.key=23"
                 );
        return 1;
    }

    // Convert to unicode

    int iLen = (int)strlen(argv[1]);
    WCHAR * pwcPath = new WCHAR[iLen+1];
    if(pwcPath == NULL)
    {
        printf("\nFailed due to lack of memory");
        return 1;
    }
    mbstowcs(pwcPath, argv[1], iLen + 1);

    // Initialize COM and create the path parser object

    HRESULT hr = CoInitializeEx(0, COINIT_MULTITHREADED);
    if(SUCCEEDED(hr))
    {
        IWbemPath *pParser = NULL;
        hr = CoCreateInstance(CLSID_WbemDefPath, 0, CLSCTX_INPROC_SERVER,
                                                                     IID_IWbemPath, (LPVOID *) &pParser);
        if(SUCCEEDED(hr))
        {
            ParseAndDump(pParser, pwcPath);
            pParser->Release();
        }
        else
            printf("\nCoCreateInstance of CLSID_WbemDefPath, return is 0x%x", hr);
        CoUninitialize();
    }
    delete [] pwcPath;
    printf("\nTerminating normally");
    return 0;
}

void ParseAndDump | ( | IWbemPath * | pParser,
 |  | WCHAR * | pwcPath
 | ) |  |

Definition at line 229 of file PathParser.cpp.

{
    HRESULT hr;
    printf("\nAttempting to parse string <%S>", pwcPath);
    hr = pParser->SetText(WBEMPATH_CREATE_ACCEPT_ALL, pwcPath);
    if(FAILED(hr))
    {
        printf("\nParse failed, return code is 0x%x", hr);
        return;
    }
    DumpServerName(pParser);
    DumpNamespaces(pParser);
    DumpClassName(pParser);
    DumpKeyList(pParser);
}

Generated on Wed Nov 13 2024 16:54:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/PropProv/ClassFac.Cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • PropProv
Functions

ClassFac.Cpp File Reference

#include <objbase.h>
#include "sample.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) CProvFactory

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 79 of file ClassFac.Cpp.

{
    ULONG nNewCount = InterlockedDecrement((long *)&m_cRef);
    if (0L == nNewCount)
        delete this;

    return nNewCount;
}

Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/PropProv/MainDll.Cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • PropProv
Functions | Variables

MainDll.Cpp File Reference

#include <objbase.h>
#include <initguid.h>
#include "sample.h"
#include <strsafe.h>

Go to the source code of this file.

Functions

DEFINE_GUID (CLSID_PropProvider, 0xCEDEB622L, 0x8C78, 0x11CF, 0xA5, 0xB6, 0x00, 0xAA, 0x00, 0x68, 0x0C, 0x3F)
STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, PPVOID ppv)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)
BOOL WINAPI | LibMain32 (HINSTANCE hInstance, ULONG ulReason, LPVOID pvReserved)

Variables

long | g_cLock = 0
long | g_cObj = 0
HMODULE | ghModule

Function Documentation

DEFINE_GUID | ( | CLSID_PropProvider | ,
 |  | 0xCEDEB622L | ,
 |  | 0x8C78 | ,
 |  | 0x11CF | ,
 |  | 0xA5 | ,
 |  | 0xB6 | ,
 |  | 0x00 | ,
 |  | 0xAA | ,
 |  | 0x00 | ,
 |  | 0x68 | ,
 |  | 0x0C | ,
 |  | 0x3F |
 | ) |  |
STDAPI DllCanUnloadNow ( void )

Definition at line 109 of file MainDll.Cpp.

{
    SCODE   sc;

    //It is OK to unload if there are no objects or locks on the
    // class factory.

    sc=( g_cObj < 1 && g_cLock < 1) ? S_OK : S_FALSE;
    return sc;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | PPVOID | ppv
 | ) |  |

Definition at line 75 of file MainDll.Cpp.

{
    HRESULT hr;
    CProvFactory *pObj;

    if (CLSID_PropProvider!=rclsid)
        return E_FAIL;

    pObj=new CProvFactory();

    if (NULL==pObj)
        return E_OUTOFMEMORY;

    hr=pObj->QueryInterface(riid, ppv);

    if (FAILED(hr))
        delete pObj;

    return hr;
}

STDAPI DllRegisterServer ( void )

Definition at line 131 of file MainDll.Cpp.

{
    char       szID[128];
    WCHAR      wcID[128];
    char       szCLSID[128];
    TCHAR       szModule[MAX_PATH+ 1];
    char * pName = "WMI Sample Prop Provider";
    char * pModel = "Both";
    HKEY hKey1, hKey2;

   // Create the path.

  memset(wcID, NULL, sizeof(wcID));
  memset(szID, NULL, sizeof(szID));

    StringFromGUID2(CLSID_PropProvider, wcID, sizeof(wcID)/sizeof(WCHAR) - 1);
    wcstombs(szID, wcID,  sizeof(szID));
  StringCbCopy(szCLSID, sizeof(szCLSID), "Software\\classes\\CLSID\\");
  StringCbCat(szCLSID, sizeof(szCLSID), (LPCTSTR)szID);

    // Create entries under CLSID

  LONG lRet = RegCreateKeyEx( HKEY_LOCAL_MACHINE, szCLSID, 0, NULL,
                    REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL,
                    &hKey1, NULL );
  if (lRet != ERROR_SUCCESS)
  {
    return E_FAIL;
  }

    lRet = RegSetValueEx(hKey1, NULL, 0, REG_SZ, (BYTE *)pName, strlen(pName)+1);
  if (lRet != ERROR_SUCCESS)
  {
    RegCloseKey(hKey1);
    return E_FAIL;
  }

  lRet = RegCreateKeyEx( hKey1, "InprocServer32", 0, NULL,
                    REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL,
                    &hKey2, NULL );
  if (lRet != ERROR_SUCCESS)
  {
    RegCloseKey(hKey1);
    return E_FAIL;
  }

  memset(&szModule, NULL, sizeof(szModule));
    GetModuleFileName(ghModule, szModule,  sizeof(szModule)/sizeof(TCHAR) - 1);
    lRet = RegSetValueEx(hKey2, NULL, 0, REG_SZ, (BYTE *)szModule,
                                        strlen(szModule)+1);
  if (lRet != ERROR_SUCCESS)
  {
      RegCloseKey(hKey2);
    RegCloseKey(hKey1);
    return E_FAIL;
  }
    lRet = RegSetValueEx(hKey2, "ThreadingModel", 0, REG_SZ,
                                        (BYTE *)pModel, strlen(pModel)+1);
  if (lRet != ERROR_SUCCESS)
  {
      RegCloseKey(hKey2);
    RegCloseKey(hKey1);
    return E_FAIL;
  }
    RegCloseKey(hKey1);
    RegCloseKey(hKey2);

    return NOERROR;

}

STDAPI DllUnregisterServer ( void )

Definition at line 213 of file MainDll.Cpp.

{
  char       szID[128];
    WCHAR      wcID[128];
    char  szCLSID[128];
    HKEY hKey;

    // Create the path using the CLSID
  memset(wcID, NULL, sizeof(wcID));
  memset(szID, NULL, sizeof(szID));
    StringFromGUID2(CLSID_PropProvider, wcID, sizeof(wcID)/sizeof(WCHAR));

    wcstombs(szID, wcID, sizeof(szID));

  StringCbCopy(szCLSID, sizeof(szCLSID), "Software\\classes\\CLSID\\");
  StringCbCat(szCLSID, sizeof(szCLSID), (LPCTSTR)szID);

     // First delete the InProcServer subkey.

    DWORD dwRet = RegOpenKeyEx(HKEY_LOCAL_MACHINE, szCLSID, 0, KEY_WRITE, &hKey);
    if(dwRet == NO_ERROR)
    {
        RegDeleteKey(hKey, "InProcServer32");
        RegCloseKey(hKey);
    }

    dwRet = RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\CLASSES\\CLSID\\"), 0, KEY_WRITE, &hKey);
    if(dwRet == NO_ERROR)
    {
        RegDeleteKey(hKey,szID);
        RegCloseKey(hKey);
    }

    return NOERROR;
}

BOOL WINAPI LibMain32 | ( | HINSTANCE | hInstance,
 |  | ULONG | ulReason,
 |  | LPVOID | pvReserved
 | ) |  |

Definition at line 56 of file MainDll.Cpp.

{

    if (DLL_PROCESS_ATTACH==ulReason)
        ghModule = hInstance;
    return TRUE;
}

Variable Documentation

long g_cLock = 0

Definition at line 43 of file MainDll.Cpp.

long g_cObj = 0

Definition at line 42 of file MainDll.Cpp.

HMODULE ghModule

Definition at line 32 of file MainDll.Cpp.

Generated on Wed Nov 13 2024 16:54:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/PropProv/PropProv.Cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • PropProv
Defines | Functions

PropProv.Cpp File Reference

#include <objbase.h>
#include "sample.h"

Go to the source code of this file.

Defines

#define _WIN32_WINNT 0x0500

Functions

DWORD GetCurrentImpersonationLevel ()
STDMETHODIMP_ (ULONG) CPropPro

Define Documentation

#define _WIN32_WINNT 0x0500

Definition at line 22 of file PropProv.Cpp.

Function Documentation

DWORD GetCurrentImpersonationLevel ( )

Definition at line 35 of file PropProv.Cpp.

{
  DWORD t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;

    HANDLE t_ThreadToken = NULL ;

    BOOL t_Status = OpenThreadToken (

    GetCurrentThread() ,
    TOKEN_QUERY,
    TRUE,
    &t_ThreadToken
  ) ;

    if ( t_Status )
    {
    SECURITY_IMPERSONATION_LEVEL t_Level = SecurityAnonymous ;
    DWORD t_Returned = 0 ;

    t_Status = GetTokenInformation (

      t_ThreadToken ,
      TokenImpersonationLevel ,
      & t_Level ,
      sizeof ( SECURITY_IMPERSONATION_LEVEL ) ,
      & t_Returned
    ) ;

    CloseHandle ( t_ThreadToken ) ;

    if ( t_Status == FALSE )
    {
      t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;
    }
    else
    {
      switch ( t_Level )
      {
        case SecurityAnonymous:
        {
          t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;
        }
        break ;

        case SecurityIdentification:
        {
          t_ImpersonationLevel = RPC_C_IMP_LEVEL_IDENTIFY ;
        }
        break ;

        case SecurityImpersonation:
        {
          t_ImpersonationLevel = RPC_C_IMP_LEVEL_IMPERSONATE ;
        }
        break ;

        case SecurityDelegation:
        {
          t_ImpersonationLevel = RPC_C_IMP_LEVEL_DELEGATE ;
        }
        break ;

        default:
        {
          t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;
        }
        break ;
      }
    }
  }
  else
  {
        ULONG t_LastError = GetLastError () ;

        if ( t_LastError == ERROR_NO_IMPERSONATION_TOKEN || t_LastError == ERROR_NO_TOKEN )
        {
            t_ImpersonationLevel = RPC_C_IMP_LEVEL_DELEGATE ;
        }
        else
    {
      if ( t_LastError == ERROR_CANT_OPEN_ANONYMOUS )
      {
        t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;
      }
      else
      {
        t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;
      }
    }
    }

  return t_ImpersonationLevel ;
}

STDMETHODIMP_ ( ULONG )

Definition at line 199 of file PropProv.Cpp.

{
    ULONG nNewCount = InterlockedDecrement((long *)&m_cRef);
    if (0L == nNewCount)
        delete this;

    return nNewCount;
}

Generated on Wed Nov 13 2024 16:54:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/PropProv/Sample.h File Reference

  • SysMgmt
  • WMI
  • VC
  • PropProv
Classes | Typedefs | Variables

Sample.h File Reference

#include <wbemcli.h>
#include <wbemprov.h>

Go to the source code of this file.

Classes

class | CPropPro
class | CProvFactory

Typedefs

typedef CProvFactory * | PCProvFactory
typedef LPVOID * | PPVOID

Variables

long | g_cLock
long | g_cObj

Typedef Documentation

typedef CProvFactory* PCProvFactory

Definition at line 88 of file Sample.h.

typedef LPVOID* PPVOID

Definition at line 27 of file Sample.h.

Variable Documentation

long g_cLock

Definition at line 27 of file myclassfactory.cpp.

long g_cObj

Definition at line 26 of file myclassfactory.cpp.

Generated on Wed Nov 13 2024 16:53:19 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/queryparser/QueryParser.cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • queryparser
Defines | Functions | Variables

QueryParser.cpp File Reference

#include <windows.h>
#include <stdio.h>
#include <wmiutils.h>
#include <strsafe.h>

Go to the source code of this file.

Defines

#define | _WIN32_WINNT 0x0400

Functions

void | DumpFeatureMasks (unsigned __int64 mask)
void | DumpFromClause (SWbemRpnEncodedQuery *pQuery)
void | DumpRpn (SWbemRpnEncodedQuery *pRpn)
void | DumpSelectList (ULONG uCount, SWbemQueryQualifiedName **pNames)
void | DumpSubexpression (SWbemRpnQueryToken *pTemp)
void | DumpWhereClause (ULONG uCount, SWbemRpnQueryToken **pWhere)
void | main (int argc, char *argv[])
void | TestQuery (IWbemQuery *pQuery)

Variables

LPWSTR | g_pQuery = 0

Define Documentation

#define _WIN32_WINNT 0x0400

Definition at line 18 of file QueryParser.cpp.

Function Documentation

void DumpFeatureMasks ( unsigned __int64 mask )

Definition at line 35 of file QueryParser.cpp.

{
    printf("Query Features:\n");

    if (mask & WMIQ_RPNF_WHERE_CLAUSE_PRESENT)
        printf("WMIQ_RPNF_WHERE_CLAUSE_PRESENT\n");

    if (mask & WMIQ_RPNF_QUERY_IS_CONJUNCTIVE)
        printf("WMIQ_RPNF_QUERY_IS_CONJUNCTIVE\n");

    if (mask & WMIQ_RPNF_QUERY_IS_DISJUNCTIVE)
        printf("WMIQ_RPNF_QUERY_IS_DISJUNCTIVE\n");

    if (mask & WMIQ_RPNF_PROJECTION)
        printf("WMIQ_RPNF_PROJECTION\n");

    if (mask & WMIQ_RPNF_FEATURE_SELECT_STAR)
        printf("WMIQ_RPNF_FEATURE_SELECT_STAR\n");

    if (mask & WMIQ_RPNF_EQUALITY_TESTS_ONLY)
        printf("WMIQ_RPNF_EQUALITY_TESTS_ONLY\n");

    if (mask & WMIQ_RPNF_COUNT_STAR)
        printf("WMIQ_RPNF_COUNT_STAR\n");

    if (mask & WMIQ_RPNF_PROP_TO_PROP_TESTS)
        printf("WMIQ_RPNF_PROP_TO_PROP_TESTS\n");

    if (mask & WMIQ_RPNF_ORDER_BY)
        printf("WMIQ_RPNF_ORDER_BY\n");

    if (mask & WMIQ_RPNF_ISA_USED)
        printf("WMIQ_RPNF_ISA_USED\n");

    if (mask & WMIQ_RPNF_GROUP_BY_HAVING)
        printf("WMIQ_RPNF_GROUP_BY_HAVING\n");

}

void DumpFromClause ( SWbemRpnEncodedQuery * pQuery )

Definition at line 282 of file QueryParser.cpp.

{
    printf("---FROM clause---\n");

    if (pQuery->m_uFromTargetType & WMIQ_RPN_FROM_PATH)
    {
        printf("  Selected from container/scope [%S]\n", pQuery->m_pszOptionalFromPath);
    }

    if (pQuery->m_uFromTargetType & WMIQ_RPN_FROM_UNARY)
    {
        printf("  Single class select = %S\n", pQuery->m_ppszFromList[0]);
    }
    else if (pQuery->m_uFromTargetType & WMIQ_RPN_FROM_CLASS_LIST)
    {
        for (unsigned u = 0; u < pQuery->m_uFromListSize; u++)
        {
            printf("  Selected class = %S\n", pQuery->m_ppszFromList[u]);
        }
    }
    else
    {
        printf("  No target classes selected; select ALL\n");
    }

    printf("---END FROM clause\n");
}

void DumpRpn ( SWbemRpnEncodedQuery * pRpn )

Definition at line 318 of file QueryParser.cpp.

{
    printf("------------RPN Encoded Query-----------------\n");
    printf("RPN Version = %d\n", pRpn->m_uVersion);
    printf("RPN Token Type = %d\n", pRpn->m_uTokenType);

    printf("Total detected features = %d  Feature Set = { ", pRpn->m_uDetectedArraySize);
    for (unsigned i = 0; i < pRpn->m_uDetectedArraySize; i++)
        printf("%d ", pRpn->m_puDetectedFeatures[i]);
    printf("}\n\n");

    DumpFeatureMasks(pRpn->m_uParsedFeatureMask);
    DumpSelectList(pRpn->m_uSelectListSize, pRpn->m_ppSelectList);
    DumpFromClause(pRpn);
    DumpWhereClause(pRpn->m_uWhereClauseSize, pRpn->m_ppRpnWhereClause);
}

void DumpSelectList | ( | ULONG | uCount,
 |  | SWbemQueryQualifiedName ** | pNames
 | ) |  |

Definition at line 82 of file QueryParser.cpp.

{
    unsigned u;

    printf("----BEGIN SELECT CLAUSE---\n");
    printf("Selected target columns/props = ");

    for (u = 0; u < uCount; u++)
    {
        SWbemQueryQualifiedName *p = pNames[u];

        // Print out current name.
        // Note that we support qualified names,
        // like p1.a,  p2.b, etc.
        // For simple cases, the m_uNameListSize is 1.
        // ===========================================

        for (unsigned u2 = 0; u2 < p->m_uNameListSize; u2++)
        {
            if (u2 > 0)
                printf(".");
            printf("%S", p->m_ppszNameList[u2]);
        }

        printf(", ");
    }

    printf("\n");
    printf("---END SELECT CLAUSE-----\n");
}

void DumpSubexpression ( SWbemRpnQueryToken * pTemp )

Definition at line 121 of file QueryParser.cpp.

{
    printf("---SUBEXPRESSION TOKEN---\n");

    if (pTemp->m_uSubexpressionShape & WMIQ_RPN_LEFT_PROPERTY_NAME)
    {
        printf("    WMIQ_RPN_LEFT_PROPERTY_NAME\n");
    }
    if (pTemp->m_uSubexpressionShape & WMIQ_RPN_RIGHT_PROPERTY_NAME)
    {
        printf("    WMIQ_RPN_RIGHT_PROPERTY_NAME\n");
    }
    if (pTemp->m_uSubexpressionShape & WMIQ_RPN_CONST2)
    {
        printf("    WMIQ_RPN_CONST2\n");
    }
    if (pTemp->m_uSubexpressionShape & WMIQ_RPN_CONST)
    {
        printf("    WMIQ_RPN_CONST\n");
    }
    if (pTemp->m_uSubexpressionShape & WMIQ_RPN_RELOP)
    {
        printf("    WMIQ_RPN_RELOP\n");
    }
    if (pTemp->m_uSubexpressionShape & WMIQ_RPN_LEFT_FUNCTION)
    {
        printf("    WMIQ_RPN_LEFT_FUNCTION\n");
    }
    if (pTemp->m_uSubexpressionShape & WMIQ_RPN_RIGHT_FUNCTION)
    {
        printf("    WMIQ_RPN_RIGHT_FUNCTION\n");
    }

    switch (pTemp->m_uOperator)
    {
        case WMIQ_RPN_OP_UNDEFINED: printf("  Operator (Invalid) WMIQ_RPN_OP_UNDEFINED\n"); break;
        case WMIQ_RPN_OP_EQ : printf("  Operator =  (WMIQ_RPN_OP_EQ)\n"); break;
        case WMIQ_RPN_OP_NE : printf("  Operator != (WMIQ_RPN_OP_NE)\n"); break;
        case WMIQ_RPN_OP_GE : printf("  Operator >= (WMIQ_RPN_OP_GE)\n"); break;
        case WMIQ_RPN_OP_LE : printf("  Operator <= (WMIQ_RPN_OP_LE)\n"); break;
        case WMIQ_RPN_OP_LT : printf("  Operator <  (WMIQ_RPN_OP_LT)\n"); break;
        case WMIQ_RPN_OP_GT : printf("  Operator >  (WMIQ_RPN_OP_GT)\n"); break;
        case WMIQ_RPN_OP_LIKE : printf("  Operator LIKE (WMIQ_RPN_OP_LIKE)\n"); break;
        case WMIQ_RPN_OP_ISA  : printf("  Operator ISA  (WMIQ_RPN_OP_ISA)\n"); break;
        case WMIQ_RPN_OP_ISNOTA  : printf("  Operator ISNOTA (WMIQ_RPN_OP_ISNOTA)\n"); break;

        default:
            printf("  Operator <INVALID -- Internal Error>\n");
            break;
    }

    // Dump identifiers (propety names)

    if (pTemp->m_pRightIdent)
    {
        printf("  Right side identifier = ");
        SWbemQueryQualifiedName *p = pTemp->m_pRightIdent;
        for (unsigned u = 0; u < p->m_uNameListSize; u++)
        {
            if (u > 0)
                printf(".");
            printf("%S", p->m_ppszNameList[u]);
        }
        printf("\n");
    }

    if (pTemp->m_pLeftIdent)
    {
        printf("  Left side identifier = ");
        SWbemQueryQualifiedName *p = pTemp->m_pLeftIdent;
        for (unsigned u = 0; u < p->m_uNameListSize; u++)
        {
            if (u > 0)
                printf(".");
            printf("%S", p->m_ppszNameList[u]);
        }
        printf("\n");
    }

    printf("  Apparent Type of Query Constant is ");

    switch(pTemp->m_uConstApparentType)
    {
        case VT_NULL:
            printf("VT_NULL");
            break;
        case VT_I4:
            printf("VT_I4,  Value = %d\n", pTemp->m_Const.m_lLongVal);
            break;
        case VT_UI4:
            printf("VT_UI4, Value = %u\n", pTemp->m_Const.m_uLongVal);
            break;
        case VT_BOOL:
            printf("VT_BOOL, Value = %d\n", pTemp->m_Const.m_bBoolVal);
            break;
        case VT_R8:
            printf("VT_R8, Value = %f\n", pTemp->m_Const.m_dblVal);
            break;
        case VT_LPWSTR:
            printf("VT_LPWSTR, Value = %S\n", pTemp->m_Const.m_pszStrVal);
            break;
    }

    printf("  Function name applied to Left Side = %S\n", pTemp->m_pszLeftFunc);
    printf("  Function name applied to Right Side = %S\n", pTemp->m_pszRightFunc);

    printf("----END SUBEXPRESSION TOKEN---\n");
}

void DumpWhereClause | ( | ULONG | uCount,
 |  | SWbemRpnQueryToken ** | pWhere
 | ) |  |

Definition at line 239 of file QueryParser.cpp.

{
    printf("---BEGIN WHERE CLAUSE---\n");

    unsigned u;

    for (u = 0; u < uCount; u++)
    {
        SWbemRpnQueryToken *pTemp = pWhere[u];

        switch(pTemp->m_uTokenType)
        {
            case WMIQ_RPN_TOKEN_EXPRESSION:
                DumpSubexpression(pTemp);
                break;

            case WMIQ_RPN_TOKEN_AND:
                printf(" Operator: AND\n");
                break;

            case WMIQ_RPN_TOKEN_OR:
                printf(" Operator: OR\n");
                break;

            case WMIQ_RPN_TOKEN_NOT:
                printf(" Operator: NOT\n");

            default:
                printf(" Operator: INVALID\n");
        }
    }

    printf("---END WHERE CLAUSE---\n");
}

void main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 387 of file QueryParser.cpp.

{
    if (argc < 2)
    {
        printf("\nusage:  QueryParser \"simple select query\"");
    printf("\nexample;  c:>QueryParser \"select RowA, RowB from tableName where propz=3\"");
        return;
    }

    wchar_t buf[8192];
  HRESULT hr = StringCbPrintfW(buf, sizeof(buf), L"%S", argv[1]);
  if (FAILED(hr))
  {
    printf("Query string cannot exceed %d characters.\n", sizeof(buf)/sizeof(wchar_t) - 1);
    printf("StringCbPrintfW failed with error code: 0x%X.\n", hr);
    return;
  }

    g_pQuery = buf;

  wprintf(L"Query = %s\n", g_pQuery);

    // Standard COM initialization stuff.
    // ===================================

    CoInitializeEx(0, COINIT_MULTITHREADED);

    // Get the QueryParser object call the test code
    // =============================================

    IWbemQuery *pQuery = 0;

    hr = CoCreateInstance(CLSID_WbemQuery, 0, CLSCTX_INPROC_SERVER,
            IID_IWbemQuery, (LPVOID *) &pQuery);

    if (hr != S_OK)
        printf("Failed to create Query object.\n");
    else
    {
        printf("Got a query parser object\n");
        TestQuery(pQuery);
        pQuery->Release();
    }

    CoUninitialize();
}

void TestQuery ( IWbemQuery * pQuery )

Definition at line 344 of file QueryParser.cpp.

{
    HRESULT hRes;
    ULONG uFeatures[] =
    {
        WMIQ_LF1_BASIC_SELECT,
        WMIQ_LF2_CLASS_NAME_IN_QUERY
    };

    hRes = pQuery->SetLanguageFeatures(0, sizeof(uFeatures)/sizeof(ULONG), uFeatures);

    hRes = pQuery->Parse(L"SQL", g_pQuery, 0);

    if (FAILED(hRes))
    {
        printf("Parse failed with error 0x%X\n", hRes);
        return;
    }

    SWbemRpnEncodedQuery *pRpn = 0;
    hRes = pQuery->GetAnalysis(
        WMIQ_ANALYSIS_RPN_SEQUENCE,
        0,
        (LPVOID *) &pRpn
        );

    if (SUCCEEDED(hRes))
    {
        printf("\n\nGot RPN Output\n");
        DumpRpn(pRpn);
        pQuery->FreeMemory(pRpn);
    }
}

Variable Documentation

LPWSTR g_pQuery = 0

Definition at line 25 of file QueryParser.cpp.

Generated on Wed Nov 13 2024 16:54:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/security/security.cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • security
Functions | Variables

security.cpp File Reference

#include <objbase.h>
#include <windows.h>
#include <stdio.h>
#include <wbemidl.h>
#include <comdef.h>
#include <wincred.h>
#include <strsafe.h>

Go to the source code of this file.

Functions

void __stdcall | _com_issue_error (HRESULT)
void | DisplayOptions ()
void | DumpAce (ACCESS_ALLOWED_ACE *pAce)
void | DumpSD (PSECURITY_DESCRIPTOR pSD)
void | ListClasses (IWbemServices *pNamespace)
BOOL | ProcessArguments (int iArgCnt, WCHAR **argv)
bool | ReadACL (IWbemServices *pNamespace)
HRESULT | SetProxySecurity (IUnknown *pProxy)
bool | StoreSD (IWbemServices *pSession, PSECURITY_DESCRIPTOR pSD)
int | wmain (int iArgCnt, WCHAR **argv)

Variables

bool | bPassWordSet = false
bool | bUserNameSet = false
BOOL | g_bInProc = FALSE
WCHAR | wFullUserName [CREDUI_MAX_USERNAME_LENGTH+1]
WCHAR | wNameSpace [MAX_PATH]
WCHAR | wPassWord [CREDUI_MAX_PASSWORD_LENGTH+1]
WCHAR | wPath [MAX_PATH]
WCHAR | wServerName [MAX_PATH]

Function Documentation

void __stdcall _com_issue_error ( HRESULT )

Definition at line 35 of file security.cpp.

{}

void DisplayOptions ( )

Definition at line 45 of file security.cpp.

{
    printf("\nThis application demonstrates various DCOM security issues.  It \n"
            "will connect up to the namespace and enumerate the top level classes\n"
            "and will also dump the security descriptor used to control access to the namespace.\n\n"
      "usage: Security [-S:<Server>] -N:<WMINamespace>\n"
            "              -S:<Server>             Optional Server Name. If not provided, local machine is assumed\n"
            "              -N:<WMINamespace>       WMI Namespace name\n"
      "Example; c:>Security -S:serverName -N:root\\default\n"
            );
    return;
}

void DumpAce ( ACCESS_ALLOWED_ACE * pAce )

Definition at line 303 of file security.cpp.

{
    printf("\n Ace, type=0x%x, flags=0x%x, mask=0x%x",
        pAce->Header.AceType, pAce->Header.AceFlags, pAce->Mask);

    PSID pSid = 0;
    SID_NAME_USE use;
    WCHAR wcUser[100], wcDomain[100];
    DWORD dwNameSize = sizeof(wcUser)/ sizeof(WCHAR);
  DWORD dwDomainSize =  sizeof(wcDomain)/ sizeof(WCHAR);
    pSid = &pAce->SidStart;
    if(LookupAccountSidW(
            NULL,              // name of local or remote computer
            pSid,              // security identifier
            wcUser,            // account name buffer
            &dwNameSize,       // size of account name buffer
            wcDomain,          // domain name
            &dwDomainSize,     // size of domain name buffer
            &use))
        printf(" User name = %S, Domain name = %S", wcUser, wcDomain);
}

void DumpSD ( PSECURITY_DESCRIPTOR pSD )

Definition at line 335 of file security.cpp.

{
    DWORD dwSize = GetSecurityDescriptorLength(pSD);
    printf("\nSecurity Descriptor is of size %d", dwSize);

    BOOL DaclPresent, DaclDefaulted;
    PACL pDacl;
    if(GetSecurityDescriptorDacl(pSD, &DaclPresent,
                &pDacl, &DaclDefaulted) && DaclPresent)
    {

        // Dump the aces

        ACL_SIZE_INFORMATION inf;
        DWORD dwNumAces;
        if(GetAclInformation(
            pDacl,
            &inf,
            sizeof(ACL_SIZE_INFORMATION),
            AclSizeInformation
            ))
        {
            dwNumAces = inf.AceCount;
            printf("\nThe DACL has %d ACEs", dwNumAces);
            for(DWORD dwCnt = 0; dwCnt < dwNumAces; dwCnt++)
            {
                ACCESS_ALLOWED_ACE * pAce;
                if(GetAce(pDacl, dwCnt, (LPVOID *)&pAce))
                    DumpAce(pAce);
            }
        }
    }
}

void ListClasses ( IWbemServices * pNamespace )

Definition at line 251 of file security.cpp.

{
    HRESULT hr;
    IEnumWbemClassObject *pEnum = NULL;

    hr = pNamespace->CreateClassEnum(NULL, 0, NULL, &pEnum);
    if(SUCCEEDED(hr))
    {

        // Note that even though security was set on the namespace pointer, it must
        // also be set on this pointer since COM will revert back to the default
        // settings for any new pointers!

        hr = SetProxySecurity(pEnum);
        if(SUCCEEDED(hr))
        {
            IWbemClassObject* Array[1];
            Array[0] = NULL;
            ULONG uRet = 0;
            while (SUCCEEDED(hr = pEnum->Next(10000, 1, Array, &uRet)) && Array[0])
            {
                // Note that IWbemClassObjects are inproc and thus have no proxy.
                // Therefore, they never need CoSetProxyBlanket.

                BSTR strText;
                IWbemClassObject* pObj = Array[0];
                hr = pObj->GetObjectText(0, &strText);

                if(SUCCEEDED(hr) && strText)
                {
                    printf("\nGot class %S", strText);
                    SysFreeString(strText);
                }
                pObj->Release();
                Array[0] = NULL;
            }
        }
        else
            printf("\nFAILED TO SET SECURITY FOR ENUMERATOR!!!!! hr = 0x%x", hr);
        pEnum->Release();
    }
}

BOOL ProcessArguments | ( | int | iArgCnt,
 |  | WCHAR ** | argv
 | ) |  |

Definition at line 67 of file security.cpp.

{
    if(iArgCnt < 2)
        return FALSE;

    wPath[0] = 0;
    wFullUserName[0] = 0;
  memset(wServerName, NULL, sizeof(wServerName));
  memset(wNameSpace, NULL, sizeof(wNameSpace));

    for(int iCnt = 1; iCnt <= iArgCnt-1 ; iCnt++)
    {
        WCHAR * pArg = argv[iCnt];
        if(pArg[0] != '-')
            return FALSE;
        switch (pArg[1])
        {
            case L's':
            case L'S':
                StringCbCopyW(wServerName, sizeof(wServerName), pArg+3);
                break;
            case L'n':
            case L'N':
                StringCbCopyW(wNameSpace, sizeof(wNameSpace), pArg+3);
                break;
            default:
                return FALSE;
        }
    }

    return TRUE;
}

bool ReadACL ( IWbemServices * pNamespace )

Definition at line 472 of file security.cpp.

{
    bool bRet = false;
    _bstr_t InstPath(L"__systemsecurity=@");
    _bstr_t MethName(L"GetSD");
    IWbemClassObject * pOutParams = NULL;

    // The security descriptor is returned via the GetSD method

    HRESULT hr = pNamespace->ExecMethod(InstPath,
            MethName,
            0,
            NULL, NULL,
            &pOutParams, NULL);
    if(SUCCEEDED(hr))
    {

        // The output parameters has a property which has the descriptor

        _bstr_t prop(L"sd");
        _variant_t var;
        hr = pOutParams->Get(prop, 0, &var, NULL, NULL);
        if(SUCCEEDED(hr))
        {
            if(var.vt != (VT_ARRAY | VT_UI1))
                return false;
            SAFEARRAY * psa = var.parray;
            PSECURITY_DESCRIPTOR pSD;
            hr = SafeArrayAccessData(psa, (void HUGEP* FAR*)&pSD);
            if(hr != 0)
                return false;

            // Dump out some information

            DumpSD(pSD);

            // Given that the security desciptor is now present, the code could use standard
            // nt functions to add or remove ace's.  There are also various libraries available
            // that can make the job a bit easier.  This sample does not change the security
            // descriptor, but does write it back unchanged as an example.

            StoreSD(pNamespace, pSD);
            SafeArrayUnaccessData(psa);
            bRet = true;
        }
    }
    return bRet;
}

HRESULT SetProxySecurity ( IUnknown * pProxy )

Definition at line 109 of file security.cpp.

{
    HRESULT hr;
    DWORD dwAuthnSvc, dwAuthzSvc ,dwAuthnLevel, dwImpLevel, dwCapabilities;
    RPC_AUTH_IDENTITY_HANDLE * pAuthInfo = NULL;

    //  There are various reasons to set security.  An application that can
    //  call CoInitializeSecurity and doesnt use an alternative user\password,
    //  need not bother with call CoSetProxyBlanket.  There are at least
    //  three cases that do need it though.
    //
    //  1) Dlls cannot call CoInitializeSecurity and will need to call it just
    //     to raise the impersonation level.  This does NOT require that the
    //     RPC_AUTH_IDENTITY_HANDLE to be set nor does this require setting
    //     it on the IUnknown pointer.
    //  2) Any time that an alternative user\password are set as is the case
    //     in this simple sample.  Note that it is necessary in that case to
    //     also set the information on the IUnknown.
    //  3) If the caller has a thread token from a remote call to itself and
    //     it wants to use that identity.  That would be the case of an RPC/COM
    //     server which is handling a call from one of its clients and it wants
    //     to use the client's identity in calls to WMI.  In this case, then
    //     the RPC_AUTH_IDENTITY_HANDLE does not need to be set, but the
    //     dwCapabilities arguement should be set for cloaking.  This is also
    //     required for the IUnknown pointer.

    if(bPassWordSet == false && bUserNameSet == false)
    {
        // In this case, nothing needs to be done.  But for the sake of
        // example the code will set the impersonation level.

        // For backwards compatibility, retrieve the previous authentication level, so
        // we can echo-back the value when we set the blanket

        hr = CoQueryProxyBlanket(
            pProxy,           //Location for the proxy to query
            &dwAuthnSvc,      //Location for the current authentication service
            &dwAuthzSvc,      //Location for the current authorization service
            NULL,             //Location for the current principal name
            &dwAuthnLevel,    //Location for the current authentication level
            &dwImpLevel,      //Location for the current impersonation level
            NULL,             //Location for the value passed to IClientSecurity::SetBlanket
            &dwCapabilities   //Location for flags indicating further capabilities of the proxy
                );
        if(FAILED(hr))
            return hr;
        hr = CoSetProxyBlanket(pProxy, RPC_C_AUTHN_DEFAULT, RPC_C_AUTHZ_DEFAULT, COLE_DEFAULT_PRINCIPAL, dwAuthnLevel,
            RPC_C_IMP_LEVEL_IMPERSONATE, COLE_DEFAULT_AUTHINFO, EOAC_DEFAULT);
        return hr;
    }
    else
    {
        // The user\password was set, it is necessary to call CoSetProxyBlanket

        COAUTHIDENTITY authident;
        pAuthInfo = NULL;

        // For backwards compatibility, retrieve the previous authentication level, so
        // we can echo-back the value when we set the blanket

        hr = CoQueryProxyBlanket(
            pProxy,           //Location for the proxy to query
            &dwAuthnSvc,      //Location for the current authentication service
            &dwAuthzSvc,      //Location for the current authorization service
            NULL,             //Location for the current principal name
            &dwAuthnLevel,    //Location for the current authentication level
            &dwImpLevel,      //Location for the current impersonation level
            NULL,             //Location for the value passed to IClientSecurity::SetBlanket
            &dwCapabilities   //Location for flags indicating further capabilities of the proxy
                );

        memset((void *)&authident,0,sizeof(COAUTHIDENTITY));

        // note that this assumes NT.  Win9X would fill in the field with
        // ascii and then use SEC_WINNT_AUTH_IDENTITY_ANSI flag instead

        WCHAR wUserName[ CREDUI_MAX_USERNAME_LENGTH + 1];
        WCHAR wDomainName[CRED_MAX_DOMAIN_TARGET_NAME_LENGTH + 1];
        memset(wUserName, NULL, sizeof(wUserName));
    memset(wDomainName, NULL, sizeof(wDomainName));
        bool bDomainNameSet = false;

        if(bUserNameSet)
        {

            // Note that the user name may be in the form domain\user.  If so, split it up

      DWORD dwRes = CredUIParseUserNameW(wFullUserName,
        wUserName, sizeof(wUserName)/sizeof(WCHAR),
        wDomainName, sizeof(wDomainName)/sizeof(WCHAR));

      if (dwRes != NO_ERROR)
      {
        printf ("Could not parse user name.\n");
        return E_FAIL;
      }

            authident.UserLength = (ULONG)wcslen(wUserName);
            authident.User = (LPWSTR)wUserName;

        }
        if(wcslen(wDomainName) > 0)
        {
            authident.DomainLength = (ULONG)wcslen(wDomainName);
            authident.Domain = (LPWSTR)wDomainName;
        }
        if(bPassWordSet)
        {
            authident.PasswordLength = (ULONG)wcslen(wPassWord);
            authident.Password = (LPWSTR)wPassWord;
        }
        authident.Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE;

        hr = CoSetProxyBlanket(pProxy, RPC_C_AUTHN_DEFAULT, RPC_C_AUTHZ_DEFAULT, COLE_DEFAULT_PRINCIPAL, dwAuthnLevel,
            RPC_C_IMP_LEVEL_IMPERSONATE, &authident, EOAC_DEFAULT);
        if(FAILED(hr))
            return hr;

        // There is a remote IUnknown interface that lurks behind IUnknown.
        // If that is not set, then the Release call can return access denied.

        IUnknown * pUnk = NULL;
        hr = pProxy->QueryInterface(IID_IUnknown, (void **)&pUnk);
        if(FAILED(hr))
            return hr;
        hr = CoSetProxyBlanket(pUnk, RPC_C_AUTHN_DEFAULT, RPC_C_AUTHZ_DEFAULT, COLE_DEFAULT_PRINCIPAL, dwAuthnLevel,
            RPC_C_IMP_LEVEL_IMPERSONATE, &authident, EOAC_DEFAULT);
        pUnk->Release();
        return hr;
    }
}

bool StoreSD | ( | IWbemServices * | pSession,
 |  | PSECURITY_DESCRIPTOR | pSD
 | ) |  |

Definition at line 378 of file security.cpp.

{
    bool bRet = false;
    HRESULT hr;

  if (!IsValidSecurityDescriptor(pSD))
    return false;

    // Get the class object

    IWbemClassObject * pClass = NULL;
    _bstr_t InstPath(L"__systemsecurity=@");
    _bstr_t ClassPath(L"__systemsecurity");
    hr = pSession->GetObject(ClassPath, 0, NULL, &pClass, NULL);
    if(FAILED(hr))
        return false;

    // Get the input parameter class

    _bstr_t MethName(L"SetSD");
    IWbemClassObject * pInClassSig = NULL;
    hr = pClass->GetMethod(MethName,0, &pInClassSig, NULL);
    pClass->Release();
    if(FAILED(hr))
        return false;

    // spawn an instance of the input parameter class

    IWbemClassObject * pInArg = NULL;
    pInClassSig->SpawnInstance(0, &pInArg);
    pInClassSig->Release();
    if(FAILED(hr))
        return false;

    // move the SD into a variant.

    SAFEARRAY FAR* psa;
    SAFEARRAYBOUND rgsabound[1];    rgsabound[0].lLbound = 0;
    long lSize = GetSecurityDescriptorLength(pSD);
    rgsabound[0].cElements = lSize;
    psa = SafeArrayCreate( VT_UI1, 1 , rgsabound );
    if(psa == NULL)
    {
        pInArg->Release();
        return false;
    }

    char * pData = NULL;
    hr = SafeArrayAccessData(psa, (void HUGEP* FAR*)&pData);
    if(FAILED(hr))
    {
        pInArg->Release();
        return false;
    }

    memcpy(pData, pSD, lSize);

    SafeArrayUnaccessData(psa);
    _variant_t var;
    var.vt = VT_I4|VT_ARRAY;
    var.parray = psa;

    // put the property

    hr = pInArg->Put(L"SD" , 0, &var, 0);
    if(FAILED(hr))
    {
        pInArg->Release();
        return false;
    }

    // Execute the method

    IWbemClassObject * pOutParams = NULL;
    hr = pSession->ExecMethod(InstPath,
            MethName,
            0,
            NULL, pInArg,
            NULL, NULL);
    if(FAILED(hr))
        printf("\nPut failed, returned 0x%x",hr);

    return bRet;
}

int wmain | ( | int | iArgCnt,
 |  | WCHAR ** | argv
 | ) |  |

Definition at line 531 of file security.cpp.

{

    if(!ProcessArguments(iArgCnt, argv))
    {
        DisplayOptions();
        return 1;
  }

  if (wcslen(wServerName) > 0)
  {

    //prompt for credentials for a remote connection

    DWORD dwRes = CredUICmdLinePromptForCredentialsW(
                  (const WCHAR *) wServerName, NULL, 0,
                  wFullUserName, sizeof(wFullUserName)/sizeof(WCHAR),
                  wPassWord, sizeof(wPassWord)/sizeof(WCHAR),
                  FALSE,
                  CREDUI_FLAGS_EXCLUDE_CERTIFICATES | CREDUI_FLAGS_DO_NOT_PERSIST );

    if (dwRes != NO_ERROR)
    {
      printf("Failed to retrieve credentials: error %d. Using the default credentials.", dwRes);
    }

    bUserNameSet = bPassWordSet = (dwRes == NO_ERROR);

  }
  else
  {
    //no server name passed in, assume local
    StringCbCopyW(wServerName, sizeof(wPath), L".");
  }

  StringCbCopyW(wPath, sizeof(wPath), L"\\\\");
  StringCbCatW(wPath, sizeof(wPath),  wServerName);
  StringCbCatW(wPath, sizeof(wPath),  L"\\");
  StringCbCatW(wPath, sizeof(wPath),  wNameSpace);

    IWbemLocator *pLocator = NULL;
    IWbemServices *pNamespace = 0;
    IWbemClassObject * pClass = NULL;

    // Initialize COM.

    HRESULT hr = CoInitialize(0);
  if (FAILED(hr))
  {
      printf("\nCoInitialize returned 0x%x:", hr);
    return 1;
  }

    // This sets the default impersonation level to "Impersonate" which is what WMI
  // providers will generally require.
    //
    // DLLs cannot call this function.  To bump up the impersonation level, they must
    // call CoSetProxyBlanket which is illustrated later on.
  //
  //  When using asynchronous WMI API's remotely in an environment where the "Local System" account
  //  has no network identity (such as non-Kerberos domains), the authentication level of
  //  RPC_C_AUTHN_LEVEL_NONE is needed. However, lowering the authentication level to
  //  RPC_C_AUTHN_LEVEL_NONE makes your application less secure. It is wise to
  //  use semi-synchronous API's for accessing WMI data and events instead of the asynchronous ones.

    hr = CoInitializeSecurity(NULL, -1, NULL, NULL,
                                RPC_C_AUTHN_LEVEL_PKT_PRIVACY,
                                RPC_C_IMP_LEVEL_IMPERSONATE,
                                NULL,
                EOAC_SECURE_REFS, //change to EOAC_NONE if you change dwAuthnLevel to RPC_C_AUTHN_LEVEL_NONE
                0);
  if (FAILED(hr))
  {
      printf("\nCoInitializeSecurity returned 0x%x:", hr);
    return 1;
  }

    hr = CoCreateInstance(CLSID_WbemLocator, 0, CLSCTX_INPROC_SERVER,
            IID_IWbemLocator, (LPVOID *) &pLocator);

  if (FAILED(hr))
  {
      printf("\nCoCreateInstance for CLSID_WbemLocator returned 0x%x:", hr);
    return 1;
  }

    hr = pLocator->ConnectServer(wPath,
                    (bUserNameSet) ? wFullUserName : NULL,
                    (bPassWordSet) ? wPassWord : NULL,
                    NULL, 0, NULL, NULL, &pNamespace);
    if(FAILED(hr))
    {
        wprintf(L"\nConnectServer  to %s failed, hr = 0x%x", wPath, hr);
    }
    else
    {
        printf("\nConnection succeeded");
        hr = SetProxySecurity(pNamespace);
        if(SUCCEEDED(hr))
        {
            ListClasses(pNamespace);
            ReadACL(pNamespace);
        }
        pNamespace->Release();
    }
    CoUninitialize();
    printf("\nTerminating normally");
    return 0;
}

Variable Documentation

bool bPassWordSet = false

Definition at line 32 of file security.cpp.

bool bUserNameSet = false

Definition at line 33 of file security.cpp.

BOOL g_bInProc = FALSE

Definition at line 529 of file security.cpp.

WCHAR wFullUserName[CREDUI_MAX_USERNAME_LENGTH+1]

Definition at line 29 of file security.cpp.

WCHAR wNameSpace[MAX_PATH]

Definition at line 28 of file security.cpp.

WCHAR wPassWord[CREDUI_MAX_PASSWORD_LENGTH+1]

Definition at line 30 of file security.cpp.

WCHAR wPath[MAX_PATH]

Definition at line 26 of file security.cpp.

WCHAR wServerName[MAX_PATH]

Definition at line 27 of file security.cpp.

Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/SimpleClient/Resource.h File Reference

  • SysMgmt
  • WMI
  • VC
  • SimpleClient
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_CONNECT 1000
#define | IDC_DISKINFO 5
#define | IDC_ENUMDISKS 3
#define | IDC_MAKEOFFICE 4
#define | IDC_NAMESPACE 1002
#define | IDC_OUTPUTLIST 1001
#define | IDD_ABOUTBOX 100
#define | IDD_WBEMCLIENT_DIALOG 102
#define | IDM_ABOUTBOX 0x0010
#define | IDR_MAINFRAME 128
#define | IDS_ABOUTBOX 101

Define Documentation

#define IDC_CONNECT 1000

Definition at line 14 of file Resource.h.

#define IDC_DISKINFO 5

Definition at line 8 of file Resource.h.

#define IDC_ENUMDISKS 3

Definition at line 6 of file Resource.h.

#define IDC_MAKEOFFICE 4

Definition at line 7 of file Resource.h.

#define IDC_NAMESPACE 1002

Definition at line 16 of file Resource.h.

#define IDC_OUTPUTLIST 1001

Definition at line 15 of file Resource.h.

#define IDD_ABOUTBOX 100

Definition at line 10 of file Resource.h.

#define IDD_WBEMCLIENT_DIALOG 102

Definition at line 12 of file Resource.h.

#define IDM_ABOUTBOX 0x0010

Definition at line 9 of file Resource.h.

#define IDR_MAINFRAME 128

Definition at line 13 of file Resource.h.

#define IDS_ABOUTBOX 101

Definition at line 11 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/SimpleClient/StdAfx.Cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • SimpleClient

StdAfx.Cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/SimpleClient/StdAfx.h File Reference

  • SysMgmt
  • WMI
  • VC
  • SimpleClient
Defines

StdAfx.h File Reference

#include <afxwin.h>
#include <afxext.h>
#include <afxdisp.h>
#include <afxcmn.h>

Go to the source code of this file.

Defines

#define VC_EXTRALEAN

Define Documentation

#define VC_EXTRALEAN

Definition at line 18 of file StdAfx.h.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/SimpleClient/WbemClient.Cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • SimpleClient
Variables

WbemClient.Cpp File Reference

#include "stdafx.h"
#include "WbemClient.h"
#include "WbemClientDlg.h"

Go to the source code of this file.

Variables

CWbemClientApp theApp

Variable Documentation

CWbemClientApp theApp

Definition at line 40 of file WbemClient.Cpp.

Generated on Wed Nov 13 2024 16:54:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/SimpleClient/WbemClient.h File Reference

  • SysMgmt
  • WMI
  • VC
  • SimpleClient
Classes

WbemClient.h File Reference

#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Classes

class CWbemClientApp
Generated on Wed Nov 13 2024 16:54:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/SimpleClient/WbemClientDlg.Cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • SimpleClient
Classes | Functions

WbemClientDlg.Cpp File Reference

#include "stdafx.h"
#include "WbemClient.h"
#include "WbemClientDlg.h"

Go to the source code of this file.

Classes

class | CAboutDlg

Functions

CString | ErrorMsg (LPCTSTR str, HRESULT hRes)

Function Documentation

CString ErrorMsg | ( | LPCTSTR | str,
 |  | HRESULT | hRes
 | ) |  |

Definition at line 18 of file WbemClientDlg.Cpp.

                                            {
    CString s;
  s.Format("%s(0x%08lx)", str, hRes);
  return s;
}

Generated on Wed Nov 13 2024 16:54:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/SimpleClient/WbemClientDlg.h File Reference

  • SysMgmt
  • WMI
  • VC
  • SimpleClient
Classes

WbemClientDlg.h File Reference

#include "wbemcli.h"

Go to the source code of this file.

Classes

class CWbemClientDlg
Generated on Wed Nov 13 2024 16:54:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/TempConsumer/Consumer.Cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • TempConsumer
Classes | Defines | Functions

Consumer.Cpp File Reference

#include <windows.h>
#include <stdio.h>
#include <wbemidl.h>
#include "oahelp.inl"

Go to the source code of this file.

Classes

class | CMySink

Defines

#define | _WIN32_WINNT 0x0400

Functions

BOOL | ExecuteQuery (IWbemObjectSink *pDestSink, IWbemServices *pSvc)
void | main (int argc, char **argv)

Define Documentation

#define _WIN32_WINNT 0x0400

Definition at line 17 of file Consumer.Cpp.

Function Documentation

BOOL ExecuteQuery | ( | IWbemObjectSink * | pDestSink,
 |  | IWbemServices * | pSvc
 | ) |  |

Definition at line 163 of file Consumer.Cpp.

{
    CBSTR Language(L"WQL");
    CBSTR Query(L"select * from MyEvent");

    HRESULT hRes = pSvc->ExecNotificationQueryAsync(
        Language,
        Query,
        0,                  // Flags
        0,                  // Context
        pDestSink
        );

    if (hRes != 0)
        return FALSE;

    return TRUE;
}

void main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 191 of file Consumer.Cpp.

{
    HRESULT hr = CoInitializeEx(0, COINIT_MULTITHREADED);
  if (FAILED(hr))
  {
      printf("\nCoInitializeEx returned 0x%x", hr);
    return;
  }

  //  NOTE:
  //  When using asynchronous WMI API's remotely in an environment where the "Local System" account
  //  has no network identity (such as non-Kerberos domains), the authentication level of
  //  RPC_C_AUTHN_LEVEL_NONE is needed. However, lowering the authentication level to
  //  RPC_C_AUTHN_LEVEL_NONE makes your application less secure. It is wise to
  //  use semi-synchronous API's for accessing WMI data and events instead of the asynchronous ones.

    hr = CoInitializeSecurity( NULL, -1, NULL, NULL,
                      RPC_C_AUTHN_LEVEL_PKT_PRIVACY,
                      RPC_C_IMP_LEVEL_IMPERSONATE,
                      NULL,
                      EOAC_SECURE_REFS, //change to EOAC_NONE if you change dwAuthnLevel to RPC_C_AUTHN_LEVEL_NONE
                      NULL );
  if (FAILED(hr))
  {
      printf("\nCoInitializeSecurity returned 0x%x", hr);
    return;
  }

    IWbemLocator *pLoc = 0;

    hr = CoCreateInstance(CLSID_WbemLocator, 0, CLSCTX_INPROC_SERVER,
            IID_IWbemLocator, (LPVOID *) &pLoc);

   if (FAILED(hr))
    {
    printf("Failed to create IWbemLocator object. Error: 0x%x\n", hr );
        CoUninitialize();
        return;
    }

    // Connect to CIMOM.
    // =================

    IWbemServices *pSvc = 0;

    HRESULT hRes = pLoc->ConnectServer(
            CBSTR(L"\\\\.\\ROOT\\DEFAULT"),
            NULL,
            NULL,
            0,
            0,
            0,
            0,
            &pSvc
            );

    if (hRes)
    {
        printf("Could not connect. Error code = 0x%X\n", hRes);
        CoUninitialize();
        return;
    }

    // If here, we succeeded.
    // ======================

    printf("Connected to CIMOM.\n");

    // Create a new sink.
    // ===================

    CMySink *pSink = new CMySink;
  if (pSink == NULL)
  {
    printf("Could not allocate sink: out of memory");
        CoUninitialize();
        return;
    }

    BOOL bRes = ExecuteQuery(pSink, pSvc);

    // Now, we wait until the user hits ENTER to stop.
    // ===============================================

    if (bRes == TRUE)
    {

        int input = 'a';
    while((input = getchar()) != '\n');

        pSvc->CancelAsyncCall(pSink);
    }
    else
    {
        printf("Unable to execute the event query\n");
    }

    // Cleanup.
    // ========

    printf("Shutting down\n");

    pSink->Release();
    pSvc->Release();
    pLoc->Release();

    CoUninitialize();
}

Generated on Wed Nov 13 2024 16:54:45 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/TempConsumer/OaHelp.Inl File Reference

  • SysMgmt
  • WMI
  • VC
  • TempConsumer
Classes

OaHelp.Inl File Reference

Go to the source code of this file.

Classes

class | CBSTR
class | CSAFEARRAY
class | CVARIANT
Generated on Wed Nov 13 2024 16:54:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/UtilLib/PreComp.h File Reference

  • SysMgmt
  • WMI
  • VC
  • UtilLib
Defines

PreComp.h File Reference

#include <ole2.h>
#include <windows.h>

Go to the source code of this file.

Defines

#define _WIN32_DCOM

Define Documentation

#define _WIN32_DCOM

Definition at line 6 of file PreComp.h.

Generated on Wed Nov 13 2024 16:53:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/UtilLib/UtilLib.h File Reference

  • SysMgmt
  • WMI
  • VC
  • UtilLib
Classes | Defines | Functions

UtilLib.h File Reference

#include <comdef.h>
#include <strsafe.h>

Go to the source code of this file.

Classes

class | MyString

Defines

#define | BLOCKSIZE (32 * sizeof(WCHAR))
#define | CIMTYPEQUAL L"CIMTYPE"
#define | CLASSPROP L"__CLASS"
#define | CVTBUFSIZE (309+40)
#define | CVTFAILED L"WideCharToMultiByte failed\n"
#define | ERROR_MODE_PRINTFIELDS 0
#define | ERROR_MODE_PRINTMOF 1
#define | FWPRINTF myFWPrintf
#define | KEYQUAL L"key"
#define | MAXITOA 19
#define | NAMEPROP L"Name"
#define | NAMESPACEPROP L"__NAMESPACE"
#define | PAGESIZE 4096
#define | PATHPROP L"__PATH"
#define | RELEASE(a) if (a) { (a)->Release(); (a)=NULL;}
#define | RELPATHPROP L"__RELPATH"
#define | SERVERPROP L"__SERVER"
#define | STRSAFE_NO_DEPRECATE
#define | SYSTEMCLASS L"__SystemClass"
#define | SYSTEMPREFIX L"__"
#define | UNREFERENCED(x)

Functions

_COM_SMARTPTR_TYPEDEF (IEnumWbemClassObject, __uuidof(IEnumWbemClassObject))
_COM_SMARTPTR_TYPEDEF (IWbemLocator, __uuidof(IWbemLocator))
_COM_SMARTPTR_TYPEDEF (IWbemClassObject, __uuidof(IWbemClassObject))
_COM_SMARTPTR_TYPEDEF (IWbemQualifierSet, __uuidof(IWbemQualifierSet))
_COM_SMARTPTR_TYPEDEF (IWbemServices, __uuidof(IWbemServices))
_COM_SMARTPTR_TYPEDEF (IWbemContext, __uuidof(IWbemContext))
_COM_SMARTPTR_TYPEDEF (IWbemStatusCodeText, __uuidof(IWbemStatusCodeText))
_COM_SMARTPTR_TYPEDEF (IWbemCallResult, __uuidof(IWbemCallResult))
_COM_SMARTPTR_TYPEDEF (IWbemObjectAccess, __uuidof(IWbemObjectAccess))
_COM_SMARTPTR_TYPEDEF (IWbemObjectSink, __uuidof(IWbemObjectSink))
char * | cvt (WCHAR *x, char **y)
double | difftime (struct _timeb finish, struct _timeb start)
int | myFWPrintf (FILE *f, WCHAR *fmt,...)
void | PrintError (char *pszFailureReason, SCODE sc, DWORD dwMode)
void | PrintErrorAndAsk (char *pszFailureReason, SCODE sc, DWORD dwMode)
void | PrintErrorAndExit (char *pszFailureReason, SCODE sc, DWORD dwMode)
const WCHAR * | TypeToString (VARTYPE v)
const WCHAR * | TypeToString (CIMTYPE v)
const WCHAR * | TypeToString (VARIANT *p)
WCHAR * | ValueToString (CIMTYPE dwType, VARIANT *pValue, WCHAR **pbuf, WCHAR *fnHandler(VARIANT *pv)=NULL)
BSTR | WbemErrorString (SCODE sc)

Define Documentation

#define BLOCKSIZE (32 * sizeof(WCHAR))

Definition at line 28 of file UtilLib.h.

#define CIMTYPEQUAL L"CIMTYPE"

Definition at line 23 of file UtilLib.h.

#define CLASSPROP L"__CLASS"

Definition at line 16 of file UtilLib.h.

#define CVTBUFSIZE (309+40)

Definition at line 29 of file UtilLib.h.

#define CVTFAILED L"WideCharToMultiByte failed\n"

Definition at line 26 of file UtilLib.h.

#define ERROR_MODE_PRINTFIELDS 0

Definition at line 31 of file UtilLib.h.

#define ERROR_MODE_PRINTMOF 1

Definition at line 32 of file UtilLib.h.

#define FWPRINTF myFWPrintf

Definition at line 15 of file UtilLib.h.

#define KEYQUAL L"key"

Definition at line 24 of file UtilLib.h.

#define MAXITOA 19

Definition at line 14 of file UtilLib.h.

#define NAMEPROP L"Name"

Definition at line 22 of file UtilLib.h.

#define NAMESPACEPROP L"__NAMESPACE"

Definition at line 19 of file UtilLib.h.

#define PAGESIZE 4096

Definition at line 30 of file UtilLib.h.

#define PATHPROP L"__PATH"

Definition at line 18 of file UtilLib.h.

#define RELEASE ( a ) if (a) { (a)->Release(); (a)=NULL;}

Definition at line 27 of file UtilLib.h.

#define RELPATHPROP L"__RELPATH"

Definition at line 21 of file UtilLib.h.

#define SERVERPROP L"__SERVER"

Definition at line 17 of file UtilLib.h.

#define STRSAFE_NO_DEPRECATE

Definition at line 35 of file UtilLib.h.

#define SYSTEMCLASS L"__SystemClass"

Definition at line 20 of file UtilLib.h.

#define SYSTEMPREFIX L"__"

Definition at line 25 of file UtilLib.h.

#define UNREFERENCED ( x )

Definition at line 33 of file UtilLib.h.

Function Documentation

_COM_SMARTPTR_TYPEDEF | ( | IEnumWbemClassObject | ,
 |  | __uuidof(IEnumWbemClassObject) |
 | ) |  |
_COM_SMARTPTR_TYPEDEF | ( | IWbemLocator | ,
 |  | __uuidof(IWbemLocator) |
 | ) |  |
_COM_SMARTPTR_TYPEDEF | ( | IWbemClassObject | ,
 |  | __uuidof(IWbemClassObject) |
 | ) |  |
_COM_SMARTPTR_TYPEDEF | ( | IWbemQualifierSet | ,
 |  | __uuidof(IWbemQualifierSet) |
 | ) |  |
_COM_SMARTPTR_TYPEDEF | ( | IWbemServices | ,
 |  | __uuidof(IWbemServices) |
 | ) |  |
_COM_SMARTPTR_TYPEDEF | ( | IWbemContext | ,
 |  | __uuidof(IWbemContext) |
 | ) |  |
_COM_SMARTPTR_TYPEDEF | ( | IWbemStatusCodeText | ,
 |  | __uuidof(IWbemStatusCodeText) |
 | ) |  |
_COM_SMARTPTR_TYPEDEF | ( | IWbemCallResult | ,
 |  | __uuidof(IWbemCallResult) |
 | ) |  |
_COM_SMARTPTR_TYPEDEF | ( | IWbemObjectAccess | ,
 |  | __uuidof(IWbemObjectAccess) |
 | ) |  |
_COM_SMARTPTR_TYPEDEF | ( | IWbemObjectSink | ,
 |  | __uuidof(IWbemObjectSink) |
 | ) |  |
char* cvt | ( | WCHAR * | x,
 |  | char ** | y
 | ) |  |

Definition at line 1202 of file Utils.Cpp.

{
    int dwRet, i;
    i = WideCharToMultiByte( CP_OEMCP,
        0,
        x,
        -1,
        NULL,
        0,
        NULL,
        NULL);

  if (i == 0)
  {
        PrintErrorAndExit("cvt() failed", S_OK, 0);
    }

    *y = (char *)calloc(i, 1);

    if (*y)
    {
        dwRet = WideCharToMultiByte( CP_OEMCP,
            0,
            x,
            -1,
            *y,
            i,
            NULL,
            NULL);

        if (dwRet == 0)
        {
            free(*y);
            *y = (char *)malloc(sizeof(CVTFAILED));
            if (*y)
            {
                memcpy(*y, CVTFAILED, sizeof(CVTFAILED));
            }
      else
      {
        PrintErrorAndExit("cvt() out of memory", S_OK, 0);
      }
        }
    }
    else
    {
        PrintErrorAndExit("cvt() out of memory", S_OK, 0);
    }

    return *y;
}

double difftime | ( | struct _timeb | finish,
 |  | struct _timeb | start
 | ) |  |

Definition at line 1260 of file Utils.Cpp.

{
    double dRet;

    if (start.millitm > finish.millitm)
    {
        dRet = ((finish.time - start.time) - 1) + (double)(((1000 + finish.millitm) - start.millitm) / 1000.0);
    }
    else
    {
        dRet = (finish.time - start.time) + (double)((finish.millitm - start.millitm) / 1000.0);
    }

    return dRet;
}

int myFWPrintf | ( | FILE * | f,
 |  | WCHAR * | fmt,
 |  |  | ...
 | ) |  |
void PrintError | ( | char * | pszFailureReason,
 |  | SCODE | sc,
 |  | DWORD | dwMode
 | ) |  |

Definition at line 67 of file Utils.Cpp.

{
    VARIANT varString;
    SCODE sc;
    IWbemClassObject *pErrorObject = NULL;
    IErrorInfo* pEI = NULL;

    fprintf(stdout, "%s\n", pszFailureReason);
    fprintf(stdout, "FunctionReturn: %S(0x%08lx)\n", WbemErrorString(psc), psc);

    if (GetErrorInfo(0, &pEI) == S_OK)
    {
        pEI->QueryInterface(IID_IWbemClassObject, (void**)&pErrorObject);
        pEI->Release();
    }

    if (pErrorObject != NULL)
    {
        VariantInit(&varString);

        if (dwMode == ERROR_MODE_PRINTFIELDS)
        {
            if (pErrorObject->InheritsFrom(L"__NotifyStatus") != WBEM_NO_ERROR)
            {
                fprintf(stdout, "Unrecognized Error Object type\n");
            }
            else if (pErrorObject->InheritsFrom(L"__ExtendedStatus") == WBEM_NO_ERROR)
            {
                sc = pErrorObject->Get(L"Description", 0L, &varString, NULL, NULL);
                if (sc != S_OK)
                {
                    fprintf(stdout, "Can't get Description: %d\n", sc);
                }
                else if (V_VT(&varString) == VT_BSTR)
                {
                    FWPRINTF(stdout, L"Description: %wS\n", V_BSTR(&varString));
                }
                VariantClear(&varString);

                pErrorObject->Get(L"Operation", 0L, &varString, NULL, NULL);
                if (sc != S_OK)
                {
                    fprintf(stdout, "Can't get Operation: %d\n", sc);
                }
                else if (V_VT(&varString) == VT_BSTR)
                {
                    FWPRINTF(stdout, L"Operation: %wS\n", V_BSTR(&varString));
                }
                VariantClear(&varString);

                pErrorObject->Get(L"ParameterInfo", 0L, &varString, NULL, NULL);
                if (sc != S_OK)
                {
                    fprintf(stdout, "Can't get ParameterInfo: %d\n", sc);
                }
                else if (V_VT(&varString) == VT_BSTR)
                {
                    FWPRINTF(stdout, L"ParameterInfo: %wS\n", V_BSTR(&varString));
                }
                VariantClear(&varString);

                pErrorObject->Get(L"ProviderName", 0L, &varString, NULL, NULL);
                if (sc != S_OK)
                {
                    fprintf(stdout, "Can't get ProviderName: %d\n", sc);
                }
                else if (V_VT(&varString) == VT_BSTR)
                {
                    FWPRINTF(stdout, L"ProviderName: %wS\n", V_BSTR(&varString));
                }
                VariantClear(&varString);
            }
        }
        else
        {
            BSTR bstrObjectText = NULL;
            if (SUCCEEDED(pErrorObject->GetObjectText(0, &bstrObjectText)))
            {
                fprintf(stdout, "%wS", bstrObjectText);
                SysFreeString(bstrObjectText);
            }
        }

        RELEASE(pErrorObject);
    }
}

void PrintErrorAndAsk | ( | char * | pszFailureReason,
 |  | SCODE | sc,
 |  | DWORD | dwMode
 | ) |  |

Definition at line 172 of file Utils.Cpp.

{
    int c;

    PrintError(pszFailureReason, sc, dwMode);
    printf("Continue (Y/N)? ");

    c = getchar();
    while (getchar() != '\n')
    {
    }

    if ((c != 'Y') && (c != 'y'))
    {
        // Clean up and exit
        OleUninitialize();
        exit(1);
    }
};

void PrintErrorAndExit | ( | char * | pszFailureReason,
 |  | SCODE | sc,
 |  | DWORD | dwMode
 | ) |  |

Definition at line 158 of file Utils.Cpp.

{
    PrintError(pszFailureReason, sc, dwMode);

    // Clean up and exit
    OleUninitialize();
    printf("Abnormal Termination\n");
    exit(1);
};

const WCHAR* TypeToString ( VARTYPE v )

Definition at line 205 of file Utils.Cpp.

{
    const static WCHAR *pVT_NULL  = L"VT_NULL";
    const static WCHAR *pVT_EMTPY = L"VT_EMPTY";
    const static WCHAR *pVT_I1    = L"VT_I1";
    const static WCHAR *pVT_UI1   = L"VT_UI1";
    const static WCHAR *pVT_I2    = L"VT_I2";
    const static WCHAR *pVT_UI2   = L"VT_UI2";
    const static WCHAR *pVT_I4    = L"VT_I4";
    const static WCHAR *pVT_UI4   = L"VT_UI4";
    const static WCHAR *pVT_I8    = L"VT_I8";
    const static WCHAR *pVT_UI8   = L"VT_UI8";
    const static WCHAR *pVT_R4    = L"VT_R4";
    const static WCHAR *pVT_R8    = L"VT_R8";
    const static WCHAR *pVT_BOOL  = L"VT_BOOL";
    const static WCHAR *pVT_BSTR  = L"VT_BSTR";
    const static WCHAR *pVT_DISPATCH = L"VT_DISPATCH";
    const static WCHAR *pVT_UNKNOWN = L"VT_UNKNOWN";
    const static WCHAR *pVT_I1_ARRAY = L"VT_I1 | VT_ARRAY";
    const static WCHAR *pVT_UI1_ARRAY  = L"VT_UI1 | VT_ARRAY";
    const static WCHAR *pVT_I2_ARRAY   = L"VT_I2 | VT_ARRAY";
    const static WCHAR *pVT_UI2_ARRAY  = L"VT_UI2 | VT_ARRAY";
    const static WCHAR *pVT_I4_ARRAY   = L"VT_I4 | VT_ARRAY";
    const static WCHAR *pVT_UI4_ARRAY  = L"VT_UI4 | VT_ARRAY";
    const static WCHAR *pVT_I8_ARRAY   = L"VT_I8 | VT_ARRAY";
    const static WCHAR *pVT_UI8_ARRAY  = L"VT_UI8 | VT_ARRAY";
    const static WCHAR *pVT_R4_ARRAY   = L"VT_R4 | VT_ARRAY";
    const static WCHAR *pVT_R8_ARRAY   = L"VT_R8 | VT_ARRAY";
    const static WCHAR *pVT_BOOL_ARRAY = L"VT_BOOL | VT_ARRAY";
    const static WCHAR *pVT_BSTR_ARRAY = L"VT_BSTR | VT_ARRAY";
    const static WCHAR *pVT_DISPATCH_ARRAY = L"VT_DISPATCH | VT_ARRAY";
    const static WCHAR *pVT_UNKNOWN_ARRAY = L"VT_UNKNOWN | VT_ARRAY";

    const WCHAR *pRetVal;

    switch (v)
    {
    case VT_NULL: pRetVal = pVT_NULL; break;

    case VT_I1: pRetVal = pVT_I1; break;
    case VT_UI1: pRetVal = pVT_UI1; break;
    case VT_I2: pRetVal = pVT_I2; break;
    case VT_UI2: pRetVal = pVT_UI2; break;
    case VT_I4: pRetVal = pVT_I4; break;
    case VT_UI4: pRetVal = pVT_UI4; break;
    case VT_I8: pRetVal = pVT_I8; break;
    case VT_UI8: pRetVal = pVT_UI8; break;
    case VT_R4: pRetVal = pVT_R4; break;
    case VT_R8: pRetVal = pVT_R8; break;
    case VT_BOOL: pRetVal = pVT_BOOL; break;
    case VT_BSTR: pRetVal = pVT_BSTR; break;
    case VT_DISPATCH: pRetVal = pVT_DISPATCH; break;
    case VT_UNKNOWN: pRetVal = pVT_UNKNOWN; break;

    case VT_I1|VT_ARRAY: pRetVal = pVT_I1_ARRAY; break;
    case VT_UI1|VT_ARRAY: pRetVal = pVT_UI1_ARRAY; break;
    case VT_I2|VT_ARRAY: pRetVal = pVT_I2_ARRAY; break;
    case VT_UI2|VT_ARRAY: pRetVal = pVT_UI2_ARRAY; break;
    case VT_I4|VT_ARRAY: pRetVal = pVT_I4_ARRAY; break;
    case VT_UI4|VT_ARRAY: pRetVal = pVT_UI4_ARRAY; break;
    case VT_I8|VT_ARRAY: pRetVal = pVT_I8_ARRAY; break;
    case VT_UI8|VT_ARRAY: pRetVal = pVT_UI8_ARRAY; break;
    case VT_R4|VT_ARRAY: pRetVal = pVT_R4_ARRAY; break;
    case VT_R8|VT_ARRAY: pRetVal = pVT_R8_ARRAY; break;
    case VT_BOOL|VT_ARRAY: pRetVal = pVT_BOOL_ARRAY; break;
    case VT_BSTR|VT_ARRAY: pRetVal = pVT_BSTR_ARRAY; break;
    case VT_DISPATCH|VT_ARRAY: pRetVal = pVT_DISPATCH_ARRAY; break;
    case VT_UNKNOWN|VT_ARRAY: pRetVal = pVT_UNKNOWN_ARRAY; break;

    default: pRetVal = L"<unknown>";
    }

    return pRetVal;
}

const WCHAR* TypeToString ( CIMTYPE v )

Definition at line 284 of file Utils.Cpp.

{
    const static WCHAR *pCIM_UNKNOWN = L"CIM_UNKNOWN";

    const static WCHAR *pCIM_ILLEGAL = L"CIM_ILLEGAL";
    const static WCHAR *pCIM_EMPTY = L"CIM_EMPTY";
    const static WCHAR *pCIM_SINT8 = L"CIM_SINT8";
    const static WCHAR *pCIM_UINT8 = L"CIM_UINT8";
    const static WCHAR *pCIM_SINT16 = L"CIM_SINT16";
    const static WCHAR *pCIM_UINT16 = L"CIM_UINT16";
    const static WCHAR *pCIM_SINT32 = L"CIM_SINT32";
    const static WCHAR *pCIM_UINT32 = L"CIM_UINT32";
    const static WCHAR *pCIM_SINT64 = L"CIM_SINT64";
    const static WCHAR *pCIM_UINT64 = L"CIM_UINT64";
    const static WCHAR *pCIM_REAL32 = L"CIM_REAL32";
    const static WCHAR *pCIM_REAL64 = L"CIM_REAL64";
    const static WCHAR *pCIM_BOOLEAN = L"CIM_BOOLEAN";
    const static WCHAR *pCIM_STRING = L"CIM_STRING";
    const static WCHAR *pCIM_DATETIME = L"CIM_DATETIME";
    const static WCHAR *pCIM_REFERENCE = L"CIM_REFERENCE";
    const static WCHAR *pCIM_OBJECT = L"CIM_OBJECT";

    const static WCHAR *pCIM_ILLEGAL_ARRAY = L"CIM_ILLEGAL | CIM_FLAG_ARRAY";
    const static WCHAR *pCIM_EMPTY_ARRAY = L"CIM_EMPTY | CIM_FLAG_ARRAY";
    const static WCHAR *pCIM_SINT8_ARRAY = L"CIM_SINT8 | CIM_FLAG_ARRAY";
    const static WCHAR *pCIM_UINT8_ARRAY = L"CIM_UINT8 | CIM_FLAG_ARRAY";
    const static WCHAR *pCIM_SINT16_ARRAY = L"CIM_SINT16 | CIM_FLAG_ARRAY";
    const static WCHAR *pCIM_UINT16_ARRAY = L"CIM_UINT16 | CIM_FLAG_ARRAY";
    const static WCHAR *pCIM_SINT32_ARRAY = L"CIM_SINT32 | CIM_FLAG_ARRAY";
    const static WCHAR *pCIM_UINT32_ARRAY = L"CIM_UINT32 | CIM_FLAG_ARRAY";
    const static WCHAR *pCIM_SINT64_ARRAY = L"CIM_SINT64 | CIM_FLAG_ARRAY";
    const static WCHAR *pCIM_UINT64_ARRAY = L"CIM_UINT64 | CIM_FLAG_ARRAY";
    const static WCHAR *pCIM_REAL32_ARRAY = L"CIM_REAL32 | CIM_FLAG_ARRAY";
    const static WCHAR *pCIM_REAL64_ARRAY = L"CIM_REAL64 | CIM_FLAG_ARRAY";
    const static WCHAR *pCIM_BOOLEAN_ARRAY = L"CIM_BOOLEAN | CIM_FLAG_ARRAY";
    const static WCHAR *pCIM_STRING_ARRAY = L"CIM_STRING | CIM_FLAG_ARRAY";
    const static WCHAR *pCIM_DATETIME_ARRAY = L"CIM_DATETIME | CIM_FLAG_ARRAY";
    const static WCHAR *pCIM_REFERENCE_ARRAY = L"CIM_REFERENCE | CIM_FLAG_ARRAY";
    const static WCHAR *pCIM_OBJECT_ARRAY = L"CIM_OBJECT | CIM_FLAG_ARRAY";

    const WCHAR *pRetVal;

    switch (v)
    {
        case CIM_ILLEGAL: pRetVal = pCIM_ILLEGAL; break;
        case CIM_EMPTY: pRetVal = pCIM_EMPTY; break;
        case CIM_SINT8: pRetVal = pCIM_SINT8; break;
        case CIM_UINT8: pRetVal = pCIM_UINT8; break;
        case CIM_SINT16: pRetVal = pCIM_SINT16; break;
        case CIM_UINT16: pRetVal = pCIM_UINT16; break;
        case CIM_SINT32: pRetVal = pCIM_SINT32; break;
        case CIM_UINT32: pRetVal = pCIM_UINT32; break;
        case CIM_SINT64: pRetVal = pCIM_SINT64; break;
        case CIM_UINT64: pRetVal = pCIM_UINT64; break;
        case CIM_REAL32: pRetVal = pCIM_REAL32; break;
        case CIM_REAL64: pRetVal = pCIM_REAL64; break;
        case CIM_BOOLEAN: pRetVal = pCIM_BOOLEAN; break;
        case CIM_STRING: pRetVal = pCIM_STRING; break;
        case CIM_DATETIME: pRetVal = pCIM_DATETIME; break;
        case CIM_REFERENCE: pRetVal = pCIM_REFERENCE; break;
        case CIM_OBJECT: pRetVal = pCIM_OBJECT; break;

        case CIM_SINT8 | CIM_FLAG_ARRAY: pRetVal = pCIM_SINT8_ARRAY; break;
        case CIM_UINT8 | CIM_FLAG_ARRAY: pRetVal = pCIM_UINT8_ARRAY; break;
        case CIM_SINT16 | CIM_FLAG_ARRAY: pRetVal = pCIM_SINT16_ARRAY; break;
        case CIM_UINT16 | CIM_FLAG_ARRAY: pRetVal = pCIM_UINT16_ARRAY; break;
        case CIM_SINT32 | CIM_FLAG_ARRAY: pRetVal = pCIM_SINT32_ARRAY; break;
        case CIM_UINT32 | CIM_FLAG_ARRAY: pRetVal = pCIM_UINT32_ARRAY; break;
        case CIM_SINT64 | CIM_FLAG_ARRAY: pRetVal = pCIM_SINT64_ARRAY; break;
        case CIM_UINT64 | CIM_FLAG_ARRAY: pRetVal = pCIM_UINT64_ARRAY; break;
        case CIM_REAL32 | CIM_FLAG_ARRAY: pRetVal = pCIM_REAL32_ARRAY; break;
        case CIM_REAL64 | CIM_FLAG_ARRAY: pRetVal = pCIM_REAL64_ARRAY; break;
        case CIM_BOOLEAN | CIM_FLAG_ARRAY: pRetVal = pCIM_BOOLEAN_ARRAY; break;
        case CIM_STRING | CIM_FLAG_ARRAY: pRetVal = pCIM_STRING_ARRAY; break;
        case CIM_DATETIME | CIM_FLAG_ARRAY: pRetVal = pCIM_DATETIME_ARRAY; break;
        case CIM_REFERENCE | CIM_FLAG_ARRAY: pRetVal = pCIM_REFERENCE_ARRAY; break;
        case CIM_OBJECT | CIM_FLAG_ARRAY: pRetVal = pCIM_OBJECT_ARRAY; break;

        default: pRetVal = pCIM_UNKNOWN; break;
    }

    return pRetVal;
}

const WCHAR* TypeToString ( VARIANT * p )

Definition at line 196 of file Utils.Cpp.

{
    return TypeToString(p->vt);
}

WCHAR* ValueToString | ( | CIMTYPE | dwType,
 |  | VARIANT * | pValue,
 |  | WCHAR ** | pbuf,
 |  | WCHAR * | fnHandlerVARIANT *pv = NULL
 | ) |  |

Definition at line 372 of file Utils.Cpp.

{
    DWORD iTotBufSize;

    WCHAR *vbuf = NULL;
    WCHAR *buf = NULL;

    WCHAR lbuf[BLOCKSIZE];

    switch (pValue->vt)
    {
        case VT_EMPTY:
        {
            buf = (WCHAR *)malloc(BLOCKSIZE);
            if (buf)
            {
                StringCbCopyW(buf, BLOCKSIZE, L"<empty>");
            }
            break;
        }

        case VT_NULL:
        {
            buf = (WCHAR *)malloc(BLOCKSIZE);
            if (buf)
            {
                StringCbCopyW(buf, BLOCKSIZE, L"<null>");
            }
            break;
        }

        case VT_BOOL:
        {
            VARIANT_BOOL b = pValue->boolVal;
            buf = (WCHAR *)malloc(BLOCKSIZE);
            if (buf)
            {
                if (!b)
                {
                    StringCbCopyW(buf, BLOCKSIZE, L"FALSE");
                }
                else
                {
                    StringCbCopyW(buf, BLOCKSIZE, L"TRUE");
                }
            }
            break;
        }

        case VT_I1:
        {
            char b = pValue->bVal;
            buf = (WCHAR *)malloc(BLOCKSIZE);
            if (buf)
            {
                if (b >= 32)
                {
                    StringCbPrintfW(buf, BLOCKSIZE, L"'%c' (%hd, 0x%hX)", b, (signed char)b, b);
                }
                else
                {
                    StringCbPrintfW(buf, BLOCKSIZE, L"%hd (0x%hX)", (signed char)b, b);
                }
            }
            break;
        }

        case VT_UI1:
        {
            unsigned char b = pValue->bVal;
            buf = (WCHAR *)malloc(BLOCKSIZE);
            if (buf)
            {
                if (b >= 32)
                {
                    StringCbPrintfW(buf, BLOCKSIZE, L"'%c' (%hu, 0x%hX)", b, (unsigned char)b, b);
                }
                else
                {
                    StringCbPrintfW(buf, BLOCKSIZE, L"%hu (0x%hX)", (unsigned char)b, b);
                }
            }
            break;
        }

        case VT_I2:
        {
            SHORT i = pValue->iVal;
            buf = (WCHAR *)malloc(BLOCKSIZE);
            if (buf)
            {
                StringCbPrintfW(buf, BLOCKSIZE, L"%hd (0x%hX)", i, i);
            }
            break;
        }

        case VT_UI2:
        {
            USHORT i = pValue->uiVal;
            buf = (WCHAR *)malloc(BLOCKSIZE);
            if (buf)
            {
                StringCbPrintfW(buf, BLOCKSIZE, L"%hu (0x%hX)", i, i);
            }
            break;
        }

        case VT_I4:
        {
            LONG l = pValue->lVal;
            buf = (WCHAR *)malloc(BLOCKSIZE);
            if (buf)
            {
                StringCbPrintfW(buf, BLOCKSIZE, L"%d (0x%X)", l, l);
            }
            break;
        }

        case VT_UI4:
        {
            ULONG l = pValue->ulVal;
            buf = (WCHAR *)malloc(BLOCKSIZE);
            if (buf)
            {
                StringCbPrintfW(buf, BLOCKSIZE, L"%u (0x%X)", l, l);
            }
            break;
        }

        case VT_R4:
        {
            float f = pValue->fltVal;
            buf = (WCHAR *)malloc(CVTBUFSIZE * sizeof(WCHAR));
            if (buf)
            {
                StringCbPrintfW(buf, BLOCKSIZE,  L"%10.4f", f);
            }
            break;
        }

        case VT_R8:
        {
            double d = pValue->dblVal;
            buf = (WCHAR *)malloc(CVTBUFSIZE * sizeof(WCHAR));
            if (buf)
            {
                StringCbPrintfW(buf, BLOCKSIZE, L"%10.4f", d);
            }
            break;
        }

        case VT_BSTR:
        {
            if (dwType == CIM_SINT64)
            {
                // a little redundant, but it makes me feel better
                LPWSTR pWStr = pValue->bstrVal;
                __int64 l = _wtoi64(pWStr);

                buf = (WCHAR *)malloc(BLOCKSIZE);
                if (buf)
                {
                    StringCbPrintfW(buf, BLOCKSIZE, L"%I64d", l);
                }
            }
            else if (dwType == CIM_UINT64)
            {
                // a little redundant, but it makes me feel better
                LPWSTR pWStr = pValue->bstrVal;
                __int64 l = _wtoi64(pWStr);

                buf = (WCHAR *)malloc(BLOCKSIZE);
                if (buf)
                {
                    StringCbPrintfW(buf, BLOCKSIZE,  L"%I64u", l);
                }
            }
            else // string, datetime, reference
            {
                LPWSTR pWStr = pValue->bstrVal;
                buf = (WCHAR *)malloc((wcslen(pWStr) * sizeof(WCHAR)) + sizeof(WCHAR) + (2 * sizeof(WCHAR)));
                if (buf)
                {
                    StringCbPrintfW(buf, BLOCKSIZE,  L"\"%wS\"", pWStr);
                }
            }
            break;
        }

        case VT_BOOL|VT_ARRAY:
        {
            SAFEARRAY *pVec = pValue->parray;
            long iLBound, iUBound;
            BOOL bFirst = TRUE;

            SafeArrayGetLBound(pVec, 1, &iLBound);
            SafeArrayGetUBound(pVec, 1, &iUBound);
            if ((iUBound - iLBound + 1) == 0)
            {
                buf = (WCHAR *)malloc(BLOCKSIZE);
        if (buf)
        {
          StringCbCopyW(buf, BLOCKSIZE, L"<empty array>");
        }
                break;
            }

            buf = (WCHAR *)malloc((iUBound - iLBound + 1) * BLOCKSIZE);
            if (buf)
            {
                StringCbCopyW(buf, ((iUBound - iLBound + 1) * BLOCKSIZE), L"");

                for (long i = iLBound; i <= iUBound; i++)
                {
                    if (!bFirst)
                    {
                        StringCbCatW(buf, (iUBound - iLBound + 1) * BLOCKSIZE, L",");
                    }
                    else
                    {
                        bFirst = FALSE;
                    }

                    VARIANT_BOOL v;
                    SafeArrayGetElement(pVec, &i, &v);
                    if (v)
                    {
                        StringCbCatW(buf, (iUBound - iLBound + 1) * BLOCKSIZE, L"TRUE");
                    }
                    else
                    {
                        StringCbCatW(buf, (iUBound - iLBound + 1) * BLOCKSIZE, L"FALSE");
                    }
                }
            }

            break;
        }

        case VT_I1|VT_ARRAY:
        {
            SAFEARRAY *pVec = pValue->parray;
            long iLBound, iUBound;
            BOOL bFirst = TRUE;

            SafeArrayGetLBound(pVec, 1, &iLBound);
            SafeArrayGetUBound(pVec, 1, &iUBound);
            if ((iUBound - iLBound + 1) == 0)
            {
                buf = (WCHAR *)malloc(BLOCKSIZE);
        if (buf)
        {
          StringCbCopyW(buf, BLOCKSIZE, L"<empty array>");
        }
                break;
            }

            int bufSize = (iUBound - iLBound + 1) * BLOCKSIZE;
            buf = (WCHAR *)malloc((iUBound - iLBound + 1) * BLOCKSIZE);
            if (buf)
            {

                StringCbCopyW(buf, ((iUBound - iLBound + 1) * BLOCKSIZE), L"");
                WCHAR *pos = buf;
                DWORD len;

                BYTE *pbstr;
                SafeArrayAccessData(pVec, (void HUGEP* FAR*)&pbstr);

                for (long i = iLBound; i <= iUBound; i++)
                {
                    if (!bFirst)
                    {
                        StringCbCopyW(pos, bufSize - (pos - buf) * sizeof(WCHAR), L",");
                        pos += 1;
                    }
                    else
                    {
                        bFirst = FALSE;
                    }

                    char v;
                    //            SafeArrayGetElement(pVec, &i, &v);
                    v = pbstr[i];

                    if (v < 32)
                    {
                        len = StringCbPrintfW(lbuf, sizeof(lbuf), L"%hd (0x%X)", v, v);
                    }
                    else
                    {
                        len = StringCbPrintfW(lbuf, sizeof(lbuf), L"'%c' %hd (0x%X)", v, v, v);
                    }
                    StringCbCopyW(pos, bufSize - (pos - buf)*sizeof(WCHAR), lbuf);
                    pos += len;
                }
            }

            SafeArrayUnaccessData(pVec);

            break;
        }

        case VT_UI1|VT_ARRAY:
        {
            SAFEARRAY *pVec = pValue->parray;
            long iLBound, iUBound;
            BOOL bFirst = TRUE;

            SafeArrayGetLBound(pVec, 1, &iLBound);
            SafeArrayGetUBound(pVec, 1, &iUBound);
            if ((iUBound - iLBound + 1) == 0)
            {
                buf = (WCHAR *)malloc(BLOCKSIZE);
        if (buf)
        {
          StringCbCopyW(buf, BLOCKSIZE, L"<empty array>");
        }
                break;
            }

      int bufsize = (iUBound - iLBound + 1) * BLOCKSIZE;
            buf = (WCHAR *)malloc(bufsize);
            if (buf)
            {
                StringCbCopyW(buf, bufsize, L"");
                WCHAR *pos = buf;
                DWORD len;

                BYTE *pbstr;
                SafeArrayAccessData(pVec, (void HUGEP* FAR*)&pbstr);

                for (long i = iLBound; i <= iUBound; i++)
                {
                    if (!bFirst)
                    {
                        StringCbCopyW(pos, bufsize - ((pos - buf)*sizeof(WCHAR)), L",");
                        pos += 1;
                    }
                    else
                    {
                        bFirst = FALSE;
                    }

                    unsigned char v;
                    //            SafeArrayGetElement(pVec, &i, &v);
                    v = pbstr[i];

                    if (v < 32)
                    {
                        len = StringCbPrintfW(lbuf, sizeof(lbuf), L"%hu (0x%X)", v, v);
                    }
                    else
                    {
                        len = StringCbPrintfW(lbuf, sizeof(lbuf), L"'%c' %hu (0x%X)", v, v, v);
                    }

                    StringCbCopyW(pos, bufsize - ((pos - buf)*sizeof(WCHAR)), lbuf);
                    pos += len;
                }
            }

            SafeArrayUnaccessData(pVec);

            break;
        }

        case VT_I2|VT_ARRAY:
        {
            SAFEARRAY *pVec = pValue->parray;
            long iLBound, iUBound;
            BOOL bFirst = TRUE;

            SafeArrayGetLBound(pVec, 1, &iLBound);
            SafeArrayGetUBound(pVec, 1, &iUBound);
            if ((iUBound - iLBound + 1) == 0)
            {
                buf = (WCHAR *)malloc(BLOCKSIZE);
        if (buf)
        {
          StringCbCopyW(buf, BLOCKSIZE, L"<empty array>");
        }
                break;
            }

            buf = (WCHAR *)malloc((iUBound - iLBound + 1) * BLOCKSIZE);
            if (buf)
            {
                StringCbCopyW(buf, ((iUBound - iLBound + 1) * BLOCKSIZE), L"");

                for (long i = iLBound; i <= iUBound; i++)
                {
                    if (!bFirst)
                    {
                        StringCbCatW(buf, ((iUBound - iLBound + 1) * BLOCKSIZE), L",");
                    }
                    else
                    {
                        bFirst = FALSE;
                    }

                    SHORT v;
                    SafeArrayGetElement(pVec, &i, &v);
                    StringCbPrintfW(lbuf, sizeof(lbuf), L"%hd", v);
                    StringCbCatW(buf, ((iUBound - iLBound + 1) * BLOCKSIZE), lbuf);
                }
            }

            break;
        }

        case VT_UI2|VT_ARRAY:
        {
            SAFEARRAY *pVec = pValue->parray;
            long iLBound, iUBound;
            BOOL bFirst = TRUE;

            SafeArrayGetLBound(pVec, 1, &iLBound);
            SafeArrayGetUBound(pVec, 1, &iUBound);
            if ((iUBound - iLBound + 1) == 0)
            {
                buf = (WCHAR *)malloc(BLOCKSIZE);
        if (buf)
        {
                  StringCbCopyW(buf, BLOCKSIZE, L"<empty array>");
        }
                break;
            }

            buf = (WCHAR *)malloc((iUBound - iLBound + 1) * BLOCKSIZE);
            if (buf)
            {
                StringCbCopyW(buf, ((iUBound - iLBound + 1) * BLOCKSIZE), L"");

                for (long i = iLBound; i <= iUBound; i++)
                {
                    if (!bFirst)
                    {
                        StringCbCatW(buf, ((iUBound - iLBound + 1) * BLOCKSIZE), L",");
                    }
                    else
                    {
                        bFirst = FALSE;
                    }

                    USHORT v;
                    SafeArrayGetElement(pVec, &i, &v);
                    StringCbPrintfW(lbuf, sizeof(lbuf), L"%hu", v);
                    StringCbCatW(buf, ((iUBound - iLBound + 1) * BLOCKSIZE), lbuf);
                }
            }

            break;
        }

        case VT_I4|VT_ARRAY:
        {
            SAFEARRAY *pVec = pValue->parray;
            long iLBound, iUBound;
            BOOL bFirst = TRUE;

            SafeArrayGetLBound(pVec, 1, &iLBound);
            SafeArrayGetUBound(pVec, 1, &iUBound);
            if ((iUBound - iLBound + 1) == 0)
            {
                buf = (WCHAR *)malloc(BLOCKSIZE);
        if (buf)
        {
                  StringCbCopyW(buf, BLOCKSIZE, L"<empty array>");
        }
                break;
            }

            buf = (WCHAR *)malloc((iUBound - iLBound + 1) * BLOCKSIZE);
            if (buf)
            {
                StringCbCopyW(buf, ((iUBound - iLBound + 1) * BLOCKSIZE), L"");

                for (long i = iLBound; i <= iUBound; i++)
                {
                    if (!bFirst)
                    {
                        StringCbCatW(buf,((iUBound - iLBound + 1) * BLOCKSIZE), L",");
                    }
                    else
                    {
                        bFirst = FALSE;
                    }

                    LONG v;
                    SafeArrayGetElement(pVec, &i, &v);
                    _ltow(v, lbuf, 10);
                    StringCbCatW(buf, ((iUBound - iLBound + 1) * BLOCKSIZE), lbuf);
                }
            }

            break;
        }

        case VT_UI4|VT_ARRAY:
        {
            SAFEARRAY *pVec = pValue->parray;
            long iLBound, iUBound;
            BOOL bFirst = TRUE;

            SafeArrayGetLBound(pVec, 1, &iLBound);
            SafeArrayGetUBound(pVec, 1, &iUBound);
            if ((iUBound - iLBound + 1) == 0)
            {
                buf = (WCHAR *)malloc(BLOCKSIZE);
        if (buf)
        {
                  StringCbCopyW(buf, BLOCKSIZE, L"<empty array>");
        }
                break;
            }

            buf = (WCHAR *)malloc((iUBound - iLBound + 1) * BLOCKSIZE);
            if (buf)
            {
                StringCbCopyW(buf, ((iUBound - iLBound + 1) * BLOCKSIZE), L"");

                for (long i = iLBound; i <= iUBound; i++)
                {
                    if (!bFirst)
                    {
                        StringCbCatW(buf, ((iUBound - iLBound + 1) * BLOCKSIZE), L",");
                    }
                    else
                    {
                        bFirst = FALSE;
                    }

                    ULONG v;
                    SafeArrayGetElement(pVec, &i, &v);
                    _ultow(v, lbuf, 10);
                    StringCbCatW(buf, ((iUBound - iLBound + 1) * BLOCKSIZE), lbuf);
                }
            }

            break;
        }

        case CIM_REAL32|VT_ARRAY:
        {
            SAFEARRAY *pVec = pValue->parray;
            long iLBound, iUBound;
            BOOL bFirst = TRUE;

            SafeArrayGetLBound(pVec, 1, &iLBound);
            SafeArrayGetUBound(pVec, 1, &iUBound);
            if ((iUBound - iLBound + 1) == 0)
            {
                buf = (WCHAR *)malloc(BLOCKSIZE);
        if (buf)
        {
                  StringCbCopyW(buf, BLOCKSIZE, L"<empty array>");
        }
                break;
            }

            int bufSize = (iUBound - iLBound + 1) * (CVTBUFSIZE * sizeof(WCHAR));
            buf = (WCHAR *)malloc(bufSize);
            if (buf)
            {
                StringCbCopyW(buf,  bufSize, L"");

                for (long i = iLBound; i <= iUBound; i++)
                {
                    if (!bFirst)
                    {
                        StringCbCatW(buf, bufSize, L",");
                    }
                    else
                    {
                        bFirst = FALSE;
                    }

                    FLOAT v;
                    SafeArrayGetElement(pVec, &i, &v);
                    StringCbPrintfW(lbuf, sizeof(lbuf), L"%10.4f", v);
                    StringCbCatW(buf, bufSize, lbuf);
                }
            }

            break;
        }

        case CIM_REAL64|VT_ARRAY:
        {
            SAFEARRAY *pVec = pValue->parray;
            long iLBound, iUBound;
            BOOL bFirst = TRUE;

            SafeArrayGetLBound(pVec, 1, &iLBound);
            SafeArrayGetUBound(pVec, 1, &iUBound);
            if ((iUBound - iLBound + 1) == 0)
            {
                buf = (WCHAR *)malloc(BLOCKSIZE);
        if (buf)
        {
                  StringCbCopyW(buf, BLOCKSIZE, L"<empty array>");
        }
                break;
            }

            int bufSize = (iUBound - iLBound + 1) * (CVTBUFSIZE * sizeof(WCHAR));
            buf = (WCHAR *)malloc(bufSize);
            if (buf)
            {
                StringCbCopyW(buf, bufSize, L"");

                for (long i = iLBound; i <= iUBound; i++)
                {
                    if (!bFirst)
                    {
                        StringCbCatW(buf, bufSize, L",");
                    }
                    else
                    {
                        bFirst = FALSE;
                    }

                    double v;
                    SafeArrayGetElement(pVec, &i, &v);
                    StringCbPrintfW(lbuf, sizeof(lbuf), L"%10.4f", v);
                    StringCbCatW(buf, bufSize, lbuf);
                }
            }

            break;
        }

        case VT_BSTR|VT_ARRAY:
        {
            if (dwType == (CIM_UINT64|VT_ARRAY))
            {
                SAFEARRAY *pVec = pValue->parray;
                long iLBound, iUBound;
                BOOL bFirst = TRUE;

                SafeArrayGetLBound(pVec, 1, &iLBound);
                SafeArrayGetUBound(pVec, 1, &iUBound);
                if ((iUBound - iLBound + 1) == 0)
                {
                    buf = (WCHAR *)malloc(BLOCKSIZE);
          if (buf)
          {
                      StringCbCopyW(buf, BLOCKSIZE, L"<empty array>");
          }
                    break;
                }

                buf = (WCHAR *)malloc((iUBound - iLBound + 1) * BLOCKSIZE);
                if (buf)
                {
                    StringCbCopyW(buf, ((iUBound - iLBound + 1) * BLOCKSIZE), L"");

                    for (long i = iLBound; i <= iUBound; i++)
                    {
                        if (!bFirst)
                        {
                            StringCbCatW(buf, ((iUBound - iLBound + 1) * BLOCKSIZE), L",");
                        }
                        else
                        {
                            bFirst = FALSE;
                        }

                        BSTR v = NULL;

                        SafeArrayGetElement(pVec, &i, &v);

                        StringCbPrintfW(lbuf, sizeof(lbuf), L"%I64u", _wtoi64(v));
                        StringCbCatW(buf, ((iUBound - iLBound + 1) * BLOCKSIZE), lbuf);
                    }
                }
            }
            else if (dwType == (CIM_SINT64|VT_ARRAY))
            {
                SAFEARRAY *pVec = pValue->parray;
                long iLBound, iUBound;
                BOOL bFirst = TRUE;

                SafeArrayGetLBound(pVec, 1, &iLBound);
                SafeArrayGetUBound(pVec, 1, &iUBound);
                if ((iUBound - iLBound + 1) == 0)
                {
                    buf = (WCHAR *)malloc(BLOCKSIZE);
          if (buf)
          {
                      StringCbCopyW(buf, BLOCKSIZE, L"<empty array>");
          }
                    break;
                }

                buf = (WCHAR *)malloc((iUBound - iLBound + 1) * BLOCKSIZE);
                if (buf)
                {
                    StringCbCopyW(buf, ((iUBound - iLBound + 1) * BLOCKSIZE), L"");

                    for (long i = iLBound; i <= iUBound; i++)
                    {
                        if (!bFirst)
                        {
                            StringCbCatW(buf, ((iUBound - iLBound + 1) * BLOCKSIZE), L",");
                        }
                        else
                        {
                            bFirst = FALSE;
                        }

                        BSTR v = NULL;

                        SafeArrayGetElement(pVec, &i, &v);

                        StringCbPrintfW(lbuf, sizeof(lbuf), L"%I64d", _wtoi64(v));
                        StringCbCatW(buf, ((iUBound - iLBound + 1) * BLOCKSIZE), lbuf);
                    }
                }
            }
            else // string, datetime, reference
            {
                SAFEARRAY *pVec = pValue->parray;
                long iLBound, iUBound;
                DWORD iNeed;
                size_t iVSize;
                DWORD iCurBufSize;

                SafeArrayGetLBound(pVec, 1, &iLBound);
                SafeArrayGetUBound(pVec, 1, &iUBound);
                if ((iUBound - iLBound + 1) == 0)
                {
                    buf = (WCHAR *)malloc(BLOCKSIZE);
          if (buf)
          {
                      StringCbCopyW(buf, BLOCKSIZE, L"<empty array>");
          }
                    break;
                }

                iTotBufSize = (iUBound - iLBound + 1) * BLOCKSIZE;
                buf = (WCHAR *)malloc(iTotBufSize);
                if (buf)
                {
                    buf[0] = L'\0';
                    iCurBufSize = 0;
                    iVSize = BLOCKSIZE;
                    vbuf = (WCHAR *)malloc(BLOCKSIZE);
                    if (vbuf)
                    {
                        size_t iLen;

                        for (long i = iLBound; i <= iUBound; i++)
                        {
                            BSTR v = NULL;
                            SafeArrayGetElement(pVec, &i, &v);
                            iLen = (SysStringLen(v) + 1) * sizeof(WCHAR);
                            if (iLen > iVSize)
                            {
                                vbuf = (WCHAR *)realloc(vbuf, iLen + sizeof(WCHAR));
                                iVSize = iLen;
                            }

                            // String size + (quotes + comma + null)
              if (vbuf)
              {
                iNeed = (StringCbPrintfW(vbuf, iVSize, L"%wS", v) + 4) * sizeof(WCHAR);
                if (iNeed + iCurBufSize > iTotBufSize)
                {
                  iTotBufSize += (iNeed * 2);  // Room enough for 2 more entries
                  buf = (WCHAR *)realloc(buf, iTotBufSize);
                }
                if (buf)
                {
                  StringCbCatW(buf, iTotBufSize, L"\"");
                  StringCbCatW(buf, iTotBufSize, vbuf);
                  if (i + 1 <= iUBound)
                  {
                    StringCbCatW(buf, iTotBufSize, L"\",");
                  }
                  else
                  {
                    StringCbCatW(buf, iTotBufSize, L"\"");
                  }
                  iCurBufSize += iNeed;
                }
              }
                            SysFreeString(v);
                        }
                        free(vbuf);
                    }
                }
            }

            break;
        }

        default:
        {
            if (fnHandler != NULL)
            {
                buf = fnHandler(pValue);
            }
            else
            {
                buf = (WCHAR *)malloc(BLOCKSIZE);
                if (buf)
                {
                    StringCbCopyW(buf, BLOCKSIZE, L"<conversion error>");
                }
            }
            break;
        }
   }

   if (!buf)
   {
       PrintErrorAndExit("ValueToString() out of memory", S_OK, 0);
   }

   *pbuf = buf;
   return buf;
}

BSTR WbemErrorString ( SCODE sc )

Definition at line 34 of file Utils.Cpp.

{
    IWbemStatusCodeTextPtr pStatus;
    BSTR bstr = NULL;

    SCODE mysc = CoCreateInstance(CLSID_WbemStatusCodeText, 0, CLSCTX_INPROC_SERVER,
        IID_IWbemStatusCodeText, (LPVOID *) &pStatus);

    if (mysc == S_OK)
    {
        mysc = pStatus->GetErrorCodeText(sc, 0, 0, &bstr);
        if (mysc == S_OK)
        {
        }
        else
        {
            WCHAR szBuffer2[MAXITOA];
            WCHAR szBuffer[sizeof(szBuffer2) + 4];

            _ltow(sc, szBuffer2, 16);
      StringCbCopyW(szBuffer, sizeof(szBuffer), L"0x");
      StringCbCatW(szBuffer, sizeof(szBuffer), szBuffer2);
            bstr = SysAllocString(szBuffer);
        }
    }

    return bstr;
}

Generated on Wed Nov 13 2024 16:54:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/UtilLib/Utils.Cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • UtilLib
Defines | Functions

Utils.Cpp File Reference

#include "precomp.h"
#include <stdio.h>
#include <wbemidl.h>
#include <sys\timeb.h>
#include <strsafe.h>
#include "utillib.h"

Go to the source code of this file.

Defines

#define | STRSAFE_NO_DEPRECATE

Functions

char * | cvt (WCHAR *x, char **y)
double | difftime (struct _timeb finish, struct _timeb start)
void | PrintError (char *pszFailureReason, SCODE psc, DWORD dwMode)
void | PrintErrorAndAsk (char *pszFailureReason, SCODE sc, DWORD dwMode)
void | PrintErrorAndExit (char *pszFailureReason, SCODE sc, DWORD dwMode)
const WCHAR * | TypeToString (VARTYPE v)
const WCHAR * | TypeToString (VARIANT *p)
const WCHAR * | TypeToString (CIMTYPE v)
WCHAR * | ValueToString (CIMTYPE dwType, VARIANT *pValue, WCHAR **pbuf, WCHAR *fnHandler(VARIANT *pv))
BSTR | WbemErrorString (SCODE sc)

Define Documentation

#define STRSAFE_NO_DEPRECATE

Definition at line 17 of file Utils.Cpp.

Function Documentation

char* cvt | ( | WCHAR * | x,
 |  | char ** | y
 | ) |  |

Definition at line 1202 of file Utils.Cpp.

{
    int dwRet, i;
    i = WideCharToMultiByte( CP_OEMCP,
        0,
        x,
        -1,
        NULL,
        0,
        NULL,
        NULL);

  if (i == 0)
  {
        PrintErrorAndExit("cvt() failed", S_OK, 0);
    }

    *y = (char *)calloc(i, 1);

    if (*y)
    {
        dwRet = WideCharToMultiByte( CP_OEMCP,
            0,
            x,
            -1,
            *y,
            i,
            NULL,
            NULL);

        if (dwRet == 0)
        {
            free(*y);
            *y = (char *)malloc(sizeof(CVTFAILED));
            if (*y)
            {
                memcpy(*y, CVTFAILED, sizeof(CVTFAILED));
            }
      else
      {
        PrintErrorAndExit("cvt() out of memory", S_OK, 0);
      }
        }
    }
    else
    {
        PrintErrorAndExit("cvt() out of memory", S_OK, 0);
    }

    return *y;
}

double difftime | ( | struct _timeb | finish,
 |  | struct _timeb | start
 | ) |  |

Definition at line 1260 of file Utils.Cpp.

{
    double dRet;

    if (start.millitm > finish.millitm)
    {
        dRet = ((finish.time - start.time) - 1) + (double)(((1000 + finish.millitm) - start.millitm) / 1000.0);
    }
    else
    {
        dRet = (finish.time - start.time) + (double)((finish.millitm - start.millitm) / 1000.0);
    }

    return dRet;
}

void PrintError | ( | char * | pszFailureReason,
 |  | SCODE | psc,
 |  | DWORD | dwMode
 | ) |  |

Definition at line 67 of file Utils.Cpp.

{
    VARIANT varString;
    SCODE sc;
    IWbemClassObject *pErrorObject = NULL;
    IErrorInfo* pEI = NULL;

    fprintf(stdout, "%s\n", pszFailureReason);
    fprintf(stdout, "FunctionReturn: %S(0x%08lx)\n", WbemErrorString(psc), psc);

    if (GetErrorInfo(0, &pEI) == S_OK)
    {
        pEI->QueryInterface(IID_IWbemClassObject, (void**)&pErrorObject);
        pEI->Release();
    }

    if (pErrorObject != NULL)
    {
        VariantInit(&varString);

        if (dwMode == ERROR_MODE_PRINTFIELDS)
        {
            if (pErrorObject->InheritsFrom(L"__NotifyStatus") != WBEM_NO_ERROR)
            {
                fprintf(stdout, "Unrecognized Error Object type\n");
            }
            else if (pErrorObject->InheritsFrom(L"__ExtendedStatus") == WBEM_NO_ERROR)
            {
                sc = pErrorObject->Get(L"Description", 0L, &varString, NULL, NULL);
                if (sc != S_OK)
                {
                    fprintf(stdout, "Can't get Description: %d\n", sc);
                }
                else if (V_VT(&varString) == VT_BSTR)
                {
                    FWPRINTF(stdout, L"Description: %wS\n", V_BSTR(&varString));
                }
                VariantClear(&varString);

                pErrorObject->Get(L"Operation", 0L, &varString, NULL, NULL);
                if (sc != S_OK)
                {
                    fprintf(stdout, "Can't get Operation: %d\n", sc);
                }
                else if (V_VT(&varString) == VT_BSTR)
                {
                    FWPRINTF(stdout, L"Operation: %wS\n", V_BSTR(&varString));
                }
                VariantClear(&varString);

                pErrorObject->Get(L"ParameterInfo", 0L, &varString, NULL, NULL);
                if (sc != S_OK)
                {
                    fprintf(stdout, "Can't get ParameterInfo: %d\n", sc);
                }
                else if (V_VT(&varString) == VT_BSTR)
                {
                    FWPRINTF(stdout, L"ParameterInfo: %wS\n", V_BSTR(&varString));
                }
                VariantClear(&varString);

                pErrorObject->Get(L"ProviderName", 0L, &varString, NULL, NULL);
                if (sc != S_OK)
                {
                    fprintf(stdout, "Can't get ProviderName: %d\n", sc);
                }
                else if (V_VT(&varString) == VT_BSTR)
                {
                    FWPRINTF(stdout, L"ProviderName: %wS\n", V_BSTR(&varString));
                }
                VariantClear(&varString);
            }
        }
        else
        {
            BSTR bstrObjectText = NULL;
            if (SUCCEEDED(pErrorObject->GetObjectText(0, &bstrObjectText)))
            {
                fprintf(stdout, "%wS", bstrObjectText);
                SysFreeString(bstrObjectText);
            }
        }

        RELEASE(pErrorObject);
    }
}

void PrintErrorAndAsk | ( | char * | pszFailureReason,
 |  | SCODE | sc,
 |  | DWORD | dwMode
 | ) |  |

Definition at line 172 of file Utils.Cpp.

{
    int c;

    PrintError(pszFailureReason, sc, dwMode);
    printf("Continue (Y/N)? ");

    c = getchar();
    while (getchar() != '\n')
    {
    }

    if ((c != 'Y') && (c != 'y'))
    {
        // Clean up and exit
        OleUninitialize();
        exit(1);
    }
};

void PrintErrorAndExit | ( | char * | pszFailureReason,
 |  | SCODE | sc,
 |  | DWORD | dwMode
 | ) |  |

Definition at line 158 of file Utils.Cpp.

{
    PrintError(pszFailureReason, sc, dwMode);

    // Clean up and exit
    OleUninitialize();
    printf("Abnormal Termination\n");
    exit(1);
};

const WCHAR* TypeToString ( VARTYPE v )

Definition at line 205 of file Utils.Cpp.

{
    const static WCHAR *pVT_NULL  = L"VT_NULL";
    const static WCHAR *pVT_EMTPY = L"VT_EMPTY";
    const static WCHAR *pVT_I1    = L"VT_I1";
    const static WCHAR *pVT_UI1   = L"VT_UI1";
    const static WCHAR *pVT_I2    = L"VT_I2";
    const static WCHAR *pVT_UI2   = L"VT_UI2";
    const static WCHAR *pVT_I4    = L"VT_I4";
    const static WCHAR *pVT_UI4   = L"VT_UI4";
    const static WCHAR *pVT_I8    = L"VT_I8";
    const static WCHAR *pVT_UI8   = L"VT_UI8";
    const static WCHAR *pVT_R4    = L"VT_R4";
    const static WCHAR *pVT_R8    = L"VT_R8";
    const static WCHAR *pVT_BOOL  = L"VT_BOOL";
    const static WCHAR *pVT_BSTR  = L"VT_BSTR";
    const static WCHAR *pVT_DISPATCH = L"VT_DISPATCH";
    const static WCHAR *pVT_UNKNOWN = L"VT_UNKNOWN";
    const static WCHAR *pVT_I1_ARRAY = L"VT_I1 | VT_ARRAY";
    const static WCHAR *pVT_UI1_ARRAY  = L"VT_UI1 | VT_ARRAY";
    const static WCHAR *pVT_I2_ARRAY   = L"VT_I2 | VT_ARRAY";
    const static WCHAR *pVT_UI2_ARRAY  = L"VT_UI2 | VT_ARRAY";
    const static WCHAR *pVT_I4_ARRAY   = L"VT_I4 | VT_ARRAY";
    const static WCHAR *pVT_UI4_ARRAY  = L"VT_UI4 | VT_ARRAY";
    const static WCHAR *pVT_I8_ARRAY   = L"VT_I8 | VT_ARRAY";
    const static WCHAR *pVT_UI8_ARRAY  = L"VT_UI8 | VT_ARRAY";
    const static WCHAR *pVT_R4_ARRAY   = L"VT_R4 | VT_ARRAY";
    const static WCHAR *pVT_R8_ARRAY   = L"VT_R8 | VT_ARRAY";
    const static WCHAR *pVT_BOOL_ARRAY = L"VT_BOOL | VT_ARRAY";
    const static WCHAR *pVT_BSTR_ARRAY = L"VT_BSTR | VT_ARRAY";
    const static WCHAR *pVT_DISPATCH_ARRAY = L"VT_DISPATCH | VT_ARRAY";
    const static WCHAR *pVT_UNKNOWN_ARRAY = L"VT_UNKNOWN | VT_ARRAY";

    const WCHAR *pRetVal;

    switch (v)
    {
    case VT_NULL: pRetVal = pVT_NULL; break;

    case VT_I1: pRetVal = pVT_I1; break;
    case VT_UI1: pRetVal = pVT_UI1; break;
    case VT_I2: pRetVal = pVT_I2; break;
    case VT_UI2: pRetVal = pVT_UI2; break;
    case VT_I4: pRetVal = pVT_I4; break;
    case VT_UI4: pRetVal = pVT_UI4; break;
    case VT_I8: pRetVal = pVT_I8; break;
    case VT_UI8: pRetVal = pVT_UI8; break;
    case VT_R4: pRetVal = pVT_R4; break;
    case VT_R8: pRetVal = pVT_R8; break;
    case VT_BOOL: pRetVal = pVT_BOOL; break;
    case VT_BSTR: pRetVal = pVT_BSTR; break;
    case VT_DISPATCH: pRetVal = pVT_DISPATCH; break;
    case VT_UNKNOWN: pRetVal = pVT_UNKNOWN; break;

    case VT_I1|VT_ARRAY: pRetVal = pVT_I1_ARRAY; break;
    case VT_UI1|VT_ARRAY: pRetVal = pVT_UI1_ARRAY; break;
    case VT_I2|VT_ARRAY: pRetVal = pVT_I2_ARRAY; break;
    case VT_UI2|VT_ARRAY: pRetVal = pVT_UI2_ARRAY; break;
    case VT_I4|VT_ARRAY: pRetVal = pVT_I4_ARRAY; break;
    case VT_UI4|VT_ARRAY: pRetVal = pVT_UI4_ARRAY; break;
    case VT_I8|VT_ARRAY: pRetVal = pVT_I8_ARRAY; break;
    case VT_UI8|VT_ARRAY: pRetVal = pVT_UI8_ARRAY; break;
    case VT_R4|VT_ARRAY: pRetVal = pVT_R4_ARRAY; break;
    case VT_R8|VT_ARRAY: pRetVal = pVT_R8_ARRAY; break;
    case VT_BOOL|VT_ARRAY: pRetVal = pVT_BOOL_ARRAY; break;
    case VT_BSTR|VT_ARRAY: pRetVal = pVT_BSTR_ARRAY; break;
    case VT_DISPATCH|VT_ARRAY: pRetVal = pVT_DISPATCH_ARRAY; break;
    case VT_UNKNOWN|VT_ARRAY: pRetVal = pVT_UNKNOWN_ARRAY; break;

    default: pRetVal = L"<unknown>";
    }

    return pRetVal;
}

const WCHAR* TypeToString ( VARIANT * p )

Definition at line 196 of file Utils.Cpp.

{
    return TypeToString(p->vt);
}

const WCHAR* TypeToString ( CIMTYPE v )

Definition at line 284 of file Utils.Cpp.

{
    const static WCHAR *pCIM_UNKNOWN = L"CIM_UNKNOWN";

    const static WCHAR *pCIM_ILLEGAL = L"CIM_ILLEGAL";
    const static WCHAR *pCIM_EMPTY = L"CIM_EMPTY";
    const static WCHAR *pCIM_SINT8 = L"CIM_SINT8";
    const static WCHAR *pCIM_UINT8 = L"CIM_UINT8";
    const static WCHAR *pCIM_SINT16 = L"CIM_SINT16";
    const static WCHAR *pCIM_UINT16 = L"CIM_UINT16";
    const static WCHAR *pCIM_SINT32 = L"CIM_SINT32";
    const static WCHAR *pCIM_UINT32 = L"CIM_UINT32";
    const static WCHAR *pCIM_SINT64 = L"CIM_SINT64";
    const static WCHAR *pCIM_UINT64 = L"CIM_UINT64";
    const static WCHAR *pCIM_REAL32 = L"CIM_REAL32";
    const static WCHAR *pCIM_REAL64 = L"CIM_REAL64";
    const static WCHAR *pCIM_BOOLEAN = L"CIM_BOOLEAN";
    const static WCHAR *pCIM_STRING = L"CIM_STRING";
    const static WCHAR *pCIM_DATETIME = L"CIM_DATETIME";
    const static WCHAR *pCIM_REFERENCE = L"CIM_REFERENCE";
    const static WCHAR *pCIM_OBJECT = L"CIM_OBJECT";

    const static WCHAR *pCIM_ILLEGAL_ARRAY = L"CIM_ILLEGAL | CIM_FLAG_ARRAY";
    const static WCHAR *pCIM_EMPTY_ARRAY = L"CIM_EMPTY | CIM_FLAG_ARRAY";
    const static WCHAR *pCIM_SINT8_ARRAY = L"CIM_SINT8 | CIM_FLAG_ARRAY";
    const static WCHAR *pCIM_UINT8_ARRAY = L"CIM_UINT8 | CIM_FLAG_ARRAY";
    const static WCHAR *pCIM_SINT16_ARRAY = L"CIM_SINT16 | CIM_FLAG_ARRAY";
    const static WCHAR *pCIM_UINT16_ARRAY = L"CIM_UINT16 | CIM_FLAG_ARRAY";
    const static WCHAR *pCIM_SINT32_ARRAY = L"CIM_SINT32 | CIM_FLAG_ARRAY";
    const static WCHAR *pCIM_UINT32_ARRAY = L"CIM_UINT32 | CIM_FLAG_ARRAY";
    const static WCHAR *pCIM_SINT64_ARRAY = L"CIM_SINT64 | CIM_FLAG_ARRAY";
    const static WCHAR *pCIM_UINT64_ARRAY = L"CIM_UINT64 | CIM_FLAG_ARRAY";
    const static WCHAR *pCIM_REAL32_ARRAY = L"CIM_REAL32 | CIM_FLAG_ARRAY";
    const static WCHAR *pCIM_REAL64_ARRAY = L"CIM_REAL64 | CIM_FLAG_ARRAY";
    const static WCHAR *pCIM_BOOLEAN_ARRAY = L"CIM_BOOLEAN | CIM_FLAG_ARRAY";
    const static WCHAR *pCIM_STRING_ARRAY = L"CIM_STRING | CIM_FLAG_ARRAY";
    const static WCHAR *pCIM_DATETIME_ARRAY = L"CIM_DATETIME | CIM_FLAG_ARRAY";
    const static WCHAR *pCIM_REFERENCE_ARRAY = L"CIM_REFERENCE | CIM_FLAG_ARRAY";
    const static WCHAR *pCIM_OBJECT_ARRAY = L"CIM_OBJECT | CIM_FLAG_ARRAY";

    const WCHAR *pRetVal;

    switch (v)
    {
        case CIM_ILLEGAL: pRetVal = pCIM_ILLEGAL; break;
        case CIM_EMPTY: pRetVal = pCIM_EMPTY; break;
        case CIM_SINT8: pRetVal = pCIM_SINT8; break;
        case CIM_UINT8: pRetVal = pCIM_UINT8; break;
        case CIM_SINT16: pRetVal = pCIM_SINT16; break;
        case CIM_UINT16: pRetVal = pCIM_UINT16; break;
        case CIM_SINT32: pRetVal = pCIM_SINT32; break;
        case CIM_UINT32: pRetVal = pCIM_UINT32; break;
        case CIM_SINT64: pRetVal = pCIM_SINT64; break;
        case CIM_UINT64: pRetVal = pCIM_UINT64; break;
        case CIM_REAL32: pRetVal = pCIM_REAL32; break;
        case CIM_REAL64: pRetVal = pCIM_REAL64; break;
        case CIM_BOOLEAN: pRetVal = pCIM_BOOLEAN; break;
        case CIM_STRING: pRetVal = pCIM_STRING; break;
        case CIM_DATETIME: pRetVal = pCIM_DATETIME; break;
        case CIM_REFERENCE: pRetVal = pCIM_REFERENCE; break;
        case CIM_OBJECT: pRetVal = pCIM_OBJECT; break;

        case CIM_SINT8 | CIM_FLAG_ARRAY: pRetVal = pCIM_SINT8_ARRAY; break;
        case CIM_UINT8 | CIM_FLAG_ARRAY: pRetVal = pCIM_UINT8_ARRAY; break;
        case CIM_SINT16 | CIM_FLAG_ARRAY: pRetVal = pCIM_SINT16_ARRAY; break;
        case CIM_UINT16 | CIM_FLAG_ARRAY: pRetVal = pCIM_UINT16_ARRAY; break;
        case CIM_SINT32 | CIM_FLAG_ARRAY: pRetVal = pCIM_SINT32_ARRAY; break;
        case CIM_UINT32 | CIM_FLAG_ARRAY: pRetVal = pCIM_UINT32_ARRAY; break;
        case CIM_SINT64 | CIM_FLAG_ARRAY: pRetVal = pCIM_SINT64_ARRAY; break;
        case CIM_UINT64 | CIM_FLAG_ARRAY: pRetVal = pCIM_UINT64_ARRAY; break;
        case CIM_REAL32 | CIM_FLAG_ARRAY: pRetVal = pCIM_REAL32_ARRAY; break;
        case CIM_REAL64 | CIM_FLAG_ARRAY: pRetVal = pCIM_REAL64_ARRAY; break;
        case CIM_BOOLEAN | CIM_FLAG_ARRAY: pRetVal = pCIM_BOOLEAN_ARRAY; break;
        case CIM_STRING | CIM_FLAG_ARRAY: pRetVal = pCIM_STRING_ARRAY; break;
        case CIM_DATETIME | CIM_FLAG_ARRAY: pRetVal = pCIM_DATETIME_ARRAY; break;
        case CIM_REFERENCE | CIM_FLAG_ARRAY: pRetVal = pCIM_REFERENCE_ARRAY; break;
        case CIM_OBJECT | CIM_FLAG_ARRAY: pRetVal = pCIM_OBJECT_ARRAY; break;

        default: pRetVal = pCIM_UNKNOWN; break;
    }

    return pRetVal;
}

WCHAR* ValueToString | ( | CIMTYPE | dwType,
 |  | VARIANT * | pValue,
 |  | WCHAR ** | pbuf,
 |  | WCHAR * | fnHandlerVARIANT *pv
 | ) |  |

Definition at line 372 of file Utils.Cpp.

{
    DWORD iTotBufSize;

    WCHAR *vbuf = NULL;
    WCHAR *buf = NULL;

    WCHAR lbuf[BLOCKSIZE];

    switch (pValue->vt)
    {
        case VT_EMPTY:
        {
            buf = (WCHAR *)malloc(BLOCKSIZE);
            if (buf)
            {
                StringCbCopyW(buf, BLOCKSIZE, L"<empty>");
            }
            break;
        }

        case VT_NULL:
        {
            buf = (WCHAR *)malloc(BLOCKSIZE);
            if (buf)
            {
                StringCbCopyW(buf, BLOCKSIZE, L"<null>");
            }
            break;
        }

        case VT_BOOL:
        {
            VARIANT_BOOL b = pValue->boolVal;
            buf = (WCHAR *)malloc(BLOCKSIZE);
            if (buf)
            {
                if (!b)
                {
                    StringCbCopyW(buf, BLOCKSIZE, L"FALSE");
                }
                else
                {
                    StringCbCopyW(buf, BLOCKSIZE, L"TRUE");
                }
            }
            break;
        }

        case VT_I1:
        {
            char b = pValue->bVal;
            buf = (WCHAR *)malloc(BLOCKSIZE);
            if (buf)
            {
                if (b >= 32)
                {
                    StringCbPrintfW(buf, BLOCKSIZE, L"'%c' (%hd, 0x%hX)", b, (signed char)b, b);
                }
                else
                {
                    StringCbPrintfW(buf, BLOCKSIZE, L"%hd (0x%hX)", (signed char)b, b);
                }
            }
            break;
        }

        case VT_UI1:
        {
            unsigned char b = pValue->bVal;
            buf = (WCHAR *)malloc(BLOCKSIZE);
            if (buf)
            {
                if (b >= 32)
                {
                    StringCbPrintfW(buf, BLOCKSIZE, L"'%c' (%hu, 0x%hX)", b, (unsigned char)b, b);
                }
                else
                {
                    StringCbPrintfW(buf, BLOCKSIZE, L"%hu (0x%hX)", (unsigned char)b, b);
                }
            }
            break;
        }

        case VT_I2:
        {
            SHORT i = pValue->iVal;
            buf = (WCHAR *)malloc(BLOCKSIZE);
            if (buf)
            {
                StringCbPrintfW(buf, BLOCKSIZE, L"%hd (0x%hX)", i, i);
            }
            break;
        }

        case VT_UI2:
        {
            USHORT i = pValue->uiVal;
            buf = (WCHAR *)malloc(BLOCKSIZE);
            if (buf)
            {
                StringCbPrintfW(buf, BLOCKSIZE, L"%hu (0x%hX)", i, i);
            }
            break;
        }

        case VT_I4:
        {
            LONG l = pValue->lVal;
            buf = (WCHAR *)malloc(BLOCKSIZE);
            if (buf)
            {
                StringCbPrintfW(buf, BLOCKSIZE, L"%d (0x%X)", l, l);
            }
            break;
        }

        case VT_UI4:
        {
            ULONG l = pValue->ulVal;
            buf = (WCHAR *)malloc(BLOCKSIZE);
            if (buf)
            {
                StringCbPrintfW(buf, BLOCKSIZE, L"%u (0x%X)", l, l);
            }
            break;
        }

        case VT_R4:
        {
            float f = pValue->fltVal;
            buf = (WCHAR *)malloc(CVTBUFSIZE * sizeof(WCHAR));
            if (buf)
            {
                StringCbPrintfW(buf, BLOCKSIZE,  L"%10.4f", f);
            }
            break;
        }

        case VT_R8:
        {
            double d = pValue->dblVal;
            buf = (WCHAR *)malloc(CVTBUFSIZE * sizeof(WCHAR));
            if (buf)
            {
                StringCbPrintfW(buf, BLOCKSIZE, L"%10.4f", d);
            }
            break;
        }

        case VT_BSTR:
        {
            if (dwType == CIM_SINT64)
            {
                // a little redundant, but it makes me feel better
                LPWSTR pWStr = pValue->bstrVal;
                __int64 l = _wtoi64(pWStr);

                buf = (WCHAR *)malloc(BLOCKSIZE);
                if (buf)
                {
                    StringCbPrintfW(buf, BLOCKSIZE, L"%I64d", l);
                }
            }
            else if (dwType == CIM_UINT64)
            {
                // a little redundant, but it makes me feel better
                LPWSTR pWStr = pValue->bstrVal;
                __int64 l = _wtoi64(pWStr);

                buf = (WCHAR *)malloc(BLOCKSIZE);
                if (buf)
                {
                    StringCbPrintfW(buf, BLOCKSIZE,  L"%I64u", l);
                }
            }
            else // string, datetime, reference
            {
                LPWSTR pWStr = pValue->bstrVal;
                buf = (WCHAR *)malloc((wcslen(pWStr) * sizeof(WCHAR)) + sizeof(WCHAR) + (2 * sizeof(WCHAR)));
                if (buf)
                {
                    StringCbPrintfW(buf, BLOCKSIZE,  L"\"%wS\"", pWStr);
                }
            }
            break;
        }

        case VT_BOOL|VT_ARRAY:
        {
            SAFEARRAY *pVec = pValue->parray;
            long iLBound, iUBound;
            BOOL bFirst = TRUE;

            SafeArrayGetLBound(pVec, 1, &iLBound);
            SafeArrayGetUBound(pVec, 1, &iUBound);
            if ((iUBound - iLBound + 1) == 0)
            {
                buf = (WCHAR *)malloc(BLOCKSIZE);
        if (buf)
        {
          StringCbCopyW(buf, BLOCKSIZE, L"<empty array>");
        }
                break;
            }

            buf = (WCHAR *)malloc((iUBound - iLBound + 1) * BLOCKSIZE);
            if (buf)
            {
                StringCbCopyW(buf, ((iUBound - iLBound + 1) * BLOCKSIZE), L"");

                for (long i = iLBound; i <= iUBound; i++)
                {
                    if (!bFirst)
                    {
                        StringCbCatW(buf, (iUBound - iLBound + 1) * BLOCKSIZE, L",");
                    }
                    else
                    {
                        bFirst = FALSE;
                    }

                    VARIANT_BOOL v;
                    SafeArrayGetElement(pVec, &i, &v);
                    if (v)
                    {
                        StringCbCatW(buf, (iUBound - iLBound + 1) * BLOCKSIZE, L"TRUE");
                    }
                    else
                    {
                        StringCbCatW(buf, (iUBound - iLBound + 1) * BLOCKSIZE, L"FALSE");
                    }
                }
            }

            break;
        }

        case VT_I1|VT_ARRAY:
        {
            SAFEARRAY *pVec = pValue->parray;
            long iLBound, iUBound;
            BOOL bFirst = TRUE;

            SafeArrayGetLBound(pVec, 1, &iLBound);
            SafeArrayGetUBound(pVec, 1, &iUBound);
            if ((iUBound - iLBound + 1) == 0)
            {
                buf = (WCHAR *)malloc(BLOCKSIZE);
        if (buf)
        {
          StringCbCopyW(buf, BLOCKSIZE, L"<empty array>");
        }
                break;
            }

            int bufSize = (iUBound - iLBound + 1) * BLOCKSIZE;
            buf = (WCHAR *)malloc((iUBound - iLBound + 1) * BLOCKSIZE);
            if (buf)
            {

                StringCbCopyW(buf, ((iUBound - iLBound + 1) * BLOCKSIZE), L"");
                WCHAR *pos = buf;
                DWORD len;

                BYTE *pbstr;
                SafeArrayAccessData(pVec, (void HUGEP* FAR*)&pbstr);

                for (long i = iLBound; i <= iUBound; i++)
                {
                    if (!bFirst)
                    {
                        StringCbCopyW(pos, bufSize - (pos - buf) * sizeof(WCHAR), L",");
                        pos += 1;
                    }
                    else
                    {
                        bFirst = FALSE;
                    }

                    char v;
                    //            SafeArrayGetElement(pVec, &i, &v);
                    v = pbstr[i];

                    if (v < 32)
                    {
                        len = StringCbPrintfW(lbuf, sizeof(lbuf), L"%hd (0x%X)", v, v);
                    }
                    else
                    {
                        len = StringCbPrintfW(lbuf, sizeof(lbuf), L"'%c' %hd (0x%X)", v, v, v);
                    }
                    StringCbCopyW(pos, bufSize - (pos - buf)*sizeof(WCHAR), lbuf);
                    pos += len;
                }
            }

            SafeArrayUnaccessData(pVec);

            break;
        }

        case VT_UI1|VT_ARRAY:
        {
            SAFEARRAY *pVec = pValue->parray;
            long iLBound, iUBound;
            BOOL bFirst = TRUE;

            SafeArrayGetLBound(pVec, 1, &iLBound);
            SafeArrayGetUBound(pVec, 1, &iUBound);
            if ((iUBound - iLBound + 1) == 0)
            {
                buf = (WCHAR *)malloc(BLOCKSIZE);
        if (buf)
        {
          StringCbCopyW(buf, BLOCKSIZE, L"<empty array>");
        }
                break;
            }

      int bufsize = (iUBound - iLBound + 1) * BLOCKSIZE;
            buf = (WCHAR *)malloc(bufsize);
            if (buf)
            {
                StringCbCopyW(buf, bufsize, L"");
                WCHAR *pos = buf;
                DWORD len;

                BYTE *pbstr;
                SafeArrayAccessData(pVec, (void HUGEP* FAR*)&pbstr);

                for (long i = iLBound; i <= iUBound; i++)
                {
                    if (!bFirst)
                    {
                        StringCbCopyW(pos, bufsize - ((pos - buf)*sizeof(WCHAR)), L",");
                        pos += 1;
                    }
                    else
                    {
                        bFirst = FALSE;
                    }

                    unsigned char v;
                    //            SafeArrayGetElement(pVec, &i, &v);
                    v = pbstr[i];

                    if (v < 32)
                    {
                        len = StringCbPrintfW(lbuf, sizeof(lbuf), L"%hu (0x%X)", v, v);
                    }
                    else
                    {
                        len = StringCbPrintfW(lbuf, sizeof(lbuf), L"'%c' %hu (0x%X)", v, v, v);
                    }

                    StringCbCopyW(pos, bufsize - ((pos - buf)*sizeof(WCHAR)), lbuf);
                    pos += len;
                }
            }

            SafeArrayUnaccessData(pVec);

            break;
        }

        case VT_I2|VT_ARRAY:
        {
            SAFEARRAY *pVec = pValue->parray;
            long iLBound, iUBound;
            BOOL bFirst = TRUE;

            SafeArrayGetLBound(pVec, 1, &iLBound);
            SafeArrayGetUBound(pVec, 1, &iUBound);
            if ((iUBound - iLBound + 1) == 0)
            {
                buf = (WCHAR *)malloc(BLOCKSIZE);
        if (buf)
        {
          StringCbCopyW(buf, BLOCKSIZE, L"<empty array>");
        }
                break;
            }

            buf = (WCHAR *)malloc((iUBound - iLBound + 1) * BLOCKSIZE);
            if (buf)
            {
                StringCbCopyW(buf, ((iUBound - iLBound + 1) * BLOCKSIZE), L"");

                for (long i = iLBound; i <= iUBound; i++)
                {
                    if (!bFirst)
                    {
                        StringCbCatW(buf, ((iUBound - iLBound + 1) * BLOCKSIZE), L",");
                    }
                    else
                    {
                        bFirst = FALSE;
                    }

                    SHORT v;
                    SafeArrayGetElement(pVec, &i, &v);
                    StringCbPrintfW(lbuf, sizeof(lbuf), L"%hd", v);
                    StringCbCatW(buf, ((iUBound - iLBound + 1) * BLOCKSIZE), lbuf);
                }
            }

            break;
        }

        case VT_UI2|VT_ARRAY:
        {
            SAFEARRAY *pVec = pValue->parray;
            long iLBound, iUBound;
            BOOL bFirst = TRUE;

            SafeArrayGetLBound(pVec, 1, &iLBound);
            SafeArrayGetUBound(pVec, 1, &iUBound);
            if ((iUBound - iLBound + 1) == 0)
            {
                buf = (WCHAR *)malloc(BLOCKSIZE);
        if (buf)
        {
                  StringCbCopyW(buf, BLOCKSIZE, L"<empty array>");
        }
                break;
            }

            buf = (WCHAR *)malloc((iUBound - iLBound + 1) * BLOCKSIZE);
            if (buf)
            {
                StringCbCopyW(buf, ((iUBound - iLBound + 1) * BLOCKSIZE), L"");

                for (long i = iLBound; i <= iUBound; i++)
                {
                    if (!bFirst)
                    {
                        StringCbCatW(buf, ((iUBound - iLBound + 1) * BLOCKSIZE), L",");
                    }
                    else
                    {
                        bFirst = FALSE;
                    }

                    USHORT v;
                    SafeArrayGetElement(pVec, &i, &v);
                    StringCbPrintfW(lbuf, sizeof(lbuf), L"%hu", v);
                    StringCbCatW(buf, ((iUBound - iLBound + 1) * BLOCKSIZE), lbuf);
                }
            }

            break;
        }

        case VT_I4|VT_ARRAY:
        {
            SAFEARRAY *pVec = pValue->parray;
            long iLBound, iUBound;
            BOOL bFirst = TRUE;

            SafeArrayGetLBound(pVec, 1, &iLBound);
            SafeArrayGetUBound(pVec, 1, &iUBound);
            if ((iUBound - iLBound + 1) == 0)
            {
                buf = (WCHAR *)malloc(BLOCKSIZE);
        if (buf)
        {
                  StringCbCopyW(buf, BLOCKSIZE, L"<empty array>");
        }
                break;
            }

            buf = (WCHAR *)malloc((iUBound - iLBound + 1) * BLOCKSIZE);
            if (buf)
            {
                StringCbCopyW(buf, ((iUBound - iLBound + 1) * BLOCKSIZE), L"");

                for (long i = iLBound; i <= iUBound; i++)
                {
                    if (!bFirst)
                    {
                        StringCbCatW(buf,((iUBound - iLBound + 1) * BLOCKSIZE), L",");
                    }
                    else
                    {
                        bFirst = FALSE;
                    }

                    LONG v;
                    SafeArrayGetElement(pVec, &i, &v);
                    _ltow(v, lbuf, 10);
                    StringCbCatW(buf, ((iUBound - iLBound + 1) * BLOCKSIZE), lbuf);
                }
            }

            break;
        }

        case VT_UI4|VT_ARRAY:
        {
            SAFEARRAY *pVec = pValue->parray;
            long iLBound, iUBound;
            BOOL bFirst = TRUE;

            SafeArrayGetLBound(pVec, 1, &iLBound);
            SafeArrayGetUBound(pVec, 1, &iUBound);
            if ((iUBound - iLBound + 1) == 0)
            {
                buf = (WCHAR *)malloc(BLOCKSIZE);
        if (buf)
        {
                  StringCbCopyW(buf, BLOCKSIZE, L"<empty array>");
        }
                break;
            }

            buf = (WCHAR *)malloc((iUBound - iLBound + 1) * BLOCKSIZE);
            if (buf)
            {
                StringCbCopyW(buf, ((iUBound - iLBound + 1) * BLOCKSIZE), L"");

                for (long i = iLBound; i <= iUBound; i++)
                {
                    if (!bFirst)
                    {
                        StringCbCatW(buf, ((iUBound - iLBound + 1) * BLOCKSIZE), L",");
                    }
                    else
                    {
                        bFirst = FALSE;
                    }

                    ULONG v;
                    SafeArrayGetElement(pVec, &i, &v);
                    _ultow(v, lbuf, 10);
                    StringCbCatW(buf, ((iUBound - iLBound + 1) * BLOCKSIZE), lbuf);
                }
            }

            break;
        }

        case CIM_REAL32|VT_ARRAY:
        {
            SAFEARRAY *pVec = pValue->parray;
            long iLBound, iUBound;
            BOOL bFirst = TRUE;

            SafeArrayGetLBound(pVec, 1, &iLBound);
            SafeArrayGetUBound(pVec, 1, &iUBound);
            if ((iUBound - iLBound + 1) == 0)
            {
                buf = (WCHAR *)malloc(BLOCKSIZE);
        if (buf)
        {
                  StringCbCopyW(buf, BLOCKSIZE, L"<empty array>");
        }
                break;
            }

            int bufSize = (iUBound - iLBound + 1) * (CVTBUFSIZE * sizeof(WCHAR));
            buf = (WCHAR *)malloc(bufSize);
            if (buf)
            {
                StringCbCopyW(buf,  bufSize, L"");

                for (long i = iLBound; i <= iUBound; i++)
                {
                    if (!bFirst)
                    {
                        StringCbCatW(buf, bufSize, L",");
                    }
                    else
                    {
                        bFirst = FALSE;
                    }

                    FLOAT v;
                    SafeArrayGetElement(pVec, &i, &v);
                    StringCbPrintfW(lbuf, sizeof(lbuf), L"%10.4f", v);
                    StringCbCatW(buf, bufSize, lbuf);
                }
            }

            break;
        }

        case CIM_REAL64|VT_ARRAY:
        {
            SAFEARRAY *pVec = pValue->parray;
            long iLBound, iUBound;
            BOOL bFirst = TRUE;

            SafeArrayGetLBound(pVec, 1, &iLBound);
            SafeArrayGetUBound(pVec, 1, &iUBound);
            if ((iUBound - iLBound + 1) == 0)
            {
                buf = (WCHAR *)malloc(BLOCKSIZE);
        if (buf)
        {
                  StringCbCopyW(buf, BLOCKSIZE, L"<empty array>");
        }
                break;
            }

            int bufSize = (iUBound - iLBound + 1) * (CVTBUFSIZE * sizeof(WCHAR));
            buf = (WCHAR *)malloc(bufSize);
            if (buf)
            {
                StringCbCopyW(buf, bufSize, L"");

                for (long i = iLBound; i <= iUBound; i++)
                {
                    if (!bFirst)
                    {
                        StringCbCatW(buf, bufSize, L",");
                    }
                    else
                    {
                        bFirst = FALSE;
                    }

                    double v;
                    SafeArrayGetElement(pVec, &i, &v);
                    StringCbPrintfW(lbuf, sizeof(lbuf), L"%10.4f", v);
                    StringCbCatW(buf, bufSize, lbuf);
                }
            }

            break;
        }

        case VT_BSTR|VT_ARRAY:
        {
            if (dwType == (CIM_UINT64|VT_ARRAY))
            {
                SAFEARRAY *pVec = pValue->parray;
                long iLBound, iUBound;
                BOOL bFirst = TRUE;

                SafeArrayGetLBound(pVec, 1, &iLBound);
                SafeArrayGetUBound(pVec, 1, &iUBound);
                if ((iUBound - iLBound + 1) == 0)
                {
                    buf = (WCHAR *)malloc(BLOCKSIZE);
          if (buf)
          {
                      StringCbCopyW(buf, BLOCKSIZE, L"<empty array>");
          }
                    break;
                }

                buf = (WCHAR *)malloc((iUBound - iLBound + 1) * BLOCKSIZE);
                if (buf)
                {
                    StringCbCopyW(buf, ((iUBound - iLBound + 1) * BLOCKSIZE), L"");

                    for (long i = iLBound; i <= iUBound; i++)
                    {
                        if (!bFirst)
                        {
                            StringCbCatW(buf, ((iUBound - iLBound + 1) * BLOCKSIZE), L",");
                        }
                        else
                        {
                            bFirst = FALSE;
                        }

                        BSTR v = NULL;

                        SafeArrayGetElement(pVec, &i, &v);

                        StringCbPrintfW(lbuf, sizeof(lbuf), L"%I64u", _wtoi64(v));
                        StringCbCatW(buf, ((iUBound - iLBound + 1) * BLOCKSIZE), lbuf);
                    }
                }
            }
            else if (dwType == (CIM_SINT64|VT_ARRAY))
            {
                SAFEARRAY *pVec = pValue->parray;
                long iLBound, iUBound;
                BOOL bFirst = TRUE;

                SafeArrayGetLBound(pVec, 1, &iLBound);
                SafeArrayGetUBound(pVec, 1, &iUBound);
                if ((iUBound - iLBound + 1) == 0)
                {
                    buf = (WCHAR *)malloc(BLOCKSIZE);
          if (buf)
          {
                      StringCbCopyW(buf, BLOCKSIZE, L"<empty array>");
          }
                    break;
                }

                buf = (WCHAR *)malloc((iUBound - iLBound + 1) * BLOCKSIZE);
                if (buf)
                {
                    StringCbCopyW(buf, ((iUBound - iLBound + 1) * BLOCKSIZE), L"");

                    for (long i = iLBound; i <= iUBound; i++)
                    {
                        if (!bFirst)
                        {
                            StringCbCatW(buf, ((iUBound - iLBound + 1) * BLOCKSIZE), L",");
                        }
                        else
                        {
                            bFirst = FALSE;
                        }

                        BSTR v = NULL;

                        SafeArrayGetElement(pVec, &i, &v);

                        StringCbPrintfW(lbuf, sizeof(lbuf), L"%I64d", _wtoi64(v));
                        StringCbCatW(buf, ((iUBound - iLBound + 1) * BLOCKSIZE), lbuf);
                    }
                }
            }
            else // string, datetime, reference
            {
                SAFEARRAY *pVec = pValue->parray;
                long iLBound, iUBound;
                DWORD iNeed;
                size_t iVSize;
                DWORD iCurBufSize;

                SafeArrayGetLBound(pVec, 1, &iLBound);
                SafeArrayGetUBound(pVec, 1, &iUBound);
                if ((iUBound - iLBound + 1) == 0)
                {
                    buf = (WCHAR *)malloc(BLOCKSIZE);
          if (buf)
          {
                      StringCbCopyW(buf, BLOCKSIZE, L"<empty array>");
          }
                    break;
                }

                iTotBufSize = (iUBound - iLBound + 1) * BLOCKSIZE;
                buf = (WCHAR *)malloc(iTotBufSize);
                if (buf)
                {
                    buf[0] = L'\0';
                    iCurBufSize = 0;
                    iVSize = BLOCKSIZE;
                    vbuf = (WCHAR *)malloc(BLOCKSIZE);
                    if (vbuf)
                    {
                        size_t iLen;

                        for (long i = iLBound; i <= iUBound; i++)
                        {
                            BSTR v = NULL;
                            SafeArrayGetElement(pVec, &i, &v);
                            iLen = (SysStringLen(v) + 1) * sizeof(WCHAR);
                            if (iLen > iVSize)
                            {
                                vbuf = (WCHAR *)realloc(vbuf, iLen + sizeof(WCHAR));
                                iVSize = iLen;
                            }

                            // String size + (quotes + comma + null)
              if (vbuf)
              {
                iNeed = (StringCbPrintfW(vbuf, iVSize, L"%wS", v) + 4) * sizeof(WCHAR);
                if (iNeed + iCurBufSize > iTotBufSize)
                {
                  iTotBufSize += (iNeed * 2);  // Room enough for 2 more entries
                  buf = (WCHAR *)realloc(buf, iTotBufSize);
                }
                if (buf)
                {
                  StringCbCatW(buf, iTotBufSize, L"\"");
                  StringCbCatW(buf, iTotBufSize, vbuf);
                  if (i + 1 <= iUBound)
                  {
                    StringCbCatW(buf, iTotBufSize, L"\",");
                  }
                  else
                  {
                    StringCbCatW(buf, iTotBufSize, L"\"");
                  }
                  iCurBufSize += iNeed;
                }
              }
                            SysFreeString(v);
                        }
                        free(vbuf);
                    }
                }
            }

            break;
        }

        default:
        {
            if (fnHandler != NULL)
            {
                buf = fnHandler(pValue);
            }
            else
            {
                buf = (WCHAR *)malloc(BLOCKSIZE);
                if (buf)
                {
                    StringCbCopyW(buf, BLOCKSIZE, L"<conversion error>");
                }
            }
            break;
        }
   }

   if (!buf)
   {
       PrintErrorAndExit("ValueToString() out of memory", S_OK, 0);
   }

   *pbuf = buf;
   return buf;
}

BSTR WbemErrorString ( SCODE sc )

Definition at line 34 of file Utils.Cpp.

{
    IWbemStatusCodeTextPtr pStatus;
    BSTR bstr = NULL;

    SCODE mysc = CoCreateInstance(CLSID_WbemStatusCodeText, 0, CLSCTX_INPROC_SERVER,
        IID_IWbemStatusCodeText, (LPVOID *) &pStatus);

    if (mysc == S_OK)
    {
        mysc = pStatus->GetErrorCodeText(sc, 0, 0, &bstr);
        if (mysc == S_OK)
        {
        }
        else
        {
            WCHAR szBuffer2[MAXITOA];
            WCHAR szBuffer[sizeof(szBuffer2) + 4];

            _ltow(sc, szBuffer2, 16);
      StringCbCopyW(szBuffer, sizeof(szBuffer), L"0x");
      StringCbCatW(szBuffer, sizeof(szBuffer), szBuffer2);
            bstr = SysAllocString(szBuffer);
        }
    }

    return bstr;
}

Generated on Wed Nov 13 2024 16:53:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/UtilLib/WbemSec.Cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • UtilLib
Functions

WbemSec.Cpp File Reference

#include "precomp.h"
#include <wbemidl.h>
#include "wbemsec.h"

Go to the source code of this file.

Functions

bool | bIsNT (void)
HRESULT | CheckAccess (SECURITY_DESCRIPTOR *a_SecurityDescriptor, DWORD a_Access, GENERIC_MAPPING *a_Mapping)
SCODE | GetAuthImp (IUnknown *pFrom, DWORD *pdwAuthLevel, DWORD *pdwImpLevel)
DWORD GetCurrentImpersonationLevel ()
HRESULT | InitializeSecurity (DWORD dwAuthLevel, DWORD dwImpLevel)
SCODE | ParseAuthorityUserArgs (BSTR &AuthArg, BSTR &UserArg, BSTR &Authority, BSTR &User)
HRESULT | SetInterfaceSecurity (IUnknown *pInterface, LPWSTR pAuthority, LPWSTR pUser, LPWSTR pPassword, DWORD dwAuthLevel, DWORD dwImpLevel)

Function Documentation

bool bIsNT ( void )

Definition at line 79 of file WbemSec.Cpp.

{
    OSVERSIONINFO os;
    os.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
    if(!GetVersionEx(&os))
        return FALSE;           // should never happen
    return os.dwPlatformId == VER_PLATFORM_WIN32_NT;
}

HRESULT CheckAccess | ( | SECURITY_DESCRIPTOR * | a_SecurityDescriptor,
 |  | DWORD | a_Access,
 |  | GENERIC_MAPPING * | a_Mapping
 | ) |  |

Definition at line 406 of file WbemSec.Cpp.

{
  HRESULT t_Result = S_OK ;

  HANDLE t_Token = NULL ;

  BOOL t_Status = OpenThreadToken (

    GetCurrentThread () ,
    TOKEN_QUERY ,
    TRUE ,
    & t_Token
  ) ;

  DWORD t_LastError = GetLastError () ;
  if ( ! t_Status)
  {
    //the thread token should always be available

    switch ( t_LastError )
    {
      case E_ACCESSDENIED:
      {
        return  WBEM_E_ACCESS_DENIED ;
      }
      break ;

      default:
      {
        return WBEM_E_FAILED ;
      }
      break ;
    }
  }

  DWORD t_Access = 0 ;
  BOOL t_AccessStatus = FALSE ;
  PRIVILEGE_SET *t_PrivilegeSet = NULL ;
  DWORD t_PrivilegeSetSize = 0 ;

  MapGenericMask (

    & a_Access ,
    a_Mapping
  ) ;

  t_Status = AccessCheck (

    a_SecurityDescriptor ,
    t_Token,
    a_Access ,
    a_Mapping ,
    NULL ,
    & t_PrivilegeSetSize ,
    & t_Access ,
    & t_AccessStatus
  ) ;

  if (!t_Status || !t_AccessStatus )
  {
    DWORD t_LastError = GetLastError () ;
    if ( t_LastError == ERROR_INSUFFICIENT_BUFFER )
    {
      t_PrivilegeSet = ( PRIVILEGE_SET * ) new BYTE [ t_PrivilegeSetSize ] ;
      if ( t_PrivilegeSet )
      {
        t_Status = AccessCheck (
          a_SecurityDescriptor ,
          t_Token,
          a_Access ,
          a_Mapping ,
          t_PrivilegeSet ,
          & t_PrivilegeSetSize ,
          & t_Access ,
          & t_AccessStatus
        ) ;

        if ( !t_Status || !t_AccessStatus )
        {
          t_Result = WBEM_E_ACCESS_DENIED ;
        }

        delete [] ( BYTE * ) t_PrivilegeSet ;
      }
      else
      {
        t_Result = WBEM_E_OUT_OF_MEMORY ;
      }
    }
    else
    {
      t_Result = WBEM_E_ACCESS_DENIED;
    }

  }

  CloseHandle ( t_Token ) ;

  return t_Result ;
}

SCODE GetAuthImp | ( | IUnknown * | pFrom,
 |  | DWORD * | pdwAuthLevel,
 |  | DWORD * | pdwImpLevel
 | ) |  |

Definition at line 212 of file WbemSec.Cpp.

{

    if(pFrom == NULL || pdwAuthLevel == NULL || pdwImpLevel == NULL)
        return WBEM_E_INVALID_PARAMETER;

    IClientSecurity * pFromSec = NULL;
    SCODE sc = pFrom->QueryInterface(IID_IClientSecurity, (void **) &pFromSec);
    if(sc == S_OK)
    {
        DWORD dwAuthnSvc, dwAuthzSvc, dwCapabilities;
        sc = pFromSec->QueryBlanket(pFrom, &dwAuthnSvc, &dwAuthzSvc,
                                            NULL,
                                            pdwAuthLevel, pdwImpLevel,
                                            NULL, &dwCapabilities);

        // Special case of going to a win9x share level box

        if (sc == 0x800706d2)
        {
            *pdwAuthLevel = RPC_C_AUTHN_LEVEL_NONE;
            *pdwImpLevel = RPC_C_IMP_LEVEL_IDENTIFY;
            sc = S_OK;
        }
        pFromSec->Release();
    }
    return sc;
}

DWORD GetCurrentImpersonationLevel ( )

Definition at line 524 of file WbemSec.Cpp.

{
  DWORD t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;

    HANDLE t_ThreadToken = NULL ;

    BOOL t_Status = OpenThreadToken (

    GetCurrentThread() ,
    TOKEN_QUERY,
    TRUE,
    &t_ThreadToken
  ) ;

    if ( t_Status )
    {
    SECURITY_IMPERSONATION_LEVEL t_Level = SecurityAnonymous ;
    DWORD t_Returned = 0 ;

    t_Status = GetTokenInformation (

      t_ThreadToken ,
      TokenImpersonationLevel ,
      & t_Level ,
      sizeof ( SECURITY_IMPERSONATION_LEVEL ) ,
      & t_Returned
    ) ;

    CloseHandle ( t_ThreadToken ) ;

    if ( t_Status == FALSE )
    {
      t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;
    }
    else
    {
      switch ( t_Level )
      {
        case SecurityAnonymous:
        {
          t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;
        }
        break ;

        case SecurityIdentification:
        {
          t_ImpersonationLevel = RPC_C_IMP_LEVEL_IDENTIFY ;
        }
        break ;

        case SecurityImpersonation:
        {
          t_ImpersonationLevel = RPC_C_IMP_LEVEL_IMPERSONATE ;
        }
        break ;

        case SecurityDelegation:
        {
          t_ImpersonationLevel = RPC_C_IMP_LEVEL_DELEGATE ;
        }
        break ;

        default:
        {
          t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;
        }
        break ;
      }
    }
  }
  else
  {
        ULONG t_LastError = GetLastError () ;

        if ( t_LastError == ERROR_NO_IMPERSONATION_TOKEN || t_LastError == ERROR_NO_TOKEN )
        {
            t_ImpersonationLevel = RPC_C_IMP_LEVEL_DELEGATE ;
        }
        else
    {
      if ( t_LastError == ERROR_CANT_OPEN_ANONYMOUS )
      {
        t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;
      }
      else
      {
        t_ImpersonationLevel = RPC_C_IMP_LEVEL_ANONYMOUS ;
      }
    }
    }

  return t_ImpersonationLevel ;
}

HRESULT InitializeSecurity | ( | DWORD | dwAuthLevel,
 |  | DWORD | dwImpLevel
 | ) |  |

Definition at line 44 of file WbemSec.Cpp.

{
    // Initialize security
    // ===================

  DWORD dwCapabilities;

  if (dwAuthLevel == RPC_C_AUTHN_LEVEL_NONE)
        dwCapabilities = EOAC_NONE;
  else
        dwCapabilities = EOAC_SECURE_REFS;

    return CoInitializeSecurity
    (NULL, -1, NULL, NULL,
        dwAuthLevel, dwImpLevel,
        NULL,
    dwCapabilities,
    0);
}

SCODE ParseAuthorityUserArgs | ( | BSTR & | AuthArg,
 |  | BSTR & | UserArg,
 |  | BSTR & | Authority,
 |  | BSTR & | User
 | ) |  |

Definition at line 118 of file WbemSec.Cpp.

{

    // Determine the connection type by examining the Authority string

    if(!(Authority == NULL || wcslen(Authority) == 0 || !_wcsnicmp(Authority, L"NTLMDOMAIN:",11)))
        return E_INVALIDARG;

    // The ntlm case is more complex.  There are four cases
    // 1)  Authority = NTLMDOMAIN:name" and User = "User"
    // 2)  Authority = NULL and User = "User"
    // 3)  Authority = "NTLMDOMAIN:" User = "domain\user"
    // 4)  Authority = NULL and User = "domain\user"

    // first step is to determine if there is a backslash in the user name somewhere between the
    // second and second to last character

    WCHAR * pSlashInUser = NULL;
    if(User)
    {
        WCHAR * pEnd = User + wcslen(User) - 1;
        for(pSlashInUser = User; pSlashInUser <= pEnd; pSlashInUser++)
            if(*pSlashInUser == L'\\')      // dont think forward slash is allowed!
                break;
        if(pSlashInUser > pEnd)
            pSlashInUser = NULL;
    }

    if(Authority && wcslen(Authority) > 11)
    {
        if(pSlashInUser)
            return E_INVALIDARG;

        AuthArg = SysAllocString(Authority + 11);
    if (!AuthArg)
      return E_OUTOFMEMORY;
        if(User)
    {
      UserArg = SysAllocString(User);
      if (!UserArg)
        return E_OUTOFMEMORY;
    }

        return S_OK;
    }
    else if(pSlashInUser)
    {
        INT_PTR iDomLen = min(MAX_PATH-1, pSlashInUser-User);
        WCHAR cTemp[MAX_PATH];
        wcsncpy(cTemp, User, iDomLen);
        cTemp[iDomLen] = 0;
        AuthArg = SysAllocString(cTemp);
    if (!AuthArg)
      return E_OUTOFMEMORY;
        if(wcslen(pSlashInUser+1))
    {
            UserArg = SysAllocString(pSlashInUser+1);
      if (!UserArg)
        return E_OUTOFMEMORY;
    }

    }
    else
        if(User)
    {
      UserArg = SysAllocString(User);
      if (!UserArg)
        return E_OUTOFMEMORY;
    }

    return S_OK;
}

HRESULT SetInterfaceSecurity | ( | IUnknown * | pInterface,
 |  | LPWSTR | pAuthority,
 |  | LPWSTR | pUser,
 |  | LPWSTR | pPassword,
 |  | DWORD | dwAuthLevel,
 |  | DWORD | dwImpLevel
 | ) |  |

Definition at line 281 of file WbemSec.Cpp.

{

    SCODE sc;
    if(pInterface == NULL)
        return E_INVALIDARG;

    // If we are lowering the security, no need to deal with the identification info

    if(dwAuthLevel == RPC_C_AUTHN_LEVEL_NONE)
        return CoSetProxyBlanket(pInterface, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, NULL,
                       RPC_C_AUTHN_LEVEL_NONE, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE);

    // If we are doing trivial case, just pass in a null authentication structure which is used
    // if the current logged in user's credentials are OK.

    if((pAuthority == NULL || wcslen(pAuthority) < 1) &&
        (pUser == NULL || wcslen(pUser) < 1) &&
        (pPassword == NULL || wcslen(pPassword) < 1))
            return CoSetProxyBlanket(pInterface, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, NULL,
                       dwAuthLevel, dwImpLevel, NULL, EOAC_NONE);

    // If user, or Authority was passed in, the we need to create an authority argument for the login

    COAUTHIDENTITY  authident;
    BSTR AuthArg = NULL, UserArg = NULL;
    sc = ParseAuthorityUserArgs(AuthArg, UserArg, pAuthority, pUser);
    if(sc != S_OK)
        return sc;

    memset((void *)&authident,0,sizeof(COAUTHIDENTITY));
    if(bIsNT())
    {
        if(UserArg)
        {
            authident.UserLength = (ULONG)wcslen(UserArg);
            authident.User = (LPWSTR)UserArg;
        }
        if(AuthArg)
        {
            authident.DomainLength = (ULONG)wcslen(AuthArg);
            authident.Domain = (LPWSTR)AuthArg;
        }
        if(pPassword)
        {
            authident.PasswordLength = (ULONG)wcslen(pPassword);
            authident.Password = (LPWSTR)pPassword;
        }
        authident.Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE;
    }
    else
    {
        char szUser[MAX_PATH], szAuthority[MAX_PATH], szPassword[MAX_PATH];
    ZeroMemory(szUser, sizeof(szUser));
    ZeroMemory(szAuthority, sizeof(szAuthority));
    ZeroMemory(szPassword, sizeof(szPassword));

    size_t written = 0;

        // Fill in the indentity structure

        if(UserArg)
        {
            written = wcstombs(szUser, UserArg, sizeof(szUser));
      if (written < sizeof(szUser) - 1)
      {
        //we could retry by calling wcstombs to find out required buffer size, but this is a simple sample
        sc = E_INVALIDARG;
        goto cleanup;
      }

            authident.UserLength = (ULONG)strlen(szUser);
            authident.User = (LPWSTR)szUser;
        }
        if(AuthArg)
        {
            written = wcstombs(szAuthority, AuthArg, sizeof(szAuthority));
      if (written < sizeof(szAuthority) - 1)
      {
        //we could retry by calling wcstombs to find out required buffer size, but this is a simple sample
        sc = E_INVALIDARG;
        goto cleanup;
      }
            authident.DomainLength = (ULONG)strlen(szAuthority);
            authident.Domain = (LPWSTR)szAuthority;
        }
        if(pPassword)
        {
            written = wcstombs(szPassword, pPassword, sizeof(szPassword));
      if (written < sizeof(szPassword) - 1)
      {
        //we could retry by calling wcstombs to find out required buffer size, but this is a simple sample
        sc = E_INVALIDARG;
        goto cleanup;
      }
            authident.PasswordLength = (ULONG)strlen(szPassword);
            authident.Password = (LPWSTR)szPassword;
        }
        authident.Flags = SEC_WINNT_AUTH_IDENTITY_ANSI;
    }
    sc = CoSetProxyBlanket(pInterface, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, NULL,
                       dwAuthLevel, dwImpLevel, &authident, EOAC_NONE);

cleanup:
    if(UserArg)
        SysFreeString(UserArg);
    if(AuthArg)
        SysFreeString(AuthArg);
    return sc;
}

Generated on Wed Nov 13 2024 16:54:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/UtilLib/WbemSec.h File Reference

  • SysMgmt
  • WMI
  • VC
  • UtilLib
Functions

WbemSec.h File Reference

Go to the source code of this file.

Functions

SCODE | GetAuthImp (IUnknown *pFrom, DWORD *pdwAuthLevel, DWORD *pdwImpLevel)
HRESULT | InitializeSecurity (DWORD dwAuthLevel, DWORD dwImpLevel)
HRESULT | SetInterfaceSecurity (IUnknown *pInterface, LPWSTR pDomain, LPWSTR pUser, LPWSTR pPassword, DWORD dwAuthLevel, DWORD dwImpLevel)

Function Documentation

SCODE GetAuthImp | ( | IUnknown * | pFrom,
 |  | DWORD * | pdwAuthLevel,
 |  | DWORD * | pdwImpLevel
 | ) |  |

Definition at line 212 of file WbemSec.Cpp.

{

    if(pFrom == NULL || pdwAuthLevel == NULL || pdwImpLevel == NULL)
        return WBEM_E_INVALID_PARAMETER;

    IClientSecurity * pFromSec = NULL;
    SCODE sc = pFrom->QueryInterface(IID_IClientSecurity, (void **) &pFromSec);
    if(sc == S_OK)
    {
        DWORD dwAuthnSvc, dwAuthzSvc, dwCapabilities;
        sc = pFromSec->QueryBlanket(pFrom, &dwAuthnSvc, &dwAuthzSvc,
                                            NULL,
                                            pdwAuthLevel, pdwImpLevel,
                                            NULL, &dwCapabilities);

        // Special case of going to a win9x share level box

        if (sc == 0x800706d2)
        {
            *pdwAuthLevel = RPC_C_AUTHN_LEVEL_NONE;
            *pdwImpLevel = RPC_C_IMP_LEVEL_IDENTIFY;
            sc = S_OK;
        }
        pFromSec->Release();
    }
    return sc;
}

HRESULT InitializeSecurity | ( | DWORD | dwAuthLevel,
 |  | DWORD | dwImpLevel
 | ) |  |

Definition at line 44 of file WbemSec.Cpp.

{
    // Initialize security
    // ===================

  DWORD dwCapabilities;

  if (dwAuthLevel == RPC_C_AUTHN_LEVEL_NONE)
        dwCapabilities = EOAC_NONE;
  else
        dwCapabilities = EOAC_SECURE_REFS;

    return CoInitializeSecurity
    (NULL, -1, NULL, NULL,
        dwAuthLevel, dwImpLevel,
        NULL,
    dwCapabilities,
    0);
}

HRESULT SetInterfaceSecurity | ( | IUnknown * | pInterface,
 |  | LPWSTR | pDomain,
 |  | LPWSTR | pUser,
 |  | LPWSTR | pPassword,
 |  | DWORD | dwAuthLevel,
 |  | DWORD | dwImpLevel
 | ) |  |

Definition at line 281 of file WbemSec.Cpp.

{

    SCODE sc;
    if(pInterface == NULL)
        return E_INVALIDARG;

    // If we are lowering the security, no need to deal with the identification info

    if(dwAuthLevel == RPC_C_AUTHN_LEVEL_NONE)
        return CoSetProxyBlanket(pInterface, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, NULL,
                       RPC_C_AUTHN_LEVEL_NONE, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE);

    // If we are doing trivial case, just pass in a null authentication structure which is used
    // if the current logged in user's credentials are OK.

    if((pAuthority == NULL || wcslen(pAuthority) < 1) &&
        (pUser == NULL || wcslen(pUser) < 1) &&
        (pPassword == NULL || wcslen(pPassword) < 1))
            return CoSetProxyBlanket(pInterface, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, NULL,
                       dwAuthLevel, dwImpLevel, NULL, EOAC_NONE);

    // If user, or Authority was passed in, the we need to create an authority argument for the login

    COAUTHIDENTITY  authident;
    BSTR AuthArg = NULL, UserArg = NULL;
    sc = ParseAuthorityUserArgs(AuthArg, UserArg, pAuthority, pUser);
    if(sc != S_OK)
        return sc;

    memset((void *)&authident,0,sizeof(COAUTHIDENTITY));
    if(bIsNT())
    {
        if(UserArg)
        {
            authident.UserLength = (ULONG)wcslen(UserArg);
            authident.User = (LPWSTR)UserArg;
        }
        if(AuthArg)
        {
            authident.DomainLength = (ULONG)wcslen(AuthArg);
            authident.Domain = (LPWSTR)AuthArg;
        }
        if(pPassword)
        {
            authident.PasswordLength = (ULONG)wcslen(pPassword);
            authident.Password = (LPWSTR)pPassword;
        }
        authident.Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE;
    }
    else
    {
        char szUser[MAX_PATH], szAuthority[MAX_PATH], szPassword[MAX_PATH];
    ZeroMemory(szUser, sizeof(szUser));
    ZeroMemory(szAuthority, sizeof(szAuthority));
    ZeroMemory(szPassword, sizeof(szPassword));

    size_t written = 0;

        // Fill in the indentity structure

        if(UserArg)
        {
            written = wcstombs(szUser, UserArg, sizeof(szUser));
      if (written < sizeof(szUser) - 1)
      {
        //we could retry by calling wcstombs to find out required buffer size, but this is a simple sample
        sc = E_INVALIDARG;
        goto cleanup;
      }

            authident.UserLength = (ULONG)strlen(szUser);
            authident.User = (LPWSTR)szUser;
        }
        if(AuthArg)
        {
            written = wcstombs(szAuthority, AuthArg, sizeof(szAuthority));
      if (written < sizeof(szAuthority) - 1)
      {
        //we could retry by calling wcstombs to find out required buffer size, but this is a simple sample
        sc = E_INVALIDARG;
        goto cleanup;
      }
            authident.DomainLength = (ULONG)strlen(szAuthority);
            authident.Domain = (LPWSTR)szAuthority;
        }
        if(pPassword)
        {
            written = wcstombs(szPassword, pPassword, sizeof(szPassword));
      if (written < sizeof(szPassword) - 1)
      {
        //we could retry by calling wcstombs to find out required buffer size, but this is a simple sample
        sc = E_INVALIDARG;
        goto cleanup;
      }
            authident.PasswordLength = (ULONG)strlen(szPassword);
            authident.Password = (LPWSTR)szPassword;
        }
        authident.Flags = SEC_WINNT_AUTH_IDENTITY_ANSI;
    }
    sc = CoSetProxyBlanket(pInterface, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, NULL,
                       dwAuthLevel, dwImpLevel, &authident, EOAC_NONE);

cleanup:
    if(UserArg)
        SysFreeString(UserArg);
    if(AuthArg)
        SysFreeString(AuthArg);
    return sc;
}

Generated on Wed Nov 13 2024 16:54:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/WMIDiskPerf/DpDetail.Cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • WMIDiskPerf
Functions | Variables

DpDetail.Cpp File Reference

#include <wbemidl.h>
#include <stdio.h>
#include <strsafe.h>

Go to the source code of this file.

Functions

void | DiskPerfDetails (IWbemServices *pIWbemServices)
void | ShowPropInfo (IWbemClassObject *pInst)

Variables

char | PropListHeader [] = ""

Function Documentation

void DiskPerfDetails ( IWbemServices * pIWbemServices )

Definition at line 36 of file DpDetail.Cpp.

{
  HRESULT   hr;
  long    lLower, lUpper, lCount;
  SAFEARRAY *psaNames = NULL;
  BSTR    PropName  = NULL;
  VARIANT   vVal;
  ULONG   uReturned;

  IEnumWbemClassObject  *pEnum      = NULL;
  IWbemClassObject    *pPerfData  = NULL;
  IWbemClassObject    *pPerfInst  = NULL;
  IWbemQualifierSet   *pQualSet   = NULL;
  VariantInit( &vVal );
  // Alloc class name string for DiskPerf
  BSTR PerfClass = SysAllocString( L"MSDiskDriver_PerformanceData" );
  if (!PerfClass)
  {
    printf("Out of memory\n");
    return;
  }

  // Get the Descriptions for the WMIDataId properties in the Embedded class.
  // Here the object info for the Class - MSDiskDriver_PerformanceData is
  // retrieved and displayed.
  // Collect object information for PerfClass
    hr = pIWbemServices->GetObject( PerfClass,
                                    0L,
                                    NULL,
                                    &pPerfData,
                                      NULL );
    SysFreeString( PerfClass );

    PerfClass = NULL;
  if ( hr == WBEM_NO_ERROR )
  {
    // show the property description list header
    printf( PropListHeader );

    // Load up a safearray of property names
    if ( ( pPerfData->GetNames( NULL,
                                WBEM_FLAG_ALWAYS | WBEM_FLAG_NONSYSTEM_ONLY,
                                NULL,
                                &psaNames ) ) == WBEM_NO_ERROR )
    {
      // Get the upper and lower bounds of the Names array
      if ( ( hr = SafeArrayGetLBound( psaNames, 1, &lLower ) ) == S_OK )
      {
        hr = SafeArrayGetUBound( psaNames, 1, &lUpper );
      }

      if ( hr != S_OK )
      {
        printf( "Problem with property name array.\n" );
      }
      else
      {
        BSTR WmiQual  = SysAllocString( L"WmiDataId" );
        if (!WmiQual)
        {
          pPerfData->Release( );
          SafeArrayDestroy( psaNames );
          printf("Out of memory\n");
          return;
        }
        BSTR DescQual = SysAllocString( L"Description" );
        if (!DescQual)
        {
          pPerfData->Release( );
          SafeArrayDestroy( psaNames );
          SysFreeString(WmiQual);
          printf("Out of memory\n");
          return;
        }
        UINT uWmiId;

        for ( lCount = lLower; lCount <= lUpper; lCount++ )
        {
          // get the property name for this element
          if ( ( SafeArrayGetElement( psaNames,
                                      &lCount,
                                      &PropName)) == S_OK )
          {
            if ( ( pPerfData->GetPropertyQualifierSet( PropName, &pQualSet ) ) == WBEM_NO_ERROR )
            {
              // check to see if the property is a WMI data Item and save its description
              // these are the DiskPerf counters
              if ( ( pQualSet->Get( WmiQual, 0L, &vVal, NULL ) ) == WBEM_NO_ERROR )
              {
                uWmiId = vVal.lVal;

                VariantClear( &vVal );
                if ( ( pQualSet->Get( DescQual, 0L, &vVal, NULL ) ) == WBEM_NO_ERROR )
                {
                  wprintf( L"( %d )\t\t%s\t%s\n", uWmiId, PropName, vVal.bstrVal );
                  VariantClear( &vVal );
                }
                else // No Description qualifier available
                  wprintf( L"( %d )\t\t%s\n", uWmiId, PropName);

              }

              pQualSet->Release( );
              pQualSet = NULL;
            }
            SysFreeString( PropName );
                              PropName  = NULL;
          }
        }
        SysFreeString( WmiQual );
        SysFreeString( DescQual );
      }
      SafeArrayDestroy( psaNames );
    }
    pPerfData->Release( );
  }

  // Now that the data class info is displayed, go get the values for all the
  // disk instances
  PerfClass = SysAllocString( L"MSDiskDriver_Performance" );
  if (!PerfClass)
  {
    printf("Out of memory\n");
    return;
  }

  // Create enumerator for all disk instances
  hr = pIWbemServices->CreateInstanceEnum( PerfClass,
                                           WBEM_FLAG_SHALLOW,
                                           NULL,
                                           &pEnum );
  SysFreeString( PerfClass );
  PerfClass = NULL;

  if ( hr == WBEM_NO_ERROR )
  {
        while ( pEnum->Next( INFINITE,
                         1,
                             &pPerfInst,
                             &uReturned ) == WBEM_NO_ERROR )
    {
      // Explicitly get the properties of InstanceName and Active state

      // Get the Instance Name string
      PropName = L"InstanceName";
      if ( ( pPerfInst->Get( PropName,
                             0L,
                             &vVal,
                             NULL, NULL ) ) == WBEM_NO_ERROR )
      {
        wprintf( L"\n%s\n", vVal.bstrVal );
        VariantClear( &vVal );
      }

      // Get Active status boolean

      PropName = L"Active";
      if ( ( pPerfInst->Get( PropName,
                             0L,
                             &vVal,
                             NULL, NULL ) ) == WBEM_NO_ERROR )
      {
        wprintf( L"\t%s\t\t= %s\n", PropName, vVal.boolVal ? L"TRUE" : L"FALSE" );
        VariantClear( &vVal );
      }

      // Get the performance data embedded object
      PropName = L"PerfData" ;
      if ( ( pPerfInst->Get( PropName,
                             0L,
                             &vVal,
                             NULL, NULL ) ) == WBEM_NO_ERROR )
      {
        if ( vVal.punkVal->QueryInterface( IID_IWbemClassObject,
                                          (PVOID *) &pPerfData ) == S_OK )
        {
          // display the WMI data item from this instance
          ShowPropInfo( pPerfData );
          pPerfData->Release( );
        }
        VariantClear( &vVal );
      }

      pPerfInst->Release( );
    }
    pEnum->Release( );
  }
  else
  {
    printf( "Can't enumerate DiskPerf instances!\n" );
  }
}

void ShowPropInfo ( IWbemClassObject * pInst )

Definition at line 232 of file DpDetail.Cpp.

{
  HRESULT hr;
  VARIANT vVal;
  BSTR PropName;

  if ( pInst )
  {
    hr = pInst->BeginEnumeration( WBEM_FLAG_LOCAL_ONLY );
    while ( hr == WBEM_NO_ERROR )
    {
      if ( ( hr = pInst->Next( 0, &PropName,
                               &vVal,
                               NULL, NULL ) ) == WBEM_NO_ERROR )
      {
        switch( vVal.vt )
        {
          case VT_I4:
          {
            wprintf( L"\t%s\t= %d\n", PropName, vVal.lVal );
          }
          break;
          case VT_BSTR:
          {
            wprintf( L"\t%s\t= %s\n", PropName, vVal.bstrVal );
          }
          break;
          default:
          {
            wprintf( L"\t%s\t= NULL\n", PropName );
          }
          break;
        }
        VariantClear( &vVal );
        SysFreeString( PropName );
      }
    }
    pInst->EndEnumeration(  );
  }
}

Variable Documentation

char PropListHeader[] = ""

Definition at line 23 of file DpDetail.Cpp.

Generated on Wed Nov 13 2024 16:54:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: SysMgmt/WMI/VC/WMIDiskPerf/WMIDiskPerf.Cpp File Reference

  • SysMgmt
  • WMI
  • VC
  • WMIDiskPerf
Functions

WMIDiskPerf.Cpp File Reference

#include <wbemidl.h>
#include <lmcons.h>
#include <stdio.h>
#include <strsafe.h>

Go to the source code of this file.

Functions

void | DiskPerfDetails (IWbemServices *pIWbemServices)
BOOL | InitSecurity (void)
int | main (int argc, char **argv)
DWORD WINAPI | WaitThread (HANDLE hWait)

Function Documentation

void DiskPerfDetails ( IWbemServices * pIWbemServices )

Definition at line 36 of file DpDetail.Cpp.

{
  HRESULT   hr;
  long    lLower, lUpper, lCount;
  SAFEARRAY *psaNames = NULL;
  BSTR    PropName  = NULL;
  VARIANT   vVal;
  ULONG   uReturned;

  IEnumWbemClassObject  *pEnum      = NULL;
  IWbemClassObject    *pPerfData  = NULL;
  IWbemClassObject    *pPerfInst  = NULL;
  IWbemQualifierSet   *pQualSet   = NULL;
  VariantInit( &vVal );
  // Alloc class name string for DiskPerf
  BSTR PerfClass = SysAllocString( L"MSDiskDriver_PerformanceData" );
  if (!PerfClass)
  {
    printf("Out of memory\n");
    return;
  }

  // Get the Descriptions for the WMIDataId properties in the Embedded class.
  // Here the object info for the Class - MSDiskDriver_PerformanceData is
  // retrieved and displayed.
  // Collect object information for PerfClass
    hr = pIWbemServices->GetObject( PerfClass,
                                    0L,
                                    NULL,
                                    &pPerfData,
                                      NULL );
    SysFreeString( PerfClass );

    PerfClass = NULL;
  if ( hr == WBEM_NO_ERROR )
  {
    // show the property description list header
    printf( PropListHeader );

    // Load up a safearray of property names
    if ( ( pPerfData->GetNames( NULL,
                                WBEM_FLAG_ALWAYS | WBEM_FLAG_NONSYSTEM_ONLY,
                                NULL,
                                &psaNames ) ) == WBEM_NO_ERROR )
    {
      // Get the upper and lower bounds of the Names array
      if ( ( hr = SafeArrayGetLBound( psaNames, 1, &lLower ) ) == S_OK )
      {
        hr = SafeArrayGetUBound( psaNames, 1, &lUpper );
      }

      if ( hr != S_OK )
      {
        printf( "Problem with property name array.\n" );
      }
      else
      {
        BSTR WmiQual  = SysAllocString( L"WmiDataId" );
        if (!WmiQual)
        {
          pPerfData->Release( );
          SafeArrayDestroy( psaNames );
          printf("Out of memory\n");
          return;
        }
        BSTR DescQual = SysAllocString( L"Description" );
        if (!DescQual)
        {
          pPerfData->Release( );
          SafeArrayDestroy( psaNames );
          SysFreeString(WmiQual);
          printf("Out of memory\n");
          return;
        }
        UINT uWmiId;

        for ( lCount = lLower; lCount <= lUpper; lCount++ )
        {
          // get the property name for this element
          if ( ( SafeArrayGetElement( psaNames,
                                      &lCount,
                                      &PropName)) == S_OK )
          {
            if ( ( pPerfData->GetPropertyQualifierSet( PropName, &pQualSet ) ) == WBEM_NO_ERROR )
            {
              // check to see if the property is a WMI data Item and save its description
              // these are the DiskPerf counters
              if ( ( pQualSet->Get( WmiQual, 0L, &vVal, NULL ) ) == WBEM_NO_ERROR )
              {
                uWmiId = vVal.lVal;

                VariantClear( &vVal );
                if ( ( pQualSet->Get( DescQual, 0L, &vVal, NULL ) ) == WBEM_NO_ERROR )
                {
                  wprintf( L"( %d )\t\t%s\t%s\n", uWmiId, PropName, vVal.bstrVal );
                  VariantClear( &vVal );
                }
                else // No Description qualifier available
                  wprintf( L"( %d )\t\t%s\n", uWmiId, PropName);

              }

              pQualSet->Release( );
              pQualSet = NULL;
            }
            SysFreeString( PropName );
                              PropName  = NULL;
          }
        }
        SysFreeString( WmiQual );
        SysFreeString( DescQual );
      }
      SafeArrayDestroy( psaNames );
    }
    pPerfData->Release( );
  }

  // Now that the data class info is displayed, go get the values for all the
  // disk instances
  PerfClass = SysAllocString( L"MSDiskDriver_Performance" );
  if (!PerfClass)
  {
    printf("Out of memory\n");
    return;
  }

  // Create enumerator for all disk instances
  hr = pIWbemServices->CreateInstanceEnum( PerfClass,
                                           WBEM_FLAG_SHALLOW,
                                           NULL,
                                           &pEnum );
  SysFreeString( PerfClass );
  PerfClass = NULL;

  if ( hr == WBEM_NO_ERROR )
  {
        while ( pEnum->Next( INFINITE,
                         1,
                             &pPerfInst,
                             &uReturned ) == WBEM_NO_ERROR )
    {
      // Explicitly get the properties of InstanceName and Active state

      // Get the Instance Name string
      PropName = L"InstanceName";
      if ( ( pPerfInst->Get( PropName,
                             0L,
                             &vVal,
                             NULL, NULL ) ) == WBEM_NO_ERROR )
      {
        wprintf( L"\n%s\n", vVal.bstrVal );
        VariantClear( &vVal );
      }

      // Get Active status boolean

      PropName = L"Active";
      if ( ( pPerfInst->Get( PropName,
                             0L,
                             &vVal,
                             NULL, NULL ) ) == WBEM_NO_ERROR )
      {
        wprintf( L"\t%s\t\t= %s\n", PropName, vVal.boolVal ? L"TRUE" : L"FALSE" );
        VariantClear( &vVal );
      }

      // Get the performance data embedded object
      PropName = L"PerfData" ;
      if ( ( pPerfInst->Get( PropName,
                             0L,
                             &vVal,
                             NULL, NULL ) ) == WBEM_NO_ERROR )
      {
        if ( vVal.punkVal->QueryInterface( IID_IWbemClassObject,
                                          (PVOID *) &pPerfData ) == S_OK )
        {
          // display the WMI data item from this instance
          ShowPropInfo( pPerfData );
          pPerfData->Release( );
        }
        VariantClear( &vVal );
      }

      pPerfInst->Release( );
    }
    pEnum->Release( );
  }
  else
  {
    printf( "Can't enumerate DiskPerf instances!\n" );
  }
}

BOOL InitSecurity ( void )

Definition at line 148 of file WMIDiskPerf.Cpp.

{
  // Adjust the security to allow client impersonation.
  HRESULT hres = CoInitializeSecurity
                ( NULL, -1, NULL, NULL,
                RPC_C_AUTHN_LEVEL_PKT_PRIVACY,
                RPC_C_IMP_LEVEL_IMPERSONATE,
                NULL,
                EOAC_SECURE_REFS,
                NULL );

  return SUCCEEDED( hres );
}

int main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 34 of file WMIDiskPerf.Cpp.

{
  HRESULT hr;
  DWORD ThreadId, dwLen = MAX_COMPUTERNAME_LENGTH + 1;
  HANDLE  hWait, hThread;
  BSTR  pNamespace;
  TCHAR szSysName[MAX_COMPUTERNAME_LENGTH + 3];

  IWbemLocator  *pIWbemLocator  = NULL;
  IWbemServices *pIWbemServices = NULL;

  if ( !SUCCEEDED( CoInitialize( NULL ) ) || !InitSecurity( ) )
  {
    printf( "COM stuff is hosed!\r\n" );

    return 0;
  }

  // Create an instance of the WbemLocator interface.
  if ( CoCreateInstance( CLSID_WbemLocator,
                         NULL,
                         CLSCTX_INPROC_SERVER,
                         IID_IWbemLocator,
                         (LPVOID *) &pIWbemLocator ) == S_OK )
  {

    StringCbCopy(szSysName, sizeof(szSysName), "\\\\");
    BOOL bRes = GetComputerName( szSysName + 2, &dwLen );
    if (!bRes)
    {
      printf("Could not get local machine name.\n");
      CoUninitialize();
      return 0;
    }
    pNamespace = SysAllocString( L"root\\WMI" );
    if (!pNamespace)
    {
      printf("Out of memory\n");
      CoUninitialize();
      return 0;
    }
    // Display connect message and start wait feedback thread
    printf( "Connecting to %s WMI server at ", szSysName );
    wprintf( L"%s...", pNamespace );

    // make a wait event and kick off wait thread
    hWait = CreateEvent( NULL, TRUE, FALSE, NULL );
    hThread = CreateThread( NULL, 0, (LPTHREAD_START_ROUTINE) WaitThread, hWait, 0, &ThreadId );

    // connect and get the IWbemServices pointer
    hr = pIWbemLocator->ConnectServer( pNamespace,
                                       NULL,
                                       NULL,
                                       0L,
                                       0L,
                                       NULL,
                                       NULL,
                                       &pIWbemServices );

    // kill wait feedback thread
    SetEvent( hWait );
    // make sure thread is gone
    WaitForSingleObject( hThread, INFINITE );
    CloseHandle( hWait );
    SysFreeString( pNamespace );

    // See what WBEM/WMI says about DiskPerf
    if ( hr == WBEM_NO_ERROR )
    {
      printf( "\nConnected with %s\n", szSysName );

      // done with locator object
      pIWbemLocator->Release( );

      // go enumerate diskperf instances...
      DiskPerfDetails( pIWbemServices );
      pIWbemServices->Release( );
    }
    else
    {
      printf( "\nFailed to connect with %s, Error: 0x%8lX\n", szSysName, hr );
    }
  }
  else
  {
    printf( "WMI services not present or unavailable!\n" );
  }

  CoUninitialize( );

  return 0;
}

DWORD WINAPI WaitThread ( HANDLE hWait )

Definition at line 132 of file WMIDiskPerf.Cpp.

{
  while ( WaitForSingleObject( hWait, 300 ) == WAIT_TIMEOUT )
  {
    printf(".");
  }
  printf("\n");

  return 0;
}

Generated on Wed Nov 13 2024 16:54:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/AdvReco/AdvReco.cpp File Reference

  • TabletPC
  • AdvReco
Defines | Functions | Variables

AdvReco.cpp File Reference

#include <windows.h>
#include <commctrl.h>
#include <atlbase.h>
#include <atlwin.h>
#include <atlcom.h>
#include <msinkaut.h>
#include <msinkaut_i.c>
#include <tpcerror.h>
#include "resource.h"
#include "EventSinks.h"
#include "ChildWnds.h"
#include "AdvReco.h"

Go to the source code of this file.

Defines

#define | _WIN32_WINNT 0x0500
#define | countof(array) (sizeof(array)/sizeof(array[0]))
#define | ListView_GetCheckState(hwndLV, i) ((((UINT)(SNDMSG((hwndLV), LVM_GETITEMSTATE, (WPARAM)(i), LVIS_STATEIMAGEMASK))) >> 12) -1)
#define | ListView_SetCheckState(hwndLV, i, fCheck) ListView_SetItemState(hwndLV, i, INDEXTOSTATEIMAGEMASK((fCheck ? 2 : 1)), LVIS_STATEIMAGEMASK)
#define | MIIM_FTYPE 0x00000100
#define | MIIM_STRING 0x00000040

Functions

int APIENTRY | WinMain (HINSTANCE hInstance, HINSTANCE, LPSTR, int nCmdShow)

Variables

CComModule | _Module
const InkApplicationGesture | gc_igtMultiStrokeGestures []
const InkApplicationGesture | gc_igtSingleStrokeGestures []
const LONG | gc_lMaxInputScopeMenuItemLength = 40
const UINT | gc_nRecommendedForMixedMode []
const LPOLESTR | gc_pwsInputScopes []
const TCHAR | gc_szAppName [] = TEXT("Advanced Recognition")

Define Documentation

#define _WIN32_WINNT 0x0500

Definition at line 45 of file AdvReco.cpp.

#define countof ( array ) (sizeof(array)/sizeof(array[0]))

Definition at line 73 of file AdvReco.cpp.

#define ListView_GetCheckState | ( | hwndLV,
 |  | i |
 | ) |  | ((((UINT)(SNDMSG((hwndLV), LVM_GETITEMSTATE, (WPARAM)(i), LVIS_STATEIMAGEMASK))) >> 12) -1)

Definition at line 61 of file AdvReco.cpp.

#define ListView_SetCheckState | ( | hwndLV,
 |  | i,
 |  | fCheck |
 | ) |  | ListView_SetItemState(hwndLV, i, INDEXTOSTATEIMAGEMASK((fCheck ? 2 : 1)), LVIS_STATEIMAGEMASK)

Definition at line 56 of file AdvReco.cpp.

#define MIIM_FTYPE 0x00000100

Definition at line 69 of file AdvReco.cpp.

#define MIIM_STRING 0x00000040

Definition at line 66 of file AdvReco.cpp.

Function Documentation

int APIENTRY WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | ,
 |  | LPSTR | ,
 |  | int | nCmdShow
 | ) |  |

Definition at line 201 of file AdvReco.cpp.

{
    int iRet = 0;

    // Initialize the COM library and the application module
    if (S_OK == ::CoInitializeEx(NULL, COINIT_APARTMENTTHREADED))
    {
        _Module.Init(NULL, hInstance);

        // Register the common control classes used by the application
        INITCOMMONCONTROLSEX icc;
        icc.dwSize = sizeof(icc);
        icc.dwICC = ICC_LISTVIEW_CLASSES | ICC_BAR_CLASSES;
        if (TRUE == ::InitCommonControlsEx(&icc))
        {
            // Call the boilerplate function of the application
            iRet = CAdvRecoApp::Run(nCmdShow);
        }
        else
        {
            ::MessageBox(NULL, TEXT("Error initializing the common controls."),
                         gc_szAppName, MB_ICONERROR | MB_OK);
        }

        // Release the module and the COM library
        _Module.Term();
        ::CoUninitialize();
    }

    return iRet;
}

Variable Documentation

CComModule _Module

Definition at line 77 of file AdvReco.cpp.

const InkApplicationGesture gc_igtMultiStrokeGestures[]
Initial value:
 {
    IAG_ArrowUp, IAG_ArrowDown, IAG_ArrowLeft,
    IAG_ArrowRight, IAG_Exclamation, IAG_DoubleTap
}

Definition at line 165 of file AdvReco.cpp.

const InkApplicationGesture gc_igtSingleStrokeGestures[]
Initial value:
 {
    IAG_Scratchout, IAG_Triangle, IAG_Square, IAG_Star, IAG_Check,
    IAG_Circle, IAG_DoubleCircle, IAG_Curlicue, IAG_DoubleCurlicue,
    IAG_SemiCircleLeft, IAG_SemiCircleRight,
    IAG_ChevronUp, IAG_ChevronDown, IAG_ChevronLeft,
    IAG_ChevronRight, IAG_Up, IAG_Down, IAG_Left, IAG_Right, IAG_UpDown, IAG_DownUp,
    IAG_LeftRight, IAG_RightLeft, IAG_UpLeftLong, IAG_UpRightLong, IAG_DownLeftLong,
    IAG_DownRightLong, IAG_UpLeft, IAG_UpRight, IAG_DownLeft, IAG_DownRight, IAG_LeftUp,
    IAG_LeftDown, IAG_RightUp, IAG_RightDown, IAG_Tap
}

Definition at line 145 of file AdvReco.cpp.

const LONG gc_lMaxInputScopeMenuItemLength = 40

Definition at line 142 of file AdvReco.cpp.

const UINT gc_nRecommendedForMixedMode[]
Initial value:
 {
        0 , 3, 6,
        7 , 8 , 25  }

Definition at line 160 of file AdvReco.cpp.

const LPOLESTR gc_pwsInputScopes[]

Definition at line 95 of file AdvReco.cpp.

const TCHAR gc_szAppName[] = TEXT("Advanced Recognition")

Definition at line 181 of file AdvReco.cpp.

Generated on Wed Nov 13 2024 16:54:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/AdvReco/AdvReco.h File Reference

  • TabletPC
  • AdvReco
Classes

AdvReco.h File Reference

Go to the source code of this file.

Classes

class CAdvRecoApp
Generated on Wed Nov 13 2024 16:54:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/AdvReco/ChildWnds.cpp File Reference

  • TabletPC
  • AdvReco
Defines | Variables

ChildWnds.cpp File Reference

#include <windows.h>
#include <atlbase.h>
#include <atlwin.h>
#include <msinkaut.h>
#include "resource.h"
#include "ChildWnds.h"

Go to the source code of this file.

Defines

#define | _WIN32_WINNT 0x0500
#define | CLR_BLUE RGB(0x00,0x00,0x80)
#define | CLR_GRAY RGB(0x80,0x80,0x80)

Variables

CComModule | _Module

Define Documentation

#define _WIN32_WINNT 0x0500

Definition at line 21 of file ChildWnds.cpp.

#define CLR_BLUE RGB(0x00,0x00,0x80)

Definition at line 39 of file ChildWnds.cpp.

#define CLR_GRAY RGB(0x80,0x80,0x80)

Definition at line 40 of file ChildWnds.cpp.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:54:46 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/AdvReco/ChildWnds.h File Reference

  • TabletPC
  • AdvReco
Classes

ChildWnds.h File Reference

Go to the source code of this file.

Classes

class | CInkInputWnd
class | CRecoOutputWnd
Generated on Wed Nov 13 2024 16:54:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/AdvReco/EventSinks.h File Reference

  • TabletPC
  • AdvReco
Classes | Defines

EventSinks.h File Reference

Go to the source code of this file.

Classes

class | IInkCollectorEventsImpl< T >
class | IInkRecognitionEventsImpl< T >

Defines

#define | DISPID_CEGesture 0x0000000a
#define | DISPID_CEStroke 0x00000001
#define | DISPID_RERecognitionWithAlternates 0x00000001
#define | SINK_ID 1

Define Documentation

#define DISPID_CEGesture 0x0000000a

Definition at line 30 of file EventSinks.h.

#define DISPID_CEStroke 0x00000001

Definition at line 27 of file EventSinks.h.

#define DISPID_RERecognitionWithAlternates 0x00000001

Definition at line 33 of file EventSinks.h.

#define SINK_ID 1

Definition at line 37 of file EventSinks.h.

Generated on Wed Nov 13 2024 16:54:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/AdvReco/resource.h File Reference

  • TabletPC
  • AdvReco
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | ID_CLEAR 40302
#define | ID_EXIT 40309
#define | ID_GUIDE_BOXES 40305
#define | ID_GUIDE_LINES 40304
#define | ID_GUIDE_NONE 40303
#define | ID_INPUTSCOPE_COERCE 40100
#define | ID_INPUTSCOPE_FIRST 40101
#define | ID_INPUTSCOPE_LAST 40199
#define | ID_MODE_GESTURES 40308
#define | ID_MODE_INK 40306
#define | ID_MODE_INK_AND_GESTURES 40307
#define | ID_RECOGNIZE 40301
#define | ID_RECOGNIZER_DEFAULT 40000
#define | ID_RECOGNIZER_FIRST 40001
#define | ID_RECOGNIZER_LAST 40099
#define | IDR_APPICON 50
#define | IDR_MENU 101
#define | IDS_GESTURE_UNKNOWN 99
#define | IDS_MSGESTURE_FIRST 200
#define | IDS_SSGESTURE_FIRST 100
#define | IDS_STRING101 101
#define | IDS_STRING102 102
#define | IDS_STRING103 103
#define | IDS_STRING104 104
#define | IDS_STRING105 105
#define | IDS_STRING106 106
#define | IDS_STRING107 107
#define | IDS_STRING108 108
#define | IDS_STRING109 109
#define | IDS_STRING110 110
#define | IDS_STRING111 111
#define | IDS_STRING112 112
#define | IDS_STRING113 113
#define | IDS_STRING114 114
#define | IDS_STRING115 115
#define | IDS_STRING116 116
#define | IDS_STRING117 117
#define | IDS_STRING118 118
#define | IDS_STRING119 119
#define | IDS_STRING120 120
#define | IDS_STRING121 121
#define | IDS_STRING122 122
#define | IDS_STRING123 123
#define | IDS_STRING124 124
#define | IDS_STRING125 125
#define | IDS_STRING126 126
#define | IDS_STRING127 127
#define | IDS_STRING128 128
#define | IDS_STRING129 129
#define | IDS_STRING130 130
#define | IDS_STRING131 131
#define | IDS_STRING132 132
#define | IDS_STRING133 133
#define | IDS_STRING134 134
#define | IDS_STRING135 135
#define | IDS_STRING136 136
#define | IDS_STRING201 201
#define | IDS_STRING202 202
#define | IDS_STRING203 203
#define | IDS_STRING204 204
#define | IDS_STRING205 205
#define | IDS_STRING206 206
#define | IDS_STRING207 207

Define Documentation

#define ID_CLEAR 40302

Definition at line 60 of file resource.h.

#define ID_EXIT 40309

Definition at line 67 of file resource.h.

#define ID_GUIDE_BOXES 40305

Definition at line 63 of file resource.h.

#define ID_GUIDE_LINES 40304

Definition at line 62 of file resource.h.

#define ID_GUIDE_NONE 40303

Definition at line 61 of file resource.h.

#define ID_INPUTSCOPE_COERCE 40100

Definition at line 56 of file resource.h.

#define ID_INPUTSCOPE_FIRST 40101

Definition at line 57 of file resource.h.

#define ID_INPUTSCOPE_LAST 40199

Definition at line 58 of file resource.h.

#define ID_MODE_GESTURES 40308

Definition at line 66 of file resource.h.

#define ID_MODE_INK 40306

Definition at line 64 of file resource.h.

#define ID_MODE_INK_AND_GESTURES 40307

Definition at line 65 of file resource.h.

#define ID_RECOGNIZE 40301

Definition at line 59 of file resource.h.

#define ID_RECOGNIZER_DEFAULT 40000

Definition at line 53 of file resource.h.

#define ID_RECOGNIZER_FIRST 40001

Definition at line 54 of file resource.h.

#define ID_RECOGNIZER_LAST 40099

Definition at line 55 of file resource.h.

#define IDR_APPICON 50

Definition at line 5 of file resource.h.

#define IDR_MENU 101

Definition at line 8 of file resource.h.

#define IDS_GESTURE_UNKNOWN 99

Definition at line 6 of file resource.h.

#define IDS_MSGESTURE_FIRST 200

Definition at line 45 of file resource.h.

#define IDS_SSGESTURE_FIRST 100

Definition at line 7 of file resource.h.

#define IDS_STRING101 101

Definition at line 9 of file resource.h.

#define IDS_STRING102 102

Definition at line 10 of file resource.h.

#define IDS_STRING103 103

Definition at line 11 of file resource.h.

#define IDS_STRING104 104

Definition at line 12 of file resource.h.

#define IDS_STRING105 105

Definition at line 13 of file resource.h.

#define IDS_STRING106 106

Definition at line 14 of file resource.h.

#define IDS_STRING107 107

Definition at line 15 of file resource.h.

#define IDS_STRING108 108

Definition at line 16 of file resource.h.

#define IDS_STRING109 109

Definition at line 17 of file resource.h.

#define IDS_STRING110 110

Definition at line 18 of file resource.h.

#define IDS_STRING111 111

Definition at line 19 of file resource.h.

#define IDS_STRING112 112

Definition at line 20 of file resource.h.

#define IDS_STRING113 113

Definition at line 21 of file resource.h.

#define IDS_STRING114 114

Definition at line 22 of file resource.h.

#define IDS_STRING115 115

Definition at line 23 of file resource.h.

#define IDS_STRING116 116

Definition at line 24 of file resource.h.

#define IDS_STRING117 117

Definition at line 25 of file resource.h.

#define IDS_STRING118 118

Definition at line 26 of file resource.h.

#define IDS_STRING119 119

Definition at line 27 of file resource.h.

#define IDS_STRING120 120

Definition at line 28 of file resource.h.

#define IDS_STRING121 121

Definition at line 29 of file resource.h.

#define IDS_STRING122 122

Definition at line 30 of file resource.h.

#define IDS_STRING123 123

Definition at line 31 of file resource.h.

#define IDS_STRING124 124

Definition at line 32 of file resource.h.

#define IDS_STRING125 125

Definition at line 33 of file resource.h.

#define IDS_STRING126 126

Definition at line 34 of file resource.h.

#define IDS_STRING127 127

Definition at line 35 of file resource.h.

#define IDS_STRING128 128

Definition at line 36 of file resource.h.

#define IDS_STRING129 129

Definition at line 37 of file resource.h.

#define IDS_STRING130 130

Definition at line 38 of file resource.h.

#define IDS_STRING131 131

Definition at line 39 of file resource.h.

#define IDS_STRING132 132

Definition at line 40 of file resource.h.

#define IDS_STRING133 133

Definition at line 41 of file resource.h.

#define IDS_STRING134 134

Definition at line 42 of file resource.h.

#define IDS_STRING135 135

Definition at line 43 of file resource.h.

#define IDS_STRING136 136

Definition at line 44 of file resource.h.

#define IDS_STRING201 201

Definition at line 46 of file resource.h.

#define IDS_STRING202 202

Definition at line 47 of file resource.h.

#define IDS_STRING203 203

Definition at line 48 of file resource.h.

#define IDS_STRING204 204

Definition at line 49 of file resource.h.

#define IDS_STRING205 205

Definition at line 50 of file resource.h.

#define IDS_STRING206 206

Definition at line 51 of file resource.h.

#define IDS_STRING207 207

Definition at line 52 of file resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/AutoClaims/C#/AssemblyInfo.cs File Reference

  • TabletPC
  • AutoClaims
  • C#

AssemblyInfo.cs File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/AutoClaims/C#/AutoClaims.cs File Reference

  • TabletPC
  • AutoClaims
  • C#
Classes | Namespaces

AutoClaims.cs File Reference

Go to the source code of this file.

Classes

class | AutoClaims::AutoClaims
The AutoClaims Sample Application form class. More...
struct | AutoClaims::InkLayer
InkLayer represents a given ink layer, which has a color and visibility setting associated with it. More...

Namespaces

namespace | AutoClaims
Generated on Wed Nov 13 2024 16:54:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/AutoClaims15/C#/AssemblyInfo.cs File Reference

  • TabletPC
  • AutoClaims15
  • C#

AssemblyInfo.cs File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/AutoClaims15/C#/AutoClaims.cs File Reference

  • TabletPC
  • AutoClaims15
  • C#
Classes | Namespaces

AutoClaims.cs File Reference

Go to the source code of this file.

Classes

class | AutoClaims::AutoClaims
The AutoClaims Sample Application form class. More...
struct | AutoClaims::InkLayer
InkLayer represents a given ink layer, which has a color and visibility setting associated with it. More...

Namespaces

namespace | AutoClaims
Generated on Wed Nov 13 2024 16:54:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/AutoClaims_WebControl/C#/AssemblyInfo.cs File Reference

  • TabletPC
  • AutoClaims_WebControl
  • C#

AssemblyInfo.cs File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/AutoClaims_WebControl/C#/AutoClaims.cs File Reference

  • TabletPC
  • AutoClaims_WebControl
  • C#
Classes | Namespaces

AutoClaims.cs File Reference

Go to the source code of this file.

Classes

class | AutoClaims::AutoClaims
The AutoClaims Sample Application form class. More...
struct | AutoClaims::InkLayer
InkLayer represents a given ink layer, which has a color and visibility setting associated with it. More...

Namespaces

namespace | AutoClaims
Generated on Wed Nov 13 2024 16:54:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/BasicRecognition/BasicRecognition.cpp File Reference

  • TabletPC
  • BasicRecognition
Functions | Variables

BasicRecognition.cpp File Reference

#include <windows.h>
#include <comdef.h>
#include <msinkaut.h>
#include <msinkaut_i.c>
#include "resource.h"

Go to the source code of this file.

Functions

void | CleanUp ()
BOOL | RegisterWindowClass (HINSTANCE hInstance)
int APIENTRY | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
LRESULT CALLBACK | WndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)

Variables

IInkCollector * | g_pIInkCollector = NULL
IInkDisp * | g_pIInkDisp = NULL
IInkRecognizerContext * | g_pIInkRecoContext = NULL
const TCHAR * | gc_szAppName = TEXT("Basic Recognition")

Function Documentation

void CleanUp ( void )

Definition at line 58 of file BasicRecognition.cpp.

{
    if (g_pIInkRecoContext != NULL)
    {
        g_pIInkRecoContext->Release();
        g_pIInkRecoContext = NULL;
    }

    if (g_pIInkDisp != NULL)
    {
        g_pIInkDisp->Release();
        g_pIInkDisp = NULL;
    }

    if (g_pIInkCollector != NULL)
    {
        g_pIInkCollector->Release();
        g_pIInkCollector = NULL;
    }
}

BOOL RegisterWindowClass ( HINSTANCE hInstance )

Definition at line 233 of file BasicRecognition.cpp.

{
    WNDCLASSEX WndClassEx;

    WndClassEx.cbSize        = sizeof(WndClassEx);
    WndClassEx.style         = CS_HREDRAW | CS_VREDRAW;
    WndClassEx.lpfnWndProc   = WndProc;
    WndClassEx.cbClsExtra    = 0;
    WndClassEx.cbWndExtra    = 0;
    WndClassEx.hInstance     = hInstance;
    WndClassEx.hIcon         = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON));
    WndClassEx.hIconSm       = WndClassEx.hIcon;
    WndClassEx.hCursor       = LoadCursor(NULL, IDC_ARROW);
    WndClassEx.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
    WndClassEx.lpszMenuName  = MAKEINTRESOURCE(IDR_MENU);
    WndClassEx.lpszClassName = gc_szAppName;

    if (!RegisterClassEx(&WndClassEx))
    {
        MessageBox(NULL, TEXT("Failed to register window class!"),
                   gc_szAppName, MB_ICONERROR);
        return false;
    }

    return true;
}

int APIENTRY WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 280 of file BasicRecognition.cpp.

{
    if (!RegisterWindowClass(hInstance))
        return 0;

    CoInitialize(NULL);

    // Create the application window
    HWND hWnd = CreateWindowEx(WS_EX_CLIENTEDGE, gc_szAppName, gc_szAppName,
                               WS_OVERLAPPEDWINDOW,
                               CW_USEDEFAULT, CW_USEDEFAULT,
                               CW_USEDEFAULT, CW_USEDEFAULT,
                               NULL, NULL, hInstance, NULL);
    if (NULL == hWnd)
    {
        MessageBox(NULL, TEXT("Error creating the window"), TEXT("Error"),
                   MB_OK | MB_ICONINFORMATION);
        return 0;
    }

    // Show the main window
    ShowWindow(hWnd, nCmdShow);
    UpdateWindow(hWnd);

    // Start the boilerplate message loop
    MSG msg;
    while (GetMessage(&msg, NULL, 0, 0) > 0)
    {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }

    CleanUp();
    CoUninitialize();

    return msg.wParam;
}

LRESULT CALLBACK WndProc | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 98 of file BasicRecognition.cpp.

{
    switch (uMsg)
    {
        case WM_CREATE:
        {
            HRESULT hr;

            // Create a recognition context that uses the default recognizer.
            // The single context will be used for all the recognition.
            hr = CoCreateInstance(CLSID_InkRecognizerContext,
                                  NULL, CLSCTX_INPROC_SERVER,
                                  IID_IInkRecognizerContext,
                                  (void **) &g_pIInkRecoContext);
            if (FAILED(hr))
            {
                ::MessageBox(NULL, TEXT("There are no handwriting recognizers installed.\n")
                                   TEXT("You need to have at least one in order to run this sample.\nExiting."),
                     gc_szAppName, MB_ICONERROR);
                return -1;
            }

            // Create the InkCollector object.
            hr = CoCreateInstance(CLSID_InkCollector,
                                  NULL, CLSCTX_INPROC_SERVER,
                                  IID_IInkCollector,
                                  (void **) &g_pIInkCollector);
            if (FAILED(hr))
                return -1;

            // Get a pointer to the Ink object
            hr = g_pIInkCollector->get_Ink(&g_pIInkDisp);
            if (FAILED(hr))
                return -1;

            // Tell InkCollector the window to collect ink in
            hr = g_pIInkCollector->put_hWnd((long)hwnd);
            if (FAILED(hr))
                return -1;

            // Enable ink input in the window
            hr = g_pIInkCollector->put_Enabled(VARIANT_TRUE);
            if (FAILED(hr))
                return -1;

            break;
        }

        case WM_DESTROY:

            PostQuitMessage(0);
            break;

        case WM_COMMAND:

            if (wParam == ID_CLEAR)
            {
                // Delete all strokes from the Ink
                g_pIInkDisp->DeleteStrokes(0);

                // Update the window
                InvalidateRect(hwnd, NULL, TRUE);
            }
            else if (wParam == ID_RECOGNIZE)
            {
                // change cursor to the system's Hourglass
                HCURSOR hCursor = ::SetCursor(::LoadCursor(NULL, IDC_WAIT));
                // Get a pointer to the ink stroke collection
                // This collection is a snapshot of the entire ink object
                IInkStrokes* pIInkStrokes = NULL;
                HRESULT hr = g_pIInkDisp->get_Strokes(&pIInkStrokes);
                if (SUCCEEDED(hr))
                {
                    // Pass the stroke collection to the recognition context
                    hr = g_pIInkRecoContext->putref_Strokes(pIInkStrokes);
                    if (SUCCEEDED(hr))
                    {
                        // Recognize
                        IInkRecognitionResult* pIInkRecoResult = NULL;
                        InkRecognitionStatus RecognitionStatus;
                        hr = g_pIInkRecoContext->Recognize(&RecognitionStatus, &pIInkRecoResult);
                        if (SUCCEEDED(hr) && (pIInkRecoResult!= NULL))
                        {
                            // Get the best result of the recognition
                            BSTR bstrBestResult = NULL;
                            hr = pIInkRecoResult->get_TopString(&bstrBestResult);
                            pIInkRecoResult->Release();
                            pIInkRecoResult = NULL;

                            // Show the result string
                            if (SUCCEEDED(hr) && bstrBestResult)
                            {
                                MessageBoxW(hwnd, bstrBestResult,
                                            L"Recognition Results", MB_OK);
                                SysFreeString(bstrBestResult);
                            }
                        }
                        // Reset the recognition context
                        g_pIInkRecoContext->putref_Strokes(NULL);
                    }
                    pIInkStrokes->Release();
                }
                // restore the cursor
                ::SetCursor(hCursor);
            }
            else
            {
                return DefWindowProc(hwnd, uMsg, wParam, lParam);
            }
            break;

        default:
            return DefWindowProc(hwnd, uMsg, wParam, lParam);
    }

    return 0;
}

Variable Documentation

IInkCollector* g_pIInkCollector = NULL

Definition at line 46 of file BasicRecognition.cpp.

IInkDisp* g_pIInkDisp = NULL

Definition at line 47 of file BasicRecognition.cpp.

IInkRecognizerContext* g_pIInkRecoContext = NULL

Definition at line 48 of file BasicRecognition.cpp.

const TCHAR* gc_szAppName = TEXT("Basic Recognition")

Definition at line 43 of file BasicRecognition.cpp.

Generated on Wed Nov 13 2024 16:54:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/BasicRecognition/resource.h File Reference

  • TabletPC
  • BasicRecognition
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | ID_CLEAR 40002
#define | ID_RECOGNIZE 40001
#define | IDI_ICON 103
#define | IDR_ICON 102
#define | IDR_MENU 101

Define Documentation

#define ID_CLEAR 40002

Definition at line 9 of file resource.h.

#define ID_RECOGNIZE 40001

Definition at line 8 of file resource.h.

#define IDI_ICON 103

Definition at line 7 of file resource.h.

#define IDR_ICON 102

Definition at line 6 of file resource.h.

#define IDR_MENU 101

Definition at line 5 of file resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/EventSink/EventSink.cpp File Reference

  • TabletPC
  • EventSink
Defines | Functions | Variables

EventSink.cpp File Reference

#include <windows.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <assert.h>
#include <msinkaut.h>
#include "TpcConpt.h"
#include "EventSink.h"
#include <msinkaut_i.c>

Go to the source code of this file.

Defines

#define | interface struct
#define | MAX_LOADSTRING 100

Functions

LRESULT CALLBACK | About (HWND, UINT, WPARAM, LPARAM)
BOOL | InitInstance (HINSTANCE, int)
ATOM | MyRegisterClass (HINSTANCE hInstance)
int APIENTRY | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
LRESULT CALLBACK | WndProc (HWND, UINT, WPARAM, LPARAM)

Variables

HINSTANCE | hInst
TCHAR | szTitle [MAX_LOADSTRING]
TCHAR | szWindowClass [MAX_LOADSTRING]

Define Documentation

#define interface struct

Definition at line 43 of file EventSink.cpp.

#define MAX_LOADSTRING 100

Definition at line 47 of file EventSink.cpp.

Function Documentation

LRESULT CALLBACK About | ( | HWND | hDlg,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 306 of file EventSink.cpp.

{
  switch (message)
  {
  case WM_INITDIALOG:
    return TRUE;

  case WM_COMMAND:
    if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
    {
      EndDialog(hDlg, LOWORD(wParam));
      return TRUE;
    }
    break;

  }

  return FALSE;
}

BOOL InitInstance | ( | HINSTANCE | hInstance,
 |  | int | nCmdShow
 | ) |  |

Definition at line 174 of file EventSink.cpp.

{
   HWND hWnd;

   hInst = hInstance; // Store instance handle in our global variable

   hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
      CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);

   if (!hWnd)
   {
      return FALSE;
   }

   ShowWindow(hWnd, nCmdShow);
   UpdateWindow(hWnd);

   return TRUE;
}

ATOM MyRegisterClass ( HINSTANCE hInstance )

Definition at line 135 of file EventSink.cpp.

{
  WNDCLASSEX wcex;

  wcex.cbSize = sizeof(WNDCLASSEX);

  wcex.style      = CS_HREDRAW | CS_VREDRAW;
  wcex.lpfnWndProc  = (WNDPROC)WndProc;
  wcex.cbClsExtra   = 0;
  wcex.cbWndExtra   = 0;
  wcex.hInstance    = hInstance;
  wcex.hIcon      = LoadIcon(hInstance, (LPCTSTR)IDI_EVENTSINK);
  wcex.hCursor    = LoadCursor(NULL, IDC_ARROW);
  wcex.hbrBackground  = (HBRUSH)(COLOR_WINDOW+1);
  wcex.lpszMenuName = (LPCTSTR)IDC_EVENTSINK;
  wcex.lpszClassName  = szWindowClass;
  wcex.hIconSm    = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL);

  return RegisterClassEx(&wcex);
}

int APIENTRY WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 82 of file EventSink.cpp.

{
  CoInitialize(NULL);
  MSG msg;
  HACCEL hAccelTable;

  // Initialize global strings
  LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
  LoadString(hInstance, IDC_EVENTSINK, szWindowClass, MAX_LOADSTRING);
  MyRegisterClass(hInstance);

  // Perform application initialization:
  if (!InitInstance (hInstance, nCmdShow))
  {
    return FALSE;
  }

  hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_EVENTSINK);

  // Main message loop:
  while (GetMessage(&msg, NULL, 0, 0))
  {
    if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
    {
      TranslateMessage(&msg);
      DispatchMessage(&msg);
    }
  }

    CoUninitialize();
  return (int) msg.wParam;
}

LRESULT CALLBACK WndProc | ( | HWND | hWnd,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 219 of file EventSink.cpp.

{
    static CMyInkCollector *pmic = NULL;
  int wmId, wmEvent;

  switch (message)
  {
  case WM_CREATE:

      // Allocate and initialize memory for object
      pmic = new CMyInkCollector();

      if (pmic != NULL)
      {
          // Real initialization. This consists of creating
          //  an ink collector object and attaching it to
          //  the current window.
          if (SUCCEEDED(pmic->Init(hWnd)))
          {
              return 0;
          }

          // Failure free resources.
          delete pmic;
          pmic = NULL;
      }

      return -1;

  case WM_COMMAND:

    wmId    = LOWORD(wParam);
    wmEvent = HIWORD(wParam);

    // Parse the menu selections:
    switch (wmId)
    {
    case IDM_ABOUT:
      DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);
      break;

    case IDM_EXIT:
      DestroyWindow(hWnd);
      break;

    default:
      return DefWindowProc(hWnd, message, wParam, lParam);
    }
    break;

  case WM_DESTROY:
      // The destructor for the object handles releasing the
      //  InkCollector and disconnecting the InkCollector
      //  from the object's event sink.
        delete pmic;
        pmic = NULL;
    PostQuitMessage(0);
    break;

  default:
    return DefWindowProc(hWnd, message, wParam, lParam);
  }

  return 0;
}

Variable Documentation

HINSTANCE hInst

Definition at line 51 of file EventSink.cpp.

TCHAR szTitle[MAX_LOADSTRING]

Definition at line 52 of file EventSink.cpp.

TCHAR szWindowClass[MAX_LOADSTRING]

Definition at line 53 of file EventSink.cpp.

Generated on Wed Nov 13 2024 16:54:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/EventSink/EventSink.h File Reference

  • TabletPC
  • EventSink
Classes

EventSink.h File Reference

#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Classes

class | CMyInkCollector
class | CMyInkEvents
Generated on Wed Nov 13 2024 16:54:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/EventSink/Resource.h File Reference

  • TabletPC
  • EventSink
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_EVENTSINK 109
#define | IDC_MYICON 2
#define | IDC_STATIC -1
#define | IDD_ABOUTBOX 103
#define | IDD_EVENTSINK_DIALOG 102
#define | IDI_EVENTSINK 107
#define | IDI_SMALL 108
#define | IDM_ABOUT 104
#define | IDM_EXIT 105
#define | IDR_MAINFRAME 128
#define | IDS_APP_TITLE 103

Define Documentation

#define IDC_EVENTSINK 109

Definition at line 15 of file Resource.h.

#define IDC_MYICON 2

Definition at line 16 of file Resource.h.

#define IDC_STATIC -1

Definition at line 17 of file Resource.h.

#define IDD_ABOUTBOX 103

Definition at line 10 of file Resource.h.

#define IDD_EVENTSINK_DIALOG 102

Definition at line 9 of file Resource.h.

#define IDI_EVENTSINK 107

Definition at line 13 of file Resource.h.

#define IDI_SMALL 108

Definition at line 14 of file Resource.h.

#define IDM_ABOUT 104

Definition at line 11 of file Resource.h.

#define IDM_EXIT 105

Definition at line 12 of file Resource.h.

#define IDR_MAINFRAME 128

Definition at line 8 of file Resource.h.

#define IDS_APP_TITLE 103

Definition at line 6 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/EventSink/TpcConpt.h File Reference

  • TabletPC
  • EventSink
Classes

TpcConpt.h File Reference

Go to the source code of this file.

Classes

class InkCollectorEvents
Generated on Wed Nov 13 2024 16:54:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/InkBlog/C#/AddBlog.aspx.cs File Reference

  • TabletPC
  • InkBlog
  • C#
Classes | Namespaces

AddBlog.aspx.cs File Reference

Go to the source code of this file.

Classes

class | InkBlog::AddBlog
The AddBlog code-behind page. More...

Namespaces

namespace | InkBlog
Generated on Wed Nov 13 2024 16:54:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/InkBlog/C#/AssemblyInfo.cs File Reference

  • TabletPC
  • InkBlog
  • C#

AssemblyInfo.cs File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/InkBlog/C#/Default.aspx.cs File Reference

  • TabletPC
  • InkBlog
  • C#
Classes | Namespaces

Default.aspx.cs File Reference

Go to the source code of this file.

Classes

class | InkBlog::_Default
The Default code-behind page. More...

Namespaces

namespace | InkBlog
Generated on Wed Nov 13 2024 16:54:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/InkBlog/C#/InkArea.cs File Reference

  • TabletPC
  • InkBlog
  • C#
Classes | Namespaces

InkArea.cs File Reference

Go to the source code of this file.

Classes

class | InkBlog::InkArea
The InkArea Sample Control class. More...

Namespaces

namespace | InkBlog
Generated on Wed Nov 13 2024 16:54:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/InkClipboard/AssemblyInfo.cs File Reference

  • TabletPC
  • InkClipboard

AssemblyInfo.cs File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/InkClipboard/InkClipboard.cs File Reference

  • TabletPC
  • InkClipboard
Classes | Namespaces | Enumerations

InkClipboard.cs File Reference

Go to the source code of this file.

Classes

class | InkClipboard::InkClipboard
The InkClipboard with Selection Sample Application form class. More...

Namespaces

namespace | InkClipboard

Enumerations

enum | InkClipboard::ApplicationMode { InkClipboard::Ink, InkClipboard::LassoSelection, InkClipboard::MoveInk }
Generated on Wed Nov 13 2024 16:54:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/InkCollection/C#/AssemblyInfo.cs File Reference

  • TabletPC
  • InkCollection
  • C#

AssemblyInfo.cs File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/InkCollection/C#/InkCollection.cs File Reference

  • TabletPC
  • InkCollection
  • C#
Classes | Namespaces

InkCollection.cs File Reference

Go to the source code of this file.

Classes

class | InkCollection::InkCollection
The InkCollection Sample Application form class. More...

Namespaces

namespace | InkCollection
Generated on Wed Nov 13 2024 16:54:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/InkCollection_RTS/C#/AssemblyInfo.cs File Reference

  • TabletPC
  • InkCollection_RTS
  • C#

AssemblyInfo.cs File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/InkCollection_RTS/C#/InkCollection.cs File Reference

  • TabletPC
  • InkCollection_RTS
  • C#
Classes | Namespaces

InkCollection.cs File Reference

Go to the source code of this file.

Classes

class | InkCollection::InkCollection
The InkCollection Sample Application form class. More...

Namespaces

namespace | InkCollection
Generated on Wed Nov 13 2024 16:54:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/InkDivider/C#/AssemblyInfo.cs File Reference

  • TabletPC
  • InkDivider
  • C#

AssemblyInfo.cs File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/InkDivider/C#/InkDividerForm.cs File Reference

  • TabletPC
  • InkDivider
  • C#
Classes | Namespaces

InkDividerForm.cs File Reference

Go to the source code of this file.

Classes

class | Microsoft::Samples::Ink::CS::InkDividerSample::InkDividerForm
InkDivider sample application form class. More...

Namespaces

namespace | Microsoft::Samples::Ink::CS::InkDividerSample
Generated on Wed Nov 13 2024 16:54:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/InkErase/C#/AssemblyInfo.cs File Reference

  • TabletPC
  • InkErase
  • C#

AssemblyInfo.cs File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/InkErase/C#/InkErase.cs File Reference

  • TabletPC
  • InkErase
  • C#
Classes | Namespaces | Enumerations

InkErase.cs File Reference

Go to the source code of this file.

Classes

class | InkErase::InkErase
Summary description for InkErase. More...

Namespaces

namespace | InkErase

Enumerations

enum | InkErase::ApplicationMode { InkErase::Ink, InkErase::CuspErase, InkErase::IntersectErase, InkErase::StrokeErase }
Generated on Wed Nov 13 2024 16:54:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/InkHitTest/AssemblyInfo.cs File Reference

  • TabletPC
  • InkHitTest

AssemblyInfo.cs File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/InkHitTest/InkHitTest.cs File Reference

  • TabletPC
  • InkHitTest
Classes | Namespaces | Enumerations

InkHitTest.cs File Reference

Go to the source code of this file.

Classes

class | InkHitTest::InkHitTest
The InkHitTest Sample Application form class. More...

Namespaces

namespace | InkHitTest

Enumerations

enum | InkHitTest::ApplicationMode { InkHitTest::None = 0, InkHitTest::Ink = 1, InkHitTest::HitTest = 2, InkHitTest::NearestPoint = 3 }
Generated on Wed Nov 13 2024 16:54:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/InkRecognition/C#/AssemblyInfo.cs File Reference

  • TabletPC
  • InkRecognition
  • C#

AssemblyInfo.cs File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/InkRecognition/C#/InkRecognition.cs File Reference

  • TabletPC
  • InkRecognition
  • C#
Classes | Namespaces

InkRecognition.cs File Reference

Go to the source code of this file.

Classes

class | InkRecognition::InkRecognition
The InkRecognition Sample Application form class. More...

Namespaces

namespace | InkRecognition
Generated on Wed Nov 13 2024 16:54:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/InkZoom/C#/AssemblyInfo.cs File Reference

  • TabletPC
  • InkZoom
  • C#

AssemblyInfo.cs File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/InkZoom/C#/InkZoom.cs File Reference

  • TabletPC
  • InkZoom
  • C#
Classes | Namespaces

InkZoom.cs File Reference

Go to the source code of this file.

Classes

class | Microsoft::Samples::Ink::Cs::InkZoom::InkZoom
The InkZoom Sample Application form class. More...

Namespaces

namespace | Microsoft::Samples::Ink::Cs::InkZoom
Generated on Wed Nov 13 2024 16:54:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/MultiReco/ChildWnds.cpp File Reference

  • TabletPC
  • MultiReco
Defines | Variables

ChildWnds.cpp File Reference

#include <windows.h>
#include <richedit.h>
#include <atlbase.h>
#include <atlwin.h>
#include <msinkaut.h>
#include "resource.h"
#include "ChildWnds.h"

Go to the source code of this file.

Defines

#define | _WIN32_WINNT 0x0500

Variables

CComModule | _Module

Define Documentation

#define _WIN32_WINNT 0x0500

Definition at line 21 of file ChildWnds.cpp.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:54:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/MultiReco/ChildWnds.h File Reference

  • TabletPC
  • MultiReco
Classes

ChildWnds.h File Reference

Go to the source code of this file.

Classes

class | CInkInputWnd
class | CRecoOutputWnd
Generated on Wed Nov 13 2024 16:54:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/MultiReco/EventSinks.h File Reference

  • TabletPC
  • MultiReco
Classes | Defines

EventSinks.h File Reference

Go to the source code of this file.

Classes

class | IInkCollectorEventsImpl< T >
class | IInkRecognitionEventsImpl< T >

Defines

#define | DISPID_CEStroke 0x00000001
#define | DISPID_RERecognition 0x00000002
#define | SINK_ID 1

Define Documentation

#define DISPID_CEStroke 0x00000001

Definition at line 27 of file EventSinks.h.

#define DISPID_RERecognition 0x00000002

Definition at line 30 of file EventSinks.h.

#define SINK_ID 1

Definition at line 34 of file EventSinks.h.

Generated on Wed Nov 13 2024 16:54:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/MultiReco/MultiReco.cpp File Reference

  • TabletPC
  • MultiReco
Defines | Functions | Variables

MultiReco.cpp File Reference

#include <windows.h>
#include <commctrl.h>
#include <commdlg.h>
#include <atlbase.h>
#include <atlwin.h>
#include <atlcom.h>
#include <msinkaut.h>
#include <msinkaut_i.c>
#include "resource.h"
#include "EventSinks.h"
#include "ChildWnds.h"
#include "MultiReco.h"

Go to the source code of this file.

Defines

#define | _WIN32_WINNT 0x0500
#define | countof(array) (sizeof(array)/sizeof(array[0]))

Functions

int APIENTRY | WinMain (HINSTANCE hInstance, HINSTANCE, LPSTR, int nCmdShow)

Variables

CComModule | _Module
const WCHAR | gc_szAppName [] = "Multiple Language Recognition with Serialization"

Define Documentation

#define _WIN32_WINNT 0x0500

Definition at line 48 of file MultiReco.cpp.

#define countof ( array ) (sizeof(array)/sizeof(array[0]))

Definition at line 57 of file MultiReco.cpp.

Function Documentation

int APIENTRY WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | ,
 |  | LPSTR | ,
 |  | int | nCmdShow
 | ) |  |

Definition at line 114 of file MultiReco.cpp.

{
    int iRet = 0;

    // Initialize the COM library and the application module
    if (S_OK == ::CoInitializeEx(NULL, COINIT_APARTMENTTHREADED))
    {
        _Module.Init(NULL, hInstance);

        // Register the common control classes used by the application
        INITCOMMONCONTROLSEX icc;
        icc.dwSize = sizeof(icc);
        icc.dwICC = ICC_BAR_CLASSES;
        if (TRUE == ::InitCommonControlsEx(&icc))
        {
            // Call the boilerplate function of the application
            iRet = CMultiRecoApp::Run(nCmdShow);
        }
        else
        {
            ::MessageBoxW(NULL, L"Error initializing the common controls.",
                         gc_szAppName, MB_ICONERROR | MB_OK);
        }

        // Release the module and the COM library
        _Module.Term();
        ::CoUninitialize();
    }

    return iRet;
}

Variable Documentation

CComModule _Module

Definition at line 61 of file MultiReco.cpp.

const WCHAR gc_szAppName[] = "Multiple Language Recognition with Serialization"

Definition at line 94 of file MultiReco.cpp.

Generated on Wed Nov 13 2024 16:54:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/MultiReco/MultiReco.h File Reference

  • TabletPC
  • MultiReco
Classes

MultiReco.h File Reference

Go to the source code of this file.

Classes

class CMultiRecoApp
Generated on Wed Nov 13 2024 16:54:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/MultiReco/resource.h File Reference

  • TabletPC
  • MultiReco
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | ID_CLEAR 40105
#define | ID_FILE_EXIT 40104
#define | ID_FILE_NEW 40100
#define | ID_FILE_OPEN 40101
#define | ID_FILE_SAVE 40102
#define | ID_FILE_SAVEAS 40103
#define | ID_RECOGNIZER_FIRST 40000
#define | ID_RECOGNIZER_LAST 40099
#define | IDR_APPICON 50
#define | IDR_MENU 101

Define Documentation

#define ID_CLEAR 40105

Definition at line 14 of file resource.h.

#define ID_FILE_EXIT 40104

Definition at line 13 of file resource.h.

#define ID_FILE_NEW 40100

Definition at line 9 of file resource.h.

#define ID_FILE_OPEN 40101

Definition at line 10 of file resource.h.

#define ID_FILE_SAVE 40102

Definition at line 11 of file resource.h.

#define ID_FILE_SAVEAS 40103

Definition at line 12 of file resource.h.

#define ID_RECOGNIZER_FIRST 40000

Definition at line 7 of file resource.h.

#define ID_RECOGNIZER_LAST 40099

Definition at line 8 of file resource.h.

#define IDR_APPICON 50

Definition at line 5 of file resource.h.

#define IDR_MENU 101

Definition at line 6 of file resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/RealTimeStylusPlugin/C#/AssemblyInfo.cs File Reference

  • TabletPC
  • RealTimeStylusPlugin
  • C#

AssemblyInfo.cs File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/RealTimeStylusPlugin/C#/CustomDynamicRendererPlugin.cs File Reference

  • TabletPC
  • RealTimeStylusPlugin
  • C#
Classes | Namespaces

CustomDynamicRendererPlugin.cs File Reference

Go to the source code of this file.

Classes

class | RealTimeStylusPlugins::CustomDynamicRendererPlugin
A real time stylus plugin that demonstrates custom dynamic rendering. More...

Namespaces

namespace | RealTimeStylusPlugins
Generated on Wed Nov 13 2024 16:54:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/RealTimeStylusPlugin/C#/PacketFilterPlugin.cs File Reference

  • TabletPC
  • RealTimeStylusPlugin
  • C#
Classes | Namespaces

PacketFilterPlugin.cs File Reference

Go to the source code of this file.

Classes

class | RealTimeStylusPlugins::PacketFilterPlugin
A real time stylus plugin that demonstrates packet modification. More...

Namespaces

namespace | RealTimeStylusPlugins
Generated on Wed Nov 13 2024 16:54:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/RealTimeStylusPlugin/C#/RealTimeStylusPluginApp.cs File Reference

  • TabletPC
  • RealTimeStylusPlugin
  • C#
Classes | Namespaces

RealTimeStylusPluginApp.cs File Reference

Go to the source code of this file.

Classes

struct | RealTimeStylusPluginApp::PluginListItem
Helper used to store information about a given plugin. More...
class | RealTimeStylusPluginApp::RealTimeStylusPluginApp
The RealTimeStylusPlugin Sample Application form class. More...

Namespaces

namespace | RealTimeStylusPluginApp
Generated on Wed Nov 13 2024 16:54:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/RecoDLL/RecoDll.cpp File Reference

  • TabletPC
  • RecoDLL
Functions | Variables

RecoDll.cpp File Reference

#include "stdafx.h"
#include "RecApis.h"
#include "assert.h"

Go to the source code of this file.

Functions

HRESULT WINAPI | AddStroke (HRECOCONTEXT hrc, PACKET_DESCRIPTION *pPacketDesc, ULONG cbPacket, BYTE *pPacket, const XFORM *pXForm)
HRESULT WINAPI | AdviseInkChange (HRECOCONTEXT hrc, BOOL bNewStroke)
HRESULT WINAPI | CloneContext (HRECOCONTEXT hrc, HRECOCONTEXT *pCloneHrc)
HRESULT WINAPI | CreateContext (HRECOGNIZER hrec, HRECOCONTEXT *phrc)
HRESULT WINAPI | CreateRecognizer (CLSID *pCLSID, HRECOGNIZER *phrec)
HRESULT WINAPI | DestroyAlternate (HRECOALT hrcalt)
HRESULT WINAPI | DestroyContext (HRECOCONTEXT hrc)
HRESULT WINAPI | DestroyRecognizer (HRECOGNIZER hrec)
BOOL APIENTRY | DllMain (HANDLE hModule, DWORD ul_reason_for_call, void *lpReserved)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)
HRESULT WINAPI | EndInkInput (HRECOCONTEXT hrc)
HRESULT WINAPI | GetAlternateList (HRECOCONTEXT hrc, RECO_RANGE *pRecoRange, ULONG *pcAlt, HRECOALT *phrcalt, ULONG iBreak)
HRESULT WINAPI | GetBestAlternate (HRECOCONTEXT hrc, HRECOALT *pHrcAlt)
HRESULT WINAPI | GetBestResultString (HRECOCONTEXT hrc, ULONG *pcbSize, WCHAR *pszBestResult)
HRESULT WINAPI | GetConfidenceLevel (HRECOALT hrcalt, RECO_RANGE *pRecoRange, CONFIDENCE_LEVEL *pcl)
HRESULT WINAPI | GetGuide (HRECOCONTEXT hrc, RECO_GUIDE *pGuide, ULONG *piIndex)
HRESULT WINAPI | GetGuideIndex (HRECOALT hrcalt, RECO_RANGE *pRecoRange, RECO_GUIDE *pGuide, ULONG iIndex)
HRESULT WINAPI | GetLatticePtr (HRECOCONTEXT hrc, RECO_LATTICE **ppLattice)
HRESULT WINAPI | GetMetrics (HRECOALT hrcalt, RECO_RANGE *pRecoRange, LINE_METRICS lm, LINE_SEGMENT *pls)
HRESULT WINAPI | GetPreferredPacketDescription (HRECOGNIZER hrec, PACKET_DESCRIPTION *pPacketDescription)
HRESULT WINAPI | GetPropertyRanges (HRECOALT hrcalt, ULONG id, ULONG *pcRanges, RECO_RANGE *pRecoRange)
HRESULT WINAPI | GetRangePropertyValue (HRECOALT hrcalt, ULONG id, RECO_RANGE *pRecoRange, ULONG *cbSize, BYTE *pProperty)
HRESULT WINAPI | GetRecoAttributes (HRECOGNIZER hrec, RECO_ATTRS *pRecoAttrs)
HRESULT WINAPI | GetResultPropertyList (HRECOGNIZER hrec, ULONG *pPropertyCount, ULONG *pPropIndexes)
HRESULT WINAPI | GetSegmentAlternateList (HRECOALT hrcalt, RECO_RANGE *pRecoRange, ULONG *pcAlts, HRECOALT *pAlts)
HRESULT WINAPI | GetString (HRECOALT hrcalt, RECO_RANGE *pRecoRange, ULONG *pcSize, WCHAR *szString)
HRESULT WINAPI | GetStrokeRanges (HRECOALT hrcalt, RECO_RANGE *pRecoRange, ULONG *pcRanges, STROKE_RANGE *pStrokeRange)
HRESULT WINAPI | GUIDToIndex (HRECOGNIZER hrec, GUID *pGUID, ULONG *pIndex)
HRESULT WINAPI | IndexToGUID (HRECOGNIZER hrec, ULONG Index, GUID *pGUID)
HRESULT WINAPI | Process (HRECOCONTEXT hrc, BOOL *pbPartialProcessing)
HRESULT WINAPI | ResetContext (HRECOCONTEXT hrc)
HRESULT WINAPI | SetCACMode (HRECOCONTEXT hrc, int iMode)
HRESULT WINAPI | SetGuide (HRECOCONTEXT hrc, const RECO_GUIDE *pGuide, ULONG iIndex)

Variables

const WCHAR * | CLSID_KEY = "CLSID"
const WCHAR * | FULL_PATH_VALUE = "Recognizer dll"
HANDLE m_hModule
const WCHAR * | RECO_CAPABILITIES = "Recognizer Capability Flags"
const WCHAR * | RECO_LANGUAGES = "Recognized Languages"
const WCHAR * | RECO_MANAGER_KEY = "CLSID\\{DE815B00-9460-4F6E-9471-892ED2275EA5}\\InprocServer32"
const WCHAR * | RECO_SHORT_NAME = "Recognizer Short Name"
const WCHAR * | RECO_SUBKEY = "Software\\Microsoft\\TPG\\Recognizers\\{6D0087D7-61D2-495f-9293-5B7B1C3FCEAB}"
const WCHAR * | RECO_VENDOR_NAME = "Vendor Name"
const WCHAR * | RECOCLSID_SUBKEY = "{6D0087D7-61D2-495f-9293-5B7B1C3FCEAB}"
const WCHAR * | RECOGNIZER_SUBKEY = "CLSID\\{6D0087D7-61D2-495f-9293-5B7B1C3FCEAB}\\InprocServer32"
const WCHAR * | RECOGNIZER_SUBPATH = "Software\\Microsoft\\TPG\\Recognizers"
const WCHAR * | RECOPROC_SUBKEY = "{6D0087D7-61D2-495f-9293-5B7B1C3FCEAB}\\InprocServer32"
const WCHAR * | TPG_SUBPATH = "Software\\Microsoft\\TPG"

Function Documentation

HRESULT WINAPI AddStroke | ( | HRECOCONTEXT | hrc,
 |  | PACKET_DESCRIPTION * | pPacketDesc,
 |  | ULONG | cbPacket,
 |  | BYTE * | pPacket,
 |  | const XFORM * | pXForm
 | ) |  |

Definition at line 213 of file RecoDll.cpp.

{
    return E_NOTIMPL;
}

HRESULT WINAPI AdviseInkChange | ( | HRECOCONTEXT | hrc,
 |  | BOOL | bNewStroke
 | ) |  |

Definition at line 237 of file RecoDll.cpp.

{
    return E_NOTIMPL;
}

HRESULT WINAPI CloneContext | ( | HRECOCONTEXT | hrc,
 |  | HRECOCONTEXT * | pCloneHrc
 | ) |  |

Definition at line 249 of file RecoDll.cpp.

{
    return E_NOTIMPL;
}

HRESULT WINAPI CreateContext | ( | HRECOGNIZER | hrec,
 |  | HRECOCONTEXT * | phrc
 | ) |  |

Definition at line 185 of file RecoDll.cpp.

{
    return E_NOTIMPL;
}

HRESULT WINAPI CreateRecognizer | ( | CLSID * | pCLSID,
 |  | HRECOGNIZER * | phrec
 | ) |  |

Definition at line 156 of file RecoDll.cpp.

{
    return E_NOTIMPL;
}

HRESULT WINAPI DestroyAlternate ( HRECOALT hrcalt )

Definition at line 225 of file RecoDll.cpp.

{
    return E_NOTIMPL;
}

HRESULT WINAPI DestroyContext ( HRECOCONTEXT hrc )

Definition at line 189 of file RecoDll.cpp.

{
    return E_NOTIMPL;
}

HRESULT WINAPI DestroyRecognizer ( HRECOGNIZER hrec )

Definition at line 160 of file RecoDll.cpp.

{
    return E_NOTIMPL;
}

BOOL APIENTRY DllMain | ( | HANDLE | hModule,
 |  | DWORD | ul_reason_for_call,
 |  | void * | lpReserved
 | ) |  |

Definition at line 37 of file RecoDll.cpp.

{
    switch (ul_reason_for_call)
    {
        case DLL_PROCESS_ATTACH:
            m_hModule = hModule;
        case DLL_THREAD_ATTACH:
        case DLL_THREAD_DETACH:
        case DLL_PROCESS_DETACH:
            break;
    }
    return TRUE;
}

STDAPI DllRegisterServer ( void )

Definition at line 61 of file RecoDll.cpp.

{
    HKEY        hKeyReco = NULL;
    HKEY        hKeyRecoManager = NULL;
    LONG        lRes = 0;
    HKEY        hkeyMyReco;
    DWORD       dwLength = 0, dwType = 0, dwSize = 0;
    DWORD       dwDisposition;
    WCHAR       szRecognizerPath[MAX_PATH];
    HRESULT     hr = S_OK;
    RECO_ATTRS  recoAttr;

    // Write the path to this dll in the registry under
    // the recognizer subkey

    // Wipe out the previous values
    lRes = RegDeleteKeyW(HKEY_LOCAL_MACHINE, RECO_SUBKEY);
    // Create the new key
    lRes = RegCreateKeyExW(HKEY_LOCAL_MACHINE, RECO_SUBKEY, 0, NULL,
        REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkeyMyReco, &dwDisposition);
    assert(lRes == ERROR_SUCCESS);
    if (lRes != ERROR_SUCCESS)
    {
        RegCloseKey(hkeyMyReco);
        return E_UNEXPECTED;
    }
    // Get the current path
    // Try to get the path of the RecoObj.dll
    // It should be the same as the one for the RecoCom.dll
    dwLength = GetModuleFileNameW((HMODULE)m_hModule, szRecognizerPath, MAX_PATH);
    // Write the path to the dll as a value
    lRes = RegSetValueExW(hkeyMyReco, FULL_PATH_VALUE, NULL, REG_SZ,
        (BYTE*)szRecognizerPath, sizeof(WCHAR)*(wcslen(szRecognizerPath)+1));
    assert(lRes == ERROR_SUCCESS);
    if (lRes != ERROR_SUCCESS)
    {
        RegCloseKey(hkeyMyReco);
        return E_UNEXPECTED;
    }
    // We get the reco attributes
    // Here we pass NULL for the hrec because we only have one recognizer
    // we would need to loop though all the recognizer and register each
    // of them if there were more than one.
    hr = GetRecoAttributes(NULL, &recoAttr);
    if (FAILED(hr))
    {
        RegCloseKey(hkeyMyReco);
        return E_UNEXPECTED;
    }
    lRes = RegSetValueExW(hkeyMyReco, RECO_LANGUAGES, 0, REG_BINARY,
        (BYTE*)recoAttr.awLanguageId, 64 * sizeof(WORD));
    assert(lRes == ERROR_SUCCESS);
    if (lRes != ERROR_SUCCESS)
    {
        RegCloseKey(hkeyMyReco);
        return E_UNEXPECTED;
    }
    lRes = RegSetValueExW(hkeyMyReco, RECO_CAPABILITIES, 0, REG_DWORD,
        (BYTE*)&(recoAttr.dwRecoCapabilityFlags), sizeof(DWORD));
    assert(lRes == ERROR_SUCCESS);
    if (lRes != ERROR_SUCCESS)
    {
        RegCloseKey(hkeyMyReco);
        return E_UNEXPECTED;
    }
    RegCloseKey(hkeyMyReco);

    return S_OK;
}

STDAPI DllUnregisterServer ( void )

Definition at line 134 of file RecoDll.cpp.

{
    LONG        lRes1 = 0;

    // Wipe out the registry information
    lRes1 = RegDeleteKeyW(HKEY_LOCAL_MACHINE, RECO_SUBKEY);

    // Try to erase the local machine\software\microsoft\tpg\recognizer
    // if necessary (don't care if it fails)
    RegDeleteKeyW(HKEY_LOCAL_MACHINE, RECOGNIZER_SUBPATH);
    RegDeleteKeyW(HKEY_LOCAL_MACHINE, TPG_SUBPATH);

    if (lRes1 != ERROR_SUCCESS && lRes1 != ERROR_FILE_NOT_FOUND)
    {
        return E_UNEXPECTED;
    }
    return S_OK ;
}

HRESULT WINAPI EndInkInput ( HRECOCONTEXT hrc )

Definition at line 245 of file RecoDll.cpp.

{
    return E_NOTIMPL;
}

HRESULT WINAPI GetAlternateList | ( | HRECOCONTEXT | hrc,
 |  | RECO_RANGE * | pRecoRange,
 |  | ULONG * | pcAlt,
 |  | HRECOALT * | phrcalt,
 |  | ULONG | iBreak
 | ) |  |

Definition at line 257 of file RecoDll.cpp.

{
    return E_NOTIMPL;
}

HRESULT WINAPI GetBestAlternate | ( | HRECOCONTEXT | hrc,
 |  | HRECOALT * | pHrcAlt
 | ) |  |

Definition at line 221 of file RecoDll.cpp.

{
    return E_NOTIMPL;
}

HRESULT WINAPI GetBestResultString | ( | HRECOCONTEXT | hrc,
 |  | ULONG * | pcbSize,
 |  | WCHAR * | pszBestResult
 | ) |  |

Definition at line 217 of file RecoDll.cpp.

{
    return E_NOTIMPL;
}

HRESULT WINAPI GetConfidenceLevel | ( | HRECOALT | hrcalt,
 |  | RECO_RANGE * | pRecoRange,
 |  | CONFIDENCE_LEVEL * | pcl
 | ) |  |

Definition at line 294 of file RecoDll.cpp.

{
    return E_NOTIMPL;
}

HRESULT WINAPI GetGuide | ( | HRECOCONTEXT | hrc,
 |  | RECO_GUIDE * | pGuide,
 |  | ULONG * | piIndex
 | ) |  |

Definition at line 233 of file RecoDll.cpp.

{
    return E_NOTIMPL;
}

HRESULT WINAPI GetGuideIndex | ( | HRECOALT | hrcalt,
 |  | RECO_RANGE * | pRecoRange,
 |  | RECO_GUIDE * | pGuide,
 |  | ULONG | iIndex
 | ) |  |

Definition at line 290 of file RecoDll.cpp.

{
    return E_NOTIMPL;
}

HRESULT WINAPI GetLatticePtr | ( | HRECOCONTEXT | hrc,
 |  | RECO_LATTICE ** | ppLattice
 | ) |  |

Definition at line 265 of file RecoDll.cpp.

{
    return E_NOTIMPL;
}

HRESULT WINAPI GetMetrics | ( | HRECOALT | hrcalt,
 |  | RECO_RANGE * | pRecoRange,
 |  | LINE_METRICS | lm,
 |  | LINE_SEGMENT * | pls
 | ) |  |

Definition at line 286 of file RecoDll.cpp.

{
    return E_NOTIMPL;
}

HRESULT WINAPI GetPreferredPacketDescription | ( | HRECOGNIZER | hrec,
 |  | PACKET_DESCRIPTION * | pPacketDescription
 | ) |  |

Definition at line 205 of file RecoDll.cpp.

{
    return E_NOTIMPL;
}

HRESULT WINAPI GetPropertyRanges | ( | HRECOALT | hrcalt,
 |  | ULONG | id,
 |  | ULONG * | pcRanges,
 |  | RECO_RANGE * | pRecoRange
 | ) |  |

Definition at line 298 of file RecoDll.cpp.

{
    return E_NOTIMPL;
}

HRESULT WINAPI GetRangePropertyValue | ( | HRECOALT | hrcalt,
 |  | ULONG | id,
 |  | RECO_RANGE * | pRecoRange,
 |  | ULONG * | cbSize,
 |  | BYTE * | pProperty
 | ) |  |

Definition at line 302 of file RecoDll.cpp.

{
    return E_NOTIMPL;
}

HRESULT WINAPI GetRecoAttributes | ( | HRECOGNIZER | hrec,
 |  | RECO_ATTRS * | pRecoAttrs
 | ) |  |

Definition at line 164 of file RecoDll.cpp.

{
    // Check the the hrec
    // TODO

    // Check the pRecoAttrs pointer
    if (IsBadWritePtr(pRecoAttrs, sizeof(RECO_ATTRS)))
        return E_POINTER;

    // Initialize the Reco Attribute structure
    ZeroMemory(pRecoAttrs, sizeof(RECO_ATTRS));

    // Fill in the vendor name and the recognizer "friendly" name
    wcsncpy(pRecoAttrs->awcVendorName, RECO_VENDOR_NAME, wcslen(RECO_VENDOR_NAME)+1);
    wcsncpy(pRecoAttrs->awcFriendlyName, RECO_SHORT_NAME, wcslen(RECO_SHORT_NAME)+1);
    // Put the languages supported by the recognizer in the awLanguageId array
    pRecoAttrs->awLanguageId[0] = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL);
    // Set the reco capability flag
    pRecoAttrs->dwRecoCapabilityFlags = 0;
    return S_OK;
}

HRESULT WINAPI GetResultPropertyList | ( | HRECOGNIZER | hrec,
 |  | ULONG * | pPropertyCount,
 |  | ULONG * | pPropIndexes
 | ) |  |

Definition at line 201 of file RecoDll.cpp.

{
    return E_NOTIMPL;
}

HRESULT WINAPI GetSegmentAlternateList | ( | HRECOALT | hrcalt,
 |  | RECO_RANGE * | pRecoRange,
 |  | ULONG * | pcAlts,
 |  | HRECOALT * | pAlts
 | ) |  |

Definition at line 282 of file RecoDll.cpp.

{
    return E_NOTIMPL;
}

HRESULT WINAPI GetString | ( | HRECOALT | hrcalt,
 |  | RECO_RANGE * | pRecoRange,
 |  | ULONG * | pcSize,
 |  | WCHAR * | szString
 | ) |  |

Definition at line 274 of file RecoDll.cpp.

{
    return E_NOTIMPL;
}

HRESULT WINAPI GetStrokeRanges | ( | HRECOALT | hrcalt,
 |  | RECO_RANGE * | pRecoRange,
 |  | ULONG * | pcRanges,
 |  | STROKE_RANGE * | pStrokeRange
 | ) |  |

Definition at line 278 of file RecoDll.cpp.

{
    return E_NOTIMPL;
}

HRESULT WINAPI GUIDToIndex | ( | HRECOGNIZER | hrec,
 |  | GUID * | pGUID,
 |  | ULONG * | pIndex
 | ) |  |

Definition at line 193 of file RecoDll.cpp.

{
    return E_NOTIMPL;
}

HRESULT WINAPI IndexToGUID | ( | HRECOGNIZER | hrec,
 |  | ULONG | Index,
 |  | GUID * | pGUID
 | ) |  |

Definition at line 197 of file RecoDll.cpp.

{
    return E_NOTIMPL;
}

HRESULT WINAPI Process | ( | HRECOCONTEXT | hrc,
 |  | BOOL * | pbPartialProcessing
 | ) |  |

Definition at line 261 of file RecoDll.cpp.

{
    return E_NOTIMPL;
}

HRESULT WINAPI ResetContext ( HRECOCONTEXT hrc )

Definition at line 253 of file RecoDll.cpp.

{
    return E_NOTIMPL;
}

HRESULT WINAPI SetCACMode | ( | HRECOCONTEXT | hrc,
 |  | int | iMode
 | ) |  |

Definition at line 241 of file RecoDll.cpp.

{
    return E_NOTIMPL;
}

HRESULT WINAPI SetGuide | ( | HRECOCONTEXT | hrc,
 |  | const RECO_GUIDE * | pGuide,
 |  | ULONG | iIndex
 | ) |  |

Definition at line 229 of file RecoDll.cpp.

{
    return E_NOTIMPL;
}

Variable Documentation

const WCHAR* CLSID_KEY = "CLSID"

Definition at line 26 of file RecoDll.cpp.

const WCHAR* FULL_PATH_VALUE = "Recognizer dll"

Definition at line 22 of file RecoDll.cpp.

HANDLE m_hModule

Definition at line 35 of file RecoDll.cpp.

const WCHAR* RECO_CAPABILITIES = "Recognizer Capability Flags"

Definition at line 29 of file RecoDll.cpp.

const WCHAR* RECO_LANGUAGES = "Recognized Languages"

Definition at line 28 of file RecoDll.cpp.

const WCHAR* RECO_MANAGER_KEY = "CLSID\\{DE815B00-9460-4F6E-9471-892ED2275EA5}\\InprocServer32"

Definition at line 23 of file RecoDll.cpp.

const WCHAR* RECO_SHORT_NAME = "Recognizer Short Name"

Definition at line 32 of file RecoDll.cpp.

const WCHAR* RECO_SUBKEY = "Software\\Microsoft\\TPG\\Recognizers\\{6D0087D7-61D2-495f-9293-5B7B1C3FCEAB}"

Definition at line 21 of file RecoDll.cpp.

const WCHAR* RECO_VENDOR_NAME = "Vendor Name"

Definition at line 33 of file RecoDll.cpp.

const WCHAR* RECOCLSID_SUBKEY = "{6D0087D7-61D2-495f-9293-5B7B1C3FCEAB}"

Definition at line 27 of file RecoDll.cpp.

const WCHAR* RECOGNIZER_SUBKEY = "CLSID\\{6D0087D7-61D2-495f-9293-5B7B1C3FCEAB}\\InprocServer32"

Definition at line 24 of file RecoDll.cpp.

const WCHAR* RECOGNIZER_SUBPATH = "Software\\Microsoft\\TPG\\Recognizers"

Definition at line 30 of file RecoDll.cpp.

const WCHAR* RECOPROC_SUBKEY = "{6D0087D7-61D2-495f-9293-5B7B1C3FCEAB}\\InprocServer32"

Definition at line 25 of file RecoDll.cpp.

const WCHAR* TPG_SUBPATH = "Software\\Microsoft\\TPG"

Definition at line 31 of file RecoDll.cpp.

Generated on Wed Nov 13 2024 16:54:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/RecoDLL/StdAfx.cpp File Reference

  • TabletPC
  • RecoDLL

StdAfx.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/RecoDLL/StdAfx.h File Reference

  • TabletPC
  • RecoDLL
Defines

StdAfx.h File Reference

#include <windows.h>

Go to the source code of this file.

Defines

#define WIN32_LEAN_AND_MEAN

Define Documentation

#define WIN32_LEAN_AND_MEAN

Definition at line 28 of file StdAfx.h.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/ScannedPaperForm/C#/AssemblyInfo.cs File Reference

  • TabletPC
  • ScannedPaperForm
  • C#

AssemblyInfo.cs File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/ScannedPaperForm/C#/PaperForm.cs File Reference

  • TabletPC
  • ScannedPaperForm
  • C#
Classes | Namespaces

PaperForm.cs File Reference

Go to the source code of this file.

Classes

class | PaperForm::PaperForm
The PaperForm Sample Application form class. More...

Namespaces

namespace | PaperForm
Generated on Wed Nov 13 2024 16:54:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/Serialization/AssemblyInfo.cs File Reference

  • TabletPC
  • Serialization

AssemblyInfo.cs File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/Serialization/Serialization.cs File Reference

  • TabletPC
  • Serialization
Classes | Namespaces

Serialization.cs File Reference

Go to the source code of this file.

Classes

class | Serialization::SerializationForm

Namespaces

namespace | Serialization
Generated on Wed Nov 13 2024 16:54:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/TPCInfo/resource.h File Reference

  • TabletPC
  • TPCInfo
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_CONTROL1 1005
#define | IDC_CONTROL2 1006
#define | IDC_CTL1_NAME 1005
#define | IDC_CTL1_VER 1009
#define | IDC_CTL2_NAME 1010
#define | IDC_CTL2_VER 1011
#define | IDC_DEFAULT_HW_RECO 1003
#define | IDC_DEFAULT_SPEECH_RECO 1004
#define | IDC_HWR_NAME 1003
#define | IDC_HWR_VENDOR 1007
#define | IDC_SPR_NAME 1004
#define | IDC_SPR_VENDOR 1008
#define | IDC_TABLETPC 1001
#define | IDC_TABLETPC_DISABLED 1002
#define | IDC_TABLETPC_ENABLED 1001
#define | IDC_TSF 1002
#define | IDD_DIALOG 102
#define | IDI_INK_ICON 100

Define Documentation

#define IDC_CONTROL1 1005

Definition at line 15 of file resource.h.

#define IDC_CONTROL2 1006

Definition at line 17 of file resource.h.

#define IDC_CTL1_NAME 1005

Definition at line 16 of file resource.h.

#define IDC_CTL1_VER 1009

Definition at line 20 of file resource.h.

#define IDC_CTL2_NAME 1010

Definition at line 21 of file resource.h.

#define IDC_CTL2_VER 1011

Definition at line 22 of file resource.h.

#define IDC_DEFAULT_HW_RECO 1003

Definition at line 11 of file resource.h.

#define IDC_DEFAULT_SPEECH_RECO 1004

Definition at line 13 of file resource.h.

#define IDC_HWR_NAME 1003

Definition at line 12 of file resource.h.

#define IDC_HWR_VENDOR 1007

Definition at line 18 of file resource.h.

#define IDC_SPR_NAME 1004

Definition at line 14 of file resource.h.

#define IDC_SPR_VENDOR 1008

Definition at line 19 of file resource.h.

#define IDC_TABLETPC 1001

Definition at line 8 of file resource.h.

#define IDC_TABLETPC_DISABLED 1002

Definition at line 9 of file resource.h.

#define IDC_TABLETPC_ENABLED 1001

Definition at line 7 of file resource.h.

#define IDC_TSF 1002

Definition at line 10 of file resource.h.

#define IDD_DIALOG 102

Definition at line 6 of file resource.h.

#define IDI_INK_ICON 100

Definition at line 5 of file resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: TabletPC/TPCInfo/TPCInfo.cpp File Reference

  • TabletPC
  • TPCInfo
Classes | Defines | Functions | Variables

TPCInfo.cpp File Reference

#include <windows.h>
#include <comdef.h>
#include <wchar.h>
#include <msinkaut.h>
#include <msinkaut_i.c>
#include "resource.h"

Go to the source code of this file.

Classes

struct | SInfo

Defines

#define | countof(A) (sizeof(A)/sizeof(A[0]))
#define | NUM_CONTROLS 2
#define | SM_TABLETPC 86

Functions

BOOL CALLBACK | DlgProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
BOOL | GetComponentInfo (CLSID clsid, SInfo &info)
int APIENTRY | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

Variables

const CLSID | CLSID_TF_ThreadMgr
const UINT | gc_uiCtrlId [NUM_CONTROLS][2]
const WCHAR | gc_wszAppName [] = "TPCInfo Sample Application"
LPCOLESTR | gc_wszProgId [NUM_CONTROLS] = {L"InkEd.InkEdit", L"msinkaut.InkPicture"}
const WCHAR * | gc_wszSpeechKey = "Software\\Microsoft\\Speech\\Recognizers"

Define Documentation

#define countof ( A ) (sizeof(A)/sizeof(A[0]))

Definition at line 46 of file TPCInfo.cpp.

#define NUM_CONTROLS 2

Definition at line 50 of file TPCInfo.cpp.

#define SM_TABLETPC 86

Definition at line 39 of file TPCInfo.cpp.

Function Documentation

BOOL CALLBACK DlgProc | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 238 of file TPCInfo.cpp.

{
    BOOL bReturn = FALSE; // the value to return
    switch (uMsg)
    {
        case WM_INITDIALOG:
        {
            // Initialize the COM
            if (FAILED(CoInitialize(NULL)))
            {
                MessageBoxW(NULL, L"Unable to initialize the COM library",
                            gc_wszAppName, MB_OK | MB_ICONINFORMATION);
                PostMessage(hwnd, WM_CLOSE, 0, 0);
                break;
            }

            // Gather and show the information we're interested in

            // Check out if Microsoft Tablet PC Platform components of the
            // Microsoft Windows XP Professional Operating System are enabled
            int bTabletPC = GetSystemMetrics(SM_TABLETPC);
            SetDlgItemTextW(hwnd, IDC_TABLETPC,
                            bTabletPC ? L"Available" : L"Not available");

            // Get the version of the Text Services Framework components
            SInfo info;
            if (GetComponentInfo(CLSID_TF_ThreadMgr, info) == TRUE)
            {
                SetDlgItemTextW(hwnd, IDC_TSF, info.wchVersion);
            }

            // Find out the name and the version of the default handwriting recognizer
            // Create the enumerator for the installed recognizers
            IInkRecognizers* pIInkRecognizers = NULL;
            HRESULT hr = CoCreateInstance(CLSID_InkRecognizers,
                                          NULL,
                                          CLSCTX_INPROC_SERVER,
                                          IID_IInkRecognizers,
                                          (void **)&pIInkRecognizers);
            if (SUCCEEDED(hr))
            {
                IInkRecognizer* pIInkRecognizer = NULL;
                // The first parameter is the language id, passing 0 means that the language
                // id will be retrieved using the user default-locale identifier
                hr = pIInkRecognizers->GetDefaultRecognizer(0, &pIInkRecognizer);
                if (SUCCEEDED(hr))
                {
                    // Get the recognizer's friendly name
                    BSTR bstr;
                    if (SUCCEEDED(pIInkRecognizer->get_Name(&bstr)))
                    {
                        SetDlgItemTextW(hwnd, IDC_HWR_NAME, bstr);
                        SysFreeString(bstr);
                    }
                    else
                    {
                        SetDlgItemTextW(hwnd, IDC_HWR_NAME, L"Failed");
                    }
                    // Get the recognizer's vendor info
                    if (SUCCEEDED(pIInkRecognizer->get_Vendor(&bstr)))
                    {
                        SetDlgItemTextW(hwnd, IDC_HWR_VENDOR, bstr);
                        SysFreeString(bstr);
                    }
                    else
                    {
                        SetDlgItemTextW(hwnd, IDC_HWR_VENDOR, L"Failed");
                    }
                    // Release it
                    pIInkRecognizer->Release();
                    pIInkRecognizer = NULL;
                }
                // Release the collection object
                pIInkRecognizers->Release();
                pIInkRecognizers = NULL;
            }

            // Find out the name and the version of the default speech recognizer

            // Open key to find path of application
            HKEY hkeySpeech;
            if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, gc_wszSpeechKey, 0, KEY_READ,
                            &hkeySpeech) == ERROR_SUCCESS)
            {
                // Query value of key to get the name of the component
                WCHAR wchValue[265];
                ULONG cSize = sizeof(wchValue);
                if (RegQueryValueExW(hkeySpeech, L"DefaultDefaultTokenId", NULL, NULL,
                                    (BYTE*)wchValue, &cSize) == ERROR_SUCCESS)
                {
                    int ndx = lstrlenW(L"HKEY_LOCAL_MACHINE\\");
                    int len = lstrlenW(wchValue);
                    if (ndx < len
                        && RegOpenKeyExW(HKEY_LOCAL_MACHINE, &wchValue[ndx], 0,
                                         KEY_READ, &hkeySpeech) == ERROR_SUCCESS)
                    {
                        cSize = sizeof(wchValue);
                        if (RegQueryValueExW(hkeySpeech, NULL, NULL, NULL,
                                             (BYTE*)wchValue, &cSize) == ERROR_SUCCESS)
                        {
                            SetDlgItemTextW(hwnd, IDC_SPR_NAME, wchValue);
                        }
                    }
                }
            }

            // Find out which of the controls are installed and show their version info
            for (int i = 0, j = 0; i < NUM_CONTROLS; i++)
            {
                // Get the component info
                CLSID clsid;
                if (SUCCEEDED(CLSIDFromProgID(gc_wszProgId[i], &clsid))
                    && GetComponentInfo(clsid, info) == TRUE)
                {
                    SetDlgItemTextW(hwnd, gc_uiCtrlId[j][0], info.wchName);
                    SetDlgItemTextW(hwnd, gc_uiCtrlId[j][1], info.wchVersion);
                    j++;
                }
            }

            // Done with the COM
            CoUninitialize();

            break;
        }
        case WM_DESTROY:

            PostQuitMessage(0);
            break;

        case WM_COMMAND:
            switch (LOWORD(wParam))
            {
                case IDCLOSE:   // User clicked on the "Close" button in the dialog.
                case IDCANCEL:  // User clicked the close button ([X]) in the caption
                                // or pressed Alt+F4.
                    DestroyWindow(hwnd);
                    bReturn = TRUE;
                    break;
            }
            break;
    }

    return bReturn;
}

BOOL GetComponentInfo | ( | CLSID | clsid,
 |  | SInfo & | info
 | ) |  |

Definition at line 92 of file TPCInfo.cpp.

{
    info.wchName[0] = info.wchVersion[0] = 0;

    // Format Registry Key string
    WCHAR wszKey[45] = L"CLSID\\";  // the key buffer should be large enough for a string
                                    // like "CLSID\{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}"
    // Convert CLSID to String
    UINT uPos = lstrlenW(wszKey);
    if (0 == StringFromGUID2(clsid, &wszKey[uPos], countof(wszKey) - uPos))
        return FALSE;
    wszKey[countof(wszKey)-1] = 0;

    // Open key to find path of application
    HKEY hKeyRoot;
    if (RegOpenKeyExW(HKEY_CLASSES_ROOT, wszKey, 0, KEY_READ, &hKeyRoot) != ERROR_SUCCESS)
        return FALSE;

    // Query value of key to get the name of the component
    ULONG cSize = sizeof(info.wchName);  // size of the buffer in bytes
    if (RegQueryValueExW(hKeyRoot, NULL, NULL, NULL, (BYTE*)info.wchName, &cSize) != ERROR_SUCCESS)
    {
        RegCloseKey(hKeyRoot);
        return FALSE;
    }
    info.wchName[countof(info.wchName) - 1] = 0;

    // Open the version info subkey
    UINT iVersionMaxLen = countof(info.wchVersion);
    HKEY hKey = NULL;
    if (RegOpenKeyExW(hKeyRoot, L"Version", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
    {
        const WCHAR* pcwsVersion = L"version ";
        UINT iLen = lstrlenW(pcwsVersion);
        // Query value of key to get version string
        if (iLen < iVersionMaxLen)
        {
            // copy the "version " string including terminating 0
            lstrcpynW(info.wchVersion, pcwsVersion, iLen + 1);
            // get the version string
            cSize = (iVersionMaxLen - iLen) * sizeof(WCHAR); // the size is in bytes
            if (RegQueryValueExW(hKey, NULL, NULL, NULL,
                                 (BYTE*)&info.wchVersion[iLen],
                                 &cSize) == ERROR_SUCCESS)
            {
                info.wchVersion[iVersionMaxLen-1] = 0;
            }
        }
        RegCloseKey(hKey);
    }

    // Open InprocServer32 subkey to get the path to the component
    if (RegOpenKeyExW(hKeyRoot, L"InprocServer32", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
    {
        // Query value of key to get the path string
        WCHAR wchPath[MAX_PATH];
        cSize = sizeof(wchPath);
        if (RegQueryValueExW(hKey, NULL, NULL, NULL, (BYTE*)wchPath, &cSize) == ERROR_SUCCESS)
        {
            // Get the build number from the file version info
            DWORD dwHandle = 0;
            cSize = GetFileVersionInfoSizeW(wchPath, &dwHandle); // returns the size in bytes
            WCHAR* pwchFileVerInfo = NULL;
            if (cSize)
            {
                pwchFileVerInfo = (WCHAR*)new BYTE[cSize];
            }
            if (NULL != pwchFileVerInfo)
            {
                // Retrieve version information for the file
                if (GetFileVersionInfoW(wchPath, 0, cSize, pwchFileVerInfo))
                {
                    // Get the default language id and code page number
                    UINT *pdwLang;
                    UINT cch = 0;
                    if (VerQueryValueW(pwchFileVerInfo, L"\\VarFileInfo\\Translation",
                                       (void**)&pdwLang, &cch) == TRUE)
                    {
                        // Read the file description for the language and code page.
                        const int MAX_SUBBLOCK = 40;
                        WCHAR wchSubBlock[MAX_SUBBLOCK];  // large enough for the string
                        _snwprintf(wchSubBlock, MAX_SUBBLOCK - 1,
                                   L"\\StringFileInfo\\%04x%04x\\FileVersion",
                                   LOWORD(*pdwLang), HIWORD(*pdwLang));
                        wchSubBlock[MAX_SUBBLOCK-1] = 0;

                        WCHAR* pwchBuildVer = NULL;
                        if ((VerQueryValueW(pwchFileVerInfo, wchSubBlock,
                                            (void**)&pwchBuildVer, &cch) == TRUE)
                            && (NULL != pwchBuildVer))
                        {
                            // Format the version string
                            UINT iLen = (UINT)lstrlenW(info.wchVersion);
                            if (0 < iLen)
                            {
                                if (iLen < iVersionMaxLen)
                                {
                                    const WCHAR* pcwsBuild = L", build ";
                                    lstrcpynW(info.wchVersion + iLen, pcwsBuild,
                                              iVersionMaxLen - iLen);
                                    iLen += lstrlenW(pcwsBuild);
                                    if (iLen < iVersionMaxLen)
                                    {
                                        lstrcpynW(info.wchVersion + iLen, pwchBuildVer,
                                                  iVersionMaxLen - iLen);
                                    }
                                }
                            }
                            else
                            {
                                lstrcpynW(info.wchVersion, pwchBuildVer, iVersionMaxLen);
                            }
                            info.wchVersion[iVersionMaxLen-1] = 0;
                        }
                    }
                }
                delete [] pwchFileVerInfo;
            }

        }
        RegCloseKey(hKey);
    }

    RegCloseKey(hKeyRoot);

    return TRUE;
}

int APIENTRY WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 404 of file TPCInfo.cpp.

{
    // unused parameters
    hPrevInstance, lpCmdLine, nCmdShow;     // silence the compiler warnings

    int iRet = 0;

    // Create the application window
    HWND hwndDlg = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_DIALOG), NULL, DlgProc);
    if (NULL != hwndDlg)
    {

        ShowWindow(hwndDlg, SW_SHOW);

        // Start the message loop
        MSG msg;
        while (GetMessage(&msg, NULL, 0, 0) > 0)
        {
            if (!IsDialogMessage(hwndDlg, &msg))
            {
                TranslateMessage(&msg);
                DispatchMessage(&msg);
            }
        }

        iRet = (int)msg.wParam;
    }
    else
    {
        MessageBoxW(NULL, L"Unable to create the dialog box",
                    gc_wszAppName, MB_OK | MB_ICONINFORMATION);
    }

    return iRet;
}

Variable Documentation

const CLSID CLSID_TF_ThreadMgr
Initial value:

        { 0x529A9E6B,0x6587,0x4F23,{ 0xAB,0x9E,0x9C,0x7D,0x68,0x3E,0x3C,0x50 } }

Definition at line 61 of file TPCInfo.cpp.

const UINT gc_uiCtrlId[NUM_CONTROLS][2]
Initial value:
 {{IDC_CTL1_NAME, IDC_CTL1_VER},
                                            {IDC_CTL2_NAME, IDC_CTL2_VER}}

Definition at line 51 of file TPCInfo.cpp.

const WCHAR gc_wszAppName[] = "TPCInfo Sample Application"

Definition at line 71 of file TPCInfo.cpp.

LPCOLESTR gc_wszProgId[NUM_CONTROLS] = {L"InkEd.InkEdit", L"msinkaut.InkPicture"}

Definition at line 55 of file TPCInfo.cpp.

const WCHAR* gc_wszSpeechKey = "Software\\Microsoft\\Speech\\Recognizers"

Definition at line 58 of file TPCInfo.cpp.

Generated on Wed Nov 13 2024 16:54:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: UDDI/publish/AssemblyInfo.cs File Reference

  • UDDI
  • publish

AssemblyInfo.cs File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: UDDI/publish/publish.cs File Reference

  • UDDI
  • publish
Classes | Namespaces

publish.cs File Reference

Go to the source code of this file.

Classes

class | Microsoft::Uddi::Demo::Publish

Namespaces

namespace | Microsoft::Uddi::Demo
Generated on Wed Nov 13 2024 16:54:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: UDDI/wsdldiscovery/AssemblyInfo.cs File Reference

  • UDDI
  • wsdldiscovery

AssemblyInfo.cs File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: UDDI/wsdldiscovery/main.cs File Reference

  • UDDI
  • wsdldiscovery
Classes | Namespaces

main.cs File Reference

Go to the source code of this file.

Classes

class | WsdlDiscovery::frmMain
Summary description for Form1. More...

Namespaces

namespace | WsdlDiscovery
Generated on Wed Nov 13 2024 16:54:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: UDDI/wsdldiscovery/controls/categorytree.cs File Reference

  • UDDI
  • wsdldiscovery
  • controls
Classes | Namespaces

categorytree.cs File Reference

Go to the source code of this file.

Classes

class | UDDI::Tools::CategoryTreeNode
class | UDDI::Tools::CategoryTreeView
Summary description for categorytree. More...

Namespaces

namespace | UDDI::Tools
Generated on Wed Nov 13 2024 16:54:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/bits/bits_ie/bits_ie.cpp File Reference

  • Web
  • bits
  • bits_ie
Classes | Defines | Typedefs | Functions | Variables

bits_ie.cpp File Reference

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <math.h>
#include <float.h>
#include <commctrl.h>
#include <commdlg.h>
#include <shellapi.h>
#include <wininet.h>
#include <shlobj.h>
#include "resource.h"
#include <bits.h>
#include <comdef.h>

Go to the source code of this file.

Classes

class | CBackgroundCopyCallback
class | SmartRefPointer< T >

Defines

#define | _UNICODE
#define | MAX_STRING 0x800

Typedefs

typedef SmartRefPointer
< IEnumBackgroundCopyFiles > 		SmartEnumFilesPointer
typedef SmartRefPointer
< IEnumBackgroundCopyJobs > 		SmartEnumJobsPointer
typedef SmartRefPointer
< IBackgroundCopyFile > 		SmartFilePointer
typedef SmartRefPointer< IUnknown > | SmartIUnknownPointer
typedef SmartRefPointer
< IBackgroundCopyJob2 > 		SmartJob2Pointer
typedef SmartRefPointer
< IBackgroundCopyError > 		SmartJobErrorPointer
typedef SmartRefPointer
< IBackgroundCopyJob > 		SmartJobPointer
typedef SmartRefPointer
< IBackgroundCopyManager > 		SmartManagerPointer
typedef SmartRefPointer
< IPersistFile > 		SmartPersistFilePointer
typedef SmartRefPointer
< IShellLink > 		SmartShellLinkPointer

Functions

void | BITSCheckHR (HWND hwnd, HRESULT Hr, bool bThrow)
void | CheckHR (HWND hwnd, HRESULT Hr, bool bThrow)
void | CreateJob (WCHAR *szJobURL)
void | CreateStartupLink (GUID JobID, WCHAR *pszFileName)
void | CreateUI (int nShowCmd)
void | DeleteStartupLink (GUID JobID)
INT_PTR CALLBACK | DialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
void | DoCancel (HWND hwndDlg, bool PromptUser)
void | DoClose (HWND hwndDlg)
void | DoFinish (HWND hwndDlg)
const WCHAR * | GetString (UINT id)
UINT64 | GetSystemTimeAsUINT64 ()
HRESULT | HandleCOMCallback (IBackgroundCopyJob *pJob, bool CriticalEvent)
void | HandleTimerTick (HWND hwndDlg)
void | HandleUpdate ()
void | InitDialog (HWND hwndDlg)
const WCHAR * | MapStateToString (BG_JOB_STATE state)
void | ResumeJob (WCHAR *szJobGUID, WCHAR *szJobFileName)
void | SafeCat (WCHAR *Dest, const WCHAR *Source, size_t Count)
void | SafeCopy (WCHAR *Dest, const WCHAR *Source, size_t Count)
void | SafeStringPrintf (WCHAR *Dest, DWORD Count, const WCHAR *Format,...)
UINT64 | ScaleDownloadEstimate (double Time, const WCHAR **pFormat)
double | ScaleDownloadRate (double Rate, const WCHAR **pFormat)
void | SetWindowTime (HWND hwnd, FILETIME filetime)
void | SignalAlert (HWND hwndDlg, UINT Type)
void | UpdateDialog (HWND hwndDlg)
int WINAPI | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

Variables

CBackgroundCopyCallback g_Callback
HWND | g_hwndDlg = NULL
GUID | g_JobId
SmartJobPointer g_pJob
SmartManagerPointer g_pManager
bool | g_RefreshOnTimer = FALSE
WCHAR | g_szFileName [MAX_PATH]
bool | g_UpdateTimerSet = FALSE

Define Documentation

#define _UNICODE

Definition at line 37 of file bits_ie.cpp.

#define MAX_STRING 0x800

Definition at line 153 of file bits_ie.cpp.

Typedef Documentation

typedef SmartRefPointer<IEnumBackgroundCopyFiles> SmartEnumFilesPointer

Definition at line 147 of file bits_ie.cpp.

typedef SmartRefPointer<IEnumBackgroundCopyJobs> SmartEnumJobsPointer

Definition at line 148 of file bits_ie.cpp.

typedef SmartRefPointer<IBackgroundCopyFile> SmartFilePointer

Definition at line 146 of file bits_ie.cpp.

typedef SmartRefPointer<IUnknown> SmartIUnknownPointer

Definition at line 141 of file bits_ie.cpp.

typedef SmartRefPointer<IBackgroundCopyJob2> SmartJob2Pointer

Definition at line 144 of file bits_ie.cpp.

typedef SmartRefPointer<IBackgroundCopyError> SmartJobErrorPointer

Definition at line 145 of file bits_ie.cpp.

typedef SmartRefPointer<IBackgroundCopyJob> SmartJobPointer

Definition at line 143 of file bits_ie.cpp.

typedef SmartRefPointer<IBackgroundCopyManager> SmartManagerPointer

Definition at line 142 of file bits_ie.cpp.

typedef SmartRefPointer<IPersistFile> SmartPersistFilePointer

Definition at line 150 of file bits_ie.cpp.

typedef SmartRefPointer<IShellLink> SmartShellLinkPointer

Definition at line 149 of file bits_ie.cpp.

Function Documentation

void BITSCheckHR | ( | HWND | hwnd,
 |  | HRESULT | Hr,
 |  | bool | bThrow
 | ) |  |

Definition at line 998 of file bits_ie.cpp.

{

   //
   // Provides automatic error code checking and dialog
   // for BITS specific errors
   //

   if (SUCCEEDED(Hr))
       return;

   WCHAR * pszError = NULL;
   HRESULT hErrorHr =
   g_pManager->GetErrorDescription(
       Hr,
       LANGIDFROMLCID( GetThreadLocale() ),
       &pszError );

   if ( FAILED(hErrorHr) || !pszError )
       {

       WCHAR ErrorMsg[ MAX_STRING ];
       SafeStringPrintf( ErrorMsg, MAX_STRING, GetString( IDS_DISPLAYERRORCODE ), Hr );

       MessageBox( hwnd, ErrorMsg, GetString( IDS_ERRORBOXTITLE ),
                   MB_OK | MB_ICONSTOP | MB_APPLMODAL );

       }

   else
       {

       MessageBox( hwnd, pszError, GetString( IDS_ERRORBOXTITLE ),
                   MB_OK | MB_ICONSTOP | MB_APPLMODAL );
       CoTaskMemFree( pszError );

       }

   if ( bThrow )
       throw _com_error( Hr );
}

void CheckHR | ( | HWND | hwnd,
 |  | HRESULT | Hr,
 |  | bool | bThrow
 | ) |  |

Definition at line 955 of file bits_ie.cpp.

{
    //
    // Provides automatic error code checking and dialog
    // for generic system errors
    //

    if (SUCCEEDED(Hr))
        return;

    WCHAR * pszError = NULL;

    DWORD dwFormatError =
    FormatMessage(
        FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
        FORMAT_MESSAGE_IGNORE_INSERTS,
        NULL,
        (DWORD)Hr,
        LANGIDFROMLCID( GetThreadLocale() ),
        (WCHAR*)&pszError,
        0,
        NULL );

    if ( !dwFormatError )
       {
       WCHAR ErrorMsg[ MAX_STRING ];
       SafeStringPrintf( ErrorMsg, MAX_STRING, GetString( IDS_DISPLAYERRORCODE ), Hr );

       MessageBox( hwnd, ErrorMsg, GetString( IDS_ERRORBOXTITLE ),
                   MB_OK | MB_ICONSTOP | MB_APPLMODAL );
       }
    else
       {
       MessageBox( hwnd, pszError, GetString( IDS_ERRORBOXTITLE ),
                   MB_OK | MB_ICONSTOP | MB_APPLMODAL );
       LocalFree( pszError );
       }

    if ( bThrow )
        throw _com_error( Hr );

}

void CreateJob ( WCHAR * szJobURL )

Definition at line 1457 of file bits_ie.cpp.

{
    //
    // Request a destination file name from the user
    // and submit a new job.
    //

    try
    {

        // crack the URL and get the filename
        WCHAR szURLFilePath[MAX_PATH] = {L'\0'};
        URL_COMPONENTS UrlComponents;

        memset( &UrlComponents, 0, sizeof(UrlComponents) );
        UrlComponents.dwStructSize = sizeof(URL_COMPONENTS);
        UrlComponents.lpszUrlPath = szURLFilePath;
        UrlComponents.dwUrlPathLength =
            sizeof(szURLFilePath)/sizeof(*szURLFilePath);

        BOOL CrackResult =
            InternetCrackUrl(
                szJobURL,
                0,
                0,
                &UrlComponents );

        if (!CrackResult)
            CheckHR( NULL, HRESULT_FROM_WIN32( GetLastError() ), false );

        if ( UrlComponents.nScheme != INTERNET_SCHEME_HTTP &&
             UrlComponents.nScheme != INTERNET_SCHEME_HTTPS
             )
            {

            MessageBox(
                NULL,
                GetString( IDS_NOHTTPORHTTPS ),
                GetString( IDS_ERRORBOXTITLE ),
                MB_OK | MB_ICONERROR | MB_APPLMODAL |
                MB_SETFOREGROUND | MB_TOPMOST );

            throw _com_error( E_INVALIDARG );

            }

        const WCHAR *szURLFileName =
            szURLFilePath + wcslen( szURLFilePath );

        // parse out the filename part of the URL
        while( szURLFileName != szURLFilePath )
            {

            if ( L'/' == *szURLFileName ||
                 L'\\' == *szURLFileName )
                {
                szURLFileName++;
                break;
                }

            szURLFileName--;
            }

    // This is needed in case the first
    // character is a slash.
        if ( L'/' == *szURLFileName ||
       L'\\' == *szURLFileName )
       szURLFileName++;

        // parse out the extension from the name
        const WCHAR *szURLFileExtension =
            szURLFileName + wcslen( szURLFileName );

        while( szURLFileName != szURLFileExtension )
            {
            if ( L'.' == *szURLFileExtension )
                break;
            szURLFileExtension--;
            }

        // build the extension list

        WCHAR *szExtensionList = NULL;
        const WCHAR *szAllFiles = GetString( IDS_ALLFILES );
        const size_t AllFilesSize = wcslen( szAllFiles ) + 1;
        const WCHAR *szAllFilesPattern = L"*";
        const size_t AllFilesPatternSize = sizeof(L"*")/sizeof(WCHAR);

        WCHAR *p;

        if ( szURLFileExtension == szURLFileName &&
             *szURLFileExtension != L'.' )
            {
            size_t StringSize = sizeof(WCHAR) * ( AllFilesSize + AllFilesPatternSize + 2 );
            szExtensionList = (WCHAR*)_alloca( StringSize );
            p = szExtensionList;
            }
        else
            {
            size_t ExtensionSize = wcslen( szURLFileExtension ) + 1;
            size_t StringSize =
                sizeof(WCHAR) * ( ExtensionSize + ExtensionSize + 1 + AllFilesSize
                                  + AllFilesPatternSize + 2 );
            szExtensionList = (WCHAR*)_alloca( StringSize );
            p = szExtensionList;

            memcpy( p, szURLFileExtension, ExtensionSize * sizeof(WCHAR) );
            p += ExtensionSize;
            *p++ = L'*';
            memcpy( p, szURLFileExtension, ExtensionSize * sizeof(WCHAR) );
            p += ExtensionSize;
            }

        memcpy( p, szAllFiles, AllFilesSize * sizeof(WCHAR) );
        p += AllFilesSize;
        memcpy( p, szAllFilesPattern, AllFilesPatternSize * sizeof(WCHAR) );
        p += AllFilesPatternSize;
        memset( p, 0, sizeof(WCHAR) * 2 );

        OPENFILENAME ofn;
        memset( &ofn, 0, sizeof( ofn ) );

        WCHAR szFileName[MAX_PATH];
        WCHAR szFileTitle[MAX_PATH];

        SafeCopy( szFileName, szURLFileName, MAX_PATH );
        SafeCopy( szFileTitle, szURLFileName, MAX_PATH );

        /* fill in non-variant fields of OPENFILENAME struct. */
        ofn.lStructSize       = sizeof(OPENFILENAME);
        ofn.hwndOwner         = g_hwndDlg;
        ofn.lpstrFilter       = szExtensionList;
        ofn.lpstrCustomFilter = NULL;
        ofn.nMaxCustFilter    = 0;
        ofn.nFilterIndex      = 0;
        ofn.lpstrFile         = szFileName;
        ofn.nMaxFile          = MAX_PATH;
        ofn.lpstrInitialDir   = NULL;
        ofn.lpstrFileTitle    = szFileTitle;
        ofn.nMaxFileTitle     = MAX_PATH;
        ofn.lpstrTitle        = GetString( IDS_FILEDLGTITLE );
        ofn.lpstrDefExt       = NULL;
        ofn.Flags             = 0;

        /* Use standard open dialog */
        BOOL bResult = GetSaveFileName ((LPOPENFILENAME)&ofn);

        if ( !bResult )
            {
            if ( !CommDlgExtendedError() )
                {
                // user canceled the box
                PostQuitMessage( 0 );
                return;
                }
            else
                CheckHR( NULL, HRESULT_FROM_WIN32( GetLastError() ), true );
            }

        SafeCopy( g_szFileName, szFileTitle, MAX_STRING );

        CheckHR( NULL,
                 CoCreateInstance( CLSID_BackgroundCopyManager,
                     NULL,
                     CLSCTX_LOCAL_SERVER,
                     IID_IBackgroundCopyManager,
                     (void**)g_pManager.GetRecvPointer() ), true );

        GUID guid;
        BITSCheckHR( NULL,
            g_pManager->CreateJob( szJobURL,
                                 BG_JOB_TYPE_DOWNLOAD,
                                 &guid,
                                 g_pJob.GetRecvPointer() ),
                        true );

        memset( &g_JobId, 0, sizeof(GUID) );
        BITSCheckHR( NULL, g_pJob->GetId( &g_JobId ), true );
        BITSCheckHR( NULL, g_pJob->AddFile( szJobURL, szFileName ), true );

        CreateStartupLink( g_JobId, g_szFileName );

        BITSCheckHR( NULL, g_pJob->SetNotifyFlags( BG_NOTIFY_JOB_MODIFICATION ), true );

        BITSCheckHR( NULL,
                     g_pJob->SetNotifyInterface( (IBackgroundCopyCallback*)&g_Callback ),
                     true );
        BITSCheckHR( NULL, g_pJob->Resume(), true );

        HandleUpdate();

    }
    catch( const _com_error &error )
    {
        if ( g_pJob )
            {
            g_pJob->Cancel();
            DeleteStartupLink( g_JobId );
            }

        throw error;
    }

}

void CreateStartupLink | ( | GUID | JobID,
 |  | WCHAR * | pszFileName
 | ) |  |

Definition at line 322 of file bits_ie.cpp.

{
    //
    // Create a link in the Startup folder for this job.
    //

    SmartShellLinkPointer   ShellLink;
    SmartPersistFilePointer PersistFile;

    WCHAR szLinkFileName[MAX_PATH] = {0};

    BOOL bResult =
        SHGetSpecialFolderPath(
            NULL,
            szLinkFileName,
            CSIDL_STARTUP,
            FALSE );

    if ( !bResult )
        CheckHR( NULL, E_FAIL, true );

    WCHAR szLinkDescription[MAX_PATH] = {0};
    SafeCopy( szLinkDescription, GetString( IDS_STARTUPLINK ), MAX_PATH );
    SafeCat( szLinkDescription, L" ", MAX_PATH );

    WCHAR szGUIDString[MAX_PATH] = {0};
    StringFromGUID2( JobID, szGUIDString, MAX_PATH );
    SafeCat( szLinkDescription, szGUIDString, MAX_PATH );

    WCHAR szArguments[MAX_PATH] = {0};
    SafeCopy( szArguments, L"/RESUMEJOB ", MAX_PATH);
    SafeCat( szArguments, szGUIDString, MAX_PATH );
    SafeCat( szArguments, L" ", MAX_PATH );
    SafeCat( szArguments, pszFileName, MAX_PATH );

    SafeCat( szLinkFileName, L"\\", MAX_PATH );
    SafeCat( szLinkFileName, szLinkDescription, MAX_PATH );
    SafeCat( szLinkFileName, L".lnk", MAX_PATH );

    CheckHR( NULL,
             CoCreateInstance( CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
                               IID_IShellLink, (LPVOID*)ShellLink.GetRecvPointer() ),
             true );

    CheckHR( NULL, ShellLink->SetShowCmd( SW_SHOWMINIMIZED ), true );
    CheckHR( NULL, ShellLink->QueryInterface( IID_IPersistFile, (LPVOID*)PersistFile.GetRecvPointer() ), true );
    CheckHR( NULL, ShellLink->SetPath( L"%windir%\\system32\\bits_ie.exe" ), true );
    CheckHR( NULL, ShellLink->SetArguments( szArguments ), true );
    CheckHR( NULL, ShellLink->SetDescription( szLinkDescription ), true );
    CheckHR( NULL, PersistFile->Save( szLinkFileName, TRUE ), true );

}

void CreateUI ( int nShowCmd )

Definition at line 1437 of file bits_ie.cpp.

{

    //
    // Creates the dialog box for the sample.
    //

    g_hwndDlg =
      CreateDialog(
         (HINSTANCE)GetModuleHandle(NULL),
         MAKEINTRESOURCE( IDD_DIALOG ),
         GetDesktopWindow(),
         DialogProc );

    if ( !g_hwndDlg )
        CheckHR( NULL, HRESULT_FROM_WIN32(GetLastError()), true );

    ShowWindow( g_hwndDlg, nShowCmd );
}

void DeleteStartupLink ( GUID JobID )

Definition at line 279 of file bits_ie.cpp.

{

    //
    // Delete the link in the Startup folder for the job
    //

    WCHAR szLinkFileName[MAX_PATH] = {0};
    WCHAR szGUIDString[MAX_PATH] = {0};

    BOOL bResult =
        SHGetSpecialFolderPath(
            NULL,
            szLinkFileName,
            CSIDL_STARTUP,
            FALSE );

    if ( !bResult )
        return;

    SafeCat( szLinkFileName, L"\\", MAX_PATH );
    SafeCat( szLinkFileName, GetString( IDS_STARTUPLINK ), MAX_PATH );
    SafeCat( szLinkFileName, L" ", MAX_PATH );

    StringFromGUID2( JobID, szGUIDString, MAX_PATH );
    SafeCat( szLinkFileName, szGUIDString, MAX_PATH );
    SafeCat( szLinkFileName, L".lnk", MAX_PATH );

    if (!DeleteFile( szLinkFileName ))
        {
        DWORD dwError = GetLastError();
        if ( ERROR_PATH_NOT_FOUND != dwError &&
             ERROR_FILE_NOT_FOUND != dwError )
            {
            CheckHR( NULL, HRESULT_FROM_WIN32( dwError ), false );
            }
        }

}

INT_PTR CALLBACK DialogProc | ( | HWND | hwndDlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 1231 of file bits_ie.cpp.

{

  //
  // Dialog proc for main dialog window
  //

  switch( uMsg )
      {

      case WM_INITDIALOG:
          g_hwndDlg = hwndDlg;
          InitDialog( hwndDlg );
          return TRUE;

      case WM_TIMER:
          HandleTimerTick( hwndDlg );
          return TRUE;

      case WM_CLOSE:
          DoClose( hwndDlg );
          return TRUE;

      case WM_COMMAND:

          switch( LOWORD( wParam ) )
              {

              case IDC_RESUME:
                  BITSCheckHR( hwndDlg, g_pJob->Resume(), false );
                  return TRUE;

              case IDC_SUSPEND:
                  BITSCheckHR( hwndDlg, g_pJob->Suspend(), false );
                  return TRUE;

              case IDC_CANCEL:
                  DoCancel( hwndDlg, true );
                  return TRUE;

              case IDC_FINISH:
                  DoFinish( hwndDlg );
                  return TRUE;

              case IDC_PRIORITY:
                  switch( HIWORD( wParam ) )
                      {

                      case CBN_SELENDOK:

                          // User clicked on priority,
                          // update it.

                          BITSCheckHR( hwndDlg,
                              g_pJob->SetPriority( (BG_JOB_PRIORITY)
                                  SendDlgItemMessage( hwndDlg, IDC_PRIORITY, CB_GETCURSEL, 0, 0 ) ), false );
                          return TRUE;

                      case CBN_SELENDCANCEL:
                          return TRUE;

                      default:
                          return FALSE;
                      }

              default:
                  return FALSE;
              }
      default:
          return FALSE;
      }
}

void DoCancel | ( | HWND | hwndDlg,
 |  | bool | PromptUser
 | ) |  |

Definition at line 1043 of file bits_ie.cpp.

{

   //
   // Handle all the operations required to cancel the job.
   // This includes asking the user for confirmation.
   //

   if ( PromptUser )
       {

       int Result =
           MessageBox(
               hwndDlg,
               GetString( IDS_CANCELTEXT ),
               GetString( IDS_CANCELCAPTION ),
               MB_YESNO | MB_ICONWARNING | MB_DEFBUTTON2 | MB_APPLMODAL |
               MB_SETFOREGROUND | MB_TOPMOST );

       if ( IDYES != Result )
           return;

       }

   try
   {
       BITSCheckHR( hwndDlg, g_pJob->Cancel(), true );
   }
   catch( _com_error Error )
   {
       // If we can't cancel for some unknown reason,
       // don't exit
       return;
   }

   DeleteStartupLink( g_JobId );
   PostQuitMessage( 0 );
}

void DoClose ( HWND hwndDlg )

Definition at line 1114 of file bits_ie.cpp.

{
    //
    // Handles an attempt by the user to close the sample.
    //

    // Check to see if the download has finished,
    // if so don't let the user exit.

    BG_JOB_STATE state;
    HRESULT hResult = g_pJob->GetState( &state );

    if (FAILED( hResult ))
        {
        BITSCheckHR( hwndDlg, hResult, false );
        return;
        }

    if ( BG_JOB_STATE_ERROR == state ||
         BG_JOB_STATE_TRANSFERRED == state )
        {

        MessageBox(
            hwndDlg,
            GetString( IDS_ALREADYFINISHED ),
            GetString( IDS_ALREADYFINISHEDCAPTION ),
            MB_OK | MB_ICONERROR | MB_DEFBUTTON1 | MB_APPLMODAL |
            MB_SETFOREGROUND | MB_TOPMOST );

        return;
        }

    //
    // Inform the user that he selected close and ask
    // confirm the intention to exit.  Explain that the job
    // will be canceled.

    int Result =
        MessageBox(
            hwndDlg,
            GetString( IDS_CLOSETEXT ),
            GetString( IDS_CLOSECAPTION ),
            MB_OKCANCEL | MB_ICONWARNING | MB_DEFBUTTON2 | MB_APPLMODAL |
            MB_SETFOREGROUND | MB_TOPMOST );

    if ( IDOK == Result )
        {

        // User confirmed the cancel, just do it.

        DoCancel( hwndDlg, false );
        return;
        }

    // The user didn't really want to exit, so ignore him
    else
        return;

}

void DoFinish ( HWND hwndDlg )

Definition at line 1087 of file bits_ie.cpp.

{

   //
   // Handles all the necessary work to complete
   // the download.
   //

   try
   {
       BITSCheckHR( hwndDlg, g_pJob->Complete(), true );
   }
   catch( _com_error Error )
   {
       // If we can't finish/complete for some unknown reason,
       // don't exit
       return;
   }

   DeleteStartupLink( g_JobId );
   PostQuitMessage( 0 );

}

const WCHAR* GetString ( UINT id )

Definition at line 236 of file bits_ie.cpp.

{

    //
    // Retrieves the localized string for the resource id
    // caching the string when loaded.

    static const WCHAR* pStringArray[ IDS_MAX ];
    static WCHAR TempStringBuffer[ MAX_STRING ];
    const WCHAR * & pStringPointer = pStringArray[ id - 1 ];

    // Cache resource strings
    if ( pStringPointer )
        return pStringPointer;

    // Load string from resource

    int CharsLoaded =
        LoadStringW(
            (HINSTANCE)GetModuleHandle(NULL),
            id,
            TempStringBuffer,
            MAX_STRING );

    if ( !CharsLoaded )
        {
        CheckHR( NULL, HRESULT_FROM_WIN32( GetLastError() ), false );
        return L"";
        }

    WCHAR *pNewString = new WCHAR[ CharsLoaded + 1];
    if ( !pNewString )
        {
        CheckHR( NULL, E_OUTOFMEMORY, false );
        return L"";
        }

    SafeCopy( pNewString, TempStringBuffer, CharsLoaded + 1 );
    return ( pStringPointer = pNewString );

}

UINT64 GetSystemTimeAsUINT64 ( )

Definition at line 436 of file bits_ie.cpp.

{

    //
    // Returns the system time as an UINT instead of a FILETIME.
    //

    FILETIME filetime;
    GetSystemTimeAsFileTime( &filetime );

    ULARGE_INTEGER large;
    memcpy( &large, &filetime, sizeof(FILETIME) );

    return large.QuadPart;
}

HRESULT HandleCOMCallback | ( | IBackgroundCopyJob * | pJob,
 |  | bool | CriticalEvent
 | ) |  |

Definition at line 1386 of file bits_ie.cpp.

{

    // In addition to the work of HandleUpdate,
    // this function checks to see if we've
    // already initialized the manager.  If not,
    // do it now.

    if ( !g_pManager )
        {

        try
        {
            CheckHR( NULL,
                     CoCreateInstance( CLSID_BackgroundCopyManager,
                         NULL,
                         CLSCTX_LOCAL_SERVER,
                         IID_IBackgroundCopyManager,
                         (void**)g_pManager.GetRecvPointer() ), true );

            *g_pJob.GetRecvPointer() = pJob;

            BITSCheckHR( NULL, g_pJob->SetNotifyFlags( BG_NOTIFY_JOB_MODIFICATION ), true );

            // As an optimization, set the notification interface to be the callback
            // It shouldn't matter if this fails
            g_pJob->SetNotifyInterface( (IBackgroundCopyCallback*)&g_Callback );

            HandleUpdate();

            ShowWindow( g_hwndDlg, CriticalEvent ? SW_NORMAL : SW_MINIMIZE );

        }
        catch(_com_error error )
        {
            g_pManager.Release();
            g_pJob.Release();

            return error.Error();
        }

        }

    HandleUpdate();
    return S_OK;
}

void HandleTimerTick ( HWND hwndDlg )

Definition at line 1179 of file bits_ie.cpp.

{

    //
    // Handle the throttling timer event
    // and update the dialog if needed
    //

    if ( g_RefreshOnTimer )
        {
        // The timer fired, handle all updates at once.
        UpdateDialog( hwndDlg );
        g_RefreshOnTimer = FALSE;
        }
    else
        {
        // The timer expired with an additional modification
        // notification.  Just kill the timer.
        KillTimer( hwndDlg, 0 );
        g_RefreshOnTimer = g_UpdateTimerSet = FALSE;
        }

}

void HandleUpdate ( )

Definition at line 1204 of file bits_ie.cpp.

{

    //
    // Handle a update request, batching the update if needed
    //

    if ( !g_UpdateTimerSet )
        {
        // We aren't currently batching updates,
        // so do this one update but prevent
        // further updates until the timer expires.
        SetTimer( g_hwndDlg, 0, 1000, NULL );
        g_UpdateTimerSet = TRUE;
        UpdateDialog( g_hwndDlg );
        }
    else
        {
        // We've started batching and yet received
        // another update request.  Delay this
        // update until the timer fires.
        g_RefreshOnTimer = TRUE;
        }

}

void InitDialog ( HWND hwndDlg )

Definition at line 933 of file bits_ie.cpp.

{

   //
   // Populate the priority list with priority descriptions
   //

   const WCHAR *Foreground    = GetString( IDS_FOREGROUND );
   const WCHAR *High          = GetString( IDS_HIGH );
   const WCHAR *Normal        = GetString( IDS_NORMAL );
   const WCHAR *Low           = GetString( IDS_LOW );

   SendDlgItemMessage( hwndDlg, IDC_PROGRESSBAR, PBM_SETRANGE, 0, MAKELPARAM(0, 100) );
   SendDlgItemMessage( hwndDlg, IDC_PRIORITY, CB_ADDSTRING, 0, (LPARAM)Foreground );
   SendDlgItemMessage( hwndDlg, IDC_PRIORITY, CB_ADDSTRING, 0, (LPARAM)High );
   SendDlgItemMessage( hwndDlg, IDC_PRIORITY, CB_ADDSTRING, 0, (LPARAM)Normal );
   SendDlgItemMessage( hwndDlg, IDC_PRIORITY, CB_ADDSTRING, 0, (LPARAM)Low );

}

const WCHAR* MapStateToString ( BG_JOB_STATE state )

Definition at line 475 of file bits_ie.cpp.

{

   //
   // Maps a BITS job state to a human readable string
   //

   switch( state )
       {

       case BG_JOB_STATE_QUEUED:
           return GetString( IDS_QUEUED );

       case BG_JOB_STATE_CONNECTING:
           return GetString( IDS_CONNECTING );

       case BG_JOB_STATE_TRANSFERRING:
           return GetString( IDS_TRANSFERRING );

       case BG_JOB_STATE_SUSPENDED:
           return GetString( IDS_SUSPENDED );

       case BG_JOB_STATE_ERROR:
           return GetString( IDS_FATALERROR );

       case BG_JOB_STATE_TRANSIENT_ERROR:
           return GetString( IDS_TRANSIENTERROR );

       case BG_JOB_STATE_TRANSFERRED:
           return GetString( IDS_TRANSFERRED );

       case BG_JOB_STATE_ACKNOWLEDGED:
           return GetString( IDS_ACKNOWLEDGED );

       case BG_JOB_STATE_CANCELLED:
           return GetString( IDS_CANCELLED );

       default:

           // NOTE: Always provide a default case
           // since new states may be added in future versions.
           return GetString( IDS_UNKNOWN );

       }
}

void ResumeJob | ( | WCHAR * | szJobGUID,
 |  | WCHAR * | szJobFileName
 | ) |  |

Definition at line 1667 of file bits_ie.cpp.

{

    //
    // Resume the display on an existing job
    //

    SafeCopy( g_szFileName, szJobFileName, MAX_PATH );
    CheckHR( NULL, IIDFromString( szJobGUID, &g_JobId ), true );

    CheckHR( NULL,
             CoCreateInstance( CLSID_BackgroundCopyManager,
                 NULL,
                 CLSCTX_LOCAL_SERVER,
                 IID_IBackgroundCopyManager,
                 (void**)g_pManager.GetRecvPointer() ), true );

    BITSCheckHR( NULL, g_pManager->GetJob( g_JobId, g_pJob.GetRecvPointer() ), true );
    BITSCheckHR( NULL,
                 g_pJob->SetNotifyInterface( (IBackgroundCopyCallback*)&g_Callback ),
                 true );
    BITSCheckHR( NULL, g_pJob->SetNotifyFlags( BG_NOTIFY_JOB_MODIFICATION ), true );

    ShowWindow( g_hwndDlg, SW_MINIMIZE );
    HandleUpdate();

}

void SafeCat | ( | WCHAR * | Dest,
 |  | const WCHAR * | Source,
 |  | size_t | Count
 | ) |  |

Definition at line 194 of file bits_ie.cpp.

{
    size_t DestSize = wcslen( Dest );

    if ( DestSize > Count )
        return;

    SafeCopy( Dest + DestSize,
              Source,
              Count - DestSize );
}

void SafeCopy | ( | WCHAR * | Dest,
 |  | const WCHAR * | Source,
 |  | size_t | Count
 | ) |  |

Definition at line 174 of file bits_ie.cpp.

{
    if ( !Count )
        return;

    while (Count && (*Source != L'\0'))
    {
        *Dest++ = *Source++;
        Count--;
    }

    if (Count == 0)
    {
        // we are going to truncate Dest
        Dest--;
    }

    *Dest= L'\0';
}

void SafeStringPrintf | ( | WCHAR * | Dest,
 |  | DWORD | Count,
 |  | const WCHAR * | Format,
 |  |  | ...
 | ) |  |

Definition at line 206 of file bits_ie.cpp.

{
     va_list arglist;
     va_start( arglist, Format );

     if ( !Count )
         return;

     int Ret;
     size_t Max;

     // leave the last space for the null terminator
     Max = Count - 1;

     Ret = _vsnwprintf( Dest, Max, Format, arglist);

     if ((Ret < 0) || (((size_t)Ret) > Max))
     {
         // need to null terminate the string
         Dest += Max;
         *Dest = '\0';
     }
     else if (((size_t)Ret) == Max)
     {
         // need to null terminate the string
         Dest += Max;
         *Dest = '\0';
     }
}

UINT64 ScaleDownloadEstimate | ( | double | Time,
 |  | const WCHAR ** | pFormat
 | ) |  |

Definition at line 562 of file bits_ie.cpp.

{

    //
    // Scales a download time estimate and selects the correct
    // format to pass to wprintf for printing.
    //

    double TimeBounds[] =
    {
       60.0 * 60.0 * 24.0,        // Days
       60.0 * 60.0,               // Hours
       60.0,                      // Minutes
       0.0                        // Seconds
    };

    UINT TimeFormat[] =
    {
        IDS_DAYSFORMAT,
        IDS_HOURSFORMAT,
        IDS_MINUTESFORMAT,
        IDS_SECONDSFORMAT
    };

    for( unsigned int c = 0;; c++ )
        {
        if ( Time >= TimeBounds[c] )
            {
            *pFormat = GetString( TimeFormat[c] );
            double scale = (TimeBounds[c] >= 1.0) ? TimeBounds[c] : 1.0;
            return (UINT64)floor( ( Time / scale ) + 0.5);
            }
        }

}

double ScaleDownloadRate | ( | double | Rate,
 |  | const WCHAR ** | pFormat
 | ) |  |

Definition at line 524 of file bits_ie.cpp.

{

    //
    // Scales a download rate and selects the correct
    // format to pass to wprintf for printing.
    //

    double RateBounds[] =
    {
       1073741824.0, // Gigabyte
       1048576.0,    // Megabyte
       1024.0,       // Kilobyte
       0             // Byte
    };

    UINT RateFormat[] =
    {
        IDS_GIGAFORMAT,
        IDS_MEGAFORMAT,
        IDS_KILOFORMAT,
        IDS_BYTEFORMAT
    };

    for( unsigned int c = 0;; c++ )
        {
        if ( Rate >= RateBounds[c] )
            {
            *pFormat = GetString( RateFormat[c] );
            double scale = (RateBounds[c] >= 1.0) ? RateBounds[c] : 1.0;
            return Rate / scale;
            }
        }
}

void SetWindowTime | ( | HWND | hwnd,
 |  | FILETIME | filetime
 | ) |  |

Definition at line 379 of file bits_ie.cpp.

{
     // Set the window text to be the text representation
     // of the file time.
     // If an error occurs, set the window text to be error

     FILETIME localtime;
     FileTimeToLocalFileTime( &filetime, &localtime );

     SYSTEMTIME systemtime;
     FileTimeToSystemTime( &localtime, &systemtime );

     WCHAR DateBuffer[ MAX_STRING ];

     int DateSize =
         GetDateFormatW(
             LOCALE_USER_DEFAULT,
             0,
             &systemtime,
             NULL,
             DateBuffer,
             MAX_STRING );

     if (!DateSize)
         {
         SetWindowText( hwnd, GetString( IDS_ERROR ) );
         return;
         }

     WCHAR TimeBuffer[ MAX_STRING ];

     int TimeSize =
        GetTimeFormatW(
            LOCALE_USER_DEFAULT,
            0,
            &systemtime,
            NULL,
            TimeBuffer,
            MAX_STRING );

     if (!TimeSize)
         {
         SetWindowText( hwnd, GetString( IDS_ERROR ) );
         return;
         }

     WCHAR FullTime[ MAX_STRING ];
     SafeStringPrintf( FullTime, MAX_STRING,
                       L"%s %s", DateBuffer, TimeBuffer );

     SetWindowText( hwnd, FullTime );
}

void SignalAlert | ( | HWND | hwndDlg,
 |  | UINT | Type
 | ) |  |

Definition at line 452 of file bits_ie.cpp.

{

    //
    // Alert the user that an important event has occurred
    //

    FLASHWINFO FlashInfo;
    FlashInfo.cbSize    = sizeof(FlashInfo);
    FlashInfo.hwnd      = hwndDlg;
    FlashInfo.dwFlags   = FLASHW_ALL | FLASHW_TIMERNOFG;
    FlashInfo.uCount    = 0;
    FlashInfo.dwTimeout = 0;

    FlashWindowEx( &FlashInfo );
    MessageBeep( Type );

}

void UpdateDialog ( HWND hwndDlg )

Definition at line 602 of file bits_ie.cpp.

{

   //
   // Main update routine for the dialog box.
   // Retries the job state/properties from
   // BITS and updates the dialog box.
   //

   {
   // update the display name

   HWND hwndDisplayName = GetDlgItem( hwndDlg, IDC_DISPLAYNAME );
   WCHAR * pszDisplayName = NULL;
   if (FAILED( g_pJob->GetDisplayName( &pszDisplayName ) ) )
       return; // stop updating on an error
   SetWindowText( hwndDisplayName, pszDisplayName );
   ShowWindow( hwndDisplayName, SW_SHOW );
   CoTaskMemFree( pszDisplayName );

   }

   static BG_JOB_STATE prevstate = BG_JOB_STATE_SUSPENDED;
   BG_JOB_STATE state;

   if (FAILED(g_pJob->GetState( &state )))
       return; // stop updating on an error

   if ( BG_JOB_STATE_ACKNOWLEDGED == state ||
        BG_JOB_STATE_CANCELLED == state )
       {
       // someone else cancelled or completed the job on us,
       // just exist the exit.
       // May happen if job is canceled with bitsadmin

       DeleteStartupLink( g_JobId );
       PostQuitMessage( 0 );
       return;
       }

   BG_JOB_PROGRESS progress;
   if (FAILED(g_pJob->GetProgress( &progress )))
       return; // stop updating on an error

   {
      // update the title, progress bar, and progress description
      WCHAR szProgress[MAX_STRING];
      WCHAR szTitle[MAX_STRING];
      WPARAM newpos = 0;

      if ( progress.BytesTotal &&
           ( progress.BytesTotal != BG_SIZE_UNKNOWN ) )
          {
          SafeStringPrintf(
              szProgress, MAX_STRING, GetString( IDS_LONGPROGRESS ),
              progress.BytesTransferred, progress.BytesTotal );

          double Percent = (double)(__int64)progress.BytesTransferred /
                           (double)(__int64)progress.BytesTotal;
          Percent *= 100.0;
          SafeStringPrintf(
              szTitle, MAX_STRING, L"%u%% %s",
              (unsigned int)Percent, g_szFileName );
          newpos = (WPARAM)Percent;

          }
      else
          {
          SafeStringPrintf(
              szProgress, MAX_STRING, GetString( IDS_SHORTPROGRESS ),
              progress.BytesTransferred );
          SafeCopy( szTitle, g_szFileName, MAX_STRING );
          newpos = 0;
          }

      SendDlgItemMessage( hwndDlg, IDC_PROGRESSBAR, PBM_SETPOS, newpos, 0 );
      SetWindowText( GetDlgItem( hwndDlg, IDC_PROGRESSINFO ), szProgress );
      ShowWindow( GetDlgItem( hwndDlg, IDC_PROGRESSINFO ), SW_SHOW );
      EnableWindow( GetDlgItem( hwndDlg, IDC_PROGRESSINFOTXT ), TRUE );
      SetWindowText( hwndDlg, szTitle );

   }

   {
   // update the status
   HWND hwndStatus = GetDlgItem( hwndDlg, IDC_STATUS );

   SetWindowText( hwndStatus, MapStateToString( state ) );
   ShowWindow( hwndStatus, SW_SHOW );

   // Only enable the finish button if the job is finished.
   EnableWindow( GetDlgItem( hwndDlg, IDC_FINISH ), ( state == BG_JOB_STATE_TRANSFERRED ) );

   // Only enable the suspend button if the job is not finished or transferred
   BOOL EnableSuspend =
       ( state != BG_JOB_STATE_SUSPENDED ) && ( state != BG_JOB_STATE_TRANSFERRED );
   EnableWindow( GetDlgItem( hwndDlg, IDC_SUSPEND ), EnableSuspend );

   // Only enable the resume button if the job is suspended
   BOOL EnableResume = ( BG_JOB_STATE_SUSPENDED == state );
   EnableWindow( GetDlgItem( hwndDlg, IDC_RESUME ), EnableResume );

   // Alert the user when something important happens
   // such as the job completes or a unrecoverable error occurs
   if ( BG_JOB_STATE_TRANSFERRED == state &&
        BG_JOB_STATE_TRANSFERRED != prevstate )
       SignalAlert( hwndDlg, MB_OK );

   else if ( BG_JOB_STATE_ERROR == state &&
        BG_JOB_STATE_ERROR != prevstate )
       SignalAlert( hwndDlg, MB_ICONEXCLAMATION );

   }

   {
   // update times
   BG_JOB_TIMES times;
   if (FAILED(g_pJob->GetTimes( &times )))
       return;

   HWND hwndCreationTime = GetDlgItem( hwndDlg, IDC_STARTTIME );
   SetWindowTime( hwndCreationTime, times.CreationTime );
   ShowWindow( hwndCreationTime, SW_SHOW );

   HWND hwndModificationTime = GetDlgItem( hwndDlg, IDC_MODIFICATIONTIME );
   SetWindowTime( hwndModificationTime, times.ModificationTime );
   ShowWindow( hwndModificationTime, SW_SHOW );

   HWND hwndCompletionTime = GetDlgItem( hwndDlg, IDC_COMPLETIONTIME );
   if ( !times.TransferCompletionTime.dwLowDateTime && !times.TransferCompletionTime.dwHighDateTime )
       {

       // BITS sets the CompletionTime to all zeros
       // if the job is incomplete

       ShowWindow( hwndCompletionTime, SW_HIDE );
       EnableWindow( GetDlgItem( hwndDlg, IDC_COMPLETIONTIMETXT ), FALSE );
       }
   else
       {
       SetWindowTime( hwndCompletionTime, times.TransferCompletionTime );
       ShowWindow( hwndCompletionTime, SW_SHOW );
       EnableWindow( GetDlgItem( hwndDlg, IDC_COMPLETIONTIMETXT ), TRUE );
       }
   }

   {
   // update the error message
   IBackgroundCopyError *pError;
   HRESULT Hr = g_pJob->GetError( &pError );

   if ( FAILED(Hr) )
       {
       ShowWindow( GetDlgItem( hwndDlg, IDC_ERRORMSG ), SW_HIDE );
       EnableWindow( GetDlgItem( hwndDlg, IDC_ERRORMSGTXT ), FALSE );
       }
   else
       {

       WCHAR* pszDescription = NULL;
       WCHAR* pszContext = NULL;

       // If these APIs fail, we should get back
       // a NULL string. So everything should be harmless.

       pError->GetErrorDescription(
           LANGIDFROMLCID( GetThreadLocale() ),
           &pszDescription );
       pError->GetErrorContextDescription(
           LANGIDFROMLCID( GetThreadLocale() ),
           &pszContext );

       WCHAR FullText[ MAX_STRING ];
       FullText[0] = L'\0';

       if ( pszDescription )
           SafeCopy( FullText, pszDescription, MAX_STRING );
       if ( pszContext )
           SafeCat( FullText, pszContext, MAX_STRING );
       CoTaskMemFree( pszDescription );
       CoTaskMemFree( pszContext );

       HWND hwndErrorText = GetDlgItem( hwndDlg, IDC_ERRORMSG );
       SetWindowText( hwndErrorText, FullText );
       ShowWindow( hwndErrorText, SW_SHOW );
       EnableWindow( GetDlgItem( hwndDlg, IDC_ERRORMSGTXT ), TRUE );

       }

   }

   if (!SendDlgItemMessage( hwndDlg, IDC_PRIORITY, CB_GETDROPPEDSTATE, 0, 0) )
       {
       // set the priority, but only do it if user isn't trying to
       // set the priority.
       BG_JOB_PRIORITY priority;
       g_pJob->GetPriority( &priority );
       SendDlgItemMessage( hwndDlg, IDC_PRIORITY, CB_SETCURSEL, (WPARAM)priority, 0 );
       }

   {

   //
   // This large block of text computes the average transfer rate
   // and estimated completion time.  This code has much
   // room for improvement.
   //

   static BOOL HasRates = FALSE;
   static UINT64 LastMeasurementTime;
   static UINT64 LastMeasurementBytes;
   static double LastMeasurementRate;

   WCHAR szRateText[MAX_STRING];
   BOOL EnableRate = FALSE;

   if ( !( BG_JOB_STATE_QUEUED == state ) &&
        !( BG_JOB_STATE_CONNECTING == state ) &&
        !( BG_JOB_STATE_TRANSFERRING == state ) )
       {
       // If the job isn't running, then rate values won't
       // make any sense. Don't display them.
       HasRates = FALSE;
       }
   else
       {

       if ( !HasRates )
           {
           LastMeasurementTime = GetSystemTimeAsUINT64();
           LastMeasurementBytes = progress.BytesTransferred;
           LastMeasurementRate = 0;
           HasRates = TRUE;
           }
       else
           {

           UINT64 CurrentTime = GetSystemTimeAsUINT64();
           UINT64 NewTotalBytes = progress.BytesTransferred;

           UINT64 NewTimeDiff = CurrentTime - LastMeasurementTime;
           UINT64 NewBytesDiff = NewTotalBytes - LastMeasurementBytes;
           double NewInstantRate = (double)(__int64)NewBytesDiff /
                                   (double)(__int64)NewTimeDiff;
           double NewAvgRate = (0.3 * LastMeasurementRate) +
                               (0.7 * NewInstantRate );

           if ( !_finite(NewInstantRate) || !_finite(NewAvgRate) )
               {
               NewInstantRate = 0;
               NewAvgRate = LastMeasurementRate;
               }

           LastMeasurementTime = CurrentTime;
           LastMeasurementBytes = NewTotalBytes;
           LastMeasurementRate = NewAvgRate;

           // convert from FILETIME units to seconds
           double NewDisplayRate = NewAvgRate * 10000000;

           const WCHAR *pRateFormat = NULL;
           double ScaledRate = ScaleDownloadRate( NewDisplayRate, &pRateFormat );
           SafeStringPrintf( szRateText, MAX_STRING, pRateFormat, ScaledRate );

           EnableRate = TRUE;
           }

       }

   if (!EnableRate)
       {
       ShowWindow( GetDlgItem( hwndDlg, IDC_TRANSFERRATE ), SW_HIDE );
       EnableWindow( GetDlgItem( hwndDlg, IDC_TRANSFERRATETXT ), FALSE );
       }
   else
       {
       SetWindowText( GetDlgItem( hwndDlg, IDC_TRANSFERRATE ), szRateText );
       ShowWindow( GetDlgItem( hwndDlg, IDC_TRANSFERRATE ), SW_SHOW );
       EnableWindow( GetDlgItem( hwndDlg, IDC_TRANSFERRATETXT ), TRUE );
       }

   BOOL EnableEstimate = FALSE;
   WCHAR szEstimateText[MAX_STRING];

   if ( EnableRate )
       {

       if ( progress.BytesTotal != 0 &&
            progress.BytesTotal != BG_SIZE_UNKNOWN )
           {

           double TimeRemaining =
               ( (__int64)progress.BytesTotal - (__int64)LastMeasurementBytes ) / LastMeasurementRate;

           // convert from FILETIME units to seconds
           TimeRemaining = TimeRemaining / 10000000.0;

           static const double SecsPer30Days = 60.0 * 60.0 * 24.0 * 30.0;

           // Don't estimate if estimate is larger then 30 days.
           if ( TimeRemaining < SecsPer30Days )
               {

               const WCHAR *pFormat = NULL;
               UINT64 Time = ScaleDownloadEstimate( TimeRemaining, &pFormat );
               SafeStringPrintf( szEstimateText, MAX_STRING, pFormat, Time );
               EnableEstimate = TRUE;
               }
           }
       }

   if (!EnableEstimate)
       {
       ShowWindow( GetDlgItem( hwndDlg, IDC_ESTIMATEDTIME ), SW_HIDE );
       EnableWindow( GetDlgItem( hwndDlg, IDC_ESTIMATEDTIMETXT ), FALSE );
       }
   else
       {
       SetWindowText( GetDlgItem( hwndDlg, IDC_ESTIMATEDTIME ), szEstimateText );
       ShowWindow( GetDlgItem( hwndDlg, IDC_ESTIMATEDTIME ), SW_SHOW );
       EnableWindow( GetDlgItem( hwndDlg, IDC_ESTIMATEDTIMETXT ), TRUE );
       }

   }

   prevstate = state;
}

int WINAPI WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 1698 of file bits_ie.cpp.

{

  //
  // Expected syntax:
  // bits_ie /CREATEJOB URL
  // bits_ie /RESUMEJOB JobGUID DestinationFile

  // /CREATEJOB - Called from the script which is run when
  //              "Background Download As" is selected.
  // /RESUMEJOB - Called from the link in the startup directory
  //              to resume a job when it is restarted.

  try
  {
      CheckHR( NULL, CoInitialize(NULL), true );

      InitCommonControls();

      CreateUI( nCmdShow );

      LPTSTR lpCommandLine = GetCommandLine();

      int argc;
      WCHAR **argv =
          CommandLineToArgvW(
              lpCommandLine,
              &argc );

      if ( argc < 2 )
          CheckHR( NULL, E_INVALIDARG, true );

      if ( argc == 3 &&
           _wcsicmp( L"/CREATEJOB", argv[1] ) == 0 )
          CreateJob( argv[2] );

      else if ( argc == 4 &&
                _wcsicmp( L"/RESUMEJOB", argv[1] ) == 0 )
          ResumeJob( argv[2], argv[3] );

      else
          CheckHR( NULL, E_INVALIDARG, true );

      MSG msg;
      while( GetMessage( &msg, NULL, 0, 0 ) )
      {
          TranslateMessage( &msg );
          DispatchMessage( &msg );
      }

  }
  catch(_com_error error )
  {
      return -1;
  }

  return 0;
}

Variable Documentation

CBackgroundCopyCallback g_Callback
HWND g_hwndDlg = NULL

Definition at line 157 of file bits_ie.cpp.

GUID g_JobId

Definition at line 155 of file bits_ie.cpp.

SmartJobPointer g_pJob

Definition at line 168 of file bits_ie.cpp.

SmartManagerPointer g_pManager

Definition at line 169 of file bits_ie.cpp.

bool g_RefreshOnTimer = FALSE

Definition at line 166 of file bits_ie.cpp.

WCHAR g_szFileName[MAX_PATH]

Definition at line 156 of file bits_ie.cpp.

bool g_UpdateTimerSet = FALSE

Definition at line 164 of file bits_ie.cpp.

Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/bits/bits_ie/resource.h File Reference

  • Web
  • bits
  • bits_ie
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_CANCEL 1005
#define | IDC_CANCEL2 1005
#define | IDC_COMPLETE2 1004
#define | IDC_COMPLETIONTIME 1024
#define | IDC_COMPLETIONTIMETXT 1011
#define | IDC_CREATIONTIMETXT 1009
#define | IDC_DISPLAYNAME 1047
#define | IDC_ERRORMSG 1027
#define | IDC_ERRORMSGTXT 1017
#define | IDC_ESTIMATEDTIME 1025
#define | IDC_ESTIMATEDTIMETXT 1012
#define | IDC_FINISH 1004
#define | IDC_MODIFICATIONTIME 1023
#define | IDC_MODIFICATONTIMETXT 1010
#define | IDC_PRIORITY 1014
#define | IDC_PRIORITYTXT 1016
#define | IDC_PROGRESS 1007
#define | IDC_PROGRESSBAR 1007
#define | IDC_PROGRESSINFO 1046
#define | IDC_PROGRESSINFOTXT 1045
#define | IDC_RESUME 1015
#define | IDC_RESUME2 1015
#define | IDC_STARTTIME 1022
#define | IDC_STATUS 1021
#define | IDC_STATUSTXT 1008
#define | IDC_SUSPEND 1006
#define | IDC_SUSPEND2 1006
#define | IDC_TRANSFERRATE 1026
#define | IDC_TRANSFERRATETXT 1013
#define | IDD_DIALOG 101
#define | IDI_ICON1 105
#define | IDS_ACKNOWLEDGED 11
#define | IDS_ALLFILES 27
#define | IDS_ALREADYFINISHED 31
#define | IDS_ALREADYFINISHEDCAPTION 32
#define | IDS_BYTEFORMAT 36
#define | IDS_CANCELCAPTION 24
#define | IDS_CANCELLED 12
#define | IDS_CANCELTEXT 25
#define | IDS_CLOSECAPTION 29
#define | IDS_CLOSETEXT 30
#define | IDS_CONNECTING 5
#define | IDS_DAYSFORMAT 14
#define | IDS_DISPLAYERRORCODE 37
#define | IDS_ERROR 2
#define | IDS_ERRORBOXTITLE 22
#define | IDS_FATALERROR 8
#define | IDS_FILEDLGTITLE 23
#define | IDS_FOREGROUND 18
#define | IDS_GIGAFORMAT 33
#define | IDS_HIGH 19
#define | IDS_HOURSFORMAT 15
#define | IDS_KILOFORMAT 35
#define | IDS_LONGPROGRESS 1
#define | IDS_LOW 21
#define | IDS_MAX IDS_DISPLAYERRORCODE
#define | IDS_MEGAFORMAT 34
#define | IDS_MINUTESFORMAT 16
#define | IDS_NOHTTPORHTTPS 26
#define | IDS_NORMAL 20
#define | IDS_QUEUED 4
#define | IDS_SECONDSFORMAT 17
#define | IDS_SHORTPROGRESS 3
#define | IDS_STARTUPLINK 28
#define | IDS_SUSPENDED 7
#define | IDS_TRANSFERRED 10
#define | IDS_TRANSFERRING 6
#define | IDS_TRANSIENTERROR 9
#define | IDS_UNKNOWN 13

Define Documentation

#define IDC_CANCEL 1005

Definition at line 48 of file resource.h.

#define IDC_CANCEL2 1005

Definition at line 47 of file resource.h.

#define IDC_COMPLETE2 1004

Definition at line 45 of file resource.h.

#define IDC_COMPLETIONTIME 1024

Definition at line 67 of file resource.h.

#define IDC_COMPLETIONTIMETXT 1011

Definition at line 56 of file resource.h.

#define IDC_CREATIONTIMETXT 1009

Definition at line 54 of file resource.h.

#define IDC_DISPLAYNAME 1047

Definition at line 73 of file resource.h.

#define IDC_ERRORMSG 1027

Definition at line 70 of file resource.h.

#define IDC_ERRORMSGTXT 1017

Definition at line 63 of file resource.h.

#define IDC_ESTIMATEDTIME 1025

Definition at line 68 of file resource.h.

#define IDC_ESTIMATEDTIMETXT 1012

Definition at line 57 of file resource.h.

#define IDC_FINISH 1004

Definition at line 46 of file resource.h.

#define IDC_MODIFICATIONTIME 1023

Definition at line 66 of file resource.h.

#define IDC_MODIFICATONTIMETXT 1010

Definition at line 55 of file resource.h.

#define IDC_PRIORITY 1014

Definition at line 59 of file resource.h.

#define IDC_PRIORITYTXT 1016

Definition at line 62 of file resource.h.

#define IDC_PROGRESS 1007

Definition at line 51 of file resource.h.

#define IDC_PROGRESSBAR 1007

Definition at line 52 of file resource.h.

#define IDC_PROGRESSINFO 1046

Definition at line 72 of file resource.h.

#define IDC_PROGRESSINFOTXT 1045

Definition at line 71 of file resource.h.

#define IDC_RESUME 1015

Definition at line 61 of file resource.h.

#define IDC_RESUME2 1015

Definition at line 60 of file resource.h.

#define IDC_STARTTIME 1022

Definition at line 65 of file resource.h.

#define IDC_STATUS 1021

Definition at line 64 of file resource.h.

#define IDC_STATUSTXT 1008

Definition at line 53 of file resource.h.

#define IDC_SUSPEND 1006

Definition at line 50 of file resource.h.

#define IDC_SUSPEND2 1006

Definition at line 49 of file resource.h.

#define IDC_TRANSFERRATE 1026

Definition at line 69 of file resource.h.

#define IDC_TRANSFERRATETXT 1013

Definition at line 58 of file resource.h.

#define IDD_DIALOG 101

Definition at line 43 of file resource.h.

#define IDI_ICON1 105

Definition at line 44 of file resource.h.

#define IDS_ACKNOWLEDGED 11

Definition at line 15 of file resource.h.

#define IDS_ALLFILES 27

Definition at line 31 of file resource.h.

#define IDS_ALREADYFINISHED 31

Definition at line 35 of file resource.h.

#define IDS_ALREADYFINISHEDCAPTION 32

Definition at line 36 of file resource.h.

#define IDS_BYTEFORMAT 36

Definition at line 40 of file resource.h.

#define IDS_CANCELCAPTION 24

Definition at line 28 of file resource.h.

#define IDS_CANCELLED 12

Definition at line 16 of file resource.h.

#define IDS_CANCELTEXT 25

Definition at line 29 of file resource.h.

#define IDS_CLOSECAPTION 29

Definition at line 33 of file resource.h.

#define IDS_CLOSETEXT 30

Definition at line 34 of file resource.h.

#define IDS_CONNECTING 5

Definition at line 9 of file resource.h.

#define IDS_DAYSFORMAT 14

Definition at line 18 of file resource.h.

#define IDS_DISPLAYERRORCODE 37

Definition at line 41 of file resource.h.

#define IDS_ERROR 2

Definition at line 6 of file resource.h.

#define IDS_ERRORBOXTITLE 22

Definition at line 26 of file resource.h.

#define IDS_FATALERROR 8

Definition at line 12 of file resource.h.

#define IDS_FILEDLGTITLE 23

Definition at line 27 of file resource.h.

#define IDS_FOREGROUND 18

Definition at line 22 of file resource.h.

#define IDS_GIGAFORMAT 33

Definition at line 37 of file resource.h.

#define IDS_HIGH 19

Definition at line 23 of file resource.h.

#define IDS_HOURSFORMAT 15

Definition at line 19 of file resource.h.

#define IDS_KILOFORMAT 35

Definition at line 39 of file resource.h.

#define IDS_LONGPROGRESS 1

Definition at line 5 of file resource.h.

#define IDS_LOW 21

Definition at line 25 of file resource.h.

#define IDS_MAX IDS_DISPLAYERRORCODE

Definition at line 42 of file resource.h.

#define IDS_MEGAFORMAT 34

Definition at line 38 of file resource.h.

#define IDS_MINUTESFORMAT 16

Definition at line 20 of file resource.h.

#define IDS_NOHTTPORHTTPS 26

Definition at line 30 of file resource.h.

#define IDS_NORMAL 20

Definition at line 24 of file resource.h.

#define IDS_QUEUED 4

Definition at line 8 of file resource.h.

#define IDS_SECONDSFORMAT 17

Definition at line 21 of file resource.h.

#define IDS_SHORTPROGRESS 3

Definition at line 7 of file resource.h.

#define IDS_STARTUPLINK 28

Definition at line 32 of file resource.h.

#define IDS_SUSPENDED 7

Definition at line 11 of file resource.h.

#define IDS_TRANSFERRED 10

Definition at line 14 of file resource.h.

#define IDS_TRANSFERRING 6

Definition at line 10 of file resource.h.

#define IDS_TRANSIENTERROR 9

Definition at line 13 of file resource.h.

#define IDS_UNKNOWN 13

Definition at line 17 of file resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/bits/Upload/cdialog.cpp File Reference

  • Web
  • bits
  • Upload
Variables

cdialog.cpp File Reference

#include <windows.h>
#include <crtdbg.h>
#include <strsafe.h>
#include <wininet.h>
#include "resource.h"
#include "main.h"
#include "util.h"
#include "cdialog.h"
#include "cpack.h"

Go to the source code of this file.

Variables

const WCHAR | STR_JOBNAME_DEFAULT [] = "BITS Upload Sample File"
const WCHAR | STR_SAMPLETEXT_DEFAULT [] = "Enter some text here"
const WCHAR | STR_VIRTUALDIR_NOTIFICATIONS [] = "http://localhost/UploadSampleWithNotifications"
const WCHAR | STR_VIRTUALDIR_PLAIN [] = "http://localhost/UploadSample"

Variable Documentation

const WCHAR STR_JOBNAME_DEFAULT[] = "BITS Upload Sample File"

Definition at line 40 of file cdialog.cpp.

const WCHAR STR_SAMPLETEXT_DEFAULT[] = "Enter some text here"

Definition at line 39 of file cdialog.cpp.

const WCHAR STR_VIRTUALDIR_NOTIFICATIONS[] = "http://localhost/UploadSampleWithNotifications"

Definition at line 37 of file cdialog.cpp.

const WCHAR STR_VIRTUALDIR_PLAIN[] = "http://localhost/UploadSample"

Definition at line 36 of file cdialog.cpp.

Generated on Wed Nov 13 2024 16:53:29 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/bits/Upload/cdialog.h File Reference

  • Web
  • bits
  • Upload
Classes | Defines

cdialog.h File Reference

#include <Windows.h>

Go to the source code of this file.

Classes

class | CSimpleDialog

Defines

#define | CALLBACK __stdcall

Define Documentation

#define CALLBACK __stdcall

Definition at line 22 of file cdialog.h.

Generated on Wed Nov 13 2024 16:53:20 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/bits/Upload/cmonitor.cpp File Reference

  • Web
  • bits
  • Upload

cmonitor.cpp File Reference

#include <windows.h>
#include <crtdbg.h>
#include <unknwn.h>
#include <strsafe.h>
#include <bits.h>
#include "util.h"
#include "main.h"
#include "cmonitor.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/bits/Upload/cmonitor.h File Reference

  • Web
  • bits
  • Upload
Classes

cmonitor.h File Reference

#include <bits.h>

Go to the source code of this file.

Classes

class CMonitor
Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/bits/Upload/cpack.cpp File Reference

  • Web
  • bits
  • Upload
Defines | Functions

cpack.cpp File Reference

#include <windows.h>
#include <crtdbg.h>
#include <strsafe.h>
#include <wininet.h>
#include <bits.h>
#include "main.h"
#include "util.h"
#include "cpack.h"
#include "cmonitor.h"

Go to the source code of this file.

Defines

#define | URL_ESCAPE_UNSAFE 0x20000000

Functions

EXTERN_C HRESULT STDAPICALLTYPE | UrlCombineW (LPCWSTR pszBase, LPCWSTR pszRelative, LPWSTR pszCombined, LPDWORD pcchCombined, DWORD dwFlags)

Define Documentation

#define URL_ESCAPE_UNSAFE 0x20000000

Definition at line 44 of file cpack.cpp.

Function Documentation

EXTERN_C HRESULT STDAPICALLTYPE UrlCombineW | ( | LPCWSTR | pszBase,
 |  | LPCWSTR | pszRelative,
 |  | LPWSTR | pszCombined,
 |  | LPDWORD | pcchCombined,
 |  | DWORD | dwFlags
 | ) |  |
Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/bits/Upload/cpack.h File Reference

  • Web
  • bits
  • Upload
Classes

cpack.h File Reference

Go to the source code of this file.

Classes

class CPack
Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/bits/Upload/main.cpp File Reference

  • Web
  • bits
  • Upload
Functions | Variables

main.cpp File Reference

#include <windows.h>
#include <crtdbg.h>
#include <strsafe.h>
#include <bits.h>
#include "resource.h"
#include "main.h"
#include "util.h"
#include "cdialog.h"

Go to the source code of this file.

Functions

int APIENTRY | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, INT iShowState)

Variables

HANDLE | g_hSafeToExitEvent = INVALID_HANDLE_VALUE
CSmartComPtr
< IBackgroundCopyManager > 		g_JobManager
CMonitor g_NotificationReceiver
CSimpleDialog * | g_pDialog = NULL

Function Documentation

int APIENTRY WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpCmdLine,
 |  | INT | iShowState
 | ) |  |

Definition at line 35 of file main.cpp.

{
    HRESULT        hr      = S_OK;
    LRESULT        lResult = 0;

    hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
    if (FAILED(hr))
    {
        goto cleanup;
    }

    //
    // Instantiate the main BITS object, the Job Manager
    //
    hr = CoCreateInstance(CLSID_BackgroundCopyManager, NULL, CLSCTX_LOCAL_SERVER, __uuidof(IBackgroundCopyManager), reinterpret_cast<LPVOID *>(g_JobManager.GrabOutPtr()));
    if (FAILED(hr))
    {
        DisplayErrorMessage(L"Failed to instantiate a CLSID_BackgroundCopyManager COM object. Aborting"
                            L"Check if BITS is correctly installed on your system.", hr);
        goto cleanup;
    }

    //
    // Create the dialog for our test application
    //
    g_pDialog = new CSimpleDialog(hInstance, IDD_UPLOADSAMPLECLIENTDIALOG);
    if (!g_pDialog)
    {
        DisplayErrorMessage(L"Could not create the UI for the BITS upload sample application. Aborting.", E_OUTOFMEMORY);
        goto cleanup;
    }

    hr = g_pDialog->Show(iShowState);
    if (FAILED(hr))
    {
        DisplayErrorMessage(L"Could not display the UI for the BITS upload sample application. Aborting.", hr);
        goto cleanup;
    }

    //
    // Starts the message loop for the dialog
    //

    INT iRet;
    MSG msg;

    iRet = GetMessage(&msg, NULL, 0, 0);
    while (iRet != 0)
    {
        if (iRet == -1)
        {
            hr = HRESULT_FROM_WIN32(GetLastError());
            DisplayErrorMessage(L"Error processing the application window message loop", hr);
            goto cleanup;
        }
        else
        {
            if (!IsWindow(g_pDialog->GetHwnd()) || !IsDialogMessage(g_pDialog->GetHwnd(), &msg))
            {
                TranslateMessage(&msg);
                DispatchMessage(&msg);
            }
        }

        iRet = GetMessage(&msg, NULL, 0, 0);
    }

cleanup:

    if (g_pDialog)
    {
        delete g_pDialog;
    }

    if (g_hSafeToExitEvent != INVALID_HANDLE_VALUE)
    {
        //
        // We need to wait here because there's chances that COM isn't yet done with
        // releasing our callback interface. The app needs to be around in case any pending reference
        // is executed.
        // The the last reference is released, the g_hSafeToExitEvent is going to be signaled
        // and we will unblock from this wait.
        //
        DWORD dwWait = WaitForSingleObject(g_hSafeToExitEvent, INFINITE);

        // Regardless of the reason we unblocked, go ahead and close
        // the event because we are about to quit the application
        CloseHandle(g_hSafeToExitEvent);
        g_hSafeToExitEvent = INVALID_HANDLE_VALUE;
    }

    // g_JobManager is a global variable, so force the release of the interface pointer
    g_JobManager.Clear();
    CoUninitialize();

    return 0;
}

Variable Documentation

HANDLE g_hSafeToExitEvent = INVALID_HANDLE_VALUE

Definition at line 33 of file main.cpp.

CSmartComPtr<IBackgroundCopyManager> g_JobManager

Definition at line 30 of file main.cpp.

CMonitor g_NotificationReceiver

Definition at line 31 of file main.cpp.

CSimpleDialog* g_pDialog = NULL

Definition at line 32 of file main.cpp.

Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/bits/Upload/main.h File Reference

  • Web
  • bits
  • Upload
Variables

main.h File Reference

#include "util.h"
#include "cdialog.h"
#include "cmonitor.h"

Go to the source code of this file.

Variables

HANDLE g_hSafeToExitEvent
CSmartComPtr
< IBackgroundCopyManager > 		g_JobManager
CMonitor g_NotificationReceiver
CSimpleDialog * g_pDialog

Variable Documentation

HANDLE g_hSafeToExitEvent

Definition at line 33 of file main.cpp.

CSmartComPtr<IBackgroundCopyManager> g_JobManager

Definition at line 30 of file main.cpp.

CMonitor g_NotificationReceiver

Definition at line 31 of file main.cpp.

CSimpleDialog* g_pDialog

Definition at line 32 of file main.cpp.

Generated on Wed Nov 13 2024 16:53:21 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/bits/Upload/resource.h File Reference

  • Web
  • bits
  • Upload
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_COMBO1 210
#define | IDC_JOBSTATUS 207
#define | IDC_RADIO1 208
#define | IDC_RADIO2 209
#define | IDC_SAMPLETEXT 201
#define | IDC_UPLOADREPLY_CHECKBOX 204
#define | IDC_VIRTUALDIR 203
#define | IDD_UPLOADSAMPLECLIENTDIALOG 102
#define | IDR_UPLOADSAMPLE 101

Define Documentation

#define IDC_COMBO1 210

Definition at line 26 of file resource.h.

#define IDC_JOBSTATUS 207

Definition at line 23 of file resource.h.

#define IDC_RADIO1 208

Definition at line 24 of file resource.h.

#define IDC_RADIO2 209

Definition at line 25 of file resource.h.

#define IDC_SAMPLETEXT 201

Definition at line 20 of file resource.h.

#define IDC_UPLOADREPLY_CHECKBOX 204

Definition at line 22 of file resource.h.

#define IDC_VIRTUALDIR 203

Definition at line 21 of file resource.h.

#define IDD_UPLOADSAMPLECLIENTDIALOG 102

Definition at line 19 of file resource.h.

#define IDR_UPLOADSAMPLE 101

Definition at line 18 of file resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/bits/Upload/util.cpp File Reference

  • Web
  • bits
  • Upload
Functions

util.cpp File Reference

#include <windows.h>
#include <crtdbg.h>
#include <strsafe.h>
#include "util.h"
#include "main.h"

Go to the source code of this file.

Functions

LPCWSTR | ConvertGuidToString (REFGUID guid)
HRESULT | DisplayErrorMessage (LPCWSTR pwszAdditionalMsg, HRESULT hrCode)

Function Documentation

LPCWSTR ConvertGuidToString ( REFGUID guid )

Definition at line 99 of file util.cpp.

{
    static WCHAR wszGuid[MAX_GUID_STRING_LENGTH];

    if (!StringFromGUID2(guid, wszGuid, MAX_GUID_STRING_LENGTH))
    {
        wszGuid[0] = L'\0';
    }

    return reinterpret_cast<WCHAR *>(wszGuid);
}

HRESULT DisplayErrorMessage | ( | LPCWSTR | pwszAdditionalMsg,
 |  | HRESULT | hrCode
 | ) |  |

Definition at line 28 of file util.cpp.

{
    HRESULT hr                    = S_OK;
    HRESULT LookupHr              = HRESULT_FROM_WIN32( ERROR_RESOURCE_LANG_NOT_FOUND );
    WCHAR   wszErrorMessage[512]  = { 0 };
    WCHAR  *pwszBITSErrorMsg      = NULL;

    if (FAILED(hrCode))
    {

        //
        // Prepare to get a locale-specific error message.
        // We we are going to try different LCIDs; depending if this is a localized OS or not,
        // we may be able to get localized error messages. Otherwise fall back to English strings.
        //
        LCID LcidsToTry[] =
        {
            GetThreadLocale(),
            GetUserDefaultLCID(),
            GetSystemDefaultLCID(),
            MAKELCID( MAKELANGID( LANG_ENGLISH, SUBLANG_ENGLISH_US ), 0 )
        };

        SIZE_T NumberOfLCIDs = ARRAYSIZE(LcidsToTry);

        //
        // Loop until we run out of LCIDs or until we succeed.
        // Note that if the error is not BITS specific, the function will search
        // winhttp and the system for a description.
        //
        for (SIZE_T i = 0;
                (( HRESULT_FROM_WIN32( ERROR_RESOURCE_LANG_NOT_FOUND ) == LookupHr ||
                   HRESULT_FROM_WIN32( ERROR_MR_MID_NOT_FOUND ) == LookupHr)
                && i < NumberOfLCIDs);
                i++)
        {
            LookupHr = g_JobManager->GetErrorDescription(hrCode, LcidsToTry[i], &pwszBITSErrorMsg);
            if (SUCCEEDED(LookupHr))
            {
                break;
            }
        }

        //
        // Build the full message that we are going to display to the user.
        // Note that maybe we didn't get an error description from BITS after all,
        // or the pwszAdditionalMsg parameter given was NULL. We need to test for those.
        //
        hr = StringCbPrintfW(
            wszErrorMessage,
            sizeof(wszErrorMessage),
            L"%s\n\nThe specific error message returned by the system is: [Error 0x%8.8x] %s\nPlease check the BITS SDK or post a question to the BITS newsgroup if you need \nassistance troubleshooting this issue.",
            (pwszAdditionalMsg? pwszAdditionalMsg : L""),
            hrCode,
            (pwszBITSErrorMsg? pwszBITSErrorMsg : L"")
        );

        if (FAILED(hr))
        {
            goto cleanup;
        }

        MessageBoxW(NULL, wszErrorMessage, L"BITS Upload Sample", MB_OK | MB_ICONERROR | MB_SYSTEMMODAL | MB_SETFOREGROUND );
    }

cleanup:

    return hr;
}

Generated on Wed Nov 13 2024 16:53:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/bits/Upload/util.h File Reference

  • Web
  • bits
  • Upload
Classes | Defines | Functions

util.h File Reference

Go to the source code of this file.

Classes

class | CSmartComPtr< T >

Defines

#define | ARRAYSIZE(a) (sizeof(a)/sizeof(a[0]))
#define | MAX_BUFFER_SIZE 4096
#define | MAX_GUID_STRING_LENGTH 40

Functions

LPCWSTR | ConvertGuidToString (REFGUID guid)
HRESULT | DisplayErrorMessage (LPCWSTR pwszAdditionalMsg, HRESULT hrCode)

Define Documentation

#define ARRAYSIZE ( a ) (sizeof(a)/sizeof(a[0]))

Definition at line 20 of file util.h.

#define MAX_BUFFER_SIZE 4096

Definition at line 21 of file util.h.

#define MAX_GUID_STRING_LENGTH 40

Definition at line 22 of file util.h.

Function Documentation

LPCWSTR ConvertGuidToString ( REFGUID guid )

Definition at line 99 of file util.cpp.

{
    static WCHAR wszGuid[MAX_GUID_STRING_LENGTH];

    if (!StringFromGUID2(guid, wszGuid, MAX_GUID_STRING_LENGTH))
    {
        wszGuid[0] = L'\0';
    }

    return reinterpret_cast<WCHAR *>(wszGuid);
}

HRESULT DisplayErrorMessage | ( | LPCWSTR | pwszAdditionalMsg,
 |  | HRESULT | hrCode
 | ) |  |

Definition at line 28 of file util.cpp.

{
    HRESULT hr                    = S_OK;
    HRESULT LookupHr              = HRESULT_FROM_WIN32( ERROR_RESOURCE_LANG_NOT_FOUND );
    WCHAR   wszErrorMessage[512]  = { 0 };
    WCHAR  *pwszBITSErrorMsg      = NULL;

    if (FAILED(hrCode))
    {

        //
        // Prepare to get a locale-specific error message.
        // We we are going to try different LCIDs; depending if this is a localized OS or not,
        // we may be able to get localized error messages. Otherwise fall back to English strings.
        //
        LCID LcidsToTry[] =
        {
            GetThreadLocale(),
            GetUserDefaultLCID(),
            GetSystemDefaultLCID(),
            MAKELCID( MAKELANGID( LANG_ENGLISH, SUBLANG_ENGLISH_US ), 0 )
        };

        SIZE_T NumberOfLCIDs = ARRAYSIZE(LcidsToTry);

        //
        // Loop until we run out of LCIDs or until we succeed.
        // Note that if the error is not BITS specific, the function will search
        // winhttp and the system for a description.
        //
        for (SIZE_T i = 0;
                (( HRESULT_FROM_WIN32( ERROR_RESOURCE_LANG_NOT_FOUND ) == LookupHr ||
                   HRESULT_FROM_WIN32( ERROR_MR_MID_NOT_FOUND ) == LookupHr)
                && i < NumberOfLCIDs);
                i++)
        {
            LookupHr = g_JobManager->GetErrorDescription(hrCode, LcidsToTry[i], &pwszBITSErrorMsg);
            if (SUCCEEDED(LookupHr))
            {
                break;
            }
        }

        //
        // Build the full message that we are going to display to the user.
        // Note that maybe we didn't get an error description from BITS after all,
        // or the pwszAdditionalMsg parameter given was NULL. We need to test for those.
        //
        hr = StringCbPrintfW(
            wszErrorMessage,
            sizeof(wszErrorMessage),
            L"%s\n\nThe specific error message returned by the system is: [Error 0x%8.8x] %s\nPlease check the BITS SDK or post a question to the BITS newsgroup if you need \nassistance troubleshooting this issue.",
            (pwszAdditionalMsg? pwszAdditionalMsg : L""),
            hrCode,
            (pwszBITSErrorMsg? pwszBITSErrorMsg : L"")
        );

        if (FAILED(hr))
        {
            goto cleanup;
        }

        MessageBoxW(NULL, wszErrorMessage, L"BITS Upload Sample", MB_OK | MB_ICONERROR | MB_SYSTEMMODAL | MB_SETFOREGROUND );
    }

cleanup:

    return hr;
}

Generated on Wed Nov 13 2024 16:53:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/BrochureMachine/BrochureMachine.cpp File Reference

  • Web
  • Browser
  • BrochureMachine
Functions | Variables

BrochureMachine.cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include "BrochureMachine.h"
#include "BrochureMachine_i.c"
#include "PTLauncher.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 46 of file BrochureMachine.cpp.

{
    return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 54 of file BrochureMachine.cpp.

{
    return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 31 of file BrochureMachine.cpp.

{
    if (dwReason == DLL_PROCESS_ATTACH)
    {
        _Module.Init(ObjectMap, hInstance, &LIBID_BROCHUREMACHINELib);
        DisableThreadLibraryCalls(hInstance);
    }
    else if (dwReason == DLL_PROCESS_DETACH)
        _Module.Term();
    return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 62 of file BrochureMachine.cpp.

{
    // registers object, typelib and all interfaces in typelib
    return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 71 of file BrochureMachine.cpp.

{
    return _Module.UnregisterServer(TRUE);
}

Variable Documentation

CComModule _Module

Definition at line 21 of file BrochureMachine.cpp.

Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/BrochureMachine/BrochureMachine.idl File Reference

  • Web
  • Browser
  • BrochureMachine
Classes | Namespaces | Functions

BrochureMachine.idl File Reference

Go to the source code of this file.

Classes

class | BROCHUREMACHINELib::PTLauncher
interface | IPTLauncher

Namespaces

namespace | BROCHUREMACHINELib

Functions

BROCHUREMACHINELib::importlib ("stdole32.tlb")
BROCHUREMACHINELib::importlib ("stdole2.tlb")
Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/BrochureMachine/BrochureMachine_p.c File Reference

  • Web
  • Browser
  • BrochureMachine
Classes | Defines | Typedefs | Functions | Variables

BrochureMachine_p.c File Reference

#include "rpcproxy.h"
#include "BrochureMachine.h"

Go to the source code of this file.

Classes

struct | _MIDL_PROC_FORMAT_STRING
struct | _MIDL_TYPE_FORMAT_STRING

Defines

#define | __REQUIRED_RPCPROXY_H_VERSION__ 440
#define | _BrochureMachine_CHECK_IID(n) IID_GENERIC_CHECK_IID( _BrochureMachine, pIID, n)
#define | PROC_FORMAT_STRING_SIZE 23
#define | TYPE_FORMAT_STRING_SIZE 3
#define | USE_STUBLESS_PROXY

Typedefs

typedef struct
_MIDL_PROC_FORMAT_STRING 		MIDL_PROC_FORMAT_STRING
typedef struct
_MIDL_TYPE_FORMAT_STRING 		MIDL_TYPE_FORMAT_STRING

Functions

int __stdcall | _BrochureMachine_IID_Lookup (const IID *pIID, int *pIndex)
CINTERFACE_PROXY_VTABLE (8)

Variables

const MIDL_PROC_FORMAT_STRING | __MIDL_ProcFormatString
const MIDL_TYPE_FORMAT_STRING | __MIDL_TypeFormatString
const IID * | _BrochureMachine_BaseIIDList []
PCInterfaceName const | _BrochureMachine_InterfaceNamesList []
const CInterfaceProxyVtbl * | _BrochureMachine_ProxyVtblList []
const CInterfaceStubVtbl * | _BrochureMachine_StubVtblList []
CInterfaceStubVtbl | _IPTLauncherStubVtbl
const ExtendedProxyFileInfo | BrochureMachine_ProxyFileInfo
const MIDL_SERVER_INFO | IPTLauncher_ServerInfo
const MIDL_STUB_DESC | Object_StubDesc

Define Documentation

#define __REQUIRED_RPCPROXY_H_VERSION__ 440

Definition at line 22 of file BrochureMachine_p.c.

#define _BrochureMachine_CHECK_IID ( n ) IID_GENERIC_CHECK_IID( _BrochureMachine, pIID, n)

Definition at line 246 of file BrochureMachine_p.c.

#define PROC_FORMAT_STRING_SIZE 23

Definition at line 35 of file BrochureMachine_p.c.

#define TYPE_FORMAT_STRING_SIZE 3

Definition at line 34 of file BrochureMachine_p.c.

#define USE_STUBLESS_PROXY

Definition at line 17 of file BrochureMachine_p.c.

Typedef Documentation

typedef struct _MIDL_PROC_FORMAT_STRING MIDL_PROC_FORMAT_STRING
typedef struct _MIDL_TYPE_FORMAT_STRING MIDL_TYPE_FORMAT_STRING

Function Documentation

int __stdcall _BrochureMachine_IID_Lookup | ( | const IID * | pIID,
 |  | int * | pIndex
 | ) |  |

Definition at line 248 of file BrochureMachine_p.c.

{

    if(!_BrochureMachine_CHECK_IID(0))
        {
        *pIndex = 0;
        return 1;
        }

    return 0;
}

CINTERFACE_PROXY_VTABLE ( 8 )

Definition at line 128 of file BrochureMachine_p.c.

{
    &IPTLauncher_ProxyInfo,
    &IID_IPTLauncher,
    IUnknown_QueryInterface_Proxy,
    IUnknown_AddRef_Proxy,
    IUnknown_Release_Proxy ,
    0 /* (void *)-1 /* IDispatch::GetTypeInfoCount */ ,
    0 /* (void *)-1 /* IDispatch::GetTypeInfo */ ,
    0 /* (void *)-1 /* IDispatch::GetIDsOfNames */ ,
    0 /* IDispatch_Invoke_Proxy */ ,
    (void *)-1 /* IPTLauncher::LaunchPT */
};

Variable Documentation

const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString

Definition at line 175 of file BrochureMachine_p.c.

const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString
Initial value:
    {
        0,
        {
      NdrFcShort( 0x0 ),

      0x0
        }
    }

Definition at line 211 of file BrochureMachine_p.c.

const IID* _BrochureMachine_BaseIIDList[]
Initial value:

{
    &IID_IDispatch,
    0
}

Definition at line 239 of file BrochureMachine_p.c.

PCInterfaceName const _BrochureMachine_InterfaceNamesList[]
Initial value:

{
    "IPTLauncher",
    0
}

Definition at line 233 of file BrochureMachine_p.c.

const CInterfaceProxyVtbl* _BrochureMachine_ProxyVtblList[]
Initial value:

{
    ( CInterfaceProxyVtbl *) &_IPTLauncherProxyVtbl,
    0
}

Definition at line 221 of file BrochureMachine_p.c.

const CInterfaceStubVtbl* _BrochureMachine_StubVtblList[]
Initial value:

{
    ( CInterfaceStubVtbl *) &_IPTLauncherStubVtbl,
    0
}

Definition at line 227 of file BrochureMachine_p.c.

CInterfaceStubVtbl _IPTLauncherStubVtbl
Initial value:
{
    &IID_IPTLauncher,
    &IPTLauncher_ServerInfo,
    8,
    &IPTLauncher_table[-3],
    CStdStubBuffer_DELEGATING_METHODS
}

Definition at line 152 of file BrochureMachine_p.c.

const ExtendedProxyFileInfo BrochureMachine_ProxyFileInfo
Initial value:

{
    (PCInterfaceProxyVtblList *) & _BrochureMachine_ProxyVtblList,
    (PCInterfaceStubVtblList *) & _BrochureMachine_StubVtblList,
    (const PCInterfaceName * ) & _BrochureMachine_InterfaceNamesList,
    (const IID ** ) & _BrochureMachine_BaseIIDList,
    & _BrochureMachine_IID_Lookup,
    1,
    2,
    0,
    0,
    0,
    0
}

Definition at line 260 of file BrochureMachine_p.c.

static const MIDL_SERVER_INFO IPTLauncher_ServerInfo
Initial value:

    {
    &Object_StubDesc,
    0,
    __MIDL_ProcFormatString.Format,
    &IPTLauncher_FormatStringOffsetTable[-3],
    0,
    0,
    0,
    0
    }

Definition at line 106 of file BrochureMachine_p.c.

const MIDL_STUB_DESC Object_StubDesc
Initial value:

    {
    0,
    NdrOleAllocate,
    NdrOleFree,
    0,
    0,
    0,
    0,
    0,
    __MIDL_TypeFormatString.Format,
    1,
    0x20000,
    0,
    0x50100a4,
    0,
    0,
    0,
    1,
    0,
    0,
    0
    }

Definition at line 73 of file BrochureMachine_p.c.

Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/BrochureMachine/dlldata.c File Reference

  • Web
  • Browser
  • BrochureMachine
Defines | Functions

dlldata.c File Reference

#include <rpcproxy.h>

Go to the source code of this file.

Defines

#define | PROXY_DELEGATION

Functions

PROXYFILE_LIST_START | REFERENCE_PROXY_FILE (BrochureMachine)

Define Documentation

#define PROXY_DELEGATION

Definition at line 18 of file dlldata.c.

Function Documentation

PROXYFILE_LIST_START REFERENCE_PROXY_FILE ( BrochureMachine )
Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/BrochureMachine/PTLauncher.cpp File Reference

  • Web
  • Browser
  • BrochureMachine

PTLauncher.cpp File Reference

#include "stdafx.h"
#include "BrochureMachine.h"
#include "PTLauncher.h"
#include "ExDisp.h"
#include "shlguid.h"
#include "mshtml.h"
#include "mshtmcid.h"
#include "mshtmhst.h"
#include "mshtmdid.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/BrochureMachine/PTLauncher.h File Reference

  • Web
  • Browser
  • BrochureMachine
Classes

PTLauncher.h File Reference

#include "resource.h"
#include <atlctl.h>

Go to the source code of this file.

Classes

class CPTLauncher
Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/BrochureMachine/resource.h File Reference

  • Web
  • Browser
  • BrochureMachine
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_PTLAUNCHER 101
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_PTLAUNCHER 101

Definition at line 10 of file resource.h.

#define IDS_PROJNAME 100

Definition at line 9 of file resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/BrochureMachine/StdAfx.cpp File Reference

  • Web
  • Browser
  • BrochureMachine

StdAfx.cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/BrochureMachine/StdAfx.h File Reference

  • Web
  • Browser
  • BrochureMachine
Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0400
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 20 of file StdAfx.h.

#define _WIN32_WINNT 0x0400

Definition at line 18 of file StdAfx.h.

#define STRICT

Definition at line 16 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EdAnnotator/AnnotatorProject/Annotator.cpp File Reference

  • Web
  • Browser
  • EdAnnotator
  • AnnotatorProject

Annotator.cpp File Reference

#include "stdafx.h"
#include "EDAnnotator.h"
#include "Annotator.h"
#include "docobj.h"
#include "mshtmcid.h"
#include "mshtmhst.h"
#include "mshtmdid.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EdAnnotator/AnnotatorProject/Annotator.h File Reference

  • Web
  • Browser
  • EdAnnotator
  • AnnotatorProject
Classes

Annotator.h File Reference

#include "resource.h"
#include <atlctl.h>
#include "mshtml.h"
#include "resource.h"

Go to the source code of this file.

Classes

class CAnnotator
Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EdAnnotator/AnnotatorProject/dlldata.c File Reference

  • Web
  • Browser
  • EdAnnotator
  • AnnotatorProject
Defines | Functions

dlldata.c File Reference

#include <rpcproxy.h>

Go to the source code of this file.

Defines

#define | PROXY_DELEGATION

Functions

PROXYFILE_LIST_START | REFERENCE_PROXY_FILE (EDAnnotator)

Define Documentation

#define PROXY_DELEGATION

Definition at line 18 of file dlldata.c.

Function Documentation

PROXYFILE_LIST_START REFERENCE_PROXY_FILE ( EDAnnotator )
Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EdAnnotator/AnnotatorProject/EDAnnotator.cpp File Reference

  • Web
  • Browser
  • EdAnnotator
  • AnnotatorProject
Functions | Variables

EDAnnotator.cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include "EDAnnotator.h"
#include "EDAnnotator_i.c"
#include "Annotator.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 46 of file EDAnnotator.cpp.

{
    return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 54 of file EDAnnotator.cpp.

{
    return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 31 of file EDAnnotator.cpp.

{
    if (dwReason == DLL_PROCESS_ATTACH)
    {
        _Module.Init(ObjectMap, hInstance, &LIBID_EDANNOTATORLib);
        DisableThreadLibraryCalls(hInstance);
    }
    else if (dwReason == DLL_PROCESS_DETACH)
        _Module.Term();
    return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 62 of file EDAnnotator.cpp.

{
    // registers object, typelib and all interfaces in typelib
    return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 71 of file EDAnnotator.cpp.

{
    return _Module.UnregisterServer(TRUE);
}

Variable Documentation

CComModule _Module

Definition at line 21 of file EDAnnotator.cpp.

Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EdAnnotator/AnnotatorProject/EDAnnotator.idl File Reference

  • Web
  • Browser
  • EdAnnotator
  • AnnotatorProject
Classes | Namespaces | Functions

EDAnnotator.idl File Reference

#include "olectl.h"

Go to the source code of this file.

Classes

class | EDANNOTATORLib::Annotator
interface | IAnnotator

Namespaces

namespace | EDANNOTATORLib

Functions

EDANNOTATORLib::importlib ("stdole32.tlb")
EDANNOTATORLib::importlib ("stdole2.tlb")
Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EdAnnotator/AnnotatorProject/EDAnnotator_p.c File Reference

  • Web
  • Browser
  • EdAnnotator
  • AnnotatorProject
Classes | Defines | Typedefs | Functions | Variables

EDAnnotator_p.c File Reference

#include "rpcproxy.h"
#include "EDAnnotator.h"

Go to the source code of this file.

Classes

struct | _MIDL_PROC_FORMAT_STRING
struct | _MIDL_TYPE_FORMAT_STRING

Defines

#define | __REQUIRED_RPCPROXY_H_VERSION__ 440
#define | _EDAnnotator_CHECK_IID(n) IID_GENERIC_CHECK_IID( _EDAnnotator, pIID, n)
#define | PROC_FORMAT_STRING_SIZE 101
#define | TYPE_FORMAT_STRING_SIZE 21
#define | USE_STUBLESS_PROXY

Typedefs

typedef struct
_MIDL_PROC_FORMAT_STRING 		MIDL_PROC_FORMAT_STRING
typedef struct
_MIDL_TYPE_FORMAT_STRING 		MIDL_TYPE_FORMAT_STRING

Functions

int __stdcall | _EDAnnotator_IID_Lookup (const IID *pIID, int *pIndex)
CINTERFACE_PROXY_VTABLE (11)

Variables

const MIDL_PROC_FORMAT_STRING | __MIDL_ProcFormatString
const MIDL_TYPE_FORMAT_STRING | __MIDL_TypeFormatString
const IID * | _EDAnnotator_BaseIIDList []
PCInterfaceName const | _EDAnnotator_InterfaceNamesList []
const CInterfaceProxyVtbl * | _EDAnnotator_ProxyVtblList []
const CInterfaceStubVtbl * | _EDAnnotator_StubVtblList []
CInterfaceStubVtbl | _IAnnotatorStubVtbl
const ExtendedProxyFileInfo | EDAnnotator_ProxyFileInfo
const MIDL_SERVER_INFO | IAnnotator_ServerInfo
const MIDL_STUB_DESC | Object_StubDesc

Define Documentation

#define __REQUIRED_RPCPROXY_H_VERSION__ 440

Definition at line 22 of file EDAnnotator_p.c.

#define _EDAnnotator_CHECK_IID ( n ) IID_GENERIC_CHECK_IID( _EDAnnotator, pIID, n)

Definition at line 375 of file EDAnnotator_p.c.

#define PROC_FORMAT_STRING_SIZE 101

Definition at line 35 of file EDAnnotator_p.c.

#define TYPE_FORMAT_STRING_SIZE 21

Definition at line 34 of file EDAnnotator_p.c.

#define USE_STUBLESS_PROXY

Definition at line 17 of file EDAnnotator_p.c.

Typedef Documentation

typedef struct _MIDL_PROC_FORMAT_STRING MIDL_PROC_FORMAT_STRING
typedef struct _MIDL_TYPE_FORMAT_STRING MIDL_TYPE_FORMAT_STRING

Function Documentation

int __stdcall _EDAnnotator_IID_Lookup | ( | const IID * | pIID,
 |  | int * | pIndex
 | ) |  |

Definition at line 377 of file EDAnnotator_p.c.

{

    if(!_EDAnnotator_CHECK_IID(0))
        {
        *pIndex = 0;
        return 1;
        }

    return 0;
}

CINTERFACE_PROXY_VTABLE ( 11 )

Definition at line 135 of file EDAnnotator_p.c.

{
    &IAnnotator_ProxyInfo,
    &IID_IAnnotator,
    IUnknown_QueryInterface_Proxy,
    IUnknown_AddRef_Proxy,
    IUnknown_Release_Proxy ,
    0 /* (void *)-1 /* IDispatch::GetTypeInfoCount */ ,
    0 /* (void *)-1 /* IDispatch::GetTypeInfo */ ,
    0 /* (void *)-1 /* IDispatch::GetIDsOfNames */ ,
    0 /* IDispatch_Invoke_Proxy */ ,
    (void *)-1 /* IAnnotator::AttachAnnotator */ ,
    (void *)-1 /* IAnnotator::DetachAnnotator */ ,
    (void *)-1 /* IAnnotator::ShowCommentGlyphs */ ,
    (void *)-1 /* IAnnotator::AddComment */
};

Variable Documentation

const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString

Definition at line 188 of file EDAnnotator_p.c.

const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString
Initial value:
    {
        0,
        {
      NdrFcShort( 0x0 ),

      0x2f,
      0x5a,
  NdrFcLong( 0x332c4425 ),
  NdrFcShort( 0x26cb ),
  NdrFcShort( 0x11d0 ),
  0xb4,
      0x83,
  0x0,
      0xc0,
  0x4f,
      0xd9,
  0x1,
      0x19,

      0x0
        }
    }

Definition at line 326 of file EDAnnotator_p.c.

const IID* _EDAnnotator_BaseIIDList[]
Initial value:

{
    &IID_IDispatch,
    0
}

Definition at line 368 of file EDAnnotator_p.c.

PCInterfaceName const _EDAnnotator_InterfaceNamesList[]
Initial value:

{
    "IAnnotator",
    0
}

Definition at line 362 of file EDAnnotator_p.c.

const CInterfaceProxyVtbl* _EDAnnotator_ProxyVtblList[]
Initial value:

{
    ( CInterfaceProxyVtbl *) &_IAnnotatorProxyVtbl,
    0
}

Definition at line 350 of file EDAnnotator_p.c.

const CInterfaceStubVtbl* _EDAnnotator_StubVtblList[]
Initial value:

{
    ( CInterfaceStubVtbl *) &_IAnnotatorStubVtbl,
    0
}

Definition at line 356 of file EDAnnotator_p.c.

CInterfaceStubVtbl _IAnnotatorStubVtbl
Initial value:
{
    &IID_IAnnotator,
    &IAnnotator_ServerInfo,
    11,
    &IAnnotator_table[-3],
    CStdStubBuffer_DELEGATING_METHODS
}

Definition at line 165 of file EDAnnotator_p.c.

const ExtendedProxyFileInfo EDAnnotator_ProxyFileInfo
Initial value:

{
    (PCInterfaceProxyVtblList *) & _EDAnnotator_ProxyVtblList,
    (PCInterfaceStubVtblList *) & _EDAnnotator_StubVtblList,
    (const PCInterfaceName * ) & _EDAnnotator_InterfaceNamesList,
    (const IID ** ) & _EDAnnotator_BaseIIDList,
    & _EDAnnotator_IID_Lookup,
    1,
    2,
    0,
    0,
    0,
    0
}

Definition at line 389 of file EDAnnotator_p.c.

static const MIDL_SERVER_INFO IAnnotator_ServerInfo
Initial value:

    {
    &Object_StubDesc,
    0,
    __MIDL_ProcFormatString.Format,
    &IAnnotator_FormatStringOffsetTable[-3],
    0,
    0,
    0,
    0
    }

Definition at line 113 of file EDAnnotator_p.c.

const MIDL_STUB_DESC Object_StubDesc
Initial value:

    {
    0,
    NdrOleAllocate,
    NdrOleFree,
    0,
    0,
    0,
    0,
    0,
    __MIDL_TypeFormatString.Format,
    1,
    0x20000,
    0,
    0x50100a4,
    0,
    0,
    0,
    1,
    0,
    0,
    0
    }

Definition at line 77 of file EDAnnotator_p.c.

Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EdAnnotator/AnnotatorProject/resource.h File Reference

  • Web
  • Browser
  • EdAnnotator
  • AnnotatorProject
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDB_ANNOTATOR 101
#define | IDR_ANNOTATOR 102
#define | IDS_PROJNAME 100

Define Documentation

#define IDB_ANNOTATOR 101

Definition at line 10 of file resource.h.

#define IDR_ANNOTATOR 102

Definition at line 11 of file resource.h.

#define IDS_PROJNAME 100

Definition at line 9 of file resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EdAnnotator/AnnotatorProject/StdAfx.cpp File Reference

  • Web
  • Browser
  • EdAnnotator
  • AnnotatorProject

StdAfx.cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EdAnnotator/AnnotatorProject/StdAfx.h File Reference

  • Web
  • Browser
  • EdAnnotator
  • AnnotatorProject
Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>
#include <atlctl.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0400
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 20 of file StdAfx.h.

#define _WIN32_WINNT 0x0400

Definition at line 18 of file StdAfx.h.

#define STRICT

Definition at line 16 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EditCommands/BrowserHost.cpp File Reference

  • Web
  • Browser
  • EditCommands

BrowserHost.cpp File Reference

#include "stdafx.h"
#include "EdCommands.h"
#include "BrowserHost.h"
#include "exdispid.h"
#include "mshtmdid.h"
#include "mshtmhst.h"
#include "mshtmcid.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EditCommands/BrowserHost.h File Reference

  • Web
  • Browser
  • EditCommands
Classes

BrowserHost.h File Reference

#include "resource.h"
#include <commctrl.h>
#include <atlwin.h>
#include <exdisp.h>
#include <mshtml.h>
#include "resource.h"

Go to the source code of this file.

Classes

class CBrowserHost
Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EditCommands/dlldata.c File Reference

  • Web
  • Browser
  • EditCommands
Defines | Functions

dlldata.c File Reference

#include <rpcproxy.h>

Go to the source code of this file.

Defines

#define | PROXY_DELEGATION

Functions

PROXYFILE_LIST_START | REFERENCE_PROXY_FILE (EdCommands)

Define Documentation

#define PROXY_DELEGATION

Definition at line 18 of file dlldata.c.

Function Documentation

PROXYFILE_LIST_START REFERENCE_PROXY_FILE ( EdCommands )
Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EditCommands/EdCommands.cpp File Reference

  • Web
  • Browser
  • EditCommands
Functions | Variables

EdCommands.cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include "EdCommands.h"
#include "EdCommands_i.c"
#include "BrowserHost.h"

Go to the source code of this file.

Functions

int WINAPI | _tWinMain (HINSTANCE hInstance, HINSTANCE, LPTSTR lpCmdLine, int)
LPCTSTR | FindOneOf (LPCTSTR p1, LPCTSTR p2)

Variables

CExeModule _Module
const DWORD | dwPause = 1000
const DWORD | dwTimeOut = 5000

Function Documentation

int WINAPI _tWinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | ,
 |  | LPTSTR | lpCmdLine,
 |  | int |
 | ) |  |

Definition at line 109 of file EdCommands.cpp.

{
  lpCmdLine = GetCommandLine(); //this line necessary for _ATL_MIN_CRT

#if _WIN32_WINNT >= 0x0400 & defined(_ATL_FREE_THREADED)
  HRESULT hRes = CoInitializeEx(NULL, COINIT_MULTITHREADED);
#else
  HRESULT hRes = CoInitialize(NULL);
#endif
  _ASSERTE(SUCCEEDED(hRes));
  _Module.Init(ObjectMap, hInstance, &LIBID_EDCOMMANDSLib);
  _Module.dwThreadID = GetCurrentThreadId();
  TCHAR szTokens[] = _T("-/");

  int nRet = 0;
  BOOL bRun = TRUE;
  LPCTSTR lpszToken = FindOneOf(lpCmdLine, szTokens);
  while (lpszToken != NULL)
  {
    if (lstrcmpi(lpszToken, _T("UnregServer"))==0)
    {
      _Module.UpdateRegistryFromResource(IDR_EdCommands, FALSE);
      nRet = _Module.UnregisterServer(TRUE);
      bRun = FALSE;
      break;
    }
    if (lstrcmpi(lpszToken, _T("RegServer"))==0)
    {
      _Module.UpdateRegistryFromResource(IDR_EdCommands, TRUE);
      nRet = _Module.RegisterServer(TRUE);
      bRun = FALSE;
      break;
    }
    lpszToken = FindOneOf(lpszToken, szTokens);
  }

  if (bRun)
  {
    _Module.StartMonitor();
#if _WIN32_WINNT >= 0x0400 & defined(_ATL_FREE_THREADED)
    hRes = _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER,
      REGCLS_MULTIPLEUSE | REGCLS_SUSPENDED);
    _ASSERTE(SUCCEEDED(hRes));
    hRes = CoResumeClassObjects();
#else
    hRes = _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER,
      REGCLS_MULTIPLEUSE);
#endif
    _ASSERTE(SUCCEEDED(hRes));

    // Create the Browser Window
    CComPtr<IBrowserHost> pApp;
    CoCreateInstance(CLSID_BrowserHost,
             NULL,
             CLSCTX_INPROC_SERVER,
             IID_IBrowserHost,
             (void**)&pApp);
    if (pApp)
    {
      pApp->Run();

      //long hwnd;
      HWND hwndApp;

      IOleWindow* pOWin;
      pApp->QueryInterface(IID_IOleWindow, (void**)&pOWin);
      pOWin->GetWindow(&hwndApp);
      pOWin->Release();
      //pApp->GetHwnd(&hwnd);
      //hwndApp = (HWND)hwnd;

      MSG msg;
      while (GetMessage(&msg, 0, 0, 0))
      {
        TranslateMessage(&msg);

        // Pass message to app on keydown so that it can pass the
        // message on to the WebBrowser control as necessary
        if (msg.message == WM_KEYDOWN)
          SendMessage(hwndApp, msg.message, msg.wParam, msg.lParam);

        DispatchMessage(&msg);
      }

      _Module.RevokeClassObjects();
      Sleep(dwPause); //wait for any threads to finish
    }
  }

  _Module.Term();
  CoUninitialize();
  return nRet;
}

LPCTSTR FindOneOf | ( | LPCTSTR | p1,
 |  | LPCTSTR | p2
 | ) |  |

Definition at line 91 of file EdCommands.cpp.

{
  while (p1 != NULL && *p1 != NULL)
  {
    LPCTSTR p = p2;
    while (p != NULL && *p != NULL)
    {
      if (*p1 == *p)
        return CharNext(p1);
      p = CharNext(p);
    }
    p1 = CharNext(p1);
  }
  return NULL;
}

Variable Documentation

CExeModule _Module

Definition at line 84 of file EdCommands.cpp.

const DWORD dwPause = 1000

Definition at line 22 of file EdCommands.cpp.

const DWORD dwTimeOut = 5000

Definition at line 21 of file EdCommands.cpp.

Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EditCommands/EdCommands.idl File Reference

  • Web
  • Browser
  • EditCommands
Classes | Namespaces | Functions

EdCommands.idl File Reference

Go to the source code of this file.

Classes

class | EDCOMMANDSLib::BrowserHost
interface | IBrowserHost

Namespaces

namespace | EDCOMMANDSLib

Functions

EDCOMMANDSLib::importlib ("stdole32.tlb")
EDCOMMANDSLib::importlib ("stdole2.tlb")
Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EditCommands/EdCommands_p.c File Reference

  • Web
  • Browser
  • EditCommands
Classes | Defines | Typedefs | Functions | Variables

EdCommands_p.c File Reference

#include "rpcproxy.h"
#include "EdCommands.h"

Go to the source code of this file.

Classes

struct | _MIDL_PROC_FORMAT_STRING
struct | _MIDL_TYPE_FORMAT_STRING

Defines

#define | __REQUIRED_RPCPROXY_H_VERSION__ 440
#define | _EdCommands_CHECK_IID(n) IID_GENERIC_CHECK_IID( _EdCommands, pIID, n)
#define | PROC_FORMAT_STRING_SIZE 45
#define | TYPE_FORMAT_STRING_SIZE 3
#define | USE_STUBLESS_PROXY

Typedefs

typedef struct
_MIDL_PROC_FORMAT_STRING 		MIDL_PROC_FORMAT_STRING
typedef struct
_MIDL_TYPE_FORMAT_STRING 		MIDL_TYPE_FORMAT_STRING

Functions

int __stdcall | _EdCommands_IID_Lookup (const IID *pIID, int *pIndex)
CINTERFACE_PROXY_VTABLE (9)

Variables

const MIDL_PROC_FORMAT_STRING | __MIDL_ProcFormatString
const MIDL_TYPE_FORMAT_STRING | __MIDL_TypeFormatString
const IID * | _EdCommands_BaseIIDList []
PCInterfaceName const | _EdCommands_InterfaceNamesList []
const CInterfaceProxyVtbl * | _EdCommands_ProxyVtblList []
const CInterfaceStubVtbl * | _EdCommands_StubVtblList []
CInterfaceStubVtbl | _IBrowserHostStubVtbl
const ExtendedProxyFileInfo | EdCommands_ProxyFileInfo
const MIDL_SERVER_INFO | IBrowserHost_ServerInfo
const MIDL_STUB_DESC | Object_StubDesc

Define Documentation

#define __REQUIRED_RPCPROXY_H_VERSION__ 440

Definition at line 22 of file EdCommands_p.c.

#define _EdCommands_CHECK_IID ( n ) IID_GENERIC_CHECK_IID( _EdCommands, pIID, n)

Definition at line 276 of file EdCommands_p.c.

#define PROC_FORMAT_STRING_SIZE 45

Definition at line 35 of file EdCommands_p.c.

#define TYPE_FORMAT_STRING_SIZE 3

Definition at line 34 of file EdCommands_p.c.

#define USE_STUBLESS_PROXY

Definition at line 17 of file EdCommands_p.c.

Typedef Documentation

typedef struct _MIDL_PROC_FORMAT_STRING MIDL_PROC_FORMAT_STRING
typedef struct _MIDL_TYPE_FORMAT_STRING MIDL_TYPE_FORMAT_STRING

Function Documentation

int __stdcall _EdCommands_IID_Lookup | ( | const IID * | pIID,
 |  | int * | pIndex
 | ) |  |

Definition at line 278 of file EdCommands_p.c.

{

    if(!_EdCommands_CHECK_IID(0))
        {
        *pIndex = 0;
        return 1;
        }

    return 0;
}

CINTERFACE_PROXY_VTABLE ( 9 )

Definition at line 129 of file EdCommands_p.c.

{
    &IBrowserHost_ProxyInfo,
    &IID_IBrowserHost,
    IUnknown_QueryInterface_Proxy,
    IUnknown_AddRef_Proxy,
    IUnknown_Release_Proxy ,
    0 /* (void *)-1 /* IDispatch::GetTypeInfoCount */ ,
    0 /* (void *)-1 /* IDispatch::GetTypeInfo */ ,
    0 /* (void *)-1 /* IDispatch::GetIDsOfNames */ ,
    0 /* IDispatch_Invoke_Proxy */ ,
    (void *)-1 /* IBrowserHost::Run */ ,
    (void *)-1 /* IBrowserHost::Stop */
};

Variable Documentation

const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString

Definition at line 178 of file EdCommands_p.c.

const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString
Initial value:
    {
        0,
        {
      NdrFcShort( 0x0 ),

      0x0
        }
    }

Definition at line 241 of file EdCommands_p.c.

const IID* _EdCommands_BaseIIDList[]
Initial value:

{
    &IID_IDispatch,
    0
}

Definition at line 269 of file EdCommands_p.c.

PCInterfaceName const _EdCommands_InterfaceNamesList[]
Initial value:

{
    "IBrowserHost",
    0
}

Definition at line 263 of file EdCommands_p.c.

const CInterfaceProxyVtbl* _EdCommands_ProxyVtblList[]
Initial value:

{
    ( CInterfaceProxyVtbl *) &_IBrowserHostProxyVtbl,
    0
}

Definition at line 251 of file EdCommands_p.c.

const CInterfaceStubVtbl* _EdCommands_StubVtblList[]
Initial value:

{
    ( CInterfaceStubVtbl *) &_IBrowserHostStubVtbl,
    0
}

Definition at line 257 of file EdCommands_p.c.

CInterfaceStubVtbl _IBrowserHostStubVtbl
Initial value:
{
    &IID_IBrowserHost,
    &IBrowserHost_ServerInfo,
    9,
    &IBrowserHost_table[-3],
    CStdStubBuffer_DELEGATING_METHODS
}

Definition at line 155 of file EdCommands_p.c.

const ExtendedProxyFileInfo EdCommands_ProxyFileInfo
Initial value:

{
    (PCInterfaceProxyVtblList *) & _EdCommands_ProxyVtblList,
    (PCInterfaceStubVtblList *) & _EdCommands_StubVtblList,
    (const PCInterfaceName * ) & _EdCommands_InterfaceNamesList,
    (const IID ** ) & _EdCommands_BaseIIDList,
    & _EdCommands_IID_Lookup,
    1,
    2,
    0,
    0,
    0,
    0
}

Definition at line 290 of file EdCommands_p.c.

static const MIDL_SERVER_INFO IBrowserHost_ServerInfo
Initial value:

    {
    &Object_StubDesc,
    0,
    __MIDL_ProcFormatString.Format,
    &IBrowserHost_FormatStringOffsetTable[-3],
    0,
    0,
    0,
    0
    }

Definition at line 107 of file EdCommands_p.c.

const MIDL_STUB_DESC Object_StubDesc
Initial value:

    {
    0,
    NdrOleAllocate,
    NdrOleFree,
    0,
    0,
    0,
    0,
    0,
    __MIDL_TypeFormatString.Format,
    1,
    0x20000,
    0,
    0x50100a4,
    0,
    0,
    0,
    1,
    0,
    0,
    0
    }

Definition at line 73 of file EdCommands_p.c.

Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EditCommands/resource.h File Reference

  • Web
  • Browser
  • EditCommands
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | ID_ADDRESSBOX 32808
#define | ID_BOX1 32800
#define | ID_BOX2 32802
#define | ID_BOX3 32804
#define | ID_BOX4 32806
#define | ID_BUTTON1 32786
#define | ID_BUTTON2 32788
#define | ID_BUTTON3 32790
#define | ID_BUTTON4 32792
#define | ID_BUTTON5 32794
#define | ID_BUTTON6 32796
#define | ID_BUTTON7 32798
#define | ID_CHECKBOX 32810
#define | ID_LEFTBAND 32784
#define | ID_TOPBAND 32782
#define | IDR_BROWSERHOST 101
#define | IDR_EdCommands 100
#define | IDS_PROJNAME 100

Define Documentation

#define ID_ADDRESSBOX 32808

Definition at line 25 of file resource.h.

#define ID_BOX1 32800

Definition at line 21 of file resource.h.

#define ID_BOX2 32802

Definition at line 22 of file resource.h.

#define ID_BOX3 32804

Definition at line 23 of file resource.h.

#define ID_BOX4 32806

Definition at line 24 of file resource.h.

#define ID_BUTTON1 32786

Definition at line 14 of file resource.h.

#define ID_BUTTON2 32788

Definition at line 15 of file resource.h.

#define ID_BUTTON3 32790

Definition at line 16 of file resource.h.

#define ID_BUTTON4 32792

Definition at line 17 of file resource.h.

#define ID_BUTTON5 32794

Definition at line 18 of file resource.h.

#define ID_BUTTON6 32796

Definition at line 19 of file resource.h.

#define ID_BUTTON7 32798

Definition at line 20 of file resource.h.

#define ID_CHECKBOX 32810

Definition at line 26 of file resource.h.

#define ID_LEFTBAND 32784

Definition at line 13 of file resource.h.

#define ID_TOPBAND 32782

Definition at line 12 of file resource.h.

#define IDR_BROWSERHOST 101

Definition at line 11 of file resource.h.

#define IDR_EdCommands 100

Definition at line 10 of file resource.h.

#define IDS_PROJNAME 100

Definition at line 9 of file resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EditCommands/StdAfx.cpp File Reference

  • Web
  • Browser
  • EditCommands

StdAfx.cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EditCommands/StdAfx.h File Reference

  • Web
  • Browser
  • EditCommands
Classes | Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Classes

class | CExeModule

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0400
#define | STRICT

Variables

CExeModule _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 20 of file StdAfx.h.

#define _WIN32_WINNT 0x0400

Definition at line 18 of file StdAfx.h.

#define STRICT

Definition at line 16 of file StdAfx.h.

Variable Documentation

CExeModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EditFeatures/BrowserHost.cpp File Reference

  • Web
  • Browser
  • EditFeatures

BrowserHost.cpp File Reference

#include "stdafx.h"
#include "EdCommands.h"
#include "BrowserHost.h"
#include "exdispid.h"
#include "mshtmdid.h"
#include "mshtmhst.h"
#include "mshtmcid.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EditFeatures/BrowserHost.h File Reference

  • Web
  • Browser
  • EditFeatures
Classes

BrowserHost.h File Reference

#include "resource.h"
#include <commctrl.h>
#include <atlwin.h>
#include <exdisp.h>
#include <mshtml.h>
#include "resource.h"

Go to the source code of this file.

Classes

class CBrowserHost
Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EditFeatures/dlldata.c File Reference

  • Web
  • Browser
  • EditFeatures
Defines | Functions

dlldata.c File Reference

#include <rpcproxy.h>

Go to the source code of this file.

Defines

#define | PROXY_DELEGATION

Functions

PROXYFILE_LIST_START | REFERENCE_PROXY_FILE (EdCommands)

Define Documentation

#define PROXY_DELEGATION

Definition at line 18 of file dlldata.c.

Function Documentation

PROXYFILE_LIST_START REFERENCE_PROXY_FILE ( EdCommands )
Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EditFeatures/EdCommands.cpp File Reference

  • Web
  • Browser
  • EditFeatures
Functions | Variables

EdCommands.cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include "EdCommands.h"
#include "EdCommands_i.c"
#include "BrowserHost.h"

Go to the source code of this file.

Functions

int WINAPI | _tWinMain (HINSTANCE hInstance, HINSTANCE, LPTSTR lpCmdLine, int)
LPCTSTR | FindOneOf (LPCTSTR p1, LPCTSTR p2)

Variables

CExeModule _Module
const DWORD | dwPause = 1000
const DWORD | dwTimeOut = 5000

Function Documentation

int WINAPI _tWinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | ,
 |  | LPTSTR | lpCmdLine,
 |  | int |
 | ) |  |

Definition at line 111 of file EdCommands.cpp.

{
  lpCmdLine = GetCommandLine(); //this line necessary for _ATL_MIN_CRT

#if _WIN32_WINNT >= 0x0400 & defined(_ATL_FREE_THREADED)
  HRESULT hRes = CoInitializeEx(NULL, COINIT_MULTITHREADED);
#else
  HRESULT hRes = CoInitialize(NULL);
#endif

  _ASSERTE(SUCCEEDED(hRes));
  _Module.Init(ObjectMap, hInstance, &LIBID_EDCOMMANDSLib);
  _Module.dwThreadID = GetCurrentThreadId();
  TCHAR szTokens[] = _T("-/");

  HRESULT hr = E_FAIL;
  BOOL bRun = TRUE;
  LPCTSTR lpszToken = FindOneOf(lpCmdLine, szTokens);
  while (lpszToken != NULL)
  {
    if (lstrcmpi(lpszToken, _T("UnregServer"))==0)
    {
      _Module.UpdateRegistryFromResource(IDR_EdCommands, FALSE);
      hr = _Module.UnregisterServer(TRUE);
      bRun = FALSE;
      //if (SUCCEEDED(hr)) MessageBox(NULL, _T("Unregistration Successful"), NULL, NULL);
      break;
    }

    if (lstrcmpi(lpszToken, _T("RegServer"))==0)
    {
      _Module.UpdateRegistryFromResource(IDR_EdCommands, TRUE);
      hr = _Module.RegisterServer(TRUE);
      bRun = FALSE;
      //if (SUCCEEDED(hr)) MessageBox(NULL, _T("Registration Successful"), NULL, NULL);
      break;
    }

    lpszToken = FindOneOf(lpszToken, szTokens);
  }

  if (bRun)
  {
    _Module.StartMonitor();

#if _WIN32_WINNT >= 0x0400 & defined(_ATL_FREE_THREADED)
    hRes = _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER,
                      REGCLS_MULTIPLEUSE | REGCLS_SUSPENDED);
    _ASSERTE(SUCCEEDED(hRes));
    hRes = CoResumeClassObjects();
#else
    hRes = _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER,
                      REGCLS_MULTIPLEUSE);
#endif

    _ASSERTE(SUCCEEDED(hRes));

    // Create the Browser Window
    CComPtr<IBrowserHost> pApp;
    CoCreateInstance(CLSID_BrowserHost,
             NULL,
             CLSCTX_INPROC_SERVER,
             IID_IBrowserHost,
             (void**)&pApp);
    if (pApp)
    {
      pApp->Run();

      long hwnd;
      HWND hwndApp;
      pApp->GetHwnd(&hwnd);
      hwndApp = (HWND)hwnd;

      MSG msg;
      while (GetMessage(&msg, 0, 0, 0))
      {
        // Avoid the beep when in the combo box
        if (msg.wParam != VK_RETURN && msg.wParam != VK_TAB)
          TranslateMessage(&msg);

        // If we get a keydown message, we must send the message
        // to the container window so that the message can be routed to
        // the correct window.  This is necessary so that the container
        // window can call TranslateAccelerator on the in-place active
        // object and so that VK_RETURN and VK_TAB messages received from
        // the combobox in the toolbar will be processed correctly.
        if (msg.message == WM_KEYDOWN)
          SendMessage(hwndApp, msg.message, msg.wParam, msg.lParam);

        DispatchMessage(&msg);
      }

      _Module.RevokeClassObjects();
      Sleep(dwPause); //wait for any threads to finish
    }
  }

  _Module.Term();
  CoUninitialize();
  return hr;
}

LPCTSTR FindOneOf | ( | LPCTSTR | p1,
 |  | LPCTSTR | p2
 | ) |  |

Definition at line 91 of file EdCommands.cpp.

{
  while (p1 != NULL && *p1 != NULL)
  {
    LPCTSTR p = p2;
    while (p != NULL && *p != NULL)
    {
      if (*p1 == *p)
        return CharNext(p1);

      p = CharNext(p);
    }

    p1 = CharNext(p1);
  }
  return NULL;
}

Variable Documentation

CExeModule _Module

Definition at line 84 of file EdCommands.cpp.

const DWORD dwPause = 1000

Definition at line 20 of file EdCommands.cpp.

const DWORD dwTimeOut = 5000

Definition at line 19 of file EdCommands.cpp.

Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EditFeatures/EdCommands.idl File Reference

  • Web
  • Browser
  • EditFeatures
Classes | Namespaces | Defines | Functions

EdCommands.idl File Reference

Go to the source code of this file.

Classes

class | EDCOMMANDSLib::BrowserHost
interface | IBrowserHost
interface | ISnap

Namespaces

namespace | EDCOMMANDSLib

Defines

#define | DISPID_GETHWND 500

Functions

EDCOMMANDSLib::importlib ("stdole32.tlb")
EDCOMMANDSLib::importlib ("stdole2.tlb")

Define Documentation

#define DISPID_GETHWND 500

Definition at line 10 of file EdCommands.idl.

Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EditFeatures/EdCommands_p.c File Reference

  • Web
  • Browser
  • EditFeatures
Classes | Defines | Typedefs | Functions | Variables

EdCommands_p.c File Reference

#include "rpcproxy.h"
#include "EdCommands.h"

Go to the source code of this file.

Classes

struct | _MIDL_PROC_FORMAT_STRING
struct | _MIDL_TYPE_FORMAT_STRING

Defines

#define | __REQUIRED_RPCPROXY_H_VERSION__ 440
#define | _EdCommands_CHECK_IID(n) IID_GENERIC_CHECK_IID( _EdCommands, pIID, n)
#define | PROC_FORMAT_STRING_SIZE 129
#define | TYPE_FORMAT_STRING_SIZE 7
#define | USE_STUBLESS_PROXY

Typedefs

typedef struct
_MIDL_PROC_FORMAT_STRING 		MIDL_PROC_FORMAT_STRING
typedef struct
_MIDL_TYPE_FORMAT_STRING 		MIDL_TYPE_FORMAT_STRING

Functions

int __stdcall | _EdCommands_IID_Lookup (const IID *pIID, int *pIndex)
CINTERFACE_PROXY_VTABLE (10)
CINTERFACE_PROXY_VTABLE (9)

Variables

const MIDL_PROC_FORMAT_STRING | __MIDL_ProcFormatString
const MIDL_TYPE_FORMAT_STRING | __MIDL_TypeFormatString
const IID * | _EdCommands_BaseIIDList []
PCInterfaceName const | _EdCommands_InterfaceNamesList []
const CInterfaceProxyVtbl * | _EdCommands_ProxyVtblList []
const CInterfaceStubVtbl * | _EdCommands_StubVtblList []
CInterfaceStubVtbl | _IBrowserHostStubVtbl
CInterfaceStubVtbl | _ISnapStubVtbl
const ExtendedProxyFileInfo | EdCommands_ProxyFileInfo
const MIDL_SERVER_INFO | IBrowserHost_ServerInfo
const MIDL_SERVER_INFO | ISnap_ServerInfo
const MIDL_STUB_DESC | Object_StubDesc

Define Documentation

#define __REQUIRED_RPCPROXY_H_VERSION__ 440

Definition at line 22 of file EdCommands_p.c.

#define _EdCommands_CHECK_IID ( n ) IID_GENERIC_CHECK_IID( _EdCommands, pIID, n)

Definition at line 479 of file EdCommands_p.c.

#define PROC_FORMAT_STRING_SIZE 129

Definition at line 35 of file EdCommands_p.c.

#define TYPE_FORMAT_STRING_SIZE 7

Definition at line 34 of file EdCommands_p.c.

#define USE_STUBLESS_PROXY

Definition at line 17 of file EdCommands_p.c.

Typedef Documentation

typedef struct _MIDL_PROC_FORMAT_STRING MIDL_PROC_FORMAT_STRING
typedef struct _MIDL_TYPE_FORMAT_STRING MIDL_TYPE_FORMAT_STRING

Function Documentation

int __stdcall _EdCommands_IID_Lookup | ( | const IID * | pIID,
 |  | int * | pIndex
 | ) |  |

Definition at line 481 of file EdCommands_p.c.

{
    IID_BS_LOOKUP_SETUP

    IID_BS_LOOKUP_INITIAL_TEST( _EdCommands, 2, 1 )
    IID_BS_LOOKUP_RETURN_RESULT( _EdCommands, 2, *pIndex )

}

CINTERFACE_PROXY_VTABLE ( 10 )

Definition at line 105 of file EdCommands_p.c.

{
    &IBrowserHost_ProxyInfo,
    &IID_IBrowserHost,
    IUnknown_QueryInterface_Proxy,
    IUnknown_AddRef_Proxy,
    IUnknown_Release_Proxy ,
    0 /* (void *)-1 /* IDispatch::GetTypeInfoCount */ ,
    0 /* (void *)-1 /* IDispatch::GetTypeInfo */ ,
    0 /* (void *)-1 /* IDispatch::GetIDsOfNames */ ,
    0 /* IDispatch_Invoke_Proxy */ ,
    (void *)-1 /* IBrowserHost::Run */ ,
    (void *)-1 /* IBrowserHost::Stop */ ,
    (void *)-1 /* IBrowserHost::GetHwnd */
};

CINTERFACE_PROXY_VTABLE ( 9 )

Definition at line 210 of file EdCommands_p.c.

{
    &ISnap_ProxyInfo,
    &IID_ISnap,
    IUnknown_QueryInterface_Proxy,
    IUnknown_AddRef_Proxy,
    IUnknown_Release_Proxy ,
    0 /* (void *)-1 /* IDispatch::GetTypeInfoCount */ ,
    0 /* (void *)-1 /* IDispatch::GetTypeInfo */ ,
    0 /* (void *)-1 /* IDispatch::GetIDsOfNames */ ,
    0 /* IDispatch_Invoke_Proxy */ ,
    (void *)-1 /* ISnap::GetSnapOn */ ,
    (void *)-1 /* ISnap::SetSnapOn */
};

Variable Documentation

const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString

Definition at line 259 of file EdCommands_p.c.

const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString
Initial value:
    {
        0,
        {
      NdrFcShort( 0x0 ),

      0x11, 0x8,
  0x8,
      0x5c,

      0x0
        }
    }

Definition at line 436 of file EdCommands_p.c.

const IID* _EdCommands_BaseIIDList[]
Initial value:

{
    &IID_IDispatch,
    &IID_IDispatch,
    0
}

Definition at line 471 of file EdCommands_p.c.

PCInterfaceName const _EdCommands_InterfaceNamesList[]
Initial value:

{
    "ISnap",
    "IBrowserHost",
    0
}

Definition at line 464 of file EdCommands_p.c.

const CInterfaceProxyVtbl* _EdCommands_ProxyVtblList[]
Initial value:

{
    ( CInterfaceProxyVtbl *) &_ISnapProxyVtbl,
    ( CInterfaceProxyVtbl *) &_IBrowserHostProxyVtbl,
    0
}

Definition at line 450 of file EdCommands_p.c.

const CInterfaceStubVtbl* _EdCommands_StubVtblList[]
Initial value:

{
    ( CInterfaceStubVtbl *) &_ISnapStubVtbl,
    ( CInterfaceStubVtbl *) &_IBrowserHostStubVtbl,
    0
}

Definition at line 457 of file EdCommands_p.c.

CInterfaceStubVtbl _IBrowserHostStubVtbl
Initial value:
{
    &IID_IBrowserHost,
    &IBrowserHost_ServerInfo,
    10,
    &IBrowserHost_table[-3],
    CStdStubBuffer_DELEGATING_METHODS
}

Definition at line 133 of file EdCommands_p.c.

CInterfaceStubVtbl _ISnapStubVtbl
Initial value:
{
    &IID_ISnap,
    &ISnap_ServerInfo,
    9,
    &ISnap_table[-3],
    CStdStubBuffer_DELEGATING_METHODS
}

Definition at line 236 of file EdCommands_p.c.

const ExtendedProxyFileInfo EdCommands_ProxyFileInfo
Initial value:

{
    (PCInterfaceProxyVtblList *) & _EdCommands_ProxyVtblList,
    (PCInterfaceStubVtblList *) & _EdCommands_StubVtblList,
    (const PCInterfaceName * ) & _EdCommands_InterfaceNamesList,
    (const IID ** ) & _EdCommands_BaseIIDList,
    & _EdCommands_IID_Lookup,
    2,
    2,
    0,
    0,
    0,
    0
}

Definition at line 490 of file EdCommands_p.c.

const MIDL_SERVER_INFO IBrowserHost_ServerInfo
Initial value:

    {
    &Object_StubDesc,
    0,
    __MIDL_ProcFormatString.Format,
    &IBrowserHost_FormatStringOffsetTable[-3],
    0,
    0,
    0,
    0
    }

Definition at line 83 of file EdCommands_p.c.

static const MIDL_SERVER_INFO ISnap_ServerInfo
Initial value:

    {
    &Object_StubDesc,
    0,
    __MIDL_ProcFormatString.Format,
    &ISnap_FormatStringOffsetTable[-3],
    0,
    0,
    0,
    0
    }

Definition at line 188 of file EdCommands_p.c.

const MIDL_STUB_DESC Object_StubDesc
Initial value:

    {
    0,
    NdrOleAllocate,
    NdrOleFree,
    0,
    0,
    0,
    0,
    0,
    __MIDL_TypeFormatString.Format,
    1,
    0x20000,
    0,
    0x50100a4,
    0,
    0,
    0,
    1,
    0,
    0,
    0
    }

Definition at line 147 of file EdCommands_p.c.

Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EditFeatures/resource.h File Reference

  • Web
  • Browser
  • EditFeatures
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | ID_BUTTON1 32768
#define | ID_BUTTON10 32782
#define | ID_BUTTON2 32769
#define | ID_BUTTON3 32770
#define | ID_BUTTON4 32772
#define | ID_BUTTON5 32774
#define | ID_BUTTON6 32776
#define | ID_BUTTON7 32778
#define | ID_BUTTON8 32777
#define | ID_BUTTON9 32779
#define | ID_TOOLBARWND 32780
#define | ID_URLBOX 32784
#define | IDR_BROWSERHOST 101
#define | IDR_EdCommands 100
#define | IDR_TOOLBAR1 201
#define | IDS_PROJNAME 100

Define Documentation

#define ID_BUTTON1 32768

Definition at line 13 of file resource.h.

#define ID_BUTTON10 32782

Definition at line 23 of file resource.h.

#define ID_BUTTON2 32769

Definition at line 14 of file resource.h.

#define ID_BUTTON3 32770

Definition at line 15 of file resource.h.

#define ID_BUTTON4 32772

Definition at line 16 of file resource.h.

#define ID_BUTTON5 32774

Definition at line 17 of file resource.h.

#define ID_BUTTON6 32776

Definition at line 18 of file resource.h.

#define ID_BUTTON7 32778

Definition at line 20 of file resource.h.

#define ID_BUTTON8 32777

Definition at line 19 of file resource.h.

#define ID_BUTTON9 32779

Definition at line 21 of file resource.h.

#define ID_TOOLBARWND 32780

Definition at line 22 of file resource.h.

#define ID_URLBOX 32784

Definition at line 24 of file resource.h.

#define IDR_BROWSERHOST 101

Definition at line 11 of file resource.h.

#define IDR_EdCommands 100

Definition at line 10 of file resource.h.

#define IDR_TOOLBAR1 201

Definition at line 12 of file resource.h.

#define IDS_PROJNAME 100

Definition at line 9 of file resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EditFeatures/StdAfx.cpp File Reference

  • Web
  • Browser
  • EditFeatures

StdAfx.cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EditFeatures/StdAfx.h File Reference

  • Web
  • Browser
  • EditFeatures
Classes | Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Classes

class | CExeModule

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0400
#define | STRICT

Variables

CExeModule _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 20 of file StdAfx.h.

#define _WIN32_WINNT 0x0400

Definition at line 18 of file StdAfx.h.

#define STRICT

Definition at line 16 of file StdAfx.h.

Variable Documentation

CExeModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EditGlyphs/BrowserHost.cpp File Reference

  • Web
  • Browser
  • EditGlyphs

BrowserHost.cpp File Reference

#include "stdafx.h"
#include "EdGlyphs.h"
#include "BrowserHost.h"
#include "exdispid.h"
#include "mshtmdid.h"
#include "mshtmhst.h"
#include "mshtmcid.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EditGlyphs/BrowserHost.h File Reference

  • Web
  • Browser
  • EditGlyphs
Classes

BrowserHost.h File Reference

#include "resource.h"
#include <commctrl.h>
#include <atlwin.h>
#include <exdisp.h>
#include <mshtml.h>
#include "resource.h"

Go to the source code of this file.

Classes

class CBrowserHost
Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EditGlyphs/dlldata.c File Reference

  • Web
  • Browser
  • EditGlyphs
Defines | Functions

dlldata.c File Reference

#include <rpcproxy.h>

Go to the source code of this file.

Defines

#define | PROXY_DELEGATION

Functions

PROXYFILE_LIST_START | REFERENCE_PROXY_FILE (EdGlyphs)

Define Documentation

#define PROXY_DELEGATION

Definition at line 18 of file dlldata.c.

Function Documentation

PROXYFILE_LIST_START REFERENCE_PROXY_FILE ( EdGlyphs )
Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EditGlyphs/EdGlyphs.cpp File Reference

  • Web
  • Browser
  • EditGlyphs
Functions | Variables

EdGlyphs.cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include "EdGlyphs.h"
#include "EdGlyphs_i.c"
#include "BrowserHost.h"

Go to the source code of this file.

Functions

int WINAPI | _tWinMain (HINSTANCE hInstance, HINSTANCE, LPTSTR lpCmdLine, int)
LPCTSTR | FindOneOf (LPCTSTR p1, LPCTSTR p2)

Variables

CExeModule _Module
const DWORD | dwPause = 1000
const DWORD | dwTimeOut = 5000

Function Documentation

int WINAPI _tWinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | ,
 |  | LPTSTR | lpCmdLine,
 |  | int |
 | ) |  |

Definition at line 111 of file EdGlyphs.cpp.

{
  lpCmdLine = GetCommandLine(); //this line necessary for _ATL_MIN_CRT

#if _WIN32_WINNT >= 0x0400 & defined(_ATL_FREE_THREADED)
  HRESULT hRes = CoInitializeEx(NULL, COINIT_MULTITHREADED);
#else
  HRESULT hRes = CoInitialize(NULL);
#endif

  _ASSERTE(SUCCEEDED(hRes));
  _Module.Init(ObjectMap, hInstance, &LIBID_EDGLYPHSLib);
  _Module.dwThreadID = GetCurrentThreadId();
  TCHAR szTokens[] = _T("-/");

  HRESULT hr = E_FAIL;
  BOOL bRun = TRUE;
  LPCTSTR lpszToken = FindOneOf(lpCmdLine, szTokens);
  while (lpszToken != NULL)
  {
    if (lstrcmpi(lpszToken, _T("UnregServer"))==0)
    {
      _Module.UpdateRegistryFromResource(IDR_EdGlyphs, FALSE);
      hr = _Module.UnregisterServer(TRUE);
      bRun = FALSE;
      //if (SUCCEEDED(hr)) MessageBox(NULL, _T("Unregistration Successful"), NULL, NULL);
      break;
    }

    if (lstrcmpi(lpszToken, _T("RegServer"))==0)
    {
      _Module.UpdateRegistryFromResource(IDR_EdGlyphs, TRUE);
      hr = _Module.RegisterServer(TRUE);
      bRun = FALSE;
      //if (SUCCEEDED(hr)) MessageBox(NULL, _T("Registration Successful"), NULL, NULL);
      break;
    }

    lpszToken = FindOneOf(lpszToken, szTokens);
  }

  if (bRun)
  {
    _Module.StartMonitor();

#if _WIN32_WINNT >= 0x0400 & defined(_ATL_FREE_THREADED)
    hRes = _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER,
                      REGCLS_MULTIPLEUSE | REGCLS_SUSPENDED);
    _ASSERTE(SUCCEEDED(hRes));
    hRes = CoResumeClassObjects();
#else
    hRes = _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER,
                      REGCLS_MULTIPLEUSE);
#endif

    _ASSERTE(SUCCEEDED(hRes));

    // Create the Browser Window
    CComPtr<IBrowserHost> pApp;
    CoCreateInstance(CLSID_BrowserHost,
             NULL,
             CLSCTX_INPROC_SERVER,
             IID_IBrowserHost,
             (void**)&pApp);
    if (pApp)
    {
      pApp->Run();

      long hwnd;
      HWND hwndApp;
      pApp->GetHwnd(&hwnd);
      hwndApp = (HWND)hwnd;

      MSG msg;
      while (GetMessage(&msg, 0, 0, 0))
      {
        // Avoid the beep when in the combo box
        if (msg.wParam != VK_RETURN && msg.wParam != VK_TAB)
          TranslateMessage(&msg);

        // If we get a keydown message, we must send the message
        // to the container window so that the message can be routed to
        // the correct window.  This is necessary so that the container
        // window can call TranslateAccelerator on the in-place active
        // object and so that VK_RETURN and VK_TAB messages received from
        // the combobox in the toolbar will be processed correctly.
        if (msg.message == WM_KEYDOWN)
          SendMessage(hwndApp, msg.message, msg.wParam, msg.lParam);

        DispatchMessage(&msg);
      }

      _Module.RevokeClassObjects();
      Sleep(dwPause); //wait for any threads to finish
    }
  }

  _Module.Term();
  CoUninitialize();
  return hr;
}

LPCTSTR FindOneOf | ( | LPCTSTR | p1,
 |  | LPCTSTR | p2
 | ) |  |

Definition at line 91 of file EdGlyphs.cpp.

{
  while (p1 != NULL && *p1 != NULL)
  {
    LPCTSTR p = p2;
    while (p != NULL && *p != NULL)
    {
      if (*p1 == *p)
        return CharNext(p1);

      p = CharNext(p);
    }

    p1 = CharNext(p1);
  }
  return NULL;
}

Variable Documentation

CExeModule _Module

Definition at line 84 of file EdGlyphs.cpp.

const DWORD dwPause = 1000

Definition at line 20 of file EdGlyphs.cpp.

const DWORD dwTimeOut = 5000

Definition at line 19 of file EdGlyphs.cpp.

Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EditGlyphs/EdGlyphs.idl File Reference

  • Web
  • Browser
  • EditGlyphs
Classes | Namespaces | Defines | Functions

EdGlyphs.idl File Reference

Go to the source code of this file.

Classes

class | EDGLYPHSLib::BrowserHost
interface | IBrowserHost
interface | ISnap

Namespaces

namespace | EDGLYPHSLib

Defines

#define | DISPID_GETHWND 500

Functions

EDGLYPHSLib::importlib ("stdole32.tlb")
EDGLYPHSLib::importlib ("stdole2.tlb")

Define Documentation

#define DISPID_GETHWND 500

Definition at line 10 of file EdGlyphs.idl.

Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EditGlyphs/EdGlyphs_p.c File Reference

  • Web
  • Browser
  • EditGlyphs
Classes | Defines | Typedefs | Functions | Variables

EdGlyphs_p.c File Reference

#include "rpcproxy.h"
#include "EdGlyphs.h"

Go to the source code of this file.

Classes

struct | _MIDL_PROC_FORMAT_STRING
struct | _MIDL_TYPE_FORMAT_STRING

Defines

#define | __REQUIRED_RPCPROXY_H_VERSION__ 440
#define | _EdGlyphs_CHECK_IID(n) IID_GENERIC_CHECK_IID( _EdGlyphs, pIID, n)
#define | PROC_FORMAT_STRING_SIZE 129
#define | TYPE_FORMAT_STRING_SIZE 7
#define | USE_STUBLESS_PROXY

Typedefs

typedef struct
_MIDL_PROC_FORMAT_STRING 		MIDL_PROC_FORMAT_STRING
typedef struct
_MIDL_TYPE_FORMAT_STRING 		MIDL_TYPE_FORMAT_STRING

Functions

int __stdcall | _EdGlyphs_IID_Lookup (const IID *pIID, int *pIndex)
CINTERFACE_PROXY_VTABLE (10)
CINTERFACE_PROXY_VTABLE (9)

Variables

const MIDL_PROC_FORMAT_STRING | __MIDL_ProcFormatString
const MIDL_TYPE_FORMAT_STRING | __MIDL_TypeFormatString
const IID * | _EdGlyphs_BaseIIDList []
PCInterfaceName const | _EdGlyphs_InterfaceNamesList []
const CInterfaceProxyVtbl * | _EdGlyphs_ProxyVtblList []
const CInterfaceStubVtbl * | _EdGlyphs_StubVtblList []
CInterfaceStubVtbl | _IBrowserHostStubVtbl
CInterfaceStubVtbl | _ISnapStubVtbl
const ExtendedProxyFileInfo | EdGlyphs_ProxyFileInfo
const MIDL_SERVER_INFO | IBrowserHost_ServerInfo
const MIDL_SERVER_INFO | ISnap_ServerInfo
const MIDL_STUB_DESC | Object_StubDesc

Define Documentation

#define __REQUIRED_RPCPROXY_H_VERSION__ 440

Definition at line 22 of file EdGlyphs_p.c.

#define _EdGlyphs_CHECK_IID ( n ) IID_GENERIC_CHECK_IID( _EdGlyphs, pIID, n)

Definition at line 479 of file EdGlyphs_p.c.

#define PROC_FORMAT_STRING_SIZE 129

Definition at line 35 of file EdGlyphs_p.c.

#define TYPE_FORMAT_STRING_SIZE 7

Definition at line 34 of file EdGlyphs_p.c.

#define USE_STUBLESS_PROXY

Definition at line 17 of file EdGlyphs_p.c.

Typedef Documentation

typedef struct _MIDL_PROC_FORMAT_STRING MIDL_PROC_FORMAT_STRING
typedef struct _MIDL_TYPE_FORMAT_STRING MIDL_TYPE_FORMAT_STRING

Function Documentation

int __stdcall _EdGlyphs_IID_Lookup | ( | const IID * | pIID,
 |  | int * | pIndex
 | ) |  |

Definition at line 481 of file EdGlyphs_p.c.

{
    IID_BS_LOOKUP_SETUP

    IID_BS_LOOKUP_INITIAL_TEST( _EdGlyphs, 2, 1 )
    IID_BS_LOOKUP_RETURN_RESULT( _EdGlyphs, 2, *pIndex )

}

CINTERFACE_PROXY_VTABLE ( 10 )

Definition at line 105 of file EdGlyphs_p.c.

{
    &IBrowserHost_ProxyInfo,
    &IID_IBrowserHost,
    IUnknown_QueryInterface_Proxy,
    IUnknown_AddRef_Proxy,
    IUnknown_Release_Proxy ,
    0 /* (void *)-1 /* IDispatch::GetTypeInfoCount */ ,
    0 /* (void *)-1 /* IDispatch::GetTypeInfo */ ,
    0 /* (void *)-1 /* IDispatch::GetIDsOfNames */ ,
    0 /* IDispatch_Invoke_Proxy */ ,
    (void *)-1 /* IBrowserHost::Run */ ,
    (void *)-1 /* IBrowserHost::Stop */ ,
    (void *)-1 /* IBrowserHost::GetHwnd */
};

CINTERFACE_PROXY_VTABLE ( 9 )

Definition at line 210 of file EdGlyphs_p.c.

{
    &ISnap_ProxyInfo,
    &IID_ISnap,
    IUnknown_QueryInterface_Proxy,
    IUnknown_AddRef_Proxy,
    IUnknown_Release_Proxy ,
    0 /* (void *)-1 /* IDispatch::GetTypeInfoCount */ ,
    0 /* (void *)-1 /* IDispatch::GetTypeInfo */ ,
    0 /* (void *)-1 /* IDispatch::GetIDsOfNames */ ,
    0 /* IDispatch_Invoke_Proxy */ ,
    (void *)-1 /* ISnap::GetSnapOn */ ,
    (void *)-1 /* ISnap::SetSnapOn */
};

Variable Documentation

const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString

Definition at line 259 of file EdGlyphs_p.c.

const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString
Initial value:
    {
        0,
        {
      NdrFcShort( 0x0 ),

      0x11, 0x8,
  0x8,
      0x5c,

      0x0
        }
    }

Definition at line 436 of file EdGlyphs_p.c.

const IID* _EdGlyphs_BaseIIDList[]
Initial value:

{
    &IID_IDispatch,
    &IID_IDispatch,
    0
}

Definition at line 471 of file EdGlyphs_p.c.

PCInterfaceName const _EdGlyphs_InterfaceNamesList[]
Initial value:

{
    "ISnap",
    "IBrowserHost",
    0
}

Definition at line 464 of file EdGlyphs_p.c.

const CInterfaceProxyVtbl* _EdGlyphs_ProxyVtblList[]
Initial value:

{
    ( CInterfaceProxyVtbl *) &_ISnapProxyVtbl,
    ( CInterfaceProxyVtbl *) &_IBrowserHostProxyVtbl,
    0
}

Definition at line 450 of file EdGlyphs_p.c.

const CInterfaceStubVtbl* _EdGlyphs_StubVtblList[]
Initial value:

{
    ( CInterfaceStubVtbl *) &_ISnapStubVtbl,
    ( CInterfaceStubVtbl *) &_IBrowserHostStubVtbl,
    0
}

Definition at line 457 of file EdGlyphs_p.c.

CInterfaceStubVtbl _IBrowserHostStubVtbl
Initial value:
{
    &IID_IBrowserHost,
    &IBrowserHost_ServerInfo,
    10,
    &IBrowserHost_table[-3],
    CStdStubBuffer_DELEGATING_METHODS
}

Definition at line 133 of file EdGlyphs_p.c.

CInterfaceStubVtbl _ISnapStubVtbl
Initial value:
{
    &IID_ISnap,
    &ISnap_ServerInfo,
    9,
    &ISnap_table[-3],
    CStdStubBuffer_DELEGATING_METHODS
}

Definition at line 236 of file EdGlyphs_p.c.

const ExtendedProxyFileInfo EdGlyphs_ProxyFileInfo
Initial value:

{
    (PCInterfaceProxyVtblList *) & _EdGlyphs_ProxyVtblList,
    (PCInterfaceStubVtblList *) & _EdGlyphs_StubVtblList,
    (const PCInterfaceName * ) & _EdGlyphs_InterfaceNamesList,
    (const IID ** ) & _EdGlyphs_BaseIIDList,
    & _EdGlyphs_IID_Lookup,
    2,
    2,
    0,
    0,
    0,
    0
}

Definition at line 490 of file EdGlyphs_p.c.

const MIDL_SERVER_INFO IBrowserHost_ServerInfo
Initial value:

    {
    &Object_StubDesc,
    0,
    __MIDL_ProcFormatString.Format,
    &IBrowserHost_FormatStringOffsetTable[-3],
    0,
    0,
    0,
    0
    }

Definition at line 83 of file EdGlyphs_p.c.

const MIDL_SERVER_INFO ISnap_ServerInfo
Initial value:

    {
    &Object_StubDesc,
    0,
    __MIDL_ProcFormatString.Format,
    &ISnap_FormatStringOffsetTable[-3],
    0,
    0,
    0,
    0
    }

Definition at line 188 of file EdGlyphs_p.c.

const MIDL_STUB_DESC Object_StubDesc
Initial value:

    {
    0,
    NdrOleAllocate,
    NdrOleFree,
    0,
    0,
    0,
    0,
    0,
    __MIDL_TypeFormatString.Format,
    1,
    0x20000,
    0,
    0x50100a4,
    0,
    0,
    0,
    1,
    0,
    0,
    0
    }

Definition at line 147 of file EdGlyphs_p.c.

Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EditGlyphs/resource.h File Reference

  • Web
  • Browser
  • EditGlyphs
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | ID_BUTTON1 32768
#define | ID_BUTTON2 32769
#define | ID_BUTTON3 32770
#define | ID_BUTTON4 32772
#define | ID_TOOLBARWND 32773
#define | ID_URLBOX 32774
#define | IDI_PBGN_GIF 206
#define | IDR_BR_GIF 205
#define | IDR_BROWSERHOST 101
#define | IDR_EdGlyphs 100
#define | IDR_GIFS1 209
#define | IDR_GIFS10 237
#define | IDR_GIFS11 238
#define | IDR_GIFS12 239
#define | IDR_GIFS13 240
#define | IDR_GIFS14 241
#define | IDR_GIFS15 242
#define | IDR_GIFS16 243
#define | IDR_GIFS17 244
#define | IDR_GIFS18 245
#define | IDR_GIFS19 246
#define | IDR_GIFS2 229
#define | IDR_GIFS3 230
#define | IDR_GIFS4 231
#define | IDR_GIFS5 232
#define | IDR_GIFS6 233
#define | IDR_GIFS7 234
#define | IDR_GIFS8 235
#define | IDR_GIFS9 236
#define | IDR_TOOLBAR1 201
#define | IDS_BR_GLYPHSTRING 104
#define | IDS_COMMENT_GLYPHSTRING 106
#define | IDS_H3ABS_GLYPHSTRING 110
#define | IDS_H3BGN_GLYPHSTRING 108
#define | IDS_H3END_GLYPHSTRING 109
#define | IDS_H4_GLYPHSTRING 111
#define | IDS_PBEG_GLYPHSTRING 101
#define | IDS_PEND_GLYPHSTRING 102
#define | IDS_PROJNAME 100
#define | IDS_SCRIPT_GLYPHSTRING 105
#define | IDS_STYLE_GLYPHSTRING 107
#define | IDS_T_GLYPHSTRING 103

Define Documentation

#define ID_BUTTON1 32768

Definition at line 45 of file resource.h.

#define ID_BUTTON2 32769

Definition at line 46 of file resource.h.

#define ID_BUTTON3 32770

Definition at line 47 of file resource.h.

#define ID_BUTTON4 32772

Definition at line 48 of file resource.h.

#define ID_TOOLBARWND 32773

Definition at line 49 of file resource.h.

#define ID_URLBOX 32774

Definition at line 50 of file resource.h.

#define IDI_PBGN_GIF 206

Definition at line 25 of file resource.h.

#define IDR_BR_GIF 205

Definition at line 24 of file resource.h.

#define IDR_BROWSERHOST 101

Definition at line 11 of file resource.h.

#define IDR_EdGlyphs 100

Definition at line 10 of file resource.h.

#define IDR_GIFS1 209

Definition at line 26 of file resource.h.

#define IDR_GIFS10 237

Definition at line 35 of file resource.h.

#define IDR_GIFS11 238

Definition at line 36 of file resource.h.

#define IDR_GIFS12 239

Definition at line 37 of file resource.h.

#define IDR_GIFS13 240

Definition at line 38 of file resource.h.

#define IDR_GIFS14 241

Definition at line 39 of file resource.h.

#define IDR_GIFS15 242

Definition at line 40 of file resource.h.

#define IDR_GIFS16 243

Definition at line 41 of file resource.h.

#define IDR_GIFS17 244

Definition at line 42 of file resource.h.

#define IDR_GIFS18 245

Definition at line 43 of file resource.h.

#define IDR_GIFS19 246

Definition at line 44 of file resource.h.

#define IDR_GIFS2 229

Definition at line 27 of file resource.h.

#define IDR_GIFS3 230

Definition at line 28 of file resource.h.

#define IDR_GIFS4 231

Definition at line 29 of file resource.h.

#define IDR_GIFS5 232

Definition at line 30 of file resource.h.

#define IDR_GIFS6 233

Definition at line 31 of file resource.h.

#define IDR_GIFS7 234

Definition at line 32 of file resource.h.

#define IDR_GIFS8 235

Definition at line 33 of file resource.h.

#define IDR_GIFS9 236

Definition at line 34 of file resource.h.

#define IDR_TOOLBAR1 201

Definition at line 23 of file resource.h.

#define IDS_BR_GLYPHSTRING 104

Definition at line 15 of file resource.h.

#define IDS_COMMENT_GLYPHSTRING 106

Definition at line 17 of file resource.h.

#define IDS_H3ABS_GLYPHSTRING 110

Definition at line 21 of file resource.h.

#define IDS_H3BGN_GLYPHSTRING 108

Definition at line 19 of file resource.h.

#define IDS_H3END_GLYPHSTRING 109

Definition at line 20 of file resource.h.

#define IDS_H4_GLYPHSTRING 111

Definition at line 22 of file resource.h.

#define IDS_PBEG_GLYPHSTRING 101

Definition at line 12 of file resource.h.

#define IDS_PEND_GLYPHSTRING 102

Definition at line 13 of file resource.h.

#define IDS_PROJNAME 100

Definition at line 9 of file resource.h.

#define IDS_SCRIPT_GLYPHSTRING 105

Definition at line 16 of file resource.h.

#define IDS_STYLE_GLYPHSTRING 107

Definition at line 18 of file resource.h.

#define IDS_T_GLYPHSTRING 103

Definition at line 14 of file resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EditGlyphs/StdAfx.cpp File Reference

  • Web
  • Browser
  • EditGlyphs

StdAfx.cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EditGlyphs/StdAfx.h File Reference

  • Web
  • Browser
  • EditGlyphs
Classes | Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Classes

class | CExeModule

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0400
#define | STRICT

Variables

CExeModule _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 20 of file StdAfx.h.

#define _WIN32_WINNT 0x0400

Definition at line 18 of file StdAfx.h.

#define STRICT

Definition at line 16 of file StdAfx.h.

Variable Documentation

CExeModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EditHost/BrowserHost.cpp File Reference

  • Web
  • Browser
  • EditHost

BrowserHost.cpp File Reference

#include "stdafx.h"
#include "EdHost.h"
#include "BrowserHost.h"
#include "exdispid.h"
#include "mshtmdid.h"
#include "mshtmhst.h"
#include "mshtmcid.h"
#include "Snap.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EditHost/BrowserHost.h File Reference

  • Web
  • Browser
  • EditHost
Classes

BrowserHost.h File Reference

#include "resource.h"
#include <commctrl.h>
#include <atlwin.h>
#include <exdisp.h>
#include <mshtml.h>
#include "resource.h"

Go to the source code of this file.

Classes

class CBrowserHost
Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EditHost/dlldata.c File Reference

  • Web
  • Browser
  • EditHost
Defines | Functions

dlldata.c File Reference

#include <rpcproxy.h>

Go to the source code of this file.

Defines

#define | PROXY_DELEGATION

Functions

PROXYFILE_LIST_START | REFERENCE_PROXY_FILE (EdHost)

Define Documentation

#define PROXY_DELEGATION

Definition at line 18 of file dlldata.c.

Function Documentation

PROXYFILE_LIST_START REFERENCE_PROXY_FILE ( EdHost )
Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EditHost/EdHost.cpp File Reference

  • Web
  • Browser
  • EditHost
Functions | Variables

EdHost.cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include "EdHost.h"
#include "EdHost_i.c"
#include "BrowserHost.h"
#include "Grid.h"
#include "Snap.h"

Go to the source code of this file.

Functions

int WINAPI | _tWinMain (HINSTANCE hInstance, HINSTANCE, LPTSTR lpCmdLine, int)
LPCTSTR | FindOneOf (LPCTSTR p1, LPCTSTR p2)

Variables

CExeModule _Module
const DWORD | dwPause = 1000
const DWORD | dwTimeOut = 5000

Function Documentation

int WINAPI _tWinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | ,
 |  | LPTSTR | lpCmdLine,
 |  | int |
 | ) |  |

Definition at line 115 of file EdHost.cpp.

{
  lpCmdLine = GetCommandLine(); //this line necessary for _ATL_MIN_CRT

#if _WIN32_WINNT >= 0x0400 & defined(_ATL_FREE_THREADED)
  HRESULT hRes = CoInitializeEx(NULL, COINIT_MULTITHREADED);
#else
  HRESULT hRes = CoInitialize(NULL);
#endif

  _ASSERTE(SUCCEEDED(hRes));
  _Module.Init(ObjectMap, hInstance, &LIBID_EDHOSTLib);
  _Module.dwThreadID = GetCurrentThreadId();
  TCHAR szTokens[] = _T("-/");

  HRESULT hr = E_FAIL;
  BOOL bRun = TRUE;
  LPCTSTR lpszToken = FindOneOf(lpCmdLine, szTokens);
  while (lpszToken != NULL)
  {
    if (lstrcmpi(lpszToken, _T("UnregServer"))==0)
    {
      _Module.UpdateRegistryFromResource(IDR_EdHost, FALSE);
      hr = _Module.UnregisterServer(TRUE);
      bRun = FALSE;
      //if (SUCCEEDED(hr)) MessageBox(NULL, _T("Unregistration Successful"), NULL, NULL);
      break;
    }

    if (lstrcmpi(lpszToken, _T("RegServer"))==0)
    {
      _Module.UpdateRegistryFromResource(IDR_EdHost, TRUE);
      hr = _Module.RegisterServer(TRUE);
      bRun = FALSE;
      //if (SUCCEEDED(hr)) MessageBox(NULL, _T("Registration Successful"), NULL, NULL);
      break;
    }

    lpszToken = FindOneOf(lpszToken, szTokens);
  }

  if (bRun)
  {
    _Module.StartMonitor();

#if _WIN32_WINNT >= 0x0400 & defined(_ATL_FREE_THREADED)
    hRes = _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER,
                      REGCLS_MULTIPLEUSE | REGCLS_SUSPENDED);
    _ASSERTE(SUCCEEDED(hRes));
    hRes = CoResumeClassObjects();
#else
    hRes = _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER,
                      REGCLS_MULTIPLEUSE);
#endif

    _ASSERTE(SUCCEEDED(hRes));

    // Create the Browser Window
    CComPtr<IBrowserHost> pApp;
    CoCreateInstance(CLSID_BrowserHost,
             NULL,
             CLSCTX_INPROC_SERVER,
             IID_IBrowserHost,
             (void**)&pApp);
    if (pApp)
    {
      pApp->Run();

      long hwnd;
      HWND hwndApp;
      pApp->GetHwnd(&hwnd);
      hwndApp = (HWND)hwnd;

      MSG msg;
      while (GetMessage(&msg, 0, 0, 0))
      {
        // Avoid the beep when in the combo box
        if (msg.wParam != VK_RETURN && msg.wParam != VK_TAB)
          TranslateMessage(&msg);

        // If we get a keydown message, we must send the message
        // to the container window so that the message can be routed to
        // the correct window.  This is necessary so that the container
        // window can call TranslateAccelerator on the in-place active
        // object and so that VK_RETURN and VK_TAB messages received from
        // the combobox in the toolbar will be processed correctly.
        if (msg.message == WM_KEYDOWN)
          SendMessage(hwndApp, msg.message, msg.wParam, msg.lParam);

        DispatchMessage(&msg);
      }

      _Module.RevokeClassObjects();
      Sleep(dwPause); //wait for any threads to finish
    }
  }

  _Module.Term();
  CoUninitialize();
  return hr;
}

LPCTSTR FindOneOf | ( | LPCTSTR | p1,
 |  | LPCTSTR | p2
 | ) |  |

Definition at line 95 of file EdHost.cpp.

{
  while (p1 != NULL && *p1 != NULL)
  {
    LPCTSTR p = p2;
    while (p != NULL && *p != NULL)
    {
      if (*p1 == *p)
        return CharNext(p1);

      p = CharNext(p);
    }

    p1 = CharNext(p1);
  }
  return NULL;
}

Variable Documentation

CExeModule _Module

Definition at line 86 of file EdHost.cpp.

const DWORD dwPause = 1000

Definition at line 22 of file EdHost.cpp.

const DWORD dwTimeOut = 5000

Definition at line 21 of file EdHost.cpp.

Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EditHost/EdHost.idl File Reference

  • Web
  • Browser
  • EditHost
Classes | Namespaces | Defines | Functions

EdHost.idl File Reference

Go to the source code of this file.

Classes

class | EDHOSTLib::BrowserHost
class | EDHOSTLib::Grid
class | EDHOSTLib::Snap
interface | IBrowserHost
interface | IGrid
interface | ISnap

Namespaces

namespace | EDHOSTLib

Defines

#define | DISPID_GETHWND 500

Functions

EDHOSTLib::importlib ("stdole32.tlb")
EDHOSTLib::importlib ("stdole2.tlb")

Define Documentation

#define DISPID_GETHWND 500

Definition at line 10 of file EdHost.idl.

Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EditHost/EdHost_p.c File Reference

  • Web
  • Browser
  • EditHost
Classes | Defines | Typedefs | Functions | Variables

EdHost_p.c File Reference

#include "rpcproxy.h"
#include "EdHost.h"

Go to the source code of this file.

Classes

struct | _MIDL_PROC_FORMAT_STRING
struct | _MIDL_TYPE_FORMAT_STRING

Defines

#define | __REQUIRED_RPCPROXY_H_VERSION__ 440
#define | _EdHost_CHECK_IID(n) IID_GENERIC_CHECK_IID( _EdHost, pIID, n)
#define | PROC_FORMAT_STRING_SIZE 241
#define | TYPE_FORMAT_STRING_SIZE 11
#define | USE_STUBLESS_PROXY

Typedefs

typedef struct
_MIDL_PROC_FORMAT_STRING 		MIDL_PROC_FORMAT_STRING
typedef struct
_MIDL_TYPE_FORMAT_STRING 		MIDL_TYPE_FORMAT_STRING

Functions

int __stdcall | _EdHost_IID_Lookup (const IID *pIID, int *pIndex)
CINTERFACE_PROXY_VTABLE (5)
CINTERFACE_PROXY_VTABLE (11)
CINTERFACE_PROXY_VTABLE (10)

Variables

const MIDL_PROC_FORMAT_STRING | __MIDL_ProcFormatString
const MIDL_TYPE_FORMAT_STRING | __MIDL_TypeFormatString
const IID * | _EdHost_BaseIIDList []
PCInterfaceName const | _EdHost_InterfaceNamesList []
const CInterfaceProxyVtbl * | _EdHost_ProxyVtblList []
const CInterfaceStubVtbl * | _EdHost_StubVtblList []
CInterfaceStubVtbl | _IBrowserHostStubVtbl
const CInterfaceStubVtbl | _IGridStubVtbl
CInterfaceStubVtbl | _ISnapStubVtbl
const ExtendedProxyFileInfo | EdHost_ProxyFileInfo
const MIDL_SERVER_INFO | IBrowserHost_ServerInfo
const MIDL_SERVER_INFO | IGrid_ServerInfo
const MIDL_SERVER_INFO | ISnap_ServerInfo
const MIDL_STUB_DESC | Object_StubDesc

Define Documentation

#define __REQUIRED_RPCPROXY_H_VERSION__ 440

Definition at line 22 of file EdHost_p.c.

#define _EdHost_CHECK_IID ( n ) IID_GENERIC_CHECK_IID( _EdHost, pIID, n)

Definition at line 704 of file EdHost_p.c.

#define PROC_FORMAT_STRING_SIZE 241

Definition at line 35 of file EdHost_p.c.

#define TYPE_FORMAT_STRING_SIZE 11

Definition at line 34 of file EdHost_p.c.

#define USE_STUBLESS_PROXY

Definition at line 17 of file EdHost_p.c.

Typedef Documentation

typedef struct _MIDL_PROC_FORMAT_STRING MIDL_PROC_FORMAT_STRING
typedef struct _MIDL_TYPE_FORMAT_STRING MIDL_TYPE_FORMAT_STRING

Function Documentation

int __stdcall _EdHost_IID_Lookup | ( | const IID * | pIID,
 |  | int * | pIndex
 | ) |  |

Definition at line 706 of file EdHost_p.c.

{
    IID_BS_LOOKUP_SETUP

    IID_BS_LOOKUP_INITIAL_TEST( _EdHost, 3, 2 )
    IID_BS_LOOKUP_NEXT_TEST( _EdHost, 1 )
    IID_BS_LOOKUP_RETURN_RESULT( _EdHost, 3, *pIndex )

}

CINTERFACE_PROXY_VTABLE ( 5 )

Definition at line 181 of file EdHost_p.c.

{
    &IGrid_ProxyInfo,
    &IID_IGrid,
    IUnknown_QueryInterface_Proxy,
    IUnknown_AddRef_Proxy,
    IUnknown_Release_Proxy ,
    (void *)-1 /* IGrid::get_GridSize */ ,
    (void *)-1 /* IGrid::put_GridSize */
};

CINTERFACE_PROXY_VTABLE ( 11 )

Definition at line 271 of file EdHost_p.c.

{
    &ISnap_ProxyInfo,
    &IID_ISnap,
    IUnknown_QueryInterface_Proxy,
    IUnknown_AddRef_Proxy,
    IUnknown_Release_Proxy ,
    0 /* (void *)-1 /* IDispatch::GetTypeInfoCount */ ,
    0 /* (void *)-1 /* IDispatch::GetTypeInfo */ ,
    0 /* (void *)-1 /* IDispatch::GetIDsOfNames */ ,
    0 /* IDispatch_Invoke_Proxy */ ,
    (void *)-1 /* ISnap::get_SnapIncrement */ ,
    (void *)-1 /* ISnap::put_SnapIncrement */ ,
    (void *)-1 /* ISnap::get_SnapOn */ ,
    (void *)-1 /* ISnap::put_SnapOn */
};

CINTERFACE_PROXY_VTABLE ( 10 )

Definition at line 105 of file EdHost_p.c.

{
    &IBrowserHost_ProxyInfo,
    &IID_IBrowserHost,
    IUnknown_QueryInterface_Proxy,
    IUnknown_AddRef_Proxy,
    IUnknown_Release_Proxy ,
    0 /* (void *)-1 /* IDispatch::GetTypeInfoCount */ ,
    0 /* (void *)-1 /* IDispatch::GetTypeInfo */ ,
    0 /* (void *)-1 /* IDispatch::GetIDsOfNames */ ,
    0 /* IDispatch_Invoke_Proxy */ ,
    (void *)-1 /* IBrowserHost::Run */ ,
    (void *)-1 /* IBrowserHost::Stop */ ,
    (void *)-1 /* IBrowserHost::GetHwnd */
};

Variable Documentation

const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString

Definition at line 324 of file EdHost_p.c.

const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString
Initial value:
    {
        0,
        {
      NdrFcShort( 0x0 ),

      0x11, 0x8,
  0x8,
      0x5c,

      0x11, 0xc,
  0x8,
      0x5c,

      0x0
        }
    }

Definition at line 653 of file EdHost_p.c.

const IID* _EdHost_BaseIIDList[]
Initial value:

{
    &IID_IDispatch,
    &IID_IDispatch,
    0,
    0
}

Definition at line 695 of file EdHost_p.c.

PCInterfaceName const _EdHost_InterfaceNamesList[]
Initial value:

{
    "ISnap",
    "IBrowserHost",
    "IGrid",
    0
}

Definition at line 687 of file EdHost_p.c.

const CInterfaceProxyVtbl* _EdHost_ProxyVtblList[]
Initial value:

{
    ( CInterfaceProxyVtbl *) &_ISnapProxyVtbl,
    ( CInterfaceProxyVtbl *) &_IBrowserHostProxyVtbl,
    ( CInterfaceProxyVtbl *) &_IGridProxyVtbl,
    0
}

Definition at line 671 of file EdHost_p.c.

const CInterfaceStubVtbl* _EdHost_StubVtblList[]
Initial value:

{
    ( CInterfaceStubVtbl *) &_ISnapStubVtbl,
    ( CInterfaceStubVtbl *) &_IBrowserHostStubVtbl,
    ( CInterfaceStubVtbl *) &_IGridStubVtbl,
    0
}

Definition at line 679 of file EdHost_p.c.

CInterfaceStubVtbl _IBrowserHostStubVtbl
Initial value:
{
    &IID_IBrowserHost,
    &IBrowserHost_ServerInfo,
    10,
    &IBrowserHost_table[-3],
    CStdStubBuffer_DELEGATING_METHODS
}

Definition at line 133 of file EdHost_p.c.

const CInterfaceStubVtbl _IGridStubVtbl
Initial value:
{
    &IID_IGrid,
    &IGrid_ServerInfo,
    5,
    0,
    CStdStubBuffer_METHODS
}

Definition at line 192 of file EdHost_p.c.

CInterfaceStubVtbl _ISnapStubVtbl
Initial value:
{
    &IID_ISnap,
    &ISnap_ServerInfo,
    11,
    &ISnap_table[-3],
    CStdStubBuffer_DELEGATING_METHODS
}

Definition at line 301 of file EdHost_p.c.

const ExtendedProxyFileInfo EdHost_ProxyFileInfo
Initial value:

{
    (PCInterfaceProxyVtblList *) & _EdHost_ProxyVtblList,
    (PCInterfaceStubVtblList *) & _EdHost_StubVtblList,
    (const PCInterfaceName * ) & _EdHost_InterfaceNamesList,
    (const IID ** ) & _EdHost_BaseIIDList,
    & _EdHost_IID_Lookup,
    3,
    2,
    0,
    0,
    0,
    0
}

Definition at line 716 of file EdHost_p.c.

const MIDL_SERVER_INFO IBrowserHost_ServerInfo
Initial value:

    {
    &Object_StubDesc,
    0,
    __MIDL_ProcFormatString.Format,
    &IBrowserHost_FormatStringOffsetTable[-3],
    0,
    0,
    0,
    0
    }

Definition at line 83 of file EdHost_p.c.

static const MIDL_SERVER_INFO IGrid_ServerInfo
Initial value:

    {
    &Object_StubDesc,
    0,
    __MIDL_ProcFormatString.Format,
    &IGrid_FormatStringOffsetTable[-3],
    0,
    0,
    0,
    0
    }

Definition at line 159 of file EdHost_p.c.

const MIDL_SERVER_INFO ISnap_ServerInfo
Initial value:

    {
    &Object_StubDesc,
    0,
    __MIDL_ProcFormatString.Format,
    &ISnap_FormatStringOffsetTable[-3],
    0,
    0,
    0,
    0
    }

Definition at line 249 of file EdHost_p.c.

const MIDL_STUB_DESC Object_StubDesc
Initial value:

    {
    0,
    NdrOleAllocate,
    NdrOleFree,
    0,
    0,
    0,
    0,
    0,
    __MIDL_TypeFormatString.Format,
    1,
    0x20000,
    0,
    0x50100a4,
    0,
    0,
    0,
    1,
    0,
    0,
    0
    }

Definition at line 147 of file EdHost_p.c.

Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EditHost/Grid.cpp File Reference

  • Web
  • Browser
  • EditHost

Grid.cpp File Reference

#include "stdafx.h"
#include "EdHost.h"
#include "Grid.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EditHost/Grid.h File Reference

  • Web
  • Browser
  • EditHost
Classes

Grid.h File Reference

#include "resource.h"
#include "mshtml.h"
#include "atlctl.h"

Go to the source code of this file.

Classes

class CGrid
Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EditHost/resource.h File Reference

  • Web
  • Browser
  • EditHost
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | ID_BUTTON1 32768
#define | ID_BUTTON2 32769
#define | ID_BUTTON3 32770
#define | ID_BUTTON4 32776
#define | ID_BUTTON5 32778
#define | ID_SNAPINCBOX 32780
#define | ID_TOOLBARWND 32772
#define | ID_URLBOX 32774
#define | IDR_BROWSERHOST 101
#define | IDR_EdHost 100
#define | IDR_GRID 250
#define | IDR_SNAP 249
#define | IDR_TOOLBAR1 201
#define | IDS_PROJNAME 100

Define Documentation

#define ID_BUTTON1 32768

Definition at line 15 of file resource.h.

#define ID_BUTTON2 32769

Definition at line 16 of file resource.h.

#define ID_BUTTON3 32770

Definition at line 17 of file resource.h.

#define ID_BUTTON4 32776

Definition at line 20 of file resource.h.

#define ID_BUTTON5 32778

Definition at line 21 of file resource.h.

#define ID_SNAPINCBOX 32780

Definition at line 22 of file resource.h.

#define ID_TOOLBARWND 32772

Definition at line 18 of file resource.h.

#define ID_URLBOX 32774

Definition at line 19 of file resource.h.

#define IDR_BROWSERHOST 101

Definition at line 11 of file resource.h.

#define IDR_EdHost 100

Definition at line 10 of file resource.h.

#define IDR_GRID 250

Definition at line 14 of file resource.h.

#define IDR_SNAP 249

Definition at line 13 of file resource.h.

#define IDR_TOOLBAR1 201

Definition at line 12 of file resource.h.

#define IDS_PROJNAME 100

Definition at line 9 of file resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EditHost/Snap.cpp File Reference

  • Web
  • Browser
  • EditHost

Snap.cpp File Reference

#include "stdafx.h"
#include "EdHost.h"
#include "Snap.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EditHost/Snap.h File Reference

  • Web
  • Browser
  • EditHost
Classes

Snap.h File Reference

#include "resource.h"
#include "mshtml.h"

Go to the source code of this file.

Classes

class CSnap
Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EditHost/StdAfx.cpp File Reference

  • Web
  • Browser
  • EditHost

StdAfx.cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/EditHost/StdAfx.h File Reference

  • Web
  • Browser
  • EditHost
Classes | Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Classes

class | CExeModule

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0400
#define | STRICT

Variables

CExeModule _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 20 of file StdAfx.h.

#define _WIN32_WINNT 0x0400

Definition at line 18 of file StdAfx.h.

#define STRICT

Definition at line 16 of file StdAfx.h.

Variable Documentation

CExeModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/RenderBehave/renderproject/Behavior.cpp File Reference

  • Web
  • Browser
  • RenderBehave
  • renderproject

Behavior.cpp File Reference

#include "stdafx.h"
#include "Render.h"
#include "EventSink.h"
#include "Behavior.h"
#include "math.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/RenderBehave/renderproject/Behavior.h File Reference

  • Web
  • Browser
  • RenderBehave
  • renderproject
Classes | Defines

Behavior.h File Reference

#include "resource.h"
#include "EventSink.h"

Go to the source code of this file.

Classes

class | CBehavior

Defines

#define | HANDLE_RADIUS 10

Define Documentation

#define HANDLE_RADIUS 10

Definition at line 13 of file Behavior.h.

Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/RenderBehave/renderproject/Dlldata.c File Reference

  • Web
  • Browser
  • RenderBehave
  • renderproject
Defines | Functions

Dlldata.c File Reference

#include <rpcproxy.h>

Go to the source code of this file.

Defines

#define | PROXY_DELEGATION

Functions

PROXYFILE_LIST_START | REFERENCE_PROXY_FILE (Render)

Define Documentation

#define PROXY_DELEGATION

Definition at line 18 of file Dlldata.c.

Function Documentation

PROXYFILE_LIST_START REFERENCE_PROXY_FILE ( Render )
Generated on Wed Nov 13 2024 16:53:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/RenderBehave/renderproject/EventSink.cpp File Reference

  • Web
  • Browser
  • RenderBehave
  • renderproject

EventSink.cpp File Reference

#include "stdafx.h"
#include "Render.h"
#include "Behavior.h"
#include "EventSink.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/RenderBehave/renderproject/EventSink.h File Reference

  • Web
  • Browser
  • RenderBehave
  • renderproject
Classes

EventSink.h File Reference

#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Classes

class CEventSink
Generated on Wed Nov 13 2024 16:54:47 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/RenderBehave/renderproject/Factory.cpp File Reference

  • Web
  • Browser
  • RenderBehave
  • renderproject

Factory.cpp File Reference

#include "stdafx.h"
#include "Render.h"
#include "Factory.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/RenderBehave/renderproject/Factory.h File Reference

  • Web
  • Browser
  • RenderBehave
  • renderproject
Classes

Factory.h File Reference

#include "resource.h"
#include "behavior.h"

Go to the source code of this file.

Classes

class CFactory
Generated on Wed Nov 13 2024 16:53:18 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/RenderBehave/renderproject/Render.cpp File Reference

  • Web
  • Browser
  • RenderBehave
  • renderproject
Functions | Variables

Render.cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include "Render.h"
#include "Render_i.c"
#include "Factory.h"
#include "Behavior.h"
#include "EventSink.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 49 of file Render.cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 57 of file Render.cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 34 of file Render.cpp.

{
  if (dwReason == DLL_PROCESS_ATTACH)
  {
    _Module.Init(ObjectMap, hInstance);
    DisableThreadLibraryCalls(hInstance);
  }
  else if (dwReason == DLL_PROCESS_DETACH)
    _Module.Term();
  return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 65 of file Render.cpp.

{
  // Registers object, typelib and all interfaces in typelib
  return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 74 of file Render.cpp.

{
  _Module.UnregisterServer();
  return S_OK;
}

Variable Documentation

CComModule _Module

Definition at line 22 of file Render.cpp.

Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/RenderBehave/renderproject/Render.idl File Reference

  • Web
  • Browser
  • RenderBehave
  • renderproject
Classes | Namespaces | Functions

Render.idl File Reference

Go to the source code of this file.

Classes

interface | IBehavior
interface | IEventSink
interface | IFactory
class | RENDERLib::Behavior
class | RENDERLib::EventSink
class | RENDERLib::Factory

Namespaces

namespace | RENDERLib

Functions

RENDERLib::importlib ("stdole32.tlb")
RENDERLib::importlib ("stdole2.tlb")
Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/RenderBehave/renderproject/Render_p.c File Reference

  • Web
  • Browser
  • RenderBehave
  • renderproject
Classes | Defines | Typedefs | Functions | Variables

Render_p.c File Reference

#include "rpcproxy.h"
#include "Render.h"

Go to the source code of this file.

Classes

struct | _MIDL_PROC_FORMAT_STRING
struct | _MIDL_TYPE_FORMAT_STRING

Defines

#define | __REQUIRED_RPCPROXY_H_VERSION__ 440
#define | _Render_CHECK_IID(n) IID_GENERIC_CHECK_IID( _Render, pIID, n)
#define | PROC_FORMAT_STRING_SIZE 1
#define | TYPE_FORMAT_STRING_SIZE 3
#define | USE_STUBLESS_PROXY

Typedefs

typedef struct
_MIDL_PROC_FORMAT_STRING 		MIDL_PROC_FORMAT_STRING
typedef struct
_MIDL_TYPE_FORMAT_STRING 		MIDL_TYPE_FORMAT_STRING

Functions

int __stdcall | _Render_IID_Lookup (const IID *pIID, int *pIndex)
CINTERFACE_PROXY_VTABLE (3)
CINTERFACE_PROXY_VTABLE (7)

Variables

const MIDL_PROC_FORMAT_STRING | __MIDL_ProcFormatString
const MIDL_TYPE_FORMAT_STRING | __MIDL_TypeFormatString
CInterfaceStubVtbl | _IBehaviorStubVtbl
CInterfaceStubVtbl | _IEventSinkStubVtbl
const CInterfaceStubVtbl | _IFactoryStubVtbl
const IID * | _Render_BaseIIDList []
PCInterfaceName const | _Render_InterfaceNamesList []
const CInterfaceProxyVtbl * | _Render_ProxyVtblList []
const CInterfaceStubVtbl * | _Render_StubVtblList []
const MIDL_STUB_DESC | Object_StubDesc
const ExtendedProxyFileInfo | Render_ProxyFileInfo

Define Documentation

#define __REQUIRED_RPCPROXY_H_VERSION__ 440

Definition at line 22 of file Render_p.c.

#define _Render_CHECK_IID ( n ) IID_GENERIC_CHECK_IID( _Render, pIID, n)

Definition at line 259 of file Render_p.c.

#define PROC_FORMAT_STRING_SIZE 1

Definition at line 35 of file Render_p.c.

#define TYPE_FORMAT_STRING_SIZE 3

Definition at line 34 of file Render_p.c.

#define USE_STUBLESS_PROXY

Definition at line 17 of file Render_p.c.

Typedef Documentation

typedef struct _MIDL_PROC_FORMAT_STRING MIDL_PROC_FORMAT_STRING
typedef struct _MIDL_TYPE_FORMAT_STRING MIDL_TYPE_FORMAT_STRING

Function Documentation

int __stdcall _Render_IID_Lookup | ( | const IID * | pIID,
 |  | int * | pIndex
 | ) |  |

Definition at line 261 of file Render_p.c.

{
    IID_BS_LOOKUP_SETUP

    IID_BS_LOOKUP_INITIAL_TEST( _Render, 3, 2 )
    IID_BS_LOOKUP_NEXT_TEST( _Render, 1 )
    IID_BS_LOOKUP_RETURN_RESULT( _Render, 3, *pIndex )

}

CINTERFACE_PROXY_VTABLE ( 3 )

Definition at line 66 of file Render_p.c.

{
    0,
    &IID_IFactory,
    IUnknown_QueryInterface_Proxy,
    IUnknown_AddRef_Proxy,
    IUnknown_Release_Proxy
};

CINTERFACE_PROXY_VTABLE ( 7 )

Definition at line 162 of file Render_p.c.

{
    0,
    &IID_IEventSink,
    IUnknown_QueryInterface_Proxy,
    IUnknown_AddRef_Proxy,
    IUnknown_Release_Proxy ,
    0 /* (void *)-1 /* IDispatch::GetTypeInfoCount */ ,
    0 /* (void *)-1 /* IDispatch::GetTypeInfo */ ,
    0 /* (void *)-1 /* IDispatch::GetIDsOfNames */ ,
    0 /* IDispatch_Invoke_Proxy */
};

Variable Documentation

const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString
Initial value:
    {
        0,
        {

      0x0
        }
    }

Definition at line 207 of file Render_p.c.

const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString
Initial value:
    {
        0,
        {
      NdrFcShort( 0x0 ),

      0x0
        }
    }

Definition at line 216 of file Render_p.c.

CInterfaceStubVtbl _IBehaviorStubVtbl
Initial value:
{
    &IID_IBehavior,
    0,
    7,
    &IBehavior_table[-3],
    CStdStubBuffer_DELEGATING_METHODS
}

Definition at line 119 of file Render_p.c.

CInterfaceStubVtbl _IEventSinkStubVtbl
Initial value:
{
    &IID_IEventSink,
    0,
    7,
    &IEventSink_table[-3],
    CStdStubBuffer_DELEGATING_METHODS
}

Definition at line 184 of file Render_p.c.

const CInterfaceStubVtbl _IFactoryStubVtbl
Initial value:
{
    &IID_IFactory,
    0,
    3,
    0,
    CStdStubBuffer_METHODS
}

Definition at line 75 of file Render_p.c.

const IID* _Render_BaseIIDList[]
Initial value:

{
    0,
    &IID_IDispatch,
    &IID_IDispatch,
    0
}

Definition at line 250 of file Render_p.c.

PCInterfaceName const _Render_InterfaceNamesList[]
Initial value:

{
    "IFactory",
    "IBehavior",
    "IEventSink",
    0
}

Definition at line 242 of file Render_p.c.

const CInterfaceProxyVtbl* _Render_ProxyVtblList[]
Initial value:

{
    ( CInterfaceProxyVtbl *) &_IFactoryProxyVtbl,
    ( CInterfaceProxyVtbl *) &_IBehaviorProxyVtbl,
    ( CInterfaceProxyVtbl *) &_IEventSinkProxyVtbl,
    0
}

Definition at line 226 of file Render_p.c.

const CInterfaceStubVtbl* _Render_StubVtblList[]
Initial value:

{
    ( CInterfaceStubVtbl *) &_IFactoryStubVtbl,
    ( CInterfaceStubVtbl *) &_IBehaviorStubVtbl,
    ( CInterfaceStubVtbl *) &_IEventSinkStubVtbl,
    0
}

Definition at line 234 of file Render_p.c.

const MIDL_STUB_DESC Object_StubDesc
Initial value:

    {
    0,
    NdrOleAllocate,
    NdrOleFree,
    0,
    0,
    0,
    0,
    0,
    __MIDL_TypeFormatString.Format,
    1,
    0x20000,
    0,
    0x50100a4,
    0,
    0,
    0,
    1,
    0,
    0,
    0
    }

Definition at line 93 of file Render_p.c.

const ExtendedProxyFileInfo Render_ProxyFileInfo
Initial value:

{
    (PCInterfaceProxyVtblList *) & _Render_ProxyVtblList,
    (PCInterfaceStubVtblList *) & _Render_StubVtblList,
    (const PCInterfaceName * ) & _Render_InterfaceNamesList,
    (const IID ** ) & _Render_BaseIIDList,
    & _Render_IID_Lookup,
    3,
    2,
    0,
    0,
    0,
    0
}

Definition at line 271 of file Render_p.c.

Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/RenderBehave/renderproject/Resource.h File Reference

  • Web
  • Browser
  • RenderBehave
  • renderproject
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_BEHAVIOR 102
#define | IDR_EVENTSINK 103
#define | IDR_FACTORY 101
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_BEHAVIOR 102

Definition at line 11 of file Resource.h.

#define IDR_EVENTSINK 103

Definition at line 12 of file Resource.h.

#define IDR_FACTORY 101

Definition at line 10 of file Resource.h.

#define IDS_PROJNAME 100

Definition at line 9 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/RenderBehave/renderproject/Stdafx.cpp File Reference

  • Web
  • Browser
  • RenderBehave
  • renderproject

Stdafx.cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/Browser/RenderBehave/renderproject/Stdafx.h File Reference

  • Web
  • Browser
  • RenderBehave
  • renderproject
Defines | Variables

Stdafx.h File Reference

#include <atlbase.h>
#include <atlcom.h>
#include <atlctl.h>
#include <mshtmdid.h>
#include <mshtmhst.h>
#include <mshtml.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0400
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 20 of file Stdafx.h.

#define _WIN32_WINNT 0x0400

Definition at line 19 of file Stdafx.h.

#define STRICT

Definition at line 16 of file Stdafx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/dxtrans/dxsurf1/dxsurf1.cpp File Reference

  • Web
  • dxtrans
  • dxsurf1
Defines | Functions | Variables

dxsurf1.cpp File Reference

#include <windows.h>
#include <initguid.h>
#include <stdio.h>
#include <stdarg.h>
#include <dxtrans.h>
#include <dxtguid.c>
#include <dxterror.h>
#include <dxbounds.h>
#include "resource.h"

Go to the source code of this file.

Defines

#define | NAME "DXSurf1"
#define | SAFE_RELEASE(ptr)
#define | TITLE "DXSurface Example 1"

Functions

HRESULT | InitFail (HWND hWnd, HRESULT hr, LPCTSTR szError,...)
BOOL | OnFileOpen (HWND hWnd, LPSTR szName)
void | RestoreLostSurfaces (HWND hWnd)
int WINAPI | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
LRESULT CALLBACK | WndProc (HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)

Variables

BOOL | g_bActive = FALSE
IDXSurface * | g_pDXImageSurf = NULL
IDXSurface * | g_pPrimaryDXSurf = NULL
IDXSurfaceFactory * | g_pSurfFact = NULL

Define Documentation

#define NAME "DXSurf1"

Definition at line 26 of file dxsurf1.cpp.

#define SAFE_RELEASE ( ptr )
Value:
{                                   \
        if (ptr) ptr->Release();    \
        ptr=NULL;                   \
}

Definition at line 28 of file dxsurf1.cpp.

#define TITLE "DXSurface Example 1"

Definition at line 27 of file dxsurf1.cpp.

Function Documentation

HRESULT InitFail | ( | HWND | hWnd,
 |  | HRESULT | hr,
 |  | LPCTSTR | szError,
 |  |  | ...
 | ) |  |

Definition at line 56 of file dxsurf1.cpp.

{
    char                        szBuff[128];
    va_list                     vl;

    g_bActive = FALSE;
    va_start( vl, szError );
    vsprintf( szBuff, szError, vl );
    ReleaseAllObjects();
    MessageBox( hWnd, szBuff, TITLE, MB_OK );
    DestroyWindow( hWnd );
    va_end( vl );
    return hr;
}

BOOL OnFileOpen | ( | HWND | hWnd,
 |  | LPSTR | szName
 | ) |  |

Definition at line 76 of file dxsurf1.cpp.

{
    OPENFILENAME    ofn;

    // Initialize the OPENFILENAME structure.
    memset( &ofn, 0, sizeof( OPENFILENAME ) );
    ofn.lStructSize      = sizeof( OPENFILENAME );
    ofn.hwndOwner        = hWnd;
    ofn.lpstrFilter      = "Image files (*.png;*.jpg;*.bmp)\0*.png;*.jpg;*.bmp\0All files {*.*}\0*.*\0\0";
    ofn.lpstrFile        = szName;
    ofn.lpstrInitialDir  = "c:\\dxmedia\\samples\\multimedia\\media\\image";
    ofn.nMaxFile         = 256;
    ofn.Flags            = OFN_FILEMUSTEXIST;
    ofn.lpstrDefExt      = "png";

    // Create the open file dialog.
    return GetOpenFileName( &ofn );
}

void RestoreLostSurfaces ( HWND hWnd )

Definition at line 104 of file dxsurf1.cpp.

{
    HRESULT                 hr;
    IDirectDrawSurface2*    pUnderlyingPrimaryDDSurf    = NULL;

    // Get the underlying DirectDraw surface for the Primary DXSurface.
    hr = g_pPrimaryDXSurf->GetDirectDrawSurface( IID_IDirectDrawSurface,
                                            (void**)&pUnderlyingPrimaryDDSurf );
    if( SUCCEEDED( hr ) )
    {
        // Restore any potentially lost contents from window swapping.
        if( pUnderlyingPrimaryDDSurf->IsLost() == DDERR_SURFACELOST )
        {
            hr = pUnderlyingPrimaryDDSurf->Restore();
        }

        // Release the Direct Draw Surface.
        pUnderlyingPrimaryDDSurf->Release();
    }

    if ( FAILED( hr ) )
        InitFail( hWnd, hr, "RestoreLostSurfaces() failed" );
}

int WINAPI WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | PSTR | szCmdLine,
 |  | int | iCmdShow
 | ) |  |

Definition at line 340 of file dxsurf1.cpp.

{
    MSG         msg;

    // Initialize the COM library.
    CoInitialize( NULL );

    if ( InitApp( hInstance, iCmdShow ) != S_OK )
    {
        ReleaseAllObjects();
        return FALSE;
    }

    while( GetMessage ( &msg, NULL, 0, 0 ) )
    {
        TranslateMessage( &msg );
        DispatchMessage( &msg );
    }

    // Uninitialize the COM library.
    CoUninitialize();

    return msg.wParam;
}

LRESULT CALLBACK WndProc | ( | HWND | hWnd,
 |  | UINT | iMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 132 of file dxsurf1.cpp.

{
    HRESULT         hr = S_OK;
    HDC             hdcWnd;
    PAINTSTRUCT     ps;
    RECT            rect;
    POINT           point;
    char            szError[256] = "";
    char            szFileName[256] = "";
    WCHAR           szWFileName[256];

    switch( iMsg )
    {
    case WM_PAINT:
        hdcWnd = BeginPaint( hWnd, &ps );

        GetClientRect( hWnd, &rect );
        SetBkMode( hdcWnd, TRANSPARENT );

        // Render the DXSurface.
        if( g_bActive )
        {
            point.x = rect.top;
            point.y = rect.left;
            ClientToScreen(hWnd, &point);

            // Initialize the placement vector for the BitBlt with the top left corner
            // coordinates of the window.
            CDXDVec   vPlacement( point.x, point.y, 0, 0 );

            // Set the portion of the primary surface that we want to BitBlt to to be
            // the size of the window.
            CDXDBnds  PortionBnds( rect.right, rect.bottom );

            // Use IDXSurfaceFactory::BitBlt to blit the eagle (g_pDXImageSurf) to the Primary
            // Surface (g_pPrimaryDXSurf).
            hr = g_pSurfFact->BitBlt( g_pPrimaryDXSurf, &vPlacement, g_pDXImageSurf,
                                                &PortionBnds, DXBOF_DO_OVER );
            if ( FAILED( hr ) )
                return InitFail( hWnd, hr, "BitBlt failed" );

            DrawText( hdcWnd, "DXSurface Sample 1. Demonstrates DXSurface BitBlt to a "
                      "Primary Surface.", -1, &rect,
                      DT_CENTER | DT_BOTTOM | DT_SINGLELINE );
        }
        else
        {
            DrawText( hdcWnd, "DXSurface Sample 1. Please open an image file.", -1, &rect,
                      DT_CENTER | DT_BOTTOM | DT_SINGLELINE );
        }

        EndPaint( hWnd, &ps );
        break;

    case WM_ACTIVATE:
        {
            if( g_bActive )
            {
                // If someone switches between windows using Alt-Tab the contents of the
                // underlying DDraw Surfaces may get lost. This function restores them.
                RestoreLostSurfaces( hWnd );
            }
            break;
        }

    case WM_COMMAND :
        switch( LOWORD( wParam ) )
        {
            case IDM_OPEN:
                // Check if the open file dialog succeed.
                if( OnFileOpen( hWnd, szFileName ) )
                {
                    // Convert the szFileName string to a Unicode string.
                    mbstowcs( szWFileName, szFileName, 256 );

                    // Release any previous image surfaces.
                    SAFE_RELEASE( g_pDXImageSurf );

                    // Call load image which creates a DXSurface with an image on it.
                    hr = g_pSurfFact->LoadImage( szWFileName, NULL, NULL,
                                    &DDPF_PMARGB32, IID_IDXSurface, (void**)&g_pDXImageSurf );
                    if( FAILED( hr ) )
                    {
                        if( hr == DXTERR_REQ_IE_DLLNOTFOUND ) // Possibly need IE4.0 or greater.
                        {
                            return InitFail( hWnd, hr, "LoadImage failed!\n"
                                "Possible cause is that IE4.0 or greater is not installed.");
                        }
                        else
                        {
                            // Note - some possible errors may include:
                            // MK_E_SYNTAX - Couldn't find the image directory
                            // INET_E_RESOURCE_NOT_FOUND - Couldn't find the image filename
                            sprintf( szError, "LoadImage failed with error code 0x%X.", hr );
                            return InitFail( hWnd, hr, szError );
                        }
                    }

                    // Let the app know that its now active and from here on when it processes
                    // WM_PAINT messages it can Blit. Prior to this we don't want to call
                    // BitBlt in WM_PAINT.
                    g_bActive = TRUE;

                    // Force a WM_PAINT message.
                    InvalidateRect( NULL, NULL, TRUE );
                }
                break;

            case IDM_EXIT:
                SendMessage( hWnd, WM_DESTROY, 0, 0 );
                break;

            case IDM_ABOUT:
                MessageBox( hWnd, "DXSurface Sample 1.\nDemonstrates DXSurface BitBlt to a "
                          "Primary Surface.\n\nCopyright © 2001 Microsoft® Corporation",
                          "About", MB_OK );
                break;
        }
        break;

    case WM_DESTROY:
        ReleaseAllObjects();
        PostQuitMessage( 0 );
        break;
    }

    return DefWindowProc( hWnd, iMsg, wParam, lParam );
}

Variable Documentation

BOOL g_bActive = FALSE

Definition at line 39 of file dxsurf1.cpp.

IDXSurface* g_pDXImageSurf = NULL

Definition at line 37 of file dxsurf1.cpp.

IDXSurface* g_pPrimaryDXSurf = NULL

Definition at line 38 of file dxsurf1.cpp.

IDXSurfaceFactory* g_pSurfFact = NULL

Definition at line 36 of file dxsurf1.cpp.

Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/dxtrans/dxsurf1/resource.h File Reference

  • Web
  • dxtrans
  • dxsurf1
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDI_DXTICON 101
#define | IDM_ABOUT 40001
#define | IDM_EXIT 40003
#define | IDM_OPEN 40002
#define | IDR_MENU1 102

Define Documentation

#define IDI_DXTICON 101

Definition at line 5 of file resource.h.

#define IDM_ABOUT 40001

Definition at line 7 of file resource.h.

#define IDM_EXIT 40003

Definition at line 9 of file resource.h.

#define IDM_OPEN 40002

Definition at line 8 of file resource.h.

#define IDR_MENU1 102

Definition at line 6 of file resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/dxtrans/dxsurf2/dxsurf2.cpp File Reference

  • Web
  • dxtrans
  • dxsurf2
Defines | Functions | Variables

dxsurf2.cpp File Reference

#include <windows.h>
#include <stdio.h>
#include <stdarg.h>
#include <initguid.h>
#include <dxtrans.h>
#include <dxbounds.h>
#include <dxtguid.c>
#include <dxterror.h>
#include "resource.h"
#include <strsafe.h>

Go to the source code of this file.

Defines

#define | NAME "DXSurf2"
#define | SAFE_RELEASE(ptr)
#define | TIMER_ID 1
#define | TITLE "DXSurface Example 2"

Functions

HRESULT | InitFail (HWND hWnd, HRESULT hr, LPCTSTR szError,...)
HRESULT | ModifySurface ()
HRESULT | RenderToWindow (HANDLE hWnd, HDC hdcWnd, float fOpacity)
int WINAPI | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
LRESULT CALLBACK | WndProc (HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)

Variables

BOOL | g_bActive = FALSE
BOOL | g_bBrighten = TRUE
CDXDBnds | g_bnds
float | g_fOpacity = .5
HINSTANCE | g_hInst = NULL
IDXSurface * | g_pDXOutSurf = NULL
IDXSurface * | g_pDXSurf1 = NULL
IDXSurface * | g_pDXSurf2 = NULL
IDXSurface * | g_pDXSurfOnSurfMod = NULL
IDXSurfaceFactory * | g_pSurfFact = NULL
IDXSurfaceModifier * | g_pSurfMod = NULL

Define Documentation

#define NAME "DXSurf2"

Definition at line 29 of file dxsurf2.cpp.

#define SAFE_RELEASE ( ptr )
Value:
{                                   \
        if (ptr) ptr->Release();    \
        ptr=NULL;                   \
}

Definition at line 31 of file dxsurf2.cpp.

#define TIMER_ID 1

Definition at line 40 of file dxsurf2.cpp.

#define TITLE "DXSurface Example 2"

Definition at line 30 of file dxsurf2.cpp.

Function Documentation

HRESULT InitFail | ( | HWND | hWnd,
 |  | HRESULT | hr,
 |  | LPCTSTR | szError,
 |  |  | ...
 | ) |  |

Definition at line 76 of file dxsurf2.cpp.

{
    char                    szBuff[128];
    va_list                 vl;

    g_bActive = FALSE;
    va_start( vl, szError );
    // Use strsafe.h version of vsprintf.
    StringCchVPrintf( szBuff, 128, szError, vl );
    MessageBox( hWnd, szBuff, TITLE, MB_OK );
    ReleaseAllObjects();
    DestroyWindow( hWnd );
    va_end( vl );
    return hr;
}

HRESULT ModifySurface ( )

Definition at line 97 of file dxsurf2.cpp.

{
    HRESULT                 hr;

    // Create the Surface Modifier object.
    hr = CoCreateInstance( CLSID_DXSurfaceModifier, NULL, CLSCTX_INPROC,
                                 IID_IDXSurfaceModifier, (void **)&g_pSurfMod );

    // Set the foreground to the parrot.png.
    if( SUCCEEDED( hr ) )
    {
        hr = g_pSurfMod->SetForeground( g_pDXSurf2, FALSE, NULL );
    }

    // Set the background to tulipshol2.jpg.
    if( SUCCEEDED( hr ) )
    {
        hr = g_pSurfMod->SetBackground( g_pDXSurf1 );
    }

    // Query the Surface Modifier for an IDXSurface pointer.
    if( SUCCEEDED( hr ) )
    {
        hr = g_pSurfMod->QueryInterface( IID_IDXSurface, (void**)&g_pDXSurfOnSurfMod );
    }

    return hr;
}

HRESULT RenderToWindow | ( | HANDLE | hWnd,
 |  | HDC | hdcWnd,
 |  | float | fOpacity
 | ) |  |

Definition at line 130 of file dxsurf2.cpp.

{
    HRESULT                 hr;
    char                    szOpacity[256];
    CDXDBnds                bnds;
    IDXDCLock*              pDCLock = NULL;
    RECT                    rect;
    HDC                     hdcSurf = NULL;

    // This call sets the new Opacity on the foreground surface.
    hr =  g_pSurfMod->SetOpacity( fOpacity );
    if ( FAILED( hr ) )
        return InitFail((HWND)hWnd, hr, "Failed to SetOpacity on Surface Modifier.");

    // Blit the DXSurface on associated with the Surface Modifier to the Output DXSurface.
    hr = g_pSurfFact->BitBlt( g_pDXOutSurf, NULL, g_pDXSurfOnSurfMod, NULL, DXBOF_DO_OVER );
    if ( FAILED( hr ) )
        return InitFail( (HWND)hWnd, hr, "BitBlt failed" );

    // Call LockSurfaceDC to get the DC of the surface.
    hr  = g_pDXOutSurf->LockSurfaceDC( NULL, 3000, 0, &pDCLock );
    if ( FAILED( hr ) )
        return InitFail( (HWND)hWnd, hr, "LockSurfaceDC failed." );

    hdcSurf = pDCLock->GetDC();

    GetClientRect( (HWND)hWnd, &rect );

    // Use GDI BitBlt to blit the surface DC to the window DC.
    BitBlt( hdcWnd, 0, 0, rect.right, rect.bottom, hdcSurf, 0, 0, SRCCOPY );

    // Use strsafe.h version of sprintf.
    StringCchPrintf( szOpacity, 256, "Parrot alpha blended with %d%% opacity over tulips.",
                    (int)((g_fOpacity*100)+.01) );
    SetTextColor( hdcWnd, RGB(255, 255, 0) );
    SetBkMode( hdcWnd, TRANSPARENT );
    DrawText( hdcWnd, szOpacity, -1, &rect, DT_CENTER | DT_BOTTOM | DT_SINGLELINE );

    // Release the IDXDCLock pointer which releases the DC lock on the surface as well.
    SAFE_RELEASE( pDCLock )

    return hr;
}

int WINAPI WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | PSTR | szCmdLine,
 |  | int | iCmdShow
 | ) |  |

Definition at line 389 of file dxsurf2.cpp.

{
    MSG         msg;
    HRESULT     hr;

    // Initialize the COM library.
    hr = CoInitialize( NULL );
    if( FAILED ( hr ) )
    {
        return FALSE;
    }

    if ( InitApp(hInstance, iCmdShow) != S_OK )
    {
        ReleaseAllObjects();
        return FALSE;
    }

    while( GetMessage ( &msg, NULL, 0, 0 ) )
    {
        TranslateMessage( &msg );
        DispatchMessage( &msg );
    }

    // Uninitialize the COM library.
    CoUninitialize();

    return msg.wParam;
}

LRESULT CALLBACK WndProc | ( | HWND | hWnd,
 |  | UINT | iMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 178 of file dxsurf2.cpp.

{
    HRESULT         hr = S_OK;
    RECT            rect;
    HDC             hdcWnd;
    PAINTSTRUCT     ps;

    switch( iMsg )
    {
    case WM_PAINT:
        hdcWnd = BeginPaint( hWnd, &ps );

        // Render the DXSurface to the window.
        if( g_bActive )
        {
            RenderToWindow( hWnd, hdcWnd, g_fOpacity );
        }

        EndPaint( hWnd, &ps );
        return 0;

    case WM_TIMER:
            // Change opacity.
            if ( g_bActive && TIMER_ID == wParam )
            {
                if ( g_bBrighten )
                {
                    g_fOpacity += .05f;
                    if( g_fOpacity > 1 )
                    {
                        g_fOpacity = 1;
                        g_bBrighten = FALSE;
                    }
                }
                else
                {
                    g_fOpacity -= .05f;
                    if( g_fOpacity < 0 )
                    {
                        g_fOpacity = 0;
                        g_bBrighten = TRUE;
                    }
                }

                GetClientRect( hWnd, &rect );
                InvalidateRect( hWnd, &rect, FALSE );
            }
            return 0;

    case WM_SIZE:
        if( g_bActive )
        {
            // Get the boundaries of the window.
            GetClientRect( hWnd, &rect );
            g_bnds.SetXYSize( rect.right, rect.bottom );

            // Release the existing output DXSurface and create a new one.
            SAFE_RELEASE( g_pDXOutSurf )
            hr = g_pSurfFact->CreateSurface( NULL, NULL, NULL, &g_bnds, 0,
                                NULL, IID_IDXSurface, (void **)&g_pDXOutSurf );
        }
        return 0;

    case WM_DESTROY:
        ReleaseAllObjects();
        PostQuitMessage(0);
        return 0;
    }

    return DefWindowProc( hWnd, iMsg, wParam, lParam );
}

Variable Documentation

BOOL g_bActive = FALSE

Definition at line 52 of file dxsurf2.cpp.

BOOL g_bBrighten = TRUE

Definition at line 53 of file dxsurf2.cpp.

CDXDBnds g_bnds

Definition at line 49 of file dxsurf2.cpp.

float g_fOpacity = .5

Definition at line 54 of file dxsurf2.cpp.

HINSTANCE g_hInst = NULL

Definition at line 55 of file dxsurf2.cpp.

IDXSurface* g_pDXOutSurf = NULL

Definition at line 48 of file dxsurf2.cpp.

IDXSurface* g_pDXSurf1 = NULL

Definition at line 46 of file dxsurf2.cpp.

IDXSurface* g_pDXSurf2 = NULL

Definition at line 47 of file dxsurf2.cpp.

IDXSurface* g_pDXSurfOnSurfMod = NULL

Definition at line 50 of file dxsurf2.cpp.

IDXSurfaceFactory* g_pSurfFact = NULL

Definition at line 45 of file dxsurf2.cpp.

IDXSurfaceModifier* g_pSurfMod = NULL

Definition at line 51 of file dxsurf2.cpp.

Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/dxtrans/dxsurf2/resource.h File Reference

  • Web
  • dxtrans
  • dxsurf2
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define IDI_DXTICON 101

Define Documentation

#define IDI_DXTICON 101

Definition at line 5 of file resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/dxtrans/dxsurf3/dxsurf3.cpp File Reference

  • Web
  • dxtrans
  • dxsurf3
Classes | Defines | Functions

dxsurf3.cpp File Reference

#include <atlbase.h>
#include <windows.h>
#include <DXTrans.h>
#include <DXTGuid.c>
#include <DXBounds.h>
#include <DXHelper.h>
#include <DXTError.h>
#include <stdlib.h>
#include <time.h>
#include <assert.h>
#include <string.h>
#include <mmsystem.h>
#include <stdio.h>
#include "resource.h"

Go to the source code of this file.

Classes

struct | WININFO

Defines

#define | NUMPIXELSTODRAW 100
#define | SAFE_RELEASE(ptr) if(ptr) { ptr->Release(); ptr = NULL; }
#define | STRICT

Functions

int | FindNumWithParameter (PTSTR)
int | FindParameter (PTSTR)
void | GetImageDirectoryAndFileName (PWSTR, PCWSTR)
BOOL | InitInstance (WININFO *, PTSTR)
BOOL | ParseCommandLine (WININFO *, PTSTR)
int WINAPI | WinMain (HINSTANCE hInstance, HINSTANCE, PTSTR pszCmdLine, int)
LRESULT CALLBACK | WndProc (HWND, UINT, WPARAM, LPARAM)

Define Documentation

#define NUMPIXELSTODRAW 100

Definition at line 46 of file dxsurf3.cpp.

#define SAFE_RELEASE ( ptr ) if(ptr) { ptr->Release(); ptr = NULL; }

Definition at line 45 of file dxsurf3.cpp.

#define STRICT

Definition at line 29 of file dxsurf3.cpp.

Function Documentation

int FindNumWithParameter ( PTSTR strParam )

Definition at line 556 of file dxsurf3.cpp.

{
    // TODO: Check that argv[i+1] is not past end of string AND that it
    // is a positive string of numbers.
    for(int i=0; i<__argc; i++)
    {
        if(lstrcmpi(strParam, __argv[i]) == 0)
            if(i+1 < __argc)
                return atoi(__argv[i+1]);
            else // We're at the end of the command line string.
                break;
    }

    return -1;
}

int FindParameter ( PTSTR strParam )

Definition at line 577 of file dxsurf3.cpp.

{
    for(int i=0; i<__argc; i++)
    {
        if(lstrcmpi(strParam, __argv[i]) == 0)
            return 1;
    }

    return -1;
}

void GetImageDirectoryAndFileName | ( | PWSTR | ,
 |  | PCWSTR |
 | ) |  |
BOOL InitInstance | ( | WININFO * | pwi,
 |  | PTSTR | strClassName
 | ) |  |

Definition at line 516 of file dxsurf3.cpp.

{
    BOOL        bRet = FALSE;
    DEVMODE     devmode;
    WNDCLASSEX  wcex = { sizeof(WNDCLASSEX), CS_HREDRAW | CS_VREDRAW, WndProc,
                            0, 0, pwi->hInstance,
                            LoadIcon(pwi->hInstance, MAKEINTRESOURCE(IDI_DXS3)),
                            LoadCursor(NULL, IDC_ARROW),
                            NULL, NULL, strClassName, 0 };

    if(!RegisterClassEx(&wcex))
        goto EXIT_FAIL;

    if(!pwi->bWindowed)
    {
        ZeroMemory(&devmode, sizeof(devmode));
        devmode.dmSize          = sizeof(DEVMODE);
        devmode.dmBitsPerPel    = pwi->nBPP;
        devmode.dmPelsWidth     = pwi->nWidth;
        devmode.dmPelsHeight    = pwi->nHeight;
        devmode.dmFields        = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
        if(ChangeDisplaySettings(&devmode, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL)
        {
            MessageBox(NULL, TEXT("Failed to set the display mode!\n"
                       "See dxsurf3.txt for how to choose another."),
                       TEXT("DXSurface Sample 3"), MB_OK);
            goto EXIT_FAIL;
        }
        ShowCursor(FALSE);
    }

    bRet = TRUE;
EXIT_FAIL:
    return bRet;
}

BOOL ParseCommandLine | ( | WININFO * | pwi,
 |  | PTSTR | pszCmdLine
 | ) |  |

Definition at line 487 of file dxsurf3.cpp.

{
    pwi->nWidth = FindNumWithParameter(TEXT("-width"));
    pwi->nHeight = FindNumWithParameter(TEXT("-height"));
    pwi->nBPP   = FindNumWithParameter(TEXT("-bpp"));
    pwi->bWindowed = FindParameter(TEXT("-windowed"));

    if(pwi->nWidth < 0  ||  pwi->nHeight < 0  ||  pwi->nBPP < 0)
    {
        // Get the current display settings.
        HDC hDC = GetDC(NULL);
        int nCurrentBPP = GetDeviceCaps(hDC, BITSPIXEL);
        ReleaseDC(NULL, hDC);

        // Set to a default resolution of 640x480 windowed.
        pwi->nWidth = 640;
        pwi->nHeight = 480;
        pwi->nBPP = nCurrentBPP;
        pwi->bWindowed = TRUE;
    }
    else if(pwi->bWindowed == -1)
        pwi->bWindowed = FALSE;

    return TRUE;
}

int WINAPI WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | ,
 |  | PTSTR | pszCmdLine,
 |  | int |
 | ) |  |

Definition at line 67 of file dxsurf3.cpp.

{
    static  WININFO wi;
            PTSTR   pstrClassName = TEXT("DXSurface Sample 3");
            HWND    hWnd;
            DWORD   dwStyle, dwExStyle;
            int     nX, nY;
            MSG     msg;
            int     nEdgeX, nEdgeY, nTopY;
            DWORD   dwPresentTime, dwLastTime;
            HMENU   hMenu;

    CoInitialize(NULL);

    wi.hInstance = hInstance;
    if(!ParseCommandLine(&wi, pszCmdLine))
        goto CLEANUP_AND_EXIT;

    // Register the window class and change the display settings if necessary.
    if(!InitInstance(&wi, pstrClassName))
        goto CLEANUP_AND_EXIT;

    if(wi.bWindowed)
    {
        dwExStyle = 0;
        dwStyle = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX;
        nX = nY = CW_USEDEFAULT;
        nEdgeX = GetSystemMetrics(SM_CXEDGE);
        nEdgeY = GetSystemMetrics(SM_CYEDGE);
        nTopY = GetSystemMetrics(SM_CYCAPTION) + GetSystemMetrics(SM_CYMENU);
        hMenu = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_DXSURFMENU));
    }
    else
    {
        dwExStyle = WS_EX_TOPMOST;
        dwStyle = WS_POPUP | WS_VISIBLE;
        nX = nY = 0;
        nEdgeX = nEdgeY = nTopY = 0;
        hMenu = NULL;
    }

    hWnd = CreateWindowEx(
                    dwExStyle,                  // extended window style
                    pstrClassName,              // pointer to registered class name
                    pstrClassName,              // pointer to window name
                    dwStyle,                    // window style
                    nX,                         // horizontal position of window
                    nY,                         // vertical position of window
                    wi.nWidth + (2*nEdgeX),     // window width
                    wi.nHeight + (2*nEdgeY) + nTopY, // window height
                    NULL,                       // handle to parent or owner window
                    hMenu,                      // handle to menu or child-window identifier
                    hInstance,                  // handle to application instance
                    (LPVOID)&wi);               // pointer to window-creation data
    if(!hWnd)
        goto CLEANUP_AND_EXIT;

    // Store the WININFO structure so that other functions can get to it.
    SetWindowLong(hWnd, GWL_USERDATA, (LONG)&wi);

    // Showtime!
    ShowWindow(hWnd, SW_SHOW);
    UpdateWindow(hWnd);

    // Initialize time variables used to maintain a steady framerate.
    dwPresentTime = timeGetTime();
    dwLastTime    = dwPresentTime;

    while(1)
    {
        while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
        {
            if(msg.message == WM_QUIT)
                goto CLEANUP_AND_EXIT;

            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }

        // Check if it's time to render.
        if(dwPresentTime - dwLastTime >= 35)
        {
            InvalidateRect(hWnd, NULL, TRUE);
            UpdateWindow(hWnd);
            dwLastTime = timeGetTime();
        }
        dwPresentTime = timeGetTime();
    }

CLEANUP_AND_EXIT:
    if(!wi.bWindowed)
        ChangeDisplaySettings(0, 0);

    CoUninitialize();
    return 0;
}

LRESULT CALLBACK WndProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 170 of file dxsurf3.cpp.

{
    static IDXSurface*         pSurfImage       = NULL;
    static IDXSurface*         pSurfSierpinski  = NULL;
    static IDXSurface*         pSurfOut         = NULL;
    static IDXSurfaceFactory*  pSurfFact        = NULL;
    static POINT               ptSierpinskiVertices[3];
           WININFO*            pwi;

    pwi = (WININFO*)GetWindowLong(hWnd, GWL_USERDATA);

    switch(uMsg)
    {
        case WM_CREATE:
        {
            LPCREATESTRUCT          lpcs        = (LPCREATESTRUCT)lParam;
            IDXSurface*             pSurfTemp   = NULL;
            IDXTransformFactory*    pTransFact  = NULL;
            IDXTransform*           pScaleTransform = NULL;
            SIZE                    size;
            HRESULT                 hRes;
            IDXTScale*              pScale      = NULL;
            CDXDBnds                bounds;
            DXPMSAMPLE              sample;
            LRESULT                 lRet = -1;

            // Get the structure that describes the physical window.
            pwi = (WININFO*)lpcs->lpCreateParams;
            bounds.SetXYSize(pwi->nWidth, pwi->nHeight);
            size.cx = pwi->nWidth; size.cy = pwi->nHeight;

            // Create a transform factory through which we'll get
            // our surface factory.  Using the surface factory
            // we can create and manipulate DXSurfaces.
            hRes = CoCreateInstance(CLSID_DXTransformFactory, NULL,
                            CLSCTX_INPROC, IID_IDXTransformFactory, (void**)&pTransFact);
            if(FAILED(hRes))
            {
                MessageBox(NULL, TEXT("Failed to CoCreate the Transform Factory!\n"
                    "Please register dxtrans.dll."), TEXT("DXSurface Sample 3"), MB_OK);
                goto FAILED;
            }

            // Get the surface factory from the transform factory.
            pTransFact->QueryInterface(IID_IDXSurfaceFactory, (void**)&pSurfFact);

            // Create a surface from an image file.
            // NOTE: The first parameter is a wide character string.  If your path
            // is in ANSI, use mbstowcs() or MultiByteToWideChar().
            hRes = pSurfFact->LoadImage(
                                    L"parrot.png",
                                    NULL,
                                    NULL,
                                    NULL,
                                    IID_IDXSurface,
                                    (void**)&pSurfTemp);
            if(FAILED(hRes))
            {
                if(hRes == DXTERR_REQ_IE_DLLNOTFOUND) // Need IE4.0 or greater.
                {
                    MessageBox(NULL, TEXT("Failed to load the image!\n"
                        "IE4.0 or greater is required for DXTransforms.\n"
                        "Press enter to exit."),
                        TEXT("DXSurface Sample 3"), MB_OK);
                }
                else // Assume we couldn't find dxmedia image directory.
                {
                    MessageBox(NULL, TEXT("The image file Parrot.png must be\n"
                        "in the current directory.\n"
                        "Press enter to exit."),
                        TEXT("DXSurface Sample 3"), MB_OK);
                }

                goto FAILED;
            }

            // Create a second, empty surface, using the size of the window
            // for the bounds.  This surface will hold the resized version of
            // the image we loaded.
            hRes = pSurfFact->CreateSurface(
                                    NULL,               // ddraw surface
                                    NULL,               // ddsurfacedesc
                                    &DDPF_PMARGB32,     // format id
                                    &bounds,
                                    0,
                                    NULL,
                                    IID_IDXSurface,
                                    (void**)&pSurfImage);
            if(FAILED(hRes))
            {
                MessageBox(NULL, TEXT("Failed to load image!\n"
                    "Please provide a valid image file."), TEXT("DXSurface Sample 3"), MB_OK);
                goto FAILED;
            }

            // Create and set-up the scale transform which will resize our image to fit
            // the entire window.  Use this instead of StretchBlt() to preserve
            // image quality as alpha is ignored with StretchBlt().
            hRes = pTransFact->CreateTransform(NULL, 0, NULL, 0, NULL, NULL, CLSID_DXTScale,
                                IID_IDXTransform, (void**)&pScaleTransform);
            if(FAILED(hRes))
            {
                MessageBox(NULL, TEXT("Failed to create the Scale transform!\n"
                    "Please register dxtrans.dll."), TEXT("DXSurface Sample 3"), MB_OK);
                goto FAILED;
            }

            pScaleTransform->Setup(
                                (IUnknown**)&pSurfTemp,     // Source (from LoadImage)
                                1,
                                (IUnknown**)&pSurfImage,    // Dest (from CreateSurface)
                                1,
                                0);

            // Get the IDXTScale interface because IDXTScale::ScaleFitToSize()
            // is what we need to call.
            pScaleTransform->QueryInterface(IID_IDXTScale, (void**)&pScale);
            pScale->ScaleFitToSize(NULL, size, FALSE);

            // Scale the output surface to the window size.
            pScaleTransform->Execute(NULL, NULL, NULL);

            // Create a surface the same size as the output surface
            // for fractal plotting.
            pSurfFact->CreateSurface(
                        NULL,               // ddraw surface
                        NULL,               // ddsurfacedesc
                        &DDPF_PMARGB32,     // format id
                        &bounds,
                        0,
                        NULL,
                        IID_IDXSurface,
                        (void**)&pSurfSierpinski);

            // Create the output surface which will hold the final result of our
            // composition of the image and the fractal.
            pSurfFact->CreateSurface(
                        NULL,               // ddraw surface
                        NULL,               // ddsurfacedesc
                        &DDPF_PMARGB32,     // format id
                        &bounds,
                        0,
                        NULL,
                        IID_IDXSurface,
                        (void**)&pSurfOut);

            // Set up the sierpinski vertices.
            ptSierpinskiVertices[0].x = bounds.Width() / 2;
            ptSierpinskiVertices[0].y = 0;
            ptSierpinskiVertices[1].x = 0;
            ptSierpinskiVertices[1].y = bounds.Height() - 1;
            ptSierpinskiVertices[2].x = bounds.Width() - 1;
            ptSierpinskiVertices[2].y = bounds.Height() - 1;

            // Initialize the sierpinski surface to full on red but zero alpha,
            // i.e. a transparent red surface.
            sample.Alpha = sample.Green = sample.Blue = 0x00;
            sample.Red = 0x40;
            DXFillSurface(
                pSurfSierpinski,
                sample,
                FALSE,  // Don't do a blend, just do a straight copy.
                10000); // Wait this many milliseconds.

            srand((unsigned)time(NULL));

            lRet = 0;
            goto OK;

// If we failed, we clean up all COM interfaces that we created.
// If we're successful, only clean up the temporary interfaces.
FAILED:
            SAFE_RELEASE(pSurfOut);
            SAFE_RELEASE(pSurfImage);
            SAFE_RELEASE(pSurfSierpinski);
            SAFE_RELEASE(pSurfFact);
OK:
            SAFE_RELEASE(pScaleTransform);
            SAFE_RELEASE(pScale);
            SAFE_RELEASE(pSurfTemp);
            SAFE_RELEASE(pTransFact);
            return lRet;
        } // WM_CREATE

        case WM_CLOSE:
            SAFE_RELEASE(pSurfImage);
            SAFE_RELEASE(pSurfOut);
            SAFE_RELEASE(pSurfSierpinski);
            SAFE_RELEASE(pSurfFact);
            PostQuitMessage(0);
            return 0;

        case WM_PAINT:
        {
            HDC         hDC;
            PAINTSTRUCT ps;
            IDXDCLock*  pIDCLock = NULL;
            CDXDBnds    bounds;
            static POINT ptCurrent = { -1, -1 };

            hDC = BeginPaint(hWnd, &ps);

            if(ptCurrent.x == -1)
                ptCurrent = ptSierpinskiVertices[rand() % 3];

            pSurfImage->GetBounds(&bounds);

            // Use IDXSurfaceFactory::BitBlt() to blt the image to the output
            // surface.
            pSurfFact->BitBlt(
                            pSurfOut,
                            NULL,
                            pSurfImage,
                            NULL,
                            0);

            IDXARGBReadWritePtr* pRWPtr = NULL;

            // Lock the DXSurface, and get an interface that allows
            // us to access the pixels.
            pSurfSierpinski->LockSurface(
                                    NULL,
                                    INFINITE,
                                    DXLOCKF_READWRITE,
                                    IID_IDXARGBReadWritePtr,
                                    (void**)&pRWPtr,
                                    NULL);

            // We use GetNativeType to give us a pointer to the first pixel,
            // and the number of pixels per row.
            DXNATIVETYPEINFO info;
            pRWPtr->GetNativeType(&info);
            DXSAMPLE* pSample = (DXSAMPLE*)info.pFirstByte;
            ULONG ulRowSampWidth = info.lPitch / sizeof(DXSAMPLE);

            // Calculate pixels to turn on.
            for(int i=0; i<NUMPIXELSTODRAW; i++)
            {
                POINT ptTemp = ptSierpinskiVertices[rand() % 3];
                ptCurrent.x = abs((ptTemp.x - ptCurrent.x) / 2) + min(ptTemp.x, ptCurrent.x);
                ptCurrent.y = abs((ptTemp.y - ptCurrent.y) / 2) + min(ptTemp.y, ptCurrent.y);

                assert(ptCurrent.x >= 0);
                assert(ptCurrent.x < pwi->nWidth);
                assert(ptCurrent.y >= 0);
                assert(ptCurrent.y < pwi->nHeight);

                // Calculate the index to the pixel.
                // Turn on the alpha channel to 1/4 intensity.
                UINT uIndex =  ulRowSampWidth * ptCurrent.y + ptCurrent.x;
                pSample[uIndex].Alpha = 0x40;
            }

            // Releasing this unlocks the Sierpinski dxsurface locked above.
            SAFE_RELEASE(pRWPtr);

            // Blend the fractal surface onto the output surface.
            pSurfFact->BitBlt(
                            pSurfOut,
                            NULL,
                            pSurfSierpinski,
                            NULL,
                            DXBOF_DO_OVER); // Do an alpha blend.

            // Lock the output surface and draw it to the DC, using GDI's BitBlt.
            pSurfOut->LockSurfaceDC(NULL, INFINITE, DXLOCKF_READ, &pIDCLock);

            PTSTR pstrMessage = TEXT("Red pixels alpha-blended over an image");
            SetBkMode(pIDCLock->GetDC(), TRANSPARENT);
            SetTextColor(pIDCLock->GetDC(), RGB(0xFF, 0x00, 0x00));
            TextOut(pIDCLock->GetDC(), 0, 0, pstrMessage, 38);

            BitBlt(
                hDC,                // handle to destination device context
                0,                  // x-coordinate of upper-left corner of dest. rect.
                0,                  // y-coordinate of upper-left corner of dest. rect.
                pwi->nWidth,        // width of destination rectangle
                pwi->nHeight,       // height of destination rectangle
                pIDCLock->GetDC(),  // handle to source device context
                0,                  // x-coordinate of upper-left corner of source rectangle
                0,                  // y-coordinate of upper-left corner of source rectangle
                SRCCOPY);           // raster operation code

            SAFE_RELEASE(pIDCLock);
            EndPaint(hWnd, &ps);
            return 0;
        }

        case WM_CHAR:
            if(wParam == VK_ESCAPE)
                PostMessage(hWnd, WM_CLOSE, 0, 0);
            return 0;

        case WM_COMMAND:
            switch(LOWORD(wParam))
            {
                case ID_FILE_EXIT:
                    PostMessage(hWnd, WM_CLOSE, 0, 0);
                    break;

                case ID_FILE_ABOUT:
                    MessageBox(hWnd, TEXT("DXSurface Sample 3 Version 1.0\n"
                                          "Copyright (c) 1998-2001 Microsoft Corporation.\n"
                                          "All rights reserved."),
                                          TEXT("DXSurface Sample 3"),
                                          MB_ICONINFORMATION | MB_OK);
                    break;
            }
            return 0;
    }

    return DefWindowProc(hWnd, uMsg, wParam, lParam);
}

Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/dxtrans/dxsurf3/resource.h File Reference

  • Web
  • dxtrans
  • dxsurf3
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | ID_FILE_ABOUT 40004
#define | ID_FILE_EXIT 40001
#define | IDI_DXS3 101
#define | IDR_DXSURFMENU 103

Define Documentation

#define ID_FILE_ABOUT 40004

Definition at line 12 of file resource.h.

#define ID_FILE_EXIT 40001

Definition at line 11 of file resource.h.

#define IDI_DXS3 101

Definition at line 9 of file resource.h.

#define IDR_DXSURFMENU 103

Definition at line 10 of file resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/dxtrans/dxsurfmod/main.cpp File Reference

  • Web
  • dxtrans
  • dxsurfmod
Defines | Functions | Variables

main.cpp File Reference

#include <objbase.h>
#include <initguid.h>
#include <windows.h>
#include <wchar.h>
#include <tchar.h>
#include <dxtguid.c>
#include <dxtrans.h>
#include <dxtmsft.h>
#include <dxbounds.h>
#include <dxterror.h>
#include <strsafe.h>
#include "resource.h"

Go to the source code of this file.

Defines

#define | MAX_SLIDE_INDEX 11

Functions

void | GetImageDirectoryAndFileName (PWSTR wszImageDirAndFileName, PCWSTR wszFileName)
void | HandleError (HRESULT hr, HWND hwnd, LPCSTR szErrorMsg)
void | ReleaseAllObjects (void)
int WINAPI | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
LRESULT CALLBACK | WndProc (HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)

Variables

CDXDBnds | g_bndsMod
CDXDBnds | g_bndsWnd
int | g_iFrameIndex = -1
IDXLookupTable * | g_pLookupTable = NULL
IDXLUTBuilder * | g_pLUTBuilder = NULL
IDXSurface * | g_pSurf1 = NULL
IDXSurface * | g_pSurf2 = NULL
IDXSurfaceFactory * | g_pSurfFact = NULL
IDXSurfaceModifier * | g_pSurfMod = NULL
IDXSurface * | g_pSurfModSurf = NULL
IDXTransformFactory * | g_pTransFact = NULL
LPCSTR | g_szCaption = NULL
LPCSTR | g_szNotes = NULL

Define Documentation

#define MAX_SLIDE_INDEX 11

Definition at line 41 of file main.cpp.

Function Documentation

void GetImageDirectoryAndFileName | ( | PWSTR | wszImageDirAndFileName,
 |  | PCWSTR | wszFileName
 | ) |  |
void HandleError | ( | HRESULT | hr,
 |  | HWND | hwnd,
 |  | LPCSTR | szErrorMsg
 | ) |  |

Definition at line 758 of file main.cpp.

{
    char    szMsg[256];

    // Use the strsafe.h version of printf.
    StringCchPrintf(szMsg, 256, "HRESULT: 0x%08x\n%s", hr, szErrorMsg);

    MessageBox(hwnd, szMsg, "Error", MB_OK | MB_ICONEXCLAMATION);

    if ( hwnd )
        PostMessage(hwnd, WM_CLOSE, 0, 0);
}

void ReleaseAllObjects ( void )

Definition at line 774 of file main.cpp.

{
    if ( g_pLookupTable )
        g_pLookupTable->Release();

    if ( g_pLUTBuilder )
        g_pLUTBuilder->Release();

    if ( g_pSurfModSurf )
        g_pSurfModSurf->Release();

    if ( g_pSurfMod )
        g_pSurfMod->Release();

    if ( g_pSurf2 )
        g_pSurf2->Release();

    if ( g_pSurf1 )
        g_pSurf1->Release();

    if ( g_pSurfFact )
        g_pSurfFact->Release();

    if ( g_pTransFact )
        g_pTransFact->Release();
}

int WINAPI WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | PSTR | szCmdLine,
 |  | int | iCmdShow
 | ) |  |

Definition at line 83 of file main.cpp.

{
    static char szAppName[] = "SurfMod";
    HWND        hwnd;
    MSG         msg;
    WNDCLASSEX  wc;

    CoInitialize(NULL);

    wc.cbSize           = sizeof(wc);
    wc.style            = CS_HREDRAW | CS_VREDRAW;
    wc.lpfnWndProc      = WndProc;
    wc.cbClsExtra       = 0;
    wc.cbWndExtra       = 0;
    wc.hInstance        = hInstance;
    wc.hIcon            = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1));
    wc.hCursor          = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground    = (HBRUSH) GetStockObject(BLACK_BRUSH);
    wc.lpszMenuName     = MAKEINTRESOURCE(IDR_MENU1);
    wc.lpszClassName    = szAppName;
    wc.hIconSm          = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1));

    RegisterClassEx(&wc);

    hwnd = CreateWindowEx(WS_EX_OVERLAPPEDWINDOW,
                          szAppName, "SurfMod",
                          WS_OVERLAPPEDWINDOW,
                          CW_USEDEFAULT, CW_USEDEFAULT,
                          680, 480,
                          NULL,
                          NULL,
                          hInstance,
                          NULL);

    if ( hwnd )
    {
        ShowWindow(hwnd, iCmdShow);
        UpdateWindow(hwnd);

        while ( GetMessage(&msg, NULL, 0, 0) )
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
    }

    ReleaseAllObjects();
    CoUninitialize();

    return msg.wParam;
}

LRESULT CALLBACK WndProc | ( | HWND | hwnd,
 |  | UINT | iMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 139 of file main.cpp.

{
    PAINTSTRUCT ps;
    RECT        rc;
    HDC         hdc         = NULL;
    HRESULT     hr          = S_OK;

    CDXDBnds    bndsCur;                    // A variable to hold the current
                                            // bounds of the surface modifier
                                            // if needed.

    POINT       pt          = { 50, 50 };   // Used for offset.

    IDXSurface* pSurfTemp   = NULL;         // A temporary surface used to
                                            // translate the surface modifier
                                            // to the screen's pixel format and
                                            // retrieve a handle to a DC.

    IDXDCLock*  pLock       = NULL;         // Used to lock a pSurfTemp and
                                            // retrieve a handle to a DC.

    OPIDDXLUTBUILDER lutOps[] =             // Operations performed by the
        { OPID_DXLUTBUILDER_Invert };       // lookup table.

    switch ( iMsg )
    {
    case WM_COMMAND:

        // User selected Exit from the File menu.

        switch ( LOWORD(wParam) )
        {
        case IDM_EXIT:

            PostMessage(hwnd, WM_CLOSE, 0, 0L);
            return 0;
        }

        break;

    case WM_CREATE:

        ///////////////////////////////////////
        //
        //  Create factories
        //

        // Transform factory.

        hr = CoCreateInstance(CLSID_DXTransformFactory, NULL, CLSCTX_INPROC,
                              IID_IDXTransformFactory, (void**) &g_pTransFact);

        // Surface factory.

        if ( SUCCEEDED(hr) )
        {
            hr = g_pTransFact->QueryService(SID_SDXSurfaceFactory,
                                            IID_IDXSurfaceFactory,
                                            (void**) &g_pSurfFact);
        }

        if ( FAILED(hr) )
        {
            HandleError(hr, NULL, "Can't create factories.  The DXMedia SDK "
                        "must be installed for this sample to work properly.");

            return -1;
        }

        ///////////////////////////////////////
        //
        //  Load Images
        //

        hr = g_pSurfFact->LoadImage(L"eagle_ck.gif",
                                    NULL, NULL, &DDPF_PMARGB32, IID_IDXSurface,
                                    (void**) &g_pSurf1);

        if ( SUCCEEDED(hr) )
        {

            hr = g_pSurfFact->LoadImage(L"apple.gif",
                                        NULL, NULL, &DDPF_PMARGB32, IID_IDXSurface,
                                        (void**) &g_pSurf2);
        }

        if ( FAILED(hr) )
        {
            if ( DXTERR_REQ_IE_DLLNOTFOUND == hr )
            {
                HandleError(hr, NULL, "Error loading images, possibly because "
                            "IE4.0 or greater is not installed.");
            }
            else
            {
                HandleError(hr, NULL, "LoadImage failure.");
            }

            return -1;
        }

        ///////////////////////////////////////
        //
        //  Create lookup table
        //

        // Create a lookup table builder.

        if ( SUCCEEDED(hr) )
        {
            hr = CoCreateInstance(CLSID_DXLUTBuilder, NULL, CLSCTX_INPROC,
                                  IID_IDXLUTBuilder, (void**) &g_pLUTBuilder);
        }

        // Setup to support color inversion operation.

        if ( SUCCEEDED(hr) )
        {
            hr = g_pLUTBuilder->SetBuildOrder(lutOps, 1);
        }

        // Modify the level of the color inversion.

        if ( SUCCEEDED(hr) )
        {
            hr = g_pLUTBuilder->SetInvert(0.5);
        }

        // Query for a lookup table to be attached to the surface modifier.

        if ( SUCCEEDED(hr) )
        {
            hr = g_pLUTBuilder->QueryInterface(IID_IDXLookupTable,
                                               (void**) &g_pLookupTable);
        }

        if ( FAILED(hr) )
        {
            HandleError(hr, NULL, "Error creating lookup table.");

            return -1;
        }

        // The g_iFrameIndex variable is initialized to -1.  Immediately
        // sending the window a keypress right arrow message will update
        // b_iFrameIndex to 0 and setup the first sample frame.

        SendMessage(hwnd, WM_KEYDOWN, VK_RIGHT, 0);

        return 0;

    case WM_DESTROY:

        PostQuitMessage(0);

        return 0;

    case WM_KEYDOWN:

        switch ( wParam )
        {

            // Only responds to the user pressing the right
            // or left arrow keys.

        case VK_RIGHT:
        case VK_LEFT:

            while ( TRUE )
            {
                if ( VK_RIGHT == wParam && g_iFrameIndex < MAX_SLIDE_INDEX )
                {
                    // Increase the frame count if the user pressed
                    // the right arrow key.

                    g_iFrameIndex++;
                    break;
                }

                if ( VK_LEFT == wParam && g_iFrameIndex > 0 )
                {
                    // Decrease the frame index if the user pressed
                    // the left arrow key.

                    g_iFrameIndex--;
                    break;
                }

                return 0;
            }

            ///////////////////////////////////////
            //
            //  Reset surface modifier
            //

            // The surface modifier can be reset by calling all Set methods
            // with NULL parameters or the it can be released and re-created.

            // 1. Release surface modifier and associated surface pointer.

            if ( g_pSurfModSurf )
            {
                g_pSurfModSurf->Release();
                g_pSurfModSurf = NULL;
            }

            if ( g_pSurfMod )
            {
                g_pSurfMod->Release();
                g_pSurfMod = NULL;
            }

            // 2. Re-create surface modifier.

            hr = CoCreateInstance(CLSID_DXSurfaceModifier, NULL, CLSCTX_INPROC,
                                  IID_IDXSurfaceModifier, (void**) &g_pSurfMod);

            // 3. Query for surface pointer to access the image.

            if ( SUCCEEDED(hr) )
            {
                hr = g_pSurfMod->QueryInterface(IID_IDXSurface,
                                                (void**) &g_pSurfModSurf);
            }

            ///////////////////////////////////////
            //
            //  Setup new frame
            //

            switch ( g_iFrameIndex )
            {
            case 0:

                // Blank opaque blue surface

                g_pSurfMod->SetFillColor(0xFF0000FF);
                g_pSurfMod->SetBounds(&g_bndsMod);

                g_szCaption = "0    "
                              "Fill Color: Opaque Blue    "
                              "[ Use left and right arrow keys to switch frames ]";

                g_szNotes = "When no background is used, the surface modifier "
                            "can be any size and sizes with the window.";

                break;

            case 1:

                // Blank opaque blue surface that's the
                // same size as the background surface

                g_pSurfMod->SetFillColor(0xFF0000FF);
                g_pSurfMod->SetBackground(g_pSurf1);

                g_szCaption = "1    "
                              "Background: Eagle    "
                              "Fill Color: Opaque Blue [ Obscures eagle ]";

                g_szNotes = "A surface modifier using a background always sizes "
                            "to the background.";

                break;

            case 2:

                // Eagle surface with a translucent blue
                // surface over the top.

                g_pSurfMod->SetFillColor(0x550000FF);
                g_pSurfMod->SetBackground(g_pSurf1);

                g_szCaption = "2    "
                              "Background: Eagle    "
                              "Fill Color: Translucent Blue    "
                              "Composite Operation: Over [ default ]    ";

                g_szNotes = "Fill color is always drawn in front of the "
                            "background surface.";

                break;

            case 3:

                // translucent blue eagle

                g_pSurfMod->SetFillColor(0x550000FF);
                g_pSurfMod->SetBackground(g_pSurf1);
                g_pSurfMod->SetCompositeOperation(DXSURFMOD_COMP_ALPHA_MASK);

                g_szCaption = "3    "
                              "Background: Eagle    "
                              "Fill Color: Translucent Blue    "
                              "Composite Operation: Alpha Mask    ";

                g_szNotes = "The background's alpha value is used to draw the "
                            "fill color.";

                break;

            case 4:

                // Apple in upper left hand corner of a
                // translucent blue surface

                g_pSurfMod->SetFillColor(0x550000FF);
                g_pSurfMod->SetForeground(g_pSurf2, FALSE, NULL);
                g_pSurfMod->SetBounds(&g_bndsMod);

                g_szCaption = "4    "
                              "Fill Color: Translucent Blue    "
                              "Foreground: Apple";

                g_szNotes = "Foreground surfaces are always drawn in front of "
                            "the fill color.";

                break;

            case 5:

                // Apple in front of translucent blue surface
                // placed 50 pixels from both top and left edges

                g_pSurfMod->SetFillColor(0x550000FF);
                g_pSurfMod->SetForeground(g_pSurf2, FALSE, &pt);
                g_pSurfMod->SetBounds(&g_bndsMod);

                g_szCaption = "5    "
                              "Fill Color: Translucent Blue    "
                              "Foreground: Apple, offset [ 50, 50 ]";

                g_szNotes = "When not tiled, the foreground is offset relative "
                            "to the upper left corner of the surface modifier.";

                break;

            case 6:

                // Apples tiled in front of translucent blue surface
                // with first apple against top left edge.

                g_pSurfMod->SetFillColor(0x550000FF);
                g_pSurfMod->SetForeground(g_pSurf2, TRUE, NULL);
                g_pSurfMod->SetBounds(&g_bndsMod);

                g_szCaption = "6    "
                              "Fill Color: Translucent Blue    "
                              "Foreground: Apple, tiled";

                g_szNotes = "The first tiled foreground image is placed in the "
                            "upper left corner of the surface modifier.";

                break;

            case 7:

                // Apples tiled in front of translucent blue surface
                // with the [50, 50] coordinate of the first apple
                // at the top left corner.

                g_pSurfMod->SetFillColor(0x550000FF);
                g_pSurfMod->SetForeground(g_pSurf2, TRUE, &pt);
                g_pSurfMod->SetBounds(&g_bndsMod);

                g_szCaption = "7    "
                              "Fill Color: Translucent Blue    "
                              "Foreground: Apple, tiled, offset [ 50, 50 ]";

                g_szNotes = "When tiled, the offset is relative to the upper "
                            "left corner of the foreground surface.";

                break;

            case 8:

                // Apple in front of eagle.

                g_pSurfMod->SetBackground(g_pSurf1);
                g_pSurfMod->SetForeground(g_pSurf2, FALSE, NULL);

                g_szCaption = "8    "
                              "Background: Eagle    "
                              "Foreground: Apple    "
                              "Composite Operation: Over [ default ]";

                g_szNotes = "The foreground surface is always drawn in front "
                            "of the background surface.";

                break;

            case 9:

                // translucent apple in front of eagle.

                g_pSurfMod->SetBackground(g_pSurf1);
                g_pSurfMod->SetForeground(g_pSurf2, FALSE, NULL);
                g_pSurfMod->SetOpacity(0.5);

                g_szCaption = "9    "
                              "Background: Eagle    "
                              "Foreground: Apple    "
                              "Composite Operation: Over [ default ]    "
                              "Opacity: 0.5";

                g_szNotes = "SetOpacity only affects the opacity of the "
                            "foreground surface.";

                break;

            case 10:

                // translucent tiled apples only show where eagle's
                // alpha value is greater than zero.

                g_pSurfMod->SetBackground(g_pSurf1);
                g_pSurfMod->SetForeground(g_pSurf2, TRUE, NULL);
                g_pSurfMod->SetCompositeOperation(DXSURFMOD_COMP_ALPHA_MASK);
                g_pSurfMod->SetOpacity(0.5);

                g_szCaption = "10    "
                              "Background: Eagle    "
                              "Foreground: Apple, tiled    "
                              "Composite Operation: Alpha Mask    "
                              "Opacity: 0.5";

                g_szNotes = "Alpha mask can be used for a cool effect with "
                            "a tiled foreground surface and opacity.";

                break;

            case 11:

                // Apple modified using a lookup table in front of
                // a translucent blue surface.

                g_pSurfMod->SetFillColor(0xFF000055);
                g_pSurfMod->SetForeground(g_pSurf2, FALSE, NULL);
                g_pSurfMod->SetLookup(g_pLookupTable);
                g_pSurfMod->SetBounds(&g_bndsMod);

                g_szCaption = "11    "
                              "Fill Color: Solid Dark Blue    "
                              "Foreground: Apple    "
                              "Lookup Table: Color Inversion";

                g_szNotes = "Lookup tables only modify the foreground surface.  "
                            "This was created with a lookup table builder.";

                break;
            }

            // Check for error

            if ( FAILED(hr) )
            {
                HandleError(hr, hwnd, "Error during frame setup.");
            }

            // Force window repaint

            InvalidateRect(hwnd, NULL, TRUE);
            UpdateWindow(hwnd);
        }

        return 0;

    case WM_PAINT:

        hdc = BeginPaint(hwnd, &ps);

        // Retrieve the bounds of the surface modifier.

        hr = g_pSurfModSurf->GetBounds(&bndsCur);

        //     Since you can't get a device context from a
        //     surface modifier, you have to:

        // 1.  Create a new surface, same size as surface modifier.
        //     Sending parameter 3 as NULL means the surface will be
        //     created with the same pixel format as the display.

        if ( SUCCEEDED(hr) )
        {
            hr = g_pSurfFact->CreateSurface(NULL, NULL, NULL, &bndsCur, NULL,
                                            NULL, IID_IDXSurface,
                                            (void**) &pSurfTemp);
        }

        // 2.  Use surface factory's BitBlt function to copy the image
        //     onto the new surface (this is the most efficient method).

        if ( SUCCEEDED(hr) )
        {
            hr = g_pSurfFact->BitBlt(pSurfTemp, NULL, g_pSurfModSurf, NULL, NULL);
        }

        // 3.  Lock the surface so that changes can't be made while painting.

        if ( SUCCEEDED(hr) )
        {
            hr = pSurfTemp->LockSurfaceDC(NULL, INFINITE, DXLOCKF_READ, &pLock);
        }

        // 4.  Retrieve a device context from the lock and then use the  GDI
        //     BitBlt function to blit the contents of the surface to the window.

        if ( SUCCEEDED(hr) )
        {
            hdc = pLock->GetDC();

            if ( bndsCur == g_bndsMod )
            {
                // If the bounds are the same as the largest possible
                // size for this window size, blit to (0,0).
                // [ Note:  Will run this code when the surface modifier
                //          does not use a background surface. ]

                BitBlt(ps.hdc, 0, 0,
                       bndsCur.Width(), bndsCur.Height(),
                       hdc, 0, 0, SRCCOPY);
            }
            else
            {
                // If the bounds are different than the largest possible
                // size for this window size, center inside the window.
                // [ Note:  Will run this code when the surface modifier
                //          uses a background surface. ]

                BitBlt(ps.hdc,
                       (g_bndsMod.Width()  - bndsCur.Width())  / 2,
                       (g_bndsMod.Height() - bndsCur.Height()) / 2,
                       bndsCur.Width(), bndsCur.Height(),
                       hdc, 0, 0, SRCCOPY);
            }

            // Releasing the lock will also release the handle to the device
            // context (hdc) so ReleaseDC isn't needed.

            pLock->Release();
        }

        // Release the temporary surface used to convert the
        // pixel format and retrieve an hdc.

        if ( pSurfTemp )
        {
            pSurfTemp->Release();
        }

        // Print the caption text at the bottom of the screen.

        if ( SUCCEEDED(hr) )
        {
            SetBkMode(ps.hdc, TRANSPARENT);

            SetTextColor(ps.hdc, RGB(255, 0, 0));
            size_t dwCaptionLength;
            if (FAILED( StringCchLength(g_szCaption, 256, &dwCaptionLength))) { return -1; }
              TextOut(ps.hdc, 10, g_bndsWnd.Height() - 45, g_szCaption, dwCaptionLength);

            SetTextColor(ps.hdc, RGB(0, 200, 0));
            size_t dwNotesLength;
            if (FAILED( StringCchLength(g_szNotes, 256, &dwNotesLength))) { return -1; }
              TextOut(ps.hdc, 10, g_bndsWnd.Height() - 25, g_szNotes, dwNotesLength);
        }

        EndPaint(hwnd, &ps);

        // Check for error

        if ( FAILED(hr) )
        {
            HandleError(hr, hwnd, "Error repainting frame.");
        }

        return 0;

    case WM_SIZE:

        GetClientRect(hwnd, &rc);

        // When the window is resized, set the sizes of
        // two bounds objects:
        //
        // g_bndsWnd is the size of the full client area of the
        //   window.
        //
        // g_bndsMod is the size of the full client area of the
        //   window minus a few pixels to leave room for a caption.
        //   These are the bounds that will be used to size surface
        //   modifiers that don't use a background surface.

        g_bndsWnd.SetXYSize(rc.right - rc.left, rc.bottom - rc.top);

        g_bndsMod.SetXYSize(rc.right - rc.left, rc.bottom - rc.top - 50);

        // Set the "virtual size" of the surface modifier equal to
        // the same size as the window (leaving room at the bottom
        // for the frame caption.)  If the surface modifier uses
        // a background surface it will ignore this method and retain
        // bounds equal to the size of the background surface.

        g_pSurfMod->SetBounds(&g_bndsMod);

        return 0;
    }

    return DefWindowProc(hwnd, iMsg, wParam, lParam);
}

Variable Documentation

CDXDBnds g_bndsMod

Definition at line 70 of file main.cpp.

CDXDBnds g_bndsWnd

Definition at line 71 of file main.cpp.

int g_iFrameIndex = -1

Definition at line 73 of file main.cpp.

IDXLookupTable* g_pLookupTable = NULL

Definition at line 68 of file main.cpp.

IDXLUTBuilder* g_pLUTBuilder = NULL

Definition at line 67 of file main.cpp.

IDXSurface* g_pSurf1 = NULL

Definition at line 61 of file main.cpp.

IDXSurface* g_pSurf2 = NULL

Definition at line 62 of file main.cpp.

IDXSurfaceFactory* g_pSurfFact = NULL

Definition at line 60 of file main.cpp.

IDXSurfaceModifier* g_pSurfMod = NULL

Definition at line 64 of file main.cpp.

IDXSurface* g_pSurfModSurf = NULL

Definition at line 65 of file main.cpp.

IDXTransformFactory* g_pTransFact = NULL

Definition at line 59 of file main.cpp.

LPCSTR g_szCaption = NULL

Definition at line 75 of file main.cpp.

LPCSTR g_szNotes = NULL

Definition at line 76 of file main.cpp.

Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/dxtrans/dxsurfmod/resource.h File Reference

  • Web
  • dxtrans
  • dxsurfmod
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | ICCR_BACKGROUND 1026
#define | IDCB_LOADBG 1017
#define | IDCB_LOADFG 1018
#define | IDCC_FILLCOLOR 1025
#define | IDCC_FOREGROUND 1028
#define | IDCE_BGA 1007
#define | IDCE_BGB 1006
#define | IDCE_BGBOUNDSX 1015
#define | IDCE_BGBOUNDSY 1016
#define | IDCE_BGG 1005
#define | IDCE_BGR 1004
#define | IDCE_BGSURFACE 1001
#define | IDCE_FGSURFACE 1008
#define | IDCE_FGTILEX 1009
#define | IDCE_FGTILEY 1012
#define | IDCE_OPACITY 1030
#define | IDCR_BOUNDS 1027
#define | IDCR_FGPLACE 1011
#define | IDCR_FGTILE 1010
#define | IDD_PROP 104
#define | IDI_ICON1 105
#define | IDM_ALPHA 40007
#define | IDM_BRIGHTNESS 40009
#define | IDM_CLOSE 40003
#define | IDM_EXIT 40004
#define | IDM_HUE 40008
#define | IDM_OVER 40006
#define | IDM_PROPERTIES 40005
#define | IDR_MENU1 101

Define Documentation

#define ICCR_BACKGROUND 1026

Definition at line 23 of file resource.h.

#define IDCB_LOADBG 1017

Definition at line 20 of file resource.h.

#define IDCB_LOADFG 1018

Definition at line 21 of file resource.h.

#define IDCC_FILLCOLOR 1025

Definition at line 22 of file resource.h.

#define IDCC_FOREGROUND 1028

Definition at line 25 of file resource.h.

#define IDCE_BGA 1007

Definition at line 12 of file resource.h.

#define IDCE_BGB 1006

Definition at line 11 of file resource.h.

#define IDCE_BGBOUNDSX 1015

Definition at line 18 of file resource.h.

#define IDCE_BGBOUNDSY 1016

Definition at line 19 of file resource.h.

#define IDCE_BGG 1005

Definition at line 10 of file resource.h.

#define IDCE_BGR 1004

Definition at line 9 of file resource.h.

#define IDCE_BGSURFACE 1001

Definition at line 8 of file resource.h.

#define IDCE_FGSURFACE 1008

Definition at line 13 of file resource.h.

#define IDCE_FGTILEX 1009

Definition at line 14 of file resource.h.

#define IDCE_FGTILEY 1012

Definition at line 17 of file resource.h.

#define IDCE_OPACITY 1030

Definition at line 26 of file resource.h.

#define IDCR_BOUNDS 1027

Definition at line 24 of file resource.h.

#define IDCR_FGPLACE 1011

Definition at line 16 of file resource.h.

#define IDCR_FGTILE 1010

Definition at line 15 of file resource.h.

#define IDD_PROP 104

Definition at line 6 of file resource.h.

#define IDI_ICON1 105

Definition at line 7 of file resource.h.

#define IDM_ALPHA 40007

Definition at line 31 of file resource.h.

#define IDM_BRIGHTNESS 40009

Definition at line 33 of file resource.h.

#define IDM_CLOSE 40003

Definition at line 27 of file resource.h.

#define IDM_EXIT 40004

Definition at line 28 of file resource.h.

#define IDM_HUE 40008

Definition at line 32 of file resource.h.

#define IDM_OVER 40006

Definition at line 30 of file resource.h.

#define IDM_PROPERTIES 40005

Definition at line 29 of file resource.h.

#define IDR_MENU1 101

Definition at line 5 of file resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/Components/Cpp/Intermediate/Catlpwr.Cpp File Reference

  • Web
  • iis
  • Components
  • Cpp
  • Intermediate
Defines | Functions | Variables

Catlpwr.Cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include "initguid.h"
#include "CATLPwr.h"
#include "Power.h"
#include "CATLPwr_i.c"

Go to the source code of this file.

Defines

#define | IID_DEFINED

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Define Documentation

#define IID_DEFINED

Definition at line 18 of file Catlpwr.Cpp.

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 47 of file Catlpwr.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 55 of file Catlpwr.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 32 of file Catlpwr.Cpp.

{
  if (dwReason == DLL_PROCESS_ATTACH)
  {
    _Module.Init(ObjectMap, hInstance);
    DisableThreadLibraryCalls(hInstance);
  }
  else if (dwReason == DLL_PROCESS_DETACH)
    _Module.Term();
  return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 63 of file Catlpwr.Cpp.

{
  // registers object, typelib and all interfaces in typelib
  return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 72 of file Catlpwr.Cpp.

{
  _Module.UnregisterServer();
  return S_OK;
}

Variable Documentation

CComModule _Module

Definition at line 22 of file Catlpwr.Cpp.

Generated on Wed Nov 13 2024 16:54:48 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/Components/Cpp/Intermediate/Catlpwr.Idl File Reference

  • Web
  • iis
  • Components
  • Cpp
  • Intermediate
Functions

Catlpwr.Idl File Reference

Go to the source code of this file.

Functions

library CATLPwr | importlib ("stdole32.tlb")
HRESULT | myMethod ([in] BSTR bstrIn,[out, retval] BSTR *pbstrOut)
HRESULT | myPowerMethod ()
HRESULT | myPowerProperty ([out, retval] BSTR *pbstrOutValue)
HRESULT | myProperty ([out, retval] BSTR *pbstrOutValue)
HRESULT | myProperty ([in] BSTR bstrInValue)

Function Documentation

library CATLPwr importlib ( "stdole32.tlb" )
HRESULT myMethod | ( | [in] BSTR | bstrIn,
 |  | [out, retval] BSTR * | pbstrOut
 | ) |  |
HRESULT myPowerMethod ( )
HRESULT myPowerProperty ( [out, retval] BSTR * pbstrOutValue ) [get]
HRESULT myProperty ( [out, retval] BSTR * pbstrOutValue ) [get]
HRESULT myProperty ( [in] BSTR bstrInValue ) [set]
Generated on Wed Nov 13 2024 16:54:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/Components/Cpp/Intermediate/Context.Cpp File Reference

  • Web
  • iis
  • Components
  • Cpp
  • Intermediate

Context.Cpp File Reference

#include "stdafx.h"
#include <asptlb.h>
#include "context.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/Components/Cpp/Intermediate/Context.h File Reference

  • Web
  • iis
  • Components
  • Cpp
  • Intermediate
Classes

Context.h File Reference

Go to the source code of this file.

Classes

class CContext
Generated on Wed Nov 13 2024 16:54:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/Components/Cpp/Intermediate/Power.Cpp File Reference

  • Web
  • iis
  • Components
  • Cpp
  • Intermediate

Power.Cpp File Reference

#include "stdafx.h"
#include "CATLPwr.h"
#include "Power.h"
#include "context.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/Components/Cpp/Intermediate/Power.h File Reference

  • Web
  • iis
  • Components
  • Cpp
  • Intermediate
Classes

Power.h File Reference

#include "resource.h"
#include <asptlb.h>

Go to the source code of this file.

Classes

class CPower
Generated on Wed Nov 13 2024 16:54:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/Components/Cpp/Intermediate/Resource.h File Reference

  • Web
  • iis
  • Components
  • Cpp
  • Intermediate
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define IDS_POWER_DESC 1

Define Documentation

#define IDS_POWER_DESC 1

Definition at line 5 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/Components/Cpp/Intermediate/StdAfx.Cpp File Reference

  • Web
  • iis
  • Components
  • Cpp
  • Intermediate

StdAfx.Cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/Components/Cpp/Intermediate/StdAfx.h File Reference

  • Web
  • iis
  • Components
  • Cpp
  • Intermediate
Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <mtx.h>
#include <atlcom.h>

Go to the source code of this file.

Variables

CComModule _Module

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/Components/Cpp/MTXSample/Account.cpp File Reference

  • Web
  • iis
  • Components
  • Cpp
  • MTXSample
Variables

Account.cpp File Reference

#include "stdafx.h"
#include "BankVC.h"
#include "Account.h"
#include "CreateTable.h"

Go to the source code of this file.

Variables

CComBSTR CONNECTION

Variable Documentation

CComBSTR CONNECTION
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/Components/Cpp/MTXSample/Account.h File Reference

  • Web
  • iis
  • Components
  • Cpp
  • MTXSample
Classes

Account.h File Reference

#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Classes

class CAccount
Generated on Wed Nov 13 2024 16:54:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/Components/Cpp/MTXSample/BankVC.cpp File Reference

  • Web
  • iis
  • Components
  • Cpp
  • MTXSample
Functions | Variables

BankVC.cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include "BankVC.h"
#include "BankVC_i.c"
#include "Account.h"
#include "CreateTable.h"
#include "MoveMoney.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 46 of file BankVC.cpp.

{
  return (_Module.GetLockCount() == 0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 53 of file BankVC.cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 28 of file BankVC.cpp.

{
  if (dwReason == DLL_PROCESS_ATTACH)
  {
    _Module.Init(ObjectMap, hInstance, &LIBID_BANKVCLib);

    DisableThreadLibraryCalls(hInstance);
  }
  else if (dwReason == DLL_PROCESS_DETACH)
  {
    _Module.Term();
  }

  return TRUE;
}

STDAPI DllRegisterServer ( void )

Definition at line 60 of file BankVC.cpp.

{
  // registers object, typelib and all interfaces in typelib

  return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 69 of file BankVC.cpp.

{
  return _Module.UnregisterServer(TRUE);
}

Variable Documentation

CComModule _Module

Definition at line 18 of file BankVC.cpp.

Generated on Wed Nov 13 2024 16:54:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/Components/Cpp/MTXSample/BankVC.idl File Reference

  • Web
  • iis
  • Components
  • Cpp
  • MTXSample
Classes | Namespaces | Functions

BankVC.idl File Reference

Go to the source code of this file.

Classes

class | BANKVCLib::Account
class | BANKVCLib::CreateTable
class | BANKVCLib::MoveMoney
interface | IAccount
interface | ICreateTable
interface | IMoveMoney

Namespaces

namespace | BANKVCLib

Functions

BANKVCLib::importlib ("stdole32.tlb")
BANKVCLib::importlib ("stdole2.tlb")
Generated on Wed Nov 13 2024 16:54:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/Components/Cpp/MTXSample/CreateTable.cpp File Reference

  • Web
  • iis
  • Components
  • Cpp
  • MTXSample
Functions | Variables

CreateTable.cpp File Reference

#include "stdafx.h"
#include "BankVC.h"
#include "CreateTable.h"

Go to the source code of this file.

Functions

CComBSTR | CONNECTION ("FILEDSN=IISSAMPLE")

Variables

char | szSQL [] = "END"

Function Documentation

CComBSTR CONNECTION ( )

Variable Documentation

char szSQL[] = "END"

Definition at line 9 of file CreateTable.cpp.

Generated on Wed Nov 13 2024 16:54:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/Components/Cpp/MTXSample/CreateTable.h File Reference

  • Web
  • iis
  • Components
  • Cpp
  • MTXSample
Classes

CreateTable.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class CCreateTable
Generated on Wed Nov 13 2024 16:54:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/Components/Cpp/MTXSample/MoveMoney.cpp File Reference

  • Web
  • iis
  • Components
  • Cpp
  • MTXSample

MoveMoney.cpp File Reference

#include "stdafx.h"
#include "BankVC.h"
#include "MoveMoney.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/Components/Cpp/MTXSample/MoveMoney.h File Reference

  • Web
  • iis
  • Components
  • Cpp
  • MTXSample
Classes

MoveMoney.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class CMoveMoney
Generated on Wed Nov 13 2024 16:53:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/Components/Cpp/MTXSample/resource.h File Reference

  • Web
  • iis
  • Components
  • Cpp
  • MTXSample
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_ACCOUNT 101
#define | IDR_CREATETABLE 102
#define | IDR_MOVEMONEY 103
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_ACCOUNT 101

Definition at line 6 of file resource.h.

#define IDR_CREATETABLE 102

Definition at line 7 of file resource.h.

#define IDR_MOVEMONEY 103

Definition at line 8 of file resource.h.

#define IDS_PROJNAME 100

Definition at line 5 of file resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/Components/Cpp/MTXSample/StdAfx.cpp File Reference

  • Web
  • iis
  • Components
  • Cpp
  • MTXSample

StdAfx.cpp File Reference

#include "stdafx.h"
#include <atlimpl.cpp>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/Components/Cpp/MTXSample/StdAfx.h File Reference

  • Web
  • iis
  • Components
  • Cpp
  • MTXSample
Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>
#include <mtx.h>
#import <msado15.dll>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0400
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 16 of file StdAfx.h.

#define _WIN32_WINNT 0x0400

Definition at line 14 of file StdAfx.h.

#define STRICT

Definition at line 12 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/Components/Cpp/Simple/CatlSmpl.Cpp File Reference

  • Web
  • iis
  • Components
  • Cpp
  • Simple
Defines | Functions | Variables

CatlSmpl.Cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include "initguid.h"
#include "CATLSmpl.h"
#include "Simple.h"
#include "CATLSmpl_i.c"

Go to the source code of this file.

Defines

#define | IID_DEFINED

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Define Documentation

#define IID_DEFINED

Definition at line 9 of file CatlSmpl.Cpp.

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 35 of file CatlSmpl.Cpp.

{
  return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 42 of file CatlSmpl.Cpp.

{
  return _Module.GetClassObject(rclsid, riid, ppv);
}

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 21 of file CatlSmpl.Cpp.

{
  if (dwReason == DLL_PROCESS_ATTACH)
  {
    _Module.Init(ObjectMap, hInstance);
    DisableThreadLibraryCalls(hInstance);
  }
  else if (dwReason == DLL_PROCESS_DETACH)
    _Module.Term();
  return TRUE;    // ok
}

STDAPI DllRegisterServer ( void )

Definition at line 49 of file CatlSmpl.Cpp.

{
  // registers object, typelib and all interfaces in typelib
  return _Module.RegisterServer(TRUE);
}

STDAPI DllUnregisterServer ( void )

Definition at line 57 of file CatlSmpl.Cpp.

{
  _Module.UnregisterServer();
  return S_OK;
}

Variable Documentation

CComModule _Module

Definition at line 12 of file CatlSmpl.Cpp.

Generated on Wed Nov 13 2024 16:54:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/Components/Cpp/Simple/CatlSmpl.Idl File Reference

  • Web
  • iis
  • Components
  • Cpp
  • Simple
Functions

CatlSmpl.Idl File Reference

Go to the source code of this file.

Functions

library CATLSmpl | importlib ("stdole32.tlb")
HRESULT | myMethod ([in] BSTR bstrIn,[out, retval] BSTR *pbstrOut)
HRESULT | myProperty ([out, retval] BSTR *pbstrOutValue)
HRESULT | myProperty ([in] BSTR bstrInValue)

Function Documentation

library CATLSmpl importlib ( "stdole32.tlb" )
HRESULT myMethod | ( | [in] BSTR | bstrIn,
 |  | [out, retval] BSTR * | pbstrOut
 | ) |  |
HRESULT myProperty ( [out, retval] BSTR * pbstrOutValue ) [get]
HRESULT myProperty ( [in] BSTR bstrInValue ) [set]
Generated on Wed Nov 13 2024 16:54:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/Components/Cpp/Simple/Resource.h File Reference

  • Web
  • iis
  • Components
  • Cpp
  • Simple
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define IDS_SIMPLE_DESC 1

Define Documentation

#define IDS_SIMPLE_DESC 1

Definition at line 5 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/Components/Cpp/Simple/Simple.Cpp File Reference

  • Web
  • iis
  • Components
  • Cpp
  • Simple

Simple.Cpp File Reference

#include "stdafx.h"
#include "CATLSmpl.h"
#include "Simple.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/Components/Cpp/Simple/Simple.h File Reference

  • Web
  • iis
  • Components
  • Cpp
  • Simple
Classes

Simple.h File Reference

#include "resource.h"

Go to the source code of this file.

Classes

class CSimple
Generated on Wed Nov 13 2024 16:54:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/Components/Cpp/Simple/StdAfx.Cpp File Reference

  • Web
  • iis
  • Components
  • Cpp
  • Simple

StdAfx.Cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/Components/Cpp/Simple/StdAfx.h File Reference

  • Web
  • iis
  • Components
  • Cpp
  • Simple
Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>

Go to the source code of this file.

Variables

CComModule _Module

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/extensions/Chunk/cte_enc.c File Reference

  • Web
  • iis
  • extensions
  • Chunk
Classes | Defines | Typedefs | Functions

cte_enc.c File Reference

#include "ctetest.h"

Go to the source code of this file.

Classes

struct | CTE_ENCODER_STRUCT

Defines

#define | CTE_ENCODER_SIZE(dwChunkSize) (sizeof(CTE_ENCODER) + dwChunkSize + CTE_MAX_ENCODING_OVERHEAD)
#define | CTE_MAX_CHUNK_HEADER_SIZE 10
#define | CTE_MAX_ENCODING_OVERHEAD (CTE_MAX_CHUNK_HEADER_SIZE + 2)

Typedefs

typedef struct CTE_ENCODER_STRUCT | CTE_ENCODER

Functions

HCTE_ENCODER | CteBeginWrite (IN EXTENSION_CONTROL_BLOCK *pECB, IN DWORD dwChunkSize)
BOOL | CteEndWrite (IN HCTE_ENCODER h)
BOOL | CteWrite (IN HCTE_ENCODER h, IN PVOID pData, IN DWORD cbData)

Define Documentation

#define CTE_ENCODER_SIZE ( dwChunkSize ) (sizeof(CTE_ENCODER) + dwChunkSize + CTE_MAX_ENCODING_OVERHEAD)

Definition at line 47 of file cte_enc.c.

#define CTE_MAX_CHUNK_HEADER_SIZE 10

Definition at line 36 of file cte_enc.c.

#define CTE_MAX_ENCODING_OVERHEAD (CTE_MAX_CHUNK_HEADER_SIZE + 2)

Definition at line 40 of file cte_enc.c.

Typedef Documentation

typedef struct CTE_ENCODER_STRUCT CTE_ENCODER

Function Documentation

HCTE_ENCODER CteBeginWrite | ( | IN EXTENSION_CONTROL_BLOCK * | pECB,
 |  | IN DWORD | dwChunkSize
 | ) |  |

Definition at line 65 of file cte_enc.c.

{
  HCTE_ENCODER h;

  /* reject zero-length chunk size */

  if (dwChunkSize == 0) {

    SetLastError(ERROR_INVALID_PARAMETER);

    return NULL;
  }

  /* allocate context structure */

  h = LocalAlloc(LMEM_FIXED, CTE_ENCODER_SIZE(dwChunkSize));

  if (h != NULL) {

    /* initialize context structure */

    h->pECB         = pECB;
    h->dwChunkSize  = dwChunkSize;
    h->cbData       = 0;

    /* chunk data bytes follow the context structure itself and chunk header */

    h->pData = (BYTE *) h + sizeof( *h ) + CTE_MAX_CHUNK_HEADER_SIZE;

    /* this is the CRLF which follows chunk size (and immediately precedes data) */

    h->pData[-2] = '\r';
    h->pData[-1] = '\n';

  } else {

    SetLastError(ERROR_NOT_ENOUGH_MEMORY);
  }

  return h;
}

BOOL CteEndWrite ( IN HCTE_ENCODER h )

Definition at line 228 of file cte_enc.c.

{
  BOOL success;

  /* if there are some bytes in the chunk, send them */

  if (h->cbData)
    if (!CteSendChunk(h))
      return FALSE;

  /* send empty chunk (which means EOF) */

  success = CteSendChunk(h);

  /* release chunk transfer context */

  LocalFree(h);

  return success;
}

BOOL CteWrite | ( | IN HCTE_ENCODER | h,
 |  | IN PVOID | pData,
 |  | IN DWORD | cbData
 | ) |  |

Definition at line 181 of file cte_enc.c.

{
  DWORD cbToConsume;
  PBYTE pBytesToSend = (PBYTE) pData;

  for (;;) {

    /* compute the number of bytes to consume, break out of the loop, if nothing is left */

    cbToConsume = min(cbData, h->dwChunkSize - h->cbData);

    if (cbToConsume == 0)
      break;

    /* move bytes to the buffer, advance pointers and counters */

    memmove(h->pData + h->cbData, pBytesToSend, cbToConsume);

    h->cbData += cbToConsume;
    pBytesToSend += cbToConsume;
    cbData -= cbToConsume;

    /* if the chunk buffer is full, send it */

    if (h->cbData == h->dwChunkSize)
      if (!CteSendChunk(h))
        return FALSE;
  }

  return TRUE;
}

Generated on Wed Nov 13 2024 16:54:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/extensions/Chunk/ctetest.c File Reference

  • Web
  • iis
  • extensions
  • Chunk
Defines | Functions

ctetest.c File Reference

#include "ctetest.h"

Go to the source code of this file.

Defines

#define | DEFAULT_CHUNK_SIZE 1024

Functions

BOOL WINAPI | DllMain (IN HINSTANCE hInstance, IN DWORD fdwReason, IN LPVOID lpvReserved)
BOOL WINAPI | GetExtensionVersion (OUT HSE_VERSION_INFO *pVer)
DWORD WINAPI | HttpExtensionProc (IN EXTENSION_CONTROL_BLOCK *pECB)
BOOL WINAPI | TerminateExtension (DWORD dwFlags)

Define Documentation

#define DEFAULT_CHUNK_SIZE 1024

Definition at line 17 of file ctetest.c.

Function Documentation

BOOL WINAPI DllMain | ( | IN HINSTANCE | hInstance,
 |  | IN DWORD | fdwReason,
 |  | IN LPVOID | lpvReserved
 | ) |  |

Definition at line 172 of file ctetest.c.

{
  // Nothing needs to be done. This function exists a template.

  return TRUE;
}

BOOL WINAPI GetExtensionVersion ( OUT HSE_VERSION_INFO * pVer )

Definition at line 129 of file ctetest.c.

{
  // tell the server our version number and extension description

  pVer->dwExtensionVersion = MAKELONG(HSE_VERSION_MINOR, HSE_VERSION_MAJOR);

  lstrcpyn(pVer->lpszExtensionDesc, "ISAPI CTE test", HSE_MAX_EXT_DLL_NAME_LEN);

  return TRUE;
}

DWORD WINAPI HttpExtensionProc ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 44 of file ctetest.c.

{
  DWORD dwChunksize = 0;
  char szPath[MAX_PATH];
  char szHeaders[1024];
  DWORD cchPath = sizeof szPath;
  DWORD cchHeaders;
  char szChunkSize[32];

  /* if request method is not "GET", bail out */

  if (_stricmp(pECB->lpszMethod, "GET") != 0)
    return HSE_STATUS_ERROR;

  /* process chunksize= query argument, if any */

  if (GetQueryStringField(pECB->lpszQueryString, "chunksize", szChunkSize, sizeof szChunkSize))
    dwChunksize = atoi(szChunkSize);

  if (dwChunksize == 0)
    dwChunksize = DEFAULT_CHUNK_SIZE;

  /* process file= query argument */

  if (!GetQueryStringField(pECB->lpszQueryString, "file", szPath, cchPath)) {

    /* no file specified - display usage and report success */

    DisplayExampleUsage(pECB);

    return HSE_STATUS_SUCCESS;
  }

  /* use ServerSupportFunction to map virtual file name to local */
  /* path (otherwise users get access to any file on the system) */

  if (!pECB->ServerSupportFunction(pECB->ConnID, HSE_REQ_MAP_URL_TO_PATH, szPath, &cchPath, NULL))
    return HSE_STATUS_ERROR;

  /* see if we can get file attributes, report error if not */

  if (GetFileAttributes(szPath) == 0xFFFFFFFF)
    return HSE_STATUS_ERROR;

  /* begin preparing the headers */

  strcpy(szHeaders, "Transfer-encoding: chunked\r\nContent-type: ");

  /* obtain MIME type for this file and append it to the headers */

  cchHeaders = strlen(szHeaders);

  GetFileMimeType(szPath, szHeaders + cchHeaders, sizeof szHeaders - cchHeaders);

  /* terminate headers with empty line */

  strcat(szHeaders, "\r\n\r\n");

  /* try sending headers to the client */

  if (!SendHttpHeaders(pECB, "200 OK", szHeaders, TRUE))
    return HSE_STATUS_ERROR;

  /* try sending the file using CTE encoding */

  if (!SendChunkedFile(pECB, dwChunksize, szPath))
    return HSE_STATUS_ERROR;

  return HSE_STATUS_SUCCESS;
}

BOOL WINAPI TerminateExtension ( DWORD dwFlags )

Definition at line 156 of file ctetest.c.

{
  return TRUE;
}

Generated on Wed Nov 13 2024 16:54:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/extensions/Chunk/ctetest.h File Reference

  • Web
  • iis
  • extensions
  • Chunk
Typedefs | Functions

ctetest.h File Reference

#include <httpext.h>
#include <stdlib.h>
#include <stdio.h>

Go to the source code of this file.

Typedefs

typedef struct CTE_ENCODER_STRUCT * | HCTE_ENCODER

Functions

HCTE_ENCODER | CteBeginWrite (IN EXTENSION_CONTROL_BLOCK *pECB, IN DWORD dwChunkSize)
BOOL | CteEndWrite (IN HCTE_ENCODER h)
BOOL | CteWrite (IN HCTE_ENCODER h, IN PVOID pData, IN DWORD cbData)

Typedef Documentation

typedef struct CTE_ENCODER_STRUCT* HCTE_ENCODER

Definition at line 27 of file ctetest.h.

Function Documentation

HCTE_ENCODER CteBeginWrite | ( | IN EXTENSION_CONTROL_BLOCK * | pECB,
 |  | IN DWORD | dwChunkSize
 | ) |  |

Definition at line 65 of file cte_enc.c.

{
  HCTE_ENCODER h;

  /* reject zero-length chunk size */

  if (dwChunkSize == 0) {

    SetLastError(ERROR_INVALID_PARAMETER);

    return NULL;
  }

  /* allocate context structure */

  h = LocalAlloc(LMEM_FIXED, CTE_ENCODER_SIZE(dwChunkSize));

  if (h != NULL) {

    /* initialize context structure */

    h->pECB         = pECB;
    h->dwChunkSize  = dwChunkSize;
    h->cbData       = 0;

    /* chunk data bytes follow the context structure itself and chunk header */

    h->pData = (BYTE *) h + sizeof( *h ) + CTE_MAX_CHUNK_HEADER_SIZE;

    /* this is the CRLF which follows chunk size (and immediately precedes data) */

    h->pData[-2] = '\r';
    h->pData[-1] = '\n';

  } else {

    SetLastError(ERROR_NOT_ENOUGH_MEMORY);
  }

  return h;
}

BOOL CteEndWrite ( IN HCTE_ENCODER h )

Definition at line 228 of file cte_enc.c.

{
  BOOL success;

  /* if there are some bytes in the chunk, send them */

  if (h->cbData)
    if (!CteSendChunk(h))
      return FALSE;

  /* send empty chunk (which means EOF) */

  success = CteSendChunk(h);

  /* release chunk transfer context */

  LocalFree(h);

  return success;
}

BOOL CteWrite | ( | IN HCTE_ENCODER | h,
 |  | IN PVOID | pData,
 |  | IN DWORD | cbData
 | ) |  |

Definition at line 181 of file cte_enc.c.

{
  DWORD cbToConsume;
  PBYTE pBytesToSend = (PBYTE) pData;

  for (;;) {

    /* compute the number of bytes to consume, break out of the loop, if nothing is left */

    cbToConsume = min(cbData, h->dwChunkSize - h->cbData);

    if (cbToConsume == 0)
      break;

    /* move bytes to the buffer, advance pointers and counters */

    memmove(h->pData + h->cbData, pBytesToSend, cbToConsume);

    h->cbData += cbToConsume;
    pBytesToSend += cbToConsume;
    cbData -= cbToConsume;

    /* if the chunk buffer is full, send it */

    if (h->cbData == h->dwChunkSize)
      if (!CteSendChunk(h))
        return FALSE;
  }

  return TRUE;
}

Generated on Wed Nov 13 2024 16:54:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/extensions/DumpVars/DumpVars.cpp File Reference

  • Web
  • iis
  • extensions
  • DumpVars
Defines | Functions

DumpVars.cpp File Reference

#include <windows.h>
#include <httpext.h>

Go to the source code of this file.

Defines

#define | VAR_BUFFER_SIZE 1024
#define | WIN32_LEAN_AND_MEAN

Functions

BOOL WINAPI | GetExtensionVersion (OUT HSE_VERSION_INFO *pVer)
DWORD WINAPI | HttpExtensionProc (IN EXTENSION_CONTROL_BLOCK *pECB)
BOOL WINAPI | TerminateExtension (IN DWORD dwFlags)

Define Documentation

#define VAR_BUFFER_SIZE 1024

Definition at line 15 of file DumpVars.cpp.

#define WIN32_LEAN_AND_MEAN

Definition at line 11 of file DumpVars.cpp.

Function Documentation

BOOL WINAPI GetExtensionVersion ( OUT HSE_VERSION_INFO * pVer )

Definition at line 161 of file DumpVars.cpp.

{
  pVer->dwExtensionVersion = MAKELONG(HSE_VERSION_MINOR, HSE_VERSION_MAJOR);

  lstrcpyn(pVer->lpszExtensionDesc, "DumpVars ISAPI Sample", HSE_MAX_EXT_DLL_NAME_LEN);

  return TRUE;
}

DWORD WINAPI HttpExtensionProc ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 29 of file DumpVars.cpp.

{
  char *aszServerVariables[] = {
    "APPL_MD_PATH", "APPL_PHYSICAL_PATH", "AUTH_PASSWORD",
    "AUTH_TYPE", "AUTH_USER", "CERT_COOKIE", "CERT_FLAGS",
    "CERT_ISSUER", "CERT_KEYSIZE", "CERT_SECRETKEYSIZE",
    "CERT_SERIALNUMBER", "CERT_SERVER_ISSUER",
    "CERT_SERVER_SUBJECT", "CERT_SUBJECT", "CONTENT_LENGTH",
    "CONTENT_TYPE", "HTTP_ACCEPT", "HTTPS", "HTTPS_KEYSIZE",
    "HTTPS_SECRETKEYSIZE", "HTTPS_SERVER_ISSUER",
    "HTTPS_SERVER_SUBJECT", "INSTANCE_ID", "INSTANCE_META_PATH",
    "PATH_INFO", "PATH_TRANSLATED", "QUERY_STRING",
    "REMOTE_ADDR", "REMOTE_HOST", "REMOTE_USER",
    "REQUEST_METHOD", "SCRIPT_NAME", "SERVER_NAME",
    "SERVER_PORT", "SERVER_PORT_SECURE", "SERVER_PROTOCOL",
    "SERVER_SOFTWARE", "URL"};

  DWORD dwBuffSize;
  DWORD dwError;

  HSE_SEND_HEADER_EX_INFO HeaderExInfo;

  // Send headers to the client

  HeaderExInfo.pszStatus = "200 OK";
  HeaderExInfo.pszHeader = "Content-type: text/html\r\n\r\n";
  HeaderExInfo.cchStatus = strlen(HeaderExInfo.pszStatus);
  HeaderExInfo.cchHeader = strlen(HeaderExInfo.pszHeader);
  HeaderExInfo.fKeepConn = FALSE;

  pECB->ServerSupportFunction(pECB->ConnID, HSE_REQ_SEND_RESPONSE_HEADER_EX, &HeaderExInfo, NULL, NULL);

  // Begin sending back HTML to the client

  char szHeader[] = "<HTML>\r\n<BODY><h1>Server Variable Dump</h1>\r\n<hr>\r\n";

  dwBuffSize = strlen(szHeader);

  pECB->WriteClient(pECB->ConnID, szHeader, &dwBuffSize, 0);

  DWORD dwNumVars = (sizeof aszServerVariables ) / (sizeof aszServerVariables[0]);

  // Get the server variables and send them

  for (DWORD x = 0; x < dwNumVars; x++) {

    dwBuffSize = VAR_BUFFER_SIZE;

    char szValue[VAR_BUFFER_SIZE] = "";

    if (!pECB->GetServerVariable(pECB->ConnID, aszServerVariables[x], szValue, &dwBuffSize)) {

      // Analyze the problem and report result to user

      switch (dwError = GetLastError( )) {

        case ERROR_INVALID_PARAMETER :

          strcpy(szValue, "ERROR_INVALID_PARAMETER");

          break;

        case ERROR_INVALID_INDEX :

          strcpy(szValue, "ERROR_INVALID_INDEX");

          break;

        case ERROR_INSUFFICIENT_BUFFER :

          wsprintf(szValue, "ERROR_INSUFFICIENT_BUFFER - %d bytes required.", dwBuffSize);

          break;

        case ERROR_MORE_DATA :

          strcpy(szValue, "ERROR_MORE_DATA");

          break;

        case ERROR_NO_DATA :

          strcpy(szValue, "ERROR_NO_DATA");

          break;

        default :

          wsprintf(szValue, "*** Error %d occured retrieving server variable ***", dwError);

          break;
      }
    }

    // Dump server variable name and value. Note that the buffer size for this output
    // is much more than is needed. In a production environment, a dynamically-allocated
    // buffer, properly sized, would make more sense.

    char szOutput[VAR_BUFFER_SIZE * 2];

    wsprintf(szOutput, "%s: %s<br>\r\n", aszServerVariables[x], szValue);

    dwBuffSize = strlen(szOutput);

    // Send the line to client

    pECB->WriteClient(pECB->ConnID, szOutput, &dwBuffSize, 0);
  }

  // End HTML page

  char szFooter[] = "</BODY>\r\n</HTML>\r\n\r\n";

  dwBuffSize = strlen(szFooter);

  pECB->WriteClient(pECB->ConnID, szFooter, &dwBuffSize, 0);

  return HSE_STATUS_SUCCESS;
}

BOOL WINAPI TerminateExtension ( IN DWORD dwFlags )

Definition at line 182 of file DumpVars.cpp.

{
  return TRUE;
}

Generated on Wed Nov 13 2024 16:54:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/extensions/Formdump/formdump.cpp File Reference

  • Web
  • iis
  • extensions
  • Formdump
Defines | Functions

formdump.cpp File Reference

#include <windows.h>
#include <ctype.h>
#include <httpext.h>
#include "keys.h"
#include "html.h"

Go to the source code of this file.

Defines

#define | MAX_BUFFER 4096
#define | WIN32_LEAN_AND_MEAN

Functions

void | DumpVariable (IN EXTENSION_CONTROL_BLOCK *pECB, IN LPCTSTR szName)
BOOL WINAPI | GetExtensionVersion (OUT HSE_VERSION_INFO *pVer)
void | HexDumper (EXTENSION_CONTROL_BLOCK *pECB, LPBYTE lpbyBuf, DWORD dwLength)
void | HexDumper (IN EXTENSION_CONTROL_BLOCK *pECB, IN LPBYTE lpbyBuf, IN DWORD dwLength)
DWORD WINAPI | HttpExtensionProc (IN EXTENSION_CONTROL_BLOCK *pECB)
BOOL | SendHttpHeaders (EXTENSION_CONTROL_BLOCK *, LPCSTR, LPCSTR)
void | SendVariables (IN EXTENSION_CONTROL_BLOCK *pECB)
void | SendVariables (EXTENSION_CONTROL_BLOCK *pECB)
BOOL WINAPI | TerminateExtension (DWORD dwFlags)
void | WhoAmI (IN EXTENSION_CONTROL_BLOCK *pECB)
void | WhoAmI (EXTENSION_CONTROL_BLOCK *pECB)

Define Documentation

#define MAX_BUFFER 4096

Definition at line 20 of file formdump.cpp.

#define WIN32_LEAN_AND_MEAN

Definition at line 12 of file formdump.cpp.

Function Documentation

void DumpVariable | ( | IN EXTENSION_CONTROL_BLOCK * | pECB,
 |  | IN LPCTSTR | szName
 | ) |  |

Definition at line 293 of file formdump.cpp.

{
  char szBuffer[MAX_BUFFER];

  DWORD dwBufferSize = sizeof szBuffer;

  if (dwBufferSize > MAX_BUFFER)
    return;

  BOOL bReturn = pECB->GetServerVariable(pECB->ConnID, (LPSTR)szName, szBuffer, &dwBufferSize);

  if (!bReturn || !szBuffer[0])
    return;

  HtmlWriteText(pECB, szName);
  HtmlWriteText(pECB, "=");
  HtmlWriteText(pECB, szBuffer);
  HtmlLineBreak(pECB);
}

BOOL WINAPI GetExtensionVersion ( OUT HSE_VERSION_INFO * pVer )

Definition at line 41 of file formdump.cpp.

{
  // set version to httpext.h version constants

  pVer->dwExtensionVersion = MAKELONG(HSE_VERSION_MINOR, HSE_VERSION_MAJOR);

  lstrcpyn((LPSTR) pVer->lpszExtensionDesc, "FORMDUMP - A Form Decoder and Dumper", HSE_MAX_EXT_DLL_NAME_LEN);

  return TRUE;
}

void HexDumper | ( | EXTENSION_CONTROL_BLOCK * | pECB,
 |  | LPBYTE | lpbyBuf,
 |  | DWORD | dwLength
 | ) |  |
void HexDumper | ( | IN EXTENSION_CONTROL_BLOCK * | pECB,
 |  | IN LPBYTE | lpbyBuf,
 |  | IN DWORD | dwLength
 | ) |  |

Definition at line 219 of file formdump.cpp.

{
  DWORD dwPos = 0;

  HtmlBeginPreformattedText(pECB);

  while (dwLength) {

    // Take min of 16 or dwLength

    DWORD dwSize = min(16, dwLength );

    // Build text line

    char szLine[80];

    wsprintf(szLine, "  %04X ", dwPos);

    for (DWORD i = 0; i < dwSize; i++) {

      char szHex[3];

      wsprintf(szHex, "%02X", lpbyBuf[i]);

      lstrcat(szLine, szHex);
      lstrcat(szLine, " " );
    }

    // Add spaces for short lines

    for (DWORD i = strlen(szLine); i < 16; i++)
      lstrcat(szLine, "   ");

    // Add ASCII chars

    for (i = 0; i < dwSize; i++) {

      if (isprint(lpbyBuf[i])) {

        char szHex[3];

        wsprintf(szHex, "%c", lpbyBuf[i]);

        lstrcat(szLine, szHex );

      } else {

        lstrcat(szLine, "." );
      }
    }

    // Write data to web page

    HtmlWriteTextLine(pECB, szLine);

    // Advance positions

    dwLength -= dwSize;
    dwPos += dwSize;
    lpbyBuf += dwSize;
  }

  HtmlEndPreformattedText(pECB);
}

DWORD WINAPI HttpExtensionProc ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 66 of file formdump.cpp.

{
  // Get the keys sent by the client

  HKEYLIST hKeyList = GetKeyList(pECB);

  // Send HTTP headers

  SendHttpHeaders(pECB, "200 OK", "Content-type: text/html\r\n\r\n");

  // Create a basic HTML page

  HtmlCreatePage(pECB, "FormDump.dll Reply");
  HtmlHeading(pECB, 1, "Data Available via ISAPI");
  HtmlHorizontalRule(pECB);

  // Send each form field

  HtmlHeading(pECB, 2, "Form Fields");

  if (!hKeyList) {

    // Report no data/error

    HtmlBold(pECB, "No form fields sent");
    HtmlWriteText(pECB, " (or error decoding keys)");
    HtmlEndParagraph(pECB);

  } else {

    // Print a quick overview

    HtmlWriteTextLine(pECB, "The form you submitted data to just called");
    HtmlWriteTextLine(pECB, "the Internet Information Server extension");
    HtmlWriteTextLine(pECB, "FormDump.dll.  Here is a listing of what was");
    HtmlWriteTextLine(pECB, "received and what variables inside FormDump");
    HtmlWriteTextLine(pECB, "have the data.");
    HtmlEndParagraph(pECB);

    // Loop through all of the keys

    HKEYLIST hKey = hKeyList;

    while (hKey) {

      // Details about the key

      LPCTSTR lpszKeyName;
      DWORD dwLength;
      BOOL bHasCtrlChars;
      int nInstance;

      // We get info, and hKey points to next key in list

      HKEYLIST hLastKey = hKey;    // keep this for later

      hKey = GetKeyInfo(hKey, &lpszKeyName, &dwLength, &bHasCtrlChars, &nInstance);

      // Build web page

      HtmlBold(pECB, "Form Field Name (lpszKeyName): ");
      HtmlWriteText(pECB, lpszKeyName);
      HtmlLineBreak(pECB);

      char szMsg[32];

      HtmlBold(pECB, "Length of Data (dwLength): ");
      wsprintf(szMsg, "%u", dwLength);
      HtmlWriteText(pECB, szMsg);
      HtmlLineBreak(pECB);

      HtmlBold(pECB, "Data Has Control Characters (bHasCtrlChars): ");
      wsprintf(szMsg, "%u", bHasCtrlChars);
      HtmlWriteText(pECB, szMsg);
      HtmlLineBreak(pECB);

      HtmlBold(pECB, "Instance of Form Field (nInstance): ");
      wsprintf(szMsg, "%u", nInstance);
      HtmlWriteText(pECB, szMsg);

      if (dwLength) {

        HtmlLineBreak(pECB);
        HtmlBold(pECB, "Data Sent for Field:");
        HtmlLineBreak(pECB);

        HexDumper(pECB, GetKeyBuffer(hLastKey), dwLength);
      }

      HtmlEndParagraph(pECB);
    }

    // Clean up

    FreeKeyList(hKeyList);
  }

  HtmlHorizontalRule(pECB);

  // Get user name from SID and return it in the page

  HtmlHeading(pECB, 2, "Security Context for HttpExtensionProc Thread");
  WhoAmI(pECB);
  HtmlHorizontalRule(pECB);

  // Display all server variables

  HtmlHeading(pECB, 2, "Server Variables");
  HtmlWriteTextLine(pECB, "Below is a list of all variables available via");
  HtmlWriteTextLine(pECB, "GetServerVariable ISAPI API.  Much of this");
  HtmlWriteTextLine(pECB, "information comes from the browser HTTP header.");
  HtmlEndParagraph(pECB);

  // Send server variables obtained from the HTTP header

  SendVariables(pECB);

  // Finish up...

  HtmlEndPage(pECB);

  return HSE_STATUS_SUCCESS;
}

BOOL SendHttpHeaders | ( | EXTENSION_CONTROL_BLOCK * | pECB,
 |  | LPCSTR | pszStatus,
 |  | LPCSTR | pszHeaders
 | ) |  |

Definition at line 330 of file formdump.cpp.

{
  HSE_SEND_HEADER_EX_INFO header_ex_info;

  header_ex_info.pszStatus = pszStatus;
  header_ex_info.pszHeader = pszHeaders;
  header_ex_info.cchStatus = strlen(pszStatus);
  header_ex_info.cchHeader = strlen(pszHeaders);
  header_ex_info.fKeepConn = FALSE;

  return pECB->ServerSupportFunction(pECB->ConnID, HSE_REQ_SEND_RESPONSE_HEADER_EX, &header_ex_info, NULL, NULL);
}

void SendVariables ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 351 of file formdump.cpp.

{
  char szBuffer[4096];

  // Dump the standard variables

  DumpVariable(pECB, "AUTH_TYPE");
  DumpVariable(pECB, "CONTENT_LENGTH");
  DumpVariable(pECB, "CONTENT_TYPE");
  DumpVariable(pECB, "GATEWAY_INTERFACE");
  DumpVariable(pECB, "PATH_INFO");
  DumpVariable(pECB, "PATH_TRANSLATED");
  DumpVariable(pECB, "QUERY_STRING");
  DumpVariable(pECB, "REMOTE_ADDR");
  DumpVariable(pECB, "REMOTE_HOST");
  DumpVariable(pECB, "REMOTE_USER");
  DumpVariable(pECB, "REQUEST_METHOD");
  DumpVariable(pECB, "SCRIPT_NAME");
  DumpVariable(pECB, "SERVER_NAME");
  DumpVariable(pECB, "SERVER_PORT");
  DumpVariable(pECB, "SERVER_PROTOCOL");
  DumpVariable(pECB, "SERVER_SOFTWARE");
  DumpVariable(pECB, "AUTH_PASS");

  // Dump any others (in ALL_HTTP)

  DWORD dwBufferSize = sizeof szBuffer;

  BOOL bReturn = pECB->GetServerVariable(pECB->ConnID, "ALL_HTTP", szBuffer, &dwBufferSize);

  if (bReturn) {

    //
    // Find lines, split key/data pair and write them as output
    //

    char *pChar = szBuffer;

    while (*pChar) {

      if (*pChar == '\r' || *pChar == '\n') {

        pChar++;

        continue;
      }

      char *pOpts = strchr(pChar, ':');   // look for separator

      if (!pOpts)
          break;

      if (!*pOpts)
          break;

      char *pEnd = pOpts;

      while (*pEnd && *pEnd != '\r' && *pEnd != '\n')
        pEnd++;

      *pOpts = 0;         // split strings

      *pEnd = 0;

      // pChar points to variable name, pOpts + 1 points to variable val

      HtmlWriteText(pECB, pChar);
      HtmlWriteText(pECB, "=");
      HtmlWriteText(pECB, pOpts + 1);
      HtmlLineBreak(pECB);

      pChar = pEnd + 1;
    }
  }

  HtmlEndParagraph(pECB);
  HtmlHorizontalRule(pECB);
}

void SendVariables ( EXTENSION_CONTROL_BLOCK * pECB )
BOOL WINAPI TerminateExtension ( DWORD dwFlags )

Definition at line 204 of file formdump.cpp.

{
  return TRUE;
}

void WhoAmI ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 438 of file formdump.cpp.

{
  HANDLE hToken;
  BYTE byBuf[1024];
  DWORD dwLen;

  SID_NAME_USE eUse;

  if (!OpenThreadToken(GetCurrentThread( ), TOKEN_QUERY, TRUE, &hToken)) {

    DWORD dwError = GetLastError();

    HtmlBold(pECB, "OpenThreadToken failed. ");
    HtmlPrintf(pECB, "Error code=%u", dwError);
    HtmlEndParagraph(pECB);

    return;
  }

  PTOKEN_USER pTokenUser = (PTOKEN_USER)byBuf;

  if (!GetTokenInformation(hToken, TokenUser, pTokenUser, sizeof byBuf, &dwLen)) {

    DWORD dwError = GetLastError();

    CloseHandle(hToken);

    HtmlBold(pECB, "GetTokenInformation failed. ");
    HtmlPrintf(pECB, "Error code=%u dwLen=%u", dwError, dwLen);
    HtmlEndParagraph(pECB);

    return;
  }

  char szName[256], szDomain[256];

  DWORD dwNameLen = sizeof szName;
  DWORD dwDomainLen = sizeof szDomain;

  if (!LookupAccountSid(NULL, pTokenUser->User.Sid, szName, &dwNameLen, szDomain, &dwDomainLen, &eUse)) {

    DWORD dwError = GetLastError();

    CloseHandle(hToken);

    HtmlBold(pECB, "LookupAccountSid failed. ");
    HtmlPrintf(pECB, "Error code=%u dwNameLen=%u dwDomainLen=%u", dwError, dwNameLen, dwDomainLen);
    HtmlEndParagraph(pECB);

    return;
  }

  HtmlBold(pECB, "Domain: ");
  HtmlWriteText(pECB, szDomain);
  HtmlLineBreak(pECB);
  HtmlBold(pECB, "User: ");
  HtmlWriteText(pECB, szName);
  HtmlEndParagraph(pECB);

  CloseHandle( hToken );
}

void WhoAmI ( EXTENSION_CONTROL_BLOCK * pECB )
Generated on Wed Nov 13 2024 16:54:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/extensions/Formdump/html.cpp File Reference

  • Web
  • iis
  • extensions
  • Formdump
Defines | Functions

html.cpp File Reference

#include <windows.h>
#include <httpext.h>
#include <stdio.h>
#include <stdarg.h>
#include "html.h"

Go to the source code of this file.

Defines

#define | WIN32_LEAN_AND_MEAN

Functions

void | HtmlBeginAddress (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlBeginBlockQuote (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlBeginBold (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlBeginCitation (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlBeginCode (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlBeginDefine (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlBeginDefinition (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlBeginDefinitionList (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlBeginDefinitionTerm (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlBeginEmphasis (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlBeginFixed (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlBeginHeading (IN EXTENSION_CONTROL_BLOCK *pECB, IN int nHeading)
void | HtmlBeginItalic (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlBeginKeyboard (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlBeginListItem (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlBeginNumberedList (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlBeginPreformattedText (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlBeginStatus (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlBeginStrong (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlBeginUnnumberedList (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlBeginVariable (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlBold (IN EXTENSION_CONTROL_BLOCK *pECB, IN LPCSTR lpszText)
void | HtmlBookmarkLink (IN EXTENSION_CONTROL_BLOCK *pECB, IN LPCSTR lpszBookmark, IN LPCSTR lpszText)
void | HtmlCreatePage (IN EXTENSION_CONTROL_BLOCK *pECB, IN LPCSTR lpszTitle)
void | HtmlDefinition (IN EXTENSION_CONTROL_BLOCK *pECB, IN LPCSTR lpszTerm, IN LPSTR lpszDef)
void | HtmlEndAddress (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlEndBlockQuote (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlEndBold (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlEndCitation (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlEndCode (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlEndDefine (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlEndDefinitionList (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlEndEmphasis (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlEndFixed (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlEndHeading (IN EXTENSION_CONTROL_BLOCK *pECB, IN int nHeading)
void | HtmlEndItalic (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlEndKeyboard (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlEndNumberedList (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlEndPage (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlEndParagraph (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlEndPreformattedText (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlEndStatus (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlEndStrong (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlEndUnnumberedList (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlEndVariable (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlFixed (IN EXTENSION_CONTROL_BLOCK *pECB, IN LPCSTR lpszText)
void | HtmlHeading (IN EXTENSION_CONTROL_BLOCK *pECB, IN int nHeading, IN LPCSTR lpszText)
void | HtmlHorizontalRule (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlHyperLink (IN EXTENSION_CONTROL_BLOCK *pECB, IN LPCSTR lpszDoc, IN LPCSTR lpszText)
void | HtmlHyperLinkAndBookmark (IN EXTENSION_CONTROL_BLOCK *pECB, IN LPCSTR lpszDoc, IN LPCSTR lpszBookmark, IN LPCSTR lpszText)
void | HtmlImage (IN EXTENSION_CONTROL_BLOCK *pECB, IN LPCSTR lpszPicFile, IN LPCSTR lpszAltText)
void | HtmlItalic (IN EXTENSION_CONTROL_BLOCK *pECB, IN LPCSTR lpszText)
void | HtmlLineBreak (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlPrintf (IN EXTENSION_CONTROL_BLOCK *pECB, IN LPCSTR lpszFormat,...)
void | HtmlWriteText (IN EXTENSION_CONTROL_BLOCK *pECB, IN LPCSTR lpsz)
void | HtmlWriteTextLine (IN EXTENSION_CONTROL_BLOCK *pECB, IN LPCSTR lpsz)
void | WriteString (IN EXTENSION_CONTROL_BLOCK *pECB, IN LPCSTR lpsz)

Define Documentation

#define WIN32_LEAN_AND_MEAN

Definition at line 11 of file html.cpp.

Function Documentation

void HtmlBeginAddress ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 314 of file html.cpp.

{
  WriteString(pECB, "<ADDRESS>");
}

void HtmlBeginBlockQuote ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 298 of file html.cpp.

{
  WriteString(pECB, "<BLOCKQUOTE>");
}

void HtmlBeginBold ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 462 of file html.cpp.

{
  WriteString(pECB, "<B>");
}

void HtmlBeginCitation ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 362 of file html.cpp.

{
  WriteString(pECB, "<CITE>");
}

void HtmlBeginCode ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 378 of file html.cpp.

{
  WriteString(pECB, "<CODE>");
}

void HtmlBeginDefine ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 330 of file html.cpp.

{
  WriteString(pECB, "<DFN>");
}

void HtmlBeginDefinition ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 275 of file html.cpp.

{
  WriteString(pECB, "<DD>");
}

void HtmlBeginDefinitionList ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 193 of file html.cpp.

{
  WriteString(pECB, "<DL>");
}

void HtmlBeginDefinitionTerm ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 270 of file html.cpp.

{
  WriteString(pECB, "<DT>");
}

void HtmlBeginEmphasis ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 346 of file html.cpp.

{
  WriteString(pECB, "<EM>");
}

void HtmlBeginFixed ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 502 of file html.cpp.

{
  WriteString(pECB, "<TT>");
}

void HtmlBeginHeading | ( | IN EXTENSION_CONTROL_BLOCK * | pECB,
 |  | IN int | nHeading
 | ) |  |

Definition at line 54 of file html.cpp.

{
  char szCode[16];

  wsprintf(szCode, "<H%i>", nHeading);
  WriteString(pECB, szCode);
}

void HtmlBeginItalic ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 482 of file html.cpp.

{
  WriteString(pECB, "<I>");
}

void HtmlBeginKeyboard ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 394 of file html.cpp.

{
  WriteString(pECB, "<KBD>");
}

void HtmlBeginListItem ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 163 of file html.cpp.

{
  WriteString(pECB, "<LI>");
}

void HtmlBeginNumberedList ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 177 of file html.cpp.

{
  WriteString(pECB, "<OL>");
}

void HtmlBeginPreformattedText ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 282 of file html.cpp.

{
  WriteString(pECB, "<PRE>");
}

void HtmlBeginStatus ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 410 of file html.cpp.

{
  WriteString(pECB, "<SAMP>");
}

void HtmlBeginStrong ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 426 of file html.cpp.

{
  WriteString(pECB, "<STRONG>");
}

void HtmlBeginUnnumberedList ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 157 of file html.cpp.

{
  WriteString(pECB, "<UL>\r\n");
}

void HtmlBeginVariable ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 440 of file html.cpp.

{
  WriteString(pECB, "<VAR>");
}

void HtmlBold | ( | IN EXTENSION_CONTROL_BLOCK * | pECB,
 |  | IN LPCSTR | lpszText
 | ) |  |

Definition at line 454 of file html.cpp.

{
  HtmlBeginBold(pECB);
  HtmlWriteText(pECB, lpszText);
  HtmlEndBold(pECB);
}

void HtmlBookmarkLink | ( | IN EXTENSION_CONTROL_BLOCK * | pECB,
 |  | IN LPCSTR | lpszBookmark,
 |  | IN LPCSTR | lpszText
 | ) |  |

Definition at line 150 of file html.cpp.

{
  HtmlHyperLinkAndBookmark(pECB, NULL, lpszBookmark, lpszText);
}

void HtmlCreatePage | ( | IN EXTENSION_CONTROL_BLOCK * | pECB,
 |  | IN LPCSTR | lpszTitle
 | ) |  |

Definition at line 27 of file html.cpp.

{
  WriteString(pECB, "<HTML>\r\n\r\n");

  if (lpszTitle) {
    WriteString(pECB, "<HEAD><TITLE>");
    HtmlWriteText(pECB, lpszTitle);
    WriteString(pECB, "</TITLE></HEAD>\r\n\r\n");
  }
  WriteString(pECB, "<BODY>\r\n\r\n");
}

void HtmlDefinition | ( | IN EXTENSION_CONTROL_BLOCK * | pECB,
 |  | IN LPCSTR | lpszTerm,
 |  | IN LPSTR | lpszDef
 | ) |  |

Definition at line 209 of file html.cpp.

{
  WriteString(pECB, "<DT> ");
  HtmlWriteText(pECB, lpszTerm);
  WriteString(pECB, "\r\n");
  WriteString(pECB, "<DD> ");

  int nStart = 0;
  int nLen = lstrlen(lpszDef);

  do {

    int nEnd = nStart + 70;

    if (nEnd >= nLen) {

      HtmlWriteText(pECB, &lpszDef[nStart]);
      WriteString(pECB, "\r\n");

      break;
    }

    while (nEnd > nStart)
      if (lpszDef[nEnd] == ' ')
        break;

    if (nEnd == nStart)

      // too long!

      nEnd = nStart + 70;

    // write defintion segment

    char tcHolder = lpszDef[nEnd];

    lpszDef[nEnd] = 0;

    HtmlWriteText(pECB, &lpszDef[nStart]);

    WriteString(pECB, "\r\n");

    lpszDef[nEnd] = tcHolder;

    nStart = nEnd;

    // skip excess whitespace

    while (lpszDef[nStart] == ' ')
      nStart++;

    // pretty formatting

    if (nStart < nLen)
      WriteString(pECB, "     ");

  } while (nStart < nLen);
}

void HtmlEndAddress ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 322 of file html.cpp.

{
  WriteString(pECB, "</ADDRESS>");
}

void HtmlEndBlockQuote ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 306 of file html.cpp.

{
  WriteString(pECB, "</BLOCKQUOTE>");
}

void HtmlEndBold ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 468 of file html.cpp.

{
  WriteString(pECB, "</B>");
}

void HtmlEndCitation ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 370 of file html.cpp.

{
  WriteString(pECB, "</CITE>");
}

void HtmlEndCode ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 386 of file html.cpp.

{
  WriteString(pECB, "</CODE>");
}

void HtmlEndDefine ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 338 of file html.cpp.

{
  WriteString(pECB, "</DFN>");
}

void HtmlEndDefinitionList ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 201 of file html.cpp.

{
  WriteString(pECB, "</DL>");
}

void HtmlEndEmphasis ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 354 of file html.cpp.

{
  WriteString(pECB, "</EM>");
}

void HtmlEndFixed ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 508 of file html.cpp.

{
  WriteString(pECB, "</TT>");
}

void HtmlEndHeading | ( | IN EXTENSION_CONTROL_BLOCK * | pECB,
 |  | IN int | nHeading
 | ) |  |

Definition at line 63 of file html.cpp.

{
  char szCode[16];

  wsprintf(szCode, "</H%i>", nHeading);
  WriteString(pECB, szCode);
}

void HtmlEndItalic ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 488 of file html.cpp.

{
  WriteString(pECB, "</I>");
}

void HtmlEndKeyboard ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 402 of file html.cpp.

{
  WriteString(pECB, "</KBD>");
}

void HtmlEndNumberedList ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 185 of file html.cpp.

{
  WriteString(pECB, "</OL>");
}

void HtmlEndPage ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 39 of file html.cpp.

{
  WriteString(pECB, "</BODY>\r\n\r\n");
  WriteString(pECB, "</HTML>\r\n");
}

void HtmlEndParagraph ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 116 of file html.cpp.

{
  WriteString(pECB, "<P>\r\n");
}

void HtmlEndPreformattedText ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 290 of file html.cpp.

{
  WriteString(pECB, "</PRE>");
}

void HtmlEndStatus ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 418 of file html.cpp.

{
  WriteString(pECB, "</SAMP>");
}

void HtmlEndStrong ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 434 of file html.cpp.

{
  WriteString(pECB, "</STRONG>");
}

void HtmlEndUnnumberedList ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 169 of file html.cpp.

{
  WriteString(pECB, "</UL>");
}

void HtmlEndVariable ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 446 of file html.cpp.

{
  WriteString(pECB, "</VAR>");
}

void HtmlFixed | ( | IN EXTENSION_CONTROL_BLOCK * | pECB,
 |  | IN LPCSTR | lpszText
 | ) |  |

Definition at line 494 of file html.cpp.

{
  HtmlBeginFixed(pECB);
  HtmlWriteText(pECB, lpszText);
  HtmlEndFixed(pECB);
}

void HtmlHeading | ( | IN EXTENSION_CONTROL_BLOCK * | pECB,
 |  | IN int | nHeading,
 |  | IN LPCSTR | lpszText
 | ) |  |

Definition at line 46 of file html.cpp.

{
  HtmlBeginHeading(pECB, nHeading);
  HtmlWriteText(pECB, lpszText);
  HtmlEndHeading(pECB, nHeading);
}

void HtmlHorizontalRule ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 520 of file html.cpp.

{
  WriteString(pECB, "\r\n<HR>\r\n");
}

void HtmlHyperLink | ( | IN EXTENSION_CONTROL_BLOCK * | pECB,
 |  | IN LPCSTR | lpszDoc,
 |  | IN LPCSTR | lpszText
 | ) |  |

Definition at line 127 of file html.cpp.

{
  WriteString(pECB, "<A HREF=\"");
  HtmlWriteText(pECB, lpszDoc);
  WriteString(pECB, "\">");
  HtmlWriteText(pECB, lpszText);
  WriteString(pECB, "</A>\r\n");
}

void HtmlHyperLinkAndBookmark | ( | IN EXTENSION_CONTROL_BLOCK * | pECB,
 |  | IN LPCSTR | lpszDoc,
 |  | IN LPCSTR | lpszBookmark,
 |  | IN LPCSTR | lpszText
 | ) |  |

Definition at line 136 of file html.cpp.

{
  WriteString(pECB, "<A HREF=\"");

  if (lpszDoc)
    HtmlWriteText(pECB, lpszDoc);

  WriteString(pECB, "#");
  HtmlWriteText(pECB, lpszBookmark);
  WriteString(pECB, "\">");
  HtmlWriteText(pECB, lpszText);
  WriteString(pECB, "</A>\r\n");
}

void HtmlImage | ( | IN EXTENSION_CONTROL_BLOCK * | pECB,
 |  | IN LPCSTR | lpszPicFile,
 |  | IN LPCSTR | lpszAltText
 | ) |  |

Definition at line 526 of file html.cpp.

{
  WriteString(pECB, "<IMG SRC = \"");
  HtmlWriteText(pECB, lpszPicFile);
  WriteString(pECB, "\"");
  if (lpszAltText) {
    WriteString(pECB, " ALT = \"");
    HtmlWriteText(pECB, lpszAltText);
    WriteString(pECB, "\"");
  }
  WriteString(pECB, ">\r\n");
}

void HtmlItalic | ( | IN EXTENSION_CONTROL_BLOCK * | pECB,
 |  | IN LPCSTR | lpszText
 | ) |  |

Definition at line 474 of file html.cpp.

{
  HtmlBeginItalic(pECB);
  HtmlWriteText(pECB, lpszText);
  HtmlEndItalic(pECB);
}

void HtmlLineBreak ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 514 of file html.cpp.

{
  WriteString(pECB, "<BR>\r\n");
}

void HtmlPrintf | ( | IN EXTENSION_CONTROL_BLOCK * | pECB,
 |  | IN LPCSTR | lpszFormat,
 |  |  | ...
 | ) |  |

Definition at line 540 of file html.cpp.

{
  char szBuf[8192];

  va_list list;

  va_start(list, lpszFormat);

  vsprintf(szBuf, lpszFormat, list);
  WriteString(pECB, szBuf);

  va_end(list);
}

void HtmlWriteText | ( | IN EXTENSION_CONTROL_BLOCK * | pECB,
 |  | IN LPCSTR | lpsz
 | ) |  |

Definition at line 79 of file html.cpp.

{
  char szBuf[1028];

  // Build up enough data to make call to WriteString
  // worthwhile; convert special chars too.

  int nLen = 0;

  for (int i = 0; lpsz[i]; i++) {

    if (lpsz[i] == '<')
      lstrcpy(&szBuf[nLen], "&lt;");
    else if (lpsz[i] == '>')
      lstrcpy(&szBuf[nLen], "&gt;");
    else if (lpsz[i] == '&')
      lstrcpy(&szBuf[nLen], "&amp;");
    else if (lpsz[i] == '\"')
      lstrcpy(&szBuf[nLen], "&quot;");
    else {
      szBuf[nLen] = lpsz[i];
      szBuf[nLen + 1] = 0;
    }

    nLen += lstrlen(&szBuf[nLen]);

    if (nLen >= 1024) {
      WriteString(pECB, szBuf);
      nLen = 0;
    }
  }

  if (nLen)
    WriteString(pECB, szBuf);
}

void HtmlWriteTextLine | ( | IN EXTENSION_CONTROL_BLOCK * | pECB,
 |  | IN LPCSTR | lpsz
 | ) |  |

Definition at line 72 of file html.cpp.

{
  HtmlWriteText(pECB, lpsz);
  WriteString(pECB, "\r\n");
}

void WriteString | ( | IN EXTENSION_CONTROL_BLOCK * | pECB,
 |  | IN LPCSTR | lpsz
 | ) |  |

Definition at line 19 of file html.cpp.

{
  DWORD dwBytesWritten;

  dwBytesWritten = lstrlen(lpsz);
  pECB->WriteClient(pECB->ConnID, (PVOID) lpsz, &dwBytesWritten, 0);
}

Generated on Wed Nov 13 2024 16:54:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/extensions/Formdump/html.h File Reference

  • Web
  • iis
  • extensions
  • Formdump
Functions

html.h File Reference

Go to the source code of this file.

Functions

void | HtmlBeginAddress (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlBeginBlockQuote (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlBeginBold (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlBeginCitation (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlBeginCode (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlBeginDefine (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlBeginDefinition (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlBeginDefinitionList (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlBeginDefinitionTerm (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlBeginEmphasis (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlBeginFixed (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlBeginHeading (IN EXTENSION_CONTROL_BLOCK *pECB, IN int nHeading)
void | HtmlBeginItalic (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlBeginKeyboard (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlBeginListItem (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlBeginNumberedList (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlBeginPreformattedText (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlBeginStatus (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlBeginStrong (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlBeginUnnumberedList (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlBeginVariable (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlBold (IN EXTENSION_CONTROL_BLOCK *pECB, IN LPCSTR lpszText)
void | HtmlBookmarkLink (IN EXTENSION_CONTROL_BLOCK *pECB, IN LPCSTR lpszBookmark, IN LPCSTR lpszText)
void | HtmlCreatePage (IN EXTENSION_CONTROL_BLOCK *pECB, IN LPCSTR lpszTitle)
void | HtmlDefinition (IN EXTENSION_CONTROL_BLOCK *pECB, IN LPCSTR lpszTerm, LPSTR lpszDef)
void | HtmlEndAddress (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlEndBlockQuote (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlEndBold (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlEndCitation (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlEndCode (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlEndDefine (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlEndDefinitionList (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlEndEmphasis (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlEndFixed (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlEndHeading (IN EXTENSION_CONTROL_BLOCK *pECB, IN int nHeading)
void | HtmlEndItalic (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlEndKeyboard (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlEndNumberedList (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlEndPage (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlEndParagraph (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlEndPreformattedText (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlEndStatus (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlEndString (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlEndUnnumberedList (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlEndVariable (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlFixed (IN EXTENSION_CONTROL_BLOCK *pECB, IN LPCSTR lpszText)
void | HtmlHeading (IN EXTENSION_CONTROL_BLOCK *pECB, IN int nHeading, IN LPCSTR lpszText)
void | HtmlHorizontalRule (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlHyperLink (IN EXTENSION_CONTROL_BLOCK *pECB, IN LPCSTR lpszDoc, IN LPCSTR lpszText)
void | HtmlHyperLinkAndBookmark (IN EXTENSION_CONTROL_BLOCK *pECB, IN LPCSTR lpszDoc, IN LPCSTR lpszBookmark, IN LPCSTR lpszText)
void | HtmlImage (IN EXTENSION_CONTROL_BLOCK *pECB, IN LPCSTR lpszPicFile, IN LPCSTR lpszAltText)
void | HtmlItalic (IN EXTENSION_CONTROL_BLOCK *pECB, IN LPCSTR lpszText)
void | HtmlLineBreak (IN EXTENSION_CONTROL_BLOCK *pECB)
void | HtmlPrintf (IN EXTENSION_CONTROL_BLOCK *pECB, IN LPCSTR lpszFormat,...)
void | HtmlWriteText (IN EXTENSION_CONTROL_BLOCK *pECB, IN LPCSTR lpsz)
void | HtmlWriteTextLine (IN EXTENSION_CONTROL_BLOCK *pECB, IN LPCSTR lpsz)
void | WriteString (IN EXTENSION_CONTROL_BLOCK *pECB, IN LPCSTR lpsz)

Function Documentation

void HtmlBeginAddress ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 314 of file html.cpp.

{
  WriteString(pECB, "<ADDRESS>");
}

void HtmlBeginBlockQuote ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 298 of file html.cpp.

{
  WriteString(pECB, "<BLOCKQUOTE>");
}

void HtmlBeginBold ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 462 of file html.cpp.

{
  WriteString(pECB, "<B>");
}

void HtmlBeginCitation ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 362 of file html.cpp.

{
  WriteString(pECB, "<CITE>");
}

void HtmlBeginCode ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 378 of file html.cpp.

{
  WriteString(pECB, "<CODE>");
}

void HtmlBeginDefine ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 330 of file html.cpp.

{
  WriteString(pECB, "<DFN>");
}

void HtmlBeginDefinition ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 275 of file html.cpp.

{
  WriteString(pECB, "<DD>");
}

void HtmlBeginDefinitionList ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 193 of file html.cpp.

{
  WriteString(pECB, "<DL>");
}

void HtmlBeginDefinitionTerm ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 270 of file html.cpp.

{
  WriteString(pECB, "<DT>");
}

void HtmlBeginEmphasis ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 346 of file html.cpp.

{
  WriteString(pECB, "<EM>");
}

void HtmlBeginFixed ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 502 of file html.cpp.

{
  WriteString(pECB, "<TT>");
}

void HtmlBeginHeading | ( | IN EXTENSION_CONTROL_BLOCK * | pECB,
 |  | IN int | nHeading
 | ) |  |

Definition at line 54 of file html.cpp.

{
  char szCode[16];

  wsprintf(szCode, "<H%i>", nHeading);
  WriteString(pECB, szCode);
}

void HtmlBeginItalic ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 482 of file html.cpp.

{
  WriteString(pECB, "<I>");
}

void HtmlBeginKeyboard ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 394 of file html.cpp.

{
  WriteString(pECB, "<KBD>");
}

void HtmlBeginListItem ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 163 of file html.cpp.

{
  WriteString(pECB, "<LI>");
}

void HtmlBeginNumberedList ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 177 of file html.cpp.

{
  WriteString(pECB, "<OL>");
}

void HtmlBeginPreformattedText ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 282 of file html.cpp.

{
  WriteString(pECB, "<PRE>");
}

void HtmlBeginStatus ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 410 of file html.cpp.

{
  WriteString(pECB, "<SAMP>");
}

void HtmlBeginStrong ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 426 of file html.cpp.

{
  WriteString(pECB, "<STRONG>");
}

void HtmlBeginUnnumberedList ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 157 of file html.cpp.

{
  WriteString(pECB, "<UL>\r\n");
}

void HtmlBeginVariable ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 440 of file html.cpp.

{
  WriteString(pECB, "<VAR>");
}

void HtmlBold | ( | IN EXTENSION_CONTROL_BLOCK * | pECB,
 |  | IN LPCSTR | lpszText
 | ) |  |

Definition at line 454 of file html.cpp.

{
  HtmlBeginBold(pECB);
  HtmlWriteText(pECB, lpszText);
  HtmlEndBold(pECB);
}

void HtmlBookmarkLink | ( | IN EXTENSION_CONTROL_BLOCK * | pECB,
 |  | IN LPCSTR | lpszBookmark,
 |  | IN LPCSTR | lpszText
 | ) |  |

Definition at line 150 of file html.cpp.

{
  HtmlHyperLinkAndBookmark(pECB, NULL, lpszBookmark, lpszText);
}

void HtmlCreatePage | ( | IN EXTENSION_CONTROL_BLOCK * | pECB,
 |  | IN LPCSTR | lpszTitle
 | ) |  |

Definition at line 27 of file html.cpp.

{
  WriteString(pECB, "<HTML>\r\n\r\n");

  if (lpszTitle) {
    WriteString(pECB, "<HEAD><TITLE>");
    HtmlWriteText(pECB, lpszTitle);
    WriteString(pECB, "</TITLE></HEAD>\r\n\r\n");
  }
  WriteString(pECB, "<BODY>\r\n\r\n");
}

void HtmlDefinition | ( | IN EXTENSION_CONTROL_BLOCK * | pECB,
 |  | IN LPCSTR | lpszTerm,
 |  | LPSTR | lpszDef
 | ) |  |
void HtmlEndAddress ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 322 of file html.cpp.

{
  WriteString(pECB, "</ADDRESS>");
}

void HtmlEndBlockQuote ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 306 of file html.cpp.

{
  WriteString(pECB, "</BLOCKQUOTE>");
}

void HtmlEndBold ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 468 of file html.cpp.

{
  WriteString(pECB, "</B>");
}

void HtmlEndCitation ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 370 of file html.cpp.

{
  WriteString(pECB, "</CITE>");
}

void HtmlEndCode ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 386 of file html.cpp.

{
  WriteString(pECB, "</CODE>");
}

void HtmlEndDefine ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 338 of file html.cpp.

{
  WriteString(pECB, "</DFN>");
}

void HtmlEndDefinitionList ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 201 of file html.cpp.

{
  WriteString(pECB, "</DL>");
}

void HtmlEndEmphasis ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 354 of file html.cpp.

{
  WriteString(pECB, "</EM>");
}

void HtmlEndFixed ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 508 of file html.cpp.

{
  WriteString(pECB, "</TT>");
}

void HtmlEndHeading | ( | IN EXTENSION_CONTROL_BLOCK * | pECB,
 |  | IN int | nHeading
 | ) |  |

Definition at line 63 of file html.cpp.

{
  char szCode[16];

  wsprintf(szCode, "</H%i>", nHeading);
  WriteString(pECB, szCode);
}

void HtmlEndItalic ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 488 of file html.cpp.

{
  WriteString(pECB, "</I>");
}

void HtmlEndKeyboard ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 402 of file html.cpp.

{
  WriteString(pECB, "</KBD>");
}

void HtmlEndNumberedList ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 185 of file html.cpp.

{
  WriteString(pECB, "</OL>");
}

void HtmlEndPage ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 39 of file html.cpp.

{
  WriteString(pECB, "</BODY>\r\n\r\n");
  WriteString(pECB, "</HTML>\r\n");
}

void HtmlEndParagraph ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 116 of file html.cpp.

{
  WriteString(pECB, "<P>\r\n");
}

void HtmlEndPreformattedText ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 290 of file html.cpp.

{
  WriteString(pECB, "</PRE>");
}

void HtmlEndStatus ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 418 of file html.cpp.

{
  WriteString(pECB, "</SAMP>");
}

void HtmlEndString ( IN EXTENSION_CONTROL_BLOCK * pECB )
void HtmlEndUnnumberedList ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 169 of file html.cpp.

{
  WriteString(pECB, "</UL>");
}

void HtmlEndVariable ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 446 of file html.cpp.

{
  WriteString(pECB, "</VAR>");
}

void HtmlFixed | ( | IN EXTENSION_CONTROL_BLOCK * | pECB,
 |  | IN LPCSTR | lpszText
 | ) |  |

Definition at line 494 of file html.cpp.

{
  HtmlBeginFixed(pECB);
  HtmlWriteText(pECB, lpszText);
  HtmlEndFixed(pECB);
}

void HtmlHeading | ( | IN EXTENSION_CONTROL_BLOCK * | pECB,
 |  | IN int | nHeading,
 |  | IN LPCSTR | lpszText
 | ) |  |

Definition at line 46 of file html.cpp.

{
  HtmlBeginHeading(pECB, nHeading);
  HtmlWriteText(pECB, lpszText);
  HtmlEndHeading(pECB, nHeading);
}

void HtmlHorizontalRule ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 520 of file html.cpp.

{
  WriteString(pECB, "\r\n<HR>\r\n");
}

void HtmlHyperLink | ( | IN EXTENSION_CONTROL_BLOCK * | pECB,
 |  | IN LPCSTR | lpszDoc,
 |  | IN LPCSTR | lpszText
 | ) |  |

Definition at line 127 of file html.cpp.

{
  WriteString(pECB, "<A HREF=\"");
  HtmlWriteText(pECB, lpszDoc);
  WriteString(pECB, "\">");
  HtmlWriteText(pECB, lpszText);
  WriteString(pECB, "</A>\r\n");
}

void HtmlHyperLinkAndBookmark | ( | IN EXTENSION_CONTROL_BLOCK * | pECB,
 |  | IN LPCSTR | lpszDoc,
 |  | IN LPCSTR | lpszBookmark,
 |  | IN LPCSTR | lpszText
 | ) |  |

Definition at line 136 of file html.cpp.

{
  WriteString(pECB, "<A HREF=\"");

  if (lpszDoc)
    HtmlWriteText(pECB, lpszDoc);

  WriteString(pECB, "#");
  HtmlWriteText(pECB, lpszBookmark);
  WriteString(pECB, "\">");
  HtmlWriteText(pECB, lpszText);
  WriteString(pECB, "</A>\r\n");
}

void HtmlImage | ( | IN EXTENSION_CONTROL_BLOCK * | pECB,
 |  | IN LPCSTR | lpszPicFile,
 |  | IN LPCSTR | lpszAltText
 | ) |  |

Definition at line 526 of file html.cpp.

{
  WriteString(pECB, "<IMG SRC = \"");
  HtmlWriteText(pECB, lpszPicFile);
  WriteString(pECB, "\"");
  if (lpszAltText) {
    WriteString(pECB, " ALT = \"");
    HtmlWriteText(pECB, lpszAltText);
    WriteString(pECB, "\"");
  }
  WriteString(pECB, ">\r\n");
}

void HtmlItalic | ( | IN EXTENSION_CONTROL_BLOCK * | pECB,
 |  | IN LPCSTR | lpszText
 | ) |  |

Definition at line 474 of file html.cpp.

{
  HtmlBeginItalic(pECB);
  HtmlWriteText(pECB, lpszText);
  HtmlEndItalic(pECB);
}

void HtmlLineBreak ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 514 of file html.cpp.

{
  WriteString(pECB, "<BR>\r\n");
}

void HtmlPrintf | ( | IN EXTENSION_CONTROL_BLOCK * | pECB,
 |  | IN LPCSTR | lpszFormat,
 |  |  | ...
 | ) |  |

Definition at line 540 of file html.cpp.

{
  char szBuf[8192];

  va_list list;

  va_start(list, lpszFormat);

  vsprintf(szBuf, lpszFormat, list);
  WriteString(pECB, szBuf);

  va_end(list);
}

void HtmlWriteText | ( | IN EXTENSION_CONTROL_BLOCK * | pECB,
 |  | IN LPCSTR | lpsz
 | ) |  |

Definition at line 79 of file html.cpp.

{
  char szBuf[1028];

  // Build up enough data to make call to WriteString
  // worthwhile; convert special chars too.

  int nLen = 0;

  for (int i = 0; lpsz[i]; i++) {

    if (lpsz[i] == '<')
      lstrcpy(&szBuf[nLen], "&lt;");
    else if (lpsz[i] == '>')
      lstrcpy(&szBuf[nLen], "&gt;");
    else if (lpsz[i] == '&')
      lstrcpy(&szBuf[nLen], "&amp;");
    else if (lpsz[i] == '\"')
      lstrcpy(&szBuf[nLen], "&quot;");
    else {
      szBuf[nLen] = lpsz[i];
      szBuf[nLen + 1] = 0;
    }

    nLen += lstrlen(&szBuf[nLen]);

    if (nLen >= 1024) {
      WriteString(pECB, szBuf);
      nLen = 0;
    }
  }

  if (nLen)
    WriteString(pECB, szBuf);
}

void HtmlWriteTextLine | ( | IN EXTENSION_CONTROL_BLOCK * | pECB,
 |  | IN LPCSTR | lpsz
 | ) |  |

Definition at line 72 of file html.cpp.

{
  HtmlWriteText(pECB, lpsz);
  WriteString(pECB, "\r\n");
}

void WriteString | ( | IN EXTENSION_CONTROL_BLOCK * | pECB,
 |  | IN LPCSTR | lpsz
 | ) |  |

Definition at line 19 of file html.cpp.

{
  DWORD dwBytesWritten;

  dwBytesWritten = lstrlen(lpsz);
  pECB->WriteClient(pECB->ConnID, (PVOID) lpsz, &dwBytesWritten, 0);
}

Generated on Wed Nov 13 2024 16:54:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/extensions/Formdump/keys.cpp File Reference

  • Web
  • iis
  • extensions
  • Formdump
Classes | Defines | Typedefs | Functions

keys.cpp File Reference

#include <windows.h>
#include <httpext.h>
#include "keys.h"

Go to the source code of this file.

Classes

struct | _tagLISTPROP
struct | _tagPOSDATA
struct | _tagPOSTKEY

Defines

#define | CONTENT_BUF_LENGTH 8192
#define | GNB_DECODED_CHAR 1
#define | GNB_NORMAL_CHAR 2
#define | GNB_NOTHING_LEFT 0
#define | LOG(errorstring)
#define | MACRO_AbortCleanup
#define | MAX_KEY_NAME_LENGTH 256
#define | USE_MEMORY
#define | WIN32_LEAN_AND_MEAN

Typedefs

typedef int(* | GETINBOUNDBYTE )(PPOSDATA p)
typedef struct _tagLISTPROP | LISTPROP
typedef struct _tagLISTPROP * | PLISTPROP
typedef struct _tagPOSDATA | POSDATA
typedef struct _tagPOSTKEY | POSTKEY
typedef struct _tagPOSDATA * | PPOSDATA
typedef struct _tagPOSTKEY * | PPOSTKEY

Functions

void | BKL_Abort (IN PPOSTKEY pHead, IN HANDLE hFile, IN LPSTR lpszKey, IN LPBYTE lpbyBuf)
BOOL | BKL_Alloc (OUT LPSTR *plpszKey, OUT LPBYTE *plpbyBuf)
void | BKL_Dealloc (IN LPSTR *plpsz, IN LPBYTE *plpby)
PPOSTKEY | BuildKeyList (IN EXTENSION_CONTROL_BLOCK *pECB, IN GETINBOUNDBYTE GetInboundByte)
HKEYLIST | FindKey (IN HKEYLIST hKeyList, IN LPCSTR lpszSearchName)
void | FreeKeyList (IN HKEYLIST hHeadKey)
LPBYTE | GetDataBuffer (IN HKEYLIST hKeyList)
int | GetFirstByte (IN OUT PPOSDATA pPosData, IN EXTENSION_CONTROL_BLOCK *pECB, OUT char *pc, IN GETINBOUNDBYTE GetInboundByte)
LPBYTE | GetKeyBuffer (IN HKEYLIST hKey)
HKEYLIST | GetKeyInfo (IN HKEYLIST hKey, OUT LPCSTR *plpszKeyName, OUT LPDWORD pdwLength, OUT BOOL *pbHasCtrlChars, OUT LPINT pnInstance)
HKEYLIST | GetKeyList (IN EXTENSION_CONTROL_BLOCK *pECB)
DWORD | GetKeyOffset (IN HKEYLIST hKey)
int | GetNextByte (IN OUT PPOSDATA pPosData, OUT char *pc)
int | GetPostedByte (PPOSDATA pPosData)
PPOSTKEY | GetPostKeys (IN EXTENSION_CONTROL_BLOCK *pECB)
PLISTPROP | GetPropAddr (IN HKEYLIST hKey)
PLISTPROP GetPropAddr (HKEYLIST hKey)
int | GetQueryByte (IN OUT PPOSDATA pPosData)
PPOSTKEY | GetUrlKeys (IN EXTENSION_CONTROL_BLOCK *pECB)
int | HexDigitToInt (IN char c)
BOOL | IsKeySeparator (char c)

Define Documentation

#define CONTENT_BUF_LENGTH 8192

Definition at line 124 of file keys.cpp.

#define GNB_DECODED_CHAR 1

Definition at line 128 of file keys.cpp.

#define GNB_NORMAL_CHAR 2

Definition at line 129 of file keys.cpp.

#define GNB_NOTHING_LEFT 0

Definition at line 127 of file keys.cpp.

#define LOG ( errorstring )

Definition at line 35 of file keys.cpp.

#define MACRO_AbortCleanup
Value:
BKL_Abort( pHead, INVALID_HANDLE_VALUE, \
    lpszKeyNameBuf,lpbyContentBuf )

Definition at line 607 of file keys.cpp.

#define MAX_KEY_NAME_LENGTH 256

Definition at line 123 of file keys.cpp.

#define USE_MEMORY

Definition at line 27 of file keys.cpp.

#define WIN32_LEAN_AND_MEAN

Definition at line 12 of file keys.cpp.

Typedef Documentation

typedef int(* GETINBOUNDBYTE)(PPOSDATA p)

Definition at line 153 of file keys.cpp.

typedef struct _tagLISTPROP LISTPROP
typedef struct _tagLISTPROP * PLISTPROP
typedef struct _tagPOSDATA POSDATA
typedef struct _tagPOSTKEY POSTKEY
typedef struct _tagPOSDATA * PPOSDATA
typedef struct _tagPOSTKEY * PPOSTKEY

Function Documentation

void BKL_Abort | ( | IN PPOSTKEY | pHead,
 |  | IN HANDLE | hFile,
 |  | IN LPSTR | lpszKey,
 |  | IN LPBYTE | lpbyBuf
 | ) |  |

Definition at line 613 of file keys.cpp.

{
    if ( pHead ) {
        FreeKeyList( (HKEYLIST) pHead );
    }

    if ( hFile != INVALID_HANDLE_VALUE ) {
        CloseHandle( hFile );
    }

    BKL_Dealloc( &lpszKey, &lpbyBuf );
}

BOOL BKL_Alloc | ( | OUT LPSTR * | plpszKey,
 |  | OUT LPBYTE * | plpbyBuf
 | ) |  |

Definition at line 546 of file keys.cpp.

{
    // Allocate a buffer for the key name
    *plpszKey = (LPSTR) HeapAlloc( GetProcessHeap( ),
        HEAP_ZERO_MEMORY,
        MAX_KEY_NAME_LENGTH );

    if ( !*plpszKey ) {
        return FALSE;
    }

#ifdef USE_MEMORY
    // Init buffer to NULL
    *plpbyBuf = NULL;

#elif defined USE_TEMPORARY_FILES

    // Allocate a buffer for the content
    *plpbyBuf = (LPBYTE) HeapAlloc( GetProcessHeap( ),
        HEAP_ZERO_MEMORY,
        CONTENT_BUF_LENGTH );

    if ( !*plpbyBuf ) {
        HeapFree( GetProcessHeap( ), 0, (LPVOID) * plpszKey );
        return FALSE;
    }
#endif

    return TRUE;
}

void BKL_Dealloc | ( | IN LPSTR * | plpsz,
 |  | IN LPBYTE * | plpby
 | ) |  |

Definition at line 582 of file keys.cpp.

{
    if ( plpsz && *plpsz ) {
        HeapFree( GetProcessHeap( ), 0, (LPVOID) * plpsz );
    }
    if ( plpby && *plpby ) {
        HeapFree( GetProcessHeap( ), 0, (LPVOID) * plpby );
    }
}

PPOSTKEY BuildKeyList | ( | IN EXTENSION_CONTROL_BLOCK * | pECB,
 |  | IN GETINBOUNDBYTE | GetInboundByte
 | ) |  |

Definition at line 655 of file keys.cpp.

       :

    Now that we have a way to get a decoded byte from the stream,
    we can parse POST data.  POST data comes in as:

    key=data&key=data&key=data\r\n

    A linked list of keys is established, and the head node
    of the list is returned.  A NULL indicates no keys or
    an error.

Arguments:
    pECB - pointer to the extension control block
    GetInboundByte - pointer to function to get input data

Returns:
    Pointer to the head node or NULL

--*/
{
    PPOSTKEY pHead = NULL;      // head of linked list ( the return val )
    PPOSTKEY pTail = NULL;      // last member in linked list
    PPOSTKEY pNewPostKey;       // pointer for unlinked, newly allocated
                                // objects

    PPOSTKEY pListWalk;         // linked list walking pointer
    PLISTPROP pProp;            // pointer to list properties
    LPSTR lpszKeyNameBuf;       // pointer to buffer, used in obtaining key
                                // name

    int nPos;                   // position within key name buffer
    DWORD dwOffset;             // offset from start of content buffer or
                                // file

    DWORD dwLength;             // length of key data
    char c;                     // general-purpose character
    int nReturn;                // general-purpose return code
    POSDATA pd;                 // POSDATA struct needed in GetInboundByte
    int nContentPos;            // position within content buffer
    LPBYTE lpbyContentBuf;      // pointer to buffer
    BOOL bHasCtrlChars;         // flag to detect ctrl chars

    // Call helper to allocate a buffer
    if ( !BKL_Alloc( &lpszKeyNameBuf, &lpbyContentBuf ) ) {
        LOG( "BuildKeyList: Memory allocation failure" );
        return NULL;
    }
    nContentPos = dwOffset = 0;

#ifdef USE_MEMORY
    //
    // Allocate enough memory for all the content.
    // For the POST method, the cbTotalBytes gives us the number
    // of bytes that are being sent by the browser.  We can
    // allocate that much but we'll really only use about 75% of it.
    // For the GET method, we need to allocate the size of the
    // query string plus 1.
    //

    lpbyContentBuf = (LPBYTE) HeapAlloc( GetProcessHeap( ),
        HEAP_ZERO_MEMORY,
        pECB->cbTotalBytes +
        lstrlen( pECB->lpszQueryString ) + 1 );

    if ( !lpbyContentBuf ) {

        LOG( "BuildKeyList: Error allocating content memory" );
        BKL_Dealloc( &lpszKeyNameBuf, &lpbyContentBuf );

        return NULL;
    }
#elif defined USE_TEMPORARY_FILES

    //
    // When USE_TEMPORARY_FILES is chosen, we create
    // a temporary file to store all the inbound data.
    // This is done to support huge amounts of inbound
    // data, like file uploads.
    //

    char szTempDir[MAX_PATH];   // directory of temporary files
    char szTempPath[MAX_PATH];  // path of content file
    HANDLE hDataFile;           // handle to content file
    DWORD dwBytesWritten;       // used with WriteFile

    // Get a temp file name
    GetTempPath( MAX_PATH, szTempDir );
    if ( !GetTempFileName( szTempDir, "key", 0, szTempPath ) ) {

        LOG( "BuildKeyList: Error creating temporary file" );
        BKL_Dealloc( &lpszKeyNameBuf, &lpbyContentBuf );

        return NULL;
    }
    // Create the content file
    hDataFile = CreateFile( szTempPath,
        GENERIC_READ | GENERIC_WRITE,
        0,                      // No sharing mode
        NULL,                   // Default security attribs
        CREATE_ALWAYS,
        FILE_ATTRIBUTE_NORMAL,
        NULL                    // No template file
        );

    // Return if an error occured
    if ( hDataFile == INVALID_HANDLE_VALUE ) {
        LOG( "BuildKeyList: Error opening temporary file" );
        MACRO_AbortCleanup;
        return NULL;
    }
#endif

    //
    // 'for' statement detects the start of a valid key name.
    //
    // To do inside 'for' loop:
    // Obtain key name
    // Write data to buffer or content file
    // Create POSTKEY object
    // Update links
    //

    for ( nReturn = GetFirstByte( &pd, pECB, &c, GetInboundByte );
        nReturn != GNB_NOTHING_LEFT;
        nReturn = GetNextByte( &pd, &c ) ) {

        // If \r or \n, ignore and continue
        if ( c == '\r' || c == '\n' ) {
            continue;
        }

        // Get a key name
        nPos = 0;
        while ( !IsKeySeparator( c ) ) {
            if ( nPos < MAX_KEY_NAME_LENGTH ) {
                lpszKeyNameBuf[nPos] = c;
                nPos++;
            }
            nReturn = GetNextByte( &pd, &c );
            if ( nReturn == GNB_NOTHING_LEFT )  { // abrupt end!
                break;
            }
        }

        // If no equals sign or name too long,
        // we have a browser formatting error
        if ( c != '=' || nPos == MAX_KEY_NAME_LENGTH ) {
            LOG( "BuildKeyList: Browser formatting error" );

            MACRO_AbortCleanup;
            return NULL;
        }

        // Truncate the name string, reset data info variables
        lpszKeyNameBuf[nPos] = 0;
        nPos++;
        dwLength = 0;
        bHasCtrlChars = FALSE;

        //
        // Move the data to the content buffer or file.
        //
        for ( nReturn = GetNextByte( &pd, &c );
            !IsKeySeparator( c ) || nReturn == GNB_DECODED_CHAR;
            nReturn = GetNextByte( &pd, &c ) ) {

            lpbyContentBuf[nContentPos] = c;

            nContentPos += sizeof ( char );
            dwLength++;

            // Check for ctrl chars
            if ( c < 0x20 ) {
                bHasCtrlChars = TRUE;
            }

#ifdef USE_TEMPORARY_FILES
            // If we have enough data, write buffer to disk
            if ( nContentPos == CONTENT_BUF_LENGTH ) {
                if ( !WriteFile( hDataFile, lpbyContentBuf,
                    nContentPos, &dwBytesWritten, NULL ) ) {

                    LOG( "BuildKeyList: Error writing to content file" );
                    MACRO_AbortCleanup;
                    return NULL;
                }
                nContentPos = 0;
            }
#endif

        } // for( nReturn

#ifdef USE_MEMORY
        //
        // Put a terminating NULL at the end of the key data.
        //

        lpbyContentBuf[nContentPos] = 0;
        nContentPos++;

#elif defined USE_TEMPORARY_FILES

        // Drain buffer
        if ( nContentPos ) {
            if ( !WriteFile( hDataFile, lpbyContentBuf,
                nContentPos, &dwBytesWritten, NULL ) ) {

                LOG( "BuildKeyList: Error writing to content file" );
                MACRO_AbortCleanup;
                return NULL;
            }
            nContentPos = 0;
        }
#endif

        // Allocate a POSTKEY object, allocate extra for first key
        if ( pHead ) {
            pNewPostKey = (PPOSTKEY) HeapAlloc(
                GetProcessHeap( ),
                HEAP_ZERO_MEMORY,
                sizeof (POSTKEY) + nPos
                );
        }else{
            pNewPostKey = (PPOSTKEY) HeapAlloc(
                GetProcessHeap( ),
                HEAP_ZERO_MEMORY,
                sizeof (POSTKEY) + nPos +
                sizeof (LISTPROP) );

            pProp = (PLISTPROP) ( (LPBYTE)pNewPostKey +
                    sizeof (POSTKEY) + nPos );
        }

        // Check for valid pointer
        if ( !pNewPostKey ) {
            LOG( "BuildKeyList: POSTKEY memory allocation failure" );
            MACRO_AbortCleanup;
            return NULL;
        }

        //
        // Set pNewPostKey members
        //

        // Set nInstance
        pNewPostKey->nInstance = 0;
        pListWalk = pHead;
        while ( pListWalk ) {
            // Check for duplicate key names
            if ( !lstrcmpi( (LPCSTR) ( &pListWalk[1] ), lpszKeyNameBuf )) {
                pNewPostKey->nInstance++;
            }
            pListWalk = pListWalk->pNext;
        }

        // Set dwOffset, dwLength, bHasCtrlChars, lpbyBuf
        pNewPostKey->dwOffset = dwOffset;
        pNewPostKey->dwLength = dwLength;
        pNewPostKey->bHasCtrlChars = bHasCtrlChars;

#ifdef USE_MEMORY
        pNewPostKey->lpbyBuf = &lpbyContentBuf[dwOffset];
        dwOffset += dwLength + 1;

#elif defined USE_TEMPORARY_FILES

        pNewPostKey->lpbyBuf = NULL;
        dwOffset += dwLength;
#endif

        // Copy key name
        lstrcpy( (LPSTR) ( &pNewPostKey[1] ), lpszKeyNameBuf );

        // Link
        if ( pTail ) {
            pTail->pNext = pNewPostKey;
        }else{

#ifdef USE_TEMPORARY_FILES
            // Copy content file name to list properties
            lstrcpy( pProp->szTempFileName, szTempPath );

            // Set handle
            pProp->hFile = hDataFile;

#elif defined USE_MEMORY

            // Set content buffer pointer
            pProp->lpbyBuf = lpbyContentBuf;
#endif

            // Set head
            pHead = pNewPostKey;
        }

        pNewPostKey->pNext = NULL;
        pTail = pNewPostKey;

        pNewPostKey->pHead = pHead;     // may point to itself

    } // for ( nReturn

#ifdef USE_TEMPORARY_FILES
    //
    // If content file is empty, close it and delete it
    //

    if ( !pHead ) {
        LOG( "Empty content file is being deleted." );
        CloseHandle( hDataFile );
        DeleteFile( szTempPath );
    }
    // Free work buffer
    BKL_Dealloc( &lpszKeyNameBuf, &lpbyContentBuf );

#elif defined USE_MEMORY

    // Free work buffer
    BKL_Dealloc( &lpszKeyNameBuf, pHead ? NULL : &lpbyContentBuf );
#endif

    return pHead;
}

HKEYLIST FindKey | ( | IN HKEYLIST | hKeyList,
 |  | IN LPCSTR | lpszSearchName
 | ) |  |

Definition at line 1221 of file keys.cpp.

       :

    FindKey sequentially searches the linked list for a given key.

Arguments:

    hKeyList - points to key list
    lpszSearchName - points to a key name to find

Returns:

    The return handle points to the element within the linked list.
    Use it in GetKeyInfo, but not FreeKeyList.

--*/
{
    PPOSTKEY pFindKey;

    pFindKey = (PPOSTKEY) hKeyList;
    while ( pFindKey ) {
        if ( !lstrcmpi( lpszSearchName, ( LPCSTR ) ( &pFindKey[1] ) ) ) {
            return ( ( HKEYLIST ) pFindKey );
        }

        pFindKey = pFindKey->pNext;
    }

    return NULL;
}

void FreeKeyList ( IN HKEYLIST hHeadKey )

Definition at line 1259 of file keys.cpp.

       :

    FreeKeyList deallocates all the objects in the key list.
    The content file is also deleted.

Arguments:
    hHeadKey - points to the list head

--*/
{
    PPOSTKEY pObject;
    PPOSTKEY pDel;
    PLISTPROP pProp;

    // Safety
    if ( !hHeadKey ) {
        return;
    }

#ifdef USE_TEMPORARY_FILES
    // Close the content file
    CloseContentFile( hHeadKey );

    // delete the content file
    pProp = GetPropAddr( hHeadKey );
    DeleteFile( pProp->szTempFileName );

#elif defined USE_MEMORY

    // delete content
    pProp = GetPropAddr( hHeadKey );
    HeapFree( GetProcessHeap( ), 0, (LPVOID) pProp->lpbyBuf );
#endif

    // delete all objects in the list
    pObject = (PPOSTKEY) hHeadKey;
    pObject = pObject->pHead;
    while ( pObject ) {

#ifdef USE_TEMPORARY_FILES
        //
        // Free each buffer when using temporary files
        //

        if ( pObject->lpbyBuf )
            HeapFree( GetProcessHeap( ), 0, (LPVOID) pObject->lpbyBuf );
#endif

        pDel = pObject;
        pObject = pObject->pNext;

        HeapFree( GetProcessHeap( ), 0, (LPVOID) pDel );
    }
}

LPBYTE GetDataBuffer ( IN HKEYLIST hKeyList )

Definition at line 1456 of file keys.cpp.

       :

    GetBufferPointer returns a pointer to the buffer used
    for content storage.

Arguments:

    hKeyList - points to a key list

Returns:

    pointer to the content buffer or NULL

--*/
{
    PLISTPROP pProp;

    // safety
    if ( !hKeyList )
        return NULL;

    pProp = GetPropAddr( hKeyList );

    return pProp->lpbyBuf;
}

int GetFirstByte | ( | IN OUT PPOSDATA | pPosData,
 |  | IN EXTENSION_CONTROL_BLOCK * | pECB,
 |  | OUT char * | pc,
 |  | IN GETINBOUNDBYTE | GetInboundByte
 | ) |  |

Definition at line 479 of file keys.cpp.

       :

    GetFirstByte eliminates the guesswork from initialization.
    We call GetFirstByte with an uninitialized POSDATA structure,
    and we call GetNextByte from there on.

Arguments:
    pPosData - points to POSDATA struct to initialize
    pECB - points to the extenstion control block
    pc - points to variable to accept decoded byte
    GetInboundByte - points to function to get incoming bytes

Returns:
    same as GetNextByte()

--*/
{
    // Initialize struct
    pPosData->nAllocLength = 0;
    pPosData->pECB = pECB;
    pPosData->GetInboundByte = GetInboundByte;

    // Make the call as usual
    return GetNextByte( pPosData, pc );
}

LPBYTE GetKeyBuffer ( IN HKEYLIST hKey )

Definition at line 1139 of file keys.cpp.

{
    //
    // We have two versions of this function because
    // we may want to use file i/o when the extension
    // deals with massive amounts of inbound data
    // ( like multi-megabyte uploads ).
    //

    //
    // This version uses a memory buffer.
    //

    PPOSTKEY pKey;

    // Safety
    if ( !hKey ) {
        return NULL;
    }

    pKey = (PPOSTKEY) hKey;

    return (LPBYTE) pKey->lpbyBuf;
}

HKEYLIST GetKeyInfo | ( | IN HKEYLIST | hKey,
 |  | OUT LPCSTR * | plpszKeyName,
 |  | OUT LPDWORD | pdwLength,
 |  | OUT BOOL * | pbHasCtrlChars,
 |  | OUT LPINT | pnInstance
 | ) |  |

Definition at line 1100 of file keys.cpp.

{
    PPOSTKEY pPostKey;

    // Safety
    if ( !hKey ) {
        return NULL;
    }

    pPostKey = (PPOSTKEY) hKey;

    // Set the data members
    if ( plpszKeyName )
        *plpszKeyName = ( LPCSTR ) ( &pPostKey[1] );
    if ( pdwLength )
        *pdwLength = pPostKey->dwLength;
    if ( pbHasCtrlChars )
        *pbHasCtrlChars = pPostKey->bHasCtrlChars;
    if ( pnInstance )
        *pnInstance = pPostKey->nInstance;

    // Return a handle to the next object in the list
    return ( ( HKEYLIST ) pPostKey->pNext );
}

HKEYLIST GetKeyList ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 1062 of file keys.cpp.

       :

    Examines the method and calls GetPostKeys or GetUrlKeys,
    whichever is relevant.

Arguments:
    pECB - points to the extension control block

Returns:
    GetPropAddr returns the address of the end of
    the first key.  We stuff list properties there.
    This implementation of keys.cpp keeps a pointer
    to the content buffer.  The second version ( used
    in IS2WCGI ) appends a temporary file name
    to the first key.

--*/
{
    if ( !lstrcmpi( pECB->lpszMethod, "POST" ) ) {
        LOG( "Method=POST" );
        return (HKEYLIST) GetPostKeys( pECB );
    }else if ( !lstrcmpi( pECB->lpszMethod, "GET" ) ) {
        LOG( "Method=GET" );
        return (HKEYLIST) GetUrlKeys( pECB );
    }
    LOG( "Unknown method" );

    return NULL;
}

DWORD GetKeyOffset ( IN HKEYLIST hKey )

Definition at line 1321 of file keys.cpp.

       :

    GetKeyOffset returns the offset of a key into the internal
    buffer or temporary file.  This is provided for IS2WCGI
    so it can return an offset within the content file.

Arguments:

    hKey - points to a key

Returns:

    Offset of a key or NULL if no key provided

--*/
{
    // Safety
    if ( !hKey )
        return NULL;

    return ( (PPOSTKEY) hKey )->dwOffset;
}

int GetNextByte | ( | IN OUT PPOSDATA | pPosData,
 |  | OUT char * | pc
 | ) |  |

Definition at line 415 of file keys.cpp.

       :
    Decode single byte of the input data

Arguments:
    pPostData - points to POSDATA struct
    pc - points to variable to accept decoded byte

Returns:
    GNB_NORMAL_CHAR, GNB_NOTHING_LEFT or GNB_DECODED_CHAR

--*/
{
    int nChar;
    int nDigit;

    // Initialize character pointer
    *pc = 0;

    // Fetch the next inbound character
    nChar = pPosData->GetInboundByte( pPosData );
    if ( nChar == -1 ) {
        return GNB_NOTHING_LEFT;
    }

    // Plus signs: convert to spaces
    if ( nChar == '+' ) {
        *pc = ' ';
        return GNB_DECODED_CHAR;
    }
    // Percent signs: convert hex values
    else if ( nChar == '%' ) {
        nChar = pPosData->GetInboundByte( pPosData );
        nDigit = HexDigitToInt( nChar );
        if ( nDigit == -1 ) {
            return GNB_NOTHING_LEFT;
        }

        *pc = ( char ) ( ( UINT ) nDigit << 4 );

        nChar = pPosData->GetInboundByte( pPosData );
        nDigit = HexDigitToInt( nChar );
        if ( nDigit == -1 ) {
            *pc = 0;            // incomplete

            return GNB_NOTHING_LEFT;
        }
        *pc |= ( char ) ( UINT ) nDigit;

        return GNB_DECODED_CHAR;
    }
    // Must be normal character then
    *pc = (char) nChar;

    return GNB_NORMAL_CHAR;
}

int GetPostedByte ( PPOSDATA pPosData )

Definition at line 197 of file keys.cpp.

{
    int nBytesToCopy;

    // For readability only...
    EXTENSION_CONTROL_BLOCK *pECB;

    pECB = pPosData->pECB;

    //
    // Initialize position struct on first call.
    //

    if ( !pPosData->nAllocLength ) {
        // Initialize the members
        pPosData->nCurrentPos = 0;
        pPosData->nBufferPos = 0;
        pPosData->nBufferLength = 0;
        pPosData->nAllocLength = 0x10000;   // 65536 bytes

        // Allocate the memory
        pPosData->pData = (LPBYTE) HeapAlloc(
            GetProcessHeap( ),
            HEAP_ZERO_MEMORY,
            pPosData->nAllocLength );
    }
    //
    // Was memory allocated?  Is it still allocated?
    // If not, return right away.
    //

    if ( !pPosData->pData ) {
        LOG( "GetPostedByte: Buffer not allocated." );
        return -1;
    }
    //
    // Check for end.  Deallocate and return if we're done.
    //

    if ( (DWORD) pPosData->nCurrentPos == pECB->cbTotalBytes ) {

        HeapFree( GetProcessHeap( ), 0, (LPVOID) pPosData->pData );
        pPosData->pData = 0;

        return -1;
    }

    //
    // Check for buffer not loaded.  Load if necessary.
    //

    if ( pPosData->nBufferPos == pPosData->nBufferLength ) {

        //
        // Fill the buffer with new inbound data.
        // Request it via ReadClient if necessary.
        //

        if ( pECB->cbAvailable < 1 ) {

            // Calculate how much we should go and get
            nBytesToCopy = pECB->cbTotalBytes - pPosData->nCurrentPos;
            if ( nBytesToCopy > pPosData->nAllocLength ) {
                nBytesToCopy = pPosData->nAllocLength;
            }

            // Let's go get the data
            if ( !pECB->ReadClient(
                    pECB->ConnID,
                    pPosData->pData,
                    (LPDWORD) & nBytesToCopy
                    )) {
                HeapFree( GetProcessHeap( ), 0, (LPVOID) pPosData->pData );
                pPosData->pData = 0;

                LOG( "GetPostedByte: Error reading data via ReadClient" );
                return -1;
            }
        }else{
            // Take at most nAllocLength bytes of data
            if ( pECB->cbAvailable > (DWORD) (pPosData->nAllocLength) ) {
                nBytesToCopy = pPosData->nAllocLength;
            }else{
                nBytesToCopy = pECB->cbAvailable;
            }

            // Copy the inbound data to our buffer
            memcpy(
                pPosData->pData,
                &pECB->lpbData[pPosData->nCurrentPos],
                nBytesToCopy
                );

            // Account for removed data
            pECB->cbAvailable -= nBytesToCopy;
        }

        // Our buffer is now full
        pPosData->nBufferLength = nBytesToCopy;
        pPosData->nBufferPos = 0;

        // Make sure we have something
        if ( !nBytesToCopy ) {
            HeapFree( GetProcessHeap( ), 0, (LPVOID) pPosData->pData );
            pPosData->pData = 0;
            return -1;
        }
    }
    //
    // Inc current pos, buffer pos, and return a character
    //

    pPosData->nCurrentPos++;
    pPosData->nBufferPos++;
    return ( (int)pPosData->pData[pPosData->nBufferPos - 1] );
}

PPOSTKEY GetPostKeys ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 1004 of file keys.cpp.

{
    return BuildKeyList( pECB, GetPostedByte );
}

PLISTPROP GetPropAddr ( IN HKEYLIST hKey )

Definition at line 1021 of file keys.cpp.

       :

    GetPropAddr returns the address of the end of
    the first key.  We stuff list properties there.
    This implementation of keys.cpp keeps a pointer
    to the content buffer.  The second version ( used
    in IS2WCGI ) appends a temporary file name
    to the first key.

Arguments:
    hKey - pointer to a key list

Returns:
    The address of the end of the first key

--*/
{
    LPCSTR lpszKeyName;
    PPOSTKEY pHead;

    // Safety
    if ( !hKey ) {
        return NULL;
    }

    // ContentPath follows POSTKEY struct and key name
    pHead = (PPOSTKEY) hKey;
    pHead = pHead->pHead;

    lpszKeyName = (LPCSTR) ( &pHead[1] );

    return (PLISTPROP) ( lpszKeyName + lstrlen( lpszKeyName ) + 1 );
}

PLISTPROP GetPropAddr ( HKEYLIST hKey )
int GetQueryByte ( IN OUT PPOSDATA pPosData )

Definition at line 330 of file keys.cpp.

{
    // For readability only...
    EXTENSION_CONTROL_BLOCK *pECB;

    pECB = pPosData->pECB;

    //
    // Initialize position struct on first call.
    //

    if ( !pPosData->nAllocLength ) {
        // Initialize the useful members
        pPosData->nBufferPos = 0;
        pPosData->nBufferLength = lstrlen( (LPCSTR) pECB->lpszQueryString );
        pPosData->nAllocLength = -1;

        char szMsg[256];

        wsprintf(
            szMsg,
            "pPosData->nBufferLength=%i",
            pPosData->nBufferLength
            );
        LOG( szMsg );
    }

    //
    // Check for end.  Deallocate and return if we're done.
    //

    if ( pPosData->nBufferPos == pPosData->nBufferLength ) {
        return -1;
    }

    //
    // Inc buffer pos and return a character
    //

    pPosData->nBufferPos++;
    return ( (int)pECB->lpszQueryString[pPosData->nBufferPos - 1] );
}

PPOSTKEY GetUrlKeys ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 1012 of file keys.cpp.

{
    return BuildKeyList( pECB, GetQueryByte );
}

int HexDigitToInt ( IN char c )

Definition at line 402 of file keys.cpp.

{
  if (c >= '0' && c <= '9')
    return (c - '0');

  if (tolower( c ) >= 'a' && tolower( c ) <= 'f')
    return (tolower( c ) - 'a'  + 10);

  return -1;
}

BOOL IsKeySeparator ( char c )

Definition at line 633 of file keys.cpp.

       :
    Identify key separators

Arguments:
    c - character

Returns:
    TRUE if character is a key separator,
    FALSE otherwise

--*/
{
    return ( c == '=' || c == '\r' || c == '\n' || c == '&' || !c );
}

Generated on Wed Nov 13 2024 16:54:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/extensions/Formdump/keys.h File Reference

  • Web
  • iis
  • extensions
  • Formdump
Typedefs | Functions

keys.h File Reference

Go to the source code of this file.

Typedefs

typedef void * | HKEYLIST

Functions

HKEYLIST | FindKey (IN HKEYLIST hKeyList, IN LPCSTR lpszSearchName)
void | FreeKeyList (IN HKEYLIST hKeyList)
LPBYTE | GetDataBuffer (IN HKEYLIST hKey)
LPBYTE | GetKeyBuffer (IN HKEYLIST hKey)
HKEYLIST | GetKeyInfo (IN HKEYLIST hKey, OUT LPCSTR *plpszKeyName, OUT LPDWORD pdwLength, OUT BOOL *pbHasCtrlChars, OUT LPINT pnInstance)
HKEYLIST | GetKeyList (IN EXTENSION_CONTROL_BLOCK *pECB)
DWORD | GetKeyOffset (IN HKEYLIST hKey)

Typedef Documentation

typedef void* HKEYLIST

Definition at line 13 of file keys.h.

Function Documentation

HKEYLIST FindKey | ( | IN HKEYLIST | hKeyList,
 |  | IN LPCSTR | lpszSearchName
 | ) |  |

Definition at line 1221 of file keys.cpp.

       :

    FindKey sequentially searches the linked list for a given key.

Arguments:

    hKeyList - points to key list
    lpszSearchName - points to a key name to find

Returns:

    The return handle points to the element within the linked list.
    Use it in GetKeyInfo, but not FreeKeyList.

--*/
{
    PPOSTKEY pFindKey;

    pFindKey = (PPOSTKEY) hKeyList;
    while ( pFindKey ) {
        if ( !lstrcmpi( lpszSearchName, ( LPCSTR ) ( &pFindKey[1] ) ) ) {
            return ( ( HKEYLIST ) pFindKey );
        }

        pFindKey = pFindKey->pNext;
    }

    return NULL;
}

void FreeKeyList ( IN HKEYLIST hKeyList )

Definition at line 1259 of file keys.cpp.

       :

    FreeKeyList deallocates all the objects in the key list.
    The content file is also deleted.

Arguments:
    hHeadKey - points to the list head

--*/
{
    PPOSTKEY pObject;
    PPOSTKEY pDel;
    PLISTPROP pProp;

    // Safety
    if ( !hHeadKey ) {
        return;
    }

#ifdef USE_TEMPORARY_FILES
    // Close the content file
    CloseContentFile( hHeadKey );

    // delete the content file
    pProp = GetPropAddr( hHeadKey );
    DeleteFile( pProp->szTempFileName );

#elif defined USE_MEMORY

    // delete content
    pProp = GetPropAddr( hHeadKey );
    HeapFree( GetProcessHeap( ), 0, (LPVOID) pProp->lpbyBuf );
#endif

    // delete all objects in the list
    pObject = (PPOSTKEY) hHeadKey;
    pObject = pObject->pHead;
    while ( pObject ) {

#ifdef USE_TEMPORARY_FILES
        //
        // Free each buffer when using temporary files
        //

        if ( pObject->lpbyBuf )
            HeapFree( GetProcessHeap( ), 0, (LPVOID) pObject->lpbyBuf );
#endif

        pDel = pObject;
        pObject = pObject->pNext;

        HeapFree( GetProcessHeap( ), 0, (LPVOID) pDel );
    }
}

LPBYTE GetDataBuffer ( IN HKEYLIST hKey )

Definition at line 1456 of file keys.cpp.

       :

    GetBufferPointer returns a pointer to the buffer used
    for content storage.

Arguments:

    hKeyList - points to a key list

Returns:

    pointer to the content buffer or NULL

--*/
{
    PLISTPROP pProp;

    // safety
    if ( !hKeyList )
        return NULL;

    pProp = GetPropAddr( hKeyList );

    return pProp->lpbyBuf;
}

LPBYTE GetKeyBuffer ( IN HKEYLIST hKey )

Definition at line 1139 of file keys.cpp.

{
    //
    // We have two versions of this function because
    // we may want to use file i/o when the extension
    // deals with massive amounts of inbound data
    // ( like multi-megabyte uploads ).
    //

    //
    // This version uses a memory buffer.
    //

    PPOSTKEY pKey;

    // Safety
    if ( !hKey ) {
        return NULL;
    }

    pKey = (PPOSTKEY) hKey;

    return (LPBYTE) pKey->lpbyBuf;
}

HKEYLIST GetKeyInfo | ( | IN HKEYLIST | hKey,
 |  | OUT LPCSTR * | plpszKeyName,
 |  | OUT LPDWORD | pdwLength,
 |  | OUT BOOL * | pbHasCtrlChars,
 |  | OUT LPINT | pnInstance
 | ) |  |

Definition at line 1100 of file keys.cpp.

{
    PPOSTKEY pPostKey;

    // Safety
    if ( !hKey ) {
        return NULL;
    }

    pPostKey = (PPOSTKEY) hKey;

    // Set the data members
    if ( plpszKeyName )
        *plpszKeyName = ( LPCSTR ) ( &pPostKey[1] );
    if ( pdwLength )
        *pdwLength = pPostKey->dwLength;
    if ( pbHasCtrlChars )
        *pbHasCtrlChars = pPostKey->bHasCtrlChars;
    if ( pnInstance )
        *pnInstance = pPostKey->nInstance;

    // Return a handle to the next object in the list
    return ( ( HKEYLIST ) pPostKey->pNext );
}

HKEYLIST GetKeyList ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 1062 of file keys.cpp.

       :

    Examines the method and calls GetPostKeys or GetUrlKeys,
    whichever is relevant.

Arguments:
    pECB - points to the extension control block

Returns:
    GetPropAddr returns the address of the end of
    the first key.  We stuff list properties there.
    This implementation of keys.cpp keeps a pointer
    to the content buffer.  The second version ( used
    in IS2WCGI ) appends a temporary file name
    to the first key.

--*/
{
    if ( !lstrcmpi( pECB->lpszMethod, "POST" ) ) {
        LOG( "Method=POST" );
        return (HKEYLIST) GetPostKeys( pECB );
    }else if ( !lstrcmpi( pECB->lpszMethod, "GET" ) ) {
        LOG( "Method=GET" );
        return (HKEYLIST) GetUrlKeys( pECB );
    }
    LOG( "Unknown method" );

    return NULL;
}

DWORD GetKeyOffset ( IN HKEYLIST hKey )

Definition at line 1321 of file keys.cpp.

       :

    GetKeyOffset returns the offset of a key into the internal
    buffer or temporary file.  This is provided for IS2WCGI
    so it can return an offset within the content file.

Arguments:

    hKey - points to a key

Returns:

    Offset of a key or NULL if no key provided

--*/
{
    // Safety
    if ( !hKey )
        return NULL;

    return ( (PPOSTKEY) hKey )->dwOffset;
}

Generated on Wed Nov 13 2024 16:54:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/extensions/InvokObjThreads/InvokObjThreads.cpp File Reference

  • Web
  • iis
  • extensions
  • InvokObjThreads
Defines | Functions | Variables

InvokObjThreads.cpp File Reference

#include <windows.h>
#include <httpext.h>
#include "IsapiThread.h"
#import "GetUserName.dll"

Go to the source code of this file.

Defines

#define | _WIN32_WINNT 0x0400

Functions

BOOL APIENTRY | DllMain (HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
BOOL WINAPI | GetExtensionVersion (HSE_VERSION_INFO *pVer)
DWORD WINAPI | HttpExtensionProc (EXTENSION_CONTROL_BLOCK *pecb)
BOOL WINAPI | TerminateExtension (DWORD dwFlags)
DWORD WINAPI | WorkerThread (LPVOID pParam)

Variables

ISAPITHREAD * pThreadPool

Define Documentation

#define _WIN32_WINNT 0x0400

Definition at line 12 of file InvokObjThreads.cpp.

Function Documentation

BOOL APIENTRY DllMain | ( | HANDLE | hModule,
 |  | DWORD | ul_reason_for_call,
 |  | LPVOID | lpReserved
 | ) |  |

Definition at line 43 of file InvokObjThreads.cpp.

{
  switch (ul_reason_for_call) {

    case DLL_PROCESS_ATTACH:

      // Allocate the thread pool object

      pThreadPool = new ISAPITHREAD;

      if (!pThreadPool) {

        #ifdef _DEBUG
          OutputDebugString("Failed to allocate thread pool object. InvokObjThreads is terminating.\r\n");
        #endif  // _DEBUG

        return FALSE;
      }

      // Initialize the worker threads

      if (!pThreadPool->InitThreadPool(WorkerThread)) {

        #ifdef _DEBUG
          OutputDebugString("Failed to initialize worker threads. InvokObjThreads is terminating.\r\n");
        #endif  // _DEBUG

        delete pThreadPool;

        return FALSE;
      }

      break;

    case DLL_PROCESS_DETACH:

      break;

    default:

      return TRUE;
  }

  return TRUE;
}

BOOL WINAPI GetExtensionVersion ( HSE_VERSION_INFO * pVer )

Definition at line 101 of file InvokObjThreads.cpp.

{
  pVer->dwExtensionVersion = MAKELONG( HSE_VERSION_MINOR, HSE_VERSION_MAJOR );

  lstrcpyn( pVer->lpszExtensionDesc, "InvokObjThreads ISAPI Sample", HSE_MAX_EXT_DLL_NAME_LEN );

  return TRUE;
}

DWORD WINAPI HttpExtensionProc ( EXTENSION_CONTROL_BLOCK * pecb )

Definition at line 124 of file InvokObjThreads.cpp.

{
  HSE_SEND_HEADER_EX_INFO HeaderExInfo;

  // Add the request to the work item queue.
  // If successful, we're done.  If not, return an error to the client

  if (pThreadPool->QueueWorkItem(pecb))
      return HSE_STATUS_PENDING;

  // Send headers back to client

  HeaderExInfo.pszStatus = "200 OK";
  HeaderExInfo.cchStatus = strlen(HeaderExInfo.pszStatus);
  HeaderExInfo.pszHeader = "Content-type: text/html\r\n\r\n";
  HeaderExInfo.cchHeader = strlen(HeaderExInfo.pszHeader);
  HeaderExInfo.fKeepConn = FALSE;

  pecb->ServerSupportFunction(pecb->ConnID, HSE_REQ_SEND_RESPONSE_HEADER_EX, &HeaderExInfo, NULL, NULL);

  // Send back a message to the client indicating that the queue is full

  CHAR szOutput[] = "<h1>InvokObjThreads.dll</h1><hr>The resource is busy.  Pleast try again later.";

  DWORD dwBuffSize = strlen(szOutput);

  pecb->WriteClient(pecb->ConnID, szOutput, &dwBuffSize, 0);

  return HSE_STATUS_SUCCESS;
}

BOOL WINAPI TerminateExtension ( DWORD dwFlags )

Definition at line 169 of file InvokObjThreads.cpp.

{
  // Delete the thread pool object

  delete pThreadPool;

  // It is now OK to unload

  return TRUE;
}

DWORD WINAPI WorkerThread ( LPVOID pParam )

Definition at line 192 of file InvokObjThreads.cpp.

{
  ISAPITHREAD *pThreadPool = (ISAPITHREAD *)pParam;

  #ifdef _DEBUG
    CHAR szDebug[1024];
  #endif

  // Get the ThreadId for this thread

  DWORD dwThreadId = GetCurrentThreadId();

  #ifdef _DEBUG
    wsprintf(szDebug, "Initializing worker thread %d.\r\n", dwThreadId);

    OutputDebugString(szDebug);
  #endif // _DEBUG

  // Initialize COM for this thread

  HRESULT hr = CoInitialize(NULL);

  if (FAILED(hr)) {

    #ifdef _DEBUG
      wsprintf(szDebug, "CoIntialize failed for thread %d: 0x%08x (%d)\r\n", dwThreadId, hr, hr);

      OutputDebugString(szDebug);
    #endif // _DEBUG

    return FALSE;
  }

  // Initialize and instance of the automation server for this thread

  GETUSERNAMELib::IGetUserNameObjPtr pItf;

  hr = pItf.CreateInstance(L"GetUserNameObj.GetUserNameObj.1");

  if (FAILED(hr)) {

    #ifdef _DEBUG
      wsprintf(szDebug, "Failed to get interface pointer for thread %d: 0x%08x (%d)\r\n", dwThreadId, hr, hr);

      OutputDebugString(szDebug);
    #endif // _DEBUG

    goto ExitWorkerThread;
  }

  // Completed thread initialization.  Now wait for work

  for (;;) {

    #ifdef _DEBUG
      wsprintf(szDebug, "Thread %d waiting for work.\r\n", dwThreadId);

      OutputDebugString(szDebug);
    #endif  // _DEBUG

    DWORD dwResult = WaitForSingleObject(pThreadPool->m_hWorkerThreadSemaphore, INFINITE);

    // Check to see that the wait succeeded

    if (dwResult != WAIT_OBJECT_0) {

      #ifdef _DEBUG
        wsprintf(szDebug, "Thread %d exiting due to wait failure.\r\n", dwThreadId);

        OutputDebugString(szDebug);
      #endif  // _DEBUG

      goto ExitWorkerThread;
    }

    // Get the next work item in the queue.  If the work item is NULL,
    // the thread should exit gracefully.

    EXTENSION_CONTROL_BLOCK *pecb = pThreadPool->GetWorkItem();

    if (!pecb) {

      #ifdef _DEBUG
        wsprintf(szDebug, "Thread %d exiting gracefully.\r\n", dwThreadId);

        OutputDebugString(szDebug);
      #endif  // _DEBUG

      goto ExitWorkerThread;
    }

    ///////
    // Process the work item
    ///////

    #ifdef _DEBUG
      wsprintf(szDebug, "Thread %d processing work item.\r\n", dwThreadId);

      OutputDebugString(szDebug);
    #endif  // _DEBUG

    // Get the request token from IIS and set the token for this thead

    HANDLE hRequestToken;

    pecb->ServerSupportFunction(pecb->ConnID, HSE_REQ_GET_IMPERSONATION_TOKEN, &hRequestToken, NULL, NULL);

    SetThreadToken(NULL, hRequestToken);

    // Send headers back to client

    HSE_SEND_HEADER_EX_INFO HeaderExInfo;

    HeaderExInfo.pszStatus = "200 OK";
    HeaderExInfo.cchStatus = strlen( HeaderExInfo.pszStatus );
    HeaderExInfo.pszHeader = "Content-type: text/html\r\n\r\n";
    HeaderExInfo.cchHeader = strlen( HeaderExInfo.pszHeader );
    HeaderExInfo.fKeepConn = FALSE;

    pecb->ServerSupportFunction(pecb->ConnID, HSE_REQ_SEND_RESPONSE_HEADER_EX, &HeaderExInfo, NULL, NULL);

    // Build the output using the result of the call to GetUserNameObj's GetMyName method

    char szOutput[1024];

    wsprintf(szOutput, "<h1>Request handled by thread %d.</h1><hr>The GetMyName method returned %s.", dwThreadId, (char *)pItf->GetMyName());

    // Send the output back to the client

    DWORD dwBuffSize = strlen(szOutput);

    pecb->WriteClient(pecb->ConnID, szOutput, &dwBuffSize, 0);

    // Notify IIS that we are done processing the request

    pecb->ServerSupportFunction(pecb->ConnID, HSE_REQ_DONE_WITH_SESSION, NULL, NULL, NULL);
  }

ExitWorkerThread:

  // Uninitialize COM for this thread and return

  CoUninitialize();

  return 0;
}

Variable Documentation

ISAPITHREAD* pThreadPool

Definition at line 27 of file InvokObjThreads.cpp.

Generated on Wed Nov 13 2024 16:54:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/extensions/InvokObjThreads/IsapiThread.cpp File Reference

  • Web
  • iis
  • extensions
  • InvokObjThreads

IsapiThread.cpp File Reference

#include "IsapiThread.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/extensions/InvokObjThreads/IsapiThread.h File Reference

  • Web
  • iis
  • extensions
  • InvokObjThreads
Classes

IsapiThread.h File Reference

#include <windows.h>
#include <httpext.h>

Go to the source code of this file.

Classes

class ISAPITHREAD
Generated on Wed Nov 13 2024 16:54:50 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/extensions/io/ASyncRead/areadcli.c File Reference

  • Web
  • iis
  • extensions
  • io
  • ASyncRead
Classes | Defines | Typedefs | Functions

areadcli.c File Reference

#include <windows.h>
#include <stdio.h>
#include <httpext.h>

Go to the source code of this file.

Classes

struct | _IO_WORK_ITEM

Defines

#define | MAX_BUF_SIZE (49152)
#define | MEM_ALLOC_THRESHOLD (1024 * 1024)

Typedefs

typedef struct _IO_WORK_ITEM | IO_WORK_ITEM
typedef struct _IO_WORK_ITEM * | PIOWI

Functions

LPVOID | AR_Allocate (IN LPEXTENSION_CONTROL_BLOCK pecb, IN DWORD dwSize)
BOOL | AR_Free (IN LPEXTENSION_CONTROL_BLOCK pecb, IN LPVOID pvData)
VOID WINAPI | AsyncReadClientIoCompletion (IN LPEXTENSION_CONTROL_BLOCK pecb, IN PVOID pContext, IN DWORD cbIO, IN DWORD dwError)
DllMain (IN HINSTANCE hinstDll, IN DWORD fdwReason, IN LPVOID lpvContext OPTIONAL)
DWORD | DoAsyncReadClient (IN PIOWI piowi)
VOID | DoCleanUp (IN PIOWI piowi)
DWORD | DoInit (IN OUT PIOWI piowi)
BOOL WINAPI | GetExtensionVersion (HSE_VERSION_INFO *pVer)
DWORD WINAPI | HttpExtensionProc (LPEXTENSION_CONTROL_BLOCK pecb)
DWORD | SendMSGToClient (IN LPEXTENSION_CONTROL_BLOCK pecb, IN LPCSTR pszErrorMsg)
BOOL WINAPI | TerminateExtension (DWORD dwFlags)

Define Documentation

#define MAX_BUF_SIZE (49152)

Definition at line 22 of file areadcli.c.

#define MEM_ALLOC_THRESHOLD (1024 * 1024)

Definition at line 23 of file areadcli.c.

Typedef Documentation

typedef struct _IO_WORK_ITEM IO_WORK_ITEM
typedef struct _IO_WORK_ITEM * PIOWI

Function Documentation

LPVOID AR_Allocate | ( | IN LPEXTENSION_CONTROL_BLOCK | pecb,
 |  | IN DWORD | dwSize
 | ) |  |

Definition at line 600 of file areadcli.c.

{
  LPVOID pvData = NULL;

  if (pecb->cbTotalBytes > MEM_ALLOC_THRESHOLD)
    pvData = VirtualAlloc(NULL, dwSize, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
   else
    pvData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwSize);

  return pvData;
}

BOOL AR_Free | ( | IN LPEXTENSION_CONTROL_BLOCK | pecb,
 |  | IN LPVOID | pvData
 | ) |  |

Definition at line 631 of file areadcli.c.

{
  BOOL fReturn = FALSE;

  if (pecb->cbTotalBytes > MEM_ALLOC_THRESHOLD)
    fReturn = VirtualFree(pvData, 0, MEM_RELEASE);
  else
    fReturn = HeapFree(GetProcessHeap(), 0, pvData);

  return fReturn;
}

VOID WINAPI AsyncReadClientIoCompletion | ( | IN LPEXTENSION_CONTROL_BLOCK | pecb,
 |  | IN PVOID | pContext,
 |  | IN DWORD | cbIO,
 |  | IN DWORD | dwError
 | ) |  |

Definition at line 429 of file areadcli.c.

{
  BOOL fReturn;
  CHAR szTmp[MAX_BUF_SIZE];
  DWORD dwFlags;
  DWORD cbTotalToRead;
  BYTE *pbData = NULL;
  PIOWI piowi = (PIOWI)pContext;
  EXTENSION_CONTROL_BLOCK *pecb = piowi->pecb;

  if (ERROR_SUCCESS == dwError) {

    /* Read successfully, so update current total bytes read (aka index of grand data holder) */

    piowi->cbReadSoFar += cbIO;

    /* If they are equal, we finish reading all bytes from client */

    if (piowi->cbReadSoFar == pecb->cbTotalBytes) {

      /* Construct the report and write it to client */

      pbData = (PBYTE)AR_Allocate(pecb, piowi->cbReadSoFar + MAX_BUF_SIZE);

      if (NULL == pbData) {

        SetLastError(ERROR_NOT_ENOUGH_MEMORY);

        wsprintf(szTmp, "Failed to allocate memory inside AsyncReadClientIoCompletion().");

        SendMSGToClient(pecb, szTmp);

        DoCleanUp(piowi);

        return;
      }

      wsprintf(pbData, g_szReport, pecb->cbTotalBytes, piowi->cbReadSoFar);

      piowi->pbDATAFromClient[piowi->cbReadSoFar] = 0;

      strcat(pbData, piowi->pbDATAFromClient);

      SendMSGToClient(pecb, pbData);

      AR_Free(piowi->pecb, pbData);

      DoCleanUp(piowi);

    } else {

      /*
        Still have more data to read...

        We need to first check if the size of the remaining chunk
        is less than MAX_BUF_SIZE, if so just read what is available,
        otherwise read MAX_BUF_SIZE bytes of data.
      */

      cbTotalToRead = pecb->cbTotalBytes - piowi->cbReadSoFar;

      if (cbTotalToRead > MAX_BUF_SIZE)
        cbTotalToRead = MAX_BUF_SIZE;

      /* Fire off another call to perform an asynchronus read from the client. */

      dwFlags = HSE_IO_ASYNC;

      /* append the new chunk to buffer, cbReadSoFar indexes the byte right after the last written byte in the buffer */

      fReturn = pecb->ServerSupportFunction(pecb->ConnID, HSE_REQ_ASYNC_READ_CLIENT, piowi->pbDATAFromClient + piowi->cbReadSoFar, &cbTotalToRead, &dwFlags);

      if (!fReturn) {

        wsprintf(szTmp, "Problem occurred at ServerSupportFunction() sending HSE_REQ_ASYNC_READ_CLIENT request.");

        SendMSGToClient(pecb, szTmp);

        DoCleanUp(piowi);
      }
    }

  } else {

    /* Error on read */

    SetLastError(dwError);

    DoCleanUp(piowi);
  }
}

DllMain | ( | IN HINSTANCE | hinstDll,
 |  | IN DWORD | fdwReason,
 |  | IN LPVOID lpvContext | OPTIONAL
 | ) |  |

Definition at line 80 of file areadcli.c.

{
  BOOL fReturn = TRUE;

  switch (fdwReason) {

    case DLL_PROCESS_ATTACH :

        OutputDebugString("Initializing the global data for areadcli.dll\n");

        /* Prevent the system from calling DllMain when threads are created or destroyed. */

        DisableThreadLibraryCalls(hinstDll);

        /* Initialize various data and modules. */

        break;

    case DLL_PROCESS_DETACH :

        if (lpvContext != NULL)
        {
        }

        break;

    default:

      break;
  }

  return fReturn;
}

DWORD DoAsyncReadClient ( IN PIOWI piowi )

Definition at line 322 of file areadcli.c.

{
  BOOL    fReturn;
  CHAR    szTmp[MAX_BUF_SIZE];
  DWORD   dwFlags;
  DWORD   cbTotalToRead = MAX_BUF_SIZE;
  DWORD   hseStatus =  HSE_STATUS_PENDING;
  BYTE    *pbData = NULL;

  /*
    Check if cbTotalBytes == cbAvailable if so lpbData contains all the data sent by
    the client, and complete the session.
  */

  if (piowi->pecb->cbTotalBytes == piowi->pecb->cbAvailable) {

    /* Construct the report and write it to client */

    pbData = (PBYTE)AR_Allocate(piowi->pecb, piowi->pecb->cbAvailable + MAX_BUF_SIZE);

    if (NULL == pbData) {

      SetLastError(ERROR_NOT_ENOUGH_MEMORY);

      return HSE_STATUS_ERROR;
    }

    wsprintf(pbData, g_szReport, piowi->pecb->cbTotalBytes, piowi->pecb->cbAvailable);

    strcat(pbData, piowi->pecb->lpbData);

    hseStatus = SendMSGToClient(piowi->pecb, pbData);

    AR_Free(piowi->pecb, pbData);

    DoCleanUp(piowi);

    return hseStatus; // HSE_STATUS_SUCCESS or HSE_STATUS_ERROR;
  }

  /*
    There is more to read. Set a call back function and context that will
    be used for handling asynchrnous IO operations. This only needs to set up once.
  */

  fReturn = piowi->pecb->ServerSupportFunction(piowi->pecb->ConnID, HSE_REQ_IO_COMPLETION, AsyncReadClientIoCompletion, 0, (LPDWORD)piowi);

  if (!fReturn) {

    wsprintf (szTmp, "Problem occurred at ServerSupportFunction() sending HSE_REQ_IO_COMPLETION request.");

    SendMSGToClient(piowi->pecb, szTmp);

    return HSE_STATUS_ERROR;
  }

  /*
    Fire off the call to perform an asynchronus read from the client.

    We need to first check if the size of the remaining chunk
    is less than MAX_BUF_SIZE, if so just read what is available,
    otherwise read MAX_BUF_SIZE bytes of data.
  */

  cbTotalToRead = piowi->pecb->cbTotalBytes - piowi->cbReadSoFar;

  if (cbTotalToRead > MAX_BUF_SIZE)
    cbTotalToRead = MAX_BUF_SIZE;

  dwFlags = HSE_IO_ASYNC;

  /* append the new chunk to buffer, cbReadSoFar indexes the byte right after the last written byte in the buffer */

  fReturn = piowi->pecb->ServerSupportFunction(piowi->pecb->ConnID, HSE_REQ_ASYNC_READ_CLIENT, piowi->pbDATAFromClient +  piowi->cbReadSoFar, &cbTotalToRead, &dwFlags);

  if (!fReturn) {

    wsprintf(szTmp, "Problem occurred at ServerSupportFunction() sending HSE_REQ_ASYNC_READ_CLIENT request.");

    SendMSGToClient(piowi->pecb, szTmp);

    hseStatus = HSE_STATUS_ERROR;
  }

  return hseStatus;
}

VOID DoCleanUp ( IN PIOWI piowi )

Definition at line 570 of file areadcli.c.

{
  if (piowi->pbDATAFromClient != NULL)
    AR_Free( piowi->pecb, piowi->pbDATAFromClient);

  piowi->pecb->ServerSupportFunction(piowi->pecb->ConnID, HSE_REQ_DONE_WITH_SESSION, NULL, NULL, NULL);

  LocalFree(piowi);

  return;
}

DWORD DoInit ( IN OUT PIOWI piowi )

Definition at line 536 of file areadcli.c.

{
  piowi->pbDATAFromClient = (PBYTE)AR_Allocate(piowi->pecb, piowi->pecb->cbTotalBytes + MAX_BUF_SIZE);

  if (NULL == piowi->pbDATAFromClient) {

    SetLastError(ERROR_NOT_ENOUGH_MEMORY);

    return HSE_STATUS_ERROR;
  }

  /* The first chunk (read-ahead chunk) has arrived. */

  strcpy(piowi->pbDATAFromClient, piowi->pecb->lpbData);

  piowi->cbReadSoFar = piowi->pecb->cbAvailable;

  return HSE_STATUS_SUCCESS;
}

BOOL WINAPI GetExtensionVersion ( HSE_VERSION_INFO * pVer )

Definition at line 128 of file areadcli.c.

{
  pVer->dwExtensionVersion = MAKELONG(HSE_VERSION_MINOR, HSE_VERSION_MAJOR);

  lstrcpyn((LPSTR) pVer->lpszExtensionDesc, "Asynchronous Read Client Sample ISAPI DLL", HSE_MAX_EXT_DLL_NAME_LEN);

  return TRUE;
}

DWORD WINAPI HttpExtensionProc ( LPEXTENSION_CONTROL_BLOCK pecb )

Definition at line 155 of file areadcli.c.

{
  PIOWI   piowi;
  DWORD   hseStatus = HSE_STATUS_SUCCESS;

  /*
    The string length of textarea name "Data=" is 5.
    Available bytes <= 5 indicates that no user-
    entered data has been sent, and the post form
    is shown.
  */

  if (pecb->cbAvailable <= 5) {

      hseStatus = SendMSGToClient(pecb, g_szPostForm);

  } else {

    piowi  = (PIOWI)LocalAlloc(LMEM_FIXED, sizeof(IO_WORK_ITEM));

    if (NULL == piowi) {

      SetLastError(ERROR_NOT_ENOUGH_MEMORY);

      return HSE_STATUS_ERROR;
    }

    piowi->pecb = pecb;

    /*
      Init Grand data holder, assign the first chunk(read-ahead chunk)
      and update the index (cbRreadSoFar) of the grand data holder.
    */

    hseStatus = DoInit(piowi);

    if (HSE_STATUS_ERROR != hseStatus) {

      /* Now we are ready to do asynchronous readclient here */

      hseStatus = DoAsyncReadClient(piowi);

      if (hseStatus != HSE_STATUS_PENDING) {

        /* When IO finishes, tell IIS we will end the session. Also clean up other resources here */

        DoCleanUp(piowi);
      }
    }
  }

  return hseStatus;
}

DWORD SendMSGToClient | ( | IN LPEXTENSION_CONTROL_BLOCK | pecb,
 |  | IN LPCSTR | pszErrorMsg
 | ) |  |

Definition at line 245 of file areadcli.c.

{
  HSE_SEND_HEADER_EX_INFO SHEI;

  BOOL    fReturn;
  DWORD   cbText;
  DWORD   hseStatus = HSE_STATUS_SUCCESS;
  CHAR    *pszText = NULL;

  CHAR    szStatus[] = "200 OK";
  CHAR    szHeaderBase[] = "Content-type: text/html\r\n\r\n";

  /*
    Populate SendHeaderExInfo struct

    NOTE we must send Content-Length header with correct
    byte count in order for keep-alive to work.
  */

  SHEI.pszStatus = szStatus;
  SHEI.pszHeader = szHeaderBase;
  SHEI.cchStatus = lstrlen(szStatus);
  SHEI.cchHeader = lstrlen(szHeaderBase);
  SHEI.fKeepConn = FALSE;

  /* Build page */

  cbText = strlen("<head><title>Simple Async Read Client Sample</title></head>\n<body></body>\n") + strlen(pszMsg) + 1;

  pszText = (PCHAR)AR_Allocate(pecb, cbText);

  /* Verify allocation */

  if (NULL == pszText) {

    SetLastError(ERROR_NOT_ENOUGH_MEMORY);

    return HSE_STATUS_ERROR;
  }

  strcpy(pszText, "<head><title>Simple Async Read Client Sample</title></head>\n");
  strcat(pszText, "<body>");
  strcat(pszText, pszMsg);
  strcat(pszText, "</body>\n");

  cbText = (DWORD)strlen(pszText);

  /* Send header and body text to client */

  fReturn = pecb->ServerSupportFunction(pecb->ConnID, HSE_REQ_SEND_RESPONSE_HEADER_EX, &SHEI, NULL, NULL);

  fReturn &= pecb->WriteClient(pecb->ConnID, pszText, &cbText, 0);

  if (!fReturn)
    hseStatus = HSE_STATUS_ERROR;

  AR_Free(pecb, pszText);

  return hseStatus;
}

BOOL WINAPI TerminateExtension ( DWORD dwFlags )

Definition at line 223 of file areadcli.c.

{
  return TRUE;
}

Generated on Wed Nov 13 2024 16:54:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/extensions/io/ASyncTrans/ftrans.c File Reference

  • Web
  • iis
  • extensions
  • io
  • ASyncTrans
Classes | Defines | Typedefs | Functions | Variables

ftrans.c File Reference

#include <windows.h>
#include "httpext.h"
#include "openf.h"

Go to the source code of this file.

Classes

struct | _AIO_WORK_ITEM

Defines

#define | MAX_BUFFER_SIZE 400
#define | USE_WORK_QUEUE 0

Typedefs

typedef struct _AIO_WORK_ITEM | AIO_WORK_ITEM
typedef struct _AIO_WORK_ITEM * | PAWI

Functions

VOID | CleanupAW (IN PAWI paw, IN BOOL fDoneWithSession)
BOOL WINAPI | DllMain (IN HINSTANCE hinstDll, IN DWORD fdwReason, IN LPVOID lpvContext OPTIONAL)
BOOL WINAPI | GetExtensionVersion (HSE_VERSION_INFO *pVer)
VOID WINAPI | HseIoCompletion (IN EXTENSION_CONTROL_BLOCK *pECB, IN PVOID pContext, IN DWORD cbIO, IN DWORD dwError)
DWORD WINAPI | HttpExtensionProc (EXTENSION_CONTROL_BLOCK *pecb)
DWORD | SendFileOver (IN EXTENSION_CONTROL_BLOCK *pecb, IN HANDLE hFile, IN LPCSTR pszFile)
DWORD | SendFileToClient (IN EXTENSION_CONTROL_BLOCK *pecb, IN LPCSTR pszFile)
DWORD | SendHeaderToClient (IN EXTENSION_CONTROL_BLOCK *pecb, IN LPCSTR pszErrorMsg)
BOOL WINAPI | TerminateExtension (DWORD dwFlags)

Variables

CRITICAL_SECTION | g_csWorkItems
LIST_ENTRY | g_lWorkItems

Define Documentation

#define MAX_BUFFER_SIZE 400

Definition at line 21 of file ftrans.c.

#define USE_WORK_QUEUE 0

Definition at line 20 of file ftrans.c.

Typedef Documentation

typedef struct _AIO_WORK_ITEM AIO_WORK_ITEM
typedef struct _AIO_WORK_ITEM * PAWI

Function Documentation

VOID CleanupAW | ( | IN PAWI | paw,
 |  | IN BOOL | fDoneWithSession
 | ) |  |

Definition at line 244 of file ftrans.c.

{
  DWORD err = GetLastError();

  if (paw->hseTf.hFile != INVALID_HANDLE_VALUE)
    FcCloseFile(paw->hseTf.hFile);

  if (fDoneWithSession)
    paw->pecb->ServerSupportFunction( paw->pecb->ConnID, HSE_REQ_DONE_WITH_SESSION, NULL, NULL, NULL);

  SetLastError(err);

  /* Remove from work items list */

  #if USE_WORK_QUEUE
    EnterCriticalSection(&g_csWorkItems);
    RemoveEntryList(&paw->listEntry);
    LeaveCriticalSection(&g_csWorkItems);
  # endif

  LocalFree(paw);
}

BOOL WINAPI DllMain | ( | IN HINSTANCE | hinstDll,
 |  | IN DWORD | fdwReason,
 |  | IN LPVOID lpvContext | OPTIONAL
 | ) |  |

Definition at line 54 of file ftrans.c.

{
  BOOL fReturn = TRUE;

  switch (fdwReason) {

    case DLL_PROCESS_ATTACH :

      OutputDebugString(" Initializing the global data in ftrans.dll\n");

      /* Initialize various data and modules. */

      InitializeCriticalSection(&g_csWorkItems);
      InitializeListHead(&g_lWorkItems);
      InitFileHandleCache();

      break;

    case DLL_PROCESS_DETACH :

      /*
        Only cleanup when we are called because of a FreeLibrary() (i.e., when lpvContext == NULL)
        If we are called because of a process termination, dont free anything. System will free resources and memory for us.
      */

      CleanupFileHandleCache();

      if (lpvContext != NULL)
        DeleteCriticalSection(&g_csWorkItems);

      break;

    default :

        break;
  }

  return fReturn;
}

BOOL WINAPI GetExtensionVersion ( HSE_VERSION_INFO * pVer )

Definition at line 136 of file ftrans.c.

{
  pVer->dwExtensionVersion = MAKELONG(HSE_VERSION_MINOR, HSE_VERSION_MAJOR);

  lstrcpyn((LPSTR) pVer->lpszExtensionDesc, "File Transfer using TransmitFile", HSE_MAX_EXT_DLL_NAME_LEN);

  return TRUE;
}

VOID WINAPI HseIoCompletion | ( | IN EXTENSION_CONTROL_BLOCK * | pECB,
 |  | IN PVOID | pContext,
 |  | IN DWORD | cbIO,
 |  | IN DWORD | dwError
 | ) |  |

Definition at line 288 of file ftrans.c.

{
  PAWI paw = (PAWI)pContext;
  EXTENSION_CONTROL_BLOCK *pecb = paw->pecb;

  CleanupAW(paw, TRUE);
}

DWORD WINAPI HttpExtensionProc ( EXTENSION_CONTROL_BLOCK * pecb )

Definition at line 110 of file ftrans.c.

{
  DWORD hseStatus;

  if (pecb->lpszQueryString == NULL || *pecb->lpszQueryString == '\0')
    hseStatus = SendHeaderToClient( pecb, "File Not Specified");
  else
    hseStatus = SendFileToClient( pecb, pecb->lpszQueryString);

  return hseStatus;
}

DWORD SendFileOver | ( | IN EXTENSION_CONTROL_BLOCK * | pecb,
 |  | IN HANDLE | hFile,
 |  | IN LPCSTR | pszFile
 | ) |  |

Definition at line 296 of file ftrans.c.

{
  PAWI paw;
  DWORD hseStatus = HSE_STATUS_PENDING;

  paw = (PAWI)LocalAlloc(LMEM_FIXED, sizeof(AIO_WORK_ITEM));

  if (NULL == paw) {

    SetLastError(ERROR_NOT_ENOUGH_MEMORY);

    return HSE_STATUS_ERROR;
  }

  /* Fill in all the data in AIO_WORK_ITEM */

  paw->pecb = pecb;

  InitializeListHead(&paw->listEntry);

  paw->hseTf.pfnHseIO = HseIoCompletion;
  paw->hseTf.pContext = paw;
  paw->hseTf.dwFlags = (HSE_IO_ASYNC | HSE_IO_DISCONNECT_AFTER_SEND);

  paw->hseTf.hFile = hFile;
  paw->hseTf.BytesToWrite = GetFileSize(hFile, NULL);
  paw->hseTf.Offset = 0;
  paw->hseTf.pTail = NULL;
  paw->hseTf.TailLength = 0;

  /* Set up the header to be sentout for the file */

  #if SEPARATE_HEADERS
    paw->hseTf.HeadLength = 0;
    paw->hseTf.pHead = NULL;
  #else
    paw->hseTf.HeadLength = wsprintfA(paw->pchBuffer, "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n<head><title>Simple File Transfer (TransmitFile) </title></head>\n<h1> Transferred file contains...</h1>\n");
    paw->hseTf.pHead = paw->pchBuffer;
  #endif

  /* Add to the list */

  #if USE_WORK_QUEUE
    EnterCriticalSection(&g_csWorkItems);
    InsertTailList(&g_lWorkItems, &paw->listEntry);
    LeaveCriticalSection(&g_csWorkItems);
  #endif

  /* Setup the Async TransmitFile */

  if (!pecb->ServerSupportFunction(pecb->ConnID, HSE_REQ_TRANSMIT_FILE, &paw->hseTf, NULL, NULL)) {

    /* Do cleanup and return error */

    /* File handle will be freed by the caller for errors */

    paw->hseTf.hFile = INVALID_HANDLE_VALUE;

    CleanupAW(paw, FALSE);

    hseStatus =  HSE_STATUS_ERROR;
  }

  return hseStatus;
}

DWORD SendFileToClient | ( | IN EXTENSION_CONTROL_BLOCK * | pecb,
 |  | IN LPCSTR | pszFile
 | ) |  |

Definition at line 192 of file ftrans.c.

{
  CHAR    pchBuffer[1024];
  HANDLE  hFile;
  DWORD   hseStatus = HSE_STATUS_SUCCESS;

  hFile = FcOpenFile(pecb, pszFile);

  if (INVALID_HANDLE_VALUE == hFile) {

    wsprintfA(pchBuffer, "OpenFailed: Error (%d) while opening the file %s.\n", GetLastError(), pszFile);

    hseStatus = SendHeaderToClient(pecb, pchBuffer);

  } else {

    #if SEPARATE_HEADERS
      hseStatus = SendHeaderToClient(pecb, "File Transfer begins");
    #else
      hseStatus = HSE_STATUS_SUCCESS;
    #endif

    if (hseStatus == HSE_STATUS_SUCCESS) {

      hseStatus = SendFileOver(pecb, hFile, pszFile);

      if (hseStatus != HSE_STATUS_PENDING) {

        /* assume that the data is transmitted. */

        if (hseStatus != HSE_STATUS_SUCCESS) {

          /* Error in transmitting the file. Send error message. */

          wsprintfA(pchBuffer, "Send Failed: Error (%d) for file %s.\n", GetLastError(), pszFile);

          SendHeaderToClient(pecb, pchBuffer);
        }
      }
    }

    if (hseStatus != HSE_STATUS_PENDING) {

      /* file handle is closed for all non-pending cases if the status is pending, file handle is cleaned up in callback */

      FcCloseFile(hFile);
    }
  }

  return hseStatus;
}

DWORD SendHeaderToClient | ( | IN EXTENSION_CONTROL_BLOCK * | pecb,
 |  | IN LPCSTR | pszErrorMsg
 | ) |  |

Definition at line 166 of file ftrans.c.

{
  HSE_SEND_HEADER_EX_INFO SendHeaderExInfo;
  char szStatus[]     = "200 OK";
  char szHeader[1024];

  /*  Note the HTTP header block is terminated by a blank '\r\n' pair, followed by the document body */

  wsprintf(szHeader, "Content-Type: text/html\r\n\r\n<head><title>Simple File Transfer (Transmit File)</title></head>\n<body><h1>%s</h1>\n", pszErrorMsg);

  /* Populate SendHeaderExInfo struct */

  SendHeaderExInfo.pszStatus = szStatus;
  SendHeaderExInfo.pszHeader = szHeader;
  SendHeaderExInfo.cchStatus = lstrlen(szStatus);
  SendHeaderExInfo.cchHeader = lstrlen(szHeader);
  SendHeaderExInfo.fKeepConn = FALSE;

  /* Send header - use the EX Version to send the header blob */

  if (!pecb->ServerSupportFunction(pecb->ConnID, HSE_REQ_SEND_RESPONSE_HEADER_EX, &SendHeaderExInfo, NULL, NULL))
    return HSE_STATUS_ERROR;

  return HSE_STATUS_SUCCESS;
}

BOOL WINAPI TerminateExtension ( DWORD dwFlags )

Definition at line 161 of file ftrans.c.

{
  return TRUE;
}

Variable Documentation

CRITICAL_SECTION g_csWorkItems

Definition at line 18 of file ftrans.c.

LIST_ENTRY g_lWorkItems

Definition at line 17 of file ftrans.c.

Generated on Wed Nov 13 2024 16:54:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/extensions/io/ASyncTrans/openf.c File Reference

  • Web
  • iis
  • extensions
  • io
  • ASyncTrans
Classes | Typedefs | Functions | Variables

openf.c File Reference

#include "openf.h"

Go to the source code of this file.

Classes

struct | _OPEN_FILE

Typedefs

typedef struct _OPEN_FILE * | LPOPEN_FILE
typedef struct _OPEN_FILE | OPEN_FILE

Functions

DWORD | CleanupFileHandleCache (VOID)
DWORD | FcCloseFile (IN HANDLE hFile)
HANDLE | FcOpenFile (IN EXTENSION_CONTROL_BLOCK *pecb, IN LPCSTR pszFile)
BOOL | FcReadFromFile (IN HANDLE hFile, OUT CHAR *pchBuffer, IN DWORD dwBufferSize, OUT LPDWORD pcbRead, IN OUT LPOVERLAPPED pov)
VOID | InitFileHandleCache (VOID)

Variables

CRITICAL_SECTION | g_csOpenFiles
DWORD | g_dwCreateFileFlags = (FILE_FLAG_SEQUENTIAL_SCAN | FILE_FLAG_OVERLAPPED)
DWORD | g_dwCreateFileShareMode = (FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE)
LPOPEN_FILE | g_pOpenFiles = NULL

Typedef Documentation

typedef struct _OPEN_FILE * LPOPEN_FILE
typedef struct _OPEN_FILE OPEN_FILE

Function Documentation

DWORD CleanupFileHandleCache ( VOID )

Definition at line 39 of file openf.c.

{
  LPOPEN_FILE  pFileScan;

  while (g_pOpenFiles != NULL) {

    pFileScan = g_pOpenFiles;

    g_pOpenFiles = g_pOpenFiles->pNext;

    if (pFileScan->hFile != INVALID_HANDLE_VALUE)
      CloseHandle( pFileScan->hFile);

    LocalFree(pFileScan);
  }

  DeleteCriticalSection(&g_csOpenFiles);

  return NO_ERROR;
}

DWORD FcCloseFile ( IN HANDLE hFile )

Definition at line 174 of file openf.c.

{
  LPOPEN_FILE pFileScan;
  DWORD dwError = NO_ERROR;

  EnterCriticalSection(&g_csOpenFiles);

  /* Look for the handle and decrement the ref count. */

  for (pFileScan = g_pOpenFiles; NULL != pFileScan; pFileScan = pFileScan->pNext) {

    if ( hFile == pFileScan->hFile) {

      /*  there is a file match. */

      pFileScan->nRefs--;

      /*
        Note: This is example code. Do not use for production, as there
        is no freeing of the file when Ref hits 0
      */

      break;
    }
  }

  if (NULL == pFileScan) {

    /* file handle not found */

    dwError = (ERROR_INVALID_HANDLE);
  }

  LeaveCriticalSection(&g_csOpenFiles);

  return dwError;
}

HANDLE FcOpenFile | ( | IN EXTENSION_CONTROL_BLOCK * | pecb,
 |  | IN LPCSTR | pszFile
 | ) |  |

Definition at line 77 of file openf.c.

{
  LPOPEN_FILE pFileScan;
  HANDLE hFile = INVALID_HANDLE_VALUE;

  EnterCriticalSection(&g_csOpenFiles);

  for (pFileScan =  g_pOpenFiles; NULL != pFileScan; pFileScan = pFileScan->pNext) {

    if (0 == lstrcmpi(pFileScan->rgchFile, pszFile)) {

      /* there is a file match. */

      break;
    }
  }

  if (NULL == pFileScan) {

    /* File was not found. Create a new file handle */

    CHAR rgchFileName[ MAX_PATH]; /* local copy */
    LPCSTR pszInputPath = pszFile;

    lstrcpyn(rgchFileName, pszFile, MAX_PATH);

    if (*pszFile == '/') {

      DWORD cbSize = sizeof(rgchFileName);
      BOOL fRet;

      /* reset the file pointer, so subsequent use will fail */

      pszFile = NULL;

      /* Using the ECB map the Virtual path to the Physical path */

      fRet = pecb->ServerSupportFunction(pecb->ConnID, HSE_REQ_MAP_URL_TO_PATH, rgchFileName, &cbSize, NULL);

      if (fRet) {

          /* we got the mapping. Use it. */

          pszFile = rgchFileName;
      }
    }

    if (NULL != pszFile) {

      pFileScan = LocalAlloc(LPTR, sizeof(*pFileScan));

      if (NULL != pFileScan) {

        SECURITY_ATTRIBUTES sa;

        sa.nLength = sizeof(sa);
        sa.lpSecurityDescriptor = NULL;
        sa.bInheritHandle = FALSE;

        pFileScan->hFile = CreateFile(pszFile, GENERIC_READ, g_dwCreateFileShareMode, &sa, OPEN_EXISTING, g_dwCreateFileFlags, NULL);

        if (INVALID_HANDLE_VALUE == pFileScan->hFile) {

          LocalFree(pFileScan);

          pFileScan = NULL;

        } else {

          /* insert this into the list at the top */

          lstrcpyn(pFileScan->rgchFile, pszInputPath, MAX_PATH);

          pFileScan->pNext = g_pOpenFiles;

          g_pOpenFiles = pFileScan;

          pFileScan->nRefs = 1;
          pFileScan->nHits = 0;
        }
      }
    }
  }

  if (NULL != pFileScan) {

    hFile = pFileScan->hFile;

    pFileScan->nHits++;
    pFileScan->nRefs++;
  }

  LeaveCriticalSection(&g_csOpenFiles);

  return hFile;
}

BOOL FcReadFromFile | ( | IN HANDLE | hFile,
 |  | OUT CHAR * | pchBuffer,
 |  | IN DWORD | dwBufferSize,
 |  | OUT LPDWORD | pcbRead,
 |  | IN OUT LPOVERLAPPED | pov
 | ) |  |

Definition at line 239 of file openf.c.

{
  BOOL fRet = TRUE;

  *pcbRead = 0;

  ResetEvent(pov->hEvent);

  /* read data from file */

  if (!ReadFile(hFile, pchBuffer, dwBufferSize, pcbRead, pov)) {

    DWORD err = GetLastError();

    if ((err != ERROR_IO_PENDING) || !GetOverlappedResult(hFile, pov, pcbRead, TRUE))
      fRet = FALSE;
  }

  if (fRet)
    pov->Offset += *pcbRead;

  return fRet;
}

VOID InitFileHandleCache ( VOID )

Definition at line 34 of file openf.c.

{
  InitializeCriticalSection(&g_csOpenFiles);
}

Variable Documentation

CRITICAL_SECTION g_csOpenFiles

Definition at line 27 of file openf.c.

DWORD g_dwCreateFileFlags = (FILE_FLAG_SEQUENTIAL_SCAN | FILE_FLAG_OVERLAPPED)

Definition at line 32 of file openf.c.

DWORD g_dwCreateFileShareMode = (FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE)

Definition at line 31 of file openf.c.

LPOPEN_FILE g_pOpenFiles = NULL

Definition at line 26 of file openf.c.

Generated on Wed Nov 13 2024 16:54:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/extensions/io/ASyncTrans/openf.h File Reference

  • Web
  • iis
  • extensions
  • io
  • ASyncTrans
Defines | Functions

openf.h File Reference

#include <windows.h>
#include <httpext.h>

Go to the source code of this file.

Defines

#define | InitializeListHead(ListHead)
#define | InsertHeadList(ListHead, Entry)
#define | InsertTailList(ListHead, Entry)
#define | IsListEmpty(ListHead) ((ListHead)->Flink == (ListHead))
#define | RemoveEntryList(Entry)
#define | RemoveHeadList(ListHead)
#define | RemoveTailList(ListHead)

Functions

DWORD | CleanupFileHandleCache (VOID)
DWORD | FcCloseFile (IN HANDLE hFile)
HANDLE | FcOpenFile (IN EXTENSION_CONTROL_BLOCK *pecb, IN LPCSTR pszFile)
BOOL | FcReadFromFile (IN HANDLE hFile, OUT CHAR *pchBuffer, IN DWORD dwBufferSize, OUT LPDWORD pcbRead, IN OUT LPOVERLAPPED pov)
VOID | InitFileHandleCache (VOID)

Define Documentation

#define InitializeListHead ( ListHead )
Value:
(\
    (ListHead)->Flink = (ListHead)->Blink = (ListHead))

Definition at line 19 of file openf.h.

#define InsertHeadList | ( | ListHead,
 |  | Entry
 | ) |
Value:
{\
    PLIST_ENTRY _EX_Flink;\
    PLIST_ENTRY _EX_ListHead;\
    _EX_ListHead = (ListHead);\
    _EX_Flink = _EX_ListHead->Flink;\
    (Entry)->Flink = _EX_Flink;\
    (Entry)->Blink = _EX_ListHead;\
    _EX_Flink->Blink = (Entry);\
    _EX_ListHead->Flink = (Entry);\
                                    }

Definition at line 52 of file openf.h.

#define InsertTailList | ( | ListHead,
 |  | Entry
 | ) |
Value:
{\
    PLIST_ENTRY _EX_Blink;\
    PLIST_ENTRY _EX_ListHead;\
    _EX_ListHead = (ListHead);\
    _EX_Blink = _EX_ListHead->Blink;\
    (Entry)->Flink = _EX_ListHead;\
    (Entry)->Blink = _EX_Blink;\
    _EX_Blink->Flink = (Entry);\
    _EX_ListHead->Blink = (Entry);\
                                    }

Definition at line 42 of file openf.h.

#define IsListEmpty ( ListHead ) ((ListHead)->Flink == (ListHead))

Definition at line 22 of file openf.h.

#define RemoveEntryList ( Entry )
Value:
{\
    PLIST_ENTRY _EX_Blink;\
    PLIST_ENTRY _EX_Flink;\
    _EX_Flink = (Entry)->Flink;\
    _EX_Blink = (Entry)->Blink;\
    _EX_Blink->Flink = _EX_Flink;\
    _EX_Flink->Blink = _EX_Blink;\
                            }

Definition at line 33 of file openf.h.

#define RemoveHeadList ( ListHead )
Value:
(ListHead)->Flink;\
    {RemoveEntryList((ListHead)->Flink)}

Definition at line 25 of file openf.h.

#define RemoveTailList ( ListHead )
Value:
(ListHead)->Blink;\
    {RemoveEntryList((ListHead)->Blink)}

Definition at line 29 of file openf.h.

Function Documentation

DWORD CleanupFileHandleCache ( VOID )

Definition at line 39 of file openf.c.

{
  LPOPEN_FILE  pFileScan;

  while (g_pOpenFiles != NULL) {

    pFileScan = g_pOpenFiles;

    g_pOpenFiles = g_pOpenFiles->pNext;

    if (pFileScan->hFile != INVALID_HANDLE_VALUE)
      CloseHandle( pFileScan->hFile);

    LocalFree(pFileScan);
  }

  DeleteCriticalSection(&g_csOpenFiles);

  return NO_ERROR;
}

DWORD FcCloseFile ( IN HANDLE hFile )

Definition at line 174 of file openf.c.

{
  LPOPEN_FILE pFileScan;
  DWORD dwError = NO_ERROR;

  EnterCriticalSection(&g_csOpenFiles);

  /* Look for the handle and decrement the ref count. */

  for (pFileScan = g_pOpenFiles; NULL != pFileScan; pFileScan = pFileScan->pNext) {

    if ( hFile == pFileScan->hFile) {

      /*  there is a file match. */

      pFileScan->nRefs--;

      /*
        Note: This is example code. Do not use for production, as there
        is no freeing of the file when Ref hits 0
      */

      break;
    }
  }

  if (NULL == pFileScan) {

    /* file handle not found */

    dwError = (ERROR_INVALID_HANDLE);
  }

  LeaveCriticalSection(&g_csOpenFiles);

  return dwError;
}

HANDLE FcOpenFile | ( | IN EXTENSION_CONTROL_BLOCK * | pecb,
 |  | IN LPCSTR | pszFile
 | ) |  |

Definition at line 77 of file openf.c.

{
  LPOPEN_FILE pFileScan;
  HANDLE hFile = INVALID_HANDLE_VALUE;

  EnterCriticalSection(&g_csOpenFiles);

  for (pFileScan =  g_pOpenFiles; NULL != pFileScan; pFileScan = pFileScan->pNext) {

    if (0 == lstrcmpi(pFileScan->rgchFile, pszFile)) {

      /* there is a file match. */

      break;
    }
  }

  if (NULL == pFileScan) {

    /* File was not found. Create a new file handle */

    CHAR rgchFileName[ MAX_PATH]; /* local copy */
    LPCSTR pszInputPath = pszFile;

    lstrcpyn(rgchFileName, pszFile, MAX_PATH);

    if (*pszFile == '/') {

      DWORD cbSize = sizeof(rgchFileName);
      BOOL fRet;

      /* reset the file pointer, so subsequent use will fail */

      pszFile = NULL;

      /* Using the ECB map the Virtual path to the Physical path */

      fRet = pecb->ServerSupportFunction(pecb->ConnID, HSE_REQ_MAP_URL_TO_PATH, rgchFileName, &cbSize, NULL);

      if (fRet) {

          /* we got the mapping. Use it. */

          pszFile = rgchFileName;
      }
    }

    if (NULL != pszFile) {

      pFileScan = LocalAlloc(LPTR, sizeof(*pFileScan));

      if (NULL != pFileScan) {

        SECURITY_ATTRIBUTES sa;

        sa.nLength = sizeof(sa);
        sa.lpSecurityDescriptor = NULL;
        sa.bInheritHandle = FALSE;

        pFileScan->hFile = CreateFile(pszFile, GENERIC_READ, g_dwCreateFileShareMode, &sa, OPEN_EXISTING, g_dwCreateFileFlags, NULL);

        if (INVALID_HANDLE_VALUE == pFileScan->hFile) {

          LocalFree(pFileScan);

          pFileScan = NULL;

        } else {

          /* insert this into the list at the top */

          lstrcpyn(pFileScan->rgchFile, pszInputPath, MAX_PATH);

          pFileScan->pNext = g_pOpenFiles;

          g_pOpenFiles = pFileScan;

          pFileScan->nRefs = 1;
          pFileScan->nHits = 0;
        }
      }
    }
  }

  if (NULL != pFileScan) {

    hFile = pFileScan->hFile;

    pFileScan->nHits++;
    pFileScan->nRefs++;
  }

  LeaveCriticalSection(&g_csOpenFiles);

  return hFile;
}

BOOL FcReadFromFile | ( | IN HANDLE | hFile,
 |  | OUT CHAR * | pchBuffer,
 |  | IN DWORD | dwBufferSize,
 |  | OUT LPDWORD | pcbRead,
 |  | IN OUT LPOVERLAPPED | pov
 | ) |  |

Definition at line 239 of file openf.c.

{
  BOOL fRet = TRUE;

  *pcbRead = 0;

  ResetEvent(pov->hEvent);

  /* read data from file */

  if (!ReadFile(hFile, pchBuffer, dwBufferSize, pcbRead, pov)) {

    DWORD err = GetLastError();

    if ((err != ERROR_IO_PENDING) || !GetOverlappedResult(hFile, pov, pcbRead, TRUE))
      fRet = FALSE;
  }

  if (fRet)
    pov->Offset += *pcbRead;

  return fRet;
}

VOID InitFileHandleCache ( VOID )

Definition at line 34 of file openf.c.

{
  InitializeCriticalSection(&g_csOpenFiles);
}

Generated on Wed Nov 13 2024 16:54:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/extensions/io/ASyncWrite/fwasync.c File Reference

  • Web
  • iis
  • extensions
  • io
  • ASyncWrite
Classes | Defines | Typedefs | Functions | Variables

fwasync.c File Reference

#include <windows.h>
#include <stdio.h>
#include "httpext.h"
#include "openf.h"

Go to the source code of this file.

Classes

struct | _AIO_WORK_ITEM

Defines

#define | MAX_BUFFER_SIZE 4096
#define | USE_WORK_QUEUE 0

Typedefs

typedef struct _AIO_WORK_ITEM | AIO_WORK_ITEM
typedef struct _AIO_WORK_ITEM * | PAWI

Functions

VOID | CleanupAW (IN PAWI paw, IN BOOL fDoneWithSession)
BOOL WINAPI | DllMain (IN HINSTANCE hinstDll, IN DWORD fdwReason, IN LPVOID lpvContext OPTIONAL)
BOOL WINAPI | GetExtensionVersion (HSE_VERSION_INFO *pVer)
VOID WINAPI | HseIoCompletion (IN EXTENSION_CONTROL_BLOCK *pECB, IN PVOID pContext, IN DWORD cbIO, IN DWORD dwError)
DWORD WINAPI | HttpExtensionProc (EXTENSION_CONTROL_BLOCK *pecb)
DWORD | ReadDataForPaw (IN PAWI paw)
DWORD | SendDataForPaw (IN PAWI paw)
DWORD | SendFileOver (IN EXTENSION_CONTROL_BLOCK *pecb, IN HANDLE hFile)
DWORD | SendFileToClient (IN EXTENSION_CONTROL_BLOCK *pecb, IN LPCSTR pszFile)
DWORD | SendHeaderToClient (IN EXTENSION_CONTROL_BLOCK *pecb, IN LPCSTR pszErrorMsg)
BOOL WINAPI | TerminateExtension (DWORD dwFlags)

Variables

CRITICAL_SECTION | g_csWorkItems
LIST_ENTRY | g_lWorkItems

Define Documentation

#define MAX_BUFFER_SIZE 4096

Definition at line 22 of file fwasync.c.

#define USE_WORK_QUEUE 0

Definition at line 21 of file fwasync.c.

Typedef Documentation

typedef struct _AIO_WORK_ITEM AIO_WORK_ITEM
typedef struct _AIO_WORK_ITEM * PAWI

Function Documentation

VOID CleanupAW | ( | IN PAWI | paw,
 |  | IN BOOL | fDoneWithSession
 | ) |  |

Definition at line 259 of file fwasync.c.

{
  DWORD err = GetLastError();

  FcCloseFile(paw->hFile);

  CloseHandle(paw->ov.hEvent);

  if (fDoneWithSession)
      paw->pecb->ServerSupportFunction( paw->pecb->ConnID, HSE_REQ_DONE_WITH_SESSION, NULL, NULL, NULL);

  SetLastError(err);

  /* Remove from work items list */

  #if USE_WORK_QUEUE
    EnterCriticalSection(&g_csWorkItems);
    RemoveEntryList(&paw->listEntry);
    LeaveCriticalSection(&g_csWorkItems);
  # endif

  LocalFree(paw);
}

BOOL WINAPI DllMain | ( | IN HINSTANCE | hinstDll,
 |  | IN DWORD | fdwReason,
 |  | IN LPVOID lpvContext | OPTIONAL
 | ) |  |

Definition at line 57 of file fwasync.c.

{
  BOOL fReturn = TRUE;

  switch (fdwReason) {

    case DLL_PROCESS_ATTACH :

      OutputDebugString( "Initializing the global data for fwasync.dll\n");

      /* Initialize various data and modules. */

      InitializeCriticalSection(&g_csWorkItems);

      InitializeListHead(&g_lWorkItems);

      fReturn = (InitFileHandleCache() == NO_ERROR);

      break;

    case DLL_PROCESS_DETACH :

      /*
        Only cleanup when we are called because of a FreeLibrary() *i.e., when lpvContext == NULL)
        If we are called because of a process termination, dont free anything. System will free resources and memory for us.
      */

      CleanupFileHandleCache();

      if (lpvContext != NULL)
        DeleteCriticalSection(&g_csWorkItems);

      break;

    default :

      break;
  }

  return fReturn;
}

BOOL WINAPI GetExtensionVersion ( HSE_VERSION_INFO * pVer )

Definition at line 141 of file fwasync.c.

{
  pVer->dwExtensionVersion = MAKELONG(HSE_VERSION_MINOR, HSE_VERSION_MAJOR);

  lstrcpyn((LPSTR) pVer->lpszExtensionDesc, "File Transfer using WriteClient", HSE_MAX_EXT_DLL_NAME_LEN);

  return TRUE;
}

VOID WINAPI HseIoCompletion | ( | IN EXTENSION_CONTROL_BLOCK * | pECB,
 |  | IN PVOID | pContext,
 |  | IN DWORD | cbIO,
 |  | IN DWORD | dwError
 | ) |  |

Definition at line 306 of file fwasync.c.

{
  PAWI paw = (PAWI)pContext;
  EXTENSION_CONTROL_BLOCK *pecb = paw->pecb;
  DWORD hseStatus;

  /*
    1. if no errors, do another read of the file
    2. send the read contents to client
    3. if no data present, cleanup and exit
  */

  if (dwError != NO_ERROR) {

    /* Do Cleanup */

    CleanupAW(paw, TRUE);

    return;
  }

  /* Read next chunk of data */

  paw->nRead = 0;

  hseStatus = ReadDataForPaw(paw);

  if (hseStatus == HSE_STATUS_SUCCESS && paw->nRead > 0)
    hseStatus = SendDataForPaw( paw);

  if (hseStatus != HSE_STATUS_PENDING)
    CleanupAW( paw, TRUE);
}

DWORD WINAPI HttpExtensionProc ( EXTENSION_CONTROL_BLOCK * pecb )

Definition at line 115 of file fwasync.c.

{
  DWORD hseStatus;

  if (pecb->lpszQueryString == NULL)
    hseStatus = SendHeaderToClient(pecb, "File Not Found");
  else
    hseStatus = SendFileToClient(pecb, pecb->lpszQueryString);

  return hseStatus;
}

DWORD ReadDataForPaw ( IN PAWI paw )

Definition at line 235 of file fwasync.c.

{
  DWORD hseStatus = HSE_STATUS_SUCCESS;

  /* read data from the file */

  if (!FcReadFromFile(paw->hFile, paw->pchBuffer, MAX_BUFFER_SIZE, &paw->nRead, &paw->ov))
    hseStatus = HSE_STATUS_ERROR;

  return hseStatus;
}

DWORD SendDataForPaw ( IN PAWI paw )

Definition at line 247 of file fwasync.c.

{
  DWORD hseStatus = HSE_STATUS_PENDING;

  /* write data to client */

  if (!paw->pecb->WriteClient(paw->pecb->ConnID, paw->pchBuffer, &paw->nRead, HSE_IO_ASYNC))
    hseStatus = HSE_STATUS_ERROR;

  return hseStatus;
}

DWORD SendFileOver | ( | IN EXTENSION_CONTROL_BLOCK * | pecb,
 |  | IN HANDLE | hFile
 | ) |  |

Definition at line 340 of file fwasync.c.

{
  PAWI paw;
  DWORD hseStatus = HSE_STATUS_SUCCESS;

  paw = (PAWI)LocalAlloc(LMEM_FIXED, sizeof(AIO_WORK_ITEM));

  if (paw == NULL) {

    SetLastError(ERROR_NOT_ENOUGH_MEMORY);

    return HSE_STATUS_ERROR;
  }

  /* Fill in all the data in AIO_WORK_ITEM */

  paw->pecb = pecb;
  InitializeListHead(&paw->listEntry);
  paw->hFile = hFile;
  paw->nRead = 0;
  memset(&paw->ov, 0, sizeof(OVERLAPPED));
  paw->ov.OffsetHigh = 0;
  paw->ov.Offset = 0;
  paw->ov.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);

  if (paw->ov.hEvent == NULL) {

    LocalFree(paw);

    return HSE_STATUS_ERROR;
  }

  /* Setup the callback context for the Async IO */

  if (!pecb->ServerSupportFunction(pecb->ConnID, HSE_REQ_IO_COMPLETION, HseIoCompletion, 0, (LPDWORD)paw)) {

    /* Do cleanup and return error */

    CloseHandle(paw->ov.hEvent);

    LocalFree(paw);

    return HSE_STATUS_ERROR;
  }

  /* Add to the list */

  #if USE_WORK_QUEUE
    EnterCriticalSection(&g_csWorkItems);
    InsertTailList(&g_lWorkItems,  &paw->listEntry);
    LeaveCriticalSection(&g_csWorkItems);
  #endif

  hseStatus = ReadDataForPaw(paw);

  if (hseStatus == HSE_STATUS_SUCCESS && paw->nRead > 0)
    hseStatus = SendDataForPaw( paw);

  if (hseStatus != HSE_STATUS_PENDING)
    CleanupAW(paw, FALSE);

  return hseStatus;
}

DWORD SendFileToClient | ( | IN EXTENSION_CONTROL_BLOCK * | pecb,
 |  | IN LPCSTR | pszFile
 | ) |  |

Definition at line 190 of file fwasync.c.

{
  CHAR    pchBuffer[1024];
  HANDLE  hFile;
  DWORD   hseStatus = HSE_STATUS_SUCCESS;

  hFile = FcOpenFile(pecb, pszFile);

  if (hFile == INVALID_HANDLE_VALUE) {

    wsprintfA(pchBuffer, "OpenFailed: Error (%d) while opening the file %s.\n", GetLastError(), pszFile);

    hseStatus = SendHeaderToClient( pecb, pchBuffer);

  } else {

    wsprintfA(pchBuffer, " Transferred file contains...");

    hseStatus = SendHeaderToClient(pecb, pchBuffer);

    if (hseStatus == HSE_STATUS_SUCCESS) {

      hseStatus = SendFileOver(pecb, hFile);

      if (hseStatus != HSE_STATUS_PENDING) {

        /* assume that the data is transmitted, and close file handle */

        FcCloseFile(hFile);

        if (hseStatus != HSE_STATUS_SUCCESS) {

          /* Error in transmitting the file. Send error message. */

          wsprintfA(pchBuffer, "Send Failed: Error (%d) for file %s.\n", GetLastError(), pszFile);

          SendHeaderToClient(pecb, pchBuffer);
        }
      }
    }
  }

  return (hseStatus);
}

DWORD SendHeaderToClient | ( | IN EXTENSION_CONTROL_BLOCK * | pecb,
 |  | IN LPCSTR | pszErrorMsg
 | ) |  |

Definition at line 164 of file fwasync.c.

{
  HSE_SEND_HEADER_EX_INFO SendHeaderExInfo;
  char szStatus[] = "200 OK";
  char szHeader[1024];

  /* Note the HTTP header block is terminated by a blank '\r\n' pair, followed by the document body */

  wsprintf(szHeader, "Content-Type: text/html\r\n\r\n<head><title>Simple File Transfer (Async Write)</title></head>\n<body><h1>%s</h1>\n", pszErrorMsg);

  /* Populate SendHeaderExInfo struct */

  SendHeaderExInfo.pszStatus = szStatus;
  SendHeaderExInfo.pszHeader = szHeader;
  SendHeaderExInfo.cchStatus = lstrlen(szStatus);
  SendHeaderExInfo.cchHeader = lstrlen(szHeader);
  SendHeaderExInfo.fKeepConn = FALSE;

  /* Send header - use the EX Version to send the header blob */

  if (!pecb->ServerSupportFunction(pecb->ConnID, HSE_REQ_SEND_RESPONSE_HEADER_EX, &SendHeaderExInfo, NULL, NULL))
    return HSE_STATUS_ERROR;

  return HSE_STATUS_SUCCESS;
}

BOOL WINAPI TerminateExtension ( DWORD dwFlags )

Definition at line 157 of file fwasync.c.

{
  /* Nothing specific do here for cleanup. Cleanup is done in the dll process detach in DllLibMain() */

  return TRUE;
}

Variable Documentation

CRITICAL_SECTION g_csWorkItems

Definition at line 19 of file fwasync.c.

LIST_ENTRY g_lWorkItems

Definition at line 18 of file fwasync.c.

Generated on Wed Nov 13 2024 16:54:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/extensions/io/ASyncWrite/openf.c File Reference

  • Web
  • iis
  • extensions
  • io
  • ASyncWrite
Classes | Typedefs | Functions | Variables

openf.c File Reference

#include "openf.h"

Go to the source code of this file.

Classes

struct | _OPEN_FILE

Typedefs

typedef struct _OPEN_FILE * | LPOPEN_FILE
typedef struct _OPEN_FILE | OPEN_FILE

Functions

DWORD | CleanupFileHandleCache (VOID)
DWORD | FcCloseFile (IN HANDLE hFile)
HANDLE | FcOpenFile (IN EXTENSION_CONTROL_BLOCK *pecb, IN LPCSTR pszFile)
BOOL | FcReadFromFile (IN HANDLE hFile, OUT CHAR *pchBuffer, IN DWORD dwBufferSize, OUT LPDWORD pcbRead, IN OUT LPOVERLAPPED pov)
VOID | InitFileHandleCache (VOID)

Variables

CRITICAL_SECTION | g_csOpenFiles
DWORD | g_dwCreateFileFlags = (FILE_FLAG_SEQUENTIAL_SCAN | FILE_FLAG_OVERLAPPED)
DWORD | g_dwCreateFileShareMode = (FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE)
LPOPEN_FILE | g_pOpenFiles = NULL

Typedef Documentation

typedef struct _OPEN_FILE * LPOPEN_FILE
typedef struct _OPEN_FILE OPEN_FILE

Function Documentation

DWORD CleanupFileHandleCache ( VOID )

Definition at line 39 of file openf.c.

{
  LPOPEN_FILE  pFileScan;

  while (g_pOpenFiles != NULL) {

    pFileScan = g_pOpenFiles;

    g_pOpenFiles = g_pOpenFiles->pNext;

    if (pFileScan->hFile != INVALID_HANDLE_VALUE)
      CloseHandle( pFileScan->hFile);

    LocalFree(pFileScan);
  }

  DeleteCriticalSection(&g_csOpenFiles);

  return NO_ERROR;
}

DWORD FcCloseFile ( IN HANDLE hFile )

Definition at line 174 of file openf.c.

{
  LPOPEN_FILE pFileScan;
  DWORD dwError = NO_ERROR;

  EnterCriticalSection(&g_csOpenFiles);

  /* Look for the handle and decrement the ref count. */

  for (pFileScan = g_pOpenFiles; NULL != pFileScan; pFileScan = pFileScan->pNext) {

    if ( hFile == pFileScan->hFile) {

      /*  there is a file match. */

      pFileScan->nRefs--;

      /*
        Note: This is example code. Do not use for production, as there
        is no freeing of the file when Ref hits 0
      */

      break;
    }
  }

  if (NULL == pFileScan) {

    /* file handle not found */

    dwError = (ERROR_INVALID_HANDLE);
  }

  LeaveCriticalSection(&g_csOpenFiles);

  return dwError;
}

HANDLE FcOpenFile | ( | IN EXTENSION_CONTROL_BLOCK * | pecb,
 |  | IN LPCSTR | pszFile
 | ) |  |

Definition at line 77 of file openf.c.

{
  LPOPEN_FILE pFileScan;
  HANDLE hFile = INVALID_HANDLE_VALUE;

  EnterCriticalSection(&g_csOpenFiles);

  for (pFileScan =  g_pOpenFiles; NULL != pFileScan; pFileScan = pFileScan->pNext) {

    if (0 == lstrcmpi(pFileScan->rgchFile, pszFile)) {

      /* there is a file match. */

      break;
    }
  }

  if (NULL == pFileScan) {

    /* File was not found. Create a new file handle */

    CHAR rgchFileName[ MAX_PATH]; /* local copy */
    LPCSTR pszInputPath = pszFile;

    lstrcpyn(rgchFileName, pszFile, MAX_PATH);

    if (*pszFile == '/') {

      DWORD cbSize = sizeof(rgchFileName);
      BOOL fRet;

      /* reset the file pointer, so subsequent use will fail */

      pszFile = NULL;

      /* Using the ECB map the Virtual path to the Physical path */

      fRet = pecb->ServerSupportFunction(pecb->ConnID, HSE_REQ_MAP_URL_TO_PATH, rgchFileName, &cbSize, NULL);

      if (fRet) {

          /* we got the mapping. Use it. */

          pszFile = rgchFileName;
      }
    }

    if (NULL != pszFile) {

      pFileScan = LocalAlloc(LPTR, sizeof(*pFileScan));

      if (NULL != pFileScan) {

        SECURITY_ATTRIBUTES sa;

        sa.nLength = sizeof(sa);
        sa.lpSecurityDescriptor = NULL;
        sa.bInheritHandle = FALSE;

        pFileScan->hFile = CreateFile(pszFile, GENERIC_READ, g_dwCreateFileShareMode, &sa, OPEN_EXISTING, g_dwCreateFileFlags, NULL);

        if (INVALID_HANDLE_VALUE == pFileScan->hFile) {

          LocalFree(pFileScan);

          pFileScan = NULL;

        } else {

          /* insert this into the list at the top */

          lstrcpyn(pFileScan->rgchFile, pszInputPath, MAX_PATH);

          pFileScan->pNext = g_pOpenFiles;

          g_pOpenFiles = pFileScan;

          pFileScan->nRefs = 1;
          pFileScan->nHits = 0;
        }
      }
    }
  }

  if (NULL != pFileScan) {

    hFile = pFileScan->hFile;

    pFileScan->nHits++;
    pFileScan->nRefs++;
  }

  LeaveCriticalSection(&g_csOpenFiles);

  return hFile;
}

BOOL FcReadFromFile | ( | IN HANDLE | hFile,
 |  | OUT CHAR * | pchBuffer,
 |  | IN DWORD | dwBufferSize,
 |  | OUT LPDWORD | pcbRead,
 |  | IN OUT LPOVERLAPPED | pov
 | ) |  |

Definition at line 239 of file openf.c.

{
  BOOL fRet = TRUE;

  *pcbRead = 0;

  ResetEvent(pov->hEvent);

  /* read data from file */

  if (!ReadFile(hFile, pchBuffer, dwBufferSize, pcbRead, pov)) {

    DWORD err = GetLastError();

    if ((err != ERROR_IO_PENDING) || !GetOverlappedResult(hFile, pov, pcbRead, TRUE))
      fRet = FALSE;
  }

  if (fRet)
    pov->Offset += *pcbRead;

  return fRet;
}

VOID InitFileHandleCache ( VOID )

Definition at line 34 of file openf.c.

{
  InitializeCriticalSection(&g_csOpenFiles);
}

Variable Documentation

CRITICAL_SECTION g_csOpenFiles

Definition at line 27 of file openf.c.

DWORD g_dwCreateFileFlags = (FILE_FLAG_SEQUENTIAL_SCAN | FILE_FLAG_OVERLAPPED)

Definition at line 32 of file openf.c.

DWORD g_dwCreateFileShareMode = (FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE)

Definition at line 31 of file openf.c.

LPOPEN_FILE g_pOpenFiles = NULL

Definition at line 26 of file openf.c.

Generated on Wed Nov 13 2024 16:54:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/extensions/io/ASyncWrite/openf.h File Reference

  • Web
  • iis
  • extensions
  • io
  • ASyncWrite
Defines | Functions

openf.h File Reference

#include <windows.h>
#include <httpext.h>

Go to the source code of this file.

Defines

#define | InitializeListHead(ListHead)
#define | InsertHeadList(ListHead, Entry)
#define | InsertTailList(ListHead, Entry)
#define | IsListEmpty(ListHead) ((ListHead)->Flink == (ListHead))
#define | RemoveEntryList(Entry)
#define | RemoveHeadList(ListHead)
#define | RemoveTailList(ListHead)

Functions

DWORD | CleanupFileHandleCache (VOID)
DWORD | FcCloseFile (IN HANDLE hFile)
HANDLE | FcOpenFile (IN EXTENSION_CONTROL_BLOCK *pecb, IN LPCSTR pszFile)
BOOL | FcReadFromFile (IN HANDLE hFile, OUT CHAR *pchBuffer, IN DWORD dwBufferSize, OUT LPDWORD pcbRead, IN OUT LPOVERLAPPED pov)
VOID | InitFileHandleCache (VOID)

Define Documentation

#define InitializeListHead ( ListHead )
Value:
(\
    (ListHead)->Flink = (ListHead)->Blink = (ListHead))

Definition at line 19 of file openf.h.

#define InsertHeadList | ( | ListHead,
 |  | Entry
 | ) |
Value:
{\
    PLIST_ENTRY _EX_Flink;\
    PLIST_ENTRY _EX_ListHead;\
    _EX_ListHead = (ListHead);\
    _EX_Flink = _EX_ListHead->Flink;\
    (Entry)->Flink = _EX_Flink;\
    (Entry)->Blink = _EX_ListHead;\
    _EX_Flink->Blink = (Entry);\
    _EX_ListHead->Flink = (Entry);\
                                    }

Definition at line 52 of file openf.h.

#define InsertTailList | ( | ListHead,
 |  | Entry
 | ) |
Value:
{\
    PLIST_ENTRY _EX_Blink;\
    PLIST_ENTRY _EX_ListHead;\
    _EX_ListHead = (ListHead);\
    _EX_Blink = _EX_ListHead->Blink;\
    (Entry)->Flink = _EX_ListHead;\
    (Entry)->Blink = _EX_Blink;\
    _EX_Blink->Flink = (Entry);\
    _EX_ListHead->Blink = (Entry);\
                                    }

Definition at line 42 of file openf.h.

#define IsListEmpty ( ListHead ) ((ListHead)->Flink == (ListHead))

Definition at line 22 of file openf.h.

#define RemoveEntryList ( Entry )
Value:
{\
    PLIST_ENTRY _EX_Blink;\
    PLIST_ENTRY _EX_Flink;\
    _EX_Flink = (Entry)->Flink;\
    _EX_Blink = (Entry)->Blink;\
    _EX_Blink->Flink = _EX_Flink;\
    _EX_Flink->Blink = _EX_Blink;\
                            }

Definition at line 33 of file openf.h.

#define RemoveHeadList ( ListHead )
Value:
(ListHead)->Flink;\
    {RemoveEntryList((ListHead)->Flink)}

Definition at line 25 of file openf.h.

#define RemoveTailList ( ListHead )
Value:
(ListHead)->Blink;\
    {RemoveEntryList((ListHead)->Blink)}

Definition at line 29 of file openf.h.

Function Documentation

DWORD CleanupFileHandleCache ( VOID )

Definition at line 39 of file openf.c.

{
  LPOPEN_FILE  pFileScan;

  while (g_pOpenFiles != NULL) {

    pFileScan = g_pOpenFiles;

    g_pOpenFiles = g_pOpenFiles->pNext;

    if (pFileScan->hFile != INVALID_HANDLE_VALUE)
      CloseHandle( pFileScan->hFile);

    LocalFree(pFileScan);
  }

  DeleteCriticalSection(&g_csOpenFiles);

  return NO_ERROR;
}

DWORD FcCloseFile ( IN HANDLE hFile )

Definition at line 174 of file openf.c.

{
  LPOPEN_FILE pFileScan;
  DWORD dwError = NO_ERROR;

  EnterCriticalSection(&g_csOpenFiles);

  /* Look for the handle and decrement the ref count. */

  for (pFileScan = g_pOpenFiles; NULL != pFileScan; pFileScan = pFileScan->pNext) {

    if ( hFile == pFileScan->hFile) {

      /*  there is a file match. */

      pFileScan->nRefs--;

      /*
        Note: This is example code. Do not use for production, as there
        is no freeing of the file when Ref hits 0
      */

      break;
    }
  }

  if (NULL == pFileScan) {

    /* file handle not found */

    dwError = (ERROR_INVALID_HANDLE);
  }

  LeaveCriticalSection(&g_csOpenFiles);

  return dwError;
}

HANDLE FcOpenFile | ( | IN EXTENSION_CONTROL_BLOCK * | pecb,
 |  | IN LPCSTR | pszFile
 | ) |  |

Definition at line 77 of file openf.c.

{
  LPOPEN_FILE pFileScan;
  HANDLE hFile = INVALID_HANDLE_VALUE;

  EnterCriticalSection(&g_csOpenFiles);

  for (pFileScan =  g_pOpenFiles; NULL != pFileScan; pFileScan = pFileScan->pNext) {

    if (0 == lstrcmpi(pFileScan->rgchFile, pszFile)) {

      /* there is a file match. */

      break;
    }
  }

  if (NULL == pFileScan) {

    /* File was not found. Create a new file handle */

    CHAR rgchFileName[ MAX_PATH]; /* local copy */
    LPCSTR pszInputPath = pszFile;

    lstrcpyn(rgchFileName, pszFile, MAX_PATH);

    if (*pszFile == '/') {

      DWORD cbSize = sizeof(rgchFileName);
      BOOL fRet;

      /* reset the file pointer, so subsequent use will fail */

      pszFile = NULL;

      /* Using the ECB map the Virtual path to the Physical path */

      fRet = pecb->ServerSupportFunction(pecb->ConnID, HSE_REQ_MAP_URL_TO_PATH, rgchFileName, &cbSize, NULL);

      if (fRet) {

          /* we got the mapping. Use it. */

          pszFile = rgchFileName;
      }
    }

    if (NULL != pszFile) {

      pFileScan = LocalAlloc(LPTR, sizeof(*pFileScan));

      if (NULL != pFileScan) {

        SECURITY_ATTRIBUTES sa;

        sa.nLength = sizeof(sa);
        sa.lpSecurityDescriptor = NULL;
        sa.bInheritHandle = FALSE;

        pFileScan->hFile = CreateFile(pszFile, GENERIC_READ, g_dwCreateFileShareMode, &sa, OPEN_EXISTING, g_dwCreateFileFlags, NULL);

        if (INVALID_HANDLE_VALUE == pFileScan->hFile) {

          LocalFree(pFileScan);

          pFileScan = NULL;

        } else {

          /* insert this into the list at the top */

          lstrcpyn(pFileScan->rgchFile, pszInputPath, MAX_PATH);

          pFileScan->pNext = g_pOpenFiles;

          g_pOpenFiles = pFileScan;

          pFileScan->nRefs = 1;
          pFileScan->nHits = 0;
        }
      }
    }
  }

  if (NULL != pFileScan) {

    hFile = pFileScan->hFile;

    pFileScan->nHits++;
    pFileScan->nRefs++;
  }

  LeaveCriticalSection(&g_csOpenFiles);

  return hFile;
}

BOOL FcReadFromFile | ( | IN HANDLE | hFile,
 |  | OUT CHAR * | pchBuffer,
 |  | IN DWORD | dwBufferSize,
 |  | OUT LPDWORD | pcbRead,
 |  | IN OUT LPOVERLAPPED | pov
 | ) |  |

Definition at line 239 of file openf.c.

{
  BOOL fRet = TRUE;

  *pcbRead = 0;

  ResetEvent(pov->hEvent);

  /* read data from file */

  if (!ReadFile(hFile, pchBuffer, dwBufferSize, pcbRead, pov)) {

    DWORD err = GetLastError();

    if ((err != ERROR_IO_PENDING) || !GetOverlappedResult(hFile, pov, pcbRead, TRUE))
      fRet = FALSE;
  }

  if (fRet)
    pov->Offset += *pcbRead;

  return fRet;
}

VOID InitFileHandleCache ( VOID )

Definition at line 34 of file openf.c.

{
  InitializeCriticalSection(&g_csOpenFiles);
}

Generated on Wed Nov 13 2024 16:54:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/extensions/io/SyncRead/readcli.c File Reference

  • Web
  • iis
  • extensions
  • io
  • SyncRead
Defines | Functions

readcli.c File Reference

#include <windows.h>
#include <httpext.h>
#include <stdio.h>
#include <stdlib.h>

Go to the source code of this file.

Defines

#define | BUFFER_LENGTH 4096
#define | STRING_LENGTH 80
#define | WIN32_LEAN_AND_MEAN

Functions

BOOL WINAPI | GetExtensionVersion (HSE_VERSION_INFO *pVer)
DWORD WINAPI | HttpExtensionProc (LPEXTENSION_CONTROL_BLOCK pec)
BOOL | SendErrorToClient (LPEXTENSION_CONTROL_BLOCK pec, CHAR *szErrorText)
BOOL WINAPI | TerminateExtension (DWORD dwFlags)

Define Documentation

#define BUFFER_LENGTH 4096

Definition at line 19 of file readcli.c.

#define STRING_LENGTH 80

Definition at line 20 of file readcli.c.

#define WIN32_LEAN_AND_MEAN

Definition at line 13 of file readcli.c.

Function Documentation

BOOL WINAPI GetExtensionVersion ( HSE_VERSION_INFO * pVer )

Definition at line 40 of file readcli.c.

{
  pVer->dwExtensionVersion = MAKELONG(HSE_VERSION_MINOR, HSE_VERSION_MAJOR);

  lstrcpyn((LPSTR) pVer->lpszExtensionDesc, "ReadClient Extension", HSE_MAX_EXT_DLL_NAME_LEN);

  return TRUE;
}

DWORD WINAPI HttpExtensionProc ( LPEXTENSION_CONTROL_BLOCK pec )

Definition at line 65 of file readcli.c.

{
  BOOL bResult;
  CHAR *szBuffer;
  CHAR szTemp[BUFFER_LENGTH];
  CHAR szTmpBuf[BUFFER_LENGTH];
  DWORD dwBytesRead;
  DWORD dwBytesWritten;
  DWORD dwTotalRead;
  DWORD dwTotalWritten;
  DWORD dwContentLength;
  DWORD dwBufferSize;
  HSE_SEND_HEADER_EX_INFO SendHeaderExInfo;

  /* Determine the amount of data available from the Content-Length header */

  dwBufferSize = sizeof(szTmpBuf) - 1;

  bResult = pec->GetServerVariable(pec->ConnID, "CONTENT_LENGTH", szTmpBuf, &dwBufferSize);

  if (!bResult) {

    bResult = SendErrorToClient(pec, "Content-Length header not found");

    if (!bResult)
      return HSE_STATUS_ERROR;

    return HSE_STATUS_SUCCESS;
  }

  dwContentLength = atol(szTmpBuf);

  /* Allocate the buffer based on the Content-Length */

  szBuffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwContentLength + 5);

  if (NULL == szBuffer) {

    sprintf(szTemp, "Unable to allocate %ld bytes of memory for buffer", dwContentLength + 5);

    bResult = SendErrorToClient(pec, szTemp);

    if (!bResult)
      return HSE_STATUS_ERROR;

    return HSE_STATUS_SUCCESS;
  }

  /* If the client didn't post anything, return and create a nice form for them */

  if (0 == pec->cbAvailable) {

    bResult = SendErrorToClient(pec, "Your request did not contain any data");

    if (!bResult)
      return HSE_STATUS_ERROR;

    return HSE_STATUS_SUCCESS;
  }

  /* Initialize variables before reading in the data */

  dwTotalWritten = 0;
  dwTotalRead = pec->cbAvailable;

  /* Copy the first chunk of the data into the buffer */

  strncpy(szBuffer, pec->lpbData, dwTotalRead);

  szBuffer[dwTotalRead] = 0;

  /* Loop to read in the rest of the data from the client */

  while (dwTotalRead < pec->cbTotalBytes) {

    /* Set the size of our temporary buffer */

    dwBytesRead = sizeof(szTmpBuf) - 1;

    if ((dwTotalRead + dwBytesRead) > pec->cbTotalBytes)
      dwBytesRead = pec->cbTotalBytes - dwTotalRead;

    /* Read the data into the temporary buffer */

    bResult = pec->ReadClient(pec->ConnID, szTmpBuf, &dwBytesRead);

    if (!bResult) {

        HeapFree(GetProcessHeap(), 0, szBuffer);

        return HSE_STATUS_ERROR;
    }

    /* NULL-Terminate the temporary buffer */

    szTmpBuf[dwBytesRead] = 0;

    /* Append the temporary buffer to the real buffer */

    if (0 != dwBytesRead)
      strcat(szBuffer + dwTotalRead, szTmpBuf);

    dwTotalRead += dwBytesRead;
  }

  /* All the data has been read in and stored in our buffer. Now send the data back to the client */

  SendHeaderExInfo.pszStatus = "200 OK";
  SendHeaderExInfo.pszHeader = "Content-Type: text/html\r\n\r\n";
  SendHeaderExInfo.cchStatus = lstrlen(SendHeaderExInfo.pszStatus);
  SendHeaderExInfo.cchHeader = lstrlen(SendHeaderExInfo.pszHeader);
  SendHeaderExInfo.fKeepConn = FALSE;

  bResult = pec->ServerSupportFunction(pec->ConnID, HSE_REQ_SEND_RESPONSE_HEADER_EX, &SendHeaderExInfo, NULL, NULL);

  if (!bResult) {

    HeapFree(GetProcessHeap(), 0, szBuffer);

    return HSE_STATUS_ERROR;
  }

  dwBytesWritten = dwTotalRead;

  bResult = pec->WriteClient(pec->ConnID, szBuffer, &dwBytesWritten, 0);

  if (!bResult) {

    HeapFree(GetProcessHeap(), 0, szBuffer);

    return HSE_STATUS_ERROR;
  }

  HeapFree(GetProcessHeap(), 0, szBuffer);

  return HSE_STATUS_SUCCESS;
}

BOOL SendErrorToClient | ( | LPEXTENSION_CONTROL_BLOCK | pec,
 |  | CHAR * | szErrorText
 | ) |  |

Definition at line 239 of file readcli.c.

{
  BOOL bResult;
  CHAR szTemp[BUFFER_LENGTH];
  DWORD dwBytesWritten;
  HSE_SEND_HEADER_EX_INFO SendHeaderExInfo;

  SendHeaderExInfo.pszStatus = "200 OK";
  SendHeaderExInfo.pszHeader = "Content-Type: text/html\r\n\r\n";
  SendHeaderExInfo.cchStatus = lstrlen(SendHeaderExInfo.pszStatus);
  SendHeaderExInfo.cchHeader = lstrlen(SendHeaderExInfo.pszHeader);
  SendHeaderExInfo.fKeepConn = FALSE;

  bResult = pec->ServerSupportFunction(pec->ConnID, HSE_REQ_SEND_RESPONSE_HEADER_EX, &SendHeaderExInfo, NULL, NULL);

  if (!bResult)
    return FALSE;

  dwBytesWritten = sprintf(
      szTemp,
      "<h3>Error: %s</h3><p>\r\n\r\n"
      "Usage: readcli.dll<p>\r\n\r\n"
      "Request must be a POST request, with extra data<p>\r\n"
      "<h2>Sample Form</h2>\r\n"
      "Enter data below:<br>\r\n"
      "<form method=POST action=\"readcli.dll\">\r\n"
      "<input type=text name=test size=80><br>\r\n"
      "<input type=submit>\r\n",
      szErrorText);

  bResult = pec->WriteClient(pec->ConnID, szTemp, &dwBytesWritten, 0);

  return bResult;
}

BOOL WINAPI TerminateExtension ( DWORD dwFlags )

Definition at line 217 of file readcli.c.

{
  return TRUE;
}

Generated on Wed Nov 13 2024 16:54:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/extensions/io/SyncWrite/fwrite.c File Reference

  • Web
  • iis
  • extensions
  • io
  • SyncWrite
Defines | Functions

fwrite.c File Reference

#include <windows.h>
#include <stdio.h>
#include "httpext.h"
#include "openf.h"

Go to the source code of this file.

Defines

#define | MAX_BUFFER_SIZE 4096
#define | WIN32_LEAN_AND_MEAN

Functions

BOOL WINAPI | DllMain (IN HINSTANCE hinstDll, IN DWORD fdwReason, IN LPVOID lpvContext OPTIONAL)
BOOL WINAPI | GetExtensionVersion (HSE_VERSION_INFO *pVer)
DWORD WINAPI | HttpExtensionProc (IN EXTENSION_CONTROL_BLOCK *pecb)
DWORD | SendFileOver (IN EXTENSION_CONTROL_BLOCK *pecb, IN HANDLE hFile)
DWORD | SendFileToClient (IN EXTENSION_CONTROL_BLOCK *pecb, IN LPCSTR pszFile)
DWORD | SendHeaderToClient (IN EXTENSION_CONTROL_BLOCK *pecb, IN LPCSTR pszErrorMsg)
BOOL WINAPI | TerminateExtension (DWORD dwFlags)

Define Documentation

#define MAX_BUFFER_SIZE 4096

Definition at line 19 of file fwrite.c.

#define WIN32_LEAN_AND_MEAN

Definition at line 13 of file fwrite.c.

Function Documentation

BOOL WINAPI DllMain | ( | IN HINSTANCE | hinstDll,
 |  | IN DWORD | fdwReason,
 |  | IN LPVOID lpvContext | OPTIONAL
 | ) |  |

Definition at line 43 of file fwrite.c.

{
  BOOL fReturn = TRUE;

  switch (fdwReason) {

    case DLL_PROCESS_ATTACH :

      OutputDebugString("Initializing the global data in fwrite.dll\n");

      /* Initialize various data and modules. */

      fReturn = (InitFileHandleCache() == NO_ERROR);

      break;

    case DLL_PROCESS_DETACH :

      /*
        Only cleanup when we are called because of a FreeLibrary() (i.e., when lpvContext == NULL)
        If we are called because of a process termination, dont free anything. System will free resources and memory for us.
      */

      CleanupFileHandleCache();

      break;

    default :

      break;
  }

  return fReturn;
}

BOOL WINAPI GetExtensionVersion ( HSE_VERSION_INFO * pVer )

Definition at line 104 of file fwrite.c.

{
  pVer->dwExtensionVersion = MAKELONG(HSE_VERSION_MINOR, HSE_VERSION_MAJOR);

  lstrcpyn((LPSTR) pVer->lpszExtensionDesc, "File Transfer Using WriteClient", HSE_MAX_EXT_DLL_NAME_LEN);

  return TRUE;
}

DWORD WINAPI HttpExtensionProc ( IN EXTENSION_CONTROL_BLOCK * pecb )

Definition at line 78 of file fwrite.c.

{
  DWORD hseStatus;

  if (pecb->lpszQueryString == NULL)
    hseStatus = SendHeaderToClient(pecb, "File Not Found");
  else
    hseStatus = SendFileToClient(pecb, pecb->lpszQueryString);

  return hseStatus;
}

DWORD SendFileOver | ( | IN EXTENSION_CONTROL_BLOCK * | pecb,
 |  | IN HANDLE | hFile
 | ) |  |

Definition at line 194 of file fwrite.c.

{
  CHAR pchBuffer[MAX_BUFFER_SIZE];
  DWORD dwBytesInFile = GetFileSize(hFile, NULL);
  DWORD nRead = 0;
  DWORD hseStatus = HSE_STATUS_SUCCESS;
  OVERLAPPED  ov;
  DWORD err;

  /* Send the whole file. Loop thru reading the file and transmitting it to client */

  memset(&ov, 0, sizeof(OVERLAPPED));

  ov.OffsetHigh = 0;
  ov.Offset = 0;
  ov.hEvent = CreateEvent(NULL, TRUE, FALSE, "OVERLAPPED::hEvent");

  if (NULL == ov.hEvent)
    return HSE_STATUS_ERROR;

  for (;;) {

    nRead = 0;

    /* read data from the file */

    if (!FcReadFromFile(hFile, pchBuffer, MAX_BUFFER_SIZE, &nRead, &ov)) {

      hseStatus = HSE_STATUS_ERROR;

      break;
    }

    /* write data to client */

    if (!pecb->WriteClient(pecb->ConnID, pchBuffer, &nRead, 0)) {

      hseStatus = HSE_STATUS_ERROR;

      break;
    }
  }

  if (NULL != ov.hEvent) {

    err = GetLastError();

    CloseHandle(ov.hEvent);

    ov.hEvent = NULL;

    SetLastError(err);
  }

  return hseStatus;
}

DWORD SendFileToClient | ( | IN EXTENSION_CONTROL_BLOCK * | pecb,
 |  | IN LPCSTR | pszFile
 | ) |  |

Definition at line 146 of file fwrite.c.

{
  CHAR    pchBuffer[1024];
  HANDLE  hFile;
  DWORD   hseStatus = HSE_STATUS_SUCCESS;

  hFile = FcOpenFile(pecb, pszFile);

  if (hFile == INVALID_HANDLE_VALUE) {

    wsprintfA(pchBuffer, "OpenFailed: Error (%d) while opening the file %s.\n", GetLastError(), pszFile);

    hseStatus = SendHeaderToClient(pecb, pchBuffer);

  } else {

    wsprintfA(pchBuffer, "Transferred file contains...");

    hseStatus = SendHeaderToClient(pecb, pchBuffer);

    if (hseStatus == HSE_STATUS_SUCCESS) {

      hseStatus = SendFileOver(pecb, hFile);

      if (hseStatus != HSE_STATUS_PENDING) {

        if (hseStatus != HSE_STATUS_SUCCESS) {

          /* Error in transmitting the file. Send error message. */

          wsprintfA(pchBuffer, "Send Failed: Error (%d) for file %s.\n", GetLastError(), pszFile);

          SendHeaderToClient(pecb, pchBuffer);
        }
      }

      if (hseStatus != HSE_STATUS_PENDING) {

        /* Assume that the data is transmitted and close the file handle */

        FcCloseFile(hFile);
      }
    }
  }

  return hseStatus;
}

DWORD SendHeaderToClient | ( | IN EXTENSION_CONTROL_BLOCK * | pecb,
 |  | IN LPCSTR | pszErrorMsg
 | ) |  |

Definition at line 120 of file fwrite.c.

{
  HSE_SEND_HEADER_EX_INFO SendHeaderExInfo;
  char szStatus[] = "200 OK";
  char szHeader[1024];

  /* Note the HTTP header block is terminated by a blank '\r\n' pair, followed by the document body */

  wsprintf(szHeader, "Content-Type: text/html\r\n\r\n<head><title>Simple File Transfer (Synchronous Write)</title></head>\n<body><h1>%s</h1>\n", pszErrorMsg);

  /*  Populate SendHeaderExInfo struct */

  SendHeaderExInfo.pszStatus = szStatus;
  SendHeaderExInfo.pszHeader = szHeader;
  SendHeaderExInfo.cchStatus = lstrlen(szStatus);
  SendHeaderExInfo.cchHeader = lstrlen(szHeader);
  SendHeaderExInfo.fKeepConn = FALSE;

  /* Send header - use the EX Version to send the header blob */

  if (!pecb->ServerSupportFunction(pecb->ConnID, HSE_REQ_SEND_RESPONSE_HEADER_EX, &SendHeaderExInfo, NULL, NULL))
    return HSE_STATUS_ERROR;

  return HSE_STATUS_SUCCESS;
}

BOOL WINAPI TerminateExtension ( DWORD dwFlags )

Definition at line 113 of file fwrite.c.

{
  /* Nothing specific do here for cleanup. Cleanup is done in the dll process detach in DllLibMain() */

  return TRUE;
}

Generated on Wed Nov 13 2024 16:54:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/extensions/io/SyncWrite/openf.c File Reference

  • Web
  • iis
  • extensions
  • io
  • SyncWrite
Classes | Typedefs | Functions | Variables

openf.c File Reference

#include "openf.h"

Go to the source code of this file.

Classes

struct | _OPEN_FILE

Typedefs

typedef struct _OPEN_FILE * | LPOPEN_FILE
typedef struct _OPEN_FILE | OPEN_FILE

Functions

DWORD | CleanupFileHandleCache (VOID)
DWORD | FcCloseFile (IN HANDLE hFile)
HANDLE | FcOpenFile (IN EXTENSION_CONTROL_BLOCK *pecb, IN LPCSTR pszFile)
BOOL | FcReadFromFile (IN HANDLE hFile, OUT CHAR *pchBuffer, IN DWORD dwBufferSize, OUT LPDWORD pcbRead, IN OUT LPOVERLAPPED pov)
VOID | InitFileHandleCache (VOID)

Variables

CRITICAL_SECTION | g_csOpenFiles
DWORD | g_dwCreateFileFlags = (FILE_FLAG_SEQUENTIAL_SCAN | FILE_FLAG_OVERLAPPED)
DWORD | g_dwCreateFileShareMode = (FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE)
LPOPEN_FILE | g_pOpenFiles = NULL

Typedef Documentation

typedef struct _OPEN_FILE * LPOPEN_FILE
typedef struct _OPEN_FILE OPEN_FILE

Function Documentation

DWORD CleanupFileHandleCache ( VOID )

Definition at line 39 of file openf.c.

{
  LPOPEN_FILE  pFileScan;

  while (g_pOpenFiles != NULL) {

    pFileScan = g_pOpenFiles;

    g_pOpenFiles = g_pOpenFiles->pNext;

    if (pFileScan->hFile != INVALID_HANDLE_VALUE)
      CloseHandle( pFileScan->hFile);

    LocalFree(pFileScan);
  }

  DeleteCriticalSection(&g_csOpenFiles);

  return NO_ERROR;
}

DWORD FcCloseFile ( IN HANDLE hFile )

Definition at line 174 of file openf.c.

{
  LPOPEN_FILE pFileScan;
  DWORD dwError = NO_ERROR;

  EnterCriticalSection(&g_csOpenFiles);

  /* Look for the handle and decrement the ref count. */

  for (pFileScan = g_pOpenFiles; NULL != pFileScan; pFileScan = pFileScan->pNext) {

    if ( hFile == pFileScan->hFile) {

      /*  there is a file match. */

      pFileScan->nRefs--;

      /*
        Note: This is example code. Do not use for production, as there
        is no freeing of the file when Ref hits 0
      */

      break;
    }
  }

  if (NULL == pFileScan) {

    /* file handle not found */

    dwError = (ERROR_INVALID_HANDLE);
  }

  LeaveCriticalSection(&g_csOpenFiles);

  return dwError;
}

HANDLE FcOpenFile | ( | IN EXTENSION_CONTROL_BLOCK * | pecb,
 |  | IN LPCSTR | pszFile
 | ) |  |

Definition at line 77 of file openf.c.

{
  LPOPEN_FILE pFileScan;
  HANDLE hFile = INVALID_HANDLE_VALUE;

  EnterCriticalSection(&g_csOpenFiles);

  for (pFileScan =  g_pOpenFiles; NULL != pFileScan; pFileScan = pFileScan->pNext) {

    if (0 == lstrcmpi(pFileScan->rgchFile, pszFile)) {

      /* there is a file match. */

      break;
    }
  }

  if (NULL == pFileScan) {

    /* File was not found. Create a new file handle */

    CHAR rgchFileName[ MAX_PATH]; /* local copy */
    LPCSTR pszInputPath = pszFile;

    lstrcpyn(rgchFileName, pszFile, MAX_PATH);

    if (*pszFile == '/') {

      DWORD cbSize = sizeof(rgchFileName);
      BOOL fRet;

      /* reset the file pointer, so subsequent use will fail */

      pszFile = NULL;

      /* Using the ECB map the Virtual path to the Physical path */

      fRet = pecb->ServerSupportFunction(pecb->ConnID, HSE_REQ_MAP_URL_TO_PATH, rgchFileName, &cbSize, NULL);

      if (fRet) {

          /* we got the mapping. Use it. */

          pszFile = rgchFileName;
      }
    }

    if (NULL != pszFile) {

      pFileScan = LocalAlloc(LPTR, sizeof(*pFileScan));

      if (NULL != pFileScan) {

        SECURITY_ATTRIBUTES sa;

        sa.nLength = sizeof(sa);
        sa.lpSecurityDescriptor = NULL;
        sa.bInheritHandle = FALSE;

        pFileScan->hFile = CreateFile(pszFile, GENERIC_READ, g_dwCreateFileShareMode, &sa, OPEN_EXISTING, g_dwCreateFileFlags, NULL);

        if (INVALID_HANDLE_VALUE == pFileScan->hFile) {

          LocalFree(pFileScan);

          pFileScan = NULL;

        } else {

          /* insert this into the list at the top */

          lstrcpyn(pFileScan->rgchFile, pszInputPath, MAX_PATH);

          pFileScan->pNext = g_pOpenFiles;

          g_pOpenFiles = pFileScan;

          pFileScan->nRefs = 1;
          pFileScan->nHits = 0;
        }
      }
    }
  }

  if (NULL != pFileScan) {

    hFile = pFileScan->hFile;

    pFileScan->nHits++;
    pFileScan->nRefs++;
  }

  LeaveCriticalSection(&g_csOpenFiles);

  return hFile;
}

BOOL FcReadFromFile | ( | IN HANDLE | hFile,
 |  | OUT CHAR * | pchBuffer,
 |  | IN DWORD | dwBufferSize,
 |  | OUT LPDWORD | pcbRead,
 |  | IN OUT LPOVERLAPPED | pov
 | ) |  |

Definition at line 239 of file openf.c.

{
  BOOL fRet = TRUE;

  *pcbRead = 0;

  ResetEvent(pov->hEvent);

  /* read data from file */

  if (!ReadFile(hFile, pchBuffer, dwBufferSize, pcbRead, pov)) {

    DWORD err = GetLastError();

    if ((err != ERROR_IO_PENDING) || !GetOverlappedResult(hFile, pov, pcbRead, TRUE))
      fRet = FALSE;
  }

  if (fRet)
    pov->Offset += *pcbRead;

  return fRet;
}

VOID InitFileHandleCache ( VOID )

Definition at line 34 of file openf.c.

{
  InitializeCriticalSection(&g_csOpenFiles);
}

Variable Documentation

CRITICAL_SECTION g_csOpenFiles

Definition at line 27 of file openf.c.

DWORD g_dwCreateFileFlags = (FILE_FLAG_SEQUENTIAL_SCAN | FILE_FLAG_OVERLAPPED)

Definition at line 32 of file openf.c.

DWORD g_dwCreateFileShareMode = (FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE)

Definition at line 31 of file openf.c.

LPOPEN_FILE g_pOpenFiles = NULL

Definition at line 26 of file openf.c.

Generated on Wed Nov 13 2024 16:54:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/extensions/io/SyncWrite/openf.h File Reference

  • Web
  • iis
  • extensions
  • io
  • SyncWrite
Defines | Functions

openf.h File Reference

#include <windows.h>
#include <httpext.h>

Go to the source code of this file.

Defines

#define | InitializeListHead(ListHead)
#define | InsertHeadList(ListHead, Entry)
#define | InsertTailList(ListHead, Entry)
#define | IsListEmpty(ListHead) ((ListHead)->Flink == (ListHead))
#define | RemoveEntryList(Entry)
#define | RemoveHeadList(ListHead)
#define | RemoveTailList(ListHead)

Functions

DWORD | CleanupFileHandleCache (VOID)
DWORD | FcCloseFile (IN HANDLE hFile)
HANDLE | FcOpenFile (IN EXTENSION_CONTROL_BLOCK *pecb, IN LPCSTR pszFile)
BOOL | FcReadFromFile (IN HANDLE hFile, OUT CHAR *pchBuffer, IN DWORD dwBufferSize, OUT LPDWORD pcbRead, IN OUT LPOVERLAPPED pov)
VOID | InitFileHandleCache (VOID)

Define Documentation

#define InitializeListHead ( ListHead )
Value:
(\
    (ListHead)->Flink = (ListHead)->Blink = (ListHead))

Definition at line 19 of file openf.h.

#define InsertHeadList | ( | ListHead,
 |  | Entry
 | ) |
Value:
{\
    PLIST_ENTRY _EX_Flink;\
    PLIST_ENTRY _EX_ListHead;\
    _EX_ListHead = (ListHead);\
    _EX_Flink = _EX_ListHead->Flink;\
    (Entry)->Flink = _EX_Flink;\
    (Entry)->Blink = _EX_ListHead;\
    _EX_Flink->Blink = (Entry);\
    _EX_ListHead->Flink = (Entry);\
                                    }

Definition at line 52 of file openf.h.

#define InsertTailList | ( | ListHead,
 |  | Entry
 | ) |
Value:
{\
    PLIST_ENTRY _EX_Blink;\
    PLIST_ENTRY _EX_ListHead;\
    _EX_ListHead = (ListHead);\
    _EX_Blink = _EX_ListHead->Blink;\
    (Entry)->Flink = _EX_ListHead;\
    (Entry)->Blink = _EX_Blink;\
    _EX_Blink->Flink = (Entry);\
    _EX_ListHead->Blink = (Entry);\
                                    }

Definition at line 42 of file openf.h.

#define IsListEmpty ( ListHead ) ((ListHead)->Flink == (ListHead))

Definition at line 22 of file openf.h.

#define RemoveEntryList ( Entry )
Value:
{\
    PLIST_ENTRY _EX_Blink;\
    PLIST_ENTRY _EX_Flink;\
    _EX_Flink = (Entry)->Flink;\
    _EX_Blink = (Entry)->Blink;\
    _EX_Blink->Flink = _EX_Flink;\
    _EX_Flink->Blink = _EX_Blink;\
                            }

Definition at line 33 of file openf.h.

#define RemoveHeadList ( ListHead )
Value:
(ListHead)->Flink;\
    {RemoveEntryList((ListHead)->Flink)}

Definition at line 25 of file openf.h.

#define RemoveTailList ( ListHead )
Value:
(ListHead)->Blink;\
    {RemoveEntryList((ListHead)->Blink)}

Definition at line 29 of file openf.h.

Function Documentation

DWORD CleanupFileHandleCache ( VOID )

Definition at line 39 of file openf.c.

{
  LPOPEN_FILE  pFileScan;

  while (g_pOpenFiles != NULL) {

    pFileScan = g_pOpenFiles;

    g_pOpenFiles = g_pOpenFiles->pNext;

    if (pFileScan->hFile != INVALID_HANDLE_VALUE)
      CloseHandle( pFileScan->hFile);

    LocalFree(pFileScan);
  }

  DeleteCriticalSection(&g_csOpenFiles);

  return NO_ERROR;
}

DWORD FcCloseFile ( IN HANDLE hFile )

Definition at line 174 of file openf.c.

{
  LPOPEN_FILE pFileScan;
  DWORD dwError = NO_ERROR;

  EnterCriticalSection(&g_csOpenFiles);

  /* Look for the handle and decrement the ref count. */

  for (pFileScan = g_pOpenFiles; NULL != pFileScan; pFileScan = pFileScan->pNext) {

    if ( hFile == pFileScan->hFile) {

      /*  there is a file match. */

      pFileScan->nRefs--;

      /*
        Note: This is example code. Do not use for production, as there
        is no freeing of the file when Ref hits 0
      */

      break;
    }
  }

  if (NULL == pFileScan) {

    /* file handle not found */

    dwError = (ERROR_INVALID_HANDLE);
  }

  LeaveCriticalSection(&g_csOpenFiles);

  return dwError;
}

HANDLE FcOpenFile | ( | IN EXTENSION_CONTROL_BLOCK * | pecb,
 |  | IN LPCSTR | pszFile
 | ) |  |

Definition at line 77 of file openf.c.

{
  LPOPEN_FILE pFileScan;
  HANDLE hFile = INVALID_HANDLE_VALUE;

  EnterCriticalSection(&g_csOpenFiles);

  for (pFileScan =  g_pOpenFiles; NULL != pFileScan; pFileScan = pFileScan->pNext) {

    if (0 == lstrcmpi(pFileScan->rgchFile, pszFile)) {

      /* there is a file match. */

      break;
    }
  }

  if (NULL == pFileScan) {

    /* File was not found. Create a new file handle */

    CHAR rgchFileName[ MAX_PATH]; /* local copy */
    LPCSTR pszInputPath = pszFile;

    lstrcpyn(rgchFileName, pszFile, MAX_PATH);

    if (*pszFile == '/') {

      DWORD cbSize = sizeof(rgchFileName);
      BOOL fRet;

      /* reset the file pointer, so subsequent use will fail */

      pszFile = NULL;

      /* Using the ECB map the Virtual path to the Physical path */

      fRet = pecb->ServerSupportFunction(pecb->ConnID, HSE_REQ_MAP_URL_TO_PATH, rgchFileName, &cbSize, NULL);

      if (fRet) {

          /* we got the mapping. Use it. */

          pszFile = rgchFileName;
      }
    }

    if (NULL != pszFile) {

      pFileScan = LocalAlloc(LPTR, sizeof(*pFileScan));

      if (NULL != pFileScan) {

        SECURITY_ATTRIBUTES sa;

        sa.nLength = sizeof(sa);
        sa.lpSecurityDescriptor = NULL;
        sa.bInheritHandle = FALSE;

        pFileScan->hFile = CreateFile(pszFile, GENERIC_READ, g_dwCreateFileShareMode, &sa, OPEN_EXISTING, g_dwCreateFileFlags, NULL);

        if (INVALID_HANDLE_VALUE == pFileScan->hFile) {

          LocalFree(pFileScan);

          pFileScan = NULL;

        } else {

          /* insert this into the list at the top */

          lstrcpyn(pFileScan->rgchFile, pszInputPath, MAX_PATH);

          pFileScan->pNext = g_pOpenFiles;

          g_pOpenFiles = pFileScan;

          pFileScan->nRefs = 1;
          pFileScan->nHits = 0;
        }
      }
    }
  }

  if (NULL != pFileScan) {

    hFile = pFileScan->hFile;

    pFileScan->nHits++;
    pFileScan->nRefs++;
  }

  LeaveCriticalSection(&g_csOpenFiles);

  return hFile;
}

BOOL FcReadFromFile | ( | IN HANDLE | hFile,
 |  | OUT CHAR * | pchBuffer,
 |  | IN DWORD | dwBufferSize,
 |  | OUT LPDWORD | pcbRead,
 |  | IN OUT LPOVERLAPPED | pov
 | ) |  |

Definition at line 239 of file openf.c.

{
  BOOL fRet = TRUE;

  *pcbRead = 0;

  ResetEvent(pov->hEvent);

  /* read data from file */

  if (!ReadFile(hFile, pchBuffer, dwBufferSize, pcbRead, pov)) {

    DWORD err = GetLastError();

    if ((err != ERROR_IO_PENDING) || !GetOverlappedResult(hFile, pov, pcbRead, TRUE))
      fRet = FALSE;
  }

  if (fRet)
    pov->Offset += *pcbRead;

  return fRet;
}

VOID InitFileHandleCache ( VOID )

Definition at line 34 of file openf.c.

{
  InitializeCriticalSection(&g_csOpenFiles);
}

Generated on Wed Nov 13 2024 16:54:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/extensions/Keep-Alive/KeepAlive.c File Reference

  • Web
  • iis
  • extensions
  • Keep-Alive
Defines | Functions

KeepAlive.c File Reference

#include <windows.h>
#include <httpext.h>
#include <stdio.h>

Go to the source code of this file.

Defines

#define | WIN32_LEAN_AND_MEAN

Functions

BOOL WINAPI | GetExtensionVersion (OUT HSE_VERSION_INFO *pVer)
DWORD WINAPI | HttpExtensionProc (IN EXTENSION_CONTROL_BLOCK *pECB)
BOOL WINAPI | TerminateExtension (IN DWORD dwFlags)

Define Documentation

#define WIN32_LEAN_AND_MEAN

Definition at line 13 of file KeepAlive.c.

Function Documentation

BOOL WINAPI GetExtensionVersion ( OUT HSE_VERSION_INFO * pVer )

Definition at line 32 of file KeepAlive.c.

{
  pVer->dwExtensionVersion = MAKELONG(HSE_VERSION_MINOR, HSE_VERSION_MAJOR);

  strncpy(pVer->lpszExtensionDesc, "ISAPI Keep-Alive Extension Sample", HSE_MAX_EXT_DLL_NAME_LEN);

  return TRUE;
}

DWORD WINAPI HttpExtensionProc ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 55 of file KeepAlive.c.

{
  /*
    Use the "Connection: Keep-Alive" header to keep the connection open;
    also, the "Content-Length:" header is required, so that the client knows when
    the server has finished.
  */

  char szHeader[] =
      "Connection: Keep-Alive\r\n"
      "Content-Length: %lu\r\n"
      "Content-type: text/html\r\n\r\n";

  char szContent[] =
      "<html> <form method=get action=\\scripts\\KeepAlive.dll>"
      "<h1>Keep-Alive Sample</h1><hr>"
      "<input type=submit value=\"Send Request\"></form></html>";

  char szBuffer[4096];
  DWORD dwSize;
  HSE_SEND_HEADER_EX_INFO HeaderExInfo;

  /* Send outgoing header with exact content length */

  sprintf(szBuffer, szHeader, strlen(szContent));

  HeaderExInfo.pszHeader = szBuffer;
  HeaderExInfo.cchHeader = strlen(szBuffer);
  HeaderExInfo.pszStatus = "200 OK";
  HeaderExInfo.cchStatus = strlen(HeaderExInfo.pszStatus);
  HeaderExInfo.fKeepConn = TRUE;

  pECB->ServerSupportFunction(pECB, HSE_REQ_SEND_RESPONSE_HEADER_EX, &HeaderExInfo, NULL, NULL);

  /* Send content */

  dwSize = strlen(szContent);

  pECB->WriteClient(pECB, szContent, &dwSize, HSE_IO_SYNC);

  /* This return code tells IIS not to close the socket connection. */

  return HSE_STATUS_SUCCESS_AND_KEEP_CONN;
}

BOOL WINAPI TerminateExtension ( IN DWORD dwFlags )

Definition at line 117 of file KeepAlive.c.

{
    return TRUE;
}

Generated on Wed Nov 13 2024 16:54:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/extensions/KeepAliveWithThreads/KeepAliveP.c File Reference

  • Web
  • iis
  • extensions
  • KeepAliveWithThreads
Defines | Functions

KeepAliveP.c File Reference

#include <windows.h>
#include <httpext.h>
#include <stdio.h>
#include "threadpool.h"

Go to the source code of this file.

Defines

#define | WIN32_LEAN_AND_MEAN

Functions

BOOL WINAPI | DllMain (IN HINSTANCE hinstDll, IN DWORD fdwReason, IN LPVOID lpvContext)
BOOL WINAPI | GetExtensionVersion (OUT HSE_VERSION_INFO *pVer)
DWORD WINAPI | HttpExtensionProc (IN EXTENSION_CONTROL_BLOCK *pECB)
BOOL WINAPI | TerminateExtension (IN DWORD dwFlags)
DWORD WINAPI | WorkerFunction (IN LPVOID pvThreadNum)

Define Documentation

#define WIN32_LEAN_AND_MEAN

Definition at line 12 of file KeepAliveP.c.

Function Documentation

BOOL WINAPI DllMain | ( | IN HINSTANCE | hinstDll,
 |  | IN DWORD | fdwReason,
 |  | IN LPVOID lpvContext |
 | ) |  |

Definition at line 35 of file KeepAliveP.c.

{
  BOOL fReturn = TRUE;

  switch (fdwReason) {

    case DLL_PROCESS_ATTACH :

      fReturn = InitThreadPool();

      break;
  }

  return fReturn;
}

BOOL WINAPI GetExtensionVersion ( OUT HSE_VERSION_INFO * pVer )

Definition at line 65 of file KeepAliveP.c.

{
  pVer->dwExtensionVersion = MAKELONG(HSE_VERSION_MINOR, HSE_VERSION_MAJOR);

  lstrcpyn(pVer->lpszExtensionDesc, "ISAPI Keep-Alive with Thread Pool Extension Sample", HSE_MAX_EXT_DLL_NAME_LEN);

  return TRUE;
}

DWORD WINAPI HttpExtensionProc ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 90 of file KeepAliveP.c.

{
  DWORD dwSize;
  HSE_SEND_HEADER_EX_INFO HeaderExInfo;

  char szHeader[] =
    "Connection: Keep-Alive\r\n"
    "Content-Length: %lu\r\n"
    "Content-type: text/html\r\n\r\n";

  char szBusyMessage[] =
    "<html> <form method=get action=KeepAliveP.dll> <input type=submit> "
    "<br>pECB->ConnID=%lu  <br>Server was too busy. </form></html>";

  char szBuffer[4096];
  char szBuffer2[4096];

  EnterCriticalSection(&csQueueLock);

  if (!AddWorkQueueEntry(pECB)) {

    /* if ECB could not be assigned */

    LeaveCriticalSection(&csQueueLock);

    sprintf(szBuffer2, szBusyMessage, pECB->ConnID);

    /* Send outgoing header */

    sprintf(szBuffer, szHeader, strlen(szBuffer2));

    HeaderExInfo.pszHeader = szBuffer;
    HeaderExInfo.cchHeader = strlen( szBuffer );
    HeaderExInfo.pszStatus = "200 OK";
    HeaderExInfo.cchStatus = strlen( HeaderExInfo.pszStatus );
    HeaderExInfo.fKeepConn = TRUE;

    pECB->ServerSupportFunction(pECB->ConnID, HSE_REQ_SEND_RESPONSE_HEADER_EX, &HeaderExInfo, NULL, NULL);

    /* Send content */

    dwSize = strlen(szBuffer2);

    pECB->WriteClient(pECB->ConnID, szBuffer2, &dwSize, 0);

    return HSE_STATUS_SUCCESS_AND_KEEP_CONN;

  } else {

    /* release 1 thread from the pool */

    ReleaseSemaphore(hWorkSem, 1, NULL);

    LeaveCriticalSection(&csQueueLock);
  }

  return HSE_STATUS_PENDING;
}

BOOL WINAPI TerminateExtension ( IN DWORD dwFlags )

Definition at line 164 of file KeepAliveP.c.

{
  return TRUE;
}

DWORD WINAPI WorkerFunction ( IN LPVOID pvThreadNum )

Definition at line 183 of file KeepAliveP.c.

{
  EXTENSION_CONTROL_BLOCK *pECB;
  DWORD dwRet, dwState, dwSize;
  HSE_SEND_HEADER_EX_INFO HeaderExInfo;

  DWORD dwThreadNum = (DWORD)pvThreadNum;

  /* This header will be filled in with the content length */

  char szHeader[] =
    "Connection: Keep-Alive\r\nContent-Length: %lu\r\n"
    "Content-type: text/html\r\n\r\n";

  char szContent[] =
    "<html> <form method=get action=KeepAliveP.dll><input type=submit> "
    "<br>pECB->ConnID=%lu  <br>dwThreadNum=%lu</form></html>";

  char szBuffer[4096];
  char szBuffer2[4096];

  for (;;) {

    dwRet = WaitForSingleObject(hWorkSem, INFINITE);

    if (dwRet == WAIT_OBJECT_0) {

      EnterCriticalSection(&csQueueLock);

      if (GetWorkQueueEntry(&pECB)) {

        /* Found work to do */

        LeaveCriticalSection(&csQueueLock);

        sprintf(szBuffer2, szContent, pECB->ConnID, dwThreadNum);

        /* Send outgoing header */

        sprintf(szBuffer, szHeader, strlen(szBuffer2));

        HeaderExInfo.pszHeader = szBuffer;
        HeaderExInfo.cchHeader = strlen( szBuffer );
        HeaderExInfo.pszStatus = "200 OK";
        HeaderExInfo.cchStatus = strlen( HeaderExInfo.pszStatus );
        HeaderExInfo.fKeepConn = TRUE;

        pECB->ServerSupportFunction(pECB->ConnID, HSE_REQ_SEND_RESPONSE_HEADER_EX, &HeaderExInfo, NULL, NULL);

        /* Simulate extended processing */

        Sleep(3000);

        /* Send content */

        dwSize = strlen(szBuffer2);

        pECB->WriteClient(pECB->ConnID, szBuffer2, &dwSize, 0);

        /* Tell IIS to keep the connection open */

        dwState = HSE_STATUS_SUCCESS_AND_KEEP_CONN;

        pECB->ServerSupportFunction(pECB->ConnID, HSE_REQ_DONE_WITH_SESSION, &dwState, NULL, 0);

      } else {

        /* No item found is unexpected condition - exit thread */

        LeaveCriticalSection(&csQueueLock);

        ExitThread(0);
      }

    } else {

      /* Leave the infinite loop */

      break;
    }
  }

  return 0;
}

Generated on Wed Nov 13 2024 16:54:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/extensions/KeepAliveWithThreads/ThreadPool.c File Reference

  • Web
  • iis
  • extensions
  • KeepAliveWithThreads
Classes | Defines | Functions | Variables

ThreadPool.c File Reference

#include <windows.h>
#include <httpext.h>
#include "threadpool.h"

Go to the source code of this file.

Classes

struct | ECB_QUEUE_ENTRY

Defines

#define | WIN32_LEAN_AND_MEAN

Functions

BOOL | AddWorkQueueEntry (IN EXTENSION_CONTROL_BLOCK *pECB)
BOOL | GetWorkQueueEntry (OUT EXTENSION_CONTROL_BLOCK **ppECB)
BOOL | InitThreadPool (void)

Variables

DWORD dwCurrentEntry
DWORD dwLastEntry
ECB_QUEUE_ENTRY | ECBqueue [WORK_QUEUE_ENTRIES]
BOOL fQueueEmpty

Define Documentation

#define WIN32_LEAN_AND_MEAN

Definition at line 12 of file ThreadPool.c.

Function Documentation

BOOL AddWorkQueueEntry ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 84 of file ThreadPool.c.

{
  DWORD i;

  for (i = 0; i < WORK_QUEUE_ENTRIES; i++) {

    if (ECBqueue[i].pECB == NULL) {

      if (fQueueEmpty) {

        dwCurrentEntry = i;

        fQueueEmpty = FALSE;

      } else {

        ECBqueue[dwLastEntry].dwNextEntry = i;
      }

      ECBqueue[i].pECB = pECB;

      dwLastEntry = i;

      return TRUE;
    }
  }

  /* If no NULL queue entry found, indicate failure */

  return FALSE;
}

BOOL GetWorkQueueEntry ( OUT EXTENSION_CONTROL_BLOCK ** ppECB )

Definition at line 116 of file ThreadPool.c.

{
  if ((*ppECB = ECBqueue[dwCurrentEntry].pECB) == NULL) {

    return FALSE;

  } else {

    ECBqueue[dwCurrentEntry].pECB = NULL;

    if (dwCurrentEntry == dwLastEntry)  /* If this is only pending item */
      fQueueEmpty = TRUE;
    else
      dwCurrentEntry = ECBqueue[dwCurrentEntry].dwNextEntry;
  }

  return TRUE;
}

BOOL InitThreadPool ( void )

Definition at line 42 of file ThreadPool.c.

{
  DWORD i;
  DWORD dwThreadID;

  /* Create Semaphore in nonsignaled state */

  if ((hWorkSem = CreateSemaphore(NULL, 0, 0x7fffffff, NULL)) == NULL)
    return FALSE;

  InitializeCriticalSection(&csQueueLock);

  fQueueEmpty = TRUE;

  /* Create Pool Threads */

  for (i = 0; i < POOL_THREADS; i++)
    if (CreateThread(NULL, 0, WorkerFunction, (LPVOID)i, 0, &dwThreadID) == NULL)
      return FALSE;

  /* Clear work queue */

  ZeroMemory(ECBqueue, WORK_QUEUE_ENTRIES * sizeof(ECB_QUEUE_ENTRY));

  return TRUE;
}

Variable Documentation

DWORD dwCurrentEntry

Definition at line 30 of file ThreadPool.c.

DWORD dwLastEntry

Definition at line 30 of file ThreadPool.c.

ECB_QUEUE_ENTRY ECBqueue[WORK_QUEUE_ENTRIES]

Definition at line 26 of file ThreadPool.c.

BOOL fQueueEmpty

Definition at line 34 of file ThreadPool.c.

Generated on Wed Nov 13 2024 16:54:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/extensions/KeepAliveWithThreads/ThreadPool.h File Reference

  • Web
  • iis
  • extensions
  • KeepAliveWithThreads
Defines | Functions | Variables

ThreadPool.h File Reference

Go to the source code of this file.

Defines

#define | POOL_THREADS 2
#define | WORK_QUEUE_ENTRIES 2

Functions

BOOL | AddWorkQueueEntry (EXTENSION_CONTROL_BLOCK *)
BOOL | GetWorkQueueEntry (EXTENSION_CONTROL_BLOCK **ppECB)
BOOL | InitThreadPool (void)
DWORD WINAPI | WorkerFunction (LPVOID)

Variables

CRITICAL_SECTION | csQueueLock
HANDLE hWorkSem

Define Documentation

#define POOL_THREADS 2

Definition at line 10 of file ThreadPool.h.

#define WORK_QUEUE_ENTRIES 2

Definition at line 14 of file ThreadPool.h.

Function Documentation

BOOL AddWorkQueueEntry ( EXTENSION_CONTROL_BLOCK * )
BOOL GetWorkQueueEntry ( EXTENSION_CONTROL_BLOCK ** ppECB )
BOOL InitThreadPool ( void )

Definition at line 42 of file ThreadPool.c.

{
  DWORD i;
  DWORD dwThreadID;

  /* Create Semaphore in nonsignaled state */

  if ((hWorkSem = CreateSemaphore(NULL, 0, 0x7fffffff, NULL)) == NULL)
    return FALSE;

  InitializeCriticalSection(&csQueueLock);

  fQueueEmpty = TRUE;

  /* Create Pool Threads */

  for (i = 0; i < POOL_THREADS; i++)
    if (CreateThread(NULL, 0, WorkerFunction, (LPVOID)i, 0, &dwThreadID) == NULL)
      return FALSE;

  /* Clear work queue */

  ZeroMemory(ECBqueue, WORK_QUEUE_ENTRIES * sizeof(ECB_QUEUE_ENTRY));

  return TRUE;
}

DWORD WINAPI WorkerFunction ( LPVOID )

Variable Documentation

CRITICAL_SECTION csQueueLock

Definition at line 18 of file ThreadPool.h.

HANDLE hWorkSem

Definition at line 25 of file ThreadPool.h.

Generated on Wed Nov 13 2024 16:54:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/extensions/Redirect/Redirect.cpp File Reference

  • Web
  • iis
  • extensions
  • Redirect
Defines | Functions

Redirect.cpp File Reference

#include <windows.h>
#include <httpext.h>
#include <stdio.h>

Go to the source code of this file.

Defines

#define | BUFF_SIZE 2048
#define | WIN32_LEAN_AND_MEAN

Functions

BOOL WINAPI | GetExtensionVersion (OUT HSE_VERSION_INFO *pVer)
DWORD WINAPI | HttpExtensionProc (IN EXTENSION_CONTROL_BLOCK *pECB)
DWORD | SendInstructionPage (IN EXTENSION_CONTROL_BLOCK *pECB)
DWORD | SendInstructionPage (EXTENSION_CONTROL_BLOCK *pECB)
BOOL WINAPI | TerminateExtension (IN DWORD dwFlags)

Define Documentation

#define BUFF_SIZE 2048

Definition at line 18 of file Redirect.cpp.

#define WIN32_LEAN_AND_MEAN

Definition at line 13 of file Redirect.cpp.

Function Documentation

BOOL WINAPI GetExtensionVersion ( OUT HSE_VERSION_INFO * pVer )

Definition at line 36 of file Redirect.cpp.

{
  pVer->dwExtensionVersion = MAKELONG(HSE_VERSION_MINOR, HSE_VERSION_MAJOR);

  lstrcpyn(pVer->lpszExtensionDesc, "Redirect ISAPI Sample", HSE_MAX_EXT_DLL_NAME_LEN);

  return TRUE;
}

DWORD WINAPI HttpExtensionProc ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 67 of file Redirect.cpp.

{
  // If no query string is present, return the instruction page

  if (!strlen(pECB->lpszQueryString))
    return SendInstructionPage(pECB);

  // Check to see if the redirect URL is on another server. If it is, use
  // HSE_REQ_SEND_URL_REDIRECT_RESP.  If it's on this local server, use
  // HSE_REQ_SEND_URL to return the specified URL without using an HTTP 302
  // status code.

  DWORD dwBuffSize = strlen(pECB->lpszQueryString);

  if (!strnicmp(pECB->lpszQueryString, "http://", 7)) {

    pECB->ServerSupportFunction(pECB->ConnID, HSE_REQ_SEND_URL_REDIRECT_RESP, pECB->lpszQueryString, &dwBuffSize, NULL);

  } else {

    // Check to make sure that query string begins with a '/'.

    if (*(pECB->lpszQueryString) != '/')
      return SendInstructionPage( pECB );

    pECB->ServerSupportFunction(pECB->ConnID, HSE_REQ_SEND_URL, pECB->lpszQueryString, &dwBuffSize, NULL);
  }

  return HSE_STATUS_SUCCESS;
}

DWORD SendInstructionPage ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 111 of file Redirect.cpp.

{
  char szStatus[] = "200 OK";
  char szContent[] =
  "<html>"
  "<head><title>Redirect URL</title></head>"
  "<body>"
  "<h1>Redirect.dll</h1>\r\n<hr>\r\n"
  "Redirect.dll returns the resource specified on the query string.<br>\r\n<br>\r\n"
  "To specify a resource on the same server as Redirect.dll, use the following form:<br>\r\n<br>\r\n"
  "<code> http://server/scripts/Redirect.dll?/virtualdir/file.htm </code><br>\r\n<br>\r\n"
  "To specify a resource on another server, use the following form:<br>\r\n<br>\r\n"
  "<code> http://server/scripts/Redirect.dll?http://server/virtualdir/file.htm </code>"
  "</body>"
  "</html>";

  char szHeaderBase[] = "Content-Length: %lu\r\nContent-type: text/html\r\n\r\n";
  char szHeader[BUFF_SIZE];

  // Fill in byte count in Content-Length header

  DWORD cchContent = strlen(szContent);

  sprintf(szHeader, szHeaderBase, cchContent);

  // Populate SendHeaderExInfo struct

  HSE_SEND_HEADER_EX_INFO SendHeaderExInfo;

  SendHeaderExInfo.pszStatus = szStatus;
  SendHeaderExInfo.pszHeader = szHeader;
  SendHeaderExInfo.cchStatus = strlen(szStatus);
  SendHeaderExInfo.cchHeader = strlen(szHeader);
  SendHeaderExInfo.fKeepConn = FALSE;

  // Send header

  if (!pECB->ServerSupportFunction(pECB->ConnID, HSE_REQ_SEND_RESPONSE_HEADER_EX, &SendHeaderExInfo, NULL, NULL))
    return HSE_STATUS_ERROR;

  //  Send content

  if (!pECB->WriteClient(pECB->ConnID, szContent, &cchContent, 0))
    return HSE_STATUS_ERROR;

  return HSE_STATUS_SUCCESS;
}

DWORD SendInstructionPage ( EXTENSION_CONTROL_BLOCK * pECB )
BOOL WINAPI TerminateExtension ( IN DWORD dwFlags )

Definition at line 171 of file Redirect.cpp.

{
  return TRUE;
}

Generated on Wed Nov 13 2024 16:54:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/extensions/Simple/Simple.cpp File Reference

  • Web
  • iis
  • extensions
  • Simple
Defines | Functions

Simple.cpp File Reference

#include <windows.h>
#include <httpext.h>

Go to the source code of this file.

Defines

#define | WIN32_LEAN_AND_MEAN

Functions

BOOL WINAPI | DllMain (IN HINSTANCE hinstDll, IN DWORD dwReason, IN LPVOID lpvContext)
BOOL WINAPI | GetExtensionVersion (OUT HSE_VERSION_INFO *pVer)
DWORD WINAPI | HttpExtensionProc (IN EXTENSION_CONTROL_BLOCK *pECB)
BOOL WINAPI | TerminateExtension (IN DWORD dwFlags)

Define Documentation

#define WIN32_LEAN_AND_MEAN

Definition at line 11 of file Simple.cpp.

Function Documentation

BOOL WINAPI DllMain | ( | IN HINSTANCE | hinstDll,
 |  | IN DWORD | dwReason,
 |  | IN LPVOID lpvContext |
 | ) |  |

Definition at line 33 of file Simple.cpp.

{
  // Note that appropriate initialization and termination code
  // would be written within the switch statement below.  Because
  // this example is very simple, none is currently needed.

  switch(dwReason) {

    case DLL_PROCESS_ATTACH :

      break;

    case DLL_PROCESS_DETACH :

      break;
  }

  return TRUE;
}

BOOL WINAPI GetExtensionVersion ( OUT HSE_VERSION_INFO * pVer )

Definition at line 74 of file Simple.cpp.

{
  pVer->dwExtensionVersion = MAKELONG(HSE_VERSION_MINOR, HSE_VERSION_MAJOR);

  lstrcpyn(pVer->lpszExtensionDesc, "IIS SDK Simple ISAPI Extension", HSE_MAX_EXT_DLL_NAME_LEN - 1);

  return TRUE;
}

DWORD WINAPI HttpExtensionProc ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 101 of file Simple.cpp.

{
  static char szMessage[] =
  "<HTML>"
  "<HEAD><TITLE> Simple ISAPI Extension DLL </TITLE>"
  "</HEAD>\r\n"
  "<BODY>"
  "<P>Hello from Simple ISAPI Extension DLL!</P>\r\n"
  "</BODY></HTML>\r\n\r\n";

  HSE_SEND_HEADER_EX_INFO HeaderExInfo;

  // prepare headers

  HeaderExInfo.pszStatus = "200 OK";
  HeaderExInfo.pszHeader = "Content-type: text/html\r\n\r\n";
  HeaderExInfo.cchStatus = strlen(HeaderExInfo.pszStatus);
  HeaderExInfo.cchHeader = strlen(HeaderExInfo.pszHeader);
  HeaderExInfo.fKeepConn = FALSE;

  // send headers using IIS-provided callback
  //
  // Note - if we needed to keep connection open, we would set fKeepConn
  // to TRUE *and* we would need to provide correct Content-Length: header

  pECB->ServerSupportFunction(pECB->ConnID, HSE_REQ_SEND_RESPONSE_HEADER_EX, &HeaderExInfo, NULL, NULL);

  // Calculate length of string to output to client

  DWORD dwBytesToWrite = strlen( szMessage );

  // send text using IIS-provied callback

  pECB->WriteClient( pECB->ConnID, szMessage, &dwBytesToWrite, 0 );

  // Indicate that the call to HttpExtensionProc was successful

  return HSE_STATUS_SUCCESS;
}

BOOL WINAPI TerminateExtension ( IN DWORD dwFlags )

Definition at line 157 of file Simple.cpp.

{
  // Note: We must not agree to be unloaded if we have any pending requests.

  return TRUE;
}

Generated on Wed Nov 13 2024 16:54:49 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/extensions/WorkerThread/WorkerThread.c File Reference

  • Web
  • iis
  • extensions
  • WorkerThread
Defines | Functions | Variables

WorkerThread.c File Reference

#include <windows.h>
#include <httpext.h>
#include <stdio.h>

Go to the source code of this file.

Defines

#define | WIN32_LEAN_AND_MEAN

Functions

BOOL WINAPI | GetExtensionVersion (OUT HSE_VERSION_INFO *pVer)
DWORD WINAPI | HttpExtensionProc (IN EXTENSION_CONTROL_BLOCK *pECB)
BOOL | SendHttpHeaders (EXTENSION_CONTROL_BLOCK *, LPCSTR, LPCSTR, BOOL)
BOOL WINAPI | TerminateExtension (IN DWORD dwFlags)
DWORD WINAPI | WorkerFunction (IN LPVOID vECB)
DWORD WINAPI | WorkerFunction (LPVOID)

Variables

DWORD | g_dwThreadCount = 0

Define Documentation

#define WIN32_LEAN_AND_MEAN

Definition at line 21 of file WorkerThread.c.

Function Documentation

BOOL WINAPI GetExtensionVersion ( OUT HSE_VERSION_INFO * pVer )

Definition at line 50 of file WorkerThread.c.

{
  /* tell the server our version number and extension description */

  pVer->dwExtensionVersion = MAKELONG(HSE_VERSION_MINOR, HSE_VERSION_MAJOR);

  lstrcpyn(pVer->lpszExtensionDesc, "ISAPI Worker Thread Extension Sample", HSE_MAX_EXT_DLL_NAME_LEN - 1);

  return TRUE;
}

DWORD WINAPI HttpExtensionProc ( IN EXTENSION_CONTROL_BLOCK * pECB )

Definition at line 77 of file WorkerThread.c.

{
  DWORD dwThreadID;

  /* NOTE: in production environment you'd probably want to limit the number of threads created */

  CreateThread( NULL,              // Pointer to thread security attributes
                0,                 // Initial thread stack size, in bytes
                WorkerFunction,    // Pointer to thread function
                pECB,              // The ECB is the argument for the new thread
                0,                 // Creation flags
                &dwThreadID);      // Pointer to returned thread identifier

  /* update global thread count */

  InterlockedIncrement(&g_dwThreadCount);

  /* Return HSE_STATUS_PENDING to release IIS pool thread without losing connection */

  return HSE_STATUS_PENDING;
}

BOOL SendHttpHeaders | ( | EXTENSION_CONTROL_BLOCK * | pECB,
 |  | LPCSTR | pszStatus,
 |  | LPCSTR | pszHeaders,
 |  | BOOL | fKeepConnection
 | ) |  |

Definition at line 167 of file WorkerThread.c.

{
  HSE_SEND_HEADER_EX_INFO header_ex_info;

  BOOL success;

  header_ex_info.pszStatus = pszStatus;
  header_ex_info.pszHeader = pszHeaders;
  header_ex_info.cchStatus = strlen(pszStatus);
  header_ex_info.cchHeader = strlen(pszHeaders);
  header_ex_info.fKeepConn = fKeepConnection;

  success = pECB->ServerSupportFunction(pECB->ConnID, HSE_REQ_SEND_RESPONSE_HEADER_EX, &header_ex_info, NULL, NULL);

  return success;
}

BOOL WINAPI TerminateExtension ( IN DWORD dwFlags )

Definition at line 198 of file WorkerThread.c.

{
  /* Our threads are deterministic and will complete not much later than 5 seconds from now */

  /* wait for all threads to terminate, sleeping for 1 sec */

  while (g_dwThreadCount > 0)
    SleepEx(1000, FALSE);

  /* make sure the last thread indeed exited */

  SleepEx(1000, FALSE);

  return TRUE;
}

DWORD WINAPI WorkerFunction ( IN LPVOID vECB )

Definition at line 113 of file WorkerThread.c.

{
  char szHeader[] = "Content-type: text/html\r\n\r\n";
  char szContent[] = "<html> <form method=get action=WorkerThread.dll><h1>Worker Thread Sample</h1><hr>"
                     "<input type=submit value=\"Send Request\"> </form></html>";

  /* Initialize local ECB pointer to void pointer passed to thread */

  EXTENSION_CONTROL_BLOCK *pECB = vECB;

  DWORD dwSize = strlen(szContent);

  /* Send outgoing header */

  SendHttpHeaders(pECB, "200 OK", szHeader, FALSE);

  /* Simulate extended processing for 5 seconds */

  Sleep(5000);

  /* Send content */

  pECB->WriteClient(pECB->ConnID, szContent, &dwSize, 0);

  /* Inform server that the request has been satisfied, and the connection may now be dropped */

  pECB->ServerSupportFunction(pECB->ConnID, HSE_REQ_DONE_WITH_SESSION, NULL, NULL, NULL);

  /* update global thread count */

  InterlockedDecrement(&g_dwThreadCount);

  return 0;
}

DWORD WINAPI WorkerFunction ( LPVOID )

Variable Documentation

DWORD g_dwThreadCount = 0

Definition at line 28 of file WorkerThread.c.

Generated on Wed Nov 13 2024 16:54:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/filters/AuthFilt/AuthFilt.c File Reference

  • Web
  • iis
  • filters
  • AuthFilt
Functions

AuthFilt.c File Reference

#include <windows.h>
#include <httpfilt.h>
#include "authfilt.h"

Go to the source code of this file.

Functions

BOOL WINAPI | DllMain (IN HINSTANCE hinstDll, IN DWORD fdwReason, IN LPVOID lpvContext OPTIONAL)
BOOL WINAPI | GetFilterVersion (HTTP_FILTER_VERSION *pVer)
DWORD WINAPI | HttpFilterProc (HTTP_FILTER_CONTEXT *pfc, DWORD NotificationType, VOID *pvData)

Function Documentation

BOOL WINAPI DllMain | ( | IN HINSTANCE | hinstDll,
 |  | IN DWORD | fdwReason,
 |  | IN LPVOID lpvContext | OPTIONAL
 | ) |  |

Definition at line 39 of file AuthFilt.c.

{
  BOOL fReturn = TRUE;

  switch (fdwReason)
  {
    case DLL_PROCESS_ATTACH :

      if (!InitializeUserDatabase() || !InitializeCache())
      {
        DbgWrite((DEST, "[GetFilterVersion] Database or cache failed, error %d\n", GetLastError()))

        return FALSE;
      }

      /* We don't care about thread attach/detach notifications */

      DisableThreadLibraryCalls(hinstDll);

      break;

    case DLL_PROCESS_DETACH :

      if (lpvContext != NULL)
      {
        TerminateCache();
        TerminateUserDatabase();
      }

      break;

    default :

      break;
  }

  return fReturn;
}

BOOL WINAPI GetFilterVersion ( HTTP_FILTER_VERSION * pVer )

Definition at line 78 of file AuthFilt.c.

{
  DbgWrite(( DEST,
    "[GetFilterVersion] Server filter version is %d.%d\n",
    HIWORD(pVer->dwServerFilterVersion ),
    LOWORD(pVer->dwServerFilterVersion )));

  pVer->dwFilterVersion = HTTP_FILTER_REVISION;

  /* Specify the types and order of notification */

  pVer->dwFlags = (SF_NOTIFY_SECURE_PORT |
    SF_NOTIFY_NONSECURE_PORT |
    SF_NOTIFY_AUTHENTICATION |
    SF_NOTIFY_LOG |
    SF_NOTIFY_ORDER_DEFAULT);

  strcpy(pVer->lpszFilterDesc, "Sample Authentication Filter, version 1.0");

  return TRUE;
}

DWORD WINAPI HttpFilterProc | ( | HTTP_FILTER_CONTEXT * | pfc,
 |  | DWORD | NotificationType,
 |  | VOID * | pvData
 | ) |  |

Definition at line 116 of file AuthFilt.c.

{
  BOOL                  fAllowed;
  CHAR                  achUser[SF_MAX_USERNAME];
  HTTP_FILTER_AUTHENT   *pAuth;
  HTTP_FILTER_LOG       *pLog;
  CHAR                  *pch;

  /*  Handle this notification */

  switch (NotificationType)
  {
    case SF_NOTIFY_AUTHENTICATION :

      pAuth = (HTTP_FILTER_AUTHENT *)pvData;

      /* Ignore the anonymous user */

      if (!*pAuth->pszUser)
      {

        /*  Tell the server to notify any subsequent notifications in the chain */

        return SF_STATUS_REQ_NEXT_NOTIFICATION;
      }

      /*  Save the unmapped username so we can log it later */

      strcpy(achUser, pAuth->pszUser);

      /*  Make sure this user is a valid user and map to the appropriate Windows NT user */

      if (!ValidateUser(pAuth->pszUser, pAuth->pszPassword, &fAllowed))
      {
        DbgWrite((DEST,
          "[OnAuthentication] Error %d validating user %s\n",
          GetLastError(),
          pAuth->pszUser));

        return SF_STATUS_REQ_ERROR;
      }

      if (!fAllowed)
      {
        /* This user isn't allowed access.  Indicate this to the server */

        SetLastError(ERROR_ACCESS_DENIED);

        return SF_STATUS_REQ_ERROR;
      }

      /*
        Save the unmapped user name so we can log it later on.  We allocate
        enough space for two usernames so we can use this memory block
        for logging.  Note we may have already allocated it from a previous
        request on this TCP session.
      */

      if (!pfc->pFilterContext)
      {
        pfc->pFilterContext = pfc->AllocMem(pfc, 2 * SF_MAX_USERNAME + 4, 0);

        if (!pfc->pFilterContext)
        {
          SetLastError(ERROR_NOT_ENOUGH_MEMORY);

          return SF_STATUS_REQ_ERROR;
        }
      }

      strcpy((CHAR *)pfc->pFilterContext, achUser);

      return SF_STATUS_REQ_HANDLED_NOTIFICATION;

    case SF_NOTIFY_LOG :

      /*
        The unmapped username is in pFilterContext if this filter authenticated this user
      */

      if (pfc->pFilterContext)
      {
        pch  = pfc->pFilterContext;
        pLog = (HTTP_FILTER_LOG *)pvData;

        /*
          Put both the original username and the NT mapped username into the log in the form "Original User (NT User)"
        */

        strcat(pch, " (");
        strcat(pch, pLog->pszClientUserName);
        strcat(pch, ")");

        pLog->pszClientUserName = pch;
      }

      return SF_STATUS_REQ_NEXT_NOTIFICATION;

    default :

      DbgWrite((DEST, "[HttpFilterProc] Unknown notification type, %d\n", NotificationType));

      break;
  }

  return SF_STATUS_REQ_NEXT_NOTIFICATION;
}

Generated on Wed Nov 13 2024 16:54:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/filters/AuthFilt/AuthFilt.h File Reference

  • Web
  • iis
  • filters
  • AuthFilt
Defines | Functions

AuthFilt.h File Reference

Go to the source code of this file.

Defines

#define | DbgWrite(x)
#define | ISWHITE(ch) ((ch) && ((ch) == ' ' || (ch) == '\t' || (ch) == '\n' || (ch) == '\r'))

Functions

BOOL | AddUserToCache (CHAR *pszUserName, CHAR *pszPassword, CHAR *pszNTUser, CHAR *pszNTUserPassword)
BOOL | InitializeCache (VOID)
BOOL | InitializeUserDatabase (VOID)
BOOL | LookupUserInCache (CHAR *pszUserName, BOOL *pfFound, CHAR *pszPassword, CHAR *pszNTUser, CHAR *pszNTUserPassword)
BOOL | LookupUserInDb (IN CHAR *pszUser, OUT BOOL *pfFound, OUT CHAR *pszPassword, OUT CHAR *pszNTUser, OUT CHAR *pszNTUserPassword)
VOID | TerminateCache (VOID)
VOID | TerminateUserDatabase (VOID)
BOOL | ValidateUser (CHAR *pszUserName, CHAR *pszPassword, BOOL *pfValid)

Define Documentation

#define DbgWrite ( x )

Definition at line 28 of file AuthFilt.h.

#define ISWHITE ( ch ) ((ch) && ((ch) == ' ' || (ch) == '\t' || (ch) == '\n' || (ch) == '\r'))

Definition at line 18 of file AuthFilt.h.

Function Documentation

BOOL AddUserToCache | ( | CHAR * | pszUserName,
 |  | CHAR * | pszPassword,
 |  | CHAR * | pszNTUser,
 |  | CHAR * | pszNTUserPassword
 | ) |  |

Definition at line 191 of file cache.c.

{
  LIST_ENTRY *pEntry;
  USER_INFO *pUser;

  /* Check our parameters before adding them to the cache */

  if (strlen(pszUserName) > SF_MAX_USERNAME ||
      strlen(pszPassword) > SF_MAX_PASSWORD ||
      strlen(pszNTUser) > SF_MAX_USERNAME ||
      strlen(pszNTUserPassword) > SF_MAX_PASSWORD)
  {
      SetLastError(ERROR_INVALID_PARAMETER);
      return FALSE;
  }

  /* Search the cache for the specified user to make sure there are no duplicates */

  EnterCriticalSection(&csCacheLock);

  for (pEntry = CacheListHead.Flink; pEntry != &CacheListHead; pEntry = pEntry->Flink)
  {
    pUser = CONTAINING_RECORD(pEntry, USER_INFO, ListEntry);

    if (!stricmp(pszUserName, pUser->achUserName))
      goto Found;
  }

  /* Allocate a new cache item and put it at the head of the list */

  pUser = (USER_INFO *)LocalAlloc(LPTR, sizeof(USER_INFO));

  if (!pUser)
  {
    LeaveCriticalSection(&csCacheLock);

    SetLastError(ERROR_NOT_ENOUGH_MEMORY);
    return FALSE;
  }

  pUser->ListEntry.Flink = CacheListHead.Flink;
  pUser->ListEntry.Blink = &CacheListHead;

  CacheListHead.Flink->Blink = &pUser->ListEntry;
  CacheListHead.Flink = &pUser->ListEntry;

Found:

  /* Set the various fields */

  strcpy(pUser->achUserName, pszUserName);
  strcpy(pUser->achPassword, pszPassword);
  strcpy(pUser->achNTUserName, pszNTUser);
  strcpy(pUser->achNTUserPassword, pszNTUserPassword);

  cCacheItems++;

  /* If there are too many cached users, remove the least recently used one now */

  if (cCacheItems > MAX_CACHED_USERS)
  {
    pEntry = CacheListHead.Blink;

    pEntry->Blink->Flink = &CacheListHead;
    CacheListHead.Blink  = pEntry->Blink;

    LocalFree(CONTAINING_RECORD(pEntry, USER_INFO, ListEntry));

    cCacheItems--;
  }

  LeaveCriticalSection(&csCacheLock);

  return TRUE;
}

BOOL InitializeCache ( VOID )

Definition at line 73 of file cache.c.

{
  if (fCacheInitialized)
    return TRUE;

  InitializeCriticalSection(&csCacheLock);

  CacheListHead.Blink = CacheListHead.Flink = &CacheListHead;

  fCacheInitialized = TRUE;

  return TRUE;
}

BOOL InitializeUserDatabase ( VOID )

Definition at line 109 of file db.c.

{
  HANDLE hFile;
  DWORD  cbFile;
  DWORD  cbRead;

  /* Open and read the file.  The System account must have access to the file. */

  hFile = CreateFile(USER_LIST_FILE, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);

  if (hFile == INVALID_HANDLE_VALUE)
  {
    DbgWrite((DEST, "[InitializeUserDatabase] Error %d openning %s\n", GetLastError(), USER_LIST_FILE));

    return FALSE;
  }

  cbFile = GetFileSize(hFile, NULL);

  if (cbFile == (DWORD) -1)
  {
    CloseHandle(hFile);

    return FALSE;
  }

  pszUserFile = LocalAlloc(LPTR, cbFile + 1);

  if (!pszUserFile)
  {
    SetLastError(ERROR_NOT_ENOUGH_MEMORY);

    CloseHandle(hFile);

    return FALSE;
  }

  if (!ReadFile(hFile, pszUserFile, cbFile, &cbRead, NULL))
  {
    CloseHandle(hFile);
    LocalFree(pszUserFile);

    return FALSE;
  }

  CloseHandle( hFile );

  /* Null terminate the file data */

  pszUserFile[cbRead] = '\0';

  return TRUE;
}

BOOL LookupUserInCache | ( | CHAR * | pszUserName,
 |  | BOOL * | pfFound,
 |  | CHAR * | pszPassword,
 |  | CHAR * | pszNTUser,
 |  | CHAR * | pszNTUserPassword
 | ) |  |

Definition at line 109 of file cache.c.

{
  LIST_ENTRY *pEntry;
  USER_INFO *pUser;
  DWORD cPosition = 0;

  /* Search the cache for the specified user */

  EnterCriticalSection(&csCacheLock);

  for (pEntry = CacheListHead.Flink; pEntry != &CacheListHead; pEntry = pEntry->Flink)
  {
    pUser = CONTAINING_RECORD(pEntry, USER_INFO, ListEntry);

    if (!stricmp( pszUserName, pUser->achUserName))
      goto Found;

    cPosition++;
  }

  LeaveCriticalSection(&csCacheLock);

  /* Not Found */

  *pfFound = FALSE;

  return TRUE;

Found:

  /* Copy out the user properties */

  strcpy(pszPassword,       pUser->achPassword);
  strcpy(pszNTUser,         pUser->achNTUserName);
  strcpy(pszNTUserPassword, pUser->achNTUserPassword);

  /*
    Move this user entry to the front of the list as we're probably going
    to get subsequent requests for this user.  Note we only move it
    if it's not already near the front
  */

  if (cPosition > LIST_REORDER_THRESHOLD)
  {
    /* Remove from the old position... */

    pEntry->Blink->Flink = pEntry->Flink;
    pEntry->Flink->Blink = pEntry->Blink;

    /* ...and insert it at the beginning of the list */

    pEntry->Blink = &CacheListHead;
    pEntry->Flink = CacheListHead.Flink;

    CacheListHead.Flink->Blink = pEntry;
    CacheListHead.Flink = pEntry;
  }

  LeaveCriticalSection(&csCacheLock);

  *pfFound = TRUE;

  return TRUE;
}

BOOL LookupUserInDb | ( | IN CHAR * | pszUser,
 |  | OUT BOOL * | pfFound,
 |  | OUT CHAR * | pszPassword,
 |  | OUT CHAR * | pszNTUser,
 |  | OUT CHAR * | pszNTUserPassword
 | ) |  |

Definition at line 185 of file db.c.

{
  CHAR *pch = pszUserFile;
  CHAR *pchEnd;
  DWORD cchUser = strlen(pszUser);
  DWORD cch;

  *pfFound = FALSE;

  /*
    Find the external username.  We're expecting one user per line in
    the form:

        username:password, NTUser:NTUserPassword
  */

  while (pch && *pch)
  {
    while (ISWHITE(*pch))
      pch++;

    if (toupper(*pch) == toupper(*pszUser) && !strnicmp(pszUser, pch, cchUser) && pch[cchUser] == ':')
    {
      pch += cchUser + 1;
      goto Found;
    }

    pch = strchr(pch + 1, '\n');
  }

  /* Not found */

  return TRUE;

Found:

  /* Break out the external username */

  if (!(pchEnd = strchr(pch, ',')))
  {
    SetLastError(ERROR_INVALID_PASSWORDNAME);
    return FALSE;
  }

  cch = pchEnd - pch;

  if (cch + 1 > SF_MAX_PASSWORD)
  {
    SetLastError(ERROR_INVALID_PASSWORDNAME);
    return FALSE;
  }

  memcpy(pszPassword, pch, cch);
  pszPassword[cch] = '\0';

  pch = pchEnd + 1;

  /* Get the NT username from the file */

  while (ISWHITE(*pch))
      pch++;

  if (!(pchEnd = strchr(pch, ':')))
  {
    SetLastError(ERROR_BAD_USERNAME);
    return FALSE;
  }

  cch = pchEnd - pch;

  if (cch + 1 > SF_MAX_USERNAME)
  {
    SetLastError(ERROR_BAD_USERNAME);
    return FALSE;
  }

  memcpy(pszNTUser, pch, cch);
  pszNTUser[cch] = '\0';

  pch = pchEnd + 1;

  /* Get the NT password from the file, look for a '\r' or '\n' */

  pchEnd = pch;

  while (*pchEnd && *pchEnd != '\r' && *pchEnd != '\n')
    pchEnd++;

  cch = pchEnd - pch;

  if (cch + 1 > SF_MAX_PASSWORD)
  {
    SetLastError(ERROR_INVALID_PASSWORDNAME);
    return FALSE;
  }

  memcpy(pszNTUserPassword, pch, cch);
  pszNTUserPassword[cch] = '\0';

  *pfFound = TRUE;

  return TRUE;
}

VOID TerminateCache ( VOID )

Definition at line 273 of file cache.c.

{
  LIST_ENTRY *pEntry;
  LIST_ENTRY *pEntryNext;
  USER_INFO *pUser;

  if (!fCacheInitialized)
    return;

  EnterCriticalSection(&csCacheLock);

  /* Free all of the cache entries */

  for (pEntry = CacheListHead.Flink; pEntry != &CacheListHead; pEntry  = pEntryNext)
  {
    pUser = CONTAINING_RECORD(pEntry, USER_INFO, ListEntry);

    pEntryNext = pEntry->Flink;

    /* Remove this entry from the list and free it */

    pEntry->Blink->Flink = pEntry->Flink;
    pEntry->Flink->Blink = pEntry->Blink;

    LocalFree(pUser);
  }

  cCacheItems = 0;

  LeaveCriticalSection(&csCacheLock);

  DeleteCriticalSection(&csCacheLock);

  fCacheInitialized = FALSE;
}

VOID TerminateUserDatabase ( VOID )

Definition at line 295 of file db.c.

{
  if (pszUserFile)
    LocalFree(pszUserFile);
}

BOOL ValidateUser | ( | CHAR * | pszUserName,
 |  | CHAR * | pszPassword,
 |  | BOOL * | pfValid
 | ) |  |
Generated on Wed Nov 13 2024 16:54:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/filters/AuthFilt/cache.c File Reference

  • Web
  • iis
  • filters
  • AuthFilt
Classes | Defines | Typedefs | Functions | Variables

cache.c File Reference

#include <windows.h>
#include <httpfilt.h>
#include "authfilt.h"

Go to the source code of this file.

Classes

struct | _USER_INFO

Defines

#define | LIST_REORDER_THRESHOLD 6
#define | MAX_CACHED_USERS 100

Typedefs

typedef struct _USER_INFO * | PUSER_INFO
typedef struct _USER_INFO | USER_INFO

Functions

BOOL | AddUserToCache (CHAR *pszUserName, CHAR *pszPassword, CHAR *pszNTUser, CHAR *pszNTUserPassword)
BOOL | InitializeCache (VOID)
BOOL | LookupUserInCache (CHAR *pszUserName, BOOL *pfFound, CHAR *pszPassword, CHAR *pszNTUser, CHAR *pszNTUserPassword)
VOID | TerminateCache (VOID)

Variables

LIST_ENTRY | CacheListHead
DWORD | cCacheItems = 0
CRITICAL_SECTION | csCacheLock
BOOL | fCacheInitialized = FALSE

Define Documentation

#define LIST_REORDER_THRESHOLD 6

Definition at line 30 of file cache.c.

#define MAX_CACHED_USERS 100

Definition at line 26 of file cache.c.

Typedef Documentation

typedef struct _USER_INFO * PUSER_INFO
typedef struct _USER_INFO USER_INFO

Function Documentation

BOOL AddUserToCache | ( | CHAR * | pszUserName,
 |  | CHAR * | pszPassword,
 |  | CHAR * | pszNTUser,
 |  | CHAR * | pszNTUserPassword
 | ) |  |

Definition at line 191 of file cache.c.

{
  LIST_ENTRY *pEntry;
  USER_INFO *pUser;

  /* Check our parameters before adding them to the cache */

  if (strlen(pszUserName) > SF_MAX_USERNAME ||
      strlen(pszPassword) > SF_MAX_PASSWORD ||
      strlen(pszNTUser) > SF_MAX_USERNAME ||
      strlen(pszNTUserPassword) > SF_MAX_PASSWORD)
  {
      SetLastError(ERROR_INVALID_PARAMETER);
      return FALSE;
  }

  /* Search the cache for the specified user to make sure there are no duplicates */

  EnterCriticalSection(&csCacheLock);

  for (pEntry = CacheListHead.Flink; pEntry != &CacheListHead; pEntry = pEntry->Flink)
  {
    pUser = CONTAINING_RECORD(pEntry, USER_INFO, ListEntry);

    if (!stricmp(pszUserName, pUser->achUserName))
      goto Found;
  }

  /* Allocate a new cache item and put it at the head of the list */

  pUser = (USER_INFO *)LocalAlloc(LPTR, sizeof(USER_INFO));

  if (!pUser)
  {
    LeaveCriticalSection(&csCacheLock);

    SetLastError(ERROR_NOT_ENOUGH_MEMORY);
    return FALSE;
  }

  pUser->ListEntry.Flink = CacheListHead.Flink;
  pUser->ListEntry.Blink = &CacheListHead;

  CacheListHead.Flink->Blink = &pUser->ListEntry;
  CacheListHead.Flink = &pUser->ListEntry;

Found:

  /* Set the various fields */

  strcpy(pUser->achUserName, pszUserName);
  strcpy(pUser->achPassword, pszPassword);
  strcpy(pUser->achNTUserName, pszNTUser);
  strcpy(pUser->achNTUserPassword, pszNTUserPassword);

  cCacheItems++;

  /* If there are too many cached users, remove the least recently used one now */

  if (cCacheItems > MAX_CACHED_USERS)
  {
    pEntry = CacheListHead.Blink;

    pEntry->Blink->Flink = &CacheListHead;
    CacheListHead.Blink  = pEntry->Blink;

    LocalFree(CONTAINING_RECORD(pEntry, USER_INFO, ListEntry));

    cCacheItems--;
  }

  LeaveCriticalSection(&csCacheLock);

  return TRUE;
}

BOOL InitializeCache ( VOID )

Definition at line 73 of file cache.c.

{
  if (fCacheInitialized)
    return TRUE;

  InitializeCriticalSection(&csCacheLock);

  CacheListHead.Blink = CacheListHead.Flink = &CacheListHead;

  fCacheInitialized = TRUE;

  return TRUE;
}

BOOL LookupUserInCache | ( | CHAR * | pszUserName,
 |  | BOOL * | pfFound,
 |  | CHAR * | pszPassword,
 |  | CHAR * | pszNTUser,
 |  | CHAR * | pszNTUserPassword
 | ) |  |

Definition at line 109 of file cache.c.

{
  LIST_ENTRY *pEntry;
  USER_INFO *pUser;
  DWORD cPosition = 0;

  /* Search the cache for the specified user */

  EnterCriticalSection(&csCacheLock);

  for (pEntry = CacheListHead.Flink; pEntry != &CacheListHead; pEntry = pEntry->Flink)
  {
    pUser = CONTAINING_RECORD(pEntry, USER_INFO, ListEntry);

    if (!stricmp( pszUserName, pUser->achUserName))
      goto Found;

    cPosition++;
  }

  LeaveCriticalSection(&csCacheLock);

  /* Not Found */

  *pfFound = FALSE;

  return TRUE;

Found:

  /* Copy out the user properties */

  strcpy(pszPassword,       pUser->achPassword);
  strcpy(pszNTUser,         pUser->achNTUserName);
  strcpy(pszNTUserPassword, pUser->achNTUserPassword);

  /*
    Move this user entry to the front of the list as we're probably going
    to get subsequent requests for this user.  Note we only move it
    if it's not already near the front
  */

  if (cPosition > LIST_REORDER_THRESHOLD)
  {
    /* Remove from the old position... */

    pEntry->Blink->Flink = pEntry->Flink;
    pEntry->Flink->Blink = pEntry->Blink;

    /* ...and insert it at the beginning of the list */

    pEntry->Blink = &CacheListHead;
    pEntry->Flink = CacheListHead.Flink;

    CacheListHead.Flink->Blink = pEntry;
    CacheListHead.Flink = pEntry;
  }

  LeaveCriticalSection(&csCacheLock);

  *pfFound = TRUE;

  return TRUE;
}

VOID TerminateCache ( VOID )

Definition at line 273 of file cache.c.

{
  LIST_ENTRY *pEntry;
  LIST_ENTRY *pEntryNext;
  USER_INFO *pUser;

  if (!fCacheInitialized)
    return;

  EnterCriticalSection(&csCacheLock);

  /* Free all of the cache entries */

  for (pEntry = CacheListHead.Flink; pEntry != &CacheListHead; pEntry  = pEntryNext)
  {
    pUser = CONTAINING_RECORD(pEntry, USER_INFO, ListEntry);

    pEntryNext = pEntry->Flink;

    /* Remove this entry from the list and free it */

    pEntry->Blink->Flink = pEntry->Flink;
    pEntry->Flink->Blink = pEntry->Blink;

    LocalFree(pUser);
  }

  cCacheItems = 0;

  LeaveCriticalSection(&csCacheLock);

  DeleteCriticalSection(&csCacheLock);

  fCacheInitialized = FALSE;
}

Variable Documentation

LIST_ENTRY CacheListHead

Definition at line 49 of file cache.c.

DWORD cCacheItems = 0

Definition at line 61 of file cache.c.

CRITICAL_SECTION csCacheLock

Definition at line 53 of file cache.c.

BOOL fCacheInitialized = FALSE

Definition at line 57 of file cache.c.

Generated on Wed Nov 13 2024 16:54:51 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/filters/AuthFilt/db.c File Reference

  • Web
  • iis
  • filters
  • AuthFilt
Defines | Functions | Variables

db.c File Reference

#include <windows.h>
#include <httpfilt.h>
#include "authfilt.h"

Go to the source code of this file.

Defines

#define | USER_LIST_FILE "c:\\inetsrv\\userdb.txt"

Functions

BOOL | InitializeUserDatabase (VOID)
BOOL | LookupUserInDb (IN CHAR *pszUser, OUT BOOL *pfFound, OUT CHAR *pszPassword, OUT CHAR *pszNTUser, OUT CHAR *pszNTUserPassword)
VOID | TerminateUserDatabase (VOID)
BOOL | ValidateUser (IN OUT CHAR *pszUserName, IN OUT CHAR *pszPassword, OUT BOOL *pfValid)

Variables

CHAR * | pszUserFile = NULL

Define Documentation

#define USER_LIST_FILE "c:\\inetsrv\\userdb.txt"

Definition at line 28 of file db.c.

Function Documentation

BOOL InitializeUserDatabase ( VOID )

Definition at line 109 of file db.c.

{
  HANDLE hFile;
  DWORD  cbFile;
  DWORD  cbRead;

  /* Open and read the file.  The System account must have access to the file. */

  hFile = CreateFile(USER_LIST_FILE, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);

  if (hFile == INVALID_HANDLE_VALUE)
  {
    DbgWrite((DEST, "[InitializeUserDatabase] Error %d openning %s\n", GetLastError(), USER_LIST_FILE));

    return FALSE;
  }

  cbFile = GetFileSize(hFile, NULL);

  if (cbFile == (DWORD) -1)
  {
    CloseHandle(hFile);

    return FALSE;
  }

  pszUserFile = LocalAlloc(LPTR, cbFile + 1);

  if (!pszUserFile)
  {
    SetLastError(ERROR_NOT_ENOUGH_MEMORY);

    CloseHandle(hFile);

    return FALSE;
  }

  if (!ReadFile(hFile, pszUserFile, cbFile, &cbRead, NULL))
  {
    CloseHandle(hFile);
    LocalFree(pszUserFile);

    return FALSE;
  }

  CloseHandle( hFile );

  /* Null terminate the file data */

  pszUserFile[cbRead] = '\0';

  return TRUE;
}

BOOL LookupUserInDb | ( | IN CHAR * | pszUser,
 |  | OUT BOOL * | pfFound,
 |  | OUT CHAR * | pszPassword,
 |  | OUT CHAR * | pszNTUser,
 |  | OUT CHAR * | pszNTUserPassword
 | ) |  |

Definition at line 185 of file db.c.

{
  CHAR *pch = pszUserFile;
  CHAR *pchEnd;
  DWORD cchUser = strlen(pszUser);
  DWORD cch;

  *pfFound = FALSE;

  /*
    Find the external username.  We're expecting one user per line in
    the form:

        username:password, NTUser:NTUserPassword
  */

  while (pch && *pch)
  {
    while (ISWHITE(*pch))
      pch++;

    if (toupper(*pch) == toupper(*pszUser) && !strnicmp(pszUser, pch, cchUser) && pch[cchUser] == ':')
    {
      pch += cchUser + 1;
      goto Found;
    }

    pch = strchr(pch + 1, '\n');
  }

  /* Not found */

  return TRUE;

Found:

  /* Break out the external username */

  if (!(pchEnd = strchr(pch, ',')))
  {
    SetLastError(ERROR_INVALID_PASSWORDNAME);
    return FALSE;
  }

  cch = pchEnd - pch;

  if (cch + 1 > SF_MAX_PASSWORD)
  {
    SetLastError(ERROR_INVALID_PASSWORDNAME);
    return FALSE;
  }

  memcpy(pszPassword, pch, cch);
  pszPassword[cch] = '\0';

  pch = pchEnd + 1;

  /* Get the NT username from the file */

  while (ISWHITE(*pch))
      pch++;

  if (!(pchEnd = strchr(pch, ':')))
  {
    SetLastError(ERROR_BAD_USERNAME);
    return FALSE;
  }

  cch = pchEnd - pch;

  if (cch + 1 > SF_MAX_USERNAME)
  {
    SetLastError(ERROR_BAD_USERNAME);
    return FALSE;
  }

  memcpy(pszNTUser, pch, cch);
  pszNTUser[cch] = '\0';

  pch = pchEnd + 1;

  /* Get the NT password from the file, look for a '\r' or '\n' */

  pchEnd = pch;

  while (*pchEnd && *pchEnd != '\r' && *pchEnd != '\n')
    pchEnd++;

  cch = pchEnd - pch;

  if (cch + 1 > SF_MAX_PASSWORD)
  {
    SetLastError(ERROR_INVALID_PASSWORDNAME);
    return FALSE;
  }

  memcpy(pszNTUserPassword, pch, cch);
  pszNTUserPassword[cch] = '\0';

  *pfFound = TRUE;

  return TRUE;
}

VOID TerminateUserDatabase ( VOID )

Definition at line 295 of file db.c.

{
  if (pszUserFile)
    LocalFree(pszUserFile);
}

BOOL ValidateUser | ( | IN OUT CHAR * | pszUserName,
 |  | IN OUT CHAR * | pszPassword,
 |  | OUT BOOL * | pfValid
 | ) |  |

Definition at line 50 of file db.c.

{
  BOOL fFound;
  CHAR achPassword[SF_MAX_PASSWORD];
  CHAR achNTUser[SF_MAX_USERNAME];
  CHAR achNTUserPassword[SF_MAX_PASSWORD];

  /*  Assume we're going to fail validation */

  *pfValid = FALSE;

  /*  Lookup the user in the cache, if that fails, get the user from the */
  /*  database and add the retrieved user to the cache */

  if (!LookupUserInCache(pszUserName, &fFound, achPassword, achNTUser, achNTUserPassword))
    return FALSE;

  if (!fFound)
  {
    if (!LookupUserInDb(pszUserName, &fFound, achPassword, achNTUser, achNTUserPassword))
      return FALSE;

    if (fFound)
      AddUserToCache(pszUserName, achPassword, achNTUser, achNTUserPassword);
  }

  if (!fFound)
  {
    DbgWrite((DEST, "[ValidateUser] Failed to find user %s\n", pszUserName));

    return TRUE;
  }

  /* Do the passwords match? */

  if (!strcmp(pszPassword, achPassword))
  {
    /* We have a match, map to the NT user and password */

    strcpy(pszUserName, achNTUser);
    strcpy(pszPassword, achNTUserPassword);

    *pfValid = TRUE;
  }

  return TRUE;
}

Variable Documentation

CHAR* pszUserFile = NULL

Definition at line 32 of file db.c.

Generated on Wed Nov 13 2024 16:54:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/filters/UpCase/UpCase.c File Reference

  • Web
  • iis
  • filters
  • UpCase
Functions

UpCase.c File Reference

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <httpfilt.h>

Go to the source code of this file.

Functions

BOOL WINAPI __stdcall | GetFilterVersion (HTTP_FILTER_VERSION *pVer)
DWORD WINAPI __stdcall | HttpFilterProc (HTTP_FILTER_CONTEXT *pfc, DWORD NotificationType, VOID *pvData)

Function Documentation

BOOL WINAPI __stdcall GetFilterVersion ( HTTP_FILTER_VERSION * pVer )

Definition at line 48 of file UpCase.c.

{
  /* Specify the types and order of notification */

  pVer->dwFlags = (SF_NOTIFY_NONSECURE_PORT | SF_NOTIFY_URL_MAP | SF_NOTIFY_SEND_RAW_DATA | SF_NOTIFY_ORDER_DEFAULT);

  pVer->dwFilterVersion = HTTP_FILTER_REVISION;

  strcpy(pVer->lpszFilterDesc, "Upper case conversion filter, Version 1.0");

  return TRUE;
}

DWORD WINAPI __stdcall HttpFilterProc | ( | HTTP_FILTER_CONTEXT * | pfc,
 |  | DWORD | NotificationType,
 |  | VOID * | pvData
 | ) |  |

Definition at line 61 of file UpCase.c.

{
  CHAR *pchIn, *pPhysPath;
  DWORD cbBuffer, cbtemp;
  PHTTP_FILTER_URL_MAP pURLMap;
  PHTTP_FILTER_RAW_DATA pRawData;

  switch (NotificationType) {

    case SF_NOTIFY_URL_MAP :

      /* Check the URL for a subdirectory in the form of /UC/ or /uc/ */

      pURLMap = (PHTTP_FILTER_URL_MAP)pvData;

      pPhysPath = pURLMap->pszPhysicalPath;

      pfc->pFilterContext = 0;

      for ( ; *pPhysPath; pPhysPath++)
      {
        /* Ensure that there are at least 4 characters (checking for "\UC\") left in the URL before checking */

        if (strlen(pPhysPath) > 3)
        {
          if (*pPhysPath == '\\' && (*(pPhysPath + 1) == 'u' || *(pPhysPath + 1) == 'U') && (*(pPhysPath + 2) == 'c' || *(pPhysPath + 2) == 'C') && *(pPhysPath + 3) == '\\')
          {
            /* Now that we've found it, remove it by collapsing everything down */

            for ( ; *(pPhysPath + 3) ; pPhysPath++)
              *pPhysPath = *(pPhysPath + 3);

            /* NULL terminate the string */

            *pPhysPath = '\0';

            /* And set the flag to let the SF_NOTIFY_SEND_RAW_DATA handler know to uppercase the content */

            pfc->pFilterContext = (VOID *)1;

            /* Break us out of the loop - note that this will only find the first instance of /UC/ in the URL */

            break;
          }
        }
      }

      break;

    case SF_NOTIFY_SEND_RAW_DATA :

      if (pfc->pFilterContext)
      {
        pRawData = (PHTTP_FILTER_RAW_DATA)pvData;

        pchIn = (BYTE *)pRawData->pvInData;

        cbBuffer = 0;

        if (pfc->pFilterContext == (VOID *)1)
        {
          /*
          As this is the first block, scan through it until 2 CRLFs are seen, to pass
          all of the headers.
          */

          for ( ; cbBuffer < pRawData->cbInData - 2; cbBuffer++)
          {
            if (pchIn[cbBuffer] == '\n' && pchIn[cbBuffer + 2]  == '\n')
            {
              cbBuffer += 3;

              break;
            }

            cbBuffer++;
          }

          for (cbtemp = 0; cbtemp < (cbBuffer - 3); cbtemp++)
          {
            if (pchIn[cbtemp] == '/' && pchIn[cbtemp + 1] == 'h' && pchIn[cbtemp + 2] == 't' && pchIn[cbtemp + 3] == 'm')
            {
              pfc->pFilterContext = (VOID *)2;

              break;
            }
          }

          if (cbtemp == cbBuffer)
            pfc->pFilterContext = 0; /* not an  html file */
        }

        /* Now uppercase everything */

        if (pfc->pFilterContext)
          for ( ; cbBuffer < pRawData->cbInData; cbBuffer++)
            pchIn[cbBuffer] = (pchIn[cbBuffer] >= 'a' && pchIn[cbBuffer] <= 'z') ? (pchIn[cbBuffer] - 'a' + 'A') : pchIn[cbBuffer];
      }

      break;

    default :

      break;
  }

  return SF_STATUS_REQ_NEXT_NOTIFICATION;
}

Generated on Wed Nov 13 2024 16:54:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/ISAPI_6.0/Extension.cpp File Reference

  • Web
  • iis
  • ISAPI_6.0
Defines | Functions

Extension.cpp File Reference

#include <windows.h>
#include <httpext.h>

Go to the source code of this file.

Defines

#define | _WIN32_WINNT 0x0500

Functions

BOOL WINAPI | GetExtensionVersion (HSE_VERSION_INFO *pVer)
DWORD WINAPI | HttpExtensionProc (EXTENSION_CONTROL_BLOCK *pecb)
BOOL WINAPI | TerminateExtension (DWORD dwFlags)

Define Documentation

#define _WIN32_WINNT 0x0500

Definition at line 18 of file Extension.cpp.

Function Documentation

BOOL WINAPI GetExtensionVersion ( HSE_VERSION_INFO * pVer )

Definition at line 26 of file Extension.cpp.

       :

    Entry point for ISAPI extension initialization.  Required.

    This function will be called exactly once in the lifetime
    of the extension, at initialization time.  This function is
    a useful point to do complex initialization tasks.  This
    function is called outside of the system loader lock, so
    it does not have the same restrictions as DllMain.

Arguments:

    pVer - points to extension version info structure

Returns:

    TRUE on success, FALSE on failure.

    Note that in the case of FALSE, IIS will call GetLastError()
    and return an error page to the client.  The entity body of
    the page may be textual if the FormatMessage API can resolve
    it, or it may just be an error number if FormatMessage can't
    resolve it.

--*/
{
    //
    // Tell IIS which version of ISAPI this extension was built from.
    //

    pVer->dwExtensionVersion = MAKELONG( HSE_VERSION_MINOR,
                                         HSE_VERSION_MAJOR);

    //
    // Report the description string for this extension.  Ensure
    // that it does not exceed the maximum length and is NULL
    // terminated.
    //

    strncpy( pVer->lpszExtensionDesc,
             "***",
             HSE_MAX_EXT_DLL_NAME_LEN );

    pVer->lpszExtensionDesc[HSE_MAX_EXT_DLL_NAME_LEN-1] = '\0';

    //
    // Return TRUE if we successfully initialized.
    //

    return TRUE;
}

DWORD WINAPI HttpExtensionProc ( EXTENSION_CONTROL_BLOCK * pecb )

Definition at line 85 of file Extension.cpp.

       :

    Entry point for ISAPI requests.  Required.

    This function is called once per request.  The EXTENSION_CONTROL_BLOCK
    passed in contains information and function pointers sufficient to
    interact with the server during this processing.

    Note that, once HttpExtensionProc is called, it is the responsibility
    of the extension to send back any data that the client should receive.
    IIS will not automatically generate any response, even in the case of
    HSE_STATUS_ERROR once the request has progressed to the point where
    this function is called.

    Also note that you should not make any blocking calls or do long-running
    operations within this function.  To allow efficient scaling of your
    server, you should consider creating a pool of private threads to handle
    the requests.  In that case, the implementation of this function would
    be just to add the pecb to a queue and return HSE_STATUS_PENDING.  The
    threads in the pool would be responsible for dequeing a pecb and calling
    HSE_REQ_DONE_WITH_SESSION when they are finished processing it.

Arguments:

    pecb - pointer to the extenstion control block

Returns:

    HSE_STATUS_SUCCESS - Indicates successful request.
    HSE_STATUS_ERROR   - Indicates failed request.
    HSE_STATUS_PENDING - Indicates that processing of the request
                         should continue after this function returns.
                         It HSE_STATUS_PENDING is used, it is necessary
                         that HSE_REQ_DONE_WITH_SESSION is called
                         exactly once when processing is completed for
                         the request.

--*/
{
    return HSE_STATUS_SUCCESS;
}

BOOL WINAPI TerminateExtension ( DWORD dwFlags )

Definition at line 134 of file Extension.cpp.

       :

    Entry point for ISAPI extension termination.  Optional.

    If present, IIS will call this function just before it
    unloads the extension.  In general, this function will
    be called after all of the running requests for this
    extension have completed.

    Any complex or long-running uninitialization tasks should
    be performed here.  This function is called outside of the
    system loader lock, so it does not have the same
    restrictions as DllMain.

Arguments:

    dwFlags - specifies whether the DLL can refuse to unload or not

Returns:

    TRUE, if the DLL can be unloaded

    Note that the HSE_TERM_ADVISORY_UNLOAD flag is not used by
    IIS, so it's not necessary to consider any cases where the
    extension can refuse to unload.

--*/
{
    BOOL    fReturn = TRUE;

    switch ( dwFlags )
    {
    case HSE_TERM_ADVISORY_UNLOAD:

        //
        // Return TRUE if ok to unload or FALSE if not
        //

        fReturn = TRUE;

    case HSE_TERM_MUST_UNLOAD:

        //
        // Cannot refuse to unload
        //

        fReturn = TRUE;
    }

    return fReturn;
}

Generated on Wed Nov 13 2024 16:54:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/ISAPI_6.0/CacheIsapi/CacheIsapi.cpp File Reference

  • Web
  • iis
  • ISAPI_6.0
  • CacheIsapi
Defines | Functions | Variables

CacheIsapi.cpp File Reference

#include <IsapiTools.h>

Go to the source code of this file.

Defines

#define | CACHE_PAGE
#define | CHANGE_DURATION_PAGE
#define | DEFAULT_CACHE_SECONDS 60
#define | HELP_PAGE
#define | INVALIDATE_PAGE
#define | MODULE_NAME "CacheIsapi"

Functions

BOOL | DoCacheable (ISAPI_REQUEST *pRequest)
BOOL | DoChangeDuration (ISAPI_REQUEST *pRequest)
BOOL | DoHelp (ISAPI_REQUEST *pRequest)
BOOL | DoInvalidate (ISAPI_REQUEST *pRequest)
BOOL WINAPI | GetExtensionVersion (HSE_VERSION_INFO *pVer)
VOID WINAPI | HandleCompletion (EXTENSION_CONTROL_BLOCK *pecb, VOID *pContext, DWORD cbIo, DWORD dwError)
DWORD WINAPI | HttpExtensionProc (EXTENSION_CONTROL_BLOCK *pecb)
BOOL WINAPI | Initialize (VOID *pContext)

Variables

DWORD | g_dwCacheSeconds = DEFAULT_CACHE_SECONDS
ISAPI_EXTENSION g_Extension
LONG | g_lRequests = 0
PFN_HSE_CACHE_INVALIDATION_CALLBACK | g_pfnInvalidateCacheUrl = NULL
ISAPI_STRINGW g_strCacheUrl

Define Documentation

#define CACHE_PAGE
Value:
"<html>\r\n"                                   \
        "<head><title>CacheIsapi</title></head>\r\n"   \
        "<h1> CacheIsapi.dll Sample </h1>\r\n"         \
        "<hr>\r\n"                                     \
        "This page is cacheable.<br><br>\r\n"          \
        "<table border=2 cellspacing=2 padding=0>\r\n" \
        "  <tr>\r\n"                                   \
        "    <td>User mode request count:</td>\r\n"    \
        "    <td>%d</td>\r\n"                          \
        "  </tr>\r\n"                                  \
        "  <tr>\r\n"                                   \
        "    <td>Page generation Time:</td>\r\n"       \
        "    <td>%s</td>\r\n"                          \
        "  </tr>\r\n"                                  \
        "  <tr>\r\n"                                   \
        "    <td>Cache Duration:</td>\r\n"             \
        "    <td>%d seconds</td>\r\n"                  \
        "  </tr>\r\n"                                  \
        "</table>\r\n"                                 \
        "<br>\r\n"                                     \
        "To invalidate the cache before it expires, "  \
        "add 'invalidate' to the query string "        \
        "and re-request this URL.  To change "         \
        "the cache duration, add the desired "         \
        "number of seconds to the query string "       \
        "and re-request this URL.\r\n"                 \
        "</html>"

Definition at line 23 of file CacheIsapi.cpp.

#define CHANGE_DURATION_PAGE
Value:
"<html>\r\n"                                 \
        "<head><title>CacheIsapi</title></head>\r\n" \
        "<h1>CacheIsapi.dll</h1>\r\n"                \
        "<hr>\r\n"                                   \
        "Cache duration set to %d seconds\r\n"       \
        "</html>"

Definition at line 60 of file CacheIsapi.cpp.

#define DEFAULT_CACHE_SECONDS 60

Definition at line 21 of file CacheIsapi.cpp.

#define HELP_PAGE
Value:
"<html>\r\n"                                            \
        "<head><title>CacheIsapi</title></head>\r\n"            \
        "<h1>CacheIsapi.dll</h1>\r\n"                           \
        "<hr>\r\n"                                              \
        "Request CacheIsapi.dll with no query string "          \
        "to generate a cacheable response.  Example:<br>\r\n"   \
        "<pre>\r\n"                                             \
        "\thttp://server/scripts/cacheisapi.dll\r\n"            \
        "</pre><br>\r\n"                                        \
        "Request CacheIsapi.dll with 'invalidate' on the "      \
        "query string to invalidate the current cached "        \
        "response.  Example:<br>\r\n"                           \
        "<pre>\r\n"                                             \
        "\thttp://server/scripts/cacheisapi.dll?invalidate\r\n" \
        "</pre><br>\r\n"                                        \
        "Request CacheIsapi.dll with a number on the query "    \
        "string, to change the cache duration to that number "  \
        "of seconds.  Example:<br>\r\n"                         \
        "<pre>\r\n"                                             \
        "\thttp://server/scripts/cacheisapi.dll?60\r\n"         \
        "</pre><br>\r\n"                                        \
        "Anything else returns this page."                      \
        "</html>\r\n"

Definition at line 68 of file CacheIsapi.cpp.

#define INVALIDATE_PAGE
Value:
"<html>\r\n"                                 \
        "<head><title>CacheIsapi</title></head>\r\n" \
        "<h1>CacheIsapi.dll</h1>\r\n"                \
        "<hr>\r\n"                                   \
        "%s"                                         \
        "</html>"

Definition at line 52 of file CacheIsapi.cpp.

#define MODULE_NAME "CacheIsapi"

Definition at line 20 of file CacheIsapi.cpp.

Function Documentation

BOOL DoCacheable ( ISAPI_REQUEST * pRequest )

Definition at line 505 of file CacheIsapi.cpp.

       :

    Builds the cacheable response page

Arguments:

    pRequest - An ISAPI_REQUEST object for this request

Returns:

    TRUE on success, FALSE on failure.

--*/
{
    FILETIME        ftCurrent;
    ISAPI_STRING    strCurrent;

    //
    // Get the current time
    //

    if ( GetCurrentTimeAsFileTime( &ftCurrent ) == FALSE )
    {
        goto Failed;
    }

    if ( GetFileTimeAsString( &ftCurrent, &strCurrent ) == FALSE )
    {
        goto Failed;
    }

    //
    // Bump the request count
    //

    InterlockedIncrement( &g_lRequests );

    if ( pRequest->PrintfToResponseBuffer( CACHE_PAGE,
                                           g_lRequests,
                                           strCurrent.QueryStr(),
                                           g_dwCacheSeconds ) == FALSE )
    {
        goto Failed;
    }

    return TRUE;

Failed:

    WriteDebug( "DoCacheable failed.  Error %d.\r\n",
                GetLastError() );

    return FALSE;
}

BOOL DoChangeDuration ( ISAPI_REQUEST * pRequest )

Definition at line 636 of file CacheIsapi.cpp.

       :

    Changes the cache lifetime for cacheable responses from this
    extension.

Arguments:

    pRequest - An ISAPI_REQUEST object for this request

Returns:

    TRUE on success, FALSE on failure.

--*/
{
    DWORD   dwNewDuration;
    HRESULT hr;

    dwNewDuration = atol( pRequest->QueryEcb()->lpszQueryString );

    g_dwCacheSeconds = dwNewDuration;

    //
    // Flush the cache
    //

    hr = g_pfnInvalidateCacheUrl( g_strCacheUrl.QueryStr() );

    if ( FAILED( hr ) )
    {
        SetLastError( hr );

        goto Failed;
    }

    //
    // Build the response
    //

    if ( pRequest->PrintfToResponseBuffer( CHANGE_DURATION_PAGE,
                                           g_dwCacheSeconds ) == FALSE )
    {
        goto Failed;
    }

    return TRUE;

Failed:

    WriteDebug( "DoCacheable failed.  Error %d.\r\n",
                GetLastError() );

    return FALSE;
}

BOOL DoHelp ( ISAPI_REQUEST * pRequest )

Definition at line 697 of file CacheIsapi.cpp.

       :

    Builds the help page for this extension

Arguments:

    pRequest - An ISAPI_REQUEST object for this request

Returns:

    TRUE on success, FALSE on failure.

--*/
{
    if ( pRequest->AddDataToResponseBuffer( HELP_PAGE,
                                            sizeof(HELP_PAGE) - 1 ) == FALSE )
    {
        goto Failed;
    }

    return TRUE;

Failed:

    WriteDebug( "DoCacheable failed.  Error %d.\r\n",
                GetLastError() );

    return FALSE;
}

BOOL DoInvalidate ( ISAPI_REQUEST * pRequest )

Definition at line 566 of file CacheIsapi.cpp.

       :

    Builds the invalidates the cache entry for
    this URL and builds the response page

Arguments:

    pRequest - An ISAPI_REQUEST object for this request

Returns:

    TRUE on success, FALSE on failure.

--*/
{
    ISAPI_STRING    strResult;
    HRESULT         hr;

    //
    // Invalidate the cache
    //

    ISAPI_ASSERT( g_strCacheUrl.QueryStr() );

    hr = g_pfnInvalidateCacheUrl( g_strCacheUrl.QueryStr() );

    if ( FAILED( hr ) )
    {
        SetLastError( hr );

        if ( strResult.Printf( "Error %d occurred flushing cache.",
                               GetLastError() ) == FALSE )
        {
            goto Failed;
        }
    }
    else
    {
        if ( strResult.Printf( "Successfully flushed the cache.") == FALSE )
        {
            goto Failed;
        }
    }

    //
    // Build a page with the results
    //

    if ( pRequest->PrintfToResponseBuffer( INVALIDATE_PAGE,
                                           strResult.QueryStr() ) == FALSE )
    {
        goto Failed;
    }

    return TRUE;

Failed:

    WriteDebug( "DoCacheable failed.  Error %d.\r\n",
                GetLastError() );

    return FALSE;
}

BOOL WINAPI GetExtensionVersion ( HSE_VERSION_INFO * pVer )

Definition at line 166 of file CacheIsapi.cpp.

       :

    Entry point for ISAPI extension initialization.  Required.

    This function will be called exactly once in the lifetime
    of the extension, at initialization time.  This function is
    a useful point to do complex initialization tasks.  This
    function is called outside of the system loader lock, so
    it does not have the same restrictions as DllMain.

Arguments:

    pVer - points to extension version info structure

Returns:

    TRUE on success, FALSE on failure.

    Note that in the case of FALSE, IIS will call GetLastError()
    and return an error page to the client.  The entity body of
    the page may be textual if the FormatMessage API can resolve
    it, or it may just be an error number if FormatMessage can't
    resolve it.

--*/
{
    //
    // Tell IIS which version of ISAPI this extension was built from.
    //

    pVer->dwExtensionVersion = MAKELONG( HSE_VERSION_MINOR,
                                         HSE_VERSION_MAJOR);

    //
    // Report the description string for this extension.  Ensure
    // that it does not exceed the maximum length and is NULL
    // terminated.
    //

    strncpy( pVer->lpszExtensionDesc,
             "CacheIsapi Sample Extension",
             HSE_MAX_EXT_DLL_NAME_LEN );

    pVer->lpszExtensionDesc[HSE_MAX_EXT_DLL_NAME_LEN-1] = '\0';

    //
    // Initialize the IsapiTools and ISAPI_EXTENSION object
    //

    InitializeIsapiTools( MODULE_NAME );

    if ( g_Extension.Initialize( MODULE_NAME ) == FALSE )
    {
        goto Failed;
    }

    //
    // Return TRUE if we successfully initialized.
    //

    return TRUE;

Failed:

    WriteDebug( "GetExtensionVersion failed.  Error %d.\r\n",
                GetLastError() );

    return FALSE;
}

VOID WINAPI HandleCompletion | ( | EXTENSION_CONTROL_BLOCK * | pecb,
 |  | VOID * | pContext,
 |  | DWORD | cbIo,
 |  | DWORD | dwError
 | ) |  |

Definition at line 734 of file CacheIsapi.cpp.

       :

    Handles completion of asynchronous I/O by deleting
    the ISAPI_REQUEST associated with the request.  The
    destructor for this object takes care of calling
    HSE_REQ_DONE_WITH_SESSION as appropriate.

Arguments:

    pRequest - An ISAPI_REQUEST object for this request

Returns:

    TRUE on success, FALSE on failure.

--*/
{
    ISAPI_REQUEST * pRequest = (ISAPI_REQUEST*)pContext;

    //
    // We just need to delete the ISAPI_REQUEST object
    // it's destructor will do the rest.
    //

    if ( pRequest )
    {
        delete pRequest;
        pRequest = NULL;
    }
}

DWORD WINAPI HttpExtensionProc ( EXTENSION_CONTROL_BLOCK * pecb )

Definition at line 243 of file CacheIsapi.cpp.

       :

    Entry point for ISAPI requests.  Required.

    This function is called once per request.  The EXTENSION_CONTROL_BLOCK
    passed in contains information and function pointers sufficient to
    interact with the server during this processing.

    Note that, once HttpExtensionProc is called, it is the responsibility
    of the extension to send back any data that the client should receive.
    IIS will not automatically generate any response, even in the case of
    HSE_STATUS_ERROR once the request has progressed to the point where
    this function is called.

    Also note that you should not make any blocking calls or do long-running
    operations within this function.  To allow efficient scaling of your
    server, you should consider creating a pool of private threads to handle
    the requests.  In that case, the implementation of this function would
    be just to add the pecb to a queue and return HSE_STATUS_PENDING.  The
    threads in the pool would be responsible for dequeing a pecb and calling
    HSE_REQ_DONE_WITH_SESSION when they are finished processing it.

Arguments:

    pecb - pointer to the extenstion control block

Returns:

    HSE_STATUS_SUCCESS - Indicates successful request.
    HSE_STATUS_ERROR   - Indicates failed request.
    HSE_STATUS_PENDING - Indicates that processing of the request
                         should continue after this function returns.
                         It HSE_STATUS_PENDING is used, it is necessary
                         that HSE_REQ_DONE_WITH_SESSION is called
                         exactly once when processing is completed for
                         the request.

--*/
{
    ISAPI_REQUEST * pRequest;
    DWORD           dwHseStatus;
    BOOL            fCacheResponse = FALSE;

    //
    // Initialize on the first hit
    //

    if ( g_Extension.InitOnce( Initialize, pecb ) == FALSE )
    {
        goto Failed;
    }

    //
    // Allocate an ISAPI_REQUEST object and set the status
    // and headers.
    //

    pRequest = new ISAPI_REQUEST( pecb );

    if ( !pRequest )
    {
        goto Failed;
    }

    if ( pRequest->SetBufferedResponseStatus( "200 OK" ) == FALSE )
    {
        goto Failed;
    }

    if ( pRequest->AddHeaderToBufferedResponse( "Content-Type",
                                                "text/html" ) == FALSE )
    {
        goto Failed;
    }

    //
    // Process the request appropriate for the actual query string
    //

    if ( *pecb->lpszQueryString == '\0' )
    {
        dwHseStatus = DoCacheable( pRequest );

        if ( dwHseStatus != HSE_STATUS_ERROR )
        {
            fCacheResponse = TRUE;
        }
    }
    else if ( stricmp( pecb->lpszQueryString, "invalidate" ) == 0 )
    {
        dwHseStatus = DoInvalidate( pRequest );
    }
    else if ( isdigit( *pecb->lpszQueryString ) )
    {
        dwHseStatus = DoChangeDuration( pRequest );
    }
    else
    {
        dwHseStatus = DoHelp( pRequest );
    }

    if ( dwHseStatus == HSE_STATUS_ERROR )
    {
        goto Failed;
    }

    //
    // Send the response asynchronousle.  Return HSE_STATUS_PENDING
    // if successful
    //

    if ( pRequest->AsyncTransmitBufferedResponse( HandleCompletion,
                                                  fCacheResponse?
                                                  g_dwCacheSeconds :
                                                  0 ) == TRUE )
    {
        return HSE_STATUS_PENDING;
    }

    //
    // Fall through to the error handler
    //

Failed:

    WriteDebug( "HttpExtensionProc failed. Error %d\r\n",
                GetLastError() );

    return SyncSendGenericServerError( pecb );
}

BOOL WINAPI Initialize ( VOID * pContext )

Definition at line 381 of file CacheIsapi.cpp.

       :

    Performs initialization of this extension

Arguments:

    pContext - The ISAPI_REQUEST associated with this request

Returns:

    TRUE on success, FALSE on failure

--*/
{
    EXTENSION_CONTROL_BLOCK *   pecb;
    BOOL                        fResult = FALSE;
    WCHAR *                     pCursor;

    pecb = (EXTENSION_CONTROL_BLOCK*)pContext;

    ISAPI_ASSERT( pecb );

    ISAPI_REQUEST   Request( pecb );

    //
    // Get the cache invalidation callback function
    //

    if ( g_pfnInvalidateCacheUrl == NULL )
    {
        fResult = pecb->ServerSupportFunction( pecb->ConnID,
                                               HSE_REQ_GET_CACHE_INVALIDATION_CALLBACK,
                                               &g_pfnInvalidateCacheUrl,
                                               NULL,
                                               NULL );

        if ( !fResult )
        {
            goto Done;
        }
    }

    //
    // Initialize the cache invalidation URL.
    //
    // Note that that URL comes from represents the key
    // that http.sys used to identify the request from the,
    // and it includes the URL and query string as sent.
    // If we call the cache invalidation function, it will
    // invalidate exactly this key.
    //
    // To keep things simple, we are going to make a few
    // assumptions.
    //
    //   1. We will assume that this extensions will
    //      mark its response as cacheable only in the
    //      case where there is no query string.
    //
    //   2. We will assume that this extension was not
    //      called via HSE_REQ_EXEC_URL.  In this case,
    //      it's possible that the URL from the client
    //      looks nothing like the URL that would
    //      normally call this extension.  We don't need
    //      to worry about the case where a filter has
    //      rewritten the client's URL, because IIS would
    //      not allow such a modified request to be
    //      cached.
    //
    // As a result of these assumptions, we are just going
    // to take the first URL to reach this extension, and
    // strip any URL off of it.  This is what we'll pass
    // in the cache invalidation function to http.sys.
    //
    // If a real, production extension chose to use the
    // cache invalidation function, it would need to keep
    // a list of URLs, representing each request, and then
    // invalidate the specific ones desired.
    //
    // Note also, that IIS will examine the "Expires"
    // header in the response and automatically invalidate
    // the cache entry at the expiration time.  Because of
    // this, most extensions won't need to use the
    // invalidation function at all.
    //

    fResult = Request.GetServerVariable( "UNICODE_CACHE_URL",
                                         &g_strCacheUrl );

    if ( !fResult )
    {
        goto Done;
    }

    //
    // Strip any query string
    //

    pCursor = wcschr( g_strCacheUrl.QueryStr(), L'?' );

    if ( pCursor )
    {
        *pCursor = L'\0';

        g_strCacheUrl.CalcLen();
    }

Done:

    if ( !fResult )
    {
        WriteDebug( "Initialize failed.  Error %d.\r\n",
                    GetLastError() );
    }

    return fResult;
}

Variable Documentation

DWORD g_dwCacheSeconds = DEFAULT_CACHE_SECONDS

Definition at line 123 of file CacheIsapi.cpp.

ISAPI_EXTENSION g_Extension

Definition at line 97 of file CacheIsapi.cpp.

LONG g_lRequests = 0

Definition at line 117 of file CacheIsapi.cpp.

PFN_HSE_CACHE_INVALIDATION_CALLBACK g_pfnInvalidateCacheUrl = NULL

Definition at line 111 of file CacheIsapi.cpp.

ISAPI_STRINGW g_strCacheUrl

Definition at line 105 of file CacheIsapi.cpp.

Generated on Wed Nov 13 2024 16:54:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/ISAPI_6.0/CustomAuth/CustomAuth.cpp File Reference

  • Web
  • iis
  • ISAPI_6.0
  • CustomAuth
Functions | Variables

CustomAuth.cpp File Reference

#include <IsapiTools.h>
#include <httpfilt.h>
#include "CustomAuth.h"

Go to the source code of this file.

Functions

BOOL | DecodeAndDecryptCredentials (CHAR *szCredentials, CHAR *szClientIP, ISAPI_STRING *pstrUser, ISAPI_STRING *pstrPassword, FILETIME *pft)
BOOL | EncryptAndEncodeCredentials (CHAR *szUser, CHAR *szPassword, CHAR *szClientIP, ISAPI_STRING *pstrResult)
BOOL WINAPI | GetExtensionVersion (HSE_VERSION_INFO *pVer)
BOOL | GetUserInfoAndUpdateCookie (ISAPI_STRING *pstrCookie, CHAR *szClientIP, HSE_EXEC_URL_USER_INFO *pUserInfo, ISAPI_STRING *pstrUser)
VOID WINAPI | HandleExecUrlCompletion (EXTENSION_CONTROL_BLOCK *pecb, VOID *pContext, DWORD cbIO, DWORD dwError)
VOID WINAPI | HandleSendPageCompletion (EXTENSION_CONTROL_BLOCK *pecb, VOID *pContext, DWORD cbIO, DWORD dwError)
DWORD WINAPI | HttpExtensionProc (EXTENSION_CONTROL_BLOCK *pecb)
DWORD | ProcessLogoff (EXTENSION_CONTROL_BLOCK *pecb)
DWORD | ProcessLogon (EXTENSION_CONTROL_BLOCK *pecb)
DWORD | SendBuiltinLogonPage (EXTENSION_CONTROL_BLOCK *pecb)

Variables

ISAPI_EXTENSION g_Extension
BOOL g_fFilterInitialized
BOOL g_fUseBuiltInLogoff
BOOL g_fUseBuiltInLogon
BOOL g_fUseClientIpForEncryption
BOOL g_fUseSSLForSubmission
INT | g_LogonTimeoutSeconds
DWORD g_LogonType
ISAPI_STRING g_strIniFile
ISAPI_STRING g_strLogoffUrl
ISAPI_STRING g_strLogonSuccessUrl
ISAPI_STRING g_strLogonUrl

Function Documentation

BOOL DecodeAndDecryptCredentials | ( | CHAR * | szCredentials,
 |  | CHAR * | szClientIP,
 |  | ISAPI_STRING * | pstrUser,
 |  | ISAPI_STRING * | pstrPassword,
 |  | FILETIME * | pft
 | ) |  |

Definition at line 1408 of file CustomAuth.cpp.

       :

    Accepts a string from the caller containing credentials
    that have been encrypted and base64 encoded, and returns
    the username and password.  The correct client's IP
    address is required to successfully complete the process.

Arguments:

    szCredentials - The encrypted and encoded credentials
    szClientIP    - The client's IP address
    pstrUser      - On successful return, contains the username
    pstrPassword  - On successful return, contains the password
    pft           - On successful return, contains the time stamp

Returns:

    TRUE on success, FALSE on failure.

--*/
{
    DATA_BLOB       ClearData = {0};
    DATA_BLOB       EncryptedData = {0};
    DATA_BLOB       EntropyData = {0};
    ISAPI_BUFFER    Buffer;
    ISAPI_STRING    strTimeStamp;
    CHAR *          pUsername;
    CHAR *          pPassword;
    CHAR *          pTimeStamp;
    CHAR *          pCursor;
    BOOL            fResult = FALSE;

    //
    // Decode the credentials
    //

    if ( Buffer.Base64Decode( szCredentials ) == FALSE )
    {
        goto Done;
    }

    //
    // Now decrypt them
    //

    EntropyData.pbData = (BYTE*)szClientIP;
    EntropyData.cbData = strlen( szClientIP );

    EncryptedData.pbData = (BYTE*)Buffer.QueryPtr();
    EncryptedData.cbData = Buffer.QueryDataSize();

    if ( CryptUnprotectData( &EncryptedData,
                             NULL,
                             g_fUseClientIpForEncryption ? &EntropyData : NULL,
                             NULL,
                             NULL,
                             CRYPTPROTECT_UI_FORBIDDEN,
                             &ClearData ) == FALSE )
    {
        goto Done;
    }

    //
    // Now parse the data for the username and password.
    // We assume the the code that encrypted the data
    // did so with the NULL terminator.
    //

    pUsername = (CHAR*)ClearData.pbData;

    pCursor = strchr( pUsername, '#' );

    if ( !pCursor )
    {
        SetLastError( ERROR_INVALID_PARAMETER );
        goto Done;
    }

    *pCursor = '\0';

    pPassword = pCursor + 1;

    pCursor = strchr( pPassword, '#' );

    if ( !pCursor )
    {
        SetLastError( ERROR_INVALID_PARAMETER );
        goto Done;
    }

    *pCursor = '\0';

    pTimeStamp = pCursor + 1;

    if ( pstrUser->Copy( pUsername ) == FALSE )
    {
        goto Done;
    }

    pstrUser->Unescape();

    if ( pstrPassword->Copy( pPassword ) == FALSE )
    {
        goto Done;
    }

    pstrPassword->Unescape();

    if ( strTimeStamp.Copy( pTimeStamp ) == FALSE )
    {
        goto Done;
    }

    strTimeStamp.Unescape();

    if ( GetFileTimeFromString( pft, strTimeStamp.QueryStr() ) == FALSE )
    {
        goto Done;
    }

    fResult = TRUE;

Done:

    if ( fResult == FALSE )
    {
        WriteDebug( "DecodeAndDecryptCredentials failed.  Error %d.\r\n",
                    GetLastError() );
    }

    //
    // Clean up data structures
    //

    if ( ClearData.pbData )
    {
        LocalFree( ClearData.pbData );
        ClearData.pbData = 0;
        ClearData.cbData = 0;
    }

    return fResult;
}

BOOL EncryptAndEncodeCredentials | ( | CHAR * | szUser,
 |  | CHAR * | szPassword,
 |  | CHAR * | szClientIP,
 |  | ISAPI_STRING * | pstrResult
 | ) |  |

Definition at line 1256 of file CustomAuth.cpp.

       :

    Accepts username and password information from the caller,
    encrypts and base64 encodes the data, and populates an
    ISAPI_STRING with the result.  The client's IP address is
    used in the encryption process to ensure that only requests
    from this same client will be able to decrypt them.

Arguments:

    szUser     - The user name to encrypt
    szPassword - The password to encrypt
    szClientIP - The client's IP address
    pstrResult - On successful return, contains the result

Returns:

    TRUE on success, FALSE on failure.

--*/
{
    DATA_BLOB       ClearBlob = {0};
    DATA_BLOB       EncryptedBlob = {0};
    DATA_BLOB       EntropyBlob = {0};
    ISAPI_STRING    strEncodedUser;
    ISAPI_STRING    strEncodedPassword;
    ISAPI_STRING    strCurrentTime;
    ISAPI_STRING    strCookedCredentials;
    BOOL            fResult = FALSE;

    //
    // Encode the username and credentials
    //

    if ( strEncodedUser.Copy( szUser ) == FALSE )
    {
        goto Done;
    }

    if ( strEncodedUser.Escape( TRUE ) == FALSE )
    {
        goto Done;
    }

    if ( strEncodedPassword.Copy( szPassword ) == FALSE )
    {
        goto Done;
    }

    if ( strEncodedPassword.Escape() == FALSE )
    {
        goto Done;
    }

    //
    // Get the current time and escape it
    //

    if ( GetCurrentTimeAsString( &strCurrentTime ) == FALSE )
    {
        goto Done;
    }

    if ( strCurrentTime.Escape() == FALSE )
    {
        goto Done;
    }

    //
    // Create the raw cookie value
    //

    if ( strCookedCredentials.Printf( "%s#%s#%s",
                                       strEncodedUser.QueryStr(),
                                       strEncodedPassword.QueryStr(),
                                       strCurrentTime.QueryStr() ) == FALSE )
    {
        goto Done;
    }

    //
    // Set up the input data blobs.
    //
    // Use the client IP for the entropy blob, and
    // cooked credentials for the clear data blob.
    //

    EntropyBlob.pbData = (BYTE*)szClientIP;
    EntropyBlob.cbData = strlen( szClientIP );

    ClearBlob.pbData = (BYTE*)strCookedCredentials.QueryStr();
    ClearBlob.cbData = strCookedCredentials.QueryCB() + sizeof(CHAR);

    //
    // Encrypt the data.  Zero out the clear data blob right afterward.
    //

    if ( CryptProtectData( &ClearBlob,
                           L"",
                           g_fUseClientIpForEncryption ? &EntropyBlob : NULL,
                           NULL,
                           NULL,
                           CRYPTPROTECT_UI_FORBIDDEN,
                           &EncryptedBlob ) == FALSE )
    {
        goto Done;
    }

    //
    // Now encode the data into the caller's buffer
    //

    fResult = pstrResult->Base64Encode( EncryptedBlob.pbData,
                                        EncryptedBlob.cbData );

Done:

    if ( fResult == FALSE )
    {
        WriteDebug( "EncryptAndEncodeCredentials failed.  Error %d.\r\n",
                    GetLastError() );
    }

    //
    // Clean up data structures
    //

    if ( EncryptedBlob.pbData )
    {
        LocalFree( EncryptedBlob.pbData );
        EncryptedBlob.pbData = NULL;
        EncryptedBlob.cbData = 0;
    }

    //
    // Zero out our buffer that held the cooked credentials
    //

    strCookedCredentials.ZeroBuffer();

    return fResult;
}

BOOL WINAPI GetExtensionVersion ( HSE_VERSION_INFO * pVer )

Definition at line 107 of file CustomAuth.cpp.

       :

    Entry point for ISAPI extension initialization.  Required.

    This function will be called exactly once in the lifetime
    of the extension, at initialization time.  This function is
    a useful point to do complex initialization tasks.  This
    function is called outside of the system loader lock, so
    it does not have the same restrictions as DllMain.

Arguments:

    pVer - points to extension version info structure

Returns:

    TRUE on success, FALSE on failure.

    Note that in the case of FALSE, IIS will call GetLastError()
    and return an error page to the client.  The entity body of
    the page may be textual if the FormatMessage API can resolve
    it, or it may just be an error number if FormatMessage can't
    resolve it.

--*/
{
    //
    // Tell IIS which version of ISAPI this extension was built from.
    //

    pVer->dwExtensionVersion = MAKELONG( HSE_VERSION_MINOR,
                                         HSE_VERSION_MAJOR);

    //
    // Report the description string for this extension.  Ensure
    // that it does not exceed the maximum length and is NULL
    // terminated.
    //

    strncpy( pVer->lpszExtensionDesc,
             "CustomAuth ISAPI Sample",
             HSE_MAX_EXT_DLL_NAME_LEN );

    pVer->lpszExtensionDesc[HSE_MAX_EXT_DLL_NAME_LEN-1] = '\0';

    //
    // Return TRUE if we successfully initialized.
    //

    return TRUE;
}

BOOL GetUserInfoAndUpdateCookie | ( | ISAPI_STRING * | pstrCookie,
 |  | CHAR * | szClientIP,
 |  | HSE_EXEC_URL_USER_INFO * | pUserInfo,
 |  | ISAPI_STRING * | pstrUser
 | ) |  |

Definition at line 1065 of file CustomAuth.cpp.

       :

    Accepts a raw cookie header value from the client, extracts the
    username and password from it, and uses the resulting credentials
    to get a token and populate an HSE_EXEC_URL_USER_INFO structure.

    Upon return, pstrCookie will be modified to hold an updated cookie
    value, modified to reflect the current time.

Arguments:

    pstrCookie - The raw cookie value to process
    szClientIP - The IP address of the client
    pUserInfo  - The caller's HSE_EXEC_URL_USER_INFO to popluate
    pstrUser   - Upon return, contains the processed username

Returns:

    TRUE on success, FALSE on failure.

--*/
{
    ISAPI_STRING    strLastVisit;
    ISAPI_STRING    strCredentials;
    ISAPI_STRING    strPassword;
    ISAPI_STRING    strUpdatedCredentials;
    FILETIME        ftLastVisit;
    CHAR *          pCursor;
    CHAR *          pDelimiter;
    HANDLE          hToken = NULL;
    BOOL            fResult;

    //
    // Get the credentials from the cookie
    //

    pCursor = pstrCookie->FindStr( "customauth=", TRUE );

    if ( pCursor == NULL )
    {
        //
        // credentials not found
        //

        goto Failed;
    }

    pCursor += sizeof("customauth=") - 1;

    pDelimiter = strchr( pCursor, ';' );

    if ( pDelimiter != NULL )
    {
        if ( pDelimiter == pCursor )
        {
            //
            // Empty CustomAuth value
            //

            goto Failed;
        }

        fResult = strCredentials.Copy( pCursor, pDelimiter - pCursor );
    }
    else
    {
        if ( *pCursor == '\0' )
        {
            //
            // Empty CustomAuth value
            //

            goto Failed;
        }

        fResult = strCredentials.Copy( pCursor );
    }

    if ( !fResult )
    {
        goto Failed;
    }

    //
    // Decrypt them.
    //

    fResult = DecodeAndDecryptCredentials( strCredentials.QueryStr(),
                                           szClientIP,
                                           pstrUser,
                                           &strPassword,
                                           &ftLastVisit );

    if ( !fResult )
    {
        goto Failed;
    }

    //
    // If the last visit is older than the logon timeout period,
    // then fail.
    //

    if ( g_LogonTimeoutSeconds )
    {
        FILETIME    ftCurrent;

        if ( GetCurrentTimeAsFileTime( &ftCurrent ) == FALSE )
        {
            goto Failed;
        }

        if ( DiffFileTimeInSeconds( &ftLastVisit, &ftCurrent ) > (DWORD)g_LogonTimeoutSeconds )
        {
            SetLastError( ERROR_SEM_TIMEOUT );
            goto Failed;
        }
    }

    //
    // Update the cookie
    //

    if ( EncryptAndEncodeCredentials( pstrUser->QueryStr(),
                                      strPassword.QueryStr(),
                                      szClientIP,
                                      &strUpdatedCredentials ) == FALSE )
    {
        goto Failed;
    }

    if ( pstrCookie->Printf( "CustomAuth=%s; Path=/",
                             strUpdatedCredentials.QueryStr() ) == FALSE )
    {
        goto Failed;
    }

    //
    // Log on the user
    //

    fResult = LogonUser( pstrUser->QueryStr(),
                         NULL,
                         strPassword.QueryStr(),
                         g_LogonType,
                         LOGON32_PROVIDER_DEFAULT,
                         &hToken );

    //
    // Regardless of the result, we are done with the password
    //

    strPassword.ZeroBuffer();

    if ( !fResult )
    {
        goto Failed;
    }

    //
    // Populate the user info from the caller
    //

    pUserInfo->hImpersonationToken = hToken;
    pUserInfo->pszCustomUserName = pstrUser->QueryStr();
    pUserInfo->pszCustomAuthType = "CustomAuth";

    return TRUE;

Failed:

    WriteDebug( "GetUserInfoAndUpdateCookie failed.  Error %d.\r\n",
                GetLastError() );

    if ( hToken != NULL )
    {
        CloseHandle( hToken );
        hToken = NULL;
    }

    return FALSE;
}

VOID WINAPI HandleExecUrlCompletion | ( | EXTENSION_CONTROL_BLOCK * | pecb,
 |  | VOID * | pContext,
 |  | DWORD | cbIO,
 |  | DWORD | dwError
 | ) |  |

Definition at line 484 of file CustomAuth.cpp.

       :

    Handles completion of an asynchronous HSE_REQ_EXEC_URL
    call.  The pContext passed into this function is the
    token that was set in the HSE_EXEC_URL_USER_INFO
    structure that did the EXEC_URL.  This function needs
    to close that handle.

Arguments:

    pecb     - Pointer to the EXTENSION_CONTROL_BLOCK
    pContext - The completion context (token per above)
    cbIO     - I/O bytes associated with this completion
    dwError  - Error associated with this completion

Returns:

    None

--*/
{
    HSE_EXEC_URL_STATUS ExecUrlStatus;
    HANDLE              hToken = (HANDLE)pContext;

    //
    // The child is done.  Delete the entity buffer now.
    //

    if ( hToken )
    {
        CloseHandle( hToken );
        hToken = NULL;
    }

    //
    // Get the child's HTTP status and set it into the ECB
    //

    if ( pecb->ServerSupportFunction( pecb->ConnID,
                                      HSE_REQ_GET_EXEC_URL_STATUS,
                                      &ExecUrlStatus,
                                      NULL,
                                      NULL ) == TRUE )
    {
        pecb->dwHttpStatusCode = ExecUrlStatus.uHttpStatusCode;
    }

    //
    // Let IIS know that we are done with the
    // ECB and return.
    //

    pecb->ServerSupportFunction( pecb->ConnID,
                                 HSE_REQ_DONE_WITH_SESSION,
                                 NULL,
                                 NULL,
                                 NULL );

}

VOID WINAPI HandleSendPageCompletion | ( | EXTENSION_CONTROL_BLOCK * | pecb,
 |  | VOID * | pContext,
 |  | DWORD | cbIO,
 |  | DWORD | dwError
 | ) |  |

Definition at line 554 of file CustomAuth.cpp.

       :

    Handles completion of a send through AsyncTransmitBufferedResponse
    call.  The pContext passed into this function is the ISAPI_REQUEST
    object used.  We need to delete that object.  It's destructor will
    take care of doing HSE_REQ_DONE_WITH_SESSION as appropriate.

Arguments:

    pecb     - Pointer to the EXTENSION_CONTROL_BLOCK
    pContext - The completion context (ISAPI_REQUEST per above)
    cbIO     - I/O bytes associated with this completion
    dwError  - Error associated with this completion

Returns:

    None

--*/
{
    ISAPI_REQUEST * pRequest = (ISAPI_REQUEST*)pContext;

    //
    // Delete the request object.  Its destructor will
    // take care of doing the right DONE_WITH_SESSION stuff.
    //

    if ( pRequest )
    {
        delete pRequest;
        pRequest = NULL;
    }
}

DWORD WINAPI HttpExtensionProc ( EXTENSION_CONTROL_BLOCK * pecb )

Definition at line 166 of file CustomAuth.cpp.

       :

    Entry point for ISAPI requests.  Required.

    This function is called once per request.  The EXTENSION_CONTROL_BLOCK
    passed in contains information and function pointers sufficient to
    interact with the server during this processing.

    Note that, once HttpExtensionProc is called, it is the responsibility
    of the extension to send back any data that the client should receive.
    IIS will not automatically generate any response, even in the case of
    HSE_STATUS_ERROR once the request has progressed to the point where
    this function is called.

    Also note that you should not make any blocking calls or do long-running
    operations within this function.  To allow efficient scaling of your
    server, you should consider creating a pool of private threads to handle
    the requests.  In that case, the implementation of this function would
    be just to add the pecb to a queue and return HSE_STATUS_PENDING.  The
    threads in the pool would be responsible for dequeing a pecb and calling
    HSE_REQ_DONE_WITH_SESSION when they are finished processing it.

Arguments:

    pecb - pointer to the extenstion control block

Returns:

    HSE_STATUS_SUCCESS - Indicates successful request.
    HSE_STATUS_ERROR   - Indicates failed request.
    HSE_STATUS_PENDING - Indicates that processing of the request
                         should continue after this function returns.
                         It HSE_STATUS_PENDING is used, it is necessary
                         that HSE_REQ_DONE_WITH_SESSION is called
                         exactly once when processing is completed for
                         the request.

--*/
{
    HTTP_FILTER_CONTEXT *   pfc = NULL;
    HSE_EXEC_URL_INFO       ExecUrlInfo;
    HSE_EXEC_URL_USER_INFO  UserInfo = {0};
    ISAPI_REQUEST           Request( pecb );
    ISAPI_STRING            strUrl;
    ISAPI_STRING            strCookie;
    ISAPI_STRING            strClientIP;
    ISAPI_STRING            strUser;
    ISAPI_STRING            strFilterContext;
    ISAPI_STRING            strAuthType;
    HANDLE                  hToken = NULL;
    BOOL                    fModifiedUserInfo = FALSE;
    DWORD                   dwResult;
    BOOL                    fResult;

    //
    // Before doing anythine else, check to see if this request
    // has already been authenticated.  If so, just let the
    // request run.
    //

    fResult = Request.GetServerVariable( "AUTH_TYPE", &strAuthType );

    if ( !fResult )
    {
        goto Failed;
    }

    if ( *( strAuthType.QueryStr() ) != '\0' )
    {
        goto CallExecUrl;
    }

    //
    // Get the URL and check to see if it's one that we should
    // deal with.
    //

    fResult = Request.GetServerVariable( "URL", &strUrl );

    if ( !fResult )
    {
        goto Failed;
    }

    //
    // Logon request?
    //

    if ( stricmp( strUrl.QueryStr(), "/Logon" ) == 0 )
    {
        dwResult = ProcessLogon( pecb );

        if ( dwResult == HSE_STATUS_ERROR )
        {
            goto Failed;
        }

        return dwResult;
    }

    //
    // Logoff request?
    //

    if ( stricmp( strUrl.QueryStr(), "/Logoff" ) == 0 )
    {
        dwResult = ProcessLogoff( pecb );

        if ( dwResult == HSE_STATUS_ERROR )
        {
            goto Failed;
        }

        return dwResult;
    }

    //
    // Use built-in logon page?
    //

    if ( g_fUseBuiltInLogon == TRUE &&
         stricmp( strUrl.QueryStr(), g_strLogonUrl.QueryStr() ) == 0 )
    {
        dwResult = SendBuiltinLogonPage( pecb );

        if ( dwResult == HSE_STATUS_ERROR )
        {
            goto Failed;
        }

        return dwResult;
    }

    //
    // Check for a cookie and process it if found
    //

    fResult = Request.GetServerVariable( "HTTP_COOKIE",
                                         &strCookie );

    if ( fResult )
    {
        fResult = Request.GetServerVariable( "REMOTE_ADDR",
                                             &strClientIP );

        if ( !fResult )
        {
            goto Failed;
        }

        fResult = Request.UnimpersonateClient();

        if ( !fResult )
        {
            goto Failed;
        }

        fResult = GetUserInfoAndUpdateCookie( &strCookie,
                                              strClientIP.QueryStr(),
                                              &UserInfo,
                                              &strUser );

        Request.ImpersonateClient();

        //
        // If we didn't get any user info from the cookie, then
        // just allow the request through as anonymous.
        //

        if ( !fResult )
        {
            goto CallExecUrl;
        }

        //
        // Set the updated cookie back into the client.
        //
        // Note that this action has a bit of cleverness to it.
        // Since we are going to call a child URL, and not send
        // response headers directly, we can't just send the
        // response header as an extension normally would.  Instead,
        // since this dll has both a filter and extension component,
        // we are getting the HTTP_FILTER_CONTEXT for the request
        // from the filter via a custom request header (which the
        // client never sees), and using a filter function to add
        // our set-cookie header so that it will be included when
        // the response headers are sent, as if it were an IIS
        // built-in header
        //

        fResult = Request.GetServerVariable( "HTTP_CUSTOMAUTH_CONTEXT",
                                             &strFilterContext );

        if ( fResult )
        {
            pfc = (HTTP_FILTER_CONTEXT*)strtoul( strFilterContext.QueryStr(),
                                                 NULL,
                                                 16 );
        }

        if ( pfc )
        {
            ISAPI_STRING    strSetCookie;

            if ( strSetCookie.Printf( "Set-Cookie: %s\r\n",
                                      strCookie.QueryStr() ) == FALSE )
            {
                goto Failed;
            }

            if ( pfc->AddResponseHeaders( pfc,
                                          strSetCookie.QueryStr(),
                                          0 ) == FALSE )
            {
                goto Failed;
            }
        }

        fModifiedUserInfo = TRUE;
    }

    //
    // Fall through
    //

CallExecUrl:

    //
    // Use EXEC_URL to pass the request along
    //
    // We will pass NULL for all of the parts of the request
    // that we don't want to modify.
    //
    // We will also use the HSE_EXEC_URL_IGNORE_CURRENT_INTERCEPTOR
    // flag.  This will ensure that this extension is not called again
    // on this request (which could otherwise happen in some cases).
    //

    ExecUrlInfo.pszUrl = NULL;
    ExecUrlInfo.pszMethod = NULL;
    ExecUrlInfo.pszChildHeaders = NULL;
    ExecUrlInfo.pUserInfo = NULL;
    ExecUrlInfo.pEntity = NULL;
    ExecUrlInfo.dwExecUrlFlags = HSE_EXEC_URL_IGNORE_CURRENT_INTERCEPTOR;

    if ( fModifiedUserInfo )
    {
        ExecUrlInfo.pUserInfo = &UserInfo;
    }

    //
    // Associate the completion routine and the current URL with
    // this request.
    //

    if ( pecb->ServerSupportFunction( pecb->ConnID,
                                      HSE_REQ_IO_COMPLETION,
                                      HandleExecUrlCompletion,
                                      NULL,
                                      (DWORD*)UserInfo.hImpersonationToken ) == FALSE )
    {
        goto Failed;
    }

    //
    // Call ExecUrl
    //

    if ( pecb->ServerSupportFunction( pecb->ConnID,
                                      HSE_REQ_EXEC_URL,
                                      &ExecUrlInfo,
                                      NULL,
                                      NULL ) == FALSE )
    {
        goto Failed;
    }

    //
    // Since EXEC_URL is asynchonous, we need to return STATUS_PENDING.
    // The I/O completion routine will clean up.
    //

    return HSE_STATUS_PENDING;

Failed:

    WriteDebug( "HttpExtensionProc failed.  Error %d.\r\n",
                GetLastError() );

    //
    // If we've already got a token, close it now.
    //

    if ( UserInfo.hImpersonationToken )
    {
        CloseHandle( UserInfo.hImpersonationToken );
        UserInfo.hImpersonationToken = NULL;
    }

    //
    // Send a 500 error
    //

    Request.SyncWriteCompleteResponse( "500 Server Error",
                                       "Content-Type: text/html\r\n\r\n",
                                       SERVER_ERROR );

    return HSE_STATUS_ERROR;

}

DWORD ProcessLogoff ( EXTENSION_CONTROL_BLOCK * pecb )

Definition at line 865 of file CustomAuth.cpp.

{
    ISAPI_REQUEST * pRequest;

    pRequest = new ISAPI_REQUEST( pecb );

    if ( !pRequest )
    {
        goto Failed;
    }

    //
    // Build the response.  If we are supposed to use the built-in
    // logoff page, then we'll send it directly.  Otherwise, the
    // response will be a 302 to the configured page.
    //

    if ( g_fUseBuiltInLogoff == TRUE )
    {
        if ( pRequest->SetBufferedResponseStatus( "200 OK" ) ==  FALSE )
        {
            goto Failed;
        }

        if ( pRequest->AddHeaderToBufferedResponse( "Expires",
                                                    "0" ) == FALSE )
        {
            goto Failed;
        }

        if ( pRequest->AddDataToResponseBuffer( LOGOFF_PAGE,
                                                sizeof(LOGOFF_PAGE) - 1 ) == FALSE )
        {
            goto Failed;
        }
    }
    else
    {
        if ( pRequest->SetBufferedResponseStatus( "302 Object Moved" ) ==  FALSE )
        {
            goto Failed;
        }

        if ( pRequest->AddHeaderToBufferedResponse( "Location",
                                                    g_strLogoffUrl.QueryStr() ) == FALSE )
        {
            goto Failed;
        }

        if ( pRequest->PrintfToResponseBuffer( REDIRECT_ENTITY,
                                               g_strLogoffUrl ) == FALSE )
        {
            goto Failed;
        }
    }

    //
    // Add a set-cookie header to remove the credentials
    //

    if ( pRequest->AddHeaderToBufferedResponse( "Set-Cookie",
                                                DELETE_COOKIE ) == FALSE )
    {
        goto Failed;
    }

    //
    // Send the response
    //

    if ( pRequest->AsyncTransmitBufferedResponse( HandleSendPageCompletion ) == TRUE )
    {
        //
        // On success, we need to return HSE_STATUS_PENDING
        //

        return HSE_STATUS_PENDING;
    }

    //
    // Fall through to error handler
    //

Failed:

    WriteDebug( "ProcessLogoff failed.  Error %d.\r\n",
                GetLastError() );

    if ( pRequest )
    {
        delete pRequest;
        pRequest = NULL;
    }

    return HSE_STATUS_ERROR;
}

DWORD ProcessLogon ( EXTENSION_CONTROL_BLOCK * pecb )

Definition at line 597 of file CustomAuth.cpp.

       :

    Handles logon requests by reading the entity body, parsing
    it for username and password information, creating a
    cookie to store them on the client (encrypted and base64
    encoded), and sending a 302 redirect to the configured
    logon success URL.

    This send is done asynchronously.

Arguments:

    pecb     - Pointer to the EXTENSION_CONTROL_BLOCK

Returns:

    HSE_STATUS_PENDING on success, or HSE_STATUS_ERROR
    on failure.

--*/
{
    ISAPI_REQUEST * pRequest;
    ISAPI_STRING    strClientIP;
    ISAPI_STRING    strCredentials;
    ISAPI_STRING    strSetCookie;
    ISAPI_STRING    strUser;
    ISAPI_STRING    strPassword;
    ISAPI_STRING    strEntity;
    ISAPI_BUFFER    Entity;
    CHAR *          pCursor;
    CHAR *          pDelimiter;
    BOOL            fResult;

    pRequest = new ISAPI_REQUEST( pecb );

    if ( !pRequest )
    {
        goto Failed;
    }

    //
    // Get the entity body for this request and store
    // it in an ISAPI_STRING
    //

    if ( pRequest->ReadAllEntity( &Entity ) == FALSE )
    {
        goto Failed;
    }

    if ( strEntity.Copy( (CHAR*)Entity.QueryPtr(),
                         Entity.QueryDataSize() ) == FALSE )
    {
        goto Failed;
    }

    //
    // Parse the username out of the entity
    //

    pCursor = strEntity.FindStr( "username=", TRUE );

    if ( !pCursor )
    {
        SetLastError( ERROR_INVALID_DATA );
        goto Failed;
    }

    pCursor += sizeof("username=") - 1;

    pDelimiter = strchr( pCursor, '&' );

    if ( pDelimiter )
    {
        fResult = strUser.Copy( pCursor, pDelimiter - pCursor );
    }
    else
    {
        fResult = strUser.Copy( pCursor );
    }

    if ( !fResult )
    {
        goto Failed;
    }

    strUser.Unescape();

    //
    // Parse the password  out of the entity
    //

    pCursor = strEntity.FindStr( "password=", TRUE );

    if ( !pCursor )
    {
        SetLastError( ERROR_INVALID_DATA );
        goto Failed;
    }

    pCursor += sizeof("password=") - 1;

    pDelimiter = strchr( pCursor, '&' );

    if ( pDelimiter )
    {
        fResult = strPassword.Copy( pCursor, pDelimiter - pCursor );
    }
    else
    {
        fResult = strPassword.Copy( pCursor );
    }

    if ( !fResult )
    {
        goto Failed;
    }

    strPassword.Unescape();

    //
    // Get the IP address of the client.  This will be passed to the
    // encryption routine so that the resulting encrypted blob can
    // only be decrypted on a request from the same client.
    //

    if ( pRequest->GetServerVariable( "REMOTE_ADDR",
                                      &strClientIP ) == FALSE )
    {
        goto Failed;
    }

    //
    // Get the encrypted credentials and build a
    // set-cookie header with them
    //
    // Temporarily stop impersonating the client while
    // calling the encryption code.
    //

    if ( pRequest->UnimpersonateClient() == FALSE )
    {
        goto Failed;
    }

    fResult = EncryptAndEncodeCredentials( strUser.QueryStr(),
                                           strPassword.QueryStr(),
                                           strClientIP.QueryStr(),
                                           &strCredentials );

    pRequest->ImpersonateClient();

    if ( !fResult )
    {
        goto Failed;
    }

    if ( strSetCookie.Printf( "CustomAuth=%s; Path=/",
                              strCredentials.QueryStr() ) == FALSE )
    {
        goto Failed;
    }

    //
    // Set the status for the response, which will be a redirect
    // to the logon success URL.
    //

    if ( pRequest->SetBufferedResponseStatus( "302 Object Moved" ) == FALSE )
    {
        goto Failed;
    }

    //
    // Add the set-cookie with the credentials
    //

    if ( pRequest->AddHeaderToBufferedResponse( "Set-Cookie",
                                                strSetCookie.QueryStr() ) == FALSE )
    {
        goto Failed;
    }

    //
    // Add the location header
    //

    if ( pRequest->AddHeaderToBufferedResponse( "Location",
                                                g_strLogonSuccessUrl.QueryStr() ) == FALSE )
    {
        goto Failed;
    }

    //
    // Add "Expires: 0" so that the client doesn't cache this page.
    //

    if ( pRequest->AddHeaderToBufferedResponse( "Expires",
                                                "0" ) == FALSE )
    {
        goto Failed;
    }

    //
    // Add the entity for the page
    //

    if ( pRequest->PrintfToResponseBuffer( REDIRECT_ENTITY,
                                           g_strLogonSuccessUrl.QueryStr() ) == FALSE )
    {
        goto Failed;
    }

    //
    // Zero out any buffers that contain unencrypted password
    // information
    //

    Entity.ZeroBuffer();
    strEntity.ZeroBuffer();
    strPassword.ZeroBuffer();

    //
    // Send the request asynchronously
    //

    if ( pRequest->AsyncTransmitBufferedResponse( HandleSendPageCompletion ) == TRUE )
    {
        //
        // On success, we need to immediately return status pending
        //

        return HSE_STATUS_PENDING;
    }

    //
    // Fall through to error handler
    //

Failed:

    WriteDebug( "ProcessLogon failed.  Error %d\r\n",
                GetLastError() );

    //
    // Zero out any buffers that contain unencrypted password
    // information
    //

    Entity.ZeroBuffer();
    strEntity.ZeroBuffer();
    strPassword.ZeroBuffer();

    if ( pRequest )
    {
        delete pRequest;
        pRequest = NULL;
    }

    return HSE_STATUS_ERROR;
}

DWORD SendBuiltinLogonPage ( EXTENSION_CONTROL_BLOCK * pecb )

Definition at line 965 of file CustomAuth.cpp.

       :

    If we are configured to send back the built-in logon
    page (instead of using a user-provided custom page),
    this function does the work.

Arguments:

    pecb     - Pointer to the EXTENSION_CONTROL_BLOCK

Returns:

    HSE_STATUS_PENDING on success, or HSE_STATUS_ERROR
    on failure.

--*/
{
    ISAPI_REQUEST * pRequest;
    ISAPI_STRING    strServerName;
    ISAPI_STRING    strHttps;

    pRequest = new ISAPI_REQUEST( pecb );

    if ( !pRequest )
    {
        goto Failed;
    }

    //
    // Set the status for the response
    //

    if ( pRequest->SetBufferedResponseStatus( "200 OK" ) == FALSE )
    {
        goto Failed;
    }

    //
    // Set the entity body for the response
    //

    strHttps.ZeroBuffer();

    if ( g_fUseSSLForSubmission )
    {
        if ( pRequest->GetServerVariable( "SERVER_NAME",
                                          &strServerName ) == FALSE )
        {
            goto Failed;
        }

        if ( strHttps.Printf( "https://%s", strServerName.QueryStr() ) == FALSE )
        {
            goto Failed;
        }
    }

    if ( pRequest->PrintfToResponseBuffer( LOGON_PAGE,
                                           strHttps.QueryStr() ) == FALSE )
    {
        goto Failed;
    }

    //
    // Now send the page asynchronously
    //

    if ( pRequest->AsyncTransmitBufferedResponse( HandleSendPageCompletion ) == TRUE )
    {
        //
        // On success, we should return status pending immediately.
        //

        return HSE_STATUS_PENDING;
    }

    //
    // Fall through to error handler
    //

Failed:

    WriteDebug( "SendBuiltinLogonPage failed.  Error %d.\r\n",
                GetLastError() );

    if ( pRequest )
    {
        delete pRequest;
        pRequest = NULL;
    }

    return HSE_STATUS_ERROR;
}

Variable Documentation

ISAPI_EXTENSION g_Extension

Definition at line 27 of file CustomAuth.cpp.

BOOL g_fFilterInitialized

Definition at line 33 of file CustomAuth.cpp.

BOOL g_fUseBuiltInLogoff

Definition at line 35 of file CustomAuth.cpp.

BOOL g_fUseBuiltInLogon

Definition at line 34 of file CustomAuth.cpp.

BOOL g_fUseClientIpForEncryption

Definition at line 37 of file CustomAuth.cpp.

BOOL g_fUseSSLForSubmission

Definition at line 36 of file CustomAuth.cpp.

INT g_LogonTimeoutSeconds

Definition at line 32 of file CustomAuth.cpp.

DWORD g_LogonType

Definition at line 38 of file CustomAuth.cpp.

ISAPI_STRING g_strIniFile

Definition at line 28 of file CustomAuth.cpp.

ISAPI_STRING g_strLogoffUrl

Definition at line 31 of file CustomAuth.cpp.

ISAPI_STRING g_strLogonSuccessUrl

Definition at line 30 of file CustomAuth.cpp.

ISAPI_STRING g_strLogonUrl

Definition at line 29 of file CustomAuth.cpp.

Generated on Wed Nov 13 2024 16:54:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/ISAPI_6.0/CustomAuth/CustomAuth.h File Reference

  • Web
  • iis
  • ISAPI_6.0
  • CustomAuth
Defines | Variables

CustomAuth.h File Reference

Go to the source code of this file.

Defines

#define | DEFAULT_LOGOFF_URL "/Logoff.htm"
#define | DEFAULT_LOGON_SUCCESS_URL "/"
#define | DEFAULT_LOGON_TIMEOUT 1200
#define | DEFAULT_LOGON_TYPE "network_cleartext"
#define | DEFAULT_LOGON_URL "/Logon.htm"
#define | DEFAULT_USE_BUILTIN_LOGOFF 1
#define | DEFAULT_USE_BUILTIN_LOGON 1
#define | DEFAULT_USE_CLIENT_IP 1
#define | DEFAULT_USE_SSL 0
#define | DELETE_COOKIE "CustomAuth=; Path=/; Expires=Tue, 01 Jan 1980 00:01:00 GMT"
#define | LOGOFF_PAGE
#define | LOGON_PAGE
#define | MODULE_NAME "CustomAuth"
#define | REDIRECT_ENTITY
#define | SERVER_ERROR

Variables

ISAPI_EXTENSION g_Extension
BOOL g_fFilterInitialized
BOOL g_fUseBuiltInLogoff
BOOL g_fUseBuiltInLogon
BOOL g_fUseClientIpForEncryption
BOOL g_fUseSSLForSubmission
INT | g_LogonTimeoutSeconds
DWORD g_LogonType
ISAPI_STRING g_strIniFile
ISAPI_STRING g_strLogoffUrl
ISAPI_STRING g_strLogonSuccessUrl
ISAPI_STRING g_strLogonUrl

Define Documentation

#define DEFAULT_LOGOFF_URL "/Logoff.htm"

Definition at line 28 of file CustomAuth.h.

#define DEFAULT_LOGON_SUCCESS_URL "/"

Definition at line 29 of file CustomAuth.h.

#define DEFAULT_LOGON_TIMEOUT 1200

Definition at line 30 of file CustomAuth.h.

#define DEFAULT_LOGON_TYPE "network_cleartext"

Definition at line 31 of file CustomAuth.h.

#define DEFAULT_LOGON_URL "/Logon.htm"

Definition at line 27 of file CustomAuth.h.

#define DEFAULT_USE_BUILTIN_LOGOFF 1

Definition at line 24 of file CustomAuth.h.

#define DEFAULT_USE_BUILTIN_LOGON 1

Definition at line 23 of file CustomAuth.h.

#define DEFAULT_USE_CLIENT_IP 1

Definition at line 26 of file CustomAuth.h.

#define DEFAULT_USE_SSL 0

Definition at line 25 of file CustomAuth.h.

#define DELETE_COOKIE "CustomAuth=; Path=/; Expires=Tue, 01 Jan 1980 00:01:00 GMT"

Definition at line 32 of file CustomAuth.h.

#define LOGOFF_PAGE
Value:
"<html>\r\n"                                              \
    "<head><title>Successfully Logged Off</title></head>\r\n" \
    "<h1> Goodbye </h1>\r\n"                                  \
    "<hr>\r\n"                                                \
    "You have successfully logged off from this server\r\n"   \
    "</html>\r\n"

Definition at line 66 of file CustomAuth.h.

#define LOGON_PAGE
Value:
"<html>\r\n"                                                        \
    "<head><title>Please Log On</title></head>\r\n"                     \
    "<h1> Please log on to this server. </h1>\r\n"                      \
    "<hr>\r\n"                                                          \
    "<form name=\"LogonForm\" action=\"%s/Logon\" method=\"POST\">\r\n" \
    "<table border=0 cellspacing=2 cellpadding=0>\r\n"                  \
    "  <tr>\r\n"                                                        \
    "    <td>User Name:</td>\r\n"                                       \
    "    <td><input type=text size=30 name=UserName></td>\r\n"          \
    "  </tr>\r\n"                                                       \
    "  <tr>\r\n"                                                        \
    "    <td>Password:</td>\r\n"                                        \
    "    <td><input type=password size=30 name=Password></td>\r\n"      \
    "  </tr>\r\n"                                                       \
    "</table>\r\n"                                                      \
    "<input type=submit value=\"Log On\">\r\n"                          \
    "</form>\r\n"                                                       \
    "</html>\r\n"

Definition at line 46 of file CustomAuth.h.

#define MODULE_NAME "CustomAuth"

Definition at line 22 of file CustomAuth.h.

#define REDIRECT_ENTITY
Value:
"<head><title>Document Moved</title></head>\r\n" \
    "<body><h1>Object Moved</h1>This document may "  \
    "be found <a HREF=\"%s\">here</a></body>"

Definition at line 74 of file CustomAuth.h.

#define SERVER_ERROR
Value:
"<html>\r\n"                                         \
    "<head> <title>500 Server Error</title> </head>\r\n" \
    "<h1> Server Error </h1>\r\n"                        \
    "<hr>\r\n"                                           \
    "The server was unable to process your request.\r\n" \
    "</html>"

Definition at line 38 of file CustomAuth.h.

Variable Documentation

ISAPI_EXTENSION g_Extension

Definition at line 97 of file CacheIsapi.cpp.

BOOL g_fFilterInitialized

Definition at line 33 of file CustomAuth.cpp.

BOOL g_fUseBuiltInLogoff

Definition at line 35 of file CustomAuth.cpp.

BOOL g_fUseBuiltInLogon

Definition at line 34 of file CustomAuth.cpp.

BOOL g_fUseClientIpForEncryption

Definition at line 37 of file CustomAuth.cpp.

BOOL g_fUseSSLForSubmission

Definition at line 36 of file CustomAuth.cpp.

INT g_LogonTimeoutSeconds

Definition at line 32 of file CustomAuth.cpp.

DWORD g_LogonType

Definition at line 38 of file CustomAuth.cpp.

ISAPI_STRING g_strIniFile

Definition at line 28 of file CustomAuth.cpp.

ISAPI_STRING g_strLogoffUrl

Definition at line 31 of file CustomAuth.cpp.

ISAPI_STRING g_strLogonSuccessUrl

Definition at line 30 of file CustomAuth.cpp.

ISAPI_STRING g_strLogonUrl

Definition at line 29 of file CustomAuth.cpp.

Generated on Wed Nov 13 2024 16:54:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/ISAPI_6.0/CustomAuth/Redir401.cpp File Reference

  • Web
  • iis
  • ISAPI_6.0
  • CustomAuth
Defines | Enumerations | Functions | Variables

Redir401.cpp File Reference

#include <stdio.h>
#include <windows.h>
#include <httpfilt.h>
#include <IsapiTools.h>
#include "CustomAuth.h"

Go to the source code of this file.

Defines

#define | _WIN32_WINNT 0x500
#define | MAX_CONFIG_LINE 1024

Enumerations

enum | FILTER_STATE { IgnoreNotification = 0, ReplaceDataWithRedirectBlob, SuppressData }

Functions

DWORD | DoEndOfRequest (HTTP_FILTER_CONTEXT *pfc)
DWORD | DoPreprocHeaders (HTTP_FILTER_CONTEXT *pfc, HTTP_FILTER_PREPROC_HEADERS *pPreproc)
DWORD | DoSendRawData (HTTP_FILTER_CONTEXT *pfc, HTTP_FILTER_RAW_DATA *pRawData)
DWORD | DoSendResponse (HTTP_FILTER_CONTEXT *pfc, HTTP_FILTER_SEND_RESPONSE *pSendResponse)
BOOL WINAPI | GetFilterVersion (PHTTP_FILTER_VERSION pVer)
INT | GetIntFromConfig (CHAR *szKey, INT nDefault)
BOOL | GetStringFromConfig (CHAR *szKey, CHAR *szDefault, ISAPI_STRING *pstrString)
DWORD WINAPI | HttpFilterProc (PHTTP_FILTER_CONTEXT pfc, DWORD dwNotificationType, LPVOID pvNotification)
BOOL | LoadModuleConfig (VOID)
VOID | TrimCommentAndTrailingWhitespace (CHAR *szString)

Variables

ISAPI_STRING g_strRedirectResponse

Define Documentation

#define _WIN32_WINNT 0x500

Definition at line 25 of file Redir401.cpp.

#define MAX_CONFIG_LINE 1024

Definition at line 34 of file Redir401.cpp.

Enumeration Type Documentation

enum FILTER_STATE
Enumerator:
IgnoreNotification
ReplaceDataWithRedirectBlob
SuppressData

Definition at line 42 of file Redir401.cpp.

{
    IgnoreNotification = 0,
    ReplaceDataWithRedirectBlob,
    SuppressData
};

Function Documentation

DWORD DoEndOfRequest ( HTTP_FILTER_CONTEXT * pfc )

Definition at line 453 of file Redir401.cpp.

       :

    Handles SF_NOTIFY_END_OF_REQUEST

    Resets the filter state for subsequent requests over
    this same client connection.

Arguments:

    pfc      - A pointer to the filter context for this notification

Returns:

    SF_STATUS_REQ_NEXT_NOTIFICATION

--*/
{
    DWORD   status = SF_STATUS_REQ_NEXT_NOTIFICATION;

    //
    // Reset the filter state
    //

    pfc->pFilterContext = (VOID*)IgnoreNotification;

    return status;
}

DWORD DoPreprocHeaders | ( | HTTP_FILTER_CONTEXT * | pfc,
 |  | HTTP_FILTER_PREPROC_HEADERS * | pPreproc
 | ) |  |

Definition at line 242 of file Redir401.cpp.

{
    ISAPI_STRING    strPFC;
    DWORD           status = SF_STATUS_REQ_NEXT_NOTIFICATION;

    //
    // Initialize the filter state for this request
    //

    pfc->pFilterContext = (VOID*)IgnoreNotification;

    //
    // We are going to store a string version of pfc in
    // a custom request header.  This will allow the extension
    // part of this dll to call AddResponseHeaders.
    //
    // First, ensure that our string is big enough to store 8
    // characters, plus terminator.
    //

    if ( strPFC.ResizeBuffer( 9 ) == FALSE )
    {
        goto Failed;
    }

    //
    // Add a CustomAuth-Context header with a string
    // version of pfc.
    //

    _snprintf( strPFC.QueryStr(),
               strPFC.QueryBufferSize() - 1,
               "%08x",
               pfc );

    if ( pPreproc->AddHeader( pfc,
                              "CustomAuth-Context:",
                              strPFC.QueryStr() ) == FALSE )
    {
        goto Failed;
    }

    return status;

Failed:

    WriteDebug( "DoPreprocHeaders failed.  Error %d\r\n",
                GetLastError() );

    return SF_STATUS_REQ_ERROR;
}

DWORD DoSendRawData | ( | HTTP_FILTER_CONTEXT * | pfc,
 |  | HTTP_FILTER_RAW_DATA * | pRawData
 | ) |  |

Definition at line 387 of file Redir401.cpp.

       :

    Handles SF_NOTIFY_SEND_RAW_DATA.

    Replaces the raw data going to the client with the redirect
    response data, or suppresses the data as directed by the
    request state.

Arguments:

    pfc      - A pointer to the filter context for this notification
    pRawData - The HTTP_FILTER_RAW_DATA structure

Returns:

    SF_STATUS_REQ_NEXT_NOTIFICATION

--*/
{
    FILTER_STATE    state = (FILTER_STATE)((DWORD)pfc->pFilterContext);
    DWORD           status = SF_STATUS_REQ_NEXT_NOTIFICATION;

    //
    // Do the right thing for the current state
    //

    switch ( state )
    {
    case IgnoreNotification:

        goto Done;

    case ReplaceDataWithRedirectBlob:

        pRawData->pvInData = g_strRedirectResponse.QueryStr();
        pRawData->cbInBuffer = g_strRedirectResponse.QueryBufferSize();
        pRawData->cbInData = g_strRedirectResponse.QueryCB();

        //
        // Set the state to suppress data, so any further notifications
        // on this response won't reach the client.
        //

        pfc->pFilterContext = (VOID*)SuppressData;

        goto Done;

    case SuppressData:

        pRawData->cbInData = 0;

        goto Done;
    }

Done:

    return status;
}

DWORD DoSendResponse | ( | HTTP_FILTER_CONTEXT * | pfc,
 |  | HTTP_FILTER_SEND_RESPONSE * | pSendResponse
 | ) |  |

Definition at line 298 of file Redir401.cpp.

       :

    Handles SF_NOTIFY_SEND_RESPONSE.

    If we detect that we are sending a 401 response, and that
    no built-in authentication schemes are in use for this request,
    we will set the filter context to replace the 401 with a
    302 redirect to the logon page.

    If this is not a 401 response, we will disable further
    notifications for this request for performance reasons.

Arguments:

    pfc           - A pointer to the filter context for this notification
    pSendResponse - The HTTP_FILTER_SEND_RESPONSE structure

Returns:

    SF_STATUS_REQ_NEXT_NOTIFICATION on success
    SF_STATUS_REQ_ERROR on failure

--*/
{
    CHAR    szWwwAuthenticate[256];
    DWORD   status = SF_STATUS_REQ_NEXT_NOTIFICATION;
    DWORD   cbWwwAuthenticate;
    BOOL    fResult;

    //
    // We care about 401 responses.  If this is not a
    // 401, then we should disable further notifications.
    //

    if ( pSendResponse->HttpStatus != 401 )
    {
        goto DisableFurtherNotifications;
    }

    //
    // Do one more check.  If this request has any www-authenticate
    // response headers, then we know that one or more authentication
    // schemes are supported.  In this case, we'll defer to the
    // built-in authentication schemes.
    //

    cbWwwAuthenticate = 256;

    fResult =  pSendResponse->GetHeader( pfc,
                                         "WWW-AUTHENTICATE:",
                                         szWwwAuthenticate,
                                         &cbWwwAuthenticate );

    if ( fResult == TRUE ||
         GetLastError() != ERROR_INVALID_INDEX )
    {
        goto DisableFurtherNotifications;
    }

    //
    // Set the filter state such that the send raw
    // handler replaces the first packet with the
    // redirect blob.
    //

    pfc->pFilterContext = (VOID*)ReplaceDataWithRedirectBlob;

    return status;

DisableFurtherNotifications:

    pfc->ServerSupportFunction( pfc,
                                SF_REQ_DISABLE_NOTIFICATIONS,
                                NULL,
                                SF_NOTIFY_SEND_RAW_DATA |
                                SF_NOTIFY_END_OF_REQUEST,
                                0 );

    return status;
}

BOOL WINAPI GetFilterVersion ( PHTTP_FILTER_VERSION pVer )

Definition at line 99 of file Redir401.cpp.

       :

    Required entry point for ISAPI filters.  This function
    is called when the server initially loads this DLL.

Arguments:

    pVer - Points to the filter version info structure

Returns:

    TRUE on successful initialization
    FALSE on initialization failure

--*/
{
  pVer->dwFilterVersion = HTTP_FILTER_REVISION;
  lstrcpy(pVer->lpszFilterDesc, "Redir401 ISAPI Filter");
  pVer->dwFlags =
    SF_NOTIFY_ORDER_DEFAULT |
        SF_NOTIFY_PREPROC_HEADERS |
        SF_NOTIFY_SEND_RESPONSE |
        SF_NOTIFY_SEND_RAW_DATA
    ;

    //
    // Initialize IsapiTools
    //

    InitializeIsapiTools( MODULE_NAME );

    //
    // Initialize the global extension object.
    //
    // Normally, this would occur in GetExtensionVersion on
    // an extension, but since we want access to the data
    // here as well and the filter part is guaranteed to
    // be called before the extension, we'll do it here.
    //

    if ( g_Extension.Initialize( MODULE_NAME ) == FALSE )
    {
        goto Failed;
    }

    //
    // Get the config filename
    //

    if ( g_strIniFile.Printf( "%s\\%s.ini",
                              g_Extension.QueryModulePath(),
                              MODULE_NAME ) == FALSE )
    {
        goto Failed;
    }

    //
    // Read the config data
    //

    if ( LoadModuleConfig() == FALSE )
    {
        goto Failed;
    }

    g_fFilterInitialized = TRUE;

  return TRUE;

Failed:

    return FALSE;
}

INT GetIntFromConfig | ( | CHAR * | szKey,
 |  | INT | nDefault
 | ) |  |

Definition at line 702 of file Redir401.cpp.

       :

    Gets an integer value from the ini file

Arguments:

    szKey    - The key to retrieve (from the [Options] section)
    nDefault - Default value to use if the key is not found

Returns:

    The requested value, or the default if it wasn't found

--*/
{
    return GetPrivateProfileInt( "Options",
                                 szKey,
                                 nDefault,
                                 g_strIniFile.QueryStr() );
}

BOOL GetStringFromConfig | ( | CHAR * | szKey,
 |  | CHAR * | szDefault,
 |  | ISAPI_STRING * | pstrString
 | ) |  |

Definition at line 645 of file Redir401.cpp.

       :

    Gets a string from the ini file

Arguments:

    szKey      - The key to retrieve (from the [Options] section)
    szDefault  - Default value to use if the key is not found
    pstrString - On successful return, contains the value

Returns:

    TRUE on success, FALSE on failure

--*/
{
    CHAR    szValue[MAX_CONFIG_LINE];
    BOOL    fResult;

    GetPrivateProfileString( "Options",
                             szKey,
                             "",
                             szValue,
                             MAX_CONFIG_LINE,
                             g_strIniFile.QueryStr() );

    TrimCommentAndTrailingWhitespace( szValue );

    if ( szValue[0] == '\0' )
    {
        WriteDebug( "GetStringFromConfig returning default value for %s.\r\n",
                    szDefault );

        fResult = pstrString->Copy( szDefault );
    }
    else
    {
        fResult = pstrString->Copy( szValue );
    }

    if ( !fResult )
    {
        WriteDebug( "GetStringFromConfig failed.  Error %d.\r\n",
                    GetLastError() );
    }

    return fResult;
}

DWORD WINAPI HttpFilterProc | ( | PHTTP_FILTER_CONTEXT | pfc,
 |  | DWORD | dwNotificationType,
 |  | LPVOID | pvNotification
 | ) |  |

Definition at line 178 of file Redir401.cpp.

       :

    Required filter notification entry point.  This function is called
    whenever one of the events (as registered in GetFilterVersion) occurs.

Arguments:

    pfc              - A pointer to the filter context for this notification
    NotificationType - The type of notification
    pvNotification   - A pointer to the notification data

Returns:

    One of the following valid filter return codes:
    - SF_STATUS_REQ_FINISHED
    - SF_STATUS_REQ_FINISHED_KEEP_CONN
    - SF_STATUS_REQ_NEXT_NOTIFICATION
    - SF_STATUS_REQ_HANDLED_NOTIFICATION
    - SF_STATUS_REQ_ERROR
    - SF_STATUS_REQ_READ_NEXT

--*/
{
    DWORD   status = SF_STATUS_REQ_NEXT_NOTIFICATION;

    //
    // Route the notification to the proper handler function
    //

    switch ( dwNotificationType )
    {
    case SF_NOTIFY_PREPROC_HEADERS:

        status = DoPreprocHeaders( pfc,
                                   (HTTP_FILTER_PREPROC_HEADERS*)pvNotification );

        break;

    case SF_NOTIFY_SEND_RESPONSE:

        status = DoSendResponse( pfc,
                                 (HTTP_FILTER_SEND_RESPONSE*)pvNotification );

        break;

    case SF_NOTIFY_SEND_RAW_DATA:

        status = DoSendRawData( pfc,
                                (HTTP_FILTER_RAW_DATA*)pvNotification );

        break;
    }

    return status;
}

BOOL LoadModuleConfig ( VOID )

Definition at line 487 of file Redir401.cpp.

       :

    Loads the configuration for this ISAPI from
    the ini file.

Arguments:

    None

Returns:

    TRUE on success, FALSE on failure

--*/
{
    ISAPI_STRING    strLogonType;
    INT             nFlag;

    //
    // Get LogonUrl as a string
    //

    if ( GetStringFromConfig( "LogonUrl",
                              DEFAULT_LOGON_URL,
                              &g_strLogonUrl ) == FALSE )
    {
        goto Failed;
    }

    //
    // Get LogoffUrl as a string
    //

    if ( GetStringFromConfig( "LogoffUrl",
                              DEFAULT_LOGON_URL,
                              &g_strLogoffUrl ) == FALSE )
    {
        goto Failed;
    }

    //
    // Get UseBuiltInLogonPage as a boolean
    //

    nFlag = GetIntFromConfig( "UseBuiltInLogonPage",
                              DEFAULT_USE_BUILTIN_LOGON );

    g_fUseBuiltInLogon = ( nFlag != 0 );

    //
    // Get UseBuiltInLogoffPage as a boolean
    //

    nFlag = GetIntFromConfig( "UseBuiltInLogoffPage",
                              DEFAULT_USE_BUILTIN_LOGOFF );

    g_fUseBuiltInLogoff = ( nFlag != 0 );

    //
    // Get UseSSLForFormSubmission as a boolean
    //

    nFlag = GetIntFromConfig( "UseSSLForFormSubmission",
                              DEFAULT_USE_SSL );

    g_fUseSSLForSubmission = ( nFlag != 0 );

    //
    // Get UseClientIpForEncryption as a boolean
    //

    nFlag = GetIntFromConfig( "UseClientIpForEncryption",
                              DEFAULT_USE_CLIENT_IP );

    g_fUseClientIpForEncryption = ( nFlag != 0 );

    //
    // Get LogonTimeout as an int
    //

    g_LogonTimeoutSeconds = GetIntFromConfig( "LogonTimeout",
                                              DEFAULT_LOGON_TIMEOUT );

    //
    // Get LogonSuccessUrl as a string
    //

    if ( GetStringFromConfig( "LogonSuccessUrl",
                              DEFAULT_LOGON_SUCCESS_URL,
                              &g_strLogonSuccessUrl ) == FALSE )
    {
        goto Failed;
    }

    //
    // Get LogonType as a string, and resolve it to a LOGON32_LOGON value
    //

    if ( GetStringFromConfig( "LogonType",
                              DEFAULT_LOGON_TYPE,
                              &strLogonType ) == FALSE )
    {
        goto Failed;
    }

    if ( stricmp( strLogonType.QueryStr(), "network_cleartext" ) == 0 )
    {
        g_LogonType = LOGON32_LOGON_NETWORK_CLEARTEXT;
    }
    else if ( stricmp( strLogonType.QueryStr(), "batch" ) == 0 )
    {
        g_LogonType = LOGON32_LOGON_BATCH;
    }
    else if ( stricmp( strLogonType.QueryStr(), "network" ) == 0 )
    {
        g_LogonType = LOGON32_LOGON_NETWORK;
    }
    else if ( stricmp( strLogonType.QueryStr(), "interactive" ) == 0 )
    {
        g_LogonType = LOGON32_LOGON_INTERACTIVE;
    }
    else
    {
        g_LogonType = LOGON32_LOGON_NETWORK_CLEARTEXT;
    }

    //
    // Build up the redirect response
    //

    if ( g_strRedirectResponse.Printf( "HTTP/1.1 302 Object Moved\r\n"
                                       "Location: %s\r\n"
                                       "Set-Cookie: %s\r\n"
                                       "\r\n"
                                       REDIRECT_ENTITY,
                                       g_strLogonUrl.QueryStr(),
                                       DELETE_COOKIE,
                                       g_strLogonUrl.QueryStr() ) == FALSE )
    {
        goto Failed;
    }

    return TRUE;

Failed:

    WriteDebug( "LoadModuleConfig failed.  Error %d.\r\n",
                GetLastError() );

    return FALSE;
}

VOID TrimCommentAndTrailingWhitespace ( CHAR * szString )

Definition at line 730 of file Redir401.cpp.

       :

    This function trims a text line from an INI file
    such that it's truncated at the first instance of
    a ';'. Any trailing whitespace is also removed.

Arguments:

    szString - The string to trim

Returns:

    None

--*/
{
    LPSTR   pCursor = szString;
    LPSTR   pWhite = NULL;

    while ( *pCursor )
    {
        if ( *pCursor == ';' )
        {
            *pCursor = '\0';
            break;
        }

        if ( *pCursor == ' ' || *pCursor == '\t' )
        {
            if ( !pWhite )
            {
                pWhite = pCursor;
            }
        }
        else
        {
            pWhite = NULL;
        }

        pCursor++;
    }

    if ( pWhite )
    {
        *pWhite = '\0';
    }

    return;
}

Variable Documentation

ISAPI_STRING g_strRedirectResponse

Definition at line 36 of file Redir401.cpp.

Generated on Wed Nov 13 2024 16:54:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/ISAPI_6.0/DumpRequestInfo/DumpRequestInfo.cpp File Reference

  • Web
  • iis
  • ISAPI_6.0
  • DumpRequestInfo
Defines | Functions | Variables

DumpRequestInfo.cpp File Reference

#include <windows.h>
#include <IsapiTools.h>

Go to the source code of this file.

Defines

#define | _WIN32_WINNT 0x0500
#define | MAX_ALLOWED_ENTITY_SIZE 120*1024
#define | MAX_BUFFERED_RESPONSE_SIZE 128*1024
#define | MAX_VAR_NAME 64

Functions

VOID WINAPI | AsyncCompletion (EXTENSION_CONTROL_BLOCK *pecb, VOID *pContext, DWORD cbIO, DWORD cbError)
BOOL WINAPI | GetExtensionVersion (HSE_VERSION_INFO *pVer)
DWORD WINAPI | HttpExtensionProc (EXTENSION_CONTROL_BLOCK *pecb)
DWORD | ProcessRequest (ISAPI_REQUEST *pRequest)
BOOL | WriteEcbDump (ISAPI_REQUEST *pRequest)
BOOL | WriteRequestEntity (ISAPI_REQUEST *pRequest)
BOOL | WriteRequestHeaders (ISAPI_REQUEST *pRequest)
BOOL | WriteServerVariables (ISAPI_REQUEST *pRequest)

Variables

CHAR | g_rgVariableList [][MAX_VAR_NAME]
CHAR | g_szErrorResponse [] = "</html>"

Define Documentation

#define _WIN32_WINNT 0x0500

Definition at line 22 of file DumpRequestInfo.cpp.

#define MAX_ALLOWED_ENTITY_SIZE 120*1024

Definition at line 109 of file DumpRequestInfo.cpp.

#define MAX_BUFFERED_RESPONSE_SIZE 128*1024

Definition at line 108 of file DumpRequestInfo.cpp.

#define MAX_VAR_NAME 64

Definition at line 36 of file DumpRequestInfo.cpp.

Function Documentation

VOID WINAPI AsyncCompletion | ( | EXTENSION_CONTROL_BLOCK * | pecb,
 |  | VOID * | pContext,
 |  | DWORD | cbIO,
 |  | DWORD | cbError
 | ) |  |

Definition at line 312 of file DumpRequestInfo.cpp.

       :

    Handles cleaning up the request when the asynchronous
    TRANSMIT_FILE call completes.  Since the ISAREQUEST
    destructor takes care of cleaning up the ISAPI pieces,
    we basically just need to delete it here.

    Note that in the case of TRANSMIT_FILE, cbIO will
    reflect the number of file bytes sent, not including
    head and tail bytes.  Since ISAREQUEST::AsyncTransmitBufferedResponse
    works by using TRANSMIT_FILE with a NULL file handle,
    we expect that cbIO will be zero.

    Also, note that we will clean up the request any differently
    if an error occurs in transmission, so we don't need to
    check the cbError member.

Arguments:

    pecb     - pointer to the extenstion control block
    pContext - pointer to the I/O context (the ISAREQUEST in our case)
    cbIO     - the number of file bytes associated with the I/O
    cbError  - if non-zero, the code associated with any error in
               transmission

Returns:

    None

--*/
{
    delete (ISAPI_REQUEST*)pContext;
}

BOOL WINAPI GetExtensionVersion ( HSE_VERSION_INFO * pVer )

Definition at line 151 of file DumpRequestInfo.cpp.

       :

    Entry point for ISAPI extension initialization.  Required.

    This function will be called exactly once in the lifetime
    of the extension, at initialization time.  This function is
    a useful point to do complex initialization tasks.  This
    function is called outside of the system loader lock, so
    it does not have the same restrictions as DllMain.

Arguments:

    pVer - points to extension version info structure

Returns:

    TRUE on success, FALSE on failure.

    Note that in the case of FALSE, IIS will call GetLastError()
    and return an error page to the client.  The entity body of
    the page may be textual if the FormatMessage API can resolve
    it, or it may just be an error number if FormatMessage can't
    resolve it.

--*/
{
    //
    // Tell IIS which version of ISAPI this extension was build from.
    //

    pVer->dwExtensionVersion = MAKELONG( HSE_VERSION_MINOR,
                                         HSE_VERSION_MAJOR);

    //
    // Report the description string for this extension.  Ensure
    // that it does not exceed the maximum length and is NULL
    // terminated.
    //

    strncpy( pVer->lpszExtensionDesc,
             "DumpRequestInfo Sample ISAPI Extension",
             HSE_MAX_EXT_DLL_NAME_LEN );

    pVer->lpszExtensionDesc[HSE_MAX_EXT_DLL_NAME_LEN-1] = '\0';

    //
    // Return TRUE if we successfully initialized.
    //

  return TRUE;
}

DWORD WINAPI HttpExtensionProc ( EXTENSION_CONTROL_BLOCK * pecb )

Definition at line 210 of file DumpRequestInfo.cpp.

       :

    Entry point for ISAPI requests.  Required.

    This function is called once per request.  The EXTENSION_CONTROL_BLOCK
    passed in contains information and function pointers sufficient to
    interact with the server during this processing.

    Note that, once HttpExtensionProc is called, it is the responsibility
    of the extension to send back any data that the client should receive.
    IIS will not automatically generate any response, even in the case of
    HSE_STATUS_ERROR once the request has progressed to the point where
    this function is called.

    Also note that you should not make any blocking calls or do long-running
    operations within this function.  To allow efficient scaling of your
    server, you should consider creating a pool of private threads to handle
    the requests.  In that case, the implementation of this function would
    be just to add the pecb to a queue and return HSE_STATUS_PENDING.  The
    threads in the pool would be responsible for dequeing a pecb and calling
    HSE_REQ_DONE_WITH_SESSION when they are finished processing it.

Arguments:

    pecb - pointer to the extenstion control block

Returns:

    HSE_STATUS_SUCCESS - Indicates successful request.
    HSE_STATUS_ERROR   - Indicates failed request.
    HSE_STATUS_PENDING - Indicates that processing of the request
                         should continue after this function returns.
                         It HSE_STATUS_PENDING is used, it is necessary
                         that HSE_REQ_DONE_WITH_SESSION is called
                         exactly once when processing is completed for
                         the request.

--*/
{
    ISAPI_REQUEST * pRequest;

    pRequest = new ISAPI_REQUEST( pecb );

    //
    // If we Fail to allocate the ISAREQUEST object.  The
    // best we can do now is to manually send an error
    // to the client.
    //

    if ( !pRequest )
    {
        DWORD   cbErrorResponse;

        //
        // Set the size of the response.  Note that HTTP entity bodies
        // are not NULL terminated.
        //

        cbErrorResponse = sizeof( g_szErrorResponse ) - 1;

        //
        // Set the ECB's status member to correctly log this
        // failure as a 500.
        //

        pecb->dwHttpStatusCode = 500;

        //
        // Send the response.  There is no real need to check
        // for an error here, as there is nothing we can do
        // to recover.
        //

        pecb->ServerSupportFunction( pecb->ConnID,
                                     HSE_REQ_SEND_RESPONSE_HEADER,
                                     "500 Server Error",
                                     NULL,
                                     (DWORD*)"Content-Type: text/html\r\n"
                                     "\r\n" );

        pecb->WriteClient( pecb->ConnID,
                           g_szErrorResponse,
                           &cbErrorResponse,
                           HSE_IO_SYNC );

        return HSE_STATUS_ERROR;
    }

    return ProcessRequest( pRequest );
}

DWORD ProcessRequest ( ISAPI_REQUEST * pRequest )

Definition at line 355 of file DumpRequestInfo.cpp.

       :

    Does the main work of processing the request

Arguments:

    pRequest - the ISAREQUEST object created in HttpExtensionProc

Returns:

    An HSE_STATUS code

--*/
{
    //
    // Set the maximum response that we are willing to send
    //

    pRequest->SetMaxResponseBufferSize( MAX_BUFFERED_RESPONSE_SIZE );

    //
    // Begin building the response buffer
    //

    if ( !pRequest->AddHeaderToBufferedResponse( "Content-Type",
                                                 "text/html" ) )
    {
        goto Failed;
    }

    if ( !pRequest->PrintfToResponseBuffer( "<html>\r\n"
                                            "<head> <title> DumpRequestInfo "
                                            "</title> </head>\r\n"
                                            "<h1> DumpRequestInfo.dll </h1>\r\n"
                                            "<hr>\r\n" ) )
    {
        goto Failed;
    }

    //
    // Dump the parts of the request into the response buffer
    //

    if ( !WriteEcbDump( pRequest ) )
    {
        goto Failed;
    }

    if ( !WriteServerVariables( pRequest ) )
    {
        goto Failed;
    }

    if ( !WriteRequestHeaders( pRequest ) )
    {
        goto Failed;
    }

    if ( !WriteRequestEntity( pRequest ) )
    {
        goto Failed;
    }

    //
    // Complete the response buffer
    //

    if ( !pRequest->PrintfToResponseBuffer( "</html>" ) )
    {
        goto Failed;
    }

    //
    // Transmit the response to the client.  If this call succeeds,
    // then we must assume that the completion will occur immediately
    // and clean up the request.  We must therefore avoid touching
    // pRequest and return HSE_STATUS_PENDING unless the call fails.
    //

    if ( pRequest->AsyncTransmitBufferedResponse( AsyncCompletion ) )
    {
        return HSE_STATUS_PENDING;
    }

    //
    // Fall through to error handler
    //

Failed:

    //
    // Send a 500 response to the client
    //

    pRequest->SyncWriteCompleteResponse( "500 Server Error",
                                         "Content-Type: text/html\r\n\r\n",
                                         g_szErrorResponse );

    return HSE_STATUS_ERROR;
}

BOOL WriteEcbDump ( ISAPI_REQUEST * pRequest )

Definition at line 462 of file DumpRequestInfo.cpp.

       :

    Writes EXTENSION_CONTROL_BLOCK data into response buffer

Arguments:

    pRequest - the ISAREQUEST object created in HttpExtensionProc

Returns:

    An HSE_STATUS code

--*/
{
    EXTENSION_CONTROL_BLOCK *   pecb;
    BOOL                        fRet;

    pecb = pRequest->QueryEcb();

    fRet = pRequest->PrintfToResponseBuffer(
        "<h1> Dump of "
        "EXTENSION_CONTROL_BLOCK: </h1>\r\n"
        "<pre>\r\n"
        "cbSize             = %d\r\n"
        "dwVersion          = %08x\r\n"
        "ConnID             = %p\r\n"
        "dwHttpStatusCode   = %d\r\n"
        "cbTotalBytes       = %d\r\n"
        "cbAvailable        = %d\r\n"
        "lpbData            = %p\r\n"
        "lpszLogData        = %s\r\n"
        "lpszMethod         = %s\r\n"
        "lpszQueryString    = %s\r\n"
        "lpszPathInfo       = %s\r\n"
        "lpszPathTranslated = %s\r\n"
        "lpszContentType    = %s\r\n"
        "</pre>\r\n"
        "<hr>\r\n",
        pecb->cbSize,
        pecb->dwVersion,
        pecb->ConnID,
        pecb->dwHttpStatusCode,
        pecb->cbTotalBytes,
        pecb->cbAvailable,
        pecb->lpbData,
        pecb->lpszLogData,
        pecb->lpszMethod,
        pecb->lpszQueryString,
        pecb->lpszPathInfo,
        pecb->lpszPathTranslated,
        pecb->lpszContentType );

    return fRet;
}

BOOL WriteRequestEntity ( ISAPI_REQUEST * pRequest )

Definition at line 665 of file DumpRequestInfo.cpp.

       :

    Writes request entity data into response buffer

Arguments:

    pRequest - the ISAREQUEST object created in HttpExtensionProc

Returns:

    An HSE_STATUS code

--*/
{
    ISAPI_BUFFER    buffEntity( MAX_ALLOWED_ENTITY_SIZE );

    //
    // If there is no entity, then just return
    //

    if ( pRequest->QueryEcb()->cbTotalBytes == 0 )
    {
        return TRUE;
    }

    //
    // Write the start of the entity output
    //

    if ( !pRequest->PrintfToResponseBuffer( "<h1> Request Entity Dump "
                                            "</h1>\r\n"
                                            "<pre>\r\n" ) )
    {
        return FALSE;
    }

    if ( !pRequest->ReadAllEntity( &buffEntity ) )
    {
        //
        // If the entity is too large for our buffer,
        // we'll just print something to that effect
        //

        if ( GetLastError() != ERROR_NOT_ENOUGH_MEMORY )
        {
            return FALSE;
        }

        if ( !pRequest->PrintfToResponseBuffer( "*** Entity Too Large "
                                                "***\r\n" ) )
        {
            return FALSE;
        }
    }

    //
    // Since we're not writing a formatted string, use the append
    // function instead of the write function.  Not only is this
    // higher performance, but it does not depend on the current
    // maximum write size.
    //

    if ( !pRequest->AddDataToResponseBuffer( buffEntity.QueryPtr(),
                                             buffEntity.QueryDataSize() ) )
    {
        return FALSE;
    }

    //
    // Write the final part of the request entity output
    //

    if ( !pRequest->PrintfToResponseBuffer( "</pre>\r\n"
                                            "<hr>\r\n" ) )
    {
        return FALSE;
    }

    return TRUE;
}

BOOL WriteRequestHeaders ( ISAPI_REQUEST * pRequest )

Definition at line 604 of file DumpRequestInfo.cpp.

       :

    Writes request header data into response buffer

Arguments:

    pRequest - the ISAREQUEST object created in HttpExtensionProc

Returns:

    An HSE_STATUS code

--*/
{
    ISAPI_STRING    strHeaders;

    //
    // Write the start of the request header output
    //

    if ( !pRequest->PrintfToResponseBuffer( "<h1> Request Header Dump "
                                            "</h1>\r\n"
                                            "<pre>\r\n" ) )
    {
        return FALSE;
    }

    //
    // Get ALL_RAW, which contains the data as the client sent it
    //

    if ( !pRequest->GetServerVariable( "ALL_RAW",
                                       &strHeaders ) )
    {
        return FALSE;
    }

    if ( !pRequest->PrintfToResponseBuffer( strHeaders.QueryStr() ) )
    {
        return FALSE;
    }

    //
    // Write the final part of the request header output
    //

    if ( !pRequest->PrintfToResponseBuffer( "</pre>\r\n"
                                            "<hr>\r\n" ) )
    {
        return FALSE;
    }

    return TRUE;
}

BOOL WriteServerVariables ( ISAPI_REQUEST * pRequest )

Definition at line 523 of file DumpRequestInfo.cpp.

       :

    Writes server variable data into response buffer

Arguments:

    pRequest - the ISAREQUEST object created in HttpExtensionProc

Returns:

    An HSE_STATUS code

--*/
{
    ISAPI_STRING    strValue;
    DWORD           x = 0;
    BOOL            fResult;

    //
    // Write the start of the server variable output
    //

    if ( !pRequest->PrintfToResponseBuffer( "<h1> Server Variable Dump "
                                            "</h1>\r\n"
                                            "<pre>\r\n" ) )
    {
        return FALSE;
    }

    //
    // Loop through all of the server variables and
    // write them to the output buffer
    //

    while ( g_rgVariableList[x] &&
            g_rgVariableList[x][0] != '\0' )
    {
        fResult = pRequest->GetServerVariable( g_rgVariableList[x],
                                               &strValue );

        if ( fResult )
        {
            if ( !pRequest->PrintfToResponseBuffer( "%20s = %s\r\n",
                                                    g_rgVariableList[x],
                                                    strValue.QueryStr() ) )
            {
                return FALSE;
            }
        }
        else
        {
            if ( !pRequest->PrintfToResponseBuffer( "%20s = *** Error %d ***\r\n",
                                                    g_rgVariableList[x],
                                                    GetLastError() ) )
            {
                return FALSE;
            }
        }

        x++;
    }

    //
    // Write the final part of the server variable output
    //

    if ( !pRequest->PrintfToResponseBuffer( "</pre>\r\n"
                                            "<hr>\r\n" ) )
    {
        return FALSE;
    }

    return TRUE;
}

Variable Documentation

CHAR g_rgVariableList[][MAX_VAR_NAME]

Definition at line 38 of file DumpRequestInfo.cpp.

CHAR g_szErrorResponse[] = "</html>"

Definition at line 94 of file DumpRequestInfo.cpp.

Generated on Wed Nov 13 2024 16:54:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/ISAPI_6.0/HelloIsapi/HelloIsapi.cpp File Reference

  • Web
  • iis
  • ISAPI_6.0
  • HelloIsapi
Defines | Functions

HelloIsapi.cpp File Reference

#include <stdio.h>
#include <windows.h>
#include <httpext.h>

Go to the source code of this file.

Defines

#define | _WIN32_WINNT 0x0500
#define | STRING_SIZE 256

Functions

BOOL WINAPI | GetExtensionVersion (HSE_VERSION_INFO *pVer)
DWORD WINAPI | HttpExtensionProc (EXTENSION_CONTROL_BLOCK *pecb)

Define Documentation

#define _WIN32_WINNT 0x0500

Definition at line 19 of file HelloIsapi.cpp.

#define STRING_SIZE 256

Definition at line 30 of file HelloIsapi.cpp.

Function Documentation

BOOL WINAPI GetExtensionVersion ( HSE_VERSION_INFO * pVer )

Definition at line 34 of file HelloIsapi.cpp.

       :

    Entry point for ISAPI extension initialization.  Required.

    This function will be called exactly once in the lifetime
    of the extension, at initialization time.  This function is
    a useful point to do complex initialization tasks.  This
    function is called outside of the system loader lock, so
    it does not have the same restrictions as DllMain.

Arguments:

    pVer - points to extension version info structure

Returns:

    TRUE on success, FALSE on failure.

    Note that in the case of FALSE, IIS will call GetLastError()
    and return an error page to the client.  The entity body of
    the page may be textual if the FormatMessage API can resolve
    it, or it may just be an error number if FormatMessage can't
    resolve it.

--*/
{
    //
    // Tell IIS which version of ISAPI this extension was build from.
    //

    pVer->dwExtensionVersion = MAKELONG( HSE_VERSION_MINOR,
                                         HSE_VERSION_MAJOR);

    //
    // Report the description string for this extension.  Ensure
    // that it does not exceed the maximum length and is NULL
    // terminated.
    //

    strncpy( pVer->lpszExtensionDesc,
             "HelloIsapi Sample Extension",
             HSE_MAX_EXT_DLL_NAME_LEN );

    pVer->lpszExtensionDesc[HSE_MAX_EXT_DLL_NAME_LEN-1] = '\0';

    //
    // Return TRUE if we successfully initialized.
    //

  return TRUE;
}

DWORD WINAPI HttpExtensionProc ( EXTENSION_CONTROL_BLOCK * pecb )

Definition at line 93 of file HelloIsapi.cpp.

       :

    Entry point for ISAPI requests.  Required.

    This function is called once per request.  The EXTENSION_CONTROL_BLOCK
    passed in contains information and function pointers sufficient to
    interact with the server during this processing.

    Note that, once HttpExtensionProc is called, it is the responsibility
    of the extension to send back any data that the client should receive.
    IIS will not automatically generate any response, even in the case of
    HSE_STATUS_ERROR once the request has progressed to the point where
    this function is called.

    Also note that you should not make any blocking calls or do long-running
    operations within this function.  To allow efficient scaling of your
    server, you should consider creating a pool of private threads to handle
    the requests.  In that case, the implementation of this function would
    be just to add the pecb to a queue and return HSE_STATUS_PENDING.  The
    threads in the pool would be responsible for dequeing a pecb and calling
    HSE_REQ_DONE_WITH_SESSION when they are finished processing it.

Arguments:

    pecb - pointer to the extenstion control block

Returns:

    HSE_STATUS_SUCCESS - Indicates successful request.
    HSE_STATUS_ERROR   - Indicates failed request.
    HSE_STATUS_PENDING - Indicates that processing of the request
                         should continue after this function returns.
                         It HSE_STATUS_PENDING is used, it is necessary
                         that HSE_REQ_DONE_WITH_SESSION is called
                         exactly once when processing is completed for
                         the request.

--*/
{
    //
    // Create a simple, canned response
    //

    CHAR    szResponse[] = "<html>\r\n"
                           "<head>\r\n"
                           "<title> HelloIsapi Sample Extension </title>\r\n"
                           "</head>\r\n"
                           "<h1> Hello ISAPI! </h1>\r\n"
                           "<hr>\r\n"
                           "This is a very simple ISAPI extension.";

    //
    // Determine the size of the response.  Note that HTTP responses
    // are not necessarily NULL terminated, so we'll not include
    // the terminator in our size.
    //

    DWORD   cbResponse = sizeof( szResponse ) - 1;

    //
    // Create the optional headers that we need.  We'll include the
    // content-type, so the client knows to render the response as
    // HTML, and we'll also include a content-length.
    //
    // The inclusion of a content-length when using
    // HSE_REQ_SEND_RESPONSE_HEADER will allow IIS to honor keep-alive
    // if the client has requested it.  Without a content-length,
    // IIS will close the connection at the conculsion of this
    // response.
    //

    CHAR    szHeaders[STRING_SIZE];

    _snprintf( szHeaders,
               STRING_SIZE,
               "Content-Type: text/html\r\n"
               "Content-Length: %d\r\n\r\n",
               cbResponse );

    //
    // Ensure that szHeaders buffer is NULL terminated in the case
    // where STRING_SIZE might have been insufficient to hold all
    // of the data.
    //
    // Note that this isn't strictly necessary for this particular
    // code, since we know that the headers will fit, and we won't
    // be calling any more string functions against szHeaders.
    // It is, however, a good practice to get into the habit of
    // protecting against any buffer overruns that result from some
    // later code assuming that this string is properly NULL
    // terminated.
    //

    szHeaders[STRING_SIZE-1] = '\0';

    //
    // Send back a 200 response, with the headers we've built
    //

    pecb->ServerSupportFunction( pecb->ConnID,
                                 HSE_REQ_SEND_RESPONSE_HEADER,
                                 "200 OK",
                                 NULL,
                                 (DWORD*)szHeaders );

    //
    // Send back the entity synchronously
    //

    pecb->WriteClient( pecb->ConnID,
                       szResponse,
                       &cbResponse,
                       HSE_IO_SYNC );

    //
    // All Done!
    //

    return HSE_STATUS_SUCCESS;
}

Generated on Wed Nov 13 2024 16:54:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/ISAPI_6.0/inc/IsapiBuffer.h File Reference

  • Web
  • iis
  • ISAPI_6.0
  • inc
Classes | Defines

IsapiBuffer.h File Reference

#include <IsapiTools.h>

Go to the source code of this file.

Classes

class | ISAPI_BUFFER

Defines

#define | DEFAULT_MAX_ALLOC_SIZE 16384
#define | INLINE_BUFFER_SIZE 256

Define Documentation

#define DEFAULT_MAX_ALLOC_SIZE 16384

Definition at line 33 of file IsapiBuffer.h.

#define INLINE_BUFFER_SIZE 256

Definition at line 34 of file IsapiBuffer.h.

Generated on Wed Nov 13 2024 16:54:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/ISAPI_6.0/inc/IsapiDebug.h File Reference

  • Web
  • iis
  • ISAPI_6.0
  • inc
Defines | Functions | Variables

IsapiDebug.h File Reference

Go to the source code of this file.

Defines

#define | MAX_DEBUG_OUTPUT 2048

Functions

VOID | IsapiAssert (CHAR *szExpr, CHAR *szFile, DWORD dwLine)
VOID | SetModuleName (CHAR *szModuleName)
VOID | WriteDebug (CHAR *szFormat,...)

Variables

CHAR | g_szModuleName [MAX_PATH+1]

Define Documentation

#define MAX_DEBUG_OUTPUT 2048

Definition at line 24 of file IsapiDebug.h.

Function Documentation

VOID IsapiAssert | ( | CHAR * | szExpr,
 |  | CHAR * | szFile,
 |  | DWORD | dwLine
 | ) |  |

Definition at line 35 of file IsapiDebug.cpp.

       :

    Calls a DebugBreak and reports the expression, source
    filename, and line number to the debugger.

    This function is called by the ISAPI_ASSERT macro, which
    provides the expression, source file, and line information.

Arguments:

    szExpr - The expression that failed the assertion
    szFile - The name of the source file that contains the expression
    dwLine - The line number of the expression

Returns:

    None

--*/
{
    va_list args;

    args = (va_list)&szExpr;

    WriteDebugArgs( "ISAPIASSERT Failed:  \"%s\", File=\"%s\", Line=%d.\r\n",
                args );

    va_end( args );

    DebugBreak();
}

VOID SetModuleName ( CHAR * szModuleName )
VOID WriteDebug | ( | CHAR * | szFormat,
 |  |  | ...
 | ) |  |

Definition at line 75 of file IsapiDebug.cpp.

       :

    Writes a line to an attached debugger using printf-style
    formatting.

Arguments:

    szFormat - The format string
    ...      - Zero or more additional arguments

Returns:

    None

--*/
{
    va_list args;

    va_start( args, szFormat );

    WriteDebugArgs( szFormat, args );

    va_end( args );
}

Variable Documentation

CHAR g_szModuleName[MAX_PATH+1]

Definition at line 23 of file IsapiModule.cpp.

Generated on Wed Nov 13 2024 16:54:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/ISAPI_6.0/inc/IsapiExtension.h File Reference

  • Web
  • iis
  • ISAPI_6.0
  • inc
Classes | Typedefs

IsapiExtension.h File Reference

#include <IsapiTools.h>

Go to the source code of this file.

Classes

class | ISAPI_EXTENSION

Typedefs

typedef BOOL(WINAPI * | PFN_FIRST_HIT_INIT )(VOID *pContext)

Typedef Documentation

typedef BOOL(WINAPI * PFN_FIRST_HIT_INIT)(VOID *pContext)

Definition at line 23 of file IsapiExtension.h.

Generated on Wed Nov 13 2024 16:54:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/ISAPI_6.0/inc/IsapiModule.h File Reference

  • Web
  • iis
  • ISAPI_6.0
  • inc
Functions

IsapiModule.h File Reference

Go to the source code of this file.

Functions

VOID InitializeIsapiTools (CHAR *szModuleName)

Function Documentation

VOID InitializeIsapiTools ( CHAR * szModuleName )

Definition at line 26 of file IsapiModule.cpp.

       :

    Initializes IsapiTools so that time function work
    correctly, and so that debug output contains the
    module name.

Arguments:

    szModuleName - The name of the dll (ie. "MyIsapi", without ".dll")

Returns:

    None

--*/
{
    //
    // Set the module name
    //

    if ( szModuleName != NULL )
    {
        strncpy( g_szModuleName, szModuleName, MAX_PATH );

        g_szModuleName[MAX_PATH] = '\0';
    }

    //
    // Initialize the time tools
    //

    InitializeIsapiTime();

    return;
}

Generated on Wed Nov 13 2024 16:54:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/ISAPI_6.0/inc/IsapiRequest.h File Reference

  • Web
  • iis
  • ISAPI_6.0
  • inc
Classes | Defines | Functions

IsapiRequest.h File Reference

#include <IsapiTools.h>
#include <httpext.h>

Go to the source code of this file.

Classes

class | ISAPI_REQUEST

Defines

#define | DEFAULT_HEADERS "\r\n"
#define | DEFAULT_RESPONSE_BUFFER_SIZE 32 * 1024
#define | DEFAULT_STATUS "200 OK"
#define | IMMEDIATE_EXPIRATION 0
#define | INLINE_READ_SIZE 2048
#define | NO_EXPIRATION 0xffffffff

Functions

DWORD | SyncSendGenericServerError (EXTENSION_CONTROL_BLOCK *pecb)

Define Documentation

#define DEFAULT_HEADERS "\r\n"

Definition at line 25 of file IsapiRequest.h.

#define DEFAULT_RESPONSE_BUFFER_SIZE 32 * 1024

Definition at line 27 of file IsapiRequest.h.

#define DEFAULT_STATUS "200 OK"

Definition at line 24 of file IsapiRequest.h.

#define IMMEDIATE_EXPIRATION 0

Definition at line 35 of file IsapiRequest.h.

#define INLINE_READ_SIZE 2048

Definition at line 26 of file IsapiRequest.h.

#define NO_EXPIRATION 0xffffffff

Definition at line 34 of file IsapiRequest.h.

Function Documentation

DWORD SyncSendGenericServerError ( EXTENSION_CONTROL_BLOCK * pecb )

Definition at line 1931 of file IsapiRequest.cpp.

       :

    Synchronously sends a generic "500 Server Error" response

Arguments:

    pecb - The EXTENSION_CONTROL_BLOCK of this request

Returns:

    HSE_STATUS_ERROR

--*/
{
    ISAPI_REQUEST   Request( pecb );

    Request.SyncWriteCompleteResponse( "500 Server Error",
                                       "Content-Type: text/html\r\n\r\n",
                                       SERVER_ERROR );

    return HSE_STATUS_ERROR;
}

Generated on Wed Nov 13 2024 16:54:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/ISAPI_6.0/inc/IsapiString.h File Reference

  • Web
  • iis
  • ISAPI_6.0
  • inc
Classes

IsapiString.h File Reference

#include <IsapiTools.h>

Go to the source code of this file.

Classes

class ISAPI_STRING
Generated on Wed Nov 13 2024 16:54:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/ISAPI_6.0/inc/IsapiStringW.h File Reference

  • Web
  • iis
  • ISAPI_6.0
  • inc
Classes

IsapiStringW.h File Reference

#include <IsapiTools.h>

Go to the source code of this file.

Classes

class ISAPI_STRINGW
Generated on Wed Nov 13 2024 16:54:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/ISAPI_6.0/inc/IsapiTime.h File Reference

  • Web
  • iis
  • ISAPI_6.0
  • inc
Functions

IsapiTime.h File Reference

#include <IsapiTools.h>

Go to the source code of this file.

Functions

DWORD64 | DiffFileTimeInMilliseconds (FILETIME *pft1, FILETIME *pft2)
DWORD | DiffFileTimeInSeconds (FILETIME *pft1, FILETIME *pft2)
BOOL | GetCurrentTimeAsFileTime (FILETIME *pft)
BOOL | GetCurrentTimeAsString (ISAPI_STRING *pString)
DWORD64 | GetCurrentTimeInMilliseconds (VOID)
DWORD | GetCurrentTimeInSeconds (VOID)
BOOL | GetFileTimeAsString (FILETIME *pft, ISAPI_STRING *pString)
BOOL | GetFileTimeFromString (FILETIME *pft, CHAR *szTimeString)
BOOL | InitializeIsapiTime (VOID)

Function Documentation

DWORD64 DiffFileTimeInMilliseconds | ( | FILETIME * | pft1,
 |  | FILETIME * | pft2
 | ) |  |

Definition at line 571 of file IsapiTime.cpp.

       :

    Returns the difference, in milliseconds, between the two
    provided FILETIMEs

Arguments:

    pft1 - The first FILETIME
    pft2 - The second FILETIME

Returns:

    The difference, in milliseconds

--*/
{
    DWORD64 Time1;
    DWORD64 Time2;
    DWORD64 DiffTime;

    Time1 = ((LARGE_INTEGER*)pft1)->QuadPart;
    Time2 = ((LARGE_INTEGER*)pft2)->QuadPart;

    DiffTime = Time2 > Time1 ? Time2 - Time1 : Time1 - Time2;

    //
    // Return result, converted from 100 nanosecond intervals
    // to milliseconds.
    //

    return DiffTime / 10000;
}

DWORD DiffFileTimeInSeconds | ( | FILETIME * | pft1,
 |  | FILETIME * | pft2
 | ) |  |

Definition at line 545 of file IsapiTime.cpp.

       :

    Returns the difference, in seconds, between the two
    provided FILETIMEs

Arguments:

    pft1 - The first FILETIME
    pft2 - The second FILETIME

Returns:

    The difference, in seconds

--*/
{
    return (DWORD)(DiffFileTimeInMilliseconds( pft1, pft2 ) / 1000);
}

BOOL GetCurrentTimeAsFileTime ( FILETIME * pft )

Definition at line 143 of file IsapiTime.cpp.

       :

    Returns the current time in the provided FILETIME structure

Arguments:

    pft - Pointer to the target FILETIME

Returns:

    TRUE on success, FALSE on failure

--*/
{
    SYSTEMTIME  st;

    //
    // Get the current time in GMT
    //

    GetSystemTime( &st );

    return SystemTimeToFileTime( &st, pft );
}

BOOL GetCurrentTimeAsString ( ISAPI_STRING * pString )

Definition at line 505 of file IsapiTime.cpp.

       :

    Builds string in the following format from the current time:

      "Tue, 16 Oct 2002 20:25:00 GMT"

Arguments:

    pString - ISAPI_STRING to store the result

Returns:

    TRUE on success, FALSE on failure

--*/
{
    FILETIME    ft;

    if ( GetCurrentTimeAsFileTime( &ft ) == FALSE )
    {
        goto Failed;
    }

    return GetFileTimeAsString( &ft, pString );

Failed:

    //
    // No special cleanup required
    //

    return FALSE;
}

DWORD64 GetCurrentTimeInMilliseconds ( VOID )

Definition at line 89 of file IsapiTime.cpp.

       :

    Returns the number of milliseconds since InitializeIsapiTime was called.

Arguments:

    None

Returns:

    The number of milliseconds

--*/
{
    FILETIME    ftCurrent;

    //
    // If we haven't been initialized, just return 0
    //

    if ( ((LARGE_INTEGER*)&g_ftInitTime)->QuadPart == 0 )
    {
        SetLastError( ERROR_INVALID_PARAMETER );
        return 0;
    }

    //
    // Get the current time
    //
    // Note that GetCurrentTimeAsFileTime calls GetSystemTime,
    // which is a system call.  This introduces a performance
    // cost due to a kernel transition.  It would be possible
    // to use something like GetTickCount to obtain higher
    // performance, but GetTickCount returns a DWORD.  This
    // would introduce a rollover problem after about 49 days.
    //
    // This code favors correctness over performance in this
    // case.
    //

    if ( GetCurrentTimeAsFileTime( &ftCurrent ) == FALSE )
    {
        return 0;
    }

    return DiffFileTimeInMilliseconds( &g_ftInitTime, &ftCurrent );
}

DWORD GetCurrentTimeInSeconds ( VOID )

Definition at line 66 of file IsapiTime.cpp.

       :

    Returns the number of seconds since InitializeIsapiTime was called

Arguments:

    None

Returns:

    The number of seconds

--*/
{
    return (DWORD)(GetCurrentTimeInMilliseconds() / 1000);
}

BOOL GetFileTimeAsString | ( | FILETIME * | pft,
 |  | ISAPI_STRING * | pString
 | ) |  |

Definition at line 412 of file IsapiTime.cpp.

       :

    Builds string in the following format from the provided FILETIME:

      "Tue, 16 Oct 2002 20:25:00 GMT"

Arguments:

    pft     - The FILETIME
    pString - ISAPI_STRING to store the result

Returns:

    TRUE on success, FALSE on failure

--*/
{
    SYSTEMTIME  st;
    CHAR        szDate[SIZE_DATE];
    CHAR        szTime[SIZE_TIME];
    DWORD       cbCopied;
    BOOL        fResult;

    //
    // Convert the supplied time to a SYSTEMTIME
    //

    fResult = FileTimeToSystemTime( pft, &st );

    if ( !fResult )
    {
        goto Failed;
    }

    //
    // Get the date and time as strings
    //

    cbCopied = GetDateFormat( LOCALE_SYSTEM_DEFAULT,
                              0,
                              &st,
                              "ddd, dd MMM yyyy",
                              szDate,
                              SIZE_DATE );

    if ( cbCopied == 0 )
    {
        goto Failed;
    }

    cbCopied = GetTimeFormat( LOCALE_SYSTEM_DEFAULT,
                              0,
                              &st,
                              "HH:mm:ss",
                              szTime,
                              SIZE_TIME );

    if ( cbCopied == 0 )
    {
        goto Failed;
    }

    //
    // Build the final result into the string
    //

    fResult = pString->Printf( "%s %s GMT",
                               szDate,
                               szTime );

    if ( !fResult )
    {
        goto Failed;
    }

    return TRUE;

Failed:

    //
    // No special cleanup required
    //

    return FALSE;
}

BOOL GetFileTimeFromString | ( | FILETIME * | pft,
 |  | CHAR * | szTimeString
 | ) |  |

Definition at line 174 of file IsapiTime.cpp.

       :

    Returns a filetime, corresponding to the provided string,
    in the format of:

      "Tue, 16 Oct 2002 20:25:00 GMT"

Arguments:

    pft          - On return, contains the FILETIME data
    szTimeString - The string to parse for time

Returns:

    TRUE on success, FALSE on failure

--*/
{
    SYSTEMTIME  st;
    CHAR *      pCursor;

    ZeroMemory( &st, sizeof(SYSTEMTIME) );

    //
    // Build the members of the systemtime structure from
    // the input string.
    //

    pCursor = szTimeString;

    //
    // Get the day of week
    //

    if ( strnicmp( pCursor, "sun", 3 ) == 0 )
    {
        st.wDayOfWeek = 0;
    }
    else if ( strnicmp( pCursor, "mon", 3 ) == 0 )
    {
        st.wDayOfWeek = 1;
    }
    else if ( strnicmp( pCursor, "tue", 3 ) == 0 )
    {
        st.wDayOfWeek = 2;
    }
    else if ( strnicmp( pCursor, "wed", 3 ) == 0 )
    {
        st.wDayOfWeek = 3;
    }
    else if ( strnicmp( pCursor, "thu", 3 ) == 0 )
    {
        st.wDayOfWeek = 4;
    }
    else if ( strnicmp( pCursor, "fri", 3 ) == 0 )
    {
        st.wDayOfWeek = 5;
    }
    else if ( strnicmp( pCursor, "sat", 3 ) == 0 )
    {
        st.wDayOfWeek = 6;
    }
    else
    {
        SetLastError( ERROR_INVALID_PARAMETER );
        goto Failed;
    }

    //
    // Get the day
    //

    pCursor = strchr( pCursor, ' ' );

    if ( !pCursor )
    {
        SetLastError( ERROR_INVALID_PARAMETER );
        goto Failed;
    }

    pCursor++;

    st.wDay = atoi( pCursor );

    //
    // Get the month
    //

    pCursor = strchr( pCursor, ' ' );

    if ( !pCursor )
    {
        SetLastError( ERROR_INVALID_PARAMETER );
        goto Failed;
    }

    pCursor++;

    if ( strnicmp( pCursor, "jan", 3 ) == 0 )
    {
        st.wMonth = 1;
    }
    else if ( strnicmp( pCursor, "feb", 3 ) == 0 )
    {
        st.wMonth = 2;
    }
    else if ( strnicmp( pCursor, "mar", 3 ) == 0 )
    {
        st.wMonth = 3;
    }
    else if ( strnicmp( pCursor, "apr", 3 ) == 0 )
    {
        st.wMonth = 4;
    }
    else if ( strnicmp( pCursor, "may", 3 ) == 0 )
    {
        st.wMonth = 5;
    }
    else if ( strnicmp( pCursor, "jun", 3 ) == 0 )
    {
        st.wMonth = 6;
    }
    else if ( strnicmp( pCursor, "jul", 3 ) == 0 )
    {
        st.wMonth = 7;
    }
    else if ( strnicmp( pCursor, "aug", 3 ) == 0 )
    {
        st.wMonth = 8;
    }
    else if ( strnicmp( pCursor, "sep", 3 ) == 0 )
    {
        st.wMonth = 9;
    }
    else if ( strnicmp( pCursor, "oct", 3 ) == 0 )
    {
        st.wMonth = 10;
    }
    else if ( strnicmp( pCursor, "nov", 3 ) == 0 )
    {
        st.wMonth = 11;
    }
    else if ( strnicmp( pCursor, "dec", 3 ) == 0 )
    {
        st.wMonth = 12;
    }
    else
    {
        SetLastError( ERROR_INVALID_PARAMETER );
        goto Failed;
    }

    //
    // Get the year
    //

    pCursor = strchr( pCursor, ' ' );

    if ( !pCursor )
    {
        SetLastError( ERROR_INVALID_PARAMETER );
        goto Failed;
    }

    pCursor++;

    st.wYear = atoi( pCursor );

    //
    // Get the Hour
    //

    pCursor = strchr( pCursor, ' ' );

    if ( !pCursor )
    {
        SetLastError( ERROR_INVALID_PARAMETER );
        goto Failed;
    }

    pCursor++;

    st.wHour = atoi( pCursor );

    //
    // Get the minutes
    //

    pCursor = strchr( pCursor, ':' );

    if ( !pCursor )
    {
        SetLastError( ERROR_INVALID_PARAMETER );
        goto Failed;
    }

    pCursor++;

    st.wMinute = atoi( pCursor );

    //
    // Get the seconds
    //

    pCursor = strchr( pCursor, ':' );

    if ( !pCursor )
    {
        SetLastError( ERROR_INVALID_PARAMETER );
        goto Failed;
    }

    pCursor++;

    st.wSecond = atoi( pCursor );

    //
    // Now convert it to a filetime
    //

    return SystemTimeToFileTime( &st, pft );

Failed:

    //
    // No special cleanup required
    //

    return FALSE;
}

BOOL InitializeIsapiTime ( VOID )

Definition at line 35 of file IsapiTime.cpp.

       :

    Initializes IsapiTools time functions by initializing g_ftInitTime

Arguments:

    None

Returns:

    TRUE on success, FALSE on failure

--*/
{
    if ( ((LARGE_INTEGER*)&g_ftInitTime)->QuadPart == 0 )
    {
        if ( GetCurrentTimeAsFileTime( &g_ftInitTime ) == FALSE )
        {
            return FALSE;
        }
    }

    return TRUE;
}

Generated on Wed Nov 13 2024 16:54:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/ISAPI_6.0/inc/IsapiTools.h File Reference

  • Web
  • iis
  • ISAPI_6.0
  • inc
Defines | Variables

IsapiTools.h File Reference

#include <windows.h>
#include <IsapiModule.h>
#include <IsapiDebug.h>
#include <IsapiBuffer.h>
#include <IsapiString.h>
#include <IsapiStringW.h>
#include <IsapiRequest.h>
#include <IsapiExtension.h>
#include <IsapiTime.h>

Go to the source code of this file.

Defines

#define | ISAPI_ASSERT(expr) ((VOID)0)

Variables

CHAR | g_szModuleName [MAX_PATH+1]

Define Documentation

#define ISAPI_ASSERT ( expr ) ((VOID)0)

Definition at line 29 of file IsapiTools.h.

Variable Documentation

CHAR g_szModuleName[MAX_PATH+1]

Definition at line 23 of file IsapiModule.cpp.

Generated on Wed Nov 13 2024 16:54:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/ISAPI_6.0/PoolWrap/Extension.cpp File Reference

  • Web
  • iis
  • ISAPI_6.0
  • PoolWrap
Defines | Functions | Variables

Extension.cpp File Reference

#include <time.h>
#include <stdio.h>
#include <windows.h>
#include <httpext.h>
#include "PoolWrap.h"

Go to the source code of this file.

Defines

#define | _WIN32_WINNT 0x0500
#define | STRING_BUFFER 1024

Functions

VOID | CopyStringAndTerminate (LPSTR szTarget, LPSTR szSource, DWORD cbTarget=0)
BOOL WINAPI | GetExtensionVersion (HSE_VERSION_INFO *pVer)
DWORD WINAPI | HttpExtensionProc (EXTENSION_CONTROL_BLOCK *pecb)
BOOL | InitThread (VOID)
BOOL | SendHeaders (EXTENSION_CONTROL_BLOCK *pecb, LPSTR szStatus, LPSTR szHeaders, DWORD cbContent=0)
DWORD | SendHelpPage (EXTENSION_CONTROL_BLOCK *pecb)
DWORD | SendStatisticsPage (EXTENSION_CONTROL_BLOCK *pecb)
BOOL WINAPI | TerminateExtension (DWORD dwFlags)
VOID | UninitThread (VOID)

Variables

SYSTEMTIME | g_StartTime

Define Documentation

#define _WIN32_WINNT 0x0500

Definition at line 33 of file Extension.cpp.

#define STRING_BUFFER 1024

Definition at line 41 of file Extension.cpp.

Function Documentation

VOID CopyStringAndTerminate | ( | LPSTR | szTarget,
 |  | LPSTR | szSource,
 |  | DWORD | cbTarget = 0
 | ) |  |

Definition at line 333 of file Extension.cpp.

       :

    This function is just a wrapper for strncpy.  If cbTarget is
    non-zero, it will NULL terminate the last character in the
    buffer.  This will help prevent buffer overruns by ensuring
    it's always safe to call string functions on the target.

    If you use strncpy without taking this extra step, and
    szSource is longer than szTarget, then szTarget will not be
    NULL terminated, and string operations can overrun the buffer.

Arguments:

    szTarget - The target buffer
    szSource - The data to be copied
    cbTarget - The size of szTarget

Returns:

    None

--*/
{
    if ( cbTarget == 0 )
    {
        strcpy( szTarget, szSource );
    }
    else
    {
        strncpy( szTarget, szSource, cbTarget );
        szTarget[cbTarget-1] = '\0';
    }
}

BOOL WINAPI GetExtensionVersion ( HSE_VERSION_INFO * pVer )

Definition at line 109 of file Extension.cpp.

       :

    This is a required ISAPI Extension DLL entry point.

Arguments:

    pVer - points to extension version info structure

Returns:

    TRUE on success, FALSE on failure.  Note that on a FALSE
    return, it should ensure that the Win32 last error is set.

--*/
{
  //
    // Set the extension version
    //

    pVer->dwExtensionVersion = MAKELONG(
        HSE_VERSION_MINOR,
        HSE_VERSION_MAJOR
        );

    //
    // Set the extension description
    //

  lstrcpyn(
        pVer->lpszExtensionDesc,
        "TestPoolWrap test ISAPI extension",
        HSE_MAX_EXT_DLL_NAME_LEN
        );

    //
    // Seed the random number generator and get the
    // time at which this extension initialized
    //

    srand( (unsigned)time( NULL ) );

    GetLocalTime( &g_StartTime );

  return TRUE;
}

DWORD WINAPI HttpExtensionProc ( EXTENSION_CONTROL_BLOCK * pecb )

Definition at line 162 of file Extension.cpp.

       :

    Entry point for requests to this extension

    Note that we assume that the response will fit into our
    string buffer, and don't take any action to prevent a
    problem with this (since the client can't do anything
    to increase the size of the response).

Arguments:

    pecb - Pointer to the EXTENSION_CONTROL_BLOCK for this request

Returns:

    One of the HSE_STATUS result codes

--*/
{
    CHAR    szQuery[STRING_BUFFER+1] = {0};
    CHAR    szContent[STRING_BUFFER+1] = {0};
    LPSTR   pCursor;
    DWORD   dwMinWait;
    DWORD   dwMaxWait;
    DWORD   dwSleepTime;
    DWORD   cbToSend;

    //
    // Process the query string
    //

    if ( pecb->lpszQueryString[0] == '\0' )
    {
        return SendHelpPage( pecb );
    }

    if ( stricmp( pecb->lpszQueryString, "statistics" ) == NULL )
    {
        return SendStatisticsPage( pecb );
    }

    CopyStringAndTerminate( szQuery, pecb->lpszQueryString, STRING_BUFFER );

    pCursor = strchr( szQuery, '+' );

    if ( pCursor == NULL )
    {
        dwMinWait = atol( szQuery );
        dwMaxWait = dwMinWait;
    }
    else
    {
        *pCursor = '\0';

        dwMinWait = atol( szQuery );
        dwMaxWait = atol( pCursor + 1 );
    }

    //
    // Calculate the sleep time and do it
    //

    if ( dwMaxWait < dwMinWait )
    {
        return SendHelpPage( pecb );
    }

    if ( dwMaxWait > dwMinWait )
    {
        dwSleepTime = dwMinWait + ( rand() % ( dwMaxWait - dwMinWait ) );
    }
    else
    {
        dwSleepTime = dwMinWait;
    }

    Sleep( dwSleepTime );

    //
    // Now send the response
    //

    _snprintf(
        szContent,
        STRING_BUFFER,
        "<html>\r\n"
        "<head> <title> %s.dll </title> </head>\r\n"
        "<h1> %s.dll </h1>\r\n"
        "<hr>\r\n"
        "%s.dll has sent this response after simulating a wait "
        "for %d milliseconds.",
        MODULE_NAME,
        MODULE_NAME,
        MODULE_NAME,
        dwSleepTime
        );

    cbToSend = strlen( szContent );

    SendHeaders(
        pecb,
        "200 OK",
        "Content-Type: text/html\r\n\r\n",
        cbToSend
        );

    pecb->WriteClient(
        pecb->ConnID,
        szContent,
        &cbToSend,
        HSE_IO_SYNC | HSE_IO_NODELAY
        );

    return HSE_STATUS_SUCCESS;
}

BOOL InitThread ( VOID )

Definition at line 84 of file Extension.cpp.

{
    //
    // Don't do any special initialization
    //

    return TRUE;
}

BOOL SendHeaders | ( | EXTENSION_CONTROL_BLOCK * | pecb,
 |  | LPSTR | szStatus,
 |  | LPSTR | szHeaders,
 |  | DWORD | cbContent = 0
 | ) |  |

Definition at line 543 of file Extension.cpp.

       :

    A simple HSE_REQ_SEND_RESPONSE_HEADER_EX wrapper that adds
    an optional content-length header to the response

Arguments:

    pecb      - The EXTENSION_CONTROL_BLOCK for the request
    szStatus  - The status (ie. "200 OK") to be sent
    szHeaders - The headers (ie. "content-type: text/html\r\n\r\n"
                to be sent
    cbContent - If non-zero, will be used to generate a
                content-length header to add to the response

Returns:

    None

--*/
{
    HSE_SEND_HEADER_EX_INFO HeaderInfo;
    CHAR                    szCookedHeaders[STRING_BUFFER+1] = {0};
    LPSTR                   pHeaders;

    if ( cbContent == 0 )
    {
        pHeaders = szHeaders;
    }
    else
    {
        _snprintf(
            szCookedHeaders,
            STRING_BUFFER,
            "Content-Length: %d\r\n%s",
            cbContent,
            szHeaders
            );

        pHeaders = szCookedHeaders;
    }

    HeaderInfo.pszHeader = pHeaders;
    HeaderInfo.pszStatus = szStatus;
    HeaderInfo.cchHeader = strlen( HeaderInfo.pszHeader );
    HeaderInfo.cchStatus = strlen( HeaderInfo.pszStatus );
    HeaderInfo.fKeepConn = cbContent ? TRUE : FALSE;

    return pecb->ServerSupportFunction(
        pecb->ConnID,
        HSE_REQ_SEND_RESPONSE_HEADER_EX,
        &HeaderInfo,
        NULL,
        NULL
        );
}

DWORD SendHelpPage ( EXTENSION_CONTROL_BLOCK * pecb )

Definition at line 375 of file Extension.cpp.

       :

    Returns the help page to the client

Arguments:

    pecb - The EXTENSION_CONTROL_BLOCK for the request

    Note that we assume that the response will fit into our
    string buffer, and don't take any action to prevent a
    problem with this (since the client can't do anything
    to increase the size of the response).

Returns:

    HSE_STATUS_SUCCESS

--*/
{
    CHAR    szContent[STRING_BUFFER+1] = {0};
    DWORD   cbToSend;

    _snprintf(
        szContent,
        STRING_BUFFER,
        "<html>\r\n"
        "<head> <title> %s.dll </title> </head>\r\n"
        "<h1> %s.dll </h1>\r\n"
        "A simple extension to demonstrate PoolWrap.cpp."
        "<hr>\r\n"
        "A request with no query string, or an invalid query "
        "string, will return this page.  The following querys "
        "will produce the specified results:<br>\r\n"
        "<br>\r\n"
        "<code>http://server/DemoPoolWrap.dll?statistics</code><br>\r\n"
        "Returns some statistics from this extension <br><br>\r\n"
        "<code>http://server/DemoPoolWrap.dll?&lttime&gt</code><br>\r\n"
        "Returns a page after waiting on a blocking call for the "
        "specified number of milliseconds <br><br>\r\n"
        "<code>http://server/DemoPoolWrap.dll?&ltmin-time&gt+&ltmax-time&gt</code><br>\r\n"
        "Returns a page after waiting on a blocking call for a random "
        "interval in the specified range in milliseconds",
        MODULE_NAME,
        MODULE_NAME
        );

    cbToSend = strlen( szContent );

    SendHeaders(
        pecb,
        "200 OK",
        "Content-Type: text/html\r\n\r\n",
        cbToSend
        );

    pecb->WriteClient(
        pecb->ConnID,
        szContent,
        &cbToSend,
        HSE_IO_SYNC | HSE_IO_NODELAY
        );

    return HSE_STATUS_SUCCESS;
}

DWORD SendStatisticsPage ( EXTENSION_CONTROL_BLOCK * pecb )

Definition at line 446 of file Extension.cpp.

       :

    Returns the statistics page to the client.

    Note that we assume that the response will fit into our
    string buffer, and don't take any action to prevent a
    problem with this (since the client can't do anything
    to increase the size of the response).

Arguments:

    pecb - The EXTENSION_CONTROL_BLOCK for the request

Returns:

    HSE_STATUS_SUCCESS

--*/
{
    CHAR    szContent[STRING_BUFFER+1];
    CHAR    szStartTime[64];
    CHAR    szTime[32];
    CHAR    szDate[32];
    DWORD   cbToSend;

    //
    // Generate the start time stamp
    //

    GetLocalTime( &g_StartTime );

  GetTimeFormat(
        LOCALE_SYSTEM_DEFAULT,
        0,
        &g_StartTime,
        "HH':'mm':'ss",
        szTime,
        32
        );

  GetDateFormat(
        LOCALE_SYSTEM_DEFAULT,
        0,
        &g_StartTime,
        "ddd',' MMM dd yyyy",
        szDate,
        32
        );

    wsprintf( szStartTime, "[%s - %s] ", szDate, szTime );

    //
    // Generate the response
    //

    _snprintf(
        szContent,
        STRING_BUFFER,
        "<html>\r\n"
        "<head> <title> %s.dll </title> </head>\r\n"
        "<h1> %s.dll Statistics:</h1>\r\n"
        "<hr>\r\n"
        "The extension was started at: %s<br>\r\n\r\n"
        "Total Pages Served: %d<br>\r\n"
        "Busy Pages Served: %d<br>",
        MODULE_NAME,
        MODULE_NAME,
        szStartTime,
        g_TotalRequests,
        g_QueueFullPages
        );

    cbToSend = strlen( szContent );

    SendHeaders(
        pecb,
        "200 OK",
        "Content-Type: text/html\r\n\r\n",
        cbToSend
        );

    pecb->WriteClient(
        pecb->ConnID,
        szContent,
        &cbToSend,
        HSE_IO_SYNC | HSE_IO_NODELAY
        );

    return HSE_STATUS_SUCCESS;
}

BOOL WINAPI TerminateExtension ( DWORD dwFlags )

Definition at line 285 of file Extension.cpp.

       :

    This is optional ISAPI extension DLL entry point.
    If present, it will be called before unloading the DLL,
    giving it a chance to perform any shutdown procedures.

Arguments:

    dwFlags - Specifies whether the DLL can refuse to unload or not.  Note
              that the case where refusal is allowed is not supported and
              should not be expected.

Returns:

    TRUE, if the DLL can be unloaded

--*/
{
    switch ( dwFlags )
    {
    case HSE_TERM_ADVISORY_UNLOAD:

        //
        // Return TRUE if ok to unload or FALSE if not.
        //
        // This case is not expected to occur
        //

        return TRUE;

    case HSE_TERM_MUST_UNLOAD:

        //
        // Cannot refuse to unload
        //

        return TRUE;
    }

    return TRUE;
}

VOID UninitThread ( VOID )

Definition at line 96 of file Extension.cpp.

{
    //
    // Don't do any special uninitialization
    //

    return;
}

Variable Documentation

SYSTEMTIME g_StartTime

Definition at line 47 of file Extension.cpp.

Generated on Wed Nov 13 2024 16:54:23 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/ISAPI_6.0/PoolWrap/PoolWrap.cpp File Reference

  • Web
  • iis
  • ISAPI_6.0
  • PoolWrap
Defines | Functions | Variables

PoolWrap.cpp File Reference

#include <stdio.h>
#include <stdarg.h>
#include <windows.h>
#include <httpext.h>
#include "PoolWrap.h"

Go to the source code of this file.

Defines

#define | _WIN32_WINNT 0x0500
#define | DEFAULT_QUEUE 10
#define | DEFAULT_THREADS 5
#define | LOG_MAX_LINE 1024
#define | RESPONSE_MAX_BUFFER 1024

Functions

BOOL | AllocateAndFormatErrorMessage (DWORD dwError, LPSTR *ppBuffer)
BOOL WINAPI | GetExtensionVersionWrapper (HSE_VERSION_INFO *pVer)
DWORD WINAPI | HttpExtensionProcWrapper (EXTENSION_CONTROL_BLOCK *pecb)
BOOL | InitThreadPool (DWORD dwQueueSize, DWORD dwNumThreads)
BOOL | IsapiWriteLog (LPSTR szString,...)
BOOL | QueueRequest (EXTENSION_CONTROL_BLOCK *pecb)
DWORD | SendExtensionInitFailed (EXTENSION_CONTROL_BLOCK *pecb)
DWORD | SendQueueFull (EXTENSION_CONTROL_BLOCK *pecb)
BOOL | SendThreadInitFailed (EXTENSION_CONTROL_BLOCK *pecb, DWORD dwError)
VOID | ShutdownThreadPool (VOID)
BOOL WINAPI | TerminateExtensionWrapper (DWORD dwFlags)
DWORD WINAPI | WorkerThreadProc (VOID *pVoid)

Variables

DWORD g_cchQueueFullHeaders
DWORD g_cchQueueFullResponse
BOOL | g_EnableLogging = TRUE
HANDLE | g_hCompletionPort = NULL
HANDLE | g_hLogFile = INVALID_HANDLE_VALUE
DWORD | g_InitResultCode = ERROR_SUCCESS
BOOL | g_InitSuccess = TRUE
LONG | g_ItemsInQueue = 0
CRITICAL_SECTION | g_LogFileLock
DWORD | g_NumThreads = 0
HANDLE * | g_pThreads = NULL
CHAR | g_QueueFullHeaders [RESPONSE_MAX_BUFFER+1] = {0}
LONG | g_QueueFullPages = 0
CHAR | g_QueueFullResponse [RESPONSE_MAX_BUFFER+1] = {0}
LONG | g_QueueSize = 0
LONG | g_TotalRequests = 0
BOOL | g_UseThreadPool = TRUE

Define Documentation

#define _WIN32_WINNT 0x0500

Definition at line 17 of file PoolWrap.cpp.

#define DEFAULT_QUEUE 10

Definition at line 30 of file PoolWrap.cpp.

#define DEFAULT_THREADS 5

Definition at line 29 of file PoolWrap.cpp.

#define LOG_MAX_LINE 1024

Definition at line 31 of file PoolWrap.cpp.

#define RESPONSE_MAX_BUFFER 1024

Definition at line 32 of file PoolWrap.cpp.

Function Documentation

BOOL AllocateAndFormatErrorMessage | ( | DWORD | dwError,
 |  | LPSTR * | ppBuffer
 | ) |  |

Definition at line 1526 of file PoolWrap.cpp.

       :

    Maps an error code into a text message into a new buffer.
    The caller needs to free the buffer with LocalFree when done.

Arguments:

    dwError  - The error to map.
    ppBuffer - Upon successful return, the error text buffer

Returns:

    TRUE on success, FALSE on failure

--*/
{
    BOOL    fResult;

    fResult = FormatMessage(
        FORMAT_MESSAGE_ALLOCATE_BUFFER |
        FORMAT_MESSAGE_IGNORE_INSERTS |
        FORMAT_MESSAGE_FROM_SYSTEM,
        NULL,
        dwError,
        0,
        reinterpret_cast<CHAR*>( ppBuffer ),
        0,
        NULL
        );

    IsapiWriteLog(
        "FormatMessage failed. Error %d.\r\n",
        GetLastError()
        );

    return fResult;
}

BOOL WINAPI GetExtensionVersionWrapper ( HSE_VERSION_INFO * pVer )

Definition at line 147 of file PoolWrap.cpp.

       :

    This function wraps GetExtensionVersion.  If GetExtensionVersion
    succeeds, this wrapper then creates a thread pool and queue for
    processing requests.

Arguments:

    pVer - poins to extension version info structure

Returns:

    Always returns TRUE.  In the event of a FALSE return from
    GetExtensionVersion, or an error creating the thread pool,
    the result code will be stored.  Any requests to this extension
    will then return an error page.

--*/
{
    CHAR    szPath[MAX_PATH+1] = {0};
    CHAR    szLogFile[MAX_PATH+1] = {0};
    LPSTR   pCursor;

    //
    // Before doing anything, get the path to this extension.  This
    // will be used to find the INI file and open the log file.
    //
    // Note that we'll avoid crashing if an error occurs during this
    // phase of initialization, but we don't have any way of logging
    // errors until we open the log file (and if we fail to open the
    // log file, we won't ever be able to log errors.)
    //

    GetModuleFileName(
        GetModuleHandle( MODULE_NAME ),
        szPath,
        MAX_PATH
        );

    pCursor = strrchr( szPath, '.' );

    if ( pCursor )
    {
        *pCursor = '\0';

        //
        // Set the log file name
        //

        strcpy( szLogFile, szPath );
        strcat( szLogFile, ".log" );

        //
        // Now tweak the path so that it points
        // to the INI file for this extension
        //

        strcat( szPath, ".ini" );
    }

    //
    // Check to see if logging is enabled
    //

    g_EnableLogging = GetPrivateProfileInt(
        "ThreadPool",
        "EnableLogging",
        1, // Enable logging TRUE by default
        szPath
        );

    if ( g_EnableLogging )
    {
        //
        // Open the log file.  We'll allow read sharing so that the log
        // can be read while the extension is running.  Don't bother to
        // check for error, since we couldn't report it, and the
        // IsapiWriteLog function is smart enough to deal with it.
        //
        // In the event of a successful call, though, we will set the
        // last error to ERROR_SUCCESS, in case CreateFile set it to
        // ERROR_ALREADY_EXISTS.
        //

        g_hLogFile = CreateFile(
            szLogFile,
            GENERIC_WRITE,
            FILE_SHARE_READ,
            NULL,
            OPEN_ALWAYS,
            FILE_ATTRIBUTE_NORMAL,
            NULL
            );
    }

    //
    // Initialize the log file lock.  From now on, the IsapiWriteLog
    // function is available for use.
    //

    if ( g_hLogFile != INVALID_HANDLE_VALUE )
    {
        SetLastError( ERROR_SUCCESS );
        InitializeCriticalSection( &g_LogFileLock );
    }

    //
    // Call the "real" GetExtensionVersion
    //

    g_InitSuccess = GetExtensionVersion( pVer );

    if ( g_InitSuccess == FALSE )
    {
        goto InitFailed;
    }

    //
    // Read thread pool settings from INI file
    //

    g_UseThreadPool = GetPrivateProfileInt(
        "ThreadPool",
        "UseThreadPool",
        1, // UseThreadPool = TRUE by default
        szPath
        );

    if ( g_UseThreadPool == 0 )
    {
        //
        // Don't initialize the thread pool, just return TRUE
        //

        IsapiWriteLog(
            "Extension %s configured to not use thread pool.\r\n",
            MODULE_NAME
            );

        return TRUE;
    }

    g_NumThreads = GetPrivateProfileInt(
        "ThreadPool",
        "NumThreads",
        0,
        szPath
        );

    g_QueueSize = GetPrivateProfileInt(
        "ThreadPool",
        "QueueSize",
        0,
        szPath
        );

    //
    // A zero value for either g_NumThreads or g_Queue size means that
    // we should use the defaults.  Also, don't let the number of threads
    // exceed the queue size.
    //

    if ( g_NumThreads == 0 )
    {
        g_NumThreads = DEFAULT_THREADS;
    }

    if ( g_QueueSize == 0 )
    {
        g_QueueSize = DEFAULT_QUEUE;
    }

    if ( g_NumThreads > static_cast<DWORD>( g_QueueSize ) )
    {
        g_NumThreads = g_QueueSize;
    }

    //
    // Build the "queue full" response.  Since this is supposed to
    // happen when the server is busy, we'll create it here at init
    // time, so that we only have to blast it out at run time.
    //

    _snprintf(
        g_QueueFullResponse,
        RESPONSE_MAX_BUFFER,
        "<html>\r\n"
        "<head><title> Extension '%s.dll' too busy </title></head>\r\n"
        "<h1> Extension '%s.dll' Too Busy. </h1>\r\n"
        "<hr>\r\n"
        "Extension '%s.dll' is too busy right now.  Please try your "
        "request again in a few minutes.\r\n"
        "</html>",
        MODULE_NAME,
        MODULE_NAME,
        MODULE_NAME
        );

    g_cchQueueFullResponse = strlen( g_QueueFullResponse );

    _snprintf(
        g_QueueFullHeaders,
        RESPONSE_MAX_BUFFER,
        "Content-Type: text/html\r\n"
        "Content-Length: %d\r\n"
        "\r\n",
        g_cchQueueFullResponse
        );

    g_cchQueueFullHeaders = strlen( g_QueueFullHeaders );

    //
    // Initialize the pool and queue
    //

    g_InitSuccess = InitThreadPool( g_QueueSize, g_NumThreads );

    if ( g_InitSuccess == FALSE )
    {
        goto InitFailed;
    }

    IsapiWriteLog(
        "Successfully initialized thread pool. QueueSize=%d, "
        "NumThreads=%d.\r\n",
        g_QueueSize,
        g_NumThreads
        );

    //
    // That's it, we're ready to go
    //

    return TRUE;

InitFailed:

    g_InitResultCode = GetLastError();

    IsapiWriteLog(
        "Attempt to initialize %s.dll failed with error %d.\r\n",
        MODULE_NAME,
        g_InitResultCode
        );

    return TRUE;
}

DWORD WINAPI HttpExtensionProcWrapper ( EXTENSION_CONTROL_BLOCK * pecb )

Definition at line 402 of file PoolWrap.cpp.

       :

    This function handles queuing requests to be picked up by
    worker threads.  Before processing, it checks for a successful
    initialization.  If initialization failed, it sends back an
    error page to the client.  If it cannot successfully queue the
    request, it will return a "busy" page to the client (since the
    only practical reason for a queue failure is that the queue is
    full).

Arguments:

    pecb - A pointer to the EXTENSION_CONTROL_BLOCK for this request

Returns:

    One of the HSE_STATUS result codes

--*/
{
    BOOL    fResult;

    InterlockedIncrement( &g_TotalRequests );

    //
    // First, check to see if the extension initialized OK.
    //

    if ( g_InitSuccess == FALSE )
    {
        return SendExtensionInitFailed( pecb );
    }

    //
    // Check to see if we are using the thread pool.  If not,
    // then just call the "real" HttpExtensionProc
    //

    if ( g_UseThreadPool == FALSE )
    {
        return HttpExtensionProc( pecb );
    }

    //
    // Now attempt to queue the request.  If not successful,
    // send the "too busy" page.
    //

    fResult = QueueRequest( pecb );

    if ( fResult == FALSE )
    {
        return SendQueueFull( pecb );
    }

    //
    // Ok, so the request has been queued.  Return HSE_STATUS_PENDING
    // now.
    //

    return HSE_STATUS_PENDING;
}

BOOL InitThreadPool | ( | DWORD | dwQueueSize,
 |  | DWORD | dwNumThreads
 | ) |  |

Definition at line 533 of file PoolWrap.cpp.

       :

    This function initializes the thread pool and queue to the
    specified sizes

Arguments:

    dwQueueSize  - The size of the request queue
    dwNumThreads - The number of threads in the pool

Returns:

    TRUE on success, FALSE on failure

--*/
{
    DWORD   dwError = ERROR_SUCCESS;
    DWORD   dwThreadId;
    DWORD   x;

    //
    // If not using a thread pool, return now
    //

    if ( g_UseThreadPool == FALSE )
    {
        SetLastError( ERROR_INVALID_PARAMETER );
        return FALSE;
    }

    //
    // Initialize the queue item count
    //

    g_ItemsInQueue = 0;

    //
    // Allocate storage for the thread handles
    //

    g_pThreads = reinterpret_cast<HANDLE*>( LocalAlloc(
        LPTR,
        g_NumThreads * sizeof( HANDLE * )
        ) );

    if ( g_pThreads == NULL )
    {
        IsapiWriteLog(
            "Insufficient memory to allocate thread handle storage.\r\n"
            );

        SetLastError( ERROR_NOT_ENOUGH_MEMORY );

        goto InitFailed;
    }

    //
    // Create the completion port for the thread pool
    //

    g_hCompletionPort = CreateIoCompletionPort(
        INVALID_HANDLE_VALUE,
        NULL,
        0,
        0
        );

    if ( g_hCompletionPort == NULL )
    {
        IsapiWriteLog(
            "Error %d occured creating the pool's completion port.\r\n",
            GetLastError()
            );

        goto InitFailed;
    }

    //
    // Create the threads
    //

    for ( x = 0; x < g_NumThreads; x++ )
    {
        g_pThreads[x] = CreateThread(
            NULL,               // Security attributes
            0,                  // Stack size
            WorkerThreadProc,   // Start routine
            NULL,               // Parameter
            0,                  // Creation flags
            &dwThreadId         // ThreadId
            );

        if ( g_pThreads[x] == NULL )
        {
            IsapiWriteLog(
                "Error %d occured creating pool thread #%d.\r\n",
                GetLastError(),
                x
                );

            goto InitFailed;
        }
    }

    return TRUE;

InitFailed:

    dwError = GetLastError();

    //
    // ShutdownThreadPool is smart enough to clean up a partially
    // initialized pool.
    //

    ShutdownThreadPool();

    SetLastError( dwError );

    return FALSE;
}

BOOL IsapiWriteLog | ( | LPSTR | szString,
 |  |  | ...
 | ) |  |

Definition at line 1065 of file PoolWrap.cpp.

       :

    This function writes a line to the log for this extension using
    printf-style formatting.

Arguments:

    szString - The format string
    ...      - Additional arguments

Returns:

    TRUE on success, FALSE on failure

--*/
{
    SYSTEMTIME  st;
    CHAR        szCookedString[LOG_MAX_LINE+1];
    CHAR        szTime[32];
    CHAR        szDate[32];
    CHAR        szTimeStamp[64];
    INT         cchCookedString;
    DWORD       cbToWrite;
    va_list     args;
    BOOL        fResult;

    //
    // If we don't have a log file handle, just return
    //

    if ( g_hLogFile == INVALID_HANDLE_VALUE )
    {
        SetLastError( ERROR_FILE_NOT_FOUND );
        return FALSE;
    }

    //
    // Apply formatting to the string
    //

    va_start( args, szString );

    cchCookedString = _vsnprintf(
        szCookedString,
        LOG_MAX_LINE,
        szString,
        args
        );

    va_end(args);

    //
    // Generate the time stamp
    //

    GetLocalTime( &st );

  GetTimeFormat(
        LOCALE_SYSTEM_DEFAULT,
        0,
        &st,
        "HH':'mm':'ss",
        szTime,
        32
        );

  GetDateFormat(
        LOCALE_SYSTEM_DEFAULT,
        0,
        &st,
        "ddd',' MMM dd yyyy",
        szDate,
        32
        );

    wsprintf( szTimeStamp, "[%s - %s] ", szDate, szTime );

    //
    // Acquire the lock and write out the log entry
    //

    EnterCriticalSection( &g_LogFileLock );

    SetFilePointer( g_hLogFile, 0, NULL, FILE_END );

    cbToWrite = strlen( szTimeStamp );

    WriteFile(
        g_hLogFile,
        szTimeStamp,
        cbToWrite,
        &cbToWrite,
        NULL
        );

    cbToWrite = cchCookedString;

    fResult = WriteFile(
        g_hLogFile,
        szCookedString,
        cbToWrite,
        &cbToWrite,
        NULL
        );

    LeaveCriticalSection( &g_LogFileLock );

  return fResult;
}

BOOL QueueRequest ( EXTENSION_CONTROL_BLOCK * pecb )

Definition at line 800 of file PoolWrap.cpp.

       :

    This function queues a request and signals the pool so that it
    can be picked up by the next available thread

Arguments:

    pecb - The EXTENSION_CONTROL_BLOCK for the request to be queued

Returns:

    TRUE on success, FALSE on failure

--*/
{
    LONG    lItems;
    BOOL    fResult;

    //
    // Can't do this if not using the thread pool
    //

    if ( g_UseThreadPool == FALSE )
    {
        SetLastError( ERROR_INVALID_PARAMETER );
        return FALSE;
    }

    //
    // Increment the number of items in the queue.  If this call
    // pushes us over the limit, then back down the count and return
    // FALSE
    //

    lItems = InterlockedIncrement( &g_ItemsInQueue );

    if ( lItems > g_QueueSize )
    {
        InterlockedDecrement( &g_ItemsInQueue );

        //
        // If we return ERROR_SUCCESS and FALSE, then the caller knows
        // that the queue is full.
        //

        SetLastError( ERROR_SUCCESS );

        return FALSE;
    }

    //
    // Post a completion for this action.  This will release a pool
    // thread.  Note that we are overloading LPOVERLAPPED to pass
    // the EXTENSION_CONTROL_BLOCK to the worker thread.
    //

    fResult = PostQueuedCompletionStatus(
        g_hCompletionPort,
        0,
        0,
        reinterpret_cast<LPOVERLAPPED>( pecb )
        );

    if ( fResult == FALSE )
    {
        IsapiWriteLog(
            "Failed to post completion.  Error %d.\r\n",
            GetLastError()
            );

        InterlockedDecrement( &g_ItemsInQueue );

        return FALSE;
    }

    return TRUE;
}

DWORD SendExtensionInitFailed ( EXTENSION_CONTROL_BLOCK * pecb )

Definition at line 1182 of file PoolWrap.cpp.

       :

    Sends back a message to the client in the event that initialization
    of this extension failed.

Arguments:

    pecb - Pointer to the EXTENSION_CONTROL_BLOCK for this request

Returns:

    HSE_STATUS_ERROR

--*/
{
    HSE_SEND_HEADER_EX_INFO HeaderInfo;
    CHAR                    szResponse[RESPONSE_MAX_BUFFER+1] = {0};
    CHAR                    szHeaders[RESPONSE_MAX_BUFFER+1] = {0};
    CHAR                    szDefaultError[64] = {0};
    LPSTR                   szTranslatedError = NULL;\
    LPSTR                   szError = NULL;
    DWORD                   cbToWrite;
    DWORD                   cchResponse;
    DWORD                   cchError;
    BOOL                    fResult;

    //
    // Build the response and error information
    //

    _snprintf(
        szResponse,
        RESPONSE_MAX_BUFFER,
        "<html>\r\n"
        "<head><title> Extension '%s.dll' not initialized </title></head>\r\n"
        "<h1> Extension '%s.dll' Not Initialized. </h1>\r\n"
        "Extension '%s.dll' failed to initialize with the following error. "
        "Please notify the administrator for this site."
        "<hr>\r\n",
        MODULE_NAME,
        MODULE_NAME,
        MODULE_NAME
        );

    cchResponse = strlen( szResponse );

    fResult = AllocateAndFormatErrorMessage(
        g_InitResultCode,
        &szTranslatedError
        );

    if ( fResult == FALSE )
    {
        _snprintf(
            szDefaultError,
            63,
            "%d (0x%08x)\r\n"
            "</html>",
            g_InitResultCode,
            g_InitResultCode
            );

        szError = szDefaultError;
    }
    else
    {
        szError = szTranslatedError;
    }

    cchError = strlen( szError );

    //
    // Send the response to the client
    //

    _snprintf(
        szHeaders,
        RESPONSE_MAX_BUFFER,
        "Content-Type: text/html\r\n"
        "Content-Length: %d\r\n"
        "\r\n",
        cchResponse + cchError
        );

    HeaderInfo.pszStatus = "500 Server Error";
    HeaderInfo.pszHeader = szHeaders;
    HeaderInfo.cchStatus = strlen( HeaderInfo.pszStatus );
    HeaderInfo.cchHeader = strlen( HeaderInfo.pszHeader );
    HeaderInfo.fKeepConn = TRUE;

    pecb->ServerSupportFunction(
        pecb->ConnID,
        HSE_REQ_SEND_RESPONSE_HEADER_EX,
        &HeaderInfo,
        NULL,
        NULL
        );

    cbToWrite = cchResponse;

    pecb->WriteClient(
        pecb->ConnID,
        szResponse,
        &cbToWrite,
        HSE_IO_SYNC
        );

    cbToWrite = cchError;

    pecb->WriteClient(
        pecb->ConnID,
        szError,
        &cbToWrite,
        HSE_IO_SYNC
        );

    //
    // Clean up the formatted error if we got it
    //

    if ( szTranslatedError != NULL )
    {
        LocalFree( szTranslatedError );
        szTranslatedError = NULL;
    }

    return HSE_STATUS_ERROR;
}

DWORD SendQueueFull ( EXTENSION_CONTROL_BLOCK * pecb )

Definition at line 1317 of file PoolWrap.cpp.

       :

    Sends back a "too busy" message to the client.  Note that
    all of the parts of the response were created at extension
    init time, so that we can just blast the result back to the
    client (since presumably, the server is really busy when
    this function is called.)

Arguments:

    pecb - Pointer to the EXTENSION_CONTROL_BLOCK for this request

Returns:

    HSE_STATUS_ERROR

--*/
{
    HSE_SEND_HEADER_EX_INFO HeaderInfo;
    DWORD                   cbToWrite;

    InterlockedIncrement( &g_QueueFullPages );

    HeaderInfo.pszStatus = "500 Server Error";
    HeaderInfo.cchStatus = 16; // length of "500 Server Error"
    HeaderInfo.pszHeader = g_QueueFullHeaders;
    HeaderInfo.cchHeader = g_cchQueueFullHeaders;
    HeaderInfo.fKeepConn = TRUE;

    cbToWrite = g_cchQueueFullResponse;

    pecb->ServerSupportFunction(
        pecb->ConnID,
        HSE_REQ_SEND_RESPONSE_HEADER_EX,
        &HeaderInfo,
        NULL,
        NULL
        );

    pecb->WriteClient(
        pecb->ConnID,
        g_QueueFullResponse,
        &cbToWrite,
        HSE_IO_SYNC
        );

    return HSE_STATUS_ERROR;
}

BOOL SendThreadInitFailed | ( | EXTENSION_CONTROL_BLOCK * | pecb,
 |  | DWORD | dwError
 | ) |  |

Definition at line 1372 of file PoolWrap.cpp.

       :

    Sends a response back to the client indicating that the
    thread failed to initialize.

Arguments:

    pecb     - Pointer to the EXTENSION_CONTROL_BLOCK for the request
    dwError  - The initialization error

Returns:

    TRUE on success, FALSE on failure

--*/
{
    HSE_SEND_HEADER_EX_INFO HeaderInfo;
    CHAR                    szResponse[RESPONSE_MAX_BUFFER+1] = {0};
    CHAR                    szHeaders[RESPONSE_MAX_BUFFER+1] = {0};
    CHAR                    szDefaultError[64] = {0};
    LPSTR                   szTranslatedError = NULL;\
    LPSTR                   szError = NULL;
    DWORD                   cbToWrite;
    DWORD                   cchResponse;
    DWORD                   cchError;
    DWORD                   HseResult;
    BOOL                    fResult;

    //
    // Build the response and error information
    //

    _snprintf(
        szResponse,
        RESPONSE_MAX_BUFFER,
        "<html>\r\n"
        "<head><title> Extension '%s.dll' error. </title></head>\r\n"
        "<h1> Extension '%s.dll' failed to fully initialize. </h1>\r\n"
        "Extension '%s.dll': Thread %d failed to initialize with the "
        "following error.  Please notify the administrator for this site."
        "<hr>\r\n",
        MODULE_NAME,
        MODULE_NAME,
        MODULE_NAME,
        GetCurrentThreadId()
        );

    cchResponse = strlen( szResponse );

    fResult = AllocateAndFormatErrorMessage(
        dwError,
        &szTranslatedError
        );

    if ( fResult == FALSE )
    {
        _snprintf(
            szDefaultError,
            63,
            "%d (0x%08x)\r\n"
            "</html>",
            dwError,
            dwError
            );

        szError = szDefaultError;
    }
    else
    {
        szError = szTranslatedError;
    }

    cchError = strlen( szError );

    //
    // Send the response to the client
    //

    _snprintf(
        szHeaders,
        RESPONSE_MAX_BUFFER,
        "Content-Type: text/html\r\n"
        "Content-Length: %d\r\n"
        "\r\n",
        cchResponse + cchError
        );

    HeaderInfo.pszStatus = "500 Server Error";
    HeaderInfo.pszHeader = szHeaders;
    HeaderInfo.cchStatus = strlen( HeaderInfo.pszStatus );
    HeaderInfo.cchHeader = strlen( HeaderInfo.pszHeader );
    HeaderInfo.fKeepConn = TRUE;

    pecb->ServerSupportFunction(
        pecb->ConnID,
        HSE_REQ_SEND_RESPONSE_HEADER_EX,
        &HeaderInfo,
        NULL,
        NULL
        );

    cbToWrite = cchResponse;

    pecb->WriteClient(
        pecb->ConnID,
        szResponse,
        &cbToWrite,
        HSE_IO_SYNC
        );

    cbToWrite = cchError;

    pecb->WriteClient(
        pecb->ConnID,
        szError,
        &cbToWrite,
        HSE_IO_SYNC
        );

    //
    // Since this error is always called on pending request,
    // we need to call DONE_WITH_SESSION
    //

    HseResult = HSE_STATUS_ERROR;

    pecb->ServerSupportFunction(
        pecb->ConnID,
        HSE_REQ_DONE_WITH_SESSION,
        &HseResult,
        NULL,
        NULL
        );

    //
    // Clean up the formatted error if we got it
    //

    if ( szTranslatedError != NULL )
    {
        LocalFree( szTranslatedError );
        szTranslatedError = NULL;
    }

    return TRUE;
}

VOID ShutdownThreadPool ( VOID )

Definition at line 662 of file PoolWrap.cpp.

       :

    This function shuts down the thread pool and queue and deallocates
    any existing associated structures

Arguments:

    None

Returns:

    None

--*/
{
    DWORD   dwBlockIndex;
    DWORD   dwThreadsRemaining;
    DWORD   dwWaitCount;
    DWORD   x;

    //
    // If we're not using the thread pool, do nothing
    //

    if ( g_UseThreadPool == FALSE )
    {
        return;
    }

    //
    // If the completion port has been created and we have threads,
    // post completions with a NULL LPOVERLAPPED for each thread in
    // the pool, and delete it.  By setting LPOVERLAPPED to NULL,
    // we are signalling the threads that it's time to quit.
    //

    if ( g_hCompletionPort )
    {
        if ( g_pThreads != NULL )
        {
            for ( x = 0; x < g_NumThreads; x++ )
            {
                PostQueuedCompletionStatus(
                    g_hCompletionPort,
                    0,
                    0,
                    NULL
                    );
            }
        }

        CloseHandle( g_hCompletionPort );
        g_hCompletionPort = NULL;
    }

    if ( g_pThreads == NULL )
    {
        //
        // If no threads - we're done
        //

        goto Done;
    }

    //
    // Now wait for each of the threads to exit.  Note that we'll wait
    // an infinite amount of time here.
    //
    // There are only two conditions in which we'd expect to see
    // ShutdownThreadPool called: in the event of an init failure, or
    // when the TerminateExtension is called by the server.  In each
    // of these cases, we expect that all of the pool threads are
    // idle (TerminateExtension isn't called until all pending requests
    // are cleaned up).  As a result, we expect them to exit very
    // quickly.
    //
    // The only real action we could take in the event some thread
    // didn't exit would be to terminate it.  TerminateThread is documented
    // to be a dangerous function in that it leaks lots of resources, and
    // doesn't allow the thread to complete any work it's doing.  As such,
    // the remedy would be as bad as the problem - the process would be
    // in a potentially unstable state.  Consequently, we'll make no
    // attempt to recover from a thread that doesn't exit.
    //

    dwBlockIndex = 0;
    dwThreadsRemaining = g_NumThreads;

    while ( dwThreadsRemaining )
    {
        dwWaitCount =
            ( dwThreadsRemaining < MAXIMUM_WAIT_OBJECTS ) ?
            dwThreadsRemaining :
            MAXIMUM_WAIT_OBJECTS;

        WaitForMultipleObjects(
            dwWaitCount,
            g_pThreads + ( dwBlockIndex * MAXIMUM_WAIT_OBJECTS ),
            TRUE,
            INFINITE
            );

        dwThreadsRemaining -= dwWaitCount;
        dwBlockIndex++;
    }

    //
    // Close our handles for each thread
    //

    for ( x = 0; x < g_NumThreads; x++ )
    {
        CloseHandle( g_pThreads[x] );
        g_pThreads[x] = NULL;
    }

    //
    // Finally, deallocate the thread handle storage buffer
    //

    LocalFree( g_pThreads );
    g_pThreads = NULL;

Done:

    g_QueueSize = 0;
    g_NumThreads = 0;
    g_ItemsInQueue = 0;

    return;
}

BOOL WINAPI TerminateExtensionWrapper ( DWORD dwFlags )

Definition at line 472 of file PoolWrap.cpp.

       :

    This function wraps TerminateExtension.  After calling
    TerminateExtension, it cleans up the queue and thread pool
    for this extension.

    Note that the TerminateExtension function implies that it
    is possible for an extension to refuse terminatation.  This
    feature was never implemented, so this wrapper always
    returns TRUE.

Arguments:

    dwFlags - Inidication that termination is optional (note
              that this will never happen)

Returns:

    Always returns TRUE.

--*/
{
    IsapiWriteLog(
        "Extension %s.dll terminating.\r\n",
        MODULE_NAME
        );

    //
    // Call the "real" TerminateExtension.  We don't need
    // its return value
    //

    TerminateExtension( dwFlags );

    //
    // Clean up the thread pool
    //

    ShutdownThreadPool();

    //
    // Close the log file
    //

    if ( g_hLogFile != INVALID_HANDLE_VALUE )
    {
        CloseHandle( g_hLogFile );
        g_hLogFile = INVALID_HANDLE_VALUE;

        DeleteCriticalSection( &g_LogFileLock );
    }

    return TRUE;
}

DWORD WINAPI WorkerThreadProc ( VOID * pVoid )

Definition at line 885 of file PoolWrap.cpp.

       :

    This function implements the worker thread loop that dispatches
    calls to the "real" HttpExtensionProc.

Arguments:

    pVoid - Required by CreateThread; not used.

Returns:

    Always returns 0

--*/
{
    EXTENSION_CONTROL_BLOCK *   pecb;
    HANDLE                      hToken = NULL;
    DWORD                       cbIo;
    DWORD                       dwKey;
    DWORD                       dwInitResultCode = ERROR_SUCCESS;
    DWORD                       dwThreadId;
    DWORD                       dwError;
    DWORD                       HseResult;
    BOOL                        fInitSuccess = TRUE;
    BOOL                        fCompletionResult = TRUE;

    dwThreadId = GetCurrentThreadId();

    //
    // Call the thread initialization function
    //

    fInitSuccess = InitThread();

    if ( fInitSuccess == FALSE )
    {
        dwInitResultCode = GetLastError();

        IsapiWriteLog(
            "Attempt to initialized thread %d failed.  Error %d.\r\n",
            dwThreadId,
            dwInitResultCode
            );
    }

    while ( TRUE )
    {
        //
        // Wait for some work
        //

        fCompletionResult = GetQueuedCompletionStatus(
            g_hCompletionPort,
            &cbIo,
            &dwKey,
            reinterpret_cast<LPOVERLAPPED*>( &pecb ),
            INFINITE
            );

        dwError = GetLastError();

        //
        // Before doing anything else, back down the queue item count
        //

        InterlockedDecrement( &g_ItemsInQueue );

        if ( fCompletionResult == FALSE )
        {
            IsapiWriteLog(
                "Thread %d: GetQueuedCompletionStatus failed with error %d. "
                "Thread will terminate.\r\n",
                dwThreadId,
                dwError
                );

            break;
        }

        //
        // If pecb is NULL, then we are supposed to exit the thread, else
        // we'll process the request.
        //

        if ( pecb == NULL )
        {
            break;
        }

        //
        // If the thread initialization failed, return an error to the
        // client
        //

        if ( fInitSuccess == FALSE )
        {
            SendThreadInitFailed( pecb, dwInitResultCode );
            continue;
        }

        //
        // Impersonate the authenticated user
        //

        pecb->ServerSupportFunction(
            pecb->ConnID,
            HSE_REQ_GET_IMPERSONATION_TOKEN,
            &hToken,
            NULL,
            NULL
            );

        ImpersonateLoggedOnUser( &hToken );

        //
        // Finally, call into the "real" HttpExtensionProc.  If it returns
        // HSE_STATUS_PENDING, then we're done.  Otherwise, we'll need to
        // call HSE_REQ_DONE_WITH_SESSION and pass along the result.
        //
        // Note that there is a potential incompatibility with the
        // HSE_STATUS_PENDING case.  Specifically, IIS cleans up the ECB in
        // such a way that both HttpExtensionProc must return, and
        // HSE_REQ_DONE_WITH_SESSION must be called (assuming a pending
        // extension) before IIS frees the ECB.
        //
        // If this wrapper is used with an extension that depends on this
        // protection from IIS, then a potential crash could occur in the
        // "real" HttpExtensionProc if DONE_WITH_SESSION occurs before it
        // returns with HSE_STATUS_PENDING.  This is because the wrapper
        // already returned STATUS_PENDING before we get here.  Thus, the
        // ECB will get freed immediately upon DONE_WITH_SESSION, even if
        // the "real" HttpExtensionProc hasn't returned yet.
        //
        // This won't be a problem if the "real" HttpExtensionProc doesn't
        // touch the ECB after DONE_WITH_SESSION could potentially be
        // called.
        //
        // And just a final note that any extension that already returns
        // HSE_STATUS_PENDING is not a good candidate to be wrapped by
        // PoolWrap, since it's already asynchronous in nature.
        //

        HseResult = HttpExtensionProc( pecb );

        RevertToSelf();
        hToken = NULL;

        if ( HseResult == HSE_STATUS_PENDING )
        {
            continue;
        }

        pecb->ServerSupportFunction(
            pecb->ConnID,
            HSE_REQ_DONE_WITH_SESSION,
            &HseResult,
            NULL,
            NULL
            );

        //
        // Done, just let the thread loop around and wait again.
        //
    }

    //
    // Uninitialize the thread
    //

    UninitThread();

    return 0;
}

Variable Documentation

DWORD g_cchQueueFullHeaders

Definition at line 48 of file PoolWrap.cpp.

DWORD g_cchQueueFullResponse

Definition at line 47 of file PoolWrap.cpp.

BOOL g_EnableLogging = TRUE

Definition at line 57 of file PoolWrap.cpp.

HANDLE g_hCompletionPort = NULL

Definition at line 40 of file PoolWrap.cpp.

HANDLE g_hLogFile = INVALID_HANDLE_VALUE

Definition at line 55 of file PoolWrap.cpp.

DWORD g_InitResultCode = ERROR_SUCCESS

Definition at line 52 of file PoolWrap.cpp.

BOOL g_InitSuccess = TRUE

Definition at line 51 of file PoolWrap.cpp.

LONG g_ItemsInQueue = 0

Definition at line 41 of file PoolWrap.cpp.

CRITICAL_SECTION g_LogFileLock

Definition at line 56 of file PoolWrap.cpp.

DWORD g_NumThreads = 0

Definition at line 43 of file PoolWrap.cpp.

HANDLE* g_pThreads = NULL

Definition at line 39 of file PoolWrap.cpp.

CHAR g_QueueFullHeaders[RESPONSE_MAX_BUFFER+1] = {0}

Definition at line 46 of file PoolWrap.cpp.

LONG g_QueueFullPages = 0

Definition at line 60 of file PoolWrap.cpp.

CHAR g_QueueFullResponse[RESPONSE_MAX_BUFFER+1] = {0}

Definition at line 45 of file PoolWrap.cpp.

LONG g_QueueSize = 0

Definition at line 42 of file PoolWrap.cpp.

LONG g_TotalRequests = 0

Definition at line 61 of file PoolWrap.cpp.

BOOL g_UseThreadPool = TRUE

Definition at line 44 of file PoolWrap.cpp.

Generated on Wed Nov 13 2024 16:54:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/ISAPI_6.0/PoolWrap/PoolWrap.h File Reference

  • Web
  • iis
  • ISAPI_6.0
  • PoolWrap
Defines | Functions | Variables

PoolWrap.h File Reference

Go to the source code of this file.

Defines

#define | MODULE_NAME "DemoPoolWrap"

Functions

BOOL | InitThread (VOID)
BOOL | IsapiWriteLog (LPSTR szString,...)
VOID | UninitThread (VOID)

Variables

LONG | g_QueueFullPages
LONG | g_TotalRequests

Define Documentation

#define MODULE_NAME "DemoPoolWrap"

Definition at line 17 of file PoolWrap.h.

Function Documentation

BOOL InitThread ( VOID )

Definition at line 84 of file Extension.cpp.

{
    //
    // Don't do any special initialization
    //

    return TRUE;
}

BOOL IsapiWriteLog | ( | LPSTR | szString,
 |  |  | ...
 | ) |  |

Definition at line 1065 of file PoolWrap.cpp.

       :

    This function writes a line to the log for this extension using
    printf-style formatting.

Arguments:

    szString - The format string
    ...      - Additional arguments

Returns:

    TRUE on success, FALSE on failure

--*/
{
    SYSTEMTIME  st;
    CHAR        szCookedString[LOG_MAX_LINE+1];
    CHAR        szTime[32];
    CHAR        szDate[32];
    CHAR        szTimeStamp[64];
    INT         cchCookedString;
    DWORD       cbToWrite;
    va_list     args;
    BOOL        fResult;

    //
    // If we don't have a log file handle, just return
    //

    if ( g_hLogFile == INVALID_HANDLE_VALUE )
    {
        SetLastError( ERROR_FILE_NOT_FOUND );
        return FALSE;
    }

    //
    // Apply formatting to the string
    //

    va_start( args, szString );

    cchCookedString = _vsnprintf(
        szCookedString,
        LOG_MAX_LINE,
        szString,
        args
        );

    va_end(args);

    //
    // Generate the time stamp
    //

    GetLocalTime( &st );

  GetTimeFormat(
        LOCALE_SYSTEM_DEFAULT,
        0,
        &st,
        "HH':'mm':'ss",
        szTime,
        32
        );

  GetDateFormat(
        LOCALE_SYSTEM_DEFAULT,
        0,
        &st,
        "ddd',' MMM dd yyyy",
        szDate,
        32
        );

    wsprintf( szTimeStamp, "[%s - %s] ", szDate, szTime );

    //
    // Acquire the lock and write out the log entry
    //

    EnterCriticalSection( &g_LogFileLock );

    SetFilePointer( g_hLogFile, 0, NULL, FILE_END );

    cbToWrite = strlen( szTimeStamp );

    WriteFile(
        g_hLogFile,
        szTimeStamp,
        cbToWrite,
        &cbToWrite,
        NULL
        );

    cbToWrite = cchCookedString;

    fResult = WriteFile(
        g_hLogFile,
        szCookedString,
        cbToWrite,
        &cbToWrite,
        NULL
        );

    LeaveCriticalSection( &g_LogFileLock );

  return fResult;
}

VOID UninitThread ( VOID )

Definition at line 96 of file Extension.cpp.

{
    //
    // Don't do any special uninitialization
    //

    return;
}

Variable Documentation

LONG g_QueueFullPages

Definition at line 60 of file PoolWrap.cpp.

LONG g_TotalRequests

Definition at line 61 of file PoolWrap.cpp.

Generated on Wed Nov 13 2024 16:54:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/ISAPI_6.0/ReMapUrl/ReMapUrl.cpp File Reference

  • Web
  • iis
  • ISAPI_6.0
  • ReMapUrl
Defines | Functions | Variables

ReMapUrl.cpp File Reference

#include <IsapiTools.h>

Go to the source code of this file.

Defines

#define | DEFAULT_ALLOW_UNMAPPED 1
#define | MAX_CONFIG_LINE 1024
#define | MODULE_NAME "ReMapUrl"
#define | REDIRECT_ENTITY

Functions

DWORD | DoCustomError (EXTENSION_CONTROL_BLOCK *pecb, CHAR *szConfigLine)
BOOL WINAPI | GetExtensionVersion (HSE_VERSION_INFO *pVer)
BOOL | GetMapping (CHAR *szUrl, ISAPI_STRING *pstrMapping)
VOID WINAPI | HandleCompletion (EXTENSION_CONTROL_BLOCK *pecb, VOID *pContext, DWORD cbIo, DWORD dwError)
DWORD WINAPI | HttpExtensionProc (EXTENSION_CONTROL_BLOCK *pecb)
BOOL | SendRedirectResponse (EXTENSION_CONTROL_BLOCK *pecb, CHAR *szLocation)
VOID | TrimCommentAndTrailingWhitespace (CHAR *szString)

Variables

ISAPI_STRING g_strIniFile

Define Documentation

#define DEFAULT_ALLOW_UNMAPPED 1

Definition at line 22 of file ReMapUrl.cpp.

#define MAX_CONFIG_LINE 1024

Definition at line 21 of file ReMapUrl.cpp.

#define MODULE_NAME "ReMapUrl"

Definition at line 20 of file ReMapUrl.cpp.

#define REDIRECT_ENTITY
Value:
"<head><title>Document Moved</title></head>\r\n" \
    "<body><h1>Object Moved</h1>This document may "  \
    "be found <a HREF=\"%s\">here</a></body>"

Definition at line 24 of file ReMapUrl.cpp.

Function Documentation

DWORD DoCustomError | ( | EXTENSION_CONTROL_BLOCK * | pecb,
 |  | CHAR * | szConfigLine
 | ) |  |

Definition at line 562 of file ReMapUrl.cpp.

{
    HSE_CUSTOM_ERROR_INFO   CustomError;
    ISAPI_REQUEST           Request( pecb );
    ISAPI_STRING            strStatus;
    ISAPI_STRING            strAlternateEntity;
    USHORT                  uSubStatus;
    CHAR *                  pCursor;

    //
    // We expect the config line to be in the
    // form:
    //
    //   500,13,Server Too Busy
    //

    if ( strStatus.Copy( szConfigLine ) == FALSE )
    {
        goto Failed;
    }

    pCursor = strchr( strStatus.QueryStr(), ',' );

    if ( !pCursor )
    {
        SetLastError( ERROR_INVALID_PARAMETER );

        goto Failed;
    }

    *pCursor = '\0';

    strStatus.CalcLen();

    pCursor++;

    uSubStatus = atoi( pCursor );

    pCursor = strchr( pCursor, ',' );

    if ( !pCursor )
    {
        SetLastError( ERROR_INVALID_PARAMETER );

        goto Failed;
    }

    if ( strAlternateEntity.Copy( pCursor+1 ) == FALSE )
    {
        goto Failed;
    }

    //
    // Set up for an asynchronous call to HSE_REQ_SEND_CUSTOM_ERROR
    //

    if ( strStatus.Append( " " ) == FALSE ||
         strStatus.Append( strAlternateEntity.QueryStr() ) == FALSE )
    {
        goto Failed;
    }

    CustomError.pszStatus = strStatus.QueryStr();
    CustomError.uHttpSubError = uSubStatus;
    CustomError.fAsync = TRUE;

    if ( pecb->ServerSupportFunction( pecb->ConnID,
                                      HSE_REQ_IO_COMPLETION,
                                      &HandleCompletion,
                                      NULL,
                                      NULL ) == FALSE )
    {
        goto Failed;
    }

    if ( pecb->ServerSupportFunction( pecb->ConnID,
                                      HSE_REQ_SEND_CUSTOM_ERROR,
                                      &CustomError,
                                      NULL,
                                      NULL ) == TRUE )
    {
        //
        // The async call succeeded.  We need to return STATUS_PENDING
        // without doing anything else to the ECB.
        //

        return HSE_STATUS_PENDING;
    }

    //
    // If we get here, then the asynchronous call failed. We'll go
    // ahead and send back a synchronous error manually.
    //

    if ( Request.SyncWriteCompleteResponse( strStatus.QueryStr(),
                                            "Content-Type: text/plain\r\n\r\n",
                                            strAlternateEntity.QueryStr() ) == FALSE )
    {
        goto Failed;
    }

    return HSE_STATUS_SUCCESS;

Failed:

    WriteDebug( "DoCustomError failed.  Error %d.\r\n",
                GetLastError() );

    return SyncSendGenericServerError( pecb );
}

BOOL WINAPI GetExtensionVersion ( HSE_VERSION_INFO * pVer )

Definition at line 66 of file ReMapUrl.cpp.

       :

    Entry point for ISAPI extension initialization.  Required.

    This function will be called exactly once in the lifetime
    of the extension, at initialization time.  This function is
    a useful point to do complex initialization tasks.  This
    function is called outside of the system loader lock, so
    it does not have the same restrictions as DllMain.

Arguments:

    pVer - points to extension version info structure

Returns:

    TRUE on success, FALSE on failure.

    Note that in the case of FALSE, IIS will call GetLastError()
    and return an error page to the client.  The entity body of
    the page may be textual if the FormatMessage API can resolve
    it, or it may just be an error number if FormatMessage can't
    resolve it.

--*/
{
    ISAPI_EXTENSION Extension;
    //
    // Tell IIS which version of ISAPI this extension was built from.
    //

    pVer->dwExtensionVersion = MAKELONG( HSE_VERSION_MINOR,
                                         HSE_VERSION_MAJOR);

    //
    // Report the description string for this extension.  Ensure
    // that it does not exceed the maximum length and is NULL
    // terminated.
    //

    strncpy( pVer->lpszExtensionDesc,
             "ReMapUrl ISAPI Sample",
             HSE_MAX_EXT_DLL_NAME_LEN );

    pVer->lpszExtensionDesc[HSE_MAX_EXT_DLL_NAME_LEN-1] = '\0';

    //
    // Get the INI filename
    //

    InitializeIsapiTools( MODULE_NAME );

    if ( Extension.Initialize( MODULE_NAME ) == FALSE )
    {
        goto Failed;
    }

    if ( g_strIniFile.Printf( "%s\\%s.ini",
                              Extension.QueryModulePath(),
                              MODULE_NAME ) == FALSE )
    {
        goto Failed;
    }

    //
    // Return TRUE if we successfully initialized.
    //

    return TRUE;

Failed:

    WriteDebug( "GetExtensionVersion failed. Error %d.\r\n",
                GetLastError() );

    return FALSE;
}

BOOL GetMapping | ( | CHAR * | szUrl,
 |  | ISAPI_STRING * | pstrMapping
 | ) |  |

Definition at line 510 of file ReMapUrl.cpp.

{
    //
    // Make sure that the output string is
    // at least as big as our config line
    //

    if ( pstrMapping->ResizeBuffer( MAX_CONFIG_LINE ) == FALSE )
    {
        goto Failed;
    }

    GetPrivateProfileString( "Mappings",
                             szUrl,
                             "",
                             pstrMapping->QueryStr(),
                             pstrMapping->QueryBufferSize(),
                             g_strIniFile.QueryStr() );

    if ( *pstrMapping->QueryStr() == 0 )
    {
        //
        // If we didn't get a mapping the first time, try
        // to get the default
        //

        GetPrivateProfileString( "Mappings",
                                 "Default",
                                 "",
                                 pstrMapping->QueryStr(),
                                 pstrMapping->QueryBufferSize(),
                                 g_strIniFile.QueryStr() );
    }

    TrimCommentAndTrailingWhitespace( pstrMapping->QueryStr() );

    pstrMapping->CalcLen();

    return TRUE;

Failed:

    WriteDebug( "GetMapping failed. Error %d.\r\n",
                GetLastError() );

    return FALSE;
}

VOID WINAPI HandleCompletion | ( | EXTENSION_CONTROL_BLOCK * | pecb,
 |  | VOID * | pContext,
 |  | DWORD | cbIo,
 |  | DWORD | dwError
 | ) |  |

Definition at line 330 of file ReMapUrl.cpp.

{
    HSE_EXEC_URL_STATUS ExecUrlStatus;
    BOOL                fIsExecCompletion = (DWORD)pContext;
    BOOL                fResult = TRUE;

    //
    // If this is not an EXEC_URL completion, then we can just
    // skip to calling DONE_WITH_SESSION.  Otherwise, we need
    // to check the result of the child.
    //

    if ( !fIsExecCompletion )
    {
        goto Done;
    }

    fResult = pecb->ServerSupportFunction( pecb->ConnID,
                                           HSE_REQ_GET_EXEC_URL_STATUS,
                                           &ExecUrlStatus,
                                           NULL,
                                           NULL );

    if ( !fResult )
    {
        goto Done;
    }

    //
    // If the status is 403.18, then that means that we tried to
    // redirect to another URL on this site, but in another
    // app pool.  In that case. the best we can do is to try a
    // 302 redirect.
    //
    // Note that we are rebuilding the remapping information here.
    // The reason for this is that we are optimizing for the case
    // when the EXEC_URL call works.  We don't want to do a heap
    // allocation in that case if we can avoid it, so we aren't
    // passing it as context to this completion routine.
    //

    if ( ExecUrlStatus.uHttpStatusCode == 403 &&
         ExecUrlStatus.uHttpSubStatus == 18 )
    {
        ISAPI_REQUEST   Request( pecb );
        ISAPI_STRING    strUrl;
        ISAPI_STRING    strMapping;

        fResult = Request.GetServerVariable( "SCRIPT_NAME",
                                             &strUrl );

        if ( !fResult )
        {
            goto Done;
        }

        fResult = GetMapping( strUrl.QueryStr(), &strMapping );

        if ( !fResult )
        {
            goto Done;
        }

        if ( pecb->lpszQueryString[0] != '\0' )
        {
            fResult = strMapping.Append( "?" );

            if ( !fResult )
            {
                goto Done;
            }

            fResult = strMapping.Append( pecb->lpszQueryString );

            if ( !fResult )
            {
                goto Done;
            }
        }

        fResult = SendRedirectResponse( pecb,
                                        strMapping.QueryStr() );

        if ( !fResult )
        {
            SyncSendGenericServerError( pecb );
        }
    }
    else
    {
        //
        // Just set the ECB's status member to match the child's
        // result
        //

        pecb->dwHttpStatusCode = ExecUrlStatus.uHttpStatusCode;
    }

Done:

    if ( !fResult )
    {
        WriteDebug( "Error processing I/O completion.  Error %d.\r\n",
                    GetLastError() );
    }

    //
    // Notify IIS that we are done with the request
    //

    pecb->ServerSupportFunction( pecb->ConnID,
                                 HSE_REQ_DONE_WITH_SESSION,
                                 NULL,
                                 NULL,
                                 NULL );
}

DWORD WINAPI HttpExtensionProc ( EXTENSION_CONTROL_BLOCK * pecb )

Definition at line 151 of file ReMapUrl.cpp.

       :

    Entry point for ISAPI requests.  Required.

    This function is called once per request.  The EXTENSION_CONTROL_BLOCK
    passed in contains information and function pointers sufficient to
    interact with the server during this processing.

    Note that, once HttpExtensionProc is called, it is the responsibility
    of the extension to send back any data that the client should receive.
    IIS will not automatically generate any response, even in the case of
    HSE_STATUS_ERROR once the request has progressed to the point where
    this function is called.

    Also note that you should not make any blocking calls or do long-running
    operations within this function.  To allow efficient scaling of your
    server, you should consider creating a pool of private threads to handle
    the requests.  In that case, the implementation of this function would
    be just to add the pecb to a queue and return HSE_STATUS_PENDING.  The
    threads in the pool would be responsible for dequeing a pecb and calling
    HSE_REQ_DONE_WITH_SESSION when they are finished processing it.

Arguments:

    pecb - pointer to the extenstion control block

Returns:

    HSE_STATUS_SUCCESS - Indicates successful request.
    HSE_STATUS_ERROR   - Indicates failed request.
    HSE_STATUS_PENDING - Indicates that processing of the request
                         should continue after this function returns.
                         It HSE_STATUS_PENDING is used, it is necessary
                         that HSE_REQ_DONE_WITH_SESSION is called
                         exactly once when processing is completed for
                         the request.

--*/
{
    HSE_EXEC_URL_INFO   ExecUrlInfo = {0};
    ISAPI_STRING        strUrl;
    ISAPI_STRING        strMapping;
    ISAPI_REQUEST       Request( pecb );

    //
    // Get the current URL and check to see if we have a
    // mapping for it.
    //

    if ( Request.GetServerVariable( "SCRIPT_NAME",
                                    &strUrl ) == FALSE )
    {
        goto Failed;
    }

    if ( GetMapping( strUrl.QueryStr(), &strMapping ) == FALSE )
    {
        goto Failed;
    }

    //
    // Ok, so there are 4 scenarios here:
    //
    //  1 - The mapping is an empty string.  In that
    //      case, we should just run the original URL
    //  2 - The mapping starts with a numeric, in which
    //      case, we should parse it as a custom error
    //      mapping
    //  3 - The mapping starts with "http", in which
    //      case, we should redirect via a 302 response
    //  4 - Else, the mapping is a URL on this site
    //

    if ( strMapping.QueryCCH() == 0 )
    {
        goto CallExecUrl;
    }
    else if ( isdigit( *(strMapping.QueryStr()) ) )
    {
        return DoCustomError( pecb, strMapping.QueryStr() );
    }

    //
    // Ok, so we know that we will be doing some kind of redirect.
    //
    // If there is a query string on this request, append it to
    // the mapping data
    //

    if ( pecb->lpszQueryString[0] != '\0' )
    {
        if ( strMapping.Append( "?" ) == FALSE )
        {
            goto Failed;
        }

        if ( strMapping.Append( pecb->lpszQueryString ) == FALSE )
        {
            goto Failed;
        }
    }

    //
    // Do the appropriate redirect
    //

    if ( strnicmp( strMapping.QueryStr(), "http", 4 ) == 0 )
    {
        //
        // Do a 302.
        //

        if ( SendRedirectResponse( pecb, strMapping.QueryStr() ) == FALSE )
        {
            goto Failed;
        }

        return HSE_STATUS_SUCCESS;
    }

    //
    // Finally, if we fall through to here, then we are going to redirect
    // this request to another URL on this site.  We just need to point
    // at the new URL and call HSE_REQ_EXEC_URL.
    //

    ExecUrlInfo.pszUrl = strMapping.QueryStr();

    //
    // Fall through to CallExecUrl
    //

CallExecUrl:

    //
    // Set up the IO completion (passing TRUE as the context
    // will notify the completion routine that this is an
    // ExecUrl call.
    //

    if ( pecb->ServerSupportFunction( pecb->ConnID,
                                      HSE_REQ_IO_COMPLETION,
                                      HandleCompletion,
                                      NULL,
                                      (DWORD*)TRUE ) == FALSE )
    {
        goto Failed;
    }

    ExecUrlInfo.dwExecUrlFlags = HSE_EXEC_URL_IGNORE_CURRENT_INTERCEPTOR;

    if ( pecb->ServerSupportFunction( pecb->ConnID,
                                      HSE_REQ_EXEC_URL,
                                      &ExecUrlInfo,
                                      NULL,
                                      NULL ) == TRUE )
    {
        return HSE_STATUS_PENDING;
    }

    //
    // Fall through to error handler
    //

Failed:

    WriteDebug( "HttpExtensionProc failed.  Error %d.\r\n",
                GetLastError() );

    return SyncSendGenericServerError( pecb );
}

BOOL SendRedirectResponse | ( | EXTENSION_CONTROL_BLOCK * | pecb,
 |  | CHAR * | szLocation
 | ) |  |

Definition at line 677 of file ReMapUrl.cpp.

{
    ISAPI_REQUEST   Request( pecb );
    ISAPI_STRING    strEscapedLocation;
    ISAPI_STRING    strHeaders;

    //
    // Since this redirect might go to another machine,
    // we should be conscious of certain client behaviors.
    // Specifically, we want to make sure that the client
    // doesn't try and run any part of szLocation as a
    // script, especially the query string, since the query
    // string was originally submitted from an untrusted
    // source (the client).  To deal with this, we will
    // escape encode the instance of the location data that
    // appears in the entity body of the redirect response
    //

    if ( strEscapedLocation.Copy( szLocation ) == FALSE )
    {
        goto Failed;
    }

    if ( strEscapedLocation.Escape() == FALSE )
    {
        goto Failed;
    }

    if ( strHeaders.Printf( "Content-Type: text/html\r\n"
                            "Location: %s\r\n\r\n",
                            szLocation ) == FALSE )
    {
        goto Failed;
    }

    if ( Request.SyncWriteCompleteResponse( "302 Object Moved",
                                            strHeaders.QueryStr(),
                                            REDIRECT_ENTITY,
                                            strEscapedLocation.QueryStr() ) == FALSE )
    {
        goto Failed;
    }

    return TRUE;

Failed:

    WriteDebug( "SendRedirectResponse failed.  Error %d.\r\n",
                GetLastError() );

    return FALSE;
}

VOID TrimCommentAndTrailingWhitespace ( CHAR * szString )

Definition at line 453 of file ReMapUrl.cpp.

       :

    This function trims a text line from an INI file
    such that it's truncated at the first instance of
    a ';'. Any trailing whitespace is also removed.

Arguments:

    szString - The string to trim

Returns:

    None

--*/
{
    LPSTR   pCursor = szString;
    LPSTR   pWhite = NULL;

    while ( *pCursor )
    {
        if ( *pCursor == ';' )
        {
            *pCursor = '\0';
            break;
        }

        if ( *pCursor == ' ' || *pCursor == '\t' )
        {
            if ( !pWhite )
            {
                pWhite = pCursor;
            }
        }
        else
        {
            pWhite = NULL;
        }

        pCursor++;
    }

    if ( pWhite )
    {
        *pWhite = '\0';
    }

    return;
}

Variable Documentation

ISAPI_STRING g_strIniFile

Definition at line 30 of file ReMapUrl.cpp.

Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/ISAPI_6.0/src/IsapiBuffer.cpp File Reference

  • Web
  • iis
  • ISAPI_6.0
  • src
Defines | Functions

IsapiBuffer.cpp File Reference

#include <IsapiTools.h>

Go to the source code of this file.

Defines

#define | SIZE_ENCODED_CHUNK 4
#define | SIZE_UNENCODED_CHUNK 3

Functions

BOOL | Base64DecodeChunk (CHAR *szChunk, BYTE *pData, DWORD *pcbData)

Define Documentation

#define SIZE_ENCODED_CHUNK 4

Definition at line 19 of file IsapiBuffer.cpp.

#define SIZE_UNENCODED_CHUNK 3

Definition at line 20 of file IsapiBuffer.cpp.

Function Documentation

BOOL Base64DecodeChunk | ( | CHAR * | szChunk,
 |  | BYTE * | pData,
 |  | DWORD * | pcbData
 | ) |  |

Definition at line 603 of file IsapiBuffer.cpp.

       :

    Decodes a 4 byte base64 encoded chunk into 3 decoded bytes

Arguments:

    szChunk - The chunk to decode
    pData   - The buffer to store the chunk
    pcbData - Upon return, the number of bytes in the return buffer

Returns:

    TRUE on success, FALSE on failure

--*/
{
    DWORD   x;
    DWORD   cbChunk;

    BYTE szReverseTable[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                              0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                              0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                              0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                              0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                              0xff, 0xff, 0xff, 0x3e, 0xff, 0xff, 0xff, 0x3f,
                              0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b,
                              0x3c, 0x3d, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                              0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
                              0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
                              0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,
                              0x17, 0x18, 0x19, 0xff, 0xff, 0xff, 0xff, 0xff,
                              0xff, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
                              0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
                              0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30,
                              0x31, 0x32, 0x33, 0xff, 0xff, 0xff, 0xff, 0xff,
                              0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                              0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                              0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                              0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                              0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                              0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                              0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                              0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                              0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                              0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                              0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                              0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                              0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                              0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                              0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                              0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };

    //
    // Clear only the necessary output bytes.
    //
    // *** WARNING ***
    // We are making two assumptions here.  First, we assume
    // that pData is big enough to do this.  Second, we assume
    // that szChunk is always 4 bytes.  If either of these
    // assumptions are bad, we'll fail in a bad way.
    //

    if ( szChunk[2] == '=' )
    {
        *pcbData = 1;
        cbChunk = 2;
    }
    else if ( szChunk[3] == '=' )
    {
        *pcbData = 2;
        cbChunk = 3;
    }
    else
    {
        *pcbData = 3;
        cbChunk = 4;
    }

    ZeroMemory( pData, *pcbData );

    //
    // Reverse lookup the character mappings
    //

    for ( x = 0; x < cbChunk; x++ )
    {
        szChunk[x] = szReverseTable[szChunk[x]];

        if ( szChunk[x] == 0xff )
        {
            //
            // Hmmm.  This isn't a valid character
            // for a base64 encoded buffer.
            //

            SetLastError( ERROR_INVALID_PARAMETER );

            return FALSE;
        }
    }

    //
    // Shift bits per Base64 rules (originally defined in
    // RFC 1341, section 5.2)
    //

    for ( x = 0; x < cbChunk; x++ )
    {
        switch ( x )
        {
        case 0:

            pData[0] = szChunk[0] << 2;
            break;

        case 1:

            pData[0] |= ( szChunk[1] & 0x30 ) >> 4;
            pData[1] = ( szChunk[1] & 0xf ) << 4;
            break;

        case 2:

            pData[1] |= ( szChunk[2] & 0x3c ) >> 2;
            pData[2] = ( szChunk[2] & 0x3 ) << 6;
            break;

        case 3:

            pData[2] |= szChunk[3];
            break;
        }
    }

    return TRUE;
}

Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/ISAPI_6.0/src/IsapiDebug.cpp File Reference

  • Web
  • iis
  • ISAPI_6.0
  • src
Functions

IsapiDebug.cpp File Reference

#include <IsapiTools.h>
#include <stdio.h>

Go to the source code of this file.

Functions

VOID | IsapiAssert (CHAR *szExpr, CHAR *szFile, DWORD dwLine)
VOID | WriteDebug (CHAR *szFormat,...)
VOID | WriteDebugArgs (CHAR *szFormat, va_list args)

Function Documentation

VOID IsapiAssert | ( | CHAR * | szExpr,
 |  | CHAR * | szFile,
 |  | DWORD | dwLine
 | ) |  |

Definition at line 35 of file IsapiDebug.cpp.

       :

    Calls a DebugBreak and reports the expression, source
    filename, and line number to the debugger.

    This function is called by the ISAPI_ASSERT macro, which
    provides the expression, source file, and line information.

Arguments:

    szExpr - The expression that failed the assertion
    szFile - The name of the source file that contains the expression
    dwLine - The line number of the expression

Returns:

    None

--*/
{
    va_list args;

    args = (va_list)&szExpr;

    WriteDebugArgs( "ISAPIASSERT Failed:  \"%s\", File=\"%s\", Line=%d.\r\n",
                args );

    va_end( args );

    DebugBreak();
}

VOID WriteDebug | ( | CHAR * | szFormat,
 |  |  | ...
 | ) |  |

Definition at line 75 of file IsapiDebug.cpp.

       :

    Writes a line to an attached debugger using printf-style
    formatting.

Arguments:

    szFormat - The format string
    ...      - Zero or more additional arguments

Returns:

    None

--*/
{
    va_list args;

    va_start( args, szFormat );

    WriteDebugArgs( szFormat, args );

    va_end( args );
}

VOID WriteDebugArgs | ( | CHAR * | szFormat,
 |  | va_list | args
 | ) |  |

Definition at line 107 of file IsapiDebug.cpp.

       :

    Writes a line to an attached debugger using printf-style
    formatting and a va_list of args.

Arguments:

    szFormat - The format string
    args     - The va_list of additional arguments

Returns:

    None

--*/
{
    CHAR    szOutput[MAX_DEBUG_OUTPUT];
    INT     nWritten = 0;

    //
    // Put the module name into the output buffer.
    //

    nWritten = _snprintf( szOutput,
                          MAX_DEBUG_OUTPUT,
                          "[%s.dll] ",
                          g_szModuleName );

    if ( nWritten == -1 )
    {
        //
        // Ouch.  Buffer was too small for even the module name
        //

        return;
    }

    //
    // Now write the rest of the data into the buffer
    //

    nWritten = _vsnprintf( szOutput + nWritten,
                           MAX_DEBUG_OUTPUT - nWritten,
                           szFormat,
                           args );

    //
    // If we overran the buffer, truncate the data
    // with \r\n\0
    //

    if ( nWritten == -1 )
    {
        //
        // If, for some reason, we have a pathologically
        // small MAX_DEBUG_OUTPUT, don't overrun the buffer
        //

        if ( MAX_DEBUG_OUTPUT < 3 )
        {
            return;
        }

        szOutput[MAX_DEBUG_OUTPUT - 3] = '\r';
        szOutput[MAX_DEBUG_OUTPUT - 2] = '\n';
        szOutput[MAX_DEBUG_OUTPUT - 1] = '\0';
    }

    //
    // Write it
    //

    OutputDebugString( szOutput );
}

Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/ISAPI_6.0/src/IsapiExtension.cpp File Reference

  • Web
  • iis
  • ISAPI_6.0
  • src
Defines

IsapiExtension.cpp File Reference

#include <IsapiTools.h>

Go to the source code of this file.

Defines

#define _WIN32_WINNT 0x0500

Define Documentation

#define _WIN32_WINNT 0x0500

Definition at line 19 of file IsapiExtension.cpp.

Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/ISAPI_6.0/src/IsapiModule.cpp File Reference

  • Web
  • iis
  • ISAPI_6.0
  • src
Functions | Variables

IsapiModule.cpp File Reference

#include <IsapiTools.h>

Go to the source code of this file.

Functions

VOID | InitializeIsapiTools (CHAR *szModuleName)

Variables

CHAR | g_szModuleName [MAX_PATH+1] = "*UnknownIsapi*"

Function Documentation

VOID InitializeIsapiTools ( CHAR * szModuleName )

Definition at line 26 of file IsapiModule.cpp.

       :

    Initializes IsapiTools so that time function work
    correctly, and so that debug output contains the
    module name.

Arguments:

    szModuleName - The name of the dll (ie. "MyIsapi", without ".dll")

Returns:

    None

--*/
{
    //
    // Set the module name
    //

    if ( szModuleName != NULL )
    {
        strncpy( g_szModuleName, szModuleName, MAX_PATH );

        g_szModuleName[MAX_PATH] = '\0';
    }

    //
    // Initialize the time tools
    //

    InitializeIsapiTime();

    return;
}

Variable Documentation

CHAR g_szModuleName[MAX_PATH+1] = "*UnknownIsapi*"

Definition at line 23 of file IsapiModule.cpp.

Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/ISAPI_6.0/src/IsapiRequest.cpp File Reference

  • Web
  • iis
  • ISAPI_6.0
  • src
Defines | Functions

IsapiRequest.cpp File Reference

#include <IsapiTools.h>

Go to the source code of this file.

Defines

#define | SERVER_ERROR

Functions

DWORD | SyncSendGenericServerError (EXTENSION_CONTROL_BLOCK *pecb)

Define Documentation

#define SERVER_ERROR
Value:
"<html>\r\n"                                         \
    "<head> <title>500 Server Error</title> </head>\r\n" \
    "<h1> Server Error </h1>\r\n"                        \
    "<hr>\r\n"                                           \
    "The server was unable to process your request.\r\n" \
    "</html>"

Definition at line 24 of file IsapiRequest.cpp.

Function Documentation

DWORD SyncSendGenericServerError ( EXTENSION_CONTROL_BLOCK * pecb )

Definition at line 1931 of file IsapiRequest.cpp.

       :

    Synchronously sends a generic "500 Server Error" response

Arguments:

    pecb - The EXTENSION_CONTROL_BLOCK of this request

Returns:

    HSE_STATUS_ERROR

--*/
{
    ISAPI_REQUEST   Request( pecb );

    Request.SyncWriteCompleteResponse( "500 Server Error",
                                       "Content-Type: text/html\r\n\r\n",
                                       SERVER_ERROR );

    return HSE_STATUS_ERROR;
}

Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/ISAPI_6.0/src/IsapiString.cpp File Reference

  • Web
  • iis
  • ISAPI_6.0
  • src
Defines | Functions

IsapiString.cpp File Reference

#include <IsapiTools.h>
#include <stdio.h>

Go to the source code of this file.

Defines

#define | SIZE_ENCODED_CHUNK 4
#define | SIZE_UNENCODED_CHUNK 3
#define | UPCASE_ANSI_CHAR(c)

Functions

VOID | Base64EncodeChunk (BYTE *pData, DWORD cbData, CHAR szOutput[5])
BOOL | IsEscapeSequence (CHAR *str)
BOOL | ShouldEscape (BYTE c)

Define Documentation

#define SIZE_ENCODED_CHUNK 4

Definition at line 25 of file IsapiString.cpp.

#define SIZE_UNENCODED_CHUNK 3

Definition at line 26 of file IsapiString.cpp.

#define UPCASE_ANSI_CHAR ( c )
Value:
((((unsigned char)c & 0xdf) < 'A' || \
                              ((unsigned char)c & 0xdf) > 'Z') ? \
                              c : \
                              (c & 0xdf))

Definition at line 28 of file IsapiString.cpp.

Function Documentation

VOID Base64EncodeChunk | ( | BYTE * | pData,
 |  | DWORD | cbData,
 |  | CHAR | szOutput[5]
 | ) |  |

Definition at line 1113 of file IsapiString.cpp.

       :

    Base64 encodes up to 3 bytes of data into a 4 byte encoded chunk

Arguments:

    pData    - The data to encode
    cbData   - The number of bytes to encode
    szOutput - On return, contains the encoded chunk

Returns:

    TRUE on success, FALSE on failure

--*/
{
    DWORD   x;
    BYTE    szTable[] = "ABCDEFGH"
                        "IJKLMNOP"
                        "QRSTUVWX"
                        "YZabcdef"
                        "ghijklmn"
                        "opqrstuv"
                        "wxyz0123"
                        "456789+/";

    //
    // *** Warning ***
    //
    // This function assumes that the output buffer
    // is at least 5 bytes.  If this is not true,
    // then this function will overrun the output
    // buffer.
    //

    ZeroMemory( szOutput, 5 );

    //
    // Handle invalid input data
    //

    if ( cbData > 3 )
    {
        cbData = 3;
    }

    if ( !cbData )
    {
        return;
    }

    //
    // Do the bit shift shuffle...
    //

    for ( x = 0; x < cbData; x++ )
    {
        switch ( x )
        {
        case 0:

            szOutput[0] = pData[0] >> 2;
            szOutput[1] = ( pData[0] & 0x3 ) << 4;
            break;

        case 1:

            szOutput[1] |= ( pData[1] ) >> 4;
            szOutput[2] = ( pData[1] & 0xf ) << 2;
            break;

        case 2:

            szOutput[2] |= ( pData[2] >> 6 );
            szOutput[3] = pData[2] & 0x3f;
            break;
        }
    }

    //
    // Handle padding
    //

    if ( x < 3 )
    {
        szOutput[3] = '=';
    }

    if ( x < 2 )
    {
        szOutput[2] = '=';
    }

    //
    // Convert bits to mapped printable characters
    //

    do
    {
        szOutput[x] = szTable[szOutput[x]];
    } while ( x-- );

    //
    // Done
    //

    return;
}

BOOL IsEscapeSequence ( CHAR * str )

Definition at line 1230 of file IsapiString.cpp.

       :

    Determines whether the specified NULL terminated
    sequence of characters is an escape sequence (ie. %00).

Arguments:

    str - The NULL terminated string to consider

Returns:

    TRUE if yes, FALSE if no

--*/
{
    if ( *str == '%' &&
         isxdigit( *(str+1) ) &&
         isxdigit( *(str+2) ) )
    {
        return TRUE;
    }

    return FALSE;
}

BOOL ShouldEscape ( BYTE c )

Definition at line 1261 of file IsapiString.cpp.

       :

    Determines whether the specified character should
    be escape encoded, per RFC2396

Arguments:

    c - The character to consider

Returns:

    TRUE if yes, FALSE if no

--*/
{
    //
    // If the character is listed in RFC2396, section
    // 2.4.3 as control, space, delims or unwise, we
    // should escape it.  Also, we should escape characters
    // with the high bit set.
    //

    if ( c <= 0x1f ||
         c == 0x7f )
    {
        //
        // Control character
        //

        goto ReturnTrue;
    }

    if ( c >= 0x80 )
    {
        //
        // High bit set
        //

        goto ReturnTrue;
    }

    switch ( c )
    {

    //
    // space
    //
    case ' ':

    //
    // delims
    //
    case '<':
    case '>':
    case '#':
    case '%':
    case '\"':

    //
    // unwise
    //
    case '{':
    case '}':
    case '|':
    case '\\':
    case '^':
    case '[':
    case ']':
    case '`':

        goto ReturnTrue;
    }

    //
    // If we get here, then the character should not be
    // escaped
    //

    return FALSE;

ReturnTrue:

    return TRUE;
}

Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/ISAPI_6.0/src/IsapiStringW.cpp File Reference

  • Web
  • iis
  • ISAPI_6.0
  • src

IsapiStringW.cpp File Reference

#include <IsapiTools.h>
#include <stdio.h>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/ISAPI_6.0/src/IsapiTime.cpp File Reference

  • Web
  • iis
  • ISAPI_6.0
  • src
Defines | Functions | Variables

IsapiTime.cpp File Reference

#include <IsapiTools.h>

Go to the source code of this file.

Defines

#define | SIZE_DATE sizeof("ddd, dd MMM yyyy")
#define | SIZE_TIME sizeof("HH:mm:ss")
#define | SIZE_TIME_STRING sizeof("ddd, dd MMMM yyyy HH:mm:ss GMT")

Functions

DWORD64 | DiffFileTimeInMilliseconds (FILETIME *pft1, FILETIME *pft2)
DWORD | DiffFileTimeInSeconds (FILETIME *pft1, FILETIME *pft2)
BOOL | GetCurrentTimeAsFileTime (FILETIME *pft)
BOOL | GetCurrentTimeAsString (ISAPI_STRING *pString)
DWORD64 | GetCurrentTimeInMilliseconds (VOID)
DWORD | GetCurrentTimeInSeconds (VOID)
BOOL | GetFileTimeAsString (FILETIME *pft, ISAPI_STRING *pString)
BOOL | GetFileTimeFromString (FILETIME *pft, CHAR *szTimeString)
BOOL | InitializeIsapiTime (VOID)

Variables

FILETIME | g_ftInitTime = {0}

Define Documentation

#define SIZE_DATE sizeof("ddd, dd MMM yyyy")

Definition at line 28 of file IsapiTime.cpp.

#define SIZE_TIME sizeof("HH:mm:ss")

Definition at line 29 of file IsapiTime.cpp.

#define SIZE_TIME_STRING sizeof("ddd, dd MMMM yyyy HH:mm:ss GMT")

Definition at line 30 of file IsapiTime.cpp.

Function Documentation

DWORD64 DiffFileTimeInMilliseconds | ( | FILETIME * | pft1,
 |  | FILETIME * | pft2
 | ) |  |

Definition at line 571 of file IsapiTime.cpp.

       :

    Returns the difference, in milliseconds, between the two
    provided FILETIMEs

Arguments:

    pft1 - The first FILETIME
    pft2 - The second FILETIME

Returns:

    The difference, in milliseconds

--*/
{
    DWORD64 Time1;
    DWORD64 Time2;
    DWORD64 DiffTime;

    Time1 = ((LARGE_INTEGER*)pft1)->QuadPart;
    Time2 = ((LARGE_INTEGER*)pft2)->QuadPart;

    DiffTime = Time2 > Time1 ? Time2 - Time1 : Time1 - Time2;

    //
    // Return result, converted from 100 nanosecond intervals
    // to milliseconds.
    //

    return DiffTime / 10000;
}

DWORD DiffFileTimeInSeconds | ( | FILETIME * | pft1,
 |  | FILETIME * | pft2
 | ) |  |

Definition at line 545 of file IsapiTime.cpp.

       :

    Returns the difference, in seconds, between the two
    provided FILETIMEs

Arguments:

    pft1 - The first FILETIME
    pft2 - The second FILETIME

Returns:

    The difference, in seconds

--*/
{
    return (DWORD)(DiffFileTimeInMilliseconds( pft1, pft2 ) / 1000);
}

BOOL GetCurrentTimeAsFileTime ( FILETIME * pft )

Definition at line 143 of file IsapiTime.cpp.

       :

    Returns the current time in the provided FILETIME structure

Arguments:

    pft - Pointer to the target FILETIME

Returns:

    TRUE on success, FALSE on failure

--*/
{
    SYSTEMTIME  st;

    //
    // Get the current time in GMT
    //

    GetSystemTime( &st );

    return SystemTimeToFileTime( &st, pft );
}

BOOL GetCurrentTimeAsString ( ISAPI_STRING * pString )

Definition at line 505 of file IsapiTime.cpp.

       :

    Builds string in the following format from the current time:

      "Tue, 16 Oct 2002 20:25:00 GMT"

Arguments:

    pString - ISAPI_STRING to store the result

Returns:

    TRUE on success, FALSE on failure

--*/
{
    FILETIME    ft;

    if ( GetCurrentTimeAsFileTime( &ft ) == FALSE )
    {
        goto Failed;
    }

    return GetFileTimeAsString( &ft, pString );

Failed:

    //
    // No special cleanup required
    //

    return FALSE;
}

DWORD64 GetCurrentTimeInMilliseconds ( VOID )

Definition at line 89 of file IsapiTime.cpp.

       :

    Returns the number of milliseconds since InitializeIsapiTime was called.

Arguments:

    None

Returns:

    The number of milliseconds

--*/
{
    FILETIME    ftCurrent;

    //
    // If we haven't been initialized, just return 0
    //

    if ( ((LARGE_INTEGER*)&g_ftInitTime)->QuadPart == 0 )
    {
        SetLastError( ERROR_INVALID_PARAMETER );
        return 0;
    }

    //
    // Get the current time
    //
    // Note that GetCurrentTimeAsFileTime calls GetSystemTime,
    // which is a system call.  This introduces a performance
    // cost due to a kernel transition.  It would be possible
    // to use something like GetTickCount to obtain higher
    // performance, but GetTickCount returns a DWORD.  This
    // would introduce a rollover problem after about 49 days.
    //
    // This code favors correctness over performance in this
    // case.
    //

    if ( GetCurrentTimeAsFileTime( &ftCurrent ) == FALSE )
    {
        return 0;
    }

    return DiffFileTimeInMilliseconds( &g_ftInitTime, &ftCurrent );
}

DWORD GetCurrentTimeInSeconds ( VOID )

Definition at line 66 of file IsapiTime.cpp.

       :

    Returns the number of seconds since InitializeIsapiTime was called

Arguments:

    None

Returns:

    The number of seconds

--*/
{
    return (DWORD)(GetCurrentTimeInMilliseconds() / 1000);
}

BOOL GetFileTimeAsString | ( | FILETIME * | pft,
 |  | ISAPI_STRING * | pString
 | ) |  |

Definition at line 412 of file IsapiTime.cpp.

       :

    Builds string in the following format from the provided FILETIME:

      "Tue, 16 Oct 2002 20:25:00 GMT"

Arguments:

    pft     - The FILETIME
    pString - ISAPI_STRING to store the result

Returns:

    TRUE on success, FALSE on failure

--*/
{
    SYSTEMTIME  st;
    CHAR        szDate[SIZE_DATE];
    CHAR        szTime[SIZE_TIME];
    DWORD       cbCopied;
    BOOL        fResult;

    //
    // Convert the supplied time to a SYSTEMTIME
    //

    fResult = FileTimeToSystemTime( pft, &st );

    if ( !fResult )
    {
        goto Failed;
    }

    //
    // Get the date and time as strings
    //

    cbCopied = GetDateFormat( LOCALE_SYSTEM_DEFAULT,
                              0,
                              &st,
                              "ddd, dd MMM yyyy",
                              szDate,
                              SIZE_DATE );

    if ( cbCopied == 0 )
    {
        goto Failed;
    }

    cbCopied = GetTimeFormat( LOCALE_SYSTEM_DEFAULT,
                              0,
                              &st,
                              "HH:mm:ss",
                              szTime,
                              SIZE_TIME );

    if ( cbCopied == 0 )
    {
        goto Failed;
    }

    //
    // Build the final result into the string
    //

    fResult = pString->Printf( "%s %s GMT",
                               szDate,
                               szTime );

    if ( !fResult )
    {
        goto Failed;
    }

    return TRUE;

Failed:

    //
    // No special cleanup required
    //

    return FALSE;
}

BOOL GetFileTimeFromString | ( | FILETIME * | pft,
 |  | CHAR * | szTimeString
 | ) |  |

Definition at line 174 of file IsapiTime.cpp.

       :

    Returns a filetime, corresponding to the provided string,
    in the format of:

      "Tue, 16 Oct 2002 20:25:00 GMT"

Arguments:

    pft          - On return, contains the FILETIME data
    szTimeString - The string to parse for time

Returns:

    TRUE on success, FALSE on failure

--*/
{
    SYSTEMTIME  st;
    CHAR *      pCursor;

    ZeroMemory( &st, sizeof(SYSTEMTIME) );

    //
    // Build the members of the systemtime structure from
    // the input string.
    //

    pCursor = szTimeString;

    //
    // Get the day of week
    //

    if ( strnicmp( pCursor, "sun", 3 ) == 0 )
    {
        st.wDayOfWeek = 0;
    }
    else if ( strnicmp( pCursor, "mon", 3 ) == 0 )
    {
        st.wDayOfWeek = 1;
    }
    else if ( strnicmp( pCursor, "tue", 3 ) == 0 )
    {
        st.wDayOfWeek = 2;
    }
    else if ( strnicmp( pCursor, "wed", 3 ) == 0 )
    {
        st.wDayOfWeek = 3;
    }
    else if ( strnicmp( pCursor, "thu", 3 ) == 0 )
    {
        st.wDayOfWeek = 4;
    }
    else if ( strnicmp( pCursor, "fri", 3 ) == 0 )
    {
        st.wDayOfWeek = 5;
    }
    else if ( strnicmp( pCursor, "sat", 3 ) == 0 )
    {
        st.wDayOfWeek = 6;
    }
    else
    {
        SetLastError( ERROR_INVALID_PARAMETER );
        goto Failed;
    }

    //
    // Get the day
    //

    pCursor = strchr( pCursor, ' ' );

    if ( !pCursor )
    {
        SetLastError( ERROR_INVALID_PARAMETER );
        goto Failed;
    }

    pCursor++;

    st.wDay = atoi( pCursor );

    //
    // Get the month
    //

    pCursor = strchr( pCursor, ' ' );

    if ( !pCursor )
    {
        SetLastError( ERROR_INVALID_PARAMETER );
        goto Failed;
    }

    pCursor++;

    if ( strnicmp( pCursor, "jan", 3 ) == 0 )
    {
        st.wMonth = 1;
    }
    else if ( strnicmp( pCursor, "feb", 3 ) == 0 )
    {
        st.wMonth = 2;
    }
    else if ( strnicmp( pCursor, "mar", 3 ) == 0 )
    {
        st.wMonth = 3;
    }
    else if ( strnicmp( pCursor, "apr", 3 ) == 0 )
    {
        st.wMonth = 4;
    }
    else if ( strnicmp( pCursor, "may", 3 ) == 0 )
    {
        st.wMonth = 5;
    }
    else if ( strnicmp( pCursor, "jun", 3 ) == 0 )
    {
        st.wMonth = 6;
    }
    else if ( strnicmp( pCursor, "jul", 3 ) == 0 )
    {
        st.wMonth = 7;
    }
    else if ( strnicmp( pCursor, "aug", 3 ) == 0 )
    {
        st.wMonth = 8;
    }
    else if ( strnicmp( pCursor, "sep", 3 ) == 0 )
    {
        st.wMonth = 9;
    }
    else if ( strnicmp( pCursor, "oct", 3 ) == 0 )
    {
        st.wMonth = 10;
    }
    else if ( strnicmp( pCursor, "nov", 3 ) == 0 )
    {
        st.wMonth = 11;
    }
    else if ( strnicmp( pCursor, "dec", 3 ) == 0 )
    {
        st.wMonth = 12;
    }
    else
    {
        SetLastError( ERROR_INVALID_PARAMETER );
        goto Failed;
    }

    //
    // Get the year
    //

    pCursor = strchr( pCursor, ' ' );

    if ( !pCursor )
    {
        SetLastError( ERROR_INVALID_PARAMETER );
        goto Failed;
    }

    pCursor++;

    st.wYear = atoi( pCursor );

    //
    // Get the Hour
    //

    pCursor = strchr( pCursor, ' ' );

    if ( !pCursor )
    {
        SetLastError( ERROR_INVALID_PARAMETER );
        goto Failed;
    }

    pCursor++;

    st.wHour = atoi( pCursor );

    //
    // Get the minutes
    //

    pCursor = strchr( pCursor, ':' );

    if ( !pCursor )
    {
        SetLastError( ERROR_INVALID_PARAMETER );
        goto Failed;
    }

    pCursor++;

    st.wMinute = atoi( pCursor );

    //
    // Get the seconds
    //

    pCursor = strchr( pCursor, ':' );

    if ( !pCursor )
    {
        SetLastError( ERROR_INVALID_PARAMETER );
        goto Failed;
    }

    pCursor++;

    st.wSecond = atoi( pCursor );

    //
    // Now convert it to a filetime
    //

    return SystemTimeToFileTime( &st, pft );

Failed:

    //
    // No special cleanup required
    //

    return FALSE;
}

BOOL InitializeIsapiTime ( VOID )

Definition at line 35 of file IsapiTime.cpp.

       :

    Initializes IsapiTools time functions by initializing g_ftInitTime

Arguments:

    None

Returns:

    TRUE on success, FALSE on failure

--*/
{
    if ( ((LARGE_INTEGER*)&g_ftInitTime)->QuadPart == 0 )
    {
        if ( GetCurrentTimeAsFileTime( &g_ftInitTime ) == FALSE )
        {
            return FALSE;
        }
    }

    return TRUE;
}

Variable Documentation

FILETIME g_ftInitTime = {0}

Definition at line 32 of file IsapiTime.cpp.

Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/ISAPI_6.0/UpCaseMap/UpCaseMap.cpp File Reference

  • Web
  • iis
  • ISAPI_6.0
  • UpCaseMap
Defines | Functions

UpCaseMap.cpp File Reference

#include <IsapiTools.h>

Go to the source code of this file.

Defines

#define | _WIN32_WINNT 0x0500
#define | MAX_ALLOWED_REQUEST_ENTITY 64*1024
#define | UPCASE_ANSI_CHAR(c)

Functions

BOOL WINAPI | GetExtensionVersion (HSE_VERSION_INFO *pVer)
VOID WINAPI | HandleCompletion (EXTENSION_CONTROL_BLOCK *pecb, VOID *pContext, DWORD cbIO, DWORD dwError)
DWORD WINAPI | HttpExtensionProc (EXTENSION_CONTROL_BLOCK *pecb)

Define Documentation

#define _WIN32_WINNT 0x0500

Definition at line 33 of file UpCaseMap.cpp.

#define MAX_ALLOWED_REQUEST_ENTITY 64*1024

Definition at line 42 of file UpCaseMap.cpp.

#define UPCASE_ANSI_CHAR ( c )
Value:
((((unsigned char)c & 0xdf) < 'A' || \
                              ((unsigned char)c & 0xdf) > 'Z') ? \
                              c : \
                              (c & 0xdf))

Definition at line 44 of file UpCaseMap.cpp.

Function Documentation

BOOL WINAPI GetExtensionVersion ( HSE_VERSION_INFO * pVer )

Definition at line 68 of file UpCaseMap.cpp.

       :

    Entry point for ISAPI extension initialization.  Required.

    This function will be called exactly once in the lifetime
    of the extension, at initialization time.  This function is
    a useful point to do complex initialization tasks.  This
    function is called outside of the system loader lock, so
    it does not have the same restrictions as DllMain.

Arguments:

    pVer - points to extension version info structure

Returns:

    TRUE on success, FALSE on failure.

    Note that in the case of FALSE, IIS will call GetLastError()
    and return an error page to the client.  The entity body of
    the page may be textual if the FormatMessage API can resolve
    it, or it may just be an error number if FormatMessage can't
    resolve it.

--*/
{
    //
    // Tell IIS which version of ISAPI this extension was build from.
    //

    pVer->dwExtensionVersion = MAKELONG( HSE_VERSION_MINOR,
                                         HSE_VERSION_MAJOR);

    //
    // Report the description string for this extension.  Ensure
    // that it does not exceed the maximum length and is NULL
    // terminated.
    //

    strncpy( pVer->lpszExtensionDesc,
             "UpCaseMap Sample ISAPI Extension",
             HSE_MAX_EXT_DLL_NAME_LEN );

    pVer->lpszExtensionDesc[HSE_MAX_EXT_DLL_NAME_LEN-1] = '\0';

    //
    // Return TRUE if we successfully initialized.
    //

  return TRUE;
}

VOID WINAPI HandleCompletion | ( | EXTENSION_CONTROL_BLOCK * | pecb,
 |  | VOID * | pContext,
 |  | DWORD | cbIO,
 |  | DWORD | dwError
 | ) |  |

Definition at line 418 of file UpCaseMap.cpp.

{
    ISAPI_BUFFER * pEntity = (ISAPI_BUFFER*)pContext;

    //
    // The child is done.  Delete the entity buffer now.
    //

    if ( pEntity )
    {
        delete pEntity;
        pEntity = 0;
    }

    //
    // Let IIS know that we are done with the
    // ECB and return.
    //

    pecb->ServerSupportFunction( pecb->ConnID,
                                 HSE_REQ_DONE_WITH_SESSION,
                                 NULL,
                                 NULL,
                                 NULL );

}

DWORD WINAPI HttpExtensionProc ( EXTENSION_CONTROL_BLOCK * pecb )

Definition at line 127 of file UpCaseMap.cpp.

       :

    Entry point for ISAPI requests.  Required.

    This function is called once per request.  The EXTENSION_CONTROL_BLOCK
    passed in contains information and function pointers sufficient to
    interact with the server during this processing.

    Note that, once HttpExtensionProc is called, it is the responsibility
    of the extension to send back any data that the client should receive.
    IIS will not automatically generate any response, even in the case of
    HSE_STATUS_ERROR once the request has progressed to the point where
    this function is called.

    Also note that you should not make any blocking calls or do long-running
    operations within this function.  To allow efficient scaling of your
    server, you should consider creating a pool of private threads to handle
    the requests.  In that case, the implementation of this function would
    be just to add the pecb to a queue and return HSE_STATUS_PENDING.  The
    threads in the pool would be responsible for dequeing a pecb and calling
    HSE_REQ_DONE_WITH_SESSION when they are finished processing it.

Arguments:

    pecb - pointer to the extenstion control block

Returns:

    HSE_STATUS_SUCCESS - Indicates successful request.
    HSE_STATUS_ERROR   - Indicates failed request.
    HSE_STATUS_PENDING - Indicates that processing of the request
                         should continue after this function returns.
                         It HSE_STATUS_PENDING is used, it is necessary
                         that HSE_REQ_DONE_WITH_SESSION is called
                         exactly once when processing is completed for
                         the request.

--*/
{
    HSE_EXEC_URL_INFO           ExecUrlInfo;
    HSE_EXEC_URL_ENTITY_INFO    EntityInfo;
    ISAPI_BUFFER *              pbuffEntity = NULL;
    ISAPI_REQUEST               Request( pecb );
    BOOL                        fModifiedEntity = FALSE;

    //
    // If there is no entity body on this request, we
    // don't need to do any processing.
    //

    if ( pecb->cbTotalBytes == 0 )
    {
        goto CallExecUrl;
    }

    //
    // Since we are going to ultimately pass our entity buffer
    // to someone else, we need to allocate it on the heap, and
    // keep it valid until they are done.
    //

    pbuffEntity = new ISAPI_BUFFER();

    if ( !pbuffEntity )
    {
        goto Failed;
    }

    //
    // Set the maximum entity body that we will allow
    //

    pbuffEntity->SetMaxAlloc( MAX_ALLOWED_REQUEST_ENTITY );

    //
    // Read the entity body.  If we fail due to
    // ERROR_NOT_ENOUGH_MEMORY, then we'll send a 413
    // response, else we'll send a 500.
    //

    if ( !Request.ReadAllEntity( pbuffEntity ) )
    {
        //
        // Since we failed to read the entity, we can
        // clean up the buffer now.
        //

        delete pbuffEntity;
        pbuffEntity = NULL;

        if ( GetLastError() == ERROR_NOT_ENOUGH_MEMORY )
        {
            HSE_CUSTOM_ERROR_INFO CustomError;

            //
            // Send a 413 response synchronously using
            // HSE_REQ_SEND_CUSTOM_ERROR
            //

            CustomError.pszStatus = "413 Entity Too Large";
            CustomError.uHttpSubError = 0;
            CustomError.fAsync = FALSE;

            if ( pecb->ServerSupportFunction( pecb->ConnID,
                                              HSE_REQ_SEND_CUSTOM_ERROR,
                                              &CustomError,
                                              NULL,
                                              NULL ) == FALSE )
            {
                //
                // The custom error call failed (which is likely, since
                // IIS does not include a custom error for this by default).
                //
                // Go ahead and send it manually.
                //

                Request.SyncWriteCompleteResponse( "413 Entity Too Large",
                                                   "Content-Type: text/html\r\n\r\n",
                                                   "<html>\r\n"
                                                   "<head> <title> Entity Too Large "
                                                   "</head> </title>\r\n"
                                                   "<h1> 413 Entity Too Large </h1>\r\n"
                                                   "<hr>\r\n"
                                                   "The size of the request entity "
                                                   "is too large.\r\n"
                                                   "</html>");
            }

            return HSE_STATUS_ERROR;
        }

        goto Failed;
    }

    //
    // If the entity is a text type, then convert it to
    // upper case.
    //
    // Note that we could modify the entity body in any
    // way that we want to here.  When we pass the details
    // of the resulting buffer through the EXEC_URL call,
    // the request will be processed as if the client had
    // originally sent the contents of our buffer.
    //
    // This is substantially different than writing a
    // READ_RAW_DATA filter in IIS versions earlier than
    // 6.0 for a number of reasons.  For example:
    //
    // - It is easy to assemble the data in a single,
    //   contiguous chunk for parsing.
    // - We can change the size of the entity body and
    //   EXEC_URL will handle the details of making the
    //   child request properly recognize it.
    // - We could acquire the entity asynchronously (although
    //   this sample does not demonstrate async reads).
    // - We don't have to worry about writing logic to handle
    //   chunk transfer encoding.
    // - The request has been authenticed by the time this
    //   extension runs, so we don't have to worry about
    //   recognizing raw authentication data streams.
    //

    if ( strnicmp( pecb->lpszContentType, "text/", 5 ) == 0 )
    {
        //
        // Walk the entity body and convert ANSI characters
        // to upper case.  We won't use _strupr for this, since
        // it assumes that the data is NULL terminated.  This
        // is not necessarily true for HTTP entity bodies.
        //

        CHAR *  pCursor;

        //
        // Get a pointer to the start of the entity data.
        // Note that we will use QueryPtr, and not QueryStr.
        // The reason for this is that QueryStr enforces
        // NULL termination.  In the case where the entity
        // body is already the maximum allowed size, adding
        // the NULL will push the buffer one byte over and
        // cause it to fail to return the string (with
        // last error ERROR_NOT_ENOUGH_MEMORY).
        //

        pCursor = (CHAR*)pbuffEntity->QueryPtr();

        for ( DWORD x = 0; x < pbuffEntity->QueryDataSize(); x++ )
        {
            *(pCursor + x) = UPCASE_ANSI_CHAR( *(pCursor + x) );
        }

        fModifiedEntity = TRUE;
    }

    //
    // Associate our modified buffer with the child request
    //

    EntityInfo.lpbData = pbuffEntity->QueryPtr();
    EntityInfo.cbAvailable = pbuffEntity->QueryDataSize();

    //
    // Fall through
    //

CallExecUrl:

    //
    // Use EXEC_URL to pass the request along
    //
    // We will pass NULL for all of the parts of the request
    // that we don't want to modify.
    //
    // We will also use the HSE_EXEC_URL_IGNORE_CURRENT_INTERCEPTOR
    // flag.  This will ensure that UpCaseMap is not called again
    // on this request (which could otherwise happen in some cases).
    //

    ExecUrlInfo.pszUrl = NULL;
    ExecUrlInfo.pszMethod = NULL;
    ExecUrlInfo.pszChildHeaders = NULL;
    ExecUrlInfo.pUserInfo = NULL;
    ExecUrlInfo.pEntity = NULL;
    ExecUrlInfo.dwExecUrlFlags = HSE_EXEC_URL_IGNORE_CURRENT_INTERCEPTOR;

    if ( fModifiedEntity )
    {
        ExecUrlInfo.pEntity = &EntityInfo;
    }

    //
    // Associate the completion routine and the current URL with
    // this request.
    //

    if ( pecb->ServerSupportFunction( pecb->ConnID,
                                      HSE_REQ_IO_COMPLETION,
                                      HandleCompletion,
                                      NULL,
                                      (DWORD*)pbuffEntity ) == FALSE )
    {
        goto Failed;
    }

    //
    // Call ExecUrl
    //

    if ( pecb->ServerSupportFunction( pecb->ConnID,
                                      HSE_REQ_EXEC_URL,
                                      &ExecUrlInfo,
                                      NULL,
                                      NULL ) == FALSE )
    {
        goto Failed;
    }

    //
    // Since EXEC_URL is asynchonous, we need to return STATUS_PENDING.
    // The I/O completion routine will clean up.
    //

    return HSE_STATUS_PENDING;

Failed:

    //
    // If we've successfully allocated our own entity buffer,
    // delete it now.
    //

    if ( pbuffEntity )
    {
        delete pbuffEntity;
        pbuffEntity = NULL;
    }

    //
    // Send a 500 error
    //

    return SyncSendGenericServerError( pecb );
}

Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/ISAPI_6.0/WildCardMap/WildCardMap.cpp File Reference

  • Web
  • iis
  • ISAPI_6.0
  • WildCardMap
Defines | Functions

WildCardMap.cpp File Reference

#include <stdio.h>
#include <windows.h>
#include <httpext.h>

Go to the source code of this file.

Defines

#define | _WIN32_WINNT 0x0500
#define | MODULE_NAME "WildCardMap"
#define | WRITE_BUFFER_SIZE 1000

Functions

VOID WINAPI | ExecUrlCompletion (EXTENSION_CONTROL_BLOCK *pecb, PVOID pContext, DWORD cbIO, DWORD dwError)
BOOL WINAPI | GetExtensionVersion (HSE_VERSION_INFO *pVer)
DWORD WINAPI | HttpExtensionProc (EXTENSION_CONTROL_BLOCK *pecb)
BOOL | SendServerError (EXTENSION_CONTROL_BLOCK *pecb)
VOID | WriteDebug (LPSTR szFormat,...)

Define Documentation

#define _WIN32_WINNT 0x0500

Definition at line 20 of file WildCardMap.cpp.

#define MODULE_NAME "WildCardMap"

Definition at line 27 of file WildCardMap.cpp.

#define WRITE_BUFFER_SIZE 1000

Definition at line 28 of file WildCardMap.cpp.

Function Documentation

VOID WINAPI ExecUrlCompletion | ( | EXTENSION_CONTROL_BLOCK * | pecb,
 |  | PVOID | pContext,
 |  | DWORD | cbIO,
 |  | DWORD | dwError
 | ) |  |

Definition at line 269 of file WildCardMap.cpp.

{
    HSE_EXEC_URL_STATUS ExecUrlStatus;
    CHAR                szStatus[32] = "";
    CHAR                szWin32Error[32] = "";
    LPSTR               pChildUrl;
    BOOL                fResult;

    pChildUrl = (LPSTR)pContext;

    //
    // Get the results of the child request and report it.
    //

    fResult = pecb->ServerSupportFunction( pecb->ConnID,
                                           HSE_REQ_GET_EXEC_URL_STATUS,
                                           &ExecUrlStatus,
                                           NULL,
                                           NULL );

    if ( fResult )
    {
        if ( ExecUrlStatus.uHttpSubStatus != 0 )
        {
            _snprintf( szStatus,
                       32,
                       "Child Status=%d.%d",
                       ExecUrlStatus.uHttpStatusCode,
                       ExecUrlStatus.uHttpSubStatus );
        }
        else
        {
            _snprintf( szStatus,
                       32,
                       "%d",
                       ExecUrlStatus.uHttpStatusCode );
        }

        szStatus[31] = '\0';

        if ( ExecUrlStatus.dwWin32Error != ERROR_SUCCESS )
        {
            _snprintf( szWin32Error,
                       16,
                       "ErrorCode=%d, ",
                       ExecUrlStatus.dwWin32Error );

            szWin32Error[31] = '\0';
        }

        WriteDebug( "ExecUrl Completion: %s, %sURL=%s.\r\n",
                    szStatus,
                    szWin32Error,
                    pChildUrl );
    }
    else
    {
        WriteDebug( "ExecUrl Completion: Error %d, URL=%s.\r\n",
                    GetLastError(),
                    pChildUrl );
    }

    //
    // Clean up the context pointer
    //

    if ( pChildUrl )
    {
        LocalFree( pChildUrl );
        pChildUrl = NULL;
    }

    //
    // Notify IIS that we are done with this request
    //

    pecb->ServerSupportFunction(
        pecb->ConnID,
        HSE_REQ_DONE_WITH_SESSION,
        NULL,
        NULL,
        NULL
        );
}

BOOL WINAPI GetExtensionVersion ( HSE_VERSION_INFO * pVer )

Definition at line 52 of file WildCardMap.cpp.

       :

    Entry point for ISAPI extension initialization.  Required.

    This function will be called exactly once in the lifetime
    of the extension, at initialization time.  This function is
    a useful point to do complex initialization tasks.  This
    function is called outside of the system loader lock, so
    it does not have the same restrictions as DllMain.

Arguments:

    pVer - points to extension version info structure

Returns:

    TR2UE on success, FALSE on failure.

    Note that in the case of FALSE, IIS will call GetLastError()
    and return an error page to the client.  The entity body of
    the page may be textual if the FormatMessage API can resolve
    it, or it may just be an error number if FormatMessage can't
    resolve it.

--*/
{
    //
    // Tell IIS which version of ISAPI this extension was build from.
    //

    pVer->dwExtensionVersion = MAKELONG( HSE_VERSION_MINOR,
                                         HSE_VERSION_MAJOR);

    //
    // Report the description string for this extension.  Ensure
    // that it does not exceed the maximum length and is NULL
    // terminated.
    //

    strncpy( pVer->lpszExtensionDesc,
             "WildCardMap Sample ISAPI Extension",
             HSE_MAX_EXT_DLL_NAME_LEN );

    pVer->lpszExtensionDesc[HSE_MAX_EXT_DLL_NAME_LEN-1] = '\0';

    //
    // Return TRUE if we successfully initialized.
    //

  return TRUE;
}

DWORD WINAPI HttpExtensionProc ( EXTENSION_CONTROL_BLOCK * pecb )

Definition at line 111 of file WildCardMap.cpp.

       :

    Entry point for ISAPI requests.  Required.

    This function is called once per request.  The EXTENSION_CONTROL_BLOCK
    passed in contains information and function pointers sufficient to
    interact with the server during this processing.

    Note that, once HttpExtensionProc is called, it is the responsibility
    of the extension to send back any data that the client should receive.
    IIS will not automatically generate any response, even in the case of
    HSE_STATUS_ERROR once the request has progressed to the point where
    this function is called.

    Also note that you should not make any blocking calls or do long-running
    operations within this function.  To allow efficient scaling of your
    server, you should consider creating a pool of private threads to handle
    the requests.  In that case, the implementation of this function would
    be just to add the pecb to a queue and return HSE_STATUS_PENDING.  The
    threads in the pool would be responsible for dequeing a pecb and calling
    HSE_REQ_DONE_WITH_SESSION when they are finished processing it.

Arguments:

    pecb - pointer to the extenstion control block

Returns:

    HSE_STATUS_SUCCESS - Indicates successful request.
    HSE_STATUS_ERROR   - Indicates failed request.
    HSE_STATUS_PENDING - Indicates that processing of the request
                         should continue after this function returns.
                         It HSE_STATUS_PENDING is used, it is necessary
                         that HSE_REQ_DONE_WITH_SESSION is called
                         exactly once when processing is completed for
                         the request.

--*/
{
    HSE_EXEC_URL_INFO   ExecUrlInfo;
    LPSTR               pUrl = NULL;
    DWORD               cbData;

    //
    // Acquire the URL for the current request.
    //

    if ( pecb->GetServerVariable( pecb->ConnID,
                                  "URL",
                                  NULL,
                                  &cbData ) == FALSE )
    {
        if ( GetLastError() == ERROR_INSUFFICIENT_BUFFER )
        {
            pUrl = (LPSTR)LocalAlloc( LPTR, cbData );

            if ( pUrl )
            {
                pecb->GetServerVariable( pecb->ConnID,
                                         "URL",
                                         pUrl,
                                         &cbData );
            }
        }
    }

    if ( !pUrl )
    {
        WriteDebug( "Error %d occurred acquiring URL.\r\n",
                    GetLastError() );

        goto Failed;
    }

    //
    // Since this is just a sample to demonstrate a very simple
    // wildcard script map, we aren't going to actually modify
    // or otherwise process the request.  We'll just report our
    // presence and then call the original URL using
    // HSE_REQ_EXEC_URL.
    //

    WriteDebug( "Request Received: URL=%s\r\n",
                pUrl );

    ExecUrlInfo.pszUrl = NULL;          // Use original request URL
    ExecUrlInfo.pszMethod = NULL;       // Use original request method
    ExecUrlInfo.pszChildHeaders = NULL; // Use original request headers
    ExecUrlInfo.pUserInfo = NULL;       // Use original request user info
    ExecUrlInfo.pEntity = NULL;         // Use original request entity

    //
    // Since this extension is intended to be used as a wildcard script
    // map, we need to set the below flag to prevent recursion, which
    // can occur in some cases.
    //

    ExecUrlInfo.dwExecUrlFlags = HSE_EXEC_URL_IGNORE_CURRENT_INTERCEPTOR;

    //
    // Associate the completion routine and the current URL with
    // this request.
    //

    if ( pecb->ServerSupportFunction( pecb->ConnID,
                                      HSE_REQ_IO_COMPLETION,
                                      ExecUrlCompletion,
                                      NULL,
                                      (LPDWORD)pUrl ) == FALSE )
    {
        WriteDebug( "Error %d occurred setting I/O completion.\r\n",
                     GetLastError() );

        goto Failed;
    }

    //
    // Ok, now that everything is set up, let's call the child request.
    //

    if ( pecb->ServerSupportFunction( pecb->ConnID,
                                      HSE_REQ_EXEC_URL,
                                      &ExecUrlInfo,
                                      NULL,
                                      NULL ) == FALSE )
    {
        WriteDebug( "Error %d occurred calling HSE_REQ_EXEC_URL.\r\n",
                     GetLastError() );

        goto Failed;
    }

    //
    // Return pending and let the completion clean up.
    //

    return HSE_STATUS_PENDING;

Failed:

    if ( pUrl )
    {
        LocalFree( pUrl );
        pUrl = NULL;
    }

    SendServerError( pecb );

    return HSE_STATUS_ERROR;
}

BOOL SendServerError ( EXTENSION_CONTROL_BLOCK * pecb )

Definition at line 360 of file WildCardMap.cpp.

{
    DWORD   cbData;
    CHAR    szError[] = "<html>\r\n"
                        "<head><title> A server error occurred. </title></head>\r\n"
                        "<h1> Server Error </h1>\r\n"
                        "<hr>\r\n"
                        "An error occurred processing this request.";

    //
    // Set the status code so that a 500 gets logged in the w3svc log.
    //

    pecb->dwHttpStatusCode = 500;

    //
    // Send headers and response
    //

    pecb->ServerSupportFunction( pecb->ConnID,
                                 HSE_REQ_SEND_RESPONSE_HEADER,
                                 "500 Server Error",
                                 NULL,
                                 (LPDWORD)"Content-Type: text/html\r\n\r\n" );

    cbData = sizeof( szError );

    return pecb->WriteClient( pecb->ConnID,
                              szError,
                              &cbData,
                              HSE_IO_SYNC );
}

VOID WriteDebug | ( | LPSTR | szFormat,
 |  |  | ...
 | ) |  |

Definition at line 396 of file WildCardMap.cpp.

{
    CHAR    szBuffer[WRITE_BUFFER_SIZE];
    LPSTR   pCursor;
    DWORD   cbToWrite;
    INT     nWritten;
    va_list args;

    if ( WRITE_BUFFER_SIZE < 3 )
    {
        //
        // This is just too small to deal with...
        //

        return;
    }

    //
    // Inject the module name tag into the buffer
    //

    nWritten = _snprintf( szBuffer,
                          WRITE_BUFFER_SIZE,
                          "[%s.dll] ",
                          MODULE_NAME );

    if ( nWritten == -1 )
    {
        return;
    }

    pCursor = szBuffer + nWritten;
    cbToWrite = WRITE_BUFFER_SIZE - nWritten;

    va_start( args, szFormat );

    nWritten = _vsnprintf( pCursor,
                           cbToWrite,
                           szFormat,
                           args );

    va_end( args );

    if ( nWritten == -1 )
    {
        szBuffer[WRITE_BUFFER_SIZE-3] = '\r';
        szBuffer[WRITE_BUFFER_SIZE-2] = '\n';
    }

    szBuffer[WRITE_BUFFER_SIZE-1] = '\0';

    OutputDebugString( szBuffer );
}

Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/iis/progadmin/ABO/EnumerateKeys/EnumerateKeys.cpp File Reference

  • Web
  • iis
  • progadmin
  • ABO
  • EnumerateKeys
Defines | Functions

EnumerateKeys.cpp File Reference

#include <WINDOWS.H>
#include <OLE2.H>
#include <coguid.h>
#include <stdio.h>
#include <stdlib.h>
#include "iadmw.h"
#include "iiscnfg.h"

Go to the source code of this file.

Defines

#define | _WIN32_DCOM
#define | INITGUID
#define | STRICT
#define | WINVER 0x0400

Functions

int __cdecl | wmain (int argc, wchar_t *argv[])

Define Documentation

#define _WIN32_DCOM

Definition at line 15 of file EnumerateKeys.cpp.

#define INITGUID

Definition at line 13 of file EnumerateKeys.cpp.

#define STRICT

Definition at line 12 of file EnumerateKeys.cpp.

#define WINVER 0x0400

Definition at line 14 of file EnumerateKeys.cpp.

Function Documentation

int __cdecl wmain | ( | int | argc,
 |  | wchar_t * | argv[]
 | ) |  |

Definition at line 27 of file EnumerateKeys.cpp.

{
  HRESULT             hr = S_OK;
  DWORD               dwEnumIndex;
  WCHAR               wszChildKeyName[METADATA_MAX_NAME_LEN];
  WCHAR               wszEnumPath[METADATA_MAX_NAME_LEN];
    COSERVERINFO        csiMachineName;
  OLECHAR             wszMachineName[MAX_PATH];
  IClassFactory       *pClassFactory = NULL;
  IMSAdminBase        *pAdminBase = NULL;   //interface pointer

  if ( (argc < 2) || (argc > 3 ) )
  {
    _putws( L"ERROR! Wrong number of parameters" );
    _putws( L"    You must supply at least the machine name\n" );

    hr = E_INVALIDARG;
        goto exit;
  }

    if ( wcslen( argv[1] ) >= MAX_PATH )
    {
    _putws( L"ERROR! bad" );

    hr = E_INVALIDARG;
        goto exit;
    }

  if ( ( argc == 3 ) && ( wcslen( argv[2] ) > METADATA_MAX_NAME_LEN ) )
  {
    _putws( L"ERROR! bad" );

    hr = E_INVALIDARG;
        goto exit;
  }

  //fill the structure for CoGetClassObject
  wcsncpy (wszMachineName, argv[1], MAX_PATH-1 );
  wszMachineName[MAX_PATH-1] = L'\0';

  csiMachineName.pAuthInfo = NULL;
  csiMachineName.dwReserved1 = 0;
  csiMachineName.dwReserved2 = 0;
  csiMachineName.pwszName = wszMachineName;

  // Initialize COM
    hr = CoInitializeEx( NULL, COINIT_MULTITHREADED );
    if (FAILED(hr))
  {
    wprintf( L"ERROR: CoInitialize Failed! Error: 0x%08x\n", hr );
        goto exit;
  }

  hr = CoGetClassObject( CLSID_MSAdminBase, CLSCTX_SERVER, &csiMachineName,
                           IID_IClassFactory, (void**) &pClassFactory);
  if (FAILED(hr))
  {
    wprintf( L"ERROR: CoGetClassObject Failed! Error: 0x%08x\n", hr );
        goto exit;
  }

  hr = pClassFactory->CreateInstance(NULL, IID_IMSAdminBase, (void **) &pAdminBase);
  if (FAILED(hr))
  {
    wprintf( L"ERROR: CreateInstance Failed! Error: 0x%08x\n", hr );
        goto exit;
  }

  if (argc != 3)
  {
    // Set up a default path.
    wszEnumPath[0] = L'/';
    wszEnumPath[1] = L'\0';
  }
  else
  {
      wcsncpy( wszEnumPath, argv[2], METADATA_MAX_NAME_LEN-1 );
      wszMachineName[METADATA_MAX_NAME_LEN-1]=L'\0';
  }

  wprintf( L"Enumerating Path: %s\n", wszEnumPath );

  // Enumerate the data
  for ( dwEnumIndex = 0; SUCCEEDED(hr); dwEnumIndex++ )
  {
    hr = pAdminBase -> EnumKeys( METADATA_MASTER_ROOT_HANDLE,
                                   wszEnumPath,
                                   wszChildKeyName,
                                   dwEnumIndex);
    if ( SUCCEEDED(hr) )
    {
        wprintf( L"[%s]\n", wszChildKeyName );
    }
  }

  if ( hr != HRESULT_FROM_WIN32(ERROR_NO_MORE_ITEMS) )
  {
    wprintf( L"EnumIndex: %d \n", dwEnumIndex );
    wprintf( L"EnumKeys return code: 0x%08x\n", hr );

    goto exit;
  }

  hr = S_OK;

exit:
  if ( pClassFactory != NULL )
  {
      pClassFactory->Release();
      pClassFactory = NULL;
  }
  if ( pAdminBase != NULL )
  {
      pAdminBase->Release();
      pAdminBase = NULL;
  }

  if ( FAILED(hr) )
  {
      wprintf( L"the example failed with 0x%08x\n", hr );
  }

  return hr;
}

Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/Cap/About.Cpp File Reference

  • Web
  • MSAgent
  • c
  • Cap
Functions

About.Cpp File Reference

#include "stdafx.h"
#include "About.h"
#include "resource.h"
#include <malloc.h>

Go to the source code of this file.

Functions

BOOL CALLBACK DlgProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)

Function Documentation

BOOL CALLBACK DlgProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 137 of file About.Cpp.

                                                                          {

  AboutDlg *pDlg;

  pDlg = (AboutDlg *)GetWindowLong(hWnd, GWLP_USERDATA);

  switch (uMsg) {
    case WM_INITDIALOG:
      pDlg = (AboutDlg *)lParam;
      SetWindowLong(hWnd, GWLP_USERDATA, (long)pDlg);
      pDlg->m_hWnd = hWnd;
      return pDlg->OnInitDialog();

    case WM_COMMAND:
      if ((wParam == IDCANCEL) || (wParam == IDOK)) {
        EndDialog(hWnd, wParam);
        return TRUE;
      }
      break;

    case WM_SYSCOMMAND:
      if ((wParam & 0xFFF0) == SC_CLOSE) {
        EndDialog(hWnd, IDOK);
        return TRUE;
      }
      break;

    case WM_PAINT:
      PAINTSTRUCT ps;
      HBRUSH hbr;

      BeginPaint(hWnd, &ps);

      hbr = CreateSolidBrush(GetSysColor(COLOR_3DFACE));

      DrawIconEx(ps.hdc,
             pDlg->m_rcIcon.left,
             pDlg->m_rcIcon.top,
             pDlg->m_hIcon,
             GetSystemMetrics(SM_CXICON),
             GetSystemMetrics(SM_CYICON),
             0,
             hbr,
             DI_NORMAL);

      DeleteObject(hbr);

      EndPaint(hWnd, &ps);
      break;
  }

  return FALSE;
}

Generated on Wed Nov 13 2024 16:54:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/Cap/About.h File Reference

  • Web
  • MSAgent
  • c
  • Cap
Classes

About.h File Reference

Go to the source code of this file.

Classes

class AboutDlg
Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/Cap/Cap.Cpp File Reference

  • Web
  • MSAgent
  • c
  • Cap
Functions | Variables

Cap.Cpp File Reference

#include "stdafx.h"
#include "MainDlg.h"
#include "Error.h"

Go to the source code of this file.

Functions

int PASCAL | WinMain (HINSTANCE hInst, HINSTANCE hInstPrev, LPTSTR pszCmdLine, int nCmdShow)

Variables

HINSTANCE | g_hInst = NULL
MainDlg * | g_pMainDlg = NULL
const LPTSTR | kpszAppTitle = _T("Microsoft Agent Character Previewer")

Function Documentation

int PASCAL WinMain | ( | HINSTANCE | hInst,
 |  | HINSTANCE | hInstPrev,
 |  | LPTSTR | pszCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 60 of file Cap.Cpp.

                              {
  MSG msg;
  HRESULT hRes;

  g_hInst = hInst;

  // Initialize COM

  CoInitialize(NULL);

  // Create an instance of our main dialog class

  g_pMainDlg = new MainDlg;

  if (g_pMainDlg == NULL)
    return -1;

  // And initialize it

  hRes = g_pMainDlg->Init();

  if (FAILED(hRes)) {
    delete g_pMainDlg;
    SystemError(NULL, hRes, FALSE);
    return -1;
  }

  // Show the window

  ShowWindow(g_pMainDlg->m_hWnd, SW_SHOW);

  // See if we got a filename on the command line

  if (lstrlen(pszCmdLine) > 0) {

    // Sometimes associating a file encloses it in
    // double quotes.

    if (pszCmdLine[0] == '"')
      pszCmdLine = _tcsinc(pszCmdLine);

    if (pszCmdLine[_tcslen(pszCmdLine)-1] == '"')
      pszCmdLine[_tcslen(pszCmdLine)-1] = 0;

    // Load the character specified on the command line.
    // This allows someone to associate this program with
    // character files so that they can double click them
    // and start this application.

    g_pMainDlg->LoadCharacter(pszCmdLine);
  }

  // Standard message loop

  while (GetMessage(&msg, NULL, 0, 0) > 0) {
    if (TranslateAccelerator(g_pMainDlg->m_hWnd, g_pMainDlg->m_hAccel, &msg))
      continue;
    if (IsDialogMessage(g_pMainDlg->m_hWnd, &msg))
      continue;
    TranslateMessage(&msg);
    DispatchMessage(&msg);
  }

  // Clean up

  delete g_pMainDlg;

  CoUninitialize();

  return 0;
}

Variable Documentation

HINSTANCE g_hInst = NULL

Definition at line 62 of file DoServer.Cpp.

MainDlg* g_pMainDlg = NULL
const LPTSTR kpszAppTitle = _T("Microsoft Agent Character Previewer")
Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/Cap/Error.Cpp File Reference

  • Web
  • MSAgent
  • c
  • Cap
Functions | Variables

Error.Cpp File Reference

#include "stdafx.h"
#include "Error.h"

Go to the source code of this file.

Functions

void | SystemError (HWND hWndParent, HRESULT hRes, BOOL bWarning)

Variables

const LPTSTR | kpszAppTitle

Function Documentation

void SystemError | ( | HWND | hWndParent,
 |  | HRESULT | hRes,
 |  | BOOL | bWarning
 | ) |  |

Definition at line 53 of file Error.Cpp.

                                                               {

  LPVOID lpMsgBuf;
  DWORD dwRes;
  UINT uFlags = MB_OK | MB_TOPMOST;

  if (bWarning)
    uFlags |= MB_ICONEXCLAMATION;
  else
    uFlags |= MB_ICONERROR;

  dwRes = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
              NULL,
              hRes,
              MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
              (LPTSTR)&lpMsgBuf,
              0,
              NULL);

  if (dwRes == 0) {
    MessageBox(hWndParent, _T("Unknown error, code = 0x%x"), kpszAppTitle, uFlags);
  }
  else {
    MessageBox(hWndParent, (LPTSTR)lpMsgBuf, kpszAppTitle, uFlags);
    LocalFree(lpMsgBuf);
  }
}

Variable Documentation

const LPTSTR kpszAppTitle
Generated on Wed Nov 13 2024 16:53:28 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/Cap/Error.h File Reference

  • Web
  • MSAgent
  • c
  • Cap
Functions

Error.h File Reference

Go to the source code of this file.

Functions

void SystemError (HWND hWndParent, HRESULT hRes, BOOL bWarning)

Function Documentation

void SystemError | ( | HWND | hWndParent,
 |  | HRESULT | hRes,
 |  | BOOL | bWarning
 | ) |  |

Definition at line 53 of file Error.Cpp.

                                                               {

  LPVOID lpMsgBuf;
  DWORD dwRes;
  UINT uFlags = MB_OK | MB_TOPMOST;

  if (bWarning)
    uFlags |= MB_ICONEXCLAMATION;
  else
    uFlags |= MB_ICONERROR;

  dwRes = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
              NULL,
              hRes,
              MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
              (LPTSTR)&lpMsgBuf,
              0,
              NULL);

  if (dwRes == 0) {
    MessageBox(hWndParent, _T("Unknown error, code = 0x%x"), kpszAppTitle, uFlags);
  }
  else {
    MessageBox(hWndParent, (LPTSTR)lpMsgBuf, kpszAppTitle, uFlags);
    LocalFree(lpMsgBuf);
  }
}

Generated on Wed Nov 13 2024 16:53:32 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/Cap/MainDlg.Cpp File Reference

  • Web
  • MSAgent
  • c
  • Cap
Defines | Functions | Variables

MainDlg.Cpp File Reference

#include "stdafx.h"
#include "MainDlg.h"
#include "About.h"
#include "Error.h"
#include "StrConv.h"
#include "resource.h"
#include "Notify.h"

Go to the source code of this file.

Defines

#define | ID_RECENT_FILE_0 900
#define | MAX_RECENT_FILENAME 32
#define | MAX_RECENT_FILES 4

Functions

LRESULT CALLBACK | ListBoxWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT CALLBACK | MoveXWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT CALLBACK | MoveYWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT CALLBACK | SpeakTextWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT CALLBACK | WndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)

Variables

HINSTANCE | g_hInst
MainDlg * g_pMainDlg
const LPTSTR | kpszAppTitle
LPCTSTR | kpszRegRoot = _T("Software\\Microsoft\\Microsoft Agent\\Tools\\Character Previewer")

Define Documentation

#define ID_RECENT_FILE_0 900

Definition at line 57 of file MainDlg.Cpp.

#define MAX_RECENT_FILENAME 32

Definition at line 56 of file MainDlg.Cpp.

#define MAX_RECENT_FILES 4

Definition at line 55 of file MainDlg.Cpp.

Function Documentation

LRESULT CALLBACK ListBoxWndProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 1464 of file MainDlg.Cpp.

                                                                                {

  _ASSERT(g_pMainDlg);

  switch (uMsg) {
    case WM_SETFOCUS:
      if (g_pMainDlg->m_pCharacter)
        SendMessage(GetParent(hWnd), DM_SETDEFID, IDC_PLAY, 0);
      break;

    case WM_LBUTTONDBLCLK:
      if (g_pMainDlg->m_pCharacter)
        g_pMainDlg->OnButtonClick(IDC_PLAY);
      return 0;
  }

  return CallWindowProc(g_pMainDlg->m_wpListBox, hWnd, uMsg, wParam, lParam);
}

LRESULT CALLBACK MoveXWndProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 1500 of file MainDlg.Cpp.

                                                                                {

  _ASSERT(g_pMainDlg);

  switch (uMsg) {
    case WM_SETFOCUS:
      _ASSERT(g_pMainDlg->m_pCharacter);
      SendMessage(GetParent(hWnd), DM_SETDEFID, IDC_MOVE, 0);
      break;
  }

  return CallWindowProc(g_pMainDlg->m_wpMoveX, hWnd, uMsg, wParam, lParam);
}

LRESULT CALLBACK MoveYWndProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 1515 of file MainDlg.Cpp.

                                                                                {

  _ASSERT(g_pMainDlg);

  switch (uMsg) {
    case WM_SETFOCUS:
      _ASSERT(g_pMainDlg->m_pCharacter);
      SendMessage(GetParent(hWnd), DM_SETDEFID, IDC_MOVE, 0);
      break;
  }

  return CallWindowProc(g_pMainDlg->m_wpMoveY, hWnd, uMsg, wParam, lParam);
}

LRESULT CALLBACK SpeakTextWndProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 1484 of file MainDlg.Cpp.

                                                                                {

  _ASSERT(g_pMainDlg);

  switch (uMsg) {
    case WM_SETFOCUS:
      _ASSERT(g_pMainDlg->m_pCharacter);
      if (GetWindowTextLength(hWnd) > 0)
        SendMessage(GetParent(hWnd), DM_SETDEFID, IDC_SPEAK, 0);
      break;
  }

  return CallWindowProc(g_pMainDlg->m_wpSpeakText, hWnd, uMsg, wParam, lParam);
}

LRESULT CALLBACK WndProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 1373 of file MainDlg.Cpp.

                                                                             {

  MainDlg *pDlg;

  pDlg = (MainDlg *)GetWindowLongPtr(hWnd, GWLP_USERDATA);

  switch (uMsg) {
    case WM_ACTIVATEAPP:
      pDlg->OnActivateApp((BOOL)wParam);
      break;

    case WM_COMMAND:
      switch (HIWORD(wParam)) {

        // First check for 0.  This is BN_CLICKED.  If lParam is 0
        // then it's a menu item selection.  If lParam is 1, it's
        // an accelerator key.  Otherwise, assume it's a button click.

        case 0:
          if ((lParam == 0) || (lParam == 1)) {
            if (!pDlg->OnCommand(wParam, lParam))
              return DefDlgProc(hWnd, uMsg, wParam, lParam);
          }
          else
            pDlg->OnButtonClick(LOWORD(wParam));

          break;

        case 1:
          if (!pDlg->OnCommand(wParam, lParam))
            return DefDlgProc(hWnd, uMsg, wParam, lParam);

          break;

        case EN_CHANGE:

          if (LOWORD(wParam) == IDC_SPEAKTEXT) {

            BOOL bEnable;

            // Enable the Speak button if there are animations and text
            // in the speak text edit field.

            bEnable = (SendDlgItemMessage(pDlg->m_hWnd, IDC_ANIMATIONS, LB_GETCOUNT, 0, 0) > 0) &&
                  (GetWindowTextLength(GetDlgItem(pDlg->m_hWnd, IDC_SPEAKTEXT)) > 0);

            // If we're enabling and the button isn't already enabled,
            // enable it and make it the default button. If we're disabling
            // and the button is enabled, disable it and turn off it's
            // default button status.

            if (bEnable && !IsWindowEnabled(GetDlgItem(pDlg->m_hWnd, IDC_SPEAK))) {
              EnableWindow(GetDlgItem(pDlg->m_hWnd, IDC_SPEAK), TRUE);
              SendMessage(pDlg->m_hWnd, DM_SETDEFID, IDC_SPEAK, 0);
            }
            else if (!bEnable && IsWindowEnabled(GetDlgItem(pDlg->m_hWnd, IDC_SPEAK))) {
              EnableWindow(GetDlgItem(pDlg->m_hWnd, IDC_SPEAK), FALSE);
              SendMessage(pDlg->m_hWnd, DM_SETDEFID, 0, 0);
            }
          }

          break;
      }
      break;

    case WM_DESTROY:
      pDlg->OnDestroy();
      break;

    case WM_DROPFILES:
      pDlg->OnDropFiles((HDROP)wParam);
      break;

    case WM_INITMENUPOPUP:
      if (!pDlg->OnInitMenuPopup((HMENU)wParam, (UINT)LOWORD(lParam), (BOOL)HIWORD(lParam)))
        return DefDlgProc(hWnd, uMsg, wParam, lParam);
      break;

    case WM_SYSCOMMAND:
      if (!pDlg->OnSysCommand(wParam))
        DefDlgProc(hWnd, uMsg, wParam, lParam);
      break;

    default:
      return DefDlgProc(hWnd, uMsg, wParam, lParam);
  }

  return 0;
}

Variable Documentation

HINSTANCE g_hInst

Definition at line 62 of file DoServer.Cpp.

MainDlg* g_pMainDlg
const LPTSTR kpszAppTitle
LPCTSTR kpszRegRoot = _T("Software\\Microsoft\\Microsoft Agent\\Tools\\Character Previewer")
Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/Cap/MainDlg.h File Reference

  • Web
  • MSAgent
  • c
  • Cap
Classes

MainDlg.h File Reference

Go to the source code of this file.

Classes

class MainDlg
Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/Cap/Notify.Cpp File Reference

  • Web
  • MSAgent
  • c
  • Cap
Functions

Notify.Cpp File Reference

#include "stdafx.h"
#include "Notify.h"
#include "MainDlg.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) AgentNotifySink

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 74 of file Notify.Cpp.

                                              {

  if (--m_cRefs != 0)
    return m_cRefs;

  delete this;
  return 0;
}

Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/Cap/Notify.h File Reference

  • Web
  • MSAgent
  • c
  • Cap
Classes

Notify.h File Reference

#include "AgtSvr.h"

Go to the source code of this file.

Classes

class AgentNotifySink
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/Cap/Resource.h File Reference

  • Web
  • MSAgent
  • c
  • Cap
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | ID_FILE_EXIT 40001
#define | ID_FILE_OPENCHARACTER 40010
#define | ID_HELP_ABOUT 40002
#define | IDC_AGENTVERSION 1116
#define | IDC_ANIMATIONS 1000
#define | IDC_ANIMATIONS_LABEL 1014
#define | IDC_BALLOON_AUTOHIDE 1008
#define | IDC_BALLOON_AUTOPACE 1007
#define | IDC_BALLOON_SIZETOTEXT 1006
#define | IDC_BALLOON_USE 1005
#define | IDC_ICONPOS 1108
#define | IDC_MOVE 1011
#define | IDC_MOVE_X 1009
#define | IDC_MOVE_Y 1010
#define | IDC_PLAY 1001
#define | IDC_POSITION_LABEL 1017
#define | IDC_SFX 1015
#define | IDC_SPEAK 1004
#define | IDC_SPEAKTEXT 1003
#define | IDC_SPEECHOUTPUT_LABEL 1016
#define | IDC_STOP 1002
#define | IDC_STOPBEFOREPLAY 1012
#define | IDC_VERSION 1115
#define | IDC_X_LABEL 1018
#define | IDC_Y_LABEL 1019
#define | IDD_ABOUT 178
#define | IDD_CAP 101
#define | IDD_DIALOG1 101
#define | IDI_APP 153
#define | IDR_ACCELERATORS 165
#define | IDR_MENU 110
#define | IDS_ANIMATIONS_LABEL 2
#define | IDS_COMMAND_PROPERTIES 1

Define Documentation

#define ID_FILE_EXIT 40001

Definition at line 35 of file Resource.h.

#define ID_FILE_OPENCHARACTER 40010

Definition at line 37 of file Resource.h.

#define ID_HELP_ABOUT 40002

Definition at line 36 of file Resource.h.

#define IDC_AGENTVERSION 1116

Definition at line 34 of file Resource.h.

#define IDC_ANIMATIONS 1000

Definition at line 13 of file Resource.h.

#define IDC_ANIMATIONS_LABEL 1014

Definition at line 26 of file Resource.h.

#define IDC_BALLOON_AUTOHIDE 1008

Definition at line 21 of file Resource.h.

#define IDC_BALLOON_AUTOPACE 1007

Definition at line 20 of file Resource.h.

#define IDC_BALLOON_SIZETOTEXT 1006

Definition at line 19 of file Resource.h.

#define IDC_BALLOON_USE 1005

Definition at line 18 of file Resource.h.

#define IDC_ICONPOS 1108

Definition at line 32 of file Resource.h.

#define IDC_MOVE 1011

Definition at line 24 of file Resource.h.

#define IDC_MOVE_X 1009

Definition at line 22 of file Resource.h.

#define IDC_MOVE_Y 1010

Definition at line 23 of file Resource.h.

#define IDC_PLAY 1001

Definition at line 14 of file Resource.h.

#define IDC_POSITION_LABEL 1017

Definition at line 29 of file Resource.h.

#define IDC_SFX 1015

Definition at line 27 of file Resource.h.

#define IDC_SPEAK 1004

Definition at line 17 of file Resource.h.

#define IDC_SPEAKTEXT 1003

Definition at line 16 of file Resource.h.

#define IDC_SPEECHOUTPUT_LABEL 1016

Definition at line 28 of file Resource.h.

#define IDC_STOP 1002

Definition at line 15 of file Resource.h.

#define IDC_STOPBEFOREPLAY 1012

Definition at line 25 of file Resource.h.

#define IDC_VERSION 1115

Definition at line 33 of file Resource.h.

#define IDC_X_LABEL 1018

Definition at line 30 of file Resource.h.

#define IDC_Y_LABEL 1019

Definition at line 31 of file Resource.h.

#define IDD_ABOUT 178

Definition at line 12 of file Resource.h.

#define IDD_CAP 101

Definition at line 8 of file Resource.h.

#define IDD_DIALOG1 101

Definition at line 7 of file Resource.h.

#define IDI_APP 153

Definition at line 10 of file Resource.h.

#define IDR_ACCELERATORS 165

Definition at line 11 of file Resource.h.

#define IDR_MENU 110

Definition at line 9 of file Resource.h.

#define IDS_ANIMATIONS_LABEL 2

Definition at line 6 of file Resource.h.

#define IDS_COMMAND_PROPERTIES 1

Definition at line 5 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/Cap/StdAfx.Cpp File Reference

  • Web
  • MSAgent
  • c
  • Cap

StdAfx.Cpp File Reference

#include "stdafx.h"
#include <objbase.h>
#include <initguid.h>
#include "AgtSvr_i.c"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/Cap/StdAfx.h File Reference

  • Web
  • MSAgent
  • c
  • Cap
Defines

StdAfx.h File Reference

#include <crtdbg.h>
#include <windows.h>
#include <tchar.h>
#include <malloc.h>
#include "AgtSvr.h"
#include "AgtErr.h"

Go to the source code of this file.

Defines

#define STRICT

Define Documentation

#define STRICT

Definition at line 5 of file StdAfx.h.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/Cap/StrConv.h File Reference

  • Web
  • MSAgent
  • c
  • Cap
Defines | Functions

StrConv.h File Reference

Go to the source code of this file.

Defines

#define | A2CW(psz) ((LPCWSTR)A2W(psz))
#define | A2W(psz)
#define | A2WHELPER A2WHelper
#define | T2CW A2CW
#define | T2W A2W
#define | USES_CONVERSION int _convert; _convert
#define | W2A(pwsz)
#define | W2AHELPER W2AHelper
#define | W2CA(pwsz) ((LPCSTR)W2A(pwsz))
#define | W2CT W2CA
#define | W2T W2A

Functions

LPCTSTR | A2CT (LPCSTR lp)
LPTSTR A2T (LPSTR lp)
LPWSTR WINAPI | A2WHelper (LPWSTR pwsz, LPCSTR psz, UINT cch)
LPSTR T2A (LPTSTR lp)
LPCSTR | T2CA (LPCTSTR lp)
LPSTR WINAPI | W2AHelper (LPSTR psz, LPCWSTR pwsz, UINT cch)

Define Documentation

#define A2CW ( psz ) ((LPCWSTR)A2W(psz))

Definition at line 55 of file StrConv.h.

#define A2W ( psz )
Value:
(\
  ((LPCSTR)psz == NULL) ? NULL : (\
    _convert = (lstrlenA(psz)+1),\
    A2WHELPER((LPWSTR)alloca(_convert*2), psz, _convert)))

Definition at line 44 of file StrConv.h.

#define A2WHELPER A2WHelper

Definition at line 39 of file StrConv.h.

#define T2CW A2CW

Definition at line 73 of file StrConv.h.

#define T2W A2W

Definition at line 69 of file StrConv.h.

#define USES_CONVERSION int _convert; _convert

Definition at line 32 of file StrConv.h.

#define W2A ( pwsz )
Value:
(\
  ((LPCWSTR)pwsz == NULL) ? NULL : (\
    _convert = (lstrlenW(pwsz)+1)*2,\
    W2AHELPER((LPSTR)alloca(_convert), pwsz, _convert)))

Definition at line 49 of file StrConv.h.

#define W2AHELPER W2AHelper

Definition at line 40 of file StrConv.h.

#define W2CA ( pwsz ) ((LPCSTR)W2A(pwsz))

Definition at line 56 of file StrConv.h.

#define W2CT W2CA

Definition at line 74 of file StrConv.h.

#define W2T W2A

Definition at line 70 of file StrConv.h.

Function Documentation

LPCTSTR A2CT ( LPCSTR lp ) [inline]

Definition at line 76 of file StrConv.h.

{ return lp; }

LPTSTR A2T ( LPSTR lp ) [inline]

Definition at line 72 of file StrConv.h.

{ return lp; }

LPWSTR WINAPI A2WHelper | ( | LPWSTR | pwsz,
 |  | LPCSTR | psz,
 |  | UINT | cch
 | ) |  |

Definition at line 5 of file StrConv.h.

                                                           {

  _ASSERTE(psz);
  _ASSERTE(pwsz);

  pwsz[0] = '\0';

  MultiByteToWideChar(CP_ACP, 0, psz, -1, pwsz, cch);

  return pwsz;
}

LPSTR T2A ( LPTSTR lp ) [inline]

Definition at line 71 of file StrConv.h.

{ return lp; }

LPCSTR T2CA ( LPCTSTR lp ) [inline]

Definition at line 75 of file StrConv.h.

{ return lp; }

LPSTR WINAPI W2AHelper | ( | LPSTR | psz,
 |  | LPCWSTR | pwsz,
 |  | UINT | cch
 | ) |  |

Definition at line 18 of file StrConv.h.

                                                          {

  _ASSERTE(psz);
  _ASSERTE(pwsz);

  psz[0] = '\0';

  WideCharToMultiByte(CP_ACP, 0, pwsz, -1, psz, cch, NULL, NULL);

  return psz;
}

Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/CapMFC/AcAnim.Cpp File Reference

  • Web
  • MSAgent
  • c
  • CapMFC

AcAnim.Cpp File Reference

#include "stdafx.h"
#include "ACAnim.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/CapMFC/AcAnim.h File Reference

  • Web
  • MSAgent
  • c
  • CapMFC
Classes

AcAnim.h File Reference

Go to the source code of this file.

Classes

class CAgentCtlAnimationNames
Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/CapMFC/AcAudio.Cpp File Reference

  • Web
  • MSAgent
  • c
  • CapMFC

AcAudio.Cpp File Reference

#include "stdafx.h"
#include "ACAudio.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/CapMFC/AcAudio.h File Reference

  • Web
  • MSAgent
  • c
  • CapMFC
Classes

AcAudio.h File Reference

Go to the source code of this file.

Classes

class CAgentCtlAudioObject
Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/CapMFC/AcBall.Cpp File Reference

  • Web
  • MSAgent
  • c
  • CapMFC

AcBall.Cpp File Reference

#include "stdafx.h"
#include "ACBall.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/CapMFC/AcBall.h File Reference

  • Web
  • MSAgent
  • c
  • CapMFC
Classes

AcBall.h File Reference

Go to the source code of this file.

Classes

class CAgentCtlBalloonEx
Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/CapMFC/AcChar.Cpp File Reference

  • Web
  • MSAgent
  • c
  • CapMFC

AcChar.Cpp File Reference

#include "stdafx.h"
#include "ACChar.h"
#include "ACBall.h"
#include "ACComms.h"
#include "ACReq.h"
#include "ACAnim.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/CapMFC/AcChar.h File Reference

  • Web
  • MSAgent
  • c
  • CapMFC
Classes

AcChar.h File Reference

Go to the source code of this file.

Classes

class CAgentCtlCharacterEx
Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/CapMFC/AcChars.Cpp File Reference

  • Web
  • MSAgent
  • c
  • CapMFC

AcChars.Cpp File Reference

#include "stdafx.h"
#include "ACChars.h"
#include "ACChar.h"
#include "ACReq.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/CapMFC/AcChars.h File Reference

  • Web
  • MSAgent
  • c
  • CapMFC
Classes

AcChars.h File Reference

Go to the source code of this file.

Classes

class CAgentCtlCharacters
Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/CapMFC/AcComm.Cpp File Reference

  • Web
  • MSAgent
  • c
  • CapMFC

AcComm.Cpp File Reference

#include "stdafx.h"
#include "ACComm.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/CapMFC/AcComm.h File Reference

  • Web
  • MSAgent
  • c
  • CapMFC
Classes

AcComm.h File Reference

Go to the source code of this file.

Classes

class CAgentCtlCommandEx
Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/CapMFC/AcComms.Cpp File Reference

  • Web
  • MSAgent
  • c
  • CapMFC

AcComms.Cpp File Reference

#include "stdafx.h"
#include "ACComms.h"
#include "ACComm.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/CapMFC/AcComms.h File Reference

  • Web
  • MSAgent
  • c
  • CapMFC
Classes

AcComms.h File Reference

Go to the source code of this file.

Classes

class CAgentCtlCommandsEx
Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/CapMFC/Acex.Cpp File Reference

  • Web
  • MSAgent
  • c
  • CapMFC

Acex.Cpp File Reference

#include "stdafx.h"
#include "acex.h"
#include "ACChars.h"
#include "ACProp.h"
#include "ACAudio.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/CapMFC/Acex.h File Reference

  • Web
  • MSAgent
  • c
  • CapMFC
Classes

Acex.h File Reference

Go to the source code of this file.

Classes

class CAgentCtlEx
Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/CapMFC/AcProp.Cpp File Reference

  • Web
  • MSAgent
  • c
  • CapMFC

AcProp.Cpp File Reference

#include "stdafx.h"
#include "ACProp.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/CapMFC/AcProp.h File Reference

  • Web
  • MSAgent
  • c
  • CapMFC
Classes

AcProp.h File Reference

Go to the source code of this file.

Classes

class CAgentCtlPropertySheet
Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/CapMFC/AcReq.Cpp File Reference

  • Web
  • MSAgent
  • c
  • CapMFC

AcReq.Cpp File Reference

#include "stdafx.h"
#include "ACReq.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/CapMFC/AcReq.h File Reference

  • Web
  • MSAgent
  • c
  • CapMFC
Classes

AcReq.h File Reference

Go to the source code of this file.

Classes

class CAgentCtlRequest
Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/CapMFC/AcUser.Cpp File Reference

  • Web
  • MSAgent
  • c
  • CapMFC

AcUser.Cpp File Reference

#include "stdafx.h"
#include "ACUser.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/CapMFC/AcUser.h File Reference

  • Web
  • MSAgent
  • c
  • CapMFC
Classes

AcUser.h File Reference

Go to the source code of this file.

Classes

class CAgentCtlUserInput
Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/CapMFC/CapMFC.Cpp File Reference

  • Web
  • MSAgent
  • c
  • CapMFC
Variables

CapMFC.Cpp File Reference

#include "stdafx.h"
#include "CapMFC.h"
#include "MainDlg.h"

Go to the source code of this file.

Variables

const LPTSTR kpszAppTitle = _T("Microsoft Agent Character Previewer")
CCapMFCApp theApp

Variable Documentation

const LPTSTR kpszAppTitle = _T("Microsoft Agent Character Previewer")
CCapMFCApp theApp

Definition at line 69 of file CapMFC.Cpp.

Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/CapMFC/CapMFC.h File Reference

  • Web
  • MSAgent
  • c
  • CapMFC
Classes

CapMFC.h File Reference

#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Classes

class CCapMFCApp
Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/CapMFC/MainDlg.Cpp File Reference

  • Web
  • MSAgent
  • c
  • CapMFC
Classes | Defines | Variables

MainDlg.Cpp File Reference

#include "stdafx.h"
#include "CapMFC.h"
#include "MainDlg.h"

Go to the source code of this file.

Classes

class | CAboutDlg

Defines

#define | ID_RECENT_FILE_0 900
#define | MAX_RECENT_FILENAME 32
#define | MAX_RECENT_FILES 4

Variables

const LPTSTR | kpszAppTitle
LPCTSTR | kpszRegRoot = _T("Software\\Microsoft\\Microsoft Agent\\Tools\\Character Previewer")

Define Documentation

#define ID_RECENT_FILE_0 900

Definition at line 63 of file MainDlg.Cpp.

#define MAX_RECENT_FILENAME 32

Definition at line 62 of file MainDlg.Cpp.

#define MAX_RECENT_FILES 4

Definition at line 61 of file MainDlg.Cpp.

Variable Documentation

const LPTSTR kpszAppTitle
LPCTSTR kpszRegRoot = _T("Software\\Microsoft\\Microsoft Agent\\Tools\\Character Previewer")
Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/CapMFC/MainDlg.h File Reference

  • Web
  • MSAgent
  • c
  • CapMFC
Classes

MainDlg.h File Reference

#include "acex.h"

Go to the source code of this file.

Classes

class CCapMFCDlg
Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/CapMFC/Resource.h File Reference

  • Web
  • MSAgent
  • c
  • CapMFC
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | ID_FILE_EXIT 32772
#define | ID_HELP_ABOUT 32773
#define | IDC_AGENT 1003
#define | IDC_ANIMATIONS 1000
#define | IDC_ANIMATIONS_LABEL 1014
#define | IDC_BALLOON_AUTOHIDE 1019
#define | IDC_BALLOON_AUTOPACE 1020
#define | IDC_BALLOON_SIZETOTEXT 1021
#define | IDC_BALLOON_USE 1018
#define | IDC_EDIT1 1017
#define | IDC_MOVE 1005
#define | IDC_MOVE_X 1024
#define | IDC_MOVE_Y 1025
#define | IDC_PLAY 1001
#define | IDC_POSITION_LABEL 1022
#define | IDC_SFX 1015
#define | IDC_SPEAK 1004
#define | IDC_SPEAKTEXT 1017
#define | IDC_SPEECHOUTPUT_LABEL 1016
#define | IDC_STOP 1002
#define | IDC_STOPBEFOREPLAY 1012
#define | IDC_VERSION 1025
#define | IDC_X_LABEL 1023
#define | IDC_Y_LABEL 1026
#define | IDD_ABOUTBOX 100
#define | IDD_CAPMFC_DIALOG 102
#define | IDM_ABOUTBOX 0x0010
#define | IDR_MAINFRAME 128
#define | IDR_MENU 130
#define | IDS_ABOUTBOX 101
#define | IDS_ANIMATIONS_LABEL 2
#define | IDS_COMMAND_PROPERTIES 102

Define Documentation

#define ID_FILE_EXIT 32772

Definition at line 35 of file Resource.h.

#define ID_HELP_ABOUT 32773

Definition at line 36 of file Resource.h.

#define IDC_AGENT 1003

Definition at line 16 of file Resource.h.

#define IDC_ANIMATIONS 1000

Definition at line 13 of file Resource.h.

#define IDC_ANIMATIONS_LABEL 1014

Definition at line 20 of file Resource.h.

#define IDC_BALLOON_AUTOHIDE 1019

Definition at line 26 of file Resource.h.

#define IDC_BALLOON_AUTOPACE 1020

Definition at line 27 of file Resource.h.

#define IDC_BALLOON_SIZETOTEXT 1021

Definition at line 28 of file Resource.h.

#define IDC_BALLOON_USE 1018

Definition at line 25 of file Resource.h.

#define IDC_EDIT1 1017

Definition at line 23 of file Resource.h.

#define IDC_MOVE 1005

Definition at line 18 of file Resource.h.

#define IDC_MOVE_X 1024

Definition at line 31 of file Resource.h.

#define IDC_MOVE_Y 1025

Definition at line 32 of file Resource.h.

#define IDC_PLAY 1001

Definition at line 14 of file Resource.h.

#define IDC_POSITION_LABEL 1022

Definition at line 29 of file Resource.h.

#define IDC_SFX 1015

Definition at line 21 of file Resource.h.

#define IDC_SPEAK 1004

Definition at line 17 of file Resource.h.

#define IDC_SPEAKTEXT 1017

Definition at line 24 of file Resource.h.

#define IDC_SPEECHOUTPUT_LABEL 1016

Definition at line 22 of file Resource.h.

#define IDC_STOP 1002

Definition at line 15 of file Resource.h.

#define IDC_STOPBEFOREPLAY 1012

Definition at line 19 of file Resource.h.

#define IDC_VERSION 1025

Definition at line 33 of file Resource.h.

#define IDC_X_LABEL 1023

Definition at line 30 of file Resource.h.

#define IDC_Y_LABEL 1026

Definition at line 34 of file Resource.h.

#define IDD_ABOUTBOX 100

Definition at line 7 of file Resource.h.

#define IDD_CAPMFC_DIALOG 102

Definition at line 9 of file Resource.h.

#define IDM_ABOUTBOX 0x0010

Definition at line 6 of file Resource.h.

#define IDR_MAINFRAME 128

Definition at line 11 of file Resource.h.

#define IDR_MENU 130

Definition at line 12 of file Resource.h.

#define IDS_ABOUTBOX 101

Definition at line 8 of file Resource.h.

#define IDS_ANIMATIONS_LABEL 2

Definition at line 5 of file Resource.h.

#define IDS_COMMAND_PROPERTIES 102

Definition at line 10 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/CapMFC/StdAfx.Cpp File Reference

  • Web
  • MSAgent
  • c
  • CapMFC

StdAfx.Cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/CapMFC/StdAfx.h File Reference

  • Web
  • MSAgent
  • c
  • CapMFC
Defines

StdAfx.h File Reference

#include <afxwin.h>
#include <afxext.h>
#include <afxdisp.h>
#include <afxcmn.h>
#include <malloc.h>
#include "ACEx.h"
#include "ACChars.h"
#include "ACChar.h"
#include "ACBall.h"
#include "ACAnim.h"
#include "ACComms.h"
#include "ACUser.h"
#include "ACReq.h"
#include "ACProp.h"
#include "ACAudio.h"
#include "AgtCtl.h"
#include "AgtSvr.h"

Go to the source code of this file.

Defines

#define VC_EXTRALEAN

Define Documentation

#define VC_EXTRALEAN

Definition at line 13 of file StdAfx.h.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/Hello/Hello.Cpp File Reference

  • Web
  • MSAgent
  • c
  • Hello
Functions

Hello.Cpp File Reference

#include <windows.h>
#include <tchar.h>
#include "AgtSvr.h"
#include "AgtSvr_i.c"

Go to the source code of this file.

Functions

int PASCAL WinMain (HINSTANCE hInst, HINSTANCE hInstPrev, LPSTR lpCmdLine, int nCmdShow)

Function Documentation

int PASCAL WinMain | ( | HINSTANCE | hInst,
 |  | HINSTANCE | hInstPrev,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 32 of file Hello.Cpp.

                              {

  HRESULT       hRes;
  _TCHAR        szError[256];
  VARIANT       vPath;
  BSTR        bszSpeak;
  long        lCharID;
  long        lRequestID;
  IAgentEx       *pAgentEx;
  IAgentCharacterEx  *pCharacterEx = NULL;

  // Initialize COM

    if (FAILED(CoInitialize(NULL))) {
    MessageBox(NULL,
           _T("There was an error initializing COM."),
           kpszAppTitle,
           MB_OK | MB_ICONERROR);
        return -1;
  }

  // Create an instance of the Agent 2.0 server. NOTE: by
  // asking for an IAgentEx interface we know we will get
  // at least Agent 2.0. The CLSID also changed between
  // 1.5 and 2.0 so we know we won't get the 1.5 server.

  hRes = CoCreateInstance(CLSID_AgentServer,
              NULL,
              CLSCTX_SERVER,
              IID_IAgentEx,
              (LPVOID *)&pAgentEx);
  if (FAILED(hRes)) {

    wsprintf(szError, _T("There was an error initializing Microsoft Agent, code = 0x%x"), hRes);

    MessageBox(NULL,
           szError,
           kpszAppTitle,
           MB_OK | MB_ICONERROR | MB_TOPMOST);

    CoUninitialize();

    return -1;
  }

  __try {

    // First try to load the default character

    VariantInit(&vPath);
    vPath.vt = VT_EMPTY;

    hRes = pAgentEx->Load(vPath, &lCharID, &lRequestID);

    if (FAILED(hRes)) {

      // There's no default character. See if we can load the
      // character from the directory used in most version 1.5
      // applications.

      vPath.vt = VT_BSTR;
      vPath.bstrVal = SysAllocString(kpwzCharacterOld);

      if (vPath.bstrVal == NULL) {
        hRes = E_OUTOFMEMORY;
        __leave;
      }

      hRes = pAgentEx->Load(vPath, &lCharID, &lRequestID);

      // Did we successfully load a character?

      if (FAILED(hRes))
        __leave;
    }

    // Get the IAgentCharacterEx interface

    hRes = pAgentEx->GetCharacterEx(lCharID, &pCharacterEx);

    if (FAILED(hRes))
      __leave;

    // Set the language of the character

    hRes = pCharacterEx->SetLanguageID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));

    if (FAILED(hRes))
      __leave;

    // Show the character.  The first parameter tells Microsoft
    // Agent to show the character by playing an animation.

    hRes = pCharacterEx->Show(FALSE, &lRequestID);

    if (FAILED(hRes))
      __leave;

    // Make the character speak

    bszSpeak = SysAllocString(L"Hello World!");

    hRes = pCharacterEx->Speak(bszSpeak, NULL, &lRequestID);

    SysFreeString(bszSpeak);

    if (FAILED(hRes))
      __leave;

    // This is a very simplistic sample.  Sleep for 10 seconds
    // and then die.

    Sleep(10000);

  }
  __finally {

    if (FAILED(hRes)) {

      wsprintf(szError, _T("An error occurred in Microsoft Agent, code = 0x%x"), hRes);

      MessageBox(NULL,
             szError,
             kpszAppTitle,
             MB_OK | MB_ICONERROR | MB_TOPMOST);
    }
  }

  // Clean up

  if (pCharacterEx) {

    // Release the character interface

    pCharacterEx->Release();

    // Unload the character.  NOTE:  releasing the character
    // interface does NOT make the character go away.  You must
    // call Unload.

    pAgentEx->Unload(lCharID);
  }

  // Release the Agent

  pAgentEx->Release();

  VariantClear(&vPath);

  CoUninitialize();

  return 0;
}

Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/Hello2/Hello2.Cpp File Reference

  • Web
  • MSAgent
  • c
  • Hello2
Functions | Variables

Hello2.Cpp File Reference

#include "Hello2.h"
#include "AgtSvr_i.c"
#include "Notify.h"

Go to the source code of this file.

Functions

int PASCAL | WinMain (HINSTANCE hInst, HINSTANCE hInstPrev, LPSTR lpCmdLine, int nCmdShow)

Variables

long | g_lDone = 0

Function Documentation

int PASCAL WinMain | ( | HINSTANCE | hInst,
 |  | HINSTANCE | hInstPrev,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 29 of file Hello2.Cpp.

                              {

  HRESULT       hRes;
  _TCHAR        szError[256];
  VARIANT       vPath;
  BSTR        bszSpeak;
  MSG         msg;
  long        lCharID;
  long        lRequestID;
  long        lNotifySinkID = -1;
  IAgentEx       *pAgentEx;
  IAgentCharacterEx  *pCharacterEx = NULL;
  AgentNotifySink    *pSink = NULL;

  // Initialize COM

    if (FAILED(CoInitialize(NULL))) {
    MessageBox(NULL,
           _T("There was an error initializing COM."),
           kpszAppTitle,
           MB_OK | MB_ICONERROR);
        return -1;
  }

  // Create an instance of the Agent 2.0 server. NOTE: by
  // asking for an IAgentEx interface we know we will get
  // at least Agent 2.0. The CLSID also changed between
  // 1.5 and 2.0 so we know we won't get the 1.5 server.

  hRes = CoCreateInstance(CLSID_AgentServer,
              NULL,
              CLSCTX_SERVER,
              IID_IAgentEx,
              (LPVOID *)&pAgentEx);
  if (FAILED(hRes)) {

    wsprintf(szError, _T("There was an error initializing Microsoft Agent, code = 0x%x"), hRes);

    MessageBox(NULL,
           szError,
           kpszAppTitle,
           MB_OK | MB_ICONERROR);

    CoUninitialize();

    return -1;
  }

  __try {

    VariantInit(&vPath);

    // Create a notify sink

    pSink = new AgentNotifySink;

    if (pSink == NULL) {
      hRes = E_OUTOFMEMORY;
      __leave;
    }

    // AddRef it

    pSink->AddRef();

    // And register it with Microsoft Agent

    hRes = pAgentEx->Register((IUnknown *)pSink, &lNotifySinkID);

    if (FAILED(hRes))
      __leave;

    // Try to load the default character

    vPath.vt = VT_EMPTY;

    hRes = pAgentEx->Load(vPath, &lCharID, &lRequestID);

    if (FAILED(hRes)) {

      // There's no default character. See if we can load the
      // character from the directory used in most version 1.5
      // applications.

      vPath.vt = VT_BSTR;
      vPath.bstrVal = SysAllocString(kpwzCharacterOld);

      if (vPath.bstrVal == NULL) {
        hRes = E_OUTOFMEMORY;
        __leave;
      }

      hRes = pAgentEx->Load(vPath, &lCharID, &lRequestID);

      // Did we successfully load a character?

      if (FAILED(hRes))
        __leave;
    }

    // Get the IAgentCharacterEx interface

    hRes = pAgentEx->GetCharacterEx(lCharID, &pCharacterEx);

    if (FAILED(hRes))
      __leave;

    // Set the language of the character

    hRes = pCharacterEx->SetLanguageID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));

    if (FAILED(hRes))
      __leave;

    // Show the character.  The first parameter tells Microsoft
    // Agent to show the character by playing an animation.

    hRes = pCharacterEx->Show(FALSE, &lRequestID);

    if (FAILED(hRes))
      __leave;

    // Make the character speak

    bszSpeak = SysAllocString(L"Hello World!");

    hRes = pCharacterEx->Speak(bszSpeak, NULL, &g_lDone);

    SysFreeString(bszSpeak);

    if (FAILED(hRes))
      __leave;

    // Start the message loop.  A WM_QUIT message will be posted
    // when we get the RequestComplete notification from Microsoft Agent.

    while (GetMessage(&msg, NULL, 0, 0) > 0)
      DispatchMessage(&msg);

  }
  __finally {

    if (FAILED(hRes)) {

      wsprintf(szError, _T("An error occurred in Microsoft Agent, code = 0x%x"), hRes);

      MessageBox(NULL,
             szError,
             kpszAppTitle,
             MB_OK | MB_ICONERROR | MB_TOPMOST);
    }
  }

  // Clean up

  if (pCharacterEx) {

    // Release the character interface

    pCharacterEx->Release();

    // Unload the character.  NOTE:  releasing the character
    // interface does NOT make the character go away.  You must
    // call Unload.

    pAgentEx->Unload(lCharID);
  }

  // Release objects

  if (pSink) {

    if (lNotifySinkID != -1)
      pAgentEx->Unregister(lNotifySinkID);

    pSink->Release();
  }

  pAgentEx->Release();

  VariantClear(&vPath);

  CoUninitialize();

  return 0;
}

Variable Documentation

long g_lDone = 0
Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/Hello2/Hello2.h File Reference

  • Web
  • MSAgent
  • c
  • Hello2
Defines

Hello2.h File Reference

#include <windows.h>
#include <tchar.h>
#include "AgtSvr.h"

Go to the source code of this file.

Defines

#define STRICT

Define Documentation

#define STRICT

Definition at line 6 of file Hello2.h.

Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/Hello2/Notify.Cpp File Reference

  • Web
  • MSAgent
  • c
  • Hello2
Functions | Variables

Notify.Cpp File Reference

#include "Notify.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) AgentNotifySink

Variables

long g_lDone

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 50 of file Notify.Cpp.

                                              {

  if (--m_cRefs != 0)
    return m_cRefs;

  delete this;
  return 0;
}

Variable Documentation

long g_lDone
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/Hello2/Notify.h File Reference

  • Web
  • MSAgent
  • c
  • Hello2
Classes

Notify.h File Reference

#include "Hello2.h"

Go to the source code of this file.

Classes

class AgentNotifySink
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/Hello3/Hello3.Cpp File Reference

  • Web
  • MSAgent
  • c
  • Hello3
Functions | Variables

Hello3.Cpp File Reference

#include "Hello3.h"
#include "AgtSvr_i.c"
#include "Notify.h"
#include <malloc.h>

Go to the source code of this file.

Functions

HRESULT | LoadCharacter (IAgentEx *pAgentEx, LPWSTR pwzFilename, long *plCharacterID, IAgentCharacterEx **ppCharacterEx)
int PASCAL | WinMain (HINSTANCE hInst, HINSTANCE hInstPrev, LPSTR lpCmdLine, int nCmdShow)

Variables

long | g_lDone = 0

Function Documentation

HRESULT LoadCharacter | ( | IAgentEx * | pAgentEx,
 |  | LPWSTR | pwzFilename,
 |  | long * | plCharacterID,
 |  | IAgentCharacterEx ** | ppCharacterEx
 | ) |  |

Definition at line 43 of file Hello3.Cpp.

                                               {

  VARIANT vPath;
  HRESULT hRes;
  long  lRequestID;
  LPWSTR  pwzPath;

  // Create a VARIANT for the filename/path

  VariantInit(&vPath);
  vPath.vt = VT_BSTR;
  vPath.bstrVal = SysAllocString(pwzFilename);

  if (vPath.bstrVal == NULL)
    return E_OUTOFMEMORY;

  // Load the character using it's filename only. NOTE: Agent 2.0
  // will look in the %msagent%\chars directory for these files.

  hRes = pAgentEx->Load(vPath, plCharacterID, &lRequestID);

  VariantClear(&vPath);

  // Did we load it successfully?

  if (FAILED(hRes)) {

    // Try to load the character from the directory used
    // in most version 1.5 applications.

    // First, allocate a buffer on the stack for the full pathname.
    // NOTE: _alloca does NOT return NULL on failure. It raises an
    // exception so be sure to wrap this in a try/catch or __try/__except
    // block.

    __try {

      pwzPath = (LPWSTR)_alloca((wcslen(kpwzOldPath) + wcslen(pwzFilename) + 1) * sizeof(WCHAR));

    }
    __except(EXCEPTION_EXECUTE_HANDLER) {

      return E_OUTOFMEMORY;
    }

    // Build the pathname

    wcscpy(pwzPath, kpwzOldPath);
    wcscat(pwzPath, pwzFilename);

    vPath.vt = VT_BSTR;
    vPath.bstrVal = SysAllocString(pwzPath);

    if (vPath.bstrVal == NULL)
      return E_OUTOFMEMORY;

    // Try to load the character from the common 1.5 path

    hRes = pAgentEx->Load(vPath, plCharacterID, &lRequestID);

    VariantClear(&vPath);

    // Did we load it?

    if (FAILED(hRes))
      return hRes;
  }

  // Get the IAgentCharacterEx interface

  return pAgentEx->GetCharacterEx(*plCharacterID, ppCharacterEx);
}

int PASCAL WinMain | ( | HINSTANCE | hInst,
 |  | HINSTANCE | hInstPrev,
 |  | LPSTR | lpCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 120 of file Hello3.Cpp.

                              {

  HRESULT       hRes;
  _TCHAR        szError[256];
  BSTR        bszSpeak;
  MSG         msg;
  long        lGenieID;
  long        lMerlinID;
  long        lRequestID;
  long        lWaitID;
  long        lNotifySinkID = -1;
  IAgentEx       *pAgentEx;
  IAgentCharacterEx  *pGenie = NULL;
  IAgentCharacterEx  *pMerlin = NULL;
  AgentNotifySink    *pSink = NULL;

  // Initialize COM

    if (FAILED(CoInitialize(NULL))) {
    MessageBox(NULL,
           _T("There was an error initializing COM."),
           kpszAppTitle,
           MB_OK | MB_ICONERROR);
        return -1;
  }

  // Create an instance of the Agent 2.0 server. NOTE: by
  // asking for an IAgentEx interface we know we will get
  // at least Agent 2.0. The CLSID also changed between
  // 1.5 and 2.0 so we know we won't get the 1.5 server.

  hRes = CoCreateInstance(CLSID_AgentServer,
              NULL,
              CLSCTX_SERVER,
              IID_IAgentEx,
              (LPVOID *)&pAgentEx);
  if (FAILED(hRes)) {

    wsprintf(szError, _T("There was an error initializing Microsoft Agent, code = 0x%x"), hRes);

    MessageBox(NULL,
           szError,
           kpszAppTitle,
           MB_OK | MB_ICONERROR);

    CoUninitialize();

    return -1;
  }

  __try {

    // Create a notify sink

    pSink = new AgentNotifySink;

    if (pSink == NULL) {
      hRes = E_OUTOFMEMORY;
      __leave;
    }

    // AddRef it

    pSink->AddRef();

    // And register it with Microsoft Agent

    hRes = pAgentEx->Register((IUnknown *)pSink, &lNotifySinkID);

    if (FAILED(hRes))
      __leave;

    // Load Genie

    hRes = LoadCharacter(pAgentEx, kpwzGenie, &lGenieID, &pGenie);

    if (FAILED(hRes))
      __leave;

    // And Merlin

    hRes = LoadCharacter(pAgentEx, kpwzMerlin, &lMerlinID, &pMerlin);

    if (FAILED(hRes))
      __leave;

    // Set their language ids

    hRes = pGenie->SetLanguageID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));

    if (FAILED(hRes))
      __leave;

    hRes = pMerlin->SetLanguageID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));

    if (FAILED(hRes))
      __leave;

    // Position them

    hRes = pGenie->MoveTo(0, 100, 0, &lRequestID);

    if (FAILED(hRes))
      __leave;

    hRes = pMerlin->MoveTo(200, 100, 0, &lRequestID);

    if (FAILED(hRes))
      __leave;

    // Show them

    hRes = pGenie->Show(FALSE, &lRequestID);

    if (FAILED(hRes))
      __leave;

    hRes = pMerlin->Show(FALSE, &lRequestID);

    if (FAILED(hRes))
      __leave;

    // Have Genie gesture towards Merlin

    hRes = pGenie->GestureAt(150, 100, &lRequestID);

    if (FAILED(hRes))
      __leave;

    // And have Genie say hello to Merlin

    bszSpeak = SysAllocString(L"Hi there Merlin.");

    hRes = pGenie->Speak(bszSpeak, NULL, &lWaitID);

    SysFreeString(bszSpeak);

    if (FAILED(hRes))
      __leave;

    // Make Merlin wait for Genie to finish speaking

    hRes = pMerlin->Wait(lWaitID, &lRequestID);

    if (FAILED(hRes))
      __leave;

    // Have Merlin gesture towards Genie

    hRes = pMerlin->GestureAt(0, 100, &lRequestID);

    if (FAILED(hRes))
      __leave;

    // And then speak back to Genie

    bszSpeak = SysAllocString(L"Hi Genie. See you later");

    hRes = pMerlin->Speak(bszSpeak, NULL, &g_lDone);

    SysFreeString(bszSpeak);

    if (FAILED(hRes))
      __leave;

    // Start the message loop.  A WM_QUIT message will be posted
    // when we get the RequestComplete notification from Microsoft Agent.

    while (GetMessage(&msg, NULL, 0, 0) > 0)
      DispatchMessage(&msg);

  }
  __finally {

    if (FAILED(hRes)) {

      wsprintf(szError, _T("An error occurred in Microsoft Agent, code = 0x%x"), hRes);

      MessageBox(NULL,
             szError,
             kpszAppTitle,
             MB_OK | MB_ICONERROR | MB_TOPMOST);
    }
  }

  // Release the character interfaces.  NOTE:  releasing the character
  // interface does NOT make the character go away.  You must
  // call Unload.

  if (pGenie) {
    pGenie->Release();
    pAgentEx->Unload(lGenieID);
  }

  if (pMerlin) {
    pMerlin->Release();
    pAgentEx->Unload(lMerlinID);
  }

  // Release objects

  if (pSink) {

    if (lNotifySinkID != -1)
      pAgentEx->Unregister(lNotifySinkID);

    pSink->Release();
  }

  pAgentEx->Release();

  CoUninitialize();

  return 0;
}

Variable Documentation

long g_lDone = 0
Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/Hello3/Hello3.h File Reference

  • Web
  • MSAgent
  • c
  • Hello3
Defines

Hello3.h File Reference

#include <windows.h>
#include <tchar.h>
#include "AgtSvr.h"

Go to the source code of this file.

Defines

#define STRICT

Define Documentation

#define STRICT

Definition at line 6 of file Hello3.h.

Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/Hello3/Notify.Cpp File Reference

  • Web
  • MSAgent
  • c
  • Hello3
Functions | Variables

Notify.Cpp File Reference

#include "Notify.h"

Go to the source code of this file.

Functions

STDMETHODIMP_ (ULONG) AgentNotifySink

Variables

long g_lDone

Function Documentation

STDMETHODIMP_ ( ULONG )

Definition at line 50 of file Notify.Cpp.

                                              {

  if (--m_cRefs != 0)
    return m_cRefs;

  delete this;
  return 0;
}

Variable Documentation

long g_lDone
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/c/Hello3/Notify.h File Reference

  • Web
  • MSAgent
  • c
  • Hello3
Classes

Notify.h File Reference

#include "Hello3.h"

Go to the source code of this file.

Classes

class AgentNotifySink
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/Java/CapJ/about.java File Reference

  • Web
  • MSAgent
  • Java
  • CapJ
Classes

about.java File Reference

Go to the source code of this file.

Classes

class About
Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/Java/CapJ/capj.java File Reference

  • Web
  • MSAgent
  • Java
  • CapJ
Classes

capj.java File Reference

Go to the source code of this file.

Classes

class CapJ
.import("USER32", auto) More...
Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/Java/Hello/HelloJ.java File Reference

  • Web
  • MSAgent
  • Java
  • Hello
Classes

HelloJ.java File Reference

Go to the source code of this file.

Classes

class HelloJ
Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/Java/Hello2/Hello2J.java File Reference

  • Web
  • MSAgent
  • Java
  • Hello2
Classes

Hello2J.java File Reference

Go to the source code of this file.

Classes

class Hello2J
Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/Java/Hello2/notify.java File Reference

  • Web
  • MSAgent
  • Java
  • Hello2
Classes

notify.java File Reference

Go to the source code of this file.

Classes

class Notify
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/Java/Hello3/Hello3J.java File Reference

  • Web
  • MSAgent
  • Java
  • Hello3
Classes

Hello3J.java File Reference

Go to the source code of this file.

Classes

class Hello3J
Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/MSAgent/Java/Hello3/Notify.java File Reference

  • Web
  • MSAgent
  • Java
  • Hello3
Classes

Notify.java File Reference

Go to the source code of this file.

Classes

class Notify
Generated on Wed Nov 13 2024 16:53:22 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/InstCodc/InstCodc.Cpp File Reference

  • Web
  • NetMeeting
  • InstCodc
Enumerations | Functions | Variables

InstCodc.Cpp File Reference

#include <stdio.h>
#include <stdarg.h>
#include <tchar.h>
#include <windows.h>
#include <windowsx.h>
#include <objbase.h>
#include <initguid.h>
#include "resource.h"
#include "codecs.h"

Go to the source code of this file.

Enumerations

enum | CODECTYPE { AUDIOCODEC, NONE }

Functions

void | DebugTextOut (TCHAR *ptszFormat,...)
void | DeinitAppInstance (HINSTANCE hInstance)
void | DlgDisplayInstalledCodecs (HWND)
void | HRErrorToString (HRESULT hr)
void | IndexInstalledCodecs (void)
BOOL | InitAppInstance (HINSTANCE hInstance)
void | LoadInstalledCodecs (void)
void | MainUI_OnClose (HWND hwnd)
void | MainUI_OnCommand (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
void | MainUI_OnDestroy (HWND hwnd)
BOOL | MainUI_OnInitDialog (HWND hwnd, HWND hwndFocus, LPARAM lParam)
LRESULT CALLBACK | MainUIProc (HWND hwnd, UINT message, UINT wParam, LONG lParam)
void | ReorderUI_OnClose (HWND hwnd)
void | ReorderUI_OnCommand (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
void | ReorderUI_OnDestroy (HWND hwnd)
BOOL | ReorderUI_OnInitDialog (HWND hwnd, HWND hwndFocus, LPARAM lParam)
LRESULT CALLBACK | ReorderUIProc (HWND hwnd, UINT message, UINT wParam, LONG lParam)
void | UpdateCapInfoListsFromIndex (void)
int PASCAL | WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow)

Variables

HINSTANCE | ghInstance = NULL
int * | gpnAudCapOrderedIndex = NULL
AUDCAP_INFO_LIST * | gpsAudCapInfoList = NULL
WAVEFORMATEX * | gpWFmt = NULL
TCHAR | gszHRError [MID_SZ]
CODECTYPE | gtCodec = AUDIOCODEC
AUDCAP_INFO | gWInfo
const int | MID_SZ = 128

Enumeration Type Documentation

enum CODECTYPE
Enumerator:
AUDIOCODEC
NONE

Definition at line 28 of file InstCodc.Cpp.

{AUDIOCODEC, NONE} CODECTYPE;

Function Documentation

void DebugTextOut | ( | TCHAR * | ptszFormat,
 |  |  | ...
 | ) |  |

Definition at line 758 of file InstCodc.Cpp.

{
    TCHAR       ptszBuffer[1048];
    va_list     pArgList;

    va_start(pArgList, ptszFormat);
    _vsntprintf(ptszBuffer, sizeof(ptszBuffer)/sizeof(ptszBuffer[0]), ptszFormat, pArgList);
    va_end(pArgList);

    OutputDebugString(ptszBuffer);
}

void DeinitAppInstance ( HINSTANCE hInstance )

Definition at line 199 of file InstCodc.Cpp.

{
    //End COM support
    CoUninitialize();

    //free the allocated memory
    LocalFree(gpWFmt);
    gpWFmt = NULL;
}

void DlgDisplayInstalledCodecs ( HWND hwnd )

Definition at line 718 of file InstCodc.Cpp.

{
    unsigned int    i;
    HWND            hListBox = NULL;

    if (NULL == gpsAudCapInfoList)
    {
        DebugTextOut(TEXT("gpsAudCapInfoList is NULL\n"));
        return;
    }

    if (NULL == gpnAudCapOrderedIndex)
    {
        DebugTextOut(TEXT("gpnAudCapOrderedIndex is NULL\n"));
        return;
    }

    //Display Installed Codecs
    hListBox = GetDlgItem(hwnd,IDC_LBINSTALLEDCODECS);
    SendMessage(hListBox,LB_RESETCONTENT,0,0);

    if (gtCodec==AUDIOCODEC)
    {
        for (i=0;i<gpsAudCapInfoList->cFormats;i++)
        {
            SendMessage(hListBox,LB_ADDSTRING,0,(LPARAM)(LPCSTR)gpsAudCapInfoList->aFormats[gpnAudCapOrderedIndex[i]].szFormat);
        }
    }

}

void HRErrorToString ( HRESULT hr ) [inline]

Definition at line 79 of file InstCodc.Cpp.

{
    FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,NULL,(DWORD)hr,LANG_SYSTEM_DEFAULT,gszHRError,MID_SZ,NULL);
}

void IndexInstalledCodecs ( void )

Definition at line 650 of file InstCodc.Cpp.

{
    unsigned int i;

    if (NULL == gpsAudCapInfoList)
    {
        DebugTextOut(TEXT("gpsAudCapInfoList is NULL\n"));
        return;
    }

    if (NULL == gpnAudCapOrderedIndex)
    {
        DebugTextOut(TEXT("gpnAudCapOrderedIndex is NULL\n"));
        return;
    }

    if (gtCodec==AUDIOCODEC)
    {
        for (i=0;i<gpsAudCapInfoList->cFormats;i++)
        {
            gpnAudCapOrderedIndex[gpsAudCapInfoList->aFormats[i].wSortIndex]=i;
        }
    }

}

BOOL InitAppInstance ( HINSTANCE hInstance )

Definition at line 124 of file InstCodc.Cpp.

{
    WNDCLASS    wc;
    BYTE        gWFmtEx[] = {0x40,0x01};

    ghInstance = hInstance;

    //Register WNDCLASS for the app.

    //This class enables the main dialog box to have additional properties
    //such as an icon.
    wc.style            = CS_DBLCLKS | CS_SAVEBITS | CS_BYTEALIGNWINDOW;
    wc.lpfnWndProc      = DefDlgProc;
    wc.cbClsExtra       = 0;
    wc.cbWndExtra       = DLGWINDOWEXTRA;
    wc.hInstance        = hInstance;
    wc.hIcon            = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_INSTCODC));
    wc.hCursor          = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground    = (HBRUSH)GetStockObject(WHITE_BRUSH);
    wc.lpszMenuName     = NULL;
    wc.lpszClassName    = TEXT("CodecInstClass");

    if (!RegisterClass(&wc))
    {
        DebugTextOut(TEXT("Register class failed!\n"));
        return FALSE;
    }

    //Setup audio codec structures
    //This particular codec is: GSM 6.10, 8,000 Hz, Mono
    gpWFmt = (WAVEFORMATEX *)LocalAlloc(LPTR,sizeof(WAVEFORMATEX)+sizeof(gWFmtEx));
    if (NULL == gpWFmt)
    {
        DebugTextOut(TEXT("Out of memory\n"));
        return FALSE;
    }

    gpWFmt->wFormatTag      = 49;
    gpWFmt->nChannels       = 1;
    gpWFmt->nSamplesPerSec  = 8000;
    gpWFmt->nAvgBytesPerSec = 1625;
    gpWFmt->nBlockAlign     = 65;
    gpWFmt->wBitsPerSample  = 0;
    gpWFmt->cbSize          = sizeof(gWFmtEx);

    CopyMemory((gpWFmt + 1), gWFmtEx, gpWFmt->cbSize);

    ZeroMemory(&gWInfo,sizeof(AUDCAP_INFO));
    gWInfo.wFormatTag = 49;
    gWInfo.uAvgBitrate = 13000;
    gWInfo.wCPUUtilizationEncode = 50; //arbitrary
    gWInfo.wCPUUtilizationDecode = 20; //artitrary
    gWInfo.bSendEnabled = 1;
    gWInfo.bRecvEnabled = 1;

    //Setup COM support
    if (FAILED(CoInitialize(NULL)))
    {
        DebugTextOut(TEXT("CoInitialize failed\n"));
        return FALSE;
    }

    //Application is a Modal Dialog.
    return DialogBox(hInstance,MAKEINTRESOURCE(IDD_MAINUI),0,(DLGPROC)MainUIProc);
}

void LoadInstalledCodecs ( void )

Definition at line 594 of file InstCodc.Cpp.

{
    HRESULT hr = S_OK;

    // Make sure that we have an IInstallAudioCodecs*
    if (NULL == pAudio)
    {
        DebugTextOut(TEXT("pAudio is NULL\n"));
        return;
    }

    //free any existing info
    if (gtCodec==AUDIOCODEC)
    {
        if (NULL != gpsAudCapInfoList)
        {
            hr = pAudio->FreeBuffer(gpsAudCapInfoList);
            if (FAILED(hr))
            {
                DebugTextOut(TEXT("pAudio->FreeBuffer failed. hr = 0x%08p\n"), hr);
                return;
            }
        }

        //Get Installed Audio Codecs
        hr = pAudio->EnumFormats(&gpsAudCapInfoList);
        if (FAILED(hr))
        {
            DebugTextOut(TEXT("pAudio->EnumFormats failed. hr = 0x%08p\n"), hr);
            gpsAudCapInfoList=NULL;
        }
        else
        {
            LocalFree(gpnAudCapOrderedIndex);

            gpnAudCapOrderedIndex = (int *)LocalAlloc(LPTR,sizeof(int) * gpsAudCapInfoList->cFormats);
            if (NULL == gpnAudCapOrderedIndex)
            {
                DebugTextOut(TEXT("Out of memory\n"));
            }
        }
    }

    //Structures returned by EnumFormats not guarenteed to be inorder.
    IndexInstalledCodecs();
}

void MainUI_OnClose ( HWND hwnd )

Definition at line 307 of file InstCodc.Cpp.

{
    EndDialog(hwnd,0);
}

void MainUI_OnCommand | ( | HWND | hwnd,
 |  | int | id,
 |  | HWND | hwndCtl,
 |  | UINT | codeNotify
 | ) |  |

Definition at line 318 of file InstCodc.Cpp.

{
    TCHAR szString[MID_SZ];
    TCHAR szString2[MID_SZ];

    if (NULL == pAudio)
    {
        DebugTextOut(TEXT("Application not initialized!\n"));
        return;
    }

    switch(id)
    {
        //Install the codec
        case IDC_INSTALL:
        {
            if (gtCodec==AUDIOCODEC)
            {
                if (FAILED(pAudio->AddACMFormat(gpWFmt,&gWInfo)))
                {
                    LoadString(ghInstance,IDS_IAFMT,szString,MID_SZ);
                    LoadString(ghInstance,IDS_AAFMT,szString2,MID_SZ);
                    MessageBox(hwnd,szString,szString2,MB_OK|MB_ICONEXCLAMATION);
                }
            }
            LoadInstalledCodecs();
            break;
        }

        // Uninstall the codec
        case IDC_UNINSTALL:
        {
            if (gtCodec==AUDIOCODEC)
            {
                if (FAILED(pAudio->RemoveACMFormat(gpWFmt)))
                {
                    LoadString(ghInstance,IDS_UAFMT,szString,MID_SZ);
                    LoadString(ghInstance,IDS_RAFMT,szString2,MID_SZ);
                    MessageBox(hwnd,szString,szString2,MB_OK|MB_ICONEXCLAMATION);
                }
            }

            LoadInstalledCodecs();
            break;
        }

        // Reorder the codecs
        case IDC_REORDER:
        {
            DialogBox(ghInstance,MAKEINTRESOURCE(IDD_REORDER),hwnd,(DLGPROC)ReorderUIProc);
            break;
        }
    }

    DlgDisplayInstalledCodecs(hwnd);
}

void MainUI_OnDestroy ( HWND hwnd )

Definition at line 268 of file InstCodc.Cpp.

{
    HRESULT hr = S_OK;

    if (NULL == pAudio)
    {
        DebugTextOut(TEXT("Application not initialized!\n"));
        return;
    }

    // Free CapInfo structures
    if (NULL != gpsAudCapInfoList)
    {
        hr = pAudio->FreeBuffer(gpsAudCapInfoList);
        if (FAILED(hr))
        {
            // Simply log the failure, and continue. We want to continue and clean up
            DebugTextOut(TEXT("pAudio->FreeBuffer failed, hr = 0x%08p"), hr);
        }
    }

    // Release the interfaces
    if (NULL != pAudio)
    {
        pAudio->Release();
        pAudio = NULL;
    }

    // Free CapInfoIndexs
    LocalFree(gpnAudCapOrderedIndex);
    gpnAudCapOrderedIndex = NULL;
}

BOOL MainUI_OnInitDialog | ( | HWND | hwnd,
 |  | HWND | hwndFocus,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 218 of file InstCodc.Cpp.

{
    HRESULT hr  = S_OK;
    TCHAR   szString[MID_SZ];

    gtCodec = NONE;

    //Get an interface to the audio codec methods
    hr = CoCreateInstance(  CLSID_InstallCodecs,
                            NULL,
                            CLSCTX_INPROC_SERVER,
                            IID_IInstallAudioCodecs,
                            (void **) &pAudio);
    if (FAILED(hr))
    {
        pAudio = NULL;
        HRErrorToString(hr);
        LoadString(ghInstance,IDS_GETIAUDIO,szString,MID_SZ);
        MessageBox(NULL,gszHRError,szString,MB_OK);
    }
    else
    {
        gtCodec = AUDIOCODEC;
    }

    // If no interfaces were available, disable everything.
    if (gtCodec == NONE)
    {
        EnableWindow(GetDlgItem(hwnd,IDC_INSTALL),FALSE);
        EnableWindow(GetDlgItem(hwnd,IDC_UNINSTALL),FALSE);
        EnableWindow(GetDlgItem(hwnd,IDC_REORDER),FALSE);
        EnableMenuItem(GetMenu(hwnd),0,MF_BYPOSITION|MF_GRAYED);
        return TRUE;
    }

    //Load installed codec formats
    LoadInstalledCodecs();

    //display codecs
    DlgDisplayInstalledCodecs(hwnd);
    return TRUE;
}

LRESULT CALLBACK MainUIProc | ( | HWND | hwnd,
 |  | UINT | message,
 |  | UINT | wParam,
 |  | LONG | lParam
 | ) |  |

Definition at line 381 of file InstCodc.Cpp.

{

    LRESULT fProcessed=TRUE;

    switch(message)
    {
        HANDLE_MSG(hwnd,WM_INITDIALOG,MainUI_OnInitDialog);
        HANDLE_MSG(hwnd,WM_CLOSE,MainUI_OnClose);
        HANDLE_MSG(hwnd,WM_DESTROY,MainUI_OnDestroy);
        HANDLE_MSG(hwnd,WM_COMMAND,MainUI_OnCommand);

    default:
        fProcessed=FALSE;
        break;
    }
    return (fProcessed);
}

void ReorderUI_OnClose ( HWND hwnd )

Definition at line 429 of file InstCodc.Cpp.

{
    IndexInstalledCodecs();
    ReorderUI_OnDestroy(hwnd);
}

void ReorderUI_OnCommand | ( | HWND | hwnd,
 |  | int | id,
 |  | HWND | hwndCtl,
 |  | UINT | codeNotify
 | ) |  |

Definition at line 441 of file InstCodc.Cpp.

{
    HWND    hListBox    = NULL;
    HRESULT hr          = S_OK;
    int     tmp         = 0;
    int     index       = 0;

    switch(id)
    {
        // Move the selected codec up in the list box, and update the CapInfoIndex
        case IDC_UP:
        {
            if (NULL == gpsAudCapInfoList)
            {
                DebugTextOut(TEXT("gpsAudCapInfoList not initialized.\n"));
                return;
            }

            if (NULL == gpnAudCapOrderedIndex)
            {
                DebugTextOut(TEXT("gpnAudCapOrderedIndex not initialized.\n"));
                return;
            }

            hListBox = GetDlgItem(hwnd,IDC_LBINSTALLEDCODECS);
            if (NULL == hListBox)
            {
                DebugTextOut(TEXT("GetDlgItem failed! Error = 0x%08p.\n"), HRESULT_FROM_WIN32(GetLastError()));
                return;
            }

            //get text of current selection
            index = SendMessage(hListBox,LB_GETCURSEL,0,0);

            //if wasn't able to get selection
            if (index==0 || index==LB_ERR)
                return;

            SendMessage(hListBox,LB_DELETESTRING,index,0);
            SendMessage(hListBox,LB_INSERTSTRING,index-1,(LPARAM)(LPCSTR)gpsAudCapInfoList->aFormats[gpnAudCapOrderedIndex[index]].szFormat);

            tmp = gpnAudCapOrderedIndex[index-1];
            gpnAudCapOrderedIndex[index-1] = gpnAudCapOrderedIndex[index];
            gpnAudCapOrderedIndex[index] = tmp;

            SendMessage(hListBox,LB_SETCURSEL,index-1,0);
            break;
        }

        // Move the selected codec down in the list box, and update the CapInfoIndex
        case IDC_DOWN:
        {
            if (NULL == gpsAudCapInfoList)
            {
                DebugTextOut(TEXT("gpsAudCapInfoList not initialized.\n"));
                return;
            }

            hListBox = GetDlgItem(hwnd,IDC_LBINSTALLEDCODECS);
            if (NULL == hListBox)
            {
                DebugTextOut(TEXT("GetDlgItem failed! Error = 0x%08p.\n"), HRESULT_FROM_WIN32(GetLastError()));
                return;
            }

            //get text of current selection
            index = SendMessage(hListBox,LB_GETCURSEL,0,0);

            if (    (index == (int)(gpsAudCapInfoList->cFormats - 1)) ||
                    (index == (int)LB_ERR))
                return;

            SendMessage(hListBox,LB_DELETESTRING,index,0);
            SendMessage(hListBox,LB_INSERTSTRING,index+1,(LPARAM)(LPCSTR)gpsAudCapInfoList->aFormats[gpnAudCapOrderedIndex[index]].szFormat);

            tmp = gpnAudCapOrderedIndex[index+1];
            gpnAudCapOrderedIndex[index+1] = gpnAudCapOrderedIndex[index];
            gpnAudCapOrderedIndex[index] = tmp;

            SendMessage(hListBox,LB_SETCURSEL,index+1,0);
            break;
        }

        // Update the CapInfoList from the CapInfoIndex
        // Call ReorderFormats to reorder the codecs in NetMtg
        // Reload the CapInfoList w/ the new info.
        case IDC_OK:
        {
            UpdateCapInfoListsFromIndex();

            if (NULL == pAudio)
            {
                DebugTextOut(TEXT("pAudio is NULL\n"));
                return;
            }

            hr = pAudio->ReorderFormats(gpsAudCapInfoList);
            if (FAILED(hr))
            {
                DebugTextOut(TEXT("pAudio->ReorderFormats failed. hr = 0x%08p\n"), hr);
                return;
            }

            //refresh display
            LoadInstalledCodecs();
            EndDialog(hwnd,TRUE);
            break;
        }

        // Cancel changes by reinitializing the CapInfoIndexs from the
        // CapInfoLists and ending the dialog.
        case IDC_CANCEL:
        {
            IndexInstalledCodecs();
            EndDialog(hwnd,TRUE);
            break;
        }
    }
}

void ReorderUI_OnDestroy ( HWND hwnd )

Definition at line 418 of file InstCodc.Cpp.

{
    EndDialog(hwnd,TRUE);
}

BOOL ReorderUI_OnInitDialog | ( | HWND | hwnd,
 |  | HWND | hwndFocus,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 406 of file InstCodc.Cpp.

{
    DlgDisplayInstalledCodecs(hwnd);
    return TRUE;
}

LRESULT CALLBACK ReorderUIProc | ( | HWND | hwnd,
 |  | UINT | message,
 |  | UINT | wParam,
 |  | LONG | lParam
 | ) |  |

Definition at line 568 of file InstCodc.Cpp.

{
    LRESULT fProcessed=TRUE;

    switch(message)
    {
        HANDLE_MSG(hwnd,WM_INITDIALOG,ReorderUI_OnInitDialog);
        HANDLE_MSG(hwnd,WM_CLOSE,ReorderUI_OnClose);
        HANDLE_MSG(hwnd,WM_DESTROY,ReorderUI_OnDestroy);
        HANDLE_MSG(hwnd,WM_COMMAND,ReorderUI_OnCommand);

    default:
        fProcessed=FALSE;
        break;
    }
    return (fProcessed);
}

void UpdateCapInfoListsFromIndex ( void )

Definition at line 684 of file InstCodc.Cpp.

{
    unsigned int i;

    if (NULL == gpsAudCapInfoList)
    {
        DebugTextOut(TEXT("gpsAudCapInfoList is NULL\n"));
        return;
    }

    if (NULL == gpnAudCapOrderedIndex)
    {
        DebugTextOut(TEXT("gpnAudCapOrderedIndex is NULL\n"));
        return;
    }

    if (gtCodec==AUDIOCODEC)
    {
        for (i=0;i<gpsAudCapInfoList->cFormats;i++)
        {
            gpsAudCapInfoList->aFormats[gpnAudCapOrderedIndex[i]].wSortIndex=i;
        }
    }

}

int PASCAL WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hPrevInstance,
 |  | LPSTR | lpszCmdLine,
 |  | int | nCmdShow
 | ) |  |

Definition at line 102 of file InstCodc.Cpp.

{
    BOOL fProcessed = FALSE;

    fProcessed = InitAppInstance(hInstance);
    if (fProcessed == FALSE)
    {
        DebugTextOut(TEXT("InitAppInstance failed\n"));
    }

    DeinitAppInstance(hInstance);
    return fProcessed;
}

Variable Documentation

HINSTANCE ghInstance = NULL

Definition at line 37 of file InstCodc.Cpp.

int* gpnAudCapOrderedIndex = NULL

Definition at line 45 of file InstCodc.Cpp.

AUDCAP_INFO_LIST* gpsAudCapInfoList = NULL

Definition at line 43 of file InstCodc.Cpp.

WAVEFORMATEX* gpWFmt = NULL

Definition at line 39 of file InstCodc.Cpp.

TCHAR gszHRError[MID_SZ]

Definition at line 78 of file InstCodc.Cpp.

CODECTYPE gtCodec = AUDIOCODEC

Definition at line 34 of file InstCodc.Cpp.

AUDCAP_INFO gWInfo

Definition at line 40 of file InstCodc.Cpp.

const int MID_SZ = 128

Definition at line 33 of file InstCodc.Cpp.

Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/InstCodc/Resource.h File Reference

  • Web
  • NetMeeting
  • InstCodc
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_CANCEL 1003
#define | IDC_DOWN 1005
#define | IDC_INSTALL 1004
#define | IDC_LBINSTALLEDCODECS 1043
#define | IDC_OK 1002
#define | IDC_REORDER 1020
#define | IDC_UNINSTALL 1006
#define | IDC_UP 1025
#define | IDD_MAINUI 101
#define | IDD_REORDER 106
#define | IDI_INSTCODC 108
#define | IDS_AAFMT 14
#define | IDS_GETIAUDIO 2
#define | IDS_IAFMT 16
#define | IDS_RAFMT 13
#define | IDS_UAFMT 17

Define Documentation

#define IDC_CANCEL 1003

Definition at line 14 of file Resource.h.

#define IDC_DOWN 1005

Definition at line 16 of file Resource.h.

#define IDC_INSTALL 1004

Definition at line 15 of file Resource.h.

#define IDC_LBINSTALLEDCODECS 1043

Definition at line 20 of file Resource.h.

#define IDC_OK 1002

Definition at line 13 of file Resource.h.

#define IDC_REORDER 1020

Definition at line 18 of file Resource.h.

#define IDC_UNINSTALL 1006

Definition at line 17 of file Resource.h.

#define IDC_UP 1025

Definition at line 19 of file Resource.h.

#define IDD_MAINUI 101

Definition at line 10 of file Resource.h.

#define IDD_REORDER 106

Definition at line 11 of file Resource.h.

#define IDI_INSTCODC 108

Definition at line 12 of file Resource.h.

#define IDS_AAFMT 14

Definition at line 7 of file Resource.h.

#define IDS_GETIAUDIO 2

Definition at line 5 of file Resource.h.

#define IDS_IAFMT 16

Definition at line 8 of file Resource.h.

#define IDS_RAFMT 13

Definition at line 6 of file Resource.h.

#define IDS_UAFMT 17

Definition at line 9 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMChat/CConf.Cpp File Reference

  • Web
  • NetMeeting
  • NMChat
Functions | Variables

CConf.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

VOID | FreeConference (void)
VOID | FreeConfMgr (void)
HRESULT | HookConference (INmConference *pConference)
HRESULT | InitConfMgr (void)

Variables

BOOL | g_fActiveConference = FALSE
const GUID | g_guidApp
const GUID | g_guidNM2Chat
INmConference * | g_pConference = NULL
CConfNotify * | g_pConferenceNotify = NULL
INmManager * | g_pMgr = NULL
CMgrNotify * | g_pMgrNotify = NULL

Function Documentation

VOID FreeConference ( void )

Definition at line 189 of file CConf.Cpp.

{
  if (NULL != g_pConferenceNotify)
  {
    g_pConferenceNotify->Disconnect();
    g_pConferenceNotify->Release();
    g_pConferenceNotify = NULL;
  }

  if (NULL != g_pConference)
  {
    g_pConference->Release();
    g_pConference = NULL;
  }
}

VOID FreeConfMgr ( void )

Definition at line 164 of file CConf.Cpp.

{
  // Release conference manager notify
  if (NULL != g_pMgrNotify)
  {
    g_pMgrNotify->Disconnect();
    g_pMgrNotify->Release();
    g_pMgrNotify = NULL;
  }

  // Release conference manager
  if (NULL != g_pMgr)
  {
    g_pMgr->Release();
    g_pMgr = NULL;
  }
}

HRESULT HookConference ( INmConference * pConference )

Definition at line 259 of file CConf.Cpp.

{
  HRESULT hr = NO_ERROR;

  ASSERT(NULL != pConference);
  ASSERT(NULL == g_pConference);

  if(NULL == pConference)
  {
    return E_POINTER;
  }

  if(NULL != g_pConference)
  {
    return E_POINTER;
  }

  g_pConference = pConference;

  pConference->AddRef();

    // Connect to the conference object
    ASSERT(NULL == g_pConferenceNotify)
    g_pConferenceNotify = new CConfNotify();
    if (NULL == g_pConferenceNotify)
    {
        hr = E_OUTOFMEMORY;
    }
    else
    {
    hr = g_pConferenceNotify->Connect(pConference);
    if (FAILED(hr))
    {
      g_pConferenceNotify->Release();
      g_pConferenceNotify = NULL;
    }
  }

  return hr;
}

HRESULT InitConfMgr ( void )

Definition at line 115 of file CConf.Cpp.

{
  HRESULT hr      = NO_ERROR;
  LPCLASSFACTORY pcf  = NULL;

    // Notify the system we want to use the conferencing services
    // by creating a conference manager object
    hr = CoGetClassObject(CLSID_NmManager,
                          CLSCTX_INPROC,
                          NULL,
                          IID_IClassFactory,
                          (void**)&pcf);
    if (SUCCEEDED(hr))
    {
        // Get the conference manager object
        hr = pcf->CreateInstance(NULL, IID_INmManager, (void**)&g_pMgr);
      if (SUCCEEDED(hr))
        {
            // Connect to the conference manager object
            g_pMgrNotify = new CMgrNotify();
            if (NULL != g_pMgrNotify)
            {
                hr = g_pMgrNotify->Connect(g_pMgr);
          if (SUCCEEDED(hr))
                {
                  ULONG uchCaps = NMCH_ALL;
                  ULONG uOptions = 0;
          hr = g_pMgr->Initialize(&uOptions, &uchCaps);
          if(FAILED(hr))
          {
            return hr;
          }
        }
            }
        }

        pcf->Release();
    }

  return hr;
}

Variable Documentation

BOOL g_fActiveConference = FALSE

Definition at line 22 of file CConf.Cpp.

const GUID g_guidApp
Initial value:

{ 0xd29a8c51, 0x774f, 0x11d0, { 0x8b, 0x1d, 0x0, 0xa0, 0xc9, 0x1b, 0xc9, 0xe} }

Definition at line 25 of file CConf.Cpp.

const GUID g_guidNM2Chat
Initial value:
{ 0x340f3a60, 0x7067, 0x11d0, { 0xa0, 0x41, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0 } }

Definition at line 29 of file CConf.Cpp.

INmConference* g_pConference = NULL

Definition at line 20 of file CConf.Cpp.

CConfNotify * g_pConferenceNotify = NULL

Definition at line 21 of file CConf.Cpp.

INmManager* g_pMgr = NULL

Definition at line 18 of file CConf.Cpp.

CMgrNotify* g_pMgrNotify = NULL

Definition at line 19 of file CConf.Cpp.

Generated on Wed Nov 13 2024 16:54:53 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMChat/CConf.h File Reference

  • Web
  • NetMeeting
  • NMChat
Classes | Functions | Variables

CConf.h File Reference

Go to the source code of this file.

Classes

class | CConfNotify
class | CMgrNotify

Functions

VOID | FreeConference (void)
VOID | FreeConfMgr (void)
HRESULT | HookConference (INmConference *pConference)
HRESULT | InitConfMgr (void)

Variables

BOOL g_fActiveConference
INmConference * | g_pConference
INmManager * | g_pMgr

Function Documentation

VOID FreeConference ( void )

Definition at line 189 of file CConf.Cpp.

{
  if (NULL != g_pConferenceNotify)
  {
    g_pConferenceNotify->Disconnect();
    g_pConferenceNotify->Release();
    g_pConferenceNotify = NULL;
  }

  if (NULL != g_pConference)
  {
    g_pConference->Release();
    g_pConference = NULL;
  }
}

VOID FreeConfMgr ( void )

Definition at line 164 of file CConf.Cpp.

{
  // Release conference manager notify
  if (NULL != g_pMgrNotify)
  {
    g_pMgrNotify->Disconnect();
    g_pMgrNotify->Release();
    g_pMgrNotify = NULL;
  }

  // Release conference manager
  if (NULL != g_pMgr)
  {
    g_pMgr->Release();
    g_pMgr = NULL;
  }
}

HRESULT HookConference ( INmConference * pConference )

Definition at line 259 of file CConf.Cpp.

{
  HRESULT hr = NO_ERROR;

  ASSERT(NULL != pConference);
  ASSERT(NULL == g_pConference);

  if(NULL == pConference)
  {
    return E_POINTER;
  }

  if(NULL != g_pConference)
  {
    return E_POINTER;
  }

  g_pConference = pConference;

  pConference->AddRef();

    // Connect to the conference object
    ASSERT(NULL == g_pConferenceNotify)
    g_pConferenceNotify = new CConfNotify();
    if (NULL == g_pConferenceNotify)
    {
        hr = E_OUTOFMEMORY;
    }
    else
    {
    hr = g_pConferenceNotify->Connect(pConference);
    if (FAILED(hr))
    {
      g_pConferenceNotify->Release();
      g_pConferenceNotify = NULL;
    }
  }

  return hr;
}

HRESULT InitConfMgr ( void )

Definition at line 115 of file CConf.Cpp.

{
  HRESULT hr      = NO_ERROR;
  LPCLASSFACTORY pcf  = NULL;

    // Notify the system we want to use the conferencing services
    // by creating a conference manager object
    hr = CoGetClassObject(CLSID_NmManager,
                          CLSCTX_INPROC,
                          NULL,
                          IID_IClassFactory,
                          (void**)&pcf);
    if (SUCCEEDED(hr))
    {
        // Get the conference manager object
        hr = pcf->CreateInstance(NULL, IID_INmManager, (void**)&g_pMgr);
      if (SUCCEEDED(hr))
        {
            // Connect to the conference manager object
            g_pMgrNotify = new CMgrNotify();
            if (NULL != g_pMgrNotify)
            {
                hr = g_pMgrNotify->Connect(g_pMgr);
          if (SUCCEEDED(hr))
                {
                  ULONG uchCaps = NMCH_ALL;
                  ULONG uOptions = 0;
          hr = g_pMgr->Initialize(&uOptions, &uchCaps);
          if(FAILED(hr))
          {
            return hr;
          }
        }
            }
        }

        pcf->Release();
    }

  return hr;
}

Variable Documentation

BOOL g_fActiveConference

Definition at line 22 of file CConf.Cpp.

INmConference* g_pConference

Definition at line 20 of file CConf.Cpp.

INmManager* g_pMgr

Definition at line 18 of file CConf.Cpp.

Generated on Wed Nov 13 2024 16:54:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMChat/cData.Cpp File Reference

  • Web
  • NetMeeting
  • NMChat
Functions | Variables

cData.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

VOID | CheckDataChannel (void)
VOID | DisplayMessage (LPTSTR pszMsg, LPTSTR pszUser)
VOID | DisplayMsg (LPTSTR pszMsg, INmMember *pMember)
VOID | DisplaySysMsg (LPTSTR pszMsg, INmMember *pMember)
VOID | FreeDataChannel (void)
HRESULT | HookData (INmChannelData *pChannelData)

Variables

INmChannelData * | g_pChannelData = NULL
CDataNotify * | g_pNotifyData = NULL

Function Documentation

VOID CheckDataChannel ( void )

Definition at line 349 of file cData.Cpp.

{
  ULONG id            = 0;
  HRESULT hr            = NO_ERROR;
  INmChannelData * pChannelData = NULL;

  if (NULL != g_pChannelData)
  {
    return; // already created
  }

  if (NULL == g_pMemberLocal)
  {
    return; // we're not in the conference yet
  }

  if (FAILED(g_pMemberLocal->GetID(&id)))
  {
    return;
  }

  if (0 == id)
  {
    return; // no local data id
  }

#ifdef NM2_CHAT_PROTOCOL
  hr = g_pConference->CreateDataChannel(&pChannelData, g_guidNM2Chat);
#else
  hr = g_pConference->CreateDataChannel(&pChannelData, g_guidApp);
#endif /* NM2_CHAT_PROTOCOL */

  if(SUCCEEDED(hr))
  {
    hr = HookData(pChannelData);  // Real hook is g_pChannelData
  }

  DisplaySysMsg((SUCCEEDED(hr)) ? TEXT("Chat Started") : TEXT("Chat failed to start!"), NULL);
}

VOID DisplayMessage | ( | LPTSTR | pszMsg,
 |  | LPTSTR | pszUser
 | ) |  |

Definition at line 77 of file cData.Cpp.

{
  int iItem = 0;
  LV_ITEM  lvItem;

  ClearStruct(&lvItem);           // Zero's memory
  lvItem.iItem = 0x0FFFFFFF;
  lvItem.mask = LVIF_PARAM | LVIF_TEXT;
  lvItem.pszText = pszUser;
  lvItem.cchTextMax = lstrlen(lvItem.pszText);
  iItem = ListView_InsertItem(ghwndMsg, &lvItem);

  {
    TCHAR sz[MAX_PATH + 1];
    ZeroMemory(sz, (MAX_PATH + 1) * sizeof(TCHAR));

    SYSTEMTIME sysTime;
    GetLocalTime(&sysTime);

    _sntprintf(sz, MAX_PATH, TEXT("%02d:%02d:%02d"), sysTime.wHour, sysTime.wMinute, sysTime.wSecond);
    ListView_SetItemText(ghwndMsg, iItem, ILV_TIME, sz);
  }

  ListView_SetItemText(ghwndMsg, iItem, ILV_TEXT, pszMsg);
}

VOID DisplayMsg | ( | LPTSTR | pszMsg,
 |  | INmMember * | pMember
 | ) |  |

Definition at line 26 of file cData.Cpp.

{
#ifdef NM2_CHAT_PROTOCOL
#ifndef UNICODE
  // Convert UNICODE to ANSI
  char sz[MAX_PATH + 1];
  ZeroMemory(sz, (MAX_PATH + 1) * sizeof(char));

  WideCharToMultiByte(CP_ACP, 0, (LPWSTR) pszMsg, -1, sz, MAX_PATH, NULL, NULL);
  pszMsg = sz;
#endif /* UNICODE */
#endif /* NM2_CHAT_PROTOCOL */

  DisplaySysMsg(pszMsg, pMember);
}

VOID DisplaySysMsg | ( | LPTSTR | pszMsg,
 |  | INmMember * | pMember
 | ) |  |

Definition at line 49 of file cData.Cpp.

{
  LPTSTR pszUser = NULL;

  if (NULL != pMember)
  {
    PUSER pUser = PUserFromINmMember(pMember);
    if (NULL != pUser)
    {
      pszUser = pUser->pszName;
    }
  }

  if (NULL == pszUser)
  {
    pszUser = TEXT("");
  }

  DisplayMessage(pszMsg, pszUser);
}

VOID FreeDataChannel ( void )

Definition at line 160 of file cData.Cpp.

{
  // Release all notify
  if (NULL != g_pNotifyData)
  {
    g_pNotifyData->Disconnect();
    g_pNotifyData->Release();
    g_pNotifyData = NULL;
  }

  if (NULL != g_pChannelData)
  {
    g_pChannelData->Release();
    g_pChannelData = NULL;
  }
}

HRESULT HookData ( INmChannelData * pChannelData )

Definition at line 110 of file cData.Cpp.

{
  HRESULT hr        = NO_ERROR;
  CDataNotify * pNotify = NULL;

  ASSERT(NULL != pChannelData);
  ASSERT(NULL == g_pChannelData);

  if(NULL == pChannelData)
  {
    return E_POINTER;
  }

  if(NULL != g_pChannelData)
  {
    return E_POINTER;
  }

  g_pChannelData = pChannelData;

    // Connect to the channel object
    pNotify = new CDataNotify();
    if (pNotify == NULL)
    {
        hr = E_OUTOFMEMORY;
    }
    else
    {
    hr = pNotify->Connect(pChannelData);
    if (SUCCEEDED(hr))
    {
      g_pNotifyData = pNotify;
    }
  }

  if (FAILED(hr))
  {
    FreeDataChannel();
  }

  return hr;
}

Variable Documentation

INmChannelData* g_pChannelData = NULL

Definition at line 17 of file cData.Cpp.

CDataNotify* g_pNotifyData = NULL

Definition at line 18 of file cData.Cpp.

Generated on Wed Nov 13 2024 16:54:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMChat/cData.h File Reference

  • Web
  • NetMeeting
  • NMChat
Classes | Functions | Variables

cData.h File Reference

Go to the source code of this file.

Classes

class | CDataNotify

Functions

VOID | CheckDataChannel (void)
VOID | DoCreateDataChannel (INmConference *pConference)
VOID | FreeDataChannel (void)
HRESULT | HookData (INmChannelData *pChannel)

Variables

INmChannelData * | g_pChannelData
CDataNotify * g_pNotifyData

Function Documentation

VOID CheckDataChannel ( void )

Definition at line 349 of file cData.Cpp.

{
  ULONG id            = 0;
  HRESULT hr            = NO_ERROR;
  INmChannelData * pChannelData = NULL;

  if (NULL != g_pChannelData)
  {
    return; // already created
  }

  if (NULL == g_pMemberLocal)
  {
    return; // we're not in the conference yet
  }

  if (FAILED(g_pMemberLocal->GetID(&id)))
  {
    return;
  }

  if (0 == id)
  {
    return; // no local data id
  }

#ifdef NM2_CHAT_PROTOCOL
  hr = g_pConference->CreateDataChannel(&pChannelData, g_guidNM2Chat);
#else
  hr = g_pConference->CreateDataChannel(&pChannelData, g_guidApp);
#endif /* NM2_CHAT_PROTOCOL */

  if(SUCCEEDED(hr))
  {
    hr = HookData(pChannelData);  // Real hook is g_pChannelData
  }

  DisplaySysMsg((SUCCEEDED(hr)) ? TEXT("Chat Started") : TEXT("Chat failed to start!"), NULL);
}

VOID DoCreateDataChannel ( INmConference * pConference )

Definition at line 440 of file cData.Cpp.

{
  INmChannelData  * pChannelData  = NULL;
  HRESULT       hr      = NO_ERROR;

  if (NULL == pConference)
  {
    WARN_MSG(TEXT("No conference."));
    return;
  }

  if (NULL != g_pChannelData)
  {
    WARN_MSG(TEXT("Data channel already exists"));
  }

  hr = pConference->CreateDataChannel(&pChannelData, g_guidNMUIChat);
  if (FAILED(hr))
  {
    ERROR_MSG(TEXT("CreateDataChannel: Failed hr=%s"), GetHrSz(hr));
    return;
  }

  if (NULL == g_pChannelData)
  {
    ERROR_MSG(TEXT("DoCreateDataChannel: Failed to hook"));
  }
  else
  {
    // The AddRef was done in the hook code.
    pChannelData->Release();
  }

  TRACE_MSG(TEXT("Created Data Channel"));
}

VOID FreeDataChannel ( void )

Definition at line 160 of file cData.Cpp.

{
  // Release all notify
  if (NULL != g_pNotifyData)
  {
    g_pNotifyData->Disconnect();
    g_pNotifyData->Release();
    g_pNotifyData = NULL;
  }

  if (NULL != g_pChannelData)
  {
    g_pChannelData->Release();
    g_pChannelData = NULL;
  }
}

HRESULT HookData ( INmChannelData * pChannel )

Definition at line 110 of file cData.Cpp.

{
  HRESULT hr        = NO_ERROR;
  CDataNotify * pNotify = NULL;

  ASSERT(NULL != pChannelData);
  ASSERT(NULL == g_pChannelData);

  if(NULL == pChannelData)
  {
    return E_POINTER;
  }

  if(NULL != g_pChannelData)
  {
    return E_POINTER;
  }

  g_pChannelData = pChannelData;

    // Connect to the channel object
    pNotify = new CDataNotify();
    if (pNotify == NULL)
    {
        hr = E_OUTOFMEMORY;
    }
    else
    {
    hr = pNotify->Connect(pChannelData);
    if (SUCCEEDED(hr))
    {
      g_pNotifyData = pNotify;
    }
  }

  if (FAILED(hr))
  {
    FreeDataChannel();
  }

  return hr;
}

Variable Documentation

INmChannelData* g_pChannelData

Definition at line 17 of file cData.Cpp.

CDataNotify* g_pNotifyData

Definition at line 18 of file cData.Cpp.

Generated on Wed Nov 13 2024 16:54:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMChat/clUtil.Cpp File Reference

  • Web
  • NetMeeting
  • NMChat
Functions

clUtil.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

POSITION | AddNode (PVOID pv, COBLIST **ppList)
LPTSTR | PszFromBstr (BSTR bstr)
PVOID | RemoveNode (POSITION *pPos, COBLIST *pList)

Function Documentation

POSITION AddNode | ( | PVOID | pv,
 |  | COBLIST ** | ppList
 | ) |  |

Definition at line 497 of file clUtil.Cpp.

{
  ASSERT(NULL != ppList);
  if(NULL == ppList)
  {
    return NULL;
  }

  if (NULL == *ppList)
  {
    *ppList = new COBLIST();
    if (NULL == *ppList)
    {
      return NULL;
    }
  }

  return (*ppList)->AddTail(pv);
}

LPTSTR PszFromBstr ( BSTR bstr )

Definition at line 627 of file clUtil.Cpp.

{
  if (NULL == bstr)
  {
    return NULL;
  }
  int cch =  WideCharToMultiByte(CP_ACP, 0, (LPWSTR)bstr, -1, NULL, 0, NULL, NULL);
  if (cch <= 0)
  {
    return NULL;
  }

  LPTSTR psz = PszAlloc(cch);
  if (NULL == psz)
  {
    return NULL;
  }

  ZeroMemory(psz, sizeof(TCHAR) * (cch + 1));

  WideCharToMultiByte(CP_ACP, 0, (LPWSTR)bstr, -1, psz, cch, NULL, NULL);
  return psz;
}

PVOID RemoveNode | ( | POSITION * | pPos,
 |  | COBLIST * | pList
 | ) |  |

Definition at line 527 of file clUtil.Cpp.

{
  if ((NULL == pList) || (NULL == pPos))
  {
    return NULL;
  }

  PVOID pv = pList->RemoveAt(*pPos);
  *pPos = NULL;
  return pv;
}

Generated on Wed Nov 13 2024 16:54:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMChat/clUtil.h File Reference

  • Web
  • NetMeeting
  • NMChat
Classes | Defines | Functions

clUtil.h File Reference

Go to the source code of this file.

Classes

class | BSTRING
class | BTSTR
class | CNotify
class | COBLIST
struct | COBNODE
class | RefCount

Defines

#define | POSITION COBNODE*

Functions

POSITION | AddNode (PVOID pv, COBLIST **ppList)
LPTSTR | PszFromBstr (BSTR bst)
PVOID | RemoveNode (POSITION *pPos, COBLIST *pList)

Define Documentation

#define POSITION COBNODE*

Definition at line 74 of file clUtil.h.

Function Documentation

POSITION AddNode | ( | PVOID | pv,
 |  | COBLIST ** | ppList
 | ) |  |

Definition at line 497 of file clUtil.Cpp.

{
  ASSERT(NULL != ppList);
  if(NULL == ppList)
  {
    return NULL;
  }

  if (NULL == *ppList)
  {
    *ppList = new COBLIST();
    if (NULL == *ppList)
    {
      return NULL;
    }
  }

  return (*ppList)->AddTail(pv);
}

LPTSTR PszFromBstr ( BSTR bst )

Definition at line 627 of file clUtil.Cpp.

{
  if (NULL == bstr)
  {
    return NULL;
  }
  int cch =  WideCharToMultiByte(CP_ACP, 0, (LPWSTR)bstr, -1, NULL, 0, NULL, NULL);
  if (cch <= 0)
  {
    return NULL;
  }

  LPTSTR psz = PszAlloc(cch);
  if (NULL == psz)
  {
    return NULL;
  }

  ZeroMemory(psz, sizeof(TCHAR) * (cch + 1));

  WideCharToMultiByte(CP_ACP, 0, (LPWSTR)bstr, -1, psz, cch, NULL, NULL);
  return psz;
}

PVOID RemoveNode | ( | POSITION * | pPos,
 |  | COBLIST * | pList
 | ) |  |

Definition at line 527 of file clUtil.Cpp.

{
  if ((NULL == pList) || (NULL == pPos))
  {
    return NULL;
  }

  PVOID pv = pList->RemoveAt(*pPos);
  *pPos = NULL;
  return pv;
}

Generated on Wed Nov 13 2024 16:54:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMChat/Cmd.Cpp File Reference

  • Web
  • NetMeeting
  • NMChat
Functions

Cmd.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

VOID | CmdAbout (void)
VOID | CmdClear (void)
VOID | CmdExit (void)
VOID | CmdFont (void)
VOID | CmdHelp (void)
VOID | CmdOptions (void)
LRESULT | MsgCmdMain (HWND hwnd, UINT uMsg, WPARAM wparam, LPARAM lparam)

Function Documentation

VOID CmdAbout ( void )

Definition at line 126 of file Cmd.Cpp.

{
  TCHAR szVersion[MAX_PATH + 1];
  ZeroMemory(szVersion, (MAX_PATH + 1) * sizeof(TCHAR));

  LoadString(ghInst, IDS_VERSION, szVersion, CCHMAX(szVersion));

  ShellAbout(ghwndMain, szVersion, NULL, LoadIcon(ghInst, MAKEINTRESOURCE(ICO_MAIN)));
}

VOID CmdClear ( void )

Definition at line 37 of file Cmd.Cpp.

{
  ClearText();
}

VOID CmdExit ( void )

Definition at line 51 of file Cmd.Cpp.

{
  DestroyWindow(ghwndMain);
}

VOID CmdFont ( void )

Definition at line 78 of file Cmd.Cpp.

{
#ifdef NOTUSED
  CHOOSEFONT cf;
  LOGFONT    lf;
  HFONT      hfont;

  ZeroMemory(&lf, sizeof(LOGFONT));
  ZeroMemory(&hfont, sizeof(HFONT));

  lf = gPref.lf;

  ClearStruct(&cf);           // Zero's memory
  cf.lStructSize = sizeof(CHOOSEFONT);
  cf.hwndOwner = ghwndMain;
  cf.lpLogFont = &lf;
  cf.iPointSize = 10;
  cf.Flags = CF_SCREENFONTS | CF_EFFECTS | CF_INITTOLOGFONTSTRUCT;

  if (ChooseFont(&cf) != TRUE)
  {
    return;
  }

  hfont= CreateFontIndirect(cf.lpLogFont);
  if (hfont == hfontNil)
  {
    return;
  }

  MaybeDeleteObject((HGDIOBJ *) &ghfontEntry);
  ghfontEntry = hfont;
  SendMessage(ghwndMsg, WM_SETFONT,
    (WPARAM) ghfontEntry, MAKELPARAM(TRUE, 0));

  gPref.lf = lf;
#endif
}

VOID CmdHelp ( void )

Definition at line 65 of file Cmd.Cpp.

{
}

VOID CmdOptions ( void )

Definition at line 24 of file Cmd.Cpp.

{
}

LRESULT MsgCmdMain | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 166 of file Cmd.Cpp.

{
  UINT wCmd = (UINT) GET_WM_COMMAND_ID(wparam, lparam);

  for (LPCMD lpcmd = _rgcmdMain; 0 != lpcmd->wCmd; lpcmd++)
  {
    if (wCmd == lpcmd->wCmd)
    {
      lpcmd->pfncmd();
      break;
    }
  }

  return 0L;
}

Generated on Wed Nov 13 2024 16:54:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMChat/cMemb.Cpp File Reference

  • Web
  • NetMeeting
  • NMChat
Functions | Variables

cMemb.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

VOID | AddMember (INmMember *pMember)
PUSER | AllocUser (INmMember *pMember)
VOID | FreeAllUsers (void)
VOID | FreeUser (PUSER pUser)
INmMember * | GetSelectedMember (void)
int | ItemFromPUser (PUSER pUser)
PUSER | PUserFromINmMember (INmMember *pMember)
VOID | RemoveMember (INmMember *pMember)

Variables

COBLIST * | g_pListUser = (COBLIST *) NULL
INmMember * | g_pMemberLocal = NULL

Function Documentation

VOID AddMember ( INmMember * pMember )

Definition at line 177 of file cMemb.Cpp.

{
  PUSER pUser = AllocUser(pMember);
  if (NULL == pUser)
  {
    return;
  }

  AddNode(pUser, &g_pListUser);

  LV_ITEM  lvItem;
  ClearStruct(&lvItem);           // Zero's memory
  lvItem.iItem = g_pListUser->GetItemCount();
  lvItem.mask = LVIF_PARAM | LVIF_TEXT;
  lvItem.pszText = (S_OK == pMember->IsSelf()) ? TEXT("everyone") : pUser->pszName;
  lvItem.cchTextMax = lstrlen(pUser->pszName);
  lvItem.lParam = (LPARAM) pUser;
  ListView_InsertItem(ghwndUser, &lvItem);

  DisplaySysMsg(TEXT("<joined>"), pMember);
}

PUSER AllocUser ( INmMember * pMember )

Definition at line 75 of file cMemb.Cpp.

{
  if(NULL == pMember)
  {
    return NULL;
  }

  HRESULT hr  = NO_ERROR;
  BSTR bstr = NULL;
  INmMember * pMemberTop = NULL;

  PUSER pUser = new USER;
  if (NULL == pUser)
  {
    return NULL;
  }

  ClearStruct(pUser);           // Zero's memory

  pUser->pMember = pMember;
  pMember->AddRef();

  hr = pMember->GetName(&bstr);
  if (SUCCEEDED(hr))
  {
    pUser->pszName = PszFromBstr(bstr);
    SysFreeString(bstr);
  }

  hr = pMember->GetNmVersion(&pUser->uVersion);

  pUser->fLocal = S_OK == pMember->IsSelf();
  pUser->fMcu = S_OK == pMember->IsMCU();

  pUser->fTop = FALSE;
  if (SUCCEEDED(g_pConference->GetTopProvider(&pMemberTop)))
  {
    pUser->fTop = (pMember == pMemberTop);
    pMemberTop->Release();
  }

  return pUser;
}

VOID FreeAllUsers ( void )

Definition at line 152 of file cMemb.Cpp.

{
  if (NULL == g_pListUser)
  {
    return;
  }

  while (!g_pListUser->IsEmpty())
  {
    USER * pUser = (USER *) g_pListUser->RemoveHead();
    ASSERT(NULL != pUser);
    FreeUser(pUser);
  }

  delete g_pListUser;
  g_pListUser = NULL;
}

VOID FreeUser ( PUSER pUser )

Definition at line 126 of file cMemb.Cpp.

{
  ASSERT(NULL != pUser);

  if(NULL == pUser)
  {
    return;
  }

  FreePlpv(&pUser->pszName);

  if (NULL != pUser->pMember)
  {
    pUser->pMember->Release();
  }

  delete pUser;
}

INmMember* GetSelectedMember ( void )

Definition at line 238 of file cMemb.Cpp.

{
  int iItem = 0;

  if (NULL == g_pListUser)
  {
    return NULL;
  }

  iItem = ListView_GetNextItem(ghwndUser, -1, LVNI_ALL | LVNI_SELECTED);
  if (-1 == iItem)
  {
    return NULL;
  }

  LV_ITEM lv;
  lv.mask = LVIF_PARAM;
  lv.iItem = iItem;
  ListView_GetItem(ghwndUser, &lv);

  return ((PUSER) lv.lParam)->pMember;
}

int ItemFromPUser ( PUSER pUser )

Definition at line 54 of file cMemb.Cpp.

{
  if (NULL == ghwndUser)
  {
    return -1;
  }

  LV_FINDINFO findInfo;
  ClearStruct(&findInfo);           // Zero's memory
  findInfo.flags = LVFI_PARAM;
    findInfo.lParam = (LPARAM) pUser;
    return ListView_FindItem(ghwndUser, -1, &findInfo);
}

PUSER PUserFromINmMember ( INmMember * pMember )

Definition at line 28 of file cMemb.Cpp.

{
  if (NULL != g_pListUser)
  {
    POSITION pos = g_pListUser->GetHeadPosition();
    while (NULL != pos)
    {
      PUSER pUser = (PUSER) g_pListUser->GetNext(pos);
      if (pMember == pUser->pMember)
      {
        ASSERT(pMember == pUser->pMember);
        return pUser;
      }
    }
  }

  return NULL;
}

VOID RemoveMember ( INmMember * pMember )

Definition at line 206 of file cMemb.Cpp.

{
  if (NULL == g_pListUser)
  {
    return;
  }

  POSITION pos = g_pListUser->GetHeadPosition();
  while (NULL != pos)
  {
    POSITION posSav = pos;
    PUSER pUser = (PUSER) g_pListUser->GetNext(pos);
    if (pMember == pUser->pMember)
    {
      ASSERT(pMember == pUser->pMember);
      DisplaySysMsg(TEXT("<left>"), pMember);

      ListView_DeleteItem(ghwndUser, ItemFromPUser(pUser));
      FreeUser(pUser);
      g_pListUser->RemoveAt(posSav);
      return;
    }
  }
}

Variable Documentation

COBLIST* g_pListUser = (COBLIST *) NULL

Definition at line 17 of file cMemb.Cpp.

INmMember* g_pMemberLocal = NULL

Definition at line 19 of file cMemb.Cpp.

Generated on Wed Nov 13 2024 16:54:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMChat/cMemb.h File Reference

  • Web
  • NetMeeting
  • NMChat
Classes | Typedefs | Functions | Variables

cMemb.h File Reference

Go to the source code of this file.

Classes

struct | tagUser

Typedefs

typedef USER * | PUSER
typedef struct tagUser | USER

Functions

VOID | AddMember (INmMember *pMember)
VOID | FreeAllUsers (void)
VOID | FreeUser (PUSER pUser)
INmMember * | GetSelectedMember (void)
PUSER | PUserFromINmMember (INmMember *pMember)
VOID | RemoveMember (INmMember *pMember)

Variables

COBLIST * g_pListUser
INmMember * | g_pMemberLocal

Typedef Documentation

typedef USER* PUSER

Definition at line 24 of file cMemb.h.

typedef struct tagUser USER

Function Documentation

VOID AddMember ( INmMember * pMember )

Definition at line 177 of file cMemb.Cpp.

{
  PUSER pUser = AllocUser(pMember);
  if (NULL == pUser)
  {
    return;
  }

  AddNode(pUser, &g_pListUser);

  LV_ITEM  lvItem;
  ClearStruct(&lvItem);           // Zero's memory
  lvItem.iItem = g_pListUser->GetItemCount();
  lvItem.mask = LVIF_PARAM | LVIF_TEXT;
  lvItem.pszText = (S_OK == pMember->IsSelf()) ? TEXT("everyone") : pUser->pszName;
  lvItem.cchTextMax = lstrlen(pUser->pszName);
  lvItem.lParam = (LPARAM) pUser;
  ListView_InsertItem(ghwndUser, &lvItem);

  DisplaySysMsg(TEXT("<joined>"), pMember);
}

VOID FreeAllUsers ( void )

Definition at line 152 of file cMemb.Cpp.

{
  if (NULL == g_pListUser)
  {
    return;
  }

  while (!g_pListUser->IsEmpty())
  {
    USER * pUser = (USER *) g_pListUser->RemoveHead();
    ASSERT(NULL != pUser);
    FreeUser(pUser);
  }

  delete g_pListUser;
  g_pListUser = NULL;
}

VOID FreeUser ( PUSER pUser )

Definition at line 126 of file cMemb.Cpp.

{
  ASSERT(NULL != pUser);

  if(NULL == pUser)
  {
    return;
  }

  FreePlpv(&pUser->pszName);

  if (NULL != pUser->pMember)
  {
    pUser->pMember->Release();
  }

  delete pUser;
}

INmMember* GetSelectedMember ( void )

Definition at line 238 of file cMemb.Cpp.

{
  int iItem = 0;

  if (NULL == g_pListUser)
  {
    return NULL;
  }

  iItem = ListView_GetNextItem(ghwndUser, -1, LVNI_ALL | LVNI_SELECTED);
  if (-1 == iItem)
  {
    return NULL;
  }

  LV_ITEM lv;
  lv.mask = LVIF_PARAM;
  lv.iItem = iItem;
  ListView_GetItem(ghwndUser, &lv);

  return ((PUSER) lv.lParam)->pMember;
}

PUSER PUserFromINmMember ( INmMember * pMember )

Definition at line 28 of file cMemb.Cpp.

{
  if (NULL != g_pListUser)
  {
    POSITION pos = g_pListUser->GetHeadPosition();
    while (NULL != pos)
    {
      PUSER pUser = (PUSER) g_pListUser->GetNext(pos);
      if (pMember == pUser->pMember)
      {
        ASSERT(pMember == pUser->pMember);
        return pUser;
      }
    }
  }

  return NULL;
}

VOID RemoveMember ( INmMember * pMember )

Definition at line 206 of file cMemb.Cpp.

{
  if (NULL == g_pListUser)
  {
    return;
  }

  POSITION pos = g_pListUser->GetHeadPosition();
  while (NULL != pos)
  {
    POSITION posSav = pos;
    PUSER pUser = (PUSER) g_pListUser->GetNext(pos);
    if (pMember == pUser->pMember)
    {
      ASSERT(pMember == pUser->pMember);
      DisplaySysMsg(TEXT("<left>"), pMember);

      ListView_DeleteItem(ghwndUser, ItemFromPUser(pUser));
      FreeUser(pUser);
      g_pListUser->RemoveAt(posSav);
      return;
    }
  }
}

Variable Documentation

COBLIST* g_pListUser

Definition at line 17 of file cMemb.Cpp.

INmMember* g_pMemberLocal

Definition at line 19 of file cMemb.Cpp.

Generated on Wed Nov 13 2024 16:54:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMChat/Debug.Cpp File Reference

  • Web
  • NetMeeting
  • NMChat

Debug.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMChat/Global.h File Reference

  • Web
  • NetMeeting
  • NMChat
Classes | Defines | Typedefs | Functions | Variables

Global.h File Reference

Go to the source code of this file.

Classes

struct | _CMD
struct | _MSD

Defines

#define | ARRAY_ELEMENTS(rg) (sizeof(rg) / sizeof(rg[0]))
#define | ASSERT(f)
#define | AssertSz(f, sz)
#define | CCHMAX(sz) (sizeof(sz) / sizeof(TCHAR))
#define | chNull ('\0')
#define | ClearStruct(lpv) ZeroMemory((LPVOID) (lpv), sizeof(*(lpv)))
#define | FEmptySz(sz) (((sz) == NULL) || (*(sz) == _T('\0')))
#define | hfontNil ((HFONT) NULL)
#define | hgdiNil ((HGDIOBJ) NULL)
#define | hwndNil ((HWND) NULL)
#define | IDW_EDIT 102
#define | IDW_MSG 100
#define | IDW_USER 101
#define | ILV_NAME 0
#define | ILV_TEXT 2
#define | ILV_TIME 1
#define | InitStruct(lpv) {ClearStruct(lpv); (* (LPDWORD) lpv) = sizeof(*(lpv));}
#define | lpNil (NULL)
#define | NotReached()
#define | SetEmptySz(sz) ( *(sz) = _T('\0') )

Typedefs

typedef struct _CMD | CMD
typedef CMD * | LPCMD
typedef MSD * | LPMSD
typedef struct _MSD | MSD
typedef VOID(* | PFNCMD )(VOID)
typedef LRESULT(* | PFNMSG )(HWND, UINT, WPARAM, LPARAM)

Functions

VOID | ClearText (void)
VOID | DisplayMessage (LPTSTR pszMsg, LPTSTR pszUser)
VOID | DisplayMsg (LPTSTR pszMsg, INmMember *pMember)
VOID | DisplaySysMsg (LPTSTR pszMsg, INmMember *pMember)
VOID | FreePlpv (LPVOID plpv)
LPVOID | LpvAlloc (int cb)
VOID | MaybeDeleteObject (HGDIOBJ *phgdi)
LPTSTR | PszAlloc (int cch)
VOID | RecalcMsgWindow (void)
VOID | SendText (void)
VOID | SizeMsgWindow (int dx, int dy)
LRESULT CALLBACK | WndProc (HWND, UINT, WPARAM, LPARAM)

Variables

const int | DXP_USER = 80
const int | DYP_EDIT = 30
const GUID | g_guidApp
const GUID | g_guidNM2Chat
HACCEL | ghAccelTable
HFONT | ghfontEntry
HINSTANCE | ghInst
HMENU | ghMenu
HWND | ghwndEdit
HWND | ghwndMain
HWND | ghwndMsg
HWND | ghwndUser
const int | XP_LEFT = 0
const int | YP_TOP = 3

Define Documentation

#define ARRAY_ELEMENTS ( rg ) (sizeof(rg) / sizeof(rg[0]))

Definition at line 44 of file Global.h.

#define ASSERT ( f )

Definition at line 63 of file Global.h.

#define AssertSz | ( | f,
 |  | sz
 | ) |

Definition at line 64 of file Global.h.

#define CCHMAX ( sz ) (sizeof(sz) / sizeof(TCHAR))

Definition at line 45 of file Global.h.

#define chNull ('\0')

Definition at line 27 of file Global.h.

#define ClearStruct ( lpv ) ZeroMemory((LPVOID) (lpv), sizeof(*(lpv)))

Definition at line 38 of file Global.h.

#define FEmptySz ( sz ) (((sz) == NULL) || (*(sz) == _T('\0')))

Definition at line 42 of file Global.h.

#define hfontNil ((HFONT) NULL)

Definition at line 31 of file Global.h.

#define hgdiNil ((HGDIOBJ) NULL)

Definition at line 32 of file Global.h.

#define hwndNil ((HWND) NULL)

Definition at line 30 of file Global.h.

#define IDW_EDIT 102

Definition at line 121 of file Global.h.

#define IDW_MSG 100

Definition at line 119 of file Global.h.

#define IDW_USER 101

Definition at line 120 of file Global.h.

#define ILV_NAME 0

Definition at line 124 of file Global.h.

#define ILV_TEXT 2

Definition at line 126 of file Global.h.

#define ILV_TIME 1

Definition at line 125 of file Global.h.

#define InitStruct ( lpv ) {ClearStruct(lpv); (* (LPDWORD) lpv) = sizeof(*(lpv));}

Definition at line 39 of file Global.h.

#define lpNil (NULL)

Definition at line 28 of file Global.h.

#define NotReached ( )

Definition at line 65 of file Global.h.

#define SetEmptySz ( sz ) ( *(sz) = _T('\0') )

Definition at line 41 of file Global.h.

Typedef Documentation

typedef struct _CMD CMD
typedef CMD* LPCMD

Definition at line 110 of file Global.h.

typedef MSD* LPMSD

Definition at line 90 of file Global.h.

typedef struct _MSD MSD
typedef VOID(* PFNCMD)(VOID)

Definition at line 102 of file Global.h.

typedef LRESULT(* PFNMSG)(HWND, UINT, WPARAM, LPARAM)

Definition at line 82 of file Global.h.

Function Documentation

VOID ClearText ( void )

Definition at line 94 of file Util.Cpp.

{
  ListView_DeleteAllItems(ghwndMsg);
}

VOID DisplayMessage | ( | LPTSTR | pszMsg,
 |  | LPTSTR | pszUser
 | ) |  |

Definition at line 77 of file cData.Cpp.

{
  int iItem = 0;
  LV_ITEM  lvItem;

  ClearStruct(&lvItem);           // Zero's memory
  lvItem.iItem = 0x0FFFFFFF;
  lvItem.mask = LVIF_PARAM | LVIF_TEXT;
  lvItem.pszText = pszUser;
  lvItem.cchTextMax = lstrlen(lvItem.pszText);
  iItem = ListView_InsertItem(ghwndMsg, &lvItem);

  {
    TCHAR sz[MAX_PATH + 1];
    ZeroMemory(sz, (MAX_PATH + 1) * sizeof(TCHAR));

    SYSTEMTIME sysTime;
    GetLocalTime(&sysTime);

    _sntprintf(sz, MAX_PATH, TEXT("%02d:%02d:%02d"), sysTime.wHour, sysTime.wMinute, sysTime.wSecond);
    ListView_SetItemText(ghwndMsg, iItem, ILV_TIME, sz);
  }

  ListView_SetItemText(ghwndMsg, iItem, ILV_TEXT, pszMsg);
}

VOID DisplayMsg | ( | LPTSTR | pszMsg,
 |  | INmMember * | pMember
 | ) |  |

Definition at line 26 of file cData.Cpp.

{
#ifdef NM2_CHAT_PROTOCOL
#ifndef UNICODE
  // Convert UNICODE to ANSI
  char sz[MAX_PATH + 1];
  ZeroMemory(sz, (MAX_PATH + 1) * sizeof(char));

  WideCharToMultiByte(CP_ACP, 0, (LPWSTR) pszMsg, -1, sz, MAX_PATH, NULL, NULL);
  pszMsg = sz;
#endif /* UNICODE */
#endif /* NM2_CHAT_PROTOCOL */

  DisplaySysMsg(pszMsg, pMember);
}

VOID DisplaySysMsg | ( | LPTSTR | pszMsg,
 |  | INmMember * | pMember
 | ) |  |

Definition at line 49 of file cData.Cpp.

{
  LPTSTR pszUser = NULL;

  if (NULL != pMember)
  {
    PUSER pUser = PUserFromINmMember(pMember);
    if (NULL != pUser)
    {
      pszUser = pUser->pszName;
    }
  }

  if (NULL == pszUser)
  {
    pszUser = TEXT("");
  }

  DisplayMessage(pszMsg, pszUser);
}

VOID FreePlpv ( LPVOID plpv )

Definition at line 167 of file Util.Cpp.

{
  if ((plpv == NULL) || (*(VOID FAR * FAR *)plpv == NULL))
  {
    return;
  }

  LocalFree(*(VOID FAR * FAR *)plpv);
  *(VOID FAR * FAR *)plpv = NULL;
}

LPVOID LpvAlloc ( int cb )

Definition at line 141 of file Util.Cpp.

{
  return LocalAlloc(LMEM_FIXED, cb);
}

VOID MaybeDeleteObject ( HGDIOBJ * phgdi )

Definition at line 187 of file Util.Cpp.

{
  if(NULL == phgdi || NULL == *phgdi)
  {
    return;
  }

  DeleteObject(*phgdi);
  *phgdi = NULL;
}

LPTSTR PszAlloc ( int cch )

Definition at line 153 of file Util.Cpp.

{
  return (LPTSTR) LocalAlloc(LMEM_FIXED, sizeof(TCHAR) * (cch+1));
}

VOID RecalcMsgWindow ( void )

Definition at line 124 of file Util.Cpp.

{
  RECT rc = {0,0,0,0};

  GetClientRect(ghwndMain, &rc);
  SizeMsgWindow(rc.right, rc.bottom);
}

VOID SendText ( void )

Definition at line 26 of file Util.Cpp.

{
  UINT  cb = 0;
  TCHAR sz[MAX_PATH + 1];
  ZeroMemory(sz, (MAX_PATH + 1) * sizeof(TCHAR));

#ifdef NM2_CHAT_PROTOCOL
  BYTE   buffer[CB_NM2_HDR + (MAX_PATH + 1) * sizeof(WCHAR)];
  ZeroMemory(buffer, CB_NMUI_HDR + (MAX_PATH + 1) * sizeof(WCHAR));

  // Get the text line
  cb = SendMessage(ghwndEdit, WM_GETTEXT, (WPARAM) MAX_PATH, (LPARAM) sz);
  SendMessage(ghwndEdit, EM_SETSEL, (WPARAM) 0, (LPARAM)-1);
  SendMessage(ghwndEdit, WM_SETTEXT, (WPARAM) 0, (LPARAM) "");

  if ((0 != cb) && (NULL != g_pChannelData))
  {
    INmMember * pMember = GetSelectedMember();
    if ((pMember != NULL) && (S_OK == pMember->IsSelf()))
    {
      // Local Member => Everyone => Broadcast
      pMember = NULL;
    }

    cb++; // include final null
#ifdef UNICODE
    lstrcpyn((LPTSTR) &buffer[CB_NM2_HDR], sz, MAX_PATH + 1);
#else
    cb = MultiByteToWideChar(CP_ACP, 0, sz, cb, (LPWSTR) &buffer[CB_NM2_HDR], MAX_PATH);
    cb *= 2; // adjust for UNICODE
#endif /* !UNICODE */

    // Add special prefix
    cb += CB_NM2_HDR;
    ZeroMemory(buffer, CB_NM2_HDR);
    * ((LPDWORD) buffer) = CB_NM2_HDR;

    g_pChannelData->SendData(pMember, cb, buffer, 0);
  }

#else
  // Get the text line
  cb = SendMessage(ghwndEdit, WM_GETTEXT, (WPARAM) CCHMAX(sz), (LPARAM) sz);
  SendMessage(ghwndEdit, EM_SETSEL, (WPARAM) 0, (LPARAM)-1);
  SendMessage(ghwndEdit, WM_SETTEXT, (WPARAM) 0, (LPARAM) "");

  if ((0 != cb) && (NULL != g_pChannelData))
  {
    INmMember * pMember = GetSelectedMember();
    if ((pMember != NULL) && (S_OK == pMember->IsSelf()))
    {
      // Local Member => Everyone => Broadcast
      pMember = NULL;
    }

    cb++; // include final null
    g_pChannelData->SendData(pMember, cb, (LPBYTE) sz, 0);
  }
#endif /* NM2_CHAT_PROTOCOL */
}

VOID SizeMsgWindow | ( | int | dx,
 |  | int | dy
 | ) |  |

Definition at line 106 of file Util.Cpp.

{
  MoveWindow(ghwndEdit, XP_LEFT, dy - DYP_EDIT, dx, DYP_EDIT, TRUE);
  dy -= (YP_TOP + DYP_EDIT);

  MoveWindow(ghwndUser, XP_LEFT, YP_TOP, DXP_USER, dy, TRUE);
  dx -= DXP_USER;

  MoveWindow(ghwndMsg, XP_LEFT + DXP_USER, YP_TOP, dx, dy, TRUE);
}

LRESULT CALLBACK WndProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 290 of file Generic.C.

{
   int wmId, wmEvent;
   PAINTSTRUCT ps;
   HDC hdc;
      POINT pnt;
   HMENU hMenu;
      BOOL bGotHelp;

   switch (message) {

      case WM_COMMAND:
         wmId    = LOWORD(wParam); // Remember, these are...
         wmEvent = HIWORD(wParam); // ...different for Win32!

         //Parse the menu selections:
         switch (wmId) {

            case IDM_ABOUT:
               DialogBox(hInst, "AboutBox", hWnd, (DLGPROC)About);
               break;

            case IDM_EXIT:
               DestroyWindow (hWnd);
               break;

            case IDM_HELPTOPICS: // Only called in Windows 95
               bGotHelp = WinHelp (hWnd, APPNAME".HLP", HELP_FINDER,(DWORD)0);
               if (!bGotHelp)
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            case IDM_HELPCONTENTS: // Not called in Windows 95
               bGotHelp = WinHelp (hWnd, APPNAME".HLP", HELP_CONTENTS,(DWORD)0);
               if (!bGotHelp)
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            case IDM_HELPSEARCH: // Not called in Windows 95
               if (!WinHelp(hWnd, APPNAME".HLP", HELP_PARTIALKEY,
                           (ULONG_PTR)(LPSTR)""))
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            case IDM_HELPHELP: // Not called in Windows 95
               if(!WinHelp(hWnd, (LPSTR)NULL, HELP_HELPONHELP, 0))
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            // Here are all the other possible menu options,
            // all of these are currently disabled:
            case IDM_NEW:
            case IDM_OPEN:
            case IDM_SAVE:
            case IDM_SAVEAS:
            case IDM_UNDO:
            case IDM_CUT:
            case IDM_COPY:
            case IDM_PASTE:
            case IDM_LINK:
            case IDM_LINKS:

            default:
               return (DefWindowProc(hWnd, message, wParam, lParam));
         }
         break;

      case WM_NCRBUTTONUP: // RightClick on windows non-client area...
         if (IS_WIN95 && SendMessage(hWnd, WM_NCHITTEST, 0, lParam) == HTSYSMENU)
         {
            // The user has clicked the right button on the applications
            // 'System Menu'. Here is where you would alter the default
            // system menu to reflect your application. Notice how the
            // explorer deals with this. For this app, we aren't doing
            // anything
            return (DefWindowProc(hWnd, message, wParam, lParam));
         } else {
            // Nothing we are interested in, allow default handling...
            return (DefWindowProc(hWnd, message, wParam, lParam));
         }
            break;

        case WM_RBUTTONDOWN: // RightClick in windows client area...
            pnt.x = LOWORD(lParam);
            pnt.y = HIWORD(lParam);
            ClientToScreen(hWnd, (LPPOINT) &pnt);
      // This is where you would determine the appropriate 'context'
      // menu to bring up. Since this app has no real functionality,
      // we will just bring up the 'Help' menu:
            hMenu = GetSubMenu (GetMenu (hWnd), 2);
            if (hMenu) {
                TrackPopupMenu (hMenu, 0, pnt.x, pnt.y, 0, hWnd, NULL);
            } else {
            // Couldn't find the menu...
                MessageBeep(0);
            }
            break;

      case WM_DISPLAYCHANGE: // Only comes through on plug'n'play systems
      {
         SIZE  szScreen;
         DWORD dwBitsPerPixel = (DWORD)wParam;

         szScreen.cx = LOWORD(lParam);
         szScreen.cy = HIWORD(lParam);

         MessageBox (GetFocus(), GetStringRes(IDS_DISPLAYCHANGED),
                     szAppName, 0);
      }
      break;

      case WM_PAINT:
         hdc = BeginPaint (hWnd, &ps);
         // Add any drawing code here...
         EndPaint (hWnd, &ps);
         break;

      case WM_DESTROY:
         // Tell WinHelp we don't need it any more...
               WinHelp (hWnd, APPNAME".HLP", HELP_QUIT,(DWORD)0);
         PostQuitMessage(0);
         break;

      default:
         return (DefWindowProc(hWnd, message, wParam, lParam));
   }
   return (0);
}

Variable Documentation

const int DXP_USER = 80

Definition at line 129 of file Global.h.

const int DYP_EDIT = 30

Definition at line 128 of file Global.h.

const GUID g_guidApp

Definition at line 25 of file CConf.Cpp.

const GUID g_guidNM2Chat

Definition at line 29 of file CConf.Cpp.

HACCEL ghAccelTable

Definition at line 25 of file Main.Cpp.

HFONT ghfontEntry

Definition at line 37 of file Main.Cpp.

HINSTANCE ghInst

Name of app.

Definition at line 24 of file ole2ui.c.

HMENU ghMenu

Definition at line 26 of file Main.Cpp.

HWND ghwndEdit

Definition at line 29 of file Main.Cpp.

HWND ghwndMain

Definition at line 447 of file MfEdit.h.

HWND ghwndMsg

Definition at line 28 of file Main.Cpp.

HWND ghwndUser

Definition at line 30 of file Main.Cpp.

const int XP_LEFT = 0

Definition at line 131 of file Global.h.

const int YP_TOP = 3

Definition at line 130 of file Global.h.

Generated on Wed Nov 13 2024 16:53:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMChat/IMSConf2.Idl File Reference

  • Web
  • NetMeeting
  • NMChat

IMSConf2.Idl File Reference

#include <imsconf2.idl>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMChat/Main.Cpp File Reference

  • Web
  • NetMeeting
  • NMChat
Classes | Typedefs | Functions | Variables

Main.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Classes

struct | _tagCol

Typedefs

typedef struct _tagCol | COL
typedef COL * | LPCOL

Functions

BOOL | FCreateEditWindow (void)
BOOL | FCreateMsgWindow (void)
BOOL | FCreateUserList (void)
BOOL | FInitApp (LPSTR lpszCmd, int nCmdShow)
BOOL | FInitMain (void)
LRESULT FAR PASCAL | SubClsEdit (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
VOID | TerminateApp (void)
int APIENTRY | WinMain (HINSTANCE hInstance, HINSTANCE hInstPrev, LPSTR lpszCmd, int nCmdShow)

Variables

HACCEL | ghAccelTable = NULL
HFONT | ghfontMsg = hfontNil
HINSTANCE | ghInst = NULL
HMENU | ghMenu = NULL
HWND | ghwndEdit = hwndNil
HWND | ghwndMain = NULL
HWND | ghwndMsg = hwndNil
HWND | ghwndUser = hwndNil
TCHAR | gszAppClassName [] = TEXT("NMCHAT")
TCHAR | gszAppName [] = TEXT("NmChat")
TCHAR | gszAppTitle [] = TEXT("NetMeeting Chat Test Application")
WNDPROC | lpProcEdit = NULL

Typedef Documentation

typedef struct _tagCol COL
typedef COL* LPCOL

Definition at line 46 of file Main.Cpp.

Function Documentation

BOOL FCreateEditWindow ( void )

Definition at line 170 of file Main.Cpp.

{
  ghwndEdit = CreateWindow(TEXT("EDIT"), NULL,
    WS_CHILD | WS_VISIBLE | WS_BORDER | ES_AUTOHSCROLL,
    0, 0, 0, DYP_EDIT,
    ghwndMain, (HMENU) IDW_EDIT, ghInst, NULL);
  if (ghwndEdit == NULL)
  {
    return FALSE;
  }

  // set the font for the window

  lpProcEdit = (WNDPROC) GetWindowLong(ghwndEdit, GWL_WNDPROC);
  SetWindowLong(ghwndEdit, GWL_WNDPROC, (LONG)(WNDPROC) SubClsEdit);

  return TRUE;
}

BOOL FCreateMsgWindow ( void )

Definition at line 65 of file Main.Cpp.

{
  ghwndMsg = CreateWindow(TEXT("SysListView32"), NULL,
    WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_BORDER | LVS_REPORT,
    0, 0, 0, 0,
    ghwndMain, (HMENU) IDW_USER, ghInst, NULL);
  if (ghwndMsg == NULL)
  {
    return FALSE;
  }

  // Initialize column data
  {
    int   iCol    = 0;
    LPCOL lpCol   = _rgColMsg;
    LV_COLUMN lvc;

    ClearStruct(&lvc);            // Zero's memory
    lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
    lvc.fmt = LVCFMT_LEFT;
    for (iCol = 0; iCol < ARRAY_ELEMENTS(_rgColMsg); iCol++)
    {
      lvc.iSubItem = iCol;
      lvc.cx = lpCol->dwWidth;
      lvc.pszText = lpCol->lpsz;
      if (ListView_InsertColumn(ghwndMsg, iCol, &lvc) == -1)
      {
        return FALSE;
      }
      lpCol++;
    }
  }

  return TRUE;
}

BOOL FCreateUserList ( void )

Definition at line 110 of file Main.Cpp.

{
  ghwndUser = CreateWindow(TEXT("SysListView32"), NULL,
    WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_BORDER | LVS_REPORT | LVS_SHOWSELALWAYS,
    0, 0, DXP_USER, 0,
    ghwndMain, (HMENU) IDW_MSG, ghInst, NULL);

  if (NULL == ghwndUser)
  {
    return FALSE;
  }

  // Initialize column data
  {
    LV_COLUMN lvc;

    ClearStruct(&lvc);            // Zero's memory
    lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
    lvc.fmt = LVCFMT_LEFT;
    lvc.iSubItem = 0;
    lvc.cx = DXP_USER;
    lvc.pszText = TEXT("Send To");
    if (ListView_InsertColumn(ghwndUser, 0, &lvc) == -1)
    {
      return FALSE;
    }
  }

  return TRUE;
}

BOOL FInitApp | ( | LPSTR | lpszCmd,
 |  | int | nCmdShow
 | ) |  |

Definition at line 251 of file Main.Cpp.

{
  InitCommonControls();

  if (FAILED(CoInitialize(NULL)))
  {
    return FALSE;
  }

  if (!FInitMain())
  {
    return FALSE;
  }

  if (!FCreateMsgWindow())
  {
    return FALSE;
  }

  if (!FCreateUserList())
  {
    return FALSE;
  }

  if (!FCreateEditWindow())
  {
    return FALSE;
  }

  ASSERT(NULL != ghwndMain);

// DO I NEED A CHECK HERE for if(NULL == ghwndMain)?

  ShowWindow(ghwndMain, nCmdShow);
  UpdateWindow(ghwndMain);

  SetFocus(ghwndEdit);

  return S_OK == InitConfMgr();
}

BOOL FInitMain ( void )

Definition at line 198 of file Main.Cpp.

{
  WNDCLASS  wc;
  TCHAR szTitle[MAX_PATH + 1];

  ZeroMemory(&wc, sizeof(WNDCLASS));
  ZeroMemory(szTitle, (MAX_PATH + 1) * sizeof(TCHAR));

  ASSERT(NULL != ghInst);

  ghAccelTable = LoadAccelerators(ghInst, MAKEINTRESOURCE(ID_APPACCEL));

  LoadString(ghInst, IDS_APP_TITLE, szTitle, CCHMAX(szTitle));

  wc.style         = CS_HREDRAW | CS_VREDRAW;
  wc.lpfnWndProc   = (WNDPROC)WndProc;
  wc.cbClsExtra    = 0;
  wc.cbWndExtra    = 0;
  wc.hInstance     = ghInst;
  wc.hIcon         = LoadIcon(ghInst, MAKEINTRESOURCE(ICO_MAIN));
  wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
  wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
  wc.lpszMenuName  = MAKEINTRESOURCE(IDM_APP);
  wc.lpszClassName = gszAppClassName;

  // Register the window class and return FALSE if unsuccesful.
  if (!RegisterClass(&wc))
  {
    return FALSE;
  }

  // Create a main window for this application instance.
  ghwndMain = CreateWindow(gszAppClassName, szTitle, WS_OVERLAPPEDWINDOW,
    0, 0, 400, 300,
    NULL, NULL, ghInst, NULL);
  if (ghwndMain == NULL)
  {
    return FALSE;
  }

  ghMenu = GetMenu(ghwndMain);
  return (NULL != ghMenu);
}

LRESULT FAR PASCAL SubClsEdit | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 152 of file Main.Cpp.

{
  if ((uMsg == WM_CHAR) && (VK_RETURN == wParam))
  {
    SendText();
    return 0L;
  }

  return CallWindowProc(lpProcEdit, hwnd, uMsg, wParam, lParam);
}

VOID TerminateApp ( void )

Definition at line 299 of file Main.Cpp.

{
  // Release all objects to which this app has a reference
  FreeDataChannel();
  FreeAllUsers();
  FreeConference();
  FreeConfMgr();

    // Uninitialize OLE
    CoUninitialize();
}

int APIENTRY WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hInstPrev,
 |  | LPSTR | lpszCmd,
 |  | int | nCmdShow
 | ) |  |

Definition at line 320 of file Main.Cpp.

{
  ghInst = hInstance;

  if (FInitApp(lpszCmd, nCmdShow))
  {
    MSG  msg;
    while (GetMessage(&msg, NULL, 0, 0))
    {
      if (!TranslateAccelerator(msg.hwnd, ghAccelTable, &msg))
      {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
      }
    }
  }

  TerminateApp();

  return 0;
}

Variable Documentation

HACCEL ghAccelTable = NULL

Definition at line 25 of file Main.Cpp.

HFONT ghfontMsg = hfontNil

Definition at line 31 of file Main.Cpp.

HINSTANCE ghInst = NULL

Name of app.

Definition at line 24 of file Main.Cpp.

HMENU ghMenu = NULL

Definition at line 26 of file Main.Cpp.

HWND ghwndEdit = hwndNil

Definition at line 29 of file Main.Cpp.

HWND ghwndMain = NULL

Definition at line 27 of file Main.Cpp.

HWND ghwndMsg = hwndNil

Definition at line 28 of file Main.Cpp.

HWND ghwndUser = hwndNil

Definition at line 30 of file Main.Cpp.

TCHAR gszAppClassName[] = TEXT("NMCHAT")

Definition at line 37 of file Main.Cpp.

TCHAR gszAppName[] = TEXT("NmChat")

Definition at line 38 of file Main.Cpp.

TCHAR gszAppTitle[] = TEXT("NetMeeting Chat Test Application")

Definition at line 34 of file Main.Cpp.

WNDPROC lpProcEdit = NULL

Definition at line 142 of file Main.Cpp.

Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMChat/Msg.Cpp File Reference

  • Web
  • NetMeeting
  • NMChat
Functions

Msg.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

VOID | CmdExit (void)
LRESULT | MsgActivate (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT | MsgClose (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT | MsgCmdMain (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT | MsgDestroy (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT | MsgGetMinMax (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT | MsgSize (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT CALLBACK | WndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)

Function Documentation

VOID CmdExit ( void )

Definition at line 51 of file Cmd.Cpp.

{
  DestroyWindow(ghwndMain);
}

LRESULT MsgActivate | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 76 of file Msg.Cpp.

{
  return 0L;
}

LRESULT MsgClose | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 45 of file Msg.Cpp.

{
  CmdExit();
  return 0;
}

LRESULT MsgCmdMain | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 166 of file Cmd.Cpp.

{
  UINT wCmd = (UINT) GET_WM_COMMAND_ID(wparam, lparam);

  for (LPCMD lpcmd = _rgcmdMain; 0 != lpcmd->wCmd; lpcmd++)
  {
    if (wCmd == lpcmd->wCmd)
    {
      lpcmd->pfncmd();
      break;
    }
  }

  return 0L;
}

LRESULT MsgDestroy | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 30 of file Msg.Cpp.

{
  PostQuitMessage(0);
  return 0;
}

LRESULT MsgGetMinMax | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 90 of file Msg.Cpp.

{
  LPMINMAXINFO lpminmax = (LPMINMAXINFO) lParam;

  lpminmax->ptMinTrackSize.x = 325;
  lpminmax->ptMinTrackSize.y = 250;

  return 0;
}

LRESULT MsgSize | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 60 of file Msg.Cpp.

{
  int dxClient = LOWORD(lParam);  // width of client area
  int dyClient = HIWORD(lParam);  // height of client area

  SizeMsgWindow(dxClient, dyClient);
  return 0;
}

LRESULT CALLBACK WndProc | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 128 of file Msg.Cpp.

{
  for (LPMSD lpmsd = _rgmsdMain; 0 != lpmsd->uMsg; lpmsd++)
  {
    if (lpmsd->uMsg == uMsg)
    {
      return lpmsd->pfnmsg(hwnd, uMsg, wParam, lParam);
    }
  }

  return DefWindowProc(hwnd, uMsg, wParam, lParam);
}

Generated on Wed Nov 13 2024 16:54:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMChat/PreComp.h File Reference

  • Web
  • NetMeeting
  • NMChat

PreComp.h File Reference

#include <windows.h>
#include <windowsx.h>
#include <commctrl.h>
#include <tchar.h>
#include <ocidl.h>
#include <stdio.h>
#include "imsconf2.h"
#include "global.h"
#include "clUtil.h"
#include "cConf.h"
#include "cData.h"
#include "cMemb.h"
#include "resource.h"
#include "global.h"
#include "clUtil.h"
#include "cConf.h"
#include "cData.h"
#include "cMemb.h"
#include "resource.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMChat/Resource.h File Reference

  • Web
  • NetMeeting
  • NMChat
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | ICO_MAIN 101
#define | ID_APPACCEL 105
#define | IDD_OPTIONS 123
#define | IDM_ABOUT 40092
#define | IDM_APP 104
#define | IDM_EJECT 40021
#define | IDM_EXIT 40002
#define | IDM_HELP 40090
#define | IDM_HELP_CONTENTS 40091
#define | IDM_OPTIONS 40013
#define | IDM_SAVE_AS 40001
#define | IDM_VIEW_CLEAR 40012
#define | IDM_VIEW_FONT 40011
#define | IDM_VIEW_NAME 40142
#define | IDM_VIEW_TIME 40143
#define | IDM_VIEW_USERS 40144
#define | IDS_APP_TITLE 1
#define | IDS_SYSMENU 4
#define | IDS_VERSION 2

Define Documentation

#define ICO_MAIN 101

Definition at line 8 of file Resource.h.

#define ID_APPACCEL 105

Definition at line 10 of file Resource.h.

#define IDD_OPTIONS 123

Definition at line 11 of file Resource.h.

#define IDM_ABOUT 40092

Definition at line 20 of file Resource.h.

#define IDM_APP 104

Definition at line 9 of file Resource.h.

#define IDM_EJECT 40021

Definition at line 17 of file Resource.h.

#define IDM_EXIT 40002

Definition at line 13 of file Resource.h.

#define IDM_HELP 40090

Definition at line 18 of file Resource.h.

#define IDM_HELP_CONTENTS 40091

Definition at line 19 of file Resource.h.

#define IDM_OPTIONS 40013

Definition at line 16 of file Resource.h.

#define IDM_SAVE_AS 40001

Definition at line 12 of file Resource.h.

#define IDM_VIEW_CLEAR 40012

Definition at line 15 of file Resource.h.

#define IDM_VIEW_FONT 40011

Definition at line 14 of file Resource.h.

#define IDM_VIEW_NAME 40142

Definition at line 21 of file Resource.h.

#define IDM_VIEW_TIME 40143

Definition at line 22 of file Resource.h.

#define IDM_VIEW_USERS 40144

Definition at line 23 of file Resource.h.

#define IDS_APP_TITLE 1

Definition at line 5 of file Resource.h.

#define IDS_SYSMENU 4

Definition at line 7 of file Resource.h.

#define IDS_VERSION 2

Definition at line 6 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMChat/Util.Cpp File Reference

  • Web
  • NetMeeting
  • NMChat
Functions

Util.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

VOID | ClearText (void)
VOID | FreePlpv (LPVOID plpv)
LPVOID | LpvAlloc (int cb)
VOID | MaybeDeleteObject (HGDIOBJ *phgdi)
LPTSTR | PszAlloc (int cch)
VOID | RecalcMsgWindow (void)
VOID | SendText (void)
VOID | SizeMsgWindow (int dx, int dy)

Function Documentation

VOID ClearText ( void )

Definition at line 94 of file Util.Cpp.

{
  ListView_DeleteAllItems(ghwndMsg);
}

VOID FreePlpv ( LPVOID plpv )

Definition at line 167 of file Util.Cpp.

{
  if ((plpv == NULL) || (*(VOID FAR * FAR *)plpv == NULL))
  {
    return;
  }

  LocalFree(*(VOID FAR * FAR *)plpv);
  *(VOID FAR * FAR *)plpv = NULL;
}

LPVOID LpvAlloc ( int cb )

Definition at line 141 of file Util.Cpp.

{
  return LocalAlloc(LMEM_FIXED, cb);
}

VOID MaybeDeleteObject ( HGDIOBJ * phgdi )

Definition at line 187 of file Util.Cpp.

{
  if(NULL == phgdi || NULL == *phgdi)
  {
    return;
  }

  DeleteObject(*phgdi);
  *phgdi = NULL;
}

LPTSTR PszAlloc ( int cch )

Definition at line 153 of file Util.Cpp.

{
  return (LPTSTR) LocalAlloc(LMEM_FIXED, sizeof(TCHAR) * (cch+1));
}

VOID RecalcMsgWindow ( void )

Definition at line 124 of file Util.Cpp.

{
  RECT rc = {0,0,0,0};

  GetClientRect(ghwndMain, &rc);
  SizeMsgWindow(rc.right, rc.bottom);
}

VOID SendText ( void )

Definition at line 26 of file Util.Cpp.

{
  UINT  cb = 0;
  TCHAR sz[MAX_PATH + 1];
  ZeroMemory(sz, (MAX_PATH + 1) * sizeof(TCHAR));

#ifdef NM2_CHAT_PROTOCOL
  BYTE   buffer[CB_NM2_HDR + (MAX_PATH + 1) * sizeof(WCHAR)];
  ZeroMemory(buffer, CB_NMUI_HDR + (MAX_PATH + 1) * sizeof(WCHAR));

  // Get the text line
  cb = SendMessage(ghwndEdit, WM_GETTEXT, (WPARAM) MAX_PATH, (LPARAM) sz);
  SendMessage(ghwndEdit, EM_SETSEL, (WPARAM) 0, (LPARAM)-1);
  SendMessage(ghwndEdit, WM_SETTEXT, (WPARAM) 0, (LPARAM) "");

  if ((0 != cb) && (NULL != g_pChannelData))
  {
    INmMember * pMember = GetSelectedMember();
    if ((pMember != NULL) && (S_OK == pMember->IsSelf()))
    {
      // Local Member => Everyone => Broadcast
      pMember = NULL;
    }

    cb++; // include final null
#ifdef UNICODE
    lstrcpyn((LPTSTR) &buffer[CB_NM2_HDR], sz, MAX_PATH + 1);
#else
    cb = MultiByteToWideChar(CP_ACP, 0, sz, cb, (LPWSTR) &buffer[CB_NM2_HDR], MAX_PATH);
    cb *= 2; // adjust for UNICODE
#endif /* !UNICODE */

    // Add special prefix
    cb += CB_NM2_HDR;
    ZeroMemory(buffer, CB_NM2_HDR);
    * ((LPDWORD) buffer) = CB_NM2_HDR;

    g_pChannelData->SendData(pMember, cb, buffer, 0);
  }

#else
  // Get the text line
  cb = SendMessage(ghwndEdit, WM_GETTEXT, (WPARAM) CCHMAX(sz), (LPARAM) sz);
  SendMessage(ghwndEdit, EM_SETSEL, (WPARAM) 0, (LPARAM)-1);
  SendMessage(ghwndEdit, WM_SETTEXT, (WPARAM) 0, (LPARAM) "");

  if ((0 != cb) && (NULL != g_pChannelData))
  {
    INmMember * pMember = GetSelectedMember();
    if ((pMember != NULL) && (S_OK == pMember->IsSelf()))
    {
      // Local Member => Everyone => Broadcast
      pMember = NULL;
    }

    cb++; // include final null
    g_pChannelData->SendData(pMember, cb, (LPBYTE) sz, 0);
  }
#endif /* NM2_CHAT_PROTOCOL */
}

VOID SizeMsgWindow | ( | int | dx,
 |  | int | dy
 | ) |  |

Definition at line 106 of file Util.Cpp.

{
  MoveWindow(ghwndEdit, XP_LEFT, dy - DYP_EDIT, dx, DYP_EDIT, TRUE);
  dy -= (YP_TOP + DYP_EDIT);

  MoveWindow(ghwndUser, XP_LEFT, YP_TOP, DXP_USER, dy, TRUE);
  dx -= DXP_USER;

  MoveWindow(ghwndMsg, XP_LEFT + DXP_USER, YP_TOP, dx, dy, TRUE);
}

Generated on Wed Nov 13 2024 16:53:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMChat2/applet.cpp File Reference

  • Web
  • NetMeeting
  • NMChat2
Functions | Variables

applet.cpp File Reference

#include "precomp.h"
#include "iapplet.c"

Go to the source code of this file.

Functions

void | FreeApplet (void)
HRESULT | InitApplet (void)

Variables

CApplet * | g_pApplet = NULL

Function Documentation

void FreeApplet ( void )

Definition at line 93 of file applet.cpp.

{
    HRESULT hr = NO_ERROR;
    if (NULL != g_pSession)
    {
        hr = g_pSession->UnAdvise();
        ASSERT(S_OK == hr);

        g_pSession->Release();
        g_pSession = NULL;
    }

    if (NULL != g_pApplet)
    {
        hr = g_pApplet->UnAdvise();
        ASSERT(S_OK == hr);

        g_pApplet->Release();
        g_pApplet = NULL;
    }
}

HRESULT InitApplet ( void )

Definition at line 33 of file applet.cpp.

{
    //
    // Make sure we are clean in the beginning.
    //
    ASSERT(NULL == g_pApplet);
    ASSERT(NULL == g_pSession);

  if(NULL != g_pApplet || NULL != g_pSession)
  {
    return E_POINTER;
  }

    //
    // Create the IApplet interface.
    //
    IApplet* pIApplet = NULL;
    HRESULT hr = ::CoCreateInstance(
                        CLSID_NmApplet,
                        NULL,
                        CLSCTX_LOCAL_SERVER,
                        IID_IApplet,
                        (void **) &pIApplet);
    if (SUCCEEDED(hr))
    {
        ASSERT(NULL != pIApplet);

        //
        // Initialize the IApplet interface.
        //
        hr = pIApplet->Initialize();
        if (SUCCEEDED(hr))
        {
            //
            // Create the Applet object, which is a wrapper of the IApplet
            // interface, and also implements the IAppletNotify notification
            // sink.
            //
            g_pApplet = new CApplet(pIApplet);
            if (NULL != g_pApplet)
            {
                //
                // Hook up the notification sink.
                //
                hr = g_pApplet->Advise();
                ASSERT(S_OK == hr);
            }
            else
            {
                hr = E_OUTOFMEMORY;
            }
        }
    }
    return hr;
}

Variable Documentation

CApplet* g_pApplet = NULL

Definition at line 27 of file applet.cpp.

Generated on Wed Nov 13 2024 16:54:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMChat2/applet.h File Reference

  • Web
  • NetMeeting
  • NMChat2
Classes | Functions | Variables

applet.h File Reference

Go to the source code of this file.

Classes

class | CApplet

Functions

void | FreeApplet (void)
HRESULT | InitApplet (void)

Variables

CApplet * g_pApplet

Function Documentation

void FreeApplet ( void )

Definition at line 93 of file applet.cpp.

{
    HRESULT hr = NO_ERROR;
    if (NULL != g_pSession)
    {
        hr = g_pSession->UnAdvise();
        ASSERT(S_OK == hr);

        g_pSession->Release();
        g_pSession = NULL;
    }

    if (NULL != g_pApplet)
    {
        hr = g_pApplet->UnAdvise();
        ASSERT(S_OK == hr);

        g_pApplet->Release();
        g_pApplet = NULL;
    }
}

HRESULT InitApplet ( void )

Definition at line 33 of file applet.cpp.

{
    //
    // Make sure we are clean in the beginning.
    //
    ASSERT(NULL == g_pApplet);
    ASSERT(NULL == g_pSession);

  if(NULL != g_pApplet || NULL != g_pSession)
  {
    return E_POINTER;
  }

    //
    // Create the IApplet interface.
    //
    IApplet* pIApplet = NULL;
    HRESULT hr = ::CoCreateInstance(
                        CLSID_NmApplet,
                        NULL,
                        CLSCTX_LOCAL_SERVER,
                        IID_IApplet,
                        (void **) &pIApplet);
    if (SUCCEEDED(hr))
    {
        ASSERT(NULL != pIApplet);

        //
        // Initialize the IApplet interface.
        //
        hr = pIApplet->Initialize();
        if (SUCCEEDED(hr))
        {
            //
            // Create the Applet object, which is a wrapper of the IApplet
            // interface, and also implements the IAppletNotify notification
            // sink.
            //
            g_pApplet = new CApplet(pIApplet);
            if (NULL != g_pApplet)
            {
                //
                // Hook up the notification sink.
                //
                hr = g_pApplet->Advise();
                ASSERT(S_OK == hr);
            }
            else
            {
                hr = E_OUTOFMEMORY;
            }
        }
    }
    return hr;
}

Variable Documentation

CApplet* g_pApplet

Definition at line 27 of file applet.cpp.

Generated on Wed Nov 13 2024 16:54:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMChat2/conf.cpp File Reference

  • Web
  • NetMeeting
  • NMChat2
Functions | Variables

conf.cpp File Reference

#include "precomp.h"
#include "imsconf2.c"

Go to the source code of this file.

Functions

void | FreeConference (void)
void | FreeConfMgr (void)
HRESULT | InitConfMgr (void)

Variables

BOOL | g_fActiveConference = FALSE
INmConference * | g_pConference = NULL
CConfNotify * | g_pConferenceNotify = NULL
INmManager * | g_pMgr = NULL
CMgrNotify * | g_pMgrNotify = NULL

Function Documentation

void FreeConference ( void )

Definition at line 237 of file conf.cpp.

{
    if (NULL != g_pConferenceNotify)
    {
        g_pConferenceNotify->Disconnect();
        g_pConferenceNotify->Release();
        g_pConferenceNotify = NULL;
    }

    if (NULL != g_pConference)
    {
        g_pConference->Release();
        g_pConference = NULL;
    }
}

void FreeConfMgr ( void )

Definition at line 208 of file conf.cpp.

{
    //
    // Release conference manager notify
    //
    if (NULL != g_pMgrNotify)
    {
        g_pMgrNotify->Disconnect();
        g_pMgrNotify->Release();
        g_pMgrNotify = NULL;
    }

    //
    // Release conference manager
    //
    if (NULL != g_pMgr)
    {
        g_pMgr->Release();
        g_pMgr = NULL;
    }
}

HRESULT InitConfMgr ( void )

Definition at line 139 of file conf.cpp.

{
    HRESULT hr      = NO_ERROR;
    LPCLASSFACTORY pcf  = NULL;

    //
    // Notify the system we want to use the conferencing services
    // by creating a conference manager object
    //
    hr = CoGetClassObject(CLSID_NmManager,
                          CLSCTX_INPROC,
                          NULL,
                          IID_IClassFactory,
                          (void**)&pcf);
    if (SUCCEEDED(hr))
    {
        //
        // Get the conference manager object
        //
        hr = pcf->CreateInstance(NULL, IID_INmManager, (void**)&g_pMgr);
        if (SUCCEEDED(hr))
        {
            //
            // Connect to the conference manager object
            //
            g_pMgrNotify = new CMgrNotify();
            if (NULL != g_pMgrNotify)
            {
                hr = g_pMgrNotify->Connect(g_pMgr);
                if (SUCCEEDED(hr))
                {
                    ULONG uchCaps = NMCH_ALL;
                    ULONG uOptions = 0;
                    hr = g_pMgr->Initialize(&uOptions, &uchCaps);
          if (SUCCEEDED (hr))
          {
            INmSysInfo* spSysInfo=NULL;

            hr=g_pMgr->GetSysInfo(&spSysInfo);

            if (SUCCEEDED(hr))
            {
              BSTR bstrVer = NULL;
              hr = spSysInfo->GetProperty(NM_SYSPROP_BUILD_VER, &bstrVer);
              ::SysFreeString(bstrVer);
              if (hr != S_OK)
              {
                MessageBox(NULL,"This sample needs Windows Netmeeting3.0","Wrong Version",MB_OK);
                return E_FAIL;
              }
            }
          }
                }
            }
        }

        pcf->Release();
    }

    return hr;
}

Variable Documentation

BOOL g_fActiveConference = FALSE

Definition at line 47 of file conf.cpp.

INmConference* g_pConference = NULL

Definition at line 37 of file conf.cpp.

CConfNotify* g_pConferenceNotify = NULL

Definition at line 42 of file conf.cpp.

INmManager* g_pMgr = NULL

Definition at line 27 of file conf.cpp.

CMgrNotify* g_pMgrNotify = NULL

Definition at line 32 of file conf.cpp.

Generated on Wed Nov 13 2024 16:54:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMChat2/conf.h File Reference

  • Web
  • NetMeeting
  • NMChat2
Classes | Functions | Variables

conf.h File Reference

Go to the source code of this file.

Classes

class | CConfNotify
class | CMgrNotify
class | CNotify
class | CRefCount

Functions

void | FreeConference (void)
void | FreeConfMgr (void)
HRESULT | InitConfMgr (void)

Variables

CConfNotify * g_pConferenceNotify

Function Documentation

void FreeConference ( void )

Definition at line 189 of file CConf.Cpp.

{
  if (NULL != g_pConferenceNotify)
  {
    g_pConferenceNotify->Disconnect();
    g_pConferenceNotify->Release();
    g_pConferenceNotify = NULL;
  }

  if (NULL != g_pConference)
  {
    g_pConference->Release();
    g_pConference = NULL;
  }
}

void FreeConfMgr ( void )

Definition at line 164 of file CConf.Cpp.

{
  // Release conference manager notify
  if (NULL != g_pMgrNotify)
  {
    g_pMgrNotify->Disconnect();
    g_pMgrNotify->Release();
    g_pMgrNotify = NULL;
  }

  // Release conference manager
  if (NULL != g_pMgr)
  {
    g_pMgr->Release();
    g_pMgr = NULL;
  }
}

HRESULT InitConfMgr ( void )

Definition at line 115 of file CConf.Cpp.

{
  HRESULT hr      = NO_ERROR;
  LPCLASSFACTORY pcf  = NULL;

    // Notify the system we want to use the conferencing services
    // by creating a conference manager object
    hr = CoGetClassObject(CLSID_NmManager,
                          CLSCTX_INPROC,
                          NULL,
                          IID_IClassFactory,
                          (void**)&pcf);
    if (SUCCEEDED(hr))
    {
        // Get the conference manager object
        hr = pcf->CreateInstance(NULL, IID_INmManager, (void**)&g_pMgr);
      if (SUCCEEDED(hr))
        {
            // Connect to the conference manager object
            g_pMgrNotify = new CMgrNotify();
            if (NULL != g_pMgrNotify)
            {
                hr = g_pMgrNotify->Connect(g_pMgr);
          if (SUCCEEDED(hr))
                {
                  ULONG uchCaps = NMCH_ALL;
                  ULONG uOptions = 0;
          hr = g_pMgr->Initialize(&uOptions, &uchCaps);
          if(FAILED(hr))
          {
            return hr;
          }
        }
            }
        }

        pcf->Release();
    }

  return hr;
}

Variable Documentation

CConfNotify* g_pConferenceNotify

Definition at line 143 of file conf.h.

Generated on Wed Nov 13 2024 16:54:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMChat2/iapplet.c File Reference

  • Web
  • NetMeeting
  • NMChat2
Classes | Defines | Typedefs | Variables

iapplet.c File Reference

Go to the source code of this file.

Classes

struct | _IID

Defines

#define | __IID_DEFINED__
#define | CLSID_DEFINED

Typedefs

typedef IID | CLSID
typedef struct _IID | IID

Variables

const CLSID | CLSID_NmApplet = {0x8C3ADF99,0xCCFE,0x11d2,{0xAD,0x10,0x00,0xC0,0x4F,0x72,0xDD,0x47}}
const IID | IID_IApplet = {0x07970b30,0xa4da,0x11d2,{0xb7,0x24,0x00,0x10,0x4b,0xc5,0x13,0x39}}
const IID | IID_IAppletNotify = {0x16153670,0xa4da,0x11d2,{0xb7,0x24,0x00,0x10,0x4b,0xc5,0x13,0x39}}
const IID | IID_IAppletSession = {0xe65dc590,0xa4d9,0x11d2,{0xb7,0x24,0x00,0x10,0x4b,0xc5,0x13,0x39}}
const IID | IID_IAppletSessionNotify = {0xf7c10ec0,0xa4d9,0x11d2,{0xb7,0x24,0x00,0x10,0x4b,0xc5,0x13,0x39}}
const IID | LIBID_NmApplet = {0x8C3ADF96,0xCCFE,0x11d2,{0xAD,0x10,0x00,0xC0,0x4F,0x72,0xDD,0x47}}

Define Documentation

#define __IID_DEFINED__

Definition at line 21 of file iapplet.c.

#define CLSID_DEFINED

Definition at line 34 of file iapplet.c.

Typedef Documentation

typedef IID CLSID

Definition at line 35 of file iapplet.c.

typedef struct _IID IID

Variable Documentation

const CLSID CLSID_NmApplet = {0x8C3ADF99,0xCCFE,0x11d2,{0xAD,0x10,0x00,0xC0,0x4F,0x72,0xDD,0x47}}

Definition at line 53 of file iapplet.c.

const IID IID_IApplet = {0x07970b30,0xa4da,0x11d2,{0xb7,0x24,0x00,0x10,0x4b,0xc5,0x13,0x39}}

Definition at line 47 of file iapplet.c.

const IID IID_IAppletNotify = {0x16153670,0xa4da,0x11d2,{0xb7,0x24,0x00,0x10,0x4b,0xc5,0x13,0x39}}

Definition at line 44 of file iapplet.c.

const IID IID_IAppletSession = {0xe65dc590,0xa4d9,0x11d2,{0xb7,0x24,0x00,0x10,0x4b,0xc5,0x13,0x39}}

Definition at line 41 of file iapplet.c.

const IID IID_IAppletSessionNotify = {0xf7c10ec0,0xa4d9,0x11d2,{0xb7,0x24,0x00,0x10,0x4b,0xc5,0x13,0x39}}

Definition at line 38 of file iapplet.c.

const IID LIBID_NmApplet = {0x8C3ADF96,0xCCFE,0x11d2,{0xAD,0x10,0x00,0xC0,0x4F,0x72,0xDD,0x47}}

Definition at line 50 of file iapplet.c.

Generated on Wed Nov 13 2024 16:54:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMChat2/iapplet.h File Reference

  • Web
  • NetMeeting
  • NMChat2
Classes | Defines | Typedefs | Enumerations | Functions | Variables

iapplet.h File Reference

#include "rpc.h"
#include "rpcndr.h"
#include "windows.h"
#include "ole2.h"
#include "oaidl.h"
#include "ocidl.h"

Go to the source code of this file.

Classes

struct | IAppletNotifyVtbl
struct | IAppletSessionNotifyVtbl
struct | IAppletSessionVtbl
struct | IAppletVtbl
struct | tagAppletCapability
struct | tagAppletCapability2
struct | tagAppletCapabilityClass
struct | tagAppletCapabilityID
struct | tagAppletChannelRequest
struct | tagAppletLongString
struct | tagAppletObjectKey
struct | tagAppletOctetString
struct | tagAppletProtocolEntity
struct | tagAppletRecord
struct | tagAppletRegistryEntryOwner
struct | tagAppletRegistryItem
struct | tagAppletRegistryKey
struct | tagAppletRegistryRequest
struct | tagAppletRoster
struct | tagAppletSessionKey
struct | tagAppletSessionRequest
struct | tagAppletTokenRequest

Defines

#define | __IApplet_FWD_DEFINED__
#define | __IApplet_INTERFACE_DEFINED__
#define | __IAppletNotify_FWD_DEFINED__
#define | __IAppletNotify_INTERFACE_DEFINED__
#define | __IAppletSession_FWD_DEFINED__
#define | __IAppletSession_INTERFACE_DEFINED__
#define | __IAppletSessionNotify_FWD_DEFINED__
#define | __IAppletSessionNotify_INTERFACE_DEFINED__
#define | __NmApplet_FWD_DEFINED__
#define | __NmApplet_LIBRARY_DEFINED__
#define | __REQUIRED_RPCNDR_H_VERSION__ 440

Typedefs

typedef struct tagAppletCapability | AppletCapability
typedef struct tagAppletCapability2 | AppletCapability2
typedef struct
tagAppletCapabilityClass 		AppletCapabilityClass
typedef struct
tagAppletCapabilityID 		AppletCapabilityID
typedef enum
tagAppletCapabilityType 		AppletCapabilityType
typedef enum tagAppletCapIDType | AppletCapIDType
typedef enum
tagAppletChannelCommand 		AppletChannelCommand
typedef USHORT | AppletChannelID
typedef struct
tagAppletChannelRequest 		AppletChannelRequest
typedef enum tagAppletChannelType | AppletChannelType
typedef ULONG | AppletConfID
typedef USHORT | AppletEntityID
typedef enum tagAppletKeyType | AppletKeyType
typedef struct tagAppletLongString | AppletLongString
typedef enum
tagAppletModificationRights 		AppletModificationRights
typedef AppletUserID | AppletNodeID
typedef struct tagAppletObjectKey | AppletObjectKey
typedef struct tagAppletOctetString | AppletOctetString
typedef enum tagAppletPriority | AppletPriority
typedef struct
tagAppletProtocolEntity 		AppletProtocolEntity
typedef enum tagAppletReason | AppletReason
typedef struct tagAppletRecord | AppletRecord
typedef enum
tagAppletRegistryCommand 		AppletRegistryCommand
typedef struct
tagAppletRegistryEntryOwner 		AppletRegistryEntryOwner
typedef struct
tagAppletRegistryItem 		AppletRegistryItem
typedef enum
tagAppletRegistryItemType 		AppletRegistryItemType
typedef struct tagAppletRegistryKey | AppletRegistryKey
typedef struct
tagAppletRegistryRequest 		AppletRegistryRequest
typedef UINT | AppletRequestTag
typedef enum
tagAppletResourceAllocCommand 		AppletResourceAllocCommand
typedef struct tagAppletRoster | AppletRoster
typedef USHORT | AppletSessionID
typedef struct tagAppletSessionKey | AppletSessionKey
typedef struct
tagAppletSessionRequest 		AppletSessionRequest
typedef enum tagAppletTokenCommand | AppletTokenCommand
typedef USHORT | AppletTokenID
typedef struct
tagAppletTokenRequest 		AppletTokenRequest
typedef enum tagAppletTokenStatus | AppletTokenStatus
typedef AppletChannelID | AppletUserID
typedef interface IApplet | IApplet
typedef interface IAppletNotify | IAppletNotify
typedef struct IAppletNotifyVtbl | IAppletNotifyVtbl
typedef interface IAppletSession | IAppletSession
typedef interface
IAppletSessionNotify 		IAppletSessionNotify
typedef struct
IAppletSessionNotifyVtbl 		IAppletSessionNotifyVtbl
typedef struct IAppletSessionVtbl | IAppletSessionVtbl
typedef struct IAppletVtbl | IAppletVtbl
typedef struct NmApplet | NmApplet

Enumerations

enum | { NmApplet_Ver_Major = 1 }
enum | { NmApplet_Ver_Minor = 0 }
enum | tagAppletCapabilityType { APPLET_UNKNOWN_CAP_TYPE = 0, APPLET_LOGICAL_CAPABILITY = 1, APPLET_UNSIGNED_MINIMUM_CAPABILITY = 2, APPLET_UNSIGNED_MAXIMUM_CAPABILITY = 3 }
enum | tagAppletCapIDType { APPLET_STANDARD_CAPABILITY = 0, APPLET_NONSTD_CAPABILITY = 1 }
enum tagAppletChannelCommand {
APPLET_JOIN_CHANNEL = 0, APPLET_LEAVE_CHANNEL = 1, APPLET_CONVENE_CHANNEL = 2, APPLET_DISBAND_CHANNEL = 3,
APPLET_ADMIT_CHANNEL = 4, APPLET_EXPEL_CHANNEL = 5
}
enum tagAppletChannelType {
APPLET_STATIC_CHANNEL = 0, APPLET_DYNAMIC_MULTICAST_CHANNEL = 1, APPLET_DYNAMIC_PRIVATE_CHANNEL = 2, APPLET_DYNAMIC_USER_ID_CHANNEL = 3,
APPLET_NO_CHANNEL_TYPE_SPECIFIED = 4
}
enum tagAppletErrorCode {
APPLET_E_NO_SERVICE = 0x82000001, APPLET_E_SERVICE_FAIL = 0x82000002, APPLET_E_ALREADY_REGISTERED = 0x82000003, APPLET_E_NOT_REGISTERED = 0x82000004,
APPLET_E_INVALID_CONFERENCE = 0x82000005, APPLET_E_INVALID_COOKIE = 0x82000006, APPLET_E_ALREADY_JOIN = 0x82000007, APPLET_E_NOT_JOINED = 0x82000008,
APPLET_E_INVALID_JOIN_REQUEST = 0x82000009, APPLET_E_ENTRY_ALREADY_EXISTS = 0x8200000a, APPLET_E_ENTRY_DOES_NOT_EXIST = 0x8200000b, APPLET_E_NOT_OWNER = 0x8200000c,
APPLET_E_NOT_ADVISED = 0x8200000d, APPLET_E_ALREADY_ADVISED = 0x8200000e
}
enum | tagAppletKeyType { APPLET_OBJECT_KEY = 1, APPLET_H221_NONSTD_KEY = 2 }
enum | tagAppletModificationRights { APPLET_OWNER_RIGHTS = 0, APPLET_SESSION_RIGHTS = 1, APPLET_PUBLIC_RIGHTS = 2, APPLET_NO_MODIFICATION_RIGHTS_SPECIFIED = 3 }
enum | tagAppletPriority { APPLET_TOP_PRIORITY = 0, APPLET_HIGH_PRIORITY = 1, APPLET_MEDIUM_PRIORITY = 2, APPLET_LOW_PRIORITY = 3 }
enum | tagAppletReason { APPLET_R_UNSPECIFIED = 0, APPLET_R_CONFERENCE_GONE = 1, APPLET_R_USER_REJECTED = 2, APPLET_R_RESOURCE_PURGED = 3 }
enum tagAppletRegistryCommand {
APPLET_REGISTER_CHANNEL = 0, APPLET_ASSIGN_TOKEN = 1, APPLET_SET_PARAMETER = 2, APPLET_RETRIEVE_ENTRY = 3,
APPLET_DELETE_ENTRY = 4, APPLET_ALLOCATE_HANDLE = 5, APPLET_MONITOR = 6
}
enum | tagAppletRegistryItemType { APPLET_REGISTRY_CHANNEL_ID = 1, APPLET_REGISTRY_TOKEN_ID = 2, APPLET_REGISTRY_PARAMETER = 3, APPLET_REGISTRY_NONE = 4 }
enum | tagAppletResourceAllocCommand { APPLET_JOIN_DYNAMIC_CHANNEL = 0, APPLET_GRAB_TOKEN_REQUEST = 1 }
enum tagAppletTokenCommand {
APPLET_GRAB_TOKEN = 0, APPLET_INHIBIT_TOKEN = 1, APPLET_GIVE_TOKEN = 2, APPLET_PLEASE_TOKEN = 3,
APPLET_RELEASE_TOKEN = 4, APPLET_TEST_TOKEN = 5, APPLET_GIVE_TOKEN_RESPONSE = 6
}
enum tagAppletTokenStatus {
APPLET_TOKEN_NOT_IN_USE = 0, APPLET_TOKEN_SELF_GRABBED = 1, APPLET_TOKEN_OTHER_GRABBED = 2, APPLET_TOKEN_SELF_INHIBITED = 3,
APPLET_TOKEN_OTHER_INHIBITED = 4, APPLET_TOKEN_SELF_RECIPIENT = 5, APPLET_TOKEN_SELF_GIVING = 6, APPLET_TOKEN_OTHER_GIVING = 7
}

Functions

HRESULT STDMETHODCALLTYPE | IApplet_Advise_Proxy (IApplet __RPC_FAR *This, IAppletNotify __RPC_FAR *pNotify, DWORD __RPC_FAR *pdwCookie)
void __RPC_STUB | IApplet_Advise_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IApplet_CreateSession_Proxy (IApplet __RPC_FAR *This, IAppletSession __RPC_FAR *__RPC_FAR *ppSession, AppletConfID nConfID)
void __RPC_STUB | IApplet_CreateSession_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IApplet_Initialize_Proxy (IApplet __RPC_FAR *This)
void __RPC_STUB | IApplet_Initialize_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IApplet_RegisterAutoJoin_Proxy (IApplet __RPC_FAR *This, AppletSessionRequest __RPC_FAR *pRequest)
void __RPC_STUB | IApplet_RegisterAutoJoin_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IApplet_UnAdvise_Proxy (IApplet __RPC_FAR *This, DWORD dwCookie)
void __RPC_STUB | IApplet_UnAdvise_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IApplet_UnregisterAutoJoin_Proxy (IApplet __RPC_FAR *This)
void __RPC_STUB | IApplet_UnregisterAutoJoin_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IAppletNotify_AutoJoinSessionIndication_Proxy (IAppletNotify __RPC_FAR *This, IAppletSession __RPC_FAR *pSession, HRESULT hrResult, AppletUserID uidMyself, AppletNodeID nidMyself, AppletSessionID sidMyself, AppletEntityID eidMyself, ULONG cDynamicChannels, AppletChannelID __RPC_FAR aDynamicChannels[])
void __RPC_STUB | IAppletNotify_AutoJoinSessionIndication_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IAppletNotify_PermitToJoinSessionIndication_Proxy (IAppletNotify __RPC_FAR *This, AppletConfID nConfID, BOOL fPermissionGranted)
void __RPC_STUB | IAppletNotify_PermitToJoinSessionIndication_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IAppletSession_Advise_Proxy (IAppletSession __RPC_FAR *This, IAppletSessionNotify __RPC_FAR *pNotify, DWORD __RPC_FAR *pdwCookie)
void __RPC_STUB | IAppletSession_Advise_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IAppletSession_ChannelRequest_Proxy (IAppletSession __RPC_FAR *This, AppletChannelRequest __RPC_FAR *pRequest)
void __RPC_STUB | IAppletSession_ChannelRequest_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IAppletSession_GetConfID_Proxy (IAppletSession __RPC_FAR *This, AppletConfID __RPC_FAR *pnConfID)
void __RPC_STUB | IAppletSession_GetConfID_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IAppletSession_InquireRoster_Proxy (IAppletSession __RPC_FAR *This, AppletSessionKey __RPC_FAR *pSessionKey)
void __RPC_STUB | IAppletSession_InquireRoster_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IAppletSession_InvokeApplet_Proxy (IAppletSession __RPC_FAR *This, AppletRequestTag __RPC_FAR *pnReqTag, AppletProtocolEntity __RPC_FAR *pAPE, ULONG cNodes, AppletNodeID __RPC_FAR aNodeIDs[])
void __RPC_STUB | IAppletSession_InvokeApplet_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IAppletSession_IsThisNodeTopProvider_Proxy (IAppletSession __RPC_FAR *This, BOOL __RPC_FAR *pfTopProvider)
void __RPC_STUB | IAppletSession_IsThisNodeTopProvider_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IAppletSession_Join_Proxy (IAppletSession __RPC_FAR *This, AppletSessionRequest __RPC_FAR *pRequest)
void __RPC_STUB | IAppletSession_Join_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IAppletSession_Leave_Proxy (IAppletSession __RPC_FAR *This)
void __RPC_STUB | IAppletSession_Leave_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IAppletSession_RegistryRequest_Proxy (IAppletSession __RPC_FAR *This, AppletRegistryRequest __RPC_FAR *pRequest)
void __RPC_STUB | IAppletSession_RegistryRequest_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IAppletSession_SendData_Proxy (IAppletSession __RPC_FAR *This, BOOL fUniformSend, AppletChannelID nChannelID, AppletPriority ePriority, ULONG cbBufSize, BYTE __RPC_FAR *pBuffer)
void __RPC_STUB | IAppletSession_SendData_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IAppletSession_TokenRequest_Proxy (IAppletSession __RPC_FAR *This, AppletTokenRequest __RPC_FAR *pRequest)
void __RPC_STUB | IAppletSession_TokenRequest_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IAppletSession_UnAdvise_Proxy (IAppletSession __RPC_FAR *This, DWORD dwCookie)
void __RPC_STUB | IAppletSession_UnAdvise_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IAppletSessionNotify_AllocateHandleConfirm_Proxy (IAppletSessionNotify __RPC_FAR *This, HRESULT hrResult, ULONG nFirstHandle, ULONG cHandles)
void __RPC_STUB | IAppletSessionNotify_AllocateHandleConfirm_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IAppletSessionNotify_ChannelConfirm_Proxy (IAppletSessionNotify __RPC_FAR *This, AppletChannelCommand eCommand, HRESULT hrResult, AppletChannelID nChannelID)
void __RPC_STUB | IAppletSessionNotify_ChannelConfirm_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IAppletSessionNotify_ChannelIndication_Proxy (IAppletSessionNotify __RPC_FAR *This, AppletChannelCommand eCommand, AppletChannelID nChannelID, AppletReason eReason, AppletUserID uidManager)
void __RPC_STUB | IAppletSessionNotify_ChannelIndication_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IAppletSessionNotify_InquireRosterConfirm_Proxy (IAppletSessionNotify __RPC_FAR *This, HRESULT hrResult, ULONG cRosters, AppletRoster __RPC_FAR *__RPC_FAR *apAppRosters)
void __RPC_STUB | IAppletSessionNotify_InquireRosterConfirm_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IAppletSessionNotify_InvokeAppletConfirm_Proxy (IAppletSessionNotify __RPC_FAR *This, AppletRequestTag nReqTag, HRESULT hrResult)
void __RPC_STUB | IAppletSessionNotify_InvokeAppletConfirm_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IAppletSessionNotify_JoinSessionConfirm_Proxy (IAppletSessionNotify __RPC_FAR *This, HRESULT hrResult, AppletUserID uidMyself, AppletNodeID nidMyself, AppletSessionID sidMyself, AppletEntityID eidMyself, ULONG cDynamicChannels, AppletChannelID __RPC_FAR aDynamicChannels[])
void __RPC_STUB | IAppletSessionNotify_JoinSessionConfirm_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IAppletSessionNotify_LeaveSessionIndication_Proxy (IAppletSessionNotify __RPC_FAR *This, AppletReason eReason, AppletUserID uidLeave)
void __RPC_STUB | IAppletSessionNotify_LeaveSessionIndication_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IAppletSessionNotify_RegistryConfirm_Proxy (IAppletSessionNotify __RPC_FAR *This, AppletRegistryCommand eCommand, HRESULT hrResult, AppletRegistryKey __RPC_FAR *pRegistryKey, AppletRegistryItem __RPC_FAR *pRegistryItem, AppletRegistryEntryOwner __RPC_FAR *pEntryOwner, AppletModificationRights eRights)
void __RPC_STUB | IAppletSessionNotify_RegistryConfirm_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IAppletSessionNotify_RosterReportIndication_Proxy (IAppletSessionNotify __RPC_FAR *This, ULONG cRosters, AppletRoster __RPC_FAR *__RPC_FAR *apAppRosters)
void __RPC_STUB | IAppletSessionNotify_RosterReportIndication_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IAppletSessionNotify_SendDataIndication_Proxy (IAppletSessionNotify __RPC_FAR *This, BOOL fUniformSend, AppletUserID uidInitiator, AppletChannelID nChannelID, AppletPriority eDataPriority, AppletOctetString Data)
void __RPC_STUB | IAppletSessionNotify_SendDataIndication_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IAppletSessionNotify_TestTokenConfirm_Proxy (IAppletSessionNotify __RPC_FAR *This, AppletTokenID nTokenID, AppletTokenStatus eStatus)
void __RPC_STUB | IAppletSessionNotify_TestTokenConfirm_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IAppletSessionNotify_TokenConfirm_Proxy (IAppletSessionNotify __RPC_FAR *This, AppletTokenCommand eCommand, HRESULT hrResult, AppletTokenID nTokenID)
void __RPC_STUB | IAppletSessionNotify_TokenConfirm_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
HRESULT STDMETHODCALLTYPE | IAppletSessionNotify_TokenIndication_Proxy (IAppletSessionNotify __RPC_FAR *This, AppletTokenCommand eCommand, AppletReason eReason, AppletTokenID nTokenID, AppletUserID uidInitiator)
void __RPC_STUB | IAppletSessionNotify_TokenIndication_Stub (IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase)
void __RPC_FAR *__RPC_USER | MIDL_user_allocate (size_t)
void __RPC_USER | MIDL_user_free (void __RPC_FAR *)

Variables

RPC_IF_HANDLE | __MIDL_itf_iapplet_0000_v0_0_c_ifspec
RPC_IF_HANDLE | __MIDL_itf_iapplet_0000_v0_0_s_ifspec
RPC_IF_HANDLE | __MIDL_itf_iapplet_0212_v0_0_c_ifspec
RPC_IF_HANDLE | __MIDL_itf_iapplet_0212_v0_0_s_ifspec
EXTERN_C const CLSID | CLSID_NmApplet
EXTERN_C const IID | IID_IApplet
EXTERN_C const IID | IID_IAppletNotify
EXTERN_C const IID | IID_IAppletSession
EXTERN_C const IID | IID_IAppletSessionNotify
EXTERN_C const IID | LIBID_NmApplet
interface IAppletSessionNotify
CONST_VTBL struct
IAppletSessionNotifyVtbl
__RPC_FAR * 		lpVtbl

Define Documentation

#define __IApplet_FWD_DEFINED__

Definition at line 59 of file iapplet.h.

#define __IApplet_INTERFACE_DEFINED__

Definition at line 1325 of file iapplet.h.

#define __IAppletNotify_FWD_DEFINED__

Definition at line 53 of file iapplet.h.

#define __IAppletNotify_INTERFACE_DEFINED__

Definition at line 1189 of file iapplet.h.

#define __IAppletSession_FWD_DEFINED__

Definition at line 47 of file iapplet.h.

#define __IAppletSession_INTERFACE_DEFINED__

Definition at line 836 of file iapplet.h.

#define __IAppletSessionNotify_FWD_DEFINED__

Definition at line 41 of file iapplet.h.

#define __IAppletSessionNotify_INTERFACE_DEFINED__

Definition at line 383 of file iapplet.h.

#define __NmApplet_FWD_DEFINED__

Definition at line 65 of file iapplet.h.

#define __NmApplet_LIBRARY_DEFINED__

Definition at line 1536 of file iapplet.h.

#define __REQUIRED_RPCNDR_H_VERSION__ 440

Definition at line 16 of file iapplet.h.

Typedef Documentation

typedef struct tagAppletCapability AppletCapability
typedef struct tagAppletCapability2 AppletCapability2
typedef struct tagAppletCapabilityClass AppletCapabilityClass
typedef struct tagAppletCapabilityID AppletCapabilityID
typedef enum tagAppletCapabilityType AppletCapabilityType
typedef enum tagAppletCapIDType AppletCapIDType
typedef enum tagAppletChannelCommand AppletChannelCommand
typedef USHORT AppletChannelID

Definition at line 88 of file iapplet.h.

typedef struct tagAppletChannelRequest AppletChannelRequest
typedef enum tagAppletChannelType AppletChannelType
typedef ULONG AppletConfID

Definition at line 98 of file iapplet.h.

typedef USHORT AppletEntityID

Definition at line 96 of file iapplet.h.

typedef enum tagAppletKeyType AppletKeyType
typedef struct tagAppletLongString AppletLongString
typedef enum tagAppletModificationRights AppletModificationRights
typedef AppletUserID AppletNodeID

Definition at line 92 of file iapplet.h.

typedef struct tagAppletObjectKey AppletObjectKey
typedef struct tagAppletOctetString AppletOctetString
typedef enum tagAppletPriority AppletPriority
typedef struct tagAppletProtocolEntity AppletProtocolEntity
typedef enum tagAppletReason AppletReason
typedef struct tagAppletRecord AppletRecord
typedef enum tagAppletRegistryCommand AppletRegistryCommand
typedef struct tagAppletRegistryEntryOwner AppletRegistryEntryOwner
typedef struct tagAppletRegistryItem AppletRegistryItem
typedef enum tagAppletRegistryItemType AppletRegistryItemType
typedef struct tagAppletRegistryKey AppletRegistryKey
typedef struct tagAppletRegistryRequest AppletRegistryRequest
typedef UINT AppletRequestTag

Definition at line 100 of file iapplet.h.

typedef enum tagAppletResourceAllocCommand AppletResourceAllocCommand
typedef struct tagAppletRoster AppletRoster
typedef USHORT AppletSessionID

Definition at line 86 of file iapplet.h.

typedef struct tagAppletSessionKey AppletSessionKey
typedef struct tagAppletSessionRequest AppletSessionRequest
typedef enum tagAppletTokenCommand AppletTokenCommand
typedef USHORT AppletTokenID

Definition at line 94 of file iapplet.h.

typedef struct tagAppletTokenRequest AppletTokenRequest
typedef enum tagAppletTokenStatus AppletTokenStatus
typedef AppletChannelID AppletUserID

Definition at line 90 of file iapplet.h.

typedef interface IApplet IApplet

Definition at line 60 of file iapplet.h.

typedef interface IAppletNotify IAppletNotify

Definition at line 54 of file iapplet.h.

typedef struct IAppletNotifyVtbl IAppletNotifyVtbl
typedef interface IAppletSession IAppletSession

Definition at line 48 of file iapplet.h.

typedef interface IAppletSessionNotify IAppletSessionNotify

Definition at line 42 of file iapplet.h.

typedef struct IAppletSessionNotifyVtbl IAppletSessionNotifyVtbl
typedef struct IAppletSessionVtbl IAppletSessionVtbl
typedef struct IAppletVtbl IAppletVtbl
typedef struct NmApplet NmApplet

Definition at line 70 of file iapplet.h.

Enumeration Type Documentation

anonymous enum
Enumerator:
NmApplet_Ver_Major

Definition at line 1527 of file iapplet.h.

{ NmApplet_Ver_Major = 1};

anonymous enum
Enumerator:
NmApplet_Ver_Minor

Definition at line 1528 of file iapplet.h.

{ NmApplet_Ver_Minor = 0};

enum tagAppletCapabilityType
Enumerator:
APPLET_UNKNOWN_CAP_TYPE
APPLET_LOGICAL_CAPABILITY
APPLET_UNSIGNED_MINIMUM_CAPABILITY
APPLET_UNSIGNED_MAXIMUM_CAPABILITY

Definition at line 171 of file iapplet.h.

    { APPLET_UNKNOWN_CAP_TYPE = 0,
  APPLET_LOGICAL_CAPABILITY = 1,
  APPLET_UNSIGNED_MINIMUM_CAPABILITY  = 2,
  APPLET_UNSIGNED_MAXIMUM_CAPABILITY  = 3
    } AppletCapabilityType;

enum tagAppletCapIDType
Enumerator:
APPLET_STANDARD_CAPABILITY
APPLET_NONSTD_CAPABILITY

Definition at line 185 of file iapplet.h.

    { APPLET_STANDARD_CAPABILITY  = 0,
  APPLET_NONSTD_CAPABILITY  = 1
    } AppletCapIDType;

enum tagAppletChannelCommand
Enumerator:
APPLET_JOIN_CHANNEL
APPLET_LEAVE_CHANNEL
APPLET_CONVENE_CHANNEL
APPLET_DISBAND_CHANNEL
APPLET_ADMIT_CHANNEL
APPLET_EXPEL_CHANNEL

Definition at line 129 of file iapplet.h.

    { APPLET_JOIN_CHANNEL = 0,
  APPLET_LEAVE_CHANNEL  = 1,
  APPLET_CONVENE_CHANNEL  = 2,
  APPLET_DISBAND_CHANNEL  = 3,
  APPLET_ADMIT_CHANNEL  = 4,
  APPLET_EXPEL_CHANNEL  = 5
    } AppletChannelCommand;

enum tagAppletChannelType
Enumerator:
APPLET_STATIC_CHANNEL
APPLET_DYNAMIC_MULTICAST_CHANNEL
APPLET_DYNAMIC_PRIVATE_CHANNEL
APPLET_DYNAMIC_USER_ID_CHANNEL
APPLET_NO_CHANNEL_TYPE_SPECIFIED

Definition at line 139 of file iapplet.h.

    { APPLET_STATIC_CHANNEL = 0,
  APPLET_DYNAMIC_MULTICAST_CHANNEL  = 1,
  APPLET_DYNAMIC_PRIVATE_CHANNEL  = 2,
  APPLET_DYNAMIC_USER_ID_CHANNEL  = 3,
  APPLET_NO_CHANNEL_TYPE_SPECIFIED  = 4
    } AppletChannelType;

enum tagAppletErrorCode
Enumerator:
APPLET_E_NO_SERVICE
APPLET_E_SERVICE_FAIL
APPLET_E_ALREADY_REGISTERED
APPLET_E_NOT_REGISTERED
APPLET_E_INVALID_CONFERENCE
APPLET_E_INVALID_COOKIE
APPLET_E_ALREADY_JOIN
APPLET_E_NOT_JOINED
APPLET_E_INVALID_JOIN_REQUEST
APPLET_E_ENTRY_ALREADY_EXISTS
APPLET_E_ENTRY_DOES_NOT_EXIST
APPLET_E_NOT_OWNER
APPLET_E_NOT_ADVISED
APPLET_E_ALREADY_ADVISED

Definition at line 212 of file iapplet.h.

    { APPLET_E_NO_SERVICE = 0x82000001,
  APPLET_E_SERVICE_FAIL = 0x82000002,
  APPLET_E_ALREADY_REGISTERED = 0x82000003,
  APPLET_E_NOT_REGISTERED = 0x82000004,
  APPLET_E_INVALID_CONFERENCE = 0x82000005,
  APPLET_E_INVALID_COOKIE = 0x82000006,
  APPLET_E_ALREADY_JOIN = 0x82000007,
  APPLET_E_NOT_JOINED = 0x82000008,
  APPLET_E_INVALID_JOIN_REQUEST = 0x82000009,
  APPLET_E_ENTRY_ALREADY_EXISTS = 0x8200000a,
  APPLET_E_ENTRY_DOES_NOT_EXIST = 0x8200000b,
  APPLET_E_NOT_OWNER  = 0x8200000c,
  APPLET_E_NOT_ADVISED  = 0x8200000d,
  APPLET_E_ALREADY_ADVISED  = 0x8200000e
    };

enum tagAppletKeyType
Enumerator:
APPLET_OBJECT_KEY
APPLET_H221_NONSTD_KEY

Definition at line 205 of file iapplet.h.

    { APPLET_OBJECT_KEY = 1,
  APPLET_H221_NONSTD_KEY  = 2
    } AppletKeyType;

enum tagAppletModificationRights
Enumerator:
APPLET_OWNER_RIGHTS
APPLET_SESSION_RIGHTS
APPLET_PUBLIC_RIGHTS
APPLET_NO_MODIFICATION_RIGHTS_SPECIFIED

Definition at line 121 of file iapplet.h.

    { APPLET_OWNER_RIGHTS = 0,
  APPLET_SESSION_RIGHTS = 1,
  APPLET_PUBLIC_RIGHTS  = 2,
  APPLET_NO_MODIFICATION_RIGHTS_SPECIFIED = 3
    } AppletModificationRights;

enum tagAppletPriority
Enumerator:
APPLET_TOP_PRIORITY
APPLET_HIGH_PRIORITY
APPLET_MEDIUM_PRIORITY
APPLET_LOW_PRIORITY

Definition at line 197 of file iapplet.h.

    { APPLET_TOP_PRIORITY = 0,
  APPLET_HIGH_PRIORITY  = 1,
  APPLET_MEDIUM_PRIORITY  = 2,
  APPLET_LOW_PRIORITY = 3
    } AppletPriority;

enum tagAppletReason
Enumerator:
APPLET_R_UNSPECIFIED
APPLET_R_CONFERENCE_GONE
APPLET_R_USER_REJECTED
APPLET_R_RESOURCE_PURGED

Definition at line 228 of file iapplet.h.

    { APPLET_R_UNSPECIFIED  = 0,
  APPLET_R_CONFERENCE_GONE  = 1,
  APPLET_R_USER_REJECTED  = 2,
  APPLET_R_RESOURCE_PURGED  = 3
    } AppletReason;

enum tagAppletRegistryCommand
Enumerator:
APPLET_REGISTER_CHANNEL
APPLET_ASSIGN_TOKEN
APPLET_SET_PARAMETER
APPLET_RETRIEVE_ENTRY
APPLET_DELETE_ENTRY
APPLET_ALLOCATE_HANDLE
APPLET_MONITOR

Definition at line 102 of file iapplet.h.

    { APPLET_REGISTER_CHANNEL = 0,
  APPLET_ASSIGN_TOKEN = 1,
  APPLET_SET_PARAMETER  = 2,
  APPLET_RETRIEVE_ENTRY = 3,
  APPLET_DELETE_ENTRY = 4,
  APPLET_ALLOCATE_HANDLE  = 5,
  APPLET_MONITOR  = 6
    } AppletRegistryCommand;

enum tagAppletRegistryItemType
Enumerator:
APPLET_REGISTRY_CHANNEL_ID
APPLET_REGISTRY_TOKEN_ID
APPLET_REGISTRY_PARAMETER
APPLET_REGISTRY_NONE

Definition at line 113 of file iapplet.h.

    { APPLET_REGISTRY_CHANNEL_ID  = 1,
  APPLET_REGISTRY_TOKEN_ID  = 2,
  APPLET_REGISTRY_PARAMETER = 3,
  APPLET_REGISTRY_NONE  = 4
    } AppletRegistryItemType;

enum tagAppletResourceAllocCommand
Enumerator:
APPLET_JOIN_DYNAMIC_CHANNEL
APPLET_GRAB_TOKEN_REQUEST

Definition at line 191 of file iapplet.h.

    { APPLET_JOIN_DYNAMIC_CHANNEL = 0,
  APPLET_GRAB_TOKEN_REQUEST = 1
    } AppletResourceAllocCommand;

enum tagAppletTokenCommand
Enumerator:
APPLET_GRAB_TOKEN
APPLET_INHIBIT_TOKEN
APPLET_GIVE_TOKEN
APPLET_PLEASE_TOKEN
APPLET_RELEASE_TOKEN
APPLET_TEST_TOKEN
APPLET_GIVE_TOKEN_RESPONSE

Definition at line 148 of file iapplet.h.

    { APPLET_GRAB_TOKEN = 0,
  APPLET_INHIBIT_TOKEN  = 1,
  APPLET_GIVE_TOKEN = 2,
  APPLET_PLEASE_TOKEN = 3,
  APPLET_RELEASE_TOKEN  = 4,
  APPLET_TEST_TOKEN = 5,
  APPLET_GIVE_TOKEN_RESPONSE  = 6
    } AppletTokenCommand;

enum tagAppletTokenStatus
Enumerator:
APPLET_TOKEN_NOT_IN_USE
APPLET_TOKEN_SELF_GRABBED
APPLET_TOKEN_OTHER_GRABBED
APPLET_TOKEN_SELF_INHIBITED
APPLET_TOKEN_OTHER_INHIBITED
APPLET_TOKEN_SELF_RECIPIENT
APPLET_TOKEN_SELF_GIVING
APPLET_TOKEN_OTHER_GIVING

Definition at line 159 of file iapplet.h.

    { APPLET_TOKEN_NOT_IN_USE = 0,
  APPLET_TOKEN_SELF_GRABBED = 1,
  APPLET_TOKEN_OTHER_GRABBED  = 2,
  APPLET_TOKEN_SELF_INHIBITED = 3,
  APPLET_TOKEN_OTHER_INHIBITED  = 4,
  APPLET_TOKEN_SELF_RECIPIENT = 5,
  APPLET_TOKEN_SELF_GIVING  = 6,
  APPLET_TOKEN_OTHER_GIVING = 7
    } AppletTokenStatus;

Function Documentation

HRESULT STDMETHODCALLTYPE IApplet_Advise_Proxy | ( | IApplet __RPC_FAR * | This,
 |  | IAppletNotify __RPC_FAR * | pNotify,
 |  | DWORD __RPC_FAR * | pdwCookie
 | ) |  |
void __RPC_STUB IApplet_Advise_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IApplet_CreateSession_Proxy | ( | IApplet __RPC_FAR * | This,
 |  | IAppletSession __RPC_FAR *__RPC_FAR * | ppSession,
 |  | AppletConfID | nConfID
 | ) |  |
void __RPC_STUB IApplet_CreateSession_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IApplet_Initialize_Proxy ( IApplet __RPC_FAR * This )
void __RPC_STUB IApplet_Initialize_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IApplet_RegisterAutoJoin_Proxy | ( | IApplet __RPC_FAR * | This,
 |  | AppletSessionRequest __RPC_FAR * | pRequest
 | ) |  |
void __RPC_STUB IApplet_RegisterAutoJoin_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IApplet_UnAdvise_Proxy | ( | IApplet __RPC_FAR * | This,
 |  | DWORD | dwCookie
 | ) |  |
void __RPC_STUB IApplet_UnAdvise_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IApplet_UnregisterAutoJoin_Proxy ( IApplet __RPC_FAR * This )
void __RPC_STUB IApplet_UnregisterAutoJoin_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IAppletNotify_AutoJoinSessionIndication_Proxy | ( | IAppletNotify __RPC_FAR * | This,
 |  | IAppletSession __RPC_FAR * | pSession,
 |  | HRESULT | hrResult,
 |  | AppletUserID | uidMyself,
 |  | AppletNodeID | nidMyself,
 |  | AppletSessionID | sidMyself,
 |  | AppletEntityID | eidMyself,
 |  | ULONG | cDynamicChannels,
 |  | AppletChannelID __RPC_FAR | aDynamicChannels[]
 | ) |  |
void __RPC_STUB IAppletNotify_AutoJoinSessionIndication_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IAppletNotify_PermitToJoinSessionIndication_Proxy | ( | IAppletNotify __RPC_FAR * | This,
 |  | AppletConfID | nConfID,
 |  | BOOL | fPermissionGranted
 | ) |  |
void __RPC_STUB IAppletNotify_PermitToJoinSessionIndication_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IAppletSession_Advise_Proxy | ( | IAppletSession __RPC_FAR * | This,
 |  | IAppletSessionNotify __RPC_FAR * | pNotify,
 |  | DWORD __RPC_FAR * | pdwCookie
 | ) |  |
void __RPC_STUB IAppletSession_Advise_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IAppletSession_ChannelRequest_Proxy | ( | IAppletSession __RPC_FAR * | This,
 |  | AppletChannelRequest __RPC_FAR * | pRequest
 | ) |  |
void __RPC_STUB IAppletSession_ChannelRequest_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IAppletSession_GetConfID_Proxy | ( | IAppletSession __RPC_FAR * | This,
 |  | AppletConfID __RPC_FAR * | pnConfID
 | ) |  |
void __RPC_STUB IAppletSession_GetConfID_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IAppletSession_InquireRoster_Proxy | ( | IAppletSession __RPC_FAR * | This,
 |  | AppletSessionKey __RPC_FAR * | pSessionKey
 | ) |  |
void __RPC_STUB IAppletSession_InquireRoster_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IAppletSession_InvokeApplet_Proxy | ( | IAppletSession __RPC_FAR * | This,
 |  | AppletRequestTag __RPC_FAR * | pnReqTag,
 |  | AppletProtocolEntity __RPC_FAR * | pAPE,
 |  | ULONG | cNodes,
 |  | AppletNodeID __RPC_FAR | aNodeIDs[]
 | ) |  |
void __RPC_STUB IAppletSession_InvokeApplet_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IAppletSession_IsThisNodeTopProvider_Proxy | ( | IAppletSession __RPC_FAR * | This,
 |  | BOOL __RPC_FAR * | pfTopProvider
 | ) |  |
void __RPC_STUB IAppletSession_IsThisNodeTopProvider_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IAppletSession_Join_Proxy | ( | IAppletSession __RPC_FAR * | This,
 |  | AppletSessionRequest __RPC_FAR * | pRequest
 | ) |  |
void __RPC_STUB IAppletSession_Join_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IAppletSession_Leave_Proxy ( IAppletSession __RPC_FAR * This )
void __RPC_STUB IAppletSession_Leave_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IAppletSession_RegistryRequest_Proxy | ( | IAppletSession __RPC_FAR * | This,
 |  | AppletRegistryRequest __RPC_FAR * | pRequest
 | ) |  |
void __RPC_STUB IAppletSession_RegistryRequest_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IAppletSession_SendData_Proxy | ( | IAppletSession __RPC_FAR * | This,
 |  | BOOL | fUniformSend,
 |  | AppletChannelID | nChannelID,
 |  | AppletPriority | ePriority,
 |  | ULONG | cbBufSize,
 |  | BYTE __RPC_FAR * | pBuffer
 | ) |  |
void __RPC_STUB IAppletSession_SendData_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IAppletSession_TokenRequest_Proxy | ( | IAppletSession __RPC_FAR * | This,
 |  | AppletTokenRequest __RPC_FAR * | pRequest
 | ) |  |
void __RPC_STUB IAppletSession_TokenRequest_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IAppletSession_UnAdvise_Proxy | ( | IAppletSession __RPC_FAR * | This,
 |  | DWORD | dwCookie
 | ) |  |
void __RPC_STUB IAppletSession_UnAdvise_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IAppletSessionNotify_AllocateHandleConfirm_Proxy | ( | IAppletSessionNotify __RPC_FAR * | This,
 |  | HRESULT | hrResult,
 |  | ULONG | nFirstHandle,
 |  | ULONG | cHandles
 | ) |  |
void __RPC_STUB IAppletSessionNotify_AllocateHandleConfirm_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IAppletSessionNotify_ChannelConfirm_Proxy | ( | IAppletSessionNotify __RPC_FAR * | This,
 |  | AppletChannelCommand | eCommand,
 |  | HRESULT | hrResult,
 |  | AppletChannelID | nChannelID
 | ) |  |
void __RPC_STUB IAppletSessionNotify_ChannelConfirm_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IAppletSessionNotify_ChannelIndication_Proxy | ( | IAppletSessionNotify __RPC_FAR * | This,
 |  | AppletChannelCommand | eCommand,
 |  | AppletChannelID | nChannelID,
 |  | AppletReason | eReason,
 |  | AppletUserID | uidManager
 | ) |  |
void __RPC_STUB IAppletSessionNotify_ChannelIndication_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IAppletSessionNotify_InquireRosterConfirm_Proxy | ( | IAppletSessionNotify __RPC_FAR * | This,
 |  | HRESULT | hrResult,
 |  | ULONG | cRosters,
 |  | AppletRoster __RPC_FAR *__RPC_FAR * | apAppRosters
 | ) |  |
void __RPC_STUB IAppletSessionNotify_InquireRosterConfirm_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IAppletSessionNotify_InvokeAppletConfirm_Proxy | ( | IAppletSessionNotify __RPC_FAR * | This,
 |  | AppletRequestTag | nReqTag,
 |  | HRESULT | hrResult
 | ) |  |
void __RPC_STUB IAppletSessionNotify_InvokeAppletConfirm_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IAppletSessionNotify_JoinSessionConfirm_Proxy | ( | IAppletSessionNotify __RPC_FAR * | This,
 |  | HRESULT | hrResult,
 |  | AppletUserID | uidMyself,
 |  | AppletNodeID | nidMyself,
 |  | AppletSessionID | sidMyself,
 |  | AppletEntityID | eidMyself,
 |  | ULONG | cDynamicChannels,
 |  | AppletChannelID __RPC_FAR | aDynamicChannels[]
 | ) |  |
void __RPC_STUB IAppletSessionNotify_JoinSessionConfirm_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IAppletSessionNotify_LeaveSessionIndication_Proxy | ( | IAppletSessionNotify __RPC_FAR * | This,
 |  | AppletReason | eReason,
 |  | AppletUserID | uidLeave
 | ) |  |
void __RPC_STUB IAppletSessionNotify_LeaveSessionIndication_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IAppletSessionNotify_RegistryConfirm_Proxy | ( | IAppletSessionNotify __RPC_FAR * | This,
 |  | AppletRegistryCommand | eCommand,
 |  | HRESULT | hrResult,
 |  | AppletRegistryKey __RPC_FAR * | pRegistryKey,
 |  | AppletRegistryItem __RPC_FAR * | pRegistryItem,
 |  | AppletRegistryEntryOwner __RPC_FAR * | pEntryOwner,
 |  | AppletModificationRights | eRights
 | ) |  |
void __RPC_STUB IAppletSessionNotify_RegistryConfirm_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IAppletSessionNotify_RosterReportIndication_Proxy | ( | IAppletSessionNotify __RPC_FAR * | This,
 |  | ULONG | cRosters,
 |  | AppletRoster __RPC_FAR *__RPC_FAR * | apAppRosters
 | ) |  |
void __RPC_STUB IAppletSessionNotify_RosterReportIndication_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IAppletSessionNotify_SendDataIndication_Proxy | ( | IAppletSessionNotify __RPC_FAR * | This,
 |  | BOOL | fUniformSend,
 |  | AppletUserID | uidInitiator,
 |  | AppletChannelID | nChannelID,
 |  | AppletPriority | eDataPriority,
 |  | AppletOctetString | Data
 | ) |  |
void __RPC_STUB IAppletSessionNotify_SendDataIndication_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IAppletSessionNotify_TestTokenConfirm_Proxy | ( | IAppletSessionNotify __RPC_FAR * | This,
 |  | AppletTokenID | nTokenID,
 |  | AppletTokenStatus | eStatus
 | ) |  |
void __RPC_STUB IAppletSessionNotify_TestTokenConfirm_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IAppletSessionNotify_TokenConfirm_Proxy | ( | IAppletSessionNotify __RPC_FAR * | This,
 |  | AppletTokenCommand | eCommand,
 |  | HRESULT | hrResult,
 |  | AppletTokenID | nTokenID
 | ) |  |
void __RPC_STUB IAppletSessionNotify_TokenConfirm_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
HRESULT STDMETHODCALLTYPE IAppletSessionNotify_TokenIndication_Proxy | ( | IAppletSessionNotify __RPC_FAR * | This,
 |  | AppletTokenCommand | eCommand,
 |  | AppletReason | eReason,
 |  | AppletTokenID | nTokenID,
 |  | AppletUserID | uidInitiator
 | ) |  |
void __RPC_STUB IAppletSessionNotify_TokenIndication_Stub | ( | IRpcStubBuffer * | This,
 |  | IRpcChannelBuffer * | _pRpcChannelBuffer,
 |  | PRPC_MESSAGE | _pRpcMessage,
 |  | DWORD * | _pdwStubPhase
 | ) |  |
void __RPC_FAR* __RPC_USER MIDL_user_allocate ( size_t )

Definition at line 364 of file Picklpc.c.

{
    unsigned char * pcAllocated;
    unsigned char * pcUserPtr;

    pcAllocated = (unsigned char *) malloc( s + 15 );
    pcUserPtr =  ALIGN_TO8( pcAllocated );
    if ( pcUserPtr == pcAllocated )
        pcUserPtr = pcAllocated + 8;

    *(pcUserPtr - 1) = (char) (pcUserPtr - pcAllocated);

    return( pcUserPtr );
}

void __RPC_USER MIDL_user_free ( void __RPC_FAR * )

Definition at line 379 of file Picklpc.c.

{
    unsigned char * pcAllocated;
    unsigned char * pcUserPtr;

    pcUserPtr = (unsigned char *) f;
    pcAllocated = pcUserPtr - *(pcUserPtr - 1);

    free( pcAllocated );
}

Variable Documentation

RPC_IF_HANDLE __MIDL_itf_iapplet_0000_v0_0_c_ifspec
RPC_IF_HANDLE __MIDL_itf_iapplet_0000_v0_0_s_ifspec
RPC_IF_HANDLE __MIDL_itf_iapplet_0212_v0_0_c_ifspec
RPC_IF_HANDLE __MIDL_itf_iapplet_0212_v0_0_s_ifspec
EXTERN_C const CLSID CLSID_NmApplet

Definition at line 1544 of file iapplet.h.

EXTERN_C const IID IID_IApplet

Definition at line 1331 of file iapplet.h.

EXTERN_C const IID IID_IAppletNotify

Definition at line 1195 of file iapplet.h.

EXTERN_C const IID IID_IAppletSession

Definition at line 842 of file iapplet.h.

EXTERN_C const IID IID_IAppletSessionNotify

Definition at line 389 of file iapplet.h.

EXTERN_C const IID LIBID_NmApplet

Definition at line 1542 of file iapplet.h.

interface IAppletSessionNotify CONST_VTBL struct IAppletSessionNotifyVtbl __RPC_FAR* lpVtbl

Definition at line 578 of file iapplet.h.

Generated on Wed Nov 13 2024 16:54:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMChat2/iapplet.idl File Reference

  • Web
  • NetMeeting
  • NMChat2

iapplet.idl File Reference

import "iapplet.idl";

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMChat2/imsconf2.idl File Reference

  • Web
  • NetMeeting
  • NMChat2

imsconf2.idl File Reference

#include <imsconf2.idl>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMChat2/precomp.h File Reference

  • Web
  • NetMeeting
  • NMChat2
Defines | Functions | Variables

precomp.h File Reference

#include <windows.h>
#include <windowsx.h>
#include <commctrl.h>
#include <tchar.h>
#include <ocidl.h>
#include <stdio.h>
#include "imsconf2.h"
#include "iapplet.h"
#include "conf.h"
#include "session.h"
#include "applet.h"
#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Defines

#define | ARRAY_ELEMENTS(rg) (sizeof(rg) / sizeof(rg[0]))
#define | ASSERT(f)
#define | CCHMAX(sz) (sizeof(sz) / sizeof(TCHAR))
#define | MAX_MEMBERS 8

Functions

void | UiAddMember (CMember *pMember)
void | UiDisplayMsg (LPTSTR pszMsg, LPTSTR pszMemberName=NULL)
void | UiDisplaySysMsg (LPTSTR pszMsg, LPTSTR pszMemberName=NULL)
void | UiRemoveMember (CMember *pMember)

Variables

HINSTANCE | g_hInstExe
HWND | g_hwndMain

Define Documentation

#define ARRAY_ELEMENTS ( rg ) (sizeof(rg) / sizeof(rg[0]))

Definition at line 30 of file precomp.h.

#define ASSERT ( f )

Definition at line 39 of file precomp.h.

#define CCHMAX ( sz ) (sizeof(sz) / sizeof(TCHAR))

Definition at line 31 of file precomp.h.

#define MAX_MEMBERS 8

Definition at line 33 of file precomp.h.

Function Documentation

void UiAddMember ( CMember * pMember )

Definition at line 491 of file ui.cpp.

{
    LPTSTR pszName = NULL;
    if (NULL != pMember)
    {
        pszName = pMember->GetName();
    }
    else
    {
        pszName = TEXT("everyone");
    }

    LV_ITEM  lvItem;
    ::ZeroMemory(&lvItem, sizeof(lvItem));
    lvItem.iItem = ListView_GetItemCount(g_hwndUser);
    lvItem.mask = LVIF_PARAM | LVIF_TEXT;
    lvItem.pszText = pszName;
    lvItem.cchTextMax = ::lstrlen(pszName);
    lvItem.lParam = (LPARAM) pMember;
    ListView_InsertItem(g_hwndUser, &lvItem);

    if (NULL != pMember)
    {
        ::UiDisplaySysMsg(TEXT("<joined>"), pszName);
    }
}

void UiDisplayMsg | ( | LPTSTR | pszMsg,
 |  | LPTSTR | pszMemberName = NULL
 | ) |  |

Definition at line 365 of file ui.cpp.

{
    if (NULL == pszUser)
    {
        pszUser = TEXT("");
    }
    ::UiDisplayMessage(pszMsg, pszUser);
}

void UiDisplaySysMsg | ( | LPTSTR | pszMsg,
 |  | LPTSTR | pszMemberName = NULL
 | ) |  |

Definition at line 381 of file ui.cpp.

{
    if (NULL == pszUser)
    {
        pszUser = TEXT("");
    }
    ::UiDisplayMessage(pszMsg, pszUser);
}

void UiRemoveMember ( CMember * pMember )

Definition at line 525 of file ui.cpp.

{
    if (NULL != pMember)
    {
        ::UiDisplaySysMsg(TEXT("<left>"), pMember->GetName());
    }

    LV_FINDINFO findInfo;
    ::ZeroMemory(&findInfo, sizeof(findInfo));
    findInfo.flags = LVFI_PARAM;
    findInfo.lParam = (LPARAM) pMember;
    int iItem = ListView_FindItem(g_hwndUser, -1, &findInfo);
    ListView_DeleteItem(g_hwndUser, iItem);
}

Variable Documentation

HINSTANCE g_hInstExe

Definition at line 60 of file ui.cpp.

HWND g_hwndMain

Definition at line 63 of file ui.cpp.

Generated on Wed Nov 13 2024 16:53:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMChat2/resource.h File Reference

  • Web
  • NetMeeting
  • NMChat2
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | ICO_MAIN 101
#define | ID_APPACCEL 105
#define | IDM_ABOUT 40092
#define | IDM_APP 104
#define | IDM_EJECT 40021
#define | IDM_EXIT 40002
#define | IDM_INVOKE_ALL 40101
#define | IDM_REGISTER_LOCAL 40100
#define | IDM_VIEW_CLEAR 40012
#define | IDS_APP_TITLE 1
#define | IDS_SYSMENU 4
#define | IDS_VERSION 2

Define Documentation

#define ICO_MAIN 101

Definition at line 22 of file resource.h.

#define ID_APPACCEL 105

Definition at line 24 of file resource.h.

#define IDM_ABOUT 40092

Definition at line 28 of file resource.h.

#define IDM_APP 104

Definition at line 23 of file resource.h.

#define IDM_EJECT 40021

Definition at line 27 of file resource.h.

#define IDM_EXIT 40002

Definition at line 25 of file resource.h.

#define IDM_INVOKE_ALL 40101

Definition at line 31 of file resource.h.

#define IDM_REGISTER_LOCAL 40100

Definition at line 30 of file resource.h.

#define IDM_VIEW_CLEAR 40012

Definition at line 26 of file resource.h.

#define IDS_APP_TITLE 1

Definition at line 19 of file resource.h.

#define IDS_SYSMENU 4

Definition at line 21 of file resource.h.

#define IDS_VERSION 2

Definition at line 20 of file resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMChat2/session.cpp File Reference

  • Web
  • NetMeeting
  • NMChat2
Defines | Functions | Variables

session.cpp File Reference

#include "precomp.h"
#include "nmappstr.h"

Go to the source code of this file.

Defines

#define | DYNAMIC_CHANNEL_RESOURCE_ID "Sample Chat Dynamic Channel"
#define | MY_KEY_SIZE (sizeof(c_AppletKeyPrefix) + sizeof(GUID) + sizeof(DWORD))

Functions

void | BuildAppletKey (void)
BOOL | GetInvokeInfo (INVOKE_INFO *pInfo)
LPTSTR | PszFromBstr (BSTR bst)
HRESULT | RegisterInvokeInfo (LPSTR pszKey)
HRESULT | RegisterNonStandardAppletInvokeInfo (void)
HRESULT | RegisterStandardAppletInvokeInfo (AppletLongString *pKey)

Variables

INVOKE_INFO g_InvokeInfo
CAppletSession * | g_pSession = NULL

Define Documentation

#define DYNAMIC_CHANNEL_RESOURCE_ID "Sample Chat Dynamic Channel"

Definition at line 692 of file session.cpp.

#define MY_KEY_SIZE (sizeof(c_AppletKeyPrefix) + sizeof(GUID) + sizeof(DWORD))

Definition at line 686 of file session.cpp.

Function Documentation

void BuildAppletKey ( void )

Definition at line 695 of file session.cpp.

{
    //
    // Build the applet key.
    //
    ::ZeroMemory(g_AppletKey, sizeof(g_AppletKey));
    ::CopyMemory(g_AppletKey, c_AppletKeyPrefix, sizeof(c_AppletKeyPrefix));
    ::CopyMemory(g_AppletKey + sizeof(c_AppletKeyPrefix),
                 &c_SampleAppletGuid, sizeof(GUID));
}

BOOL GetInvokeInfo ( INVOKE_INFO * pInfo )

Definition at line 927 of file session.cpp.

{
  TCHAR szValue[MAX_PATH + 1];
  ::ZeroMemory(szValue, (MAX_PATH + 1) * sizeof(TCHAR));

    ::ZeroMemory(pInfo, sizeof(*pInfo));

    // retrieve conf ID
    if (::GetEnvironmentVariable(NM_ENV_CONF_ID, szValue, MAX_PATH))
    {
        pInfo->nConfID = ::atoi(szValue);
    }

    // retrieve the node ID of initiator
    if (::GetEnvironmentVariable(NM_ENV_NODE_ID, szValue, MAX_PATH))
    {
        pInfo->nidInitiator = ::atoi(szValue);
    }

    pInfo->fValid = pInfo->nConfID && pInfo->nidInitiator;
    return pInfo->fValid;
}

LPTSTR PszFromBstr ( BSTR bst )

Definition at line 1185 of file session.cpp.

{
    LPTSTR psz = NULL;

    if (NULL != bstr)
    {
        int cch = ::WideCharToMultiByte(CP_ACP, 0, (LPWSTR)bstr, -1, NULL, 0, NULL, NULL);
        if (cch > 0)
        {
            psz = new TCHAR[cch+1];
            if (NULL != psz)
            {
        ZeroMemory(psz, sizeof(TCHAR) * (cch + 1));
                ::WideCharToMultiByte(CP_ACP, 0, (LPWSTR)bstr, -1, psz, cch, NULL, NULL);
            }
        }
    }
    return psz;
}

HRESULT RegisterInvokeInfo ( LPSTR pszKey )

Definition at line 833 of file session.cpp.

{
    if(NULL == pszKey)
  {
    return E_POINTER;
  }

  HKEY hKey = NULL;
    LONG lRet = 0;
    DWORD dwDisposition = 0;
    TCHAR szValue[MAX_PATH + 1];
  ::ZeroMemory(szValue, (MAX_PATH + 1) * sizeof(TCHAR));

  lRet = ::RegCreateKeyEx(
                        HKEY_LOCAL_MACHINE,
                        pszKey,
                        0,
                        NULL,
                        REG_OPTION_NON_VOLATILE,
                        KEY_SET_VALUE,
                        NULL,
                        &hKey,
                        &dwDisposition);

    ASSERT(0 == lRet);
    ASSERT(NULL != hKey);

  if(NULL == hKey)
  {
    return E_HANDLE;
  }

    szValue[0] = TEXT('\0');
    ::GetModuleFileName(g_hInstExe, szValue, MAX_PATH);
    lRet = ::RegSetValueEx(hKey,
                           NM_REGVAL_APP_PATH,
                           0,
                           REG_SZ,
                           (LPBYTE) &szValue[0],
                           (::lstrlen(szValue) + 1) * sizeof(TCHAR));
    ASSERT(0 == lRet);

    szValue[0] = TEXT('\0'); // no command line
    lRet = ::RegSetValueEx(hKey,
                           NM_REGVAL_CMD_LINE,
                           0,
                           REG_SZ,
                           (LPBYTE) &szValue[0],
                           (::lstrlen(szValue) + 1) * sizeof(TCHAR));
    ASSERT(0 == lRet);

    ::GetCurrentDirectory(MAX_PATH, szValue); // default working directory
    lRet = ::RegSetValueEx(hKey,
                           NM_REGVAL_CURR_DIR,
                           0,
                           REG_SZ,
                           (LPBYTE) &szValue[0],
                           (::lstrlen(szValue) + 1) * sizeof(TCHAR));
    ASSERT(0 == lRet);

    ::lstrcpyn((LPTSTR) &szValue[0], TEXT("Microsoft Corporation"), MAX_PATH + 1);
    lRet = ::RegSetValueEx(hKey,
                           NM_REGVAL_MANUFACTURER,
                           0,
                           REG_SZ,
                           (LPBYTE) &szValue[0],
                           (::lstrlen(szValue) + 1) * sizeof(TCHAR));
    ASSERT(0 == lRet);

    ::lstrcpyn((LPTSTR) &szValue[0], TEXT("NetMeeting SDK 3.0 Chat Sample Applet"), MAX_PATH + 1);
    lRet = ::RegSetValueEx(hKey,
                           NM_REGVAL_PRODUCT_NAME,
                           0,
                           REG_SZ,
                           (LPBYTE) &szValue[0],
                           (::lstrlen(szValue) + 1) * sizeof(TCHAR));
    ASSERT(0 == lRet);

    ::lstrcpyn((LPTSTR) &szValue[0], TEXT("SDK Sample using IApplet and IAppletSession"), MAX_PATH + 1);
    lRet = ::RegSetValueEx(hKey,
                           NM_REGVAL_DESCRIPTION,
                           0,
                           REG_SZ,
                           (LPBYTE) &szValue[0],
                           (::lstrlen(szValue) + 1) * sizeof(TCHAR));
    ASSERT(0 == lRet);

    ::RegFlushKey(hKey);
    ::RegCloseKey(hKey);
    return S_OK;
}

HRESULT RegisterNonStandardAppletInvokeInfo ( void )

Definition at line 795 of file session.cpp.

{
    //
    // Build the applet key.
    //
    ::BuildAppletKey();

    //
    // The format of a non-standard t120 applet is as follows.
    //  NM_APPLET_KEY\NM_NONSTD_KEY\{2-hex-dot string}
    //
    char szKey[MAX_PATH + 1];
  ::ZeroMemory(szKey, (MAX_PATH + 1) * sizeof(char));

  ::_snprintf(szKey, MAX_PATH, "%s\\%s\\%s", NM_APPLET_KEY, NM_NONSTD_KEY_TYPE, "{");

    //
    // Build the 2-digit hex dot string.
    //
    LPSTR pszKey = szKey + ::lstrlenA(szKey);
    ULONG cbDataSize = sizeof(g_AppletKey);
    LPBYTE pbData = g_AppletKey;
    for (ULONG i = 0; i < cbDataSize; i++, pbData++)
    {
    ::_snprintf(pszKey, MAX_PATH - ::lstrlenA(szKey), "%02X.", (UINT) *pbData);
        pszKey += ::lstrlenA(pszKey);
    }
    ::_snprintf(pszKey - 1, 1, "}");

    //
    // Register the applet information.
    //
    return ::RegisterInvokeInfo(szKey);
}

HRESULT RegisterStandardAppletInvokeInfo ( AppletLongString * pKey )

Definition at line 766 of file session.cpp.

{
    //
    // The format of a standard t120 applet will be as follows.
    //  NM_APPLET_KEY\NM_STD_KEY\{8-hex-dot string}
    //
    char szKey[MAX_PATH + 1];
  ::ZeroMemory(szKey, (MAX_PATH + 1) * sizeof(char));

  ::_snprintf(szKey, MAX_PATH, "%s\\%s\\%s", NM_APPLET_KEY, NM_STD_KEY_TYPE, "{");

    //
    // Build the 8-digit hex dot string.
    //
    LPSTR pszKey = szKey + ::lstrlenA(szKey);
    for (ULONG i = 0; i < pKey->nStrLen; i++)
    {
        ::_snprintf(pszKey, MAX_PATH - ::lstrlenA(szKey), "%08X.", (UINT) pKey->pnValue[i]);
        pszKey += ::lstrlenA(pszKey);
    }
  ::_snprintf(pszKey - 1, 1, "}");

    //
    // Register the applet information.
    //
    return ::RegisterInvokeInfo(szKey);
}

Variable Documentation

INVOKE_INFO g_InvokeInfo

Definition at line 32 of file session.cpp.

CAppletSession* g_pSession = NULL

Definition at line 27 of file session.cpp.

Generated on Wed Nov 13 2024 16:53:28 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMChat2/session.h File Reference

  • Web
  • NetMeeting
  • NMChat2
Classes | Functions | Variables

session.h File Reference

Go to the source code of this file.

Classes

class | CAppletSession
class | CMember
struct | INVOKE_INFO

Functions

BOOL GetInvokeInfo (INVOKE_INFO *)
HRESULT | RegisterNonStandardAppletInvokeInfo (void)
HRESULT | RegisterStandardAppletInvokeInfo (AppletLongString *pKey)

Variables

INVOKE_INFO g_InvokeInfo
CAppletSession * g_pSession

Function Documentation

BOOL GetInvokeInfo ( INVOKE_INFO * )

Definition at line 927 of file session.cpp.

{
  TCHAR szValue[MAX_PATH + 1];
  ::ZeroMemory(szValue, (MAX_PATH + 1) * sizeof(TCHAR));

    ::ZeroMemory(pInfo, sizeof(*pInfo));

    // retrieve conf ID
    if (::GetEnvironmentVariable(NM_ENV_CONF_ID, szValue, MAX_PATH))
    {
        pInfo->nConfID = ::atoi(szValue);
    }

    // retrieve the node ID of initiator
    if (::GetEnvironmentVariable(NM_ENV_NODE_ID, szValue, MAX_PATH))
    {
        pInfo->nidInitiator = ::atoi(szValue);
    }

    pInfo->fValid = pInfo->nConfID && pInfo->nidInitiator;
    return pInfo->fValid;
}

HRESULT RegisterNonStandardAppletInvokeInfo ( void )

Definition at line 795 of file session.cpp.

{
    //
    // Build the applet key.
    //
    ::BuildAppletKey();

    //
    // The format of a non-standard t120 applet is as follows.
    //  NM_APPLET_KEY\NM_NONSTD_KEY\{2-hex-dot string}
    //
    char szKey[MAX_PATH + 1];
  ::ZeroMemory(szKey, (MAX_PATH + 1) * sizeof(char));

  ::_snprintf(szKey, MAX_PATH, "%s\\%s\\%s", NM_APPLET_KEY, NM_NONSTD_KEY_TYPE, "{");

    //
    // Build the 2-digit hex dot string.
    //
    LPSTR pszKey = szKey + ::lstrlenA(szKey);
    ULONG cbDataSize = sizeof(g_AppletKey);
    LPBYTE pbData = g_AppletKey;
    for (ULONG i = 0; i < cbDataSize; i++, pbData++)
    {
    ::_snprintf(pszKey, MAX_PATH - ::lstrlenA(szKey), "%02X.", (UINT) *pbData);
        pszKey += ::lstrlenA(pszKey);
    }
    ::_snprintf(pszKey - 1, 1, "}");

    //
    // Register the applet information.
    //
    return ::RegisterInvokeInfo(szKey);
}

HRESULT RegisterStandardAppletInvokeInfo ( AppletLongString * pKey )

Definition at line 766 of file session.cpp.

{
    //
    // The format of a standard t120 applet will be as follows.
    //  NM_APPLET_KEY\NM_STD_KEY\{8-hex-dot string}
    //
    char szKey[MAX_PATH + 1];
  ::ZeroMemory(szKey, (MAX_PATH + 1) * sizeof(char));

  ::_snprintf(szKey, MAX_PATH, "%s\\%s\\%s", NM_APPLET_KEY, NM_STD_KEY_TYPE, "{");

    //
    // Build the 8-digit hex dot string.
    //
    LPSTR pszKey = szKey + ::lstrlenA(szKey);
    for (ULONG i = 0; i < pKey->nStrLen; i++)
    {
        ::_snprintf(pszKey, MAX_PATH - ::lstrlenA(szKey), "%08X.", (UINT) pKey->pnValue[i]);
        pszKey += ::lstrlenA(pszKey);
    }
  ::_snprintf(pszKey - 1, 1, "}");

    //
    // Register the applet information.
    //
    return ::RegisterInvokeInfo(szKey);
}

Variable Documentation

INVOKE_INFO g_InvokeInfo

Definition at line 32 of file session.cpp.

CAppletSession* g_pSession

Definition at line 27 of file session.cpp.

Generated on Wed Nov 13 2024 16:54:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMChat2/ui.cpp File Reference

  • Web
  • NetMeeting
  • NMChat2
Classes | Defines | Functions | Variables

ui.cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Classes

struct | COL

Defines

#define | IDW_EDIT 102
#define | IDW_MSG 100
#define | IDW_USER 101
#define | ILV_NAME 0
#define | ILV_TEXT 2
#define | ILV_TIME 1
#define | MY_CLASS_NAME TEXT("MyClassName")

Functions

void | CmdAbout (void)
void | CmdExit (void)
void | CmdInvokeRemote (void)
void | CmdRegisterLocal (void)
BOOL | CreateEditWindow (void)
BOOL | CreateMsgWindow (void)
BOOL | CreateUserList (void)
BOOL | InitMainUI (void)
LRESULT | MsgCmdMain (HWND hwnd, WPARAM wParam, LPARAM lParam)
void | ProcessCleanup (void)
BOOL | ProcessStartup (LPSTR lpszCmd, int nCmdShow)
LRESULT FAR PASCAL | SubClsEdit (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
void | UiAddMember (CMember *pMember)
void | UiClearText (void)
void | UiDisplayMessage (LPTSTR pszMsg, LPTSTR pszUser)
void | UiDisplayMsg (LPTSTR pszMsg, LPTSTR pszUser)
void | UiDisplaySysMsg (LPTSTR pszMsg, LPTSTR pszUser)
CMember * | UiGetSelectedMember (void)
void | UiRemoveMember (CMember *pMember)
void | UiSendText (void)
void | UiSizeMsgWindow (int dx, int dy)
int APIENTRY | WinMain (HINSTANCE hInstance, HINSTANCE hInstPrev, LPSTR lpszCmd, int nCmdShow)
LRESULT CALLBACK | WndProc (HWND, UINT, WPARAM, LPARAM)

Variables

const int | DXP_USER = 80
const int | DYP_EDIT = 30
HACCEL | g_hAccelTable = NULL
HINSTANCE | g_hInstExe = NULL
HMENU | g_hMenu = NULL
HWND | g_hwndEdit = NULL
HWND | g_hwndMain = NULL
HWND | g_hwndMsg = NULL
HWND | g_hwndUser = NULL
WNDPROC | lpProcEdit = NULL
const int | XP_LEFT = 0
const int | YP_TOP = 3

Define Documentation

#define IDW_EDIT 102

Definition at line 26 of file ui.cpp.

#define IDW_MSG 100

Definition at line 24 of file ui.cpp.

#define IDW_USER 101

Definition at line 25 of file ui.cpp.

#define ILV_NAME 0

Definition at line 29 of file ui.cpp.

#define ILV_TEXT 2

Definition at line 31 of file ui.cpp.

#define ILV_TIME 1

Definition at line 30 of file ui.cpp.

#define MY_CLASS_NAME TEXT("MyClassName")

Definition at line 69 of file ui.cpp.

Function Documentation

void CmdAbout ( void )

Definition at line 584 of file ui.cpp.

{
    TCHAR szVersion[MAX_PATH + 1];
  ::ZeroMemory(szVersion, (MAX_PATH + 1) * sizeof(TCHAR));

    ::LoadString(g_hInstExe, IDS_VERSION, szVersion, CCHMAX(szVersion));

    ::ShellAbout(g_hwndMain, szVersion, NULL, LoadIcon(g_hInstExe, MAKEINTRESOURCE(ICO_MAIN)));
}

void CmdExit ( void )

Definition at line 570 of file ui.cpp.

{
    ::DestroyWindow(g_hwndMain);
}

void CmdInvokeRemote ( void )

Definition at line 619 of file ui.cpp.

{
    if (NULL != g_pSession)
    {
        g_pSession->InvokeApplet();
    }
}

void CmdRegisterLocal ( void )

Definition at line 604 of file ui.cpp.

{
    HRESULT hr = ::RegisterNonStandardAppletInvokeInfo();
    ASSERT(S_OK == hr);
}

BOOL CreateEditWindow ( void )

Definition at line 189 of file ui.cpp.

{
    g_hwndEdit = ::CreateWindow(TEXT("EDIT"), NULL,
                        WS_CHILD | WS_VISIBLE | WS_BORDER | ES_AUTOHSCROLL,
                        0, 0, 0, DYP_EDIT, g_hwndMain, (HMENU) IDW_EDIT, g_hInstExe, NULL);
    if (NULL != g_hwndEdit)
    {
        // set the font for the window

        lpProcEdit = (WNDPROC) ::GetWindowLong(g_hwndEdit, GWL_WNDPROC);
        ::SetWindowLong(g_hwndEdit, GWL_WNDPROC, (LONG)(WNDPROC) SubClsEdit);
    }

    return (BOOL) g_hwndEdit;
}

BOOL CreateMsgWindow ( void )

Definition at line 98 of file ui.cpp.

{
    g_hwndMsg = ::CreateWindow(TEXT("SysListView32"), NULL,
                    WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_BORDER | LVS_REPORT,
                    0, 0, 0, 0, g_hwndMain, (HMENU) IDW_USER, g_hInstExe, NULL);
    if (NULL != g_hwndMsg)
    {
        // Initialize column data
        int iCol  = 0;
    int iRet  = 0;
        COL  *lpCol = NULL;
        LV_COLUMN lvc;

        lpCol = _rgColMsg;
        ::ZeroMemory(&lvc, sizeof(lvc));
        lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
        lvc.fmt = LVCFMT_LEFT;
        for (iCol = 0; iCol < ARRAY_ELEMENTS(_rgColMsg); iCol++)
        {
            lvc.iSubItem = iCol;
            lvc.cx = lpCol->dwWidth;
            lvc.pszText = lpCol->lpsz;

            iRet = ListView_InsertColumn(g_hwndMsg, iCol, &lvc);
            ASSERT(-1 != iRet);
            lpCol++;
        }
    }
    return (BOOL) g_hwndMsg;
}

BOOL CreateUserList ( void )

Definition at line 138 of file ui.cpp.

{
    g_hwndUser = ::CreateWindow(TEXT("SysListView32"), NULL,
                        WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_BORDER | LVS_REPORT | LVS_SHOWSELALWAYS,
                        0, 0, DXP_USER, 0, g_hwndMain, (HMENU) IDW_MSG, g_hInstExe, NULL);
    if (NULL != g_hwndUser)
    {
        // Initialize column data
        int iRet = 0;
        LV_COLUMN lvc;
        ::ZeroMemory(&lvc, sizeof(lvc));
        lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
        lvc.fmt = LVCFMT_LEFT;
        lvc.iSubItem = 0;
        lvc.cx = DXP_USER;
        lvc.pszText = TEXT("Send To");
        iRet = ListView_InsertColumn(g_hwndUser, 0, &lvc);
        ASSERT(-1 != iRet);
    }
    return (BOOL) g_hwndUser;
}

BOOL InitMainUI ( void )

Definition at line 214 of file ui.cpp.

{
    TCHAR szTitle[MAX_PATH + 1];
    WNDCLASS  wc;

  ::ZeroMemory(szTitle, (MAX_PATH + 1) * sizeof(TCHAR));
  ::ZeroMemory(&wc, sizeof(WNDCLASS));

    ASSERT(NULL != g_hInstExe);

    g_hAccelTable = ::LoadAccelerators(g_hInstExe, MAKEINTRESOURCE(ID_APPACCEL));

    ::LoadString(g_hInstExe, IDS_APP_TITLE, szTitle, CCHMAX(szTitle));

    wc.style         = CS_HREDRAW | CS_VREDRAW;
    wc.lpfnWndProc   = (WNDPROC)WndProc;
    wc.cbClsExtra    = 0;
    wc.cbWndExtra    = 0;
    wc.hInstance     = g_hInstExe;
    wc.hIcon         = LoadIcon(g_hInstExe, MAKEINTRESOURCE(ICO_MAIN));
    wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
    wc.lpszMenuName  = MAKEINTRESOURCE(IDM_APP);
    wc.lpszClassName = MY_CLASS_NAME;

    // Register the window class and return FALSE if unsuccesful.
    ::RegisterClass(&wc);

    // Create a main window for this application instance.
    g_hwndMain = ::CreateWindow(MY_CLASS_NAME, szTitle, WS_OVERLAPPEDWINDOW,
                                0, 0, 400, 300, NULL, NULL, g_hInstExe, NULL);
    ASSERT(NULL != g_hwndMain);

    g_hMenu = ::GetMenu(g_hwndMain);
    ASSERT(NULL != g_hMenu);

    return (NULL != g_hwndMain && NULL != g_hMenu);
}

LRESULT MsgCmdMain | ( | HWND | hwnd,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 636 of file ui.cpp.

{
    switch (GET_WM_COMMAND_ID(wParam, lParam))
    {
    case IDM_EXIT:
    {
            ::CmdExit();
      break;
    }
    case IDM_VIEW_CLEAR:
    {
            ::UiClearText();
      break;
    }
    case IDM_ABOUT:
    {
            ::CmdAbout();
      break;
    }
    case IDM_REGISTER_LOCAL:
    {
            ::CmdRegisterLocal();
      break;
    }
    case IDM_INVOKE_ALL:
    {
            ::CmdInvokeRemote();
      break;
    }
    }
    return 0L;
}

void ProcessCleanup ( void )

Definition at line 316 of file ui.cpp.

{
    // Release all objects to which this app has a reference
    ::FreeConference();
    ::FreeApplet();
    ::FreeConfMgr();

    // Uninitialize OLE
    ::CoUninitialize();
}

BOOL ProcessStartup | ( | LPSTR | lpszCmd,
 |  | int | nCmdShow
 | ) |  |

Definition at line 262 of file ui.cpp.

{
    ::GetInvokeInfo(&g_InvokeInfo);
    if (g_InvokeInfo.fValid)
    {
        if (::FindWindow(MY_CLASS_NAME, NULL))
        {
            return FALSE;
        }
    }

    ::InitCommonControls();

    HRESULT hr = ::CoInitialize(NULL);
    if (SUCCEEDED(hr))
    {
        if (::InitMainUI())
        {
            if (::CreateMsgWindow())
            {
                if (::CreateUserList())
                {
                    if (::CreateEditWindow())
                    {
                        ASSERT(NULL != g_hwndMain);
                        ::ShowWindow(g_hwndMain, nCmdShow);
                        ::UpdateWindow(g_hwndMain);
                        ::SetFocus(g_hwndEdit);

                        hr = ::InitConfMgr();
                        if (SUCCEEDED(hr))
                        {
                            hr = ::InitApplet();
                            if (SUCCEEDED(hr))
                            {
                                return TRUE;
                            }
                        }
                    }
                }
            }
        }
    }

    return FALSE;
}

LRESULT FAR PASCAL SubClsEdit | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 171 of file ui.cpp.

{
    if ((uMsg == WM_CHAR) && (VK_RETURN == wParam))
    {
        ::UiSendText();
        return 0L;
    }

    return ::CallWindowProc(lpProcEdit, hwnd, uMsg, wParam, lParam);
}

void UiAddMember ( CMember * pMember )

Definition at line 491 of file ui.cpp.

{
    LPTSTR pszName = NULL;
    if (NULL != pMember)
    {
        pszName = pMember->GetName();
    }
    else
    {
        pszName = TEXT("everyone");
    }

    LV_ITEM  lvItem;
    ::ZeroMemory(&lvItem, sizeof(lvItem));
    lvItem.iItem = ListView_GetItemCount(g_hwndUser);
    lvItem.mask = LVIF_PARAM | LVIF_TEXT;
    lvItem.pszText = pszName;
    lvItem.cchTextMax = ::lstrlen(pszName);
    lvItem.lParam = (LPARAM) pMember;
    ListView_InsertItem(g_hwndUser, &lvItem);

    if (NULL != pMember)
    {
        ::UiDisplaySysMsg(TEXT("<joined>"), pszName);
    }
}

void UiClearText ( void )

Definition at line 460 of file ui.cpp.

{
    ListView_DeleteAllItems(g_hwndMsg);
}

void UiDisplayMessage | ( | LPTSTR | pszMsg,
 |  | LPTSTR | pszUser
 | ) |  |

Definition at line 397 of file ui.cpp.

{
    int iItem = 0;
    LV_ITEM  lvItem;
    SYSTEMTIME sysTime;
    TCHAR szTime[MAX_PATH + 1];
  ::ZeroMemory(szTime, (MAX_PATH + 1) * sizeof(TCHAR));

    ::ZeroMemory(&lvItem, sizeof(lvItem));
    lvItem.iItem = 0x0FFFFFFF;
    lvItem.mask = LVIF_PARAM | LVIF_TEXT;
    lvItem.pszText = pszUser;
    lvItem.cchTextMax = ::lstrlen(lvItem.pszText);
    iItem = ListView_InsertItem(g_hwndMsg, &lvItem);

    // print out the time
    ::GetLocalTime(&sysTime);

  _sntprintf(szTime,MAX_PATH, TEXT("%02d:%02d:%02d"), sysTime.wHour, sysTime.wMinute, sysTime.wSecond);
    ListView_SetItemText(g_hwndMsg, iItem, ILV_TIME, szTime);

    // print out the text
    ListView_SetItemText(g_hwndMsg, iItem, ILV_TEXT, pszMsg);
}

void UiDisplayMsg | ( | LPTSTR | pszMsg,
 |  | LPTSTR | pszUser
 | ) |  |

Definition at line 365 of file ui.cpp.

{
    if (NULL == pszUser)
    {
        pszUser = TEXT("");
    }
    ::UiDisplayMessage(pszMsg, pszUser);
}

void UiDisplaySysMsg | ( | LPTSTR | pszMsg,
 |  | LPTSTR | pszUser
 | ) |  |

Definition at line 381 of file ui.cpp.

{
    if (NULL == pszUser)
    {
        pszUser = TEXT("");
    }
    ::UiDisplayMessage(pszMsg, pszUser);
}

CMember * UiGetSelectedMember ( void )

Definition at line 547 of file ui.cpp.

{
    int iItem = ListView_GetNextItem(g_hwndUser, -1, LVNI_ALL | LVNI_SELECTED);
    if (-1 != iItem)
    {
        LV_ITEM lv;
        lv.mask = LVIF_PARAM;
        lv.iItem = iItem;
        ListView_GetItem(g_hwndUser, &lv);
        return (CMember *) lv.lParam;
    }
    return NULL;
}

void UiRemoveMember ( CMember * pMember )

Definition at line 525 of file ui.cpp.

{
    if (NULL != pMember)
    {
        ::UiDisplaySysMsg(TEXT("<left>"), pMember->GetName());
    }

    LV_FINDINFO findInfo;
    ::ZeroMemory(&findInfo, sizeof(findInfo));
    findInfo.flags = LVFI_PARAM;
    findInfo.lParam = (LPARAM) pMember;
    int iItem = ListView_FindItem(g_hwndUser, -1, &findInfo);
    ListView_DeleteItem(g_hwndUser, iItem);
}

void UiSendText ( void )

Definition at line 432 of file ui.cpp.

{
    UINT  cb = 0;
    TCHAR sz[MAX_PATH + 1];

  ::ZeroMemory(sz, (MAX_PATH + 1) * sizeof(TCHAR));

    // Get the text line
    cb = ::SendMessage(g_hwndEdit, WM_GETTEXT, (WPARAM) CCHMAX(sz), (LPARAM) sz);
    ::SendMessage(g_hwndEdit, EM_SETSEL, (WPARAM) 0, (LPARAM)-1);
    ::SendMessage(g_hwndEdit, WM_SETTEXT, (WPARAM) 0, (LPARAM) "");

    if (0 != cb && NULL != g_pSession)
    {
        CMember * pMember = ::UiGetSelectedMember();
        AppletUserID uidReceiver = (NULL != pMember) ? pMember->GetUID() : 0;

        g_pSession->SendData(uidReceiver, ++cb, (LPBYTE) sz);
    }
}

void UiSizeMsgWindow | ( | int | dx,
 |  | int | dy
 | ) |  |

Definition at line 472 of file ui.cpp.

{
    ::MoveWindow(g_hwndEdit, XP_LEFT, dy - DYP_EDIT, dx, DYP_EDIT, TRUE);
    dy -= (YP_TOP + DYP_EDIT);

    ::MoveWindow(g_hwndUser, XP_LEFT, YP_TOP, DXP_USER, dy, TRUE);
    dx -= DXP_USER;

    ::MoveWindow(g_hwndMsg, XP_LEFT + DXP_USER, YP_TOP, dx, dy, TRUE);
}

int APIENTRY WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hInstPrev,
 |  | LPSTR | lpszCmd,
 |  | int | nCmdShow
 | ) |  |

Definition at line 336 of file ui.cpp.

{
    g_hInstExe = hInstance;

    if (::ProcessStartup(lpszCmd, nCmdShow))
    {
        MSG  msg;
        while (::GetMessage(&msg, NULL, 0, 0))
        {
            if (! ::TranslateAccelerator(msg.hwnd, g_hAccelTable, &msg))
            {
                ::TranslateMessage(&msg);
                ::DispatchMessage(&msg);
            }
        }
    }

    ::ProcessCleanup();

    return 0;
}

LRESULT CALLBACK WndProc | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 678 of file ui.cpp.

{
    LRESULT lRet = 0;
    switch (uMsg)
    {
    case WM_COMMAND:
    {
      lRet = ::MsgCmdMain(hwnd, wParam, lParam);
      break;
    }
    case WM_DESTROY:
    {
      ::PostQuitMessage(0);
      break;
    }
    case WM_CLOSE:
    {
            ::CmdExit();
      break;
    }
    case WM_SIZE:
    {
            ::UiSizeMsgWindow(LOWORD(lParam), HIWORD(lParam));
      break;
    }
    case WM_GETMINMAXINFO:
    {
      ((LPMINMAXINFO) lParam)->ptMinTrackSize.x = 325;
      ((LPMINMAXINFO) lParam)->ptMinTrackSize.y = 250;
      break;
    }
    default:
    {
      lRet = ::DefWindowProc(hwnd, uMsg, wParam, lParam);
      break;
    }
    }
    return lRet;
}

Variable Documentation

const int DXP_USER = 80

Definition at line 34 of file ui.cpp.

const int DYP_EDIT = 30

Definition at line 33 of file ui.cpp.

HACCEL g_hAccelTable = NULL

Definition at line 61 of file ui.cpp.

HINSTANCE g_hInstExe = NULL

Definition at line 60 of file ui.cpp.

HMENU g_hMenu = NULL

Definition at line 62 of file ui.cpp.

HWND g_hwndEdit = NULL

Definition at line 65 of file ui.cpp.

HWND g_hwndMain = NULL

Definition at line 63 of file ui.cpp.

HWND g_hwndMsg = NULL

Definition at line 64 of file ui.cpp.

HWND g_hwndUser = NULL

Definition at line 66 of file ui.cpp.

WNDPROC lpProcEdit = NULL

Definition at line 161 of file ui.cpp.

const int XP_LEFT = 0

Definition at line 36 of file ui.cpp.

const int YP_TOP = 3

Definition at line 35 of file ui.cpp.

Generated on Wed Nov 13 2024 16:54:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMFT/CConf.Cpp File Reference

  • Web
  • NetMeeting
  • NMFT
Functions | Variables

CConf.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

BOOL | FInitNm (void)
VOID | FreeFtChannel (void)
VOID | FreeNmObjects (void)
HRESULT | GetActiveConference (void)
HRESULT | GetFtChannel (void)
HRESULT | HookFtChannel (void)
HRESULT | InitConfMgr (void)
HRESULT | SendFile (void)
VOID | UpdateProgress (CONFN uNotify)

Variables

const GUID | g_guidApp
INmChannelFt * | g_pChannelFt = NULL
INmConference * | g_pConference = NULL
INmFt * | g_pFt = NULL
INmMember * | g_pMember = NULL
INmManager * | g_pMgr = NULL
CFtNotify * | g_pNotifyFt = NULL
HWND | ghwndProgress = NULL

Function Documentation

BOOL FInitNm ( void )

Definition at line 511 of file CConf.Cpp.

{
  if (S_OK != InitConfMgr())
    return FALSE;

  if (S_OK != GetActiveConference())
    return FALSE;

  if (S_OK != GetFtChannel())
    return FALSE;

  if (S_OK != HookFtChannel())
    return FALSE;

  return TRUE;
}

VOID FreeFtChannel ( void )

Definition at line 125 of file CConf.Cpp.

{
  if (NULL != g_pFt)
  {
    g_pFt->Release();
    g_pFt = NULL;
  }

  // Release all notify
  if (NULL != g_pNotifyFt)
  {
    g_pNotifyFt->Disconnect();
    g_pNotifyFt->Release();
    g_pNotifyFt = NULL;
  }

  if (NULL != g_pChannelFt)
  {
    g_pChannelFt->Release();
    g_pChannelFt = NULL;
  }
}

VOID FreeNmObjects ( void )

Definition at line 485 of file CConf.Cpp.

{
  FreeFtChannel();

  // Release conference
  if (NULL != g_pConference)
  {
    g_pConference->Release();
    g_pConference = NULL;
  }

  // Release conference manager
  if (NULL != g_pMgr)
  {
    g_pMgr->Release();
    g_pMgr = NULL;
  }
}

HRESULT GetActiveConference ( void )

Definition at line 80 of file CConf.Cpp.

{
  HRESULT         hr  = NO_ERROR  ;
  IEnumNmConference * pEnum = NULL    ;

  if (NULL == g_pMgr)
  {
    return E_FAIL;
  }

  hr = g_pMgr->EnumConference(&pEnum);
  if (SUCCEEDED(hr))
  {
    if  (NULL == pEnum)
      return E_POINTER;

    hr = pEnum->Next(1, &g_pConference, NULL);
    if SUCCEEDED(hr)
    {
      hr  = E_POINTER;
      if  (NULL != g_pConference)
      {
        NM_CONFERENCE_STATE confState;
        hr = g_pConference->GetState(&confState);
        if (SUCCEEDED(hr))
        {
          hr = (NM_CONFERENCE_ACTIVE == confState) ? S_OK : S_FALSE;
        }
      }
    }

    pEnum->Release();
    pEnum = NULL;
  }

  return hr;
}

HRESULT GetFtChannel ( void )

Definition at line 155 of file CConf.Cpp.

{
  HRESULT       hr    = NO_ERROR  ;
  BOOL        fFound  = FALSE   ;
  ULONG       nmch    = 0     ;
  INmChannel    * pChannel  = NULL    ;
  IEnumNmChannel  * pEnum   = NULL    ;

  if (NULL == g_pConference)
  {
    return E_FAIL;
  }

  // TODO: Check if active and in data conference

  hr = g_pConference->EnumChannel(&pEnum);
  if (SUCCEEDED(hr))
  {
    if  (NULL == pEnum)
      return E_FAIL;

    while (SUCCEEDED(hr) && !fFound)
    {
      hr = pEnum->Next(1, &pChannel, NULL);

      if FAILED(hr)
        break;

      if  (NULL == pChannel)
      {
        hr = E_FAIL;
        break;
      }

      hr = pChannel->GetNmch(&nmch);

      if (SUCCEEDED(hr) && (NMCH_FT == nmch))
      {
        hr = pChannel->QueryInterface(IID_INmChannelFt, (PVOID *) &g_pChannelFt);
        fFound = ((S_OK == hr) && (NULL != g_pChannelFt));
      }

      pChannel->Release();
      pChannel = NULL;
    }

    pEnum->Release();
    pEnum = NULL;
  }

  return fFound ? S_OK : hr;
}

HRESULT HookFtChannel ( void )

Definition at line 215 of file CConf.Cpp.

{
  HRESULT     hr    = NO_ERROR  ;
  CFtNotify * pNotify = NULL    ;

  ASSERT(NULL != g_pChannelFt);
  if  (NULL == g_pChannelFt)
    return E_FAIL;

    // Connect to the channel object
    pNotify = new CFtNotify();
    if (pNotify == NULL)
    {
        hr = E_OUTOFMEMORY;
    }
    else
    {
    hr = pNotify->Connect(g_pChannelFt);
    if (SUCCEEDED(hr))
    {
      g_pNotifyFt = pNotify;
    }
    else
    {
      pNotify -> Release();
      pNotify =  NULL;
    }
  }

  if (FAILED(hr))
  {
    FreeFtChannel();
  }

  return hr;
}

HRESULT InitConfMgr ( void )

Definition at line 37 of file CConf.Cpp.

{
  HRESULT     hr  = NULL;
  LPCLASSFACTORY  pcf = NULL;

  // Notify the system we want to use the conferencing services
  // by creating a conference manager object

  hr = CoGetClassObject(CLSID_NmManager, CLSCTX_INPROC, NULL, IID_IClassFactory, (void**)&pcf);

  if (SUCCEEDED(hr))
  {
    if  (NULL == pcf)
      return E_POINTER;

    // Get the conference manager object
    hr = pcf->CreateInstance(NULL, IID_INmManager, (void**)&g_pMgr);
    if (SUCCEEDED(hr))
    {
      hr  = E_POINTER;
      if  (NULL != g_pMgr)
      {
        ULONG uchCaps = NMCH_ALL;
        ULONG uOptions  = 0;

        hr = g_pMgr->Initialize(&uOptions, &uchCaps);
      }
    }

    pcf->Release();
    pcf = NULL;
  }

  return hr;
}

HRESULT SendFile ( void )

Definition at line 259 of file CConf.Cpp.

{
  HRESULT hr  = NO_ERROR;

  if (NULL == g_pChannelFt)
  {
    return E_FAIL;
  }

  BSTRING bstrFile(g_szFile);
  hr = g_pChannelFt->SendFile(&g_pFt, g_pMember, bstrFile, 0);
  return hr;
}

VOID UpdateProgress ( CONFN uNotify )

Definition at line 276 of file CConf.Cpp.

{
  HRESULT hr  = NO_ERROR;

  if ((NULL == g_pFt) || (NULL == ghwndMain))
  {
    return;
  }

  NM_FT_STATE uState;
  hr = g_pFt->GetState(&uState);

  switch (uNotify)
    {
  case CONFN_FT_STARTED:
  {
    TCHAR szMsg[MAX_PATH + 1];

    ZeroMemory(szMsg, MAX_PATH + 1);

    // Fill out "Sending <filename>"

    _sntprintf(szMsg, MAX_PATH, TEXT("Sending %s"), (NULL != g_szFile) ? g_szFile : TEXT("<Null>"));
    SetDlgItemText(ghwndMain, IDE_SEND, szMsg);

    ULONG uBytes  = 0;
    if (FAILED(g_pFt->GetSize(&uBytes)))
      uBytes = 0;

    // Fill out "to <user> (x bytes)"

    SetDlgItemText(ghwndMain, IDE_DEST, szMsg);

    ghwndProgress = GetDlgItem(ghwndMain, IDC_PROGRESS);
    ASSERT(NULL != ghwndProgress);

    SendMessage(ghwndProgress, PBM_SETPOS, 0, 0);
    ShowWindow(ghwndMain, SW_SHOW);
    SetFocus(GetDlgItem(ghwndMain, IDCANCEL));
    break;
  }

  case CONFN_FT_PROGRESS:
  {
    ULONG uPercent    = 0 ;
    ULONG uBytesCurr  = 0 ;
    ULONG uBytesTotal = 0 ;

    if (FAILED(g_pFt->GetBytesTransferred(&uBytesCurr)) ||
      FAILED(g_pFt->GetSize(&uBytesTotal)))
    {
      return;
    }

    if (0 == uBytesTotal)
      uPercent = 100;
    else
      uPercent = uBytesCurr * 100 / uBytesTotal;

    SendMessage(ghwndProgress, PBM_SETPOS, uPercent, 0);
    break;
  }

  case CONFN_FT_COMPLETE:
  case CONFN_FT_CANCELED:
  {
    SetDlgItemText(ghwndMain, IDCANCEL, TEXT("Close"));
    break;
  }

  default:
    return;
    }
}

Variable Documentation

const GUID g_guidApp
Initial value:

{0x3582ded0, 0x9ccf, 0x11d0, { 0x8b, 0x26, 0x0, 0xa0, 0xc9, 0x1b, 0xc9, 0xe} }

Definition at line 27 of file CConf.Cpp.

INmChannelFt* g_pChannelFt = NULL

Definition at line 20 of file CConf.Cpp.

INmConference* g_pConference = NULL

Definition at line 19 of file CConf.Cpp.

INmFt* g_pFt = NULL

Definition at line 23 of file CConf.Cpp.

INmMember* g_pMember = NULL

Definition at line 22 of file CConf.Cpp.

INmManager* g_pMgr = NULL

Definition at line 18 of file CConf.Cpp.

CFtNotify* g_pNotifyFt = NULL

Definition at line 21 of file CConf.Cpp.

HWND ghwndProgress = NULL

Definition at line 274 of file CConf.Cpp.

Generated on Wed Nov 13 2024 16:54:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMFT/CConf.h File Reference

  • Web
  • NetMeeting
  • NMFT
Classes | Functions | Variables

CConf.h File Reference

Go to the source code of this file.

Classes

class | CFtNotify

Functions

BOOL | FInitNm (void)
VOID | FreeNmObjects (void)
HRESULT | SendFile (void)

Variables

INmChannelFt * | g_pChannelFt
INmConference * | g_pConference
INmFt * | g_pFt
INmMember * | g_pMember
INmManager * | g_pMgr
CFtNotify * g_pNotifyFt

Function Documentation

BOOL FInitNm ( void )

Definition at line 511 of file CConf.Cpp.

{
  if (S_OK != InitConfMgr())
    return FALSE;

  if (S_OK != GetActiveConference())
    return FALSE;

  if (S_OK != GetFtChannel())
    return FALSE;

  if (S_OK != HookFtChannel())
    return FALSE;

  return TRUE;
}

VOID FreeNmObjects ( void )

Definition at line 485 of file CConf.Cpp.

{
  FreeFtChannel();

  // Release conference
  if (NULL != g_pConference)
  {
    g_pConference->Release();
    g_pConference = NULL;
  }

  // Release conference manager
  if (NULL != g_pMgr)
  {
    g_pMgr->Release();
    g_pMgr = NULL;
  }
}

HRESULT SendFile ( void )

Definition at line 259 of file CConf.Cpp.

{
  HRESULT hr  = NO_ERROR;

  if (NULL == g_pChannelFt)
  {
    return E_FAIL;
  }

  BSTRING bstrFile(g_szFile);
  hr = g_pChannelFt->SendFile(&g_pFt, g_pMember, bstrFile, 0);
  return hr;
}

Variable Documentation

INmChannelFt* g_pChannelFt

Definition at line 20 of file CConf.Cpp.

INmConference* g_pConference

Definition at line 20 of file CConf.Cpp.

INmFt* g_pFt

Definition at line 23 of file CConf.Cpp.

INmMember* g_pMember

Definition at line 22 of file CConf.Cpp.

INmManager* g_pMgr

Definition at line 18 of file CConf.Cpp.

CFtNotify* g_pNotifyFt

Definition at line 21 of file CConf.Cpp.

Generated on Wed Nov 13 2024 16:54:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMFT/clUtil.Cpp File Reference

  • Web
  • NetMeeting
  • NMFT
Functions

clUtil.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

POSITION | AddNode (PVOID pv, COBLIST **ppList)
LPTSTR | PszFromBstr (BSTR bstr)
PVOID | RemoveNode (POSITION *pPos, COBLIST *pList)

Function Documentation

POSITION AddNode | ( | PVOID | pv,
 |  | COBLIST ** | ppList
 | ) |  |

Definition at line 505 of file clUtil.Cpp.

{
  ASSERT(NULL != ppList);
  if  (NULL == ppList)
    return NULL;

  if (NULL == *ppList)
  {
    *ppList = new COBLIST();
    if (NULL == *ppList)
      return NULL;
  }

  return (*ppList)->AddTail(pv);
}

LPTSTR PszFromBstr ( BSTR bstr )

Definition at line 625 of file clUtil.Cpp.

{
  if (NULL == bstr)
    return NULL;
  int cch =  WideCharToMultiByte(CP_ACP, 0, (LPWSTR)bstr, -1, NULL, 0, NULL, NULL);
  if (cch <= 0)
    return NULL;

  LPTSTR psz = PszAlloc(cch);
  if (NULL == psz)
    return NULL;

  ZeroMemory(bstr, (cch + 1) * sizeof(TCHAR));

  WideCharToMultiByte(CP_ACP, 0, (LPWSTR)bstr, -1, psz, cch, NULL, NULL);
  return psz;
}

PVOID RemoveNode | ( | POSITION * | pPos,
 |  | COBLIST * | pList
 | ) |  |

Definition at line 531 of file clUtil.Cpp.

{
  if ((NULL == pList) || (NULL == pPos))
    return NULL;

  PVOID pv = pList->RemoveAt(*pPos);
  *pPos = NULL;
  return pv;
}

Generated on Wed Nov 13 2024 16:54:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMFT/clUtil.h File Reference

  • Web
  • NetMeeting
  • NMFT
Classes | Defines | Functions

clUtil.h File Reference

Go to the source code of this file.

Classes

class | BSTRING
class | BTSTR
class | CNotify
class | COBLIST
struct | COBNODE
class | RefCount

Defines

#define | POSITION COBNODE*

Functions

POSITION | AddNode (PVOID pv, COBLIST **ppList)
LPTSTR | PszFromBstr (BSTR bst)
PVOID | RemoveNode (POSITION *pPos, COBLIST *pList)

Define Documentation

#define POSITION COBNODE*

Definition at line 77 of file clUtil.h.

Function Documentation

POSITION AddNode | ( | PVOID | pv,
 |  | COBLIST ** | ppList
 | ) |  |

Definition at line 497 of file clUtil.Cpp.

{
  ASSERT(NULL != ppList);
  if(NULL == ppList)
  {
    return NULL;
  }

  if (NULL == *ppList)
  {
    *ppList = new COBLIST();
    if (NULL == *ppList)
    {
      return NULL;
    }
  }

  return (*ppList)->AddTail(pv);
}

LPTSTR PszFromBstr ( BSTR bst )

Definition at line 627 of file clUtil.Cpp.

{
  if (NULL == bstr)
  {
    return NULL;
  }
  int cch =  WideCharToMultiByte(CP_ACP, 0, (LPWSTR)bstr, -1, NULL, 0, NULL, NULL);
  if (cch <= 0)
  {
    return NULL;
  }

  LPTSTR psz = PszAlloc(cch);
  if (NULL == psz)
  {
    return NULL;
  }

  ZeroMemory(psz, sizeof(TCHAR) * (cch + 1));

  WideCharToMultiByte(CP_ACP, 0, (LPWSTR)bstr, -1, psz, cch, NULL, NULL);
  return psz;
}

PVOID RemoveNode | ( | POSITION * | pPos,
 |  | COBLIST * | pList
 | ) |  |

Definition at line 527 of file clUtil.Cpp.

{
  if ((NULL == pList) || (NULL == pPos))
  {
    return NULL;
  }

  PVOID pv = pList->RemoveAt(*pPos);
  *pPos = NULL;
  return pv;
}

Generated on Wed Nov 13 2024 16:54:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMFT/Debug.Cpp File Reference

  • Web
  • NetMeeting
  • NMFT

Debug.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMFT/Global.h File Reference

  • Web
  • NetMeeting
  • NMFT
Defines | Functions | Variables

Global.h File Reference

Go to the source code of this file.

Defines

#define | ASSERT(f)
#define | AssertSz(f, sz)
#define | NotReached()

Functions

VOID | CmdClose (void)
BOOL | FFileExists (LPCTSTR szFile)
BOOL FGetFileName (LPTSTR szFileName)
VOID | FreePlpv (LPVOID plpv)
LPVOID | LpvAlloc (int cb)
LPTSTR | PszAlloc (int cch)
LPCTSTR | StrChr (LPCTSTR pcsz, TCHAR ch)
LRESULT CALLBACK | WndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)

Variables

BOOL g_fQuiet
const GUID | g_guidApp
TCHAR | g_szFile [MAX_PATH+1]
HINSTANCE | ghInst
HWND | ghwndMain

Define Documentation

#define ASSERT ( f )

Definition at line 33 of file Global.h.

#define AssertSz | ( | f,
 |  | sz
 | ) |

Definition at line 34 of file Global.h.

#define NotReached ( )

Definition at line 35 of file Global.h.

Function Documentation

VOID CmdClose ( void )

Definition at line 28 of file Msg.Cpp.

{
  DestroyWindow(ghwndMain);
}

BOOL FFileExists ( LPCTSTR szFile )

Definition at line 60 of file Util.Cpp.

{
  HANDLE hFile  = 0;

  if ((NULL == szFile) || (_T('\0') == *szFile))
    return FALSE;

  UINT uErrorMode = SetErrorMode(SEM_NOOPENFILEERRORBOX | SEM_FAILCRITICALERRORS);
  hFile = CreateFile(szFile, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
    NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
  SetErrorMode(uErrorMode); // Restore error mode

  if (hFile == INVALID_HANDLE_VALUE)
    return FALSE;

  CloseHandle(hFile);
  return TRUE;
}

BOOL FGetFileName ( LPTSTR szFileName )

Definition at line 28 of file Util.Cpp.

{
  OPENFILENAME ofn;

  if  (NULL == szFileName)
    return FALSE;

  szFileName[0] = 0;

  ZeroMemory(&ofn, sizeof(OPENFILENAME));

  ofn.lStructSize   = sizeof(OPENFILENAME);
  ofn.hwndOwner     = ghwndMain;
  ofn.hInstance     = (HINSTANCE) ghInst;
  ofn.lpstrFilter   = _szFilter;
  ofn.nFilterIndex  = 1L;
  ofn.lpstrFile     = szFileName;
  ofn.nMaxFile      = MAX_PATH; // really max characters for szFileName
  ofn.lpstrTitle    = _szPickMsg;
  ofn.lpstrInitialDir = NULL;
  ofn.Flags = OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_EXPLORER;

  return GetOpenFileName(&ofn);
}

VOID FreePlpv ( LPVOID plpv )

Definition at line 167 of file Util.Cpp.

{
  if ((plpv == NULL) || (*(VOID FAR * FAR *)plpv == NULL))
  {
    return;
  }

  LocalFree(*(VOID FAR * FAR *)plpv);
  *(VOID FAR * FAR *)plpv = NULL;
}

LPVOID LpvAlloc ( int cb )

Definition at line 141 of file Util.Cpp.

{
  return LocalAlloc(LMEM_FIXED, cb);
}

LPTSTR PszAlloc ( int cch )

Definition at line 153 of file Util.Cpp.

{
  return (LPTSTR) LocalAlloc(LMEM_FIXED, sizeof(TCHAR) * (cch+1));
}

LPCTSTR StrChr | ( | LPCTSTR | pcsz,
 |  | TCHAR | ch
 | ) |  |

Definition at line 131 of file Util.Cpp.

{
    LPCTSTR pcszFound = NULL;

    if (pcsz)
    {
        while (*pcsz)
        {
            if (*pcsz == ch)
            {
                pcszFound = pcsz;
                break;
            }

            pcsz = CharNext(pcsz);
        }
    }

    return pcszFound;
}

LRESULT CALLBACK WndProc | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 290 of file Generic.C.

{
   int wmId, wmEvent;
   PAINTSTRUCT ps;
   HDC hdc;
      POINT pnt;
   HMENU hMenu;
      BOOL bGotHelp;

   switch (message) {

      case WM_COMMAND:
         wmId    = LOWORD(wParam); // Remember, these are...
         wmEvent = HIWORD(wParam); // ...different for Win32!

         //Parse the menu selections:
         switch (wmId) {

            case IDM_ABOUT:
               DialogBox(hInst, "AboutBox", hWnd, (DLGPROC)About);
               break;

            case IDM_EXIT:
               DestroyWindow (hWnd);
               break;

            case IDM_HELPTOPICS: // Only called in Windows 95
               bGotHelp = WinHelp (hWnd, APPNAME".HLP", HELP_FINDER,(DWORD)0);
               if (!bGotHelp)
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            case IDM_HELPCONTENTS: // Not called in Windows 95
               bGotHelp = WinHelp (hWnd, APPNAME".HLP", HELP_CONTENTS,(DWORD)0);
               if (!bGotHelp)
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            case IDM_HELPSEARCH: // Not called in Windows 95
               if (!WinHelp(hWnd, APPNAME".HLP", HELP_PARTIALKEY,
                           (ULONG_PTR)(LPSTR)""))
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            case IDM_HELPHELP: // Not called in Windows 95
               if(!WinHelp(hWnd, (LPSTR)NULL, HELP_HELPONHELP, 0))
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            // Here are all the other possible menu options,
            // all of these are currently disabled:
            case IDM_NEW:
            case IDM_OPEN:
            case IDM_SAVE:
            case IDM_SAVEAS:
            case IDM_UNDO:
            case IDM_CUT:
            case IDM_COPY:
            case IDM_PASTE:
            case IDM_LINK:
            case IDM_LINKS:

            default:
               return (DefWindowProc(hWnd, message, wParam, lParam));
         }
         break;

      case WM_NCRBUTTONUP: // RightClick on windows non-client area...
         if (IS_WIN95 && SendMessage(hWnd, WM_NCHITTEST, 0, lParam) == HTSYSMENU)
         {
            // The user has clicked the right button on the applications
            // 'System Menu'. Here is where you would alter the default
            // system menu to reflect your application. Notice how the
            // explorer deals with this. For this app, we aren't doing
            // anything
            return (DefWindowProc(hWnd, message, wParam, lParam));
         } else {
            // Nothing we are interested in, allow default handling...
            return (DefWindowProc(hWnd, message, wParam, lParam));
         }
            break;

        case WM_RBUTTONDOWN: // RightClick in windows client area...
            pnt.x = LOWORD(lParam);
            pnt.y = HIWORD(lParam);
            ClientToScreen(hWnd, (LPPOINT) &pnt);
      // This is where you would determine the appropriate 'context'
      // menu to bring up. Since this app has no real functionality,
      // we will just bring up the 'Help' menu:
            hMenu = GetSubMenu (GetMenu (hWnd), 2);
            if (hMenu) {
                TrackPopupMenu (hMenu, 0, pnt.x, pnt.y, 0, hWnd, NULL);
            } else {
            // Couldn't find the menu...
                MessageBeep(0);
            }
            break;

      case WM_DISPLAYCHANGE: // Only comes through on plug'n'play systems
      {
         SIZE  szScreen;
         DWORD dwBitsPerPixel = (DWORD)wParam;

         szScreen.cx = LOWORD(lParam);
         szScreen.cy = HIWORD(lParam);

         MessageBox (GetFocus(), GetStringRes(IDS_DISPLAYCHANGED),
                     szAppName, 0);
      }
      break;

      case WM_PAINT:
         hdc = BeginPaint (hWnd, &ps);
         // Add any drawing code here...
         EndPaint (hWnd, &ps);
         break;

      case WM_DESTROY:
         // Tell WinHelp we don't need it any more...
               WinHelp (hWnd, APPNAME".HLP", HELP_QUIT,(DWORD)0);
         PostQuitMessage(0);
         break;

      default:
         return (DefWindowProc(hWnd, message, wParam, lParam));
   }
   return (0);
}

Variable Documentation

BOOL g_fQuiet

Definition at line 26 of file Main.Cpp.

const GUID g_guidApp

Definition at line 25 of file CConf.Cpp.

TCHAR g_szFile[MAX_PATH+1]

Definition at line 27 of file Main.Cpp.

HINSTANCE ghInst

Name of app.

Definition at line 24 of file ole2ui.c.

HWND ghwndMain

Definition at line 447 of file MfEdit.h.

Generated on Wed Nov 13 2024 16:53:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMFT/IMSConf2.Idl File Reference

  • Web
  • NetMeeting
  • NMFT
Functions | Variables

IMSConf2.Idl File Reference

Go to the source code of this file.

Functions

cpp_quote ("//+-------------------------------------------------------------------------") cpp_quote(" cpp_quote("cpp_quote(" cpp_quote("cpp_quote(" cpp_quote("cpp_quote(" import "objidl.idl"
cpp_quote ("") cpp_quote(" cpp_quote("cpp_quote(" cpp_quote("") cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("") cpp_quote(" cpp_quote("cpp_quote("cpp_quote("cpp_quote(" cpp_quote("") cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("") cpp_quote(" cpp_quote("cpp_quote("") cpp_quote(" cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote(" cpp_quote("") cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("") cpp_quote("") cpp_quote(" cpp_quote("cpp_quote("cpp_quote("cpp_quote("") cpp_quote("") cpp_quote(" cpp_quote("cpp_quote("") cpp_quote("cpp_quote("") cpp_quote("enum

Variables

import oleidl idl

Function Documentation

cpp_quote ( "//+-------------------------------------------------------------------------" )
cpp_quote ( "" )

Definition at line 57 of file IMSConf2.Idl.

Variable Documentation

import oaidl idl

Definition at line 25 of file IMSConf2.Idl.

Generated on Wed Nov 13 2024 16:54:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMFT/Main.Cpp File Reference

  • Web
  • NetMeeting
  • NMFT
Functions | Variables

Main.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

BOOL | FInitMain (void)
BOOL | FVerifyFile (void)
int __cdecl | main ()
BOOL | ParseCmdLine (void)

Variables

BOOL | g_fQuiet = FALSE
CONST TCHAR | g_szAppClassName [] = TEXT("NMFT Dialog")
TCHAR | g_szFile [MAX_PATH+1]
HINSTANCE | ghInst = NULL
HWND | ghwndMain = NULL

Function Documentation

BOOL FInitMain ( void )

Definition at line 166 of file Main.Cpp.

{
  TCHAR szTitle[MAX_PATH + 1];
  WNDCLASS  wc;

  ZeroMemory(szTitle, sizeof(TCHAR) * (MAX_PATH + 1));
  ZeroMemory(&wc, sizeof(WNDCLASS));

  ASSERT(NULL != ghInst);

  LoadString(ghInst, IDS_APP_TITLE, szTitle, MAX_PATH);

  ZeroMemory(&wc, sizeof(WNDCLASS));

  wc.style         = CS_HREDRAW | CS_VREDRAW;
  wc.lpfnWndProc   = (WNDPROC)WndProc;
  wc.cbClsExtra    = 0;
  wc.cbWndExtra    = DLGWINDOWEXTRA;
  wc.hInstance     = ghInst;
  wc.hIcon         = LoadIcon(ghInst, MAKEINTRESOURCE(ICO_MAIN));
  wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
  wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
  wc.lpszMenuName  = MAKEINTRESOURCE(IDM_APP);
  wc.lpszClassName = g_szAppClassName;

  // Register the window class and return FALSE if unsuccesful.
  if (!RegisterClass(&wc))
    return FALSE;

  ghwndMain = CreateDialog(ghInst, MAKEINTRESOURCE(IDD_PROGRESS), 0, NULL);

  if (NULL == ghwndMain)
    return FALSE;

  if (!FInitNm())
  {
    // TODO: Display error message
    // Unable to initialize, no conference, etc.
    return FALSE;
  }

  if (!FVerifyFile())
    return FALSE;

  LPTSTR pszFile  = 0;
  GetFullPathName(g_szFile, MAX_PATH, g_szFile, &pszFile);

  if (!FFileExists(g_szFile))
  {
    TCHAR szMsg[2 * MAX_PATH + 1];

    ZeroMemory(szMsg, (2 * MAX_PATH + 1) * sizeof(TCHAR));

    _sntprintf(szMsg, 2 * MAX_PATH, TEXT("Unable to send the file\r\n%s"), g_szFile);
    MessageBox(NULL, szMsg, TEXT("NmFt Error"), MB_OK | MB_ICONSTOP);
    return FALSE;
  }

  if (FAILED(SendFile()))
    return FALSE;

  return TRUE;
}

BOOL FVerifyFile ( void )

Definition at line 146 of file Main.Cpp.

{
  // Check if filename was specified on command line
  if (ParseCmdLine())
    return TRUE;

  // Prompt the user to select a file
  if (FGetFileName(g_szFile))
    return TRUE;

  return FALSE;
}

int __cdecl main ( void )

Definition at line 242 of file Main.Cpp.

{
#ifdef _DEBUG
  ghInst = hInstance;
#else
  ghInst = ::GetModuleHandle(NULL);
#endif // ! _DEBUG

  ZeroMemory(g_szFile, sizeof(TCHAR) * (MAX_PATH + 1));

  InitCommonControls();

  if (FAILED(CoInitialize(NULL)))
    return 0;

  if (FInitMain() && !g_fQuiet)
  {
    MSG  msg;
    while (GetMessage(&msg, NULL, 0, 0))
    {
      TranslateMessage(&msg);
      DispatchMessage(&msg);
    }
  }

  FreeNmObjects();
    CoUninitialize();

#ifndef DEBUG
  ExitProcess(0);
#endif

  return 0;
}

BOOL ParseCmdLine ( void )

Definition at line 38 of file Main.Cpp.

{
  LPTSTR pch = ::GetCommandLine();
  if (NULL == pch)
    return FALSE;

  // Work on a copy of the buffer
  TCHAR sz[MAX_PATH*2 + 1];

  ZeroMemory(sz, MAX_PATH*2 + 1);

  lstrcpyn(sz, pch, MAX_PATH*2 + 1);
  sz[MAX_PATH*2] = 0;

  pch = sz;

  BOOL  fInStr  = FALSE;
  BOOL  fInName = FALSE;
  BOOL  fInApp  = TRUE;
  TCHAR ch    = 0;
  LPTSTR  lpsz  = NULL;

  // walk through the command line, parsing filenames and options
  while (_T('\0') != (ch = *pch))
  {
    switch (ch)
    {
    case _T('\"'):      // Double quoted filename
      fInStr = !fInStr;
      if (fInStr)
      {
        lpsz = CharNext(pch);
        break;
      }

    case _T(' '):       // Space usually terminates a filename
      if (fInStr)  // except in a long filename
        break;

    case _T('\0'):
      if (fInApp)
      {
        // Skip the application name (first string on command line)
        fInApp = FALSE;
        fInName = FALSE;
        lpsz = CharNext(pch);
        break;
      }

      if (!fInName)
      {
        lpsz = CharNext(pch);
        break; // ignore extra whitespace
      }

      {
        LPTSTR pchT = CharNext(pch);
        *pch = _T('\0'); // null terminate string
        fInName = FALSE;
        pch = pchT;
        continue; // continue loop
      }
      break;

    case _T('/'):      // Command line option
    {
      if (fInName || fInStr)
        break;

      pch = CharNext(pch);
      ch = *pch;
      if (_T('\0') == ch)
        return FALSE;

      if ((_T('Q') == ch) || (_T('q') == ch))
      {
        g_fQuiet = TRUE;
      }
      // TODO: other options

      break;
    }

    default:        // Normal character
      fInName = TRUE;
      break;
    } /* switch (ch) */

    pch = CharNext(pch);
  }

  if ((NULL == lpsz) || (_T('\0') == *lpsz))
    return FALSE;

  ZeroMemory(g_szFile, MAX_PATH + 1);
  lstrcpyn(g_szFile, lpsz, MAX_PATH + 1);
  g_szFile[MAX_PATH] = 0;

  return TRUE;
}

Variable Documentation

BOOL g_fQuiet = FALSE

Definition at line 26 of file Main.Cpp.

CONST TCHAR g_szAppClassName[] = TEXT("NMFT Dialog")

Definition at line 29 of file Main.Cpp.

TCHAR g_szFile[MAX_PATH+1]

Definition at line 27 of file Main.Cpp.

HINSTANCE ghInst = NULL

Name of app.

Definition at line 24 of file Main.Cpp.

HWND ghwndMain = NULL

Definition at line 25 of file Main.Cpp.

Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMFT/Msg.Cpp File Reference

  • Web
  • NetMeeting
  • NMFT
Classes | Typedefs | Functions

Msg.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Classes

struct | _MSD

Typedefs

typedef MSD * | LPMSD
typedef struct _MSD | MSD
typedef LRESULT(* | PFNMSG )(HWND, UINT, WPARAM, LPARAM)

Functions

VOID | CmdClose (void)
LRESULT | MsgClose (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT | MsgCmdMain (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT | MsgDestroy (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT CALLBACK | WndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)

Typedef Documentation

typedef MSD* LPMSD

Definition at line 25 of file Msg.Cpp.

typedef struct _MSD MSD
typedef LRESULT(* PFNMSG)(HWND, UINT, WPARAM, LPARAM)

Definition at line 17 of file Msg.Cpp.

Function Documentation

VOID CmdClose ( void )

Definition at line 28 of file Msg.Cpp.

{
  DestroyWindow(ghwndMain);
}

LRESULT MsgClose | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 57 of file Msg.Cpp.

{
  CmdClose();
  return 0;
}

LRESULT MsgCmdMain | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 70 of file Msg.Cpp.

{
  WORD wCmd = GET_WM_COMMAND_ID(wParam, lParam);
  switch (wCmd)
    {
  case IDCANCEL:
  {
    if (NULL != g_pFt)
    {
      g_pFt->Cancel();
      CmdClose();
    }
    break;
  }

  default:
    break;
    } /* switch wCmd */

  return 0L;
}

LRESULT MsgDestroy | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 42 of file Msg.Cpp.

{
  PostQuitMessage(0);
  return 0;
}

LRESULT CALLBACK WndProc | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 112 of file Msg.Cpp.

{
  for (LPMSD lpmsd = _rgmsdMain; 0 != lpmsd->uMsg; lpmsd++)
  {
    if (lpmsd->uMsg == uMsg)
    {
      return lpmsd->pfnmsg(hwnd, uMsg, wParam, lParam);
    }
  }

  return DefWindowProc(hwnd, uMsg, wParam, lParam);
}

Generated on Wed Nov 13 2024 16:54:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMFT/PreComp.h File Reference

  • Web
  • NetMeeting
  • NMFT

PreComp.h File Reference

#include <windows.h>
#include <windowsx.h>
#include <commctrl.h>
#include <tchar.h>
#include <ocidl.h>
#include <stdio.h>
#include "imsconf2.h"
#include "global.h"
#include "clUtil.h"
#include "cConf.h"
#include "resource.h"
#include "global.h"
#include "clUtil.h"
#include "cConf.h"
#include "resource.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMFT/Resource.h File Reference

  • Web
  • NetMeeting
  • NMFT
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | ICO_MAIN 101
#define | ID_APPACCEL 105
#define | IDC_PROGRESS 1030
#define | IDD_PROGRESS 124
#define | IDE_DEST 1029
#define | IDE_SEND 1028
#define | IDM_APP 104
#define | IDS_APP_TITLE 1
#define | IDS_VERSION 2

Define Documentation

#define ICO_MAIN 101

Definition at line 7 of file Resource.h.

#define ID_APPACCEL 105

Definition at line 9 of file Resource.h.

#define IDC_PROGRESS 1030

Definition at line 13 of file Resource.h.

#define IDD_PROGRESS 124

Definition at line 10 of file Resource.h.

#define IDE_DEST 1029

Definition at line 12 of file Resource.h.

#define IDE_SEND 1028

Definition at line 11 of file Resource.h.

#define IDM_APP 104

Definition at line 8 of file Resource.h.

#define IDS_APP_TITLE 1

Definition at line 5 of file Resource.h.

#define IDS_VERSION 2

Definition at line 6 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMFT/Util.Cpp File Reference

  • Web
  • NetMeeting
  • NMFT
Functions

Util.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

BOOL | FFileExists (LPCTSTR szFile)
BOOL FGetFileName (LPTSTR szFileName)
VOID | FreePlpv (LPVOID plpv)
LPVOID | LpvAlloc (int cb)
LPTSTR | PszAlloc (int cch)
LPCTSTR | StrChr (LPCTSTR pcsz, TCHAR ch)

Function Documentation

BOOL FFileExists ( LPCTSTR szFile )

Definition at line 60 of file Util.Cpp.

{
  HANDLE hFile  = 0;

  if ((NULL == szFile) || (_T('\0') == *szFile))
    return FALSE;

  UINT uErrorMode = SetErrorMode(SEM_NOOPENFILEERRORBOX | SEM_FAILCRITICALERRORS);
  hFile = CreateFile(szFile, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
    NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
  SetErrorMode(uErrorMode); // Restore error mode

  if (hFile == INVALID_HANDLE_VALUE)
    return FALSE;

  CloseHandle(hFile);
  return TRUE;
}

BOOL FGetFileName ( LPTSTR szFileName )

Definition at line 28 of file Util.Cpp.

{
  OPENFILENAME ofn;

  if  (NULL == szFileName)
    return FALSE;

  szFileName[0] = 0;

  ZeroMemory(&ofn, sizeof(OPENFILENAME));

  ofn.lStructSize   = sizeof(OPENFILENAME);
  ofn.hwndOwner     = ghwndMain;
  ofn.hInstance     = (HINSTANCE) ghInst;
  ofn.lpstrFilter   = _szFilter;
  ofn.nFilterIndex  = 1L;
  ofn.lpstrFile     = szFileName;
  ofn.nMaxFile      = MAX_PATH; // really max characters for szFileName
  ofn.lpstrTitle    = _szPickMsg;
  ofn.lpstrInitialDir = NULL;
  ofn.Flags = OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_EXPLORER;

  return GetOpenFileName(&ofn);
}

VOID FreePlpv ( LPVOID plpv )

Definition at line 114 of file Util.Cpp.

{
  if ((plpv == NULL) || (*(VOID FAR * FAR *)plpv == NULL)) {
    return;
  }

  LocalFree(*(VOID FAR * FAR *)plpv);
  *(VOID FAR * FAR *)plpv = NULL;
}

LPVOID LpvAlloc ( int cb )

Definition at line 88 of file Util.Cpp.

{
  return LocalAlloc(LMEM_FIXED, cb);
}

LPTSTR PszAlloc ( int cch )

Definition at line 100 of file Util.Cpp.

{
  return (LPTSTR) LocalAlloc(LMEM_FIXED, sizeof(TCHAR) * (cch+1));
}

LPCTSTR StrChr | ( | LPCTSTR | pcsz,
 |  | TCHAR | ch
 | ) |  |

Definition at line 131 of file Util.Cpp.

{
    LPCTSTR pcszFound = NULL;

    if (pcsz)
    {
        while (*pcsz)
        {
            if (*pcsz == ch)
            {
                pcszFound = pcsz;
                break;
            }

            pcsz = CharNext(pcsz);
        }
    }

    return pcszFound;
}

Generated on Wed Nov 13 2024 16:53:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMShare/CConf.Cpp File Reference

  • Web
  • NetMeeting
  • NMShare
Functions | Variables

CConf.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

VOID | FreeConference (void)
VOID | FreeConfMgr (void)
HRESULT | HookConference (INmConference *pConference)
HRESULT | InitConfMgr (void)

Variables

const GUID | g_guidApp
INmConference * | g_pConference = NULL
CConfNotify * | g_pConferenceNotify = NULL
INmManager * | g_pMgr = NULL
CMgrNotify * | g_pMgrNotify = NULL

Function Documentation

VOID FreeConference ( void )

Definition at line 104 of file CConf.Cpp.

{
  if (NULL != g_pConferenceNotify)
  {
    g_pConferenceNotify->Disconnect();
    g_pConferenceNotify->Release();
    g_pConferenceNotify = NULL;
  }

  if (NULL != g_pConference)
  {
    g_pConference->Release();
    g_pConference = NULL;
  }
}

VOID FreeConfMgr ( void )

Definition at line 79 of file CConf.Cpp.

{
  // Release conference manager notify
  if (NULL != g_pMgrNotify)
  {
    g_pMgrNotify->Disconnect();
    g_pMgrNotify->Release();
    g_pMgrNotify = NULL;
  }

  // Release conference manager
  if (NULL != g_pMgr)
  {
    g_pMgr->Release();
    g_pMgr = NULL;
  }
}

HRESULT HookConference ( INmConference * pConference )

Definition at line 253 of file CConf.Cpp.

{
  if (NULL == pConference)
  {
    return E_POINTER;
  }

  HRESULT hr = S_OK;

  ASSERT(NULL != pConference);
  ASSERT(NULL == g_pConference);
  g_pConference = pConference;

  pConference->AddRef();

    // Connect to the conference object
    ASSERT(NULL == g_pConferenceNotify)
    g_pConferenceNotify = new CConfNotify();
    if (NULL == g_pConferenceNotify)
    {
        hr = E_OUTOFMEMORY;
    }
    else
    {
    hr = g_pConferenceNotify->Connect(pConference);
    if (FAILED(hr))
    {
      g_pConferenceNotify->Release();
      g_pConferenceNotify = NULL;
    }
  }

  return hr;
}

HRESULT InitConfMgr ( void )

Definition at line 33 of file CConf.Cpp.

{
  HRESULT hr;
  LPCLASSFACTORY pcf;

    // Notify the system we want to use the conferencing services
    // by creating a conference manager object
    hr = CoGetClassObject(CLSID_NmManager,
                          CLSCTX_INPROC,
                          NULL,
                          IID_IClassFactory,
                          (void**)&pcf);
    if (SUCCEEDED(hr))
    {
        // Get the conference manager object
        hr = pcf->CreateInstance(NULL, IID_INmManager, (void**)&g_pMgr);
      if (SUCCEEDED(hr))
        {
            // Connect to the conference manager object
            g_pMgrNotify = new CMgrNotify();
            if (NULL != g_pMgrNotify)
            {
                hr = g_pMgrNotify->Connect(g_pMgr);
          if (SUCCEEDED(hr))
                {
                  ULONG uchCaps = NMCH_ALL;
                  ULONG uOptions = 0;
          hr = g_pMgr->Initialize(&uOptions, &uchCaps);
          //*** Do we need to verify that it initialized properly? ***
        }
            }
        }

        pcf->Release();
    }

  return hr;
}

Variable Documentation

const GUID g_guidApp
Initial value:

{ 0xd29a8c52, 0x774f, 0x11d0, { 0x8b, 0x1d, 0x0, 0xa0, 0xc9, 0x1b, 0xc9, 0xe} }

Definition at line 24 of file CConf.Cpp.

INmConference* g_pConference = NULL

Definition at line 20 of file CConf.Cpp.

CConfNotify* g_pConferenceNotify = NULL

Definition at line 21 of file CConf.Cpp.

INmManager* g_pMgr = NULL

Definition at line 18 of file CConf.Cpp.

CMgrNotify* g_pMgrNotify = NULL

Definition at line 19 of file CConf.Cpp.

Generated on Wed Nov 13 2024 16:54:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMShare/CConf.h File Reference

  • Web
  • NetMeeting
  • NMShare
Classes | Functions | Variables

CConf.h File Reference

Go to the source code of this file.

Classes

class | CConfNotify
class | CMgrNotify

Functions

VOID | FreeConference (void)
VOID | FreeConfMgr (void)
HRESULT | HookConference (INmConference *pConference)
HRESULT | InitConfMgr (void)

Variables

INmConference * | g_pConference
INmManager * | g_pMgr

Function Documentation

VOID FreeConference ( void )

Definition at line 189 of file CConf.Cpp.

{
  if (NULL != g_pConferenceNotify)
  {
    g_pConferenceNotify->Disconnect();
    g_pConferenceNotify->Release();
    g_pConferenceNotify = NULL;
  }

  if (NULL != g_pConference)
  {
    g_pConference->Release();
    g_pConference = NULL;
  }
}

VOID FreeConfMgr ( void )

Definition at line 164 of file CConf.Cpp.

{
  // Release conference manager notify
  if (NULL != g_pMgrNotify)
  {
    g_pMgrNotify->Disconnect();
    g_pMgrNotify->Release();
    g_pMgrNotify = NULL;
  }

  // Release conference manager
  if (NULL != g_pMgr)
  {
    g_pMgr->Release();
    g_pMgr = NULL;
  }
}

HRESULT HookConference ( INmConference * pConference )

Definition at line 259 of file CConf.Cpp.

{
  HRESULT hr = NO_ERROR;

  ASSERT(NULL != pConference);
  ASSERT(NULL == g_pConference);

  if(NULL == pConference)
  {
    return E_POINTER;
  }

  if(NULL != g_pConference)
  {
    return E_POINTER;
  }

  g_pConference = pConference;

  pConference->AddRef();

    // Connect to the conference object
    ASSERT(NULL == g_pConferenceNotify)
    g_pConferenceNotify = new CConfNotify();
    if (NULL == g_pConferenceNotify)
    {
        hr = E_OUTOFMEMORY;
    }
    else
    {
    hr = g_pConferenceNotify->Connect(pConference);
    if (FAILED(hr))
    {
      g_pConferenceNotify->Release();
      g_pConferenceNotify = NULL;
    }
  }

  return hr;
}

HRESULT InitConfMgr ( void )

Definition at line 115 of file CConf.Cpp.

{
  HRESULT hr      = NO_ERROR;
  LPCLASSFACTORY pcf  = NULL;

    // Notify the system we want to use the conferencing services
    // by creating a conference manager object
    hr = CoGetClassObject(CLSID_NmManager,
                          CLSCTX_INPROC,
                          NULL,
                          IID_IClassFactory,
                          (void**)&pcf);
    if (SUCCEEDED(hr))
    {
        // Get the conference manager object
        hr = pcf->CreateInstance(NULL, IID_INmManager, (void**)&g_pMgr);
      if (SUCCEEDED(hr))
        {
            // Connect to the conference manager object
            g_pMgrNotify = new CMgrNotify();
            if (NULL != g_pMgrNotify)
            {
                hr = g_pMgrNotify->Connect(g_pMgr);
          if (SUCCEEDED(hr))
                {
                  ULONG uchCaps = NMCH_ALL;
                  ULONG uOptions = 0;
          hr = g_pMgr->Initialize(&uOptions, &uchCaps);
          if(FAILED(hr))
          {
            return hr;
          }
        }
            }
        }

        pcf->Release();
    }

  return hr;
}

Variable Documentation

INmConference* g_pConference

Definition at line 20 of file CConf.Cpp.

INmManager* g_pMgr

Definition at line 18 of file CConf.Cpp.

Generated on Wed Nov 13 2024 16:54:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMShare/chWnd.Cpp File Reference

  • Web
  • NetMeeting
  • NMShare
Functions | Variables

chWnd.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

int | AddApp (INmSharableApp *pApp)
VOID | FreeAllApps (void)
int | ItemFromPApp (INmSharableApp *pApp)
LRESULT | MsgNotifyAppList (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
VOID | UpdateApp (INmSharableApp *pApp)
VOID | UpdateAppList (void)

Variables

COBLIST * | g_pListApp = (COBLIST *) NULL

Function Documentation

int AddApp ( INmSharableApp * pApp )

Definition at line 27 of file chWnd.Cpp.

{
  TCHAR sz[MAX_PATH + 1];
  ZeroMemory(sz,(MAX_PATH + 1) * sizeof(TCHAR));
  _sntprintf(sz,MAX_PATH,TEXT("%08X"), pApp);

  //wsprintf(sz, TEXT("%08X"), pApp);

  pApp->AddRef();
  AddNode(pApp, &g_pListApp);

  LV_ITEM  lvItem;
  ClearStruct(&lvItem);
  lvItem.iItem = g_pListApp->GetItemCount();
  lvItem.mask = LVIF_PARAM | LVIF_TEXT;
  lvItem.pszText = sz;
  lvItem.cchTextMax = lstrlen(sz);
  lvItem.lParam = (LPARAM) pApp;
  return ListView_InsertItem(ghwndApp, &lvItem);
}

VOID FreeAllApps ( void )

Definition at line 74 of file chWnd.Cpp.

{
  if (NULL != g_pListApp)
  {
    while (!g_pListApp->IsEmpty())
    {
      INmSharableApp * pApp = (INmSharableApp *) g_pListApp->RemoveHead();
      ASSERT(NULL != pApp);
      pApp->Release();
    }
  }
}

int ItemFromPApp ( INmSharableApp * pApp )

Definition at line 55 of file chWnd.Cpp.

{
  if (NULL == ghwndApp)
    return -1;

  LV_FINDINFO findInfo;
  ClearStruct(&findInfo);
  findInfo.flags = LVFI_PARAM;
    findInfo.lParam = (LPARAM) pApp;
    return ListView_FindItem(ghwndApp, -1, &findInfo);
}

LRESULT MsgNotifyAppList | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 164 of file chWnd.Cpp.

{
  LV_DISPINFO *pLvdi = (LV_DISPINFO *)lParam;

  switch(pLvdi->hdr.code)
  {
    case NM_DBLCLK:
    case NM_RETURN:
    {
      HRESULT hr = S_OK;
      NM_SHAPP_STATE uState;

      int iItem = ListView_GetNextItem(ghwndApp, -1, LVNI_ALL | LVNI_SELECTED);
      if (-1 == iItem)
        break;

      LV_ITEM lvi;
      ClearStruct(&lvi);
      lvi.iItem = iItem;
      lvi.mask = LVIF_PARAM;
      if (!ListView_GetItem(ghwndApp, &lvi))
        break;

      INmSharableApp * pApp = (INmSharableApp *) lvi.lParam;
      ASSERT(NULL != pApp);
      hr = pApp->GetState(&uState);
      if (FAILED(hr))
        break;

      if (NM_SHAPP_NOT_SHARED == uState)
        uState = NM_SHAPP_SHARED;
      else
        uState = NM_SHAPP_NOT_SHARED;

      hr = pApp->SetState(uState);
      break;
    }
    default:
      break;
  }

  return 0;
}

VOID UpdateApp ( INmSharableApp * pApp )

Definition at line 94 of file chWnd.Cpp.

{
  HRESULT hr = S_OK;
  LPTSTR  psz = NULL;
  BSTR    bstr;

  HWND    hwnd = 0;
  int     iItem = 0;
  NM_SHAPP_STATE uState;

  iItem = ItemFromPApp(pApp);
  if (-1 == iItem)
  {
    iItem = AddApp(pApp);
    if (-1 == iItem)
      return;
  }

  hr = pApp->GetHwnd(&hwnd);
  if (SUCCEEDED(hr))
  {
    TCHAR sz[MAX_PATH + 1];
    ZeroMemory(sz,(MAX_PATH + 1) * sizeof(TCHAR));
    _sntprintf(sz,MAX_PATH,TEXT("%08X"), hwnd);

    //TCHAR sz[MAX_PATH];
    //wsprintf(sz, TEXT("%08X"), hwnd);
    ListView_SetItemText(ghwndApp, iItem, ILV_HWND, sz);
  }

  hr = pApp->GetState(&uState);
  if (SUCCEEDED(hr))
  {
    ListView_SetItemText(ghwndApp, iItem, ILV_STATUS,
      (NM_SHAPP_SHARED == uState) ? TEXT("Shared") : TEXT("Not Shared"));
  }

  hr = pApp->GetName(&bstr);
  if (SUCCEEDED(hr))
  {
    psz = PszFromBstr(bstr);
    SysFreeString(bstr);

    ListView_SetItemText(ghwndApp, iItem, ILV_NAME, psz);
    FreePlpv(&psz);
  }
}

VOID UpdateAppList ( void )

Definition at line 149 of file chWnd.Cpp.

{
  // Update all apps
  // - enumerate all
  // - ensure all are in list
  // - check data for each
}

Variable Documentation

COBLIST* g_pListApp = (COBLIST *) NULL

Definition at line 18 of file chWnd.Cpp.

Generated on Wed Nov 13 2024 16:54:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMShare/clUtil.Cpp File Reference

  • Web
  • NetMeeting
  • NMShare
Functions

clUtil.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

POSITION | AddNode (PVOID pv, COBLIST **ppList)
LPTSTR | PszFromBstr (BSTR bstr)
PVOID | RemoveNode (POSITION *pPos, COBLIST *pList)

Function Documentation

POSITION AddNode | ( | PVOID | pv,
 |  | COBLIST ** | ppList
 | ) |  |

Definition at line 455 of file clUtil.Cpp.

{
  ASSERT(NULL != ppList);
  if (NULL == *ppList)
  {
    *ppList = new COBLIST();
    if (NULL == *ppList)
      return NULL;
  }

  return (*ppList)->AddTail(pv);
}

LPTSTR PszFromBstr ( BSTR bstr )

Definition at line 580 of file clUtil.Cpp.

{
  if (NULL == bstr)
    return NULL;
  int cch =  WideCharToMultiByte(CP_ACP, 0, (LPWSTR)bstr, -1, NULL, 0, NULL, NULL);
  if (cch <= 0)
    return NULL;

  LPTSTR psz = PszAlloc(cch);
  if (NULL == psz)
    return NULL;

  WideCharToMultiByte(CP_ACP, 0, (LPWSTR)bstr, -1, psz, cch+1, NULL, NULL);
  return psz;
}

PVOID RemoveNode | ( | POSITION * | pPos,
 |  | COBLIST * | pList
 | ) |  |

Definition at line 478 of file clUtil.Cpp.

{
  if ((NULL == pList) || (NULL == pPos))
    return NULL;

  PVOID pv = pList->RemoveAt(*pPos);
  *pPos = NULL;
  return pv;
}

Generated on Wed Nov 13 2024 16:54:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMShare/clUtil.h File Reference

  • Web
  • NetMeeting
  • NMShare
Classes | Defines | Functions

clUtil.h File Reference

Go to the source code of this file.

Classes

class | BSTRING
class | BTSTR
class | CNotify
class | COBLIST
struct | COBNODE
class | RefCount

Defines

#define | POSITION COBNODE*

Functions

POSITION | AddNode (PVOID pv, COBLIST **ppList)
LPTSTR | PszFromBstr (BSTR bst)
PVOID | RemoveNode (POSITION *pPos, COBLIST *pList)

Define Documentation

#define POSITION COBNODE*

Definition at line 78 of file clUtil.h.

Function Documentation

POSITION AddNode | ( | PVOID | pv,
 |  | COBLIST ** | ppList
 | ) |  |

Definition at line 497 of file clUtil.Cpp.

{
  ASSERT(NULL != ppList);
  if(NULL == ppList)
  {
    return NULL;
  }

  if (NULL == *ppList)
  {
    *ppList = new COBLIST();
    if (NULL == *ppList)
    {
      return NULL;
    }
  }

  return (*ppList)->AddTail(pv);
}

LPTSTR PszFromBstr ( BSTR bst )

Definition at line 627 of file clUtil.Cpp.

{
  if (NULL == bstr)
  {
    return NULL;
  }
  int cch =  WideCharToMultiByte(CP_ACP, 0, (LPWSTR)bstr, -1, NULL, 0, NULL, NULL);
  if (cch <= 0)
  {
    return NULL;
  }

  LPTSTR psz = PszAlloc(cch);
  if (NULL == psz)
  {
    return NULL;
  }

  ZeroMemory(psz, sizeof(TCHAR) * (cch + 1));

  WideCharToMultiByte(CP_ACP, 0, (LPWSTR)bstr, -1, psz, cch, NULL, NULL);
  return psz;
}

PVOID RemoveNode | ( | POSITION * | pPos,
 |  | COBLIST * | pList
 | ) |  |

Definition at line 527 of file clUtil.Cpp.

{
  if ((NULL == pList) || (NULL == pPos))
  {
    return NULL;
  }

  PVOID pv = pList->RemoveAt(*pPos);
  *pPos = NULL;
  return pv;
}

Generated on Wed Nov 13 2024 16:54:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMShare/Cmd.Cpp File Reference

  • Web
  • NetMeeting
  • NMShare
Functions

Cmd.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

VOID | CmdAbout (void)
VOID | CmdClear (void)
VOID | CmdCollaborate (void)
VOID | CmdExit (void)
VOID | CmdFont (void)
VOID | CmdHelp (void)
VOID | CmdInControl (void)
VOID | CmdOptions (void)
VOID | CmdRefresh (void)
VOID | CmdViewMsg (void)
VOID | CmdViewSbar (void)
VOID | CmdViewUsers (void)
VOID | CmdWorkAlone (void)
LRESULT | MsgCmdMain (HWND hwnd, UINT uMsg, WPARAM wparam, LPARAM lparam)

Function Documentation

VOID CmdAbout ( void )

Definition at line 112 of file Cmd.Cpp.

{
  TCHAR szVersion[MAX_PATH];

  LoadString(ghInst, IDS_VERSION, szVersion, CCHMAX(szVersion));

  ShellAbout(ghwndMain, szVersion, NULL, LoadIcon(ghInst, MAKEINTRESOURCE(ICO_MAIN)));
}

VOID CmdClear ( void )

Definition at line 30 of file Cmd.Cpp.

{
  ClearText();
}

VOID CmdCollaborate ( void )

Definition at line 161 of file Cmd.Cpp.

{
  DoCollaborate();
}

VOID CmdExit ( void )

Definition at line 44 of file Cmd.Cpp.

{
  DestroyWindow(ghwndMain);
}

VOID CmdFont ( void )

Definition at line 71 of file Cmd.Cpp.

{
#ifdef NOTUSED
  CHOOSEFONT cf;
  LOGFONT    lf;
  HFONT      hfont;

  lf = gPref.lf;

  ClearStruct(&cf);
  cf.lStructSize = sizeof(CHOOSEFONT);
  cf.hwndOwner = ghwndMain;
  cf.lpLogFont = &lf;
  cf.iPointSize = 10;
  cf.Flags = CF_SCREENFONTS | CF_EFFECTS | CF_INITTOLOGFONTSTRUCT;

  if (ChooseFont(&cf) != TRUE)
    return;

  hfont= CreateFontIndirect(cf.lpLogFont);
  if (hfont == hfontNil)
    return;

  MaybeDeleteObject((HGDIOBJ *) &ghfontEntry);
  ghfontEntry = hfont;
  SendMessage(ghwndMsg, WM_SETFONT,
    (WPARAM) ghfontEntry, MAKELPARAM(TRUE, 0));

  gPref.lf = lf;
#endif
}

VOID CmdHelp ( void )

Definition at line 58 of file Cmd.Cpp.

{
}

VOID CmdInControl ( void )

Definition at line 166 of file Cmd.Cpp.

{
  DoTakeControl();
}

VOID CmdOptions ( void )

Definition at line 18 of file Cmd.Cpp.

{
}

VOID CmdRefresh ( void )

Definition at line 151 of file Cmd.Cpp.

{
  DoEnumApps();
}

VOID CmdViewMsg ( void )

Definition at line 138 of file Cmd.Cpp.

{
  gPref.fMsgWindow = !gPref.fMsgWindow;
  ShowHwnd(ghwndMsg, gPref.fMsgWindow, IDM_VIEW_MSG);
}

VOID CmdViewSbar ( void )

Definition at line 131 of file Cmd.Cpp.

{
  gPref.fSbar = !gPref.fSbar;
  ShowHwnd(ghwndSbar, gPref.fSbar, IDM_VIEW_SBAR);
}

VOID CmdViewUsers ( void )

Definition at line 145 of file Cmd.Cpp.

{
  gPref.fUserList = !gPref.fUserList;
  ShowHwnd(ghwndUser, gPref.fUserList, IDM_VIEW_USERLIST);
}

VOID CmdWorkAlone ( void )

Definition at line 156 of file Cmd.Cpp.

{
  DoWorkAlone();
}

LRESULT MsgCmdMain | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 208 of file Cmd.Cpp.

{
  UINT wCmd = (UINT) GET_WM_COMMAND_ID(wparam, lparam);

  for (LPCMD lpcmd = _rgcmdMain; 0 != lpcmd->wCmd; lpcmd++)
  {
    if (wCmd == lpcmd->wCmd)
    {
      lpcmd->pfncmd();
      break;
    }
  }

  return 0L;
}

Generated on Wed Nov 13 2024 16:54:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMShare/cMemb.Cpp File Reference

  • Web
  • NetMeeting
  • NMShare
Functions | Variables

cMemb.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

VOID | AddMember (INmMember *pMember)
PUSER | AllocUser (INmMember *pMember)
VOID | FreeAllUsers (void)
VOID | FreeUser (PUSER pUser)
int | ItemFromPUser (PUSER pUser)
PUSER | PUserFromINmMember (INmMember *pMember)
VOID | RemoveMember (INmMember *pMember)

Variables

COBLIST * | g_pListUser = (COBLIST *) NULL

Function Documentation

VOID AddMember ( INmMember * pMember )

Definition at line 142 of file cMemb.Cpp.

{
  if (NULL == pMember)
  {
    return;
  }

  PUSER pUser = AllocUser(pMember);

  if (NULL == pUser)
  {
    return;
  }

  AddNode(pUser, &g_pListUser);

  LV_ITEM  lvItem;
  ClearStruct(&lvItem);
  lvItem.iItem = g_pListUser->GetItemCount();
  lvItem.mask = LVIF_PARAM | LVIF_TEXT;
  lvItem.pszText = pUser->pszName;
  lvItem.cchTextMax = lstrlen(pUser->pszName);
  lvItem.lParam = (LPARAM) pUser;
  ListView_InsertItem(ghwndUser, &lvItem);

  TCHAR szMsg[MAX_PATH + 1];
  ZeroMemory(szMsg,(MAX_PATH + 1) * sizeof(TCHAR));
  _sntprintf(szMsg,MAX_PATH,TEXT("%s joined"), pUser->pszName);

  DisplayMsg(szMsg);

}

PUSER AllocUser ( INmMember * pMember )

Definition at line 71 of file cMemb.Cpp.

{
  HRESULT hr = S_OK;
  BSTR bstr;

  if (NULL == pMember)
  {
    return NULL;
  }

  PUSER pUser = new USER;
  if (NULL == pUser)
  {
    return NULL;
  }
  ClearStruct(pUser);

  pUser->pMember = pMember;
  pMember->AddRef();

  hr = pMember->GetName(&bstr);
  if (SUCCEEDED(hr))
  {
    pUser->pszName = PszFromBstr(bstr);
    SysFreeString(bstr);
  }
  //*** What happens if GetName fails? ***

  return pUser;
}

VOID FreeAllUsers ( void )

Definition at line 124 of file cMemb.Cpp.

{
  if (NULL != g_pListUser)
  {
    while (!g_pListUser->IsEmpty())
    {
      RemoveMember(((PUSER) g_pListUser->GetHead())->pMember);
    }
  }
}

VOID FreeUser ( PUSER pUser )

Definition at line 109 of file cMemb.Cpp.

{
  ASSERT(NULL != pUser);

  if (NULL != pUser)
  {
    FreePlpv(&pUser->pszName);

    if (NULL != pUser->pMember)
    {
      pUser->pMember->Release();
    }
  }
}

int ItemFromPUser ( PUSER pUser )

Definition at line 52 of file cMemb.Cpp.

{
  if (NULL == ghwndUser)
    return -1;

  LV_FINDINFO findInfo;
  ClearStruct(&findInfo);
  findInfo.flags = LVFI_PARAM;
    findInfo.lParam = (LPARAM) pUser;
    return ListView_FindItem(ghwndUser, -1, &findInfo);
}

PUSER PUserFromINmMember ( INmMember * pMember )

Definition at line 26 of file cMemb.Cpp.

{
  if (NULL != g_pListUser)
  {
    POSITION pos = g_pListUser->GetHeadPosition();
    while (NULL != pos)
    {
      PUSER pUser = (PUSER) g_pListUser->GetNext(pos);
      if (pMember == pUser->pMember)
      {
        ASSERT(pMember == pUser->pMember);
        return pUser;
      }
    }
  }

  return NULL;
}

VOID RemoveMember ( INmMember * pMember )

Definition at line 182 of file cMemb.Cpp.

{
  if (NULL == g_pListUser)
    return;

  if (NULL == pMember)
    return;

  POSITION pos = g_pListUser->GetHeadPosition();
  while (NULL != pos)
  {
    POSITION posSav = pos;
    PUSER pUser = (PUSER) g_pListUser->GetNext(pos);
    if (pMember == pUser->pMember)
    {
      TCHAR szMsg[MAX_PATH + 1];
      ZeroMemory(szMsg,(MAX_PATH + 1) * sizeof(TCHAR));
      _sntprintf(szMsg,MAX_PATH,TEXT("%s left"), pUser->pszName);

      DisplayMsg(szMsg);

      ListView_DeleteItem(ghwndUser, ItemFromPUser(pUser));
      FreeUser(pUser);
      g_pListUser->RemoveAt(posSav);
      return;
    }
  }
}

Variable Documentation

COBLIST* g_pListUser = (COBLIST *) NULL

Definition at line 17 of file cMemb.Cpp.

Generated on Wed Nov 13 2024 16:54:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMShare/cMemb.h File Reference

  • Web
  • NetMeeting
  • NMShare
Classes | Typedefs | Functions | Variables

cMemb.h File Reference

Go to the source code of this file.

Classes

struct | tagUser

Typedefs

typedef USER * | PUSER
typedef struct tagUser | USER

Functions

VOID | AddMember (INmMember *pMember)
VOID | FreeAllUsers (void)
VOID | FreeUser (PUSER pUser)
PUSER | PUserFromINmMember (INmMember *pMember)
VOID | RemoveMember (INmMember *pMember)

Variables

COBLIST * g_pListUser

Typedef Documentation

typedef USER* PUSER

Definition at line 20 of file cMemb.h.

typedef struct tagUser USER

Function Documentation

VOID AddMember ( INmMember * pMember )

Definition at line 177 of file cMemb.Cpp.

{
  PUSER pUser = AllocUser(pMember);
  if (NULL == pUser)
  {
    return;
  }

  AddNode(pUser, &g_pListUser);

  LV_ITEM  lvItem;
  ClearStruct(&lvItem);           // Zero's memory
  lvItem.iItem = g_pListUser->GetItemCount();
  lvItem.mask = LVIF_PARAM | LVIF_TEXT;
  lvItem.pszText = (S_OK == pMember->IsSelf()) ? TEXT("everyone") : pUser->pszName;
  lvItem.cchTextMax = lstrlen(pUser->pszName);
  lvItem.lParam = (LPARAM) pUser;
  ListView_InsertItem(ghwndUser, &lvItem);

  DisplaySysMsg(TEXT("<joined>"), pMember);
}

VOID FreeAllUsers ( void )

Definition at line 152 of file cMemb.Cpp.

{
  if (NULL == g_pListUser)
  {
    return;
  }

  while (!g_pListUser->IsEmpty())
  {
    USER * pUser = (USER *) g_pListUser->RemoveHead();
    ASSERT(NULL != pUser);
    FreeUser(pUser);
  }

  delete g_pListUser;
  g_pListUser = NULL;
}

VOID FreeUser ( PUSER pUser )

Definition at line 126 of file cMemb.Cpp.

{
  ASSERT(NULL != pUser);

  if(NULL == pUser)
  {
    return;
  }

  FreePlpv(&pUser->pszName);

  if (NULL != pUser->pMember)
  {
    pUser->pMember->Release();
  }

  delete pUser;
}

PUSER PUserFromINmMember ( INmMember * pMember )

Definition at line 28 of file cMemb.Cpp.

{
  if (NULL != g_pListUser)
  {
    POSITION pos = g_pListUser->GetHeadPosition();
    while (NULL != pos)
    {
      PUSER pUser = (PUSER) g_pListUser->GetNext(pos);
      if (pMember == pUser->pMember)
      {
        ASSERT(pMember == pUser->pMember);
        return pUser;
      }
    }
  }

  return NULL;
}

VOID RemoveMember ( INmMember * pMember )

Definition at line 206 of file cMemb.Cpp.

{
  if (NULL == g_pListUser)
  {
    return;
  }

  POSITION pos = g_pListUser->GetHeadPosition();
  while (NULL != pos)
  {
    POSITION posSav = pos;
    PUSER pUser = (PUSER) g_pListUser->GetNext(pos);
    if (pMember == pUser->pMember)
    {
      ASSERT(pMember == pUser->pMember);
      DisplaySysMsg(TEXT("<left>"), pMember);

      ListView_DeleteItem(ghwndUser, ItemFromPUser(pUser));
      FreeUser(pUser);
      g_pListUser->RemoveAt(posSav);
      return;
    }
  }
}

Variable Documentation

COBLIST* g_pListUser

Definition at line 17 of file cMemb.Cpp.

Generated on Wed Nov 13 2024 16:54:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMShare/cShare.Cpp File Reference

  • Web
  • NetMeeting
  • NMShare
Functions | Variables

cShare.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

VOID | DoCollaborate (void)
VOID | DoEnumApps (void)
VOID | DoTakeControl (void)
VOID | DoWorkAlone (void)
VOID | FreeAppShareChannel (void)
HRESULT | HookChannel (INmChannel *pChannel)
VOID | UnHookChannel (INmChannel *pChannel)

Variables

INmChannelAppShare * | g_pChannelAppShare = NULL
CAppShareNotify * | g_pNotifyAppShare = NULL

Function Documentation

VOID DoCollaborate ( void )

Definition at line 373 of file cShare.Cpp.

{
  if (NULL == g_pChannelAppShare)
    return;

  HRESULT hr = g_pChannelAppShare->SetState(NM_SHARE_COLLABORATING);
}

VOID DoEnumApps ( void )

Definition at line 335 of file cShare.Cpp.

{
  HRESULT hr = S_OK;
  ULONG cFetched = 0;
  IEnumNmSharableApp * pEnum = NULL;
  INmSharableApp * pApp = NULL;

  if (NULL == g_pChannelAppShare)
    return;

  hr = g_pChannelAppShare->EnumSharableApp(&pEnum);
  if (FAILED(hr))
  {
      return;
  }

  for ( ; ; )
  {
    hr = pEnum->Next(1, &pApp, &cFetched);
    if (S_OK != hr)
      break;

    UpdateApp(pApp);
    pApp->Release();
  }

  pEnum->Release();
}

VOID DoTakeControl ( void )

Definition at line 381 of file cShare.Cpp.

{
  if (NULL == g_pChannelAppShare)
    return;

  HRESULT hr = g_pChannelAppShare->SetState(NM_SHARE_IN_CONTROL);
}

VOID DoWorkAlone ( void )

Definition at line 365 of file cShare.Cpp.

{
  if (NULL == g_pChannelAppShare)
    return;

  HRESULT hr = g_pChannelAppShare->SetState(NM_SHARE_WORKING_ALONE);
}

VOID FreeAppShareChannel ( void )

Definition at line 115 of file cShare.Cpp.

{
  // Release all notify
  if (NULL != g_pNotifyAppShare)
  {
    g_pNotifyAppShare->Disconnect();
    g_pNotifyAppShare->Release();
    g_pNotifyAppShare = NULL;
  }

  if (NULL != g_pChannelAppShare)
  {
    g_pChannelAppShare->Release();
    g_pChannelAppShare = NULL;
  }
}

HRESULT HookChannel ( INmChannel * pChannel )

Definition at line 27 of file cShare.Cpp.

{
  HRESULT hr = S_OK;
  CAppShareNotify * pNotify = NULL;
  INmChannelAppShare * pChannelAs = NULL;

  ASSERT(NULL != pChannel);

  if (NULL == pChannel)
  {
    hr = ERROR_INVALID_PARAMETER;
    return hr;
  }

  hr = pChannel->QueryInterface(IID_INmChannelAppShare, (void **)&pChannelAs);
  if (FAILED(hr))
  {
    // Not an app sharing channel
    return hr;
  }
  if (NULL != g_pChannelAppShare)
  {
    g_pChannelAppShare->Release();
    g_pChannelAppShare = NULL;
  }
  g_pChannelAppShare = pChannelAs;
  // keep QI ref around

    // Connect to the channel object
    pNotify = new CAppShareNotify();
    if (pNotify == NULL)
    {
        hr = E_OUTOFMEMORY;
    }
    else
    {
    hr = pNotify->Connect(g_pChannelAppShare);
    if (FAILED(hr))
    {
      pNotify->Release();
    }
    else
    {
      g_pNotifyAppShare = pNotify;
    }
  }

  if (FAILED(hr))
  {
    g_pChannelAppShare->Release();
    g_pChannelAppShare = NULL;
  }
  else
  {
    DoEnumApps();
  }

  return hr;
}

VOID UnHookChannel ( INmChannel * pChannel )

Definition at line 94 of file cShare.Cpp.

{
  if (NULL == pChannel)
    return;

  if (NULL == g_pChannelAppShare)
    return;

  if (S_OK != g_pChannelAppShare->IsSameAs(pChannel))
    return;

  FreeAppShareChannel();
}

Variable Documentation

INmChannelAppShare* g_pChannelAppShare = NULL

Definition at line 17 of file cShare.Cpp.

CAppShareNotify* g_pNotifyAppShare = NULL

Definition at line 18 of file cShare.Cpp.

Generated on Wed Nov 13 2024 16:54:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMShare/cShare.h File Reference

  • Web
  • NetMeeting
  • NMShare
Classes | Functions | Variables

cShare.h File Reference

Go to the source code of this file.

Classes

class | CAppShareNotify

Functions

VOID | DoCollaborate (void)
VOID | DoEnumApps (void)
VOID | DoTakeControl (void)
VOID | DoWorkAlone (void)
VOID | FreeAllApps (void)
VOID | FreeAppShareChannel (void)
HRESULT | HookChannel (INmChannel *pChannel)
VOID | UnHookChannel (INmChannel *pChannel)
VOID | UpdateApp (INmSharableApp *pApp)
VOID | UpdateAppList (void)

Variables

INmChannelAppShare * | g_pChannelAppShare
CAppShareNotify * g_pNotifyAppShare

Function Documentation

VOID DoCollaborate ( void )

Definition at line 373 of file cShare.Cpp.

{
  if (NULL == g_pChannelAppShare)
    return;

  HRESULT hr = g_pChannelAppShare->SetState(NM_SHARE_COLLABORATING);
}

VOID DoEnumApps ( void )

Definition at line 335 of file cShare.Cpp.

{
  HRESULT hr = S_OK;
  ULONG cFetched = 0;
  IEnumNmSharableApp * pEnum = NULL;
  INmSharableApp * pApp = NULL;

  if (NULL == g_pChannelAppShare)
    return;

  hr = g_pChannelAppShare->EnumSharableApp(&pEnum);
  if (FAILED(hr))
  {
      return;
  }

  for ( ; ; )
  {
    hr = pEnum->Next(1, &pApp, &cFetched);
    if (S_OK != hr)
      break;

    UpdateApp(pApp);
    pApp->Release();
  }

  pEnum->Release();
}

VOID DoTakeControl ( void )

Definition at line 381 of file cShare.Cpp.

{
  if (NULL == g_pChannelAppShare)
    return;

  HRESULT hr = g_pChannelAppShare->SetState(NM_SHARE_IN_CONTROL);
}

VOID DoWorkAlone ( void )

Definition at line 365 of file cShare.Cpp.

{
  if (NULL == g_pChannelAppShare)
    return;

  HRESULT hr = g_pChannelAppShare->SetState(NM_SHARE_WORKING_ALONE);
}

VOID FreeAllApps ( void )

Definition at line 74 of file chWnd.Cpp.

{
  if (NULL != g_pListApp)
  {
    while (!g_pListApp->IsEmpty())
    {
      INmSharableApp * pApp = (INmSharableApp *) g_pListApp->RemoveHead();
      ASSERT(NULL != pApp);
      pApp->Release();
    }
  }
}

VOID FreeAppShareChannel ( void )

Definition at line 115 of file cShare.Cpp.

{
  // Release all notify
  if (NULL != g_pNotifyAppShare)
  {
    g_pNotifyAppShare->Disconnect();
    g_pNotifyAppShare->Release();
    g_pNotifyAppShare = NULL;
  }

  if (NULL != g_pChannelAppShare)
  {
    g_pChannelAppShare->Release();
    g_pChannelAppShare = NULL;
  }
}

HRESULT HookChannel ( INmChannel * pChannel )

Definition at line 27 of file cShare.Cpp.

{
  HRESULT hr = S_OK;
  CAppShareNotify * pNotify = NULL;
  INmChannelAppShare * pChannelAs = NULL;

  ASSERT(NULL != pChannel);

  if (NULL == pChannel)
  {
    hr = ERROR_INVALID_PARAMETER;
    return hr;
  }

  hr = pChannel->QueryInterface(IID_INmChannelAppShare, (void **)&pChannelAs);
  if (FAILED(hr))
  {
    // Not an app sharing channel
    return hr;
  }
  if (NULL != g_pChannelAppShare)
  {
    g_pChannelAppShare->Release();
    g_pChannelAppShare = NULL;
  }
  g_pChannelAppShare = pChannelAs;
  // keep QI ref around

    // Connect to the channel object
    pNotify = new CAppShareNotify();
    if (pNotify == NULL)
    {
        hr = E_OUTOFMEMORY;
    }
    else
    {
    hr = pNotify->Connect(g_pChannelAppShare);
    if (FAILED(hr))
    {
      pNotify->Release();
    }
    else
    {
      g_pNotifyAppShare = pNotify;
    }
  }

  if (FAILED(hr))
  {
    g_pChannelAppShare->Release();
    g_pChannelAppShare = NULL;
  }
  else
  {
    DoEnumApps();
  }

  return hr;
}

VOID UnHookChannel ( INmChannel * pChannel )

Definition at line 94 of file cShare.Cpp.

{
  if (NULL == pChannel)
    return;

  if (NULL == g_pChannelAppShare)
    return;

  if (S_OK != g_pChannelAppShare->IsSameAs(pChannel))
    return;

  FreeAppShareChannel();
}

VOID UpdateApp ( INmSharableApp * pApp )

Definition at line 94 of file chWnd.Cpp.

{
  HRESULT hr = S_OK;
  LPTSTR  psz = NULL;
  BSTR    bstr;

  HWND    hwnd = 0;
  int     iItem = 0;
  NM_SHAPP_STATE uState;

  iItem = ItemFromPApp(pApp);
  if (-1 == iItem)
  {
    iItem = AddApp(pApp);
    if (-1 == iItem)
      return;
  }

  hr = pApp->GetHwnd(&hwnd);
  if (SUCCEEDED(hr))
  {
    TCHAR sz[MAX_PATH + 1];
    ZeroMemory(sz,(MAX_PATH + 1) * sizeof(TCHAR));
    _sntprintf(sz,MAX_PATH,TEXT("%08X"), hwnd);

    //TCHAR sz[MAX_PATH];
    //wsprintf(sz, TEXT("%08X"), hwnd);
    ListView_SetItemText(ghwndApp, iItem, ILV_HWND, sz);
  }

  hr = pApp->GetState(&uState);
  if (SUCCEEDED(hr))
  {
    ListView_SetItemText(ghwndApp, iItem, ILV_STATUS,
      (NM_SHAPP_SHARED == uState) ? TEXT("Shared") : TEXT("Not Shared"));
  }

  hr = pApp->GetName(&bstr);
  if (SUCCEEDED(hr))
  {
    psz = PszFromBstr(bstr);
    SysFreeString(bstr);

    ListView_SetItemText(ghwndApp, iItem, ILV_NAME, psz);
    FreePlpv(&psz);
  }
}

VOID UpdateAppList ( void )

Definition at line 149 of file chWnd.Cpp.

{
  // Update all apps
  // - enumerate all
  // - ensure all are in list
  // - check data for each
}

Variable Documentation

INmChannelAppShare* g_pChannelAppShare

Definition at line 17 of file cShare.Cpp.

CAppShareNotify* g_pNotifyAppShare

Definition at line 18 of file cShare.Cpp.

Generated on Wed Nov 13 2024 16:54:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMShare/Debug.Cpp File Reference

  • Web
  • NetMeeting
  • NMShare

Debug.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMShare/Global.h File Reference

  • Web
  • NetMeeting
  • NMShare
Classes | Defines | Typedefs | Functions | Variables

Global.h File Reference

Go to the source code of this file.

Classes

struct | _CMD
struct | _MSD
struct | _PREF

Defines

#define | ARRAY_ELEMENTS(rg) (sizeof(rg) / sizeof(rg[0]))
#define | ASSERT(f)
#define | AssertSz(f, sz)
#define | CCHMAX(sz) (sizeof(sz) / sizeof(TCHAR))
#define | chNull ('\0')
#define | ClearStruct(lpv) ZeroMemory((LPVOID) (lpv), sizeof(*(lpv)))
#define | FEmptySz(sz) (((sz) == NULL) || (*(sz) == _T('\0')))
#define | hfontNil ((HFONT) NULL)
#define | hgdiNil ((HGDIOBJ) NULL)
#define | hwndNil ((HWND) NULL)
#define | IDW_APP 102
#define | IDW_MSG 100
#define | IDW_USER 101
#define | ILV_ADDR 0
#define | ILV_HWND 1
#define | ILV_NAME 3
#define | ILV_STATUS 2
#define | InitStruct(lpv) {ClearStruct(lpv); (* (LPDWORD) lpv) = sizeof(*(lpv));}
#define | lpNil (NULL)
#define | NotReached()
#define | SetEmptySz(sz) ( *(sz) = _T('\0') )

Typedefs

typedef struct _CMD | CMD
typedef CMD * | LPCMD
typedef MSD * | LPMSD
typedef struct _MSD | MSD
typedef VOID(* | PFNCMD )(VOID)
typedef LRESULT(* | PFNMSG )(HWND, UINT, WPARAM, LPARAM)
typedef struct _PREF | PREF

Functions

VOID | ClearText (void)
VOID | DisplayMsg (LPTSTR pszMsg)
VOID | FreePlpv (LPVOID plpv)
LPVOID | LpvAlloc (int cb)
VOID | MaybeDeleteObject (HGDIOBJ *phgdi)
LRESULT | MsgNotifyAppList (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
LPTSTR | PszAlloc (int cch)
VOID | RecalcMsgWindow (void)
VOID | SetMenuCheck (UINT idm, BOOL fCheck)
VOID | ShowHwnd (HWND hwnd, BOOL fShow, int idm)
VOID | SizeMsgWindow (int dx, int dy)
LRESULT CALLBACK | WndProc (HWND, UINT, WPARAM, LPARAM)

Variables

const int | DXP_USER = 80
const int | DYP_MSG = 30
HACCEL | ghAccelTable
HFONT | ghfontEntry
HINSTANCE | ghInst
HMENU | ghMenu
HWND | ghwndApp
HWND | ghwndMain
HWND | ghwndMsg
HWND | ghwndSbar
HWND | ghwndUser
PREF gPref
const int | XP_LEFT = 0
const int | YP_TOP = 1

Define Documentation

#define ARRAY_ELEMENTS ( rg ) (sizeof(rg) / sizeof(rg[0]))

Definition at line 41 of file Global.h.

#define ASSERT ( f )

Definition at line 62 of file Global.h.

#define AssertSz | ( | f,
 |  | sz
 | ) |

Definition at line 63 of file Global.h.

#define CCHMAX ( sz ) (sizeof(sz) / sizeof(TCHAR))

Definition at line 42 of file Global.h.

#define chNull ('\0')

Definition at line 22 of file Global.h.

#define ClearStruct ( lpv ) ZeroMemory((LPVOID) (lpv), sizeof(*(lpv)))

Definition at line 34 of file Global.h.

#define FEmptySz ( sz ) (((sz) == NULL) || (*(sz) == _T('\0')))

Definition at line 39 of file Global.h.

#define hfontNil ((HFONT) NULL)

Definition at line 26 of file Global.h.

#define hgdiNil ((HGDIOBJ) NULL)

Definition at line 27 of file Global.h.

#define hwndNil ((HWND) NULL)

Definition at line 25 of file Global.h.

#define IDW_APP 102

Definition at line 120 of file Global.h.

#define IDW_MSG 100

Definition at line 118 of file Global.h.

#define IDW_USER 101

Definition at line 119 of file Global.h.

#define ILV_ADDR 0

Definition at line 123 of file Global.h.

#define ILV_HWND 1

Definition at line 124 of file Global.h.

#define ILV_NAME 3

Definition at line 126 of file Global.h.

#define ILV_STATUS 2

Definition at line 125 of file Global.h.

#define InitStruct ( lpv ) {ClearStruct(lpv); (* (LPDWORD) lpv) = sizeof(*(lpv));}

Definition at line 35 of file Global.h.

#define lpNil (NULL)

Definition at line 23 of file Global.h.

#define NotReached ( )

Definition at line 64 of file Global.h.

#define SetEmptySz ( sz ) ( *(sz) = _T('\0') )

Definition at line 38 of file Global.h.

Typedef Documentation

typedef struct _CMD CMD
typedef CMD* LPCMD

Definition at line 102 of file Global.h.

typedef MSD* LPMSD

Definition at line 85 of file Global.h.

typedef struct _MSD MSD
typedef VOID(* PFNCMD)(VOID)

Definition at line 94 of file Global.h.

typedef LRESULT(* PFNMSG)(HWND, UINT, WPARAM, LPARAM)

Definition at line 77 of file Global.h.

typedef struct _PREF PREF

Function Documentation

VOID ClearText ( void )

Definition at line 94 of file Util.Cpp.

{
  ListView_DeleteAllItems(ghwndMsg);
}

VOID DisplayMsg ( LPTSTR pszMsg )

Definition at line 36 of file Util.Cpp.

{
  SendMessage(ghwndMsg, LB_ADDSTRING, 0, (LPARAM) pszMsg);
  PostMessage(ghwndMsg, WM_VSCROLL, SB_BOTTOM, 0);
}

VOID FreePlpv ( LPVOID plpv )

Definition at line 167 of file Util.Cpp.

{
  if ((plpv == NULL) || (*(VOID FAR * FAR *)plpv == NULL))
  {
    return;
  }

  LocalFree(*(VOID FAR * FAR *)plpv);
  *(VOID FAR * FAR *)plpv = NULL;
}

LPVOID LpvAlloc ( int cb )

Definition at line 141 of file Util.Cpp.

{
  return LocalAlloc(LMEM_FIXED, cb);
}

VOID MaybeDeleteObject ( HGDIOBJ * phgdi )

Definition at line 187 of file Util.Cpp.

{
  if(NULL == phgdi || NULL == *phgdi)
  {
    return;
  }

  DeleteObject(*phgdi);
  *phgdi = NULL;
}

LRESULT MsgNotifyAppList | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 164 of file chWnd.Cpp.

{
  LV_DISPINFO *pLvdi = (LV_DISPINFO *)lParam;

  switch(pLvdi->hdr.code)
  {
    case NM_DBLCLK:
    case NM_RETURN:
    {
      HRESULT hr = S_OK;
      NM_SHAPP_STATE uState;

      int iItem = ListView_GetNextItem(ghwndApp, -1, LVNI_ALL | LVNI_SELECTED);
      if (-1 == iItem)
        break;

      LV_ITEM lvi;
      ClearStruct(&lvi);
      lvi.iItem = iItem;
      lvi.mask = LVIF_PARAM;
      if (!ListView_GetItem(ghwndApp, &lvi))
        break;

      INmSharableApp * pApp = (INmSharableApp *) lvi.lParam;
      ASSERT(NULL != pApp);
      hr = pApp->GetState(&uState);
      if (FAILED(hr))
        break;

      if (NM_SHAPP_NOT_SHARED == uState)
        uState = NM_SHAPP_SHARED;
      else
        uState = NM_SHAPP_NOT_SHARED;

      hr = pApp->SetState(uState);
      break;
    }
    default:
      break;
  }

  return 0;
}

LPTSTR PszAlloc ( int cch )

Definition at line 153 of file Util.Cpp.

{
  return (LPTSTR) LocalAlloc(LMEM_FIXED, sizeof(TCHAR) * (cch+1));
}

VOID RecalcMsgWindow ( void )

Definition at line 124 of file Util.Cpp.

{
  RECT rc = {0,0,0,0};

  GetClientRect(ghwndMain, &rc);
  SizeMsgWindow(rc.right, rc.bottom);
}

VOID SetMenuCheck | ( | UINT | idm,
 |  | BOOL | fCheck
 | ) |  |

Definition at line 193 of file Util.Cpp.

{
  CheckMenuItem(ghMenu, idm,
    fCheck ? (MF_CHECKED  | MF_BYCOMMAND) : (MF_UNCHECKED | MF_BYCOMMAND));
}

VOID ShowHwnd | ( | HWND | hwnd,
 |  | BOOL | fShow,
 |  | int | idm
 | ) |  |

Definition at line 118 of file Util.Cpp.

{
  if (IsWindow(hwnd))
  {
    ShowWindow(hwnd, fShow ? SW_SHOW : SW_HIDE);
    SetMenuCheck(idm, fShow);
    RecalcMsgWindow();
  }
}

VOID SizeMsgWindow | ( | int | dx,
 |  | int | dy
 | ) |  |

Definition at line 106 of file Util.Cpp.

{
  MoveWindow(ghwndEdit, XP_LEFT, dy - DYP_EDIT, dx, DYP_EDIT, TRUE);
  dy -= (YP_TOP + DYP_EDIT);

  MoveWindow(ghwndUser, XP_LEFT, YP_TOP, DXP_USER, dy, TRUE);
  dx -= DXP_USER;

  MoveWindow(ghwndMsg, XP_LEFT + DXP_USER, YP_TOP, dx, dy, TRUE);
}

LRESULT CALLBACK WndProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 290 of file Generic.C.

{
   int wmId, wmEvent;
   PAINTSTRUCT ps;
   HDC hdc;
      POINT pnt;
   HMENU hMenu;
      BOOL bGotHelp;

   switch (message) {

      case WM_COMMAND:
         wmId    = LOWORD(wParam); // Remember, these are...
         wmEvent = HIWORD(wParam); // ...different for Win32!

         //Parse the menu selections:
         switch (wmId) {

            case IDM_ABOUT:
               DialogBox(hInst, "AboutBox", hWnd, (DLGPROC)About);
               break;

            case IDM_EXIT:
               DestroyWindow (hWnd);
               break;

            case IDM_HELPTOPICS: // Only called in Windows 95
               bGotHelp = WinHelp (hWnd, APPNAME".HLP", HELP_FINDER,(DWORD)0);
               if (!bGotHelp)
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            case IDM_HELPCONTENTS: // Not called in Windows 95
               bGotHelp = WinHelp (hWnd, APPNAME".HLP", HELP_CONTENTS,(DWORD)0);
               if (!bGotHelp)
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            case IDM_HELPSEARCH: // Not called in Windows 95
               if (!WinHelp(hWnd, APPNAME".HLP", HELP_PARTIALKEY,
                           (ULONG_PTR)(LPSTR)""))
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            case IDM_HELPHELP: // Not called in Windows 95
               if(!WinHelp(hWnd, (LPSTR)NULL, HELP_HELPONHELP, 0))
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            // Here are all the other possible menu options,
            // all of these are currently disabled:
            case IDM_NEW:
            case IDM_OPEN:
            case IDM_SAVE:
            case IDM_SAVEAS:
            case IDM_UNDO:
            case IDM_CUT:
            case IDM_COPY:
            case IDM_PASTE:
            case IDM_LINK:
            case IDM_LINKS:

            default:
               return (DefWindowProc(hWnd, message, wParam, lParam));
         }
         break;

      case WM_NCRBUTTONUP: // RightClick on windows non-client area...
         if (IS_WIN95 && SendMessage(hWnd, WM_NCHITTEST, 0, lParam) == HTSYSMENU)
         {
            // The user has clicked the right button on the applications
            // 'System Menu'. Here is where you would alter the default
            // system menu to reflect your application. Notice how the
            // explorer deals with this. For this app, we aren't doing
            // anything
            return (DefWindowProc(hWnd, message, wParam, lParam));
         } else {
            // Nothing we are interested in, allow default handling...
            return (DefWindowProc(hWnd, message, wParam, lParam));
         }
            break;

        case WM_RBUTTONDOWN: // RightClick in windows client area...
            pnt.x = LOWORD(lParam);
            pnt.y = HIWORD(lParam);
            ClientToScreen(hWnd, (LPPOINT) &pnt);
      // This is where you would determine the appropriate 'context'
      // menu to bring up. Since this app has no real functionality,
      // we will just bring up the 'Help' menu:
            hMenu = GetSubMenu (GetMenu (hWnd), 2);
            if (hMenu) {
                TrackPopupMenu (hMenu, 0, pnt.x, pnt.y, 0, hWnd, NULL);
            } else {
            // Couldn't find the menu...
                MessageBeep(0);
            }
            break;

      case WM_DISPLAYCHANGE: // Only comes through on plug'n'play systems
      {
         SIZE  szScreen;
         DWORD dwBitsPerPixel = (DWORD)wParam;

         szScreen.cx = LOWORD(lParam);
         szScreen.cy = HIWORD(lParam);

         MessageBox (GetFocus(), GetStringRes(IDS_DISPLAYCHANGED),
                     szAppName, 0);
      }
      break;

      case WM_PAINT:
         hdc = BeginPaint (hWnd, &ps);
         // Add any drawing code here...
         EndPaint (hWnd, &ps);
         break;

      case WM_DESTROY:
         // Tell WinHelp we don't need it any more...
               WinHelp (hWnd, APPNAME".HLP", HELP_QUIT,(DWORD)0);
         PostQuitMessage(0);
         break;

      default:
         return (DefWindowProc(hWnd, message, wParam, lParam));
   }
   return (0);
}

Variable Documentation

const int DXP_USER = 80

Definition at line 129 of file Global.h.

const int DYP_MSG = 30

Definition at line 128 of file Global.h.

HACCEL ghAccelTable

Definition at line 25 of file Main.Cpp.

HFONT ghfontEntry

Definition at line 37 of file Main.Cpp.

HINSTANCE ghInst

Name of app.

Definition at line 24 of file ole2ui.c.

HMENU ghMenu

Definition at line 26 of file Main.Cpp.

HWND ghwndApp

Definition at line 48 of file MciPlay.c.

HWND ghwndMain

Definition at line 447 of file MfEdit.h.

HWND ghwndMsg

Definition at line 28 of file Main.Cpp.

HWND ghwndSbar

Definition at line 29 of file Main.Cpp.

HWND ghwndUser

Definition at line 30 of file Main.Cpp.

PREF gPref

Definition at line 34 of file Main.Cpp.

const int XP_LEFT = 0

Definition at line 131 of file Global.h.

const int YP_TOP = 1

Definition at line 130 of file Global.h.

Generated on Wed Nov 13 2024 16:53:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMShare/IMSConf2.Idl File Reference

  • Web
  • NetMeeting
  • NMShare
Functions | Variables

IMSConf2.Idl File Reference

Go to the source code of this file.

Functions

cpp_quote ("//+-------------------------------------------------------------------------") cpp_quote(" cpp_quote("cpp_quote(" cpp_quote("cpp_quote(" cpp_quote("cpp_quote(" import "objidl.idl"
cpp_quote ("") cpp_quote(" cpp_quote("cpp_quote(" cpp_quote("") cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("") cpp_quote(" cpp_quote("cpp_quote("cpp_quote("cpp_quote(" cpp_quote("") cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("") cpp_quote(" cpp_quote("cpp_quote("") cpp_quote(" cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote(" cpp_quote("") cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("") cpp_quote("") cpp_quote(" cpp_quote("cpp_quote("cpp_quote("cpp_quote("") cpp_quote("") cpp_quote(" cpp_quote("cpp_quote("") cpp_quote("cpp_quote("") cpp_quote("enum

Variables

import oleidl idl

Function Documentation

cpp_quote ( "//+-------------------------------------------------------------------------" )
cpp_quote ( "" )

Definition at line 57 of file IMSConf2.Idl.

Variable Documentation

import oaidl idl

Definition at line 25 of file IMSConf2.Idl.

Generated on Wed Nov 13 2024 16:54:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMShare/Main.Cpp File Reference

  • Web
  • NetMeeting
  • NMShare
Classes | Typedefs | Functions | Variables

Main.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Classes

struct | _tagCol

Typedefs

typedef struct _tagCol | COL
typedef COL * | LPCOL

Functions

BOOL | FCreateAppWindow (void)
BOOL | FCreateMsgWindow (void)
BOOL | FCreateUserList (void)
BOOL | FInitApp (LPSTR lpszCmd, int nCmdShow)
BOOL | FInitMain (void)
BOOL | FInitPref (void)
VOID | TerminateApp (void)
int APIENTRY | WinMain (HINSTANCE hInstance, HINSTANCE hInstPrev, LPSTR lpszCmd, int nCmdShow)

Variables

HACCEL | ghAccelTable = NULL
HFONT | ghfontMsg = hfontNil
HINSTANCE | ghInst = NULL
HMENU | ghMenu = NULL
HWND | ghwndApp = hwndNil
HWND | ghwndMain = NULL
HWND | ghwndMsg = hwndNil
HWND | ghwndSbar = NULL
HWND | ghwndUser = hwndNil
PREF gPref
TCHAR | gszAppClassName [] = TEXT("NMSHARE")
TCHAR | gszAppName [] = TEXT("NmShare")
TCHAR | gszAppTitle [] = TEXT("NetMeeting Sharing Test Application")

Typedef Documentation

typedef struct _tagCol COL
typedef COL* LPCOL

Definition at line 49 of file Main.Cpp.

Function Documentation

BOOL FCreateAppWindow ( void )

Definition at line 86 of file Main.Cpp.

{
  ghwndApp = CreateWindow(TEXT("SysListView32"), NULL,
    WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_BORDER | LVS_REPORT,
    0, 0, 0, 0,
    ghwndMain, (HMENU) IDW_APP, ghInst, NULL);
  if (ghwndApp == NULL)
    return FALSE;

  // Initialize column data
  {
    int   iCol = 0;
    LPCOL lpCol = NULL;
    LV_COLUMN lvc;

    lpCol = _rgColMsg;
    ClearStruct(&lvc);
    lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
    lvc.fmt = LVCFMT_LEFT;
    for (iCol = 0; iCol < ARRAY_ELEMENTS(_rgColMsg); iCol++)
    {
      lvc.iSubItem = iCol;
      lvc.cx = lpCol->dwWidth;
      lvc.pszText = lpCol->lpsz;
      if (ListView_InsertColumn(ghwndApp, iCol, &lvc) == -1)
        return FALSE;
      lpCol++;
    }
  }

  return TRUE;
}

BOOL FCreateMsgWindow ( void )

Definition at line 164 of file Main.Cpp.

{
  ghwndMsg = CreateWindow(TEXT("LISTBOX"), NULL,
    WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_BORDER | WS_CLIPSIBLINGS |
    LBS_USETABSTOPS | LBS_NOINTEGRALHEIGHT | LBS_HASSTRINGS,
    0, 0, 0, 0,
    ghwndMain, (HMENU) IDW_MSG, ghInst, NULL);
  if (NULL == ghwndMsg)
    return FALSE;

  // set the font for the window
  ghfontMsg = CreateFontIndirect(&gPref.lf);
  if (ghfontMsg == hfontNil)
    return TRUE;

  SendMessage(ghwndMsg, WM_SETFONT, (WPARAM) ghfontMsg, MAKELPARAM(TRUE, 0));

  return TRUE;
}

BOOL FCreateUserList ( void )

Definition at line 128 of file Main.Cpp.

{
  ghwndUser = CreateWindow(TEXT("SysListView32"), NULL,
    WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_BORDER | LVS_REPORT | LVS_SHOWSELALWAYS,
    0, 0, DXP_USER, 0,
    ghwndMain, (HMENU) IDW_USER, ghInst, NULL);

  if (NULL == ghwndUser)
    return FALSE;

  // Initialize column data
  {
    LV_COLUMN lvc;

    ClearStruct(&lvc);
    lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
    lvc.fmt = LVCFMT_LEFT;
    lvc.iSubItem = 0;
    lvc.cx = DXP_USER;
    lvc.pszText = TEXT("Users");
    if (ListView_InsertColumn(ghwndUser, 0, &lvc) == -1)
      return FALSE;
  }

  return TRUE;
}

BOOL FInitApp | ( | LPSTR | lpszCmd,
 |  | int | nCmdShow
 | ) |  |

Definition at line 241 of file Main.Cpp.

{
  InitCommonControls();

  if (FAILED(CoInitialize(NULL)))
    return FALSE;

  if (!FInitPref())
    return FALSE;

  if (!FInitMain())
    return FALSE;

  if (!FCreateMsgWindow())
    return FALSE;

  if (!FCreateUserList())
    return FALSE;

  if (!FCreateAppWindow())
    return FALSE;

  ASSERT(NULL != ghwndMain);
  ShowWindow(ghwndMain, nCmdShow);
  UpdateWindow(ghwndMain);

  return S_OK == InitConfMgr();
}

BOOL FInitMain ( void )

Definition at line 193 of file Main.Cpp.

{
  TCHAR szTitle[MAX_PATH + 1];
  WNDCLASS  wc;

  ASSERT(NULL != ghInst);

  ZeroMemory(szTitle,(MAX_PATH + 1) * sizeof(TCHAR));

  ghAccelTable = LoadAccelerators(ghInst, MAKEINTRESOURCE(ID_APPACCEL));

  LoadString(ghInst, IDS_APP_TITLE, szTitle, CCHMAX(szTitle));

  wc.style         = CS_HREDRAW | CS_VREDRAW;
  wc.lpfnWndProc   = (WNDPROC)WndProc;
  wc.cbClsExtra    = 0;
  wc.cbWndExtra    = 0;
  wc.hInstance     = ghInst;
  wc.hIcon         = LoadIcon(ghInst, MAKEINTRESOURCE(ICO_MAIN));
  wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
  wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
  wc.lpszMenuName  = MAKEINTRESOURCE(IDM_APP);
  wc.lpszClassName = gszAppClassName;

  // Register the window class and return FALSE if unsuccesful.
  if (!RegisterClass(&wc))
    return FALSE;

  // Create a main window for this application instance.
  ghwndMain = CreateWindow(gszAppClassName, szTitle, WS_OVERLAPPEDWINDOW,
    0, 0, 400, 300,
    NULL, NULL, ghInst, NULL);
  if (ghwndMain == NULL)
    return FALSE;

  ghMenu = GetMenu(ghwndMain);
  return (NULL != ghMenu);
}

BOOL FInitPref ( void )

Definition at line 69 of file Main.Cpp.

{
  ClearStruct(&gPref);
  gPref.fMsgWindow = TRUE;
  gPref.fUserList = TRUE;
  return TRUE;
}

VOID TerminateApp ( void )

Definition at line 277 of file Main.Cpp.

{
  // Release all objects to which this app has a reference
  FreeAllApps();
  FreeAppShareChannel();
  FreeAllUsers();
  FreeConference();
  FreeConfMgr();

    // Uninitialize OLE
    CoUninitialize();
}

int APIENTRY WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hInstPrev,
 |  | LPSTR | lpszCmd,
 |  | int | nCmdShow
 | ) |  |

Definition at line 297 of file Main.Cpp.

{
  ghInst = hInstance;

  if (FInitApp(lpszCmd, nCmdShow))
  {
    MSG  msg;
    while (GetMessage(&msg, NULL, 0, 0))
    {
      if (!TranslateAccelerator(msg.hwnd, ghAccelTable, &msg))
      {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
      }
    }
  }

  TerminateApp();

  return 0;
}

Variable Documentation

HACCEL ghAccelTable = NULL

Definition at line 26 of file Main.Cpp.

HFONT ghfontMsg = hfontNil

Definition at line 33 of file Main.Cpp.

HINSTANCE ghInst = NULL

Name of app.

Definition at line 25 of file Main.Cpp.

HMENU ghMenu = NULL

Definition at line 27 of file Main.Cpp.

HWND ghwndApp = hwndNil

Definition at line 31 of file Main.Cpp.

HWND ghwndMain = NULL

Definition at line 28 of file Main.Cpp.

HWND ghwndMsg = hwndNil

Definition at line 30 of file Main.Cpp.

HWND ghwndSbar = NULL

Definition at line 29 of file Main.Cpp.

HWND ghwndUser = hwndNil

Definition at line 32 of file Main.Cpp.

PREF gPref

Definition at line 34 of file Main.Cpp.

TCHAR gszAppClassName[] = TEXT("NMSHARE")

Definition at line 40 of file Main.Cpp.

TCHAR gszAppName[] = TEXT("NmShare")

Definition at line 41 of file Main.Cpp.

TCHAR gszAppTitle[] = TEXT("NetMeeting Sharing Test Application")

Definition at line 37 of file Main.Cpp.

Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMShare/Msg.Cpp File Reference

  • Web
  • NetMeeting
  • NMShare
Functions

Msg.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

VOID | CmdExit (void)
LRESULT | MsgClose (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT | MsgCmdMain (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT | MsgDestroy (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT | MsgGetMinMax (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT | MsgNotify (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT | MsgSize (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT CALLBACK | WndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)

Function Documentation

VOID CmdExit ( void )

Definition at line 51 of file Cmd.Cpp.

{
  DestroyWindow(ghwndMain);
}

LRESULT MsgClose | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 46 of file Msg.Cpp.

{
  FreeAllUsers();
  CmdExit();
  return 0;
}

LRESULT MsgCmdMain | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 166 of file Cmd.Cpp.

{
  UINT wCmd = (UINT) GET_WM_COMMAND_ID(wparam, lparam);

  for (LPCMD lpcmd = _rgcmdMain; 0 != lpcmd->wCmd; lpcmd++)
  {
    if (wCmd == lpcmd->wCmd)
    {
      lpcmd->pfncmd();
      break;
    }
  }

  return 0L;
}

LRESULT MsgDestroy | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 31 of file Msg.Cpp.

{
  PostQuitMessage(0);
  return 0;
}

LRESULT MsgGetMinMax | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 78 of file Msg.Cpp.

{
  LPMINMAXINFO lpminmax = (LPMINMAXINFO) lParam;

  lpminmax->ptMinTrackSize.x = 325;
  lpminmax->ptMinTrackSize.y = 250;

  return 0;
}

LRESULT MsgNotify | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 95 of file Msg.Cpp.

{
    switch (((LPNMHDR) lParam)->idFrom)
    {
    case IDW_APP:
      return MsgNotifyAppList(hwnd, uMsg, wParam, lParam);
    default:
        break;
    }

    return 0;
}

LRESULT MsgSize | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 62 of file Msg.Cpp.

{
  int dxClient = LOWORD(lParam);  // width of client area
  int dyClient = HIWORD(lParam);  // height of client area

  SizeMsgWindow(dxClient, dyClient);
  return 0;
}

LRESULT CALLBACK WndProc | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 132 of file Msg.Cpp.

{
  for (LPMSD lpmsd = _rgmsdMain; 0 != lpmsd->uMsg; lpmsd++)
  {
    if (lpmsd->uMsg == uMsg)
    {
      return lpmsd->pfnmsg(hwnd, uMsg, wParam, lParam);
    }
  }

  return DefWindowProc(hwnd, uMsg, wParam, lParam);
}

Generated on Wed Nov 13 2024 16:54:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMShare/PreComp.h File Reference

  • Web
  • NetMeeting
  • NMShare

PreComp.h File Reference

#include <windows.h>
#include <windowsx.h>
#include <commctrl.h>
#include <tchar.h>
#include <ocidl.h>
#include <stdio.h>
#include "imsconf2.h"
#include "global.h"
#include "clUtil.h"
#include "cConf.h"
#include "cShare.h"
#include "cMemb.h"
#include "resource.h"
#include "global.h"
#include "clUtil.h"
#include "cConf.h"
#include "cShare.h"
#include "cMemb.h"
#include "resource.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMShare/Resource.h File Reference

  • Web
  • NetMeeting
  • NMShare
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | ICO_MAIN 101
#define | ID_APPACCEL 105
#define | IDD_OPTIONS 123
#define | IDM_ABOUT 40092
#define | IDM_APP 104
#define | IDM_CALL 40145
#define | IDM_COLLABORATE 40148
#define | IDM_EJECT 40021
#define | IDM_EXIT 40002
#define | IDM_HELP 40090
#define | IDM_HELP_CONTENTS 40091
#define | IDM_IN_CONTROL 40149
#define | IDM_OPTIONS 40013
#define | IDM_REFRESH 40146
#define | IDM_SAVE_AS 40001
#define | IDM_SHARE 40150
#define | IDM_VIEW_CLEAR 40012
#define | IDM_VIEW_FONT 40011
#define | IDM_VIEW_MSG 40153
#define | IDM_VIEW_NAME 40142
#define | IDM_VIEW_SBAR 40151
#define | IDM_VIEW_TIME 40143
#define | IDM_VIEW_USERLIST 40152
#define | IDM_VIEW_USERS 40144
#define | IDM_WORK_ALONE 40147
#define | IDS_APP_TITLE 1
#define | IDS_SYSMENU 4
#define | IDS_VERSION 2

Define Documentation

#define ICO_MAIN 101

Definition at line 8 of file Resource.h.

#define ID_APPACCEL 105

Definition at line 10 of file Resource.h.

#define IDD_OPTIONS 123

Definition at line 11 of file Resource.h.

#define IDM_ABOUT 40092

Definition at line 20 of file Resource.h.

#define IDM_APP 104

Definition at line 9 of file Resource.h.

#define IDM_CALL 40145

Definition at line 24 of file Resource.h.

#define IDM_COLLABORATE 40148

Definition at line 27 of file Resource.h.

#define IDM_EJECT 40021

Definition at line 17 of file Resource.h.

#define IDM_EXIT 40002

Definition at line 13 of file Resource.h.

#define IDM_HELP 40090

Definition at line 18 of file Resource.h.

#define IDM_HELP_CONTENTS 40091

Definition at line 19 of file Resource.h.

#define IDM_IN_CONTROL 40149

Definition at line 28 of file Resource.h.

#define IDM_OPTIONS 40013

Definition at line 16 of file Resource.h.

#define IDM_REFRESH 40146

Definition at line 25 of file Resource.h.

#define IDM_SAVE_AS 40001

Definition at line 12 of file Resource.h.

#define IDM_SHARE 40150

Definition at line 29 of file Resource.h.

#define IDM_VIEW_CLEAR 40012

Definition at line 15 of file Resource.h.

#define IDM_VIEW_FONT 40011

Definition at line 14 of file Resource.h.

#define IDM_VIEW_MSG 40153

Definition at line 32 of file Resource.h.

#define IDM_VIEW_NAME 40142

Definition at line 21 of file Resource.h.

#define IDM_VIEW_SBAR 40151

Definition at line 30 of file Resource.h.

#define IDM_VIEW_TIME 40143

Definition at line 22 of file Resource.h.

#define IDM_VIEW_USERLIST 40152

Definition at line 31 of file Resource.h.

#define IDM_VIEW_USERS 40144

Definition at line 23 of file Resource.h.

#define IDM_WORK_ALONE 40147

Definition at line 26 of file Resource.h.

#define IDS_APP_TITLE 1

Definition at line 5 of file Resource.h.

#define IDS_SYSMENU 4

Definition at line 7 of file Resource.h.

#define IDS_VERSION 2

Definition at line 6 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMShare/Util.Cpp File Reference

  • Web
  • NetMeeting
  • NMShare
Functions

Util.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

VOID | ClearText (void)
VOID | DisplayMsg (LPTSTR pszMsg)
VOID | FreePlpv (LPVOID plpv)
LPVOID | LpvAlloc (int cb)
VOID | MaybeDeleteObject (HGDIOBJ *phgdi)
LPTSTR | PszAlloc (int cch)
VOID | RecalcMsgWindow (void)
VOID | SetMenuCheck (UINT idm, BOOL fCheck)
VOID | ShowHwnd (HWND hwnd, BOOL fShow, int idm)
VOID | SizeMsgWindow (int dx, int dy)

Function Documentation

VOID ClearText ( void )

Definition at line 24 of file Util.Cpp.

{
  SendMessage(ghwndMsg, LB_RESETCONTENT, 0, 0);
}

VOID DisplayMsg ( LPTSTR pszMsg )

Definition at line 36 of file Util.Cpp.

{
  SendMessage(ghwndMsg, LB_ADDSTRING, 0, (LPARAM) pszMsg);
  PostMessage(ghwndMsg, WM_VSCROLL, SB_BOTTOM, 0);
}

VOID FreePlpv ( LPVOID plpv )

Definition at line 156 of file Util.Cpp.

{
  if ((plpv == NULL) || (*(VOID FAR * FAR *)plpv == NULL)) {
    return;
  }

  LocalFree(*(VOID FAR * FAR *)plpv);
  *(VOID FAR * FAR *)plpv = NULL;
}

LPVOID LpvAlloc ( int cb )

Definition at line 137 of file Util.Cpp.

{
  return LocalAlloc(LMEM_FIXED, cb);
}

VOID MaybeDeleteObject ( HGDIOBJ * phgdi )

Definition at line 175 of file Util.Cpp.

{
  if (*phgdi == hgdiNil)
    return;

  DeleteObject(*phgdi);
  *phgdi = hgdiNil;
}

LPTSTR PszAlloc ( int cch )

Definition at line 142 of file Util.Cpp.

{
  return (LPTSTR) LocalAlloc(LMEM_FIXED, sizeof(TCHAR) * (cch+1));
}

VOID RecalcMsgWindow ( void )

Definition at line 101 of file Util.Cpp.

{
  RECT rc;

  GetClientRect(ghwndMain, &rc);
  SizeMsgWindow(rc.right, rc.bottom);
}

VOID SetMenuCheck | ( | UINT | idm,
 |  | BOOL | fCheck
 | ) |  |

Definition at line 193 of file Util.Cpp.

{
  CheckMenuItem(ghMenu, idm,
    fCheck ? (MF_CHECKED  | MF_BYCOMMAND) : (MF_UNCHECKED | MF_BYCOMMAND));
}

VOID ShowHwnd | ( | HWND | hwnd,
 |  | BOOL | fShow,
 |  | int | idm
 | ) |  |

Definition at line 118 of file Util.Cpp.

{
  if (IsWindow(hwnd))
  {
    ShowWindow(hwnd, fShow ? SW_SHOW : SW_HIDE);
    SetMenuCheck(idm, fShow);
    RecalcMsgWindow();
  }
}

VOID SizeMsgWindow | ( | int | dx,
 |  | int | dy
 | ) |  |

Definition at line 71 of file Util.Cpp.

{
  int dyT = dy;
  int dxLeft = XP_LEFT;

  if (gPref.fMsgWindow)
  {
    dyT = dy / 2;
    MoveWindow(ghwndMsg, XP_LEFT, dy - dyT, dx, dyT, TRUE);
    dy -= (YP_TOP + dyT);
  }

  if (gPref.fUserList)
  {
    MoveWindow(ghwndUser, XP_LEFT, YP_TOP, DXP_USER, dyT, TRUE);
    dxLeft += DXP_USER;
    dx -= DXP_USER;
  }

  MoveWindow(ghwndApp, dxLeft, YP_TOP, dx, dy, TRUE);
}

Generated on Wed Nov 13 2024 16:53:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMUI/CCall.Cpp File Reference

  • Web
  • NetMeeting
  • NMUI
Functions | Variables

CCall.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

VOID | DoCallConference (void)
VOID | DoCallCreate (void)
VOID | DoCancelCall (void)
VOID | DoHandleCall (BOOL fAccept)
VOID | FreeCalls (void)
INmCall * | GetCurrentCall (void)
HRESULT | HookCall (INmCall *pCall)

Variables

COBLIST * | g_pListCall = NULL
COBLIST * | g_pListCallNotify = NULL

Function Documentation

VOID DoCallConference ( void )

Definition at line 298 of file CCall.Cpp.

{
  HRESULT       hr      = E_FAIL  ;
  INmCall     * pCall     = NULL    ;

  BSTRING       bstrAddr(gPref.pszAddr);
  BSTRING       bstrConference(gPref.pszConferenceName);
  BSTRING       bstrPassword(gPref.pszPassword);

  if  ( ( (NULL == bstrAddr.GetLPBSTR())      && (NULL != gPref.pszAddr)    )
    ||  ( (NULL == bstrConference.GetLPBSTR())  && (NULL != gPref.pszConferenceName)  )
    ||  ( (NULL == bstrPassword.GetLPBSTR())    && (NULL != gPref.pszPassword)  )
    )
  {
    return;
  }

  // Validate system

  if (NULL == g_pMgr)
  {
    ERROR_MSG(TEXT("No conference manager object"));
    return;
  }

  if (NULL != GetCurrentConference())
  {
    WARN_MSG(TEXT("can't join conferences!"));
  }

  hr = g_pMgr->CallConference(&pCall, gPref.nmCallType, gPref.nmAddrType, bstrAddr, bstrConference, bstrPassword);

  if (FAILED(hr))
  {
    ERROR_MSG(TEXT("CallConference failed HResult=%s"), GetHrSz(hr));
  }
  else
  {
    ASSERT(pCall == GetCurrentCall());

    if  (NULL != pCall)
    {
      pCall->Release();
      TRACE_MSG(TEXT("CallConference succeeded"));
    }
    else
    {
      ERROR_MSG(TEXT("CallConference returned a null pointer"));
    }
  }
}

VOID DoCallCreate ( void )

Definition at line 357 of file CCall.Cpp.

{
  HRESULT       hr      = E_FAIL  ;
  INmCall     * pCall     = NULL    ;
  INmConference * pConference = NULL    ;

  BSTRING   bstrAddr(gPref.pszAddr);
  if  ((NULL == bstrAddr.GetLPBSTR()) && (NULL != gPref.pszAddr))
    return;

  // Validate system
  if (NULL == g_pMgr)
  {
    ERROR_MSG(TEXT("No conference manager object"));
    return;
  }

  pConference = GetCurrentConference();
  if (NULL == pConference)
  {
    TRACE_MSG(TEXT("using no conference"));
  }

  hr = g_pMgr->CreateCall(&pCall, gPref.nmCallType, gPref.nmAddrType, bstrAddr, pConference);
  if (FAILED(hr))
  {
    ERROR_MSG(TEXT("CreateCall failed HResult=%s"), GetHrSz(hr));
  }
  else
  {
    ASSERT(pCall == GetCurrentCall());

    if  (NULL != pCall)
    {
      pCall->Release();
      TRACE_MSG(TEXT("CreateCall succeeded"));
    }
    else
    {
      ERROR_MSG(TEXT("CreateCall returned a NULL pointer"));
    }
  }
}

VOID DoCancelCall ( void )

Definition at line 438 of file CCall.Cpp.

{
  HRESULT   hr  = E_FAIL;
  INmCall * pCall = GetCurrentCall();

  if (NULL == pCall)
  {
    TRACE_MSG(TEXT("No call to destroy?"));
    return;
  }

  hr = pCall->Cancel();
  TRACE_MSG(TEXT("Call Cancel result = %s"), GetHrSz(hr));

  // Free just the single call - watch the notify proc
  FreeCalls();
}

VOID DoHandleCall ( BOOL fAccept )

Definition at line 408 of file CCall.Cpp.

{
  HRESULT   hr  = E_FAIL;
  INmCall * pCall = GetCurrentCall();

  if (NULL == pCall)
  {
    TRACE_MSG(TEXT("No call to handle?"));
    return;
  }

  if (fAccept)
  {
    hr = pCall->Accept();
  }
  else
  {
    hr = pCall->Reject();
  }

  TRACE_MSG(TEXT("Call result = %s"), GetHrSz(hr));
}

VOID FreeCalls ( void )

Definition at line 100 of file CCall.Cpp.

{
  // Release all notify
  if (NULL != g_pListCallNotify)
  {
    while (!g_pListCallNotify->IsEmpty())
    {
      CCallNotify * pNotify = (CCallNotify *) g_pListCallNotify->RemoveHead();
      ASSERT(NULL != pNotify);
      if  (NULL == pNotify)
        break;

      OBJECT_MSG(TEXT("[%08X] call notify released"), pNotify);
      pNotify->Disconnect();
      pNotify->Release();
    }
  }

  if (NULL != g_pListCall)
  {
    while (!g_pListCall->IsEmpty())
    {
      INmCall * pCall = (INmCall *) g_pListCall->RemoveHead();
      ASSERT(NULL != pCall);
      if  (NULL == pCall)
        break;

      OBJECT_MSG(TEXT("[%08X] call released"), pCall);
      pCall->Release();
    }
  }
}

INmCall* GetCurrentCall ( void )

Definition at line 28 of file CCall.Cpp.

{
  if (NULL == g_pListCall)
    return NULL;

  return (INmCall *) g_pListCall->GetTail();
}

HRESULT HookCall ( INmCall * pCall )

Definition at line 45 of file CCall.Cpp.

{
  HRESULT     hr    = NO_ERROR;
  CCallNotify * pNotify = NULL;

  ASSERT(NULL != pCall);
  if  (NULL == pCall)
  {
    return E_POINTER;
  }

  pCall->AddRef();
  if  (NULL == AddNode(pCall, &g_pListCall))
  {
    pCall -> Release();
    return E_FAIL;
  }

    // Connect to the conference object
    pNotify = new CCallNotify();
    if (pNotify == NULL)
    {
        hr = E_OUTOFMEMORY;
    }
    else
    {
    hr = pNotify->Connect(pCall);
    if (FAILED(hr))
    {
      ERROR_MSG(TEXT("CConfNotify Failed (%s)"), GetHrSz(hr));
      pNotify->Release();
    }
    else
    {
      OBJECT_MSG(TEXT("Call Connection point established successfully"));
      if  (NULL == AddNode(pNotify, &g_pListCallNotify))
      {
        ERROR_MSG(TEXT("AddNode Failed in Hook Call"));
        pNotify -> Disconnect();
        pNotify -> Release();
        return E_FAIL;
      }
    }
  }

  return hr;
}

Variable Documentation

COBLIST* g_pListCall = NULL

Definition at line 18 of file CCall.Cpp.

COBLIST* g_pListCallNotify = NULL

Definition at line 19 of file CCall.Cpp.

Generated on Wed Nov 13 2024 16:54:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMUI/CCall.h File Reference

  • Web
  • NetMeeting
  • NMUI
Classes | Functions | Variables

CCall.h File Reference

Go to the source code of this file.

Classes

class | CCallNotify

Functions

VOID | DoCallConference (void)
VOID | DoCallCreate (void)
VOID | DoCancelCall (void)
VOID | DoHandleCall (BOOL fAccept)
VOID | FreeCalls (void)
INmCall * | GetCurrentCall (void)
HRESULT | HookCall (INmCall *pCall)

Variables

COBLIST * g_pListCall
COBLIST * g_pListCallNotify

Function Documentation

VOID DoCallConference ( void )

Definition at line 298 of file CCall.Cpp.

{
  HRESULT       hr      = E_FAIL  ;
  INmCall     * pCall     = NULL    ;

  BSTRING       bstrAddr(gPref.pszAddr);
  BSTRING       bstrConference(gPref.pszConferenceName);
  BSTRING       bstrPassword(gPref.pszPassword);

  if  ( ( (NULL == bstrAddr.GetLPBSTR())      && (NULL != gPref.pszAddr)    )
    ||  ( (NULL == bstrConference.GetLPBSTR())  && (NULL != gPref.pszConferenceName)  )
    ||  ( (NULL == bstrPassword.GetLPBSTR())    && (NULL != gPref.pszPassword)  )
    )
  {
    return;
  }

  // Validate system

  if (NULL == g_pMgr)
  {
    ERROR_MSG(TEXT("No conference manager object"));
    return;
  }

  if (NULL != GetCurrentConference())
  {
    WARN_MSG(TEXT("can't join conferences!"));
  }

  hr = g_pMgr->CallConference(&pCall, gPref.nmCallType, gPref.nmAddrType, bstrAddr, bstrConference, bstrPassword);

  if (FAILED(hr))
  {
    ERROR_MSG(TEXT("CallConference failed HResult=%s"), GetHrSz(hr));
  }
  else
  {
    ASSERT(pCall == GetCurrentCall());

    if  (NULL != pCall)
    {
      pCall->Release();
      TRACE_MSG(TEXT("CallConference succeeded"));
    }
    else
    {
      ERROR_MSG(TEXT("CallConference returned a null pointer"));
    }
  }
}

VOID DoCallCreate ( void )

Definition at line 357 of file CCall.Cpp.

{
  HRESULT       hr      = E_FAIL  ;
  INmCall     * pCall     = NULL    ;
  INmConference * pConference = NULL    ;

  BSTRING   bstrAddr(gPref.pszAddr);
  if  ((NULL == bstrAddr.GetLPBSTR()) && (NULL != gPref.pszAddr))
    return;

  // Validate system
  if (NULL == g_pMgr)
  {
    ERROR_MSG(TEXT("No conference manager object"));
    return;
  }

  pConference = GetCurrentConference();
  if (NULL == pConference)
  {
    TRACE_MSG(TEXT("using no conference"));
  }

  hr = g_pMgr->CreateCall(&pCall, gPref.nmCallType, gPref.nmAddrType, bstrAddr, pConference);
  if (FAILED(hr))
  {
    ERROR_MSG(TEXT("CreateCall failed HResult=%s"), GetHrSz(hr));
  }
  else
  {
    ASSERT(pCall == GetCurrentCall());

    if  (NULL != pCall)
    {
      pCall->Release();
      TRACE_MSG(TEXT("CreateCall succeeded"));
    }
    else
    {
      ERROR_MSG(TEXT("CreateCall returned a NULL pointer"));
    }
  }
}

VOID DoCancelCall ( void )

Definition at line 438 of file CCall.Cpp.

{
  HRESULT   hr  = E_FAIL;
  INmCall * pCall = GetCurrentCall();

  if (NULL == pCall)
  {
    TRACE_MSG(TEXT("No call to destroy?"));
    return;
  }

  hr = pCall->Cancel();
  TRACE_MSG(TEXT("Call Cancel result = %s"), GetHrSz(hr));

  // Free just the single call - watch the notify proc
  FreeCalls();
}

VOID DoHandleCall ( BOOL fAccept )

Definition at line 408 of file CCall.Cpp.

{
  HRESULT   hr  = E_FAIL;
  INmCall * pCall = GetCurrentCall();

  if (NULL == pCall)
  {
    TRACE_MSG(TEXT("No call to handle?"));
    return;
  }

  if (fAccept)
  {
    hr = pCall->Accept();
  }
  else
  {
    hr = pCall->Reject();
  }

  TRACE_MSG(TEXT("Call result = %s"), GetHrSz(hr));
}

VOID FreeCalls ( void )

Definition at line 100 of file CCall.Cpp.

{
  // Release all notify
  if (NULL != g_pListCallNotify)
  {
    while (!g_pListCallNotify->IsEmpty())
    {
      CCallNotify * pNotify = (CCallNotify *) g_pListCallNotify->RemoveHead();
      ASSERT(NULL != pNotify);
      if  (NULL == pNotify)
        break;

      OBJECT_MSG(TEXT("[%08X] call notify released"), pNotify);
      pNotify->Disconnect();
      pNotify->Release();
    }
  }

  if (NULL != g_pListCall)
  {
    while (!g_pListCall->IsEmpty())
    {
      INmCall * pCall = (INmCall *) g_pListCall->RemoveHead();
      ASSERT(NULL != pCall);
      if  (NULL == pCall)
        break;

      OBJECT_MSG(TEXT("[%08X] call released"), pCall);
      pCall->Release();
    }
  }
}

INmCall* GetCurrentCall ( void )

Definition at line 28 of file CCall.Cpp.

{
  if (NULL == g_pListCall)
    return NULL;

  return (INmCall *) g_pListCall->GetTail();
}

HRESULT HookCall ( INmCall * pCall )

Definition at line 45 of file CCall.Cpp.

{
  HRESULT     hr    = NO_ERROR;
  CCallNotify * pNotify = NULL;

  ASSERT(NULL != pCall);
  if  (NULL == pCall)
  {
    return E_POINTER;
  }

  pCall->AddRef();
  if  (NULL == AddNode(pCall, &g_pListCall))
  {
    pCall -> Release();
    return E_FAIL;
  }

    // Connect to the conference object
    pNotify = new CCallNotify();
    if (pNotify == NULL)
    {
        hr = E_OUTOFMEMORY;
    }
    else
    {
    hr = pNotify->Connect(pCall);
    if (FAILED(hr))
    {
      ERROR_MSG(TEXT("CConfNotify Failed (%s)"), GetHrSz(hr));
      pNotify->Release();
    }
    else
    {
      OBJECT_MSG(TEXT("Call Connection point established successfully"));
      if  (NULL == AddNode(pNotify, &g_pListCallNotify))
      {
        ERROR_MSG(TEXT("AddNode Failed in Hook Call"));
        pNotify -> Disconnect();
        pNotify -> Release();
        return E_FAIL;
      }
    }
  }

  return hr;
}

Variable Documentation

COBLIST* g_pListCall

Definition at line 18 of file CCall.Cpp.

COBLIST* g_pListCallNotify

Definition at line 19 of file CCall.Cpp.

Generated on Wed Nov 13 2024 16:54:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMUI/CChan.Cpp File Reference

  • Web
  • NetMeeting
  • NMUI
Functions | Variables

CChan.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

VOID | FreeChannels (void)
HRESULT | HookChannel (INmChannel *pChannel)
VOID | UnHookChannel (INmChannel *pChannel)
VOID | UpdateChannelState (INmChannel *pChannel)

Variables

COBLIST * | g_pListChannel = NULL
COBLIST * | g_pListChannelNotify = NULL

Function Documentation

VOID FreeChannels ( void )

Definition at line 253 of file CChan.Cpp.

{
  // Release all notify
  if (NULL != g_pListChannelNotify)
  {
    while (!g_pListChannelNotify->IsEmpty())
    {
      CChannelNotify * pNotify = (CChannelNotify *) g_pListChannelNotify->RemoveHead();
      ASSERT(NULL != pNotify);
      if  (NULL == pNotify)
      {
        WARN_MSG(TEXT("NULL == pNotify in FreeChannels"));
        break;
      }

      OBJECT_MSG(TEXT("[%08X] channel notify released"), pNotify);
      pNotify->Disconnect();
      pNotify->Release();
    }
  }

  if (NULL != g_pListChannel)
  {
    while (!g_pListChannel->IsEmpty())
    {
      INmChannel * pChannel = (INmChannel *) g_pListChannel->RemoveHead();
      ASSERT(NULL != pChannel);
      if  (NULL == pChannel)
      {
        WARN_MSG(TEXT("NULL == pNotify in FreeChannels"));
        break;
      }
      OBJECT_MSG(TEXT("[%08X] channel released"), pChannel);
      pChannel->Release();
    }
  }
}

HRESULT HookChannel ( INmChannel * pChannel )

Definition at line 30 of file CChan.Cpp.

{
  HRESULT      hr     = E_FAIL;
  CChannelNotify * pNotify  = NULL  ;
  ULONG      uch    = 0   ;

  pChannel->GetNmch(&uch);
  TRACE_MSG(TEXT("[%08X] - Channel=[%s] Added"), pChannel, GetNmchSz(uch));

  ASSERT(NULL != pChannel);
  if  (NULL == pChannel)
  {
    return E_POINTER;
  }

  pChannel->AddRef();
  if  (NULL == AddNode(pChannel, &g_pListChannel))
  {
    pChannel -> Release();
    return E_FAIL;
  }

    pNotify = new CChannelNotify();
    if (pNotify == NULL)
    {
        hr = E_OUTOFMEMORY;
    }
    else
    {
    hr = pNotify->Connect(pChannel);
    if (FAILED(hr))
    {
      WARN_MSG(TEXT("CConfNotify Failed (%s)"), GetHrSz(hr));
      pNotify->Release();
    }
    else
    {
      OBJECT_MSG(TEXT("Conference Connection point established successfully"));
      if  (NULL == AddNode(pNotify, &g_pListChannelNotify))
      {
        ERROR_MSG(TEXT("AddNode failed in HookChannel"));
        pNotify->Disconnect();
        pNotify->Release();
        return E_FAIL;
      }
    }
  }

  if (SUCCEEDED(hr))
  {
    if (SUCCEEDED(pChannel->GetNmch(&uch)))
    {
      switch (uch)
        {
      case NMCH_SHARE:
        HookAppShare(pChannel);
        break;

      case NMCH_DATA:
        HookData(pChannel);
        break;

      case NMCH_FT:
        HookFileTransfer(pChannel);
        break;

      default:
        break;
        }
    }
  }

  return hr;
}

VOID UnHookChannel ( INmChannel * pChannel )

Definition at line 112 of file CChan.Cpp.

{
  if  (NULL == pChannel)
  {
    WARN_MSG(TEXT("NULL == pChannel"));
    return;
  }

  POSITION pos    = 0;
  POSITION posSav   = 0;
  IUnknown * pUnk   = pChannel;
  ULONG uch     = 0;

  pChannel->GetNmch(&uch);
  TRACE_MSG(TEXT("[%08X] - Channel=[%s] Removed"), pChannel, GetNmchSz(uch));

  // Search for the notify object responsible for this channel
  ASSERT(NULL != g_pListChannelNotify);

  if  (NULL != g_pListChannelNotify)
  {
    for (pos = g_pListChannelNotify->GetHeadPosition(); NULL != pos; )
    {
      posSav = pos;
      CChannelNotify * pNotify = (CChannelNotify *) g_pListChannelNotify->GetNext(pos);
      ASSERT(NULL != pNotify);
      if  (NULL == pNotify)
      {
        WARN_MSG(TEXT("NULL == pNotify"));
        break;
      }

      if (S_OK == pChannel->IsSameAs((INmChannel *) pNotify->GetPunk()))
      {
        g_pListChannelNotify->RemoveAt(posSav);
        pNotify->Disconnect();
        pNotify->Release();
        break;
      }
    }
  }

  // Search for the channel in the list
  ASSERT(NULL != g_pListChannel);
  if  (NULL != g_pListChannel)
  {
    for (pos = g_pListChannel->GetHeadPosition(); NULL != pos; )
    {
      posSav = pos;
      if (S_OK == pChannel->IsSameAs((INmChannel *) g_pListChannel->GetNext(pos)))
      {
        g_pListChannel->RemoveAt(posSav);
        pChannel->Release();
        break;
      }
    }
  }

  if  (g_pChannelData)
  {
    g_pChannelData->Release();
    g_pChannelData = NULL;
  }

  OBJECT_MSG(TEXT("Channel connection point removed"));
}

VOID UpdateChannelState ( INmChannel * pChannel )

Definition at line 186 of file CChan.Cpp.

{
  if  (NULL == pChannel)
  {
    WARN_MSG(TEXT("NULL == pChannel"));
    return;
  }

  HRESULT hr      = NO_ERROR  ;
  ULONG nmch    = 0     ;
  BOOL  fActive   = FALSE   ;
  ULONG cMember   = 0     ;

  hr = pChannel->GetNmch(&nmch);
  if (FAILED(hr))
  {
    return;
  }
  fActive = S_OK == pChannel->IsActive();

  if  FAILED(hr = pChannel->GetMemberCount(&cMember))
  {
    WARN_MSG(TEXT("GetMemberCount returned error code %08X"), hr);
  }

  TRACE_MSG(TEXT("%s channel %08X is %s with %d members"), GetNmchSz(nmch), pChannel,
                fActive ? TEXT("Active") : TEXT("Inactive"), cMember);

  switch (nmch)
  {
  case NMCH_DATA:
  {
    INmChannelData * pChannelData = NULL;
    hr = pChannel->QueryInterface(IID_INmChannelData, (void **)&pChannelData);
    if (FAILED(hr) || (NULL == pChannelData))
      return;
    if (pChannelData != g_pChannelData)
    {
      WARN_MSG(TEXT("second data channel?"));
    }
    SetMenuCheck(IDM_CHANNEL_DATA, fActive);
    pChannelData->Release();
    break;
  }
  case NMCH_AUDIO:
  case NMCH_VIDEO:
    break;

  case NMCH_SHARE:
  {
    if (fActive)
      break;
    FreeAs();
    break;
  }
  default:
    break;
  }
}

Variable Documentation

COBLIST* g_pListChannel = NULL

Definition at line 18 of file CChan.Cpp.

COBLIST* g_pListChannelNotify = NULL

Definition at line 19 of file CChan.Cpp.

Generated on Wed Nov 13 2024 16:54:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMUI/CChan.h File Reference

  • Web
  • NetMeeting
  • NMUI
Classes | Functions | Variables

CChan.h File Reference

Go to the source code of this file.

Classes

class | CChannelNotify

Functions

VOID | DoFtCancel (void)
VOID | FreeAs (void)
VOID | FreeChannels (void)
VOID | FreeFt (void)
HRESULT | HookChannel (INmChannel *pChannel)
VOID | SendFile (INmMember *pMember)
VOID | UnHookChannel (INmChannel *pChannel)
VOID | UpdateChannelState (INmChannel *pChannel)

Variables

COBLIST * g_pListChannel
COBLIST * g_pListChannelNotify

Function Documentation

VOID DoFtCancel ( void )

Definition at line 276 of file cft.cpp.

{
  if (NULL == g_pFt)
    return;

  HRESULT hr = g_pFt->Cancel();
}

VOID FreeAs ( void )

Definition at line 147 of file cshare.cpp.

{
  if(NULL != g_pNotifyAppShare)
  {
    g_pNotifyAppShare->Disconnect();
    g_pNotifyAppShare->Release();
    g_pNotifyAppShare = NULL;
  }

  if (NULL != g_pChannelAppShare)
  {
    g_pChannelAppShare->Release();
    g_pChannelAppShare = NULL;
  }
}

VOID FreeChannels ( void )

Definition at line 253 of file CChan.Cpp.

{
  // Release all notify
  if (NULL != g_pListChannelNotify)
  {
    while (!g_pListChannelNotify->IsEmpty())
    {
      CChannelNotify * pNotify = (CChannelNotify *) g_pListChannelNotify->RemoveHead();
      ASSERT(NULL != pNotify);
      if  (NULL == pNotify)
      {
        WARN_MSG(TEXT("NULL == pNotify in FreeChannels"));
        break;
      }

      OBJECT_MSG(TEXT("[%08X] channel notify released"), pNotify);
      pNotify->Disconnect();
      pNotify->Release();
    }
  }

  if (NULL != g_pListChannel)
  {
    while (!g_pListChannel->IsEmpty())
    {
      INmChannel * pChannel = (INmChannel *) g_pListChannel->RemoveHead();
      ASSERT(NULL != pChannel);
      if  (NULL == pChannel)
      {
        WARN_MSG(TEXT("NULL == pNotify in FreeChannels"));
        break;
      }
      OBJECT_MSG(TEXT("[%08X] channel released"), pChannel);
      pChannel->Release();
    }
  }
}

VOID FreeFt ( void )

Definition at line 291 of file cft.cpp.

{
  if (NULL != g_pFt)
  {
    g_pFt->Release();
    g_pFt = NULL;
  }
}

HRESULT HookChannel ( INmChannel * pChannel )

Definition at line 27 of file cShare.Cpp.

{
  HRESULT hr = S_OK;
  CAppShareNotify * pNotify = NULL;
  INmChannelAppShare * pChannelAs = NULL;

  ASSERT(NULL != pChannel);

  if (NULL == pChannel)
  {
    hr = ERROR_INVALID_PARAMETER;
    return hr;
  }

  hr = pChannel->QueryInterface(IID_INmChannelAppShare, (void **)&pChannelAs);
  if (FAILED(hr))
  {
    // Not an app sharing channel
    return hr;
  }
  if (NULL != g_pChannelAppShare)
  {
    g_pChannelAppShare->Release();
    g_pChannelAppShare = NULL;
  }
  g_pChannelAppShare = pChannelAs;
  // keep QI ref around

    // Connect to the channel object
    pNotify = new CAppShareNotify();
    if (pNotify == NULL)
    {
        hr = E_OUTOFMEMORY;
    }
    else
    {
    hr = pNotify->Connect(g_pChannelAppShare);
    if (FAILED(hr))
    {
      pNotify->Release();
    }
    else
    {
      g_pNotifyAppShare = pNotify;
    }
  }

  if (FAILED(hr))
  {
    g_pChannelAppShare->Release();
    g_pChannelAppShare = NULL;
  }
  else
  {
    DoEnumApps();
  }

  return hr;
}

VOID SendFile ( INmMember * pMember )

Definition at line 309 of file cft.cpp.

{
  PUSER pUser = PUserLocal();
  if (NULL == pUser)
  {
    return;
  }

  if (NULL == pUser->m_pChannelFt)
  {
    return;
  }

  BSTRING   bstrFileName(gPref.pszFileName);
  if  ((NULL == bstrFileName.GetLPBSTR()) && (NULL != gPref.pszFileName))
    return;

  INmFt * pFt = NULL;
  HRESULT   hr  = pUser->m_pChannelFt->SendFile(&pFt, pINmMember, bstrFileName, 0);

  if (SUCCEEDED(hr))
  {
    if  (NULL == pFt)
    {
      ERROR_MSG(TEXT("SendFile: NULL == pFt"));
      return;
    }

    INmMember * pMember = NULL;

    FreeFt();
    g_pFt = pFt;

    hr = pFt->GetMember( &pMember );
    if(SUCCEEDED(hr))
    {
      if(NULL == pMember)
      {
        // file was sent to everyone
      }
      else
      {
        BSTR bstrName = NULL;

        // file was sent to this user
        hr = pMember->GetName(&bstrName);
        if  (NULL != bstrName)
        {
          ::SysFreeString(bstrName);
        }

        pMember->Release();
      }
    }
  }
}

VOID UnHookChannel ( INmChannel * pChannel )

Definition at line 94 of file cShare.Cpp.

{
  if (NULL == pChannel)
    return;

  if (NULL == g_pChannelAppShare)
    return;

  if (S_OK != g_pChannelAppShare->IsSameAs(pChannel))
    return;

  FreeAppShareChannel();
}

VOID UpdateChannelState ( INmChannel * pChannel )

Definition at line 186 of file CChan.Cpp.

{
  if  (NULL == pChannel)
  {
    WARN_MSG(TEXT("NULL == pChannel"));
    return;
  }

  HRESULT hr      = NO_ERROR  ;
  ULONG nmch    = 0     ;
  BOOL  fActive   = FALSE   ;
  ULONG cMember   = 0     ;

  hr = pChannel->GetNmch(&nmch);
  if (FAILED(hr))
  {
    return;
  }
  fActive = S_OK == pChannel->IsActive();

  if  FAILED(hr = pChannel->GetMemberCount(&cMember))
  {
    WARN_MSG(TEXT("GetMemberCount returned error code %08X"), hr);
  }

  TRACE_MSG(TEXT("%s channel %08X is %s with %d members"), GetNmchSz(nmch), pChannel,
                fActive ? TEXT("Active") : TEXT("Inactive"), cMember);

  switch (nmch)
  {
  case NMCH_DATA:
  {
    INmChannelData * pChannelData = NULL;
    hr = pChannel->QueryInterface(IID_INmChannelData, (void **)&pChannelData);
    if (FAILED(hr) || (NULL == pChannelData))
      return;
    if (pChannelData != g_pChannelData)
    {
      WARN_MSG(TEXT("second data channel?"));
    }
    SetMenuCheck(IDM_CHANNEL_DATA, fActive);
    pChannelData->Release();
    break;
  }
  case NMCH_AUDIO:
  case NMCH_VIDEO:
    break;

  case NMCH_SHARE:
  {
    if (fActive)
      break;
    FreeAs();
    break;
  }
  default:
    break;
  }
}

Variable Documentation

COBLIST* g_pListChannel

Definition at line 18 of file CChan.Cpp.

COBLIST* g_pListChannelNotify

Definition at line 19 of file CChan.Cpp.

Generated on Wed Nov 13 2024 16:54:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMUI/CConf.Cpp File Reference

  • Web
  • NetMeeting
  • NMUI
Functions | Variables

CConf.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

VOID | DoConferenceCreate (void)
VOID | DoConferenceLeave (void)
VOID | FreeConferences (void)
INmConference * | GetCurrentConference (void)
HRESULT | HookConference (INmConference *pConference)

Variables

COBLIST * | g_pListConference = NULL
COBLIST * | g_pListConferenceNotify = NULL

Function Documentation

VOID DoConferenceCreate ( void )

Definition at line 159 of file CConf.Cpp.

{
  HRESULT       hr      = NO_ERROR  ;
  INmConference * pConference = NULL    ;

  // Validate system
  if (NULL == g_pMgr)
  {
    ERROR_MSG(TEXT("No conference manager object"));
    return;
  }

  if (NULL != GetCurrentConference())
  {
    WARN_MSG(TEXT("Attempting to create second conference"));
  }

  // Create Local Conference
  BSTRING bstrName(gPref.pszConferenceName);
  BSTRING bstrPassword(gPref.pszPassword);

  if  ( ((NULL == (BSTR) bstrName) && (NULL != gPref.pszConferenceName))
    ||  ((NULL == (BSTR) bstrPassword) && (NULL != gPref.pszPassword))
    )
    return;

  hr = g_pMgr->CreateConference(&pConference, bstrName, bstrPassword, gPref.dwNmch);
  if (SUCCEEDED(hr) && (NULL != pConference))
  {
    hr = pConference->Host();
    if (FAILED(hr))
    {
      WARN_MSG(TEXT("Failed to host conference"));
    }

    // Release here, because we always AddRef in INmManager.ConferenceCreated

    ASSERT(pConference == GetCurrentConference());
    pConference->Release();

    TRACE_MSG(TEXT("CreateConference succeeded"));
  }
  else
  {
    ERROR_MSG(TEXT("CreateConference failed HResult=%s"), GetHrSz(hr));
  }
}

VOID DoConferenceLeave ( void )

Definition at line 215 of file CConf.Cpp.

{
  HRESULT       hr      = NO_ERROR  ;
  INmConference * pConference = NULL    ;

  pConference = GetCurrentConference();
  if (NULL == pConference)
  {
    ERROR_MSG(TEXT("No conference object"));
    return;
  }

  hr = pConference->Leave();
  if (FAILED(hr))
  {
    ERROR_MSG(TEXT("Conference Leave hresult=%s"), GetHrSz(hr));
  }
  else
  {
    TRACE_MSG(TEXT("Conference Leave successful..."));
  }
}

VOID FreeConferences ( void )

Definition at line 109 of file CConf.Cpp.

{
  // Release all notify
  if (NULL != g_pListConferenceNotify)
  {
    while (!g_pListConferenceNotify->IsEmpty())
    {
      CConfNotify * pNotify = (CConfNotify *) g_pListConferenceNotify->RemoveHead();
      ASSERT(NULL != pNotify);
      if  (NULL == pNotify)
      {
        WARN_MSG(TEXT("FreeConferences, NULL == pNotify"));
        break;
      }

      OBJECT_MSG(TEXT("[%08X] conference notify released"), pNotify);
      pNotify->Disconnect();
      pNotify->Release();
    }
  }

  if (NULL != g_pListConference)
  {
    while (!g_pListConference->IsEmpty())
    {
      INmConference * pConference = (INmConference *) g_pListConference->RemoveHead();
      ASSERT(NULL != pConference);
      if  (NULL == pConference)
      {
        WARN_MSG(TEXT("FreeConferences, NULL == pNotify"));
        break;
      }

      OBJECT_MSG(TEXT("[%08X] conference released"), pConference);
      pConference->Release();
    }
  }

  UpdateStatusIcon(NULL);
}

INmConference* GetCurrentConference ( void )

Definition at line 28 of file CConf.Cpp.

{
  if (NULL == g_pListConference)
    return NULL;

  return (INmConference *) g_pListConference->GetTail();
}

HRESULT HookConference ( INmConference * pConference )

Definition at line 43 of file CConf.Cpp.

{
  HRESULT     hr    = NO_ERROR  ;
  CConfNotify * pNotify = NULL    ;

  ASSERT(NULL != pConference);
  if  (NULL == pConference)
    return E_POINTER;

  pConference->AddRef();
  if  (NULL == AddNode(pConference, &g_pListConference))
  {
    ERROR_MSG(TEXT("AddNode failed HookConference, pNotify"));
    pConference -> Release();
    return E_FAIL;
  }

    // Connect to the conference object
    pNotify = new CConfNotify();
    if (NULL == pNotify)
    {
        hr = E_OUTOFMEMORY;
        ERROR_MSG(TEXT("Unable to allocate CConfNotify"));
    }
    else
    {
    hr = pNotify->Connect(pConference);
    if (FAILED(hr))
    {
      TRACE_MSG(TEXT("CConfNotify Failed (%s)"), GetHrSz(hr));
      pNotify->Release();
      pNotify = NULL;
    }
    else
    {
      if  (NULL != AddNode(pNotify, &g_pListConferenceNotify))
      {
        TRACE_MSG(TEXT("Conference Connection point established successfully"));
      }
      else
      {
        ERROR_MSG(TEXT("AddNode failed HookConference, pNotify"));
        pNotify -> Disconnect();
        pNotify -> Release();
        pNotify =  NULL;

        hr = E_FAIL;
      }
    }
  }

  if  SUCCEEDED(hr)
  {
    UpdateStatusIcon(ICO_PHONE);
  }

  return hr;
}

Variable Documentation

COBLIST* g_pListConference = NULL

Definition at line 18 of file CConf.Cpp.

COBLIST* g_pListConferenceNotify = NULL

Definition at line 19 of file CConf.Cpp.

Generated on Wed Nov 13 2024 16:54:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMUI/CConf.h File Reference

  • Web
  • NetMeeting
  • NMUI
Classes | Functions | Variables

CConf.h File Reference

Go to the source code of this file.

Classes

class | CConfNotify

Functions

VOID | DoConferenceCreate (void)
VOID | DoConferenceLeave (void)
VOID | FreeConferences (void)
INmConference * | GetCurrentConference (void)
HRESULT | HookConference (INmConference *pConference)

Variables

COBLIST * g_pListConference
COBLIST * g_pListConferenceNotify

Function Documentation

VOID DoConferenceCreate ( void )

Definition at line 159 of file CConf.Cpp.

{
  HRESULT       hr      = NO_ERROR  ;
  INmConference * pConference = NULL    ;

  // Validate system
  if (NULL == g_pMgr)
  {
    ERROR_MSG(TEXT("No conference manager object"));
    return;
  }

  if (NULL != GetCurrentConference())
  {
    WARN_MSG(TEXT("Attempting to create second conference"));
  }

  // Create Local Conference
  BSTRING bstrName(gPref.pszConferenceName);
  BSTRING bstrPassword(gPref.pszPassword);

  if  ( ((NULL == (BSTR) bstrName) && (NULL != gPref.pszConferenceName))
    ||  ((NULL == (BSTR) bstrPassword) && (NULL != gPref.pszPassword))
    )
    return;

  hr = g_pMgr->CreateConference(&pConference, bstrName, bstrPassword, gPref.dwNmch);
  if (SUCCEEDED(hr) && (NULL != pConference))
  {
    hr = pConference->Host();
    if (FAILED(hr))
    {
      WARN_MSG(TEXT("Failed to host conference"));
    }

    // Release here, because we always AddRef in INmManager.ConferenceCreated

    ASSERT(pConference == GetCurrentConference());
    pConference->Release();

    TRACE_MSG(TEXT("CreateConference succeeded"));
  }
  else
  {
    ERROR_MSG(TEXT("CreateConference failed HResult=%s"), GetHrSz(hr));
  }
}

VOID DoConferenceLeave ( void )

Definition at line 215 of file CConf.Cpp.

{
  HRESULT       hr      = NO_ERROR  ;
  INmConference * pConference = NULL    ;

  pConference = GetCurrentConference();
  if (NULL == pConference)
  {
    ERROR_MSG(TEXT("No conference object"));
    return;
  }

  hr = pConference->Leave();
  if (FAILED(hr))
  {
    ERROR_MSG(TEXT("Conference Leave hresult=%s"), GetHrSz(hr));
  }
  else
  {
    TRACE_MSG(TEXT("Conference Leave successful..."));
  }
}

VOID FreeConferences ( void )

Definition at line 109 of file CConf.Cpp.

{
  // Release all notify
  if (NULL != g_pListConferenceNotify)
  {
    while (!g_pListConferenceNotify->IsEmpty())
    {
      CConfNotify * pNotify = (CConfNotify *) g_pListConferenceNotify->RemoveHead();
      ASSERT(NULL != pNotify);
      if  (NULL == pNotify)
      {
        WARN_MSG(TEXT("FreeConferences, NULL == pNotify"));
        break;
      }

      OBJECT_MSG(TEXT("[%08X] conference notify released"), pNotify);
      pNotify->Disconnect();
      pNotify->Release();
    }
  }

  if (NULL != g_pListConference)
  {
    while (!g_pListConference->IsEmpty())
    {
      INmConference * pConference = (INmConference *) g_pListConference->RemoveHead();
      ASSERT(NULL != pConference);
      if  (NULL == pConference)
      {
        WARN_MSG(TEXT("FreeConferences, NULL == pNotify"));
        break;
      }

      OBJECT_MSG(TEXT("[%08X] conference released"), pConference);
      pConference->Release();
    }
  }

  UpdateStatusIcon(NULL);
}

INmConference* GetCurrentConference ( void )

Definition at line 28 of file CConf.Cpp.

{
  if (NULL == g_pListConference)
    return NULL;

  return (INmConference *) g_pListConference->GetTail();
}

HRESULT HookConference ( INmConference * pConference )

Definition at line 259 of file CConf.Cpp.

{
  HRESULT hr = NO_ERROR;

  ASSERT(NULL != pConference);
  ASSERT(NULL == g_pConference);

  if(NULL == pConference)
  {
    return E_POINTER;
  }

  if(NULL != g_pConference)
  {
    return E_POINTER;
  }

  g_pConference = pConference;

  pConference->AddRef();

    // Connect to the conference object
    ASSERT(NULL == g_pConferenceNotify)
    g_pConferenceNotify = new CConfNotify();
    if (NULL == g_pConferenceNotify)
    {
        hr = E_OUTOFMEMORY;
    }
    else
    {
    hr = g_pConferenceNotify->Connect(pConference);
    if (FAILED(hr))
    {
      g_pConferenceNotify->Release();
      g_pConferenceNotify = NULL;
    }
  }

  return hr;
}

Variable Documentation

COBLIST* g_pListConference

Definition at line 18 of file CConf.Cpp.

COBLIST* g_pListConferenceNotify

Definition at line 19 of file CConf.Cpp.

Generated on Wed Nov 13 2024 16:54:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMUI/cData.Cpp File Reference

  • Web
  • NetMeeting
  • NMUI
Functions | Variables

cData.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

VOID | DisplayChatMsg (INmMember *pMember, PTCHAR pszMsg, int msgType, DWORD dwFlags)
VOID | DoActivateDataChannel (BOOL fActive)
VOID | DoCreateDataChannel (INmConference *pConference)
VOID | DoSendChatMsg (LPTSTR psz, INmMember *pMember)
VOID | FreeDataChannel (void)
HRESULT | HookData (INmChannel *pChannel)

Variables

INmChannelData * | g_pChannelData = NULL
CDataNotify * | g_pNotifyData = NULL

Function Documentation

VOID DisplayChatMsg | ( | INmMember * | pMember,
 |  | PTCHAR | pszMsg,
 |  | int | msgType,
 |  | DWORD | dwFlags
 | ) |  |

Definition at line 321 of file cData.Cpp.

{
  COLORREF cv = RGB(0, 0, 0);

  TCHAR sz[MAX_PATH + 1];
  ZeroMemory(sz, (MAX_PATH + 1) * sizeof(TCHAR));

  PUSER pUser = PUserFromINmMember(pMember);

  switch (msgType)
    {
  case MSG_SENT:
  {
    cv = RGB(127, 0, 127);
    if (NULL == pUser)
    {
      lstrcpyn(sz, TEXT("Msg to Everyone\0"), MAX_PATH+1);
      sz[MAX_PATH] = 0;
    }
    else
    {
      _sntprintf(sz, MAX_PATH, TEXT("Whisper to %s"), pUser -> pszName);
    }
    break;
  }
  case MSG_RECEIVED:
  {
    cv = RGB(255, 0, 255);
    if (NULL == pUser)
    {
      lstrcpyn(sz, TEXT("Message from ????\0"), MAX_PATH+1);
      sz[MAX_PATH] = 0;
    }
    else if (dwFlags & NM_DF_PRIVATE)
    {
      _sntprintf(sz, MAX_PATH, TEXT("Whisper from %s\0"), pUser -> pszName);
    }
    else if (dwFlags & NM_DF_BROADCAST)
    {
      _sntprintf(sz, MAX_PATH, TEXT("Message from %s\0"), pUser -> pszName);
    }
    break;
  }
  default:
    cv = RGB(0, 0, 0);
    break;
    }

  Log(RGB(0, 0, 0), sz);

#ifdef NMUI_CHAT_PROTOCOL
#ifndef UNICODE
  // Convert UNICODE to ANSI
  WideCharToMultiByte(CP_ACP, 0, (LPWSTR) pszMsg, -1, sz, MAX_PATH, NULL, NULL);
  pszMsg = sz;
#endif /* UNICODE */
#endif /* NMUI_CHAT_PROTOCOL */

  Log(cv, pszMsg);
}

VOID DoActivateDataChannel ( BOOL fActive )

Definition at line 483 of file cData.Cpp.

{
  HRESULT hr  = NO_ERROR;

  if (NULL == g_pChannelData)
    return;

  hr = g_pChannelData->IsActive();
  TRACE_MSG(TEXT("Data channel is %s"), (S_OK == hr) ? "Active" : "Inactive");

  hr = g_pChannelData->SetActive(fActive);
  TRACE_MSG(TEXT("Data channel SetActive Result=%s"), GetHrSz(hr));
}

VOID DoCreateDataChannel ( INmConference * pConference )

Definition at line 440 of file cData.Cpp.

{
  INmChannelData  * pChannelData  = NULL;
  HRESULT       hr      = NO_ERROR;

  if (NULL == pConference)
  {
    WARN_MSG(TEXT("No conference."));
    return;
  }

  if (NULL != g_pChannelData)
  {
    WARN_MSG(TEXT("Data channel already exists"));
  }

  hr = pConference->CreateDataChannel(&pChannelData, g_guidNMUIChat);
  if (FAILED(hr))
  {
    ERROR_MSG(TEXT("CreateDataChannel: Failed hr=%s"), GetHrSz(hr));
    return;
  }

  if (NULL == g_pChannelData)
  {
    ERROR_MSG(TEXT("DoCreateDataChannel: Failed to hook"));
  }
  else
  {
    // The AddRef was done in the hook code.
    pChannelData->Release();
  }

  TRACE_MSG(TEXT("Created Data Channel"));
}

VOID DoSendChatMsg | ( | LPTSTR | psz,
 |  | INmMember * | pMember
 | ) |  |

Definition at line 389 of file cData.Cpp.

{
  HRESULT hr  = NO_ERROR;
  UINT  cb  = lstrlen(psz) + 1; // include final null

  if ((1 == cb) || (NULL == g_pChannelData) || (MAX_PATH + 1 < cb) )
  {
    return;
  }

#ifdef NMUI_CHAT_PROTOCOL

  BYTE buffer[CB_NMUI_HDR + (MAX_PATH + 1) * sizeof(WCHAR)];
  ZeroMemory(buffer, CB_NMUI_HDR + (MAX_PATH + 1) * sizeof(WCHAR));

#ifdef UNICODE
  lstrcpyn((LPTSTR) &buffer[CB_NMUI_HDR], psz, MAX_PATH+1);
  buffer[CB_NMUI_HDR + MAX_PATH] = 0;
#else
  cb = MultiByteToWideChar(CP_ACP, 0, psz, cb, (LPWSTR) &buffer[CB_NMUI_HDR], MAX_PATH);
  cb *= 2; // adjust for UNICODE
#endif /* !UNICODE */

  // Add special prefix
  cb += CB_NMUI_HDR;
  ZeroMemory(buffer, CB_NMUI_HDR);
  * ((LPDWORD) buffer) = CB_NMUI_HDR;

  psz = (LPTSTR) buffer;

#else
  cb++; // include final null
#endif /* NMUI_CHAT_PROTOCOL */

  if ((NULL != pMember) && (S_OK == pMember->IsSelf()))
    pMember = NULL; // local machine = everyone

  hr = g_pChannelData->SendData(pMember, cb, (LPBYTE) psz, 0);
  if (FAILED(hr))
  {
    ERROR_MSG(TEXT("DoSendChatMsg: SendData failed: %s"), GetHrSz(hr));
  }
}

VOID FreeDataChannel ( void )

Definition at line 106 of file cData.Cpp.

{
  // Release all notify
  if  (NULL != g_pNotifyData)
  {
    OBJECT_MSG(TEXT("[%08X] data notify released"), g_pNotifyData);
    g_pNotifyData->Disconnect();
    g_pNotifyData->Release();
    g_pNotifyData = NULL;
  }

  if  (NULL != g_pChannelData)
  {
    OBJECT_MSG(TEXT("[%08X] data channel released"), g_pChannelData);
    g_pChannelData->Release();
    g_pChannelData = NULL;
  }
}

HRESULT HookData ( INmChannel * pChannel )

Definition at line 26 of file cData.Cpp.

{
  ASSERT(NULL != pChannel);
  if  (NULL == pChannel)
  {
    ERROR_MSG(TEXT("NULL == pChannel"));
    return E_POINTER;
  }

  HRESULT     hr    = NO_ERROR  ;
  CDataNotify * pNotify = NULL    ;

  if (NULL != g_pChannelData)
  {
    ERROR_MSG(TEXT("HookData: replacing existing g_pChannelData"));

    g_pChannelData->Release();
    g_pChannelData = NULL;
  }

  if  (NULL != g_pNotifyData)
  {
    g_pNotifyData -> Disconnect();
    g_pNotifyData -> Release();
    g_pNotifyData =  NULL;
  }

  hr = pChannel->QueryInterface(IID_INmChannelData, (void **)&g_pChannelData);
  if FAILED(hr)
  {
    ERROR_MSG(TEXT("HookData:Unable to get Data Channel"));
    return hr;
  }

  if  (NULL == g_pChannelData)
  {
    ERROR_MSG(TEXT("HookData:QI returned a NULL pointer"));
    return E_POINTER;
  }

  // keep QI ref around

    // Connect to the channel object

    pNotify = new CDataNotify();
    if (pNotify == NULL)
    {
        hr = E_OUTOFMEMORY;
    }
    else
    {
    hr = pNotify->Connect(g_pChannelData);
    if (FAILED(hr))
    {
      ERROR_MSG(TEXT("CConfNotify Failed (%s)"), GetHrSz(hr));
      pNotify->Release();
    }
    else
    {
      OBJECT_MSG(TEXT("Data Connection point established successfully"));
      g_pNotifyData = pNotify;
    }
  }

  if (FAILED(hr))
  {
    g_pChannelData->Release();
    g_pChannelData = NULL;
  }

  return hr;
}

Variable Documentation

INmChannelData* g_pChannelData = NULL

Definition at line 17 of file cData.Cpp.

CDataNotify* g_pNotifyData = NULL

Definition at line 18 of file cData.Cpp.

Generated on Wed Nov 13 2024 16:54:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMUI/cData.h File Reference

  • Web
  • NetMeeting
  • NMUI
Classes | Defines | Functions | Variables

cData.h File Reference

Go to the source code of this file.

Classes

class | CDataNotify

Defines

#define | MSG_RECEIVED 2
#define | MSG_SENT 1

Functions

VOID | DisplayChatMsg (INmMember *pMember, PTCHAR pszMsg, int msgType, DWORD dwFlags=0)
VOID | DoActivateDataChannel (BOOL fActive)
VOID | DoCreateDataChannel (INmConference *pConference)
VOID | DoSendChatMsg (LPTSTR psz, INmMember *pMember)
VOID | FreeDataChannel (void)
HRESULT | HookData (INmChannel *pData)

Variables

INmChannelData * | g_pChannelData
CDataNotify * g_pNotifyData

Define Documentation

#define MSG_RECEIVED 2

Definition at line 73 of file cData.h.

#define MSG_SENT 1

Definition at line 72 of file cData.h.

Function Documentation

VOID DisplayChatMsg | ( | INmMember * | pMember,
 |  | PTCHAR | pszMsg,
 |  | int | msgType,
 |  | DWORD | dwFlags = 0
 | ) |  |

Definition at line 321 of file cData.Cpp.

{
  COLORREF cv = RGB(0, 0, 0);

  TCHAR sz[MAX_PATH + 1];
  ZeroMemory(sz, (MAX_PATH + 1) * sizeof(TCHAR));

  PUSER pUser = PUserFromINmMember(pMember);

  switch (msgType)
    {
  case MSG_SENT:
  {
    cv = RGB(127, 0, 127);
    if (NULL == pUser)
    {
      lstrcpyn(sz, TEXT("Msg to Everyone\0"), MAX_PATH+1);
      sz[MAX_PATH] = 0;
    }
    else
    {
      _sntprintf(sz, MAX_PATH, TEXT("Whisper to %s"), pUser -> pszName);
    }
    break;
  }
  case MSG_RECEIVED:
  {
    cv = RGB(255, 0, 255);
    if (NULL == pUser)
    {
      lstrcpyn(sz, TEXT("Message from ????\0"), MAX_PATH+1);
      sz[MAX_PATH] = 0;
    }
    else if (dwFlags & NM_DF_PRIVATE)
    {
      _sntprintf(sz, MAX_PATH, TEXT("Whisper from %s\0"), pUser -> pszName);
    }
    else if (dwFlags & NM_DF_BROADCAST)
    {
      _sntprintf(sz, MAX_PATH, TEXT("Message from %s\0"), pUser -> pszName);
    }
    break;
  }
  default:
    cv = RGB(0, 0, 0);
    break;
    }

  Log(RGB(0, 0, 0), sz);

#ifdef NMUI_CHAT_PROTOCOL
#ifndef UNICODE
  // Convert UNICODE to ANSI
  WideCharToMultiByte(CP_ACP, 0, (LPWSTR) pszMsg, -1, sz, MAX_PATH, NULL, NULL);
  pszMsg = sz;
#endif /* UNICODE */
#endif /* NMUI_CHAT_PROTOCOL */

  Log(cv, pszMsg);
}

VOID DoActivateDataChannel ( BOOL fActive )

Definition at line 483 of file cData.Cpp.

{
  HRESULT hr  = NO_ERROR;

  if (NULL == g_pChannelData)
    return;

  hr = g_pChannelData->IsActive();
  TRACE_MSG(TEXT("Data channel is %s"), (S_OK == hr) ? "Active" : "Inactive");

  hr = g_pChannelData->SetActive(fActive);
  TRACE_MSG(TEXT("Data channel SetActive Result=%s"), GetHrSz(hr));
}

VOID DoCreateDataChannel ( INmConference * pConference )

Definition at line 440 of file cData.Cpp.

{
  INmChannelData  * pChannelData  = NULL;
  HRESULT       hr      = NO_ERROR;

  if (NULL == pConference)
  {
    WARN_MSG(TEXT("No conference."));
    return;
  }

  if (NULL != g_pChannelData)
  {
    WARN_MSG(TEXT("Data channel already exists"));
  }

  hr = pConference->CreateDataChannel(&pChannelData, g_guidNMUIChat);
  if (FAILED(hr))
  {
    ERROR_MSG(TEXT("CreateDataChannel: Failed hr=%s"), GetHrSz(hr));
    return;
  }

  if (NULL == g_pChannelData)
  {
    ERROR_MSG(TEXT("DoCreateDataChannel: Failed to hook"));
  }
  else
  {
    // The AddRef was done in the hook code.
    pChannelData->Release();
  }

  TRACE_MSG(TEXT("Created Data Channel"));
}

VOID DoSendChatMsg | ( | LPTSTR | psz,
 |  | INmMember * | pMember
 | ) |  |

Definition at line 389 of file cData.Cpp.

{
  HRESULT hr  = NO_ERROR;
  UINT  cb  = lstrlen(psz) + 1; // include final null

  if ((1 == cb) || (NULL == g_pChannelData) || (MAX_PATH + 1 < cb) )
  {
    return;
  }

#ifdef NMUI_CHAT_PROTOCOL

  BYTE buffer[CB_NMUI_HDR + (MAX_PATH + 1) * sizeof(WCHAR)];
  ZeroMemory(buffer, CB_NMUI_HDR + (MAX_PATH + 1) * sizeof(WCHAR));

#ifdef UNICODE
  lstrcpyn((LPTSTR) &buffer[CB_NMUI_HDR], psz, MAX_PATH+1);
  buffer[CB_NMUI_HDR + MAX_PATH] = 0;
#else
  cb = MultiByteToWideChar(CP_ACP, 0, psz, cb, (LPWSTR) &buffer[CB_NMUI_HDR], MAX_PATH);
  cb *= 2; // adjust for UNICODE
#endif /* !UNICODE */

  // Add special prefix
  cb += CB_NMUI_HDR;
  ZeroMemory(buffer, CB_NMUI_HDR);
  * ((LPDWORD) buffer) = CB_NMUI_HDR;

  psz = (LPTSTR) buffer;

#else
  cb++; // include final null
#endif /* NMUI_CHAT_PROTOCOL */

  if ((NULL != pMember) && (S_OK == pMember->IsSelf()))
    pMember = NULL; // local machine = everyone

  hr = g_pChannelData->SendData(pMember, cb, (LPBYTE) psz, 0);
  if (FAILED(hr))
  {
    ERROR_MSG(TEXT("DoSendChatMsg: SendData failed: %s"), GetHrSz(hr));
  }
}

VOID FreeDataChannel ( void )

Definition at line 160 of file cData.Cpp.

{
  // Release all notify
  if (NULL != g_pNotifyData)
  {
    g_pNotifyData->Disconnect();
    g_pNotifyData->Release();
    g_pNotifyData = NULL;
  }

  if (NULL != g_pChannelData)
  {
    g_pChannelData->Release();
    g_pChannelData = NULL;
  }
}

HRESULT HookData ( INmChannel * pData )

Definition at line 26 of file cData.Cpp.

{
  ASSERT(NULL != pChannel);
  if  (NULL == pChannel)
  {
    ERROR_MSG(TEXT("NULL == pChannel"));
    return E_POINTER;
  }

  HRESULT     hr    = NO_ERROR  ;
  CDataNotify * pNotify = NULL    ;

  if (NULL != g_pChannelData)
  {
    ERROR_MSG(TEXT("HookData: replacing existing g_pChannelData"));

    g_pChannelData->Release();
    g_pChannelData = NULL;
  }

  if  (NULL != g_pNotifyData)
  {
    g_pNotifyData -> Disconnect();
    g_pNotifyData -> Release();
    g_pNotifyData =  NULL;
  }

  hr = pChannel->QueryInterface(IID_INmChannelData, (void **)&g_pChannelData);
  if FAILED(hr)
  {
    ERROR_MSG(TEXT("HookData:Unable to get Data Channel"));
    return hr;
  }

  if  (NULL == g_pChannelData)
  {
    ERROR_MSG(TEXT("HookData:QI returned a NULL pointer"));
    return E_POINTER;
  }

  // keep QI ref around

    // Connect to the channel object

    pNotify = new CDataNotify();
    if (pNotify == NULL)
    {
        hr = E_OUTOFMEMORY;
    }
    else
    {
    hr = pNotify->Connect(g_pChannelData);
    if (FAILED(hr))
    {
      ERROR_MSG(TEXT("CConfNotify Failed (%s)"), GetHrSz(hr));
      pNotify->Release();
    }
    else
    {
      OBJECT_MSG(TEXT("Data Connection point established successfully"));
      g_pNotifyData = pNotify;
    }
  }

  if (FAILED(hr))
  {
    g_pChannelData->Release();
    g_pChannelData = NULL;
  }

  return hr;
}

Variable Documentation

INmChannelData* g_pChannelData

Definition at line 17 of file cData.Cpp.

CDataNotify* g_pNotifyData

Definition at line 18 of file cData.Cpp.

Generated on Wed Nov 13 2024 16:54:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMUI/cft.cpp File Reference

  • Web
  • NetMeeting
  • NMUI
Functions | Variables

cft.cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

VOID | DoFtCancel (void)
VOID | FreeFt (void)
HRESULT | HookFileTransfer (INmChannel *pChannel)
VOID | SendFile (INmMember *pINmMember)

Variables

INmChannelFt * | g_pChannelFt = NULL
INmFt * | g_pFt = NULL
CFileTransferNotify * | g_pNotifyFileTransfer = NULL

Function Documentation

VOID DoFtCancel ( void )

Definition at line 276 of file cft.cpp.

{
  if (NULL == g_pFt)
    return;

  HRESULT hr = g_pFt->Cancel();
}

VOID FreeFt ( void )

Definition at line 291 of file cft.cpp.

{
  if (NULL != g_pFt)
  {
    g_pFt->Release();
    g_pFt = NULL;
  }
}

HRESULT HookFileTransfer ( INmChannel * pChannel )

Definition at line 30 of file cft.cpp.

{
  HRESULT         hr    = NO_ERROR  ;
  CFileTransferNotify * pNotify = NULL    ;

  ASSERT(NULL != pChannel);
  if  (NULL == pChannel)
  {
    ERROR_MSG(TEXT("HookFileTransfer passed a Null Pointer"));
    return E_POINTER;
  }

  if  (NULL != g_pChannelFt)
  {
    ERROR_MSG(TEXT("HookFileTransfer: replacing existing g_pChannelFileTransfer"));
  }

  hr = pChannel->QueryInterface(IID_INmChannelFt, (void **)&g_pChannelFt);
  if  FAILED(hr)
  {
    ERROR_MSG(TEXT("HookFileTransfer:Unable to get File Transfer channel"));
    return hr;
  }

  if  (NULL == g_pChannelFt)
  {
    ERROR_MSG(TEXT("HookFileTransfer:QI returned a Null Pointer"));
    return E_FAIL;
  }

  // Connect to the Ft object
  pNotify = new CFileTransferNotify();
  if(NULL == pNotify)
  {
    hr = E_OUTOFMEMORY;
  }
  else
  {
    hr = pNotify->Connect(g_pChannelFt);
    if(FAILED(hr))
    {
      ERROR_MSG(TEXT("CFileTransferNotify Failed (%s)"), GetHrSz(hr));
      pNotify->Release();
    }
    else
    {
      OBJECT_MSG(TEXT("FileTransfer Connection point established successfully"));
      g_pNotifyFileTransfer = pNotify;
    }
  }

  if(FAILED(hr))
  {
    g_pChannelFt->Release();
    g_pChannelFt = NULL;
  }

  return hr;
}

VOID SendFile ( INmMember * pINmMember )

Definition at line 309 of file cft.cpp.

{
  PUSER pUser = PUserLocal();
  if (NULL == pUser)
  {
    return;
  }

  if (NULL == pUser->m_pChannelFt)
  {
    return;
  }

  BSTRING   bstrFileName(gPref.pszFileName);
  if  ((NULL == bstrFileName.GetLPBSTR()) && (NULL != gPref.pszFileName))
    return;

  INmFt * pFt = NULL;
  HRESULT   hr  = pUser->m_pChannelFt->SendFile(&pFt, pINmMember, bstrFileName, 0);

  if (SUCCEEDED(hr))
  {
    if  (NULL == pFt)
    {
      ERROR_MSG(TEXT("SendFile: NULL == pFt"));
      return;
    }

    INmMember * pMember = NULL;

    FreeFt();
    g_pFt = pFt;

    hr = pFt->GetMember( &pMember );
    if(SUCCEEDED(hr))
    {
      if(NULL == pMember)
      {
        // file was sent to everyone
      }
      else
      {
        BSTR bstrName = NULL;

        // file was sent to this user
        hr = pMember->GetName(&bstrName);
        if  (NULL != bstrName)
        {
          ::SysFreeString(bstrName);
        }

        pMember->Release();
      }
    }
  }
}

Variable Documentation

INmChannelFt* g_pChannelFt = NULL

Definition at line 19 of file cft.cpp.

INmFt* g_pFt = NULL

Definition at line 18 of file cft.cpp.

CFileTransferNotify* g_pNotifyFileTransfer = NULL

Definition at line 20 of file cft.cpp.

Generated on Wed Nov 13 2024 16:54:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMUI/cft.h File Reference

  • Web
  • NetMeeting
  • NMUI
Classes | Functions

cft.h File Reference

Go to the source code of this file.

Classes

class | CFileTransferNotify

Functions

VOID | DoFtCancel (void)
HRESULT | HookFileTransfer (INmChannel *pChannel)
VOID | SendFile (INmMember *pMember)

Function Documentation

VOID DoFtCancel ( void )

Definition at line 276 of file cft.cpp.

{
  if (NULL == g_pFt)
    return;

  HRESULT hr = g_pFt->Cancel();
}

HRESULT HookFileTransfer ( INmChannel * pChannel )

Definition at line 30 of file cft.cpp.

{
  HRESULT         hr    = NO_ERROR  ;
  CFileTransferNotify * pNotify = NULL    ;

  ASSERT(NULL != pChannel);
  if  (NULL == pChannel)
  {
    ERROR_MSG(TEXT("HookFileTransfer passed a Null Pointer"));
    return E_POINTER;
  }

  if  (NULL != g_pChannelFt)
  {
    ERROR_MSG(TEXT("HookFileTransfer: replacing existing g_pChannelFileTransfer"));
  }

  hr = pChannel->QueryInterface(IID_INmChannelFt, (void **)&g_pChannelFt);
  if  FAILED(hr)
  {
    ERROR_MSG(TEXT("HookFileTransfer:Unable to get File Transfer channel"));
    return hr;
  }

  if  (NULL == g_pChannelFt)
  {
    ERROR_MSG(TEXT("HookFileTransfer:QI returned a Null Pointer"));
    return E_FAIL;
  }

  // Connect to the Ft object
  pNotify = new CFileTransferNotify();
  if(NULL == pNotify)
  {
    hr = E_OUTOFMEMORY;
  }
  else
  {
    hr = pNotify->Connect(g_pChannelFt);
    if(FAILED(hr))
    {
      ERROR_MSG(TEXT("CFileTransferNotify Failed (%s)"), GetHrSz(hr));
      pNotify->Release();
    }
    else
    {
      OBJECT_MSG(TEXT("FileTransfer Connection point established successfully"));
      g_pNotifyFileTransfer = pNotify;
    }
  }

  if(FAILED(hr))
  {
    g_pChannelFt->Release();
    g_pChannelFt = NULL;
  }

  return hr;
}

VOID SendFile ( INmMember * pMember )

Definition at line 309 of file cft.cpp.

{
  PUSER pUser = PUserLocal();
  if (NULL == pUser)
  {
    return;
  }

  if (NULL == pUser->m_pChannelFt)
  {
    return;
  }

  BSTRING   bstrFileName(gPref.pszFileName);
  if  ((NULL == bstrFileName.GetLPBSTR()) && (NULL != gPref.pszFileName))
    return;

  INmFt * pFt = NULL;
  HRESULT   hr  = pUser->m_pChannelFt->SendFile(&pFt, pINmMember, bstrFileName, 0);

  if (SUCCEEDED(hr))
  {
    if  (NULL == pFt)
    {
      ERROR_MSG(TEXT("SendFile: NULL == pFt"));
      return;
    }

    INmMember * pMember = NULL;

    FreeFt();
    g_pFt = pFt;

    hr = pFt->GetMember( &pMember );
    if(SUCCEEDED(hr))
    {
      if(NULL == pMember)
      {
        // file was sent to everyone
      }
      else
      {
        BSTR bstrName = NULL;

        // file was sent to this user
        hr = pMember->GetName(&bstrName);
        if  (NULL != bstrName)
        {
          ::SysFreeString(bstrName);
        }

        pMember->Release();
      }
    }
  }
}

Generated on Wed Nov 13 2024 16:54:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMUI/clUtil.Cpp File Reference

  • Web
  • NetMeeting
  • NMUI
Functions

clUtil.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

POSITION | AddNode (PVOID pv, COBLIST **ppList)
DWORD | GetRegDWORD (HKEY hkRoot, LPCTSTR szSubKey, LPCTSTR szValName, DWORD dwDefault)
LPTSTR | PszFromBstr (BSTR bstr)
PVOID | RemoveNode (POSITION *pPos, COBLIST *pList)

Function Documentation

POSITION AddNode | ( | PVOID | pv,
 |  | COBLIST ** | ppList
 | ) |  |

Definition at line 504 of file clUtil.Cpp.

{
  ASSERT(NULL != ppList);
  if  (NULL == ppList)
    return NULL;

  if (NULL == *ppList)
  {
    *ppList = new COBLIST();
    if (NULL == *ppList)
      return NULL;
  }

  return (*ppList)->AddTail(pv);
}

DWORD GetRegDWORD | ( | HKEY | hkRoot,
 |  | LPCTSTR | szSubKey,
 |  | LPCTSTR | szValName,
 |  | DWORD | dwDefault
 | ) |  |

Definition at line 619 of file clUtil.Cpp.

{
  DWORD dwRet = dwDefault;

  HKEY hKey = 0;
  LONG l    = ::RegOpenKeyEx(hkRoot, szSubKey, 0, KEY_QUERY_VALUE, &hKey);

  if(ERROR_SUCCESS == l)
  {
    DWORD dwType = REG_BINARY;
    DWORD dwSize = sizeof(DWORD);

    if  (ERROR_SUCCESS != ::RegQueryValueEx(hKey, szValName, 0, &dwType, (LPBYTE) &dwRet, &dwSize))
    {
      dwRet = dwDefault;
    }

    RegCloseKey(hKey);
  }

  return dwRet;
}

LPTSTR PszFromBstr ( BSTR bstr )

Definition at line 600 of file clUtil.Cpp.

{
  if (NULL == bstr)
    return NULL;
  int cch =  WideCharToMultiByte(CP_ACP, 0, (LPWSTR)bstr, -1, NULL, 0, NULL, NULL);
  if (cch <= 0)
    return NULL;

  LPTSTR psz = PszAlloc(cch);
  if (NULL == psz)
    return NULL;

  ZeroMemory(psz, (cch + 1) * sizeof(TCHAR));

  WideCharToMultiByte(CP_ACP, 0, (LPWSTR)bstr, -1, psz, cch, NULL, NULL);
  return psz;
}

PVOID RemoveNode | ( | POSITION * | pPos,
 |  | COBLIST * | pList
 | ) |  |

Definition at line 530 of file clUtil.Cpp.

{
  if ((NULL == pList) || (NULL == pPos))
    return NULL;

  PVOID pv = pList->RemoveAt(*pPos);
  *pPos = NULL;
  return pv;
}

Generated on Wed Nov 13 2024 16:54:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMUI/clUtil.h File Reference

  • Web
  • NetMeeting
  • NMUI
Classes | Defines | Functions

clUtil.h File Reference

Go to the source code of this file.

Classes

class | BSTRING
class | BTSTR
class | CNotify
class | COBLIST
struct | COBNODE
class | RefCount

Defines

#define | POSITION COBNODE*

Functions

POSITION | AddNode (PVOID pv, COBLIST **ppList)
DWORD | GetRegDWORD (HKEY hkRoot, LPCTSTR szSubKey, LPCTSTR szValName, DWORD dwDefault)
LPTSTR | PszFromBstr (BSTR bst)
PVOID | RemoveNode (POSITION *pPos, COBLIST *pList)

Define Documentation

#define POSITION COBNODE*

Definition at line 74 of file clUtil.h.

Function Documentation

POSITION AddNode | ( | PVOID | pv,
 |  | COBLIST ** | ppList
 | ) |  |

Definition at line 497 of file clUtil.Cpp.

{
  ASSERT(NULL != ppList);
  if(NULL == ppList)
  {
    return NULL;
  }

  if (NULL == *ppList)
  {
    *ppList = new COBLIST();
    if (NULL == *ppList)
    {
      return NULL;
    }
  }

  return (*ppList)->AddTail(pv);
}

DWORD GetRegDWORD | ( | HKEY | hkRoot,
 |  | LPCTSTR | szSubKey,
 |  | LPCTSTR | szValName,
 |  | DWORD | dwDefault
 | ) |  |

Definition at line 619 of file clUtil.Cpp.

{
  DWORD dwRet = dwDefault;

  HKEY hKey = 0;
  LONG l    = ::RegOpenKeyEx(hkRoot, szSubKey, 0, KEY_QUERY_VALUE, &hKey);

  if(ERROR_SUCCESS == l)
  {
    DWORD dwType = REG_BINARY;
    DWORD dwSize = sizeof(DWORD);

    if  (ERROR_SUCCESS != ::RegQueryValueEx(hKey, szValName, 0, &dwType, (LPBYTE) &dwRet, &dwSize))
    {
      dwRet = dwDefault;
    }

    RegCloseKey(hKey);
  }

  return dwRet;
}

LPTSTR PszFromBstr ( BSTR bst )

Definition at line 627 of file clUtil.Cpp.

{
  if (NULL == bstr)
  {
    return NULL;
  }
  int cch =  WideCharToMultiByte(CP_ACP, 0, (LPWSTR)bstr, -1, NULL, 0, NULL, NULL);
  if (cch <= 0)
  {
    return NULL;
  }

  LPTSTR psz = PszAlloc(cch);
  if (NULL == psz)
  {
    return NULL;
  }

  ZeroMemory(psz, sizeof(TCHAR) * (cch + 1));

  WideCharToMultiByte(CP_ACP, 0, (LPWSTR)bstr, -1, psz, cch, NULL, NULL);
  return psz;
}

PVOID RemoveNode | ( | POSITION * | pPos,
 |  | COBLIST * | pList
 | ) |  |

Definition at line 527 of file clUtil.Cpp.

{
  if ((NULL == pList) || (NULL == pPos))
  {
    return NULL;
  }

  PVOID pv = pList->RemoveAt(*pPos);
  *pPos = NULL;
  return pv;
}

Generated on Wed Nov 13 2024 16:54:54 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMUI/Cmd.Cpp File Reference

  • Web
  • NetMeeting
  • NMUI
Typedefs | Functions

Cmd.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Typedefs

typedef BOOL(WINAPI * | LPFNDLLFUNC )(HWND)

Functions

VOID | CmdAbout (void)
VOID | CmdAudio (void)
VOID | CmdCall (void)
VOID | CmdCallAccept (void)
VOID | CmdCallCancel (void)
VOID | CmdCallConf (void)
VOID | CmdCallReject (void)
VOID | CmdChannelData (void)
VOID | CmdChat (void)
VOID | CmdClear (void)
VOID | CmdConfAppLeak (void)
VOID | CmdConfInfo (void)
VOID | CmdConfLeak (void)
VOID | CmdConfStart (void)
VOID | CmdConfStop (void)
VOID | CmdDataEnable (void)
VOID | CmdEject (void)
VOID | CmdEnableAppSharing (void)
VOID | CmdExit (void)
VOID | CmdFont (void)
VOID | CmdFtCancel (void)
VOID | CmdHelp (void)
VOID | CmdIsSharingEnabled ()
VOID | CmdLaunch (void)
VOID | CmdMonitor (void)
VOID | CmdOptions (void)
VOID | CmdSendFile (void)
VOID | CmdShare (void)
VOID | CmdShowLocal (void)
VOID | CmdSysInfo (void)
VOID | CmdSysLogOnOff (void)
VOID | CmdTopMost (void)
VOID | CmdUpdate (void)
VOID | CmdViewChat (void)
VOID | CmdViewMsg (void)
VOID | CmdViewSbar (void)
VOID | CmdViewTbar (void)
LRESULT | MsgCmdMain (HWND hwnd, UINT uMsg, WPARAM wparam, LPARAM lparam)
VOID | OnStartup (void)

Typedef Documentation

typedef BOOL(WINAPI * LPFNDLLFUNC)(HWND)

Definition at line 509 of file Cmd.Cpp.

Function Documentation

VOID CmdAbout ( void )

Definition at line 491 of file Cmd.Cpp.

{
  TCHAR szVersion[MAX_PATH + 1];
  ZeroMemory(szVersion, sizeof(TCHAR) * (MAX_PATH + 1));

  LoadString(ghInst, IDS_VERSION, szVersion, MAX_PATH);

  ShellAbout(ghwndMain, szVersion, NULL, LoadIcon(ghInst, MAKEINTRESOURCE(ICO_MAIN)));
}

VOID CmdAudio ( void )

Definition at line 230 of file Cmd.Cpp.

{
  DlgAudio();
}

VOID CmdCall ( void )

Definition at line 91 of file Cmd.Cpp.

{
  if (!DlgNewCall())
    return;
  DoCallCreate();
}

VOID CmdCallAccept ( void )

Definition at line 118 of file Cmd.Cpp.

{
  DoHandleCall(TRUE);
}

VOID CmdCallCancel ( void )

Definition at line 142 of file Cmd.Cpp.

{
  DoCancelCall();
}

VOID CmdCallConf ( void )

Definition at line 104 of file Cmd.Cpp.

{
  if (!DlgCallConf())
    return;
  DoCallConference();
}

VOID CmdCallReject ( void )

Definition at line 130 of file Cmd.Cpp.

{
  DoHandleCall(FALSE);
}

VOID CmdChannelData ( void )

Definition at line 199 of file Cmd.Cpp.

{
  DoCreateDataChannel(GetCurrentConference());
}

VOID CmdChat ( void )

Definition at line 204 of file Cmd.Cpp.

{
  TCHAR sz[MAX_PATH + 1];
  ZeroMemory(sz, (MAX_PATH+1) * sizeof(TCHAR));

  // Get the text line
  SendMessage(ghwndChat, WM_GETTEXT, (WPARAM) MAX_PATH, (LPARAM) sz);
  SendMessage(ghwndChat, EM_SETSEL, (WPARAM) 0, (LPARAM)-1);
  SendMessage(ghwndChat, WM_SETTEXT, (WPARAM) 0, (LPARAM) "");

  if (NULL != g_pChannelData)
  {
    INmMember * pMember = NULL;
    int iSel = SendMessage(ghwndUList, CB_GETCURSEL, 0, 0);
    if (CB_ERR != iSel)
    {
      PUSER pUser = (PUSER) SendMessage(ghwndUList, CB_GETITEMDATA, (WPARAM) iSel, 0);
      if (NULL != pUser)
        pMember = pUser->pMember;
    }
    DoSendChatMsg(sz, pMember);
  }

  SetFocus(ghwndChat);
}

VOID CmdClear ( void )

Definition at line 390 of file Cmd.Cpp.

{
  ClearLog();
}

VOID CmdConfAppLeak ( void )

Definition at line 256 of file Cmd.Cpp.

{
  DoSharableAppLeak();
}

VOID CmdConfInfo ( void )

Definition at line 246 of file Cmd.Cpp.

{
  DoEnumAll();
}

VOID CmdConfLeak ( void )

Definition at line 251 of file Cmd.Cpp.

{
  DoEnumMemberLeak();
}

VOID CmdConfStart ( void )

Definition at line 60 of file Cmd.Cpp.

{
  if (!DlgNewConference())
    return;

  TRACE_MSG(TEXT("Starting conference [%s] nmch=%08X"),
    (NULL != gPref.pszConferenceName) ?  gPref.pszConferenceName : TEXT("NULL"),
    gPref.dwNmch);
  DoConferenceCreate();
}

VOID CmdConfStop ( void )

Definition at line 78 of file Cmd.Cpp.

{
  TRACE_MSG(TEXT("Stopping conference..."));
  DoConferenceLeave();
}

VOID CmdDataEnable ( void )

Definition at line 190 of file Cmd.Cpp.

{
  if (NULL == g_pChannelData)
    return;

  DoActivateDataChannel(S_OK != g_pChannelData->IsActive());
}

VOID CmdEject ( void )

Definition at line 180 of file Cmd.Cpp.

{
  DlgEject();
}

VOID CmdEnableAppSharing ( void )

Definition at line 511 of file Cmd.Cpp.

{
  BOOL RetVal= IsSharingEnabled();

  if(FALSE == RetVal)
  {
    HINSTANCE hDLL      = 0;
    LPFNDLLFUNC lpfnDllFunc1  = 0;    // Function pointer
    TCHAR szDLL[MAX_PATH + 1];
    TCHAR szFunc[MAX_PATH + 1];
    int retVal          = 0;

    ZeroMemory(szDLL, (MAX_PATH + 1) * sizeof(TCHAR));
    ZeroMemory(szFunc, (MAX_PATH + 1)* sizeof(TCHAR));

    LoadString(ghInst, IDS_DLLNAME, szDLL, MAX_PATH);
    LoadString(ghInst, IDS_SETUPDD_FUNC, szFunc, MAX_PATH);

    // Load Library on the setupdd.dll
    hDLL = LoadLibrary(szDLL);

    if (hDLL != NULL)
    {
      lpfnDllFunc1 = (LPFNDLLFUNC)GetProcAddress(hDLL, szFunc);
      if (!lpfnDllFunc1)
      {
        // handle the error
        ERROR_MSG(TEXT("Could not find the %s function\r\n"), szFunc);
        retVal = FALSE;
      }
      else
      {
        TRACE_MSG(TEXT("Found the %s function\r\n"), szFunc);

        // call the function
        retVal = lpfnDllFunc1(ghwndMain);

        TRACE_MSG(TEXT("%s returns %s\r\n"), szFunc, (retVal ? "TRUE" : "FALSE"));

      }
      FreeLibrary(hDLL);

      ::MessageBox(ghwndMain,TEXT("Attempt to enable sharing... COMPLETE - REBOOT NOW!"), TEXT("AppSharing Enabled"), MB_OK);

    }
    else
    {
      ::MessageBox(ghwndMain, TEXT("Could not load Setupdd.dll"), TEXT("Error in Enabling Appsharing"), MB_OK);
    }

  }
  else
    ::MessageBox(ghwndMain, TEXT("AppSharing Already Enabled"), TEXT("AppShare Status"), MB_OK);

}

VOID CmdExit ( void )

Definition at line 404 of file Cmd.Cpp.

{
  WritePref();
  DestroyWindow(ghwndMain);
}

VOID CmdFont ( void )

Definition at line 449 of file Cmd.Cpp.

{
  CHOOSEFONT cf;
  LOGFONT    lf;
  HFONT      hfont;

  ZeroMemory(&cf, sizeof(CHOOSEFONT));
  ZeroMemory(&lf, sizeof(LOGFONT));
  ZeroMemory(&hfont, sizeof(HFONT));

  lf = gPref.lf;

  cf.lStructSize = sizeof(CHOOSEFONT);
  cf.hwndOwner = ghwndMain;
  cf.lpLogFont = &lf;
  cf.iPointSize = 10;
  cf.Flags = CF_SCREENFONTS | CF_EFFECTS | CF_INITTOLOGFONTSTRUCT;

  if (ChooseFont(&cf) != TRUE)
    return;

  hfont= CreateFontIndirect(cf.lpLogFont);
  if (NULL == hfont)
    return;

  MaybeDeleteObject((HGDIOBJ *) &ghfontEntry);
  ghfontEntry = hfont;
  SendMessage(ghwndMsg, WM_SETFONT,
    (WPARAM) ghfontEntry, MAKELPARAM(TRUE, 0));

  gPref.lf = lf;
}

VOID CmdFtCancel ( void )

Definition at line 185 of file Cmd.Cpp.

{
  DoFtCancel();
}

VOID CmdHelp ( void )

Definition at line 419 of file Cmd.Cpp.

{
  TCHAR  szFile[MAX_PATH + 1];

  ZeroMemory(szFile, (MAX_PATH + 1) * sizeof(TCHAR));

  GetModuleFileName(ghInst, szFile, MAX_PATH);

  // convert the app name to the help filename (foo.exe => foo.hlp)

  LPTSTR  tsz = SzFindLastCh(szFile, _T('.'));
  if  ( (NULL != tsz)
    &&  (MAX_PATH - 4 > (tsz - szFile) / sizeof(TCHAR))
    &&  (tsz > szFile)
    )
  {
    _sntprintf(tsz, 4, TEXT(".hlp"));
    WinHelp(ghwndMain, szFile, HELP_CONTENTS, 0);
  }
}

VOID CmdIsSharingEnabled ( )

Definition at line 576 of file Cmd.Cpp.

{
  BOOL RetVal= IsSharingEnabled();

  if(FALSE == RetVal)
    ::MessageBox(ghwndMain, TEXT("AppSharing Is Not Enabled"), TEXT("AppShare Enable Status"), MB_OK);
  else
    ::MessageBox(ghwndMain, TEXT("AppSharing Already Enabled"), TEXT("AppShare Enable Status"), MB_OK);

}

VOID CmdLaunch ( void )

Definition at line 175 of file Cmd.Cpp.

{
  DlgLaunch();
}

VOID CmdMonitor ( void )

Definition at line 26 of file Cmd.Cpp.

{
  if (NULL == g_pMgr)
  {
    if (FAILED(InitConfMgr()))
    {
      ERROR_MSG(TEXT("Failed to monitor incoming calls"));
    }
    else
    {
      TRACE_MSG(TEXT("Monitoring incoming calls"));
    }

  }
  else
  {
    FreeAllComObjects();
    //FreeConfMgr();
    ASSERT(NULL == g_pMgr);

  }

  BOOL fChecked = NULL != g_pMgr;
  SetToolbarCheck(IDM_MONITOR, fChecked);
  SetMenuCheck(IDM_MONITOR, fChecked);
}

VOID CmdOptions ( void )

Definition at line 261 of file Cmd.Cpp.

{
  DlgOptions();
}

VOID CmdSendFile ( void )

Definition at line 236 of file Cmd.Cpp.

{
  DlgSendFile();
}

VOID CmdShare ( void )

Definition at line 154 of file Cmd.Cpp.

{
  DlgShare();
}

VOID CmdShowLocal ( void )

Definition at line 164 of file Cmd.Cpp.

{
  DlgShowLocal();
}

VOID CmdSysInfo ( void )

Definition at line 241 of file Cmd.Cpp.

{
  DumpSysInfo();
}

VOID CmdSysLogOnOff ( void )

Definition at line 159 of file Cmd.Cpp.

{
  DlgLogOnOff();
}

VOID CmdTopMost ( void )

Definition at line 273 of file Cmd.Cpp.

{

  TCHAR szTitle[MAX_PATH+1];
  WNDCLASSEX  wc;
  HWND hwndTest;

  ZeroMemory(szTitle, sizeof(TCHAR) * (MAX_PATH + 1));
  ZeroMemory(&wc, sizeof(WNDCLASSEX));

  ASSERT(NULL != ghwndMain);
  ASSERT(NULL != ghInst);

//  ghAccelTable = LoadAccelerators(ghInst, MAKEINTRESOURCE(ID_APPACCEL));

  LoadString(ghInst, IDS_APP_TITLE, szTitle, MAX_PATH);

  wc.cbSize        = sizeof(WNDCLASSEX);
  wc.style         = CS_HREDRAW | CS_VREDRAW;
  wc.lpfnWndProc   = (WNDPROC)WndProc;
  wc.cbClsExtra    = 0;
  wc.cbWndExtra    = 0;
  wc.hInstance     = ghInst;
  wc.hIcon         = LoadIcon(ghInst, MAKEINTRESOURCE(ICO_TOPMOST));
  wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
  wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
  wc.lpszMenuName  = NULL;
  wc.lpszClassName = TEXT("NMTOPMOST");
  wc.hIconSm       = NULL;

  if(!RegisterClassEx(&wc))
    return;

  hwndTest = CreateWindowEx(
    WS_EX_TOPMOST,  // dwExStyle - extended styles
    TEXT("NMTOPMOST"),   // lpClassName - class name
    TEXT("szTitle"),     // window name
    WS_POPUP|WS_OVERLAPPEDWINDOW, // window style
    CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, // x, y, dx, dy
    NULL, // parent window handle
    NULL, // menu handle
    ghInst, // instance of app
    NULL); // window creation data

  if (hwndTest == NULL)
    return;

  ShowWindow(hwndTest, SW_SHOWNORMAL);
  UpdateWindow(hwndTest);

}

VOID CmdUpdate ( void )

Definition at line 267 of file Cmd.Cpp.

{
  UpdateConfView();
}

VOID CmdViewChat ( void )

Definition at line 359 of file Cmd.Cpp.

{
  gPref.fChat = !gPref.fChat;
  ShowWindow(ghwndSend, gPref.fChat ? SW_SHOW : SW_HIDE);
  ShowWindow(ghwndUList, gPref.fChat ? SW_SHOW : SW_HIDE);
  ShowHwnd(ghwndChat, gPref.fChat, IDM_VIEW_CHAT);
}

VOID CmdViewMsg ( void )

Definition at line 374 of file Cmd.Cpp.

{
  gPref.fMsg = !gPref.fMsg;
  ShowHwnd(ghwndMsg, gPref.fMsg, IDM_VIEW_MSG);
  SetToolbarCheck(IDM_VIEW_MSG, gPref.fMsg);
}

VOID CmdViewSbar ( void )

Definition at line 333 of file Cmd.Cpp.

{
  gPref.fSbar = !gPref.fSbar;
  ShowHwnd(ghwndSbar, gPref.fSbar, IDM_VIEW_SBAR);
}

VOID CmdViewTbar ( void )

Definition at line 346 of file Cmd.Cpp.

{
  gPref.fTbar = !gPref.fTbar;
  ShowHwnd(ghwndTbar, gPref.fTbar, IDM_VIEW_TBAR);
}

LRESULT MsgCmdMain | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 681 of file Cmd.Cpp.

{
  UINT wCmd = (UINT) GET_WM_COMMAND_ID(wparam, lparam);

  for (LPCMD lpcmd = _rgcmdMain; 0 != lpcmd->wCmd; lpcmd++)
  {
    if (wCmd == lpcmd->wCmd)
    {
      lpcmd->pfncmd();
      break;
    }
  }

  return 0L;
}

VOID OnStartup ( void )

Definition at line 596 of file Cmd.Cpp.

{
  if (gPref.fAutoMonitor)
  {
    CmdMonitor();
  }

  if (gPref.fAutoHost)
  {
    DoConferenceCreate();
  }

  if (gPref.fAutoCall)
  {
    DoCallCreate();
  }
}

Generated on Wed Nov 13 2024 16:54:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMUI/cMemb.Cpp File Reference

  • Web
  • NetMeeting
  • NMUI
Functions | Variables

cMemb.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

VOID | AddMember (INmMember *pMember)
PUSER | AllocUser (INmMember *pMember)
VOID | FreeAllUsers (void)
VOID | FreeUser (PUSER pUser)
int | ItemFromPUser (PUSER pUser)
PUSER | PUserFromINmMember (INmMember *pMember)
PUSER PUserLocal ()
VOID | RemoveMember (INmMember *pMember)
VOID | UpdateConfView (void)
VOID | UpdateUserChannel (PUSER pUser, INmChannel *pChannel, NM_MEMBER_NOTIFY uNotify)
VOID | UpdateUserCount (void)
VOID | UpdateUserDisplay (PUSER pUser)
VOID | UpdateUserInfo (PUSER pUser)

Variables

COBLIST * | g_pListUser = NULL
UINT | gcUsers = 0

Function Documentation

VOID AddMember ( INmMember * pMember )

Definition at line 324 of file cMemb.Cpp.

{
  PUSER pUser = AllocUser(pMember);
  if (NULL == pUser)
  {
    return;
  }

  if  (NULL == AddNode(pUser, &g_pListUser))
  {
    ERROR_MSG(TEXT("AddMember: AddNode returned Null"));
    return;
  }

  LV_ITEM  lvItem;
  ZeroMemory(&lvItem, sizeof(LV_ITEM));

  lvItem.iItem = gcUsers;
  lvItem.mask = LVIF_PARAM | LVIF_TEXT;
  lvItem.pszText = pUser->pszName;
  lvItem.cchTextMax = lstrlen(pUser->pszName);
  lvItem.lParam = (LPARAM) pUser;
  ListView_InsertItem(ghwndLView, &lvItem);

  gcUsers++;
  UpdateUserCount();
  UpdateUserDisplay(pUser);

  AddUserToUList(pUser, ghwndUList, FALSE);
}

PUSER AllocUser ( INmMember * pMember )

Definition at line 177 of file cMemb.Cpp.

{
  if  (NULL == pMember)
  {
    ERROR_MSG(TEXT("AllocUser: NULL == pMember"));
    return NULL;
  }

  HRESULT     hr      = NO_ERROR;
  BSTR      bstr    = NULL;
  INmConference * pConference = NULL;

  PUSER pUser = new USER;
  if (NULL == pUser)
  {
    return NULL;
  }

  ZeroMemory(pUser, sizeof(USER));

  pUser->pMember = pMember;
  pMember->AddRef();

  hr = pMember->GetName(&bstr);
  if (FAILED(hr))
  {
    WARN_MSG(TEXT("Problem with GetName"));
  }
  else
  {
    pUser->pszName = PszFromBstr(bstr);
    SysFreeString(bstr);
  }

  hr = pMember->GetAddr(&bstr, &pUser->uType);
  if (FAILED(hr))
  {
    WARN_MSG(TEXT("Problem with GetAddr"));
  }
  else
  {
    pUser->pszAddr = PszFromBstr(bstr);
    SysFreeString(bstr);
  }

  hr = pMember->GetNmchCaps(&pUser->uchCaps);
  if (FAILED(hr))
  {
    WARN_MSG(TEXT("Problem with GetNmchCaps"));
    pUser->uchCaps = 0;
  }

  hr = pMember->GetNmVersion(&pUser->uVersion);
  if (FAILED(hr))
  {
    WARN_MSG(TEXT("Problem with GetNmVersion"));
    pUser->uVersion = 0;
  }

  hr = pMember->GetID(&pUser->uId);
  if (FAILED(hr))
  {
    WARN_MSG(TEXT("Problem with GetID"));
    pUser->uId = 0;
  }

  pUser->fLocal = S_OK == pMember->IsSelf();
  pUser->fMcu = S_OK == pMember->IsMCU();
  pUser->fTop = FALSE;
  hr = pMember->GetConference(&pConference);
  if (FAILED(hr))
  {
    WARN_MSG(TEXT("Problem with GetConference"));
  }
  else
  {
    INmMember * pMemberTop  = NULL;
    if (SUCCEEDED(pConference->GetTopProvider(&pMemberTop)))
    {
      pUser->fTop = (pMember == pMemberTop);
      pMemberTop->Release();
    }
    pConference->Release();
  }

  return pUser;
}

VOID FreeAllUsers ( void )

Definition at line 300 of file cMemb.Cpp.

{
  if (NULL != g_pListUser)
  {
    while (!g_pListUser->IsEmpty())
    {
      PUSER pUser = (PUSER) g_pListUser -> GetHead();
      if  (NULL == pUser)
      {
        ERROR_MSG(TEXT("FreeAllUsers: NULL == pUser"));
        break;
      }

      RemoveMember(pUser->pMember);
    }
  }
}

VOID FreeUser ( PUSER pUser )

Definition at line 271 of file cMemb.Cpp.

{
  ASSERT(NULL != pUser);
  if  (NULL == pUser)
  {
    ERROR_MSG(TEXT("FreeUser: NULL == pUser"));
    return;
  }

  FreePlpv(&pUser->pszName);
  FreePlpv(&pUser->pszAddr);

  if (NULL != pUser->pMember)
  {
    OBJECT_MSG(TEXT("[%08X] member released"), pUser->pMember);
    pUser->pMember->Release();
    pUser->pMember = NULL;
  }

  delete pUser;
}

int ItemFromPUser ( PUSER pUser )

Definition at line 56 of file cMemb.Cpp.

{
  if (NULL == ghwndLView)
    return -1;

  LV_FINDINFO findInfo;
  ZeroMemory(&findInfo, sizeof(findInfo));
  findInfo.flags = LVFI_PARAM;
    findInfo.lParam = (LPARAM) pUser;
    return ListView_FindItem(ghwndLView, -1, &findInfo);
}

PUSER PUserFromINmMember ( INmMember * pMember )

Definition at line 27 of file cMemb.Cpp.

{
  if (NULL != g_pListUser)
  {
    POSITION pos = g_pListUser->GetHeadPosition();
    while (NULL != pos)
    {
      PUSER pUser = (PUSER) g_pListUser->GetNext(pos);
      if  (NULL == pUser)
      {
        ERROR_MSG(TEXT("PUserFromINmMember: NULL == pUser"));
        break;
      }

      if (pMember == pUser->pMember)
        return pUser;
    }
  }

  return NULL;
}

PUSER PUserLocal ( )

Definition at line 77 of file cMemb.Cpp.

{
  if (NULL != g_pListUser)
  {
    POSITION pos = g_pListUser->GetHeadPosition();
    while (NULL != pos)
    {
      PUSER pUser = (PUSER) g_pListUser->GetNext(pos);
      if  (NULL == pUser)
      {
        ERROR_MSG(TEXT("PUserLocal: NULL == pUser"));
        break;
      }

      if (pUser->fLocal)
        return pUser;
    }
  }

  return NULL;
}

VOID RemoveMember ( INmMember * pMember )

Definition at line 361 of file cMemb.Cpp.

{
  if (NULL == g_pListUser)
    return;

  POSITION pos = g_pListUser->GetHeadPosition();
  while (NULL != pos)
  {
    POSITION posSav = pos;

    PUSER pUser = (PUSER) g_pListUser->GetNext(pos);
    if  (NULL == pUser)
    {
      ERROR_MSG(TEXT("RemoveMember: NULL == pUser"));
      return;
    }

    if (pMember == pUser->pMember)
    {
      RemoveUserFromUList(pUser, ghwndUList);
      ListView_DeleteItem(ghwndLView, ItemFromPUser(pUser));
      FreeUser(pUser);
      pUser = NULL;

      g_pListUser->RemoveAt(posSav);

      gcUsers--;
      UpdateUserCount();
      return;
    }
  }
}

VOID UpdateConfView ( void )

Definition at line 598 of file cMemb.Cpp.

{
  if (NULL == g_pListUser)
    return;

  POSITION pos = g_pListUser->GetHeadPosition();
  while (NULL != pos)
  {
    PUSER pUser = (PUSER) g_pListUser->GetNext(pos);
    UpdateUserInfo(pUser);
    UpdateUserDisplay(pUser);
  }
}

VOID UpdateUserChannel | ( | PUSER | pUser,
 |  | INmChannel * | pChannel,
 |  | NM_MEMBER_NOTIFY | uNotify
 | ) |  |

Definition at line 400 of file cMemb.Cpp.

{
  ULONG   uch   = 0   ;
  //PVOID * ppChannel = NULL  ;

  ASSERT(NULL != pChannel);
  if  ((NULL == pChannel) || (NULL == pUser))
  {
    ERROR_MSG(TEXT("UpdateUserChannel: Null parameter passed in"));
    return;
  }

  if (FAILED(pChannel->GetNmch(&uch)))
  {
    return;
  }

  if (NM_MEMBER_ADDED == uNotify)
  {
  switch (uch)
  {
    case NMCH_AUDIO:
    {
      INmChannelAudio * pChannelAudio = NULL;
      if (SUCCEEDED(pChannel->QueryInterface(IID_INmChannelAudio, (PVOID *) &pChannelAudio)))
      {
        if  (NULL == pChannelAudio)
        {
          ERROR_MSG(TEXT("UpdateUserChannel: pChannelAudio == NULL"));
          break;
        }

        if ((S_OK == pChannelAudio->IsIncoming()) != pUser->fLocal)
        {
          ASSERT((NULL == pUser->m_pChannelAudio) || (pChannelAudio == pUser->m_pChannelAudio));
          pUser->m_pChannelAudio = pChannelAudio;
        }

        pChannelAudio->Release();
      }
      break;
    }

    case NMCH_SHARE:
      if (NULL == pUser->m_pChannelAs)
      {
        INmChannelAppShare * pChannelAs = NULL;
        if (SUCCEEDED(pChannel->QueryInterface(IID_INmChannelAppShare, (PVOID *) &pChannelAs)))
        {
          if  (NULL == pChannelAs)
          {
            ERROR_MSG(TEXT("UpdateUserChannel: pChannelAs == NULL"));
            break;
          }

          pUser->m_pChannelAs = pChannelAs;
          pChannelAs->Release();
        }
      }
      break;

    case NMCH_FT:
      if (NULL == pUser->m_pChannelFt)
      {
        INmChannelFt * pChannelFt;
        if (SUCCEEDED(pChannel->QueryInterface(IID_INmChannelFt, (PVOID *) &pChannelFt)))
        {
          if  (NULL == pChannelFt)
          {
            ERROR_MSG(TEXT("UpdateUserChannel: pChannelFt == NULL"));
            break;
          }

          pUser->m_pChannelFt = pChannelFt;
          pChannelFt->Release();
        }
      }
      break;

    case NMCH_VIDEO:
    case NMCH_DATA:
    case NMCH_NONE:
    case NMCH_ALL:
    default:
      break;
  }
  } /* CONFN_MEMBER_ADDED */

  UpdateUserDisplay(pUser);
}

VOID UpdateUserCount ( void )

Definition at line 154 of file cMemb.Cpp.

{
  TCHAR sz[MAX_PATH + 1];
  ZeroMemory(sz, (MAX_PATH + 1) * sizeof(TCHAR));

  if (1 == gcUsers)
  {
    lstrcpyn(sz, TEXT("1 user\0"), MAX_PATH+1);
    sz[MAX_PATH] = 0;
  }
  else
    _sntprintf(sz, MAX_PATH, TEXT("%d users\0"), gcUsers);

  UpdateStatusBar(sz, IDSBP_USERCOUNT, 0);
}

VOID UpdateUserDisplay ( PUSER pUser )

Definition at line 105 of file cMemb.Cpp.

{
  if  (NULL == pUser)
  {
    ERROR_MSG(TEXT("UpdateUserDisplay: NULL == pUser"));
    return;
  }

  int iItem = ItemFromPUser(pUser);
  TCHAR sz[MAX_PATH + 1];
  ZeroMemory(sz, (MAX_PATH + 1) * sizeof(TCHAR));

  ASSERT(NULL != ghwndLView);

  _sntprintf(sz, MAX_PATH, TEXT("%d\0"), pUser->uVersion);
  ListView_SetItemText(ghwndLView, iItem, ILV_VERSION, sz);

  _sntprintf(sz, MAX_PATH, TEXT("%d\0"), pUser->fMcu);
  ListView_SetItemText(ghwndLView, iItem, ILV_MCU, sz);

  _sntprintf(sz, MAX_PATH, TEXT("%d\0"), pUser->fLocal);
  ListView_SetItemText(ghwndLView, iItem, ILV_LOCAL, sz);

  _sntprintf(sz, MAX_PATH, TEXT("%X\0"), pUser->m_pChannelAudio);
  ListView_SetItemText(ghwndLView, iItem, ILV_AUDIO, sz);

  _sntprintf(sz, MAX_PATH, TEXT("%X\0"), pUser->m_pChannelAs);
  ListView_SetItemText(ghwndLView, iItem, ILV_AS, sz);

  _sntprintf(sz, MAX_PATH, TEXT("%X\0"), pUser->m_pChannelFt);
  ListView_SetItemText(ghwndLView, iItem, ILV_FT, sz);

  _sntprintf(sz, MAX_PATH, TEXT("%08X\0"), pUser->uchCaps);
  ListView_SetItemText(ghwndLView, iItem, ILV_CAPS, sz);

  ListView_SetItemText(ghwndLView, iItem, ILV_ADDR,
    (NULL == pUser->pszAddr) ? TEXT("?") : pUser->pszAddr);

  _sntprintf(sz, MAX_PATH, TEXT("%08X\0"), pUser->uId);
  ListView_SetItemText(ghwndLView, iItem, ILV_ID, sz);

}

VOID UpdateUserInfo ( PUSER pUser )

Definition at line 498 of file cMemb.Cpp.

{
  if  (NULL == pUser)
  {
    ERROR_MSG(TEXT("NULL == pUser"));
    return;
  }

  ULONG   ul    = 0;
  HRESULT hr    = NO_ERROR;
  LPTSTR  psz   = NULL;
  BSTR    bstr  = NULL;

  INmMember * pMember = pUser->pMember;

  hr = pMember->GetName(&bstr);
  if (FAILED(hr))
  {
    WARN_MSG(TEXT("Problem with GetName"));
  }
  else
  {
    psz = PszFromBstr(bstr);
    SysFreeString(bstr);

    if (0 != lstrcmp(pUser->pszName, psz))
    {
      WARN_MSG(TEXT("Replacing Name [%s] => [%s]"),
        (NULL == pUser->pszName) ? TEXT("NULL") : pUser->pszName,
        (NULL == psz) ? TEXT("NULL") : psz);
    }
    FreePlpv(&pUser->pszName);
    pUser->pszName = psz;
  }

  hr = pMember->GetAddr(&bstr, &pUser->uType);
  if (FAILED(hr))
  {
    WARN_MSG(TEXT("Problem with GetAddr"));
  }
  else
  {
    psz = PszFromBstr(bstr);
    SysFreeString(bstr);

    if(NULL != pUser->pszAddr)
    {
      if (0 != lstrcmp(pUser->pszAddr, psz))
      {
        WARN_MSG(TEXT("Replacing Addr [%s] => [%s]"),
          (NULL == pUser->pszAddr) ? TEXT("NULL") : pUser->pszAddr,
          (NULL == psz) ? TEXT("NULL") : psz);
      }
      FreePlpv(&pUser->pszAddr);
    }
    pUser->pszAddr = psz;
  }

  hr = pMember->GetNmchCaps(&ul);
  if (FAILED(hr))
  {
    WARN_MSG(TEXT("Problem with GetNmchCaps"));
    pUser->uchCaps = 0;
  }
  else if (pUser->uchCaps != ul)
  {
    WARN_MSG(TEXT("Updating uchCaps [%08X] => [%08X]"), pUser->uchCaps, ul);
    pUser->uchCaps = ul;
  }

  hr = pMember->GetNmVersion(&ul);
  if (FAILED(hr))
  {
    WARN_MSG(TEXT("Problem with GetNmVersion"));
    pUser->uVersion = 0;
  }
  else if (pUser->uVersion != ul)
  {
    WARN_MSG(TEXT("Updating version [%08X] => [%08X]"), pUser->uVersion, ul);
    pUser->uchCaps = ul;
  }

  if (pUser->fLocal != (S_OK == pMember->IsSelf()) )
  {
    ERROR_MSG(TEXT("Local User status changed?"));
  }

  if (pUser->fMcu != (S_OK == pMember->IsMCU()))
  {
    ERROR_MSG(TEXT("MCU status changed?"));
  }
}

Variable Documentation

COBLIST* g_pListUser = NULL

Definition at line 17 of file cMemb.Cpp.

UINT gcUsers = 0

Definition at line 18 of file cMemb.Cpp.

Generated on Wed Nov 13 2024 16:54:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMUI/cMemb.h File Reference

  • Web
  • NetMeeting
  • NMUI
Classes | Typedefs | Functions | Variables

cMemb.h File Reference

Go to the source code of this file.

Classes

struct | tagUser

Typedefs

typedef USER * | PUSER
typedef struct tagUser | USER

Functions

VOID | AddMember (INmMember *pMember)
VOID | AddUserToUList (PUSER pUser, HWND hwndCombo, BOOL fEveryone)
VOID | FreeAllUsers (void)
VOID | FreeUser (PUSER pUser)
PUSER | PUserFromINmMember (INmMember *pMember)
PUSER PUserLocal ()
VOID | RemoveMember (INmMember *pMember)
VOID | RemoveUserFromUList (PUSER pUser, HWND hwndCombo)
VOID | UpdateConfView (void)
VOID | UpdateUserChannel (PUSER pUser, INmChannel *pChannel, NM_MEMBER_NOTIFY uNotify)

Variables

COBLIST * g_pListUser

Typedef Documentation

typedef USER* PUSER

Definition at line 33 of file cMemb.h.

typedef struct tagUser USER

Function Documentation

VOID AddMember ( INmMember * pMember )

Definition at line 177 of file cMemb.Cpp.

{
  PUSER pUser = AllocUser(pMember);
  if (NULL == pUser)
  {
    return;
  }

  AddNode(pUser, &g_pListUser);

  LV_ITEM  lvItem;
  ClearStruct(&lvItem);           // Zero's memory
  lvItem.iItem = g_pListUser->GetItemCount();
  lvItem.mask = LVIF_PARAM | LVIF_TEXT;
  lvItem.pszText = (S_OK == pMember->IsSelf()) ? TEXT("everyone") : pUser->pszName;
  lvItem.cchTextMax = lstrlen(pUser->pszName);
  lvItem.lParam = (LPARAM) pUser;
  ListView_InsertItem(ghwndUser, &lvItem);

  DisplaySysMsg(TEXT("<joined>"), pMember);
}

VOID AddUserToUList | ( | PUSER | pUser,
 |  | HWND | hwndCombo,
 |  | BOOL | fEveryone
 | ) |  |

Definition at line 149 of file Dlg.Cpp.

{
  DWORD dwIndex = 0;

  ASSERT(NULL != pUser);
  if  (NULL == pUser)
  {
    ERROR_MSG(TEXT("AddUserToUList: NULL == pUser"));
    return;
  }

  if  (NULL == hwndCombo)
  {
    ERROR_MSG(TEXT("AddUserToUList: NULL == hwndCombo"));
    return;
  }

  if (fEveryone && (S_OK == pUser->pMember->IsSelf()))
  {
    dwIndex = SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM) TEXT("<all>"));
  }
  else
  {
    dwIndex = SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM) pUser->pszName);
  }
  SendMessage(hwndCombo, CB_SETITEMDATA, dwIndex, (LPARAM) pUser);
}

VOID FreeAllUsers ( void )

Definition at line 152 of file cMemb.Cpp.

{
  if (NULL == g_pListUser)
  {
    return;
  }

  while (!g_pListUser->IsEmpty())
  {
    USER * pUser = (USER *) g_pListUser->RemoveHead();
    ASSERT(NULL != pUser);
    FreeUser(pUser);
  }

  delete g_pListUser;
  g_pListUser = NULL;
}

VOID FreeUser ( PUSER pUser )

Definition at line 126 of file cMemb.Cpp.

{
  ASSERT(NULL != pUser);

  if(NULL == pUser)
  {
    return;
  }

  FreePlpv(&pUser->pszName);

  if (NULL != pUser->pMember)
  {
    pUser->pMember->Release();
  }

  delete pUser;
}

PUSER PUserFromINmMember ( INmMember * pMember )

Definition at line 28 of file cMemb.Cpp.

{
  if (NULL != g_pListUser)
  {
    POSITION pos = g_pListUser->GetHeadPosition();
    while (NULL != pos)
    {
      PUSER pUser = (PUSER) g_pListUser->GetNext(pos);
      if (pMember == pUser->pMember)
      {
        ASSERT(pMember == pUser->pMember);
        return pUser;
      }
    }
  }

  return NULL;
}

PUSER PUserLocal ( )

Definition at line 77 of file cMemb.Cpp.

{
  if (NULL != g_pListUser)
  {
    POSITION pos = g_pListUser->GetHeadPosition();
    while (NULL != pos)
    {
      PUSER pUser = (PUSER) g_pListUser->GetNext(pos);
      if  (NULL == pUser)
      {
        ERROR_MSG(TEXT("PUserLocal: NULL == pUser"));
        break;
      }

      if (pUser->fLocal)
        return pUser;
    }
  }

  return NULL;
}

VOID RemoveMember ( INmMember * pMember )

Definition at line 206 of file cMemb.Cpp.

{
  if (NULL == g_pListUser)
  {
    return;
  }

  POSITION pos = g_pListUser->GetHeadPosition();
  while (NULL != pos)
  {
    POSITION posSav = pos;
    PUSER pUser = (PUSER) g_pListUser->GetNext(pos);
    if (pMember == pUser->pMember)
    {
      ASSERT(pMember == pUser->pMember);
      DisplaySysMsg(TEXT("<left>"), pMember);

      ListView_DeleteItem(ghwndUser, ItemFromPUser(pUser));
      FreeUser(pUser);
      g_pListUser->RemoveAt(posSav);
      return;
    }
  }
}

VOID RemoveUserFromUList | ( | PUSER | pUser,
 |  | HWND | hwndCombo
 | ) |  |

Definition at line 184 of file Dlg.Cpp.

{
  ASSERT(NULL != pUser);
  if  (NULL == pUser)
  {
    ERROR_MSG(TEXT("RemoveUserFromList: NULL == pUser"));
    return;
  }

  if (!IsWindow(hwndCombo))
  {
    ERROR_MSG(TEXT("RemoveUserFromUList: invalid hwnd combo?"));
    return;
  }

  for (DWORD dwIndex = 0; ; dwIndex++)
  {
    DWORD dw = SendMessage(hwndCombo, CB_GETITEMDATA, dwIndex, 0);
    if (CB_ERR == dw)
    {
      break;
    }
    if (pUser == (PUSER) dw)
    {
      SendMessage(hwndCombo, CB_DELETESTRING, (WPARAM)dwIndex, 0);
      return;
    }
  }

  ERROR_MSG(TEXT("RemoveUserFromUList: Unable to delete [%s]"), pUser->pszName);
}

VOID UpdateConfView ( void )

Definition at line 598 of file cMemb.Cpp.

{
  if (NULL == g_pListUser)
    return;

  POSITION pos = g_pListUser->GetHeadPosition();
  while (NULL != pos)
  {
    PUSER pUser = (PUSER) g_pListUser->GetNext(pos);
    UpdateUserInfo(pUser);
    UpdateUserDisplay(pUser);
  }
}

VOID UpdateUserChannel | ( | PUSER | pUser,
 |  | INmChannel * | pChannel,
 |  | NM_MEMBER_NOTIFY | uNotify
 | ) |  |

Definition at line 400 of file cMemb.Cpp.

{
  ULONG   uch   = 0   ;
  //PVOID * ppChannel = NULL  ;

  ASSERT(NULL != pChannel);
  if  ((NULL == pChannel) || (NULL == pUser))
  {
    ERROR_MSG(TEXT("UpdateUserChannel: Null parameter passed in"));
    return;
  }

  if (FAILED(pChannel->GetNmch(&uch)))
  {
    return;
  }

  if (NM_MEMBER_ADDED == uNotify)
  {
  switch (uch)
  {
    case NMCH_AUDIO:
    {
      INmChannelAudio * pChannelAudio = NULL;
      if (SUCCEEDED(pChannel->QueryInterface(IID_INmChannelAudio, (PVOID *) &pChannelAudio)))
      {
        if  (NULL == pChannelAudio)
        {
          ERROR_MSG(TEXT("UpdateUserChannel: pChannelAudio == NULL"));
          break;
        }

        if ((S_OK == pChannelAudio->IsIncoming()) != pUser->fLocal)
        {
          ASSERT((NULL == pUser->m_pChannelAudio) || (pChannelAudio == pUser->m_pChannelAudio));
          pUser->m_pChannelAudio = pChannelAudio;
        }

        pChannelAudio->Release();
      }
      break;
    }

    case NMCH_SHARE:
      if (NULL == pUser->m_pChannelAs)
      {
        INmChannelAppShare * pChannelAs = NULL;
        if (SUCCEEDED(pChannel->QueryInterface(IID_INmChannelAppShare, (PVOID *) &pChannelAs)))
        {
          if  (NULL == pChannelAs)
          {
            ERROR_MSG(TEXT("UpdateUserChannel: pChannelAs == NULL"));
            break;
          }

          pUser->m_pChannelAs = pChannelAs;
          pChannelAs->Release();
        }
      }
      break;

    case NMCH_FT:
      if (NULL == pUser->m_pChannelFt)
      {
        INmChannelFt * pChannelFt;
        if (SUCCEEDED(pChannel->QueryInterface(IID_INmChannelFt, (PVOID *) &pChannelFt)))
        {
          if  (NULL == pChannelFt)
          {
            ERROR_MSG(TEXT("UpdateUserChannel: pChannelFt == NULL"));
            break;
          }

          pUser->m_pChannelFt = pChannelFt;
          pChannelFt->Release();
        }
      }
      break;

    case NMCH_VIDEO:
    case NMCH_DATA:
    case NMCH_NONE:
    case NMCH_ALL:
    default:
      break;
  }
  } /* CONFN_MEMBER_ADDED */

  UpdateUserDisplay(pUser);
}

Variable Documentation

COBLIST* g_pListUser

Definition at line 17 of file cMemb.Cpp.

Generated on Wed Nov 13 2024 16:54:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMUI/cMgr.Cpp File Reference

  • Web
  • NetMeeting
  • NMUI
Functions | Variables

cMgr.Cpp File Reference

#include "precomp.h"
#include <atlbase.h>

Go to the source code of this file.

Functions

VOID | DumpLaunchInfo (void)
VOID | DumpSysInfo (void)
VOID | FreeConfMgr (void)
HRESULT | InitConfMgr (void)
HRESULT | InitializeNm (void)
VOID | SysLogOnOff (int iDirection)

Variables

DWSTR _rgSysInfo []
const GUID | g_guid
const GUID | g_guidNMUIChat
INmManager * | g_pMgr = NULL
CMgrNotify * | g_pMgrNotify = NULL

Function Documentation

VOID DumpLaunchInfo ( void )

Definition at line 380 of file cMgr.Cpp.

{
  HRESULT       hr      = NO_ERROR  ;
  INmSysInfo    * pSysInfo    = NULL    ;
  INmConference * pConference = NULL    ;
  INmMember   * pMember   = NULL    ;

  if (NULL == g_pMgr)
    return;

  if (FAILED(g_pMgr->GetSysInfo(&pSysInfo)))
  {
    return;
  }

  GUID g = IID_INmSysInfo;

  hr = pSysInfo->SetUserData(g, reinterpret_cast<byte*>(&g), sizeof(g));
  if(SUCCEEDED(hr))
  {

    BYTE* pb  = 0;
    ULONG ul  = 0;
    if  SUCCEEDED(hr = pSysInfo->GetUserData(g, &pb, &ul))
    {
      ASSERT(ul == sizeof(g));
      ASSERT(0 == memcmp(pb, &g, ul));

      CoTaskMemFree(pb);
    }
    else
    {
      ERROR_MSG(TEXT("DumpLaunchInfo: pSysInfo->GetUserData returned 0x%08X"), hr);
    }
  }

  hr = pSysInfo->GetLaunchInfo(&pConference, &pMember);
  TRACE_MSG(TEXT("GetLaunchInfo: (%s) Conference=%08X Member=%08X"), GetHrSz(hr), pConference, pMember);

  if (NULL != pConference)
    pConference->Release();

  if (NULL != pMember)
    pMember->Release();

  pSysInfo->Release();
}

VOID DumpSysInfo ( void )

Definition at line 315 of file cMgr.Cpp.

{
  HRESULT     hr    = NO_ERROR;
  INmSysInfo  * pSysInfo  = 0;

  if (NULL == g_pMgr)
    return;

  if (FAILED(g_pMgr->GetSysInfo(&pSysInfo)))
  {
    return;
  }

  hr = pSysInfo->IsInstalled();

  TRACE_MSG(TEXT("NetMeeting IsInstalled (%s)"), GetHrSz(hr));

  TRACE_MSG(TEXT("--- NetMeeting System Information ---"));

  for (int i = 0; i < ARRAY_ELEMENTS(_rgSysInfo); i++)
  {
    BSTR bstr = NULL;
    hr = pSysInfo->GetProperty((NM_SYSPROP)_rgSysInfo[i].dw, &bstr);
    if FAILED(hr)
    {
      TRACE_MSG(TEXT("%s: HRESULT = %s"), _rgSysInfo[i].psz, GetHrSz(hr));
    }
    else
    {
      LPTSTR psz = PszFromBstr(bstr);
      TRACE_MSG(TEXT("%s = [%s]"), _rgSysInfo[i].psz, psz);
      FreePlpv(&psz);
      SysFreeString(bstr);
    }
  }
  TRACE_MSG(TEXT("--- NetMeeting System Information ---"));

  ULONG nmch  = 0;
  hr = pSysInfo->GetNmchCaps(&nmch);

  HRESULT hrInstalled = pSysInfo->IsInstalled();
  TRACE_MSG(TEXT("Installed=%s, Caps=%08X  hr=%s"), GetHrSz(hrInstalled), nmch, GetHrSz(hr));

  BSTRING bstr(TEXT("1"));
  if  (NULL == bstr.GetLPBSTR())
  {
    ERROR_MSG(TEXT("DumpSysInfo: NULL == bstr"));
  }
  else
  {
    hr = pSysInfo->SetProperty(NM_SYSPROP_DISABLE_INITIAL_ILS_LOGON, bstr);
  }

  pSysInfo->Release();

  DumpAllCalls();
}

VOID FreeConfMgr ( void )

Definition at line 129 of file cMgr.Cpp.

{
  // Release conference manager notify
  if (NULL != g_pMgrNotify)
  {
    OBJECT_MSG(TEXT("Freeing g_pMgrNotify"));
    g_pMgrNotify->Disconnect();
    g_pMgrNotify->Release();
    g_pMgrNotify = NULL;
  }

  // Release conference manager
  if (NULL != g_pMgr)
  {
    OBJECT_MSG(TEXT("Freeing g_pMgr"));
    g_pMgr->Release();
    g_pMgr = NULL;
  }
}

HRESULT InitConfMgr ( void )

Definition at line 51 of file cMgr.Cpp.

{
  HRESULT     hr  = NO_ERROR;
  LPCLASSFACTORY  pcf = NULL;

    // Notify the system we want to use the conferencing services
    // by creating a conference manager object
    hr = CoGetClassObject(CLSID_NmManager,
                          CLSCTX_INPROC,
                          NULL,
                          IID_IClassFactory,
                          (void**)&pcf);
    if (FAILED(hr))
    {
      ERROR_MSG(TEXT("CoGetClassObject Failed (%s)"), GetHrSz(hr));
    }
  else if (NULL == pcf)
  {
    ERROR_MSG(TEXT("CoGetClassObject Succeeded but returned a Null Ptr"));
    hr  = E_POINTER;
  }
    else
    {
        // Get the conference manager object
        hr = pcf->CreateInstance(NULL, IID_INmManager, (void**)&g_pMgr);
        if (FAILED(hr))
        {
        ERROR_MSG(TEXT("CreateInstance Failed (%s)"), GetHrSz(hr));
        }
        else if (NULL == g_pMgr)
    {
      ERROR_MSG(TEXT("CreateInstance Succeeded but returned a Null Ptr"));
      hr  = E_POINTER;
    }
    else
        {
            // Connect to the conference manager object
            g_pMgrNotify = new CMgrNotify();
            if (g_pMgrNotify == NULL)
            {
                hr = E_OUTOFMEMORY;
          ERROR_MSG(TEXT("CConfMgrNotify: out of memory!"));
            }
            else
            {
                hr = g_pMgrNotify->Connect(g_pMgr);
                if (FAILED(hr))
                {
            ERROR_MSG(TEXT("CConfMgrNotify Failed (%s)"), GetHrSz(hr));
                    g_pMgrNotify->Release();
                    g_pMgrNotify = NULL;
                }
                else
                {
          DumpSysInfo();
                  hr = InitializeNm();
                  DumpLaunchInfo();
        }
            }
        }

        pcf->Release();
    }

  if  FAILED(hr)
  {
    FreeConfMgr();
  }

  return hr;
}

HRESULT InitializeNm ( void )

Definition at line 32 of file cMgr.Cpp.

{
  HRESULT hr      = NO_ERROR;
  ULONG uchCaps   = 0;
  ULONG uOptions  = (ULONG) gPref.iInit;

  hr = g_pMgr->Initialize(&uOptions, &uchCaps);
  TRACE_MSG(TEXT("CConfMgr result=%s uOptions=%08X"), GetHrSz(hr), uOptions);

  return hr;
}

VOID SysLogOnOff ( int iDirection )

Definition at line 435 of file cMgr.Cpp.

{
  HRESULT     hr      = NO_ERROR  ;
  INmSysInfo  * pSysInfo    = NULL    ;
  BSTRING     bstrDirection       ;
  BSTR      bstrServer  = NULL    ;

  if (NULL == g_pMgr)
    return;

  if (FAILED(g_pMgr->GetSysInfo(&pSysInfo)))
  {
    TRACE_MSG(TEXT("NetMeeting GetSysInfo failed"));
    return;
  }

  hr = pSysInfo->GetProperty(NM_SYSPROP_IS_RUNNING, &bstrServer);
  if(FAILED(hr))
    TRACE_MSG(TEXT("NetMeeting GetProperty [Is Running] (%s) "), GetHrSz(hr));

  if  (NULL != bstrServer)
  {
    ::SysFreeString(bstrServer);
    bstrServer = NULL;
  }

  hr = pSysInfo->GetProperty(NM_SYSPROP_SERVER_NAME, &bstrServer);
  if(FAILED(hr))
    TRACE_MSG(TEXT("NetMeeting GetProperty [ServerName] (%s) "), GetHrSz(hr));
  else
    TRACE_MSG(TEXT("Server is %s"), PszFromBstr(bstrServer));

  if  (NULL != bstrServer)
  {
    ::SysFreeString(bstrServer);
    bstrServer = NULL;
  }

  bstrDirection = (iDirection==LOGON ? BSTRING(TEXT("1")) : BSTRING(TEXT("0")));

  hr = pSysInfo->SetProperty(NM_SYSPROP_LOGGED_ON, bstrDirection);

  TRACE_MSG(TEXT("NetMeeting SetProperty [Logon/Logoff] (%s)"), GetHrSz(hr));

  pSysInfo->Release();
}

Variable Documentation

DWSTR _rgSysInfo[]
Initial value:
 {
  {NM_SYSPROP_EMAIL_NAME,    TEXT("Email     ")},
  {NM_SYSPROP_SERVER_NAME,   TEXT("Server    ")},
  {NM_SYSPROP_RESOLVE_NAME,  TEXT("Resolve   ")},
  {NM_SYSPROP_FIRST_NAME,    TEXT("First Name")},
  {NM_SYSPROP_LAST_NAME,     TEXT("Last Name ")},
  {NM_SYSPROP_USER_NAME,     TEXT("Name      ")},
  {NM_SYSPROP_USER_CITY,     TEXT("City      ")},
  {NM_SYSPROP_USER_COUNTRY,  TEXT("Country   ")},
  {NM_SYSPROP_USER_COMMENTS, TEXT("Comments  ")},
  {NM_SYSPROP_USER_CATEGORY, TEXT("Category  ")},
  {NM_SYSPROP_INSTALL_DIRECTORY, TEXT("Directory ")},
  {NM_SYSPROP_APP_NAME,      TEXT("App Name  ")},
  {NM_SYSPROP_IS_RUNNING,    TEXT("Is Running")},
  {NM_SYSPROP_IN_CONFERENCE, TEXT("In Conference")},
  {NM_SYSPROP_H323_GATEWAY,  TEXT("H323 Gateway ")},
  {NM_SYSPROP_H323_GATEWAY_ENABLE, TEXT("H323 Enable  ")},
  {NM_SYSPROP_LOGGED_ON,     TEXT("Logged on    ")},
  {200,            TEXT("Build Ver   ")},
}

Definition at line 287 of file cMgr.Cpp.

const GUID g_guid
Initial value:

{ 0xd29a8c51, 0x774f, 0x11d0, { 0x8b, 0x1d, 0x0, 0xa0, 0xc9, 0x1b, 0xc9, 0xe} }

Definition at line 25 of file cMgr.Cpp.

const GUID g_guidNMUIChat
Initial value:

{ 0x9f7f48b5, 0x4a97, 0x11d3, { 0xa1, 0x2d, 0x0, 0xc0, 0x4f, 0x79, 0xc1, 0xd9 } }

Definition at line 28 of file cMgr.Cpp.

INmManager* g_pMgr = NULL

Definition at line 19 of file cMgr.Cpp.

CMgrNotify* g_pMgrNotify = NULL

Definition at line 21 of file cMgr.Cpp.

Generated on Wed Nov 13 2024 16:54:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMUI/cMgr.h File Reference

  • Web
  • NetMeeting
  • NMUI
Classes | Functions | Variables

cMgr.h File Reference

Go to the source code of this file.

Classes

class | CMgrNotify

Functions

VOID | DumpLaunchInfo (void)
VOID | DumpSysInfo (void)
VOID | FreeConfMgr (void)
INmConference * | GetCurrentConference (void)
HRESULT | InitConfMgr (void)
VOID | SysLogOnOff (int iDirection)

Variables

const GUID | g_guid
const GUID | g_guidNMUIChat
INmManager * | g_pMgr

Function Documentation

VOID DumpLaunchInfo ( void )

Definition at line 380 of file cMgr.Cpp.

{
  HRESULT       hr      = NO_ERROR  ;
  INmSysInfo    * pSysInfo    = NULL    ;
  INmConference * pConference = NULL    ;
  INmMember   * pMember   = NULL    ;

  if (NULL == g_pMgr)
    return;

  if (FAILED(g_pMgr->GetSysInfo(&pSysInfo)))
  {
    return;
  }

  GUID g = IID_INmSysInfo;

  hr = pSysInfo->SetUserData(g, reinterpret_cast<byte*>(&g), sizeof(g));
  if(SUCCEEDED(hr))
  {

    BYTE* pb  = 0;
    ULONG ul  = 0;
    if  SUCCEEDED(hr = pSysInfo->GetUserData(g, &pb, &ul))
    {
      ASSERT(ul == sizeof(g));
      ASSERT(0 == memcmp(pb, &g, ul));

      CoTaskMemFree(pb);
    }
    else
    {
      ERROR_MSG(TEXT("DumpLaunchInfo: pSysInfo->GetUserData returned 0x%08X"), hr);
    }
  }

  hr = pSysInfo->GetLaunchInfo(&pConference, &pMember);
  TRACE_MSG(TEXT("GetLaunchInfo: (%s) Conference=%08X Member=%08X"), GetHrSz(hr), pConference, pMember);

  if (NULL != pConference)
    pConference->Release();

  if (NULL != pMember)
    pMember->Release();

  pSysInfo->Release();
}

VOID DumpSysInfo ( void )

Definition at line 315 of file cMgr.Cpp.

{
  HRESULT     hr    = NO_ERROR;
  INmSysInfo  * pSysInfo  = 0;

  if (NULL == g_pMgr)
    return;

  if (FAILED(g_pMgr->GetSysInfo(&pSysInfo)))
  {
    return;
  }

  hr = pSysInfo->IsInstalled();

  TRACE_MSG(TEXT("NetMeeting IsInstalled (%s)"), GetHrSz(hr));

  TRACE_MSG(TEXT("--- NetMeeting System Information ---"));

  for (int i = 0; i < ARRAY_ELEMENTS(_rgSysInfo); i++)
  {
    BSTR bstr = NULL;
    hr = pSysInfo->GetProperty((NM_SYSPROP)_rgSysInfo[i].dw, &bstr);
    if FAILED(hr)
    {
      TRACE_MSG(TEXT("%s: HRESULT = %s"), _rgSysInfo[i].psz, GetHrSz(hr));
    }
    else
    {
      LPTSTR psz = PszFromBstr(bstr);
      TRACE_MSG(TEXT("%s = [%s]"), _rgSysInfo[i].psz, psz);
      FreePlpv(&psz);
      SysFreeString(bstr);
    }
  }
  TRACE_MSG(TEXT("--- NetMeeting System Information ---"));

  ULONG nmch  = 0;
  hr = pSysInfo->GetNmchCaps(&nmch);

  HRESULT hrInstalled = pSysInfo->IsInstalled();
  TRACE_MSG(TEXT("Installed=%s, Caps=%08X  hr=%s"), GetHrSz(hrInstalled), nmch, GetHrSz(hr));

  BSTRING bstr(TEXT("1"));
  if  (NULL == bstr.GetLPBSTR())
  {
    ERROR_MSG(TEXT("DumpSysInfo: NULL == bstr"));
  }
  else
  {
    hr = pSysInfo->SetProperty(NM_SYSPROP_DISABLE_INITIAL_ILS_LOGON, bstr);
  }

  pSysInfo->Release();

  DumpAllCalls();
}

VOID FreeConfMgr ( void )

Definition at line 164 of file CConf.Cpp.

{
  // Release conference manager notify
  if (NULL != g_pMgrNotify)
  {
    g_pMgrNotify->Disconnect();
    g_pMgrNotify->Release();
    g_pMgrNotify = NULL;
  }

  // Release conference manager
  if (NULL != g_pMgr)
  {
    g_pMgr->Release();
    g_pMgr = NULL;
  }
}

INmConference* GetCurrentConference ( void )

Definition at line 28 of file CConf.Cpp.

{
  if (NULL == g_pListConference)
    return NULL;

  return (INmConference *) g_pListConference->GetTail();
}

HRESULT InitConfMgr ( void )

Definition at line 115 of file CConf.Cpp.

{
  HRESULT hr      = NO_ERROR;
  LPCLASSFACTORY pcf  = NULL;

    // Notify the system we want to use the conferencing services
    // by creating a conference manager object
    hr = CoGetClassObject(CLSID_NmManager,
                          CLSCTX_INPROC,
                          NULL,
                          IID_IClassFactory,
                          (void**)&pcf);
    if (SUCCEEDED(hr))
    {
        // Get the conference manager object
        hr = pcf->CreateInstance(NULL, IID_INmManager, (void**)&g_pMgr);
      if (SUCCEEDED(hr))
        {
            // Connect to the conference manager object
            g_pMgrNotify = new CMgrNotify();
            if (NULL != g_pMgrNotify)
            {
                hr = g_pMgrNotify->Connect(g_pMgr);
          if (SUCCEEDED(hr))
                {
                  ULONG uchCaps = NMCH_ALL;
                  ULONG uOptions = 0;
          hr = g_pMgr->Initialize(&uOptions, &uchCaps);
          if(FAILED(hr))
          {
            return hr;
          }
        }
            }
        }

        pcf->Release();
    }

  return hr;
}

VOID SysLogOnOff ( int iDirection )

Definition at line 435 of file cMgr.Cpp.

{
  HRESULT     hr      = NO_ERROR  ;
  INmSysInfo  * pSysInfo    = NULL    ;
  BSTRING     bstrDirection       ;
  BSTR      bstrServer  = NULL    ;

  if (NULL == g_pMgr)
    return;

  if (FAILED(g_pMgr->GetSysInfo(&pSysInfo)))
  {
    TRACE_MSG(TEXT("NetMeeting GetSysInfo failed"));
    return;
  }

  hr = pSysInfo->GetProperty(NM_SYSPROP_IS_RUNNING, &bstrServer);
  if(FAILED(hr))
    TRACE_MSG(TEXT("NetMeeting GetProperty [Is Running] (%s) "), GetHrSz(hr));

  if  (NULL != bstrServer)
  {
    ::SysFreeString(bstrServer);
    bstrServer = NULL;
  }

  hr = pSysInfo->GetProperty(NM_SYSPROP_SERVER_NAME, &bstrServer);
  if(FAILED(hr))
    TRACE_MSG(TEXT("NetMeeting GetProperty [ServerName] (%s) "), GetHrSz(hr));
  else
    TRACE_MSG(TEXT("Server is %s"), PszFromBstr(bstrServer));

  if  (NULL != bstrServer)
  {
    ::SysFreeString(bstrServer);
    bstrServer = NULL;
  }

  bstrDirection = (iDirection==LOGON ? BSTRING(TEXT("1")) : BSTRING(TEXT("0")));

  hr = pSysInfo->SetProperty(NM_SYSPROP_LOGGED_ON, bstrDirection);

  TRACE_MSG(TEXT("NetMeeting SetProperty [Logon/Logoff] (%s)"), GetHrSz(hr));

  pSysInfo->Release();
}

Variable Documentation

const GUID g_guid

Definition at line 25 of file cMgr.Cpp.

const GUID g_guidNMUIChat

Definition at line 28 of file cMgr.Cpp.

INmManager* g_pMgr

Definition at line 18 of file CConf.Cpp.

Generated on Wed Nov 13 2024 16:54:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMUI/cshare.cpp File Reference

  • Web
  • NetMeeting
  • NMUI
Functions | Variables

cshare.cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

VOID | DoEnumApps (void)
VOID | FreeAs (void)
HRESULT | HookAppShare (INmChannel *pChannel)

Variables

INmChannelAppShare * | g_pChannelAppShare = NULL
CAppShareNotify * | g_pNotifyAppShare = NULL

Function Documentation

VOID DoEnumApps ( void )

Definition at line 23 of file cshare.cpp.

{
  HRESULT         hr    = NO_ERROR  ;
  ULONG         cFetched  = 0     ;
  IEnumNmSharableApp  * pEnum   = NULL    ;
  INmSharableApp    * pApp    = NULL    ;

  if (NULL == g_pChannelAppShare)
    return;

  if(fRobCheck != FALSE)
  {
    MessageBox(NULL, TEXT("DoEnumApps: Error"), TEXT("Error!!!"), MB_OK);
  }

  fRobCheck = TRUE;

  hr = g_pChannelAppShare->EnumSharableApp(&pEnum);

  if (FAILED(hr))
    return;

  while (1)
  {
    hr = pEnum->Next(1, &pApp, &cFetched);

    if  (NULL != pApp)
    {
      pApp->Release();
      pApp = NULL;
    }

    if FAILED(hr)
      break;
  }

  pEnum->Release();

  fRobCheck = FALSE;
}

VOID FreeAs ( void )

Definition at line 147 of file cshare.cpp.

{
  if(NULL != g_pNotifyAppShare)
  {
    g_pNotifyAppShare->Disconnect();
    g_pNotifyAppShare->Release();
    g_pNotifyAppShare = NULL;
  }

  if (NULL != g_pChannelAppShare)
  {
    g_pChannelAppShare->Release();
    g_pChannelAppShare = NULL;
  }
}

HRESULT HookAppShare ( INmChannel * pChannel )

Definition at line 72 of file cshare.cpp.

{
  HRESULT       hr    = NO_ERROR  ;
  CAppShareNotify * pNotify = NULL    ;

  ASSERT(NULL != pChannel);
  if  (NULL == pChannel)
  {
    ERROR_MSG(TEXT("HookAppShare: NULL == pChannel"));
    return E_POINTER;
  }

  //  Clean up any previous pointers [that were otherwise going to be overwritten]

  if  ((NULL != g_pNotifyAppShare) || (NULL != g_pChannelAppShare))
  {
    ERROR_MSG(TEXT("HookAppShare: replacing existing App Sharing pointers"));
    FreeAs();
  }

  //  Get new app sharing channel

  hr = pChannel->QueryInterface(IID_INmChannelAppShare, (void **)&g_pChannelAppShare);
  if (FAILED(hr))
  {
    ERROR_MSG(TEXT("HookAppShare:Unable to get Application Sharing Channel"));
    return hr;
  }

  if  (NULL == g_pChannelAppShare)
  {
    ERROR_MSG(TEXT("HookAppShare: QI Application Sharing Channel returned NULL"));
    return E_FAIL;
  }

  // keep QI ref around

    // Connect to the channel object

    pNotify = new CAppShareNotify();
    if (pNotify == NULL)
    {
        hr = E_OUTOFMEMORY;
    }
    else
    {
    hr = pNotify->Connect(g_pChannelAppShare);
    if (FAILED(hr))
    {
      ERROR_MSG(TEXT("CConfNotify Failed (%s)"), GetHrSz(hr));
      pNotify->Release();
    }
    else
    {
      OBJECT_MSG(TEXT("AppSharing Connection point established successfully"));
      g_pNotifyAppShare = pNotify;
    }
  }

  if (FAILED(hr))
  {
    g_pChannelAppShare->Release();
    g_pChannelAppShare = NULL;
  }

  return hr;
}

Variable Documentation

INmChannelAppShare* g_pChannelAppShare = NULL

Definition at line 17 of file cshare.cpp.

CAppShareNotify* g_pNotifyAppShare = NULL

Definition at line 18 of file cshare.cpp.

Generated on Wed Nov 13 2024 16:54:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMUI/cshare.h File Reference

  • Web
  • NetMeeting
  • NMUI
Classes | Functions | Variables

cshare.h File Reference

Go to the source code of this file.

Classes

class | CAppShareNotify

Functions

VOID | DoCreateAppShareChannel (INmConference *pConference)
VOID | FreeAppShareChannel (void)
HRESULT | HookAppShare (INmChannel *pAppShare)

Variables

INmChannelAppShare * | g_pChannelAppShare
CAppShareNotify * g_pNotifyAppShare

Function Documentation

VOID DoCreateAppShareChannel ( INmConference * pConference )
VOID FreeAppShareChannel ( void )

Definition at line 115 of file cShare.Cpp.

{
  // Release all notify
  if (NULL != g_pNotifyAppShare)
  {
    g_pNotifyAppShare->Disconnect();
    g_pNotifyAppShare->Release();
    g_pNotifyAppShare = NULL;
  }

  if (NULL != g_pChannelAppShare)
  {
    g_pChannelAppShare->Release();
    g_pChannelAppShare = NULL;
  }
}

HRESULT HookAppShare ( INmChannel * pAppShare )

Definition at line 72 of file cshare.cpp.

{
  HRESULT       hr    = NO_ERROR  ;
  CAppShareNotify * pNotify = NULL    ;

  ASSERT(NULL != pChannel);
  if  (NULL == pChannel)
  {
    ERROR_MSG(TEXT("HookAppShare: NULL == pChannel"));
    return E_POINTER;
  }

  //  Clean up any previous pointers [that were otherwise going to be overwritten]

  if  ((NULL != g_pNotifyAppShare) || (NULL != g_pChannelAppShare))
  {
    ERROR_MSG(TEXT("HookAppShare: replacing existing App Sharing pointers"));
    FreeAs();
  }

  //  Get new app sharing channel

  hr = pChannel->QueryInterface(IID_INmChannelAppShare, (void **)&g_pChannelAppShare);
  if (FAILED(hr))
  {
    ERROR_MSG(TEXT("HookAppShare:Unable to get Application Sharing Channel"));
    return hr;
  }

  if  (NULL == g_pChannelAppShare)
  {
    ERROR_MSG(TEXT("HookAppShare: QI Application Sharing Channel returned NULL"));
    return E_FAIL;
  }

  // keep QI ref around

    // Connect to the channel object

    pNotify = new CAppShareNotify();
    if (pNotify == NULL)
    {
        hr = E_OUTOFMEMORY;
    }
    else
    {
    hr = pNotify->Connect(g_pChannelAppShare);
    if (FAILED(hr))
    {
      ERROR_MSG(TEXT("CConfNotify Failed (%s)"), GetHrSz(hr));
      pNotify->Release();
    }
    else
    {
      OBJECT_MSG(TEXT("AppSharing Connection point established successfully"));
      g_pNotifyAppShare = pNotify;
    }
  }

  if (FAILED(hr))
  {
    g_pChannelAppShare->Release();
    g_pChannelAppShare = NULL;
  }

  return hr;
}

Variable Documentation

INmChannelAppShare* g_pChannelAppShare

Definition at line 17 of file cShare.Cpp.

CAppShareNotify* g_pNotifyAppShare

Definition at line 18 of file cShare.Cpp.

Generated on Wed Nov 13 2024 16:54:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMUI/Debug.Cpp File Reference

  • Web
  • NetMeeting
  • NMUI
Defines | Functions

Debug.Cpp File Reference

#include "precomp.h"
#include <atlbase.h>
#include <atlconv.h>

Go to the source code of this file.

Defines

#define | STRING_CASE(val) case val: pcsz = TEXT(#val); break

Functions

VOID FAR PASCAL | AssertProc (LPTSTR lpszMsg, LPTSTR lpszAssert, LPTSTR lpszFile, UINT line)
VOID | ClearLog (void)
VOID | DoEnumAll (void)
VOID | DoEnumChannelMember (INmChannel *pChannel)
VOID | DoEnumConferenceMember (INmConference *pConference)
VOID | DoEnumMemberLeak (void)
VOID | DoSharableAppLeak (void)
VOID | DumpAllCalls (void)
VOID | DumpCallInfo (INmCall *pCall)
VOID | DumpChannelInfo (INmChannel *pChannel)
VOID | DumpConferenceInfo (INmConference *pConference)
VOID | DumpMemberInfo (INmMember *pMember)
VOID | ErrorMsg (LPTSTR ptszFormat,...)
LPCTSTR | GetCallStateSz (NM_CALL_STATE uState)
LPCTSTR | GetCollaborationStateSz (NM_SHARE_STATE uState)
LPCTSTR | GetConferenceStateSz (NM_CONFERENCE_STATE uState)
LPCTSTR | GetConfnSz (CONFN confn)
LPCTSTR | GetHrSz (HRESULT hr)
LPCTSTR | GetNmchSz (ULONG uch)
VOID | Log (COLORREF cv, LPTSTR pszMsg)
VOID | LogMsg (COLORREF cv, LPTSTR tszFormat,...)
VOID | TraceMsg (LPTSTR ptszFormat,...)
VOID | WarnMsg (LPTSTR ptszFormat,...)

Define Documentation

#define STRING_CASE ( val ) case val: pcsz = TEXT(#val); break

Definition at line 20 of file Debug.Cpp.

Function Documentation

VOID FAR PASCAL AssertProc | ( | LPTSTR | lpszMsg,
 |  | LPTSTR | lpszAssert,
 |  | LPTSTR | lpszFile,
 |  | UINT | line
 | ) |  |

Definition at line 246 of file Debug.Cpp.

{
  int  id = 0;
  TCHAR szBuffer[1024]; // a big buffer
  ZeroMemory(szBuffer, 1024 * sizeof(TCHAR));

  _sntprintf(szBuffer, 1023, TEXT("Assert: %s\nFile %s, Line %d"),
    (lpszMsg && *lpszMsg) ? lpszMsg : lpszAssert,
    lpszFile ? lpszFile : TEXT(""), line);

#ifdef DEBUG
  OutputDebugString(szBuffer);
#endif

  do {
    id = MessageBox(NULL, szBuffer, TEXT("NmUi Assert"),
          MB_ICONHAND | MB_ABORTRETRYIGNORE | MB_SYSTEMMODAL);

    switch (id)
    {
    case IDRETRY:
      DebugBreak();
      break;
    case IDABORT:
      FatalAppExit(0, szBuffer);
      break;
    case IDIGNORE:
    default:
      break;
    }
  } while (id == IDRETRY);
}

VOID ClearLog ( void )

Definition at line 301 of file Debug.Cpp.

{
  SendMessage(ghwndMsg, LB_RESETCONTENT, 0, 0);
}

VOID DoEnumAll ( void )

Definition at line 870 of file Debug.Cpp.

{
  HRESULT       hr    = NO_ERROR;
  IEnumNmChannel  * pEnum   = NULL;
  ULONG       cFetched  = 0;
  ULONG       cChannel  = 0;
  INmConference * pConference = GetCurrentConference();

  if (NULL == pConference)
  {
    TRACE_MSG(TEXT("No current conference"));
    return;
  }

  DumpConferenceInfo(pConference);

  DoEnumConferenceMember(pConference);

  hr = pConference->GetChannelCount(&cChannel);
  if (FAILED(hr))
  {
      ERROR_MSG(TEXT("GetChannelCount Failed (%s)"), GetHrSz(hr));
      return;
  }
  TRACE_MSG(TEXT("%d channels in conference"), cChannel);

  if (cChannel > 10)
    cChannel = 10;

  hr = pConference->EnumChannel(&pEnum);
  if (FAILED(hr))
  {
      ERROR_MSG(TEXT("EnumChannel Failed (%s)"), GetHrSz(hr));
      return;
  }

  if  (NULL == pEnum)
  {
    ERROR_MSG(TEXT("EnumChannel returned NULL ptr"));
    return;
  }

  INmChannel * rgpChannel[10];
  for (int i = 0; i < 10; i++)
    rgpChannel[i] = NULL;

  hr = pEnum->Next(cChannel, rgpChannel, &cFetched);
  if (FAILED(hr))
  {
      ERROR_MSG(TEXT("EnumMember Failed (%s)"), GetHrSz(hr));
  }
  else
  {
    for (UINT iChannel = 0; iChannel < cFetched; iChannel++)
    {
      if  (NULL != rgpChannel[iChannel])
      {
        DumpChannelInfo(rgpChannel[iChannel]);
        DoEnumChannelMember(rgpChannel[iChannel]);
        rgpChannel[iChannel]->Release();
        rgpChannel[iChannel] = NULL;
      }
      else
      {
        ERROR_MSG(TEXT("DoEnumAll: rgpChannel[iChannel] == NULL"));
      }
    }
  }

  pEnum->Release();
}

VOID DoEnumChannelMember ( INmChannel * pChannel )

Definition at line 718 of file Debug.Cpp.

{
  HRESULT       hr    = NO_ERROR;
  IEnumNmMember * pEnum   = NULL;
  ULONG       cFetched  = 0;
  ULONG       cMember = 0;

  ASSERT(NULL != pChannel);
  if  (NULL == pChannel)
  {
    ERROR_MSG(TEXT("DoEnumChannelMember: NULL == pChannel"));
    return;
  }

  hr = pChannel->GetMemberCount(&cMember);
  if (FAILED(hr))
  {
      ERROR_MSG(TEXT("GetMemberCount Failed (%s)"), GetHrSz(hr));
      return;
  }
  TRACE_MSG(TEXT("%d members in channel (%08X)"), cMember, pChannel);

  if (0 == cMember)
    return;

  if (cMember > 10)
    cMember = 10;

  hr = pChannel->EnumMember(&pEnum);
  if (FAILED(hr))
  {
      ERROR_MSG(TEXT("EnumMember Failed (%s)"), GetHrSz(hr));
      return;
  }
  else if (NULL == pEnum)
  {
    ERROR_MSG(TEXT("EnumMember returned a Null ptr"));
    return;
  }

  INmMember * rgpMember[10];
  for (int i = 0; i < 10; i++)
    rgpMember[i] = NULL;

  hr = pEnum->Next(cMember, rgpMember, &cFetched);
  if (FAILED(hr))
  {
      ERROR_MSG(TEXT("EnumMember Failed (%s)"), GetHrSz(hr));
  }
  else
  {
    for (UINT iMember = 0; iMember < cFetched; iMember++)
    {
      DumpMemberInfo(rgpMember[iMember]);

      if  (NULL != rgpMember[iMember])
      {
        rgpMember[iMember]->Release();
        rgpMember[iMember] = NULL;
      }
    }
  }

  pEnum->Release();
  pEnum = NULL;
}

VOID DoEnumConferenceMember ( INmConference * pConference )

Definition at line 793 of file Debug.Cpp.

{
  HRESULT       hr    = NO_ERROR;
  IEnumNmMember * pEnum   = NULL;
  ULONG       cFetched  = 0;
  ULONG       cMember = 0;

  ASSERT(NULL != pConference);
  if  (NULL == pConference)
  {
    ERROR_MSG(TEXT("DoEnumConferenceMember: NULL == pConference"));
    return;
  }

  hr = pConference->GetMemberCount(&cMember);
  if (FAILED(hr))
  {
      ERROR_MSG(TEXT("GetMemberCount Failed (%s)"), GetHrSz(hr));
      return;
  }
  TRACE_MSG(TEXT("%d members in conference (%08X)"), cMember, pConference);

  if (cMember > 10)
    cMember = 10;

  hr = pConference->EnumMember(&pEnum);
  if (FAILED(hr))
  {
      ERROR_MSG(TEXT("EnumMember Failed (%s)"), GetHrSz(hr));
      return;
  }

  if  (NULL == pEnum)
  {
    ERROR_MSG(TEXT("EnumMember returned Null ptr"));
    return;
  }

  INmMember * rgpMember[10];
  BSTR      bstrAddr  = NULL;
  NM_ADDR_TYPE  uType;

  for (int i = 0; i < 10; i++)
    rgpMember[i] = NULL;

  hr = pEnum->Next(cMember, rgpMember, &cFetched);
  if (FAILED(hr))
  {
      ERROR_MSG(TEXT("EnumMember Failed (%s)"), GetHrSz(hr));
  }
  else
  {
    for (UINT iMember = 0; iMember < cFetched; iMember++)
    {
      if  (NULL != rgpMember[iMember])
      {
        hr = rgpMember[iMember] ->GetAddr(&bstrAddr, &uType);
        DumpMemberInfo(rgpMember[iMember]);
        rgpMember[iMember]->Release();
        rgpMember[iMember] = NULL;
      }
      else
        ERROR_MSG(TEXT("rgpMember[iMember] == NULL"));
    }
  }

  pEnum->Release();
  pEnum = NULL;
}

VOID DoEnumMemberLeak ( void )

Definition at line 948 of file Debug.Cpp.

{

  HRESULT       hr    = NO_ERROR;
  IEnumNmMember * pEnum   = NULL;
  INmMember   * pm    = NULL;
  INmConference * pConference = GetCurrentConference();
  UINT i;

  if (NULL == pConference)
  {
    TRACE_MSG(TEXT("No current conference"));
    return;
  }

  for(i=0; i < 10; i++)
  {
    hr = pConference->EnumMember(&pEnum);
    if  (SUCCEEDED(hr) && (NULL != pEnum))
    {
      while(pEnum->Next(1, &pm, NULL) == NO_ERROR)
      {
        if  (NULL != pm)
        {
          pm->Release();
          pm = NULL;
        }
      }

      pEnum->Release();
      pEnum = NULL;
    }
    else
    {
      ERROR_MSG(TEXT("DoEnumMemberLeak: Error INmMember::EnumMember"));
    }
  }

}

VOID DoSharableAppLeak ( void )

Definition at line 993 of file Debug.Cpp.

{

  HRESULT         hr  = NO_ERROR  ;
  IEnumNmSharableApp  * pEnum = NULL    ;
  INmSharableApp    * pa  = NULL    ;

  if  (NULL == g_pChannelAppShare)
  {
    ERROR_MSG(TEXT("DoSharableAppLeak: NULL == g_pChannelAppShare"));
    return;
  }

  for(UINT i=0; i < 1000; i++)
  {
    hr = g_pChannelAppShare->EnumSharableApp(&pEnum);
    if  (SUCCEEDED(hr) && (NULL != pEnum))
    {
      while(pEnum->Next(1, &pa, NULL) == NO_ERROR)
      {
        if  (NULL != pa)
        {
          pa->Release();
          pa = NULL;
        }
      }

      pEnum->Release();
      pEnum = NULL;
    }
    else
    {
      ERROR_MSG(TEXT("DoSharableAppLeak: NULL == pEnum"));
    }
  }

}

VOID DumpAllCalls ( void )

Definition at line 487 of file Debug.Cpp.

{
  if (NULL == g_pListCall)
    return;

  for (POSITION pos = g_pListCall->GetHeadPosition(); NULL != pos; )
  {
    INmCall * pCall = (INmCall *) g_pListCall->GetNext(pos);
    DumpCallInfo(pCall);
  }
}

VOID DumpCallInfo ( INmCall * pCall )

Definition at line 418 of file Debug.Cpp.

{
  HRESULT       hr      = NO_ERROR  ;
  BSTR        bstrName    = NULL    ;
  BSTR        bstrAddr    = NULL    ;
  NM_ADDR_TYPE    uType           ;
  NM_CALL_STATE   uState          ;
  INmConference * pConference = NULL    ;

  OBJECT_MSG(TEXT("[%08X] - dump call info"), pCall);
  if (NULL == pCall)
  {
    ERROR_MSG(TEXT("DumpCallInfo: Invalid Call"));
    return;
  }

  hr = pCall->GetName(&bstrName);
  if (FAILED(hr))
  {
    bstrName = NULL;
      ERROR_MSG(TEXT("DumpCallInfo: GetName failed"));
  }

  hr = pCall->GetAddr(&bstrAddr, &uType);
  if (FAILED(hr))
  {
    bstrAddr = NULL;
    uType = NM_ADDR_UNKNOWN;
      ERROR_MSG(TEXT("DumpCallInfo: GetAddr failed"));
  }

    if (FAILED(pCall->GetState(&uState)))
    {
    uState = NM_CALL_INVALID;
      ERROR_MSG(TEXT("DumpCallInfo: GetState failed"));
    }

  hr = pCall->GetConference(&pConference);
  if (FAILED(hr))
  {
      WARN_MSG(TEXT("DumpCallInfo: GetConference failed %s"), GetHrSz(hr));
  }
  else if (NULL == pConference)
  {
    WARN_MSG(TEXT("DumpCallInfo: GetConference returned a null ptr"));
  }

  TRACE_MSG(TEXT("Call=[%s] Addr=[%s], Type=%d, State=%s %s conf=%08X"),
    (LPTSTR) BTSTR(bstrName), (LPTSTR) BTSTR(bstrAddr),
    uType, GetCallStateSz(uState),
    (S_OK == pCall->IsIncoming()) ? TEXT("(Incoming)") : TEXT(""), pConference);

  if (NULL != pConference)
  {
    pConference->Release();
    pConference = NULL;
  }

  SysFreeString(bstrName);
  SysFreeString(bstrAddr);
}

VOID DumpChannelInfo ( INmChannel * pChannel )

Definition at line 635 of file Debug.Cpp.

{
  HRESULT hr    = NO_ERROR;
  ULONG uch   = 0;
  ULONG cMember = 0;

  if  (NULL == pChannel)
  {
    ERROR_MSG(TEXT("DumpChannelInfo: NULL == pChannel"));
    return;
  }

  hr = pChannel->GetNmch(&uch);
  if (FAILED(hr))
  {
    ERROR_MSG(TEXT("GetNmch failed"));
    uch = 0;
  }

  hr = pChannel->GetMemberCount(&cMember);
  if (FAILED(hr))
  {
    ERROR_MSG(TEXT("GetMemberCount failed"));
    cMember = 0;
  }

  TRACE_MSG(TEXT("[%08X] - Channel=[%s] MemberCount=%d"), pChannel, GetNmchSz(uch), cMember);
  switch (uch)
    {
  case NMCH_AUDIO:
  {
    INmChannelAudio * pChannelAudio = NULL;
    hr = pChannel->QueryInterface(IID_INmChannelAudio, (void **)&pChannelAudio);
    if (FAILED(hr))
    {
      ERROR_MSG(TEXT("Not an audio channel?"));
    }
    else if (NULL == pChannelAudio)
    {
      ERROR_MSG(TEXT("DumpChannelInfo: NULL == pChannelAudio"));
    }
    else
    {
      NM_AUDIO_STATE uState ;
      pChannelAudio->GetState(&uState);
      TRACE_MSG(TEXT("Audio State: %d"), uState);
      pChannelAudio->Release();
      pChannelAudio = NULL;
    }
    break;
  }

  case NMCH_VIDEO:
    break;

  case NMCH_DATA:
  {
    INmChannelData * pChannelData = NULL;
    hr = pChannel->QueryInterface(IID_INmChannelData, (void **)&pChannelData);
    if (FAILED(hr) || (NULL == pChannelData))
    {
      ERROR_MSG(TEXT("Not a data channel?"));
    }
    else
    {
      TRACE_MSG(TEXT("Data channel is %s"),
        (S_OK == pChannelData->IsActive()) ? TEXT("Active") : TEXT("Inactive"));
      pChannelData->Release();
      pChannelData = NULL;
    }
    break;
  }
  default:
    break;
    }
}

VOID DumpConferenceInfo ( INmConference * pConference )

Definition at line 506 of file Debug.Cpp.

{
  HRESULT       hr      = NO_ERROR  ;
  BSTR        bstr    = NULL    ;
  ULONG       cMember   = 0     ;
  ULONG       cChannel  = 0     ;
  NM_CONFERENCE_STATE uState          ;

  if (NULL == pConference)
  {
    ERROR_MSG(TEXT("DumpConferenceInfo: Invalid conference"));
    return;
  }

  hr = pConference->GetName(&bstr);
  if (FAILED(hr))
  {
    ERROR_MSG(TEXT("GetName failed"));
    bstr = NULL;
  }

  hr = pConference->GetState(&uState);
  if (FAILED(hr))
  {
    ERROR_MSG(TEXT("GetState failed?"));
  }

  hr = pConference->GetMemberCount(&cMember);
  if (FAILED(hr))
  {
    ERROR_MSG(TEXT("GetMemberCount failed"));
    cMember = 0;
  }

  hr = pConference->GetChannelCount(&cChannel);
  if (FAILED(hr))
  {
    ERROR_MSG(TEXT("GetChannelCount failed"));
    cChannel = 0;
  }

  TRACE_MSG(TEXT("[%08X] - Conference=[%s] state=%s"), pConference,
    (LPTSTR) BTSTR(bstr), GetConferenceStateSz(uState));
  TRACE_MSG(TEXT("  MemberCount=%d, ChannelCount=%d"), cMember, cChannel);

  SysFreeString(bstr);
}

VOID DumpMemberInfo ( INmMember * pMember )

Definition at line 561 of file Debug.Cpp.

{
  HRESULT     hr      = NO_ERROR  ;
  BSTR      bstr    = NULL    ;
  BOOL      fLocal    = FALSE   ;
  BOOL      fMcu    = FALSE   ;
  BOOL      fTop    = FALSE   ;
  ULONG     uchCaps   = 0     ;
  ULONG     uVer    = 0     ;
  INmConference * pConference = NULL    ;

  if  (NULL == pMember)
  {
    ERROR_MSG(TEXT("DumpMemberInfo: NULL == pMember"));
    return;
  }

  hr = pMember->GetName(&bstr);
  if (FAILED(hr))
  {
    ERROR_MSG(TEXT("Problem with GetName"));
  }

  hr = pMember->GetNmchCaps(&uchCaps);
  if (FAILED(hr))
  {
    ERROR_MSG(TEXT("Problem with GetNmchCaps"));
    uchCaps = 0;
  }

  hr = pMember->GetNmVersion(&uVer);
  if (FAILED(hr))
  {
    ERROR_MSG(TEXT("Problem with GetNmVersion"));
    uVer = 0;
  }

  fLocal = S_OK == pMember->IsSelf();
  fMcu = S_OK == pMember->IsMCU();

  fTop = FALSE;
  hr = pMember->GetConference(&pConference);
  if (FAILED(hr) || (NULL == pConference))
  {
    TRACE_MSG(TEXT("Problem with GetConference"));
  }
  else
  {
    INmMember * pMemberTop  = NULL;
    if (SUCCEEDED(pConference->GetTopProvider(&pMemberTop)) && (NULL != pMemberTop))
    {
      fTop = (pMember == pMemberTop);

      pMemberTop->Release();
      pMemberTop = NULL;
    }

    pConference->Release();
    pConference = NULL;
  }

  TRACE_MSG(TEXT("[%08X] Member=[%s] "), pMember, (LPTSTR) BTSTR(bstr));
  TRACE_MSG(TEXT("Local=%d, MCU=%d, Top=%d, uch=%08X, version=%d"), fLocal, fMcu, fTop, uchCaps, uVer);

  SysFreeString(bstr);
}

VOID ErrorMsg | ( | LPTSTR | ptszFormat,
 |  |  | ...
 | ) |  |

Definition at line 366 of file Debug.Cpp.

{
  TCHAR szMsg[1024];
  va_list v1;

  ZeroMemory(szMsg, 1024 * sizeof(TCHAR));

  va_start(v1, ptszFormat);
  _vsntprintf(szMsg, 1023, ptszFormat, v1);
  va_end(v1);

  Log(RGB(255, 0, 0), szMsg);

#ifdef DEBUG
  OutputDebugString(szMsg);
  OutputDebugString(TEXT("\r\n"));
#endif
}

LPCTSTR GetCallStateSz ( NM_CALL_STATE uState )

Definition at line 161 of file Debug.Cpp.

{
  LPCTSTR pcsz  = NULL;
  static TCHAR _szMsg[256];

  switch (uState)
    {
  STRING_CASE(NM_CALL_INVALID);
  STRING_CASE(NM_CALL_INIT);
  STRING_CASE(NM_CALL_RING);
  STRING_CASE(NM_CALL_SEARCH);
  STRING_CASE(NM_CALL_WAIT);
  STRING_CASE(NM_CALL_ACCEPTED);
  STRING_CASE(NM_CALL_REJECTED);
  STRING_CASE(NM_CALL_CANCELED);

  default:
    ZeroMemory(_szMsg, 256 * sizeof(TCHAR));
    _sntprintf(_szMsg, 255, TEXT("NM_CALL_%04X\0"), uState);
    pcsz = _szMsg;
    break;
    }
  return pcsz;
}

LPCTSTR GetCollaborationStateSz ( NM_SHARE_STATE uState )

Definition at line 220 of file Debug.Cpp.

{
  LPCTSTR pcsz  = NULL;
  static TCHAR _szMsg[256];

  switch (uState)
    {
  STRING_CASE(NM_SHARE_COLLABORATING);
  STRING_CASE(NM_SHARE_UNKNOWN);
  STRING_CASE(NM_SHARE_IN_CONTROL);
  STRING_CASE(NM_SHARE_WORKING_ALONE);

  default:
    ZeroMemory(_szMsg, 256 * sizeof(TCHAR));
    _sntprintf(_szMsg, 255, TEXT("NM_SHARE_%04X\0"), uState);
    pcsz = _szMsg;
    break;
    }
  return pcsz;
}

LPCTSTR GetConferenceStateSz ( NM_CONFERENCE_STATE uState )

Definition at line 193 of file Debug.Cpp.

{
  LPCTSTR pcsz  = NULL;
  static TCHAR _szMsg[256];

  switch (uState)
    {
  STRING_CASE(NM_CONFERENCE_IDLE);
  STRING_CASE(NM_CONFERENCE_WAITING);
  STRING_CASE(NM_CONFERENCE_INITIALIZING);
  STRING_CASE(NM_CONFERENCE_ACTIVE);

  default:
    ZeroMemory(_szMsg, 256 * sizeof(TCHAR));
    _sntprintf(_szMsg, 255, TEXT("NM_CONFERENCE_%04X\0"), uState);
    pcsz = _szMsg;
    break;
    }
  return pcsz;
}

LPCTSTR GetConfnSz ( CONFN confn )

Definition at line 90 of file Debug.Cpp.

{
  LPCTSTR pcsz  = NULL;
  static TCHAR _szMsg[256];

  switch (confn)
    {
  STRING_CASE(CONFN_FT_UI);
  STRING_CASE(CONFN_FT_OFFERED);
  STRING_CASE(CONFN_FT_STARTED);
  STRING_CASE(CONFN_FT_PROGRESS);
  STRING_CASE(CONFN_FT_COMPLETE);
  STRING_CASE(CONFN_FT_CANCELED);

  STRING_CASE(CONFN_CALL_INCOMPATIBLE);
  STRING_CASE(CONFN_CALL_OLDER);
  STRING_CASE(CONFN_CALL_NEWER);
  STRING_CASE(CONFN_CALL_IGNORED);
  STRING_CASE(CONFN_CALL_FAILED);
  STRING_CASE(CONFN_CALL_IN_CONFERENCE);

  STRING_CASE(CONFN_NM_STARTED);
  STRING_CASE(CONFN_NM_STOPPED);

  default:
    ZeroMemory(_szMsg, 256 * sizeof(TCHAR));
    _sntprintf(_szMsg, 255, TEXT("CONFN_%08X\0"), confn);
    pcsz = _szMsg;
    break;
    }
  return pcsz;
}

LPCTSTR GetHrSz ( HRESULT hr )

Definition at line 28 of file Debug.Cpp.

{
  LPCTSTR pcsz  = NULL;
  static TCHAR _szHRESULT[128];

  switch (hr)
    {
  STRING_CASE(S_OK);
  STRING_CASE(S_FALSE);

  STRING_CASE(NM_E_NOT_INITIALIZED);
  STRING_CASE(NM_E_CHANNEL_ALREADY_EXISTS);
  STRING_CASE(NM_E_NO_T120_CONFERENCE);
  STRING_CASE(NM_E_NOT_ACTIVE);

  STRING_CASE(DRAGDROP_S_CANCEL);
  STRING_CASE(DRAGDROP_S_DROP);
  STRING_CASE(DRAGDROP_S_USEDEFAULTCURSORS);

  STRING_CASE(E_UNEXPECTED);
  STRING_CASE(E_NOTIMPL);
  STRING_CASE(E_OUTOFMEMORY);
  STRING_CASE(E_INVALIDARG);
  STRING_CASE(E_NOINTERFACE);
  STRING_CASE(E_POINTER);
  STRING_CASE(E_HANDLE);
  STRING_CASE(E_ABORT);
  STRING_CASE(E_FAIL);
  STRING_CASE(E_ACCESSDENIED);

  STRING_CASE(CLASS_E_NOAGGREGATION);

  STRING_CASE(CO_E_NOTINITIALIZED);
  STRING_CASE(CO_E_ALREADYINITIALIZED);
  STRING_CASE(CO_E_INIT_ONLY_SINGLE_THREADED);

  STRING_CASE(REGDB_E_INVALIDVALUE);
  STRING_CASE(REGDB_E_CLASSNOTREG);
  STRING_CASE(REGDB_E_IIDNOTREG);

  STRING_CASE(DV_E_DVASPECT);
  STRING_CASE(DV_E_LINDEX);
  STRING_CASE(DV_E_TYMED);
  STRING_CASE(DV_E_FORMATETC);

  default:
    ZeroMemory(_szHRESULT, 128 * sizeof(TCHAR));
    _sntprintf(_szHRESULT, 127, TEXT("%#lx\0"), hr);
    pcsz = _szHRESULT;
    break;
    }

  return pcsz;
}

LPCTSTR GetNmchSz ( ULONG uch )

Definition at line 130 of file Debug.Cpp.

{
  LPCTSTR pcsz  = NULL;
  static TCHAR _szMsg[256];

  switch (uch)
    {
  case NMCH_DATA:  pcsz = TEXT("Data");  break;
  case NMCH_AUDIO: pcsz = TEXT("Audio"); break;
  case NMCH_VIDEO: pcsz = TEXT("Video"); break;
  case NMCH_SHARE: pcsz = TEXT("Share"); break;
  case NMCH_FT:    pcsz = TEXT("Ft");    break;

  case NMCH_ALL:
  case NMCH_NONE:
  default:
    ZeroMemory(_szMsg, 256 * sizeof(TCHAR));
    _sntprintf(_szMsg, 255, TEXT("%04X\0"), uch);
    pcsz = _szMsg;
    break;
    }
  return pcsz;
}

VOID Log | ( | COLORREF | cv,
 |  | LPTSTR | pszMsg
 | ) |  |

Definition at line 286 of file Debug.Cpp.

{
  int iItem = SendMessage(ghwndMsg, LB_ADDSTRING, 0, (LPARAM) pszMsg);

  SendMessage(ghwndMsg, LB_SETITEMDATA, (WPARAM)iItem, (LPARAM) cv);

  PostMessage(ghwndMsg, WM_VSCROLL, SB_BOTTOM, 0);
}

VOID LogMsg | ( | COLORREF | cv,
 |  | LPTSTR | tszFormat,
 |  |  | ...
 | ) |  |

Definition at line 392 of file Debug.Cpp.

{
  TCHAR tszMsg[1024];
  va_list v1;

  ZeroMemory(tszMsg, 1024 * sizeof(TCHAR));

  va_start(v1, tszFormat);
  _vsntprintf(tszMsg, 1023, tszFormat, v1);
  va_end(v1);

  Log(cv, tszMsg);

#ifdef DEBUG
  OutputDebugString(tszMsg);
  OutputDebugString(TEXT("\r\n"));
#endif
}

VOID TraceMsg | ( | LPTSTR | ptszFormat,
 |  |  | ...
 | ) |  |

Definition at line 313 of file Debug.Cpp.

{

  TCHAR szMsg[1024];
  va_list v1;

  ZeroMemory(szMsg, 1024 * sizeof(TCHAR));

  va_start(v1, ptszFormat);
  _vsntprintf(szMsg, 1023, ptszFormat, v1);
  va_end(v1);

  Log(RGB(0, 0, 0), szMsg);

#ifdef DEBUG
  OutputDebugString(szMsg);
  OutputDebugString(TEXT("\r\n"));
#endif
}

VOID WarnMsg | ( | LPTSTR | ptszFormat,
 |  |  | ...
 | ) |  |

Definition at line 340 of file Debug.Cpp.

{
  TCHAR szMsg[1024];
  va_list v1;

  ZeroMemory(szMsg, 1024 * sizeof(TCHAR));

  va_start(v1, ptszFormat);
  _vsntprintf(szMsg, 1023, ptszFormat, v1);
  va_end(v1);

  Log(RGB(0, 0, 255), szMsg);

#ifdef DEBUG
  OutputDebugString(szMsg);
  OutputDebugString(TEXT("\r\n"));
#endif
}

Generated on Wed Nov 13 2024 16:54:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMUI/Dlg.Cpp File Reference

  • Web
  • NetMeeting
  • NMUI
Defines | Functions | Variables

Dlg.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Defines

#define | ILV_AS_HWND 0
#define | ILV_AS_NAME 2
#define | ILV_AS_STATUS 1
#define | NM_NT_DISPLAY_DRIVER_KEY _T("System\\CurrentControlSet\\Services\\mnmdd")
#define | NT_DRIVER_START_DISABLED 0x4
#define | REGVAL_INSTALL_DIR TEXT("InstallationDirectory")
#define | REGVAL_NM_NT_DISPLAY_DRIVER_ENABLED _T("Start")

Functions

VOID | _InitGuidLBox (HWND hwnd)
VOID | AddUserToUList (PUSER pUser, HWND hwndCombo, BOOL fEveryone)
LRESULT CALLBACK | AudioDlgProc (HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT CALLBACK | CallConfDlgProc (HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT CALLBACK | CallDlgProc (HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT CALLBACK | ConferenceDlgProc (HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
BOOL | DlgAudio (VOID)
BOOL | DlgCallConf (VOID)
BOOL | DlgEject (VOID)
BOOL | DlgLaunch (VOID)
BOOL | DlgLogOnOff (VOID)
BOOL | DlgNewCall (VOID)
BOOL | DlgNewConference (VOID)
BOOL | DlgOptions (VOID)
BOOL | DlgSendFile (VOID)
BOOL | DlgShare (VOID)
BOOL | DlgShowLocal (VOID)
VOID | DrawUserItem (LPDRAWITEMSTRUCT lpdis)
LRESULT CALLBACK | EjectDlgProc (HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
VOID | FreeShareList (HWND hwnd)
DWORD | GetLBoxDw (HWND hwndCombo)
VOID | InitializeUserList (HWND hwndCombo, BOOL fEveryone)
VOID | InitLBox (HWND hwndCombo, DWSTR *pdwstr, UINT cElt, DWORD dwDefault)
VOID | InitShareList (HWND hdlg)
VOID | InitUserLBox (HWND hdlg, BOOL fEveryone)
BOOL | IsSharingEnabled (VOID)
LRESULT CALLBACK | LaunchDlgProc (HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT CALLBACK | LogOnOffDlgProc (HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT CALLBACK | OptionsDlgProc (HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
VOID | RemoveUserFromUList (PUSER pUser, HWND hwndCombo)
LRESULT CALLBACK | SendFileDlgProc (HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT CALLBACK | ShareDlgProc (HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT CALLBACK | ShowLocalDlgProc (HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
VOID | UpdateAudioSettings (HWND hdlg)
VOID | UpdateShareList (HWND hwnd)

Variables

DWSTR _rgAddrType []
DWSTR _rgCallType []

Define Documentation

#define ILV_AS_HWND 0

Definition at line 873 of file Dlg.Cpp.

#define ILV_AS_NAME 2

Definition at line 875 of file Dlg.Cpp.

#define ILV_AS_STATUS 1

Definition at line 874 of file Dlg.Cpp.

#define NM_NT_DISPLAY_DRIVER_KEY _T("System\\CurrentControlSet\\Services\\mnmdd")

Definition at line 17 of file Dlg.Cpp.

#define NT_DRIVER_START_DISABLED 0x4

Definition at line 19 of file Dlg.Cpp.

#define REGVAL_INSTALL_DIR TEXT("InstallationDirectory")

Definition at line 20 of file Dlg.Cpp.

#define REGVAL_NM_NT_DISPLAY_DRIVER_ENABLED _T("Start")

Definition at line 18 of file Dlg.Cpp.

Function Documentation

VOID _InitGuidLBox ( HWND hwnd )

Definition at line 1189 of file Dlg.Cpp.

{
  HRESULT     hr    = NO_ERROR  ;
  DWORD     dwIndex = 0     ;
  INmSysInfo  * pSysInfo  = NULL    ;

  GUID      guid;
  ZeroMemory(&guid, sizeof(GUID));

  TCHAR     szGuid[MAX_PATH + 1];
  ZeroMemory(szGuid, (MAX_PATH + 1)*sizeof(TCHAR));

  if  (NULL == g_pMgr)
  {
    ERROR_MSG(TEXT("_InitGuidLBox: NULL == g_pMgr"));
    return;
  }

  hr = g_pMgr->GetSysInfo(&pSysInfo);
  if (FAILED(hr))
  {
    ERROR_MSG(TEXT("GetSysInfo Failed hr=%s"), GetHrSz(hr));
    return;
  }

  if  (NULL == pSysInfo)
  {
    ERROR_MSG(TEXT("GetSysInfo returned a Null Ptr"));
    return;
  }

  // TODO: use INmMgr::GetNmApp to enumerate local items

  GuidToSz((GUID *)&g_guid, szGuid);
  dwIndex = SendMessage(hwnd, CB_ADDSTRING, 0, (LPARAM) szGuid);

  ZeroMemory(szGuid, (MAX_PATH + 1) * sizeof(TCHAR));
  GuidToSz((GUID *)&g_guidNMUIChat, szGuid);
  dwIndex = SendMessage(hwnd, CB_ADDSTRING, 0, (LPARAM) szGuid);

  memset(&guid, 0x00, sizeof(GUID));
  GuidToSz((GUID *)&guid, szGuid);
  dwIndex = SendMessage(hwnd, CB_ADDSTRING, 0, (LPARAM) szGuid);

  memset(&guid, 0x11, sizeof(GUID));
  GuidToSz((GUID *)&guid, szGuid);
  dwIndex = SendMessage(hwnd, CB_ADDSTRING, 0, (LPARAM) szGuid);

  memset(&guid, 0x22, sizeof(GUID));
  GuidToSz((GUID *)&guid, szGuid);
  dwIndex = SendMessage(hwnd, CB_ADDSTRING, 0, (LPARAM) szGuid);

  SendMessage(hwnd, CB_SETCURSEL, 0, 0);
  pSysInfo->Release();
}

VOID AddUserToUList | ( | PUSER | pUser,
 |  | HWND | hwndCombo,
 |  | BOOL | fEveryone
 | ) |  |

Definition at line 149 of file Dlg.Cpp.

{
  DWORD dwIndex = 0;

  ASSERT(NULL != pUser);
  if  (NULL == pUser)
  {
    ERROR_MSG(TEXT("AddUserToUList: NULL == pUser"));
    return;
  }

  if  (NULL == hwndCombo)
  {
    ERROR_MSG(TEXT("AddUserToUList: NULL == hwndCombo"));
    return;
  }

  if (fEveryone && (S_OK == pUser->pMember->IsSelf()))
  {
    dwIndex = SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM) TEXT("<all>"));
  }
  else
  {
    dwIndex = SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM) pUser->pszName);
  }
  SendMessage(hwndCombo, CB_SETITEMDATA, dwIndex, (LPARAM) pUser);
}

LRESULT CALLBACK AudioDlgProc | ( | HWND | hdlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 711 of file Dlg.Cpp.

{
  HRESULT hr  = NO_ERROR;

  switch (uMsg)
  {
  case WM_INITDIALOG:
  {
    CenterWindow(hdlg, ghwndMain);

    InitUserLBox(hdlg, FALSE);

    SendDlgItemMessage (hdlg, IDC_LEVEL, TBM_SETRANGEMIN, FALSE,
      0 );
    SendDlgItemMessage (hdlg, IDC_LEVEL, TBM_SETRANGEMAX, FALSE,
      NM_MAX_AUDIO_LEVEL );
    SendDlgItemMessage (hdlg, IDC_LEVEL, TBM_SETTICFREQ,
      8096, 0 );
    SendDlgItemMessage (hdlg, IDC_LEVEL, TBM_SETPAGESIZE,
      0, 8096 );
    SendDlgItemMessage (hdlg, IDC_LEVEL, TBM_SETLINESIZE,
      0, 256 );

    UpdateAudioSettings(hdlg);
    return TRUE;
  }

  case WM_DRAWITEM:
    DrawUserItem((LPDRAWITEMSTRUCT) lParam);
    break;

  case WM_COMMAND:
    switch (GET_WM_COMMAND_ID(wParam, lParam))
    {
    case IDOK:
    case IDCANCEL:
      EndDialog(hdlg, 1);
      return TRUE;

    case IDB_UPDATE:
    {
      UpdateAudioSettings(hdlg);
      return TRUE;
    }

    case IDC_ACTIVE:
    {
      int iSel = SendDlgItemMessage(hdlg, IDL_USERS, CB_GETCURSEL, 0, 0);
      if (CB_ERR != iSel)
      {
        PUSER pUser = (PUSER) SendDlgItemMessage(hdlg, IDL_USERS,
          CB_GETITEMDATA, (WPARAM) iSel, 0);

        if  (NULL == pUser)
        {
          ERROR_MSG(TEXT("AudioDlgProc (IDC_ACTIVE): NULL == pUser"));
        }
        else
        {
          INmChannelAudio * pChannel = pUser->m_pChannelAudio;
          if (NULL != pChannel)
          {
            // Flip the active state
            BOOL fActive = (S_OK != pChannel->IsActive());
            hr = pChannel->SetActive(fActive);
            TRACE_MSG(TEXT("SetActive result=%s"), GetHrSz(hr));
          }
        }
      }
      return TRUE;
    }

    case IDC_PAUSE:
    {
      int iSel = SendDlgItemMessage(hdlg, IDL_USERS, CB_GETCURSEL, 0, 0);
      if (CB_ERR != iSel)
      {
        PUSER pUser = (PUSER) SendDlgItemMessage(hdlg, IDL_USERS,
          CB_GETITEMDATA, (WPARAM) iSel, 0);

        if  (NULL == pUser)
        {
          ERROR_MSG(TEXT("AudioDlgProc (IDC_PAUSE): NULL == pUser"));
        }
        else
        {
          INmChannelAudio * pChannel = pUser->m_pChannelAudio;
          if (NULL != pChannel)
          {
            // Flip the pause state
            DWORD fPause = IsDlgButtonChecked(hdlg, IDC_PAUSE);
            hr = pChannel->SetProperty(NM_AUDPROP_PAUSE, fPause);
            TRACE_MSG(TEXT("SetProperty result=%s"), GetHrSz(hr));
          }
        }
      }
      return TRUE;
    }

    default:
      return TRUE;
    } /* switch (cmd) */

  case WM_HSCROLL:
  {
    DWORD dwLevel = SendDlgItemMessage( hdlg, IDC_LEVEL,
          TBM_GETPOS, 0, 0 );
    SetDlgItemInt(hdlg, IDE_LEVEL, dwLevel, FALSE);

    if (TB_ENDTRACK == LOWORD(wParam))
    {
      int iSel = SendDlgItemMessage(hdlg, IDL_USERS, CB_GETCURSEL, 0, 0);
      if (CB_ERR != iSel)
      {
        PUSER pUser = (PUSER) SendDlgItemMessage(hdlg, IDL_USERS,
          CB_GETITEMDATA, (WPARAM) iSel, 0);

        if  (NULL == pUser)
        {
          ERROR_MSG(TEXT("AudioDlgProc (WM_HSCROLL): NULL == pUser"));
        }
        else
        {
          INmChannelAudio * pChannel = pUser->m_pChannelAudio;
          if (NULL != pChannel)
          {
            hr = pChannel->SetProperty(NM_AUDPROP_LEVEL, dwLevel);
            TRACE_MSG(TEXT("SetProperty result=%s"), GetHrSz(hr));
          }
        }
      }
    }
    return TRUE;
  }

  default:
    break;
  } /* switch (uMsg) */

  return FALSE;
}

LRESULT CALLBACK CallConfDlgProc | ( | HWND | hdlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 442 of file Dlg.Cpp.

{
  switch (uMsg)
  {
  case WM_INITDIALOG:
    CenterWindow(hdlg, ghwndMain);

    SetDlgItemText(hdlg, IDE_ADDR,       gPref.pszAddr);
    SetDlgItemText(hdlg, IDE_CONFERENCE, gPref.pszConferenceName);
    SetDlgItemText(hdlg, IDE_PASSWORD,   gPref.pszPassword);

    InitLBox(GetDlgItem(hdlg, IDL_ADDR_TYPE),
      _rgAddrType, ARRAY_ELEMENTS(_rgAddrType), gPref.nmAddrType);
    InitLBox(GetDlgItem(hdlg, IDL_CALL_TYPE),
      _rgCallType, ARRAY_ELEMENTS(_rgCallType), gPref.nmCallType);
    return TRUE;

  case WM_COMMAND:
    switch (GET_WM_COMMAND_ID(wParam, lParam))
    {
    case IDOK:
      GetDlgItemPsz(hdlg, IDE_ADDR,       &gPref.pszAddr);
      GetDlgItemPsz(hdlg, IDE_CONFERENCE, &gPref.pszConferenceName);
      GetDlgItemPsz(hdlg, IDE_PASSWORD,   &gPref.pszPassword);

      gPref.nmAddrType = (NM_ADDR_TYPE) GetLBoxDw(GetDlgItem(hdlg, IDL_ADDR_TYPE));
      gPref.nmCallType = (NM_CALL_TYPE) GetLBoxDw(GetDlgItem(hdlg, IDL_CALL_TYPE));

      EndDialog(hdlg, 0);
      return TRUE;

    case IDCANCEL:
      EndDialog(hdlg, 1);
      return TRUE;

    default:
      return TRUE;
    } /* switch (cmd) */

  default:
    break;
  } /* switch (uMsg) */

  return FALSE;
}

LRESULT CALLBACK CallDlgProc | ( | HWND | hdlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 508 of file Dlg.Cpp.

{
  switch (uMsg)
  {
  case WM_INITDIALOG:
    CenterWindow(hdlg, ghwndMain);

    SetDlgItemText(hdlg, IDE_ADDR, gPref.pszAddr);
    InitLBox(GetDlgItem(hdlg, IDL_ADDR_TYPE),
      _rgAddrType, ARRAY_ELEMENTS(_rgAddrType), gPref.nmAddrType);
    InitLBox(GetDlgItem(hdlg, IDL_CALL_TYPE),
      _rgCallType, ARRAY_ELEMENTS(_rgCallType), gPref.nmCallType);
    return TRUE;

  case WM_COMMAND:
    switch (GET_WM_COMMAND_ID(wParam, lParam))
    {
    case IDOK:
      GetDlgItemPsz(hdlg, IDE_ADDR, &gPref.pszAddr);

      gPref.nmAddrType = (NM_ADDR_TYPE) GetLBoxDw(GetDlgItem(hdlg, IDL_ADDR_TYPE));
      gPref.nmCallType = (NM_CALL_TYPE) GetLBoxDw(GetDlgItem(hdlg, IDL_CALL_TYPE));

      EndDialog(hdlg, 0);
      return TRUE;

    case IDCANCEL:
      EndDialog(hdlg, 1);
      return TRUE;

    default:
      return TRUE;
    } /* switch (cmd) */

  default:
    break;
  } /* switch (uMsg) */

  return FALSE;
}

LRESULT CALLBACK ConferenceDlgProc | ( | HWND | hdlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 273 of file Dlg.Cpp.

{
  switch (uMsg)
  {
  case WM_INITDIALOG:
    CenterWindow(hdlg, ghwndMain);

    SetDlgItemText(hdlg, IDE_NAME, gPref.pszConferenceName);
    SetDlgItemText(hdlg, IDE_PASSWORD, gPref.pszPassword);

    { // check channel types
      DWORD dwFlag = 0x01;
      for (int id = IDC_NMCH_FIRST; id <= IDC_NMCH_LAST; id++)
      {
        CheckDlgButton(hdlg, id, 0 != (gPref.dwNmch & dwFlag));
        dwFlag <<= 1;
      }
    }

    return TRUE;

  case WM_COMMAND:
    switch (GET_WM_COMMAND_ID(wParam, lParam))
    {
    case IDOK:
      GetDlgItemPsz(hdlg, IDE_NAME, &gPref.pszConferenceName);
      GetDlgItemPsz(hdlg, IDE_PASSWORD, &gPref.pszPassword);

      { // check media types
        DWORD dwFlag = 0x01;
        gPref.dwNmch = 0;
        for (int id = IDC_NMCH_FIRST; id <= IDC_NMCH_LAST; id++)
        {
          if (IsDlgButtonChecked(hdlg, id))
            gPref.dwNmch |= dwFlag;
          dwFlag <<= 1;
        }
      }

      EndDialog(hdlg, 0);
      return TRUE;

    case IDCANCEL:
      EndDialog(hdlg, 1);
      return TRUE;

    default:
      return TRUE;
    } /* switch (cmd) */

  default:
    break;
  } /* switch (uMsg) */

  return FALSE;
}

BOOL DlgAudio ( VOID )

Definition at line 860 of file Dlg.Cpp.

{
  return (0 == DialogBox(ghInst, MAKEINTRESOURCE(IDD_AUDIO),
    ghwndMain, (DLGPROC)AudioDlgProc));
}

BOOL DlgCallConf ( VOID )

Definition at line 495 of file Dlg.Cpp.

{
  return (0 == DialogBox(ghInst, MAKEINTRESOURCE(IDD_CALL_CONF),
    ghwndMain, (DLGPROC)CallConfDlgProc));
}

BOOL DlgEject ( VOID )

Definition at line 1426 of file Dlg.Cpp.

{
  return (0 == DialogBox(ghInst, MAKEINTRESOURCE(IDD_EJECT),
    ghwndMain, (DLGPROC)EjectDlgProc));
}

BOOL DlgLaunch ( VOID )

Definition at line 1343 of file Dlg.Cpp.

{
  if (NULL == GetCurrentConference())
    return FALSE;

  return (0 == DialogBox(ghInst, MAKEINTRESOURCE(IDD_LAUNCH),
    ghwndMain, (DLGPROC)LaunchDlgProc));
}

BOOL DlgLogOnOff ( VOID )

Definition at line 1700 of file Dlg.Cpp.

{
  return (0 == DialogBox(ghInst, MAKEINTRESOURCE(IDD_LOGONOFF),
    ghwndMain, (DLGPROC)LogOnOffDlgProc));
}

BOOL DlgNewCall ( VOID )

Definition at line 556 of file Dlg.Cpp.

{
  return (0 == DialogBox(ghInst, MAKEINTRESOURCE(IDD_CALL),
    ghwndMain, (DLGPROC)CallDlgProc));
}

BOOL DlgNewConference ( VOID )

Definition at line 337 of file Dlg.Cpp.

{
  return (0 == DialogBox(ghInst, MAKEINTRESOURCE(IDD_CONFERENCE),
    ghwndMain, (DLGPROC)ConferenceDlgProc));
}

BOOL DlgOptions ( VOID )

Definition at line 649 of file Dlg.Cpp.

{
  return (0 == DialogBox(ghInst, MAKEINTRESOURCE(IDD_OPTIONS),
    ghwndMain, (DLGPROC)OptionsDlgProc));
}

BOOL DlgSendFile ( VOID )

Definition at line 429 of file Dlg.Cpp.

{
  return (0 == DialogBox(ghInst, MAKEINTRESOURCE(IDD_SENDFILE),
    ghwndMain, (DLGPROC)SendFileDlgProc));
}

BOOL DlgShare ( VOID )

Definition at line 1176 of file Dlg.Cpp.

{
  return (0 == DialogBox(ghInst, MAKEINTRESOURCE(IDD_SHARE),
    ghwndMain, (DLGPROC)ShareDlgProc));
}

BOOL DlgShowLocal ( VOID )

Definition at line 1557 of file Dlg.Cpp.

{
  return (0 == DialogBox(ghInst, MAKEINTRESOURCE(IDD_SHOWLOCAL),
    ghwndMain, (DLGPROC)ShowLocalDlgProc));
}

VOID DrawUserItem ( LPDRAWITEMSTRUCT lpdis )

Definition at line 223 of file Dlg.Cpp.

{
  if  (NULL == lpdis)
  {
    ERROR_MSG(TEXT("DrawUserItem: NULL == lpdis"));
    return;
  }

  if (lpdis->itemID == -1)
    return;

  PUSER   pUser = (PUSER) lpdis->itemData;
  COLORREF  cvText  = RGB(0, 0, 0);
  COLORREF  cvBack  = RGB(0, 0, 0);

  cvText = SetTextColor(lpdis->hDC, GetSysColor((lpdis->itemState & ODS_SELECTED)
    ? COLOR_HIGHLIGHTTEXT : COLOR_WINDOWTEXT));

  cvBack = SetBkColor(lpdis->hDC, GetSysColor((lpdis->itemState & ODS_SELECTED)
    ? COLOR_HIGHLIGHT : COLOR_WINDOW));

  if (NULL == pUser->pszName)
  {
    ExtTextOut(lpdis->hDC, lpdis->rcItem.left+2, lpdis->rcItem.top+2,
      ETO_CLIPPED | ETO_OPAQUE, &lpdis->rcItem,
      TEXT("? user\0"), 6, NULL);
  }
  else
  {
    ExtTextOut(lpdis->hDC, lpdis->rcItem.left+2, lpdis->rcItem.top+2,
      ETO_CLIPPED | ETO_OPAQUE, &lpdis->rcItem,
      pUser->pszName, lstrlen(pUser->pszName), NULL);
  }

  SetTextColor(lpdis->hDC, cvText);
  SetBkColor(lpdis->hDC, cvBack);

  if (lpdis->itemState & ODS_FOCUS)
  {
    DrawFocusRect(lpdis->hDC, &lpdis->rcItem);
  }
}

LRESULT CALLBACK EjectDlgProc | ( | HWND | hdlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 1359 of file Dlg.Cpp.

{
  switch (uMsg)
  {
  case WM_INITDIALOG:
  {
    CenterWindow(hdlg, ghwndMain);

    InitUserLBox(hdlg, FALSE);
    return TRUE;
  }

  case WM_DRAWITEM:
    DrawUserItem((LPDRAWITEMSTRUCT) lParam);
    break;

  case WM_COMMAND:
    switch (GET_WM_COMMAND_ID(wParam, lParam))
    {
    case IDOK:
    {
      // Get the Member
      INmMember * pMember = NULL;
      int iSel = SendDlgItemMessage(hdlg, IDL_USERS, CB_GETCURSEL, 0, 0);
      if (CB_ERR != iSel)
      {
        PUSER pUser = (PUSER) SendDlgItemMessage(hdlg, IDL_USERS,
          CB_GETITEMDATA, (WPARAM) iSel, 0);
        if (NULL != pUser)
          pMember = pUser->pMember;
      }

      if (NULL != pMember)
      {
        HRESULT hr = pMember->Eject();

        if (FAILED(hr))
        {
          ERROR_MSG(TEXT("Eject Failed hr=%s"), GetHrSz(hr));
        }
      }

      EndDialog(hdlg, 1);
      return TRUE;
    }
    case IDCANCEL:
      EndDialog(hdlg, 0);
      return TRUE;

    default:
      return TRUE;
    } /* switch (cmd) */

  default:
    break;
  } /* switch (uMsg) */

  return FALSE;
}

VOID FreeShareList ( HWND hwnd )

Definition at line 890 of file Dlg.Cpp.

{
  for (int iItem = 0; ; iItem++)
  {
    LV_ITEM lvi;
    ZeroMemory(&lvi, sizeof(LV_ITEM));

    lvi.mask = LVIF_PARAM;
    lvi.iItem = iItem;

    if (!ListView_GetItem(hwnd, &lvi))
      break;

    INmSharableApp * pApp = (INmSharableApp *) lvi.lParam;
    ASSERT(NULL != pApp);
    if  (NULL == pApp)
    {
      ERROR_MSG(TEXT("FreeShareList: NULL == pApp"));
      break;
    }

    pApp->Release();
    pApp = NULL;
  }

  ListView_DeleteAllItems(hwnd);
}

DWORD GetLBoxDw ( HWND hwndCombo )

Definition at line 77 of file Dlg.Cpp.

{
  if  (NULL == hwndCombo)
  {
    ERROR_MSG(TEXT("GetLBoxDw: NULL == hwndCombo"));
    return 0;
  }

  int iSel = SendMessage(hwndCombo, CB_GETCURSEL, 0, 0);
  if (CB_ERR == iSel)
    return 0;

  return SendMessage(hwndCombo, CB_GETITEMDATA, (WPARAM) iSel, 0);
}

VOID InitializeUserList | ( | HWND | hwndCombo,
 |  | BOOL | fEveryone
 | ) |  |

Definition at line 120 of file Dlg.Cpp.

{
  if (NULL == g_pListUser)
    return;

  if  (NULL == hwndCombo)
  {
    ERROR_MSG(TEXT("InitializeUserList: hwndCombo == NULL"));
    return;
  }

  POSITION pos = g_pListUser->GetHeadPosition();
  while (NULL != pos)
  {
    POSITION posSav = pos;
    PUSER pUser = (PUSER) g_pListUser->GetNext(pos);
    AddUserToUList(pUser, hwndCombo, fEveryone);
  }

  SendMessage(hwndCombo, CB_SETCURSEL, 0, 0);
}

VOID InitLBox | ( | HWND | hwndCombo,
 |  | DWSTR * | pdwstr,
 |  | UINT | cElt,
 |  | DWORD | dwDefault
 | ) |  |

Definition at line 39 of file Dlg.Cpp.

{
  DWORD dwIndex = 0;
  DWORD iSel  = 0;

  ASSERT(NULL != hwndCombo);
  if  (NULL == hwndCombo)
  {
    ERROR_MSG(TEXT("InitLBox: NULL == hwndCombo"));
    return;
  }

  if  (NULL == pdwstr)
  {
    ERROR_MSG(TEXT("InitLBox: NULL == pdwstr"));
    return;
  }

  for ( ; cElt > 0; cElt--, pdwstr++)
  {
    dwIndex = SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM) pdwstr->psz);
    SendMessage(hwndCombo, CB_SETITEMDATA, dwIndex, (LPARAM) pdwstr->dw);
    if (pdwstr->dw == dwDefault)
    {
      iSel = dwIndex;
    }
  }

  SendMessage(hwndCombo, CB_SETCURSEL, dwDefault, 0);
}

VOID InitShareList ( HWND hdlg )

Definition at line 1006 of file Dlg.Cpp.

{
  HWND hwnd = GetDlgItem(hdlg, IDL_APP);

  ASSERT(NULL != hwnd);
  if  (NULL == hwnd)
  {
    ERROR_MSG(TEXT("InitShareList: NULL == hwnd"));
    return;
  }

  // Initialize column data
  {
    int     iCol  = 0       ;
    LPCOL   lpCol = _rgColShare ;
    LV_COLUMN lvc           ;

    ZeroMemory(&lvc, sizeof(LV_COLUMN));
    lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
    lvc.fmt  = LVCFMT_LEFT;

    for (iCol = 0; iCol < ARRAY_ELEMENTS(_rgColShare); iCol++)
    {
      lvc.iSubItem = iCol;
      lvc.cx = lpCol->dwWidth;
      lvc.pszText = lpCol->lpsz;
      if (ListView_InsertColumn(hwnd, iCol, &lvc) == -1)
        return;
      lpCol++;
    }
  }

  UpdateShareList(hwnd);
}

VOID InitUserLBox | ( | HWND | hdlg,
 |  | BOOL | fEveryone
 | ) |  |

Definition at line 99 of file Dlg.Cpp.

{
  HWND hwndCombo = GetDlgItem(hdlg, IDL_USERS);

  ASSERT(NULL != hwndCombo);
  if  (NULL == hwndCombo)
  {
    ERROR_MSG(TEXT("InitUserLBox: NULL == hwndCombo"));
    return;
  }

  InitializeUserList(hwndCombo, fEveryone);
}

BOOL IsSharingEnabled ( VOID )

Definition at line 1706 of file Dlg.Cpp.

{
  OSVERSIONINFO osvi;
  osvi.dwOSVersionInfoSize = sizeof(osvi);

  if(FALSE == ::GetVersionEx(&osvi))
  {
    return TRUE;
  }

    if((VER_PLATFORM_WIN32_NT == osvi.dwPlatformId) && (4 >= osvi.dwMajorVersion))
    {
    if(NT_DRIVER_START_DISABLED == GetRegDWORD(HKEY_LOCAL_MACHINE, NM_NT_DISPLAY_DRIVER_KEY, REGVAL_NM_NT_DISPLAY_DRIVER_ENABLED, 0))
    {
      return FALSE;
    }
  }

  return TRUE;

}

LRESULT CALLBACK LaunchDlgProc | ( | HWND | hdlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 1252 of file Dlg.Cpp.

{
  switch (uMsg)
  {
  case WM_INITDIALOG:
  {
    CenterWindow(hdlg, ghwndMain);

    InitUserLBox(hdlg, TRUE);
    _InitGuidLBox(GetDlgItem(hdlg, IDL_GUID));
    return TRUE;
  }

  case WM_DRAWITEM:
    DrawUserItem((LPDRAWITEMSTRUCT) lParam);
    break;

  case WM_COMMAND:
    switch (GET_WM_COMMAND_ID(wParam, lParam))
    {
    case IDOK:
    {
      // Get the Member
      INmMember * pMember = NULL;
      int iSel = SendDlgItemMessage(hdlg, IDL_USERS, CB_GETCURSEL, 0, 0);
      if (CB_ERR != iSel)
      {
        PUSER pUser = (PUSER) SendDlgItemMessage(hdlg, IDL_USERS,
          CB_GETITEMDATA, (WPARAM) iSel, 0);
        if (NULL != pUser)
        {
          pMember = pUser->pMember;
          if (S_OK == pMember->IsSelf())
            pMember = NULL; // everyone
        }
      }

      // Get the Guid
      GUID  guid;
      ZeroMemory(&guid, sizeof(GUID));

      TCHAR szGuid[MAX_PATH + 1];
      ZeroMemory(szGuid, sizeof(TCHAR) * (MAX_PATH + 1));

      GetDlgItemText(hdlg, IDL_GUID, szGuid, MAX_PATH);
      SzToGuid(szGuid, &guid);

      INmConference * pConference = GetCurrentConference();
      HRESULT hr  = NO_ERROR;

      if (NULL == pConference)
      {
        hr = E_FAIL;
      }
      else
      {
        hr = pConference->LaunchRemote(guid, pMember);
      }

      if (FAILED(hr))
      {
        ERROR_MSG(TEXT("LaunchRemote Failed hr=%s"), GetHrSz(hr));
      }
      else
      {
        EndDialog(hdlg, 1);
      }
      return TRUE;
    }
    case IDCANCEL:
      EndDialog(hdlg, 0);
      return TRUE;

    default:
      return TRUE;
    } /* switch (cmd) */

  default:
    break;
  } /* switch (uMsg) */

  return FALSE;
}

LRESULT CALLBACK LogOnOffDlgProc | ( | HWND | hdlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 1572 of file Dlg.Cpp.

{

  switch (uMsg)
  {
  case WM_INITDIALOG:
  {
    CenterWindow(hdlg, ghwndMain);
//    InitShareList(hdlg);
    return TRUE;
  }

  case WM_COMMAND:
  {
    UINT wCmd = GET_WM_COMMAND_ID(wParam, lParam);
    switch (wCmd)
    {
    case IDOK:
    case IDCANCEL:
//      FreeShareList(GetDlgItem(hdlg, IDL_APP));
      EndDialog(hdlg, 1);
      return TRUE;

//    case IDB_UPDATE:
//      UpdateShareList(GetDlgItem(hdlg, IDL_APP));
//      break;

    case IDB_SHARE:
    case IDB_UNSHARE:
    {
      HRESULT     hr    = NO_ERROR;
      NM_SHAPP_STATE  uState;
      HWND      hwndLv  = GetDlgItem(hdlg, IDL_APP);
      int       iItem = ListView_GetNextItem(hwndLv, -1, LVNI_ALL | LVNI_SELECTED);

      if (-1 == iItem)
        break;

      LV_ITEM lvi;
      ZeroMemory(&lvi, sizeof(LV_ITEM));

      lvi.iItem = iItem;
      lvi.mask = LVIF_PARAM;
      if (!ListView_GetItem(hwndLv, &lvi))
        break;

      INmSharableApp * pApp = (INmSharableApp *) lvi.lParam;
      ASSERT(NULL != pApp);
      if  (NULL == pApp)
      {
        ERROR_MSG(TEXT("LogOnOffDlgProc: NULL == pApp"));
        break;
      }

      hr = pApp->GetState(&uState);
      if (FAILED(hr))
      {
        ERROR_MSG(TEXT("Invalid hwnd? hr=%s"), GetHrSz(hr));
        break;
      }
      STATE_MSG(TEXT("Current app share state is %s"), (uState==NM_SHAPP_SHARED) ? "shared" : (uState == NM_SHAPP_NOT_SHARED) ? "not shared": "unknown");
      hr = pApp->SetState((IDB_SHARE == wCmd) ? NM_SHAPP_SHARED : NM_SHAPP_NOT_SHARED);
      return TRUE;
    }

    case IDB_COLLAB:
    case IDB_UNCOLLAB:
    {
      HRESULT     hr    = NO_ERROR;
      NM_SHARE_STATE  uState;

      if  (NULL == g_pChannelAppShare)
      {
        ERROR_MSG(TEXT("LogOnOffDlgProc: NULL == g_pChannelAppShare"));
        break;
      }

      hr = g_pChannelAppShare->GetState(&uState);
      if (FAILED(hr))
      {
        ERROR_MSG(TEXT("Invalid hwnd? hr=%s"), GetHrSz(hr));
        break;
      }

      STATE_MSG(TEXT("Current app collaboration status is %s"), GetCollaborationStateSz(uState));

      {
        // set the state
        switch(uState)
        {
        case NM_SHARE_WORKING_ALONE:
        case NM_SHARE_COLLABORATING:
          hr = g_pChannelAppShare->SetState(NM_SHARE_IN_CONTROL);
          break;

        case NM_SHARE_IN_CONTROL:
          hr = g_pChannelAppShare->SetState(NM_SHARE_WORKING_ALONE);
          break;

        case NM_SHARE_UNKNOWN:
          TRACE_MSG(TEXT("Cannot collaborate"));

        }
      }

      return TRUE;
    }

    default:
      return TRUE;
    } // switch (cmd)
  }

  default:
    break;
  } /* switch (uMsg) */

  return FALSE;
}

LRESULT CALLBACK OptionsDlgProc | ( | HWND | hdlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 569 of file Dlg.Cpp.

{
  switch (uMsg)
  {
  case WM_INITDIALOG:
    CenterWindow(hdlg, ghwndMain);

    CheckDlgButton(hdlg, IDC_MONITOR, gPref.fAutoMonitor);

    CheckDlgButton(hdlg, IDC_HOST, gPref.fAutoHost);
    SetDlgItemText(hdlg, IDE_CONFERENCE_NAME, gPref.pszConferenceName);

    CheckDlgButton(hdlg, IDC_CALL_USER, gPref.fAutoCall);
    SetDlgItemText(hdlg, IDE_USER_NAME, gPref.pszAddr);

    CheckDlgButton(hdlg, IDC_AUTO_CHAT, gPref.fAutoChat);

    CheckDlgButton(hdlg, IDC_MSG_TRACE,   gPref.fMsgTrace);
    CheckDlgButton(hdlg, IDC_MSG_OBJECTS, gPref.fMsgObjects);
    CheckDlgButton(hdlg, IDC_MSG_NOTIFY,  gPref.fMsgNotify);
    CheckDlgButton(hdlg, IDC_MSG_STATE,   gPref.fMsgState);

    CheckRadioButton(hdlg, IDR_INIT_NORMAL, IDR_INIT_BACKGROUND,
      gPref.iInit + IDR_INIT_NORMAL);
    return TRUE;

  case WM_COMMAND:
    switch (GET_WM_COMMAND_ID(wParam, lParam))
    {
    case IDOK:
      gPref.fAutoMonitor= IsDlgButtonChecked(hdlg, IDC_MONITOR);

      gPref.fAutoHost   = IsDlgButtonChecked(hdlg, IDC_HOST);
      GetDlgItemPsz(hdlg, IDE_CONFERENCE_NAME, &gPref.pszConferenceName);

      gPref.fAutoCall   = IsDlgButtonChecked(hdlg, IDC_CALL_USER);
      GetDlgItemPsz(hdlg, IDE_USER_NAME, &gPref.pszAddr);

      gPref.fAutoChat   = IsDlgButtonChecked(hdlg, IDC_AUTO_CHAT);

      gPref.fMsgTrace   = IsDlgButtonChecked(hdlg, IDC_MSG_TRACE);
      gPref.fMsgObjects = IsDlgButtonChecked(hdlg, IDC_MSG_OBJECTS);
      gPref.fMsgNotify  = IsDlgButtonChecked(hdlg, IDC_MSG_NOTIFY);
      gPref.fMsgState   = IsDlgButtonChecked(hdlg, IDC_MSG_STATE);

      if (IsDlgButtonChecked(hdlg, IDR_INIT_NORMAL))
        gPref.iInit = NM_INIT_NORMAL;
      else if (IsDlgButtonChecked(hdlg, IDR_INIT_CONTROL))
        gPref.iInit = NM_INIT_CONTROL;
      else if (IsDlgButtonChecked(hdlg, IDR_INIT_NO_LAUNCH))
        gPref.iInit = NM_INIT_NO_LAUNCH;
      else if (IsDlgButtonChecked(hdlg, IDR_INIT_BACKGROUND))
        gPref.iInit = NM_INIT_BACKGROUND;

      EndDialog(hdlg, 0);
      return TRUE;

    case IDCANCEL:
      EndDialog(hdlg, 1);
      return TRUE;

    default:
      return TRUE;
    } /* switch (cmd) */

  default:
    break;
  } /* switch (uMsg) */

  return FALSE;
}

VOID RemoveUserFromUList | ( | PUSER | pUser,
 |  | HWND | hwndCombo
 | ) |  |

Definition at line 184 of file Dlg.Cpp.

{
  ASSERT(NULL != pUser);
  if  (NULL == pUser)
  {
    ERROR_MSG(TEXT("RemoveUserFromList: NULL == pUser"));
    return;
  }

  if (!IsWindow(hwndCombo))
  {
    ERROR_MSG(TEXT("RemoveUserFromUList: invalid hwnd combo?"));
    return;
  }

  for (DWORD dwIndex = 0; ; dwIndex++)
  {
    DWORD dw = SendMessage(hwndCombo, CB_GETITEMDATA, dwIndex, 0);
    if (CB_ERR == dw)
    {
      break;
    }
    if (pUser == (PUSER) dw)
    {
      SendMessage(hwndCombo, CB_DELETESTRING, (WPARAM)dwIndex, 0);
      return;
    }
  }

  ERROR_MSG(TEXT("RemoveUserFromUList: Unable to delete [%s]"), pUser->pszName);
}

LRESULT CALLBACK SendFileDlgProc | ( | HWND | hdlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 350 of file Dlg.Cpp.

{
  switch (uMsg)
  {
  case WM_INITDIALOG:
  {
    HWND hwnd;

    CenterWindow(hdlg, ghwndMain);

    hwnd = GetDlgItem(hdlg, IDC_USERNAME);

    InitUserLBox(hdlg, TRUE);

    // Set the default filename
    SetDlgItemText(hdlg, IDE_FILENAME, gPref.pszFileName);

    return TRUE;
  }

  case WM_COMMAND:
    switch (GET_WM_COMMAND_ID(wParam, lParam))
    {
    case IDOK:
    {
      INmMember * pMember = NULL;
      int iSel = SendDlgItemMessage(hdlg, IDL_USERS, CB_GETCURSEL, 0, 0);
      if (CB_ERR != iSel)
      {
        PUSER pUser = (PUSER) SendDlgItemMessage(hdlg, IDL_USERS,
          CB_GETITEMDATA, (WPARAM) iSel, 0);
        if (NULL != pUser)
        {
          pMember = pUser->pMember;
          if (S_OK == pMember->IsSelf())
            pMember = NULL; // everyone
        }
      }
      GetDlgItemPsz(hdlg, IDE_FILENAME, &gPref.pszFileName);

      SendFile(pMember);
      EndDialog(hdlg, 0);
      return TRUE;
    }

    case IDCANCEL:
      EndDialog(hdlg, 1);
      return TRUE;

    case IDB_BROWSE:
    {
      TCHAR szFileName[MAX_PATH + 1];
      ZeroMemory(szFileName, sizeof(TCHAR) * (MAX_PATH + 1));

      // Get the file name
      if (!FGetFileName(szFileName))    //  FGetFileName assumes buffer size is MAX_PATH
        return FALSE;

      SetDlgItemText(hdlg, IDE_FILENAME, szFileName);
      return TRUE;
    }

    default:
      return TRUE;
    } /* switch (cmd) */

  default:
    break;
  } /* switch (uMsg) */

  return FALSE;
}

LRESULT CALLBACK ShareDlgProc | ( | HWND | hdlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 1049 of file Dlg.Cpp.

{
  switch (uMsg)
  {
  case WM_INITDIALOG:
  {
    CenterWindow(hdlg, ghwndMain);
    InitShareList(hdlg);
    return TRUE;
  }

  case WM_COMMAND:
  {
    UINT wCmd = GET_WM_COMMAND_ID(wParam, lParam);
    switch (wCmd)
    {
    case IDOK:
    case IDCANCEL:
      FreeShareList(GetDlgItem(hdlg, IDL_APP));
      EndDialog(hdlg, 1);
      return TRUE;

    case IDB_UPDATE:
      UpdateShareList(GetDlgItem(hdlg, IDL_APP));
      break;

    case IDB_SHARE:
    case IDB_UNSHARE:
    {
      HRESULT     hr    = NO_ERROR;
      NM_SHAPP_STATE  uState;
      HWND      hwndLv  = GetDlgItem(hdlg, IDL_APP);

      int iItem = ListView_GetNextItem(hwndLv, -1, LVNI_ALL | LVNI_SELECTED);
      if (-1 == iItem)
        break;

      LV_ITEM lvi;
      ZeroMemory(&lvi, sizeof(LV_ITEM));

      lvi.iItem = iItem;
      lvi.mask = LVIF_PARAM;
      if (!ListView_GetItem(hwndLv, &lvi))
        break;

      INmSharableApp * pApp = (INmSharableApp *) lvi.lParam;
      ASSERT(NULL != pApp);
      if  (NULL == pApp)
      {
        ERROR_MSG(TEXT("ShareDlgProc: NULL == pApp"));
        break;
      }

      hr = pApp->GetState(&uState);
      if (FAILED(hr))
      {
        ERROR_MSG(TEXT("Invalid hwnd? hr=%s"), GetHrSz(hr));
        break;
      }
      STATE_MSG(TEXT("Current app share state is %s"), (uState==NM_SHAPP_SHARED) ? "shared" : (uState == NM_SHAPP_NOT_SHARED) ? "not shared": "unknown");
      hr = pApp->SetState((IDB_SHARE == wCmd) ? NM_SHAPP_SHARED : NM_SHAPP_NOT_SHARED);
      return TRUE;
    }

    case IDB_COLLAB:
    case IDB_UNCOLLAB:
    {
      HRESULT     hr    = NO_ERROR;
      NM_SHARE_STATE  uState;

      if  (NULL == g_pChannelAppShare)
      {
        ERROR_MSG(TEXT("ShareDlgProc: NULL == g_pChannelAppShare"));
        break;
      }

      hr = g_pChannelAppShare->GetState(&uState);
      if (FAILED(hr))
      {
        ERROR_MSG(TEXT("Invalid hwnd? hr=%s"), GetHrSz(hr));
        break;
      }

      STATE_MSG(TEXT("Current app collaboration status is %s"), GetCollaborationStateSz(uState));

      {
        // set the state
        switch(uState)
        {
        case NM_SHARE_WORKING_ALONE:
        case NM_SHARE_COLLABORATING:
          hr = g_pChannelAppShare->SetState(NM_SHARE_IN_CONTROL);
          break;

        case NM_SHARE_IN_CONTROL:
          hr = g_pChannelAppShare->SetState(NM_SHARE_WORKING_ALONE);
          break;

        case NM_SHARE_UNKNOWN:
          TRACE_MSG(TEXT("Cannot collaborate"));

        }
      }

      return TRUE;
    }

    default:
      return TRUE;
    } /* switch (cmd) */
  }

  default:
    break;
  } /* switch (uMsg) */

  return FALSE;
}

LRESULT CALLBACK ShowLocalDlgProc | ( | HWND | hdlg,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 1440 of file Dlg.Cpp.

{
  HRESULT     hr    = NO_ERROR;

  switch (uMsg)
  {
  case WM_INITDIALOG:
  {

    INmSysInfo * pSysInfo = NULL;

    CenterWindow(hdlg, ghwndMain);

    if  (NULL == g_pMgr)
    {
      ERROR_MSG(TEXT("ShowLocalDlgProc: NULL == g_pMgr"));
    }
    else
    {
      hr = g_pMgr->GetSysInfo(&pSysInfo);
      if(FAILED(hr))
        ERROR_MSG(TEXT("GetSysInfo failed (%s)"), GetHrSz(hr));
      else if (NULL == pSysInfo)
        ERROR_MSG(TEXT("ShowLocalDlgProc: NULL == pSysInfo"));
    }

    CheckRadioButton(hdlg, IDC_SHOW_CHAT, IDC_FINDSOMEONE, IDC_SHOW_CHAT);

    if  (NULL != pSysInfo)
    {
      pSysInfo -> Release();
      pSysInfo =  NULL;
    }

    return TRUE;
  }
  case WM_COMMAND:
  {
    UINT    wCmd    = GET_WM_COMMAND_ID(wParam, lParam);
    NM_APPID  AppID;
    INmObject * pObject = NULL;

    switch (wCmd)
    {
    case IDOK:

      if  (NULL == g_pMgr)
      {
        ERROR_MSG(TEXT("ShowLocalDlgProc: NULL == g_pMgr"));
        return FALSE;
      }

      hr = g_pMgr->QueryInterface(IID_INmObject, (void**) &pObject);

      ASSERT(NULL != pObject);

      if  (FAILED(hr) || (NULL == pObject))
      {
        ERROR_MSG(TEXT("ShowLocalDlgProc: QI FAILED [hr=%08X ptr=%p]"), hr, pObject);
        return FALSE;
      }

      if(IsDlgButtonChecked(hdlg, IDC_SHOW_FT))
        AppID = NM_APPID_FILE_TRANSFER;
      else if(IsDlgButtonChecked(hdlg, IDC_SHOW_CHAT))
        AppID = NM_APPID_CHAT;
      else if(IsDlgButtonChecked(hdlg, IDC_SHOW_WB))
        AppID = NM_APPID_WHITEBOARD;
      else if(IsDlgButtonChecked(hdlg, IDC_SHOW_T126WB))
        AppID = NM_APPID_T126_WHITEBOARD;
      else if(IsDlgButtonChecked(hdlg, IDC_SHOW_AS))
        AppID = NM_APPID_APPSHARING;
      else if(IsDlgButtonChecked(hdlg, IDC_FINDSOMEONE))
      {
        hr = pObject->CallDialog(NULL, 0);
        EndDialog(hdlg, 1);

        pObject->Release();
        pObject = NULL;

        return TRUE;
      }

      hr = pObject->ShowLocal(AppID);
      if(FAILED(hr))
        ERROR_MSG(TEXT("ShowLocal failed (%s)"), GetHrSz(hr));

      pObject -> Release();
      pObject =  NULL;

      // fall through so the dialog goes away!!!

    case IDCANCEL:
      EndDialog(hdlg, 1);
      return TRUE;

    default:
      return TRUE;
    } // switch (cmd)

  }

  default:
    break;
  } /* switch (uMsg) */

  return FALSE;
}

VOID UpdateAudioSettings ( HWND hdlg )

Definition at line 662 of file Dlg.Cpp.

{
  int iSel = SendDlgItemMessage(hdlg, IDL_USERS, CB_GETCURSEL, 0, 0);
  if (CB_ERR == iSel)
    return;

  PUSER pUser = (PUSER) SendDlgItemMessage(hdlg, IDL_USERS,
    CB_GETITEMDATA, (WPARAM) iSel, 0);

  if  (NULL == pUser)
  {
    ERROR_MSG(TEXT("UpdateAudioSettings: NULL == pUser"));
    return;
  }

  INmChannelAudio * pChannel = pUser->m_pChannelAudio;
  if (NULL != pChannel)
  {
    NM_AUDIO_STATE uState;
    if (SUCCEEDED(pChannel->GetState(&uState)))
    {
      TRACE_MSG(TEXT("Audio State is %d"), uState);
    }

    DWORD dwLevel = 0;
    if (SUCCEEDED(pChannel->GetProperty(NM_AUDPROP_LEVEL, &dwLevel)))
    {
      SendDlgItemMessage (hdlg, IDC_LEVEL, TBM_SETPOS, TRUE,
                dwLevel );

      SetDlgItemInt(hdlg, IDE_LEVEL, dwLevel, FALSE);
    }

    CheckDlgButton(hdlg, IDC_ACTIVE,
      (S_OK == pChannel->IsActive()) ? BST_CHECKED : BST_UNCHECKED);

    DWORD fPause = FALSE;
    pChannel->GetProperty(NM_AUDPROP_PAUSE, &fPause);
    CheckDlgButton(hdlg, IDC_PAUSE, fPause ? BST_CHECKED : BST_UNCHECKED);
  }
}

VOID UpdateShareList ( HWND hwnd )

Definition at line 925 of file Dlg.Cpp.

{
  LV_ITEM         lvItem        ;
  HRESULT         hr    = NO_ERROR  ;
  ULONG         cFetched  = 0     ;
  IEnumNmSharableApp  * pEnum   = NULL    ;
  INmSharableApp    * pApp    = NULL    ;
  NM_SHAPP_STATE      uState        ;
  HWND          hwndApp = 0     ;
  int           iItem   = 0     ;
  BSTR          bstr    = NULL    ;
  LPTSTR          psz   = NULL    ;
  TCHAR         sz[MAX_PATH + 1]    ;

  ZeroMemory(sz, (MAX_PATH + 1) * sizeof(TCHAR));

  FreeShareList(hwnd);

  if (NULL == g_pChannelAppShare)
    return;

  ZeroMemory(&lvItem, sizeof(LV_ITEM));
  lvItem.mask = LVIF_PARAM | LVIF_TEXT;

  hr = g_pChannelAppShare->EnumSharableApp(&pEnum);
  if (FAILED(hr))
  {
    ERROR_MSG(TEXT("UpdateShareList: EnumSharableApp returned 0x%08X"), hr);
      return;
  }

  if  (NULL == pEnum)
  {
    ERROR_MSG(TEXT("UpdateShareList: EnumSharableApp returned a Null Ptr"));
    return;
  }

  for ( ; ; )
  {
    hr = pEnum->Next(1, &pApp, &cFetched);
    if FAILED(hr)
      break;

    if  (NULL == pApp)
    {
      ERROR_MSG(TEXT("UpdateShareList: NULL == pApp"));
      break;
    }

    hr = pApp->GetHwnd(&hwndApp);
    _sntprintf(sz, MAX_PATH, TEXT("%08X"), hwndApp);

    lvItem.pszText    = sz;
    lvItem.cchTextMax = lstrlen(sz);
    lvItem.lParam   = (LPARAM) pApp;
    iItem       = ListView_InsertItem(hwnd, &lvItem);

    hr = pApp->GetState(&uState);
    ListView_SetItemText(hwnd, iItem, ILV_AS_STATUS,
      (NM_SHAPP_SHARED == uState) ? TEXT("Shared") : TEXT("Not Shared"));

    hr = pApp->GetName(&bstr);
    psz = PszFromBstr(bstr);
    SysFreeString(bstr);

    //  Store item to ListView (pApp will be released when removed from ListView)
    ListView_SetItemText(hwnd, iItem, ILV_AS_NAME, psz);
    FreePlpv(&psz);
  }

  pEnum->Release();
  pEnum = NULL;
}

Variable Documentation

DWSTR _rgAddrType[]
Initial value:
 {
  {NM_ADDR_UNKNOWN,      TEXT("Unknown")},
  {NM_ADDR_IP,           TEXT("IP")},
  {NM_ADDR_MACHINENAME,  TEXT("Machine name")},
  {NM_ADDR_PSTN,         TEXT("PSTN")},
  {NM_ADDR_ULS,          TEXT("ULS")},
  {NM_ADDR_H323_GATEWAY, TEXT("H323 Gateway")},
  {6,            TEXT("callto")},
}

Definition at line 29 of file Dlg.Cpp.

DWSTR _rgCallType[]
Initial value:
 {
  {NM_CALL_DEFAULT, TEXT("Default")},
  {NM_CALL_T120,    TEXT("T120")},
  {NM_CALL_H323,    TEXT("H323")},
}

Definition at line 23 of file Dlg.Cpp.

Generated on Wed Nov 13 2024 16:54:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMUI/Global.h File Reference

  • Web
  • NetMeeting
  • NMUI
Classes | Defines | Typedefs | Functions | Variables

Global.h File Reference

Go to the source code of this file.

Classes

struct | _CMD
struct | _MSD
struct | _PREF
struct | _tagCol
struct | DWSTR

Defines

#define | ARRAY_ELEMENTS(rg) (sizeof(rg) / sizeof(rg[0]))
#define | ASSERT(f)
#define | AssertSz(f, sz)
#define | BUTTONHEIGHT 16
#define | BUTTONWIDTH 16
#define | DXP_SEND 60
#define | DXP_ULIST 120
#define | DYP_SEND 25
#define | DYP_ULIST 90
#define | ERROR_MSG ::ErrorMsg
#define | IDSBP_ICON 2
#define | IDSBP_MSG 0
#define | IDSBP_USERCOUNT 1
#define | IDW_CHAT 104
#define | IDW_LVIEW 101
#define | IDW_MSG 100
#define | IDW_SBAR 102
#define | IDW_SEND 105
#define | IDW_TBAR 103
#define | ILV_ADDR 8
#define | ILV_AS 5
#define | ILV_AUDIO 3
#define | ILV_CAPS 2
#define | ILV_FT 4
#define | ILV_ID 9
#define | ILV_LOCAL 7
#define | ILV_MCU 6
#define | ILV_NAME 0
#define | ILV_VERSION 1
#define | IMAGEHEIGHT 16
#define | IMAGEWIDTH 16
#define | LOG_MSG ::LogMsg
#define | LOGOFF 0
#define | LOGON 1
#define | NOTIFY_MSG (!gPref.fMsgNotify) ? (void) 0 : ::TraceMsg
#define | NotReached()
#define | NUMIMAGES 29
#define | OBJECT_MSG (!gPref.fMsgObjects) ? (void) 0 : ::TraceMsg
#define | SetPropResult(hdlg, f) SetWindowLong(GetParent(hdlg), DWL_MSGRESULT, f)
#define | STATE_MSG (!gPref.fMsgState) ? (void) 0 : ::TraceMsg
#define | STATUSICONSIZE 16
#define | TRACE_MSG (!gPref.fMsgTrace) ? (void) 0 : ::TraceMsg
#define | WARN_MSG ::WarnMsg

Typedefs

typedef struct _CMD | CMD
typedef struct _tagCol | COL
typedef CMD * | LPCMD
typedef COL * | LPCOL
typedef MSD * | LPMSD
typedef struct _MSD | MSD
typedef VOID(* | PFNCMD )(VOID)
typedef LRESULT(* | PFNMSG )(HWND, UINT, WPARAM, LPARAM)
typedef struct _PREF | PREF

Functions

VOID | CenterWindow (HWND hwndChild, HWND hwndParent)
TCHAR | ChFromHex (LPTSTR lpch)
VOID | ClearLog (void)
LPTSTR | ConfErrToSz (DWORD dwError, LPTSTR sz)
VOID | DataToHex (LPTSTR lpchSrc, LPTSTR lpchDest, int cb)
VOID | DisplayDlg (BOOL fShow, HWND *phdlg, int id, int idm)
VOID | DisplayStatus (BOOL fShow)
BOOL | DlgAudio (VOID)
BOOL | DlgCallConf (VOID)
BOOL | DlgEject (VOID)
VOID | DlgExit (HWND, WORD, WORD, HWND)
BOOL | DlgLaunch (VOID)
BOOL | DlgLogOnOff (VOID)
BOOL | DlgNewCall (VOID)
BOOL | DlgNewConference (VOID)
BOOL | DlgOptions (VOID)
BOOL | DlgSendFile (VOID)
BOOL | DlgShare (VOID)
BOOL | DlgShowLocal (VOID)
VOID | DoEnumAll (void)
VOID | DoEnumApps (void)
VOID | DoEnumChannelMember (INmChannel *pChannel)
VOID | DoEnumConferenceMember (INmConference *pConference)
VOID | DoEnumMemberLeak (void)
VOID | DoSharableAppLeak (void)
VOID | DrawUserItem (LPDRAWITEMSTRUCT lpdis)
VOID | DumpAllCalls (void)
VOID | DumpCallInfo (INmCall *pCall)
VOID | DumpChannelInfo (INmChannel *pChannel)
VOID | DumpConferenceInfo (INmConference *pConference)
VOID | DumpMemberInfo (INmMember *pMember)
VOID | ErrorMsg (LPTSTR ptszFormat,...)
BOOL | FCreateSbar (void)
BOOL | FCreateTbar (void)
BOOL | FGetDirectory (LPTSTR szDir)
BOOL FGetFileName (LPTSTR szFileName)
BOOL | FInitApp (LPTSTR lpszCmd, int nCmdShow)
VOID | FreeAllComObjects (void)
VOID | FreePlpv (LPVOID plpv)
LPCTSTR | GetCallStateSz (NM_CALL_STATE uState)
LPCTSTR | GetCollaborationStateSz (NM_SHARE_STATE uState)
LPCTSTR | GetConferenceStateSz (NM_CONFERENCE_STATE uState)
LPCTSTR | GetConfnSz (CONFN confn)
VOID | GetDlgItemPsz (HWND hdlg, UINT id, LPTSTR *ppsz)
VOID | GetDlgItemsRc (HWND hdlg, int id1, int id2, LPRECT prc)
LPCTSTR | GetHrSz (HRESULT hr)
BOOL | GetIniBool (LPTSTR szEntry, BOOL f)
VOID | GetIniHex (LPTSTR szEntry, LPVOID lpv, int cb)
DWORD | GetIniInt (LPTSTR szEntry, DWORD dwDefault)
LPTSTR | GetIniStr (LPTSTR szEntry, LPTSTR szDefault)
LPCTSTR | GetNmchSz (ULONG uch)
int | GetRadioButton (HWND hdlg, int idrFirst, int idrLast)
VOID | GuidToSz (GUID *pguid, LPTSTR sz)
VOID | HexToData (LPTSTR lpchSrc, LPVOID lpchDest, int cb)
VOID | InitDbg (void)
VOID | InitializeUserList (HWND hwndCombo, BOOL fEveryone)
BOOL | IsSharingEnabled (VOID)
VOID | Log (COLORREF cv, LPTSTR lpsz)
VOID | LogMsg (COLORREF cv, LPTSTR pszFormat,...)
VOID | LogResult (LPTSTR sz, DWORD dwTest, DWORD dwResult)
VOID | LogTestCancel (LPTSTR sz)
VOID | LogTestStart (LPTSTR sz)
VOID | LogTestStop (LPTSTR sz)
LPVOID | LpvAlloc (int cb)
VOID | MaybeDeleteObject (HGDIOBJ *phgdi)
INT | MsgBoxIMbd (int iMbd)
INT | MsgBoxIMbdDw (int iMbd, DWORD dw)
INT | MsgBoxIMbdSz (int iMbd, LPTSTR lpsz)
VOID | OnStartup (void)
LPTSTR | PszAlloc (int cch)
VOID | ReadPref (void)
VOID | RecalcMsgWindow (void)
VOID | SetMenuCheck (UINT idm, BOOL fCheck)
VOID | SetToolbarCheck (int idm, BOOL fCheck)
VOID | ShowHwnd (HWND hwnd, BOOL fShow, int idm)
VOID | SizeMsgWindow (int dx, int dy)
VOID | SizeStatus (int dxClient, int dy)
VOID | StatusMsg (LPTSTR sz)
LPTSTR | SzFindLastCh (LPTSTR lpsz, TCHAR ch)
VOID | SzToGuid (LPTSTR sz, GUID *pguid)
VOID | TraceMsg (LPTSTR ptszFormat,...)
VOID | UpdateHdlgIdInt (HWND hdlg, int id, LPINT lpint)
VOID | UpdateHdlgIdText (HWND hdlg, int id, LPVOID lpv)
VOID | UpdateStatusBar (LPTSTR lpsz, WORD wPart, WORD wFlags)
VOID | UpdateStatusIcon (DWORD dwId)
VOID | WarnMsg (LPTSTR ptszFormat,...)
LRESULT CALLBACK | WndProc (HWND, UINT, WPARAM, LPARAM)
VOID | WriteIniBool (LPTSTR szEntry, BOOL f)
VOID | WriteIniHex (LPTSTR szEntry, LPVOID lpv, int cb)
VOID | WriteIniInt (LPTSTR szEntry, DWORD dw)
VOID | WriteIniStr (LPTSTR szEntry, LPTSTR sz)
VOID | WriteIniTbar (void)
VOID | WritePref (void)

Variables

int | gdxWndMin
int | gdyWndMin
HACCEL | ghAccelTable
HWND | ghdlgStatus
HFONT | ghfontEntry
HINSTANCE | ghInst
HMENU | ghMenu
HWND | ghwndChat
HWND | ghwndLView
HWND | ghwndMain
HWND | ghwndMsg
HWND | ghwndSbar
HWND | ghwndSend
HWND | ghwndTbar
HWND | ghwndUList
PREF gPref
TCHAR | gszAppName []
TCHAR | gszIniName []

Define Documentation

#define ARRAY_ELEMENTS ( rg ) (sizeof(rg) / sizeof(rg[0]))

Definition at line 22 of file Global.h.

#define ASSERT ( f )

Definition at line 39 of file Global.h.

#define AssertSz | ( | f,
 |  | sz
 | ) |

Definition at line 40 of file Global.h.

#define BUTTONHEIGHT 16

Definition at line 198 of file Global.h.

#define BUTTONWIDTH 16

Definition at line 197 of file Global.h.

#define DXP_SEND 60

Definition at line 219 of file Global.h.

#define DXP_ULIST 120

Definition at line 221 of file Global.h.

#define DYP_SEND 25

Definition at line 220 of file Global.h.

#define DYP_ULIST 90

Definition at line 222 of file Global.h.

#define ERROR_MSG ::ErrorMsg

Definition at line 49 of file Global.h.

#define IDSBP_ICON 2

Definition at line 205 of file Global.h.

#define IDSBP_MSG 0

Definition at line 203 of file Global.h.

#define IDSBP_USERCOUNT 1

Definition at line 204 of file Global.h.

#define IDW_CHAT 104

Definition at line 190 of file Global.h.

#define IDW_LVIEW 101

Definition at line 187 of file Global.h.

#define IDW_MSG 100

Definition at line 186 of file Global.h.

#define IDW_SBAR 102

Definition at line 188 of file Global.h.

#define IDW_SEND 105

Definition at line 191 of file Global.h.

#define IDW_TBAR 103

Definition at line 189 of file Global.h.

#define ILV_ADDR 8

Definition at line 216 of file Global.h.

#define ILV_AS 5

Definition at line 213 of file Global.h.

#define ILV_AUDIO 3

Definition at line 211 of file Global.h.

#define ILV_CAPS 2

Definition at line 210 of file Global.h.

#define ILV_FT 4

Definition at line 212 of file Global.h.

#define ILV_ID 9

Definition at line 217 of file Global.h.

#define ILV_LOCAL 7

Definition at line 215 of file Global.h.

#define ILV_MCU 6

Definition at line 214 of file Global.h.

#define ILV_NAME 0

Definition at line 208 of file Global.h.

#define ILV_VERSION 1

Definition at line 209 of file Global.h.

#define IMAGEHEIGHT 16

Definition at line 196 of file Global.h.

#define IMAGEWIDTH 16

Definition at line 195 of file Global.h.

#define LOG_MSG ::LogMsg

Definition at line 60 of file Global.h.

#define LOGOFF 0

Definition at line 56 of file Global.h.

#define LOGON 1

Definition at line 57 of file Global.h.

#define NOTIFY_MSG (!gPref.fMsgNotify) ? (void) 0 : ::TraceMsg

Definition at line 53 of file Global.h.

#define NotReached ( )

Definition at line 41 of file Global.h.

#define NUMIMAGES 29

Definition at line 194 of file Global.h.

#define OBJECT_MSG (!gPref.fMsgObjects) ? (void) 0 : ::TraceMsg

Definition at line 52 of file Global.h.

#define SetPropResult | ( | hdlg,
 |  | f |
 | ) |  | SetWindowLong(GetParent(hdlg), DWL_MSGRESULT, f)

Definition at line 341 of file Global.h.

#define STATE_MSG (!gPref.fMsgState) ? (void) 0 : ::TraceMsg

Definition at line 54 of file Global.h.

#define STATUSICONSIZE 16

Definition at line 200 of file Global.h.

#define TRACE_MSG (!gPref.fMsgTrace) ? (void) 0 : ::TraceMsg

Definition at line 51 of file Global.h.

#define WARN_MSG ::WarnMsg

Definition at line 48 of file Global.h.

Typedef Documentation

typedef struct _CMD CMD
typedef struct _tagCol COL
typedef CMD* LPCMD

Definition at line 129 of file Global.h.

typedef COL* LPCOL

Definition at line 174 of file Global.h.

typedef MSD* LPMSD

Definition at line 112 of file Global.h.

typedef struct _MSD MSD
typedef VOID(* PFNCMD)(VOID)

Definition at line 121 of file Global.h.

typedef LRESULT(* PFNMSG)(HWND, UINT, WPARAM, LPARAM)

Definition at line 104 of file Global.h.

typedef struct _PREF PREF

Function Documentation

VOID CenterWindow | ( | HWND | hwndChild,
 |  | HWND | hwndParent
 | ) |  |

Definition at line 676 of file Generic.C.

{
   RECT    rChild, rParent, rWorkArea;
   int     wChild, hChild, wParent, hParent;
   int     xNew, yNew;
   BOOL  bResult;

   // Get the Height and Width of the child window
   GetWindowRect (hwndChild, &rChild);
   wChild = rChild.right - rChild.left;
   hChild = rChild.bottom - rChild.top;

   // Get the Height and Width of the parent window
   GetWindowRect (hwndParent, &rParent);
   wParent = rParent.right - rParent.left;
   hParent = rParent.bottom - rParent.top;

   // Get the limits of the 'workarea'
   bResult = SystemParametersInfo(
      SPI_GETWORKAREA,  // system parameter to query or set
      sizeof(RECT),
      &rWorkArea,
      0);
   if (!bResult) {
      rWorkArea.left = rWorkArea.top = 0;
      rWorkArea.right = GetSystemMetrics(SM_CXSCREEN);
      rWorkArea.bottom = GetSystemMetrics(SM_CYSCREEN);
   }

   // Calculate new X position, then adjust for workarea
   xNew = rParent.left + ((wParent - wChild) /2);
   if (xNew < rWorkArea.left) {
      xNew = rWorkArea.left;
   } else if ((xNew+wChild) > rWorkArea.right) {
      xNew = rWorkArea.right - wChild;
   }

   // Calculate new Y position, then adjust for workarea
   yNew = rParent.top  + ((hParent - hChild) /2);
   if (yNew < rWorkArea.top) {
      yNew = rWorkArea.top;
   } else if ((yNew+hChild) > rWorkArea.bottom) {
      yNew = rWorkArea.bottom - hChild;
   }

   // Set it, and return
   return SetWindowPos (hwndChild, NULL, xNew, yNew, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
}

TCHAR ChFromHex ( LPTSTR lpch )

Definition at line 299 of file Util.Cpp.

{
  if  (NULL == lpch)
    return NULL;

  int   i = 0;
  int   cch = 2;
  char  ch  = 0;

  while (cch-- > 0)
  {
    ch = *lpch++;
    if (ch >= 'A')
    {
      i = (i*16) + (ch - ('A'-10));
    }
    else
    {
      i = (i*16) + (ch - '0');
    }
  }

  return (TCHAR) i;
}

VOID ClearLog ( void )

Definition at line 301 of file Debug.Cpp.

{
  SendMessage(ghwndMsg, LB_RESETCONTENT, 0, 0);
}

LPTSTR ConfErrToSz | ( | DWORD | dwError,
 |  | LPTSTR | sz
 | ) |  |
VOID DataToHex | ( | LPTSTR | lpchSrc,
 |  | LPTSTR | lpchDest,
 |  | int | cb
 | ) |  |

Definition at line 382 of file Util.Cpp.

{
  int cb  = cbDest / 2;
  UINT ch = 0;

  if  (NULL == lpchDest)
  {
    ERROR_MSG(TEXT("DataToHex: Destination string is NULL"));
    return;
  }

  if (lpchSrc == NULL)
  {
    lpchDest[0] = 0;  // return empty string
    return;
  }

  while (cb-- > 0)
  {
    ch = 0x00FF & (unsigned char) (*lpchSrc++);
    _sntprintf(lpchDest, 2, TEXT("%02X"), ch);
    lpchDest += 2;
  }
}

VOID DisplayDlg | ( | BOOL | fShow,
 |  | HWND * | phdlg,
 |  | int | id,
 |  | int | idm
 | ) |  |
VOID DisplayStatus ( BOOL fShow )
BOOL DlgAudio ( VOID )

Definition at line 860 of file Dlg.Cpp.

{
  return (0 == DialogBox(ghInst, MAKEINTRESOURCE(IDD_AUDIO),
    ghwndMain, (DLGPROC)AudioDlgProc));
}

BOOL DlgCallConf ( VOID )

Definition at line 495 of file Dlg.Cpp.

{
  return (0 == DialogBox(ghInst, MAKEINTRESOURCE(IDD_CALL_CONF),
    ghwndMain, (DLGPROC)CallConfDlgProc));
}

BOOL DlgEject ( VOID )

Definition at line 1426 of file Dlg.Cpp.

{
  return (0 == DialogBox(ghInst, MAKEINTRESOURCE(IDD_EJECT),
    ghwndMain, (DLGPROC)EjectDlgProc));
}

VOID DlgExit | ( | HWND | ,
 |  | WORD | ,
 |  | WORD | ,
 |  | HWND |
 | ) |  |
BOOL DlgLaunch ( VOID )

Definition at line 1343 of file Dlg.Cpp.

{
  if (NULL == GetCurrentConference())
    return FALSE;

  return (0 == DialogBox(ghInst, MAKEINTRESOURCE(IDD_LAUNCH),
    ghwndMain, (DLGPROC)LaunchDlgProc));
}

BOOL DlgLogOnOff ( VOID )

Definition at line 1700 of file Dlg.Cpp.

{
  return (0 == DialogBox(ghInst, MAKEINTRESOURCE(IDD_LOGONOFF),
    ghwndMain, (DLGPROC)LogOnOffDlgProc));
}

BOOL DlgNewCall ( VOID )

Definition at line 556 of file Dlg.Cpp.

{
  return (0 == DialogBox(ghInst, MAKEINTRESOURCE(IDD_CALL),
    ghwndMain, (DLGPROC)CallDlgProc));
}

BOOL DlgNewConference ( VOID )

Definition at line 337 of file Dlg.Cpp.

{
  return (0 == DialogBox(ghInst, MAKEINTRESOURCE(IDD_CONFERENCE),
    ghwndMain, (DLGPROC)ConferenceDlgProc));
}

BOOL DlgOptions ( VOID )

Definition at line 649 of file Dlg.Cpp.

{
  return (0 == DialogBox(ghInst, MAKEINTRESOURCE(IDD_OPTIONS),
    ghwndMain, (DLGPROC)OptionsDlgProc));
}

BOOL DlgSendFile ( VOID )

Definition at line 429 of file Dlg.Cpp.

{
  return (0 == DialogBox(ghInst, MAKEINTRESOURCE(IDD_SENDFILE),
    ghwndMain, (DLGPROC)SendFileDlgProc));
}

BOOL DlgShare ( VOID )

Definition at line 1176 of file Dlg.Cpp.

{
  return (0 == DialogBox(ghInst, MAKEINTRESOURCE(IDD_SHARE),
    ghwndMain, (DLGPROC)ShareDlgProc));
}

BOOL DlgShowLocal ( VOID )

Definition at line 1557 of file Dlg.Cpp.

{
  return (0 == DialogBox(ghInst, MAKEINTRESOURCE(IDD_SHOWLOCAL),
    ghwndMain, (DLGPROC)ShowLocalDlgProc));
}

VOID DoEnumAll ( void )

Definition at line 870 of file Debug.Cpp.

{
  HRESULT       hr    = NO_ERROR;
  IEnumNmChannel  * pEnum   = NULL;
  ULONG       cFetched  = 0;
  ULONG       cChannel  = 0;
  INmConference * pConference = GetCurrentConference();

  if (NULL == pConference)
  {
    TRACE_MSG(TEXT("No current conference"));
    return;
  }

  DumpConferenceInfo(pConference);

  DoEnumConferenceMember(pConference);

  hr = pConference->GetChannelCount(&cChannel);
  if (FAILED(hr))
  {
      ERROR_MSG(TEXT("GetChannelCount Failed (%s)"), GetHrSz(hr));
      return;
  }
  TRACE_MSG(TEXT("%d channels in conference"), cChannel);

  if (cChannel > 10)
    cChannel = 10;

  hr = pConference->EnumChannel(&pEnum);
  if (FAILED(hr))
  {
      ERROR_MSG(TEXT("EnumChannel Failed (%s)"), GetHrSz(hr));
      return;
  }

  if  (NULL == pEnum)
  {
    ERROR_MSG(TEXT("EnumChannel returned NULL ptr"));
    return;
  }

  INmChannel * rgpChannel[10];
  for (int i = 0; i < 10; i++)
    rgpChannel[i] = NULL;

  hr = pEnum->Next(cChannel, rgpChannel, &cFetched);
  if (FAILED(hr))
  {
      ERROR_MSG(TEXT("EnumMember Failed (%s)"), GetHrSz(hr));
  }
  else
  {
    for (UINT iChannel = 0; iChannel < cFetched; iChannel++)
    {
      if  (NULL != rgpChannel[iChannel])
      {
        DumpChannelInfo(rgpChannel[iChannel]);
        DoEnumChannelMember(rgpChannel[iChannel]);
        rgpChannel[iChannel]->Release();
        rgpChannel[iChannel] = NULL;
      }
      else
      {
        ERROR_MSG(TEXT("DoEnumAll: rgpChannel[iChannel] == NULL"));
      }
    }
  }

  pEnum->Release();
}

VOID DoEnumApps ( void )

Definition at line 335 of file cShare.Cpp.

{
  HRESULT hr = S_OK;
  ULONG cFetched = 0;
  IEnumNmSharableApp * pEnum = NULL;
  INmSharableApp * pApp = NULL;

  if (NULL == g_pChannelAppShare)
    return;

  hr = g_pChannelAppShare->EnumSharableApp(&pEnum);
  if (FAILED(hr))
  {
      return;
  }

  for ( ; ; )
  {
    hr = pEnum->Next(1, &pApp, &cFetched);
    if (S_OK != hr)
      break;

    UpdateApp(pApp);
    pApp->Release();
  }

  pEnum->Release();
}

VOID DoEnumChannelMember ( INmChannel * pChannel )

Definition at line 718 of file Debug.Cpp.

{
  HRESULT       hr    = NO_ERROR;
  IEnumNmMember * pEnum   = NULL;
  ULONG       cFetched  = 0;
  ULONG       cMember = 0;

  ASSERT(NULL != pChannel);
  if  (NULL == pChannel)
  {
    ERROR_MSG(TEXT("DoEnumChannelMember: NULL == pChannel"));
    return;
  }

  hr = pChannel->GetMemberCount(&cMember);
  if (FAILED(hr))
  {
      ERROR_MSG(TEXT("GetMemberCount Failed (%s)"), GetHrSz(hr));
      return;
  }
  TRACE_MSG(TEXT("%d members in channel (%08X)"), cMember, pChannel);

  if (0 == cMember)
    return;

  if (cMember > 10)
    cMember = 10;

  hr = pChannel->EnumMember(&pEnum);
  if (FAILED(hr))
  {
      ERROR_MSG(TEXT("EnumMember Failed (%s)"), GetHrSz(hr));
      return;
  }
  else if (NULL == pEnum)
  {
    ERROR_MSG(TEXT("EnumMember returned a Null ptr"));
    return;
  }

  INmMember * rgpMember[10];
  for (int i = 0; i < 10; i++)
    rgpMember[i] = NULL;

  hr = pEnum->Next(cMember, rgpMember, &cFetched);
  if (FAILED(hr))
  {
      ERROR_MSG(TEXT("EnumMember Failed (%s)"), GetHrSz(hr));
  }
  else
  {
    for (UINT iMember = 0; iMember < cFetched; iMember++)
    {
      DumpMemberInfo(rgpMember[iMember]);

      if  (NULL != rgpMember[iMember])
      {
        rgpMember[iMember]->Release();
        rgpMember[iMember] = NULL;
      }
    }
  }

  pEnum->Release();
  pEnum = NULL;
}

VOID DoEnumConferenceMember ( INmConference * pConference )

Definition at line 793 of file Debug.Cpp.

{
  HRESULT       hr    = NO_ERROR;
  IEnumNmMember * pEnum   = NULL;
  ULONG       cFetched  = 0;
  ULONG       cMember = 0;

  ASSERT(NULL != pConference);
  if  (NULL == pConference)
  {
    ERROR_MSG(TEXT("DoEnumConferenceMember: NULL == pConference"));
    return;
  }

  hr = pConference->GetMemberCount(&cMember);
  if (FAILED(hr))
  {
      ERROR_MSG(TEXT("GetMemberCount Failed (%s)"), GetHrSz(hr));
      return;
  }
  TRACE_MSG(TEXT("%d members in conference (%08X)"), cMember, pConference);

  if (cMember > 10)
    cMember = 10;

  hr = pConference->EnumMember(&pEnum);
  if (FAILED(hr))
  {
      ERROR_MSG(TEXT("EnumMember Failed (%s)"), GetHrSz(hr));
      return;
  }

  if  (NULL == pEnum)
  {
    ERROR_MSG(TEXT("EnumMember returned Null ptr"));
    return;
  }

  INmMember * rgpMember[10];
  BSTR      bstrAddr  = NULL;
  NM_ADDR_TYPE  uType;

  for (int i = 0; i < 10; i++)
    rgpMember[i] = NULL;

  hr = pEnum->Next(cMember, rgpMember, &cFetched);
  if (FAILED(hr))
  {
      ERROR_MSG(TEXT("EnumMember Failed (%s)"), GetHrSz(hr));
  }
  else
  {
    for (UINT iMember = 0; iMember < cFetched; iMember++)
    {
      if  (NULL != rgpMember[iMember])
      {
        hr = rgpMember[iMember] ->GetAddr(&bstrAddr, &uType);
        DumpMemberInfo(rgpMember[iMember]);
        rgpMember[iMember]->Release();
        rgpMember[iMember] = NULL;
      }
      else
        ERROR_MSG(TEXT("rgpMember[iMember] == NULL"));
    }
  }

  pEnum->Release();
  pEnum = NULL;
}

VOID DoEnumMemberLeak ( void )

Definition at line 948 of file Debug.Cpp.

{

  HRESULT       hr    = NO_ERROR;
  IEnumNmMember * pEnum   = NULL;
  INmMember   * pm    = NULL;
  INmConference * pConference = GetCurrentConference();
  UINT i;

  if (NULL == pConference)
  {
    TRACE_MSG(TEXT("No current conference"));
    return;
  }

  for(i=0; i < 10; i++)
  {
    hr = pConference->EnumMember(&pEnum);
    if  (SUCCEEDED(hr) && (NULL != pEnum))
    {
      while(pEnum->Next(1, &pm, NULL) == NO_ERROR)
      {
        if  (NULL != pm)
        {
          pm->Release();
          pm = NULL;
        }
      }

      pEnum->Release();
      pEnum = NULL;
    }
    else
    {
      ERROR_MSG(TEXT("DoEnumMemberLeak: Error INmMember::EnumMember"));
    }
  }

}

VOID DoSharableAppLeak ( void )

Definition at line 993 of file Debug.Cpp.

{

  HRESULT         hr  = NO_ERROR  ;
  IEnumNmSharableApp  * pEnum = NULL    ;
  INmSharableApp    * pa  = NULL    ;

  if  (NULL == g_pChannelAppShare)
  {
    ERROR_MSG(TEXT("DoSharableAppLeak: NULL == g_pChannelAppShare"));
    return;
  }

  for(UINT i=0; i < 1000; i++)
  {
    hr = g_pChannelAppShare->EnumSharableApp(&pEnum);
    if  (SUCCEEDED(hr) && (NULL != pEnum))
    {
      while(pEnum->Next(1, &pa, NULL) == NO_ERROR)
      {
        if  (NULL != pa)
        {
          pa->Release();
          pa = NULL;
        }
      }

      pEnum->Release();
      pEnum = NULL;
    }
    else
    {
      ERROR_MSG(TEXT("DoSharableAppLeak: NULL == pEnum"));
    }
  }

}

VOID DrawUserItem ( LPDRAWITEMSTRUCT lpdis )

Definition at line 223 of file Dlg.Cpp.

{
  if  (NULL == lpdis)
  {
    ERROR_MSG(TEXT("DrawUserItem: NULL == lpdis"));
    return;
  }

  if (lpdis->itemID == -1)
    return;

  PUSER   pUser = (PUSER) lpdis->itemData;
  COLORREF  cvText  = RGB(0, 0, 0);
  COLORREF  cvBack  = RGB(0, 0, 0);

  cvText = SetTextColor(lpdis->hDC, GetSysColor((lpdis->itemState & ODS_SELECTED)
    ? COLOR_HIGHLIGHTTEXT : COLOR_WINDOWTEXT));

  cvBack = SetBkColor(lpdis->hDC, GetSysColor((lpdis->itemState & ODS_SELECTED)
    ? COLOR_HIGHLIGHT : COLOR_WINDOW));

  if (NULL == pUser->pszName)
  {
    ExtTextOut(lpdis->hDC, lpdis->rcItem.left+2, lpdis->rcItem.top+2,
      ETO_CLIPPED | ETO_OPAQUE, &lpdis->rcItem,
      TEXT("? user\0"), 6, NULL);
  }
  else
  {
    ExtTextOut(lpdis->hDC, lpdis->rcItem.left+2, lpdis->rcItem.top+2,
      ETO_CLIPPED | ETO_OPAQUE, &lpdis->rcItem,
      pUser->pszName, lstrlen(pUser->pszName), NULL);
  }

  SetTextColor(lpdis->hDC, cvText);
  SetBkColor(lpdis->hDC, cvBack);

  if (lpdis->itemState & ODS_FOCUS)
  {
    DrawFocusRect(lpdis->hDC, &lpdis->rcItem);
  }
}

VOID DumpAllCalls ( void )

Definition at line 487 of file Debug.Cpp.

{
  if (NULL == g_pListCall)
    return;

  for (POSITION pos = g_pListCall->GetHeadPosition(); NULL != pos; )
  {
    INmCall * pCall = (INmCall *) g_pListCall->GetNext(pos);
    DumpCallInfo(pCall);
  }
}

VOID DumpCallInfo ( INmCall * pCall )

Definition at line 418 of file Debug.Cpp.

{
  HRESULT       hr      = NO_ERROR  ;
  BSTR        bstrName    = NULL    ;
  BSTR        bstrAddr    = NULL    ;
  NM_ADDR_TYPE    uType           ;
  NM_CALL_STATE   uState          ;
  INmConference * pConference = NULL    ;

  OBJECT_MSG(TEXT("[%08X] - dump call info"), pCall);
  if (NULL == pCall)
  {
    ERROR_MSG(TEXT("DumpCallInfo: Invalid Call"));
    return;
  }

  hr = pCall->GetName(&bstrName);
  if (FAILED(hr))
  {
    bstrName = NULL;
      ERROR_MSG(TEXT("DumpCallInfo: GetName failed"));
  }

  hr = pCall->GetAddr(&bstrAddr, &uType);
  if (FAILED(hr))
  {
    bstrAddr = NULL;
    uType = NM_ADDR_UNKNOWN;
      ERROR_MSG(TEXT("DumpCallInfo: GetAddr failed"));
  }

    if (FAILED(pCall->GetState(&uState)))
    {
    uState = NM_CALL_INVALID;
      ERROR_MSG(TEXT("DumpCallInfo: GetState failed"));
    }

  hr = pCall->GetConference(&pConference);
  if (FAILED(hr))
  {
      WARN_MSG(TEXT("DumpCallInfo: GetConference failed %s"), GetHrSz(hr));
  }
  else if (NULL == pConference)
  {
    WARN_MSG(TEXT("DumpCallInfo: GetConference returned a null ptr"));
  }

  TRACE_MSG(TEXT("Call=[%s] Addr=[%s], Type=%d, State=%s %s conf=%08X"),
    (LPTSTR) BTSTR(bstrName), (LPTSTR) BTSTR(bstrAddr),
    uType, GetCallStateSz(uState),
    (S_OK == pCall->IsIncoming()) ? TEXT("(Incoming)") : TEXT(""), pConference);

  if (NULL != pConference)
  {
    pConference->Release();
    pConference = NULL;
  }

  SysFreeString(bstrName);
  SysFreeString(bstrAddr);
}

VOID DumpChannelInfo ( INmChannel * pChannel )

Definition at line 635 of file Debug.Cpp.

{
  HRESULT hr    = NO_ERROR;
  ULONG uch   = 0;
  ULONG cMember = 0;

  if  (NULL == pChannel)
  {
    ERROR_MSG(TEXT("DumpChannelInfo: NULL == pChannel"));
    return;
  }

  hr = pChannel->GetNmch(&uch);
  if (FAILED(hr))
  {
    ERROR_MSG(TEXT("GetNmch failed"));
    uch = 0;
  }

  hr = pChannel->GetMemberCount(&cMember);
  if (FAILED(hr))
  {
    ERROR_MSG(TEXT("GetMemberCount failed"));
    cMember = 0;
  }

  TRACE_MSG(TEXT("[%08X] - Channel=[%s] MemberCount=%d"), pChannel, GetNmchSz(uch), cMember);
  switch (uch)
    {
  case NMCH_AUDIO:
  {
    INmChannelAudio * pChannelAudio = NULL;
    hr = pChannel->QueryInterface(IID_INmChannelAudio, (void **)&pChannelAudio);
    if (FAILED(hr))
    {
      ERROR_MSG(TEXT("Not an audio channel?"));
    }
    else if (NULL == pChannelAudio)
    {
      ERROR_MSG(TEXT("DumpChannelInfo: NULL == pChannelAudio"));
    }
    else
    {
      NM_AUDIO_STATE uState ;
      pChannelAudio->GetState(&uState);
      TRACE_MSG(TEXT("Audio State: %d"), uState);
      pChannelAudio->Release();
      pChannelAudio = NULL;
    }
    break;
  }

  case NMCH_VIDEO:
    break;

  case NMCH_DATA:
  {
    INmChannelData * pChannelData = NULL;
    hr = pChannel->QueryInterface(IID_INmChannelData, (void **)&pChannelData);
    if (FAILED(hr) || (NULL == pChannelData))
    {
      ERROR_MSG(TEXT("Not a data channel?"));
    }
    else
    {
      TRACE_MSG(TEXT("Data channel is %s"),
        (S_OK == pChannelData->IsActive()) ? TEXT("Active") : TEXT("Inactive"));
      pChannelData->Release();
      pChannelData = NULL;
    }
    break;
  }
  default:
    break;
    }
}

VOID DumpConferenceInfo ( INmConference * pConference )

Definition at line 506 of file Debug.Cpp.

{
  HRESULT       hr      = NO_ERROR  ;
  BSTR        bstr    = NULL    ;
  ULONG       cMember   = 0     ;
  ULONG       cChannel  = 0     ;
  NM_CONFERENCE_STATE uState          ;

  if (NULL == pConference)
  {
    ERROR_MSG(TEXT("DumpConferenceInfo: Invalid conference"));
    return;
  }

  hr = pConference->GetName(&bstr);
  if (FAILED(hr))
  {
    ERROR_MSG(TEXT("GetName failed"));
    bstr = NULL;
  }

  hr = pConference->GetState(&uState);
  if (FAILED(hr))
  {
    ERROR_MSG(TEXT("GetState failed?"));
  }

  hr = pConference->GetMemberCount(&cMember);
  if (FAILED(hr))
  {
    ERROR_MSG(TEXT("GetMemberCount failed"));
    cMember = 0;
  }

  hr = pConference->GetChannelCount(&cChannel);
  if (FAILED(hr))
  {
    ERROR_MSG(TEXT("GetChannelCount failed"));
    cChannel = 0;
  }

  TRACE_MSG(TEXT("[%08X] - Conference=[%s] state=%s"), pConference,
    (LPTSTR) BTSTR(bstr), GetConferenceStateSz(uState));
  TRACE_MSG(TEXT("  MemberCount=%d, ChannelCount=%d"), cMember, cChannel);

  SysFreeString(bstr);
}

VOID DumpMemberInfo ( INmMember * pMember )

Definition at line 561 of file Debug.Cpp.

{
  HRESULT     hr      = NO_ERROR  ;
  BSTR      bstr    = NULL    ;
  BOOL      fLocal    = FALSE   ;
  BOOL      fMcu    = FALSE   ;
  BOOL      fTop    = FALSE   ;
  ULONG     uchCaps   = 0     ;
  ULONG     uVer    = 0     ;
  INmConference * pConference = NULL    ;

  if  (NULL == pMember)
  {
    ERROR_MSG(TEXT("DumpMemberInfo: NULL == pMember"));
    return;
  }

  hr = pMember->GetName(&bstr);
  if (FAILED(hr))
  {
    ERROR_MSG(TEXT("Problem with GetName"));
  }

  hr = pMember->GetNmchCaps(&uchCaps);
  if (FAILED(hr))
  {
    ERROR_MSG(TEXT("Problem with GetNmchCaps"));
    uchCaps = 0;
  }

  hr = pMember->GetNmVersion(&uVer);
  if (FAILED(hr))
  {
    ERROR_MSG(TEXT("Problem with GetNmVersion"));
    uVer = 0;
  }

  fLocal = S_OK == pMember->IsSelf();
  fMcu = S_OK == pMember->IsMCU();

  fTop = FALSE;
  hr = pMember->GetConference(&pConference);
  if (FAILED(hr) || (NULL == pConference))
  {
    TRACE_MSG(TEXT("Problem with GetConference"));
  }
  else
  {
    INmMember * pMemberTop  = NULL;
    if (SUCCEEDED(pConference->GetTopProvider(&pMemberTop)) && (NULL != pMemberTop))
    {
      fTop = (pMember == pMemberTop);

      pMemberTop->Release();
      pMemberTop = NULL;
    }

    pConference->Release();
    pConference = NULL;
  }

  TRACE_MSG(TEXT("[%08X] Member=[%s] "), pMember, (LPTSTR) BTSTR(bstr));
  TRACE_MSG(TEXT("Local=%d, MCU=%d, Top=%d, uch=%08X, version=%d"), fLocal, fMcu, fTop, uchCaps, uVer);

  SysFreeString(bstr);
}

VOID ErrorMsg | ( | LPTSTR | ptszFormat,
 |  |  | ...
 | ) |  |

Definition at line 366 of file Debug.Cpp.

{
  TCHAR szMsg[1024];
  va_list v1;

  ZeroMemory(szMsg, 1024 * sizeof(TCHAR));

  va_start(v1, ptszFormat);
  _vsntprintf(szMsg, 1023, ptszFormat, v1);
  va_end(v1);

  Log(RGB(255, 0, 0), szMsg);

#ifdef DEBUG
  OutputDebugString(szMsg);
  OutputDebugString(TEXT("\r\n"));
#endif
}

BOOL FCreateSbar ( void )

Definition at line 293 of file sBar.Cpp.

{
  ghwndSbar = CreateWindow(STATUSCLASSNAME, NULL,
    WS_CHILD | SBARS_SIZEGRIP,
    0, 0, 0, 0,
    ghwndMain, (HMENU) IDW_SBAR, ghInst, NULL);

  return (ghwndSbar != NULL);
}

BOOL FCreateTbar ( void )

Definition at line 127 of file sBar.Cpp.

{
  DWORD   cBtn  = 0;
  LPTBBUTTON  ptbb  = 0;

  ptbb = _GetDefaultTbb(&cBtn, FALSE /* fReset */);
  if (NULL == ptbb)
    return FALSE;

  ghwndTbar = CreateToolbarEx(ghwndMain,
    WS_CHILD | CCS_ADJUSTABLE |
      TBSTYLE_TOOLTIPS | TBSTYLE_ALTDRAG, // | TBSTYLE_WRAPABLE
    IDW_TBAR,
    NUMIMAGES,
    ghInst,
    IDC_TOOLBAR,
    ptbb,
    cBtn,
    BUTTONWIDTH,
    BUTTONHEIGHT,
    IMAGEWIDTH,
    IMAGEHEIGHT,
    sizeof(TBBUTTON));

  FreePlpv(&ptbb);

  return (ghwndTbar != NULL);
}

BOOL FGetDirectory ( LPTSTR szDir )

Definition at line 483 of file Util.Cpp.

{
  BOOL      fRet    = FALSE;
  LPITEMIDLIST  pidl    = NULL;
  LPITEMIDLIST  pidlRoot  = NULL;
  LPMALLOC    lpMalloc  = NULL;

  TCHAR     szPath[MAX_PATH + 1];
  ZeroMemory(szPath, sizeof(TCHAR) * (MAX_PATH + 1));

  BROWSEINFO bi = {
    ghwndMain,
    NULL,
    szPath,
    TEXT("Select a Directory\0"),
    BIF_RETURNONLYFSDIRS,
    NULL, 0L, 0 };

  if  (0 != SHGetSpecialFolderLocation(HWND_DESKTOP, CSIDL_DRIVES, &pidlRoot))
    return FALSE;

  if  (NULL == pidlRoot)
    return FALSE;

  bi.pidlRoot = pidlRoot;
  pidl = SHBrowseForFolder(&bi);

  if  (NULL != pidl)
    fRet = SHGetPathFromIDList(pidl, szDir);
  else
    fRet = FALSE;

  // Get the shell's allocator to free PIDLs
  if (!SHGetMalloc(&lpMalloc) && (NULL != lpMalloc))
  {
    if (NULL != pidlRoot)
    {
      lpMalloc->Free(pidlRoot);
      pidlRoot = NULL;
    }

    if (NULL != pidl)
    {
      lpMalloc->Free(pidl);
      pidl = NULL;
    }

    lpMalloc->Release();
    lpMalloc = NULL;
  }

  return fRet;
}

BOOL FGetFileName ( LPTSTR szFileName )

Definition at line 28 of file Util.Cpp.

{
  OPENFILENAME ofn;

  if  (NULL == szFileName)
    return FALSE;

  szFileName[0] = 0;

  ZeroMemory(&ofn, sizeof(OPENFILENAME));

  ofn.lStructSize   = sizeof(OPENFILENAME);
  ofn.hwndOwner     = ghwndMain;
  ofn.hInstance     = (HINSTANCE) ghInst;
  ofn.lpstrFilter   = _szFilter;
  ofn.nFilterIndex  = 1L;
  ofn.lpstrFile     = szFileName;
  ofn.nMaxFile      = MAX_PATH; // really max characters for szFileName
  ofn.lpstrTitle    = _szPickMsg;
  ofn.lpstrInitialDir = NULL;
  ofn.Flags = OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_EXPLORER;

  return GetOpenFileName(&ofn);
}

BOOL FInitApp | ( | LPTSTR | lpszCmd,
 |  | int | nCmdShow
 | ) |  |
VOID FreeAllComObjects ( void )

Definition at line 395 of file Init.Cpp.

{
  // Release all objects to which this app has a reference
  FreeAs();

  if(NULL != g_pNotifyFileTransfer)
  {
    g_pNotifyFileTransfer->Disconnect();
    g_pNotifyFileTransfer->Release();
    g_pNotifyFileTransfer = NULL;
  }

  if(NULL != g_pChannelFt)
  {
    g_pChannelFt->Release();
    g_pChannelFt = NULL;
  }

  FreeFt();

  FreeDataChannel();
  FreeAllUsers();
  FreeChannels();
  FreeCalls();
  FreeConferences();
  FreeConfMgr();
}

VOID FreePlpv ( LPVOID plpv )

Definition at line 167 of file Util.Cpp.

{
  if ((plpv == NULL) || (*(VOID FAR * FAR *)plpv == NULL))
  {
    return;
  }

  LocalFree(*(VOID FAR * FAR *)plpv);
  *(VOID FAR * FAR *)plpv = NULL;
}

LPCTSTR GetCallStateSz ( NM_CALL_STATE uState )

Definition at line 161 of file Debug.Cpp.

{
  LPCTSTR pcsz  = NULL;
  static TCHAR _szMsg[256];

  switch (uState)
    {
  STRING_CASE(NM_CALL_INVALID);
  STRING_CASE(NM_CALL_INIT);
  STRING_CASE(NM_CALL_RING);
  STRING_CASE(NM_CALL_SEARCH);
  STRING_CASE(NM_CALL_WAIT);
  STRING_CASE(NM_CALL_ACCEPTED);
  STRING_CASE(NM_CALL_REJECTED);
  STRING_CASE(NM_CALL_CANCELED);

  default:
    ZeroMemory(_szMsg, 256 * sizeof(TCHAR));
    _sntprintf(_szMsg, 255, TEXT("NM_CALL_%04X\0"), uState);
    pcsz = _szMsg;
    break;
    }
  return pcsz;
}

LPCTSTR GetCollaborationStateSz ( NM_SHARE_STATE uState )

Definition at line 220 of file Debug.Cpp.

{
  LPCTSTR pcsz  = NULL;
  static TCHAR _szMsg[256];

  switch (uState)
    {
  STRING_CASE(NM_SHARE_COLLABORATING);
  STRING_CASE(NM_SHARE_UNKNOWN);
  STRING_CASE(NM_SHARE_IN_CONTROL);
  STRING_CASE(NM_SHARE_WORKING_ALONE);

  default:
    ZeroMemory(_szMsg, 256 * sizeof(TCHAR));
    _sntprintf(_szMsg, 255, TEXT("NM_SHARE_%04X\0"), uState);
    pcsz = _szMsg;
    break;
    }
  return pcsz;
}

LPCTSTR GetConferenceStateSz ( NM_CONFERENCE_STATE uState )

Definition at line 193 of file Debug.Cpp.

{
  LPCTSTR pcsz  = NULL;
  static TCHAR _szMsg[256];

  switch (uState)
    {
  STRING_CASE(NM_CONFERENCE_IDLE);
  STRING_CASE(NM_CONFERENCE_WAITING);
  STRING_CASE(NM_CONFERENCE_INITIALIZING);
  STRING_CASE(NM_CONFERENCE_ACTIVE);

  default:
    ZeroMemory(_szMsg, 256 * sizeof(TCHAR));
    _sntprintf(_szMsg, 255, TEXT("NM_CONFERENCE_%04X\0"), uState);
    pcsz = _szMsg;
    break;
    }
  return pcsz;
}

LPCTSTR GetConfnSz ( CONFN confn )

Definition at line 90 of file Debug.Cpp.

{
  LPCTSTR pcsz  = NULL;
  static TCHAR _szMsg[256];

  switch (confn)
    {
  STRING_CASE(CONFN_FT_UI);
  STRING_CASE(CONFN_FT_OFFERED);
  STRING_CASE(CONFN_FT_STARTED);
  STRING_CASE(CONFN_FT_PROGRESS);
  STRING_CASE(CONFN_FT_COMPLETE);
  STRING_CASE(CONFN_FT_CANCELED);

  STRING_CASE(CONFN_CALL_INCOMPATIBLE);
  STRING_CASE(CONFN_CALL_OLDER);
  STRING_CASE(CONFN_CALL_NEWER);
  STRING_CASE(CONFN_CALL_IGNORED);
  STRING_CASE(CONFN_CALL_FAILED);
  STRING_CASE(CONFN_CALL_IN_CONFERENCE);

  STRING_CASE(CONFN_NM_STARTED);
  STRING_CASE(CONFN_NM_STOPPED);

  default:
    ZeroMemory(_szMsg, 256 * sizeof(TCHAR));
    _sntprintf(_szMsg, 255, TEXT("CONFN_%08X\0"), confn);
    pcsz = _szMsg;
    break;
    }
  return pcsz;
}

VOID GetDlgItemPsz | ( | HWND | hdlg,
 |  | UINT | id,
 |  | LPTSTR * | ppsz
 | ) |  |

Definition at line 547 of file Util.Cpp.

{
  if  (NULL == ppsz)
  {
    ERROR_MSG(TEXT("GetDlgItemPsz: NULL = ppsz"));
    return;
  }

  UINT  cch   = 0;

  TCHAR sz[MAX_PATH+1];
  ZeroMemory(sz, sizeof(TCHAR) * (MAX_PATH + 1));

  FreePlpv(ppsz);

  cch = GetDlgItemText(hdlg, id, sz, MAX_PATH);
  if (0 == cch)
    return;

  *ppsz = (LPTSTR) PszAlloc(cch);
  if (NULL == *ppsz)
    return;

  ZeroMemory(*ppsz, (cch+1)* sizeof(TCHAR));  //PszAlloc allocates number of bytes passed + 1
  lstrcpyn(*ppsz, sz, cch+1);
  (*ppsz)[cch] = 0;
}

VOID GetDlgItemsRc | ( | HWND | hdlg,
 |  | int | id1,
 |  | int | id2,
 |  | LPRECT | prc
 | ) |  |
LPCTSTR GetHrSz ( HRESULT hr )

Definition at line 28 of file Debug.Cpp.

{
  LPCTSTR pcsz  = NULL;
  static TCHAR _szHRESULT[128];

  switch (hr)
    {
  STRING_CASE(S_OK);
  STRING_CASE(S_FALSE);

  STRING_CASE(NM_E_NOT_INITIALIZED);
  STRING_CASE(NM_E_CHANNEL_ALREADY_EXISTS);
  STRING_CASE(NM_E_NO_T120_CONFERENCE);
  STRING_CASE(NM_E_NOT_ACTIVE);

  STRING_CASE(DRAGDROP_S_CANCEL);
  STRING_CASE(DRAGDROP_S_DROP);
  STRING_CASE(DRAGDROP_S_USEDEFAULTCURSORS);

  STRING_CASE(E_UNEXPECTED);
  STRING_CASE(E_NOTIMPL);
  STRING_CASE(E_OUTOFMEMORY);
  STRING_CASE(E_INVALIDARG);
  STRING_CASE(E_NOINTERFACE);
  STRING_CASE(E_POINTER);
  STRING_CASE(E_HANDLE);
  STRING_CASE(E_ABORT);
  STRING_CASE(E_FAIL);
  STRING_CASE(E_ACCESSDENIED);

  STRING_CASE(CLASS_E_NOAGGREGATION);

  STRING_CASE(CO_E_NOTINITIALIZED);
  STRING_CASE(CO_E_ALREADYINITIALIZED);
  STRING_CASE(CO_E_INIT_ONLY_SINGLE_THREADED);

  STRING_CASE(REGDB_E_INVALIDVALUE);
  STRING_CASE(REGDB_E_CLASSNOTREG);
  STRING_CASE(REGDB_E_IIDNOTREG);

  STRING_CASE(DV_E_DVASPECT);
  STRING_CASE(DV_E_LINDEX);
  STRING_CASE(DV_E_TYMED);
  STRING_CASE(DV_E_FORMATETC);

  default:
    ZeroMemory(_szHRESULT, 128 * sizeof(TCHAR));
    _sntprintf(_szHRESULT, 127, TEXT("%#lx\0"), hr);
    pcsz = _szHRESULT;
    break;
    }

  return pcsz;
}

BOOL GetIniBool | ( | LPTSTR | szEntry,
 |  | BOOL | f
 | ) |  |

Definition at line 27 of file Util.Cpp.

{
  return GetPrivateProfileInt(gszAppName, pszEntry, fDefault, gszIniName) != 0;
}

VOID GetIniHex | ( | LPTSTR | szEntry,
 |  | LPVOID | lpv,
 |  | int | cb
 | ) |  |

Definition at line 93 of file Util.Cpp.

{
  TCHAR sz[MAX_PATH + 1];
  ZeroMemory(sz, (MAX_PATH + 1) * sizeof(TCHAR));

  if (GetPrivateProfileString(gszAppName, pszEntry, TEXT(""), sz, MAX_PATH, gszIniName) != 0)
  {
    HexToData(sz, lpv, (MAX_PATH < cb) ? MAX_PATH : cb);
  }
}

DWORD GetIniInt | ( | LPTSTR | szEntry,
 |  | DWORD | dwDefault
 | ) |  |

Definition at line 40 of file Util.Cpp.

{
  return GetPrivateProfileInt(gszAppName, pszEntry, dwDefault, gszIniName);
}

LPTSTR GetIniStr | ( | LPTSTR | szEntry,
 |  | LPTSTR | szDefault
 | ) |  |

Definition at line 53 of file Util.Cpp.

{
  int     cch   = 0;
  LPTSTR    pszRet  = 0;

  TCHAR   sz[MAX_PATH + 1];
  ZeroMemory(sz, (MAX_PATH + 1) * sizeof(TCHAR));

  cch = GetPrivateProfileString(gszAppName, pszEntry, pszDefault, sz, MAX_PATH, gszIniName);
  if (cch == 0)
  {
    if (NULL == pszDefault)
      return NULL;

    cch = lstrlen(pszDefault);
    lstrcpyn(sz, pszDefault, MAX_PATH+1);
    sz[MAX_PATH] = 0;
  }

  pszRet = PszAlloc(cch);
  if (pszRet == NULL)
    return NULL;

  ZeroMemory(pszRet, (cch+1)* sizeof(TCHAR)); // PszAlloc allocated cch + 1 characters
  lstrcpyn(pszRet, sz, cch+1);
  pszRet[cch] = 0;

  return pszRet;
}

LPCTSTR GetNmchSz ( ULONG uch )

Definition at line 130 of file Debug.Cpp.

{
  LPCTSTR pcsz  = NULL;
  static TCHAR _szMsg[256];

  switch (uch)
    {
  case NMCH_DATA:  pcsz = TEXT("Data");  break;
  case NMCH_AUDIO: pcsz = TEXT("Audio"); break;
  case NMCH_VIDEO: pcsz = TEXT("Video"); break;
  case NMCH_SHARE: pcsz = TEXT("Share"); break;
  case NMCH_FT:    pcsz = TEXT("Ft");    break;

  case NMCH_ALL:
  case NMCH_NONE:
  default:
    ZeroMemory(_szMsg, 256 * sizeof(TCHAR));
    _sntprintf(_szMsg, 255, TEXT("%04X\0"), uch);
    pcsz = _szMsg;
    break;
    }
  return pcsz;
}

int GetRadioButton | ( | HWND | hdlg,
 |  | int | idrFirst,
 |  | int | idrLast
 | ) |  |

Definition at line 582 of file Util.Cpp.

{
  for (int id = idrFirst; id <= idrLast; id++)
  {
    if (BST_UNCHECKED != IsDlgButtonChecked(hdlg, id))
      return id;
  }
  return idrFirst;
}

VOID GuidToSz | ( | GUID * | pguid,
 |  | LPTSTR | sz
 | ) |  |

Definition at line 606 of file Util.Cpp.

{
  ASSERT(NULL != pguid);
  ASSERT(NULL != lpchDest);

  if  ((NULL == pguid) || (NULL == lpchDest))
  {
    ERROR_MSG(TEXT("GuidToSz: Null pointer passed in as parameter"));
    return;
  }

  _sntprintf(lpchDest, 25, TEXT("{%08X-%04X-%04X-%02X%02X-"),
    pguid->Data1, pguid->Data2, pguid->Data3, pguid->Data4[0], pguid->Data4[1]);
  lpchDest += 1+8+1+4+1+4+1+2+2+1;

  for (int i = 2; i < 8; i++)
  {
    _sntprintf(lpchDest, 2, TEXT("%02X"), pguid->Data4[i]);
    lpchDest += 2;
  }

  lpchDest[0] = TEXT('}');
}

VOID HexToData | ( | LPTSTR | lpchSrc,
 |  | LPVOID | lpchDest,
 |  | int | cb
 | ) |  |

Definition at line 333 of file Util.Cpp.

{
  if  ((NULL == lpvDest) || (NULL == lpchSrc))
    return;

  PTCHAR lpchDest = (PTCHAR) lpvDest;

  CharUpperBuff(lpchSrc, cb);

  while (cb-- > 0)
  {
    *lpchDest++ = ChFromHex(lpchSrc);
    lpchSrc += 2;
  }
}

VOID InitDbg ( void )
VOID InitializeUserList | ( | HWND | hwndCombo,
 |  | BOOL | fEveryone
 | ) |  |

Definition at line 120 of file Dlg.Cpp.

{
  if (NULL == g_pListUser)
    return;

  if  (NULL == hwndCombo)
  {
    ERROR_MSG(TEXT("InitializeUserList: hwndCombo == NULL"));
    return;
  }

  POSITION pos = g_pListUser->GetHeadPosition();
  while (NULL != pos)
  {
    POSITION posSav = pos;
    PUSER pUser = (PUSER) g_pListUser->GetNext(pos);
    AddUserToUList(pUser, hwndCombo, fEveryone);
  }

  SendMessage(hwndCombo, CB_SETCURSEL, 0, 0);
}

BOOL IsSharingEnabled ( VOID )

Definition at line 1706 of file Dlg.Cpp.

{
  OSVERSIONINFO osvi;
  osvi.dwOSVersionInfoSize = sizeof(osvi);

  if(FALSE == ::GetVersionEx(&osvi))
  {
    return TRUE;
  }

    if((VER_PLATFORM_WIN32_NT == osvi.dwPlatformId) && (4 >= osvi.dwMajorVersion))
    {
    if(NT_DRIVER_START_DISABLED == GetRegDWORD(HKEY_LOCAL_MACHINE, NM_NT_DISPLAY_DRIVER_KEY, REGVAL_NM_NT_DISPLAY_DRIVER_ENABLED, 0))
    {
      return FALSE;
    }
  }

  return TRUE;

}

VOID Log | ( | COLORREF | cv,
 |  | LPTSTR | lpsz
 | ) |  |

Definition at line 286 of file Debug.Cpp.

{
  int iItem = SendMessage(ghwndMsg, LB_ADDSTRING, 0, (LPARAM) pszMsg);

  SendMessage(ghwndMsg, LB_SETITEMDATA, (WPARAM)iItem, (LPARAM) cv);

  PostMessage(ghwndMsg, WM_VSCROLL, SB_BOTTOM, 0);
}

VOID LogMsg | ( | COLORREF | cv,
 |  | LPTSTR | pszFormat,
 |  |  | ...
 | ) |  |

Definition at line 392 of file Debug.Cpp.

{
  TCHAR tszMsg[1024];
  va_list v1;

  ZeroMemory(tszMsg, 1024 * sizeof(TCHAR));

  va_start(v1, tszFormat);
  _vsntprintf(tszMsg, 1023, tszFormat, v1);
  va_end(v1);

  Log(cv, tszMsg);

#ifdef DEBUG
  OutputDebugString(tszMsg);
  OutputDebugString(TEXT("\r\n"));
#endif
}

VOID LogResult | ( | LPTSTR | sz,
 |  | DWORD | dwTest,
 |  | DWORD | dwResult
 | ) |  |
VOID LogTestCancel ( LPTSTR sz )
VOID LogTestStart ( LPTSTR sz )
VOID LogTestStop ( LPTSTR sz )
LPVOID LpvAlloc ( int cb )

Definition at line 141 of file Util.Cpp.

{
  return LocalAlloc(LMEM_FIXED, cb);
}

VOID MaybeDeleteObject ( HGDIOBJ * phgdi )

Definition at line 187 of file Util.Cpp.

{
  if(NULL == phgdi || NULL == *phgdi)
  {
    return;
  }

  DeleteObject(*phgdi);
  *phgdi = NULL;
}

INT MsgBoxIMbd ( int iMbd )
INT MsgBoxIMbdDw | ( | int | iMbd,
 |  | DWORD | dw
 | ) |  |
INT MsgBoxIMbdSz | ( | int | iMbd,
 |  | LPTSTR | lpsz
 | ) |  |
VOID OnStartup ( void )

Definition at line 596 of file Cmd.Cpp.

{
  if (gPref.fAutoMonitor)
  {
    CmdMonitor();
  }

  if (gPref.fAutoHost)
  {
    DoConferenceCreate();
  }

  if (gPref.fAutoCall)
  {
    DoCallCreate();
  }
}

LPTSTR PszAlloc ( int cch )

Definition at line 153 of file Util.Cpp.

{
  return (LPTSTR) LocalAlloc(LMEM_FIXED, sizeof(TCHAR) * (cch+1));
}

VOID ReadPref ( void )

Definition at line 72 of file Init.Cpp.

{
  ZeroMemory(&gPref, sizeof(PREF));

  gPref.fSbar       = GetIniBool(gszSbar, TRUE);
  gPref.fTbar       = GetIniBool(gszTbar, TRUE);
  gPref.fMsg        = GetIniBool(gszMsg, TRUE);
  gPref.fChat       = GetIniBool(gszChat, TRUE);

  gPref.pszConferenceName = GetIniStr(gszConferenceName, TEXT("NmUi Conference"));

  gPref.pszAddr    = GetIniStr(gszAddr, TEXT("User 1"));
  gPref.nmAddrType = (NM_ADDR_TYPE) GetIniInt(gszAddrType, NM_ADDR_UNKNOWN);
  gPref.nmCallType = (NM_CALL_TYPE) GetIniInt(gszIniCallType, (int) NM_CALL_DEFAULT);

  GetIniHex(gszMainWnd, &gPref.wpMain, sizeof(WINDOWPLACEMENT));
  GetIniHex(gszMsgFont, &gPref.lf, sizeof(LOGFONT));

  gPref.fAutoMonitor= GetIniBool(gszIniAutoMonitor, FALSE);
  gPref.fAutoHost   = GetIniBool(gszIniAutoHost, FALSE);
  gPref.fAutoCall   = GetIniBool(gszIniAutoCall, FALSE);
  gPref.fAutoChat   = GetIniBool(gszIniAutoChat, FALSE);

  gPref.fMsgTrace   = GetIniBool(gszIniMsgTrace, TRUE);
  gPref.fMsgObjects = GetIniBool(gszIniMsgObjects, FALSE);
  gPref.fMsgNotify  = GetIniBool(gszIniMsgNotify, TRUE);
  gPref.fMsgState   = GetIniBool(gszIniMsgState, TRUE);

  gPref.iInit       = GetIniInt(gszIniInit, NM_INIT_NORMAL);

  gPref.pszFileName = GetIniStr(gszFileName, TEXT("C:\\autoexec.bat"));
}

VOID RecalcMsgWindow ( void )

Definition at line 124 of file Util.Cpp.

{
  RECT rc = {0,0,0,0};

  GetClientRect(ghwndMain, &rc);
  SizeMsgWindow(rc.right, rc.bottom);
}

VOID SetMenuCheck | ( | UINT | idm,
 |  | BOOL | fCheck
 | ) |  |

Definition at line 193 of file Util.Cpp.

{
  CheckMenuItem(ghMenu, idm,
    fCheck ? (MF_CHECKED  | MF_BYCOMMAND) : (MF_UNCHECKED | MF_BYCOMMAND));
}

VOID SetToolbarCheck | ( | int | idm,
 |  | BOOL | fCheck
 | ) |  |

Definition at line 229 of file sBar.Cpp.

{
  SendMessage(ghwndTbar, TB_CHECKBUTTON,
    (WPARAM) idm, (LPARAM) MAKELONG(fCheck, 0));
}

VOID ShowHwnd | ( | HWND | hwnd,
 |  | BOOL | fShow,
 |  | int | idm
 | ) |  |

Definition at line 118 of file Util.Cpp.

{
  if (IsWindow(hwnd))
  {
    ShowWindow(hwnd, fShow ? SW_SHOW : SW_HIDE);
    SetMenuCheck(idm, fShow);
    RecalcMsgWindow();
  }
}

VOID SizeMsgWindow | ( | int | dx,
 |  | int | dy
 | ) |  |

Definition at line 106 of file Util.Cpp.

{
  MoveWindow(ghwndEdit, XP_LEFT, dy - DYP_EDIT, dx, DYP_EDIT, TRUE);
  dy -= (YP_TOP + DYP_EDIT);

  MoveWindow(ghwndUser, XP_LEFT, YP_TOP, DXP_USER, dy, TRUE);
  dx -= DXP_USER;

  MoveWindow(ghwndMsg, XP_LEFT + DXP_USER, YP_TOP, dx, dy, TRUE);
}

VOID SizeStatus | ( | int | dxClient,
 |  | int | dy
 | ) |  |

Definition at line 25 of file rtns.Cpp.

{
  int rgdxp[3];

  rgdxp[2] = dxClient;
  dxClient -= 50;
  rgdxp[1] = dxClient;
  dxClient -= 75;
  rgdxp[0] = dxClient;
  SendMessage(ghwndSbar, SB_SETPARTS, (WPARAM) 3, (LPARAM) rgdxp);
}

VOID StatusMsg ( LPTSTR sz )

Definition at line 324 of file sBar.Cpp.

{
  UpdateStatusBar(sz, IDSBP_MSG, 0);
}

LPTSTR SzFindLastCh | ( | LPTSTR | lpsz,
 |  | TCHAR | ch
 | ) |  |

Definition at line 676 of file Util.Cpp.

{
  if  (NULL == lpsz)
    return NULL;

  LPTSTR  lpchRet = NULL;

  for (lpchRet = NULL; *lpsz; lpsz = CharNext(lpsz))
  {
    if (ch == *lpsz)
      lpchRet = lpsz;
  }

  return lpchRet;
}

VOID SzToGuid | ( | LPTSTR | sz,
 |  | GUID * | pguid
 | ) |  |

Definition at line 637 of file Util.Cpp.

{
  if  (NULL == pguid)
    return;

  ZeroMemory(pguid, sizeof(GUID));

  if ((NULL == lpchSrc) || (NULL == lpchSrc[0]) || (lstrlen(lpchSrc) < sizeof(GUID)*2 + 6))
  {
    return;
  }

  if (_T('{') != *lpchSrc++)
    return;
  lpchSrc = HexToBin(lpchSrc, &pguid->Data1, sizeof(pguid->Data1));
  if (_T('-') != *lpchSrc++)
    return;
  lpchSrc = HexToBin(lpchSrc, &pguid->Data2, sizeof(pguid->Data2));
  if (_T('-') != *lpchSrc++)
    return;
  lpchSrc = HexToBin(lpchSrc, &pguid->Data3, sizeof(pguid->Data3));
  if (_T('-') != *lpchSrc++)
    return;
  lpchSrc = HexToBin(lpchSrc, &pguid->Data4[0], sizeof(BYTE));
  lpchSrc = HexToBin(lpchSrc, &pguid->Data4[1], sizeof(BYTE));
  if (_T('-') != *lpchSrc++)
    return;
  HexToData(lpchSrc, &pguid->Data4[2], sizeof(pguid->Data4) - 2*sizeof(BYTE));
}

VOID TraceMsg | ( | LPTSTR | ptszFormat,
 |  |  | ...
 | ) |  |

Definition at line 313 of file Debug.Cpp.

{

  TCHAR szMsg[1024];
  va_list v1;

  ZeroMemory(szMsg, 1024 * sizeof(TCHAR));

  va_start(v1, ptszFormat);
  _vsntprintf(szMsg, 1023, ptszFormat, v1);
  va_end(v1);

  Log(RGB(0, 0, 0), szMsg);

#ifdef DEBUG
  OutputDebugString(szMsg);
  OutputDebugString(TEXT("\r\n"));
#endif
}

VOID UpdateHdlgIdInt | ( | HWND | hdlg,
 |  | int | id,
 |  | LPINT | lpint
 | ) |  |
VOID UpdateHdlgIdText | ( | HWND | hdlg,
 |  | int | id,
 |  | LPVOID | lpv
 | ) |  |
VOID UpdateStatusBar | ( | LPTSTR | lpsz,
 |  | WORD | wPart,
 |  | WORD | wFlags
 | ) |  |

Definition at line 312 of file sBar.Cpp.

{
    SendMessage(ghwndSbar, SB_SETTEXT, wPart | wFlags, (LPARAM) lpsz);
}

VOID UpdateStatusIcon ( DWORD dwId )

Definition at line 336 of file sBar.Cpp.

{
  static DWORD m_idIconStatus = 0;
  static HICON m_hIconStatus = 0;

  if (dwId == m_idIconStatus)
    return;

  HICON hIcon = (HICON) LoadImage(ghInst,
        MAKEINTRESOURCE(dwId), IMAGE_ICON,
        STATUSICONSIZE, STATUSICONSIZE,
        LR_DEFAULTCOLOR | LR_SHARED);
  if (NULL == hIcon)
  {
    return;
  }

  m_idIconStatus = dwId;
  m_hIconStatus = hIcon;
  SendMessage(ghwndSbar, SB_SETTEXT,
      IDSBP_ICON | SBT_OWNERDRAW, (LPARAM) m_hIconStatus);
}

VOID WarnMsg | ( | LPTSTR | ptszFormat,
 |  |  | ...
 | ) |  |

Definition at line 340 of file Debug.Cpp.

{
  TCHAR szMsg[1024];
  va_list v1;

  ZeroMemory(szMsg, 1024 * sizeof(TCHAR));

  va_start(v1, ptszFormat);
  _vsntprintf(szMsg, 1023, ptszFormat, v1);
  va_end(v1);

  Log(RGB(0, 0, 255), szMsg);

#ifdef DEBUG
  OutputDebugString(szMsg);
  OutputDebugString(TEXT("\r\n"));
#endif
}

LRESULT CALLBACK WndProc | ( | HWND | ,
 |  | UINT | ,
 |  | WPARAM | ,
 |  | LPARAM |
 | ) |  |

Definition at line 290 of file Generic.C.

{
   int wmId, wmEvent;
   PAINTSTRUCT ps;
   HDC hdc;
      POINT pnt;
   HMENU hMenu;
      BOOL bGotHelp;

   switch (message) {

      case WM_COMMAND:
         wmId    = LOWORD(wParam); // Remember, these are...
         wmEvent = HIWORD(wParam); // ...different for Win32!

         //Parse the menu selections:
         switch (wmId) {

            case IDM_ABOUT:
               DialogBox(hInst, "AboutBox", hWnd, (DLGPROC)About);
               break;

            case IDM_EXIT:
               DestroyWindow (hWnd);
               break;

            case IDM_HELPTOPICS: // Only called in Windows 95
               bGotHelp = WinHelp (hWnd, APPNAME".HLP", HELP_FINDER,(DWORD)0);
               if (!bGotHelp)
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            case IDM_HELPCONTENTS: // Not called in Windows 95
               bGotHelp = WinHelp (hWnd, APPNAME".HLP", HELP_CONTENTS,(DWORD)0);
               if (!bGotHelp)
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            case IDM_HELPSEARCH: // Not called in Windows 95
               if (!WinHelp(hWnd, APPNAME".HLP", HELP_PARTIALKEY,
                           (ULONG_PTR)(LPSTR)""))
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            case IDM_HELPHELP: // Not called in Windows 95
               if(!WinHelp(hWnd, (LPSTR)NULL, HELP_HELPONHELP, 0))
               {
                  MessageBox (GetFocus(), GetStringRes(IDS_NO_HELP),
                              szAppName, MB_OK|MB_ICONHAND);
               }
               break;

            // Here are all the other possible menu options,
            // all of these are currently disabled:
            case IDM_NEW:
            case IDM_OPEN:
            case IDM_SAVE:
            case IDM_SAVEAS:
            case IDM_UNDO:
            case IDM_CUT:
            case IDM_COPY:
            case IDM_PASTE:
            case IDM_LINK:
            case IDM_LINKS:

            default:
               return (DefWindowProc(hWnd, message, wParam, lParam));
         }
         break;

      case WM_NCRBUTTONUP: // RightClick on windows non-client area...
         if (IS_WIN95 && SendMessage(hWnd, WM_NCHITTEST, 0, lParam) == HTSYSMENU)
         {
            // The user has clicked the right button on the applications
            // 'System Menu'. Here is where you would alter the default
            // system menu to reflect your application. Notice how the
            // explorer deals with this. For this app, we aren't doing
            // anything
            return (DefWindowProc(hWnd, message, wParam, lParam));
         } else {
            // Nothing we are interested in, allow default handling...
            return (DefWindowProc(hWnd, message, wParam, lParam));
         }
            break;

        case WM_RBUTTONDOWN: // RightClick in windows client area...
            pnt.x = LOWORD(lParam);
            pnt.y = HIWORD(lParam);
            ClientToScreen(hWnd, (LPPOINT) &pnt);
      // This is where you would determine the appropriate 'context'
      // menu to bring up. Since this app has no real functionality,
      // we will just bring up the 'Help' menu:
            hMenu = GetSubMenu (GetMenu (hWnd), 2);
            if (hMenu) {
                TrackPopupMenu (hMenu, 0, pnt.x, pnt.y, 0, hWnd, NULL);
            } else {
            // Couldn't find the menu...
                MessageBeep(0);
            }
            break;

      case WM_DISPLAYCHANGE: // Only comes through on plug'n'play systems
      {
         SIZE  szScreen;
         DWORD dwBitsPerPixel = (DWORD)wParam;

         szScreen.cx = LOWORD(lParam);
         szScreen.cy = HIWORD(lParam);

         MessageBox (GetFocus(), GetStringRes(IDS_DISPLAYCHANGED),
                     szAppName, 0);
      }
      break;

      case WM_PAINT:
         hdc = BeginPaint (hWnd, &ps);
         // Add any drawing code here...
         EndPaint (hWnd, &ps);
         break;

      case WM_DESTROY:
         // Tell WinHelp we don't need it any more...
               WinHelp (hWnd, APPNAME".HLP", HELP_QUIT,(DWORD)0);
         PostQuitMessage(0);
         break;

      default:
         return (DefWindowProc(hWnd, message, wParam, lParam));
   }
   return (0);
}

VOID WriteIniBool | ( | LPTSTR | szEntry,
 |  | BOOL | f
 | ) |  |

Definition at line 145 of file Util.Cpp.

{
  WritePrivateProfileString(gszAppName, pszEntry, f ? TEXT("1") : TEXT("0"), gszIniName);
}

VOID WriteIniHex | ( | LPTSTR | szEntry,
 |  | LPVOID | lpv,
 |  | int | cb
 | ) |  |

Definition at line 156 of file Util.Cpp.

{
  if  ((NULL == pszEntry) || (NULL == lpv))
  {
    ERROR_MSG(TEXT("WriteIniHex: NULL == in parameter"));
    return;
  }

  TCHAR sz[MAX_PATH + 1];
  ZeroMemory(sz, sizeof(TCHAR) * (MAX_PATH+1));

  DataToHex((LPTSTR) lpv, sz, 2*cb > MAX_PATH ? MAX_PATH : 2*cb);

  WriteIniStr(pszEntry, sz);

}

VOID WriteIniInt | ( | LPTSTR | szEntry,
 |  | DWORD | dw
 | ) |  |

Definition at line 127 of file Util.Cpp.

{
  TCHAR szData[MAX_PATH + 1];
  ZeroMemory(szData, (MAX_PATH + 1) * sizeof(TCHAR));

  _sntprintf(szData, MAX_PATH, TEXT("%d\0"), dw);
  WritePrivateProfileString(gszAppName, pszEntry, szData, gszIniName);
}

VOID WriteIniStr | ( | LPTSTR | szEntry,
 |  | LPTSTR | sz
 | ) |  |

Definition at line 113 of file Util.Cpp.

{
  WritePrivateProfileString(gszAppName, pszEntry, pszData, gszIniName);
}

VOID WriteIniTbar ( void )

Definition at line 253 of file sBar.Cpp.

{
  int     iBtn  = 0;
  int     cBtn  = 0;
  LPTSTR    lpsz  = 0;
  LPTSTR    lpch  = 0;
  TBBUTTON  tbb;

  if (NULL == ghwndTbar)
    return; // no toolbar?

  cBtn = SendMessage(ghwndTbar, TB_BUTTONCOUNT, 0, 0);
  if (0 == cBtn)
    return;

  lpsz = (LPTSTR) LpvAlloc((cBtn*2 + 1) * sizeof(TCHAR));
  if (NULL == lpsz)
    return;
  ZeroMemory(lpsz, (cBtn*2 + 1) * sizeof(TCHAR));

  lpch = lpsz;
  for (iBtn = 0; iBtn < cBtn; iBtn++)
  {
    SendMessage(ghwndTbar, TB_GETBUTTON, (WPARAM) iBtn, (LPARAM) (LPTBBUTTON) &tbb);
    _sntprintf(lpch, 2, TEXT("%02X"), LOBYTE(tbb.dwData));
    lpch += 2;
  }
  WriteIniStr(_szToolbar, lpsz);
  FreePlpv(&lpsz);
}

VOID WritePref ( void )

Definition at line 114 of file Init.Cpp.

{
  WriteIniBool(gszSbar, gPref.fSbar);
  WriteIniBool(gszTbar, gPref.fTbar);
  WriteIniBool(gszMsg, gPref.fMsg);
  WriteIniBool(gszChat, gPref.fChat);

  WriteIniStr(gszConferenceName, gPref.pszConferenceName);
  FreePlpv(&gPref.pszConferenceName);

  WriteIniStr(gszFileName, gPref.pszFileName);
  FreePlpv(&gPref.pszFileName);

  WriteIniStr(gszAddr, gPref.pszAddr);
  FreePlpv(&gPref.pszAddr);
  WriteIniInt(gszAddrType, (int) gPref.nmAddrType);
  WriteIniInt(gszIniCallType, (int) gPref.nmCallType);

  if (NULL != ghwndMain)
  {
    gPref.wpMain.length = sizeof(WINDOWPLACEMENT);
    GetWindowPlacement(ghwndMain, &gPref.wpMain);
  }
  WriteIniHex(gszMainWnd, &gPref.wpMain, sizeof(WINDOWPLACEMENT));

  WriteIniHex(gszMsgFont, &gPref.lf, sizeof(LOGFONT));

  WriteIniTbar();

  WriteIniBool(gszIniAutoMonitor, gPref.fAutoMonitor);
  WriteIniBool(gszIniAutoHost,    gPref.fAutoHost);
  WriteIniBool(gszIniAutoCall,    gPref.fAutoCall);
  WriteIniBool(gszIniAutoChat,    gPref.fAutoChat);

  WriteIniInt(gszIniInit,        gPref.iInit);

  WriteIniBool(gszIniMsgTrace,    gPref.fMsgTrace);
  WriteIniBool(gszIniMsgObjects,  gPref.fMsgObjects);
  WriteIniBool(gszIniMsgNotify,   gPref.fMsgNotify);
  WriteIniBool(gszIniMsgState,    gPref.fMsgState);
}

Variable Documentation

int gdxWndMin

Definition at line 40 of file Main.Cpp.

int gdyWndMin

Definition at line 41 of file Main.Cpp.

HACCEL ghAccelTable

Definition at line 25 of file Main.Cpp.

HWND ghdlgStatus
HFONT ghfontEntry

Definition at line 37 of file Main.Cpp.

HINSTANCE ghInst

Name of app.

Definition at line 24 of file ole2ui.c.

HMENU ghMenu

Definition at line 26 of file Main.Cpp.

HWND ghwndChat

Definition at line 32 of file Main.Cpp.

HWND ghwndLView

Definition at line 35 of file Main.Cpp.

HWND ghwndMain

Definition at line 447 of file MfEdit.h.

HWND ghwndMsg

Definition at line 28 of file Main.Cpp.

HWND ghwndSbar

Definition at line 29 of file Main.Cpp.

HWND ghwndSend

Definition at line 33 of file Main.Cpp.

HWND ghwndTbar

Definition at line 30 of file Main.Cpp.

HWND ghwndUList

Definition at line 34 of file Main.Cpp.

PREF gPref

Definition at line 34 of file Main.Cpp.

TCHAR gszAppName[]

Definition at line 38 of file Main.Cpp.

TCHAR gszIniName[]

Definition at line 21 of file Init.Cpp.

Generated on Wed Nov 13 2024 16:53:35 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMUI/IMSConf2.Idl File Reference

  • Web
  • NetMeeting
  • NMUI
Functions | Variables

IMSConf2.Idl File Reference

Go to the source code of this file.

Functions

cpp_quote ("//+-------------------------------------------------------------------------") cpp_quote(" cpp_quote("cpp_quote(" cpp_quote("cpp_quote(" cpp_quote("cpp_quote(" import "objidl.idl"
cpp_quote ("") cpp_quote(" cpp_quote("cpp_quote(" cpp_quote("") cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("") cpp_quote(" cpp_quote("cpp_quote("cpp_quote("cpp_quote(" cpp_quote("") cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("") cpp_quote(" cpp_quote("cpp_quote("") cpp_quote(" cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote(" cpp_quote("") cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("cpp_quote("") cpp_quote("") cpp_quote(" cpp_quote("cpp_quote("cpp_quote("cpp_quote("") cpp_quote("") cpp_quote(" cpp_quote("cpp_quote("") cpp_quote("cpp_quote("") cpp_quote("enum

Variables

import oleidl idl

Function Documentation

cpp_quote ( "//+-------------------------------------------------------------------------" )
cpp_quote ( "" )

Definition at line 57 of file IMSConf2.Idl.

Variable Documentation

import oaidl idl

Definition at line 25 of file IMSConf2.Idl.

Generated on Wed Nov 13 2024 16:54:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMUI/Init.Cpp File Reference

  • Web
  • NetMeeting
  • NMUI
Functions | Variables

Init.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

VOID | CmdChat (void)
BOOL | FCreateChatWindow (void)
BOOL | FCreateLView (void)
BOOL | FCreateMsgWindow (void)
BOOL | FInitApp (LPSTR lpszCmd, int nCmdShow)
BOOL | FInitMain (void)
VOID | FreeAllComObjects (void)
VOID | ReadPref (void)
LRESULT FAR PASCAL | SubClsEdit (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
VOID | WritePref (void)

Variables

INmChannelFt * | g_pChannelFt
CFileTransferNotify * g_pNotifyFileTransfer
TCHAR | gszAddr [] = TEXT("Addr")
TCHAR | gszAddrType [] = TEXT("AddrType")
TCHAR | gszAppClassName [] = TEXT("NMUI")
TCHAR | gszAppName [] = TEXT("NmUi")
TCHAR | gszChat [] = TEXT("Chat")
TCHAR | gszConferenceName [] = TEXT("Conference Name")
TCHAR | gszFileName [] = TEXT("Filename")
TCHAR | gszIniAutoCall [] = TEXT("AutoCall")
TCHAR | gszIniAutoChat [] = TEXT("AutoChat")
TCHAR | gszIniAutoHost [] = TEXT("AutoHost")
TCHAR | gszIniAutoMonitor [] = TEXT("AutoMonitor")
TCHAR | gszIniCallType [] = TEXT("CallType")
TCHAR | gszIniInit [] = TEXT("Init")
TCHAR | gszIniMsgNotify [] = TEXT("Notify Msgs")
TCHAR | gszIniMsgObjects [] = TEXT("Object Msgs")
TCHAR | gszIniMsgState [] = TEXT("State change Msgs")
TCHAR | gszIniMsgTrace [] = TEXT("Trace Msgs")
TCHAR | gszIniName [] = TEXT("NmUi.ini")
TCHAR | gszMainWnd [] = TEXT("MainWnd")
TCHAR | gszMsg [] = TEXT("Messages")
TCHAR | gszMsgFont [] = TEXT("Message Font")
TCHAR | gszSbar [] = TEXT("SBar")
TCHAR | gszTbar [] = TEXT("TBar")
WNDPROC | lpProcEdit = NULL

Function Documentation

VOID CmdChat ( void )

Definition at line 204 of file Cmd.Cpp.

{
  TCHAR sz[MAX_PATH + 1];
  ZeroMemory(sz, (MAX_PATH+1) * sizeof(TCHAR));

  // Get the text line
  SendMessage(ghwndChat, WM_GETTEXT, (WPARAM) MAX_PATH, (LPARAM) sz);
  SendMessage(ghwndChat, EM_SETSEL, (WPARAM) 0, (LPARAM)-1);
  SendMessage(ghwndChat, WM_SETTEXT, (WPARAM) 0, (LPARAM) "");

  if (NULL != g_pChannelData)
  {
    INmMember * pMember = NULL;
    int iSel = SendMessage(ghwndUList, CB_GETCURSEL, 0, 0);
    if (CB_ERR != iSel)
    {
      PUSER pUser = (PUSER) SendMessage(ghwndUList, CB_GETITEMDATA, (WPARAM) iSel, 0);
      if (NULL != pUser)
        pMember = pUser->pMember;
    }
    DoSendChatMsg(sz, pMember);
  }

  SetFocus(ghwndChat);
}

BOOL FCreateChatWindow ( void )

Definition at line 250 of file Init.Cpp.

{
  ghwndChat = CreateWindow(TEXT("EDIT"), NULL,
    WS_CHILD | WS_VISIBLE | WS_BORDER | WS_CLIPSIBLINGS |  WS_TABSTOP |
      ES_AUTOHSCROLL,
    0, 0, DXP_SEND, DYP_SEND,
    ghwndMain, (HMENU) IDW_CHAT, ghInst, NULL);
  if (ghwndChat == NULL)
    return FALSE;

  // set the font for the window

  ghwndSend = CreateWindow(TEXT("BUTTON"), TEXT("Send To"),
    WS_CHILD | WS_VISIBLE | WS_BORDER | WS_CLIPSIBLINGS | WS_TABSTOP |
      BS_DEFPUSHBUTTON,
    0, 0, DXP_SEND, DYP_SEND,
    ghwndMain, (HMENU) IDW_SEND, ghInst, NULL);
  if (ghwndSend == NULL)
    return FALSE;

  lpProcEdit = (WNDPROC) GetWindowLongPtr(ghwndChat, GWLP_WNDPROC);
  SetWindowLongPtr(ghwndChat, GWLP_WNDPROC, (LONG)(WNDPROC) SubClsEdit);

  ghwndUList = CreateWindow(TEXT("COMBOBOX"), TEXT("Everyone"),
    WS_CHILD | WS_VISIBLE | WS_BORDER | WS_CLIPSIBLINGS | WS_VSCROLL | WS_TABSTOP |
      CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED,
    0, 0, DXP_ULIST, DYP_ULIST,
    ghwndMain, (HMENU) IDL_USERS, ghInst, NULL);
  if (ghwndUList == NULL)
    return FALSE;

  return TRUE;
}

BOOL FCreateLView ( void )

Definition at line 163 of file Init.Cpp.

{
  ghwndLView = CreateWindow(TEXT("SysListView32"), NULL,
    WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_BORDER | WS_CLIPSIBLINGS | LVS_REPORT,
    0, 0, 0, 0,
    ghwndMain, (HMENU) IDW_LVIEW, ghInst, NULL);
  if (ghwndLView == NULL)
    return FALSE;

  ListView_SetExtendedListViewStyle(ghwndLView, LVS_EX_FULLROWSELECT);

  // Initialize column data
  {
    int     iCol  = 0;
    LPCOL   lpCol = _rgColMember;
    LV_COLUMN lvc;

    ZeroMemory(&lvc, sizeof(LV_COLUMN));

    lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
    lvc.fmt = LVCFMT_LEFT;
    for (iCol = 0; iCol < ARRAY_ELEMENTS(_rgColMember); iCol++)
    {
      lvc.iSubItem = iCol;
      lvc.cx = lpCol->dwWidth;
      lvc.pszText = lpCol->lpsz;
      if (ListView_InsertColumn(ghwndLView, iCol, &lvc) == -1)
        return FALSE;
      lpCol++;
    }
  }

  return TRUE;
}

BOOL FCreateMsgWindow ( void )

Definition at line 207 of file Init.Cpp.

{
  ghwndMsg = CreateWindow(TEXT("LISTBOX"), NULL,
    WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_BORDER | WS_CLIPSIBLINGS |
    LBS_USETABSTOPS | LBS_NOINTEGRALHEIGHT | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS ,
    0, 0, 0, 0,
    ghwndMain, (HMENU) IDW_MSG, ghInst, NULL);
  if (ghwndMsg == NULL)
    return FALSE;

  // set the font for the window
  ghfontEntry = CreateFontIndirect(&gPref.lf);
  if (NULL == ghfontEntry)
    return TRUE;

  SendMessage(ghwndMsg, WM_SETFONT, (WPARAM) ghfontEntry, MAKELPARAM(TRUE, 0));

  return TRUE;
}

BOOL FInitApp | ( | LPSTR | lpszCmd,
 |  | int | nCmdShow
 | ) |  |

Definition at line 361 of file Init.Cpp.

{
  InitCommonControls();

  if (FAILED(CoInitialize(NULL)))
    return FALSE;

  ReadPref();

  if (!FInitMain())
    return FALSE;

  ASSERT(NULL != ghwndMain);
  ShowWindow(ghwndMain, nCmdShow);
  UpdateWindow(ghwndMain);

  TRACE_MSG(TEXT("System Initialized"));

  OnStartup();
  return TRUE;
}

BOOL FInitMain ( void )

Definition at line 293 of file Init.Cpp.

{
  TCHAR szTitle[MAX_PATH + 1];
  WNDCLASS  wc;

  ZeroMemory(szTitle, sizeof(TCHAR) * (MAX_PATH + 1));
  ZeroMemory(&wc, sizeof(wc));

  ASSERT(NULL != ghInst);
  if (NULL == ghInst)
  {
    ERROR_MSG(TEXT("FInitMain: NULL == ghInst"));
    return FALSE;
  }

  ghAccelTable = LoadAccelerators(ghInst, MAKEINTRESOURCE(ID_APPACCEL));

  LoadString(ghInst, IDS_APP_TITLE, szTitle, MAX_PATH);

  wc.style         = CS_HREDRAW | CS_VREDRAW;
  wc.lpfnWndProc   = (WNDPROC)WndProc;
  wc.cbClsExtra    = 0;
  wc.cbWndExtra    = 0;
  wc.hInstance     = ghInst;
  wc.hIcon         = LoadIcon(ghInst, MAKEINTRESOURCE(ICO_MAIN));
  wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
  wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
  wc.lpszMenuName  = MAKEINTRESOURCE(IDM_APP);
  wc.lpszClassName = gszAppClassName;

  // Register the window class and return FALSE if unsuccesful.
  if (!RegisterClass(&wc))
    return FALSE;

  // MAIN WINDOW
  // Create a main window for this application instance.
  ghwndMain = CreateWindow(gszAppClassName, szTitle, WS_OVERLAPPEDWINDOW,
    CW_USEDEFAULT, 0, CW_USEDEFAULT, 0,
    NULL, NULL, ghInst, NULL);
  if (ghwndMain == NULL)
    return FALSE;

  ghMenu = GetMenu(ghwndMain);
  if (NULL == ghMenu)
    return FALSE;

  if (!FCreateSbar() || !FCreateTbar() ||
    !FCreateLView() || !FCreateMsgWindow() || !FCreateChatWindow())
    return FALSE;

  ShowHwnd(ghwndTbar, gPref.fTbar, IDM_VIEW_TBAR);
  ShowHwnd(ghwndSbar, gPref.fSbar, IDM_VIEW_SBAR);

  if (gPref.wpMain.length != 0)
    SetWindowPlacement(ghwndMain, &gPref.wpMain);

  return TRUE;
}

VOID FreeAllComObjects ( void )

Definition at line 395 of file Init.Cpp.

{
  // Release all objects to which this app has a reference
  FreeAs();

  if(NULL != g_pNotifyFileTransfer)
  {
    g_pNotifyFileTransfer->Disconnect();
    g_pNotifyFileTransfer->Release();
    g_pNotifyFileTransfer = NULL;
  }

  if(NULL != g_pChannelFt)
  {
    g_pChannelFt->Release();
    g_pChannelFt = NULL;
  }

  FreeFt();

  FreeDataChannel();
  FreeAllUsers();
  FreeChannels();
  FreeCalls();
  FreeConferences();
  FreeConfMgr();
}

VOID ReadPref ( void )

Definition at line 72 of file Init.Cpp.

{
  ZeroMemory(&gPref, sizeof(PREF));

  gPref.fSbar       = GetIniBool(gszSbar, TRUE);
  gPref.fTbar       = GetIniBool(gszTbar, TRUE);
  gPref.fMsg        = GetIniBool(gszMsg, TRUE);
  gPref.fChat       = GetIniBool(gszChat, TRUE);

  gPref.pszConferenceName = GetIniStr(gszConferenceName, TEXT("NmUi Conference"));

  gPref.pszAddr    = GetIniStr(gszAddr, TEXT("User 1"));
  gPref.nmAddrType = (NM_ADDR_TYPE) GetIniInt(gszAddrType, NM_ADDR_UNKNOWN);
  gPref.nmCallType = (NM_CALL_TYPE) GetIniInt(gszIniCallType, (int) NM_CALL_DEFAULT);

  GetIniHex(gszMainWnd, &gPref.wpMain, sizeof(WINDOWPLACEMENT));
  GetIniHex(gszMsgFont, &gPref.lf, sizeof(LOGFONT));

  gPref.fAutoMonitor= GetIniBool(gszIniAutoMonitor, FALSE);
  gPref.fAutoHost   = GetIniBool(gszIniAutoHost, FALSE);
  gPref.fAutoCall   = GetIniBool(gszIniAutoCall, FALSE);
  gPref.fAutoChat   = GetIniBool(gszIniAutoChat, FALSE);

  gPref.fMsgTrace   = GetIniBool(gszIniMsgTrace, TRUE);
  gPref.fMsgObjects = GetIniBool(gszIniMsgObjects, FALSE);
  gPref.fMsgNotify  = GetIniBool(gszIniMsgNotify, TRUE);
  gPref.fMsgState   = GetIniBool(gszIniMsgState, TRUE);

  gPref.iInit       = GetIniInt(gszIniInit, NM_INIT_NORMAL);

  gPref.pszFileName = GetIniStr(gszFileName, TEXT("C:\\autoexec.bat"));
}

LRESULT FAR PASCAL SubClsEdit | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 232 of file Init.Cpp.

{
  if ((uMsg == WM_CHAR) && (VK_RETURN == wParam))
  {
    CmdChat();
    return 0L;
  }

  return CallWindowProc(lpProcEdit, hwnd, uMsg, wParam, lParam);
}

VOID WritePref ( void )

Definition at line 114 of file Init.Cpp.

{
  WriteIniBool(gszSbar, gPref.fSbar);
  WriteIniBool(gszTbar, gPref.fTbar);
  WriteIniBool(gszMsg, gPref.fMsg);
  WriteIniBool(gszChat, gPref.fChat);

  WriteIniStr(gszConferenceName, gPref.pszConferenceName);
  FreePlpv(&gPref.pszConferenceName);

  WriteIniStr(gszFileName, gPref.pszFileName);
  FreePlpv(&gPref.pszFileName);

  WriteIniStr(gszAddr, gPref.pszAddr);
  FreePlpv(&gPref.pszAddr);
  WriteIniInt(gszAddrType, (int) gPref.nmAddrType);
  WriteIniInt(gszIniCallType, (int) gPref.nmCallType);

  if (NULL != ghwndMain)
  {
    gPref.wpMain.length = sizeof(WINDOWPLACEMENT);
    GetWindowPlacement(ghwndMain, &gPref.wpMain);
  }
  WriteIniHex(gszMainWnd, &gPref.wpMain, sizeof(WINDOWPLACEMENT));

  WriteIniHex(gszMsgFont, &gPref.lf, sizeof(LOGFONT));

  WriteIniTbar();

  WriteIniBool(gszIniAutoMonitor, gPref.fAutoMonitor);
  WriteIniBool(gszIniAutoHost,    gPref.fAutoHost);
  WriteIniBool(gszIniAutoCall,    gPref.fAutoCall);
  WriteIniBool(gszIniAutoChat,    gPref.fAutoChat);

  WriteIniInt(gszIniInit,        gPref.iInit);

  WriteIniBool(gszIniMsgTrace,    gPref.fMsgTrace);
  WriteIniBool(gszIniMsgObjects,  gPref.fMsgObjects);
  WriteIniBool(gszIniMsgNotify,   gPref.fMsgNotify);
  WriteIniBool(gszIniMsgState,    gPref.fMsgState);
}

Variable Documentation

INmChannelFt* g_pChannelFt

Definition at line 20 of file CConf.Cpp.

CFileTransferNotify* g_pNotifyFileTransfer

Definition at line 20 of file cft.cpp.

TCHAR gszAddr[] = TEXT("Addr")

Definition at line 30 of file Init.Cpp.

TCHAR gszAddrType[] = TEXT("AddrType")

Definition at line 31 of file Init.Cpp.

TCHAR gszAppClassName[] = TEXT("NMUI")

Definition at line 19 of file Init.Cpp.

TCHAR gszAppName[] = TEXT("NmUi")

Definition at line 20 of file Init.Cpp.

TCHAR gszChat[] = TEXT("Chat")

Definition at line 27 of file Init.Cpp.

TCHAR gszConferenceName[] = TEXT("Conference Name")

Definition at line 32 of file Init.Cpp.

TCHAR gszFileName[] = TEXT("Filename")

Definition at line 33 of file Init.Cpp.

TCHAR gszIniAutoCall[] = TEXT("AutoCall")

Definition at line 39 of file Init.Cpp.

TCHAR gszIniAutoChat[] = TEXT("AutoChat")

Definition at line 40 of file Init.Cpp.

TCHAR gszIniAutoHost[] = TEXT("AutoHost")

Definition at line 38 of file Init.Cpp.

TCHAR gszIniAutoMonitor[] = TEXT("AutoMonitor")

Definition at line 37 of file Init.Cpp.

TCHAR gszIniCallType[] = TEXT("CallType")

Definition at line 35 of file Init.Cpp.

TCHAR gszIniInit[] = TEXT("Init")

Definition at line 42 of file Init.Cpp.

TCHAR gszIniMsgNotify[] = TEXT("Notify Msgs")

Definition at line 46 of file Init.Cpp.

TCHAR gszIniMsgObjects[] = TEXT("Object Msgs")

Definition at line 45 of file Init.Cpp.

TCHAR gszIniMsgState[] = TEXT("State change Msgs")

Definition at line 47 of file Init.Cpp.

TCHAR gszIniMsgTrace[] = TEXT("Trace Msgs")

Definition at line 44 of file Init.Cpp.

TCHAR gszIniName[] = TEXT("NmUi.ini")

Definition at line 21 of file Init.Cpp.

TCHAR gszMainWnd[] = TEXT("MainWnd")

Definition at line 24 of file Init.Cpp.

TCHAR gszMsg[] = TEXT("Messages")

Definition at line 28 of file Init.Cpp.

TCHAR gszMsgFont[] = TEXT("Message Font")

Definition at line 29 of file Init.Cpp.

TCHAR gszSbar[] = TEXT("SBar")

Definition at line 25 of file Init.Cpp.

TCHAR gszTbar[] = TEXT("TBar")

Definition at line 26 of file Init.Cpp.

WNDPROC lpProcEdit = NULL

Definition at line 228 of file Init.Cpp.

Generated on Wed Nov 13 2024 16:54:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMUI/Main.Cpp File Reference

  • Web
  • NetMeeting
  • NMUI
Functions | Variables

Main.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

VOID CALLBACK | TimerProc (HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime)
int APIENTRY | WinMain (HINSTANCE hInstance, HINSTANCE hInstPrev, LPSTR lpszCmd, int nCmdShow)

Variables

int | gdxWndMin = 325
int | gdyWndMin = 250
HACCEL | ghAccelTable = NULL
HFONT | ghfontEntry = NULL
HINSTANCE | ghInst = NULL
HMENU | ghMenu = NULL
HWND | ghwndChat = NULL
HWND | ghwndEntry = NULL
HWND | ghwndLView = NULL
HWND | ghwndMain = NULL
HWND | ghwndMsg = NULL
HWND | ghwndSbar = NULL
HWND | ghwndSend = NULL
HWND | ghwndTbar = NULL
HWND | ghwndUList = NULL
PREF gPref

Function Documentation

VOID CALLBACK TimerProc | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | UINT | idEvent,
 |  | DWORD | dwTime
 | ) |  |

Definition at line 47 of file Main.Cpp.

{
  DoEnumApps();
}

int APIENTRY WinMain | ( | HINSTANCE | hInstance,
 |  | HINSTANCE | hInstPrev,
 |  | LPSTR | lpszCmd,
 |  | int | nCmdShow
 | ) |  |

Definition at line 58 of file Main.Cpp.

{
  ghInst = hInstance;

  if (FInitApp(lpszCmd, nCmdShow))
  {

    MSG  msg = {0,0,0,0,0,0};
    while (GetMessage(&msg, NULL, 0, 0))
    {
      if (!TranslateAccelerator(msg.hwnd, ghAccelTable, &msg))
      {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
      }
    }
  }

    // Uninitialize OLE
    CoUninitialize();

  return 0;
}

Variable Documentation

int gdxWndMin = 325

Definition at line 40 of file Main.Cpp.

int gdyWndMin = 250

Definition at line 41 of file Main.Cpp.

HACCEL ghAccelTable = NULL

Definition at line 25 of file Main.Cpp.

HFONT ghfontEntry = NULL

Definition at line 37 of file Main.Cpp.

HINSTANCE ghInst = NULL

Name of app.

Definition at line 24 of file Main.Cpp.

HMENU ghMenu = NULL

Definition at line 26 of file Main.Cpp.

HWND ghwndChat = NULL

Definition at line 32 of file Main.Cpp.

HWND ghwndEntry = NULL

Definition at line 36 of file Main.Cpp.

HWND ghwndLView = NULL

Definition at line 35 of file Main.Cpp.

HWND ghwndMain = NULL

Definition at line 27 of file Main.Cpp.

HWND ghwndMsg = NULL

Definition at line 31 of file Main.Cpp.

HWND ghwndSbar = NULL

Definition at line 29 of file Main.Cpp.

HWND ghwndSend = NULL

Definition at line 33 of file Main.Cpp.

HWND ghwndTbar = NULL

Definition at line 30 of file Main.Cpp.

HWND ghwndUList = NULL

Definition at line 34 of file Main.Cpp.

PREF gPref

Definition at line 39 of file Main.Cpp.

Generated on Wed Nov 13 2024 16:53:07 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMUI/Msg.Cpp File Reference

  • Web
  • NetMeeting
  • NMUI
Functions

Msg.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

VOID | CmdExit (void)
LRESULT | MsgClose (HWND hwnd, UINT uMsg, WPARAM wparam, LPARAM lparam)
LRESULT | MsgCmdMain (HWND hwnd, UINT uMsg, WPARAM wparam, LPARAM lparam)
LRESULT | MsgCreate (HWND hwnd, UINT uMsg, WPARAM wparam, LPARAM lParam)
LRESULT | MsgDestroy (HWND hwnd, UINT uMsg, WPARAM wparam, LPARAM lParam)
LRESULT | MsgDrawItem (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT | MsgGetMinMax (HWND hwnd, UINT uMsg, WPARAM wparam, LPARAM lparam)
LRESULT | MsgMenuSelect (HWND hwnd, UINT uMessage, WPARAM wparam, LPARAM lparam)
LRESULT | MsgNotify (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT | MsgNotifyTbar (HWND hwnd, UINT uMessage, WPARAM wparam, LPARAM lparam)
LRESULT | MsgSize (HWND hwnd, UINT uMsg, WPARAM wparam, LPARAM lparam)
LRESULT CALLBACK | WndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)

Function Documentation

VOID CmdExit ( void )

Definition at line 51 of file Cmd.Cpp.

{
  DestroyWindow(ghwndMain);
}

LRESULT MsgClose | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 58 of file Msg.Cpp.

{
  FreeAllComObjects();
  CmdExit();
  return 0;
}

LRESULT MsgCmdMain | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 166 of file Cmd.Cpp.

{
  UINT wCmd = (UINT) GET_WM_COMMAND_ID(wparam, lparam);

  for (LPCMD lpcmd = _rgcmdMain; 0 != lpcmd->wCmd; lpcmd++)
  {
    if (wCmd == lpcmd->wCmd)
    {
      lpcmd->pfncmd();
      break;
    }
  }

  return 0L;
}

LRESULT MsgCreate | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wparam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 46 of file Msg.Cpp.

{
  return 0;
}

LRESULT MsgDestroy | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wparam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 32 of file Msg.Cpp.

{
  FreeAllComObjects();
  PostQuitMessage(0);
  return 0;
}

LRESULT MsgDrawItem | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 116 of file Msg.Cpp.

{
  switch (wParam)
  {
  case IDW_MSG:
  {
    LPDRAWITEMSTRUCT  lpdi  = (LPDRAWITEMSTRUCT)lParam;
    TCHAR *       tsz   = 0;

    if  (NULL == lpdi)
    {
      ERROR_MSG(TEXT("MsgDrawItem: NULL == lpdi"));
      break;
    }

    COLORREF cv = SendMessage(ghwndMsg, LB_GETITEMDATA, (WPARAM)lpdi->itemID, (LPARAM)0);
    SetTextColor(lpdi->hDC, cv);

    int nLen = SendMessage(ghwndMsg, LB_GETTEXTLEN, (WPARAM) lpdi->itemID, 0);

    if  ( (0 < nLen)
      &&  (NULL != (tsz = new TCHAR[nLen + 1]))
      )
    {
      ZeroMemory(tsz, nLen + 1);

      SendMessage(ghwndMsg, LB_GETTEXT, (WPARAM)lpdi->itemID, (LPARAM) tsz);
      DrawText(lpdi->hDC, tsz, -1, &lpdi->rcItem, DT_LEFT | DT_SINGLELINE);

      delete [] tsz;
      tsz = 0;
    }
    break;
  }
  case IDW_SBAR:
  {
    if  (NULL == lParam)
    {
      ERROR_MSG(TEXT("MsgDrawItem: NULL == lParam"));
      break;
    }

    if (0 != (((LPDRAWITEMSTRUCT) lParam)->itemData))
    {
      DrawIconEx( ((LPDRAWITEMSTRUCT) lParam)->hDC,
        ((LPDRAWITEMSTRUCT) lParam)->rcItem.left,
        ((LPDRAWITEMSTRUCT) lParam)->rcItem.top,
        (HICON) (((LPDRAWITEMSTRUCT) lParam)->itemData),
        STATUSICONSIZE, STATUSICONSIZE, 0, NULL, DI_NORMAL);
    }
    break;
  }

  case IDL_USERS:
  {
    DrawUserItem((LPDRAWITEMSTRUCT) lParam);
    break;
  }

  default:
    break;
  } /* switch */

  return 0;
}

LRESULT MsgGetMinMax | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 91 of file Msg.Cpp.

{
  LPMINMAXINFO lpminmax = (LPMINMAXINFO) lparam;

  if (gdxWndMin == 0 || gdyWndMin == 0)
    return 0;

  if  (NULL == lpminmax)
  {
    ERROR_MSG(TEXT("MsgGetMinMax: NULL == lpminmax"));
    return 0;
  }

  lpminmax->ptMinTrackSize.x = gdxWndMin;
  lpminmax->ptMinTrackSize.y = gdyWndMin;

  return 0;
}

LRESULT MsgMenuSelect | ( | HWND | hwnd,
 |  | UINT | uMessage,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 84 of file STATBAR.c.

{
    static char szBuffer[128];
    UINT   nStringID = 0;
    UINT   fuFlags = GET_WM_MENUSELECT_FLAGS(wparam, lparam) & 0xffff;
    UINT   uCmd    = GET_WM_MENUSELECT_CMD(wparam, lparam);
    HMENU  hMenu   = GET_WM_MENUSELECT_HMENU(wparam, lparam);

    szBuffer[0] = 0;                            // First reset the buffer

    if (fuFlags == 0xffff && hMenu == NULL)     // Menu has been closed
        nStringID = IDS_DESCRIPTION;

    else if (fuFlags & MFT_SEPARATOR)           // Ignore separators
        nStringID = 0;

    else if (fuFlags & MF_POPUP)                // Popup menu
    {
#ifdef MENUHACK                 // This code shouldn't be necessary...
        UINT i;
        for (i = 0; i < sizeof(idPopup)/sizeof(idPopup[0]); i++)
        {
            if(GetSubMenu(hMenu, i) == (HMENU)((UINT_PTR)uCmd))
            {
                uCmd = i;
                break;
            }
        }
#endif
        if (fuFlags & MF_SYSMENU)               // System menu
            nStringID = IDS_SYSMENU;

        else
            // Get string ID for popup menu from idPopup array.
            nStringID = ((uCmd < sizeof(idPopup)/sizeof(idPopup[0])) ?
                            idPopup[uCmd] : 0);
    }  // for MF_POPUP

    else                                        // Must be a command item
        nStringID = uCmd;                       // String ID == Command ID

    // Load the string if we have an ID
    if (0 != nStringID)
        LoadString(hInst, nStringID, szBuffer, sizeof(szBuffer));

    // Finally... send the string to the status bar
    UpdateStatusBar(szBuffer, 0, 0);

    return 0;
}

LRESULT MsgNotify | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 189 of file Msg.Cpp.

{
  if  (NULL == lParam)
  {
    ERROR_MSG(TEXT("MsgNotify: NULL == MsgNotify"));
    return 0;
  }

    switch (((LPNMHDR) lParam)->idFrom)
        {
    case IDW_TBAR:
        return MsgNotifyTbar(hwnd, uMsg, wParam, lParam);
    default:
        // It might still be for the toolbar (tooltips)
        return MsgNotifyTbar(hwnd, uMsg, wParam, lParam);
        }

    return 0;
}

LRESULT MsgNotifyTbar | ( | HWND | hwnd,
 |  | UINT | uMessage,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 162 of file sBar.Cpp.

{
  LPTOOLTIPTEXT lpToolTipText =(LPTOOLTIPTEXT) lparam;
  static TCHAR szBuffer[MAX_PATH + 1];

  if  (NULL == lparam)
  {
    ERROR_MSG(TEXT("MsgNotifyTbar: NULL == lparam"));
    return 0;
  }

  switch (lpToolTipText->hdr.code)
    {
  case TTN_NEEDTEXT:
  {
    ZeroMemory(szBuffer, sizeof(TCHAR) * (MAX_PATH + 1));
    int cb  = 0;

    cb = LoadString(ghInst, lpToolTipText->hdr.idFrom,   // string ID == command ID
      szBuffer, MAX_PATH);
    if (cb == 0)
    {
      szBuffer[0] = '\0';
    }

    lpToolTipText->lpszText = szBuffer;
    return 1;
  }
  case TBN_QUERYINSERT:
    return 1; // allow insert
  case TBN_QUERYDELETE:
    return 1; // allow delete
  case TBN_RESET:
    ResetToolbar();
    return 1;
  case TBN_GETBUTTONINFO:
  {
    LPTBNOTIFY ptbn = (LPTBNOTIFY) lparam;
    int iBtn = ptbn->iItem+1;

    if (iBtn >= (ARRAY_ELEMENTS(_rgtbb)))
      return 0; // all button data has been passed to the control

    LoadString(ghInst, _rgtbb[iBtn].idCommand, ptbn->pszText, ptbn->cchText);
//?   ptbn->tbButton = _rgtbb[iBtn];
    return 1;

  }
  case TBN_CUSTHELP:
    break;
  case TBN_TOOLBARCHANGE:
    break; // changes handled when exiting
  default:
    break;
    }

  return 0;
}

LRESULT MsgSize | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 72 of file Msg.Cpp.

{
  int dxClient = LOWORD(lparam);  // width of client area
  int dyClient = HIWORD(lparam);  // height of client area

  SizeMsgWindow(dxClient, dyClient);
  SizeStatus(dxClient, 0);
  SendMessage(ghwndSbar, uMsg, wparam, lparam);

  return 0;
}

LRESULT CALLBACK WndProc | ( | HWND | hwnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 234 of file Msg.Cpp.

{
  if  (NULL == _rgmsdMain)
  {
    ERROR_MSG(TEXT("WndProc: NULL == _rgmsdMain"));
    return 0;
  }

  for (LPMSD lpmsd = _rgmsdMain; 0 != lpmsd->uMsg; lpmsd++)
  {
    if (lpmsd->uMsg == uMsg)
    {
      return lpmsd->pfnmsg(hwnd, uMsg, wParam, lParam);
    }
  }

  return DefWindowProc(hwnd, uMsg, wParam, lParam);
}

Generated on Wed Nov 13 2024 16:54:55 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMUI/PreComp.h File Reference

  • Web
  • NetMeeting
  • NMUI
Defines

PreComp.h File Reference

#include <windows.h>
#include <windowsx.h>
#include <commctrl.h>
#include <tchar.h>
#include <ocidl.h>
#include <stdio.h>
#include "imsconf2.h"
#include "global.h"
#include "clUtil.h"
#include "cMgr.h"
#include "cConf.h"
#include "cCall.h"
#include "cChan.h"
#include "cMemb.h"
#include "cData.h"
#include "cShare.h"
#include "cft.h"
#include "resource.h"
#include "global.h"
#include "resource.h"

Go to the source code of this file.

Defines

#define | NM_APPID_NETMEETING 0
#define | NMUI_CHAT_PROTOCOL

Define Documentation

#define NM_APPID_NETMEETING 0

Definition at line 21 of file PreComp.h.

#define NMUI_CHAT_PROTOCOL

Definition at line 19 of file PreComp.h.

Generated on Wed Nov 13 2024 16:53:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMUI/Resource.h File Reference

  • Web
  • NetMeeting
  • NMUI
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | ICO_AUDIO 120
#define | ICO_MAIN 101
#define | ICO_NOAUDIO 116
#define | ICO_PHONE 118
#define | ICO_SPEAKER 119
#define | ICO_TOPMOST 130
#define | ID_APPACCEL 105
#define | ID_BUTTON40100 40100
#define | ID_BUTTON40101 40101
#define | ID_BUTTON40102 40102
#define | ID_BUTTON40103 40103
#define | ID_BUTTON40104 40104
#define | ID_BUTTON40105 40105
#define | ID_BUTTON40106 40106
#define | ID_BUTTON40107 40107
#define | ID_BUTTON40108 40108
#define | ID_BUTTON40109 40109
#define | ID_BUTTON40110 40110
#define | ID_BUTTON40111 40111
#define | ID_BUTTON40112 40112
#define | ID_BUTTON40113 40113
#define | ID_BUTTON40114 40114
#define | ID_BUTTON40115 40115
#define | ID_BUTTON40116 40116
#define | ID_BUTTON40117 40117
#define | ID_BUTTON40118 40118
#define | ID_BUTTON40119 40119
#define | ID_BUTTON40120 40120
#define | ID_BUTTON40121 40121
#define | ID_BUTTON40122 40122
#define | ID_BUTTON40123 40123
#define | ID_BUTTON40124 40124
#define | ID_BUTTON40125 40125
#define | ID_BUTTON40126 40126
#define | ID_BUTTON40127 40127
#define | ID_BUTTON40140 40140
#define | IDB_ACTIVATE 1030
#define | IDB_BROWSE 1018
#define | IDB_COLLAB 1036
#define | IDB_SET_LEVEL 1031
#define | IDB_SHARE 1033
#define | IDB_SWITCH 1035
#define | IDB_TBAR 114
#define | IDB_UNCOLLAB 1037
#define | IDB_UNSHARE 1034
#define | IDB_UPDATE 1035
#define | IDC_ACTIVE 1036
#define | IDC_APP_CODE 1071
#define | IDC_AUTO_CHAT 1036
#define | IDC_CALL_USER 1028
#define | IDC_DOWN 1057
#define | IDC_DWUSERID 1016
#define | IDC_E_AUTOSIZE 1061
#define | IDC_FINDSOMEONE 1078
#define | IDC_HCONFNOTIFY 1014
#define | IDC_HOST 1026
#define | IDC_LEFT 1058
#define | IDC_LEVEL 1069
#define | IDC_MONITOR 1025
#define | IDC_MSG_NOTIFY 1035
#define | IDC_MSG_OBJECTS 1034
#define | IDC_MSG_STATE 1038
#define | IDC_MSG_TRACE 1037
#define | IDC_NMCH_AS 5005
#define | IDC_NMCH_AUDIO 5002
#define | IDC_NMCH_DATA 5001
#define | IDC_NMCH_FIRST 5001
#define | IDC_NMCH_FT 5006
#define | IDC_NMCH_LAST 5006
#define | IDC_NMCH_SKIPP_THIS_ONE 5004
#define | IDC_NOUI 1050
#define | IDC_PAUSE 1037
#define | IDC_PB_AUTOSIZE 1062
#define | IDC_RIGHT 1059
#define | IDC_S_AUTOSIZE 1067
#define | IDC_SERVER_NAME 1072
#define | IDC_SHORT 1051
#define | IDC_SHOW_AS 1076
#define | IDC_SHOW_CHAT 1074
#define | IDC_SHOW_FT 1073
#define | IDC_SHOW_T126WB 1077
#define | IDC_SHOW_WB 1075
#define | IDC_SPIN 1029
#define | IDC_TALL 1052
#define | IDC_THIN 1053
#define | IDC_TOOLBAR 112
#define | IDC_TOPMOST 1060
#define | IDC_UI_APP_SHARE 1032
#define | IDC_UI_CALL 1030
#define | IDC_UI_FT 1033
#define | IDC_UI_JOIN 1031
#define | IDC_UP 1056
#define | IDC_UPDATE 1049
#define | IDC_USERID 1022
#define | IDC_USERNAME 1016
#define | IDC_VISIBLE 1055
#define | IDC_WIDE 1054
#define | IDD_AUDIO 124
#define | IDD_CALL 107
#define | IDD_CALL_CONF 126
#define | IDD_CONFERENCE 106
#define | IDD_EJECT 130
#define | IDD_LAUNCH 128
#define | IDD_LOGONOFF 132
#define | IDD_OPTIONS 123
#define | IDD_SENDFILE 112
#define | IDD_SHARE 125
#define | IDD_SHOWLOCAL 131
#define | IDD_SWITCH 127
#define | IDE_ADDR 1001
#define | IDE_APPLICATION 1010
#define | IDE_COMMANDLINE 1011
#define | IDE_CONFERENCE 1034
#define | IDE_CONFERENCE_NAME 1027
#define | IDE_DATA 1010
#define | IDE_DIRECTORY 1012
#define | IDE_FILENAME 1017
#define | IDE_HCONF 1011
#define | IDE_LEVEL 1028
#define | IDE_NAME 6000
#define | IDE_PASSWORD 1002
#define | IDE_USER_NAME 1029
#define | IDE_USERID 1011
#define | IDL_ADDR_TYPE 1024
#define | IDL_APP 1032
#define | IDL_CALL_TYPE 1025
#define | IDL_CONFERENCE 6001
#define | IDL_GUID 1038
#define | IDL_USERS 6002
#define | IDM_ABOUT 41000
#define | IDM_APP 104
#define | IDM_CALL 40071
#define | IDM_CALL_ACCEPT 41016
#define | IDM_CALL_CANCEL 40074
#define | IDM_CALL_CONF 40143
#define | IDM_CALL_REJECT 41017
#define | IDM_CHANNEL_AUDIO 40067
#define | IDM_CHANNEL_DATA 40073
#define | IDM_CHANNEL_FT 40069
#define | IDM_CHANNEL_SHARE 40070
#define | IDM_CMD_CANCELTRANSFER 41010
#define | IDM_CMD_CONNECT 41001
#define | IDM_CMD_DISCONNECT 41002
#define | IDM_CMD_ENUMCONF 40044
#define | IDM_CMD_ENUMUSER 40045
#define | IDM_CMD_GETINFO 41003
#define | IDM_CMD_ISWINDOWSHARED 41008
#define | IDM_CMD_LAUNCHREMOTE 40060
#define | IDM_CMD_LISTEN 41011
#define | IDM_CMD_REMOVENOTIFY 41013
#define | IDM_CMD_SENDDATA 41005
#define | IDM_CMD_SENDFILE 41006
#define | IDM_CMD_SETGUID 40059
#define | IDM_CMD_SETINFO 41004
#define | IDM_CMD_SETNOTIFY 41012
#define | IDM_CMD_SETRECDIR 40048
#define | IDM_CMD_SHAREWINDOW 41007
#define | IDM_CMD_UNSHAREWINDOW 41009
#define | IDM_CONF_LEAK 41019
#define | IDM_CONF_LEAK2 41020
#define | IDM_CONF_START 40064
#define | IDM_CONF_STOP 40065
#define | IDM_CONFINFO 41015
#define | IDM_DATA_ENABLE 41018
#define | IDM_EJECT 40072
#define | IDM_ENABLE_APPSHARING 41030
#define | IDM_EXIT 40017
#define | IDM_FT_CANCEL 41014
#define | IDM_HELP 40999
#define | IDM_HELP_CONTENTS 40063
#define | IDM_IS_SHARING_ENABLED 41031
#define | IDM_LAUNCH 40145
#define | IDM_LOGONOFF 41028
#define | IDM_MONITOR 40084
#define | IDM_OPTIONS 40141
#define | IDM_SHOWLOCAL 41027
#define | IDM_SWITCH 40142
#define | IDM_SYS_LOGOFF 41024
#define | IDM_SYS_LOGON 41023
#define | IDM_SYSINFO 40066
#define | IDM_TOPMOST 41022
#define | IDM_UPDATE 40146
#define | IDM_VIEW_CHAT 40144
#define | IDM_VIEW_CLEAR 40055
#define | IDM_VIEW_ENVIRON 40058
#define | IDM_VIEW_FONT 40016
#define | IDM_VIEW_MSG 40085
#define | IDM_VIEW_SBAR 40014
#define | IDM_VIEW_TBAR 40062
#define | IDR_INIT_BACKGROUND 1069
#define | IDR_INIT_CONTROL 1065
#define | IDR_INIT_NO_LAUNCH 1066
#define | IDR_INIT_NORMAL 1064
#define | IDS_APP_TITLE 1
#define | IDS_DLLNAME 41025
#define | IDS_SETUPDD_FUNC 41026
#define | IDS_SYSMENU 4
#define | IDS_VERSION 2
#define | IDT_CMD_LAUNCHREMOTE 40061

Define Documentation

#define ICO_AUDIO 120

Definition at line 19 of file Resource.h.

#define ICO_MAIN 101

Definition at line 8 of file Resource.h.

#define ICO_NOAUDIO 116

Definition at line 16 of file Resource.h.

#define ICO_PHONE 118

Definition at line 17 of file Resource.h.

#define ICO_SPEAKER 119

Definition at line 18 of file Resource.h.

#define ICO_TOPMOST 130

Definition at line 27 of file Resource.h.

#define ID_APPACCEL 105

Definition at line 10 of file Resource.h.

#define ID_BUTTON40100 40100

Definition at line 138 of file Resource.h.

#define ID_BUTTON40101 40101

Definition at line 139 of file Resource.h.

#define ID_BUTTON40102 40102

Definition at line 140 of file Resource.h.

#define ID_BUTTON40103 40103

Definition at line 141 of file Resource.h.

#define ID_BUTTON40104 40104

Definition at line 142 of file Resource.h.

#define ID_BUTTON40105 40105

Definition at line 143 of file Resource.h.

#define ID_BUTTON40106 40106

Definition at line 144 of file Resource.h.

#define ID_BUTTON40107 40107

Definition at line 145 of file Resource.h.

#define ID_BUTTON40108 40108

Definition at line 146 of file Resource.h.

#define ID_BUTTON40109 40109

Definition at line 147 of file Resource.h.

#define ID_BUTTON40110 40110

Definition at line 148 of file Resource.h.

#define ID_BUTTON40111 40111

Definition at line 149 of file Resource.h.

#define ID_BUTTON40112 40112

Definition at line 150 of file Resource.h.

#define ID_BUTTON40113 40113

Definition at line 151 of file Resource.h.

#define ID_BUTTON40114 40114

Definition at line 152 of file Resource.h.

#define ID_BUTTON40115 40115

Definition at line 153 of file Resource.h.

#define ID_BUTTON40116 40116

Definition at line 154 of file Resource.h.

#define ID_BUTTON40117 40117

Definition at line 155 of file Resource.h.

#define ID_BUTTON40118 40118

Definition at line 156 of file Resource.h.

#define ID_BUTTON40119 40119

Definition at line 157 of file Resource.h.

#define ID_BUTTON40120 40120

Definition at line 158 of file Resource.h.

#define ID_BUTTON40121 40121

Definition at line 159 of file Resource.h.

#define ID_BUTTON40122 40122

Definition at line 160 of file Resource.h.

#define ID_BUTTON40123 40123

Definition at line 161 of file Resource.h.

#define ID_BUTTON40124 40124

Definition at line 162 of file Resource.h.

#define ID_BUTTON40125 40125

Definition at line 163 of file Resource.h.

#define ID_BUTTON40126 40126

Definition at line 164 of file Resource.h.

#define ID_BUTTON40127 40127

Definition at line 165 of file Resource.h.

#define ID_BUTTON40140 40140

Definition at line 166 of file Resource.h.

#define IDB_ACTIVATE 1030

Definition at line 54 of file Resource.h.

#define IDB_BROWSE 1018

Definition at line 42 of file Resource.h.

#define IDB_COLLAB 1036

Definition at line 69 of file Resource.h.

#define IDB_SET_LEVEL 1031

Definition at line 56 of file Resource.h.

#define IDB_SHARE 1033

Definition at line 60 of file Resource.h.

#define IDB_SWITCH 1035

Definition at line 66 of file Resource.h.

#define IDB_TBAR 114

Definition at line 15 of file Resource.h.

#define IDB_UNCOLLAB 1037

Definition at line 72 of file Resource.h.

#define IDB_UNSHARE 1034

Definition at line 62 of file Resource.h.

#define IDB_UPDATE 1035

Definition at line 65 of file Resource.h.

#define IDC_ACTIVE 1036

Definition at line 67 of file Resource.h.

#define IDC_APP_CODE 1071

Definition at line 95 of file Resource.h.

#define IDC_AUTO_CHAT 1036

Definition at line 68 of file Resource.h.

#define IDC_CALL_USER 1028

Definition at line 49 of file Resource.h.

#define IDC_DOWN 1057

Definition at line 83 of file Resource.h.

#define IDC_DWUSERID 1016

Definition at line 39 of file Resource.h.

#define IDC_E_AUTOSIZE 1061

Definition at line 87 of file Resource.h.

#define IDC_FINDSOMEONE 1078

Definition at line 102 of file Resource.h.

#define IDC_HCONFNOTIFY 1014

Definition at line 38 of file Resource.h.

#define IDC_HOST 1026

Definition at line 47 of file Resource.h.

#define IDC_LEFT 1058

Definition at line 84 of file Resource.h.

#define IDC_LEVEL 1069

Definition at line 94 of file Resource.h.

#define IDC_MONITOR 1025

Definition at line 45 of file Resource.h.

#define IDC_MSG_NOTIFY 1035

Definition at line 64 of file Resource.h.

#define IDC_MSG_OBJECTS 1034

Definition at line 61 of file Resource.h.

#define IDC_MSG_STATE 1038

Definition at line 74 of file Resource.h.

#define IDC_MSG_TRACE 1037

Definition at line 70 of file Resource.h.

#define IDC_NMCH_AS 5005

Definition at line 107 of file Resource.h.

#define IDC_NMCH_AUDIO 5002

Definition at line 105 of file Resource.h.

#define IDC_NMCH_DATA 5001

Definition at line 104 of file Resource.h.

#define IDC_NMCH_FIRST 5001

Definition at line 103 of file Resource.h.

#define IDC_NMCH_FT 5006

Definition at line 108 of file Resource.h.

#define IDC_NMCH_LAST 5006

Definition at line 109 of file Resource.h.

#define IDC_NMCH_SKIPP_THIS_ONE 5004

Definition at line 106 of file Resource.h.

#define IDC_NOUI 1050

Definition at line 76 of file Resource.h.

#define IDC_PAUSE 1037

Definition at line 71 of file Resource.h.

#define IDC_PB_AUTOSIZE 1062

Definition at line 88 of file Resource.h.

#define IDC_RIGHT 1059

Definition at line 85 of file Resource.h.

#define IDC_S_AUTOSIZE 1067

Definition at line 92 of file Resource.h.

#define IDC_SERVER_NAME 1072

Definition at line 96 of file Resource.h.

#define IDC_SHORT 1051

Definition at line 77 of file Resource.h.

#define IDC_SHOW_AS 1076

Definition at line 100 of file Resource.h.

#define IDC_SHOW_CHAT 1074

Definition at line 98 of file Resource.h.

#define IDC_SHOW_FT 1073

Definition at line 97 of file Resource.h.

#define IDC_SHOW_T126WB 1077

Definition at line 101 of file Resource.h.

#define IDC_SHOW_WB 1075

Definition at line 99 of file Resource.h.

#define IDC_SPIN 1029

Definition at line 52 of file Resource.h.

#define IDC_TALL 1052

Definition at line 78 of file Resource.h.

#define IDC_THIN 1053

Definition at line 79 of file Resource.h.

#define IDC_TOOLBAR 112

Definition at line 14 of file Resource.h.

#define IDC_TOPMOST 1060

Definition at line 86 of file Resource.h.

#define IDC_UI_APP_SHARE 1032

Definition at line 57 of file Resource.h.

#define IDC_UI_CALL 1030

Definition at line 53 of file Resource.h.

#define IDC_UI_FT 1033

Definition at line 59 of file Resource.h.

#define IDC_UI_JOIN 1031

Definition at line 55 of file Resource.h.

#define IDC_UP 1056

Definition at line 82 of file Resource.h.

#define IDC_UPDATE 1049

Definition at line 75 of file Resource.h.

#define IDC_USERID 1022

Definition at line 43 of file Resource.h.

#define IDC_USERNAME 1016

Definition at line 40 of file Resource.h.

#define IDC_VISIBLE 1055

Definition at line 81 of file Resource.h.

#define IDC_WIDE 1054

Definition at line 80 of file Resource.h.

#define IDD_AUDIO 124

Definition at line 21 of file Resource.h.

#define IDD_CALL 107

Definition at line 12 of file Resource.h.

#define IDD_CALL_CONF 126

Definition at line 23 of file Resource.h.

#define IDD_CONFERENCE 106

Definition at line 11 of file Resource.h.

#define IDD_EJECT 130

Definition at line 26 of file Resource.h.

#define IDD_LAUNCH 128

Definition at line 25 of file Resource.h.

#define IDD_LOGONOFF 132

Definition at line 29 of file Resource.h.

#define IDD_OPTIONS 123

Definition at line 20 of file Resource.h.

#define IDD_SENDFILE 112

Definition at line 13 of file Resource.h.

#define IDD_SHARE 125

Definition at line 22 of file Resource.h.

#define IDD_SHOWLOCAL 131

Definition at line 28 of file Resource.h.

#define IDD_SWITCH 127

Definition at line 24 of file Resource.h.

#define IDE_ADDR 1001

Definition at line 30 of file Resource.h.

#define IDE_APPLICATION 1010

Definition at line 32 of file Resource.h.

#define IDE_COMMANDLINE 1011

Definition at line 34 of file Resource.h.

#define IDE_CONFERENCE 1034

Definition at line 63 of file Resource.h.

#define IDE_CONFERENCE_NAME 1027

Definition at line 48 of file Resource.h.

#define IDE_DATA 1010

Definition at line 33 of file Resource.h.

#define IDE_DIRECTORY 1012

Definition at line 37 of file Resource.h.

#define IDE_FILENAME 1017

Definition at line 41 of file Resource.h.

#define IDE_HCONF 1011

Definition at line 36 of file Resource.h.

#define IDE_LEVEL 1028

Definition at line 50 of file Resource.h.

#define IDE_NAME 6000

Definition at line 110 of file Resource.h.

#define IDE_PASSWORD 1002

Definition at line 31 of file Resource.h.

#define IDE_USER_NAME 1029

Definition at line 51 of file Resource.h.

#define IDE_USERID 1011

Definition at line 35 of file Resource.h.

#define IDL_ADDR_TYPE 1024

Definition at line 44 of file Resource.h.

#define IDL_APP 1032

Definition at line 58 of file Resource.h.

#define IDL_CALL_TYPE 1025

Definition at line 46 of file Resource.h.

#define IDL_CONFERENCE 6001

Definition at line 111 of file Resource.h.

#define IDL_GUID 1038

Definition at line 73 of file Resource.h.

#define IDL_USERS 6002

Definition at line 112 of file Resource.h.

#define IDM_ABOUT 41000

Definition at line 174 of file Resource.h.

#define IDM_APP 104

Definition at line 9 of file Resource.h.

#define IDM_CALL 40071

Definition at line 132 of file Resource.h.

#define IDM_CALL_ACCEPT 41016

Definition at line 190 of file Resource.h.

#define IDM_CALL_CANCEL 40074

Definition at line 135 of file Resource.h.

#define IDM_CALL_CONF 40143

Definition at line 169 of file Resource.h.

#define IDM_CALL_REJECT 41017

Definition at line 191 of file Resource.h.

#define IDM_CHANNEL_AUDIO 40067

Definition at line 129 of file Resource.h.

#define IDM_CHANNEL_DATA 40073

Definition at line 134 of file Resource.h.

#define IDM_CHANNEL_FT 40069

Definition at line 130 of file Resource.h.

#define IDM_CHANNEL_SHARE 40070

Definition at line 131 of file Resource.h.

#define IDM_CMD_CANCELTRANSFER 41010

Definition at line 184 of file Resource.h.

#define IDM_CMD_CONNECT 41001

Definition at line 175 of file Resource.h.

#define IDM_CMD_DISCONNECT 41002

Definition at line 176 of file Resource.h.

#define IDM_CMD_ENUMCONF 40044

Definition at line 116 of file Resource.h.

#define IDM_CMD_ENUMUSER 40045

Definition at line 117 of file Resource.h.

#define IDM_CMD_GETINFO 41003

Definition at line 177 of file Resource.h.

#define IDM_CMD_ISWINDOWSHARED 41008

Definition at line 182 of file Resource.h.

#define IDM_CMD_LAUNCHREMOTE 40060

Definition at line 122 of file Resource.h.

#define IDM_CMD_LISTEN 41011

Definition at line 185 of file Resource.h.

#define IDM_CMD_REMOVENOTIFY 41013

Definition at line 187 of file Resource.h.

#define IDM_CMD_SENDDATA 41005

Definition at line 179 of file Resource.h.

#define IDM_CMD_SENDFILE 41006

Definition at line 180 of file Resource.h.

#define IDM_CMD_SETGUID 40059

Definition at line 121 of file Resource.h.

#define IDM_CMD_SETINFO 41004

Definition at line 178 of file Resource.h.

#define IDM_CMD_SETNOTIFY 41012

Definition at line 186 of file Resource.h.

#define IDM_CMD_SETRECDIR 40048

Definition at line 118 of file Resource.h.

#define IDM_CMD_SHAREWINDOW 41007

Definition at line 181 of file Resource.h.

#define IDM_CMD_UNSHAREWINDOW 41009

Definition at line 183 of file Resource.h.

#define IDM_CONF_LEAK 41019

Definition at line 193 of file Resource.h.

#define IDM_CONF_LEAK2 41020

Definition at line 194 of file Resource.h.

#define IDM_CONF_START 40064

Definition at line 126 of file Resource.h.

#define IDM_CONF_STOP 40065

Definition at line 127 of file Resource.h.

#define IDM_CONFINFO 41015

Definition at line 189 of file Resource.h.

#define IDM_DATA_ENABLE 41018

Definition at line 192 of file Resource.h.

#define IDM_EJECT 40072

Definition at line 133 of file Resource.h.

#define IDM_ENABLE_APPSHARING 41030

Definition at line 202 of file Resource.h.

#define IDM_EXIT 40017

Definition at line 115 of file Resource.h.

#define IDM_FT_CANCEL 41014

Definition at line 188 of file Resource.h.

#define IDM_HELP 40999

Definition at line 173 of file Resource.h.

#define IDM_HELP_CONTENTS 40063

Definition at line 125 of file Resource.h.

#define IDM_IS_SHARING_ENABLED 41031

Definition at line 203 of file Resource.h.

#define IDM_LAUNCH 40145

Definition at line 171 of file Resource.h.

#define IDM_LOGONOFF 41028

Definition at line 201 of file Resource.h.

#define IDM_MONITOR 40084

Definition at line 136 of file Resource.h.

#define IDM_OPTIONS 40141

Definition at line 167 of file Resource.h.

#define IDM_SHOWLOCAL 41027

Definition at line 200 of file Resource.h.

#define IDM_SWITCH 40142

Definition at line 168 of file Resource.h.

#define IDM_SYS_LOGOFF 41024

Definition at line 197 of file Resource.h.

#define IDM_SYS_LOGON 41023

Definition at line 196 of file Resource.h.

#define IDM_SYSINFO 40066

Definition at line 128 of file Resource.h.

#define IDM_TOPMOST 41022

Definition at line 195 of file Resource.h.

#define IDM_UPDATE 40146

Definition at line 172 of file Resource.h.

#define IDM_VIEW_CHAT 40144

Definition at line 170 of file Resource.h.

#define IDM_VIEW_CLEAR 40055

Definition at line 119 of file Resource.h.

#define IDM_VIEW_ENVIRON 40058

Definition at line 120 of file Resource.h.

#define IDM_VIEW_FONT 40016

Definition at line 114 of file Resource.h.

#define IDM_VIEW_MSG 40085

Definition at line 137 of file Resource.h.

#define IDM_VIEW_SBAR 40014

Definition at line 113 of file Resource.h.

#define IDM_VIEW_TBAR 40062

Definition at line 124 of file Resource.h.

#define IDR_INIT_BACKGROUND 1069

Definition at line 93 of file Resource.h.

#define IDR_INIT_CONTROL 1065

Definition at line 90 of file Resource.h.

#define IDR_INIT_NO_LAUNCH 1066

Definition at line 91 of file Resource.h.

#define IDR_INIT_NORMAL 1064

Definition at line 89 of file Resource.h.

#define IDS_APP_TITLE 1

Definition at line 5 of file Resource.h.

#define IDS_DLLNAME 41025

Definition at line 198 of file Resource.h.

#define IDS_SETUPDD_FUNC 41026

Definition at line 199 of file Resource.h.

#define IDS_SYSMENU 4

Definition at line 7 of file Resource.h.

#define IDS_VERSION 2

Definition at line 6 of file Resource.h.

#define IDT_CMD_LAUNCHREMOTE 40061

Definition at line 123 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMUI/rtns.Cpp File Reference

  • Web
  • NetMeeting
  • NMUI
Functions

rtns.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

VOID | RecalcMsgWindow (void)
VOID | ShowHwnd (HWND hwnd, BOOL fShow, int idm)
VOID | SizeMsgWindow (int dx, int dy)
VOID | SizeStatus (int dxClient, int dy)

Function Documentation

VOID RecalcMsgWindow ( void )

Definition at line 99 of file rtns.Cpp.

{
  RECT rc = {0,0,0,0};

  GetClientRect(ghwndMain, &rc);
  SizeMsgWindow(rc.right, rc.bottom);
}

VOID ShowHwnd | ( | HWND | hwnd,
 |  | BOOL | fShow,
 |  | int | idm
 | ) |  |

Definition at line 114 of file rtns.Cpp.

{
  if (IsWindow(hwnd))
  {
    ShowWindow(hwnd, fShow ? SW_SHOW : SW_HIDE);
    SetMenuCheck(idm, fShow);
    RecalcMsgWindow();
  }
}

VOID SizeMsgWindow | ( | int | dx,
 |  | int | dy
 | ) |  |

Definition at line 43 of file rtns.Cpp.

{
  RECT  rc    = {0, 0, 0, 0};
  int   xLeft = 0;
  int   yTop  = 0;
  int   d   = 0;
  int   dyLView = 0;

  xLeft = 0;
  yTop = 3;
  dy -= 3;

  if (gPref.fTbar)
  {
    // adjust for Toolbar
    GetClientRect(ghwndTbar, &rc);
    d = (rc.bottom - rc.top);
    yTop += d;
    dy -= d;
  }

  if (gPref.fSbar)
  {
    // adjust for status bar
    GetClientRect(ghwndSbar, &rc);
    d = (rc.bottom - rc.top);
    dy -= d;
  }

  if (gPref.fChat)
  {
    // adjust for status bar
    GetClientRect(ghwndChat, &rc);
    d = (rc.bottom - rc.top);
    dy -= d;
    MoveWindow(ghwndChat, xLeft, yTop + dy, dx-(DXP_SEND+DXP_ULIST), d, TRUE);
    MoveWindow(ghwndSend, xLeft+dx-(DXP_SEND+DXP_ULIST), yTop + dy, DXP_SEND, DYP_SEND, TRUE);
    MoveWindow(ghwndUList, xLeft+dx-DXP_ULIST, yTop + dy, DXP_ULIST, DYP_ULIST, TRUE);
  }

  dyLView = dy;
  if (gPref.fMsg)
  {
    dyLView = dyLView / 2;
    MoveWindow(ghwndMsg, xLeft, yTop+dyLView, dx, dyLView, TRUE);
  }

  MoveWindow(ghwndLView, xLeft, yTop, dx, dyLView, TRUE);
}

VOID SizeStatus | ( | int | dxClient,
 |  | int | dy
 | ) |  |

Definition at line 25 of file rtns.Cpp.

{
  int rgdxp[3];

  rgdxp[2] = dxClient;
  dxClient -= 50;
  rgdxp[1] = dxClient;
  dxClient -= 75;
  rgdxp[0] = dxClient;
  SendMessage(ghwndSbar, SB_SETPARTS, (WPARAM) 3, (LPARAM) rgdxp);
}

Generated on Wed Nov 13 2024 16:54:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMUI/sBar.Cpp File Reference

  • Web
  • NetMeeting
  • NMUI
Functions | Variables

sBar.Cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

LPTBBUTTON | _GetDefaultTbb (DWORD *pcTbb, BOOL fReset)
VOID | CmdToolbar (HWND hwnd, WORD wCmd, WORD wNotify, HWND hwndCtrl)
BOOL | FCreateSbar (void)
BOOL | FCreateTbar (void)
LRESULT | MsgMenuSelect (HWND hwnd, UINT uMessage, WPARAM wparam, LPARAM lparam)
LRESULT | MsgNotifyTbar (HWND hwnd, UINT uMessage, WPARAM wparam, LPARAM lparam)
VOID | ResetToolbar (void)
VOID | SetToolbarCheck (int idm, BOOL fCheck)
VOID | StatusMsg (LPTSTR sz)
VOID | UpdateStatusBar (LPTSTR lpsz, WORD wPart, WORD wFlags)
VOID | UpdateStatusIcon (DWORD dwId)
VOID | WriteIniTbar (void)

Variables

TBBUTTON | _rgtbb []

Function Documentation

LPTBBUTTON _GetDefaultTbb | ( | DWORD * | pcTbb,
 |  | BOOL | fReset
 | ) |  |

Definition at line 48 of file sBar.Cpp.

{
  if  (NULL == pcTbb)
  {
    ERROR_MSG(TEXT("_GetDefaultTbb: NULL == pcTbb"));
    return 0;
  }

  DWORD iBtn  = 0;
  DWORD cBtn  = 0;
  LPTSTR  lpsz  = 0;
  LPTSTR  lpch  = 0;
  LPTBBUTTON pttb = 0;

  if (fReset)
    lpsz = _szBtnDefault;
  else
    lpsz = GetIniStr(_szToolbar, _szBtnDefault);

  if  (NULL == lpsz)
    return NULL;

  lpch = lpsz;
  cBtn = lstrlen(lpsz) / 2;

  pttb = (LPTBBUTTON) LpvAlloc(sizeof(TBBUTTON) * cBtn);
  if (NULL == pttb)
    return NULL;
  for (iBtn = 0; iBtn < cBtn; iBtn++)
  {
    CopyMemory(pttb + iBtn, &_rgtbb[ChFromHex(lpch)], sizeof(TBBUTTON));
    lpch += 2;
  }

  if (!fReset)
    FreePlpv(&lpsz);

  *pcTbb = cBtn;
  return pttb;
}

VOID CmdToolbar | ( | HWND | hwnd,
 |  | WORD | wCmd,
 |  | WORD | wNotify,
 |  | HWND | hwndCtrl
 | ) |  |

Definition at line 241 of file sBar.Cpp.

{
  SendMessage(ghwndTbar, TB_CUSTOMIZE, 0, 0);
}

BOOL FCreateSbar ( void )

Definition at line 293 of file sBar.Cpp.

{
  ghwndSbar = CreateWindow(STATUSCLASSNAME, NULL,
    WS_CHILD | SBARS_SIZEGRIP,
    0, 0, 0, 0,
    ghwndMain, (HMENU) IDW_SBAR, ghInst, NULL);

  return (ghwndSbar != NULL);
}

BOOL FCreateTbar ( void )

Definition at line 127 of file sBar.Cpp.

{
  DWORD   cBtn  = 0;
  LPTBBUTTON  ptbb  = 0;

  ptbb = _GetDefaultTbb(&cBtn, FALSE /* fReset */);
  if (NULL == ptbb)
    return FALSE;

  ghwndTbar = CreateToolbarEx(ghwndMain,
    WS_CHILD | CCS_ADJUSTABLE |
      TBSTYLE_TOOLTIPS | TBSTYLE_ALTDRAG, // | TBSTYLE_WRAPABLE
    IDW_TBAR,
    NUMIMAGES,
    ghInst,
    IDC_TOOLBAR,
    ptbb,
    cBtn,
    BUTTONWIDTH,
    BUTTONHEIGHT,
    IMAGEWIDTH,
    IMAGEHEIGHT,
    sizeof(TBBUTTON));

  FreePlpv(&ptbb);

  return (ghwndTbar != NULL);
}

LRESULT MsgMenuSelect | ( | HWND | hwnd,
 |  | UINT | uMessage,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 368 of file sBar.Cpp.

{
  TCHAR  szBuffer[MAX_PATH + 1];
  UINT   nStringID = 0;
  UINT   fuFlags = GET_WM_MENUSELECT_FLAGS(wparam, lparam) & 0xffff;
  UINT   uCmd    = GET_WM_MENUSELECT_CMD(wparam, lparam);
  HMENU  hMenu   = GET_WM_MENUSELECT_HMENU(wparam, lparam);

  ZeroMemory(szBuffer, sizeof(TCHAR)*(MAX_PATH + 1));

  if (fuFlags == 0xffff && hMenu == NULL)     // Menu has been closed
  {
    return 0;
//    nStringID = IDS_DESCRIPTION;
  }
  else if (fuFlags & MFT_SEPARATOR)           // Ignore separators
  {
    nStringID = 0;
  }
  else if (fuFlags & MF_POPUP)                // Popup menu
  {
    if (fuFlags & MF_SYSMENU)               // System menu
      nStringID = IDS_SYSMENU;
  }
  else                                        // Must be a command item
  {
    nStringID = uCmd;               // String ID == Command ID
  }

  // Load the string if we have an ID
  if (nStringID != 0)
  {
    LoadString(ghInst, nStringID, szBuffer, MAX_PATH);
  }

  // Finally... send the string to the status bar
  UpdateStatusBar(szBuffer, IDSBP_MSG, 0);

  return 0;
}

LRESULT MsgNotifyTbar | ( | HWND | hwnd,
 |  | UINT | uMessage,
 |  | WPARAM | wparam,
 |  | LPARAM | lparam
 | ) |  |

Definition at line 162 of file sBar.Cpp.

{
  LPTOOLTIPTEXT lpToolTipText =(LPTOOLTIPTEXT) lparam;
  static TCHAR szBuffer[MAX_PATH + 1];

  if  (NULL == lparam)
  {
    ERROR_MSG(TEXT("MsgNotifyTbar: NULL == lparam"));
    return 0;
  }

  switch (lpToolTipText->hdr.code)
    {
  case TTN_NEEDTEXT:
  {
    ZeroMemory(szBuffer, sizeof(TCHAR) * (MAX_PATH + 1));
    int cb  = 0;

    cb = LoadString(ghInst, lpToolTipText->hdr.idFrom,   // string ID == command ID
      szBuffer, MAX_PATH);
    if (cb == 0)
    {
      szBuffer[0] = '\0';
    }

    lpToolTipText->lpszText = szBuffer;
    return 1;
  }
  case TBN_QUERYINSERT:
    return 1; // allow insert
  case TBN_QUERYDELETE:
    return 1; // allow delete
  case TBN_RESET:
    ResetToolbar();
    return 1;
  case TBN_GETBUTTONINFO:
  {
    LPTBNOTIFY ptbn = (LPTBNOTIFY) lparam;
    int iBtn = ptbn->iItem+1;

    if (iBtn >= (ARRAY_ELEMENTS(_rgtbb)))
      return 0; // all button data has been passed to the control

    LoadString(ghInst, _rgtbb[iBtn].idCommand, ptbn->pszText, ptbn->cchText);
//?   ptbn->tbButton = _rgtbb[iBtn];
    return 1;

  }
  case TBN_CUSTHELP:
    break;
  case TBN_TOOLBARCHANGE:
    break; // changes handled when exiting
  default:
    break;
    }

  return 0;
}

VOID ResetToolbar ( void )

Definition at line 97 of file sBar.Cpp.

{
  DWORD cBtn  = 0;
  DWORD iBtn  = 0;

  LPTBBUTTON ptbb = NULL;

  ptbb = _GetDefaultTbb(&cBtn, TRUE /* fReset */);
  if (NULL == ptbb)
    return;

  iBtn = SendMessage(ghwndTbar, TB_BUTTONCOUNT, 0, 0);
  while (iBtn != 0)
  {
    SendMessage(ghwndTbar, TB_DELETEBUTTON, (WPARAM) --iBtn, 0);
  }

  SendMessage(ghwndTbar, TB_ADDBUTTONS, (WPARAM) cBtn, (LPARAM) ptbb);

  FreePlpv(&ptbb);
}

VOID SetToolbarCheck | ( | int | idm,
 |  | BOOL | fCheck
 | ) |  |

Definition at line 229 of file sBar.Cpp.

{
  SendMessage(ghwndTbar, TB_CHECKBUTTON,
    (WPARAM) idm, (LPARAM) MAKELONG(fCheck, 0));
}

VOID StatusMsg ( LPTSTR sz )

Definition at line 324 of file sBar.Cpp.

{
  UpdateStatusBar(sz, IDSBP_MSG, 0);
}

VOID UpdateStatusBar | ( | LPTSTR | lpsz,
 |  | WORD | wPart,
 |  | WORD | wFlags
 | ) |  |

Definition at line 312 of file sBar.Cpp.

{
    SendMessage(ghwndSbar, SB_SETTEXT, wPart | wFlags, (LPARAM) lpsz);
}

VOID UpdateStatusIcon ( DWORD dwId )

Definition at line 336 of file sBar.Cpp.

{
  static DWORD m_idIconStatus = 0;
  static HICON m_hIconStatus = 0;

  if (dwId == m_idIconStatus)
    return;

  HICON hIcon = (HICON) LoadImage(ghInst,
        MAKEINTRESOURCE(dwId), IMAGE_ICON,
        STATUSICONSIZE, STATUSICONSIZE,
        LR_DEFAULTCOLOR | LR_SHARED);
  if (NULL == hIcon)
  {
    return;
  }

  m_idIconStatus = dwId;
  m_hIconStatus = hIcon;
  SendMessage(ghwndSbar, SB_SETTEXT,
      IDSBP_ICON | SBT_OWNERDRAW, (LPARAM) m_hIconStatus);
}

VOID WriteIniTbar ( void )

Definition at line 253 of file sBar.Cpp.

{
  int     iBtn  = 0;
  int     cBtn  = 0;
  LPTSTR    lpsz  = 0;
  LPTSTR    lpch  = 0;
  TBBUTTON  tbb;

  if (NULL == ghwndTbar)
    return; // no toolbar?

  cBtn = SendMessage(ghwndTbar, TB_BUTTONCOUNT, 0, 0);
  if (0 == cBtn)
    return;

  lpsz = (LPTSTR) LpvAlloc((cBtn*2 + 1) * sizeof(TCHAR));
  if (NULL == lpsz)
    return;
  ZeroMemory(lpsz, (cBtn*2 + 1) * sizeof(TCHAR));

  lpch = lpsz;
  for (iBtn = 0; iBtn < cBtn; iBtn++)
  {
    SendMessage(ghwndTbar, TB_GETBUTTON, (WPARAM) iBtn, (LPARAM) (LPTBBUTTON) &tbb);
    _sntprintf(lpch, 2, TEXT("%02X"), LOBYTE(tbb.dwData));
    lpch += 2;
  }
  WriteIniStr(_szToolbar, lpsz);
  FreePlpv(&lpsz);
}

Variable Documentation

TBBUTTON _rgtbb[]
Initial value:
{
    {0,   0,                      TBSTATE_ENABLED, TBSTYLE_SEP,    0, 0,  0, 0},
    {28,  IDM_MONITOR,            TBSTATE_ENABLED, TBSTYLE_CHECK,  0, 0,  1, 0},
    {10,  IDM_CONF_START,         TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0,  2, 0},
    {6,   IDM_CONF_STOP,          TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0,  3, 0},
    {4,   IDM_VIEW_CLEAR,         TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0,  4, 0},
    {5,   IDM_CALL,               TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0,  5, 0},
    {1,   IDM_VIEW_MSG,           TBSTATE_ENABLED, TBSTYLE_CHECK,  0, 0,  6, 0},
    {0,   IDM_VIEW_CLEAR,         TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0,  7, 0},
    {6,   IDM_VIEW_FONT,          TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0,  8, 0},
    {10,  IDM_CHANNEL_DATA,       TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0,  9, 0},
    {11,  IDM_CHANNEL_AUDIO,      TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 10, 0},
    {26,  IDM_CHANNEL_FT,         TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 12, 0},
    {14,  IDM_CHANNEL_SHARE,      TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 13, 0},
    {3,   IDM_FT_CANCEL,          TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 14, 0},

}

Definition at line 17 of file sBar.Cpp.

Generated on Wed Nov 13 2024 16:54:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/NMUI/Util.Cpp File Reference

  • Web
  • NetMeeting
  • NMUI
Functions

Util.Cpp File Reference

#include "precomp.h"
#include "shlobj.h"

Go to the source code of this file.

Functions

VOID | CenterWindow (HWND hwndChild, HWND hwndParent)
TCHAR | ChFromHex (LPTSTR lpch)
VOID | DataToHex (LPTSTR lpchSrc, LPTSTR lpchDest, int cbDest)
BOOL | FGetDirectory (LPTSTR szDir)
BOOL FGetFileName (LPTSTR szFileName)
VOID | FreePlpv (LPVOID plpv)
VOID | GetDlgItemPsz (HWND hdlg, UINT id, LPTSTR *ppsz)
BOOL | GetIniBool (LPTSTR pszEntry, BOOL fDefault)
VOID | GetIniHex (LPTSTR pszEntry, LPVOID lpv, int cb)
DWORD | GetIniInt (LPTSTR pszEntry, DWORD dwDefault)
LPTSTR | GetIniStr (LPTSTR pszEntry, LPTSTR pszDefault)
int | GetRadioButton (HWND hdlg, int idrFirst, int idrLast)
VOID | GuidToSz (GUID *pguid, LPTSTR lpchDest)
LPTSTR | HexToBin (LPTSTR lpchSrc, LPVOID lpvDest, int cb)
VOID | HexToData (LPTSTR lpchSrc, LPVOID lpvDest, int cb)
LPVOID | LpvAlloc (int cb)
VOID | MaybeDeleteObject (HGDIOBJ *phgdi)
LPTSTR | PszAlloc (int cch)
VOID | SetMenuCheck (UINT idm, BOOL fCheck)
LPTSTR | SzFindLastCh (LPTSTR lpsz, TCHAR ch)
VOID | SzToGuid (LPTSTR lpchSrc, GUID *pguid)
VOID | WriteIniBool (LPTSTR pszEntry, BOOL f)
VOID | WriteIniHex (LPTSTR pszEntry, LPVOID lpv, int cb)
VOID | WriteIniInt (LPTSTR pszEntry, DWORD dw)
VOID | WriteIniStr (LPTSTR pszEntry, LPTSTR pszData)

Function Documentation

VOID CenterWindow | ( | HWND | hwndChild,
 |  | HWND | hwndParent
 | ) |  |

Definition at line 182 of file Util.Cpp.

{
  int xNew    = 0;
  int yNew    = 0;
  int cxChild   = 0;
  int cyChild   = 0;
  int cxParent  = 0;
  int cyParent  = 0;
  int cxScreen  = 0;
  int cyScreen  = 0;

  RECT  rcChild = {0,0,0,0};
  RECT  rcParent= {0,0,0,0};
  HDC   hdc;

  // Get the Height and Width of the child window
  GetWindowRect(hwndChild, &rcChild);
  cxChild = rcChild.right - rcChild.left;
  cyChild = rcChild.bottom - rcChild.top;

  // Get the Height and Width of the parent window
  GetWindowRect(hwndParent, &rcParent);
  cxParent = rcParent.right - rcParent.left;
  cyParent = rcParent.bottom - rcParent.top;

  // Get the display limits
  hdc = GetDC(hwndChild);
  if (hdc == NULL) {
    // major problems - move window to 0,0
    xNew = yNew = 0;
  } else {
    cxScreen = GetDeviceCaps(hdc, HORZRES);
    cyScreen = GetDeviceCaps(hdc, VERTRES);
    ReleaseDC(hwndChild, hdc);

    if (NULL == hwndParent) {
      cxParent = cxScreen;
      cyParent = cyScreen;
      SetRect(&rcParent, 0, 0, cxScreen, cyScreen);
    }

    // Calculate new X position, then adjust for screen
    xNew = rcParent.left + ((cxParent - cxChild) / 2);
    if (xNew < 0) {
      xNew = 0;
    } else if ((xNew + cxChild) > cxScreen) {
      xNew = cxScreen - cxChild;
    }

    // Calculate new Y position, then adjust for screen
    yNew = rcParent.top  + ((cyParent - cyChild) / 2);
    if (yNew < 0) {
      yNew = 0;
    } else if ((yNew + cyChild) > cyScreen) {
      yNew = cyScreen - cyChild;
    }

  }

  SetWindowPos(hwndChild, NULL, xNew, yNew, 0, 0,
    SWP_NOSIZE | SWP_NOZORDER);
}

TCHAR ChFromHex ( LPTSTR lpch )

Definition at line 299 of file Util.Cpp.

{
  if  (NULL == lpch)
    return NULL;

  int   i = 0;
  int   cch = 2;
  char  ch  = 0;

  while (cch-- > 0)
  {
    ch = *lpch++;
    if (ch >= 'A')
    {
      i = (i*16) + (ch - ('A'-10));
    }
    else
    {
      i = (i*16) + (ch - '0');
    }
  }

  return (TCHAR) i;
}

VOID DataToHex | ( | LPTSTR | lpchSrc,
 |  | LPTSTR | lpchDest,
 |  | int | cbDest
 | ) |  |

Definition at line 382 of file Util.Cpp.

{
  int cb  = cbDest / 2;
  UINT ch = 0;

  if  (NULL == lpchDest)
  {
    ERROR_MSG(TEXT("DataToHex: Destination string is NULL"));
    return;
  }

  if (lpchSrc == NULL)
  {
    lpchDest[0] = 0;  // return empty string
    return;
  }

  while (cb-- > 0)
  {
    ch = 0x00FF & (unsigned char) (*lpchSrc++);
    _sntprintf(lpchDest, 2, TEXT("%02X"), ch);
    lpchDest += 2;
  }
}

BOOL FGetDirectory ( LPTSTR szDir )

Definition at line 483 of file Util.Cpp.

{
  BOOL      fRet    = FALSE;
  LPITEMIDLIST  pidl    = NULL;
  LPITEMIDLIST  pidlRoot  = NULL;
  LPMALLOC    lpMalloc  = NULL;

  TCHAR     szPath[MAX_PATH + 1];
  ZeroMemory(szPath, sizeof(TCHAR) * (MAX_PATH + 1));

  BROWSEINFO bi = {
    ghwndMain,
    NULL,
    szPath,
    TEXT("Select a Directory\0"),
    BIF_RETURNONLYFSDIRS,
    NULL, 0L, 0 };

  if  (0 != SHGetSpecialFolderLocation(HWND_DESKTOP, CSIDL_DRIVES, &pidlRoot))
    return FALSE;

  if  (NULL == pidlRoot)
    return FALSE;

  bi.pidlRoot = pidlRoot;
  pidl = SHBrowseForFolder(&bi);

  if  (NULL != pidl)
    fRet = SHGetPathFromIDList(pidl, szDir);
  else
    fRet = FALSE;

  // Get the shell's allocator to free PIDLs
  if (!SHGetMalloc(&lpMalloc) && (NULL != lpMalloc))
  {
    if (NULL != pidlRoot)
    {
      lpMalloc->Free(pidlRoot);
      pidlRoot = NULL;
    }

    if (NULL != pidl)
    {
      lpMalloc->Free(pidl);
      pidl = NULL;
    }

    lpMalloc->Release();
    lpMalloc = NULL;
  }

  return fRet;
}

BOOL FGetFileName ( LPTSTR szFileName )

Definition at line 446 of file Util.Cpp.

{
  if  (NULL == szFileName)
  {
    ERROR_MSG(TEXT("FGetFileName: NULL == szFileName"));
    return FALSE;
  }

  OPENFILENAME ofn;
  ZeroMemory(&ofn, sizeof(OPENFILENAME));

  szFileName[0] = TEXT('\0');

  ofn.lStructSize   = sizeof(OPENFILENAME);
  ofn.hwndOwner     = ghwndMain;
  ofn.hInstance     = (HINSTANCE) ghInst;
  ofn.lpstrFilter   = TEXT("All Files\0*.*\0Text Files (*.txt)\0*.TXT\0");
  ofn.nFilterIndex  = 1L;
  ofn.lpstrFile     = szFileName;
  ofn.nMaxFile      = MAX_PATH;
  ofn.lpstrTitle    = TEXT("Pick a file to send\0");
  ofn.lpstrInitialDir = NULL;
  ofn.Flags = OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_EXPLORER;

  if (!GetOpenFileName(&ofn))
    return FALSE;

  return TRUE;
}

VOID FreePlpv ( LPVOID plpv )

Definition at line 280 of file Util.Cpp.

{
  if ((plpv == NULL) || (*(VOID FAR * FAR *)plpv == NULL)) {
    return;
  }

  LocalFree(*(VOID FAR * FAR *)plpv);
  *(VOID FAR * FAR *)plpv = NULL;
}

VOID GetDlgItemPsz | ( | HWND | hdlg,
 |  | UINT | id,
 |  | LPTSTR * | ppsz
 | ) |  |

Definition at line 547 of file Util.Cpp.

{
  if  (NULL == ppsz)
  {
    ERROR_MSG(TEXT("GetDlgItemPsz: NULL = ppsz"));
    return;
  }

  UINT  cch   = 0;

  TCHAR sz[MAX_PATH+1];
  ZeroMemory(sz, sizeof(TCHAR) * (MAX_PATH + 1));

  FreePlpv(ppsz);

  cch = GetDlgItemText(hdlg, id, sz, MAX_PATH);
  if (0 == cch)
    return;

  *ppsz = (LPTSTR) PszAlloc(cch);
  if (NULL == *ppsz)
    return;

  ZeroMemory(*ppsz, (cch+1)* sizeof(TCHAR));  //PszAlloc allocates number of bytes passed + 1
  lstrcpyn(*ppsz, sz, cch+1);
  (*ppsz)[cch] = 0;
}

BOOL GetIniBool | ( | LPTSTR | pszEntry,
 |  | BOOL | fDefault
 | ) |  |

Definition at line 27 of file Util.Cpp.

{
  return GetPrivateProfileInt(gszAppName, pszEntry, fDefault, gszIniName) != 0;
}

VOID GetIniHex | ( | LPTSTR | pszEntry,
 |  | LPVOID | lpv,
 |  | int | cb
 | ) |  |

Definition at line 93 of file Util.Cpp.

{
  TCHAR sz[MAX_PATH + 1];
  ZeroMemory(sz, (MAX_PATH + 1) * sizeof(TCHAR));

  if (GetPrivateProfileString(gszAppName, pszEntry, TEXT(""), sz, MAX_PATH, gszIniName) != 0)
  {
    HexToData(sz, lpv, (MAX_PATH < cb) ? MAX_PATH : cb);
  }
}

DWORD GetIniInt | ( | LPTSTR | pszEntry,
 |  | DWORD | dwDefault
 | ) |  |

Definition at line 40 of file Util.Cpp.

{
  return GetPrivateProfileInt(gszAppName, pszEntry, dwDefault, gszIniName);
}

LPTSTR GetIniStr | ( | LPTSTR | pszEntry,
 |  | LPTSTR | pszDefault
 | ) |  |

Definition at line 53 of file Util.Cpp.

{
  int     cch   = 0;
  LPTSTR    pszRet  = 0;

  TCHAR   sz[MAX_PATH + 1];
  ZeroMemory(sz, (MAX_PATH + 1) * sizeof(TCHAR));

  cch = GetPrivateProfileString(gszAppName, pszEntry, pszDefault, sz, MAX_PATH, gszIniName);
  if (cch == 0)
  {
    if (NULL == pszDefault)
      return NULL;

    cch = lstrlen(pszDefault);
    lstrcpyn(sz, pszDefault, MAX_PATH+1);
    sz[MAX_PATH] = 0;
  }

  pszRet = PszAlloc(cch);
  if (pszRet == NULL)
    return NULL;

  ZeroMemory(pszRet, (cch+1)* sizeof(TCHAR)); // PszAlloc allocated cch + 1 characters
  lstrcpyn(pszRet, sz, cch+1);
  pszRet[cch] = 0;

  return pszRet;
}

int GetRadioButton | ( | HWND | hdlg,
 |  | int | idrFirst,
 |  | int | idrLast
 | ) |  |

Definition at line 582 of file Util.Cpp.

{
  for (int id = idrFirst; id <= idrLast; id++)
  {
    if (BST_UNCHECKED != IsDlgButtonChecked(hdlg, id))
      return id;
  }
  return idrFirst;
}

VOID GuidToSz | ( | GUID * | pguid,
 |  | LPTSTR | lpchDest
 | ) |  |

Definition at line 606 of file Util.Cpp.

{
  ASSERT(NULL != pguid);
  ASSERT(NULL != lpchDest);

  if  ((NULL == pguid) || (NULL == lpchDest))
  {
    ERROR_MSG(TEXT("GuidToSz: Null pointer passed in as parameter"));
    return;
  }

  _sntprintf(lpchDest, 25, TEXT("{%08X-%04X-%04X-%02X%02X-"),
    pguid->Data1, pguid->Data2, pguid->Data3, pguid->Data4[0], pguid->Data4[1]);
  lpchDest += 1+8+1+4+1+4+1+2+2+1;

  for (int i = 2; i < 8; i++)
  {
    _sntprintf(lpchDest, 2, TEXT("%02X"), pguid->Data4[i]);
    lpchDest += 2;
  }

  lpchDest[0] = TEXT('}');
}

LPTSTR HexToBin | ( | LPTSTR | lpchSrc,
 |  | LPVOID | lpvDest,
 |  | int | cb
 | ) |  |

Definition at line 358 of file Util.Cpp.

{
  if  ((NULL == lpvDest) || (NULL == lpchSrc))
    return NULL;

  TCHAR * lpchDest = ((TCHAR *) lpvDest) + cb;

  CharUpperBuff(lpchSrc, cb);

  while (cb-- > 0)
  {
    lpchDest--;
    *lpchDest = ChFromHex(lpchSrc);
    lpchSrc += 2;
  }
  return lpchSrc;
}

VOID HexToData | ( | LPTSTR | lpchSrc,
 |  | LPVOID | lpvDest,
 |  | int | cb
 | ) |  |

Definition at line 333 of file Util.Cpp.

{
  if  ((NULL == lpvDest) || (NULL == lpchSrc))
    return;

  PTCHAR lpchDest = (PTCHAR) lpvDest;

  CharUpperBuff(lpchSrc, cb);

  while (cb-- > 0)
  {
    *lpchDest++ = ChFromHex(lpchSrc);
    lpchSrc += 2;
  }
}

LPVOID LpvAlloc ( int cb )

Definition at line 254 of file Util.Cpp.

{
  return LocalAlloc(LMEM_FIXED, cb);
}

VOID MaybeDeleteObject ( HGDIOBJ * phgdi )

Definition at line 431 of file Util.Cpp.

{
  if ((NULL == phgdi) || (NULL == *phgdi))
    return;

  DeleteObject(*phgdi);
  *phgdi = NULL;
}

LPTSTR PszAlloc ( int cch )

Definition at line 266 of file Util.Cpp.

{
  return (LPTSTR) LocalAlloc(LMEM_FIXED, sizeof(TCHAR) * (cch+1));
}

VOID SetMenuCheck | ( | UINT | idm,
 |  | BOOL | fCheck
 | ) |  |

Definition at line 416 of file Util.Cpp.

{
  CheckMenuItem(ghMenu, idm,
    fCheck ? (MF_CHECKED  | MF_BYCOMMAND) : (MF_UNCHECKED | MF_BYCOMMAND));
}

LPTSTR SzFindLastCh | ( | LPTSTR | lpsz,
 |  | TCHAR | ch
 | ) |  |

Definition at line 676 of file Util.Cpp.

{
  if  (NULL == lpsz)
    return NULL;

  LPTSTR  lpchRet = NULL;

  for (lpchRet = NULL; *lpsz; lpsz = CharNext(lpsz))
  {
    if (ch == *lpsz)
      lpchRet = lpsz;
  }

  return lpchRet;
}

VOID SzToGuid | ( | LPTSTR | lpchSrc,
 |  | GUID * | pguid
 | ) |  |

Definition at line 637 of file Util.Cpp.

{
  if  (NULL == pguid)
    return;

  ZeroMemory(pguid, sizeof(GUID));

  if ((NULL == lpchSrc) || (NULL == lpchSrc[0]) || (lstrlen(lpchSrc) < sizeof(GUID)*2 + 6))
  {
    return;
  }

  if (_T('{') != *lpchSrc++)
    return;
  lpchSrc = HexToBin(lpchSrc, &pguid->Data1, sizeof(pguid->Data1));
  if (_T('-') != *lpchSrc++)
    return;
  lpchSrc = HexToBin(lpchSrc, &pguid->Data2, sizeof(pguid->Data2));
  if (_T('-') != *lpchSrc++)
    return;
  lpchSrc = HexToBin(lpchSrc, &pguid->Data3, sizeof(pguid->Data3));
  if (_T('-') != *lpchSrc++)
    return;
  lpchSrc = HexToBin(lpchSrc, &pguid->Data4[0], sizeof(BYTE));
  lpchSrc = HexToBin(lpchSrc, &pguid->Data4[1], sizeof(BYTE));
  if (_T('-') != *lpchSrc++)
    return;
  HexToData(lpchSrc, &pguid->Data4[2], sizeof(pguid->Data4) - 2*sizeof(BYTE));
}

VOID WriteIniBool | ( | LPTSTR | pszEntry,
 |  | BOOL | f
 | ) |  |

Definition at line 145 of file Util.Cpp.

{
  WritePrivateProfileString(gszAppName, pszEntry, f ? TEXT("1") : TEXT("0"), gszIniName);
}

VOID WriteIniHex | ( | LPTSTR | pszEntry,
 |  | LPVOID | lpv,
 |  | int | cb
 | ) |  |

Definition at line 156 of file Util.Cpp.

{
  if  ((NULL == pszEntry) || (NULL == lpv))
  {
    ERROR_MSG(TEXT("WriteIniHex: NULL == in parameter"));
    return;
  }

  TCHAR sz[MAX_PATH + 1];
  ZeroMemory(sz, sizeof(TCHAR) * (MAX_PATH+1));

  DataToHex((LPTSTR) lpv, sz, 2*cb > MAX_PATH ? MAX_PATH : 2*cb);

  WriteIniStr(pszEntry, sz);

}

VOID WriteIniInt | ( | LPTSTR | pszEntry,
 |  | DWORD | dw
 | ) |  |

Definition at line 127 of file Util.Cpp.

{
  TCHAR szData[MAX_PATH + 1];
  ZeroMemory(szData, (MAX_PATH + 1) * sizeof(TCHAR));

  _sntprintf(szData, MAX_PATH, TEXT("%d\0"), dw);
  WritePrivateProfileString(gszAppName, pszEntry, szData, gszIniName);
}

VOID WriteIniStr | ( | LPTSTR | pszEntry,
 |  | LPTSTR | pszData
 | ) |  |

Definition at line 113 of file Util.Cpp.

{
  WritePrivateProfileString(gszAppName, pszEntry, pszData, gszIniName);
}

Generated on Wed Nov 13 2024 16:53:13 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/PlugTransport/imsconf3.idl File Reference

  • Web
  • NetMeeting
  • PlugTransport

imsconf3.idl File Reference

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/PlugTransport/iplgxprt.idl File Reference

  • Web
  • NetMeeting
  • PlugTransport
Classes | Defines | Typedefs | Enumerations

iplgxprt.idl File Reference

Go to the source code of this file.

Classes

interface | IPluggableTransport
struct | tagPLUGXPRT_PARAMETERS

Defines

#define | UUID_IPluggableTransport FB7045F0-A4DC-11D2-B724-00104BC51339

Typedefs

typedef unsigned int | HCOMMDEV
typedef unsigned int | HEVENT
typedef enum tagPLUGXPRT_CALL_TYPE | PLUGXPRT_CALL_TYPE
typedef enum tagPLUGXPRT_FRAMING | PLUGXPRT_FRAMING
typedef struct
tagPLUGXPRT_PARAMETERS 		PLUGXPRT_PARAMETERS
typedef enum
tagPLUGXPRT_PSTN_CALL_CONTROL 		PLUGXPRT_PSTN_CALL_CONTROL

Enumerations

enum | tagPLUGXPRT_CALL_TYPE { PLUGXPRT_UNKNOWN_CALL_TYPE = 0, PLUGXPRT_CALLER = 1, PLUGXPRT_CALLEE = 2 }
enum | tagPLUGXPRT_FRAMING { FRAMING_LEGACY_PSTN = 0, FRAMING_X224 = 1 }
enum | tagPLUGXPRT_PSTN_CALL_CONTROL { PLUGXPRT_PSTN_CALL_CONTROL_PORT_HANDLE = 0, PLUGXPRT_PSTN_CALL_CONTROL_MANUAL = 1 }

Define Documentation

#define UUID_IPluggableTransport FB7045F0-A4DC-11D2-B724-00104BC51339

Definition at line 10 of file iplgxprt.idl.

Typedef Documentation

typedef unsigned int HCOMMDEV

Definition at line 20 of file iplgxprt.idl.

typedef unsigned int HEVENT

Definition at line 21 of file iplgxprt.idl.

typedef enum tagPLUGXPRT_CALL_TYPE PLUGXPRT_CALL_TYPE
typedef enum tagPLUGXPRT_FRAMING PLUGXPRT_FRAMING
typedef struct tagPLUGXPRT_PARAMETERS PLUGXPRT_PARAMETERS
typedef enum tagPLUGXPRT_PSTN_CALL_CONTROL PLUGXPRT_PSTN_CALL_CONTROL

Enumeration Type Documentation

enum tagPLUGXPRT_CALL_TYPE
Enumerator:
PLUGXPRT_UNKNOWN_CALL_TYPE
PLUGXPRT_CALLER
PLUGXPRT_CALLEE

Definition at line 32 of file iplgxprt.idl.

{
    PLUGXPRT_UNKNOWN_CALL_TYPE  = 0,
    PLUGXPRT_CALLER             = 1,
    PLUGXPRT_CALLEE             = 2,
}

enum tagPLUGXPRT_FRAMING
Enumerator:
FRAMING_LEGACY_PSTN
FRAMING_X224

Definition at line 24 of file iplgxprt.idl.

{
    FRAMING_LEGACY_PSTN     = 0,    // legacy PSTN framing
    FRAMING_X224            = 1,    // X224 Connect + X224 Data Transfer
}

enum tagPLUGXPRT_PSTN_CALL_CONTROL
Enumerator:
PLUGXPRT_PSTN_CALL_CONTROL_PORT_HANDLE
PLUGXPRT_PSTN_CALL_CONTROL_MANUAL

Definition at line 41 of file iplgxprt.idl.

{
    PLUGXPRT_PSTN_CALL_CONTROL_PORT_HANDLE    = 0,  // default, for normal PSTN
    PLUGXPRT_PSTN_CALL_CONTROL_MANUAL         = 1,  // for legacy null modem
}

Generated on Wed Nov 13 2024 16:54:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/PlugTransport/nmsession.cpp File Reference

  • Web
  • NetMeeting
  • PlugTransport
Functions

nmsession.cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

BOOL | BSTR2LPSTR (BSTR bstrConnID, LPSTR pszConnID)
BSTR | LPSTR2BSTR (LPSTR pszString)

Function Documentation

BOOL BSTR2LPSTR | ( | BSTR | bstrConnID,
 |  | LPSTR | pszConnID
 | ) |  |

Definition at line 274 of file utils.cpp.

{
    *pszConnID = '\0';
    return ::WideCharToMultiByte(CP_ACP, 0, bstrConnID, -1, pszConnID, CONNIDMAXLENGTH, NULL, NULL);
}

BSTR LPSTR2BSTR ( LPSTR pszString )

Definition at line 250 of file utils.cpp.

{
    WCHAR wszConnID[CONNIDMAXLENGTH];

    if (::MultiByteToWideChar(CP_ACP, 0, pszString, -1, wszConnID, CONNIDMAXLENGTH))
    {
        return ::SysAllocString(wszConnID);
    }

    return NULL;
}

Generated on Wed Nov 13 2024 16:54:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/PlugTransport/nmsession.h File Reference

  • Web
  • NetMeeting
  • PlugTransport
Classes | Defines

nmsession.h File Reference

Go to the source code of this file.

Classes

class | CCallNotify
class | CConfNotify
class | CMgrNotify
class | Conf

Defines

#define | CONNIDMAXLENGTH 64
#define | NAMEMAXLENGTH 64
#define | PLUGABLE_PORT_NUMBER 522
#define | WM_CONNECTED WM_USER + 2
#define | WM_CONNECTING WM_USER + 1
#define | WM_DISCONNECTED WM_USER + 3
#define | WM_PLUGABLE_SOCKET (WM_APP + 0x601)

Define Documentation

#define CONNIDMAXLENGTH 64

Definition at line 28 of file nmsession.h.

#define NAMEMAXLENGTH 64

Definition at line 27 of file nmsession.h.

#define PLUGABLE_PORT_NUMBER 522

Definition at line 24 of file nmsession.h.

#define WM_CONNECTED WM_USER + 2

Definition at line 21 of file nmsession.h.

#define WM_CONNECTING WM_USER + 1

Definition at line 20 of file nmsession.h.

#define WM_DISCONNECTED WM_USER + 3

Definition at line 22 of file nmsession.h.

#define WM_PLUGABLE_SOCKET (WM_APP + 0x601)

Definition at line 25 of file nmsession.h.

Generated on Wed Nov 13 2024 16:54:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/PlugTransport/nullmdm.cpp File Reference

  • Web
  • NetMeeting
  • PlugTransport
Variables

nullmdm.cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Variables

ULONG | g_nConnID = 0
BYTE | g_szNULLMStartString [] = "NULLMDM"

Variable Documentation

ULONG g_nConnID = 0

Definition at line 24 of file nullmdm.cpp.

BYTE g_szNULLMStartString[] = "NULLMDM"

Definition at line 23 of file nullmdm.cpp.

Generated on Wed Nov 13 2024 16:54:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/PlugTransport/nullmdm.h File Reference

  • Web
  • NetMeeting
  • PlugTransport
Classes | Defines | Typedefs | Enumerations

nullmdm.h File Reference

Go to the source code of this file.

Classes

class | CNullModem
class | CPSTN
struct | tagLINE_INFO
struct | tphys_connect_info

Defines

#define | COMM_PORT_BAUD_RATE 19200
#define | COMM_PORT_DATA_BITS 8
#define | COMM_PORT_STOP_BITS ONESTOPBIT
#define | COMM_PORT_TIMEOUT 60000
#define | COMPORTNAMEMAXLENGTH 64

Typedefs

typedef enum tagCALL_STATE | CALL_STATE
typedef struct tagLINE_INFO | LINE_INFO
typedef UINT | PHYSICAL_HANDLE
typedef struct tphys_connect_info * | PTPHYS_CONNECT_INFO
typedef struct tphys_connect_info | TPHYS_CONNECT_INFO
typedef enum tagTPhysicalError | TPhysicalError

Enumerations

enum tagCALL_STATE {
CALL_STATE_IDLE = 0, CALL_STATE_MAKE = 1, CALL_STATE_ANSWER = 2, CALL_STATE_DROP = 3,
CALL_STATE_CONNECTED = 4
}
enum tagTPhysicalError {
TPHYS_SUCCESS = 0, TPHYS_RESULT_INUSE = 100, TPHYS_RESULT_FAIL = 101, TPHYS_RESULT_NOT_INITIALIZED = 102,
TPHYS_RESULT_CONNECT_FAILED = 103, TPHYS_CONNECT_RESPONSE_FAILED = 104, TPHYS_RESULT_NOT_LISTENING = 105, TPHYS_RESULT_INVALID_CONNECTION = 106,
TPHYS_RESULT_INVALID_ADDRESS = 107, TPHYS_RESULT_CONNECT_REJECTED = 108, TPHYS_RESULT_SUCCESS_ALTERNATE = 109, TPHYS_RESULT_COMM_PORT_BUSY = 110,
TPHYS_RESULT_WAITING_FOR_CONNECTION = 111
}

Define Documentation

#define COMM_PORT_BAUD_RATE 19200

Definition at line 134 of file nullmdm.h.

#define COMM_PORT_DATA_BITS 8

Definition at line 136 of file nullmdm.h.

#define COMM_PORT_STOP_BITS ONESTOPBIT

Definition at line 135 of file nullmdm.h.

#define COMM_PORT_TIMEOUT 60000

Definition at line 133 of file nullmdm.h.

#define COMPORTNAMEMAXLENGTH 64

Definition at line 20 of file nullmdm.h.

Typedef Documentation

typedef enum tagCALL_STATE CALL_STATE
typedef struct tagLINE_INFO LINE_INFO
typedef UINT PHYSICAL_HANDLE

Definition at line 49 of file nullmdm.h.

typedef struct tphys_connect_info * PTPHYS_CONNECT_INFO
typedef struct tphys_connect_info TPHYS_CONNECT_INFO
typedef enum tagTPhysicalError TPhysicalError

Enumeration Type Documentation

enum tagCALL_STATE
Enumerator:
CALL_STATE_IDLE
CALL_STATE_MAKE
CALL_STATE_ANSWER
CALL_STATE_DROP
CALL_STATE_CONNECTED

Definition at line 55 of file nullmdm.h.

{
    CALL_STATE_IDLE         = 0,    // Call is idle
    CALL_STATE_MAKE         = 1,    // Establishing phone connection
    CALL_STATE_ANSWER       = 2,    // Answering a new call
    CALL_STATE_DROP         = 3,    // Dropping the phone connection
    CALL_STATE_CONNECTED    = 4,    // Phone connection established and passed onto TDD.
}

enum tagTPhysicalError
Enumerator:
TPHYS_SUCCESS
TPHYS_RESULT_INUSE
TPHYS_RESULT_FAIL
TPHYS_RESULT_NOT_INITIALIZED
TPHYS_RESULT_CONNECT_FAILED
TPHYS_CONNECT_RESPONSE_FAILED
TPHYS_RESULT_NOT_LISTENING
TPHYS_RESULT_INVALID_CONNECTION
TPHYS_RESULT_INVALID_ADDRESS
TPHYS_RESULT_CONNECT_REJECTED
TPHYS_RESULT_SUCCESS_ALTERNATE
TPHYS_RESULT_COMM_PORT_BUSY
TPHYS_RESULT_WAITING_FOR_CONNECTION

Definition at line 23 of file nullmdm.h.

{
    TPHYS_SUCCESS                       =   0,
    TPHYS_RESULT_INUSE                  = 100,
    TPHYS_RESULT_FAIL                   = 101,
    TPHYS_RESULT_NOT_INITIALIZED        = 102,
    TPHYS_RESULT_CONNECT_FAILED         = 103,
    TPHYS_CONNECT_RESPONSE_FAILED       = 104,
    TPHYS_RESULT_NOT_LISTENING          = 105,
    TPHYS_RESULT_INVALID_CONNECTION     = 106,
    TPHYS_RESULT_INVALID_ADDRESS        = 107,
    TPHYS_RESULT_CONNECT_REJECTED       = 108,
    TPHYS_RESULT_SUCCESS_ALTERNATE      = 109,
    TPHYS_RESULT_COMM_PORT_BUSY         = 110,
    TPHYS_RESULT_WAITING_FOR_CONNECTION = 111,
}

Generated on Wed Nov 13 2024 16:54:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/PlugTransport/plugtransport.idl File Reference

  • Web
  • NetMeeting
  • PlugTransport

plugtransport.idl File Reference

import "imsconf3.idl";
import "iplgxprt.idl";

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/PlugTransport/plugxprt.cpp File Reference

  • Web
  • NetMeeting
  • PlugTransport
Functions

plugxprt.cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

BOOL | BSTR2LPSTR (BSTR bstrConnID, LPSTR pszConnID)
BSTR | LPSTR2BSTR (LPSTR pszString)

Function Documentation

BOOL BSTR2LPSTR | ( | BSTR | bstrConnID,
 |  | LPSTR | pszConnID
 | ) |  |

Definition at line 274 of file utils.cpp.

{
    *pszConnID = '\0';
    return ::WideCharToMultiByte(CP_ACP, 0, bstrConnID, -1, pszConnID, CONNIDMAXLENGTH, NULL, NULL);
}

BSTR LPSTR2BSTR ( LPSTR pszString )

Definition at line 250 of file utils.cpp.

{
    WCHAR wszConnID[CONNIDMAXLENGTH];

    if (::MultiByteToWideChar(CP_ACP, 0, pszString, -1, wszConnID, CONNIDMAXLENGTH))
    {
        return ::SysAllocString(wszConnID);
    }

    return NULL;
}

Generated on Wed Nov 13 2024 16:54:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/PlugTransport/plugxprt.h File Reference

  • Web
  • NetMeeting
  • PlugTransport
Classes | Defines

plugxprt.h File Reference

Go to the source code of this file.

Classes

class | CPluggableTransport

Defines

#define | CONNIDMAXLENGTH 64

Define Documentation

#define CONNIDMAXLENGTH 64

Definition at line 20 of file plugxprt.h.

Generated on Wed Nov 13 2024 16:54:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/PlugTransport/precomp.h File Reference

  • Web
  • NetMeeting
  • PlugTransport

precomp.h File Reference

#include <windows.h>
#include <ocidl.h>
#include <assert.h>
#include <string.h>
#include <tchar.h>
#include "resource.h"
#include "plugtransport.h"
#include "utils.h"
#include "nmsession.h"
#include "nullmdm.h"
#include "x224.h"
#include "plugxprt.h"
#include "resource.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/PlugTransport/resource.h File Reference

  • Web
  • NetMeeting
  • PlugTransport
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | ID_CALL 1005
#define | ID_CONNECT 1006
#define | ID_CONTROL 1005
#define | IDC_CONNECT 1001
#define | IDC_EDIT1 1000
#define | IDC_LISTEN 1002
#define | IDC_NAME 1000
#define | IDC_PSTN 1004
#define | IDC_X224 1003
#define | IDD_DIALOG1 101
#define | IDD_PLUGTRANSPORT 101

Define Documentation

#define ID_CALL 1005

Definition at line 14 of file resource.h.

#define ID_CONNECT 1006

Definition at line 15 of file resource.h.

#define ID_CONTROL 1005

Definition at line 13 of file resource.h.

#define IDC_CONNECT 1001

Definition at line 9 of file resource.h.

#define IDC_EDIT1 1000

Definition at line 7 of file resource.h.

#define IDC_LISTEN 1002

Definition at line 10 of file resource.h.

#define IDC_NAME 1000

Definition at line 8 of file resource.h.

#define IDC_PSTN 1004

Definition at line 12 of file resource.h.

#define IDC_X224 1003

Definition at line 11 of file resource.h.

#define IDD_DIALOG1 101

Definition at line 5 of file resource.h.

#define IDD_PLUGTRANSPORT 101

Definition at line 6 of file resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/PlugTransport/ui.cpp File Reference

  • Web
  • NetMeeting
  • PlugTransport
Defines | Functions | Variables

ui.cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Defines

#define | DEFAULTCOMPORT TEXT("Com1")
#define | MAX_SZ 200

Functions

BOOL CALLBACK | MainDlgProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
int WINAPI | WinMain (HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR szCmdLine, INT nCmdShow)

Variables

HINSTANCE | ghInst

Define Documentation

#define DEFAULTCOMPORT TEXT("Com1")

Definition at line 24 of file ui.cpp.

#define MAX_SZ 200

Definition at line 23 of file ui.cpp.

Function Documentation

BOOL CALLBACK MainDlgProc | ( | HWND | hWnd,
 |  | UINT | uMsg,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 109 of file ui.cpp.

{

    static Conf *pConf = NULL;
    static CPluggableTransport *pPlugTrans = NULL;
    HRESULT hr = S_OK;

    switch (uMsg)
    {
    case WM_INITDIALOG:
    {
        pConf = new Conf(hWnd);
        if (NULL == pConf)
        {
            MessageBox(NULL,TEXT("Not enough memory"),TEXT("Error"),MB_OK);
            EndDialog(hWnd,0);
            return false;
        }

        pPlugTrans = new CPluggableTransport();
        if (NULL == pPlugTrans)
        {
            MessageBox(NULL,TEXT("Not enough memory"),TEXT("Error"),MB_OK);
            EndDialog(hWnd,0);
            return false;
        }

        // Initialize the NM part of the Conf object
        hr = pConf->Initialize();
        if (FAILED(hr))
        {
            MessageBox(NULL,TEXT("NetMeeting cannot start"),TEXT("Error"),MB_OK);
            EndDialog(hWnd,0);
            return false;
        }

        // Initialize the PluggableTransport part of the Conf object
        hr = pPlugTrans->Initialize(pConf->GetNmManager());
        if (FAILED(hr))
        {
            MessageBox(NULL,TEXT("Plug cannot be initialized"),TEXT("Error"),MB_OK);
            EndDialog(hWnd,0);
            return false;
        }

        // update UI
        SetDlgItemText(hWnd, ID_CALL, TEXT("&Call"));
        SetDlgItemText(hWnd, ID_CONNECT, TEXT("Co&nnect"));
        EnableWindow(GetDlgItem(hWnd, ID_CALL), false);
        EnableWindow(GetDlgItem(hWnd, ID_CONNECT), true);
        EnableWindow(GetDlgItem(hWnd, IDC_LISTEN), false);
        EnableWindow(GetDlgItem(hWnd, IDC_CONNECT), false);
        return true;
    }

    case WM_CLOSE:
    {
        if (NULL != pPlugTrans)
        {
            // Close any connections of any kind that are still there
            if (pPlugTrans->InConnection())
            {
                hr = pPlugTrans->CloseConnection(FRAMING_LEGACY_PSTN);
                if (FAILED(hr))
                {
                    // Ignore the failure for now
                }

                hr = pPlugTrans->CloseConnection(FRAMING_X224);
                if (FAILED(hr))
                {
                    // Ignore the failure for now
                }
            }

            hr = pPlugTrans->Uninitialize();
            if (FAILED(hr))
            {
                MessageBox(NULL,TEXT("pPlugTrans->Uninitialize failed"),TEXT("Error"),MB_OK);
            }

            delete pPlugTrans;
            pPlugTrans = NULL;
        }

        if (NULL != pConf)
        {
            // Hangup if in a call
            if (pConf->InCall())
            {
                hr = pConf->HangUp();
                if (FAILED(hr))
                {
                    MessageBox(NULL,TEXT("pConf->HangUp failed"),TEXT("Error"),MB_OK);
                }
            }

            // Clear and delete Conf object
            hr = pConf->Uninitialize();
            if (FAILED(hr))
            {
                MessageBox(NULL,TEXT("pConf->Uninitialize failed"),TEXT("Error"),MB_OK);
            }

            delete pConf;
            pConf = NULL;
        }

        EndDialog(hWnd, 0);
        return true;
    }

    case WM_CONNECTING:
    case WM_CONNECTED:
    {
        // Message from Conf object that a user is connected
        SetDlgItemText(hWnd,ID_CALL,TEXT("Han&gup"));
        return true;
    }

    case WM_DISCONNECTED:
    {
        // Message from Conf object that a user disconnected or rejected call
        SetDlgItemText(hWnd,ID_CALL,TEXT("C&all"));
        EnableWindow(GetDlgItem(hWnd, ID_CALL), false);
        EnableWindow(GetDlgItem(hWnd, IDC_LISTEN), false);
        EnableWindow(GetDlgItem(hWnd, IDC_CONNECT), false);

        // Close the connection
        SendMessage(hWnd, WM_COMMAND, ID_CONNECT, 0);
        return true;
    }

    case WM_PLUGABLE_SOCKET:
    {
        ULONG event = WSAGETSELECTEVENT(lParam);

        if (NULL == pPlugTrans)
        {
            MessageBox(NULL, TEXT("pPlugTrans is NULL"), TEXT("Error"), MB_OK);
            return false;
        }

        // We get FD_CLOSE when the socket is closed by the remote site
        if (event & FD_CLOSE)
        {
            SetEvent(pPlugTrans->GetCloseEventHandle());
        }

        //We get FD_READ when there is data available for us to read
        if (event & FD_READ)
        {
            SetEvent(pPlugTrans->GetReadEventHandle());
        }

        // We get FD_WRITE when there is space available to write data to WinSock
        if (event & FD_WRITE)
        {
            SetEvent(pPlugTrans->GetWriteEventHandle());
        }

        // We get FD_CONNECT when connecting to a remote site
        if (event & FD_CONNECT)
        {
            // No FD_CONNECT code is needed for this sample
        }

        // We get FD_ACCEPT when a remote site is connecting with us
        if (event & FD_ACCEPT)
        {
            hr = pPlugTrans->AcceptConnection(hWnd);
            if (FAILED(hr))
            {
                MessageBox(NULL, TEXT("Accept connection failed"), TEXT("Error"), MB_OK);
                return false;
            }

            // update UI
            SetDlgItemText(hWnd,ID_CONNECT,TEXT("&Disconnect"));
            EnableWindow(GetDlgItem(hWnd, ID_CALL), true);
        }
        return true;
    }

    case WM_COMMAND:
    {
        switch (LOWORD(wParam))
        {
        case IDC_PSTN:
        {
            EnableWindow(GetDlgItem(hWnd, IDC_LISTEN), true);
            EnableWindow(GetDlgItem(hWnd, IDC_CONNECT), true);
            return true;
        }
        case IDC_X224:
        {
            EnableWindow(GetDlgItem(hWnd, IDC_LISTEN), true);
            EnableWindow(GetDlgItem(hWnd, IDC_CONNECT), true);
            // It seems that user wants to use X224. Let's create the listen socket
            // in order to be ready to accept new connections
            if (BST_CHECKED == IsDlgButtonChecked(hWnd, IDC_LISTEN))
            {
                if (FAILED(pPlugTrans->m_pX224->CreateListenSocket(hWnd)))
                {
                    MessageBox(hWnd, TEXT("Create listen socket failed"), TEXT("Error"), MB_OK);
                    return false;
                }
            }
            return true;
        }

        case ID_CALL:
        {
            // If not in a call, then make a call, otherwise hang up.
            if (NULL == pConf)
            {
                return false;
            }

            if (FALSE == pConf->InCall())
            {
                hr = pConf->Call(pPlugTrans);
                if (FAILED(hr))
                {
                }
                return true;
            }
            else
            {
                hr = pConf->HangUp();
                if (FAILED(hr))
                {
                }
                return true;
            }
        }
        case ID_CONNECT:
        {
            // If not in a connection, then make a connection. otherwise close the connections
            if (NULL == pPlugTrans)
            {
                return false;
            }

            if (!pPlugTrans->InConnection())
            {
                // get the machine name or the com port you are gonna use
                // It must always be something there
                TCHAR szName[MAX_SZ];

                GetDlgItemText(hWnd,IDC_NAME,szName,MAX_SZ);
                if (szName[0] == TEXT('\0'))
                {
                    MessageBox(hWnd, TEXT("Enter a machine name to connect to or a com port to use"), TEXT("Error"), MB_OK);
                    return false;
                }

                if (BST_CHECKED == IsDlgButtonChecked(hWnd, IDC_PSTN))
                {
                    if (BST_CHECKED == IsDlgButtonChecked(hWnd, IDC_LISTEN))
                    {
                        // This is the case in which we use PSTN stack
                        //and we are going to accept a connection
                        if (SUCCEEDED(pPlugTrans->AcceptConnection(szName)))
                        {
                            SetDlgItemText(hWnd,ID_CONNECT,TEXT("&Disconnect"));
                            EnableWindow(GetDlgItem(hWnd, ID_CALL), true);
                            return true;
                        }
                        return false;
                    }

                    if (BST_CHECKED == IsDlgButtonChecked(hWnd, IDC_CONNECT))
                    {
                        // This is the case in which we use PSTN stack
                        //and we are going to make a connection
                        if (SUCCEEDED(pPlugTrans->CreateConnection(szName)))
                        {
                            SetDlgItemText(hWnd,ID_CONNECT,TEXT("&Disconnect"));
                            EnableWindow(GetDlgItem(hWnd, ID_CALL), true);
                            return true;
                        }
                        return false;
                    }
                }

                if (BST_CHECKED == IsDlgButtonChecked(hWnd, IDC_X224))
                {
                    if (BST_CHECKED == IsDlgButtonChecked(hWnd, IDC_CONNECT))
                    {
                        // This is the case in which we use X224 stack
                        //and we are going to create a connection

                        // Create the connect socket
                        if (FAILED(pPlugTrans->m_pX224->CreateConnectSocket(hWnd, szName)))
                        {
                            MessageBox(hWnd, TEXT("Create connect socket failed"), TEXT("Error"), MB_OK);
                            return false;
                        }

                        // Create the connection
                        if (SUCCEEDED(pPlugTrans->CreateConnection()))
                        {
                            SetDlgItemText(hWnd,ID_CONNECT,TEXT("&Disconnect"));
                            EnableWindow(GetDlgItem(hWnd, ID_CALL), true);
                            return true;
                        }
                        return false;
                    }
                }
            }
            else
            {
                // close any connections of any kind
                pPlugTrans->CloseConnection(FRAMING_LEGACY_PSTN);
                pPlugTrans->CloseConnection(FRAMING_X224);
                SetDlgItemText(hWnd,ID_CONNECT,TEXT("&Connect"));
                EnableWindow(GetDlgItem(hWnd, ID_CALL), false);
                EnableWindow(GetDlgItem(hWnd, IDC_LISTEN), false);
                EnableWindow(GetDlgItem(hWnd, IDC_CONNECT), false);
                return true;
            }

        return false;
        }

        case IDC_LISTEN:
        {
            if (BST_CHECKED == IsDlgButtonChecked(hWnd, IDC_X224))
            {
                // It seems that the user wants to use X224. Let's create the listen socket
                // in order to be ready to accept new connections
                SendDlgItemMessage (hWnd, IDC_NAME, WM_SETTEXT, 0, (LPARAM)(LPSTR) pPlugTrans->m_pX224->SetAndGetHostName());
                if (FAILED(pPlugTrans->m_pX224->CreateListenSocket(hWnd)))
                {
                    MessageBox(hWnd, TEXT("Create listen socket failed"), TEXT("Error"), MB_OK);
                    return false;
                }
            }

            if (BST_CHECKED == IsDlgButtonChecked(hWnd, IDC_PSTN))
            {
                // It seems that the user wants to use PSTN. Let's show him the default
                // com port
                SendDlgItemMessage(hWnd, IDC_NAME, WM_SETTEXT, 0, (LPARAM)(LPSTR) DEFAULTCOMPORT);
            }

            return true;
        }
        }
     }
    default:
        return false;
    }
}

int WINAPI WinMain | ( | HINSTANCE | hInst,
 |  | HINSTANCE | hPrevInst,
 |  | LPSTR | szCmdLine,
 |  | INT | nCmdShow
 | ) |  |

Definition at line 53 of file ui.cpp.

{
    HRESULT hr = S_OK;
    int     iRes = 0;
    WSADATA wsa_data;
    WORD    version_requested = MAKEWORD (1,1);

    // Initialize COM
    hr = CoInitialize(NULL);
    if (FAILED(hr))
    {
        MessageBox(NULL, TEXT("CoInitialize"), TEXT("Error"), MB_OK);
        return -1;
    }

    ghInst = hInst;

    // Initialize windows sockets
    iRes = ::WSAStartup(version_requested, &wsa_data);
    if (iRes)
    {
        MessageBox(NULL, TEXT("WSAStartup failed"), TEXT("Error"), MB_OK);
        return -1;
    }

    // Load UI
    iRes = DialogBox(hInst,MAKEINTRESOURCE(IDD_PLUGTRANSPORT),NULL,(DLGPROC)MainDlgProc);

    // Terminate use of Windows sockets
    iRes = ::WSACleanup();
    if (SOCKET_ERROR == iRes)
    {
        MessageBox(NULL, TEXT("WSACleanup failed"), TEXT("Error"), MB_OK);
        return -1;
    }

    // Uninitialize COM
    CoUninitialize();

    return iRes;
}

Variable Documentation

HINSTANCE ghInst

Name of app.

Definition at line 31 of file ui.cpp.

Generated on Wed Nov 13 2024 16:54:56 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/PlugTransport/utils.cpp File Reference

  • Web
  • NetMeeting
  • PlugTransport
Functions

utils.cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

BOOL | BSTR2LPSTR (BSTR bstrConnID, LPSTR pszConnID)
BSTR | LPSTR2BSTR (LPSTR pszString)

Function Documentation

BOOL BSTR2LPSTR | ( | BSTR | bstrConnID,
 |  | LPSTR | pszConnID
 | ) |  |

Definition at line 274 of file utils.cpp.

{
    *pszConnID = '\0';
    return ::WideCharToMultiByte(CP_ACP, 0, bstrConnID, -1, pszConnID, CONNIDMAXLENGTH, NULL, NULL);
}

BSTR LPSTR2BSTR ( LPSTR pszString )

Definition at line 250 of file utils.cpp.

{
    WCHAR wszConnID[CONNIDMAXLENGTH];

    if (::MultiByteToWideChar(CP_ACP, 0, pszString, -1, wszConnID, CONNIDMAXLENGTH))
    {
        return ::SysAllocString(wszConnID);
    }

    return NULL;
}

Generated on Wed Nov 13 2024 16:53:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/PlugTransport/utils.h File Reference

  • Web
  • NetMeeting
  • PlugTransport
Classes | Defines

utils.h File Reference

Go to the source code of this file.

Classes

class | CNotify
class | RefCount

Defines

#define | ASSERT assert

Define Documentation

#define ASSERT assert

Definition at line 4 of file utils.h.

Generated on Wed Nov 13 2024 16:53:09 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/PlugTransport/x224.cpp File Reference

  • Web
  • NetMeeting
  • PlugTransport

x224.cpp File Reference

#include "precomp.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/NetMeeting/PlugTransport/x224.h File Reference

  • Web
  • NetMeeting
  • PlugTransport
Classes | Defines

x224.h File Reference

Go to the source code of this file.

Classes

class | CX224

Defines

#define | MAXHOSTNAMELENGTH 64

Define Documentation

#define MAXHOSTNAMELENGTH 64

Definition at line 20 of file x224.h.

Generated on Wed Nov 13 2024 16:54:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/networking/asyncdemo/AsyncDemo.cpp File Reference

  • Web
  • networking
  • asyncdemo
Classes | Functions | Variables

AsyncDemo.cpp File Reference

#include <windows.h>
#include <iostream.h>
#include <string.h>
#include <stdio.h>
#include <wininet.h>
#include "resource.h"

Go to the source code of this file.

Classes

struct | REQUEST_CONTEXT

Functions

void | AsyncDirect (REQUEST_CONTEXT *, HINTERNET)
BOOL CALLBACK | AsyncURL (HWND, UINT, WPARAM, LPARAM)
int WINAPI | Dump (HWND, int, HINTERNET)
int WINAPI | Header (HWND, int, int, HINTERNET)
void __stdcall | Juggler (HINTERNET, DWORD, DWORD, LPVOID, DWORD)
DWORD | Threader (LPVOID)
int WINAPI | WinMain (HINSTANCE hThisInst, HINSTANCE hPrevInst, LPSTR lpszArgs, int nWinMode)

Variables

HWND | hButton
HINTERNET | hOpen
INTERNET_STATUS_CALLBACK | iscCallback
LPSTR | lpszAgent = "Asynchronous WinInet Demo Program"

Function Documentation

void AsyncDirect | ( | REQUEST_CONTEXT * | prcContext,
 |  | HINTERNET | hOpen
 | ) |  |

Definition at line 216 of file AsyncDemo.cpp.

{
  //dim a buffer to hold the URL
  char szURL[256];

  //retrieve the URL from the designated edit box
  GetDlgItemText(prcContext->hWindow,prcContext->nURL,szURL,256);

  //update the memo in the REQUEST_CONTEXT structure
  sprintf(prcContext->szMemo, "AsyncDirect(%s)(%d):", szURL, prcContext->nURL);

  //call InternetOpenUrl
  prcContext->hResource = InternetOpenUrl(hOpen, szURL, NULL, 0, 0, (DWORD)prcContext);

  //check the HINTERNET handle for errors
  if (prcContext->hResource == NULL)
  {
    if (GetLastError() != ERROR_IO_PENDING)
    {
      //reuse the URL buffer for the error information
      sprintf(szURL,"Error %d encountered.",GetLastError());

      //write error to resource edit box
      SetDlgItemText(prcContext->hWindow, prcContext->nResource,
        szURL);
    }
  }

}

BOOL CALLBACK AsyncURL | ( | HWND | hX,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 123 of file AsyncDemo.cpp.

{

  switch(message)
  {
    case WM_INITDIALOG:
      //change the cursor to indicate something is happening
      SetCursor(LoadCursor(NULL,IDC_WAIT));

      //set the default web sites
      SetDlgItemText(hX,IDC_URL1,
        LPSTR("http://www.microsoft.com"));
      SetDlgItemText(hX,IDC_URL2,
        LPSTR("http://home.microsoft.com"));

      //initialize the first context value
      rcContext1.hWindow = hX;
      rcContext1.nURL = IDC_URL1;
      rcContext1.nHeader = IDC_Header1;
      rcContext1.nResource = IDC_Resource1;
      sprintf(rcContext1.szMemo, "AsyncURL(%d)",
        rcContext2.nURL);

      //initialize the second context value
      rcContext2.hWindow = hX;
      rcContext2.nURL = IDC_URL2;
      rcContext2.nHeader = IDC_Header2;
      rcContext2.nResource = IDC_Resource2;
      sprintf(rcContext2.szMemo, "AsyncURL(%d)",
        rcContext2.nURL);

      //change the cursor back to normal
      SetCursor(LoadCursor(NULL,IDC_ARROW));
      return TRUE;
    case WM_COMMAND:
      switch(LOWORD(wParam))
      {
        case IDC_EXIT:
          //change the cursor
          SetCursor(LoadCursor(NULL,IDC_WAIT));

          //close the dialog box
          EndDialog(hX,0);

          //return the cursor to normal
          SetCursor(LoadCursor(NULL,IDC_ARROW));
          return TRUE;
        case IDC_Download:

          hButton = GetDlgItem(hX, IDC_Download);
          EnableWindow(hButton,0);

          //reset the edit boxes
          SetDlgItemText(hX,IDC_Resource1,LPSTR(""));
          SetDlgItemText(hX,IDC_Resource2,LPSTR(""));
          SetDlgItemText(hX,IDC_Header1,LPSTR(""));
          SetDlgItemText(hX,IDC_Header2,LPSTR(""));

          //start the downloads
          AsyncDirect(&rcContext1, hOpen);
          AsyncDirect(&rcContext2, hOpen);
          return TRUE;
      }
      return FALSE;
    case WM_DESTROY:
      //change the cursor
      SetCursor(LoadCursor(NULL,IDC_WAIT));

      //close the dialog box
      EndDialog(hX,0);

      //return the cursor to normal
      SetCursor(LoadCursor(NULL,IDC_ARROW));
      return TRUE;
    default:
      return FALSE;

  }

}

int WINAPI Dump | ( | HWND | hX,
 |  | int | intCtrlID,
 |  | HINTERNET | hResource
 | ) |  |

Definition at line 515 of file AsyncDemo.cpp.

{

  LPSTR lpszData;   // buffer for the data
  DWORD dwSize;     // size of the data available
  DWORD dwDownloaded; // size of the downloaded data
  DWORD dwSizeSum=0;  // size of the data in the textbox
  LPSTR lpszHolding;  // buffer to merge the textbox data and buffer

  char  szError[80];  // buffer for error information
  // Set the cursor to an hourglass.
  SetCursor(LoadCursor(NULL,IDC_WAIT));

  int   nCounter;   // counter used to display something while
              // I/O is pending.

  // This loop handles reading the data.
  do
  {

try_again:
    // The call to InternetQueryDataAvailable determines the amount of
    // data available to download.
    if (!InternetQueryDataAvailable(hResource,&dwSize,0,0))
    {
      if (GetLastError()== ERROR_IO_PENDING)
      {
        nCounter = 0;

        while(GetLastError()==ERROR_IO_PENDING)
        {
          nCounter++;

          if (nCounter==2000)
            break;
        }
        goto try_again;
      }
      sprintf(szError,"Error %d encountered by InternetQueryDataAvailable",
        GetLastError());
      SetDlgItemText(hX,intCtrlID, szError);
      SetCursor(LoadCursor(NULL,IDC_ARROW));
      break;
    }
    else
    {
      // Allocates a buffer of the size returned by InternetQueryDataAvailable
      lpszData = new char[dwSize+1];

      // Reads the data from the HINTERNET handle.
      if(!InternetReadFile(hResource,(LPVOID)lpszData,dwSize,&dwDownloaded))
      {
        if (GetLastError()== ERROR_IO_PENDING)
        {
          nCounter = 0;

          while(GetLastError()==ERROR_IO_PENDING)
          {
            nCounter++;
          }
          goto keep_going;
        }
        sprintf(szError,"Error %d encountered by InternetReadFile",
          GetLastError());
        SetDlgItemText(hX,intCtrlID, szError);
        delete[] lpszData;
        break;
      }
      else
      {

keep_going:
        // Adds a null terminator to the end of the data buffer
        lpszData[dwDownloaded]='\0';

        // Allocates the holding buffer
        lpszHolding = new char[dwSizeSum + dwDownloaded + 1];

        // Checks if there has been any data written to the textbox
        if (dwSizeSum != 0)
        {
          // Retrieves the data stored in the textbox if any
          GetDlgItemText(hX,intCtrlID,(LPSTR)lpszHolding,dwSizeSum);

          // Adds a null terminator at the end of the textbox data
          lpszHolding[dwSizeSum]='\0';
        }
        else
        {
          // Make the holding buffer an empty string.
          lpszHolding[0]='\0';
        }

        // Adds the new data to the holding buffer
        strcat(lpszHolding,lpszData);

        // Writes the holding buffer to the textbox
        SetDlgItemText(hX,intCtrlID,(LPSTR)lpszHolding);

        // Delete the two buffers
        delete[] lpszHolding;
        delete[] lpszData;

        // Add the size of the downloaded data to the textbox data size
        dwSizeSum = dwSizeSum + dwDownloaded + 1;

        // Check the size of the remaining data.  If it is zero, break.
        if (dwDownloaded == 0)
          break;
      }
    }
  }
  while(TRUE);

  // Close the HINTERNET handle
  InternetCloseHandle(hResource);

  // Set the cursor back to an arrow
  SetCursor(LoadCursor(NULL,IDC_ARROW));

  // Return
  return TRUE;
}

int WINAPI Header | ( | HWND | hX,
 |  | int | intControl,
 |  | int | intCustom,
 |  | HINTERNET | hHttp
 | ) |  |

Definition at line 450 of file AsyncDemo.cpp.

{
  DWORD dwHeaderType=-1;
  DWORD dwSize=0;
  LPVOID lpOutBuffer = NULL;

  char szError[80];

  //change the cursor
  SetCursor(LoadCursor(NULL,IDC_WAIT));

  //set the header type to be requested, which is all headers in
  //this case
  dwHeaderType = HTTP_QUERY_RAW_HEADERS_CRLF;

retry:

  //call HttpQueryInfo.
  //first time with a zero buffer size to get the size of the buffer
  //needed and to check if the header exists
  if(!HttpQueryInfo(hHttp,dwHeaderType,(LPVOID)lpOutBuffer,&dwSize,NULL))
  {
    //check if the header was not found
    if (GetLastError()==ERROR_HTTP_HEADER_NOT_FOUND)
    {
      sprintf(szError,"Error %d encountered", GetLastError());
      SetDlgItemText(hX,intControl, szError);
      SetCursor(LoadCursor(NULL,IDC_ARROW));
      return TRUE;
    }
    else
    {
      //check if the buffer was insufficient
      if (GetLastError()==ERROR_INSUFFICIENT_BUFFER)
      {
        //allocate the buffer
        lpOutBuffer = new char[dwSize+1];
        goto retry;
      }
      else
      {
        //display other errors in header edit box
        sprintf(szError,"Error %d encountered", GetLastError());
        SetDlgItemText(hX,intControl, szError);
        SetCursor(LoadCursor(NULL,IDC_ARROW));
        return FALSE;
      }
    }
  }

  SetDlgItemText(hX,intControl,(LPSTR)lpOutBuffer);
  delete[]lpOutBuffer;
  SetCursor(LoadCursor(NULL,IDC_ARROW));
  return 1;

}

void __stdcall Juggler | ( | HINTERNET | hInternet,
 |  | DWORD | dwContext,
 |  | DWORD | dwInternetStatus,
 |  | LPVOID | lpvStatusInformation,
 |  | DWORD | dwStatusInformationLength
 | ) |  |

Definition at line 259 of file AsyncDemo.cpp.

{
  REQUEST_CONTEXT *cpContext;
  char szBuffer[256];
  cpContext= (REQUEST_CONTEXT*)dwContext;

  switch (dwInternetStatus)
  {
    case INTERNET_STATUS_CLOSING_CONNECTION:
      //write the callback information to the buffer
      sprintf(szBuffer,"%s: CLOSING_CONNECTION (%d)",
        cpContext->szMemo, dwStatusInformationLength);
      break;
    case INTERNET_STATUS_CONNECTED_TO_SERVER:
      //write the callback information to the buffer
      sprintf(szBuffer,"%s: CONNECTED_TO_SERVER (%d)",
        cpContext->szMemo, dwStatusInformationLength);
      break;
    case INTERNET_STATUS_CONNECTING_TO_SERVER:
      //write the callback information to the buffer
      sprintf(szBuffer,"%s: CONNECTING_TO_SERVER (%d)",
        cpContext->szMemo, dwStatusInformationLength);
      break;
    case INTERNET_STATUS_CONNECTION_CLOSED:
      //write the callback information to the buffer
      sprintf(szBuffer,"%s: CONNECTION_CLOSED (%d)",
        cpContext->szMemo, dwStatusInformationLength);
      break;
    case INTERNET_STATUS_HANDLE_CLOSING:
      //write the callback information to the buffer
      sprintf(szBuffer,"%s: HANDLE_CLOSING (%d)",
        cpContext->szMemo, dwStatusInformationLength);

      sprintf(cpContext->szMemo, "Closed");

      //check if the both resource handles are closing
      //if so, enable the download button.
      if ((strcmp(rcContext1.szMemo,"Closed")) ||
        (strcmp(rcContext2.szMemo,"Closed")))
      {
        hButton = GetDlgItem(cpContext->hWindow, IDC_Download);
        EnableWindow(hButton,1);
      }
      break;
    case INTERNET_STATUS_HANDLE_CREATED:
      //write the callback information to the buffer
      sprintf(szBuffer,"%s: HANDLE_CREATED (%d)",
        cpContext->szMemo, dwStatusInformationLength);
      break;
    case INTERNET_STATUS_INTERMEDIATE_RESPONSE:
      //write the callback information to the buffer
      sprintf(szBuffer,"%s: INTERMEDIATE_RESPONSE (%d)",
        cpContext->szMemo, dwStatusInformationLength);
      break;
    case INTERNET_STATUS_NAME_RESOLVED:
      //write the callback information to the buffer
      sprintf(szBuffer,"%s: NAME_RESOLVED (%d)",
        cpContext->szMemo, dwStatusInformationLength);
      break;
    case INTERNET_STATUS_RECEIVING_RESPONSE:
      //write the callback information to the buffer
      sprintf(szBuffer,"%s: RECEIVEING_RESPONSE (%d)",
        cpContext->szMemo, dwStatusInformationLength);
      break;
    case INTERNET_STATUS_RESPONSE_RECEIVED:
      //write the callback information to the buffer
      sprintf(szBuffer,"%s: RESPONSE_RECEIVED (%d)",
        cpContext->szMemo, dwStatusInformationLength);
      break;
    case INTERNET_STATUS_REDIRECT:
      //write the callback information to the buffer
      sprintf(szBuffer,"%s: REDIRECT (%d)",
        cpContext->szMemo, dwStatusInformationLength);
      break;
    case INTERNET_STATUS_REQUEST_COMPLETE:

      //check for errors
      if (LPINTERNET_ASYNC_RESULT(lpvStatusInformation)->dwError == 0)
      {
        //check if the completed request is from AsyncDirect
        if (strcmp(cpContext->szMemo, "AsyncDirect"))
        {
          //set the resource handle to the HINTERNET handle
          //returned in the callback
          cpContext->hResource = HINTERNET(
            LPINTERNET_ASYNC_RESULT(lpvStatusInformation)->dwResult);

          //write the callback information to the buffer
          sprintf(szBuffer,"%s: REQUEST_COMPLETE (%d)",
            cpContext->szMemo, dwStatusInformationLength);

          //create a thread to handle the header and
          //resource download
          cpContext->hThread = CreateThread(NULL, 0,
            (LPTHREAD_START_ROUTINE)Threader,LPVOID(cpContext), 0,
            &cpContext->dwThreadID);

        }
        else
        {
          sprintf(szBuffer,"%s(%d): REQUEST_COMPLETE (%d)",
            cpContext->szMemo,
            cpContext->nURL, dwStatusInformationLength);
        }

      }
      else
      {
        sprintf(szBuffer,
          "%s: REQUEST_COMPLETE (%d) Error (%d) encountered",
          cpContext->szMemo, dwStatusInformationLength,
          GetLastError());
      }
      break;
    case INTERNET_STATUS_REQUEST_SENT:
      //write the callback information to the buffer
      sprintf(szBuffer,"%s: REQUEST_SENT (%d)",
        cpContext->szMemo, dwStatusInformationLength);
      break;
    case INTERNET_STATUS_RESOLVING_NAME:
      //write the callback information to the buffer
      sprintf(szBuffer,"%s: RESOLVING_NAME (%d)",
        cpContext->szMemo, dwStatusInformationLength);
      break;
    case INTERNET_STATUS_SENDING_REQUEST:
      //write the callback information to the buffer
      sprintf(szBuffer,"%s: SENDING_REQUEST (%d)",
        cpContext->szMemo, dwStatusInformationLength);
      break;
    case INTERNET_STATUS_STATE_CHANGE:
      //write the callback information to the buffer
      sprintf(szBuffer,"%s: STATE_CHANGE (%d)",
        cpContext->szMemo, dwStatusInformationLength);
      break;
    default:
      //write the callback information to the buffer
      sprintf(szBuffer,"%s: Unknown: Status %d Given", dwInternetStatus);
      break;
  }

  //add the callback information to the callback list box
  SendDlgItemMessage(cpContext->hWindow,IDC_CallbackList,
    LB_ADDSTRING,0,(LPARAM)szBuffer);

}

DWORD Threader ( LPVOID lpvContext )

Definition at line 421 of file AsyncDemo.cpp.

{
  REQUEST_CONTEXT *cpContext;

  //copy the pointer to a REQUEST_CONTEXT pointer to ease calls
  cpContext= (REQUEST_CONTEXT*)lpvContext;

  //set szMemo to the name of the function to be called
  sprintf(cpContext->szMemo, "Header(%d)", cpContext->nURL);

  //call the header function
  Header(cpContext->hWindow, cpContext->nHeader, -1, cpContext->hResource);

  //set szMemo to the name of the function to be called
  sprintf(cpContext->szMemo, "Dump(%d)", cpContext->nURL);

  //call the dump function
  Dump(cpContext->hWindow, cpContext->nResource, cpContext->hResource);

  return S_OK;

}

int WINAPI WinMain | ( | HINSTANCE | hThisInst,
 |  | HINSTANCE | hPrevInst,
 |  | LPSTR | lpszArgs,
 |  | int | nWinMode
 | ) |  |

Definition at line 85 of file AsyncDemo.cpp.

{

  //create the root HINTERNET handle using the systems default
  //settings.
  hOpen = InternetOpen(lpszAgent, INTERNET_OPEN_TYPE_PRECONFIG,
            NULL, NULL, INTERNET_FLAG_ASYNC);

  //check if the root HINTERNET handle has been created
  if (hOpen == NULL)
  {
    return FALSE;
  }
  else
  {
    //sets the callback function
    iscCallback = InternetSetStatusCallback(hOpen, (INTERNET_STATUS_CALLBACK)Juggler);

    //creates the dialog box
    DialogBox(hThisInst,"DB_ASYNCDEMO", HWND_DESKTOP,(DLGPROC)AsyncURL);

    //closes the root HINTERNET handle
    return InternetCloseHandle(hOpen);
  }

}

Variable Documentation

HWND hButton

Definition at line 59 of file AsyncDemo.cpp.

HINTERNET hOpen

Definition at line 37 of file AsyncDemo.cpp.

INTERNET_STATUS_CALLBACK iscCallback

Definition at line 40 of file AsyncDemo.cpp.

LPSTR lpszAgent = "Asynchronous WinInet Demo Program"

Definition at line 34 of file AsyncDemo.cpp.

Generated on Wed Nov 13 2024 16:54:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/networking/asyncdemo/resource.h File Reference

  • Web
  • networking
  • asyncdemo
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | ID_EXIT 1000
#define | IDC_CallbackList 1005
#define | IDC_Download 1001
#define | IDC_EXIT 1000
#define | IDC_Header1 1003
#define | IDC_Header2 1012
#define | IDC_LIST1 1005
#define | IDC_Resource1 1004
#define | IDC_Resource2 1013
#define | IDC_URL1 1002
#define | IDC_URL2 1011

Define Documentation

#define ID_EXIT 1000

Definition at line 6 of file resource.h.

#define IDC_CallbackList 1005

Definition at line 13 of file resource.h.

#define IDC_Download 1001

Definition at line 8 of file resource.h.

#define IDC_EXIT 1000

Definition at line 7 of file resource.h.

#define IDC_Header1 1003

Definition at line 10 of file resource.h.

#define IDC_Header2 1012

Definition at line 15 of file resource.h.

#define IDC_LIST1 1005

Definition at line 12 of file resource.h.

#define IDC_Resource1 1004

Definition at line 11 of file resource.h.

#define IDC_Resource2 1013

Definition at line 16 of file resource.h.

#define IDC_URL1 1002

Definition at line 9 of file resource.h.

#define IDC_URL2 1011

Definition at line 14 of file resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/networking/ftpjr/FTPJr.cpp File Reference

  • Web
  • networking
  • ftpjr
Defines | Functions | Variables

FTPJr.cpp File Reference

#include <iostream.h>
#include <windows.h>
#include <direct.h>
#include <wininet.h>
#include <strsafe.h>

Go to the source code of this file.

Defines

#define | PROMPT "FTP Jr>"
#define | STRSAFE_WITH_GETS

Functions

BOOL Close ()
void | DisplayHelp ()
BOOL | ErrorOut (DWORD, CHAR *)
BOOL | ErrorOut (DWORD dError, TCHAR *szCallFunc)
void | FtpEnumDirectory ()
void | lcd (char *)
void | main (int argc, char *argv[])
BOOL | Open (CHAR *)
BOOL | ParseCommand (char *, char *, char *)
void | rcd (char *)
void | ShowUsage ()
void | type (char *)

Variables

char | arg1 [256]
char | arg2 [256]
char | arg3 [256]
BOOL | bActiveSession = FALSE
DWORD | dwType = FTP_TRANSFER_TYPE_BINARY
HINTERNET | hConnect
HINTERNET | hOpen
char | szCmdLine [256] = ""
char | szProxy [256] = ""
char | szServer [256] = ""

Define Documentation

#define PROMPT "FTP Jr>"

Definition at line 21 of file FTPJr.cpp.

#define STRSAFE_WITH_GETS

Definition at line 14 of file FTPJr.cpp.

Function Documentation

BOOL Close ( )

Definition at line 456 of file FTPJr.cpp.

{
    if (!InternetCloseHandle (hConnect) )
    {
        ErrorOut (GetLastError(), "InternetCloseHandle");
        return FALSE;
    }
    bActiveSession = FALSE;
    return TRUE;
}

void DisplayHelp ( )

Definition at line 331 of file FTPJr.cpp.

{
  cout << "Commands are:" << endl;
  cout << "   cd" << endl;
  cout << "   close" << endl;
  cout << "   del" << endl;
  cout << "   get" << endl;
  cout << "   help" << endl;
  cout << "   lcd" << endl;
  cout << "   ls" << endl;
  cout << "   md" << endl;
  cout << "   open" << endl;
  cout << "   put" << endl;
  cout << "   quit" << endl;
  cout << "   rd" << endl;
  cout << "   ren" << endl;
  cout << "   type" << endl;
    ShowUsage ();
  cout << endl << PROMPT;
}

BOOL ErrorOut | ( | DWORD | ,
 |  | CHAR * |
 | ) |  |
BOOL ErrorOut | ( | DWORD | dError,
 |  | TCHAR * | szCallFunc
 | ) |  |

Definition at line 536 of file FTPJr.cpp.

{
    TCHAR szTemp[100] = "", *szBuffer=NULL, *szBufferFinal = NULL;
    DWORD  dwIntError , dwLength = 0;
  HRESULT hr = StringCchPrintf(szTemp, 100, "%s error %d\n", szCallFunc, dError );
  if (dError == ERROR_INTERNET_EXTENDED_ERROR)
  {
    InternetGetLastResponseInfo (&dwIntError, NULL, &dwLength);
    if (dwLength)
    {
      if ( !(szBuffer = (TCHAR *) LocalAlloc ( LPTR,  dwLength) ) )
      {
        HRESULT hr = StringCchCat( szTemp, 100, "Unable to allocate memory to display Internet error code. Error code: " );
        hr = StringCchCat( szTemp, 100, TEXT (_itoa (GetLastError(), szBuffer, 10)  ) );
        hr = StringCchCat( szTemp, 100, TEXT ("\n") );
        cerr << szTemp << endl;
        return FALSE;
      }
      if (!InternetGetLastResponseInfo (&dwIntError, (LPTSTR) szBuffer, &dwLength))
      {
        hr = StringCchCat( szTemp, 100, "Unable to get Internet error. Error code: " );
        hr = StringCchCat( szTemp, 100, TEXT (_itoa (GetLastError(), szBuffer, 10)  ) );
        hr = StringCchCat( szTemp, 100, TEXT ("\n") );
        cerr << szTemp << endl;
        return FALSE;
      }
      if ( !(szBufferFinal = (TCHAR *) LocalAlloc ( LPTR,  (strlen (szBuffer) +strlen (szTemp) + 1)  ) )  )
      {
        hr = StringCchCat( szTemp, 100, "Unable to allocate memory. Error code: " );
        hr = StringCchCat( szTemp, 100, TEXT (_itoa (GetLastError(), szBuffer, 10)  ) );
        hr = StringCchCat( szTemp, 100, TEXT ("\n") );
        cerr << szTemp << endl;
        return FALSE;
      }
      hr = StringCchCopy(szBufferFinal, 110, szTemp);
      hr = StringCchCat( szBufferFinal, 110, szBuffer );
      LocalFree (szBuffer);
      cerr <<  szBufferFinal  << endl;
      LocalFree (szBufferFinal);
    }
  }
  else
        cerr << szTemp << endl;
    return TRUE;
}

void FtpEnumDirectory ( )

Definition at line 467 of file FTPJr.cpp.

{
  WIN32_FIND_DATA pData;
  HINTERNET hFind;
  DWORD dError;

  // Start enumeration and get file handle
  if ( !(hFind = FtpFindFirstFile (hConnect, TEXT ("*.*"), &pData, 0, 0) ))
    if (GetLastError()  == ERROR_NO_MORE_FILES)
    {
      cout << "This directory is empty" << endl;
      return ;
    }
    else
    {
      ErrorOut (GetLastError (), "FindFirst error: ");
      return ;
    }

  cout << pData.cFileName;
  if (pData.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY)
    // Entry is a directory, mark it as such
    cout << " <DIR> " << endl;
  else
    cout << endl;

  dError = NO_ERROR;
  do
  {
     if (!InternetFindNextFile (hFind, &pData))
     {
       dError = GetLastError();
       if ( dError == ERROR_NO_MORE_FILES )
        break;
       else
       {
         ErrorOut (dError, "InternetFindNextFile");
         return ;
       }
     }
     else
     {
        cout << pData.cFileName;
        if (pData.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY)
          cout << " <DIR> " << endl;
        else
          cout << endl;
       }
  }
  while ( TRUE);
  if (!InternetCloseHandle (hFind) )
  {
    ErrorOut (GetLastError(), "InternetCloseHandle error");
    return ;
  }
  return ;
}

void lcd ( char * pszDir )

Definition at line 352 of file FTPJr.cpp.

{
  if ((*pszDir != 0) && (_chdir(pszDir) == -1))
    cout << "?Invalid Local Directory" << endl << PROMPT;
  else
  {
    char dir[256];
    GetCurrentDirectory(256, dir);
    cout << "Local Directory is " << dir << endl << PROMPT;
  }
}

void main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 42 of file FTPJr.cpp.

{

  // Display our banner
  cout << "FTP Jr. WinInet FTP Sample Application" << endl;
  cout << "Microsoft Corporation" << endl << endl;

  // Do they want the display syntax?
  if ((lstrcmp(argv[1], "/?") == 0) ||
        (lstrcmp(argv[1], "?") == 0) ||
    (lstrcmp(argv[1], "-?") == 0) ||
    (lstrcmp(argv[1], "help") == 0) ||
        (lstrcmp(argv[1], "/help") == 0) ||
    (lstrcmp(argv[1], "/HELP") == 0) ||
    (lstrcmp(argv[1], "HELP") == 0))
  {
    ShowUsage();
    return;
  }

  switch (argc)
  {
  case 2:
    // Specified proxy, Open WININET.DLL w/ Proxy
    StringCchCopy(szProxy, 256, argv[1]);
        if ( !(hOpen = InternetOpen ( "FTP Jr (C)",  CERN_PROXY_INTERNET_ACCESS, szProxy, NULL, 0) ) )
        {
            ErrorOut ( GetLastError(), "InternetOpen");
           return ;
        }
        break;
    case 1:
    // No proxy specified.  Open WININET.DLL w/ local access
        if ( !(hOpen = InternetOpen ( "FTP Jr (C)",  LOCAL_INTERNET_ACCESS , NULL, 0, 0) ) )
        {
            ErrorOut ( GetLastError(), "InternetOpen");
            return ;
        }
        break;
    default:
    ShowUsage();
    return;
  }

  printf("%10s", PROMPT);
//  cout << "FTPJr"<<endl;

  // Parse commands 1 line at a time
  while(TRUE)
  {
    char *pszArg1, *pszArg2, *pszArg3, *pszTemp;

    // Read line
    HRESULT hr = StringCchGets(szCmdLine, 256);
    pszArg1 = szCmdLine;

    //Remove white space before 1st arg
    while((*pszArg1 != 0) &&
        (*pszArg1 == ' ')) pszArg1++;

    pszArg2 = pszArg1;

    //Find end of 1st arg and zero terminate
    while ((*pszArg2 != 0) &&
         (*pszArg2 != ' ')) pszArg2++;

    if (*pszArg2 != 0) *pszArg2++ = 0;

    //Remove white space before 2nd arg
    while ((*pszArg2 !=0) &&
         (*pszArg2 == ' ')) pszArg2++;

    pszArg3 = pszArg2;

    //Find end of 2nd arg and zero terminate
    while ((*pszArg3 != 0) &&
         (*pszArg3 != ' ')) pszArg3++;

    if (*pszArg3 != 0) *pszArg3++ = 0;

    //Remove white space before 3rd Arg
    while ((*pszArg3 !=0) &&
         (*pszArg3 == ' ')) pszArg3++;

    pszTemp = pszArg3;

    //Find end of 3rd arg and zero terminate
    while((*pszTemp != 0) &&
        (*pszTemp != ' ')) pszTemp++;

    if (*pszTemp != 0) *pszTemp = 0;

    //Loop indefintely until ParseCommand returns false
    if (ParseCommand(pszArg1, pszArg2, pszArg3) == FALSE)
      return;

  }
}

BOOL Open ( CHAR * szHost )

Definition at line 427 of file FTPJr.cpp.

{
    CHAR szUser[256], szPass[256];
    if ( *szHost == 0)
    {
    cout << "Enter Host: ";
    StringCchGetsA(szHost, 256);
    cout << "Enter Username: ";
    StringCchGetsA(szUser, 256);
    cout << "Enter Password: ";
    StringCchGetsA(szPass, 256);
    }
    else
    {
    cout << "Enter Username: ";
    StringCchGetsA(szUser, 256);
    cout << "Enter Password: ";
    StringCchGetsA(szPass, 256);
    }
    if ( !(hConnect = InternetConnect ( hOpen, szHost , INTERNET_INVALID_PORT_NUMBER, szUser,  szPass, INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE , 0) ) )
    {
      ErrorOut (GetLastError(), "InternetConnect");
        return FALSE;
    }
    bActiveSession = TRUE;
  HRESULT hr = StringCchCopyA(szServer, 256, szHost);
    return TRUE;
}

BOOL ParseCommand | ( | char * | pszArg1,
 |  | char * | pszArg2,
 |  | char * | pszArg3
 | ) |  |

Definition at line 150 of file FTPJr.cpp.

{
  _strupr(pszArg1);
    CHAR szFile1[256] ="", szFile2[256] ="";

  // Quit Command
  if (lstrcmp(pszArg1, "QUIT") == 0)
    return FALSE;

  // Get Command
  else if (lstrcmp(pszArg1, "GET") == 0)
  {
      if (bActiveSession)
        {
      cout << "Enter Remote Filename: ";
      StringCchGetsA(szFile1, 256);
      cout << "Enter Local Filename: ";
      StringCchGetsA(szFile2, 256);
            if (!FtpGetFile (hConnect, szFile1, szFile2, FALSE, 0, INTERNET_FLAG_RELOAD | dwType, 0 ) )
                ErrorOut (GetLastError(), "FtpGetFile");
        }
        else
            cout << "No active session" ;
        cout << endl << PROMPT;
  }

  // Put Command
  else if (lstrcmp(pszArg1, "PUT") == 0)
  {
      if (bActiveSession)
        {
      cout << "Enter Remote Filename: ";
      StringCchGetsA(szFile1, 256);
      cout << "Enter Local Filename: ";
      StringCchGetsA(szFile2, 256);
            if (!FtpPutFile (hConnect,szFile1, szFile2, dwType, 0 ) )
                ErrorOut (GetLastError(), "FtpPutFile");
        }
        else
            cout << "No active session" ;
        cout << endl << PROMPT;
  }

  // Del Command
  else if (lstrcmp(pszArg1, "DEL") == 0)
  {
      if (bActiveSession)
        {
      cout << "Enter Remote Filename: ";
      StringCchGetsA(szFile1, 256);
            if (!FtpDeleteFile (hConnect,szFile1 ) )
                ErrorOut (GetLastError(), "FtpDelFile");
        }
        else
            cout << "No active session" ;
        cout << endl << PROMPT;
  }

  // Ren Command
  else if (lstrcmp(pszArg1, "REN") == 0)
  {
      if (bActiveSession)
        {
      cout << "Enter Existing Filename: ";
      StringCchGetsA(szFile1, 256);
      cout << "Enter New Filename: ";
      StringCchGetsA(szFile2, 256);
            if (!FtpRenameFile (hConnect,szFile1, szFile2 ) )
                ErrorOut (GetLastError(), "FtpRenameFile");
        }
        else
            cout << "No active session" ;
        cout << endl << PROMPT;

  }

  // ls command
  else if (lstrcmp(pszArg1, "LS") == 0)
  {
      if (bActiveSession)
            FtpEnumDirectory();
        else
            cout << "No active session" ;
        cout << endl << PROMPT;
  }

  // md command
  else if (lstrcmp(pszArg1, "MD") == 0)
  {
      if (bActiveSession)
        {
      cout << "Enter Directory: ";
      StringCchGetsA(szFile1, 256);
            if (!FtpCreateDirectory (hConnect,szFile1 ) )
                ErrorOut (GetLastError(), "FtpCreateDirectory");
        }
        else
            cout << "No active session" ;
        cout << endl << PROMPT;
  }

  // rd command
  else if (lstrcmp(pszArg1, "RD") == 0)
  {
      if (bActiveSession)
        {
      cout << "Enter Directory: ";
      StringCchGetsA(szFile1, 256);
            if (!FtpRemoveDirectory (hConnect,szFile1 ) )
                ErrorOut (GetLastError(), "FtpRemoveDirectory");
        }
        else
            cout << "No active session" ;
        cout << endl << PROMPT;
  }

  // type command
  else if (lstrcmp(pszArg1, "TYPE") == 0)
  {
        if (bActiveSession)
            type (pszArg2);
        else
            cout << "No active session" << endl << PROMPT;
  }

  // cd command
  else if (lstrcmp(pszArg1, "CD") == 0)
  {
        if (bActiveSession)
            rcd (pszArg2);
        else
            cout << "No active session" << endl << PROMPT;
  }

  // lcd command
  else if (lstrcmp(pszArg1, "LCD") == 0)
  {
    lcd(pszArg2);
  }

  // open command
  else if (lstrcmp(pszArg1, "OPEN") == 0)
  {
        if (!bActiveSession)
        {
          if (Open (pszArg2))
                cout << "Connected to " << pszArg2 << endl << PROMPT;
            else
                cout << "Session closed" << endl << PROMPT;
        }
        else
            cout << "Already connected to " << szServer << endl << PROMPT;

  }

  // close command
  else if (lstrcmp(pszArg1, "CLOSE") == 0)
  {
        if (bActiveSession)
        {
          Close();
            cout << "Session closed" << endl << PROMPT;
        }
        else
            cout << "No active session" << endl << PROMPT;
  }

  // help command
  else if (lstrcmp(pszArg1, "HELP") == 0)
  {
    DisplayHelp();
  }

  // error Unknown command
  else
  {
    cout << "?Unknown Command" << endl << PROMPT;
  }
  return TRUE;
}

void rcd ( char * pszDir )

Definition at line 364 of file FTPJr.cpp.

{
    char dir[256];
  if (*pszDir != 0)
    {
    if (!FtpSetCurrentDirectory (hConnect, pszDir))
        {
            ErrorOut (GetLastError(), "FtpSetCurrentDirectory");
            cout <<  PROMPT;
        }
        else
        cout << "Remote Directory is " << pszDir << endl << PROMPT;
    }
  else
  {
        DWORD dwSize = sizeof(dir);
    if (!FtpGetCurrentDirectory (hConnect, dir, &dwSize))
            cout << "Can not determine current remote directory " << endl << PROMPT;
        else
        cout << "Remote Directory is " << dir << endl << PROMPT;
  }
}

void ShowUsage ( )

Definition at line 418 of file FTPJr.cpp.

{
  cout << "Syntax:" << endl << "  FTPJR <proxy>" << endl ;
    cout << "Note: a CERN style proxy will not work. You will need to "<< endl;
    cout << "specify a TIS style FTP proxy in the form:" << endl << endl;
  cout << "     FTPJR ftp-gw" << endl << endl;
  cout << "where ftp-gw is the name of the host that is running the gateway" << endl;
}

void type ( char * szType )

Definition at line 387 of file FTPJr.cpp.

{

  _strupr(szType);
  if (*szType != 0)
    {
      if (lstrcmp(szType, "BIN") == 0)
        {
        dwType = FTP_TRANSFER_TYPE_BINARY;
            cout << "BIN mode selected";
        }
      else if (lstrcmp(szType, "ASCII") == 0)
        {
        dwType = FTP_TRANSFER_TYPE_ASCII;
            cout << "ASCII mode selected";
        }
        else
            cout << "Invalid mode";
        cout << endl << PROMPT;
    }
  else
  {
    if ( dwType == FTP_TRANSFER_TYPE_BINARY)
            cout << "BIN ";
        else
        cout << "ASCII ";
        cout << "mode selected " << endl << PROMPT;
  }
}

Variable Documentation

char arg1[256]

Definition at line 34 of file FTPJr.cpp.

char arg2[256]

Definition at line 34 of file FTPJr.cpp.

char arg3[256]

Definition at line 34 of file FTPJr.cpp.

BOOL bActiveSession = FALSE

Definition at line 39 of file FTPJr.cpp.

DWORD dwType = FTP_TRANSFER_TYPE_BINARY

Definition at line 40 of file FTPJr.cpp.

HINTERNET hConnect

Definition at line 38 of file FTPJr.cpp.

HINTERNET hOpen

Definition at line 38 of file FTPJr.cpp.

char szCmdLine[256] = ""

Definition at line 37 of file FTPJr.cpp.

char szProxy[256] = ""

Definition at line 35 of file FTPJr.cpp.

char szServer[256] = ""

Definition at line 36 of file FTPJr.cpp.

Generated on Wed Nov 13 2024 16:54:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/networking/httpauth/httpauth.cpp File Reference

  • Web
  • networking
  • httpauth
Defines | Functions

httpauth.cpp File Reference

#include <windows.h>
#include <stdio.h>
#include <fcntl.h>
#include <io.h>
#include <wininet.h>
#include <strsafe.h>

Go to the source code of this file.

Defines

#define | CHECK_ERROR(cond, err) if (!(cond)) {pszErr=(err); goto done;}
#define | STRSAFE_WITH_GETS

Functions

DWORD | DoCustomUI (HINTERNET hConnect, HINTERNET hRequest)
int | main (int argc, char **argv)
BOOL | NeedAuth (HINTERNET hRequest)

Define Documentation

#define CHECK_ERROR | ( | cond,
 |  | err |
 | ) |  | if (!(cond)) {pszErr=(err); goto done;}
#define STRSAFE_WITH_GETS

Definition at line 9 of file httpauth.cpp.

Function Documentation

DWORD DoCustomUI | ( | HINTERNET | hConnect,
 |  | HINTERNET | hRequest
 | ) |  |

Definition at line 66 of file httpauth.cpp.

{
    // Prompt for username and password.
    char  szUser[64], szPass[64];
    fprintf (stderr, "Enter Username: ");
    if(FAILED(StringCchGetsA(szUser, 64)))
        return ERROR_INTERNET_LOGIN_FAILURE;
    fprintf (stderr, "Enter Password: ");
    if(FAILED(StringCchGetsA(szPass, 64)))
        return ERROR_INTERNET_LOGIN_FAILURE;

    // Set the values in the handle.
    InternetSetOption
        (hConnect, INTERNET_OPTION_USERNAME, szUser, sizeof(szUser));
    InternetSetOption
        (hConnect, INTERNET_OPTION_PASSWORD, szPass, sizeof(szPass));

    // Drain the socket.
    BYTE bBuf[1000];
    DWORD cbBuf = sizeof(bBuf);
    DWORD cbRead;
    while (InternetReadFile (hRequest, bBuf, cbBuf, &cbRead) && cbRead);

    return ERROR_INTERNET_FORCE_RETRY;
}

int main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 94 of file httpauth.cpp.

{
    HINTERNET hInternet = NULL;
    HINTERNET hConnect  = NULL;
    HINTERNET hRequest  = NULL;
    PSTR pszErr = NULL;
    BOOL fRet;

#define CHECK_ERROR(cond, err) if (!(cond)) {pszErr=(err); goto done;}

    // Check usage.
    if (argc < 2)
    {
        fprintf (stderr, "Usage:   httpauth [-c] <server> [<object> [<user> [<pass>]]]\n");
        fprintf (stderr, "  -c: Use custom UI to prompt for user/pass");
        exit (1);
    }

    // Parse arguments.
    BOOL fAllowCustomUI = FALSE;
    if (argc >= 2 && argv[1][0] == '-')
    {
        fAllowCustomUI = TRUE;
        argv++;
        argc--;
    }
    PSTR pszHost   = argv[1];
    PSTR pszObject = argc >= 3 ? argv[2] : "/";
    PSTR pszUser   = argc >= 4 ? argv[3] : NULL;
    PSTR pszPass   = argc >= 5 ? argv[4] : NULL;

    // Initialize wininet.
    hInternet = InternetOpen
    (
        "HttpAuth Sample",            // app name
        INTERNET_OPEN_TYPE_PRECONFIG, // access type
        NULL,                         // proxy server
        0,                            // proxy port
        0                             // flags
    );
    CHECK_ERROR (hInternet, "InternetOpen");

    // Connect to host.
    hConnect = InternetConnect
    (
        hInternet,                    // wininet handle,
        pszHost,                      // host
        0,                            // port
        pszUser,                      // user
        NULL,                         // pass
        INTERNET_SERVICE_HTTP,        // service
        0,                            // flags
        0                             // context
    );
    CHECK_ERROR (hConnect, "InternetConnect");

    if (pszPass)
    {
        // Work around InternetConnect disallowing empty passwords.
        InternetSetOption (hConnect, INTERNET_OPTION_PASSWORD,
            pszPass, lstrlen(pszPass)+1);
    }

    // Create request.
    hRequest = HttpOpenRequest
    (
        hConnect,                     // connect handle
        "GET",                        // request method
        pszObject,                    // object name
        NULL,                         // version
        NULL,                         // referrer
        NULL,                         // accept types
        INTERNET_FLAG_KEEP_CONNECTION // flags: keep-alive
             | INTERNET_FLAG_RELOAD,  // flags: bypass cache
        0                             // context
    );
    CHECK_ERROR (hRequest, "HttpOpenRequest");

resend:

    // Send request.
    fRet = HttpSendRequest
    (
        hRequest,                     // request handle
        "",                           // header string
        0,                            // header length
        NULL,                         // post data
        0                             // post length
    );

    // Handle any authentication dialogs.
    if (NeedAuth(hRequest) && fAllowCustomUI)
    {
        if (DoCustomUI (hConnect, hRequest) == ERROR_INTERNET_FORCE_RETRY)
            goto resend;
    }
    else
    {
        DWORD dwErr;
        dwErr = InternetErrorDlg
        (
            GetDesktopWindow(),
            hRequest,
            fRet ? ERROR_SUCCESS : GetLastError(),
            FLAGS_ERROR_UI_FILTER_FOR_ERRORS  |
                FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS |
                FLAGS_ERROR_UI_FLAGS_GENERATE_DATA,
            NULL
        );

        if (dwErr == ERROR_INTERNET_FORCE_RETRY)
            goto resend;
    }

    // Dump some bytes.
    BYTE bBuf[1024];
    DWORD cbBuf;
    DWORD cbRead;
    cbBuf = sizeof(bBuf);
    _setmode( _fileno( stdout ), _O_BINARY );
    while (InternetReadFile (hRequest, bBuf, cbBuf, &cbRead) && cbRead)
        fwrite (bBuf, 1, cbRead, stdout);

done: // Clean up.

    if (pszErr)
        fprintf (stderr, "Failed on %s, last error %d\n", pszErr, GetLastError());
    if (hRequest)
        InternetCloseHandle (hRequest);
    if (hConnect)
        InternetCloseHandle (hConnect);
    if (hInternet)
        InternetCloseHandle (hInternet);
    return 0;
}

BOOL NeedAuth ( HINTERNET hRequest )

Definition at line 18 of file httpauth.cpp.

{
    // Get status code.
    DWORD dwStatus;
    DWORD cbStatus = sizeof(dwStatus);
    HttpQueryInfo
    (
        hRequest,
        HTTP_QUERY_FLAG_NUMBER | HTTP_QUERY_STATUS_CODE,
        &dwStatus,
        &cbStatus,
        NULL
    );
    fprintf (stderr, "Status: %d\n", dwStatus);

    // Look for 401 or 407.
    DWORD dwFlags;
    switch (dwStatus)
    {
        case HTTP_STATUS_DENIED:
            dwFlags = HTTP_QUERY_WWW_AUTHENTICATE;
            break;
        case HTTP_STATUS_PROXY_AUTH_REQ:
            dwFlags = HTTP_QUERY_PROXY_AUTHENTICATE;
            break;
        default:
            return FALSE;
    }

    // Enumerate the authentication types.
    BOOL fRet;
    char szScheme[64];
    DWORD dwIndex = 0;
    do
    {
        DWORD cbScheme = sizeof(szScheme);
        fRet = HttpQueryInfo
            (hRequest, dwFlags, szScheme, &cbScheme, &dwIndex);
        if (fRet)
            fprintf (stderr, "Found auth scheme: %s\n", szScheme);
    }
        while (fRet);

    return TRUE;
}

Generated on Wed Nov 13 2024 16:54:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/networking/httpdump/HeadDump.cpp File Reference

  • Web
  • networking
  • httpdump
Defines | Functions

HeadDump.cpp File Reference

#include <windows.h>
#include <wininet.h>
#include <iostream>
#include <tchar.h>
#include <strsafe.h>

Go to the source code of this file.

Defines

#define | _tcerr cerr
#define | _tcin cin
#define | _tcout cout
#define | SZTEMP_SIZE 100

Functions

int | _tmain (int argc, TCHAR *argv[])
BOOL | ErrorOut (DWORD dError, TCHAR *szCallingFunc)
BOOL | ParseParams (int argc, TCHAR **argv, TCHAR *szServer, TCHAR *szObject, TCHAR *szProxy, TCHAR *szFile, BOOL &bUi, BOOL &bSSL)
void | Usage (TCHAR *szName)

Define Documentation

#define _tcerr cerr

Definition at line 72 of file HeadDump.cpp.

#define _tcin cin

Definition at line 71 of file HeadDump.cpp.

#define _tcout cout

Definition at line 70 of file HeadDump.cpp.

#define SZTEMP_SIZE 100

Function Documentation

int _tmain | ( | int | argc,
 |  | TCHAR * | argv[]
 | ) |  |

Definition at line 82 of file HeadDump.cpp.

{
 HINTERNET hOpen, hConnect, hReq;
 DWORD  dwSize, dwCode;
 DWORD  dwFlags = INTERNET_FLAG_RELOAD |
                  INTERNET_FLAG_NO_CACHE_WRITE |
                  INTERNET_FLAG_KEEP_CONNECTION;
 CHAR *lpBuffer, szData[51];
 TCHAR szServer[256], szObject [256], szProxy [256], szFile [256];
 BOOL bSSL, bUi;
 HANDLE hFile = NULL;
 INTERNET_PORT dwPort;
 TCHAR szAccept[] = TEXT("*/*");
 LPTSTR AcceptTypes[2]={0};

 AcceptTypes[0]=szAccept;

if (!ParseParams ( argc , argv, szServer, szObject,
                  szProxy,  szFile, bUi, bSSL))
    return (FALSE);

if (szFile [0])
{
  // Open local file
  SECURITY_ATTRIBUTES sa = {sizeof(SECURITY_ATTRIBUTES), NULL, FALSE};
  if  ( !(hFile = CreateFile (szFile,
                            GENERIC_WRITE,
                FILE_SHARE_READ,
                &sa,
                CREATE_ALWAYS,
                FILE_ATTRIBUTE_NORMAL, NULL) ))
  {
    _tcerr << TEXT("Can't open file: ") << szFile << TEXT(" Error: ") << GetLastError() << endl;
    return 0;
  }
}

if (szProxy [0] == NULL)
{
   // No proxy was specified
   if ( !(hOpen = InternetOpen ( TEXT("HeadDump"),  LOCAL_INTERNET_ACCESS , NULL, 0, 0) ) )
   {
       ErrorOut ( GetLastError(), TEXT("InternetOpen"));
       return 0;
   }
 }
 else
 {
   // Use proxy server
   if ( !(hOpen = InternetOpen ( TEXT("HeadDump"),  CERN_PROXY_INTERNET_ACCESS, szProxy, NULL, 0) ) )
   {
        ErrorOut ( GetLastError(), TEXT("InternetOpen"));
       return 0;
   }
 }

if  (bSSL)
{
    dwPort = INTERNET_DEFAULT_HTTPS_PORT;
    dwFlags |= INTERNET_FLAG_SECURE |
               INTERNET_FLAG_IGNORE_CERT_CN_INVALID |
               INTERNET_FLAG_IGNORE_CERT_DATE_INVALID  ;
}
else
    dwPort = INTERNET_INVALID_PORT_NUMBER;

if ( !(hConnect = InternetConnect ( hOpen, szServer , dwPort, TEXT(""),  TEXT(""), INTERNET_SERVICE_HTTP, 0, 0) ) )
{
    ErrorOut (GetLastError(), TEXT("InternetConnect"));
    return 0;
}

if ( !(hReq = HttpOpenRequest (hConnect, TEXT("GET"), szObject, HTTP_VERSION, TEXT(""),
                                (LPCTSTR*) AcceptTypes, dwFlags ,0 )))
{
    ErrorOut (GetLastError(), TEXT("HttpOpenRequest"));
    return 0;
}

again:
if ( !HttpSendRequest (hReq, // handle from HttpOpenRequest
                                             NULL, 0, NULL, 0) )
{
       ErrorOut (GetLastError(), TEXT("HttpSendRequest"));

       dwFlags |= SECURITY_FLAG_IGNORE_UNKNOWN_CA                 |
                           SECURITY_FLAG_IGNORE_REVOCATION        |
                           SECURITY_FLAG_IGNORE_REDIRECT_TO_HTTP  |
                           SECURITY_FLAG_IGNORE_REDIRECT_TO_HTTPS |
                           SECURITY_FLAG_IGNORE_CERT_DATE_INVALID |
                           SECURITY_FLAG_IGNORE_CERT_CN_INVALID;

       if ( !InternetSetOption (hReq,
                                INTERNET_OPTION_SECURITY_FLAGS,
                                &dwFlags,
                                sizeof (dwFlags) ) )
       {
          _tcerr << TEXT("InternetSetOptionFailed: ") << GetLastError() << endl;
          return FALSE;
       }
}

if ( !HttpSendRequest (hReq, NULL, 0, NULL, 0) )
{
       ErrorOut (GetLastError(), TEXT("HttpSendRequest"));
       return FALSE;
}

dwSize = sizeof (DWORD) ;
if ( !HttpQueryInfo (hReq, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, &dwCode, &dwSize, NULL))
{
  ErrorOut (GetLastError(), TEXT("HttpQueryInfo"));
  return FALSE;
}

if ( dwCode == HTTP_STATUS_DENIED || dwCode == HTTP_STATUS_PROXY_AUTH_REQ)
{
    // We have to read all outstanding data on the Internet handle
    // before we can resubmit request. Just discard the data.
    do
  {
    InternetReadFile (hReq, (LPVOID)szData, 50, &dwSize);
  }
  while (dwSize != 0);

    if (!bUi)
    {
        // This is a secure page.
        _tcerr << TEXT("This page is password protected. ") << endl;
      TCHAR szUser[50]=TEXT("");
      TCHAR szPass[50]=TEXT("");

      wcerr << TEXT("User: ");
      _tcin  >> szUser;
      _tcerr << TEXT("Pass: ");
      _tcin  >> szPass;
        if ( !InternetSetOption (hConnect, INTERNET_OPTION_USERNAME, (LPVOID) szUser, lstrlen (szUser) ))
        {
            _tcerr << TEXT("InternetSetOptionFailed: ") << GetLastError() << endl;
            return FALSE;
        }

        if ( !InternetSetOption (hConnect, INTERNET_OPTION_PASSWORD, (LPVOID) szPass, lstrlen (szPass) ))
        {
            _tcerr << TEXT("InternetSetOptionFailed: ") << GetLastError() << endl;
            return FALSE;
        }
        goto again;
    }
    else
    {
        if ( InternetErrorDlg (GetDesktopWindow(),
                               hReq,
                               ERROR_INTERNET_INCORRECT_PASSWORD,
                               FLAGS_ERROR_UI_FILTER_FOR_ERRORS |
                               FLAGS_ERROR_UI_FLAGS_GENERATE_DATA |
                               FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS,
                               NULL) == ERROR_INTERNET_FORCE_RETRY)
            goto again;
    }

}

// First time we will find out the size of the headers.
HttpQueryInfo (hReq,HTTP_QUERY_RAW_HEADERS_CRLF,  NULL, &dwSize, NULL);
lpBuffer =  new char [dwSize + 1 ];

// Now we call HttpQueryInfo again to get the headers.
if (!HttpQueryInfo (hReq,HTTP_QUERY_RAW_HEADERS_CRLF, (LPVOID) lpBuffer,
    &dwSize, NULL))
{
  ErrorOut (GetLastError(), TEXT("HttpQueryInfo"));
  return FALSE;
}
*(lpBuffer + dwSize) = '\0';
cout << lpBuffer << endl;

do
{
  if (!InternetReadFile (hReq, (LPVOID)szData, 50, &dwSize) )
  {
    ErrorOut (GetLastError (), TEXT("InternetReadFile"));
    return FALSE;
  }
  if (dwSize != 0)
  {
    if (!hFile)
    {
      // dump text to the screen
      szData[dwSize] = '\0';
      cout << szData;
    }
    else
    {
      DWORD dwWritten;
      if (!WriteFile(hFile,  szData, dwSize,  &dwWritten,  NULL))
      {
        CloseHandle (hFile);
        _tcerr << TEXT("WriteFile to ") << szFile << TEXT(" failed: ") <<
        GetLastError () << endl;
        return FALSE;
      }
    }
  }
}
while (dwSize);

_tcout << endl;

if (!InternetCloseHandle (hReq) )
{
    ErrorOut (GetLastError (), TEXT("CloseHandle on hReq"));
    return FALSE;
}
if (!InternetCloseHandle (hConnect) )
{
    ErrorOut (GetLastError (), TEXT("CloseHandle on hConnect"));
    return FALSE;
}
if (!InternetCloseHandle (hOpen) )
{
    ErrorOut (GetLastError (), TEXT("CloseHandle on hOpen"));
    return FALSE;
}

delete [] lpBuffer;

if (hFile)
{
  FlushFileBuffers (hFile);
  CloseHandle (hFile);
}
return TRUE;
}

BOOL ErrorOut | ( | DWORD | dError,
 |  | TCHAR * | szCallingFunc
 | ) |  |

Definition at line 337 of file HeadDump.cpp.

{
    #define SZTEMP_SIZE 100
    TCHAR szTemp[SZTEMP_SIZE] = TEXT(""), *szBuffer=NULL, *szBufferFinal = NULL;
    char strName[256]="";
    DWORD  dwIntError , dwLength = 0, dwFinalLength;

    FormatMessage(FORMAT_MESSAGE_FROM_HMODULE,
                GetModuleHandle(TEXT("wininet.dll")),dError,0,
                  (LPTSTR)strName,256,NULL);

    StringCchPrintf( szTemp, SZTEMP_SIZE, TEXT("%s error code: %d\nMessage: %s\n"),
                 szCallFunc, dError, strName);

  if (dError == ERROR_INTERNET_EXTENDED_ERROR)
  {
    InternetGetLastResponseInfo (&dwIntError, NULL, &dwLength);
    if (dwLength)
    {
      if ( !(szBuffer = (TCHAR *) LocalAlloc ( LPTR,  dwLength) ) )
      {
        StringCchCat(szTemp, SZTEMP_SIZE, TEXT ( "Unable to allocate memory to display Internet error code. Error code: "));
        StringCchCat(szTemp, SZTEMP_SIZE, _itot(GetLastError(), szBuffer, 10));
        StringCchCat(szTemp, SZTEMP_SIZE, TEXT ("\n") );
        _tcerr << szTemp << endl;
        return FALSE;
      }
      if (!InternetGetLastResponseInfo (&dwIntError, (LPTSTR) szBuffer, &dwLength))
      {
        StringCchCat(szTemp, SZTEMP_SIZE, TEXT ( "Unable to get Internet error. Error code: ") );
        StringCchCat(szTemp, SZTEMP_SIZE, _itot (GetLastError(), szBuffer, 10));
        StringCchCat(szTemp, SZTEMP_SIZE, TEXT ("\n") );
        _tcerr << szTemp << endl;
        return FALSE;
      }

      size_t sizeBuffer;
      size_t sizeTemp;
      if( FAILED(StringCchLength( szBuffer, dwLength, &sizeBuffer ) )||
        FAILED(StringCchLength( szTemp, SZTEMP_SIZE, &sizeTemp ) ) )
      {
        _tcerr << TEXT("Unable to determine buffer sizes.") << endl;
        return FALSE;
      }

      dwFinalLength = sizeBuffer + sizeTemp + 1;
      if ( !(szBufferFinal = (TCHAR *) LocalAlloc ( LPTR,  dwFinalLength)))
      {
        StringCchCat(szTemp, SZTEMP_SIZE, TEXT ( "Unable to allocate memory. Error code: ") );
        StringCchCat(szTemp, SZTEMP_SIZE, _itot (GetLastError(), szBuffer, 10));
        StringCchCat(szTemp, SZTEMP_SIZE, TEXT ("\n") );
        _tcerr << szTemp << endl;
        return FALSE;
      }
      StringCchCopy(szBufferFinal, dwFinalLength, szTemp);
      StringCchCat(szBufferFinal, dwFinalLength, szBuffer);
      LocalFree (szBuffer);
      _tcerr <<  szBufferFinal  << endl;
      LocalFree (szBufferFinal);
    }
  }
  else
    _tcerr << szTemp << endl;

    return TRUE;
}

BOOL ParseParams | ( | int | argc,
 |  | TCHAR ** | argv,
 |  | TCHAR * | szServer,
 |  | TCHAR * | szObject,
 |  | TCHAR * | szProxy,
 |  | TCHAR * | szFile,
 |  | BOOL & | bUi,
 |  | BOOL & | bSSL
 | ) |  |

Definition at line 405 of file HeadDump.cpp.

{
    int i = 1;
    BOOL bServer = FALSE;

    szProxy[0]  = NULL, bUi = FALSE, bSSL = FALSE, szFile[0]  = NULL;
    StringCchCopy(szObject, 256, TEXT(""));

    while (i < argc)
    {
       if ( *argv[i] != '-')
       {
           Usage (argv[0]);
           return FALSE;
       }
       switch (argv[i][1])
       {
           case 'H':
           case 'h':
              StringCchCopy(szServer, 256, argv[i+1]);
              i += 2;
              bServer = TRUE;
           break;
           case 'o':
           case 'O':
              StringCchCopy(szObject, 256, argv[i+1]);
              i += 2;
           break;

           case 'p':
           case 'P':
              StringCchCopy(szProxy, 256, argv[i+1]);
              i += 2;
           break;

           case 'u':
           case 'U':
              bUi = TRUE;
              i++;
           break;

           case 's':
           case 'S':
              bSSL = TRUE;
              i++;
           break;

           case 'f':
           case 'F':
              StringCchCopy(szFile, 256, argv[i+1]);
              i += 2;
           break;

       case '?':
         Usage (argv[0]);
         return FALSE;
       break;
       default:
           _tcerr << TEXT("Invalid command line argument: ")<< argv[i] << endl;
           Usage (argv[0]);
           return FALSE;
        }
    }
    if ( bServer )
        return TRUE;
    else
    {
        Usage(argv[0]);
        return FALSE;
    }
}

void Usage ( TCHAR * szName )

Definition at line 479 of file HeadDump.cpp.

{
    _tcerr << TEXT("Usage: " << szName <<" -h host [-o object] [-p proxy] [-u] [-s] [-?] [-f file]") << endl;
    _tcerr << TEXT("\t-h host is a HTTP server such as www.server.com") << endl;
    _tcerr << TEXT("\t-p proxy is optional proxy in form: http://proxy:80") << endl;
    _tcerr << TEXT("\t-o object is optional document to GET in form: /foobar.htm") << endl;
    _tcerr << TEXT("\t-u use this flag to bring user name and password UI ") << endl;
    _tcerr << TEXT("\t-f save remote object as local file ") << endl;
    _tcerr << TEXT("\t-? get help ") << endl;
    _tcerr << TEXT("\t-s use SSL ") << endl;
}

Generated on Wed Nov 13 2024 16:54:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/winhttp/asyncdemocomplete/AsyncDemo.cpp File Reference

  • Web
  • winhttp
  • asyncdemocomplete
Classes | Defines | Functions | Variables

AsyncDemo.cpp File Reference

#include <windows.h>
#include <winhttp.h>
#include <stdio.h>
#include "resource.h"

Go to the source code of this file.

Classes

struct | REQUEST_CONTEXT

Defines

#define | CASE_OF(constant) case constant: return (L# constant)
#define | UNICODE

Functions

void __stdcall | AsyncCallback (HINTERNET, DWORD_PTR, DWORD, LPVOID, DWORD)
BOOL CALLBACK | AsyncDialog (HWND hX, UINT message, WPARAM wParam, LPARAM lParam)
void | Cleanup (REQUEST_CONTEXT *cpContext)
LPCWSTR | GetApiErrorString (DWORD dwResult)
BOOL | Header (REQUEST_CONTEXT *cpContext)
BOOL | QueryData (REQUEST_CONTEXT *cpContext)
BOOL | ReadData (REQUEST_CONTEXT *cpContext)
BOOL | SendRequest (REQUEST_CONTEXT *cpContext, LPWSTR szURL)
void | TransferAndDeleteBuffers (REQUEST_CONTEXT *cpContext, LPSTR lpReadBuffer, DWORD dwBytesRead)
int WINAPI | WinMain (HINSTANCE hThisInst, HINSTANCE hPrevInst, LPSTR lpszArgs, int nWinMode)

Variables

CRITICAL_SECTION | g_CallBackCritSec
HINTERNET | hSession

Define Documentation

#define CASE_OF ( constant ) case constant: return (L# constant)

Definition at line 47 of file AsyncDemo.cpp.

#define UNICODE

Definition at line 9 of file AsyncDemo.cpp.

Function Documentation

void __stdcall AsyncCallback | ( | HINTERNET | hInternet,
 |  | DWORD_PTR | dwContext,
 |  | DWORD | dwInternetStatus,
 |  | LPVOID | lpvStatusInformation,
 |  | DWORD | dwStatusInformationLength
 | ) |  |

Definition at line 355 of file AsyncDemo.cpp.

{
    REQUEST_CONTEXT *cpContext;
    WCHAR szBuffer[256];
    cpContext = (REQUEST_CONTEXT*)dwContext;
    WINHTTP_ASYNC_RESULT *pAR;

    if (cpContext == NULL)
    {
        // this should not happen, but we are being defensive here
        return;
    }

    szBuffer[0] = 0;

    // Create a string that reflects the status flag.
    switch (dwInternetStatus)
    {
        case WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE:
            swprintf(szBuffer,L"%s: SENDREQUEST_COMPLETE (%d)",
                cpContext->szMemo, dwStatusInformationLength);

            // Prepare the request handle to receive a response.
            if (WinHttpReceiveResponse( cpContext->hRequest, NULL) == FALSE)
            {
                Cleanup(cpContext);
            }
            break;
        case WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE:
            swprintf(szBuffer,L"%s: HEADERS_AVAILABLE (%d)",
                cpContext->szMemo, dwStatusInformationLength);
            Header( cpContext);

            // Initialize the buffer sizes.
            cpContext->dwSize = 0;
            cpContext->dwTotalSize = 0;

            // Begin downloading the resource.
            if (QueryData( cpContext ) == FALSE)
            {
                Cleanup(cpContext);
            }
            break;
        case WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE:
            swprintf(szBuffer,L"%s: DATA_AVAILABLE (%d)",
                cpContext->szMemo, dwStatusInformationLength);

            cpContext->dwSize = *((LPDWORD)lpvStatusInformation);

            // If there is no data, the process is complete.
            if (cpContext->dwSize == 0)
            {
                // All of the data has been read.  Display the data.
                if (cpContext->dwTotalSize)
                {
                    // Convert the final context buffer to wide characters,
                    // and display.
                    LPWSTR lpWideBuffer = new WCHAR[cpContext->dwTotalSize + 1];
                    MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED,
                                         cpContext->lpBuffer,
                                         cpContext->dwTotalSize,
                                         lpWideBuffer,
                                         cpContext->dwTotalSize);
                    lpWideBuffer[cpContext->dwTotalSize] = 0;
                    /* note: in the case of binary data, only data upto the first null will be displayed */
                    SetDlgItemText( cpContext->hWindow, cpContext->nResource,
                                    lpWideBuffer);

                    // Delete the remaining data buffers.
                    delete [] lpWideBuffer;
                    delete [] cpContext->lpBuffer;
                    cpContext->lpBuffer = NULL;
                }

                // Close the request and connect handles for this context.
                Cleanup(cpContext);

            }
            else
                // Otherwise, read the next block of data.
                if (ReadData( cpContext ) == FALSE)
                {
                    Cleanup(cpContext);
                }
            break;
        case WINHTTP_CALLBACK_STATUS_READ_COMPLETE:
            swprintf(szBuffer,L"%s: READ_COMPLETE (%d)",
                cpContext->szMemo, dwStatusInformationLength);

            // Copy the data and delete the buffers.

            if (dwStatusInformationLength != 0)
            {
                TransferAndDeleteBuffers(cpContext, (LPSTR) lpvStatusInformation, dwStatusInformationLength);

                // Check for more data.
                if (QueryData(cpContext) == FALSE)
                {
                    Cleanup(cpContext);
                }
            }
            break;
        case WINHTTP_CALLBACK_STATUS_REDIRECT:
            swprintf(szBuffer,L"%s: REDIRECT (%d)",
                cpContext->szMemo, dwStatusInformationLength);
            break;
        case WINHTTP_CALLBACK_STATUS_REQUEST_ERROR:
            pAR = (WINHTTP_ASYNC_RESULT *)lpvStatusInformation;
            swprintf( szBuffer,L"%s: REQUEST_ERROR - error %d, result %s",
                      cpContext->szMemo, pAR->dwError,
                      GetApiErrorString(pAR->dwResult));

            Cleanup(cpContext);
            break;
        default:
            swprintf(szBuffer,L"%s: Unknown/unhandled callback - status %d given",
                cpContext->szMemo, dwInternetStatus);
            break;
    }

    // Add the callback information to the listbox.
    SendDlgItemMessage( cpContext->hWindow, IDC_CBLIST, LB_ADDSTRING, 0,
                        (LPARAM)szBuffer);

}

BOOL CALLBACK AsyncDialog | ( | HWND | hX,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 489 of file AsyncDemo.cpp.

{
    switch(message)
    {
    case WM_INITDIALOG:
        // Set the default web sites.
        SetDlgItemText(hX, IDC_URL1, L"http://www.microsoft.com");
        SetDlgItemText(hX, IDC_URL2, L"http://www.msn.com");

        // Initialize the first context value.
        rcContext1.hWindow = hX;
        rcContext1.nURL = IDC_URL1;
        rcContext1.nHeader = IDC_HEADER1;
        rcContext1.nResource = IDC_RESOURCE1;
        rcContext1.hConnect = 0;
        rcContext1.hRequest = 0;
        rcContext1.lpBuffer = NULL;
        rcContext1.szMemo[0] = 0;

        // Initialize the second context value.
        rcContext2.hWindow = hX;
        rcContext2.nURL = IDC_URL2;
        rcContext2.nHeader = IDC_HEADER2;
        rcContext2.nResource = IDC_RESOURCE2;
        rcContext2.hConnect = 0;
        rcContext2.hRequest = 0;
        rcContext2.lpBuffer = NULL;
        rcContext2.szMemo[0] = 0;

        return TRUE;
  case WM_CLOSE:
        EndDialog(hX,0);
    return TRUE;
    case WM_COMMAND:
        switch(LOWORD(wParam))
        {
            case IDC_EXIT:
                EndDialog(hX,0);
                return TRUE;
            case IDC_DOWNLOAD:
                WCHAR szURL[256];

                // Disable the download button.
                EnableWindow( GetDlgItem(hX, IDC_DOWNLOAD), 0);

                // Reset the edit boxes.
                SetDlgItemText( hX, IDC_HEADER1, NULL );
                SetDlgItemText( hX, IDC_HEADER2, NULL );
                SetDlgItemText( hX, IDC_RESOURCE1, NULL );
                SetDlgItemText( hX, IDC_RESOURCE2, NULL );

                // Obtain the URLs from the dialog box and send the requests.
                GetDlgItemText( hX, IDC_URL1, szURL, 256);
                BOOL fRequest1 = SendRequest(&rcContext1, szURL);

                GetDlgItemText( hX, IDC_URL2, szURL, 256);
                BOOL fRequest2 = SendRequest(&rcContext2, szURL);

                if (!fRequest1 && !fRequest2)
                {
                    // Enable the download button if both requests are failing.
                    EnableWindow( GetDlgItem(hX, IDC_DOWNLOAD), TRUE);
                }

                return (fRequest1 && fRequest2);
        }
    default:
        return FALSE;
    }
}

void Cleanup ( REQUEST_CONTEXT * cpContext )

Definition at line 70 of file AsyncDemo.cpp.

{
    // Set the memo to indicate a closed handle.
    swprintf(cpContext->szMemo, L"Closed");

    if (cpContext->hRequest)
    {
        WinHttpSetStatusCallback(cpContext->hRequest,
                NULL,
                NULL,
                NULL);

        WinHttpCloseHandle(cpContext->hRequest);
    cpContext->hRequest = NULL;
    }

    if (cpContext->hConnect)
    {
        WinHttpCloseHandle(cpContext->hConnect);
    cpContext->hConnect = NULL;
    }

    delete [] cpContext->lpBuffer;
  cpContext->lpBuffer = NULL;

    // note: this function can be called concurrently by differnet threads, therefore any global data
    // reference needs to be protected

    EnterCriticalSection(&g_CallBackCritSec);

    // If both handles are closed, re-enable the download button.
    if ((wcsncmp( rcContext1.szMemo, L"Closed",6)==0) &&
        (wcsncmp( rcContext2.szMemo, L"Closed",6)==0))
    {
        EnableWindow( GetDlgItem(cpContext->hWindow, IDC_DOWNLOAD),1);
    }

    LeaveCriticalSection(&g_CallBackCritSec);

}

LPCWSTR GetApiErrorString ( DWORD dwResult )

Definition at line 49 of file AsyncDemo.cpp.

{
    // Return the error result as a string so that the
    // name of the function causing the error can be displayed.
    switch(dwResult)
    {
        CASE_OF( API_RECEIVE_RESPONSE );
        CASE_OF( API_QUERY_DATA_AVAILABLE );
        CASE_OF( API_READ_DATA );
        CASE_OF( API_WRITE_DATA );
        CASE_OF( API_SEND_REQUEST );
    }
    return L"Unknown function";

}

BOOL Header ( REQUEST_CONTEXT * cpContext )

Definition at line 227 of file AsyncDemo.cpp.

{
    DWORD dwSize=0;
    LPVOID lpOutBuffer = NULL;

    // Set the state memo.
    swprintf(cpContext->szMemo, L"WinHttpQueryHeaders (%d)", cpContext->nURL);

    // Use HttpQueryInfo to obtain the size of the buffer.
    if (!WinHttpQueryHeaders( cpContext->hRequest,
                              WINHTTP_QUERY_RAW_HEADERS_CRLF,
                              WINHTTP_HEADER_NAME_BY_INDEX, NULL, &dwSize, WINHTTP_NO_HEADER_INDEX))
    {
        // An ERROR_INSUFFICIENT_BUFFER is expected because you
        // are looking for the size of the headers.  If any other
        // error is encountered, display error information.
        DWORD dwErr = GetLastError();
        if (dwErr != ERROR_INSUFFICIENT_BUFFER)
        {
            WCHAR  szError[256];
            swprintf( szError, L"%s: Error %d encountered.",
                      cpContext->szMemo, dwErr);
            SetDlgItemText( cpContext->hWindow, cpContext->nResource, szError);
            return FALSE;
        }
    }

    // Allocate memory for the buffer.
    lpOutBuffer = new WCHAR[dwSize];

    // Use HttpQueryInfo to obtain the header buffer.
    if(WinHttpQueryHeaders( cpContext->hRequest,
                            WINHTTP_QUERY_RAW_HEADERS_CRLF,
                            WINHTTP_HEADER_NAME_BY_INDEX, lpOutBuffer, &dwSize, WINHTTP_NO_HEADER_INDEX))
        SetDlgItemText( cpContext->hWindow, cpContext->nHeader,
                        (LPWSTR)lpOutBuffer);

    // Free the allocated memory.
    delete [] lpOutBuffer;

    return TRUE;
}

BOOL QueryData ( REQUEST_CONTEXT * cpContext )

Definition at line 271 of file AsyncDemo.cpp.

{
    // Set the state memo.
    swprintf( cpContext->szMemo, L"WinHttpQueryDataAvailable (%d)",
              cpContext->nURL);

    // Chech for available data.
    if (WinHttpQueryDataAvailable(cpContext->hRequest, NULL) == FALSE)
    {
        // If a synchronous error occured, display the error.  Otherwise
        // the query is successful or asynchronous.
        DWORD dwErr = GetLastError();
        WCHAR  szError[256];
        swprintf( szError, L"%s: Error %d encountered.",
                  cpContext->szMemo, dwErr);
        SetDlgItemText( cpContext->hWindow, cpContext->nResource, szError);
        return FALSE;
    }
    return TRUE;
}

BOOL ReadData ( REQUEST_CONTEXT * cpContext )

Definition at line 323 of file AsyncDemo.cpp.

{
    LPSTR lpOutBuffer = new char[cpContext->dwSize+1];
    ZeroMemory(lpOutBuffer, cpContext->dwSize+1);

    // Set the state memo.
    swprintf( cpContext->szMemo, L"WinHttpReadData (%d)",
              cpContext->nURL);

    // Read the available data.
    if (WinHttpReadData( cpContext->hRequest, (LPVOID)lpOutBuffer,
                          cpContext->dwSize, NULL) == FALSE)
    {
        // If a synchronous error occurred, display the error.  Otherwise
        // the read is successful or asynchronous.
        DWORD dwErr = GetLastError();
        WCHAR  szError[256];
        swprintf( szError, L"%s: Error %d encountered.",
                  cpContext->szMemo, dwErr);
        SetDlgItemText( cpContext->hWindow, cpContext->nResource, szError);
        delete [] lpOutBuffer;
        return FALSE;
    }

    return TRUE;
}

BOOL SendRequest | ( | REQUEST_CONTEXT * | cpContext,
 |  | LPWSTR | szURL
 | ) |  |

Definition at line 114 of file AsyncDemo.cpp.

{
    WCHAR szHost[256];
    DWORD dwOpenRequestFlag = 0;
    URL_COMPONENTS urlComp;
    BOOL fRet = FALSE;

    // Initialize URL_COMPONENTS structure.
    ZeroMemory(&urlComp, sizeof(urlComp));
    urlComp.dwStructSize = sizeof(urlComp);

    // Use allocated buffer to store the Host Name.
    urlComp.lpszHostName        = szHost;
    urlComp.dwHostNameLength    = sizeof(szHost) / sizeof(szHost[0]);

    // Set non zero lengths to obtain pointer to the URL Path.
    /* note: if we threat this pointer as a NULL terminated string
            this pointer will contain Extra Info as well. */
    urlComp.dwUrlPathLength = -1;

    // Crack HTTP scheme.
    urlComp.dwSchemeLength = -1;

    // Set the szMemo string.
    swprintf( cpContext->szMemo, L"WinHttpCrackURL (%d)", cpContext->nURL);

    // Crack the URL.
    if (!WinHttpCrackUrl(szURL, 0, 0, &urlComp))
    {
        goto cleanup;
    }

    // Set the szMemo string.
    swprintf( cpContext->szMemo, L"WinHttpConnect (%d)", cpContext->nURL);

    // Open an HTTP session.
    cpContext->hConnect = WinHttpConnect(hSession, szHost,
                                    urlComp.nPort, 0);
    if (NULL == cpContext->hConnect)
    {
        goto cleanup;
    }

    // Prepare OpenRequest flag
    dwOpenRequestFlag = (INTERNET_SCHEME_HTTPS == urlComp.nScheme) ?
                            WINHTTP_FLAG_SECURE : 0;

    // Set the szMemo string.
    swprintf( cpContext->szMemo, L"WinHttpOpenRequest (%d)", cpContext->nURL);

    // Open a "GET" request.
    cpContext->hRequest = WinHttpOpenRequest(cpContext->hConnect,
                                        L"GET", urlComp.lpszUrlPath,
                                        NULL, WINHTTP_NO_REFERER,
                                        WINHTTP_DEFAULT_ACCEPT_TYPES,
                                        dwOpenRequestFlag);

    if (cpContext->hRequest == 0)
    {
        goto cleanup;
    }

    // Set the szMemo string.
    swprintf( cpContext->szMemo, L"WinHttpSetStatusCallback (%d)", cpContext->nURL);

    // Install the status callback function.
    WINHTTP_STATUS_CALLBACK pCallback = WinHttpSetStatusCallback(cpContext->hRequest,
                            (WINHTTP_STATUS_CALLBACK)AsyncCallback,
                            WINHTTP_CALLBACK_FLAG_ALL_COMPLETIONS |
                            WINHTTP_CALLBACK_FLAG_REDIRECT,
                            NULL);

    // note: On success WinHttpSetStatusCallback returns the previously defined callback function.
    // Here it should be NULL
    if (pCallback != NULL)
    {
        goto cleanup;
    }

    // Set the szMemo string.
    swprintf( cpContext->szMemo, L"WinHttpSendRequest (%d)", cpContext->nURL);

    // Send the request.
    if (!WinHttpSendRequest(cpContext->hRequest,
                        WINHTTP_NO_ADDITIONAL_HEADERS, 0,
                        WINHTTP_NO_REQUEST_DATA, 0, 0,
                        (DWORD_PTR)cpContext))
    {
        goto cleanup;
    }

    fRet = TRUE;

cleanup:

    if (fRet == FALSE)
    {
        WCHAR szError[256];

        // Set the error message.
        swprintf(szError, L"%s failed with error %d", cpContext->szMemo, GetLastError());

        // Cleanup handles.
        Cleanup(cpContext);

        // Display the error message.
        SetDlgItemText(cpContext->hWindow, cpContext->nResource, szError);

    }

    return fRet;
}

void TransferAndDeleteBuffers | ( | REQUEST_CONTEXT * | cpContext,
 |  | LPSTR | lpReadBuffer,
 |  | DWORD | dwBytesRead
 | ) |  |

Definition at line 293 of file AsyncDemo.cpp.

{
    cpContext->dwSize = dwBytesRead;

    if(!cpContext->lpBuffer)
    {
        // If there is no context buffer, start one with the read data.
        cpContext->lpBuffer = lpReadBuffer;
    }
    else
    {
        // Store the previous buffer, and create a new one big
        // enough to hold the old data and the new data.
        LPSTR lpOldBuffer = cpContext->lpBuffer;
        cpContext->lpBuffer = new char[cpContext->dwTotalSize + cpContext->dwSize];

        // Copy the old and read buffer into the new context buffer.
        memcpy(cpContext->lpBuffer, lpOldBuffer, cpContext->dwTotalSize);
        memcpy(cpContext->lpBuffer + cpContext->dwTotalSize, lpReadBuffer, cpContext->dwSize);

        // Free the memory allocated to the old and read buffers.
        delete [] lpOldBuffer;
        delete [] lpReadBuffer;
    }

    // Keep track of the total size.
    cpContext->dwTotalSize += cpContext->dwSize;
}

int WINAPI WinMain | ( | HINSTANCE | hThisInst,
 |  | HINSTANCE | hPrevInst,
 |  | LPSTR | lpszArgs,
 |  | int | nWinMode
 | ) |  |

Definition at line 565 of file AsyncDemo.cpp.

{
    // Create the session handle using the default settings.
    hSession = WinHttpOpen( L"Asynchronous WinHTTP Demo/1.0",
                            WINHTTP_ACCESS_TYPE_DEFAULT_PROXY,
                            WINHTTP_NO_PROXY_NAME,
                            WINHTTP_NO_PROXY_BYPASS,
                            WINHTTP_FLAG_ASYNC);

    // Check to see if the session handle was successfully created.
    if(hSession != NULL)
    {
        InitializeCriticalSection(&g_CallBackCritSec);

        // Show the dialog box.
        DialogBox( hThisInst, MAKEINTRESOURCE(IDD_DIALOG1),
                   HWND_DESKTOP, (DLGPROC)AsyncDialog );

        DeleteCriticalSection(&g_CallBackCritSec);

        // Close the session handle.
        WinHttpCloseHandle(hSession);

    }

    return 0;
}

Variable Documentation

CRITICAL_SECTION g_CallBackCritSec

Definition at line 40 of file AsyncDemo.cpp.

HINTERNET hSession

Definition at line 38 of file AsyncDemo.cpp.

Generated on Wed Nov 13 2024 16:54:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/winhttp/asyncdemocomplete/resource.h File Reference

  • Web
  • winhttp
  • asyncdemocomplete
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_CBLIST 1000
#define | IDC_DOWNLOAD 1001
#define | IDC_EXIT 1002
#define | IDC_HEADER1 1004
#define | IDC_HEADER2 1007
#define | IDC_RESOURCE1 1005
#define | IDC_RESOURCE2 1008
#define | IDC_URL1 1003
#define | IDC_URL2 1006
#define | IDD_DIALOG1 101

Define Documentation

#define IDC_CBLIST 1000

Definition at line 6 of file resource.h.

#define IDC_DOWNLOAD 1001

Definition at line 7 of file resource.h.

#define IDC_EXIT 1002

Definition at line 8 of file resource.h.

#define IDC_HEADER1 1004

Definition at line 10 of file resource.h.

#define IDC_HEADER2 1007

Definition at line 13 of file resource.h.

#define IDC_RESOURCE1 1005

Definition at line 11 of file resource.h.

#define IDC_RESOURCE2 1008

Definition at line 14 of file resource.h.

#define IDC_URL1 1003

Definition at line 9 of file resource.h.

#define IDC_URL2 1006

Definition at line 12 of file resource.h.

#define IDD_DIALOG1 101

Definition at line 5 of file resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/winhttp/asyncdemotutorial/AsyncDemo.cpp File Reference

  • Web
  • winhttp
  • asyncdemotutorial
Classes | Defines | Functions

AsyncDemo.cpp File Reference

#include <windows.h>
#include <winhttp.h>
#include <stdio.h>
#include "resource.h"

Go to the source code of this file.

Classes

struct | REQUEST_CONTEXT

Defines

#define | UNICODE

Functions

void __stdcall | AsyncCallback (HINTERNET hInternet, DWORD dwContext, DWORD dwInternetStatus, LPVOID lpvStatusInformation, DWORD dwStatusInformationLength)
BOOL CALLBACK | AsyncDialog (HWND hX, UINT message, WPARAM wParam, LPARAM lParam)
int WINAPI | WinMain (HINSTANCE hThisInst, HINSTANCE hPrevInst, LPSTR lpszArgs, int nWinMode)

Define Documentation

#define UNICODE

Definition at line 9 of file AsyncDemo.cpp.

Function Documentation

void __stdcall AsyncCallback | ( | HINTERNET | hInternet,
 |  | DWORD | dwContext,
 |  | DWORD | dwInternetStatus,
 |  | LPVOID | lpvStatusInformation,
 |  | DWORD | dwStatusInformationLength
 | ) |  |

Definition at line 45 of file AsyncDemo.cpp.

{
    REQUEST_CONTEXT *cpContext;
    WCHAR szBuffer[256];
    cpContext = (REQUEST_CONTEXT*)dwContext;

    // Create a string that reflects the status flag.
    switch (dwInternetStatus)
    {
        case WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE:
            swprintf(szBuffer,L"%s: DATA_AVAILABLE (%d)",
                cpContext->szMemo, dwStatusInformationLength);
            break;
        case WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE:
            swprintf(szBuffer,L"%s: HEADERS_AVAILABLE (%d)",
                cpContext->szMemo, dwStatusInformationLength);
            break;
        case WINHTTP_CALLBACK_STATUS_INTERMEDIATE_RESPONSE:
            swprintf(szBuffer,L"%s: INTERMEDIATE_RESPONSE (%d)",
                cpContext->szMemo, dwStatusInformationLength);
            break;
        case WINHTTP_CALLBACK_STATUS_READ_COMPLETE:
            swprintf(szBuffer,L"%s: READ_COMPLETE (%d)",
                cpContext->szMemo, dwStatusInformationLength);
            break;
        case WINHTTP_CALLBACK_STATUS_REDIRECT:
            swprintf(szBuffer,L"%s: REDIRECT (%d)",
                cpContext->szMemo, dwStatusInformationLength);
            break;
        case WINHTTP_CALLBACK_STATUS_REQUEST_ERROR:
            swprintf(szBuffer,L"%s: REQUEST_ERROR (%d)",
                cpContext->szMemo, dwStatusInformationLength);
            break;
        case WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE:
            swprintf(szBuffer,L"%s: SENDREQUEST_COMPLETE (%d)",
                cpContext->szMemo, dwStatusInformationLength);
            break;
        default:
            swprintf(szBuffer,L"%s: Unknown callback - status %d given",
                cpContext->szMemo, dwInternetStatus);
            break;
    }

    // Add the callback information to the listbox.
    SendDlgItemMessage( cpContext->hWindow, IDC_CBLIST, LB_ADDSTRING, 0,
                        (LPARAM)szBuffer);
}

BOOL CALLBACK AsyncDialog | ( | HWND | hX,
 |  | UINT | message,
 |  | WPARAM | wParam,
 |  | LPARAM | lParam
 | ) |  |

Definition at line 101 of file AsyncDemo.cpp.

{
    switch(message)
    {
    case WM_INITDIALOG:
        // Set the default web sites.
        SetDlgItemText(hX, IDC_URL1, L"http://www.microsoft.com");
        SetDlgItemText(hX, IDC_URL2, L"http://www.msn.com");

        return TRUE;
    case WM_CLOSE:
        EndDialog(hX,0);
        return TRUE;
    case WM_COMMAND:
        switch(LOWORD(wParam))
        {
            case IDC_EXIT:
                EndDialog(hX,0);
                return TRUE;
            case IDC_DOWNLOAD:
                WCHAR szURL1[256], szURL2[256];

                // Reset the edit boxes.
                SetDlgItemText( hX, IDC_HEADER1, NULL );
                SetDlgItemText( hX, IDC_HEADER2, NULL );
                SetDlgItemText( hX, IDC_RESOURCE1, NULL );
                SetDlgItemText( hX, IDC_RESOURCE2, NULL );

                // Obtain the URLs from the dialog box.
                GetDlgItemText( hX, IDC_URL1, szURL1, 256);
                GetDlgItemText( hX, IDC_URL2, szURL2, 256);

                return TRUE;
        }
    default:
        return FALSE;
    }
}

int WINAPI WinMain | ( | HINSTANCE | hThisInst,
 |  | HINSTANCE | hPrevInst,
 |  | LPSTR | lpszArgs,
 |  | int | nWinMode
 | ) |  |

Definition at line 145 of file AsyncDemo.cpp.

{
    // Show the dialog box.
    DialogBox( hThisInst, MAKEINTRESOURCE(IDD_DIALOG1),
               HWND_DESKTOP, (DLGPROC)AsyncDialog );

    return 0;
}

Generated on Wed Nov 13 2024 16:54:57 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/winhttp/asyncdemotutorial/resource.h File Reference

  • Web
  • winhttp
  • asyncdemotutorial
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_CBLIST 1000
#define | IDC_DOWNLOAD 1001
#define | IDC_EXIT 1002
#define | IDC_HEADER1 1004
#define | IDC_HEADER2 1007
#define | IDC_RESOURCE1 1005
#define | IDC_RESOURCE2 1008
#define | IDC_URL1 1003
#define | IDC_URL2 1006
#define | IDD_DIALOG1 101

Define Documentation

#define IDC_CBLIST 1000

Definition at line 6 of file resource.h.

#define IDC_DOWNLOAD 1001

Definition at line 7 of file resource.h.

#define IDC_EXIT 1002

Definition at line 8 of file resource.h.

#define IDC_HEADER1 1004

Definition at line 10 of file resource.h.

#define IDC_HEADER2 1007

Definition at line 13 of file resource.h.

#define IDC_RESOURCE1 1005

Definition at line 11 of file resource.h.

#define IDC_RESOURCE2 1008

Definition at line 14 of file resource.h.

#define IDC_URL1 1003

Definition at line 9 of file resource.h.

#define IDC_URL2 1006

Definition at line 12 of file resource.h.

#define IDD_DIALOG1 101

Definition at line 5 of file resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/winhttp/retoptions/RetOptions.cpp File Reference

  • Web
  • winhttp
  • retoptions
Functions

RetOptions.cpp File Reference

#include <windows.h>
#include <winhttp.h>
#include <stdio.h>

Go to the source code of this file.

Functions

int main (int argc, char *argv[])

Function Documentation

int main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 14 of file RetOptions.cpp.

{
    HINTERNET hSession;
    HINTERNET hConnect;
    HINTERNET hRequest;
    BOOL httpResult;
    DWORD data;
    DWORD dwSize = sizeof(DWORD);
    LPWSTR pwszURL;

    // Print a description of the sample.
    printf("This sample demonstrates the process for retrieving WinHTTP\n");
    printf("options programmatically from a C/C++ application. WinHTTP\n");
    printf("application programming interface (API) functions are used to\n");
    printf("determine the default connect time-out value and to find the\n");
    printf("current URL after an HTTP request is redirected.\n\n");

    // Use WinHttpOpen to obtain a session handle.
    hSession = WinHttpOpen(  L"A WinHTTP Example Program/1.0",
                             WINHTTP_ACCESS_TYPE_DEFAULT_PROXY,
                             WINHTTP_NO_PROXY_NAME,
                             WINHTTP_NO_PROXY_BYPASS, 0);

    // Use WinHttpQueryOption to retrieve Internet options.
    httpResult = WinHttpQueryOption( hSession, WINHTTP_OPTION_CONNECT_TIMEOUT,
                                     &data, &dwSize);
    if (httpResult)
        printf("Connect time-out:\t%u ms\n",data);

    // Use WinHttpConnect to specify an HTTP server.
    hConnect = WinHttpConnect( hSession, L"msdn.microsoft.com",
                               INTERNET_DEFAULT_HTTP_PORT, 0);

    // Open and Send a Request Header.
    hRequest = WinHttpOpenRequest( hConnect, L"GET",
                         L"/downloads/samples/internet/winhttp/retoptions/redirect.asp",
                         NULL, WINHTTP_NO_REFERER,
                         WINHTTP_DEFAULT_ACCEPT_TYPES, 0);
    httpResult = WinHttpSendRequest( hRequest, WINHTTP_NO_ADDITIONAL_HEADERS,
                                     0, WINHTTP_NO_REQUEST_DATA, 0, 0, 0);
    httpResult = WinHttpReceiveResponse( hRequest, NULL);

    // Use WinHttpQueryOption again, this time to obtain a buffer size.
    httpResult = WinHttpQueryOption( hRequest, WINHTTP_OPTION_URL,
                                     NULL, &dwSize);
    pwszURL = new WCHAR[dwSize/sizeof(WCHAR)];

    // Use WinHttpQueryOption to retrieve Internet options.
    httpResult = WinHttpQueryOption( hRequest, WINHTTP_OPTION_URL,
                                     (void *)pwszURL, &dwSize);
    printf("Redirected URL:\t\t%S\n",pwszURL);

    // Free the allocated memory.
    delete [] pwszURL;

    // When finished, release the hRequest handle.
    httpResult = WinHttpCloseHandle(hRequest);
    if (!httpResult)
        printf("Could not close the hRequest handle.\n");

    // When finished, release the hConnect handle.
    httpResult = WinHttpCloseHandle(hConnect);
    if (!httpResult)
        printf("Could not close the hConnect handle.\n");

    // When finished, release the hSession handle.
    httpResult = WinHttpCloseHandle(hSession);
    if (!httpResult)
        printf("Could not close the hSession handle.\n");

    return 0;
}

Generated on Wed Nov 13 2024 16:54:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/winhttp/setoptions/SetOptions.cpp File Reference

  • Web
  • winhttp
  • setoptions
Functions

SetOptions.cpp File Reference

#include <windows.h>
#include <winhttp.h>
#include <stdio.h>

Go to the source code of this file.

Functions

int main (int argc, char *argv[])

Function Documentation

int main | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 13 of file SetOptions.cpp.

                                 {

    HINTERNET hSession;
    BOOL httpResult;
    DWORD dwSize    = sizeof(DWORD);
    DWORD dwData = 0;
    DWORD dwNewData = 50000;

    // Print a description for the user.
    printf("This sample demonstrates the process for setting WinHTTP options\n");
    printf("programmatically from a C/C++ application. WinHTTP application\n");
    printf("programming interface (API) functions are used to change the connect\n");
    printf("time-out value.\n\n");

    // Use WinHttpOpen to obtain a session handle.
    hSession = WinHttpOpen(  L"A WinHTTP Example Program/1.0",
                             WINHTTP_ACCESS_TYPE_DEFAULT_PROXY,
                             WINHTTP_NO_PROXY_NAME,
                             WINHTTP_NO_PROXY_BYPASS, 0);

    // Use WinHttpQueryOption to retrieve the connect time-out.
    httpResult = WinHttpQueryOption( hSession, WINHTTP_OPTION_CONNECT_TIMEOUT,
                                     &dwData, &dwSize);
    printf("Old Connect Time-Out: %u\n", dwData);

    // Use WinHttpSetOption to set a new connect time-out.
    httpResult = WinHttpSetOption( hSession, WINHTTP_OPTION_CONNECT_TIMEOUT,
                                   &dwNewData, dwSize);

    // Use WinHttpQueryOption to verify the new connect time-out.
    httpResult = WinHttpQueryOption( hSession, WINHTTP_OPTION_CONNECT_TIMEOUT,
                                     &dwData, &dwSize);
    printf("New Connect Time-Out: %u\n", dwData);

    // When finished, release the HINTERNET handle.
    httpResult = WinHttpCloseHandle(hSession);
    if (!httpResult)
        printf("Could not close the HINTERNET handle.\n");

    return 0;
}

Generated on Wed Nov 13 2024 16:54:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/winhttp/WinHttpAsyncSample/browser.cpp File Reference

  • Web
  • winhttp
  • WinHttpAsyncSample
Functions

browser.cpp File Reference

#include <windows.h>
#include <winhttp.h>
#include "defs.h"
#include "browser.h"
#include <stdio.h>

Go to the source code of this file.

Functions

void CALLBACK RequesterStatusCallback (HINTERNET hInternet, DWORD_PTR dwContext, DWORD dwInternetStatus, LPVOID lpvStatusInformation, DWORD dwStatusInformationLength)

Function Documentation

void CALLBACK RequesterStatusCallback | ( | HINTERNET | hInternet,
 |  | DWORD_PTR | dwContext,
 |  | DWORD | dwInternetStatus,
 |  | LPVOID | lpvStatusInformation,
 |  | DWORD | dwStatusInformationLength
 | ) |  |

Definition at line 467 of file browser.cpp.

{
    ASYNC_REQUESTER* pRequester = (ASYNC_REQUESTER*)dwContext;
    ASSERT(pRequester != NULL);

    ASSERT(pRequester->m_hRequest == hInternet);

    switch(dwInternetStatus)
    {
        case WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE:
            pRequester->OnSendRequestComplete();
            break;
        case WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE:
            pRequester->OnHeadersAvailable();
            break;
        case WINHTTP_CALLBACK_STATUS_READ_COMPLETE:
            pRequester->OnReadComplete(dwStatusInformationLength);
            break;
        case WINHTTP_CALLBACK_STATUS_REQUEST_ERROR:
            pRequester->OnRequestError((LPWINHTTP_ASYNC_RESULT)lpvStatusInformation);
            break;
        case WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING:
            pRequester->OnHandleClosing(hInternet);
            pRequester->m_hRequest = NULL;
            break;
        default:
            ;
    }
}

Generated on Wed Nov 13 2024 16:54:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/winhttp/WinHttpAsyncSample/browser.h File Reference

  • Web
  • winhttp
  • WinHttpAsyncSample
Classes | Typedefs

browser.h File Reference

Go to the source code of this file.

Classes

class | ASYNC_REQUESTER
struct | BROWSER_CONFIG
class | SIMPLE_BROWSER

Typedefs

typedef struct BROWSER_CONFIG * | P_BROWSER_CONFIG

Typedef Documentation

typedef struct BROWSER_CONFIG * P_BROWSER_CONFIG
Generated on Wed Nov 13 2024 16:54:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/winhttp/WinHttpAsyncSample/defs.h File Reference

  • Web
  • winhttp
  • WinHttpAsyncSample
Defines | Functions

defs.h File Reference

Go to the source code of this file.

Defines

#define | ASSERT(fVal) if (!(fVal)) DebugBreak();
#define | CONTAINING_RECORD(address, type, field) ((type *)((PCHAR)(address) - (ULONG_PTR)(&((type *)0)->field)))
#define | InitializeListHead(ListHead)
#define | InsertHeadList(ListHead, Entry)
#define | InsertTailList(ListHead, Entry)
#define | IsListEmpty(ListHead) ((ListHead)->Flink == (ListHead))
#define | RemoveEntryList(Entry)
#define | RemoveHeadList(ListHead)
#define | RemoveTailList(ListHead)

Functions

BOOL | IsNodeOnList (PLIST_ENTRY ListHead, PLIST_ENTRY Entry)

Define Documentation

#define ASSERT ( fVal ) if (!(fVal)) DebugBreak();

Definition at line 7 of file defs.h.

#define CONTAINING_RECORD | ( | address,
 |  | type,
 |  | field |
 | ) |  | ((type *)((PCHAR)(address) - (ULONG_PTR)(&((type *)0)->field)))

Definition at line 22 of file defs.h.

#define InitializeListHead ( ListHead )
Value:
(\
    (ListHead)->Flink = (ListHead)->Blink = (ListHead))

Definition at line 35 of file defs.h.

#define InsertHeadList | ( | ListHead,
 |  | Entry
 | ) |
Value:
{\
    PLIST_ENTRY _EX_Flink;\
    PLIST_ENTRY _EX_ListHead;\
    _EX_ListHead = (ListHead);\
    _EX_Flink = _EX_ListHead->Flink;\
    (Entry)->Flink = _EX_Flink;\
    (Entry)->Blink = _EX_ListHead;\
    _EX_Flink->Blink = (Entry);\
    _EX_ListHead->Flink = (Entry);\
    }

Definition at line 113 of file defs.h.

#define InsertTailList | ( | ListHead,
 |  | Entry
 | ) |
Value:
{\
    PLIST_ENTRY _EX_Blink;\
    PLIST_ENTRY _EX_ListHead;\
    _EX_ListHead = (ListHead);\
    _EX_Blink = _EX_ListHead->Blink;\
    (Entry)->Flink = _EX_ListHead;\
    (Entry)->Blink = _EX_Blink;\
    _EX_Blink->Flink = (Entry);\
    _EX_ListHead->Blink = (Entry);\
    }

Definition at line 94 of file defs.h.

#define IsListEmpty ( ListHead ) ((ListHead)->Flink == (ListHead))

Definition at line 45 of file defs.h.

#define RemoveEntryList ( Entry )
Value:
{\
    PLIST_ENTRY _EX_Blink;\
    PLIST_ENTRY _EX_Flink;\
    _EX_Flink = (Entry)->Flink;\
    _EX_Blink = (Entry)->Blink;\
    _EX_Blink->Flink = _EX_Flink;\
    _EX_Flink->Blink = _EX_Blink;\
    }

Definition at line 77 of file defs.h.

#define RemoveHeadList ( ListHead )
Value:
(ListHead)->Flink;\
    {RemoveEntryList((ListHead)->Flink)}

Definition at line 55 of file defs.h.

#define RemoveTailList ( ListHead )
Value:
(ListHead)->Blink;\
    {RemoveEntryList((ListHead)->Blink)}

Definition at line 66 of file defs.h.

Function Documentation

BOOL IsNodeOnList | ( | PLIST_ENTRY | ListHead,
 |  | PLIST_ENTRY | Entry
 | ) |  |

Definition at line 23 of file msputils.cpp.

{
    PLIST_ENTRY pCurrent = ListHead;
    while(pCurrent->Flink != Entry)
    {
        pCurrent = pCurrent->Flink;
        if(pCurrent == 0)
        {
            return FALSE;
        }
    }
    return TRUE;
}

Generated on Wed Nov 13 2024 16:54:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/winhttp/WinHttpAsyncSample/SimpleBrowser.cpp File Reference

  • Web
  • winhttp
  • WinHttpAsyncSample
Functions | Variables

SimpleBrowser.cpp File Reference

#include <windows.h>
#include <winhttp.h>
#include "defs.h"
#include "browser.h"
#include <stdio.h>

Go to the source code of this file.

Functions

BOOL WINAPI | ConsoleEventHandler (DWORD dwCtrlType)
int __cdecl | main ()

Variables

BROWSER_CONFIG BrowserConfigs []
SIMPLE_BROWSER * | BrowserSessions [sizeof(BrowserConfigs)/sizeof(BROWSER_CONFIG)]

Function Documentation

BOOL WINAPI ConsoleEventHandler ( DWORD dwCtrlType )

Definition at line 65 of file SimpleBrowser.cpp.

{
    fprintf(stdout, "Ctrl-C detected...\n");

    UINT nNumBrowserSessions = sizeof(BrowserConfigs) / sizeof (BROWSER_CONFIG);

    for (UINT i = 0; i < nNumBrowserSessions; ++i)
    {
        if (BrowserSessions[i])
        {
            BrowserSessions[i]->Close();
            delete BrowserSessions[i];
            BrowserSessions[i] = NULL;
        }
    }

    ::ExitProcess(0);

    return TRUE;
}

int __cdecl main ( void )

Definition at line 88 of file SimpleBrowser.cpp.

{
    // first mask off Ctrl-C so that we can initialize w/o worrying being interrupted
    ::SetConsoleCtrlHandler(NULL, TRUE);

    UINT nNumBrowserSessions = sizeof(BrowserConfigs) / sizeof (BROWSER_CONFIG);

    for (UINT i = 0; i < nNumBrowserSessions; ++i)
    {
        SIMPLE_BROWSER* pBrowser = new SIMPLE_BROWSER(i);
        if (pBrowser)
        {
            if (pBrowser->Open(&BrowserConfigs[i]) == TRUE)
            {
                BrowserSessions[i] = pBrowser;
            }
            else
            {
                delete pBrowser;
            }
        }
    }

    // now that things are started let's unmask Ctrl-C and register a custom Ctrl handler
    // to faciliate gracefully shutdown
    ::SetConsoleCtrlHandler(NULL, FALSE);
    ::SetConsoleCtrlHandler(ConsoleEventHandler, TRUE);

    ::Sleep(INFINITE);

    return 0;
}

Variable Documentation

BROWSER_CONFIG BrowserConfigs[]

Definition at line 17 of file SimpleBrowser.cpp.

SIMPLE_BROWSER* BrowserSessions[sizeof(BrowserConfigs)/sizeof(BROWSER_CONFIG)]

Definition at line 60 of file SimpleBrowser.cpp.

Generated on Wed Nov 13 2024 16:54:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/winhttp/WinHttpFormSubmitSample/WinHttpFormSubmitSample.cpp File Reference

  • Web
  • winhttp
  • WinHttpFormSubmitSample
Functions

WinHttpFormSubmitSample.cpp File Reference

#include "stdio.h"
#include "tchar.h"
#include "windows.h"
#include "winhttp.h"

Go to the source code of this file.

Functions

int | _tmain (int argc, _TCHAR *argv[])
BOOL | GetFileHandleAndSize (LPWSTR szFilename, OUT HANDLE *pHandle, OUT DWORD *pdwSize)
BOOL | WinHttpFormSubmitSample (LPCWSTR szServer, INTERNET_PORT dwPort, LPWSTR szPath, BOOL fUseSSL, LPWSTR szPostFilename)

Function Documentation

int _tmain | ( | int | argc,
 |  | _TCHAR * | argv[]
 | ) |  |

Definition at line 18 of file WinHttpFormSubmitSample.cpp.

{
    URL_COMPONENTS urlComponents;
    LPWSTR szUrl = argv[1];
    LPWSTR szFilename = argv[2];
    BOOL fShowHelp = FALSE;
    LPWSTR szAllocHost = NULL;
    LPWSTR szAllocPath = NULL;

    if (argc != 3)
    {
        fShowHelp = TRUE;
        goto done;
    }

    //  We call WinHttpCrackUrl to get the server, path, and scheme of the request.
    memset( &urlComponents, 0, sizeof(urlComponents));
    urlComponents.dwStructSize = sizeof(urlComponents);
    urlComponents.dwHostNameLength = 1;
    urlComponents.dwUrlPathLength = 1;

    if (!WinHttpCrackUrl( szUrl, 0, NULL, &urlComponents))
    {
        printf("\n\nThere was a problem with the URL given, \"%S\".", szUrl);
        fShowHelp = TRUE;
        goto done;
    }

    szAllocHost = new WCHAR[urlComponents.dwHostNameLength+1];
    szAllocPath = new WCHAR[urlComponents.dwUrlPathLength+1];

    if (szAllocHost == NULL
        || szAllocPath == NULL)
    {
        SetLastError(ERROR_OUTOFMEMORY);
        goto done;
    }

    memcpy(szAllocHost, urlComponents.lpszHostName,
           urlComponents.dwHostNameLength*sizeof(WCHAR));
    szAllocHost[urlComponents.dwHostNameLength] = L'\0';
    memcpy(szAllocPath, urlComponents.lpszUrlPath,
           urlComponents.dwUrlPathLength*sizeof(WCHAR));
    szAllocPath[urlComponents.dwUrlPathLength] = L'\0';

    if ((DWORD)-1 == GetFileAttributes(szFilename))
    {
        printf("\n\nThe specified file, \"%S\", does not exist.", szFilename);
        fShowHelp = TRUE;
        goto done;
    }

    if (!WinHttpFormSubmitSample(
          szAllocHost, urlComponents.nPort, szAllocPath,
          (urlComponents.nScheme == INTERNET_SCHEME_HTTPS) ? TRUE : FALSE, szFilename))
    {
        goto done;
    }

    SetLastError(NO_ERROR);
done:
    if (GetLastError() != NO_ERROR)
    {
        DWORD dwLastError = GetLastError();
        printf("\n\nFormSubmit failed with error code %i", dwLastError);
        fShowHelp = TRUE;
    }

    if (fShowHelp)
    {
        printf(
            "\n\n  Proper usage of this example is \"FormSubmit <url> <filename>\",\n"
            "Where <url> is a target HTTP URL and <filename> is the name of a file\n"
            "with the form submit contents.  Please see Section 8.2.1 \"Forms Submission\"\n"
            "of RFC 1866 (http://www.ietf.org/rfc/rfc1866.txt) for a description of valid\n"
            "form submit contents.");
    }

    if (szAllocPath != NULL)
        delete [] szAllocPath;

    if (szAllocHost != NULL)
        delete [] szAllocHost;

    printf("\n\n");
    return 0;
}

BOOL GetFileHandleAndSize | ( | LPWSTR | szFilename,
 |  | OUT HANDLE * | pHandle,
 |  | OUT DWORD * | pdwSize
 | ) |  |

Definition at line 108 of file WinHttpFormSubmitSample.cpp.

{
    BOOL returnValue = FALSE;
    HANDLE hFile = INVALID_HANDLE_VALUE;
    LARGE_INTEGER liSize;
    liSize.LowPart = 0;
    liSize.HighPart = 0;

    hFile = CreateFile(szFilename, GENERIC_READ, FILE_SHARE_READ, NULL,
                       OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);

    if (hFile == INVALID_HANDLE_VALUE)
        goto done;

    if (!GetFileSizeEx(hFile, &liSize))
        goto done;

    if (liSize.HighPart != 0
        || liSize.LowPart > 0x7FFFFFFF)
    {
        //  Lets not try to send anything larger than 2 gigs
        SetLastError(ERROR_OPEN_FAILED);
    }

    returnValue = TRUE;
done:

    if (returnValue)
    {
        *pHandle = hFile;
        *pdwSize = liSize.LowPart;
        return TRUE;
    }
    else
    {
        if (hFile != INVALID_HANDLE_VALUE)
            CloseHandle(hFile);

        return FALSE;
    }
}

BOOL WinHttpFormSubmitSample | ( | LPCWSTR | szServer,
 |  | INTERNET_PORT | dwPort,
 |  | LPWSTR | szPath,
 |  | BOOL | fUseSSL,
 |  | LPWSTR | szPostFilename
 | ) |  |

Definition at line 151 of file WinHttpFormSubmitSample.cpp.

{
    DWORD dwStatusCode = 0;
    DWORD dwSize = sizeof(DWORD);
    DWORD dwTemp, dwTemp2;
    BOOL  bResults = FALSE;
    BOOL returnValue = FALSE;

    HANDLE hFile = INVALID_HANDLE_VALUE;
    DWORD dwFileSize = 0;
    BYTE byteBuffer[2048];

    HINTERNET  hSession = NULL,
               hConnect = NULL,
               hRequest = NULL;

    static const WCHAR szContentType[] = L"Content-Type: application/x-www-form-urlencoded\r\n";

    // First make sure the file we want to send is available.
    if (!GetFileHandleAndSize(szPostFilename, &hFile, &dwFileSize))
        goto done;

    // Use WinHttpOpen to obtain a session handle.
    hSession = WinHttpOpen( L"WinHttpFormSubmitSample",
                            WINHTTP_ACCESS_TYPE_DEFAULT_PROXY,
                            WINHTTP_NO_PROXY_NAME,
                            WINHTTP_NO_PROXY_BYPASS, 0);
    if (hSession == NULL)
        goto done;

    // Specify an HTTP server.
    hConnect = WinHttpConnect( hSession, szServer, dwPort, 0);
    if (hConnect == NULL)
        goto done;

    // Create an HTTP request handle.
    hRequest = WinHttpOpenRequest( hConnect, L"POST", szPath,
               NULL, WINHTTP_NO_REFERER, WINHTTP_DEFAULT_ACCEPT_TYPES,
               fUseSSL ? WINHTTP_FLAG_SECURE : 0);
    if (hRequest == NULL)
        goto done;

    //  Add the "Content-Type" header

    if (!WinHttpAddRequestHeaders(hRequest, szContentType, (DWORD)-1,
               WINHTTP_ADDREQ_FLAG_ADD & WINHTTP_ADDREQ_FLAG_REPLACE))
        goto done;

    bResults = WinHttpSendRequest( hRequest,
                                   WINHTTP_NO_ADDITIONAL_HEADERS, 0,
                                   NULL, 0, dwFileSize, 0);
    if (!bResults)
        goto done;

    while (dwFileSize > 0)
    {
        if (!ReadFile(hFile, byteBuffer, sizeof(byteBuffer), &dwTemp, NULL))
            goto done;

        if (dwTemp == 0)
        {
            dwFileSize = 0;
            continue;
        }
        else if (dwTemp > dwFileSize)
        {
            // unexpectedly found more data in the file than we though was there, bail out
            goto done;
        }
        else
        {
            dwFileSize -= dwTemp;  // update the amount of file left to send..
        }

        if (!WinHttpWriteData( hRequest, byteBuffer, dwTemp, &dwTemp2)
            || dwTemp != dwTemp2)
        {
            goto done;
        }
    }

    //  ensure the whole file was successfully sent
    if (dwFileSize != 0)
        goto done;

    // End the request.
    bResults = WinHttpReceiveResponse( hRequest, NULL);
    if (!bResults)
        goto done;

    // Check the status code.
    bResults = WinHttpQueryHeaders( hRequest,
                                    WINHTTP_QUERY_STATUS_CODE|
                                    WINHTTP_QUERY_FLAG_NUMBER, NULL,
                                    &dwStatusCode, &dwSize, NULL);
    if (!bResults)
        goto done;

    if (bResults)
    {
        switch (dwStatusCode)
        {
        case 200:
            //  The resource was successfully retrieved.
            //  You could use WinHttpReadData to read the contents of the server's response.
            printf("\nSuccessfuly posted to %S.", szServer);
            break;
        default:
            //  The status code does not indicate success.
            printf("\nThe server responded with a status code of %i.", dwStatusCode);
            break;
        }
    }

    returnValue = TRUE;

done:
    dwTemp = GetLastError();

    // Close any open handles.
    if (hRequest)
        WinHttpCloseHandle(hRequest);

    if (hConnect)
        WinHttpCloseHandle(hConnect);

    if (hSession)
        WinHttpCloseHandle(hSession);

    if (hFile != INVALID_HANDLE_VALUE)
        CloseHandle(hFile);

    SetLastError(dwTemp);
    return returnValue;
}

Generated on Wed Nov 13 2024 16:54:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/winhttp/WinHttpPostSample/WinHttpPostSample.cpp File Reference

  • Web
  • winhttp
  • WinHttpPostSample
Classes | Functions

WinHttpPostSample.cpp File Reference

#include <tchar.h>
#include <windows.h>
#include <stdio.h>
#include "winhttp.h"

Go to the source code of this file.

Classes

class | CQuickStringWrap

Functions

int | _tmain (int argc, _TCHAR *argv[])
DWORD | ChooseAuthScheme (HINTERNET hRequest, DWORD dwSupportedSchemes)
BOOL | GetFileHandleAndSize (LPWSTR szFilename, OUT HANDLE *pHandle, OUT DWORD *pdwSize)
BOOL | WinHttpSamplePost (LPCWSTR szServerUrl, LPCWSTR szFile, LPCWSTR szProxyUrl)

Function Documentation

int _tmain | ( | int | argc,
 |  | _TCHAR * | argv[]
 | ) |  |

Definition at line 60 of file WinHttpPostSample.cpp.

{
    LPWSTR szServerUrl = argv[1];
    LPWSTR szFilename = argv[2];
    LPWSTR szProxyUrl = NULL;  // optional argv[3];
    URL_COMPONENTS urlComponents;
    BOOL fShowHelp = FALSE;
    DWORD dwTemp;

    //
    //  Make sure we got three or four params
    //(the first is the executeable name, rest are user params)
    //

    if (argc != 4)
    {
        if (argc == 3)
        {
            szProxyUrl = NULL;
        }
        else
        {
            fShowHelp = TRUE;
            goto done;
        }
    }
    else
    {
        szProxyUrl = argv[3];
    }

    //
    //  Do some validation on the input URLs..
    //

    memset(&urlComponents,0,sizeof(urlComponents));
    urlComponents.dwStructSize = sizeof(urlComponents);
    urlComponents.dwUserNameLength = 1;
    urlComponents.dwPasswordLength = 1;
    urlComponents.dwHostNameLength = 1;
    urlComponents.dwUrlPathLength = 1;

    if( !WinHttpCrackUrl(szServerUrl, 0, 0, &urlComponents))
    {
        printf("\nThere was a problem with the Server URL %S.\n", szServerUrl);
        fShowHelp = TRUE;
        goto done;
    }

    memset(&urlComponents,0,sizeof(urlComponents));
    urlComponents.dwStructSize = sizeof(urlComponents);
    urlComponents.dwUserNameLength = 1;
    urlComponents.dwPasswordLength = 1;
    urlComponents.dwHostNameLength = 1;
    urlComponents.dwUrlPathLength = 1;

    if (szProxyUrl != NULL
        && (!WinHttpCrackUrl(szProxyUrl, 0, 0, &urlComponents)
            || urlComponents.dwUrlPathLength > 1
            || urlComponents.nScheme != INTERNET_SCHEME_HTTP))
    {
        printf("\nThere was a problem with the Proxy URL %S."
               "  It should be a http:// url, and should have"
               " an empty path.\n", szProxyUrl);
        fShowHelp = TRUE;
        goto done;
    }

    //
    //  Make sure a file was passed in...
    //

    if ((DWORD)-1 == GetFileAttributes(szFilename))
    {
        printf("\nThe specified file, \"%S\", was not found.\n", szFilename);
        fShowHelp = TRUE;
        goto done;
    }

    if (!WinHttpSamplePost(szServerUrl, szFilename, szProxyUrl))
        goto done;

    SetLastError(NO_ERROR);

done:
    dwTemp = GetLastError();
    if (dwTemp != NO_ERROR)
    {
        printf( "\nWinHttpPostSample failed with error code %i.", dwTemp);
    }

    if (fShowHelp)
    {
        printf(
            "\n\n  Proper usage of this example is \"Post <url1> <filename> [url2]\",\n"
            "Where <url1> is the target HTTP URL and <filename> is the name of a file\n"
            "which will be POST'd to <url1>.  [url2] is optional and indicates the proxy\n"
            "to use.\n"
            "  Urls are of the form http://[username]:[password]@<server>[:port]/<path>.");
    }

    printf("\n\n");

    return 0;
}

DWORD ChooseAuthScheme | ( | HINTERNET | hRequest,
 |  | DWORD | dwSupportedSchemes
 | ) |  |

Definition at line 210 of file WinHttpPostSample.cpp.

{
    //  It is the servers responsibility to only accept authentication schemes
    //which provide the level of security needed to protect the server's
    //resource.
    //  However the client has some obligation when picking an authentication
    //scheme to ensure it provides the level of security needed to protect
    //the client's username and password from being revealed.  The Basic authentication
    //scheme is risky because it sends the username and password across the
    //wire in a format anyone can read.  This is not an issue for SSL connections though.

    if (dwSupportedSchemes & WINHTTP_AUTH_SCHEME_NEGOTIATE)
        return WINHTTP_AUTH_SCHEME_NEGOTIATE;
    else if (dwSupportedSchemes & WINHTTP_AUTH_SCHEME_NTLM)
        return WINHTTP_AUTH_SCHEME_NTLM;
    else if (dwSupportedSchemes & WINHTTP_AUTH_SCHEME_PASSPORT)
        return WINHTTP_AUTH_SCHEME_PASSPORT;
    else if (dwSupportedSchemes & WINHTTP_AUTH_SCHEME_DIGEST)
        return WINHTTP_AUTH_SCHEME_DIGEST;
    else if (dwSupportedSchemes & WINHTTP_AUTH_SCHEME_BASIC)
    {
        DWORD dwValue;
        DWORD dwSize = sizeof(dwValue);
        if (WinHttpQueryOption(hRequest, WINHTTP_OPTION_SECURITY_FLAGS, &dwValue,&dwSize)
            && (dwValue & SECURITY_FLAG_SECURE))
        {
            return WINHTTP_AUTH_SCHEME_BASIC;
        }
        else
            return 0;
    }
    else
        return 0;
}

BOOL GetFileHandleAndSize | ( | LPWSTR | szFilename,
 |  | OUT HANDLE * | pHandle,
 |  | OUT DWORD * | pdwSize
 | ) |  |

Definition at line 167 of file WinHttpPostSample.cpp.

{
    BOOL returnValue = FALSE;
    HANDLE hFile = INVALID_HANDLE_VALUE;
    LARGE_INTEGER liSize;
    liSize.LowPart = 0;
    liSize.HighPart = 0;

    hFile = CreateFile(szFilename, GENERIC_READ, FILE_SHARE_READ, NULL,
                       OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);

    if (hFile == INVALID_HANDLE_VALUE)
        goto done;

    if (!GetFileSizeEx(hFile, &liSize))
        goto done;

    if (liSize.HighPart != 0
        || liSize.LowPart > 0x7FFFFFFF)
    {
        //  Lets not try to send anything larger than 2 gigs
        SetLastError(ERROR_OPEN_FAILED);
    }

    returnValue = TRUE;
done:

    if (returnValue)
    {
        *pHandle = hFile;
        *pdwSize = liSize.LowPart;
        return TRUE;
    }
    else
    {
        if (hFile != INVALID_HANDLE_VALUE)
            CloseHandle(hFile);

        return FALSE;
    }
}

BOOL WinHttpSamplePost | ( | LPCWSTR | szServerUrl,
 |  | LPCWSTR | szFile,
 |  | LPCWSTR | szProxyUrl
 | ) |  |

Definition at line 246 of file WinHttpPostSample.cpp.

{
    BOOL returnValue = FALSE;
    DWORD dwTemp;

    URL_COMPONENTS urlServerComponents;
    URL_COMPONENTS urlProxyComponents;
    CQuickStringWrap strTargetServer;
    CQuickStringWrap strTargetPath;
    CQuickStringWrap strTargetUsername;
    CQuickStringWrap strTargetPassword;
    CQuickStringWrap strProxyServer;
    CQuickStringWrap strProxyUsername;
    CQuickStringWrap strProxyPassword;

    HANDLE hFile = INVALID_HANDLE_VALUE;
    DWORD dwFileSize;

    HINTERNET hSession = NULL, hConnect = NULL, hRequest = NULL;
    DWORD dwProxyAuthScheme = 0;
    DWORD dwStatusCode = 0;

    if (!GetFileHandleAndSize((LPWSTR)szFile, &hFile, &dwFileSize))
        goto done;

    //
    //  Its a long but straightforward chunk of code below that
    //splits szServerUrl and szProxyUrl into the various
    //strTarget*,strProxy* components.  They need to be put
    //into the separate str* variables so that they are individually
    //NULL-terminated.
    //

    //  From the server URL, we need a host, path, username and password.
    memset (&urlServerComponents, 0, sizeof(urlServerComponents));
    urlServerComponents.dwStructSize = sizeof(urlServerComponents);
    urlServerComponents.dwHostNameLength = 1;
    urlServerComponents.dwUrlPathLength = 1;
    urlServerComponents.dwUserNameLength = 1;
    urlServerComponents.dwPasswordLength = 1;

    if (!WinHttpCrackUrl(szServerUrl, 0, 0, &urlServerComponents))
        goto done;

    //
    //  An earlier version of WinHttp v5.1 has a bug where it misreports
    //the length of the username or password if they are not present.
    //

    if (urlServerComponents.lpszUserName == NULL)
        urlServerComponents.dwUserNameLength = 0;

    if (urlServerComponents.lpszPassword == NULL)
        urlServerComponents.dwPasswordLength = 0;

    if (!strTargetServer.Set(urlServerComponents.lpszHostName, urlServerComponents.dwHostNameLength)
        || !strTargetPath.Set(urlServerComponents.lpszUrlPath, urlServerComponents.dwUrlPathLength))
    {
        goto done;
    }

    //  for the username and password, if they are empty, leave the string pointers as NULL.
    //  This allows for the current process's default credentials to be used.
    if (urlServerComponents.dwUserNameLength != 0
        && !strTargetUsername.Set(urlServerComponents.lpszUserName,
                                  urlServerComponents.dwUserNameLength))
    {
        goto done;
    }

    if (urlServerComponents.dwPasswordLength != 0
        && !strTargetPassword.Set(urlServerComponents.lpszPassword,
                                  urlServerComponents.dwPasswordLength))
    {
        goto done;
    }

    if (szProxyUrl != NULL)
    {
        //  From the proxy URL, we need a host, username and password.
        memset (&urlProxyComponents, 0, sizeof(urlProxyComponents));
        urlProxyComponents.dwStructSize = sizeof(urlProxyComponents);
        urlProxyComponents.dwHostNameLength = 1;
        urlProxyComponents.dwUserNameLength = 1;
        urlProxyComponents.dwPasswordLength = 1;

        if (!WinHttpCrackUrl(szProxyUrl, 0, 0, &urlProxyComponents))
            goto done;

        //
        //  An earlier version of WinHttp v5.1 has a bug where it misreports
        //the length of the username or password if they are not present.
        //

        if (urlProxyComponents.lpszUserName == NULL)
            urlProxyComponents.dwUserNameLength = 0;

        if (urlProxyComponents.lpszPassword == NULL)
            urlProxyComponents.dwPasswordLength = 0;

        //  We do something tricky here, taking from the host beginning
        //to the beginning of the path as the strProxyServer.  What this
        //does, is if you have urls like "http://proxy","http://proxy/",
        //"http://proxy:8080" is copy them as "proxy","proxy","proxy:8080"
        //respectively.  This makes the port available for WinHttpOpen.
        if (urlProxyComponents.lpszUrlPath == NULL)
        {
            urlProxyComponents.lpszUrlPath = wcschr(urlProxyComponents.lpszHostName, L'/');
            if(urlProxyComponents.lpszUrlPath == NULL)
            {
                urlProxyComponents.lpszUrlPath = urlProxyComponents.lpszHostName
                                         + wcslen(urlProxyComponents.lpszHostName);
            }
        }
        if (!strProxyServer.Set(urlProxyComponents.lpszHostName,
            (DWORD)(urlProxyComponents.lpszUrlPath - urlProxyComponents.lpszHostName)))
        {
            goto done;
        }

        //  for the username and password, if they are empty, leave the string pointers as NULL.
        //  This allows for the current process's default credentials to be used.
        if (urlProxyComponents.dwUserNameLength != 0
            && !strProxyUsername.Set(urlProxyComponents.lpszUserName,
                                     urlProxyComponents.dwUserNameLength))
        {
            goto done;
        }

        if (urlProxyComponents.dwPasswordLength != 0
            && !strProxyPassword.Set(urlProxyComponents.lpszPassword,
                                     urlProxyComponents.dwPasswordLength))
        {
            goto done;
        }
    }

    //
    //  whew, now we can go on and start the request.
    //

    //
    //  Open a WinHttp session using the specified proxy
    //
    if (szProxyUrl != NULL)
    {
        hSession = WinHttpOpen(L"WinHttpPostSample",WINHTTP_ACCESS_TYPE_NAMED_PROXY,
                               strProxyServer, L"<local>", 0);
    }
    else
    {
        hSession = WinHttpOpen(L"WinHttpPostSample",WINHTTP_ACCESS_TYPE_DEFAULT_PROXY,
                               NULL,NULL,0);
    }

    if (hSession == NULL)
       goto done;

    //
    //  Open a connection to the target server
    //
    hConnect = WinHttpConnect( hSession, strTargetServer, urlServerComponents.nPort, 0);

    if (hConnect == NULL)
        goto done;

    //
    //  Open the request
    //
    hRequest = WinHttpOpenRequest(hConnect, L"POST", strTargetPath, NULL, NULL, NULL,
                urlServerComponents.nScheme == INTERNET_SCHEME_HTTPS ? WINHTTP_FLAG_SECURE : 0);

    if (hRequest == NULL)
        goto done;

    //
    //  Send the request.
    //
    //  This is done in a loop so that authentication challenges can be handled.
    //
    BOOL bDone;
    DWORD dwLastStatusCode = 0;
    bDone = FALSE;
    while (!bDone)
    {
        //  If a proxy auth challenge was responded to, reset those credentials
        //before each SendRequest.  This is done because after responding to a 401
        //or perhaps a redirect the proxy may require re-authentication.  You
        //could get into a 407,401,407,401,etc loop otherwise.
        if (dwProxyAuthScheme != 0)
        {
            if( !WinHttpSetCredentials( hRequest, WINHTTP_AUTH_TARGET_PROXY,
                                        dwProxyAuthScheme, strProxyUsername,
                                        strProxyPassword, NULL))
            {
                goto done;
            }
        }
        // Send a request.

        if (!WinHttpSendRequest( hRequest, WINHTTP_NO_ADDITIONAL_HEADERS, 0,
                                 NULL, 0, dwFileSize, 0))
        {
            goto done;
        }

        //
        //  Now we send the contents of the file.  We may have to redo this
        //after an auth challenge, and so we will reset the file position
        //to the beginning on each loop.
        //
        if(INVALID_SET_FILE_POINTER == SetFilePointer(hFile,0,NULL,FILE_BEGIN))
            goto done;

        //  Load the file 4k at a time and write it.  fwFileLeft will track
        //how much more needs to be written.
        DWORD dwFileLeft;
        dwFileLeft = dwFileSize;
        while(dwFileLeft > 0)
        {
            DWORD dwBytesRead;
            BYTE buffer[4096];

            if (!ReadFile(hFile, buffer, sizeof(buffer), &dwBytesRead, NULL))
                goto done;

            if (dwBytesRead == 0)
            {
                dwFileLeft = 0;
                continue;
            }
            else if (dwBytesRead > dwFileLeft)
            {
                // unexpectedly read more from the file than we expected to find.. bail out
                goto done;
            }
            else
                dwFileLeft -= dwBytesRead;

            if (!WinHttpWriteData(hRequest, buffer, dwBytesRead, &dwBytesRead))
                goto done;
        }

        // End the request.
        if (!WinHttpReceiveResponse( hRequest, NULL))
        {
            //  There is a special error we can get here indicating we need to try again
            if (GetLastError() == ERROR_WINHTTP_RESEND_REQUEST)
                continue;
            else
                goto done;
        }

        // Check the status code.
        dwTemp = sizeof(dwStatusCode);
        if (!WinHttpQueryHeaders( hRequest,
                        WINHTTP_QUERY_STATUS_CODE| WINHTTP_QUERY_FLAG_NUMBER,
                        NULL, &dwStatusCode, &dwTemp, NULL))
        {
            goto done;
        }

        DWORD dwSupportedSchemes, dwFirstScheme, dwTarget, dwSelectedScheme;
        switch (dwStatusCode)
        {
        case 200:
            // The resource was successfully retrieved.
            // You could use WinHttpReadData to read the contents of the server's response.
            printf("\nThe POST was successfully completed.");
            bDone = TRUE;
            break;
        case 401:
            // The server requires authentication.
            printf("\nThe server requires authentication.  Sending credentials...");

            // Obtain the supported and preferred schemes.
            if( !WinHttpQueryAuthSchemes(hRequest, &dwSupportedSchemes, &dwFirstScheme, &dwTarget))
                goto done;

            // Set the credentials before resending the request.
            dwSelectedScheme = ChooseAuthScheme(hRequest, dwSupportedSchemes);

            if (dwSelectedScheme == 0)
            {
                bDone = TRUE;
            }
            else
            {
                if (!WinHttpSetCredentials( hRequest, dwTarget, dwSelectedScheme,
                                            strTargetUsername, strTargetPassword, NULL))
                {
                    goto done;
                }
            }

            // If the same credentials are requested twice, abort the
            // request.  For simplicity, this sample does not check for
            // a repeated sequence of status codes.
            if (dwLastStatusCode==401)
            {
                printf("\nServer Authentication failed.");
                bDone = TRUE;
            }

            break;
        case 407:
            // The proxy requires authentication.
            printf("\nThe proxy requires authentication.  Sending credentials...");

            // Obtain the supported and preferred schemes.
            if (!WinHttpQueryAuthSchemes( hRequest, &dwSupportedSchemes, &dwFirstScheme, &dwTarget))
                goto done;

            // Set the credentials before resending the request.
            dwProxyAuthScheme = ChooseAuthScheme(hRequest, dwSupportedSchemes);

            // If the same credentials are requested twice, abort the
            // request.  For simplicity, this sample does not check for
            // a repeated sequence of status codes.
            if (dwLastStatusCode==407)
            {
                printf("\nProxy Authentication failed.");
                bDone = TRUE;
            }
            break;
        default:
            // The status code does not indicate success.
            printf("\nStatus code %d returned.\n", dwStatusCode);
            bDone = TRUE;
        }

        // Keep track of the last status code.
        dwLastStatusCode = dwStatusCode;
    }

    returnValue = TRUE;

done:
    dwTemp = GetLastError();

    if (hRequest != NULL)
        WinHttpCloseHandle(hRequest);

    if (hConnect != NULL)
        WinHttpCloseHandle(hConnect);

    if (hSession != NULL)
        WinHttpCloseHandle(hSession);

    if (hFile != INVALID_HANDLE_VALUE)
        CloseHandle(INVALID_HANDLE_VALUE);

    SetLastError(dwTemp);

    return returnValue;
}

Generated on Wed Nov 13 2024 16:54:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/xml/mfc_tree/resource.h File Reference

  • Web
  • xml
  • mfc_tree
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDB_TREEICON 129
#define | IDC_DEBUG 1000
#define | IDC_FILENAME 1003
#define | IDC_LOAD 1002
#define | IDC_OPEN 1004
#define | IDC_TREE 1001
#define | IDD_ABOUTBOX 100
#define | IDD_XMLTREE_DIALOG 102
#define | IDM_ABOUTBOX 0x0010
#define | IDR_XMLTREE 128
#define | IDS_ABOUTBOX 101

Define Documentation

#define IDB_TREEICON 129

Definition at line 21 of file resource.h.

#define IDC_DEBUG 1000

Definition at line 22 of file resource.h.

#define IDC_FILENAME 1003

Definition at line 25 of file resource.h.

#define IDC_LOAD 1002

Definition at line 24 of file resource.h.

#define IDC_OPEN 1004

Definition at line 26 of file resource.h.

#define IDC_TREE 1001

Definition at line 23 of file resource.h.

#define IDD_ABOUTBOX 100

Definition at line 17 of file resource.h.

#define IDD_XMLTREE_DIALOG 102

Definition at line 19 of file resource.h.

#define IDM_ABOUTBOX 0x0010

Definition at line 16 of file resource.h.

#define IDR_XMLTREE 128

Definition at line 20 of file resource.h.

#define IDS_ABOUTBOX 101

Definition at line 18 of file resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/xml/mfc_tree/StdAfx.cpp File Reference

  • Web
  • xml
  • mfc_tree

StdAfx.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/xml/mfc_tree/StdAfx.h File Reference

  • Web
  • xml
  • mfc_tree
Defines

StdAfx.h File Reference

#include <afxwin.h>
#include <afxext.h>
#include <afxdisp.h>
#include <afxdtctl.h>
#include <afxcmn.h>
#import "MSXML.DLL"

Go to the source code of this file.

Defines

#define VC_EXTRALEAN

Define Documentation

#define VC_EXTRALEAN

Definition at line 22 of file StdAfx.h.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/xml/mfc_tree/XMLTree.cpp File Reference

  • Web
  • xml
  • mfc_tree
Variables

XMLTree.cpp File Reference

#include "stdafx.h"
#include "XMLTree.h"
#include "XMLTreeDlg.h"

Go to the source code of this file.

Variables

CXMLTreeApp theApp

Variable Documentation

CXMLTreeApp theApp

Definition at line 41 of file XMLTree.cpp.

Generated on Wed Nov 13 2024 16:54:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/xml/mfc_tree/XMLTree.h File Reference

  • Web
  • xml
  • mfc_tree
Classes

XMLTree.h File Reference

#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Classes

class CXMLTreeApp
Generated on Wed Nov 13 2024 16:54:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/xml/mfc_tree/XMLTreeDlg.cpp File Reference

  • Web
  • xml
  • mfc_tree
Classes

XMLTreeDlg.cpp File Reference

#include "stdafx.h"
#include "XMLTree.h"
#include "XMLTreeDlg.h"

Go to the source code of this file.

Classes

class CAboutDlg
Generated on Wed Nov 13 2024 16:54:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: Web/xml/mfc_tree/XMLTreeDlg.h File Reference

  • Web
  • xml
  • mfc_tree
Classes

XMLTreeDlg.h File Reference

Go to the source code of this file.

Classes

class CXMLTreeDlg
Generated on Wed Nov 13 2024 16:54:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/ClipBookServer/ClipBook Server/ClipBook Server.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • ClipBookServer
  • ClipBook Server
Classes | Defines | Typedefs | Functions | Variables

ClipBook Server.cpp File Reference

#include "ClRes.h"

Go to the source code of this file.

Classes

struct | _CLIPBOOKSERVER_RESOURCE

Defines

#define | CLIPBOOKSERVER_SINGLE_INSTANCE_SEMAPHORE L"Cluster_ClipBookServer_Semaphore"

Typedefs

typedef struct
_CLIPBOOKSERVER_RESOURCE 		CLIPBOOKSERVER_RESOURCE
typedef struct
_CLIPBOOKSERVER_RESOURCE * 		PCLIPBOOKSERVER_RESOURCE

Functions

BOOL | ClipBookServerCheckIsAlive (PCLIPBOOKSERVER_RESOURCE pResourceEntryIn, BOOL fFullCheckIn)
void WINAPI | ClipBookServerClose (RESID residIn)
BOOL WINAPI | ClipBookServerDllMain (HINSTANCE hDllHandleIn, DWORD nReasonIn, LPVOID ReservedIn)
DWORD | ClipBookServerGetRequiredDependencies (PVOID pOutBufferOut, DWORD cbOutBufferSizeIn, LPDWORD pcbBytesReturnedOut)
BOOL WINAPI | ClipBookServerIsAlive (RESID residIn)
BOOL WINAPI | ClipBookServerLooksAlive (RESID residIn)
DWORD WINAPI | ClipBookServerOffline (RESID residIn)
DWORD WINAPI | ClipBookServerOfflineThread (PCLUS_WORKER pWorkerIn, PCLIPBOOKSERVER_RESOURCE pResourceEntryIn)
DWORD WINAPI | ClipBookServerOnline (RESID residIn, PHANDLE phEventHandleInout)
DWORD WINAPI | ClipBookServerOnlineThread (PCLUS_WORKER pWorkerIn, PCLIPBOOKSERVER_RESOURCE pResourceEntryIn)
RESID WINAPI | ClipBookServerOpen (LPCWSTR pwszResourceNameIn, HKEY hkeyResourceKeyIn, RESOURCE_HANDLE hResourceHandleIn)
DWORD WINAPI | ClipBookServerResourceControl (RESID residIn, DWORD nControlCodeIn, PVOID pInBufferIn, DWORD cbInBufferSizeIn, PVOID pOutBufferOut, DWORD cbOutBufferSizeIn, LPDWORD pcbBytesReturnedOut)
DWORD | ClipBookServerSetNameHandler (PCLIPBOOKSERVER_RESOURCE pResourceEntryIn, LPWSTR pwszNameIn)
DWORD WINAPI | ClipBookServerStartup (LPCWSTR pwszResourceTypeIn, DWORD nMinVersionSupportedIn, DWORD nMaxVersionSupportedIn, PSET_RESOURCE_STATUS_ROUTINE pfnSetResourceStatusIn, PLOG_EVENT_ROUTINE pfnLogEventIn, PCLRES_FUNCTION_TABLE *pFunctionTableOut)
void WINAPI | ClipBookServerTerminate (RESID residIn)
DWORD | ClipBookServerVerifyRequiredDependencies (PCLIPBOOKSERVER_RESOURCE pResourceEntryIn)
CLRES_V1_FUNCTION_TABLE (g_ClipBookServerFunctionTable, CLRES_VERSION_V1_00, ClipBookServer, NULL, NULL, ClipBookServerResourceControl, NULL)

Variables

CLRES_FUNCTION_TABLE | g_ClipBookServerFunctionTable

Define Documentation

#define CLIPBOOKSERVER_SINGLE_INSTANCE_SEMAPHORE L"Cluster_ClipBookServer_Semaphore"

Definition at line 55 of file ClipBook Server.cpp.

Typedef Documentation

typedef struct _CLIPBOOKSERVER_RESOURCE CLIPBOOKSERVER_RESOURCE
typedef struct _CLIPBOOKSERVER_RESOURCE * PCLIPBOOKSERVER_RESOURCE

Function Documentation

BOOL ClipBookServerCheckIsAlive | ( | PCLIPBOOKSERVER_RESOURCE | pResourceEntryIn,
 |  | BOOL | fFullCheckIn
 | ) |  |

Definition at line 1922 of file ClipBook Server.cpp.

{
    BOOL    fIsAlive = TRUE;
    DWORD   sc;

    //
    // Check to see if the resource is alive.
    //

    sc = ResUtilVerifyService( pResourceEntryIn->hService );
    if ( sc != ERROR_SUCCESS )
    {
        (g_pfnLogEvent)(
              pResourceEntryIn->hResourceHandle
            , LOG_ERROR
            , L"CheckIsAlive: Verification of the '%1!s!' service failed. Error: %2!u!.\n"
            , CLIPBOOKSERVER_SVCNAME
            , sc
            );
        fIsAlive = FALSE;
        goto Cleanup;
    } // if: error verifying service

    if ( fFullCheckIn )
    {
        //
        // TODO: Add code to perform a full check.
        //

    } // if: performing a full check

Cleanup:

    return fIsAlive;

} //*** ClipBookServerCheckIsAlive

void WINAPI ClipBookServerClose ( RESID residIn )

Definition at line 694 of file ClipBook Server.cpp.

{
    PCLIPBOOKSERVER_RESOURCE pResourceEntry = NULL;
    DWORD                   sc = ERROR_SUCCESS;

    //
    // Verify we have a valid resource ID.
    //

    pResourceEntry = static_cast< PCLIPBOOKSERVER_RESOURCE >( residIn );
    if ( pResourceEntry == NULL )
    {
        DBG_PRINT( "ClipBookServer: Close request for a nonexistent resource id.\n" );
        sc = ERROR_RESOURCE_NOT_FOUND;
        goto Cleanup;
    } // if: NULL resource ID

    if ( pResourceEntry->resid != residIn )
    {
        (g_pfnLogEvent)(
              pResourceEntry->hResourceHandle
            , LOG_ERROR
            , L"Close resource sanity check failed! resid = 0x%1!08x!.\n"
            , residIn
            );
        sc = ERROR_RESOURCE_NOT_FOUND;
        goto Cleanup;
    } // if: invalid resource ID

    if ( pResourceEntry->pwszResourceName == NULL )
    {
        (g_pfnLogEvent)(
              pResourceEntry->hResourceHandle
            , LOG_INFORMATION
            , L"Close request for resource with resid 0x%1!08x!.\n"
            , residIn
            );
    } // if: resource name is null...
    else
    {
        (g_pfnLogEvent)(
              pResourceEntry->hResourceHandle
            , LOG_INFORMATION
            , L"Close request for resource '%1!s!'.\n"
            , pResourceEntry->pwszResourceName
            );
    } // else: resource name is not null...

    //
    // Close the Parameters key.
    //

    if ( pResourceEntry->hkeyParameters != NULL )
    {
        ClusterRegCloseKey( pResourceEntry->hkeyParameters );
        pResourceEntry->hkeyParameters = NULL;
    } // if: parameters key is open

    //
    // Close the cluster handle.
    //

    if ( pResourceEntry->hCluster != NULL )
    {
        CloseCluster( pResourceEntry->hCluster );
        pResourceEntry->hCluster = NULL;
    } // if: cluster handle is open

    //
    // Close the resource handle.
    //

    if ( pResourceEntry->hResource != NULL )
    {
        CloseClusterResource( pResourceEntry->hResource );
        pResourceEntry->hResource = NULL;
    } // if: resource handle is open

    //
    // Clean up the semaphore if this is the single resource instance.
    //

    if ( pResourceEntry == g_pSingleInstanceResourceClipBookServer )
    {
        (g_pfnLogEvent)(
              pResourceEntry->hResourceHandle
            , LOG_INFORMATION
            , L"Close: Setting semaphore '%1!s!'.\n"
            , CLIPBOOKSERVER_SINGLE_INSTANCE_SEMAPHORE
            );
        g_pSingleInstanceResourceClipBookServer = NULL;
        ReleaseSemaphore( g_hSingleInstanceSemaphoreClipBookServer, 1 , NULL );
    } // if: this is the single resource instance

    //
    // Release the service handle in case it is still open.
    //

    if ( pResourceEntry->hService != NULL )
    {
        CloseServiceHandle( pResourceEntry->hService );
        pResourceEntry->hService = NULL;
    } // if:

    // ADDPARAM: Add new properties here.

    //
    // The ResUtil API's use LocalAlloc, so use LocalFree on the prop list members.
    //

    //
    // Deallocate the resource entry.
    //

    delete [] pResourceEntry->pwszResourceName;
    delete pResourceEntry;

    sc = ERROR_SUCCESS;

Cleanup:

    SetLastError( sc );

    return;

} //*** ClipBookServerClose

BOOL WINAPI ClipBookServerDllMain | ( | HINSTANCE | hDllHandleIn,
 |  | DWORD | nReasonIn,
 |  | LPVOID | ReservedIn
 | ) |  |

Definition at line 179 of file ClipBook Server.cpp.

{
    BOOL    fSuccess = TRUE;
    DWORD   sc = ERROR_SUCCESS;

    UNREFERENCED_PARAMETER( hDllHandleIn );
    UNREFERENCED_PARAMETER( ReservedIn );

    switch ( nReasonIn )
    {
        case DLL_PROCESS_ATTACH:
            g_hSingleInstanceSemaphoreClipBookServer = CreateSemaphoreW(
                  NULL
                , 0
                , 1
                , CLIPBOOKSERVER_SINGLE_INSTANCE_SEMAPHORE
                );
            sc = GetLastError();
            if ( g_hSingleInstanceSemaphoreClipBookServer == NULL )
            {
                fSuccess = FALSE;
                goto Cleanup;
            } // if: error creating semaphore

            if ( sc != ERROR_ALREADY_EXISTS )
            {
                // If the semaphore didnt exist, set its initial count to 1.
                ReleaseSemaphore( g_hSingleInstanceSemaphoreClipBookServer, 1, NULL );
            } // if: semaphore didn't already exist

            break;

        case DLL_PROCESS_DETACH:
            if ( g_hSingleInstanceSemaphoreClipBookServer != NULL )
            {
                CloseHandle( g_hSingleInstanceSemaphoreClipBookServer );
                g_hSingleInstanceSemaphoreClipBookServer = NULL;
            } // if: single instance semaphore was created

            if ( g_schSCMHandle != NULL )
            {
                CloseServiceHandle( g_schSCMHandle );
                g_schSCMHandle = NULL;
            } // if: global SCM handle was opened

            break;

    } // switch: nReason

Cleanup:

    return fSuccess;

} //*** ClipBookServerDllMain

DWORD ClipBookServerGetRequiredDependencies | ( | PVOID | pOutBufferOut,
 |  | DWORD | cbOutBufferSizeIn,
 |  | LPDWORD | pcbBytesReturnedOut
 | ) |  |

Definition at line 2129 of file ClipBook Server.cpp.

{
    //
    // TODO: Specify your resource's required dependencies here.
    // The default is that the resource requires a dependency on a
    // network name resource.
    //

    struct DEP_DATA
    {
        //
        // TODO: Uncomment the following line to enable a dependency on a storage device.
        //

        //CLUSPROP_RESOURCE_CLASS rcStorage;
        CLUSPROP_SZ_DECLARE( netnameEntry, RTL_NUMBER_OF( RESOURCE_TYPE_NETWORK_NAME ) );
        CLUSPROP_SYNTAX     endmark;
    };

    DEP_DATA *  pdepdata = static_cast< DEP_DATA * >( pOutBufferOut );
    DWORD       sc = ERROR_SUCCESS;
    HRESULT     hr = S_OK;

    *pcbBytesReturnedOut = sizeof( *pdepdata );
    if ( cbOutBufferSizeIn < sizeof( *pdepdata ) )
    {
        if ( pOutBufferOut == NULL )
        {
            sc = ERROR_SUCCESS;
        } // if: no buffer specified
        else
        {
            sc = ERROR_MORE_DATA;
        } // if: buffer specified
    } // if: output buffer is too small
    else
    {
        ZeroMemory( pdepdata, sizeof( *pdepdata ) );

        //
        // TODO: Uncomment the following lines to enable a dependency on a storage device.
        //

        //
        // Add the storage device entry.
        //

        //pdepdata->rcStorage.Syntax.dw = CLUSPROP_SYNTAX_RESCLASS;
        //pdepdata->rcStorage.cbLength = sizeof( pdepdata->rcStorage.rc );
        //pdepdata->rcStorage.rc = CLUS_RESCLASS_STORAGE;

        //
        // Add the netname entry.
        //
        pdepdata->netnameEntry.Syntax.dw = CLUSPROP_SYNTAX_NAME;
        pdepdata->netnameEntry.cbLength = sizeof( RESOURCE_TYPE_NETWORK_NAME );
        hr = StringCchCopyW(
                  pdepdata->netnameEntry.sz
                , RTL_NUMBER_OF( pdepdata->netnameEntry.sz )
                , RESOURCE_TYPE_NETWORK_NAME
                );
        if ( FAILED( hr ) )
        {
            sc = HRESULT_CODE( hr );
            goto Cleanup;
        } // if:

        //
        // Add the endmark.
        //

        pdepdata->endmark.dw = CLUSPROP_SYNTAX_ENDMARK;

        sc = ERROR_SUCCESS;
    } // else: output buffer is large enough

Cleanup:

    return sc;

} //*** ClipBookServerGetRequiredDependencies

BOOL WINAPI ClipBookServerIsAlive ( RESID residIn )

Definition at line 1850 of file ClipBook Server.cpp.

{
    PCLIPBOOKSERVER_RESOURCE pResourceEntry = NULL;

    //
    // Verify we have a valid resource ID.
    //

    pResourceEntry = static_cast< PCLIPBOOKSERVER_RESOURCE >( residIn );
    if ( pResourceEntry == NULL )
    {
        DBG_PRINT( "ClipBook Server: IsAlive request for a nonexistent resource id.\n" );
        return FALSE;
    } // if: NULL resource ID

    if ( pResourceEntry->resid != residIn )
    {
        (g_pfnLogEvent)(
              pResourceEntry->hResourceHandle
            , LOG_ERROR
            , L"IsAlive sanity check failed! resid = 0x%1!08x!.\n"
            , residIn
            );
        return FALSE;
    } // if: invalid resource ID

#ifdef LOG_VERBOSE
    (g_pfnLogEvent)(
          pResourceEntry->hResourceHandle
        , LOG_INFORMATION
        , L"IsAlive request.\n"
        );
#endif

    //
    // Check to see if the resource is alive.
    //

    return ClipBookServerCheckIsAlive( pResourceEntry, TRUE /* fFullCheck */ );

} //** ClipBookServerIsAlive

BOOL WINAPI ClipBookServerLooksAlive ( RESID residIn )

Definition at line 1762 of file ClipBook Server.cpp.

{
    PCLIPBOOKSERVER_RESOURCE pResourceEntry = NULL;

    //
    // Verify we have a valid resource ID.
    //

    pResourceEntry = static_cast< PCLIPBOOKSERVER_RESOURCE >( residIn );
    if ( pResourceEntry == NULL )
    {
        DBG_PRINT( "ClipBook Server: LooksAlive request for a nonexistent resource id.\n" );
        return FALSE;
    } // if: NULL resource ID

    if ( pResourceEntry->resid != residIn )
    {
        (g_pfnLogEvent)(
              pResourceEntry->hResourceHandle
            , LOG_ERROR
            , L"LooksAlive sanity check failed! resid = 0x%1!08x!.\n"
            , residIn
            );
        return FALSE;
    } // if: invalid resource ID

#ifdef LOG_VERBOSE
    (g_pfnLogEvent)(
          pResourceEntry->hResourceHandle
        , LOG_INFORMATION
        , L"LooksAlive request.\n"
        );
#endif

    //
    // TODO: LooksAlive code
    //

    //
    // NOTE: LooksAlive should be a quick check to see if the resource is
    // available or not, whereas IsAlive should be a thorough check.  If
    // there are no differences between a quick check and a thorough check,
    // IsAlive can be called for LooksAlive, as it is below.  However, if there
    // are differences, replace the call to IsAlive below with your quick
    // check code.
    //

    //
    // Check to see if the resource is alive.
    //

    return ClipBookServerCheckIsAlive( pResourceEntry, FALSE /* fFullCheck */ );

} //*** ClipBookServerLooksAlive

DWORD WINAPI ClipBookServerOffline ( RESID residIn )

Definition at line 1321 of file ClipBook Server.cpp.

{
    PCLIPBOOKSERVER_RESOURCE pResourceEntry = NULL;
    DWORD                   sc = ERROR_SUCCESS;

    //
    // Verify we have a valid resource ID.
    //

    pResourceEntry = static_cast< PCLIPBOOKSERVER_RESOURCE >( residIn );
    if ( pResourceEntry == NULL )
    {
        DBG_PRINT( "ClipBook Server: Offline request for a nonexistent resource id.\n" );
        sc = ERROR_RESOURCE_NOT_FOUND;
        goto Cleanup;
    } // if: NULL resource ID

    if ( pResourceEntry->resid != residIn )
    {
        (g_pfnLogEvent)(
              pResourceEntry->hResourceHandle
            , LOG_ERROR
            , L"Offline resource sanity check failed! resid = 0x%1!08x!.\n"
            , residIn
            );
        sc = ERROR_RESOURCE_NOT_FOUND;
        goto Cleanup;
    } // if: invalid resource ID

    (g_pfnLogEvent)(
          pResourceEntry->hResourceHandle
        , LOG_INFORMATION
        , L"Offline request.\n"
        );

    //
    // Start the Offline thread to perform the offline operation.
    //

    pResourceEntry->state = ClusterResourceOfflinePending;
    ClusWorkerTerminate( &pResourceEntry->cwWorkerThread );
    sc = ClusWorkerCreate(
              &pResourceEntry->cwWorkerThread
            , reinterpret_cast< PWORKER_START_ROUTINE >( ClipBookServerOfflineThread )
            , pResourceEntry
            );
    if ( sc != ERROR_SUCCESS )
    {
        pResourceEntry->state = ClusterResourceFailed;
        (g_pfnLogEvent)(
              pResourceEntry->hResourceHandle
            , LOG_ERROR
            , L"Offline: Unable to start thread. Error: %1!u!.\n"
            , sc
            );
    } // if: error creating the worker thread
    else
    {
        sc = ERROR_IO_PENDING;
    } // if: worker thread created successfully

Cleanup:

    return sc;

} //*** ClipBookServerOffline

DWORD WINAPI ClipBookServerOfflineThread | ( | PCLUS_WORKER | pWorkerIn,
 |  | PCLIPBOOKSERVER_RESOURCE | pResourceEntryIn
 | ) |  |

Definition at line 1417 of file ClipBook Server.cpp.

{
    RESOURCE_STATUS     resourceStatus;
    DWORD               sc = ERROR_SUCCESS;
    DWORD               nRetryTime = 300;     // 300 msec at a time
    BOOL                fDidStop = FALSE;
    SERVICE_STATUS      ServiceStatus;

    ResUtilInitializeResourceStatus( &resourceStatus );

    resourceStatus.ResourceState = ClusterResourceFailed;
    resourceStatus.WaitHint = 0;
    resourceStatus.CheckPoint = 1;

    //
    // If the service has gone offline or was never brought online then we're done.
    //

    if ( pResourceEntryIn->hService == NULL )
    {
        resourceStatus.ResourceState = ClusterResourceOffline;
        goto Cleanup;
    }

    //
    // Try to stop the service.  Wait for it to terminate as long as we're not asked to terminate.
    //

    while ( ClusWorkerCheckTerminate( pWorkerIn ) == FALSE )
    {
        sc = (ControlService(
                      pResourceEntryIn->hService
                    , (fDidStop
                        ? SERVICE_CONTROL_INTERROGATE
                        : SERVICE_CONTROL_STOP)
                    , &ServiceStatus
                    )
                ? ERROR_SUCCESS
                : GetLastError()
                );

        if ( sc == ERROR_SUCCESS )
        {
            fDidStop = TRUE;

            if ( ServiceStatus.dwCurrentState == SERVICE_STOPPED )
            {
                (g_pfnLogEvent)(
                      pResourceEntryIn->hResourceHandle
                    , LOG_INFORMATION
                    , L"OfflineThread: The '%1!s!' service stopped.\n"
                    , CLIPBOOKSERVER_SVCNAME
                    );

                //
                // Set the status to offline.
                //

                resourceStatus.ResourceState = ClusterResourceOffline;
                CloseServiceHandle( pResourceEntryIn->hService );
                pResourceEntryIn->hService = NULL;
                pResourceEntryIn->dwProcessId = 0;

                (g_pfnLogEvent)(
                      pResourceEntryIn->hResourceHandle
                    , LOG_INFORMATION
                    , L"OfflineThread: Service is now offline.\n"
                    );
                break;
            } // if: current service state is STOPPED
        } // if: ControlService completed successfully

        if (    ( sc == ERROR_EXCEPTION_IN_SERVICE )
            ||  ( sc == ERROR_PROCESS_ABORTED )
            ||  ( sc == ERROR_SERVICE_NOT_ACTIVE )
           )
        {
            (g_pfnLogEvent)(
                  pResourceEntryIn->hResourceHandle
                , LOG_INFORMATION
                , L"OfflineThread: The '%1!s!' service died or is not active any more; status = %2!u!.\n"
                , CLIPBOOKSERVER_SVCNAME
                , sc
                );

            //
            // Set the status to offline.
            //

            resourceStatus.ResourceState = ClusterResourceOffline;
            CloseServiceHandle( pResourceEntryIn->hService );
            pResourceEntryIn->hService = NULL;
            pResourceEntryIn->dwProcessId = 0;
            (g_pfnLogEvent)(
                  pResourceEntryIn->hResourceHandle
                , LOG_INFORMATION
                , L"OfflineThread: Service is now offline.\n"
                );
            break;
        } // if: service stopped abnormally

        (g_pfnLogEvent)(
              pResourceEntryIn->hResourceHandle
            , LOG_INFORMATION
            , L"OfflineThread: retrying...\n"
            );

        Sleep( nRetryTime );

    } // while: not asked to terminate

    //
    // Undo the temporary changes to the service config.
    //

    ResUtilRemoveResourceServiceEnvironment(
              CLIPBOOKSERVER_SVCNAME
            , g_pfnLogEvent
            , pResourceEntryIn->hResourceHandle
            );

Cleanup:

    pResourceEntryIn->state = resourceStatus.ResourceState;
    g_pfnSetResourceStatus( pResourceEntryIn->hResourceHandle, &resourceStatus );

    return sc;

} //*** ClipBookServerOfflineThread

DWORD WINAPI ClipBookServerOnline | ( | RESID | residIn,
 |  | PHANDLE | phEventHandleInout
 | ) |  |

Definition at line 876 of file ClipBook Server.cpp.

{
    PCLIPBOOKSERVER_RESOURCE pResourceEntry = NULL;
    DWORD                   sc = ERROR_SUCCESS;

    UNREFERENCED_PARAMETER( phEventHandleOut );

    //
    // Verify we have a valid resource ID.
    //

    pResourceEntry = static_cast< PCLIPBOOKSERVER_RESOURCE >( residIn );
    if ( pResourceEntry == NULL )
    {
        DBG_PRINT( "ClipBook Server: Online request for a nonexistent resource id.\n" );
        return ERROR_RESOURCE_NOT_FOUND;
    } // if: NULL resource ID

    if ( pResourceEntry->resid != residIn )
    {
        (g_pfnLogEvent)(
              pResourceEntry->hResourceHandle
            , LOG_ERROR
            , L"Online sanity check failed! resid = 0x%1!08x!.\n"
            , residIn
            );
        return ERROR_RESOURCE_NOT_FOUND;
    } // if: invalid resource ID

    (g_pfnLogEvent)(
          pResourceEntry->hResourceHandle
        , LOG_INFORMATION
        , L"Online request.\n"
        );

    //
    // Start the Online thread to perform the online operation.
    //

    pResourceEntry->state = ClusterResourceOnlinePending;
    ClusWorkerTerminate( &pResourceEntry->cwWorkerThread );
    sc = ClusWorkerCreate(
              &pResourceEntry->cwWorkerThread
            , reinterpret_cast< PWORKER_START_ROUTINE >( ClipBookServerOnlineThread )
            , pResourceEntry
            );
    if ( sc != ERROR_SUCCESS )
    {
        pResourceEntry->state = ClusterResourceFailed;
        (g_pfnLogEvent)(
              pResourceEntry->hResourceHandle
            , LOG_ERROR
            , L"Online: Unable to start thread. Error: %1!u!.\n"
            , sc
            );
    } // if: error creating the worker thread
    else
    {
        sc = ERROR_IO_PENDING;
    } // if: worker thread created successfully

    return sc;

} //*** ClipBookServerOnline

DWORD WINAPI ClipBookServerOnlineThread | ( | PCLUS_WORKER | pWorkerIn,
 |  | PCLIPBOOKSERVER_RESOURCE | pResourceEntryIn
 | ) |  |

Definition at line 971 of file ClipBook Server.cpp.

{
    RESOURCE_STATUS         resourceStatus;
    DWORD                   sc = ERROR_SUCCESS;
    DWORD                   nPrevCheckpoint;
    DWORD                   cbBytesNeeded;
    SERVICE_STATUS_PROCESS  ServiceStatus = { 0 };
    RESOURCE_EXIT_STATE     resExitState;

    UNREFERENCED_PARAMETER( pWorkerIn );

    ResUtilInitializeResourceStatus( &resourceStatus );

    resourceStatus.ResourceState = ClusterResourceFailed;
    resourceStatus.WaitHint = 0;
    resourceStatus.CheckPoint = 1;

    //
    // Parameter checking.
    //

    if ( pResourceEntryIn == NULL )
    {
        sc = ERROR_INVALID_PARAMETER;
        goto Cleanup;
    } // if:

    //
    // If we require dependencies them make sure we have them set.
    //

    sc = ClipBookServerVerifyRequiredDependencies( pResourceEntryIn );
    if ( sc != ERROR_SUCCESS )
    {
        (g_pfnLogEvent)(
              pResourceEntryIn->hResourceHandle
            , LOG_ERROR
            , L"OnlineThread: Required dependency not found. Error: %1!u!.\n"
            , sc
            );
        goto Cleanup;
    } // if: required dependencies are missing

    //
    // Create the new environment with the simulated net name when the
    // services queries GetComputerName.
    //

    if ( ClusWorkerCheckTerminate( pWorkerIn ) == TRUE )
    {
        goto Cleanup;
    } // if: terminating

    sc = ResUtilSetResourceServiceEnvironment(
              CLIPBOOKSERVER_SVCNAME
            , pResourceEntryIn->hResource
            , g_pfnLogEvent
            , pResourceEntryIn->hResourceHandle
            );
    if ( sc != ERROR_SUCCESS )
    {
        (g_pfnLogEvent)(
              pResourceEntryIn->hResourceHandle
            , LOG_ERROR
            , L"OnlineThread: Failed to set service environment. Error: %1!u!.\n"
            , sc
            );
        goto Cleanup;
    } // if: error setting the environment for the service

    //
    // Stop the service if it's running since we are about to change
    // its parameters.
    //

    sc = ResUtilStopResourceService( CLIPBOOKSERVER_SVCNAME );
    if ( sc != ERROR_SUCCESS )
    {
        (g_pfnLogEvent)(
              pResourceEntryIn->hResourceHandle
            , LOG_ERROR
            , L"OnlineThread: Failed to stop the '%1!s!' service. Error: %2!u!.\n"
            , CLIPBOOKSERVER_SVCNAME
            , sc
            );
        goto Cleanup;
    } // if: error stopping the service

    //
    // Make sure the service is ready to be controlled by the cluster.
    //

    if ( ClusWorkerCheckTerminate( pWorkerIn ) == TRUE )
    {
        goto Cleanup;
    } // if: terminating

    sc = ResUtilSetResourceServiceStartParameters(
              CLIPBOOKSERVER_SVCNAME
            , g_schSCMHandle
            , &pResourceEntryIn->hService
            , g_pfnLogEvent
            , pResourceEntryIn->hResourceHandle
            );
    if ( sc != ERROR_SUCCESS )
    {
        (g_pfnLogEvent)(
              pResourceEntryIn->hResourceHandle
            , LOG_ERROR
            , L"OnlineThread: Failed to set service start parameters. Error: %1!u!.\n"
            , sc
            );
        goto Cleanup;
    } // if:  error setting service start parameters

    //
    // Perform resource-specific initialization before starting the service.
    //

    //
    // TODO: Add code to initialize the resource before starting the service.
    //

    //
    // Start the service.
    //

    if ( ! StartServiceW( pResourceEntryIn->hService, 0, NULL ) )
    {
        sc = GetLastError();
        if ( sc != ERROR_SERVICE_ALREADY_RUNNING )
        {
            //
            //  TODO: Log event to the event log.
            //

            (g_pfnLogEvent)(
                  pResourceEntryIn->hResourceHandle
                , LOG_ERROR
                , L"OnlineThread: Failed to start the '%1!s!' service. Error: %2!u!.\n"
                , CLIPBOOKSERVER_SVCNAME
                , sc
                );
            sc = ERROR_SERVICE_NEVER_STARTED;
            goto Cleanup;
        } // if: error other than service already running occurred
    } // if: error starting the service

    //
    // Query the status of the service in a loop until it leaves
    // the pending state.
    //

    sc = ERROR_SUCCESS;
    resourceStatus.ResourceState = ClusterResourceOnlinePending;
    nPrevCheckpoint = 0;
    while ( ! ClusWorkerCheckTerminate( pWorkerIn ) )
    {
        //
        // Query the service status.
        //

        if ( ! QueryServiceStatusEx(
                  pResourceEntryIn->hService
                , SC_STATUS_PROCESS_INFO
                , reinterpret_cast< LPBYTE >( &ServiceStatus )
                , sizeof( SERVICE_STATUS_PROCESS )
                , &cbBytesNeeded
                )
           )
        {
            sc = GetLastError();
            (g_pfnLogEvent)(
                  pResourceEntryIn->hResourceHandle
                , LOG_ERROR
                , L"OnlineThread: Failed to query service status for the '%1!s!' service. Error: %2!u!.\n"
                , CLIPBOOKSERVER_SVCNAME
                , sc
                );
            resourceStatus.ResourceState = ClusterResourceFailed;
            goto Cleanup;
        } // if: error querying service status

        //
        // If the service is no longer pending, we are done.
        //

        if ( ServiceStatus.dwCurrentState != SERVICE_START_PENDING )
        {
            break;
        } // if: service state is not pending

        //
        // If the service checkpoint value changed, use it when notifying
        // the Resource Monitor of our current status.
        //

        if ( nPrevCheckpoint != ServiceStatus.dwCheckPoint )
        {
            nPrevCheckpoint = ServiceStatus.dwCheckPoint;
            resourceStatus.CheckPoint++;
        } // if:

        //
        // Notify the Resource Monitor of our current state.
        //

        resExitState = static_cast< RESOURCE_EXIT_STATE >(
            (g_pfnSetResourceStatus)(
                  pResourceEntryIn->hResourceHandle
                , &resourceStatus
                )
            );
        if ( resExitState != ResourceExitStateContinue )
        {
            goto Cleanup;
        } // if: resource is being terminated

        //
        // Check again in 1/2 second.
        //

        Sleep( 500 );
    } // while: not terminating while querying the status of the service

    //
    // Assume that we failed.
    //

    resourceStatus.ResourceState = ClusterResourceFailed;

    //
    // If we exited the loop before setting ServiceStatus, then return now.
    //

    if ( ClusWorkerCheckTerminate( pWorkerIn ) == TRUE )
    {
        goto Cleanup;
    } // if: being terminated

    if ( ServiceStatus.dwCurrentState != SERVICE_RUNNING )
    {
        sc = ERROR_SERVICE_NEVER_STARTED;

        //
        // TODO: Log event to the event log
        //

        (g_pfnLogEvent)(
              pResourceEntryIn->hResourceHandle
            , LOG_ERROR
            , L"OnlineThread: Failed to start the '%1!s!' service. Error: %2!u!.\n"
            , CLIPBOOKSERVER_SVCNAME
            , sc
            );
        goto Cleanup;
    } // if: service not running when loop exited

    //
    // Set status to online and save process ID of the service.
    // This is used to enable us to terminate the resource more
    // effectively.
    //

    resourceStatus.ResourceState = ClusterResourceOnline;
    if ( ! (ServiceStatus.dwServiceFlags & SERVICE_RUNS_IN_SYSTEM_PROCESS) )
    {
        pResourceEntryIn->dwProcessId = ServiceStatus.dwProcessId;
    } // if: not running in the system process

    (g_pfnLogEvent)(
          pResourceEntryIn->hResourceHandle
        , LOG_INFORMATION
        , L"The '%1!s!' service is now online.\n"
        , CLIPBOOKSERVER_SVCNAME
        );

Cleanup:

    if ( sc != ERROR_SUCCESS )
    {
        (g_pfnLogEvent)(
              pResourceEntryIn->hResourceHandle
            , LOG_ERROR
            , L"OnlineThread: Error %1!u! bringing resource online.\n"
            , sc
            );

        if ( pResourceEntryIn->hService != NULL )
        {
            CloseServiceHandle( pResourceEntryIn->hService );
            pResourceEntryIn->hService = NULL;
        } // if: service handle was opened
    } // if: error occurred

    pResourceEntryIn->state = resourceStatus.ResourceState;
    g_pfnSetResourceStatus( pResourceEntryIn->hResourceHandle, &resourceStatus );

    return sc;

} //*** ClipBookServerOnlineThread

RESID WINAPI ClipBookServerOpen | ( | LPCWSTR | pwszResourceNameIn,
 |  | HKEY | hkeyResourceKeyIn,
 |  | RESOURCE_HANDLE | hResourceHandleIn
 | ) |  |

Definition at line 381 of file ClipBook Server.cpp.

{
    DWORD                   sc = ERROR_SUCCESS;
    size_t                  cchBuffer = 0;
    RESID                   resid = NULL;
    HKEY                    hkeyParameters = NULL;
    PCLIPBOOKSERVER_RESOURCE pResourceEntry = NULL;
    SC_HANDLE               hService = NULL;
    HRESULT                 hr = S_OK;

    //
    // Check if more than one resource of this type.
    //

    if ( WaitForSingleObject( g_hSingleInstanceSemaphoreClipBookServer, 0 ) == WAIT_TIMEOUT )
    {
        //
        // A resource of this type is already running.
        //

        (g_pfnLogEvent)(
              hResourceHandleIn
            , LOG_ERROR
            , L"A resource of this type is already running.\n"
            );
        sc = ERROR_OBJECT_ALREADY_EXISTS;
        goto Cleanup;
    } // if: semaphore for resources of this type already already locked

    if ( g_pSingleInstanceResourceClipBookServer != NULL )
    {
        (g_pfnLogEvent)(
              hResourceHandleIn
            , LOG_ERROR
            , L"Single instance resource already set!\n"
            );
        sc = ERROR_OBJECT_ALREADY_EXISTS;
        goto Cleanup;
    } // if: resource of this type already exists

    //
    // Get a global handle to the Service Control Manager (SCM).
    //

    if ( g_schSCMHandle == NULL )
    {
        g_schSCMHandle = OpenSCManager( NULL, NULL, SC_MANAGER_ALL_ACCESS );
        if ( g_schSCMHandle == NULL )
        {
            sc = GetLastError();
            (g_pfnLogEvent)(
                  hResourceHandleIn
                , LOG_ERROR
                , L"Failed to open Service Control Manager. Error: %1!u!.\n"
                , sc
                );
            goto Cleanup;
        } // if: error opening the Service Control Manager
    } // if: Service Control Manager not open yet

    //
    // Make sure the service is ready to be controlled by the cluster.
    //

    //
    // Note: We do this in Open so that as soon as the resource is created
    //       the service is configured for cluster service control.
    //

    sc = ResUtilSetResourceServiceStartParameters(
              CLIPBOOKSERVER_SVCNAME
            , g_schSCMHandle
            , &hService
            , g_pfnLogEvent
            , hResourceHandleIn
            );
    if ( sc != ERROR_SUCCESS )
    {
        (g_pfnLogEvent)(
              hResourceHandleIn
            , LOG_ERROR
            , L"Failed to set the service start parameters for the '%1!s!' service. Error: %2!u!.\n"
            , CLIPBOOKSERVER_SVCNAME
            , sc
            );
        goto Cleanup;
    } // if:  error setting service start parameters

    if ( hService != NULL )
    {
        CloseServiceHandle( hService );
        hService = NULL;
    } // if: hService is not NULL

    //
    // Make sure the service has been stopped.
    //

    sc = ResUtilStopResourceService( CLIPBOOKSERVER_SVCNAME );
    if ( sc != ERROR_SUCCESS )
    {
        (g_pfnLogEvent)(
              hResourceHandleIn
            , LOG_ERROR
            , L"Failed to stop the '%1!s!' service. Error: %2!u!.\n"
            , CLIPBOOKSERVER_SVCNAME
            , sc
            );
        goto Cleanup;
    } // if: error stopping the service

    //
    // Open the Parameters registry key for this resource.
    //

    sc = ClusterRegOpenKey(
              hkeyResourceKeyIn
            , L"Parameters"
            , KEY_ALL_ACCESS
            , &hkeyParameters
            );
    if ( sc != ERROR_SUCCESS )
    {
        (g_pfnLogEvent)(
              hResourceHandleIn
            , LOG_ERROR
            , L"Open: Unable to open Parameters key. Error: %1!u!.\n"
            , sc
            );
        goto Cleanup;
    } // if: error creating the Parameters key for the resource

    //
    // Allocate a resource entry.
    //

    pResourceEntry = new CLIPBOOKSERVER_RESOURCE;
    if ( pResourceEntry == NULL )
    {
        sc = GetLastError();
        (g_pfnLogEvent)(
              hResourceHandleIn
            , LOG_ERROR
            , L"Open: Unable to allocate resource entry structure. Error: %1!u!.\n"
            , sc
            );
        goto Cleanup;
    } // if: error allocating memory for the resource

    //
    // Initialize the resource entry..
    //

    ZeroMemory( pResourceEntry, sizeof( *pResourceEntry ) );

    pResourceEntry->resid = static_cast< RESID >( pResourceEntry ); // for validation
    pResourceEntry->hResourceHandle = hResourceHandleIn;
    pResourceEntry->hkeyParameters = hkeyParameters;
    pResourceEntry->state = ClusterResourceOffline;

    //
    // Save the name of the resource.
    //

    cchBuffer = lstrlenW( pwszResourceNameIn ) + 1;
    pResourceEntry->pwszResourceName = new WCHAR[ cchBuffer ];
    if ( pResourceEntry->pwszResourceName == NULL )
    {
        sc = GetLastError();
        (g_pfnLogEvent)(
              hResourceHandleIn
            , LOG_ERROR
            , L"Open: Unable to allocate the resource name buffer. Error: %1!u!.\n"
            , sc
            );
        goto Cleanup;
    } // if: error allocating memory for the name.

    hr = StringCchCopyW( pResourceEntry->pwszResourceName, cchBuffer, pwszResourceNameIn );
    if ( FAILED( hr ) )
    {
        sc = HRESULT_CODE( hr );
        (g_pfnLogEvent)(
              hResourceHandleIn
            , LOG_ERROR
            , L"Open: Unable to allocate the resource name buffer. Error: %1!u!.\n"
            , sc
            );
        goto Cleanup;
    } // if:

    //
    // Open the cluster.
    //

    pResourceEntry->hCluster = OpenCluster( NULL );
    if ( pResourceEntry->hCluster == NULL )
    {
        sc = GetLastError();
        (g_pfnLogEvent)(
              hResourceHandleIn
            , LOG_ERROR
            , L"Open: Unable to open the cluster. Error: %1!u!.\n"
            , sc
            );
        goto Cleanup;
    } // if: error opening the cluster

    //
    // Open the resource.
    //

    pResourceEntry->hResource = OpenClusterResource( pResourceEntry->hCluster, pwszResourceNameIn );
    if ( pResourceEntry->hResource == NULL )
    {
        sc = GetLastError();
        (g_pfnLogEvent)(
              hResourceHandleIn
            , LOG_ERROR
            , L"Open: Unable to open the resource. Error: %1!u!.\n"
            , sc
            );
        goto Cleanup;
    } // if: error opening the resource

    //
    // Initialization for the resource.
    //

    //
    // TODO: Add your custom resource open code here.
    //

    resid = static_cast< RESID >( pResourceEntry );
    g_pSingleInstanceResourceClipBookServer = pResourceEntry;
    sc = ERROR_SUCCESS;

Cleanup:

    if ( resid == NULL )
    {
        assert( sc != ERROR_SUCCESS );

        (g_pfnLogEvent)(
              hResourceHandleIn
            , LOG_ERROR
            , L"Open: failed with error %1!u!.\n"
            , sc
            );

        if ( hkeyParameters != NULL )
        {
            ClusterRegCloseKey( hkeyParameters );
        } // if:

        if ( pResourceEntry != NULL )
        {
            if ( pResourceEntry->hResource != NULL )
            {
                CloseClusterResource( pResourceEntry->hResource );
            } // if:

            if ( pResourceEntry->hCluster != NULL )
            {
                CloseCluster( pResourceEntry->hCluster );
            } // if:

            delete [] pResourceEntry->pwszResourceName;
            delete pResourceEntry;

        } // if: resource entry allocated
    } // if: something failed

    if ( hService != NULL )
    {
        CloseServiceHandle( hService );
        hService = NULL;
    } // if: hService is not NULL

    SetLastError( sc );

    return resid;

} //*** ClipBookServerOpen

DWORD WINAPI ClipBookServerResourceControl | ( | RESID | residIn,
 |  | DWORD | nControlCodeIn,
 |  | PVOID | pInBufferIn,
 |  | DWORD | cbInBufferSizeIn,
 |  | PVOID | pOutBufferOut,
 |  | DWORD | cbOutBufferSizeIn,
 |  | LPDWORD | pcbBytesReturnedOut
 | ) |  |

Definition at line 2020 of file ClipBook Server.cpp.

{
    DWORD               sc = ERROR_SUCCESS;
    PCLIPBOOKSERVER_RESOURCE pResourceEntry = NULL;

    UNREFERENCED_PARAMETER( cbInBufferSizeIn );
    //
    // Verify we have a valid resource ID.
    //
    pResourceEntry = static_cast< PCLIPBOOKSERVER_RESOURCE >( residIn );
    if ( pResourceEntry == NULL )
    {
        DBG_PRINT( "ClipBook Server: ResourceControl request for a nonexistent resource id.\n" );
        return ERROR_RESOURCE_NOT_FOUND;
    } // if: NULL resource ID

    if ( pResourceEntry->resid != residIn )
    {
        (g_pfnLogEvent)(
              pResourceEntry->hResourceHandle
            , LOG_ERROR
            , L"ResourceControl sanity check failed! resid = 0x%1!08x!.\n"
            , residIn
            );
        return ERROR_RESOURCE_NOT_FOUND;
    } // if: invalid resource ID

    switch ( nControlCodeIn )
    {
        case CLUSCTL_RESOURCE_UNKNOWN:
            *pcbBytesReturnedOut = 0;
            sc = ERROR_SUCCESS;
            break;

        case CLUSCTL_RESOURCE_SET_NAME:
            sc = ClipBookServerSetNameHandler( pResourceEntry, static_cast< LPWSTR >( pInBufferIn ) );
            break;

        case CLUSCTL_RESOURCE_GET_REQUIRED_DEPENDENCIES:
            sc = ClipBookServerGetRequiredDependencies( pOutBufferOut, cbOutBufferSizeIn, pcbBytesReturnedOut );
            break;

        case CLUSCTL_RESOURCE_GET_CHARACTERISTICS:
        case CLUSCTL_RESOURCE_GET_CLASS_INFO:
        case CLUSCTL_RESOURCE_STORAGE_GET_DISK_INFO:
        case CLUSCTL_RESOURCE_STORAGE_IS_PATH_VALID:
        case CLUSCTL_RESOURCE_DELETE:
        case CLUSCTL_RESOURCE_INSTALL_NODE:
        case CLUSCTL_RESOURCE_EVICT_NODE:
        case CLUSCTL_RESOURCE_ADD_DEPENDENCY:
        case CLUSCTL_RESOURCE_REMOVE_DEPENDENCY:
        case CLUSCTL_RESOURCE_ADD_OWNER:
        case CLUSCTL_RESOURCE_REMOVE_OWNER:
        case CLUSCTL_RESOURCE_CLUSTER_NAME_CHANGED:
        case CLUSCTL_RESOURCE_CLUSTER_VERSION_CHANGED:
        default:
            sc = ERROR_INVALID_FUNCTION;
            break;
    } // switch: nControlCodeIn

    return sc;

} //*** ClipBookServerResourceControl

DWORD ClipBookServerSetNameHandler | ( | PCLIPBOOKSERVER_RESOURCE | pResourceEntryIn,
 |  | LPWSTR | pwszNameIn
 | ) |  |

Definition at line 2495 of file ClipBook Server.cpp.

{
    DWORD   sc = ERROR_SUCCESS;
    DWORD   cchNameBuffer = 0;
    HRESULT hr = S_OK;
    WCHAR * pwszTemp = NULL;

    //
    // Allocate a buffer for the new name.
    //

    cchNameBuffer = lstrlenW( pwszNameIn ) + 1;
    pwszTemp = new WCHAR[ cchNameBuffer ];
    if ( pwszTemp == NULL )
    {
        sc = GetLastError();
        (g_pfnLogEvent)(
              pResourceEntryIn->hResourceHandle
            , LOG_ERROR
            , L"Failed to allocate memory for the new resource name '%1!s!'. Error: %2!u!.\n"
            , pwszNameIn
            , sc
            );
        goto Cleanup;
    } // if: error allocating memory for the name.

    //
    // Copy the new name to the new buffer.
    //

    hr = StringCchCopyW( pwszTemp, cchNameBuffer, pwszNameIn );
    if ( FAILED( hr ) )
    {
        sc = HRESULT_CODE( hr );
        goto Cleanup;
    } // if:

    //
    // All went well, free the old buffer and assign the new one.
    //

    delete [] pResourceEntryIn->pwszResourceName;
    pResourceEntryIn->pwszResourceName = pwszTemp;
    pwszTemp = NULL;

Cleanup:

    delete [] pwszTemp;

    return sc;

} //*** ClipBookServerSetNameHandler

DWORD WINAPI ClipBookServerStartup | ( | LPCWSTR | pwszResourceTypeIn,
 |  | DWORD | nMinVersionSupportedIn,
 |  | DWORD | nMaxVersionSupportedIn,
 |  | PSET_RESOURCE_STATUS_ROUTINE | pfnSetResourceStatusIn,
 |  | PLOG_EVENT_ROUTINE | pfnLogEventIn,
 |  | PCLRES_FUNCTION_TABLE * | pFunctionTableOut
 | ) |  |

Definition at line 303 of file ClipBook Server.cpp.

{
    DWORD sc = ERROR_SUCCESS;

    // These are stored in the calling DllMain.
    UNREFERENCED_PARAMETER( pfnSetResourceStatusIn );
    UNREFERENCED_PARAMETER( pfnLogEventIn );

    if (   (nMinVersionSupportedIn > CLRES_VERSION_V1_00)
        || (nMaxVersionSupportedIn < CLRES_VERSION_V1_00) )
    {
        sc = ERROR_REVISION_MISMATCH;
    } // if: version not supported
    else if ( NIStringCompareW( pwszResourceTypeIn, RESTYPE_NAME, RTL_NUMBER_OF( RESTYPE_NAME ) ) == 0 )
    {
        *pFunctionTableOut = &g_ClipBookServerFunctionTable;
        sc = ERROR_SUCCESS;
    } // else if: we support this type of resource
    else
    {
        //
        // We don't support this resource type.
        //

        sc = ERROR_CLUSTER_RESNAME_NOT_FOUND;
    } // else: resource type name not supported

    return sc;

} //*** ClipBookServerStartup

void WINAPI ClipBookServerTerminate ( RESID residIn )

Definition at line 1573 of file ClipBook Server.cpp.

{
    PCLIPBOOKSERVER_RESOURCE pResourceEntry = NULL;
    DWORD                   sc = ERROR_SUCCESS;

    //
    // Verify we have a valid resource ID.
    //

    pResourceEntry = static_cast< PCLIPBOOKSERVER_RESOURCE >( residIn );
    if ( pResourceEntry == NULL )
    {
        DBG_PRINT( "ClipBook Server: Terminate request for a nonexistent resource id.\n" );
        return;
    } // if: NULL resource ID

    if ( pResourceEntry->resid != residIn )
    {
        (g_pfnLogEvent)(
              pResourceEntry->hResourceHandle
            , LOG_ERROR
            , L"Terminate resource sanity check failed! resid = 0x%1!08x!.\n"
            , residIn
            );
        return;
    } // if: invalid resource ID

    (g_pfnLogEvent)(
          pResourceEntry->hResourceHandle
        , LOG_INFORMATION
        , L"Terminate request.\n"
        );

    //
    // Kill off any pending threads.
    //

    ClusWorkerTerminate( &pResourceEntry->cwWorkerThread );

    if ( pResourceEntry->hService != NULL )
    {
        DWORD           nTotalRetryTime = 30*1000;  // Wait 30 secs for shutdown
        DWORD           nRetryTime = 300;           // 300 msec at a time
        BOOL            fDidStop = FALSE;
        SERVICE_STATUS  ServiceStatus;

        for ( ;; )
        {
            sc = (ControlService(
                          pResourceEntry->hService
                        , (fDidStop
                            ? SERVICE_CONTROL_INTERROGATE
                            : SERVICE_CONTROL_STOP)
                        , &ServiceStatus
                        )
                    ? ERROR_SUCCESS
                    : GetLastError()
                    );

            if ( sc == ERROR_SUCCESS )
            {
                fDidStop = TRUE;

                if ( ServiceStatus.dwCurrentState == SERVICE_STOPPED )
                {
                    (g_pfnLogEvent)(
                          pResourceEntry->hResourceHandle
                        , LOG_INFORMATION
                        , L"Terminate: The '%1!s!' service stopped.\n"
                        , CLIPBOOKSERVER_SVCNAME
                        );
                    break;
                } // if: current service state is STOPPED
            } // if: ControlService completed successfully

            if (    ( sc == ERROR_EXCEPTION_IN_SERVICE )
                ||  ( sc == ERROR_PROCESS_ABORTED )
                ||  ( sc == ERROR_SERVICE_NOT_ACTIVE )
               )
            {
                (g_pfnLogEvent)(
                      pResourceEntry->hResourceHandle
                    , LOG_INFORMATION
                    , L"Terminate: Service died; status = %1!u!.\n"
                    , sc
                    );
                break;
            } // if: service stopped abnormally

            if ( (nTotalRetryTime -= nRetryTime) == 0 )
            {
                (g_pfnLogEvent)(
                      pResourceEntry->hResourceHandle
                    , LOG_ERROR
                    , L"Terminate: Service did not stop; giving up.\n"
                    );

                break;
            } // if: retried too many times

            (g_pfnLogEvent)(
                  pResourceEntry->hResourceHandle
                , LOG_INFORMATION
                , L"Terminate: retrying...\n"
                );

            Sleep( nRetryTime );
        } // for: forever

        //
        // Declare the service offline.  It may not truly be offline, so
        // if there is a pid for this service, try and terminate that process.
        // Note that terminating a process doesnt terminate all the child
        // processes.
        //

        if ( pResourceEntry->dwProcessId != 0 )
        {
            HANDLE hSvcProcess = NULL;

            hSvcProcess = OpenProcess(
                                  PROCESS_TERMINATE
                                , FALSE
                                , pResourceEntry->dwProcessId
                                );
            if ( hSvcProcess != NULL )
            {
                (g_pfnLogEvent)(
                      pResourceEntry->hResourceHandle
                    , LOG_INFORMATION
                    , L"Terminate: Terminating processid %1!u!\n"
                    , pResourceEntry->dwProcessId
                    );
                TerminateProcess( hSvcProcess, 0 );
                CloseHandle( hSvcProcess );
            } // if: opened process successfully
        } // if: service process ID available

        CloseServiceHandle( pResourceEntry->hService );
        pResourceEntry->hService = NULL;
        pResourceEntry->dwProcessId = 0;
    } // if: service was started

    //
    // Undo the temporary changes to the service config.
    //

    ResUtilRemoveResourceServiceEnvironment(
              CLIPBOOKSERVER_SVCNAME
            , g_pfnLogEvent
            , pResourceEntry->hResourceHandle
            );

    pResourceEntry->state = ClusterResourceFailed;

    return;

} //*** ClipBookServerTerminate

DWORD ClipBookServerVerifyRequiredDependencies ( PCLIPBOOKSERVER_RESOURCE pResourceEntryIn )

Definition at line 2241 of file ClipBook Server.cpp.

{
    DWORD                   sc = ERROR_SUCCESS;
    DWORD                   cbBuffer = 0;
    PBYTE                   pbBuffer = NULL;
    CLUSPROP_BUFFER_HELPER  props;
    HRESOURCE               hResource = NULL;

    //
    // Get the list of required dependencies.
    //

    sc = ClipBookServerGetRequiredDependencies(
                  NULL
                , 0
                , &cbBuffer
                );
    if ( sc != ERROR_SUCCESS )
    {
        (g_pfnLogEvent)(
              pResourceEntryIn->hResourceHandle
            , LOG_ERROR
            , L"VerifyRequiredDependencies: Failed to retrieve list of required dependencies. Error: %1!u!.\n"
            , sc
            );
        goto Cleanup;
    } // if:

    pbBuffer = new BYTE[ cbBuffer ];
    if ( pbBuffer == NULL )
    {
        sc = ERROR_OUTOFMEMORY;
        (g_pfnLogEvent)(
              pResourceEntryIn->hResourceHandle
            , LOG_ERROR
            , L"VerifyRequiredDependencies: Failed to allocate memory. Error: %1!u!.\n"
            , sc
            );
        goto Cleanup;
    } // if:

    sc = ClipBookServerGetRequiredDependencies(
                  pbBuffer
                , cbBuffer
                , &cbBuffer
                );
    if ( sc != ERROR_SUCCESS )
    {
        (g_pfnLogEvent)(
              pResourceEntryIn->hResourceHandle
            , LOG_ERROR
            , L"VerifyRequiredDependencies: Failed to retrieve list of required dependencies. Error: %1!u!.\n"
            , sc
            );
        goto Cleanup;
    } // if:

    //
    // Assign the list.
    //

    props.pRequiredDependencyValue = (PCLUSPROP_REQUIRED_DEPENDENCY) pbBuffer;

    //
    // Loop through each required dependency and make sure
    // there is a dependency on a resource of that type.
    //

    while ( props.pSyntax->dw != CLUSPROP_SYNTAX_ENDMARK )
    {
        //
        // Check whether the dependency exists.
        //

        if ( props.pSyntax->dw == CLUSPROP_SYNTAX_RESCLASS )
        {
            //
            // We have a dependency on a class of resource, such as storage devices.
            // This allows us to depend on a storage resource type from any vendor
            // and not just on Physical Disk.
            //

            hResource = ResUtilGetResourceDependencyByClass(
                              pResourceEntryIn->hCluster
                            , pResourceEntryIn->hResource
                            , props.pResourceClassInfoValue
                            , TRUE  // bRecurse
                            );
            if ( hResource == NULL )
            {
                sc = GetLastError();
                if ( sc == ERROR_NO_MORE_ITEMS )
                {
                    //
                    // If we failed with ERROR_NO_MORE_ITEMS then the resource enumeration
                    // completed without finding the dependency.  Change sc to reflect the
                    // actual meaning of the error.
                    //

                    sc = ERROR_DEPENDENCY_NOT_FOUND;
                } // if:

                if ( props.pResourceClassInfoValue->rc == CLUS_RESCLASS_STORAGE )
                {
                    //
                    // We require a storage class resource dependency.
                    //

                    (g_pfnLogEvent)(
                          pResourceEntryIn->hResourceHandle
                        , LOG_ERROR
                        , L"VerifyRequiredDependencies: Missing storage resource dependency. Error: %1!u!.\n"
                        , sc
                        );
                } // if: storage resclass dependency
                else
                {
                    //
                    // We require a custom-defined resource class dependency.
                    //

                    (g_pfnLogEvent)(
                          pResourceEntryIn->hResourceHandle
                        , LOG_ERROR
                        , L"VerifyRequiredDependencies: Missing resource class dependency. Class: %1!u!. Error: %2!u!.\n"
                        , props.pResourceClassInfoValue->rc
                        , sc
                        );
                } // else: custom resclass dependency
                goto Cleanup;
            } // if: hResource == NULL

            props.pb += sizeof( *props.pResourceClassValue );
        } // if: by resclass
        else if ( props.pSyntax->dw == CLUSPROP_SYNTAX_NAME )
        {
            //
            // We have a dependency on a particular resource type.
            //

            hResource = ResUtilGetResourceDependencyByName(
                              pResourceEntryIn->hCluster
                            , pResourceEntryIn->hResource
                            , props.pStringValue->sz
                            , TRUE  // bRecurse
                            );
            if ( hResource == NULL )
            {
                sc = GetLastError();
                if ( sc == ERROR_NO_MORE_ITEMS )
                {
                    //
                    // If we failed with ERROR_NO_MORE_ITEMS then the resource enumeration
                    // completed without finding the dependency.  Change sc to reflect the
                    // actual meaning of the error.
                    //

                    sc = ERROR_DEPENDENCY_NOT_FOUND;
                } // if:

                (g_pfnLogEvent)(
                      pResourceEntryIn->hResourceHandle
                    , LOG_ERROR
                    , L"VerifyRequiredDependencies: Missing a required depencency on '%1!s!'. Error: %2!u!.\n"
                    , props.pStringValue->sz
                    , sc
                    );
                goto Cleanup;
            } // if: hResource == NULL

            props.pb += sizeof( *props.pStringValue ) + ALIGN_CLUSPROP( props.pStringValue->cbLength );
        } // else if: by name
        else
        {
            //
            // If we got here then our list of required dependencies contains an invalid entry.
            //
            //

            sc = ERROR_DEPENDENCY_NOT_FOUND;
            (g_pfnLogEvent)(
                  pResourceEntryIn->hResourceHandle
                , LOG_ERROR
                , L"VerifyRequiredDependencies: Invalid dependency type. Error: %1!u!.\n"
                , sc
                );
            goto Cleanup;
        } // else: unknown

        CloseClusterResource( hResource );
        hResource = NULL;

        //
        // Test to make sure we haven't gone past the end of the buffer.
        //

        if ( props.pb > (pbBuffer + cbBuffer) )
        {
            sc = ERROR_INVALID_DATA;
            (g_pfnLogEvent)(
                  pResourceEntryIn->hResourceHandle
                , LOG_ERROR
                , L"VerifyRequiredDependencies: Invalid property list detected. Error: %1!u!.\n"
                , sc
                );
            goto Cleanup;
        } // if: we've gone beyond the end of the buffer

    } // while: !endmark

    sc = ERROR_SUCCESS;

Cleanup:

    if ( hResource != NULL )
    {
        CloseClusterResource( hResource );
    } // if:

    delete [] pbBuffer;

    return sc;

} //*** ClipBookServerVerifyRequiredDependencies

CLRES_V1_FUNCTION_TABLE | ( | g_ClipBookServerFunctionTable | ,
 |  | CLRES_VERSION_V1_00 | ,
 |  | ClipBookServer | ,
 |  | NULL | ,
 |  | NULL | ,
 |  | ClipBookServerResourceControl | ,
 |  | NULL |
 | ) |  |

Variable Documentation

CLRES_FUNCTION_TABLE g_ClipBookServerFunctionTable
Generated on Wed Nov 13 2024 16:54:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/ClipBookServer/ClipBook Server/ClRes.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • ClipBookServer
  • ClipBook Server
Functions | Variables

ClRes.cpp File Reference

#include "ClRes.h"
#include "CMgdResType.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsidIn, REFIID riidIn, LPVOID *ppvOut)
BOOL WINAPI | DllMain (HINSTANCE hInstanceIn, DWORD nReasonIn, LPVOID ReservedIn)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)
DWORD WINAPI | Startup (LPCWSTR pwszResourceTypeIn, DWORD nMinVersionSupportedIn, DWORD nMaxVersionSupportedIn, PSET_RESOURCE_STATUS_ROUTINE pfnSetResourceStatusIn, PLOG_EVENT_ROUTINE pfnLogEventIn, PCLRES_FUNCTION_TABLE *pFunctionTableOut)

Variables

CComModule | _Module
PLOG_EVENT_ROUTINE | g_pfnLogEvent = NULL
PSET_RESOURCE_STATUS_ROUTINE | g_pfnSetResourceStatus = NULL
SC_HANDLE | g_schSCMHandle = NULL

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 173 of file ClRes.cpp.

{
    return ( _Module.GetLockCount() == 0 ) ? S_OK : S_FALSE;

} //*** DllCanUnloadNow

STDAPI DllGetClassObject | ( | REFCLSID | rclsidIn,
 |  | REFIID | riidIn,
 |  | LPVOID * | ppvOut
 | ) |  |

Definition at line 203 of file ClRes.cpp.

{
    return _Module.GetClassObject( rclsidIn, riidIn, ppvOut );

} //*** DllGetClassObject

BOOL WINAPI DllMain | ( | HINSTANCE | hInstanceIn,
 |  | DWORD | nReasonIn,
 |  | LPVOID | ReservedIn
 | ) |  |

Definition at line 116 of file ClRes.cpp.

{
    BOOL    fSuccess = TRUE;

    //
    // Perform global initialization.
    //

    switch ( nReasonIn )
    {
        case DLL_PROCESS_ATTACH:
            _Module.Init( ObjectMap, hInstanceIn );
            DisableThreadLibraryCalls( hInstanceIn );
            break;

        case DLL_PROCESS_DETACH:
            _Module.Term();
            break;

    } // switch: nReason

    //
    // Pass this request off to the resource type-specific routines.
    //

    fSuccess = ClipBookServerDllMain( hInstanceIn, nReasonIn, ReservedIn );

    return fSuccess;

} //*** DllMain

STDAPI DllRegisterServer ( void )

Definition at line 235 of file ClRes.cpp.

{
    //
    //  registers object, typelib and all interfaces in typelib
    //

    return _Module.RegisterServer( TRUE );

} //*** DllRegisterServer

STDAPI DllUnregisterServer ( void )

Definition at line 267 of file ClRes.cpp.

{
    return _Module.UnregisterServer( TRUE );

} //*** DllUnregisterServer

DWORD WINAPI Startup | ( | LPCWSTR | pwszResourceTypeIn,
 |  | DWORD | nMinVersionSupportedIn,
 |  | DWORD | nMaxVersionSupportedIn,
 |  | PSET_RESOURCE_STATUS_ROUTINE | pfnSetResourceStatusIn,
 |  | PLOG_EVENT_ROUTINE | pfnLogEventIn,
 |  | PCLRES_FUNCTION_TABLE * | pFunctionTableOut
 | ) |  |

Definition at line 337 of file ClRes.cpp.

{
    DWORD   sc = ERROR_CLUSTER_RESNAME_NOT_FOUND;

    //
    // Save the function pointers if they haven't been saved yet.
    //

    if ( g_pfnLogEvent == NULL )
    {
        g_pfnLogEvent = pfnLogEventIn;
        g_pfnSetResourceStatus = pfnSetResourceStatusIn;
    } // if: function pointers specified

    //
    // Call the resource type-specific Startup routine.
    //

    if ( NIStringCompareW( pwszResourceTypeIn, RESTYPE_NAME, RTL_NUMBER_OF( RESTYPE_NAME ) ) == 0 )
    {
        sc = ClipBookServerStartup(
                  pwszResourceTypeIn
                , nMinVersionSupportedIn
                , nMaxVersionSupportedIn
                , pfnSetResourceStatusIn
                , pfnLogEventIn
                , pFunctionTableOut
                );
    } // if: ClipBook Server resource type

    return sc;

} //*** Startup

Variable Documentation

CComModule _Module

Definition at line 30 of file ClRes.cpp.

PLOG_EVENT_ROUTINE g_pfnLogEvent = NULL

Definition at line 44 of file ClRes.cpp.

PSET_RESOURCE_STATUS_ROUTINE g_pfnSetResourceStatus = NULL

Definition at line 47 of file ClRes.cpp.

SC_HANDLE g_schSCMHandle = NULL

Definition at line 50 of file ClRes.cpp.

Generated on Wed Nov 13 2024 16:54:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/ClipBookServer/ClipBook Server/ClRes.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • ClipBookServer
  • ClipBook Server
Defines | Functions | Variables

ClRes.h File Reference

#include <atlbase.h>
#include <atlcom.h>
#include <ClusCfgServer.h>
#include <ClusCfgGuids.h>
#include "MgdResource.h"
#include "resource.h"
#include <windows.h>
#include <clusapi.h>
#include <resapi.h>
#include <stdio.h>
#include <strsafe.h>
#include <assert.h>
#include "StringUtils.h"
#include "guids.h"
#include "resource.h"
#include "StringUtils.h"
#include "guids.h"

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _UNICODE 1
#define | _WIN32_WINNT 0x0502
#define | CLIPBOOKSERVER_SVCNAME L"ClipSrv"
#define | DBG_PRINT printf
#define | RESOURCE_TYPE_IP_ADDRESS L"IP Address"
#define | RESOURCE_TYPE_NETWORK_NAME L"Network Name"
#define | RESTYPE_DLL_NAME L"ClipBook Server.dll"
#define | RESTYPE_NAME L"ClipBook Server"
#define | RTL_NUMBER_OF(A) (sizeof(A)/sizeof((A)[0]))
#define | TypeSafeParams(_interface, _ppunk) IID_##_interface, reinterpret_cast< void ** >( static_cast< _interface ** >( _ppunk ) )
#define | TypeSafeQI(_interface, _ppunk) QueryInterface( TypeSafeParams( _interface, _ppunk ) )
#define | UNICODE 1

Functions

BOOL WINAPI | ClipBookServerDllMain (HINSTANCE hDllHandleIn, DWORD nReasonIn, LPVOID ReservedIn)
DWORD WINAPI | ClipBookServerStartup (LPCWSTR pwszResourceTypeIn, DWORD nMinVersionSupportedIn, DWORD nMaxVersionSupportedIn, PSET_RESOURCE_STATUS_ROUTINE pfnSetResourceStatusIn, PLOG_EVENT_ROUTINE pfnLogEventIn, PCLRES_FUNCTION_TABLE *pFunctionTableOut)

Variables

CComModule | _Module
PLOG_EVENT_ROUTINE | g_pfnLogEvent
PSET_RESOURCE_STATUS_ROUTINE | g_pfnSetResourceStatus
SC_HANDLE | g_schSCMHandle

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 31 of file ClRes.h.

#define _UNICODE 1

Definition at line 30 of file ClRes.h.

#define _WIN32_WINNT 0x0502

Definition at line 33 of file ClRes.h.

#define CLIPBOOKSERVER_SVCNAME L"ClipSrv"

Definition at line 96 of file ClRes.h.

#define DBG_PRINT printf

Definition at line 120 of file ClRes.h.

#define RESOURCE_TYPE_IP_ADDRESS L"IP Address"

Definition at line 117 of file ClRes.h.

#define RESOURCE_TYPE_NETWORK_NAME L"Network Name"

Definition at line 118 of file ClRes.h.

#define RESTYPE_DLL_NAME L"ClipBook Server.dll"

Definition at line 90 of file ClRes.h.

#define RESTYPE_NAME L"ClipBook Server"

Definition at line 84 of file ClRes.h.

#define RTL_NUMBER_OF ( A ) (sizeof(A)/sizeof((A)[0]))

Definition at line 150 of file ClRes.h.

#define TypeSafeParams | ( | _interface,
 |  | _ppunk |
 | ) |  | IID_##_interface, reinterpret_cast< void ** >( static_cast< _interface ** >( _ppunk ) )

Definition at line 158 of file ClRes.h.

#define TypeSafeQI | ( | _interface,
 |  | _ppunk |
 | ) |  | QueryInterface( TypeSafeParams( _interface, _ppunk ) )

Definition at line 163 of file ClRes.h.

#define UNICODE 1

Definition at line 29 of file ClRes.h.

Function Documentation

BOOL WINAPI ClipBookServerDllMain | ( | HINSTANCE | hDllHandleIn,
 |  | DWORD | nReasonIn,
 |  | LPVOID | ReservedIn
 | ) |  |

Definition at line 179 of file ClipBook Server.cpp.

{
    BOOL    fSuccess = TRUE;
    DWORD   sc = ERROR_SUCCESS;

    UNREFERENCED_PARAMETER( hDllHandleIn );
    UNREFERENCED_PARAMETER( ReservedIn );

    switch ( nReasonIn )
    {
        case DLL_PROCESS_ATTACH:
            g_hSingleInstanceSemaphoreClipBookServer = CreateSemaphoreW(
                  NULL
                , 0
                , 1
                , CLIPBOOKSERVER_SINGLE_INSTANCE_SEMAPHORE
                );
            sc = GetLastError();
            if ( g_hSingleInstanceSemaphoreClipBookServer == NULL )
            {
                fSuccess = FALSE;
                goto Cleanup;
            } // if: error creating semaphore

            if ( sc != ERROR_ALREADY_EXISTS )
            {
                // If the semaphore didnt exist, set its initial count to 1.
                ReleaseSemaphore( g_hSingleInstanceSemaphoreClipBookServer, 1, NULL );
            } // if: semaphore didn't already exist

            break;

        case DLL_PROCESS_DETACH:
            if ( g_hSingleInstanceSemaphoreClipBookServer != NULL )
            {
                CloseHandle( g_hSingleInstanceSemaphoreClipBookServer );
                g_hSingleInstanceSemaphoreClipBookServer = NULL;
            } // if: single instance semaphore was created

            if ( g_schSCMHandle != NULL )
            {
                CloseServiceHandle( g_schSCMHandle );
                g_schSCMHandle = NULL;
            } // if: global SCM handle was opened

            break;

    } // switch: nReason

Cleanup:

    return fSuccess;

} //*** ClipBookServerDllMain

DWORD WINAPI ClipBookServerStartup | ( | LPCWSTR | pwszResourceTypeIn,
 |  | DWORD | nMinVersionSupportedIn,
 |  | DWORD | nMaxVersionSupportedIn,
 |  | PSET_RESOURCE_STATUS_ROUTINE | pfnSetResourceStatusIn,
 |  | PLOG_EVENT_ROUTINE | pfnLogEventIn,
 |  | PCLRES_FUNCTION_TABLE * | pFunctionTableOut
 | ) |  |

Definition at line 303 of file ClipBook Server.cpp.

{
    DWORD sc = ERROR_SUCCESS;

    // These are stored in the calling DllMain.
    UNREFERENCED_PARAMETER( pfnSetResourceStatusIn );
    UNREFERENCED_PARAMETER( pfnLogEventIn );

    if (   (nMinVersionSupportedIn > CLRES_VERSION_V1_00)
        || (nMaxVersionSupportedIn < CLRES_VERSION_V1_00) )
    {
        sc = ERROR_REVISION_MISMATCH;
    } // if: version not supported
    else if ( NIStringCompareW( pwszResourceTypeIn, RESTYPE_NAME, RTL_NUMBER_OF( RESTYPE_NAME ) ) == 0 )
    {
        *pFunctionTableOut = &g_ClipBookServerFunctionTable;
        sc = ERROR_SUCCESS;
    } // else if: we support this type of resource
    else
    {
        //
        // We don't support this resource type.
        //

        sc = ERROR_CLUSTER_RESNAME_NOT_FOUND;
    } // else: resource type name not supported

    return sc;

} //*** ClipBookServerStartup

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

PLOG_EVENT_ROUTINE g_pfnLogEvent

Definition at line 44 of file ClRes.cpp.

PSET_RESOURCE_STATUS_ROUTINE g_pfnSetResourceStatus

Definition at line 47 of file ClRes.cpp.

SC_HANDLE g_schSCMHandle

Definition at line 50 of file ClRes.cpp.

Generated on Wed Nov 13 2024 16:54:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/ClipBookServer/ClipBook Server/CMgdClusCfgInit.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • ClipBookServer
  • ClipBook Server

CMgdClusCfgInit.cpp File Reference

#include "clres.h"
#include "CMgdClusCfgInit.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/ClipBookServer/ClipBook Server/CMgdClusCfgInit.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • ClipBookServer
  • ClipBook Server
Classes

CMgdClusCfgInit.h File Reference

#include "clres.h"

Go to the source code of this file.

Classes

class CMgdClusCfgInit
Generated on Wed Nov 13 2024 16:54:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/ClipBookServer/ClipBook Server/CMgdResType.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • ClipBookServer
  • ClipBook Server
Defines

CMgdResType.cpp File Reference

#include "clres.h"
#include "CMgdResType.h"
#include "MgdResource_i.c"

Go to the source code of this file.

Defines

#define | CLUSTER_RESTYPE_DEFAULT_IS_ALIVE ( 60 * 1000 )
#define | CLUSTER_RESTYPE_DEFAULT_LOOKS_ALIVE ( 5 * 1000 )

Define Documentation

#define CLUSTER_RESTYPE_DEFAULT_IS_ALIVE ( 60 * 1000 )

Definition at line 41 of file CMgdResType.cpp.

#define CLUSTER_RESTYPE_DEFAULT_LOOKS_ALIVE ( 5 * 1000 )

Definition at line 40 of file CMgdResType.cpp.

Generated on Wed Nov 13 2024 16:54:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/ClipBookServer/ClipBook Server/CMgdResType.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • ClipBookServer
  • ClipBook Server
Classes

CMgdResType.h File Reference

#include "clres.h"
#include "CMgdClusCfgInit.h"
#include "clres.h"
#include "CMgdClusCfgInit.h"

Go to the source code of this file.

Classes

class CMgdResType
Generated on Wed Nov 13 2024 16:54:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/ClipBookServer/ClipBook Server/Guids.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • ClipBookServer
  • ClipBook Server
Functions

Guids.h File Reference

#include <initguid.h>

Go to the source code of this file.

Functions

DEFINE_GUID (RESTYPE_ClipBookServer, 0xE83C5122, 0x8C18, 0x42FA, 0x99, 0xE7, 0x22, 0x1B, 0x51, 0xE1, 0x65, 0x05)
DEFINE_GUID (TASKID_Minor_ClipBookServer_ResType_CommitChanges, 0xE4F7A345, 0xEF7C, 0x45F1, 0x95, 0xFE, 0xD6, 0xBF, 0x9C, 0x03, 0x4F, 0xEE)
DEFINE_GUID (TASKID_Minor_ClipBookServer_Initialize, 0x308A300C, 0x2A40, 0x4818, 0xB5, 0xD2, 0x7B, 0x65, 0xE3, 0x9F, 0xB4, 0xFA)
DEFINE_GUID (CLSID_CoClipBookServerEx, 0x9E747617, 0xE5D1, 0x42D7, 0xA8, 0xC3, 0x0F, 0xC1, 0xD4, 0x18, 0xB7, 0x6B)

Function Documentation

DEFINE_GUID | ( | RESTYPE_ClipBookServer | ,
 |  | 0xE83C5122 | ,
 |  | 0x8C18 | ,
 |  | 0x42FA | ,
 |  | 0x99 | ,
 |  | 0xE7 | ,
 |  | 0x22 | ,
 |  | 0x1B | ,
 |  | 0x51 | ,
 |  | 0xE1 | ,
 |  | 0x65 | ,
 |  | 0x05 |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_ClipBookServer_ResType_CommitChanges | ,
 |  | 0xE4F7A345 | ,
 |  | 0xEF7C | ,
 |  | 0x45F1 | ,
 |  | 0x95 | ,
 |  | 0xFE | ,
 |  | 0xD6 | ,
 |  | 0xBF | ,
 |  | 0x9C | ,
 |  | 0x03 | ,
 |  | 0x4F | ,
 |  | 0xEE |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_ClipBookServer_Initialize | ,
 |  | 0x308A300C | ,
 |  | 0x2A40 | ,
 |  | 0x4818 | ,
 |  | 0xB5 | ,
 |  | 0xD2 | ,
 |  | 0x7B | ,
 |  | 0x65 | ,
 |  | 0xE3 | ,
 |  | 0x9F | ,
 |  | 0xB4 | ,
 |  | 0xFA |
 | ) |  |
DEFINE_GUID | ( | CLSID_CoClipBookServerEx | ,
 |  | 0x9E747617 | ,
 |  | 0xE5D1 | ,
 |  | 0x42D7 | ,
 |  | 0xA8 | ,
 |  | 0xC3 | ,
 |  | 0x0F | ,
 |  | 0xC1 | ,
 |  | 0xD4 | ,
 |  | 0x18 | ,
 |  | 0xB7 | ,
 |  | 0x6B |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/ClipBookServer/ClipBook Server/MgdResource.idl File Reference

  • WinBase
  • Cluster
  • Win2003
  • ClipBookServer
  • ClipBook Server
Classes | Namespaces | Functions

MgdResource.idl File Reference

Go to the source code of this file.

Classes

class | MGDRESOURCELib::ClipBookServer

Namespaces

namespace | MGDRESOURCELib

Functions

MGDRESOURCELib::importlib ("stdole32.tlb")
MGDRESOURCELib::importlib ("stdole2.tlb")
Generated on Wed Nov 13 2024 16:54:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/ClipBookServer/ClipBook Server/Resource.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • ClipBookServer
  • ClipBook Server
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_CMgdResType 2001
#define | IDS_CLUSCFG_ERROR_CONFIGURING_RESTYPE_FAILED 2012
#define | IDS_CLUSCFG_ERROR_GETCOMPUTERNAME_FAILED 2013
#define | IDS_CLUSCFG_INFO_CONFIGURED_RESTYPE 2011
#define | IDS_CLUSCFG_INFO_CONFIGURING_RESTYPE 2010
#define | IDS_RESTYPE_DISPLAYNAME 2002

Define Documentation

#define IDR_CMgdResType 2001

Definition at line 1 of file Resource.h.

#define IDS_CLUSCFG_ERROR_CONFIGURING_RESTYPE_FAILED 2012

Definition at line 5 of file Resource.h.

#define IDS_CLUSCFG_ERROR_GETCOMPUTERNAME_FAILED 2013

Definition at line 6 of file Resource.h.

#define IDS_CLUSCFG_INFO_CONFIGURED_RESTYPE 2011

Definition at line 4 of file Resource.h.

#define IDS_CLUSCFG_INFO_CONFIGURING_RESTYPE 2010

Definition at line 3 of file Resource.h.

#define IDS_RESTYPE_DISPLAYNAME 2002

Definition at line 2 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/ClipBookServer/ClipBook Server/StringUtils.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • ClipBookServer
  • ClipBook Server
Functions

StringUtils.cpp File Reference

#include "StringUtils.h"

Go to the source code of this file.

Functions

int | BSTRCompareW (BSTR bstrString1In, BSTR bstrString2In)
HRESULT | HrFormatStringIntoBSTR (LPCWSTR pcwszFmtIn, BSTR *pbstrInout,...)
HRESULT | HrFormatStringIntoBSTR (HINSTANCE hInstanceIn, LANGID langidIn, UINT idsIn, BSTR *pbstrInout,...)
HRESULT | HrFormatStringWithVAListIntoBSTR (HINSTANCE hInstanceIn, LANGID langidIn, UINT idsIn, BSTR *pbstrInout, va_list valistIn)
HRESULT | HrFormatStringWithVAListIntoBSTR (LPCWSTR pcwszFmtIn, BSTR *pbstrInout, va_list valistIn)
HRESULT | HrLoadStringIntoBSTR (HINSTANCE hInstanceIn, LANGID langidIn, UINT idsIn, BSTR *pbstrInout)
int | IBSTRCompareW (BSTR bstrString1In, BSTR bstrString2In)
int | IStringCompareW (LPCWSTR pcwszString1In, LPCWSTR pcwszString2In)
int | IStringCompareW (LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)
int | NBSTRCompareW (BSTR bstrString1In, BSTR bstrString2In)
int | NIBSTRCompareW (BSTR bstrString1In, BSTR bstrString2In)
int | NIStringCompareW (LPCWSTR pcwszString1In, LPCWSTR pcwszString2In, size_t cchIn)
int | NIStringCompareW (LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)
int | NStringCompareW (LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)
int | NStringCompareW (LPCWSTR pcwszString1In, LPCWSTR pcwszString2In, size_t cchIn)
int | StringCompareW (LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)
int | StringCompareW (LPCWSTR pcwszString1In, LPCWSTR pcwszString2In)
int | WrapCompareString (BOOL fCaseSensitive, LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)

Function Documentation

int BSTRCompareW | ( | BSTR | bstrString1In,
 |  | BSTR | bstrString2In
 | ) |  |

Definition at line 100 of file StringUtils.cpp.

{
    return WrapCompareString(
                  TRUE
                , static_cast< LPCWSTR >( bstrString1In )
                , SysStringLen( bstrString1In )
                , static_cast< LPCWSTR >( bstrString2In )
                , SysStringLen( bstrString2In )
                );
} //*** BSTRCompareW

HRESULT HrFormatStringIntoBSTR | ( | LPCWSTR | pcwszFmtIn,
 |  | BSTR * | pbstrInout,
 |  |  | ...
 | ) |  |

Definition at line 773 of file StringUtils.cpp.

{
    HRESULT hr = S_OK;
    va_list valist;

    va_start( valist, pbstrInout );

    hr = HrFormatStringWithVAListIntoBSTR( pcwszFmtIn, pbstrInout, valist );

    va_end( valist );

    return hr;

} //*** HrFormatStringIntoBSTR

HRESULT HrFormatStringIntoBSTR | ( | HINSTANCE | hInstanceIn,
 |  | LANGID | langidIn,
 |  | UINT | idsIn,
 |  | BSTR * | pbstrInout,
 |  |  | ...
 | ) |  |

Definition at line 578 of file StringUtils.cpp.

{
    HRESULT hr;
    va_list valist;

    va_start( valist, pbstrInout );

    hr = HrFormatStringWithVAListIntoBSTR(
                          hInstanceIn
                        , langidIn
                        , idsIn
                        , pbstrInout
                        , valist
                        );

    va_end( valist );

    return hr;

} //*** HrFormatStringIntoBSTR

HRESULT HrFormatStringWithVAListIntoBSTR | ( | HINSTANCE | hInstanceIn,
 |  | LANGID | langidIn,
 |  | UINT | idsIn,
 |  | BSTR * | pbstrInout,
 |  | va_list | valistIn
 | ) |  |

Definition at line 651 of file StringUtils.cpp.

{
    HRESULT hr = S_OK;
    BSTR    bstrStringResource = NULL;
    DWORD   cch;
    LPWSTR  pwsz = NULL;

    assert( pbstrInout != NULL );

    if ( pbstrInout == NULL )
    {
        hr = E_POINTER;
        goto Cleanup;
    } // if:

    //
    // Load the string resource.
    //

    hr = HrLoadStringIntoBSTR( hInstanceIn, langidIn, idsIn, &bstrStringResource );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    //
    // Format the message with the arguments.
    //

    cch = FormatMessage(
                      ( FORMAT_MESSAGE_ALLOCATE_BUFFER
                      | FORMAT_MESSAGE_FROM_STRING )
                    , bstrStringResource
                    , 0
                    , 0
                    , (LPWSTR) &pwsz
                    , 0
                    , &valistIn
                    );
    if ( cch == 0 )
    {
        hr = HRESULT_FROM_WIN32( GetLastError() );
        goto Cleanup;
    } // if:

    //
    // If previously allocated free it before re-allocating it.
    //

    if ( *pbstrInout != NULL )
    {
        SysFreeString( *pbstrInout );
        *pbstrInout = NULL;
    } // if:

    //
    // Allocate a BSTR for the string.
    //

    *pbstrInout = SysAllocStringLen( pwsz, cch );
    if ( *pbstrInout == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if:

Cleanup:

    SysFreeString( bstrStringResource );
    LocalFree( pwsz );

    return hr;

} //*** HrFormatStringWithVAListIntoBSTR

HRESULT HrFormatStringWithVAListIntoBSTR | ( | LPCWSTR | pcwszFmtIn,
 |  | BSTR * | pbstrInout,
 |  | va_list | valistIn
 | ) |  |

Definition at line 831 of file StringUtils.cpp.

{
    HRESULT hr = S_OK;
    DWORD   cch;
    LPWSTR  pwsz = NULL;

    if (    ( pbstrInout == NULL )
        ||  ( pcwszFmtIn == NULL )
       )
    {
        hr = E_POINTER;
        goto Cleanup;
    } // if:

    //
    // Format the message with the arguments.
    //

    cch = FormatMessage(
                      ( FORMAT_MESSAGE_ALLOCATE_BUFFER
                      | FORMAT_MESSAGE_FROM_STRING )
                    , pcwszFmtIn
                    , 0
                    , 0
                    , (LPWSTR) &pwsz
                    , 0
                    , &valistIn
                    );
    if ( cch == 0 )
    {
        hr = HRESULT_FROM_WIN32( GetLastError() );
        goto Cleanup;
    } // if:

    //
    // If previously allocated free it before re-allocating it.
    //

    if ( *pbstrInout != NULL )
    {
        SysFreeString( *pbstrInout );
        *pbstrInout = NULL;
    } // if:

    //
    // Allocate a BSTR for the string.
    //

    *pbstrInout = SysAllocStringLen( pwsz, cch );
    if ( *pbstrInout == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if:

Cleanup:

    LocalFree( pwsz );

    return hr;

} //*** HrFormatStringWithVAListIntoBSTR

HRESULT HrLoadStringIntoBSTR | ( | HINSTANCE | hInstanceIn,
 |  | LANGID | langidIn,
 |  | UINT | idsIn,
 |  | BSTR * | pbstrInout
 | ) |  |

Definition at line 341 of file StringUtils.cpp.

{
    HRESULT hr              = S_OK;
    HRSRC   hrsrc           = NULL;
    HGLOBAL hgbl            = NULL;
    int     cch             = 0;
    PBYTE   pbStringData;
    PBYTE   pbStringDataMax;
    PBYTE   pbStringTable;
    int     cbStringTable;
    int     nTable;
    int     nOffset;
    int     idxString;

    assert( idsIn != 0 );
    assert( pbstrInout != NULL );

    if ( pbstrInout == NULL )
    {
        hr = E_POINTER;
        goto Cleanup;
    } // if:

    if ( hInstanceIn == NULL )
    {
        hInstanceIn = _Module.m_hInstResource;
    } // if:

    //
    //  The resource Id specified must be converted to an index into
    //  a Windows StringTable.
    //

    nTable = idsIn / 16;
    nOffset = idsIn - (nTable * 16);

    //
    //  Internal Table Id's start at 1 not 0.
    //

    nTable++;

    //
    // Find the part of the string table where the string resides.
    //

    //
    //  Find the table containing the string.
    // First try to load the language specified.  If we can't find it we
    // try the "neutral" language.
    //

    hrsrc = FindResourceEx( hInstanceIn, RT_STRING, MAKEINTRESOURCE( nTable ), langidIn );
    if ( ( hrsrc == NULL ) && ( GetLastError() == ERROR_RESOURCE_LANG_NOT_FOUND ) )
    {
        hrsrc = FindResourceEx(
                      hInstanceIn
                    , RT_STRING
                    , MAKEINTRESOURCE( nTable )
                    , MAKELANGID( LANG_NEUTRAL, SUBLANG_NEUTRAL )
                    );
    } // if: FindResourceEx failed

    if ( hrsrc == NULL )
    {
        hr = HRESULT_FROM_WIN32( GetLastError() );
        goto Cleanup;
    } // if:

    //
    //  Load the table.
    //

    hgbl = LoadResource( hInstanceIn, hrsrc );
    if ( hgbl == NULL )
    {
        hr = HRESULT_FROM_WIN32( GetLastError() );
        goto Cleanup;
    } // if:

    //
    //  Lock the table so we access its data.
    //

    pbStringTable = reinterpret_cast< PBYTE >( LockResource( hgbl ) );
    if ( pbStringTable == NULL )
    {
        hr = HRESULT_FROM_WIN32( GetLastError() );
        goto Cleanup;
    } // if:

    cbStringTable = SizeofResource( hInstanceIn, hrsrc );
    assert( cbStringTable != 0 );

    //
    //  Set the data pointer to the beginning of the table.
    //

    pbStringData = pbStringTable;
    pbStringDataMax = pbStringTable + cbStringTable;

    //
    // Skip strings in the block of 16 which are before the desired string.
    //

    for ( idxString = 0 ; idxString <= nOffset ; idxString++ )
    {
        assert( pbStringData != NULL );
        assert( pbStringData < pbStringDataMax );

        //
        //  Get the number of characters excluding the '\0'.
        //

        cch = * ( (USHORT *) pbStringData );

        //
        //  Found the string.
        //

        if ( idxString == nOffset )
        {
            if ( cch == 0 )
            {
                hr = HRESULT_FROM_WIN32( ERROR_RESOURCE_NAME_NOT_FOUND );
                goto Cleanup;
            } // if:

            //
            //  Skip over the string length to get the string.
            //

            pbStringData += sizeof( WCHAR );

            break;
        } // if: found the string

        //
        //  Add one to account for the string length.
        //  A string length of 0 still takes 1 WCHAR for the length portion.
        //

        cch++;

        //
        //  Skip over this string to get to the next string.
        //

        pbStringData += ( cch * sizeof( WCHAR ) );

    } // for: each string in the block of 16 strings in the table

    //
    //  Note: nStringLen is the number of characters in the string not including the '\0'.
    //

    //
    // If previously allocated free it before re-allocating it.
    //

    if ( *pbstrInout != NULL )
    {
        SysFreeString( *pbstrInout );
        *pbstrInout = NULL;
    } // if: string was allocated previously

    //
    // Allocate a BSTR for the string.
    //

    *pbstrInout = SysAllocStringLen( (OLECHAR *) pbStringData, cch );
    if ( *pbstrInout == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if:

Cleanup:

    return hr;

} //*** HrLoadStringIntoBSTR

int IBSTRCompareW | ( | BSTR | bstrString1In,
 |  | BSTR | bstrString2In
 | ) |  |

Definition at line 85 of file StringUtils.cpp.

{
    return WrapCompareString(
                  FALSE
                , static_cast< LPCWSTR >( bstrString1In )
                , SysStringLen( bstrString1In )
                , static_cast< LPCWSTR >( bstrString2In )
                , SysStringLen( bstrString2In )
                );
} //*** IBSTRCompareW

int IStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | LPCWSTR | pcwszString2In
 | ) |  |

Definition at line 115 of file StringUtils.cpp.

{
    return WrapCompareString(
                  FALSE
                , pcwszString1In
                , static_cast< size_t >( -1 )
                , pcwszString2In
                , static_cast< size_t >( -1 )
            );
} //*** IStringCompareW

int IStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 145 of file StringUtils.cpp.

{
    return WrapCompareString(
                  FALSE
                , pcwszString1In
                , cch1In
                , pcwszString2In
                , cch2In
                );
} //*** IStringCompareW

int NBSTRCompareW | ( | BSTR | bstrString1In,
 |  | BSTR | bstrString2In
 | ) |  |

Definition at line 203 of file StringUtils.cpp.

{
    size_t cchMin;

    cchMin = min( SysStringLen( bstrString1In ), SysStringLen( bstrString2In ) );

    return WrapCompareString(
                  TRUE
                , static_cast< LPCWSTR >( bstrString1In )
                , cchMin
                , static_cast< LPCWSTR >( bstrString2In )
                , cchMin
                );
} //*** NBSTRCompareW

int NIBSTRCompareW | ( | BSTR | bstrString1In,
 |  | BSTR | bstrString2In
 | ) |  |

Definition at line 184 of file StringUtils.cpp.

{
    size_t cchMin;

    cchMin = min( SysStringLen( bstrString1In ), SysStringLen( bstrString2In ) );

    return WrapCompareString(
                  FALSE
                , static_cast< LPCWSTR >( bstrString1In )
                , cchMin
                , static_cast< LPCWSTR >( bstrString2In )
                , cchMin
                );
} //*** NIBSTRCompareW

int NIStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cchIn
 | ) |  |

Definition at line 222 of file StringUtils.cpp.

{
    return WrapCompareString(
                  FALSE
                , pcwszString1In
                , cchIn
                , pcwszString2In
                , cchIn
                );
} //*** NIStringCompareW

int NIStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 254 of file StringUtils.cpp.

{
    return WrapCompareString(
                  FALSE
                , pcwszString1In
                , min( cch1In, cch2In )
                , pcwszString2In
                , min( cch1In, cch2In )
                );
} //*** NIStringCompareW

int NStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 271 of file StringUtils.cpp.

{
    return WrapCompareString(
                  TRUE
                , pcwszString1In
                , min( cch1In, cch2In )
                , pcwszString2In
                , min( cch1In, cch2In )
                );
} //*** NStringCompareW

int NStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cchIn
 | ) |  |

Definition at line 238 of file StringUtils.cpp.

{
    return WrapCompareString(
                  TRUE
                , pcwszString1In
                , cchIn
                , pcwszString2In
                , cchIn
                );
} //*** NIStringCompareW

int StringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 162 of file StringUtils.cpp.

{
    return WrapCompareString(
                  TRUE
                , pcwszString1In
                , cch1In
                , pcwszString2In
                , cch2In
                );
} //*** StringCompareW

int StringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | LPCWSTR | pcwszString2In
 | ) |  |

Definition at line 130 of file StringUtils.cpp.

{
    return WrapCompareString(
                  TRUE
                , pcwszString1In
                , static_cast< size_t >( -1 )
                , pcwszString2In
                , static_cast< size_t >( -1 )
                );
} //*** StringCompareW

int WrapCompareString | ( | BOOL | fCaseSensitive,
 |  | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 57 of file StringUtils.cpp.

{
    int nRet;

    nRet = CompareStringW(
              LOCALE_SYSTEM_DEFAULT
            , fCaseSensitive ? 0 : NORM_IGNORECASE
            , pcwszString1In
            , static_cast< DWORD >( cch1In )
            , pcwszString2In
            , static_cast< DWORD >( cch2In )
            );

    return nRet - CSTR_EQUAL; // CSTR_LT < CSTR_EQUAL < CSTR_GT

} // *** WrapCompareString

Generated on Wed Nov 13 2024 16:54:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/ClipBookServer/ClipBook Server/StringUtils.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • ClipBookServer
  • ClipBook Server
Functions

StringUtils.h File Reference

#include "ClRes.h"

Go to the source code of this file.

Functions

int | BSTRCompareW (BSTR bstrString1In, BSTR bstrString2In)
HRESULT | HrFormatStringIntoBSTR (HINSTANCE hInstanceIn, LANGID langidIn, UINT idsIn, BSTR *pbstrInout,...)
HRESULT | HrFormatStringIntoBSTR (HINSTANCE hInstanceIn, UINT idsIn, BSTR *pbstrInout,...)
HRESULT | HrFormatStringIntoBSTR (UINT idsIn, BSTR *pbstrInout,...)
HRESULT | HrFormatStringIntoBSTR (LPCWSTR pcwszFmtIn, BSTR *pbstrInout,...)
HRESULT | HrFormatStringWithVAListIntoBSTR (HINSTANCE hInstanceIn, LANGID langidIn, UINT idsIn, BSTR *pbstrInout, va_list valistIn)
HRESULT | HrFormatStringWithVAListIntoBSTR (HINSTANCE hInstanceIn, UINT idsIn, BSTR *pbstrInout, va_list valistIn)
HRESULT | HrFormatStringWithVAListIntoBSTR (LPCWSTR pcwszFmtIn, BSTR *pbstrInout, va_list valistIn)
HRESULT | HrLoadStringIntoBSTR (HINSTANCE hInstanceIn, UINT idsIn, BSTR *pbstrInout)
HRESULT | HrLoadStringIntoBSTR (HINSTANCE hInstanceIn, LANGID langidIn, UINT idsIn, BSTR *pbstrInout)
HRESULT | HrLoadStringIntoBSTR (UINT idsIn, BSTR *pbstrInout)
int | IBSTRCompareW (BSTR bstrString1In, BSTR bstrString2In)
int | IStringCompareW (LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)
int | IStringCompareW (LPCWSTR pcwszString1In, LPCWSTR pcwszString2In)
int | NBSTRCompareW (BSTR bstrString1In, BSTR bstrString2In)
int | NIBSTRCompareW (BSTR bstrString1In, BSTR bstrString2In)
int | NIStringCompareW (LPCWSTR pcwszString1In, LPCWSTR pcwszString2In, size_t cchIn)
int | NIStringCompareW (LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)
int | NStringCompareW (LPCWSTR pcwszString1In, LPCWSTR pcwszString2In, size_t cchIn)
int | NStringCompareW (LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)
int | StringCompareW (LPCWSTR pcwszString1In, LPCWSTR pcwszString2In)
int | StringCompareW (LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)

Function Documentation

int BSTRCompareW | ( | BSTR | bstrString1In,
 |  | BSTR | bstrString2In
 | ) |  |

Definition at line 100 of file StringUtils.cpp.

{
    return WrapCompareString(
                  TRUE
                , static_cast< LPCWSTR >( bstrString1In )
                , SysStringLen( bstrString1In )
                , static_cast< LPCWSTR >( bstrString2In )
                , SysStringLen( bstrString2In )
                );
} //*** BSTRCompareW

HRESULT HrFormatStringIntoBSTR | ( | HINSTANCE | hInstanceIn,
 |  | LANGID | langidIn,
 |  | UINT | idsIn,
 |  | BSTR * | pbstrInout,
 |  |  | ...
 | ) |  |

Definition at line 578 of file StringUtils.cpp.

{
    HRESULT hr;
    va_list valist;

    va_start( valist, pbstrInout );

    hr = HrFormatStringWithVAListIntoBSTR(
                          hInstanceIn
                        , langidIn
                        , idsIn
                        , pbstrInout
                        , valist
                        );

    va_end( valist );

    return hr;

} //*** HrFormatStringIntoBSTR

HRESULT HrFormatStringIntoBSTR | ( | HINSTANCE | hInstanceIn,
 |  | UINT | idsIn,
 |  | BSTR * | pbstrInout,
 |  |  | ... |
 | ) |  |  | [inline]

Definition at line 189 of file StringUtils.h.

{
    HRESULT hr;
    va_list valist;

    va_start( valist, pbstrInout );

    hr = HrFormatStringWithVAListIntoBSTR(
                  hInstanceIn
                , MAKELANGID( LANG_NEUTRAL, SUBLANG_NEUTRAL )
                , idsIn
                , pbstrInout
                , valist
                );

    va_end( valist );

    return hr;

} //*** HrFormatStringIntoBSTR

HRESULT HrFormatStringIntoBSTR | ( | UINT | idsIn,
 |  | BSTR * | pbstrInout,
 |  |  | ... |
 | ) |  |  | [inline]

Definition at line 217 of file StringUtils.h.

{
    HRESULT hr;
    va_list valist;

    va_start( valist, pbstrInout );

    hr = HrFormatStringWithVAListIntoBSTR(
                  NULL
                , MAKELANGID( LANG_NEUTRAL, SUBLANG_NEUTRAL )
                , idsIn
                , pbstrInout
                , valist
                );

    va_end( valist );

    return hr;

} //*** HrFormatStringIntoBSTR

HRESULT HrFormatStringIntoBSTR | ( | LPCWSTR | pcwszFmtIn,
 |  | BSTR * | pbstrInout,
 |  |  | ...
 | ) |  |

Definition at line 773 of file StringUtils.cpp.

{
    HRESULT hr = S_OK;
    va_list valist;

    va_start( valist, pbstrInout );

    hr = HrFormatStringWithVAListIntoBSTR( pcwszFmtIn, pbstrInout, valist );

    va_end( valist );

    return hr;

} //*** HrFormatStringIntoBSTR

HRESULT HrFormatStringWithVAListIntoBSTR | ( | HINSTANCE | hInstanceIn,
 |  | LANGID | langidIn,
 |  | UINT | idsIn,
 |  | BSTR * | pbstrInout,
 |  | va_list | valistIn
 | ) |  |

Definition at line 651 of file StringUtils.cpp.

{
    HRESULT hr = S_OK;
    BSTR    bstrStringResource = NULL;
    DWORD   cch;
    LPWSTR  pwsz = NULL;

    assert( pbstrInout != NULL );

    if ( pbstrInout == NULL )
    {
        hr = E_POINTER;
        goto Cleanup;
    } // if:

    //
    // Load the string resource.
    //

    hr = HrLoadStringIntoBSTR( hInstanceIn, langidIn, idsIn, &bstrStringResource );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    //
    // Format the message with the arguments.
    //

    cch = FormatMessage(
                      ( FORMAT_MESSAGE_ALLOCATE_BUFFER
                      | FORMAT_MESSAGE_FROM_STRING )
                    , bstrStringResource
                    , 0
                    , 0
                    , (LPWSTR) &pwsz
                    , 0
                    , &valistIn
                    );
    if ( cch == 0 )
    {
        hr = HRESULT_FROM_WIN32( GetLastError() );
        goto Cleanup;
    } // if:

    //
    // If previously allocated free it before re-allocating it.
    //

    if ( *pbstrInout != NULL )
    {
        SysFreeString( *pbstrInout );
        *pbstrInout = NULL;
    } // if:

    //
    // Allocate a BSTR for the string.
    //

    *pbstrInout = SysAllocStringLen( pwsz, cch );
    if ( *pbstrInout == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if:

Cleanup:

    SysFreeString( bstrStringResource );
    LocalFree( pwsz );

    return hr;

} //*** HrFormatStringWithVAListIntoBSTR

HRESULT HrFormatStringWithVAListIntoBSTR | ( | HINSTANCE | hInstanceIn,
 |  | UINT | idsIn,
 |  | BSTR * | pbstrInout,
 |  | va_list | valistIn |
 | ) |  |  | [inline]

Definition at line 244 of file StringUtils.h.

{
    return HrFormatStringWithVAListIntoBSTR(
                  hInstanceIn
                , MAKELANGID( LANG_NEUTRAL, SUBLANG_NEUTRAL )
                , idsIn
                , pbstrInout
                , valistIn
                );

} //*** HrFormatStringWithVAListIntoBSTR

HRESULT HrFormatStringWithVAListIntoBSTR | ( | LPCWSTR | pcwszFmtIn,
 |  | BSTR * | pbstrInout,
 |  | va_list | valistIn
 | ) |  |

Definition at line 831 of file StringUtils.cpp.

{
    HRESULT hr = S_OK;
    DWORD   cch;
    LPWSTR  pwsz = NULL;

    if (    ( pbstrInout == NULL )
        ||  ( pcwszFmtIn == NULL )
       )
    {
        hr = E_POINTER;
        goto Cleanup;
    } // if:

    //
    // Format the message with the arguments.
    //

    cch = FormatMessage(
                      ( FORMAT_MESSAGE_ALLOCATE_BUFFER
                      | FORMAT_MESSAGE_FROM_STRING )
                    , pcwszFmtIn
                    , 0
                    , 0
                    , (LPWSTR) &pwsz
                    , 0
                    , &valistIn
                    );
    if ( cch == 0 )
    {
        hr = HRESULT_FROM_WIN32( GetLastError() );
        goto Cleanup;
    } // if:

    //
    // If previously allocated free it before re-allocating it.
    //

    if ( *pbstrInout != NULL )
    {
        SysFreeString( *pbstrInout );
        *pbstrInout = NULL;
    } // if:

    //
    // Allocate a BSTR for the string.
    //

    *pbstrInout = SysAllocStringLen( pwsz, cch );
    if ( *pbstrInout == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if:

Cleanup:

    LocalFree( pwsz );

    return hr;

} //*** HrFormatStringWithVAListIntoBSTR

HRESULT HrLoadStringIntoBSTR | ( | HINSTANCE | hInstanceIn,
 |  | UINT | idsIn,
 |  | BSTR * | pbstrInout |
 | ) |  |  | [inline]

Definition at line 149 of file StringUtils.h.

{
    return HrLoadStringIntoBSTR(
                          hInstanceIn
                        , MAKELANGID( LANG_NEUTRAL, SUBLANG_NEUTRAL )
                        , idsIn
                        , pbstrInout
                        );

} //*** HrLoadStringIntoBSTR

HRESULT HrLoadStringIntoBSTR | ( | HINSTANCE | hInstanceIn,
 |  | LANGID | langidIn,
 |  | UINT | idsIn,
 |  | BSTR * | pbstrInout
 | ) |  |

Definition at line 341 of file StringUtils.cpp.

{
    HRESULT hr              = S_OK;
    HRSRC   hrsrc           = NULL;
    HGLOBAL hgbl            = NULL;
    int     cch             = 0;
    PBYTE   pbStringData;
    PBYTE   pbStringDataMax;
    PBYTE   pbStringTable;
    int     cbStringTable;
    int     nTable;
    int     nOffset;
    int     idxString;

    assert( idsIn != 0 );
    assert( pbstrInout != NULL );

    if ( pbstrInout == NULL )
    {
        hr = E_POINTER;
        goto Cleanup;
    } // if:

    if ( hInstanceIn == NULL )
    {
        hInstanceIn = _Module.m_hInstResource;
    } // if:

    //
    //  The resource Id specified must be converted to an index into
    //  a Windows StringTable.
    //

    nTable = idsIn / 16;
    nOffset = idsIn - (nTable * 16);

    //
    //  Internal Table Id's start at 1 not 0.
    //

    nTable++;

    //
    // Find the part of the string table where the string resides.
    //

    //
    //  Find the table containing the string.
    // First try to load the language specified.  If we can't find it we
    // try the "neutral" language.
    //

    hrsrc = FindResourceEx( hInstanceIn, RT_STRING, MAKEINTRESOURCE( nTable ), langidIn );
    if ( ( hrsrc == NULL ) && ( GetLastError() == ERROR_RESOURCE_LANG_NOT_FOUND ) )
    {
        hrsrc = FindResourceEx(
                      hInstanceIn
                    , RT_STRING
                    , MAKEINTRESOURCE( nTable )
                    , MAKELANGID( LANG_NEUTRAL, SUBLANG_NEUTRAL )
                    );
    } // if: FindResourceEx failed

    if ( hrsrc == NULL )
    {
        hr = HRESULT_FROM_WIN32( GetLastError() );
        goto Cleanup;
    } // if:

    //
    //  Load the table.
    //

    hgbl = LoadResource( hInstanceIn, hrsrc );
    if ( hgbl == NULL )
    {
        hr = HRESULT_FROM_WIN32( GetLastError() );
        goto Cleanup;
    } // if:

    //
    //  Lock the table so we access its data.
    //

    pbStringTable = reinterpret_cast< PBYTE >( LockResource( hgbl ) );
    if ( pbStringTable == NULL )
    {
        hr = HRESULT_FROM_WIN32( GetLastError() );
        goto Cleanup;
    } // if:

    cbStringTable = SizeofResource( hInstanceIn, hrsrc );
    assert( cbStringTable != 0 );

    //
    //  Set the data pointer to the beginning of the table.
    //

    pbStringData = pbStringTable;
    pbStringDataMax = pbStringTable + cbStringTable;

    //
    // Skip strings in the block of 16 which are before the desired string.
    //

    for ( idxString = 0 ; idxString <= nOffset ; idxString++ )
    {
        assert( pbStringData != NULL );
        assert( pbStringData < pbStringDataMax );

        //
        //  Get the number of characters excluding the '\0'.
        //

        cch = * ( (USHORT *) pbStringData );

        //
        //  Found the string.
        //

        if ( idxString == nOffset )
        {
            if ( cch == 0 )
            {
                hr = HRESULT_FROM_WIN32( ERROR_RESOURCE_NAME_NOT_FOUND );
                goto Cleanup;
            } // if:

            //
            //  Skip over the string length to get the string.
            //

            pbStringData += sizeof( WCHAR );

            break;
        } // if: found the string

        //
        //  Add one to account for the string length.
        //  A string length of 0 still takes 1 WCHAR for the length portion.
        //

        cch++;

        //
        //  Skip over this string to get to the next string.
        //

        pbStringData += ( cch * sizeof( WCHAR ) );

    } // for: each string in the block of 16 strings in the table

    //
    //  Note: nStringLen is the number of characters in the string not including the '\0'.
    //

    //
    // If previously allocated free it before re-allocating it.
    //

    if ( *pbstrInout != NULL )
    {
        SysFreeString( *pbstrInout );
        *pbstrInout = NULL;
    } // if: string was allocated previously

    //
    // Allocate a BSTR for the string.
    //

    *pbstrInout = SysAllocStringLen( (OLECHAR *) pbStringData, cch );
    if ( *pbstrInout == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if:

Cleanup:

    return hr;

} //*** HrLoadStringIntoBSTR

HRESULT HrLoadStringIntoBSTR | ( | UINT | idsIn,
 |  | BSTR * | pbstrInout |
 | ) |  |  | [inline]

Definition at line 134 of file StringUtils.h.

{
    return HrLoadStringIntoBSTR(
                          NULL
                        , MAKELANGID( LANG_NEUTRAL, SUBLANG_NEUTRAL )
                        , idsIn
                        , pbstrInout
                        );
} //*** HrLoadStringIntoBSTR

int IBSTRCompareW | ( | BSTR | bstrString1In,
 |  | BSTR | bstrString2In
 | ) |  |

Definition at line 85 of file StringUtils.cpp.

{
    return WrapCompareString(
                  FALSE
                , static_cast< LPCWSTR >( bstrString1In )
                , SysStringLen( bstrString1In )
                , static_cast< LPCWSTR >( bstrString2In )
                , SysStringLen( bstrString2In )
                );
} //*** IBSTRCompareW

int IStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 145 of file StringUtils.cpp.

{
    return WrapCompareString(
                  FALSE
                , pcwszString1In
                , cch1In
                , pcwszString2In
                , cch2In
                );
} //*** IStringCompareW

int IStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | LPCWSTR | pcwszString2In
 | ) |  |

Definition at line 115 of file StringUtils.cpp.

{
    return WrapCompareString(
                  FALSE
                , pcwszString1In
                , static_cast< size_t >( -1 )
                , pcwszString2In
                , static_cast< size_t >( -1 )
            );
} //*** IStringCompareW

int NBSTRCompareW | ( | BSTR | bstrString1In,
 |  | BSTR | bstrString2In
 | ) |  |

Definition at line 203 of file StringUtils.cpp.

{
    size_t cchMin;

    cchMin = min( SysStringLen( bstrString1In ), SysStringLen( bstrString2In ) );

    return WrapCompareString(
                  TRUE
                , static_cast< LPCWSTR >( bstrString1In )
                , cchMin
                , static_cast< LPCWSTR >( bstrString2In )
                , cchMin
                );
} //*** NBSTRCompareW

int NIBSTRCompareW | ( | BSTR | bstrString1In,
 |  | BSTR | bstrString2In
 | ) |  |

Definition at line 184 of file StringUtils.cpp.

{
    size_t cchMin;

    cchMin = min( SysStringLen( bstrString1In ), SysStringLen( bstrString2In ) );

    return WrapCompareString(
                  FALSE
                , static_cast< LPCWSTR >( bstrString1In )
                , cchMin
                , static_cast< LPCWSTR >( bstrString2In )
                , cchMin
                );
} //*** NIBSTRCompareW

int NIStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cchIn
 | ) |  |

Definition at line 222 of file StringUtils.cpp.

{
    return WrapCompareString(
                  FALSE
                , pcwszString1In
                , cchIn
                , pcwszString2In
                , cchIn
                );
} //*** NIStringCompareW

int NIStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 254 of file StringUtils.cpp.

{
    return WrapCompareString(
                  FALSE
                , pcwszString1In
                , min( cch1In, cch2In )
                , pcwszString2In
                , min( cch1In, cch2In )
                );
} //*** NIStringCompareW

int NStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cchIn
 | ) |  |

Definition at line 238 of file StringUtils.cpp.

{
    return WrapCompareString(
                  TRUE
                , pcwszString1In
                , cchIn
                , pcwszString2In
                , cchIn
                );
} //*** NIStringCompareW

int NStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 271 of file StringUtils.cpp.

{
    return WrapCompareString(
                  TRUE
                , pcwszString1In
                , min( cch1In, cch2In )
                , pcwszString2In
                , min( cch1In, cch2In )
                );
} //*** NStringCompareW

int StringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | LPCWSTR | pcwszString2In
 | ) |  |

Definition at line 130 of file StringUtils.cpp.

{
    return WrapCompareString(
                  TRUE
                , pcwszString1In
                , static_cast< size_t >( -1 )
                , pcwszString2In
                , static_cast< size_t >( -1 )
                );
} //*** StringCompareW

int StringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 162 of file StringUtils.cpp.

{
    return WrapCompareString(
                  TRUE
                , pcwszString1In
                , cch1In
                , pcwszString2In
                , cch2In
                );
} //*** StringCompareW

Generated on Wed Nov 13 2024 16:54:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/BasePage.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • ClipBookServer
  • ClipBook ServerEx

BasePage.cpp File Reference

#include "stdafx.h"
#include "ClipBook ServerEx.h"
#include "ExtObj.h"
#include "BasePage.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/BasePage.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • ClipBookServer
  • ClipBook ServerEx
Classes | Typedefs

BasePage.h File Reference

#include <CluAdmEx.h>
#include "ExtObj.h"
#include "PropList.h"
#include "PropList.h"

Go to the source code of this file.

Classes

class CBasePropertyPage

Typedefs

typedef CList
< CBasePropertyPage
*, CBasePropertyPage * > 		CPageList

Typedef Documentation

typedef CList< CBasePropertyPage *, CBasePropertyPage * > CPageList

Definition at line 194 of file BasePage.h.

Generated on Wed Nov 13 2024 16:54:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/ClipBook ServerEx.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • ClipBookServer
  • ClipBook ServerEx
Classes | Functions | Variables

ClipBook ServerEx.cpp File Reference

#include "stdafx.h"
#include <initguid.h>
#include <CluAdmEx.h>
#include "ClipBook ServerEx.h"
#include "ExtObj.h"
#include "BasePage.h"
#include "RegExt.h"

Go to the source code of this file.

Classes

class | CClipBookServerApp

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsidIn, REFIID riidIn, LPVOID *ppvOut)
STDAPI | DllRegisterCluAdminExtension (HCLUSTER hClusterIn)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterCluAdminExtension (HCLUSTER hClusterIn)
STDAPI | DllUnregisterServer (void)
void | FormatError (CString &rstrErrorInout, DWORD dwErrorIn)

Variables

CComModule | _Module
CClipBookServerApp theApp

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 247 of file ClipBook ServerEx.cpp.

{
    AFX_MANAGE_STATE( AfxGetStaticModuleState() );

    return ( AfxDllCanUnloadNow() && _Module.GetLockCount() == 0 ) ? S_OK : S_FALSE;

}  //*** DllCanUnloadNow

STDAPI DllGetClassObject | ( | REFCLSID | rclsidIn,
 |  | REFIID | riidIn,
 |  | LPVOID * | ppvOut
 | ) |  |

Definition at line 277 of file ClipBook ServerEx.cpp.

{
    return _Module.GetClassObject( rclsidIn, riidIn, ppvOut );

}  //*** DllGetClassObject

STDAPI DllRegisterCluAdminExtension ( HCLUSTER hClusterIn )

Definition at line 369 of file ClipBook ServerEx.cpp.

{
    DWORD       sc = ERROR_SUCCESS;
    DWORD       scTemp = ERROR_SUCCESS;
    LPCWSTR     pwszResTypes = g_wszResourceTypeNames;

    AFX_MANAGE_STATE( AfxGetStaticModuleState() );

    //
    // Register to extend our resource type(s).
    //

    while ( *pwszResTypes != L'\0' )
    {
        wprintf( L"  %s\n", pwszResTypes );
        scTemp = RegisterCluAdminResourceTypeExtension(
                      hClusterIn
                    , pwszResTypes
                    , &CLSID_CoClipBookServerEx
                    );
        if ( scTemp != ERROR_SUCCESS )
        {
            sc = scTemp;
        } // if:  error registering the extension

        pwszResTypes += lstrlenW( pwszResTypes ) + 1;
    }  // while:  more resource types

    if ( sc != ERROR_SUCCESS )
    {
        goto Cleanup;
    } // if:

Cleanup:

    return HRESULT_FROM_WIN32( sc );

}  //*** DllRegisterCluAdminExtension

STDAPI DllRegisterServer ( void )

Definition at line 307 of file ClipBook ServerEx.cpp.

{
    HRESULT hr = S_OK;

    //
    //  Registers object, typelib and all interfaces in typelib
    //

    hr = _Module.RegisterServer( FALSE /*bRegTypeLib*/ );

    return hr;

}  //*** DllRegisterServer

STDAPI DllUnregisterCluAdminExtension ( HCLUSTER hClusterIn )

Definition at line 428 of file ClipBook ServerEx.cpp.

{
    DWORD       sc = ERROR_SUCCESS;
    DWORD       scTemp = ERROR_SUCCESS;
    LPCWSTR     pwszResTypes = g_wszResourceTypeNames;

    AFX_MANAGE_STATE( AfxGetStaticModuleState() );

    //
    // Unregister to extend our resource type(s).
    //

    while ( *pwszResTypes != L'\0' )
    {
        wprintf( L"  %s\n", pwszResTypes );
        scTemp = UnregisterCluAdminResourceTypeExtension(
                      hClusterIn
                    , pwszResTypes
                    , &CLSID_CoClipBookServerEx
                    );
        if ( scTemp != ERROR_SUCCESS )
        {
            sc = scTemp;
        } // if:  error unregistering the extension

        pwszResTypes += lstrlenW( pwszResTypes ) + 1;
    }  // while:  more resource types

    if ( sc != ERROR_SUCCESS )
    {
        goto Cleanup;
    } // if:

Cleanup:

    return HRESULT_FROM_WIN32( sc );

}  //*** DllUnregisterCluAdminExtension

STDAPI DllUnregisterServer ( void )

Definition at line 341 of file ClipBook ServerEx.cpp.

{
    HRESULT hr = S_OK;

    hr = _Module.UnregisterServer();

    return hr;

}  //*** DllUnregisterServer

void FormatError | ( | CString & | rstrErrorInout,
 |  | DWORD | dwErrorIn
 | ) |  |

Definition at line 161 of file ClipBook ServerEx.cpp.

{
    DWORD   cch;
    TCHAR   szError[ 512 ];

    //
    // Format the NT status code from CLUSAPI.  This is necessary
    // for the cases where cluster messages haven't been added to
    // the system message file yet.
    //

    cch = FormatMessage(
                      FORMAT_MESSAGE_FROM_HMODULE | FORMAT_MESSAGE_IGNORE_INSERTS
                    , ::GetModuleHandle( _T( "CLUSAPI.DLL" ) )
                    , dwErrorIn
                    , MAKELANGID( LANG_NEUTRAL, SUBLANG_NEUTRAL )
                    , szError
                    , RTL_NUMBER_OF( szError )
                    , 0
                    );
    if ( cch == 0 )
    {
        cch = FormatMessage(
                          FORMAT_MESSAGE_FROM_SYSTEM
                        , NULL
                        , dwErrorIn
                        , MAKELANGID( LANG_NEUTRAL, SUBLANG_NEUTRAL )
                        , szError
                        , RTL_NUMBER_OF( szError )
                        , 0
                        );
        if ( cch == 0 )
        {
            //
            // Format the NT status code from NTDLL since this hasn't been
            // integrated into the system yet.
            //

            cch = FormatMessage(
                              FORMAT_MESSAGE_FROM_HMODULE | FORMAT_MESSAGE_IGNORE_INSERTS
                            , ::GetModuleHandle( _T( "NTDLL.DLL" ) )
                            , dwErrorIn
                            , MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL)
                            , szError
                            , RTL_NUMBER_OF( szError )
                            , 0
                            );
        }  // if:  error formatting status code from system
    }  // if:  error formatting status code from ClusApi

    if ( cch > 0 )
    {
        rstrErrorInout = szError;
    }  // if:  no error
    else
    {
        TRACE( _T( "FormatError() - Error 0x%08.8x formatting string for error code 0x%08.8x\n" ), GetLastError(), dwErrorIn );
        rstrErrorInout.Format( _T( "Error 0x%08.8x" ), dwErrorIn );
    }  // else:  error formatting the message

}  //*** FormatError

Variable Documentation

CComModule _Module

Definition at line 39 of file ClipBook ServerEx.cpp.

CClipBookServerApp theApp

Definition at line 91 of file ClipBook ServerEx.cpp.

Generated on Wed Nov 13 2024 16:54:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/ClipBook ServerEx.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • ClipBookServer
  • ClipBook ServerEx
Functions

ClipBook ServerEx.h File Reference

#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Functions

void FormatError (CString &rstrErrorInout, DWORD dwErrorIn)

Function Documentation

void FormatError | ( | CString & | rstrErrorInout,
 |  | DWORD | dwErrorIn
 | ) |  |

Definition at line 161 of file ClipBook ServerEx.cpp.

{
    DWORD   cch;
    TCHAR   szError[ 512 ];

    //
    // Format the NT status code from CLUSAPI.  This is necessary
    // for the cases where cluster messages haven't been added to
    // the system message file yet.
    //

    cch = FormatMessage(
                      FORMAT_MESSAGE_FROM_HMODULE | FORMAT_MESSAGE_IGNORE_INSERTS
                    , ::GetModuleHandle( _T( "CLUSAPI.DLL" ) )
                    , dwErrorIn
                    , MAKELANGID( LANG_NEUTRAL, SUBLANG_NEUTRAL )
                    , szError
                    , RTL_NUMBER_OF( szError )
                    , 0
                    );
    if ( cch == 0 )
    {
        cch = FormatMessage(
                          FORMAT_MESSAGE_FROM_SYSTEM
                        , NULL
                        , dwErrorIn
                        , MAKELANGID( LANG_NEUTRAL, SUBLANG_NEUTRAL )
                        , szError
                        , RTL_NUMBER_OF( szError )
                        , 0
                        );
        if ( cch == 0 )
        {
            //
            // Format the NT status code from NTDLL since this hasn't been
            // integrated into the system yet.
            //

            cch = FormatMessage(
                              FORMAT_MESSAGE_FROM_HMODULE | FORMAT_MESSAGE_IGNORE_INSERTS
                            , ::GetModuleHandle( _T( "NTDLL.DLL" ) )
                            , dwErrorIn
                            , MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL)
                            , szError
                            , RTL_NUMBER_OF( szError )
                            , 0
                            );
        }  // if:  error formatting status code from system
    }  // if:  error formatting status code from ClusApi

    if ( cch > 0 )
    {
        rstrErrorInout = szError;
    }  // if:  no error
    else
    {
        TRACE( _T( "FormatError() - Error 0x%08.8x formatting string for error code 0x%08.8x\n" ), GetLastError(), dwErrorIn );
        rstrErrorInout.Format( _T( "Error 0x%08.8x" ), dwErrorIn );
    }  // else:  error formatting the message

}  //*** FormatError

Generated on Wed Nov 13 2024 16:54:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/DDxDDv.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • ClipBookServer
  • ClipBook ServerEx
Functions

DDxDDv.cpp File Reference

#include "stdafx.h"
#include "DDxDDv.h"
#include "resource.h"

Go to the source code of this file.

Functions

void | CleanupLabel (LPTSTR pwszLabelIn)
void AFXAPI | DDV_RequiredText (CDataExchange *pDXIn, int nIDCIn, int nIDCLabelIn, const CString &rstrValueIn)
void AFXAPI | DDX_Number (CDataExchange *pDXIn, int nIDCIn, DWORD &rdwValueInout, DWORD dwMinIn, DWORD dwMaxIn, BOOL fSignedIn)

Function Documentation

void CleanupLabel ( LPTSTR pwszLabelIn )

Definition at line 308 of file DDxDDv.cpp.

{
    LPTSTR  pin = NULL;
    LPTSTR  pout = NULL;
    LANGID  langid;
    WORD    primarylangid;
    BOOL    fFELanguage;

    //
    //  Get the language ID.
    //

    langid = GetUserDefaultLangID();
    primarylangid = static_cast< WORD >( PRIMARYLANGID( langid ) );
    fFELanguage = ((primarylangid == LANG_JAPANESE)
                || (primarylangid == LANG_CHINESE)
                || (primarylangid == LANG_KOREAN) );

    //
    // Copy the name sans '&' and ':' chars
    //

    pin = pout = pwszLabelIn;
    do
    {
        //
        // Strip FE accelerators with parentheses. e.g. "foo(&F)" -> "foo"
        //

        if (    fFELanguage
            &&  (pin[ 0 ] == _T('('))
            &&  (pin[ 1 ] == _T('&'))
            &&  (pin[ 2 ] != _T('\0'))
            &&  (pin[ 3 ] == _T(')')) )
        {
            pin += 3;
        } // if:  Far East language with accelerator
        else if ( (*pin != _T('&')) && (*pin != _T(':')) )
        {
            *pout++ = *pin;
        } // else if:  accelerator found
    } while ( *pin++ != _T('\0') );

} //*** CleanupLabel

void AFXAPI DDV_RequiredText | ( | CDataExchange * | pDXIn,
 |  | int | nIDCIn,
 |  | int | nIDCLabelIn,
 |  | const CString & | rstrValueIn
 | ) |  |

Definition at line 246 of file DDxDDv.cpp.

{
    ASSERT( pDXIn != NULL );

    AFX_MANAGE_STATE( AfxGetStaticModuleState() );

    if ( pDXIn->m_bSaveAndValidate )
    {
        if ( rstrValueIn.GetLength() == 0 )
        {
            HWND        hwndLabel;
            TCHAR       szLabel[ 1024 ];
            CString     strPrompt;

            // Get the label window handle
            hwndLabel = pDXIn->PrepareEditCtrl( nIDCLabelIn );

            // Get the text of the label.
            GetWindowText( hwndLabel, szLabel, RTL_NUMBER_OF( szLabel ) );

            // Remove ampersands (&) and colons (:).
            CleanupLabel( szLabel );

            // Format and display a message.
            strPrompt.FormatMessage( IDS_REQUIRED_FIELD_EMPTY, szLabel );
            AfxMessageBox( strPrompt, MB_ICONEXCLAMATION );

            // Do this so that the control receives focus.
            (void) pDXIn->PrepareEditCtrl( nIDCIn );

            // Fail the call.
            strPrompt.Empty();  // exception prep
            pDXIn->Fail();
        } // if:  field not specified
    } // if:  saving data

} //*** DDV_RequiredText

void AFXAPI DDX_Number | ( | CDataExchange * | pDXIn,
 |  | int | nIDCIn,
 |  | DWORD & | rdwValueInout,
 |  | DWORD | dwMinIn,
 |  | DWORD | dwMaxIn,
 |  | BOOL | fSignedIn
 | ) |  |

Definition at line 68 of file DDxDDv.cpp.

{
    HWND    hwndCtrl = NULL;
    DWORD   dwValue = 0;
    HRESULT hr = S_OK;

    ASSERT( pDXIn != NULL );
#ifdef _DEBUG
    if ( fSignedIn )
    {
        ASSERT( static_cast< LONG >( dwMinIn ) < static_cast< LONG >( dwMaxIn ) );
    }
    else
    {
        ASSERT( dwMinIn < dwMaxIn );
    }
#endif // _DEBUG

    AFX_MANAGE_STATE( AfxGetStaticModuleState() );

    //
    //  Get the control window handle.
    //

    hwndCtrl = pDXIn->PrepareEditCtrl( nIDCIn );

    if ( pDXIn->m_bSaveAndValidate )
    {
        BOOL    bTranslated;

        //
        //  Get the number from the control.
        //

        dwValue = GetDlgItemInt( pDXIn->m_pDlgWnd->m_hWnd, nIDCIn, &bTranslated, fSignedIn );

        //
        // If the retrival failed, it is a signed number, and the minimum
        // value is the smallest negative value possible, check the string itself.
        //

        if ( ! bTranslated && fSignedIn && (dwMinIn == 0x80000000) )
        {
            UINT    cch = 0;
            TCHAR   szNumber[ 20 ];

            //
            //  See if it is the smallest negative number.
            //

            cch = GetDlgItemText( pDXIn->m_pDlgWnd->m_hWnd, nIDCIn, szNumber, RTL_NUMBER_OF( szNumber ) );
            if ( (cch != 0) && (_tcsnicmp( szNumber, _T("-2147483648"), RTL_NUMBER_OF( szNumber ) ) == 0) )
            {
                dwValue = 0x80000000;
                bTranslated = TRUE;
            } // if:  text retrieved successfully and is highest negative number
        } // if:  error translating number and getting signed number

        //
        // If the retrieval failed or the specified number is
        // out of range, display an error.
        //

        if (    ! bTranslated
            ||  (fSignedIn
                && (    (static_cast< LONG >( dwValue ) < static_cast< LONG >( dwMinIn ))
                    ||  (static_cast< LONG >( dwValue ) > static_cast< LONG >( dwMaxIn ))
                    )
                )
            ||  (!  fSignedIn
                &&  (   (dwValue < dwMinIn)
                    ||  (dwValue > dwMaxIn)
                    )
                )
            )
        {
            TCHAR   szMin[ 32 ];
            TCHAR   szMax[ 32 ];
            CString strPrompt;

            if ( fSignedIn )
            {
                hr = StringCchPrintf( szMin, RTL_NUMBER_OF( szMin ), _T("%d%"), dwMinIn );
                ASSERT( SUCCEEDED( hr ) );
                hr = StringCchPrintf( szMax, RTL_NUMBER_OF( szMax ), _T("%d%"), dwMaxIn );
                ASSERT( SUCCEEDED( hr ) );
            } // if:  signed number
            else
            {
                hr = StringCchPrintf( szMin, RTL_NUMBER_OF( szMin ), _T("%u%"), dwMinIn );
                ASSERT( SUCCEEDED( hr ) );
                hr = StringCchPrintf( szMax, RTL_NUMBER_OF( szMax ), _T("%u%"), dwMaxIn );
                ASSERT( SUCCEEDED( hr ) );
            } // else:  unsigned number
            AfxFormatString2( strPrompt, AFX_IDP_PARSE_INT_RANGE, szMin, szMax );
            AfxMessageBox( strPrompt, MB_ICONEXCLAMATION, AFX_IDP_PARSE_INT_RANGE );
            strPrompt.Empty(); // exception prep
            pDXIn->Fail();
        } // if:  invalid string
        else
        {
            rdwValueInout = dwValue;
        } // if:  number is in range
    } // if:  saving data
    else
    {
        CString     strMinValue;
        CString     strMaxValue;
        UINT        cchMax;

        //
        //  Set the maximum number of characters that can be entered.
        //

        if ( fSignedIn )
        {
            strMinValue.Format( _T("%d"), dwMinIn );
            strMaxValue.Format( _T("%d"), dwMaxIn );
        } // if:  signed value
        else
        {
            strMinValue.Format( _T("%u"), dwMinIn );
            strMaxValue.Format( _T("%u"), dwMaxIn );
        } // else:  unsigned value
        cchMax = max( strMinValue.GetLength(), strMaxValue.GetLength() );
        SendMessage( hwndCtrl, EM_LIMITTEXT, cchMax, 0 );

        //
        //  Set the value into the control.
        //

        if ( fSignedIn )
        {
            LONG lValue = static_cast< LONG >( rdwValueInout );
            DDX_Text( pDXIn, nIDCIn, lValue );
        } // if:  signed value
        else
        {
            DDX_Text( pDXIn, nIDCIn, rdwValueInout );
        } // else:
    } // else:  setting data onto the dialog

} //*** DDX_Number

Generated on Wed Nov 13 2024 16:54:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/DDxDDv.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • ClipBookServer
  • ClipBook ServerEx
Functions

DDxDDv.h File Reference

Go to the source code of this file.

Functions

void | CleanupLabel (LPTSTR pwszIn)
void AFXAPI | DDV_RequiredText (CDataExchange *pDXIn, int nIDCIn, int nIDCLabelIn, const CString &rstrValueIn)
void AFXAPI | DDX_Number (CDataExchange *pDXIn, int nIDCIn, LONG &rnValueInout, LONG nMinIn, LONG nMaxIn, BOOL fSignedIn)
void AFXAPI | DDX_Number (CDataExchange *pDXIn, int nIDCIn, DWORD &rdwValueInout, DWORD dwMinIn, DWORD dwMaxIn, BOOL fSignedIn=FALSE)

Function Documentation

void CleanupLabel ( LPTSTR pwszIn )

Definition at line 308 of file DDxDDv.cpp.

{
    LPTSTR  pin = NULL;
    LPTSTR  pout = NULL;
    LANGID  langid;
    WORD    primarylangid;
    BOOL    fFELanguage;

    //
    //  Get the language ID.
    //

    langid = GetUserDefaultLangID();
    primarylangid = static_cast< WORD >( PRIMARYLANGID( langid ) );
    fFELanguage = ((primarylangid == LANG_JAPANESE)
                || (primarylangid == LANG_CHINESE)
                || (primarylangid == LANG_KOREAN) );

    //
    // Copy the name sans '&' and ':' chars
    //

    pin = pout = pwszLabelIn;
    do
    {
        //
        // Strip FE accelerators with parentheses. e.g. "foo(&F)" -> "foo"
        //

        if (    fFELanguage
            &&  (pin[ 0 ] == _T('('))
            &&  (pin[ 1 ] == _T('&'))
            &&  (pin[ 2 ] != _T('\0'))
            &&  (pin[ 3 ] == _T(')')) )
        {
            pin += 3;
        } // if:  Far East language with accelerator
        else if ( (*pin != _T('&')) && (*pin != _T(':')) )
        {
            *pout++ = *pin;
        } // else if:  accelerator found
    } while ( *pin++ != _T('\0') );

} //*** CleanupLabel

void AFXAPI DDV_RequiredText | ( | CDataExchange * | pDXIn,
 |  | int | nIDCIn,
 |  | int | nIDCLabelIn,
 |  | const CString & | rstrValueIn
 | ) |  |

Definition at line 246 of file DDxDDv.cpp.

{
    ASSERT( pDXIn != NULL );

    AFX_MANAGE_STATE( AfxGetStaticModuleState() );

    if ( pDXIn->m_bSaveAndValidate )
    {
        if ( rstrValueIn.GetLength() == 0 )
        {
            HWND        hwndLabel;
            TCHAR       szLabel[ 1024 ];
            CString     strPrompt;

            // Get the label window handle
            hwndLabel = pDXIn->PrepareEditCtrl( nIDCLabelIn );

            // Get the text of the label.
            GetWindowText( hwndLabel, szLabel, RTL_NUMBER_OF( szLabel ) );

            // Remove ampersands (&) and colons (:).
            CleanupLabel( szLabel );

            // Format and display a message.
            strPrompt.FormatMessage( IDS_REQUIRED_FIELD_EMPTY, szLabel );
            AfxMessageBox( strPrompt, MB_ICONEXCLAMATION );

            // Do this so that the control receives focus.
            (void) pDXIn->PrepareEditCtrl( nIDCIn );

            // Fail the call.
            strPrompt.Empty();  // exception prep
            pDXIn->Fail();
        } // if:  field not specified
    } // if:  saving data

} //*** DDV_RequiredText

void AFXAPI DDX_Number | ( | CDataExchange * | pDXIn,
 |  | int | nIDCIn,
 |  | LONG & | rnValueInout,
 |  | LONG | nMinIn,
 |  | LONG | nMaxIn,
 |  | BOOL | fSignedIn |
 | ) |  |  | [inline]

Definition at line 53 of file DDxDDv.h.

{
    DDX_Number(
          pDXIn
        , nIDCIn
        , reinterpret_cast< DWORD & >( rnValueInout )
        , static_cast< DWORD >( nMinIn )
        , static_cast< DWORD >( nMaxIn )
        , fSignedIn
        );

} //*** DDXNumber

void AFXAPI DDX_Number | ( | CDataExchange * | pDXIn,
 |  | int | nIDCIn,
 |  | DWORD & | rdwValueInout,
 |  | DWORD | dwMinIn,
 |  | DWORD | dwMaxIn,
 |  | BOOL | fSignedIn = FALSE
 | ) |  |

Definition at line 68 of file DDxDDv.cpp.

{
    HWND    hwndCtrl = NULL;
    DWORD   dwValue = 0;
    HRESULT hr = S_OK;

    ASSERT( pDXIn != NULL );
#ifdef _DEBUG
    if ( fSignedIn )
    {
        ASSERT( static_cast< LONG >( dwMinIn ) < static_cast< LONG >( dwMaxIn ) );
    }
    else
    {
        ASSERT( dwMinIn < dwMaxIn );
    }
#endif // _DEBUG

    AFX_MANAGE_STATE( AfxGetStaticModuleState() );

    //
    //  Get the control window handle.
    //

    hwndCtrl = pDXIn->PrepareEditCtrl( nIDCIn );

    if ( pDXIn->m_bSaveAndValidate )
    {
        BOOL    bTranslated;

        //
        //  Get the number from the control.
        //

        dwValue = GetDlgItemInt( pDXIn->m_pDlgWnd->m_hWnd, nIDCIn, &bTranslated, fSignedIn );

        //
        // If the retrival failed, it is a signed number, and the minimum
        // value is the smallest negative value possible, check the string itself.
        //

        if ( ! bTranslated && fSignedIn && (dwMinIn == 0x80000000) )
        {
            UINT    cch = 0;
            TCHAR   szNumber[ 20 ];

            //
            //  See if it is the smallest negative number.
            //

            cch = GetDlgItemText( pDXIn->m_pDlgWnd->m_hWnd, nIDCIn, szNumber, RTL_NUMBER_OF( szNumber ) );
            if ( (cch != 0) && (_tcsnicmp( szNumber, _T("-2147483648"), RTL_NUMBER_OF( szNumber ) ) == 0) )
            {
                dwValue = 0x80000000;
                bTranslated = TRUE;
            } // if:  text retrieved successfully and is highest negative number
        } // if:  error translating number and getting signed number

        //
        // If the retrieval failed or the specified number is
        // out of range, display an error.
        //

        if (    ! bTranslated
            ||  (fSignedIn
                && (    (static_cast< LONG >( dwValue ) < static_cast< LONG >( dwMinIn ))
                    ||  (static_cast< LONG >( dwValue ) > static_cast< LONG >( dwMaxIn ))
                    )
                )
            ||  (!  fSignedIn
                &&  (   (dwValue < dwMinIn)
                    ||  (dwValue > dwMaxIn)
                    )
                )
            )
        {
            TCHAR   szMin[ 32 ];
            TCHAR   szMax[ 32 ];
            CString strPrompt;

            if ( fSignedIn )
            {
                hr = StringCchPrintf( szMin, RTL_NUMBER_OF( szMin ), _T("%d%"), dwMinIn );
                ASSERT( SUCCEEDED( hr ) );
                hr = StringCchPrintf( szMax, RTL_NUMBER_OF( szMax ), _T("%d%"), dwMaxIn );
                ASSERT( SUCCEEDED( hr ) );
            } // if:  signed number
            else
            {
                hr = StringCchPrintf( szMin, RTL_NUMBER_OF( szMin ), _T("%u%"), dwMinIn );
                ASSERT( SUCCEEDED( hr ) );
                hr = StringCchPrintf( szMax, RTL_NUMBER_OF( szMax ), _T("%u%"), dwMaxIn );
                ASSERT( SUCCEEDED( hr ) );
            } // else:  unsigned number
            AfxFormatString2( strPrompt, AFX_IDP_PARSE_INT_RANGE, szMin, szMax );
            AfxMessageBox( strPrompt, MB_ICONEXCLAMATION, AFX_IDP_PARSE_INT_RANGE );
            strPrompt.Empty(); // exception prep
            pDXIn->Fail();
        } // if:  invalid string
        else
        {
            rdwValueInout = dwValue;
        } // if:  number is in range
    } // if:  saving data
    else
    {
        CString     strMinValue;
        CString     strMaxValue;
        UINT        cchMax;

        //
        //  Set the maximum number of characters that can be entered.
        //

        if ( fSignedIn )
        {
            strMinValue.Format( _T("%d"), dwMinIn );
            strMaxValue.Format( _T("%d"), dwMaxIn );
        } // if:  signed value
        else
        {
            strMinValue.Format( _T("%u"), dwMinIn );
            strMaxValue.Format( _T("%u"), dwMaxIn );
        } // else:  unsigned value
        cchMax = max( strMinValue.GetLength(), strMaxValue.GetLength() );
        SendMessage( hwndCtrl, EM_LIMITTEXT, cchMax, 0 );

        //
        //  Set the value into the control.
        //

        if ( fSignedIn )
        {
            LONG lValue = static_cast< LONG >( rdwValueInout );
            DDX_Text( pDXIn, nIDCIn, lValue );
        } // if:  signed value
        else
        {
            DDX_Text( pDXIn, nIDCIn, rdwValueInout );
        } // else:
    } // else:  setting data onto the dialog

} //*** DDX_Number

Generated on Wed Nov 13 2024 16:54:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/ExtObj.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • ClipBookServer
  • ClipBook ServerEx

ExtObj.cpp File Reference

#include "stdafx.h"
#include "ClipBook ServerEx.h"
#include "ExtObj.h"
#include "ExtObjData.h"
#include "ResProp.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/ExtObj.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • ClipBookServer
  • ClipBook ServerEx
Classes | Typedefs

ExtObj.h File Reference

#include <CluAdmEx.h>
#include "ExtObjID.h"
#include "ExtObjData.h"
#include "ExtObjData.h"

Go to the source code of this file.

Classes

class CExtObject

Typedefs

typedef CList
< CBasePropertyPage
*, CBasePropertyPage * > 		CPageList

Typedef Documentation

typedef CList< CBasePropertyPage *, CBasePropertyPage * > CPageList

Definition at line 42 of file ExtObj.h.

Generated on Wed Nov 13 2024 16:54:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/ExtObjData.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • ClipBookServer
  • ClipBook ServerEx
Defines

ExtObjData.cpp File Reference

#include "stdafx.h"
#include "ClipBook ServerEx.h"
#include "ExtObjData.h"
#include "resprop.h"
#include "resource.h"

Go to the source code of this file.

Defines

#define | ALL_RESOURCES_MENU_BASE_ID 40
#define | ALL_RESOURCES_MENU_ID_1 (ALL_RESOURCES_MENU_BASE_ID + 1)
#define | ALL_RESTYPES_MENU_BASE_ID 60
#define | ALL_RESTYPES_MENU_ID_1 (ALL_RESTYPES_MENU_BASE_ID + 1)
#define | CLUSTER_MENU_BASE_ID 0
#define | CLUSTER_MENU_ID_1 (CLUSTER_MENU_BASE_ID + 1)
#define | GROUP_MENU_BASE_ID 20
#define | GROUP_MENU_ID_1 (GROUP_MENU_BASE_ID + 1)
#define | NETINTERFACE_MENU_BASE_ID 80
#define | NETINTERFACE_MENU_ID_1 (NETINTERFACE_MENU_BASE_ID + 1)
#define | NETWORK_MENU_BASE_ID 70
#define | NETWORK_MENU_ID_1 (NETWORK_MENU_BASE_ID + 1)
#define | NODE_MENU_BASE_ID 10
#define | NODE_MENU_ID_1 (NODE_MENU_BASE_ID + 1)
#define | RESOURCE_MENU_BASE_ID 30
#define | RESOURCE_MENU_ID_1 (RESOURCE_MENU_BASE_ID + 1)
#define | RESTYPE_MENU_BASE_ID 50
#define | RESTYPE_MENU_ID_1 (RESTYPE_MENU_BASE_ID + 1)

Define Documentation

#define ALL_RESOURCES_MENU_BASE_ID 40

Definition at line 50 of file ExtObjData.cpp.

#define ALL_RESOURCES_MENU_ID_1 (ALL_RESOURCES_MENU_BASE_ID + 1)

Definition at line 51 of file ExtObjData.cpp.

#define ALL_RESTYPES_MENU_BASE_ID 60

Definition at line 56 of file ExtObjData.cpp.

#define ALL_RESTYPES_MENU_ID_1 (ALL_RESTYPES_MENU_BASE_ID + 1)

Definition at line 57 of file ExtObjData.cpp.

#define CLUSTER_MENU_BASE_ID 0

Definition at line 38 of file ExtObjData.cpp.

#define CLUSTER_MENU_ID_1 (CLUSTER_MENU_BASE_ID + 1)

Definition at line 39 of file ExtObjData.cpp.

#define GROUP_MENU_BASE_ID 20

Definition at line 44 of file ExtObjData.cpp.

#define GROUP_MENU_ID_1 (GROUP_MENU_BASE_ID + 1)

Definition at line 45 of file ExtObjData.cpp.

#define NETINTERFACE_MENU_BASE_ID 80

Definition at line 62 of file ExtObjData.cpp.

#define NETINTERFACE_MENU_ID_1 (NETINTERFACE_MENU_BASE_ID + 1)

Definition at line 63 of file ExtObjData.cpp.

#define NETWORK_MENU_BASE_ID 70

Definition at line 59 of file ExtObjData.cpp.

#define NETWORK_MENU_ID_1 (NETWORK_MENU_BASE_ID + 1)

Definition at line 60 of file ExtObjData.cpp.

#define NODE_MENU_BASE_ID 10

Definition at line 41 of file ExtObjData.cpp.

#define NODE_MENU_ID_1 (NODE_MENU_BASE_ID + 1)

Definition at line 42 of file ExtObjData.cpp.

#define RESOURCE_MENU_BASE_ID 30

Definition at line 47 of file ExtObjData.cpp.

#define RESOURCE_MENU_ID_1 (RESOURCE_MENU_BASE_ID + 1)

Definition at line 48 of file ExtObjData.cpp.

#define RESTYPE_MENU_BASE_ID 50

Definition at line 53 of file ExtObjData.cpp.

#define RESTYPE_MENU_ID_1 (RESTYPE_MENU_BASE_ID + 1)

Definition at line 54 of file ExtObjData.cpp.

Generated on Wed Nov 13 2024 16:54:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/ExtObjData.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • ClipBookServer
  • ClipBook ServerEx
Classes

ExtObjData.h File Reference

#include <CluAdmEx.h>

Go to the source code of this file.

Classes

class | CClusterData
class | CGroupData
class | CNetInterfaceData
class | CNetworkData
class | CNodeData
class | CObjData
class | CResData
class | CResTypeData
Generated on Wed Nov 13 2024 16:54:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/ExtObjID.idl File Reference

  • WinBase
  • Cluster
  • Win2003
  • ClipBookServer
  • ClipBook ServerEx
Classes | Namespaces | Functions

ExtObjID.idl File Reference

Go to the source code of this file.

Classes

class | CLUADMEXLib::CoClipBookServerEx

Namespaces

namespace | CLUADMEXLib

Functions

CLUADMEXLib::importlib ("stdole2.tlb")
Generated on Wed Nov 13 2024 16:54:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/PropList.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • ClipBookServer
  • ClipBook ServerEx
Classes | Functions | Variables

PropList.cpp File Reference

#include "stdafx.h"
#include "PropList.h"
#include <StrSafe.h>

Go to the source code of this file.

Classes

class | CMemoryException

Functions

int | BSTRCompareW (BSTR bstrString1In, BSTR bstrString2In)
int | IBSTRCompareW (BSTR bstrString1In, BSTR bstrString2In)
int | IStringCompareW (LPCWSTR pcwszString1In, LPCWSTR pcwszString2In)
int | IStringCompareW (LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)
int | NBSTRCompareW (BSTR bstrString1In, BSTR bstrString2In)
int | NIBSTRCompareW (BSTR bstrString1In, BSTR bstrString2In)
int | NIStringCompareW (LPCWSTR pcwszString1In, LPCWSTR pcwszString2In, size_t cchIn)
int | NIStringCompareW (LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)
int | NStringCompareW (LPCWSTR pcwszString1In, LPCWSTR pcwszString2In, size_t cchIn)
int | NStringCompareW (LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)
int | StringCompareW (LPCWSTR pcwszString1In, LPCWSTR pcwszString2In)
int | StringCompareW (LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)
int | WrapCompareString (BOOL fCaseSensitive, LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)

Variables

const int | BUFFER_GROWTH_FACTOR = 256

Function Documentation

int BSTRCompareW | ( | BSTR | bstrString1In,
 |  | BSTR | bstrString2In
 | ) |  |

Definition at line 127 of file PropList.cpp.

{
    return WrapCompareString(
                  TRUE
                , static_cast< LPCWSTR >( bstrString1In )
                , SysStringLen( bstrString1In )
                , static_cast< LPCWSTR >( bstrString2In )
                , SysStringLen( bstrString2In )
                );
} //*** BSTRCompareW

int IBSTRCompareW | ( | BSTR | bstrString1In,
 |  | BSTR | bstrString2In
 | ) |  |

Definition at line 112 of file PropList.cpp.

{
    return WrapCompareString(
                  FALSE
                , static_cast< LPCWSTR >( bstrString1In )
                , SysStringLen( bstrString1In )
                , static_cast< LPCWSTR >( bstrString2In )
                , SysStringLen( bstrString2In )
                );
} //*** IBSTRCompareW

int IStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | LPCWSTR | pcwszString2In
 | ) |  |

Definition at line 142 of file PropList.cpp.

{
    return WrapCompareString(
                  FALSE
                , pcwszString1In
                , static_cast< size_t >( -1 )
                , pcwszString2In
                , static_cast< size_t >( -1 )
            );
} //*** IStringCompareW

int IStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 172 of file PropList.cpp.

{
    return WrapCompareString(
                  FALSE
                , pcwszString1In
                , cch1In
                , pcwszString2In
                , cch2In
                );
} //*** IStringCompareW

int NBSTRCompareW | ( | BSTR | bstrString1In,
 |  | BSTR | bstrString2In
 | ) |  |

Definition at line 230 of file PropList.cpp.

{
    size_t cchMin;

    cchMin = min( SysStringLen( bstrString1In ), SysStringLen( bstrString2In ) );

    return WrapCompareString(
                  TRUE
                , static_cast< LPCWSTR >( bstrString1In )
                , cchMin
                , static_cast< LPCWSTR >( bstrString2In )
                , cchMin
                );
} //*** NBSTRCompareW

int NIBSTRCompareW | ( | BSTR | bstrString1In,
 |  | BSTR | bstrString2In
 | ) |  |

Definition at line 211 of file PropList.cpp.

{
    size_t cchMin;

    cchMin = min( SysStringLen( bstrString1In ), SysStringLen( bstrString2In ) );

    return WrapCompareString(
                  FALSE
                , static_cast< LPCWSTR >( bstrString1In )
                , cchMin
                , static_cast< LPCWSTR >( bstrString2In )
                , cchMin
                );
} //*** NIBSTRCompareW

int NIStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cchIn
 | ) |  |

Definition at line 249 of file PropList.cpp.

{
    return WrapCompareString(
                  FALSE
                , pcwszString1In
                , cchIn
                , pcwszString2In
                , cchIn
                );
} //*** NIStringCompareW

int NIStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 281 of file PropList.cpp.

{
    return WrapCompareString(
                  FALSE
                , pcwszString1In
                , min( cch1In, cch2In )
                , pcwszString2In
                , min( cch1In, cch2In )
                );
} //*** NIStringCompareW

int NStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cchIn
 | ) |  |

Definition at line 265 of file PropList.cpp.

{
    return WrapCompareString(
                  TRUE
                , pcwszString1In
                , cchIn
                , pcwszString2In
                , cchIn
                );
} //*** NIStringCompareW

int NStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 298 of file PropList.cpp.

{
    return WrapCompareString(
                  TRUE
                , pcwszString1In
                , min( cch1In, cch2In )
                , pcwszString2In
                , min( cch1In, cch2In )
                );
} //*** NStringCompareW

int StringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | LPCWSTR | pcwszString2In
 | ) |  |

Definition at line 157 of file PropList.cpp.

{
    return WrapCompareString(
                  TRUE
                , pcwszString1In
                , static_cast< size_t >( -1 )
                , pcwszString2In
                , static_cast< size_t >( -1 )
                );
} //*** StringCompareW

int StringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 189 of file PropList.cpp.

{
    return WrapCompareString(
                  TRUE
                , pcwszString1In
                , cch1In
                , pcwszString2In
                , cch2In
                );
} //*** StringCompareW

int WrapCompareString | ( | BOOL | fCaseSensitive,
 |  | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 84 of file PropList.cpp.

{
    int nRet;

    nRet = CompareStringW(
              LOCALE_SYSTEM_DEFAULT
            , fCaseSensitive ? 0 : NORM_IGNORECASE
            , pcwszString1In
            , static_cast< DWORD >( cch1In )
            , pcwszString2In
            , static_cast< DWORD >( cch2In )
            );

    return nRet - CSTR_EQUAL; // CSTR_LT < CSTR_EQUAL < CSTR_GT

} // *** WrapCompareString

Variable Documentation

const int BUFFER_GROWTH_FACTOR = 256

Definition at line 46 of file PropList.cpp.

Generated on Wed Nov 13 2024 16:54:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/PropList.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • ClipBookServer
  • ClipBook ServerEx
Classes | Defines | Functions

PropList.h File Reference

#include <windows.h>
#include <clusapi.h>
#include <crtdbg.h>

Go to the source code of this file.

Classes

class | CClusPropList
class | CClusPropValueList

Defines

#define | ASSERT _ASSERTE

Functions

int | BSTRCompareW (BSTR bstrString1In, BSTR bstrString2In)
int | IBSTRCompareW (BSTR bstrString1In, BSTR bstrString2In)
int | IStringCompareW (LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)
int | IStringCompareW (LPCWSTR pcwszString1In, LPCWSTR pcwszString2In)
int | NBSTRCompareW (BSTR bstrString1In, BSTR bstrString2In)
int | NIBSTRCompareW (BSTR bstrString1In, BSTR bstrString2In)
int | NIStringCompareW (LPCWSTR pcwszString1In, LPCWSTR pcwszString2In, size_t cchIn)
int | NIStringCompareW (LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)
int | NStringCompareW (LPCWSTR pcwszString1In, LPCWSTR pcwszString2In, size_t cchIn)
int | NStringCompareW (LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)
int | StringCompareW (LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)
int | StringCompareW (LPCWSTR pcwszString1In, LPCWSTR pcwszString2In)

Define Documentation

#define ASSERT _ASSERTE

Definition at line 49 of file PropList.h.

Function Documentation

int BSTRCompareW | ( | BSTR | bstrString1In,
 |  | BSTR | bstrString2In
 | ) |  |

Definition at line 100 of file StringUtils.cpp.

{
    return WrapCompareString(
                  TRUE
                , static_cast< LPCWSTR >( bstrString1In )
                , SysStringLen( bstrString1In )
                , static_cast< LPCWSTR >( bstrString2In )
                , SysStringLen( bstrString2In )
                );
} //*** BSTRCompareW

int IBSTRCompareW | ( | BSTR | bstrString1In,
 |  | BSTR | bstrString2In
 | ) |  |

Definition at line 85 of file StringUtils.cpp.

{
    return WrapCompareString(
                  FALSE
                , static_cast< LPCWSTR >( bstrString1In )
                , SysStringLen( bstrString1In )
                , static_cast< LPCWSTR >( bstrString2In )
                , SysStringLen( bstrString2In )
                );
} //*** IBSTRCompareW

int IStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 145 of file StringUtils.cpp.

{
    return WrapCompareString(
                  FALSE
                , pcwszString1In
                , cch1In
                , pcwszString2In
                , cch2In
                );
} //*** IStringCompareW

int IStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | LPCWSTR | pcwszString2In
 | ) |  |

Definition at line 115 of file StringUtils.cpp.

{
    return WrapCompareString(
                  FALSE
                , pcwszString1In
                , static_cast< size_t >( -1 )
                , pcwszString2In
                , static_cast< size_t >( -1 )
            );
} //*** IStringCompareW

int NBSTRCompareW | ( | BSTR | bstrString1In,
 |  | BSTR | bstrString2In
 | ) |  |

Definition at line 203 of file StringUtils.cpp.

{
    size_t cchMin;

    cchMin = min( SysStringLen( bstrString1In ), SysStringLen( bstrString2In ) );

    return WrapCompareString(
                  TRUE
                , static_cast< LPCWSTR >( bstrString1In )
                , cchMin
                , static_cast< LPCWSTR >( bstrString2In )
                , cchMin
                );
} //*** NBSTRCompareW

int NIBSTRCompareW | ( | BSTR | bstrString1In,
 |  | BSTR | bstrString2In
 | ) |  |

Definition at line 184 of file StringUtils.cpp.

{
    size_t cchMin;

    cchMin = min( SysStringLen( bstrString1In ), SysStringLen( bstrString2In ) );

    return WrapCompareString(
                  FALSE
                , static_cast< LPCWSTR >( bstrString1In )
                , cchMin
                , static_cast< LPCWSTR >( bstrString2In )
                , cchMin
                );
} //*** NIBSTRCompareW

int NIStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cchIn
 | ) |  |

Definition at line 222 of file StringUtils.cpp.

{
    return WrapCompareString(
                  FALSE
                , pcwszString1In
                , cchIn
                , pcwszString2In
                , cchIn
                );
} //*** NIStringCompareW

int NIStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 254 of file StringUtils.cpp.

{
    return WrapCompareString(
                  FALSE
                , pcwszString1In
                , min( cch1In, cch2In )
                , pcwszString2In
                , min( cch1In, cch2In )
                );
} //*** NIStringCompareW

int NStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cchIn
 | ) |  |

Definition at line 238 of file StringUtils.cpp.

{
    return WrapCompareString(
                  TRUE
                , pcwszString1In
                , cchIn
                , pcwszString2In
                , cchIn
                );
} //*** NIStringCompareW

int NStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 271 of file StringUtils.cpp.

{
    return WrapCompareString(
                  TRUE
                , pcwszString1In
                , min( cch1In, cch2In )
                , pcwszString2In
                , min( cch1In, cch2In )
                );
} //*** NStringCompareW

int StringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 162 of file StringUtils.cpp.

{
    return WrapCompareString(
                  TRUE
                , pcwszString1In
                , cch1In
                , pcwszString2In
                , cch2In
                );
} //*** StringCompareW

int StringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | LPCWSTR | pcwszString2In
 | ) |  |

Definition at line 130 of file StringUtils.cpp.

{
    return WrapCompareString(
                  TRUE
                , pcwszString1In
                , static_cast< size_t >( -1 )
                , pcwszString2In
                , static_cast< size_t >( -1 )
                );
} //*** StringCompareW

Generated on Wed Nov 13 2024 16:54:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/RegExt.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • ClipBookServer
  • ClipBook ServerEx
Functions | Variables

RegExt.cpp File Reference

#include "stdafx.h"
#include <ole2.h>
#include <StrSafe.h>

Go to the source code of this file.

Functions

DWORD | RegisterCluAdminAllGroupsExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | RegisterCluAdminAllNetInterfacesExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | RegisterCluAdminAllNetworksExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | RegisterCluAdminAllNodesExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | RegisterCluAdminAllResourcesExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | RegisterCluAdminAllResourceTypesExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | RegisterCluAdminClusterExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | RegisterCluAdminResourceTypeExtension (HCLUSTER hClusterIn, LPCWSTR pwszResourceTypeIn, const CLSID *pClsidIn)
DWORD | UnregisterCluAdminAllGroupsExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | UnregisterCluAdminAllNetInterfacesExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | UnregisterCluAdminAllNetworksExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | UnregisterCluAdminAllNodesExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | UnregisterCluAdminAllResourcesExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | UnregisterCluAdminAllResourceTypesExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | UnregisterCluAdminClusterExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | UnregisterCluAdminResourceTypeExtension (HCLUSTER hClusterIn, LPCWSTR pwszResourceTypeIn, const CLSID *pClsidIn)

Variables

const LPCWSTR | REG_VALUE_ADMIN_EXTENSIONS = "AdminExtensions"

Function Documentation

DWORD RegisterCluAdminAllGroupsExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 175 of file RegExt.cpp.

{
    DWORD sc = ERROR_SUCCESS;

    sc = RegisterAnyCluAdminExtension( hClusterIn, L"Groups", pClsidIn );

    return sc;

}  //*** RegisterCluAdminAllGroupsExtension

DWORD RegisterCluAdminAllNetInterfacesExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 307 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;

    sc = RegisterAnyCluAdminExtension( hClusterIn, L"NetworkInterfaces", pClsidIn );

    return sc;

}  //*** RegisterCluAdminAllNetInterfacesExtension

DWORD RegisterCluAdminAllNetworksExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 274 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;

    sc = RegisterAnyCluAdminExtension( hClusterIn, L"Networks", pClsidIn );

    return sc;

}  //*** RegisterCluAdminAllNetworksExtension

DWORD RegisterCluAdminAllNodesExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 142 of file RegExt.cpp.

{
    DWORD sc = ERROR_SUCCESS;

    sc = RegisterAnyCluAdminExtension( hClusterIn, L"Nodes", pClsidIn );

    return sc;

}  //*** RegisterCluAdminAllNodesExtension

DWORD RegisterCluAdminAllResourcesExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 208 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;

    sc = RegisterAnyCluAdminExtension( hClusterIn, L"Resources", pClsidIn );

    return sc;

}  //*** RegisterCluAdminAllResourcesExtension

DWORD RegisterCluAdminAllResourceTypesExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 241 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;

    sc = RegisterAnyCluAdminExtension( hClusterIn, L"ResourceTypes", pClsidIn );

    return sc;

}  //*** RegisterCluAdminAllResourceTypesExtension

DWORD RegisterCluAdminClusterExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 90 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;
    HKEY    hKey = NULL;

    //
    //  Get the cluster registry key.
    //

    hKey = GetClusterKey( hClusterIn, KEY_ALL_ACCESS );
    if ( hKey == NULL )
    {
        sc = GetLastError();
    } // if: error getting cluster key
    else
    {
        //
        //  Register the extension.
        //

        sc = RegisterAnyCluAdminExtension( hKey, pClsidIn );

        ClusterRegCloseKey( hKey );
    }  // else:  GetClusterKey succeeded

    return sc;

}  //*** RegisterCluAdminClusterExtension

DWORD RegisterCluAdminResourceTypeExtension | ( | HCLUSTER | hClusterIn,
 |  | LPCWSTR | pwszResourceTypeIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 348 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;
    HKEY    hKey = NULL;

    //
    // Get the resource type registry key.
    //

    hKey = GetClusterResourceTypeKey( hClusterIn, pwszResourceTypeIn, KEY_ALL_ACCESS );
    if ( hKey == NULL )
    {
        sc = GetLastError();
        if ( sc == ERROR_FILE_NOT_FOUND )
        {
            //
            //  If we failed to open the key with 'file not found' that means that
            //  the key doesn't exist.  We'll return a 'res type not found' error,
            //  which is more accurate.
            //

            sc = ERROR_CLUSTER_RESOURCE_TYPE_NOT_FOUND;
        } // if:
    } // if: error getting resource type key
    else
    {
        //
        //  Register the extension.
        //

        sc = RegisterAnyCluAdminExtension( hKey, pClsidIn );

        ClusterRegCloseKey( hKey );
    }  // else:  GetClusterResourceTypeKey succeeded

    return sc;

}  //*** RegisterCluAdminResourceTypeExtension

DWORD UnregisterCluAdminAllGroupsExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 496 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;

    sc = UnregisterAnyCluAdminExtension( hClusterIn, L"Groups", pClsidIn );

    return sc;

}  //*** UnregisterCluAdminAllGroupsExtension

DWORD UnregisterCluAdminAllNetInterfacesExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 628 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;

    sc = UnregisterAnyCluAdminExtension( hClusterIn, L"NetworkInterfaces", pClsidIn );

    return sc;

}  //*** UnregisterCluAdminAllNetInterfacesExtension

DWORD UnregisterCluAdminAllNetworksExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 595 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;

    sc = UnregisterAnyCluAdminExtension( hClusterIn, L"Networks", pClsidIn );

    return sc;

}  //*** UnregisterCluAdminAllNetworksExtension

DWORD UnregisterCluAdminAllNodesExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 463 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;

    sc = UnregisterAnyCluAdminExtension( hClusterIn, L"Nodes", pClsidIn );

    return sc;

}  //*** UnregisterCluAdminAllNodesExtension

DWORD UnregisterCluAdminAllResourcesExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 529 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;

    sc = UnregisterAnyCluAdminExtension( hClusterIn, L"Resources", pClsidIn );

    return sc;

}  //*** UnregisterCluAdminAllResourcesExtension

DWORD UnregisterCluAdminAllResourceTypesExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 562 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;

    sc = UnregisterAnyCluAdminExtension( hClusterIn, L"ResourceTypes", pClsidIn );

    return sc;

}  //*** UnregisterCluAdminAllResourceTypesExtension

DWORD UnregisterCluAdminClusterExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 411 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;
    HKEY    hKey = NULL;

    //
    //  Get the cluster registry key.
    //

    hKey = GetClusterKey(hClusterIn, KEY_ALL_ACCESS);
    if ( hKey == NULL )
    {
        sc = GetLastError();
    } // if: error getting cluster key
    else
    {
        //
        //  Unregister the extension.
        //

        sc = UnregisterAnyCluAdminExtension( hKey, pClsidIn );

        ClusterRegCloseKey( hKey );
    }  // else:  GetClusterKey succeeded

    return sc;

}  //*** UnregisterCluAdminClusterExtension

DWORD UnregisterCluAdminResourceTypeExtension | ( | HCLUSTER | hClusterIn,
 |  | LPCWSTR | pwszResourceTypeIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 663 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;
    HKEY    hKey = NULL;

    //
    //  Get the resource type registry key.
    //

    hKey = GetClusterResourceTypeKey( hClusterIn, pwszResourceTypeIn, KEY_ALL_ACCESS );
    if ( hKey == NULL )
    {
        sc = GetLastError();
        if ( sc == ERROR_FILE_NOT_FOUND )
        {
            //
            //  If we failed to open the key with 'file not found' that means that
            //  the key doesn't exist.  We'll return a 'res type not found' error,
            //  which is more accurate.
            //

            sc = ERROR_CLUSTER_RESOURCE_TYPE_NOT_FOUND;
        } // if:
    } // if: error getting resource type key
    else
    {
        //
        //  Unregister the extension.
        //

        sc = UnregisterAnyCluAdminExtension( hKey, pClsidIn );

        ClusterRegCloseKey( hKey );
    }  // else:  GetClusterResourceTypeKey succeeded

    return sc;

}  //*** UnregisterCluAdminResourceTypeExtension

Variable Documentation

const LPCWSTR REG_VALUE_ADMIN_EXTENSIONS = "AdminExtensions"

Definition at line 30 of file RegExt.cpp.

Generated on Wed Nov 13 2024 16:55:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/RegExt.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • ClipBookServer
  • ClipBook ServerEx
Functions

RegExt.h File Reference

Go to the source code of this file.

Functions

DWORD | RegisterCluAdminAllGroupsExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | RegisterCluAdminAllNetInterfacesExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | RegisterCluAdminAllNetworksExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | RegisterCluAdminAllNodesExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | RegisterCluAdminAllResourcesExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | RegisterCluAdminAllResourceTypesExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | RegisterCluAdminClusterExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | RegisterCluAdminResourceTypeExtension (HCLUSTER hClusterIn, LPCWSTR pwszResourceTypeIn, const CLSID *pClsidIn)
DWORD | UnregisterCluAdminAllGroupsExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | UnregisterCluAdminAllNetInterfacesExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | UnregisterCluAdminAllNetworksExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | UnregisterCluAdminAllNodesExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | UnregisterCluAdminAllResourcesExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | UnregisterCluAdminAllResourceTypesExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | UnregisterCluAdminClusterExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | UnregisterCluAdminResourceTypeExtension (HCLUSTER hClusterIn, LPCWSTR pwszResourceTypeIn, const CLSID *pClsid)

Function Documentation

DWORD RegisterCluAdminAllGroupsExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 175 of file RegExt.cpp.

{
    DWORD sc = ERROR_SUCCESS;

    sc = RegisterAnyCluAdminExtension( hClusterIn, L"Groups", pClsidIn );

    return sc;

}  //*** RegisterCluAdminAllGroupsExtension

DWORD RegisterCluAdminAllNetInterfacesExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 307 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;

    sc = RegisterAnyCluAdminExtension( hClusterIn, L"NetworkInterfaces", pClsidIn );

    return sc;

}  //*** RegisterCluAdminAllNetInterfacesExtension

DWORD RegisterCluAdminAllNetworksExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 274 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;

    sc = RegisterAnyCluAdminExtension( hClusterIn, L"Networks", pClsidIn );

    return sc;

}  //*** RegisterCluAdminAllNetworksExtension

DWORD RegisterCluAdminAllNodesExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 142 of file RegExt.cpp.

{
    DWORD sc = ERROR_SUCCESS;

    sc = RegisterAnyCluAdminExtension( hClusterIn, L"Nodes", pClsidIn );

    return sc;

}  //*** RegisterCluAdminAllNodesExtension

DWORD RegisterCluAdminAllResourcesExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 208 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;

    sc = RegisterAnyCluAdminExtension( hClusterIn, L"Resources", pClsidIn );

    return sc;

}  //*** RegisterCluAdminAllResourcesExtension

DWORD RegisterCluAdminAllResourceTypesExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 241 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;

    sc = RegisterAnyCluAdminExtension( hClusterIn, L"ResourceTypes", pClsidIn );

    return sc;

}  //*** RegisterCluAdminAllResourceTypesExtension

DWORD RegisterCluAdminClusterExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 90 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;
    HKEY    hKey = NULL;

    //
    //  Get the cluster registry key.
    //

    hKey = GetClusterKey( hClusterIn, KEY_ALL_ACCESS );
    if ( hKey == NULL )
    {
        sc = GetLastError();
    } // if: error getting cluster key
    else
    {
        //
        //  Register the extension.
        //

        sc = RegisterAnyCluAdminExtension( hKey, pClsidIn );

        ClusterRegCloseKey( hKey );
    }  // else:  GetClusterKey succeeded

    return sc;

}  //*** RegisterCluAdminClusterExtension

DWORD RegisterCluAdminResourceTypeExtension | ( | HCLUSTER | hClusterIn,
 |  | LPCWSTR | pwszResourceTypeIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 348 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;
    HKEY    hKey = NULL;

    //
    // Get the resource type registry key.
    //

    hKey = GetClusterResourceTypeKey( hClusterIn, pwszResourceTypeIn, KEY_ALL_ACCESS );
    if ( hKey == NULL )
    {
        sc = GetLastError();
        if ( sc == ERROR_FILE_NOT_FOUND )
        {
            //
            //  If we failed to open the key with 'file not found' that means that
            //  the key doesn't exist.  We'll return a 'res type not found' error,
            //  which is more accurate.
            //

            sc = ERROR_CLUSTER_RESOURCE_TYPE_NOT_FOUND;
        } // if:
    } // if: error getting resource type key
    else
    {
        //
        //  Register the extension.
        //

        sc = RegisterAnyCluAdminExtension( hKey, pClsidIn );

        ClusterRegCloseKey( hKey );
    }  // else:  GetClusterResourceTypeKey succeeded

    return sc;

}  //*** RegisterCluAdminResourceTypeExtension

DWORD UnregisterCluAdminAllGroupsExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 496 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;

    sc = UnregisterAnyCluAdminExtension( hClusterIn, L"Groups", pClsidIn );

    return sc;

}  //*** UnregisterCluAdminAllGroupsExtension

DWORD UnregisterCluAdminAllNetInterfacesExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 628 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;

    sc = UnregisterAnyCluAdminExtension( hClusterIn, L"NetworkInterfaces", pClsidIn );

    return sc;

}  //*** UnregisterCluAdminAllNetInterfacesExtension

DWORD UnregisterCluAdminAllNetworksExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 595 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;

    sc = UnregisterAnyCluAdminExtension( hClusterIn, L"Networks", pClsidIn );

    return sc;

}  //*** UnregisterCluAdminAllNetworksExtension

DWORD UnregisterCluAdminAllNodesExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 463 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;

    sc = UnregisterAnyCluAdminExtension( hClusterIn, L"Nodes", pClsidIn );

    return sc;

}  //*** UnregisterCluAdminAllNodesExtension

DWORD UnregisterCluAdminAllResourcesExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 529 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;

    sc = UnregisterAnyCluAdminExtension( hClusterIn, L"Resources", pClsidIn );

    return sc;

}  //*** UnregisterCluAdminAllResourcesExtension

DWORD UnregisterCluAdminAllResourceTypesExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 562 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;

    sc = UnregisterAnyCluAdminExtension( hClusterIn, L"ResourceTypes", pClsidIn );

    return sc;

}  //*** UnregisterCluAdminAllResourceTypesExtension

DWORD UnregisterCluAdminClusterExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 411 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;
    HKEY    hKey = NULL;

    //
    //  Get the cluster registry key.
    //

    hKey = GetClusterKey(hClusterIn, KEY_ALL_ACCESS);
    if ( hKey == NULL )
    {
        sc = GetLastError();
    } // if: error getting cluster key
    else
    {
        //
        //  Unregister the extension.
        //

        sc = UnregisterAnyCluAdminExtension( hKey, pClsidIn );

        ClusterRegCloseKey( hKey );
    }  // else:  GetClusterKey succeeded

    return sc;

}  //*** UnregisterCluAdminClusterExtension

DWORD UnregisterCluAdminResourceTypeExtension | ( | HCLUSTER | hClusterIn,
 |  | LPCWSTR | pwszResourceTypeIn,
 |  | const CLSID * | pClsid
 | ) |  |

Definition at line 663 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;
    HKEY    hKey = NULL;

    //
    //  Get the resource type registry key.
    //

    hKey = GetClusterResourceTypeKey( hClusterIn, pwszResourceTypeIn, KEY_ALL_ACCESS );
    if ( hKey == NULL )
    {
        sc = GetLastError();
        if ( sc == ERROR_FILE_NOT_FOUND )
        {
            //
            //  If we failed to open the key with 'file not found' that means that
            //  the key doesn't exist.  We'll return a 'res type not found' error,
            //  which is more accurate.
            //

            sc = ERROR_CLUSTER_RESOURCE_TYPE_NOT_FOUND;
        } // if:
    } // if: error getting resource type key
    else
    {
        //
        //  Unregister the extension.
        //

        sc = UnregisterAnyCluAdminExtension( hKey, pClsidIn );

        ClusterRegCloseKey( hKey );
    }  // else:  GetClusterResourceTypeKey succeeded

    return sc;

}  //*** UnregisterCluAdminResourceTypeExtension

Generated on Wed Nov 13 2024 16:55:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/resource.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • ClipBookServer
  • ClipBook ServerEx
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_PP_ICON 1000
#define | IDC_PP_TITLE 1001
#define | IDD_PP_CLIPBOOKSERVER_PARAMETERS 130
#define | IDD_WIZ_CLIPBOOKSERVER_PARAMETERS 131
#define | IDS_ALLRESOURCES_MENU_ITEM_1 1140
#define | IDS_ALLRESOURCES_MENU_ITEM_1_DESC 1141
#define | IDS_ALLRESTYPES_MENU_ITEM_1 1160
#define | IDS_ALLRESTYPES_MENU_ITEM_1_DESC 1161
#define | IDS_APPLY_PARAM_CHANGES_ERROR 31200
#define | IDS_CLUADMEX_COMOBJ_DESC 31100
#define | IDS_CLUSTER_MENU_ITEM_1 1100
#define | IDS_CLUSTER_MENU_ITEM_1_DESC 1101
#define | IDS_ERROR_MSG_ID 31101
#define | IDS_ERROR_SETTING_PROPERTIES 31103
#define | IDS_ERROR_VALIDATING_PROPERTIES 31104
#define | IDS_GROUP_MENU_ITEM_1 1120
#define | IDS_GROUP_MENU_ITEM_1_DESC 1121
#define | IDS_NETINTERFACE_MENU_ITEM_1 1180
#define | IDS_NETINTERFACE_MENU_ITEM_1_DESC 1181
#define | IDS_NETWORK_MENU_ITEM_1 1170
#define | IDS_NETWORK_MENU_ITEM_1_DESC 1171
#define | IDS_NODE_MENU_ITEM_1 1110
#define | IDS_NODE_MENU_ITEM_1_DESC 1111
#define | IDS_REQUIRED_FIELD_EMPTY 31102
#define | IDS_RESOURCE_MENU_ITEM_1 1130
#define | IDS_RESOURCE_MENU_ITEM_1_DESC 1131
#define | IDS_RESTYPE_MENU_ITEM_1 1150
#define | IDS_RESTYPE_MENU_ITEM_1_DESC 1151

Define Documentation

#define IDC_PP_ICON 1000

Definition at line 7 of file resource.h.

#define IDC_PP_TITLE 1001

Definition at line 8 of file resource.h.

#define IDD_PP_CLIPBOOKSERVER_PARAMETERS 130

Definition at line 5 of file resource.h.

#define IDD_WIZ_CLIPBOOKSERVER_PARAMETERS 131

Definition at line 6 of file resource.h.

#define IDS_ALLRESOURCES_MENU_ITEM_1 1140

Definition at line 17 of file resource.h.

#define IDS_ALLRESOURCES_MENU_ITEM_1_DESC 1141

Definition at line 18 of file resource.h.

#define IDS_ALLRESTYPES_MENU_ITEM_1 1160

Definition at line 21 of file resource.h.

#define IDS_ALLRESTYPES_MENU_ITEM_1_DESC 1161

Definition at line 22 of file resource.h.

#define IDS_APPLY_PARAM_CHANGES_ERROR 31200

Definition at line 32 of file resource.h.

#define IDS_CLUADMEX_COMOBJ_DESC 31100

Definition at line 27 of file resource.h.

#define IDS_CLUSTER_MENU_ITEM_1 1100

Definition at line 9 of file resource.h.

#define IDS_CLUSTER_MENU_ITEM_1_DESC 1101

Definition at line 10 of file resource.h.

#define IDS_ERROR_MSG_ID 31101

Definition at line 28 of file resource.h.

#define IDS_ERROR_SETTING_PROPERTIES 31103

Definition at line 30 of file resource.h.

#define IDS_ERROR_VALIDATING_PROPERTIES 31104

Definition at line 31 of file resource.h.

#define IDS_GROUP_MENU_ITEM_1 1120

Definition at line 13 of file resource.h.

#define IDS_GROUP_MENU_ITEM_1_DESC 1121

Definition at line 14 of file resource.h.

#define IDS_NETINTERFACE_MENU_ITEM_1 1180

Definition at line 25 of file resource.h.

#define IDS_NETINTERFACE_MENU_ITEM_1_DESC 1181

Definition at line 26 of file resource.h.

#define IDS_NETWORK_MENU_ITEM_1 1170

Definition at line 23 of file resource.h.

#define IDS_NETWORK_MENU_ITEM_1_DESC 1171

Definition at line 24 of file resource.h.

#define IDS_NODE_MENU_ITEM_1 1110

Definition at line 11 of file resource.h.

#define IDS_NODE_MENU_ITEM_1_DESC 1111

Definition at line 12 of file resource.h.

#define IDS_REQUIRED_FIELD_EMPTY 31102

Definition at line 29 of file resource.h.

#define IDS_RESOURCE_MENU_ITEM_1 1130

Definition at line 15 of file resource.h.

#define IDS_RESOURCE_MENU_ITEM_1_DESC 1131

Definition at line 16 of file resource.h.

#define IDS_RESTYPE_MENU_ITEM_1 1150

Definition at line 19 of file resource.h.

#define IDS_RESTYPE_MENU_ITEM_1_DESC 1151

Definition at line 20 of file resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/ResProp.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • ClipBookServer
  • ClipBook ServerEx

ResProp.cpp File Reference

#include "stdafx.h"
#include "ClipBook ServerEx.h"
#include "ResProp.h"
#include "ExtObj.h"
#include "DDxDDv.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:55:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/ResProp.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • ClipBookServer
  • ClipBook ServerEx
Classes

ResProp.h File Reference

#include "BasePage.h"
#include "PropList.h"

Go to the source code of this file.

Classes

class CClipBookServerParamsPage
Generated on Wed Nov 13 2024 16:55:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/StdAfx.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • ClipBookServer
  • ClipBook ServerEx
Variables

StdAfx.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Variables

const WCHAR g_wszResourceTypeNames [] = "ClipBook Server\0"

Variable Documentation

const WCHAR g_wszResourceTypeNames[] = "ClipBook Server\0"

Definition at line 7 of file StdAfx.cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/ClipBookServer/ClipBook ServerEx/StdAfx.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • ClipBookServer
  • ClipBook ServerEx
Defines | Typedefs | Variables

StdAfx.h File Reference

#include <afxwin.h>
#include <afxext.h>
#include <afxdisp.h>
#include <afxtempl.h>
#include <afxcmn.h>
#include <afxpriv.h>
#include <atlbase.h>
#include <atlcom.h>
#include <clusapi.h>
#include <resapi.h>
#include <strsafe.h>
#include "proplist.h"
#include "proplist.h"

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _UNICODE
#define | RTL_NUMBER_OF(A) (sizeof(A)/sizeof((A)[0]))
#define | STRSAFE_LIB
#define | VC_EXTRALEAN

Typedefs

typedef UINT | IDD
typedef UINT | IDS

Variables

CComModule | _Module
const WCHAR | g_wszResourceTypeNames []

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 21 of file StdAfx.h.

#define _UNICODE

Definition at line 11 of file StdAfx.h.

#define RTL_NUMBER_OF ( A ) (sizeof(A)/sizeof((A)[0]))

Definition at line 28 of file StdAfx.h.

#define STRSAFE_LIB

Definition at line 76 of file StdAfx.h.

#define VC_EXTRALEAN

Definition at line 8 of file StdAfx.h.

Typedef Documentation

typedef UINT IDD

Definition at line 88 of file StdAfx.h.

typedef UINT IDS

Definition at line 87 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

const WCHAR g_wszResourceTypeNames[]

Definition at line 7 of file StdAfx.cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/FileShareSample/File Share Sample/ClRes.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • FileShareSample
  • File Share Sample
Functions | Variables

ClRes.cpp File Reference

#include "ClRes.h"

Go to the source code of this file.

Functions

BOOL WINAPI | DllMain (HINSTANCE hInstanceIn, DWORD nReasonIn, LPVOID ReservedIn)
DWORD WINAPI | Startup (LPCWSTR pwszResourceTypeIn, DWORD nMinVersionSupportedIn, DWORD nMaxVersionSupportedIn, PSET_RESOURCE_STATUS_ROUTINE pfnSetResourceStatusIn, PLOG_EVENT_ROUTINE pfnLogEventIn, PCLRES_FUNCTION_TABLE *pFunctionTableOut)

Variables

HINSTANCE | g_hInstance = NULL
PLOG_EVENT_ROUTINE | g_pfnLogEvent = NULL
PSET_RESOURCE_STATUS_ROUTINE | g_pfnSetResourceStatus = NULL

Function Documentation

BOOL WINAPI DllMain | ( | HINSTANCE | hInstanceIn,
 |  | DWORD | nReasonIn,
 |  | LPVOID | ReservedIn
 | ) |  |

Definition at line 86 of file ClRes.cpp.

{
    BOOL    fSuccess = TRUE;

    //
    // Perform global initialization.
    //

    switch ( nReasonIn )
    {
        case DLL_PROCESS_ATTACH:
            g_hInstance = hInstanceIn;
            DisableThreadLibraryCalls( hInstanceIn );
            break;

        case DLL_PROCESS_DETACH:
            break;

    } // switch: nReason

    //
    // Pass this request off to the resource type-specific routines.
    //

    fSuccess = FileShareSampleDllMain( hInstanceIn, nReasonIn, ReservedIn );

    return fSuccess;

} //*** DllMain

DWORD WINAPI Startup | ( | LPCWSTR | pwszResourceTypeIn,
 |  | DWORD | nMinVersionSupportedIn,
 |  | DWORD | nMaxVersionSupportedIn,
 |  | PSET_RESOURCE_STATUS_ROUTINE | pfnSetResourceStatusIn,
 |  | PLOG_EVENT_ROUTINE | pfnLogEventIn,
 |  | PCLRES_FUNCTION_TABLE * | pFunctionTableOut
 | ) |  |

Definition at line 184 of file ClRes.cpp.

{
    DWORD   sc = ERROR_CLUSTER_RESNAME_NOT_FOUND;

    //
    // Save the function pointers if they haven't been saved yet.
    //

    if ( g_pfnLogEvent == NULL )
    {
        g_pfnLogEvent = pfnLogEventIn;
        g_pfnSetResourceStatus = pfnSetResourceStatusIn;
    } // if: function pointers specified

    //
    // Call the resource type-specific Startup routine.
    //

    if ( NIStringCompareW( pwszResourceTypeIn, RESTYPE_NAME, RTL_NUMBER_OF( RESTYPE_NAME ) ) == 0 )
    {
        sc = FileShareSampleStartup(
                  pwszResourceTypeIn
                , nMinVersionSupportedIn
                , nMaxVersionSupportedIn
                , pfnSetResourceStatusIn
                , pfnLogEventIn
                , pFunctionTableOut
                );
    } // if: File Share Sample resource type

    return sc;

} //*** Startup

Variable Documentation

HINSTANCE g_hInstance = NULL

Definition at line 30 of file ClRes.cpp.

PLOG_EVENT_ROUTINE g_pfnLogEvent = NULL

Definition at line 33 of file ClRes.cpp.

PSET_RESOURCE_STATUS_ROUTINE g_pfnSetResourceStatus = NULL

Definition at line 36 of file ClRes.cpp.

Generated on Wed Nov 13 2024 16:54:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/FileShareSample/File Share Sample/ClRes.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • FileShareSample
  • File Share Sample
Defines | Functions | Variables

ClRes.h File Reference

#include <windows.h>
#include <clusapi.h>
#include <resapi.h>
#include <stdio.h>
#include <strsafe.h>
#include <assert.h>
#include "StringUtils.h"
#include "StringUtils.h"

Go to the source code of this file.

Defines

#define | _UNICODE 1
#define | _WIN32_WINNT 0x0502
#define | DBG_PRINT printf
#define | FILESHARESAMPLE_SVCNAME L"LanmanServer"
#define | RESTYPE_DLL_NAME L"File Share Sample.dll"
#define | RESTYPE_NAME L"File Share Sample"
#define | RTL_NUMBER_OF(A) (sizeof(A)/sizeof((A)[0]))
#define | UNICODE 1

Functions

BOOL WINAPI | FileShareSampleDllMain (HINSTANCE hDllHandleIn, DWORD nReasonIn, LPVOID ReservedIn)
DWORD WINAPI | FileShareSampleStartup (LPCWSTR pwszResourceTypeIn, DWORD nMinVersionSupportedIn, DWORD nMaxVersionSupportedIn, PSET_RESOURCE_STATUS_ROUTINE pfnSetResourceStatusIn, PLOG_EVENT_ROUTINE pfnLogEventIn, PCLRES_FUNCTION_TABLE *pFunctionTableOut)

Variables

HINSTANCE | g_hInstance
PLOG_EVENT_ROUTINE | g_pfnLogEvent
PSET_RESOURCE_STATUS_ROUTINE | g_pfnSetResourceStatus

Define Documentation

#define _UNICODE 1

Definition at line 30 of file ClRes.h.

#define _WIN32_WINNT 0x0502

Definition at line 32 of file ClRes.h.

#define DBG_PRINT printf

Definition at line 93 of file ClRes.h.

#define FILESHARESAMPLE_SVCNAME L"LanmanServer"

Definition at line 72 of file ClRes.h.

#define RESTYPE_DLL_NAME L"File Share Sample.dll"

Definition at line 66 of file ClRes.h.

#define RESTYPE_NAME L"File Share Sample"

Definition at line 60 of file ClRes.h.

#define RTL_NUMBER_OF ( A ) (sizeof(A)/sizeof((A)[0]))

Definition at line 119 of file ClRes.h.

#define UNICODE 1

Definition at line 29 of file ClRes.h.

Function Documentation

BOOL WINAPI FileShareSampleDllMain | ( | HINSTANCE | hDllHandleIn,
 |  | DWORD | nReasonIn,
 |  | LPVOID | ReservedIn
 | ) |  |

Definition at line 235 of file File Share Sample.cpp.

{
    BOOL    fSuccess = TRUE;

    UNREFERENCED_PARAMETER( hDllHandleIn );
    UNREFERENCED_PARAMETER( ReservedIn );

    switch ( nReasonIn )
    {
        case DLL_PROCESS_ATTACH:
            break;

        case DLL_PROCESS_DETACH:
            break;

    } // switch: nReason

    return fSuccess;

} //*** FileShareSampleDllMain

DWORD WINAPI FileShareSampleStartup | ( | LPCWSTR | pwszResourceTypeIn,
 |  | DWORD | nMinVersionSupportedIn,
 |  | DWORD | nMaxVersionSupportedIn,
 |  | PSET_RESOURCE_STATUS_ROUTINE | pfnSetResourceStatusIn,
 |  | PLOG_EVENT_ROUTINE | pfnLogEventIn,
 |  | PCLRES_FUNCTION_TABLE * | pFunctionTableOut
 | ) |  |

Definition at line 325 of file File Share Sample.cpp.

{
    DWORD sc = ERROR_SUCCESS;

    // These are stored in the calling DllMain.
    UNREFERENCED_PARAMETER( pfnSetResourceStatusIn );
    UNREFERENCED_PARAMETER( pfnLogEventIn );

    if (   (nMinVersionSupportedIn > CLRES_VERSION_V1_00)
        || (nMaxVersionSupportedIn < CLRES_VERSION_V1_00) )
    {
        sc = ERROR_REVISION_MISMATCH;
    } // if: version not supported
    else if ( NIStringCompareW( pwszResourceTypeIn, RESTYPE_NAME, RTL_NUMBER_OF( RESTYPE_NAME ) ) == 0 )
    {
        *pFunctionTableOut = &g_FileShareSampleFunctionTable;
        sc = ERROR_SUCCESS;
    } // else if: we support this type of resource
    else
    {
        //
        // We don't support this resource type.
        //

        sc = ERROR_CLUSTER_RESNAME_NOT_FOUND;
    } // else: resource type name not supported

    return sc;

} //*** FileShareSampleStartup

Variable Documentation

HINSTANCE g_hInstance

Definition at line 104 of file SServer.Cpp.

PLOG_EVENT_ROUTINE g_pfnLogEvent

Definition at line 44 of file ClRes.cpp.

PSET_RESOURCE_STATUS_ROUTINE g_pfnSetResourceStatus

Definition at line 47 of file ClRes.cpp.

Generated on Wed Nov 13 2024 16:54:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/FileShareSample/File Share Sample/File Share Sample.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • FileShareSample
  • File Share Sample
Classes | Defines | Typedefs | Functions | Variables

File Share Sample.cpp File Reference

#include "ClRes.h"
#include <lmerr.h>
#include <lmshare.h>
#include <LMAPIbuf.h>

Go to the source code of this file.

Classes

struct | _FILESHARESAMPLE_PROPS
struct | _FILESHARESAMPLE_RESOURCE

Defines

#define | CLUSCTL_RESOURCE_FILESHARESAMPLE_CALL_ISALIVE CLUSCTL_USER_CODE( 1, CLUS_OBJECT_RESOURCE )
#define | PROP_DEFAULT__MAXUSERS (4294967295)
#define | PROP_MAX__MAXUSERS (4294967295)
#define | PROP_MIN__MAXUSERS (0)
#define | PROP_NAME__MAXUSERS L"MaxUsers"
#define | PROP_NAME__PATH L"Path"
#define | PROP_NAME__REMARK L"Remark"
#define | PROP_NAME__SHARENAME L"ShareName"

Typedefs

typedef struct
_FILESHARESAMPLE_PROPS 		FILESHARESAMPLE_PROPS
typedef struct
_FILESHARESAMPLE_RESOURCE 		FILESHARESAMPLE_RESOURCE
typedef struct
_FILESHARESAMPLE_PROPS * 		PFILESHARESAMPLE_PROPS
typedef struct
_FILESHARESAMPLE_RESOURCE * 		PFILESHARESAMPLE_RESOURCE

Functions

CLRES_V1_FUNCTION_TABLE (g_FileShareSampleFunctionTable, CLRES_VERSION_V1_00, FileShareSample, NULL, NULL, FileShareSampleResourceControl, FileShareSampleResourceTypeControl)
BOOL | FileShareSampleCheckIsAlive (PFILESHARESAMPLE_RESOURCE pResourceEntryIn, BOOL fFullCheckIn)
void WINAPI | FileShareSampleClose (RESID residIn)
BOOL WINAPI | FileShareSampleDllMain (HINSTANCE hDllHandleIn, DWORD nReasonIn, LPVOID ReservedIn)
DWORD | FileShareSampleGetPrivateResProperties (PFILESHARESAMPLE_RESOURCE pResourceEntryIn, PVOID pOutBufferOut, DWORD cbOutBufferSizeIn, LPDWORD pcbBytesReturnedOut)
BOOL WINAPI | FileShareSampleIsAlive (RESID residIn)
BOOL WINAPI | FileShareSampleLooksAlive (RESID residIn)
DWORD WINAPI | FileShareSampleOffline (RESID residIn)
DWORD WINAPI | FileShareSampleOfflineThread (PCLUS_WORKER pWorkerIn, PFILESHARESAMPLE_RESOURCE pResourceEntryIn)
DWORD WINAPI | FileShareSampleOnline (RESID residIn, PHANDLE phEventHandleInout)
DWORD WINAPI | FileShareSampleOnlineThread (PCLUS_WORKER pWorkerIn, PFILESHARESAMPLE_RESOURCE pResourceEntryIn)
RESID WINAPI | FileShareSampleOpen (LPCWSTR pwszResourceNameIn, HKEY hkeyResourceKeyIn, RESOURCE_HANDLE hResourceHandleIn)
DWORD WINAPI | FileShareSampleResourceControl (RESID residIn, DWORD nControlCodeIn, PVOID pInBufferIn, DWORD cbInBufferSizeIn, PVOID pOutBufferOut, DWORD cbOutBufferSizeIn, LPDWORD pcbBytesReturnedOut)
DWORD WINAPI | FileShareSampleResourceTypeControl (LPCWSTR pwszResourceTypeNameIn, DWORD nControlCodeIn, PVOID pInBufferIn, DWORD cbInBufferSizeIn, PVOID pOutBufferOut, DWORD cbOutBufferSizeIn, LPDWORD pcbBytesReturnedOut)
DWORD | FileShareSampleSetNameHandler (PFILESHARESAMPLE_RESOURCE pResourceEntryIn, LPWSTR pwszNameIn)
DWORD | FileShareSampleSetPrivateResProperties (PFILESHARESAMPLE_RESOURCE pResourceEntryIn, const PVOID pInBufferIn, DWORD cbInBufferSizeIn)
DWORD WINAPI | FileShareSampleStartup (LPCWSTR pwszResourceTypeIn, DWORD nMinVersionSupportedIn, DWORD nMaxVersionSupportedIn, PSET_RESOURCE_STATUS_ROUTINE pfnSetResourceStatusIn, PLOG_EVENT_ROUTINE pfnLogEventIn, PCLRES_FUNCTION_TABLE *pFunctionTableOut)
void WINAPI | FileShareSampleTerminate (RESID residIn)
DWORD | FileShareSampleValidatePrivateResProperties (PFILESHARESAMPLE_RESOURCE pResourceEntryIn, const PVOID pInBufferIn, DWORD cbInBufferSizeIn, PFILESHARESAMPLE_PROPS pPropsOut)

Variables

RESUTIL_PROPERTY_ITEM | FileShareSampleResourcePrivateProperties []
CLRES_FUNCTION_TABLE | g_FileShareSampleFunctionTable

Define Documentation

#define CLUSCTL_RESOURCE_FILESHARESAMPLE_CALL_ISALIVE CLUSCTL_USER_CODE( 1, CLUS_OBJECT_RESOURCE )

Definition at line 29 of file File Share Sample.cpp.

#define PROP_DEFAULT__MAXUSERS (4294967295)

Definition at line 39 of file File Share Sample.cpp.

#define PROP_MAX__MAXUSERS (4294967295)

Definition at line 38 of file File Share Sample.cpp.

#define PROP_MIN__MAXUSERS (0)

Definition at line 37 of file File Share Sample.cpp.

#define PROP_NAME__MAXUSERS L"MaxUsers"

Definition at line 35 of file File Share Sample.cpp.

#define PROP_NAME__PATH L"Path"

Definition at line 33 of file File Share Sample.cpp.

#define PROP_NAME__REMARK L"Remark"

Definition at line 34 of file File Share Sample.cpp.

#define PROP_NAME__SHARENAME L"ShareName"

Definition at line 32 of file File Share Sample.cpp.

Typedef Documentation

typedef struct _FILESHARESAMPLE_PROPS FILESHARESAMPLE_PROPS
typedef struct _FILESHARESAMPLE_RESOURCE FILESHARESAMPLE_RESOURCE
typedef struct _FILESHARESAMPLE_PROPS * PFILESHARESAMPLE_PROPS
typedef struct _FILESHARESAMPLE_RESOURCE * PFILESHARESAMPLE_RESOURCE

Function Documentation

CLRES_V1_FUNCTION_TABLE | ( | g_FileShareSampleFunctionTable | ,
 |  | CLRES_VERSION_V1_00 | ,
 |  | FileShareSample | ,
 |  | NULL | ,
 |  | NULL | ,
 |  | FileShareSampleResourceControl | ,
 |  | FileShareSampleResourceTypeControl |
 | ) |  |
BOOL FileShareSampleCheckIsAlive | ( | PFILESHARESAMPLE_RESOURCE | pResourceEntryIn,
 |  | BOOL | fFullCheckIn
 | ) |  |

Definition at line 1674 of file File Share Sample.cpp.

{
    BOOL            fIsAlive = FALSE;
    DWORD           sc = ERROR_SUCCESS;
    SHARE_INFO_2 *  pshareInfo = NULL;
    HANDLE          hFile = NULL;
    WIN32_FIND_DATA fileData;

    ZeroMemory( &fileData, sizeof( fileData ) );

    //
    // Reset the variable.
    //

    pResourceEntryIn->fIsAliveFailed = FALSE;

    //
    // Check to see if the resource is alive.
    //

    sc = NetShareGetInfo(
              NULL
            , pResourceEntryIn->propsActive.pwszShareName
            , 2     // return a SHARE_INFO_2 structure
            , reinterpret_cast< LPBYTE * >( &pshareInfo )
            );
    if ( sc == NERR_NetNameNotFound )
    {
        (g_pfnLogEvent)(
              pResourceEntryIn->hResourceHandle
            , LOG_ERROR
            , L"CheckIsAlive: Error, share '%1!ws!' went away.\n"
            , pResourceEntryIn->propsActive.pwszShareName
            );
        goto Cleanup;
    } // if:  share name not found
    else if ( sc != NERR_Success )
    {
        (g_pfnLogEvent)(
              pResourceEntryIn->hResourceHandle
            , LOG_ERROR
            , L"CheckIsAlive: Error %1!u! checking for share '%2!ws!'.\n"
            , sc
            , pResourceEntryIn->propsActive.pwszShareName
            );
        goto Cleanup;
    } // else if: error getting share info

    if ( fFullCheckIn == TRUE )
    {
        //
        // Do a full check by trying to open a file on the share.
        //

        hFile = FindFirstFileW( pResourceEntryIn->pwszUNCSharedPath, &fileData );

        //
        // If we fail on the first attempt, try again.  There seems to be
        // a bug in the RDR where the first attempt to read a share after
        // it has been deleted and reinstated fails.
        //

        if ( hFile == INVALID_HANDLE_VALUE )
        {
            hFile = FindFirstFileW( pResourceEntryIn->pwszUNCSharedPath, &fileData );
        } // if:  error finding file

        //
        // If we succeeded in finding a file, or there were no files in
        // the path, then return success, otherwise we had a failure.
        //

        sc = GetLastError();

        if (    ( hFile == INVALID_HANDLE_VALUE )
             && ( sc    != ERROR_FILE_NOT_FOUND )
             && ( sc    != ERROR_ACCESS_DENIED )
           )
        {
            (g_pfnLogEvent)(
                  pResourceEntryIn->hResourceHandle
                , LOG_ERROR
                , L"CheckIsAlive: Share has gone offline!\n"
                );
        } // if:  error finding the file
        else
        {
            FindClose( hFile );
            sc = ERROR_SUCCESS;     // There are other non-failure status codes possible, reset to success.
        } // else:  found file
    } // if: performing a full check

Cleanup:

    NetApiBufferFree( reinterpret_cast< LPBYTE * >( pshareInfo ) );
    pshareInfo = NULL;

    if ( sc == ERROR_SUCCESS )
    {
        fIsAlive = TRUE;
    } // if:

    return fIsAlive;

} //*** FileShareSampleCheckIsAlive

void WINAPI FileShareSampleClose ( RESID residIn )

Definition at line 657 of file File Share Sample.cpp.

{
    PFILESHARESAMPLE_RESOURCE pResourceEntry = NULL;
    DWORD                   sc = ERROR_SUCCESS;

    //
    // Verify we have a valid resource ID.
    //

    pResourceEntry = static_cast< PFILESHARESAMPLE_RESOURCE >( residIn );
    if ( pResourceEntry == NULL )
    {
        DBG_PRINT( "FileShareSample: Close request for a nonexistent resource id.\n" );
        sc = ERROR_RESOURCE_NOT_FOUND;
        goto Cleanup;
    } // if: NULL resource ID

    if ( pResourceEntry->resid != residIn )
    {
        (g_pfnLogEvent)(
              pResourceEntry->hResourceHandle
            , LOG_ERROR
            , L"Close resource sanity check failed! resid = 0x%1!08x!.\n"
            , residIn
            );
        sc = ERROR_RESOURCE_NOT_FOUND;
        goto Cleanup;
    } // if: invalid resource ID

    if ( pResourceEntry->pwszResourceName == NULL )
    {
        (g_pfnLogEvent)(
              pResourceEntry->hResourceHandle
            , LOG_INFORMATION
            , L"Close request for resource with resid 0x%1!08x!.\n"
            , residIn
            );
    } // if: resource name is null...
    else
    {
        (g_pfnLogEvent)(
              pResourceEntry->hResourceHandle
            , LOG_INFORMATION
            , L"Close request for resource '%1!s!'.\n"
            , pResourceEntry->pwszResourceName
            );
    } // else: resource name is not null...

    //
    // Close the Parameters key.
    //

    if ( pResourceEntry->hkeyParameters != NULL )
    {
        ClusterRegCloseKey( pResourceEntry->hkeyParameters );
        pResourceEntry->hkeyParameters = NULL;
    } // if: parameters key is open

    //
    // Close the cluster handle.
    //

    if ( pResourceEntry->hCluster != NULL )
    {
        CloseCluster( pResourceEntry->hCluster );
        pResourceEntry->hCluster = NULL;
    } // if: cluster handle is open

    //
    // Close the resource handle.
    //

    if ( pResourceEntry->hResource != NULL )
    {
        CloseClusterResource( pResourceEntry->hResource );
        pResourceEntry->hResource = NULL;
    } // if: resource handle is open

    // ADDPARAM: Add new properties here.

    //
    // The ResUtil API's use LocalAlloc, so use LocalFree on the prop list members.
    //

    LocalFree( pResourceEntry->propsActive.pwszShareName );
    LocalFree( pResourceEntry->props.pwszShareName );
    LocalFree( pResourceEntry->propsActive.pwszPath );
    LocalFree( pResourceEntry->props.pwszPath );
    LocalFree( pResourceEntry->propsActive.pwszRemark );
    LocalFree( pResourceEntry->props.pwszRemark );
    LocalFree( pResourceEntry->pwszExpandedPath );

    //
    // Deallocate the resource entry.
    //

    delete [] pResourceEntry->pwszResourceName;
    delete [] pResourceEntry->pwszComputerName;
    delete [] pResourceEntry->pwszUNCSharedPath;

    delete pResourceEntry;

    sc = ERROR_SUCCESS;

Cleanup:

    SetLastError( sc );

    return;

} //*** FileShareSampleClose

BOOL WINAPI FileShareSampleDllMain | ( | HINSTANCE | hDllHandleIn,
 |  | DWORD | nReasonIn,
 |  | LPVOID | ReservedIn
 | ) |  |

Definition at line 235 of file File Share Sample.cpp.

{
    BOOL    fSuccess = TRUE;

    UNREFERENCED_PARAMETER( hDllHandleIn );
    UNREFERENCED_PARAMETER( ReservedIn );

    switch ( nReasonIn )
    {
        case DLL_PROCESS_ATTACH:
            break;

        case DLL_PROCESS_DETACH:
            break;

    } // switch: nReason

    return fSuccess;

} //*** FileShareSampleDllMain

DWORD FileShareSampleGetPrivateResProperties | ( | PFILESHARESAMPLE_RESOURCE | pResourceEntryIn,
 |  | PVOID | pOutBufferOut,
 |  | DWORD | cbOutBufferSizeIn,
 |  | LPDWORD | pcbBytesReturnedOut
 | ) |  |

Definition at line 2140 of file File Share Sample.cpp.

{
    DWORD   sc;
    DWORD   cbRequired = 0;

    sc = ResUtilGetAllProperties(
              pResourceEntryIn->hkeyParameters
            , FileShareSampleResourcePrivateProperties
            , pOutBufferOut
            , cbOutBufferSizeIn
            , pcbBytesReturnedOut
            , &cbRequired
            );
    if ( sc == ERROR_MORE_DATA )
    {
        *pcbBytesReturnedOut = cbRequired;
    } // if: output buffer is too small

    return sc;

} //*** FileShareSampleGetPrivateResProperties

BOOL WINAPI FileShareSampleIsAlive ( RESID residIn )

Definition at line 1593 of file File Share Sample.cpp.

{
    PFILESHARESAMPLE_RESOURCE pResourceEntry = NULL;

    //
    // Verify we have a valid resource ID.
    //

    pResourceEntry = static_cast< PFILESHARESAMPLE_RESOURCE >( residIn );
    if ( pResourceEntry == NULL )
    {
        DBG_PRINT( "File Share Sample: IsAlive request for a nonexistent resource id.\n" );
        return FALSE;
    } // if: NULL resource ID

    if ( pResourceEntry->resid != residIn )
    {
        (g_pfnLogEvent)(
              pResourceEntry->hResourceHandle
            , LOG_ERROR
            , L"IsAlive sanity check failed! resid = 0x%1!08x!.\n"
            , residIn
            );
        return FALSE;
    } // if: invalid resource ID

#ifdef LOG_VERBOSE
    (g_pfnLogEvent)(
          pResourceEntry->hResourceHandle
        , LOG_INFORMATION
        , L"IsAlive request.\n"
        );
#endif

    //
    // Check to see if the resource is alive.
    //

    return FileShareSampleCheckIsAlive( pResourceEntry, TRUE /* fFullCheck */ );

} //** FileShareSampleIsAlive

BOOL WINAPI FileShareSampleLooksAlive ( RESID residIn )

Definition at line 1482 of file File Share Sample.cpp.

{
    PFILESHARESAMPLE_RESOURCE   pResourceEntry = NULL;
    BOOL                        fRet = FALSE;

    //
    // Verify we have a valid resource ID.
    //

    pResourceEntry = static_cast< PFILESHARESAMPLE_RESOURCE >( residIn );
    if ( pResourceEntry == NULL )
    {
        DBG_PRINT( "File Share Sample: LooksAlive request for a nonexistent resource id.\n" );
        return FALSE;
    } // if: NULL resource ID

    if ( pResourceEntry->resid != residIn )
    {
        (g_pfnLogEvent)(
              pResourceEntry->hResourceHandle
            , LOG_ERROR
            , L"LooksAlive sanity check failed! resid = 0x%1!08x!.\n"
            , residIn
            );
        return FALSE;
    } // if: invalid resource ID

#ifdef LOG_VERBOSE
    (g_pfnLogEvent)(
          pResourceEntry->hResourceHandle
        , LOG_INFORMATION
        , L"LooksAlive request.\n"
        );
#endif

    //
    // NOTE: LooksAlive should be a quick check to see if the resource is
    // available or not, whereas IsAlive should be a thorough check.  If
    // there are no differences between a quick check and a thorough check,
    // IsAlive can be called for LooksAlive, as it is below.  However, if there
    // are differences, replace the call to IsAlive below with your quick
    // check code.
    //

    //
    // Check to see if the resource is alive.
    //

    if ( pResourceEntry->fIsAliveFailed == TRUE )
    {
        //
        // Somebody called ClusterResourceControl with our custom control code.
        // That had the same effect as calling IsAlive and the result was false,
        // so we can skip doing the LooksAlive check and return false.  This
        // will cause IsAlive to be called and we'll do another check just in
        // case we encountered a hiccup the first time.
        //

        fRet = FALSE;
    } // if:
    else
    {
        fRet = FileShareSampleCheckIsAlive( pResourceEntry, FALSE /* fFullCheck */ );
    } // else:

    return fRet;

} //*** FileShareSampleLooksAlive

DWORD WINAPI FileShareSampleOffline ( RESID residIn )

Definition at line 1192 of file File Share Sample.cpp.

{
    PFILESHARESAMPLE_RESOURCE pResourceEntry = NULL;
    DWORD                   sc = ERROR_SUCCESS;

    //
    // Verify we have a valid resource ID.
    //

    pResourceEntry = static_cast< PFILESHARESAMPLE_RESOURCE >( residIn );
    if ( pResourceEntry == NULL )
    {
        DBG_PRINT( "File Share Sample: Offline request for a nonexistent resource id.\n" );
        sc = ERROR_RESOURCE_NOT_FOUND;
        goto Cleanup;
    } // if: NULL resource ID

    if ( pResourceEntry->resid != residIn )
    {
        (g_pfnLogEvent)(
              pResourceEntry->hResourceHandle
            , LOG_ERROR
            , L"Offline resource sanity check failed! resid = 0x%1!08x!.\n"
            , residIn
            );
        sc = ERROR_RESOURCE_NOT_FOUND;
        goto Cleanup;
    } // if: invalid resource ID

    (g_pfnLogEvent)(
          pResourceEntry->hResourceHandle
        , LOG_INFORMATION
        , L"Offline request.\n"
        );

    //
    // Start the Offline thread to perform the offline operation.
    //

    pResourceEntry->state = ClusterResourceOfflinePending;
    ClusWorkerTerminate( &pResourceEntry->cwWorkerThread );
    sc = ClusWorkerCreate(
                  &pResourceEntry->cwWorkerThread
                , reinterpret_cast< PWORKER_START_ROUTINE >( FileShareSampleOfflineThread )
                , pResourceEntry
                );
    if ( sc != ERROR_SUCCESS )
    {
        pResourceEntry->state = ClusterResourceFailed;
        (g_pfnLogEvent)(
              pResourceEntry->hResourceHandle
            , LOG_ERROR
            , L"Offline: Unable to start thread. Error: %1!u!.\n"
            , sc
            );
    } // if: error creating the worker thread
    else
    {
        sc = ERROR_IO_PENDING;
    } // if: worker thread created successfully

Cleanup:

    return sc;

} //*** FileShareSampleOffline

DWORD WINAPI FileShareSampleOfflineThread | ( | PCLUS_WORKER | pWorkerIn,
 |  | PFILESHARESAMPLE_RESOURCE | pResourceEntryIn
 | ) |  |

Definition at line 1297 of file File Share Sample.cpp.

{
    RESOURCE_STATUS     resourceStatus;
    DWORD               sc = ERROR_SUCCESS;

    ResUtilInitializeResourceStatus( &resourceStatus );

    resourceStatus.ResourceState = ClusterResourceFailed;
    resourceStatus.WaitHint = 0;
    resourceStatus.CheckPoint = 1;

    //
    // Take the resource offline.
    //

    //
    // The call to ClusWorkerCheckTerminate checks to see if this
    // resource has been terminated or not.
    //

    if ( ClusWorkerCheckTerminate( pWorkerIn ) == TRUE )
    {
        goto Cleanup;
    } // if: resource terminated

    sc = NetShareDel( NULL, pResourceEntryIn->propsActive.pwszShareName, 0 );
    if ( (sc != NERR_Success) && (sc != NERR_NetNameNotFound) )
    {
        (g_pfnLogEvent)(
              pResourceEntryIn->hResourceHandle
            , LOG_ERROR
            , L"OfflineThread: Error %1!u! taking share '%2!s!' offline.\n"
            , sc
            , pResourceEntryIn->propsActive.pwszShareName
            );
        goto Cleanup;
    } // if: error taking the resource offline

    sc = ERROR_SUCCESS;
    resourceStatus.ResourceState = ClusterResourceOffline;

Cleanup:

    pResourceEntryIn->state = resourceStatus.ResourceState;
    g_pfnSetResourceStatus( pResourceEntryIn->hResourceHandle, &resourceStatus );

    return sc;

} //*** FileShareSampleOfflineThread

DWORD WINAPI FileShareSampleOnline | ( | RESID | residIn,
 |  | PHANDLE | phEventHandleInout
 | ) |  |

Definition at line 823 of file File Share Sample.cpp.

{
    PFILESHARESAMPLE_RESOURCE pResourceEntry = NULL;
    DWORD                   sc = ERROR_SUCCESS;

    UNREFERENCED_PARAMETER( phEventHandleOut );

    //
    // Verify we have a valid resource ID.
    //

    pResourceEntry = static_cast< PFILESHARESAMPLE_RESOURCE >( residIn );
    if ( pResourceEntry == NULL )
    {
        DBG_PRINT( "File Share Sample: Online request for a nonexistent resource id.\n" );
        return ERROR_RESOURCE_NOT_FOUND;
    } // if: NULL resource ID

    if ( pResourceEntry->resid != residIn )
    {
        (g_pfnLogEvent)(
              pResourceEntry->hResourceHandle
            , LOG_ERROR
            , L"Online sanity check failed! resid = 0x%1!08x!.\n"
            , residIn
            );
        return ERROR_RESOURCE_NOT_FOUND;
    } // if: invalid resource ID

    (g_pfnLogEvent)(
          pResourceEntry->hResourceHandle
        , LOG_INFORMATION
        , L"Online request.\n"
        );

    //
    // Start the Online thread to perform the online operation.
    //

    pResourceEntry->state = ClusterResourceOnlinePending;
    ClusWorkerTerminate( &pResourceEntry->cwWorkerThread );
    sc = ClusWorkerCreate(
                  &pResourceEntry->cwWorkerThread
                , reinterpret_cast< PWORKER_START_ROUTINE >( FileShareSampleOnlineThread )
                , pResourceEntry
                );
    if ( sc != ERROR_SUCCESS )
    {
        pResourceEntry->state = ClusterResourceFailed;
        (g_pfnLogEvent)(
              pResourceEntry->hResourceHandle
            , LOG_ERROR
            , L"Online: Unable to start thread. Error: %1!u!.\n"
            , sc
            );
    } // if: error creating the worker thread
    else
    {
        sc = ERROR_IO_PENDING;
    } // if: worker thread created successfully

    return sc;

} //*** FileShareSampleOnline

DWORD WINAPI FileShareSampleOnlineThread | ( | PCLUS_WORKER | pWorkerIn,
 |  | PFILESHARESAMPLE_RESOURCE | pResourceEntryIn
 | ) |  |

Definition at line 927 of file File Share Sample.cpp.

{
    RESOURCE_STATUS resourceStatus;
    DWORD           sc = ERROR_SUCCESS;
    DWORD           cch = 0;
    LPWSTR          pwszNameOfPropInError = NULL;
    SHARE_INFO_2    shareInfo;
    HRESULT         hr = S_OK;

    ResUtilInitializeResourceStatus( &resourceStatus );

    resourceStatus.ResourceState = ClusterResourceFailed;
    resourceStatus.WaitHint = 0;
    resourceStatus.CheckPoint = 1;

    //
    // Parameter checking.
    //

    if ( pResourceEntryIn == NULL )
    {
        sc = ERROR_INVALID_PARAMETER;
        goto Cleanup;
    } // if:

    //
    // Read properties.
    //

    sc = ResUtilGetPropertiesToParameterBlock(
              pResourceEntryIn->hkeyParameters
            , FileShareSampleResourcePrivateProperties
            , reinterpret_cast< LPBYTE >( &pResourceEntryIn->propsActive )
            , TRUE // CheckForRequiredProperties
            , &pwszNameOfPropInError
            );
    if ( sc != ERROR_SUCCESS )
    {
        (g_pfnLogEvent)(
              pResourceEntryIn->hResourceHandle
            , LOG_ERROR
            , L"OnlineThread: Unable to read the '%1!s!' property. Error: %2!u!.\n"
            , (pwszNameOfPropInError == NULL ? L"" : pwszNameOfPropInError)
            , sc
            );
        goto Cleanup;
    } // if: error getting properties

    //
    // Start any services that we depend on.
    // The call to ClusWorkerCheckTerminate checks to see if this resource
    // has been told to stop the online process, in which case we should
    // not start the service.
    //

    if ( ClusWorkerCheckTerminate( pWorkerIn ) == TRUE )
    {
        goto Cleanup;
    } // if: terminating

    sc = ResUtilStartResourceService( FILESHARESAMPLE_SVCNAME, NULL );
    if ( sc == ERROR_SERVICE_ALREADY_RUNNING )
    {
        sc = ERROR_SUCCESS;
    } // if: service was already started
    else if ( sc != ERROR_SUCCESS )
    {
        (g_pfnLogEvent)(
              pResourceEntryIn->hResourceHandle
            , LOG_ERROR
            , L"OnlineThread: Failed to bring required service '%1!s!' online.  Error: %2!u!.\n"
            , FILESHARESAMPLE_SVCNAME
            , sc
            );
        goto Cleanup;
    } // else if: error starting the service

    //
    // TODO: Add code to start the resource.
    //

    if ( ClusWorkerCheckTerminate( pWorkerIn ) == TRUE )
    {
        goto Cleanup;
    } // if: terminating

    //
    // The path may contain environment variables so we need to expand them.
    //

    delete [] pResourceEntryIn->pwszUNCSharedPath;
    pResourceEntryIn->pwszUNCSharedPath = NULL;

    LocalFree( pResourceEntryIn->pwszExpandedPath );
    pResourceEntryIn->pwszExpandedPath = ResUtilExpandEnvironmentStrings( pResourceEntryIn->propsActive.pwszPath );
    if ( pResourceEntryIn->pwszExpandedPath == NULL )
    {
        sc = GetLastError();
        (g_pfnLogEvent)(
              pResourceEntryIn->hResourceHandle
            , LOG_ERROR
            , L"OnlineThread: Error %1!u! expanding path '%2!ws!' for share '%3!ws!'.\n"
            , sc
            , pResourceEntryIn->propsActive.pwszPath
            , pResourceEntryIn->propsActive.pwszShareName
            );
        goto Cleanup;
    } // if:

    //
    // Make sure the path doesn't end in a trailing backslash or it will fail to come online.
    // Accept paths such as E:\ though.
    //

    cch = wcslen( pResourceEntryIn->pwszExpandedPath );
    if ( ( cch > 3 ) && (pResourceEntryIn->pwszExpandedPath[ cch - 1 ] == L'\\' ) )
    {
        pResourceEntryIn->pwszExpandedPath[ cch - 1 ] = L'\0';
    } // if:

    //
    // Initialize the shareInfo struct and create the share.
    //

    ZeroMemory( &shareInfo, sizeof( shareInfo ) );
    shareInfo.shi2_netname =    pResourceEntryIn->propsActive.pwszShareName;
    shareInfo.shi2_type =       STYPE_DISKTREE;
    shareInfo.shi2_remark =     pResourceEntryIn->propsActive.pwszRemark;
    shareInfo.shi2_max_uses =   pResourceEntryIn->propsActive.nMaxUsers;
    shareInfo.shi2_path =       pResourceEntryIn->pwszExpandedPath;

    sc = NetShareAdd( NULL, 2, reinterpret_cast< PBYTE >( &shareInfo ), NULL );
    if ( sc != NERR_Success )
    {
        (g_pfnLogEvent)(
              pResourceEntryIn->hResourceHandle
            , LOG_ERROR
            , L"OnlineThread: Error %1!u! creating share '%2!ws!' for path '%3!ws!'.\n"
            , sc
            , pResourceEntryIn->propsActive.pwszShareName
            , pResourceEntryIn->pwszExpandedPath
            );
        goto Cleanup;
    } // if: error creating share

    //
    // Calculate the UNC path in order to test for aliveness.  e.g. \\node1\myshare
    //

    // Figure out how big of a buffer we need and allocate it.
    // The magic "8" comes from this: - \\x\y\*.* - excluding the x & y and adding the null.
    cch = 8 + wcslen( pResourceEntryIn->pwszComputerName ) + wcslen( pResourceEntryIn->propsActive.pwszShareName );
    pResourceEntryIn->pwszUNCSharedPath = new WCHAR[ cch ];
    if ( pResourceEntryIn->pwszUNCSharedPath == NULL )
    {
        sc = ERROR_OUTOFMEMORY;
        (g_pfnLogEvent)(
              pResourceEntryIn->hResourceHandle
            , LOG_ERROR
            , L"OnlineThread: Error %1!u! allocating memory for local path.\n"
            , sc
            );
        goto Cleanup;
    } // if:

    // Format the path into pwszUNCSharedPath.
    hr = StringCchPrintf(
              pResourceEntryIn->pwszUNCSharedPath
            , cch
            , L"\\\\%ws\\%ws\\*.*"
            , pResourceEntryIn->pwszComputerName
            , pResourceEntryIn->propsActive.pwszShareName
            );
    if ( FAILED( hr ) )
    {
        sc = SCODE( hr );
        (g_pfnLogEvent)(
              pResourceEntryIn->hResourceHandle
            , LOG_ERROR
            , L"OnlineThread: Error %1!u! formatting share path from computer name '%2!s!' and share name '%3!s!'.\n"
            , sc
            , pResourceEntryIn->pwszComputerName
            , pResourceEntryIn->propsActive.pwszShareName
            );
        goto Cleanup;
    } // if:

    sc = ERROR_SUCCESS;
    resourceStatus.ResourceState = ClusterResourceOnline;

Cleanup:

    if ( sc != ERROR_SUCCESS )
    {
        (g_pfnLogEvent)(
              pResourceEntryIn->hResourceHandle
            , LOG_ERROR
            , L"OnlineThread: Error %1!u! bringing resource online.\n"
            , sc
            );
    } // if: error occurred

    pResourceEntryIn->state = resourceStatus.ResourceState;
    g_pfnSetResourceStatus( pResourceEntryIn->hResourceHandle, &resourceStatus );

    return sc;

} //*** FileShareSampleOnlineThread

RESID WINAPI FileShareSampleOpen | ( | LPCWSTR | pwszResourceNameIn,
 |  | HKEY | hkeyResourceKeyIn,
 |  | RESOURCE_HANDLE | hResourceHandleIn
 | ) |  |

Definition at line 403 of file File Share Sample.cpp.

{
    DWORD                   sc = ERROR_SUCCESS;
    size_t                  cchBuffer = 0;
    DWORD                   cchComputerName = 0;
    RESID                   resid = NULL;
    HKEY                    hkeyParameters = NULL;
    PFILESHARESAMPLE_RESOURCE pResourceEntry = NULL;
    HRESULT                 hr = S_OK;

    //
    // Open the Parameters registry key for this resource.
    //

    sc = ClusterRegOpenKey(
              hkeyResourceKeyIn
            , L"Parameters"
            , KEY_ALL_ACCESS
            , &hkeyParameters
            );
    if ( sc != ERROR_SUCCESS )
    {
        (g_pfnLogEvent)(
              hResourceHandleIn
            , LOG_ERROR
            , L"Open: Unable to open Parameters key. Error: %1!u!.\n"
            , sc
            );
        goto Cleanup;
    } // if: error creating the Parameters key for the resource

    //
    // Allocate a resource entry.
    //

    pResourceEntry = new FILESHARESAMPLE_RESOURCE;
    if ( pResourceEntry == NULL )
    {
        sc = GetLastError();
        (g_pfnLogEvent)(
              hResourceHandleIn
            , LOG_ERROR
            , L"Open: Unable to allocate resource entry structure. Error: %1!u!.\n"
            , sc
            );
        goto Cleanup;
    } // if: error allocating memory for the resource

    //
    // Initialize the resource entry..
    //

    ZeroMemory( pResourceEntry, sizeof( *pResourceEntry ) );

    pResourceEntry->resid = static_cast< RESID >( pResourceEntry ); // for validation
    pResourceEntry->hResourceHandle = hResourceHandleIn;
    pResourceEntry->hkeyParameters = hkeyParameters;
    pResourceEntry->state = ClusterResourceOffline;

    //
    // Save the name of the resource.
    //

    cchBuffer = lstrlenW( pwszResourceNameIn ) + 1;
    pResourceEntry->pwszResourceName = new WCHAR[ cchBuffer ];
    if ( pResourceEntry->pwszResourceName == NULL )
    {
        sc = GetLastError();
        (g_pfnLogEvent)(
              hResourceHandleIn
            , LOG_ERROR
            , L"Open: Unable to allocate the resource name buffer. Error: %1!u!.\n"
            , sc
            );
        goto Cleanup;
    } // if: error allocating memory for the name.

    hr = StringCchCopyW( pResourceEntry->pwszResourceName, cchBuffer, pwszResourceNameIn );
    if ( FAILED( hr ) )
    {
        sc = HRESULT_CODE( hr );
        (g_pfnLogEvent)(
              hResourceHandleIn
            , LOG_ERROR
            , L"Open: Unable to allocate the resource name buffer. Error: %1!u!.\n"
            , sc
            );
        goto Cleanup;
    } // if:

    //
    // Open the cluster.
    //

    pResourceEntry->hCluster = OpenCluster( NULL );
    if ( pResourceEntry->hCluster == NULL )
    {
        sc = GetLastError();
        (g_pfnLogEvent)(
              hResourceHandleIn
            , LOG_ERROR
            , L"Open: Unable to open the cluster. Error: %1!u!.\n"
            , sc
            );
        goto Cleanup;
    } // if: error opening the cluster

    //
    // Open the resource.
    //

    pResourceEntry->hResource = OpenClusterResource( pResourceEntry->hCluster, pwszResourceNameIn );
    if ( pResourceEntry->hResource == NULL )
    {
        sc = GetLastError();
        (g_pfnLogEvent)(
              hResourceHandleIn
            , LOG_ERROR
            , L"Open: Unable to open the resource. Error: %1!u!.\n"
            , sc
            );
        goto Cleanup;
    } // if: error opening the resource

    //
    // Startup for the resource.
    //

    //
    // Retrieve the computer name.
    //

    cchComputerName = 0;
    GetComputerNameEx( ComputerNamePhysicalDnsHostname, NULL, &cchComputerName );
    sc = GetLastError();
    if ( sc != ERROR_MORE_DATA )
    {
        //
        // Something went wrong, we should've gotten ERROR_MORE_DATA.
        //

        (g_pfnLogEvent)(
              hResourceHandleIn
            , LOG_ERROR
            , L"Open: failed to retrieve the computer name with error %1!u!.\n"
            , sc
            );
        goto Cleanup;
    } // if: GetComputerNameEx failed

    pResourceEntry->pwszComputerName = new WCHAR[ cchComputerName ];
    if ( pResourceEntry->pwszComputerName == NULL )
    {
        sc = ERROR_OUTOFMEMORY;
        (g_pfnLogEvent)(
              hResourceHandleIn
            , LOG_ERROR
            , L"Open: failed to allocate computer name buffer with error %1!u!.\n"
            , sc
            );
        goto Cleanup;
    } // if: buffer allocation failed

    if ( GetComputerNameEx(
                  ComputerNamePhysicalDnsHostname
                , pResourceEntry->pwszComputerName
                , &cchComputerName
                ) == 0 )
    {
        sc = GetLastError();
        (g_pfnLogEvent)(
              hResourceHandleIn
            , LOG_ERROR
            , L"Open: failed to retrieve the computer name with error %1!u!.\n"
            , sc
            );
        goto Cleanup;
    } // if: GetComputerNameEx failed

    resid = static_cast< RESID >( pResourceEntry );

    sc = ERROR_SUCCESS;

Cleanup:

    if ( resid == NULL )
    {
        assert( sc != ERROR_SUCCESS );

        (g_pfnLogEvent)(
              hResourceHandleIn
            , LOG_ERROR
            , L"Open: failed with error %1!u!.\n"
            , sc
            );

        if ( hkeyParameters != NULL )
        {
            ClusterRegCloseKey( hkeyParameters );
        } // if:

        if ( pResourceEntry != NULL )
        {
            if ( pResourceEntry->hResource != NULL )
            {
                CloseClusterResource( pResourceEntry->hResource );
            } // if:

            if ( pResourceEntry->hCluster != NULL )
            {
                CloseCluster( pResourceEntry->hCluster );
            } // if:

            delete [] pResourceEntry->pwszResourceName;
            delete [] pResourceEntry->pwszComputerName;
            delete pResourceEntry;

        } // if: resource entry allocated
    } // if: something failed

    SetLastError( sc );

    return resid;

} //*** FileShareSampleOpen

DWORD WINAPI FileShareSampleResourceControl | ( | RESID | residIn,
 |  | DWORD | nControlCodeIn,
 |  | PVOID | pInBufferIn,
 |  | DWORD | cbInBufferSizeIn,
 |  | PVOID | pOutBufferOut,
 |  | DWORD | cbOutBufferSizeIn,
 |  | LPDWORD | pcbBytesReturnedOut
 | ) |  |

Definition at line 1841 of file File Share Sample.cpp.

{
    DWORD               sc = ERROR_SUCCESS;
    PFILESHARESAMPLE_RESOURCE pResourceEntry = NULL;

    //
    // Verify we have a valid resource ID.
    //
    pResourceEntry = static_cast< PFILESHARESAMPLE_RESOURCE >( residIn );
    if ( pResourceEntry == NULL )
    {
        DBG_PRINT( "File Share Sample: ResourceControl request for a nonexistent resource id.\n" );
        return ERROR_RESOURCE_NOT_FOUND;
    } // if: NULL resource ID

    if ( pResourceEntry->resid != residIn )
    {
        (g_pfnLogEvent)(
              pResourceEntry->hResourceHandle
            , LOG_ERROR
            , L"ResourceControl sanity check failed! resid = 0x%1!08x!.\n"
            , residIn
            );
        return ERROR_RESOURCE_NOT_FOUND;
    } // if: invalid resource ID

    switch ( nControlCodeIn )
    {
        case CLUSCTL_RESOURCE_UNKNOWN:
            *pcbBytesReturnedOut = 0;
            sc = ERROR_SUCCESS;
            break;

        case CLUSCTL_RESOURCE_ENUM_PRIVATE_PROPERTIES:
        {
            DWORD cbRequired = 0;
            sc = ResUtilEnumProperties(
                      FileShareSampleResourcePrivateProperties
                    , static_cast< LPWSTR >( pOutBufferOut )
                    , cbOutBufferSizeIn
                    , pcbBytesReturnedOut
                    , &cbRequired
                    );
            if ( sc == ERROR_MORE_DATA )
            {
                *pcbBytesReturnedOut = cbRequired;
            } // if: output buffer is too small
            break;
        }

        case CLUSCTL_RESOURCE_GET_PRIVATE_PROPERTIES:
            sc = FileShareSampleGetPrivateResProperties(
                      pResourceEntry
                    , pOutBufferOut
                    , cbOutBufferSizeIn
                    , pcbBytesReturnedOut
                    );
            break;

        case CLUSCTL_RESOURCE_VALIDATE_PRIVATE_PROPERTIES:
            sc = FileShareSampleValidatePrivateResProperties(
                      pResourceEntry
                    , pInBufferIn
                    , cbInBufferSizeIn
                    , NULL
                    );
            break;

        case CLUSCTL_RESOURCE_SET_PRIVATE_PROPERTIES:
            sc = FileShareSampleSetPrivateResProperties(
                      pResourceEntry
                    , pInBufferIn
                    , cbInBufferSizeIn
                    );
            break;

        case CLUSCTL_RESOURCE_SET_NAME:
            sc = FileShareSampleSetNameHandler( pResourceEntry, static_cast< LPWSTR >( pInBufferIn ) );
            break;

        case CLUSCTL_RESOURCE_FILESHARESAMPLE_CALL_ISALIVE:

            //
            // This has the same effect as the periodic IsAlive check.
            //

            if ( pResourceEntry->state != ClusterResourceOnline )
            {
                sc = ERROR_CLUSTER_INVALID_REQUEST;
            } // if:
            else if ( FileShareSampleCheckIsAlive( pResourceEntry, TRUE ) == FALSE )
            {
                sc = ERROR_RESOURCE_FAILED;
                pResourceEntry->fIsAliveFailed = TRUE;
                (g_pfnLogEvent)(
                      pResourceEntry->hResourceHandle
                    , LOG_ERROR
                    , L"ResourceControl CALL_ISALIVE failed.\n"
                    );
            } // else if:
            else
            {
                sc = ERROR_SUCCESS;
                (g_pfnLogEvent)(
                      pResourceEntry->hResourceHandle
                    , LOG_INFORMATION
                    , L"ResourceControl CALL_ISALIVE succeeded.\n"
                    );
            } // else:

            break;

        case CLUSCTL_RESOURCE_GET_REQUIRED_DEPENDENCIES:
        case CLUSCTL_RESOURCE_GET_CHARACTERISTICS:
        case CLUSCTL_RESOURCE_GET_CLASS_INFO:
        case CLUSCTL_RESOURCE_STORAGE_GET_DISK_INFO:
        case CLUSCTL_RESOURCE_STORAGE_IS_PATH_VALID:
        case CLUSCTL_RESOURCE_DELETE:
        case CLUSCTL_RESOURCE_INSTALL_NODE:
        case CLUSCTL_RESOURCE_EVICT_NODE:
        case CLUSCTL_RESOURCE_ADD_DEPENDENCY:
        case CLUSCTL_RESOURCE_REMOVE_DEPENDENCY:
        case CLUSCTL_RESOURCE_ADD_OWNER:
        case CLUSCTL_RESOURCE_REMOVE_OWNER:
        case CLUSCTL_RESOURCE_CLUSTER_NAME_CHANGED:
        case CLUSCTL_RESOURCE_CLUSTER_VERSION_CHANGED:
        default:
            sc = ERROR_INVALID_FUNCTION;
            break;
    } // switch: nControlCodeIn

    return sc;

} //*** FileShareSampleResourceControl

DWORD WINAPI FileShareSampleResourceTypeControl | ( | LPCWSTR | pwszResourceTypeNameIn,
 |  | DWORD | nControlCodeIn,
 |  | PVOID | pInBufferIn,
 |  | DWORD | cbInBufferSizeIn,
 |  | PVOID | pOutBufferOut,
 |  | DWORD | cbOutBufferSizeIn,
 |  | LPDWORD | pcbBytesReturnedOut
 | ) |  |

Definition at line 2038 of file File Share Sample.cpp.

{
    DWORD   sc = ERROR_SUCCESS;

    UNREFERENCED_PARAMETER( pwszResourceTypeNameIn );
    UNREFERENCED_PARAMETER( pInBufferIn );
    UNREFERENCED_PARAMETER( cbInBufferSizeIn );

    switch ( nControlCodeIn )
    {

        case CLUSCTL_RESOURCE_TYPE_UNKNOWN:
            *pcbBytesReturnedOut = 0;
            sc = ERROR_SUCCESS;
            break;

        case CLUSCTL_RESOURCE_TYPE_ENUM_PRIVATE_PROPERTIES:
        {
            DWORD cbRequired = 0;
            sc = ResUtilEnumProperties(
                      FileShareSampleResourcePrivateProperties
                    , static_cast< LPWSTR >( pOutBufferOut )
                    , cbOutBufferSizeIn
                    , pcbBytesReturnedOut
                    , &cbRequired
                    );
            if ( sc == ERROR_MORE_DATA )
            {
                *pcbBytesReturnedOut = cbRequired;
            } // if: output buffer is too small
            break;
        }

        case CLUSCTL_RESOURCE_TYPE_GET_REQUIRED_DEPENDENCIES:
        case CLUSCTL_RESOURCE_TYPE_GET_CHARACTERISTICS:
        case CLUSCTL_RESOURCE_TYPE_GET_CLASS_INFO:
        case CLUSCTL_RESOURCE_TYPE_STORAGE_GET_AVAILABLE_DISKS:
        case CLUSCTL_RESOURCE_TYPE_INSTALL_NODE:
        case CLUSCTL_RESOURCE_TYPE_EVICT_NODE:
        default:
            sc = ERROR_INVALID_FUNCTION;
            break;
    } // switch: nControlCode

    return sc;

} //*** FileShareSampleResourceTypeControl

DWORD FileShareSampleSetNameHandler | ( | PFILESHARESAMPLE_RESOURCE | pResourceEntryIn,
 |  | LPWSTR | pwszNameIn
 | ) |  |

Definition at line 2553 of file File Share Sample.cpp.

{
    DWORD   sc = ERROR_SUCCESS;
    DWORD   cchNameBuffer = 0;
    HRESULT hr = S_OK;
    WCHAR * pwszTemp = NULL;

    //
    // Allocate a buffer for the new name.
    //

    cchNameBuffer = lstrlenW( pwszNameIn ) + 1;
    pwszTemp = new WCHAR[ cchNameBuffer ];
    if ( pwszTemp == NULL )
    {
        sc = GetLastError();
        (g_pfnLogEvent)(
              pResourceEntryIn->hResourceHandle
            , LOG_ERROR
            , L"Failed to allocate memory for the new resource name '%1!s!'. Error: %2!u!.\n"
            , pwszNameIn
            , sc
            );
        goto Cleanup;
    } // if: error allocating memory for the name.

    //
    // Copy the new name to the new buffer.
    //

    hr = StringCchCopyW( pwszTemp, cchNameBuffer, pwszNameIn );
    if ( FAILED( hr ) )
    {
        sc = HRESULT_CODE( hr );
        goto Cleanup;
    } // if:

    //
    // All went well, free the old buffer and assign the new one.
    //

    delete [] pResourceEntryIn->pwszResourceName;
    pResourceEntryIn->pwszResourceName = pwszTemp;
    pwszTemp = NULL;

Cleanup:

    delete [] pwszTemp;

    return sc;

} //*** FileShareSampleSetNameHandler

DWORD FileShareSampleSetPrivateResProperties | ( | PFILESHARESAMPLE_RESOURCE | pResourceEntryIn,
 |  | const PVOID | pInBufferIn,
 |  | DWORD | cbInBufferSizeIn
 | ) |  |

Definition at line 2376 of file File Share Sample.cpp.

{
    DWORD                   sc = ERROR_SUCCESS;
    FILESHARESAMPLE_PROPS   props;
    BOOL                    fAllowDynamicChanges = FALSE;
    PSHARE_INFO_2           psiOld = NULL;
    SHARE_INFO_2            siNew;
    DWORD                   nInvalidParam;

    //
    // Parse the properties so they can be validated together.
    // This routine does individual property validation.
    //

    sc = FileShareSampleValidatePrivateResProperties( pResourceEntryIn, pInBufferIn, cbInBufferSizeIn, &props );
    if ( sc != ERROR_SUCCESS )
    {
        goto Cleanup;
    } // if: error validating properties

    //
    // Only update the share if the name and the path didn't change.
    //

    if (   (    ( pResourceEntryIn->props.pwszShareName != NULL )
             && ( IStringCompareW( props.pwszShareName, pResourceEntryIn->props.pwszShareName ) != 0 )
           )
        || (    ( pResourceEntryIn->props.pwszPath != NULL )
             && ( IStringCompareW( props.pwszPath, pResourceEntryIn->props.pwszPath ) != 0 )
           )
       )
    {
        fAllowDynamicChanges = FALSE;
    } // if: share or path changed
    else
    {
        fAllowDynamicChanges = TRUE;
    } // else: share and path

    //
    // Save the property values.
    //

    sc = ResUtilSetPropertyParameterBlock(
              pResourceEntryIn->hkeyParameters
            , FileShareSampleResourcePrivateProperties
            , NULL
            , reinterpret_cast< LPBYTE >( &props )
            , pInBufferIn
            , cbInBufferSizeIn
            , reinterpret_cast< LPBYTE >( &pResourceEntryIn->props )
            );

    ResUtilFreeParameterBlock(
              reinterpret_cast< LPBYTE >( &props )
            , reinterpret_cast< LPBYTE >( &pResourceEntryIn->props )
            , FileShareSampleResourcePrivateProperties
            );

    if ( sc != ERROR_SUCCESS )
    {
        goto Cleanup;
    } // if: properties not set successfully

    //
    // If the resource is online, return a non-success status.
    //

    if (    ( pResourceEntryIn->state == ClusterResourceOnline )
         && ( fAllowDynamicChanges == TRUE )
       )
    {
        //
        // Get the current share info.
        //

        sc = NetShareGetInfo(
                      NULL      // pwszServer
                    , pResourceEntryIn->props.pwszShareName
                    , 2         // level
                    , reinterpret_cast< LPBYTE * >( &psiOld )
                    );
        if ( sc != NERR_Success )
        {
            sc = ERROR_RESOURCE_PROPERTIES_STORED;
            goto Cleanup;
        } // if:

        //
        // Set new share info.
        //

        //
        // Note: NetShareSetInfo ignores all but shi2_remark and shi2_max_uses.
        //

        CopyMemory( &siNew, psiOld, sizeof( siNew ) );
        siNew.shi2_remark =     pResourceEntryIn->props.pwszRemark;
        siNew.shi2_max_uses =   pResourceEntryIn->props.nMaxUsers;

        sc = NetShareSetInfo(
                      NULL      // pwszServer
                    , pResourceEntryIn->props.pwszShareName
                    , 2         // level
                    , reinterpret_cast< LPBYTE >( &siNew )
                    , &nInvalidParam
                    );
        if ( sc != NERR_Success )
        {
            (g_pfnLogEvent)(
                  pResourceEntryIn->hResourceHandle
                , LOG_ERROR
                , L"SetPrivateProps: Error setting info on share '%1!ws!'. Error %2!u!, property # %3!d!.\n"
                , pResourceEntryIn->props.pwszShareName
                , sc
                , nInvalidParam
                );
            sc = ERROR_RESOURCE_PROPERTIES_STORED;
            goto Cleanup;
        } // if:  error setting new share info

        sc = ERROR_SUCCESS;

    } // if: resource is currently online
    else if (    ( pResourceEntryIn->state == ClusterResourceOnline )
              || ( pResourceEntryIn->state == ClusterResourceOnlinePending )
            )
    {
        sc = ERROR_RESOURCE_PROPERTIES_STORED;
    } // else if: resource is currently online or online pending
    else
    {
        sc = ERROR_SUCCESS;
    } // else: resource is in some other state

Cleanup:

    if ( psiOld != NULL )
    {
        NetApiBufferFree( psiOld );
    } // if:

    return sc;

} //*** FileShareSampleSetPrivateResProperties

DWORD WINAPI FileShareSampleStartup | ( | LPCWSTR | pwszResourceTypeIn,
 |  | DWORD | nMinVersionSupportedIn,
 |  | DWORD | nMaxVersionSupportedIn,
 |  | PSET_RESOURCE_STATUS_ROUTINE | pfnSetResourceStatusIn,
 |  | PLOG_EVENT_ROUTINE | pfnLogEventIn,
 |  | PCLRES_FUNCTION_TABLE * | pFunctionTableOut
 | ) |  |

Definition at line 325 of file File Share Sample.cpp.

{
    DWORD sc = ERROR_SUCCESS;

    // These are stored in the calling DllMain.
    UNREFERENCED_PARAMETER( pfnSetResourceStatusIn );
    UNREFERENCED_PARAMETER( pfnLogEventIn );

    if (   (nMinVersionSupportedIn > CLRES_VERSION_V1_00)
        || (nMaxVersionSupportedIn < CLRES_VERSION_V1_00) )
    {
        sc = ERROR_REVISION_MISMATCH;
    } // if: version not supported
    else if ( NIStringCompareW( pwszResourceTypeIn, RESTYPE_NAME, RTL_NUMBER_OF( RESTYPE_NAME ) ) == 0 )
    {
        *pFunctionTableOut = &g_FileShareSampleFunctionTable;
        sc = ERROR_SUCCESS;
    } // else if: we support this type of resource
    else
    {
        //
        // We don't support this resource type.
        //

        sc = ERROR_CLUSTER_RESNAME_NOT_FOUND;
    } // else: resource type name not supported

    return sc;

} //*** FileShareSampleStartup

void WINAPI FileShareSampleTerminate ( RESID residIn )

Definition at line 1382 of file File Share Sample.cpp.

{
    DWORD                       sc = ERROR_SUCCESS;
    PFILESHARESAMPLE_RESOURCE   pResourceEntry = NULL;

    //
    // Verify we have a valid resource ID.
    //

    pResourceEntry = static_cast< PFILESHARESAMPLE_RESOURCE >( residIn );
    if ( pResourceEntry == NULL )
    {
        DBG_PRINT( "File Share Sample: Terminate request for a nonexistent resource id.\n" );
        return;
    } // if: NULL resource ID

    if ( pResourceEntry->resid != residIn )
    {
        (g_pfnLogEvent)(
              pResourceEntry->hResourceHandle
            , LOG_ERROR
            , L"Terminate resource sanity check failed! resid = 0x%1!08x!.\n"
            , residIn
            );
        return;
    } // if: invalid resource ID

    (g_pfnLogEvent)(
          pResourceEntry->hResourceHandle
        , LOG_INFORMATION
        , L"Terminate request.\n"
        );

    //
    // Kill off any pending threads.
    //

    ClusWorkerTerminate( &pResourceEntry->cwWorkerThread );

    //
    // Terminate the resource.
    //

    sc = NetShareDel( NULL, pResourceEntry->propsActive.pwszShareName, 0 );
    if ( sc != NERR_Success && sc != NERR_NetNameNotFound )
    {
        (g_pfnLogEvent)(
              pResourceEntry->hResourceHandle
            , LOG_ERROR
            , L"Terminate: Error %1!u! removing share '%2!ws!'.\n"
            , sc
            , pResourceEntry->propsActive.pwszShareName
            );
    } // if:  error taking the resource offline

    pResourceEntry->state = ClusterResourceFailed;

    return;

} //*** FileShareSampleTerminate

DWORD FileShareSampleValidatePrivateResProperties | ( | PFILESHARESAMPLE_RESOURCE | pResourceEntryIn,
 |  | const PVOID | pInBufferIn,
 |  | DWORD | cbInBufferSizeIn,
 |  | PFILESHARESAMPLE_PROPS | pPropsOut
 | ) |  |

Definition at line 2206 of file File Share Sample.cpp.

{
    DWORD                   sc = ERROR_SUCCESS;
    FILESHARESAMPLE_PROPS   propsCurrent;
    FILESHARESAMPLE_PROPS   propsNew;
    PFILESHARESAMPLE_PROPS  pLocalProps = NULL;
    LPWSTR                  pwszNameOfPropInError;
    BOOL                    fRetrievedProps = FALSE;

    //
    // Check if there is input data.
    //

    if (    (pInBufferIn == NULL)
        ||  (cbInBufferSizeIn < sizeof( DWORD )) )
    {
        sc = ERROR_INVALID_DATA;
        goto Cleanup;
    } // if: no input buffer or input buffer not big enough to contain property list

    //
    // Retrieve the current set of private properties from the
    // cluster database.
    //

    ZeroMemory( &propsCurrent, sizeof( propsCurrent ) );

    sc = ResUtilGetPropertiesToParameterBlock(
               pResourceEntryIn->hkeyParameters
             , FileShareSampleResourcePrivateProperties
             , reinterpret_cast< LPBYTE >( &propsCurrent )
             , FALSE /*CheckForRequiredProperties*/
             , &pwszNameOfPropInError
             );
    if ( sc != ERROR_SUCCESS )
    {
        (g_pfnLogEvent)(
              pResourceEntryIn->hResourceHandle
            , LOG_ERROR
            , L"Unable to read the '%1!s!' property. Error: %2!u!.\n"
            , (pwszNameOfPropInError == NULL ? L"" : pwszNameOfPropInError)
            , sc
            );
        goto Cleanup;
    } // if: error getting properties
    fRetrievedProps = TRUE;

    //
    // Duplicate the resource parameter block.
    //

    if ( pPropsOut == NULL )
    {
        pLocalProps = &propsNew;
    } // if: no parameter block passed in
    else
    {
        pLocalProps = pPropsOut;
    } // else: parameter block passed in

    ZeroMemory( pLocalProps, sizeof( *pLocalProps ) );

    sc = ResUtilDupParameterBlock(
              reinterpret_cast< LPBYTE >( pLocalProps )
            , reinterpret_cast< LPBYTE >( &propsCurrent )
            , FileShareSampleResourcePrivateProperties
            );
    if ( sc != ERROR_SUCCESS )
    {
        goto Cleanup;
    } // if: error duplicating the parameter block

    //
    // Parse and validate the properties.
    //

    sc = ResUtilVerifyPropertyTable(
              FileShareSampleResourcePrivateProperties
            , NULL
            , TRUE // AllowUnknownProperties
            , pInBufferIn
            , cbInBufferSizeIn
            , reinterpret_cast< LPBYTE >( pLocalProps )
            );
    if ( sc != ERROR_SUCCESS )
    {
        goto Cleanup;
    } // if: property list not validated successfully

    //
    // Validate the property values.
    //

    //
    // TODO: Code to validate interactions between properties goes here.
    //

Cleanup:

    //
    // Cleanup our parameter block.
    //

    if (    ( pLocalProps == &propsNew )
        ||  (   ( sc != ERROR_SUCCESS)
            &&  ( pLocalProps != NULL )
            )
       )
    {
        ResUtilFreeParameterBlock(
              reinterpret_cast< LPBYTE >( pLocalProps )
            , reinterpret_cast< LPBYTE >( &propsCurrent )
            , FileShareSampleResourcePrivateProperties
            );
    } // if: we duplicated the parameter block

    if ( fRetrievedProps )
    {
        ResUtilFreeParameterBlock(
              reinterpret_cast< LPBYTE >( &propsCurrent )
            , NULL
            , FileShareSampleResourcePrivateProperties
            );
    } // if: properties were retrieved

    return sc;

} // FileShareSampleValidatePrivateResProperties

Variable Documentation

RESUTIL_PROPERTY_ITEM FileShareSampleResourcePrivateProperties[]
Initial value:
{
    { PROP_NAME__SHARENAME, NULL, CLUSPROP_FORMAT_SZ, 0, 0, 0, RESUTIL_PROPITEM_REQUIRED, FIELD_OFFSET( FILESHARESAMPLE_PROPS, pwszShareName ) },
    { PROP_NAME__PATH, NULL, CLUSPROP_FORMAT_EXPAND_SZ, 0, 0, 0, RESUTIL_PROPITEM_REQUIRED, FIELD_OFFSET( FILESHARESAMPLE_PROPS, pwszPath ) },
    { PROP_NAME__REMARK, NULL, CLUSPROP_FORMAT_SZ, 0, 0, 0, 0, FIELD_OFFSET( FILESHARESAMPLE_PROPS, pwszRemark ) },
    { PROP_NAME__MAXUSERS, NULL, CLUSPROP_FORMAT_DWORD, PROP_DEFAULT__MAXUSERS, PROP_MIN__MAXUSERS, PROP_MAX__MAXUSERS, 0, FIELD_OFFSET( FILESHARESAMPLE_PROPS, nMaxUsers ) },
    { 0 }
}

Definition at line 85 of file File Share Sample.cpp.

CLRES_FUNCTION_TABLE g_FileShareSampleFunctionTable
Generated on Wed Nov 13 2024 16:55:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/FileShareSample/File Share Sample/StringUtils.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • FileShareSample
  • File Share Sample
Functions

StringUtils.cpp File Reference

#include "StringUtils.h"

Go to the source code of this file.

Functions

int | BSTRCompareW (BSTR bstrString1In, BSTR bstrString2In)
HRESULT | HrFormatStringIntoBSTR (LPCWSTR pcwszFmtIn, BSTR *pbstrInout,...)
HRESULT | HrFormatStringIntoBSTR (HINSTANCE hInstanceIn, LANGID langidIn, UINT idsIn, BSTR *pbstrInout,...)
HRESULT | HrFormatStringWithVAListIntoBSTR (HINSTANCE hInstanceIn, LANGID langidIn, UINT idsIn, BSTR *pbstrInout, va_list valistIn)
HRESULT | HrFormatStringWithVAListIntoBSTR (LPCWSTR pcwszFmtIn, BSTR *pbstrInout, va_list valistIn)
HRESULT | HrLoadStringIntoBSTR (HINSTANCE hInstanceIn, LANGID langidIn, UINT idsIn, BSTR *pbstrInout)
int | IBSTRCompareW (BSTR bstrString1In, BSTR bstrString2In)
int | IStringCompareW (LPCWSTR pcwszString1In, LPCWSTR pcwszString2In)
int | IStringCompareW (LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)
int | NBSTRCompareW (BSTR bstrString1In, BSTR bstrString2In)
int | NIBSTRCompareW (BSTR bstrString1In, BSTR bstrString2In)
int | NIStringCompareW (LPCWSTR pcwszString1In, LPCWSTR pcwszString2In, size_t cchIn)
int | NIStringCompareW (LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)
int | NStringCompareW (LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)
int | NStringCompareW (LPCWSTR pcwszString1In, LPCWSTR pcwszString2In, size_t cchIn)
int | StringCompareW (LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)
int | StringCompareW (LPCWSTR pcwszString1In, LPCWSTR pcwszString2In)
int | WrapCompareString (BOOL fCaseSensitive, LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)

Function Documentation

int BSTRCompareW | ( | BSTR | bstrString1In,
 |  | BSTR | bstrString2In
 | ) |  |

Definition at line 100 of file StringUtils.cpp.

{
    return WrapCompareString(
                  TRUE
                , static_cast< LPCWSTR >( bstrString1In )
                , SysStringLen( bstrString1In )
                , static_cast< LPCWSTR >( bstrString2In )
                , SysStringLen( bstrString2In )
                );
} //*** BSTRCompareW

HRESULT HrFormatStringIntoBSTR | ( | LPCWSTR | pcwszFmtIn,
 |  | BSTR * | pbstrInout,
 |  |  | ...
 | ) |  |

Definition at line 773 of file StringUtils.cpp.

{
    HRESULT hr = S_OK;
    va_list valist;

    va_start( valist, pbstrInout );

    hr = HrFormatStringWithVAListIntoBSTR( pcwszFmtIn, pbstrInout, valist );

    va_end( valist );

    return hr;

} //*** HrFormatStringIntoBSTR

HRESULT HrFormatStringIntoBSTR | ( | HINSTANCE | hInstanceIn,
 |  | LANGID | langidIn,
 |  | UINT | idsIn,
 |  | BSTR * | pbstrInout,
 |  |  | ...
 | ) |  |

Definition at line 578 of file StringUtils.cpp.

{
    HRESULT hr;
    va_list valist;

    va_start( valist, pbstrInout );

    hr = HrFormatStringWithVAListIntoBSTR(
                          hInstanceIn
                        , langidIn
                        , idsIn
                        , pbstrInout
                        , valist
                        );

    va_end( valist );

    return hr;

} //*** HrFormatStringIntoBSTR

HRESULT HrFormatStringWithVAListIntoBSTR | ( | HINSTANCE | hInstanceIn,
 |  | LANGID | langidIn,
 |  | UINT | idsIn,
 |  | BSTR * | pbstrInout,
 |  | va_list | valistIn
 | ) |  |

Definition at line 651 of file StringUtils.cpp.

{
    HRESULT hr = S_OK;
    BSTR    bstrStringResource = NULL;
    DWORD   cch;
    LPWSTR  pwsz = NULL;

    assert( pbstrInout != NULL );

    if ( pbstrInout == NULL )
    {
        hr = E_POINTER;
        goto Cleanup;
    } // if:

    //
    // Load the string resource.
    //

    hr = HrLoadStringIntoBSTR( hInstanceIn, langidIn, idsIn, &bstrStringResource );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    //
    // Format the message with the arguments.
    //

    cch = FormatMessage(
                      ( FORMAT_MESSAGE_ALLOCATE_BUFFER
                      | FORMAT_MESSAGE_FROM_STRING )
                    , bstrStringResource
                    , 0
                    , 0
                    , (LPWSTR) &pwsz
                    , 0
                    , &valistIn
                    );
    if ( cch == 0 )
    {
        hr = HRESULT_FROM_WIN32( GetLastError() );
        goto Cleanup;
    } // if:

    //
    // If previously allocated free it before re-allocating it.
    //

    if ( *pbstrInout != NULL )
    {
        SysFreeString( *pbstrInout );
        *pbstrInout = NULL;
    } // if:

    //
    // Allocate a BSTR for the string.
    //

    *pbstrInout = SysAllocStringLen( pwsz, cch );
    if ( *pbstrInout == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if:

Cleanup:

    SysFreeString( bstrStringResource );
    LocalFree( pwsz );

    return hr;

} //*** HrFormatStringWithVAListIntoBSTR

HRESULT HrFormatStringWithVAListIntoBSTR | ( | LPCWSTR | pcwszFmtIn,
 |  | BSTR * | pbstrInout,
 |  | va_list | valistIn
 | ) |  |

Definition at line 831 of file StringUtils.cpp.

{
    HRESULT hr = S_OK;
    DWORD   cch;
    LPWSTR  pwsz = NULL;

    if (    ( pbstrInout == NULL )
        ||  ( pcwszFmtIn == NULL )
       )
    {
        hr = E_POINTER;
        goto Cleanup;
    } // if:

    //
    // Format the message with the arguments.
    //

    cch = FormatMessage(
                      ( FORMAT_MESSAGE_ALLOCATE_BUFFER
                      | FORMAT_MESSAGE_FROM_STRING )
                    , pcwszFmtIn
                    , 0
                    , 0
                    , (LPWSTR) &pwsz
                    , 0
                    , &valistIn
                    );
    if ( cch == 0 )
    {
        hr = HRESULT_FROM_WIN32( GetLastError() );
        goto Cleanup;
    } // if:

    //
    // If previously allocated free it before re-allocating it.
    //

    if ( *pbstrInout != NULL )
    {
        SysFreeString( *pbstrInout );
        *pbstrInout = NULL;
    } // if:

    //
    // Allocate a BSTR for the string.
    //

    *pbstrInout = SysAllocStringLen( pwsz, cch );
    if ( *pbstrInout == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if:

Cleanup:

    LocalFree( pwsz );

    return hr;

} //*** HrFormatStringWithVAListIntoBSTR

HRESULT HrLoadStringIntoBSTR | ( | HINSTANCE | hInstanceIn,
 |  | LANGID | langidIn,
 |  | UINT | idsIn,
 |  | BSTR * | pbstrInout
 | ) |  |

Definition at line 341 of file StringUtils.cpp.

{
    HRESULT hr              = S_OK;
    HRSRC   hrsrc           = NULL;
    HGLOBAL hgbl            = NULL;
    int     cch             = 0;
    PBYTE   pbStringData;
    PBYTE   pbStringDataMax;
    PBYTE   pbStringTable;
    int     cbStringTable;
    int     nTable;
    int     nOffset;
    int     idxString;

    assert( idsIn != 0 );
    assert( pbstrInout != NULL );

    if ( pbstrInout == NULL )
    {
        hr = E_POINTER;
        goto Cleanup;
    } // if:

    if ( hInstanceIn == NULL )
    {
        hInstanceIn = g_hInstance;
    } // if:

    //
    //  The resource Id specified must be converted to an index into
    //  a Windows StringTable.
    //

    nTable = idsIn / 16;
    nOffset = idsIn - (nTable * 16);

    //
    //  Internal Table Id's start at 1 not 0.
    //

    nTable++;

    //
    // Find the part of the string table where the string resides.
    //

    //
    //  Find the table containing the string.
    // First try to load the language specified.  If we can't find it we
    // try the "neutral" language.
    //

    hrsrc = FindResourceEx( hInstanceIn, RT_STRING, MAKEINTRESOURCE( nTable ), langidIn );
    if ( ( hrsrc == NULL ) && ( GetLastError() == ERROR_RESOURCE_LANG_NOT_FOUND ) )
    {
        hrsrc = FindResourceEx(
                      hInstanceIn
                    , RT_STRING
                    , MAKEINTRESOURCE( nTable )
                    , MAKELANGID( LANG_NEUTRAL, SUBLANG_NEUTRAL )
                    );
    } // if: FindResourceEx failed

    if ( hrsrc == NULL )
    {
        hr = HRESULT_FROM_WIN32( GetLastError() );
        goto Cleanup;
    } // if:

    //
    //  Load the table.
    //

    hgbl = LoadResource( hInstanceIn, hrsrc );
    if ( hgbl == NULL )
    {
        hr = HRESULT_FROM_WIN32( GetLastError() );
        goto Cleanup;
    } // if:

    //
    //  Lock the table so we access its data.
    //

    pbStringTable = reinterpret_cast< PBYTE >( LockResource( hgbl ) );
    if ( pbStringTable == NULL )
    {
        hr = HRESULT_FROM_WIN32( GetLastError() );
        goto Cleanup;
    } // if:

    cbStringTable = SizeofResource( hInstanceIn, hrsrc );
    assert( cbStringTable != 0 );

    //
    //  Set the data pointer to the beginning of the table.
    //

    pbStringData = pbStringTable;
    pbStringDataMax = pbStringTable + cbStringTable;

    //
    // Skip strings in the block of 16 which are before the desired string.
    //

    for ( idxString = 0 ; idxString <= nOffset ; idxString++ )
    {
        assert( pbStringData != NULL );
        assert( pbStringData < pbStringDataMax );

        //
        //  Get the number of characters excluding the '\0'.
        //

        cch = * ( (USHORT *) pbStringData );

        //
        //  Found the string.
        //

        if ( idxString == nOffset )
        {
            if ( cch == 0 )
            {
                hr = HRESULT_FROM_WIN32( ERROR_RESOURCE_NAME_NOT_FOUND );
                goto Cleanup;
            } // if:

            //
            //  Skip over the string length to get the string.
            //

            pbStringData += sizeof( WCHAR );

            break;
        } // if: found the string

        //
        //  Add one to account for the string length.
        //  A string length of 0 still takes 1 WCHAR for the length portion.
        //

        cch++;

        //
        //  Skip over this string to get to the next string.
        //

        pbStringData += ( cch * sizeof( WCHAR ) );

    } // for: each string in the block of 16 strings in the table

    //
    //  Note: nStringLen is the number of characters in the string not including the '\0'.
    //

    //
    // If previously allocated free it before re-allocating it.
    //

    if ( *pbstrInout != NULL )
    {
        SysFreeString( *pbstrInout );
        *pbstrInout = NULL;
    } // if: string was allocated previously

    //
    // Allocate a BSTR for the string.
    //

    *pbstrInout = SysAllocStringLen( (OLECHAR *) pbStringData, cch );
    if ( *pbstrInout == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if:

Cleanup:

    return hr;

} //*** HrLoadStringIntoBSTR

int IBSTRCompareW | ( | BSTR | bstrString1In,
 |  | BSTR | bstrString2In
 | ) |  |

Definition at line 85 of file StringUtils.cpp.

{
    return WrapCompareString(
                  FALSE
                , static_cast< LPCWSTR >( bstrString1In )
                , SysStringLen( bstrString1In )
                , static_cast< LPCWSTR >( bstrString2In )
                , SysStringLen( bstrString2In )
                );
} //*** IBSTRCompareW

int IStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | LPCWSTR | pcwszString2In
 | ) |  |

Definition at line 115 of file StringUtils.cpp.

{
    return WrapCompareString(
                  FALSE
                , pcwszString1In
                , static_cast< size_t >( -1 )
                , pcwszString2In
                , static_cast< size_t >( -1 )
            );
} //*** IStringCompareW

int IStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 145 of file StringUtils.cpp.

{
    return WrapCompareString(
                  FALSE
                , pcwszString1In
                , cch1In
                , pcwszString2In
                , cch2In
                );
} //*** IStringCompareW

int NBSTRCompareW | ( | BSTR | bstrString1In,
 |  | BSTR | bstrString2In
 | ) |  |

Definition at line 203 of file StringUtils.cpp.

{
    size_t cchMin;

    cchMin = min( SysStringLen( bstrString1In ), SysStringLen( bstrString2In ) );

    return WrapCompareString(
                  TRUE
                , static_cast< LPCWSTR >( bstrString1In )
                , cchMin
                , static_cast< LPCWSTR >( bstrString2In )
                , cchMin
                );
} //*** NBSTRCompareW

int NIBSTRCompareW | ( | BSTR | bstrString1In,
 |  | BSTR | bstrString2In
 | ) |  |

Definition at line 184 of file StringUtils.cpp.

{
    size_t cchMin;

    cchMin = min( SysStringLen( bstrString1In ), SysStringLen( bstrString2In ) );

    return WrapCompareString(
                  FALSE
                , static_cast< LPCWSTR >( bstrString1In )
                , cchMin
                , static_cast< LPCWSTR >( bstrString2In )
                , cchMin
                );
} //*** NIBSTRCompareW

int NIStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cchIn
 | ) |  |

Definition at line 222 of file StringUtils.cpp.

{
    return WrapCompareString(
                  FALSE
                , pcwszString1In
                , cchIn
                , pcwszString2In
                , cchIn
                );
} //*** NIStringCompareW

int NIStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 254 of file StringUtils.cpp.

{
    return WrapCompareString(
                  FALSE
                , pcwszString1In
                , min( cch1In, cch2In )
                , pcwszString2In
                , min( cch1In, cch2In )
                );
} //*** NIStringCompareW

int NStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 271 of file StringUtils.cpp.

{
    return WrapCompareString(
                  TRUE
                , pcwszString1In
                , min( cch1In, cch2In )
                , pcwszString2In
                , min( cch1In, cch2In )
                );
} //*** NStringCompareW

int NStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cchIn
 | ) |  |

Definition at line 238 of file StringUtils.cpp.

{
    return WrapCompareString(
                  TRUE
                , pcwszString1In
                , cchIn
                , pcwszString2In
                , cchIn
                );
} //*** NIStringCompareW

int StringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 162 of file StringUtils.cpp.

{
    return WrapCompareString(
                  TRUE
                , pcwszString1In
                , cch1In
                , pcwszString2In
                , cch2In
                );
} //*** StringCompareW

int StringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | LPCWSTR | pcwszString2In
 | ) |  |

Definition at line 130 of file StringUtils.cpp.

{
    return WrapCompareString(
                  TRUE
                , pcwszString1In
                , static_cast< size_t >( -1 )
                , pcwszString2In
                , static_cast< size_t >( -1 )
                );
} //*** StringCompareW

int WrapCompareString | ( | BOOL | fCaseSensitive,
 |  | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 57 of file StringUtils.cpp.

{
    int nRet;

    nRet = CompareStringW(
              LOCALE_SYSTEM_DEFAULT
            , fCaseSensitive ? 0 : NORM_IGNORECASE
            , pcwszString1In
            , static_cast< DWORD >( cch1In )
            , pcwszString2In
            , static_cast< DWORD >( cch2In )
            );

    return nRet - CSTR_EQUAL; // CSTR_LT < CSTR_EQUAL < CSTR_GT

} // *** WrapCompareString

Generated on Wed Nov 13 2024 16:54:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/FileShareSample/File Share Sample/StringUtils.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • FileShareSample
  • File Share Sample
Functions

StringUtils.h File Reference

#include "ClRes.h"

Go to the source code of this file.

Functions

int | BSTRCompareW (BSTR bstrString1In, BSTR bstrString2In)
HRESULT | HrFormatStringIntoBSTR (HINSTANCE hInstanceIn, LANGID langidIn, UINT idsIn, BSTR *pbstrInout,...)
HRESULT | HrFormatStringIntoBSTR (HINSTANCE hInstanceIn, UINT idsIn, BSTR *pbstrInout,...)
HRESULT | HrFormatStringIntoBSTR (UINT idsIn, BSTR *pbstrInout,...)
HRESULT | HrFormatStringIntoBSTR (LPCWSTR pcwszFmtIn, BSTR *pbstrInout,...)
HRESULT | HrFormatStringWithVAListIntoBSTR (HINSTANCE hInstanceIn, LANGID langidIn, UINT idsIn, BSTR *pbstrInout, va_list valistIn)
HRESULT | HrFormatStringWithVAListIntoBSTR (HINSTANCE hInstanceIn, UINT idsIn, BSTR *pbstrInout, va_list valistIn)
HRESULT | HrFormatStringWithVAListIntoBSTR (LPCWSTR pcwszFmtIn, BSTR *pbstrInout, va_list valistIn)
HRESULT | HrLoadStringIntoBSTR (HINSTANCE hInstanceIn, UINT idsIn, BSTR *pbstrInout)
HRESULT | HrLoadStringIntoBSTR (HINSTANCE hInstanceIn, LANGID langidIn, UINT idsIn, BSTR *pbstrInout)
HRESULT | HrLoadStringIntoBSTR (UINT idsIn, BSTR *pbstrInout)
int | IBSTRCompareW (BSTR bstrString1In, BSTR bstrString2In)
int | IStringCompareW (LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)
int | IStringCompareW (LPCWSTR pcwszString1In, LPCWSTR pcwszString2In)
int | NBSTRCompareW (BSTR bstrString1In, BSTR bstrString2In)
int | NIBSTRCompareW (BSTR bstrString1In, BSTR bstrString2In)
int | NIStringCompareW (LPCWSTR pcwszString1In, LPCWSTR pcwszString2In, size_t cchIn)
int | NIStringCompareW (LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)
int | NStringCompareW (LPCWSTR pcwszString1In, LPCWSTR pcwszString2In, size_t cchIn)
int | NStringCompareW (LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)
int | StringCompareW (LPCWSTR pcwszString1In, LPCWSTR pcwszString2In)
int | StringCompareW (LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)

Function Documentation

int BSTRCompareW | ( | BSTR | bstrString1In,
 |  | BSTR | bstrString2In
 | ) |  |

Definition at line 100 of file StringUtils.cpp.

{
    return WrapCompareString(
                  TRUE
                , static_cast< LPCWSTR >( bstrString1In )
                , SysStringLen( bstrString1In )
                , static_cast< LPCWSTR >( bstrString2In )
                , SysStringLen( bstrString2In )
                );
} //*** BSTRCompareW

HRESULT HrFormatStringIntoBSTR | ( | HINSTANCE | hInstanceIn,
 |  | LANGID | langidIn,
 |  | UINT | idsIn,
 |  | BSTR * | pbstrInout,
 |  |  | ...
 | ) |  |

Definition at line 578 of file StringUtils.cpp.

{
    HRESULT hr;
    va_list valist;

    va_start( valist, pbstrInout );

    hr = HrFormatStringWithVAListIntoBSTR(
                          hInstanceIn
                        , langidIn
                        , idsIn
                        , pbstrInout
                        , valist
                        );

    va_end( valist );

    return hr;

} //*** HrFormatStringIntoBSTR

HRESULT HrFormatStringIntoBSTR | ( | HINSTANCE | hInstanceIn,
 |  | UINT | idsIn,
 |  | BSTR * | pbstrInout,
 |  |  | ... |
 | ) |  |  | [inline]

Definition at line 189 of file StringUtils.h.

{
    HRESULT hr;
    va_list valist;

    va_start( valist, pbstrInout );

    hr = HrFormatStringWithVAListIntoBSTR(
                  hInstanceIn
                , MAKELANGID( LANG_NEUTRAL, SUBLANG_NEUTRAL )
                , idsIn
                , pbstrInout
                , valist
                );

    va_end( valist );

    return hr;

} //*** HrFormatStringIntoBSTR

HRESULT HrFormatStringIntoBSTR | ( | UINT | idsIn,
 |  | BSTR * | pbstrInout,
 |  |  | ... |
 | ) |  |  | [inline]

Definition at line 217 of file StringUtils.h.

{
    HRESULT hr;
    va_list valist;

    va_start( valist, pbstrInout );

    hr = HrFormatStringWithVAListIntoBSTR(
                  NULL
                , MAKELANGID( LANG_NEUTRAL, SUBLANG_NEUTRAL )
                , idsIn
                , pbstrInout
                , valist
                );

    va_end( valist );

    return hr;

} //*** HrFormatStringIntoBSTR

HRESULT HrFormatStringIntoBSTR | ( | LPCWSTR | pcwszFmtIn,
 |  | BSTR * | pbstrInout,
 |  |  | ...
 | ) |  |

Definition at line 773 of file StringUtils.cpp.

{
    HRESULT hr = S_OK;
    va_list valist;

    va_start( valist, pbstrInout );

    hr = HrFormatStringWithVAListIntoBSTR( pcwszFmtIn, pbstrInout, valist );

    va_end( valist );

    return hr;

} //*** HrFormatStringIntoBSTR

HRESULT HrFormatStringWithVAListIntoBSTR | ( | HINSTANCE | hInstanceIn,
 |  | LANGID | langidIn,
 |  | UINT | idsIn,
 |  | BSTR * | pbstrInout,
 |  | va_list | valistIn
 | ) |  |

Definition at line 651 of file StringUtils.cpp.

{
    HRESULT hr = S_OK;
    BSTR    bstrStringResource = NULL;
    DWORD   cch;
    LPWSTR  pwsz = NULL;

    assert( pbstrInout != NULL );

    if ( pbstrInout == NULL )
    {
        hr = E_POINTER;
        goto Cleanup;
    } // if:

    //
    // Load the string resource.
    //

    hr = HrLoadStringIntoBSTR( hInstanceIn, langidIn, idsIn, &bstrStringResource );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    //
    // Format the message with the arguments.
    //

    cch = FormatMessage(
                      ( FORMAT_MESSAGE_ALLOCATE_BUFFER
                      | FORMAT_MESSAGE_FROM_STRING )
                    , bstrStringResource
                    , 0
                    , 0
                    , (LPWSTR) &pwsz
                    , 0
                    , &valistIn
                    );
    if ( cch == 0 )
    {
        hr = HRESULT_FROM_WIN32( GetLastError() );
        goto Cleanup;
    } // if:

    //
    // If previously allocated free it before re-allocating it.
    //

    if ( *pbstrInout != NULL )
    {
        SysFreeString( *pbstrInout );
        *pbstrInout = NULL;
    } // if:

    //
    // Allocate a BSTR for the string.
    //

    *pbstrInout = SysAllocStringLen( pwsz, cch );
    if ( *pbstrInout == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if:

Cleanup:

    SysFreeString( bstrStringResource );
    LocalFree( pwsz );

    return hr;

} //*** HrFormatStringWithVAListIntoBSTR

HRESULT HrFormatStringWithVAListIntoBSTR | ( | HINSTANCE | hInstanceIn,
 |  | UINT | idsIn,
 |  | BSTR * | pbstrInout,
 |  | va_list | valistIn |
 | ) |  |  | [inline]

Definition at line 244 of file StringUtils.h.

{
    return HrFormatStringWithVAListIntoBSTR(
                  hInstanceIn
                , MAKELANGID( LANG_NEUTRAL, SUBLANG_NEUTRAL )
                , idsIn
                , pbstrInout
                , valistIn
                );

} //*** HrFormatStringWithVAListIntoBSTR

HRESULT HrFormatStringWithVAListIntoBSTR | ( | LPCWSTR | pcwszFmtIn,
 |  | BSTR * | pbstrInout,
 |  | va_list | valistIn
 | ) |  |

Definition at line 831 of file StringUtils.cpp.

{
    HRESULT hr = S_OK;
    DWORD   cch;
    LPWSTR  pwsz = NULL;

    if (    ( pbstrInout == NULL )
        ||  ( pcwszFmtIn == NULL )
       )
    {
        hr = E_POINTER;
        goto Cleanup;
    } // if:

    //
    // Format the message with the arguments.
    //

    cch = FormatMessage(
                      ( FORMAT_MESSAGE_ALLOCATE_BUFFER
                      | FORMAT_MESSAGE_FROM_STRING )
                    , pcwszFmtIn
                    , 0
                    , 0
                    , (LPWSTR) &pwsz
                    , 0
                    , &valistIn
                    );
    if ( cch == 0 )
    {
        hr = HRESULT_FROM_WIN32( GetLastError() );
        goto Cleanup;
    } // if:

    //
    // If previously allocated free it before re-allocating it.
    //

    if ( *pbstrInout != NULL )
    {
        SysFreeString( *pbstrInout );
        *pbstrInout = NULL;
    } // if:

    //
    // Allocate a BSTR for the string.
    //

    *pbstrInout = SysAllocStringLen( pwsz, cch );
    if ( *pbstrInout == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if:

Cleanup:

    LocalFree( pwsz );

    return hr;

} //*** HrFormatStringWithVAListIntoBSTR

HRESULT HrLoadStringIntoBSTR | ( | HINSTANCE | hInstanceIn,
 |  | UINT | idsIn,
 |  | BSTR * | pbstrInout |
 | ) |  |  | [inline]

Definition at line 149 of file StringUtils.h.

{
    return HrLoadStringIntoBSTR(
                          hInstanceIn
                        , MAKELANGID( LANG_NEUTRAL, SUBLANG_NEUTRAL )
                        , idsIn
                        , pbstrInout
                        );

} //*** HrLoadStringIntoBSTR

HRESULT HrLoadStringIntoBSTR | ( | HINSTANCE | hInstanceIn,
 |  | LANGID | langidIn,
 |  | UINT | idsIn,
 |  | BSTR * | pbstrInout
 | ) |  |

Definition at line 341 of file StringUtils.cpp.

{
    HRESULT hr              = S_OK;
    HRSRC   hrsrc           = NULL;
    HGLOBAL hgbl            = NULL;
    int     cch             = 0;
    PBYTE   pbStringData;
    PBYTE   pbStringDataMax;
    PBYTE   pbStringTable;
    int     cbStringTable;
    int     nTable;
    int     nOffset;
    int     idxString;

    assert( idsIn != 0 );
    assert( pbstrInout != NULL );

    if ( pbstrInout == NULL )
    {
        hr = E_POINTER;
        goto Cleanup;
    } // if:

    if ( hInstanceIn == NULL )
    {
        hInstanceIn = _Module.m_hInstResource;
    } // if:

    //
    //  The resource Id specified must be converted to an index into
    //  a Windows StringTable.
    //

    nTable = idsIn / 16;
    nOffset = idsIn - (nTable * 16);

    //
    //  Internal Table Id's start at 1 not 0.
    //

    nTable++;

    //
    // Find the part of the string table where the string resides.
    //

    //
    //  Find the table containing the string.
    // First try to load the language specified.  If we can't find it we
    // try the "neutral" language.
    //

    hrsrc = FindResourceEx( hInstanceIn, RT_STRING, MAKEINTRESOURCE( nTable ), langidIn );
    if ( ( hrsrc == NULL ) && ( GetLastError() == ERROR_RESOURCE_LANG_NOT_FOUND ) )
    {
        hrsrc = FindResourceEx(
                      hInstanceIn
                    , RT_STRING
                    , MAKEINTRESOURCE( nTable )
                    , MAKELANGID( LANG_NEUTRAL, SUBLANG_NEUTRAL )
                    );
    } // if: FindResourceEx failed

    if ( hrsrc == NULL )
    {
        hr = HRESULT_FROM_WIN32( GetLastError() );
        goto Cleanup;
    } // if:

    //
    //  Load the table.
    //

    hgbl = LoadResource( hInstanceIn, hrsrc );
    if ( hgbl == NULL )
    {
        hr = HRESULT_FROM_WIN32( GetLastError() );
        goto Cleanup;
    } // if:

    //
    //  Lock the table so we access its data.
    //

    pbStringTable = reinterpret_cast< PBYTE >( LockResource( hgbl ) );
    if ( pbStringTable == NULL )
    {
        hr = HRESULT_FROM_WIN32( GetLastError() );
        goto Cleanup;
    } // if:

    cbStringTable = SizeofResource( hInstanceIn, hrsrc );
    assert( cbStringTable != 0 );

    //
    //  Set the data pointer to the beginning of the table.
    //

    pbStringData = pbStringTable;
    pbStringDataMax = pbStringTable + cbStringTable;

    //
    // Skip strings in the block of 16 which are before the desired string.
    //

    for ( idxString = 0 ; idxString <= nOffset ; idxString++ )
    {
        assert( pbStringData != NULL );
        assert( pbStringData < pbStringDataMax );

        //
        //  Get the number of characters excluding the '\0'.
        //

        cch = * ( (USHORT *) pbStringData );

        //
        //  Found the string.
        //

        if ( idxString == nOffset )
        {
            if ( cch == 0 )
            {
                hr = HRESULT_FROM_WIN32( ERROR_RESOURCE_NAME_NOT_FOUND );
                goto Cleanup;
            } // if:

            //
            //  Skip over the string length to get the string.
            //

            pbStringData += sizeof( WCHAR );

            break;
        } // if: found the string

        //
        //  Add one to account for the string length.
        //  A string length of 0 still takes 1 WCHAR for the length portion.
        //

        cch++;

        //
        //  Skip over this string to get to the next string.
        //

        pbStringData += ( cch * sizeof( WCHAR ) );

    } // for: each string in the block of 16 strings in the table

    //
    //  Note: nStringLen is the number of characters in the string not including the '\0'.
    //

    //
    // If previously allocated free it before re-allocating it.
    //

    if ( *pbstrInout != NULL )
    {
        SysFreeString( *pbstrInout );
        *pbstrInout = NULL;
    } // if: string was allocated previously

    //
    // Allocate a BSTR for the string.
    //

    *pbstrInout = SysAllocStringLen( (OLECHAR *) pbStringData, cch );
    if ( *pbstrInout == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if:

Cleanup:

    return hr;

} //*** HrLoadStringIntoBSTR

HRESULT HrLoadStringIntoBSTR | ( | UINT | idsIn,
 |  | BSTR * | pbstrInout |
 | ) |  |  | [inline]

Definition at line 134 of file StringUtils.h.

{
    return HrLoadStringIntoBSTR(
                          NULL
                        , MAKELANGID( LANG_NEUTRAL, SUBLANG_NEUTRAL )
                        , idsIn
                        , pbstrInout
                        );
} //*** HrLoadStringIntoBSTR

int IBSTRCompareW | ( | BSTR | bstrString1In,
 |  | BSTR | bstrString2In
 | ) |  |

Definition at line 85 of file StringUtils.cpp.

{
    return WrapCompareString(
                  FALSE
                , static_cast< LPCWSTR >( bstrString1In )
                , SysStringLen( bstrString1In )
                , static_cast< LPCWSTR >( bstrString2In )
                , SysStringLen( bstrString2In )
                );
} //*** IBSTRCompareW

int IStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 145 of file StringUtils.cpp.

{
    return WrapCompareString(
                  FALSE
                , pcwszString1In
                , cch1In
                , pcwszString2In
                , cch2In
                );
} //*** IStringCompareW

int IStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | LPCWSTR | pcwszString2In
 | ) |  |

Definition at line 115 of file StringUtils.cpp.

{
    return WrapCompareString(
                  FALSE
                , pcwszString1In
                , static_cast< size_t >( -1 )
                , pcwszString2In
                , static_cast< size_t >( -1 )
            );
} //*** IStringCompareW

int NBSTRCompareW | ( | BSTR | bstrString1In,
 |  | BSTR | bstrString2In
 | ) |  |

Definition at line 203 of file StringUtils.cpp.

{
    size_t cchMin;

    cchMin = min( SysStringLen( bstrString1In ), SysStringLen( bstrString2In ) );

    return WrapCompareString(
                  TRUE
                , static_cast< LPCWSTR >( bstrString1In )
                , cchMin
                , static_cast< LPCWSTR >( bstrString2In )
                , cchMin
                );
} //*** NBSTRCompareW

int NIBSTRCompareW | ( | BSTR | bstrString1In,
 |  | BSTR | bstrString2In
 | ) |  |

Definition at line 184 of file StringUtils.cpp.

{
    size_t cchMin;

    cchMin = min( SysStringLen( bstrString1In ), SysStringLen( bstrString2In ) );

    return WrapCompareString(
                  FALSE
                , static_cast< LPCWSTR >( bstrString1In )
                , cchMin
                , static_cast< LPCWSTR >( bstrString2In )
                , cchMin
                );
} //*** NIBSTRCompareW

int NIStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cchIn
 | ) |  |

Definition at line 222 of file StringUtils.cpp.

{
    return WrapCompareString(
                  FALSE
                , pcwszString1In
                , cchIn
                , pcwszString2In
                , cchIn
                );
} //*** NIStringCompareW

int NIStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 254 of file StringUtils.cpp.

{
    return WrapCompareString(
                  FALSE
                , pcwszString1In
                , min( cch1In, cch2In )
                , pcwszString2In
                , min( cch1In, cch2In )
                );
} //*** NIStringCompareW

int NStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cchIn
 | ) |  |

Definition at line 238 of file StringUtils.cpp.

{
    return WrapCompareString(
                  TRUE
                , pcwszString1In
                , cchIn
                , pcwszString2In
                , cchIn
                );
} //*** NIStringCompareW

int NStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 271 of file StringUtils.cpp.

{
    return WrapCompareString(
                  TRUE
                , pcwszString1In
                , min( cch1In, cch2In )
                , pcwszString2In
                , min( cch1In, cch2In )
                );
} //*** NStringCompareW

int StringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | LPCWSTR | pcwszString2In
 | ) |  |

Definition at line 130 of file StringUtils.cpp.

{
    return WrapCompareString(
                  TRUE
                , pcwszString1In
                , static_cast< size_t >( -1 )
                , pcwszString2In
                , static_cast< size_t >( -1 )
                );
} //*** StringCompareW

int StringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 162 of file StringUtils.cpp.

{
    return WrapCompareString(
                  TRUE
                , pcwszString1In
                , cch1In
                , pcwszString2In
                , cch2In
                );
} //*** StringCompareW

Generated on Wed Nov 13 2024 16:54:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/BasePage.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • FileShareSample
  • File Share SampleEx

BasePage.cpp File Reference

#include "stdafx.h"
#include "File Share SampleEx.h"
#include "ExtObj.h"
#include "BasePage.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/BasePage.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • FileShareSample
  • File Share SampleEx
Classes | Typedefs

BasePage.h File Reference

#include <CluAdmEx.h>
#include "ExtObj.h"
#include "PropList.h"
#include "PropList.h"

Go to the source code of this file.

Classes

class CBasePropertyPage

Typedefs

typedef CList
< CBasePropertyPage
*, CBasePropertyPage * > 		CPageList

Typedef Documentation

typedef CList< CBasePropertyPage *, CBasePropertyPage * > CPageList

Definition at line 194 of file BasePage.h.

Generated on Wed Nov 13 2024 16:54:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/DDxDDv.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • FileShareSample
  • File Share SampleEx
Functions

DDxDDv.cpp File Reference

#include "stdafx.h"
#include "DDxDDv.h"
#include "resource.h"

Go to the source code of this file.

Functions

void | CleanupLabel (LPTSTR pwszLabelIn)
void AFXAPI | DDV_RequiredText (CDataExchange *pDXIn, int nIDCIn, int nIDCLabelIn, const CString &rstrValueIn)
void AFXAPI | DDX_Number (CDataExchange *pDXIn, int nIDCIn, DWORD &rdwValueInout, DWORD dwMinIn, DWORD dwMaxIn, BOOL fSignedIn)

Function Documentation

void CleanupLabel ( LPTSTR pwszLabelIn )

Definition at line 308 of file DDxDDv.cpp.

{
    LPTSTR  pin = NULL;
    LPTSTR  pout = NULL;
    LANGID  langid;
    WORD    primarylangid;
    BOOL    fFELanguage;

    //
    //  Get the language ID.
    //

    langid = GetUserDefaultLangID();
    primarylangid = static_cast< WORD >( PRIMARYLANGID( langid ) );
    fFELanguage = ((primarylangid == LANG_JAPANESE)
                || (primarylangid == LANG_CHINESE)
                || (primarylangid == LANG_KOREAN) );

    //
    // Copy the name sans '&' and ':' chars
    //

    pin = pout = pwszLabelIn;
    do
    {
        //
        // Strip FE accelerators with parentheses. e.g. "foo(&F)" -> "foo"
        //

        if (    fFELanguage
            &&  (pin[ 0 ] == _T('('))
            &&  (pin[ 1 ] == _T('&'))
            &&  (pin[ 2 ] != _T('\0'))
            &&  (pin[ 3 ] == _T(')')) )
        {
            pin += 3;
        } // if:  Far East language with accelerator
        else if ( (*pin != _T('&')) && (*pin != _T(':')) )
        {
            *pout++ = *pin;
        } // else if:  accelerator found
    } while ( *pin++ != _T('\0') );

} //*** CleanupLabel

void AFXAPI DDV_RequiredText | ( | CDataExchange * | pDXIn,
 |  | int | nIDCIn,
 |  | int | nIDCLabelIn,
 |  | const CString & | rstrValueIn
 | ) |  |

Definition at line 246 of file DDxDDv.cpp.

{
    ASSERT( pDXIn != NULL );

    AFX_MANAGE_STATE( AfxGetStaticModuleState() );

    if ( pDXIn->m_bSaveAndValidate )
    {
        if ( rstrValueIn.GetLength() == 0 )
        {
            HWND        hwndLabel;
            TCHAR       szLabel[ 1024 ];
            CString     strPrompt;

            // Get the label window handle
            hwndLabel = pDXIn->PrepareEditCtrl( nIDCLabelIn );

            // Get the text of the label.
            GetWindowText( hwndLabel, szLabel, RTL_NUMBER_OF( szLabel ) );

            // Remove ampersands (&) and colons (:).
            CleanupLabel( szLabel );

            // Format and display a message.
            strPrompt.FormatMessage( IDS_REQUIRED_FIELD_EMPTY, szLabel );
            AfxMessageBox( strPrompt, MB_ICONEXCLAMATION );

            // Do this so that the control receives focus.
            (void) pDXIn->PrepareEditCtrl( nIDCIn );

            // Fail the call.
            strPrompt.Empty();  // exception prep
            pDXIn->Fail();
        } // if:  field not specified
    } // if:  saving data

} //*** DDV_RequiredText

void AFXAPI DDX_Number | ( | CDataExchange * | pDXIn,
 |  | int | nIDCIn,
 |  | DWORD & | rdwValueInout,
 |  | DWORD | dwMinIn,
 |  | DWORD | dwMaxIn,
 |  | BOOL | fSignedIn
 | ) |  |

Definition at line 68 of file DDxDDv.cpp.

{
    HWND    hwndCtrl = NULL;
    DWORD   dwValue = 0;
    HRESULT hr = S_OK;

    ASSERT( pDXIn != NULL );
#ifdef _DEBUG
    if ( fSignedIn )
    {
        ASSERT( static_cast< LONG >( dwMinIn ) < static_cast< LONG >( dwMaxIn ) );
    }
    else
    {
        ASSERT( dwMinIn < dwMaxIn );
    }
#endif // _DEBUG

    AFX_MANAGE_STATE( AfxGetStaticModuleState() );

    //
    //  Get the control window handle.
    //

    hwndCtrl = pDXIn->PrepareEditCtrl( nIDCIn );

    if ( pDXIn->m_bSaveAndValidate )
    {
        BOOL    bTranslated;

        //
        //  Get the number from the control.
        //

        dwValue = GetDlgItemInt( pDXIn->m_pDlgWnd->m_hWnd, nIDCIn, &bTranslated, fSignedIn );

        //
        // If the retrival failed, it is a signed number, and the minimum
        // value is the smallest negative value possible, check the string itself.
        //

        if ( ! bTranslated && fSignedIn && (dwMinIn == 0x80000000) )
        {
            UINT    cch = 0;
            TCHAR   szNumber[ 20 ];

            //
            //  See if it is the smallest negative number.
            //

            cch = GetDlgItemText( pDXIn->m_pDlgWnd->m_hWnd, nIDCIn, szNumber, RTL_NUMBER_OF( szNumber ) );
            if ( (cch != 0) && (_tcsnicmp( szNumber, _T("-2147483648"), RTL_NUMBER_OF( szNumber ) ) == 0) )
            {
                dwValue = 0x80000000;
                bTranslated = TRUE;
            } // if:  text retrieved successfully and is highest negative number
        } // if:  error translating number and getting signed number

        //
        // If the retrieval failed or the specified number is
        // out of range, display an error.
        //

        if (    ! bTranslated
            ||  (fSignedIn
                && (    (static_cast< LONG >( dwValue ) < static_cast< LONG >( dwMinIn ))
                    ||  (static_cast< LONG >( dwValue ) > static_cast< LONG >( dwMaxIn ))
                    )
                )
            ||  (!  fSignedIn
                &&  (   (dwValue < dwMinIn)
                    ||  (dwValue > dwMaxIn)
                    )
                )
            )
        {
            TCHAR   szMin[ 32 ];
            TCHAR   szMax[ 32 ];
            CString strPrompt;

            if ( fSignedIn )
            {
                hr = StringCchPrintf( szMin, RTL_NUMBER_OF( szMin ), _T("%d%"), dwMinIn );
                ASSERT( SUCCEEDED( hr ) );
                hr = StringCchPrintf( szMax, RTL_NUMBER_OF( szMax ), _T("%d%"), dwMaxIn );
                ASSERT( SUCCEEDED( hr ) );
            } // if:  signed number
            else
            {
                hr = StringCchPrintf( szMin, RTL_NUMBER_OF( szMin ), _T("%u%"), dwMinIn );
                ASSERT( SUCCEEDED( hr ) );
                hr = StringCchPrintf( szMax, RTL_NUMBER_OF( szMax ), _T("%u%"), dwMaxIn );
                ASSERT( SUCCEEDED( hr ) );
            } // else:  unsigned number
            AfxFormatString2( strPrompt, AFX_IDP_PARSE_INT_RANGE, szMin, szMax );
            AfxMessageBox( strPrompt, MB_ICONEXCLAMATION, AFX_IDP_PARSE_INT_RANGE );
            strPrompt.Empty(); // exception prep
            pDXIn->Fail();
        } // if:  invalid string
        else
        {
            rdwValueInout = dwValue;
        } // if:  number is in range
    } // if:  saving data
    else
    {
        CString     strMinValue;
        CString     strMaxValue;
        UINT        cchMax;

        //
        //  Set the maximum number of characters that can be entered.
        //

        if ( fSignedIn )
        {
            strMinValue.Format( _T("%d"), dwMinIn );
            strMaxValue.Format( _T("%d"), dwMaxIn );
        } // if:  signed value
        else
        {
            strMinValue.Format( _T("%u"), dwMinIn );
            strMaxValue.Format( _T("%u"), dwMaxIn );
        } // else:  unsigned value
        cchMax = max( strMinValue.GetLength(), strMaxValue.GetLength() );
        SendMessage( hwndCtrl, EM_LIMITTEXT, cchMax, 0 );

        //
        //  Set the value into the control.
        //

        if ( fSignedIn )
        {
            LONG lValue = static_cast< LONG >( rdwValueInout );
            DDX_Text( pDXIn, nIDCIn, lValue );
        } // if:  signed value
        else
        {
            DDX_Text( pDXIn, nIDCIn, rdwValueInout );
        } // else:
    } // else:  setting data onto the dialog

} //*** DDX_Number

Generated on Wed Nov 13 2024 16:54:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/DDxDDv.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • FileShareSample
  • File Share SampleEx
Functions

DDxDDv.h File Reference

Go to the source code of this file.

Functions

void | CleanupLabel (LPTSTR pwszIn)
void AFXAPI | DDV_RequiredText (CDataExchange *pDXIn, int nIDCIn, int nIDCLabelIn, const CString &rstrValueIn)
void AFXAPI | DDX_Number (CDataExchange *pDXIn, int nIDCIn, LONG &rnValueInout, LONG nMinIn, LONG nMaxIn, BOOL fSignedIn)
void AFXAPI | DDX_Number (CDataExchange *pDXIn, int nIDCIn, DWORD &rdwValueInout, DWORD dwMinIn, DWORD dwMaxIn, BOOL fSignedIn=FALSE)

Function Documentation

void CleanupLabel ( LPTSTR pwszIn )

Definition at line 308 of file DDxDDv.cpp.

{
    LPTSTR  pin = NULL;
    LPTSTR  pout = NULL;
    LANGID  langid;
    WORD    primarylangid;
    BOOL    fFELanguage;

    //
    //  Get the language ID.
    //

    langid = GetUserDefaultLangID();
    primarylangid = static_cast< WORD >( PRIMARYLANGID( langid ) );
    fFELanguage = ((primarylangid == LANG_JAPANESE)
                || (primarylangid == LANG_CHINESE)
                || (primarylangid == LANG_KOREAN) );

    //
    // Copy the name sans '&' and ':' chars
    //

    pin = pout = pwszLabelIn;
    do
    {
        //
        // Strip FE accelerators with parentheses. e.g. "foo(&F)" -> "foo"
        //

        if (    fFELanguage
            &&  (pin[ 0 ] == _T('('))
            &&  (pin[ 1 ] == _T('&'))
            &&  (pin[ 2 ] != _T('\0'))
            &&  (pin[ 3 ] == _T(')')) )
        {
            pin += 3;
        } // if:  Far East language with accelerator
        else if ( (*pin != _T('&')) && (*pin != _T(':')) )
        {
            *pout++ = *pin;
        } // else if:  accelerator found
    } while ( *pin++ != _T('\0') );

} //*** CleanupLabel

void AFXAPI DDV_RequiredText | ( | CDataExchange * | pDXIn,
 |  | int | nIDCIn,
 |  | int | nIDCLabelIn,
 |  | const CString & | rstrValueIn
 | ) |  |

Definition at line 246 of file DDxDDv.cpp.

{
    ASSERT( pDXIn != NULL );

    AFX_MANAGE_STATE( AfxGetStaticModuleState() );

    if ( pDXIn->m_bSaveAndValidate )
    {
        if ( rstrValueIn.GetLength() == 0 )
        {
            HWND        hwndLabel;
            TCHAR       szLabel[ 1024 ];
            CString     strPrompt;

            // Get the label window handle
            hwndLabel = pDXIn->PrepareEditCtrl( nIDCLabelIn );

            // Get the text of the label.
            GetWindowText( hwndLabel, szLabel, RTL_NUMBER_OF( szLabel ) );

            // Remove ampersands (&) and colons (:).
            CleanupLabel( szLabel );

            // Format and display a message.
            strPrompt.FormatMessage( IDS_REQUIRED_FIELD_EMPTY, szLabel );
            AfxMessageBox( strPrompt, MB_ICONEXCLAMATION );

            // Do this so that the control receives focus.
            (void) pDXIn->PrepareEditCtrl( nIDCIn );

            // Fail the call.
            strPrompt.Empty();  // exception prep
            pDXIn->Fail();
        } // if:  field not specified
    } // if:  saving data

} //*** DDV_RequiredText

void AFXAPI DDX_Number | ( | CDataExchange * | pDXIn,
 |  | int | nIDCIn,
 |  | LONG & | rnValueInout,
 |  | LONG | nMinIn,
 |  | LONG | nMaxIn,
 |  | BOOL | fSignedIn |
 | ) |  |  | [inline]

Definition at line 53 of file DDxDDv.h.

{
    DDX_Number(
          pDXIn
        , nIDCIn
        , reinterpret_cast< DWORD & >( rnValueInout )
        , static_cast< DWORD >( nMinIn )
        , static_cast< DWORD >( nMaxIn )
        , fSignedIn
        );

} //*** DDXNumber

void AFXAPI DDX_Number | ( | CDataExchange * | pDXIn,
 |  | int | nIDCIn,
 |  | DWORD & | rdwValueInout,
 |  | DWORD | dwMinIn,
 |  | DWORD | dwMaxIn,
 |  | BOOL | fSignedIn = FALSE
 | ) |  |

Definition at line 68 of file DDxDDv.cpp.

{
    HWND    hwndCtrl = NULL;
    DWORD   dwValue = 0;
    HRESULT hr = S_OK;

    ASSERT( pDXIn != NULL );
#ifdef _DEBUG
    if ( fSignedIn )
    {
        ASSERT( static_cast< LONG >( dwMinIn ) < static_cast< LONG >( dwMaxIn ) );
    }
    else
    {
        ASSERT( dwMinIn < dwMaxIn );
    }
#endif // _DEBUG

    AFX_MANAGE_STATE( AfxGetStaticModuleState() );

    //
    //  Get the control window handle.
    //

    hwndCtrl = pDXIn->PrepareEditCtrl( nIDCIn );

    if ( pDXIn->m_bSaveAndValidate )
    {
        BOOL    bTranslated;

        //
        //  Get the number from the control.
        //

        dwValue = GetDlgItemInt( pDXIn->m_pDlgWnd->m_hWnd, nIDCIn, &bTranslated, fSignedIn );

        //
        // If the retrival failed, it is a signed number, and the minimum
        // value is the smallest negative value possible, check the string itself.
        //

        if ( ! bTranslated && fSignedIn && (dwMinIn == 0x80000000) )
        {
            UINT    cch = 0;
            TCHAR   szNumber[ 20 ];

            //
            //  See if it is the smallest negative number.
            //

            cch = GetDlgItemText( pDXIn->m_pDlgWnd->m_hWnd, nIDCIn, szNumber, RTL_NUMBER_OF( szNumber ) );
            if ( (cch != 0) && (_tcsnicmp( szNumber, _T("-2147483648"), RTL_NUMBER_OF( szNumber ) ) == 0) )
            {
                dwValue = 0x80000000;
                bTranslated = TRUE;
            } // if:  text retrieved successfully and is highest negative number
        } // if:  error translating number and getting signed number

        //
        // If the retrieval failed or the specified number is
        // out of range, display an error.
        //

        if (    ! bTranslated
            ||  (fSignedIn
                && (    (static_cast< LONG >( dwValue ) < static_cast< LONG >( dwMinIn ))
                    ||  (static_cast< LONG >( dwValue ) > static_cast< LONG >( dwMaxIn ))
                    )
                )
            ||  (!  fSignedIn
                &&  (   (dwValue < dwMinIn)
                    ||  (dwValue > dwMaxIn)
                    )
                )
            )
        {
            TCHAR   szMin[ 32 ];
            TCHAR   szMax[ 32 ];
            CString strPrompt;

            if ( fSignedIn )
            {
                hr = StringCchPrintf( szMin, RTL_NUMBER_OF( szMin ), _T("%d%"), dwMinIn );
                ASSERT( SUCCEEDED( hr ) );
                hr = StringCchPrintf( szMax, RTL_NUMBER_OF( szMax ), _T("%d%"), dwMaxIn );
                ASSERT( SUCCEEDED( hr ) );
            } // if:  signed number
            else
            {
                hr = StringCchPrintf( szMin, RTL_NUMBER_OF( szMin ), _T("%u%"), dwMinIn );
                ASSERT( SUCCEEDED( hr ) );
                hr = StringCchPrintf( szMax, RTL_NUMBER_OF( szMax ), _T("%u%"), dwMaxIn );
                ASSERT( SUCCEEDED( hr ) );
            } // else:  unsigned number
            AfxFormatString2( strPrompt, AFX_IDP_PARSE_INT_RANGE, szMin, szMax );
            AfxMessageBox( strPrompt, MB_ICONEXCLAMATION, AFX_IDP_PARSE_INT_RANGE );
            strPrompt.Empty(); // exception prep
            pDXIn->Fail();
        } // if:  invalid string
        else
        {
            rdwValueInout = dwValue;
        } // if:  number is in range
    } // if:  saving data
    else
    {
        CString     strMinValue;
        CString     strMaxValue;
        UINT        cchMax;

        //
        //  Set the maximum number of characters that can be entered.
        //

        if ( fSignedIn )
        {
            strMinValue.Format( _T("%d"), dwMinIn );
            strMaxValue.Format( _T("%d"), dwMaxIn );
        } // if:  signed value
        else
        {
            strMinValue.Format( _T("%u"), dwMinIn );
            strMaxValue.Format( _T("%u"), dwMaxIn );
        } // else:  unsigned value
        cchMax = max( strMinValue.GetLength(), strMaxValue.GetLength() );
        SendMessage( hwndCtrl, EM_LIMITTEXT, cchMax, 0 );

        //
        //  Set the value into the control.
        //

        if ( fSignedIn )
        {
            LONG lValue = static_cast< LONG >( rdwValueInout );
            DDX_Text( pDXIn, nIDCIn, lValue );
        } // if:  signed value
        else
        {
            DDX_Text( pDXIn, nIDCIn, rdwValueInout );
        } // else:
    } // else:  setting data onto the dialog

} //*** DDX_Number

Generated on Wed Nov 13 2024 16:54:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/ExtObj.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • FileShareSample
  • File Share SampleEx

ExtObj.cpp File Reference

#include "stdafx.h"
#include "File Share SampleEx.h"
#include "ExtObj.h"
#include "ExtObjData.h"
#include "ResProp.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/ExtObj.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • FileShareSample
  • File Share SampleEx
Classes | Typedefs

ExtObj.h File Reference

#include <CluAdmEx.h>
#include "ExtObjID.h"
#include "ExtObjData.h"

Go to the source code of this file.

Classes

class CExtObject

Typedefs

typedef CList
< CBasePropertyPage
*, CBasePropertyPage * > 		CPageList

Typedef Documentation

typedef CList< CBasePropertyPage *, CBasePropertyPage * > CPageList

Definition at line 42 of file ExtObj.h.

Generated on Wed Nov 13 2024 16:54:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/ExtObjData.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • FileShareSample
  • File Share SampleEx
Defines

ExtObjData.cpp File Reference

#include "stdafx.h"
#include "File Share SampleEx.h"
#include "ExtObjData.h"
#include "resprop.h"
#include "resource.h"

Go to the source code of this file.

Defines

#define | ALL_RESOURCES_MENU_BASE_ID 40
#define | ALL_RESOURCES_MENU_ID_1 (ALL_RESOURCES_MENU_BASE_ID + 1)
#define | ALL_RESTYPES_MENU_BASE_ID 60
#define | ALL_RESTYPES_MENU_ID_1 (ALL_RESTYPES_MENU_BASE_ID + 1)
#define | CLUSTER_MENU_BASE_ID 0
#define | CLUSTER_MENU_ID_1 (CLUSTER_MENU_BASE_ID + 1)
#define | GROUP_MENU_BASE_ID 20
#define | GROUP_MENU_ID_1 (GROUP_MENU_BASE_ID + 1)
#define | NETINTERFACE_MENU_BASE_ID 80
#define | NETINTERFACE_MENU_ID_1 (NETINTERFACE_MENU_BASE_ID + 1)
#define | NETWORK_MENU_BASE_ID 70
#define | NETWORK_MENU_ID_1 (NETWORK_MENU_BASE_ID + 1)
#define | NODE_MENU_BASE_ID 10
#define | NODE_MENU_ID_1 (NODE_MENU_BASE_ID + 1)
#define | RESOURCE_MENU_BASE_ID 30
#define | RESOURCE_MENU_ID_1 (RESOURCE_MENU_BASE_ID + 1)
#define | RESTYPE_MENU_BASE_ID 50
#define | RESTYPE_MENU_ID_1 (RESTYPE_MENU_BASE_ID + 1)

Define Documentation

#define ALL_RESOURCES_MENU_BASE_ID 40

Definition at line 50 of file ExtObjData.cpp.

#define ALL_RESOURCES_MENU_ID_1 (ALL_RESOURCES_MENU_BASE_ID + 1)

Definition at line 51 of file ExtObjData.cpp.

#define ALL_RESTYPES_MENU_BASE_ID 60

Definition at line 56 of file ExtObjData.cpp.

#define ALL_RESTYPES_MENU_ID_1 (ALL_RESTYPES_MENU_BASE_ID + 1)

Definition at line 57 of file ExtObjData.cpp.

#define CLUSTER_MENU_BASE_ID 0

Definition at line 38 of file ExtObjData.cpp.

#define CLUSTER_MENU_ID_1 (CLUSTER_MENU_BASE_ID + 1)

Definition at line 39 of file ExtObjData.cpp.

#define GROUP_MENU_BASE_ID 20

Definition at line 44 of file ExtObjData.cpp.

#define GROUP_MENU_ID_1 (GROUP_MENU_BASE_ID + 1)

Definition at line 45 of file ExtObjData.cpp.

#define NETINTERFACE_MENU_BASE_ID 80

Definition at line 62 of file ExtObjData.cpp.

#define NETINTERFACE_MENU_ID_1 (NETINTERFACE_MENU_BASE_ID + 1)

Definition at line 63 of file ExtObjData.cpp.

#define NETWORK_MENU_BASE_ID 70

Definition at line 59 of file ExtObjData.cpp.

#define NETWORK_MENU_ID_1 (NETWORK_MENU_BASE_ID + 1)

Definition at line 60 of file ExtObjData.cpp.

#define NODE_MENU_BASE_ID 10

Definition at line 41 of file ExtObjData.cpp.

#define NODE_MENU_ID_1 (NODE_MENU_BASE_ID + 1)

Definition at line 42 of file ExtObjData.cpp.

#define RESOURCE_MENU_BASE_ID 30

Definition at line 47 of file ExtObjData.cpp.

#define RESOURCE_MENU_ID_1 (RESOURCE_MENU_BASE_ID + 1)

Definition at line 48 of file ExtObjData.cpp.

#define RESTYPE_MENU_BASE_ID 50

Definition at line 53 of file ExtObjData.cpp.

#define RESTYPE_MENU_ID_1 (RESTYPE_MENU_BASE_ID + 1)

Definition at line 54 of file ExtObjData.cpp.

Generated on Wed Nov 13 2024 16:54:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/ExtObjData.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • FileShareSample
  • File Share SampleEx
Classes

ExtObjData.h File Reference

#include <CluAdmEx.h>

Go to the source code of this file.

Classes

class | CClusterData
class | CGroupData
class | CNetInterfaceData
class | CNetworkData
class | CNodeData
class | CObjData
class | CResData
class | CResTypeData
Generated on Wed Nov 13 2024 16:54:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/ExtObjID.idl File Reference

  • WinBase
  • Cluster
  • Win2003
  • FileShareSample
  • File Share SampleEx
Classes | Namespaces | Functions

ExtObjID.idl File Reference

Go to the source code of this file.

Classes

class | CLUADMEXLib::CoFileShareSampleEx

Namespaces

namespace | CLUADMEXLib

Functions

CLUADMEXLib::importlib ("stdole2.tlb")
Generated on Wed Nov 13 2024 16:54:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/File Share SampleEx.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • FileShareSample
  • File Share SampleEx
Classes | Functions | Variables

File Share SampleEx.cpp File Reference

#include "stdafx.h"
#include <initguid.h>
#include <CluAdmEx.h>
#include "File Share SampleEx.h"
#include "ExtObj.h"
#include "BasePage.h"
#include "RegExt.h"

Go to the source code of this file.

Classes

class | CFileShareSampleApp

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsidIn, REFIID riidIn, LPVOID *ppvOut)
STDAPI | DllRegisterCluAdminExtension (HCLUSTER hClusterIn)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterCluAdminExtension (HCLUSTER hClusterIn)
STDAPI | DllUnregisterServer (void)
void | FormatError (CString &rstrErrorInout, DWORD dwErrorIn)

Variables

CComModule | _Module
CFileShareSampleApp theApp

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 247 of file File Share SampleEx.cpp.

{
    AFX_MANAGE_STATE( AfxGetStaticModuleState() );

    return ( AfxDllCanUnloadNow() && _Module.GetLockCount() == 0 ) ? S_OK : S_FALSE;

}  //*** DllCanUnloadNow

STDAPI DllGetClassObject | ( | REFCLSID | rclsidIn,
 |  | REFIID | riidIn,
 |  | LPVOID * | ppvOut
 | ) |  |

Definition at line 277 of file File Share SampleEx.cpp.

{
    return _Module.GetClassObject( rclsidIn, riidIn, ppvOut );

}  //*** DllGetClassObject

STDAPI DllRegisterCluAdminExtension ( HCLUSTER hClusterIn )

Definition at line 369 of file File Share SampleEx.cpp.

{
    DWORD       sc = ERROR_SUCCESS;
    DWORD       scTemp = ERROR_SUCCESS;
    LPCWSTR     pwszResTypes = g_wszResourceTypeNames;

    AFX_MANAGE_STATE( AfxGetStaticModuleState() );

    //
    // Register to extend our resource type(s).
    //

    while ( *pwszResTypes != L'\0' )
    {
        wprintf( L"  %s\n", pwszResTypes );
        scTemp = RegisterCluAdminResourceTypeExtension(
                      hClusterIn
                    , pwszResTypes
                    , &CLSID_CoFileShareSampleEx
                    );
        if ( scTemp != ERROR_SUCCESS )
        {
            sc = scTemp;
        } // if:  error registering the extension

        pwszResTypes += lstrlenW( pwszResTypes ) + 1;
    }  // while:  more resource types

    if ( sc != ERROR_SUCCESS )
    {
        goto Cleanup;
    } // if:

Cleanup:

    return HRESULT_FROM_WIN32( sc );

}  //*** DllRegisterCluAdminExtension

STDAPI DllRegisterServer ( void )

Definition at line 307 of file File Share SampleEx.cpp.

{
    HRESULT hr = S_OK;

    //
    //  Registers object, typelib and all interfaces in typelib
    //

    hr = _Module.RegisterServer( FALSE /*bRegTypeLib*/ );

    return hr;

}  //*** DllRegisterServer

STDAPI DllUnregisterCluAdminExtension ( HCLUSTER hClusterIn )

Definition at line 428 of file File Share SampleEx.cpp.

{
    DWORD       sc = ERROR_SUCCESS;
    DWORD       scTemp = ERROR_SUCCESS;
    LPCWSTR     pwszResTypes = g_wszResourceTypeNames;

    AFX_MANAGE_STATE( AfxGetStaticModuleState() );

    //
    // Unregister to extend our resource type(s).
    //

    while ( *pwszResTypes != L'\0' )
    {
        wprintf( L"  %s\n", pwszResTypes );
        scTemp = UnregisterCluAdminResourceTypeExtension(
                      hClusterIn
                    , pwszResTypes
                    , &CLSID_CoFileShareSampleEx
                    );
        if ( scTemp != ERROR_SUCCESS )
        {
            sc = scTemp;
        } // if:  error unregistering the extension

        pwszResTypes += lstrlenW( pwszResTypes ) + 1;
    }  // while:  more resource types

    if ( sc != ERROR_SUCCESS )
    {
        goto Cleanup;
    } // if:

Cleanup:

    return HRESULT_FROM_WIN32( sc );

}  //*** DllUnregisterCluAdminExtension

STDAPI DllUnregisterServer ( void )

Definition at line 341 of file File Share SampleEx.cpp.

{
    HRESULT hr = S_OK;

    hr = _Module.UnregisterServer();

    return hr;

}  //*** DllUnregisterServer

void FormatError | ( | CString & | rstrErrorInout,
 |  | DWORD | dwErrorIn
 | ) |  |

Definition at line 161 of file File Share SampleEx.cpp.

{
    DWORD   cch;
    TCHAR   szError[ 512 ];

    //
    // Format the NT status code from CLUSAPI.  This is necessary
    // for the cases where cluster messages haven't been added to
    // the system message file yet.
    //

    cch = FormatMessage(
                      FORMAT_MESSAGE_FROM_HMODULE | FORMAT_MESSAGE_IGNORE_INSERTS
                    , ::GetModuleHandle( _T( "CLUSAPI.DLL" ) )
                    , dwErrorIn
                    , MAKELANGID( LANG_NEUTRAL, SUBLANG_NEUTRAL )
                    , szError
                    , RTL_NUMBER_OF( szError )
                    , 0
                    );
    if ( cch == 0 )
    {
        cch = FormatMessage(
                          FORMAT_MESSAGE_FROM_SYSTEM
                        , NULL
                        , dwErrorIn
                        , MAKELANGID( LANG_NEUTRAL, SUBLANG_NEUTRAL )
                        , szError
                        , RTL_NUMBER_OF( szError )
                        , 0
                        );
        if ( cch == 0 )
        {
            //
            // Format the NT status code from NTDLL since this hasn't been
            // integrated into the system yet.
            //

            cch = FormatMessage(
                              FORMAT_MESSAGE_FROM_HMODULE | FORMAT_MESSAGE_IGNORE_INSERTS
                            , ::GetModuleHandle( _T( "NTDLL.DLL" ) )
                            , dwErrorIn
                            , MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL)
                            , szError
                            , RTL_NUMBER_OF( szError )
                            , 0
                            );
        }  // if:  error formatting status code from system
    }  // if:  error formatting status code from ClusApi

    if ( cch > 0 )
    {
        rstrErrorInout = szError;
    }  // if:  no error
    else
    {
        TRACE( _T( "FormatError() - Error 0x%08.8x formatting string for error code 0x%08.8x\n" ), GetLastError(), dwErrorIn );
        rstrErrorInout.Format( _T( "Error 0x%08.8x" ), dwErrorIn );
    }  // else:  error formatting the message

}  //*** FormatError

Variable Documentation

CComModule _Module

Definition at line 39 of file File Share SampleEx.cpp.

CFileShareSampleApp theApp

Definition at line 91 of file File Share SampleEx.cpp.

Generated on Wed Nov 13 2024 16:55:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/File Share SampleEx.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • FileShareSample
  • File Share SampleEx
Defines | Functions

File Share SampleEx.h File Reference

#include "resource.h"
#include "resource.h"

Go to the source code of this file.

Defines

#define | REGPARAM_FILESHARESAMPLE_MAXUSERS L"MaxUsers"
#define | REGPARAM_FILESHARESAMPLE_PATH L"Path"
#define | REGPARAM_FILESHARESAMPLE_REMARK L"Remark"
#define | REGPARAM_FILESHARESAMPLE_SHARENAME L"ShareName"

Functions

void | FormatError (CString &rstrErrorInout, DWORD dwErrorIn)

Define Documentation

#define REGPARAM_FILESHARESAMPLE_MAXUSERS L"MaxUsers"

Definition at line 42 of file File Share SampleEx.h.

#define REGPARAM_FILESHARESAMPLE_PATH L"Path"

Definition at line 40 of file File Share SampleEx.h.

#define REGPARAM_FILESHARESAMPLE_REMARK L"Remark"

Definition at line 41 of file File Share SampleEx.h.

#define REGPARAM_FILESHARESAMPLE_SHARENAME L"ShareName"

Definition at line 39 of file File Share SampleEx.h.

Function Documentation

void FormatError | ( | CString & | rstrErrorInout,
 |  | DWORD | dwErrorIn
 | ) |  |

Definition at line 161 of file ClipBook ServerEx.cpp.

{
    DWORD   cch;
    TCHAR   szError[ 512 ];

    //
    // Format the NT status code from CLUSAPI.  This is necessary
    // for the cases where cluster messages haven't been added to
    // the system message file yet.
    //

    cch = FormatMessage(
                      FORMAT_MESSAGE_FROM_HMODULE | FORMAT_MESSAGE_IGNORE_INSERTS
                    , ::GetModuleHandle( _T( "CLUSAPI.DLL" ) )
                    , dwErrorIn
                    , MAKELANGID( LANG_NEUTRAL, SUBLANG_NEUTRAL )
                    , szError
                    , RTL_NUMBER_OF( szError )
                    , 0
                    );
    if ( cch == 0 )
    {
        cch = FormatMessage(
                          FORMAT_MESSAGE_FROM_SYSTEM
                        , NULL
                        , dwErrorIn
                        , MAKELANGID( LANG_NEUTRAL, SUBLANG_NEUTRAL )
                        , szError
                        , RTL_NUMBER_OF( szError )
                        , 0
                        );
        if ( cch == 0 )
        {
            //
            // Format the NT status code from NTDLL since this hasn't been
            // integrated into the system yet.
            //

            cch = FormatMessage(
                              FORMAT_MESSAGE_FROM_HMODULE | FORMAT_MESSAGE_IGNORE_INSERTS
                            , ::GetModuleHandle( _T( "NTDLL.DLL" ) )
                            , dwErrorIn
                            , MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL)
                            , szError
                            , RTL_NUMBER_OF( szError )
                            , 0
                            );
        }  // if:  error formatting status code from system
    }  // if:  error formatting status code from ClusApi

    if ( cch > 0 )
    {
        rstrErrorInout = szError;
    }  // if:  no error
    else
    {
        TRACE( _T( "FormatError() - Error 0x%08.8x formatting string for error code 0x%08.8x\n" ), GetLastError(), dwErrorIn );
        rstrErrorInout.Format( _T( "Error 0x%08.8x" ), dwErrorIn );
    }  // else:  error formatting the message

}  //*** FormatError

Generated on Wed Nov 13 2024 16:55:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/PropList.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • FileShareSample
  • File Share SampleEx
Classes | Functions | Variables

PropList.cpp File Reference

#include "stdafx.h"
#include "PropList.h"
#include <StrSafe.h>

Go to the source code of this file.

Classes

class | CMemoryException

Functions

int | BSTRCompareW (BSTR bstrString1In, BSTR bstrString2In)
int | IBSTRCompareW (BSTR bstrString1In, BSTR bstrString2In)
int | IStringCompareW (LPCWSTR pcwszString1In, LPCWSTR pcwszString2In)
int | IStringCompareW (LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)
int | NBSTRCompareW (BSTR bstrString1In, BSTR bstrString2In)
int | NIBSTRCompareW (BSTR bstrString1In, BSTR bstrString2In)
int | NIStringCompareW (LPCWSTR pcwszString1In, LPCWSTR pcwszString2In, size_t cchIn)
int | NIStringCompareW (LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)
int | NStringCompareW (LPCWSTR pcwszString1In, LPCWSTR pcwszString2In, size_t cchIn)
int | NStringCompareW (LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)
int | StringCompareW (LPCWSTR pcwszString1In, LPCWSTR pcwszString2In)
int | StringCompareW (LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)
int | WrapCompareString (BOOL fCaseSensitive, LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)

Variables

const int | BUFFER_GROWTH_FACTOR = 256

Function Documentation

int BSTRCompareW | ( | BSTR | bstrString1In,
 |  | BSTR | bstrString2In
 | ) |  |

Definition at line 127 of file PropList.cpp.

{
    return WrapCompareString(
                  TRUE
                , static_cast< LPCWSTR >( bstrString1In )
                , SysStringLen( bstrString1In )
                , static_cast< LPCWSTR >( bstrString2In )
                , SysStringLen( bstrString2In )
                );
} //*** BSTRCompareW

int IBSTRCompareW | ( | BSTR | bstrString1In,
 |  | BSTR | bstrString2In
 | ) |  |

Definition at line 112 of file PropList.cpp.

{
    return WrapCompareString(
                  FALSE
                , static_cast< LPCWSTR >( bstrString1In )
                , SysStringLen( bstrString1In )
                , static_cast< LPCWSTR >( bstrString2In )
                , SysStringLen( bstrString2In )
                );
} //*** IBSTRCompareW

int IStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | LPCWSTR | pcwszString2In
 | ) |  |

Definition at line 142 of file PropList.cpp.

{
    return WrapCompareString(
                  FALSE
                , pcwszString1In
                , static_cast< size_t >( -1 )
                , pcwszString2In
                , static_cast< size_t >( -1 )
            );
} //*** IStringCompareW

int IStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 172 of file PropList.cpp.

{
    return WrapCompareString(
                  FALSE
                , pcwszString1In
                , cch1In
                , pcwszString2In
                , cch2In
                );
} //*** IStringCompareW

int NBSTRCompareW | ( | BSTR | bstrString1In,
 |  | BSTR | bstrString2In
 | ) |  |

Definition at line 230 of file PropList.cpp.

{
    size_t cchMin;

    cchMin = min( SysStringLen( bstrString1In ), SysStringLen( bstrString2In ) );

    return WrapCompareString(
                  TRUE
                , static_cast< LPCWSTR >( bstrString1In )
                , cchMin
                , static_cast< LPCWSTR >( bstrString2In )
                , cchMin
                );
} //*** NBSTRCompareW

int NIBSTRCompareW | ( | BSTR | bstrString1In,
 |  | BSTR | bstrString2In
 | ) |  |

Definition at line 211 of file PropList.cpp.

{
    size_t cchMin;

    cchMin = min( SysStringLen( bstrString1In ), SysStringLen( bstrString2In ) );

    return WrapCompareString(
                  FALSE
                , static_cast< LPCWSTR >( bstrString1In )
                , cchMin
                , static_cast< LPCWSTR >( bstrString2In )
                , cchMin
                );
} //*** NIBSTRCompareW

int NIStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cchIn
 | ) |  |

Definition at line 249 of file PropList.cpp.

{
    return WrapCompareString(
                  FALSE
                , pcwszString1In
                , cchIn
                , pcwszString2In
                , cchIn
                );
} //*** NIStringCompareW

int NIStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 281 of file PropList.cpp.

{
    return WrapCompareString(
                  FALSE
                , pcwszString1In
                , min( cch1In, cch2In )
                , pcwszString2In
                , min( cch1In, cch2In )
                );
} //*** NIStringCompareW

int NStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cchIn
 | ) |  |

Definition at line 265 of file PropList.cpp.

{
    return WrapCompareString(
                  TRUE
                , pcwszString1In
                , cchIn
                , pcwszString2In
                , cchIn
                );
} //*** NIStringCompareW

int NStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 298 of file PropList.cpp.

{
    return WrapCompareString(
                  TRUE
                , pcwszString1In
                , min( cch1In, cch2In )
                , pcwszString2In
                , min( cch1In, cch2In )
                );
} //*** NStringCompareW

int StringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | LPCWSTR | pcwszString2In
 | ) |  |

Definition at line 157 of file PropList.cpp.

{
    return WrapCompareString(
                  TRUE
                , pcwszString1In
                , static_cast< size_t >( -1 )
                , pcwszString2In
                , static_cast< size_t >( -1 )
                );
} //*** StringCompareW

int StringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 189 of file PropList.cpp.

{
    return WrapCompareString(
                  TRUE
                , pcwszString1In
                , cch1In
                , pcwszString2In
                , cch2In
                );
} //*** StringCompareW

int WrapCompareString | ( | BOOL | fCaseSensitive,
 |  | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 84 of file PropList.cpp.

{
    int nRet;

    nRet = CompareStringW(
              LOCALE_SYSTEM_DEFAULT
            , fCaseSensitive ? 0 : NORM_IGNORECASE
            , pcwszString1In
            , static_cast< DWORD >( cch1In )
            , pcwszString2In
            , static_cast< DWORD >( cch2In )
            );

    return nRet - CSTR_EQUAL; // CSTR_LT < CSTR_EQUAL < CSTR_GT

} // *** WrapCompareString

Variable Documentation

const int BUFFER_GROWTH_FACTOR = 256

Definition at line 46 of file PropList.cpp.

Generated on Wed Nov 13 2024 16:54:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/PropList.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • FileShareSample
  • File Share SampleEx
Classes | Defines | Functions

PropList.h File Reference

#include <windows.h>
#include <clusapi.h>
#include <crtdbg.h>

Go to the source code of this file.

Classes

class | CClusPropList
class | CClusPropValueList

Defines

#define | ASSERT _ASSERTE

Functions

int | BSTRCompareW (BSTR bstrString1In, BSTR bstrString2In)
int | IBSTRCompareW (BSTR bstrString1In, BSTR bstrString2In)
int | IStringCompareW (LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)
int | IStringCompareW (LPCWSTR pcwszString1In, LPCWSTR pcwszString2In)
int | NBSTRCompareW (BSTR bstrString1In, BSTR bstrString2In)
int | NIBSTRCompareW (BSTR bstrString1In, BSTR bstrString2In)
int | NIStringCompareW (LPCWSTR pcwszString1In, LPCWSTR pcwszString2In, size_t cchIn)
int | NIStringCompareW (LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)
int | NStringCompareW (LPCWSTR pcwszString1In, LPCWSTR pcwszString2In, size_t cchIn)
int | NStringCompareW (LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)
int | StringCompareW (LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)
int | StringCompareW (LPCWSTR pcwszString1In, LPCWSTR pcwszString2In)

Define Documentation

#define ASSERT _ASSERTE

Definition at line 49 of file PropList.h.

Function Documentation

int BSTRCompareW | ( | BSTR | bstrString1In,
 |  | BSTR | bstrString2In
 | ) |  |

Definition at line 100 of file StringUtils.cpp.

{
    return WrapCompareString(
                  TRUE
                , static_cast< LPCWSTR >( bstrString1In )
                , SysStringLen( bstrString1In )
                , static_cast< LPCWSTR >( bstrString2In )
                , SysStringLen( bstrString2In )
                );
} //*** BSTRCompareW

int IBSTRCompareW | ( | BSTR | bstrString1In,
 |  | BSTR | bstrString2In
 | ) |  |

Definition at line 85 of file StringUtils.cpp.

{
    return WrapCompareString(
                  FALSE
                , static_cast< LPCWSTR >( bstrString1In )
                , SysStringLen( bstrString1In )
                , static_cast< LPCWSTR >( bstrString2In )
                , SysStringLen( bstrString2In )
                );
} //*** IBSTRCompareW

int IStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 145 of file StringUtils.cpp.

{
    return WrapCompareString(
                  FALSE
                , pcwszString1In
                , cch1In
                , pcwszString2In
                , cch2In
                );
} //*** IStringCompareW

int IStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | LPCWSTR | pcwszString2In
 | ) |  |

Definition at line 115 of file StringUtils.cpp.

{
    return WrapCompareString(
                  FALSE
                , pcwszString1In
                , static_cast< size_t >( -1 )
                , pcwszString2In
                , static_cast< size_t >( -1 )
            );
} //*** IStringCompareW

int NBSTRCompareW | ( | BSTR | bstrString1In,
 |  | BSTR | bstrString2In
 | ) |  |

Definition at line 203 of file StringUtils.cpp.

{
    size_t cchMin;

    cchMin = min( SysStringLen( bstrString1In ), SysStringLen( bstrString2In ) );

    return WrapCompareString(
                  TRUE
                , static_cast< LPCWSTR >( bstrString1In )
                , cchMin
                , static_cast< LPCWSTR >( bstrString2In )
                , cchMin
                );
} //*** NBSTRCompareW

int NIBSTRCompareW | ( | BSTR | bstrString1In,
 |  | BSTR | bstrString2In
 | ) |  |

Definition at line 184 of file StringUtils.cpp.

{
    size_t cchMin;

    cchMin = min( SysStringLen( bstrString1In ), SysStringLen( bstrString2In ) );

    return WrapCompareString(
                  FALSE
                , static_cast< LPCWSTR >( bstrString1In )
                , cchMin
                , static_cast< LPCWSTR >( bstrString2In )
                , cchMin
                );
} //*** NIBSTRCompareW

int NIStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cchIn
 | ) |  |

Definition at line 222 of file StringUtils.cpp.

{
    return WrapCompareString(
                  FALSE
                , pcwszString1In
                , cchIn
                , pcwszString2In
                , cchIn
                );
} //*** NIStringCompareW

int NIStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 254 of file StringUtils.cpp.

{
    return WrapCompareString(
                  FALSE
                , pcwszString1In
                , min( cch1In, cch2In )
                , pcwszString2In
                , min( cch1In, cch2In )
                );
} //*** NIStringCompareW

int NStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cchIn
 | ) |  |

Definition at line 238 of file StringUtils.cpp.

{
    return WrapCompareString(
                  TRUE
                , pcwszString1In
                , cchIn
                , pcwszString2In
                , cchIn
                );
} //*** NIStringCompareW

int NStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 271 of file StringUtils.cpp.

{
    return WrapCompareString(
                  TRUE
                , pcwszString1In
                , min( cch1In, cch2In )
                , pcwszString2In
                , min( cch1In, cch2In )
                );
} //*** NStringCompareW

int StringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 162 of file StringUtils.cpp.

{
    return WrapCompareString(
                  TRUE
                , pcwszString1In
                , cch1In
                , pcwszString2In
                , cch2In
                );
} //*** StringCompareW

int StringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | LPCWSTR | pcwszString2In
 | ) |  |

Definition at line 130 of file StringUtils.cpp.

{
    return WrapCompareString(
                  TRUE
                , pcwszString1In
                , static_cast< size_t >( -1 )
                , pcwszString2In
                , static_cast< size_t >( -1 )
                );
} //*** StringCompareW

Generated on Wed Nov 13 2024 16:54:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/RegExt.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • FileShareSample
  • File Share SampleEx
Functions | Variables

RegExt.cpp File Reference

#include "stdafx.h"
#include <ole2.h>
#include <StrSafe.h>

Go to the source code of this file.

Functions

DWORD | RegisterCluAdminAllGroupsExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | RegisterCluAdminAllNetInterfacesExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | RegisterCluAdminAllNetworksExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | RegisterCluAdminAllNodesExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | RegisterCluAdminAllResourcesExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | RegisterCluAdminAllResourceTypesExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | RegisterCluAdminClusterExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | RegisterCluAdminResourceTypeExtension (HCLUSTER hClusterIn, LPCWSTR pwszResourceTypeIn, const CLSID *pClsidIn)
DWORD | UnregisterCluAdminAllGroupsExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | UnregisterCluAdminAllNetInterfacesExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | UnregisterCluAdminAllNetworksExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | UnregisterCluAdminAllNodesExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | UnregisterCluAdminAllResourcesExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | UnregisterCluAdminAllResourceTypesExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | UnregisterCluAdminClusterExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | UnregisterCluAdminResourceTypeExtension (HCLUSTER hClusterIn, LPCWSTR pwszResourceTypeIn, const CLSID *pClsidIn)

Variables

const LPCWSTR | REG_VALUE_ADMIN_EXTENSIONS = "AdminExtensions"

Function Documentation

DWORD RegisterCluAdminAllGroupsExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 175 of file RegExt.cpp.

{
    DWORD sc = ERROR_SUCCESS;

    sc = RegisterAnyCluAdminExtension( hClusterIn, L"Groups", pClsidIn );

    return sc;

}  //*** RegisterCluAdminAllGroupsExtension

DWORD RegisterCluAdminAllNetInterfacesExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 307 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;

    sc = RegisterAnyCluAdminExtension( hClusterIn, L"NetworkInterfaces", pClsidIn );

    return sc;

}  //*** RegisterCluAdminAllNetInterfacesExtension

DWORD RegisterCluAdminAllNetworksExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 274 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;

    sc = RegisterAnyCluAdminExtension( hClusterIn, L"Networks", pClsidIn );

    return sc;

}  //*** RegisterCluAdminAllNetworksExtension

DWORD RegisterCluAdminAllNodesExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 142 of file RegExt.cpp.

{
    DWORD sc = ERROR_SUCCESS;

    sc = RegisterAnyCluAdminExtension( hClusterIn, L"Nodes", pClsidIn );

    return sc;

}  //*** RegisterCluAdminAllNodesExtension

DWORD RegisterCluAdminAllResourcesExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 208 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;

    sc = RegisterAnyCluAdminExtension( hClusterIn, L"Resources", pClsidIn );

    return sc;

}  //*** RegisterCluAdminAllResourcesExtension

DWORD RegisterCluAdminAllResourceTypesExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 241 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;

    sc = RegisterAnyCluAdminExtension( hClusterIn, L"ResourceTypes", pClsidIn );

    return sc;

}  //*** RegisterCluAdminAllResourceTypesExtension

DWORD RegisterCluAdminClusterExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 90 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;
    HKEY    hKey = NULL;

    //
    //  Get the cluster registry key.
    //

    hKey = GetClusterKey( hClusterIn, KEY_ALL_ACCESS );
    if ( hKey == NULL )
    {
        sc = GetLastError();
    } // if: error getting cluster key
    else
    {
        //
        //  Register the extension.
        //

        sc = RegisterAnyCluAdminExtension( hKey, pClsidIn );

        ClusterRegCloseKey( hKey );
    }  // else:  GetClusterKey succeeded

    return sc;

}  //*** RegisterCluAdminClusterExtension

DWORD RegisterCluAdminResourceTypeExtension | ( | HCLUSTER | hClusterIn,
 |  | LPCWSTR | pwszResourceTypeIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 348 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;
    HKEY    hKey = NULL;

    //
    // Get the resource type registry key.
    //

    hKey = GetClusterResourceTypeKey( hClusterIn, pwszResourceTypeIn, KEY_ALL_ACCESS );
    if ( hKey == NULL )
    {
        sc = GetLastError();
        if ( sc == ERROR_FILE_NOT_FOUND )
        {
            //
            //  If we failed to open the key with 'file not found' that means that
            //  the key doesn't exist.  We'll return a 'res type not found' error,
            //  which is more accurate.
            //

            sc = ERROR_CLUSTER_RESOURCE_TYPE_NOT_FOUND;
        } // if:
    } // if: error getting resource type key
    else
    {
        //
        //  Register the extension.
        //

        sc = RegisterAnyCluAdminExtension( hKey, pClsidIn );

        ClusterRegCloseKey( hKey );
    }  // else:  GetClusterResourceTypeKey succeeded

    return sc;

}  //*** RegisterCluAdminResourceTypeExtension

DWORD UnregisterCluAdminAllGroupsExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 496 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;

    sc = UnregisterAnyCluAdminExtension( hClusterIn, L"Groups", pClsidIn );

    return sc;

}  //*** UnregisterCluAdminAllGroupsExtension

DWORD UnregisterCluAdminAllNetInterfacesExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 628 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;

    sc = UnregisterAnyCluAdminExtension( hClusterIn, L"NetworkInterfaces", pClsidIn );

    return sc;

}  //*** UnregisterCluAdminAllNetInterfacesExtension

DWORD UnregisterCluAdminAllNetworksExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 595 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;

    sc = UnregisterAnyCluAdminExtension( hClusterIn, L"Networks", pClsidIn );

    return sc;

}  //*** UnregisterCluAdminAllNetworksExtension

DWORD UnregisterCluAdminAllNodesExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 463 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;

    sc = UnregisterAnyCluAdminExtension( hClusterIn, L"Nodes", pClsidIn );

    return sc;

}  //*** UnregisterCluAdminAllNodesExtension

DWORD UnregisterCluAdminAllResourcesExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 529 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;

    sc = UnregisterAnyCluAdminExtension( hClusterIn, L"Resources", pClsidIn );

    return sc;

}  //*** UnregisterCluAdminAllResourcesExtension

DWORD UnregisterCluAdminAllResourceTypesExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 562 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;

    sc = UnregisterAnyCluAdminExtension( hClusterIn, L"ResourceTypes", pClsidIn );

    return sc;

}  //*** UnregisterCluAdminAllResourceTypesExtension

DWORD UnregisterCluAdminClusterExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 411 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;
    HKEY    hKey = NULL;

    //
    //  Get the cluster registry key.
    //

    hKey = GetClusterKey(hClusterIn, KEY_ALL_ACCESS);
    if ( hKey == NULL )
    {
        sc = GetLastError();
    } // if: error getting cluster key
    else
    {
        //
        //  Unregister the extension.
        //

        sc = UnregisterAnyCluAdminExtension( hKey, pClsidIn );

        ClusterRegCloseKey( hKey );
    }  // else:  GetClusterKey succeeded

    return sc;

}  //*** UnregisterCluAdminClusterExtension

DWORD UnregisterCluAdminResourceTypeExtension | ( | HCLUSTER | hClusterIn,
 |  | LPCWSTR | pwszResourceTypeIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 663 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;
    HKEY    hKey = NULL;

    //
    //  Get the resource type registry key.
    //

    hKey = GetClusterResourceTypeKey( hClusterIn, pwszResourceTypeIn, KEY_ALL_ACCESS );
    if ( hKey == NULL )
    {
        sc = GetLastError();
        if ( sc == ERROR_FILE_NOT_FOUND )
        {
            //
            //  If we failed to open the key with 'file not found' that means that
            //  the key doesn't exist.  We'll return a 'res type not found' error,
            //  which is more accurate.
            //

            sc = ERROR_CLUSTER_RESOURCE_TYPE_NOT_FOUND;
        } // if:
    } // if: error getting resource type key
    else
    {
        //
        //  Unregister the extension.
        //

        sc = UnregisterAnyCluAdminExtension( hKey, pClsidIn );

        ClusterRegCloseKey( hKey );
    }  // else:  GetClusterResourceTypeKey succeeded

    return sc;

}  //*** UnregisterCluAdminResourceTypeExtension

Variable Documentation

const LPCWSTR REG_VALUE_ADMIN_EXTENSIONS = "AdminExtensions"

Definition at line 30 of file RegExt.cpp.

Generated on Wed Nov 13 2024 16:55:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/RegExt.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • FileShareSample
  • File Share SampleEx
Functions

RegExt.h File Reference

Go to the source code of this file.

Functions

DWORD | RegisterCluAdminAllGroupsExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | RegisterCluAdminAllNetInterfacesExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | RegisterCluAdminAllNetworksExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | RegisterCluAdminAllNodesExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | RegisterCluAdminAllResourcesExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | RegisterCluAdminAllResourceTypesExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | RegisterCluAdminClusterExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | RegisterCluAdminResourceTypeExtension (HCLUSTER hClusterIn, LPCWSTR pwszResourceTypeIn, const CLSID *pClsidIn)
DWORD | UnregisterCluAdminAllGroupsExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | UnregisterCluAdminAllNetInterfacesExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | UnregisterCluAdminAllNetworksExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | UnregisterCluAdminAllNodesExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | UnregisterCluAdminAllResourcesExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | UnregisterCluAdminAllResourceTypesExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | UnregisterCluAdminClusterExtension (HCLUSTER hClusterIn, const CLSID *pClsidIn)
DWORD | UnregisterCluAdminResourceTypeExtension (HCLUSTER hClusterIn, LPCWSTR pwszResourceTypeIn, const CLSID *pClsid)

Function Documentation

DWORD RegisterCluAdminAllGroupsExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 175 of file RegExt.cpp.

{
    DWORD sc = ERROR_SUCCESS;

    sc = RegisterAnyCluAdminExtension( hClusterIn, L"Groups", pClsidIn );

    return sc;

}  //*** RegisterCluAdminAllGroupsExtension

DWORD RegisterCluAdminAllNetInterfacesExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 307 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;

    sc = RegisterAnyCluAdminExtension( hClusterIn, L"NetworkInterfaces", pClsidIn );

    return sc;

}  //*** RegisterCluAdminAllNetInterfacesExtension

DWORD RegisterCluAdminAllNetworksExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 274 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;

    sc = RegisterAnyCluAdminExtension( hClusterIn, L"Networks", pClsidIn );

    return sc;

}  //*** RegisterCluAdminAllNetworksExtension

DWORD RegisterCluAdminAllNodesExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 142 of file RegExt.cpp.

{
    DWORD sc = ERROR_SUCCESS;

    sc = RegisterAnyCluAdminExtension( hClusterIn, L"Nodes", pClsidIn );

    return sc;

}  //*** RegisterCluAdminAllNodesExtension

DWORD RegisterCluAdminAllResourcesExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 208 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;

    sc = RegisterAnyCluAdminExtension( hClusterIn, L"Resources", pClsidIn );

    return sc;

}  //*** RegisterCluAdminAllResourcesExtension

DWORD RegisterCluAdminAllResourceTypesExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 241 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;

    sc = RegisterAnyCluAdminExtension( hClusterIn, L"ResourceTypes", pClsidIn );

    return sc;

}  //*** RegisterCluAdminAllResourceTypesExtension

DWORD RegisterCluAdminClusterExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 90 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;
    HKEY    hKey = NULL;

    //
    //  Get the cluster registry key.
    //

    hKey = GetClusterKey( hClusterIn, KEY_ALL_ACCESS );
    if ( hKey == NULL )
    {
        sc = GetLastError();
    } // if: error getting cluster key
    else
    {
        //
        //  Register the extension.
        //

        sc = RegisterAnyCluAdminExtension( hKey, pClsidIn );

        ClusterRegCloseKey( hKey );
    }  // else:  GetClusterKey succeeded

    return sc;

}  //*** RegisterCluAdminClusterExtension

DWORD RegisterCluAdminResourceTypeExtension | ( | HCLUSTER | hClusterIn,
 |  | LPCWSTR | pwszResourceTypeIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 348 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;
    HKEY    hKey = NULL;

    //
    // Get the resource type registry key.
    //

    hKey = GetClusterResourceTypeKey( hClusterIn, pwszResourceTypeIn, KEY_ALL_ACCESS );
    if ( hKey == NULL )
    {
        sc = GetLastError();
        if ( sc == ERROR_FILE_NOT_FOUND )
        {
            //
            //  If we failed to open the key with 'file not found' that means that
            //  the key doesn't exist.  We'll return a 'res type not found' error,
            //  which is more accurate.
            //

            sc = ERROR_CLUSTER_RESOURCE_TYPE_NOT_FOUND;
        } // if:
    } // if: error getting resource type key
    else
    {
        //
        //  Register the extension.
        //

        sc = RegisterAnyCluAdminExtension( hKey, pClsidIn );

        ClusterRegCloseKey( hKey );
    }  // else:  GetClusterResourceTypeKey succeeded

    return sc;

}  //*** RegisterCluAdminResourceTypeExtension

DWORD UnregisterCluAdminAllGroupsExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 496 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;

    sc = UnregisterAnyCluAdminExtension( hClusterIn, L"Groups", pClsidIn );

    return sc;

}  //*** UnregisterCluAdminAllGroupsExtension

DWORD UnregisterCluAdminAllNetInterfacesExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 628 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;

    sc = UnregisterAnyCluAdminExtension( hClusterIn, L"NetworkInterfaces", pClsidIn );

    return sc;

}  //*** UnregisterCluAdminAllNetInterfacesExtension

DWORD UnregisterCluAdminAllNetworksExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 595 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;

    sc = UnregisterAnyCluAdminExtension( hClusterIn, L"Networks", pClsidIn );

    return sc;

}  //*** UnregisterCluAdminAllNetworksExtension

DWORD UnregisterCluAdminAllNodesExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 463 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;

    sc = UnregisterAnyCluAdminExtension( hClusterIn, L"Nodes", pClsidIn );

    return sc;

}  //*** UnregisterCluAdminAllNodesExtension

DWORD UnregisterCluAdminAllResourcesExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 529 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;

    sc = UnregisterAnyCluAdminExtension( hClusterIn, L"Resources", pClsidIn );

    return sc;

}  //*** UnregisterCluAdminAllResourcesExtension

DWORD UnregisterCluAdminAllResourceTypesExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 562 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;

    sc = UnregisterAnyCluAdminExtension( hClusterIn, L"ResourceTypes", pClsidIn );

    return sc;

}  //*** UnregisterCluAdminAllResourceTypesExtension

DWORD UnregisterCluAdminClusterExtension | ( | HCLUSTER | hClusterIn,
 |  | const CLSID * | pClsidIn
 | ) |  |

Definition at line 411 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;
    HKEY    hKey = NULL;

    //
    //  Get the cluster registry key.
    //

    hKey = GetClusterKey(hClusterIn, KEY_ALL_ACCESS);
    if ( hKey == NULL )
    {
        sc = GetLastError();
    } // if: error getting cluster key
    else
    {
        //
        //  Unregister the extension.
        //

        sc = UnregisterAnyCluAdminExtension( hKey, pClsidIn );

        ClusterRegCloseKey( hKey );
    }  // else:  GetClusterKey succeeded

    return sc;

}  //*** UnregisterCluAdminClusterExtension

DWORD UnregisterCluAdminResourceTypeExtension | ( | HCLUSTER | hClusterIn,
 |  | LPCWSTR | pwszResourceTypeIn,
 |  | const CLSID * | pClsid
 | ) |  |

Definition at line 663 of file RegExt.cpp.

{
    DWORD   sc = ERROR_SUCCESS;
    HKEY    hKey = NULL;

    //
    //  Get the resource type registry key.
    //

    hKey = GetClusterResourceTypeKey( hClusterIn, pwszResourceTypeIn, KEY_ALL_ACCESS );
    if ( hKey == NULL )
    {
        sc = GetLastError();
        if ( sc == ERROR_FILE_NOT_FOUND )
        {
            //
            //  If we failed to open the key with 'file not found' that means that
            //  the key doesn't exist.  We'll return a 'res type not found' error,
            //  which is more accurate.
            //

            sc = ERROR_CLUSTER_RESOURCE_TYPE_NOT_FOUND;
        } // if:
    } // if: error getting resource type key
    else
    {
        //
        //  Unregister the extension.
        //

        sc = UnregisterAnyCluAdminExtension( hKey, pClsidIn );

        ClusterRegCloseKey( hKey );
    }  // else:  GetClusterResourceTypeKey succeeded

    return sc;

}  //*** UnregisterCluAdminResourceTypeExtension

Generated on Wed Nov 13 2024 16:55:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/resource.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • FileShareSample
  • File Share SampleEx
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDC_PP_FILESHARESAMPLE_MAXUSERS 1017
#define | IDC_PP_FILESHARESAMPLE_MAXUSERS_LABEL 1016
#define | IDC_PP_FILESHARESAMPLE_PATH 1013
#define | IDC_PP_FILESHARESAMPLE_PATH_LABEL 1012
#define | IDC_PP_FILESHARESAMPLE_REMARK 1015
#define | IDC_PP_FILESHARESAMPLE_REMARK_LABEL 1014
#define | IDC_PP_FILESHARESAMPLE_SHARENAME 1011
#define | IDC_PP_FILESHARESAMPLE_SHARENAME_LABEL 1010
#define | IDC_PP_ICON 1000
#define | IDC_PP_TITLE 1001
#define | IDD_PP_FILESHARESAMPLE_PARAMETERS 130
#define | IDD_WIZ_FILESHARESAMPLE_PARAMETERS 131
#define | IDS_ALLRESOURCES_MENU_ITEM_1 1140
#define | IDS_ALLRESOURCES_MENU_ITEM_1_DESC 1141
#define | IDS_ALLRESTYPES_MENU_ITEM_1 1160
#define | IDS_ALLRESTYPES_MENU_ITEM_1_DESC 1161
#define | IDS_APPLY_PARAM_CHANGES_ERROR 31200
#define | IDS_CLUADMEX_COMOBJ_DESC 31100
#define | IDS_CLUSTER_MENU_ITEM_1 1100
#define | IDS_CLUSTER_MENU_ITEM_1_DESC 1101
#define | IDS_ERROR_MSG_ID 31101
#define | IDS_ERROR_SETTING_PROPERTIES 31103
#define | IDS_ERROR_VALIDATING_PROPERTIES 31104
#define | IDS_GROUP_MENU_ITEM_1 1120
#define | IDS_GROUP_MENU_ITEM_1_DESC 1121
#define | IDS_NETINTERFACE_MENU_ITEM_1 1180
#define | IDS_NETINTERFACE_MENU_ITEM_1_DESC 1181
#define | IDS_NETWORK_MENU_ITEM_1 1170
#define | IDS_NETWORK_MENU_ITEM_1_DESC 1171
#define | IDS_NODE_MENU_ITEM_1 1110
#define | IDS_NODE_MENU_ITEM_1_DESC 1111
#define | IDS_REQUIRED_FIELD_EMPTY 31102
#define | IDS_RESOURCE_MENU_ITEM_CALL_ISALIVE 1130
#define | IDS_RESOURCE_MENU_ITEM_CALL_ISALIVE_DESC 1131
#define | IDS_RESTYPE_MENU_ITEM_1 1150
#define | IDS_RESTYPE_MENU_ITEM_1_DESC 1151

Define Documentation

#define IDC_PP_FILESHARESAMPLE_MAXUSERS 1017

Definition at line 16 of file resource.h.

#define IDC_PP_FILESHARESAMPLE_MAXUSERS_LABEL 1016

Definition at line 15 of file resource.h.

#define IDC_PP_FILESHARESAMPLE_PATH 1013

Definition at line 12 of file resource.h.

#define IDC_PP_FILESHARESAMPLE_PATH_LABEL 1012

Definition at line 11 of file resource.h.

#define IDC_PP_FILESHARESAMPLE_REMARK 1015

Definition at line 14 of file resource.h.

#define IDC_PP_FILESHARESAMPLE_REMARK_LABEL 1014

Definition at line 13 of file resource.h.

#define IDC_PP_FILESHARESAMPLE_SHARENAME 1011

Definition at line 10 of file resource.h.

#define IDC_PP_FILESHARESAMPLE_SHARENAME_LABEL 1010

Definition at line 9 of file resource.h.

#define IDC_PP_ICON 1000

Definition at line 7 of file resource.h.

#define IDC_PP_TITLE 1001

Definition at line 8 of file resource.h.

#define IDD_PP_FILESHARESAMPLE_PARAMETERS 130

Definition at line 5 of file resource.h.

#define IDD_WIZ_FILESHARESAMPLE_PARAMETERS 131

Definition at line 6 of file resource.h.

#define IDS_ALLRESOURCES_MENU_ITEM_1 1140

Definition at line 25 of file resource.h.

#define IDS_ALLRESOURCES_MENU_ITEM_1_DESC 1141

Definition at line 26 of file resource.h.

#define IDS_ALLRESTYPES_MENU_ITEM_1 1160

Definition at line 29 of file resource.h.

#define IDS_ALLRESTYPES_MENU_ITEM_1_DESC 1161

Definition at line 30 of file resource.h.

#define IDS_APPLY_PARAM_CHANGES_ERROR 31200

Definition at line 40 of file resource.h.

#define IDS_CLUADMEX_COMOBJ_DESC 31100

Definition at line 35 of file resource.h.

#define IDS_CLUSTER_MENU_ITEM_1 1100

Definition at line 17 of file resource.h.

#define IDS_CLUSTER_MENU_ITEM_1_DESC 1101

Definition at line 18 of file resource.h.

#define IDS_ERROR_MSG_ID 31101

Definition at line 36 of file resource.h.

#define IDS_ERROR_SETTING_PROPERTIES 31103

Definition at line 38 of file resource.h.

#define IDS_ERROR_VALIDATING_PROPERTIES 31104

Definition at line 39 of file resource.h.

#define IDS_GROUP_MENU_ITEM_1 1120

Definition at line 21 of file resource.h.

#define IDS_GROUP_MENU_ITEM_1_DESC 1121

Definition at line 22 of file resource.h.

#define IDS_NETINTERFACE_MENU_ITEM_1 1180

Definition at line 33 of file resource.h.

#define IDS_NETINTERFACE_MENU_ITEM_1_DESC 1181

Definition at line 34 of file resource.h.

#define IDS_NETWORK_MENU_ITEM_1 1170

Definition at line 31 of file resource.h.

#define IDS_NETWORK_MENU_ITEM_1_DESC 1171

Definition at line 32 of file resource.h.

#define IDS_NODE_MENU_ITEM_1 1110

Definition at line 19 of file resource.h.

#define IDS_NODE_MENU_ITEM_1_DESC 1111

Definition at line 20 of file resource.h.

#define IDS_REQUIRED_FIELD_EMPTY 31102

Definition at line 37 of file resource.h.

#define IDS_RESOURCE_MENU_ITEM_CALL_ISALIVE 1130

Definition at line 23 of file resource.h.

#define IDS_RESOURCE_MENU_ITEM_CALL_ISALIVE_DESC 1131

Definition at line 24 of file resource.h.

#define IDS_RESTYPE_MENU_ITEM_1 1150

Definition at line 27 of file resource.h.

#define IDS_RESTYPE_MENU_ITEM_1_DESC 1151

Definition at line 28 of file resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/ResProp.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • FileShareSample
  • File Share SampleEx

ResProp.cpp File Reference

#include "stdafx.h"
#include "File Share SampleEx.h"
#include "ResProp.h"
#include "ExtObj.h"
#include "DDxDDv.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:55:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/ResProp.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • FileShareSample
  • File Share SampleEx
Classes

ResProp.h File Reference

#include "BasePage.h"
#include "PropList.h"

Go to the source code of this file.

Classes

class CFileShareSampleParamsPage
Generated on Wed Nov 13 2024 16:55:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/StdAfx.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • FileShareSample
  • File Share SampleEx
Variables

StdAfx.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Variables

const WCHAR g_wszResourceTypeNames [] = "File Share Sample\0"

Variable Documentation

const WCHAR g_wszResourceTypeNames[] = "File Share Sample\0"

Definition at line 7 of file StdAfx.cpp.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/FileShareSample/File Share SampleEx/StdAfx.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • FileShareSample
  • File Share SampleEx
Defines | Typedefs | Variables

StdAfx.h File Reference

#include <afxwin.h>
#include <afxext.h>
#include <afxdisp.h>
#include <afxtempl.h>
#include <afxcmn.h>
#include <afxpriv.h>
#include <atlbase.h>
#include <atlcom.h>
#include <clusapi.h>
#include <resapi.h>
#include <strsafe.h>
#include "proplist.h"
#include "proplist.h"

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _UNICODE
#define | CLUSCTL_RESOURCE_FILESHARESAMPLE_CALL_ISALIVE CLUSCTL_USER_CODE( 1, CLUS_OBJECT_RESOURCE )
#define | RTL_NUMBER_OF(A) (sizeof(A)/sizeof((A)[0]))
#define | STRSAFE_LIB
#define | VC_EXTRALEAN

Typedefs

typedef UINT | IDD
typedef UINT | IDS

Variables

CComModule | _Module
const WCHAR | g_wszResourceTypeNames []

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 21 of file StdAfx.h.

#define _UNICODE

Definition at line 11 of file StdAfx.h.

#define CLUSCTL_RESOURCE_FILESHARESAMPLE_CALL_ISALIVE CLUSCTL_USER_CODE( 1, CLUS_OBJECT_RESOURCE )

Definition at line 94 of file StdAfx.h.

#define RTL_NUMBER_OF ( A ) (sizeof(A)/sizeof((A)[0]))

Definition at line 28 of file StdAfx.h.

#define STRSAFE_LIB

Definition at line 76 of file StdAfx.h.

#define VC_EXTRALEAN

Definition at line 8 of file StdAfx.h.

Typedef Documentation

typedef UINT IDD

Definition at line 88 of file StdAfx.h.

typedef UINT IDS

Definition at line 87 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

const WCHAR g_wszResourceTypeNames[]

Definition at line 7 of file StdAfx.cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyCapabilities/Dll.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyCapabilities
Functions | Variables

Dll.cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include "MyCapabilities.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 60 of file Dll.cpp.

{
    return ( _Module.GetLockCount()==0 ) ? S_OK : S_FALSE;

} //*** DllCanUnloadNow

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 76 of file Dll.cpp.

{
    return _Module.GetClassObject( rclsid, riid, ppv );

} //*** DllGetClassObject

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 35 of file Dll.cpp.

{
    if ( dwReason == DLL_PROCESS_ATTACH )
    {
        _Module.Init( ObjectMap, hInstance ); // no typelib
        DisableThreadLibraryCalls( hInstance );
    }
    else if ( dwReason == DLL_PROCESS_DETACH )
    {
        _Module.Term();
    }
    return TRUE;    // ok

} //*** DllMain

STDAPI DllRegisterServer ( void )

Definition at line 92 of file Dll.cpp.

{
    // registers object; FALSE => no typelib
    return _Module.RegisterServer( FALSE );

} //*** DllRegisterServer

STDAPI DllUnregisterServer ( void )

Definition at line 109 of file Dll.cpp.

{
    return _Module.UnregisterServer( FALSE ); // FALSE => no typelib

} //*** DllUnregisterServer

Variable Documentation

CComModule _Module

Definition at line 17 of file Dll.cpp.

Generated on Wed Nov 13 2024 16:55:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyCapabilities/MyCapabilities.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyCapabilities

MyCapabilities.cpp File Reference

#include "stdafx.h"
#include "MyCapabilities.h"
#include <winerror.h>
#include <assert.h>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:55:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyCapabilities/MyCapabilities.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyCapabilities
Classes | Functions

MyCapabilities.h File Reference

#include <ClusCfgGuids.h>
#include "resource.h"

Go to the source code of this file.

Classes

class CMyCapabilities

Functions

DEFINE_GUID (CLSID_MyCapabilities, 0x96fce880, 0x4763, 0x4287, 0xa6, 0x4b, 0x53, 0xbd, 0x2a, 0xa9, 0x9a, 0x4)
DEFINE_GUID (TASKID_Minor_MyApp_Compat_Info, 0x65cc8af, 0xd454, 0x4f55, 0x94, 0x13, 0x9c, 0x4d, 0x97, 0x51, 0x5, 0xed)

Function Documentation

DEFINE_GUID | ( | CLSID_MyCapabilities | ,
 |  | 0x96fce880 | ,
 |  | 0x4763 | ,
 |  | 0x4287 | ,
 |  | 0xa6 | ,
 |  | 0x4b | ,
 |  | 0x53 | ,
 |  | 0xbd | ,
 |  | 0x2a | ,
 |  | 0xa9 | ,
 |  | 0x9a | ,
 |  | 0x4 |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_MyApp_Compat_Info | ,
 |  | 0x65cc8af | ,
 |  | 0xd454 | ,
 |  | 0x4f55 | ,
 |  | 0x94 | ,
 |  | 0x13 | ,
 |  | 0x9c | ,
 |  | 0x4d | ,
 |  | 0x97 | ,
 |  | 0x51 | ,
 |  | 0x5 | ,
 |  | 0xed |
 | ) |  |
Generated on Wed Nov 13 2024 16:55:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyCapabilities/Resource.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyCapabilities
Defines

Resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_MYCAPABILITIES 101
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_MYCAPABILITIES 101

Definition at line 6 of file Resource.h.

#define IDS_PROJNAME 100

Definition at line 5 of file Resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyCapabilities/StdAfx.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyCapabilities

StdAfx.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyCapabilities/StdAfx.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyCapabilities
Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>
#include <ClusCfgGuids.h>
#include <ClusCfgServer.h>
#include <strsafe.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0502
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 11 of file StdAfx.h.

#define _WIN32_WINNT 0x0502

Definition at line 9 of file StdAfx.h.

#define STRICT

Definition at line 7 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyEvictListener/dll.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyEvictListener
Functions | Variables

dll.cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include "MyEvictListener.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 60 of file dll.cpp.

{
    return ( _Module.GetLockCount()==0 ) ? S_OK : S_FALSE;

} //*** DllCanUnloadNow

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 76 of file dll.cpp.

{
    return _Module.GetClassObject( rclsid, riid, ppv );

} //*** DllGetClassObject

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 35 of file dll.cpp.

{
    if ( dwReason == DLL_PROCESS_ATTACH )
    {
        _Module.Init( ObjectMap, hInstance ); // no typelib
        DisableThreadLibraryCalls( hInstance );
    }
    else if ( dwReason == DLL_PROCESS_DETACH )
    {
        _Module.Term();
    }
    return TRUE;    // ok

} //*** DllMain

STDAPI DllRegisterServer ( void )

Definition at line 92 of file dll.cpp.

{
    // registers object; FALSE => no typelib
    return _Module.RegisterServer( FALSE );

} //*** DllRegisterServer

STDAPI DllUnregisterServer ( void )

Definition at line 109 of file dll.cpp.

{
    return _Module.UnregisterServer( FALSE ); // FALSE => no typelib

} //*** DllUnregisterServer

Variable Documentation

CComModule _Module

Definition at line 17 of file dll.cpp.

Generated on Wed Nov 13 2024 16:55:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyEvictListener/MyEvictListener.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyEvictListener

MyEvictListener.cpp File Reference

#include "stdafx.h"
#include "MyEvictListener.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:55:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyEvictListener/MyEvictListener.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyEvictListener
Classes | Functions

MyEvictListener.h File Reference

#include <ClusCfgGuids.h>
#include "resource.h"

Go to the source code of this file.

Classes

class CMyEvictListener

Functions

DEFINE_GUID (CLSID_MyEvictListener, 0x8097f026, 0x7e96, 0x4afa, 0xb3, 0x17, 0xb3, 0x5d, 0x8f, 0x88, 0xcf, 0xf7)

Function Documentation

DEFINE_GUID | ( | CLSID_MyEvictListener | ,
 |  | 0x8097f026 | ,
 |  | 0x7e96 | ,
 |  | 0x4afa | ,
 |  | 0xb3 | ,
 |  | 0x17 | ,
 |  | 0xb3 | ,
 |  | 0x5d | ,
 |  | 0x8f | ,
 |  | 0x88 | ,
 |  | 0xcf | ,
 |  | 0xf7 |
 | ) |  |
Generated on Wed Nov 13 2024 16:55:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyEvictListener/resource.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyEvictListener
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_MYEVICTLISTENER 101
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_MYEVICTLISTENER 101

Definition at line 6 of file resource.h.

#define IDS_PROJNAME 100

Definition at line 5 of file resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyEvictListener/StdAfx.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyEvictListener

StdAfx.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyEvictListener/StdAfx.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyEvictListener
Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>
#include <ClusCfgServer.h>
#include <ClusCfgGuids.h>
#include <strsafe.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0502
#define | RTL_NUMBER_OF(A) (sizeof(A)/sizeof((A)[0]))
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 11 of file StdAfx.h.

#define _WIN32_WINNT 0x0502

Definition at line 9 of file StdAfx.h.

#define RTL_NUMBER_OF ( A ) (sizeof(A)/sizeof((A)[0]))

Definition at line 29 of file StdAfx.h.

#define STRICT

Definition at line 7 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyMemberSetChangeListener/dll.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyMemberSetChangeListener
Functions | Variables

dll.cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include "MyMemberSetChangeListener.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 60 of file dll.cpp.

{
    return ( _Module.GetLockCount()==0 ) ? S_OK : S_FALSE;

} //*** DllCanUnloadNow

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 76 of file dll.cpp.

{
    return _Module.GetClassObject( rclsid, riid, ppv );

} //*** DllGetClassObject

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 35 of file dll.cpp.

{
    if ( dwReason == DLL_PROCESS_ATTACH )
    {
        _Module.Init( ObjectMap, hInstance ); // no typelib
        DisableThreadLibraryCalls( hInstance );
    }
    else if ( dwReason == DLL_PROCESS_DETACH )
    {
        _Module.Term();
    }
    return TRUE;    // ok

} //*** DllMain

STDAPI DllRegisterServer ( void )

Definition at line 92 of file dll.cpp.

{
    // registers object; FALSE => no typelib
    return _Module.RegisterServer( FALSE );

} //*** DllRegisterServer

STDAPI DllUnregisterServer ( void )

Definition at line 109 of file dll.cpp.

{
    return _Module.UnregisterServer( FALSE ); // FALSE => no typelib

} //*** DllUnregisterServer

Variable Documentation

CComModule _Module

Definition at line 17 of file dll.cpp.

Generated on Wed Nov 13 2024 16:55:00 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyMemberSetChangeListener/MyMemberSetChangeListener.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyMemberSetChangeListener

MyMemberSetChangeListener.cpp File Reference

#include "stdafx.h"
#include "MyMemberSetChangeListener.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:55:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyMemberSetChangeListener/MyMemberSetChangeListener.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyMemberSetChangeListener
Classes | Functions

MyMemberSetChangeListener.h File Reference

#include <ClusCfgServer.h>
#include <ClusCfgGuids.h>
#include "resource.h"

Go to the source code of this file.

Classes

class CMyMemberSetChangeListener

Functions

DEFINE_GUID (CLSID_MyMemberSetChangeListener, 0x7cd2ebbf, 0x958, 0x4513, 0xa5, 0x8f, 0xb, 0xb, 0x9, 0x8a, 0x61, 0x19)
DEFINE_GUID (TASKID_Minor_MyMemberSetChange_Info, 0x2a483627, 0x8bce, 0x48ea, 0x96, 0x13, 0x4c, 0xa2, 0xf5, 0x34, 0x89, 0xfa)

Function Documentation

DEFINE_GUID | ( | CLSID_MyMemberSetChangeListener | ,
 |  | 0x7cd2ebbf | ,
 |  | 0x958 | ,
 |  | 0x4513 | ,
 |  | 0xa5 | ,
 |  | 0x8f | ,
 |  | 0xb | ,
 |  | 0xb | ,
 |  | 0x9 | ,
 |  | 0x8a | ,
 |  | 0x61 | ,
 |  | 0x19 |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_MyMemberSetChange_Info | ,
 |  | 0x2a483627 | ,
 |  | 0x8bce | ,
 |  | 0x48ea | ,
 |  | 0x96 | ,
 |  | 0x13 | ,
 |  | 0x4c | ,
 |  | 0xa2 | ,
 |  | 0xf5 | ,
 |  | 0x34 | ,
 |  | 0x89 | ,
 |  | 0xfa |
 | ) |  |
Generated on Wed Nov 13 2024 16:55:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyMemberSetChangeListener/resource.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyMemberSetChangeListener
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_MYMEMBERSETCHANGELISTENER 101
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_MYMEMBERSETCHANGELISTENER 101

Definition at line 6 of file resource.h.

#define IDS_PROJNAME 100

Definition at line 5 of file resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyMemberSetChangeListener/StdAfx.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyMemberSetChangeListener

StdAfx.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyMemberSetChangeListener/StdAfx.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyMemberSetChangeListener
Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>
#include <ClusCfgServer.h>
#include <ClusCfgGuids.h>
#include <strsafe.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0502
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 13 of file StdAfx.h.

#define _WIN32_WINNT 0x0502

Definition at line 11 of file StdAfx.h.

#define STRICT

Definition at line 9 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyStartupListener/Dll.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyStartupListener
Functions | Variables

Dll.cpp File Reference

#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include "MyStartupListener.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 60 of file Dll.cpp.

{
    return ( _Module.GetLockCount()==0 ) ? S_OK : S_FALSE;

} //*** DllCanUnloadNow

STDAPI DllGetClassObject | ( | REFCLSID | rclsid,
 |  | REFIID | riid,
 |  | LPVOID * | ppv
 | ) |  |

Definition at line 76 of file Dll.cpp.

{
    return _Module.GetClassObject( rclsid, riid, ppv );

} //*** DllGetClassObject

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID |
 | ) |  |

Definition at line 35 of file Dll.cpp.

{
    if ( dwReason == DLL_PROCESS_ATTACH )
    {
        _Module.Init( ObjectMap, hInstance ); // no typelib
        DisableThreadLibraryCalls( hInstance );
    }
    else if ( dwReason == DLL_PROCESS_DETACH )
    {
        _Module.Term();
    }
    return TRUE;    // ok

} //*** DllMain

STDAPI DllRegisterServer ( void )

Definition at line 92 of file Dll.cpp.

{
    // registers object; FALSE => no typelib
    return _Module.RegisterServer( FALSE );

} //*** DllRegisterServer

STDAPI DllUnregisterServer ( void )

Definition at line 109 of file Dll.cpp.

{
    return _Module.UnregisterServer( FALSE ); // FALSE => no typelib

} //*** DllUnregisterServer

Variable Documentation

CComModule _Module

Definition at line 17 of file Dll.cpp.

Generated on Wed Nov 13 2024 16:55:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyStartupListener/MyStartupListener.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyStartupListener

MyStartupListener.cpp File Reference

#include "stdafx.h"
#include "MyStartupListener.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:55:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyStartupListener/MyStartupListener.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyStartupListener
Classes | Functions

MyStartupListener.h File Reference

#include <ClusCfgGuids.h>
#include "resource.h"

Go to the source code of this file.

Classes

class CMyStartupListener

Functions

DEFINE_GUID (CLSID_MyStartupListener, 0xba3de790, 0xad13, 0x432b, 0xa1, 0xdb, 0x49, 0x5, 0xf6, 0xc7, 0xa3, 0x36)

Function Documentation

DEFINE_GUID | ( | CLSID_MyStartupListener | ,
 |  | 0xba3de790 | ,
 |  | 0xad13 | ,
 |  | 0x432b | ,
 |  | 0xa1 | ,
 |  | 0xdb | ,
 |  | 0x49 | ,
 |  | 0x5 | ,
 |  | 0xf6 | ,
 |  | 0xc7 | ,
 |  | 0xa3 | ,
 |  | 0x36 |
 | ) |  |
Generated on Wed Nov 13 2024 16:55:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyStartupListener/resource.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyStartupListener
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_MYSTARTUPLISTENER 101
#define | IDS_PROJNAME 100

Define Documentation

#define IDR_MYSTARTUPLISTENER 101

Definition at line 6 of file resource.h.

#define IDS_PROJNAME 100

Definition at line 5 of file resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyStartupListener/StdAfx.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyStartupListener

StdAfx.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyStartupListener/StdAfx.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyStartupListener
Defines | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <atlcom.h>
#include <ClusCfgGuids.h>
#include <ClusCfgServer.h>
#include <strsafe.h>

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0502
#define | STRICT

Variables

CComModule | _Module

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 19 of file StdAfx.h.

#define _WIN32_WINNT 0x0502

Definition at line 17 of file StdAfx.h.

#define STRICT

Definition at line 15 of file StdAfx.h.

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyStorageResource/CClusterUtils.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyStorageResource

CClusterUtils.cpp File Reference

#include "stdafx.h"
#include "CClusterUtils.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:55:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyStorageResource/CClusterUtils.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyStorageResource
Classes

CClusterUtils.h File Reference

#include "stdafx.h"

Go to the source code of this file.

Classes

class CClusterUtils
Generated on Wed Nov 13 2024 16:55:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyStorageResource/CEnumStorageResource.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyStorageResource

CEnumStorageResource.cpp File Reference

#include "stdafx.h"
#include "CEnumStorageResource.h"
#include "SIndexedDisk.h"
#include "WMIHelpers.h"
#include "PropList.h"
#include "InsertionSort.h"
#include <resapi.h>

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:55:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyStorageResource/CEnumStorageResource.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyStorageResource
Classes | Variables

CEnumStorageResource.h File Reference

#include "stdafx.h"
#include "CStorageResource.h"
#include "CMgdClusCfgInit.h"
#include "CClusterUtils.h"

Go to the source code of this file.

Classes

class | CEnumStorageResource

Variables

const WCHAR | g_szNameSpaceRoot [] = { L"\\\\?\\GLOBALROOT" }
const WCHAR | g_szPhysicalDriveFormat [] = { L"\\\\.\\PHYSICALDRIVE%lu\0" }

Variable Documentation

const WCHAR g_szNameSpaceRoot[] = { L"\\\\?\\GLOBALROOT" }

Definition at line 35 of file CEnumStorageResource.h.

const WCHAR g_szPhysicalDriveFormat[] = { L"\\\\.\\PHYSICALDRIVE%lu\0" }

Definition at line 36 of file CEnumStorageResource.h.

Generated on Wed Nov 13 2024 16:55:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyStorageResource/CMgdClusCfgInit.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyStorageResource

CMgdClusCfgInit.cpp File Reference

#include "stdafx.h"
#include "CMgdClusCfgInit.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:54:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyStorageResource/CMgdClusCfgInit.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyStorageResource
Classes

CMgdClusCfgInit.h File Reference

#include "stdafx.h"

Go to the source code of this file.

Classes

class CMgdClusCfgInit
Generated on Wed Nov 13 2024 16:54:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyStorageResource/Common.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyStorageResource
Defines

Common.h File Reference

Go to the source code of this file.

Defines

#define | LOG_STATUS_REPORT(_pwsz_, _hr_)
#define | LOG_STATUS_REPORT_MINOR(_minor_, _pwsz_, _hr_)
#define | LOG_STATUS_REPORT_MINOR_STRING(_minor_, _pwszFormat_, _arg0_, _hr_)
#define | LOG_STATUS_REPORT_STRING(_pwszFormat_, _arg0_, _hr_)
#define | LOG_STATUS_REPORT_STRING2(_pwszFormat_, _arg0_, _arg1_, _hr_)
#define | LOG_STATUS_REPORT_STRING3(_pwszFormat_, _arg0_, _arg1_, _arg2_, _hr_)
#define | LOG_STATUS_REPORT_STRING4(_pwszFormat_, _arg0_, _arg1_, _arg2_, _arg3_, _hr_)
#define | STATUS_REPORT(_major_, _minor_, _uid_, _hr_)
#define | STATUS_REPORT_REF(_major_, _minor_, _idsMsg_, _idsRef_, _hr_)
#define | STATUS_REPORT_STRING(_major_, _minor_, _idsFormat_, _arg0_, _hr_)
#define | STATUS_REPORT_STRING2(_major_, _minor_, _idsFormat_, _arg0_, _arg1_, _hr_)
#define | STATUS_REPORT_STRING2_REF(_major_, _minor_, _idsFormat_, _arg0_, _arg1_, _idsRef_, _hr_)
#define | STATUS_REPORT_STRING_REF(_major_, _minor_, _idsFormat_, _arg0_, _idsRef_, _hr_)

Define Documentation

#define LOG_STATUS_REPORT | ( | _pwsz_,
 |  | _hr_
 | ) |
Value:
HrSendStatusReport( \
                          TASKID_Major_Update_Progress \
                        , TASKID_Major_Server_Log \
                        , 1 \
                        , 1 \
                        , 1 \
                        , _hr_\
                        , _pwsz_ \
                        , (UINT)NULL \
                        )

Definition at line 22 of file Common.h.

#define LOG_STATUS_REPORT_MINOR | ( | _minor_,
 |  | _pwsz_,
 |  | _hr_
 | ) |
Value:
HrSendStatusReport( \
                          TASKID_Major_Server_Log \
                        , _minor_ \
                        , 1 \
                        , 1 \
                        , 1 \
                        , _hr_ \
                        , _pwsz_ \
                        , (UINT)NULL \
                        )

Definition at line 34 of file Common.h.

#define LOG_STATUS_REPORT_MINOR_STRING | ( | _minor_,
 |  | _pwszFormat_,
 |  | _arg0_,
 |  | _hr_
 | ) |
Value:
{ \
        BSTR    _bstrMsg_ = NULL; \
        HRESULT _hrTemp_; \
        \
        _hrTemp_ = HrFormatStringIntoBSTR( _pwszFormat_, &_bstrMsg_, _arg0_ ); \
        _hrTemp_ = HrSendStatusReport( \
                              TASKID_Major_Server_Log \
                            , _minor_ \
                            , 1 \
                            , 1 \
                            , 1 \
                            , _hr_ \
                            , _hrTemp_ == S_OK ? _bstrMsg_ : L"The description for this entry could not be located." \
                            , (UINT) 0 \
                            ); \
        if ( FAILED( _hrTemp_ ) && SUCCEEDED( _hr_ ) ) \
        { \
            _hr_ = _hrTemp_; \
        } \
        \
        SysFreeString( _bstrMsg_ ); \
    }

Definition at line 46 of file Common.h.

#define LOG_STATUS_REPORT_STRING | ( | _pwszFormat_,
 |  | _arg0_,
 |  | _hr_
 | ) |
Value:
{ \
        BSTR    _bstrMsg_ = NULL; \
        HRESULT _hrTemp_; \
        \
        _hrTemp_ = HrFormatStringIntoBSTR( _pwszFormat_, &_bstrMsg_, _arg0_ ); \
        _hrTemp_ = HrSendStatusReport( \
                              TASKID_Major_Update_Progress \
                            , TASKID_Major_Server_Log \
                            , 1 \
                            , 1 \
                            , 1 \
                            , _hr_ \
                            , _hrTemp_ == S_OK ? _bstrMsg_ : L"The description for this entry could not be located." \
                            , (UINT) 0 \
                            ); \
        if ( FAILED( _hrTemp_ ) && SUCCEEDED( _hr_ ) ) \
        { \
            _hr_ = _hrTemp_; \
        } \
        \
        SysFreeString( _bstrMsg_ ); \
    }

Definition at line 70 of file Common.h.

#define LOG_STATUS_REPORT_STRING2 | ( | _pwszFormat_,
 |  | _arg0_,
 |  | _arg1_,
 |  | _hr_
 | ) |
Value:
{ \
        BSTR    _bstrMsg_ = NULL; \
        HRESULT _hrTemp_; \
        \
        _hrTemp_ = HrFormatStringIntoBSTR( _pwszFormat_, &_bstrMsg_, _arg0_, _arg1_ ); \
        _hrTemp_ = HrSendStatusReport( \
                              TASKID_Major_Update_Progress \
                            , TASKID_Major_Server_Log \
                            , 1 \
                            , 1 \
                            , 1 \
                            , _hr_\
                            , _hrTemp_ == S_OK ? _bstrMsg_ : L"The description for this entry could not be located." \
                            , (UINT) 0 \
                            ); \
        if ( FAILED( _hrTemp_ ) ) \
        { \
            _hr_ = _hrTemp_; \
        } \
        \
        SysFreeString( _bstrMsg_ ); \
    }

Definition at line 94 of file Common.h.

#define LOG_STATUS_REPORT_STRING3 | ( | _pwszFormat_,
 |  | _arg0_,
 |  | _arg1_,
 |  | _arg2_,
 |  | _hr_
 | ) |
Value:
{ \
        BSTR    _bstrMsg_ = NULL; \
        HRESULT _hrTemp_; \
        \
        _hrTemp_ = HrFormatStringIntoBSTR( _pwszFormat_, &_bstrMsg_, _arg0_, _arg1_, _arg2_ ); \
        _hrTemp_ = HrSendStatusReport( \
                              TASKID_Major_Update_Progress \
                            , TASKID_Major_Server_Log \
                            , 1 \
                            , 1 \
                            , 1 \
                            , _hr_\
                            , _hrTemp_ == S_OK ? _bstrMsg_ : L"The description for this entry could not be located." \
                            , (UINT) 0 \
                            ); \
        if ( FAILED( _hrTemp_ ) ) \
        { \
            _hr_ = _hrTemp_; \
        } \
        \
        SysFreeString( _bstrMsg_ ); \
    }

Definition at line 118 of file Common.h.

#define LOG_STATUS_REPORT_STRING4 | ( | _pwszFormat_,
 |  | _arg0_,
 |  | _arg1_,
 |  | _arg2_,
 |  | _arg3_,
 |  | _hr_
 | ) |
Value:
{ \
        BSTR    _bstrMsg_ = NULL; \
        HRESULT _hrTemp_; \
        \
        _hrTemp_ = HrFormatStringIntoBSTR( _pwszFormat_, &_bstrMsg_, _arg0_, _arg1_, _arg2_, _arg3_ ); \
        _hrTemp_ = HrSendStatusReport( \
                              TASKID_Major_Update_Progress \
                            , TASKID_Major_Server_Log \
                            , 1 \
                            , 1 \
                            , 1 \
                            , _hr_\
                            , _hrTemp_ == S_OK ? _bstrMsg_ : L"The description for this entry could not be located." \
                            , (UINT) 0 \
                            ); \
        if ( FAILED( _hrTemp_ ) ) \
        { \
            _hr_ = _hrTemp_; \
        } \
        \
        SysFreeString( _bstrMsg_ ); \
    }

Definition at line 142 of file Common.h.

#define STATUS_REPORT | ( | _major_,
 |  | _minor_,
 |  | _uid_,
 |  | _hr_
 | ) |
Value:
HrSendStatusReport( \
                          _major_ \
                        , _minor_ \
                        , 1 \
                        , 1 \
                        , 1 \
                        , _hr_\
                        , _uid_ \
                        , NULL \
                        )

Definition at line 278 of file Common.h.

#define STATUS_REPORT_REF | ( | _major_,
 |  | _minor_,
 |  | _idsMsg_,
 |  | _idsRef_,
 |  | _hr_
 | ) |
Value:
HrSendStatusReport( \
                      _major_ \
                    , _minor_ \
                    , 1 \
                    , 1 \
                    , 1 \
                    , _hr_ \
                    , (DWORD) _idsMsg_ \
                    , (DWORD) _idsRef_ \
                    )

Definition at line 166 of file Common.h.

#define STATUS_REPORT_STRING | ( | _major_,
 |  | _minor_,
 |  | _idsFormat_,
 |  | _arg0_,
 |  | _hr_
 | ) |
Value:
{ \
        BSTR    _bstrMsg_ = NULL; \
        HRESULT _hrTemp_; \
        \
        _hrTemp_ = HrFormatStringIntoBSTR( NULL, _idsFormat_, &_bstrMsg_, _arg0_ ); \
        _hrTemp_ = HrSendStatusReport( \
                              _major_ \
                            , _minor_ \
                            , 1 \
                            , 1 \
                            , 1 \
                            , _hr_ \
                            , _hrTemp_ == S_OK ? _bstrMsg_ : L"The description for this entry could not be located." \
                            , (UINT)0 \
                            , (UINT)0 \
                            ); \
        if ( FAILED( _hrTemp_ ) ) \
        { \
            _hr_ = _hrTemp_; \
        } \
        \
        SysFreeString( _bstrMsg_ ); \
    }

Definition at line 178 of file Common.h.

#define STATUS_REPORT_STRING2 | ( | _major_,
 |  | _minor_,
 |  | _idsFormat_,
 |  | _arg0_,
 |  | _arg1_,
 |  | _hr_
 | ) |
Value:
{ \
        BSTR    _bstrMsg_ = NULL; \
        HRESULT _hrTemp_; \
        \
        _hrTemp_ = HrFormatStringIntoBSTR( NULL, _idsFormat_, &_bstrMsg_, _arg0_, _arg1_ ); \
        _hrTemp_ = HrSendStatusReport( \
                              _major_ \
                            , _minor_ \
                            , 1 \
                            , 1 \
                            , 1 \
                            , _hr_ \
                            , _hrTemp_ == S_OK ? _bstrMsg_ : L"The description for this entry could not be located." \
                            , (UINT)0 \
                            , (UINT)0 \
                            ); \
        if ( FAILED( _hrTemp_ ) ) \
        { \
            _hr_ = _hrTemp_; \
        } \
        \
        SysFreeString( _bstrMsg_ ); \
    }

Definition at line 203 of file Common.h.

#define STATUS_REPORT_STRING2_REF | ( | _major_,
 |  | _minor_,
 |  | _idsFormat_,
 |  | _arg0_,
 |  | _arg1_,
 |  | _idsRef_,
 |  | _hr_
 | ) |
Value:
{ \
        BSTR    _bstrMsg_ = NULL; \
        HRESULT _hrTemp_; \
        \
        _hrTemp_ = HrFormatStringIntoBSTR( NULL, _idsFormat_, &_bstrMsg_, _arg0_, _arg1_ ); \
        _hrTemp_ = HrSendStatusReport( \
                              _major_ \
                            , _minor_ \
                            , 1 \
                            , 1 \
                            , 1 \
                            , _hr_ \
                            , _hrTemp_ == S_OK ? _bstrMsg_ : L"The description for this entry could not be located." \
                            , _idsRef_ \
                            , NULL \
                            ); \
        if ( FAILED( _hrTemp_ ) ) \
        { \
            _hr_ = _hrTemp_; \
        } \
        \
        SysFreeString( _bstrMsg_ ); \
    }

Definition at line 253 of file Common.h.

#define STATUS_REPORT_STRING_REF | ( | _major_,
 |  | _minor_,
 |  | _idsFormat_,
 |  | _arg0_,
 |  | _idsRef_,
 |  | _hr_
 | ) |
Value:
{ \
        BSTR    _bstrMsg_ = NULL; \
        HRESULT _hrTemp_; \
        \
        _hrTemp_ = HrFormatStringIntoBSTR( NULL, _idsFormat_, &_bstrMsg_, _arg0_ ); \
        _hrTemp_ = HrSendStatusReport( \
                              _major_ \
                            , _minor_ \
                            , 1 \
                            , 1 \
                            , 1 \
                            , _hr_ \
                            , _hrTemp_ == S_OK ? _bstrMsg_ : L"The description for this entry could not be located." \
                            , _idsRef_ \
                            , NULL \
                            ); \
        if ( FAILED( _hrTemp_ ) ) \
        { \
            _hr_ = _hrTemp_; \
        } \
        \
        SysFreeString( _bstrMsg_ ); \
    }

Definition at line 228 of file Common.h.

Generated on Wed Nov 13 2024 16:53:12 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyStorageResource/CPartitionInfo.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyStorageResource

CPartitionInfo.cpp File Reference

#include "stdafx.h"
#include "WMIHelpers.h"
#include "CPartitionInfo.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:55:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyStorageResource/CPartitionInfo.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyStorageResource
Classes

CPartitionInfo.h File Reference

#include "stdafx.h"
#include "CMgdClusCfgInit.h"

Go to the source code of this file.

Classes

class CPartitionInfo
Generated on Wed Nov 13 2024 16:55:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyStorageResource/CStorageResource.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyStorageResource
Defines

CStorageResource.cpp File Reference

#include "stdafx.h"
#include "WMIHelpers.h"
#include "CStorageResource.h"
#include "CPartitionInfo.h"
#include "proplist.h"
#include <ntddscsi.h>

Go to the source code of this file.

Defines

#define | CLUSDISK_SRB_SIGNATURE "CLUSDISK"
#define | FILE_DEVICE_SCSI 0x0000001b
#define | IOCTL_SCSI_MINIPORT_NOT_QUORUM_CAPABLE ( ( FILE_DEVICE_SCSI << 16 ) + 0x0520 )

Define Documentation

#define CLUSDISK_SRB_SIGNATURE "CLUSDISK"
#define FILE_DEVICE_SCSI 0x0000001b
#define IOCTL_SCSI_MINIPORT_NOT_QUORUM_CAPABLE ( ( FILE_DEVICE_SCSI << 16 ) + 0x0520 )
Generated on Wed Nov 13 2024 16:55:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyStorageResource/CStorageResource.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyStorageResource
Classes | Defines

CStorageResource.h File Reference

#include "stdafx.h"
#include "CStorageResType.h"
#include "CMgdClusCfgInit.h"

Go to the source code of this file.

Classes

class | CStorageResource

Defines

#define | MYRES_DEPENDENCY_MODE dfSHARED

Define Documentation

#define MYRES_DEPENDENCY_MODE dfSHARED

Definition at line 39 of file CStorageResource.h.

Generated on Wed Nov 13 2024 16:55:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyStorageResource/CStorageResType.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyStorageResource
Defines

CStorageResType.cpp File Reference

#include "stdafx.h"
#include "CStorageResType.h"

Go to the source code of this file.

Defines

#define | CLUSTER_RESTYPE_DEFAULT_IS_ALIVE ( 60 * 1000 )
#define | CLUSTER_RESTYPE_DEFAULT_LOOKS_ALIVE ( 5 * 1000 )

Define Documentation

#define CLUSTER_RESTYPE_DEFAULT_IS_ALIVE ( 60 * 1000 )

Definition at line 32 of file CStorageResType.cpp.

#define CLUSTER_RESTYPE_DEFAULT_LOOKS_ALIVE ( 5 * 1000 )

Definition at line 31 of file CStorageResType.cpp.

Generated on Wed Nov 13 2024 16:55:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyStorageResource/CStorageResType.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyStorageResource
Classes

CStorageResType.h File Reference

#include "stdafx.h"
#include "CMgdClusCfgInit.h"

Go to the source code of this file.

Classes

class CStorageResType
Generated on Wed Nov 13 2024 16:55:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyStorageResource/guids.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyStorageResource
Functions

guids.h File Reference

#include <initguid.h>

Go to the source code of this file.

Functions

DEFINE_GUID (TASKID_Minor_StorageResourceInitialize, 0xe9fbb913, 0xde7b, 0x4d7d, 0xb3, 0x67, 0x6, 0xe7, 0xee, 0xc8, 0x1, 0x9e)
DEFINE_GUID (RESTYPE_StorageResource, 0x215929d2, 0x7, 0x4d94, 0x92, 0xa8, 0xc0, 0x58, 0xc2, 0x4, 0x59, 0x0)
DEFINE_GUID (TASKID_Minor_HrGetLogicalDisks_Next, 0x67215ffb, 0xc63d, 0x4fee, 0xb2, 0xd4, 0xea, 0x23, 0xe9, 0xf8, 0x4c, 0x7e)
DEFINE_GUID (TASKID_Minor_WMI_Logical_Disks_Qry_Failed, 0xb2211a28, 0x6f50, 0x4532, 0xb1, 0x6f, 0x9, 0xfa, 0x7e, 0xb5, 0x54, 0x72)
DEFINE_GUID (TASKID_Minor_HrGetLogicalDisks, 0x3787cc20, 0x5822, 0x4e23, 0xb4, 0xb2, 0x87, 0x12, 0xea, 0x48, 0x23, 0xd6)
DEFINE_GUID (TASKID_Minor_HrAddLogicalDiskToArray, 0x721099af, 0x7cc8, 0x4f87, 0xa2, 0x13, 0x48, 0x72, 0x97, 0xf7, 0x19, 0x4f)
DEFINE_GUID (TASKID_Minor_HrGetFriendlyName, 0xbd4be998, 0x6400, 0x46a2, 0xa1, 0xd8, 0xb, 0xb5, 0xfc, 0x17, 0xdd, 0x42)
DEFINE_GUID (TASKID_Minor_GetFriendlyName, 0x721099af, 0x7cc8, 0x4f87, 0xa2, 0x13, 0x48, 0x72, 0x97, 0xf7, 0x19, 0x4f)
DEFINE_GUID (TASKID_Minor_Disk_Not_NTFS, 0xf0493cc2, 0x90be, 0x4199, 0x98, 0x47, 0xe7, 0x1b, 0xed, 0x99, 0xb, 0x63)
DEFINE_GUID (TASKID_Minor_Disk_No_File_System, 0x6ea41d85, 0xb149, 0x406c, 0x93, 0xc5, 0x59, 0x71, 0x8c, 0x3e, 0xfe, 0x3c)
DEFINE_GUID (TASKID_Minor_SetWbemObject_Partition, 0xcf4008b3, 0xe902, 0x4a54, 0x80, 0xdd, 0x26, 0x95, 0x55, 0x7f, 0x4f, 0xcc)
DEFINE_GUID (TASKID_Minor_GetSize, 0x8af69452, 0x886b, 0x45ee, 0xb4, 0xfd, 0xd2, 0xfa, 0x7f, 0x47, 0xf4, 0xc4)
DEFINE_GUID (TASKID_Minor_GetDriveLetterMappings_Partition, 0x927ecc61, 0xe8b3, 0x4919, 0x88, 0xb7, 0x2e, 0x89, 0x87, 0x47, 0x84, 0xab)
DEFINE_GUID (TASKID_Minor_PartitionInfo_GetDescription_Memory, 0x6ca61237, 0xc4, 0x4e5b, 0x90, 0xa0, 0x68, 0xe2, 0x63, 0x15, 0xd1, 0xfc)
DEFINE_GUID (TASKID_Minor_PartitionInfo_GetDescription_Pointer, 0xebf09d63, 0x5d2, 0x4019, 0x9b, 0x8a, 0x4e, 0xb0, 0x64, 0xaf, 0x1, 0xf1)
DEFINE_GUID (TASKID_Minor_PartitionInfo_GetName_Pointer, 0x31729c01, 0xaac2, 0x4baa, 0x86, 0xf4, 0xf6, 0xdc, 0xdd, 0xcb, 0x70, 0xb)
DEFINE_GUID (TASKID_Minor_PartitionInfo_GetUID_Memory, 0x5872713b, 0x70e1, 0x4155, 0x89, 0x74, 0x20, 0x96, 0x97, 0x62, 0x7a, 0xc6)
DEFINE_GUID (TASKID_Minor_PartitionInfo_GetUID_Pointer, 0x3704f82d, 0x1b0e, 0x4b2f, 0xbd, 0x33, 0x86, 0xe4, 0x4a, 0xc9, 0xa5, 0x9b)
DEFINE_GUID (TASKID_Minor_SetWbemServices_Partition, 0x65a8703b, 0xd91a, 0x4edc, 0x86, 0x1d, 0x1b, 0xf3, 0x7a, 0x3a, 0xf, 0x84)
DEFINE_GUID (TASKID_Minor_StorageResourceType_CommitChanges, 0xee6ab597, 0x5992, 0x4a86, 0xa7, 0x85, 0xc1, 0x43, 0xc7, 0x68, 0xdf, 0xb7)
DEFINE_GUID (TASKID_Minor_WQL_Disk_Qry_Next_Failed, 0xcde9f8fc, 0x5c95, 0x4e9a, 0xb7, 0x3a, 0x19, 0x80, 0x7d, 0xa9, 0xf5, 0xa5)
DEFINE_GUID (TASKID_Minor_HrGetDisks, 0x25205b87, 0x3abe, 0x4527, 0xb9, 0xb2, 0xc4, 0xd3, 0xe, 0x46, 0xd2, 0x50)
DEFINE_GUID (TASKID_Minor_StorageResource_Cluster_Capable, 0x94fea8d6, 0xa61d, 0x43aa, 0x9c, 0xd9, 0xe2, 0x2c, 0x15, 0x32, 0xf7, 0xa1)
DEFINE_GUID (TASKID_Minor_Pruning_CrashDump_Disk_Bus, 0x32135624, 0xe54d, 0x46c2, 0xa7, 0xee, 0x70, 0x4d, 0xe4, 0x16, 0xfb, 0xe3)
DEFINE_GUID (TASKID_Minor_Pruning_PageFile_Disk_Bus, 0x95d0bdfa, 0x579, 0x4b40, 0x8d, 0xdb, 0x4f, 0x9b, 0xca, 0x9d, 0x72, 0x5)
DEFINE_GUID (TASKID_Minor_Non_SCSI_Disks, 0xb8f5736b, 0x2046, 0x4762, 0x81, 0x22, 0xc7, 0x37, 0xed, 0x92, 0xbf, 0x28)
DEFINE_GUID (TASKID_Minor_WMI_Get_LogicalDisk_Failed, 0xafcff8c7, 0xf83c, 0x482e, 0xbb, 0xef, 0x60, 0xfd, 0xcd, 0x4c, 0xc4, 0x1a)
DEFINE_GUID (TASKID_Minor_HrIsLogicalDiskNTFS, 0xcd5cbe2e, 0x9a98, 0x4eac, 0xbd, 0xc3, 0x20, 0x19, 0x5c, 0x21, 0x7a, 0xd3)
DEFINE_GUID (TASKID_Minor_HrIsLogicalDiskNTFS_InvalidArg, 0x46597d45, 0x38d8, 0x4134, 0x9b, 0x34, 0x97, 0xdd, 0xc0, 0x94, 0xa8, 0x75)
DEFINE_GUID (TASKID_Minor_HrAddObjectToArray, 0x3e18b282, 0xddd5, 0x4eff, 0x8a, 0xce, 0xbe, 0x29, 0x48, 0x37, 0x2e, 0x51)
DEFINE_GUID (TASKID_Minor_Pruning_System_Disk_Bus, 0x3c02daa7, 0x4c68, 0x4a68, 0xae, 0x56, 0x45, 0x4f, 0x26, 0xd6, 0xb8, 0xc6)
DEFINE_GUID (TASKID_Minor_Pruning_Boot_Disk_Bus, 0xc08826d6, 0xd99b, 0x46d1, 0xa5, 0xe4, 0x99, 0x6b, 0x8a, 0xaa, 0x33, 0x6d)
DEFINE_GUID (TASKID_Minor_Clone_Enum_StorageResource, 0x75de3c02, 0x9df, 0x4bb2, 0x99, 0xbd, 0x83, 0xf, 0x12, 0x2e, 0xdb, 0x87)
DEFINE_GUID (TASKID_Minor_Next_Enum_StorageResource, 0xac376681, 0x2a03, 0x4219, 0x93, 0xb, 0x5b, 0xcb, 0xf4, 0x87, 0x84, 0xf3)
DEFINE_GUID (TASKID_Minor_Boot_Partition_Not_NTFS, 0xc08a253c, 0xa491, 0x4a57, 0xb5, 0xb, 0x1a, 0xd2, 0xa3, 0x49, 0xda, 0x57)
DEFINE_GUID (TASKID_Minor_SetWbemServices_Enum_StorageResource, 0x5d9625a4, 0x9de4, 0x4872, 0x95, 0x23, 0x26, 0x4e, 0xd, 0x83, 0xa, 0xf)
DEFINE_GUID (TASKID_Minor_InitWbem_Enum_StorageResource, 0xa07ceac4, 0x8c45, 0x4938, 0xb7, 0xf, 0xf7, 0x5c, 0xda, 0xc7, 0x1e, 0x18)
DEFINE_GUID (TASKID_Minor_HrCreateFriendlyName_BSTR, 0xe8cb2d98, 0x4634, 0x442b, 0xbe, 0xa5, 0xc9, 0xfc, 0xac, 0x8, 0x63, 0x4a)
DEFINE_GUID (TASKID_Minor_HrCreateFriendlyName_VOID, 0x7f305e21, 0xd0bf, 0x4821, 0xab, 0x7e, 0x25, 0x88, 0x1f, 0xc5, 0xdb, 0x2e)
DEFINE_GUID (TASKID_Minor_HrAddPartitionToArray, 0xd099e738, 0x2d66, 0x4295, 0x9c, 0x13, 0x8e, 0x31, 0xc, 0x78, 0xbf, 0xb2)
DEFINE_GUID (TASKID_Minor_WQL_Partition_Qry_Next_Failed, 0x2865e3cf, 0x251d, 0x49d1, 0xbd, 0x2, 0x4a, 0x18, 0x7b, 0xfe, 0x6b, 0x87)
DEFINE_GUID (TASKID_Minor_WMI_DiskDrivePartitions_Qry_Failed, 0xa63feba9, 0xb876, 0x458c, 0x9d, 0x46, 0x73, 0xe2, 0x9e, 0x7d, 0xfd, 0x43)
DEFINE_GUID (TASKID_Minor_HrGetPartitionInfo, 0x25af944, 0x540e, 0x4b60, 0xac, 0x29, 0xb, 0x41, 0x45, 0x87, 0x37, 0x19)
DEFINE_GUID (TASKID_Minor_HrSetFriendlyName_StorageResource, 0xe0a688f7, 0xe589, 0x4910, 0x85, 0x2e, 0x7a, 0x3b, 0xd1, 0x4a, 0x3a, 0x14)
DEFINE_GUID (TASKID_Minor_HrGetSignature_Pointer, 0x8b37a3e0, 0xe23c, 0x405e, 0xa2, 0x89, 0xe8, 0x9f, 0x9f, 0x5e, 0x81, 0x93)
DEFINE_GUID (TASKID_Minor_HrGetDeviceID_Memory, 0x401b7b17, 0xd44d, 0x4d45, 0xa1, 0xa9, 0xc7, 0xdd, 0x49, 0xfb, 0xed, 0xa3)
DEFINE_GUID (TASKID_Minor_HrGetDeviceID_Pointer, 0x800adb0b, 0x7f9d, 0x465b, 0xb5, 0x7b, 0xf3, 0xaf, 0x46, 0xd6, 0x7e, 0xc2)
DEFINE_GUID (TASKID_Minor_HrGetSCSIPort, 0x8979adbe, 0x6211, 0x4e70, 0x85, 0x3, 0x5b, 0x27, 0x94, 0x87, 0x12, 0x3f)
DEFINE_GUID (TASKID_Minor_HrGetSCSIBus, 0x255d2fc8, 0xcf19, 0x44f5, 0xa5, 0x15, 0x75, 0x5, 0xc1, 0xf4, 0x4a, 0xa)
DEFINE_GUID (TASKID_Minor_Clone_StorageResource, 0xe78edbb5, 0x5804, 0x462e, 0x87, 0xe, 0x59, 0x9b, 0xf8, 0x98, 0x45, 0x4c)
DEFINE_GUID (TASKID_Minor_StorageResource_No_Partitions, 0xfe52b921, 0xc04b, 0x47aa, 0x8c, 0xc6, 0xe3, 0x20, 0xaf, 0x91, 0xd4, 0xbf)
DEFINE_GUID (TASKID_Minor_Next_StorageResource, 0x9c22a873, 0x9152, 0x4b13, 0x91, 0x60, 0xcc, 0xb9, 0xc9, 0x27, 0x90, 0x39)
DEFINE_GUID (TASKID_Minor_SetWbemObject_StorageResource, 0x6b10761b, 0x5eca, 0x4ce7, 0x8e, 0x9d, 0x7f, 0xa8, 0xa0, 0x78, 0xb0, 0xd4)
DEFINE_GUID (TASKID_Minor_StorageResource_Signature, 0x626153a8, 0x4d, 0x49aa, 0xab, 0x43, 0xdb, 0x2f, 0xf5, 0xa3, 0x3a, 0x68)
DEFINE_GUID (TASKID_Minor_SetWbemServices_StorageResource, 0x64d8f134, 0x767, 0x4639, 0x9a, 0x53, 0x3, 0x88, 0xce, 0x67, 0x14, 0x5)
DEFINE_GUID (TASKID_Minor_StorageResource_Create, 0x1d87b8e, 0xc74, 0x4871, 0xa4, 0xa3, 0x6e, 0x57, 0x3f, 0xca, 0x52, 0x51)
DEFINE_GUID (TASKID_Minor_StorageResource_PreCreate, 0x5771ff41, 0x4b86, 0x44a3, 0x97, 0x6e, 0x0, 0x64, 0xb, 0x52, 0xaa, 0xee)
DEFINE_GUID (TASKID_Minor_StorageResource_GetUID_Memory, 0xa61d60c2, 0xabb4, 0x4296, 0xa4, 0x2a, 0x68, 0x86, 0xe, 0x97, 0xd2, 0xdd)
DEFINE_GUID (TASKID_Minor_StorageResource_GetUID_Pointer, 0x47be7aa7, 0xa677, 0x42f5, 0x84, 0xc8, 0x8e, 0x51, 0x91, 0x79, 0xfe, 0x75)
DEFINE_GUID (TASKID_Minor_SetName_StorageResource, 0xe2986823, 0x149e, 0x40a8, 0x86, 0x6, 0xb8, 0xed, 0xf1, 0xd0, 0x78, 0x68)
DEFINE_GUID (TASKID_Minor_GetName_Memory, 0x2c130dbc, 0xcdd3, 0x4e24, 0xa4, 0x28, 0xe2, 0x84, 0xb6, 0x4d, 0x41, 0x1)
DEFINE_GUID (TASKID_Minor_GetName_Pointer, 0xfa2988e6, 0x51fc, 0x47ce, 0x86, 0x1e, 0xce, 0x7a, 0x6e, 0x9e, 0xd6, 0xaf)
DEFINE_GUID (TASKID_Minor_GetDriveLetterMappings_StorageResource, 0xa52b9965, 0x6bf8, 0x4216, 0x8f, 0xc9, 0x4, 0xe7, 0x15, 0x18, 0xd, 0xd5)

Function Documentation

DEFINE_GUID | ( | TASKID_Minor_StorageResourceInitialize | ,
 |  | 0xe9fbb913 | ,
 |  | 0xde7b | ,
 |  | 0x4d7d | ,
 |  | 0xb3 | ,
 |  | 0x67 | ,
 |  | 0x6 | ,
 |  | 0xe7 | ,
 |  | 0xee | ,
 |  | 0xc8 | ,
 |  | 0x1 | ,
 |  | 0x9e |
 | ) |  |
DEFINE_GUID | ( | RESTYPE_StorageResource | ,
 |  | 0x215929d2 | ,
 |  | 0x7 | ,
 |  | 0x4d94 | ,
 |  | 0x92 | ,
 |  | 0xa8 | ,
 |  | 0xc0 | ,
 |  | 0x58 | ,
 |  | 0xc2 | ,
 |  | 0x4 | ,
 |  | 0x59 | ,
 |  | 0x0 |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_HrGetLogicalDisks_Next | ,
 |  | 0x67215ffb | ,
 |  | 0xc63d | ,
 |  | 0x4fee | ,
 |  | 0xb2 | ,
 |  | 0xd4 | ,
 |  | 0xea | ,
 |  | 0x23 | ,
 |  | 0xe9 | ,
 |  | 0xf8 | ,
 |  | 0x4c | ,
 |  | 0x7e |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_WMI_Logical_Disks_Qry_Failed | ,
 |  | 0xb2211a28 | ,
 |  | 0x6f50 | ,
 |  | 0x4532 | ,
 |  | 0xb1 | ,
 |  | 0x6f | ,
 |  | 0x9 | ,
 |  | 0xfa | ,
 |  | 0x7e | ,
 |  | 0xb5 | ,
 |  | 0x54 | ,
 |  | 0x72 |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_HrGetLogicalDisks | ,
 |  | 0x3787cc20 | ,
 |  | 0x5822 | ,
 |  | 0x4e23 | ,
 |  | 0xb4 | ,
 |  | 0xb2 | ,
 |  | 0x87 | ,
 |  | 0x12 | ,
 |  | 0xea | ,
 |  | 0x48 | ,
 |  | 0x23 | ,
 |  | 0xd6 |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_HrAddLogicalDiskToArray | ,
 |  | 0x721099af | ,
 |  | 0x7cc8 | ,
 |  | 0x4f87 | ,
 |  | 0xa2 | ,
 |  | 0x13 | ,
 |  | 0x48 | ,
 |  | 0x72 | ,
 |  | 0x97 | ,
 |  | 0xf7 | ,
 |  | 0x19 | ,
 |  | 0x4f |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_HrGetFriendlyName | ,
 |  | 0xbd4be998 | ,
 |  | 0x6400 | ,
 |  | 0x46a2 | ,
 |  | 0xa1 | ,
 |  | 0xd8 | ,
 |  | 0xb | ,
 |  | 0xb5 | ,
 |  | 0xfc | ,
 |  | 0x17 | ,
 |  | 0xdd | ,
 |  | 0x42 |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_GetFriendlyName | ,
 |  | 0x721099af | ,
 |  | 0x7cc8 | ,
 |  | 0x4f87 | ,
 |  | 0xa2 | ,
 |  | 0x13 | ,
 |  | 0x48 | ,
 |  | 0x72 | ,
 |  | 0x97 | ,
 |  | 0xf7 | ,
 |  | 0x19 | ,
 |  | 0x4f |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_Disk_Not_NTFS | ,
 |  | 0xf0493cc2 | ,
 |  | 0x90be | ,
 |  | 0x4199 | ,
 |  | 0x98 | ,
 |  | 0x47 | ,
 |  | 0xe7 | ,
 |  | 0x1b | ,
 |  | 0xed | ,
 |  | 0x99 | ,
 |  | 0xb | ,
 |  | 0x63 |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_Disk_No_File_System | ,
 |  | 0x6ea41d85 | ,
 |  | 0xb149 | ,
 |  | 0x406c | ,
 |  | 0x93 | ,
 |  | 0xc5 | ,
 |  | 0x59 | ,
 |  | 0x71 | ,
 |  | 0x8c | ,
 |  | 0x3e | ,
 |  | 0xfe | ,
 |  | 0x3c |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_SetWbemObject_Partition | ,
 |  | 0xcf4008b3 | ,
 |  | 0xe902 | ,
 |  | 0x4a54 | ,
 |  | 0x80 | ,
 |  | 0xdd | ,
 |  | 0x26 | ,
 |  | 0x95 | ,
 |  | 0x55 | ,
 |  | 0x7f | ,
 |  | 0x4f | ,
 |  | 0xcc |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_GetSize | ,
 |  | 0x8af69452 | ,
 |  | 0x886b | ,
 |  | 0x45ee | ,
 |  | 0xb4 | ,
 |  | 0xfd | ,
 |  | 0xd2 | ,
 |  | 0xfa | ,
 |  | 0x7f | ,
 |  | 0x47 | ,
 |  | 0xf4 | ,
 |  | 0xc4 |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_GetDriveLetterMappings_Partition | ,
 |  | 0x927ecc61 | ,
 |  | 0xe8b3 | ,
 |  | 0x4919 | ,
 |  | 0x88 | ,
 |  | 0xb7 | ,
 |  | 0x2e | ,
 |  | 0x89 | ,
 |  | 0x87 | ,
 |  | 0x47 | ,
 |  | 0x84 | ,
 |  | 0xab |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_PartitionInfo_GetDescription_Memory | ,
 |  | 0x6ca61237 | ,
 |  | 0xc4 | ,
 |  | 0x4e5b | ,
 |  | 0x90 | ,
 |  | 0xa0 | ,
 |  | 0x68 | ,
 |  | 0xe2 | ,
 |  | 0x63 | ,
 |  | 0x15 | ,
 |  | 0xd1 | ,
 |  | 0xfc |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_PartitionInfo_GetDescription_Pointer | ,
 |  | 0xebf09d63 | ,
 |  | 0x5d2 | ,
 |  | 0x4019 | ,
 |  | 0x9b | ,
 |  | 0x8a | ,
 |  | 0x4e | ,
 |  | 0xb0 | ,
 |  | 0x64 | ,
 |  | 0xaf | ,
 |  | 0x1 | ,
 |  | 0xf1 |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_PartitionInfo_GetName_Pointer | ,
 |  | 0x31729c01 | ,
 |  | 0xaac2 | ,
 |  | 0x4baa | ,
 |  | 0x86 | ,
 |  | 0xf4 | ,
 |  | 0xf6 | ,
 |  | 0xdc | ,
 |  | 0xdd | ,
 |  | 0xcb | ,
 |  | 0x70 | ,
 |  | 0xb |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_PartitionInfo_GetUID_Memory | ,
 |  | 0x5872713b | ,
 |  | 0x70e1 | ,
 |  | 0x4155 | ,
 |  | 0x89 | ,
 |  | 0x74 | ,
 |  | 0x20 | ,
 |  | 0x96 | ,
 |  | 0x97 | ,
 |  | 0x62 | ,
 |  | 0x7a | ,
 |  | 0xc6 |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_PartitionInfo_GetUID_Pointer | ,
 |  | 0x3704f82d | ,
 |  | 0x1b0e | ,
 |  | 0x4b2f | ,
 |  | 0xbd | ,
 |  | 0x33 | ,
 |  | 0x86 | ,
 |  | 0xe4 | ,
 |  | 0x4a | ,
 |  | 0xc9 | ,
 |  | 0xa5 | ,
 |  | 0x9b |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_SetWbemServices_Partition | ,
 |  | 0x65a8703b | ,
 |  | 0xd91a | ,
 |  | 0x4edc | ,
 |  | 0x86 | ,
 |  | 0x1d | ,
 |  | 0x1b | ,
 |  | 0xf3 | ,
 |  | 0x7a | ,
 |  | 0x3a | ,
 |  | 0xf | ,
 |  | 0x84 |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_StorageResourceType_CommitChanges | ,
 |  | 0xee6ab597 | ,
 |  | 0x5992 | ,
 |  | 0x4a86 | ,
 |  | 0xa7 | ,
 |  | 0x85 | ,
 |  | 0xc1 | ,
 |  | 0x43 | ,
 |  | 0xc7 | ,
 |  | 0x68 | ,
 |  | 0xdf | ,
 |  | 0xb7 |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_WQL_Disk_Qry_Next_Failed | ,
 |  | 0xcde9f8fc | ,
 |  | 0x5c95 | ,
 |  | 0x4e9a | ,
 |  | 0xb7 | ,
 |  | 0x3a | ,
 |  | 0x19 | ,
 |  | 0x80 | ,
 |  | 0x7d | ,
 |  | 0xa9 | ,
 |  | 0xf5 | ,
 |  | 0xa5 |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_HrGetDisks | ,
 |  | 0x25205b87 | ,
 |  | 0x3abe | ,
 |  | 0x4527 | ,
 |  | 0xb9 | ,
 |  | 0xb2 | ,
 |  | 0xc4 | ,
 |  | 0xd3 | ,
 |  | 0xe | ,
 |  | 0x46 | ,
 |  | 0xd2 | ,
 |  | 0x50 |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_StorageResource_Cluster_Capable | ,
 |  | 0x94fea8d6 | ,
 |  | 0xa61d | ,
 |  | 0x43aa | ,
 |  | 0x9c | ,
 |  | 0xd9 | ,
 |  | 0xe2 | ,
 |  | 0x2c | ,
 |  | 0x15 | ,
 |  | 0x32 | ,
 |  | 0xf7 | ,
 |  | 0xa1 |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_Pruning_CrashDump_Disk_Bus | ,
 |  | 0x32135624 | ,
 |  | 0xe54d | ,
 |  | 0x46c2 | ,
 |  | 0xa7 | ,
 |  | 0xee | ,
 |  | 0x70 | ,
 |  | 0x4d | ,
 |  | 0xe4 | ,
 |  | 0x16 | ,
 |  | 0xfb | ,
 |  | 0xe3 |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_Pruning_PageFile_Disk_Bus | ,
 |  | 0x95d0bdfa | ,
 |  | 0x579 | ,
 |  | 0x4b40 | ,
 |  | 0x8d | ,
 |  | 0xdb | ,
 |  | 0x4f | ,
 |  | 0x9b | ,
 |  | 0xca | ,
 |  | 0x9d | ,
 |  | 0x72 | ,
 |  | 0x5 |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_Non_SCSI_Disks | ,
 |  | 0xb8f5736b | ,
 |  | 0x2046 | ,
 |  | 0x4762 | ,
 |  | 0x81 | ,
 |  | 0x22 | ,
 |  | 0xc7 | ,
 |  | 0x37 | ,
 |  | 0xed | ,
 |  | 0x92 | ,
 |  | 0xbf | ,
 |  | 0x28 |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_WMI_Get_LogicalDisk_Failed | ,
 |  | 0xafcff8c7 | ,
 |  | 0xf83c | ,
 |  | 0x482e | ,
 |  | 0xbb | ,
 |  | 0xef | ,
 |  | 0x60 | ,
 |  | 0xfd | ,
 |  | 0xcd | ,
 |  | 0x4c | ,
 |  | 0xc4 | ,
 |  | 0x1a |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_HrIsLogicalDiskNTFS | ,
 |  | 0xcd5cbe2e | ,
 |  | 0x9a98 | ,
 |  | 0x4eac | ,
 |  | 0xbd | ,
 |  | 0xc3 | ,
 |  | 0x20 | ,
 |  | 0x19 | ,
 |  | 0x5c | ,
 |  | 0x21 | ,
 |  | 0x7a | ,
 |  | 0xd3 |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_HrIsLogicalDiskNTFS_InvalidArg | ,
 |  | 0x46597d45 | ,
 |  | 0x38d8 | ,
 |  | 0x4134 | ,
 |  | 0x9b | ,
 |  | 0x34 | ,
 |  | 0x97 | ,
 |  | 0xdd | ,
 |  | 0xc0 | ,
 |  | 0x94 | ,
 |  | 0xa8 | ,
 |  | 0x75 |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_HrAddObjectToArray | ,
 |  | 0x3e18b282 | ,
 |  | 0xddd5 | ,
 |  | 0x4eff | ,
 |  | 0x8a | ,
 |  | 0xce | ,
 |  | 0xbe | ,
 |  | 0x29 | ,
 |  | 0x48 | ,
 |  | 0x37 | ,
 |  | 0x2e | ,
 |  | 0x51 |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_Pruning_System_Disk_Bus | ,
 |  | 0x3c02daa7 | ,
 |  | 0x4c68 | ,
 |  | 0x4a68 | ,
 |  | 0xae | ,
 |  | 0x56 | ,
 |  | 0x45 | ,
 |  | 0x4f | ,
 |  | 0x26 | ,
 |  | 0xd6 | ,
 |  | 0xb8 | ,
 |  | 0xc6 |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_Pruning_Boot_Disk_Bus | ,
 |  | 0xc08826d6 | ,
 |  | 0xd99b | ,
 |  | 0x46d1 | ,
 |  | 0xa5 | ,
 |  | 0xe4 | ,
 |  | 0x99 | ,
 |  | 0x6b | ,
 |  | 0x8a | ,
 |  | 0xaa | ,
 |  | 0x33 | ,
 |  | 0x6d |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_Clone_Enum_StorageResource | ,
 |  | 0x75de3c02 | ,
 |  | 0x9df | ,
 |  | 0x4bb2 | ,
 |  | 0x99 | ,
 |  | 0xbd | ,
 |  | 0x83 | ,
 |  | 0xf | ,
 |  | 0x12 | ,
 |  | 0x2e | ,
 |  | 0xdb | ,
 |  | 0x87 |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_Next_Enum_StorageResource | ,
 |  | 0xac376681 | ,
 |  | 0x2a03 | ,
 |  | 0x4219 | ,
 |  | 0x93 | ,
 |  | 0xb | ,
 |  | 0x5b | ,
 |  | 0xcb | ,
 |  | 0xf4 | ,
 |  | 0x87 | ,
 |  | 0x84 | ,
 |  | 0xf3 |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_Boot_Partition_Not_NTFS | ,
 |  | 0xc08a253c | ,
 |  | 0xa491 | ,
 |  | 0x4a57 | ,
 |  | 0xb5 | ,
 |  | 0xb | ,
 |  | 0x1a | ,
 |  | 0xd2 | ,
 |  | 0xa3 | ,
 |  | 0x49 | ,
 |  | 0xda | ,
 |  | 0x57 |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_SetWbemServices_Enum_StorageResource | ,
 |  | 0x5d9625a4 | ,
 |  | 0x9de4 | ,
 |  | 0x4872 | ,
 |  | 0x95 | ,
 |  | 0x23 | ,
 |  | 0x26 | ,
 |  | 0x4e | ,
 |  | 0xd | ,
 |  | 0x83 | ,
 |  | 0xa | ,
 |  | 0xf |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_InitWbem_Enum_StorageResource | ,
 |  | 0xa07ceac4 | ,
 |  | 0x8c45 | ,
 |  | 0x4938 | ,
 |  | 0xb7 | ,
 |  | 0xf | ,
 |  | 0xf7 | ,
 |  | 0x5c | ,
 |  | 0xda | ,
 |  | 0xc7 | ,
 |  | 0x1e | ,
 |  | 0x18 |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_HrCreateFriendlyName_BSTR | ,
 |  | 0xe8cb2d98 | ,
 |  | 0x4634 | ,
 |  | 0x442b | ,
 |  | 0xbe | ,
 |  | 0xa5 | ,
 |  | 0xc9 | ,
 |  | 0xfc | ,
 |  | 0xac | ,
 |  | 0x8 | ,
 |  | 0x63 | ,
 |  | 0x4a |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_HrCreateFriendlyName_VOID | ,
 |  | 0x7f305e21 | ,
 |  | 0xd0bf | ,
 |  | 0x4821 | ,
 |  | 0xab | ,
 |  | 0x7e | ,
 |  | 0x25 | ,
 |  | 0x88 | ,
 |  | 0x1f | ,
 |  | 0xc5 | ,
 |  | 0xdb | ,
 |  | 0x2e |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_HrAddPartitionToArray | ,
 |  | 0xd099e738 | ,
 |  | 0x2d66 | ,
 |  | 0x4295 | ,
 |  | 0x9c | ,
 |  | 0x13 | ,
 |  | 0x8e | ,
 |  | 0x31 | ,
 |  | 0xc | ,
 |  | 0x78 | ,
 |  | 0xbf | ,
 |  | 0xb2 |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_WQL_Partition_Qry_Next_Failed | ,
 |  | 0x2865e3cf | ,
 |  | 0x251d | ,
 |  | 0x49d1 | ,
 |  | 0xbd | ,
 |  | 0x2 | ,
 |  | 0x4a | ,
 |  | 0x18 | ,
 |  | 0x7b | ,
 |  | 0xfe | ,
 |  | 0x6b | ,
 |  | 0x87 |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_WMI_DiskDrivePartitions_Qry_Failed | ,
 |  | 0xa63feba9 | ,
 |  | 0xb876 | ,
 |  | 0x458c | ,
 |  | 0x9d | ,
 |  | 0x46 | ,
 |  | 0x73 | ,
 |  | 0xe2 | ,
 |  | 0x9e | ,
 |  | 0x7d | ,
 |  | 0xfd | ,
 |  | 0x43 |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_HrGetPartitionInfo | ,
 |  | 0x25af944 | ,
 |  | 0x540e | ,
 |  | 0x4b60 | ,
 |  | 0xac | ,
 |  | 0x29 | ,
 |  | 0xb | ,
 |  | 0x41 | ,
 |  | 0x45 | ,
 |  | 0x87 | ,
 |  | 0x37 | ,
 |  | 0x19 |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_HrSetFriendlyName_StorageResource | ,
 |  | 0xe0a688f7 | ,
 |  | 0xe589 | ,
 |  | 0x4910 | ,
 |  | 0x85 | ,
 |  | 0x2e | ,
 |  | 0x7a | ,
 |  | 0x3b | ,
 |  | 0xd1 | ,
 |  | 0x4a | ,
 |  | 0x3a | ,
 |  | 0x14 |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_HrGetSignature_Pointer | ,
 |  | 0x8b37a3e0 | ,
 |  | 0xe23c | ,
 |  | 0x405e | ,
 |  | 0xa2 | ,
 |  | 0x89 | ,
 |  | 0xe8 | ,
 |  | 0x9f | ,
 |  | 0x9f | ,
 |  | 0x5e | ,
 |  | 0x81 | ,
 |  | 0x93 |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_HrGetDeviceID_Memory | ,
 |  | 0x401b7b17 | ,
 |  | 0xd44d | ,
 |  | 0x4d45 | ,
 |  | 0xa1 | ,
 |  | 0xa9 | ,
 |  | 0xc7 | ,
 |  | 0xdd | ,
 |  | 0x49 | ,
 |  | 0xfb | ,
 |  | 0xed | ,
 |  | 0xa3 |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_HrGetDeviceID_Pointer | ,
 |  | 0x800adb0b | ,
 |  | 0x7f9d | ,
 |  | 0x465b | ,
 |  | 0xb5 | ,
 |  | 0x7b | ,
 |  | 0xf3 | ,
 |  | 0xaf | ,
 |  | 0x46 | ,
 |  | 0xd6 | ,
 |  | 0x7e | ,
 |  | 0xc2 |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_HrGetSCSIPort | ,
 |  | 0x8979adbe | ,
 |  | 0x6211 | ,
 |  | 0x4e70 | ,
 |  | 0x85 | ,
 |  | 0x3 | ,
 |  | 0x5b | ,
 |  | 0x27 | ,
 |  | 0x94 | ,
 |  | 0x87 | ,
 |  | 0x12 | ,
 |  | 0x3f |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_HrGetSCSIBus | ,
 |  | 0x255d2fc8 | ,
 |  | 0xcf19 | ,
 |  | 0x44f5 | ,
 |  | 0xa5 | ,
 |  | 0x15 | ,
 |  | 0x75 | ,
 |  | 0x5 | ,
 |  | 0xc1 | ,
 |  | 0xf4 | ,
 |  | 0x4a | ,
 |  | 0xa |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_Clone_StorageResource | ,
 |  | 0xe78edbb5 | ,
 |  | 0x5804 | ,
 |  | 0x462e | ,
 |  | 0x87 | ,
 |  | 0xe | ,
 |  | 0x59 | ,
 |  | 0x9b | ,
 |  | 0xf8 | ,
 |  | 0x98 | ,
 |  | 0x45 | ,
 |  | 0x4c |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_StorageResource_No_Partitions | ,
 |  | 0xfe52b921 | ,
 |  | 0xc04b | ,
 |  | 0x47aa | ,
 |  | 0x8c | ,
 |  | 0xc6 | ,
 |  | 0xe3 | ,
 |  | 0x20 | ,
 |  | 0xaf | ,
 |  | 0x91 | ,
 |  | 0xd4 | ,
 |  | 0xbf |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_Next_StorageResource | ,
 |  | 0x9c22a873 | ,
 |  | 0x9152 | ,
 |  | 0x4b13 | ,
 |  | 0x91 | ,
 |  | 0x60 | ,
 |  | 0xcc | ,
 |  | 0xb9 | ,
 |  | 0xc9 | ,
 |  | 0x27 | ,
 |  | 0x90 | ,
 |  | 0x39 |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_SetWbemObject_StorageResource | ,
 |  | 0x6b10761b | ,
 |  | 0x5eca | ,
 |  | 0x4ce7 | ,
 |  | 0x8e | ,
 |  | 0x9d | ,
 |  | 0x7f | ,
 |  | 0xa8 | ,
 |  | 0xa0 | ,
 |  | 0x78 | ,
 |  | 0xb0 | ,
 |  | 0xd4 |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_StorageResource_Signature | ,
 |  | 0x626153a8 | ,
 |  | 0x4d | ,
 |  | 0x49aa | ,
 |  | 0xab | ,
 |  | 0x43 | ,
 |  | 0xdb | ,
 |  | 0x2f | ,
 |  | 0xf5 | ,
 |  | 0xa3 | ,
 |  | 0x3a | ,
 |  | 0x68 |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_SetWbemServices_StorageResource | ,
 |  | 0x64d8f134 | ,
 |  | 0x767 | ,
 |  | 0x4639 | ,
 |  | 0x9a | ,
 |  | 0x53 | ,
 |  | 0x3 | ,
 |  | 0x88 | ,
 |  | 0xce | ,
 |  | 0x67 | ,
 |  | 0x14 | ,
 |  | 0x5 |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_StorageResource_Create | ,
 |  | 0x1d87b8e | ,
 |  | 0xc74 | ,
 |  | 0x4871 | ,
 |  | 0xa4 | ,
 |  | 0xa3 | ,
 |  | 0x6e | ,
 |  | 0x57 | ,
 |  | 0x3f | ,
 |  | 0xca | ,
 |  | 0x52 | ,
 |  | 0x51 |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_StorageResource_PreCreate | ,
 |  | 0x5771ff41 | ,
 |  | 0x4b86 | ,
 |  | 0x44a3 | ,
 |  | 0x97 | ,
 |  | 0x6e | ,
 |  | 0x0 | ,
 |  | 0x64 | ,
 |  | 0xb | ,
 |  | 0x52 | ,
 |  | 0xaa | ,
 |  | 0xee |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_StorageResource_GetUID_Memory | ,
 |  | 0xa61d60c2 | ,
 |  | 0xabb4 | ,
 |  | 0x4296 | ,
 |  | 0xa4 | ,
 |  | 0x2a | ,
 |  | 0x68 | ,
 |  | 0x86 | ,
 |  | 0xe | ,
 |  | 0x97 | ,
 |  | 0xd2 | ,
 |  | 0xdd |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_StorageResource_GetUID_Pointer | ,
 |  | 0x47be7aa7 | ,
 |  | 0xa677 | ,
 |  | 0x42f5 | ,
 |  | 0x84 | ,
 |  | 0xc8 | ,
 |  | 0x8e | ,
 |  | 0x51 | ,
 |  | 0x91 | ,
 |  | 0x79 | ,
 |  | 0xfe | ,
 |  | 0x75 |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_SetName_StorageResource | ,
 |  | 0xe2986823 | ,
 |  | 0x149e | ,
 |  | 0x40a8 | ,
 |  | 0x86 | ,
 |  | 0x6 | ,
 |  | 0xb8 | ,
 |  | 0xed | ,
 |  | 0xf1 | ,
 |  | 0xd0 | ,
 |  | 0x78 | ,
 |  | 0x68 |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_GetName_Memory | ,
 |  | 0x2c130dbc | ,
 |  | 0xcdd3 | ,
 |  | 0x4e24 | ,
 |  | 0xa4 | ,
 |  | 0x28 | ,
 |  | 0xe2 | ,
 |  | 0x84 | ,
 |  | 0xb6 | ,
 |  | 0x4d | ,
 |  | 0x41 | ,
 |  | 0x1 |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_GetName_Pointer | ,
 |  | 0xfa2988e6 | ,
 |  | 0x51fc | ,
 |  | 0x47ce | ,
 |  | 0x86 | ,
 |  | 0x1e | ,
 |  | 0xce | ,
 |  | 0x7a | ,
 |  | 0x6e | ,
 |  | 0x9e | ,
 |  | 0xd6 | ,
 |  | 0xaf |
 | ) |  |
DEFINE_GUID | ( | TASKID_Minor_GetDriveLetterMappings_StorageResource | ,
 |  | 0xa52b9965 | ,
 |  | 0x6bf8 | ,
 |  | 0x4216 | ,
 |  | 0x8f | ,
 |  | 0xc9 | ,
 |  | 0x4 | ,
 |  | 0xe7 | ,
 |  | 0x15 | ,
 |  | 0x18 | ,
 |  | 0xd | ,
 |  | 0xd5 |
 | ) |  |
Generated on Wed Nov 13 2024 16:53:33 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyStorageResource/InsertionSort.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyStorageResource
Classes | Functions

InsertionSort.h File Reference

Go to the source code of this file.

Classes

struct | LessThan< Item >

Functions

template<class Item , class PredecessorFunction >
void | InsertionSort (Item *pArrayStartIn, size_t cArraySizeIn, const PredecessorFunction &rPrecedesIn)
template<class Item >
void | InsertionSort (Item *pBeginIn, size_t cArraySizeIn)

Function Documentation

template<class Item , class PredecessorFunction >
void InsertionSort | ( | Item * | pArrayStartIn,
 |  | size_t | cArraySizeIn,
 |  | const PredecessorFunction & | rPrecedesIn
 | ) |  |

Definition at line 70 of file InsertionSort.h.

{
    ASSERT( pArrayStartIn != NULL );

    Item * pCurrentItem;
    Item * pSortedLocation;
    Item * pNextToCopy;
    Item * pArrayEnd = pArrayStartIn + cArraySizeIn;

    //
    // Insertion sort algorithm; for a good description, see "Introduction to Algorithms"
    // by Cormen, Leiserson, and Rivest.
    //

    //
    //  Loop invariant: all items to the left of pCurrentItem are in sorted order.
    //  Arrays of size zero or one are considered to be already sorted, so start
    //  pCurrentItem at second element in the array (if more than one element exists).
    //
    for ( pCurrentItem = pArrayStartIn + 1; pCurrentItem < pArrayEnd; ++pCurrentItem )
    {
        //
        //  Find where the current item needs to go to make the loop invariant true for pCurrentItem + 1.
        //  This could be a binary search, but collections of large enough size that it matters
        //  should use a quick sort instead.
        //
        pSortedLocation = pCurrentItem;
        while ( ( pSortedLocation > pArrayStartIn )
            &&     rPrecedesIn( *pCurrentItem, *( pSortedLocation - 1 ) )
            )
        {
            --pSortedLocation;
        }

        // Does the current item need to move?
        if ( pSortedLocation != pCurrentItem )
        {
            // Store the current item.
            Item tempItem( *pCurrentItem ); // declared inline to avoid requiring default constructor for Item

            // Move all items in [pSortedLocation, pCurrentItem) to the right by one.
            for ( pNextToCopy = pCurrentItem ; pNextToCopy > pSortedLocation; --pNextToCopy )
            {
                *pNextToCopy = *( pNextToCopy - 1 );
            }

            // Copy the current item into its proper location
            *pSortedLocation = tempItem;

        } // if item not in sorted location

    } // for each item in array

} //*** InsertionSort

template<class Item >
void InsertionSort | ( | Item * | pBeginIn,
 |  | size_t | cArraySizeIn |
 | ) |  |  | [inline]

Definition at line 163 of file InsertionSort.h.

{
    InsertionSort( pBeginIn, cArraySizeIn, LessThan< Item >() );
}

Generated on Wed Nov 13 2024 16:55:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyStorageResource/MyStorageResource.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyStorageResource
Functions | Variables

MyStorageResource.cpp File Reference

#include "stdafx.h"
#include "CEnumStorageResource.h"
#include "CStorageResource.h"
#include "CStorageResType.h"
#include "CPartitionInfo.h"

Go to the source code of this file.

Functions

STDAPI | DllCanUnloadNow (void)
STDAPI | DllGetClassObject (REFCLSID rclsidIn, REFIID riidIn, LPVOID *ppvOut)
BOOL WINAPI | DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID pvReserved)
STDAPI | DllRegisterServer (void)
STDAPI | DllUnregisterServer (void)

Variables

CComModule | _Module

Function Documentation

STDAPI DllCanUnloadNow ( void )

Definition at line 101 of file MyStorageResource.cpp.

{
    return ( _Module.GetLockCount() == 0 ) ? S_OK : S_FALSE;

} //*** DllCanUnloadNow

STDAPI DllGetClassObject | ( | REFCLSID | rclsidIn,
 |  | REFIID | riidIn,
 |  | LPVOID * | ppvOut
 | ) |  |

Definition at line 127 of file MyStorageResource.cpp.

{
    return _Module.GetClassObject( rclsidIn, riidIn, ppvOut );

} //*** DllGetClassObject

BOOL WINAPI DllMain | ( | HINSTANCE | hInstance,
 |  | DWORD | dwReason,
 |  | LPVOID | pvReserved
 | ) |  |

Definition at line 60 of file MyStorageResource.cpp.

{
    UNREFERENCED_PARAMETER( pvReserved );

    if ( dwReason == DLL_PROCESS_ATTACH )
    {
        _Module.Init( ObjectMap, hInstance, &LIBID_MyStorageResourceLib );
        DisableThreadLibraryCalls( hInstance );
    } // if: we are being loaded
    else if ( dwReason == DLL_PROCESS_DETACH )
    {
        _Module.Term();
    } // else: we are being unloaded

    return TRUE;    // ok

} //*** DllMain

STDAPI DllRegisterServer ( void )

Definition at line 155 of file MyStorageResource.cpp.

{
    // registers object, typelib and all interfaces in typelib
    return _Module.RegisterServer( TRUE );

} //*** DllRegisterServer

STDAPI DllUnregisterServer ( void )

Definition at line 183 of file MyStorageResource.cpp.

{
    return _Module.UnregisterServer( TRUE );

} //*** DllUnregisterServer

Variable Documentation

CComModule _Module

Definition at line 25 of file MyStorageResource.cpp.

Generated on Wed Nov 13 2024 16:55:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyStorageResource/MyStorageResource.idl File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyStorageResource
Classes | Namespaces | Functions

MyStorageResource.idl File Reference

Go to the source code of this file.

Classes

interface | IPartitionProperties
interface | IStorageProperties
interface | IWMIObject
interface | IWMIServices
class | MyStorageResourceLib::CEnumStorageResource
class | MyStorageResourceLib::CPartitionInfo
class | MyStorageResourceLib::CStorageResource
class | MyStorageResourceLib::CStorageResType

Namespaces

namespace | MyStorageResourceLib

Functions

MyStorageResourceLib::importlib ("stdole32.tlb")
MyStorageResourceLib::importlib ("stdole2.tlb")
Generated on Wed Nov 13 2024 16:55:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyStorageResource/PropList.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyStorageResource
Classes | Variables

PropList.cpp File Reference

#include "stdafx.h"
#include "PropList.h"
#include <StrSafe.h>

Go to the source code of this file.

Classes

class | CMemoryException

Variables

const int | BUFFER_GROWTH_FACTOR = 256

Variable Documentation

const int BUFFER_GROWTH_FACTOR = 256

Definition at line 40 of file PropList.cpp.

Generated on Wed Nov 13 2024 16:54:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyStorageResource/PropList.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyStorageResource
Classes | Defines

PropList.h File Reference

#include <windows.h>
#include <clusapi.h>
#include <crtdbg.h>

Go to the source code of this file.

Classes

class | CClusPropList
class | CClusPropValueList

Defines

#define | ASSERT _ASSERTE

Define Documentation

#define ASSERT _ASSERTE

Definition at line 40 of file PropList.h.

Generated on Wed Nov 13 2024 16:54:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyStorageResource/resource.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyStorageResource
Defines

resource.h File Reference

Go to the source code of this file.

Defines

#define | IDR_CEnumStorageResource 101
#define | IDR_CPartitionInfo 104
#define | IDR_CStorageResource 102
#define | IDR_CStorageResType 103
#define | IDS_CONFIGURED_EXTENSION 4011
#define | IDS_CONFIGURED_RESTYPE 4010
#define | IDS_CONFIGURING_RESTYPE 4007
#define | IDS_CONFIGURING_RESTYPE_FAILED 4008
#define | IDS_DISK 301
#define | IDS_ENUMSTORAGERESOURCE_DESC 201
#define | IDS_ERROR_DISK_CLUSTER_CAPABLE 5111
#define | IDS_ERROR_DISK_CLUSTER_CAPABLE_REF 5112
#define | IDS_ERROR_DISK_NO_FILE_SYSTEM 5200
#define | IDS_ERROR_DISK_NO_FILE_SYSTEM_REF 5201
#define | IDS_ERROR_DISK_SIGNATURE 5102
#define | IDS_ERROR_DISK_SIGNATURE_REF 5103
#define | IDS_ERROR_FOUND_NON_SCSI_DISK 5014
#define | IDS_ERROR_FOUND_NON_SCSI_DISK_REF 5015
#define | IDS_ERROR_GETCOMPUTERNAME_FAILED 4005
#define | IDS_ERROR_INVALIDARG 5001
#define | IDS_ERROR_INVALIDARG_REF 5002
#define | IDS_ERROR_LDM_DISK 5022
#define | IDS_ERROR_LDM_DISK_REF 5023
#define | IDS_ERROR_NO_INTERFACE 4004
#define | IDS_ERROR_NULL_POINTER 4002
#define | IDS_ERROR_NULL_POINTER_REF 4003
#define | IDS_ERROR_OUTOFMEMORY 4000
#define | IDS_ERROR_OUTOFMEMORY_REF 4001
#define | IDS_ERROR_WBEM_CONNECTION_FAILURE 5206
#define | IDS_ERROR_WBEM_CONNECTION_FAILURE_REF 5207
#define | IDS_ERROR_WMI_DISKDRIVEPARTITIONS_QRY_FAILED 5107
#define | IDS_ERROR_WMI_DISKDRIVEPARTITIONS_QRY_FAILED_REF 5108
#define | IDS_ERROR_WMI_DISKS_QRY_FAILED 5204
#define | IDS_ERROR_WMI_DISKS_QRY_FAILED_REF 5205
#define | IDS_ERROR_WMI_GET_LOGICALDISK_FAILED 5011
#define | IDS_ERROR_WMI_GET_LOGICALDISK_FAILED_REF 5026
#define | IDS_ERROR_WQL_QRY_NEXT_FAILED 5109
#define | IDS_ERROR_WQL_QRY_NEXT_FAILED_REF 5110
#define | IDS_GPT 302
#define | IDS_INFO_BOOTDISK_PRUNED 5006
#define | IDS_INFO_BOOTDISK_PRUNED_REF 5007
#define | IDS_INFO_CRASHDUMPDISK_PRUNED 5020
#define | IDS_INFO_CRASHDUMPDISK_PRUNED_REF 5021
#define | IDS_INFO_DISK_CLUSTER_CAPABLE 5104
#define | IDS_INFO_DISK_CREATE 5100
#define | IDS_INFO_DISK_NOT_CLUSTER_CAPABLE 5105
#define | IDS_INFO_DISK_NOT_CLUSTER_CAPABLE_REF 5106
#define | IDS_INFO_DISK_PRECREATE 5101
#define | IDS_INFO_GPT_DISK 5024
#define | IDS_INFO_GPT_DISK_REF 5025
#define | IDS_INFO_NON_SCSI_DISKS 5012
#define | IDS_INFO_NON_SCSI_DISKS_REF 5013
#define | IDS_INFO_PAGEFILEDISK_PRUNED 5017
#define | IDS_INFO_PAGEFILEDISK_PRUNED_REF 5018
#define | IDS_INFO_PRUNING_BOOTDISK_BUS 5005
#define | IDS_INFO_PRUNING_CRASHDUMP_BUS 5019
#define | IDS_INFO_PRUNING_PAGEFILEDISK_BUS 5016
#define | IDS_INFO_PRUNING_SYSTEMDISK_BUS 5008
#define | IDS_INFO_SYSTEMDISK_PRUNED 5009
#define | IDS_INFO_SYSTEMDISK_PRUNED_REF 5010
#define | IDS_LDM 303
#define | IDS_PARTITIONINFO_DESC 204
#define | IDS_PROJNAME 200
#define | IDS_RESOURCE_DESCRIPTION 4006
#define | IDS_RESTYPE_DISPLAYNAME 300
#define | IDS_STORAGERESOURCE_DESC 202
#define | IDS_STORAGERESTYPE_DESC 203
#define | IDS_WARN_BOOT_PARTITION_NOT_NTFS 5003
#define | IDS_WARN_BOOT_PARTITION_NOT_NTFS_REF 5004
#define | IDS_WARN_DISK_NOT_NTFS 5202
#define | IDS_WARN_DISK_NOT_NTFS_REF 5203

Define Documentation

#define IDR_CEnumStorageResource 101

Definition at line 5 of file resource.h.

#define IDR_CPartitionInfo 104

Definition at line 8 of file resource.h.

#define IDR_CStorageResource 102

Definition at line 6 of file resource.h.

#define IDR_CStorageResType 103

Definition at line 7 of file resource.h.

#define IDS_CONFIGURED_EXTENSION 4011

Definition at line 31 of file resource.h.

#define IDS_CONFIGURED_RESTYPE 4010

Definition at line 30 of file resource.h.

#define IDS_CONFIGURING_RESTYPE 4007

Definition at line 28 of file resource.h.

#define IDS_CONFIGURING_RESTYPE_FAILED 4008

Definition at line 29 of file resource.h.

#define IDS_DISK 301

Definition at line 17 of file resource.h.

#define IDS_ENUMSTORAGERESOURCE_DESC 201

Definition at line 11 of file resource.h.

#define IDS_ERROR_DISK_CLUSTER_CAPABLE 5111

Definition at line 69 of file resource.h.

#define IDS_ERROR_DISK_CLUSTER_CAPABLE_REF 5112

Definition at line 70 of file resource.h.

#define IDS_ERROR_DISK_NO_FILE_SYSTEM 5200

Definition at line 71 of file resource.h.

#define IDS_ERROR_DISK_NO_FILE_SYSTEM_REF 5201

Definition at line 72 of file resource.h.

#define IDS_ERROR_DISK_SIGNATURE 5102

Definition at line 60 of file resource.h.

#define IDS_ERROR_DISK_SIGNATURE_REF 5103

Definition at line 61 of file resource.h.

#define IDS_ERROR_FOUND_NON_SCSI_DISK 5014

Definition at line 45 of file resource.h.

#define IDS_ERROR_FOUND_NON_SCSI_DISK_REF 5015

Definition at line 46 of file resource.h.

#define IDS_ERROR_GETCOMPUTERNAME_FAILED 4005

Definition at line 26 of file resource.h.

#define IDS_ERROR_INVALIDARG 5001

Definition at line 32 of file resource.h.

#define IDS_ERROR_INVALIDARG_REF 5002

Definition at line 33 of file resource.h.

#define IDS_ERROR_LDM_DISK 5022

Definition at line 53 of file resource.h.

#define IDS_ERROR_LDM_DISK_REF 5023

Definition at line 54 of file resource.h.

#define IDS_ERROR_NO_INTERFACE 4004

Definition at line 25 of file resource.h.

#define IDS_ERROR_NULL_POINTER 4002

Definition at line 23 of file resource.h.

#define IDS_ERROR_NULL_POINTER_REF 4003

Definition at line 24 of file resource.h.

#define IDS_ERROR_OUTOFMEMORY 4000

Definition at line 21 of file resource.h.

#define IDS_ERROR_OUTOFMEMORY_REF 4001

Definition at line 22 of file resource.h.

#define IDS_ERROR_WBEM_CONNECTION_FAILURE 5206

Definition at line 77 of file resource.h.

#define IDS_ERROR_WBEM_CONNECTION_FAILURE_REF 5207

Definition at line 78 of file resource.h.

#define IDS_ERROR_WMI_DISKDRIVEPARTITIONS_QRY_FAILED 5107

Definition at line 65 of file resource.h.

#define IDS_ERROR_WMI_DISKDRIVEPARTITIONS_QRY_FAILED_REF 5108

Definition at line 66 of file resource.h.

#define IDS_ERROR_WMI_DISKS_QRY_FAILED 5204

Definition at line 75 of file resource.h.

#define IDS_ERROR_WMI_DISKS_QRY_FAILED_REF 5205

Definition at line 76 of file resource.h.

#define IDS_ERROR_WMI_GET_LOGICALDISK_FAILED 5011

Definition at line 42 of file resource.h.

#define IDS_ERROR_WMI_GET_LOGICALDISK_FAILED_REF 5026

Definition at line 57 of file resource.h.

#define IDS_ERROR_WQL_QRY_NEXT_FAILED 5109

Definition at line 67 of file resource.h.

#define IDS_ERROR_WQL_QRY_NEXT_FAILED_REF 5110

Definition at line 68 of file resource.h.

#define IDS_GPT 302

Definition at line 18 of file resource.h.

#define IDS_INFO_BOOTDISK_PRUNED 5006

Definition at line 37 of file resource.h.

#define IDS_INFO_BOOTDISK_PRUNED_REF 5007

Definition at line 38 of file resource.h.

#define IDS_INFO_CRASHDUMPDISK_PRUNED 5020

Definition at line 51 of file resource.h.

#define IDS_INFO_CRASHDUMPDISK_PRUNED_REF 5021

Definition at line 52 of file resource.h.

#define IDS_INFO_DISK_CLUSTER_CAPABLE 5104

Definition at line 62 of file resource.h.

#define IDS_INFO_DISK_CREATE 5100

Definition at line 58 of file resource.h.

#define IDS_INFO_DISK_NOT_CLUSTER_CAPABLE 5105

Definition at line 63 of file resource.h.

#define IDS_INFO_DISK_NOT_CLUSTER_CAPABLE_REF 5106

Definition at line 64 of file resource.h.

#define IDS_INFO_DISK_PRECREATE 5101

Definition at line 59 of file resource.h.

#define IDS_INFO_GPT_DISK 5024

Definition at line 55 of file resource.h.

#define IDS_INFO_GPT_DISK_REF 5025

Definition at line 56 of file resource.h.

#define IDS_INFO_NON_SCSI_DISKS 5012

Definition at line 43 of file resource.h.

#define IDS_INFO_NON_SCSI_DISKS_REF 5013

Definition at line 44 of file resource.h.

#define IDS_INFO_PAGEFILEDISK_PRUNED 5017

Definition at line 48 of file resource.h.

#define IDS_INFO_PAGEFILEDISK_PRUNED_REF 5018

Definition at line 49 of file resource.h.

#define IDS_INFO_PRUNING_BOOTDISK_BUS 5005

Definition at line 36 of file resource.h.

#define IDS_INFO_PRUNING_CRASHDUMP_BUS 5019

Definition at line 50 of file resource.h.

#define IDS_INFO_PRUNING_PAGEFILEDISK_BUS 5016

Definition at line 47 of file resource.h.

#define IDS_INFO_PRUNING_SYSTEMDISK_BUS 5008

Definition at line 39 of file resource.h.

#define IDS_INFO_SYSTEMDISK_PRUNED 5009

Definition at line 40 of file resource.h.

#define IDS_INFO_SYSTEMDISK_PRUNED_REF 5010

Definition at line 41 of file resource.h.

#define IDS_LDM 303

Definition at line 19 of file resource.h.

#define IDS_PARTITIONINFO_DESC 204

Definition at line 14 of file resource.h.

#define IDS_PROJNAME 200

Definition at line 10 of file resource.h.

#define IDS_RESOURCE_DESCRIPTION 4006

Definition at line 27 of file resource.h.

#define IDS_RESTYPE_DISPLAYNAME 300

Definition at line 16 of file resource.h.

#define IDS_STORAGERESOURCE_DESC 202

Definition at line 12 of file resource.h.

#define IDS_STORAGERESTYPE_DESC 203

Definition at line 13 of file resource.h.

#define IDS_WARN_BOOT_PARTITION_NOT_NTFS 5003

Definition at line 34 of file resource.h.

#define IDS_WARN_BOOT_PARTITION_NOT_NTFS_REF 5004

Definition at line 35 of file resource.h.

#define IDS_WARN_DISK_NOT_NTFS 5202

Definition at line 73 of file resource.h.

#define IDS_WARN_DISK_NOT_NTFS_REF 5203

Definition at line 74 of file resource.h.

Generated on Wed Nov 13 2024 16:52:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyStorageResource/SIndexedDisk.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyStorageResource

SIndexedDisk.cpp File Reference

#include "stdafx.h"
#include "SIndexedDisk.h"

Go to the source code of this file.

Generated on Wed Nov 13 2024 16:55:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyStorageResource/SIndexedDisk.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyStorageResource
Classes

SIndexedDisk.h File Reference

#include "stdafx.h"

Go to the source code of this file.

Classes

struct | SIndexedDisk
struct | SIndexedDiskLessThan
Generated on Wed Nov 13 2024 16:55:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyStorageResource/StdAfx.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyStorageResource
Functions

StdAfx.cpp File Reference

#include "stdafx.h"
#include "MyStorageResource_i.c"

Go to the source code of this file.

Functions

HRESULT HrSetInitialize (IUnknown *punkIn, IClusCfgCallback *picccIn, LCID lcidIn)

Function Documentation

HRESULT HrSetInitialize | ( | IUnknown * | punkIn,
 |  | IClusCfgCallback * | picccIn,
 |  | LCID | lcidIn
 | ) |  |

Definition at line 60 of file StdAfx.cpp.

{
    assert( punkIn != NULL );

    HRESULT                 hr;
    IClusCfgInitialize *    pcci = NULL;
    IUnknown *              punkCallback = NULL;

    //
    // Make sure required arguments were specified.
    //

    if ( punkIn == NULL )
    {
        hr = E_INVALIDARG;
        goto Cleanup;
    } // if:

    //
    // If a callback interface was specified, get an IUnknown pointer
    // to pass to the specified object.
    //

    if ( picccIn != NULL )
    {
        hr = picccIn->TypeSafeQI( IUnknown, &punkCallback );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:
    } // if: callback interface was specified

    //
    // Query the object for the IClusCfgInitialize interface and call
    // the Initialize method if successful.
    //

    hr = punkIn->TypeSafeQI( IClusCfgInitialize, &pcci );
    if ( SUCCEEDED( hr ) )
    {
        hr = pcci->Initialize( punkCallback, lcidIn );
        pcci->Release();
    } // if:
    else if ( hr == E_NOINTERFACE )
    {
        hr = S_OK;
    } // else if:

Cleanup:

    if ( punkCallback != NULL )
    {
        punkCallback->Release();
    } // if:

    return hr;

} //*** HrSetInitialize

Generated on Wed Nov 13 2024 16:53:05 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyStorageResource/StdAfx.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyStorageResource
Defines | Functions | Variables

StdAfx.h File Reference

#include <atlbase.h>
#include <Windows.h>
#include <atlcom.h>
#include <ClusCfgServer.h>
#include <ClusCfgGuids.h>
#include <clusapi.h>
#include <assert.h>
#include <WBemCli.h>
#include "MyStorageResource.h"
#include <strsafe.h>
#include "StringUtils.h"
#include "resource.h"
#include "guids.h"
#include "common.h"
#include "resource.h"

Go to the source code of this file.

Defines

#define | _ATL_APARTMENT_THREADED
#define | _WIN32_WINNT 0x0502
#define | HEAPREALLOC(_pvMem, _uBytes, _uFlags)
#define | RESTYPE_DLL_NAME L"clusres.dll"
#define | RESTYPE_NAME L"Physical Disk"
#define | RTL_NUMBER_OF(A) (sizeof(A)/sizeof((A)[0]))
#define | TypeSafeParams(_interface, _ppunk) IID_##_interface, reinterpret_cast< void ** >( static_cast< _interface ** >( _ppunk ) )
#define | TypeSafeQI(_interface, _ppunk) QueryInterface( TypeSafeParams( _interface, _ppunk ) )

Functions

HRESULT | HrSetInitialize (IUnknown *punkIn, IClusCfgCallback *picccIn, LCID lcidIn)

Variables

CComModule | _Module
const HRESULT | E_PROPTYPEMISMATCH = HRESULT_FROM_WIN32( ERROR_CLUSTER_PROPERTY_DATA_TYPE_MISMATCH )

Define Documentation

#define _ATL_APARTMENT_THREADED

Definition at line 42 of file StdAfx.h.

#define _WIN32_WINNT 0x0502

Definition at line 33 of file StdAfx.h.

#define HEAPREALLOC | ( | _pvMem,
 |  | _uBytes,
 |  | _uFlags
 | ) |
Value:
( ( _pvMem == NULL ) \
                                                    ? HeapAlloc( GetProcessHeap(), _uFlags, _uBytes ) \
                                                    : HeapReAlloc( GetProcessHeap(), _uFlags, _pvMem, _uBytes ) )

Definition at line 119 of file StdAfx.h.

#define RESTYPE_DLL_NAME L"clusres.dll"

Definition at line 147 of file StdAfx.h.

#define RESTYPE_NAME L"Physical Disk"

Definition at line 137 of file StdAfx.h.

#define RTL_NUMBER_OF ( A ) (sizeof(A)/sizeof((A)[0]))

Definition at line 91 of file StdAfx.h.

#define TypeSafeParams | ( | _interface,
 |  | _ppunk |
 | ) |  | IID_##_interface, reinterpret_cast< void ** >( static_cast< _interface ** >( _ppunk ) )

Definition at line 99 of file StdAfx.h.

#define TypeSafeQI | ( | _interface,
 |  | _ppunk |
 | ) |  | QueryInterface( TypeSafeParams( _interface, _ppunk ) )

Definition at line 104 of file StdAfx.h.

Function Documentation

HRESULT HrSetInitialize | ( | IUnknown * | punkIn,
 |  | IClusCfgCallback * | picccIn,
 |  | LCID | lcidIn
 | ) |  |

Definition at line 60 of file StdAfx.cpp.

{
    assert( punkIn != NULL );

    HRESULT                 hr;
    IClusCfgInitialize *    pcci = NULL;
    IUnknown *              punkCallback = NULL;

    //
    // Make sure required arguments were specified.
    //

    if ( punkIn == NULL )
    {
        hr = E_INVALIDARG;
        goto Cleanup;
    } // if:

    //
    // If a callback interface was specified, get an IUnknown pointer
    // to pass to the specified object.
    //

    if ( picccIn != NULL )
    {
        hr = picccIn->TypeSafeQI( IUnknown, &punkCallback );
        if ( FAILED( hr ) )
        {
            goto Cleanup;
        } // if:
    } // if: callback interface was specified

    //
    // Query the object for the IClusCfgInitialize interface and call
    // the Initialize method if successful.
    //

    hr = punkIn->TypeSafeQI( IClusCfgInitialize, &pcci );
    if ( SUCCEEDED( hr ) )
    {
        hr = pcci->Initialize( punkCallback, lcidIn );
        pcci->Release();
    } // if:
    else if ( hr == E_NOINTERFACE )
    {
        hr = S_OK;
    } // else if:

Cleanup:

    if ( punkCallback != NULL )
    {
        punkCallback->Release();
    } // if:

    return hr;

} //*** HrSetInitialize

Variable Documentation

CComModule _Module

Definition at line 42 of file ComSpy.Cpp.

const HRESULT E_PROPTYPEMISMATCH = HRESULT_FROM_WIN32( ERROR_CLUSTER_PROPERTY_DATA_TYPE_MISMATCH )

Definition at line 111 of file StdAfx.h.

Generated on Wed Nov 13 2024 16:53:06 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyStorageResource/StringUtils.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyStorageResource
Functions

StringUtils.cpp File Reference

#include "StdAfx.h"

Go to the source code of this file.

Functions

int | BSTRCompareW (BSTR bstrString1In, BSTR bstrString2In)
HRESULT | HrFormatStringIntoBSTR (LPCWSTR pcwszFmtIn, BSTR *pbstrInout,...)
HRESULT | HrFormatStringIntoBSTR (HINSTANCE hInstanceIn, LANGID langidIn, UINT idsIn, BSTR *pbstrInout,...)
HRESULT | HrFormatStringWithVAListIntoBSTR (HINSTANCE hInstanceIn, LANGID langidIn, UINT idsIn, BSTR *pbstrInout, va_list valistIn)
HRESULT | HrFormatStringWithVAListIntoBSTR (LPCWSTR pcwszFmtIn, BSTR *pbstrInout, va_list valistIn)
HRESULT | HrLoadStringIntoBSTR (HINSTANCE hInstanceIn, LANGID langidIn, UINT idsIn, BSTR *pbstrInout)
int | IBSTRCompareW (BSTR bstrString1In, BSTR bstrString2In)
int | IStringCompareW (LPCWSTR pcwszString1In, LPCWSTR pcwszString2In)
int | IStringCompareW (LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)
int | NBSTRCompareW (BSTR bstrString1In, BSTR bstrString2In)
int | NIBSTRCompareW (BSTR bstrString1In, BSTR bstrString2In)
int | NIStringCompareW (LPCWSTR pcwszString1In, LPCWSTR pcwszString2In, size_t cchIn)
int | NIStringCompareW (LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)
int | NStringCompareW (LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)
int | NStringCompareW (LPCWSTR pcwszString1In, LPCWSTR pcwszString2In, size_t cchIn)
int | StringCompareW (LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)
int | StringCompareW (LPCWSTR pcwszString1In, LPCWSTR pcwszString2In)
int | WrapCompareString (BOOL fCaseSensitive, LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)

Function Documentation

int BSTRCompareW | ( | BSTR | bstrString1In,
 |  | BSTR | bstrString2In
 | ) |  |

Definition at line 93 of file StringUtils.cpp.

{
    return WrapCompareString(
                  TRUE
                , static_cast< LPCWSTR >( bstrString1In )
                , SysStringLen( bstrString1In )
                , static_cast< LPCWSTR >( bstrString2In )
                , SysStringLen( bstrString2In )
                );
} //*** BSTRCompareW

HRESULT HrFormatStringIntoBSTR | ( | LPCWSTR | pcwszFmtIn,
 |  | BSTR * | pbstrInout,
 |  |  | ...
 | ) |  |

Definition at line 766 of file StringUtils.cpp.

{
    HRESULT hr = S_OK;
    va_list valist;

    va_start( valist, pbstrInout );

    hr = HrFormatStringWithVAListIntoBSTR( pcwszFmtIn, pbstrInout, valist );

    va_end( valist );

    return hr;

} //*** HrFormatStringIntoBSTR

HRESULT HrFormatStringIntoBSTR | ( | HINSTANCE | hInstanceIn,
 |  | LANGID | langidIn,
 |  | UINT | idsIn,
 |  | BSTR * | pbstrInout,
 |  |  | ...
 | ) |  |

Definition at line 571 of file StringUtils.cpp.

{
    HRESULT hr;
    va_list valist;

    va_start( valist, pbstrInout );

    hr = HrFormatStringWithVAListIntoBSTR(
                          hInstanceIn
                        , langidIn
                        , idsIn
                        , pbstrInout
                        , valist
                        );

    va_end( valist );

    return hr;

} //*** HrFormatStringIntoBSTR

HRESULT HrFormatStringWithVAListIntoBSTR | ( | HINSTANCE | hInstanceIn,
 |  | LANGID | langidIn,
 |  | UINT | idsIn,
 |  | BSTR * | pbstrInout,
 |  | va_list | valistIn
 | ) |  |

Definition at line 644 of file StringUtils.cpp.

{
    HRESULT hr = S_OK;
    BSTR    bstrStringResource = NULL;
    DWORD   cch;
    LPWSTR  pwsz = NULL;

    assert( pbstrInout != NULL );

    if ( pbstrInout == NULL )
    {
        hr = E_POINTER;
        goto Cleanup;
    } // if:

    //
    // Load the string resource.
    //

    hr = HrLoadStringIntoBSTR( hInstanceIn, langidIn, idsIn, &bstrStringResource );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    //
    // Format the message with the arguments.
    //

    cch = FormatMessage(
                      ( FORMAT_MESSAGE_ALLOCATE_BUFFER
                      | FORMAT_MESSAGE_FROM_STRING )
                    , bstrStringResource
                    , 0
                    , 0
                    , (LPWSTR) &pwsz
                    , 0
                    , &valistIn
                    );
    if ( cch == 0 )
    {
        hr = HRESULT_FROM_WIN32( GetLastError() );
        goto Cleanup;
    } // if:

    //
    // If previously allocated free it before re-allocating it.
    //

    if ( *pbstrInout != NULL )
    {
        SysFreeString( *pbstrInout );
        *pbstrInout = NULL;
    } // if:

    //
    // Allocate a BSTR for the string.
    //

    *pbstrInout = SysAllocStringLen( pwsz, cch );
    if ( *pbstrInout == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if:

Cleanup:

    SysFreeString( bstrStringResource );
    LocalFree( pwsz );

    return hr;

} //*** HrFormatStringWithVAListIntoBSTR

HRESULT HrFormatStringWithVAListIntoBSTR | ( | LPCWSTR | pcwszFmtIn,
 |  | BSTR * | pbstrInout,
 |  | va_list | valistIn
 | ) |  |

Definition at line 824 of file StringUtils.cpp.

{
    HRESULT hr = S_OK;
    DWORD   cch;
    LPWSTR  pwsz = NULL;

    if (    ( pbstrInout == NULL )
        ||  ( pcwszFmtIn == NULL )
       )
    {
        hr = E_POINTER;
        goto Cleanup;
    } // if:

    //
    // Format the message with the arguments.
    //

    cch = FormatMessage(
                      ( FORMAT_MESSAGE_ALLOCATE_BUFFER
                      | FORMAT_MESSAGE_FROM_STRING )
                    , pcwszFmtIn
                    , 0
                    , 0
                    , (LPWSTR) &pwsz
                    , 0
                    , &valistIn
                    );
    if ( cch == 0 )
    {
        hr = HRESULT_FROM_WIN32( GetLastError() );
        goto Cleanup;
    } // if:

    //
    // If previously allocated free it before re-allocating it.
    //

    if ( *pbstrInout != NULL )
    {
        SysFreeString( *pbstrInout );
        *pbstrInout = NULL;
    } // if:

    //
    // Allocate a BSTR for the string.
    //

    *pbstrInout = SysAllocStringLen( pwsz, cch );
    if ( *pbstrInout == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if:

Cleanup:

    LocalFree( pwsz );

    return hr;

} //*** HrFormatStringWithVAListIntoBSTR

HRESULT HrLoadStringIntoBSTR | ( | HINSTANCE | hInstanceIn,
 |  | LANGID | langidIn,
 |  | UINT | idsIn,
 |  | BSTR * | pbstrInout
 | ) |  |

Definition at line 334 of file StringUtils.cpp.

{
    HRESULT hr              = S_OK;
    HRSRC   hrsrc           = NULL;
    HGLOBAL hgbl            = NULL;
    int     cch             = 0;
    PBYTE   pbStringData;
    PBYTE   pbStringDataMax;
    PBYTE   pbStringTable;
    int     cbStringTable;
    int     nTable;
    int     nOffset;
    int     idxString;

    assert( idsIn != 0 );
    assert( pbstrInout != NULL );

    if ( pbstrInout == NULL )
    {
        hr = E_POINTER;
        goto Cleanup;
    } // if:

    if ( hInstanceIn == NULL )
    {
        hInstanceIn = _Module.m_hInstResource;
    } // if:

    //
    //  The resource Id specified must be converted to an index into
    //  a Windows StringTable.
    //

    nTable = idsIn / 16;
    nOffset = idsIn - (nTable * 16);

    //
    //  Internal Table Id's start at 1 not 0.
    //

    nTable++;

    //
    // Find the part of the string table where the string resides.
    //

    //
    //  Find the table containing the string.
    // First try to load the language specified.  If we can't find it we
    // try the "neutral" language.
    //

    hrsrc = FindResourceEx( hInstanceIn, RT_STRING, MAKEINTRESOURCE( nTable ), langidIn );
    if ( ( hrsrc == NULL ) && ( GetLastError() == ERROR_RESOURCE_LANG_NOT_FOUND ) )
    {
        hrsrc = FindResourceEx(
                      hInstanceIn
                    , RT_STRING
                    , MAKEINTRESOURCE( nTable )
                    , MAKELANGID( LANG_NEUTRAL, SUBLANG_NEUTRAL )
                    );
    } // if: FindResourceEx failed

    if ( hrsrc == NULL )
    {
        hr = HRESULT_FROM_WIN32( GetLastError() );
        goto Cleanup;
    } // if:

    //
    //  Load the table.
    //

    hgbl = LoadResource( hInstanceIn, hrsrc );
    if ( hgbl == NULL )
    {
        hr = HRESULT_FROM_WIN32( GetLastError() );
        goto Cleanup;
    } // if:

    //
    //  Lock the table so we access its data.
    //

    pbStringTable = reinterpret_cast< PBYTE >( LockResource( hgbl ) );
    if ( pbStringTable == NULL )
    {
        hr = HRESULT_FROM_WIN32( GetLastError() );
        goto Cleanup;
    } // if:

    cbStringTable = SizeofResource( hInstanceIn, hrsrc );
    assert( cbStringTable != 0 );

    //
    //  Set the data pointer to the beginning of the table.
    //

    pbStringData = pbStringTable;
    pbStringDataMax = pbStringTable + cbStringTable;

    //
    // Skip strings in the block of 16 which are before the desired string.
    //

    for ( idxString = 0 ; idxString <= nOffset ; idxString++ )
    {
        assert( pbStringData != NULL );
        assert( pbStringData < pbStringDataMax );

        //
        //  Get the number of characters excluding the '\0'.
        //

        cch = * ( (USHORT *) pbStringData );

        //
        //  Found the string.
        //

        if ( idxString == nOffset )
        {
            if ( cch == 0 )
            {
                hr = HRESULT_FROM_WIN32( ERROR_RESOURCE_NAME_NOT_FOUND );
                goto Cleanup;
            } // if:

            //
            //  Skip over the string length to get the string.
            //

            pbStringData += sizeof( WCHAR );

            break;
        } // if: found the string

        //
        //  Add one to account for the string length.
        //  A string length of 0 still takes 1 WCHAR for the length portion.
        //

        cch++;

        //
        //  Skip over this string to get to the next string.
        //

        pbStringData += ( cch * sizeof( WCHAR ) );

    } // for: each string in the block of 16 strings in the table

    //
    //  Note: nStringLen is the number of characters in the string not including the '\0'.
    //

    //
    // If previously allocated free it before re-allocating it.
    //

    if ( *pbstrInout != NULL )
    {
        SysFreeString( *pbstrInout );
        *pbstrInout = NULL;
    } // if: string was allocated previously

    //
    // Allocate a BSTR for the string.
    //

    *pbstrInout = SysAllocStringLen( (OLECHAR *) pbStringData, cch );
    if ( *pbstrInout == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if:

Cleanup:

    return hr;

} //*** HrLoadStringIntoBSTR

int IBSTRCompareW | ( | BSTR | bstrString1In,
 |  | BSTR | bstrString2In
 | ) |  |

Definition at line 78 of file StringUtils.cpp.

{
    return WrapCompareString(
                  FALSE
                , static_cast< LPCWSTR >( bstrString1In )
                , SysStringLen( bstrString1In )
                , static_cast< LPCWSTR >( bstrString2In )
                , SysStringLen( bstrString2In )
                );
} //*** IBSTRCompareW

int IStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | LPCWSTR | pcwszString2In
 | ) |  |

Definition at line 108 of file StringUtils.cpp.

{
    return WrapCompareString(
                  FALSE
                , pcwszString1In
                , static_cast< size_t >( -1 )
                , pcwszString2In
                , static_cast< size_t >( -1 )
            );
} //*** IStringCompareW

int IStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 138 of file StringUtils.cpp.

{
    return WrapCompareString(
                  FALSE
                , pcwszString1In
                , cch1In
                , pcwszString2In
                , cch2In
                );
} //*** IStringCompareW

int NBSTRCompareW | ( | BSTR | bstrString1In,
 |  | BSTR | bstrString2In
 | ) |  |

Definition at line 196 of file StringUtils.cpp.

{
    size_t cchMin;

    cchMin = min( SysStringLen( bstrString1In ), SysStringLen( bstrString2In ) );

    return WrapCompareString(
                  TRUE
                , static_cast< LPCWSTR >( bstrString1In )
                , cchMin
                , static_cast< LPCWSTR >( bstrString2In )
                , cchMin
                );
} //*** NBSTRCompareW

int NIBSTRCompareW | ( | BSTR | bstrString1In,
 |  | BSTR | bstrString2In
 | ) |  |

Definition at line 177 of file StringUtils.cpp.

{
    size_t cchMin;

    cchMin = min( SysStringLen( bstrString1In ), SysStringLen( bstrString2In ) );

    return WrapCompareString(
                  FALSE
                , static_cast< LPCWSTR >( bstrString1In )
                , cchMin
                , static_cast< LPCWSTR >( bstrString2In )
                , cchMin
                );
} //*** NIBSTRCompareW

int NIStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cchIn
 | ) |  |

Definition at line 215 of file StringUtils.cpp.

{
    return WrapCompareString(
                  FALSE
                , pcwszString1In
                , cchIn
                , pcwszString2In
                , cchIn
                );
} //*** NIStringCompareW

int NIStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 247 of file StringUtils.cpp.

{
    return WrapCompareString(
                  FALSE
                , pcwszString1In
                , min( cch1In, cch2In )
                , pcwszString2In
                , min( cch1In, cch2In )
                );
} //*** NIStringCompareW

int NStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 264 of file StringUtils.cpp.

{
    return WrapCompareString(
                  TRUE
                , pcwszString1In
                , min( cch1In, cch2In )
                , pcwszString2In
                , min( cch1In, cch2In )
                );
} //*** NStringCompareW

int NStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cchIn
 | ) |  |

Definition at line 231 of file StringUtils.cpp.

{
    return WrapCompareString(
                  TRUE
                , pcwszString1In
                , cchIn
                , pcwszString2In
                , cchIn
                );
} //*** NIStringCompareW

int StringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 155 of file StringUtils.cpp.

{
    return WrapCompareString(
                  TRUE
                , pcwszString1In
                , cch1In
                , pcwszString2In
                , cch2In
                );
} //*** StringCompareW

int StringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | LPCWSTR | pcwszString2In
 | ) |  |

Definition at line 123 of file StringUtils.cpp.

{
    return WrapCompareString(
                  TRUE
                , pcwszString1In
                , static_cast< size_t >( -1 )
                , pcwszString2In
                , static_cast< size_t >( -1 )
                );
} //*** StringCompareW

int WrapCompareString | ( | BOOL | fCaseSensitive,
 |  | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 50 of file StringUtils.cpp.

{
    int nRet;

    nRet = CompareStringW(
              LOCALE_SYSTEM_DEFAULT
            , fCaseSensitive ? 0 : NORM_IGNORECASE
            , pcwszString1In
            , static_cast< DWORD >( cch1In )
            , pcwszString2In
            , static_cast< DWORD >( cch2In )
            );

    return nRet - CSTR_EQUAL; // CSTR_LT < CSTR_EQUAL < CSTR_GT

} // *** WrapCompareString

Generated on Wed Nov 13 2024 16:54:58 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyStorageResource/StringUtils.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyStorageResource
Functions

StringUtils.h File Reference

#include "stdafx.h"

Go to the source code of this file.

Functions

int | BSTRCompareW (BSTR bstrString1In, BSTR bstrString2In)
HRESULT | HrFormatStringIntoBSTR (HINSTANCE hInstanceIn, LANGID langidIn, UINT idsIn, BSTR *pbstrInout,...)
HRESULT | HrFormatStringIntoBSTR (HINSTANCE hInstanceIn, UINT idsIn, BSTR *pbstrInout,...)
HRESULT | HrFormatStringIntoBSTR (UINT idsIn, BSTR *pbstrInout,...)
HRESULT | HrFormatStringIntoBSTR (LPCWSTR pcwszFmtIn, BSTR *pbstrInout,...)
HRESULT | HrFormatStringWithVAListIntoBSTR (HINSTANCE hInstanceIn, LANGID langidIn, UINT idsIn, BSTR *pbstrInout, va_list valistIn)
HRESULT | HrFormatStringWithVAListIntoBSTR (HINSTANCE hInstanceIn, UINT idsIn, BSTR *pbstrInout, va_list valistIn)
HRESULT | HrFormatStringWithVAListIntoBSTR (LPCWSTR pcwszFmtIn, BSTR *pbstrInout, va_list valistIn)
HRESULT | HrLoadStringIntoBSTR (HINSTANCE hInstanceIn, UINT idsIn, BSTR *pbstrInout)
HRESULT | HrLoadStringIntoBSTR (HINSTANCE hInstanceIn, LANGID langidIn, UINT idsIn, BSTR *pbstrInout)
HRESULT | HrLoadStringIntoBSTR (UINT idsIn, BSTR *pbstrInout)
int | IBSTRCompareW (BSTR bstrString1In, BSTR bstrString2In)
int | IStringCompareW (LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)
int | IStringCompareW (LPCWSTR pcwszString1In, LPCWSTR pcwszString2In)
int | NBSTRCompareW (BSTR bstrString1In, BSTR bstrString2In)
int | NIBSTRCompareW (BSTR bstrString1In, BSTR bstrString2In)
int | NIStringCompareW (LPCWSTR pcwszString1In, LPCWSTR pcwszString2In, size_t cchIn)
int | NIStringCompareW (LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)
int | NStringCompareW (LPCWSTR pcwszString1In, LPCWSTR pcwszString2In, size_t cchIn)
int | NStringCompareW (LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)
int | StringCompareW (LPCWSTR pcwszString1In, LPCWSTR pcwszString2In)
int | StringCompareW (LPCWSTR pcwszString1In, size_t cch1In, LPCWSTR pcwszString2In, size_t cch2In)

Function Documentation

int BSTRCompareW | ( | BSTR | bstrString1In,
 |  | BSTR | bstrString2In
 | ) |  |

Definition at line 100 of file StringUtils.cpp.

{
    return WrapCompareString(
                  TRUE
                , static_cast< LPCWSTR >( bstrString1In )
                , SysStringLen( bstrString1In )
                , static_cast< LPCWSTR >( bstrString2In )
                , SysStringLen( bstrString2In )
                );
} //*** BSTRCompareW

HRESULT HrFormatStringIntoBSTR | ( | HINSTANCE | hInstanceIn,
 |  | LANGID | langidIn,
 |  | UINT | idsIn,
 |  | BSTR * | pbstrInout,
 |  |  | ...
 | ) |  |

Definition at line 578 of file StringUtils.cpp.

{
    HRESULT hr;
    va_list valist;

    va_start( valist, pbstrInout );

    hr = HrFormatStringWithVAListIntoBSTR(
                          hInstanceIn
                        , langidIn
                        , idsIn
                        , pbstrInout
                        , valist
                        );

    va_end( valist );

    return hr;

} //*** HrFormatStringIntoBSTR

HRESULT HrFormatStringIntoBSTR | ( | HINSTANCE | hInstanceIn,
 |  | UINT | idsIn,
 |  | BSTR * | pbstrInout,
 |  |  | ... |
 | ) |  |  | [inline]

Definition at line 180 of file StringUtils.h.

{
    HRESULT hr;
    va_list valist;

    va_start( valist, pbstrInout );

    hr = HrFormatStringWithVAListIntoBSTR(
                  hInstanceIn
                , MAKELANGID( LANG_NEUTRAL, SUBLANG_NEUTRAL )
                , idsIn
                , pbstrInout
                , valist
                );

    va_end( valist );

    return hr;

} //*** HrFormatStringIntoBSTR

HRESULT HrFormatStringIntoBSTR | ( | UINT | idsIn,
 |  | BSTR * | pbstrInout,
 |  |  | ... |
 | ) |  |  | [inline]

Definition at line 208 of file StringUtils.h.

{
    HRESULT hr;
    va_list valist;

    va_start( valist, pbstrInout );

    hr = HrFormatStringWithVAListIntoBSTR(
                  NULL
                , MAKELANGID( LANG_NEUTRAL, SUBLANG_NEUTRAL )
                , idsIn
                , pbstrInout
                , valist
                );

    va_end( valist );

    return hr;

} //*** HrFormatStringIntoBSTR

HRESULT HrFormatStringIntoBSTR | ( | LPCWSTR | pcwszFmtIn,
 |  | BSTR * | pbstrInout,
 |  |  | ...
 | ) |  |

Definition at line 773 of file StringUtils.cpp.

{
    HRESULT hr = S_OK;
    va_list valist;

    va_start( valist, pbstrInout );

    hr = HrFormatStringWithVAListIntoBSTR( pcwszFmtIn, pbstrInout, valist );

    va_end( valist );

    return hr;

} //*** HrFormatStringIntoBSTR

HRESULT HrFormatStringWithVAListIntoBSTR | ( | HINSTANCE | hInstanceIn,
 |  | LANGID | langidIn,
 |  | UINT | idsIn,
 |  | BSTR * | pbstrInout,
 |  | va_list | valistIn
 | ) |  |

Definition at line 651 of file StringUtils.cpp.

{
    HRESULT hr = S_OK;
    BSTR    bstrStringResource = NULL;
    DWORD   cch;
    LPWSTR  pwsz = NULL;

    assert( pbstrInout != NULL );

    if ( pbstrInout == NULL )
    {
        hr = E_POINTER;
        goto Cleanup;
    } // if:

    //
    // Load the string resource.
    //

    hr = HrLoadStringIntoBSTR( hInstanceIn, langidIn, idsIn, &bstrStringResource );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    //
    // Format the message with the arguments.
    //

    cch = FormatMessage(
                      ( FORMAT_MESSAGE_ALLOCATE_BUFFER
                      | FORMAT_MESSAGE_FROM_STRING )
                    , bstrStringResource
                    , 0
                    , 0
                    , (LPWSTR) &pwsz
                    , 0
                    , &valistIn
                    );
    if ( cch == 0 )
    {
        hr = HRESULT_FROM_WIN32( GetLastError() );
        goto Cleanup;
    } // if:

    //
    // If previously allocated free it before re-allocating it.
    //

    if ( *pbstrInout != NULL )
    {
        SysFreeString( *pbstrInout );
        *pbstrInout = NULL;
    } // if:

    //
    // Allocate a BSTR for the string.
    //

    *pbstrInout = SysAllocStringLen( pwsz, cch );
    if ( *pbstrInout == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if:

Cleanup:

    SysFreeString( bstrStringResource );
    LocalFree( pwsz );

    return hr;

} //*** HrFormatStringWithVAListIntoBSTR

HRESULT HrFormatStringWithVAListIntoBSTR | ( | HINSTANCE | hInstanceIn,
 |  | UINT | idsIn,
 |  | BSTR * | pbstrInout,
 |  | va_list | valistIn |
 | ) |  |  | [inline]

Definition at line 235 of file StringUtils.h.

{
    return HrFormatStringWithVAListIntoBSTR(
                  hInstanceIn
                , MAKELANGID( LANG_NEUTRAL, SUBLANG_NEUTRAL )
                , idsIn
                , pbstrInout
                , valistIn
                );

} //*** HrFormatStringWithVAListIntoBSTR

HRESULT HrFormatStringWithVAListIntoBSTR | ( | LPCWSTR | pcwszFmtIn,
 |  | BSTR * | pbstrInout,
 |  | va_list | valistIn
 | ) |  |

Definition at line 831 of file StringUtils.cpp.

{
    HRESULT hr = S_OK;
    DWORD   cch;
    LPWSTR  pwsz = NULL;

    if (    ( pbstrInout == NULL )
        ||  ( pcwszFmtIn == NULL )
       )
    {
        hr = E_POINTER;
        goto Cleanup;
    } // if:

    //
    // Format the message with the arguments.
    //

    cch = FormatMessage(
                      ( FORMAT_MESSAGE_ALLOCATE_BUFFER
                      | FORMAT_MESSAGE_FROM_STRING )
                    , pcwszFmtIn
                    , 0
                    , 0
                    , (LPWSTR) &pwsz
                    , 0
                    , &valistIn
                    );
    if ( cch == 0 )
    {
        hr = HRESULT_FROM_WIN32( GetLastError() );
        goto Cleanup;
    } // if:

    //
    // If previously allocated free it before re-allocating it.
    //

    if ( *pbstrInout != NULL )
    {
        SysFreeString( *pbstrInout );
        *pbstrInout = NULL;
    } // if:

    //
    // Allocate a BSTR for the string.
    //

    *pbstrInout = SysAllocStringLen( pwsz, cch );
    if ( *pbstrInout == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if:

Cleanup:

    LocalFree( pwsz );

    return hr;

} //*** HrFormatStringWithVAListIntoBSTR

HRESULT HrLoadStringIntoBSTR | ( | HINSTANCE | hInstanceIn,
 |  | UINT | idsIn,
 |  | BSTR * | pbstrInout |
 | ) |  |  | [inline]

Definition at line 140 of file StringUtils.h.

{
    return HrLoadStringIntoBSTR(
                          hInstanceIn
                        , MAKELANGID( LANG_NEUTRAL, SUBLANG_NEUTRAL )
                        , idsIn
                        , pbstrInout
                        );

} //*** HrLoadStringIntoBSTR

HRESULT HrLoadStringIntoBSTR | ( | HINSTANCE | hInstanceIn,
 |  | LANGID | langidIn,
 |  | UINT | idsIn,
 |  | BSTR * | pbstrInout
 | ) |  |

Definition at line 341 of file StringUtils.cpp.

{
    HRESULT hr              = S_OK;
    HRSRC   hrsrc           = NULL;
    HGLOBAL hgbl            = NULL;
    int     cch             = 0;
    PBYTE   pbStringData;
    PBYTE   pbStringDataMax;
    PBYTE   pbStringTable;
    int     cbStringTable;
    int     nTable;
    int     nOffset;
    int     idxString;

    assert( idsIn != 0 );
    assert( pbstrInout != NULL );

    if ( pbstrInout == NULL )
    {
        hr = E_POINTER;
        goto Cleanup;
    } // if:

    if ( hInstanceIn == NULL )
    {
        hInstanceIn = _Module.m_hInstResource;
    } // if:

    //
    //  The resource Id specified must be converted to an index into
    //  a Windows StringTable.
    //

    nTable = idsIn / 16;
    nOffset = idsIn - (nTable * 16);

    //
    //  Internal Table Id's start at 1 not 0.
    //

    nTable++;

    //
    // Find the part of the string table where the string resides.
    //

    //
    //  Find the table containing the string.
    // First try to load the language specified.  If we can't find it we
    // try the "neutral" language.
    //

    hrsrc = FindResourceEx( hInstanceIn, RT_STRING, MAKEINTRESOURCE( nTable ), langidIn );
    if ( ( hrsrc == NULL ) && ( GetLastError() == ERROR_RESOURCE_LANG_NOT_FOUND ) )
    {
        hrsrc = FindResourceEx(
                      hInstanceIn
                    , RT_STRING
                    , MAKEINTRESOURCE( nTable )
                    , MAKELANGID( LANG_NEUTRAL, SUBLANG_NEUTRAL )
                    );
    } // if: FindResourceEx failed

    if ( hrsrc == NULL )
    {
        hr = HRESULT_FROM_WIN32( GetLastError() );
        goto Cleanup;
    } // if:

    //
    //  Load the table.
    //

    hgbl = LoadResource( hInstanceIn, hrsrc );
    if ( hgbl == NULL )
    {
        hr = HRESULT_FROM_WIN32( GetLastError() );
        goto Cleanup;
    } // if:

    //
    //  Lock the table so we access its data.
    //

    pbStringTable = reinterpret_cast< PBYTE >( LockResource( hgbl ) );
    if ( pbStringTable == NULL )
    {
        hr = HRESULT_FROM_WIN32( GetLastError() );
        goto Cleanup;
    } // if:

    cbStringTable = SizeofResource( hInstanceIn, hrsrc );
    assert( cbStringTable != 0 );

    //
    //  Set the data pointer to the beginning of the table.
    //

    pbStringData = pbStringTable;
    pbStringDataMax = pbStringTable + cbStringTable;

    //
    // Skip strings in the block of 16 which are before the desired string.
    //

    for ( idxString = 0 ; idxString <= nOffset ; idxString++ )
    {
        assert( pbStringData != NULL );
        assert( pbStringData < pbStringDataMax );

        //
        //  Get the number of characters excluding the '\0'.
        //

        cch = * ( (USHORT *) pbStringData );

        //
        //  Found the string.
        //

        if ( idxString == nOffset )
        {
            if ( cch == 0 )
            {
                hr = HRESULT_FROM_WIN32( ERROR_RESOURCE_NAME_NOT_FOUND );
                goto Cleanup;
            } // if:

            //
            //  Skip over the string length to get the string.
            //

            pbStringData += sizeof( WCHAR );

            break;
        } // if: found the string

        //
        //  Add one to account for the string length.
        //  A string length of 0 still takes 1 WCHAR for the length portion.
        //

        cch++;

        //
        //  Skip over this string to get to the next string.
        //

        pbStringData += ( cch * sizeof( WCHAR ) );

    } // for: each string in the block of 16 strings in the table

    //
    //  Note: nStringLen is the number of characters in the string not including the '\0'.
    //

    //
    // If previously allocated free it before re-allocating it.
    //

    if ( *pbstrInout != NULL )
    {
        SysFreeString( *pbstrInout );
        *pbstrInout = NULL;
    } // if: string was allocated previously

    //
    // Allocate a BSTR for the string.
    //

    *pbstrInout = SysAllocStringLen( (OLECHAR *) pbStringData, cch );
    if ( *pbstrInout == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if:

Cleanup:

    return hr;

} //*** HrLoadStringIntoBSTR

HRESULT HrLoadStringIntoBSTR | ( | UINT | idsIn,
 |  | BSTR * | pbstrInout |
 | ) |  |  | [inline]

Definition at line 125 of file StringUtils.h.

{
    return HrLoadStringIntoBSTR(
                          NULL
                        , MAKELANGID( LANG_NEUTRAL, SUBLANG_NEUTRAL )
                        , idsIn
                        , pbstrInout
                        );
} //*** HrLoadStringIntoBSTR

int IBSTRCompareW | ( | BSTR | bstrString1In,
 |  | BSTR | bstrString2In
 | ) |  |

Definition at line 85 of file StringUtils.cpp.

{
    return WrapCompareString(
                  FALSE
                , static_cast< LPCWSTR >( bstrString1In )
                , SysStringLen( bstrString1In )
                , static_cast< LPCWSTR >( bstrString2In )
                , SysStringLen( bstrString2In )
                );
} //*** IBSTRCompareW

int IStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 145 of file StringUtils.cpp.

{
    return WrapCompareString(
                  FALSE
                , pcwszString1In
                , cch1In
                , pcwszString2In
                , cch2In
                );
} //*** IStringCompareW

int IStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | LPCWSTR | pcwszString2In
 | ) |  |

Definition at line 115 of file StringUtils.cpp.

{
    return WrapCompareString(
                  FALSE
                , pcwszString1In
                , static_cast< size_t >( -1 )
                , pcwszString2In
                , static_cast< size_t >( -1 )
            );
} //*** IStringCompareW

int NBSTRCompareW | ( | BSTR | bstrString1In,
 |  | BSTR | bstrString2In
 | ) |  |

Definition at line 203 of file StringUtils.cpp.

{
    size_t cchMin;

    cchMin = min( SysStringLen( bstrString1In ), SysStringLen( bstrString2In ) );

    return WrapCompareString(
                  TRUE
                , static_cast< LPCWSTR >( bstrString1In )
                , cchMin
                , static_cast< LPCWSTR >( bstrString2In )
                , cchMin
                );
} //*** NBSTRCompareW

int NIBSTRCompareW | ( | BSTR | bstrString1In,
 |  | BSTR | bstrString2In
 | ) |  |

Definition at line 184 of file StringUtils.cpp.

{
    size_t cchMin;

    cchMin = min( SysStringLen( bstrString1In ), SysStringLen( bstrString2In ) );

    return WrapCompareString(
                  FALSE
                , static_cast< LPCWSTR >( bstrString1In )
                , cchMin
                , static_cast< LPCWSTR >( bstrString2In )
                , cchMin
                );
} //*** NIBSTRCompareW

int NIStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cchIn
 | ) |  |

Definition at line 222 of file StringUtils.cpp.

{
    return WrapCompareString(
                  FALSE
                , pcwszString1In
                , cchIn
                , pcwszString2In
                , cchIn
                );
} //*** NIStringCompareW

int NIStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 254 of file StringUtils.cpp.

{
    return WrapCompareString(
                  FALSE
                , pcwszString1In
                , min( cch1In, cch2In )
                , pcwszString2In
                , min( cch1In, cch2In )
                );
} //*** NIStringCompareW

int NStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cchIn
 | ) |  |

Definition at line 238 of file StringUtils.cpp.

{
    return WrapCompareString(
                  TRUE
                , pcwszString1In
                , cchIn
                , pcwszString2In
                , cchIn
                );
} //*** NIStringCompareW

int NStringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 271 of file StringUtils.cpp.

{
    return WrapCompareString(
                  TRUE
                , pcwszString1In
                , min( cch1In, cch2In )
                , pcwszString2In
                , min( cch1In, cch2In )
                );
} //*** NStringCompareW

int StringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | LPCWSTR | pcwszString2In
 | ) |  |

Definition at line 130 of file StringUtils.cpp.

{
    return WrapCompareString(
                  TRUE
                , pcwszString1In
                , static_cast< size_t >( -1 )
                , pcwszString2In
                , static_cast< size_t >( -1 )
                );
} //*** StringCompareW

int StringCompareW | ( | LPCWSTR | pcwszString1In,
 |  | size_t | cch1In,
 |  | LPCWSTR | pcwszString2In,
 |  | size_t | cch2In
 | ) |  |

Definition at line 162 of file StringUtils.cpp.

{
    return WrapCompareString(
                  TRUE
                , pcwszString1In
                , cch1In
                , pcwszString2In
                , cch2In
                );
} //*** StringCompareW

Generated on Wed Nov 13 2024 16:54:59 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyStorageResource/WMIHelpers.cpp File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyStorageResource
Functions

WMIHelpers.cpp File Reference

#include "stdafx.h"
#include "WMIHelpers.h"

Go to the source code of this file.

Functions

HRESULT | HrGetWMIProperty (IWbemClassObject *pWMIObjectIn, LPCWSTR pcszPropertyNameIn, ULONG ulPropertyTypeIn, VARIANT *pVariantOut)
HRESULT | HrInitializeWbemConnection (IWbemServices **pIWbemServicesOut)
HRESULT | HrSetBlanket (IWbemServices *pIWbemServicesIn)
HRESULT | HrSetWbemServices (IUnknown *punkIn, IWbemServices *pIWbemServicesIn)

Function Documentation

HRESULT HrGetWMIProperty | ( | IWbemClassObject * | pWMIObjectIn,
 |  | LPCWSTR | pcszPropertyNameIn,
 |  | ULONG | ulPropertyTypeIn,
 |  | VARIANT * | pVariantOut
 | ) |  |

Definition at line 59 of file WMIHelpers.cpp.

{
    assert( pWMIObjectIn != NULL );
    assert( pcszPropertyNameIn != NULL );
    assert( pVariantOut != NULL );

    HRESULT hr;
    BSTR    bstrProp = NULL;

    VariantClear( pVariantOut );

    bstrProp = SysAllocString( pcszPropertyNameIn );
    if ( bstrProp == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if:

    hr = pWMIObjectIn->Get( bstrProp, 0L, pVariantOut, NULL, NULL );
    if ( FAILED( hr ) )
    {
        //
        //  The SendStatusReport mechanism does not work in these helper
        //  functions.  It is an exercise left up to the reader as to how
        //  best to log errors from this function...
        //
        //  It is expected that most implementers of a ClusCfg managed
        //  resource will not use this function as it is here for
        //  demonstration purposes only...
        //

        //LOG_STATUS_REPORT_STRING( L"[MyStorageResource] Could not get the value for WMI property '%1!ws!'.", bstrProp, hr );
        goto Cleanup;
    } // if:

    //
    //  For reasons only known to WMI, boolean properties are of type VT_NULL instead of
    //  VT_BOOL when they are not set or false...
    //

    //
    //  Added the special case check for signature.  We know that signature will be NULL
    //  when the spindle is under ClusDisk control...
    //

    if (    ( ulPropertyTypeIn != VT_BOOL )
        &&  ( NIStringCompareW( bstrProp, SysStringLen( bstrProp ), L"Signature", RTL_NUMBER_OF( L"Signature" ) ) != 0 ) )
    {
        if ( pVariantOut->vt != ulPropertyTypeIn )
        {
            //LOG_STATUS_REPORT_STRING3( L"[MyStorageResource] Variant type for WMI Property '%1!ws!' was supposed to be '%2!d!', but was '%3!d!' instead.", pcszPropertyNameIn, ulPropertyTypeIn, pVariantOut->vt, hr );
            hr = E_PROPTYPEMISMATCH;
        } // if:
    } // if:

Cleanup:

    SysFreeString( bstrProp );

    return hr;

} //*** HrGetWMIProperty

HRESULT HrInitializeWbemConnection ( IWbemServices ** pIWbemServicesOut )

Definition at line 277 of file WMIHelpers.cpp.

{
    assert( pIWbemServicesOut != NULL );

    HRESULT         hr = S_OK;
    IWbemLocator *  pIWbemLocator = NULL;
    BSTR            bstrNameSpace = NULL;

    hr = CoCreateInstance( CLSID_WbemLocator, NULL, CLSCTX_INPROC_SERVER, IID_IWbemLocator, (LPVOID *) &pIWbemLocator );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    bstrNameSpace = SysAllocString( L"\\\\.\\root\\cimv2" );
    if ( bstrNameSpace == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if:

    hr = pIWbemLocator->ConnectServer(
                            bstrNameSpace,
                            NULL,                   // using current account for simplicity
                            NULL,                   // using current password for simplicity
                            NULL,                   // locale
                            0L,                     // securityFlags, reserved must be 0
                            NULL,                   // authority (domain for NTLM)
                            NULL,                   // context
                            pIWbemServicesOut
                            );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    hr = HrSetBlanket( *pIWbemServicesOut );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

Cleanup:

    SysFreeString( bstrNameSpace );

    if ( pIWbemLocator != NULL )
    {
        pIWbemLocator->Release();
    } // if:

    return hr;

} //*** HrInitializeWbemConnection

HRESULT HrSetBlanket ( IWbemServices * pIWbemServicesIn )

Definition at line 219 of file WMIHelpers.cpp.

{
    assert( pIWbemServicesIn != NULL );

    HRESULT hr = S_FALSE;

    if ( pIWbemServicesIn )
    {
        IClientSecurity *   pCliSec;

        hr = pIWbemServicesIn->TypeSafeQI( IClientSecurity, &pCliSec );
        if ( SUCCEEDED( hr ) )
        {
            hr = pCliSec->SetBlanket(
                            pIWbemServicesIn,
                            RPC_C_AUTHN_WINNT,
                            RPC_C_AUTHZ_NONE,
                            NULL,
                            RPC_C_AUTHN_LEVEL_CONNECT,
                            RPC_C_IMP_LEVEL_IMPERSONATE,
                            NULL,
                            EOAC_NONE
                            );

            pCliSec->Release();
        } // if:
    } // if:

    return hr;

} //*** HrSetBlanket

HRESULT HrSetWbemServices | ( | IUnknown * | punkIn,
 |  | IWbemServices * | pIWbemServicesIn
 | ) |  |

Definition at line 157 of file WMIHelpers.cpp.

{
    assert( punkIn != NULL );

    HRESULT         hr;
    IWMIServices *  piws = NULL;

    if ( punkIn == NULL )
    {
        hr = E_POINTER;
        goto Cleanup;
    } // if:

    hr = punkIn->TypeSafeQI( IWMIServices, &piws );
    if ( SUCCEEDED( hr ) )
    {
        hr = piws->SetWbemServices( pIWbemServicesIn );
        piws->Release();
    } // if:
    else if ( hr == E_NOINTERFACE )
    {
        hr = S_OK;
    } // else if:

Cleanup:

    return hr;

} //*** HrSetWbemServices

Generated on Wed Nov 13 2024 16:55:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Cluster/Win2003/MyStorageResource/WMIHelpers.h File Reference

  • WinBase
  • Cluster
  • Win2003
  • MyStorageResource
Functions

WMIHelpers.h File Reference

#include "stdafx.h"

Go to the source code of this file.

Functions

HRESULT | HrGetWMIProperty (IWbemClassObject *pWMIObjectIn, LPCWSTR pcszPropertyNameIn, ULONG ulPropertyTypeIn, VARIANT *pVariantOut)
HRESULT | HrInitializeWbemConnection (IWbemServices **pIWbemServicesOut)
HRESULT | HrSetBlanket (IWbemServices *pIWbemServicesIn)
HRESULT | HrSetWbemServices (IUnknown *punkIn, IWbemServices *pIWbemServicesIn)

Function Documentation

HRESULT HrGetWMIProperty | ( | IWbemClassObject * | pWMIObjectIn,
 |  | LPCWSTR | pcszPropertyNameIn,
 |  | ULONG | ulPropertyTypeIn,
 |  | VARIANT * | pVariantOut
 | ) |  |

Definition at line 59 of file WMIHelpers.cpp.

{
    assert( pWMIObjectIn != NULL );
    assert( pcszPropertyNameIn != NULL );
    assert( pVariantOut != NULL );

    HRESULT hr;
    BSTR    bstrProp = NULL;

    VariantClear( pVariantOut );

    bstrProp = SysAllocString( pcszPropertyNameIn );
    if ( bstrProp == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if:

    hr = pWMIObjectIn->Get( bstrProp, 0L, pVariantOut, NULL, NULL );
    if ( FAILED( hr ) )
    {
        //
        //  The SendStatusReport mechanism does not work in these helper
        //  functions.  It is an exercise left up to the reader as to how
        //  best to log errors from this function...
        //
        //  It is expected that most implementers of a ClusCfg managed
        //  resource will not use this function as it is here for
        //  demonstration purposes only...
        //

        //LOG_STATUS_REPORT_STRING( L"[MyStorageResource] Could not get the value for WMI property '%1!ws!'.", bstrProp, hr );
        goto Cleanup;
    } // if:

    //
    //  For reasons only known to WMI, boolean properties are of type VT_NULL instead of
    //  VT_BOOL when they are not set or false...
    //

    //
    //  Added the special case check for signature.  We know that signature will be NULL
    //  when the spindle is under ClusDisk control...
    //

    if (    ( ulPropertyTypeIn != VT_BOOL )
        &&  ( NIStringCompareW( bstrProp, SysStringLen( bstrProp ), L"Signature", RTL_NUMBER_OF( L"Signature" ) ) != 0 ) )
    {
        if ( pVariantOut->vt != ulPropertyTypeIn )
        {
            //LOG_STATUS_REPORT_STRING3( L"[MyStorageResource] Variant type for WMI Property '%1!ws!' was supposed to be '%2!d!', but was '%3!d!' instead.", pcszPropertyNameIn, ulPropertyTypeIn, pVariantOut->vt, hr );
            hr = E_PROPTYPEMISMATCH;
        } // if:
    } // if:

Cleanup:

    SysFreeString( bstrProp );

    return hr;

} //*** HrGetWMIProperty

HRESULT HrInitializeWbemConnection ( IWbemServices ** pIWbemServicesOut )

Definition at line 277 of file WMIHelpers.cpp.

{
    assert( pIWbemServicesOut != NULL );

    HRESULT         hr = S_OK;
    IWbemLocator *  pIWbemLocator = NULL;
    BSTR            bstrNameSpace = NULL;

    hr = CoCreateInstance( CLSID_WbemLocator, NULL, CLSCTX_INPROC_SERVER, IID_IWbemLocator, (LPVOID *) &pIWbemLocator );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    bstrNameSpace = SysAllocString( L"\\\\.\\root\\cimv2" );
    if ( bstrNameSpace == NULL )
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    } // if:

    hr = pIWbemLocator->ConnectServer(
                            bstrNameSpace,
                            NULL,                   // using current account for simplicity
                            NULL,                   // using current password for simplicity
                            NULL,                   // locale
                            0L,                     // securityFlags, reserved must be 0
                            NULL,                   // authority (domain for NTLM)
                            NULL,                   // context
                            pIWbemServicesOut
                            );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

    hr = HrSetBlanket( *pIWbemServicesOut );
    if ( FAILED( hr ) )
    {
        goto Cleanup;
    } // if:

Cleanup:

    SysFreeString( bstrNameSpace );

    if ( pIWbemLocator != NULL )
    {
        pIWbemLocator->Release();
    } // if:

    return hr;

} //*** HrInitializeWbemConnection

HRESULT HrSetBlanket ( IWbemServices * pIWbemServicesIn )

Definition at line 219 of file WMIHelpers.cpp.

{
    assert( pIWbemServicesIn != NULL );

    HRESULT hr = S_FALSE;

    if ( pIWbemServicesIn )
    {
        IClientSecurity *   pCliSec;

        hr = pIWbemServicesIn->TypeSafeQI( IClientSecurity, &pCliSec );
        if ( SUCCEEDED( hr ) )
        {
            hr = pCliSec->SetBlanket(
                            pIWbemServicesIn,
                            RPC_C_AUTHN_WINNT,
                            RPC_C_AUTHZ_NONE,
                            NULL,
                            RPC_C_AUTHN_LEVEL_CONNECT,
                            RPC_C_IMP_LEVEL_IMPERSONATE,
                            NULL,
                            EOAC_NONE
                            );

            pCliSec->Release();
        } // if:
    } // if:

    return hr;

} //*** HrSetBlanket

HRESULT HrSetWbemServices | ( | IUnknown * | punkIn,
 |  | IWbemServices * | pIWbemServicesIn
 | ) |  |

Definition at line 157 of file WMIHelpers.cpp.

{
    assert( punkIn != NULL );

    HRESULT         hr;
    IWMIServices *  piws = NULL;

    if ( punkIn == NULL )
    {
        hr = E_POINTER;
        goto Cleanup;
    } // if:

    hr = punkIn->TypeSafeQI( IWMIServices, &piws );
    if ( SUCCEEDED( hr ) )
    {
        hr = piws->SetWbemServices( pIWbemServicesIn );
        piws->Release();
    } // if:
    else if ( hr == E_NOINTERFACE )
    {
        hr = S_OK;
    } // else if:

Cleanup:

    return hr;

} //*** HrSetWbemServices

Generated on Wed Nov 13 2024 16:55:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Debug/BPSamp/BPSamp.h File Reference

  • WinBase
  • Debug
  • BPSamp
Functions | Variables

BPSamp.h File Reference

Go to the source code of this file.

Functions

BOOL | add_thread (DWORD dwThreadID, HANDLE hThread)
BOOL | clear_codebreakpoint (void)
BOOL | clear_databreakpoint (void)
BOOL WINAPI | control_C_handler (DWORD dwCtrlType)
void | display_help (void)
BOOL display_thread_registers (DWORD dwID)
BOOL | do_debug_command (void)
void | dump_debug_event_info (DEBUG_EVENT *de)
BOOL | remove_thread (DWORD dwThreadID)
BOOL | set_codebreakpoint (DWORD dwAddress)
BOOL | set_databreakpoint (DWORD dwAddress)
void | set_thread_eip_back (DWORD dwThreadID)

Variables

DWORD g_dwCodeAddress
DWORD g_dwCurrentThreadID
BOOL g_fAtCodeBreakpoint
BOOL g_fInDbgCmd
HANDLE g_hProcDebuggee

Function Documentation

BOOL add_thread | ( | DWORD | dwThreadID,
 |  | HANDLE | hThread
 | ) |  |

Definition at line 52 of file Utils.c.

{
   DWORD i;

   // find first empty slot
   for (i = 0; i<MAX_THREADS; i++)
   {
      if (dti[i].dwThreadID == 0)
      {
         dti[i].dwThreadID = dwThreadID;

         if (!DuplicateHandle(GetCurrentProcess(),
                  hThread,
                  GetCurrentProcess(),
                  &(dti[i].hThread),
                  THREAD_GET_CONTEXT | THREAD_SET_CONTEXT,
                  FALSE,
                  0))
         {
            printf("add_thread: DuplicateHandle failed: %d\n",
            GetLastError());
         }

         return TRUE;
      }

   }

   // assume no slot left
   printf("WARNING! tried to add more threads than %d thread in list\n",
   MAX_THREADS);
   return FALSE;
}

BOOL clear_codebreakpoint ( void )

Definition at line 451 of file Utils.c.

{
   DWORD cbBytes;

   if (g_dwCodeAddress == 0)
   {
      printf("no code breakpoint to clear\n");
      return FALSE;
   }

   if (!WriteProcessMemory(g_hProcDebuggee,
                          (LPVOID)g_dwCodeAddress,
                          (LPVOID)&bOpCode, 1, &cbBytes))
   {
      printf("ReadProcessMemory failed: %d\n", GetLastError());
      return FALSE;
   }

   g_dwCodeAddress = 0;

   return TRUE;

}

BOOL clear_databreakpoint ( void )

Definition at line 371 of file Utils.c.

{
   DWORD i;

   // need to iterate through each thread ID
   // and set the thread context to set the debug
   // threads
   for (i=0; i<MAX_THREADS; i++)
   {
      if (dti[i].dwThreadID)
      {
         clearthread_databreakpoint(dti[i].hThread);
      }

   }

   return TRUE;
}

BOOL WINAPI control_C_handler ( DWORD dwCtrlType )

Definition at line 203 of file Main.c.

{
   DWORD dwThreadID = 0;
   HANDLE hThread;

   if ((CTRL_C_EVENT == dwCtrlType) || (CTRL_BREAK_EVENT == dwCtrlType))
   {
      // don't start new debug command threads if one already started
      if (g_fInDbgCmd)
         return TRUE;
      // to start the command prompt create a thread and
      // return

      g_fInDbgCmd = TRUE;  // keeps from calling CreateRemoteThread
                         // multiple times when debugger command thread
                         // is active
      hThread = CreateRemoteThread(g_hProcDebuggee, NULL, 0,
         (LPTHREAD_START_ROUTINE)DebugBreak, NULL, 0, &dwThreadID);
      if (hThread == NULL)
      {
         printf("ERROR: CreateRemoteThread failed: %d\n", GetLastError());
         g_fInDbgCmd = FALSE;
      }
      else
      {
         CloseHandle(hThread);
      }

      return TRUE;
   }

   return FALSE;
}

void display_help ( void )

Definition at line 269 of file DbgCmd.c.

{
   printf("b <addr>        sets a breakpoint in code at addr\n");
   printf("w <addr>        sets a data watchpoint at addr\n");
   printf("cb              clears the code breakpoint\n");
   printf("cw              clears the data watchpoint\n");
   printf("g               go\n");
   printf("q               quits the debugger\n");
   printf("?               displays this help\n");

   printf("\n\n");
   printf("To break into the running debuggee, press Ctrl+C\n");
   printf("\n");
}

BOOL display_thread_registers ( DWORD dwID )

Definition at line 131 of file Utils.c.

{
   DWORD i;
   CONTEXT context;

   // find request thread id
   for (i = 0; i<MAX_THREADS; i++)
   {
      if (dti[i].dwThreadID == dwID)
      {
         context.ContextFlags = CONTEXT_FULL;
         if (!GetThreadContext(dti[i].hThread, &context))
         {
            printf("GetThreadContext failed: %d\n", GetLastError());
            return FALSE;
         }

         printf("eax=%08x ebx=%08x ecx=%08x edx=%08x esi=%08x edi=%08x\n"
                "eip=%08x esp=%08x ebp=%08x\n",
                context.Eax,
                context.Ebx,
                context.Ecx,
                context.Edx,
                context.Esi,
                context.Edi,
                context.Eip,
                context.Esp,
                context.Ebp);

         return TRUE;
      }

   }

   // assume thread ID not found here
   printf("WARNING: request to thread registers for %d not found"
          "in thread list\n", dwID);
   return FALSE;

}

BOOL do_debug_command ( void )

Definition at line 71 of file DbgCmd.c.

{
   DWORD dwCmd;

   while (TRUE)
   {
      printf("dbg>");
      if (!fgets(szCmd, sizeof(szCmd), stdin))
      {
          // unable to read input, quit
          g_fInDbgCmd = FALSE;
          return TRUE;
      }

      dwCmd = parse_command(szCmd, &cmd_args);

      switch(dwCmd)
      {
      case DBGCMD_QUIT:
         g_fInDbgCmd = FALSE;
         return TRUE;  // means quit debugger
         break;

      case DBGCMD_WATCHPOINT:
         set_databreakpoint(cmd_args.dwAddress);
         break;

      case DBGCMD_BREAKPOINT:
         set_codebreakpoint(cmd_args.dwAddress);
         break;

      case DBGCMD_CLEARBP:

         if (cmd_args.dwBPType == BPITEM_WATCHPOINT)
            clear_databreakpoint();

         if (cmd_args.dwBPType == BPITEM_BREAKPOINT)
            clear_codebreakpoint();

         break;

      case DBGCMD_GO:

         // in order to continue from a code breakpoint
         // we must clear the breakpoint (restore the
         // original opcode) before continuing.

         // an implementation of "sticky breakpoints"
         // is much more complex.

         if (g_fAtCodeBreakpoint)
         {

            clear_codebreakpoint();
            set_thread_eip_back(g_dwCurrentThreadID);
         }

         g_fInDbgCmd = FALSE;
         return FALSE; // means do not quit debugger
         break;

      case DBGCMD_SHOWHELP:
         display_help();
         break;
      case DBGCMD_UNKNOWN:
         printf("unknown command\n");
         break;

      default:
         printf("do_debug_command: should never get here\n");
         break;

      }

   }

   g_fInDbgCmd = FALSE;
   return FALSE;  // should not get here

}

void dump_debug_event_info ( DEBUG_EVENT * de )

Definition at line 488 of file Utils.c.

{

   switch(de->dwDebugEventCode)
   {
      case EXCEPTION_DEBUG_EVENT:
         printf("%d: EXCEPTION_DEBUG_EVENT\n", de->dwThreadId);

         switch (de->u.Exception.ExceptionRecord.ExceptionCode)
         {
            case EXCEPTION_ACCESS_VIOLATION:
               printf("\tEXCEPTION_ACCESS_VIOLATION\n");
            break;

            case EXCEPTION_DATATYPE_MISALIGNMENT:
               printf("\tEXCEPTION_DATATYPE_MISALIGNMENT\n");
            break;

            case EXCEPTION_BREAKPOINT:
               printf("\tEXCEPTION_BREAKPOINT\n");
            break;

            case EXCEPTION_SINGLE_STEP:
               printf("\tEXCEPTION_SINGLE_STEP\n");
            break;

            case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
               printf("\tEXCEPTION_ARRAY_BOUNDS_EXCEEDED\n");
            break;

            case EXCEPTION_FLT_DENORMAL_OPERAND:
               printf("\tEXCEPTION_FLT_DENORMAL_OPERAND\n");
            break;

            case EXCEPTION_FLT_DIVIDE_BY_ZERO:
               printf("\tEXCEPTION_FLT_DIVIDE_BY_ZERO\n");
            break;

            case EXCEPTION_FLT_INEXACT_RESULT:
               printf("\tEXCEPTION_FLT_INEXACT_RESULT\n");
            break;

            case EXCEPTION_FLT_INVALID_OPERATION:
               printf("\tEXCEPTION_FLT_INVALID_OPERATION\n");
            break;

            case EXCEPTION_FLT_OVERFLOW:
               printf("\tEXCEPTION_FLT_OVERFLOW\n");
            break;

            case EXCEPTION_FLT_STACK_CHECK:
               printf("\tEXCEPTION_FLT_STACK_CHECK\n");
            break;

            case EXCEPTION_FLT_UNDERFLOW:
               printf("\tEXCEPTION_FLT_UNDERFLOW\n");
            break;

            case EXCEPTION_INT_DIVIDE_BY_ZERO:
               printf("\tEXCEPTION_INT_DIVIDE_BY_ZERO\n");
            break;

            case EXCEPTION_INT_OVERFLOW:
               printf("\tEXCEPTION_INT_OVERFLOW\n");
            break;

            case EXCEPTION_PRIV_INSTRUCTION:
               printf("\tEXCEPTION_PRIV_INSTRUCTION\n");
            break;

            case EXCEPTION_IN_PAGE_ERROR:
               printf("\tEXCEPTION_IN_PAGE_ERROR\n");
            break;

            case EXCEPTION_ILLEGAL_INSTRUCTION:
               printf("\tEXCEPTION_ILLEGAL_INSTRUCTION\n");
            break;

            case EXCEPTION_NONCONTINUABLE_EXCEPTION:
               printf("\tEXCEPTION_NONCONTINUABLE_EXCEPTION\n");
            break;

            case EXCEPTION_STACK_OVERFLOW:
               printf("\tEXCEPTION_STACK_OVERFLOW\n");
            break;

            case EXCEPTION_INVALID_DISPOSITION:
               printf("\tEXCEPTION_INVALID_DISPOSITION\n");
            break;

            case EXCEPTION_GUARD_PAGE:
               printf("\tEXCEPTION_GUARD_PAGE\n");
            break;

            case EXCEPTION_INVALID_HANDLE:
               printf("\tEXCEPTION_INVALID_HANDLE\n");
            break;

            case CONTROL_C_EXIT:
               printf("\tCONTROL_C_EXIT\n");
            break;

            case DBG_CONTROL_C:
               printf("\tDBG_CONTROL_C\n");
            break;

            case DBG_CONTROL_BREAK:
               printf("\tDBG_CONTROL_BREAK\n");
            break;

            default:
               printf("\tUnknown exception raised: %08X\n",
               de->u.Exception.ExceptionRecord.ExceptionCode);
            break;
         }

      break;

      case CREATE_THREAD_DEBUG_EVENT:
         printf("%d: CREATE_THREAD_DEBUG_EVENT.\n", de->dwThreadId);
      break;

      case CREATE_PROCESS_DEBUG_EVENT:
         printf("%d: CREATE_PROCESS_DEBUG_EVENT\n", de->dwThreadId);
      break;

      case EXIT_THREAD_DEBUG_EVENT:
         printf("%d: EXIT_THREAD_DEBUG_EVENT\n", de->dwThreadId);
      break;

      case EXIT_PROCESS_DEBUG_EVENT:
         printf("%d: EXIT_PROCESS_DEBUG_EVENT\n", de->dwThreadId);
      break;

      case LOAD_DLL_DEBUG_EVENT:
         printf("%d: LOAD_DLL_DEBUG_EVENT\n", de->dwThreadId);
      break;

      case UNLOAD_DLL_DEBUG_EVENT:
         printf("%d: UNLOAD_DLL_DEBUG_EVENT\n", de->dwThreadId);
      break;

      case OUTPUT_DEBUG_STRING_EVENT:
         printf("%d: OUTPUT_DEBUG_STRING_EVENT\n", de->dwThreadId);
      break;

      case RIP_EVENT:
         printf("%d: RIP_EVENT\n", de->dwThreadId);
      break;

      default:  // we should never get here
         printf("%d: de.dwDebugEventCode default case %08X\n",
         de->dwThreadId, de->dwDebugEventCode);
      break;
   }

}

BOOL remove_thread ( DWORD dwThreadID )

Definition at line 96 of file Utils.c.

{
   DWORD i;

   // find request thread id
   for (i = 0; i<MAX_THREADS; i++)
   {
      if (dti[i].dwThreadID == dwThreadID)
      {
         dti[i].dwThreadID = 0;
         CloseHandle(dti[i].hThread);
         dti[i].hThread = NULL;
         return TRUE;
      }

   }

   // assume thread ID not found here
   printf("WARNING: request to remove thread %d not found in thread list\n",
   dwThreadID);
   return FALSE;

}

BOOL set_codebreakpoint ( DWORD dwAddress )

Definition at line 414 of file Utils.c.

{
   DWORD cbBytes;

   // read the original opcode of where we want to set an int 3 instruction
   if (!ReadProcessMemory(g_hProcDebuggee,
                         (LPCVOID)dwAddress,
                         (LPVOID)&bOpCode, 1, &cbBytes))
   {
      printf("ReadProcessMemory failed: %d\n", GetLastError());
      return FALSE;
   }

   if (!WriteProcessMemory(g_hProcDebuggee,
                          (LPVOID)dwAddress,
                          (LPVOID)&X86INT3, 1, &cbBytes))
   {
      printf("ReadProcessMemory failed: %d\n", GetLastError());
      return FALSE;
   }

   g_dwCodeAddress = dwAddress;
   printf("Breakpoint set at %08X\n", g_dwCodeAddress);
   return TRUE;
}

BOOL set_databreakpoint ( DWORD dwAddress )

Definition at line 342 of file Utils.c.

{
   DWORD i;

   // need to iterate through each thread ID
   // and set the thread context to set the debug
   // threads
   for (i=0; i<MAX_THREADS; i++)
   {
      if (dti[i].dwThreadID)
      {
         setthread_databreakpoint(dti[i].hThread, dwAddress);
      }

   }

   return TRUE;
}

void set_thread_eip_back ( DWORD dwThreadID )

Definition at line 183 of file Utils.c.

{
   HANDLE hThread = NULL;
   int i;
   CONTEXT context;

   for (i=0; i<MAX_THREADS; i++)
   {
      if (dti[i].dwThreadID == dwThreadID)
      {
         hThread = dti[i].hThread;
         break;
      }
   }

   if (hThread == NULL)
   {
      printf("FATAL: cannot find thread %d in thread list to set EIP back\n", dwThreadID);
   }

   context.ContextFlags = CONTEXT_CONTROL;

   GetThreadContext(hThread, &context);
   context.Eip--;
   SetThreadContext(hThread, &context);

}

Variable Documentation

DWORD g_dwCodeAddress

Definition at line 221 of file Utils.c.

DWORD g_dwCurrentThreadID

Definition at line 46 of file DbgCmd.c.

BOOL g_fAtCodeBreakpoint

Definition at line 45 of file DbgCmd.c.

BOOL g_fInDbgCmd

Definition at line 43 of file DbgCmd.c.

HANDLE g_hProcDebuggee

Definition at line 19 of file Main.c.

Generated on Wed Nov 13 2024 16:55:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Debug/BPSamp/BPSampTest.c File Reference

  • WinBase
  • Debug
  • BPSamp
Functions | Variables

BPSampTest.c File Reference

#include <windows.h>
#include <stdio.h>

Go to the source code of this file.

Functions

void | f1 (DWORD dw1, DWORD dw2)
void | f2 (DWORD dw1, DWORD dw2)
void | f3 (DWORD dw1, DWORD dw2)
void | main (void)

Variables

char | szBuff [10]

Function Documentation

void f1 | ( | DWORD | dw1,
 |  | DWORD | dw2
 | ) |  |

Definition at line 28 of file BPSampTest.c.

{

  f2(5, 4);

}

void f2 | ( | DWORD | dw1,
 |  | DWORD | dw2
 | ) |  |

Definition at line 21 of file BPSampTest.c.

{

  f3(2, 3);

}

void f3 | ( | DWORD | dw1,
 |  | DWORD | dw2
 | ) |  |

Definition at line 9 of file BPSampTest.c.

{
  lstrcpyn(szBuff, "hi there", 10);
//  for (i=0; i<10; i++)
//    szBuff[i] = 'z';

  printf("%p %s\n", szBuff, szBuff);

   MessageBox(NULL, "TEST", "TEST", MB_OK);

}

void main ( void )

Definition at line 35 of file BPSampTest.c.

{
  CONTEXT context;
  printf("%p\n", szBuff);
  _asm int 3

  MessageBox(NULL, "attach debugger", "test", MB_OK);

  context.ContextFlags = CONTEXT_FULL | CONTEXT_DEBUG_REGISTERS;

  if (!GetThreadContext(GetCurrentThread(), &context))
    printf("GetThreadContext failed: %d\n", GetLastError());
  else
    printf("Dr0 = %08X, Dr7 = %08X\n", context.Dr0, context.Dr7);

  f1(1, 2);

}

Variable Documentation

char szBuff[10]

Definition at line 5 of file BPSampTest.c.

Generated on Wed Nov 13 2024 16:55:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Debug/BPSamp/DbgCmd.c File Reference

  • WinBase
  • Debug
  • BPSamp
Classes | Defines | Typedefs | Functions | Variables

DbgCmd.c File Reference

#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include "bpsamp.h"

Go to the source code of this file.

Classes

struct | CMD_ARGS

Defines

#define | BPITEM_BREAKPOINT 2
#define | BPITEM_WATCHPOINT 1
#define | DBGCMD_BREAKPOINT 4
#define | DBGCMD_CLEARBP 5
#define | DBGCMD_GO 2
#define | DBGCMD_QUIT 1
#define | DBGCMD_SHOWHELP 6
#define | DBGCMD_UNKNOWN -1
#define | DBGCMD_WATCHPOINT 3

Typedefs

typedef struct CMD_ARGS * | PCMD_ARGS

Functions

void | display_help (void)
BOOL | do_debug_command (void)
DWORD | parse_command (char *szCmd, PCMD_ARGS pcmd_args)

Variables

DWORD | g_dwCurrentThreadID = 0
BOOL | g_fAtCodeBreakpoint = FALSE
BOOL | g_fInDbgCmd = FALSE
char | szCmd [0x1000]

Define Documentation

#define BPITEM_BREAKPOINT 2

Definition at line 27 of file DbgCmd.c.

#define BPITEM_WATCHPOINT 1

Definition at line 26 of file DbgCmd.c.

#define DBGCMD_BREAKPOINT 4

Definition at line 39 of file DbgCmd.c.

#define DBGCMD_CLEARBP 5

Definition at line 40 of file DbgCmd.c.

#define DBGCMD_GO 2

Definition at line 37 of file DbgCmd.c.

#define DBGCMD_QUIT 1

Definition at line 36 of file DbgCmd.c.

#define DBGCMD_SHOWHELP 6

Definition at line 41 of file DbgCmd.c.

#define DBGCMD_UNKNOWN -1

Definition at line 35 of file DbgCmd.c.

#define DBGCMD_WATCHPOINT 3

Definition at line 38 of file DbgCmd.c.

Typedef Documentation

typedef struct CMD_ARGS * PCMD_ARGS

Function Documentation

void display_help ( void )

Definition at line 269 of file DbgCmd.c.

{
   printf("b <addr>        sets a breakpoint in code at addr\n");
   printf("w <addr>        sets a data watchpoint at addr\n");
   printf("cb              clears the code breakpoint\n");
   printf("cw              clears the data watchpoint\n");
   printf("g               go\n");
   printf("q               quits the debugger\n");
   printf("?               displays this help\n");

   printf("\n\n");
   printf("To break into the running debuggee, press Ctrl+C\n");
   printf("\n");
}

BOOL do_debug_command ( void )

Definition at line 71 of file DbgCmd.c.

{
   DWORD dwCmd;

   while (TRUE)
   {
      printf("dbg>");
      if (!fgets(szCmd, sizeof(szCmd), stdin))
      {
          // unable to read input, quit
          g_fInDbgCmd = FALSE;
          return TRUE;
      }

      dwCmd = parse_command(szCmd, &cmd_args);

      switch(dwCmd)
      {
      case DBGCMD_QUIT:
         g_fInDbgCmd = FALSE;
         return TRUE;  // means quit debugger
         break;

      case DBGCMD_WATCHPOINT:
         set_databreakpoint(cmd_args.dwAddress);
         break;

      case DBGCMD_BREAKPOINT:
         set_codebreakpoint(cmd_args.dwAddress);
         break;

      case DBGCMD_CLEARBP:

         if (cmd_args.dwBPType == BPITEM_WATCHPOINT)
            clear_databreakpoint();

         if (cmd_args.dwBPType == BPITEM_BREAKPOINT)
            clear_codebreakpoint();

         break;

      case DBGCMD_GO:

         // in order to continue from a code breakpoint
         // we must clear the breakpoint (restore the
         // original opcode) before continuing.

         // an implementation of "sticky breakpoints"
         // is much more complex.

         if (g_fAtCodeBreakpoint)
         {

            clear_codebreakpoint();
            set_thread_eip_back(g_dwCurrentThreadID);
         }

         g_fInDbgCmd = FALSE;
         return FALSE; // means do not quit debugger
         break;

      case DBGCMD_SHOWHELP:
         display_help();
         break;
      case DBGCMD_UNKNOWN:
         printf("unknown command\n");
         break;

      default:
         printf("do_debug_command: should never get here\n");
         break;

      }

   }

   g_fInDbgCmd = FALSE;
   return FALSE;  // should not get here

}

DWORD parse_command | ( | char * | szCmd,
 |  | PCMD_ARGS | pcmd_args
 | ) |  |

Definition at line 175 of file DbgCmd.c.

{
   char *ptr;

   // swallow any leading spaces
   ptr = szCmd;
   while (' ' == *ptr)
      ptr++;

   // we found the go command
   if (('g' == *ptr) || ('G' == *ptr))
      return DBGCMD_GO;

   // quit command
   if (('q' == *ptr) || ('Q' == *ptr))
      return DBGCMD_QUIT;

   // set watchpoint
   // w XXXXXXXX address
   if (('w' == *ptr) || ('W' == *ptr))
   {
      char *stopstring;

      ptr++;
      pcmd_args->dwAddress = strtoul( ptr, &stopstring, 16 );

      if (pcmd_args->dwAddress == 0)
      {
         printf("cannot set watchpoint at address 0\n");
         return DBGCMD_UNKNOWN;
      }

      return DBGCMD_WATCHPOINT;
   }

   // set breakpoint
   // b XXXXXXXX address
   if (('b' == *ptr) || ('B' == *ptr))
   {
      char *stopstring;   // for strtoul

      ptr++;
      pcmd_args->dwAddress = strtoul( ptr, &stopstring, 16 );

      if (pcmd_args->dwAddress == 0)
      {
         printf("cannot set watchpoint at address 0\n");
         return DBGCMD_UNKNOWN;
      }

      return DBGCMD_BREAKPOINT;
   }

   // clear breakpoints
   // either cw or cb
   if (('c' == *ptr) || ('C' == *ptr))
   {
      ptr++;
      if (('w' == *ptr) || ('W' == *ptr))
      {
         pcmd_args->dwBPType = BPITEM_WATCHPOINT;
         return DBGCMD_CLEARBP;
      }

      if (('b' == *ptr) || ('B' == *ptr))
      {
         pcmd_args->dwBPType = BPITEM_BREAKPOINT;
         return DBGCMD_CLEARBP;
      }

      return DBGCMD_UNKNOWN;
   }

   // for displaying help
   if ('?' == *ptr)
   {
      return DBGCMD_SHOWHELP;
   }

   return DBGCMD_UNKNOWN;

}

Variable Documentation

DWORD g_dwCurrentThreadID = 0

Definition at line 46 of file DbgCmd.c.

BOOL g_fAtCodeBreakpoint = FALSE

Definition at line 45 of file DbgCmd.c.

BOOL g_fInDbgCmd = FALSE

Definition at line 43 of file DbgCmd.c.

char szCmd[0x1000]

Definition at line 49 of file DbgCmd.c.

Generated on Wed Nov 13 2024 16:55:01 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Debug/BPSamp/Main.c File Reference

  • WinBase
  • Debug
  • BPSamp
Functions | Variables

Main.c File Reference

#include <windows.h>
#include <stdio.h>
#include "bpsamp.h"

Go to the source code of this file.

Functions

BOOL WINAPI | control_C_handler (DWORD dwCtrlType)
void | main (int argc, char **argv)

Variables

HANDLE g_hProcDebuggee

Function Documentation

BOOL WINAPI control_C_handler ( DWORD dwCtrlType )

Definition at line 203 of file Main.c.

{
   DWORD dwThreadID = 0;
   HANDLE hThread;

   if ((CTRL_C_EVENT == dwCtrlType) || (CTRL_BREAK_EVENT == dwCtrlType))
   {
      // don't start new debug command threads if one already started
      if (g_fInDbgCmd)
         return TRUE;
      // to start the command prompt create a thread and
      // return

      g_fInDbgCmd = TRUE;  // keeps from calling CreateRemoteThread
                         // multiple times when debugger command thread
                         // is active
      hThread = CreateRemoteThread(g_hProcDebuggee, NULL, 0,
         (LPTHREAD_START_ROUTINE)DebugBreak, NULL, 0, &dwThreadID);
      if (hThread == NULL)
      {
         printf("ERROR: CreateRemoteThread failed: %d\n", GetLastError());
         g_fInDbgCmd = FALSE;
      }
      else
      {
         CloseHandle(hThread);
      }

      return TRUE;
   }

   return FALSE;
}

void main | ( | int | argc,
 |  | char ** | argv
 | ) |  |

Definition at line 31 of file Main.c.

{
   BOOL fExit = FALSE;
   STARTUPINFO si;
   PROCESS_INFORMATION pi;
   LPSTR lpszCmdLine = NULL;
   DEBUG_EVENT de;
   DWORD dwContinue = 0;
   OSVERSIONINFO osvi;

   if (argc < 2)
   {
      printf("please pass name of exe to debug\n");
      return;

   }

   lpszCmdLine = argv[1];

   osvi.dwOSVersionInfoSize = sizeof(osvi);
   GetVersionEx(&osvi);
   if (osvi.dwPlatformId != VER_PLATFORM_WIN32_NT)
   {
      printf("This sample is only supported on Windows NT\n");
      return;
   }

   // register a control C handler to get user commands
   if (!SetConsoleCtrlHandler(control_C_handler, TRUE))
   {
      printf("FATAL! SetConsoleCtrlHandler failed: %d\n", GetLastError());
      return;
   }

   memset(&si, 0, sizeof(STARTUPINFO));
   si.cb = sizeof(STARTUPINFO);
   if (!CreateProcess(NULL, lpszCmdLine, NULL, NULL, 1,
        NORMAL_PRIORITY_CLASS | DEBUG_PROCESS, NULL, NULL, &si, &pi))
   {
      printf("CreateProcess(%s) failed: %d.\n", lpszCmdLine, GetLastError() );
      return;
   }

   display_help();

   g_hProcDebuggee = pi.hProcess;

   while(!fExit && WaitForDebugEvent(&de, INFINITE))
   {

      dump_debug_event_info(&de);

      dwContinue = DBG_CONTINUE;
      switch(de.dwDebugEventCode)
      {
         case EXCEPTION_DEBUG_EVENT:

         switch (de.u.Exception.ExceptionRecord.ExceptionCode)
         {
            case EXCEPTION_BREAKPOINT:

               display_thread_registers(de.dwThreadId);

               // if Eip is at the g_dwCodeAddress for
               // the code breakpoint, indicate the the
               // rest of the debugger we are at a code
               // breakpoint.

               if (de.u.Exception.ExceptionRecord.ExceptionAddress ==
                     (LPVOID)g_dwCodeAddress)
               {
                  printf("code breakpoint hit!\n");
                  g_fAtCodeBreakpoint = TRUE;
                  g_dwCurrentThreadID = de.dwThreadId;
               }
               else
               {
                  g_fAtCodeBreakpoint = FALSE;
               }

               fExit = do_debug_command();

               dwContinue = DBG_CONTINUE;

            break;

            case EXCEPTION_SINGLE_STEP:

               display_thread_registers(de.dwThreadId);

               fExit = do_debug_command();
               dwContinue = DBG_CONTINUE;

            break;

            case DBG_CONTROL_C:
            case DBG_CONTROL_BREAK:

               fExit = do_debug_command();
               dwContinue = DBG_CONTINUE;

            break;

            default:
               dwContinue = DBG_EXCEPTION_NOT_HANDLED;
            break;
         }

         break;

         case CREATE_THREAD_DEBUG_EVENT:
            add_thread(de.dwThreadId, de.u.CreateThread.hThread);
         break;

         case CREATE_PROCESS_DEBUG_EVENT:
            add_thread(de.dwThreadId, de.u.CreateProcessInfo.hThread);
         break;

         case EXIT_THREAD_DEBUG_EVENT:
            remove_thread(de.dwThreadId);
         break;

         case EXIT_PROCESS_DEBUG_EVENT:
               fExit = TRUE;
         break;

         case LOAD_DLL_DEBUG_EVENT:
         break;

         case UNLOAD_DLL_DEBUG_EVENT:
         break;

         case OUTPUT_DEBUG_STRING_EVENT:
         break;

         case RIP_EVENT:
         break;
         default:
         break;
      }

      ContinueDebugEvent(de.dwProcessId, de.dwThreadId, dwContinue);

   }  // while(!fExit && WaitForDebugEvent(&de, INFINITE))

}

Variable Documentation

HANDLE g_hProcDebuggee

Definition at line 19 of file Main.c.

Generated on Wed Nov 13 2024 16:53:52 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Debug/BPSamp/Utils.c File Reference

  • WinBase
  • Debug
  • BPSamp
Classes | Defines | Typedefs | Functions | Variables

Utils.c File Reference

#include <windows.h>
#include <stdio.h>
#include "bpsamp.h"

Go to the source code of this file.

Classes

struct | DBG_THREAD_INFO

Defines

#define | DR7CLEAR 0x00000000
#define | DR7SET 0x000d0101
#define | MAX_THREADS 100

Typedefs

typedef struct DBG_THREAD_INFO * | PDBG_THREAD_INFO

Functions

BOOL | add_thread (DWORD dwThreadID, HANDLE hThread)
BOOL | clear_codebreakpoint (void)
BOOL | clear_databreakpoint (void)
void | clearthread_databreakpoint (HANDLE hThread)
BOOL display_thread_registers (DWORD dwID)
void | dump_debug_event_info (DEBUG_EVENT *de)
BOOL | remove_thread (DWORD dwThreadID)
BOOL | set_codebreakpoint (DWORD dwAddress)
BOOL | set_databreakpoint (DWORD dwAddress)
void | set_thread_eip_back (DWORD dwThreadID)
void | setthread_databreakpoint (HANDLE hThread, DWORD dwAddress)

Variables

BYTE | bOpCode
DWORD g_dwCodeAddress
const BYTE | X86INT3 = 0xcc

Define Documentation

#define DR7CLEAR 0x00000000

Definition at line 229 of file Utils.c.

#define DR7SET 0x000d0101

this example is hardcoded to set a debug register to watch when memory changes at a certain address

Definition at line 228 of file Utils.c.

#define MAX_THREADS 100

Definition at line 38 of file Utils.c.

Typedef Documentation

typedef struct DBG_THREAD_INFO * PDBG_THREAD_INFO

Function Documentation

BOOL add_thread | ( | DWORD | dwThreadID,
 |  | HANDLE | hThread
 | ) |  |

Definition at line 52 of file Utils.c.

{
   DWORD i;

   // find first empty slot
   for (i = 0; i<MAX_THREADS; i++)
   {
      if (dti[i].dwThreadID == 0)
      {
         dti[i].dwThreadID = dwThreadID;

         if (!DuplicateHandle(GetCurrentProcess(),
                  hThread,
                  GetCurrentProcess(),
                  &(dti[i].hThread),
                  THREAD_GET_CONTEXT | THREAD_SET_CONTEXT,
                  FALSE,
                  0))
         {
            printf("add_thread: DuplicateHandle failed: %d\n",
            GetLastError());
         }

         return TRUE;
      }

   }

   // assume no slot left
   printf("WARNING! tried to add more threads than %d thread in list\n",
   MAX_THREADS);
   return FALSE;
}

BOOL clear_codebreakpoint ( void )

Definition at line 451 of file Utils.c.

{
   DWORD cbBytes;

   if (g_dwCodeAddress == 0)
   {
      printf("no code breakpoint to clear\n");
      return FALSE;
   }

   if (!WriteProcessMemory(g_hProcDebuggee,
                          (LPVOID)g_dwCodeAddress,
                          (LPVOID)&bOpCode, 1, &cbBytes))
   {
      printf("ReadProcessMemory failed: %d\n", GetLastError());
      return FALSE;
   }

   g_dwCodeAddress = 0;

   return TRUE;

}

BOOL clear_databreakpoint ( void )

Definition at line 371 of file Utils.c.

{
   DWORD i;

   // need to iterate through each thread ID
   // and set the thread context to set the debug
   // threads
   for (i=0; i<MAX_THREADS; i++)
   {
      if (dti[i].dwThreadID)
      {
         clearthread_databreakpoint(dti[i].hThread);
      }

   }

   return TRUE;
}

void clearthread_databreakpoint ( HANDLE hThread )

Definition at line 291 of file Utils.c.

{
   CONTEXT context;

   context.ContextFlags = CONTEXT_DEBUG_REGISTERS;

   if (!GetThreadContext(hThread, &context))
   {
      printf("GetThreadContext failed: %d\n", GetLastError());
      return;
   }

   context.Dr0 = 0;
   context.Dr7 = DR7CLEAR;

   if (!SetThreadContext(hThread, &context))
   {
      printf("SetThreadContext failed: %d\n", GetLastError());
      return;
   }

   if (!GetThreadContext(hThread, &context))
   {
      printf("GetThreadContext failed: %d\n", GetLastError());
      return;
   }

   printf("clearthread_databreakpoint -- Dr0 = %08X, Dr7 = %08X\n",
   context.Dr0, context.Dr7);

}

BOOL display_thread_registers ( DWORD dwID )

Definition at line 131 of file Utils.c.

{
   DWORD i;
   CONTEXT context;

   // find request thread id
   for (i = 0; i<MAX_THREADS; i++)
   {
      if (dti[i].dwThreadID == dwID)
      {
         context.ContextFlags = CONTEXT_FULL;
         if (!GetThreadContext(dti[i].hThread, &context))
         {
            printf("GetThreadContext failed: %d\n", GetLastError());
            return FALSE;
         }

         printf("eax=%08x ebx=%08x ecx=%08x edx=%08x esi=%08x edi=%08x\n"
                "eip=%08x esp=%08x ebp=%08x\n",
                context.Eax,
                context.Ebx,
                context.Ecx,
                context.Edx,
                context.Esi,
                context.Edi,
                context.Eip,
                context.Esp,
                context.Ebp);

         return TRUE;
      }

   }

   // assume thread ID not found here
   printf("WARNING: request to thread registers for %d not found"
          "in thread list\n", dwID);
   return FALSE;

}

void dump_debug_event_info ( DEBUG_EVENT * de )

Definition at line 488 of file Utils.c.

{

   switch(de->dwDebugEventCode)
   {
      case EXCEPTION_DEBUG_EVENT:
         printf("%d: EXCEPTION_DEBUG_EVENT\n", de->dwThreadId);

         switch (de->u.Exception.ExceptionRecord.ExceptionCode)
         {
            case EXCEPTION_ACCESS_VIOLATION:
               printf("\tEXCEPTION_ACCESS_VIOLATION\n");
            break;

            case EXCEPTION_DATATYPE_MISALIGNMENT:
               printf("\tEXCEPTION_DATATYPE_MISALIGNMENT\n");
            break;

            case EXCEPTION_BREAKPOINT:
               printf("\tEXCEPTION_BREAKPOINT\n");
            break;

            case EXCEPTION_SINGLE_STEP:
               printf("\tEXCEPTION_SINGLE_STEP\n");
            break;

            case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
               printf("\tEXCEPTION_ARRAY_BOUNDS_EXCEEDED\n");
            break;

            case EXCEPTION_FLT_DENORMAL_OPERAND:
               printf("\tEXCEPTION_FLT_DENORMAL_OPERAND\n");
            break;

            case EXCEPTION_FLT_DIVIDE_BY_ZERO:
               printf("\tEXCEPTION_FLT_DIVIDE_BY_ZERO\n");
            break;

            case EXCEPTION_FLT_INEXACT_RESULT:
               printf("\tEXCEPTION_FLT_INEXACT_RESULT\n");
            break;

            case EXCEPTION_FLT_INVALID_OPERATION:
               printf("\tEXCEPTION_FLT_INVALID_OPERATION\n");
            break;

            case EXCEPTION_FLT_OVERFLOW:
               printf("\tEXCEPTION_FLT_OVERFLOW\n");
            break;

            case EXCEPTION_FLT_STACK_CHECK:
               printf("\tEXCEPTION_FLT_STACK_CHECK\n");
            break;

            case EXCEPTION_FLT_UNDERFLOW:
               printf("\tEXCEPTION_FLT_UNDERFLOW\n");
            break;

            case EXCEPTION_INT_DIVIDE_BY_ZERO:
               printf("\tEXCEPTION_INT_DIVIDE_BY_ZERO\n");
            break;

            case EXCEPTION_INT_OVERFLOW:
               printf("\tEXCEPTION_INT_OVERFLOW\n");
            break;

            case EXCEPTION_PRIV_INSTRUCTION:
               printf("\tEXCEPTION_PRIV_INSTRUCTION\n");
            break;

            case EXCEPTION_IN_PAGE_ERROR:
               printf("\tEXCEPTION_IN_PAGE_ERROR\n");
            break;

            case EXCEPTION_ILLEGAL_INSTRUCTION:
               printf("\tEXCEPTION_ILLEGAL_INSTRUCTION\n");
            break;

            case EXCEPTION_NONCONTINUABLE_EXCEPTION:
               printf("\tEXCEPTION_NONCONTINUABLE_EXCEPTION\n");
            break;

            case EXCEPTION_STACK_OVERFLOW:
               printf("\tEXCEPTION_STACK_OVERFLOW\n");
            break;

            case EXCEPTION_INVALID_DISPOSITION:
               printf("\tEXCEPTION_INVALID_DISPOSITION\n");
            break;

            case EXCEPTION_GUARD_PAGE:
               printf("\tEXCEPTION_GUARD_PAGE\n");
            break;

            case EXCEPTION_INVALID_HANDLE:
               printf("\tEXCEPTION_INVALID_HANDLE\n");
            break;

            case CONTROL_C_EXIT:
               printf("\tCONTROL_C_EXIT\n");
            break;

            case DBG_CONTROL_C:
               printf("\tDBG_CONTROL_C\n");
            break;

            case DBG_CONTROL_BREAK:
               printf("\tDBG_CONTROL_BREAK\n");
            break;

            default:
               printf("\tUnknown exception raised: %08X\n",
               de->u.Exception.ExceptionRecord.ExceptionCode);
            break;
         }

      break;

      case CREATE_THREAD_DEBUG_EVENT:
         printf("%d: CREATE_THREAD_DEBUG_EVENT.\n", de->dwThreadId);
      break;

      case CREATE_PROCESS_DEBUG_EVENT:
         printf("%d: CREATE_PROCESS_DEBUG_EVENT\n", de->dwThreadId);
      break;

      case EXIT_THREAD_DEBUG_EVENT:
         printf("%d: EXIT_THREAD_DEBUG_EVENT\n", de->dwThreadId);
      break;

      case EXIT_PROCESS_DEBUG_EVENT:
         printf("%d: EXIT_PROCESS_DEBUG_EVENT\n", de->dwThreadId);
      break;

      case LOAD_DLL_DEBUG_EVENT:
         printf("%d: LOAD_DLL_DEBUG_EVENT\n", de->dwThreadId);
      break;

      case UNLOAD_DLL_DEBUG_EVENT:
         printf("%d: UNLOAD_DLL_DEBUG_EVENT\n", de->dwThreadId);
      break;

      case OUTPUT_DEBUG_STRING_EVENT:
         printf("%d: OUTPUT_DEBUG_STRING_EVENT\n", de->dwThreadId);
      break;

      case RIP_EVENT:
         printf("%d: RIP_EVENT\n", de->dwThreadId);
      break;

      default:  // we should never get here
         printf("%d: de.dwDebugEventCode default case %08X\n",
         de->dwThreadId, de->dwDebugEventCode);
      break;
   }

}

BOOL remove_thread ( DWORD dwThreadID )

Definition at line 96 of file Utils.c.

{
   DWORD i;

   // find request thread id
   for (i = 0; i<MAX_THREADS; i++)
   {
      if (dti[i].dwThreadID == dwThreadID)
      {
         dti[i].dwThreadID = 0;
         CloseHandle(dti[i].hThread);
         dti[i].hThread = NULL;
         return TRUE;
      }

   }

   // assume thread ID not found here
   printf("WARNING: request to remove thread %d not found in thread list\n",
   dwThreadID);
   return FALSE;

}

BOOL set_codebreakpoint ( DWORD dwAddress )

Definition at line 414 of file Utils.c.

{
   DWORD cbBytes;

   // read the original opcode of where we want to set an int 3 instruction
   if (!ReadProcessMemory(g_hProcDebuggee,
                         (LPCVOID)dwAddress,
                         (LPVOID)&bOpCode, 1, &cbBytes))
   {
      printf("ReadProcessMemory failed: %d\n", GetLastError());
      return FALSE;
   }

   if (!WriteProcessMemory(g_hProcDebuggee,
                          (LPVOID)dwAddress,
                          (LPVOID)&X86INT3, 1, &cbBytes))
   {
      printf("ReadProcessMemory failed: %d\n", GetLastError());
      return FALSE;
   }

   g_dwCodeAddress = dwAddress;
   printf("Breakpoint set at %08X\n", g_dwCodeAddress);
   return TRUE;
}

BOOL set_databreakpoint ( DWORD dwAddress )

Definition at line 342 of file Utils.c.

{
   DWORD i;

   // need to iterate through each thread ID
   // and set the thread context to set the debug
   // threads
   for (i=0; i<MAX_THREADS; i++)
   {
      if (dti[i].dwThreadID)
      {
         setthread_databreakpoint(dti[i].hThread, dwAddress);
      }

   }

   return TRUE;
}

void set_thread_eip_back ( DWORD dwThreadID )

Definition at line 183 of file Utils.c.

{
   HANDLE hThread = NULL;
   int i;
   CONTEXT context;

   for (i=0; i<MAX_THREADS; i++)
   {
      if (dti[i].dwThreadID == dwThreadID)
      {
         hThread = dti[i].hThread;
         break;
      }
   }

   if (hThread == NULL)
   {
      printf("FATAL: cannot find thread %d in thread list to set EIP back\n", dwThreadID);
   }

   context.ContextFlags = CONTEXT_CONTROL;

   GetThreadContext(hThread, &context);
   context.Eip--;
   SetThreadContext(hThread, &context);

}

void setthread_databreakpoint | ( | HANDLE | hThread,
 |  | DWORD | dwAddress
 | ) |  |

Definition at line 244 of file Utils.c.

{
   CONTEXT context;

   context.ContextFlags = CONTEXT_DEBUG_REGISTERS;

   if (!GetThreadContext(hThread, &context))
   {
      printf("GetThreadContext failed: %d\n", GetLastError());
      return;
   }

   context.Dr0 = dwAddress;
   context.Dr7 = DR7SET;
   context.Dr6 = 0;

   if (!SetThreadContext(hThread, &context))
   {
      printf("SetThreadContext failed: %d\n", GetLastError());
      return;
   }

   if (!GetThreadContext(hThread, &context))
   {
      printf("GetThreadContext failed: %d\n", GetLastError());
      return;
   }

   printf("setthread_databreakpoint set Dr0 = %08X, Dr7 = %08X\n",
   context.Dr0, context.Dr7);

}

Variable Documentation

BYTE bOpCode

Definition at line 222 of file Utils.c.

DWORD g_dwCodeAddress

Definition at line 221 of file Utils.c.

const BYTE X86INT3 = 0xcc

Definition at line 223 of file Utils.c.

Generated on Wed Nov 13 2024 16:54:04 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Debug/dbh/dbh.cpp File Reference

  • WinBase
  • Debug
  • dbh
Classes | Defines | Typedefs | Enumerations | Functions | Variables

dbh.cpp File Reference

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <assert.h>
#include <dbghelp.h>
#include <strsafe.h>
#include <crtdbg.h>

Go to the source code of this file.

Classes

struct | _CMD
struct | ENUMSYMDATA

Defines

#define | DIMA(Array) DIMAT(Array, (Array)[0])
#define | DIMAT(Array, EltType) (sizeof(Array) / sizeof(EltType))
#define | dispaddr(addr) _dispaddr(addr, false)
#define | dumpsym(sym) _dumpsym(sym, false)
#define | false FALSE
#define | MAX_FORMAT_STRINGS 8
#define | MAX_STR 256
#define | SI_BUFFER_SIZE (sizeof(SYMBOL_INFO) + MAX_SYM_NAME)
#define | SYM_BUFFER_SIZE (sizeof(IMAGEHLP_SYMBOL64) + MAX_SYM_NAME)
#define | SymTagMax 0x1f
#define | true TRUE
#define | WILD_UNDERSCORE 1

Typedefs

typedef struct _CMD | CMD
typedef BOOL(* | CMDPROC )(char *params)
typedef struct _CMD * | PCMD
typedef struct ENUMSYMDATA * | PENUMSYMDATA

Enumerations

enum {
cmdQuit = 0, cmdHelp, cmdVerbose, cmdLoad,
cmdUnload, cmdEnum, cmdName, cmdAddr,
cmdBase, cmdNext, cmdPrev, cmdLine,
cmdLineNext, cmdLinePrev, cmdUndec, cmdFindFile,
cmdAdd, cmdDelete, cmdEnumForAddr, cmdLocals,
cmdType, cmdInfo, cmdMax
}

Functions

char * | _dispaddr (ULONG64 addr, BOOL pad)
void | _dumpsym (PIMAGEHLP_SYMBOL64 sym, BOOL pad)
BOOL CALLBACK | cbEnumSymbols (PSYMBOL_INFO si, ULONG size, PVOID context)
BOOL | cbSrcFiles (PSOURCEFILE pSourceFile, PVOID UserContext)
BOOL CALLBACK | cbSymbol (HANDLE hProcess, ULONG ActionCode, ULONG64 CallbackData, ULONG64 UserContext)
void | cleanup ()
BOOL | cmdline (int argc, char *argv[])
char * | dispsymtag (ULONG symtag)
int | dprintf (LPSTR Format,...)
void | dumpdbi (PIMAGE_DEBUG_INFORMATION dbi)
void | dumpLine (PIMAGEHLP_LINE64 line)
void | dumpsi (PSYMBOL_INFO si)
void | dumpsym32 (PIMAGEHLP_SYMBOL sym)
BOOL | fnAdd (char *)
BOOL | fnAddr (char *)
BOOL | fnBase (char *)
BOOL | fnDelete (char *)
BOOL | fnEnum (char *)
BOOL | fnEnumForAddr (char *)
BOOL | fnFindFile (char *)
BOOL | fnHelp (char *)
BOOL | fnInfo (char *)
BOOL | fnLine (char *)
BOOL | fnLineNext (char *)
BOOL | fnLinePrev (char *)
BOOL | fnLoad (char *)
BOOL | fnLocals (char *)
BOOL | fnName (char *)
BOOL | fnNext (char *)
BOOL | fnNextPrev (int direction, char *param)
BOOL | fnPrev (char *)
BOOL | fnQuit (char *)
BOOL | fnType (char *)
BOOL | fnUndec (char *)
BOOL | fnUnload (char *)
BOOL | fnVerbose (char *)
char * | GetParameters (char *cmd)
char * | getstr (char *buf, int size)
BOOL init ()
int | InputLoop ()
BOOL | lineNextPrev (BOOL prev)
__cdecl | main (int argc, char *argv[], char *envp[])
void | prompt ()
PIMAGEHLP_SYMBOL64 | SymbolFromName (char *param)
DWORD64 | sz2addr (char *sz)
__inline int | ucase (int c)
BOOL | validnum (char *sz)

Variables

char * | g_SymTagNames []
DWORD64 | gBase
CMD | gCmd [cmdMax]
DWORD64 | gDefaultBase
DWORD64 | gDefaultBaseForVirtualMods
char | gExecCmd [MAX_STR] = ""
char | gImageName [MAX_STR]
IMAGEHLP_LINE64 | gLine
char | gModName [MAX_STR] = ""
char | gObj [MAX_PATH+1] = ""
DWORD gOptions
char | gSrcFileName [MAX_PATH+1] = ""
char | gSymbolSearchPath [MAX_STR]
HANDLE gTID

Define Documentation

#define DIMA ( Array ) DIMAT(Array, (Array)[0])

Definition at line 29 of file dbh.cpp.

#define DIMAT | ( | Array,
 |  | EltType |
 | ) |  | (sizeof(Array) / sizeof(EltType))

Definition at line 28 of file dbh.cpp.

#define dispaddr ( addr ) _dispaddr(addr, false)

Definition at line 216 of file dbh.cpp.

#define dumpsym ( sym ) _dumpsym(sym, false)

Definition at line 272 of file dbh.cpp.

#define false FALSE

Definition at line 33 of file dbh.cpp.

#define MAX_FORMAT_STRINGS 8

Definition at line 199 of file dbh.cpp.

#define MAX_STR 256

Definition at line 36 of file dbh.cpp.

#define SI_BUFFER_SIZE (sizeof(SYMBOL_INFO) + MAX_SYM_NAME)

Definition at line 39 of file dbh.cpp.

#define SYM_BUFFER_SIZE (sizeof(IMAGEHLP_SYMBOL64) + MAX_SYM_NAME)

Definition at line 38 of file dbh.cpp.

#define SymTagMax 0x1f

Definition at line 314 of file dbh.cpp.

#define true TRUE

Definition at line 32 of file dbh.cpp.

#define WILD_UNDERSCORE 1

Definition at line 37 of file dbh.cpp.

Typedef Documentation

typedef struct _CMD CMD
typedef BOOL(* CMDPROC)(char *params)

Definition at line 79 of file dbh.cpp.

typedef struct _CMD * PCMD
typedef struct ENUMSYMDATA * PENUMSYMDATA

Enumeration Type Documentation

anonymous enum
Enumerator:
cmdQuit
cmdHelp
cmdVerbose
cmdLoad
cmdUnload
cmdEnum
cmdName
cmdAddr
cmdBase
cmdNext
cmdPrev
cmdLine
cmdLineNext
cmdLinePrev
cmdUndec
cmdFindFile
cmdAdd
cmdDelete
cmdEnumForAddr
cmdLocals
cmdType
cmdInfo
cmdMax

Definition at line 50 of file dbh.cpp.

{
    cmdQuit = 0,
    cmdHelp,
    cmdVerbose,
    cmdLoad,
    cmdUnload,
    cmdEnum,
    cmdName,
    cmdAddr,
    cmdBase,
    cmdNext,
    cmdPrev,
    cmdLine,
    cmdLineNext,
    cmdLinePrev,
    cmdUndec,
    cmdFindFile,
    cmdAdd,
    cmdDelete,
    cmdEnumForAddr,
    cmdLocals,
    cmdType,
    cmdInfo,
    cmdMax
};

Function Documentation

char* _dispaddr | ( | ULONG64 | addr,
 |  | BOOL | pad
 | ) |  |

Definition at line 202 of file dbh.cpp.

{
    static char sz[20];

    if ((addr >> 32) != 0)
        StringCchPrintf(sz, DIMA(sz), "%8x`%08x", (ULONG)(addr>>32), (ULONG)addr);
    else
        StringCchPrintf(sz, DIMA(sz), pad ? "         %8x" : "%8x", (ULONG)addr);
    return sz;
}

void _dumpsym | ( | PIMAGEHLP_SYMBOL64 | sym,
 |  | BOOL | pad
 | ) |  |

Definition at line 261 of file dbh.cpp.

{
    printf(" name : %s\n", sym->Name);
    printf(" addr : %s\n", _dispaddr(sym->Address, pad));
    printf(" size : %x\n", sym->Size);
    printf("flags : %x\n", sym->Flags);
}

BOOL CALLBACK cbEnumSymbols | ( | PSYMBOL_INFO | si,
 |  | ULONG | size,
 |  | PVOID | context
 | ) |  |

Definition at line 383 of file dbh.cpp.

{
    PENUMSYMDATA esd = (PENUMSYMDATA)context;

    printf(" %8s : ", _dispaddr(si->Address, true));
    if (si->Flags & SYMF_FORWARDER)
        printf("%c ", 'F');
    else if (si->Flags & SYMF_EXPORT)
        printf("%c ", 'E');
    else
        printf("  ");
    printf("%s\n", si->Name);

    return true;
}

BOOL cbSrcFiles | ( | PSOURCEFILE | pSourceFile,
 |  | PVOID | UserContext
 | ) |  |

Definition at line 405 of file dbh.cpp.

{
    if (!pSourceFile)
        return false;

    printf("%s\n", pSourceFile->FileName);

    return true;
}

BOOL CALLBACK cbSymbol | ( | HANDLE | hProcess,
 |  | ULONG | ActionCode,
 |  | ULONG64 | CallbackData,
 |  | ULONG64 | UserContext
 | ) |  |

Definition at line 421 of file dbh.cpp.

{
    PIMAGEHLP_DEFERRED_SYMBOL_LOAD64 idsl;

    idsl = (PIMAGEHLP_DEFERRED_SYMBOL_LOAD64) CallbackData;

    switch ( ActionCode )
    {
    case CBA_DEBUG_INFO:
        printf("%s", (LPSTR)CallbackData);
        break;

    default:
        return false;
    }

    return false;
}

void cleanup ( )

Definition at line 1312 of file dbh.cpp.

{
    int i;

    fnUnload(NULL);
    for (i = 0; i < 50; i++)
        SymCleanup(gTID);
}

BOOL cmdline | ( | int | argc,
 |  | char * | argv[]
 | ) |  |

Definition at line 1322 of file dbh.cpp.

{
    int   i;
    char *p;

    for (i = 1; i < argc; i++)
    {
        p = argv[i];
        switch (*p)
        {
        case '/':
        case '-':
            p++;
            switch (tolower(*p))
            {
            case 'v':
                fnVerbose("on");
                break;
            default:
                printf("%s is an unknown switch\n", argv[i]);
                break;
            }
            break;

        default:
            if (*gModName) {
                StringCchCat(gExecCmd, DIMA(gExecCmd), argv[i]);
                StringCchCat(gExecCmd, DIMA(gExecCmd), " ");
            } else
                fnLoad(argv[i]);
            break;
        }
    }

    return true;
}

char* dispsymtag ( ULONG symtag )

Definition at line 352 of file dbh.cpp.

{
    if (symtag >= SymTagMax) {
        return "<Invalid>";
    } else {
        return g_SymTagNames[symtag];
    }
}

int dprintf | ( | LPSTR | Format,
 |  |  | ...
 | ) |  |

Definition at line 174 of file dbh.cpp.

{
    static char buf[1000] = "";
    va_list args;

    if ((gOptions & SYMOPT_DEBUG) == 0)
        return 1;

    va_start(args, Format);
    StringCchVPrintf(buf, DIMA(buf), Format, args);
    va_end(args);
    fputs(buf, stdout);
    return 1;
}

void dumpdbi ( PIMAGE_DEBUG_INFORMATION dbi )

Definition at line 296 of file dbh.cpp.

{
    printf("              List : 0x%x\n", dbi->List);
    printf("         ImageBase : 0x%x\n", dbi->ImageBase);
    printf("       SizeOfImage : 0x%x\n", dbi->SizeOfImage);
    printf(" SizeOfCoffSymbols : 0x%x\n", dbi->SizeOfCoffSymbols);
    printf("       CoffSymbols : 0x%x\n", dbi->CoffSymbols);
    printf("     ImageFilePath : %s\n",   dbi->ImageFilePath);
    printf("     ImageFileName : %s\n",   dbi->ImageFileName);
}

void dumpLine ( PIMAGEHLP_LINE64 line )

Definition at line 285 of file dbh.cpp.

{
    printf("file : %s\n", line->FileName);
    printf("line : %d\n", line->LineNumber);
    printf("addr : %s\n", dispaddr(line->Address));
}

void dumpsi ( PSYMBOL_INFO si )

Definition at line 364 of file dbh.cpp.

{
    printf("   name : %s\n", si->Name);
    printf("   addr : %s\n", dispaddr(si->Address));
    printf("   size : %x\n", si->Size);
    printf("  flags : %x\n", si->Flags);
    printf("   type : %x\n", si->TypeIndex);
    printf("modbase : %s\n", dispaddr(si->ModBase));
    printf("  value : %s\n", dispaddr(si->Value));
    printf("    reg : %x\n", si->Register);
    printf("  scope : %s (%x)\n", dispsymtag(si->Scope), si->Scope);
    printf("    tag : %s (%x)\n", dispsymtag(si->Tag), si->Tag);
}

void dumpsym32 ( PIMAGEHLP_SYMBOL sym )

Definition at line 274 of file dbh.cpp.

{
    printf(" name : %s\n", sym->Name);
    printf(" addr : %s\n", dispaddr(sym->Address));
    printf(" size : %x\n", sym->Size);
    printf("flags : %x\n", sym->Flags);
}

BOOL fnAdd ( char * param )

Definition at line 1092 of file dbh.cpp.

{
    BOOL               rc;
    DWORD64            addr;
    DWORD              size;
    char              *p;
    char               name[MAX_STR];
    char              *n;

    if (!param || !*param) {
        printf("add <name address> : must specify a symbol name, address, and size.\n");
        return true;
    }

    p = param;
    while (isspace(*p)) p++;
    *name = 0;
    for (n = name; *p; p++, n++) {
        if (isspace(*p)) {
            *n = 0;
            break;
        }
        *n = *p;
    }

    addr = 0;
    size = 0;
    while (isspace(*p)) p++;
    if (*(p + 1) == 'x' || *(p + 1) == 'X')
        p += 2;
    rc = sscanf(p, "%I64x %x", &addr, &size);
    if ((rc < 2) || !addr || !*name)
    {
        printf("add <name address> : must specify a symbol name, address, and size.\n");
        return true;
    }

    rc = SymAddSymbol(gTID, 0, name, addr, size, 0);
    if (!rc)
        printf("Error 0x%x trying to add symbol\n", GetLastError());

    return true;
}

BOOL fnAddr ( char * param )

Definition at line 644 of file dbh.cpp.

{
    BOOL               rc;
    DWORD64            addr;
    DWORD64            disp;
    PSYMBOL_INFO       si;

    addr = sz2addr(param);
    if (!addr)
    {
        printf("addr <address> : finds a symbol by it's hex address\n");
        return true;
    }

    si = (PSYMBOL_INFO)malloc(SI_BUFFER_SIZE);
    if (!si)
        return false;
    ZeroMemory(si, SI_BUFFER_SIZE);
    si->MaxNameLen = MAX_SYM_NAME;

    rc = SymFromAddr(gTID, addr, &disp, si);
    if (rc)
    {
        printf("%s", si->Name);
        if (disp)
            printf("+%I64x", disp);
        printf("\n");
        dumpsi(si);
    }

    free(si);

    return true;
}

BOOL fnBase ( char * param )

Definition at line 908 of file dbh.cpp.

{
    DWORD64            addr;

    addr = sz2addr(param);
    if (!addr)
    {
        printf("base <address> : sets the base address for module loads\n");
        return true;
    }

    gDefaultBase = addr;
    gDefaultBaseForVirtualMods = addr;
    if (gBase)
        fnLoad(gImageName);

    return true;
}

BOOL fnDelete ( char * param )

Definition at line 1139 of file dbh.cpp.

{
    BOOL               rc;
    DWORD64            addr;
    DWORD              err;
    char              *name = NULL;

    if (!param || !*param) {
        printf("del <name/address> : must specify a symbol name or address to delete.\n");
        return true;
    }

    addr = sz2addr(param);
    if (!addr)
        name = param;

    rc = SymDeleteSymbol(gTID, 0, name, addr, 0);
    if (!rc) {
        err = GetLastError();
        if (err == ERROR_NOT_FOUND)
            printf("Couldn't find %s to delete.\n", param);
        else
            printf("Error 0x%x trying to delete symbol\n", err);
    }

    return true;
}

BOOL fnEnum ( char * param )

Definition at line 602 of file dbh.cpp.

{
    BOOL rc;
    ENUMSYMDATA esd;

    esd.base = gBase;
    StringCchCopy(esd.mask, MAX_STR, param ? param : "");

    rc = SymEnumSymbols(gTID, gBase, param, cbEnumSymbols, &esd);
    if (!rc)
        printf("error 0x%x calling SymEnumSymbols()\n", GetLastError());

    return true;
}

BOOL fnEnumForAddr ( char * param )

Definition at line 682 of file dbh.cpp.

{
    BOOL               rc;
    DWORD64            addr;
    ENUMSYMDATA        esd;

    addr = sz2addr(param);
    if (!addr)
    {
        printf("enumaddr <addr> : lists all symbols with a certain hex address\n");
        return true;
    }

    esd.base = gBase;
    StringCchCopy(esd.mask, MAX_STR, "");

    rc = SymEnumSymbolsForAddr(gTID, addr, cbEnumSymbols, &esd);
    if (!rc)
        printf("error 0x%0 calling SymEnumSymbolsForAddr()\n", GetLastError());

    return true;
}

BOOL fnFindFile ( char * param )

Definition at line 1056 of file dbh.cpp.

{
    DWORD rc;
    char  root[MAX_PATH + 1];
    char  file[MAX_PATH + 1];
    char  found[MAX_PATH + 1];

    if (!param)
    {
        printf("ff <root path> <file name> - finds file in path\n");
        return true;
    }

    rc = sscanf(param, "%s %s", root, file);
    if ((rc < 2) || !*root || !*file)
    {
        printf("ff <root path> <file name> - finds file in path\n");
        return true;
    }

    *found = 0;

    rc = SearchTreeForFile(root, file, found);

    if (!rc) {
        printf("error 0x%u looking for %s\n", GetLastError(), file);
    } else {
        printf("found %s\n", found);
    }

    return true;
}

BOOL fnHelp ( char * param )

Definition at line 457 of file dbh.cpp.

{
    printf("      dbh commands :\n");
    printf("?             help : prints this message\n");
    printf("q             quit : quits this program\n");
    printf("v verbose <on/off> : controls debug spew\n");
    printf("    load <modname> : loads the requested module\n");
    printf("u           unload : unloads the current module\n");
    printf("x      enum <mask> : enumerates all matching symbols\n");
    printf("n   name <symname> : finds a symbol by it's name\n");
    printf("a      addr <addr> : finds a symbol by it's hex address\n");
    printf("m  enumaddr <addr> : lists all symbols with a certain hex address\n");
    printf("b   base <address> : sets the new default base address\n");
    printf("s   next <add/nam> : finds the symbol after the passed sym\n");
    printf("p   prev <add/nam> : finds the symbol before the passed sym\n");
    printf("l    line <file:#> : finds the matching line number\n");
    printf("j         linenext : goes to the next line after the current\n");
    printf("k         lineprev : goes to the line previous to the current\n");
    printf("f ff <path> <file> : finds file in path\n");
    printf("+  add <name addr> : adds symbols with passed name and address\n");
    printf("-  del <name/addr> : deletes symbols with passed name or address\n");
    printf("m  enumaddr <addr> : enum all symbols for address\n");
    printf("z    locals <name> : enum all scoped symbols for a named function\n");
    printf("t      type <name> : lists the type information for the symbol\n");
    printf("i             info : displays information about the loaded module\n");
    printf("      undec <name> : undecorates a given symbol name\n");

    return true;
}

BOOL fnInfo ( char * param )

Definition at line 779 of file dbh.cpp.

{
  IMAGEHLP_MODULE64 mi;

    static char *symtypes[NumSymTypes] =
    {
        "SymNone",
        "SymCoff",
        "SymCv",
        "SymPdb",
        "SymExport",
        "SymDeferred",
        "SymSym",
        "SymDia",
        "SymVirtual"
    };

    ZeroMemory((void *)&mi, sizeof(mi));
    mi.SizeOfStruct = sizeof(mi);

  if (!SymGetModuleInfo64(gTID, gBase, &mi))
  {
    printf("error 0x%x calling SymGetModuleInfo64()\n", GetLastError());
    return true;
  }

    printf("    SizeOfStruct : 0x%x\n", mi.SizeOfStruct);
    printf("     BaseOfImage : 0x%i64x\n", mi.BaseOfImage);
    printf("       ImageSize : 0x%x\n", mi.ImageSize);
    printf("   TimeDateStamp : 0x%x\n", mi.TimeDateStamp);
    printf("        CheckSum : 0x%x\n", mi.CheckSum);
    printf("         NumSyms : 0x%x\n", mi.NumSyms);
    printf("         SymType : %s\n", symtypes[mi.SymType]);
    printf("      ModuleName : %s\n", mi.ModuleName);
    printf("       ImageName : %s\n", mi.ImageName);
    printf(" LoadedImageName : %s\n", mi.LoadedImageName);

    return true;
}

BOOL fnLine ( char * param )

Definition at line 930 of file dbh.cpp.

{
    char              *file;
    DWORD              linenum;
    BOOL               rc;
    IMAGEHLP_LINE64    line;
    LONG               disp;

    if (!param || !*param)
        return true;

    file = param;

    while (*param != ':') {
        if (!*param)
            return true;
        param++;
    }
    *param++ = 0;
    linenum = atoi(param);
    if (!linenum)
        return true;

    memset(&line, 0, sizeof(line));
    line.SizeOfStruct = sizeof(IMAGEHLP_LINE64);
    rc = SymGetLineFromName64(gTID,
                              gModName,
                              file,
                              linenum,
                              &disp,
                              &line);

    if (!rc) {
        printf("line: error 0x%x looking for %s#%d\n",
               GetLastError(),
               file,
               linenum);
        return true;
    }

    dumpLine(&line);
    printf("disp : %x\n", disp);

    // save for future next/prev calls

    memcpy(&gLine, &line, sizeof(gLine));

    return true;
}

BOOL fnLineNext ( char * param )

Definition at line 1017 of file dbh.cpp.

{
    return lineNextPrev(false);
}

BOOL fnLinePrev ( char * param )

Definition at line 1025 of file dbh.cpp.

{
    return lineNextPrev(true);
}

BOOL fnLoad ( char * param )

Definition at line 513 of file dbh.cpp.

{
    char    ext[MAX_STR];
    char    mod[MAX_STR];
    DWORD   flags = 0;
    DWORD64 addr  = 0;
    DWORD   size  = 0x1000000;
    HANDLE  hf = NULL;
    BOOL    dontopen = false;

    if (!*param)
    {
        printf("load <modname> - you must specify a module to load\n");
        return true;
    }

    _splitpath(param, NULL, NULL, mod, ext);

    if (!*ext) {
        flags = SLMFLAG_VIRTUAL;
        addr = gDefaultBaseForVirtualMods;
    } else if (!_strcmpi(ext, ".pdb")) {
        addr = gDefaultBaseForVirtualMods;
        dontopen = true;
    } else {
        addr = gDefaultBase;
    }

    fnUnload(NULL);

    StringCchCopy(gModName, DIMA(gModName), mod);

    // you can do this with or without an open file handle

    if (!dontopen) {
        hf = CreateFile(param,
                        GENERIC_READ,
                        0,
                        NULL,
                        OPEN_EXISTING,
                        0,
                        0);
        size = GetFileSize(hf, NULL);
    }

    addr = SymLoadModuleEx(gTID,
                           hf,         // hFile,
                           param,      // ImageName,
                           mod,        // ModuleName,
                           addr,       // BaseOfDll,
                           size,       // SizeOfDll
                           NULL,       // Data
                           flags);     // Flags

    if (!addr)
    {
        *gModName = 0;
        printf("error 0x%x loading %s.\n", GetLastError(), param);
        return true;
    }
    StringCchCopy(gImageName, DIMA(gImageName), param);
    gBase = addr;

    if (hf != INVALID_HANDLE_VALUE)
        CloseHandle(hf);

    return true;
}

BOOL fnLocals ( char * param )

Definition at line 708 of file dbh.cpp.

{
    PSYMBOL_INFO         si;
    char                 name[MAX_STR];
    IMAGEHLP_STACK_FRAME frame;
    ENUMSYMDATA          esd;

    if (!param || !*param)
    {
        printf("locals <symbolname> - finds all locals a function\n");
        return true;
    }
    StringCchPrintf(name, DIMA(name), "%s!%s", gModName, param);

    si = (PSYMBOL_INFO)malloc(SI_BUFFER_SIZE);
    if (!si)
        return false;
    ZeroMemory(si, SI_BUFFER_SIZE);
    si->MaxNameLen = MAX_SYM_NAME;

    if (!SymFromName(gTID, name, si))
        goto exit;

    printf("dumping locals for %s...\n", si->Name);

    ZeroMemory(&frame, sizeof(frame));
    frame.InstructionOffset = si->Address;

    SymSetContext(gTID, &frame, NULL);

    esd.base = gBase;
    StringCchCopy(esd.mask, MAX_STR, "*");
    if (!SymEnumSymbols(gTID, 0, esd.mask, cbEnumSymbols, &esd))
        printf("error 0x%0 calling SymEnumSymbols()\n", GetLastError());

exit:
    free(si);

    return true;
}

BOOL fnName ( char * param )

Definition at line 620 of file dbh.cpp.

{
    SYMBOL_INFO_PACKAGE sip;    // this struct saves allocation code
    char         name[MAX_STR];

    if (!param || !*param)
    {
        printf("name <symbolname> - finds a symbol by it's name\n");
        return true;
    }
    StringCchPrintf(name, DIMA(name), "%s!%s", gModName, param);

    ZeroMemory(&sip, sizeof(sip));
    sip.si.MaxNameLen = MAX_SYM_NAME;

    if (SymFromName(gTID, name, &sip.si))
        dumpsi(&sip.si);

    return true;
}

BOOL fnNext ( char * param )

Definition at line 892 of file dbh.cpp.

{
    return fnNextPrev(1, param);
}

BOOL fnNextPrev | ( | int | direction,
 |  | char * | param
 | ) |  |

Definition at line 848 of file dbh.cpp.

{
    BOOL               rc;
    PIMAGEHLP_SYMBOL64 sym;
    DWORD64            addr;

    addr = sz2addr(param);
    if (!addr)
    {
        sym = SymbolFromName(param);
        if (!sym)
            return true;
        addr = sym->Address;
        if (!addr) {
            free(sym);
            return true;
        }
    }
    else
    {
        sym = (PIMAGEHLP_SYMBOL64)malloc(SYM_BUFFER_SIZE);
        if (!sym)
            return false;
        rc = SymGetSymFromAddr64(gTID, addr, NULL, sym);
        if (!rc)
            return true;
    }

    if (direction > 0)
        rc = SymGetSymNext64(gTID, sym);
    else
        rc = SymGetSymPrev64(gTID, sym);

    if (rc)
        dumpsym(sym);

    free(sym);

    return true;
}

BOOL fnPrev ( char * param )

Definition at line 900 of file dbh.cpp.

{
    return fnNextPrev(-1, param);
}

BOOL fnQuit ( char * param )

Definition at line 448 of file dbh.cpp.

{
    printf("goodbye\n");
    return false;
}

BOOL fnType ( char * param )

Definition at line 752 of file dbh.cpp.

{
    PSYMBOL_INFO si;

    if (!param || !*param)
    {
        printf("type <typename> - finds type info\n");
        return true;
    }

    si = (PSYMBOL_INFO)malloc(SI_BUFFER_SIZE);
    if (!si)
        return false;
    ZeroMemory(si, SI_BUFFER_SIZE);
    si->MaxNameLen = MAX_SYM_NAME;

    if (SymGetTypeFromName(gTID, gBase, param, si))
        dumpsi(si);

    free(si);

    return true;
}

BOOL fnUndec ( char * param )

Definition at line 1033 of file dbh.cpp.

{
    DWORD rc;
    char uname[MAX_SYM_NAME + 1];

    if (!param || !*param)
    {
        printf("undec <symbolname> - undecorates a C++ mangled symbol name\n");
        return true;
    }

    rc = UnDecorateSymbolName(param, uname, MAX_SYM_NAME, UNDNAME_COMPLETE);
    if (!rc)
        printf("error 0x%u undecorating %s\n", GetLastError(), param);
    else
        printf("%s =\n%s\n", param, uname);

    return true;
}

BOOL fnUnload ( char * param )

Definition at line 585 of file dbh.cpp.

{
    if (!gBase)
        return true;

    if (!SymUnloadModule64(gTID, gBase))
        printf("error unloading %s at %s\n", gModName, dispaddr(gBase));

    gBase = 0;
    *gModName = 0;

    return true;
}

BOOL fnVerbose ( char * param )

Definition at line 490 of file dbh.cpp.

{
    int opts = gOptions;

    if (!param || !*param)
        printf("");
    else if (!_strcmpi(param, "on"))
        opts |= SYMOPT_DEBUG;
    else if (!_strcmpi(param, "off"))
        opts = gOptions & ~SYMOPT_DEBUG;
    else
        printf("verbose <on//off>\n");

    gOptions = SymSetOptions(opts);

    printf("verbose mode %s.\n", gOptions & SYMOPT_DEBUG ? "on" : "off");

    return true;
}

char* GetParameters ( char * cmd )

Definition at line 1170 of file dbh.cpp.

{
    char *p     = cmd;
    char *param = NULL;

    while (*p++)
    {
        if (isspace(*p))
        {
            *p++ = 0;
             return *p ? p : NULL;
        }
    }

    return NULL;
}

char* getstr | ( | char * | buf,
 |  | int | size
 | ) |  |

Definition at line 1198 of file dbh.cpp.

{
    char *rc;

    rc = fgets(buf, size, stdin);
    if (!rc)
        return 0;

    while (*buf)
    {
        switch (*buf)
        {
        case 0xa:
            *buf = 0;
            // pass through
        case 0:
            return rc;
        }
        buf++;
    }

    return rc;
}

BOOL init ( )

Definition at line 1267 of file dbh.cpp.

{
    int i;
    BOOL rc;

    *gModName = 0;
    gBase = 0;;
    gDefaultBaseForVirtualMods = 0x1000000;
    gDefaultBase = 0x1000000;
    ZeroMemory(&gLine, sizeof(gLine));

    dprintf("dbh: initializing...\n");
    i = GetEnvironmentVariable("_NT_SYMBOL_PATH", gSymbolSearchPath, MAX_STR);
    if (i < 1)
        *gSymbolSearchPath = 0;
    dprintf("Symbol Path = [%s]\n", gSymbolSearchPath);

    gTID = (HANDLE)(ULONG_PTR)GetCurrentThreadId();
    rc = SymInitialize(gTID, gSymbolSearchPath, false);
    if (!rc)
    {
        printf("error 0x%x from SymInitialize()\n", GetLastError());
        return rc;
    }
    rc = SymInitialize(gTID, gSymbolSearchPath, false);
    if (!rc)
    {
        printf("error 0x%x from SymInitialize()\n", GetLastError());
        return rc;
    }

    gOptions = SymSetOptions(SYMOPT_CASE_INSENSITIVE | SYMOPT_UNDNAME | SYMOPT_LOAD_LINES | SYMOPT_ALLOW_ABSOLUTE_SYMBOLS | SYMOPT_AUTO_PUBLICS);
    dprintf("SymOpts = 0x%x\n", gOptions);

    rc = SymRegisterCallback64(gTID, cbSymbol, 0);
    if (!rc)
    {
        printf("error 0x%x from SymRegisterCallback64()\n", GetLastError());
        return rc;
    }

    return rc;
}

int InputLoop ( )

Definition at line 1226 of file dbh.cpp.

{
    char  cmd[MAX_STR + 1];
    char *params;
    int   i;
    BOOL  rc;

    do
    {
        rc = true;
        prompt();
        if (*gExecCmd) {
            StringCchCopy(cmd, DIMA(cmd), gExecCmd);
            printf(cmd);
            printf("\n");
        } else if (!getstr(cmd, sizeof(cmd)))
            return 0;
        params = GetParameters(cmd);

        for (i = 0; i < cmdMax; i++)
        {
            if (!_strcmpi(cmd, gCmd[i].token)
                || !_strcmpi(cmd, gCmd[i].shorttoken))
            {
                break;
            }
        }

        if (i == cmdMax)
            printf("[%s] is an unrecognized command.\n", cmd);
        else
            rc = gCmd[i].fn(params);

        if (*gExecCmd)
            rc = false;
    } while (rc);

    return 0;
}

BOOL lineNextPrev ( BOOL prev )

Definition at line 983 of file dbh.cpp.

{
    BOOL               rc;
    IMAGEHLP_LINE64    line;

    if (!gLine.SizeOfStruct)
        return true;
    memcpy(&line, &gLine, sizeof(line));

    if (prev)
        rc = SymGetLinePrev64(gTID, &line);
    else
        rc = SymGetLineNext64(gTID, &line);

    if (!rc) {
        printf("line: error 0x%x looking for %s#%d\n",
               GetLastError(),
               line.FileName,
               line.LineNumber);
        return true;
    }

    dumpLine(&line);

    // save for future next/prev calls

    memcpy(&gLine, &line, sizeof(gLine));

    return true;
}

__cdecl main | ( | int | argc,
 |  | char * | argv[],
 |  | char * | envp[]
 | ) |  |

Definition at line 1362 of file dbh.cpp.

{
    DWORD rc;

    _CrtSetDbgFlag( ( _CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_LEAK_CHECK_DF ) | _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG ) );

    if (!init())
        return 1;
    cmdline(argc, argv);
    rc = InputLoop();
    cleanup();

    _CrtDumpMemoryLeaks();

    return rc;
}

void prompt ( )

Definition at line 1188 of file dbh.cpp.

{
    if (!*gModName)
        printf("dbh: ");
    else
        printf("%s [%I64x]: ", gModName, gBase);
}

PIMAGEHLP_SYMBOL64 SymbolFromName ( char * param )

Definition at line 820 of file dbh.cpp.

{
    BOOL               rc;
    PIMAGEHLP_SYMBOL64 sym;
    char               name[MAX_STR];

    if (!name || !*name)
        return NULL;

    sym = (PIMAGEHLP_SYMBOL64)malloc(SYM_BUFFER_SIZE);
    if (!sym)
        return false;
    ZeroMemory(sym, SYM_BUFFER_SIZE);
    sym->MaxNameLength = MAX_SYM_NAME;

    StringCchPrintf(name, DIMA(name), "%s!%s", gModName, param);
    rc = SymGetSymFromName64(gTID, name, sym);
    if (!rc) {
        free(sym);
        return NULL;
    }

    return sym;
}

DWORD64 sz2addr ( char * sz )

Definition at line 239 of file dbh.cpp.

{
    char   *p;
    DWORD64 addr = 0;

    if (sz && *sz)
    {
        p = sz;
        if (*(p + 1) == 'x' || *(p + 1) == 'X')
            p += 2;
        if (!validnum(p))
            return 0;
        if (sscanf(p, "%I64x", &addr) < 1)
            return 0;
    }

    return addr;
}

__inline int ucase ( int c )

Definition at line 193 of file dbh.cpp.

{
    return (gOptions & SYMOPT_CASE_INSENSITIVE) ? toupper(c) : c;
}

BOOL validnum ( char * sz )

Definition at line 219 of file dbh.cpp.

{
    int c;

    for (; *sz; sz++)
    {
        c = tolower(*sz);
        if (c >= '0' && c <= '9')
            continue;
        if (c >= 'a' && c <= 'f')
            continue;
        return false;
    }

    return true;
}

Variable Documentation

char* g_SymTagNames[]

Definition at line 317 of file dbh.cpp.

DWORD64 gBase

Definition at line 159 of file dbh.cpp.

CMD gCmd[cmdMax]

Definition at line 115 of file dbh.cpp.

DWORD64 gDefaultBase

Definition at line 160 of file dbh.cpp.

DWORD64 gDefaultBaseForVirtualMods

Definition at line 161 of file dbh.cpp.

char gExecCmd[MAX_STR] = ""

Definition at line 165 of file dbh.cpp.

char gImageName[MAX_STR]

Definition at line 157 of file dbh.cpp.

IMAGEHLP_LINE64 gLine

Definition at line 164 of file dbh.cpp.

char gModName[MAX_STR] = ""

Definition at line 156 of file dbh.cpp.

char gObj[MAX_PATH+1] = ""

Definition at line 167 of file dbh.cpp.

DWORD gOptions

Definition at line 162 of file dbh.cpp.

char gSrcFileName[MAX_PATH+1] = ""

Definition at line 166 of file dbh.cpp.

char gSymbolSearchPath[MAX_STR]

Definition at line 158 of file dbh.cpp.

HANDLE gTID

Definition at line 163 of file dbh.cpp.

Generated on Wed Nov 13 2024 16:55:02 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Debug/Deb/Deb.h File Reference

  • WinBase
  • Debug
  • Deb
Defines

Deb.h File Reference

Go to the source code of this file.

Defines

#define | IDC_CLEAR_ON_NEW 9009
#define | IDC_DEBUG_MODE_ERROR 9021
#define | IDC_DEBUG_MODE_MINORERROR 9022
#define | IDC_DEBUG_MODE_NONE 9020
#define | IDC_DEBUG_MODE_WARNING 9023
#define | IDC_DEBUG_ONLY_THIS_PROCESS 9003
#define | IDC_DEBUG_PROCESS 9004
#define | IDC_HIGH_PRIORITY_CLASS 9007
#define | IDC_IDLE_PRIORITY_CLASS 9005
#define | IDC_INITIALDIR 9001
#define | IDC_NORMAL_PRIORITY_CLASS 9006
#define | IDC_PROCESSLIST 9002
#define | IDC_REALTIME_PRIORITY_CLASS 9008
#define | IDC_SAVE_PREFERENCES 9999
#define | IDC_SHOW_SYMBOLS 9011
#define | IDC_VERBOSE 9010
#define | IDM_EDIT_COPY 1202
#define | IDM_EDIT_CUT 1201
#define | IDM_EDIT_DELETE 1203
#define | IDM_FILE_ATTACH 1102
#define | IDM_FILE_EXIT 1109
#define | IDM_FILE_OPEN 1101
#define | IDM_HELP_ABOUT 1909
#define | IDM_HELP_CONTENTS 1901
#define | IDM_HELP_HOWTOUSE 1903
#define | IDM_HELP_SEARCH 1902
#define | IDM_OPTIONS_COLOR 1705
#define | IDM_OPTIONS_FONT 1701
#define | IDM_OPTIONS_PREFERENCES 1702
#define | IDM_OPTIONS_SAVEDDIR 1704
#define | IDM_OPTIONS_SAVENOW 1799
#define | IDM_OPTIONS_SAVEONEXIT 1798
#define | IDM_OPTIONS_TOOLBAR 1703
#define | IDS_API_FAILED_MSG 9001
#define | IDS_APPNAME 2000
#define | IDS_BUTTON_ATTACH 2021
#define | IDS_BUTTON_COPY 2023
#define | IDS_BUTTON_CUT 2022
#define | IDS_BUTTON_DELETE 2024
#define | IDS_BUTTON_HELP 2025
#define | IDS_BUTTON_OPEN 2020
#define | IDS_DEBUG_EVENTS 2040
#define | IDS_EXIT_BOX_TEXT 2031
#define | IDS_EXIT_BOX_TITLE 2030
#define | IDS_OFN_DEBUGGEE_TITLE 2013
#define | IDS_OFN_FILTER 2012
#define | IDS_OFN_FILTERNAME 2011
#define | IDS_OFN_TITLE 2010
#define | IDS_SHORT_APPNAME 2001
#define | IDS_WINDOWS_NT_REQUIRED 9999
#define | IDS_WINDOWS_NT_REQUIRED_TITLE 9998
#define | UM_CREATE_LISTBOX (WM_APP+0)
#define | WM_APP 0x8000

Define Documentation

#define IDC_CLEAR_ON_NEW 9009

Definition at line 76 of file Deb.h.

#define IDC_DEBUG_MODE_ERROR 9021

Definition at line 80 of file Deb.h.

#define IDC_DEBUG_MODE_MINORERROR 9022

Definition at line 81 of file Deb.h.

#define IDC_DEBUG_MODE_NONE 9020

Definition at line 79 of file Deb.h.

#define IDC_DEBUG_MODE_WARNING 9023

Definition at line 82 of file Deb.h.

#define IDC_DEBUG_ONLY_THIS_PROCESS 9003

Definition at line 70 of file Deb.h.

#define IDC_DEBUG_PROCESS 9004

Definition at line 71 of file Deb.h.

#define IDC_HIGH_PRIORITY_CLASS 9007

Definition at line 74 of file Deb.h.

#define IDC_IDLE_PRIORITY_CLASS 9005

Definition at line 72 of file Deb.h.

#define IDC_INITIALDIR 9001

Definition at line 68 of file Deb.h.

#define IDC_NORMAL_PRIORITY_CLASS 9006

Definition at line 73 of file Deb.h.

#define IDC_PROCESSLIST 9002

Definition at line 69 of file Deb.h.

#define IDC_REALTIME_PRIORITY_CLASS 9008

Definition at line 75 of file Deb.h.

#define IDC_SAVE_PREFERENCES 9999

Definition at line 83 of file Deb.h.

#define IDC_SHOW_SYMBOLS 9011

Definition at line 78 of file Deb.h.

#define IDC_VERBOSE 9010

Definition at line 77 of file Deb.h.

#define IDM_EDIT_COPY 1202

Definition at line 26 of file Deb.h.

#define IDM_EDIT_CUT 1201

Definition at line 25 of file Deb.h.

#define IDM_EDIT_DELETE 1203

Definition at line 27 of file Deb.h.

#define IDM_FILE_ATTACH 1102

Definition at line 22 of file Deb.h.

#define IDM_FILE_EXIT 1109

Definition at line 23 of file Deb.h.

#define IDM_FILE_OPEN 1101

Definition at line 21 of file Deb.h.

#define IDM_HELP_ABOUT 1909

Definition at line 40 of file Deb.h.

#define IDM_HELP_CONTENTS 1901

Definition at line 37 of file Deb.h.

#define IDM_HELP_HOWTOUSE 1903

Definition at line 39 of file Deb.h.

#define IDM_HELP_SEARCH 1902

Definition at line 38 of file Deb.h.

#define IDM_OPTIONS_COLOR 1705

Definition at line 33 of file Deb.h.

#define IDM_OPTIONS_FONT 1701

Definition at line 29 of file Deb.h.

#define IDM_OPTIONS_PREFERENCES 1702

Definition at line 30 of file Deb.h.

#define IDM_OPTIONS_SAVEDDIR 1704

Definition at line 32 of file Deb.h.

#define IDM_OPTIONS_SAVENOW 1799

Definition at line 35 of file Deb.h.

#define IDM_OPTIONS_SAVEONEXIT 1798

Definition at line 34 of file Deb.h.

#define IDM_OPTIONS_TOOLBAR 1703

Definition at line 31 of file Deb.h.

#define IDS_API_FAILED_MSG 9001

Definition at line 63 of file Deb.h.

#define IDS_APPNAME 2000

Definition at line 43 of file Deb.h.

#define IDS_BUTTON_ATTACH 2021

Definition at line 52 of file Deb.h.

#define IDS_BUTTON_COPY 2023

Definition at line 54 of file Deb.h.

#define IDS_BUTTON_CUT 2022

Definition at line 53 of file Deb.h.

#define IDS_BUTTON_DELETE 2024

Definition at line 55 of file Deb.h.

#define IDS_BUTTON_HELP 2025

Definition at line 56 of file Deb.h.

#define IDS_BUTTON_OPEN 2020

Definition at line 51 of file Deb.h.

#define IDS_DEBUG_EVENTS 2040

Definition at line 61 of file Deb.h.

#define IDS_EXIT_BOX_TEXT 2031

Definition at line 59 of file Deb.h.

#define IDS_EXIT_BOX_TITLE 2030

Definition at line 58 of file Deb.h.

#define IDS_OFN_DEBUGGEE_TITLE 2013

Definition at line 49 of file Deb.h.

#define IDS_OFN_FILTER 2012

Definition at line 48 of file Deb.h.

#define IDS_OFN_FILTERNAME 2011

Definition at line 47 of file Deb.h.

#define IDS_OFN_TITLE 2010

Definition at line 46 of file Deb.h.

#define IDS_SHORT_APPNAME 2001

Definition at line 44 of file Deb.h.

#define IDS_WINDOWS_NT_REQUIRED 9999

Definition at line 65 of file Deb.h.

#define IDS_WINDOWS_NT_REQUIRED_TITLE 9998

Definition at line 64 of file Deb.h.

#define UM_CREATE_LISTBOX (WM_APP+0)

Definition at line 91 of file Deb.h.

#define WM_APP 0x8000

Definition at line 89 of file Deb.h.

Generated on Wed Nov 13 2024 16:55:02 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Debug/Deb/DebDebug.c File Reference

  • WinBase
  • Debug
  • Deb
Defines | Functions | Variables

DebDebug.c File Reference

#include <Windows.H>
#include <StdDef.H>
#include <strsafe.h>
#include "LinkList.H"
#include "DEBMisc.H"
#include "DEBDebug.H"

Go to the source code of this file.

Defines

#define | BUFFER_SIZE 256
#define | IMAGE_BASE_OFFSET (13 * sizeof(DWORD))
#define | IMAGE_EXPORT_TABLE_RVA_OFFSET (30 * sizeof(DWORD))
#define | IMAGE_NAME_RVA_OFFSET offsetof(IMAGE_EXPORT_DIRECTORY, Name)
#define | IMAGE_SECOND_HEADER_OFFSET (15 * sizeof(ULONG))
#define | STRICT

Functions

BOOL AllocDllNode (PNODE *, PDEB_DLL_NODE_INFO *)
BOOL AllocProcessNode (PNODE *, PDEB_PROCESS_NODE_INFO *)
BOOL AllocThreadNode (PNODE *, PDEB_THREAD_NODE_INFO *)
BOOL CreateDllList (PLIST *)
BOOL CreateProcessList (PLIST *)
BOOL CreateThreadList (PLIST *)
DWORD WINAPI | DebugEventThread (PDEB_STARTUP_INFO pDebStartupInfo)
BOOL DebugNewProcess (LPTSTR, LPTSTR)
BOOL DeleteCurrentDllNode (PLIST)
BOOL DeleteCurrentProcessNode (PLIST)
BOOL DeleteCurrentThreadNode (PLIST)
BOOL DeleteDllNode (PLIST, PNODE)
BOOL DeleteProcessNode (PLIST, PNODE)
BOOL DeleteThreadNode (PLIST, PNODE)
BOOL DestroyDllList (PLIST)
BOOL DestroyDllNode (PNODE)
BOOL DestroyProcessList (PLIST)
BOOL DestroyProcessNode (PNODE)
BOOL DestroyThreadList (PLIST)
BOOL DestroyThreadNode (PNODE)
int | DllOrderFunction (PNODE, PNODE)
BOOL FreeDllNodeInfo (PNODE)
BOOL FreeProcessNodeInfo (PNODE)
BOOL FreeThreadNodeInfo (PNODE)
BOOL | GetDllFileName (LPDEBUG_EVENT, LPTSTR, DWORD)
BOOL | GetDllFileNameFromList (LPDEBUG_EVENT, LPTSTR, DWORD)
DWORD | GetModuleFileNameFromHeader (HANDLE, HANDLE, DWORD_PTR, LPTSTR, DWORD)
BOOL | GetOutputDebugString (LPDEBUG_EVENT, LPTSTR, DWORD, LPTSTR, DWORD)
BOOL | HandleBreakPointException (LPDEBUG_EVENT)
BOOL | HandleCreateProcessEvent (LPDEBUG_EVENT)
BOOL | HandleCreateThreadEvent (LPDEBUG_EVENT)
BOOL | HandleExceptionEvent (LPDEBUG_EVENT)
BOOL | HandleExitProcessEvent (LPDEBUG_EVENT)
BOOL | HandleExitThreadEvent (LPDEBUG_EVENT)
BOOL | HandleLoadDllEvent (LPDEBUG_EVENT)
BOOL | HandleOutputDebugStringEvent (LPDEBUG_EVENT)
BOOL | HandleRipEvent (LPDEBUG_EVENT)
BOOL | HandleUnknownEvent (LPDEBUG_EVENT)
BOOL | HandleUnloadDllEvent (LPDEBUG_EVENT)
BOOL | InitDllNodeInfo (PDEB_DLL_NODE_INFO *, LPDEBUG_EVENT)
BOOL | InitProcessNodeInfo (PDEB_PROCESS_NODE_INFO *, LPDEBUG_EVENT)
BOOL | InitThreadNodeInfo (PDEB_THREAD_NODE_INFO *, LPDEBUG_EVENT)
BOOL InsertDllNode (PLIST, PNODE)
BOOL InsertProcessNode (PLIST, PNODE)
BOOL InsertThreadNode (PLIST, PNODE)
int | ProcessOrderFunction (PNODE, PNODE)
BOOL SetCurrentDllNode (PLIST, PNODE)
BOOL SetCurrentProcessNode (PLIST, PNODE)
BOOL SetCurrentThreadNode (PLIST, PNODE)
int | ThreadOrderFunction (PNODE, PNODE)

Variables

BOOL | fFinished = FALSE
HANDLE hHeap
PLIST pProcessList

Define Documentation

#define BUFFER_SIZE 256
#define IMAGE_BASE_OFFSET (13 * sizeof(DWORD))
#define IMAGE_EXPORT_TABLE_RVA_OFFSET (30 * sizeof(DWORD))
#define IMAGE_NAME_RVA_OFFSET offsetof(IMAGE_EXPORT_DIRECTORY, Name)
#define IMAGE_SECOND_HEADER_OFFSET (15 * sizeof(ULONG))
#define STRICT

Definition at line 23 of file DebDebug.c.

Function Documentation

BOOL AllocDllNode | ( | PNODE * | ppDllNode,
 |  | PDEB_DLL_NODE_INFO * | ppDllNodeInfo
 | ) |  |

Definition at line 1869 of file DebDebug.c.

{
  //-- create node
  CreateNode( ppDllNode );

  //-- alloc info data
  *ppDllNodeInfo = (PDEB_DLL_NODE_INFO) HeapAlloc( hHeap, 0L,
                                      sizeof( DEB_DLL_NODE_INFO ) );
  (*ppDllNode)->pNodeData = *(ppDllNodeInfo);
  (*ppDllNodeInfo)->lpstrFileName = (LPTSTR) HeapAlloc( hHeap, 0L, (DWORD) MAX_PATH );

  return( TRUE );
}

BOOL AllocProcessNode | ( | PNODE * | ppProcessNode,
 |  | PDEB_PROCESS_NODE_INFO * | ppProcessNodeInfo
 | ) |  |

Definition at line 1383 of file DebDebug.c.

{
  //-- create node
  CreateNode( ppProcessNode );

  //-- alloc info data
  *ppProcessNodeInfo = (PDEB_PROCESS_NODE_INFO) HeapAlloc( hHeap, 0L,
                                              sizeof( DEB_PROCESS_NODE_INFO ) );
  (*ppProcessNode)->pNodeData = *(ppProcessNodeInfo);

  (*ppProcessNodeInfo)->lpstrFileName = (LPTSTR) HeapAlloc( hHeap, 0L,
                                               (DWORD) MAX_PATH );
  (*ppProcessNodeInfo)->lpstrPathName = (LPTSTR) HeapAlloc( hHeap, 0L,
                                               (DWORD) MAX_PATH );
  CreateThreadList( &((*ppProcessNodeInfo)->pThreadList) );
  CreateDllList( &((*ppProcessNodeInfo)->pDllList) );

  return( TRUE );
}

BOOL AllocThreadNode | ( | PNODE * | ppThreadNode,
 |  | PDEB_THREAD_NODE_INFO * | ppThreadNodeInfo
 | ) |  |

Definition at line 1633 of file DebDebug.c.

{
  //-- create node
  CreateNode( ppThreadNode );

  //-- alloc info data
  *ppThreadNodeInfo = (PDEB_THREAD_NODE_INFO) HeapAlloc( hHeap, 0L,
                                            (DWORD) sizeof( DEB_THREAD_NODE_INFO ) );
  (*ppThreadNode)->pNodeData = *(ppThreadNodeInfo);

  return( TRUE );
}

BOOL CreateDllList ( PLIST * ppDllList )

Definition at line 1817 of file DebDebug.c.

{
  PDEB_DLL_LIST_INFO pDllListInfo;

  //-- create list
  CreateList( ppDllList, DllOrderFunction );

  //-- alloc info data
  pDllListInfo = (PDEB_DLL_LIST_INFO) HeapAlloc( hHeap, 0L,
                                                sizeof( DEB_DLL_LIST_INFO ) );
  (*ppDllList)->pListData = pDllListInfo;

  //-- init info data
  pDllListInfo->dwActiveDlls = 0;

  return( TRUE );
}

BOOL CreateProcessList ( PLIST * ppProcessList )

Definition at line 1329 of file DebDebug.c.

{
  PDEB_PROCESS_LIST_INFO pProcessListInfo;

  //-- create list
  CreateList( ppProcessList, ProcessOrderFunction );

  //-- alloc info data
  pProcessListInfo = (PDEB_PROCESS_LIST_INFO) HeapAlloc( hHeap, 0L,
                                                sizeof( DEB_PROCESS_LIST_INFO ) );
  (*ppProcessList)->pListData = pProcessListInfo;

  //-- init info data
  pProcessListInfo->dwActiveProcesses = 0;

  return( TRUE );
}

BOOL CreateThreadList ( PLIST * ppThreadList )

Definition at line 1579 of file DebDebug.c.

{
  PDEB_THREAD_LIST_INFO pThreadListInfo;

  //-- create list
  CreateList( ppThreadList, ThreadOrderFunction );

  //-- alloc info data
  pThreadListInfo = (PDEB_THREAD_LIST_INFO) HeapAlloc( hHeap, 0L,
                                                sizeof( DEB_THREAD_LIST_INFO ) );
  (*ppThreadList)->pListData = pThreadListInfo;

  //-- init info data
  pThreadListInfo->dwActiveThreads = 0;

  return( TRUE );
}

DWORD WINAPI DebugEventThread ( PDEB_STARTUP_INFO pDebStartupInfo )

Definition at line 120 of file DebDebug.c.

{
  #define BUFFER_SIZE 256

  static BOOL  fFirstTime = TRUE;
  static TCHAR szDebuggeeTitle[128];

  DEBUG_EVENT  DebugEvent;

  LPTSTR lpszDebugEventBuffer;
  LPTSTR lpszTempBuffer;
  LPTSTR lpszRawBuffer;

  //-- set the minimum error level for debugging events
  SetDebugErrorLevel( Profile.DebugErrorLevel );

  if( fFirstTime ) {
    if( !LoadString( Global.hInstance, IDS_OFN_DEBUGGEE_TITLE, szDebuggeeTitle,
           sizeof(szDebuggeeTitle)/sizeof(TCHAR) ) )
      ErrorMessageBox( TEXT("LoadString()"),
        Global.szApiFailed, szSourceFileName, __LINE__ );
  }

  //-- determine if 'attach to' or 'open new' debuggee
  if( pDebStartupInfo->fActive ) {
    if( !DebugActiveProcess( pDebStartupInfo->dwProcessId ) )
      ErrorMessageBox( TEXT("DebugActiveProcess()"),
        Global.szApiFailed, szSourceFileName, __LINE__ );
  }
  else {
    if( !DebugNewProcess( pDebStartupInfo->lpstrPathName, szDebuggeeTitle ) )
    ExitThread( FALSE );
  }

  //-- increment active process count
  Global.dwActiveDebuggees++;

  //-- create a local heap
  {
    SYSTEM_INFO SysInfo;

    GetSystemInfo( &SysInfo );  // get the system memory page size
    hHeap = HeapCreate( 0L, SysInfo.dwPageSize, 1000*SysInfo.dwPageSize );
  }

  //-- create and initialize the process list
  CreateProcessList( &pProcessList );

  //-- alloc temporary (life of thread) string buffers
  lpszDebugEventBuffer = (LPTSTR) HeapAlloc( hHeap, 0L, BUFFER_SIZE * sizeof(TCHAR) );
  lpszTempBuffer = (LPTSTR) HeapAlloc( hHeap, 0L, BUFFER_SIZE * sizeof(TCHAR) );
  lpszRawBuffer = (LPTSTR) HeapAlloc( hHeap, 0L, BUFFER_SIZE * sizeof(TCHAR) );

  // ----------------------------------------------------------------------
  // begin debug event processing loop
  // ----------------------------------------------------------------------
  for(;;) {

    //-- wait for debug events
    if( !WaitForDebugEvent( &DebugEvent, INFINITE ) ) {
      ListBoxPrintF( pDebStartupInfo->hWndListBox, TEXT( "%s" ), TEXT( "Failed to attach to Debuggee..." ) );
      fFinished = TRUE;
      break;
    }

    // --------------------------------------------------------------------
    // display each debug event as it occurs and handle minimal debug
    // event processing
    // --------------------------------------------------------------------
    MakeCommonDebugEventString( lpszDebugEventBuffer, BUFFER_SIZE, &DebugEvent );

    switch( DebugEvent.dwDebugEventCode ) {

      // ------------------------------------------------------------------
      // exception occured
      // ------------------------------------------------------------------
      case EXCEPTION_DEBUG_EVENT:

        //-- figure out which type of exception
        switch( DebugEvent.u.Exception.ExceptionRecord.ExceptionCode ) {

          //--standard exceptions
          case EXCEPTION_ACCESS_VIOLATION:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s" ),
              TEXT( "Exception: " ), TEXT( "Access Violation" ) );
            break;

          case EXCEPTION_DATATYPE_MISALIGNMENT:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s" ),
              TEXT( "Exception: " ), TEXT( "Datatype Misalignment" ) );
            break;

          case EXCEPTION_BREAKPOINT:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s" ),
              TEXT( "Exception: " ), TEXT( "Breakpoint" ) );
            break;

          case EXCEPTION_SINGLE_STEP:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s" ),
              TEXT( "Exception: " ), TEXT( "Single Step" ) );
            break;

          case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s" ),
              TEXT( "Exception: " ), TEXT( "Array Bound Exceeded" ) );
            break;

          case EXCEPTION_FLT_DENORMAL_OPERAND:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s %s" ),
              TEXT( "Exception: " ), TEXT( "Floating Point" ),
              TEXT( "Denormal Operand" ) );
            break;

          case EXCEPTION_FLT_DIVIDE_BY_ZERO:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s %s" ),
              TEXT( "Exception: " ), TEXT( "Floating Point" ),
              TEXT( "Divide By Zero" ) );
            break;

          case EXCEPTION_FLT_INEXACT_RESULT:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s %s" ),
              TEXT( "Exception: " ), TEXT( "Floating Point" ),
              TEXT( "Inexact Result" ) );
            break;

          case EXCEPTION_FLT_INVALID_OPERATION:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s %s" ),
              TEXT( "Exception: " ), TEXT( "Floating Point" ),
              TEXT( "Invalid Operation" ) );
            break;

          case EXCEPTION_FLT_OVERFLOW:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s %s" ),
              TEXT( "Exception: " ), TEXT( "Floating Point" ),
              TEXT( "Overflow" ) );
            break;

          case EXCEPTION_FLT_STACK_CHECK:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s %s" ),
              TEXT( "Exception: " ), TEXT( "Floating Point" ),
              TEXT( "Stack Check" ) );
            break;

          case EXCEPTION_FLT_UNDERFLOW:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s %s" ),
              TEXT( "Exception: " ), TEXT( "Floating Point" ),
              TEXT( "Underflow" ) );
            break;

          case EXCEPTION_INT_DIVIDE_BY_ZERO:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s %s" ),
              TEXT( "Exception: " ), TEXT( "Integer" ),
              TEXT( "Divide By Zero" ) );
            break;

          case EXCEPTION_INT_OVERFLOW:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s %s" ),
              TEXT( "Exception: " ), TEXT( "Integer" ),
              TEXT( "Overflow" ) );
            break;

          case EXCEPTION_PRIV_INSTRUCTION:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s" ),
              TEXT( "Exception: " ), TEXT( "Privileged Instruction" ) );
            break;

          case EXCEPTION_IN_PAGE_ERROR:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s" ),
              TEXT( "Exception: " ), TEXT( "In Page Error" ) );
            break;

          //-- Debug exceptions
          case DBG_TERMINATE_THREAD:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s" ),
              TEXT( "Debug Exception: " ), TEXT( "Terminate Thread" ) );
            break;

          case DBG_TERMINATE_PROCESS:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s" ),
              TEXT( "Debug Exception: " ), TEXT( "Terminate Process" ) );
            break;

          case DBG_CONTROL_C:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s" ),
              TEXT( "Debug Exception: " ), TEXT( "Control+C" ) );
            break;

          case DBG_CONTROL_BREAK:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s" ),
              TEXT( "Debug Exception: " ), TEXT( "Control+Break" ) );
            break;

          //-- RPC exceptions (some)
          case RPC_S_UNKNOWN_IF:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s" ),
              TEXT( "RPC Exception: " ), TEXT( "Unknown Interface" ) );
            break;

          case RPC_S_SERVER_UNAVAILABLE:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s" ),
              TEXT( "RPC Exception: " ), TEXT( "Server Unavailable" ) );
            break;

          //-- VDM exceptions (minimal information)
          case EXCEPTION_VDM_EVENT:  // see DEBDebug.H for definition
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s" ),
              TEXT( "VDM Exception: " ) );

          default:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s%X%s" ),
              TEXT( "Exception: " ), TEXT( "Unknown [0x" ),
               DebugEvent.u.Exception.ExceptionRecord.ExceptionCode,
               TEXT( "]" ) );
            break;

        }
        if( Profile.fVerbose ) {
          StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "\n + %s%d" ),
            TEXT( "dwFirstChance: " ), DebugEvent.u.Exception.dwFirstChance );
        }
        else {
          if( DebugEvent.u.Exception.dwFirstChance != 0 )
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s" ),
              TEXT( " - First Chance" ) );
          else
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s" ),
              TEXT( " - Second Chance" ) );
        }
        HandleExceptionEvent( &DebugEvent );
        break;

      // ------------------------------------------------------------------
      // new thread started
      // ------------------------------------------------------------------
      case CREATE_THREAD_DEBUG_EVENT:
        StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s" ),
          TEXT( "Create Thread: " ) );
        if( Profile.fVerbose ) {
          StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "\n + %s%d\n + %s%X\n + %s%d" ),
            TEXT( "hThread:0x" ), DebugEvent.u.CreateThread.hThread,
            TEXT( "lpThreadLocalBase:0x" ), DebugEvent.u.CreateThread.lpThreadLocalBase,
            TEXT( "lpStartAddress:0x" ), DebugEvent.u.CreateThread.lpStartAddress );
        }
        HandleCreateThreadEvent( &DebugEvent );
        break;

      // ------------------------------------------------------------------
      // new process started
      // ------------------------------------------------------------------
      case CREATE_PROCESS_DEBUG_EVENT:
        StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s" ),
          TEXT( "Create Process: " ) );
        if( Profile.fVerbose ) {
          StringAppendF( lpszDebugEventBuffer,
BUFFER_SIZE,             TEXT( "\n + %s%X\n + %s%X\n + %s%X\n + %s%X\n + %s%d" )
            TEXT( "\n + %s%d\n + %s%X\n + %s%X\n + %s%X\n + %s%d" ),
            TEXT( "hFile:0x" ), DebugEvent.u.CreateProcessInfo.hFile,
            TEXT( "hProcess:0x" ), DebugEvent.u.CreateProcessInfo.hProcess,
            TEXT( "hThread:0x" ), DebugEvent.u.CreateProcessInfo.hThread,
            TEXT( "lpBaseOfImage:0x" ), DebugEvent.u.CreateProcessInfo.lpBaseOfImage,
            TEXT( "dwDebugInfoFileOffset: " ), DebugEvent.u.CreateProcessInfo.dwDebugInfoFileOffset,
            TEXT( "nDebugInfoSize: " ), DebugEvent.u.CreateProcessInfo.nDebugInfoSize,
            TEXT( "lpThreadLocalBase:0x" ), DebugEvent.u.CreateProcessInfo.lpThreadLocalBase,
            TEXT( "lpStartAddress:0x" ), DebugEvent.u.CreateProcessInfo.lpStartAddress,
            TEXT( "lpImageName:0x" ), DebugEvent.u.CreateProcessInfo.lpImageName,
            TEXT( "fUnicode: " ), DebugEvent.u.CreateProcessInfo.fUnicode );
        }
        HandleCreateProcessEvent( &DebugEvent );
        break;

      // ------------------------------------------------------------------
      // existing thread terminated
      // ------------------------------------------------------------------
      case EXIT_THREAD_DEBUG_EVENT:
        StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s" ),
          TEXT( "Exit Thread: " ) );
        if( Profile.fVerbose ) {
          StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "\n + %s%d" ),
            TEXT( "dwExitCode: " ), DebugEvent.u.ExitThread.dwExitCode );
        }
        else {
          StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%d" ),
            TEXT( "Returned " ), DebugEvent.u.ExitThread.dwExitCode );
        }
        HandleExitThreadEvent( &DebugEvent );
        break;

      // ------------------------------------------------------------------
      // existing process terminated
      // ------------------------------------------------------------------
      case EXIT_PROCESS_DEBUG_EVENT:
        StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s" ),
          TEXT( "Exit Process: " ) );
        if( Profile.fVerbose ) {
          StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "\n + %s%d" ),
            TEXT( "dwExitCode: " ), DebugEvent.u.ExitProcess.dwExitCode );
        }
        else {
          StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%d" ),
            TEXT( "Returned " ), DebugEvent.u.ExitProcess.dwExitCode );
        }
        HandleExitProcessEvent( &DebugEvent );
        break;

      // ------------------------------------------------------------------
      // new DLL loaded
      // ------------------------------------------------------------------
      case LOAD_DLL_DEBUG_EVENT:
        StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s" ),
          TEXT( "Load DLL: " ) );
        StringCbCopy( lpszTempBuffer, sizeof(lpszTempBuffer) , TEXT("Empty!") );
        GetDllFileName( &DebugEvent, lpszTempBuffer, BUFFER_SIZE );
        StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s" ), lpszTempBuffer );
        if( Profile.fVerbose ) {
          StringAppendF( lpszDebugEventBuffer,
BUFFER_SIZE,             TEXT( "\n + %s%X\n + %s%X\n + %s%d\n + %s%d\n + %s%X\n + %s%d" ),
            TEXT( "hFile:0x" ), DebugEvent.u.LoadDll.hFile,
            TEXT( "lpBaseOfDll:0x" ), DebugEvent.u.LoadDll.lpBaseOfDll,
            TEXT( "dwDebugInfoFileOffset: " ), DebugEvent.u.LoadDll.dwDebugInfoFileOffset,
            TEXT( "nDebugInfoSize: " ), DebugEvent.u.LoadDll.nDebugInfoSize,
            TEXT( "lpImageName:0x" ), DebugEvent.u.LoadDll.lpImageName,
            TEXT( "fUnicode: " ), DebugEvent.u.LoadDll.fUnicode );
        }
        HandleLoadDllEvent( &DebugEvent );
        break;

      // ------------------------------------------------------------------
      // existing DLL explicitly unloaded
      // ------------------------------------------------------------------
      case UNLOAD_DLL_DEBUG_EVENT:
        StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s" ), TEXT( "Unload DLL: " ) );
        GetDllFileNameFromList( &DebugEvent, lpszTempBuffer, BUFFER_SIZE );
        StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s" ), lpszTempBuffer );
        if( Profile.fVerbose ) {
          StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "\n + %s%X" ),
            TEXT( "lpBaseOfDLL:0x" ), DebugEvent.u.UnloadDll.lpBaseOfDll );
        }
        HandleUnloadDllEvent( &DebugEvent );
        break;

      // ------------------------------------------------------------------
      // OutputDebugString() occured
      // ------------------------------------------------------------------
      case OUTPUT_DEBUG_STRING_EVENT:
        StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s" ),
          TEXT( "Output Debug String: " ) );
        GetOutputDebugString( &DebugEvent, lpszTempBuffer, BUFFER_SIZE,
                              lpszRawBuffer, BUFFER_SIZE );
        StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s" ), lpszTempBuffer );
        if( Profile.fVerbose ) {
          StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "\n + %s%X\n + %s%d\n + %s%d" ),
            TEXT( "lpDebugStringData:0x" ), DebugEvent.u.DebugString.lpDebugStringData,
            TEXT( "fUnicode: " ), DebugEvent.u.DebugString.fUnicode,
            TEXT( "nDebugStringLength: " ), DebugEvent.u.DebugString.nDebugStringLength );
        }
        HandleOutputDebugStringEvent( &DebugEvent );
        break;

      // ------------------------------------------------------------------
      // RIP occured
      // ------------------------------------------------------------------
      case RIP_EVENT:
        StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s" ),
          TEXT( "RIP" ) );
        if( Profile.fVerbose ) {
          StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "\n + %s%d\n + %s%d" ),
            TEXT( "dwError: " ), DebugEvent.u.RipInfo.dwError,
            TEXT( "dwType: " ), DebugEvent.u.RipInfo.dwType );
        }
        HandleRipEvent( &DebugEvent );
        break;

      // ------------------------------------------------------------------
      // unknown debug event occured
      // ------------------------------------------------------------------
      default:
        StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%X%s" ),
          TEXT( "Debug Event:Unknown [0x" ),
          DebugEvent.dwDebugEventCode, lpszTempBuffer,
          TEXT( "]" ) );
        HandleUnknownEvent( &DebugEvent );
        break;
    }

    //-- insert the debug event string into the listbox
    ListBoxPrintF( pDebStartupInfo->hWndListBox, TEXT( "%s" ), lpszDebugEventBuffer );

    //-- default action, just continue
    if( fFinished ) {
      fFinished = FALSE;   // reset the value
      break;
    }
    else
      ContinueDebugEvent( DebugEvent.dwProcessId, DebugEvent.dwThreadId,
        DBG_CONTINUE );
  }

  //-- free temporary (life of thread) string buffers
  HeapFree( hHeap, 0L, (PVOID) lpszDebugEventBuffer );
  HeapFree( hHeap, 0L, (PVOID) lpszTempBuffer );
  HeapFree( hHeap, 0L, (PVOID) lpszRawBuffer );

  //-- free list
  DestroyProcessList( pProcessList );

  //-- free the heap
  HeapDestroy( hHeap );

  //-- decrement active process count
  Global.dwActiveDebuggees--;
  ExitThread( TRUE );

  return( TRUE );  // avoid the "no return value" warning
}

BOOL DebugNewProcess | ( | LPTSTR | lpszFileName,
 |  | LPTSTR | lpszTitle
 | ) |  |

Definition at line 814 of file DebDebug.c.

{
  static STARTUPINFO           StartupInfo;
  static LPSTARTUPINFO         lpStartupInfo = &StartupInfo;
  static PROCESS_INFORMATION   ProcessInfo;
  static LPPROCESS_INFORMATION lpProcessInfo = &ProcessInfo;

  lpStartupInfo->cb          = sizeof( STARTUPINFO );
  lpStartupInfo->lpDesktop   = 0L;
  lpStartupInfo->lpTitle     = lpszTitle;
  lpStartupInfo->dwX         = 0;
  lpStartupInfo->dwY         = 0;
  lpStartupInfo->dwXSize     = 0;
  lpStartupInfo->dwYSize     = 0;
  lpStartupInfo->dwFlags     = 0L;
  lpStartupInfo->wShowWindow = SW_SHOWDEFAULT;

  lpProcessInfo->hProcess = 0L;

  //-- create the Debuggee process instead
  if( !CreateProcess(
         0L,
         lpszFileName,
         (LPSECURITY_ATTRIBUTES) 0L,
         (LPSECURITY_ATTRIBUTES) 0L,
         TRUE,
         Profile.DebugMode | Profile.DebuggeePriority | CREATE_NEW_CONSOLE,
         (LPVOID) 0L,
         (LPTSTR) 0L,
         lpStartupInfo, lpProcessInfo ) ) {

    switch( GetLastError() ) {

      case ERROR_FILE_NOT_FOUND:
        MessageBox( GetDesktopWindow(), TEXT( "This file does not exist." ),
          TEXT( "Open File Error" ), MB_OK | MB_APPLMODAL | MB_SETFOREGROUND );
        break;
      case ERROR_ACCESS_DENIED:
        MessageBox( GetDesktopWindow(), TEXT( "Access denied." ),
          TEXT( "Open File Error" ), MB_OK | MB_APPLMODAL | MB_SETFOREGROUND );
        break;
      case ERROR_FILE_INVALID:
        MessageBox( GetDesktopWindow(), TEXT( "Invalid file." ),
          TEXT( "Open File Error" ), MB_OK | MB_APPLMODAL | MB_SETFOREGROUND );
        break;
      case ERROR_FILE_CORRUPT:
        MessageBox( GetDesktopWindow(), TEXT( "The file is corrupt." ),
          TEXT( "Open File Error" ), MB_OK | MB_APPLMODAL | MB_SETFOREGROUND );
        break;
      case ERROR_BAD_EXE_FORMAT:
        MessageBox( GetDesktopWindow(), TEXT( "The file has a bad format." ),
          TEXT( "Open File Error" ), MB_OK | MB_APPLMODAL | MB_SETFOREGROUND );
        break;
      default:
        ErrorMessageBox( TEXT( "CreateProcess()" ),
          Global.szApiFailed, szSourceFileName, __LINE__ );
        break;

    }
    return( FALSE );

  }
  else {
    CloseHandle( ProcessInfo.hProcess );
    CloseHandle( ProcessInfo.hThread );
  }

  return( TRUE
 );
}

BOOL DeleteCurrentDllNode ( PLIST pDllList )

Definition at line 2001 of file DebDebug.c.

{
  PDEB_DLL_LIST_INFO pDllListInfo = pDllList->pListData;
  PNODE              pDllNode = (PNODE) pDllList->pCurrentNode;

  //-- free info data
  FreeDllNodeInfo( pDllNode );

  //-- delete and destroy node
  DeleteCurrentNode( pDllList );

  //-- decrement dwActiveDlls
  pDllListInfo->dwActiveDlls--;

  return( TRUE );
}

BOOL DeleteCurrentProcessNode ( PLIST pProcessList )

Definition at line 1526 of file DebDebug.c.

{
  PDEB_PROCESS_LIST_INFO pProcessListInfo = pProcessList->pListData;
  PNODE                  pProcessNode = (PNODE) pProcessList->pCurrentNode;

  //-- free info data
  FreeProcessNodeInfo( pProcessNode );

  //-- delete and destroy node
  DeleteCurrentNode( pProcessList );

  //-- decrement dwActiveProcesss
  pProcessListInfo->dwActiveProcesses--;

  return( TRUE );
}

BOOL DeleteCurrentThreadNode ( PLIST pThreadList )

Definition at line 1764 of file DebDebug.c.

{
  PDEB_THREAD_LIST_INFO pThreadListInfo = pThreadList->pListData;
  PNODE                 pThreadNode = (PNODE) pThreadList->pCurrentNode;

  //-- free info data
  FreeThreadNodeInfo( pThreadNode );

  //-- delete and destroy node
  DeleteCurrentNode( pThreadList );

  //-- decrement dwActiveThreads
  pThreadListInfo->dwActiveThreads--;

  return( TRUE );
}

BOOL DeleteDllNode | ( | PLIST | pDllList,
 |  | PNODE | pDllNode
 | ) |  |

Definition at line 1945 of file DebDebug.c.

{
  PNODE pDeleteNode;

  SetCurrentNode( pDllList, pDllNode, pDllList->OrderFunction );
  GetCurrentNode( pDllList, &pDeleteNode );
  DeleteCurrentDllNode( pDllList );

  return( TRUE );
}

BOOL DeleteProcessNode | ( | PLIST | pProcessList,
 |  | PNODE | pProcessNode
 | ) |  |

Definition at line 1467 of file DebDebug.c.

{
  PNODE pDeleteNode;

  SetCurrentNode( pProcessList, pProcessNode, pProcessList->OrderFunction );
  GetCurrentNode( pProcessList, &pDeleteNode );
  DeleteCurrentProcessNode( pProcessList );

  return( TRUE );
}

BOOL DeleteThreadNode | ( | PLIST | pThreadList,
 |  | PNODE | pThreadNode
 | ) |  |

Definition at line 1709 of file DebDebug.c.

{
  PNODE pDeleteNode;

  SetCurrentNode( pThreadList, pThreadNode, pThreadList->OrderFunction );
  GetCurrentNode( pThreadList, &pDeleteNode );
  DeleteCurrentThreadNode( pThreadList );

  return( TRUE );
}

BOOL DestroyDllList ( PLIST pDllList )

Definition at line 1843 of file DebDebug.c.

{
  PDEB_DLL_LIST_INFO pDllListInfo = pDllList->pListData;
  PNODE              pDeleteNode;

  //-- make sure all nodes are removed first
  while( pDllListInfo->dwActiveDlls ) {
    GetCurrentNode( pDllList, &pDeleteNode );
    DeleteCurrentDllNode( pDllList );
  }

  //-- free list data and destroy the list
  HeapFree( hHeap, 0L, (PVOID) pDllListInfo );
  DestroyList( pDllList );

  return( TRUE );
}

BOOL DestroyDllNode ( PNODE pDllNode )

Definition at line 1982 of file DebDebug.c.

{
  //-- free info data
  FreeDllNodeInfo( pDllNode );

  //-- destroy node
  DestroyNode( pDllNode );

  return( TRUE );
}

BOOL DestroyProcessList ( PLIST pProcessList )

Definition at line 1355 of file DebDebug.c.

{
  PDEB_PROCESS_LIST_INFO pProcessListInfo = pProcessList->pListData;
  PNODE                  pDeleteNode;

  //-- make sure all nodes are removed first
  while( pProcessListInfo->dwActiveProcesses ) {
    GetCurrentNode( pProcessList, &pDeleteNode );
    DeleteCurrentProcessNode( pProcessList );
  }

  //-- free info data
  HeapFree( hHeap, 0L, (PVOID) pProcessListInfo );

  //-- destroy list
  DestroyList( pProcessList );

  return( TRUE );
}

BOOL DestroyProcessNode ( PNODE pProcessNode )

Definition at line 1507 of file DebDebug.c.

{
  //-- free info data
  FreeProcessNodeInfo( pProcessNode );

  //-- destroy node
  DestroyNode( pProcessNode );

  return( TRUE );
}

BOOL DestroyThreadList ( PLIST pThreadList )

Definition at line 1605 of file DebDebug.c.

{
  PDEB_THREAD_LIST_INFO pThreadListInfo = pThreadList->pListData;
  PNODE                 pDeleteNode;

  //-- make sure all nodes are removed first
  while( pThreadListInfo->dwActiveThreads ) {
    GetCurrentNode( pThreadList, &pDeleteNode );
    DeleteCurrentThreadNode( pThreadList );
  }

  //-- free info data
  HeapFree( hHeap, 0L, (PVOID) pThreadListInfo );

  //-- destroy list
  DestroyList( pThreadList );

  return( TRUE );
}

BOOL DestroyThreadNode ( PNODE pThreadNode )

Definition at line 1745 of file DebDebug.c.

{
  //-- free info data
  FreeThreadNodeInfo( pThreadNode );

  //-- destroy node
  DestroyNode( pThreadNode );

  return( TRUE );
}

int DllOrderFunction | ( | PNODE | pNode1,
 |  | PNODE | pNode2
 | ) |  |

Definition at line 1795 of file DebDebug.c.

{
  PDEB_DLL_NODE_INFO pDllNodeInfo1 = pNode1->pNodeData;
  PDEB_DLL_NODE_INFO pDllNodeInfo2 = pNode2->pNodeData;

  if( pDllNodeInfo1->DllDebugInfo.lpBaseOfDll < pDllNodeInfo2->DllDebugInfo.lpBaseOfDll )
    return( LIST_LEFT_OF );

  if( pDllNodeInfo1->DllDebugInfo.lpBaseOfDll > pDllNodeInfo2->DllDebugInfo.lpBaseOfDll )
    return( LIST_RIGHT_OF );

  return( LIST_MATCH );
}

BOOL FreeDllNodeInfo ( PNODE pDllNode )

Definition at line 1964 of file DebDebug.c.

{
  PDEB_DLL_NODE_INFO pDllNodeInfo = (PDEB_DLL_NODE_INFO) pDllNode->pNodeData;

  //-- free info data
  HeapFree( hHeap, 0L, (PVOID) pDllNodeInfo->lpstrFileName );
  HeapFree( hHeap, 0L, (PVOID) pDllNodeInfo );

  return( TRUE );
}

BOOL FreeProcessNodeInfo ( PNODE pProcessNode )

Definition at line 1486 of file DebDebug.c.

{
  PDEB_PROCESS_NODE_INFO pProcessNodeInfo = (PDEB_PROCESS_NODE_INFO) pProcessNode->pNodeData;

  //-- free info data
  DestroyDllList( pProcessNodeInfo->pDllList );
  DestroyThreadList( pProcessNodeInfo->pThreadList );
  HeapFree( hHeap, 0L, (PVOID) pProcessNodeInfo->lpstrPathName );
  HeapFree( hHeap, 0L, (PVOID) pProcessNodeInfo->lpstrFileName );
  HeapFree( hHeap, 0L, (PVOID) pProcessNodeInfo );

  return( TRUE );
}

BOOL FreeThreadNodeInfo ( PNODE pThreadNode )

Definition at line 1728 of file DebDebug.c.

{
  PDEB_THREAD_NODE_INFO pThreadNodeInfo = (PDEB_THREAD_NODE_INFO) pThreadNode->pNodeData;

  //-- free info data
  HeapFree( hHeap, 0L, (PVOID) pThreadNodeInfo );

  return( TRUE );
}

BOOL GetDllFileName | ( | LPDEBUG_EVENT | lpDebugEvent,
 |  | LPTSTR | lpszBuffer,
 |  | DWORD | cchBuffer
 | ) |  |

Definition at line 892 of file DebDebug.c.

{
  PNODE                  pProcessNode, pSearchProcessNode;
  PDEB_PROCESS_NODE_INFO pProcessNodeInfo, pSearchProcessNodeInfo;

  AllocProcessNode( &pSearchProcessNode, &pSearchProcessNodeInfo );
  pSearchProcessNodeInfo->dwProcessId = lpDebugEvent->dwProcessId;
  SetCurrentProcessNode( pProcessList, pSearchProcessNode );
  GetCurrentNode( pProcessList, &pProcessNode );
  pProcessNodeInfo = (PDEB_PROCESS_NODE_INFO) pProcessNode->pNodeData;
  GetModuleFileNameFromHeader(
    pProcessNodeInfo->ProcessDebugInfo.hProcess,
    lpDebugEvent->u.LoadDll.hFile,
    (DWORD_PTR)lpDebugEvent->u.LoadDll.lpBaseOfDll,
    lpszBuffer, cchBuffer);
  DestroyProcessNode( pSearchProcessNode );

  return( TRUE );
}

BOOL GetDllFileNameFromList | ( | LPDEBUG_EVENT | lpDebugEvent,
 |  | LPTSTR | lpszBuffer,
 |  | DWORD | cchBuffer
 | ) |  |

Definition at line 920 of file DebDebug.c.

{
  PNODE                  pProcessNode, pSearchProcessNode;
  PNODE                  pDllNode, pSearchDllNode;
  PDEB_PROCESS_NODE_INFO pProcessNodeInfo, pSearchProcessNodeInfo;
  PDEB_DLL_NODE_INFO     pDllNodeInfo, pSearchDllNodeInfo;

  AllocProcessNode( &pSearchProcessNode, &pSearchProcessNodeInfo );
  pSearchProcessNodeInfo->dwProcessId = lpDebugEvent->dwProcessId;
  SetCurrentProcessNode( pProcessList, pSearchProcessNode );
  GetCurrentNode( pProcessList, &pProcessNode );
  pProcessNodeInfo = (PDEB_PROCESS_NODE_INFO) pProcessNode->pNodeData;
  AllocDllNode( &pSearchDllNode, &pSearchDllNodeInfo );
  pSearchDllNodeInfo->DllDebugInfo.lpBaseOfDll = lpDebugEvent->u.UnloadDll.lpBaseOfDll;
  SetCurrentDllNode( pProcessNodeInfo->pDllList, pSearchDllNode );
  GetCurrentNode( pProcessNodeInfo->pDllList, &pDllNode );
  pDllNodeInfo = (PDEB_DLL_NODE_INFO) pDllNode->pNodeData;
  lstrcpyn( lpszBuffer, pDllNodeInfo->lpstrFileName, cchBuffer );

  return( TRUE );
}

DWORD GetModuleFileNameFromHeader | ( | HANDLE | hProcess,
 |  | HANDLE | hFile,
 |  | DWORD_PTR | BaseOfDll,
 |  | LPTSTR | lpszPath,
 |  | DWORD | cchPath
 | ) |  |

Definition at line 1031 of file DebDebug.c.

{
  #define IMAGE_SECOND_HEADER_OFFSET    (15 * sizeof(ULONG)) // relative to file beginning
  #define IMAGE_BASE_OFFSET             (13 * sizeof(DWORD)) // relative to PE header base
  #define IMAGE_EXPORT_TABLE_RVA_OFFSET (30 * sizeof(DWORD)) // relative to PE header base
  #define IMAGE_NAME_RVA_OFFSET         offsetof(IMAGE_EXPORT_DIRECTORY, Name)

  WORD   DosSignature;
  DWORD  NtSignature;
  DWORD  dwNumberOfBytesRead = 0;
  DWORD  PeHeader;
  DWORD_PTR ImageBase, ExportTableRVA, NameRVA;

  //-- verify that the handle is not 0L
  if( !hFile ) {
    StringCbCopy( lpszPath, sizeof(lpszPath),TEXT("Invalid File Handle") );
    return( 0 );
  }

  //-- verify that the handle is for a disk file
  if( GetFileType(hFile) != FILE_TYPE_DISK ) {
    StringCbCopy( lpszPath,sizeof(lpszPath) ,TEXT("Invalid File Type") );
    return( 0 );
  }

  //-- Extract the filename from the EXE header
  SetFilePointer( hFile, 0L, 0L, FILE_BEGIN );
  ReadFile( hFile, &DosSignature, sizeof(DosSignature), &dwNumberOfBytesRead,
    (LPOVERLAPPED) 0L);

  //-- verify DOS signature found
  if( DosSignature != IMAGE_DOS_SIGNATURE ) {
    StringCbPrintf( lpszPath, sizeof(lpszPath), TEXT( "Bad MZ Signature: 0x%x" ), DosSignature );
    return( 0 );
  }

  SetFilePointer( hFile, IMAGE_SECOND_HEADER_OFFSET, (LPLONG) 0L,
    FILE_BEGIN );
  ReadFile( hFile, &PeHeader, sizeof(PeHeader), &dwNumberOfBytesRead,
    (LPOVERLAPPED) 0L );
  SetFilePointer( hFile, PeHeader, (LPLONG) 0L, FILE_BEGIN );
  ReadFile( hFile, &NtSignature, sizeof(NtSignature), &dwNumberOfBytesRead,
    (LPOVERLAPPED) 0L);

  //-- verify Windows NT (PE) signature found
  if( NtSignature != IMAGE_NT_SIGNATURE ) {
    StringCbCopy( lpszPath, sizeof(lpszPath), TEXT( "Bad PE Signature: 0x%x" ), DosSignature );
    return( 0 );
  }

  SetFilePointer( hFile, PeHeader + IMAGE_BASE_OFFSET, (LPLONG) 0L,
    FILE_BEGIN );
  ReadFile( hFile, &ImageBase, sizeof(ImageBase), &dwNumberOfBytesRead,
    (LPOVERLAPPED) 0L);
  SetFilePointer( hFile, PeHeader + IMAGE_EXPORT_TABLE_RVA_OFFSET,
    (LPLONG) 0L, FILE_BEGIN );
  ReadFile( hFile, &ExportTableRVA, sizeof(ExportTableRVA),
    &dwNumberOfBytesRead, (LPOVERLAPPED) 0L);

  //-- now read from the virtual address space in the process
  if (!ReadProcessMemory( hProcess,
         (LPVOID) (BaseOfDll + ExportTableRVA + IMAGE_NAME_RVA_OFFSET),
         &NameRVA, sizeof(NameRVA), &dwNumberOfBytesRead ) ||
      dwNumberOfBytesRead != sizeof(NameRVA))
  {
      StringCbCopy( lpszPath,sizeof(lpszPath), TEXT("Access Denied!") );
      dwNumberOfBytesRead = 0;
  }
  else if( !ReadProcessMemory( hProcess,
              (LPVOID) (BaseOfDll + NameRVA),
              lpszPath, cchPath * sizeof(TCHAR),
              &dwNumberOfBytesRead ))
  {
     StringCbCopy( lpszPath, sizeof(lpszPath), TEXT("Access Denied!") );
  }

  return( dwNumberOfBytesRead );
}

BOOL GetOutputDebugString | ( | LPDEBUG_EVENT | lpDebugEvent,
 |  | LPTSTR | lpszBuffer,
 |  | DWORD | cchBuffer,
 |  | LPTSTR | lpszTemp,
 |  | DWORD | cchTemp
 | ) |  |

Definition at line 951 of file DebDebug.c.

{
  PNODE                  pProcessNode, pSearchProcessNode;
  PDEB_PROCESS_NODE_INFO pProcessNodeInfo, pSearchProcessNodeInfo;
  DWORD dwNumberOfBytesRead;
  DWORD cchToRead;
  BOOL fFailed;

  AllocProcessNode( &pSearchProcessNode, &pSearchProcessNodeInfo );
  pSearchProcessNodeInfo->dwProcessId = lpDebugEvent->dwProcessId;
  SetCurrentProcessNode( pProcessList, pSearchProcessNode );
  GetCurrentNode( pProcessList, &pProcessNode );
  pProcessNode = (PNODE) pProcessList->pCurrentNode;
  pProcessNodeInfo = (PDEB_PROCESS_NODE_INFO) pProcessNode->pNodeData;
  cchToRead = lpDebugEvent->u.DebugString.nDebugStringLength;
  if (cchToRead > cchTemp)
  {
    cchToRead = cchTemp - sizeof(TCHAR);
  }
  fFailed = FALSE;
  if (!ReadProcessMemory(
         pProcessNodeInfo->ProcessDebugInfo.hProcess,
         lpDebugEvent->u.DebugString.lpDebugStringData,
         lpszTemp, cchToRead * sizeof(TCHAR),
         &dwNumberOfBytesRead ) ||
      dwNumberOfBytesRead < cchToRead * sizeof(TCHAR))
  {
      fFailed = TRUE;
  }
  lpszTemp[cchTemp - 1] = 0;
  if (!fFailed)
  {
#ifdef _UNICODE
      if (!lpDebugEvent->u.DebugString.fUnicode)
      {
          if (!MultiByteToWideChar(CP_ACP, 0, lpszTemp, -1,
                                   lpszBuffer, cchBuffer))
          {
              fFailed = TRUE;
          }
      }
      else
      {
          lstrcpyn(lpszBuffer, lpszTemp, cchBuffer);
      }
#else
      if (lpDebugEvent->u.DebugString.fUnicode)
      {
          if (!WideCharToMultiByte(CP_ACP, 0, lpszTemp, -1,
                                   lpszBuffer, cchBuffer, NULL, NULL))
          {
              fFailed = TRUE;
          }
      }
      else
      {
          lstrcpyn(lpszBuffer, lpszTemp, cchBuffer);
      }
#endif
  }
  if (fFailed)
  {
      StringCbCopy(lpszBuffer, sizeof(lpszBuffer), TEXT("Unable to read output string!"));
  }
  DestroyProcessNode( pSearchProcessNode );

  return( TRUE );
}

BOOL HandleBreakPointException ( LPDEBUG_EVENT lpDebugEvent )

Definition at line 572 of file DebDebug.c.

{
#if defined(_ALPHA_) || defined(_AXP64_)
  PNODE                  pProcessNode, pSearchProcessNode;
  PNODE                  pThreadNode, pSearchThreadNode;
  PDEB_PROCESS_NODE_INFO pProcessNodeInfo, pSearchProcessNodeInfo;
  PDEB_THREAD_NODE_INFO  pThreadNodeInfo, pSearchThreadNodeInfo;
  PDEB_THREAD_LIST_INFO  pThreadListInfo;

  AllocProcessNode( &pSearchProcessNode, &pSearchProcessNodeInfo );
  pSearchProcessNodeInfo->dwProcessId = lpDebugEvent->dwProcessId;
  SetCurrentProcessNode( pProcessList, pSearchProcessNode );
  GetCurrentNode( pProcessList, &pProcessNode );
  pProcessNodeInfo = (PDEB_PROCESS_NODE_INFO) pProcessNode->pNodeData;
  pThreadListInfo = (PDEB_THREAD_LIST_INFO) pProcessNodeInfo->pThreadList->pListData;
  //-- if no thread nodes then hThread is stored in the process node
  if( !pThreadListInfo->dwActiveThreads ) {
    SkipBreakPoint( (pProcessNodeInfo->ProcessDebugInfo).hThread );
  }
  else {
    AllocThreadNode( &pSearchThreadNode, &pSearchThreadNodeInfo );
    pSearchThreadNodeInfo->dwThreadId = lpDebugEvent->dwThreadId;
    SetCurrentThreadNode( pProcessNodeInfo->pThreadList, pSearchThreadNode );
    GetCurrentNode( pProcessNodeInfo->pThreadList, &pThreadNode );
    pThreadNodeInfo = (PDEB_THREAD_NODE_INFO) pThreadNode->pNodeData;
    SkipBreakPoint( (pThreadNodeInfo->ThreadDebugInfo).hThread );
    DestroyThreadNode( pSearchThreadNode );
  }
  DestroyProcessNode( pSearchProcessNode );
 #else

  ContinueDebugEvent( lpDebugEvent->dwProcessId, lpDebugEvent->dwThreadId,
    DBG_CONTINUE );
 #endif

  return( TRUE );
}

BOOL HandleCreateProcessEvent ( LPDEBUG_EVENT lpDebugEvent )

Definition at line 644 of file DebDebug.c.

{
  PNODE                  pProcessNode;
  PDEB_PROCESS_NODE_INFO pProcessNodeInfo;

  AllocProcessNode( &pProcessNode, &pProcessNodeInfo );
  InitProcessNodeInfo( &pProcessNodeInfo, lpDebugEvent );
  InsertProcessNode( pProcessList, pProcessNode );

  return( TRUE );
}

BOOL HandleCreateThreadEvent ( LPDEBUG_EVENT lpDebugEvent )

Definition at line 617 of file DebDebug.c.

{
  PNODE                  pProcessNode, pSearchProcessNode;
  PNODE                  pThreadNode;
  PDEB_PROCESS_NODE_INFO pProcessNodeInfo, pSearchProcessNodeInfo;
  PDEB_THREAD_NODE_INFO  pThreadNodeInfo;

  AllocProcessNode( &pSearchProcessNode, &pSearchProcessNodeInfo );
  pSearchProcessNodeInfo->dwProcessId = lpDebugEvent->dwProcessId;
  SetCurrentProcessNode( pProcessList, pSearchProcessNode );
  GetCurrentNode( pProcessList, &pProcessNode );
  pProcessNodeInfo = (PDEB_PROCESS_NODE_INFO) pProcessNode->pNodeData;
  AllocThreadNode( &pThreadNode, &pThreadNodeInfo );
  InitThreadNodeInfo( &pThreadNodeInfo, lpDebugEvent );
  InsertThreadNode( pProcessNodeInfo->pThreadList, pThreadNode );
  DestroyProcessNode( pSearchProcessNode );

  return( TRUE );
}

BOOL HandleExceptionEvent ( LPDEBUG_EVENT lpDebugEvent )

Definition at line 548 of file DebDebug.c.

{
  switch( lpDebugEvent->u.Exception.ExceptionRecord.ExceptionCode ) {

    case EXCEPTION_BREAKPOINT:
      HandleBreakPointException( lpDebugEvent );
      break;

    default:
      ContinueDebugEvent( lpDebugEvent->dwProcessId, lpDebugEvent->dwThreadId,
        DBG_EXCEPTION_NOT_HANDLED );

  }

  return( TRUE );
}

BOOL HandleExitProcessEvent ( LPDEBUG_EVENT lpDebugEvent )

Definition at line 692 of file DebDebug.c.

{
  PNODE                  pSearchProcessNode;
  PDEB_PROCESS_NODE_INFO pSearchProcessNodeInfo;
  PDEB_PROCESS_LIST_INFO pProcessListInfo;

  AllocProcessNode( &pSearchProcessNode, &pSearchProcessNodeInfo );
  pSearchProcessNodeInfo->dwProcessId = lpDebugEvent->dwProcessId;
  DeleteProcessNode( pProcessList, pSearchProcessNode );
  //-- if last process? free all temporary memory, exit thread
  pProcessListInfo = (PDEB_PROCESS_LIST_INFO) pProcessList->pListData;
  if( !pProcessListInfo->dwActiveProcesses )
    fFinished = TRUE;
  DestroyProcessNode( pSearchProcessNode );

  return( TRUE );
}

BOOL HandleExitThreadEvent ( LPDEBUG_EVENT lpDebugEvent )

Definition at line 664 of file DebDebug.c.

{
  PNODE                  pProcessNode, pSearchProcessNode;
  PNODE                  pSearchThreadNode;
  PDEB_PROCESS_NODE_INFO pProcessNodeInfo, pSearchProcessNodeInfo;
  PDEB_THREAD_NODE_INFO  pSearchThreadNodeInfo;

  AllocProcessNode( &pSearchProcessNode, &pSearchProcessNodeInfo );
  pSearchProcessNodeInfo->dwProcessId = lpDebugEvent->dwProcessId;
  SetCurrentProcessNode( pProcessList, pSearchProcessNode );
  GetCurrentNode( pProcessList, &pProcessNode );
  pProcessNodeInfo = (PDEB_PROCESS_NODE_INFO) pProcessNode->pNodeData;
  AllocThreadNode( &pSearchThreadNode, &pSearchThreadNodeInfo );
  pSearchThreadNodeInfo->dwThreadId = lpDebugEvent->dwThreadId;
  DeleteThreadNode( pProcessNodeInfo->pThreadList, pSearchThreadNode );
  DestroyThreadNode( pSearchThreadNode );
  DestroyProcessNode( pSearchProcessNode );

  return( TRUE );
}

BOOL HandleLoadDllEvent ( LPDEBUG_EVENT lpDebugEvent )

Definition at line 717 of file DebDebug.c.

{
  PNODE                  pProcessNode, pSearchProcessNode;
  PNODE                  pDllNode;
  PDEB_PROCESS_NODE_INFO pProcessNodeInfo, pSearchProcessNodeInfo;
  PDEB_DLL_NODE_INFO     pDllNodeInfo;

  AllocProcessNode( &pSearchProcessNode, &pSearchProcessNodeInfo );
  pSearchProcessNodeInfo->dwProcessId = lpDebugEvent->dwProcessId;
  SetCurrentProcessNode( pProcessList, pSearchProcessNode );
  GetCurrentNode( pProcessList, &pProcessNode );
  pProcessNodeInfo = (PDEB_PROCESS_NODE_INFO) pProcessNode->pNodeData;
  AllocDllNode( &pDllNode, &pDllNodeInfo );
  InitDllNodeInfo( &pDllNodeInfo, lpDebugEvent );
  InsertDllNode( pProcessNodeInfo->pDllList, pDllNode );
  DestroyProcessNode( pSearchProcessNode );

  return( TRUE );
}

BOOL HandleOutputDebugStringEvent ( LPDEBUG_EVENT lpDebugEvent )

Definition at line 773 of file DebDebug.c.

{
  return( TRUE );
}

BOOL HandleRipEvent ( LPDEBUG_EVENT lpDebugEvent )

Definition at line 785 of file DebDebug.c.

{
  return( TRUE );
}

BOOL HandleUnknownEvent ( LPDEBUG_EVENT lpDebugEvent )

Definition at line 797 of file DebDebug.c.

{
  return( TRUE );
}

BOOL HandleUnloadDllEvent ( LPDEBUG_EVENT lpDebugEvent )

Definition at line 745 of file DebDebug.c.

{
  PNODE                  pProcessNode, pSearchProcessNode;
  PNODE                  pSearchDllNode;
  PDEB_PROCESS_NODE_INFO pProcessNodeInfo, pSearchProcessNodeInfo;
  PDEB_DLL_NODE_INFO     pSearchDllNodeInfo;

  AllocProcessNode( &pSearchProcessNode, &pSearchProcessNodeInfo );
  pSearchProcessNodeInfo->dwProcessId = lpDebugEvent->dwProcessId;
  SetCurrentProcessNode( pProcessList, pSearchProcessNode );
  GetCurrentNode( pProcessList, &pProcessNode );
  pProcessNodeInfo = (PDEB_PROCESS_NODE_INFO) pProcessNode->pNodeData;
  AllocDllNode( &pSearchDllNode, &pSearchDllNodeInfo );
  pSearchDllNodeInfo->DllDebugInfo.lpBaseOfDll = lpDebugEvent->u.UnloadDll.lpBaseOfDll;
  DeleteDllNode( pProcessNodeInfo->pDllList, pSearchDllNode );
  DestroyDllNode( pSearchDllNode );
  DestroyProcessNode( pSearchProcessNode );

  return( TRUE );
}

BOOL InitDllNodeInfo | ( | PDEB_DLL_NODE_INFO * | ppDllNodeInfo,
 |  | LPDEBUG_EVENT | lpDebugEvent
 | ) |  |

Definition at line 1891 of file DebDebug.c.

{
  //-- init info data
  GetDllFileName( lpDebugEvent, (*ppDllNodeInfo)->lpstrFileName, MAX_PATH );
  (*ppDllNodeInfo)->DllDebugInfo = lpDebugEvent->u.LoadDll;

  return( TRUE );
}

BOOL InitProcessNodeInfo | ( | PDEB_PROCESS_NODE_INFO * | ppProcessNodeInfo,
 |  | LPDEBUG_EVENT | lpDebugEvent
 | ) |  |

Definition at line 1411 of file DebDebug.c.

{
  //-- init info data
  (*ppProcessNodeInfo)->dwProcessId = lpDebugEvent->dwProcessId;
  (*ppProcessNodeInfo)->dwThreadId  = lpDebugEvent->dwThreadId;
  // Note:pThreadList initialized via previous CreateThreadList() call
  // Note:pDllList initialized via previous CreateDllList() call
  (*ppProcessNodeInfo)->ProcessDebugInfo = lpDebugEvent->u.CreateProcessInfo;

  return( TRUE );
}

BOOL InitThreadNodeInfo | ( | PDEB_THREAD_NODE_INFO * | ppThreadNodeInfo,
 |  | LPDEBUG_EVENT | lpDebugEvent
 | ) |  |

Definition at line 1654 of file DebDebug.c.

{
  //-- init info data
  (*ppThreadNodeInfo)->dwProcessId     = lpDebugEvent->dwProcessId;
  (*ppThreadNodeInfo)->dwThreadId      = lpDebugEvent->dwThreadId;
  (*ppThreadNodeInfo)->ThreadDebugInfo = lpDebugEvent->u.CreateThread;

  return( TRUE );
}

BOOL InsertDllNode | ( | PLIST | pDllList,
 |  | PNODE | pDllNode
 | ) |  |

Definition at line 1909 of file DebDebug.c.

{
  PDEB_DLL_LIST_INFO pDllListInfo = pDllList->pListData;

  // insert the node
  InsertNode( pDllList, pDllNode );

  //-- increment dwActiveDlls
  pDllListInfo->dwActiveDlls++;

  return( TRUE );
}

BOOL InsertProcessNode | ( | PLIST | pProcessList,
 |  | PNODE | pProcessNode
 | ) |  |

Definition at line 1431 of file DebDebug.c.

{
  PDEB_PROCESS_LIST_INFO pProcessListInfo = pProcessList->pListData;

  //-- insert the node
  InsertNode( pProcessList, pProcessNode );

  //-- increment dwActiveProcesss
  pProcessListInfo->dwActiveProcesses++;

  return( TRUE );
}

BOOL InsertThreadNode | ( | PLIST | pThreadList,
 |  | PNODE | pThreadNode
 | ) |  |

Definition at line 1673 of file DebDebug.c.

{
  PDEB_THREAD_LIST_INFO pThreadListInfo = (PDEB_THREAD_LIST_INFO) pThreadList->pListData;

  //-- insert the thread node
  InsertNode( pThreadList, pThreadNode );

  //-- increment dwActiveThreads
  pThreadListInfo->dwActiveThreads++;

  return( TRUE );
}

int ProcessOrderFunction | ( | PNODE | pNode1,
 |  | PNODE | pNode2
 | ) |  |

Definition at line 1307 of file DebDebug.c.

{
  PDEB_PROCESS_NODE_INFO pProcessNodeInfo1 = pNode1->pNodeData;
  PDEB_PROCESS_NODE_INFO pProcessNodeInfo2 = pNode2->pNodeData;

  if( pProcessNodeInfo1->dwProcessId < pProcessNodeInfo2->dwProcessId )
    return( LIST_LEFT_OF );

  if( pProcessNodeInfo1->dwProcessId > pProcessNodeInfo2->dwProcessId )
    return( LIST_RIGHT_OF );

  return( LIST_MATCH );
}

BOOL SetCurrentDllNode | ( | PLIST | pDllList,
 |  | PNODE | pDllNode
 | ) |  |

Definition at line 1930 of file DebDebug.c.

{
  SetCurrentNode( pDllList, pDllNode, pDllList->OrderFunction );

  return( TRUE );
}

BOOL SetCurrentProcessNode | ( | PLIST | pProcessList,
 |  | PNODE | pProcessNode
 | ) |  |

Definition at line 1452 of file DebDebug.c.

{
  SetCurrentNode( pProcessList, pProcessNode, pProcessList->OrderFunction );

  return( TRUE );
}

BOOL SetCurrentThreadNode | ( | PLIST | pThreadList,
 |  | PNODE | pThreadNode
 | ) |  |

Definition at line 1694 of file DebDebug.c.

{
  SetCurrentNode( pThreadList, pThreadNode, pThreadList->OrderFunction );

  return( TRUE );
}

int ThreadOrderFunction | ( | PNODE | pNode1,
 |  | PNODE | pNode2
 | ) |  |

Definition at line 1557 of file DebDebug.c.

{
  PDEB_THREAD_NODE_INFO pThreadNodeInfo1 = pNode1->pNodeData;
  PDEB_THREAD_NODE_INFO pThreadNodeInfo2 = pNode2->pNodeData;

  if( pThreadNodeInfo1->dwThreadId < pThreadNodeInfo2->dwThreadId )
    return( LIST_LEFT_OF );

  if( pThreadNodeInfo1->dwThreadId > pThreadNodeInfo2->dwThreadId )
    return( LIST_RIGHT_OF );

  return( LIST_MATCH );
}

Variable Documentation

BOOL fFinished = FALSE

Definition at line 36 of file DebDebug.c.

HANDLE hHeap

Definition at line 34 of file DebDebug.c.

PLIST pProcessList

Definition at line 35 of file DebDebug.c.

Generated on Wed Nov 13 2024 16:55:03 for WinXP-Examples by doxygen 1.7.1


WinXP-Examples: WinBase/Debug/Deb/DebDebug.h File Reference

  • WinBase
  • Debug
  • Deb
Classes | Defines | Typedefs | Functions

DebDebug.h File Reference

Go to the source code of this file.

Classes

struct | DEB_DLL_LIST_INFO_STRUCT
struct | DEB_DLL_NODE_INFO_STRUCT
struct | DEB_PROCESS_LIST_INFO_STRUCT
struct | DEB_PROCESS_NODE_INFO_STRUCT
struct | DEB_STARTUP_INFO_STRUCT
struct | DEB_THREAD_LIST_INFO_STRUCT
struct | DEB_THREAD_NODE_INFO_STRUCT

Defines

#define | EXCEPTION_VDM_EVENT ( (LONG) 0x40000005L )

Typedefs

typedef struct
DEB_DLL_LIST_INFO_STRUCT 		DEB_DLL_LIST_INFO
typedef struct
DEB_DLL_NODE_INFO_STRUCT 		DEB_DLL_NODE_INFO
typedef struct
DEB_PROCESS_LIST_INFO_STRUCT 		DEB_PROCESS_LIST_INFO
typedef struct
DEB_PROCESS_NODE_INFO_STRUCT 		DEB_PROCESS_NODE_INFO
typedef struct
DEB_STARTUP_INFO_STRUCT 		DEB_STARTUP_INFO
typedef struct
DEB_THREAD_LIST_INFO_STRUCT 		DEB_THREAD_LIST_INFO
typedef struct
DEB_THREAD_NODE_INFO_STRUCT 		DEB_THREAD_NODE_INFO
typedef struct
DEB_DLL_LIST_INFO_STRUCT * 		PDEB_DLL_LIST_INFO
typedef struct
DEB_DLL_NODE_INFO_STRUCT * 		PDEB_DLL_NODE_INFO
typedef struct
DEB_PROCESS_LIST_INFO_STRUCT * 		PDEB_PROCESS_LIST_INFO
typedef struct
DEB_PROCESS_NODE_INFO_STRUCT * 		PDEB_PROCESS_NODE_INFO
typedef struct
DEB_STARTUP_INFO_STRUCT * 		PDEB_STARTUP_INFO
typedef struct
DEB_THREAD_LIST_INFO_STRUCT * 		PDEB_THREAD_LIST_INFO
typedef struct
DEB_THREAD_NODE_INFO_STRUCT * 		PDEB_THREAD_NODE_INFO

Functions

DWORD WINAPI | DebugEventThread (PDEB_STARTUP_INFO)

Define Documentation

#define EXCEPTION_VDM_EVENT ( (LONG) 0x40000005L )

Definition at line 20 of file DebDebug.h.

Typedef Documentation

typedef struct DEB_DLL_LIST_INFO_STRUCT DEB_DLL_LIST_INFO
typedef struct DEB_DLL_NODE_INFO_STRUCT DEB_DLL_NODE_INFO
typedef struct DEB_PROCESS_LIST_INFO_STRUCT DEB_PROCESS_LIST_INFO
typedef struct DEB_PROCESS_NODE_INFO_STRUCT DEB_PROCESS_NODE_INFO
typedef struct DEB_STARTUP_INFO_STRUCT DEB_STARTUP_INFO
typedef struct DEB_THREAD_LIST_INFO_STRUCT DEB_THREAD_LIST_INFO
typedef struct DEB_THREAD_NODE_INFO_STRUCT DEB_THREAD_NODE_INFO
typedef struct DEB_DLL_LIST_INFO_STRUCT* PDEB_DLL_LIST_INFO

Definition at line 45 of file DebDebug.h.

typedef struct DEB_DLL_NODE_INFO_STRUCT* PDEB_DLL_NODE_INFO

Definition at line 69 of file DebDebug.h.

typedef struct DEB_PROCESS_LIST_INFO_STRUCT* PDEB_PROCESS_LIST_INFO

Definition at line 35 of file DebDebug.h.

typedef struct DEB_PROCESS_NODE_INFO_STRUCT* PDEB_PROCESS_NODE_INFO

Definition at line 51 of file DebDebug.h.

typedef struct DEB_STARTUP_INFO_STRUCT* PDEB_STARTUP_INFO

Definition at line 23 of file DebDebug.h.

typedef struct DEB_THREAD_LIST_INFO_STRUCT* PDEB_THREAD_LIST_INFO

Definition at line 40 of file DebDebug.h.

typedef struct DEB_THREAD_NODE_INFO_STRUCT* PDEB_THREAD_NODE_INFO

Definition at line 62 of file DebDebug.h.

Function Documentation

DWORD WINAPI DebugEventThread ( PDEB_STARTUP_INFO )

Definition at line 120 of file DebDebug.c.

{
  #define BUFFER_SIZE 256

  static BOOL  fFirstTime = TRUE;
  static TCHAR szDebuggeeTitle[128];

  DEBUG_EVENT  DebugEvent;

  LPTSTR lpszDebugEventBuffer;
  LPTSTR lpszTempBuffer;
  LPTSTR lpszRawBuffer;

  //-- set the minimum error level for debugging events
  SetDebugErrorLevel( Profile.DebugErrorLevel );

  if( fFirstTime ) {
    if( !LoadString( Global.hInstance, IDS_OFN_DEBUGGEE_TITLE, szDebuggeeTitle,
           sizeof(szDebuggeeTitle)/sizeof(TCHAR) ) )
      ErrorMessageBox( TEXT("LoadString()"),
        Global.szApiFailed, szSourceFileName, __LINE__ );
  }

  //-- determine if 'attach to' or 'open new' debuggee
  if( pDebStartupInfo->fActive ) {
    if( !DebugActiveProcess( pDebStartupInfo->dwProcessId ) )
      ErrorMessageBox( TEXT("DebugActiveProcess()"),
        Global.szApiFailed, szSourceFileName, __LINE__ );
  }
  else {
    if( !DebugNewProcess( pDebStartupInfo->lpstrPathName, szDebuggeeTitle ) )
    ExitThread( FALSE );
  }

  //-- increment active process count
  Global.dwActiveDebuggees++;

  //-- create a local heap
  {
    SYSTEM_INFO SysInfo;

    GetSystemInfo( &SysInfo );  // get the system memory page size
    hHeap = HeapCreate( 0L, SysInfo.dwPageSize, 1000*SysInfo.dwPageSize );
  }

  //-- create and initialize the process list
  CreateProcessList( &pProcessList );

  //-- alloc temporary (life of thread) string buffers
  lpszDebugEventBuffer = (LPTSTR) HeapAlloc( hHeap, 0L, BUFFER_SIZE * sizeof(TCHAR) );
  lpszTempBuffer = (LPTSTR) HeapAlloc( hHeap, 0L, BUFFER_SIZE * sizeof(TCHAR) );
  lpszRawBuffer = (LPTSTR) HeapAlloc( hHeap, 0L, BUFFER_SIZE * sizeof(TCHAR) );

  // ----------------------------------------------------------------------
  // begin debug event processing loop
  // ----------------------------------------------------------------------
  for(;;) {

    //-- wait for debug events
    if( !WaitForDebugEvent( &DebugEvent, INFINITE ) ) {
      ListBoxPrintF( pDebStartupInfo->hWndListBox, TEXT( "%s" ), TEXT( "Failed to attach to Debuggee..." ) );
      fFinished = TRUE;
      break;
    }

    // --------------------------------------------------------------------
    // display each debug event as it occurs and handle minimal debug
    // event processing
    // --------------------------------------------------------------------
    MakeCommonDebugEventString( lpszDebugEventBuffer, BUFFER_SIZE, &DebugEvent );

    switch( DebugEvent.dwDebugEventCode ) {

      // ------------------------------------------------------------------
      // exception occured
      // ------------------------------------------------------------------
      case EXCEPTION_DEBUG_EVENT:

        //-- figure out which type of exception
        switch( DebugEvent.u.Exception.ExceptionRecord.ExceptionCode ) {

          //--standard exceptions
          case EXCEPTION_ACCESS_VIOLATION:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s" ),
              TEXT( "Exception: " ), TEXT( "Access Violation" ) );
            break;

          case EXCEPTION_DATATYPE_MISALIGNMENT:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s" ),
              TEXT( "Exception: " ), TEXT( "Datatype Misalignment" ) );
            break;

          case EXCEPTION_BREAKPOINT:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s" ),
              TEXT( "Exception: " ), TEXT( "Breakpoint" ) );
            break;

          case EXCEPTION_SINGLE_STEP:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s" ),
              TEXT( "Exception: " ), TEXT( "Single Step" ) );
            break;

          case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s" ),
              TEXT( "Exception: " ), TEXT( "Array Bound Exceeded" ) );
            break;

          case EXCEPTION_FLT_DENORMAL_OPERAND:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s %s" ),
              TEXT( "Exception: " ), TEXT( "Floating Point" ),
              TEXT( "Denormal Operand" ) );
            break;

          case EXCEPTION_FLT_DIVIDE_BY_ZERO:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s %s" ),
              TEXT( "Exception: " ), TEXT( "Floating Point" ),
              TEXT( "Divide By Zero" ) );
            break;

          case EXCEPTION_FLT_INEXACT_RESULT:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s %s" ),
              TEXT( "Exception: " ), TEXT( "Floating Point" ),
              TEXT( "Inexact Result" ) );
            break;

          case EXCEPTION_FLT_INVALID_OPERATION:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s %s" ),
              TEXT( "Exception: " ), TEXT( "Floating Point" ),
              TEXT( "Invalid Operation" ) );
            break;

          case EXCEPTION_FLT_OVERFLOW:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s %s" ),
              TEXT( "Exception: " ), TEXT( "Floating Point" ),
              TEXT( "Overflow" ) );
            break;

          case EXCEPTION_FLT_STACK_CHECK:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s %s" ),
              TEXT( "Exception: " ), TEXT( "Floating Point" ),
              TEXT( "Stack Check" ) );
            break;

          case EXCEPTION_FLT_UNDERFLOW:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s %s" ),
              TEXT( "Exception: " ), TEXT( "Floating Point" ),
              TEXT( "Underflow" ) );
            break;

          case EXCEPTION_INT_DIVIDE_BY_ZERO:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s %s" ),
              TEXT( "Exception: " ), TEXT( "Integer" ),
              TEXT( "Divide By Zero" ) );
            break;

          case EXCEPTION_INT_OVERFLOW:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s %s" ),
              TEXT( "Exception: " ), TEXT( "Integer" ),
              TEXT( "Overflow" ) );
            break;

          case EXCEPTION_PRIV_INSTRUCTION:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s" ),
              TEXT( "Exception: " ), TEXT( "Privileged Instruction" ) );
            break;

          case EXCEPTION_IN_PAGE_ERROR:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s" ),
              TEXT( "Exception: " ), TEXT( "In Page Error" ) );
            break;

          //-- Debug exceptions
          case DBG_TERMINATE_THREAD:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s" ),
              TEXT( "Debug Exception: " ), TEXT( "Terminate Thread" ) );
            break;

          case DBG_TERMINATE_PROCESS:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s" ),
              TEXT( "Debug Exception: " ), TEXT( "Terminate Process" ) );
            break;

          case DBG_CONTROL_C:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s" ),
              TEXT( "Debug Exception: " ), TEXT( "Control+C" ) );
            break;

          case DBG_CONTROL_BREAK:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s" ),
              TEXT( "Debug Exception: " ), TEXT( "Control+Break" ) );
            break;

          //-- RPC exceptions (some)
          case RPC_S_UNKNOWN_IF:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s" ),
              TEXT( "RPC Exception: " ), TEXT( "Unknown Interface" ) );
            break;

          case RPC_S_SERVER_UNAVAILABLE:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s" ),
              TEXT( "RPC Exception: " ), TEXT( "Server Unavailable" ) );
            break;

          //-- VDM exceptions (minimal information)
          case EXCEPTION_VDM_EVENT:  // see DEBDebug.H for definition
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s" ),
              TEXT( "VDM Exception: " ) );

          default:
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%s%X%s" ),
              TEXT( "Exception: " ), TEXT( "Unknown [0x" ),
               DebugEvent.u.Exception.ExceptionRecord.ExceptionCode,
               TEXT( "]" ) );
            break;

        }
        if( Profile.fVerbose ) {
          StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "\n + %s%d" ),
            TEXT( "dwFirstChance: " ), DebugEvent.u.Exception.dwFirstChance );
        }
        else {
          if( DebugEvent.u.Exception.dwFirstChance != 0 )
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s" ),
              TEXT( " - First Chance" ) );
          else
            StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s" ),
              TEXT( " - Second Chance" ) );
        }
        HandleExceptionEvent( &DebugEvent );
        break;

      // ------------------------------------------------------------------
      // new thread started
      // ------------------------------------------------------------------
      case CREATE_THREAD_DEBUG_EVENT:
        StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s" ),
          TEXT( "Create Thread: " ) );
        if( Profile.fVerbose ) {
          StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "\n + %s%d\n + %s%X\n + %s%d" ),
            TEXT( "hThread:0x" ), DebugEvent.u.CreateThread.hThread,
            TEXT( "lpThreadLocalBase:0x" ), DebugEvent.u.CreateThread.lpThreadLocalBase,
            TEXT( "lpStartAddress:0x" ), DebugEvent.u.CreateThread.lpStartAddress );
        }
        HandleCreateThreadEvent( &DebugEvent );
        break;

      // ------------------------------------------------------------------
      // new process started
      // ------------------------------------------------------------------
      case CREATE_PROCESS_DEBUG_EVENT:
        StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s" ),
          TEXT( "Create Process: " ) );
        if( Profile.fVerbose ) {
          StringAppendF( lpszDebugEventBuffer,
BUFFER_SIZE,             TEXT( "\n + %s%X\n + %s%X\n + %s%X\n + %s%X\n + %s%d" )
            TEXT( "\n + %s%d\n + %s%X\n + %s%X\n + %s%X\n + %s%d" ),
            TEXT( "hFile:0x" ), DebugEvent.u.CreateProcessInfo.hFile,
            TEXT( "hProcess:0x" ), DebugEvent.u.CreateProcessInfo.hProcess,
            TEXT( "hThread:0x" ), DebugEvent.u.CreateProcessInfo.hThread,
            TEXT( "lpBaseOfImage:0x" ), DebugEvent.u.CreateProcessInfo.lpBaseOfImage,
            TEXT( "dwDebugInfoFileOffset: " ), DebugEvent.u.CreateProcessInfo.dwDebugInfoFileOffset,
            TEXT( "nDebugInfoSize: " ), DebugEvent.u.CreateProcessInfo.nDebugInfoSize,
            TEXT( "lpThreadLocalBase:0x" ), DebugEvent.u.CreateProcessInfo.lpThreadLocalBase,
            TEXT( "lpStartAddress:0x" ), DebugEvent.u.CreateProcessInfo.lpStartAddress,
            TEXT( "lpImageName:0x" ), DebugEvent.u.CreateProcessInfo.lpImageName,
            TEXT( "fUnicode: " ), DebugEvent.u.CreateProcessInfo.fUnicode );
        }
        HandleCreateProcessEvent( &DebugEvent );
        break;

      // ------------------------------------------------------------------
      // existing thread terminated
      // ------------------------------------------------------------------
      case EXIT_THREAD_DEBUG_EVENT:
        StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s" ),
          TEXT( "Exit Thread: " ) );
        if( Profile.fVerbose ) {
          StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "\n + %s%d" ),
            TEXT( "dwExitCode: " ), DebugEvent.u.ExitThread.dwExitCode );
        }
        else {
          StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%d" ),
            TEXT( "Returned " ), DebugEvent.u.ExitThread.dwExitCode );
        }
        HandleExitThreadEvent( &DebugEvent );
        break;

      // ------------------------------------------------------------------
      // existing process terminated
      // ------------------------------------------------------------------
      case EXIT_PROCESS_DEBUG_EVENT:
        StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s" ),
          TEXT( "Exit Process: " ) );
        if( Profile.fVerbose ) {
          StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "\n + %s%d" ),
            TEXT( "dwExitCode: " ), DebugEvent.u.ExitProcess.dwExitCode );
        }
        else {
          StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%d" ),
            TEXT( "Returned " ), DebugEvent.u.ExitProcess.dwExitCode );
        }
        HandleExitProcessEvent( &DebugEvent );
        break;

      // ------------------------------------------------------------------
      // new DLL loaded
      // ------------------------------------------------------------------
      case LOAD_DLL_DEBUG_EVENT:
        StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s" ),
          TEXT( "Load DLL: " ) );
        StringCbCopy( lpszTempBuffer, sizeof(lpszTempBuffer) , TEXT("Empty!") );
        GetDllFileName( &DebugEvent, lpszTempBuffer, BUFFER_SIZE );
        StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s" ), lpszTempBuffer );
        if( Profile.fVerbose ) {
          StringAppendF( lpszDebugEventBuffer,
BUFFER_SIZE,             TEXT( "\n + %s%X\n + %s%X\n + %s%d\n + %s%d\n + %s%X\n + %s%d" ),
            TEXT( "hFile:0x" ), DebugEvent.u.LoadDll.hFile,
            TEXT( "lpBaseOfDll:0x" ), DebugEvent.u.LoadDll.lpBaseOfDll,
            TEXT( "dwDebugInfoFileOffset: " ), DebugEvent.u.LoadDll.dwDebugInfoFileOffset,
            TEXT( "nDebugInfoSize: " ), DebugEvent.u.LoadDll.nDebugInfoSize,
            TEXT( "lpImageName:0x" ), DebugEvent.u.LoadDll.lpImageName,
            TEXT( "fUnicode: " ), DebugEvent.u.LoadDll.fUnicode );
        }
        HandleLoadDllEvent( &DebugEvent );
        break;

      // ------------------------------------------------------------------
      // existing DLL explicitly unloaded
      // ------------------------------------------------------------------
      case UNLOAD_DLL_DEBUG_EVENT:
        StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s" ), TEXT( "Unload DLL: " ) );
        GetDllFileNameFromList( &DebugEvent, lpszTempBuffer, BUFFER_SIZE );
        StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s" ), lpszTempBuffer );
        if( Profile.fVerbose ) {
          StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "\n + %s%X" ),
            TEXT( "lpBaseOfDLL:0x" ), DebugEvent.u.UnloadDll.lpBaseOfDll );
        }
        HandleUnloadDllEvent( &DebugEvent );
        break;

      // ------------------------------------------------------------------
      // OutputDebugString() occured
      // ------------------------------------------------------------------
      case OUTPUT_DEBUG_STRING_EVENT:
        StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s" ),
          TEXT( "Output Debug String: " ) );
        GetOutputDebugString( &DebugEvent, lpszTempBuffer, BUFFER_SIZE,
                              lpszRawBuffer, BUFFER_SIZE );
        StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s" ), lpszTempBuffer );
        if( Profile.fVerbose ) {
          StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "\n + %s%X\n + %s%d\n + %s%d" ),
            TEXT( "lpDebugStringData:0x" ), DebugEvent.u.DebugString.lpDebugStringData,
            TEXT( "fUnicode: " ), DebugEvent.u.DebugString.fUnicode,
            TEXT( "nDebugStringLength: " ), DebugEvent.u.DebugString.nDebugStringLength );
        }
        HandleOutputDebugStringEvent( &DebugEvent );
        break;

      // ------------------------------------------------------------------
      // RIP occured
      // ------------------------------------------------------------------
      case RIP_EVENT:
        StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s" ),
          TEXT( "RIP" ) );
        if( Profile.fVerbose ) {
          StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "\n + %s%d\n + %s%d" ),
            TEXT( "dwError: " ), DebugEvent.u.RipInfo.dwError,
            TEXT( "dwType: " ), DebugEvent.u.RipInfo.dwType );
        }
        HandleRipEvent( &DebugEvent );
        break;

      // ------------------------------------------------------------------
      // unknown debug event occured
      // ------------------------------------------------------------------
      default:
        StringAppendF( lpszDebugEventBuffer, BUFFER_SIZE, TEXT( "%s%X%s" ),
          TEXT( "Debug Event:Unknown [0x" ),
          DebugEvent.dwDebugEventCode, lpszTempBuffer,
          TEXT( "]" ) );
        HandleUnknownEvent( &DebugEvent );
        break;
    }

    //-- insert the debug event string into the listbox
    ListBoxPrintF( pDebStartupInfo->hWndListBox, TEXT( "%s" ), lpszDebugEventBuffer );

    //-- default action, just continue
    if( fFinished ) {
      fFinished = FALSE;   // reset the value
      break;
    }
    else
      ContinueDebugEvent( DebugEvent.dwProcessId, DebugEvent.dwThreadId,
        DBG_CONTINUE );
  }

  //-- free temporary (life of thread) string buffers
  HeapFree( hHeap, 0L, (PVOID) lpszDebugEventBuffer );
  HeapFree( hHeap, 0L, (PVOID) lpszTempBuffer );
  HeapFree( hHeap, 0L, (PVOID) lpszRawBuffer );

  //-- free list
  DestroyProcessList( pProcessList );

  //-- free the heap
  HeapDestroy( hHeap );

  //-- decrement active process count
  Global.dwActiveDebuggees--;
  ExitThread( TRUE );

  return( TRUE );  // avoid the "no return value" warning
}

Generated on Wed Nov 13 2024 16:55:03 for WinXP-Examples by doxygen 1.7.1